diff --git a/.circleci/config.yml b/.circleci/config.yml index cb085191b714..c5f9a1781d4f 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,4 +1,5 @@ -version: 2 +version: 2.1 + aliases: - &restore-node-modules-cache keys: @@ -24,33 +25,187 @@ aliases: - &artifact_babel_min path: ~/babel/packages/babel-standalone/babel.min.js - - &artifact_env - path: ~/babel/packages/babel-preset-env-standalone/babel-preset-env.js + - &test262_workdir + working_directory: ~/babel/babel-test262-runner - - &artifact_env_min - path: ~/babel/packages/babel-preset-env-standalone/babel-preset-env.min.js + - &artifact_test262_tap + path: ~/test262.tap -jobs: - build: + - &artifact_test262_xunit + path: ~/test-results + + - &artifact_test262_diff_tap + path: ~/diff.tap + +executors: + node-executor: + docker: + - image: circleci/node:latest working_directory: ~/babel + # e2e-vue-cli test requires chromium + node-browsers-executor: docker: - - image: circleci/node:12 + - image: circleci/node:latest-browsers + working_directory: ~/babel + +jobs: + build-standalone: + executor: node-executor steps: - checkout - - restore-cache: *restore-yarn-cache - - restore-cache: *restore-node-modules-cache - - run: yarn --version - - run: make test-ci-coverage - # Builds babel-standalone with the regular Babel config - - run: IS_PUBLISH=true make build - # test-ci-coverage doesn't test babel-standalone, as trying to gather coverage - # data for a JS file that's several megabytes large is bound to fail. Here, - # we just run the babel-standalone test separately. - - run: ./node_modules/.bin/jest packages/babel-standalone/test/ - - run: ./node_modules/.bin/jest packages/babel-preset-env-standalone/test/ + - restore_cache: *restore-yarn-cache + - restore_cache: *restore-node-modules-cache + # Builds babel-standalone with the regular Babel config + # test-ci-coverage doesn't test babel-standalone, as trying to gather coverage + - run: IS_PUBLISH=true make -j build-standalone-ci + # data for a JS file that's several megabytes large is bound to fail. Here, + # we just run the babel-standalone test separately. + - run: yarn jest "\-standalone/test" - store_artifacts: *artifact_babel - store_artifacts: *artifact_babel_min - - store_artifacts: *artifact_env - - store_artifacts: *artifact_env_min - save_cache: *save-node-modules-cache - save_cache: *save-yarn-cache + + test262: + executor: node-executor + steps: + - checkout + - run: + name: Sync with latest master branch (only on PRs) + command: | + if [ -n "$CIRCLE_PULL_REQUEST" ] + then + git fetch origin refs/pull/$CIRCLE_PR_NUMBER/merge + git checkout -qf FETCH_HEAD + fi + - restore_cache: *restore-yarn-cache + - restore_cache: *restore-node-modules-cache + - run: + name: Build Babel + command: BABEL_ENV=test make bootstrap + - run: + name: Setup Test Runner + command: | + git clone --recurse-submodules https://github.com/babel/babel-test262-runner + cd babel-test262-runner + npm ci + npm i tap-mocha-reporter --save-dev + node lib/download-node + - run: + name: Download master branch Test262 artifact + command: node lib/download-master-artifact ~/master.tap + <<: *test262_workdir + - run: + name: Run Test262 + command: BABEL_PATH=.. node lib/run-tests I_AM_SURE | tee ~/test262.tap + <<: *test262_workdir + - store_artifacts: *artifact_test262_tap + - run: + name: Output Test262 results + command: | + cat ~/test262.tap | $(npm bin)/tap-mocha-reporter spec || true + <<: *test262_workdir + - run: + name: Compare previous master branch & current job results + command: | + mkdir -p ~/test-results/test262 + node lib/compare-results ~/master.tap ~/test262.tap | tee ~/diff.tap + <<: *test262_workdir + - store_artifacts: *artifact_test262_diff_tap + - run: + name: Output comparision results and report to CircleCI + command: | + mkdir -p ~/test-results/test262 + cat ~/diff.tap | $(npm bin)/tap-merge | $(npm bin)/tap-mocha-reporter xunit | tee ~/test-results/test262/results.xml + <<: *test262_workdir + - store_test_results: *artifact_test262_xunit + - save_cache: *save-node-modules-cache + - save_cache: *save-yarn-cache + + publish-verdaccio: + executor: node-executor + steps: + - checkout + - run: yarn install + - run: ./scripts/integration-tests/publish-local.sh + - persist_to_workspace: + root: /tmp/verdaccio-workspace + paths: + - storage + - htpasswd + + e2e-babel: + executor: node-executor + steps: + - checkout + - attach_workspace: + at: /tmp/verdaccio-workspace + - run: ./scripts/integration-tests/e2e-babel.sh + + e2e-babel-old-version: + executor: node-executor + steps: + - checkout + - attach_workspace: + at: /tmp/verdaccio-workspace + - run: ./scripts/integration-tests/e2e-babel-old-version.sh + + e2e-create-react-app: + executor: node-executor + steps: + - checkout + - attach_workspace: + at: /tmp/verdaccio-workspace + - run: ./scripts/integration-tests/e2e-create-react-app.sh + + e2e-vue-cli: + executor: node-browsers-executor + steps: + - checkout + - attach_workspace: + at: /tmp/verdaccio-workspace + - run: ./scripts/integration-tests/e2e-vue-cli.sh + +workflows: + version: 2 + build-standalone: + jobs: + - build-standalone + test262-master: + jobs: + - test262: + filters: + branches: + only: + - master + test262: + jobs: + - approve-test262-run: + type: approval + filters: + branches: + ignore: + - master + - test262: + requires: + - approve-test262-run + filters: + branches: + ignore: + - master + e2e: + jobs: + - publish-verdaccio + - e2e-babel: + requires: + - publish-verdaccio + - e2e-babel-old-version: + requires: + - publish-verdaccio + - e2e-create-react-app: + requires: + - publish-verdaccio + - e2e-vue-cli: + requires: + - publish-verdaccio + diff --git a/.codesandbox/ci.json b/.codesandbox/ci.json new file mode 100644 index 000000000000..a349bd52660c --- /dev/null +++ b/.codesandbox/ci.json @@ -0,0 +1,6 @@ +{ + "installCommand": "codesandbox", + "buildCommand": false, + "sandboxes": ["9d0wg", "7s08o"], + "packages": ["packages/*"] +} diff --git a/.eslintignore b/.eslintignore index 092fbbb802cd..1fba0618658f 100644 --- a/.eslintignore +++ b/.eslintignore @@ -17,10 +17,13 @@ codemods/*/lib codemods/*/dist codemods/*/test/fixtures codemods/*/test/tmp -packages/babel-preset-env/data +packages/babel-compat-data/build +packages/babel-preset-env/data/[^(plugin-features|shipped-proposals).js] packages/babel-preset-env/test/debug-fixtures -packages/babel-preset-env-standalone/babel-preset-env.js -packages/babel-preset-env-standalone/babel-preset-env.min.js packages/babel-standalone/babel.js packages/babel-standalone/babel.min.js packages/babel-parser/test/expressions + +eslint/*/lib +eslint/*/node_modules +eslint/*/test/fixtures diff --git a/.eslintrc.js b/.eslintrc.js new file mode 100644 index 000000000000..6eea9bc6f6fc --- /dev/null +++ b/.eslintrc.js @@ -0,0 +1,59 @@ +const path = require("path"); + +module.exports = { + root: true, + plugins: ["prettier", "@babel/development", "import", "jest"], + // replace it by `@babel/internal` when `@babel/eslint-config-internal` is published + extends: path.resolve(__dirname, "eslint/babel-eslint-config-internal"), + rules: { + "prettier/prettier": "error", + // TODO: remove after babel-eslint-config-internal is fully integrated into this repository. + "max-len": "off", + }, + env: { + node: true, + }, + overrides: [ + { + files: [ + "packages/*/src/**/*.js", + "codemods/*/src/**/*.js", + "eslint/*/src/**/*.js", + ], + rules: { + "@babel/development/no-undefined-identifier": "error", + "@babel/development/no-deprecated-clone": "error", + "import/no-extraneous-dependencies": "error", + "guard-for-in": "error", + }, + }, + { + files: [ + "packages/*/test/**/*.js", + "codemods/*/test/**/*.js", + "eslint/*/test/**/*.js", + "packages/babel-helper-transform-fixture-test-runner/src/helpers.js", + "test/**/*.js", + ], + env: { + jest: true, + }, + extends: "plugin:jest/recommended", + rules: { + "jest/expect-expect": "off", + "jest/no-identical-title": "off", + "jest/no-standalone-expect": "off", + "jest/no-test-callback": "off", + "jest/valid-describe": "off" + } + }, + { + files: ["packages/babel-plugin-*/src/index.js"], + excludedFiles: ["packages/babel-plugin-transform-regenerator/**/*.js"], + rules: { + "@babel/development/plugin-name": "error", + eqeqeq: ["error", "always", { null: "ignore" }], + }, + }, + ], +}; diff --git a/.eslintrc.json b/.eslintrc.json deleted file mode 100644 index a59dc0d9e2dd..000000000000 --- a/.eslintrc.json +++ /dev/null @@ -1,41 +0,0 @@ -{ - "root": true, - "plugins": ["prettier", "@babel/development", "import"], - "extends": "babel", - "rules": { - "prettier/prettier": "error" - }, - "env": { - "node": true - }, - "overrides": [ - { - "files": ["packages/*/src/**/*.js", "codemods/*/src/**/*.js"], - "rules": { - "@babel/development/no-undefined-identifier": "error", - "@babel/development/no-deprecated-clone": "error", - "import/no-extraneous-dependencies": "error", - "guard-for-in": "error" - } - }, - { - "files": [ - "packages/*/test/**/*.js", - "codemods/*/test/**/*.js", - "packages/babel-helper-transform-fixture-test-runner/src/helpers.js", - "test/**/*.js" - ], - "env": { - "jest": true - } - }, - { - "files": ["packages/babel-plugin-*/src/index.js"], - "excludedFiles": ["packages/babel-plugin-transform-regenerator/**/*.js"], - "rules": { - "@babel/development/plugin-name": "error", - "eqeqeq": ["error", "always", { "null": "ignore" }] - } - } - ] -} diff --git a/.flowconfig b/.flowconfig index 694811e55964..77b3550cda2b 100644 --- a/.flowconfig +++ b/.flowconfig @@ -14,6 +14,7 @@ codemods/*/src lib/file.js lib/parser.js lib/third-party-libs.js.flow +lib/preset-modules.js.flow packages/babel-types/lib/index.js.flow [options] @@ -24,4 +25,6 @@ suppress_comment= \\(.\\|\n\\)*\\$FlowIgnore suppress_type=$FlowFixMe suppress_type=$FlowSubtype esproposal.export_star_as=enable +esproposal.optional_chaining=enable +esproposal.nullish_coalescing=enable module.name_mapper='^@babel\/\([a-zA-Z0-9_\-]+\)$' -> '/packages/babel-\1/src/index' diff --git a/packages/babel-preset-env/CHANGELOG.md b/.github/CHANGELO-preset-env-v0-v1.md similarity index 100% rename from packages/babel-preset-env/CHANGELOG.md rename to .github/CHANGELO-preset-env-v0-v1.md diff --git a/.github/CHANGELOG-6to5.md b/.github/CHANGELOG-6to5.md index 45afe2368d8d..88016f402214 100644 --- a/.github/CHANGELOG-6to5.md +++ b/.github/CHANGELOG-6to5.md @@ -122,7 +122,7 @@ * Restructure transformers so they're only ran if the AST contains nodes that they need to worry about. Improves transpilation speed significantly. * **Bug Fix** * Fix source maps not tracking end of node locations. - * **Spec Compliancy** + * **Spec Compliance** * Use static super references as the home object is actually done at definition time. * **Polish** * Force the `es6.destructuring` transformer to be whitelisted when the `es7.objectSpread` transformer is. @@ -479,7 +479,7 @@ ## 2.12.3 - * **Spec Compliancy** + * **Spec Compliance** * Optional `typeof` transformer checks for `undefined` before passing it to the helper. * Class methods are now named. @@ -551,7 +551,7 @@ * Add `classesFastSuper` optional transformer that doesn't support parent getters and prototype changing. * Add `forOfFast` transformer that speeds up `for...of` on arrays but produces more code. * Add `--react-compat` to `bin/6to5`. - * **Spec Compliancy** + * **Spec Compliance** * Disallow setters without a single parameter. * Add `configurable` and `writable` to defined properties. * Use define instead of assignment for class methods. @@ -619,7 +619,7 @@ ## 2.7.0 - * **Spec Compliancy** + * **Spec Compliance** * Disallow reassignments of imports. * **New Feature** * `reactCompat` option to enable pre-v0.12 react components. @@ -662,7 +662,7 @@ * **Polish** * Move `"use strict";` to inside module bodies instead of at the top of the file. * Better handling of dynamic imports. - * **Spec Compliancy** + * **Spec Compliance** * Class inheritance now has a `function` or `null` type check. * Add `interopRequireWildcard` around wildcard imports and exports to handle non-object exports. diff --git a/.github/CHANGELOG-v4.md b/.github/CHANGELOG-v4.md index 7a06b2c93eee..ea6c1d496f50 100644 --- a/.github/CHANGELOG-v4.md +++ b/.github/CHANGELOG-v4.md @@ -110,7 +110,7 @@ * Throw an error on different `babel` and `babel-runtime` versions. * Replicate module environment for `babel-node` eval. * Clean up classes output. - * **Spec Compliancy** + * **Spec Compliance** * Make it illegal to use a rest parameter on a setter. ## 4.6.6 @@ -150,8 +150,8 @@ * **New Feature** * Desugar sticky regexes to a new constructor expression so it can be handled by a polyfill. - * **Spec Compliancy** - * `for...of` now outputs in a lengthy `try...catch` this is to ensure spec compliancy in regards to iterator returns and abrupt completions. See [google/traceur-compiler#1773](https://github.com/google/traceur-compiler/issues/1773) and [babel/babel/#838](https://github.com/babel/babel/issues/838) for more information. + * **Spec Compliance** + * `for...of` now outputs in a lengthy `try...catch` this is to ensure spec compliance in regards to iterator returns and abrupt completions. See [google/traceur-compiler#1773](https://github.com/google/traceur-compiler/issues/1773) and [babel/babel/#838](https://github.com/babel/babel/issues/838) for more information. * **Polish** * Rest parameters that are only referred to via number properties on member expressions are desugared into a direct `arguments` reference. Thanks [@neVERberleRfellerER](https://github.com/neVERberleRfellerER)! * `$ babel` no longer exits on syntax errors. diff --git a/.github/CHANGELOG-v5.md b/.github/CHANGELOG-v5.md index 64d4999d58df..30d9f2d051ff 100644 --- a/.github/CHANGELOG-v5.md +++ b/.github/CHANGELOG-v5.md @@ -12,7 +12,7 @@ ## 5.8.24 - * **Spec Compliancy** + * **Spec Compliance** * Updated `optimisation.react.inlineElements` transformer to React 0.14 output. Thanks [@spicyj](https://github.com/spicyj)! * **Polish** * Add support for evaluating more static nodes. Thanks [@hzoo](https://github.com/hzoo)! @@ -451,7 +451,7 @@ Issues with publish process. ![gifs lol](https://31.media.tumblr.com/568205a0e37ae15eca510fa639589a59/tumblr_n8kw8kpcSb1sg6cg8o1_500.gif) - * **Spec Compliancy** + * **Spec Compliance** * Allow trailing param commas for methods when using the `es7.trailingCommas` transformer. * **Bug Fix** * Fix `es6.blockScoping` transformer not properly ignoring `break` in `SwitchCase`. @@ -481,7 +481,7 @@ Issues with publish process. * Fix correct function scope being passed to `nameMethod.property` when inferring the function name for class methods. * Fix incorrect extensions reference causing weird issues when using the Babel CLI. * Fix destructuring param reference replacements not inheriting from their original param. - * **Spec Compliancy** + * **Spec Compliance** * Fix order that method decorators are ran in. ## 5.2.15 @@ -616,7 +616,7 @@ Issues with publish process. * Fix `externalHelpers` option being incorrectly listed as type `string`. * **Internal** * Upgrade `core-js` to `0.9.0`. - * **Spec Compliancy** + * **Spec Compliance** * Fix object decorators not using the `initializer` pattern. * Remove property initializer descriptor reflection. diff --git a/.github/CHANGELOG-v6.md b/.github/CHANGELOG-v6.md index 92d9173db5b8..4094b38395a1 100644 --- a/.github/CHANGELOG-v6.md +++ b/.github/CHANGELOG-v6.md @@ -22,7 +22,7 @@ > Backports for some folks (also other's when we accidentally merged PRs from both 6.x/master) > Lesson learned: just use `master` and backport on another branch. -#### :eyeglasses: Spec Compliancy +#### :eyeglasses: Spec Compliance * `babel-core`, `babel-generator`, `babel-plugin-transform-flow-comments`, `babel-plugin-transform-flow-strip-types`, `babel-traverse`, `babel-types` * [#6081](https://github.com/babel/babel/pull/6081) Flow opaque type 6.x backport. ([@jbrown215](https://github.com/jbrown215)) @@ -1468,7 +1468,7 @@ It's a one-time use tool (helpful after the initial release when upgrading from ## v6.17.0 (2016-10-01) -#### :eyeglasses: Spec Compliancy +#### :eyeglasses: Spec Compliance * `babel-preset-stage-2`, `babel-preset-stage-3` * [#4617](https://github.com/babel/babel/pull/4617) Move async-generators to stage-3. ([@hzoo](https://github.com/hzoo)) @@ -1476,7 +1476,7 @@ It's a one-time use tool (helpful after the initial release when upgrading from Specification repo: https://github.com/tc39/proposal-async-iteration -Asynchronous Iteration was already added in [6.16.0](http://babeljs.io/blog/2016/09/28/6.16.0#spec-compliancy) under stage-2 but it was moved to stage-3 at the [latest TC-39 meeting](https://github.com/tc39/agendas/blob/master/2016/09.md#agenda-for-the-54th-meeting-of-ecma-tc39). +Asynchronous Iteration was already added in [6.16.0](http://babeljs.io/blog/2016/09/28/6.16.0#spec-compliance) under stage-2 but it was moved to stage-3 at the [latest TC-39 meeting](https://github.com/tc39/agendas/blob/master/2016/09.md#agenda-for-the-54th-meeting-of-ecma-tc39). ```js // async generator syntax @@ -1569,7 +1569,7 @@ First PR! Babel 6.16: Happy 2nd Birthday 🎂! -#### :eyeglasses: Spec Compliancy +#### :eyeglasses: Spec Compliance * `babel-core`, `babel-generator`, `babel-helper-remap-async-to-generator`, `babel-helpers`, `babel-plugin-transform-async-generator-functions`, `babel-types`, `babel-preset-stage-2`, ... * [#3473](https://github.com/babel/babel/pull/3473) via [#4576](https://github.com/babel/babel/pull/4576) Implement support for async generator functions and for-await statements. ([@zenparsing](https://github.com/zenparsing)) @@ -2036,7 +2036,7 @@ It's also a lot folk's first PR (or first code PR)! * `babel-generator`, `babel-types` * [#3570](https://github.com/babel/babel/pull/3570) Add support for the new declare module.exports of flow. ([@danez](https://github.com/danez)) -#### Spec Compliancy +#### Spec Compliance * `babel-plugin-transform-es2015-modules-amd`, `babel-plugin-transform-es2015-modules-commonjs`, `babel-plugin-transform-es2015-modules-umd` * [#3518](https://github.com/babel/babel/pull/3518) Throw error for multiple exports default. ([@kaicataldo](https://github.com/kaicataldo)) @@ -2332,7 +2332,7 @@ Length: The number of characters in the output code * `babel-plugin-transform-react-jsx-self`, `babel-preset-react` * [#3540](https://github.com/babel/babel/pull/3540) Added jsx-self babel transform plugin. ([@jimfb](https://github.com/jimfb)) -#### Spec Compliancy +#### Spec Compliance * `babel-plugin-transform-es2015-unicode-regex` * [#3338](https://github.com/babel/babel/pull/3338) Update to `regexpu-core@2.0.0` for ES2016 compliance. ([@mathiasbynens](https://github.com/mathiasbynens)) @@ -3206,7 +3206,7 @@ Changes to note: - Reverting the class properties semicolon parser error. - Fix regression with plugin ordering with `babel-register`. -#### Spec Compliancy +#### Spec Compliance * `babel-plugin-transform-class-properties`, `babylon` * [#3332](https://github.com/babel/babel/pull/3332) Revert to standard ASI behavior for class properties. ([@loganfsmyth](https://github.com/loganfsmyth)) @@ -3628,7 +3628,7 @@ Thanks to @samwgoldman for all the new flow support! * `babel-plugin-transform-es2015-parameters`: [#3191](https://github.com/babel/babel/pull/3191) Fix the order of arguments initialization (fixes [T6809](http://phabricator.babeljs.io/T6809)) * `babel-traverse`: [#3198](https://github.com/babel/babel/pull/3198) In `evaluate()`, it should not mistake lack of confidence for falsy -* **Spec Compliancy** +* **Spec Compliance** * `babylon`, `babel-generator`, `babel-plugin-transform-regenerator`: [#3190](https://github.com/babel/babel/pull/3190): Remove `await *` from `babylon` and raise an error for that syntax since it was removed from the proposal and was causing an issue at runtime but not at compile time (fixes [T6688](http://phabricator.babeljs.io/T6688)). * **Internal** @@ -3863,7 +3863,7 @@ Thanks to @samwgoldman for all the new flow support! * Move `children` prop pushing to after props to ensure correct order in the react inline elements plugin. * Fix `buildExternalHelpers` script ignoring non-underscored helpers. * Fix exported classes with static class properties. - * **Spec Compliancy** + * **Spec Compliance** * Add support for computed mutators in `babel-plugin-transform-es2015-computed-properties`. * **Polish** * Make interop for plugins with the `__esModule` work for all plugins no matter how they're imported/specified. @@ -3904,7 +3904,7 @@ Thanks to @samwgoldman for all the new flow support! * **Polish** * Add npm 3 check to `babel-doctor`. * Autoclear the `babel/register` cache when it gets too big to be serialised. - * **Spec Compliancy** + * **Spec Compliance** * Add support for flow existential type parameters. ## 6.1.1 @@ -3969,7 +3969,7 @@ Thanks to @samwgoldman for all the new flow support! ## 6.0.14 - * **Spec Compliancy** + * **Spec Compliance** * Update exponentiation operator precedence. * Fix parser bug where arrow functions have a higher precedence than they should. * **Bug Fix** diff --git a/.github/ISSUE_TEMPLATE/Bug_report.md b/.github/ISSUE_TEMPLATE/Bug_report.md index 344922e4702c..63e446c69272 100644 --- a/.github/ISSUE_TEMPLATE/Bug_report.md +++ b/.github/ISSUE_TEMPLATE/Bug_report.md @@ -9,6 +9,14 @@ assignees: '' ## Bug Report + +- [ ] I would like to work on a fix! + + + **Current Behavior** A clear and concise description of the behavior. @@ -22,7 +30,8 @@ var your => (code) => here; **Expected behavior/code** A clear and concise description of what you expected to happen (or code). -**Babel Configuration (.babelrc, package.json, cli command)** +**Babel Configuration (babel.config.js, .babelrc, package.json#babel, cli command, .eslintrc)** +- Filename: `babel.config.js` ```js { @@ -31,6 +40,10 @@ A clear and concise description of what you expected to happen (or code). ``` **Environment** + +``` + +``` - Babel version(s): [e.g. v6.0.0, v7.0.0-beta.34] - Node/npm version: [e.g. Node 8/npm 5] - OS: [e.g. OSX 10.13.4, Windows 10] @@ -38,7 +51,7 @@ A clear and concise description of what you expected to happen (or code). - How you are using Babel: [e.g. `cli`, `register`, `loader`] **Possible Solution** - + **Additional context/Screenshots** Add any other context about the problem here. If applicable, add screenshots to help explain. diff --git a/.github/ISSUE_TEMPLATE/Feature_request.md b/.github/ISSUE_TEMPLATE/Feature_request.md index b9c82542ff8c..dd65864dce47 100644 --- a/.github/ISSUE_TEMPLATE/Feature_request.md +++ b/.github/ISSUE_TEMPLATE/Feature_request.md @@ -9,6 +9,9 @@ assignees: '' ## Feature Request + +- [ ] I would like to work on this feature! + **Is your feature request related to a problem? Please describe.** A clear and concise description of what the problem is. Ex. I have an issue when [...] diff --git a/.github/ISSUE_TEMPLATE/Npm_error.md b/.github/ISSUE_TEMPLATE/Npm_error.md new file mode 100644 index 000000000000..a47cd0439fcc --- /dev/null +++ b/.github/ISSUE_TEMPLATE/Npm_error.md @@ -0,0 +1,18 @@ +--- +name: "\U0001F4E6 npm error" +about: "When you get a `No matching version found for ...` error from npm" +title: '' +labels: 'i: npm cache' +assignees: '' + +--- + + + +First of all, check if the package for which `npm` throws an error is actually published by searching [on the npm website](https://www.npmjs.com/). + +If it is, then there is nothing that we can do about it: it was correctly published, but for some reason your package manager client doesn't find it. + +If you are using a proxy for the npm registry (maybe it's used by your company, or you are using it because your country blocks the main npm registry), then it's likely that it has cached the old version of the package and it isn't loading the new one. If you can, try clearing the proxy's cache. Otherwise, you will have to wait until the cache is automatically updated (it might take a few hours, or even days). + +If you are not using a proxy, or if it isn't a caching problem, please report the issue to npm (https://github.com/npm/cli/issues/new/choose) instead of in this repo! diff --git a/.github/ISSUE_TEMPLATE/Regression-v7.md b/.github/ISSUE_TEMPLATE/Regression-v7.md index a700b90ba073..e2d524c4aac7 100644 --- a/.github/ISSUE_TEMPLATE/Regression-v7.md +++ b/.github/ISSUE_TEMPLATE/Regression-v7.md @@ -10,6 +10,9 @@ assignees: '' # v7 Regression + +- [ ] I would like to work on a fix! + > First check out: https://babeljs.io/docs/en/v7-migration > Also a partial upgrade tool: https://github.com/babel/babel-upgrade @@ -26,7 +29,10 @@ A clear and concise description of what the regression is. var your => (code) => here; ``` -**Babel Configuration (.babelrc, package.json, cli command)** +**Expected behavior/code** +A clear and concise description of what you expected to happen (or code). + +**Babel Configuration (babel.config.js, .babelrc, package.json#babel, cli command)** ```js { @@ -34,10 +40,11 @@ var your => (code) => here; } ``` -**Expected behavior/code** -A clear and concise description of what you expected to happen (or code). - **Environment** + +``` + +``` - Babel version(s): [e.g. v6.0.0, v7.0.0-beta.34] - Node/npm version: [e.g. Node 8/npm 5] - OS: [e.g. OSX 10.13.4, Windows 10] diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index e5a78bd6542d..f805376b4926 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -2,6 +2,8 @@ Before making a PR, please read our contributing guidelines https://github.com/babel/babel/blob/master/CONTRIBUTING.md +Please note that the Babel Team requires two approvals before merging most PRs. + For issue references: Add a comma-separated list of a [closing word](https://help.github.com/articles/closing-issues-via-commit-messages/) followed by the ticket number fixed by the PR. (it should be underlined in the preview if done correctly) If you are making a change that should have a docs update: submit another PR to https://github.com/babel/website @@ -9,7 +11,7 @@ If you are making a change that should have a docs update: submit another PR to | Q                       | A | ------------------------ | --- -| Fixed Issues? | `Fixes #1, Fixes #2` +| Fixed Issues? | `Fixes #1, Fixes #2` | Patch: Bug Fix? | | Major: Breaking Change? | | Minor: New Feature? | diff --git a/.github/actions/create-release-tag/Dockerfile b/.github/actions/create-release-tag/Dockerfile deleted file mode 100644 index 58c743a3d5dd..000000000000 --- a/.github/actions/create-release-tag/Dockerfile +++ /dev/null @@ -1,16 +0,0 @@ -FROM debian:stable-slim - -LABEL "name"="create-release-tag" -LABEL "version"="0.0.1" - -LABEL "com.github.actions.name"="Create release tag" -LABEL "com.github.actions.description"="Creates a release tag equal to the last commit message" -LABEL "com.github.actions.icon"="tag" -LABEL "com.github.actions.color"="gray-dark" - -ADD entrypoint.sh /action/entrypoint.sh - -RUN chmod +x /action/entrypoint.sh -RUN apt-get update && apt-get install -y --no-install-recommends git - -ENTRYPOINT ["/action/entrypoint.sh"] diff --git a/.github/actions/create-release-tag/entrypoint.sh b/.github/actions/create-release-tag/entrypoint.sh deleted file mode 100644 index 225797f39735..000000000000 --- a/.github/actions/create-release-tag/entrypoint.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/sh - -set -e - -# GitHub doesn't support running actions on new tags yet: we need to run it on the commit. -# For this reason, we can't be sure that the tag already exists. We can use the commit -# message to create the tag. If the tag already exists locally, they won't conflict because -# they have the same name and are on the same commit. - -echo "INFO: Getting release version..." -tag_name=$(git log --oneline --format=%B -1 $GITHUB_SHA) - -echo "INFO: Creating new tag..." -(git tag $tag_name $GITHUB_SHA) || echo "INFO: Tag already exists" diff --git a/.github/actions/filter-commit-message/Dockerfile b/.github/actions/filter-commit-message/Dockerfile deleted file mode 100644 index 4779062c2ad3..000000000000 --- a/.github/actions/filter-commit-message/Dockerfile +++ /dev/null @@ -1,16 +0,0 @@ -FROM debian:stable-slim - -LABEL "name"="filter" -LABEL "version"="1.1.0" - -LABEL "com.github.actions.name"="Filter commit message" -LABEL "com.github.actions.description"="Stop a workflow if the message of the current commit doesn't match the pattern" -LABEL "com.github.actions.icon"="filter" -LABEL "com.github.actions.color"="gray-dark" - -ADD entrypoint.sh /action/entrypoint.sh - -RUN chmod +x /action/entrypoint.sh -RUN apt-get update && apt-get install -y --no-install-recommends git - -ENTRYPOINT ["/action/entrypoint.sh"] diff --git a/.github/actions/filter-commit-message/entrypoint.sh b/.github/actions/filter-commit-message/entrypoint.sh deleted file mode 100644 index ba8873b64b3b..000000000000 --- a/.github/actions/filter-commit-message/entrypoint.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh - -set -e - -pattern=$1 -message=$(git log --oneline --format=%B -1 $GITHUB_SHA) - -if echo "$message" | grep -Pq "$pattern"; then - echo "INFO: $message matches $pattern" - exit 0 -else - echo "INFO: $message does not match $pattern" - # 78 is the "neutral" exit status - exit 78 -fi diff --git a/.github/actions/trigger-github-release/Dockerfile b/.github/actions/trigger-github-release/Dockerfile deleted file mode 100644 index c7e17c775bae..000000000000 --- a/.github/actions/trigger-github-release/Dockerfile +++ /dev/null @@ -1,19 +0,0 @@ -FROM node:10 - -LABEL "name" = "trigger-github-release" -LABEL "version" = "0.0.1" - -LABEL "com.github.actions.name" = "Trigger GitHub release" -LABEL "com.github.actions.description" = "Trigger a new GitHub release and generate the changelog using lerna-changelog." -LABEL "com.github.actions.icon" = "tag" -LABEL "com.github.actions.color" = "yellow" - -ADD entrypoint.sh /action/entrypoint.sh -ADD package.json /action/package.json -ADD package-lock.json /action/package-lock.json -ADD release.js /action/release.js -ADD update-changelog.js /action/update-changelog.js - -RUN chmod +x /action/entrypoint.sh - -ENTRYPOINT ["/action/entrypoint.sh"] diff --git a/.github/actions/trigger-github-release/entrypoint.sh b/.github/actions/trigger-github-release/entrypoint.sh deleted file mode 100755 index b284b6289dec..000000000000 --- a/.github/actions/trigger-github-release/entrypoint.sh +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/sh - -set -e - -echo "INFO: Installing action dependencies..." -(cd /action; npm ci) - -echo "INFO: Getting release version..." -current_tag=$(git describe --abbrev=0 --tags $GITHUB_SHA) - -last_tag=$(git describe --abbrev=0 --tags $current_tag^) -echo "INFO: New version is $current_tag; last version is $last_tag." - -echo "INFO: Generating the changelog..." - -# lerna-changelog expects the token to be provided as GITHUB_AUTH, -# but GitHub actions don't allow to predefine custom env vars prefixed with -# GITHUB_. We need to define it here. -changelog=$( - GITHUB_AUTH="$GITHUB_TOKEN" \ - node /action/node_modules/.bin/lerna-changelog --tag-from $last_tag --tag-to $current_tag -) - -echo "INFO: Publishing the new GitHub release..." -echo "$changelog" | node /action/release $current_tag - -echo "INFO: Updating CHANGELOG.md..." -echo "$changelog" | node /action/update-changelog - -echo "INFO: Committing changelog..." -git add CHANGELOG.md -git -c user.name="$COMMIT_AUTHOR_NAME" -c user.email="$COMMIT_AUTHOR_EMAIL" \ - commit -m "Add $current_tag to CHANGELOG.md [skip ci]" --no-verify --quiet - -echo "INFO: Pushing updates..." -git push "https://${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git" master - -echo "INFO: Done! Don't forget to thank new contributors :)" diff --git a/.github/actions/trigger-github-release/package-lock.json b/.github/actions/trigger-github-release/package-lock.json deleted file mode 100644 index 55580a945f66..000000000000 --- a/.github/actions/trigger-github-release/package-lock.json +++ /dev/null @@ -1,1415 +0,0 @@ -{ - "name": "@internal/trigger-github-release", - "version": "0.0.1", - "lockfileVersion": 1, - "requires": true, - "dependencies": { - "@octokit/endpoint": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/@octokit/endpoint/-/endpoint-3.1.1.tgz", - "integrity": "sha512-KPkoTvKwCTetu/UqonLs1pfwFO5HAqTv/Ksp9y4NAg//ZgUCpvJsT4Hrst85uEzJvkB8+LxKyR4Bfv2X8O4cmQ==", - "requires": { - "deepmerge": "3.0.0", - "is-plain-object": "^2.0.4", - "universal-user-agent": "^2.0.1", - "url-template": "^2.0.8" - } - }, - "@octokit/request": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/@octokit/request/-/request-2.2.0.tgz", - "integrity": "sha512-4P9EbwKZ4xfyupVMb3KVuHmM+aO2fye3nufjGKz/qDssvdJj9Rlx44O0FdFvUp4kIzToy3AHLTOulEIDAL+dpg==", - "requires": { - "@octokit/endpoint": "^3.0.0", - "is-plain-object": "^2.0.4", - "node-fetch": "^2.3.0", - "universal-user-agent": "^2.0.1" - } - }, - "@octokit/rest": { - "version": "16.3.0", - "resolved": "https://registry.npmjs.org/@octokit/rest/-/rest-16.3.0.tgz", - "integrity": "sha512-u0HkROLB0nOSfJhkF5FKMg6I12m6cN5S3S73Lwtfgrs9u4LhgUCZN2hC2KDyIaT7nhvNe9Kx0PgxhhD6li6QsA==", - "requires": { - "@octokit/request": "2.2.0", - "before-after-hook": "^1.2.0", - "btoa-lite": "^1.0.0", - "lodash.get": "^4.4.2", - "lodash.pick": "^4.4.0", - "lodash.set": "^4.3.2", - "lodash.uniq": "^4.5.0", - "octokit-pagination-methods": "^1.1.0", - "universal-user-agent": "^2.0.0", - "url-template": "^2.0.8" - } - }, - "@types/node": { - "version": "10.12.18", - "resolved": "https://registry.npmjs.org/@types/node/-/node-10.12.18.tgz", - "integrity": "sha512-fh+pAqt4xRzPfqA6eh3Z2y6fyZavRIumvjhaCL753+TVkGKGhpPeyrJG2JftD0T9q4GF00KjefsQ+PQNDdWQaQ==" - }, - "agent-base": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-4.2.1.tgz", - "integrity": "sha512-JVwXMr9nHYTUXsBFKUqhJwvlcYU/blreOEUkhNR2eXZIvwd+c+o5V4MgDPKWnMS/56awN3TRzIP+KoPn+roQtg==", - "requires": { - "es6-promisify": "^5.0.0" - } - }, - "agentkeepalive": { - "version": "3.5.2", - "resolved": "https://registry.npmjs.org/agentkeepalive/-/agentkeepalive-3.5.2.tgz", - "integrity": "sha512-e0L/HNe6qkQ7H19kTlRRqUibEAwDK5AFk6y3PtMsuut2VAH6+Q4xZml1tNDJD7kSAyqmbG/K08K5WEJYtUrSlQ==", - "requires": { - "humanize-ms": "^1.2.1" - } - }, - "ansi-regex": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", - "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=" - }, - "ansi-styles": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", - "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", - "requires": { - "color-convert": "^1.9.0" - } - }, - "any-promise": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/any-promise/-/any-promise-1.3.0.tgz", - "integrity": "sha1-q8av7tzqUugJzcA3au0845Y10X8=" - }, - "aproba": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/aproba/-/aproba-1.2.0.tgz", - "integrity": "sha512-Y9J6ZjXtoYh8RnXVCMOU/ttDmk1aBjunq9vO0ta5x85WDQiQfUF9sIPBITdbiiIVcBo03Hi3jMxigBtsddlXRw==" - }, - "balanced-match": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", - "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=" - }, - "before-after-hook": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/before-after-hook/-/before-after-hook-1.2.0.tgz", - "integrity": "sha512-wI3QtdLppHNkmM1VgRVLCrlWCKk/YexlPicYbXPs4eYdd1InrUCTFsx5bX1iUQzzMsoRXXPpM1r+p7JEJJydag==" - }, - "bluebird": { - "version": "3.5.3", - "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.5.3.tgz", - "integrity": "sha512-/qKPUQlaW1OyR51WeCPBvRnAlnZFUJkCSG5HzGnuIqhgyJtF+T94lFnn33eiazjRm2LAHVy2guNnaq48X9SJuw==" - }, - "brace-expansion": { - "version": "1.1.11", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", - "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", - "requires": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" - } - }, - "btoa-lite": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/btoa-lite/-/btoa-lite-1.0.0.tgz", - "integrity": "sha1-M3dm2hWAEhD92VbCLpxokaudAzc=" - }, - "buffer-from": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.1.tgz", - "integrity": "sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A==" - }, - "cacache": { - "version": "11.3.2", - "resolved": "https://registry.npmjs.org/cacache/-/cacache-11.3.2.tgz", - "integrity": "sha512-E0zP4EPGDOaT2chM08Als91eYnf8Z+eH1awwwVsngUmgppfM5jjJ8l3z5vO5p5w/I3LsiXawb1sW0VY65pQABg==", - "requires": { - "bluebird": "^3.5.3", - "chownr": "^1.1.1", - "figgy-pudding": "^3.5.1", - "glob": "^7.1.3", - "graceful-fs": "^4.1.15", - "lru-cache": "^5.1.1", - "mississippi": "^3.0.0", - "mkdirp": "^0.5.1", - "move-concurrently": "^1.0.1", - "promise-inflight": "^1.0.1", - "rimraf": "^2.6.2", - "ssri": "^6.0.1", - "unique-filename": "^1.1.1", - "y18n": "^4.0.0" - }, - "dependencies": { - "lru-cache": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz", - "integrity": "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==", - "requires": { - "yallist": "^3.0.2" - } - }, - "y18n": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.0.tgz", - "integrity": "sha512-r9S/ZyXu/Xu9q1tYlpsLIsa3EeLXXk0VwlxqTcFRfg9EhMW+17kbt9G0NrgCmhGb5vT2hyhJZLfDGx+7+5Uj/w==" - }, - "yallist": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.0.3.tgz", - "integrity": "sha512-S+Zk8DEWE6oKpV+vI3qWkaK+jSbIK86pCwe2IF/xwIpQ8jEuxpw9NyaGjmp9+BoJv5FV2piqCDcoCtStppiq2A==" - } - } - }, - "camelcase": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-4.1.0.tgz", - "integrity": "sha1-1UVjW+HjPFQmScaRc+Xeas+uNN0=" - }, - "chalk": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.1.tgz", - "integrity": "sha512-ObN6h1v2fTJSmUXoS3nMQ92LbDK9be4TV+6G+omQlGJFdcUX5heKi1LZ1YnRMIgwTLEj3E24bT6tYni50rlCfQ==", - "requires": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - } - }, - "chownr": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/chownr/-/chownr-1.1.1.tgz", - "integrity": "sha512-j38EvO5+LHX84jlo6h4UzmOwi0UgW61WRyPtJz4qaadK5eY3BTS5TY/S1Stc3Uk2lIM6TPevAlULiEJwie860g==" - }, - "cli-highlight": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/cli-highlight/-/cli-highlight-1.2.3.tgz", - "integrity": "sha512-cmc4Y2kJuEpT2KZd9pgWWskpDMMfJu2roIcY1Ya/aIItufF5FKsV/NtA6vvdhSUllR8KJfvQDNmIcskU+MKLDg==", - "requires": { - "chalk": "^2.3.0", - "highlight.js": "^9.6.0", - "mz": "^2.4.0", - "parse5": "^3.0.3", - "yargs": "^10.0.3" - }, - "dependencies": { - "yargs": { - "version": "10.1.2", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-10.1.2.tgz", - "integrity": "sha512-ivSoxqBGYOqQVruxD35+EyCFDYNEFL/Uo6FcOnz+9xZdZzK0Zzw4r4KhbrME1Oo2gOggwJod2MnsdamSG7H9ig==", - "requires": { - "cliui": "^4.0.0", - "decamelize": "^1.1.1", - "find-up": "^2.1.0", - "get-caller-file": "^1.0.1", - "os-locale": "^2.0.0", - "require-directory": "^2.1.1", - "require-main-filename": "^1.0.1", - "set-blocking": "^2.0.0", - "string-width": "^2.0.0", - "which-module": "^2.0.0", - "y18n": "^3.2.1", - "yargs-parser": "^8.1.0" - } - } - } - }, - "cliui": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/cliui/-/cliui-4.1.0.tgz", - "integrity": "sha512-4FG+RSG9DL7uEwRUZXZn3SS34DiDPfzP0VOiEwtUWlE+AR2EIg+hSyvrIgUUfhdgR/UkAeW2QHgeP+hWrXs7jQ==", - "requires": { - "string-width": "^2.1.1", - "strip-ansi": "^4.0.0", - "wrap-ansi": "^2.0.0" - } - }, - "code-point-at": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz", - "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=" - }, - "color-convert": { - "version": "1.9.3", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", - "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", - "requires": { - "color-name": "1.1.3" - } - }, - "color-name": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", - "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=" - }, - "concat-map": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", - "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=" - }, - "concat-stream": { - "version": "1.6.2", - "resolved": "http://registry.npmjs.org/concat-stream/-/concat-stream-1.6.2.tgz", - "integrity": "sha512-27HBghJxjiZtIk3Ycvn/4kbJk/1uZuJFfuPEns6LaEvpvG1f0hTea8lilrouyo9mVc2GWdcEZ8OLoGmSADlrCw==", - "requires": { - "buffer-from": "^1.0.0", - "inherits": "^2.0.3", - "readable-stream": "^2.2.2", - "typedarray": "^0.0.6" - } - }, - "copy-concurrently": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/copy-concurrently/-/copy-concurrently-1.0.5.tgz", - "integrity": "sha512-f2domd9fsVDFtaFcbaRZuYXwtdmnzqbADSwhSWYxYB/Q8zsdUUFMXVRwXGDMWmbEzAn1kdRrtI1T/KTFOL4X2A==", - "requires": { - "aproba": "^1.1.1", - "fs-write-stream-atomic": "^1.0.8", - "iferr": "^0.1.5", - "mkdirp": "^0.5.1", - "rimraf": "^2.5.4", - "run-queue": "^1.0.0" - } - }, - "core-util-is": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", - "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=" - }, - "cross-spawn": { - "version": "6.0.5", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz", - "integrity": "sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ==", - "requires": { - "nice-try": "^1.0.4", - "path-key": "^2.0.1", - "semver": "^5.5.0", - "shebang-command": "^1.2.0", - "which": "^1.2.9" - } - }, - "cyclist": { - "version": "0.2.2", - "resolved": "https://registry.npmjs.org/cyclist/-/cyclist-0.2.2.tgz", - "integrity": "sha1-GzN5LhHpFKL9bW7WRHRkRE5fpkA=" - }, - "debug": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", - "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", - "requires": { - "ms": "2.0.0" - }, - "dependencies": { - "ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" - } - } - }, - "decamelize": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", - "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=" - }, - "deepmerge": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-3.0.0.tgz", - "integrity": "sha512-a8z8bkgHsAML+uHLqmMS83HHlpy3PvZOOuiTQqaa3wu8ZVg3h0hqHk6aCsGdOnZV2XMM/FRimNGjUh0KCcmHBw==" - }, - "define-properties": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.3.tgz", - "integrity": "sha512-3MqfYKj2lLzdMSf8ZIZE/V+Zuy+BgD6f164e8K2w7dgnpKArBDerGYpM46IYYcjnkdPNMjPk9A6VFB8+3SKlXQ==", - "requires": { - "object-keys": "^1.0.12" - } - }, - "duplexify": { - "version": "3.6.1", - "resolved": "https://registry.npmjs.org/duplexify/-/duplexify-3.6.1.tgz", - "integrity": "sha512-vM58DwdnKmty+FSPzT14K9JXb90H+j5emaR4KYbr2KTIz00WHGbWOe5ghQTx233ZCLZtrGDALzKwcjEtSt35mA==", - "requires": { - "end-of-stream": "^1.0.0", - "inherits": "^2.0.1", - "readable-stream": "^2.0.0", - "stream-shift": "^1.0.0" - } - }, - "encoding": { - "version": "0.1.12", - "resolved": "https://registry.npmjs.org/encoding/-/encoding-0.1.12.tgz", - "integrity": "sha1-U4tm8+5izRq1HsMjgp0flIDHS+s=", - "requires": { - "iconv-lite": "~0.4.13" - } - }, - "end-of-stream": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.1.tgz", - "integrity": "sha512-1MkrZNvWTKCaigbn+W15elq2BB/L22nqrSY5DKlo3X6+vclJm8Bb5djXJBmEX6fS3+zCh/F4VBK5Z2KxJt4s2Q==", - "requires": { - "once": "^1.4.0" - } - }, - "err-code": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/err-code/-/err-code-1.1.2.tgz", - "integrity": "sha1-BuARbTAo9q70gGhJ6w6mp0iuaWA=" - }, - "es-abstract": { - "version": "1.12.0", - "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.12.0.tgz", - "integrity": "sha512-C8Fx/0jFmV5IPoMOFPA9P9G5NtqW+4cOPit3MIuvR2t7Ag2K15EJTpxnHAYTzL+aYQJIESYeXZmDBfOBE1HcpA==", - "requires": { - "es-to-primitive": "^1.1.1", - "function-bind": "^1.1.1", - "has": "^1.0.1", - "is-callable": "^1.1.3", - "is-regex": "^1.0.4" - } - }, - "es-to-primitive": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.2.0.tgz", - "integrity": "sha512-qZryBOJjV//LaxLTV6UC//WewneB3LcXOL9NP++ozKVXsIIIpm/2c13UDiD9Jp2eThsecw9m3jPqDwTyobcdbg==", - "requires": { - "is-callable": "^1.1.4", - "is-date-object": "^1.0.1", - "is-symbol": "^1.0.2" - } - }, - "es6-promise": { - "version": "4.2.5", - "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.2.5.tgz", - "integrity": "sha512-n6wvpdE43VFtJq+lUDYDBFUwV8TZbuGXLV4D6wKafg13ldznKsyEvatubnmUe31zcvelSzOHF+XbaT+Bl9ObDg==" - }, - "es6-promisify": { - "version": "5.0.0", - "resolved": "http://registry.npmjs.org/es6-promisify/-/es6-promisify-5.0.0.tgz", - "integrity": "sha1-UQnWLz5W6pZ8S2NQWu8IKRyKUgM=", - "requires": { - "es6-promise": "^4.0.3" - } - }, - "escape-string-regexp": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", - "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=" - }, - "execa": { - "version": "0.10.0", - "resolved": "https://registry.npmjs.org/execa/-/execa-0.10.0.tgz", - "integrity": "sha512-7XOMnz8Ynx1gGo/3hyV9loYNPWM94jG3+3T3Y8tsfSstFmETmENCMU/A/zj8Lyaj1lkgEepKepvd6240tBRvlw==", - "requires": { - "cross-spawn": "^6.0.0", - "get-stream": "^3.0.0", - "is-stream": "^1.1.0", - "npm-run-path": "^2.0.0", - "p-finally": "^1.0.0", - "signal-exit": "^3.0.0", - "strip-eof": "^1.0.0" - } - }, - "figgy-pudding": { - "version": "3.5.1", - "resolved": "https://registry.npmjs.org/figgy-pudding/-/figgy-pudding-3.5.1.tgz", - "integrity": "sha512-vNKxJHTEKNThjfrdJwHc7brvM6eVevuO5nTj6ez8ZQ1qbXTvGthucRF7S4vf2cr71QVnT70V34v0S1DyQsti0w==" - }, - "find-up": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz", - "integrity": "sha1-RdG35QbHF93UgndaK3eSCjwMV6c=", - "requires": { - "locate-path": "^2.0.0" - } - }, - "flush-write-stream": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/flush-write-stream/-/flush-write-stream-1.0.3.tgz", - "integrity": "sha512-calZMC10u0FMUqoiunI2AiGIIUtUIvifNwkHhNupZH4cbNnW1Itkoh/Nf5HFYmDrwWPjrUxpkZT0KhuCq0jmGw==", - "requires": { - "inherits": "^2.0.1", - "readable-stream": "^2.0.4" - } - }, - "from2": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/from2/-/from2-2.3.0.tgz", - "integrity": "sha1-i/tVAr3kpNNs/e6gB/zKIdfjgq8=", - "requires": { - "inherits": "^2.0.1", - "readable-stream": "^2.0.0" - } - }, - "fs-write-stream-atomic": { - "version": "1.0.10", - "resolved": "https://registry.npmjs.org/fs-write-stream-atomic/-/fs-write-stream-atomic-1.0.10.tgz", - "integrity": "sha1-tH31NJPvkR33VzHnCp3tAYnbQMk=", - "requires": { - "graceful-fs": "^4.1.2", - "iferr": "^0.1.5", - "imurmurhash": "^0.1.4", - "readable-stream": "1 || 2" - } - }, - "fs.realpath": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", - "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=" - }, - "function-bind": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", - "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==" - }, - "get-caller-file": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-1.0.3.tgz", - "integrity": "sha512-3t6rVToeoZfYSGd8YoLFR2DJkiQrIiUrGcjvFX2mDw3bn6k2OtwHN0TNCLbBO+w8qTvimhDkv+LSscbJY1vE6w==" - }, - "get-stdin": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/get-stdin/-/get-stdin-6.0.0.tgz", - "integrity": "sha512-jp4tHawyV7+fkkSKyvjuLZswblUtz+SQKzSWnBbii16BuZksJlU1wuBYXY75r+duh/llF1ur6oNwi+2ZzjKZ7g==" - }, - "get-stream": { - "version": "3.0.0", - "resolved": "http://registry.npmjs.org/get-stream/-/get-stream-3.0.0.tgz", - "integrity": "sha1-jpQ9E1jcN1VQVOy+LtsFqhdO3hQ=" - }, - "glob": { - "version": "7.1.3", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.3.tgz", - "integrity": "sha512-vcfuiIxogLV4DlGBHIUOwI0IbrJ8HWPc4MU7HzviGeNho/UJDfi6B5p3sHeWIQ0KGIU0Jpxi5ZHxemQfLkkAwQ==", - "requires": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.0.4", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - } - }, - "graceful-fs": { - "version": "4.1.15", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.15.tgz", - "integrity": "sha512-6uHUhOPEBgQ24HM+r6b/QwWfZq+yiFcipKFrOFiBEnWdy5sdzYoi+pJeQaPI5qOLRFqWmAXUPQNsielzdLoecA==" - }, - "has": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", - "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", - "requires": { - "function-bind": "^1.1.1" - } - }, - "has-flag": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", - "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=" - }, - "has-symbols": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.0.tgz", - "integrity": "sha1-uhqPGvKg/DllD1yFA2dwQSIGO0Q=" - }, - "highlight.js": { - "version": "9.13.1", - "resolved": "https://registry.npmjs.org/highlight.js/-/highlight.js-9.13.1.tgz", - "integrity": "sha512-Sc28JNQNDzaH6PORtRLMvif9RSn1mYuOoX3omVjnb0+HbpPygU2ALBI0R/wsiqCb4/fcp07Gdo8g+fhtFrQl6A==" - }, - "http-cache-semantics": { - "version": "3.8.1", - "resolved": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-3.8.1.tgz", - "integrity": "sha512-5ai2iksyV8ZXmnZhHH4rWPoxxistEexSi5936zIQ1bnNTW5VnA85B6P/VpXiRM017IgRvb2kKo1a//y+0wSp3w==" - }, - "http-proxy-agent": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-2.1.0.tgz", - "integrity": "sha512-qwHbBLV7WviBl0rQsOzH6o5lwyOIvwp/BdFnvVxXORldu5TmjFfjzBcWUWS5kWAZhmv+JtiDhSuQCp4sBfbIgg==", - "requires": { - "agent-base": "4", - "debug": "3.1.0" - } - }, - "https-proxy-agent": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-2.2.1.tgz", - "integrity": "sha512-HPCTS1LW51bcyMYbxUIOO4HEOlQ1/1qRaFWcyxvwaqUS9TY88aoEuHUY33kuAh1YhVVaDQhLZsnPd+XNARWZlQ==", - "requires": { - "agent-base": "^4.1.0", - "debug": "^3.1.0" - } - }, - "humanize-ms": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/humanize-ms/-/humanize-ms-1.2.1.tgz", - "integrity": "sha1-xG4xWaKT9riW2ikxbYtv6Lt5u+0=", - "requires": { - "ms": "^2.0.0" - } - }, - "iconv-lite": { - "version": "0.4.24", - "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", - "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", - "requires": { - "safer-buffer": ">= 2.1.2 < 3" - } - }, - "iferr": { - "version": "0.1.5", - "resolved": "https://registry.npmjs.org/iferr/-/iferr-0.1.5.tgz", - "integrity": "sha1-xg7taebY/bazEEofy8ocGS3FtQE=" - }, - "imurmurhash": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", - "integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o=" - }, - "inflight": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", - "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", - "requires": { - "once": "^1.3.0", - "wrappy": "1" - } - }, - "inherits": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", - "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=" - }, - "invert-kv": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/invert-kv/-/invert-kv-1.0.0.tgz", - "integrity": "sha1-EEqOSqym09jNFXqO+L+rLXo//bY=" - }, - "ip": { - "version": "1.1.5", - "resolved": "https://registry.npmjs.org/ip/-/ip-1.1.5.tgz", - "integrity": "sha1-vd7XARQpCCjAoDnnLvJfWq7ENUo=" - }, - "is-callable": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.1.4.tgz", - "integrity": "sha512-r5p9sxJjYnArLjObpjA4xu5EKI3CuKHkJXMhT7kwbpUyIFD1n5PMAsoPvWnvtZiNz7LjkYDRZhd7FlI0eMijEA==" - }, - "is-date-object": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.1.tgz", - "integrity": "sha1-mqIOtq7rv/d/vTPnTKAbM1gdOhY=" - }, - "is-fullwidth-code-point": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", - "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=" - }, - "is-plain-object": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-2.0.4.tgz", - "integrity": "sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og==", - "requires": { - "isobject": "^3.0.1" - } - }, - "is-regex": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.0.4.tgz", - "integrity": "sha1-VRdIm1RwkbCTDglWVM7SXul+lJE=", - "requires": { - "has": "^1.0.1" - } - }, - "is-stream": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz", - "integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ=" - }, - "is-symbol": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.2.tgz", - "integrity": "sha512-HS8bZ9ox60yCJLH9snBpIwv9pYUAkcuLhSA1oero1UB5y9aiQpRA8y2ex945AOtCZL1lJDeIk3G5LthswI46Lw==", - "requires": { - "has-symbols": "^1.0.0" - } - }, - "isarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", - "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=" - }, - "isexe": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", - "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=" - }, - "isobject": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", - "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=" - }, - "json-parse-better-errors": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz", - "integrity": "sha512-mrqyZKfX5EhL7hvqcV6WG1yYjnjeuYDzDhhcAAUrq8Po85NBQBJP+ZDUT75qZQ98IkUoBqdkExkukOU7Ts2wrw==" - }, - "lcid": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/lcid/-/lcid-1.0.0.tgz", - "integrity": "sha1-MIrMr6C8SDo4Z7S28rlQYlHRuDU=", - "requires": { - "invert-kv": "^1.0.0" - } - }, - "lerna-changelog": { - "version": "0.8.2", - "resolved": "https://registry.npmjs.org/lerna-changelog/-/lerna-changelog-0.8.2.tgz", - "integrity": "sha512-GrWs8K3DrPpO1sUrcloYp9ioj+PNAX27U6tM0+10fhbNzBB7h4HS+4N5DWKhEQRDoJjZh1QA+wWwTpDNJdJHyA==", - "requires": { - "chalk": "^2.4.1", - "cli-highlight": "^1.2.3", - "execa": "^0.10.0", - "make-fetch-happen": "^4.0.1", - "normalize-git-url": "^3.0.2", - "p-map": "^1.2.0", - "progress": "^2.0.0", - "string.prototype.padend": "^3.0.0", - "yargs": "^11.0.0" - } - }, - "locate-path": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-2.0.0.tgz", - "integrity": "sha1-K1aLJl7slExtnA3pw9u7ygNUzY4=", - "requires": { - "p-locate": "^2.0.0", - "path-exists": "^3.0.0" - } - }, - "lodash.get": { - "version": "4.4.2", - "resolved": "https://registry.npmjs.org/lodash.get/-/lodash.get-4.4.2.tgz", - "integrity": "sha1-LRd/ZS+jHpObRDjVNBSZ36OCXpk=" - }, - "lodash.pick": { - "version": "4.4.0", - "resolved": "https://registry.npmjs.org/lodash.pick/-/lodash.pick-4.4.0.tgz", - "integrity": "sha1-UvBWEP/53tQiYRRB7R/BI6AwAbM=" - }, - "lodash.set": { - "version": "4.3.2", - "resolved": "https://registry.npmjs.org/lodash.set/-/lodash.set-4.3.2.tgz", - "integrity": "sha1-2HV7HagH3eJIFrDWqEvqGnYjCyM=" - }, - "lodash.uniq": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/lodash.uniq/-/lodash.uniq-4.5.0.tgz", - "integrity": "sha1-0CJTc662Uq3BvILklFM5qEJ1R3M=" - }, - "lru-cache": { - "version": "4.1.5", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-4.1.5.tgz", - "integrity": "sha512-sWZlbEP2OsHNkXrMl5GYk/jKk70MBng6UU4YI/qGDYbgf6YbP4EvmqISbXCoJiRKs+1bSpFHVgQxvJ17F2li5g==", - "requires": { - "pseudomap": "^1.0.2", - "yallist": "^2.1.2" - } - }, - "macos-release": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/macos-release/-/macos-release-2.0.0.tgz", - "integrity": "sha512-iCM3ZGeqIzlrH7KxYK+fphlJpCCczyHXc+HhRVbEu9uNTCrzYJjvvtefzeKTCVHd5AP/aD/fzC80JZ4ZP+dQ/A==" - }, - "make-fetch-happen": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/make-fetch-happen/-/make-fetch-happen-4.0.1.tgz", - "integrity": "sha512-7R5ivfy9ilRJ1EMKIOziwrns9fGeAD4bAha8EB7BIiBBLHm2KeTUGCrICFt2rbHfzheTLynv50GnNTK1zDTrcQ==", - "requires": { - "agentkeepalive": "^3.4.1", - "cacache": "^11.0.1", - "http-cache-semantics": "^3.8.1", - "http-proxy-agent": "^2.1.0", - "https-proxy-agent": "^2.2.1", - "lru-cache": "^4.1.2", - "mississippi": "^3.0.0", - "node-fetch-npm": "^2.0.2", - "promise-retry": "^1.1.1", - "socks-proxy-agent": "^4.0.0", - "ssri": "^6.0.0" - } - }, - "mem": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/mem/-/mem-1.1.0.tgz", - "integrity": "sha1-Xt1StIXKHZAP5kiVUFOZoN+kX3Y=", - "requires": { - "mimic-fn": "^1.0.0" - } - }, - "mimic-fn": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-1.2.0.tgz", - "integrity": "sha512-jf84uxzwiuiIVKiOLpfYk7N46TSy8ubTonmneY9vrpHNAnp0QBt2BxWV9dO3/j+BoVAb+a5G6YDPW3M5HOdMWQ==" - }, - "minimatch": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", - "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", - "requires": { - "brace-expansion": "^1.1.7" - } - }, - "minimist": { - "version": "0.0.8", - "resolved": "http://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", - "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=" - }, - "mississippi": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/mississippi/-/mississippi-3.0.0.tgz", - "integrity": "sha512-x471SsVjUtBRtcvd4BzKE9kFC+/2TeWgKCgw0bZcw1b9l2X3QX5vCWgF+KaZaYm87Ss//rHnWryupDrgLvmSkA==", - "requires": { - "concat-stream": "^1.5.0", - "duplexify": "^3.4.2", - "end-of-stream": "^1.1.0", - "flush-write-stream": "^1.0.0", - "from2": "^2.1.0", - "parallel-transform": "^1.1.0", - "pump": "^3.0.0", - "pumpify": "^1.3.3", - "stream-each": "^1.1.0", - "through2": "^2.0.0" - } - }, - "mkdirp": { - "version": "0.5.1", - "resolved": "http://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", - "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", - "requires": { - "minimist": "0.0.8" - } - }, - "move-concurrently": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/move-concurrently/-/move-concurrently-1.0.1.tgz", - "integrity": "sha1-viwAX9oy4LKa8fBdfEszIUxwH5I=", - "requires": { - "aproba": "^1.1.1", - "copy-concurrently": "^1.0.0", - "fs-write-stream-atomic": "^1.0.8", - "mkdirp": "^0.5.1", - "rimraf": "^2.5.4", - "run-queue": "^1.0.3" - } - }, - "ms": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz", - "integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==" - }, - "mz": { - "version": "2.7.0", - "resolved": "https://registry.npmjs.org/mz/-/mz-2.7.0.tgz", - "integrity": "sha512-z81GNO7nnYMEhrGh9LeymoE4+Yr0Wn5McHIZMK5cfQCl+NDX08sCZgUc9/6MHni9IWuFLm1Z3HTCXu2z9fN62Q==", - "requires": { - "any-promise": "^1.0.0", - "object-assign": "^4.0.1", - "thenify-all": "^1.0.0" - } - }, - "nice-try": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/nice-try/-/nice-try-1.0.5.tgz", - "integrity": "sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==" - }, - "node-fetch": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.3.0.tgz", - "integrity": "sha512-MOd8pV3fxENbryESLgVIeaGKrdl+uaYhCSSVkjeOb/31/njTpcis5aWfdqgNlHIrKOLRbMnfPINPOML2CIFeXA==" - }, - "node-fetch-npm": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/node-fetch-npm/-/node-fetch-npm-2.0.2.tgz", - "integrity": "sha512-nJIxm1QmAj4v3nfCvEeCrYSoVwXyxLnaPBK5W1W5DGEJwjlKuC2VEUycGw5oxk+4zZahRrB84PUJJgEmhFTDFw==", - "requires": { - "encoding": "^0.1.11", - "json-parse-better-errors": "^1.0.0", - "safe-buffer": "^5.1.1" - } - }, - "normalize-git-url": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/normalize-git-url/-/normalize-git-url-3.0.2.tgz", - "integrity": "sha1-jl8Uvgva7bc+ByADEKpBbCc1D8Q=" - }, - "npm-run-path": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-2.0.2.tgz", - "integrity": "sha1-NakjLfo11wZ7TLLd8jV7GHFTbF8=", - "requires": { - "path-key": "^2.0.0" - } - }, - "number-is-nan": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz", - "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=" - }, - "object-assign": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", - "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=" - }, - "object-keys": { - "version": "1.0.12", - "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.0.12.tgz", - "integrity": "sha512-FTMyFUm2wBcGHnH2eXmz7tC6IwlqQZ6mVZ+6dm6vZ4IQIHjs6FdNsQBuKGPuUUUY6NfJw2PshC08Tn6LzLDOag==" - }, - "octokit-pagination-methods": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/octokit-pagination-methods/-/octokit-pagination-methods-1.1.0.tgz", - "integrity": "sha512-fZ4qZdQ2nxJvtcasX7Ghl+WlWS/d9IgnBIwFZXVNNZUmzpno91SX5bc5vuxiuKoCtK78XxGGNuSCrDC7xYB3OQ==" - }, - "once": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", - "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", - "requires": { - "wrappy": "1" - } - }, - "os-locale": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/os-locale/-/os-locale-2.1.0.tgz", - "integrity": "sha512-3sslG3zJbEYcaC4YVAvDorjGxc7tv6KVATnLPZONiljsUncvihe9BQoVCEs0RZ1kmf4Hk9OBqlZfJZWI4GanKA==", - "requires": { - "execa": "^0.7.0", - "lcid": "^1.0.0", - "mem": "^1.1.0" - }, - "dependencies": { - "cross-spawn": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-5.1.0.tgz", - "integrity": "sha1-6L0O/uWPz/b4+UUQoKVUu/ojVEk=", - "requires": { - "lru-cache": "^4.0.1", - "shebang-command": "^1.2.0", - "which": "^1.2.9" - } - }, - "execa": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/execa/-/execa-0.7.0.tgz", - "integrity": "sha1-lEvs00zEHuMqY6n68nrVpl/Fl3c=", - "requires": { - "cross-spawn": "^5.0.1", - "get-stream": "^3.0.0", - "is-stream": "^1.1.0", - "npm-run-path": "^2.0.0", - "p-finally": "^1.0.0", - "signal-exit": "^3.0.0", - "strip-eof": "^1.0.0" - } - } - } - }, - "os-name": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/os-name/-/os-name-3.0.0.tgz", - "integrity": "sha512-7c74tib2FsdFbQ3W+qj8Tyd1R3Z6tuVRNNxXjJcZ4NgjIEQU9N/prVMqcW29XZPXGACqaXN3jq58/6hoaoXH6g==", - "requires": { - "macos-release": "^2.0.0", - "windows-release": "^3.1.0" - } - }, - "p-finally": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/p-finally/-/p-finally-1.0.0.tgz", - "integrity": "sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4=" - }, - "p-limit": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-1.3.0.tgz", - "integrity": "sha512-vvcXsLAJ9Dr5rQOPk7toZQZJApBl2K4J6dANSsEuh6QI41JYcsS/qhTGa9ErIUUgK3WNQoJYvylxvjqmiqEA9Q==", - "requires": { - "p-try": "^1.0.0" - } - }, - "p-locate": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-2.0.0.tgz", - "integrity": "sha1-IKAQOyIqcMj9OcwuWAaA893l7EM=", - "requires": { - "p-limit": "^1.1.0" - } - }, - "p-map": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/p-map/-/p-map-1.2.0.tgz", - "integrity": "sha512-r6zKACMNhjPJMTl8KcFH4li//gkrXWfbD6feV8l6doRHlzljFWGJ2AP6iKaCJXyZmAUMOPtvbW7EXkbWO/pLEA==" - }, - "p-try": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/p-try/-/p-try-1.0.0.tgz", - "integrity": "sha1-y8ec26+P1CKOE/Yh8rGiN8GyB7M=" - }, - "parallel-transform": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/parallel-transform/-/parallel-transform-1.1.0.tgz", - "integrity": "sha1-1BDwZbBdojCB/NEPKIVMKb2jOwY=", - "requires": { - "cyclist": "~0.2.2", - "inherits": "^2.0.3", - "readable-stream": "^2.1.5" - } - }, - "parse5": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/parse5/-/parse5-3.0.3.tgz", - "integrity": "sha512-rgO9Zg5LLLkfJF9E6CCmXlSE4UVceloys8JrFqCcHloC3usd/kJCyPDwH2SOlzix2j3xaP9sUX3e8+kvkuleAA==", - "requires": { - "@types/node": "*" - } - }, - "path-exists": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", - "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=" - }, - "path-is-absolute": { - "version": "1.0.1", - "resolved": "http://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", - "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=" - }, - "path-key": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/path-key/-/path-key-2.0.1.tgz", - "integrity": "sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A=" - }, - "process-nextick-args": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.0.tgz", - "integrity": "sha512-MtEC1TqN0EU5nephaJ4rAtThHtC86dNN9qCuEhtshvpVBkAW5ZO7BASN9REnF9eoXGcRub+pFuKEpOHE+HbEMw==" - }, - "progress": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.3.tgz", - "integrity": "sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==" - }, - "promise-inflight": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/promise-inflight/-/promise-inflight-1.0.1.tgz", - "integrity": "sha1-mEcocL8igTL8vdhoEputEsPAKeM=" - }, - "promise-retry": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/promise-retry/-/promise-retry-1.1.1.tgz", - "integrity": "sha1-ZznpaOMFHaIM5kl/srUPaRHfPW0=", - "requires": { - "err-code": "^1.0.0", - "retry": "^0.10.0" - } - }, - "pseudomap": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/pseudomap/-/pseudomap-1.0.2.tgz", - "integrity": "sha1-8FKijacOYYkX7wqKw0wa5aaChrM=" - }, - "pump": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz", - "integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==", - "requires": { - "end-of-stream": "^1.1.0", - "once": "^1.3.1" - } - }, - "pumpify": { - "version": "1.5.1", - "resolved": "https://registry.npmjs.org/pumpify/-/pumpify-1.5.1.tgz", - "integrity": "sha512-oClZI37HvuUJJxSKKrC17bZ9Cu0ZYhEAGPsPUy9KlMUmv9dKX2o77RUmq7f3XjIxbwyGwYzbzQ1L2Ks8sIradQ==", - "requires": { - "duplexify": "^3.6.0", - "inherits": "^2.0.3", - "pump": "^2.0.0" - }, - "dependencies": { - "pump": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/pump/-/pump-2.0.1.tgz", - "integrity": "sha512-ruPMNRkN3MHP1cWJc9OWr+T/xDP0jhXYCLfJcBuX54hhfIBnaQmAUMfDcG4DM5UMWByBbJY69QSphm3jtDKIkA==", - "requires": { - "end-of-stream": "^1.1.0", - "once": "^1.3.1" - } - } - } - }, - "readable-stream": { - "version": "2.3.6", - "resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", - "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", - "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~2.0.0", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.1.1", - "util-deprecate": "~1.0.1" - } - }, - "require-directory": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", - "integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I=" - }, - "require-main-filename": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-1.0.1.tgz", - "integrity": "sha1-l/cXtp1IeE9fUmpsWqj/3aBVpNE=" - }, - "retry": { - "version": "0.10.1", - "resolved": "https://registry.npmjs.org/retry/-/retry-0.10.1.tgz", - "integrity": "sha1-52OI0heZLCUnUCQdPTlW/tmNj/Q=" - }, - "rimraf": { - "version": "2.6.2", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.2.tgz", - "integrity": "sha512-lreewLK/BlghmxtfH36YYVg1i8IAce4TI7oao75I1g245+6BctqTVQiBP3YUJ9C6DQOXJmkYR9X9fCLtCOJc5w==", - "requires": { - "glob": "^7.0.5" - } - }, - "run-queue": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/run-queue/-/run-queue-1.0.3.tgz", - "integrity": "sha1-6Eg5bwV9Ij8kOGkkYY4laUFh7Ec=", - "requires": { - "aproba": "^1.1.1" - } - }, - "safe-buffer": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" - }, - "safer-buffer": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", - "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" - }, - "semver": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.6.0.tgz", - "integrity": "sha512-RS9R6R35NYgQn++fkDWaOmqGoj4Ek9gGs+DPxNUZKuwE183xjJroKvyo1IzVFeXvUrvmALy6FWD5xrdJT25gMg==" - }, - "set-blocking": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", - "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=" - }, - "shebang-command": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz", - "integrity": "sha1-RKrGW2lbAzmJaMOfNj/uXer98eo=", - "requires": { - "shebang-regex": "^1.0.0" - } - }, - "shebang-regex": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz", - "integrity": "sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM=" - }, - "signal-exit": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz", - "integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=" - }, - "smart-buffer": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/smart-buffer/-/smart-buffer-4.0.1.tgz", - "integrity": "sha512-RFqinRVJVcCAL9Uh1oVqE6FZkqsyLiVOYEZ20TqIOjuX7iFVJ+zsbs4RIghnw/pTs7mZvt8ZHhvm1ZUrR4fykg==" - }, - "socks": { - "version": "2.2.2", - "resolved": "https://registry.npmjs.org/socks/-/socks-2.2.2.tgz", - "integrity": "sha512-g6wjBnnMOZpE0ym6e0uHSddz9p3a+WsBaaYQaBaSCJYvrC4IXykQR9MNGjLQf38e9iIIhp3b1/Zk8YZI3KGJ0Q==", - "requires": { - "ip": "^1.1.5", - "smart-buffer": "^4.0.1" - } - }, - "socks-proxy-agent": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/socks-proxy-agent/-/socks-proxy-agent-4.0.1.tgz", - "integrity": "sha512-Kezx6/VBguXOsEe5oU3lXYyKMi4+gva72TwJ7pQY5JfqUx2nMk7NXA6z/mpNqIlfQjWYVfeuNvQjexiTaTn6Nw==", - "requires": { - "agent-base": "~4.2.0", - "socks": "~2.2.0" - } - }, - "ssri": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/ssri/-/ssri-6.0.1.tgz", - "integrity": "sha512-3Wge10hNcT1Kur4PDFwEieXSCMCJs/7WvSACcrMYrNp+b8kDL1/0wJch5Ni2WrtwEa2IO8OsVfeKIciKCDx/QA==", - "requires": { - "figgy-pudding": "^3.5.1" - } - }, - "stream-each": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/stream-each/-/stream-each-1.2.3.tgz", - "integrity": "sha512-vlMC2f8I2u/bZGqkdfLQW/13Zihpej/7PmSiMQsbYddxuTsJp8vRe2x2FvVExZg7FaOds43ROAuFJwPR4MTZLw==", - "requires": { - "end-of-stream": "^1.1.0", - "stream-shift": "^1.0.0" - } - }, - "stream-shift": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/stream-shift/-/stream-shift-1.0.0.tgz", - "integrity": "sha1-1cdSgl5TZ+eG944Y5EXqIjoVWVI=" - }, - "string-width": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", - "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", - "requires": { - "is-fullwidth-code-point": "^2.0.0", - "strip-ansi": "^4.0.0" - } - }, - "string.prototype.padend": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/string.prototype.padend/-/string.prototype.padend-3.0.0.tgz", - "integrity": "sha1-86rvfBcZ8XDF6rHDK/eA2W4h8vA=", - "requires": { - "define-properties": "^1.1.2", - "es-abstract": "^1.4.3", - "function-bind": "^1.0.2" - } - }, - "string_decoder": { - "version": "1.1.1", - "resolved": "http://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", - "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", - "requires": { - "safe-buffer": "~5.1.0" - } - }, - "strip-ansi": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", - "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", - "requires": { - "ansi-regex": "^3.0.0" - } - }, - "strip-eof": { - "version": "1.0.0", - "resolved": "http://registry.npmjs.org/strip-eof/-/strip-eof-1.0.0.tgz", - "integrity": "sha1-u0P/VZim6wXYm1n80SnJgzE2Br8=" - }, - "supports-color": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", - "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", - "requires": { - "has-flag": "^3.0.0" - } - }, - "thenify": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/thenify/-/thenify-3.3.0.tgz", - "integrity": "sha1-5p44obq+lpsBCCB5eLn2K4hgSDk=", - "requires": { - "any-promise": "^1.0.0" - } - }, - "thenify-all": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/thenify-all/-/thenify-all-1.6.0.tgz", - "integrity": "sha1-GhkY1ALY/D+Y+/I02wvMjMEOlyY=", - "requires": { - "thenify": ">= 3.1.0 < 4" - } - }, - "through2": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/through2/-/through2-2.0.5.tgz", - "integrity": "sha512-/mrRod8xqpA+IHSLyGCQ2s8SPHiCDEeQJSep1jqLYeEUClOFG2Qsh+4FU6G9VeqpZnGW/Su8LQGc4YKni5rYSQ==", - "requires": { - "readable-stream": "~2.3.6", - "xtend": "~4.0.1" - } - }, - "typedarray": { - "version": "0.0.6", - "resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz", - "integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=" - }, - "unique-filename": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/unique-filename/-/unique-filename-1.1.1.tgz", - "integrity": "sha512-Vmp0jIp2ln35UTXuryvjzkjGdRyf9b2lTXuSYUiPmzRcl3FDtYqAwOnTJkAngD9SWhnoJzDbTKwaOrZ+STtxNQ==", - "requires": { - "unique-slug": "^2.0.0" - } - }, - "unique-slug": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/unique-slug/-/unique-slug-2.0.1.tgz", - "integrity": "sha512-n9cU6+gITaVu7VGj1Z8feKMmfAjEAQGhwD9fE3zvpRRa0wEIx8ODYkVGfSc94M2OX00tUFV8wH3zYbm1I8mxFg==", - "requires": { - "imurmurhash": "^0.1.4" - } - }, - "universal-user-agent": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/universal-user-agent/-/universal-user-agent-2.0.2.tgz", - "integrity": "sha512-nOwvHWLH3dBazyuzbECPA5uVFNd7AlgviXRHgR4yf48QqitIvpdncRrxMbZNMpPPEfgz30I9ubd1XmiJiqsTrg==", - "requires": { - "os-name": "^3.0.0" - } - }, - "url-template": { - "version": "2.0.8", - "resolved": "https://registry.npmjs.org/url-template/-/url-template-2.0.8.tgz", - "integrity": "sha1-/FZaPMy/93MMd19WQflVV5FDnyE=" - }, - "util-deprecate": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", - "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=" - }, - "which": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", - "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", - "requires": { - "isexe": "^2.0.0" - } - }, - "which-module": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.0.tgz", - "integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=" - }, - "windows-release": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/windows-release/-/windows-release-3.1.0.tgz", - "integrity": "sha512-hBb7m7acFgQPQc222uEQTmdcGLeBmQLNLFIh0rDk3CwFOBrfjefLzEfEfmpMq8Af/n/GnFf3eYf203FY1PmudA==", - "requires": { - "execa": "^0.10.0" - } - }, - "wrap-ansi": { - "version": "2.1.0", - "resolved": "http://registry.npmjs.org/wrap-ansi/-/wrap-ansi-2.1.0.tgz", - "integrity": "sha1-2Pw9KE3QV5T+hJc8rs3Rz4JP3YU=", - "requires": { - "string-width": "^1.0.1", - "strip-ansi": "^3.0.1" - }, - "dependencies": { - "ansi-regex": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", - "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=" - }, - "is-fullwidth-code-point": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", - "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", - "requires": { - "number-is-nan": "^1.0.0" - } - }, - "string-width": { - "version": "1.0.2", - "resolved": "http://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", - "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", - "requires": { - "code-point-at": "^1.0.0", - "is-fullwidth-code-point": "^1.0.0", - "strip-ansi": "^3.0.0" - } - }, - "strip-ansi": { - "version": "3.0.1", - "resolved": "http://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", - "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", - "requires": { - "ansi-regex": "^2.0.0" - } - } - } - }, - "wrappy": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" - }, - "xtend": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.1.tgz", - "integrity": "sha1-pcbVMr5lbiPbgg77lDofBJmNY68=" - }, - "y18n": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/y18n/-/y18n-3.2.1.tgz", - "integrity": "sha1-bRX7qITAhnnA136I53WegR4H+kE=" - }, - "yallist": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-2.1.2.tgz", - "integrity": "sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI=" - }, - "yargs": { - "version": "11.1.0", - "resolved": "http://registry.npmjs.org/yargs/-/yargs-11.1.0.tgz", - "integrity": "sha512-NwW69J42EsCSanF8kyn5upxvjp5ds+t3+udGBeTbFnERA+lF541DDpMawzo4z6W/QrzNM18D+BPMiOBibnFV5A==", - "requires": { - "cliui": "^4.0.0", - "decamelize": "^1.1.1", - "find-up": "^2.1.0", - "get-caller-file": "^1.0.1", - "os-locale": "^2.0.0", - "require-directory": "^2.1.1", - "require-main-filename": "^1.0.1", - "set-blocking": "^2.0.0", - "string-width": "^2.0.0", - "which-module": "^2.0.0", - "y18n": "^3.2.1", - "yargs-parser": "^9.0.2" - }, - "dependencies": { - "yargs-parser": { - "version": "9.0.2", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-9.0.2.tgz", - "integrity": "sha1-nM9qQ0YP5O1Aqbto9I1DuKaMwHc=", - "requires": { - "camelcase": "^4.1.0" - } - } - } - }, - "yargs-parser": { - "version": "8.1.0", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-8.1.0.tgz", - "integrity": "sha512-yP+6QqN8BmrgW2ggLtTbdrOyBNSI7zBa4IykmiV5R1wl1JWNxQvWhMfMdmzIYtKU7oP3OOInY/tl2ov3BDjnJQ==", - "requires": { - "camelcase": "^4.1.0" - } - } - } -} diff --git a/.github/actions/trigger-github-release/package.json b/.github/actions/trigger-github-release/package.json deleted file mode 100644 index 04d1dee9653a..000000000000 --- a/.github/actions/trigger-github-release/package.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "private": true, - "name": "@internal/trigger-github-release", - "version": "0.0.1", - "author": "Nicolò Ribaudo ", - "license": "MIT", - "dependencies": { - "@octokit/rest": "^16.3.0", - "get-stdin": "^6.0.0", - "lerna-changelog": "^0.8.2" - } -} diff --git a/.github/actions/trigger-github-release/release.js b/.github/actions/trigger-github-release/release.js deleted file mode 100644 index 1979f5e14d03..000000000000 --- a/.github/actions/trigger-github-release/release.js +++ /dev/null @@ -1,26 +0,0 @@ -"use strict"; - -const [ /* node */, /* file */, tag ] = process.argv; - -const getStdin = require("get-stdin"); -const octokit = require("@octokit/rest")(); - -octokit.authenticate({ - type: "token", - token: process.env.GITHUB_TOKEN -}); - -const [ repoOwner, repoName ] = process.env.GITHUB_REPOSITORY.split("/"); - -getStdin() - .then(changelog => octokit.repos.createRelease({ - owner: repoOwner, - repo: repoName, - tag_name: tag, - body: changelog, - draft: true, - })) - .catch(err => { - console.error(err); - process.exit(1); - }); diff --git a/.github/actions/trigger-github-release/update-changelog.js b/.github/actions/trigger-github-release/update-changelog.js deleted file mode 100644 index f7fdd7fbdedd..000000000000 --- a/.github/actions/trigger-github-release/update-changelog.js +++ /dev/null @@ -1,31 +0,0 @@ -"use strict"; - -const getStdin = require("get-stdin"); -const fs = require("fs").promises; -const path = require("path"); - -const { GITHUB_WORKSPACE } = process.env; - -const INSERTION_POINT = ""; -const CHANGELOG = path.resolve(GITHUB_WORKSPACE, "CHANGELOG.md"); - -main(); -async function main() { - let [stdin, changelog] = await Promise.all([ - getStdin(), - fs.readFile(CHANGELOG, "utf8"), - ]); - - if (!changelog.includes(INSERTION_POINT)) { - throw new Error(`Missing "${INSERTION_POINT}" in CHANGELOG.md`); - } - - // Remove committers - stdin = stdin.split("\n\n#### Committers")[0]; - changelog = changelog.replace( - INSERTION_POINT, - INSERTION_POINT + "\n" + stdin - ); - - await fs.writeFile(CHANGELOG, changelog); -} diff --git a/.github/lock.yml b/.github/lock.yml deleted file mode 100644 index 7737237177e2..000000000000 --- a/.github/lock.yml +++ /dev/null @@ -1,12 +0,0 @@ -# Configuration for lock-threads - https://github.com/dessant/lock-threads - -# Number of days of inactivity before a closed issue or pull request is locked -daysUntilLock: 91 -# Comment to post before locking. Set to `false` to disable -lockComment: false -only: issues -lockLabel: 'outdated' - -# Issues or pull requests with these labels will not be locked -# exemptLabels: -# - no-locking diff --git a/.github/main.workflow b/.github/main.workflow deleted file mode 100644 index 34173cb45992..000000000000 --- a/.github/main.workflow +++ /dev/null @@ -1,53 +0,0 @@ -workflow "Release" { - on = "push" - resolves = [ - "Trigger GitHub release", - # GitHub actions are too slow for this, it takes more than 15 mins. - # Publishing to npm from GH actions is a cool idea, but it's a lot faster to - # publish locally. - # "Publish to npm", - ] -} - -action "Trigger GitHub release" { - uses = "./.github/actions/trigger-github-release/" - secrets = ["GITHUB_TOKEN"] - env = { - COMMIT_AUTHOR_NAME = "Babel Bot" - COMMIT_AUTHOR_EMAIL = "babel-bot@users.noreply.github.com" - } - needs = ["Create release tag"] -} - -action "Publish to npm" { - uses = "docker://node:10" - secrets = ["NPM_TOKEN"] - runs = "make" - args = "publish-ci" - env = { - CI = "true" - } - needs = ["Create release tag"] -} - -# When GitHub Actions will support the "release" event for public -# repositories, we won't need this checks anymore. -action "Create release tag" { - uses = "./.github/actions/create-release-tag" - needs = [ - "Is version commit", - "On master branch", - ] -} - -action "Is version commit" { - uses = "./.github/actions/filter-commit-message" - # This regex is run using "grep -P". - # The (-\\S+) part is for 7.0.0-beta.1 releases. - args = "^v(\\d+\\.){2}\\d+(-\\S+)?$" -} - -action "On master branch" { - uses = "actions/bin/filter@master" - args = "branch master" -} diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml new file mode 100644 index 000000000000..03738da23034 --- /dev/null +++ b/.github/workflows/coverage.yml @@ -0,0 +1,29 @@ +name: Report Coverage + +on: [push, pull_request] + +jobs: + build: + runs-on: ubuntu-latest + strategy: + matrix: + node-version: [13.x] + steps: + - name: Checkout code + uses: actions/checkout@v1 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v1 + with: + node-version: ${{ matrix.node-version }} + - name: Environment log + id: env + run: | + yarn --version + - name: Generate coverage report + run: | + yarn --version + make -j test-ci-coverage + - name: Upload coverage report + uses: codecov/codecov-action@v1 + with: + token: ${{ secrets.CODECOV_TOKEN }} diff --git a/.github/workflows/issue-triage.yml b/.github/workflows/issue-triage.yml new file mode 100644 index 000000000000..574fd4f550d4 --- /dev/null +++ b/.github/workflows/issue-triage.yml @@ -0,0 +1,81 @@ +name: Issue Triage + +on: + issues: + types: [opened, labeled] + +jobs: + welcome: + name: Welcome comment + runs-on: ubuntu-latest + steps: + - name: Check if Babel member + id: is_babel_member + if: github.event.action == 'opened' + uses: babel/actions/is-org-member@v2 + with: + org: babel + username: ${{ github.event.issue.user.login }} + token: ${{ secrets.GITHUB_TOKEN }} + - name: Create Welcome Comment + uses: babel/actions/create-comment@v2 + if: | + github.event.action == 'opened' && + steps.is_babel_member.outputs.result == 0 + with: + token: ${{ secrets.BOT_TOKEN }} + issue: ${{ github.event.issue.number }} + comment: > + Hey @${{ github.event.issue.user.login }}! + We really appreciate you taking the time to report an issue. The + collaborators on this project attempt to help as many people as + possible, but we're a limited number of volunteers, so it's + possible this won't be addressed swiftly. + + + If you need any help, or just have general Babel or JavaScript questions, we have a + vibrant [Slack community](https://babeljs.slack.com) that typically always has someone + willing to help. You can sign-up [here](https://slack.babeljs.io/) for an invite." + + needs_info: + name: Needs Info + runs-on: ubuntu-latest + steps: + - name: Create Needs Info Comment + uses: babel/actions/create-comment@v2 + if: | + github.event.action == 'labeled' && + github.event.label.name == 'Needs Info' + with: + token: ${{ secrets.BOT_TOKEN }} + issue: ${{ github.event.issue.number }} + comment: > + Hi @${{ github.event.issue.user.login }}! + This issue is missing some important information we'll need + to be able to reproduce this issue. + + + Please understand that we receive a high volume of issues, + and there are only a limited number of volunteers that help + maintain this project. The easier it is for us to decipher an + issue with the info provided, the more likely it is that we'll + be able to help. + + + Please make sure you have the following information documented in + this ticket: + + 1. Your Babel configuration (typically from `.babelrc` or `babel.config.js`) + + 2. The current (incorrect) behavior you're seeing + + 3. The behavior you expect + + 4. A [short, self-contained example](http://sscce.org/) + + + Please provide either a link to the problem via the + [`repl`](https://babeljs.io/repl/), or if the `repl` is + insufficient, a new and minimal repository with instructions on + how to build/replicate the issue. + diff --git a/.github/workflows/lock.yml b/.github/workflows/lock.yml new file mode 100644 index 000000000000..e68792313c89 --- /dev/null +++ b/.github/workflows/lock.yml @@ -0,0 +1,17 @@ +name: Lock Threads + +on: + schedule: + - cron: '0 4 * * *' + +jobs: + lock: + runs-on: ubuntu-latest + steps: + - uses: dessant/lock-threads@v2 + with: + github-token: ${{ github.token }} + issue-lock-inactive-days: '91' + issue-lock-labels: 'outdated' + pr-lock-inactive-days: '91' + pr-lock-labels: 'outdated' diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 000000000000..f56849952c55 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,53 @@ +name: Release + +on: + push: + tags: ["v*"] + +jobs: + github_release: + name: Trigger GitHub release + runs-on: ubuntu-latest + steps: + - name: Checkout the new tag + uses: actions/checkout@v1.0.0 + + - name: Get tag info + id: tags + uses: babel/actions/get-release-tags@v2 + + - name: Generate the changelog + id: changelog + uses: babel/actions/generate-lerna-changelog@v2 + with: + from: ${{ steps.tags.outputs.old }} + to: ${{ steps.tags.outputs.new }} + env: + GITHUB_AUTH: ${{ secrets.GITHUB_TOKEN }} + + - name: Create a draft GitHub release + uses: babel/actions/publish-github-release@v2 + with: + tag: ${{ steps.tags.outputs.new }} + changelog: ${{ steps.changelog.outputs.changelog }} + token: ${{ secrets.BOT_TOKEN }} + + - name: Check if releasing from master + id: is_master + uses: babel/actions/ref-matches-branch@v2 + with: + name: master + + - name: Update CHANGELOG.md + if: steps.is_master.outputs.result == 1 + uses: babel/actions/update-changelog@v2 + with: + changelog: ${{ steps.changelog.outputs.changelog }} + + - name: Commit CHANGELOG.md + if: steps.is_master.outputs.result == 1 + run: | + git add CHANGELOG.md + git -c user.name="Babel Bot" -c user.email="babel-bot@users.noreply.github.com" \ + commit -m "Add ${{ steps.tags.outputs.new }} to CHANGELOG.md [skip ci]" --no-verify --quiet + git push "https://babel-bot:${{ secrets.BOT_TOKEN }}@github.com/${GITHUB_REPOSITORY}.git" master diff --git a/.gitignore b/.gitignore index 2f99b017304b..ae39564eb8a4 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,11 @@ .npmrc +.yarn/cache +.yarn/unplugged +.yarn/build-state.yml +.yarn/install-state.gz +.pnp.js + .DS_Store /node_modules /.github/actions/*/node_modules @@ -20,6 +26,8 @@ dist package-lock.json !/.github/actions/*/package-lock.json +/packages/babel-compat-data/build + /packages/babel-runtime/helpers/*.js !/packages/babel-runtime/helpers/toArray.js !/packages/babel-runtime/helpers/iterableToArray.js @@ -52,11 +60,15 @@ package-lock.json .nyc_output /babel.sublime-workspace packages/babel-standalone/babel.js +packages/babel-standalone/babel.js.map packages/babel-standalone/babel.min.js -packages/babel-preset-env-standalone/babel-preset-env.js -packages/babel-preset-env-standalone/babel-preset-env.min.js /codemods/*/lib /codemods/*/node_modules /packages/babel-parser/build .idea/ /.changelog + +/eslint/*/lib +/eslint/*/node_modules +/eslint/*/LICENSE +!/packages/babel-eslint-plugin/LICENSE diff --git a/.prettierignore b/.prettierignore index e86c7aa505d3..19e8316f03eb 100644 --- a/.prettierignore +++ b/.prettierignore @@ -1,5 +1,7 @@ package.json packages/babel-preset-env/data +packages/babel-compat-data/data +packages/babel-compat-data/scripts/data/overlapping-plugins.js packages/*/test/fixtures/**/input.* packages/*/test/fixtures/**/exec.* packages/*/test/fixtures/**/output.* diff --git a/.prettierrc b/.prettierrc index 5c53b22f8ab7..bfe4721c3432 100644 --- a/.prettierrc +++ b/.prettierrc @@ -13,10 +13,12 @@ "**/codemods/*/src/**/*.js", "**/codemods/*/test/**/*.js", "**/packages/*/src/**/*.js", - "**/packages/*/test/**/*.js" + "**/packages/*/test/**/*.js", + "**/eslint/*/src/**/*.js", + "**/eslint/*/test/**/*.js" ], - "parser": "babylon", "options": { + "parser": "babel", "trailingComma": "all" } }] diff --git a/.travis.yml b/.travis.yml index 3957c277c102..0b5f27f648e6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,43 +3,52 @@ git: language: node_js cache: yarn: true -node_js: - # We test the latest version on circleci - - '11' - - '10' - - '8' - - '6' + +os: linux env: global: - PATH=$HOME/.yarn/bin:$PATH - JOB=test -before_install: - - curl -o- -L https://yarnpkg.com/install.sh | bash - -install: - # the `make test-ci` script runs this command already - - if [ "$JOB" != "test" ] && [ "$JOB" != "lint" ]; then yarn install; fi - - if [ "$JOB" = "lint" ]; then make bootstrap; fi - +install: skip before_script: - - if [ "$JOB" = "babel-parser-flow-tests" ]; then make bootstrap-flow; fi - - if [ "$JOB" = "babel-parser-test262-tests" ]; then make bootstrap-test262; fi + - if [ "$TRAVIS_OS_NAME" = "windows" ]; then choco install make; fi script: - - if [ "$JOB" = "test" ]; then make test-ci; fi - - if [ "$JOB" = "lint" ]; then make lint && make flow; fi - - if [ "$JOB" = "babel-parser-flow-tests" ]; then make test-flow-ci; fi - - if [ "$JOB" = "babel-parser-test262-tests" ]; then make test-test262-ci; fi + - if [ "$JOB" = "test" ]; then make -j test-ci; fi + - if [ "$JOB" = "lint" ]; then make -j code-quality-ci; fi + - if [ "$JOB" = "babel-parser-flow-tests" ]; then make -j test-flow-ci; fi + - if [ "$JOB" = "babel-parser-typescript-tests" ]; then make -j test-typescript-ci; fi + - if [ "$JOB" = "babel-parser-test262-tests" ]; then make -j test-test262-ci; fi matrix: fast_finish: true include: - node_js: "node" env: JOB=lint + # We test the latest version on circleci + - node_js: "13" + # Move `windows` build to be the third since it is slow + - os: windows + node_js: "node" + env: + - JOB=test + # https://travis-ci.community/t/build-doesnt-finish-after-completing-tests/288/9 + - YARN_GPG=no + cache: + yarn: true + directories: + - $HOME/AppData/Local/Temp/chocolatey + # Continue node_js matrix + - node_js: "6" + - node_js: "12" + - node_js: "10" + - node_js: "8" - node_js: "node" env: JOB=babel-parser-flow-tests + - node_js: "node" + env: JOB=babel-parser-typescript-tests - node_js: "node" env: JOB=babel-parser-test262-tests diff --git a/CHANGELOG.md b/CHANGELOG.md index 9ce2fc517e3d..5ddb3d7f6559 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ > **Tags:** > - :boom: [Breaking Change] -> - :eyeglasses: [Spec Compliancy] +> - :eyeglasses: [Spec Compliance] > - :rocket: [New Feature] > - :bug: [Bug Fix] > - :memo: [Documentation] @@ -13,10 +13,931 @@ _Note: Gaps between patch versions are faulty, broken or test releases._ See [CHANGELOG - v4](/.github/CHANGELOG-v4.md), [CHANGELOG - v5](/.github/CHANGELOG-v5.md), and [CHANGELOG - v6](/.github/CHANGELOG-v6.md) for v4.x-v6.x changes. See [CHANGELOG - 6to5](/.github/CHANGELOG-6to5.md) for the pre-4.0.0 version changelog. -See [Babylon's CHANGELOG](packages/babylon/CHANGELOG.md) for the Babylon pre-7.0.0-beta.29 version changelog. +See [Babylon's CHANGELOG](packages/babel-parser/CHANGELOG.md) for the Babylon pre-7.0.0-beta.29 version changelog. +See [`babel-eslint`'s releases](https://github.com/babel/babel-eslint/releases) for the changelog before `@babel/eslint-parser` 7.8.0. +See [`eslint-plugin-babel`'s releases](https://github.com/babel/eslint-plugin-babel/releases) for the changelog before `@babel/eslint-plugin` 7.8.0. +## v7.9.5 (2020-04-07) + +#### :bug: Bug Fix +* `babel-plugin-proposal-object-rest-spread`, `babel-plugin-transform-parameters` + * [#11326](https://github.com/babel/babel/pull/11326) Correctly transpile when default parameter initializer references binding in rest pattern ([@vedantroy](https://github.com/vedantroy)) +* `babel-traverse` + * [#11375](https://github.com/babel/babel/pull/11375) Fixed generateUid creating clashing ids after scope re-crawling ([@Andarist](https://github.com/Andarist)) + * [#11323](https://github.com/babel/babel/pull/11323) Fixed issue with programPath.scope.references not being registered back correctly after scope re-crawling ([@Andarist](https://github.com/Andarist)) +* `babel-plugin-transform-destructuring` + * [#11360](https://github.com/babel/babel/pull/11360) fix Incorrect destructuring compilation of `for (let [[x] = [1]] = []… ([@Zzzen](https://github.com/Zzzen)) +* `babel-preset-env` + * [#11373](https://github.com/babel/babel/pull/11373) Fixed useBuiltIns and modules validation when using 'false' as option ([@JMarkoski](https://github.com/JMarkoski)) +* `babel-plugin-transform-classes` + * [#11341](https://github.com/babel/babel/pull/11341) Fix createSuper in Babel <7.5.5 ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo)) +* `babel-helper-function-name`, `babel-plugin-transform-function-name` + * [#11361](https://github.com/babel/babel/pull/11361) fix: do not add function name when parent's operator is not `=` ([@JLHwung](https://github.com/JLHwung)) +* `babel-helper-builder-react-jsx-experimental`, `babel-plugin-transform-react-jsx` + * [#11354](https://github.com/babel/babel/pull/11354) fix auto import error with whitespace JSXText ([@lunaruan](https://github.com/lunaruan)) +* `babel-types` + * [#11359](https://github.com/babel/babel/pull/11359) fix: allow logical assignment operators in AssignmentExpression ([@JLHwung](https://github.com/JLHwung)) +* `babel-plugin-transform-parameters` + * [#11346](https://github.com/babel/babel/pull/11346) Set correct async/generator in IIFE for params ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo)) +* `babel-helper-create-class-features-plugin` + * [#11345](https://github.com/babel/babel/pull/11345) Ignore abstract methods when decorating class ([@oliverdunk](https://github.com/oliverdunk)) + +#### :nail_care: Polish +* `babel-plugin-transform-parameters` + * [#11349](https://github.com/babel/babel/pull/11349) Don't check type annotations when deciding params scope ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo)) +* `babel-traverse` + * [#11368](https://github.com/babel/babel/pull/11368) Simplify scope.hasReferences implementation ([@Andarist](https://github.com/Andarist)) +* `babel-plugin-proposal-class-properties`, `babel-plugin-proposal-decorators`, `babel-plugin-transform-classes`, `babel-plugin-transform-parameters`, `babel-plugin-transform-runtime`, `babel-plugin-transform-typescript`, `babel-preset-env` + * [#11358](https://github.com/babel/babel/pull/11358) Don't call `createSuper` in loose mode (it was unused) ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo)) +* `babel-generator` + * [#11328](https://github.com/babel/babel/pull/11328) polish: align optional chain whitespace behavior to their sibiling ([@JLHwung](https://github.com/JLHwung)) + +#### :house: Internal +* [#11374](https://github.com/babel/babel/pull/11374) Bump handlebars dep ([@existentialism](https://github.com/existentialism)) +* [#11347](https://github.com/babel/babel/pull/11347) Fix e2e publish test when branching from an older version ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo)) +* [#11329](https://github.com/babel/babel/pull/11329) chore: remove unused graceful-fs ([@JLHwung](https://github.com/JLHwung)) +## v7.9.4 (2020-03-24) + +#### :bug: Bug Fix +* `babel-parser` + * [#11186](https://github.com/babel/babel/pull/11186) fix: token after strict mode block is evaluated in strict mode ([@kaicataldo](https://github.com/kaicataldo)) +* `babel-generator` + * [#11325](https://github.com/babel/babel/pull/11325) fix: check parentheses between optional chain and other types ([@JLHwung](https://github.com/JLHwung)) +* `babel-plugin-transform-react-jsx`, `babel-preset-react` + * [#11324](https://github.com/babel/babel/pull/11324) Restore default pragmas in preset-react for classic runtime ([@existentialism](https://github.com/existentialism)) +* `babel-plugin-transform-typescript` + * [#11315](https://github.com/babel/babel/pull/11315) [preset-typescript] Fix private members type annotations ([@Lodin](https://github.com/Lodin)) + +#### :house: Internal +* `babel-parser` + * [#11322](https://github.com/babel/babel/pull/11322) Compact parser fixture loc info ([@JLHwung](https://github.com/JLHwung)) +## v7.9.3 (2020-03-22) + +#### :bug: Bug Fix +* `babel-plugin-transform-parameters` + * [#11307](https://github.com/babel/babel/pull/11307) Define default value for vars shadowing params ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo)) +* `babel-generator` + * [#11306](https://github.com/babel/babel/pull/11306) Fix logic to insert parens in return statements with comments ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo)) +* `babel-parser` + * [#11284](https://github.com/babel/babel/pull/11284) fix: async arrow functions should not be allowed after binary operator. ([@vedantroy](https://github.com/vedantroy)) + +#### :house: Internal +* [#11293](https://github.com/babel/babel/pull/11293) chore: fix build-babel exclude in gulpfile ([@JLHwung](https://github.com/JLHwung)) +## v7.9.2 (2020-03-21) + +#### :bug: Bug Fix +* `babel-helpers`, `babel-plugin-transform-classes` + * [#11298](https://github.com/babel/babel/pull/11298) Manually inline the createSuper helper on older Babel versions ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo)) +* `babel-helpers` + * [#11302](https://github.com/babel/babel/pull/11302) Don't use ES6 in the for-of helper ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo)) +* `babel-parser`, `babel-plugin-transform-typescript` + * [#11296](https://github.com/babel/babel/pull/11296) fix: parse value imports named type as values ([@kaicataldo](https://github.com/kaicataldo)) + +#### :house: Internal +* `babel-helper-transform-fixture-test-runner`, `babel-plugin-transform-react-jsx-development`, `babel-preset-react` + * [#11297](https://github.com/babel/babel/pull/11297) Transform cwd in string literal on win32 ([@JLHwung](https://github.com/JLHwung)) +## v7.9.1 (2020-03-20) + +#### :bug: Bug Fix +* `babel-plugin-transform-react-jsx`, `babel-preset-react` + * [#11295](https://github.com/babel/babel/pull/11295) Consider jsxFrag as set when it's set to the default value ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo)) +## v7.9.0 (2020-03-20) + +#### :rocket: New Feature +* `babel-generator`, `babel-helper-builder-react-jsx-experimental`, `babel-helper-builder-react-jsx`, `babel-plugin-transform-block-scoping`, `babel-plugin-transform-classes`, `babel-plugin-transform-function-name`, `babel-plugin-transform-react-constant-elements`, `babel-plugin-transform-react-inline-elements`, `babel-plugin-transform-react-jsx-development`, `babel-plugin-transform-react-jsx`, `babel-plugin-transform-regenerator`, `babel-preset-react`, `babel-preset-typescript`, `babel-standalone` + * [#11126](https://github.com/babel/babel/pull/11126) Mark transpiled JSX elements as pure ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo)) +* `babel-helper-builder-react-jsx-experimental`, `babel-helper-builder-react-jsx`, `babel-plugin-transform-react-jsx-development`, `babel-plugin-transform-react-jsx-self`, `babel-plugin-transform-react-jsx`, `babel-preset-react`, `babel-standalone` + * [#11154](https://github.com/babel/babel/pull/11154) Add experimental version of the `babel-plugin-transform-react-jsx` transform ([@lunaruan](https://github.com/lunaruan)) +* `babel-compat-data`, `babel-preset-env` + * [#11083](https://github.com/babel/babel/pull/11083) Include preset modules ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo)) + * [#10971](https://github.com/babel/babel/pull/10971) Add numeric separator to `shippedProposals` ([@Wetinee](https://github.com/Wetinee)) +* `babel-core`, `babel-helpers`, `babel-plugin-proposal-class-properties`, `babel-plugin-proposal-decorators`, `babel-plugin-transform-classes`, `babel-plugin-transform-function-name`, `babel-plugin-transform-parameters`, `babel-plugin-transform-react-jsx`, `babel-plugin-transform-runtime`, `babel-plugin-transform-typescript`, `babel-preset-env` + * [#8656](https://github.com/babel/babel/pull/8656) Allow extending untranspiled classes ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo)) +* `babel-core`, `babel-helper-module-transforms`, `babel-plugin-transform-modules-amd`, `babel-plugin-transform-modules-commonjs`, `babel-plugin-transform-modules-systemjs`, `babel-plugin-transform-modules-umd` + * [#11194](https://github.com/babel/babel/pull/11194) Allow defining the moduleIds-related option in the transform plugins ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo)) +* `babel-core`, `babel-generator`, `babel-parser`, `babel-plugin-syntax-record-and-tuple`, `babel-types` + * [#10865](https://github.com/babel/babel/pull/10865) Added support for record and tuple syntax. ([@rickbutton](https://github.com/rickbutton)) +* `babel-generator`, `babel-parser`, `babel-plugin-transform-flow-strip-types`, `babel-preset-flow` + * [#11178](https://github.com/babel/babel/pull/11178) Implement support for `declare` on class fields with Flow ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo)) +* `babel-types` + * [#10680](https://github.com/babel/babel/pull/10680) Add cloneDeepWithoutLoc ([@Taym95](https://github.com/Taym95)) +* `babel-generator` + * [#11028](https://github.com/babel/babel/pull/11028) Added jsescOptions to Numeric Literals ([@sidntrivedi012](https://github.com/sidntrivedi012)) +* `babel-generator`, `babel-parser`, `babel-types` + * [#11077](https://github.com/babel/babel/pull/11077) Add support for flow's SymbolTypeAnnotation ([@existentialism](https://github.com/existentialism)) +* `babel-parser` + * [#11117](https://github.com/babel/babel/pull/11117) Parse BigInts by default ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo)) + * [#11254](https://github.com/babel/babel/pull/11254) Add estree parsing support for `export * as A` ([@existentialism](https://github.com/existentialism)) + * [#11246](https://github.com/babel/babel/pull/11246) feat: align ID_Start/ID_Continue regex to Unicode 13.0.0 ([@JLHwung](https://github.com/JLHwung)) +* `babel-plugin-transform-react-jsx-source`, `babel-preset-react` + * [#11139](https://github.com/babel/babel/pull/11139) feat(react-jsx-source): add columnNumber property ([@motiz88](https://github.com/motiz88)) +* `babel-generator`, `babel-parser`, `babel-plugin-transform-typescript`, `babel-preset-typescript`, `babel-types` + * [#11171](https://github.com/babel/babel/pull/11171) Add `import type` and `export type` support to TypeScript ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo)) + +#### :bug: Bug Fix +* `babel-helper-builder-react-jsx-experimental`, `babel-helper-builder-react-jsx`, `babel-helper-validator-identifier`, `babel-highlight`, `babel-parser`, `babel-types` + * [#11289](https://github.com/babel/babel/pull/11289) Add @babel/helper-validator-identifier ([@JLHwung](https://github.com/JLHwung)) +* `babel-plugin-proposal-optional-chaining` + * [#11261](https://github.com/babel/babel/pull/11261) Memoize call expressions in optional chains in loose mode ([@oliverdunk](https://github.com/oliverdunk)) +* `babel-plugin-transform-react-jsx-self`, `babel-preset-react` + * [#11290](https://github.com/babel/babel/pull/11290) Pass the correct `this` to JSX's `__self` with the old plugin ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo)) +* `babel-helper-builder-react-jsx-experimental`, `babel-plugin-transform-react-jsx-development`, `babel-plugin-transform-react-jsx` + * [#11288](https://github.com/babel/babel/pull/11288) Use the correct `this` in `__self` for JSX elements in arrows ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo)) +* `babel-compat-data`, `babel-preset-env` + * [#11280](https://github.com/babel/babel/pull/11280) Move `object-rest-spread` after `transform-parameters` ([@JLHwung](https://github.com/JLHwung)) +* `babel-helpers`, `babel-plugin-transform-for-of`, `babel-preset-env` + * [#11285](https://github.com/babel/babel/pull/11285) Allow for-of on polyfilled or builtin iterables without `Symbol` support ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo)) + * [#11263](https://github.com/babel/babel/pull/11263) Add for-of fallback for arrays in browsers without symbol support ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo)) +* `babel-plugin-proposal-object-rest-spread` + * [#11282](https://github.com/babel/babel/pull/11282) fix: object-rest-spread should not transform export array rest ([@JLHwung](https://github.com/JLHwung)) +* `babel-register` + * [#11249](https://github.com/babel/babel/pull/11249) Add path separator to `@babel/register` sourceRoot ([@andrewdotn](https://github.com/andrewdotn)) +* `babel-core`, `babel-helpers`, `babel-plugin-transform-runtime` + * [#10575](https://github.com/babel/babel/pull/10575) Create File class for babel helpers ([@JLHwung](https://github.com/JLHwung)) +* `babel-helpers`, `babel-plugin-transform-modules-commonjs`, `babel-preset-env`, `babel-runtime-corejs2`, `babel-runtime` + * [#11268](https://github.com/babel/babel/pull/11268) Allow rest/spread on polyfilled or builtin iterables without `Symbol` support ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo)) +* `babel-parser` + * [#11148](https://github.com/babel/babel/pull/11148) Allow await when it is not in AsyncArrowHead ([@arku](https://github.com/arku)) +* `babel-helpers`, `babel-plugin-proposal-object-rest-spread`, `babel-runtime-corejs2`, `babel-runtime` + * [#9794](https://github.com/babel/babel/pull/9794) fix(rest-spread): Do not require `Symbol.iterator` for strings ([@clshortfuse](https://github.com/clshortfuse)) +* `babel-generator` + * [#11255](https://github.com/babel/babel/pull/11255) Fix printing edge cases in Nullish Coalescing and Optional Chaining ([@jridgewell](https://github.com/jridgewell)) + +#### :nail_care: Polish +* `babel-parser` + * [#11208](https://github.com/babel/babel/pull/11208) Rephrase parser error message ([@JLHwung](https://github.com/JLHwung)) +* `babel-helpers`, `babel-plugin-transform-destructuring`, `babel-plugin-transform-modules-commonjs`, `babel-plugin-transform-spread`, `babel-preset-env`, `babel-runtime-corejs2`, `babel-runtime` + * [#11264](https://github.com/babel/babel/pull/11264) Throw better errors for non-iterables when Symbol doesn't exist. ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo)) + +#### :house: Internal +* `babel-helper-builder-react-jsx-experimental`, `babel-helper-builder-react-jsx`, `babel-helper-validator-identifier`, `babel-highlight`, `babel-parser`, `babel-types` + * [#11289](https://github.com/babel/babel/pull/11289) Add @babel/helper-validator-identifier ([@JLHwung](https://github.com/JLHwung)) +* `babel-compat-data`, `babel-preset-env` + * [#11277](https://github.com/babel/babel/pull/11277) Update compat-data ([@existentialism](https://github.com/existentialism)) +* `babel-core` + * [#11276](https://github.com/babel/babel/pull/11276) chore: bump json5 and minimist ([@JLHwung](https://github.com/JLHwung)) +* `babel-types` + * [#11250](https://github.com/babel/babel/pull/11250) Add stricter Optional Chain node validation ([@jridgewell](https://github.com/jridgewell)) + * [#11267](https://github.com/babel/babel/pull/11267) Update Purish aliases ([@jridgewell](https://github.com/jridgewell)) +* `babel-helpers`, `babel-plugin-transform-block-scoping`, `babel-plugin-transform-for-of`, `babel-plugin-transform-parameters`, `babel-plugin-transform-runtime`, `babel-preset-env` + * [#11262](https://github.com/babel/babel/pull/11262) Extract for-of iterator handling to a helper ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo)) +* `babel-core`, `babel-plugin-proposal-decorators`, `babel-plugin-proposal-logical-assignment-operators`, `babel-plugin-proposal-object-rest-spread`, `babel-plugin-proposal-partial-application`, `babel-plugin-proposal-pipeline-operator`, `babel-plugin-transform-parameters`, `babel-traverse` + * [#11260](https://github.com/babel/babel/pull/11260) Support more node types in generateUidBasedOnNode ([@jridgewell](https://github.com/jridgewell)) +* Other + * [#11259](https://github.com/babel/babel/pull/11259) Remove unused `gulp-rename` ([@existentialism](https://github.com/existentialism)) +## v7.8.8 (2020-03-12) + +#### :rocket: New Feature +* `babel-helper-create-regexp-features-plugin`, `babel-plugin-proposal-unicode-property-regex`, `babel-plugin-transform-dotall-regex` + * [#11244](https://github.com/babel/babel/pull/11244) Add support for Unicode 13 in regexps (update `regexpu-core`) ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo)) + +#### :bug: Bug Fix +* `babel-plugin-transform-parameters` + * [#11242](https://github.com/babel/babel/pull/11242) fix: do not remove shadowed for-loop declarators ([@JLHwung](https://github.com/JLHwung)) +* `babel-generator` + * [#11227](https://github.com/babel/babel/pull/11227) Force parentheses around array and conditional infer ([@smelukov](https://github.com/smelukov)) +* `babel-parser` + * [#11188](https://github.com/babel/babel/pull/11188) fix: non-directive "use strict" should not enable parsing in strict mode ([@kaicataldo](https://github.com/kaicataldo)) +* `babel-preset-env` + * [#11218](https://github.com/babel/babel/pull/11218) update: preset-env-fixtures ([@kaicataldo](https://github.com/kaicataldo)) + +#### :house: Internal +* `babel-plugin-syntax-export-namespace-from` + * [#11236](https://github.com/babel/babel/pull/11236) Archive @babel/plugin-syntax-export-namespace-from ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo)) +* Other + * [#11235](https://github.com/babel/babel/pull/11235) chore: pin `@rollup/plugin-json` to 4.0.1 ([@JLHwung](https://github.com/JLHwung)) + * [#11230](https://github.com/babel/babel/pull/11230) chore: update acorn to latest version ([@JLHwung](https://github.com/JLHwung)) +* `babel-preset-env` + * [#11225](https://github.com/babel/babel/pull/11225) Update @babel deps ([@existentialism](https://github.com/existentialism)) +* `babel-parser` + * [#11219](https://github.com/babel/babel/pull/11219) refactor: remove redundant contextDescription empty check ([@JLHwung](https://github.com/JLHwung)) +## v7.8.7 (2020-03-05) + +#### :bug: Bug Fix +* `babel-preset-env` + * [#11201](https://github.com/babel/babel/pull/11201) Allow using `preset-env` with newer versions of `compat-data` ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo)) +* `babel-core` + * [#11193](https://github.com/babel/babel/pull/11193) Pass URLs to import() rather than paths ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo)) +* `babel-parser` + * [#11198](https://github.com/babel/babel/pull/11198) fix(babel-parser): chain off optionally chained keys named class and function ([@Vages](https://github.com/Vages)) +* `babel-helper-call-delegate`, `babel-plugin-transform-parameters` + * [#11158](https://github.com/babel/babel/pull/11158) Fix scope of function body when var redeclares param ([@openorclose](https://github.com/openorclose)) +* `babel-generator` + * [#11190](https://github.com/babel/babel/pull/11190) Fix printing parentheses around optional chains ([@sag1v](https://github.com/sag1v)) +* `babel-types` + * [#11184](https://github.com/babel/babel/pull/11184) Add "Statement" as alias to Flow enum declaration ([@gkz](https://github.com/gkz)) +* `babel-plugin-transform-typescript` + * [#11129](https://github.com/babel/babel/pull/11129) Typescript: Preserve decorated definite class properties ([@jamescdavis](https://github.com/jamescdavis)) + +#### :house: Internal +* `babel-parser` + * [#11192](https://github.com/babel/babel/pull/11192) Refactor: add parser message template ([@JLHwung](https://github.com/JLHwung)) +* Other + * [#11181](https://github.com/babel/babel/pull/11181) Set correct version for @babel/eslint-plugin-development ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo)) +## v7.8.6 (2020-02-27) + +#### :eyeglasses: Spec Compliance +* `babel-helper-module-transforms`, `babel-helper-replace-supers`, `babel-plugin-transform-modules-commonjs` + * [#11109](https://github.com/babel/babel/pull/11109) Fix rewriteThis in helper-module-transforms for computed class elements ([@sidntrivedi012](https://github.com/sidntrivedi012)) +* `babel-parser` + * [#10956](https://github.com/babel/babel/pull/10956) Refactor await/yield production parameter tracking ([@JLHwung](https://github.com/JLHwung)) + +#### :boom: Breaking Change +* [#11137](https://github.com/babel/babel/pull/11137) Breaking: align babel-eslint-parser & espree ([@kaicataldo](https://github.com/kaicataldo)) + +#### :rocket: New Feature +* `babel-helper-create-regexp-features-plugin`, `babel-plugin-transform-classes`, `babel-plugin-transform-named-capturing-groups-regex`, `babel-preset-env` + * [#11134](https://github.com/babel/babel/pull/11134) Mark `wrapNativeSuper` and `wrapRegExp` as pure ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo)) + +#### :bug: Bug Fix +* `babel-helper-compilation-targets` + * [#11124](https://github.com/babel/babel/pull/11124) fix: search for browserslist if esmodules is falsy ([@fengzilong](https://github.com/fengzilong)) +* `babel-register` + * [#11160](https://github.com/babel/babel/pull/11160) fix: workaround misleading node.js ENOENT error ([@JLHwung](https://github.com/JLHwung)) +* `babel-parser` + * [#11146](https://github.com/babel/babel/pull/11146) Parse declare modifier around accessibility modifiers ([@JLHwung](https://github.com/JLHwung)) + * [#11092](https://github.com/babel/babel/pull/11092) Fix Async Generic After Await Parsing Error ([@liamfd](https://github.com/liamfd)) +* Other + * [#11137](https://github.com/babel/babel/pull/11137) Breaking: align babel-eslint-parser & espree ([@kaicataldo](https://github.com/kaicataldo)) +* `babel-compat-data`, `babel-preset-env` + * [#10929](https://github.com/babel/babel/pull/10929) Update preset-env builtin-definitions ([@JLHwung](https://github.com/JLHwung)) +* `babel-traverse` + * [#11136](https://github.com/babel/babel/pull/11136) fix @babel/traverse can't use path.remove() with noScope ([@liuxingbaoyu](https://github.com/liuxingbaoyu)) +* `babel-helper-create-class-features-plugin`, `babel-helper-replace-supers` + * [#11068](https://github.com/babel/babel/pull/11068) Fix classNameTDZError in computed prototype methods with class fields ([@sidntrivedi012](https://github.com/sidntrivedi012)) +* `babel-template` + * [#11112](https://github.com/babel/babel/pull/11112) Respect preserveComments option in tempate.ast() ([@dentrado](https://github.com/dentrado)) +* `babel-plugin-transform-for-of` + * [#11088](https://github.com/babel/babel/pull/11088) Allow redeclaration of loop variable in body ([@openorclose](https://github.com/openorclose)) +* `babel-helper-module-transforms`, `babel-plugin-transform-modules-commonjs` + * [#11074](https://github.com/babel/babel/pull/11074) Fix export bindings not updated by 'for ... in' and 'for ... of' ([@vedantroy](https://github.com/vedantroy)) +* `babel-standalone` + * [#10797](https://github.com/babel/babel/pull/10797) fix: specify sourceFileName when generating inline sourcemaps ([@JLHwung](https://github.com/JLHwung)) +* `babel-types` + * [#11089](https://github.com/babel/babel/pull/11089) Make `isReferenced` return false for method parameter name ([@brokensandals](https://github.com/brokensandals)) + +#### :nail_care: Polish +* `babel-core`, `babel-generator`, `babel-plugin-external-helpers`, `babel-plugin-proposal-async-generator-functions`, `babel-plugin-proposal-class-properties`, `babel-plugin-proposal-decorators`, `babel-plugin-proposal-function-bind`, `babel-plugin-transform-async-to-generator`, `babel-plugin-transform-classes`, `babel-plugin-transform-flow-comments`, `babel-plugin-transform-flow-strip-types`, `babel-plugin-transform-function-name`, `babel-plugin-transform-parameters`, `babel-plugin-transform-react-constant-elements`, `babel-plugin-transform-react-jsx`, `babel-plugin-transform-regenerator`, `babel-plugin-transform-runtime`, `babel-plugin-transform-typescript`, `babel-preset-env` + * [#11133](https://github.com/babel/babel/pull/11133) Skip newlines around inline `#__PURE__` annotations ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo)) + +#### :house: Internal +* Other + * [#11175](https://github.com/babel/babel/pull/11175) replace `gulp-watch` by `gulp.watch` ([@JLHwung](https://github.com/JLHwung)) + * [#11163](https://github.com/babel/babel/pull/11163) chore: migrate lock threads to github actions ([@JLHwung](https://github.com/JLHwung)) + * [#11164](https://github.com/babel/babel/pull/11164) chore: specify dependency rule of check-compat-data-ci ([@JLHwung](https://github.com/JLHwung)) + * [#11106](https://github.com/babel/babel/pull/11106) Centralize @babel/eslint-* tests ([@kaicataldo](https://github.com/kaicataldo)) + * [#11072](https://github.com/babel/babel/pull/11072) Update @babel deps ([@existentialism](https://github.com/existentialism)) + * [#11070](https://github.com/babel/babel/pull/11070) Clean babel-eslint-*/**/lib ([@kaicataldo](https://github.com/kaicataldo)) +* `babel-generator`, `babel-helper-fixtures`, `babel-parser`, `babel-traverse` + * [#11168](https://github.com/babel/babel/pull/11168) Enable more eslint recommended rules ([@JLHwung](https://github.com/JLHwung)) +* `babel-helper-replace-supers` + * [#11121](https://github.com/babel/babel/pull/11121) Fix typing of ReplaceSupers options ([@existentialism](https://github.com/existentialism)) +* `babel-core`, `babel-plugin-syntax-decorators`, `babel-template`, `babel-traverse` + * [#11119](https://github.com/babel/babel/pull/11119) Add eslint-plugin-jest ([@JLHwung](https://github.com/JLHwung)) +* `babel-parser` + * [#11096](https://github.com/babel/babel/pull/11096) Wrap type-only class fields in flow comments ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo)) +* `babel-core`, `babel-parser`, `babel-types` + * [#11093](https://github.com/babel/babel/pull/11093) Turn on no-fallthrough rule ([@JLHwung](https://github.com/JLHwung)) +* `babel-preset-stage-0`, `babel-preset-stage-1`, `babel-preset-stage-2`, `babel-preset-stage-3` + * [#11101](https://github.com/babel/babel/pull/11101) Remove stage presets from the monorepo ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo)) +* `babel-preset-env-standalone` + * [#10993](https://github.com/babel/babel/pull/10993) Archive @babel/preset-env-standalone ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo)) +## v7.8.5 (2020-01-31) + +#### :bug: Bug Fix +* `babel-compat-data` + * [#11078](https://github.com/babel/babel/pull/11078) Do not publish build directory of compat-data ([@danez](https://github.com/danez)) + +#### :house: Internal +* [#11071](https://github.com/babel/babel/pull/11071) Further refactoring of @babel/eslint-parser ([@kaicataldo](https://github.com/kaicataldo)) +## v7.8.4 (2020-01-30) + +> :warning: In Babel 7.8.0 we introduced the `--copy-ignored` option for `@babel/cli`, defaulting to `false`. However, previous versions behaved as if that option was present: for this reason, we changed its default value to `true` (when `--copy-files` is provided) and introduced a `--no-copy-ignored` option to disable it. + +#### :eyeglasses: Spec Compliance +* `babel-parser` + * [#11031](https://github.com/babel/babel/pull/11031) fix: properly parse member expression after property initializer ([@vedantroy](https://github.com/vedantroy)) + * [#11017](https://github.com/babel/babel/pull/11017) Update coalesce precedence ([@JLHwung](https://github.com/JLHwung)) + * [#11009](https://github.com/babel/babel/pull/11009) fix: triple `__proto__` in object patterns should be allowed ([@JLHwung](https://github.com/JLHwung)) + * [#10987](https://github.com/babel/babel/pull/10987) Duplicate `__proto__` key should be allowed in object patterns ([@JLHwung](https://github.com/JLHwung)) + +#### :bug: Bug Fix +* `babel-cli` + * [#11063](https://github.com/babel/babel/pull/11063) [@babel/cli] Copy ignored files by default ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo)) +* `babel-compat-data` + * [#11066](https://github.com/babel/babel/pull/11066) Fix core-js 2 builtin data for opera ([@danez](https://github.com/danez)) +* `babel-helpers`, `babel-plugin-proposal-class-properties`, `babel-plugin-proposal-decorators`, `babel-plugin-transform-classes`, `babel-plugin-transform-parameters`, `babel-plugin-transform-typeof-symbol`, `babel-preset-env` + * [#11049](https://github.com/babel/babel/pull/11049) Avoid compiling the _typeof helper with itself ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo)) +* `babel-traverse` + * [#11011](https://github.com/babel/babel/pull/11011) Bug/missing references after crawl ([@regiontog](https://github.com/regiontog)) +* `babel-plugin-transform-parameters` + * [#9714](https://github.com/babel/babel/pull/9714) Fix rest parameters indexing with TypeScript 'this parameter' ([@BenoitZugmeyer](https://github.com/BenoitZugmeyer)) +* `babel-plugin-transform-for-of` + * [#11023](https://github.com/babel/babel/pull/11023) fix: for-of transform should skip for-await-of ([@JLHwung](https://github.com/JLHwung)) +* `babel-compat-data`, `babel-preset-env` + * [#11016](https://github.com/babel/babel/pull/11016) Re-generate preset-env fixtures ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo)) +* `babel-generator` + * [#11014](https://github.com/babel/babel/pull/11014) Fix parentheses removal in nullish-coalescing operation ([@sidntrivedi012](https://github.com/sidntrivedi012)) +* `babel-helper-compilation-targets` + * [#11006](https://github.com/babel/babel/pull/11006) fix: supply '.' subpath for backward compatibility with node.js 13.0-13.1 ([@JLHwung](https://github.com/JLHwung)) + +#### :nail_care: Polish +* `babel-core` + * [#10969](https://github.com/babel/babel/pull/10969) polish: throw human-friendly error when item-option pair is incorrectly unwrapped ([@JLHwung](https://github.com/JLHwung)) + +#### :memo: Documentation +* `babel-parser` + * [#11015](https://github.com/babel/babel/pull/11015) add AST for the module attribute proposal ([@xtuc](https://github.com/xtuc)) + +#### :house: Internal +* `babel-compat-data` + * [#11039](https://github.com/babel/babel/pull/11039) Update compat table ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo)) + * [#11041](https://github.com/babel/babel/pull/11041) Delete duplicated file in `@babel/compat-data` ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo)) + * [#10814](https://github.com/babel/babel/pull/10814) chore: map mobile browser data to their desktop version ([@JLHwung](https://github.com/JLHwung)) + * [#11024](https://github.com/babel/babel/pull/11024) Check that generated compat-data is up to date on CI ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo)) +* `babel-parser` + * [#11032](https://github.com/babel/babel/pull/11032) refactor: simplify toAssignable routine ([@JLHwung](https://github.com/JLHwung)) + * [#11026](https://github.com/babel/babel/pull/11026) chore: use @babel/eslint-config-internal ([@JLHwung](https://github.com/JLHwung)) +* `babel-preset-env` + * [#11030](https://github.com/babel/babel/pull/11030) update compat-data related docs/config [skip ci] ([@JLHwung](https://github.com/JLHwung)) +* `babel-compat-data`, `babel-node`, `babel-parser`, `babel-preset-env` + * [#11025](https://github.com/babel/babel/pull/11025) Enable `no-process-exit` ([@JLHwung](https://github.com/JLHwung)) +* Other + * [#11021](https://github.com/babel/babel/pull/11021) chore: replace yarn-upgrade by bump-babel-dependencies in vuejs e2e tests ([@JLHwung](https://github.com/JLHwung)) + * [#11004](https://github.com/babel/babel/pull/11004) chore: test against @vue/babel-preset-app ([@JLHwung](https://github.com/JLHwung)) +* `babel-core` + * [#10995](https://github.com/babel/babel/pull/10995) Exclude `import()` tests from pubilsh build ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo)) + +#### :running_woman: Performance +* `babel-parser` + * [#11029](https://github.com/babel/babel/pull/11029) fix(babel-parser): avoid state.clone() to clone the whole token store ([@3cp](https://github.com/3cp)) +## v7.8.3 (2020-01-13) + +#### :bug: Bug Fix +* `babel-types` + * [#11002](https://github.com/babel/babel/pull/11002) fix: generated builder parameter should respect builder keys ([@JLHwung](https://github.com/JLHwung)) + +#### :house: Internal +* `babel-preset-env-standalone`, `babel-standalone` + * [#10994](https://github.com/babel/babel/pull/10994) Ignore .map files in standalone packages ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo)) +* `babel-plugin-proposal-decorators`, `babel-plugin-proposal-dynamic-import`, `babel-plugin-proposal-logical-assignment-operators`, `babel-plugin-proposal-object-rest-spread`, `babel-plugin-syntax-async-generators`, `babel-plugin-syntax-bigint`, `babel-plugin-syntax-dynamic-import`, `babel-plugin-syntax-json-strings`, `babel-plugin-syntax-nullish-coalescing-operator`, `babel-plugin-syntax-object-rest-spread`, `babel-plugin-syntax-optional-catch-binding`, `babel-plugin-syntax-optional-chaining`, `babel-plugin-transform-flow-strip-types`, `babel-plugin-transform-modules-commonjs`, `babel-plugin-transform-modules-systemjs`, `babel-plugin-transform-react-constant-elements`, `babel-preset-env-standalone`, `babel-preset-env`, `babel-standalone` + * [#10820](https://github.com/babel/babel/pull/10820) Archive syntax plugins enabled by default ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo)) + +#### :leftwards_arrow_with_hook: Revert +* _Every package_ + * [#11003](https://github.com/babel/babel/pull/11003) Revert "chore: specify package type (#10849)" ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo)) +## v7.8.2 (2020-01-12) + +#### :bug: Bug Fix +* `babel-preset-env` + * [#10992](https://github.com/babel/babel/pull/10992) fix: `isPluginRequired` returns the opposite result in v7.8.0 ([@sodatea](https://github.com/sodatea)) +## v7.8.1 (2020-01-12) + +#### :bug: Bug Fix +* `babel-compat-data`, `babel-helper-compilation-targets` + * [#10991](https://github.com/babel/babel/pull/10991) Downgrade semver for compatibility with Node 6 ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo)) +## v7.8.0 (2020-01-12) + +#### :eyeglasses: Spec Compliance +* `babel-parser` + * [#10980](https://github.com/babel/babel/pull/10980) Disallow private name in object elements and TS type elements ([@JLHwung](https://github.com/JLHwung)) + * [#10955](https://github.com/babel/babel/pull/10955) LiteralPropertyName should allow BigIntLiteral ([@JLHwung](https://github.com/JLHwung)) + * [#10953](https://github.com/babel/babel/pull/10953) fix: check await when parsing AsyncArrowBindingIdentifier ([@JLHwung](https://github.com/JLHwung)) + * [#10947](https://github.com/babel/babel/pull/10947) Fix: TopLevelAwait should respect await identifiers defined in sub scope. ([@JLHwung](https://github.com/JLHwung)) + * [#10946](https://github.com/babel/babel/pull/10946) fix: Class Field Initializer should not allow await expression as immediate child ([@JLHwung](https://github.com/JLHwung)) +* `babel-plugin-proposal-numeric-separator` + * [#10938](https://github.com/babel/babel/pull/10938) StringNumericLiteral does not include NumericLiteralSeparator ([@JLHwung](https://github.com/JLHwung)) +* `babel-generator`, `babel-parser`, `babel-plugin-proposal-private-methods` + * [#10456](https://github.com/babel/babel/pull/10456) [parser] Disallow duplicate and undeclared private names ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo)) + +#### :boom: Breaking Change +* `babel-types` + * [#10917](https://github.com/babel/babel/pull/10917) (opt-in) Improve @babel/types with env.BABEL_TYPES_8_BREAKING ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo)) + +#### :rocket: New Feature +* `babel-standalone` + * [#10821](https://github.com/babel/babel/pull/10821) Merge env-standalone to babel-standalone ([@JLHwung](https://github.com/JLHwung)) +* `babel-core` + * [#10783](https://github.com/babel/babel/pull/10783) Add babelrc.json support ([@yordis](https://github.com/yordis)) + * [#10903](https://github.com/babel/babel/pull/10903) Add support for babel.config.mjs and .babelrc.mjs ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo)) +* `babel-compat-data`, `babel-preset-env-standalone`, `babel-preset-env` + * [#10811](https://github.com/babel/babel/pull/10811) Add optional-chaining and nullish-coalescing to preset-env ([@Druotic](https://github.com/Druotic)) +* `babel-helper-module-transforms`, `babel-plugin-transform-modules-systemjs` + * [#10780](https://github.com/babel/babel/pull/10780) add `allowTopLevelThis` option to `transform-modules-systemjs` ([@JLHwung](https://github.com/JLHwung)) +* `babel-parser` + * [#10817](https://github.com/babel/babel/pull/10817) enable optional chaining by default in @babel/parser ([@jackisherwood](https://github.com/jackisherwood)) +* `babel-cli` + * [#10887](https://github.com/babel/babel/pull/10887) --copy-ignored flag added to CLI ([@rajasekarm](https://github.com/rajasekarm)) + * [#9144](https://github.com/babel/babel/pull/9144) Add --out-file-extension option to babel-cli ([@eps1lon](https://github.com/eps1lon)) +* `babel-core`, `babel-generator`, `babel-parser` + * [#10819](https://github.com/babel/babel/pull/10819) Enable nullish coalescing by default in @babel/parser ([@layershifter](https://github.com/layershifter)) +* `babel-core`, `babel-parser` + * [#10843](https://github.com/babel/babel/pull/10843) [parser] enable dynamic import by default ([@AbdulAli19](https://github.com/AbdulAli19)) + +#### :bug: Bug Fix +* `babel-node` + * [#10763](https://github.com/babel/babel/pull/10763) Filename detection should respect short flags ([@JLHwung](https://github.com/JLHwung)) +* `babel-plugin-proposal-numeric-separator` + * [#10938](https://github.com/babel/babel/pull/10938) StringNumericLiteral does not include NumericLiteralSeparator ([@JLHwung](https://github.com/JLHwung)) +* `babel-preset-env` + * [#10790](https://github.com/babel/babel/pull/10790) Use chrome data when android is absent ([@JLHwung](https://github.com/JLHwung)) + * [#10930](https://github.com/babel/babel/pull/10930) fix: Promise.any requires global.AggregateError ([@JLHwung](https://github.com/JLHwung)) +* `babel-parser` + * [#10944](https://github.com/babel/babel/pull/10944) When reading a new string, U+2028/2029 should correctly set the new column ([@JLHwung](https://github.com/JLHwung)) + * [#10937](https://github.com/babel/babel/pull/10937) Refactor parseSubscript ([@JLHwung](https://github.com/JLHwung)) + * [#10901](https://github.com/babel/babel/pull/10901) fix: lost leading comment after named import ([@elevatebart](https://github.com/elevatebart)) +* `babel-traverse` + * [#10949](https://github.com/babel/babel/pull/10949) Override toString in case this function is printed ([@jayenashar](https://github.com/jayenashar)) +* `babel-helper-module-transforms`, `babel-plugin-transform-modules-commonjs` + * [#10934](https://github.com/babel/babel/pull/10934) helper-module-transforms: dereference imported template tag ([@ajafff](https://github.com/ajafff)) +* `babel-traverse`, `babel-types` + * [#10912](https://github.com/babel/babel/pull/10912) Fix parameter expression get binding ([@JLHwung](https://github.com/JLHwung)) +* `babel-core` + * [#10914](https://github.com/babel/babel/pull/10914) @babel-core: parse should parse only ([@kaicataldo](https://github.com/kaicataldo)) +* `babel-helpers` + * [#10902](https://github.com/babel/babel/pull/10902) fix: Object.getOwnPropertySymbols called on non-object ([@bassaer](https://github.com/bassaer)) + +#### :nail_care: Polish +* `babel-node` + * [#9695](https://github.com/babel/babel/pull/9695) Use `babel > ` as prompt in babel-node ([@ZYSzys](https://github.com/ZYSzys)) +* `babel-parser` + * [#10906](https://github.com/babel/babel/pull/10906) refactor: remove inClassProperty parser state ([@JLHwung](https://github.com/JLHwung)) + +#### :memo: Documentation +* `babel-preset-env` + * [#10982](https://github.com/babel/babel/pull/10982) CONTRIBUTING: Update link to plugin-features.js [skip ci] ([@andersk](https://github.com/andersk)) +* Other + * [#10973](https://github.com/babel/babel/pull/10973) Added instructions to fork the repo in order to setup. ([@sidntrivedi012](https://github.com/sidntrivedi012)) + +#### :house: Internal +* `babel-preset-env` + * [#10983](https://github.com/babel/babel/pull/10983) chore: update corejs fixtures ([@JLHwung](https://github.com/JLHwung)) + * [#10974](https://github.com/babel/babel/pull/10974) chore: update caniuse-usage Chrome 49 related fixtures ([@JLHwung](https://github.com/JLHwung)) + * [#10924](https://github.com/babel/babel/pull/10924) Replace custom "findSuggestion" function with "levenary" ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo)) +* `babel-core` + * [#10507](https://github.com/babel/babel/pull/10507) Prepare @babel/core for asynchronicity ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo)) +* Other + * [#10979](https://github.com/babel/babel/pull/10979) Reduce false negative cases of typescript parser tests ([@JLHwung](https://github.com/JLHwung)) + * [#10976](https://github.com/babel/babel/pull/10976) Update Test262, Flow and TS parser tests ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo)) + * [#10964](https://github.com/babel/babel/pull/10964) Bump coverage target from 80% to 90% ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo)) + * [#10958](https://github.com/babel/babel/pull/10958) Fix recent e2e-vuejs-cli error ([@JLHwung](https://github.com/JLHwung)) + * [#10919](https://github.com/babel/babel/pull/10919) Add integration test: e2e-vue-cli ([@JLHwung](https://github.com/JLHwung)) + * [#10943](https://github.com/babel/babel/pull/10943) chore: update test262 ([@JLHwung](https://github.com/JLHwung)) + * [#10918](https://github.com/babel/babel/pull/10918) chore: refine e2e test scripts ([@JLHwung](https://github.com/JLHwung)) + * [#10905](https://github.com/babel/babel/pull/10905) chore: separate build-standalone with coverage ([@JLHwung](https://github.com/JLHwung)) + * [#10898](https://github.com/babel/babel/pull/10898) Move coverage to GitHub actions ([@JLHwung](https://github.com/JLHwung)) +* `babel-compat-data`, `babel-helper-compilation-targets`, `babel-preset-env` + * [#10899](https://github.com/babel/babel/pull/10899) Extract targets parser and compat data from preset-env ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo)) +* `babel-parser` + * [#10950](https://github.com/babel/babel/pull/10950) test: add invalid-lone-import test ([@JLHwung](https://github.com/JLHwung)) + * [#10936](https://github.com/babel/babel/pull/10936) refactor: remove unecessary checkYieldAwaitInDefaultParams ([@JLHwung](https://github.com/JLHwung)) + * [#10935](https://github.com/babel/babel/pull/10935) refactor: remove unused invalidTemplateEscapePosition tokenizer state ([@JLHwung](https://github.com/JLHwung)) + * [#10939](https://github.com/babel/babel/pull/10939) TSTypeCastExpression should not be inside call parameters ([@JLHwung](https://github.com/JLHwung)) + * [#10942](https://github.com/babel/babel/pull/10942) Remove unused parser methods ([@JLHwung](https://github.com/JLHwung)) +* _Every package_ + * [#10849](https://github.com/babel/babel/pull/10849) chore: specify package type [skip-ci] ([@JLHwung](https://github.com/JLHwung)) + +#### :leftwards_arrow_with_hook: Revert +* `babel-cli` + * [#10923](https://github.com/babel/babel/pull/10923) fix: minified should not accept optional argument ([@JLHwung](https://github.com/JLHwung)) +## v7.7.7 (2019-12-19) + +#### :eyeglasses: Spec Compliance +* `babel-parser` + * [#10576](https://github.com/babel/babel/pull/10576) [parser] validation for parentheses in the left-hand side of assignment expressions ([@boweihan](https://github.com/boweihan)) + +#### :bug: Bug Fix +* `babel-plugin-proposal-object-rest-spread` + * [#10863](https://github.com/babel/babel/pull/10863) fix: add computed property support for object Ref ([@JLHwung](https://github.com/JLHwung)) +* `babel-core` + * [#10890](https://github.com/babel/babel/pull/10890) fix: skip merging large input sourcemaps ([@JLHwung](https://github.com/JLHwung)) + * [#10885](https://github.com/babel/babel/pull/10885) fix: avoid string copy when processing input source-map ([@JLHwung](https://github.com/JLHwung)) +* `babel-node` + * [#10871](https://github.com/babel/babel/pull/10871) Allow -r from node_modules with @babel/node ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo)) +* `babel-plugin-transform-parameters` + * [#10053](https://github.com/babel/babel/pull/10053) Check shadow variable to identifier in default parameters ([@JLHwung](https://github.com/JLHwung)) +* `babel-parser` + * [#10828](https://github.com/babel/babel/pull/10828) @babel/parser: fix ImportExpression node to match ESTree spec ([@kaicataldo](https://github.com/kaicataldo)) + * [#10827](https://github.com/babel/babel/pull/10827) @babel/parser: fix BigIntLiteral node to match ESTree spec ([@kaicataldo](https://github.com/kaicataldo)) + +#### :nail_care: Polish +* `babel-plugin-transform-react-jsx` + * [#10868](https://github.com/babel/babel/pull/10868) Fix pragmaFrag spelling in error message ([@azizhk](https://github.com/azizhk)) + +#### :house: Internal +* `babel-generator`, `babel-plugin-proposal-pipeline-operator`, `babel-plugin-proposal-unicode-property-regex`, `babel-plugin-syntax-pipeline-operator`, `babel-plugin-transform-dotall-regex`, `babel-preset-env-standalone`, `babel-preset-typescript`, `babel-standalone` + * [#10882](https://github.com/babel/babel/pull/10882) Ignore some files in npm package ([@JLHwung](https://github.com/JLHwung)) +* Other + * [#10874](https://github.com/babel/babel/pull/10874) chore: cache chocolatey installation temporary files ([@JLHwung](https://github.com/JLHwung)) + * [#10880](https://github.com/babel/babel/pull/10880) chore: add PR Intent checkbox [ci-skip] ([@JLHwung](https://github.com/JLHwung)) + * [#10870](https://github.com/babel/babel/pull/10870) chore: update babel-eslint to 11.0.0-beta.2 ([@JLHwung](https://github.com/JLHwung)) + * [#10848](https://github.com/babel/babel/pull/10848) Tune eslint packages test configuration ([@JLHwung](https://github.com/JLHwung)) +* `babel-preset-env` + * [#10873](https://github.com/babel/babel/pull/10873) chore: download compat-table when build-data is run ([@JLHwung](https://github.com/JLHwung)) + * [#10846](https://github.com/babel/babel/pull/10846) Update corejs fixtures ([@JLHwung](https://github.com/JLHwung)) + * [#10837](https://github.com/babel/babel/pull/10837) refactor: rewrite available-plugins to esm ([@JLHwung](https://github.com/JLHwung)) +* `babel-parser` + * [#10858](https://github.com/babel/babel/pull/10858) Properly serialize non-json values in parser tests ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo)) +* `babel-cli`, `babel-node`, `babel-register` + * [#10847](https://github.com/babel/babel/pull/10847) Add missing dev dependencies ([@JLHwung](https://github.com/JLHwung)) + +#### :leftwards_arrow_with_hook: Revert +* `babel-plugin-transform-classes`, `babel-plugin-transform-regenerator`, `babel-preset-env` + * [#10839](https://github.com/babel/babel/pull/10839) Use `async-to-generator` even when `regenerator` is enabled ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo)) +## v7.7.6 (2019-12-08) + +#### :house: Internal +* [#10836](https://github.com/babel/babel/pull/10836) chore: add PR Revert labels to changelog [ci-skip] ([@JLHwung](https://github.com/JLHwung)) + +#### :leftwards_arrow_with_hook: Revert +* `babel-plugin-transform-modules-commonjs`, `babel-plugin-transform-regenerator`, `babel-plugin-transform-runtime`, `babel-preset-env`, `babel-runtime-corejs2` + * [#10835](https://github.com/babel/babel/pull/10835) Revert "Add ".js" extension to injected polyfill imports" ([@JLHwung](https://github.com/JLHwung)) +## v7.7.5 (2019-12-06) + +#### :bug: Bug Fix +* `babel-plugin-transform-modules-commonjs`, `babel-plugin-transform-regenerator`, `babel-plugin-transform-runtime`, `babel-preset-env`, `babel-runtime-corejs2` + * [#10549](https://github.com/babel/babel/pull/10549) Add ".js" extension to injected polyfill imports ([@shimataro](https://github.com/shimataro)) +* `babel-cli` + * [#10283](https://github.com/babel/babel/pull/10283) `babel --watch` should have equivalent file selection logic with `babel` ([@JLHwung](https://github.com/JLHwung)) +* `babel-parser` + * [#10801](https://github.com/babel/babel/pull/10801) Use scope flags to check arguments ([@JLHwung](https://github.com/JLHwung)) + * [#10800](https://github.com/babel/babel/pull/10800) Allow tuple rest trailing comma ([@yeonjuan](https://github.com/yeonjuan)) + * [#10475](https://github.com/babel/babel/pull/10475) Correctly disambiguate / after async fuctions ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo)) +* `babel-parser`, `babel-plugin-proposal-optional-chaining`, `babel-plugin-transform-modules-amd` + * [#10806](https://github.com/babel/babel/pull/10806) fix(optional chaining): Optional delete returns true with nullish base ([@mpaarating](https://github.com/mpaarating)) +* `babel-helper-module-transforms`, `babel-plugin-transform-modules-amd` + * [#10764](https://github.com/babel/babel/pull/10764) fix: rewriteBindingInitVisitor should skip on scopable node ([@JLHwung](https://github.com/JLHwung)) + +#### :nail_care: Polish +* `babel-plugin-transform-runtime` + * [#10788](https://github.com/babel/babel/pull/10788) Do not transpile typeof helper with itself in babel/runtime ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo)) +* `babel-core` + * [#10778](https://github.com/babel/babel/pull/10778) refactor: Improve error message in @babel/core ([@jaroslav-kubicek](https://github.com/jaroslav-kubicek)) + +#### :house: Internal +* `babel-preset-env-standalone` + * [#10779](https://github.com/babel/babel/pull/10779) Bundle standalone using rollup ([@JLHwung](https://github.com/JLHwung)) +* Other + * [#10781](https://github.com/babel/babel/pull/10781) Tune makefile scripts ([@JLHwung](https://github.com/JLHwung)) +* `babel-helper-transform-fixture-test-runner` + * [#10566](https://github.com/babel/babel/pull/10566) Incorrect trace position in fixture runner ([@JLHwung](https://github.com/JLHwung)) + +## v7.7.4 (2019-11-23) + +#### :bug: Bug Fix +* `babel-runtime-corejs2`, `babel-runtime-corejs3`, `babel-runtime` + * [#10748](https://github.com/babel/babel/pull/10748) Add support for native esm to @babel/runtime. ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo)) +* `babel-preset-env` + * [#10742](https://github.com/babel/babel/pull/10742) Update preset-env mappings. ([@existentialism](https://github.com/existentialism)) +* `babel-parser` + * [#10737](https://github.com/babel/babel/pull/10737) Flow enums: fix enum body location. ([@gkz](https://github.com/gkz)) + * [#10657](https://github.com/babel/babel/pull/10657) Fix some incorrect typeof parsing in flow. ([@existentialism](https://github.com/existentialism)) + * [#10582](https://github.com/babel/babel/pull/10582) [parser] Allow optional async methods. ([@gonzarodriguezt](https://github.com/gonzarodriguezt)) + * [#10710](https://github.com/babel/babel/pull/10710) register import equals specifier. ([@JLHwung](https://github.com/JLHwung)) + * [#10592](https://github.com/babel/babel/pull/10592) Allow TypeScript type assertions in array destructuring. ([@SakibulMowla](https://github.com/SakibulMowla)) +* `babel-preset-env-standalone` + * [#10732](https://github.com/babel/babel/pull/10732) fix: add missing available plugins to babel-preset-env-standalone. ([@JLHwung](https://github.com/JLHwung)) +* `babel-plugin-transform-function-name`, `babel-plugin-transform-modules-umd`, `babel-preset-env` + * [#10701](https://github.com/babel/babel/pull/10701) Circumvent typeof transform for umd build template. ([@JLHwung](https://github.com/JLHwung)) +* `babel-cli` + * [#10698](https://github.com/babel/babel/pull/10698) Babel should not silently remove unknown options after commander arguments. ([@JLHwung](https://github.com/JLHwung)) +* `babel-plugin-proposal-optional-chaining` + * [#10694](https://github.com/babel/babel/pull/10694) Fix optional method chaining in derived classes. ([@Shriram-Balaji](https://github.com/Shriram-Balaji)) +* `babel-parser`, `babel-types` + * [#10677](https://github.com/babel/babel/pull/10677) Add `asserts this [is type]` parsing support. ([@JLHwung](https://github.com/JLHwung)) +* `babel-traverse` + * [#10598](https://github.com/babel/babel/pull/10598) Fix parentheses on replaceWithMultiple for JSX. ([@khoumani](https://github.com/khoumani)) +* `babel-helpers`, `babel-plugin-proposal-object-rest-spread`, `babel-preset-env` + * [#10683](https://github.com/babel/babel/pull/10683) Fix: Don't call Object.keys on non-objects (babel#10482). ([@chrishinrichs](https://github.com/chrishinrichs)) + +#### :nail_care: Polish +* `babel-plugin-proposal-nullish-coalescing-operator` + * [#10720](https://github.com/babel/babel/pull/10720) polish: skip creating extra reference for safely re-used node. ([@JLHwung](https://github.com/JLHwung)) + +#### :house: Internal +* Other + * [#10731](https://github.com/babel/babel/pull/10731) Removed duplicate key in package.json. ([@rajasekarm](https://github.com/rajasekarm)) + * [#10718](https://github.com/babel/babel/pull/10718) chore: use loose mode of transform. ([@JLHwung](https://github.com/JLHwung)) + * [#10579](https://github.com/babel/babel/pull/10579) Implement PR workflow for running test262 on babel PRs. ([@jbhoosreddy](https://github.com/jbhoosreddy)) + * [#10648](https://github.com/babel/babel/pull/10648) bump @babel/* dev dependencies. ([@JLHwung](https://github.com/JLHwung)) + * [#10569](https://github.com/babel/babel/pull/10569) E2E test Babel with itself before publishing. ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo)) +* `babel-core` + * [#10668](https://github.com/babel/babel/pull/10668) Reduce standalone build size. ([@JLHwung](https://github.com/JLHwung)) +* `babel-plugin-transform-literals`, `babel-preset-env-standalone` + * [#10725](https://github.com/babel/babel/pull/10725) fix typo [ci-skip]. ([@JLHwung](https://github.com/JLHwung)) +* `babel-cli` + * [#10692](https://github.com/babel/babel/pull/10692) Add missing flow type to babel-cli for consistency. ([@ZYSzys](https://github.com/ZYSzys)) + +## v7.7.3 (2019-11-08) + +#### :bug: Bug Fix +* `babel-parser` + * [#10682](https://github.com/babel/babel/pull/10682) Don't recover from "adjacent jsx elements" parser error ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo)) +## v7.7.2 (2019-11-07) + +#### :bug: Bug Fix +* `babel-parser` + * [#10669](https://github.com/babel/babel/pull/10669) Parse arrows with params annotations in conditional expressions ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo)) +* `babel-plugin-transform-typescript` + * [#10658](https://github.com/babel/babel/pull/10658) fix: remove accessibility of constructor ([@JLHwung](https://github.com/JLHwung)) +* `babel-traverse` + * [#10656](https://github.com/babel/babel/pull/10656) fix: add inList setter for compatibility with babel-minify ([@JLHwung](https://github.com/JLHwung)) +## v7.7.1 (2019-11-05) + +#### :bug: Bug Fix +* `babel-types` + * [#10650](https://github.com/babel/babel/pull/10650) Revert "throw a TypeError if identifier validation fails (#10621)" ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo)) +* `babel-preset-env` + * [#10649](https://github.com/babel/babel/pull/10649) Fix(babel-preset-env): check api.caller is a function to avoid to thr… ([@love2me](https://github.com/love2me)) + +## v7.7.0 (2019-11-05) + +#### :eyeglasses: Spec Compliance +* `babel-types` + * [#10621](https://github.com/babel/babel/pull/10621) throw a TypeError if identifier validation fails. ([@dentrado](https://github.com/dentrado)) +* `babel-parser` + * [#10559](https://github.com/babel/babel/pull/10559) fix: Exclude catch clause from let identifier error. ([@gonzarodriguezt](https://github.com/gonzarodriguezt)) + * [#10567](https://github.com/babel/babel/pull/10567) [parser] Exception to 8 and 9 in tagged template. ([@pnowak](https://github.com/pnowak)) + * [#10532](https://github.com/babel/babel/pull/10532) Allow duplicate __proto__ keys in patterns, simple case (#6705). ([@alejo90](https://github.com/alejo90)) + +#### :rocket: New Feature +* `babel-generator`, `babel-helper-create-class-features-plugin`, `babel-parser`, `babel-plugin-transform-typescript`, `babel-preset-typescript`, `babel-types` + * [#10545](https://github.com/babel/babel/pull/10545) Add support for TS declare modifier on fields. ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo)) +* `babel-core`, `babel-parser`, `babel-preset-typescript` + * [#10363](https://github.com/babel/babel/pull/10363) @babel/parser error recovery. ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo)) +* `babel-core` + * [#10599](https://github.com/babel/babel/pull/10599) Add support for .cjs config files. ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo)) + * [#10501](https://github.com/babel/babel/pull/10501) Add support for babel.config.json. ([@devongovett](https://github.com/devongovett)) + * [#10361](https://github.com/babel/babel/pull/10361) feat: if code frame error is on a single line, highlight the whole path. ([@SimenB](https://github.com/SimenB)) +* `babel-plugin-syntax-top-level-await`, `babel-preset-env` + * [#10573](https://github.com/babel/babel/pull/10573) Create @babel/plugin-syntax-top-level-await. ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo)) +* `babel-helper-builder-react-jsx`, `babel-plugin-transform-react-jsx`, `babel-preset-react` + * [#10572](https://github.com/babel/babel/pull/10572) [transform-react-jsx] Add useSpread option to transform JSX. ([@ivandevp](https://github.com/ivandevp)) +* `babel-generator`, `babel-parser`, `babel-plugin-proposal-decorators`, `babel-plugin-syntax-flow`, `babel-types` + * [#10344](https://github.com/babel/babel/pull/10344) Flow enums parsing. ([@gkz](https://github.com/gkz)) +* `babel-plugin-transform-function-name`, `babel-plugin-transform-modules-umd`, `babel-preset-env` + * [#10477](https://github.com/babel/babel/pull/10477) Changes UMD callsite to be more likely to pass in the intended object.. ([@MicahZoltu](https://github.com/MicahZoltu)) +* `babel-parser` + * [#10449](https://github.com/babel/babel/pull/10449) Create parser plugin "topLevelAwait". ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo)) + * [#10521](https://github.com/babel/babel/pull/10521) [parser] Enable "exportNamespaceFrom" by default. ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo)) + * [#10483](https://github.com/babel/babel/pull/10483) [parser] Add support for private fields in TypeScript. ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo)) +* `babel-generator`, `babel-parser`, `babel-types` + * [#10543](https://github.com/babel/babel/pull/10543) add assertions signature for TypeScript. ([@tanhauhau](https://github.com/tanhauhau)) +* `babel-cli`, `babel-register` + * [#8622](https://github.com/babel/babel/pull/8622) Make dir for babel --out-file. ([@TrySound](https://github.com/TrySound)) +* `babel-cli` + * [#10399](https://github.com/babel/babel/pull/10399) Closes [#8326](https://github.com/babel/babel/issues/8326), add back --quiet option.. ([@chris-peng-1244](https://github.com/chris-peng-1244)) + +#### :bug: Bug Fix +* `babel-helpers`, `babel-plugin-proposal-async-generator-functions`, `babel-plugin-proposal-function-sent`, `babel-preset-env` + * [#10422](https://github.com/babel/babel/pull/10422) Correctly delegate .return() in async generator. ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo)) +* `babel-helper-module-transforms`, `babel-plugin-transform-modules-commonjs` + * [#10628](https://github.com/babel/babel/pull/10628) Don't throw when destructuring into a var named as an import. ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo)) +* `babel-plugin-transform-modules-systemjs` + * [#10638](https://github.com/babel/babel/pull/10638) fix: remove ExportNamedDeclaration when the specifier is empty. ([@JLHwung](https://github.com/JLHwung)) +* `babel-parser` + * [#10631](https://github.com/babel/babel/pull/10631) [TS] Parse calls with type args in optional chains. ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo)) + * [#10607](https://github.com/babel/babel/pull/10607) fixed missing errors on assignment pattern in object expression. ([@vivek12345](https://github.com/vivek12345)) + * [#10594](https://github.com/babel/babel/pull/10594) [parser] Parse only modifiers of actual methods. ([@gonzarodriguezt](https://github.com/gonzarodriguezt)) +* `babel-plugin-transform-typescript` + * [#10555](https://github.com/babel/babel/pull/10555) [TS] Correctly transform computed strings and templates in enums. ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo)) +* `babel-core` + * [#10623](https://github.com/babel/babel/pull/10623) Fix: inputSourceMap should work when it is an external file. ([@JLHwung](https://github.com/JLHwung)) + * [#10539](https://github.com/babel/babel/pull/10539) fix: remove filename annotation in buildCodeFrameError. ([@JLHwung](https://github.com/JLHwung)) +* `babel-plugin-proposal-decorators` + * [#10578](https://github.com/babel/babel/pull/10578) [decorators] fix: support string literal properties. ([@mwhitworth](https://github.com/mwhitworth)) +* `babel-helpers`, `babel-plugin-proposal-dynamic-import`, `babel-plugin-transform-modules-commonjs`, `babel-preset-env` + * [#10574](https://github.com/babel/babel/pull/10574) fix: _interopRequireWildcard should only cache objects. ([@samMeow](https://github.com/samMeow)) +* `babel-traverse` + * [#9777](https://github.com/babel/babel/pull/9777) [traverse] Allow skipping nodes inserted with .replaceWith(). ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo)) +* `babel-preset-env` + * [#10146](https://github.com/babel/babel/pull/10146) Inject core-js@3 imports in Program:exit instead of on post(). ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo)) +* `babel-generator` + * [#10519](https://github.com/babel/babel/pull/10519) Fix generator missing parens around an arrow returning function type. ([@existentialism](https://github.com/existentialism)) +* `babel-plugin-transform-async-to-generator`, `babel-preset-env`, `babel-traverse` + * [#9939](https://github.com/babel/babel/pull/9939) Don't use args rest/spread to hoist super method calls. ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo)) + +#### :nail_care: Polish +* `babel-plugin-transform-classes`, `babel-plugin-transform-regenerator`, `babel-preset-env` + * [#9481](https://github.com/babel/babel/pull/9481) [preset-env] Don't use async-to-generator when already using regenerator. ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo)) +* `babel-helpers`, `babel-plugin-transform-modules-commonjs`, `babel-preset-env` + * [#10585](https://github.com/babel/babel/pull/10585) fix(babel‑helpers/interopRequireWildcard): Avoid double nullish check. ([@ExE-Boss](https://github.com/ExE-Boss)) +* `babel-register` + * [#10557](https://github.com/babel/babel/pull/10557) fix: disable caching when babel could not read/write cache. ([@JLHwung](https://github.com/JLHwung)) + +#### :house: Internal +* `babel-cli`, `babel-node` + * [#10619](https://github.com/babel/babel/pull/10619) chore: remove output-file-sync dependency. ([@JLHwung](https://github.com/JLHwung)) +* `babel-register` + * [#10614](https://github.com/babel/babel/pull/10614) chore: bump source-map-support to 0.5.14. ([@JLHwung](https://github.com/JLHwung)) +* `babel-helper-create-regexp-features-plugin`, `babel-plugin-proposal-unicode-property-regex`, `babel-plugin-transform-dotall-regex`, `babel-plugin-transform-named-capturing-groups-regex`, `babel-plugin-transform-unicode-regex`, `babel-preset-env` + * [#10447](https://github.com/babel/babel/pull/10447) Merge multiple regex transform plugin. ([@JLHwung](https://github.com/JLHwung)) +* `babel-preset-env` + * [#10612](https://github.com/babel/babel/pull/10612) chore: update web.immediate support fixtures. ([@JLHwung](https://github.com/JLHwung)) +* `babel-helper-module-imports` + * [#10608](https://github.com/babel/babel/pull/10608) Use .find instead of .filter to get targetPath in ImportInjector. ([@Andarist](https://github.com/Andarist)) +* Other + * [#10600](https://github.com/babel/babel/pull/10600) Test node@13 on circle. ([@existentialism](https://github.com/existentialism)) + * [#10593](https://github.com/babel/babel/pull/10593) chore: replace outdated travis-ci.org badges [ci skip]. ([@JLHwung](https://github.com/JLHwung)) + * [#10591](https://github.com/babel/babel/pull/10591) chore: test against Node.js 13. ([@JLHwung](https://github.com/JLHwung)) + * [#10556](https://github.com/babel/babel/pull/10556) Add master branch workflow for test262 tests. ([@jbhoosreddy](https://github.com/jbhoosreddy)) + * [#10553](https://github.com/babel/babel/pull/10553) chore: introduce envinfo into environment section. ([@JLHwung](https://github.com/JLHwung)) +* `babel-runtime` + * [#10418](https://github.com/babel/babel/pull/10418) docs: add homepage link. ([@DanArthurGallagher](https://github.com/DanArthurGallagher)) +* `babel-helper-annotate-as-pure`, `babel-helper-bindify-decorators`, `babel-helper-builder-binary-assignment-operator-visitor`, `babel-helper-builder-react-jsx`, `babel-helper-call-delegate`, `babel-helper-define-map`, `babel-helper-explode-assignable-expression`, `babel-helper-explode-class`, `babel-helper-function-name`, `babel-helper-get-function-arity`, `babel-helper-hoist-variables`, `babel-helper-member-expression-to-functions`, `babel-helper-module-imports`, `babel-helper-module-transforms`, `babel-helper-optimise-call-expression`, `babel-helper-remap-async-to-generator`, `babel-helper-replace-supers`, `babel-helper-simple-access`, `babel-helper-split-export-declaration`, `babel-helper-wrap-function`, `babel-helpers`, `babel-template` + * [#10568](https://github.com/babel/babel/pull/10568) Bump babel-types to ^7.6.3. ([@JLHwung](https://github.com/JLHwung)) + +#### :running_woman: Performance +* `babel-traverse` + * [#10480](https://github.com/babel/babel/pull/10480) Traverse performance. ([@JLHwung](https://github.com/JLHwung)) + +## v7.6.4 (2019-10-10) + +#### :eyeglasses: Spec Compliance +* `babel-parser` + * [#10491](https://github.com/babel/babel/pull/10491) Trailing comma after rest - The final fix ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo)) + +#### :bug: Bug Fix +* `babel-cli`, `babel-core`, `babel-generator`, `babel-helper-transform-fixture-test-runner` + * [#10536](https://github.com/babel/babel/pull/10536) Revert "chore: Upgrade source-map to 0.6.1 (#10446)" ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo)) +## v7.6.3 (2019-10-08) + +#### :eyeglasses: Spec Compliance +* `babel-parser` + * [#10469](https://github.com/babel/babel/pull/10469) Disallow await inside async arrow params ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo)) + * [#10493](https://github.com/babel/babel/pull/10493) [parser] Disallow numeric separators in legacy octal like integers ([@gonzarodriguezt](https://github.com/gonzarodriguezt)) + +#### :rocket: New Feature +* `babel-types` + * [#10504](https://github.com/babel/babel/pull/10504) Add declarations for more of @babel/types exports ([@Jessidhia](https://github.com/Jessidhia)) + +#### :bug: Bug Fix +* `babel-plugin-transform-block-scoping` + * [#10343](https://github.com/babel/babel/pull/10343) Do not remove let bindings even they are wrapped in closure ([@JLHwung](https://github.com/JLHwung)) +* `babel-parser` + * [#10119](https://github.com/babel/babel/pull/10119) add scope to TSModuleDeclaration ([@tanhauhau](https://github.com/tanhauhau)) + * [#10332](https://github.com/babel/babel/pull/10332) Do not allow member expressions to start async arrows ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo)) + * [#10490](https://github.com/babel/babel/pull/10490) [parser] Don't crash on comment after trailing comma after elision ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo)) +* `babel-plugin-transform-react-constant-elements`, `babel-traverse` + * [#10529](https://github.com/babel/babel/pull/10529) Do not hoist jsx referencing a mutable binding ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo)) +* `babel-generator`, `babel-parser`, `babel-plugin-transform-block-scoping`, `babel-plugin-transform-flow-comments`, `babel-plugin-transform-flow-strip-types`, `babel-plugin-transform-typescript` + * [#10220](https://github.com/babel/babel/pull/10220) Flow: interface identifier should be declared in the scope ([@JLHwung](https://github.com/JLHwung)) + +#### :nail_care: Polish +* `babel-core` + * [#10419](https://github.com/babel/babel/pull/10419) assertNoDuplicates throw with more context ([@hjdivad](https://github.com/hjdivad)) + * [#10511](https://github.com/babel/babel/pull/10511) Add filename to transform error ([@JLHwung](https://github.com/JLHwung)) + +#### :house: Internal +* Other + * [#10506](https://github.com/babel/babel/pull/10506) Use `make -j` for parallel build ([@JLHwung](https://github.com/JLHwung)) + * [#10443](https://github.com/babel/babel/pull/10443) perf: only apply lazy cjs module transform on cli and core ([@JLHwung](https://github.com/JLHwung)) + * [#10494](https://github.com/babel/babel/pull/10494) Enable optional chaining and nullish coalescing plugins ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo)) +* `babel-cli`, `babel-core`, `babel-generator`, `babel-helper-fixtures`, `babel-helper-transform-fixture-test-runner`, `babel-node`, `babel-plugin-transform-react-jsx-source`, `babel-plugin-transform-runtime`, `babel-preset-env`, `babel-preset-react` + * [#10249](https://github.com/babel/babel/pull/10249) Add windows to travis ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo)) + +#### :running_woman: Performance +* `babel-parser` + * [#10371](https://github.com/babel/babel/pull/10371) perf: replace lookahead by lookaheadCharCode ([@JLHwung](https://github.com/JLHwung)) +* Other + * [#10443](https://github.com/babel/babel/pull/10443) perf: only apply lazy cjs module transform on cli and core ([@JLHwung](https://github.com/JLHwung)) +## v7.6.2 (2019-09-23) + +#### :eyeglasses: Spec Compliance +* `babel-parser` + * [#10472](https://github.com/babel/babel/pull/10472) added check to disallow super.private variable access and test case added. ([@vivek12345](https://github.com/vivek12345)) + * [#10468](https://github.com/babel/babel/pull/10468) [parser] Disallow numeric separator in unicode scape sequences. ([@ivandevp](https://github.com/ivandevp)) + * [#10467](https://github.com/babel/babel/pull/10467) [parser] Invalid NonOctal Decimal. ([@gonzarodriguezt](https://github.com/gonzarodriguezt)) + * [#10461](https://github.com/babel/babel/pull/10461) [parser] Disallow static fields named `constructor`. ([@guywaldman](https://github.com/guywaldman)) + * [#10455](https://github.com/babel/babel/pull/10455) [parser] Report escapes in kws only if they won't be used as identifiers. ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo)) + +#### :bug: Bug Fix +* `babel-parser` + * [#10445](https://github.com/babel/babel/pull/10445) Leave trailing comments after handling a possible trailing comma. ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo)) +* `babel-cli` + * [#10400](https://github.com/babel/babel/pull/10400) fix: allow the process to exit naturally. ([@JLHwung](https://github.com/JLHwung)) +* `babel-core` + * [#10402](https://github.com/babel/babel/pull/10402) fix: pass optionLoc when validating plugin object. ([@JLHwung](https://github.com/JLHwung)) +* `babel-plugin-transform-block-scoping`, `babel-plugin-transform-spread`, `babel-traverse` + * [#10417](https://github.com/babel/babel/pull/10417) Do not guess relative execution status for exported fns. ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo)) +* `babel-plugin-proposal-object-rest-spread`, `babel-preset-env` + * [#10275](https://github.com/babel/babel/pull/10275) fix object rest in array pattern. ([@tanhauhau](https://github.com/tanhauhau)) + +#### :house: Internal +* `babel-plugin-transform-named-capturing-groups-regex` + * [#10430](https://github.com/babel/babel/pull/10430) refactor: replace regexp-tree by regexpu. ([@JLHwung](https://github.com/JLHwung)) +* Other + * [#10441](https://github.com/babel/babel/pull/10441) Update GitHub actions to v2. ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo)) + * [#10427](https://github.com/babel/babel/pull/10427) chore: add lint-ts rule. ([@JLHwung](https://github.com/JLHwung)) +* `babel-helper-fixtures` + * [#10428](https://github.com/babel/babel/pull/10428) chore: remove tryResolve dependency. ([@JLHwung](https://github.com/JLHwung)) +* `babel-node` + * [#10429](https://github.com/babel/babel/pull/10429) Remove babel polyfill dependency of babel-node. ([@bdwain](https://github.com/bdwain)) +* `babel-generator`, `babel-helper-fixtures` + * [#10420](https://github.com/babel/babel/pull/10420) chore: remove trim-right dependency. ([@JLHwung](https://github.com/JLHwung)) +* `babel-core`, `babel-plugin-transform-runtime`, `babel-register` + * [#10405](https://github.com/babel/babel/pull/10405) Remove circular dependency. ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo)) + +#### :running_woman: Performance +* `babel-parser` + * [#10421](https://github.com/babel/babel/pull/10421) Miscellaneous perf tweak. ([@JLHwung](https://github.com/JLHwung)) + +## v7.6.1 (2019-09-06) + +#### :bug: Bug Fix +* `babel-types` + * [#10404](https://github.com/babel/babel/pull/10404) fix(types): correct typescript function headers ([@forstermatth](https://github.com/forstermatth)) +* `babel-node` + * [#9758](https://github.com/babel/babel/pull/9758) Remove process.exit(1) from babel-node ([@dword-design](https://github.com/dword-design)) + +## v7.6.0 (2019-09-06) + +#### :eyeglasses: Spec Compliance +* `babel-generator`, `babel-parser` + * [#10269](https://github.com/babel/babel/pull/10269) Fix parenthesis for nullish coalescing ([@vivek12345](https://github.com/vivek12345)) +* `babel-helpers`, `babel-plugin-transform-block-scoping`, `babel-traverse` + * [#9498](https://github.com/babel/babel/pull/9498) Fix tdz checks in transform-block-scoping plugin ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo)) + +#### :rocket: New Feature +* `babel-core` + * [#10181](https://github.com/babel/babel/pull/10181) feat(errors): validate preset when filename is absent ([@JLHwung](https://github.com/JLHwung)) +* `babel-helper-create-class-features-plugin`, `babel-helpers`, `babel-plugin-proposal-private-methods` + * [#10217](https://github.com/babel/babel/pull/10217) Class Private Static Accessors ([@tim-mc](https://github.com/tim-mc)) +* `babel-generator`, `babel-parser`, `babel-types` + * [#10148](https://github.com/babel/babel/pull/10148) V8intrinsic syntax plugin ([@JLHwung](https://github.com/JLHwung)) +* `babel-preset-typescript` + * [#10382](https://github.com/babel/babel/pull/10382) Allow setting 'allowNamespaces' in typescript preset ([@dsgkirkby](https://github.com/dsgkirkby)) +* `babel-parser` + * [#10352](https://github.com/babel/babel/pull/10352) Do not register ambient classes to the TS scope ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo)) +* `babel-types` + * [#10248](https://github.com/babel/babel/pull/10248) Add static to class property builder ([@yuri-karadzhov](https://github.com/yuri-karadzhov)) + +#### :bug: Bug Fix +* `babel-helpers`, `babel-plugin-transform-destructuring`, `babel-plugin-transform-modules-commonjs`, `babel-preset-env` + * [#10396](https://github.com/babel/babel/pull/10396) fix: early return when instance is not iterable ([@JLHwung](https://github.com/JLHwung)) +* `babel-plugin-transform-runtime` + * [#10398](https://github.com/babel/babel/pull/10398) Add supports for polyfill computed methods ([@rhyzx](https://github.com/rhyzx)) +* `babel-preset-env` + * [#10397](https://github.com/babel/babel/pull/10397) Don't polyfill when evaluation is not confident ([@rhyzx](https://github.com/rhyzx)) + * [#10218](https://github.com/babel/babel/pull/10218) [preset-env] Include / exclude module plugins properly ([@AdamRamberg](https://github.com/AdamRamberg)) + * [#10284](https://github.com/babel/babel/pull/10284) Replace es.string.reverse with es.array.reverse ([@epicfaace](https://github.com/epicfaace)) +* `babel-plugin-transform-named-capturing-groups-regex` + * [#10395](https://github.com/babel/babel/pull/10395) fix: transform name capturing regex once ([@JLHwung](https://github.com/JLHwung)) +* `babel-types` + * [#10098](https://github.com/babel/babel/pull/10098) fix typescript for babel-types ([@tanhauhau](https://github.com/tanhauhau)) + * [#10319](https://github.com/babel/babel/pull/10319) Add a builder definition including name for tsTypeParameter ([@deificx](https://github.com/deificx)) +* `babel-parser` + * [#10380](https://github.com/babel/babel/pull/10380) Refactor trailing comment adjustment ([@banga](https://github.com/banga)) + * [#10369](https://github.com/babel/babel/pull/10369) Retain trailing comments in array expressions ([@banga](https://github.com/banga)) + * [#10292](https://github.com/babel/babel/pull/10292) fix: assign trailing comment to ObjectProperty only when inside an ObjectExpression ([@JLHwung](https://github.com/JLHwung)) +* `babel-parser`, `babel-types` + * [#10366](https://github.com/babel/babel/pull/10366) Don't allow JSXNamespacedName to chain ([@jridgewell](https://github.com/jridgewell)) +* `babel-generator`, `babel-plugin-transform-typescript`, `babel-types` + * [#10341](https://github.com/babel/babel/pull/10341) Add TSBigIntKeyword to @babel/types ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo)) +* `babel-core`, `babel-types` + * [#9960](https://github.com/babel/babel/pull/9960) Do not delete "fake" source map comments from strings ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo)) +* `babel-plugin-transform-flow-comments` + * [#10329](https://github.com/babel/babel/pull/10329) Fix flow comments plugin issues ([@zaygraveyard](https://github.com/zaygraveyard)) +* `babel-helpers`, `babel-plugin-transform-react-constant-elements` + * [#10307](https://github.com/babel/babel/pull/10307) [fix] jsx helper calls order ([@Sinewyk](https://github.com/Sinewyk)) +* `babel-plugin-proposal-decorators` + * [#10302](https://github.com/babel/babel/pull/10302) fix: register inserted class declaration ([@thiagoarrais](https://github.com/thiagoarrais)) +* `babel-plugin-proposal-do-expressions`, `babel-traverse` + * [#10070](https://github.com/babel/babel/pull/10070) Do expressions transform for switch statements ([@tanhauhau](https://github.com/tanhauhau)) + * [#10277](https://github.com/babel/babel/pull/10277) remove finally from completion record in try statement ([@tanhauhau](https://github.com/tanhauhau)) +* `babel-helpers`, `babel-plugin-transform-named-capturing-groups-regex` + * [#10136](https://github.com/babel/babel/pull/10136) fix capturing group for matchAll ([@tanhauhau](https://github.com/tanhauhau)) + +#### :nail_care: Polish +* `babel-plugin-transform-runtime`, `babel-preset-env` + * [#10372](https://github.com/babel/babel/pull/10372) Don't allow instance properties transformation on namespace ([@rhyzx](https://github.com/rhyzx)) + +#### :memo: Documentation +* [#10313](https://github.com/babel/babel/pull/10313) Adds note about two approval policy to PR template ([@thiagoarrais](https://github.com/thiagoarrais)) + +#### :house: Internal +* `babel-register` + * [#9847](https://github.com/babel/babel/pull/9847) Remove core-js dependency from @babel/register ([@coreyfarrell](https://github.com/coreyfarrell)) +* `babel-helper-fixtures`, `babel-helper-transform-fixture-test-runner`, `babel-preset-env` + * [#10401](https://github.com/babel/babel/pull/10401) Use "validateLogs" for preset-env's debug fixtures ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo)) +* `babel-parser` + * [#10380](https://github.com/babel/babel/pull/10380) Refactor trailing comment adjustment ([@banga](https://github.com/banga)) +* `babel-helper-fixtures`, `babel-helper-transform-fixture-test-runner`, `babel-plugin-proposal-dynamic-import`, `babel-preset-env` + * [#10326](https://github.com/babel/babel/pull/10326) Allow testing logs with `@babel/helper-transform-fixture-test-runner` ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo)) +* `babel-runtime-corejs2`, `babel-runtime`, `babel-types` + * [#10331](https://github.com/babel/babel/pull/10331) Commit generated code ([@JLHwung](https://github.com/JLHwung)) +* `babel-cli`, `babel-core`, `babel-generator`, `babel-helper-create-class-features-plugin`, `babel-helper-fixtures`, `babel-node`, `babel-parser`, `babel-plugin-proposal-do-expressions`, `babel-plugin-proposal-pipeline-operator`, `babel-plugin-transform-modules-commonjs`, `babel-plugin-transform-runtime`, `babel-preset-env`, `babel-standalone`, `babel-template`, `babel-traverse`, `babel-types` + * [#10228](https://github.com/babel/babel/pull/10228) Update dev dependencies and fix linting errors ([@danez](https://github.com/danez)) +* `babel-cli` + * [#10244](https://github.com/babel/babel/pull/10244) added flow to babel cli ([@Letladi](https://github.com/Letladi)) + +#### :running_woman: Performance +* `babel-helpers`, `babel-plugin-transform-modules-commonjs`, `babel-preset-env` + * [#10161](https://github.com/babel/babel/pull/10161) Improves the logic to import objects in helpers ([@ifsnow](https://github.com/ifsnow)) +* `babel-traverse` + * [#10243](https://github.com/babel/babel/pull/10243) perf: always return `void 0` as undefined node ([@JLHwung](https://github.com/JLHwung)) ## v7.5.5 (2019-07-17) @@ -389,7 +1310,7 @@ See [Babylon's CHANGELOG](packages/babylon/CHANGELOG.md) for the Babylon pre-7.0 ## v7.3.3 (2019-02-15) -#### :eyeglasses: Spec Compliancy +#### :eyeglasses: Spec Compliance * `babel-generator` * [#9501](https://github.com/babel/babel/pull/9501) Correctly output escapes in directives ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo)) @@ -411,11 +1332,11 @@ See [Babylon's CHANGELOG](packages/babylon/CHANGELOG.md) for the Babylon pre-7.0 * [#9491](https://github.com/babel/babel/pull/9491) Better error output in parser tests ([@danez](https://github.com/danez)) ## v7.3.2 (2019-02-04) -Various spec compliancy fixes and better support for smart pipelines and private methods. +Various spec compliance fixes and better support for smart pipelines and private methods. Thanks @gverni, @naffiq, @spondbob and @dstaley for their first PRs! -#### :eyeglasses: Spec Compliancy +#### :eyeglasses: Spec Compliance * `babel-parser` * [#9403](https://github.com/babel/babel/pull/9403) Fix line continuation with Unicode line terminators. ([@danez](https://github.com/danez)) * [#9400](https://github.com/babel/babel/pull/9400) Make yield a contextual keyword. ([@danez](https://github.com/danez)) @@ -463,7 +1384,7 @@ This release fixes some regressions introduced in v7.3.0 Thanks to @jamesgeorge007 and @armano2 for their first PR! -#### :eyeglasses: Spec Compliancy +#### :eyeglasses: Spec Compliance * `babel-parser` * [#9314](https://github.com/babel/babel/pull/9314) Disallow async functions as loop body. ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo)) * [#9315](https://github.com/babel/babel/pull/9315) Parse class heritage as strict mode code. ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo)) @@ -684,7 +1605,7 @@ You can read more about this release at https://babeljs.io/blog/2018/12/03/7.2.0 ## v7.1.5 (2018-11-06) -#### :eyeglasses: Spec Compliancy +#### :eyeglasses: Spec Compliance * `babel-parser`, `babylon` * [#7727](https://github.com/babel/babel/pull/7727) Fix await in function name and parameters. ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo)) @@ -1147,7 +2068,7 @@ Fixed a peerDep issue Mostly bug fixes and some decorator updates -#### :eyeglasses: Spec Compliancy +#### :eyeglasses: Spec Compliance * `babel-plugin-proposal-unicode-property-regex` * [#8127](https://github.com/babel/babel/pull/8127) Update plugin-proposal-unicode-property-regex for Unicode v11. ([@mathiasbynens](https://github.com/mathiasbynens)) * `babel-parser` @@ -1247,7 +2168,7 @@ Mostly bugfix release for a regression in decorators, and a quick fix for some n - Fix IE10 class regression - Various fixes, many TS fixes -#### :eyeglasses: Spec Compliancy +#### :eyeglasses: Spec Compliance * `babel-parser`, `babel-plugin-proposal-json-strings`, `babel-plugin-syntax-json-strings`, `babel-preset-stage-3` * [#7985](https://github.com/babel/babel/pull/7985) Subsume json. ([@jridgewell](https://github.com/jridgewell)) @@ -1437,7 +2358,7 @@ Mostly bugfix release for a regression in decorators, and a quick fix for some n * `babel-generator`, `babel-helper-define-map`, `babel-plugin-syntax-class-properties`, `babel-plugin-transform-parameters`, `babel-plugin-transform-react-constant-elements`, `babel-traverse`, `babel-types` * [#7666](https://github.com/babel/babel/pull/7666) Private Properties phase 1. ([@jridgewell](https://github.com/jridgewell)) -#### :eyeglasses: Spec Compliancy +#### :eyeglasses: Spec Compliance * `babel-helper-simple-access`, `babel-plugin-transform-modules-commonjs`, `babel-plugin-transform-modules-systemjs` * [#7766](https://github.com/babel/babel/pull/7766) Correct update expression Number coercion. ([@jridgewell](https://github.com/jridgewell)) * `babel-core`, `babel-generator`, `babel-plugin-proposal-decorators`, `babel-types`, `babylon` @@ -1525,7 +2446,7 @@ Mostly bugfix release for a regression in decorators, and a quick fix for some n Various fixes, also lazy-load `@babel/core` dependencies (should make config lookup and other API methods fast for other projects to use). -#### :eyeglasses: Spec Compliancy +#### :eyeglasses: Spec Compliance * `babel-plugin-proposal-logical-assignment-operators` * [#7604](https://github.com/babel/babel/pull/7604) Logical Assignment: ensure computed key isn't recomputed. ([@jridgewell](https://github.com/jridgewell)) @@ -1624,7 +2545,7 @@ We'll need to update tooling for this ^. Also published `gulp-babel@8.0.0-beta.2 * `babel-register` * [#7416](https://github.com/babel/babel/pull/7416) Replace instead of merging babel-register options, and resolve cwd up front. ([@loganfsmyth](https://github.com/loganfsmyth)) -#### :eyeglasses: Spec Compliancy +#### :eyeglasses: Spec Compliance * `babylon` * [#7503](https://github.com/babel/babel/pull/7503) Update test262 test script and a few keyword escape fixes. ([@existentialism](https://github.com/existentialism)) * [#7498](https://github.com/babel/babel/pull/7498) Disallow setters to have RestElement. ([@danez](https://github.com/danez)) @@ -1772,7 +2693,7 @@ We'll need to update tooling for this ^. Also published `gulp-babel@8.0.0-beta.2 ## v7.0.0-beta.39 (2018-01-30) -#### :eyeglasses: Spec Compliancy +#### :eyeglasses: Spec Compliance * `babel-plugin-proposal-optional-chaining` * [#6345](https://github.com/babel/babel/pull/6345) Remove old optional chain features. ([@jridgewell](https://github.com/jridgewell)) @@ -1985,7 +2906,7 @@ Fixes + [overrides](https://github.com/babel/babel/pull/7091) config feature Various bug fixes, first version of Babel to use the MIT version of `regenerator` -#### :eyeglasses: Spec Compliancy +#### :eyeglasses: Spec Compliance * `babylon` * [#6986](https://github.com/babel/babel/pull/6986) Fix destructuring assignment spec violation. ([@ksashikumar](https://github.com/ksashikumar)) * `babel-helper-replace-supers`, `babel-helpers`, `babel-plugin-proposal-class-properties`, `babel-plugin-transform-classes`, `babel-plugin-transform-parameters` @@ -2038,7 +2959,7 @@ Various bug fixes, first version of Babel to use the MIT version of `regenerator * `babel-preset-stage-1`, `babel-preset-stage-2` * [#6949](https://github.com/babel/babel/pull/6949) Fix stage refs to exportNamespaceFrom and exportDefaultFrom. ([@existentialism](https://github.com/existentialism)) -#### :eyeglasses: Spec Compliancy +#### :eyeglasses: Spec Compliance * `babel-preset-stage-0`, `babel-preset-stage-1` * [#6943](https://github.com/babel/babel/pull/6943) Moving Do expression to stage 1. ([@rajzshkr](https://github.com/rajzshkr)) @@ -2052,7 +2973,7 @@ Various bug fixes, first version of Babel to use the MIT version of `regenerator ## v7.0.0-beta.33 (2017-12-01) -#### :eyeglasses: Spec Compliancy +#### :eyeglasses: Spec Compliance * `babel-generator`, `babel-plugin-proposal-export-default-from`, `babel-plugin-proposal-export-default`, `babel-plugin-proposal-export-namespace-from`, `babel-plugin-proposal-export-namespace`, `babel-plugin-syntax-export-default-from`, `babel-plugin-syntax-export-extensions`, `babel-plugin-syntax-export-namespace-from`, `babel-standalone`, `babylon` * [#6920](https://github.com/babel/babel/pull/6920) Split exportExtensions into exportDefault and exportNamespace plugins…. ([@existentialism](https://github.com/existentialism)) * `babylon` @@ -2237,7 +3158,7 @@ Various bug fixes, first version of Babel to use the MIT version of `regenerator > Note: don't use ^ in your dependencies when using a beta. It can still break between (we should try not to do it but it can), so pin all the packages like `"@babel/cli" : "7.0.0-beta.4"` -#### :eyeglasses: Spec Compliancy +#### :eyeglasses: Spec Compliance * `babel-plugin-transform-optional-chaining` * [#6525](https://github.com/babel/babel/pull/6525) Optional Chaining: Account for document.all. ([@azz](https://github.com/azz)) * `babel-preset-env`, `babel-helper-remap-async-to-generator`, `babel-helpers`, `babel-plugin-transform-async-generator-functions`, `babel-plugin-transform-async-to-generator`, `babel-plugin-transform-function-sent` @@ -2517,7 +3438,7 @@ let {...{}} = {}; let {...[]} = {}; - Add `--config-file` CLI flag to explicitly pass a config location - Move `babel-standalone` into the repo (another form of this used to be `babel-browser`) -#### :eyeglasses: Spec Compliancy +#### :eyeglasses: Spec Compliance * `babel-plugin-transform-async-to-generator`, `babel-*` * [#6094](https://github.com/babel/babel/pull/6094) Spec compatibility for iteratorClose condition.. ([@yavorsky](https://github.com/yavorsky)) * `babel-helpers`, `babel-plugin-transform-es2015-computed-properties` @@ -2653,7 +3574,7 @@ Initial release of typescript equivalent of how Babel handles flow with a new `b ## v7.0.0-alpha.18 (2017-08-03) -#### :eyeglasses: Spec Compliancy +#### :eyeglasses: Spec Compliance * `babel-generator`, `babel-plugin-transform-flow-comments`, `babel-plugin-transform-flow-strip-types`, `babel-types` * [#5990](https://github.com/babel/babel/pull/5990) Flow opaque type aliases. ([@jbrown215](https://github.com/jbrown215)) * `babel-preset-stage-3` @@ -2702,9 +3623,9 @@ Initial release of typescript equivalent of how Babel handles flow with a new `b - Optional catch binding `try {} catch {}`: `babel-plugin-transform-optional-catch-binding` - es2015-parameters `loose` mode that doesn't use `arguments` -#### :eyeglasses: Spec Compliancy +#### :eyeglasses: Spec Compliance * `babel-plugin-check-es2015-constants` - * [#5930](https://github.com/babel/babel/pull/5930) Spec compliancy of check-es2015-constants plugin. ([@maurobringolf](https://github.com/maurobringolf)) + * [#5930](https://github.com/babel/babel/pull/5930) Spec compliance of check-es2015-constants plugin. ([@maurobringolf](https://github.com/maurobringolf)) > Instead of throwing a compile time error when const is violated, Babel should insert a throw statement before the violation. @@ -3009,7 +3930,7 @@ var A = function A() { ## v7.0.0-alpha.12 (2017-05-31) -#### :eyeglasses: Spec Compliancy +#### :eyeglasses: Spec Compliance * `babel-core`, `babel-generator`, `babel-plugin-syntax-numeric-separator`, `babel-plugin-transform-numeric-separator`, `babel-preset-stage-1`, `babel-template`, `babel-traverse`, `babel-types` * [#5793](https://github.com/babel/babel/pull/5793) Support for NumericLiteralSeparator, Stage 1 feature. ([@rwaldron](https://github.com/rwaldron)) @@ -3050,7 +3971,7 @@ var A = function A() { Update Babylon: https://github.com/babel/babylon/releases/tag/v7.0.0-beta.9, https://github.com/babel/babylon/releases/tag/v7.0.0-beta.10 -#### :eyeglasses: Spec Compliancy +#### :eyeglasses: Spec Compliance * `babel-generator`, `babel-plugin-transform-flow-strip-types`, `babel-types` * [#5525](https://github.com/babel/babel/pull/5525) Add support for object type spread. ([@conartist6](https://github.com/conartist6)) @@ -3124,7 +4045,7 @@ Update Babylon: https://github.com/babel/babylon/releases/tag/v7.0.0-beta.9, htt ## v7.0.0-alpha.8 (2017-04-17) -#### :eyeglasses: Spec Compliancy +#### :eyeglasses: Spec Compliance * `babel-preset-stage-2`, `babel-preset-stage-3` * [#5610](https://github.com/babel/babel/pull/5610) Move syntax-dynamic-import to stage-3. ([@dkaoster](https://github.com/dkaoster)) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index e7b9bd953b54..c0a2bd0510ed 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,4 +1,4 @@ ----- +---

Setup @@ -12,26 +12,24 @@ Internals

----- - +--- # Contributing -Contributions are always welcome, no matter how large or small. Before -contributing, please read the -[code of conduct](https://github.com/babel/babel/blob/master/CODE_OF_CONDUCT.md). +Contributions are always welcome, no matter how large or small! Before contributing, please read the [code of conduct](https://github.com/babel/babel/blob/master/CODE_OF_CONDUCT.md). ## Not sure where to start? - If you aren't just making a documentation change, you'll probably want to learn a bit about a few topics. - - [ASTs](https://en.wikipedia.org/wiki/Abstract_syntax_tree) (Abstract Syntax Tree): The Babel AST [spec](https://github.com/babel/babel/blob/master/packages/babel-parser/ast/spec.md) is a bit different from [ESTree](https://github.com/estree/estree). The differences are listed [here](https://babeljs.io/docs/en/next/babel-parser.html#output). - - Check out [`/doc`](https://github.com/babel/babel/tree/master/doc) for information about Babel's internals - - Check out [the Babel Plugin Handbook](https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#babel-plugin-handbook) - core plugins are written the same way as any other plugin! - - Check out [AST Explorer](http://astexplorer.net/#/scUfOmVOG5) to learn more about ASTs or make your own plugin in the browser + - [ASTs](https://en.wikipedia.org/wiki/Abstract_syntax_tree) (Abstract Syntax Tree): The Babel AST [spec](https://github.com/babel/babel/blob/master/packages/babel-parser/ast/spec.md) is a bit different from [ESTree](https://github.com/estree/estree). The differences are listed [here](https://babeljs.io/docs/en/next/babel-parser.html#output). + - Check out [`/doc`](https://github.com/babel/babel/tree/master/doc) for information about Babel's internals + - Check out [the Babel Plugin Handbook](https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#babel-plugin-handbook) - core plugins are written the same way as any other plugin! + - Check out [AST Explorer](http://astexplorer.net/#/scUfOmVOG5) to learn more about ASTs or make your own plugin in the browser - When you feel ready to jump into the Babel source code, a good place to start is to look for issues tagged with [help wanted](https://github.com/babel/babel/labels/help%20wanted) and/or [good first issue](https://github.com/babel/babel/labels/good%20first%20issue). - Follow along with what we are working on by joining our [Slack](https://babeljs.slack.com) (you can sign-up [here](https://slack.babeljs.io/) - for an invite), following our announcements on [Twitter](https://twitter.com/babeljs), and reading (or participating!) in our [meeting notes](https://github.com/babel/notes). + for an invite), following our announcements on [Twitter](https://twitter.com/babeljs), and reading (or participating!) in our [meeting notes](https://github.com/babel/notes). - Check out our [website](http://babeljs.io/) and the [repo](https://github.com/babel/website) +- You can contribute by triaging issues which may include reproducing bug reports or asking for vital information, such as version numbers or reproduction instructions. If you would like to start triaging issues, one easy way to get started is to [subscribe to babel on CodeTriage](https://www.codetriage.com/babel/babel). [![Open Source Helpers](https://www.codetriage.com/babel/babel/badges/users.svg)](https://www.codetriage.com/babel/babel) ## Chat @@ -39,17 +37,18 @@ Feel free to check out the `#discussion`/`#development` channels on our [Slack]( ## Developing -**Note:** Versions `< 5.1.10` can't be built. - -Babel is built for Node 6 and up but we develop using Node 8 and yarn. You can check this with `node -v`. +*Node*: Check that Node is [installed](https://nodejs.org/en/download/) with version 10 and up. You can check this with `node -v`. -Make sure that Yarn is installed with version >= `0.28.0`. -Installation instructions can be found here: https://yarnpkg.com/en/docs/install. +*Yarn*: Make sure that Yarn 1 is [installed](https://classic.yarnpkg.com/en/docs/install) with version >= `1.19.0`. ### Setup +Fork the `babel` repository to your GitHub Account. + +Then, run: + ```sh -$ git clone https://github.com/babel/babel +$ git clone https://github.com//babel $ cd babel $ make bootstrap ``` @@ -68,7 +67,7 @@ $ make watch to have Babel build itself and incrementally build files on change. -You can access the built files for individual packages from `packages//lib`. +> You can access the built files for individual packages from `packages//lib`. If you wish to build a copy of Babel for distribution, then run: @@ -105,9 +104,7 @@ If you just want to run all tests: $ make test-only ``` -Most likely you'll want to focus in on a specific issue. - -To run tests for a specific package in [packages](https://github.com/babel/babel/tree/master/packages), you can use the `TEST_ONLY` environment variable: +When working on an issue, you will most likely want to focus on a particular [packages](https://github.com/babel/babel/tree/master/packages). Using `TEST_ONLY` will only run tests for that specific package. ```sh $ TEST_ONLY=babel-cli make test @@ -157,12 +154,12 @@ $ ./scripts/test-cov.sh In case you're not able to reproduce an error on CI locally, it may be due to - - Node Version: Travis CI runs the tests against all major node versions. If your tests use JavaScript features unsupported by lower versions of node, then use [minNodeVersion option](#writing-tests) in options.json. - - Timeout: Check the CI log and if the only errors are timeout errors and you are sure that it's not related to the changes you made, ask someone in the slack channel to trigger rebuild on the CI build and it might be resolved +- Node Version: Travis CI runs the tests against all major node versions. If your tests use JavaScript features unsupported by lower versions of node, then use [minNodeVersion option](#writing-tests) in options.json. +- Timeout: Check the CI log and if the only errors are timeout errors and you are sure that it's not related to the changes you made, ask someone in the slack channel to trigger rebuild on the CI build and it might be resolved In case you're locally getting errors which are not on the CI, it may be due to - - Updates in Dependencies: Make sure you run `make bootstrap` before you run `make build` or `make watch` before you run the tests. +- Updates in Dependencies: Make sure you run `make bootstrap` before you run `make build` or `make watch` before you run the tests. ### Writing tests @@ -176,15 +173,16 @@ For example, in [`@babel/plugin-transform-exponentiation-operator/test`](https:/ - There is an `index.js` file. It imports our [test helper](https://github.com/babel/babel/tree/master/packages/babel-helper-plugin-test-runner). (You don't have to worry about this). - There can be multiple folders under [`/fixtures`](https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-exponentiation-operator/test/fixtures) - - There is an [`options.json`](https://github.com/babel/babel/blob/master/packages/babel-plugin-transform-exponentiation-operator/test/fixtures/exponentian-operator/options.json) file whose function is similar to a `.babelrc` file, allowing you to pass in the plugins and settings you need for your tests. - - For this test, we only need the relevant plugin, so it's just `{ "plugins": ["@babel/plugin-transform-exponentiation-operator"] }`. - - If necessary, you can have an `options.json` with different options in each subfolder. + + - There is an [`options.json`](https://github.com/babel/babel/blob/master/packages/babel-plugin-transform-exponentiation-operator/test/fixtures/exponentian-operator/options.json) file whose function is similar to a `.babelrc` file, allowing you to pass in the plugins and settings you need for your tests. + - For this test, we only need the relevant plugin, so it's just `{ "plugins": ["@babel/plugin-transform-exponentiation-operator"] }`. + - If necessary, you can have an `options.json` with different options in each subfolder. - In each subfolder, you can organize your directory structure by categories of tests. (Example: these folders can be named after the feature you are testing or can reference the issue number they fix) - Generally, there are two kinds of tests for plugins -   - The first is a simple test of the input and output produced by running Babel on some code. We do this by creating an [`input.js`](https://github.com/babel/babel/blob/master/packages/babel-plugin-transform-exponentiation-operator/test/fixtures/exponentian-operator/binary/input.js) file and an [`output.js`](https://github.com/babel/babel/blob/master/packages/babel-plugin-transform-exponentiation-operator/test/fixtures/exponentian-operator/binary/output.js) file. This kind of test only works in sub-subdirectories of `/fixtures`, i.e. `/fixtures/exponentian-operator/binary/input.js` and **not** `/fixtures/exponentian-operator/input.js`. - - If you need to expect an error, you can ignore creating the `output.js` file and pass a new `throws` key to the `options.json` that contains the error string that is created. - - The second and preferred type is a test that actually evaluates the produced code and asserts that certain properties are true or false. We do this by creating an [`exec.js`](https://github.com/babel/babel/blob/master/packages/babel-plugin-transform-exponentiation-operator/test/fixtures/exponentian-operator/comprehensive/exec.js) file. +   - The first is a simple test of the input and output produced by running Babel on some code. We do this by creating an [`input.js`](https://github.com/babel/babel/blob/master/packages/babel-plugin-transform-exponentiation-operator/test/fixtures/exponentian-operator/binary/input.js) file and an [`output.js`](https://github.com/babel/babel/blob/master/packages/babel-plugin-transform-exponentiation-operator/test/fixtures/exponentian-operator/binary/output.js) file. This kind of test only works in sub-subdirectories of `/fixtures`, i.e. `/fixtures/exponentian-operator/binary/input.js` and **not** `/fixtures/exponentian-operator/input.js`. + - If you need to expect an error, you can ignore creating the `output.js` file and pass a new `throws` key to the `options.json` that contains the error string that is created. + - The second and preferred type is a test that actually evaluates the produced code and asserts that certain properties are true or false. We do this by creating an [`exec.js`](https://github.com/babel/babel/blob/master/packages/babel-plugin-transform-exponentiation-operator/test/fixtures/exponentian-operator/comprehensive/exec.js) file. In a fixture test, you simply write out the code you want to transform in `input.js`. @@ -199,6 +197,7 @@ and the expected output after transforming it with your `options.json` in `outpu // output.js Math.pow(2, 2); ``` + In an `exec.js` test, we run or check that the code actually does what it's supposed to do rather than just check the static output. ```js @@ -234,9 +233,9 @@ Inside the `packages/babel-parser/test/fixtures` folder are categories/groupings etc.). To add a test, create a folder under one of these groupings (or create a new one) with a descriptive name, and add the following: -* Create an `input.js` file that contains the code you want the babel parser to parse. +- Create an `input.js` file that contains the code you want the babel parser to parse. -* Add an `output.json` file with the expected parser output. For added convenience, if there is no `output.json` present, the test runner will generate one for you. +- Add an `output.json` file with the expected parser output. For added convenience, if there is no `output.json` present, the test runner will generate one for you. After writing tests for @babel/parser, just build it by running: @@ -316,6 +315,7 @@ Note that the code shown in Chrome DevTools is compiled code and therefore diffe - Start working about the Babel transform itself! ## Internals + - AST spec ([babel-parser/ast/spec.md](https://github.com/babel/babel/blob/master/packages/babel-parser/ast/spec.md)) - Versioning ([doc/design/versioning.md](https://github.com/babel/babel/blob/master/doc/design/versioning.md)) - Monorepo ([doc/design/monorepo.md](https://github.com/babel/babel/blob/master/doc/design/monorepo.md)) diff --git a/Gulpfile.js b/Gulpfile.js index 5df9882ca3f2..5f0b03c04b51 100644 --- a/Gulpfile.js +++ b/Gulpfile.js @@ -5,31 +5,29 @@ const through = require("through2"); const chalk = require("chalk"); const newer = require("gulp-newer"); const babel = require("gulp-babel"); -const gulpWatch = require("gulp-watch"); const fancyLog = require("fancy-log"); const filter = require("gulp-filter"); const gulp = require("gulp"); const path = require("path"); -const webpack = require("webpack"); -const merge = require("merge-stream"); const rollup = require("rollup"); const rollupBabel = require("rollup-plugin-babel"); +const rollupBabelSource = require("./scripts/rollup-plugin-babel-source"); +const rollupCommonJs = require("rollup-plugin-commonjs"); +const rollupJson = require("@rollup/plugin-json"); +const rollupNodeBuiltins = require("rollup-plugin-node-builtins"); +const rollupNodeGlobals = require("rollup-plugin-node-globals"); const rollupNodeResolve = require("rollup-plugin-node-resolve"); const rollupReplace = require("rollup-plugin-replace"); -const { registerStandalonePackageTask } = require("./scripts/gulp-tasks"); +const { terser: rollupTerser } = require("rollup-plugin-terser"); -const sources = ["codemods", "packages"]; +const defaultSourcesGlob = "./@(codemods|packages|eslint)/*/src/**/*.js"; function swapSrcWithLib(srcPath) { const parts = srcPath.split(path.sep); - parts[1] = "lib"; + parts[2] = "lib"; return parts.join(path.sep); } -function getGlobFromSource(source) { - return `./${source}/*/src/**/*.js`; -} - function getIndexFromPackage(name) { return `${name}/src/index.js`; } @@ -56,68 +54,178 @@ function rename(fn) { }); } -function buildBabel(exclude) { - return merge( - sources.map(source => { - const base = path.join(__dirname, source); - - let stream = gulp.src(getGlobFromSource(source), { base: base }); - - if (exclude) { - const filters = exclude.map(p => `!**/${p}/**`); - filters.unshift("**"); - stream = stream.pipe(filter(filters)); - } - - return stream - .pipe(errorsLogger()) - .pipe(newer({ dest: base, map: swapSrcWithLib })) - .pipe(compilationLogger()) - .pipe(babel()) - .pipe( - // Passing 'file.relative' because newer() above uses a relative - // path and this keeps it consistent. - rename(file => path.resolve(file.base, swapSrcWithLib(file.relative))) - ) - .pipe(gulp.dest(base)); - }) - ); +function buildBabel(exclude, sourcesGlob = defaultSourcesGlob) { + const base = __dirname; + + let stream = gulp.src(sourcesGlob, { base: __dirname }); + + if (exclude) { + const filters = exclude.map(p => `!**/${p.src}/**`); + filters.unshift("**"); + stream = stream.pipe(filter(filters)); + } + + return stream + .pipe(errorsLogger()) + .pipe(newer({ dest: base, map: swapSrcWithLib })) + .pipe(compilationLogger()) + .pipe(babel()) + .pipe( + // Passing 'file.relative' because newer() above uses a relative + // path and this keeps it consistent. + rename(file => path.resolve(file.base, swapSrcWithLib(file.relative))) + ) + .pipe(gulp.dest(base)); } +let babelVersion = require("./packages/babel-core/package.json").version; function buildRollup(packages) { + const sourcemap = process.env.NODE_ENV === "production"; + const minify = !!process.env.IS_PUBLISH; return Promise.all( - packages.map(pkg => { - const input = getIndexFromPackage(pkg); - fancyLog(`Compiling '${chalk.cyan(input)}' with rollup ...`); - return rollup - .rollup({ - input, - plugins: [ - rollupReplace({ - "process.env.NODE_ENV": JSON.stringify(process.env.NODE_ENV), - }), - rollupBabel({ - envName: "babel-parser", - }), - rollupNodeResolve(), - ], - }) - .then(bundle => { - return bundle.write({ - file: path.join(pkg, "lib/index.js"), - format: "cjs", - name: "babel-parser", - sourcemap: process.env.NODE_ENV !== "production", + packages.map( + ({ src, format, dest, name, filename, version = babelVersion }) => { + const extraPlugins = []; + let nodeResolveBrowser = false, + babelEnvName = "rollup"; + switch (src) { + case "packages/babel-standalone": + nodeResolveBrowser = true; + babelEnvName = "standalone"; + if (minify) { + extraPlugins.push( + rollupTerser({ + include: /^.+\.min\.js$/, + }) + ); + } + break; + } + // If this build is part of a pull request, include the pull request number in + // the version number. + if (process.env.CIRCLE_PR_NUMBER) { + const prVersion = "+pr." + process.env.CIRCLE_PR_NUMBER; + babelVersion += prVersion; + version += prVersion; + } + const input = getIndexFromPackage(src); + fancyLog(`Compiling '${chalk.cyan(input)}' with rollup ...`); + return rollup + .rollup({ + input, + plugins: [ + ...extraPlugins, + rollupBabelSource(), + rollupReplace({ + "process.env.NODE_ENV": JSON.stringify(process.env.NODE_ENV), + BABEL_VERSION: JSON.stringify(babelVersion), + VERSION: JSON.stringify(version), + }), + rollupBabel({ + envName: babelEnvName, + babelrc: false, + extends: "./babel.config.js", + }), + rollupNodeResolve({ + browser: nodeResolveBrowser, + preferBuiltins: true, + //todo: When Yarn workspaces is enabled, remove `dedupe` option + dedupe(importee) { + return ( + importee.startsWith("lodash/") || + [ + "babel-plugin-dynamic-import-node/utils", + "esutils", + "semver", + "source-map", + ].includes(importee) + ); + }, + }), + rollupCommonJs({ + include: [ + /node_modules/, + "packages/babel-runtime/regenerator/**", + "packages/babel-preset-env/data/*.js", + // Rollup doesn't read export maps, so it loads the cjs fallback + "packages/babel-compat-data/*.js", + ], + namedExports: { + "babel-plugin-dynamic-import-node/utils.js": [ + "createDynamicImportTransform", + "getImportSource", + ], + "@babel/standalone": ["availablePlugins", "registerPlugin"], + }, + }), + rollupJson(), + rollupNodeBuiltins(), + rollupNodeGlobals({ sourceMap: sourcemap }), + ], + }) + .then(bundle => { + const outputFile = path.resolve(src, dest, filename || "index.js"); + return bundle + .write({ + file: outputFile, + format, + name, + sourcemap: sourcemap, + }) + .then(() => { + if (!process.env.IS_PUBLISH) { + fancyLog( + chalk.yellow( + `Skipped minification of '${chalk.cyan( + path.relative(path.join(__dirname, ".."), outputFile) + )}' because not publishing` + ) + ); + return undefined; + } + fancyLog( + `Minifying '${chalk.cyan( + path.relative(path.join(__dirname, ".."), outputFile) + )}'...` + ); + + return bundle.write({ + file: outputFile.replace(/\.js$/, ".min.js"), + format, + name, + sourcemap: sourcemap, + }); + }); }); - }); - }) + } + ) ); } -const bundles = ["packages/babel-parser"]; +const libBundles = [ + { + src: "packages/babel-parser", + format: "cjs", + dest: "lib", + version: require("./packages/babel-parser/package").version, + }, +]; + +const standaloneBundle = [ + { + src: "packages/babel-standalone", + format: "umd", + name: "Babel", + filename: "babel.js", + dest: "", + version: require("./packages/babel-core/package").version, + }, +]; + +gulp.task("build-rollup", () => buildRollup(libBundles)); +gulp.task("build-babel-standalone", () => buildRollup(standaloneBundle)); -gulp.task("build-rollup", () => buildRollup(bundles)); -gulp.task("build-babel", () => buildBabel(/* exclude */ bundles)); +gulp.task("build-babel", () => buildBabel(/* exclude */ libBundles)); gulp.task("build", gulp.parallel("build-rollup", "build-babel")); gulp.task("default", gulp.series("build")); @@ -127,48 +235,6 @@ gulp.task("build-no-bundle", () => buildBabel()); gulp.task( "watch", gulp.series("build-no-bundle", function watch() { - gulpWatch( - sources.map(getGlobFromSource), - { debounceDelay: 200 }, - gulp.task("build-no-bundle") - ); + gulp.watch(defaultSourcesGlob, gulp.task("build-no-bundle")); }) ); - -registerStandalonePackageTask( - gulp, - "babel", - "Babel", - path.join(__dirname, "packages"), - require("./packages/babel-standalone/package.json").version -); - -const presetEnvWebpackPlugins = [ - new webpack.NormalModuleReplacementPlugin( - /\.\/available-plugins/, - require.resolve( - path.join( - __dirname, - "./packages/babel-preset-env-standalone/src/available-plugins" - ) - ) - ), - new webpack.NormalModuleReplacementPlugin( - /caniuse-lite\/data\/regions\/.+/, - require.resolve( - path.join( - __dirname, - "./packages/babel-preset-env-standalone/src/caniuse-lite-regions" - ) - ) - ), -]; - -registerStandalonePackageTask( - gulp, - "babel-preset-env", - "babelPresetEnv", - path.join(__dirname, "packages"), - require("./packages/babel-preset-env-standalone/package.json").version, - presetEnvWebpackPlugins -); diff --git a/Makefile b/Makefile index 5fa5cb0cfdbf..69c97e5eff66 100644 --- a/Makefile +++ b/Makefile @@ -1,67 +1,133 @@ -MAKEFLAGS = -j1 -FLOW_COMMIT = 09669846b7a7ca5a6c23c12d56bb3bebdafd67e9 -TEST262_COMMIT = de567d3aa5de4eaa11e00131d26b9fe77997dfb0 +FLOW_COMMIT = a1f9a4c709dcebb27a5084acf47755fbae699c25 +TEST262_COMMIT = 28b4fcca4b1b1d278dfe0cc0e69c7d9d59b31aab +TYPESCRIPT_COMMIT = 5fc917be2e4dd64c8e9504d36615cd7fbfdd4cd3 + +FORCE_PUBLISH = "@babel/runtime,@babel/runtime-corejs2,@babel/runtime-corejs3,@babel/standalone" # Fix color output until TravisCI fixes https://github.com/travis-ci/travis-ci/issues/7967 export FORCE_COLOR = true -SOURCES = packages codemods +SOURCES = packages codemods eslint + +COMMA := , +EMPTY := +SPACE := $(EMPTY) $(EMPTY) +COMMA_SEPARATED_SOURCES = $(subst $(SPACE),$(COMMA),$(SOURCES)) + +YARN := yarn --silent +NODE := $(YARN) node + .PHONY: build build-dist watch lint fix clean test-clean test-only test test-ci publish bootstrap -build: clean clean-lib - ./node_modules/.bin/gulp build - node ./packages/babel-standalone/scripts/generate.js - node ./packages/babel-types/scripts/generateTypeHelpers.js - # call build again as the generated files might need to be compiled again. - ./node_modules/.bin/gulp build - # generate flow and typescript typings - node packages/babel-types/scripts/generators/flow.js > ./packages/babel-types/lib/index.js.flow - node packages/babel-types/scripts/generators/typescript.js > ./packages/babel-types/lib/index.d.ts +build: build-bundle ifneq ("$(BABEL_COVERAGE)", "true") - make build-standalone - make build-preset-env-standalone + $(MAKE) build-standalone endif -build-standalone: - ./node_modules/.bin/gulp build-babel-standalone +build-bundle: clean clean-lib + $(YARN) gulp build + $(MAKE) generate-standalone generate-type-helpers + # call build again as the generated files might need to be compiled again. + $(YARN) gulp build + $(MAKE) build-typings + $(MAKE) build-dist + +build-bundle-ci: bootstrap-only + $(MAKE) build-bundle + +generate-standalone: + $(NODE) packages/babel-standalone/scripts/generate.js + +generate-type-helpers: + $(NODE) packages/babel-types/scripts/generateTypeHelpers.js + +build-typings: build-flow-typings build-typescript-typings + +build-flow-typings: + $(NODE) packages/babel-types/scripts/generators/flow.js > packages/babel-types/lib/index.js.flow + +build-typescript-typings: + $(NODE) packages/babel-types/scripts/generators/typescript.js > packages/babel-types/lib/index.d.ts + +build-standalone: build-babel-standalone + +build-standalone-ci: build-bundle-ci + $(MAKE) build-standalone -build-preset-env-standalone: - ./node_modules/.bin/gulp build-babel-preset-env-standalone +build-babel-standalone: + $(YARN) gulp build-babel-standalone prepublish-build-standalone: - BABEL_ENV=production IS_PUBLISH=true ./node_modules/.bin/gulp build-babel-standalone + BABEL_ENV=production IS_PUBLISH=true $(YARN) gulp build-babel-standalone -prepublish-build-preset-env-standalone: - BABEL_ENV=production IS_PUBLISH=true ./node_modules/.bin/gulp build-babel-preset-env-standalone +build-dist: build-polyfill-dist build-plugin-transform-runtime-dist -build-dist: build +build-polyfill-dist: cd packages/babel-polyfill; \ scripts/build-dist.sh - cd packages/babel-plugin-transform-runtime; \ - node scripts/build-dist.js -watch: clean clean-lib +build-plugin-transform-runtime-dist: + cd packages/babel-plugin-transform-runtime; \ + $(NODE) scripts/build-dist.js +build-no-bundle: clean clean-lib + BABEL_ENV=development $(YARN) gulp build-no-bundle # Ensure that build artifacts for types are created during local # development too. - BABEL_ENV=development ./node_modules/.bin/gulp build-no-bundle - node ./packages/babel-types/scripts/generateTypeHelpers.js - node packages/babel-types/scripts/generators/flow.js > ./packages/babel-types/lib/index.js.flow - node packages/babel-types/scripts/generators/typescript.js > ./packages/babel-types/lib/index.d.ts - BABEL_ENV=development ./node_modules/.bin/gulp watch + $(MAKE) generate-type-helpers + $(MAKE) build-typings + +build-no-bundle-ci: bootstrap-only + $(MAKE) build-no-bundle + +watch: build-no-bundle + BABEL_ENV=development $(YARN) gulp watch + +code-quality-ci: flowcheck-ci lint-ci + +flowcheck-ci: bootstrap-flowcheck + $(MAKE) flow + +code-quality: flow lint flow: - ./node_modules/.bin/flow check --strip-root + $(YARN) flow check --strip-root + +bootstrap-flowcheck: build-no-bundle-ci + +lint-ci: lint-js-ci lint-ts-ci check-compat-data-ci + +lint-js-ci: bootstrap-only + $(MAKE) lint-js + +lint-ts-ci: bootstrap-flowcheck + $(MAKE) lint-ts + +check-compat-data-ci: build-no-bundle-ci + $(MAKE) check-compat-data + +lint: lint-js lint-ts -lint: - ./node_modules/.bin/eslint scripts $(SOURCES) '*.js' --format=codeframe +lint-js: + BABEL_ENV=test $(YARN) eslint scripts $(SOURCES) '*.js' --format=codeframe -fix: fix-json - ./node_modules/.bin/eslint scripts $(SOURCES) '*.js' --format=codeframe --fix +lint-ts: + scripts/lint-ts-typings.sh + +fix: fix-json fix-js + +fix-js: + $(YARN) eslint scripts $(SOURCES) '*.js' --format=codeframe --fix fix-json: - ./node_modules/.bin/prettier "{packages,codemod}/*/test/fixtures/**/options.json" --write --loglevel warn + $(YARN) prettier "{$(COMMA_SEPARATED_SOURCES)}/*/test/fixtures/**/options.json" --write --loglevel warn + +check-compat-data: + cd packages/babel-compat-data; CHECK_COMPAT_DATA=true $(YARN) run build-data + +build-compat-data: + cd packages/babel-compat-data; $(YARN) run build-data clean: test-clean rm -f .npmrc @@ -74,72 +140,92 @@ test-clean: $(foreach source, $(SOURCES), \ $(call clean-source-test, $(source))) +# Does not work on Windows; use "$(YARN) jest" instead test-only: BABEL_ENV=test ./scripts/test.sh - make test-clean + $(MAKE) test-clean test: lint test-only -test-ci: bootstrap test-only +test-ci: jest-ci +jest-ci: build-standalone-ci + BABEL_ENV=test $(YARN) jest --maxWorkers=4 --ci + $(MAKE) test-clean + +# Does not work on Windows test-ci-coverage: SHELL:=/bin/bash test-ci-coverage: - BABEL_COVERAGE=true BABEL_ENV=test make bootstrap + BABEL_COVERAGE=true BABEL_ENV=test $(MAKE) bootstrap BABEL_ENV=test TEST_TYPE=cov ./scripts/test-cov.sh bash <(curl -s https://codecov.io/bash) -f coverage/coverage-final.json bootstrap-flow: - rm -rf ./build/flow - mkdir -p ./build - git clone --branch=master --single-branch --shallow-since=2018-11-01 https://github.com/facebook/flow.git ./build/flow + rm -rf build/flow + mkdir -p build + git clone --branch=master --single-branch --shallow-since=2018-11-01 https://github.com/facebook/flow.git build/flow cd build/flow && git checkout $(FLOW_COMMIT) test-flow: - node scripts/tests/flow/run_babel_parser_flow_tests.js + $(NODE) scripts/parser-tests/flow -test-flow-ci: bootstrap test-flow +test-flow-ci: build-bundle-ci bootstrap-flow + $(MAKE) test-flow test-flow-update-whitelist: - node scripts/tests/flow/run_babel_parser_flow_tests.js --update-whitelist + $(NODE) scripts/parser-tests/flow --update-whitelist -bootstrap-test262: - rm -rf ./build/test262 +bootstrap-typescript: + rm -rf ./build/typescript mkdir -p ./build - git clone --branch=master --single-branch --shallow-since=2019-01-01 https://github.com/tc39/test262.git ./build/test262 + git clone --branch=master --single-branch --shallow-since=2019-09-01 https://github.com/microsoft/TypeScript.git ./build/typescript + cd build/typescript && git checkout $(TYPESCRIPT_COMMIT) + +test-typescript: + $(NODE) scripts/parser-tests/typescript + +test-typescript-ci: build-bundle-ci bootstrap-typescript + $(MAKE) test-typescript + +test-typescript-update-whitelist: + $(NODE) scripts/parser-tests/typescript --update-whitelist + +bootstrap-test262: + rm -rf build/test262 + mkdir -p build + git clone --branch=master --single-branch --shallow-since=2019-12-01 https://github.com/tc39/test262.git build/test262 cd build/test262 && git checkout $(TEST262_COMMIT) test-test262: - node scripts/tests/test262/run_babel_parser_test262.js + $(NODE) scripts/parser-tests/test262 -test-test262-ci: bootstrap test-test262 +test-test262-ci: build-bundle-ci bootstrap-test262 + $(MAKE) test-test262 test-test262-update-whitelist: - node scripts/tests/test262/run_babel_parser_test262.js --update-whitelist + $(NODE) scripts/parser-tests/test262 --update-whitelist +# Does not work on Windows clone-license: ./scripts/clone-license.sh -prepublish-build: - make clean-lib - rm -rf packages/babel-runtime/helpers - rm -rf packages/babel-runtime-corejs2/helpers - rm -rf packages/babel-runtime-corejs2/core-js - NODE_ENV=production BABEL_ENV=production make build-dist - make clone-license +prepublish-build: clean-lib clean-runtime-helpers + NODE_ENV=production BABEL_ENV=production $(MAKE) build + $(MAKE) clone-license prepublish: - make bootstrap-only - make prepublish-build - make test + $(MAKE) bootstrap-only + $(MAKE) prepublish-build + IS_PUBLISH=true $(MAKE) test new-version: git pull --rebase - ./node_modules/.bin/lerna version --force-publish="@babel/runtime,@babel/runtime-corejs2,@babel/runtime-corejs3,@babel/standalone,@babel/preset-env-standalone" + $(YARN) lerna version --force-publish=$(FORCE_PUBLISH) # NOTE: Run make new-version first publish: prepublish - ./node_modules/.bin/lerna publish from-git --require-scripts - make clean + $(YARN) lerna publish from-git + $(MAKE) clean publish-ci: prepublish ifneq ("$(NPM_TOKEN)", "") @@ -148,23 +234,47 @@ else echo "Missing NPM_TOKEN env var" exit 1 endif - ./node_modules/.bin/lerna publish from-git --require-scripts --yes + $(YARN) lerna publish from-git --yes rm -f .npmrc - make clean + $(MAKE) clean -bootstrap-only: clean-all +publish-test: +ifneq ("$(I_AM_USING_VERDACCIO)", "I_AM_SURE") + echo "You probably don't know what you are doing" + exit 1 +endif + $(MAKE) prepublish-build + $(YARN) lerna version $(VERSION) --force-publish=$(FORCE_PUBLISH) --no-push --yes --tag-version-prefix="version-e2e-test-" + $(YARN) lerna publish from-git --registry http://localhost:4873 --yes --tag-version-prefix="version-e2e-test-" + $(MAKE) clean + +publish-eslint: + $(call set-json-field, ./eslint/$(PKG)/package.json, private, false) + cd eslint/$(PKG); yarn publish + $(call set-json-field, ./eslint/$(PKG)/package.json, private, true) + +bootstrap-only: lerna-bootstrap + +yarn-install: clean-all yarn --ignore-engines - ./node_modules/.bin/lerna bootstrap -- --ignore-engines + +lerna-bootstrap: yarn-install +# todo: remove `-- -- --ignore-engines` in Babel 8 + $(YARN) lerna bootstrap -- -- --ignore-engines bootstrap: bootstrap-only - make build - cd packages/babel-plugin-transform-runtime; \ - node scripts/build-dist.js + $(MAKE) build clean-lib: $(foreach source, $(SOURCES), \ $(call clean-source-lib, $(source))) +clean-runtime-helpers: + rm -f packages/babel-runtime/helpers/**/*.js + rm -f packages/babel-runtime-corejs2/helpers/**/*.js + rm -f packages/babel-runtime-corejs3/helpers/**/*.js + rm -rf packages/babel-runtime-corejs2/core-js + clean-all: rm -rf node_modules rm -rf package-lock.json @@ -173,7 +283,13 @@ clean-all: $(foreach source, $(SOURCES), \ $(call clean-source-all, $(source))) - make clean + $(MAKE) clean + +update-env-corejs-fixture: + rm -rf packages/babel-preset-env/node_modules/core-js-compat + $(YARN) lerna bootstrap + $(MAKE) build-bundle + OVERWRITE=true $(YARN) jest packages/babel-preset-env define clean-source-lib rm -rf $(1)/*/lib @@ -187,8 +303,15 @@ define clean-source-test endef define clean-source-all - rm -rf $(1)/*/lib + $(call clean-source-lib, $1) rm -rf $(1)/*/node_modules rm -rf $(1)/*/package-lock.json endef + +define set-json-field + $(NODE) -e "\ + require('fs').writeFileSync('$1'.trim(), \ + JSON.stringify({ ...require('$1'.trim()), $2: $3 }, null, 2) + '\\n' \ + )" +endef diff --git a/README.md b/README.md index 579b85a7cd88..0b17712e2e75 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ v6 npm Downloads

- Travis Status + Travis Status CircleCI Status Coverage Status Slack Status @@ -80,14 +80,14 @@ Try it out at our [REPL](https://babeljs.io/repl/build/master#?code_lz=NoRgNATGD Mostly a handful of volunteers, funded by you! Please check out our [team page](https://babeljs.io/team)! -### Looking for support? - -For questions and support please join our [Slack Community](https://slack.babeljs.io/) (you can sign-up [here](https://slack.babeljs.io/) for an invite), ask a question on [Stack Overflow](https://stackoverflow.com/questions/tagged/babeljs), or ping us on [Twitter](https://twitter.com/babeljs). - ### Is there a Babel song? I'm so glad you asked: [Hallelujah —— In Praise of Babel](SONG.md) by [@angus-c](https://github.com/angus-c), [audio version](https://youtu.be/40abpedBKK8) by [@swyx](https://twitter.com/@swyx). Tweet us your recordings! +### Looking for support? + +For questions and support please join our [Slack Community](https://slack.babeljs.io/) (you can sign-up [here](https://slack.babeljs.io/) for an invite), ask a question on [Stack Overflow](https://stackoverflow.com/questions/tagged/babeljs), or ping us on [Twitter](https://twitter.com/babeljs). + ### Where are the docs? Check out our website: [babeljs.io](https://babeljs.io/), and report issues/features at [babel/website](https://github.com/babel/website/issues). @@ -98,12 +98,19 @@ Please read through our [CONTRIBUTING.md](CONTRIBUTING.md) and fill out the issu ### Want to contribute to Babel? -Check out our [CONTRIBUTING.md](CONTRIBUTING.md) to get started with setting up the repo. +Check out: + +- Our [#development](https://babeljs.slack.com/messages/development) Slack channel and say hi ([signup](https://slack.babeljs.io))! +- Issues with the [good first issue](https://github.com/babel/babel/labels/good%20first%20issue) and [help wanted](https://github.com/babel/babel/labels/help%20wanted) label. We suggest also looking at the [closed ones](https://github.com/babel/babel/issues?utf8=%E2%9C%93&q=is%3Aclosed+label%3A%22good+first+issue%22) to get a sense of the kinds of issues you can tackle. + +Some resources: -- If you have already joined Slack, join our [#development](https://babeljs.slack.com/messages/development) channel and say hi! -- Check out the issues with the [good first issue](https://github.com/babel/babel/labels/good%20first%20issue) and [help wanted](https://github.com/babel/babel/labels/help%20wanted) label. We suggest also looking at the closed ones to get a sense of the kinds of issues you can tackle. +- Our [CONTRIBUTING.md](CONTRIBUTING.md) to get started with setting up the repo. - Our discussions/notes/roadmap: [babel/notes](https://github.com/babel/notes) - Our progress on TC39 proposals: [babel/proposals](https://github.com/babel/proposals) +- Our blog which contains release posts and explanations: [/blog](https://babeljs.io/blog) +- Our videos page with talks about open source and Babel: [/videos](https://babeljs.io/videos) +- Our [podcast](https://podcast.babeljs.io) ### How is the repo structured? diff --git a/babel.config.js b/babel.config.js index 82966a7f07ca..b66ad8e143e3 100644 --- a/babel.config.js +++ b/babel.config.js @@ -8,28 +8,48 @@ module.exports = function(api) { const envOptsNoTargets = { loose: true, modules: false, + shippedProposals: true, exclude: ["transform-typeof-symbol"], }; const envOpts = Object.assign({}, envOptsNoTargets); + const compileDynamicImport = env === "test" || env === "development"; + let convertESM = true; let ignoreLib = true; - let includeRuntime = false; + let includeRegeneratorRuntime = false; + + let transformRuntimeOptions; + const nodeVersion = "6.9"; + // The vast majority of our src files are modules, but we use + // unambiguous to keep things simple until we get around to renaming + // the modules to be more easily distinguished from CommonJS + const unambiguousSources = [ + "packages/*/src", + "packages/*/test", + "codemods/*/src", + "codemods/*/test", + "eslint/*/src", + "eslint/*/test", + ]; switch (env) { // Configs used during bundling builds. - case "babel-parser": - convertESM = false; - ignoreLib = false; - envOpts.targets = { - node: nodeVersion, - }; - break; case "standalone": + includeRegeneratorRuntime = true; + unambiguousSources.push("packages/babel-runtime/regenerator"); + // fall through + case "rollup": convertESM = false; ignoreLib = false; - includeRuntime = true; + // rollup-commonjs will converts node_modules to ESM + unambiguousSources.push( + "**/node_modules", + "packages/babel-preset-env/data", + "packages/babel-compat-data" + ); + if (env === "rollup") envOpts.targets = { node: nodeVersion }; break; case "production": // Config during builds before publish. @@ -50,6 +70,16 @@ module.exports = function(api) { break; } + if (includeRegeneratorRuntime) { + const babelRuntimePkgPath = require.resolve("@babel/runtime/package.json"); + + transformRuntimeOptions = { + helpers: false, // Helpers are handled by rollup when needed + regenerator: true, + version: require(babelRuntimePkgPath).version, + }; + } + const config = { // Our dependencies are all standard CommonJS, along with all sorts of // other random files in Babel's codebase, so we use script as the default, @@ -63,7 +93,6 @@ module.exports = function(api) { "packages/*/test/fixtures", ignoreLib ? "packages/*/lib" : null, "packages/babel-standalone/babel.js", - "packages/babel-preset-env-standalone/babel-preset-env.js", ].filter(Boolean), presets: [["@babel/env", envOpts]], plugins: [ @@ -72,60 +101,46 @@ module.exports = function(api) { "@babel/plugin-transform-flow-strip-types", ["@babel/proposal-class-properties", { loose: true }], "@babel/proposal-export-namespace-from", - "@babel/proposal-numeric-separator", [ "@babel/proposal-object-rest-spread", { useBuiltIns: true, loose: true }, ], + compileDynamicImport ? dynamicImportUrlToPath : null, + compileDynamicImport ? "@babel/plugin-proposal-dynamic-import" : null, - // Explicitly use the lazy version of CommonJS modules. - convertESM ? ["@babel/transform-modules-commonjs", { lazy: true }] : null, + convertESM ? "@babel/transform-modules-commonjs" : null, ].filter(Boolean), overrides: [ { - test: "packages/babel-parser", + test: [ + "packages/babel-parser", + "packages/babel-helper-validator-identifier", + ], plugins: [ "babel-plugin-transform-charcodes", ["@babel/transform-for-of", { assumeArray: true }], ], }, { - test: "./packages/babel-register", + test: ["./packages/babel-cli", "./packages/babel-core"], plugins: [ - // Override the root options to disable lazy imports for babel-register - // because otherwise the require hook will try to lazy-import things - // leading to dependency cycles. - convertESM ? "@babel/transform-modules-commonjs" : null, + // Explicitly use the lazy version of CommonJS modules. + convertESM + ? ["@babel/transform-modules-commonjs", { lazy: true }] + : null, ].filter(Boolean), }, { test: "./packages/babel-polyfill", presets: [["@babel/env", envOptsNoTargets]], - plugins: [["@babel/transform-modules-commonjs", { lazy: false }]], }, { - // The vast majority of our src files are modules, but we use - // unambiguous to keep things simple until we get around to renaming - // the modules to be more easily distinguished from CommonJS - test: [ - "packages/*/src", - "packages/*/test", - "codemods/*/src", - "codemods/*/test", - ], + test: unambiguousSources, sourceType: "unambiguous", }, - { - // The runtime transform shouldn't process its own runtime or core-js. - exclude: [ - "packages/babel-runtime", - /[\\/]node_modules[\\/](?:@babel\/runtime|babel-runtime|core-js)[\\/]/, - ], - plugins: [ - includeRuntime - ? ["@babel/transform-runtime", { version: "7.4.4" }] - : null, - ].filter(Boolean), + includeRegeneratorRuntime && { + exclude: /regenerator-runtime/, + plugins: [["@babel/transform-runtime", transformRuntimeOptions]], }, ].filter(Boolean), }; @@ -138,3 +153,45 @@ module.exports = function(api) { return config; }; + +// !!! WARNING !!! Hacks are coming + +// import() uses file:// URLs for absolute imports, while require() uses +// file paths. +// Since this isn't handled by @babel/plugin-transform-modules-commonjs, +// we must handle it here. +// However, fileURLToPath is only supported starting from Node.js 10. +// In older versions, we can remove the pathToFileURL call so that it keeps +// the original absolute path. +// NOTE: This plugin must run before @babel/plugin-transform-modules-commonjs, +// and assumes that the target is the current node version. +function dynamicImportUrlToPath({ template }) { + const currentNodeSupportsURL = !!require("url").pathToFileURL; + + if (currentNodeSupportsURL) { + return { + visitor: { + CallExpression(path) { + if (path.get("callee").isImport()) { + path.get("arguments.0").replaceWith( + template.expression.ast` + require("url").fileURLToPath(${path.node.arguments[0]}) + ` + ); + } + }, + }, + }; + } else { + // TODO: Remove in Babel 8 (it's not needed when using Node 10) + return { + visitor: { + CallExpression(path) { + if (path.get("callee").isIdentifier({ name: "pathToFileURL" })) { + path.replaceWith(path.get("arguments.0")); + } + }, + }, + }; + } +} diff --git a/codecov.yml b/codecov.yml index ed4545a1bf7d..17d3dfb026d0 100644 --- a/codecov.yml +++ b/codecov.yml @@ -5,7 +5,7 @@ coverage: status: project: default: - target: "80%" + target: "90%" patch: enabled: false ignore: diff --git a/codemods/babel-plugin-codemod-object-assign-to-object-spread/package.json b/codemods/babel-plugin-codemod-object-assign-to-object-spread/package.json index 747fa0fe68e7..e432a89a4486 100644 --- a/codemods/babel-plugin-codemod-object-assign-to-object-spread/package.json +++ b/codemods/babel-plugin-codemod-object-assign-to-object-spread/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-codemod-object-assign-to-object-spread", - "version": "7.0.0", + "version": "7.7.4", "description": "Transforms Object.assign into object spread syntax", "repository": "https://github.com/babel/babel/tree/master/codemods/babel-plugin-codemod-object-assign-to-object-spread", "license": "MIT", @@ -13,16 +13,13 @@ "@babel/plugin" ], "dependencies": { - "@babel/plugin-syntax-object-rest-spread": "^7.0.0" + "@babel/plugin-syntax-object-rest-spread": "^7.7.4" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.0.0", - "@babel/helper-plugin-test-runner": "^7.0.0" - }, - "publishConfig": { - "access": "public" + "@babel/core": "^7.7.4", + "@babel/helper-plugin-test-runner": "^7.7.4" } } diff --git a/codemods/babel-plugin-codemod-optional-catch-binding/package.json b/codemods/babel-plugin-codemod-optional-catch-binding/package.json index 45913353021c..68196e27c1ba 100644 --- a/codemods/babel-plugin-codemod-optional-catch-binding/package.json +++ b/codemods/babel-plugin-codemod-optional-catch-binding/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-codemod-optional-catch-binding", - "version": "7.0.0", + "version": "7.7.4", "description": "Remove unused catch bindings", "repository": "https://github.com/babel/babel/tree/master/codemods/babel-plugin-codemod-remove-unused-catch-binding", "license": "MIT", @@ -13,13 +13,13 @@ "@babel/plugin" ], "dependencies": { - "@babel/plugin-syntax-optional-catch-binding": "^7.0.0" + "@babel/plugin-syntax-optional-catch-binding": "^7.7.4" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.0.0", - "@babel/helper-plugin-test-runner": "^7.0.0" + "@babel/core": "^7.7.4", + "@babel/helper-plugin-test-runner": "^7.7.4" } } diff --git a/codemods/babel-plugin-codemod-optional-catch-binding/test/fixtures/codemod-optional-catch-binding/try-catch-finally-used-binding/options.json b/codemods/babel-plugin-codemod-optional-catch-binding/test/fixtures/codemod-optional-catch-binding/try-catch-finally-used-binding/options.json index 0587911559c4..cbe0e9893752 100644 --- a/codemods/babel-plugin-codemod-optional-catch-binding/test/fixtures/codemod-optional-catch-binding/try-catch-finally-used-binding/options.json +++ b/codemods/babel-plugin-codemod-optional-catch-binding/test/fixtures/codemod-optional-catch-binding/try-catch-finally-used-binding/options.json @@ -1,3 +1,3 @@ { - "plugins": ["../../../../lib"] - } + "plugins": ["../../../../lib"] +} diff --git a/doc/design/monorepo.md b/doc/design/monorepo.md index d10cc9741b76..0460dcd82b73 100644 --- a/doc/design/monorepo.md +++ b/doc/design/monorepo.md @@ -15,7 +15,7 @@ This is quite taboo but let's look at the pros and cons: * Easy to coordinate changes across modules. * Single place to report issues. * Easier to setup a development environment. - * Tests across modules are run together which finds bugs that touch multiple modules easier. + * Tests across modules are run together which finds bugs that touch multiple modules more easily. **Cons:** diff --git a/eslint/babel-eslint-config-internal/.npmignore b/eslint/babel-eslint-config-internal/.npmignore new file mode 100644 index 000000000000..ad69326ce8c2 --- /dev/null +++ b/eslint/babel-eslint-config-internal/.npmignore @@ -0,0 +1,4 @@ +src +test +.* +*.log diff --git a/eslint/babel-eslint-config-internal/README.md b/eslint/babel-eslint-config-internal/README.md new file mode 100644 index 000000000000..20d79ebc44bb --- /dev/null +++ b/eslint/babel-eslint-config-internal/README.md @@ -0,0 +1,4 @@ +## @babel/eslint-config-internal +--- + +ESLint config for the Babel codebase (originally taken from `eslint-config-kittens`) diff --git a/eslint/babel-eslint-config-internal/index.js b/eslint/babel-eslint-config-internal/index.js new file mode 100644 index 000000000000..6bf24402795c --- /dev/null +++ b/eslint/babel-eslint-config-internal/index.js @@ -0,0 +1,33 @@ +"use strict"; + +module.exports = { + parser: "babel-eslint", + extends: "eslint:recommended", + plugins: ["flowtype"], + parserOptions: { + ecmaVersion: 2020, + sourceType: "module", + }, + globals: { + // Flow + Iterator: true, + $Keys: true, + }, + env: { + node: true, + es2020: true, + browser: true, + }, + rules: { + curly: ["error", "multi-line"], + "linebreak-style": ["error", "unix"], + "no-case-declarations": "error", + "no-confusing-arrow": "error", + "no-empty": ["error", { allowEmptyCatch: true }], + "no-process-exit": "error", + "no-var": "error", + "prefer-const": "error", + "flowtype/define-flow-type": "warn", + "flowtype/use-flow-type": "warn", + }, +}; diff --git a/eslint/babel-eslint-config-internal/package.json b/eslint/babel-eslint-config-internal/package.json new file mode 100644 index 000000000000..93324f718152 --- /dev/null +++ b/eslint/babel-eslint-config-internal/package.json @@ -0,0 +1,15 @@ +{ + "name": "@babel/eslint-config-internal", + "version": "0.0.0", + "description": "The Babel Team's ESLint configuration. Since it's internal, it might not respect semver.", + "author": "Sebastian McKenzie ", + "homepage": "https://babeljs.io/", + "license": "MIT", + "private": true, + "repository": "https://github.com/babel/babel/tree/master/eslint/babel-eslint-config-internal", + "main": "index.js", + "peerDependencies": { + "babel-eslint": "^10.0.0 || ^11.0.0-0", + "eslint-plugin-flowtype": "^3.0.0" + } +} diff --git a/eslint/babel-eslint-parser/.npmignore b/eslint/babel-eslint-parser/.npmignore new file mode 100644 index 000000000000..c3aafe7a7721 --- /dev/null +++ b/eslint/babel-eslint-parser/.npmignore @@ -0,0 +1,4 @@ +src +test +.* +*.log \ No newline at end of file diff --git a/eslint/babel-eslint-parser/README.md b/eslint/babel-eslint-parser/README.md new file mode 100644 index 000000000000..d9ebe61f3f64 --- /dev/null +++ b/eslint/babel-eslint-parser/README.md @@ -0,0 +1,127 @@ +# @babel/eslint-parser [![npm](https://img.shields.io/npm/v/@babel/eslint-parser.svg)](https://www.npmjs.com/package/@babel/eslint-parser) [![travis](https://img.shields.io/travis/babel/@babel/eslint-parser/master.svg)](https://travis-ci.org/babel/@babel/eslint-parser) [![npm-downloads](https://img.shields.io/npm/dm/@babel/eslint-parser.svg)](https://www.npmjs.com/package/@babel/eslint-parser) + + +## This project is still experimental and will be released with Babel v8. You can track our progress [here](https://github.com/babel/babel/issues/10752)! Please use [babel-eslint](https://github.com/babel/babel-eslint) in the meantime. + +**@babel/eslint-parser** allows you to lint **ALL** valid Babel code with the fantastic +[ESLint](https://github.com/eslint/eslint). + +## When should I use @babel/eslint-parser? + +ESLint's default parser and core rules [only support the latest final ECMAScript standard](https://github.com/eslint/eslint/blob/a675c89573836adaf108a932696b061946abf1e6/README.md#what-about-experimental-features) and do not support experimental (such as new features) and non-standard (such as Flow or TypeScript types) syntax provided by Babel. @babel/eslint-parser is a parser that allows ESLint to run on source code that is transformed by Babel. + +**Note:** You only need to use @babel/parser-eslint if you are using Babel to transform your code. If this is not the case, please use the relevant parser for your chosen flavor of ECMAScript (note that the default parser supports all non-experimental syntax as well as JSX). + +## How does it work? + +ESLint allows for the use of [custom parsers](https://eslint.org/docs/developer-guide/working-with-custom-parsers). When using this plugin, your code is parsed by Babel's parser (using the configuration specified in your [Babel configuration file](https://babeljs.io/docs/en/configuration)) and the resulting AST is +transformed into an [ESTree](https://github.com/estree/estree)-compliant structure that ESLint can understand. All location info such as line numbers, +columns is also retained so you can track down errors with ease. + +**Note:** ESLint's core rules do not support experimental syntax and may therefore not work as expected when using `@babel/eslint-parser`. Please use the companion [`@babel/eslint-plugin`](https://github.com/babel/babel/tree/master/eslint/babel-eslint-plugin) plugin for core rules that you have issues with. + +## Usage + +### Installation + +```sh +$ npm install eslint @babel/core @babel/eslint-parser --save-dev +# or +$ yarn add eslint @babel/core @babel/eslint-parser -D +``` + +**Note:** @babel/eslint-parser requires `@babel/core@>=7.2.0` and a valid Babel configuration file to run. If you do not have this already set up, please see the [Babel Usage Guide](https://babeljs.io/docs/en/usage). + +### Setup + +To use @babel/eslint-parser, `"@babel/eslint-parser"` must be specified as the `parser` in your ESLint configuration file (see [here](https://eslint.org/docs/user-guide/configuring#specifying-parser) for more detailed information). + +**.eslintrc.js** + +```js +module.exports = { + parser: "@babel/eslint-parser", +}; +``` + +With the parser set, your configuration can be configured as described in the [Configuring ESLint](https://eslint.org/docs/user-guide/configuring) documentation. + +**Note:** The `parserOptions` described in the [official documentation](https://eslint.org/docs/user-guide/configuring#specifying-parser-options) are for the default parser and are not necessarily supported by @babel/eslint-parser. Please see the section directly below for supported `parserOptions`. + +### Additional parser configuration + +Additional configuration options can be set in your ESLint configuration under the `parserOptions` key. Please note that the `ecmaFeatures` config property may still be required for ESLint to work properly with features not in ECMAScript 5 by default. + +- `requireConfigFile` (default `true`) can be set to `false` to allow @babel/eslint-parser to run on files that do not have a Babel configuration associated with them. This can be useful for linting files that are not transformed by Babel (such as tooling configuration files), though we recommend using the default parser via [glob-based configuration](https://eslint.org/docs/user-guide/configuring#configuration-based-on-glob-patterns). Note: @babel/eslint-parser will not parse any experimental syntax when no configuration file is found. +- `sourceType` can be set to `"module"`(default) or `"script"` if your code isn't using ECMAScript modules. +- `allowImportExportEverywhere` (default `false`) can be set to `true` to allow import and export declarations to appear anywhere a statement is allowed if your build environment supports that. Otherwise import and export declarations can only appear at a program's top level. +- `ecmaFeatures.globalReturn` (default `false`) allow return statements in the global scope when used with `sourceType: "script"`. +- `babelOptions` passes through Babel's configuration [loading](https://babeljs.io/docs/en/options#config-loading-options) and [merging](https://babeljs.io/docs/en/options#config-merging-options) options (for instance, in case of a monorepo). When not defined, @babel/eslint-parser will use Babel's default configuration file resolution logic. + +**.eslintrc.js** + +```js +module.exports = { + parser: "@babel/eslint-parser", + parserOptions: { + sourceType: "module", + allowImportExportEverywhere: false, + ecmaFeatures: { + globalReturn: false, + }, + babelOptions: { + configFile: "path/to/config.js", + }, + }, +}; +``` + +**.eslintrc.js using glob-based configuration** + +This configuration would use the default parser for all files except for those found by the `"files/transformed/by/babel/*.js"` glob. + +```js +module.exports = { + rules: { + indent: "error" + }, + overrides: [ + { + files: ["files/transformed/by/babel/*.js"], + parser: "@babel/eslint-parser", + } + ] +}; +``` + +### Run + +```sh +$ ./node_modules/.bin/eslint yourfile.js +``` + +## Known issues + +Flow: + +> Check out [eslint-plugin-flowtype](https://github.com/gajus/eslint-plugin-flowtype): An `eslint` plugin that makes flow type annotations global variables and marks declarations as used. Solves the problem of false positives with `no-undef` and `no-unused-vars`. + +- `no-undef` for global flow types: `ReactElement`, `ReactClass` [#130](https://github.com/babel/@babel/eslint-parser/issues/130#issuecomment-111215076) + - Workaround: define types as globals in `.eslintrc` or define types and import them `import type ReactElement from './types'` +- `no-unused-vars/no-undef` with Flow declarations (`declare module A {}`) [#132](https://github.com/babel/@babel/eslint-parser/issues/132#issuecomment-112815926) + +Modules/strict mode + +- `no-unused-vars: ["error", { vars: local }]` [#136](https://github.com/babel/@babel/eslint-parser/issues/136) + +Please check out [eslint-plugin-react](https://github.com/yannickcr/eslint-plugin-react) for React/JSX issues. + +- `no-unused-vars` with jsx + +Please check out [eslint-plugin-babel](https://github.com/babel/eslint-plugin-babel) for other issues. + +## Questions and support + +If you have an issue, please first check if it can be reproduced with the default parser and with the latest versions of `eslint` and `@babel/eslint-parser`. If it is not reproducible with the default parser, it is most likely an issue with `@babel/eslint-parser`. + +For questions and support please visit the [`#discussion`](https://babeljs.slack.com/messages/discussion/) Babel Slack channel (sign up [here](https://github.com/babel/notes/issues/38)) or the ESLint [Gitter](https://gitter.im/eslint/eslint). diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json new file mode 100644 index 000000000000..36218eb13c84 --- /dev/null +++ b/eslint/babel-eslint-parser/package.json @@ -0,0 +1,37 @@ +{ + "name": "@babel/eslint-parser", + "version": "0.0.0", + "description": "ESLint parser that allows for linting of experimental syntax transformed by Babel", + "author": "Sebastian McKenzie ", + "license": "MIT", + "private": true, + "repository": { + "type": "git", + "url": "https://github.com/babel/babel.git", + "directory": "eslint/babel-eslint-parser" + }, + "bugs": { + "url": "https://github.com/babel/babel/issues" + }, + "homepage": "https://github.com/babel/babel/tree/master/eslint/babel-eslint-parser", + "engines": { + "node": ">=10.9" + }, + "main": "lib/index.js", + "peerDependencies": { + "@babel/core": ">=7.2.0", + "eslint": ">=6.0.0" + }, + "dependencies": { + "eslint-scope": "5.0.0", + "eslint-visitor-keys": "^1.1.0", + "semver": "^6.3.0" + }, + "devDependencies": { + "@babel/core": "^7.2.0", + "@babel/eslint-shared-fixtures": "*", + "dedent": "^0.7.0", + "eslint": "^6.0.1", + "lodash.clonedeep": "^4.5.0" + } +} diff --git a/eslint/babel-eslint-parser/src/analyze-scope.js b/eslint/babel-eslint-parser/src/analyze-scope.js new file mode 100644 index 000000000000..2a520438546b --- /dev/null +++ b/eslint/babel-eslint-parser/src/analyze-scope.js @@ -0,0 +1,344 @@ +import { types as t } from "@babel/core"; +import escope from "eslint-scope"; +import { Definition } from "eslint-scope/lib/definition"; +import OriginalPatternVisitor from "eslint-scope/lib/pattern-visitor"; +import OriginalReferencer from "eslint-scope/lib/referencer"; +import { getKeys as fallback } from "eslint-visitor-keys"; +import childVisitorKeys from "./visitor-keys"; + +const flowFlippedAliasKeys = t.FLIPPED_ALIAS_KEYS.Flow.concat([ + "ArrayPattern", + "ClassDeclaration", + "ClassExpression", + "FunctionDeclaration", + "FunctionExpression", + "Identifier", + "ObjectPattern", + "RestElement", +]); + +const visitorKeysMap = Object.entries(t.VISITOR_KEYS).reduce( + (acc, [key, value]) => { + if (!flowFlippedAliasKeys.includes(value)) { + acc[key] = value; + } + return acc; + }, + {}, +); + +const propertyTypes = { + // loops + callProperties: { type: "loop", values: ["value"] }, + indexers: { type: "loop", values: ["key", "value"] }, + properties: { type: "loop", values: ["argument", "value"] }, + types: { type: "loop" }, + params: { type: "loop" }, + // single property + argument: { type: "single" }, + elementType: { type: "single" }, + qualification: { type: "single" }, + rest: { type: "single" }, + returnType: { type: "single" }, + // others + typeAnnotation: { type: "typeAnnotation" }, + typeParameters: { type: "typeParameters" }, + id: { type: "id" }, +}; + +class PatternVisitor extends OriginalPatternVisitor { + ArrayPattern(node) { + node.elements.forEach(this.visit, this); + } + + ObjectPattern(node) { + node.properties.forEach(this.visit, this); + } +} + +class Referencer extends OriginalReferencer { + // inherits. + visitPattern(node, options, callback) { + if (!node) { + return; + } + + // Visit type annotations. + this._checkIdentifierOrVisit(node.typeAnnotation); + if (t.isAssignmentPattern(node)) { + this._checkIdentifierOrVisit(node.left.typeAnnotation); + } + + // Overwrite `super.visitPattern(node, options, callback)` in order to not visit `ArrayPattern#typeAnnotation` and `ObjectPattern#typeAnnotation`. + if (typeof options === "function") { + callback = options; + options = { processRightHandNodes: false }; + } + + const visitor = new PatternVisitor(this.options, node, callback); + visitor.visit(node); + + // Process the right hand nodes recursively. + if (options.processRightHandNodes) { + visitor.rightHandNodes.forEach(this.visit, this); + } + } + + // inherits. + visitClass(node) { + // Decorators. + this._visitArray(node.decorators); + + // Flow type parameters. + const typeParamScope = this._nestTypeParamScope(node); + + // Flow super types. + this._visitTypeAnnotation(node.implements); + this._visitTypeAnnotation( + node.superTypeParameters && node.superTypeParameters.params, + ); + + // Basic. + super.visitClass(node); + + // Close the type parameter scope. + if (typeParamScope) { + this.close(node); + } + } + + // inherits. + visitFunction(node) { + const typeParamScope = this._nestTypeParamScope(node); + + // Flow return types. + this._checkIdentifierOrVisit(node.returnType); + + // Basic. + super.visitFunction(node); + + // Close the type parameter scope. + if (typeParamScope) { + this.close(node); + } + } + + // inherits. + visitProperty(node) { + if (node.value?.type === "TypeCastExpression") { + this._visitTypeAnnotation(node.value); + } + this._visitArray(node.decorators); + super.visitProperty(node); + } + + InterfaceDeclaration(node) { + this._createScopeVariable(node, node.id); + + const typeParamScope = this._nestTypeParamScope(node); + + // TODO: Handle mixins + this._visitArray(node.extends); + this.visit(node.body); + + if (typeParamScope) { + this.close(node); + } + } + + TypeAlias(node) { + this._createScopeVariable(node, node.id); + + const typeParamScope = this._nestTypeParamScope(node); + + this.visit(node.right); + + if (typeParamScope) { + this.close(node); + } + } + + ClassProperty(node) { + this._visitClassProperty(node); + } + + ClassPrivateProperty(node) { + this._visitClassProperty(node); + } + + // TODO: Update to visit type annotations when TypeScript/Flow support this syntax. + ClassPrivateMethod(node) { + super.MethodDefinition(node); + } + + DeclareModule(node) { + this._visitDeclareX(node); + } + + DeclareFunction(node) { + this._visitDeclareX(node); + } + + DeclareVariable(node) { + this._visitDeclareX(node); + } + + DeclareClass(node) { + this._visitDeclareX(node); + } + + // visit OptionalMemberExpression as a MemberExpression. + OptionalMemberExpression(node) { + super.MemberExpression(node); + } + + _visitClassProperty(node) { + this._visitTypeAnnotation(node.typeAnnotation); + this.visitProperty(node); + } + + _visitDeclareX(node) { + if (node.id) { + this._createScopeVariable(node, node.id); + } + + const typeParamScope = this._nestTypeParamScope(node); + if (typeParamScope) { + this.close(node); + } + } + + _createScopeVariable(node, name) { + this.currentScope().variableScope.__define( + name, + new Definition("Variable", name, node, null, null, null), + ); + } + + _nestTypeParamScope(node) { + if (!node.typeParameters) { + return null; + } + + const parentScope = this.scopeManager.__currentScope; + const scope = new escope.Scope( + this.scopeManager, + "type-parameters", + parentScope, + node, + false, + ); + + this.scopeManager.__nestScope(scope); + for (let j = 0; j < node.typeParameters.params.length; j++) { + const name = node.typeParameters.params[j]; + scope.__define(name, new Definition("TypeParameter", name, name)); + if (name.typeAnnotation) { + this._checkIdentifierOrVisit(name); + } + } + scope.__define = function() { + return parentScope.__define.apply(parentScope, arguments); + }; + + return scope; + } + + _visitTypeAnnotation(node) { + if (!node) { + return; + } + if (Array.isArray(node)) { + node.forEach(this._visitTypeAnnotation, this); + return; + } + + // get property to check (params, id, etc...) + const visitorValues = visitorKeysMap[node.type]; + if (!visitorValues) { + return; + } + + // can have multiple properties + for (let i = 0; i < visitorValues.length; i++) { + const visitorValue = visitorValues[i]; + const propertyType = propertyTypes[visitorValue]; + const nodeProperty = node[visitorValue]; + // check if property or type is defined + if (propertyType == null || nodeProperty == null) { + continue; + } + if (propertyType.type === "loop") { + for (let j = 0; j < nodeProperty.length; j++) { + if (Array.isArray(propertyType.values)) { + for (let k = 0; k < propertyType.values.length; k++) { + const loopPropertyNode = nodeProperty[j][propertyType.values[k]]; + if (loopPropertyNode) { + this._checkIdentifierOrVisit(loopPropertyNode); + } + } + } else { + this._checkIdentifierOrVisit(nodeProperty[j]); + } + } + } else if (propertyType.type === "single") { + this._checkIdentifierOrVisit(nodeProperty); + } else if (propertyType.type === "typeAnnotation") { + this._visitTypeAnnotation(node.typeAnnotation); + } else if (propertyType.type === "typeParameters") { + for (let l = 0; l < node.typeParameters.params.length; l++) { + this._checkIdentifierOrVisit(node.typeParameters.params[l]); + } + } else if (propertyType.type === "id") { + if (node.id.type === "Identifier") { + this._checkIdentifierOrVisit(node.id); + } else { + this._visitTypeAnnotation(node.id); + } + } + } + } + + _checkIdentifierOrVisit(node) { + if (node?.typeAnnotation) { + this._visitTypeAnnotation(node.typeAnnotation); + } else if (node?.type === "Identifier") { + this.visit(node); + } else { + this._visitTypeAnnotation(node); + } + } + + _visitArray(nodeList) { + if (nodeList) { + for (const node of nodeList) { + this.visit(node); + } + } + } +} + +export default function analyzeScope(ast, parserOptions) { + const options = { + ignoreEval: true, + optimistic: false, + directive: false, + nodejsScope: + ast.sourceType === "script" && + (parserOptions.ecmaFeatures && + parserOptions.ecmaFeatures.globalReturn) === true, + impliedStrict: false, + sourceType: ast.sourceType, + ecmaVersion: parserOptions.ecmaVersion, + fallback, + }; + + options.childVisitorKeys = childVisitorKeys; + + const scopeManager = new escope.ScopeManager(options); + const referencer = new Referencer(options, scopeManager); + + referencer.visit(ast); + + return scopeManager; +} diff --git a/eslint/babel-eslint-parser/src/configuration.js b/eslint/babel-eslint-parser/src/configuration.js new file mode 100644 index 000000000000..e6d036372f12 --- /dev/null +++ b/eslint/babel-eslint-parser/src/configuration.js @@ -0,0 +1,61 @@ +import { loadPartialConfig } from "@babel/core"; + +export function normalizeESLintConfig(options) { + const defaultOptions = { + babelOptions: {}, + ecmaVersion: 2020, + sourceType: "module", + allowImportExportEverywhere: false, + }; + + return Object.assign(defaultOptions, options); +} + +export function normalizeBabelParseConfig(options) { + const parseOptions = { + sourceType: options.sourceType, + filename: options.filePath, + cwd: options.babelOptions.cwd, + root: options.babelOptions.root, + rootMode: options.babelOptions.rootMode, + envName: options.babelOptions.envName, + configFile: options.babelOptions.configFile, + babelrc: options.babelOptions.babelrc, + babelrcRoots: options.babelOptions.babelrcRoots, + extends: options.babelOptions.extends, + env: options.babelOptions.env, + overrides: options.babelOptions.overrides, + test: options.babelOptions.test, + include: options.babelOptions.include, + exclude: options.babelOptions.exclude, + ignore: options.babelOptions.ignore, + only: options.babelOptions.only, + parserOpts: { + allowImportExportEverywhere: options.allowImportExportEverywhere, + allowReturnOutsideFunction: true, + allowSuperOutsideMethod: true, + ranges: true, + tokens: true, + plugins: ["estree"], + }, + caller: { + name: "@babel/eslint-parser", + }, + }; + + if (options.requireConfigFile !== false) { + const config = loadPartialConfig(parseOptions); + + if (config !== null) { + if (!config.hasFilesystemConfig()) { + throw new Error( + `No Babel config file detected for ${config.options.filename}. Either disable config file checking with requireConfigFile: false, or configure Babel so that it can find the config files.`, + ); + } + + return config.options; + } + } + + return parseOptions; +} diff --git a/eslint/babel-eslint-parser/src/convert/convertAST.js b/eslint/babel-eslint-parser/src/convert/convertAST.js new file mode 100644 index 000000000000..4cee65d0f6f7 --- /dev/null +++ b/eslint/babel-eslint-parser/src/convert/convertAST.js @@ -0,0 +1,138 @@ +import { types as t, traverse } from "@babel/core"; + +function convertNodes(ast, code) { + const astTransformVisitor = { + noScope: true, + enter(path) { + const { node } = path; + + if (node.innerComments) { + delete node.innerComments; + } + + if (node.trailingComments) { + delete node.trailingComments; + } + + if (node.leadingComments) { + delete node.leadingComments; + } + }, + exit(path) { + const { node } = path; + + // Used internally by @babel/parser. + if (node.extra) { + delete node.extra; + } + + if (node?.loc.identifierName) { + delete node.loc.identifierName; + } + + if (path.isTypeParameter()) { + node.type = "Identifier"; + node.typeAnnotation = node.bound; + delete node.bound; + } + + // flow: prevent "no-undef" + // for "Component" in: "let x: React.Component" + if (path.isQualifiedTypeIdentifier()) { + delete node.id; + } + // for "b" in: "var a: { b: Foo }" + if (path.isObjectTypeProperty()) { + delete node.key; + } + // for "indexer" in: "var a: {[indexer: string]: number}" + if (path.isObjectTypeIndexer()) { + delete node.id; + } + // for "param" in: "var a: { func(param: Foo): Bar };" + if (path.isFunctionTypeParam()) { + delete node.name; + } + + // modules + if (path.isImportDeclaration()) { + delete node.isType; + } + + // template string range fixes + if (path.isTemplateLiteral()) { + for (let i = 0; i < node.quasis.length; i++) { + const q = node.quasis[i]; + q.range[0] -= 1; + if (q.tail) { + q.range[1] += 1; + } else { + q.range[1] += 2; + } + q.loc.start.column -= 1; + if (q.tail) { + q.loc.end.column += 1; + } else { + q.loc.end.column += 2; + } + } + } + }, + }; + const state = { source: code }; + + // Monkey patch visitor keys in order to be able to traverse the estree nodes + t.VISITOR_KEYS.Property = t.VISITOR_KEYS.ObjectProperty; + t.VISITOR_KEYS.MethodDefinition = [ + "key", + "value", + "decorators", + "returnType", + "typeParameters", + ]; + + traverse(ast, astTransformVisitor, null, state); + + // These can be safely deleted because they are not defined in the original visitor keys. + delete t.VISITOR_KEYS.Property; + delete t.VISITOR_KEYS.MethodDefinition; +} + +function convertProgramNode(ast) { + ast.type = "Program"; + ast.sourceType = ast.program.sourceType; + ast.body = ast.program.body; + delete ast.program; + delete ast.errors; + + if (ast.comments.length) { + const lastComment = ast.comments[ast.comments.length - 1]; + + if (ast.tokens.length) { + const lastToken = ast.tokens[ast.tokens.length - 1]; + + if (lastComment.end > lastToken.end) { + // If there is a comment after the last token, the program ends at the + // last token and not the comment + ast.range[1] = lastToken.end; + ast.loc.end.line = lastToken.loc.end.line; + ast.loc.end.column = lastToken.loc.end.column; + } + } + } else { + if (!ast.tokens.length) { + ast.loc.start.line = 1; + ast.loc.end.line = 1; + } + } + + if (ast.body && ast.body.length > 0) { + ast.loc.start.line = ast.body[0].loc.start.line; + ast.range[0] = ast.body[0].start; + } +} + +export default function convertAST(ast, code) { + convertNodes(ast, code); + convertProgramNode(ast); +} diff --git a/eslint/babel-eslint-parser/src/convert/convertComments.js b/eslint/babel-eslint-parser/src/convert/convertComments.js new file mode 100644 index 000000000000..854c3440c590 --- /dev/null +++ b/eslint/babel-eslint-parser/src/convert/convertComments.js @@ -0,0 +1,14 @@ +export default function convertComments(comments) { + for (const comment of comments) { + if (comment.type === "CommentBlock") { + comment.type = "Block"; + } else if (comment.type === "CommentLine") { + comment.type = "Line"; + } + // sometimes comments don't get ranges computed, + // even with options.ranges === true + if (!comment.range) { + comment.range = [comment.start, comment.end]; + } + } +} diff --git a/eslint/babel-eslint-parser/src/convert/convertTokens.js b/eslint/babel-eslint-parser/src/convert/convertTokens.js new file mode 100644 index 000000000000..402f02ebe6c6 --- /dev/null +++ b/eslint/babel-eslint-parser/src/convert/convertTokens.js @@ -0,0 +1,185 @@ +import { tokTypes as tt } from "@babel/core"; + +function convertTemplateType(tokens) { + let curlyBrace = null; + let templateTokens = []; + const result = []; + + function addTemplateType() { + const start = templateTokens[0]; + const end = templateTokens[templateTokens.length - 1]; + + const value = templateTokens.reduce((result, token) => { + if (token.value) { + result += token.value; + } else if (token.type !== tt.template) { + result += token.type.label; + } + + return result; + }, ""); + + result.push({ + type: "Template", + value: value, + start: start.start, + end: end.end, + loc: { + start: start.loc.start, + end: end.loc.end, + }, + }); + + templateTokens = []; + } + + tokens.forEach(token => { + switch (token.type) { + case tt.backQuote: + if (curlyBrace) { + result.push(curlyBrace); + curlyBrace = null; + } + + templateTokens.push(token); + + if (templateTokens.length > 1) { + addTemplateType(); + } + + break; + + case tt.dollarBraceL: + templateTokens.push(token); + addTemplateType(); + break; + + case tt.braceR: + if (curlyBrace) { + result.push(curlyBrace); + } + + curlyBrace = token; + break; + + case tt.template: + if (curlyBrace) { + templateTokens.push(curlyBrace); + curlyBrace = null; + } + + templateTokens.push(token); + break; + + case tt.eof: + if (curlyBrace) { + result.push(curlyBrace); + } + + break; + + default: + if (curlyBrace) { + result.push(curlyBrace); + curlyBrace = null; + } + + result.push(token); + } + }); + + return result; +} + +function convertToken(token, source) { + const type = token.type; + token.range = [token.start, token.end]; + + if (type === tt.name) { + token.type = "Identifier"; + } else if ( + type === tt.semi || + type === tt.comma || + type === tt.parenL || + type === tt.parenR || + type === tt.braceL || + type === tt.braceR || + type === tt.slash || + type === tt.dot || + type === tt.bracketL || + type === tt.bracketR || + type === tt.ellipsis || + type === tt.arrow || + type === tt.pipeline || + type === tt.star || + type === tt.incDec || + type === tt.colon || + type === tt.question || + type === tt.questionDot || + type === tt.template || + type === tt.backQuote || + type === tt.dollarBraceL || + type === tt.at || + type === tt.logicalOR || + type === tt.logicalAND || + type === tt.nullishCoalescing || + type === tt.bitwiseOR || + type === tt.bitwiseXOR || + type === tt.bitwiseAND || + type === tt.equality || + type === tt.relational || + type === tt.bitShift || + type === tt.plusMin || + type === tt.modulo || + type === tt.exponent || + type === tt.bang || + type === tt.tilde || + type === tt.doubleColon || + type === tt.hash || + type.isAssign + ) { + token.type = "Punctuator"; + if (!token.value) token.value = type.label; + } else if (type === tt.jsxTagStart) { + token.type = "Punctuator"; + token.value = "<"; + } else if (type === tt.jsxTagEnd) { + token.type = "Punctuator"; + token.value = ">"; + } else if (type === tt.jsxName) { + token.type = "JSXIdentifier"; + } else if (type === tt.jsxText) { + token.type = "JSXText"; + } else if (type.keyword === "null") { + token.type = "Null"; + } else if (type.keyword === "false" || type.keyword === "true") { + token.type = "Boolean"; + } else if (type.keyword) { + token.type = "Keyword"; + } else if (type === tt.num) { + token.type = "Numeric"; + token.value = source.slice(token.start, token.end); + } else if (type === tt.string) { + token.type = "String"; + token.value = source.slice(token.start, token.end); + } else if (type === tt.regexp) { + token.type = "RegularExpression"; + const value = token.value; + token.regex = { + pattern: value.pattern, + flags: value.flags, + }; + token.value = `/${value.pattern}/${value.flags}`; + } else if (type === tt.bigint) { + token.type = "Numeric"; + token.value = `${token.value}n`; + } + + return token; +} + +export default function convertTokens(tokens, code) { + return convertTemplateType(tokens) + .filter(t => t.type !== "CommentLine" && t.type !== "CommentBlock") + .map(t => convertToken(t, code)); +} diff --git a/eslint/babel-eslint-parser/src/convert/index.js b/eslint/babel-eslint-parser/src/convert/index.js new file mode 100644 index 000000000000..7a9de2b4cc0b --- /dev/null +++ b/eslint/babel-eslint-parser/src/convert/index.js @@ -0,0 +1,9 @@ +import convertTokens from "./convertTokens"; +import convertComments from "./convertComments"; +import convertAST from "./convertAST"; + +export default function(ast, code) { + ast.tokens = convertTokens(ast.tokens, code); + convertComments(ast.comments); + convertAST(ast, code); +} diff --git a/eslint/babel-eslint-parser/src/index.js b/eslint/babel-eslint-parser/src/index.js new file mode 100644 index 000000000000..2d54014b4468 --- /dev/null +++ b/eslint/babel-eslint-parser/src/index.js @@ -0,0 +1,26 @@ +import semver from "semver"; +import { version as CURRENT_BABEL_VERSION } from "@babel/core"; +import parseWithScope from "./parse-with-scope"; +import { normalizeESLintConfig } from "./configuration"; +import packageJson from "../package.json"; + +const SUPPORTED_BABEL_VERSION_RANGE = + packageJson.peerDependencies["@babel/core"]; +const IS_RUNNING_SUPPORTED_VERSION = semver.satisfies( + CURRENT_BABEL_VERSION, + SUPPORTED_BABEL_VERSION_RANGE, +); + +export function parse(code, options) { + return parseForESLint(code, options).ast; +} + +export function parseForESLint(code, options = {}) { + if (!IS_RUNNING_SUPPORTED_VERSION) { + throw new Error( + `babel-eslint@${packageJson.version} does not support @babel/core@${CURRENT_BABEL_VERSION}. Please downgrade to babel-eslint@^10 or upgrade to @babel/core@${SUPPORTED_BABEL_VERSION_RANGE}`, + ); + } + + return parseWithScope(code, normalizeESLintConfig(options)); +} diff --git a/eslint/babel-eslint-parser/src/parse-with-scope.js b/eslint/babel-eslint-parser/src/parse-with-scope.js new file mode 100644 index 000000000000..9d29b67f10d7 --- /dev/null +++ b/eslint/babel-eslint-parser/src/parse-with-scope.js @@ -0,0 +1,10 @@ +import visitorKeys from "./visitor-keys"; +import analyzeScope from "./analyze-scope"; +import parse from "./parse"; + +export default function parseWithScope(code, options) { + const ast = parse(code, options); + const scopeManager = analyzeScope(ast, options); + + return { ast, scopeManager, visitorKeys }; +} diff --git a/eslint/babel-eslint-parser/src/parse.js b/eslint/babel-eslint-parser/src/parse.js new file mode 100644 index 000000000000..9410fcba01d3 --- /dev/null +++ b/eslint/babel-eslint-parser/src/parse.js @@ -0,0 +1,23 @@ +import { parseSync as babelParse } from "@babel/core"; +import convert from "./convert"; +import { normalizeBabelParseConfig } from "./configuration"; + +export default function parse(code, options) { + const parseOptions = normalizeBabelParseConfig(options); + let ast; + + try { + ast = babelParse(code, parseOptions); + } catch (err) { + if (err instanceof SyntaxError) { + err.lineNumber = err.loc.line; + err.column = err.loc.column; + } + + throw err; + } + + convert(ast, code); + + return ast; +} diff --git a/eslint/babel-eslint-parser/src/visitor-keys.js b/eslint/babel-eslint-parser/src/visitor-keys.js new file mode 100644 index 000000000000..6676a86602e3 --- /dev/null +++ b/eslint/babel-eslint-parser/src/visitor-keys.js @@ -0,0 +1,15 @@ +import { types as t } from "@babel/core"; +import { KEYS as ESLINT_VISITOR_KEYS } from "eslint-visitor-keys"; + +const { VISITOR_KEYS: BABEL_VISITOR_KEYS } = t; + +export default Object.assign( + { + Literal: ESLINT_VISITOR_KEYS.Literal, + MethodDefinition: ["decorators"].concat( + ESLINT_VISITOR_KEYS.MethodDefinition, + ), + Property: ["decorators"].concat(ESLINT_VISITOR_KEYS.Property), + }, + BABEL_VISITOR_KEYS, +); diff --git a/eslint/babel-eslint-parser/test/index.js b/eslint/babel-eslint-parser/test/index.js new file mode 100644 index 000000000000..6fd61c84142c --- /dev/null +++ b/eslint/babel-eslint-parser/test/index.js @@ -0,0 +1,596 @@ +import path from "path"; +import { pathToFileURL } from "url"; +import escope from "eslint-scope"; +import unpad from "dedent"; +import { parseForESLint } from "../src"; + +const BABEL_OPTIONS = { + configFile: require.resolve( + "@babel/eslint-shared-fixtures/config/babel.config.js", + ), +}; +const PROPS_TO_REMOVE = [ + "importKind", + "exportKind", + "variance", + "typeArguments", +]; +// We can remove needing to drop "exported" if null once this lands: +// https://github.com/acornjs/acorn/pull/889 +const PROPS_TO_REMOVE_IF_NULL = ["exported"]; + +function deeplyRemoveProperties(obj, props, propsIfNull) { + for (const [k, v] of Object.entries(obj)) { + if (typeof v === "object") { + if (Array.isArray(v)) { + for (const el of v) { + if (el != null) { + deeplyRemoveProperties(el, props, propsIfNull); + } + } + } + + if (props.includes(k) || (propsIfNull.includes(k) && v === null)) { + delete obj[k]; + } else if (v != null) { + deeplyRemoveProperties(v, props, propsIfNull); + } + continue; + } + + if (props.includes(k) || (propsIfNull.includes(k) && v === null)) { + delete obj[k]; + } + } +} + +describe("Babel and Espree", () => { + let espree; + + function parseAndAssertSame(code) { + code = unpad(code); + const espreeAST = espree.parse(code, { + ecmaFeatures: { + // enable JSX parsing + jsx: true, + // enable return in global scope + globalReturn: true, + // enable implied strict mode (if ecmaVersion >= 5) + impliedStrict: true, + // allow experimental object rest/spread + experimentalObjectRestSpread: true, + }, + tokens: true, + loc: true, + range: true, + comment: true, + ecmaVersion: 2020, + sourceType: "module", + }); + const babelAST = parseForESLint(code, { + eslintVisitorKeys: true, + eslintScopeManager: true, + babelOptions: BABEL_OPTIONS, + }).ast; + deeplyRemoveProperties(babelAST, PROPS_TO_REMOVE, PROPS_TO_REMOVE_IF_NULL); + expect(babelAST).toEqual(espreeAST); + } + + beforeAll(async () => { + // Use the version of Espree that is a dependency of + // the version of ESLint we are testing against. + const espreePath = require.resolve("espree", { + paths: [path.dirname(require.resolve("eslint"))], + }); + + espree = await import(pathToFileURL(espreePath)); + }); + + describe("compatibility", () => { + it("should allow ast.analyze to be called without options", function() { + const ast = parseForESLint("`test`", { + eslintScopeManager: true, + eslintVisitorKeys: true, + babelOptions: BABEL_OPTIONS, + }).ast; + expect(() => { + escope.analyze(ast); + }).not.toThrow(new TypeError("Should allow no options argument.")); + }); + }); + + describe("templates", () => { + it("empty template string", () => { + parseAndAssertSame("``"); + }); + + it("template string", () => { + parseAndAssertSame("`test`"); + }); + + it("template string using $", () => { + parseAndAssertSame("`$`"); + }); + + it("template string with expression", () => { + parseAndAssertSame("`${a}`"); + }); + + it("template string with multiple expressions", () => { + parseAndAssertSame("`${a}${b}${c}`"); + }); + + it("template string with expression and strings", () => { + parseAndAssertSame("`a${a}a`"); + }); + + it("template string with binary expression", () => { + parseAndAssertSame("`a${a + b}a`"); + }); + + it("tagged template", () => { + parseAndAssertSame("jsx``"); + }); + + it("tagged template with expression", () => { + parseAndAssertSame("jsx``"); + }); + + it("tagged template with new operator", () => { + parseAndAssertSame("new raw`42`"); + }); + + it("template with nested function/object", () => { + parseAndAssertSame( + "`outer${{x: {y: 10}}}bar${`nested${function(){return 1;}}endnest`}end`", + ); + }); + + it("template with braces inside and outside of template string #96", () => { + parseAndAssertSame( + "if (a) { var target = `{}a:${webpackPort}{}}}}`; } else { app.use(); }", + ); + }); + + it("template also with braces #96", () => { + parseAndAssertSame(` + export default function f1() { + function f2(foo) { + const bar = 3; + return \`\${foo} \${bar}\`; + } + return f2; + } + `); + }); + + it("template with destructuring #31", () => { + parseAndAssertSame(` + module.exports = { + render() { + var {name} = this.props; + return Math.max(null, \`Name: \${name}, Name: \${name}\`); + } + }; + `); + }); + + it("template with arrow returning template #603", () => { + parseAndAssertSame(` + var a = \`\${() => { + \`\${''}\` + }}\`; + `); + }); + + it("template string with object with template string inside", () => { + parseAndAssertSame("`${ { a:`${2}` } }`"); + }); + }); + + it("simple expression", () => { + parseAndAssertSame("a = 1"); + }); + + it("logical NOT", () => { + parseAndAssertSame("!0"); + }); + + it("bitwise NOT", () => { + parseAndAssertSame("~0"); + }); + + it("class declaration", () => { + parseAndAssertSame("class Foo {}"); + }); + + it("class expression", () => { + parseAndAssertSame("var a = class Foo {}"); + }); + + it("jsx expression", () => { + parseAndAssertSame(""); + }); + + it("jsx expression with 'this' as identifier", () => { + parseAndAssertSame(""); + }); + + it("jsx expression with a dynamic attribute", () => { + parseAndAssertSame(""); + }); + + it("jsx expression with a member expression as identifier", () => { + parseAndAssertSame(""); + }); + + it("jsx expression with spread", () => { + parseAndAssertSame("var myDivElement =

;"); + }); + + it("empty jsx text", () => { + parseAndAssertSame(""); + }); + + it("jsx text with content", () => { + parseAndAssertSame("Hello, world!"); + }); + + it("nested jsx", () => { + parseAndAssertSame("
\n

Wat

\n
"); + }); + + it("default import", () => { + parseAndAssertSame('import foo from "foo";'); + }); + + it("import specifier", () => { + parseAndAssertSame('import { foo } from "foo";'); + }); + + it("import specifier with name", () => { + parseAndAssertSame('import { foo as bar } from "foo";'); + }); + + it("import bare", () => { + parseAndAssertSame('import "foo";'); + }); + + it("export default class declaration", () => { + parseAndAssertSame("export default class Foo {}"); + }); + + it("export default class expression", () => { + parseAndAssertSame("export default class {}"); + }); + + it("export default function declaration", () => { + parseAndAssertSame("export default function Foo() {}"); + }); + + it("export default function expression", () => { + parseAndAssertSame("export default function () {}"); + }); + + it("export all", () => { + parseAndAssertSame('export * from "foo";'); + }); + + // Espree doesn't support `export * as ns` yet + it("export * as ns", () => { + const code = 'export * as Foo from "foo";'; + const babylonAST = parseForESLint(code, { + eslintVisitorKeys: true, + eslintScopeManager: true, + babelOptions: BABEL_OPTIONS, + }).ast; + expect(babylonAST.tokens[1].type).toEqual("Punctuator"); + }); + + it("export named", () => { + parseAndAssertSame("var foo = 1;export { foo };"); + }); + + it("export named alias", () => { + parseAndAssertSame("var foo = 1;export { foo as bar };"); + }); + + // Espree doesn't support the optional chaining operator yet + it("optional chaining operator (token)", () => { + const code = "foo?.bar"; + const babylonAST = parseForESLint(code, { + eslintVisitorKeys: true, + eslintScopeManager: true, + babelOptions: BABEL_OPTIONS, + }).ast; + expect(babylonAST.tokens[1].type).toEqual("Punctuator"); + }); + + // Espree doesn't support the nullish coalescing operator yet + it("nullish coalescing operator (token)", () => { + const code = "foo ?? bar"; + const babylonAST = parseForESLint(code, { + eslintVisitorKeys: true, + eslintScopeManager: true, + babelOptions: BABEL_OPTIONS, + }).ast; + expect(babylonAST.tokens[1].type).toEqual("Punctuator"); + }); + + // Espree doesn't support the pipeline operator yet + it("pipeline operator (token)", () => { + const code = "foo |> bar"; + const babylonAST = parseForESLint(code, { + eslintVisitorKeys: true, + eslintScopeManager: true, + babelOptions: BABEL_OPTIONS, + }).ast; + expect(babylonAST.tokens[1].type).toEqual("Punctuator"); + }); + + // Espree doesn't support private fields yet + it("hash (token)", () => { + const code = "class A { #x }"; + const babylonAST = parseForESLint(code, { + eslintVisitorKeys: true, + eslintScopeManager: true, + babelOptions: BABEL_OPTIONS, + }).ast; + expect(babylonAST.tokens[3].type).toEqual("Punctuator"); + expect(babylonAST.tokens[3].value).toEqual("#"); + }); + + it("empty program with line comment", () => { + parseAndAssertSame("// single comment"); + }); + + it("empty program with block comment", () => { + parseAndAssertSame(" /* multiline\n * comment\n*/"); + }); + + it("line comments", () => { + parseAndAssertSame(` + // single comment + var foo = 15; // comment next to statement + // second comment after statement + `); + }); + + it("block comments", () => { + parseAndAssertSame(` + /* single comment */ + var foo = 15; /* comment next to statement */ + /* + * multiline + * comment + */ + `); + }); + + it("block comments #124", () => { + parseAndAssertSame(` + React.createClass({ + render() { + // return ( + //
+ // ); // <-- this is the line that is reported + } + }); + `); + }); + + it("null", () => { + parseAndAssertSame("null"); + }); + + it("boolean", () => { + parseAndAssertSame("if (true) {} else if (false) {}"); + }); + + it("regexp", () => { + parseAndAssertSame("/affix-top|affix-bottom|affix|[a-z]/"); + }); + + it("regexp", () => { + parseAndAssertSame("const foo = /foo/;"); + }); + + it("regexp y flag", () => { + parseAndAssertSame("const foo = /foo/y;"); + }); + + it("regexp u flag", () => { + parseAndAssertSame("const foo = /foo/u;"); + }); + + it("regexp in a template string", () => { + parseAndAssertSame('`${/\\d/.exec("1")[0]}`'); + }); + + it("first line is empty", () => { + parseAndAssertSame('\nimport Immutable from "immutable";'); + }); + + it("empty", () => { + parseAndAssertSame(""); + }); + + it("jsdoc", () => { + parseAndAssertSame(` + /** + * @param {object} options + * @return {number} + */ + const test = function({ a, b, c }) { + return a + b + c; + }; + module.exports = test; + `); + }); + + it("empty block with comment", () => { + parseAndAssertSame(` + function a () { + try { + b(); + } catch (e) { + // asdf + } + } + `); + }); + + describe("babel tests", () => { + it("MethodDefinition", () => { + parseAndAssertSame(` + export default class A { + a() {} + } + `); + }); + + it("MethodDefinition 2", () => { + parseAndAssertSame( + "export default class Bar { get bar() { return 42; }}", + ); + }); + + it("ClassMethod", () => { + parseAndAssertSame(` + class A { + constructor() { + } + } + `); + }); + + it("ClassMethod multiple params", () => { + parseAndAssertSame(` + class A { + constructor(a, b, c) { + } + } + `); + }); + + it("ClassMethod multiline", () => { + parseAndAssertSame(` + class A { + constructor ( + a, + b, + c + ) + + { + + } + } + `); + }); + + it("ClassMethod oneline", () => { + parseAndAssertSame("class A { constructor(a, b, c) {} }"); + }); + + it("ObjectMethod", () => { + parseAndAssertSame(` + var a = { + b(c) { + } + } + `); + }); + + it("do not allow import export everywhere", () => { + expect(() => { + parseAndAssertSame('function F() { import a from "a"; }'); + }).toThrow( + new SyntaxError( + "'import' and 'export' may only appear at the top level", + ), + ); + }); + + it("return outside function", () => { + parseAndAssertSame("return;"); + }); + + it("super outside method", () => { + expect(() => { + parseAndAssertSame("function F() { super(); }"); + }).toThrow(new SyntaxError("'super' keyword outside a method")); + }); + + it("StringLiteral", () => { + parseAndAssertSame(""); + parseAndAssertSame(""); + parseAndAssertSame("a"); + }); + + it("getters and setters", () => { + parseAndAssertSame("class A { get x ( ) { ; } }"); + parseAndAssertSame(` + class A { + get x( + ) + { + ; + } + } + `); + parseAndAssertSame("class A { set x (a) { ; } }"); + parseAndAssertSame(` + class A { + set x(a + ) + { + ; + } + } + `); + parseAndAssertSame(` + var B = { + get x () { + return this.ecks; + }, + set x (ecks) { + this.ecks = ecks; + } + }; + `); + }); + + it("RestOperator", () => { + parseAndAssertSame("var { a, ...b } = c"); + parseAndAssertSame("var [ a, ...b ] = c"); + parseAndAssertSame("var a = function (...b) {}"); + }); + + it("SpreadOperator", () => { + parseAndAssertSame("var a = { b, ...c }"); + parseAndAssertSame("var a = [ a, ...b ]"); + parseAndAssertSame("var a = sum(...b)"); + }); + + it("Async/Await", () => { + parseAndAssertSame(` + async function a() { + await 1; + } + `); + }); + + it("BigInt", () => { + parseAndAssertSame(` + const a = 1n; + `); + }); + + it("Dynamic Import", () => { + parseAndAssertSame(` + const a = import('a'); + `); + }); + }); +}); diff --git a/eslint/babel-eslint-plugin-development/.npmignore b/eslint/babel-eslint-plugin-development/.npmignore new file mode 100644 index 000000000000..c3aafe7a7721 --- /dev/null +++ b/eslint/babel-eslint-plugin-development/.npmignore @@ -0,0 +1,4 @@ +src +test +.* +*.log \ No newline at end of file diff --git a/eslint/babel-eslint-plugin-development/README.md b/eslint/babel-eslint-plugin-development/README.md new file mode 100644 index 000000000000..12cc354b7470 --- /dev/null +++ b/eslint/babel-eslint-plugin-development/README.md @@ -0,0 +1,38 @@ +# @babel/eslint-plugin-development + +A set of eslint rules to enforce best practices in the development of Babel plugins. + +## Installation + +You'll first need to install [ESLint](http://eslint.org): + +``` +$ npm install --save-dev eslint +``` + +Next, install `@babel/eslint-plugin-development`: + +``` +$ npm install --save-dev @babel/eslint-plugin-development +``` + +Then, load the plugin in your `.eslintrc` configuration file. You can omit the `eslint-plugin-` prefix: + +```json +{ + "plugins": ["@babel/development"] +} +``` + +## Supported Rules + +> Note: Rules marked with :wrench: are autofixable. + +* `@babel/development/no-deprecated-clone` (:wrench:): Disallows using the deprecated + `t.clone(node)` and `t.cloneDeep(node)` methods from `@babel/types`. Those + calls are replaced with `t.cloneNode(node)` when using `eslint --fix`. +* `@babel/development/no-undefined-identifier`: Disallows using + `t.identifier("undefined")` to create a node which represents an `undefined` + value, since it might cause problem if `undefined` is redeclared. +* `@babel/development/plugin-name`: Requires plugins to have a `name` property, which + can be useful for debugging purposes. diff --git a/eslint/babel-eslint-plugin-development/package.json b/eslint/babel-eslint-plugin-development/package.json new file mode 100644 index 000000000000..d59704a25597 --- /dev/null +++ b/eslint/babel-eslint-plugin-development/package.json @@ -0,0 +1,36 @@ +{ + "name": "@babel/eslint-plugin-development", + "version": "1.0.1", + "description": "ESLint rules that enforce best practices in the development of Babel plugins.", + "private": true, + "keywords": [ + "eslint", + "eslintplugin", + "eslint-plugin" + ], + "author": { + "name": "Nicolò Ribaudo", + "email": "nicolo.ribaudo@gmail.com", + "url": "https://github.com/nicolo-ribaudo" + }, + "main": "lib/index.js", + "devDependencies": { + "eslint": "^5.9.0" + }, + "engines": { + "node": ">=10.9" + }, + "publishConfig": { + "access": "public" + }, + "license": "MIT", + "repository": { + "type": "git", + "url": "https://github.com/babel/babel.git", + "directory": "eslint/babel-eslint-plugin-development" + }, + "bugs": { + "url": "https://github.com/babel/babel/issues" + }, + "homepage": "https://github.com/babel/babel/tree/master/eslint/babel-eslint-plugin-development" +} diff --git a/eslint/babel-eslint-plugin-development/src/index.js b/eslint/babel-eslint-plugin-development/src/index.js new file mode 100644 index 000000000000..ae6662710684 --- /dev/null +++ b/eslint/babel-eslint-plugin-development/src/index.js @@ -0,0 +1,11 @@ +import noDeprecatedClone from "./rules/no-deprecated-clone"; +import noUndefinedIdentifier from "./rules/no-undefined-identifier"; +import pluginName from "./rules/plugin-name"; + +export default { + rules: { + "no-deprecated-clone": noDeprecatedClone, + "no-undefined-identifier": noUndefinedIdentifier, + "plugin-name": pluginName, + }, +}; diff --git a/eslint/babel-eslint-plugin-development/src/rules/no-deprecated-clone.js b/eslint/babel-eslint-plugin-development/src/rules/no-deprecated-clone.js new file mode 100644 index 000000000000..dddc5eb3b729 --- /dev/null +++ b/eslint/babel-eslint-plugin-development/src/rules/no-deprecated-clone.js @@ -0,0 +1,39 @@ +import getReferenceOrigin from "../utils/get-reference-origin"; +import isFromBabelTypes from "../utils/is-from-babel-types"; + +export default { + meta: { + schema: [], + fixable: "code", + }, + create(context) { + return { + CallExpression(node) { + const { callee } = node; + const scope = context.getScope(); + + const origin = getReferenceOrigin(callee, scope); + if (!origin) return; + + const { name } = origin; + if ( + (name === "clone" || name === "cloneDeep") && + isFromBabelTypes(origin, scope) + ) { + const isMemberExpression = callee.type === "MemberExpression"; + const id = isMemberExpression ? callee.property : callee; + + context.report({ + node: id, + message: `t.${name}() is deprecated. Use t.cloneNode() instead.`, + fix(fixer) { + if (isMemberExpression) { + return fixer.replaceText(id, "cloneNode"); + } + }, + }); + } + }, + }; + }, +}; diff --git a/eslint/babel-eslint-plugin-development/src/rules/no-undefined-identifier.js b/eslint/babel-eslint-plugin-development/src/rules/no-undefined-identifier.js new file mode 100644 index 000000000000..33e154be8979 --- /dev/null +++ b/eslint/babel-eslint-plugin-development/src/rules/no-undefined-identifier.js @@ -0,0 +1,39 @@ +import getReferenceOrigin from "../utils/get-reference-origin"; +import isFromBabelTypes from "../utils/is-from-babel-types"; + +function firstArgumentIsUndefinedString(argumentsArray) { + return ( + argumentsArray.length > 0 && + argumentsArray[0].type === "Literal" && + argumentsArray[0].value === "undefined" + ); +} + +export default { + meta: { + schema: [], + }, + create(context) { + return { + CallExpression(node) { + const { callee } = node; + const scope = context.getScope(); + + const origin = getReferenceOrigin(callee, scope); + if (!origin) return; + + const { name } = origin; + if ( + (name === "identifier" || name === "Identifier") && + firstArgumentIsUndefinedString(node.arguments) && + isFromBabelTypes(origin, scope) + ) { + context.report( + node, + "Use path.scope.buildUndefinedNode() to create an undefined identifier directly.", + ); + } + }, + }; + }, +}; diff --git a/eslint/babel-eslint-plugin-development/src/rules/plugin-name.js b/eslint/babel-eslint-plugin-development/src/rules/plugin-name.js new file mode 100644 index 000000000000..df14476cd43b --- /dev/null +++ b/eslint/babel-eslint-plugin-development/src/rules/plugin-name.js @@ -0,0 +1,50 @@ +import isBabelPluginFactory from "../utils/is-babel-plugin-factory"; + +function getReturnValue(node) { + const { body } = node; + + if (body.type === "BlockStatement") { + const returnNode = body.body.find(n => n.type === "ReturnStatement"); + return returnNode && returnNode.argument; + } + + // Arrow functions with implicit return + return body; +} + +export default { + meta: { + schema: [], + }, + create(context /*: Context */) { + let pluginFound = false; + + return { + FunctionDeclaration: functionVisitor, + FunctionExpression: functionVisitor, + ArrowFunctionExpression: functionVisitor, + + "Program:exit"(node) { + if (!pluginFound) { + context.report(node, "This file does not export a Babel plugin."); + } + }, + }; + + function functionVisitor(node) { + if (!isBabelPluginFactory(node, context.getScope())) return; + + const returnValue = getReturnValue(node); + if (!returnValue || returnValue.type !== "ObjectExpression") return; + + pluginFound = true; + + if (!returnValue.properties.some(p => p.key.name === "name")) { + context.report( + returnValue, + "This Babel plugin doesn't have a 'name' property.", + ); + } + } + }, +}; diff --git a/eslint/babel-eslint-plugin-development/src/utils/get-export-name.js b/eslint/babel-eslint-plugin-development/src/utils/get-export-name.js new file mode 100644 index 000000000000..2d75e3e46a4d --- /dev/null +++ b/eslint/babel-eslint-plugin-development/src/utils/get-export-name.js @@ -0,0 +1,22 @@ +export default function getExportName(node) { + const { parent } = node; + + if (parent.type === "ExportDefaultDeclaration") { + return "default"; + } + + if (parent.type === "ExportNamedDeclaration") { + return node.id.name; + } + + if ( + parent.type === "AssignmentExpression" && + parent.left.type === "MemberExpression" && + parent.left.object.type === "Identifier" && + parent.left.object.name === "module" && + parent.left.property.type === "Identifier" && + parent.left.property.name === "exports" + ) { + return "module.exports"; + } +} diff --git a/eslint/babel-eslint-plugin-development/src/utils/get-reference-origin.js b/eslint/babel-eslint-plugin-development/src/utils/get-reference-origin.js new file mode 100644 index 000000000000..25fd7b0a541f --- /dev/null +++ b/eslint/babel-eslint-plugin-development/src/utils/get-reference-origin.js @@ -0,0 +1,141 @@ +/*:: +type ReferenceOriginImport = { kind: "import", source: string, name: string }; +type ReferenceOriginParam = { + kind: "param", + index: number, + functionNode: Node, +}; + +type ReferenceOrigin = + | ReferenceOriginImport + | ReferenceOriginParam + | { kind: "import *", source: string } + | { + kind: "property", + base: ReferenceOriginImport | ReferenceOriginParam, + path: string, + name: string, + }; +*/ + +// Given a node and a context, returns a description of where its value comes +// from. +// It resolves imports, parameters of exported functions and property accesses. +// See the ReferenceOrigin type for more informations. +export default function getReferenceOrigin( + node, + scope, +) /*: ?ReferenceOrigin */ { + if (node.type === "Identifier") { + const variable = getVariableDefinition(node.name, scope); + if (!variable) return null; + + const definition = variable.definition; + const defNode = definition.node; + + if (definition.type === "ImportBinding") { + if (defNode.type === "ImportSpecifier") { + return { + kind: "import", + source: definition.parent.source.value, + name: defNode.imported.name, + }; + } + if (defNode.type === "ImportNamespaceSpecifier") { + return { + kind: "import *", + source: definition.parent.source.value, + }; + } + } + + if (definition.type === "Variable" && defNode.init) { + const origin = getReferenceOrigin(defNode.init, variable.scope); + return origin && patternToProperty(definition.name, origin); + } + + if (definition.type === "Parameter") { + return patternToProperty(definition.name, { + kind: "param", + index: definition.index, + functionNode: definition.node, + }); + } + } + + if (node.type === "MemberExpression" && !node.computed) { + const origin = getReferenceOrigin(node.object, scope); + return origin && addProperty(origin, node.property.name); + } + + return null; +} + +function getVariableDefinition(name, scope) { + let currentScope = scope; + do { + const variable = currentScope.set.get(name); + if (variable && variable.defs[0]) { + return { scope: currentScope, definition: variable.defs[0] }; + } + } while ((currentScope = currentScope.upper)); +} + +function patternToProperty(id, base) { + const path = getPatternPath(id); + return path && path.reduce(addProperty, base); +} + +// Adds a property to a given origin. If it was a namespace import it becomes +// a named import, so that `import * as x from "foo"; x.bar` and +// `import { bar } from "foo"` have the same origin. +function addProperty(origin, name) { + if (origin.kind === "import *") { + return { + kind: "import", + source: origin.source, + name, + }; + } + if (origin.kind === "property") { + return { + kind: "property", + base: origin.base, + path: origin.path + "." + name, + name, + }; + } + return { + kind: "property", + base: origin, + path: name, + name, + }; +} + +// if "node" is c of { a: { b: c } }, the result is ["a","b"] +function getPatternPath(node) { + let current = node; + const path = []; + + // Unshift keys to path while going up + do { + const property = current.parent; + if ( + property.type === "ArrayPattern" || + property.type === "AssignmentPattern" || + property.computed + ) { + // These nodes are not supported. + return null; + } + if (property.type === "Property") { + path.unshift(property.key.name); + } else { + // The destructuring pattern is finished + break; + } + } while ((current = current.parent.parent)); + + return path; +} diff --git a/eslint/babel-eslint-plugin-development/src/utils/is-babel-plugin-factory.js b/eslint/babel-eslint-plugin-development/src/utils/is-babel-plugin-factory.js new file mode 100644 index 000000000000..19d889bffe21 --- /dev/null +++ b/eslint/babel-eslint-plugin-development/src/utils/is-babel-plugin-factory.js @@ -0,0 +1,24 @@ +import getReferenceOrigin from "./get-reference-origin"; +import getExportName from "./get-export-name"; + +export default function isBabelPluginFactory(node, scope) { + const { parent } = node; + + if (parent.type === "CallExpression") { + const calleeOrigin = getReferenceOrigin(parent.callee, scope); + + // Using "declare" from "@babel/helper-plugin-utils" + return !!( + calleeOrigin && + calleeOrigin.kind === "import" && + calleeOrigin.name === "declare" && + calleeOrigin.source === "@babel/helper-plugin-utils" + ); + } + + const exportName = getExportName(node); + + // export default function ({ types: t }) {} + // module.exports = function ({ types: t }) {} + return exportName === "default" || exportName === "module.exports"; +} diff --git a/eslint/babel-eslint-plugin-development/src/utils/is-from-babel-types.js b/eslint/babel-eslint-plugin-development/src/utils/is-from-babel-types.js new file mode 100644 index 000000000000..4a7a24bca040 --- /dev/null +++ b/eslint/babel-eslint-plugin-development/src/utils/is-from-babel-types.js @@ -0,0 +1,33 @@ +import isBabelPluginFactory from "./is-babel-plugin-factory"; + +// Check if a ReferenceOrigin (returned by ./get-reference-origin.js) +// is a reference to a @babel/types export. +export default function isFromBabelTypes( + origin /*: ReferenceOrigin */, + scope /*: Scope */, +) { + if (origin.kind === "import" && origin.source === "@babel/types") { + // imported from @babel/types + return true; + } + + if ( + origin.kind === "property" && + origin.base.kind === "import" && + origin.base.name === "types" && + origin.base.source === "@babel/core" + ) { + // imported from @babel/core + return true; + } + + if ( + origin.kind === "property" && + origin.base.kind === "param" && + origin.base.index === 0 + ) { + return isBabelPluginFactory(origin.base.functionNode, scope); + } + + return false; +} diff --git a/eslint/babel-eslint-plugin-development/test/rules/no-deprecated-clone.js b/eslint/babel-eslint-plugin-development/test/rules/no-deprecated-clone.js new file mode 100644 index 000000000000..9905bc170f0c --- /dev/null +++ b/eslint/babel-eslint-plugin-development/test/rules/no-deprecated-clone.js @@ -0,0 +1,136 @@ +import rule from "../../src/rules/no-deprecated-clone"; +import { RuleTester } from "eslint"; + +const cloneError = "t.clone() is deprecated. Use t.cloneNode() instead."; +const cloneDeepError = + "t.cloneDeep() is deprecated. Use t.cloneNode() instead."; + +const ruleTester = new RuleTester({ + parserOptions: { sourceType: "module" }, +}); + +ruleTester.run("no-deprecated-clone", rule, { + valid: [ + `_.clone(obj)`, + `_.cloneDeep(obj)`, + `import * as t from "lib"; t.clone();`, + `import * as t from "lib"; t.cloneDeep();`, + `function f(_) { _.types.clone(); }`, + `function f(_) { _.types.cloneDeep(); }`, + `import * as t from "@babel/types"; t.cloneNode();`, + ], + invalid: [ + { + code: `import { clone } from "@babel/types"; clone();`, + errors: [cloneError], + }, + { + code: `import { cloneDeep } from "@babel/types"; cloneDeep();`, + errors: [cloneDeepError], + }, + { + code: `import { clone } from "@babel/types"; var clone2 = clone; clone2();`, + errors: [cloneError], + }, + { + code: `import { cloneDeep } from "@babel/types"; var cloneDeep2 = cloneDeep; cloneDeep2();`, + errors: [cloneDeepError], + }, + { + code: `import * as t from "@babel/types"; t.clone();`, + errors: [cloneError], + }, + { + code: `import * as t from "@babel/types"; t.cloneDeep();`, + errors: [cloneDeepError], + }, + { + code: `import * as t from "@babel/types"; var { clone } = t; clone();`, + errors: [cloneError], + }, + { + code: `import * as t from "@babel/types"; var { cloneDeep } = t; cloneDeep();`, + errors: [cloneDeepError], + }, + { + code: `import { clone as c } from "@babel/types"; c();`, + errors: [cloneError], + }, + { + code: `import { cloneDeep as cD } from "@babel/types"; cD();`, + errors: [cloneDeepError], + }, + { + code: `import * as babel from "@babel/core"; babel.types.clone();`, + errors: [cloneError], + }, + { + code: `import * as babel from "@babel/core"; babel.types.cloneDeep();`, + errors: [cloneDeepError], + }, + { + code: `import { types } from "@babel/core"; types.clone();`, + errors: [cloneError], + }, + { + code: `import { types } from "@babel/core"; types.cloneDeep();`, + errors: [cloneDeepError], + }, + { + code: `import { types as t } from "@babel/core"; t.clone();`, + errors: [cloneError], + }, + { + code: `import { types as t } from "@babel/core"; t.cloneDeep();`, + errors: [cloneDeepError], + }, + { + code: `export default function plugin(babel) { babel.types.clone() }`, + errors: [cloneError], + }, + { + code: `export default function plugin(babel) { babel.types.cloneDeep() }`, + errors: [cloneDeepError], + }, + { + code: `export default function plugin({ types }) { types.clone() }`, + errors: [cloneError], + }, + { + code: `export default function plugin({ types }) { types.cloneDeep() }`, + errors: [cloneDeepError], + }, + { + code: `export default function plugin({ types: t }) { t.clone() }`, + errors: [cloneError], + }, + { + code: `export default function plugin({ types: t }) { t.cloneDeep() }`, + errors: [cloneDeepError], + }, + { + code: `export default ({ types }) => { types.clone() }`, + errors: [cloneError], + }, + { + code: `export default ({ types }) => { types.cloneDeep() }`, + errors: [cloneDeepError], + }, + { + code: `module.exports = function plugin({ types }) { types.clone() }`, + errors: [cloneError], + }, + { + code: `module.exports = function plugin({ types }) { types.cloneDeep() }`, + errors: [cloneDeepError], + }, + { + code: `import { declare } from "@babel/helper-plugin-utils"; declare(({ types }) => { types.clone() });`, + errors: [cloneError], + }, + { + code: `import { declare } from "@babel/helper-plugin-utils"; declare(({ types }) => { types.cloneDeep() });`, + errors: [cloneDeepError], + }, + ], +}); diff --git a/eslint/babel-eslint-plugin-development/test/rules/no-undefined-identifier.js b/eslint/babel-eslint-plugin-development/test/rules/no-undefined-identifier.js new file mode 100644 index 000000000000..d6d8c6b28b6b --- /dev/null +++ b/eslint/babel-eslint-plugin-development/test/rules/no-undefined-identifier.js @@ -0,0 +1,78 @@ +import rule from "../../src/rules/no-undefined-identifier"; +import { RuleTester } from "eslint"; + +const error = + "Use path.scope.buildUndefinedNode() to create an undefined identifier directly."; + +const ruleTester = new RuleTester({ + parserOptions: { sourceType: "module" }, +}); + +ruleTester.run("no-undefined-identifier", rule, { + valid: [ + `_.identifier("undefined")`, + `_.Identifier("undefined")`, + `import * as t from "lib"; t.identifier("undefined");`, + `function f(_) { _.types.identifier("undefined"); }`, + `import * as t from "@babel/types"; t.identifier("not_undefined");`, + `path.scope.buildUndefinedNode();`, + ], + invalid: [ + { + code: `import { identifier } from "@babel/types"; identifier("undefined");`, + errors: [error], + }, + { + code: `import { Identifier } from "@babel/types"; Identifier("undefined");`, + errors: [error], + }, + { + code: `import * as t from "@babel/types"; t.identifier("undefined");`, + errors: [error], + }, + { + code: `import * as t from "@babel/types"; var { identifier } = t; identifier("undefined");`, + errors: [error], + }, + { + code: `import { identifier as id } from "@babel/types"; id("undefined");`, + errors: [error], + }, + { + code: `import * as babel from "@babel/core"; babel.types.identifier("undefined");`, + errors: [error], + }, + { + code: `import { types } from "@babel/core"; types.identifier("undefined");`, + errors: [error], + }, + { + code: `import { types as t } from "@babel/core"; t.identifier("undefined");`, + errors: [error], + }, + { + code: `export default function plugin(babel) { babel.types.identifier("undefined") }`, + errors: [error], + }, + { + code: `export default function plugin({ types }) { types.identifier("undefined") }`, + errors: [error], + }, + { + code: `export default function plugin({ types: t }) { t.identifier("undefined") }`, + errors: [error], + }, + { + code: `export default ({ types }) => { types.identifier("undefined") }`, + errors: [error], + }, + { + code: `module.exports = function plugin({ types }) { types.identifier("undefined") }`, + errors: [error], + }, + { + code: `import { declare } from "@babel/helper-plugin-utils"; declare(({ types }) => { types.identifier("undefined") });`, + errors: [error], + }, + ], +}); diff --git a/eslint/babel-eslint-plugin-development/test/rules/plugin-name.js b/eslint/babel-eslint-plugin-development/test/rules/plugin-name.js new file mode 100644 index 000000000000..d39924efe752 --- /dev/null +++ b/eslint/babel-eslint-plugin-development/test/rules/plugin-name.js @@ -0,0 +1,52 @@ +import rule from "../../src/rules/plugin-name"; +import { RuleTester } from "eslint"; + +const missingPluginError = "This file does not export a Babel plugin."; +const missingNameError = "This Babel plugin doesn't have a 'name' property."; + +const ruleTester = new RuleTester({ + parserOptions: { sourceType: "module" }, +}); + +ruleTester.run("plugin-name", rule, { + valid: [ + `export default function () { return { name: "test-plugin" } }`, + `import { declare } from "@babel/helper-plugin-utils"; declare(() => { return { name: "test-plugin" } })`, + `import { declare } from "@babel/helper-plugin-utils"; declare(() => ({ name: "test-plugin" }))`, + `module.exports = function () { return { name: "foo" }; }`, + ], + invalid: [ + { + code: `function fn() { return { name: "foo" } }`, + errors: [missingPluginError], + }, + { + code: `export function fn() { return { name: "foo" } }`, + errors: [missingPluginError], + }, + { + code: `(function fn() { return { name: "foo" } })`, + errors: [missingPluginError], + }, + { + code: `() => { return { name: "foo" } }`, + errors: [missingPluginError], + }, + { + code: `export default function fn() {}`, + errors: [missingPluginError], + }, + { + code: `export default function fn() { return {} }`, + errors: [missingNameError], + }, + { + code: `import { declare } from "@babel/helper-plugin-utils"; declare(() => ({}))`, + errors: [missingNameError], + }, + { + code: `module.exports = function () { return {} }`, + errors: [missingNameError], + }, + ], +}); diff --git a/eslint/babel-eslint-plugin/.npmignore b/eslint/babel-eslint-plugin/.npmignore new file mode 100644 index 000000000000..ad69326ce8c2 --- /dev/null +++ b/eslint/babel-eslint-plugin/.npmignore @@ -0,0 +1,4 @@ +src +test +.* +*.log diff --git a/eslint/babel-eslint-plugin/LICENSE b/eslint/babel-eslint-plugin/LICENSE new file mode 100644 index 000000000000..3d0e2f3067b8 --- /dev/null +++ b/eslint/babel-eslint-plugin/LICENSE @@ -0,0 +1,23 @@ +Copyright (c) 2014-2015 Jason Quense +Original work by respective rule authors; copywrites noted in files. + +MIT License + +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. \ No newline at end of file diff --git a/eslint/babel-eslint-plugin/README.md b/eslint/babel-eslint-plugin/README.md new file mode 100644 index 000000000000..cb9eb4e4df43 --- /dev/null +++ b/eslint/babel-eslint-plugin/README.md @@ -0,0 +1,49 @@ +# @babel/eslint-plugin + +## This project is still experimental and will be released with Babel v8. You can track our progress [here](https://github.com/babel/babel/issues/10752)! Please use [eslint-plugin-babel](https://github.com/babel/eslint-plugin-babel) in the meantime. + +Companion rules for `@babel/eslint-parser`. `@babel/eslint-parser` does a great job at adapting `eslint` +for use with Babel, but it can't change the built-in rules to support experimental features. +`@babel/eslint-plugin` re-implements problematic rules so they do not give false positives or negatives. + +> Requires Node 10.9 or greater + +### Install + +```sh +npm install @babel/eslint-plugin --save-dev +``` + +Load the plugin in your `.eslintrc.json` file: + +```json +{ + "plugins": ["@babel/eslint-plugin"] +} +``` + +Finally enable all the rules you would like to use (remember to disable the +original ones as well!). + +```json +{ + "rules": { + "babel/new-cap": "error", + "babel/no-invalid-this": "error", + "babel/no-unused-expressions": "error", + "babel/object-curly-spacing": "error", + "babel/semi": "error", + } +} +``` +### Rules + +Each rule corresponds to a core `eslint` rule and has the same options. + +🛠: means it's autofixable with `--fix`. + +- `babel/new-cap`: handles decorators (`@Decorator`) +- `babel/no-invalid-this`: handles class fields and private class methods (`class A { a = this.b; }`) +- `babel/no-unused-expressions`: handles `do` expressions +- `babel/object-curly-spacing`: handles `export * as x from "mod";` (🛠) +- `babel/semi`: Handles class properties (🛠) diff --git a/eslint/babel-eslint-plugin/package.json b/eslint/babel-eslint-plugin/package.json new file mode 100644 index 000000000000..f259174f472b --- /dev/null +++ b/eslint/babel-eslint-plugin/package.json @@ -0,0 +1,41 @@ +{ + "name": "@babel/eslint-plugin", + "version": "0.0.0", + "description": "Companion rules for @babel/eslint-parser", + "main": "lib/index.js", + "repository": { + "type": "git", + "url": "git+https://github.com/babel/babel.git", + "directory": "eslint/babel-eslint-plugin" + }, + "keywords": [ + "babel", + "eslint", + "eslintplugin", + "eslint-plugin", + "babel-eslint" + ], + "author": "Jason Quense @monasticpanic", + "license": "MIT", + "private": true, + "engines": { + "node": ">=10.9" + }, + "bugs": { + "url": "https://github.com/babel/babel/issues" + }, + "homepage": "https://github.com/babel/babel/tree/master/eslint/babel-eslint-plugin", + "peerDependencies": { + "@babel/eslint-parser": "0.0.0", + "eslint": ">=6.0.0" + }, + "dependencies": { + "eslint-rule-composer": "^0.3.0" + }, + "devDependencies": { + "@babel/eslint-shared-fixtures": "*", + "@babel/eslint-parser": "*", + "eslint": "^6.0.0", + "lodash.clonedeep": "^4.5.0" + } +} diff --git a/eslint/babel-eslint-plugin/src/index.js b/eslint/babel-eslint-plugin/src/index.js new file mode 100644 index 000000000000..96fd40caf70e --- /dev/null +++ b/eslint/babel-eslint-plugin/src/index.js @@ -0,0 +1,22 @@ +import newCap from "./rules/new-cap"; +import noInvalidThis from "./rules/no-invalid-this"; +import noUnusedExpressions from "./rules/no-unused-expressions"; +import objectCurlySpacing from "./rules/object-curly-spacing"; +import semi from "./rules/semi"; + +module.exports = { + rules: { + "new-cap": newCap, + "no-invalid-this": noInvalidThis, + "no-unused-expressions": noUnusedExpressions, + "object-curly-spacing": objectCurlySpacing, + semi, + }, + rulesConfig: { + "new-cap": "off", + "no-invalid-this": "off", + "no-unused-expressions": "off", + "object-curly-spacing": "off", + semi: "off", + }, +}; diff --git a/eslint/babel-eslint-plugin/src/rules/new-cap.js b/eslint/babel-eslint-plugin/src/rules/new-cap.js new file mode 100644 index 000000000000..1fddf1a43b5a --- /dev/null +++ b/eslint/babel-eslint-plugin/src/rules/new-cap.js @@ -0,0 +1,18 @@ +import ruleComposer from "eslint-rule-composer"; +import eslint from "eslint"; + +const rule = new eslint.Linter().getRules().get("new-cap"); + +/** + * Returns whether a node is under a decorator or not. + * @param {ASTNode} node CallExpression node + * @returns {Boolean} Returns true if the node is under a decorator. + */ +function isDecorator(node) { + return node.parent.type === "Decorator"; +} + +export default ruleComposer.filterReports( + rule, + problem => !isDecorator(problem.node), +); diff --git a/eslint/babel-eslint-plugin/src/rules/no-invalid-this.js b/eslint/babel-eslint-plugin/src/rules/no-invalid-this.js new file mode 100644 index 000000000000..4c6434235c2a --- /dev/null +++ b/eslint/babel-eslint-plugin/src/rules/no-invalid-this.js @@ -0,0 +1,20 @@ +import ruleComposer from "eslint-rule-composer"; +import eslint from "eslint"; + +const noInvalidThisRule = new eslint.Linter().getRules().get("no-invalid-this"); + +export default ruleComposer.filterReports(noInvalidThisRule, problem => { + let inClassProperty = false; + let node = problem.node; + + while (node) { + if (node.type === "ClassProperty" || node.type === "ClassPrivateProperty") { + inClassProperty = true; + return; + } + + node = node.parent; + } + + return !inClassProperty; +}); diff --git a/eslint/babel-eslint-plugin/src/rules/no-unused-expressions.js b/eslint/babel-eslint-plugin/src/rules/no-unused-expressions.js new file mode 100644 index 000000000000..a313b0743245 --- /dev/null +++ b/eslint/babel-eslint-plugin/src/rules/no-unused-expressions.js @@ -0,0 +1,64 @@ +import ruleComposer from "eslint-rule-composer"; +import eslint from "eslint"; + +const rule = new eslint.Linter().getRules().get("no-unused-expressions"); + +/** + * @param {ASTNode} node - any node + * @returns {boolean} whether the given node is either an IfStatement or an + * ExpressionStatement and is the last node in the body of a BlockStatement + */ +function isFinalStatementInBlockStatement(node) { + const parent = node.parent; + return ( + /^(?:If|Expression)Statement$/.test(node.type) && + parent.type === "BlockStatement" && + parent.body[parent.body.length - 1] === node + ); +} + +/** + * @param {ASTNode} node - any node + * @returns {boolean} whether the given node represents an unbroken chain of + * tail ExpressionStatements and IfStatements within a DoExpression + * https://github.com/tc39/proposal-do-expressions + */ +function isInDoStatement(node) { + if (!node) return false; + + if (node.type === "DoExpression") return true; + + // this is an `else if` + if ( + node.type === "IfStatement" && + node.parent && + node.parent.type === "IfStatement" + ) { + return isInDoStatement(node.parent); + } + + if (isFinalStatementInBlockStatement(node)) { + return isInDoStatement(node.parent.parent); + } + + return false; +} + +/** + * @param {ASTNode} node - any node + * @returns {boolean} whether the given node is an optional call expression, + * https://github.com/tc39/proposal-optional-chaining + */ +function isOptionalCallExpression(node) { + return ( + !!node && + node.type === "ExpressionStatement" && + node.expression.type === "OptionalCallExpression" + ); +} + +export default ruleComposer.filterReports( + rule, + problem => + !isInDoStatement(problem.node) && !isOptionalCallExpression(problem.node), +); diff --git a/eslint/babel-eslint-plugin/src/rules/object-curly-spacing.js b/eslint/babel-eslint-plugin/src/rules/object-curly-spacing.js new file mode 100644 index 000000000000..210f7a9fe5fa --- /dev/null +++ b/eslint/babel-eslint-plugin/src/rules/object-curly-spacing.js @@ -0,0 +1,20 @@ +import ruleComposer from "eslint-rule-composer"; +import eslint from "eslint"; + +const rule = new eslint.Linter().getRules().get("object-curly-spacing"); + +export default ruleComposer.filterReports(rule, problem => { + const node = problem.node; + + // Allow exportDefaultFrom syntax: + // export x from '...'; + if ( + node.type === "ExportNamedDeclaration" && + node.specifiers.length === 1 && + node.specifiers[0].type === "ExportDefaultSpecifier" + ) { + return false; + } + + return true; +}); diff --git a/eslint/babel-eslint-plugin/src/rules/semi.js b/eslint/babel-eslint-plugin/src/rules/semi.js new file mode 100644 index 000000000000..f8cc783ac64a --- /dev/null +++ b/eslint/babel-eslint-plugin/src/rules/semi.js @@ -0,0 +1,105 @@ +import ruleComposer from "eslint-rule-composer"; +import eslint from "eslint"; + +const OPT_OUT_PATTERN = /^[-[(/+`]/; // One of [(/+-` + +const rule = new eslint.Linter().getRules().get("semi"); + +function isSemicolon(token) { + return token.type === "Punctuator" && token.value === ";"; +} + +function isUnnecessarySemicolon(context, lastToken) { + if (!isSemicolon(lastToken)) { + return false; + } + + const nextToken = context.getSourceCode().getTokenAfter(lastToken); + + if (!nextToken) { + return true; + } + + const lastTokenLine = lastToken.loc.end.line; + const nextTokenLine = nextToken.loc.start.line; + const isOptOutToken = + OPT_OUT_PATTERN.test(nextToken.value) && + nextToken.value !== "++" && + nextToken.value !== "--"; + const isDivider = nextToken.value === "}" || nextToken.value === ";"; + + return (lastTokenLine !== nextTokenLine && !isOptOutToken) || isDivider; +} + +function isOneLinerBlock(context, node) { + const nextToken = context.getSourceCode().getTokenAfter(node); + + if (!nextToken || nextToken.value !== "}") { + return false; + } + + const parent = node.parent; + + return ( + parent && + parent.type === "BlockStatement" && + parent.loc.start.line === parent.loc.end.line + ); +} + +function report(context, node, missing) { + const lastToken = context.getSourceCode().getLastToken(node); + + let message, + fix, + loc = lastToken.loc; + + if (!missing) { + message = "Missing semicolon."; + loc = loc.end; + fix = function(fixer) { + return fixer.insertTextAfter(lastToken, ";"); + }; + } else { + message = "Extra semicolon."; + loc = loc.start; + fix = function(fixer) { + return fixer.remove(lastToken); + }; + } + + context.report({ + node, + loc, + message, + fix, + }); +} + +export default ruleComposer.joinReports([ + rule, + context => ({ + ClassProperty(node) { + const options = context.options[1]; + const exceptOneLine = options && options.omitLastInOneLineBlock === true; + const sourceCode = context.getSourceCode(); + const lastToken = sourceCode.getLastToken(node); + + if (context.options[0] === "never") { + if (isUnnecessarySemicolon(context, lastToken)) { + report(context, node, true); + } + } else { + if (!isSemicolon(lastToken)) { + if (!exceptOneLine || !isOneLinerBlock(context, node)) { + report(context, node); + } + } else { + if (exceptOneLine && isOneLinerBlock(context, node)) { + report(context, node, true); + } + } + } + }, + }), +]); diff --git a/eslint/babel-eslint-plugin/test/helpers/RuleTester.js b/eslint/babel-eslint-plugin/test/helpers/RuleTester.js new file mode 100644 index 000000000000..47166bd51185 --- /dev/null +++ b/eslint/babel-eslint-plugin/test/helpers/RuleTester.js @@ -0,0 +1,14 @@ +import { RuleTester } from "eslint"; + +RuleTester.setDefaultConfig({ + parser: require.resolve("@babel/eslint-parser"), + parserOptions: { + babelOptions: { + configFile: require.resolve( + "@babel/eslint-shared-fixtures/config/babel.config.js", + ), + }, + }, +}); + +export default RuleTester; diff --git a/eslint/babel-eslint-plugin/test/rules/new-cap.js b/eslint/babel-eslint-plugin/test/rules/new-cap.js new file mode 100644 index 000000000000..d5e44984152e --- /dev/null +++ b/eslint/babel-eslint-plugin/test/rules/new-cap.js @@ -0,0 +1,12 @@ +import rule from "../../src/rules/new-cap"; +import RuleTester from "../helpers/RuleTester"; + +const ruleTester = new RuleTester(); +ruleTester.run("@babel/new-cap", rule, { + valid: [ + { + code: "@MyDecorator(123) class MyClass{}", + }, + ], + invalid: [], +}); diff --git a/eslint/babel-eslint-plugin/test/rules/no-invalid-this.js b/eslint/babel-eslint-plugin/test/rules/no-invalid-this.js new file mode 100644 index 000000000000..7773aed80683 --- /dev/null +++ b/eslint/babel-eslint-plugin/test/rules/no-invalid-this.js @@ -0,0 +1,116 @@ +import cloneDeep from "lodash.clonedeep"; +import rule from "../../src/rules/no-invalid-this"; +import RuleTester from "../helpers/RuleTester"; + +/** + * A constant value for non strict mode environment. + * @returns {void} + */ +function NORMAL(pattern) { + pattern.parserOptions.sourceType = "script"; +} + +/** + * A constant value for strict mode environment. + * This modifies pattern object to make strict mode. + * @param {Object} pattern - A pattern object to modify. + * @returns {void} + */ +function USE_STRICT(pattern) { + pattern.code = '"use strict"; ' + pattern.code; +} + +/** + * A constant value for implied strict mode. + * This modifies pattern object to impose strict mode. + * @param {Object} pattern - A pattern object to modify. + * @returns {void} + */ +function IMPLIED_STRICT(pattern) { + pattern.code = "/* implied strict mode */ " + pattern.code; + pattern.parserOptions.ecmaFeatures = pattern.parserOptions.ecmaFeatures || {}; + pattern.parserOptions.ecmaFeatures.impliedStrict = true; +} + +/** + * A constant value for modules environment. + * This modifies pattern object to make modules. + * @param {Object} pattern - A pattern object to modify. + * @returns {void} + */ +function MODULES(pattern) { + pattern.code = "/* modules */ " + pattern.code; +} + +/** + * Extracts patterns each condition for a specified type. The type is `valid` or `invalid`. + * @param {Object[]} patterns - Original patterns. + * @param {string} type - One of `"valid"` or `"invalid"`. + * @returns {Object[]} Test patterns. + */ +function extractPatterns(patterns, type) { + // Clone and apply the pattern environment. + const patternsList = patterns.map(function(pattern) { + return pattern[type].map(function(applyCondition) { + const thisPattern = cloneDeep(pattern); + + applyCondition(thisPattern); + + if (type === "valid") { + thisPattern.errors = []; + } else { + thisPattern.code += " /* should error */"; + } + + delete thisPattern.invalid; + delete thisPattern.valid; + + return thisPattern; + }); + }); + + // Flatten. + return Array.prototype.concat.apply([], patternsList); +} + +//------------------------------------------------------------------------------ +// Tests +//------------------------------------------------------------------------------ + +const patterns = [ + // Class private fields + { + code: "class A {a = this.b;};", + parserOptions: { ecmaVersion: 6 }, + valid: [NORMAL, USE_STRICT, IMPLIED_STRICT, MODULES], + invalid: [], + }, + + { + code: "class A {a = () => {return this.b;};};", + parserOptions: { ecmaVersion: 6 }, + valid: [NORMAL, USE_STRICT, IMPLIED_STRICT, MODULES], + invalid: [], + }, + + // Class Private methods + { + code: "class A {#a = this.b;};", + parserOptions: { ecmaVersion: 6 }, + valid: [NORMAL, USE_STRICT, IMPLIED_STRICT, MODULES], + invalid: [], + }, + + { + code: "class A {#a = () => {return this.b;};};", + parserOptions: { ecmaVersion: 6 }, + valid: [NORMAL, USE_STRICT, IMPLIED_STRICT, MODULES], + invalid: [], + }, +]; + +const ruleTester = new RuleTester(); +ruleTester.run("@babel/no-invalid-this", rule, { + valid: extractPatterns(patterns, "valid"), + invalid: extractPatterns(patterns, "invalid"), +}); diff --git a/eslint/babel-eslint-plugin/test/rules/no-unused-expressions.js b/eslint/babel-eslint-plugin/test/rules/no-unused-expressions.js new file mode 100644 index 000000000000..991bf6fa80b4 --- /dev/null +++ b/eslint/babel-eslint-plugin/test/rules/no-unused-expressions.js @@ -0,0 +1,37 @@ +import rule from "../../src/rules/no-unused-expressions"; +import RuleTester from "../helpers/RuleTester"; + +const ruleTester = new RuleTester(); +ruleTester.run("@babel/no-unused-expressions", rule, { + valid: [ + "let a = do { if (foo) { foo.bar; } }", + "let a = do { foo; }", + "let a = do { let b = 2; foo; }", + "let a = do { (foo + 1); }", + "let a = do { if (foo) { if (foo.bar) { foo.bar; } } }", + "let a = do { if (foo) { if (foo.bar) { foo.bar; } else if (foo.baz) { foo.baz; } } }", + "foo.bar?.();", + ], + invalid: [ + { + code: "let a = do { foo; let b = 2; }", + errors: [ + { + message: + "Expected an assignment or function call and instead saw an expression.", + type: "ExpressionStatement", + }, + ], + }, + { + code: "let a = do { if (foo) { foo.bar } else { a; bar.foo } }", + errors: [ + { + message: + "Expected an assignment or function call and instead saw an expression.", + type: "ExpressionStatement", + }, + ], + }, + ], +}); diff --git a/eslint/babel-eslint-plugin/test/rules/object-curly-spacing.js b/eslint/babel-eslint-plugin/test/rules/object-curly-spacing.js new file mode 100644 index 000000000000..8a08a09516c7 --- /dev/null +++ b/eslint/babel-eslint-plugin/test/rules/object-curly-spacing.js @@ -0,0 +1,13 @@ +import rule from "../../src/rules/object-curly-spacing"; +import RuleTester from "../helpers/RuleTester"; + +const ruleTester = new RuleTester(); +ruleTester.run("@babel/object-curly-spacing", rule, { + valid: [ + { + code: 'export x from "mod";', + }, + ], + + invalid: [], +}); diff --git a/eslint/babel-eslint-plugin/test/rules/semi.js b/eslint/babel-eslint-plugin/test/rules/semi.js new file mode 100644 index 000000000000..d7a757b62616 --- /dev/null +++ b/eslint/babel-eslint-plugin/test/rules/semi.js @@ -0,0 +1,52 @@ +import rule from "../../src/rules/semi"; +import RuleTester from "../helpers/RuleTester"; + +const ruleTester = new RuleTester(); + +ruleTester.run("semi", rule, { + valid: [ + "class Foo { bar = 'example'; }", + "class Foo { static bar = 'example'; }", + { + code: "class Foo { bar = () => {}; }", + options: ["always", { omitLastInOneLineBlock: true }], + }, + + // never + { code: "class Foo { bar = 'example' }", options: ["never"] }, + { code: "class Foo { static bar = 'example' }", options: ["never"] }, + { code: "class Foo { bar = () => {} }", options: ["never"] }, + ], + invalid: [ + { + code: "class Foo { bar = 'example' }", + errors: [{ message: "Missing semicolon." }], + }, + { + code: "class Foo { static bar = 'example' }", + errors: [{ message: "Missing semicolon." }], + }, + { + code: "class Foo { bar = () => {} }", + options: ["always", { omitLastInOneLineBlock: true }], + errors: [{ message: "Missing semicolon." }], + }, + + // "never" + { + code: "class Foo { bar = 'example'; }", + options: ["never"], + errors: [{ message: "Extra semicolon." }], + }, + { + code: "class Foo { static bar = 'example'; }", + options: ["never"], + errors: [{ message: "Extra semicolon." }], + }, + { + code: "class Foo { bar = () => {}; }", + options: ["never"], + errors: [{ message: "Extra semicolon." }], + }, + ], +}); diff --git a/eslint/babel-eslint-shared-fixtures/config/babel.config.decorators-legacy.js b/eslint/babel-eslint-shared-fixtures/config/babel.config.decorators-legacy.js new file mode 100644 index 000000000000..dbad846412e6 --- /dev/null +++ b/eslint/babel-eslint-shared-fixtures/config/babel.config.decorators-legacy.js @@ -0,0 +1,6 @@ +"use strict"; + +module.exports = { + presets: [["@babel/preset-env", { forceAllTransforms: true }]], + plugins: [["@babel/plugin-proposal-decorators", { legacy: true }]], +}; diff --git a/eslint/babel-eslint-shared-fixtures/config/babel.config.js b/eslint/babel-eslint-shared-fixtures/config/babel.config.js new file mode 100644 index 000000000000..202b888fe7b1 --- /dev/null +++ b/eslint/babel-eslint-shared-fixtures/config/babel.config.js @@ -0,0 +1,24 @@ +"use strict"; + +module.exports = { + presets: [ + ["@babel/preset-env", { forceAllTransforms: true }], + ["@babel/preset-flow", { all: true }], + "@babel/preset-react", + ], + plugins: [ + "@babel/plugin-syntax-dynamic-import", + "@babel/plugin-syntax-import-meta", + "@babel/plugin-syntax-export-default-from", + "@babel/plugin-proposal-class-properties", + "@babel/plugin-proposal-nullish-coalescing-operator", + "@babel/plugin-proposal-optional-chaining", + "@babel/plugin-syntax-numeric-separator", + "@babel/plugin-syntax-export-namespace-from", + ["@babel/plugin-proposal-decorators", { decoratorsBeforeExport: false }], + ["@babel/plugin-proposal-pipeline-operator", { proposal: "minimal" }], + "@babel/plugin-syntax-bigint", + "@babel/plugin-proposal-private-methods", + "@babel/plugin-proposal-do-expressions", + ], +}; diff --git a/eslint/babel-eslint-shared-fixtures/package.json b/eslint/babel-eslint-shared-fixtures/package.json new file mode 100644 index 000000000000..96bbb96dde67 --- /dev/null +++ b/eslint/babel-eslint-shared-fixtures/package.json @@ -0,0 +1,25 @@ +{ + "name": "@babel/eslint-shared-fixtures", + "version": "0.0.0", + "description": "Shared fixtures for testing @babel/eslint-* packages", + "license": "MIT", + "private": true, + "dependencies": { + "@babel/plugin-proposal-class-properties": "^7.1.0", + "@babel/plugin-proposal-decorators": "^7.1.2", + "@babel/plugin-proposal-do-expressions": "^7.7.4", + "@babel/plugin-proposal-nullish-coalescing-operator": "^7.0.0", + "@babel/plugin-proposal-optional-chaining": "^7.0.0", + "@babel/plugin-proposal-pipeline-operator": "^7.0.0", + "@babel/plugin-proposal-private-methods": "^7.7.4", + "@babel/plugin-syntax-bigint": "^7.7.4", + "@babel/plugin-syntax-dynamic-import": "^7.0.0", + "@babel/plugin-syntax-export-default-from": "^7.0.0", + "@babel/plugin-syntax-export-namespace-from": "^7.0.0", + "@babel/plugin-syntax-import-meta": "^7.0.0", + "@babel/plugin-syntax-numeric-separator": "^7.0.0", + "@babel/preset-env": "^7.1.5", + "@babel/preset-flow": "^7.0.0", + "@babel/preset-react": "^7.0.0" + } +} diff --git a/eslint/babel-eslint-tests/package.json b/eslint/babel-eslint-tests/package.json new file mode 100644 index 000000000000..edcabd8bbe04 --- /dev/null +++ b/eslint/babel-eslint-tests/package.json @@ -0,0 +1,15 @@ +{ + "name": "@babel/eslint-tests", + "version": "0.0.0", + "description": "Tests for babel/eslint-* packages", + "license": "MIT", + "private": true, + "devDependencies": { + "@babel/eslint-parser": "*", + "@babel/eslint-plugin": "*", + "@babel/eslint-shared-fixtures": "*", + "dedent": "^0.7.0", + "eslint": "^6.0.0", + "eslint-plugin-import": "^2.20.1" + } +} diff --git a/eslint/babel-eslint-tests/test/fixtures/eslint-plugin-import/.eslintrc.yml b/eslint/babel-eslint-tests/test/fixtures/eslint-plugin-import/.eslintrc.yml new file mode 100644 index 000000000000..861dfa917f87 --- /dev/null +++ b/eslint/babel-eslint-tests/test/fixtures/eslint-plugin-import/.eslintrc.yml @@ -0,0 +1,7 @@ +root: true +parser: "@babel/eslint-parser" +plugins: + - import +rules: + import/no-named-as-default: error + no-unused-vars: error diff --git a/eslint/babel-eslint-tests/test/fixtures/eslint-plugin-import/a.js b/eslint/babel-eslint-tests/test/fixtures/eslint-plugin-import/a.js new file mode 100644 index 000000000000..e8d96fc4d62d --- /dev/null +++ b/eslint/babel-eslint-tests/test/fixtures/eslint-plugin-import/a.js @@ -0,0 +1 @@ +export default function foo() { } diff --git a/eslint/babel-eslint-tests/test/fixtures/eslint-plugin-import/b.js b/eslint/babel-eslint-tests/test/fixtures/eslint-plugin-import/b.js new file mode 100644 index 000000000000..b3a52f870198 --- /dev/null +++ b/eslint/babel-eslint-tests/test/fixtures/eslint-plugin-import/b.js @@ -0,0 +1 @@ +import foo from './a.js'; diff --git a/eslint/babel-eslint-tests/test/fixtures/eslint-plugin-import/c.js b/eslint/babel-eslint-tests/test/fixtures/eslint-plugin-import/c.js new file mode 100644 index 000000000000..2beac98f3b74 --- /dev/null +++ b/eslint/babel-eslint-tests/test/fixtures/eslint-plugin-import/c.js @@ -0,0 +1,4 @@ +// @flow +type Foo = {}; + +const FlowTypeButton = ({ }: Foo) => { }; diff --git a/eslint/babel-eslint-tests/test/fixtures/rules/strict/function-with.js b/eslint/babel-eslint-tests/test/fixtures/rules/strict/function-with.js new file mode 100644 index 000000000000..3df7515269d5 --- /dev/null +++ b/eslint/babel-eslint-tests/test/fixtures/rules/strict/function-with.js @@ -0,0 +1,3 @@ +function x () { + "use strict"; +} diff --git a/eslint/babel-eslint-tests/test/fixtures/rules/strict/function-without.js b/eslint/babel-eslint-tests/test/fixtures/rules/strict/function-without.js new file mode 100644 index 000000000000..20b3e9e55005 --- /dev/null +++ b/eslint/babel-eslint-tests/test/fixtures/rules/strict/function-without.js @@ -0,0 +1 @@ +function x () {} diff --git a/eslint/babel-eslint-tests/test/fixtures/rules/strict/global-with-function-with.js b/eslint/babel-eslint-tests/test/fixtures/rules/strict/global-with-function-with.js new file mode 100644 index 000000000000..ef682f72c947 --- /dev/null +++ b/eslint/babel-eslint-tests/test/fixtures/rules/strict/global-with-function-with.js @@ -0,0 +1,5 @@ +"use strict"; + +function x () { + "use strict"; +} diff --git a/eslint/babel-eslint-tests/test/fixtures/rules/strict/global-with-function-without.js b/eslint/babel-eslint-tests/test/fixtures/rules/strict/global-with-function-without.js new file mode 100644 index 000000000000..206f708141b7 --- /dev/null +++ b/eslint/babel-eslint-tests/test/fixtures/rules/strict/global-with-function-without.js @@ -0,0 +1,3 @@ +"use strict"; + +function x () {} diff --git a/eslint/babel-eslint-tests/test/fixtures/rules/strict/global-with.js b/eslint/babel-eslint-tests/test/fixtures/rules/strict/global-with.js new file mode 100644 index 000000000000..e967aa4994d0 --- /dev/null +++ b/eslint/babel-eslint-tests/test/fixtures/rules/strict/global-with.js @@ -0,0 +1,6 @@ +"use strict"; +/* +The empty statement is intentional. As of now, ESLint won't enforce +string: [2, "global"] on a program with an empty body. A test for that without +massaging the AST to ESlint's input format should fail. +*/ diff --git a/eslint/babel-eslint-tests/test/fixtures/rules/strict/none.js b/eslint/babel-eslint-tests/test/fixtures/rules/strict/none.js new file mode 100644 index 000000000000..4a6db98f6226 --- /dev/null +++ b/eslint/babel-eslint-tests/test/fixtures/rules/strict/none.js @@ -0,0 +1 @@ +"no use strict anywhere"; diff --git a/eslint/babel-eslint-tests/test/helpers/verifyAndAssertMessages.js b/eslint/babel-eslint-tests/test/helpers/verifyAndAssertMessages.js new file mode 100644 index 000000000000..3d94edfd7906 --- /dev/null +++ b/eslint/babel-eslint-tests/test/helpers/verifyAndAssertMessages.js @@ -0,0 +1,69 @@ +import eslint from "eslint"; +import unpad from "dedent"; +import * as parser from "@babel/eslint-parser"; + +export default function verifyAndAssertMessages( + code, + rules = {}, + expectedMessages = [], + sourceType, + overrideConfig, +) { + const linter = new eslint.Linter(); + linter.defineParser("@babel/eslint-parser", parser); + + const messages = linter.verify(unpad(`${code}`), { + parser: "@babel/eslint-parser", + rules, + env: { + node: true, + es6: true, + }, + ...overrideConfig, + parserOptions: { + sourceType, + requireConfigFile: false, + babelOptions: { + configFile: require.resolve( + "@babel/eslint-shared-fixtures/config/babel.config.js", + ), + }, + ...overrideConfig?.parserOptions, + }, + }); + + if (messages.length !== expectedMessages.length) { + throw new Error( + `Expected ${expectedMessages.length} message(s), got ${ + messages.length + }\n${JSON.stringify(messages, null, 2)}`, + ); + } + + messages.forEach((message, i) => { + const formattedMessage = `${message.line}:${message.column} ${ + message.message + }${message.ruleId ? ` ${message.ruleId}` : ""}`; + const expectedMessage = expectedMessages[i]; + + if (expectedMessage instanceof RegExp) { + if (!expectedMessage.test(formattedMessage)) { + throw new Error( + ` + Message ${i} does not pass RegExp test: + Test: ${expectedMessage} + Actual: ${formattedMessage} + `, + ); + } + } else if (formattedMessage !== expectedMessage) { + throw new Error( + ` + Message ${i} does not match: + Expected: ${expectedMessage} + Actual: ${formattedMessage} + `, + ); + } + }); +} diff --git a/eslint/babel-eslint-tests/test/integration/eslint-plugin-import.js b/eslint/babel-eslint-tests/test/integration/eslint-plugin-import.js new file mode 100644 index 000000000000..28aa3d6ac379 --- /dev/null +++ b/eslint/babel-eslint-tests/test/integration/eslint-plugin-import.js @@ -0,0 +1,13 @@ +import eslint from "eslint"; +import path from "path"; + +describe("https://github.com/babel/babel-eslint/issues/558", () => { + it("doesn't crash with eslint-plugin-import", () => { + const engine = new eslint.CLIEngine({ ignore: false }); + engine.executeOnFiles( + ["a.js", "b.js", "c.js"].map(file => + path.resolve(__dirname, `../fixtures/eslint-plugin-import/${file}`), + ), + ); + }); +}); diff --git a/eslint/babel-eslint-tests/test/integration/eslint/eslint.js b/eslint/babel-eslint-tests/test/integration/eslint/eslint.js new file mode 100644 index 000000000000..1a62e20f56a9 --- /dev/null +++ b/eslint/babel-eslint-tests/test/integration/eslint/eslint.js @@ -0,0 +1,1881 @@ +import verifyAndAssertMessages from "../../helpers/verifyAndAssertMessages"; + +describe("verify", () => { + it("arrow function support (issue #1)", () => { + verifyAndAssertMessages("describe('stuff', () => {});"); + }); + + it("EOL validation (issue #2)", () => { + verifyAndAssertMessages( + 'module.exports = "something";', + { "eol-last": 1, semi: 1 }, + ["1:30 Newline required at end of file but not found. eol-last"], + ); + }); + + it("Readable error messages (issue #3)", () => { + verifyAndAssertMessages("{ , res }", {}, [ + /1:2 Parsing error:.*Unexpected token \(1:2\)/, + ]); + }); + + it("Modules support (issue #5)", () => { + verifyAndAssertMessages( + ` + import Foo from 'foo'; + export default Foo; + export const c = 'c'; + export class Store {} + `, + ); + }); + + it("Rest parameters (issue #7)", () => { + verifyAndAssertMessages("function foo(...args) { return args; }", { + "no-undef": 1, + }); + }); + + it("Exported classes should be used (issue #8)", () => { + verifyAndAssertMessages("class Foo {} module.exports = Foo;", { + "no-unused-vars": 1, + }); + }); + + it("super keyword in class (issue #10)", () => { + verifyAndAssertMessages("class Foo { constructor() { super() } }", { + "no-undef": 1, + }); + }); + + it("Rest parameter in destructuring assignment (issue #11)", () => { + verifyAndAssertMessages( + "const [a, ...rest] = ['1', '2', '3']; module.exports = rest;", + { "no-undef": 1 }, + ); + }); + + it("JSX attribute names marked as variables (issue #12)", () => { + verifyAndAssertMessages('module.exports =
', { + "no-undef": 1, + }); + }); + + it("Multiple destructured assignment with compound properties (issue #16)", () => { + verifyAndAssertMessages("module.exports = { ...a.a, ...a.b };", { + "no-dupe-keys": 1, + }); + }); + + it("Arrow function with non-block bodies (issue #20)", () => { + verifyAndAssertMessages( + '"use strict"; () => 1', + { strict: [1, "global"] }, + [], + "script", + { sourceType: "script" }, + ); + }); + + it("#242", () => { + verifyAndAssertMessages('"use strict"; asdf;', { + "no-irregular-whitespace": 1, + }); + }); + + it("await keyword (issue #22)", () => { + verifyAndAssertMessages("async function foo() { await bar(); }", { + "no-unused-expressions": 1, + }); + }); + + it("arrow functions (issue #27)", () => { + verifyAndAssertMessages("[1, 2, 3].map(i => i * 2);", { + "func-names": 1, + "space-before-blocks": 1, + }); + }); + + it("comment with padded-blocks (issue #33)", () => { + verifyAndAssertMessages( + ` + if (a) { + // i'm a comment! + let b = c + } + `, + { "padded-blocks": [1, "never"] }, + ); + }); + + describe("flow", () => { + it("check regular function", () => { + verifyAndAssertMessages( + "function a(b, c) { b += 1; c += 1; return b + c; } a;", + { "no-unused-vars": 1, "no-undef": 1 }, + ); + }); + + it("type alias", () => { + verifyAndAssertMessages("type SomeNewType = any;", { "no-undef": 1 }); + }); + + it("type cast expression #102", () => { + verifyAndAssertMessages("for (let a of (a: Array)) {}"); + }); + + it("multiple nullable type annotations and return #108", () => { + verifyAndAssertMessages( + ` + import type Foo from 'foo'; + import type Foo2 from 'foo'; + import type Foo3 from 'foo'; + function log(foo: ?Foo, foo2: ?Foo2): ?Foo3 { + console.log(foo, foo2); + } + log(1, 2); + `, + { "no-unused-vars": 1, "no-undef": 1 }, + ); + }); + + it("interface declaration", () => { + verifyAndAssertMessages( + ` + interface Foo {}; + interface Bar { + foo: Foo, + }; + `, + { "no-unused-vars": 1, "no-undef": 1 }, + ["2:11 'Bar' is defined but never used. no-unused-vars"], + ); + }); + + it("type parameter bounds (classes)", () => { + verifyAndAssertMessages( + ` + import type {Foo, Foo2} from 'foo'; + import Base from 'base'; + class Log extends Base { + messages: {[T1]: T2}; + } + new Log(); + `, + { "no-unused-vars": 1, "no-undef": 1 }, + ["3:34 'T4' is defined but never used. no-unused-vars"], + ); + }); + + it("type parameter scope (classes)", () => { + verifyAndAssertMessages( + ` + T; + class Foo {} + T; + new Foo(); + `, + { "no-unused-vars": 1, "no-undef": 1 }, + [ + "1:1 'T' is not defined. no-undef", + "2:11 'T' is defined but never used. no-unused-vars", + "3:1 'T' is not defined. no-undef", + ], + ); + }); + + it("type parameter bounds (interfaces)", () => { + verifyAndAssertMessages( + ` + import type {Foo, Foo2, Bar} from ''; + interface Log extends Bar { + messages: {[T1]: T2}; + } + `, + { "no-unused-vars": 1, "no-undef": 1 }, + [ + "2:11 'Log' is defined but never used. no-unused-vars", + "2:38 'T4' is defined but never used. no-unused-vars", + ], + ); + }); + + it("type parameter scope (interfaces)", () => { + verifyAndAssertMessages( + ` + T; + interface Foo {}; + T; + Foo; + `, + { "no-unused-vars": 1, "no-undef": 1 }, + [ + "1:1 'T' is not defined. no-undef", + "2:15 'T' is defined but never used. no-unused-vars", + "3:1 'T' is not defined. no-undef", + ], + ); + }); + + it("type parameter bounds (type aliases)", () => { + verifyAndAssertMessages( + ` + import type {Foo, Foo2, Foo3} from 'foo'; + type Log = { + messages: {[T1]: T2}; + delay: Foo3; + }; + `, + { "no-unused-vars": 1, "no-undef": 1 }, + [ + "2:6 'Log' is defined but never used. no-unused-vars", + "2:29 'T3' is defined but never used. no-unused-vars", + ], + ); + }); + + it("type parameter scope (type aliases)", () => { + verifyAndAssertMessages( + ` + T; + type Foo = {}; + T; + Foo; + `, + { "no-unused-vars": 1, "no-undef": 1 }, + [ + "1:1 'T' is not defined. no-undef", + "2:10 'T' is defined but never used. no-unused-vars", + "3:1 'T' is not defined. no-undef", + ], + ); + }); + + it("type parameter bounds (functions)", () => { + verifyAndAssertMessages( + ` + import type Foo from 'foo'; + import type Foo2 from 'foo'; + function log(a: T1, b: T2): T3 { return a + b; } + log(1, 2); + `, + { "no-unused-vars": 1, "no-undef": 1 }, + ["3:37 'T4' is defined but never used. no-unused-vars"], + ); + }); + + it("type parameter scope (functions)", () => { + verifyAndAssertMessages( + ` + T; + function log() {} + T; + log; + `, + { "no-unused-vars": 1, "no-undef": 1 }, + [ + "1:1 'T' is not defined. no-undef", + "2:14 'T' is defined but never used. no-unused-vars", + "3:1 'T' is not defined. no-undef", + ], + ); + }); + + it("nested type annotations", () => { + verifyAndAssertMessages( + ` + import type Foo from 'foo'; + function foo(callback: () => Foo) { + return callback(); + } + foo(); + `, + { "no-unused-vars": 1, "no-undef": 1 }, + ); + }); + + it("type in var declaration", () => { + verifyAndAssertMessages( + ` + import type Foo from 'foo'; + var x: Foo = 1; + x; + `, + { "no-unused-vars": 1, "no-undef": 1 }, + ); + }); + + it("object type annotation", () => { + verifyAndAssertMessages( + ` + import type Foo from 'foo'; + var a: {numVal: Foo}; + a; + `, + { "no-unused-vars": 1, "no-undef": 1 }, + ); + }); + + it("object property types", () => { + verifyAndAssertMessages( + ` + import type Foo from 'foo'; + import type Foo2 from 'foo'; + var a = { + circle: (null : ?{ setNativeProps(props: Foo): Foo2 }) + }; + a; + `, + { "no-unused-vars": 1, "no-undef": 1 }, + ); + }); + + it("namespaced types", () => { + verifyAndAssertMessages( + ` + var React = require('react-native'); + var b = { + openExternalExample: (null: ?React.Component) + }; + var c = { + render(): React.Component {} + }; + b; + c; + `, + { "no-unused-vars": 1, "no-undef": 1 }, + ); + }); + + it("ArrayTypeAnnotation", () => { + verifyAndAssertMessages( + ` + import type Foo from 'foo'; + var x: Foo[]; x; + `, + { "no-unused-vars": 1, "no-undef": 1 }, + ); + }); + + it("ClassImplements", () => { + verifyAndAssertMessages( + ` + import type Bar from 'foo'; + export default class Foo implements Bar {} + `, + { "no-unused-vars": 1, "no-undef": 1 }, + ); + }); + + it("type alias creates declaration + usage", () => { + verifyAndAssertMessages( + ` + type Foo = any; + var x : Foo = 1; x; + `, + { "no-unused-vars": 1, "no-undef": 1 }, + ); + }); + + it("type alias with type parameters", () => { + verifyAndAssertMessages( + ` + import type Bar from 'foo'; + import type Foo3 from 'foo'; + type Foo = Bar + var x : Foo = 1; x; + `, + { "no-unused-vars": 1, "no-undef": 1 }, + ); + }); + + it("export type alias", () => { + verifyAndAssertMessages( + ` + import type Foo2 from 'foo'; + export type Foo = Foo2; + `, + { "no-unused-vars": 1, "no-undef": 1 }, + ); + }); + + it("polymorphic types #109", () => { + verifyAndAssertMessages( + "export default function groupByEveryN(array: Array, n: number): Array> { n; }", + { "no-unused-vars": 1, "no-undef": 1 }, + ); + }); + + it("types definition from import", () => { + verifyAndAssertMessages( + ` + import type Promise from 'bluebird'; + type Operation = () => Promise; + x: Operation; + `, + { "no-unused-vars": 1, "no-undef": 1 }, + ); + }); + + it("polymorphic/generic types for class #123", () => { + verifyAndAssertMessages( + ` + class Box { + value: T; + } + var box = new Box(); + console.log(box.value); + `, + { "no-unused-vars": 1, "no-undef": 1 }, + ); + }); + + it("polymorphic/generic types for function #123", () => { + verifyAndAssertMessages( + ` + export function identity(value) { + var a: T = value; a; + } + `, + { "no-unused-vars": 1, "no-undef": 1 }, + ); + }); + + it("polymorphic/generic types for type alias #123", () => { + verifyAndAssertMessages( + ` + import Bar from './Bar'; + type Foo = Bar; var x: Foo = 1; console.log(x); + `, + { "no-unused-vars": 1, "no-undef": 1 }, + ); + }); + + it("polymorphic/generic types - outside of fn scope #123", () => { + verifyAndAssertMessages( + ` + export function foo(value) { value; }; + var b: T = 1; b; + `, + { "no-unused-vars": 1, "no-undef": 1 }, + [ + "1:21 'T' is defined but never used. no-unused-vars", + "2:8 'T' is not defined. no-undef", + ], + ); + }); + + it("polymorphic/generic types - extending unknown #123", () => { + verifyAndAssertMessages( + ` + import Bar from 'bar'; + export class Foo extends Bar {} + `, + { "no-unused-vars": 1, "no-undef": 1 }, + ["2:30 'T' is not defined. no-undef"], + ); + }); + + it("polymorphic/generic types - function calls", () => { + verifyAndAssertMessages( + ` + function f(): T {} + f(); + `, + { "no-unused-vars": 1, "no-undef": 1 }, + ["2:3 'T' is not defined. no-undef"], + ); + }); + + it("polymorphic/generic types - function calls #644", () => { + verifyAndAssertMessages( + ` + import type {Type} from 'Type'; + function f(): T {} + f(); + `, + { "no-unused-vars": 1, "no-undef": 1 }, + ); + }); + + it("support declarations #132", () => { + verifyAndAssertMessages( + ` + declare class A { static () : number } + declare module B { declare var x: number; } + declare function foo(): void; + declare var bar + A; B; foo(); bar; + `, + { "no-undef": 1, "no-unused-vars": 1 }, + ); + }); + + it("supports type spreading", () => { + verifyAndAssertMessages( + ` + type U = {}; + type T = {a: number, ...U, ...V}; + `, + { "no-undef": 1, "no-unused-vars": 1 }, + [ + "2:6 'T' is defined but never used. no-unused-vars", + "2:31 'V' is not defined. no-undef", + ], + ); + }); + + it("1", () => { + verifyAndAssertMessages( + ` + import type Foo from 'foo'; + import type Foo2 from 'foo'; + export default function(a: Foo, b: ?Foo2, c){ a; b; c; } + `, + { "no-unused-vars": 1, "no-undef": 1 }, + ); + }); + + it("2", () => { + verifyAndAssertMessages( + ` + import type Foo from 'foo'; + export default function(a: () => Foo){ a; } + `, + { "no-unused-vars": 1, "no-undef": 1 }, + ); + }); + + it("3", () => { + verifyAndAssertMessages( + ` + import type Foo from 'foo'; + import type Foo2 from 'foo'; + export default function(a: (_:Foo) => Foo2){ a; } + `, + { "no-unused-vars": 1, "no-undef": 1 }, + ); + }); + + it("4", () => { + verifyAndAssertMessages( + ` + import type Foo from 'foo'; + import type Foo2 from 'foo'; + import type Foo3 from 'foo'; + export default function(a: (_1:Foo, _2:Foo2) => Foo3){ a; } + `, + { "no-unused-vars": 1, "no-undef": 1 }, + ); + }); + + it("5", () => { + verifyAndAssertMessages( + ` + import type Foo from 'foo'; + import type Foo2 from 'foo'; + export default function(a: (_1:Foo, ...foo:Array) => number){ a; } + `, + { "no-unused-vars": 1, "no-undef": 1 }, + ); + }); + + it("6", () => { + verifyAndAssertMessages( + ` + import type Foo from 'foo'; + export default function(): Foo {} + `, + { "no-unused-vars": 1, "no-undef": 1 }, + ); + }); + + it("7", () => { + verifyAndAssertMessages( + ` + import type Foo from 'foo'; + export default function():() => Foo {} + `, + { "no-unused-vars": 1, "no-undef": 1 }, + ); + }); + + it("8", () => { + verifyAndAssertMessages( + ` + import type Foo from 'foo'; + import type Foo2 from 'foo'; + export default function():(_?:Foo) => Foo2{} + `, + { "no-unused-vars": 1, "no-undef": 1 }, + ); + }); + + it("9", () => { + verifyAndAssertMessages( + "export default function (a: T1, b: T2) { b; }", + { "no-unused-vars": 1, "no-undef": 1 }, + ); + }); + + it("10", () => { + verifyAndAssertMessages( + "var a=function(a: T1, b: T2) {return a + b;}; a;", + { "no-unused-vars": 1, "no-undef": 1 }, + ); + }); + + it("11", () => { + verifyAndAssertMessages("var a={*id(x: T): T { x; }}; a;", { + "no-unused-vars": 1, + "no-undef": 1, + }); + }); + + it("12", () => { + verifyAndAssertMessages("var a={async id(x: T): T { x; }}; a;", { + "no-unused-vars": 1, + "no-undef": 1, + }); + }); + + it("13", () => { + verifyAndAssertMessages("var a={123(x: T): T { x; }}; a;", { + "no-unused-vars": 1, + "no-undef": 1, + }); + }); + + it("14", () => { + verifyAndAssertMessages( + ` + import type Foo from 'foo'; + import type Foo2 from 'foo'; + export default class Bar {set fooProp(value:Foo):Foo2{ value; }} + `, + { "no-unused-vars": 1, "no-undef": 1 }, + ); + }); + + it("15", () => { + verifyAndAssertMessages( + ` + import type Foo2 from 'foo'; + export default class Foo {get fooProp(): Foo2{}} + `, + { "no-unused-vars": 1, "no-undef": 1 }, + ); + }); + + it("16", () => { + verifyAndAssertMessages( + ` + import type Foo from 'foo'; + var numVal:Foo; numVal; + `, + { "no-unused-vars": 1, "no-undef": 1 }, + ); + }); + + it("17", () => { + verifyAndAssertMessages( + ` + import type Foo from 'foo'; + var a: {numVal: Foo;}; a; + `, + { "no-unused-vars": 1, "no-undef": 1 }, + ); + }); + + it("18", () => { + verifyAndAssertMessages( + ` + import type Foo from 'foo'; + import type Foo2 from 'foo'; + import type Foo3 from 'foo'; + var a: ?{numVal: Foo; [indexer: Foo2]: Foo3}; a; + `, + { "no-unused-vars": 1, "no-undef": 1 }, + ); + }); + + it("19", () => { + verifyAndAssertMessages( + ` + import type Foo from 'foo'; + import type Foo2 from 'foo'; + var a: {numVal: Foo; subObj?: ?{strVal: Foo2}}; a; + `, + { "no-unused-vars": 1, "no-undef": 1 }, + ); + }); + + it("20", () => { + verifyAndAssertMessages( + ` + import type Foo from 'foo'; + import type Foo2 from 'foo'; + import type Foo3 from 'foo'; + import type Foo4 from 'foo'; + var a: { [a: Foo]: Foo2; [b: Foo3]: Foo4; }; a; + `, + { "no-unused-vars": 1, "no-undef": 1 }, + ); + }); + + it("21", () => { + verifyAndAssertMessages( + ` + import type Foo from 'foo'; + import type Foo2 from 'foo'; + import type Foo3 from 'foo'; + var a: {add(x:Foo, ...y:Array): Foo3}; a; + `, + { "no-unused-vars": 1, "no-undef": 1 }, + ); + }); + + it("22", () => { + verifyAndAssertMessages( + ` + import type Foo from 'foo'; + import type Foo2 from 'foo'; + import type Foo3 from 'foo'; + var a: { id(x: Foo2): Foo3; }; a; + `, + { "no-unused-vars": 1, "no-undef": 1 }, + ); + }); + + it("23", () => { + verifyAndAssertMessages( + ` + import type Foo from 'foo'; + var a:Array = [1, 2, 3]; a; + `, + { "no-unused-vars": 1, "no-undef": 1 }, + ); + }); + + it("24", () => { + verifyAndAssertMessages( + ` + import type Baz from 'baz'; + export default class Bar extends Baz { }; + `, + { "no-unused-vars": 1, "no-undef": 1 }, + ); + }); + + it("25", () => { + verifyAndAssertMessages( + "export default class Bar { bar(): T { return 42; }}", + { "no-unused-vars": 1, "no-undef": 1 }, + ); + }); + + it("26", () => { + verifyAndAssertMessages( + ` + import type Foo from 'foo'; + import type Foo2 from 'foo'; + export default class Bar { static prop1:Foo; prop2:Foo2; } + `, + { "no-unused-vars": 1, "no-undef": 1 }, + ); + }); + + it("27", () => { + verifyAndAssertMessages( + ` + import type Foo from 'foo'; + import type Foo2 from 'foo'; + var x : Foo | Foo2 = 4; x; + `, + { "no-unused-vars": 1, "no-undef": 1 }, + ); + }); + + it("28", () => { + verifyAndAssertMessages( + ` + import type Foo from 'foo'; + import type Foo2 from 'foo'; + var x : () => Foo | () => Foo2; x; + `, + { "no-unused-vars": 1, "no-undef": 1 }, + ); + }); + + it("29", () => { + verifyAndAssertMessages( + ` + import type Foo from 'foo'; + import type Foo2 from 'foo'; + var x: typeof Foo | number = Foo2; x; + `, + { "no-unused-vars": 1, "no-undef": 1 }, + ); + }); + + it("30", () => { + verifyAndAssertMessages( + ` + import type Foo from 'foo'; + var {x}: {x: Foo; } = { x: 'hello' }; x; + `, + { "no-unused-vars": 1, "no-undef": 1 }, + ); + }); + + it("31", () => { + verifyAndAssertMessages( + ` + import type Foo from 'foo'; + var [x]: Array = [ 'hello' ]; x; + `, + { "no-unused-vars": 1, "no-undef": 1 }, + ); + }); + + it("32", () => { + verifyAndAssertMessages( + ` + import type Foo from 'foo'; + export default function({x}: { x: Foo; }) { x; } + `, + { "no-unused-vars": 1, "no-undef": 1 }, + ); + }); + + it("33", () => { + verifyAndAssertMessages( + ` + import type Foo from 'foo'; + function foo([x]: Array) { x; } foo(); + `, + { "no-unused-vars": 1, "no-undef": 1 }, + ); + }); + + it("34", () => { + verifyAndAssertMessages( + ` + import type Foo from 'foo'; + import type Foo2 from 'foo'; + var a: Map >; a; + `, + { "no-unused-vars": 1, "no-undef": 1 }, + ); + }); + + it("35", () => { + verifyAndAssertMessages( + ` + import type Foo from 'foo'; + var a: ?Promise[]; a; + `, + { "no-unused-vars": 1, "no-undef": 1 }, + ); + }); + + it("36", () => { + verifyAndAssertMessages( + ` + import type Foo from 'foo'; + import type Foo2 from 'foo'; + var a:(...rest:Array) => Foo2; a; + `, + { "no-unused-vars": 1, "no-undef": 1 }, + ); + }); + + it("37", () => { + verifyAndAssertMessages( + ` + import type Foo from 'foo'; + import type Foo2 from 'foo'; + import type Foo3 from 'foo'; + import type Foo4 from 'foo'; + var a: (x: Foo2, ...y:Foo3[]) => Foo4; a; + `, + { "no-unused-vars": 1, "no-undef": 1 }, + ); + }); + + it("38", () => { + verifyAndAssertMessages( + ` + import type {foo, bar} from 'baz'; + foo; bar; + `, + { "no-unused-vars": 1, "no-undef": 1 }, + ); + }); + + it("39", () => { + verifyAndAssertMessages( + ` + import type {foo as bar} from 'baz'; + bar; + `, + { "no-unused-vars": 1, "no-undef": 1 }, + ); + }); + + it("40", () => { + verifyAndAssertMessages( + ` + import type from 'foo'; + type; + `, + { "no-unused-vars": 1, "no-undef": 1 }, + ); + }); + + it("41", () => { + verifyAndAssertMessages( + ` + import type, {foo} from 'bar'; + type; foo; + `, + { "no-unused-vars": 1, "no-undef": 1 }, + ); + }); + + it("43", () => { + verifyAndAssertMessages( + ` + import type Foo from 'foo'; + var a: Foo[]; a; + `, + { "no-unused-vars": 1, "no-undef": 1 }, + ); + }); + + it("44", () => { + verifyAndAssertMessages( + ` + import type Foo from 'foo'; + var a: ?Foo[]; a; + `, + { "no-unused-vars": 1, "no-undef": 1 }, + ); + }); + + it("45", () => { + verifyAndAssertMessages( + ` + import type Foo from 'foo'; + var a: (?Foo)[]; a; + `, + { "no-unused-vars": 1, "no-undef": 1 }, + ); + }); + + it("46", () => { + verifyAndAssertMessages( + ` + import type Foo from 'foo'; + var a: () => Foo[]; a; + `, + { "no-unused-vars": 1, "no-undef": 1 }, + ); + }); + + it("47", () => { + verifyAndAssertMessages( + ` + import type Foo from 'foo'; + var a: (() => Foo)[]; a; + `, + { "no-unused-vars": 1, "no-undef": 1 }, + ); + }); + + it("48", () => { + verifyAndAssertMessages( + ` + import type Foo from 'foo'; + var a: typeof Foo[]; a; + `, + { "no-unused-vars": 1, "no-undef": 1 }, + ); + }); + + it("49", () => { + verifyAndAssertMessages( + ` + import type Foo from 'foo'; + import type Foo2 from 'foo'; + import type Foo3 from 'foo'; + var a : [Foo, Foo2,] = [123, 'duck',]; a; + `, + { "no-unused-vars": 1, "no-undef": 1 }, + ); + }); + }); + + it("class usage", () => { + verifyAndAssertMessages("class Lol {} module.exports = Lol;", { + "no-unused-vars": 1, + }); + }); + + it("class definition: gaearon/redux#24", () => { + verifyAndAssertMessages( + ` + export default function root(stores) { + return DecoratedComponent => class ReduxRootDecorator { + a() { DecoratedComponent; stores; } + }; + } + `, + { "no-undef": 1, "no-unused-vars": 1 }, + ); + }); + + it("class properties #71", () => { + verifyAndAssertMessages("class Lol { foo = 'bar'; }", { "no-undef": 1 }); + }); + + it("template strings #31", () => { + verifyAndAssertMessages("console.log(`${a}, b`);", { "comma-spacing": 1 }); + }); + + it("template with destructuring #31", () => { + verifyAndAssertMessages( + ` + module.exports = { + render() { + var {name} = this.props; + return Math.max(null, \`Name: \${name}, Name: \${name}\`); + } + }; + `, + { "comma-spacing": 1 }, + ); + }); + + it("template with arrow returning template #603", () => { + verifyAndAssertMessages( + ` + var a = \`\${() => { + \`\${''}\` + }}\`; + `, + { indent: 1 }, + [], + ); + }); + + describe("decorators #72 (legacy)", () => { + function verifyDecoratorsLegacyAndAssertMessages( + code, + rules, + expectedMessages, + sourceType, + ) { + const overrideConfig = { + parserOptions: { + sourceType, + babelOptions: { + configFile: require.resolve( + "@babel/eslint-shared-fixtures/config/babel.config.decorators-legacy.js", + ), + }, + }, + }; + return verifyAndAssertMessages( + code, + rules, + expectedMessages, + sourceType, + overrideConfig, + ); + } + + it("class declaration", () => { + verifyDecoratorsLegacyAndAssertMessages( + ` + import classDeclaration from 'decorator'; + import decoratorParameter from 'decorator'; + @classDeclaration((parameter) => parameter) + @classDeclaration(decoratorParameter) + @classDeclaration + export class TextareaAutosize {} + `, + { "no-unused-vars": 1 }, + ); + }); + + it("method definition", () => { + verifyDecoratorsLegacyAndAssertMessages( + ` + import classMethodDeclarationA from 'decorator'; + import decoratorParameter from 'decorator'; + export class TextareaAutosize { + @classMethodDeclarationA((parameter) => parameter) + @classMethodDeclarationA(decoratorParameter) + @classMethodDeclarationA + methodDeclaration(e) { + e(); + } + } + `, + { "no-unused-vars": 1 }, + ); + }); + + it("method definition get/set", () => { + verifyDecoratorsLegacyAndAssertMessages( + ` + import classMethodDeclarationA from 'decorator'; + import decoratorParameter from 'decorator'; + export class TextareaAutosize { + @classMethodDeclarationA((parameter) => parameter) + @classMethodDeclarationA(decoratorParameter) + @classMethodDeclarationA + get bar() { } + @classMethodDeclarationA((parameter) => parameter) + @classMethodDeclarationA(decoratorParameter) + @classMethodDeclarationA + set bar(val) { val; } + } + `, + { "no-unused-vars": 1 }, + ); + }); + + it("object property", () => { + verifyDecoratorsLegacyAndAssertMessages( + ` + import classMethodDeclarationA from 'decorator'; + import decoratorParameter from 'decorator'; + var obj = { + @classMethodDeclarationA((parameter) => parameter) + @classMethodDeclarationA(decoratorParameter) + @classMethodDeclarationA + methodDeclaration(e) { + e(); + } + }; + obj; + `, + { "no-unused-vars": 1 }, + ); + }); + + it("object property get/set", () => { + verifyDecoratorsLegacyAndAssertMessages( + ` + import classMethodDeclarationA from 'decorator'; + import decoratorParameter from 'decorator'; + var obj = { + @classMethodDeclarationA((parameter) => parameter) + @classMethodDeclarationA(decoratorParameter) + @classMethodDeclarationA + get bar() { }, + @classMethodDeclarationA((parameter) => parameter) + @classMethodDeclarationA(decoratorParameter) + @classMethodDeclarationA + set bar(val) { val; } + }; + obj; + `, + { "no-unused-vars": 1 }, + ); + }); + }); + + describe("decorators #72", () => { + it("class declaration", () => { + verifyAndAssertMessages( + ` + import classDeclaration from 'decorator'; + import decoratorParameter from 'decorator'; + export + @classDeclaration((parameter) => parameter) + @classDeclaration(decoratorParameter) + @classDeclaration + class TextareaAutosize {} + `, + { "no-unused-vars": 1 }, + ); + }); + + it("method definition", () => { + verifyAndAssertMessages( + ` + import classMethodDeclarationA from 'decorator'; + import decoratorParameter from 'decorator'; + export class TextareaAutosize { + @classMethodDeclarationA((parameter) => parameter) + @classMethodDeclarationA(decoratorParameter) + @classMethodDeclarationA + methodDeclaration(e) { + e(); + } + } + `, + { "no-unused-vars": 1 }, + ); + }); + + it("method definition get/set", () => { + verifyAndAssertMessages( + ` + import classMethodDeclarationA from 'decorator'; + import decoratorParameter from 'decorator'; + export class TextareaAutosize { + @classMethodDeclarationA((parameter) => parameter) + @classMethodDeclarationA(decoratorParameter) + @classMethodDeclarationA + get bar() { } + @classMethodDeclarationA((parameter) => parameter) + @classMethodDeclarationA(decoratorParameter) + @classMethodDeclarationA + set bar(val) { val; } + } + `, + { "no-unused-vars": 1 }, + ); + }); + }); + + it("detects minimal no-unused-vars case #120", () => { + verifyAndAssertMessages("var unused;", { "no-unused-vars": 1 }, [ + "1:5 'unused' is defined but never used. no-unused-vars", + ]); + }); + + // This two tests are disabled, as the feature to visit properties when + // there is a spread/rest operator has been removed as it caused problems + // with other rules #249 + // eslint-disable-next-line jest/no-disabled-tests + it.skip("visits excluded properties left of spread #95", () => { + verifyAndAssertMessages( + "var originalObject = {}; var {field1, field2, ...clone} = originalObject;", + { "no-unused-vars": 1 }, + ); + }); + + // eslint-disable-next-line jest/no-disabled-tests + it.skip("visits excluded properties left of spread #210", () => { + verifyAndAssertMessages( + "const props = { yo: 'yo' }; const { ...otherProps } = props;", + { "no-unused-vars": 1 }, + ); + }); + + it("does not mark spread variables false-positive", () => { + verifyAndAssertMessages( + "var originalObject = {}; var {field1, field2, ...clone} = originalObject;", + { "no-undef": 1, "no-redeclare": 1 }, + ); + }); + + it("does not mark spread variables false-positive", () => { + verifyAndAssertMessages( + "const props = { yo: 'yo' }; const { ...otherProps } = props;", + { "no-undef": 1, "no-redeclare": 1 }, + ); + }); + + it("does not mark spread variables as use-before-define #249", () => { + verifyAndAssertMessages( + "var originalObject = {}; var {field1, field2, ...clone} = originalObject;", + { "no-use-before-define": 1 }, + ); + }); + + it("detects no-unused-vars with object destructuring #142", () => { + verifyAndAssertMessages( + "const {Bacona} = require('baconjs')", + { "no-undef": 1, "no-unused-vars": 1 }, + ["1:8 'Bacona' is assigned a value but never used. no-unused-vars"], + ); + }); + + it("don't warn no-unused-vars with spread #142", () => { + verifyAndAssertMessages( + ` + export default function test(data) { + return { + foo: 'bar', + ...data + }; + } + `, + { "no-undef": 1, "no-unused-vars": 1 }, + ); + }); + + it("excludes comment tokens #153", () => { + verifyAndAssertMessages( + ` + var a = [ + 1, + 2, // a trailing comment makes this line fail comma-dangle (always-multiline) + ]; + `, + { "comma-dangle": [2, "always-multiline"] }, + ); + + verifyAndAssertMessages( + ` + switch (a) { + // A comment here makes the above line fail brace-style + case 1: + console.log(a); + } + `, + { "brace-style": 2 }, + ); + }); + + it("ternary and parens #149", () => { + verifyAndAssertMessages("true ? (true) : false;", { "space-infix-ops": 1 }); + }); + + it("line comment space-in-parens #124", () => { + verifyAndAssertMessages( + ` + React.createClass({ + render() { + // return ( + //
+ // ); // <-- this is the line that is reported + } + }); + `, + { "space-in-parens": 1 }, + ); + }); + + it("block comment space-in-parens #124", () => { + verifyAndAssertMessages( + ` + React.createClass({ + render() { + /* + return ( +
+ ); // <-- this is the line that is reported + */ + } + }); + `, + { "space-in-parens": 1 }, + ); + }); + + it("no no-undef error with rest #11", () => { + verifyAndAssertMessages("const [a, ...rest] = ['1', '2', '3']; a; rest;", { + "no-undef": 1, + "no-unused-vars": 1, + }); + }); + + it("async function with space-before-function-paren #168", () => { + verifyAndAssertMessages("it('handles updates', async function() {});", { + "space-before-function-paren": [1, "never"], + }); + }); + + it("default param flow type no-unused-vars #184", () => { + verifyAndAssertMessages( + ` + type ResolveOptionType = { + depth?: number, + identifier?: string + }; + + export default function resolve( + options: ResolveOptionType = {} + ): Object { + options; + } + `, + { "no-unused-vars": 1, "no-undef": 1 }, + ); + }); + + it("no-use-before-define #192", () => { + verifyAndAssertMessages( + ` + console.log(x); + var x = 1; + `, + { "no-use-before-define": 1 }, + ["1:13 'x' was used before it was defined. no-use-before-define"], + ); + }); + + it("jsx and stringliteral #216", () => { + verifyAndAssertMessages("
"); + }); + + it("getter/setter #218", () => { + verifyAndAssertMessages( + ` + class Person { + set a (v) { } + } + `, + { + "space-before-function-paren": 1, + "keyword-spacing": [1, { before: true }], + indent: 1, + }, + ); + }); + + it("getter/setter #220", () => { + verifyAndAssertMessages( + ` + var B = { + get x () { + return this.ecks; + }, + set x (ecks) { + this.ecks = ecks; + } + }; + `, + { "no-dupe-keys": 1 }, + ); + }); + + it("fixes issues with flow types and ObjectPattern", () => { + verifyAndAssertMessages( + ` + import type Foo from 'bar'; + export default class Foobar { + foo({ bar }: Foo) { bar; } + bar({ foo }: Foo) { foo; } + } + `, + { "no-unused-vars": 1, "no-shadow": 1 }, + ); + }); + + it("correctly detects redeclares if in script mode #217", () => { + verifyAndAssertMessages( + ` + var a = 321; + var a = 123; + `, + { "no-redeclare": 1 }, + ["2:5 'a' is already defined. no-redeclare"], + "script", + ); + }); + + it("correctly detects redeclares if in module mode #217", () => { + verifyAndAssertMessages( + ` + var a = 321; + var a = 123; + `, + { "no-redeclare": 1 }, + ["2:5 'a' is already defined. no-redeclare"], + "module", + ); + }); + + it("no-implicit-globals in script: globalReturn is false", () => { + verifyAndAssertMessages( + "var leakedGlobal = 1;", + { "no-implicit-globals": 1 }, + [ + "1:5 Unexpected 'var' declaration in the global scope, wrap in an IIFE for a local variable, assign as global property for a global variable. no-implicit-globals", + ], + "script", + { + env: {}, + parserOptions: { + ecmaVersion: 6, + sourceType: "script", + ecmaFeatures: { globalReturn: false }, + }, + }, + ); + }); + + it("no-implicit-globals in script: globalReturn is true", () => { + verifyAndAssertMessages( + "var leakedGlobal = 1;", + { "no-implicit-globals": 1 }, + [], + "script", + { + env: {}, + parserOptions: { + ecmaVersion: 6, + sourceType: "script", + ecmaFeatures: { globalReturn: true }, + }, + }, + ); + }); + + it("no-implicit-globals in module", () => { + verifyAndAssertMessages( + "var leakedGlobal = 1;", + { "no-implicit-globals": 1 }, + [], + "module", + { + env: {}, + parserOptions: { ecmaVersion: 6, sourceType: "module" }, + }, + ); + }); + + it("no-implicit-globals in default", () => { + verifyAndAssertMessages( + "var leakedGlobal = 1;", + { "no-implicit-globals": 1 }, + [], + undefined, + { + env: {}, + parserOptions: { ecmaVersion: 6 }, + }, + ); + }); + + it("allowImportExportEverywhere option (#327)", () => { + verifyAndAssertMessages( + ` + if (true) { import Foo from 'foo'; } + function foo() { import Bar from 'bar'; } + switch (a) { case 1: import FooBar from 'foobar'; } + `, + {}, + [], + "module", + { + env: {}, + parserOptions: { + ecmaVersion: 6, + sourceType: "module", + allowImportExportEverywhere: true, + }, + }, + ); + }); + + it("with does not crash parsing in script mode (strict off) #171", () => { + verifyAndAssertMessages("with (arguments) { length; }", {}, [], "script"); + }); + + it("with does crash parsing in module mode (strict on) #171", () => { + verifyAndAssertMessages("with (arguments) { length; }", {}, [ + /'with' in strict mode/, + ]); + }); + + it("new.target is not reported as undef #235", () => { + verifyAndAssertMessages("function foo () { return new.target }", { + "no-undef": 1, + }); + }); + + it("decorator does not create TypeError #229", () => { + verifyAndAssertMessages( + ` + class A { + @test + f() {} + } + `, + { "no-undef": 1 }, + ["2:4 'test' is not defined. no-undef"], + ); + }); + + it("Flow definition does not trigger warnings #223", () => { + verifyAndAssertMessages( + ` + import { Map as $Map } from 'immutable'; + function myFunction($state: $Map, { a, b, c } : { a: ?Object, b: ?Object, c: $Map }) {} + `, + { "no-dupe-args": 1, "no-redeclare": 1, "no-shadow": 1 }, + ); + }); + + it("newline-before-return with comments #289", () => { + verifyAndAssertMessages( + ` + function a() { + if (b) { + /* eslint-disable no-console */ + console.log('test'); + /* eslint-enable no-console */ + } + + return hasGlobal; + } + `, + { "newline-before-return": 1 }, + ); + }); + + it("spaced-comment with shebang #163", () => { + verifyAndAssertMessages( + ` + #!/usr/bin/env babel-node + import {spawn} from 'foobar'; + `, + { "spaced-comment": 1 }, + ); + }); + + describe("Class Property Declarations", () => { + it("no-redeclare false positive 1", () => { + verifyAndAssertMessages( + ` + class Group { + static propTypes = {}; + } + class TypicalForm { + static propTypes = {}; + } + `, + { "no-redeclare": 1 }, + ); + }); + + it("no-redeclare false positive 2", () => { + verifyAndAssertMessages( + ` + function validate() {} + class MyComponent { + static validate = validate; + } + `, + { "no-redeclare": 1 }, + ); + }); + + it("check references", () => { + verifyAndAssertMessages( + ` + var a; + class A { + prop1; + prop2 = a; + prop3 = b; + } + new A + `, + { "no-undef": 1, "no-unused-vars": 1, "no-redeclare": 1 }, + ["5:11 'b' is not defined. no-undef"], + ); + }); + }); + + it("dynamic import support", () => { + verifyAndAssertMessages("import('test-module').then(() => {})"); + }); + + it("regex with es6 unicodeCodePointEscapes", () => { + verifyAndAssertMessages( + "string.replace(/[\u{0000A0}-\u{10FFFF}<>&]/gmiu, (char) => `&#x${char.codePointAt(0).toString(16)};`);", + ); + }); + + describe("class field declarations", () => { + describe("field declarations", () => { + it("should not be undefined", () => { + verifyAndAssertMessages( + ` + class C { + d = 1; + } + `, + { "no-undef": 1 }, + ); + }); + + it("should not be unused", () => { + verifyAndAssertMessages( + ` + export class C { + d = 1; + } + `, + { "no-unused-vars": 1 }, + ); + }); + }); + + describe("private field declarations", () => { + it("should not be undefined", () => { + verifyAndAssertMessages( + ` + class C { + #d = 1; + } + `, + { "no-undef": 1 }, + ); + }); + + it("should not be unused", () => { + verifyAndAssertMessages( + ` + export class C { + #d = 1; + } + `, + { "no-unused-vars": 1 }, + ); + }); + }); + + describe("private methods", () => { + it("should not be undefined", () => { + verifyAndAssertMessages( + ` + class C { + #d() {}; + } + `, + { "no-undef": 1 }, + ); + }); + + it("should not be unused", () => { + verifyAndAssertMessages( + ` + export class C { + #d() {}; + } + `, + { "no-unused-vars": 1 }, + ); + }); + }); + }); + + describe("optional chaining operator", () => { + it("should not be undefined #595", () => { + verifyAndAssertMessages( + ` + const foo = {}; + foo?.bar; + `, + { "no-undef": 1 }, + ); + }); + }); + + it("flow types on class method should be visited correctly", () => { + verifyAndAssertMessages( + ` + import type NodeType from 'foo'; + class NodeUtils { + finishNodeAt(node: T): T { return node; } + } + + new NodeUtils(); + `, + { "no-unused-vars": 1 }, + ); + }); + + it("works with dynamicImport", () => { + verifyAndAssertMessages( + ` + import('a'); + `, + ); + }); + + it("works with numericSeparator", () => { + verifyAndAssertMessages( + ` + 1_000 + `, + ); + }); + + it("works with optionalChaining", () => { + verifyAndAssertMessages( + ` + a?.b + `, + ); + }); + + it("works with import.meta", () => { + verifyAndAssertMessages( + ` + import.meta + `, + ); + }); + + it("works with classPrivateProperties", () => { + verifyAndAssertMessages( + ` + class A { #a = 1; } + `, + ); + }); + + it("works with classPrivateMethods", () => { + verifyAndAssertMessages( + ` + class A { #a(b, c) {} } + `, + ); + }); + + it("works with arrow function classPrivateProperties", () => { + verifyAndAssertMessages( + ` + class A { #a = (a, b) => {}; } + `, + ); + }); + + it("works with optionalCatchBinding", () => { + verifyAndAssertMessages( + ` + try {} catch {} + try {} catch {} finally {} + `, + ); + }); + + it("exportDefaultFrom", () => { + verifyAndAssertMessages( + ` + export v from "mod" + `, + ); + }); + + it("exportNamespaceFrom", () => { + verifyAndAssertMessages( + ` + export * as ns from "mod" + `, + ); + }); + + it("ignore eval in scope analysis", () => { + verifyAndAssertMessages( + ` + const a = 1; + console.log(a); + eval(''); + `, + { "no-unused-vars": 1, "no-undef": 1 }, + ); + }); +}); diff --git a/eslint/babel-eslint-tests/test/integration/eslint/rules/strict.js b/eslint/babel-eslint-tests/test/integration/eslint/rules/strict.js new file mode 100644 index 000000000000..1bd83dd597b6 --- /dev/null +++ b/eslint/babel-eslint-tests/test/integration/eslint/rules/strict.js @@ -0,0 +1,212 @@ +import eslint from "eslint"; +import fs from "fs"; +import path from "path"; +import * as parser from "@babel/eslint-parser"; + +eslint.linter.defineParser("@babel/eslint-parser", parser); + +const paths = { + fixtures: path.join(__dirname, "../../..", "fixtures", "rules"), +}; + +const encoding = "utf8"; +const errorLevel = 2; + +const baseEslintOpts = { + parser: "@babel/eslint-parser", + parserOptions: { + sourceType: "script", + requireConfigFile: false, + babelOptions: { configFile: false }, + }, +}; + +/** + * Load a fixture and run eslint.linter.verify() on it. + * Pass the return value to done(). + * @param object opts + * @param function done + */ +function lint(opts, done) { + readFixture(opts.fixture, (err, src) => { + if (err) return done(err); + done(null, eslint.linter.verify(src, opts.eslint)); + }); +} + +/** + * Read a fixture file, passing the content to done(). + * @param string|array id + * @param function done + */ +function readFixture(id, done) { + if (Array.isArray(id)) id = path.join.apply(path, id); + if (!path.extname(id)) id += ".js"; + fs.readFile(path.join(paths.fixtures, id), encoding, done); +} +// readFixture + +describe("Rules:", () => { + describe("`strict`", strictSuite); +}); + +function strictSuite() { + const ruleId = "strict"; + + describe("when set to 'never'", () => { + const eslintOpts = Object.assign({}, baseEslintOpts, { + rules: {}, + }); + eslintOpts.rules[ruleId] = [errorLevel, "never"]; + + ["global-with", "function-with"].forEach(fixture => { + it(`should error on ${fixture.match(/^[^-]+/)[0]} directive`, done => { + lint( + { + fixture: ["strict", fixture], + eslint: eslintOpts, + }, + (err, report) => { + if (err) return done(err); + expect(report[0].ruleId).toBe(ruleId); + done(); + }, + ); + }); + }); + }); + + describe("when set to 'global'", () => { + const eslintOpts = Object.assign({}, baseEslintOpts, { + rules: {}, + }); + eslintOpts.rules[ruleId] = [errorLevel, "global"]; + + it("shouldn't error on single global directive", done => { + lint( + { + fixture: ["strict", "global-with"], + eslint: eslintOpts, + }, + (err, report) => { + if (err) return done(err); + expect(report.length).toBe(0); + done(); + }, + ); + }); + + it("should error twice on global directive: no and function directive: yes", done => { + lint( + { + fixture: ["strict", "function-with"], + eslint: eslintOpts, + }, + (err, report) => { + if (err) return done(err); + expect(report[0].ruleId).toBe(ruleId); + done(); + }, + ); + }); + + it("should error on function directive", done => { + lint( + { + fixture: ["strict", "global-with-function-with"], + eslint: eslintOpts, + }, + (err, report) => { + if (err) return done(err); + expect(report[0].ruleId).toBe(ruleId); + // This is to make sure the test fails prior to adapting Babel AST + // directive representation to ESLint format. Otherwise it reports an + // error for missing global directive that masquerades as the expected + // result of the previous assertion. + expect(report[0].nodeType).not.toBe("Program"); + done(); + }, + ); + }); + + it("should error on no directive", done => { + lint( + { + fixture: ["strict", "none"], + eslint: eslintOpts, + }, + (err, report) => { + if (err) return done(err); + expect(report[0].ruleId).toBe(ruleId); + done(); + }, + ); + }); + }); + + describe("when set to 'function'", () => { + const eslintOpts = Object.assign({}, baseEslintOpts, { + rules: {}, + }); + eslintOpts.rules[ruleId] = [errorLevel, "function"]; + + it("shouldn't error on single function directive", done => { + lint( + { + fixture: ["strict", "function-with"], + eslint: eslintOpts, + }, + (err, report) => { + if (err) return done(err); + expect(report.length).toBe(0); + done(); + }, + ); + }); + + it("should error twice on function directive: no and global directive: yes", done => { + lint( + { + fixture: ["strict", "global-with-function-without"], + eslint: eslintOpts, + }, + (err, report) => { + if (err) return done(err); + [0, 1].forEach(i => { + expect(report[i].ruleId).toBe(ruleId); + }); + done(); + }, + ); + }); + + it("should error on only global directive", done => { + lint( + { + fixture: ["strict", "global-with"], + eslint: eslintOpts, + }, + (err, report) => { + if (err) return done(err); + expect(report[0].ruleId).toBe(ruleId); + done(); + }, + ); + }); + + it("should error on extraneous global directive", done => { + lint( + { + fixture: ["strict", "global-with-function-with"], + eslint: eslintOpts, + }, + (err, report) => { + if (err) return done(err); + expect(report[0].ruleId).toBe(ruleId); + expect(report[0].nodeType.indexOf("Function")).toBe(-1); + done(); + }, + ); + }); + }); +} diff --git a/jest.config.js b/jest.config.js new file mode 100644 index 000000000000..7af88ad8ff06 --- /dev/null +++ b/jest.config.js @@ -0,0 +1,67 @@ +// These packages undet the @babel namespace aren't in this monorepo. +const externalBabelPackages = [ + "plugin-syntax-async-generators", + "plugin-syntax-bigint", + "plugin-syntax-dynamic-import", + "plugin-syntax-json-strings", + "plugin-syntax-nullish-coalescing-operator", + "plugin-syntax-object-rest-spread", + "plugin-syntax-optional-catch-binding", + "plugin-syntax-optional-chaining", + "plugin-syntax-export-namespace-from", +]; + +// prettier-ignore +const monorepoPackagePattern = + `^@babel/(?!eslint-)(?!${externalBabelPackages.join("|")})([a-zA-Z0-9_-]+)$`; + +module.exports = { + collectCoverageFrom: [ + "packages/*/src/**/*.mjs", + "packages/*/src/**/*.js", + "codemods/*/src/**/*.mjs", + "codemods/*/src/**/*.js", + "eslint/*/src/**/*.mjs", + "eslint/*/src/**/*.js", + ], + // The eslint/* packages use ESLint v6, which has dropped support for Node v6. + // TODO: Remove this process.version check in Babel 8. + testRegex: `./(packages|codemods${ + /^v6./u.test(process.version) ? "" : "|eslint" + })/[^/]+/test/.+\\.m?js$`, + testPathIgnorePatterns: [ + "/node_modules/", + "/test/fixtures/", + "/test/debug-fixtures/", + "/babel-parser/test/expressions/", + "/test/tmp/", + "/test/__data__/", + "/test/helpers/", + "/test/warning\\.js", + "/build/", + "_browser\\.js", + ], + testEnvironment: "node", + setupFilesAfterEnv: ["/test/testSetupFile.js"], + transformIgnorePatterns: [ + "/node_modules/", + "/packages/babel-standalone/babel(\\.min)?\\.js", + "/test/(fixtures|tmp|__data__)/", + "/(packages|codemods|eslint)/[^/]+/lib/", + ], + coveragePathIgnorePatterns: [ + "/node_modules/", + "/packages/babel-standalone/babel(\\.min)?\\.js", + "/test/(fixtures|tmp|__data__)/", + ], + modulePathIgnorePatterns: [ + "/test/fixtures/", + "/test/tmp/", + "/test/__data__/", + "/build/", + ], + moduleNameMapper: { + [monorepoPackagePattern]: "/packages/babel-$1/", + "^@babel/eslint-([a-zA-Z0-9_-]+)$": "/eslint/babel-eslint-$1/", + }, +}; diff --git a/lerna.json b/lerna.json index 10d091d9337f..c8a4e6634e7d 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "7.5.5", + "version": "7.9.5", "changelog": { "repo": "babel/babel", "cacheDir": ".changelog", @@ -11,7 +11,8 @@ "PR: Polish :nail_care:": ":nail_care: Polish", "PR: Docs :memo:": ":memo: Documentation", "PR: Internal :house:": ":house: Internal", - "PR: Performance :running_woman:": ":running_woman: Performance" + "PR: Performance :running_woman:": ":running_woman: Performance", + "PR: Revert :leftwards_arrow_with_hook:": ":leftwards_arrow_with_hook: Revert" } }, "command": { @@ -20,14 +21,18 @@ "*.md", "*.txt", "test/**", + "**/test/**", "codemods/**", - "# We ignore every JSON file, except for built-in-modules, built-ins and plugins defined in babel-preset-env/data.", - "@(!(built-in-modules|built-ins|plugins|package)).json" + "# We ignore every JSON file, except for native-modules, built-ins and plugins defined in babel-preset-env/data.", + "@(!(native-modules|built-ins|plugins|package)).json", + "# Until the ESLint packages version are aligned with Babel's, we ignore them", + "eslint/**" ] } }, "packages": [ "codemods/*", + "eslint/*", "packages/*" ], "npmClient": "yarn", diff --git a/lib/preset-modules.js.flow b/lib/preset-modules.js.flow new file mode 100644 index 000000000000..78e460f1bbea --- /dev/null +++ b/lib/preset-modules.js.flow @@ -0,0 +1,18 @@ +declare module "@babel/preset-modules/lib/plugins/transform-async-arrows-in-class" { + declare module.exports: Function; +} +declare module "@babel/preset-modules/lib/plugins/transform-edge-default-parameters" { + declare module.exports: Function; +} +declare module "@babel/preset-modules/lib/plugins/transform-edge-function-name" { + declare module.exports: Function; +} +declare module "@babel/preset-modules/lib/plugins/transform-tagged-template-caching" { + declare module.exports: Function; +} +declare module "@babel/preset-modules/lib/plugins/transform-safari-block-shadowing" { + declare module.exports: Function; +} +declare module "@babel/preset-modules/lib/plugins/transform-safari-for-shadowing" { + declare module.exports: Function; +} diff --git a/lib/third-party-libs.js.flow b/lib/third-party-libs.js.flow index c21a2797acfe..b41fbe725b4e 100644 --- a/lib/third-party-libs.js.flow +++ b/lib/third-party-libs.js.flow @@ -4,6 +4,7 @@ declare module "resolve" { declare export default { + (string, {| basedir: string |}, (err: ?Error, res: string) => void): void; sync: (string, {| basedir: string |}) => string; }; } @@ -165,7 +166,7 @@ declare module "source-map" { } declare module "convert-source-map" { - import type { SourceMap } from "source-map"; + import type { SourceMap, SourceMapGenerator } from "source-map"; declare class Converter { toJSON(): string; @@ -177,11 +178,11 @@ declare module "convert-source-map" { declare module.exports: { SourceMap: SourceMap, Converter: Converter, - fromObject(obj: SourceMap): Converter, - fromJSON(str: string): Converter, + fromObject(obj: SourceMap | SourceMapGenerator): Converter, + fromJSON(str: string | Buffer): Converter, fromBase64(str: string): Converter, fromComment(str: string): Converter, - fromMapFileComment(str: string): Converter, + fromMapFileComment(str: string, dir: string): Converter, fromSource(str: string): Converter, fromMapFileSource(str: string, dir: string): Converter, removeComments(str: string): string, @@ -190,12 +191,6 @@ declare module "convert-source-map" { }; } -declare module "js-levenshtein" { - declare module.exports: { - (string, string): number, - }; -} - declare module "core-js-compat/data" { declare type Target = "node" | "chrome" | "opera" | "edge" | "firefox" | "safari" | "ie" | "ios" | "android" | "electron" | "samsung"; diff --git a/package.json b/package.json index bd04e0638455..24f8db36b6c5 100644 --- a/package.json +++ b/package.json @@ -3,79 +3,81 @@ "private": true, "license": "MIT", "scripts": { + "bootstrap": "make bootstrap", + "codesandbox": "make bootstrap-only; make build-no-bundle", "build": "make build", "fix": "make fix", "lint": "make lint", "test": "make test" }, "devDependencies": { - "@babel/cli": "^7.4.4", - "@babel/core": "^7.4.5", + "@babel/cli": "^7.8.4", + "@babel/core": "^7.9.0", "@babel/eslint-plugin-development": "^1.0.1", - "@babel/plugin-proposal-class-properties": "^7.4.4", - "@babel/plugin-proposal-export-namespace-from": "^7.2.0", - "@babel/plugin-proposal-numeric-separator": "^7.2.0", - "@babel/plugin-transform-modules-commonjs": "^7.4.4", - "@babel/plugin-transform-runtime": "^7.4.4", - "@babel/preset-env": "^7.4.5", - "@babel/preset-flow": "^7.0.0", - "@babel/register": "^7.4.4", - "@babel/runtime": "^7.4.5", - "babel-eslint": "^11.0.0-beta.0", - "babel-jest": "^24.8.0", - "babel-loader": "^8.0.6", + "@babel/plugin-proposal-class-properties": "^7.8.3", + "@babel/plugin-proposal-dynamic-import": "^7.8.3", + "@babel/plugin-proposal-export-namespace-from": "^7.8.3", + "@babel/plugin-proposal-object-rest-spread": "^7.9.5", + "@babel/plugin-transform-flow-strip-types": "^7.9.0", + "@babel/plugin-transform-for-of": "^7.9.0", + "@babel/plugin-transform-modules-commonjs": "^7.9.0", + "@babel/plugin-transform-runtime": "^7.9.0", + "@babel/preset-env": "^7.9.5", + "@babel/preset-flow": "^7.9.0", + "@babel/register": "^7.9.0", + "@babel/runtime": "^7.9.2", + "@rollup/plugin-json": "4.0.1", + "babel-eslint": "^11.0.0-beta.2", + "babel-jest": "^24.9.0", "babel-plugin-transform-charcodes": "^0.2.0", "browserify": "^16.2.3", "bundle-collapser": "^1.2.1", "chalk": "^2.4.2", "charcodes": "^0.2.0", "derequire": "^2.0.2", - "duplicate-package-checker-webpack-plugin": "^2.1.0", "enhanced-resolve": "^3.0.0", - "eslint": "^5.16.0", - "eslint-config-babel": "^9.0.0", - "eslint-plugin-flowtype": "^3.8.2", - "eslint-plugin-import": "^2.17.2", - "eslint-plugin-prettier": "^3.1.0", + "eslint": "^6.8.0", + "eslint-import-resolver-node": "^0.3.3", + "eslint-plugin-flowtype": "^4.6.0", + "eslint-plugin-import": "^2.20.1", + "eslint-plugin-jest": "^23.8.2", + "eslint-plugin-prettier": "^3.1.2", "fancy-log": "^1.3.3", - "flow-bin": "^0.94.0", - "graceful-fs": "^4.1.15", + "flow-bin": "^0.108.0", "gulp": "^4.0.2", "gulp-babel": "^8.0.0", "gulp-filter": "^5.1.0", "gulp-newer": "^1.0.0", "gulp-plumber": "^1.2.1", - "gulp-rename": "^1.4.0", - "gulp-uglify": "^3.0.2", - "gulp-watch": "^5.0.1", - "husky": "^2.3.0", - "jest": "^24.8.0", - "lerna": "^3.14.2", + "husky": "^3.0.0", + "jest": "^24.9.0", + "lerna": "^3.19.0", "lerna-changelog": "^0.5.0", - "lint-staged": "^8.1.7", + "lint-staged": "^9.2.0", "lodash": "^4.17.13", - "merge-stream": "^1.0.1", + "mergeiterator": "^1.2.5", "output-file-sync": "^2.0.0", - "prettier": "^1.17.1", + "prettier": "^1.19.1", "pump": "^3.0.0", "rimraf": "^2.6.3", - "rollup": "^1.12.0", - "rollup-plugin-babel": "^4.0.0", + "rollup": "^1.32.1", + "rollup-plugin-babel": "^4.4.0", + "rollup-plugin-commonjs": "^10.1.0", + "rollup-plugin-node-builtins": "^2.1.2", + "rollup-plugin-node-globals": "^1.4.0", "rollup-plugin-node-resolve": "^5.0.0", "rollup-plugin-replace": "^2.2.0", - "test262-stream": "^1.2.0", + "rollup-plugin-terser": "^5.3.0", + "test262-stream": "^1.3.0", "through2": "^2.0.0", - "warnings-to-errors-webpack-plugin": "^2.0.0", - "webpack": "^3.4.1", - "webpack-dependency-suite": "^2.4.4", - "webpack-stream": "^4.0.0" + "typescript": "^3.6.3" }, "resolutions": { - "@lerna/**/@lerna/collect-updates": "https://github.com/babel/lerna.git#babel-collect-updates" + "@lerna/collect-updates": "https://github.com/babel/lerna.git#babel-collect-updates" }, "engines": { - "node": ">= 6.9.0 < 13.0.0", - "npm": ">= 3.x <= 6.x", + "node": ">= 6.9.0", + "npm": ">= 3.x", "yarn": ">=0.27.5 || >=1.0.0-20170811" }, "lint-staged": { @@ -87,53 +89,5 @@ "hooks": { "pre-commit": "lint-staged" } - }, - "jest": { - "collectCoverageFrom": [ - "packages/*/src/**/*.mjs", - "packages/*/src/**/*.js", - "codemods/*/src/**/*.mjs", - "codemods/*/src/**/*.js" - ], - "testRegex": "./(packages|codemods)/[^/]+/test/.+\\.m?js$", - "testPathIgnorePatterns": [ - "/node_modules/", - "/test/fixtures/", - "/test/debug-fixtures/", - "/babel-parser/test/expressions/", - "/test/tmp/", - "/test/__data__/", - "/test/helpers/", - "/test/warning\\.js", - "/build/", - "_browser\\.js" - ], - "testEnvironment": "node", - "setupFilesAfterEnv": [ - "/test/testSetupFile.js" - ], - "transformIgnorePatterns": [ - "/node_modules/", - "/packages/babel-standalone/babel(\\.min)?\\.js", - "/packages/babel-preset-env-standalone/babel-preset-env(\\.min)?\\.js", - "/test/(fixtures|tmp|__data__)/", - "/(packages|codemods)/[^/]+/lib/" - ], - "coveragePathIgnorePatterns": [ - "/node_modules/", - "/packages/babel-standalone/babel(\\.min)?\\.js", - "/packages/babel-preset-env-standalone/babel-preset-env(\\.min)?\\.js", - "/test/(fixtures|tmp|__data__)/" - ], - "modulePathIgnorePatterns": [ - "/test/fixtures/", - "/test/tmp/", - "/test/__data__/", - "/build/" - ], - "moduleNameMapper": { - "^@babel/([a-zA-Z0-9_-]+)$": "/packages/babel-$1/" - } - }, - "dependencies": {} + } } diff --git a/packages/babel-cli/package.json b/packages/babel-cli/package.json index 0b4bd8731363..e8def286ed40 100644 --- a/packages/babel-cli/package.json +++ b/packages/babel-cli/package.json @@ -1,6 +1,6 @@ { "name": "@babel/cli", - "version": "7.5.5", + "version": "7.8.4", "description": "Babel command line.", "author": "Sebastian McKenzie ", "homepage": "https://babeljs.io/", @@ -19,25 +19,25 @@ "compiler" ], "dependencies": { - "commander": "^2.8.1", + "commander": "^4.0.1", "convert-source-map": "^1.1.0", "fs-readdir-recursive": "^1.1.0", "glob": "^7.0.0", "lodash": "^4.17.13", - "mkdirp": "^0.5.1", - "output-file-sync": "^2.0.0", + "make-dir": "^2.1.0", "slash": "^2.0.0", "source-map": "^0.5.0" }, "optionalDependencies": { - "chokidar": "^2.0.4" + "chokidar": "^2.1.8" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.5.5", - "@babel/helper-fixtures": "^7.5.5" + "@babel/core": "^7.8.4", + "@babel/helper-fixtures": "^7.8.3", + "rimraf": "^3.0.0" }, "bin": { "babel": "./bin/babel.js", diff --git a/packages/babel-cli/src/babel-external-helpers.js b/packages/babel-cli/src/babel-external-helpers.js index c2560dfa6f37..fef536187c41 100755 --- a/packages/babel-cli/src/babel-external-helpers.js +++ b/packages/babel-cli/src/babel-external-helpers.js @@ -1,7 +1,12 @@ +// @flow + import commander from "commander"; import { buildExternalHelpers } from "@babel/core"; -function collect(value, previousValue): Array { +function collect( + value: string | any, + previousValue: Array, +): Array { // If the user passed the option with no value, like "babel-external-helpers --whitelist", do nothing. if (typeof value !== "string") return previousValue; diff --git a/packages/babel-cli/src/babel/dir.js b/packages/babel-cli/src/babel/dir.js index 2eaca85750f8..9b199b98a4e2 100644 --- a/packages/babel-cli/src/babel/dir.js +++ b/packages/babel-cli/src/babel/dir.js @@ -1,24 +1,48 @@ +// @flow + import defaults from "lodash/defaults"; -import outputFileSync from "output-file-sync"; -import { sync as mkdirpSync } from "mkdirp"; +import { sync as makeDirSync } from "make-dir"; import slash from "slash"; import path from "path"; import fs from "fs"; import * as util from "./util"; +import { type CmdOptions } from "./options"; + +const FILE_TYPE = Object.freeze({ + NON_COMPILABLE: "NON_COMPILABLE", + COMPILED: "COMPILED", + IGNORED: "IGNORED", + ERR_COMPILATION: "ERR_COMPILATION", +}); + +function outputFileSync(filePath: string, data: string | Buffer): void { + makeDirSync(path.dirname(filePath)); + fs.writeFileSync(filePath, data); +} -export default async function({ cliOptions, babelOptions }) { +export default async function({ + cliOptions, + babelOptions, +}: CmdOptions): Promise { const filenames = cliOptions.filenames; - async function write(src, base) { + async function write( + src: string, + base: string, + ): Promise<$Keys> { let relative = path.relative(base, src); if (!util.isCompilableExtension(relative, cliOptions.extensions)) { - return false; + return FILE_TYPE.NON_COMPILABLE; } - // remove extension and then append back on .js - relative = util.adjustRelative(relative, cliOptions.keepFileExtension); + relative = util.withExtension( + relative, + cliOptions.keepFileExtension + ? path.extname(relative) + : cliOptions.outFileExtension, + ); const dest = getDest(relative, base); @@ -33,7 +57,7 @@ export default async function({ cliOptions, babelOptions }) { ), ); - if (!res) return false; + if (!res) return FILE_TYPE.IGNORED; // we've requested explicit sourcemaps to be written to disk if ( @@ -54,37 +78,40 @@ export default async function({ cliOptions, babelOptions }) { console.log(src + " -> " + dest); } - return true; + return FILE_TYPE.COMPILED; } catch (err) { if (cliOptions.watch) { console.error(err); - return false; + return FILE_TYPE.ERR_COMPILATION; } throw err; } } - function getDest(filename, base) { + function getDest(filename: string, base: string): string { if (cliOptions.relative) { return path.join(base, cliOptions.outDir, filename); } return path.join(cliOptions.outDir, filename); } - async function handleFile(src, base) { + async function handleFile(src: string, base: string): Promise { const written = await write(src, base); - if (!written && cliOptions.copyFiles) { + if ( + (cliOptions.copyFiles && written === FILE_TYPE.NON_COMPILABLE) || + (cliOptions.copyIgnored && written === FILE_TYPE.IGNORED) + ) { const filename = path.relative(base, src); const dest = getDest(filename, base); outputFileSync(dest, fs.readFileSync(src)); util.chmod(src, dest); } - return written; + return written === FILE_TYPE.COMPILED; } - async function handle(filenameOrDir) { + async function handle(filenameOrDir: string): Promise { if (!fs.existsSync(filenameOrDir)) return 0; const stat = fs.statSync(filenameOrDir); @@ -116,24 +143,26 @@ export default async function({ cliOptions, babelOptions }) { util.deleteDir(cliOptions.outDir); } - mkdirpSync(cliOptions.outDir); + makeDirSync(cliOptions.outDir); let compiledFiles = 0; for (const filename of cliOptions.filenames) { compiledFiles += await handle(filename); } - console.log( - `Successfully compiled ${compiledFiles} ${ - compiledFiles !== 1 ? "files" : "file" - } with Babel.`, - ); + if (!cliOptions.quiet) { + console.log( + `Successfully compiled ${compiledFiles} ${ + compiledFiles !== 1 ? "files" : "file" + } with Babel.`, + ); + } } if (cliOptions.watch) { const chokidar = util.requireChokidar(); - filenames.forEach(function(filenameOrDir) { + filenames.forEach(function(filenameOrDir: string): void { const watcher = chokidar.watch(filenameOrDir, { persistent: true, ignoreInitial: true, @@ -143,8 +172,8 @@ export default async function({ cliOptions, babelOptions }) { }, }); - ["add", "change"].forEach(function(type) { - watcher.on(type, function(filename) { + ["add", "change"].forEach(function(type: string): void { + watcher.on(type, function(filename: string): void { handleFile( filename, filename === filenameOrDir diff --git a/packages/babel-cli/src/babel/file.js b/packages/babel-cli/src/babel/file.js index f0678e27ed39..c1c60ff91615 100644 --- a/packages/babel-cli/src/babel/file.js +++ b/packages/babel-cli/src/babel/file.js @@ -1,14 +1,26 @@ +// @flow + import convertSourceMap from "convert-source-map"; import defaults from "lodash/defaults"; import sourceMap from "source-map"; import slash from "slash"; +import { sync as makeDirSync } from "make-dir"; import path from "path"; import fs from "fs"; import * as util from "./util"; - -export default async function({ cliOptions, babelOptions }) { - function buildResult(fileResults) { +import { type CmdOptions } from "./options"; + +type CompilationOutput = { + code: string, + map: Object, +}; + +export default async function({ + cliOptions, + babelOptions, +}: CmdOptions): Promise { + function buildResult(fileResults: Array): CompilationOutput { const map = new sourceMap.SourceMapGenerator({ file: cliOptions.sourceMapTarget || @@ -74,10 +86,12 @@ export default async function({ cliOptions, babelOptions }) { }; } - function output(fileResults) { + function output(fileResults: Array): void { const result = buildResult(fileResults); if (cliOptions.outFile) { + makeDirSync(path.dirname(cliOptions.outFile)); + // we've requested for a sourcemap to be written to disk if (babelOptions.sourceMaps && babelOptions.sourceMaps !== "inline") { const mapLoc = cliOptions.outFile + ".map"; @@ -91,14 +105,15 @@ export default async function({ cliOptions, babelOptions }) { } } - function readStdin() { - return new Promise((resolve, reject) => { + function readStdin(): Promise { + return new Promise((resolve: Function, reject: Function): void => { let code = ""; process.stdin.setEncoding("utf8"); process.stdin.on("readable", function() { const chunk = process.stdin.read(); + // $FlowIgnore if (chunk !== null) code += chunk; }); @@ -109,7 +124,7 @@ export default async function({ cliOptions, babelOptions }) { }); } - async function stdin() { + async function stdin(): Promise { const code = await readStdin(); const res = await util.transform( @@ -126,7 +141,7 @@ export default async function({ cliOptions, babelOptions }) { output([res]); } - async function walk(filenames) { + async function walk(filenames: Array): Promise { const _filenames = []; filenames.forEach(function(filename) { @@ -151,7 +166,7 @@ export default async function({ cliOptions, babelOptions }) { }); const results = await Promise.all( - _filenames.map(async function(filename) { + _filenames.map(async function(filename: string): Promise { let sourceFilename = filename; if (cliOptions.outFile) { sourceFilename = path.relative( @@ -168,7 +183,7 @@ export default async function({ cliOptions, babelOptions }) { { sourceFileName: sourceFilename, // Since we're compiling everything to be merged together, - // "inline" applies to the final output file, but to the individual + // "inline" applies to the final output file, but not to the individual // files being concatenated. sourceMaps: babelOptions.sourceMaps === "inline" @@ -192,7 +207,7 @@ export default async function({ cliOptions, babelOptions }) { output(results); } - async function files(filenames) { + async function files(filenames: Array): Promise { if (!cliOptions.skipInitialBuild) { await walk(filenames); } @@ -201,6 +216,7 @@ export default async function({ cliOptions, babelOptions }) { const chokidar = util.requireChokidar(); chokidar .watch(filenames, { + disableGlobbing: true, persistent: true, ignoreInitial: true, awaitWriteFinish: { @@ -208,8 +224,11 @@ export default async function({ cliOptions, babelOptions }) { pollInterval: 10, }, }) - .on("all", function(type, filename) { - if (!util.isCompilableExtension(filename, cliOptions.extensions)) { + .on("all", function(type: string, filename: string): void { + if ( + !util.isCompilableExtension(filename, cliOptions.extensions) && + !filenames.includes(filename) + ) { return; } diff --git a/packages/babel-cli/src/babel/index.js b/packages/babel-cli/src/babel/index.js index f3194576072a..a740bcdedadf 100755 --- a/packages/babel-cli/src/babel/index.js +++ b/packages/babel-cli/src/babel/index.js @@ -6,8 +6,12 @@ import fileCommand from "./file"; const opts = parseArgv(process.argv); -const fn = opts.cliOptions.outDir ? dirCommand : fileCommand; -fn(opts).catch(err => { - console.error(err); - process.exit(1); -}); +if (opts) { + const fn = opts.cliOptions.outDir ? dirCommand : fileCommand; + fn(opts).catch(err => { + console.error(err); + process.exitCode = 1; + }); +} else { + process.exitCode = 2; +} diff --git a/packages/babel-cli/src/babel/options.js b/packages/babel-cli/src/babel/options.js index 41cc0fb83e7f..9fc6f1a640c5 100644 --- a/packages/babel-cli/src/babel/options.js +++ b/packages/babel-cli/src/babel/options.js @@ -1,3 +1,5 @@ +// @flow + import fs from "fs"; import commander from "commander"; @@ -10,19 +12,19 @@ import pkg from "../../package.json"; // Standard Babel input configs. commander.option( "-f, --filename [filename]", - "filename to use when reading from stdin - this will be used in source-maps, errors etc", + "The filename to use when reading from stdin. This will be used in source-maps, errors etc.", ); commander.option( "--presets [list]", - "comma-separated list of preset names", + "A comma-separated list of preset names.", collect, ); commander.option( "--plugins [list]", - "comma-separated list of plugin names", + "A comma-separated list of plugin names.", collect, ); -commander.option("--config-file [path]", "Path to a .babelrc file to use"); +commander.option("--config-file [path]", "Path to a .babelrc file to use."); commander.option( "--env-name [name]", "The name of the 'env' to use when loading configs and plugins. " + @@ -38,120 +40,150 @@ commander.option( commander.option("--source-type [script|module]", ""); commander.option( "--no-babelrc", - "Whether or not to look up .babelrc and .babelignore files", + "Whether or not to look up .babelrc and .babelignore files.", ); commander.option( "--ignore [list]", - "list of glob paths to **not** compile", + "List of glob paths to **not** compile.", collect, ); commander.option( "--only [list]", - "list of glob paths to **only** compile", + "List of glob paths to **only** compile.", collect, ); // Misc babel config. commander.option( "--no-highlight-code", - "enable/disable ANSI syntax highlighting of code frames (on by default)", + "Enable or disable ANSI syntax highlighting of code frames. (on by default)", ); // General output formatting. commander.option( "--no-comments", - "write comments to generated output (true by default)", + "Write comments to generated output. (true by default)", ); commander.option( "--retain-lines", - "retain line numbers - will result in really ugly code", + "Retain line numbers. This will result in really ugly code.", ); commander.option( "--compact [true|false|auto]", - "do not include superfluous whitespace characters and line terminators", + "Do not include superfluous whitespace characters and line terminators.", booleanify, ); -commander.option("--minified", "save as much bytes when printing [true|false]"); +commander.option( + "--minified", + "Save as many bytes when printing. (false by default)", +); commander.option( "--auxiliary-comment-before [string]", - "print a comment before any injected non-user code", + "Print a comment before any injected non-user code.", ); commander.option( "--auxiliary-comment-after [string]", - "print a comment after any injected non-user code", + "Print a comment after any injected non-user code.", ); // General source map formatting. commander.option("-s, --source-maps [true|false|inline|both]", "", booleanify); commander.option( "--source-map-target [string]", - "set `file` on returned source map", + "Set `file` on returned source map.", ); commander.option( "--source-file-name [string]", - "set `sources[0]` on returned source map", + "Set `sources[0]` on returned source map.", ); commander.option( "--source-root [filename]", - "the root from which all sources are relative", + "The root from which all sources are relative.", ); // Config params for certain module output formats. commander.option( "--module-root [filename]", - "optional prefix for the AMD module formatter that will be prepend to the filename on module definitions", + // eslint-disable-next-line max-len + "Optional prefix for the AMD module formatter that will be prepended to the filename on module definitions.", ); -commander.option("-M, --module-ids", "insert an explicit id for modules"); +commander.option("-M, --module-ids", "Insert an explicit id for modules."); commander.option( "--module-id [string]", - "specify a custom name for module ids", + "Specify a custom name for module ids.", ); // "babel" command specific arguments that are not passed to @babel/core. commander.option( "-x, --extensions [extensions]", - "List of extensions to compile when a directory has been input [.es6,.js,.es,.jsx,.mjs]", + "List of extensions to compile when a directory has been the input. [.es6,.js,.es,.jsx,.mjs]", collect, ); commander.option( "--keep-file-extension", - "Preserve the file extensions of the input files", + "Preserve the file extensions of the input files.", ); -commander.option("-w, --watch", "Recompile files on changes"); +commander.option("-w, --watch", "Recompile files on changes."); commander.option( "--skip-initial-build", - "Do not compile files before watching", + "Do not compile files before watching.", ); commander.option( "-o, --out-file [out]", - "Compile all input files into a single file", + "Compile all input files into a single file.", ); commander.option( "-d, --out-dir [out]", - "Compile an input directory of modules into an output directory", + "Compile an input directory of modules into an output directory.", ); commander.option( "--relative", "Compile into an output directory relative to input directory or file. Requires --out-dir [out]", ); + commander.option( "-D, --copy-files", - "When compiling a directory copy over non-compilable files", + "When compiling a directory copy over non-compilable files.", ); commander.option( "--include-dotfiles", - "Include dotfiles when compiling and copying non-compilable files", + "Include dotfiles when compiling and copying non-compilable files.", +); +commander.option( + "--no-copy-ignored", + "Exclude ignored files when copying non-compilable files.", +); + +commander.option( + "--verbose", + "Log everything. This option conflicts with --quiet", +); +commander.option( + "--quiet", + "Don't log anything. This option conflicts with --verbose", ); -commander.option("--verbose", "Log everything"); commander.option( "--delete-dir-on-start", - "Delete the out directory before compilation", + "Delete the out directory before compilation.", +); +commander.option( + "--out-file-extension [string]", + "Use a specific extension for the output files", ); commander.version(pkg.version + " (@babel/core " + version + ")"); commander.usage("[options] "); +// register an empty action handler so that commander.js can throw on +// unknown options _after_ args +// see https://github.com/tj/commander.js/issues/561#issuecomment-522209408 +commander.action(() => {}); -export default function parseArgv(args: Array) { +export type CmdOptions = { + babelOptions: Object, + cliOptions: Object, +}; + +export default function parseArgv(args: Array): CmdOptions | null { // commander.parse(args); @@ -200,6 +232,10 @@ export default function parseArgv(args: Array) { errors.push("--delete-dir-on-start requires --out-dir"); } + if (commander.verbose && commander.quiet) { + errors.push("--verbose and --quiet cannot be used together"); + } + if ( !commander.outDir && filenames.length === 0 && @@ -211,12 +247,18 @@ export default function parseArgv(args: Array) { ); } + if (commander.keepFileExtension && commander.outFileExtension) { + errors.push( + "--out-file-extension cannot be used with --keep-file-extension", + ); + } + if (errors.length) { console.error("babel:"); errors.forEach(function(e) { console.error(" " + e); }); - process.exit(2); + return null; } const opts = commander.opts(); @@ -267,14 +309,17 @@ export default function parseArgv(args: Array) { filenames, extensions: opts.extensions, keepFileExtension: opts.keepFileExtension, + outFileExtension: opts.outFileExtension, watch: opts.watch, skipInitialBuild: opts.skipInitialBuild, outFile: opts.outFile, outDir: opts.outDir, relative: opts.relative, copyFiles: opts.copyFiles, + copyIgnored: opts.copyFiles && opts.copyIgnored, includeDotfiles: opts.includeDotfiles, verbose: opts.verbose, + quiet: opts.quiet, deleteDirOnStart: opts.deleteDirOnStart, sourceMapTarget: opts.sourceMapTarget, }, @@ -293,7 +338,10 @@ function booleanify(val: any): boolean | any { return val; } -function collect(value, previousValue): Array { +function collect( + value: string | any, + previousValue: Array, +): Array { // If the user passed the option with no value, like "babel file.js --presets", do nothing. if (typeof value !== "string") return previousValue; diff --git a/packages/babel-cli/src/babel/util.js b/packages/babel-cli/src/babel/util.js index 99c9ae9b00cd..3cdfe4927982 100644 --- a/packages/babel-cli/src/babel/util.js +++ b/packages/babel-cli/src/babel/util.js @@ -1,10 +1,12 @@ +// @flow + import readdirRecursive from "fs-readdir-recursive"; import * as babel from "@babel/core"; import includes from "lodash/includes"; import path from "path"; import fs from "fs"; -export function chmod(src, dest) { +export function chmod(src: string, dest: string): void { fs.chmodSync(dest, fs.statSync(src).mode); } @@ -13,8 +15,8 @@ type ReaddirFilter = (filename: string) => boolean; export function readdir( dirname: string, includeDotfiles: boolean, - filter: ReaddirFilter, -) { + filter?: ReaddirFilter, +): Array { return readdirRecursive(dirname, (filename, _index, currentDirectory) => { const stat = fs.statSync(path.join(currentDirectory, filename)); @@ -30,7 +32,7 @@ export function readdirForCompilable( dirname: string, includeDotfiles: boolean, altExts?: Array, -) { +): Array { return readdir(dirname, includeDotfiles, function(filename) { return isCompilableExtension(filename, altExts); }); @@ -48,7 +50,7 @@ export function isCompilableExtension( return includes(exts, ext); } -export function addSourceMappingUrl(code, loc) { +export function addSourceMappingUrl(code: string, loc: string): string { return code + "\n//# sourceMappingURL=" + path.basename(loc); } @@ -56,7 +58,11 @@ const CALLER = { name: "@babel/cli", }; -export function transform(filename, code, opts) { +export function transform( + filename: string, + code: string, + opts: Object, +): Promise { opts = { ...opts, caller: CALLER, @@ -71,7 +77,10 @@ export function transform(filename, code, opts) { }); } -export function compile(filename, opts) { +export function compile( + filename: string, + opts: Object | Function, +): Promise { opts = { ...opts, caller: CALLER, @@ -85,7 +94,7 @@ export function compile(filename, opts) { }); } -export function deleteDir(path) { +export function deleteDir(path: string): void { if (fs.existsSync(path)) { fs.readdirSync(path).forEach(function(file) { const curPath = path + "/" + file; @@ -103,10 +112,10 @@ export function deleteDir(path) { process.on("uncaughtException", function(err) { console.error(err); - process.exit(1); + process.exitCode = 1; }); -export function requireChokidar() { +export function requireChokidar(): Object { try { return require("chokidar"); } catch (err) { @@ -118,9 +127,7 @@ export function requireChokidar() { } } -export function adjustRelative(relative, keepFileExtension) { - if (keepFileExtension) { - return relative; - } - return relative.replace(/\.(\w*?)$/, "") + ".js"; +export function withExtension(filename: string, ext: string = ".js") { + const newBasename = path.basename(filename, path.extname(filename)) + ext; + return path.join(path.dirname(filename), newBasename); } diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files --include-dotfiles with ignore in babelrc/.babelrc b/packages/babel-cli/test/fixtures/babel/--copy-files --include-dotfiles with ignore in babelrc/.babelrc new file mode 100644 index 000000000000..b1fb07ff865b --- /dev/null +++ b/packages/babel-cli/test/fixtures/babel/--copy-files --include-dotfiles with ignore in babelrc/.babelrc @@ -0,0 +1,3 @@ +{ + "ignore": ["src/foo"] +} diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files --include-dotfiles with ignore in babelrc/in-files/src/.foorc b/packages/babel-cli/test/fixtures/babel/--copy-files --include-dotfiles with ignore in babelrc/in-files/src/.foorc new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files --include-dotfiles with ignore in babelrc/in-files/src/README.md b/packages/babel-cli/test/fixtures/babel/--copy-files --include-dotfiles with ignore in babelrc/in-files/src/README.md new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files --include-dotfiles with ignore in babelrc/in-files/src/foo/.foo.js b/packages/babel-cli/test/fixtures/babel/--copy-files --include-dotfiles with ignore in babelrc/in-files/src/foo/.foo.js new file mode 100644 index 000000000000..31142aabfe70 --- /dev/null +++ b/packages/babel-cli/test/fixtures/babel/--copy-files --include-dotfiles with ignore in babelrc/in-files/src/foo/.foo.js @@ -0,0 +1 @@ +a; diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files --include-dotfiles with ignore in babelrc/in-files/src/foo/index.js b/packages/babel-cli/test/fixtures/babel/--copy-files --include-dotfiles with ignore in babelrc/in-files/src/foo/index.js new file mode 100644 index 000000000000..e46160df1c7a --- /dev/null +++ b/packages/babel-cli/test/fixtures/babel/--copy-files --include-dotfiles with ignore in babelrc/in-files/src/foo/index.js @@ -0,0 +1 @@ +bar; diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files --include-dotfiles with ignore in babelrc/in-files/src/index.js b/packages/babel-cli/test/fixtures/babel/--copy-files --include-dotfiles with ignore in babelrc/in-files/src/index.js new file mode 100644 index 000000000000..c6788558edcb --- /dev/null +++ b/packages/babel-cli/test/fixtures/babel/--copy-files --include-dotfiles with ignore in babelrc/in-files/src/index.js @@ -0,0 +1 @@ +index; diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files --include-dotfiles with ignore in babelrc/options.json b/packages/babel-cli/test/fixtures/babel/--copy-files --include-dotfiles with ignore in babelrc/options.json new file mode 100644 index 000000000000..bb94e945f80e --- /dev/null +++ b/packages/babel-cli/test/fixtures/babel/--copy-files --include-dotfiles with ignore in babelrc/options.json @@ -0,0 +1,10 @@ +{ + "args": [ + "src", + "--out-dir", + "lib", + "--copy-files", + "--include-dotfiles", + "--verbose" + ] +} diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files --include-dotfiles with ignore in babelrc/out-files/lib/.foorc b/packages/babel-cli/test/fixtures/babel/--copy-files --include-dotfiles with ignore in babelrc/out-files/lib/.foorc new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files --include-dotfiles with ignore in babelrc/out-files/lib/README.md b/packages/babel-cli/test/fixtures/babel/--copy-files --include-dotfiles with ignore in babelrc/out-files/lib/README.md new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files --include-dotfiles with ignore in babelrc/out-files/lib/foo/.foo.js b/packages/babel-cli/test/fixtures/babel/--copy-files --include-dotfiles with ignore in babelrc/out-files/lib/foo/.foo.js new file mode 100644 index 000000000000..31142aabfe70 --- /dev/null +++ b/packages/babel-cli/test/fixtures/babel/--copy-files --include-dotfiles with ignore in babelrc/out-files/lib/foo/.foo.js @@ -0,0 +1 @@ +a; diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files --include-dotfiles with ignore in babelrc/out-files/lib/foo/index.js b/packages/babel-cli/test/fixtures/babel/--copy-files --include-dotfiles with ignore in babelrc/out-files/lib/foo/index.js new file mode 100644 index 000000000000..e46160df1c7a --- /dev/null +++ b/packages/babel-cli/test/fixtures/babel/--copy-files --include-dotfiles with ignore in babelrc/out-files/lib/foo/index.js @@ -0,0 +1 @@ +bar; diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files --include-dotfiles with ignore in babelrc/out-files/lib/index.js b/packages/babel-cli/test/fixtures/babel/--copy-files --include-dotfiles with ignore in babelrc/out-files/lib/index.js new file mode 100644 index 000000000000..1073b618d0dd --- /dev/null +++ b/packages/babel-cli/test/fixtures/babel/--copy-files --include-dotfiles with ignore in babelrc/out-files/lib/index.js @@ -0,0 +1,3 @@ +"use strict"; + +index; diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files --include-dotfiles with ignore in babelrc/stdout.txt b/packages/babel-cli/test/fixtures/babel/--copy-files --include-dotfiles with ignore in babelrc/stdout.txt new file mode 100644 index 000000000000..84a430432e47 --- /dev/null +++ b/packages/babel-cli/test/fixtures/babel/--copy-files --include-dotfiles with ignore in babelrc/stdout.txt @@ -0,0 +1,2 @@ +src/index.js -> lib/index.js +Successfully compiled 1 file with Babel. diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files --include-dotfiles/out-files/lib/foo/foo.js b/packages/babel-cli/test/fixtures/babel/--copy-files --include-dotfiles/out-files/lib/foo/foo.js index e69de29bb2d1..3918c74e4463 100644 --- a/packages/babel-cli/test/fixtures/babel/--copy-files --include-dotfiles/out-files/lib/foo/foo.js +++ b/packages/babel-cli/test/fixtures/babel/--copy-files --include-dotfiles/out-files/lib/foo/foo.js @@ -0,0 +1 @@ +"use strict"; diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files --no-copy-ignored with babelignore/.babelignore b/packages/babel-cli/test/fixtures/babel/--copy-files --no-copy-ignored with babelignore/.babelignore new file mode 100644 index 000000000000..8b4ba6ce4d35 --- /dev/null +++ b/packages/babel-cli/test/fixtures/babel/--copy-files --no-copy-ignored with babelignore/.babelignore @@ -0,0 +1 @@ +src/foo diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files --no-copy-ignored with babelignore/in-files/src/.foorc b/packages/babel-cli/test/fixtures/babel/--copy-files --no-copy-ignored with babelignore/in-files/src/.foorc new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files --no-copy-ignored with babelignore/in-files/src/README.md b/packages/babel-cli/test/fixtures/babel/--copy-files --no-copy-ignored with babelignore/in-files/src/README.md new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files --no-copy-ignored with babelignore/in-files/src/foo/bar.js b/packages/babel-cli/test/fixtures/babel/--copy-files --no-copy-ignored with babelignore/in-files/src/foo/bar.js new file mode 100644 index 000000000000..e46160df1c7a --- /dev/null +++ b/packages/babel-cli/test/fixtures/babel/--copy-files --no-copy-ignored with babelignore/in-files/src/foo/bar.js @@ -0,0 +1 @@ +bar; diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files --no-copy-ignored with babelignore/in-files/src/index.js b/packages/babel-cli/test/fixtures/babel/--copy-files --no-copy-ignored with babelignore/in-files/src/index.js new file mode 100644 index 000000000000..c6788558edcb --- /dev/null +++ b/packages/babel-cli/test/fixtures/babel/--copy-files --no-copy-ignored with babelignore/in-files/src/index.js @@ -0,0 +1 @@ +index; diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files --no-copy-ignored with babelignore/options.json b/packages/babel-cli/test/fixtures/babel/--copy-files --no-copy-ignored with babelignore/options.json new file mode 100644 index 000000000000..4b73dd790e1f --- /dev/null +++ b/packages/babel-cli/test/fixtures/babel/--copy-files --no-copy-ignored with babelignore/options.json @@ -0,0 +1,10 @@ +{ + "args": [ + "src", + "--out-dir", + "lib", + "--copy-files", + "--no-copy-ignored", + "--verbose" + ] +} diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files --no-copy-ignored with babelignore/out-files/lib/README.md b/packages/babel-cli/test/fixtures/babel/--copy-files --no-copy-ignored with babelignore/out-files/lib/README.md new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files --no-copy-ignored with babelignore/out-files/lib/index.js b/packages/babel-cli/test/fixtures/babel/--copy-files --no-copy-ignored with babelignore/out-files/lib/index.js new file mode 100644 index 000000000000..1073b618d0dd --- /dev/null +++ b/packages/babel-cli/test/fixtures/babel/--copy-files --no-copy-ignored with babelignore/out-files/lib/index.js @@ -0,0 +1,3 @@ +"use strict"; + +index; diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files --no-copy-ignored with babelignore/stdout.txt b/packages/babel-cli/test/fixtures/babel/--copy-files --no-copy-ignored with babelignore/stdout.txt new file mode 100644 index 000000000000..84a430432e47 --- /dev/null +++ b/packages/babel-cli/test/fixtures/babel/--copy-files --no-copy-ignored with babelignore/stdout.txt @@ -0,0 +1,2 @@ +src/index.js -> lib/index.js +Successfully compiled 1 file with Babel. diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files --no-copy-ignored with ignore in babelrc/.babelrc b/packages/babel-cli/test/fixtures/babel/--copy-files --no-copy-ignored with ignore in babelrc/.babelrc new file mode 100644 index 000000000000..b1fb07ff865b --- /dev/null +++ b/packages/babel-cli/test/fixtures/babel/--copy-files --no-copy-ignored with ignore in babelrc/.babelrc @@ -0,0 +1,3 @@ +{ + "ignore": ["src/foo"] +} diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files --no-copy-ignored with ignore in babelrc/in-files/src/.foorc b/packages/babel-cli/test/fixtures/babel/--copy-files --no-copy-ignored with ignore in babelrc/in-files/src/.foorc new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files --no-copy-ignored with ignore in babelrc/in-files/src/README.md b/packages/babel-cli/test/fixtures/babel/--copy-files --no-copy-ignored with ignore in babelrc/in-files/src/README.md new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files --no-copy-ignored with ignore in babelrc/in-files/src/foo/bar.js b/packages/babel-cli/test/fixtures/babel/--copy-files --no-copy-ignored with ignore in babelrc/in-files/src/foo/bar.js new file mode 100644 index 000000000000..e46160df1c7a --- /dev/null +++ b/packages/babel-cli/test/fixtures/babel/--copy-files --no-copy-ignored with ignore in babelrc/in-files/src/foo/bar.js @@ -0,0 +1 @@ +bar; diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files --no-copy-ignored with ignore in babelrc/in-files/src/index.js b/packages/babel-cli/test/fixtures/babel/--copy-files --no-copy-ignored with ignore in babelrc/in-files/src/index.js new file mode 100644 index 000000000000..c6788558edcb --- /dev/null +++ b/packages/babel-cli/test/fixtures/babel/--copy-files --no-copy-ignored with ignore in babelrc/in-files/src/index.js @@ -0,0 +1 @@ +index; diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files --no-copy-ignored with ignore in babelrc/options.json b/packages/babel-cli/test/fixtures/babel/--copy-files --no-copy-ignored with ignore in babelrc/options.json new file mode 100644 index 000000000000..4b73dd790e1f --- /dev/null +++ b/packages/babel-cli/test/fixtures/babel/--copy-files --no-copy-ignored with ignore in babelrc/options.json @@ -0,0 +1,10 @@ +{ + "args": [ + "src", + "--out-dir", + "lib", + "--copy-files", + "--no-copy-ignored", + "--verbose" + ] +} diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files --no-copy-ignored with ignore in babelrc/out-files/lib/README.md b/packages/babel-cli/test/fixtures/babel/--copy-files --no-copy-ignored with ignore in babelrc/out-files/lib/README.md new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files --no-copy-ignored with ignore in babelrc/out-files/lib/index.js b/packages/babel-cli/test/fixtures/babel/--copy-files --no-copy-ignored with ignore in babelrc/out-files/lib/index.js new file mode 100644 index 000000000000..1073b618d0dd --- /dev/null +++ b/packages/babel-cli/test/fixtures/babel/--copy-files --no-copy-ignored with ignore in babelrc/out-files/lib/index.js @@ -0,0 +1,3 @@ +"use strict"; + +index; diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files --no-copy-ignored with ignore in babelrc/stdout.txt b/packages/babel-cli/test/fixtures/babel/--copy-files --no-copy-ignored with ignore in babelrc/stdout.txt new file mode 100644 index 000000000000..84a430432e47 --- /dev/null +++ b/packages/babel-cli/test/fixtures/babel/--copy-files --no-copy-ignored with ignore in babelrc/stdout.txt @@ -0,0 +1,2 @@ +src/index.js -> lib/index.js +Successfully compiled 1 file with Babel. diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files --no-copy-ignored with ignore/in-files/src/.foorc b/packages/babel-cli/test/fixtures/babel/--copy-files --no-copy-ignored with ignore/in-files/src/.foorc new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files --no-copy-ignored with ignore/in-files/src/README.md b/packages/babel-cli/test/fixtures/babel/--copy-files --no-copy-ignored with ignore/in-files/src/README.md new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files --no-copy-ignored with ignore/in-files/src/foo/bar.js b/packages/babel-cli/test/fixtures/babel/--copy-files --no-copy-ignored with ignore/in-files/src/foo/bar.js new file mode 100644 index 000000000000..e46160df1c7a --- /dev/null +++ b/packages/babel-cli/test/fixtures/babel/--copy-files --no-copy-ignored with ignore/in-files/src/foo/bar.js @@ -0,0 +1 @@ +bar; diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files --no-copy-ignored with ignore/in-files/src/index.js b/packages/babel-cli/test/fixtures/babel/--copy-files --no-copy-ignored with ignore/in-files/src/index.js new file mode 100644 index 000000000000..c6788558edcb --- /dev/null +++ b/packages/babel-cli/test/fixtures/babel/--copy-files --no-copy-ignored with ignore/in-files/src/index.js @@ -0,0 +1 @@ +index; diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files --no-copy-ignored with ignore/options.json b/packages/babel-cli/test/fixtures/babel/--copy-files --no-copy-ignored with ignore/options.json new file mode 100644 index 000000000000..8654a9282e58 --- /dev/null +++ b/packages/babel-cli/test/fixtures/babel/--copy-files --no-copy-ignored with ignore/options.json @@ -0,0 +1,12 @@ +{ + "args": [ + "src", + "--out-dir", + "lib", + "--copy-files", + "--ignore", + "src/foo", + "--no-copy-ignored", + "--verbose" + ] +} diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files --no-copy-ignored with ignore/out-files/lib/README.md b/packages/babel-cli/test/fixtures/babel/--copy-files --no-copy-ignored with ignore/out-files/lib/README.md new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files --no-copy-ignored with ignore/out-files/lib/index.js b/packages/babel-cli/test/fixtures/babel/--copy-files --no-copy-ignored with ignore/out-files/lib/index.js new file mode 100644 index 000000000000..cb5e86b12ef3 --- /dev/null +++ b/packages/babel-cli/test/fixtures/babel/--copy-files --no-copy-ignored with ignore/out-files/lib/index.js @@ -0,0 +1,3 @@ +"use strict"; + +index; \ No newline at end of file diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files --no-copy-ignored with ignore/stdout.txt b/packages/babel-cli/test/fixtures/babel/--copy-files --no-copy-ignored with ignore/stdout.txt new file mode 100644 index 000000000000..84a430432e47 --- /dev/null +++ b/packages/babel-cli/test/fixtures/babel/--copy-files --no-copy-ignored with ignore/stdout.txt @@ -0,0 +1,2 @@ +src/index.js -> lib/index.js +Successfully compiled 1 file with Babel. diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files --no-copy-ignored with only/in-files/src/.foorc b/packages/babel-cli/test/fixtures/babel/--copy-files --no-copy-ignored with only/in-files/src/.foorc new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files --no-copy-ignored with only/in-files/src/README.md b/packages/babel-cli/test/fixtures/babel/--copy-files --no-copy-ignored with only/in-files/src/README.md new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files --no-copy-ignored with only/in-files/src/foo/bar.js b/packages/babel-cli/test/fixtures/babel/--copy-files --no-copy-ignored with only/in-files/src/foo/bar.js new file mode 100644 index 000000000000..e46160df1c7a --- /dev/null +++ b/packages/babel-cli/test/fixtures/babel/--copy-files --no-copy-ignored with only/in-files/src/foo/bar.js @@ -0,0 +1 @@ +bar; diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files --no-copy-ignored with only/in-files/src/index.js b/packages/babel-cli/test/fixtures/babel/--copy-files --no-copy-ignored with only/in-files/src/index.js new file mode 100644 index 000000000000..c6788558edcb --- /dev/null +++ b/packages/babel-cli/test/fixtures/babel/--copy-files --no-copy-ignored with only/in-files/src/index.js @@ -0,0 +1 @@ +index; diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files --no-copy-ignored with only/options.json b/packages/babel-cli/test/fixtures/babel/--copy-files --no-copy-ignored with only/options.json new file mode 100644 index 000000000000..d8b67e9dca82 --- /dev/null +++ b/packages/babel-cli/test/fixtures/babel/--copy-files --no-copy-ignored with only/options.json @@ -0,0 +1,12 @@ +{ + "args": [ + "src", + "--out-dir", + "lib", + "--copy-files", + "--only", + "src/foo/*", + "--no-copy-ignored", + "--verbose" + ] +} diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files --no-copy-ignored with only/out-files/lib/README.md b/packages/babel-cli/test/fixtures/babel/--copy-files --no-copy-ignored with only/out-files/lib/README.md new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files --no-copy-ignored with only/out-files/lib/foo/bar.js b/packages/babel-cli/test/fixtures/babel/--copy-files --no-copy-ignored with only/out-files/lib/foo/bar.js new file mode 100644 index 000000000000..0ed075a19327 --- /dev/null +++ b/packages/babel-cli/test/fixtures/babel/--copy-files --no-copy-ignored with only/out-files/lib/foo/bar.js @@ -0,0 +1,3 @@ +"use strict"; + +bar; diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files --no-copy-ignored with only/stdout.txt b/packages/babel-cli/test/fixtures/babel/--copy-files --no-copy-ignored with only/stdout.txt new file mode 100644 index 000000000000..673dafc7483e --- /dev/null +++ b/packages/babel-cli/test/fixtures/babel/--copy-files --no-copy-ignored with only/stdout.txt @@ -0,0 +1,2 @@ +src/foo/bar.js -> lib/foo/bar.js +Successfully compiled 1 file with Babel. diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files with ignore in babelignore/.babelignore b/packages/babel-cli/test/fixtures/babel/--copy-files with ignore in babelignore/.babelignore new file mode 100644 index 000000000000..8b4ba6ce4d35 --- /dev/null +++ b/packages/babel-cli/test/fixtures/babel/--copy-files with ignore in babelignore/.babelignore @@ -0,0 +1 @@ +src/foo diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files with ignore in babelignore/in-files/src/.foorc b/packages/babel-cli/test/fixtures/babel/--copy-files with ignore in babelignore/in-files/src/.foorc new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files with ignore in babelignore/in-files/src/README.md b/packages/babel-cli/test/fixtures/babel/--copy-files with ignore in babelignore/in-files/src/README.md new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files with ignore in babelignore/in-files/src/foo/bar.js b/packages/babel-cli/test/fixtures/babel/--copy-files with ignore in babelignore/in-files/src/foo/bar.js new file mode 100644 index 000000000000..e46160df1c7a --- /dev/null +++ b/packages/babel-cli/test/fixtures/babel/--copy-files with ignore in babelignore/in-files/src/foo/bar.js @@ -0,0 +1 @@ +bar; diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files with ignore in babelignore/in-files/src/index.js b/packages/babel-cli/test/fixtures/babel/--copy-files with ignore in babelignore/in-files/src/index.js new file mode 100644 index 000000000000..c6788558edcb --- /dev/null +++ b/packages/babel-cli/test/fixtures/babel/--copy-files with ignore in babelignore/in-files/src/index.js @@ -0,0 +1 @@ +index; diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files with ignore in babelignore/options.json b/packages/babel-cli/test/fixtures/babel/--copy-files with ignore in babelignore/options.json new file mode 100644 index 000000000000..39e3d0dc2606 --- /dev/null +++ b/packages/babel-cli/test/fixtures/babel/--copy-files with ignore in babelignore/options.json @@ -0,0 +1,9 @@ +{ + "args": [ + "src", + "--out-dir", + "lib", + "--copy-files", + "--verbose" + ] +} diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files with ignore in babelignore/out-files/lib/README.md b/packages/babel-cli/test/fixtures/babel/--copy-files with ignore in babelignore/out-files/lib/README.md new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files with ignore in babelignore/out-files/lib/foo/bar.js b/packages/babel-cli/test/fixtures/babel/--copy-files with ignore in babelignore/out-files/lib/foo/bar.js new file mode 100644 index 000000000000..e46160df1c7a --- /dev/null +++ b/packages/babel-cli/test/fixtures/babel/--copy-files with ignore in babelignore/out-files/lib/foo/bar.js @@ -0,0 +1 @@ +bar; diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files with ignore in babelignore/out-files/lib/index.js b/packages/babel-cli/test/fixtures/babel/--copy-files with ignore in babelignore/out-files/lib/index.js new file mode 100644 index 000000000000..1073b618d0dd --- /dev/null +++ b/packages/babel-cli/test/fixtures/babel/--copy-files with ignore in babelignore/out-files/lib/index.js @@ -0,0 +1,3 @@ +"use strict"; + +index; diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files with ignore in babelignore/stdout.txt b/packages/babel-cli/test/fixtures/babel/--copy-files with ignore in babelignore/stdout.txt new file mode 100644 index 000000000000..84a430432e47 --- /dev/null +++ b/packages/babel-cli/test/fixtures/babel/--copy-files with ignore in babelignore/stdout.txt @@ -0,0 +1,2 @@ +src/index.js -> lib/index.js +Successfully compiled 1 file with Babel. diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files with ignore in babelrc/.babelrc b/packages/babel-cli/test/fixtures/babel/--copy-files with ignore in babelrc/.babelrc new file mode 100644 index 000000000000..b1fb07ff865b --- /dev/null +++ b/packages/babel-cli/test/fixtures/babel/--copy-files with ignore in babelrc/.babelrc @@ -0,0 +1,3 @@ +{ + "ignore": ["src/foo"] +} diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files with ignore in babelrc/in-files/src/.foorc b/packages/babel-cli/test/fixtures/babel/--copy-files with ignore in babelrc/in-files/src/.foorc new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files with ignore in babelrc/in-files/src/README.md b/packages/babel-cli/test/fixtures/babel/--copy-files with ignore in babelrc/in-files/src/README.md new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files with ignore in babelrc/in-files/src/foo/bar.js b/packages/babel-cli/test/fixtures/babel/--copy-files with ignore in babelrc/in-files/src/foo/bar.js new file mode 100644 index 000000000000..e46160df1c7a --- /dev/null +++ b/packages/babel-cli/test/fixtures/babel/--copy-files with ignore in babelrc/in-files/src/foo/bar.js @@ -0,0 +1 @@ +bar; diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files with ignore in babelrc/in-files/src/index.js b/packages/babel-cli/test/fixtures/babel/--copy-files with ignore in babelrc/in-files/src/index.js new file mode 100644 index 000000000000..c6788558edcb --- /dev/null +++ b/packages/babel-cli/test/fixtures/babel/--copy-files with ignore in babelrc/in-files/src/index.js @@ -0,0 +1 @@ +index; diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files with ignore in babelrc/options.json b/packages/babel-cli/test/fixtures/babel/--copy-files with ignore in babelrc/options.json new file mode 100644 index 000000000000..39e3d0dc2606 --- /dev/null +++ b/packages/babel-cli/test/fixtures/babel/--copy-files with ignore in babelrc/options.json @@ -0,0 +1,9 @@ +{ + "args": [ + "src", + "--out-dir", + "lib", + "--copy-files", + "--verbose" + ] +} diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files with ignore in babelrc/out-files/lib/README.md b/packages/babel-cli/test/fixtures/babel/--copy-files with ignore in babelrc/out-files/lib/README.md new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files with ignore in babelrc/out-files/lib/foo/bar.js b/packages/babel-cli/test/fixtures/babel/--copy-files with ignore in babelrc/out-files/lib/foo/bar.js new file mode 100644 index 000000000000..e46160df1c7a --- /dev/null +++ b/packages/babel-cli/test/fixtures/babel/--copy-files with ignore in babelrc/out-files/lib/foo/bar.js @@ -0,0 +1 @@ +bar; diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files with ignore in babelrc/out-files/lib/index.js b/packages/babel-cli/test/fixtures/babel/--copy-files with ignore in babelrc/out-files/lib/index.js new file mode 100644 index 000000000000..1073b618d0dd --- /dev/null +++ b/packages/babel-cli/test/fixtures/babel/--copy-files with ignore in babelrc/out-files/lib/index.js @@ -0,0 +1,3 @@ +"use strict"; + +index; diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files with ignore in babelrc/stdout.txt b/packages/babel-cli/test/fixtures/babel/--copy-files with ignore in babelrc/stdout.txt new file mode 100644 index 000000000000..84a430432e47 --- /dev/null +++ b/packages/babel-cli/test/fixtures/babel/--copy-files with ignore in babelrc/stdout.txt @@ -0,0 +1,2 @@ +src/index.js -> lib/index.js +Successfully compiled 1 file with Babel. diff --git a/packages/babel-cli/test/fixtures/babel/--minified/in-files/script.js b/packages/babel-cli/test/fixtures/babel/--minified/in-files/script.js new file mode 100644 index 000000000000..3353ddb752c2 --- /dev/null +++ b/packages/babel-cli/test/fixtures/babel/--minified/in-files/script.js @@ -0,0 +1 @@ +() => 42; diff --git a/packages/babel-cli/test/fixtures/babel/--minified/options.json b/packages/babel-cli/test/fixtures/babel/--minified/options.json new file mode 100644 index 000000000000..2df8c827b826 --- /dev/null +++ b/packages/babel-cli/test/fixtures/babel/--minified/options.json @@ -0,0 +1,3 @@ +{ + "args": ["--out-file", "script2.js", "--no-comments", "--minified", "script.js"] +} diff --git a/packages/babel-cli/test/fixtures/babel/--minified/out-files/script2.js b/packages/babel-cli/test/fixtures/babel/--minified/out-files/script2.js new file mode 100644 index 000000000000..b9260cd4afe8 --- /dev/null +++ b/packages/babel-cli/test/fixtures/babel/--minified/out-files/script2.js @@ -0,0 +1 @@ +"use strict";(function(){return 42}); diff --git a/packages/babel-cli/test/fixtures/babel/dir --out-dir --out-file-extension/in-files/src/bar.mjs b/packages/babel-cli/test/fixtures/babel/dir --out-dir --out-file-extension/in-files/src/bar.mjs new file mode 100644 index 000000000000..7c1178b8d64f --- /dev/null +++ b/packages/babel-cli/test/fixtures/babel/dir --out-dir --out-file-extension/in-files/src/bar.mjs @@ -0,0 +1 @@ +arr.map(x => x / DIVIDER); diff --git a/packages/babel-cli/test/fixtures/babel/dir --out-dir --out-file-extension/in-files/src/foo.jsx b/packages/babel-cli/test/fixtures/babel/dir --out-dir --out-file-extension/in-files/src/foo.jsx new file mode 100644 index 000000000000..4bc9539528d4 --- /dev/null +++ b/packages/babel-cli/test/fixtures/babel/dir --out-dir --out-file-extension/in-files/src/foo.jsx @@ -0,0 +1 @@ +arr.map(x => x * MULTIPLIER); diff --git a/packages/babel-cli/test/fixtures/babel/dir --out-dir --out-file-extension/options.json b/packages/babel-cli/test/fixtures/babel/dir --out-dir --out-file-extension/options.json new file mode 100644 index 000000000000..5150f4941a1f --- /dev/null +++ b/packages/babel-cli/test/fixtures/babel/dir --out-dir --out-file-extension/options.json @@ -0,0 +1,12 @@ +{ + "args": [ + "src", + "--out-dir", + "lib", + "--out-file-extension", + ".mjs", + "--extensions", + ".jsx,.mjs", + "--verbose" + ] +} diff --git a/packages/babel-cli/test/fixtures/babel/dir --out-dir --out-file-extension/out-files/lib/bar.mjs b/packages/babel-cli/test/fixtures/babel/dir --out-dir --out-file-extension/out-files/lib/bar.mjs new file mode 100644 index 000000000000..5d02843681e4 --- /dev/null +++ b/packages/babel-cli/test/fixtures/babel/dir --out-dir --out-file-extension/out-files/lib/bar.mjs @@ -0,0 +1,5 @@ +"use strict"; + +arr.map(function (x) { + return x / DIVIDER; +}); diff --git a/packages/babel-cli/test/fixtures/babel/dir --out-dir --out-file-extension/out-files/lib/foo.mjs b/packages/babel-cli/test/fixtures/babel/dir --out-dir --out-file-extension/out-files/lib/foo.mjs new file mode 100644 index 000000000000..ae4557e57bc3 --- /dev/null +++ b/packages/babel-cli/test/fixtures/babel/dir --out-dir --out-file-extension/out-files/lib/foo.mjs @@ -0,0 +1,5 @@ +"use strict"; + +arr.map(function (x) { + return x * MULTIPLIER; +}); diff --git a/packages/babel-cli/test/fixtures/babel/dir --out-dir --out-file-extension/stdout.txt b/packages/babel-cli/test/fixtures/babel/dir --out-dir --out-file-extension/stdout.txt new file mode 100644 index 000000000000..24ba955afb2b --- /dev/null +++ b/packages/babel-cli/test/fixtures/babel/dir --out-dir --out-file-extension/stdout.txt @@ -0,0 +1,3 @@ +src/bar.mjs -> lib/bar.mjs +src/foo.jsx -> lib/foo.mjs +Successfully compiled 2 files with Babel. diff --git a/packages/babel-cli/test/fixtures/babel/error --keep-file-extension --out-file-extension/options.json b/packages/babel-cli/test/fixtures/babel/error --keep-file-extension --out-file-extension/options.json new file mode 100644 index 000000000000..8ad9743c9dbc --- /dev/null +++ b/packages/babel-cli/test/fixtures/babel/error --keep-file-extension --out-file-extension/options.json @@ -0,0 +1,4 @@ +{ + "args": ["--keep-file-extension", "--out-file-extension", ".mjs"], + "stderrContains": true +} diff --git a/packages/babel-cli/test/fixtures/babel/error --keep-file-extension --out-file-extension/stderr.txt b/packages/babel-cli/test/fixtures/babel/error --keep-file-extension --out-file-extension/stderr.txt new file mode 100644 index 000000000000..acc6f8edb8bb --- /dev/null +++ b/packages/babel-cli/test/fixtures/babel/error --keep-file-extension --out-file-extension/stderr.txt @@ -0,0 +1 @@ +--out-file-extension cannot be used with --keep-file-extension diff --git a/packages/babel-cli/test/fixtures/babel/error incorrect options after args/in-files/script.js b/packages/babel-cli/test/fixtures/babel/error incorrect options after args/in-files/script.js new file mode 100644 index 000000000000..4bc9539528d4 --- /dev/null +++ b/packages/babel-cli/test/fixtures/babel/error incorrect options after args/in-files/script.js @@ -0,0 +1 @@ +arr.map(x => x * MULTIPLIER); diff --git a/packages/babel-cli/test/fixtures/babel/error incorrect options after args/options.json b/packages/babel-cli/test/fixtures/babel/error incorrect options after args/options.json new file mode 100644 index 000000000000..dde64755da06 --- /dev/null +++ b/packages/babel-cli/test/fixtures/babel/error incorrect options after args/options.json @@ -0,0 +1,4 @@ +{ + "args": ["script.js", "--spruce-maps"], + "stderrContains": true +} diff --git a/packages/babel-cli/test/fixtures/babel/error incorrect options after args/stderr.txt b/packages/babel-cli/test/fixtures/babel/error incorrect options after args/stderr.txt new file mode 100644 index 000000000000..294d5ccaeaed --- /dev/null +++ b/packages/babel-cli/test/fixtures/babel/error incorrect options after args/stderr.txt @@ -0,0 +1 @@ +error: unknown option '--spruce-maps' diff --git a/packages/babel-cli/test/fixtures/babel/error incorrect options before args/in-files/script.js b/packages/babel-cli/test/fixtures/babel/error incorrect options before args/in-files/script.js new file mode 100644 index 000000000000..4bc9539528d4 --- /dev/null +++ b/packages/babel-cli/test/fixtures/babel/error incorrect options before args/in-files/script.js @@ -0,0 +1 @@ +arr.map(x => x * MULTIPLIER); diff --git a/packages/babel-cli/test/fixtures/babel/error incorrect options before args/options.json b/packages/babel-cli/test/fixtures/babel/error incorrect options before args/options.json new file mode 100644 index 000000000000..0d7953971726 --- /dev/null +++ b/packages/babel-cli/test/fixtures/babel/error incorrect options before args/options.json @@ -0,0 +1,4 @@ +{ + "args": ["--spruce-maps", "script.js"], + "stderrContains": true +} diff --git a/packages/babel-cli/test/fixtures/babel/error incorrect options before args/stderr.txt b/packages/babel-cli/test/fixtures/babel/error incorrect options before args/stderr.txt new file mode 100644 index 000000000000..294d5ccaeaed --- /dev/null +++ b/packages/babel-cli/test/fixtures/babel/error incorrect options before args/stderr.txt @@ -0,0 +1 @@ +error: unknown option '--spruce-maps' diff --git a/packages/babel-cli/test/fixtures/babel/filename --out-file deep/in-files/script.js b/packages/babel-cli/test/fixtures/babel/filename --out-file deep/in-files/script.js new file mode 100644 index 000000000000..4bc9539528d4 --- /dev/null +++ b/packages/babel-cli/test/fixtures/babel/filename --out-file deep/in-files/script.js @@ -0,0 +1 @@ +arr.map(x => x * MULTIPLIER); diff --git a/packages/babel-cli/test/fixtures/babel/filename --out-file deep/options.json b/packages/babel-cli/test/fixtures/babel/filename --out-file deep/options.json new file mode 100644 index 000000000000..d24719ba4a76 --- /dev/null +++ b/packages/babel-cli/test/fixtures/babel/filename --out-file deep/options.json @@ -0,0 +1,3 @@ +{ + "args": ["script.js", "--out-file", "folder/nested/script.js"] +} diff --git a/packages/babel-cli/test/fixtures/babel/filename --out-file deep/out-files/folder/nested/script.js b/packages/babel-cli/test/fixtures/babel/filename --out-file deep/out-files/folder/nested/script.js new file mode 100644 index 000000000000..ae4557e57bc3 --- /dev/null +++ b/packages/babel-cli/test/fixtures/babel/filename --out-file deep/out-files/folder/nested/script.js @@ -0,0 +1,5 @@ +"use strict"; + +arr.map(function (x) { + return x * MULTIPLIER; +}); diff --git a/packages/babel-cli/test/fixtures/babel/stdin --filename windows/options.json b/packages/babel-cli/test/fixtures/babel/stdin --filename windows/options.json new file mode 100644 index 000000000000..0c847447d595 --- /dev/null +++ b/packages/babel-cli/test/fixtures/babel/stdin --filename windows/options.json @@ -0,0 +1,5 @@ +{ + "args": ["--filename", "test.js"], + "stderrContains": true, + "os": ["win32"] +} diff --git a/packages/babel-cli/test/fixtures/babel/stdin --filename windows/stderr.txt b/packages/babel-cli/test/fixtures/babel/stdin --filename windows/stderr.txt new file mode 100644 index 000000000000..1ca69db1084e --- /dev/null +++ b/packages/babel-cli/test/fixtures/babel/stdin --filename windows/stderr.txt @@ -0,0 +1 @@ +SyntaxError: \test.js: Unexpected token, expected ";" (2:10) diff --git a/packages/babel-cli/test/fixtures/babel/stdin --filename windows/stdin.txt b/packages/babel-cli/test/fixtures/babel/stdin --filename windows/stdin.txt new file mode 100644 index 000000000000..1d931c7e8559 --- /dev/null +++ b/packages/babel-cli/test/fixtures/babel/stdin --filename windows/stdin.txt @@ -0,0 +1,3 @@ +arr.map(function () { + return $]!; +}); diff --git a/packages/babel-cli/test/fixtures/babel/stdin --filename/options.json b/packages/babel-cli/test/fixtures/babel/stdin --filename/options.json index 4274d9a29614..724c35ed8520 100644 --- a/packages/babel-cli/test/fixtures/babel/stdin --filename/options.json +++ b/packages/babel-cli/test/fixtures/babel/stdin --filename/options.json @@ -1,4 +1,5 @@ { "args": ["--filename", "test.js"], - "stderrContains": true + "stderrContains": true, + "os": ["linux", "darwin"] } diff --git a/packages/babel-cli/test/index.js b/packages/babel-cli/test/index.js index 64f64273319c..c9f993b04cbb 100644 --- a/packages/babel-cli/test/index.js +++ b/packages/babel-cli/test/index.js @@ -1,7 +1,7 @@ const readdir = require("fs-readdir-recursive"); const helper = require("@babel/helper-fixtures"); const rimraf = require("rimraf"); -const outputFileSync = require("output-file-sync"); +const { sync: makeDirSync } = require("make-dir"); const child = require("child_process"); const merge = require("lodash/merge"); const path = require("path"); @@ -14,6 +14,11 @@ const fileFilter = function(x) { return x !== ".DS_Store"; }; +const outputFileSync = function(filePath, data) { + makeDirSync(path.dirname(filePath)); + fs.writeFileSync(filePath, data); +}; + const presetLocs = [path.join(__dirname, "../../babel-preset-react")]; const pluginLocs = [ @@ -89,19 +94,21 @@ const assertTest = function(stdout, stderr, opts, cwd) { const actualFiles = readDir(tmpLoc, fileFilter); Object.keys(actualFiles).forEach(function(filename) { - if ( - // saveInFiles always creates an empty .babelrc, so lets exclude for now - filename !== ".babelrc" && - !opts.inFiles.hasOwnProperty(filename) - ) { - const expected = opts.outFiles[filename]; - const actual = actualFiles[filename]; - - expect(expected).not.toBeUndefined(); - - if (expected) { - expect(actual).toBe(expected); + try { + if ( + // saveInFiles always creates an empty .babelrc, so lets exclude for now + filename !== ".babelrc" && + filename !== ".babelignore" && + !Object.prototype.hasOwnProperty.call(opts.inFiles, filename) + ) { + const expected = opts.outFiles[filename]; + const actual = actualFiles[filename]; + + expect(actual).toBe(expected ?? ""); } + } catch (e) { + e.message += "\n at " + filename; + throw e; } }); @@ -115,13 +122,6 @@ const buildTest = function(binName, testName, opts) { const binLoc = path.join(__dirname, "../lib", binName); return function(callback) { - const dir = process.cwd(); - - process.chdir(__dirname); - if (fs.existsSync(tmpLoc)) rimraf.sync(tmpLoc); - fs.mkdirSync(tmpLoc); - process.chdir(tmpLoc); - saveInFiles(opts.inFiles); let args = [binLoc]; @@ -159,7 +159,6 @@ const buildTest = function(binName, testName, opts) { args.map(arg => `"${arg}"`).join(" ") + ": " + err.message; } - process.chdir(dir); callback(err); }); @@ -175,6 +174,26 @@ fs.readdirSync(fixtureLoc).forEach(function(binName) { const suiteLoc = path.join(fixtureLoc, binName); describe("bin/" + binName, function() { + let cwd; + + beforeEach(() => { + cwd = process.cwd(); + + if (fs.existsSync(tmpLoc)) { + for (const child of fs.readdirSync(tmpLoc)) { + rimraf.sync(path.join(tmpLoc, child)); + } + } else { + fs.mkdirSync(tmpLoc); + } + + process.chdir(tmpLoc); + }); + + afterEach(() => { + process.chdir(cwd); + }); + fs.readdirSync(suiteLoc).forEach(function(testName) { if (testName.startsWith(".")) return; @@ -185,7 +204,29 @@ fs.readdirSync(fixtureLoc).forEach(function(binName) { }; const optionsLoc = path.join(testLoc, "options.json"); - if (fs.existsSync(optionsLoc)) merge(opts, require(optionsLoc)); + if (fs.existsSync(optionsLoc)) { + const taskOpts = require(optionsLoc); + if (taskOpts.os) { + let os = taskOpts.os; + + if (!Array.isArray(os) && typeof os !== "string") { + throw new Error( + `'os' should be either string or string array: ${taskOpts.os}`, + ); + } + + if (typeof os === "string") { + os = [os]; + } + + if (!os.includes(process.platform)) { + return; + } + + delete taskOpts.os; + } + merge(opts, taskOpts); + } ["stdout", "stdin", "stderr"].forEach(function(key) { const loc = path.join(testLoc, key + ".txt"); @@ -200,12 +241,18 @@ fs.readdirSync(fixtureLoc).forEach(function(binName) { opts.inFiles = readDir(path.join(testLoc, "in-files"), fileFilter); const babelrcLoc = path.join(testLoc, ".babelrc"); + const babelIgnoreLoc = path.join(testLoc, ".babelignore"); if (fs.existsSync(babelrcLoc)) { // copy .babelrc file to tmp directory opts.inFiles[".babelrc"] = helper.readFile(babelrcLoc); + opts.inFiles[".babelignore"] = helper.readFile(babelIgnoreLoc); + } + if (fs.existsSync(babelIgnoreLoc)) { + // copy .babelignore file to tmp directory + opts.inFiles[".babelignore"] = helper.readFile(babelIgnoreLoc); } - it(testName, buildTest(binName, testName, opts)); + it(testName, buildTest(binName, testName, opts), 20000); }); }); }); diff --git a/packages/babel-code-frame/package.json b/packages/babel-code-frame/package.json index 0b753eb11230..e5ba6996a98a 100644 --- a/packages/babel-code-frame/package.json +++ b/packages/babel-code-frame/package.json @@ -1,6 +1,6 @@ { "name": "@babel/code-frame", - "version": "7.5.5", + "version": "7.8.3", "description": "Generate errors that contain a code frame that point to source locations.", "author": "Sebastian McKenzie ", "homepage": "https://babeljs.io/", @@ -11,7 +11,7 @@ "repository": "https://github.com/babel/babel/tree/master/packages/babel-code-frame", "main": "lib/index.js", "dependencies": { - "@babel/highlight": "^7.0.0" + "@babel/highlight": "^7.8.3" }, "devDependencies": { "chalk": "^2.0.0", diff --git a/packages/babel-compat-data/.npmignore b/packages/babel-compat-data/.npmignore new file mode 100644 index 000000000000..d3587d842355 --- /dev/null +++ b/packages/babel-compat-data/.npmignore @@ -0,0 +1,5 @@ +build +scripts +src +test +*.log diff --git a/packages/babel-compat-data/corejs2-built-ins.js b/packages/babel-compat-data/corejs2-built-ins.js new file mode 100644 index 000000000000..ccbe72f0d58b --- /dev/null +++ b/packages/babel-compat-data/corejs2-built-ins.js @@ -0,0 +1,4 @@ +// Node < 13.3 doesn't support export maps in package.json. +// Use this proxy file as a fallback. + +module.exports = require("./data/corejs2-built-ins.json"); diff --git a/packages/babel-compat-data/corejs3-shipped-proposals.js b/packages/babel-compat-data/corejs3-shipped-proposals.js new file mode 100644 index 000000000000..b6abc7d26767 --- /dev/null +++ b/packages/babel-compat-data/corejs3-shipped-proposals.js @@ -0,0 +1,4 @@ +// Node < 13.3 doesn't support export maps in package.json. +// Use this proxy file as a fallback. + +module.exports = require("./data/corejs3-shipped-proposals.json"); diff --git a/packages/babel-preset-env/data/corejs2-built-ins.json b/packages/babel-compat-data/data/corejs2-built-ins.json similarity index 86% rename from packages/babel-preset-env/data/corejs2-built-ins.json rename to packages/babel-compat-data/data/corejs2-built-ins.json index 2079f1c3d74a..4ed5c101c917 100644 --- a/packages/babel-preset-env/data/corejs2-built-ins.json +++ b/packages/babel-compat-data/data/corejs2-built-ins.json @@ -1,14 +1,14 @@ { "es6.array.copy-within": { "chrome": "45", + "opera": "32", "edge": "12", "firefox": "32", "safari": "9", "node": "4", "ios": "9", "samsung": "5", - "opera": "32", - "electron": "0.35" + "electron": "0.32" }, "es6.array.every": { "chrome": "5", @@ -21,19 +21,19 @@ "android": "4", "ios": "6", "phantom": "2", - "samsung": "2.1", - "electron": "1.1" + "samsung": "1", + "electron": "0.20" }, "es6.array.fill": { "chrome": "45", + "opera": "32", "edge": "12", "firefox": "31", "safari": "7.1", "node": "4", "ios": "8", "samsung": "5", - "opera": "32", - "electron": "0.35" + "electron": "0.32" }, "es6.array.filter": { "chrome": "5", @@ -46,38 +46,40 @@ "android": "4", "ios": "6", "phantom": "2", - "samsung": "2.1", - "electron": "1.1" + "samsung": "1", + "electron": "0.20" }, "es6.array.find": { "chrome": "45", + "opera": "32", "edge": "12", "firefox": "25", "safari": "7.1", "node": "4", "ios": "8", "samsung": "5", - "opera": "32", - "electron": "0.35" + "electron": "0.32" }, "es6.array.find-index": { "chrome": "45", + "opera": "32", "edge": "12", "firefox": "25", "safari": "7.1", "node": "4", "ios": "8", "samsung": "5", - "opera": "32", - "electron": "0.35" + "electron": "0.32" }, "es7.array.flat-map": { "chrome": "69", + "opera": "56", + "edge": "79", "firefox": "62", "safari": "12", "node": "11", "ios": "12", - "opera": "56", + "samsung": "10", "electron": "4" }, "es6.array.for-each": { @@ -91,29 +93,29 @@ "android": "4", "ios": "6", "phantom": "2", - "samsung": "2.1", - "electron": "1.1" + "samsung": "1", + "electron": "0.20" }, "es6.array.from": { "chrome": "51", + "opera": "38", "edge": "15", "firefox": "36", "safari": "10", "node": "6.5", "ios": "10", "samsung": "5", - "opera": "38", "electron": "1.2" }, "es7.array.includes": { "chrome": "47", + "opera": "34", "edge": "14", "firefox": "43", "safari": "10", "node": "6", "ios": "10", "samsung": "5", - "opera": "34", "electron": "0.36" }, "es6.array.index-of": { @@ -127,8 +129,8 @@ "android": "4", "ios": "6", "phantom": "2", - "samsung": "2.1", - "electron": "1.1" + "samsung": "1", + "electron": "0.20" }, "es6.array.is-array": { "chrome": "5", @@ -141,19 +143,19 @@ "android": "4", "ios": "6", "phantom": "2", - "samsung": "2.1", - "electron": "1.1" + "samsung": "1", + "electron": "0.20" }, "es6.array.iterator": { "chrome": "38", + "opera": "25", "edge": "12", "firefox": "28", "safari": "7.1", "node": "0.12", "ios": "8", "samsung": "3", - "opera": "25", - "electron": "0.2" + "electron": "0.20" }, "es6.array.last-index-of": { "chrome": "5", @@ -166,8 +168,8 @@ "android": "4", "ios": "6", "phantom": "2", - "samsung": "2.1", - "electron": "1.1" + "samsung": "1", + "electron": "0.20" }, "es6.array.map": { "chrome": "5", @@ -180,19 +182,19 @@ "android": "4", "ios": "6", "phantom": "2", - "samsung": "2.1", - "electron": "1.1" + "samsung": "1", + "electron": "0.20" }, "es6.array.of": { "chrome": "45", + "opera": "32", "edge": "12", "firefox": "25", "safari": "9", "node": "4", "ios": "9", "samsung": "5", - "opera": "32", - "electron": "0.35" + "electron": "0.32" }, "es6.array.reduce": { "chrome": "5", @@ -205,8 +207,8 @@ "android": "4", "ios": "6", "phantom": "2", - "samsung": "2.1", - "electron": "1.1" + "samsung": "1", + "electron": "0.20" }, "es6.array.reduce-right": { "chrome": "5", @@ -219,8 +221,8 @@ "android": "4", "ios": "6", "phantom": "2", - "samsung": "2.1", - "electron": "1.1" + "samsung": "1", + "electron": "0.20" }, "es6.array.some": { "chrome": "5", @@ -233,8 +235,8 @@ "android": "4", "ios": "6", "phantom": "2", - "samsung": "2.1", - "electron": "1.1" + "samsung": "1", + "electron": "0.20" }, "es6.array.sort": { "chrome": "63", @@ -245,18 +247,18 @@ "node": "10", "ie": "9", "ios": "12", - "samsung": "8.2", - "electron": "3.1" + "samsung": "8", + "electron": "3" }, "es6.array.species": { "chrome": "51", + "opera": "38", "edge": "13", "firefox": "48", "safari": "10", "node": "6.5", "ios": "10", "samsung": "5", - "opera": "38", "electron": "1.2" }, "es6.date.now": { @@ -270,8 +272,8 @@ "android": "4", "ios": "6", "phantom": "2", - "samsung": "2.1", - "electron": "1.1" + "samsung": "1", + "electron": "0.20" }, "es6.date.to-iso-string": { "chrome": "5", @@ -284,8 +286,8 @@ "android": "4", "ios": "6", "phantom": "2", - "samsung": "2.1", - "electron": "1.1" + "samsung": "1", + "electron": "0.20" }, "es6.date.to-json": { "chrome": "5", @@ -297,18 +299,18 @@ "ie": "9", "android": "4", "ios": "10", - "samsung": "2.1", - "electron": "1.1" + "samsung": "1", + "electron": "0.20" }, "es6.date.to-primitive": { "chrome": "47", + "opera": "34", "edge": "15", "firefox": "44", "safari": "10", "node": "6", "ios": "10", "samsung": "5", - "opera": "34", "electron": "0.36" }, "es6.date.to-string": { @@ -322,8 +324,8 @@ "android": "4", "ios": "6", "phantom": "2", - "samsung": "2.1", - "electron": "1.1" + "samsung": "1", + "electron": "0.20" }, "es6.function.bind": { "chrome": "7", @@ -336,18 +338,18 @@ "android": "4", "ios": "6", "phantom": "2", - "samsung": "2.1", - "electron": "5" + "samsung": "1", + "electron": "0.20" }, "es6.function.has-instance": { "chrome": "51", + "opera": "38", "edge": "15", "firefox": "50", "safari": "10", "node": "6.5", "ios": "10", "samsung": "5", - "opera": "38", "electron": "1.2" }, "es6.function.name": { @@ -360,328 +362,330 @@ "android": "4", "ios": "6", "phantom": "2", - "samsung": "2.1", - "electron": "1.1" + "samsung": "1", + "electron": "0.20" }, "es6.map": { "chrome": "51", + "opera": "38", "edge": "15", "firefox": "53", "safari": "10", "node": "6.5", "ios": "10", "samsung": "5", - "opera": "38", "electron": "1.2" }, "es6.math.acosh": { "chrome": "38", + "opera": "25", "edge": "12", "firefox": "25", "safari": "7.1", "node": "0.12", "ios": "8", "samsung": "3", - "opera": "25", - "electron": "0.2" + "electron": "0.20" }, "es6.math.asinh": { "chrome": "38", + "opera": "25", "edge": "12", "firefox": "25", "safari": "7.1", "node": "0.12", "ios": "8", "samsung": "3", - "opera": "25", - "electron": "0.2" + "electron": "0.20" }, "es6.math.atanh": { "chrome": "38", + "opera": "25", "edge": "12", "firefox": "25", "safari": "7.1", "node": "0.12", "ios": "8", "samsung": "3", - "opera": "25", - "electron": "0.2" + "electron": "0.20" }, "es6.math.cbrt": { "chrome": "38", + "opera": "25", "edge": "12", "firefox": "25", "safari": "7.1", "node": "0.12", "ios": "8", "samsung": "3", - "opera": "25", - "electron": "0.2" + "electron": "0.20" }, "es6.math.clz32": { "chrome": "38", + "opera": "25", "edge": "12", "firefox": "31", "safari": "9", "node": "0.12", "ios": "9", "samsung": "3", - "opera": "25", - "electron": "0.2" + "electron": "0.20" }, "es6.math.cosh": { "chrome": "38", + "opera": "25", "edge": "12", "firefox": "25", "safari": "7.1", "node": "0.12", "ios": "8", "samsung": "3", - "opera": "25", - "electron": "0.2" + "electron": "0.20" }, "es6.math.expm1": { "chrome": "38", + "opera": "25", "edge": "12", "firefox": "25", "safari": "7.1", "node": "0.12", "ios": "8", "samsung": "3", - "opera": "25", - "electron": "0.2" + "electron": "0.20" }, "es6.math.fround": { "chrome": "38", + "opera": "25", "edge": "12", "firefox": "26", "safari": "7.1", "node": "0.12", "ios": "8", "samsung": "3", - "opera": "25", - "electron": "0.2" + "electron": "0.20" }, "es6.math.hypot": { "chrome": "38", + "opera": "25", "edge": "12", "firefox": "27", "safari": "7.1", "node": "0.12", "ios": "8", "samsung": "3", - "opera": "25", - "electron": "0.2" + "electron": "0.20" }, "es6.math.imul": { "chrome": "30", + "opera": "17", "edge": "12", "firefox": "23", "safari": "7", "node": "0.12", "android": "4.4", "ios": "7", - "samsung": "2.1", - "opera": "17", - "electron": "0.2" + "samsung": "2", + "electron": "0.20" }, "es6.math.log1p": { "chrome": "38", + "opera": "25", "edge": "12", "firefox": "25", "safari": "7.1", "node": "0.12", "ios": "8", "samsung": "3", - "opera": "25", - "electron": "0.2" + "electron": "0.20" }, "es6.math.log10": { "chrome": "38", + "opera": "25", "edge": "12", "firefox": "25", "safari": "7.1", "node": "0.12", "ios": "8", "samsung": "3", - "opera": "25", - "electron": "0.2" + "electron": "0.20" }, "es6.math.log2": { "chrome": "38", + "opera": "25", "edge": "12", "firefox": "25", "safari": "7.1", "node": "0.12", "ios": "8", "samsung": "3", - "opera": "25", - "electron": "0.2" + "electron": "0.20" }, "es6.math.sign": { "chrome": "38", + "opera": "25", "edge": "12", "firefox": "25", "safari": "9", "node": "0.12", "ios": "9", "samsung": "3", - "opera": "25", - "electron": "0.2" + "electron": "0.20" }, "es6.math.sinh": { "chrome": "38", + "opera": "25", "edge": "12", "firefox": "25", "safari": "7.1", "node": "0.12", "ios": "8", "samsung": "3", - "opera": "25", - "electron": "0.2" + "electron": "0.20" }, "es6.math.tanh": { "chrome": "38", + "opera": "25", "edge": "12", "firefox": "25", "safari": "7.1", "node": "0.12", "ios": "8", "samsung": "3", - "opera": "25", - "electron": "0.2" + "electron": "0.20" }, "es6.math.trunc": { "chrome": "38", + "opera": "25", "edge": "12", "firefox": "25", "safari": "7.1", "node": "0.12", "ios": "8", "samsung": "3", - "opera": "25", - "electron": "0.2" + "electron": "0.20" }, "es6.number.constructor": { "chrome": "41", + "opera": "28", "edge": "12", "firefox": "36", "safari": "9", "node": "4", "ios": "9", "samsung": "3.4", - "opera": "28", - "electron": "0.24" + "electron": "0.22" }, "es6.number.epsilon": { "chrome": "34", + "opera": "21", "edge": "12", "firefox": "25", "safari": "9", "node": "0.12", "ios": "9", - "samsung": "2.1", - "opera": "21", - "electron": "0.2" + "samsung": "2", + "electron": "0.20" }, "es6.number.is-finite": { "chrome": "19", + "opera": "15", "edge": "12", "firefox": "16", "safari": "9", "node": "0.12", "android": "4.1", "ios": "9", - "samsung": "2.1", - "electron": "0.2" + "samsung": "1.5", + "electron": "0.20" }, "es6.number.is-integer": { "chrome": "34", + "opera": "21", "edge": "12", "firefox": "16", "safari": "9", "node": "0.12", "ios": "9", - "samsung": "2.1", - "opera": "21", - "electron": "0.2" + "samsung": "2", + "electron": "0.20" }, "es6.number.is-nan": { "chrome": "19", + "opera": "15", "edge": "12", "firefox": "15", "safari": "9", "node": "0.12", "android": "4.1", "ios": "9", - "samsung": "2.1", - "electron": "0.2" + "samsung": "1.5", + "electron": "0.20" }, "es6.number.is-safe-integer": { "chrome": "34", + "opera": "21", "edge": "12", "firefox": "32", "safari": "9", "node": "0.12", "ios": "9", - "samsung": "2.1", - "opera": "21", - "electron": "0.2" + "samsung": "2", + "electron": "0.20" }, "es6.number.max-safe-integer": { "chrome": "34", + "opera": "21", "edge": "12", "firefox": "31", "safari": "9", "node": "0.12", "ios": "9", - "samsung": "2.1", - "opera": "21", - "electron": "0.2" + "samsung": "2", + "electron": "0.20" }, "es6.number.min-safe-integer": { "chrome": "34", + "opera": "21", "edge": "12", "firefox": "31", "safari": "9", "node": "0.12", "ios": "9", - "samsung": "2.1", - "opera": "21", - "electron": "0.2" + "samsung": "2", + "electron": "0.20" }, "es6.number.parse-float": { "chrome": "34", + "opera": "21", "edge": "12", "firefox": "25", "safari": "9", "node": "0.12", "ios": "9", - "samsung": "2.1", - "opera": "21", - "electron": "0.2" + "samsung": "2", + "electron": "0.20" }, "es6.number.parse-int": { "chrome": "34", + "opera": "21", "edge": "12", "firefox": "25", "safari": "9", "node": "0.12", "ios": "9", - "samsung": "2.1", - "opera": "21", - "electron": "0.2" + "samsung": "2", + "electron": "0.20" }, "es6.object.assign": { "chrome": "49", + "opera": "36", "edge": "13", "firefox": "36", "safari": "10", "node": "6", "ios": "10", "samsung": "5", - "opera": "36", - "electron": "1" + "electron": "0.37" }, "es6.object.create": { "chrome": "5", @@ -694,30 +698,30 @@ "android": "4", "ios": "6", "phantom": "2", - "samsung": "2.1", - "electron": "1.1" + "samsung": "1", + "electron": "0.20" }, "es7.object.define-getter": { "chrome": "62", + "opera": "49", "edge": "16", "firefox": "48", "safari": "9", "node": "8.10", "ios": "9", - "samsung": "8.2", - "opera": "49", - "electron": "3.1" + "samsung": "8", + "electron": "3" }, "es7.object.define-setter": { "chrome": "62", + "opera": "49", "edge": "16", "firefox": "48", "safari": "9", "node": "8.10", "ios": "9", - "samsung": "8.2", - "opera": "49", - "electron": "3.1" + "samsung": "8", + "electron": "3" }, "es6.object.define-property": { "chrome": "5", @@ -730,8 +734,8 @@ "android": "4", "ios": "6", "phantom": "2", - "samsung": "2.1", - "electron": "1.1" + "samsung": "1", + "electron": "0.20" }, "es6.object.define-properties": { "chrome": "5", @@ -744,474 +748,487 @@ "android": "4", "ios": "6", "phantom": "2", - "samsung": "2.1", - "electron": "1.1" + "samsung": "1", + "electron": "0.20" }, "es7.object.entries": { "chrome": "54", + "opera": "41", "edge": "14", "firefox": "47", "safari": "10.1", "node": "7", "ios": "10.3", - "samsung": "6.2", - "opera": "41", + "samsung": "6", "electron": "1.5" }, "es6.object.freeze": { "chrome": "44", + "opera": "31", "edge": "12", "firefox": "35", "safari": "9", "node": "4", "ios": "9", "samsung": "4", - "opera": "31", - "electron": "0.31" + "electron": "0.30" }, "es6.object.get-own-property-descriptor": { "chrome": "44", + "opera": "31", "edge": "12", "firefox": "35", "safari": "9", "node": "4", "ios": "9", "samsung": "4", - "opera": "31", - "electron": "0.31" + "electron": "0.30" }, "es7.object.get-own-property-descriptors": { "chrome": "54", + "opera": "41", "edge": "15", "firefox": "50", "safari": "10.1", "node": "7", "ios": "10.3", - "samsung": "6.2", - "opera": "41", + "samsung": "6", "electron": "1.5" }, "es6.object.get-own-property-names": { "chrome": "40", + "opera": "27", "edge": "12", "firefox": "33", "safari": "9", "node": "4", "ios": "9", "samsung": "3.4", - "opera": "27", "electron": "0.21" }, "es6.object.get-prototype-of": { "chrome": "44", + "opera": "31", "edge": "12", "firefox": "35", "safari": "9", "node": "4", "ios": "9", "samsung": "4", - "opera": "31", - "electron": "0.31" + "electron": "0.30" }, "es7.object.lookup-getter": { "chrome": "62", + "opera": "49", + "edge": "79", "firefox": "36", "safari": "9", "node": "8.10", "ios": "9", - "samsung": "8.2", - "opera": "49", - "electron": "3.1" + "samsung": "8", + "electron": "3" }, "es7.object.lookup-setter": { "chrome": "62", + "opera": "49", + "edge": "79", "firefox": "36", "safari": "9", "node": "8.10", "ios": "9", - "samsung": "8.2", - "opera": "49", - "electron": "3.1" + "samsung": "8", + "electron": "3" }, "es6.object.prevent-extensions": { "chrome": "44", + "opera": "31", "edge": "12", "firefox": "35", "safari": "9", "node": "4", "ios": "9", "samsung": "4", - "opera": "31", - "electron": "0.31" + "electron": "0.30" }, "es6.object.to-string": { "chrome": "57", + "opera": "44", "edge": "15", "firefox": "51", "safari": "10", "node": "8", "ios": "10", - "samsung": "7.2", - "opera": "44", + "samsung": "7", "electron": "1.7" }, "es6.object.is": { "chrome": "19", + "opera": "15", "edge": "12", "firefox": "22", "safari": "9", "node": "0.12", "android": "4.1", "ios": "9", - "samsung": "2.1", - "electron": "0.2" + "samsung": "1.5", + "electron": "0.20" }, "es6.object.is-frozen": { "chrome": "44", + "opera": "31", "edge": "12", "firefox": "35", "safari": "9", "node": "4", "ios": "9", "samsung": "4", - "opera": "31", - "electron": "0.31" + "electron": "0.30" }, "es6.object.is-sealed": { "chrome": "44", + "opera": "31", "edge": "12", "firefox": "35", "safari": "9", "node": "4", "ios": "9", "samsung": "4", - "opera": "31", - "electron": "0.31" + "electron": "0.30" }, "es6.object.is-extensible": { "chrome": "44", + "opera": "31", "edge": "12", "firefox": "35", "safari": "9", "node": "4", "ios": "9", "samsung": "4", - "opera": "31", - "electron": "0.31" + "electron": "0.30" }, "es6.object.keys": { "chrome": "40", + "opera": "27", "edge": "12", "firefox": "35", "safari": "9", "node": "4", "ios": "9", "samsung": "3.4", - "opera": "27", "electron": "0.21" }, "es6.object.seal": { "chrome": "44", + "opera": "31", "edge": "12", "firefox": "35", "safari": "9", "node": "4", "ios": "9", "samsung": "4", - "opera": "31", - "electron": "0.31" + "electron": "0.30" }, "es6.object.set-prototype-of": { "chrome": "34", + "opera": "21", "edge": "12", "firefox": "31", "safari": "9", "node": "0.12", "ie": "11", "ios": "9", - "samsung": "2.1", - "opera": "21", - "electron": "0.2" + "samsung": "2", + "electron": "0.20" }, "es7.object.values": { "chrome": "54", + "opera": "41", "edge": "14", "firefox": "47", "safari": "10.1", "node": "7", "ios": "10.3", - "samsung": "6.2", - "opera": "41", + "samsung": "6", "electron": "1.5" }, "es6.promise": { "chrome": "51", + "opera": "38", "edge": "14", "firefox": "45", "safari": "10", "node": "6.5", "ios": "10", "samsung": "5", - "opera": "38", "electron": "1.2" }, "es7.promise.finally": { "chrome": "63", + "opera": "50", "edge": "18", "firefox": "58", "safari": "11.1", "node": "10", "ios": "11.3", - "samsung": "8.2", - "opera": "50", - "electron": "3.1" + "samsung": "8", + "electron": "3" }, "es6.reflect.apply": { "chrome": "49", + "opera": "36", "edge": "12", "firefox": "42", "safari": "10", "node": "6", "ios": "10", "samsung": "5", - "opera": "36", - "electron": "1" + "electron": "0.37" }, "es6.reflect.construct": { "chrome": "49", + "opera": "36", "edge": "13", "firefox": "49", "safari": "10", "node": "6", "ios": "10", "samsung": "5", - "opera": "36", - "electron": "1" + "electron": "0.37" }, "es6.reflect.define-property": { "chrome": "49", + "opera": "36", "edge": "13", "firefox": "42", "safari": "10", "node": "6", "ios": "10", "samsung": "5", - "opera": "36", - "electron": "1" + "electron": "0.37" }, "es6.reflect.delete-property": { "chrome": "49", + "opera": "36", "edge": "12", "firefox": "42", "safari": "10", "node": "6", "ios": "10", "samsung": "5", - "opera": "36", - "electron": "1" + "electron": "0.37" }, "es6.reflect.get": { "chrome": "49", + "opera": "36", "edge": "12", "firefox": "42", "safari": "10", "node": "6", "ios": "10", "samsung": "5", - "opera": "36", - "electron": "1" + "electron": "0.37" }, "es6.reflect.get-own-property-descriptor": { "chrome": "49", + "opera": "36", "edge": "12", "firefox": "42", "safari": "10", "node": "6", "ios": "10", "samsung": "5", - "opera": "36", - "electron": "1" + "electron": "0.37" }, "es6.reflect.get-prototype-of": { "chrome": "49", + "opera": "36", "edge": "12", "firefox": "42", "safari": "10", "node": "6", "ios": "10", "samsung": "5", - "opera": "36", - "electron": "1" + "electron": "0.37" }, "es6.reflect.has": { "chrome": "49", + "opera": "36", "edge": "12", "firefox": "42", "safari": "10", "node": "6", "ios": "10", "samsung": "5", - "opera": "36", - "electron": "1" + "electron": "0.37" }, "es6.reflect.is-extensible": { "chrome": "49", + "opera": "36", "edge": "12", "firefox": "42", "safari": "10", "node": "6", "ios": "10", "samsung": "5", - "opera": "36", - "electron": "1" + "electron": "0.37" }, "es6.reflect.own-keys": { "chrome": "49", + "opera": "36", "edge": "12", "firefox": "42", "safari": "10", "node": "6", "ios": "10", "samsung": "5", - "opera": "36", - "electron": "1" + "electron": "0.37" }, "es6.reflect.prevent-extensions": { "chrome": "49", + "opera": "36", "edge": "12", "firefox": "42", "safari": "10", "node": "6", "ios": "10", "samsung": "5", - "opera": "36", - "electron": "1" + "electron": "0.37" }, "es6.reflect.set": { "chrome": "49", + "opera": "36", "edge": "12", "firefox": "42", "safari": "10", "node": "6", "ios": "10", "samsung": "5", - "opera": "36", - "electron": "1" + "electron": "0.37" }, "es6.reflect.set-prototype-of": { "chrome": "49", + "opera": "36", "edge": "12", "firefox": "42", "safari": "10", "node": "6", "ios": "10", "samsung": "5", - "opera": "36", - "electron": "1" + "electron": "0.37" }, "es6.regexp.constructor": { "chrome": "50", + "opera": "37", + "edge": "79", "firefox": "40", "safari": "10", "node": "6", "ios": "10", "samsung": "5", - "opera": "37", "electron": "1.1" }, "es6.regexp.flags": { "chrome": "49", + "opera": "36", + "edge": "79", "firefox": "37", "safari": "9", "node": "6", "ios": "9", "samsung": "5", - "opera": "36", - "electron": "1" + "electron": "0.37" }, "es6.regexp.match": { "chrome": "50", + "opera": "37", + "edge": "79", "firefox": "49", "safari": "10", "node": "6", "ios": "10", "samsung": "5", - "opera": "37", "electron": "1.1" }, "es6.regexp.replace": { "chrome": "50", + "opera": "37", + "edge": "79", "firefox": "49", "safari": "10", "node": "6", "ios": "10", "samsung": "5", - "opera": "37", "electron": "1.1" }, "es6.regexp.split": { "chrome": "50", + "opera": "37", + "edge": "79", "firefox": "49", "safari": "10", "node": "6", "ios": "10", "samsung": "5", - "opera": "37", "electron": "1.1" }, "es6.regexp.search": { "chrome": "50", + "opera": "37", + "edge": "79", "firefox": "49", "safari": "10", "node": "6", "ios": "10", "samsung": "5", - "opera": "37", "electron": "1.1" }, "es6.regexp.to-string": { "chrome": "50", + "opera": "37", + "edge": "79", "firefox": "39", "safari": "10", "node": "6", "ios": "10", "samsung": "5", - "opera": "37", "electron": "1.1" }, "es6.set": { "chrome": "51", + "opera": "38", "edge": "15", "firefox": "53", "safari": "10", "node": "6.5", "ios": "10", "samsung": "5", - "opera": "38", "electron": "1.2" }, "es6.symbol": { "chrome": "51", + "opera": "38", + "edge": "79", "firefox": "51", "safari": "10", "node": "6.5", "ios": "10", "samsung": "5", - "opera": "38", "electron": "1.2" }, "es7.symbol.async-iterator": { "chrome": "63", + "opera": "50", + "edge": "79", "firefox": "57", "safari": "12", "node": "10", "ios": "12", - "samsung": "8.2", - "opera": "50", - "electron": "3.1" + "samsung": "8", + "electron": "3" }, "es6.string.anchor": { "chrome": "5", + "opera": "15", "edge": "12", "firefox": "17", "safari": "6", @@ -1219,11 +1236,12 @@ "android": "4", "ios": "7", "phantom": "2", - "samsung": "2.1", - "electron": "1.1" + "samsung": "1", + "electron": "0.20" }, "es6.string.big": { "chrome": "5", + "opera": "15", "edge": "12", "firefox": "17", "safari": "6", @@ -1231,11 +1249,12 @@ "android": "4", "ios": "7", "phantom": "2", - "samsung": "2.1", - "electron": "1.1" + "samsung": "1", + "electron": "0.20" }, "es6.string.blink": { "chrome": "5", + "opera": "15", "edge": "12", "firefox": "17", "safari": "6", @@ -1243,11 +1262,12 @@ "android": "4", "ios": "7", "phantom": "2", - "samsung": "2.1", - "electron": "1.1" + "samsung": "1", + "electron": "0.20" }, "es6.string.bold": { "chrome": "5", + "opera": "15", "edge": "12", "firefox": "17", "safari": "6", @@ -1255,33 +1275,34 @@ "android": "4", "ios": "7", "phantom": "2", - "samsung": "2.1", - "electron": "1.1" + "samsung": "1", + "electron": "0.20" }, "es6.string.code-point-at": { "chrome": "41", + "opera": "28", "edge": "12", "firefox": "29", "safari": "9", "node": "4", "ios": "9", "samsung": "3.4", - "opera": "28", - "electron": "0.24" + "electron": "0.22" }, "es6.string.ends-with": { "chrome": "41", + "opera": "28", "edge": "12", "firefox": "29", "safari": "9", "node": "4", "ios": "9", "samsung": "3.4", - "opera": "28", - "electron": "0.24" + "electron": "0.22" }, "es6.string.fixed": { "chrome": "5", + "opera": "15", "edge": "12", "firefox": "17", "safari": "6", @@ -1289,11 +1310,12 @@ "android": "4", "ios": "7", "phantom": "2", - "samsung": "2.1", - "electron": "1.1" + "samsung": "1", + "electron": "0.20" }, "es6.string.fontcolor": { "chrome": "5", + "opera": "15", "edge": "12", "firefox": "17", "safari": "6", @@ -1301,11 +1323,12 @@ "android": "4", "ios": "7", "phantom": "2", - "samsung": "2.1", - "electron": "1.1" + "samsung": "1", + "electron": "0.20" }, "es6.string.fontsize": { "chrome": "5", + "opera": "15", "edge": "12", "firefox": "17", "safari": "6", @@ -1313,33 +1336,34 @@ "android": "4", "ios": "7", "phantom": "2", - "samsung": "2.1", - "electron": "1.1" + "samsung": "1", + "electron": "0.20" }, "es6.string.from-code-point": { "chrome": "41", + "opera": "28", "edge": "12", "firefox": "29", "safari": "9", "node": "4", "ios": "9", "samsung": "3.4", - "opera": "28", - "electron": "0.24" + "electron": "0.22" }, "es6.string.includes": { "chrome": "41", + "opera": "28", "edge": "12", "firefox": "40", "safari": "9", "node": "4", "ios": "9", "samsung": "3.4", - "opera": "28", - "electron": "0.24" + "electron": "0.22" }, "es6.string.italics": { "chrome": "5", + "opera": "15", "edge": "12", "firefox": "17", "safari": "6", @@ -1347,22 +1371,23 @@ "android": "4", "ios": "7", "phantom": "2", - "samsung": "2.1", - "electron": "1.1" + "samsung": "1", + "electron": "0.20" }, "es6.string.iterator": { "chrome": "38", + "opera": "25", "edge": "12", "firefox": "36", "safari": "9", "node": "0.12", "ios": "9", "samsung": "3", - "opera": "25", - "electron": "0.2" + "electron": "0.20" }, "es6.string.link": { "chrome": "5", + "opera": "15", "edge": "12", "firefox": "17", "safari": "6", @@ -1370,55 +1395,56 @@ "android": "4", "ios": "7", "phantom": "2", - "samsung": "2.1", - "electron": "1.1" + "samsung": "1", + "electron": "0.20" }, "es7.string.pad-start": { "chrome": "57", + "opera": "44", "edge": "15", "firefox": "48", "safari": "10", "node": "8", "ios": "10", - "samsung": "7.2", - "opera": "44", + "samsung": "7", "electron": "1.7" }, "es7.string.pad-end": { "chrome": "57", + "opera": "44", "edge": "15", "firefox": "48", "safari": "10", "node": "8", "ios": "10", - "samsung": "7.2", - "opera": "44", + "samsung": "7", "electron": "1.7" }, "es6.string.raw": { "chrome": "41", + "opera": "28", "edge": "12", "firefox": "34", "safari": "9", "node": "4", "ios": "9", "samsung": "3.4", - "opera": "28", - "electron": "0.24" + "electron": "0.22" }, "es6.string.repeat": { "chrome": "41", + "opera": "28", "edge": "12", "firefox": "24", "safari": "9", "node": "4", "ios": "9", "samsung": "3.4", - "opera": "28", - "electron": "0.24" + "electron": "0.22" }, "es6.string.small": { "chrome": "5", + "opera": "15", "edge": "12", "firefox": "17", "safari": "6", @@ -1426,22 +1452,23 @@ "android": "4", "ios": "7", "phantom": "2", - "samsung": "2.1", - "electron": "1.1" + "samsung": "1", + "electron": "0.20" }, "es6.string.starts-with": { "chrome": "41", + "opera": "28", "edge": "12", "firefox": "29", "safari": "9", "node": "4", "ios": "9", "samsung": "3.4", - "opera": "28", - "electron": "0.24" + "electron": "0.22" }, "es6.string.strike": { "chrome": "5", + "opera": "15", "edge": "12", "firefox": "17", "safari": "6", @@ -1449,11 +1476,12 @@ "android": "4", "ios": "7", "phantom": "2", - "samsung": "2.1", - "electron": "1.1" + "samsung": "1", + "electron": "0.20" }, "es6.string.sub": { "chrome": "5", + "opera": "15", "edge": "12", "firefox": "17", "safari": "6", @@ -1461,11 +1489,12 @@ "android": "4", "ios": "7", "phantom": "2", - "samsung": "2.1", - "electron": "1.1" + "samsung": "1", + "electron": "0.20" }, "es6.string.sup": { "chrome": "5", + "opera": "15", "edge": "12", "firefox": "17", "safari": "6", @@ -1473,8 +1502,8 @@ "android": "4", "ios": "7", "phantom": "2", - "samsung": "2.1", - "electron": "1.1" + "samsung": "1", + "electron": "0.20" }, "es6.string.trim": { "chrome": "5", @@ -1487,36 +1516,40 @@ "android": "4", "ios": "6", "phantom": "2", - "samsung": "2.1", - "electron": "1.1" + "samsung": "1", + "electron": "0.20" }, "es7.string.trim-left": { "chrome": "66", + "opera": "53", + "edge": "79", "firefox": "61", "safari": "12", "node": "10", "ios": "12", - "opera": "53", - "electron": "3.1" + "samsung": "9", + "electron": "3" }, "es7.string.trim-right": { "chrome": "66", + "opera": "53", + "edge": "79", "firefox": "61", "safari": "12", "node": "10", "ios": "12", - "opera": "53", - "electron": "3.1" + "samsung": "9", + "electron": "3" }, "es6.typed.array-buffer": { "chrome": "51", + "opera": "38", "edge": "13", "firefox": "48", "safari": "10", "node": "6.5", "ios": "10", "samsung": "5", - "opera": "38", "electron": "1.2" }, "es6.typed.data-view": { @@ -1530,128 +1563,128 @@ "android": "4", "ios": "6", "phantom": "2", - "samsung": "2.1", - "electron": "1.1" + "samsung": "1", + "electron": "0.20" }, "es6.typed.int8-array": { "chrome": "51", + "opera": "38", "edge": "13", "firefox": "48", "safari": "10", "node": "6.5", "ios": "10", "samsung": "5", - "opera": "38", "electron": "1.2" }, "es6.typed.uint8-array": { "chrome": "51", + "opera": "38", "edge": "13", "firefox": "48", "safari": "10", "node": "6.5", "ios": "10", "samsung": "5", - "opera": "38", "electron": "1.2" }, "es6.typed.uint8-clamped-array": { "chrome": "51", + "opera": "38", "edge": "13", "firefox": "48", "safari": "10", "node": "6.5", "ios": "10", "samsung": "5", - "opera": "38", "electron": "1.2" }, "es6.typed.int16-array": { "chrome": "51", + "opera": "38", "edge": "13", "firefox": "48", "safari": "10", "node": "6.5", "ios": "10", "samsung": "5", - "opera": "38", "electron": "1.2" }, "es6.typed.uint16-array": { "chrome": "51", + "opera": "38", "edge": "13", "firefox": "48", "safari": "10", "node": "6.5", "ios": "10", "samsung": "5", - "opera": "38", "electron": "1.2" }, "es6.typed.int32-array": { "chrome": "51", + "opera": "38", "edge": "13", "firefox": "48", "safari": "10", "node": "6.5", "ios": "10", "samsung": "5", - "opera": "38", "electron": "1.2" }, "es6.typed.uint32-array": { "chrome": "51", + "opera": "38", "edge": "13", "firefox": "48", "safari": "10", "node": "6.5", "ios": "10", "samsung": "5", - "opera": "38", "electron": "1.2" }, "es6.typed.float32-array": { "chrome": "51", + "opera": "38", "edge": "13", "firefox": "48", "safari": "10", "node": "6.5", "ios": "10", "samsung": "5", - "opera": "38", "electron": "1.2" }, "es6.typed.float64-array": { "chrome": "51", + "opera": "38", "edge": "13", "firefox": "48", "safari": "10", "node": "6.5", "ios": "10", "samsung": "5", - "opera": "38", "electron": "1.2" }, "es6.weak-map": { "chrome": "51", + "opera": "38", "edge": "15", "firefox": "53", "safari": "9", "node": "6.5", "ios": "9", "samsung": "5", - "opera": "38", "electron": "1.2" }, "es6.weak-set": { "chrome": "51", + "opera": "38", "edge": "15", "firefox": "53", "safari": "9", "node": "6.5", "ios": "9", "samsung": "5", - "opera": "38", "electron": "1.2" } } diff --git a/packages/babel-compat-data/data/corejs3-shipped-proposals.json b/packages/babel-compat-data/data/corejs3-shipped-proposals.json new file mode 100644 index 000000000000..7ce01ed93444 --- /dev/null +++ b/packages/babel-compat-data/data/corejs3-shipped-proposals.json @@ -0,0 +1,5 @@ +[ + "esnext.global-this", + "esnext.promise.all-settled", + "esnext.string.match-all" +] diff --git a/packages/babel-compat-data/data/native-modules.json b/packages/babel-compat-data/data/native-modules.json new file mode 100644 index 000000000000..980db7b7d21b --- /dev/null +++ b/packages/babel-compat-data/data/native-modules.json @@ -0,0 +1,15 @@ +{ + "es6.module": { + "edge": "16", + "firefox": "60", + "chrome": "61", + "safari": "10.1", + "opera": "48", + "ios_saf": "10.3", + "android": "61", + "op_mob": "48", + "and_chr": "61", + "and_ff": "60", + "samsung": "8.2" + } +} diff --git a/packages/babel-compat-data/data/overlapping-plugins.json b/packages/babel-compat-data/data/overlapping-plugins.json new file mode 100644 index 000000000000..e5d9e4af4297 --- /dev/null +++ b/packages/babel-compat-data/data/overlapping-plugins.json @@ -0,0 +1,18 @@ +{ + "transform-async-to-generator": [ + "bugfix/transform-async-arrows-in-class" + ], + "transform-parameters": [ + "bugfix/transform-edge-default-parameters" + ], + "transform-function-name": [ + "bugfix/transform-edge-function-name" + ], + "transform-block-scoping": [ + "bugfix/transform-safari-block-shadowing", + "bugfix/transform-safari-for-shadowing" + ], + "transform-template-literals": [ + "bugfix/transform-tagged-template-caching" + ] +} diff --git a/packages/babel-compat-data/data/plugin-bugfixes.json b/packages/babel-compat-data/data/plugin-bugfixes.json new file mode 100644 index 000000000000..1768229cc446 --- /dev/null +++ b/packages/babel-compat-data/data/plugin-bugfixes.json @@ -0,0 +1,125 @@ +{ + "transform-async-to-generator": { + "chrome": "55", + "opera": "42", + "edge": "15", + "firefox": "52", + "safari": "10.1", + "node": "7.6", + "ios": "10.3", + "samsung": "6", + "electron": "1.6" + }, + "bugfix/transform-async-arrows-in-class": { + "chrome": "55", + "opera": "42", + "edge": "15", + "firefox": "52", + "safari": "11", + "node": "7.6", + "ios": "11", + "samsung": "6", + "electron": "1.6" + }, + "transform-parameters": { + "chrome": "49", + "opera": "36", + "edge": "15", + "firefox": "53", + "safari": "10", + "node": "6", + "ios": "10", + "samsung": "5", + "electron": "0.37" + }, + "bugfix/transform-edge-default-parameters": { + "chrome": "49", + "opera": "36", + "edge": "18", + "firefox": "52", + "safari": "10", + "node": "6", + "ios": "10", + "samsung": "5", + "electron": "0.37" + }, + "transform-function-name": { + "chrome": "51", + "opera": "38", + "edge": "14", + "firefox": "53", + "safari": "10", + "node": "6.5", + "ios": "10", + "samsung": "5", + "electron": "1.2" + }, + "bugfix/transform-edge-function-name": { + "chrome": "51", + "opera": "38", + "edge": "79", + "firefox": "53", + "safari": "10", + "node": "6.5", + "ios": "10", + "samsung": "5", + "electron": "1.2" + }, + "transform-block-scoping": { + "chrome": "49", + "opera": "36", + "edge": "14", + "firefox": "51", + "safari": "10", + "node": "6", + "ios": "10", + "samsung": "5", + "electron": "0.37" + }, + "bugfix/transform-safari-block-shadowing": { + "chrome": "49", + "opera": "36", + "edge": "12", + "firefox": "44", + "safari": "11", + "node": "6", + "ie": "11", + "ios": "11", + "samsung": "5", + "electron": "0.37" + }, + "bugfix/transform-safari-for-shadowing": { + "chrome": "49", + "opera": "36", + "edge": "12", + "firefox": "4", + "safari": "11", + "node": "6", + "ie": "11", + "ios": "11", + "samsung": "5", + "electron": "0.37" + }, + "transform-template-literals": { + "chrome": "41", + "opera": "28", + "edge": "13", + "firefox": "34", + "safari": "9", + "node": "4", + "ios": "9", + "samsung": "3.4", + "electron": "0.22" + }, + "bugfix/transform-tagged-template-caching": { + "chrome": "41", + "opera": "28", + "edge": "12", + "firefox": "34", + "safari": "13", + "node": "4", + "ios": "13", + "samsung": "3.4", + "electron": "0.22" + } +} diff --git a/packages/babel-preset-env/data/plugins.json b/packages/babel-compat-data/data/plugins.json similarity index 80% rename from packages/babel-preset-env/data/plugins.json rename to packages/babel-compat-data/data/plugins.json index 382a51399431..801f033f09fe 100644 --- a/packages/babel-preset-env/data/plugins.json +++ b/packages/babel-compat-data/data/plugins.json @@ -1,47 +1,187 @@ { + "proposal-numeric-separator": { + "chrome": "75", + "opera": "62", + "edge": "79", + "firefox": "70", + "safari": "13", + "node": "12.5", + "ios": "13", + "samsung": "11", + "electron": "6" + }, + "proposal-nullish-coalescing-operator": { + "chrome": "80", + "opera": "67", + "edge": "80", + "firefox": "72", + "safari": "13.1", + "node": "14", + "electron": "8.1" + }, + "proposal-optional-chaining": { + "chrome": "80", + "opera": "67", + "edge": "80", + "firefox": "74", + "safari": "13.1", + "node": "14", + "electron": "8.1" + }, + "proposal-json-strings": { + "chrome": "66", + "opera": "53", + "edge": "79", + "firefox": "62", + "safari": "12", + "node": "10", + "ios": "12", + "samsung": "9", + "electron": "3" + }, + "proposal-optional-catch-binding": { + "chrome": "66", + "opera": "53", + "edge": "79", + "firefox": "58", + "safari": "11.1", + "node": "10", + "ios": "11.3", + "samsung": "9", + "electron": "3" + }, + "transform-parameters": { + "chrome": "49", + "opera": "36", + "edge": "18", + "firefox": "53", + "safari": "10", + "node": "6", + "ios": "10", + "samsung": "5", + "electron": "0.37" + }, + "proposal-async-generator-functions": { + "chrome": "63", + "opera": "50", + "edge": "79", + "firefox": "57", + "safari": "12", + "node": "10", + "ios": "12", + "samsung": "8", + "electron": "3" + }, + "proposal-object-rest-spread": { + "chrome": "60", + "opera": "47", + "edge": "79", + "firefox": "55", + "safari": "11.1", + "node": "8.3", + "ios": "11.3", + "samsung": "8", + "electron": "2" + }, + "transform-dotall-regex": { + "chrome": "62", + "opera": "49", + "edge": "79", + "safari": "11.1", + "node": "8.10", + "ios": "11.3", + "samsung": "8", + "electron": "3" + }, + "proposal-unicode-property-regex": { + "chrome": "64", + "opera": "51", + "edge": "79", + "safari": "11.1", + "node": "10", + "ios": "11.3", + "samsung": "9", + "electron": "3" + }, + "transform-named-capturing-groups-regex": { + "chrome": "64", + "opera": "51", + "edge": "79", + "safari": "11.1", + "node": "10", + "ios": "11.3", + "samsung": "9", + "electron": "3" + }, + "transform-async-to-generator": { + "chrome": "55", + "opera": "42", + "edge": "15", + "firefox": "52", + "safari": "11", + "node": "7.6", + "ios": "11", + "samsung": "6", + "electron": "1.6" + }, + "transform-exponentiation-operator": { + "chrome": "52", + "opera": "39", + "edge": "14", + "firefox": "52", + "safari": "10.1", + "node": "7", + "ios": "10.3", + "samsung": "6", + "electron": "1.3" + }, "transform-template-literals": { "chrome": "41", + "opera": "28", "edge": "13", "firefox": "34", + "safari": "13", "node": "4", + "ios": "13", "samsung": "3.4", - "opera": "28", - "electron": "0.24" + "electron": "0.22" }, "transform-literals": { "chrome": "44", + "opera": "31", "edge": "12", "firefox": "53", "safari": "9", "node": "4", "ios": "9", "samsung": "4", - "opera": "31", - "electron": "0.31" + "electron": "0.30" }, "transform-function-name": { "chrome": "51", + "opera": "38", + "edge": "79", "firefox": "53", "safari": "10", "node": "6.5", "ios": "10", "samsung": "5", - "opera": "38", "electron": "1.2" }, "transform-arrow-functions": { "chrome": "47", + "opera": "34", "edge": "13", "firefox": "45", "safari": "10", "node": "6", "ios": "10", "samsung": "5", - "opera": "34", "electron": "0.36" }, "transform-block-scoped-functions": { "chrome": "41", + "opera": "28", "edge": "12", "firefox": "46", "safari": "10", @@ -49,259 +189,162 @@ "ie": "11", "ios": "10", "samsung": "3.4", - "opera": "28", - "electron": "0.24" + "electron": "0.22" }, "transform-classes": { "chrome": "46", + "opera": "33", "edge": "13", "firefox": "45", "safari": "10", "node": "5", "ios": "10", "samsung": "5", - "opera": "33", "electron": "0.36" }, "transform-object-super": { "chrome": "46", + "opera": "33", "edge": "13", "firefox": "45", "safari": "10", "node": "5", "ios": "10", "samsung": "5", - "opera": "33", "electron": "0.36" }, "transform-shorthand-properties": { "chrome": "43", + "opera": "30", "edge": "12", "firefox": "33", "safari": "9", "node": "4", "ios": "9", "samsung": "4", - "opera": "30", - "electron": "0.29" + "electron": "0.28" }, "transform-duplicate-keys": { "chrome": "42", + "opera": "29", "edge": "12", "firefox": "34", "safari": "9", "node": "4", "ios": "9", "samsung": "3.4", - "opera": "29", - "electron": "0.27" + "electron": "0.25" }, "transform-computed-properties": { "chrome": "44", + "opera": "31", "edge": "12", "firefox": "34", "safari": "7.1", "node": "4", "ios": "8", "samsung": "4", - "opera": "31", - "electron": "0.31" + "electron": "0.30" }, "transform-for-of": { "chrome": "51", + "opera": "38", "edge": "15", "firefox": "53", "safari": "10", "node": "6.5", "ios": "10", "samsung": "5", - "opera": "38", "electron": "1.2" }, "transform-sticky-regex": { "chrome": "49", + "opera": "36", "edge": "13", "firefox": "3", "safari": "10", "node": "6", "ios": "10", "samsung": "5", - "opera": "36", - "electron": "1" - }, - "transform-dotall-regex": { - "chrome": "62", - "safari": "11.1", - "node": "8.10", - "ios": "11.3", - "samsung": "8.2", - "opera": "49", - "electron": "3.1" + "electron": "0.37" }, "transform-unicode-regex": { "chrome": "50", + "opera": "37", "edge": "13", "firefox": "46", "safari": "12", "node": "6", "ios": "12", "samsung": "5", - "opera": "37", "electron": "1.1" }, "transform-spread": { "chrome": "46", + "opera": "33", "edge": "13", "firefox": "36", "safari": "10", "node": "5", "ios": "10", "samsung": "5", - "opera": "33", "electron": "0.36" }, - "transform-parameters": { - "chrome": "49", - "edge": "18", - "firefox": "53", - "safari": "10", - "node": "6", - "ios": "10", - "samsung": "5", - "opera": "36", - "electron": "1" - }, "transform-destructuring": { "chrome": "51", + "opera": "38", "edge": "15", "firefox": "53", "safari": "10", "node": "6.5", "ios": "10", "samsung": "5", - "opera": "38", "electron": "1.2" }, "transform-block-scoping": { "chrome": "49", + "opera": "36", "edge": "14", "firefox": "51", "safari": "11", "node": "6", "ios": "11", "samsung": "5", - "opera": "36", - "electron": "1" + "electron": "0.37" }, "transform-typeof-symbol": { "chrome": "38", + "opera": "25", "edge": "12", "firefox": "36", "safari": "9", "node": "0.12", "ios": "9", "samsung": "3", - "opera": "25", - "electron": "0.2" + "electron": "0.20" }, "transform-new-target": { "chrome": "46", + "opera": "33", "edge": "14", "firefox": "41", "safari": "10", "node": "5", "ios": "10", "samsung": "5", - "opera": "33", "electron": "0.36" }, "transform-regenerator": { "chrome": "50", + "opera": "37", "edge": "13", "firefox": "53", "safari": "10", "node": "6", "ios": "10", "samsung": "5", - "opera": "37", "electron": "1.1" }, - "transform-exponentiation-operator": { - "chrome": "52", - "edge": "14", - "firefox": "52", - "safari": "10.1", - "node": "7", - "ios": "10.3", - "samsung": "6.2", - "opera": "39", - "electron": "1.3" - }, - "transform-async-to-generator": { - "chrome": "55", - "edge": "15", - "firefox": "52", - "safari": "11", - "node": "7.6", - "ios": "11", - "samsung": "6.2", - "opera": "42", - "electron": "1.6" - }, - "proposal-async-generator-functions": { - "chrome": "63", - "firefox": "57", - "safari": "12", - "node": "10", - "ios": "12", - "samsung": "8.2", - "opera": "50", - "electron": "3.1" - }, - "proposal-object-rest-spread": { - "chrome": "60", - "firefox": "55", - "safari": "11.1", - "node": "8.3", - "ios": "11.3", - "samsung": "8.2", - "opera": "47", - "electron": "2.1" - }, - "proposal-unicode-property-regex": { - "chrome": "64", - "safari": "11.1", - "node": "10", - "ios": "11.3", - "opera": "51", - "electron": "3.1" - }, - "proposal-json-strings": { - "chrome": "66", - "firefox": "62", - "safari": "12", - "node": "10", - "ios": "12", - "opera": "53", - "electron": "3.1" - }, - "proposal-optional-catch-binding": { - "chrome": "66", - "firefox": "58", - "safari": "11.1", - "node": "10", - "ios": "11.3", - "opera": "53", - "electron": "3.1" - }, - "transform-named-capturing-groups-regex": { - "chrome": "64", - "safari": "11.1", - "node": "10", - "ios": "11.3", - "opera": "51", - "electron": "3.1" - }, "transform-member-expression-literals": { "chrome": "7", "opera": "12", @@ -313,8 +356,8 @@ "android": "4", "ios": "6", "phantom": "2", - "samsung": "2.1", - "electron": "5" + "samsung": "1", + "electron": "0.20" }, "transform-property-literals": { "chrome": "7", @@ -327,8 +370,8 @@ "android": "4", "ios": "6", "phantom": "2", - "samsung": "2.1", - "electron": "5" + "samsung": "1", + "electron": "0.20" }, "transform-reserved-words": { "chrome": "13", @@ -341,7 +384,7 @@ "android": "4.4", "ios": "6", "phantom": "2", - "samsung": "2.1", - "electron": "0.2" + "samsung": "1", + "electron": "0.20" } } diff --git a/packages/babel-compat-data/native-modules.js b/packages/babel-compat-data/native-modules.js new file mode 100644 index 000000000000..efa3031c0a53 --- /dev/null +++ b/packages/babel-compat-data/native-modules.js @@ -0,0 +1,4 @@ +// Node < 13.3 doesn't support export maps in package.json. +// Use this proxy file as a fallback. + +module.exports = require("./data/native-modules.json"); diff --git a/packages/babel-compat-data/overlapping-plugins.js b/packages/babel-compat-data/overlapping-plugins.js new file mode 100644 index 000000000000..9f7d8efde56f --- /dev/null +++ b/packages/babel-compat-data/overlapping-plugins.js @@ -0,0 +1,4 @@ +// Node < 13.3 doesn't support export maps in package.json. +// Use this proxy file as a fallback. + +module.exports = require("./data/overlapping-plugins.json"); diff --git a/packages/babel-compat-data/package.json b/packages/babel-compat-data/package.json new file mode 100644 index 000000000000..695557bba730 --- /dev/null +++ b/packages/babel-compat-data/package.json @@ -0,0 +1,38 @@ +{ + "name": "@babel/compat-data", + "version": "7.9.0", + "author": "The Babel Team (https://babeljs.io/team)", + "license": "MIT", + "description": "", + "repository": "https://github.com/babel/babel/tree/master/packages/babel-compat-data", + "publishConfig": { + "access": "public" + }, + "exports": { + "./plugins": "./data/plugins.json", + "./native-modules": "./data/native-modules.json", + "./corejs2-built-ins": "./data/corejs2-built-ins.json", + "./corejs3-shipped-proposals": "./data/corejs3-shipped-proposals.json", + "./overlapping-plugins": "./data/overlapping-plugins.json", + "./plugin-bugfixes": "./data/plugin-bugfixes.json" + }, + "scripts": { + "build-data": "./scripts/download-compat-table.sh; node ./scripts/build-data.js; node ./scripts/build-modules-support.js; node ./scripts/build-bugfixes-targets.js" + }, + "keywords": [ + "babel", + "compat-table", + "compat-data" + ], + "dependencies": { + "browserslist": "^4.11.1", + "invariant": "^2.2.4", + "semver": "^5.5.0" + }, + "devDependencies": { + "@babel/helper-compilation-targets": "^7.8.6", + "caniuse-db": "1.0.30001035", + "electron-to-chromium": "1.3.377", + "lodash": "^4.17.15" + } +} diff --git a/packages/babel-compat-data/plugin-bugfixes.js b/packages/babel-compat-data/plugin-bugfixes.js new file mode 100644 index 000000000000..79e5bfb7b572 --- /dev/null +++ b/packages/babel-compat-data/plugin-bugfixes.js @@ -0,0 +1,4 @@ +// Node < 13.3 doesn't support export maps in package.json. +// Use this proxy file as a fallback. + +module.exports = require("./data/plugin-bugfixes.json"); diff --git a/packages/babel-compat-data/plugins.js b/packages/babel-compat-data/plugins.js new file mode 100644 index 000000000000..74a9d60f2310 --- /dev/null +++ b/packages/babel-compat-data/plugins.js @@ -0,0 +1,4 @@ +// Node < 13.3 doesn't support export maps in package.json. +// Use this proxy file as a fallback. + +module.exports = require("./data/plugins.json"); diff --git a/packages/babel-compat-data/scripts/build-bugfixes-targets.js b/packages/babel-compat-data/scripts/build-bugfixes-targets.js new file mode 100644 index 000000000000..9fe3b77b9f2b --- /dev/null +++ b/packages/babel-compat-data/scripts/build-bugfixes-targets.js @@ -0,0 +1,72 @@ +"use strict"; + +// NOTE: This script must be run _after_ build-data.js + +const path = require("path"); + +const { + getLowestImplementedVersion, + environments, + writeFile, +} = require("./utils-build-data"); + +const data = require("./data/plugin-bugfixes"); +const pluginFeatures = require("./data/plugin-features"); + +const generatedTargets = {}; +const overlappingPlugins = {}; + +const allReplacedFeatures = {}; + +const has = Function.call.bind(Object.hasOwnProperty); + +for (const [plugin, { replaces, features }] of Object.entries(data)) { + if (!has(overlappingPlugins, replaces)) { + overlappingPlugins[replaces] = []; + generatedTargets[replaces] = {}; + allReplacedFeatures[replaces] = []; + } + generatedTargets[plugin] = {}; + + allReplacedFeatures[replaces].push(...features); + + overlappingPlugins[replaces].push(plugin); + + for (const env of environments) { + const supportedWithBugfix = getLowestImplementedVersion({ features }, env); + if (supportedWithBugfix) { + generatedTargets[plugin][env] = supportedWithBugfix; + } + } +} + +for (const [replaced, features] of Object.entries(allReplacedFeatures)) { + let replacedFeatures = pluginFeatures[replaced]; + if (!Array.isArray(replacedFeatures)) { + replacedFeatures = replacedFeatures.features; + } + + for (const env of environments) { + const stillNotSupported = getLowestImplementedVersion( + { features: replacedFeatures }, + env, + name => features.some(feat => name.includes(feat)) + ); + + if (stillNotSupported) { + generatedTargets[replaced][env] = stillNotSupported; + } + } +} + +for (const [filename, data] of [ + ["plugin-bugfixes", generatedTargets], + ["overlapping-plugins", overlappingPlugins], +]) { + const dataPath = path.join(__dirname, `../data/${filename}.json`); + + if (!writeFile(data, dataPath, filename)) { + process.exitCode = 1; + break; + } +} diff --git a/packages/babel-compat-data/scripts/build-corejs3-proposals.js b/packages/babel-compat-data/scripts/build-corejs3-proposals.js new file mode 100644 index 000000000000..80cecb1b36a6 --- /dev/null +++ b/packages/babel-compat-data/scripts/build-corejs3-proposals.js @@ -0,0 +1,34 @@ +const data = require("core-js-compat/data.json"); +const fs = require("fs"); +const path = require("path"); + +const features = Object.keys(data); + +const shippedProposals = features.filter(feature => { + return feature.startsWith("esnext.") && Object.keys(data[feature]).length > 0; +}); + +fs.writeFileSync( + path.join(__dirname, "../data/corejs3-shipped-proposals.json"), + JSON.stringify(shippedProposals, undefined, 2) + "\n" +); + +const finishedProposals = shippedProposals.filter(feature => { + return features.includes(feature.replace("esnext.", "es.")); +}); + +const builtInDefinitionsPath = path.join( + __dirname, + "../../babel-preset-env/src/polyfills/corejs3/built-in-definitions.js" +); + +const builtInDefinitions = fs.readFileSync(builtInDefinitionsPath, "utf-8"); + +for (const feature of finishedProposals) { + const standarizedName = feature.replace("esnext.", "es."); + if (!builtInDefinitions.includes(standarizedName)) { + console.log( + `${feature} is now standarized as ${standarizedName}, please add "${standarizedName}" to "${builtInDefinitionsPath}"` + ); + } +} diff --git a/packages/babel-compat-data/scripts/build-data.js b/packages/babel-compat-data/scripts/build-data.js new file mode 100644 index 000000000000..bda20e1e4c09 --- /dev/null +++ b/packages/babel-compat-data/scripts/build-data.js @@ -0,0 +1,18 @@ +"use strict"; + +const path = require("path"); + +const { generateData, environments, writeFile } = require("./utils-build-data"); + +for (const target of ["plugin", "corejs2-built-in"]) { + const newData = generateData( + environments, + require(`./data/${target}-features`) + ); + const dataPath = path.join(__dirname, `../data/${target}s.json`); + + if (!writeFile(newData, dataPath, target)) { + process.exitCode = 1; + break; + } +} diff --git a/packages/babel-compat-data/scripts/build-modules-support.js b/packages/babel-compat-data/scripts/build-modules-support.js new file mode 100644 index 000000000000..ac7eee8d7fef --- /dev/null +++ b/packages/babel-compat-data/scripts/build-modules-support.js @@ -0,0 +1,40 @@ +const path = require("path"); +const fs = require("fs"); + +const moduleSupport = require("caniuse-db/features-json/es6-module.json"); + +const acceptedWithCaveats = new Set(["safari", "ios_saf"]); + +const browserNameMap = { + and_chr: "chrome", + and_ff: "firefox", + android: "chrome", // map to chrome here as Android WebView 61 is Chromium-based + op_mob: "opera", +}; +const { stats } = moduleSupport; + +const allowedBrowsers = {}; + +Object.keys(stats).forEach(browser => { + const browserName = browserNameMap[browser] || browser; + const browserVersions = stats[browserName]; + const allowedVersions = Object.keys(browserVersions) + .filter(value => { + // Edge 16/17 are marked as "y #6" + return acceptedWithCaveats.has(browserName) + ? browserVersions[value][0] === "a" + : browserVersions[value].startsWith("y"); + }) + .sort((a, b) => a - b); + + if (allowedVersions[0] !== undefined) { + // Handle cases where caniuse specifies version as: "11.0-11.2" + allowedBrowsers[browser] = allowedVersions[0].split("-")[0]; + } +}); + +const dataPath = path.join(__dirname, "../data/native-modules.json"); +const data = { + "es6.module": allowedBrowsers, +}; +fs.writeFileSync(dataPath, `${JSON.stringify(data, null, 2)}\n`); diff --git a/packages/babel-preset-env/data/corejs2-built-in-features.js b/packages/babel-compat-data/scripts/data/corejs2-built-in-features.js similarity index 80% rename from packages/babel-preset-env/data/corejs2-built-in-features.js rename to packages/babel-compat-data/scripts/data/corejs2-built-in-features.js index f18244b4c9ad..2beb9bbed4c8 100644 --- a/packages/babel-preset-env/data/corejs2-built-in-features.js +++ b/packages/babel-compat-data/scripts/data/corejs2-built-in-features.js @@ -26,7 +26,7 @@ const typedArrayMethods = [ "typed arrays / %TypedArray%[Symbol.species]", ]; -const es = { +module.exports = { // compat-table missing babel6 mapping // "es6.array.concat": { // features: [ @@ -34,7 +34,8 @@ const es = { // "well-known symbols / Symbol.species, Array.prototype.concat", // ] // }, - "es6.array.copy-within": "Array.prototype methods / Array.prototype.copyWithin", + "es6.array.copy-within": + "Array.prototype methods / Array.prototype.copyWithin", "es6.array.every": "Array methods / Array.prototype.every", "es6.array.fill": "Array.prototype methods / Array.prototype.fill", "es6.array.filter": { @@ -46,7 +47,8 @@ const es = { }, "es6.array.find": "Array.prototype methods / Array.prototype.find", "es6.array.find-index": "Array.prototype methods / Array.prototype.findIndex", - "es7.array.flat-map": "Array.prototype.{flat, flatMap} / Array.prototype.flatMap", + "es7.array.flat-map": + "Array.prototype.{flat, flatMap} / Array.prototype.flatMap", "es6.array.for-each": "Array methods / Array.prototype.forEach", "es6.array.from": "Array static methods / Array.from", "es7.array.includes": "Array.prototype.includes", @@ -90,12 +92,36 @@ const es = { "es6.function.has-instance": "well-known symbols / Symbol.hasInstance", "es6.function.name": { features: [ - "function \"name\" property / function statements", - "function \"name\" property / function expressions", + 'function "name" property / function statements', + 'function "name" property / function expressions', ], }, - "es6.map": "Map", + // This is explicit to prevent Map-related proposals (like + // Map.prototype.upsert) from being included + "es6.map": { + features: [ + "Map / basic functionality", + "Map / constructor arguments", + "Map / constructor requires new", + "Map / constructor accepts null", + "Map / constructor invokes set", + "Map / iterator closing", + "Map / Map.prototype.add returns this", + "Map / -0 key converts to +0", + "Map / Map.prototype.size", + "Map / Map.prototype.delete", + "Map / Map.prototype.clear", + "Map / Map.prototype.forEach", + "Map / Map.prototype.keys", + "Map / Map.prototype.values", + "Map / Map.prototype.entries", + "Map / Map.prototype[Symbol.iterator]", + "Map / Map.prototype isn't an instance", + "Map / Map iterator prototype chain", + "Map / Map[Symbol.species]", + ], + }, "es6.math.acosh": "Math methods / Math.acosh", "es6.math.asinh": "Math methods / Math.asinh", @@ -150,13 +176,19 @@ const es = { ], }, "es6.object.define-property": "Object static methods / Object.defineProperty", - "es6.object.define-properties": "Object static methods / Object.defineProperties", + "es6.object.define-properties": + "Object static methods / Object.defineProperties", "es7.object.entries": "Object static methods / Object.entries", - "es6.object.freeze": "Object static methods accept primitives / Object.freeze", - "es6.object.get-own-property-descriptor": "Object static methods accept primitives / Object.getOwnPropertyDescriptor", - "es7.object.get-own-property-descriptors": "Object static methods / Object.getOwnPropertyDescriptors", - "es6.object.get-own-property-names": "Object static methods accept primitives / Object.getOwnPropertyNames", - "es6.object.get-prototype-of": "Object static methods accept primitives / Object.getPrototypeOf", + "es6.object.freeze": + "Object static methods accept primitives / Object.freeze", + "es6.object.get-own-property-descriptor": + "Object static methods accept primitives / Object.getOwnPropertyDescriptor", + "es7.object.get-own-property-descriptors": + "Object static methods / Object.getOwnPropertyDescriptors", + "es6.object.get-own-property-names": + "Object static methods accept primitives / Object.getOwnPropertyNames", + "es6.object.get-prototype-of": + "Object static methods accept primitives / Object.getPrototypeOf", "es7.object.lookup-getter": { features: [ "Object.prototype getter/setter methods / __lookupGetter__", @@ -175,15 +207,20 @@ const es = { "Object.prototype getter/setter methods / __lookupSetter__, data properties can shadow accessors", ], }, - "es6.object.prevent-extensions": "Object static methods accept primitives / Object.preventExtensions", + "es6.object.prevent-extensions": + "Object static methods accept primitives / Object.preventExtensions", "es6.object.to-string": "well-known symbols / Symbol.toStringTag", "es6.object.is": "Object static methods / Object.is", - "es6.object.is-frozen": "Object static methods accept primitives / Object.isFrozen", - "es6.object.is-sealed": "Object static methods accept primitives / Object.isSealed", - "es6.object.is-extensible": "Object static methods accept primitives / Object.isExtensible", + "es6.object.is-frozen": + "Object static methods accept primitives / Object.isFrozen", + "es6.object.is-sealed": + "Object static methods accept primitives / Object.isSealed", + "es6.object.is-extensible": + "Object static methods accept primitives / Object.isExtensible", "es6.object.keys": "Object static methods accept primitives / Object.keys", "es6.object.seal": "Object static methods accept primitives / Object.seal", - "es6.object.set-prototype-of": "Object static methods / Object.setPrototypeOf", + "es6.object.set-prototype-of": + "Object static methods / Object.setPrototypeOf", "es7.object.values": "Object static methods / Object.values", "es6.promise": { @@ -200,7 +237,8 @@ const es = { "es6.reflect.define-property": "Reflect / Reflect.defineProperty", "es6.reflect.delete-property": "Reflect / Reflect.deleteProperty", "es6.reflect.get": "Reflect / Reflect.get", - "es6.reflect.get-own-property-descriptor": "Reflect / Reflect.getOwnPropertyDescriptor", + "es6.reflect.get-own-property-descriptor": + "Reflect / Reflect.getOwnPropertyDescriptor", "es6.reflect.get-prototype-of": "Reflect / Reflect.getPrototypeOf", "es6.reflect.has": "Reflect / Reflect.has", "es6.reflect.is-extensible": "Reflect / Reflect.isExtensible", @@ -216,11 +254,16 @@ const es = { ], }, "es6.regexp.flags": "RegExp.prototype properties / RegExp.prototype.flags", - "es6.regexp.match": "RegExp.prototype properties / RegExp.prototype[Symbol.match]", - "es6.regexp.replace": "RegExp.prototype properties / RegExp.prototype[Symbol.replace]", - "es6.regexp.split": "RegExp.prototype properties / RegExp.prototype[Symbol.split]", - "es6.regexp.search": "RegExp.prototype properties / RegExp.prototype[Symbol.search]", - "es6.regexp.to-string": "miscellaneous / RegExp.prototype.toString generic and uses \"flags\" property", + "es6.regexp.match": + "RegExp.prototype properties / RegExp.prototype[Symbol.match]", + "es6.regexp.replace": + "RegExp.prototype properties / RegExp.prototype[Symbol.replace]", + "es6.regexp.split": + "RegExp.prototype properties / RegExp.prototype[Symbol.split]", + "es6.regexp.search": + "RegExp.prototype properties / RegExp.prototype[Symbol.search]", + "es6.regexp.to-string": + 'miscellaneous / RegExp.prototype.toString generic and uses "flags" property', // This is explicit due to prevent the stage-1 Set proposals under the // category "Set methods" from being included. @@ -271,15 +314,18 @@ const es = { "es6.string.big": "String.prototype HTML methods", "es6.string.blink": "String.prototype HTML methods", "es6.string.bold": "String.prototype HTML methods", - "es6.string.code-point-at": "String.prototype methods / String.prototype.codePointAt", - "es6.string.ends-with": "String.prototype methods / String.prototype.endsWith", + "es6.string.code-point-at": + "String.prototype methods / String.prototype.codePointAt", + "es6.string.ends-with": + "String.prototype methods / String.prototype.endsWith", "es6.string.fixed": "String.prototype HTML methods", "es6.string.fontcolor": "String.prototype HTML methods", "es6.string.fontsize": "String.prototype HTML methods", "es6.string.from-code-point": "String static methods / String.fromCodePoint", "es6.string.includes": "String.prototype methods / String.prototype.includes", "es6.string.italics": "String.prototype HTML methods", - "es6.string.iterator": "String.prototype methods / String.prototype[Symbol.iterator]", + "es6.string.iterator": + "String.prototype methods / String.prototype[Symbol.iterator]", "es6.string.link": "String.prototype HTML methods", // "String.prototype methods / String.prototype.normalize" not implemented "es7.string.pad-start": "String padding / String.prototype.padStart", @@ -287,7 +333,8 @@ const es = { "es6.string.raw": "String static methods / String.raw", "es6.string.repeat": "String.prototype methods / String.prototype.repeat", "es6.string.small": "String.prototype HTML methods", - "es6.string.starts-with": "String.prototype methods / String.prototype.startsWith", + "es6.string.starts-with": + "String.prototype methods / String.prototype.startsWith", "es6.string.strike": "String.prototype HTML methods", "es6.string.sub": "String.prototype HTML methods", "es6.string.sup": "String.prototype HTML methods", @@ -329,7 +376,3 @@ const es = { "es6.weak-set": "WeakSet", }; - -const proposals = require("./shipped-proposals").builtIns; - -module.exports = Object.assign({}, es, proposals); diff --git a/packages/babel-compat-data/scripts/data/plugin-bugfixes.js b/packages/babel-compat-data/scripts/data/plugin-bugfixes.js new file mode 100644 index 000000000000..53d3b81e6c38 --- /dev/null +++ b/packages/babel-compat-data/scripts/data/plugin-bugfixes.js @@ -0,0 +1,38 @@ +/* eslint sort-keys: "error" */ + +module.exports = { + "bugfix/transform-async-arrows-in-class": { + features: ["async functions / async arrow functions in methods, classes"], + replaces: "transform-async-to-generator", + }, + "bugfix/transform-edge-default-parameters": { + features: [ + "destructuring, parameters / shorthand defaults, arrow function", + ], + replaces: "transform-parameters", + }, + "bugfix/transform-edge-function-name": { + features: ['function "name" property / variables (function)'], + replaces: "transform-function-name", + }, + "bugfix/transform-safari-block-shadowing": { + features: [ + "const / scope shadow resolution", + "const / scope shadow resolution (strict mode)", + "let / scope shadow resolution", + "let / scope shadow resolution (strict mode)", + ], + replaces: "transform-block-scoping", + }, + "bugfix/transform-safari-for-shadowing": { + features: [ + "let / for-in loop binding shadowing parameter", + "let / for-in loop binding shadowing parameter (strict mode)", + ], + replaces: "transform-block-scoping", + }, + "bugfix/transform-tagged-template-caching": { + features: ["template literals / TemplateStrings permanent caching"], + replaces: "transform-template-literals", + }, +}; diff --git a/packages/babel-compat-data/scripts/data/plugin-features.js b/packages/babel-compat-data/scripts/data/plugin-features.js new file mode 100644 index 000000000000..0671413626fa --- /dev/null +++ b/packages/babel-compat-data/scripts/data/plugin-features.js @@ -0,0 +1,140 @@ +// WARNING: Plugin ordering is important. Don't reorder this file +// without checking that it doesn't break anything. + +const es5 = { + "transform-member-expression-literals": + "Object/array literal extensions / Reserved words as property names", + "transform-property-literals": + "Object/array literal extensions / Reserved words as property names", + "transform-reserved-words": "Miscellaneous / Unreserved words", +}; + +// https://github.com/babel/babel/issues/11278 +// transform-parameters should run before object-rest-spread +const es2015Parameter = { + "transform-parameters": { + features: [ + "default function parameters", + "rest parameters", + "destructuring, parameters / aliased defaults, arrow function", + "destructuring, parameters / shorthand defaults, arrow function", + ], + }, +}; + +const es2015 = { + "transform-template-literals": { + features: ["template literals"], + }, + "transform-literals": { + features: ["Unicode code point escapes"], + }, + "transform-function-name": { + features: ['function "name" property'], + }, + "transform-arrow-functions": { + features: ["arrow functions"], + }, + "transform-block-scoped-functions": { + features: ["block-level function declaration"], + }, + "transform-classes": { + features: ["class", "super"], + }, + "transform-object-super": { + features: ["super"], + }, + "transform-shorthand-properties": { + features: ["object literal extensions / shorthand properties"], + }, + "transform-duplicate-keys": { + features: ["miscellaneous / duplicate property names in strict mode"], + }, + "transform-computed-properties": { + features: ["object literal extensions / computed properties"], + }, + "transform-for-of": { + features: ["for..of loops"], + }, + "transform-sticky-regex": { + features: [ + 'RegExp "y" and "u" flags / "y" flag, lastIndex', + 'RegExp "y" and "u" flags / "y" flag', + ], + }, + "transform-unicode-regex": { + features: [ + 'RegExp "y" and "u" flags / "u" flag, case folding', + 'RegExp "y" and "u" flags / "u" flag, Unicode code point escapes', + 'RegExp "y" and "u" flags / "u" flag, non-BMP Unicode characters', + 'RegExp "y" and "u" flags / "u" flag', + ], + }, + "transform-spread": { + features: ["spread syntax for iterable objects"], + }, + "transform-destructuring": { + features: ["destructuring, assignment", "destructuring, declarations"], + }, + "transform-block-scoping": { + features: ["const", "let"], + }, + "transform-typeof-symbol": { + features: ["Symbol / typeof support"], + }, + "transform-new-target": { + features: ["new.target"], + }, + "transform-regenerator": { + features: ["generators"], + }, +}; + +const es2016 = { + "transform-exponentiation-operator": { + features: ["exponentiation (**) operator"], + }, +}; + +const es2017 = { + "transform-async-to-generator": { + features: ["async functions"], + }, +}; + +const es2018 = { + "proposal-async-generator-functions": "Asynchronous Iterators", + "proposal-object-rest-spread": "object rest/spread properties", + + "transform-dotall-regex": "s (dotAll) flag for regular expressions", + "proposal-unicode-property-regex": "RegExp Unicode Property Escapes", + "transform-named-capturing-groups-regex": "RegExp named capture groups", +}; + +const es2019 = { + "proposal-json-strings": "JSON superset", + "proposal-optional-catch-binding": "optional catch binding", +}; + +const es2020 = { + "proposal-nullish-coalescing-operator": "nullish coalescing operator (??)", + "proposal-optional-chaining": "optional chaining operator (?.)", +}; + +const shippedProposal = { + "proposal-numeric-separator": "numeric separator", +}; + +// Run plugins for modern features first +module.exports = Object.assign( + {}, + shippedProposal, + es2020, + es2019, + es2015Parameter, + es2018, + es2017, + es2016, + es2015, + es5 +); diff --git a/packages/babel-compat-data/scripts/download-compat-table.sh b/packages/babel-compat-data/scripts/download-compat-table.sh new file mode 100755 index 000000000000..394fe1ed4ed9 --- /dev/null +++ b/packages/babel-compat-data/scripts/download-compat-table.sh @@ -0,0 +1,20 @@ +#!/bin/bash +set -e + +COMPAT_TABLE_COMMIT=9e07df3875d8416af85cf523716519e9dd1e5e44 +GIT_HEAD=build/compat-table/.git/HEAD + +if [ -d "build/compat-table" ]; then + cd build/compat-table + commit="$(git rev-parse HEAD)" + cd ../.. + + if [ $commit == $COMPAT_TABLE_COMMIT ]; then + exit 0 + fi +fi + +rm -rf build/compat-table +mkdir -p build +git clone --branch=gh-pages --single-branch --shallow-since=2020-04-01 https://github.com/kangax/compat-table.git build/compat-table +cd build/compat-table && git checkout -qf $COMPAT_TABLE_COMMIT diff --git a/packages/babel-compat-data/scripts/utils-build-data.js b/packages/babel-compat-data/scripts/utils-build-data.js new file mode 100644 index 000000000000..28708953e4e5 --- /dev/null +++ b/packages/babel-compat-data/scripts/utils-build-data.js @@ -0,0 +1,143 @@ +"use strict"; + +const fs = require("fs"); +const flatMap = require("lodash/flatMap"); +const mapValues = require("lodash/mapValues"); +const findLastIndex = require("lodash/findLastIndex"); +const electronToChromiumVersions = require("electron-to-chromium").versions; + +const envs = require("../build/compat-table/environments"); +const parseEnvsVersions = require("../build/compat-table/build-utils/parse-envs-versions"); +const interpolateAllResults = require("../build/compat-table/build-utils/interpolate-all-results"); +const compareVersions = require("../build/compat-table/build-utils/compare-versions"); + +// Add Electron to the list of environments +Object.keys(electronToChromiumVersions).forEach(electron => { + const chrome = electronToChromiumVersions[electron]; + + const electronId = `electron${electron.replace(".", "_")}`; + let chromeId = `chrome${chrome}`; + + // This is missing + if (chromeId === "chrome82") chromeId = "chrome81"; + if (!envs[chromeId]) { + throw new Error( + `Electron ${electron} inherits from Chrome ${chrome}, which is not defined.` + ); + } + + envs[electronId] = { equals: chromeId }; +}); + +const envsVersions = parseEnvsVersions(envs); + +const compatSources = ["es5", "es6", "es2016plus", "esnext"].map(source => { + const data = require(`../build/compat-table/data-${source}`); + interpolateAllResults(data.tests, envs); + return data; +}); + +// End of compat-table code adaptation + +exports.environments = [ + "chrome", + "opera", + "edge", + "firefox", + "safari", + "node", + "ie", + "android", + "ios", + "phantom", + "samsung", + "electron", +]; + +const compatibilityTests = flatMap(compatSources, data => + flatMap(data.tests, test => { + if (!test.subtests) return test; + + return test.subtests.map(subtest => + Object.assign({}, subtest, { + name: test.name + " / " + subtest.name, + group: test.name, + }) + ); + }) +); + +exports.getLowestImplementedVersion = ( + { features }, + env, + exclude = () => false +) => { + const tests = compatibilityTests.filter(test => { + // TODO (Babel 9): Use ||=, &&= + let ok = features.includes(test.name); + ok = ok || (test.group && features.includes(test.group)); + ok = ok || (features.length === 1 && test.name.startsWith(features[0])); + ok = ok && !exclude(test.name); + return ok; + }); + + const envTests = tests.map(({ res }) => { + const lastNotImplemented = findLastIndex( + envsVersions[env], + // Babel assumes strict mode + ({ id }) => !(res[id] === true || res[id] === "strict") + ); + + return envsVersions[env][lastNotImplemented + 1]; + }); + + if (envTests.length === 0 || envTests.some(t => !t)) return null; + + const result = envTests.reduce((a, b) => { + return compareVersions(a, b) > 0 ? a : b; + }); + + // NOTE(bng): A number of environments in compat-table changed to + // include a trailing zero (node10 -> node10_0), so for now stripping + // it to be consistent + return result.version.join(".").replace(/\.0$/, ""); +}; + +exports.generateData = (environments, features) => { + return mapValues(features, options => { + if (!options.features) { + options = { + features: [options], + }; + } + + const plugin = {}; + + environments.forEach(env => { + const version = exports.getLowestImplementedVersion(options, env); + if (version) plugin[env] = version; + }); + + return plugin; + }); +}; + +exports.writeFile = function(data, dataPath, name) { + const stringified = JSON.stringify(data, null, 2) + "\n"; + if (process.env.CHECK_COMPAT_DATA) { + const currentData = fs.readFileSync(dataPath, "utf8"); + + // Compare as JSON strings to also check keys ordering + if (currentData !== stringified) { + console.error( + `The newly generated ${name} data does not match the current ` + + "files. Re-run `make build-compat-data`." + ); + + return false; + } + } else { + fs.writeFileSync(dataPath, stringified); + } + return true; +}; diff --git a/packages/babel-core/package.json b/packages/babel-core/package.json index 56efb4a95fc5..abaadca60b32 100644 --- a/packages/babel-core/package.json +++ b/packages/babel-core/package.json @@ -1,6 +1,6 @@ { "name": "@babel/core", - "version": "7.5.5", + "version": "7.9.0", "description": "Babel compiler core.", "main": "lib/index.js", "author": "Sebastian McKenzie ", @@ -28,28 +28,35 @@ "engines": { "node": ">=6.9.0" }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/babel" + }, "browser": { "./lib/config/files/index.js": "./lib/config/files/index-browser.js", - "./lib/transform-file.js": "./lib/transform-file-browser.js" + "./lib/transform-file.js": "./lib/transform-file-browser.js", + "./src/config/files/index.js": "./src/config/files/index-browser.js", + "./src/transform-file.js": "./src/transform-file-browser.js" }, "dependencies": { - "@babel/code-frame": "^7.5.5", - "@babel/generator": "^7.5.5", - "@babel/helpers": "^7.5.5", - "@babel/parser": "^7.5.5", - "@babel/template": "^7.4.4", - "@babel/traverse": "^7.5.5", - "@babel/types": "^7.5.5", - "convert-source-map": "^1.1.0", + "@babel/code-frame": "^7.8.3", + "@babel/generator": "^7.9.0", + "@babel/helper-module-transforms": "^7.9.0", + "@babel/helpers": "^7.9.0", + "@babel/parser": "^7.9.0", + "@babel/template": "^7.8.6", + "@babel/traverse": "^7.9.0", + "@babel/types": "^7.9.0", + "convert-source-map": "^1.7.0", "debug": "^4.1.0", - "json5": "^2.1.0", + "gensync": "^1.0.0-beta.1", + "json5": "^2.1.2", "lodash": "^4.17.13", "resolve": "^1.3.2", "semver": "^5.4.1", "source-map": "^0.5.0" }, "devDependencies": { - "@babel/helper-transform-fixture-test-runner": "^7.5.5", - "@babel/register": "^7.5.5" + "@babel/helper-transform-fixture-test-runner": "^7.8.3" } } diff --git a/packages/babel-core/src/config/caching.js b/packages/babel-core/src/config/caching.js index 5b915e7f7767..fcad6e8fccbe 100644 --- a/packages/babel-core/src/config/caching.js +++ b/packages/babel-core/src/config/caching.js @@ -1,5 +1,17 @@ // @flow +import gensync, { type Handler } from "gensync"; +import { + maybeAsync, + isAsync, + onFirstPause, + waitFor, + isThenable, +} from "../gensync-utils/async"; +import { isIterableIterator } from "./util"; + +export type { CacheConfigurator }; + export type SimpleCacheConfigurator = SimpleCacheConfiguratorFn & SimpleCacheConfiguratorObj; @@ -14,91 +26,223 @@ type SimpleCacheConfiguratorObj = { invalidate: (handler: () => T) => T, }; -type CacheEntry = Array<{ +export type CacheEntry = Array<{ value: ResultT, - valid: SideChannel => boolean, + valid: SideChannel => Handler, }>; -export type { CacheConfigurator }; +const synchronize = ( + gen: (...ArgsT) => Handler, + // $FlowIssue https://github.com/facebook/flow/issues/7279 +): ((...args: ArgsT) => ResultT) => { + return gensync(gen).sync; +}; -/** - * Given a function with a single argument, cache its results based on its argument and how it - * configures its caching behavior. Cached values are stored strongly. - */ -export function makeStrongCache( +// eslint-disable-next-line require-yield, no-unused-vars +function* genTrue(data: any) { + return true; +} + +export function makeWeakCache( + handler: (ArgT, CacheConfigurator) => Handler | ResultT, +): (ArgT, SideChannel) => Handler { + return makeCachedFunction(WeakMap, handler); +} + +export function makeWeakCacheSync( handler: (ArgT, CacheConfigurator) => ResultT, ): (ArgT, SideChannel) => ResultT { - return makeCachedFunction(new Map(), handler); + return synchronize<[ArgT, SideChannel], ResultT>( + makeWeakCache(handler), + ); } -/** - * Given a function with a single argument, cache its results based on its argument and how it - * configures its caching behavior. Cached values are stored weakly and the function argument must be - * an object type. - */ -export function makeWeakCache< - ArgT: {} | Array<*> | $ReadOnlyArray<*>, - ResultT, - SideChannel, ->( +export function makeStrongCache( + handler: (ArgT, CacheConfigurator) => Handler | ResultT, +): (ArgT, SideChannel) => Handler { + return makeCachedFunction(Map, handler); +} + +export function makeStrongCacheSync( handler: (ArgT, CacheConfigurator) => ResultT, ): (ArgT, SideChannel) => ResultT { - return makeCachedFunction(new WeakMap(), handler); + return synchronize<[ArgT, SideChannel], ResultT>( + makeStrongCache(handler), + ); +} + +/* NOTE: Part of the logic explained in this comment is explained in the + * getCachedValueOrWait and setupAsyncLocks functions. + * + * > There are only two hard things in Computer Science: cache invalidation and naming things. + * > -- Phil Karlton + * + * I don't know if Phil was also thinking about handling a cache whose invalidation function is + * defined asynchronously is considered, but it is REALLY hard to do correctly. + * + * The implemented logic (only when gensync is run asynchronously) is the following: + * 1. If there is a valid cache associated to the current "arg" parameter, + * a. RETURN the cached value + * 3. If there is a FinishLock associated to the current "arg" parameter representing a valid cache, + * a. Wait for that lock to be released + * b. RETURN the value associated with that lock + * 5. Start executing the function to be cached + * a. If it pauses on a promise, then + * i. Let FinishLock be a new lock + * ii. Store FinishLock as associated to the current "arg" parameter + * iii. Wait for the function to finish executing + * iv. Release FinishLock + * v. Send the function result to anyone waiting on FinishLock + * 6. Store the result in the cache + * 7. RETURN the result + */ +function makeCachedFunction( + CallCache: Class, + handler: (ArgT, CacheConfigurator) => Handler | ResultT, +): (ArgT, SideChannel) => Handler { + const callCacheSync = new CallCache(); + const callCacheAsync = new CallCache(); + const futureCache = new CallCache(); + + return function* cachedFunction(arg: ArgT, data: SideChannel) { + const asyncContext = yield* isAsync(); + const callCache = asyncContext ? callCacheAsync : callCacheSync; + + const cached = yield* getCachedValueOrWait( + asyncContext, + callCache, + futureCache, + arg, + data, + ); + if (cached.valid) return cached.value; + + const cache = new CacheConfigurator(data); + + const handlerResult = handler(arg, cache); + + let finishLock: ?Lock; + let value: ResultT; + + if (isIterableIterator(handlerResult)) { + // Flow refines handlerResult to Generator + const gen = (handlerResult: Generator<*, ResultT, *>); + + value = yield* onFirstPause(gen, () => { + finishLock = setupAsyncLocks(cache, futureCache, arg); + }); + } else { + // $FlowIgnore doesn't refine handlerResult to ResultT + value = (handlerResult: ResultT); + } + + updateFunctionCache(callCache, cache, arg, value); + + if (finishLock) { + futureCache.delete(arg); + finishLock.release(value); + } + + return value; + }; } type CacheMap = | Map> | WeakMap>; -function makeCachedFunction< +function* getCachedValue< ArgT, ResultT, SideChannel, // $FlowIssue https://github.com/facebook/flow/issues/4528 Cache: CacheMap, >( - callCache: Cache, - handler: (ArgT, CacheConfigurator) => ResultT, -): (ArgT, SideChannel) => ResultT { - return function cachedFunction(arg, data) { - let cachedValue: CacheEntry | void = callCache.get( - arg, - ); - - if (cachedValue) { - for (const { value, valid } of cachedValue) { - if (valid(data)) return value; - } + cache: Cache, + arg: ArgT, + data: SideChannel, +): Handler<{ valid: true, value: ResultT } | { valid: false, value: null }> { + const cachedValue: CacheEntry | void = cache.get(arg); + + if (cachedValue) { + for (const { value, valid } of cachedValue) { + if (yield* valid(data)) return { valid: true, value }; } + } - const cache = new CacheConfigurator(data); + return { valid: false, value: null }; +} + +function* getCachedValueOrWait( + asyncContext: boolean, + callCache: CacheMap, + futureCache: CacheMap, SideChannel>, + arg: ArgT, + data: SideChannel, +): Handler<{ valid: true, value: ResultT } | { valid: false, value: null }> { + const cached = yield* getCachedValue(callCache, arg, data); + if (cached.valid) { + return cached; + } - const value = handler(arg, cache); - - if (!cache.configured()) cache.forever(); - - cache.deactivate(); - - switch (cache.mode()) { - case "forever": - cachedValue = [{ value, valid: () => true }]; - callCache.set(arg, cachedValue); - break; - case "invalidate": - cachedValue = [{ value, valid: cache.validator() }]; - callCache.set(arg, cachedValue); - break; - case "valid": - if (cachedValue) { - cachedValue.push({ value, valid: cache.validator() }); - } else { - cachedValue = [{ value, valid: cache.validator() }]; - callCache.set(arg, cachedValue); - } + if (asyncContext) { + const cached = yield* getCachedValue(futureCache, arg, data); + if (cached.valid) { + const value = yield* waitFor(cached.value.promise); + return { valid: true, value }; } + } - return value; - }; + return { valid: false, value: null }; +} + +function setupAsyncLocks( + config: CacheConfigurator, + futureCache: CacheMap, SideChannel>, + arg: ArgT, +): Lock { + const finishLock = new Lock(); + + updateFunctionCache(futureCache, config, arg, finishLock); + + return finishLock; +} + +function updateFunctionCache< + ArgT, + ResultT, + SideChannel, + // $FlowIssue https://github.com/facebook/flow/issues/4528 + Cache: CacheMap, +>( + cache: Cache, + config: CacheConfigurator, + arg: ArgT, + value: ResultT, +) { + if (!config.configured()) config.forever(); + + let cachedValue: CacheEntry | void = cache.get(arg); + + config.deactivate(); + + switch (config.mode()) { + case "forever": + cachedValue = [{ value, valid: genTrue }]; + cache.set(arg, cachedValue); + break; + case "invalidate": + cachedValue = [{ value, valid: config.validator() }]; + cache.set(arg, cachedValue); + break; + case "valid": + if (cachedValue) { + cachedValue.push({ value, valid: config.validator() }); + } else { + cachedValue = [{ value, valid: config.validator() }]; + cache.set(arg, cachedValue); + } + } } class CacheConfigurator { @@ -109,7 +253,7 @@ class CacheConfigurator { _configured: boolean = false; - _pairs: Array<[mixed, (SideChannel) => mixed]> = []; + _pairs: Array<[mixed, (SideChannel) => Handler]> = []; _data: SideChannel; @@ -162,30 +306,36 @@ class CacheConfigurator { this._configured = true; const key = handler(this._data); - this._pairs.push([key, handler]); + + const fn = maybeAsync( + handler, + `You appear to be using an async cache handler, but Babel has been called synchronously`, + ); + + if (isThenable(key)) { + return key.then(key => { + this._pairs.push([key, fn]); + return key; + }); + } + + this._pairs.push([key, fn]); return key; } invalidate(handler: SideChannel => T): T { - if (!this._active) { - throw new Error("Cannot change caching after evaluation has completed."); - } - if (this._never || this._forever) { - throw new Error( - "Caching has already been configured with .never or .forever()", - ); - } this._invalidate = true; - this._configured = true; - - const key = handler(this._data); - this._pairs.push([key, handler]); - return key; + return this.using(handler); } - validator(): SideChannel => boolean { + validator(): SideChannel => Handler { const pairs = this._pairs; - return (data: SideChannel) => pairs.every(([key, fn]) => key === fn(data)); + return function*(data: SideChannel) { + for (const [key, fn] of pairs) { + if (key !== (yield* fn(data))) return false; + } + return true; + }; } deactivate() { @@ -219,8 +369,18 @@ function makeSimpleConfigurator( // Types are limited here so that in the future these values can be used // as part of Babel's caching logic. -type SimpleType = string | boolean | number | null | void; +type SimpleType = string | boolean | number | null | void | Promise; export function assertSimpleType(value: mixed): SimpleType { + if (isThenable(value)) { + throw new Error( + `You appear to be using an async cache handler, ` + + `which your current version of Babel does not support. ` + + `We may add support for this in the future, ` + + `but if you're on the most recent version of @babel/core and still ` + + `seeing this error, then you'll need to synchronously handle your caching logic.`, + ); + } + if ( value != null && typeof value !== "string" && @@ -233,3 +393,20 @@ export function assertSimpleType(value: mixed): SimpleType { } return value; } + +class Lock { + released: boolean = false; + promise: Promise; + _resolve: (value: T) => void; + + constructor() { + this.promise = new Promise(resolve => { + this._resolve = resolve; + }); + } + + release(value: T) { + this.released = true; + this._resolve(value); + } +} diff --git a/packages/babel-core/src/config/config-chain.js b/packages/babel-core/src/config/config-chain.js index 3bbedcdff1a9..1af3f35d2371 100644 --- a/packages/babel-core/src/config/config-chain.js +++ b/packages/babel-core/src/config/config-chain.js @@ -2,6 +2,7 @@ import path from "path"; import buildDebug from "debug"; +import type { Handler } from "gensync"; import { validate, type ValidatedOptions, @@ -24,7 +25,7 @@ import { type FilePackageData, } from "./files"; -import { makeWeakCache, makeStrongCache } from "./caching"; +import { makeWeakCacheSync, makeStrongCacheSync } from "./caching"; import { createCachedDescriptors, @@ -57,11 +58,11 @@ export type ConfigContext = { /** * Build a config chain for a given preset. */ -export function buildPresetChain( +export function* buildPresetChain( arg: PresetInstance, context: *, -): ConfigChain | null { - const chain = buildPresetChainWalker(arg, context); +): Handler { + const chain = yield* buildPresetChainWalker(arg, context); if (!chain) return null; return { @@ -82,11 +83,11 @@ export const buildPresetChainWalker: ( overridesEnv: (preset, index, envName) => loadPresetOverridesEnvDescriptors(preset)(index)(envName), }); -const loadPresetDescriptors = makeWeakCache((preset: PresetInstance) => +const loadPresetDescriptors = makeWeakCacheSync((preset: PresetInstance) => buildRootDescriptors(preset, preset.alias, createUncachedDescriptors), ); -const loadPresetEnvDescriptors = makeWeakCache((preset: PresetInstance) => - makeStrongCache((envName: string) => +const loadPresetEnvDescriptors = makeWeakCacheSync((preset: PresetInstance) => + makeStrongCacheSync((envName: string) => buildEnvDescriptors( preset, preset.alias, @@ -95,20 +96,21 @@ const loadPresetEnvDescriptors = makeWeakCache((preset: PresetInstance) => ), ), ); -const loadPresetOverridesDescriptors = makeWeakCache((preset: PresetInstance) => - makeStrongCache((index: number) => - buildOverrideDescriptors( - preset, - preset.alias, - createUncachedDescriptors, - index, +const loadPresetOverridesDescriptors = makeWeakCacheSync( + (preset: PresetInstance) => + makeStrongCacheSync((index: number) => + buildOverrideDescriptors( + preset, + preset.alias, + createUncachedDescriptors, + index, + ), ), - ), ); -const loadPresetOverridesEnvDescriptors = makeWeakCache( +const loadPresetOverridesEnvDescriptors = makeWeakCacheSync( (preset: PresetInstance) => - makeStrongCache((index: number) => - makeStrongCache((envName: string) => + makeStrongCacheSync((index: number) => + makeStrongCacheSync((envName: string) => buildOverrideEnvDescriptors( preset, preset.alias, @@ -129,11 +131,11 @@ export type RootConfigChain = ConfigChain & { /** * Build a config chain for Babel's full root configuration. */ -export function buildRootChain( +export function* buildRootChain( opts: ValidatedOptions, context: ConfigContext, -): RootConfigChain | null { - const programmaticChain = loadProgrammaticChain( +): Handler { + const programmaticChain = yield* loadProgrammaticChain( { options: opts, dirname: context.cwd, @@ -144,14 +146,18 @@ export function buildRootChain( let configFile; if (typeof opts.configFile === "string") { - configFile = loadConfig( + configFile = yield* loadConfig( opts.configFile, context.cwd, context.envName, context.caller, ); } else if (opts.configFile !== false) { - configFile = findRootConfig(context.root, context.envName, context.caller); + configFile = yield* findRootConfig( + context.root, + context.envName, + context.caller, + ); } let { babelrc, babelrcRoots } = opts; @@ -160,7 +166,7 @@ export function buildRootChain( const configFileChain = emptyChain(); if (configFile) { const validatedFile = validateConfigFile(configFile); - const result = loadFileChain(validatedFile, context); + const result = yield* loadFileChain(validatedFile, context); if (!result) return null; // Allow config files to toggle `.babelrc` resolution on and off and @@ -178,7 +184,7 @@ export function buildRootChain( const pkgData = typeof context.filename === "string" - ? findPackageData(context.filename) + ? yield* findPackageData(context.filename) : null; let ignoreFile, babelrcFile; @@ -189,7 +195,7 @@ export function buildRootChain( pkgData && babelrcLoadEnabled(context, pkgData, babelrcRoots, babelrcRootsDirectory) ) { - ({ ignore: ignoreFile, config: babelrcFile } = findRelativeConfig( + ({ ignore: ignoreFile, config: babelrcFile } = yield* findRelativeConfig( pkgData, context.envName, context.caller, @@ -203,7 +209,10 @@ export function buildRootChain( } if (babelrcFile) { - const result = loadFileChain(validateBabelrcFile(babelrcFile), context); + const result = yield* loadFileChain( + validateBabelrcFile(babelrcFile), + context, + ); if (!result) return null; mergeChain(fileChain, result); @@ -268,7 +277,7 @@ function babelrcLoadEnabled( }); } -const validateConfigFile = makeWeakCache( +const validateConfigFile = makeWeakCacheSync( (file: ConfigFile): ValidatedFile => ({ filepath: file.filepath, dirname: file.dirname, @@ -276,7 +285,7 @@ const validateConfigFile = makeWeakCache( }), ); -const validateBabelrcFile = makeWeakCache( +const validateBabelrcFile = makeWeakCacheSync( (file: ConfigFile): ValidatedFile => ({ filepath: file.filepath, dirname: file.dirname, @@ -284,7 +293,7 @@ const validateBabelrcFile = makeWeakCache( }), ); -const validateExtendFile = makeWeakCache( +const validateExtendFile = makeWeakCacheSync( (file: ConfigFile): ValidatedFile => ({ filepath: file.filepath, dirname: file.dirname, @@ -321,11 +330,11 @@ const loadFileChain = makeChainWalker({ overridesEnv: (file, index, envName) => loadFileOverridesEnvDescriptors(file)(index)(envName), }); -const loadFileDescriptors = makeWeakCache((file: ValidatedFile) => +const loadFileDescriptors = makeWeakCacheSync((file: ValidatedFile) => buildRootDescriptors(file, file.filepath, createUncachedDescriptors), ); -const loadFileEnvDescriptors = makeWeakCache((file: ValidatedFile) => - makeStrongCache((envName: string) => +const loadFileEnvDescriptors = makeWeakCacheSync((file: ValidatedFile) => + makeStrongCacheSync((envName: string) => buildEnvDescriptors( file, file.filepath, @@ -334,8 +343,8 @@ const loadFileEnvDescriptors = makeWeakCache((file: ValidatedFile) => ), ), ); -const loadFileOverridesDescriptors = makeWeakCache((file: ValidatedFile) => - makeStrongCache((index: number) => +const loadFileOverridesDescriptors = makeWeakCacheSync((file: ValidatedFile) => + makeStrongCacheSync((index: number) => buildOverrideDescriptors( file, file.filepath, @@ -344,18 +353,19 @@ const loadFileOverridesDescriptors = makeWeakCache((file: ValidatedFile) => ), ), ); -const loadFileOverridesEnvDescriptors = makeWeakCache((file: ValidatedFile) => - makeStrongCache((index: number) => - makeStrongCache((envName: string) => - buildOverrideEnvDescriptors( - file, - file.filepath, - createUncachedDescriptors, - index, - envName, +const loadFileOverridesEnvDescriptors = makeWeakCacheSync( + (file: ValidatedFile) => + makeStrongCacheSync((index: number) => + makeStrongCacheSync((envName: string) => + buildOverrideEnvDescriptors( + file, + file.filepath, + createUncachedDescriptors, + index, + envName, + ), ), ), - ), ); function buildRootDescriptors({ dirname, options }, alias, descriptors) { @@ -414,8 +424,12 @@ function makeChainWalker({ env: (ArgT, string) => OptionsAndDescriptors | null, overrides: (ArgT, number) => OptionsAndDescriptors, overridesEnv: (ArgT, number, string) => OptionsAndDescriptors | null, -}): (ArgT, ConfigContext, Set | void) => ConfigChain | null { - return (input, context, files = new Set()) => { +}): ( + ArgT, + ConfigContext, + Set | void, +) => Handler { + return function*(input, context, files = new Set()) { const { dirname } = input; const flattenedConfigs = []; @@ -459,7 +473,9 @@ function makeChainWalker({ const chain = emptyChain(); for (const op of flattenedConfigs) { - if (!mergeExtendsChain(chain, op.options, dirname, context, files)) { + if ( + !(yield* mergeExtendsChain(chain, op.options, dirname, context, files)) + ) { return null; } @@ -469,16 +485,16 @@ function makeChainWalker({ }; } -function mergeExtendsChain( +function* mergeExtendsChain( chain: ConfigChain, opts: ValidatedOptions, dirname: string, context: ConfigContext, files: Set, -): boolean { +): Handler { if (opts.extends === undefined) return true; - const file = loadConfig( + const file = yield* loadConfig( opts.extends, dirname, context.envName, @@ -494,7 +510,11 @@ function mergeExtendsChain( } files.add(file); - const fileChain = loadFileChain(validateExtendFile(file), context, files); + const fileChain = yield* loadFileChain( + validateExtendFile(file), + context, + files, + ); files.delete(file); if (!fileChain) return false; @@ -549,7 +569,7 @@ function normalizeOptions(opts: ValidatedOptions): ValidatedOptions { // "sourceMap" is just aliased to sourceMap, so copy it over as // we merge the options together. - if (options.hasOwnProperty("sourceMap")) { + if (Object.prototype.hasOwnProperty.call(options, "sourceMap")) { options.sourceMaps = options.sourceMap; delete options.sourceMap; } diff --git a/packages/babel-core/src/config/config-descriptors.js b/packages/babel-core/src/config/config-descriptors.js index e17cca93c680..fa60d47d7139 100644 --- a/packages/babel-core/src/config/config-descriptors.js +++ b/packages/babel-core/src/config/config-descriptors.js @@ -5,8 +5,8 @@ import { loadPlugin, loadPreset } from "./files"; import { getItemDescriptor } from "./item"; import { - makeWeakCache, - makeStrongCache, + makeWeakCacheSync, + makeStrongCacheSync, type CacheConfigurator, } from "./caching"; @@ -130,11 +130,11 @@ export function createUncachedDescriptors( } const PRESET_DESCRIPTOR_CACHE = new WeakMap(); -const createCachedPresetDescriptors = makeWeakCache( +const createCachedPresetDescriptors = makeWeakCacheSync( (items: PluginList, cache: CacheConfigurator) => { const dirname = cache.using(dir => dir); - return makeStrongCache((alias: string) => - makeStrongCache((passPerPreset: boolean) => + return makeStrongCacheSync((alias: string) => + makeStrongCacheSync((passPerPreset: boolean) => createPresetDescriptors(items, dirname, alias, passPerPreset).map( // Items are cached using the overall preset array identity when // possibly, but individual descriptors are also cached if a match @@ -147,10 +147,10 @@ const createCachedPresetDescriptors = makeWeakCache( ); const PLUGIN_DESCRIPTOR_CACHE = new WeakMap(); -const createCachedPluginDescriptors = makeWeakCache( +const createCachedPluginDescriptors = makeWeakCacheSync( (items: PluginList, cache: CacheConfigurator) => { const dirname = cache.using(dir => dir); - return makeStrongCache((alias: string) => + return makeStrongCacheSync((alias: string) => createPluginDescriptors(items, dirname, alias).map( // Items are cached using the overall plugin array identity when // possibly, but individual descriptors are also cached if a match @@ -345,6 +345,7 @@ function assertNoDuplicates(items: Array): void { } if (nameMap.has(item.name)) { + const conflicts = items.filter(i => i.value === item.value); throw new Error( [ `Duplicate plugin/preset detected.`, @@ -355,6 +356,9 @@ function assertNoDuplicates(items: Array): void { ` ['some-plugin', {}],`, ` ['some-plugin', {}, 'some unique name'],`, ` ]`, + ``, + `Duplicates detected are:`, + `${JSON.stringify(conflicts, null, 2)}`, ].join("\n"), ); } diff --git a/packages/babel-core/src/config/files/configuration.js b/packages/babel-core/src/config/files/configuration.js index ab3353f6fde3..611cd49223e2 100644 --- a/packages/babel-core/src/config/files/configuration.js +++ b/packages/babel-core/src/config/files/configuration.js @@ -2,33 +2,48 @@ import buildDebug from "debug"; import path from "path"; -import fs from "fs"; import json5 from "json5"; -import resolve from "resolve"; +import gensync, { type Handler } from "gensync"; import { makeStrongCache, - makeWeakCache, + makeWeakCacheSync, type CacheConfigurator, } from "../caching"; import makeAPI, { type PluginAPI } from "../helpers/config-api"; import { makeStaticFileCache } from "./utils"; +import loadCjsOrMjsDefault from "./module-types"; import pathPatternToRegex from "../pattern-to-regex"; import type { FilePackageData, RelativeConfig, ConfigFile } from "./types"; import type { CallerMetadata } from "../validation/options"; +import * as fs from "../../gensync-utils/fs"; +import resolve from "../../gensync-utils/resolve"; + const debug = buildDebug("babel:config:loading:files:configuration"); -const BABEL_CONFIG_JS_FILENAME = "babel.config.js"; +export const ROOT_CONFIG_FILENAMES = [ + "babel.config.js", + "babel.config.cjs", + "babel.config.mjs", + "babel.config.json", +]; +const RELATIVE_CONFIG_FILENAMES = [ + ".babelrc", + ".babelrc.js", + ".babelrc.cjs", + ".babelrc.mjs", + ".babelrc.json", +]; -const BABELRC_FILENAME = ".babelrc"; -const BABELRC_JS_FILENAME = ".babelrc.js"; const BABELIGNORE_FILENAME = ".babelignore"; -export function findConfigUpwards(rootDir: string): string | null { +export function* findConfigUpwards(rootDir: string): Handler { let dirname = rootDir; while (true) { - if (fs.existsSync(path.join(dirname, BABEL_CONFIG_JS_FILENAME))) { - return dirname; + for (const filename of ROOT_CONFIG_FILENAMES) { + if (yield* fs.exists(path.join(dirname, filename))) { + return dirname; + } } const nextDir = path.dirname(dirname); @@ -39,11 +54,11 @@ export function findConfigUpwards(rootDir: string): string | null { return null; } -export function findRelativeConfig( +export function* findRelativeConfig( packageData: FilePackageData, envName: string, caller: CallerMetadata | void, -): RelativeConfig { +): Handler { let config = null; let ignore = null; @@ -51,50 +66,20 @@ export function findRelativeConfig( for (const loc of packageData.directories) { if (!config) { - config = [BABELRC_FILENAME, BABELRC_JS_FILENAME].reduce( - (previousConfig: ConfigFile | null, name) => { - const filepath = path.join(loc, name); - const config = readConfig(filepath, envName, caller); - - if (config && previousConfig) { - throw new Error( - `Multiple configuration files found. Please remove one:\n` + - ` - ${path.basename(previousConfig.filepath)}\n` + - ` - ${name}\n` + - `from ${loc}`, - ); - } - - return config || previousConfig; - }, - null, - ); - - const pkgConfig = + config = yield* loadOneConfig( + RELATIVE_CONFIG_FILENAMES, + loc, + envName, + caller, packageData.pkg && packageData.pkg.dirname === loc ? packageToBabelConfig(packageData.pkg) - : null; - - if (pkgConfig) { - if (config) { - throw new Error( - `Multiple configuration files found. Please remove one:\n` + - ` - ${path.basename(pkgConfig.filepath)}#babel\n` + - ` - ${path.basename(config.filepath)}\n` + - `from ${loc}`, - ); - } - config = pkgConfig; - } - - if (config) { - debug("Found configuration %o from %o.", config.filepath, dirname); - } + : null, + ); } if (!ignore) { const ignoreLoc = path.join(loc, BABELIGNORE_FILENAME); - ignore = readIgnoreConfig(ignoreLoc); + ignore = yield* readIgnoreConfig(ignoreLoc); if (ignore) { debug("Found ignore %o from %o.", ignore.filepath, dirname); @@ -109,25 +94,50 @@ export function findRootConfig( dirname: string, envName: string, caller: CallerMetadata | void, -): ConfigFile | null { - const filepath = path.resolve(dirname, BABEL_CONFIG_JS_FILENAME); +): Handler { + return loadOneConfig(ROOT_CONFIG_FILENAMES, dirname, envName, caller); +} - const conf = readConfig(filepath, envName, caller); - if (conf) { - debug("Found root config %o in %o.", BABEL_CONFIG_JS_FILENAME, dirname); +function* loadOneConfig( + names: string[], + dirname: string, + envName: string, + caller: CallerMetadata | void, + previousConfig?: ConfigFile | null = null, +): Handler { + const configs = yield* gensync.all( + names.map(filename => + readConfig(path.join(dirname, filename), envName, caller), + ), + ); + const config = configs.reduce((previousConfig: ConfigFile | null, config) => { + if (config && previousConfig) { + throw new Error( + `Multiple configuration files found. Please remove one:\n` + + ` - ${path.basename(previousConfig.filepath)}\n` + + ` - ${config.filepath}\n` + + `from ${dirname}`, + ); + } + + return config || previousConfig; + }, previousConfig); + + if (config) { + debug("Found configuration %o from %o.", config.filepath, dirname); } - return conf; + return config; } -export function loadConfig( +export function* loadConfig( name: string, dirname: string, envName: string, caller: CallerMetadata | void, -): ConfigFile { - const filepath = resolve.sync(name, { basedir: dirname }); +): Handler { + const filepath = yield* resolve(name, { basedir: dirname }); - const conf = readConfig(filepath, envName, caller); + const conf = yield* readConfig(filepath, envName, caller); if (!conf) { throw new Error(`Config file ${filepath} contains no configuration data`); } @@ -140,89 +150,90 @@ export function loadConfig( * Read the given config file, returning the result. Returns null if no config was found, but will * throw if there are parsing errors while loading a config. */ -function readConfig(filepath, envName, caller): ConfigFile | null { - return path.extname(filepath) === ".js" +function readConfig(filepath, envName, caller) { + const ext = path.extname(filepath); + return ext === ".js" || ext === ".cjs" || ext === ".mjs" ? readConfigJS(filepath, { envName, caller }) : readConfigJSON5(filepath); } const LOADING_CONFIGS = new Set(); -const readConfigJS = makeStrongCache( - ( - filepath: string, - cache: CacheConfigurator<{ - envName: string, - caller: CallerMetadata | void, - }>, - ) => { - if (!fs.existsSync(filepath)) { - cache.forever(); - return null; - } +const readConfigJS = makeStrongCache(function* readConfigJS( + filepath: string, + cache: CacheConfigurator<{ + envName: string, + caller: CallerMetadata | void, + }>, +): Handler { + if (!fs.exists.sync(filepath)) { + cache.forever(); + return null; + } - // The `require()` call below can make this code reentrant if a require hook like @babel/register has been - // loaded into the system. That would cause Babel to attempt to compile the `.babelrc.js` file as it loads - // below. To cover this case, we auto-ignore re-entrant config processing. - if (LOADING_CONFIGS.has(filepath)) { - cache.never(); - - debug("Auto-ignoring usage of config %o.", filepath); - return { - filepath, - dirname: path.dirname(filepath), - options: {}, - }; - } + // The `require()` call below can make this code reentrant if a require hook like @babel/register has been + // loaded into the system. That would cause Babel to attempt to compile the `.babelrc.js` file as it loads + // below. To cover this case, we auto-ignore re-entrant config processing. + if (LOADING_CONFIGS.has(filepath)) { + cache.never(); - let options; - try { - LOADING_CONFIGS.add(filepath); - - // $FlowIssue - const configModule = (require(filepath): mixed); - options = - configModule && configModule.__esModule - ? configModule.default || undefined - : configModule; - } catch (err) { - err.message = `${filepath}: Error while loading config - ${err.message}`; - throw err; - } finally { - LOADING_CONFIGS.delete(filepath); - } + debug("Auto-ignoring usage of config %o.", filepath); + return { + filepath, + dirname: path.dirname(filepath), + options: {}, + }; + } - if (typeof options === "function") { - options = ((options: any): (api: PluginAPI) => {})(makeAPI(cache)); + let options: mixed; + try { + LOADING_CONFIGS.add(filepath); + options = (yield* loadCjsOrMjsDefault( + filepath, + "You appear to be using a native ECMAScript module configuration " + + "file, which is only supported when running Babel asynchronously.", + ): mixed); + } catch (err) { + err.message = `${filepath}: Error while loading config - ${err.message}`; + throw err; + } finally { + LOADING_CONFIGS.delete(filepath); + } - if (!cache.configured()) throwConfigError(); - } + let assertCache = false; + if (typeof options === "function") { + yield* []; // if we want to make it possible to use async configs + options = ((options: any): (api: PluginAPI) => {})(makeAPI(cache)); - if (!options || typeof options !== "object" || Array.isArray(options)) { - throw new Error( - `${filepath}: Configuration should be an exported JavaScript object.`, - ); - } + assertCache = true; + } - if (typeof options.then === "function") { - throw new Error( - `You appear to be using an async configuration, ` + - `which your current version of Babel does not support. ` + - `We may add support for this in the future, ` + - `but if you're on the most recent version of @babel/core and still ` + - `seeing this error, then you'll need to synchronously return your config.`, - ); - } + if (!options || typeof options !== "object" || Array.isArray(options)) { + throw new Error( + `${filepath}: Configuration should be an exported JavaScript object.`, + ); + } - return { - filepath, - dirname: path.dirname(filepath), - options, - }; - }, -); + if (typeof options.then === "function") { + throw new Error( + `You appear to be using an async configuration, ` + + `which your current version of Babel does not support. ` + + `We may add support for this in the future, ` + + `but if you're on the most recent version of @babel/core and still ` + + `seeing this error, then you'll need to synchronously return your config.`, + ); + } + + if (assertCache && !cache.configured()) throwConfigError(); + + return { + filepath, + dirname: path.dirname(filepath), + options, + }; +}); -const packageToBabelConfig = makeWeakCache( +const packageToBabelConfig = makeWeakCacheSync( (file: ConfigFile): ConfigFile | null => { const babel = file.options[("babel": string)]; diff --git a/packages/babel-core/src/config/files/import.js b/packages/babel-core/src/config/files/import.js new file mode 100644 index 000000000000..e16bc29752a9 --- /dev/null +++ b/packages/babel-core/src/config/files/import.js @@ -0,0 +1,7 @@ +// We keep this in a seprate file so that in older node versions, where +// import() isn't supported, we can try/catch around the require() call +// when loading this file. + +export default function import_(filepath: string) { + return import(filepath); +} diff --git a/packages/babel-core/src/config/files/index-browser.js b/packages/babel-core/src/config/files/index-browser.js index 1d2adccaa811..8e3a8cf26ce2 100644 --- a/packages/babel-core/src/config/files/index-browser.js +++ b/packages/babel-core/src/config/files/index-browser.js @@ -1,5 +1,7 @@ // @flow +import type { Handler } from "gensync"; + import type { ConfigFile, IgnoreFile, @@ -11,13 +13,15 @@ import type { CallerMetadata } from "../validation/options"; export type { ConfigFile, IgnoreFile, RelativeConfig, FilePackageData }; -export function findConfigUpwards( +// eslint-disable-next-line require-yield +export function* findConfigUpwards( rootDir: string, // eslint-disable-line no-unused-vars -): string | null { +): Handler { return null; } -export function findPackageData(filepath: string): FilePackageData { +// eslint-disable-next-line require-yield +export function* findPackageData(filepath: string): Handler { return { filepath, directories: [], @@ -26,31 +30,36 @@ export function findPackageData(filepath: string): FilePackageData { }; } -export function findRelativeConfig( +// eslint-disable-next-line require-yield +export function* findRelativeConfig( pkgData: FilePackageData, // eslint-disable-line no-unused-vars envName: string, // eslint-disable-line no-unused-vars caller: CallerMetadata | void, // eslint-disable-line no-unused-vars -): RelativeConfig { +): Handler { return { pkg: null, config: null, ignore: null }; } -export function findRootConfig( +// eslint-disable-next-line require-yield +export function* findRootConfig( dirname: string, // eslint-disable-line no-unused-vars envName: string, // eslint-disable-line no-unused-vars caller: CallerMetadata | void, // eslint-disable-line no-unused-vars -): ConfigFile | null { +): Handler { return null; } -export function loadConfig( +// eslint-disable-next-line require-yield +export function* loadConfig( name: string, dirname: string, envName: string, // eslint-disable-line no-unused-vars caller: CallerMetadata | void, // eslint-disable-line no-unused-vars -): ConfigFile { +): Handler { throw new Error(`Cannot load ${name} relative to ${dirname} in a browser`); } +export const ROOT_CONFIG_FILENAMES = []; + // eslint-disable-next-line no-unused-vars export function resolvePlugin(name: string, dirname: string): string | null { return null; diff --git a/packages/babel-core/src/config/files/index.js b/packages/babel-core/src/config/files/index.js index 3c74f2d4eebb..464ef66253f4 100644 --- a/packages/babel-core/src/config/files/index.js +++ b/packages/babel-core/src/config/files/index.js @@ -14,6 +14,7 @@ export { findRelativeConfig, findRootConfig, loadConfig, + ROOT_CONFIG_FILENAMES, } from "./configuration"; export type { ConfigFile, diff --git a/packages/babel-core/src/config/files/module-types.js b/packages/babel-core/src/config/files/module-types.js new file mode 100644 index 000000000000..4c761597f9f1 --- /dev/null +++ b/packages/babel-core/src/config/files/module-types.js @@ -0,0 +1,63 @@ +import { isAsync, waitFor } from "../../gensync-utils/async"; +import type { Handler } from "gensync"; +import path from "path"; +import { pathToFileURL } from "url"; + +let import_; +try { + // Node < 13.3 doesn't support import() syntax. + import_ = require("./import").default; +} catch {} + +export default function* loadCjsOrMjsDefault( + filepath: string, + asyncError: string, +): Handler { + switch (guessJSModuleType(filepath)) { + case "cjs": + return loadCjsDefault(filepath); + case "unknown": + try { + return loadCjsDefault(filepath); + } catch (e) { + if (e.code !== "ERR_REQUIRE_ESM") throw e; + } + // fall through + case "mjs": + if (yield* isAsync()) { + return yield* waitFor(loadMjsDefault(filepath)); + } + throw new Error(asyncError); + } +} + +function guessJSModuleType(filename: string): "cjs" | "mjs" | "unknown" { + switch (path.extname(filename)) { + case ".cjs": + return "cjs"; + case ".mjs": + return "mjs"; + default: + return "unknown"; + } +} + +function loadCjsDefault(filepath: string) { + const module = (require(filepath): mixed); + // TODO (Babel 8): Remove "undefined" fallback + return module?.__esModule ? module.default || undefined : module; +} + +async function loadMjsDefault(filepath: string) { + if (!import_) { + throw new Error( + "Internal error: Native ECMAScript modules aren't supported" + + " by this platform.\n", + ); + } + + // import() expects URLs, not file paths. + // https://github.com/nodejs/node/issues/31710 + const module = await import_(pathToFileURL(filepath)); + return module.default; +} diff --git a/packages/babel-core/src/config/files/package.js b/packages/babel-core/src/config/files/package.js index 8e370a472d56..278ddfb852f5 100644 --- a/packages/babel-core/src/config/files/package.js +++ b/packages/babel-core/src/config/files/package.js @@ -1,6 +1,7 @@ // @flow import path from "path"; +import type { Handler } from "gensync"; import { makeStaticFileCache } from "./utils"; import type { ConfigFile, FilePackageData } from "./types"; @@ -12,7 +13,7 @@ const PACKAGE_FILENAME = "package.json"; * of Babel's config requires general package information to decide when to * search for .babelrc files */ -export function findPackageData(filepath: string): FilePackageData { +export function* findPackageData(filepath: string): Handler { let pkg = null; const directories = []; let isPackage = true; @@ -21,7 +22,7 @@ export function findPackageData(filepath: string): FilePackageData { while (!pkg && path.basename(dirname) !== "node_modules") { directories.push(dirname); - pkg = readConfigPackage(path.join(dirname, PACKAGE_FILENAME)); + pkg = yield* readConfigPackage(path.join(dirname, PACKAGE_FILENAME)); const nextLoc = path.dirname(dirname); if (dirname === nextLoc) { diff --git a/packages/babel-core/src/config/files/utils.js b/packages/babel-core/src/config/files/utils.js index db202259d5e8..61c3b24a7a4a 100644 --- a/packages/babel-core/src/config/files/utils.js +++ b/packages/babel-core/src/config/files/utils.js @@ -1,24 +1,32 @@ // @flow -import fs from "fs"; -import { makeStrongCache } from "../caching"; +import type { Gensync, Handler } from "gensync"; + +import { makeStrongCache, type CacheConfigurator } from "../caching"; +import * as fs from "../../gensync-utils/fs"; +import nodeFs from "fs"; export function makeStaticFileCache( fn: (string, string) => T, -): string => T | null { - return makeStrongCache((filepath, cache) => { - if (cache.invalidate(() => fileMtime(filepath)) === null) { +): Gensync<[string], T | null> { + return (makeStrongCache(function*( + filepath: string, + cache: CacheConfigurator, + ): Handler { + const cached = cache.invalidate(() => fileMtime(filepath)); + + if (cached === null) { cache.forever(); return null; } - return fn(filepath, fs.readFileSync(filepath, "utf8")); - }); + return fn(filepath, yield* fs.readFile(filepath, "utf8")); + }): Gensync); } function fileMtime(filepath: string): number | null { try { - return +fs.statSync(filepath).mtime; + return +nodeFs.statSync(filepath).mtime; } catch (e) { if (e.code !== "ENOENT" && e.code !== "ENOTDIR") throw e; } diff --git a/packages/babel-core/src/config/full.js b/packages/babel-core/src/config/full.js index 88c65ff882be..35b6dc86625a 100644 --- a/packages/babel-core/src/config/full.js +++ b/packages/babel-core/src/config/full.js @@ -1,5 +1,8 @@ // @flow +import gensync, { type Handler } from "gensync"; +import { forwardAsync } from "../gensync-utils/async"; + import { mergeOptions } from "./util"; import * as context from "../index"; import Plugin from "./plugin"; @@ -12,12 +15,21 @@ import { } from "./config-chain"; import type { UnloadedDescriptor } from "./config-descriptors"; import traverse from "@babel/traverse"; -import { makeWeakCache, type CacheConfigurator } from "./caching"; -import { validate, type CallerMetadata } from "./validation/options"; +import { + makeWeakCache, + makeWeakCacheSync, + type CacheConfigurator, +} from "./caching"; +import { + validate, + type CallerMetadata, + checkNoUnwrappedItemOptionPairs, +} from "./validation/options"; import { validatePluginObject } from "./validation/plugins"; import makeAPI from "./helpers/config-api"; import loadPrivatePartialConfig from "./partial"; +import type { ValidatedOptions } from "./validation/options"; type LoadedDescriptor = { value: {}, @@ -44,10 +56,10 @@ type SimpleContext = { caller: CallerMetadata | void, }; -export default function loadFullConfig( +export default gensync<[any], ResolvedConfig | null>(function* loadFullConfig( inputOpts: mixed, -): ResolvedConfig | null { - const result = loadPrivatePartialConfig(inputOpts); +): Handler { + const result = yield* loadPrivatePartialConfig(inputOpts); if (!result) { return null; } @@ -62,28 +74,58 @@ export default function loadFullConfig( throw new Error("Assertion failure - plugins and presets exist"); } - const ignored = (function recurseDescriptors( + const ignored = yield* (function* recurseDescriptors( config: { plugins: Array, presets: Array, }, pass: Array, ) { - const plugins = config.plugins.reduce((acc, descriptor) => { + const plugins = []; + for (let i = 0; i < config.plugins.length; i++) { + const descriptor = config.plugins[i]; if (descriptor.options !== false) { - acc.push(loadPluginDescriptor(descriptor, context)); + try { + plugins.push(yield* loadPluginDescriptor(descriptor, context)); + } catch (e) { + // print special message for `plugins: ["@babel/foo", { foo: "option" }]` + if (i > 0 && e.code === "BABEL_UNKNOWN_PLUGIN_PROPERTY") { + checkNoUnwrappedItemOptionPairs( + config.plugins[i - 1], + descriptor, + "plugin", + i, + e, + ); + } + throw e; + } } - return acc; - }, []); - const presets = config.presets.reduce((acc, descriptor) => { + } + + const presets = []; + for (let i = 0; i < config.presets.length; i++) { + const descriptor = config.presets[i]; if (descriptor.options !== false) { - acc.push({ - preset: loadPresetDescriptor(descriptor, context), - pass: descriptor.ownPass ? [] : pass, - }); + try { + presets.push({ + preset: yield* loadPresetDescriptor(descriptor, context), + pass: descriptor.ownPass ? [] : pass, + }); + } catch (e) { + if (i > 0 && e.code === "BABEL_UNKNOWN_OPTION") { + checkNoUnwrappedItemOptionPairs( + config.presets[i - 1], + descriptor, + "preset", + i, + e, + ); + } + throw e; + } } - return acc; - }, []); + } // resolve presets if (presets.length > 0) { @@ -98,7 +140,7 @@ export default function loadFullConfig( for (const { preset, pass } of presets) { if (!preset) return true; - const ignored = recurseDescriptors( + const ignored = yield* recurseDescriptors( { plugins: preset.plugins, presets: preset.presets, @@ -164,61 +206,61 @@ export default function loadFullConfig( options: opts, passes: passes, }; -} +}); /** * Load a generic plugin/preset from the given descriptor loaded from the config object. */ -const loadDescriptor = makeWeakCache( - ( - { value, options, dirname, alias }: UnloadedDescriptor, - cache: CacheConfigurator, - ): LoadedDescriptor => { - // Disabled presets should already have been filtered out - if (options === false) throw new Error("Assertion failure"); - - options = options || {}; - - let item = value; - if (typeof value === "function") { - const api = { - ...context, - ...makeAPI(cache), - }; - try { - item = value(api, options, dirname); - } catch (e) { - if (alias) { - e.message += ` (While processing: ${JSON.stringify(alias)})`; - } - throw e; +const loadDescriptor = makeWeakCache(function*( + { value, options, dirname, alias }: UnloadedDescriptor, + cache: CacheConfigurator, +): Handler { + // Disabled presets should already have been filtered out + if (options === false) throw new Error("Assertion failure"); + + options = options || {}; + + let item = value; + if (typeof value === "function") { + const api = { + ...context, + ...makeAPI(cache), + }; + try { + item = value(api, options, dirname); + } catch (e) { + if (alias) { + e.message += ` (While processing: ${JSON.stringify(alias)})`; } + throw e; } + } - if (!item || typeof item !== "object") { - throw new Error("Plugin/Preset did not return an object."); - } + if (!item || typeof item !== "object") { + throw new Error("Plugin/Preset did not return an object."); + } - if (typeof item.then === "function") { - throw new Error( - `You appear to be using an async plugin, ` + - `which your current version of Babel does not support. ` + - `If you're using a published plugin, ` + - `you may need to upgrade your @babel/core version.`, - ); - } + if (typeof item.then === "function") { + yield* []; // if we want to support async plugins - return { value: item, options, dirname, alias }; - }, -); + throw new Error( + `You appear to be using an async plugin, ` + + `which your current version of Babel does not support. ` + + `If you're using a published plugin, ` + + `you may need to upgrade your @babel/core version.`, + ); + } + + return { value: item, options, dirname, alias }; +}); /** * Instantiate a plugin for the given descriptor, returning the plugin/options pair. */ -function loadPluginDescriptor( +function* loadPluginDescriptor( descriptor: UnloadedDescriptor, context: SimpleContext, -): Plugin { +): Handler { if (descriptor.value instanceof Plugin) { if (descriptor.options) { throw new Error( @@ -229,69 +271,105 @@ function loadPluginDescriptor( return descriptor.value; } - return instantiatePlugin(loadDescriptor(descriptor, context), context); + return yield* instantiatePlugin( + yield* loadDescriptor(descriptor, context), + context, + ); } -const instantiatePlugin = makeWeakCache( - ( - { value, options, dirname, alias }: LoadedDescriptor, - cache: CacheConfigurator, - ): Plugin => { - const pluginObj = validatePluginObject(value); +const instantiatePlugin = makeWeakCache(function*( + { value, options, dirname, alias }: LoadedDescriptor, + cache: CacheConfigurator, +): Handler { + const pluginObj = validatePluginObject(value); - const plugin = { - ...pluginObj, - }; - if (plugin.visitor) { - plugin.visitor = traverse.explode({ - ...plugin.visitor, - }); - } + const plugin = { + ...pluginObj, + }; + if (plugin.visitor) { + plugin.visitor = traverse.explode({ + ...plugin.visitor, + }); + } - if (plugin.inherits) { - const inheritsDescriptor = { - name: undefined, - alias: `${alias}$inherits`, - value: plugin.inherits, - options, - dirname, - }; + if (plugin.inherits) { + const inheritsDescriptor = { + name: undefined, + alias: `${alias}$inherits`, + value: plugin.inherits, + options, + dirname, + }; + const inherits = yield* forwardAsync(loadPluginDescriptor, run => { // If the inherited plugin changes, reinstantiate this plugin. - const inherits = cache.invalidate(data => - loadPluginDescriptor(inheritsDescriptor, data), - ); + return cache.invalidate(data => run(inheritsDescriptor, data)); + }); + + plugin.pre = chain(inherits.pre, plugin.pre); + plugin.post = chain(inherits.post, plugin.post); + plugin.manipulateOptions = chain( + inherits.manipulateOptions, + plugin.manipulateOptions, + ); + plugin.visitor = traverse.visitors.merge([ + inherits.visitor || {}, + plugin.visitor || {}, + ]); + } + + return new Plugin(plugin, options, alias); +}); - plugin.pre = chain(inherits.pre, plugin.pre); - plugin.post = chain(inherits.post, plugin.post); - plugin.manipulateOptions = chain( - inherits.manipulateOptions, - plugin.manipulateOptions, +const validateIfOptionNeedsFilename = ( + options: ValidatedOptions, + descriptor: UnloadedDescriptor, +): void => { + if (options.test || options.include || options.exclude) { + const formattedPresetName = descriptor.name + ? `"${descriptor.name}"` + : "/* your preset */"; + throw new Error( + [ + `Preset ${formattedPresetName} requires a filename to be set when babel is called directly,`, + `\`\`\``, + `babel.transform(code, { filename: 'file.ts', presets: [${formattedPresetName}] });`, + `\`\`\``, + `See https://babeljs.io/docs/en/options#filename for more information.`, + ].join("\n"), + ); + } +}; + +const validatePreset = ( + preset: PresetInstance, + context: ConfigContext, + descriptor: UnloadedDescriptor, +): void => { + if (!context.filename) { + const { options } = preset; + validateIfOptionNeedsFilename(options, descriptor); + if (options.overrides) { + options.overrides.forEach(overrideOptions => + validateIfOptionNeedsFilename(overrideOptions, descriptor), ); - plugin.visitor = traverse.visitors.merge([ - inherits.visitor || {}, - plugin.visitor || {}, - ]); } - - return new Plugin(plugin, options, alias); - }, -); + } +}; /** * Generate a config object that will act as the root of a new nested config. */ -const loadPresetDescriptor = ( +function* loadPresetDescriptor( descriptor: UnloadedDescriptor, context: ConfigContext, -): ConfigChain | null => { - return buildPresetChain( - instantiatePreset(loadDescriptor(descriptor, context)), - context, - ); -}; +): Handler { + const preset = instantiatePreset(yield* loadDescriptor(descriptor, context)); + validatePreset(preset, context, descriptor); + return yield* buildPresetChain(preset, context); +} -const instantiatePreset = makeWeakCache( +const instantiatePreset = makeWeakCacheSync( ({ value, dirname, alias }: LoadedDescriptor): PresetInstance => { return { options: validate("preset", value), diff --git a/packages/babel-core/src/config/index.js b/packages/babel-core/src/config/index.js index 51016d34c757..11888a48ec7c 100644 --- a/packages/babel-core/src/config/index.js +++ b/packages/babel-core/src/config/index.js @@ -1,6 +1,7 @@ // @flow -import loadFullConfig from "./full"; +import gensync from "gensync"; + export type { ResolvedConfig, InputOptions, @@ -8,12 +9,29 @@ export type { Plugin, } from "./full"; +import loadFullConfig from "./full"; +import { loadPartialConfig as loadPartialConfigRunner } from "./partial"; + export { loadFullConfig as default }; -export { loadPartialConfig } from "./partial"; export type { PartialConfig } from "./partial"; -export function loadOptions(opts: {}): Object | null { - const config = loadFullConfig(opts); - +const loadOptionsRunner = gensync<[mixed], Object | null>(function*(opts) { + const config = yield* loadFullConfig(opts); return config ? config.options : null; -} +}); + +const maybeErrback = runner => (opts: mixed, callback: Function) => { + if (callback === undefined && typeof opts === "function") { + callback = opts; + opts = undefined; + } + return callback ? runner.errback(opts, callback) : runner.sync(opts); +}; + +export const loadPartialConfig = maybeErrback(loadPartialConfigRunner); +export const loadPartialConfigSync = loadPartialConfigRunner.sync; +export const loadPartialConfigAsync = loadPartialConfigRunner.async; + +export const loadOptions = maybeErrback(loadOptionsRunner); +export const loadOptionsSync = loadOptionsRunner.sync; +export const loadOptionsAsync = loadOptionsRunner.async; diff --git a/packages/babel-core/src/config/partial.js b/packages/babel-core/src/config/partial.js index 42b00208def0..921e07a7a8ee 100644 --- a/packages/babel-core/src/config/partial.js +++ b/packages/babel-core/src/config/partial.js @@ -1,6 +1,7 @@ // @flow import path from "path"; +import gensync, { type Handler } from "gensync"; import Plugin from "./plugin"; import { mergeOptions } from "./util"; import { createItemFromDescriptor } from "./item"; @@ -12,26 +13,36 @@ import { type RootMode, } from "./validation/options"; -import { findConfigUpwards, type ConfigFile, type IgnoreFile } from "./files"; - -function resolveRootMode(rootDir: string, rootMode: RootMode): string { +import { + findConfigUpwards, + ROOT_CONFIG_FILENAMES, + type ConfigFile, + type IgnoreFile, +} from "./files"; + +function* resolveRootMode( + rootDir: string, + rootMode: RootMode, +): Handler { switch (rootMode) { case "root": return rootDir; case "upward-optional": { - const upwardRootDir = findConfigUpwards(rootDir); + const upwardRootDir = yield* findConfigUpwards(rootDir); return upwardRootDir === null ? rootDir : upwardRootDir; } case "upward": { - const upwardRootDir = findConfigUpwards(rootDir); + const upwardRootDir = yield* findConfigUpwards(rootDir); if (upwardRootDir !== null) return upwardRootDir; throw Object.assign( (new Error( `Babel was run with rootMode:"upward" but a root could not ` + - `be found when searching upward from "${rootDir}"`, + `be found when searching upward from "${rootDir}".\n` + + `One of the following config files must be in the directory tree: ` + + `"${ROOT_CONFIG_FILENAMES.join(", ")}".`, ): any), { code: "BABEL_ROOT_NOT_FOUND", @@ -40,19 +51,21 @@ function resolveRootMode(rootDir: string, rootMode: RootMode): string { ); } default: - throw new Error(`Assertion failure - unknown rootMode value`); + throw new Error(`Assertion failure - unknown rootMode value.`); } } -export default function loadPrivatePartialConfig( - inputOpts: mixed, -): { +type PrivPartialConfig = { options: ValidatedOptions, context: ConfigContext, ignore: IgnoreFile | void, babelrc: ConfigFile | void, config: ConfigFile | void, -} | null { +}; + +export default function* loadPrivatePartialConfig( + inputOpts: mixed, +): Handler { if ( inputOpts != null && (typeof inputOpts !== "object" || Array.isArray(inputOpts)) @@ -71,7 +84,7 @@ export default function loadPrivatePartialConfig( cloneInputAst = true, } = args; const absoluteCwd = path.resolve(cwd); - const absoluteRootDir = resolveRootMode( + const absoluteRootDir = yield* resolveRootMode( path.resolve(absoluteCwd, rootDir), rootMode, ); @@ -87,7 +100,7 @@ export default function loadPrivatePartialConfig( caller, }; - const configChain = buildRootChain(args, context); + const configChain = yield* buildRootChain(args, context); if (!configChain) return null; const options = {}; @@ -124,8 +137,10 @@ export default function loadPrivatePartialConfig( }; } -export function loadPartialConfig(inputOpts: mixed): PartialConfig | null { - const result = loadPrivatePartialConfig(inputOpts); +export const loadPartialConfig = gensync<[any], PartialConfig | null>(function*( + inputOpts: mixed, +): Handler { + const result: ?PrivPartialConfig = yield* loadPrivatePartialConfig(inputOpts); if (!result) return null; const { options, babelrc, ignore, config } = result; @@ -145,7 +160,7 @@ export function loadPartialConfig(inputOpts: mixed): PartialConfig | null { ignore ? ignore.filepath : undefined, config ? config.filepath : undefined, ); -} +}); export type { PartialConfig }; @@ -176,11 +191,7 @@ class PartialConfig { } /** - * Returns true if their is a config file in the filesystem for this config. - * - * While this only means .babelrc(.mjs)?/package.json#babel right now, it - * may well expand in the future, so using this is recommended vs checking - * this.babelrc directly. + * Returns true if there is a config file in the filesystem for this config. */ hasFilesystemConfig(): boolean { return this.babelrc !== undefined || this.config !== undefined; diff --git a/packages/babel-core/src/config/util.js b/packages/babel-core/src/config/util.js index f64975216db3..b9d3af143dd3 100644 --- a/packages/babel-core/src/config/util.js +++ b/packages/babel-core/src/config/util.js @@ -28,3 +28,14 @@ function mergeDefaultFields(target: T, source: T) { if (val !== undefined) target[k] = (val: any); } } + +export function isIterableIterator(value: mixed): boolean %checks { + return ( + /*:: value instanceof Generator && */ + // /*:: "@@iterator" in value && */ + !!value && + typeof value.next === "function" && + // $FlowIgnore + typeof value[Symbol.iterator] === "function" + ); +} diff --git a/packages/babel-core/src/config/validation/option-assertions.js b/packages/babel-core/src/config/validation/option-assertions.js index 87244b4f16b3..a279a72781a0 100644 --- a/packages/babel-core/src/config/validation/option-assertions.js +++ b/packages/babel-core/src/config/validation/option-assertions.js @@ -278,7 +278,7 @@ export function assertConfigFileSearch( ) { throw new Error( `${msg(loc)} must be a undefined, a boolean, a string, ` + - `got ${JSON.stringify(value)}`, + `got ${JSON.stringify((value: any))}`, ); } @@ -302,7 +302,7 @@ export function assertBabelrcSearch( } else if (!checkValidTest(value)) { throw new Error( `${msg(loc)} must be a undefined, a boolean, a string/Function/RegExp ` + - `or an array of those, got ${JSON.stringify(value)}`, + `or an array of those, got ${JSON.stringify((value: any))}`, ); } return (value: any); diff --git a/packages/babel-core/src/config/validation/options.js b/packages/babel-core/src/config/validation/options.js index ff09c6bdd3ee..d1f01b70c30b 100644 --- a/packages/babel-core/src/config/validation/options.js +++ b/packages/babel-core/src/config/validation/options.js @@ -27,6 +27,7 @@ import { type Validator, type OptionPath, } from "./option-assertions"; +import type { UnloadedDescriptor } from "../config-descriptors"; const ROOT_VALIDATORS: ValidatorSet = { cwd: (assertString: Validator<$PropertyType>), @@ -277,7 +278,8 @@ export type OptionsSource = | "configfile" | "babelrcfile" | "extendsfile" - | "preset"; + | "preset" + | "plugin"; type RootPath = $ReadOnly<{ type: "root", @@ -369,16 +371,20 @@ function throwUnknownError(loc: OptionPath) { if (removed[key]) { const { message, version = 5 } = removed[key]; - throw new ReferenceError( + throw new Error( `Using removed Babel ${version} option: ${msg(loc)} - ${message}`, ); } else { // eslint-disable-next-line max-len - const unknownOptErr = `Unknown option: ${msg( - loc, - )}. Check out https://babeljs.io/docs/en/babel-core/#options for more information about options.`; + const unknownOptErr = new Error( + `Unknown option: ${msg( + loc, + )}. Check out https://babeljs.io/docs/en/babel-core/#options for more information about options.`, + ); + // $FlowIgnore + unknownOptErr.code = "BABEL_UNKNOWN_OPTION"; - throw new ReferenceError(unknownOptErr); + throw unknownOptErr; } } @@ -443,3 +449,26 @@ function assertOverridesList(loc: OptionPath, value: mixed): OverridesList { } return (arr: any); } + +export function checkNoUnwrappedItemOptionPairs( + lastItem: UnloadedDescriptor, + thisItem: UnloadedDescriptor, + type: "plugin" | "preset", + index: number, + e: Error, +): void { + if ( + lastItem.file && + lastItem.options === undefined && + typeof thisItem.value === "object" + ) { + e.message += + `\n- Maybe you meant to use\n` + + `"${type}": [\n ["${lastItem.file.request}", ${JSON.stringify( + thisItem.value, + undefined, + 2, + )}]\n]\n` + + `To be a valid ${type}, its name and options should be wrapped in a pair of brackets`; + } +} diff --git a/packages/babel-core/src/config/validation/plugins.js b/packages/babel-core/src/config/validation/plugins.js index 7800de965e31..06778caff269 100644 --- a/packages/babel-core/src/config/validation/plugins.js +++ b/packages/babel-core/src/config/validation/plugins.js @@ -84,11 +84,27 @@ export type PluginObject = { }; export function validatePluginObject(obj: {}): PluginObject { + const rootPath: RootPath = { + type: "root", + source: "plugin", + }; Object.keys(obj).forEach(key => { const validator = VALIDATORS[key]; + const optLoc = { + type: "option", + name: key, + parent: rootPath, + }; - if (validator) validator(key, obj[key]); - else throw new Error(`.${key} is not a valid Plugin property`); + if (validator) validator(optLoc, obj[key]); + else { + const invalidPluginPropertyError = new Error( + `.${key} is not a valid Plugin property`, + ); + // $FlowIgnore + invalidPluginPropertyError.code = "BABEL_UNKNOWN_PLUGIN_PROPERTY"; + throw invalidPluginPropertyError; + } }); return (obj: any); diff --git a/packages/babel-core/src/gensync-utils/async.js b/packages/babel-core/src/gensync-utils/async.js new file mode 100644 index 000000000000..84edcc394135 --- /dev/null +++ b/packages/babel-core/src/gensync-utils/async.js @@ -0,0 +1,110 @@ +// @flow + +import gensync, { type Gensync, type Handler } from "gensync"; + +type MaybePromise = T | Promise; + +const id = x => x; + +const runGenerator = gensync(function*(item) { + return yield* item; +}); + +// This Gensync returns true if the current execution contect is +// asynchronous, otherwise it returns false. +export const isAsync = gensync<[], boolean>({ + sync: () => false, + errback: cb => cb(null, true), +}); + +// This function wraps any functions (which could be either synchronous or +// asynchronous) with a Gensync. If the wrapped function returns a promise +// but the current execution context is synchronous, it will throw the +// provided error. +// This is used to handle user-provided functions which could be asynchronous. +export function maybeAsync( + fn: (...args: Args) => T, + message: string, +): Gensync { + return gensync({ + sync(...args) { + const result = fn.apply(this, args); + if (isThenable(result)) throw new Error(message); + return result; + }, + async(...args) { + return Promise.resolve(fn.apply(this, args)); + }, + }); +} + +const withKind = (gensync<[any], any>({ + sync: cb => cb("sync"), + async: cb => cb("async"), +}): (cb: (kind: "sync" | "async") => MaybePromise) => Handler); + +// This function wraps a generator (or a Gensync) into another function which, +// when called, will run the provided generator in a sync or async way, depending +// on the execution context where this forwardAsync function is called. +// This is useful, for example, when passing a callback to a function which isn't +// aware of gensync, but it only knows about synchronous and asynchronous functions. +// An example is cache.using, which being exposed to the user must be as simple as +// possible: +// yield* forwardAsync(gensyncFn, wrappedFn => +// cache.using(x => { +// // Here we don't know about gensync. wrappedFn is a +// // normal sync or async function +// return wrappedFn(x); +// }) +// ) +export function forwardAsync( + action: (...args: ActionArgs) => Handler, + cb: ( + adapted: (...args: ActionArgs) => MaybePromise, + ) => MaybePromise, +): Handler { + const g = gensync(action); + return withKind(kind => { + const adapted = g[kind]; + return cb(adapted); + }); +} + +// If the given generator is executed asynchronously, the first time that it +// is paused (i.e. When it yields a gensync generator which can't be run +// synchronously), call the "firstPause" callback. +export const onFirstPause = (gensync<[any, any], any>({ + name: "onFirstPause", + arity: 2, + sync: function(item) { + return runGenerator.sync(item); + }, + errback: function(item, firstPause, cb) { + let completed = false; + + runGenerator.errback(item, (err, value) => { + completed = true; + cb(err, value); + }); + + if (!completed) { + firstPause(); + } + }, +}): (gen: Generator<*, T, *>, cb: Function) => Handler); + +// Wait for the given promise to be resolved +export const waitFor = (gensync<[any], any>({ + sync: id, + async: id, +}): (p: T | Promise) => Handler); + +export function isThenable(val: mixed): boolean %checks { + return ( + /*:: val instanceof Promise && */ + !!val && + (typeof val === "object" || typeof val === "function") && + !!val.then && + typeof val.then === "function" + ); +} diff --git a/packages/babel-core/src/gensync-utils/fs.js b/packages/babel-core/src/gensync-utils/fs.js new file mode 100644 index 000000000000..6b8f60c7b145 --- /dev/null +++ b/packages/babel-core/src/gensync-utils/fs.js @@ -0,0 +1,21 @@ +// @flow + +import fs from "fs"; +import gensync from "gensync"; + +export const readFile = gensync<[string, "utf8"], string>({ + sync: fs.readFileSync, + errback: fs.readFile, +}); + +export const exists = gensync<[string], boolean>({ + sync(path) { + try { + fs.accessSync(path); + return true; + } catch { + return false; + } + }, + errback: (path, cb) => fs.access(path, undefined, err => cb(null, !err)), +}); diff --git a/packages/babel-core/src/gensync-utils/resolve.js b/packages/babel-core/src/gensync-utils/resolve.js new file mode 100644 index 000000000000..d16f6e7c4b2c --- /dev/null +++ b/packages/babel-core/src/gensync-utils/resolve.js @@ -0,0 +1,9 @@ +// @flow + +import resolve from "resolve"; +import gensync from "gensync"; + +export default gensync<[string, {| basedir: string |}], string>({ + sync: resolve.sync, + errback: resolve, +}); diff --git a/packages/babel-core/src/index.js b/packages/babel-core/src/index.js index e7ae7c0edfc6..23d023b5cabd 100644 --- a/packages/babel-core/src/index.js +++ b/packages/babel-core/src/index.js @@ -1,9 +1,7 @@ // @flow export { default as File } from "./transformation/file/file"; -export { - default as buildExternalHelpers, -} from "./tools/build-external-helpers"; +export { default as buildExternalHelpers } from "./tools/build-external-helpers"; export { resolvePlugin, resolvePreset } from "./config/files"; export { version } from "../package.json"; @@ -17,7 +15,14 @@ export { default as template } from "@babel/template"; export { createConfigItem } from "./config/item"; -export { loadPartialConfig, loadOptions } from "./config"; +export { + loadPartialConfig, + loadPartialConfigSync, + loadPartialConfigAsync, + loadOptions, + loadOptionsSync, + loadOptionsAsync, +} from "./config"; export { transform, transformSync, transformAsync } from "./transform"; export { diff --git a/packages/babel-core/src/parse.js b/packages/babel-core/src/parse.js index b3397a1a2e23..3609df763530 100644 --- a/packages/babel-core/src/parse.js +++ b/packages/babel-core/src/parse.js @@ -1,14 +1,13 @@ // @flow +import gensync from "gensync"; + import loadConfig, { type InputOptions } from "./config"; -import normalizeFile from "./transformation/normalize-file"; +import parser from "./parser"; +import type { ParseResult } from "./parser"; import normalizeOptions from "./transformation/normalize-opts"; -type AstRoot = BabelNodeFile | BabelNodeProgram; - -export type ParseResult = AstRoot; - -export type FileParseCallback = { +type FileParseCallback = { (Error, null): any, (null, ParseResult | null): any, }; @@ -22,6 +21,18 @@ type Parse = { (code: string, opts: ?InputOptions): ParseResult | null, }; +const parseRunner = gensync<[string, ?InputOptions], ParseResult | null>( + function* parse(code, opts) { + const config = yield* loadConfig(opts); + + if (config === null) { + return null; + } + + return yield* parser(config.passes, normalizeOptions(config), code); + }, +); + export const parse: Parse = (function parse(code, opts, callback) { if (typeof opts === "function") { callback = opts; @@ -30,55 +41,10 @@ export const parse: Parse = (function parse(code, opts, callback) { // For backward-compat with Babel 7's early betas, we allow sync parsing when // no callback is given. Will be dropped in some future Babel major version. - if (callback === undefined) return parseSync(code, opts); - - const config = loadConfig(opts); - - if (config === null) { - return null; - } - - // Reassign to keep Flowtype happy. - const cb = callback; - - // Just delaying the transform one tick for now to simulate async behavior - // but more async logic may land here eventually. - process.nextTick(() => { - let ast = null; - try { - const cfg = loadConfig(opts); - if (cfg === null) return cb(null, null); - - ast = normalizeFile(cfg.passes, normalizeOptions(cfg), code).ast; - } catch (err) { - return cb(err); - } + if (callback === undefined) return parseRunner.sync(code, opts); - cb(null, ast); - }); + parseRunner.errback(code, opts, callback); }: Function); -export function parseSync( - code: string, - opts?: InputOptions, -): ParseResult | null { - const config = loadConfig(opts); - - if (config === null) { - return null; - } - - return normalizeFile(config.passes, normalizeOptions(config), code).ast; -} - -export function parseAsync( - code: string, - opts?: InputOptions, -): Promise { - return new Promise((res, rej) => { - parse(code, opts, (err, result) => { - if (err == null) res(result); - else rej(err); - }); - }); -} +export const parseSync = parseRunner.sync; +export const parseAsync = parseRunner.async; diff --git a/packages/babel-core/src/parser/index.js b/packages/babel-core/src/parser/index.js new file mode 100644 index 000000000000..3ddf5ca4b64d --- /dev/null +++ b/packages/babel-core/src/parser/index.js @@ -0,0 +1,76 @@ +import type { Handler } from "gensync"; +import { parse } from "@babel/parser"; +import { codeFrameColumns } from "@babel/code-frame"; +import generateMissingPluginMessage from "./util/missing-plugin-helper"; + +type AstRoot = BabelNodeFile | BabelNodeProgram; + +export type ParseResult = AstRoot; + +export default function* parser( + pluginPasses: PluginPasses, + { parserOpts, highlightCode = true, filename = "unknown" }: Object, + code: string, +): Handler { + try { + const results = []; + for (const plugins of pluginPasses) { + for (const plugin of plugins) { + const { parserOverride } = plugin; + if (parserOverride) { + const ast = parserOverride(code, parserOpts, parse); + + if (ast !== undefined) results.push(ast); + } + } + } + + if (results.length === 0) { + return parse(code, parserOpts); + } else if (results.length === 1) { + yield* []; // If we want to allow async parsers + if (typeof results[0].then === "function") { + throw new Error( + `You appear to be using an async parser plugin, ` + + `which your current version of Babel does not support. ` + + `If you're using a published plugin, you may need to upgrade ` + + `your @babel/core version.`, + ); + } + return results[0]; + } + throw new Error("More than one plugin attempted to override parsing."); + } catch (err) { + if (err.code === "BABEL_PARSER_SOURCETYPE_MODULE_REQUIRED") { + err.message += + "\nConsider renaming the file to '.mjs', or setting sourceType:module " + + "or sourceType:unambiguous in your Babel config for this file."; + // err.code will be changed to BABEL_PARSE_ERROR later. + } + + const { loc, missingPlugin } = err; + if (loc) { + const codeFrame = codeFrameColumns( + code, + { + start: { + line: loc.line, + column: loc.column + 1, + }, + }, + { + highlightCode, + }, + ); + if (missingPlugin) { + err.message = + `${filename}: ` + + generateMissingPluginMessage(missingPlugin[0], loc, codeFrame); + } else { + err.message = `${filename}: ${err.message}\n\n` + codeFrame; + } + err.code = "BABEL_PARSE_ERROR"; + } + throw err; + } +} diff --git a/packages/babel-core/src/transformation/util/missing-plugin-helper.js b/packages/babel-core/src/parser/util/missing-plugin-helper.js similarity index 82% rename from packages/babel-core/src/transformation/util/missing-plugin-helper.js rename to packages/babel-core/src/parser/util/missing-plugin-helper.js index b0642c50c3cf..114b9f23005b 100644 --- a/packages/babel-core/src/transformation/util/missing-plugin-helper.js +++ b/packages/babel-core/src/parser/util/missing-plugin-helper.js @@ -11,6 +11,26 @@ const pluginNameMap = { url: "https://git.io/vb4SL", }, }, + classPrivateProperties: { + syntax: { + name: "@babel/plugin-syntax-class-properties", + url: "https://git.io/vb4yQ", + }, + transform: { + name: "@babel/plugin-proposal-class-properties", + url: "https://git.io/vb4SL", + }, + }, + classPrivateMethods: { + syntax: { + name: "@babel/plugin-syntax-class-properties", + url: "https://git.io/vb4yQ", + }, + transform: { + name: "@babel/plugin-proposal-private-methods", + url: "https://git.io/JvpRG", + }, + }, decorators: { syntax: { name: "@babel/plugin-syntax-decorators", @@ -63,8 +83,8 @@ const pluginNameMap = { url: "https://git.io/vb4yb", }, transform: { - name: "@babel/plugin-transform-flow-strip-types", - url: "https://git.io/vb49g", + name: "@babel/preset-flow", + url: "https://git.io/JfeDn", }, }, functionBind: { @@ -99,8 +119,8 @@ const pluginNameMap = { url: "https://git.io/vb4yA", }, transform: { - name: "@babel/plugin-transform-react-jsx", - url: "https://git.io/vb4yd", + name: "@babel/preset-react", + url: "https://git.io/JfeDR", }, }, logicalAssignment: { @@ -113,16 +133,6 @@ const pluginNameMap = { url: "https://git.io/vAlRe", }, }, - nullishCoalescingOperator: { - syntax: { - name: "@babel/plugin-syntax-nullish-coalescing-operator", - url: "https://git.io/vb4yx", - }, - transform: { - name: "@babel/plugin-proposal-nullish-coalescing-operator", - url: "https://git.io/vb4Se", - }, - }, numericSeparator: { syntax: { name: "@babel/plugin-syntax-numeric-separator", @@ -153,6 +163,12 @@ const pluginNameMap = { url: "https://git.io/vb4SU", }, }, + recordAndTuple: { + syntax: { + name: "@babel/plugin-syntax-record-and-tuple", + url: "https://git.io/JvKp3", + }, + }, throwExpressions: { syntax: { name: "@babel/plugin-syntax-throw-expressions", @@ -169,8 +185,8 @@ const pluginNameMap = { url: "https://git.io/vb4SC", }, transform: { - name: "@babel/plugin-transform-typescript", - url: "https://git.io/vb4Sm", + name: "@babel/preset-typescript", + url: "https://git.io/JfeDz", }, }, @@ -188,6 +204,16 @@ const pluginNameMap = { url: "https://git.io/vb4yp", }, }, + nullishCoalescingOperator: { + syntax: { + name: "@babel/plugin-syntax-nullish-coalescing-operator", + url: "https://git.io/vb4yx", + }, + transform: { + name: "@babel/plugin-proposal-nullish-coalescing-operator", + url: "https://git.io/vb4Se", + }, + }, objectRestSpread: { syntax: { name: "@babel/plugin-syntax-object-rest-spread", @@ -234,13 +260,15 @@ export default function generateMissingPluginMessage( if (pluginInfo) { const { syntax: syntaxPlugin, transform: transformPlugin } = pluginInfo; if (syntaxPlugin) { + const syntaxPluginInfo = getNameURLCombination(syntaxPlugin); if (transformPlugin) { const transformPluginInfo = getNameURLCombination(transformPlugin); - helpMessage += - `\n\nAdd ${transformPluginInfo} to the 'plugins' section of your Babel config ` + - `to enable transformation.`; + const sectionType = transformPlugin.name.startsWith("@babel/plugin") + ? "plugins" + : "presets"; + helpMessage += `\n\nAdd ${transformPluginInfo} to the '${sectionType}' section of your Babel config to enable transformation. +If you want to leave it as-is, add ${syntaxPluginInfo} to the 'plugins' section to enable parsing.`; } else { - const syntaxPluginInfo = getNameURLCombination(syntaxPlugin); helpMessage += `\n\nAdd ${syntaxPluginInfo} to the 'plugins' section of your Babel config ` + `to enable parsing.`; diff --git a/packages/babel-core/src/tools/build-external-helpers.js b/packages/babel-core/src/tools/build-external-helpers.js index c6aa2bf6d21a..914f2baf4e84 100644 --- a/packages/babel-core/src/tools/build-external-helpers.js +++ b/packages/babel-core/src/tools/build-external-helpers.js @@ -2,6 +2,7 @@ import * as helpers from "@babel/helpers"; import generator from "@babel/generator"; import template from "@babel/template"; import * as t from "@babel/types"; +import File from "../transformation/file/file"; // Wrapped to avoid wasting time parsing this when almost no-one uses // build-external-helpers. @@ -136,6 +137,7 @@ function buildHelpers(body, namespace, whitelist) { const ref = (refs[name] = getHelperReference(name)); + helpers.ensure(name, File); const { nodes } = helpers.get(name, getHelperReference, ref); body.push(...nodes); diff --git a/packages/babel-core/src/transform-ast.js b/packages/babel-core/src/transform-ast.js index 101177dcece9..9a40bda90d3a 100644 --- a/packages/babel-core/src/transform-ast.js +++ b/packages/babel-core/src/transform-ast.js @@ -1,9 +1,10 @@ // @flow -import loadConfig, { type InputOptions } from "./config"; +import gensync from "gensync"; + +import loadConfig, { type InputOptions, type ResolvedConfig } from "./config"; import { - runSync, - runAsync, + run, type FileResult, type FileResultCallback, } from "./transformation"; @@ -24,6 +25,18 @@ type TransformFromAst = { (ast: AstRoot, code: string, opts: ?InputOptions): FileResult | null, }; +const transformFromAstRunner = gensync< + [AstRoot, string, ?InputOptions], + FileResult | null, +>(function*(ast, code, opts) { + const config: ResolvedConfig | null = yield* loadConfig(opts); + if (config === null) return null; + + if (!ast) throw new Error("No AST given"); + + return yield* run(config, code, ast); +}); + export const transformFromAst: TransformFromAst = (function transformFromAst( ast, code, @@ -37,50 +50,12 @@ export const transformFromAst: TransformFromAst = (function transformFromAst( // For backward-compat with Babel 6, we allow sync transformation when // no callback is given. Will be dropped in some future Babel major version. - if (callback === undefined) return transformFromAstSync(ast, code, opts); - - // Reassign to keep Flowtype happy. - const cb = callback; - - // Just delaying the transform one tick for now to simulate async behavior - // but more async logic may land here eventually. - process.nextTick(() => { - let cfg; - try { - cfg = loadConfig(opts); - if (cfg === null) return cb(null, null); - } catch (err) { - return cb(err); - } - - if (!ast) return cb(new Error("No AST given")); + if (callback === undefined) { + return transformFromAstRunner.sync(ast, code, opts); + } - runAsync(cfg, code, ast, cb); - }); + transformFromAstRunner.errback(ast, code, opts, callback); }: Function); -export function transformFromAstSync( - ast: AstRoot, - code: string, - opts: ?InputOptions, -): FileResult | null { - const config = loadConfig(opts); - if (config === null) return null; - - if (!ast) throw new Error("No AST given"); - - return runSync(config, code, ast); -} - -export function transformFromAstAsync( - ast: AstRoot, - code: string, - opts: ?InputOptions, -): Promise { - return new Promise((res, rej) => { - transformFromAst(ast, code, opts, (err, result) => { - if (err == null) res(result); - else rej(err); - }); - }); -} +export const transformFromAstSync = transformFromAstRunner.sync; +export const transformFromAstAsync = transformFromAstRunner.async; diff --git a/packages/babel-core/src/transform-file.js b/packages/babel-core/src/transform-file.js index d3c9ab640fc3..9d2c3e6ae406 100644 --- a/packages/babel-core/src/transform-file.js +++ b/packages/babel-core/src/transform-file.js @@ -1,13 +1,14 @@ // @flow -import fs from "fs"; -import loadConfig, { type InputOptions } from "./config"; +import gensync from "gensync"; + +import loadConfig, { type InputOptions, type ResolvedConfig } from "./config"; import { - runSync, - runAsync, + run, type FileResult, type FileResultCallback, } from "./transformation"; +import * as fs from "./gensync-utils/fs"; import typeof * as transformFileBrowserType from "./transform-file-browser"; import typeof * as transformFileType from "./transform-file"; @@ -22,74 +23,26 @@ type TransformFile = { (filename: string, opts: ?InputOptions, callback: FileResultCallback): void, }; -export const transformFile: TransformFile = (function transformFile( - filename, - opts, - callback, -) { - let options; - if (typeof opts === "function") { - callback = opts; - opts = undefined; - } - - if (opts == null) { - options = { filename }; - } else if (opts && typeof opts === "object") { - options = { - ...opts, - filename, - }; - } - - process.nextTick(() => { - let cfg; - try { - cfg = loadConfig(options); - if (cfg === null) return callback(null, null); - } catch (err) { - return callback(err); +const transformFileRunner = gensync<[string, ?InputOptions], FileResult | null>( + function*(filename, opts) { + let options; + if (opts == null) { + options = { filename }; + } else if (opts && typeof opts === "object") { + options = { + ...opts, + filename, + }; } - // Reassignment to keep Flow happy. - const config = cfg; - - fs.readFile(filename, "utf8", function(err, code: string) { - if (err) return callback(err, null); - - runAsync(config, code, null, callback); - }); - }); -}: Function); - -export function transformFileSync( - filename: string, - opts: ?InputOptions, -): FileResult | null { - let options; - if (opts == null) { - options = { filename }; - } else if (opts && typeof opts === "object") { - options = { - ...opts, - filename, - }; - } - - const config = loadConfig(options); - if (config === null) return null; + const config: ResolvedConfig | null = yield* loadConfig(options); + if (config === null) return null; - return runSync(config, fs.readFileSync(filename, "utf8")); -} + const code = yield* fs.readFile(filename, "utf8"); + return yield* run(config, code); + }, +); -export function transformFileAsync( - filename: string, - opts: ?InputOptions, -): Promise { - return new Promise((res, rej) => { - transformFile(filename, opts, (err, result) => { - if (err == null) res(result); - else rej(err); - }); - }); -} +export const transformFile: TransformFile = transformFileRunner.errback; +export const transformFileSync = transformFileRunner.sync; +export const transformFileAsync = transformFileRunner.async; diff --git a/packages/babel-core/src/transform.js b/packages/babel-core/src/transform.js index 4a2f0e5c1691..0ace438c29fa 100644 --- a/packages/babel-core/src/transform.js +++ b/packages/babel-core/src/transform.js @@ -1,8 +1,10 @@ // @flow -import loadConfig, { type InputOptions } from "./config"; + +import gensync from "gensync"; + +import loadConfig, { type InputOptions, type ResolvedConfig } from "./config"; import { - runSync, - runAsync, + run, type FileResult, type FileResultCallback, } from "./transformation"; @@ -16,6 +18,15 @@ type Transform = { (code: string, opts: ?InputOptions): FileResult | null, }; +const transformRunner = gensync<[string, ?InputOptions], FileResult | null>( + function* transform(code, opts) { + const config: ResolvedConfig | null = yield* loadConfig(opts); + if (config === null) return null; + + return yield* run(config, code); + }, +); + export const transform: Transform = (function transform(code, opts, callback) { if (typeof opts === "function") { callback = opts; @@ -24,44 +35,10 @@ export const transform: Transform = (function transform(code, opts, callback) { // For backward-compat with Babel 6, we allow sync transformation when // no callback is given. Will be dropped in some future Babel major version. - if (callback === undefined) return transformSync(code, opts); + if (callback === undefined) return transformRunner.sync(code, opts); - // Reassign to keep Flowtype happy. - const cb = callback; - - // Just delaying the transform one tick for now to simulate async behavior - // but more async logic may land here eventually. - process.nextTick(() => { - let cfg; - try { - cfg = loadConfig(opts); - if (cfg === null) return cb(null, null); - } catch (err) { - return cb(err); - } - - runAsync(cfg, code, null, cb); - }); + transformRunner.errback(code, opts, callback); }: Function); -export function transformSync( - code: string, - opts: ?InputOptions, -): FileResult | null { - const config = loadConfig(opts); - if (config === null) return null; - - return runSync(config, code); -} - -export function transformAsync( - code: string, - opts: ?InputOptions, -): Promise { - return new Promise((res, rej) => { - transform(code, opts, (err, result) => { - if (err == null) res(result); - else rej(err); - }); - }); -} +export const transformSync = transformRunner.sync; +export const transformAsync = transformRunner.async; diff --git a/packages/babel-core/src/transformation/block-hoist-plugin.js b/packages/babel-core/src/transformation/block-hoist-plugin.js index 8e8fe69699f0..49ecf5a18556 100644 --- a/packages/babel-core/src/transformation/block-hoist-plugin.js +++ b/packages/babel-core/src/transformation/block-hoist-plugin.js @@ -11,7 +11,7 @@ export default function loadBlockHoistPlugin(): Plugin { // Lazy-init the internal plugin to remove the init-time circular // dependency between plugins being passed @babel/core's export object, // which loads this file, and this 'loadConfig' loading plugins. - const config = loadConfig({ + const config = loadConfig.sync({ babelrc: false, configFile: false, plugins: [blockHoistPlugin], diff --git a/packages/babel-core/src/transformation/file/file.js b/packages/babel-core/src/transformation/file/file.js index a0a9f65bcdf4..4187151a973a 100644 --- a/packages/babel-core/src/transformation/file/file.js +++ b/packages/babel-core/src/transformation/file/file.js @@ -5,6 +5,7 @@ import { NodePath, Scope, type HubInterface } from "@babel/traverse"; import { codeFrameColumns } from "@babel/code-frame"; import traverse from "@babel/traverse"; import * as t from "@babel/types"; +import { getModuleName } from "@babel/helper-module-transforms"; import semver from "semver"; import type { NormalizedFile } from "../normalize-file"; @@ -19,6 +20,17 @@ const errorVisitor = { }, }; +export type NodeLocation = { + loc?: { + end?: { line: number, column: number }, + start: { line: number, column: number }, + }, + _loc?: { + end?: { line: number, column: number }, + start: { line: number, column: number }, + }, +}; + export default class File { _map: Map = new Map(); opts: Object; @@ -95,49 +107,7 @@ export default class File { } getModuleName(): ?string { - const { - filename, - filenameRelative = filename, - - moduleId, - moduleIds = !!moduleId, - - getModuleId, - - sourceRoot: sourceRootTmp, - moduleRoot = sourceRootTmp, - sourceRoot = moduleRoot, - } = this.opts; - - if (!moduleIds) return null; - - // moduleId is n/a if a `getModuleId()` is provided - if (moduleId != null && !getModuleId) { - return moduleId; - } - - let moduleName = moduleRoot != null ? moduleRoot + "/" : ""; - - if (filenameRelative) { - const sourceRootReplacer = - sourceRoot != null ? new RegExp("^" + sourceRoot + "/?") : ""; - - moduleName += filenameRelative - // remove sourceRoot from filename - .replace(sourceRootReplacer, "") - // remove extension - .replace(/\.(\w*?)$/, ""); - } - - // normalize path separators - moduleName = moduleName.replace(/\\/g, "/"); - - if (getModuleId) { - // If return is falsy, assume they want us to use our generated default name - return getModuleId(moduleName) || moduleName; - } else { - return moduleName; - } + return getModuleName(this.opts, this.opts); } addImport() { @@ -204,7 +174,7 @@ export default class File { } // make sure that the helper exists - helpers.ensure(name); + helpers.ensure(name, File); const uid = (this.declarations[name] = this.scope.generateUidIdentifier( name, @@ -250,17 +220,12 @@ export default class File { } buildCodeFrameError( - node: ?{ - loc?: { start: { line: number, column: number } }, - _loc?: { start: { line: number, column: number } }, - }, + node: ?NodeLocation, msg: string, Error: typeof Error = SyntaxError, ): Error { let loc = node && (node.loc || node._loc); - msg = `${this.opts.filename}: ${msg}`; - if (!loc && node) { const state = { loc: null, @@ -287,6 +252,13 @@ export default class File { line: loc.start.line, column: loc.start.column + 1, }, + end: + loc.end && loc.start.line === loc.end.line + ? { + line: loc.end.line, + column: loc.end.column + 1, + } + : undefined, }, { highlightCode }, ); diff --git a/packages/babel-core/src/transformation/file/generate.js b/packages/babel-core/src/transformation/file/generate.js index e124c16fc4c6..b07851fe9cba 100644 --- a/packages/babel-core/src/transformation/file/generate.js +++ b/packages/babel-core/src/transformation/file/generate.js @@ -1,7 +1,7 @@ // @flow import type { PluginPasses } from "../../config"; -import convertSourceMap, { type SourceMap } from "convert-source-map"; +import convertSourceMap, { typeof SourceMap } from "convert-source-map"; import generate from "@babel/generator"; import type File from "./file"; @@ -41,7 +41,7 @@ export default function generateCode( if (typeof result.then === "function") { throw new Error( - `You appear to be using an async parser plugin, ` + + `You appear to be using an async codegen plugin, ` + `which your current version of Babel does not support. ` + `If you're using a published plugin, ` + `you may need to upgrade your @babel/core version.`, diff --git a/packages/babel-core/src/transformation/file/merge-map.js b/packages/babel-core/src/transformation/file/merge-map.js index ff2e65b042b8..911867d96890 100644 --- a/packages/babel-core/src/transformation/file/merge-map.js +++ b/packages/babel-core/src/transformation/file/merge-map.js @@ -1,6 +1,6 @@ // @flow -import type { SourceMap } from "convert-source-map"; +import typeof { SourceMap } from "convert-source-map"; import sourceMap from "source-map"; export default function mergeSourceMap( diff --git a/packages/babel-core/src/transformation/index.js b/packages/babel-core/src/transformation/index.js index a03c4db0cf2a..970549f9d94e 100644 --- a/packages/babel-core/src/transformation/index.js +++ b/packages/babel-core/src/transformation/index.js @@ -1,6 +1,7 @@ // @flow import traverse from "@babel/traverse"; -import type { SourceMap } from "convert-source-map"; +import typeof { SourceMap } from "convert-source-map"; +import type { Handler } from "gensync"; import type { ResolvedConfig, PluginPasses } from "../config"; @@ -25,41 +26,41 @@ export type FileResult = { map: SourceMap | null, }; -export function runAsync( +export function* run( config: ResolvedConfig, code: string, ast: ?(BabelNodeFile | BabelNodeProgram), - callback: Function, -) { - let result; - try { - result = runSync(config, code, ast); - } catch (err) { - return callback(err); - } - - // We don't actually care about calling this synchronously here because it is - // already running within a .nextTick handler from the transform calls above. - return callback(null, result); -} - -export function runSync( - config: ResolvedConfig, - code: string, - ast: ?(BabelNodeFile | BabelNodeProgram), -): FileResult { - const file = normalizeFile( +): Handler { + const file = yield* normalizeFile( config.passes, normalizeOptions(config), code, ast, ); - transformFile(file, config.passes); - const opts = file.opts; - const { outputCode, outputMap } = - opts.code !== false ? generateCode(config.passes, file) : {}; + try { + yield* transformFile(file, config.passes); + } catch (e) { + e.message = `${opts.filename ?? "unknown"}: ${e.message}`; + if (!e.code) { + e.code = "BABEL_TRANSFORM_ERROR"; + } + throw e; + } + + let outputCode, outputMap; + try { + if (opts.code !== false) { + ({ outputCode, outputMap } = generateCode(config.passes, file)); + } + } catch (e) { + e.message = `${opts.filename ?? "unknown"}: ${e.message}`; + if (!e.code) { + e.code = "BABEL_GENERATE_ERROR"; + } + throw e; + } return { metadata: file.metadata, @@ -71,7 +72,7 @@ export function runSync( }; } -function transformFile(file: File, pluginPasses: PluginPasses): void { +function* transformFile(file: File, pluginPasses: PluginPasses): Handler { for (const pluginPairs of pluginPasses) { const passPairs = []; const passes = []; @@ -90,6 +91,7 @@ function transformFile(file: File, pluginPasses: PluginPasses): void { if (fn) { const result = fn.call(pass, file); + yield* []; if (isThenable(result)) { throw new Error( `You appear to be using an plugin with an async .pre, ` + @@ -114,6 +116,7 @@ function transformFile(file: File, pluginPasses: PluginPasses): void { if (fn) { const result = fn.call(pass, file); + yield* []; if (isThenable(result)) { throw new Error( `You appear to be using an plugin with an async .post, ` + diff --git a/packages/babel-core/src/transformation/normalize-file.js b/packages/babel-core/src/transformation/normalize-file.js index 65476e1d5d27..4beea7de13ae 100644 --- a/packages/babel-core/src/transformation/normalize-file.js +++ b/packages/babel-core/src/transformation/normalize-file.js @@ -1,17 +1,18 @@ // @flow +import fs from "fs"; import path from "path"; import buildDebug from "debug"; import cloneDeep from "lodash/cloneDeep"; +import type { Handler } from "gensync"; import * as t from "@babel/types"; import type { PluginPasses } from "../config"; import convertSourceMap, { typeof Converter } from "convert-source-map"; -import { parse } from "@babel/parser"; -import { codeFrameColumns } from "@babel/code-frame"; import File from "./file/file"; -import generateMissingPluginMessage from "./util/missing-plugin-helper"; +import parser from "../parser"; const debug = buildDebug("babel:transform:file"); +const LARGE_INPUT_SOURCEMAP_THRESHOLD = 1_000_000; export type NormalizedFile = { code: string, @@ -19,14 +20,25 @@ export type NormalizedFile = { inputMap: Converter | null, }; -export default function normalizeFile( +export default function* normalizeFile( pluginPasses: PluginPasses, options: Object, code: string, ast: ?(BabelNodeFile | BabelNodeProgram), -): File { +): Handler { code = `${code || ""}`; + if (ast) { + if (ast.type === "Program") { + ast = t.file(ast, [], []); + } else if (ast.type !== "File") { + throw new Error("AST root must be a Program or File node"); + } + ast = cloneDeep(ast); + } else { + ast = yield* parser(pluginPasses, options, code); + } + let inputMap = null; if (options.inputSourceMap !== false) { // If an explicit object is passed in, it overrides the processing of @@ -36,36 +48,37 @@ export default function normalizeFile( } if (!inputMap) { - try { - inputMap = convertSourceMap.fromSource(code); - - if (inputMap) { - code = convertSourceMap.removeComments(code); + const lastComment = extractComments(INLINE_SOURCEMAP_REGEX, ast); + if (lastComment) { + try { + inputMap = convertSourceMap.fromComment(lastComment); + } catch (err) { + debug("discarding unknown inline input sourcemap", err); } - } catch (err) { - debug("discarding unknown inline input sourcemap", err); - code = convertSourceMap.removeComments(code); } } if (!inputMap) { - if (typeof options.filename === "string") { + const lastComment = extractComments(EXTERNAL_SOURCEMAP_REGEX, ast); + if (typeof options.filename === "string" && lastComment) { try { - inputMap = convertSourceMap.fromMapFileSource( - code, - path.dirname(options.filename), + // when `lastComment` is non-null, EXTERNAL_SOURCEMAP_REGEX must have matches + const match: [string, string] = (EXTERNAL_SOURCEMAP_REGEX.exec( + lastComment, + ): any); + const inputMapContent: Buffer = fs.readFileSync( + path.resolve(path.dirname(options.filename), match[1]), ); - - if (inputMap) { - code = convertSourceMap.removeMapFileComments(code); + if (inputMapContent.length > LARGE_INPUT_SOURCEMAP_THRESHOLD) { + debug("skip merging input map > 1 MB"); + } else { + inputMap = convertSourceMap.fromJSON(inputMapContent); } } catch (err) { debug("discarding unknown file input sourcemap", err); - code = convertSourceMap.removeMapFileComments(code); } - } else { + } else if (lastComment) { debug("discarding un-loadable file input sourcemap"); - code = convertSourceMap.removeMapFileComments(code); } } } @@ -98,68 +111,47 @@ export default function normalizeFile( }); } -function parser( - pluginPasses: PluginPasses, - { parserOpts, highlightCode = true, filename = "unknown" }: Object, - code: string, -) { - try { - const results = []; - for (const plugins of pluginPasses) { - for (const plugin of plugins) { - const { parserOverride } = plugin; - if (parserOverride) { - const ast = parserOverride(code, parserOpts, parse); +// These regexps are copied from the convert-source-map package, +// but without // or /* at the beginning of the comment. - if (ast !== undefined) results.push(ast); - } - } - } +// eslint-disable-next-line max-len +const INLINE_SOURCEMAP_REGEX = /^[@#]\s+sourceMappingURL=data:(?:application|text)\/json;(?:charset[:=]\S+?;)?base64,(?:.*)$/; +const EXTERNAL_SOURCEMAP_REGEX = /^[@#][ \t]+sourceMappingURL=([^\s'"`]+)[ \t]*$/; - if (results.length === 0) { - return parse(code, parserOpts); - } else if (results.length === 1) { - if (typeof results[0].then === "function") { - throw new Error( - `You appear to be using an async codegen plugin, ` + - `which your current version of Babel does not support. ` + - `If you're using a published plugin, you may need to upgrade ` + - `your @babel/core version.`, - ); +function extractCommentsFromList(regex, comments, lastComment) { + if (comments) { + comments = comments.filter(({ value }) => { + if (regex.test(value)) { + lastComment = value; + return false; } - return results[0]; - } - throw new Error("More than one plugin attempted to override parsing."); - } catch (err) { - if (err.code === "BABEL_PARSER_SOURCETYPE_MODULE_REQUIRED") { - err.message += - "\nConsider renaming the file to '.mjs', or setting sourceType:module " + - "or sourceType:unambiguous in your Babel config for this file."; - } - - const { loc, missingPlugin } = err; - if (loc) { - const codeFrame = codeFrameColumns( - code, - { - start: { - line: loc.line, - column: loc.column + 1, - }, - }, - { - highlightCode, - }, - ); - if (missingPlugin) { - err.message = - `${filename}: ` + - generateMissingPluginMessage(missingPlugin[0], loc, codeFrame); - } else { - err.message = `${filename}: ${err.message}\n\n` + codeFrame; - } - err.code = "BABEL_PARSE_ERROR"; - } - throw err; + return true; + }); } + return [comments, lastComment]; +} + +function extractComments(regex, ast) { + let lastComment = null; + t.traverseFast(ast, node => { + // $FlowIgnore destructuring with expressions is not supported + [node.leadingComments, lastComment] = extractCommentsFromList( + regex, + node.leadingComments, + lastComment, + ); + // $FlowIgnore destructuring with expressions is not supported + [node.innerComments, lastComment] = extractCommentsFromList( + regex, + node.innerComments, + lastComment, + ); + // $FlowIgnore destructuring with expressions is not supported + [node.trailingComments, lastComment] = extractCommentsFromList( + regex, + node.trailingComments, + lastComment, + ); + }); + return lastComment; } diff --git a/packages/babel-core/src/transformation/plugin-pass.js b/packages/babel-core/src/transformation/plugin-pass.js index 6e62c42bc786..e11f97804745 100644 --- a/packages/babel-core/src/transformation/plugin-pass.js +++ b/packages/babel-core/src/transformation/plugin-pass.js @@ -1,6 +1,7 @@ // @flow import type File from "./file/file"; +import type NodeLocation from "./file/file"; export default class PluginPass { _map: Map = new Map(); @@ -47,14 +48,7 @@ export default class PluginPass { return this.file.getModuleName(); } - buildCodeFrameError( - node: ?{ - loc?: { start: { line: number, column: number } }, - _loc?: { start: { line: number, column: number } }, - }, - msg: string, - Error?: typeof Error, - ) { + buildCodeFrameError(node: ?NodeLocation, msg: string, Error?: typeof Error) { return this.file.buildCodeFrameError(node, msg, Error); } } diff --git a/packages/babel-core/test/__snapshots__/option-manager.js.snap b/packages/babel-core/test/__snapshots__/option-manager.js.snap new file mode 100644 index 000000000000..423a2dac00b8 --- /dev/null +++ b/packages/babel-core/test/__snapshots__/option-manager.js.snap @@ -0,0 +1,34 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`option-manager config plugin/preset flattening and overriding should throw when an option is following a preset 1`] = ` +"[BABEL] unknown: Unknown option: .useSpread. Check out https://babeljs.io/docs/en/babel-core/#options for more information about options. +- Maybe you meant to use +\\"preset\\": [ + [\\"./fixtures/option-manager/babel-preset-bar\\", { + \\"useSpread\\": true +}] +] +To be a valid preset, its name and options should be wrapped in a pair of brackets" +`; + +exports[`option-manager config plugin/preset flattening and overriding should throw when an option is provided as a plugin 1`] = ` +"[BABEL] unknown: .useSpread is not a valid Plugin property +- Maybe you meant to use +\\"plugin\\": [ + [\\"./fixtures/option-manager/babel-plugin-foo\\", { + \\"useSpread\\": true +}] +] +To be a valid plugin, its name and options should be wrapped in a pair of brackets" +`; + +exports[`option-manager config plugin/preset flattening and overriding should throw when an option is provided as a preset 1`] = ` +"[BABEL] unknown: Unknown option: .useBuiltIns. Check out https://babeljs.io/docs/en/babel-core/#options for more information about options. +- Maybe you meant to use +\\"preset\\": [ + [\\"./fixtures/option-manager/babel-preset-bar\\", { + \\"useBuiltIns\\": \\"entry\\" +}] +] +To be a valid preset, its name and options should be wrapped in a pair of brackets" +`; diff --git a/packages/babel-core/test/api.js b/packages/babel-core/test/api.js index 6868db9c84fd..0ab8b5a796b1 100644 --- a/packages/babel-core/test/api.js +++ b/packages/babel-core/test/api.js @@ -785,11 +785,11 @@ describe("api", function() { options, function(err) { expect(err.message).toMatch( - "Support for the experimental syntax 'dynamicImport' isn't currently enabled (1:9)", + "Support for the experimental syntax 'pipelineOperator' isn't currently enabled (1:3):", ); expect(err.message).toMatch( - "Add @babel/plugin-syntax-dynamic-import (https://git.io/vb4Sv) to the " + - "'plugins' section of your Babel config to enable parsing.", + "Add @babel/plugin-proposal-pipeline-operator (https://git.io/vb4SU) to the " + + "'plugins' section of your Babel config to enable transformation.", ); done(); }, diff --git a/packages/babel-core/test/async.js b/packages/babel-core/test/async.js new file mode 100644 index 000000000000..3d834c9e637d --- /dev/null +++ b/packages/babel-core/test/async.js @@ -0,0 +1,214 @@ +import path from "path"; +import * as babel from ".."; + +const nodeGte8 = (...args) => { + // "minNodeVersion": "8.0.0" <-- For Ctrl+F when dropping node 6 + const testFn = process.version.slice(0, 3) === "v6." ? it.skip : it; + testFn(...args); +}; + +describe("asynchronicity", () => { + const base = path.join(__dirname, "fixtures", "async"); + let cwd; + + beforeEach(function() { + cwd = process.cwd(); + process.chdir(base); + }); + + afterEach(function() { + process.chdir(cwd); + }); + + describe("config file", () => { + describe("async function", () => { + nodeGte8("called synchronously", () => { + process.chdir("config-file-async-function"); + + expect(() => + babel.transformSync(""), + ).toThrowErrorMatchingInlineSnapshot( + `"You appear to be using an async configuration, which your current version of Babel does` + + ` not support. We may add support for this in the future, but if you're on the most recent` + + ` version of @babel/core and still seeing this error, then you'll need to synchronously` + + ` return your config."`, + ); + }); + + nodeGte8("called asynchronously", async () => { + process.chdir("config-file-async-function"); + + await expect( + babel.transformAsync(""), + ).rejects.toThrowErrorMatchingInlineSnapshot( + `"You appear to be using an async configuration, which your current version of Babel does` + + ` not support. We may add support for this in the future, but if you're on the most recent` + + ` version of @babel/core and still seeing this error, then you'll need to synchronously` + + ` return your config."`, + ); + }); + }); + + describe("promise", () => { + it("called synchronously", () => { + process.chdir("config-file-promise"); + + expect(() => + babel.transformSync(""), + ).toThrowErrorMatchingInlineSnapshot( + `"You appear to be using an async configuration, which your current version of Babel does` + + ` not support. We may add support for this in the future, but if you're on the most recent` + + ` version of @babel/core and still seeing this error, then you'll need to synchronously` + + ` return your config."`, + ); + }); + + it("called asynchronously", async () => { + process.chdir("config-file-promise"); + + await expect( + babel.transformAsync(""), + ).rejects.toThrowErrorMatchingInlineSnapshot( + `"You appear to be using an async configuration, which your current version of Babel does` + + ` not support. We may add support for this in the future, but if you're on the most recent` + + ` version of @babel/core and still seeing this error, then you'll need to synchronously` + + ` return your config."`, + ); + }); + }); + + describe("cache.using", () => { + nodeGte8("called synchronously", () => { + process.chdir("config-cache"); + + expect(() => + babel.transformSync(""), + ).toThrowErrorMatchingInlineSnapshot( + `"You appear to be using an async cache handler, which your current version of Babel does` + + ` not support. We may add support for this in the future, but if you're on the most recent` + + ` version of @babel/core and still seeing this error, then you'll need to synchronously` + + ` handle your caching logic."`, + ); + }); + + nodeGte8("called asynchronously", async () => { + process.chdir("config-cache"); + + await expect( + babel.transformAsync(""), + ).rejects.toThrowErrorMatchingInlineSnapshot( + `"You appear to be using an async cache handler, which your current version of Babel does` + + ` not support. We may add support for this in the future, but if you're on the most recent` + + ` version of @babel/core and still seeing this error, then you'll need to synchronously` + + ` handle your caching logic."`, + ); + }); + }); + }); + + describe("plugin", () => { + describe("factory function", () => { + nodeGte8("called synchronously", () => { + process.chdir("plugin"); + + expect(() => + babel.transformSync(""), + ).toThrowErrorMatchingInlineSnapshot( + `"[BABEL] unknown: You appear to be using an async plugin, which your current version of Babel` + + ` does not support. If you're using a published plugin, you may need to upgrade your` + + ` @babel/core version."`, + ); + }); + + nodeGte8("called asynchronously", async () => { + process.chdir("plugin"); + + await expect( + babel.transformAsync(""), + ).rejects.toThrowErrorMatchingInlineSnapshot( + `"[BABEL] unknown: You appear to be using an async plugin, which your current version of Babel` + + ` does not support. If you're using a published plugin, you may need to upgrade your` + + ` @babel/core version."`, + ); + }); + }); + + describe(".pre", () => { + nodeGte8("called synchronously", () => { + process.chdir("plugin-pre"); + + expect(() => + babel.transformSync(""), + ).toThrowErrorMatchingInlineSnapshot( + `"unknown: You appear to be using an plugin with an async .pre, which your current version` + + ` of Babel does not support. If you're using a published plugin, you may need to upgrade your` + + ` @babel/core version."`, + ); + }); + + nodeGte8("called asynchronously", async () => { + process.chdir("plugin-pre"); + + await expect( + babel.transformAsync(""), + ).rejects.toThrowErrorMatchingInlineSnapshot( + `"unknown: You appear to be using an plugin with an async .pre, which your current version` + + ` of Babel does not support. If you're using a published plugin, you may need to upgrade your` + + ` @babel/core version."`, + ); + }); + }); + + describe(".post", () => { + nodeGte8("called synchronously", () => { + process.chdir("plugin-post"); + + expect(() => + babel.transformSync(""), + ).toThrowErrorMatchingInlineSnapshot( + `"unknown: You appear to be using an plugin with an async .post, which your current version` + + ` of Babel does not support. If you're using a published plugin, you may need to upgrade your` + + ` @babel/core version."`, + ); + }); + + nodeGte8("called asynchronously", async () => { + process.chdir("plugin-post"); + + await expect( + babel.transformAsync(""), + ).rejects.toThrowErrorMatchingInlineSnapshot( + `"unknown: You appear to be using an plugin with an async .post, which your current version` + + ` of Babel does not support. If you're using a published plugin, you may need to upgrade your` + + ` @babel/core version."`, + ); + }); + }); + + describe("inherits", () => { + nodeGte8("called synchronously", () => { + process.chdir("plugin-inherits"); + + expect(() => + babel.transformSync(""), + ).toThrowErrorMatchingInlineSnapshot( + `"[BABEL] unknown: You appear to be using an async plugin, which your current version of Babel` + + ` does not support. If you're using a published plugin, you may need to upgrade your` + + ` @babel/core version."`, + ); + }); + + nodeGte8("called asynchronously", async () => { + process.chdir("plugin-inherits"); + + await expect( + babel.transformAsync(""), + ).rejects.toThrowErrorMatchingInlineSnapshot( + `"[BABEL] unknown: You appear to be using an async plugin, which your current version of Babel` + + ` does not support. If you're using a published plugin, you may need to upgrade your` + + ` @babel/core version."`, + ); + }); + }); + }); +}); diff --git a/packages/babel-core/test/caching-api.js b/packages/babel-core/test/caching-api.js index 0318759fe861..f8d442c150b4 100644 --- a/packages/babel-core/test/caching-api.js +++ b/packages/babel-core/test/caching-api.js @@ -1,10 +1,12 @@ -import { makeStrongCache } from "../lib/config/caching"; +import gensync from "gensync"; +import { makeStrongCacheSync, makeStrongCache } from "../lib/config/caching"; +import { waitFor } from "../lib/gensync-utils/async"; describe("caching API", () => { it("should allow permacaching with .forever()", () => { let count = 0; - const fn = makeStrongCache((arg, cache) => { + const fn = makeStrongCacheSync((arg, cache) => { cache.forever(); return { arg, count: count++ }; }); @@ -21,7 +23,7 @@ describe("caching API", () => { it("should allow disabling caching with .never()", () => { let count = 0; - const fn = makeStrongCache((arg, cache) => { + const fn = makeStrongCacheSync((arg, cache) => { cache.never(); return { arg, count: count++ }; }); @@ -41,7 +43,7 @@ describe("caching API", () => { let count = 0; let other = "default"; - const fn = makeStrongCache((arg, cache) => { + const fn = makeStrongCacheSync((arg, cache) => { const val = cache.using(() => other); return { arg, val, count: count++ }; @@ -82,7 +84,7 @@ describe("caching API", () => { let count = 0; let other = "default"; - const fn = makeStrongCache((arg, cache) => { + const fn = makeStrongCacheSync((arg, cache) => { const val = cache.invalidate(() => other); return { arg, val, count: count++ }; @@ -124,7 +126,7 @@ describe("caching API", () => { let other = "default"; let another = "another"; - const fn = makeStrongCache((arg, cache) => { + const fn = makeStrongCacheSync((arg, cache) => { const val = cache.using(() => other); const val2 = cache.invalidate(() => another); @@ -223,7 +225,7 @@ describe("caching API", () => { it("should auto-permacache by default", () => { let count = 0; - const fn = makeStrongCache(arg => ({ arg, count: count++ })); + const fn = makeStrongCacheSync(arg => ({ arg, count: count++ })); expect(fn("one")).toEqual({ arg: "one", count: 0 }); expect(fn("one")).toBe(fn("one")); @@ -235,7 +237,7 @@ describe("caching API", () => { }); it("should throw if you set permacaching and use .using", () => { - const fn = makeStrongCache((arg, cache) => { + const fn = makeStrongCacheSync((arg, cache) => { cache.forever(); cache.using(() => null); @@ -245,7 +247,7 @@ describe("caching API", () => { }); it("should throw if you set permacaching and use .invalidate", () => { - const fn = makeStrongCache((arg, cache) => { + const fn = makeStrongCacheSync((arg, cache) => { cache.forever(); cache.invalidate(() => null); @@ -255,7 +257,7 @@ describe("caching API", () => { }); it("should throw if you set permacaching and use .never", () => { - const fn = makeStrongCache((arg, cache) => { + const fn = makeStrongCacheSync((arg, cache) => { cache.forever(); cache.never(); @@ -265,7 +267,7 @@ describe("caching API", () => { }); it("should throw if you set no caching and use .using", () => { - const fn = makeStrongCache((arg, cache) => { + const fn = makeStrongCacheSync((arg, cache) => { cache.never(); cache.using(() => null); @@ -275,7 +277,7 @@ describe("caching API", () => { }); it("should throw if you set no caching and use .invalidate", () => { - const fn = makeStrongCache((arg, cache) => { + const fn = makeStrongCacheSync((arg, cache) => { cache.never(); cache.invalidate(() => null); @@ -285,7 +287,7 @@ describe("caching API", () => { }); it("should throw if you set no caching and use .never", () => { - const fn = makeStrongCache((arg, cache) => { + const fn = makeStrongCacheSync((arg, cache) => { cache.never(); cache.using(() => null); @@ -295,7 +297,7 @@ describe("caching API", () => { }); it("should throw if you configure .forever after exiting", () => { - const fn = makeStrongCache((arg, cache) => cache); + const fn = makeStrongCacheSync((arg, cache) => cache); expect(() => fn().forever()).toThrow( /Cannot change caching after evaluation/, @@ -303,7 +305,7 @@ describe("caching API", () => { }); it("should throw if you configure .never after exiting", () => { - const fn = makeStrongCache((arg, cache) => cache); + const fn = makeStrongCacheSync((arg, cache) => cache); expect(() => fn().never()).toThrow( /Cannot change caching after evaluation/, @@ -311,7 +313,7 @@ describe("caching API", () => { }); it("should throw if you configure .using after exiting", () => { - const fn = makeStrongCache((arg, cache) => cache); + const fn = makeStrongCacheSync((arg, cache) => cache); expect(() => fn().using(() => null)).toThrow( /Cannot change caching after evaluation/, @@ -319,7 +321,7 @@ describe("caching API", () => { }); it("should throw if you configure .invalidate after exiting", () => { - const fn = makeStrongCache((arg, cache) => cache); + const fn = makeStrongCacheSync((arg, cache) => cache); expect(() => fn().invalidate(() => null)).toThrow( /Cannot change caching after evaluation/, @@ -330,7 +332,7 @@ describe("caching API", () => { it("should allow permacaching with cache(true)", () => { let count = 0; - const fn = makeStrongCache((arg, cache) => { + const fn = makeStrongCacheSync((arg, cache) => { cache = cache.simple(); cache(true); @@ -349,7 +351,7 @@ describe("caching API", () => { it("should allow disabling caching with cache(false)", () => { let count = 0; - const fn = makeStrongCache((arg, cache) => { + const fn = makeStrongCacheSync((arg, cache) => { cache = cache.simple(); cache(false); @@ -371,7 +373,7 @@ describe("caching API", () => { let count = 0; let other = "default"; - const fn = makeStrongCache((arg, cache) => { + const fn = makeStrongCacheSync((arg, cache) => { cache = cache.simple(); const val = cache(() => other); @@ -410,4 +412,60 @@ describe("caching API", () => { expect(fn("two")).toBe(fn("two")); }); }); + + describe("async", () => { + const wait = gensync({ + sync: () => {}, + errback: (t, cb) => setTimeout(cb, t), + }); + + it("should throw if the cache is configured asynchronously", async () => { + const fn = gensync( + makeStrongCache(function*(arg, cache) { + yield* wait(1000); + cache.never(); + return { arg }; + }), + ).async; + + await expect(fn("bar")).rejects.toThrowErrorMatchingInlineSnapshot( + `"Cannot change caching after evaluation has completed."`, + ); + }); + + it("should allow asynchronous cache invalidation functions", async () => { + const fn = gensync( + makeStrongCache(function*(arg, cache) { + yield* waitFor( + cache.using(async () => { + await wait.async(50); + return "x"; + }), + ); + return { arg }; + }), + ).async; + + const [res1, res2] = await Promise.all([fn("foo"), fn("foo")]); + + expect(res1).toBe(res2); + }); + + it("should allow synchronous yield before cache configuration", async () => { + const fn = gensync( + makeStrongCache(function*(arg, cache) { + yield* gensync({ + sync: () => 2, + errback: cb => cb(null, 2), + })(); + cache.forever(); + return { arg }; + }), + ).async; + + const [res1, res2] = await Promise.all([fn("foo"), fn("foo")]); + + expect(res1).toBe(res2); + }); + }); }); diff --git a/packages/babel-core/test/config-chain.js b/packages/babel-core/test/config-chain.js index c3c17e5fe639..e479fdff93e4 100644 --- a/packages/babel-core/test/config-chain.js +++ b/packages/babel-core/test/config-chain.js @@ -1,16 +1,72 @@ import fs from "fs"; +import os from "os"; import path from "path"; -import { loadOptions as loadOptionsOrig } from "../lib"; +import escapeRegExp from "lodash/escapeRegExp"; +import * as babel from "../lib"; + +// TODO: In Babel 8, we can directly uses fs.promises which is supported by +// node 8+ +const pfs = + fs.promises ?? + new Proxy(fs, { + get(target, name) { + if (name === "copyFile") { + // fs.copyFile is only supported since node 8.5 + // https://stackoverflow.com/a/30405105/2359289 + return function copyFile(source, target) { + const rd = fs.createReadStream(source); + const wr = fs.createWriteStream(target); + return new Promise(function(resolve, reject) { + rd.on("error", reject); + wr.on("error", reject); + wr.on("finish", resolve); + rd.pipe(wr); + }).catch(function(error) { + rd.destroy(); + wr.end(); + throw error; + }); + }; + } + + return (...args) => + new Promise((resolve, reject) => + target[name](...args, (error, result) => { + if (error) reject(error); + else resolve(result); + }), + ); + }, + }); function fixture(...args) { return path.join(__dirname, "fixtures", "config", ...args); } function loadOptions(opts) { - return loadOptionsOrig({ - cwd: __dirname, - ...opts, - }); + return babel.loadOptions({ cwd: __dirname, ...opts }); +} + +function loadOptionsAsync(opts) { + return babel.loadOptionsAsync({ cwd: __dirname, ...opts }); +} + +function pairs(items) { + const pairs = []; + for (let i = 0; i < items.length - 1; i++) { + for (let j = i + 1; j < items.length; j++) { + pairs.push([items[i], items[j]]); + } + } + return pairs; +} + +async function getTemp(name) { + const cwd = await pfs.mkdtemp(os.tmpdir() + path.sep + name); + const tmp = name => path.join(cwd, name); + const config = name => + pfs.copyFile(fixture("config-files-templates", name), tmp(name)); + return { cwd, tmp, config }; } describe("buildConfigChain", function() { @@ -33,7 +89,7 @@ describe("buildConfigChain", function() { cwd: fixture("nonexistant-fake"), filename: fixture("nonexistant-fake", "src.js"), babelrc: false, - test: new RegExp(fixture("nonexistant-fake")), + test: new RegExp(escapeRegExp(fixture("nonexistant-fake"))), comments: true, }); @@ -69,7 +125,7 @@ describe("buildConfigChain", function() { cwd: fixture("nonexistant-fake"), filename: fixture("nonexistant-fake", "src.js"), babelrc: false, - test: new RegExp(fixture("nonexistant-unknown")), + test: new RegExp(escapeRegExp(fixture("nonexistant-unknown"))), comments: true, }); @@ -107,7 +163,7 @@ describe("buildConfigChain", function() { cwd: fixture("nonexistant-fake"), filename: fixture("nonexistant-fake", "src.js"), babelrc: false, - test: [new RegExp(fixture("nonexistant-fake"))], + test: [new RegExp(escapeRegExp(fixture("nonexistant-fake")))], comments: true, }); @@ -143,7 +199,7 @@ describe("buildConfigChain", function() { cwd: fixture("nonexistant-fake"), filename: fixture("nonexistant-fake", "src.js"), babelrc: false, - test: [new RegExp(fixture("nonexistant-unknown"))], + test: [new RegExp(escapeRegExp(fixture("nonexistant-unknown")))], comments: true, }); @@ -183,7 +239,7 @@ describe("buildConfigChain", function() { cwd: fixture("nonexistant-fake"), filename: fixture("nonexistant-fake", "src.js"), babelrc: false, - include: new RegExp(fixture("nonexistant-fake")), + include: new RegExp(escapeRegExp(fixture("nonexistant-fake"))), comments: true, }); @@ -219,7 +275,7 @@ describe("buildConfigChain", function() { cwd: fixture("nonexistant-fake"), filename: fixture("nonexistant-fake", "src.js"), babelrc: false, - include: new RegExp(fixture("nonexistant-unknown")), + include: new RegExp(escapeRegExp(fixture("nonexistant-unknown"))), comments: true, }); @@ -257,7 +313,7 @@ describe("buildConfigChain", function() { cwd: fixture("nonexistant-fake"), filename: fixture("nonexistant-fake", "src.js"), babelrc: false, - include: [new RegExp(fixture("nonexistant-fake"))], + include: [new RegExp(escapeRegExp(fixture("nonexistant-fake")))], comments: true, }); @@ -293,7 +349,7 @@ describe("buildConfigChain", function() { cwd: fixture("nonexistant-fake"), filename: fixture("nonexistant-fake", "src.js"), babelrc: false, - include: [new RegExp(fixture("nonexistant-unknown"))], + include: [new RegExp(escapeRegExp(fixture("nonexistant-unknown")))], comments: true, }); @@ -333,7 +389,7 @@ describe("buildConfigChain", function() { cwd: fixture("nonexistant-fake"), filename: fixture("nonexistant-fake", "src.js"), babelrc: false, - exclude: new RegExp(fixture("nonexistant-fake")), + exclude: new RegExp(escapeRegExp(fixture("nonexistant-fake"))), comments: true, }); @@ -369,7 +425,7 @@ describe("buildConfigChain", function() { cwd: fixture("nonexistant-fake"), filename: fixture("nonexistant-fake", "src.js"), babelrc: false, - exclude: new RegExp(fixture("nonexistant-unknown")), + exclude: new RegExp(escapeRegExp(fixture("nonexistant-unknown"))), comments: true, }); @@ -407,7 +463,7 @@ describe("buildConfigChain", function() { cwd: fixture("nonexistant-fake"), filename: fixture("nonexistant-fake", "src.js"), babelrc: false, - exclude: [new RegExp(fixture("nonexistant-fake"))], + exclude: [new RegExp(escapeRegExp(fixture("nonexistant-fake")))], comments: true, }); @@ -443,7 +499,7 @@ describe("buildConfigChain", function() { cwd: fixture("nonexistant-fake"), filename: fixture("nonexistant-fake", "src.js"), babelrc: false, - exclude: [new RegExp(fixture("nonexistant-unknown"))], + exclude: [new RegExp(escapeRegExp(fixture("nonexistant-unknown")))], comments: true, }); @@ -944,111 +1000,250 @@ describe("buildConfigChain", function() { } }); - it("should load .babelrc", () => { - const filename = fixture("config-files", "babelrc", "src.js"); + describe("root", () => { + test.each(["babel.config.json", "babel.config.js", "babel.config.cjs"])( + "should load %s synchronously", + async name => { + const { cwd, tmp, config } = await getTemp( + `babel-test-load-config-sync-${name}`, + ); + const filename = tmp("src.js"); + + await config(name); + + expect(loadOptions({ filename, cwd })).toEqual({ + ...getDefaults(), + filename, + cwd, + root: cwd, + comments: true, + }); + }, + ); + + test("should not load babel.config.mjs synchronously", async () => { + const { cwd, tmp, config } = await getTemp( + "babel-test-load-config-sync-babel.config.mjs", + ); + const filename = tmp("src.js"); - expect( - loadOptions({ + await config("babel.config.mjs"); + + expect(() => loadOptions({ filename, cwd })).toThrow( + /is only supported when running Babel asynchronously/, + ); + }); + + test.each([ + "babel.config.json", + "babel.config.js", + "babel.config.cjs", + "babel.config.mjs", + ])("should load %s asynchronously", async name => { + const { cwd, tmp, config } = await getTemp( + `babel-test-load-config-async-${name}`, + ); + const filename = tmp("src.js"); + + // We can't transpile import() while publishing, and it isn't supported + // by jest. + if (process.env.IS_PUBLISH && name === "babel.config.mjs") return; + + await config(name); + + expect(await loadOptionsAsync({ filename, cwd })).toEqual({ + ...getDefaults(), filename, - cwd: path.dirname(filename), - }), - ).toEqual({ - ...getDefaults(), - filename: filename, - cwd: path.dirname(filename), - root: path.dirname(filename), - comments: true, + cwd, + root: cwd, + comments: true, + }); }); - }); - it("should load .babelrc.js", () => { - const filename = fixture("config-files", "babelrc-js", "src.js"); + test.each( + pairs([ + "babel.config.json", + "babel.config.js", + "babel.config.cjs", + "babel.config.mjs", + ]), + )("should throw if both %s and %s are used", async (name1, name2) => { + const { cwd, tmp, config } = await getTemp( + `babel-test-dup-config-${name1}-${name2}`, + ); + + // We can't transpile import() while publishing, and it isn't supported + // by jest. + if ( + process.env.IS_PUBLISH && + (name1 === "babel.config.mjs" || name2 === "babel.config.mjs") + ) { + return; + } - expect(loadOptions({ filename, cwd: path.dirname(filename) })).toEqual({ - ...getDefaults(), - filename: filename, - cwd: path.dirname(filename), - root: path.dirname(filename), - comments: true, + await Promise.all([config(name1), config(name2)]); + + await expect( + loadOptionsAsync({ filename: tmp("src.js"), cwd }), + ).rejects.toThrow(/Multiple configuration files found/); }); }); - it("should load package.json#babel", () => { - const filename = fixture("config-files", "pkg", "src.js"); + describe("relative", () => { + test.each([ + "package.json", + ".babelrc", + ".babelrc.js", + ".babelrc.cjs", + ".babelrc.json", + ])("should load %s synchronously", async name => { + const { cwd, tmp, config } = await getTemp( + `babel-test-load-config-${name}`, + ); + const filename = tmp("src.js"); - expect(loadOptions({ filename, cwd: path.dirname(filename) })).toEqual({ - ...getDefaults(), - filename: filename, - cwd: path.dirname(filename), - root: path.dirname(filename), - comments: true, + await config(name); + + expect(loadOptions({ filename, cwd })).toEqual({ + ...getDefaults(), + filename, + cwd, + root: cwd, + comments: true, + }); }); - }); - it("should load .babelignore", () => { - const filename = fixture("config-files", "babelignore", "src.js"); + test("should not load .babelrc.mjs synchronously", async () => { + const { cwd, tmp, config } = await getTemp( + "babel-test-load-config-sync-.babelrc.mjs", + ); + const filename = tmp("src.js"); - expect(loadOptions({ filename, cwd: path.dirname(filename) })).toBeNull(); - }); + await config(".babelrc.mjs"); - it("should throw if there are both .babelrc and .babelrc.js", () => { - const filename = fixture("config-files", "both-babelrc", "src.js"); + expect(() => loadOptions({ filename, cwd })).toThrow( + /is only supported when running Babel asynchronously/, + ); + }); - expect(() => - loadOptions({ filename, cwd: path.dirname(filename) }), - ).toThrow(/Multiple configuration files found/); - }); + test.each([ + "package.json", + ".babelrc", + ".babelrc.js", + ".babelrc.cjs", + ".babelrc.mjs", + ])("should load %s asynchronously", async name => { + const { cwd, tmp, config } = await getTemp( + `babel-test-load-config-${name}`, + ); + const filename = tmp("src.js"); - it("should throw if there are both .babelrc and package.json", () => { - const filename = fixture("config-files", "pkg-babelrc", "src.js"); + // We can't transpile import() while publishing, and it isn't supported + // by jest. + if (process.env.IS_PUBLISH && name === ".babelrc.mjs") return; - expect(() => - loadOptions({ filename, cwd: path.dirname(filename) }), - ).toThrow(/Multiple configuration files found/); - }); + await config(name); - it("should throw if there are both .babelrc.js and package.json", () => { - const filename = fixture("config-files", "pkg-babelrc-js", "src.js"); + expect(await loadOptionsAsync({ filename, cwd })).toEqual({ + ...getDefaults(), + filename, + cwd, + root: cwd, + comments: true, + }); + }); - expect(() => - loadOptions({ filename, cwd: path.dirname(filename) }), - ).toThrow(/Multiple configuration files found/); - }); + it("should load .babelignore", () => { + const filename = fixture("config-files", "babelignore", "src.js"); - it("should ignore package.json without a 'babel' property", () => { - const filename = fixture("config-files", "pkg-ignored", "src.js"); + expect( + loadOptions({ filename, cwd: path.dirname(filename) }), + ).toBeNull(); + }); - expect(loadOptions({ filename, cwd: path.dirname(filename) })).toEqual({ - ...getDefaults(), - filename: filename, - cwd: path.dirname(filename), - root: path.dirname(filename), - comments: true, + test.each( + pairs([ + "package.json", + ".babelrc", + ".babelrc.js", + ".babelrc.cjs", + ".babelrc.mjs", + ".babelrc.json", + ]), + )("should throw if both %s and %s are used", async (name1, name2) => { + const { cwd, tmp, config } = await getTemp( + `babel-test-dup-config-${name1}-${name2}`, + ); + + // We can't transpile import() while publishing, and it isn't supported + // by jest. + if ( + process.env.IS_PUBLISH && + (name1 === ".babelrc.mjs" || name2 === ".babelrc.mjs") + ) { + return; + } + + await Promise.all([config(name1), config(name2)]); + + await expect( + loadOptionsAsync({ filename: tmp("src.js"), cwd }), + ).rejects.toThrow(/Multiple configuration files found/); }); - }); - it("should show helpful errors for .babelrc", () => { - const filename = fixture("config-files", "babelrc-error", "src.js"); + it("should ignore package.json without a 'babel' property", () => { + const filename = fixture("config-files", "pkg-ignored", "src.js"); - expect(() => - loadOptions({ filename, cwd: path.dirname(filename) }), - ).toThrow(/Error while parsing config - /); - }); + expect(loadOptions({ filename, cwd: path.dirname(filename) })).toEqual({ + ...getDefaults(), + filename: filename, + cwd: path.dirname(filename), + root: path.dirname(filename), + comments: true, + }); + }); - it("should show helpful errors for .babelrc.js", () => { - const filename = fixture("config-files", "babelrc-js-error", "src.js"); + test.each` + config | dir | error + ${".babelrc"} | ${"babelrc-error"} | ${/Error while parsing config - /} + ${".babelrc.json"} | ${"babelrc-json-error"} | ${/Error while parsing config - /} + ${".babelrc.js"} | ${"babelrc-js-error"} | ${/Babelrc threw an error/} + ${".babelrc.cjs"} | ${"babelrc-cjs-error"} | ${/Babelrc threw an error/} + ${".babelrc.mjs"} | ${"babelrc-mjs-error"} | ${/Babelrc threw an error/} + ${"package.json"} | ${"pkg-error"} | ${/Error while parsing JSON - /} + `("should show helpful errors for $config", async ({ dir, error }) => { + const filename = fixture("config-files", dir, "src.js"); - expect(() => - loadOptions({ filename, cwd: path.dirname(filename) }), - ).toThrow(/Babelrc threw an error/); + // We can't transpile import() while publishing, and it isn't supported + // by jest. + if (process.env.IS_PUBLISH && dir === "babelrc-mjs-error") return; + + await expect( + loadOptionsAsync({ filename, cwd: path.dirname(filename) }), + ).rejects.toThrow(error); + }); }); - it("should show helpful errors for package.json", () => { - const filename = fixture("config-files", "pkg-error", "src.js"); + it("should throw when `test` presents but `filename` is not passed", () => { + expect(() => loadOptions({ test: /\.ts$/, plugins: [] })).toThrow( + /Configuration contains string\/RegExp pattern/, + ); + }); - expect(() => - loadOptions({ filename, cwd: path.dirname(filename) }), - ).toThrow(/Error while parsing JSON - /); + it("should throw when `preset` requires `filename` but it was not passed", () => { + expect(() => { + loadOptions({ + presets: [require("./fixtures/config-loading/preset4")], + }); + }).toThrow(/Preset \/\* your preset \*\/ requires a filename/); + }); + + it("should throw when `preset.overrides` requires `filename` but it was not passed", () => { + expect(() => { + loadOptions({ + presets: [require("./fixtures/config-loading/preset5")], + }); + }).toThrow(/Preset \/\* your preset \*\/ requires a filename/); }); }); }); diff --git a/packages/babel-core/test/config-loading.js b/packages/babel-core/test/config-loading.js index b31eac8ed2d9..4f61315404e4 100644 --- a/packages/babel-core/test/config-loading.js +++ b/packages/babel-core/test/config-loading.js @@ -1,6 +1,8 @@ -import loadConfig, { loadPartialConfig } from "../lib/config"; +import loadConfigRunner, { loadPartialConfig } from "../lib/config"; import path from "path"; +const loadConfig = loadConfigRunner.sync; + describe("@babel/core config loading", () => { const FILEPATH = path.join( __dirname, @@ -322,6 +324,21 @@ describe("@babel/core config loading", () => { } } }); + + it("should thrown when plugin is not valid", () => { + const fooPlugin = { + inherits: "inhertis-should-not-be-string", + }; + const opts = { + cwd: path.dirname(FILEPATH), + filename: FILEPATH, + plugins: [fooPlugin], + }; + + expect(() => loadConfig(opts)).toThrow( + /\.inherits must be a function, or undefined/, + ); + }); }); describe("caller metadata", () => { diff --git a/packages/babel-core/test/fixtures/api/parsing-errors/only-syntax/file.js b/packages/babel-core/test/fixtures/api/parsing-errors/only-syntax/file.js index 55194f0636b3..c6c1a3ba7cd2 100644 --- a/packages/babel-core/test/fixtures/api/parsing-errors/only-syntax/file.js +++ b/packages/babel-core/test/fixtures/api/parsing-errors/only-syntax/file.js @@ -1 +1 @@ -var $ = import("jquery"); \ No newline at end of file +a |> b \ No newline at end of file diff --git a/packages/babel-core/test/fixtures/async/config-cache/babel.config.js b/packages/babel-core/test/fixtures/async/config-cache/babel.config.js new file mode 100644 index 000000000000..f17724435869 --- /dev/null +++ b/packages/babel-core/test/fixtures/async/config-cache/babel.config.js @@ -0,0 +1,12 @@ +const wait = t => new Promise(r => setTimeout(r, t)); + +module.exports = function(api) { + api.cache.using(async () => { + await wait(50); + return 2; + }) + + return { + plugins: ["./plugin"], + }; +}; diff --git a/packages/babel-core/test/fixtures/async/config-cache/plugin.js b/packages/babel-core/test/fixtures/async/config-cache/plugin.js new file mode 100644 index 000000000000..f3164a2364f9 --- /dev/null +++ b/packages/babel-core/test/fixtures/async/config-cache/plugin.js @@ -0,0 +1,9 @@ +module.exports = function plugin({ types: t }) { + return { + visitor: { + Program(path) { + path.pushContainer("body", t.stringLiteral("success")); + }, + }, + }; +}; diff --git a/packages/babel-core/test/fixtures/async/config-file-async-function/babel.config.js b/packages/babel-core/test/fixtures/async/config-file-async-function/babel.config.js new file mode 100644 index 000000000000..14e85e8e700f --- /dev/null +++ b/packages/babel-core/test/fixtures/async/config-file-async-function/babel.config.js @@ -0,0 +1,11 @@ +const wait = t => new Promise(r => setTimeout(r, t)); + +module.exports = async function(api) { + await wait(50); + + api.cache.never(); + + return { + plugins: ["./plugin"], + }; +}; diff --git a/packages/babel-core/test/fixtures/async/config-file-async-function/plugin.js b/packages/babel-core/test/fixtures/async/config-file-async-function/plugin.js new file mode 100644 index 000000000000..f3164a2364f9 --- /dev/null +++ b/packages/babel-core/test/fixtures/async/config-file-async-function/plugin.js @@ -0,0 +1,9 @@ +module.exports = function plugin({ types: t }) { + return { + visitor: { + Program(path) { + path.pushContainer("body", t.stringLiteral("success")); + }, + }, + }; +}; diff --git a/packages/babel-core/test/fixtures/async/config-file-promise/babel.config.js b/packages/babel-core/test/fixtures/async/config-file-promise/babel.config.js new file mode 100644 index 000000000000..dffa9f6fdbe1 --- /dev/null +++ b/packages/babel-core/test/fixtures/async/config-file-promise/babel.config.js @@ -0,0 +1,5 @@ +const wait = t => new Promise(r => setTimeout(r, t)); + +module.exports = wait(50).then(() => ({ + plugins: ["./plugin"], +})); diff --git a/packages/babel-core/test/fixtures/async/config-file-promise/plugin.js b/packages/babel-core/test/fixtures/async/config-file-promise/plugin.js new file mode 100644 index 000000000000..f3164a2364f9 --- /dev/null +++ b/packages/babel-core/test/fixtures/async/config-file-promise/plugin.js @@ -0,0 +1,9 @@ +module.exports = function plugin({ types: t }) { + return { + visitor: { + Program(path) { + path.pushContainer("body", t.stringLiteral("success")); + }, + }, + }; +}; diff --git a/packages/babel-core/test/fixtures/async/plugin-inherits/babel.config.js b/packages/babel-core/test/fixtures/async/plugin-inherits/babel.config.js new file mode 100644 index 000000000000..8b5df0db23c0 --- /dev/null +++ b/packages/babel-core/test/fixtures/async/plugin-inherits/babel.config.js @@ -0,0 +1,3 @@ +module.exports = { + plugins: ["./plugin"], +}; diff --git a/packages/babel-core/test/fixtures/async/plugin-inherits/plugin.js b/packages/babel-core/test/fixtures/async/plugin-inherits/plugin.js new file mode 100644 index 000000000000..6f7f0b197f46 --- /dev/null +++ b/packages/babel-core/test/fixtures/async/plugin-inherits/plugin.js @@ -0,0 +1,10 @@ +module.exports = function plugin({ types: t }) { + return { + inherits: require("./plugin2"), + visitor: { + Program(path) { + path.pushContainer("body", t.stringLiteral("success")); + }, + }, + }; +}; diff --git a/packages/babel-core/test/fixtures/async/plugin-inherits/plugin2.js b/packages/babel-core/test/fixtures/async/plugin-inherits/plugin2.js new file mode 100644 index 000000000000..f881463f9814 --- /dev/null +++ b/packages/babel-core/test/fixtures/async/plugin-inherits/plugin2.js @@ -0,0 +1,13 @@ +const wait = t => new Promise(r => setTimeout(r, t)); + +module.exports = async function plugin({ types: t }) { + await wait(50); + + return { + visitor: { + Program(path) { + path.pushContainer("body", t.stringLiteral("success 2")); + }, + }, + }; +}; diff --git a/packages/babel-core/test/fixtures/async/plugin-post/babel.config.js b/packages/babel-core/test/fixtures/async/plugin-post/babel.config.js new file mode 100644 index 000000000000..8b5df0db23c0 --- /dev/null +++ b/packages/babel-core/test/fixtures/async/plugin-post/babel.config.js @@ -0,0 +1,3 @@ +module.exports = { + plugins: ["./plugin"], +}; diff --git a/packages/babel-core/test/fixtures/async/plugin-post/plugin.js b/packages/babel-core/test/fixtures/async/plugin-post/plugin.js new file mode 100644 index 000000000000..8ceebfd644d4 --- /dev/null +++ b/packages/babel-core/test/fixtures/async/plugin-post/plugin.js @@ -0,0 +1,15 @@ +const wait = t => new Promise(r => setTimeout(r, t)); + +module.exports = function plugin({ types: t }) { + return { + async post() { + await wait(50); + }, + + visitor: { + Program(path) { + path.pushContainer("body", t.stringLiteral("success")); + }, + }, + }; +}; diff --git a/packages/babel-core/test/fixtures/async/plugin-pre/babel.config.js b/packages/babel-core/test/fixtures/async/plugin-pre/babel.config.js new file mode 100644 index 000000000000..8b5df0db23c0 --- /dev/null +++ b/packages/babel-core/test/fixtures/async/plugin-pre/babel.config.js @@ -0,0 +1,3 @@ +module.exports = { + plugins: ["./plugin"], +}; diff --git a/packages/babel-core/test/fixtures/async/plugin-pre/plugin.js b/packages/babel-core/test/fixtures/async/plugin-pre/plugin.js new file mode 100644 index 000000000000..d354a0a60fb7 --- /dev/null +++ b/packages/babel-core/test/fixtures/async/plugin-pre/plugin.js @@ -0,0 +1,15 @@ +const wait = t => new Promise(r => setTimeout(r, t)); + +module.exports = function plugin({ types: t }) { + return { + async pre() { + await wait(50); + }, + + visitor: { + Program(path) { + path.pushContainer("body", t.stringLiteral("success")); + }, + }, + }; +}; diff --git a/packages/babel-core/test/fixtures/async/plugin/babel.config.js b/packages/babel-core/test/fixtures/async/plugin/babel.config.js new file mode 100644 index 000000000000..8b5df0db23c0 --- /dev/null +++ b/packages/babel-core/test/fixtures/async/plugin/babel.config.js @@ -0,0 +1,3 @@ +module.exports = { + plugins: ["./plugin"], +}; diff --git a/packages/babel-core/test/fixtures/async/plugin/plugin.js b/packages/babel-core/test/fixtures/async/plugin/plugin.js new file mode 100644 index 000000000000..9777dd80ae42 --- /dev/null +++ b/packages/babel-core/test/fixtures/async/plugin/plugin.js @@ -0,0 +1,13 @@ +const wait = t => new Promise(r => setTimeout(r, t)); + +module.exports = async function plugin({ types: t }) { + await wait(50); + + return { + visitor: { + Program(path) { + path.pushContainer("body", t.stringLiteral("success")); + }, + }, + }; +}; diff --git a/packages/babel-core/test/fixtures/config-loading/preset4.js b/packages/babel-core/test/fixtures/config-loading/preset4.js new file mode 100644 index 000000000000..1698ff05edd1 --- /dev/null +++ b/packages/babel-core/test/fixtures/config-loading/preset4.js @@ -0,0 +1,6 @@ +module.exports = function() { + return { + test: /\.ts$/, + plugins: [] + } +}; diff --git a/packages/babel-core/test/fixtures/config-loading/preset5.js b/packages/babel-core/test/fixtures/config-loading/preset5.js new file mode 100644 index 000000000000..65ecb47f93c8 --- /dev/null +++ b/packages/babel-core/test/fixtures/config-loading/preset5.js @@ -0,0 +1,8 @@ +module.exports = function() { + return { + overrides: [{ + test: /\.ts$/, + plugins: [] + }] + } +}; diff --git a/packages/babel-core/test/fixtures/config/config-files-templates/.babelrc b/packages/babel-core/test/fixtures/config/config-files-templates/.babelrc new file mode 100644 index 000000000000..b445e5d66381 --- /dev/null +++ b/packages/babel-core/test/fixtures/config/config-files-templates/.babelrc @@ -0,0 +1,3 @@ +{ + "comments": true +} diff --git a/packages/babel-core/test/fixtures/config/config-files-templates/.babelrc.cjs b/packages/babel-core/test/fixtures/config/config-files-templates/.babelrc.cjs new file mode 100644 index 000000000000..409f4a98ac90 --- /dev/null +++ b/packages/babel-core/test/fixtures/config/config-files-templates/.babelrc.cjs @@ -0,0 +1,3 @@ +module.exports = { + comments: true +}; diff --git a/packages/babel-core/test/fixtures/config/config-files-templates/.babelrc.js b/packages/babel-core/test/fixtures/config/config-files-templates/.babelrc.js new file mode 100644 index 000000000000..409f4a98ac90 --- /dev/null +++ b/packages/babel-core/test/fixtures/config/config-files-templates/.babelrc.js @@ -0,0 +1,3 @@ +module.exports = { + comments: true +}; diff --git a/packages/babel-core/test/fixtures/config/config-files-templates/.babelrc.json b/packages/babel-core/test/fixtures/config/config-files-templates/.babelrc.json new file mode 100644 index 000000000000..b445e5d66381 --- /dev/null +++ b/packages/babel-core/test/fixtures/config/config-files-templates/.babelrc.json @@ -0,0 +1,3 @@ +{ + "comments": true +} diff --git a/packages/babel-core/test/fixtures/config/config-files-templates/.babelrc.mjs b/packages/babel-core/test/fixtures/config/config-files-templates/.babelrc.mjs new file mode 100644 index 000000000000..7fc8bbfea752 --- /dev/null +++ b/packages/babel-core/test/fixtures/config/config-files-templates/.babelrc.mjs @@ -0,0 +1,8 @@ +// Until Jest supports native mjs, we must simulate it 🤷 + +module.exports = new Promise(resolve => resolve({ + default: { + comments: true + } +})); +module.exports.__esModule = true; diff --git a/packages/babel-core/test/fixtures/config/config-files-templates/babel.config.cjs b/packages/babel-core/test/fixtures/config/config-files-templates/babel.config.cjs new file mode 100644 index 000000000000..409f4a98ac90 --- /dev/null +++ b/packages/babel-core/test/fixtures/config/config-files-templates/babel.config.cjs @@ -0,0 +1,3 @@ +module.exports = { + comments: true +}; diff --git a/packages/babel-core/test/fixtures/config/config-files-templates/babel.config.js b/packages/babel-core/test/fixtures/config/config-files-templates/babel.config.js new file mode 100644 index 000000000000..409f4a98ac90 --- /dev/null +++ b/packages/babel-core/test/fixtures/config/config-files-templates/babel.config.js @@ -0,0 +1,3 @@ +module.exports = { + comments: true +}; diff --git a/packages/babel-core/test/fixtures/config/config-files-templates/babel.config.json b/packages/babel-core/test/fixtures/config/config-files-templates/babel.config.json new file mode 100644 index 000000000000..4b7be6033f68 --- /dev/null +++ b/packages/babel-core/test/fixtures/config/config-files-templates/babel.config.json @@ -0,0 +1,3 @@ +{ + "comments": true +} \ No newline at end of file diff --git a/packages/babel-core/test/fixtures/config/config-files-templates/babel.config.mjs b/packages/babel-core/test/fixtures/config/config-files-templates/babel.config.mjs new file mode 100644 index 000000000000..7fc8bbfea752 --- /dev/null +++ b/packages/babel-core/test/fixtures/config/config-files-templates/babel.config.mjs @@ -0,0 +1,8 @@ +// Until Jest supports native mjs, we must simulate it 🤷 + +module.exports = new Promise(resolve => resolve({ + default: { + comments: true + } +})); +module.exports.__esModule = true; diff --git a/packages/babel-core/test/fixtures/config/config-files/pkg/package.json b/packages/babel-core/test/fixtures/config/config-files-templates/package.json similarity index 100% rename from packages/babel-core/test/fixtures/config/config-files/pkg/package.json rename to packages/babel-core/test/fixtures/config/config-files-templates/package.json diff --git a/packages/babel-core/test/fixtures/config/config-files/babelrc-cjs-error/.babelrc.cjs b/packages/babel-core/test/fixtures/config/config-files/babelrc-cjs-error/.babelrc.cjs new file mode 100644 index 000000000000..accbe7c461f1 --- /dev/null +++ b/packages/babel-core/test/fixtures/config/config-files/babelrc-cjs-error/.babelrc.cjs @@ -0,0 +1,3 @@ +module.exports = function() { + throw new Error("Babelrc threw an error"); +}; diff --git a/packages/babel-core/test/fixtures/config/config-files/babelrc-js/.babelrc.js b/packages/babel-core/test/fixtures/config/config-files/babelrc-js/.babelrc.js deleted file mode 100644 index 37622f0ad309..000000000000 --- a/packages/babel-core/test/fixtures/config/config-files/babelrc-js/.babelrc.js +++ /dev/null @@ -1,3 +0,0 @@ -module.exports = { - comments: true, -}; diff --git a/packages/babel-core/test/fixtures/config/config-files/babelrc-json-error/.babelrc b/packages/babel-core/test/fixtures/config/config-files/babelrc-json-error/.babelrc new file mode 100644 index 000000000000..1d936d04a4e4 --- /dev/null +++ b/packages/babel-core/test/fixtures/config/config-files/babelrc-json-error/.babelrc @@ -0,0 +1 @@ +{45 diff --git a/packages/babel-core/test/fixtures/config/config-files/babelrc-mjs-error/.babelrc.mjs b/packages/babel-core/test/fixtures/config/config-files/babelrc-mjs-error/.babelrc.mjs new file mode 100644 index 000000000000..5a4fdd06a352 --- /dev/null +++ b/packages/babel-core/test/fixtures/config/config-files/babelrc-mjs-error/.babelrc.mjs @@ -0,0 +1,8 @@ +// Until Jest supports native mjs, we must simulate it 🤷 + +module.exports = new Promise(resolve => resolve({ + default: function () { + throw new Error("Babelrc threw an error"); + } +})); +module.exports.__esModule = true; diff --git a/packages/babel-core/test/fixtures/config/config-files/babelrc/.babelrc b/packages/babel-core/test/fixtures/config/config-files/babelrc/.babelrc deleted file mode 100644 index 2f6b10872c8d..000000000000 --- a/packages/babel-core/test/fixtures/config/config-files/babelrc/.babelrc +++ /dev/null @@ -1,3 +0,0 @@ -{ - comments: true, -} diff --git a/packages/babel-core/test/fixtures/config/config-files/both-babelrc/.babelrc b/packages/babel-core/test/fixtures/config/config-files/both-babelrc/.babelrc deleted file mode 100644 index 0967ef424bce..000000000000 --- a/packages/babel-core/test/fixtures/config/config-files/both-babelrc/.babelrc +++ /dev/null @@ -1 +0,0 @@ -{} diff --git a/packages/babel-core/test/fixtures/config/config-files/both-babelrc/.babelrc.js b/packages/babel-core/test/fixtures/config/config-files/both-babelrc/.babelrc.js deleted file mode 100644 index f053ebf7976e..000000000000 --- a/packages/babel-core/test/fixtures/config/config-files/both-babelrc/.babelrc.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = {}; diff --git a/packages/babel-core/test/fixtures/config/config-files/pkg-babelrc-js/.babelrc.js b/packages/babel-core/test/fixtures/config/config-files/pkg-babelrc-js/.babelrc.js deleted file mode 100644 index f053ebf7976e..000000000000 --- a/packages/babel-core/test/fixtures/config/config-files/pkg-babelrc-js/.babelrc.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = {}; diff --git a/packages/babel-core/test/fixtures/config/config-files/pkg-babelrc-js/package.json b/packages/babel-core/test/fixtures/config/config-files/pkg-babelrc-js/package.json deleted file mode 100644 index e25be3ecd260..000000000000 --- a/packages/babel-core/test/fixtures/config/config-files/pkg-babelrc-js/package.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "babel": {} -} diff --git a/packages/babel-core/test/fixtures/config/config-files/pkg-babelrc/.babelrc b/packages/babel-core/test/fixtures/config/config-files/pkg-babelrc/.babelrc deleted file mode 100644 index 0967ef424bce..000000000000 --- a/packages/babel-core/test/fixtures/config/config-files/pkg-babelrc/.babelrc +++ /dev/null @@ -1 +0,0 @@ -{} diff --git a/packages/babel-core/test/fixtures/config/config-files/pkg-babelrc/package.json b/packages/babel-core/test/fixtures/config/config-files/pkg-babelrc/package.json deleted file mode 100644 index e25be3ecd260..000000000000 --- a/packages/babel-core/test/fixtures/config/config-files/pkg-babelrc/package.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "babel": {} -} diff --git a/packages/babel-core/test/fixtures/option-manager/babel-plugin-foo/index.js b/packages/babel-core/test/fixtures/option-manager/babel-plugin-foo/index.js new file mode 100644 index 000000000000..17f95feabdaa --- /dev/null +++ b/packages/babel-core/test/fixtures/option-manager/babel-plugin-foo/index.js @@ -0,0 +1 @@ +module.exports = () => ({}); diff --git a/packages/babel-core/test/fixtures/option-manager/babel-preset-bar/index.js b/packages/babel-core/test/fixtures/option-manager/babel-preset-bar/index.js new file mode 100644 index 000000000000..17f95feabdaa --- /dev/null +++ b/packages/babel-core/test/fixtures/option-manager/babel-preset-bar/index.js @@ -0,0 +1 @@ +module.exports = () => ({}); diff --git a/packages/babel-core/test/fixtures/parse/output.json b/packages/babel-core/test/fixtures/parse/output.json index 06fb684869dc..5c48f0e09836 100644 --- a/packages/babel-core/test/fixtures/parse/output.json +++ b/packages/babel-core/test/fixtures/parse/output.json @@ -2,6 +2,7 @@ "type": "File", "start": 0, "end": 91, + "errors": [], "loc": { "start": { "line": 1, diff --git a/packages/babel-core/test/fixtures/plugins/build-code-frame-error/exec.js b/packages/babel-core/test/fixtures/plugins/build-code-frame-error/exec.js index 3462e87a1932..0b56fb9bfb43 100644 --- a/packages/babel-core/test/fixtures/plugins/build-code-frame-error/exec.js +++ b/packages/babel-core/test/fixtures/plugins/build-code-frame-error/exec.js @@ -1,16 +1,18 @@ -var code = "function f() {}"; -transform(code, { - plugins: [ - function() { - return { - visitor: { - FunctionDeclaration: function(path) { - throw path.buildCodeFrameError("someMsg"); +expect(() => { + var code = "function f() {}"; + transform(code, { + plugins: [ + function() { + return { + visitor: { + FunctionDeclaration: function(path) { + throw path.buildCodeFrameError("someMsg"); + }, }, - }, - }; - }, - ], - // hard to assert on ANSI escape codes - highlightCode: false, -}); + }; + }, + ], + // hard to assert on ANSI escape codes + highlightCode: false, + }); +}).toThrow(/^unknown: someMsg\s+> 1 \| function f\(\) {}/); diff --git a/packages/babel-core/test/fixtures/plugins/build-code-frame-error/options.json b/packages/babel-core/test/fixtures/plugins/build-code-frame-error/options.json deleted file mode 100644 index b24f27d786a8..000000000000 --- a/packages/babel-core/test/fixtures/plugins/build-code-frame-error/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "undefined: someMsg\n> 1 | function f() {}" -} diff --git a/packages/babel-core/test/fixtures/plugins/transform-error/exec.js b/packages/babel-core/test/fixtures/plugins/transform-error/exec.js new file mode 100644 index 000000000000..a5d11f514dea --- /dev/null +++ b/packages/babel-core/test/fixtures/plugins/transform-error/exec.js @@ -0,0 +1,15 @@ +var code = "function f() {}"; +transform(code, { + plugins: [ + function() { + return { + visitor: { + FunctionDeclaration: function(path) { + throw new Error("someMsg"); + }, + }, + }; + }, + ], + filename: "/fake/path/example.js" +}); diff --git a/packages/babel-core/test/fixtures/plugins/transform-error/options.json b/packages/babel-core/test/fixtures/plugins/transform-error/options.json new file mode 100644 index 000000000000..056950478dcf --- /dev/null +++ b/packages/babel-core/test/fixtures/plugins/transform-error/options.json @@ -0,0 +1,4 @@ +{ + "throws": "/fake/path/example.js: someMsg", + "os": ["linux", "darwin"] +} diff --git a/packages/babel-core/test/fixtures/transformation/misc/regression-1155/options.json b/packages/babel-core/test/fixtures/transformation/misc/regression-1155/options.json index cf0501f1cfba..d650f3fb41ba 100644 --- a/packages/babel-core/test/fixtures/transformation/misc/regression-1155/options.json +++ b/packages/babel-core/test/fixtures/transformation/misc/regression-1155/options.json @@ -1,7 +1,7 @@ { "plugins": [ "transform-classes", - "external-helpers", + ["external-helpers", { "helperVersion": "7.100.0" }], "transform-block-scoping" ] } diff --git a/packages/babel-core/test/fixtures/transformation/misc/regression-1155/output.js b/packages/babel-core/test/fixtures/transformation/misc/regression-1155/output.js index 78220af85dbe..7e4ac18f7b30 100644 --- a/packages/babel-core/test/fixtures/transformation/misc/regression-1155/output.js +++ b/packages/babel-core/test/fixtures/transformation/misc/regression-1155/output.js @@ -1,10 +1,10 @@ -var Foo = -/*#__PURE__*/ -function (_Bar) { +var Foo = /*#__PURE__*/function (_Bar) { "use strict"; babelHelpers.inherits(Foo, _Bar); + var _super = babelHelpers.createSuper(Foo); + function Foo(options) { babelHelpers.classCallCheck(this, Foo); var parentOptions = {}; @@ -13,7 +13,7 @@ function (_Bar) { this; }; - return babelHelpers.possibleConstructorReturn(this, babelHelpers.getPrototypeOf(Foo).call(this, parentOptions)); + return _super.call(this, parentOptions); } return Foo; diff --git a/packages/babel-core/test/fixtures/transformation/misc/regression-2765/output.js b/packages/babel-core/test/fixtures/transformation/misc/regression-2765/output.js index dc0b722317b6..8bcda9018e61 100644 --- a/packages/babel-core/test/fixtures/transformation/misc/regression-2765/output.js +++ b/packages/babel-core/test/fixtures/transformation/misc/regression-2765/output.js @@ -1,9 +1,7 @@ function f() { var _this = this; - let g = - /*#__PURE__*/ - function () { + let g = /*#__PURE__*/function () { var _ref = babelHelpers.asyncToGenerator(function* () { _this; }); @@ -19,9 +17,7 @@ class Class { var _this2 = this; return babelHelpers.asyncToGenerator(function* () { - var c = - /*#__PURE__*/ - function () { + var c = /*#__PURE__*/function () { var _ref2 = babelHelpers.asyncToGenerator(function* (b) { _this2; }); diff --git a/packages/babel-core/test/fixtures/transformation/misc/regression-2892/output.js b/packages/babel-core/test/fixtures/transformation/misc/regression-2892/output.js index ec30a24e9b09..b440ec1ed540 100644 --- a/packages/babel-core/test/fixtures/transformation/misc/regression-2892/output.js +++ b/packages/babel-core/test/fixtures/transformation/misc/regression-2892/output.js @@ -15,9 +15,7 @@ function _defineProperties(target, props) { for (var i = 0; i < props.length; i+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } -var Foo = -/*#__PURE__*/ -function () { +var Foo = /*#__PURE__*/function () { function Foo() { _classCallCheck(this, Foo); } @@ -25,9 +23,7 @@ function () { _createClass(Foo, [{ key: "bar", value: function () { - var _bar = _asyncToGenerator( - /*#__PURE__*/ - regeneratorRuntime.mark(function _callee() { + var _bar = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() { var baz; return regeneratorRuntime.wrap(function _callee$(_context) { while (1) { @@ -61,19 +57,15 @@ function foo() { } function _foo() { - _foo = _asyncToGenerator( - /*#__PURE__*/ - regeneratorRuntime.mark(function _callee3() { + _foo = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee3() { var bar, _bar2; return regeneratorRuntime.wrap(function _callee3$(_context3) { while (1) { switch (_context3.prev = _context3.next) { case 0: - _bar2 = function _ref2() { - _bar2 = _asyncToGenerator( - /*#__PURE__*/ - regeneratorRuntime.mark(function _callee2() { + _bar2 = function _bar4() { + _bar2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2() { var baz; return regeneratorRuntime.wrap(function _callee2$(_context2) { while (1) { @@ -91,7 +83,7 @@ function _foo() { return _bar2.apply(this, arguments); }; - bar = function _ref() { + bar = function _bar3() { return _bar2.apply(this, arguments); }; diff --git a/packages/babel-core/test/fixtures/transformation/source-maps/class/output.js b/packages/babel-core/test/fixtures/transformation/source-maps/class/output.js index 76b7ca7f8914..8f75c22d4d81 100644 --- a/packages/babel-core/test/fixtures/transformation/source-maps/class/output.js +++ b/packages/babel-core/test/fixtures/transformation/source-maps/class/output.js @@ -1,6 +1,4 @@ -var Test = -/*#__PURE__*/ -function () { +var Test = /*#__PURE__*/function () { "use strict"; function Test() { diff --git a/packages/babel-core/test/fixtures/transformation/source-maps/class/source-mappings.json b/packages/babel-core/test/fixtures/transformation/source-maps/class/source-mappings.json index b53208fbe4d6..c00fd6e9bcf5 100644 --- a/packages/babel-core/test/fixtures/transformation/source-maps/class/source-mappings.json +++ b/packages/babel-core/test/fixtures/transformation/source-maps/class/source-mappings.json @@ -4,7 +4,7 @@ "column": 10 }, "generated": { - "line": 13, + "line": 11, "column": 15 } }] \ No newline at end of file diff --git a/packages/babel-core/test/fixtures/transformation/source-maps/comment-inside-string/input.js b/packages/babel-core/test/fixtures/transformation/source-maps/comment-inside-string/input.js new file mode 100644 index 000000000000..b883f5d7b9a4 --- /dev/null +++ b/packages/babel-core/test/fixtures/transformation/source-maps/comment-inside-string/input.js @@ -0,0 +1,8 @@ +// https://github.com/babel/babel/issues/9790 +const comment = `//# sourceMappingURL=${path.basename( + sourceMapFilename +)}` + +// https://github.com/babel/babel/issues/9956 +this.shadowRoot.innerHTML = ``; diff --git a/packages/babel-core/test/fixtures/transformation/source-maps/comment-inside-string/options.json b/packages/babel-core/test/fixtures/transformation/source-maps/comment-inside-string/options.json new file mode 100644 index 000000000000..0e6084f210d8 --- /dev/null +++ b/packages/babel-core/test/fixtures/transformation/source-maps/comment-inside-string/options.json @@ -0,0 +1,3 @@ +{ + "inputSourceMap": true +} diff --git a/packages/babel-core/test/fixtures/transformation/source-maps/comment-inside-string/output.js b/packages/babel-core/test/fixtures/transformation/source-maps/comment-inside-string/output.js new file mode 100644 index 000000000000..9188ec5abc3b --- /dev/null +++ b/packages/babel-core/test/fixtures/transformation/source-maps/comment-inside-string/output.js @@ -0,0 +1,5 @@ +// https://github.com/babel/babel/issues/9790 +const comment = `//# sourceMappingURL=${path.basename(sourceMapFilename)}`; // https://github.com/babel/babel/issues/9956 + +this.shadowRoot.innerHTML = ``; diff --git a/packages/babel-core/test/fixtures/transformation/source-maps/input-source-map-external/input.js b/packages/babel-core/test/fixtures/transformation/source-maps/input-source-map-external/input.js new file mode 100644 index 000000000000..f7250b67d0b4 --- /dev/null +++ b/packages/babel-core/test/fixtures/transformation/source-maps/input-source-map-external/input.js @@ -0,0 +1,5 @@ +var foo = function () { + return 4; +}; + +//# sourceMappingURL=input.js.map diff --git a/packages/babel-core/test/fixtures/transformation/source-maps/input-source-map-external/input.js.map b/packages/babel-core/test/fixtures/transformation/source-maps/input-source-map-external/input.js.map new file mode 100644 index 000000000000..cb88961ebdc0 --- /dev/null +++ b/packages/babel-core/test/fixtures/transformation/source-maps/input-source-map-external/input.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["original.js"],"names":[],"mappings":"AAAA,UAAU,Y;SAAM,C;CAAC","sourcesContent":["var foo = () => 4;"]} diff --git a/packages/babel-core/test/fixtures/transformation/source-maps/input-source-map-external/options.json b/packages/babel-core/test/fixtures/transformation/source-maps/input-source-map-external/options.json new file mode 100644 index 000000000000..0e6084f210d8 --- /dev/null +++ b/packages/babel-core/test/fixtures/transformation/source-maps/input-source-map-external/options.json @@ -0,0 +1,3 @@ +{ + "inputSourceMap": true +} diff --git a/packages/babel-core/test/fixtures/transformation/source-maps/input-source-map-external/output.js b/packages/babel-core/test/fixtures/transformation/source-maps/input-source-map-external/output.js new file mode 100644 index 000000000000..cf3efeceb306 --- /dev/null +++ b/packages/babel-core/test/fixtures/transformation/source-maps/input-source-map-external/output.js @@ -0,0 +1,3 @@ +var foo = function () { + return 4; +}; diff --git a/packages/babel-core/test/fixtures/transformation/source-maps/input-source-map-external/source-map.json b/packages/babel-core/test/fixtures/transformation/source-maps/input-source-map-external/source-map.json new file mode 100644 index 000000000000..63c01db5fede --- /dev/null +++ b/packages/babel-core/test/fixtures/transformation/source-maps/input-source-map-external/source-map.json @@ -0,0 +1,7 @@ +{ + "mappings": "AAAA,IAAA,GAAA,GAAU,Y;SAAM,C;AAAC,CAAjB", + "names": [], + "sources": ["original.js"], + "sourcesContent": ["var foo = () => 4;"], + "version": 3 +} diff --git a/packages/babel-core/test/option-manager.js b/packages/babel-core/test/option-manager.js index 4a6301ab4777..e792d27f0500 100644 --- a/packages/babel-core/test/option-manager.js +++ b/packages/babel-core/test/option-manager.js @@ -27,14 +27,65 @@ describe("option-manager", () => { return { plugin, calls }; } - it("should throw if a plugin is repeated", () => { - const { calls, plugin } = makePlugin(); + it("should throw when an option is provided as a preset", () => { + expect(() => { + loadOptions({ + presets: [ + "./fixtures/option-manager/babel-preset-bar", + { useBuiltIns: "entry" }, + ], + }); + }).toThrowErrorMatchingSnapshot(); + }); + it("should throw when an option is provided as a plugin", () => { expect(() => { loadOptions({ - plugins: [plugin, plugin], + plugins: [ + "./fixtures/option-manager/babel-plugin-foo", + { useSpread: true }, + ], }); - }).toThrow(/Duplicate plugin\/preset detected/); + }).toThrowErrorMatchingSnapshot(); + }); + + it("should throw when an option is following a preset", () => { + expect(() => { + loadOptions({ + presets: [ + "./fixtures/option-manager/babel-plugin-foo", + "./fixtures/option-manager/babel-preset-bar", + { useSpread: true }, + ], + }); + }).toThrowErrorMatchingSnapshot(); + }); + + it("should not throw when a preset string followed by valid preset object", () => { + const { plugin } = makePlugin("my-plugin"); + expect( + loadOptions({ + presets: [ + "@babel/env", + { plugins: [[plugin, undefined, "my-plugin"]] }, + ], + }), + ).toBeTruthy(); + }); + + it("should throw if a plugin is repeated, with information about the repeated plugin", () => { + const { calls, plugin } = makePlugin("my-plugin"); + + expect(() => { + loadOptions({ + plugins: [ + [plugin, undefined, "my-plugin"], + [plugin, undefined, "my-plugin"], + ], + }); + }).toThrow( + /Duplicate plugin\/preset detected.*Duplicates detected are.*my-plugin.*my-plugin/ms, + ); expect(calls).toEqual([]); }); @@ -43,8 +94,8 @@ describe("option-manager", () => { expect(() => { loadOptions({ plugins: [[plugin, null]], - }).toThrow(/.plugins[0][1] must be an object, false, or undefined/); - }); + }); + }).toThrow(".plugins[0][1] must be an object, false, or undefined"); expect(calls).toEqual([]); }); @@ -54,7 +105,10 @@ describe("option-manager", () => { const { calls: calls2, plugin: plugin2 } = makePlugin(); loadOptions({ - plugins: [[plugin1, { arg: 1 }], [plugin2, { arg: 2 }, "some-name"]], + plugins: [ + [plugin1, { arg: 1 }], + [plugin2, { arg: 2 }, "some-name"], + ], }); expect(calls1).toEqual([{ arg: 1 }]); expect(calls2).toEqual([{ arg: 2 }]); @@ -69,7 +123,10 @@ describe("option-manager", () => { plugins: [[plugin1, { arg: 1 }]], env: { test: { - plugins: [[plugin1, { arg: 3 }], [plugin2, { arg: 2 }]], + plugins: [ + [plugin1, { arg: 3 }], + [plugin2, { arg: 2 }], + ], }, }, }); @@ -83,8 +140,8 @@ describe("option-manager", () => { expect(() => { loadOptions({ presets: [preset, preset], - }).toThrow(/Duplicate plugin\/preset detected/); - }); + }); + }).toThrow(/Duplicate plugin\/preset detected/); expect(calls).toEqual([]); }); @@ -93,7 +150,10 @@ describe("option-manager", () => { const { calls: calls2, plugin: preset2 } = makePlugin(); loadOptions({ - presets: [[preset1, { arg: 1 }], [preset2, { arg: 2 }, "some-name"]], + presets: [ + [preset1, { arg: 1 }], + [preset2, { arg: 2 }, "some-name"], + ], }); expect(calls1).toEqual([{ arg: 1 }]); expect(calls2).toEqual([{ arg: 2 }]); @@ -107,7 +167,10 @@ describe("option-manager", () => { presets: [[preset1, { arg: 1 }]], env: { test: { - presets: [[preset1, { arg: 3 }], [preset2, { arg: 2 }]], + presets: [ + [preset1, { arg: 3 }], + [preset2, { arg: 2 }], + ], }, }, }); @@ -125,7 +188,10 @@ describe("option-manager", () => { presets: [[preset1, { arg: 1 }]], env: { test: { - presets: [[preset1, { arg: 3 }], [preset2, { arg: 2 }]], + presets: [ + [preset1, { arg: 3 }], + [preset2, { arg: 2 }], + ], }, }, }); diff --git a/packages/babel-generator/.npmignore b/packages/babel-generator/.npmignore index f9806945836e..f3b1e0392a0b 100644 --- a/packages/babel-generator/.npmignore +++ b/packages/babel-generator/.npmignore @@ -1,3 +1,4 @@ src test +scripts *.log diff --git a/packages/babel-generator/package.json b/packages/babel-generator/package.json index 815171acf262..84f0741459af 100644 --- a/packages/babel-generator/package.json +++ b/packages/babel-generator/package.json @@ -1,6 +1,6 @@ { "name": "@babel/generator", - "version": "7.5.5", + "version": "7.9.5", "description": "Turns an AST into code.", "author": "Sebastian McKenzie ", "homepage": "https://babeljs.io/", @@ -14,14 +14,13 @@ "lib" ], "dependencies": { - "@babel/types": "^7.5.5", + "@babel/types": "^7.9.5", "jsesc": "^2.5.1", "lodash": "^4.17.13", - "source-map": "^0.5.0", - "trim-right": "^1.0.1" + "source-map": "^0.5.0" }, "devDependencies": { - "@babel/helper-fixtures": "^7.5.5", - "@babel/parser": "^7.5.5" + "@babel/helper-fixtures": "^7.8.6", + "@babel/parser": "^7.9.4" } } diff --git a/packages/babel-generator/src/buffer.js b/packages/babel-generator/src/buffer.js index fd64201a921b..d9af9a167a14 100644 --- a/packages/babel-generator/src/buffer.js +++ b/packages/babel-generator/src/buffer.js @@ -1,5 +1,4 @@ import type SourceMap from "./source-map"; -import trimRight from "trim-right"; const SPACES_RE = /^[ \t]+$/; @@ -43,7 +42,7 @@ export default class Buffer { const result = { // Whatever trim is used here should not execute a regex against the // source string since it may be arbitrarily large after all transformations - code: trimRight(this._buf.join("")), + code: this._buf.join("").trimRight(), map: null, rawMappings: map && map.getRawMappings(), }; diff --git a/packages/babel-generator/src/generators/classes.js b/packages/babel-generator/src/generators/classes.js index e8c62339a6d2..1713293369d4 100644 --- a/packages/babel-generator/src/generators/classes.js +++ b/packages/babel-generator/src/generators/classes.js @@ -71,26 +71,8 @@ export function ClassBody(node: Object) { export function ClassProperty(node: Object) { this.printJoin(node.decorators, node); + this.tsPrintClassMemberModifiers(node, /* isField */ true); - if (node.accessibility) { - // TS - this.word(node.accessibility); - this.space(); - } - if (node.static) { - this.word("static"); - this.space(); - } - if (node.abstract) { - // TS - this.word("abstract"); - this.space(); - } - if (node.readonly) { - // TS - this.word("readonly"); - this.space(); - } if (node.computed) { this.token("["); this.print(node.key, node); @@ -148,23 +130,6 @@ export function ClassPrivateMethod(node: Object) { export function _classMethodHead(node) { this.printJoin(node.decorators, node); - - if (node.accessibility) { - // TS - this.word(node.accessibility); - this.space(); - } - - if (node.abstract) { - // TS - this.word("abstract"); - this.space(); - } - - if (node.static) { - this.word("static"); - this.space(); - } - + this.tsPrintClassMemberModifiers(node, /* isField */ false); this._methodHead(node); } diff --git a/packages/babel-generator/src/generators/expressions.js b/packages/babel-generator/src/generators/expressions.js index 4f9a525bd05e..62c3aca83bc0 100644 --- a/packages/babel-generator/src/generators/expressions.js +++ b/packages/babel-generator/src/generators/expressions.js @@ -264,3 +264,8 @@ export function PrivateName(node: Object) { this.token("#"); this.print(node.id, node); } + +export function V8IntrinsicIdentifier(node: Object) { + this.token("%"); + this.word(node.name); +} diff --git a/packages/babel-generator/src/generators/flow.js b/packages/babel-generator/src/generators/flow.js index 225428b00801..b39d498eefe3 100644 --- a/packages/babel-generator/src/generators/flow.js +++ b/packages/babel-generator/src/generators/flow.js @@ -134,6 +134,92 @@ export function DeclareExportAllDeclaration(/*node: Object*/) { ExportAllDeclaration.apply(this, arguments); } +export function EnumDeclaration(node: Object) { + const { id, body } = node; + this.word("enum"); + this.space(); + this.print(id, node); + this.print(body, node); +} + +function enumExplicitType( + context: Object, + name: string, + hasExplicitType: boolean, +) { + if (hasExplicitType) { + context.space(); + context.word("of"); + context.space(); + context.word(name); + } + context.space(); +} + +function enumBody(context: Object, node: Object) { + const { members } = node; + context.token("{"); + context.indent(); + context.newline(); + for (const member of members) { + context.print(member, node); + context.newline(); + } + context.dedent(); + context.token("}"); +} + +export function EnumBooleanBody(node: Object) { + const { explicitType } = node; + enumExplicitType(this, "boolean", explicitType); + enumBody(this, node); +} + +export function EnumNumberBody(node: Object) { + const { explicitType } = node; + enumExplicitType(this, "number", explicitType); + enumBody(this, node); +} + +export function EnumStringBody(node: Object) { + const { explicitType } = node; + enumExplicitType(this, "string", explicitType); + enumBody(this, node); +} + +export function EnumSymbolBody(node: Object) { + enumExplicitType(this, "symbol", true); + enumBody(this, node); +} + +export function EnumDefaultedMember(node: Object) { + const { id } = node; + this.print(id, node); + this.token(","); +} + +function enumInitializedMember(context: Object, node: Object) { + const { id, init } = node; + context.print(id, node); + context.space(); + context.token("="); + context.space(); + context.print(init, node); + context.token(","); +} + +export function EnumBooleanMember(node: Object) { + enumInitializedMember(this, node); +} + +export function EnumNumberMember(node: Object) { + enumInitializedMember(this, node); +} + +export function EnumStringMember(node: Object) { + enumInitializedMember(this, node); +} + function FlowExportDeclaration(node: Object) { if (node.declaration) { const declar = node.declaration; @@ -510,6 +596,10 @@ export function QualifiedTypeIdentifier(node: Object) { this.print(node.id, node); } +export function SymbolTypeAnnotation() { + this.word("symbol"); +} + function orSeparator() { this.space(); this.token("|"); diff --git a/packages/babel-generator/src/generators/modules.js b/packages/babel-generator/src/generators/modules.js index b081a2882d3d..6b2e2e9b4a33 100644 --- a/packages/babel-generator/src/generators/modules.js +++ b/packages/babel-generator/src/generators/modules.js @@ -99,7 +99,7 @@ function ExportDeclaration(node: Object) { // print "special" specifiers first let hasSpecial = false; - while (true) { + for (;;) { const first = specifiers[0]; if ( t.isExportDefaultSpecifier(first) || @@ -149,7 +149,7 @@ export function ImportDeclaration(node: Object) { const specifiers = node.specifiers.slice(0); if (specifiers && specifiers.length) { // print "special" specifiers first - while (true) { + for (;;) { const first = specifiers[0]; if ( t.isImportDefaultSpecifier(first) || diff --git a/packages/babel-generator/src/generators/types.js b/packages/babel-generator/src/generators/types.js index fdd090dd4113..e0e70b8ad45a 100644 --- a/packages/babel-generator/src/generators/types.js +++ b/packages/babel-generator/src/generators/types.js @@ -65,9 +65,9 @@ export function ObjectProperty(node: Object) { // shorthand! if ( node.shorthand && - (t.isIdentifier(node.key) && - t.isIdentifier(node.value) && - node.key.name === node.value.name) + t.isIdentifier(node.key) && + t.isIdentifier(node.value) && + node.key.name === node.value.name ) { return; } @@ -106,6 +106,69 @@ export function ArrayExpression(node: Object) { export { ArrayExpression as ArrayPattern }; +export function RecordExpression(node: Object) { + const props = node.properties; + + let startToken; + let endToken; + if (this.format.recordAndTupleSyntaxType === "bar") { + startToken = "{|"; + endToken = "|}"; + } else if (this.format.recordAndTupleSyntaxType === "hash") { + startToken = "#{"; + endToken = "}"; + } else { + throw new Error( + `The "recordAndTupleSyntaxType" generator option must be "bar" or "hash" (${JSON.stringify( + this.format.recordAndTupleSyntaxType, + )} received).`, + ); + } + + this.token(startToken); + this.printInnerComments(node); + + if (props.length) { + this.space(); + this.printList(props, node, { indent: true, statement: true }); + this.space(); + } + this.token(endToken); +} + +export function TupleExpression(node: Object) { + const elems = node.elements; + const len = elems.length; + + let startToken; + let endToken; + if (this.format.recordAndTupleSyntaxType === "bar") { + startToken = "[|"; + endToken = "|]"; + } else if (this.format.recordAndTupleSyntaxType === "hash") { + startToken = "#["; + endToken = "]"; + } else { + throw new Error( + `${this.format.recordAndTupleSyntaxType} is not a valid recordAndTuple syntax type`, + ); + } + + this.token(startToken); + this.printInnerComments(node); + + for (let i = 0; i < elems.length; i++) { + const elem = elems[i]; + if (elem) { + if (i > 0) this.space(); + this.print(elem, node); + if (i < len - 1) this.token(","); + } + } + + this.token(endToken); +} + export function RegExpLiteral(node: Object) { this.word(`/${node.pattern}/${node.flags}`); } @@ -120,8 +183,11 @@ export function NullLiteral() { export function NumericLiteral(node: Object) { const raw = this.getPossibleRaw(node); + const opts = this.format.jsescOption; const value = node.value + ""; - if (raw == null) { + if (opts.numbers) { + this.number(jsesc(node.value, opts)); + } else if (raw == null) { this.number(value); // normalize } else if (this.format.minified) { this.number(raw.length < value.length ? raw : value); diff --git a/packages/babel-generator/src/generators/typescript.js b/packages/babel-generator/src/generators/typescript.js index c5d737892f2d..39c580d74d2f 100644 --- a/packages/babel-generator/src/generators/typescript.js +++ b/packages/babel-generator/src/generators/typescript.js @@ -67,12 +67,14 @@ export function TSQualifiedName(node) { export function TSCallSignatureDeclaration(node) { this.tsPrintSignatureDeclarationBase(node); + this.token(";"); } export function TSConstructSignatureDeclaration(node) { this.word("new"); this.space(); this.tsPrintSignatureDeclarationBase(node); + this.token(";"); } export function TSPropertySignature(node) { @@ -127,6 +129,9 @@ export function TSIndexSignature(node) { export function TSAnyKeyword() { this.word("any"); } +export function TSBigIntKeyword() { + this.word("bigint"); +} export function TSUnknownKeyword() { this.word("unknown"); } @@ -192,11 +197,17 @@ export function TSTypeReference(node) { } export function TSTypePredicate(node) { + if (node.asserts) { + this.word("asserts"); + this.space(); + } this.print(node.parameterName); - this.space(); - this.word("is"); - this.space(); - this.print(node.typeAnnotation.typeAnnotation); + if (node.typeAnnotation) { + this.space(); + this.word("is"); + this.space(); + this.print(node.typeAnnotation.typeAnnotation); + } } export function TSTypeQuery(node) { @@ -545,3 +556,26 @@ export function tsPrintSignatureDeclarationBase(node) { this.token(")"); this.print(node.typeAnnotation, node); } + +export function tsPrintClassMemberModifiers(node, isField) { + if (isField && node.declare) { + this.word("declare"); + this.space(); + } + if (node.accessibility) { + this.word(node.accessibility); + this.space(); + } + if (node.static) { + this.word("static"); + this.space(); + } + if (node.abstract) { + this.word("abstract"); + this.space(); + } + if (isField && node.readonly) { + this.word("readonly"); + this.space(); + } +} diff --git a/packages/babel-generator/src/index.js b/packages/babel-generator/src/index.js index 4e7399d4bb47..1f56bc285426 100644 --- a/packages/babel-generator/src/index.js +++ b/packages/babel-generator/src/index.js @@ -58,6 +58,7 @@ function normalizeOptions(code, opts): Format { wrap: true, ...opts.jsescOption, }, + recordAndTupleSyntaxType: opts.recordAndTupleSyntaxType, }; if (format.minified) { @@ -70,7 +71,8 @@ function normalizeOptions(code, opts): Format { format.shouldPrintComment || (value => format.comments || - (value.indexOf("@license") >= 0 || value.indexOf("@preserve") >= 0)); + value.indexOf("@license") >= 0 || + value.indexOf("@preserve") >= 0); } if (format.compact === "auto") { diff --git a/packages/babel-generator/src/node/index.js b/packages/babel-generator/src/node/index.js index 394e63b5cbdd..43bddb3e1993 100644 --- a/packages/babel-generator/src/node/index.js +++ b/packages/babel-generator/src/node/index.js @@ -46,14 +46,7 @@ function isOrHasCallExpression(node) { return true; } - if (t.isMemberExpression(node)) { - return ( - isOrHasCallExpression(node.object) || - (!node.computed && isOrHasCallExpression(node.property)) - ); - } else { - return false; - } + return t.isMemberExpression(node) && isOrHasCallExpression(node.object); } export function needsWhitespace(node, parent, type) { diff --git a/packages/babel-generator/src/node/parentheses.js b/packages/babel-generator/src/node/parentheses.js index 8c38fa627239..cd3dc0943a12 100644 --- a/packages/babel-generator/src/node/parentheses.js +++ b/packages/babel-generator/src/node/parentheses.js @@ -2,6 +2,7 @@ import * as t from "@babel/types"; const PRECEDENCE = { "||": 0, + "??": 0, "&&": 1, "|": 2, "^": 3, @@ -31,31 +32,41 @@ const isClassExtendsClause = (node: Object, parent: Object): boolean => (t.isClassDeclaration(parent) || t.isClassExpression(parent)) && parent.superClass === node; +const hasPostfixPart = (node: Object, parent: Object) => + ((t.isMemberExpression(parent) || t.isOptionalMemberExpression(parent)) && + parent.object === node) || + ((t.isCallExpression(parent) || + t.isOptionalCallExpression(parent) || + t.isNewExpression(parent)) && + parent.callee === node) || + (t.isTaggedTemplateExpression(parent) && parent.tag === node) || + t.isTSNonNullExpression(parent); + export function NullableTypeAnnotation(node: Object, parent: Object): boolean { return t.isArrayTypeAnnotation(parent); } -export function FunctionTypeAnnotation(node: Object, parent: Object): boolean { +export function FunctionTypeAnnotation( + node: Object, + parent: Object, + printStack: Array, +): boolean { return ( // (() => A) | (() => B) t.isUnionTypeAnnotation(parent) || // (() => A) & (() => B) t.isIntersectionTypeAnnotation(parent) || // (() => A)[] - t.isArrayTypeAnnotation(parent) + t.isArrayTypeAnnotation(parent) || + // (A: T): (T => T[]) => B => [A, B] + (t.isTypeAnnotation(parent) && + // Check grandparent + t.isArrowFunctionExpression(printStack[printStack.length - 3])) ); } export function UpdateExpression(node: Object, parent: Object): boolean { - return ( - // (foo++).test(), (foo++)[0] - t.isMemberExpression(parent, { object: node }) || - // (foo++)() - t.isCallExpression(parent, { callee: node }) || - // new (foo++)() - t.isNewExpression(parent, { callee: node }) || - isClassExtendsClause(node, parent) - ); + return hasPostfixPart(node, parent) || isClassExtendsClause(node, parent); } export function ObjectExpression( @@ -87,10 +98,8 @@ export function Binary(node: Object, parent: Object): boolean { } if ( - ((t.isCallExpression(parent) || t.isNewExpression(parent)) && - parent.callee === node) || + hasPostfixPart(node, parent) || t.isUnaryLike(parent) || - (t.isMemberExpression(parent) && parent.object === node) || t.isAwaitExpression(parent) ) { return true; @@ -113,8 +122,6 @@ export function Binary(node: Object, parent: Object): boolean { return true; } } - - return false; } export function UnionTypeAnnotation(node: Object, parent: Object): boolean { @@ -148,6 +155,10 @@ export function TSUnionType(node: Object, parent: Object): boolean { export { TSUnionType as TSIntersectionType }; +export function TSInferType(node: Object, parent: Object): boolean { + return t.isTSArrayType(parent) || t.isTSOptionalType(parent); +} + export function BinaryExpression(node: Object, parent: Object): boolean { // let i = (1 in []); // for ((1 in []);;); @@ -184,9 +195,7 @@ export function YieldExpression(node: Object, parent: Object): boolean { return ( t.isBinary(parent) || t.isUnaryLike(parent) || - t.isCallExpression(parent) || - t.isMemberExpression(parent) || - t.isNewExpression(parent) || + hasPostfixPart(node, parent) || (t.isAwaitExpression(parent) && t.isYieldExpression(node)) || (t.isConditionalExpression(parent) && node === parent.test) || isClassExtendsClause(node, parent) @@ -205,9 +214,7 @@ export function ClassExpression( export function UnaryLike(node: Object, parent: Object): boolean { return ( - t.isMemberExpression(parent, { object: node }) || - t.isCallExpression(parent, { callee: node }) || - t.isNewExpression(parent, { callee: node }) || + hasPostfixPart(node, parent) || t.isBinaryExpression(parent, { operator: "**", left: node }) || isClassExtendsClause(node, parent) ); @@ -231,8 +238,6 @@ export function ConditionalExpression(node: Object, parent: Object): boolean { t.isBinary(parent) || t.isConditionalExpression(parent, { test: node }) || t.isAwaitExpression(parent) || - t.isOptionalMemberExpression(parent) || - t.isTaggedTemplateExpression(parent) || t.isTSTypeAssertion(parent) || t.isTSAsExpression(parent) ) { @@ -246,19 +251,36 @@ export function OptionalMemberExpression( node: Object, parent: Object, ): boolean { - return t.isCallExpression(parent) || t.isMemberExpression(parent); + return ( + t.isCallExpression(parent, { callee: node }) || + t.isMemberExpression(parent, { object: node }) + ); } -export function AssignmentExpression(node: Object): boolean { +export { OptionalMemberExpression as OptionalCallExpression }; + +export function AssignmentExpression( + node: Object, + parent: Object, + printStack: Array, +): boolean { if (t.isObjectPattern(node.left)) { return true; } else { - return ConditionalExpression(...arguments); + return ConditionalExpression(node, parent, printStack); } } -export function NewExpression(node: Object, parent: Object): boolean { - return isClassExtendsClause(node, parent); +export function LogicalExpression(node: Object, parent: Object): boolean { + switch (node.operator) { + case "||": + if (!t.isLogicalExpression(parent)) return false; + return parent.operator === "??" || parent.operator === "&&"; + case "&&": + return t.isLogicalExpression(parent, { operator: "??" }); + case "??": + return t.isLogicalExpression(parent) && parent.operator !== "??"; + } } // Walk up the print stack to determine if our node can come first @@ -274,7 +296,6 @@ function isFirstInStatement( while (i > 0) { if ( t.isExpressionStatement(parent, { expression: node }) || - t.isTaggedTemplateExpression(parent) || (considerDefaultExports && t.isExportDefaultDeclaration(parent, { declaration: node })) || (considerArrow && t.isArrowFunctionExpression(parent, { body: node })) @@ -283,9 +304,8 @@ function isFirstInStatement( } if ( - t.isCallExpression(parent, { callee: node }) || + (hasPostfixPart(node, parent) && !t.isNewExpression(parent)) || (t.isSequenceExpression(parent) && parent.expressions[0] === node) || - t.isMemberExpression(parent, { object: node }) || t.isConditional(parent, { test: node }) || t.isBinary(parent, { left: node }) || t.isAssignmentExpression(parent, { left: node }) diff --git a/packages/babel-generator/src/node/whitespace.js b/packages/babel-generator/src/node/whitespace.js index c9bf14750d2d..27e8161be572 100644 --- a/packages/babel-generator/src/node/whitespace.js +++ b/packages/babel-generator/src/node/whitespace.js @@ -14,13 +14,13 @@ type WhitespaceObject = { */ function crawl(node, state = {}) { - if (t.isMemberExpression(node)) { + if (t.isMemberExpression(node) || t.isOptionalMemberExpression(node)) { crawl(node.object, state); if (node.computed) crawl(node.property, state); } else if (t.isBinary(node) || t.isAssignmentExpression(node)) { crawl(node.left, state); crawl(node.right, state); - } else if (t.isCallExpression(node)) { + } else if (t.isCallExpression(node) || t.isOptionalCallExpression(node)) { state.hasCall = true; crawl(node.callee, state); } else if (t.isFunction(node)) { @@ -119,7 +119,7 @@ export const nodes = { }, /** - * Test if CallExpression needs whitespace. + * Test if CallExpressionish needs whitespace. */ CallExpression(node: Object): ?WhitespaceObject { @@ -131,6 +131,15 @@ export const nodes = { } }, + OptionalCallExpression(node: Object): ?WhitespaceObject { + if (t.isFunction(node.callee)) { + return { + before: true, + after: true, + }; + } + }, + /** * Test if VariableDeclaration needs whitespace. */ diff --git a/packages/babel-generator/src/printer.js b/packages/babel-generator/src/printer.js index fb4715d491c5..2403fd9936bb 100644 --- a/packages/babel-generator/src/printer.js +++ b/packages/babel-generator/src/printer.js @@ -9,6 +9,7 @@ import * as generatorFunctions from "./generators"; const SCIENTIFIC_NOTATION = /e/i; const ZERO_DECIMAL_INTEGER = /\.0+$/; const NON_DECIMAL_LITERAL = /^0[box]/; +const PURE_ANNOTATION_RE = /^\s*[@#]__PURE__\s*$/; export type Format = { shouldPrintComment: (comment: string) => boolean, @@ -248,20 +249,57 @@ export default class Printer { // see startTerminatorless() instance method const parenPushNewlineState = this._parenPushNewlineState; if (!parenPushNewlineState) return; - this._parenPushNewlineState = null; + + // This function does two things: + // - If needed, prints a parenthesis + // - If the currently printed string removes the need for the paren, + // it resets the _parenPushNewlineState field. + // Almost everything removes the need for a paren, except for + // comments and whitespaces. let i; for (i = 0; i < str.length && str[i] === " "; i++) continue; - if (i === str.length) return; + if (i === str.length) { + // Whitespaces only, the parentheses might still be needed. + return; + } // Check for newline or comment. const cha = str[i]; if (cha !== "\n") { - if (cha !== "/") return; - if (i + 1 === str.length) return; + if ( + // This is not a comment (it doesn't start with /) + cha !== "/" || + // This is not a comment (it's a / operator) + i + 1 === str.length + ) { + // After a normal token, the parentheses aren't needed anymore + this._parenPushNewlineState = null; + return; + } + const chaPost = str[i + 1]; - if (chaPost !== "/" && chaPost !== "*") return; + + if (chaPost === "*") { + // This is a block comment + + if (PURE_ANNOTATION_RE.test(str.slice(i + 2, str.length - 2))) { + // We avoid printing newlines after #__PURE__ comments (we treat + // then as unary operators), but we must keep the old + // parenPushNewlineState because, if a newline was forbidden, it is + // still forbidden after the comment. + return; + } + + // NOTE: code flow continues from here to after these if/elses + } else if (chaPost !== "/") { + // This is neither a block comment, nor a line comment. + // After a normal token, the parentheses aren't needed anymore + this._parenPushNewlineState = null; + return; + } } + this.token("("); this.indent(); parenPushNewlineState.printed = true; @@ -477,7 +515,11 @@ export default class Printer { } _printLeadingComments(node) { - this._printComments(this._getComments(true, node)); + this._printComments( + this._getComments(true, node), + // Don't add leading/trailing new lines to #__PURE__ annotations + true, + ); } printInnerComments(node, indent = true) { @@ -532,7 +574,7 @@ export default class Printer { ); } - _printComment(comment) { + _printComment(comment, skipNewLines?: boolean) { if (!this.format.shouldPrintComment(comment.value)) return; // Some plugins use this to mark comments as removed using the AST-root 'comments' property, @@ -549,12 +591,12 @@ export default class Printer { const isBlockComment = comment.type === "CommentBlock"; - // Always add a newline before a block comment - this.newline( - this._buf.hasContent() && !this._noLineTerminator && isBlockComment - ? 1 - : 0, - ); + // Add a newline before and after a block comment, unless explicitly + // disallowed + const printNewLines = + isBlockComment && !skipNewLines && !this._noLineTerminator; + + if (printNewLines && this._buf.hasContent()) this.newline(1); if (!this.endsWith("[") && !this.endsWith("{")) this.space(); @@ -584,15 +626,26 @@ export default class Printer { this._append(val); }); - // Always add a newline after a block comment - this.newline(isBlockComment && !this._noLineTerminator ? 1 : 0); + if (printNewLines) this.newline(1); } - _printComments(comments?: Array) { + _printComments(comments?: Array, inlinePureAnnotation?: boolean) { if (!comments || !comments.length) return; - for (const comment of comments) { - this._printComment(comment); + if ( + inlinePureAnnotation && + comments.length === 1 && + PURE_ANNOTATION_RE.test(comments[0].value) + ) { + this._printComment( + comments[0], + // Keep newlines if the comment marks a standalone call + this._buf.hasContent() && !this.endsWith("\n"), + ); + } else { + for (const comment of comments) { + this._printComment(comment); + } } } } diff --git a/packages/babel-generator/src/source-map.js b/packages/babel-generator/src/source-map.js index d03628a5eb53..9c58d8b8c64b 100644 --- a/packages/babel-generator/src/source-map.js +++ b/packages/babel-generator/src/source-map.js @@ -24,14 +24,20 @@ export default class SourceMap { const code = this._code; if (typeof code === "string") { - map.setSourceContent(this._opts.sourceFileName, code); + map.setSourceContent( + this._opts.sourceFileName.replace(/\\/g, "/"), + code, + ); } else if (typeof code === "object") { Object.keys(code).forEach(sourceFileName => { - map.setSourceContent(sourceFileName, code[sourceFileName]); + map.setSourceContent( + sourceFileName.replace(/\\/g, "/"), + code[sourceFileName], + ); }); } - this._rawMappings.forEach(map.addMapping, map); + this._rawMappings.forEach(mapping => map.addMapping(mapping), map); } return this._cachedMap.toJSON(); @@ -83,7 +89,10 @@ export default class SourceMap { line: generatedLine, column: generatedColumn, }, - source: line == null ? undefined : filename || this._opts.sourceFileName, + source: + line == null + ? undefined + : (filename || this._opts.sourceFileName).replace(/\\/g, "/"), original: line == null ? undefined diff --git a/packages/babel-generator/test/fixtures/comments/create-parenthesized-expressions/options.json b/packages/babel-generator/test/fixtures/comments/create-parenthesized-expressions/options.json index 7c49b91ec9b2..ffc84e30b554 100644 --- a/packages/babel-generator/test/fixtures/comments/create-parenthesized-expressions/options.json +++ b/packages/babel-generator/test/fixtures/comments/create-parenthesized-expressions/options.json @@ -1,3 +1,3 @@ { - "parserOpts": {"createParenthesizedExpressions": true} + "parserOpts": { "createParenthesizedExpressions": true } } diff --git a/packages/babel-generator/test/fixtures/escapes/options.json b/packages/babel-generator/test/fixtures/escapes/jsonEscape/options.json similarity index 100% rename from packages/babel-generator/test/fixtures/escapes/options.json rename to packages/babel-generator/test/fixtures/escapes/jsonEscape/options.json diff --git a/packages/babel-generator/test/fixtures/escapes/numeric-literals/input.js b/packages/babel-generator/test/fixtures/escapes/numeric-literals/input.js new file mode 100644 index 000000000000..91c93b0951e1 --- /dev/null +++ b/packages/babel-generator/test/fixtures/escapes/numeric-literals/input.js @@ -0,0 +1 @@ +let x = 42 \ No newline at end of file diff --git a/packages/babel-generator/test/fixtures/escapes/numeric-literals/options.json b/packages/babel-generator/test/fixtures/escapes/numeric-literals/options.json new file mode 100644 index 000000000000..0e857996e427 --- /dev/null +++ b/packages/babel-generator/test/fixtures/escapes/numeric-literals/options.json @@ -0,0 +1,6 @@ +{ + "jsescOption": { + "numbers": "hexadecimal", + "lowercaseHex": true + } +} diff --git a/packages/babel-generator/test/fixtures/escapes/numeric-literals/output.js b/packages/babel-generator/test/fixtures/escapes/numeric-literals/output.js new file mode 100644 index 000000000000..7ba9bc21a7c6 --- /dev/null +++ b/packages/babel-generator/test/fixtures/escapes/numeric-literals/output.js @@ -0,0 +1 @@ +let x = 0x2a; \ No newline at end of file diff --git a/packages/babel-generator/test/fixtures/flow/arrow-functions/input.js b/packages/babel-generator/test/fixtures/flow/arrow-functions/input.js index a3d11b136d6b..5719c2dbf087 100644 --- a/packages/babel-generator/test/fixtures/flow/arrow-functions/input.js +++ b/packages/babel-generator/test/fixtures/flow/arrow-functions/input.js @@ -5,3 +5,4 @@ const bar4 = x => {}; const bar5 = (x): string => {}; const bar6 = (x: number) => {}; const bar7 = (x) => {}; +const bar8 = (x: T): (T => T[]) => y => [x, y]; diff --git a/packages/babel-generator/test/fixtures/flow/arrow-functions/output.js b/packages/babel-generator/test/fixtures/flow/arrow-functions/output.js index 8b1f78020541..d132971e4bcf 100644 --- a/packages/babel-generator/test/fixtures/flow/arrow-functions/output.js +++ b/packages/babel-generator/test/fixtures/flow/arrow-functions/output.js @@ -10,4 +10,6 @@ const bar5 = (x): string => {}; const bar6 = (x: number) => {}; -const bar7 = (x) => {}; \ No newline at end of file +const bar7 = (x) => {}; + +const bar8 = (x: T): ((T) => T[]) => y => [x, y]; diff --git a/packages/babel-generator/test/fixtures/flow/declare-field/input.js b/packages/babel-generator/test/fixtures/flow/declare-field/input.js new file mode 100644 index 000000000000..f0db8dde1762 --- /dev/null +++ b/packages/babel-generator/test/fixtures/flow/declare-field/input.js @@ -0,0 +1,4 @@ +class A { + declare x + declare static y +} diff --git a/packages/babel-generator/test/fixtures/flow/declare-field/options.json b/packages/babel-generator/test/fixtures/flow/declare-field/options.json new file mode 100644 index 000000000000..65c79d81c796 --- /dev/null +++ b/packages/babel-generator/test/fixtures/flow/declare-field/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["flow", "classProperties"] +} diff --git a/packages/babel-generator/test/fixtures/flow/declare-field/output.js b/packages/babel-generator/test/fixtures/flow/declare-field/output.js new file mode 100644 index 000000000000..7d405964d29f --- /dev/null +++ b/packages/babel-generator/test/fixtures/flow/declare-field/output.js @@ -0,0 +1,4 @@ +class A { + declare x; + declare static y; +} \ No newline at end of file diff --git a/packages/babel-generator/test/fixtures/flow/declare-statements/input.js b/packages/babel-generator/test/fixtures/flow/declare-statements/input.js index a0874c4d44a4..7b2571e32867 100644 --- a/packages/babel-generator/test/fixtures/flow/declare-statements/input.js +++ b/packages/babel-generator/test/fixtures/flow/declare-statements/input.js @@ -11,15 +11,16 @@ declare class A { static [ indexer: number]: string } declare class A { static () : number } declare class B { (): number } declare class A mixins B, C {} -declare type A = string +declare type A1 = string declare type T = { [k:string]: U } -declare type B = { +declare type B1 = { fn?: (foo: string) => void, } -declare interface I { foo: string } -declare interface I { foo: T } +declare interface I1 { foo: string } +declare interface I2 { foo: T } declare module.exports: { foo: string } declare opaque type Foo: Bar; declare opaque type ID; declare opaque type num: number; declare opaque type NumArray; +declare var sym: symbol; diff --git a/packages/babel-generator/test/fixtures/flow/declare-statements/output.js b/packages/babel-generator/test/fixtures/flow/declare-statements/output.js index 7be6ae40cec7..beede465d3df 100644 --- a/packages/babel-generator/test/fixtures/flow/declare-statements/output.js +++ b/packages/babel-generator/test/fixtures/flow/declare-statements/output.js @@ -22,17 +22,17 @@ declare class B { (): number } declare class A mixins B, C {} -declare type A = string; +declare type A1 = string; declare type T = { [k: string]: U }; -declare type B = { +declare type B1 = { fn?: (foo: string) => void }; -declare interface I { +declare interface I1 { foo: string } -declare interface I { +declare interface I2 { foo: T } declare module.exports: { @@ -41,4 +41,5 @@ declare module.exports: { declare opaque type Foo: Bar; declare opaque type ID; declare opaque type num: number; -declare opaque type NumArray; \ No newline at end of file +declare opaque type NumArray; +declare var sym: symbol; \ No newline at end of file diff --git a/packages/babel-generator/test/fixtures/flow/def-site-variance/input.js b/packages/babel-generator/test/fixtures/flow/def-site-variance/input.js index 9f00e80993d1..0891ba212de5 100644 --- a/packages/babel-generator/test/fixtures/flow/def-site-variance/input.js +++ b/packages/babel-generator/test/fixtures/flow/def-site-variance/input.js @@ -5,10 +5,10 @@ type T2 = { +p: T }; type T3 = { -p: T }; type T4 = { +[k:K]: V }; type T5 = { -[k:K]: V }; -interface I { +p: T } -interface I { -p: T } -interface I { +[k:K]: V } -interface I { -[k:K]: V } +interface I1 { +p: T } +interface I2 { -p: T } +interface I3 { +[k:K]: V } +interface I4 { -[k:K]: V } declare class I { +p: T } declare class I { -p: T } declare class I { +[k:K]: V } diff --git a/packages/babel-generator/test/fixtures/flow/def-site-variance/output.js b/packages/babel-generator/test/fixtures/flow/def-site-variance/output.js index 5c2b69d1a6dd..66dd195d22e1 100644 --- a/packages/babel-generator/test/fixtures/flow/def-site-variance/output.js +++ b/packages/babel-generator/test/fixtures/flow/def-site-variance/output.js @@ -15,16 +15,16 @@ type T4 = { type T5 = { -[k: K]: V }; -interface I { +interface I1 { +p: T } -interface I { +interface I2 { -p: T } -interface I { +interface I3 { +[k: K]: V } -interface I { +interface I4 { -[k: K]: V } declare class I { diff --git a/packages/babel-generator/test/fixtures/flow/enum-declaration/input.js b/packages/babel-generator/test/fixtures/flow/enum-declaration/input.js new file mode 100644 index 000000000000..f59944f78e18 --- /dev/null +++ b/packages/babel-generator/test/fixtures/flow/enum-declaration/input.js @@ -0,0 +1,36 @@ +enum E { + A = true, + B = false, +} +enum E of boolean { + A = true, + B = false, +} +enum E { + A = 1, + B = 2, +} +enum E of number { + A = 1, + B = 2, +} +enum E { + A, + B, +} +enum E of string { + A, + B, +} +enum E { + A = "a", + B = "b", +} +enum E of string { + A = "a", + B = "b", +} +enum E of symbol { + A, + B, +} diff --git a/packages/babel-generator/test/fixtures/flow/enum-declaration/options.json b/packages/babel-generator/test/fixtures/flow/enum-declaration/options.json new file mode 100644 index 000000000000..53fd48c051cb --- /dev/null +++ b/packages/babel-generator/test/fixtures/flow/enum-declaration/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["flow", { "enums": true }]] +} diff --git a/packages/babel-generator/test/fixtures/flow/enum-declaration/output.js b/packages/babel-generator/test/fixtures/flow/enum-declaration/output.js new file mode 100644 index 000000000000..f59944f78e18 --- /dev/null +++ b/packages/babel-generator/test/fixtures/flow/enum-declaration/output.js @@ -0,0 +1,36 @@ +enum E { + A = true, + B = false, +} +enum E of boolean { + A = true, + B = false, +} +enum E { + A = 1, + B = 2, +} +enum E of number { + A = 1, + B = 2, +} +enum E { + A, + B, +} +enum E of string { + A, + B, +} +enum E { + A = "a", + B = "b", +} +enum E of string { + A = "a", + B = "b", +} +enum E of symbol { + A, + B, +} diff --git a/packages/babel-generator/test/fixtures/flow/internal-slot/input.js b/packages/babel-generator/test/fixtures/flow/internal-slot/input.js index b00d3bd76f22..6056da54458a 100644 --- a/packages/babel-generator/test/fixtures/flow/internal-slot/input.js +++ b/packages/babel-generator/test/fixtures/flow/internal-slot/input.js @@ -1,7 +1,7 @@ declare class C { static [[foo]]: T } declare class C { [[foo]]: T } -interface I { [[foo]]: X } -interface I { [[foo]](): X } +interface I1 { [[foo]]: X } +interface I2 { [[foo]](): X } type T1 = { [[foo]]: X } type T2 = { [[foo]](): X } type T3 = { [[foo]]?: X } diff --git a/packages/babel-generator/test/fixtures/flow/internal-slot/output.js b/packages/babel-generator/test/fixtures/flow/internal-slot/output.js index 2a48fb9f186a..3b2b5ece1a23 100644 --- a/packages/babel-generator/test/fixtures/flow/internal-slot/output.js +++ b/packages/babel-generator/test/fixtures/flow/internal-slot/output.js @@ -4,10 +4,10 @@ declare class C { declare class C { [[foo]]: T } -interface I { +interface I1 { [[foo]]: X } -interface I { +interface I2 { [[foo]]() => X } type T1 = { diff --git a/packages/babel-generator/test/fixtures/flow/iterator-inside-interface/input.js b/packages/babel-generator/test/fixtures/flow/iterator-inside-interface/input.js index dab9a962acf7..7e5fb6309d97 100644 --- a/packages/babel-generator/test/fixtures/flow/iterator-inside-interface/input.js +++ b/packages/babel-generator/test/fixtures/flow/iterator-inside-interface/input.js @@ -1,7 +1,7 @@ -interface A { +interface A1 { @@iterator(): Iterator; } -interface A { +interface A2 { @@asyncIterator(): Iterator; } diff --git a/packages/babel-generator/test/fixtures/flow/iterator-inside-interface/output.js b/packages/babel-generator/test/fixtures/flow/iterator-inside-interface/output.js index ef726ab2fc5b..57b22ad84495 100644 --- a/packages/babel-generator/test/fixtures/flow/iterator-inside-interface/output.js +++ b/packages/babel-generator/test/fixtures/flow/iterator-inside-interface/output.js @@ -1,6 +1,6 @@ -interface A { +interface A1 { @@iterator(): Iterator } -interface A { +interface A2 { @@asyncIterator(): Iterator } \ No newline at end of file diff --git a/packages/babel-generator/test/fixtures/flow/type-annotations/input.js b/packages/babel-generator/test/fixtures/flow/type-annotations/input.js index e7335c30b72a..846595e9453e 100644 --- a/packages/babel-generator/test/fixtures/flow/type-annotations/input.js +++ b/packages/babel-generator/test/fixtures/flow/type-annotations/input.js @@ -128,3 +128,4 @@ var a34: {| id(x: T): T; |}; function foo27(numVal: number = 2) {} function foo28(numVal?: number = 2) {} export type * from "foo"; +const foo29: symbol = Symbol(); diff --git a/packages/babel-generator/test/fixtures/flow/type-annotations/output.js b/packages/babel-generator/test/fixtures/flow/type-annotations/output.js index 6465359f336d..71548b99c5ab 100644 --- a/packages/babel-generator/test/fixtures/flow/type-annotations/output.js +++ b/packages/babel-generator/test/fixtures/flow/type-annotations/output.js @@ -293,4 +293,5 @@ function foo27(numVal: number = 2) {} function foo28(numVal?: number = 2) {} -export type * from "foo"; \ No newline at end of file +export type * from "foo"; +const foo29: symbol = Symbol(); \ No newline at end of file diff --git a/packages/babel-generator/test/fixtures/misc/V8IntrinsicIdentifier/input.js b/packages/babel-generator/test/fixtures/misc/V8IntrinsicIdentifier/input.js new file mode 100644 index 000000000000..613a26cd98c7 --- /dev/null +++ b/packages/babel-generator/test/fixtures/misc/V8IntrinsicIdentifier/input.js @@ -0,0 +1 @@ +%DebugPrint(foo); diff --git a/packages/babel-generator/test/fixtures/misc/V8IntrinsicIdentifier/options.json b/packages/babel-generator/test/fixtures/misc/V8IntrinsicIdentifier/options.json new file mode 100644 index 000000000000..609458c2c65e --- /dev/null +++ b/packages/babel-generator/test/fixtures/misc/V8IntrinsicIdentifier/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["v8intrinsic"] +} diff --git a/packages/babel-generator/test/fixtures/misc/V8IntrinsicIdentifier/output.js b/packages/babel-generator/test/fixtures/misc/V8IntrinsicIdentifier/output.js new file mode 100644 index 000000000000..613a26cd98c7 --- /dev/null +++ b/packages/babel-generator/test/fixtures/misc/V8IntrinsicIdentifier/output.js @@ -0,0 +1 @@ +%DebugPrint(foo); diff --git a/packages/babel-generator/test/fixtures/parentheses/assignment-expression/input.js b/packages/babel-generator/test/fixtures/parentheses/assignment-expression/input.js index f1b168c7207f..0144ab8ea036 100644 --- a/packages/babel-generator/test/fixtures/parentheses/assignment-expression/input.js +++ b/packages/babel-generator/test/fixtures/parentheses/assignment-expression/input.js @@ -1,3 +1,6 @@ 1 + (a = 2); 1 + (a += 2); a = a || (a = {}); + +(a = b)(); +(a = b)?.(); diff --git a/packages/babel-generator/test/fixtures/parentheses/assignment-expression/output.js b/packages/babel-generator/test/fixtures/parentheses/assignment-expression/output.js index fbc4744e9e4d..85217e309303 100644 --- a/packages/babel-generator/test/fixtures/parentheses/assignment-expression/output.js +++ b/packages/babel-generator/test/fixtures/parentheses/assignment-expression/output.js @@ -1,3 +1,5 @@ 1 + (a = 2); 1 + (a += 2); -a = a || (a = {}); \ No newline at end of file +a = a || (a = {}); +(a = b)(); +(a = b)?.(); \ No newline at end of file diff --git a/packages/babel-generator/test/fixtures/parentheses/await-expression/input.js b/packages/babel-generator/test/fixtures/parentheses/await-expression/input.js index 828926300767..fc65d8c01bd2 100644 --- a/packages/babel-generator/test/fixtures/parentheses/await-expression/input.js +++ b/packages/babel-generator/test/fixtures/parentheses/await-expression/input.js @@ -1,6 +1,7 @@ -async function asdf() { +async function foo() { (await 1) || (await 2); (await b)(); + (await b)?.(); new (await b)(); true ? (await 1) : (await 2); await (1 ? 2 : 3); @@ -10,4 +11,5 @@ async function asdf() { async function a(b) { (await xhr({ url: "views/test.html" })).data; + (await replay())?.data; } diff --git a/packages/babel-generator/test/fixtures/parentheses/await-expression/output.js b/packages/babel-generator/test/fixtures/parentheses/await-expression/output.js index f717dddcbc3f..e864e993947d 100644 --- a/packages/babel-generator/test/fixtures/parentheses/await-expression/output.js +++ b/packages/babel-generator/test/fixtures/parentheses/await-expression/output.js @@ -1,6 +1,7 @@ -async function asdf() { +async function foo() { (await 1) || (await 2); (await b)(); + (await b)?.(); new (await b)(); true ? await 1 : await 2; await (1 ? 2 : 3); @@ -12,4 +13,5 @@ async function a(b) { (await xhr({ url: "views/test.html" })).data; + (await replay())?.data; } \ No newline at end of file diff --git a/packages/babel-generator/test/fixtures/parentheses/binary/input.js b/packages/babel-generator/test/fixtures/parentheses/binary/input.js new file mode 100644 index 000000000000..02ea8d1d2937 --- /dev/null +++ b/packages/babel-generator/test/fixtures/parentheses/binary/input.js @@ -0,0 +1,2 @@ +(a + b)[0]; +(a + b)?.[0]; diff --git a/packages/babel-generator/test/fixtures/parentheses/binary/output.js b/packages/babel-generator/test/fixtures/parentheses/binary/output.js new file mode 100644 index 000000000000..e520a37ec32a --- /dev/null +++ b/packages/babel-generator/test/fixtures/parentheses/binary/output.js @@ -0,0 +1,2 @@ +(a + b)[0]; +(a + b)?.[0]; \ No newline at end of file diff --git a/packages/babel-generator/test/fixtures/parentheses/class-extends/output.js b/packages/babel-generator/test/fixtures/parentheses/class-extends/output.js index a898c15b5a13..11b2ee978828 100644 --- a/packages/babel-generator/test/fixtures/parentheses/class-extends/output.js +++ b/packages/babel-generator/test/fixtures/parentheses/class-extends/output.js @@ -12,7 +12,7 @@ class A6 extends class {} {} class A7 extends (B ? C : D) {} -class A8 extends (new B()) {} +class A8 extends new B() {} class A9 extends (B, C) {} @@ -32,4 +32,4 @@ async function f1() { function* f2() { class A16 extends (yield 1) {} -} \ No newline at end of file +} diff --git a/packages/babel-generator/test/fixtures/parentheses/nullish-coalescing/input.js b/packages/babel-generator/test/fixtures/parentheses/nullish-coalescing/input.js new file mode 100644 index 000000000000..9c0ee73d545b --- /dev/null +++ b/packages/babel-generator/test/fixtures/parentheses/nullish-coalescing/input.js @@ -0,0 +1,17 @@ +const foo = 'test' +console.log((foo ?? '') == '') + + +a ?? (b ?? c); +(a ?? b) ?? c; + +a ?? (b || c); +a || (b ?? c); +(a ?? b) || c; +(a || b) ?? c; + +a ?? (b && c); +a && (b ?? c); +(a ?? b) && c; +(a && b) ?? c; + diff --git a/packages/babel-generator/test/fixtures/parentheses/nullish-coalescing/output.js b/packages/babel-generator/test/fixtures/parentheses/nullish-coalescing/output.js new file mode 100644 index 000000000000..38de5e1b5d2b --- /dev/null +++ b/packages/babel-generator/test/fixtures/parentheses/nullish-coalescing/output.js @@ -0,0 +1,12 @@ +const foo = 'test'; +console.log((foo ?? '') == ''); +a ?? b ?? c; +a ?? b ?? c; +a ?? (b || c); +a || (b ?? c); +(a ?? b) || c; +(a || b) ?? c; +a ?? (b && c); +a && (b ?? c); +(a ?? b) && c; +(a && b) ?? c; \ No newline at end of file diff --git a/packages/babel-generator/test/fixtures/parentheses/object/input.js b/packages/babel-generator/test/fixtures/parentheses/object/input.js index 1675763aabca..a798dd28ccb4 100644 --- a/packages/babel-generator/test/fixtures/parentheses/object/input.js +++ b/packages/babel-generator/test/fixtures/parentheses/object/input.js @@ -1,2 +1,6 @@ ({}) === foo; ({}) && foo; +({})(); +({})?.(); +({}).foo; +({})?.foo; diff --git a/packages/babel-generator/test/fixtures/parentheses/object/output.js b/packages/babel-generator/test/fixtures/parentheses/object/output.js index 6af6268b0cc1..5c5f910eb2a2 100644 --- a/packages/babel-generator/test/fixtures/parentheses/object/output.js +++ b/packages/babel-generator/test/fixtures/parentheses/object/output.js @@ -1,2 +1,6 @@ ({}) === foo; -({}) && foo; \ No newline at end of file +({}) && foo; +({})(); +({})?.(); +({}).foo; +({})?.foo; \ No newline at end of file diff --git a/packages/babel-generator/test/fixtures/parentheses/tagged-template-expression/input.js b/packages/babel-generator/test/fixtures/parentheses/tagged-template-expression/input.js index a2b14afaa872..c91ad40db835 100644 --- a/packages/babel-generator/test/fixtures/parentheses/tagged-template-expression/input.js +++ b/packages/babel-generator/test/fixtures/parentheses/tagged-template-expression/input.js @@ -1,3 +1,8 @@ (() => {})``; (function(){}``); -(a ? b : c)``; \ No newline at end of file +(a ? b : c)``; + +function* fn() { + (yield)`foo`; + (yield f)`foo`; +} diff --git a/packages/babel-generator/test/fixtures/parentheses/tagged-template-expression/output.js b/packages/babel-generator/test/fixtures/parentheses/tagged-template-expression/output.js index 6ddf8f48ab8e..bc4371fbdf61 100644 --- a/packages/babel-generator/test/fixtures/parentheses/tagged-template-expression/output.js +++ b/packages/babel-generator/test/fixtures/parentheses/tagged-template-expression/output.js @@ -1,3 +1,8 @@ (() => {})``; (function () {})``; -(a ? b : c)``; \ No newline at end of file +(a ? b : c)``; + +function* fn() { + (yield)`foo`; + (yield f)`foo`; +} \ No newline at end of file diff --git a/packages/babel-generator/test/fixtures/parentheses/unary-like/input.js b/packages/babel-generator/test/fixtures/parentheses/unary-like/input.js new file mode 100644 index 000000000000..ccc6620254f0 --- /dev/null +++ b/packages/babel-generator/test/fixtures/parentheses/unary-like/input.js @@ -0,0 +1,4 @@ +(void 0)(); +(void 0)?.(); +(void 0)[0]; +(void 0)?.[0]; diff --git a/packages/babel-generator/test/fixtures/parentheses/unary-like/output.js b/packages/babel-generator/test/fixtures/parentheses/unary-like/output.js new file mode 100644 index 000000000000..91797085444a --- /dev/null +++ b/packages/babel-generator/test/fixtures/parentheses/unary-like/output.js @@ -0,0 +1,4 @@ +(void 0)(); +(void 0)?.(); +(void 0)[0]; +(void 0)?.[0]; \ No newline at end of file diff --git a/packages/babel-generator/test/fixtures/parentheses/update-expression/input.js b/packages/babel-generator/test/fixtures/parentheses/update-expression/input.js index f3d794c2c99c..6dd4f1efd773 100644 --- a/packages/babel-generator/test/fixtures/parentheses/update-expression/input.js +++ b/packages/babel-generator/test/fixtures/parentheses/update-expression/input.js @@ -6,3 +6,9 @@ new (a++)(); new (++a); new (a++); + +(++a)?.(); +(a++)?.(); + +(++a)?.[0]; +(a++)?.[0]; diff --git a/packages/babel-generator/test/fixtures/parentheses/update-expression/output.js b/packages/babel-generator/test/fixtures/parentheses/update-expression/output.js index 0c30f7b869f4..8eb3ca9c5a82 100644 --- a/packages/babel-generator/test/fixtures/parentheses/update-expression/output.js +++ b/packages/babel-generator/test/fixtures/parentheses/update-expression/output.js @@ -3,4 +3,8 @@ new (++a)(); new (a++)(); new (++a)(); -new (a++)(); \ No newline at end of file +new (a++)(); +(++a)?.(); +(a++)?.(); +(++a)?.[0]; +(a++)?.[0]; diff --git a/packages/babel-generator/test/fixtures/parentheses/yield-expression/input.js b/packages/babel-generator/test/fixtures/parentheses/yield-expression/input.js index 2d6b7957f17c..ac2feefa401b 100644 --- a/packages/babel-generator/test/fixtures/parentheses/yield-expression/input.js +++ b/packages/babel-generator/test/fixtures/parentheses/yield-expression/input.js @@ -1,6 +1,7 @@ -function* asdf() { +function* foo() { (yield 1) || (yield 2); (yield b)(); + (yield b)?.(); new (yield b)(); (yield 1) ? (yield 2) : (yield 3); yield (1 ? 2 : 3); @@ -9,6 +10,7 @@ function* asdf() { function* a(b) { (yield xhr({ url: "views/test.html" })).data; + (yield replay())?.data; } (async function* () { diff --git a/packages/babel-generator/test/fixtures/parentheses/yield-expression/output.js b/packages/babel-generator/test/fixtures/parentheses/yield-expression/output.js index e7c3bcd100df..fbf1bce8e507 100644 --- a/packages/babel-generator/test/fixtures/parentheses/yield-expression/output.js +++ b/packages/babel-generator/test/fixtures/parentheses/yield-expression/output.js @@ -1,6 +1,7 @@ -function* asdf() { +function* foo() { (yield 1) || (yield 2); (yield b)(); + (yield b)?.(); new (yield b)(); (yield 1) ? yield 2 : yield 3; yield 1 ? 2 : 3; @@ -11,8 +12,9 @@ function* a(b) { (yield xhr({ url: "views/test.html" })).data; + (yield replay())?.data; } (async function* () { await (yield 1); -}); +}); \ No newline at end of file diff --git a/packages/babel-generator/test/fixtures/recordAndTupleSyntaxType/bar-record/input.js b/packages/babel-generator/test/fixtures/recordAndTupleSyntaxType/bar-record/input.js new file mode 100644 index 000000000000..93e090d7c975 --- /dev/null +++ b/packages/babel-generator/test/fixtures/recordAndTupleSyntaxType/bar-record/input.js @@ -0,0 +1 @@ +{| a: 1 |} diff --git a/packages/babel-generator/test/fixtures/recordAndTupleSyntaxType/bar-record/options.json b/packages/babel-generator/test/fixtures/recordAndTupleSyntaxType/bar-record/options.json new file mode 100644 index 000000000000..37424cd7c9a5 --- /dev/null +++ b/packages/babel-generator/test/fixtures/recordAndTupleSyntaxType/bar-record/options.json @@ -0,0 +1,4 @@ +{ + "plugins": [["recordAndTuple", { "syntaxType": "bar" }]], + "recordAndTupleSyntaxType": "bar" +} diff --git a/packages/babel-generator/test/fixtures/recordAndTupleSyntaxType/bar-record/output.js b/packages/babel-generator/test/fixtures/recordAndTupleSyntaxType/bar-record/output.js new file mode 100644 index 000000000000..84df2a985ceb --- /dev/null +++ b/packages/babel-generator/test/fixtures/recordAndTupleSyntaxType/bar-record/output.js @@ -0,0 +1,3 @@ +{| + a: 1 +|}; \ No newline at end of file diff --git a/packages/babel-generator/test/fixtures/recordAndTupleSyntaxType/bar-tuple/input.js b/packages/babel-generator/test/fixtures/recordAndTupleSyntaxType/bar-tuple/input.js new file mode 100644 index 000000000000..36a4579b0615 --- /dev/null +++ b/packages/babel-generator/test/fixtures/recordAndTupleSyntaxType/bar-tuple/input.js @@ -0,0 +1 @@ +[| 1 |] diff --git a/packages/babel-generator/test/fixtures/recordAndTupleSyntaxType/bar-tuple/options.json b/packages/babel-generator/test/fixtures/recordAndTupleSyntaxType/bar-tuple/options.json new file mode 100644 index 000000000000..37424cd7c9a5 --- /dev/null +++ b/packages/babel-generator/test/fixtures/recordAndTupleSyntaxType/bar-tuple/options.json @@ -0,0 +1,4 @@ +{ + "plugins": [["recordAndTuple", { "syntaxType": "bar" }]], + "recordAndTupleSyntaxType": "bar" +} diff --git a/packages/babel-generator/test/fixtures/recordAndTupleSyntaxType/bar-tuple/output.js b/packages/babel-generator/test/fixtures/recordAndTupleSyntaxType/bar-tuple/output.js new file mode 100644 index 000000000000..5ef84a9ba0d8 --- /dev/null +++ b/packages/babel-generator/test/fixtures/recordAndTupleSyntaxType/bar-tuple/output.js @@ -0,0 +1 @@ +[|1|]; \ No newline at end of file diff --git a/packages/babel-generator/test/fixtures/recordAndTupleSyntaxType/hash-record/input.js b/packages/babel-generator/test/fixtures/recordAndTupleSyntaxType/hash-record/input.js new file mode 100644 index 000000000000..6412030c4216 --- /dev/null +++ b/packages/babel-generator/test/fixtures/recordAndTupleSyntaxType/hash-record/input.js @@ -0,0 +1 @@ +#{ a: 1 } diff --git a/packages/babel-generator/test/fixtures/recordAndTupleSyntaxType/hash-record/options.json b/packages/babel-generator/test/fixtures/recordAndTupleSyntaxType/hash-record/options.json new file mode 100644 index 000000000000..e55454c942e7 --- /dev/null +++ b/packages/babel-generator/test/fixtures/recordAndTupleSyntaxType/hash-record/options.json @@ -0,0 +1,4 @@ +{ + "plugins": [["recordAndTuple", { "syntaxType": "hash" }]], + "recordAndTupleSyntaxType": "hash" +} diff --git a/packages/babel-generator/test/fixtures/recordAndTupleSyntaxType/hash-record/output.js b/packages/babel-generator/test/fixtures/recordAndTupleSyntaxType/hash-record/output.js new file mode 100644 index 000000000000..3db8963f5404 --- /dev/null +++ b/packages/babel-generator/test/fixtures/recordAndTupleSyntaxType/hash-record/output.js @@ -0,0 +1,3 @@ +#{ + a: 1 +}; \ No newline at end of file diff --git a/packages/babel-generator/test/fixtures/recordAndTupleSyntaxType/hash-tuple/input.js b/packages/babel-generator/test/fixtures/recordAndTupleSyntaxType/hash-tuple/input.js new file mode 100644 index 000000000000..53cbd2199dae --- /dev/null +++ b/packages/babel-generator/test/fixtures/recordAndTupleSyntaxType/hash-tuple/input.js @@ -0,0 +1 @@ +#[ 1 ] diff --git a/packages/babel-generator/test/fixtures/recordAndTupleSyntaxType/hash-tuple/options.json b/packages/babel-generator/test/fixtures/recordAndTupleSyntaxType/hash-tuple/options.json new file mode 100644 index 000000000000..e55454c942e7 --- /dev/null +++ b/packages/babel-generator/test/fixtures/recordAndTupleSyntaxType/hash-tuple/options.json @@ -0,0 +1,4 @@ +{ + "plugins": [["recordAndTuple", { "syntaxType": "hash" }]], + "recordAndTupleSyntaxType": "hash" +} diff --git a/packages/babel-generator/test/fixtures/recordAndTupleSyntaxType/hash-tuple/output.js b/packages/babel-generator/test/fixtures/recordAndTupleSyntaxType/hash-tuple/output.js new file mode 100644 index 000000000000..8922efd0ebd0 --- /dev/null +++ b/packages/babel-generator/test/fixtures/recordAndTupleSyntaxType/hash-tuple/output.js @@ -0,0 +1 @@ +#[1]; \ No newline at end of file diff --git a/packages/babel-generator/test/fixtures/recordAndTupleSyntaxType/invalid-option/input.js b/packages/babel-generator/test/fixtures/recordAndTupleSyntaxType/invalid-option/input.js new file mode 100644 index 000000000000..6412030c4216 --- /dev/null +++ b/packages/babel-generator/test/fixtures/recordAndTupleSyntaxType/invalid-option/input.js @@ -0,0 +1 @@ +#{ a: 1 } diff --git a/packages/babel-generator/test/fixtures/recordAndTupleSyntaxType/invalid-option/options.json b/packages/babel-generator/test/fixtures/recordAndTupleSyntaxType/invalid-option/options.json new file mode 100644 index 000000000000..8c3f43216d7a --- /dev/null +++ b/packages/babel-generator/test/fixtures/recordAndTupleSyntaxType/invalid-option/options.json @@ -0,0 +1,5 @@ +{ + "plugins": [["recordAndTuple", { "syntaxType": "hash" }]], + "recordAndTupleSyntaxType": "invalid", + "throws": "The \"recordAndTupleSyntaxType\" generator option must be \"bar\" or \"hash\" (\"invalid\" received)" +} diff --git a/packages/babel-generator/test/fixtures/recordAndTupleSyntaxType/missing-option/input.js b/packages/babel-generator/test/fixtures/recordAndTupleSyntaxType/missing-option/input.js new file mode 100644 index 000000000000..6412030c4216 --- /dev/null +++ b/packages/babel-generator/test/fixtures/recordAndTupleSyntaxType/missing-option/input.js @@ -0,0 +1 @@ +#{ a: 1 } diff --git a/packages/babel-generator/test/fixtures/recordAndTupleSyntaxType/missing-option/options.json b/packages/babel-generator/test/fixtures/recordAndTupleSyntaxType/missing-option/options.json new file mode 100644 index 000000000000..09a736a1a286 --- /dev/null +++ b/packages/babel-generator/test/fixtures/recordAndTupleSyntaxType/missing-option/options.json @@ -0,0 +1,4 @@ +{ + "plugins": [["recordAndTuple", { "syntaxType": "hash" }]], + "throws": "The \"recordAndTupleSyntaxType\" generator option must be \"bar\" or \"hash\" (undefined received)" +} diff --git a/packages/babel-generator/test/fixtures/regression/11304/input.js b/packages/babel-generator/test/fixtures/regression/11304/input.js new file mode 100644 index 000000000000..f195ee2d5298 --- /dev/null +++ b/packages/babel-generator/test/fixtures/regression/11304/input.js @@ -0,0 +1,7 @@ +function f() { + return ( + /*#__PURE__*/ + //test + 0 + ); +} diff --git a/packages/babel-generator/test/fixtures/regression/11304/options.json b/packages/babel-generator/test/fixtures/regression/11304/options.json new file mode 100644 index 000000000000..eb4e948bfaa5 --- /dev/null +++ b/packages/babel-generator/test/fixtures/regression/11304/options.json @@ -0,0 +1,3 @@ +{ + "compact": true +} diff --git a/packages/babel-generator/test/fixtures/regression/11304/output.js b/packages/babel-generator/test/fixtures/regression/11304/output.js new file mode 100644 index 000000000000..108feca555eb --- /dev/null +++ b/packages/babel-generator/test/fixtures/regression/11304/output.js @@ -0,0 +1,2 @@ +function f(){return/*#__PURE__*/ (//test +0);} \ No newline at end of file diff --git a/packages/babel-generator/test/fixtures/types/BigIntLiteral/options.json b/packages/babel-generator/test/fixtures/types/BigIntLiteral/options.json deleted file mode 100644 index c7885a10736b..000000000000 --- a/packages/babel-generator/test/fixtures/types/BigIntLiteral/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "plugins": ["bigInt"] } diff --git a/packages/babel-generator/test/fixtures/types/ClassBody-ClassProperty/input.js b/packages/babel-generator/test/fixtures/types/ClassBody-ClassProperty/input.js index 6256942ca5c5..87462c83f603 100644 --- a/packages/babel-generator/test/fixtures/types/ClassBody-ClassProperty/input.js +++ b/packages/babel-generator/test/fixtures/types/ClassBody-ClassProperty/input.js @@ -28,9 +28,9 @@ class Foo { foo = 0; bar = 1; #foo; - #foo = 1; - static #foo; - static #foo = Foo.#foo; + #foo2 = 1; + static #foo3; + static #foo4 = Foo.#foo; } class A1 { diff --git a/packages/babel-generator/test/fixtures/types/ClassBody-ClassProperty/output.js b/packages/babel-generator/test/fixtures/types/ClassBody-ClassProperty/output.js index 905fe31bdbfb..9970811aabad 100644 --- a/packages/babel-generator/test/fixtures/types/ClassBody-ClassProperty/output.js +++ b/packages/babel-generator/test/fixtures/types/ClassBody-ClassProperty/output.js @@ -27,9 +27,9 @@ class Foo { foo = 0; bar = 1; #foo; - #foo = 1; - static #foo; - static #foo = Foo.#foo; + #foo2 = 1; + static #foo3; + static #foo4 = Foo.#foo; } class A1 { @@ -69,4 +69,4 @@ class A6 { class A7 { static get static() {} -} +} \ No newline at end of file diff --git a/packages/babel-generator/test/fixtures/types/ClassBody-MethodDefinition/input.js b/packages/babel-generator/test/fixtures/types/ClassBody-MethodDefinition/input.js index ae3f4b33c003..67ccba8fc28b 100644 --- a/packages/babel-generator/test/fixtures/types/ClassBody-MethodDefinition/input.js +++ b/packages/babel-generator/test/fixtures/types/ClassBody-MethodDefinition/input.js @@ -6,13 +6,13 @@ class Foo { set foo(bar) {} async #foo() {} - #foo() {} - get #foo() {} - set #foo(bar) {} - * #foo() {} - async * #foo() {} - get #bar() {} - set #baz(taz) {} + #foo2() {} + get #foo3() {} + set #foo3(bar) {} + * #foo4() {} + async * #foo5() {} + get #bar6() {} + set #baz6(taz) {} static async foo() {} static foo() {} @@ -23,13 +23,13 @@ class Foo { static * foo() {} static async * foo() {} - static #foo() {} - static async #foo() {} + static #foo7() {} + static async #foo8() {} static ["foo"]() {} - static get #foo() {} - static set #foo(taz) {} - static * #foo() {} - static async * #foo() {} + static get #foo9() {} + static set #foo9(taz) {} + static * #foo10() {} + static async * #foo11() {} get () {} diff --git a/packages/babel-generator/test/fixtures/types/ClassBody-MethodDefinition/output.js b/packages/babel-generator/test/fixtures/types/ClassBody-MethodDefinition/output.js index 24f3e9229c84..7f66930a5422 100644 --- a/packages/babel-generator/test/fixtures/types/ClassBody-MethodDefinition/output.js +++ b/packages/babel-generator/test/fixtures/types/ClassBody-MethodDefinition/output.js @@ -11,19 +11,19 @@ class Foo { async #foo() {} - #foo() {} + #foo2() {} - get #foo() {} + get #foo3() {} - set #foo(bar) {} + set #foo3(bar) {} - *#foo() {} + *#foo4() {} - async *#foo() {} + async *#foo5() {} - get #bar() {} + get #bar6() {} - set #baz(taz) {} + set #baz6(taz) {} static async foo() {} @@ -41,19 +41,19 @@ class Foo { static async *foo() {} - static #foo() {} + static #foo7() {} - static async #foo() {} + static async #foo8() {} static ["foo"]() {} - static get #foo() {} + static get #foo9() {} - static set #foo(taz) {} + static set #foo9(taz) {} - static *#foo() {} + static *#foo10() {} - static async *#foo() {} + static async *#foo11() {} get() {} diff --git a/packages/babel-generator/test/fixtures/types/LogicalExpression/input.js b/packages/babel-generator/test/fixtures/types/LogicalExpression/input.js index 08cae4f71732..1f1ae59c50a7 100644 --- a/packages/babel-generator/test/fixtures/types/LogicalExpression/input.js +++ b/packages/babel-generator/test/fixtures/types/LogicalExpression/input.js @@ -1,4 +1,15 @@ foo ||bar; (x => x)|| bar; (function a(x){return x;})|| 2; -0||(function(){return alpha;}); \ No newline at end of file +0||(function(){return alpha;}); + +a && (b && c); +(a && b) && c; + +a || (b || c); +(a || b) || c; + +a || (b && c); +a && (b || c); +(a || b) && c; +(a && b) || c; diff --git a/packages/babel-generator/test/fixtures/types/LogicalExpression/output.js b/packages/babel-generator/test/fixtures/types/LogicalExpression/output.js index a27aa9ac1833..254b73ae3e8c 100644 --- a/packages/babel-generator/test/fixtures/types/LogicalExpression/output.js +++ b/packages/babel-generator/test/fixtures/types/LogicalExpression/output.js @@ -7,4 +7,13 @@ foo || bar; 0 || function () { return alpha; -}; \ No newline at end of file +}; + +a && b && c; +a && b && c; +a || b || c; +a || b || c; +a || b && c; +a && (b || c); +(a || b) && c; +a && b || c; \ No newline at end of file diff --git a/packages/babel-generator/test/fixtures/types/Optional-CallExpression/input.js b/packages/babel-generator/test/fixtures/types/Optional-CallExpression/input.js index bcd6e5b5d64f..0de13a68be71 100644 --- a/packages/babel-generator/test/fixtures/types/Optional-CallExpression/input.js +++ b/packages/babel-generator/test/fixtures/types/Optional-CallExpression/input.js @@ -5,6 +5,14 @@ foo?.(bar()); foo?.(bar("test")); foo(bar?.()); foo(bar?.("test")); +(foo?.())(); +(foo?.()).baz; +foo(bar?.baz); +foo(bar?.baz()); +foo(bar?.("test")); +foo[bar?.baz]; +foo[bar?.baz()]; +foo[bar?.("test")]; a.foo?.(); a.foo?.("foo"); a.foo?.("foo", "bar"); diff --git a/packages/babel-generator/test/fixtures/types/Optional-CallExpression/output.js b/packages/babel-generator/test/fixtures/types/Optional-CallExpression/output.js index 48dca55ae75c..ff468712077c 100644 --- a/packages/babel-generator/test/fixtures/types/Optional-CallExpression/output.js +++ b/packages/babel-generator/test/fixtures/types/Optional-CallExpression/output.js @@ -5,6 +5,14 @@ foo?.(bar()); foo?.(bar("test")); foo(bar?.()); foo(bar?.("test")); +(foo?.())(); +(foo?.()).baz; +foo(bar?.baz); +foo(bar?.baz()); +foo(bar?.("test")); +foo[bar?.baz]; +foo[bar?.baz()]; +foo[bar?.("test")]; a.foo?.(); a.foo?.("foo"); a.foo?.("foo", "bar"); diff --git a/packages/babel-generator/test/fixtures/typescript/arrow-function-assertion/input.js b/packages/babel-generator/test/fixtures/typescript/arrow-function-assertion/input.js new file mode 100644 index 000000000000..67e467cda8ed --- /dev/null +++ b/packages/babel-generator/test/fixtures/typescript/arrow-function-assertion/input.js @@ -0,0 +1,2 @@ +(x: any): asserts x => true; +(x: any): asserts x is boolean => true; \ No newline at end of file diff --git a/packages/babel-generator/test/fixtures/typescript/arrow-function-assertion/output.js b/packages/babel-generator/test/fixtures/typescript/arrow-function-assertion/output.js new file mode 100644 index 000000000000..b0befa69dc24 --- /dev/null +++ b/packages/babel-generator/test/fixtures/typescript/arrow-function-assertion/output.js @@ -0,0 +1,3 @@ +(x: any): asserts x => true; + +(x: any): asserts x is boolean => true; \ No newline at end of file diff --git a/packages/babel-generator/test/fixtures/typescript/class-field-declare/input.js b/packages/babel-generator/test/fixtures/typescript/class-field-declare/input.js new file mode 100644 index 000000000000..0e524a92bb8a --- /dev/null +++ b/packages/babel-generator/test/fixtures/typescript/class-field-declare/input.js @@ -0,0 +1,5 @@ +class A { + declare foo; + declare bar: string; + declare readonly bax: number; +} diff --git a/packages/babel-generator/test/fixtures/typescript/class-field-declare/options.json b/packages/babel-generator/test/fixtures/typescript/class-field-declare/options.json new file mode 100644 index 000000000000..9f3a0c2c0ff1 --- /dev/null +++ b/packages/babel-generator/test/fixtures/typescript/class-field-declare/options.json @@ -0,0 +1,4 @@ +{ + "sourceType": "module", + "plugins": ["typescript", "classProperties"] +} diff --git a/packages/babel-generator/test/fixtures/typescript/class-field-declare/output.js b/packages/babel-generator/test/fixtures/typescript/class-field-declare/output.js new file mode 100644 index 000000000000..d1d7b1be56aa --- /dev/null +++ b/packages/babel-generator/test/fixtures/typescript/class-field-declare/output.js @@ -0,0 +1,5 @@ +class A { + declare foo; + declare bar: string; + declare readonly bax: number; +} \ No newline at end of file diff --git a/packages/babel-generator/test/fixtures/typescript/export-declaration-type/input.js b/packages/babel-generator/test/fixtures/typescript/export-declaration-type/input.js new file mode 100644 index 000000000000..1d10049665df --- /dev/null +++ b/packages/babel-generator/test/fixtures/typescript/export-declaration-type/input.js @@ -0,0 +1,2 @@ +export interface A {} +export type B = string; diff --git a/packages/babel-generator/test/fixtures/typescript/export-declaration-type/output.js b/packages/babel-generator/test/fixtures/typescript/export-declaration-type/output.js new file mode 100644 index 000000000000..1d10049665df --- /dev/null +++ b/packages/babel-generator/test/fixtures/typescript/export-declaration-type/output.js @@ -0,0 +1,2 @@ +export interface A {} +export type B = string; diff --git a/packages/babel-generator/test/fixtures/typescript/export-type/input.js b/packages/babel-generator/test/fixtures/typescript/export-type/input.js new file mode 100644 index 000000000000..cbf7e0f4977e --- /dev/null +++ b/packages/babel-generator/test/fixtures/typescript/export-type/input.js @@ -0,0 +1,3 @@ +type A = 2; +export type { A }; +export type { B } from "./mod"; diff --git a/packages/babel-generator/test/fixtures/typescript/export-type/output.js b/packages/babel-generator/test/fixtures/typescript/export-type/output.js new file mode 100644 index 000000000000..51245b7a5ae7 --- /dev/null +++ b/packages/babel-generator/test/fixtures/typescript/export-type/output.js @@ -0,0 +1,3 @@ +type A = 2; +export type { A }; +export type { B } from "./mod"; \ No newline at end of file diff --git a/packages/babel-generator/test/fixtures/typescript/function-assertion/input.js b/packages/babel-generator/test/fixtures/typescript/function-assertion/input.js new file mode 100644 index 000000000000..17db65c5a77f --- /dev/null +++ b/packages/babel-generator/test/fixtures/typescript/function-assertion/input.js @@ -0,0 +1,2 @@ +function f(x: any): asserts x {} +(function(x: any): asserts x is boolean {}) diff --git a/packages/babel-generator/test/fixtures/typescript/function-assertion/output.js b/packages/babel-generator/test/fixtures/typescript/function-assertion/output.js new file mode 100644 index 000000000000..b55c84620cc9 --- /dev/null +++ b/packages/babel-generator/test/fixtures/typescript/function-assertion/output.js @@ -0,0 +1,3 @@ +function f(x: any): asserts x {} + +(function (x: any): asserts x is boolean {}); \ No newline at end of file diff --git a/packages/babel-generator/test/fixtures/typescript/import-type/input.js b/packages/babel-generator/test/fixtures/typescript/import-type/input.js new file mode 100644 index 000000000000..de5f7f5fc88a --- /dev/null +++ b/packages/babel-generator/test/fixtures/typescript/import-type/input.js @@ -0,0 +1,3 @@ +import type T from './mod'; +import type { A, B } from './mod'; +import type * as Types from './mod'; \ No newline at end of file diff --git a/packages/babel-generator/test/fixtures/typescript/import-type/output.js b/packages/babel-generator/test/fixtures/typescript/import-type/output.js new file mode 100644 index 000000000000..de5f7f5fc88a --- /dev/null +++ b/packages/babel-generator/test/fixtures/typescript/import-type/output.js @@ -0,0 +1,3 @@ +import type T from './mod'; +import type { A, B } from './mod'; +import type * as Types from './mod'; \ No newline at end of file diff --git a/packages/babel-generator/test/fixtures/typescript/interface-call-signature/input.js b/packages/babel-generator/test/fixtures/typescript/interface-call-signature/input.js index 5d6b541719ba..738804b2a41d 100644 --- a/packages/babel-generator/test/fixtures/typescript/interface-call-signature/input.js +++ b/packages/babel-generator/test/fixtures/typescript/interface-call-signature/input.js @@ -1,3 +1,4 @@ interface I { (x: number): void; + (x: string): void; } diff --git a/packages/babel-generator/test/fixtures/typescript/interface-call-signature/output.js b/packages/babel-generator/test/fixtures/typescript/interface-call-signature/output.js index 90b0b85044b1..df39231079bd 100644 --- a/packages/babel-generator/test/fixtures/typescript/interface-call-signature/output.js +++ b/packages/babel-generator/test/fixtures/typescript/interface-call-signature/output.js @@ -1,3 +1,4 @@ interface I { - (x: number): void -} \ No newline at end of file + (x: number): void; + (x: string): void; +} diff --git a/packages/babel-generator/test/fixtures/typescript/interface-construct-signature/input.js b/packages/babel-generator/test/fixtures/typescript/interface-construct-signature/input.js index d726e4c4ed1c..5d05c1fb19a1 100644 --- a/packages/babel-generator/test/fixtures/typescript/interface-construct-signature/input.js +++ b/packages/babel-generator/test/fixtures/typescript/interface-construct-signature/input.js @@ -1,3 +1,4 @@ interface I { new (x: number): void; + new (x: string): void; } diff --git a/packages/babel-generator/test/fixtures/typescript/interface-construct-signature/output.js b/packages/babel-generator/test/fixtures/typescript/interface-construct-signature/output.js index 0d29e5753dcf..d7b1fff898af 100644 --- a/packages/babel-generator/test/fixtures/typescript/interface-construct-signature/output.js +++ b/packages/babel-generator/test/fixtures/typescript/interface-construct-signature/output.js @@ -1,3 +1,4 @@ interface I { - new (x: number): void -} \ No newline at end of file + new (x: number): void; + new (x: string): void; +} diff --git a/packages/babel-generator/test/fixtures/typescript/non-null-parentheses/input.js b/packages/babel-generator/test/fixtures/typescript/non-null-parentheses/input.js new file mode 100644 index 000000000000..76a1cb8b73e4 --- /dev/null +++ b/packages/babel-generator/test/fixtures/typescript/non-null-parentheses/input.js @@ -0,0 +1,16 @@ +(a ? b : c)!; +(a ? b : c)!.d; +(a ? b : c!); +(a ? b : c!).d; + +foo!(); +foo()!; + +async function* f() { + (yield x)!; + yield x!; + (yield)!; + + (await x)!; + (await x!); +} diff --git a/packages/babel-generator/test/fixtures/typescript/non-null-parentheses/output.js b/packages/babel-generator/test/fixtures/typescript/non-null-parentheses/output.js new file mode 100644 index 000000000000..d31e4d1cb7a9 --- /dev/null +++ b/packages/babel-generator/test/fixtures/typescript/non-null-parentheses/output.js @@ -0,0 +1,14 @@ +(a ? b : c)!; +(a ? b : c)!.d; +a ? b : c!; +(a ? b : c!).d; +foo!(); +foo()!; + +async function* f() { + (yield x)!; + yield x!; + (yield)!; + (await x)!; + await x!; +} \ No newline at end of file diff --git a/packages/babel-generator/test/fixtures/whitespace/call-expression/input.js b/packages/babel-generator/test/fixtures/whitespace/call-expression/input.js new file mode 100644 index 000000000000..7cc11bd3c019 --- /dev/null +++ b/packages/babel-generator/test/fixtures/whitespace/call-expression/input.js @@ -0,0 +1,5 @@ +(() => {})(); +foo(); + +(() => {})?.(); +foo(); diff --git a/packages/babel-generator/test/fixtures/whitespace/call-expression/output.js b/packages/babel-generator/test/fixtures/whitespace/call-expression/output.js new file mode 100644 index 000000000000..e8f531fc4c7d --- /dev/null +++ b/packages/babel-generator/test/fixtures/whitespace/call-expression/output.js @@ -0,0 +1,7 @@ +(() => {})(); + +foo(); + +(() => {})?.(); + +foo(); diff --git a/packages/babel-generator/test/fixtures/whitespace/member-expression/input.js b/packages/babel-generator/test/fixtures/whitespace/member-expression/input.js new file mode 100644 index 000000000000..8b89c89a2fa3 --- /dev/null +++ b/packages/babel-generator/test/fixtures/whitespace/member-expression/input.js @@ -0,0 +1,5 @@ +foo = (() => {}).call(); +foo; + +foo = (() => {})?.call(); +foo; diff --git a/packages/babel-generator/test/fixtures/whitespace/member-expression/output.js b/packages/babel-generator/test/fixtures/whitespace/member-expression/output.js new file mode 100644 index 000000000000..957955ae9efa --- /dev/null +++ b/packages/babel-generator/test/fixtures/whitespace/member-expression/output.js @@ -0,0 +1,7 @@ +foo = (() => {}).call(); + +foo; + +foo = (() => {})?.call(); + +foo; \ No newline at end of file diff --git a/packages/babel-generator/test/index.js b/packages/babel-generator/test/index.js index 80bee85f9eaf..bde980029536 100644 --- a/packages/babel-generator/test/index.js +++ b/packages/babel-generator/test/index.js @@ -197,7 +197,7 @@ describe("generation", function() { const id2 = fn.body.body[0].expression; id2.name += "2"; - id2.loc.identiferName = "bar"; + id2.loc.identifierName = "bar"; const generated = generate( ast, @@ -295,9 +295,43 @@ describe("generation", function() { expect(generated).toHaveProperty("map"); expect(typeof generated.map).toBe("object"); }); + + it("wraps around infer inside an array type", () => { + const type = t.tsArrayType( + t.tsInferType(t.tsTypeParameter(null, null, "T")), + ); + + const output = generate(type).code; + expect(output).toBe("(infer T)[]"); + }); }); describe("programmatic generation", function() { + it("should add parenthesis when NullishCoalescing is used along with ||", function() { + // https://github.com/babel/babel/issues/10260 + const nullishCoalesc = t.logicalExpression( + "??", + t.logicalExpression("||", t.identifier("a"), t.identifier("b")), + t.identifier("c"), + ); + const output = generate(nullishCoalesc).code; + expect(output).toBe(`(a || b) ?? c`); + }); + + it("should add parenthesis when NullishCoalesing is used with &&", function() { + const nullishCoalesc = t.logicalExpression( + "??", + t.identifier("a"), + t.logicalExpression( + "&&", + t.identifier("b"), + t.logicalExpression("&&", t.identifier("c"), t.identifier("d")), + ), + ); + const output = generate(nullishCoalesc).code; + expect(output).toBe(`a ?? (b && c && d)`); + }); + it("numeric member expression", function() { // Should not generate `0.foo` const mem = t.memberExpression( @@ -500,22 +534,33 @@ suites.forEach(function(testSuite) { sourceMaps: task.sourceMap ? true : task.options.sourceMaps, }; - const result = generate(actualAst, options, actualCode); - - if (options.sourceMaps) { - expect(result.map).toEqual(task.sourceMap); - } + const run = () => { + return generate(actualAst, options, actualCode); + }; - if ( - !expected.code && - result.code && - fs.statSync(path.dirname(expected.loc)).isDirectory() && - !process.env.CI - ) { - console.log(`New test file created: ${expected.loc}`); - fs.writeFileSync(expected.loc, result.code); + const throwMsg = task.options.throws; + if (throwMsg) { + expect(() => run()).toThrow( + throwMsg === true ? undefined : throwMsg, + ); } else { - expect(result.code).toBe(expected.code); + const result = run(); + + if (options.sourceMaps) { + expect(result.map).toEqual(task.sourceMap); + } + + if ( + !expected.code && + result.code && + fs.statSync(path.dirname(expected.loc)).isDirectory() && + !process.env.CI + ) { + console.log(`New test file created: ${expected.loc}`); + fs.writeFileSync(expected.loc, result.code); + } else { + expect(result.code).toBe(expected.code); + } } } }, diff --git a/packages/babel-helper-annotate-as-pure/package.json b/packages/babel-helper-annotate-as-pure/package.json index 543b4fbf16ab..657e41d35e5f 100644 --- a/packages/babel-helper-annotate-as-pure/package.json +++ b/packages/babel-helper-annotate-as-pure/package.json @@ -1,6 +1,6 @@ { "name": "@babel/helper-annotate-as-pure", - "version": "7.0.0", + "version": "7.8.3", "description": "Helper function to annotate paths and nodes with #__PURE__ comment", "repository": "https://github.com/babel/babel/tree/master/packages/babel-helper-annotate-as-pure", "license": "MIT", @@ -9,6 +9,6 @@ }, "main": "lib/index.js", "dependencies": { - "@babel/types": "^7.0.0" + "@babel/types": "^7.8.3" } } diff --git a/packages/babel-helper-bindify-decorators/package.json b/packages/babel-helper-bindify-decorators/package.json index c7904cd201ea..005e4d816c36 100644 --- a/packages/babel-helper-bindify-decorators/package.json +++ b/packages/babel-helper-bindify-decorators/package.json @@ -1,6 +1,6 @@ { "name": "@babel/helper-bindify-decorators", - "version": "7.1.0", + "version": "7.8.3", "description": "Helper function to bindify decorators", "repository": "https://github.com/babel/babel/tree/master/packages/babel-helper-bindify-decorators", "license": "MIT", @@ -9,7 +9,7 @@ }, "main": "lib/index.js", "dependencies": { - "@babel/traverse": "^7.1.0", - "@babel/types": "^7.0.0" + "@babel/traverse": "^7.8.3", + "@babel/types": "^7.8.3" } } diff --git a/packages/babel-helper-builder-binary-assignment-operator-visitor/package.json b/packages/babel-helper-builder-binary-assignment-operator-visitor/package.json index 3e292cc12d6f..e22874ab1118 100644 --- a/packages/babel-helper-builder-binary-assignment-operator-visitor/package.json +++ b/packages/babel-helper-builder-binary-assignment-operator-visitor/package.json @@ -1,6 +1,6 @@ { "name": "@babel/helper-builder-binary-assignment-operator-visitor", - "version": "7.1.0", + "version": "7.8.3", "description": "Helper function to build binary assignment operator visitors", "repository": "https://github.com/babel/babel/tree/master/packages/babel-helper-builder-binary-assignment-operator-visitor", "license": "MIT", @@ -9,7 +9,7 @@ }, "main": "lib/index.js", "dependencies": { - "@babel/helper-explode-assignable-expression": "^7.1.0", - "@babel/types": "^7.0.0" + "@babel/helper-explode-assignable-expression": "^7.8.3", + "@babel/types": "^7.8.3" } } diff --git a/packages/babel-helper-builder-react-jsx-experimental/package.json b/packages/babel-helper-builder-react-jsx-experimental/package.json new file mode 100644 index 000000000000..a2640cfaac3c --- /dev/null +++ b/packages/babel-helper-builder-react-jsx-experimental/package.json @@ -0,0 +1,16 @@ +{ + "name": "@babel/helper-builder-react-jsx-experimental", + "version": "7.9.5", + "description": "Helper function to build react jsx", + "repository": "https://github.com/babel/babel/tree/master/packages/babel-helper-builder-react-jsx-experimental", + "license": "MIT", + "publishConfig": { + "access": "public" + }, + "main": "lib/index.js", + "dependencies": { + "@babel/helper-annotate-as-pure": "^7.8.3", + "@babel/helper-module-imports": "^7.8.3", + "@babel/types": "^7.9.5" + } +} diff --git a/packages/babel-helper-builder-react-jsx-experimental/src/index.js b/packages/babel-helper-builder-react-jsx-experimental/src/index.js new file mode 100644 index 000000000000..d42d84c34063 --- /dev/null +++ b/packages/babel-helper-builder-react-jsx-experimental/src/index.js @@ -0,0 +1,836 @@ +import * as t from "@babel/types"; +import { addNamed, addNamespace, isModule } from "@babel/helper-module-imports"; +import annotateAsPure from "@babel/helper-annotate-as-pure"; + +const DEFAULT = { + importSource: "react", + runtime: "automatic", + pragma: "React.createElement", + pragmaFrag: "React.Fragment", +}; + +export function helper(babel, options) { + const FILE_NAME_VAR = "_jsxFileName"; + + const JSX_SOURCE_ANNOTATION_REGEX = /\*?\s*@jsxImportSource\s+([^\s]+)/; + const JSX_RUNTIME_ANNOTATION_REGEX = /\*?\s*@jsxRuntime\s+([^\s]+)/; + + const JSX_ANNOTATION_REGEX = /\*?\s*@jsx\s+([^\s]+)/; + const JSX_FRAG_ANNOTATION_REGEX = /\*?\s*@jsxFrag\s+([^\s]+)/; + + // This is the number of possible import names + // development: jsxDEV, Fragment, createElement + // production: jsx, jsxs, Fragment, createElement + const IMPORT_NAME_SIZE = options.development ? 3 : 4; + + const { + importSource: IMPORT_SOURCE_DEFAULT = DEFAULT.importSource, + runtime: RUNTIME_DEFAULT = DEFAULT.runtime, + pragma: PRAGMA_DEFAULT = DEFAULT.pragma, + pragmaFrag: PRAGMA_FRAG_DEFAULT = DEFAULT.pragmaFrag, + } = options; + + const injectMetaPropertiesVisitor = { + JSXOpeningElement(path, state) { + for (const attr of path.get("attributes")) { + if (!attr.isJSXElement()) continue; + + const { name } = attr.node.name; + if (name === "__source" || name === "__self") { + throw path.buildCodeFrameError( + `__source and __self should not be defined in props and are reserved for internal usage.`, + ); + } + } + + const source = t.jsxAttribute( + t.jsxIdentifier("__source"), + t.jsxExpressionContainer(makeSource(path, state)), + ); + const self = t.jsxAttribute( + t.jsxIdentifier("__self"), + t.jsxExpressionContainer(t.thisExpression()), + ); + + path.pushContainer("attributes", [source, self]); + }, + }; + + return { + JSXNamespacedName(path, state) { + const throwIfNamespace = + state.opts.throwIfNamespace === undefined + ? true + : !!state.opts.throwIfNamespace; + if (throwIfNamespace) { + throw path.buildCodeFrameError( + `Namespace tags are not supported by default. React's JSX doesn't support namespace tags. \ +You can set \`throwIfNamespace: false\` to bypass this warning.`, + ); + } + }, + + JSXSpreadChild(path) { + throw path.buildCodeFrameError( + "Spread children are not supported in React.", + ); + }, + + JSXElement: { + exit(path, file) { + let callExpr; + if ( + file.get("@babel/plugin-react-jsx/runtime") === "classic" || + shouldUseCreateElement(path) + ) { + callExpr = buildCreateElementCall(path, file); + } else { + callExpr = buildJSXElementCall(path, file); + } + + path.replaceWith(t.inherits(callExpr, path.node)); + }, + }, + + JSXFragment: { + exit(path, file) { + let callExpr; + if (file.get("@babel/plugin-react-jsx/runtime") === "classic") { + callExpr = buildCreateElementFragmentCall(path, file); + } else { + callExpr = buildJSXFragmentCall(path, file); + } + + path.replaceWith(t.inherits(callExpr, path.node)); + }, + }, + + JSXAttribute(path) { + if (t.isJSXElement(path.node.value)) { + path.node.value = t.jsxExpressionContainer(path.node.value); + } + }, + + Program: { + enter(path, state) { + if (hasJSX(path)) { + const { file } = state; + let runtime = RUNTIME_DEFAULT; + + // For jsx mode + let source = IMPORT_SOURCE_DEFAULT; + let sourceSet = !!options.importSource; + + // For createElement mode + let pragma = PRAGMA_DEFAULT; + let pragmaFrag = PRAGMA_FRAG_DEFAULT; + let pragmaSet = !!options.pragma; + let pragmaFragSet = !!options.pragmaFrag; + + if (file.ast.comments) { + for (const comment of (file.ast.comments: Array)) { + const sourceMatches = JSX_SOURCE_ANNOTATION_REGEX.exec( + comment.value, + ); + if (sourceMatches) { + source = sourceMatches[1]; + sourceSet = true; + } + + const runtimeMatches = JSX_RUNTIME_ANNOTATION_REGEX.exec( + comment.value, + ); + if (runtimeMatches) { + runtime = runtimeMatches[1]; + } + + const jsxMatches = JSX_ANNOTATION_REGEX.exec(comment.value); + if (jsxMatches) { + pragma = jsxMatches[1]; + pragmaSet = true; + } + const jsxFragMatches = JSX_FRAG_ANNOTATION_REGEX.exec( + comment.value, + ); + if (jsxFragMatches) { + pragmaFrag = jsxFragMatches[1]; + pragmaFragSet = true; + } + } + } + + state.set("@babel/plugin-react-jsx/runtime", runtime); + if (runtime === "classic") { + if (sourceSet) { + throw path.buildCodeFrameError( + `importSource cannot be set when runtime is classic.`, + ); + } + state.set( + "@babel/plugin-react-jsx/createElementIdentifier", + createIdentifierParser(pragma), + ); + state.set( + "@babel/plugin-react-jsx/jsxFragIdentifier", + createIdentifierParser(pragmaFrag), + ); + state.set("@babel/plugin-react-jsx/usedFragment", false); + state.set( + "@babel/plugin-react-jsx/pragmaSet", + pragma !== DEFAULT.pragma, + ); + state.set( + "@babel/plugin-react-jsx/pragmaFragSet", + pragmaFrag !== DEFAULT.pragmaFrag, + ); + } else if (runtime === "automatic") { + if (pragmaSet || pragmaFragSet) { + throw path.buildCodeFrameError( + `pragma and pragmaFrag cannot be set when runtime is automatic.`, + ); + } + + const importName = addAutoImports(path, { + ...state.opts, + source, + }); + + state.set( + "@babel/plugin-react-jsx/jsxIdentifier", + createIdentifierParser( + createIdentifierName( + path, + options.development ? "jsxDEV" : "jsx", + importName, + ), + ), + ); + state.set( + "@babel/plugin-react-jsx/jsxStaticIdentifier", + createIdentifierParser( + createIdentifierName( + path, + options.development ? "jsxDEV" : "jsxs", + importName, + ), + ), + ); + + state.set( + "@babel/plugin-react-jsx/createElementIdentifier", + createIdentifierParser( + createIdentifierName(path, "createElement", importName), + ), + ); + + state.set( + "@babel/plugin-react-jsx/jsxFragIdentifier", + createIdentifierParser( + createIdentifierName(path, "Fragment", importName), + ), + ); + + state.set( + "@babel/plugin-react-jsx/importSourceSet", + source !== DEFAULT.importSource, + ); + } else { + throw path.buildCodeFrameError( + `Runtime must be either "classic" or "automatic".`, + ); + } + + if (options.development) { + path.traverse(injectMetaPropertiesVisitor, state); + } + } + }, + + exit(path, state) { + if ( + state.get("@babel/plugin-react-jsx/runtime") === "classic" && + state.get("@babel/plugin-react-jsx/pragmaSet") && + state.get("@babel/plugin-react-jsx/usedFragment") && + !state.get("@babel/plugin-react-jsx/pragmaFragSet") + ) { + throw new Error( + "transform-react-jsx: pragma has been set but " + + "pragmaFrag has not been set", + ); + } + }, + }, + }; + + // We want to use React.createElement, even in the case of + // jsx, for
to distinguish it + // from
. This is an intermediary + // step while we deprecate key spread from props. Afterwards, + // we will stop using createElement in the transform. + function shouldUseCreateElement(path) { + const openingPath = path.get("openingElement"); + const attributes = openingPath.node.attributes; + + let seenPropsSpread = false; + for (let i = 0; i < attributes.length; i++) { + const attr = attributes[i]; + if ( + seenPropsSpread && + t.isJSXAttribute(attr) && + attr.name.name === "key" + ) { + return true; + } else if (t.isJSXSpreadAttribute(attr)) { + seenPropsSpread = true; + } + } + return false; + } + + function createIdentifierName(path, name, importName) { + if (isModule(path)) { + const identifierName = `${importName[name]}`; + return identifierName; + } else { + return `${importName[name]}.${name}`; + } + } + + function getImportNames(parentPath) { + const imports = new Set(); + + parentPath.traverse({ + "JSXElement|JSXFragment"(path) { + if (path.type === "JSXFragment") imports.add("Fragment"); + const openingPath = path.get("openingElement"); + + const validChildren = t.react.buildChildren(openingPath.parent); + let importName; + if (path.type === "JSXElement" && shouldUseCreateElement(path)) { + importName = "createElement"; + } else if (options.development) { + importName = "jsxDEV"; + } else if (validChildren.length > 1) { + importName = "jsxs"; + } else { + importName = "jsx"; + } + imports.add(importName); + + if (imports.size === IMPORT_NAME_SIZE) { + path.stop(); + } + }, + }); + return imports; + } + + function hasJSX(parentPath) { + let fileHasJSX = false; + parentPath.traverse({ + "JSXElement|JSXFragment"(path) { + fileHasJSX = true; + path.stop(); + }, + }); + + return fileHasJSX; + } + + function getSource(source, importName) { + switch (importName) { + case "Fragment": + return `${source}/${ + options.development ? "jsx-dev-runtime" : "jsx-runtime" + }`; + case "jsxDEV": + return `${source}/jsx-dev-runtime`; + case "jsx": + case "jsxs": + return `${source}/jsx-runtime`; + case "createElement": + return source; + } + } + + function addAutoImports(path, state) { + const imports = getImportNames(path, state); + if (isModule(path)) { + // import {jsx} from "react"; + // import {createElement} from "react"; + const importMap = {}; + + imports.forEach(importName => { + if (!importMap[importName]) { + importMap[importName] = addNamed( + path, + importName, + getSource(state.source, importName), + { + importedInterop: "uncompiled", + ensureLiveReference: true, + }, + ).name; + } + }); + + return importMap; + } else { + const importMap = {}; + const sourceMap = {}; + imports.forEach(importName => { + const source = getSource(state.source, importName); + if (!importMap[importName]) { + if (!sourceMap[source]) { + // var _react = require("react") + sourceMap[source] = addNamespace(path, source, { + importedInterop: "uncompiled", + ensureLiveReference: true, + }).name; + } + + importMap[importName] = sourceMap[source]; + } + }); + return importMap; + } + } + + function createIdentifierParser(id) { + return () => { + return id + .split(".") + .map(name => t.identifier(name)) + .reduce((object, property) => t.memberExpression(object, property)); + }; + } + + function makeTrace(fileNameIdentifier, lineNumber, column0Based) { + const fileLineLiteral = + lineNumber != null ? t.numericLiteral(lineNumber) : t.nullLiteral(); + + const fileColumnLiteral = + column0Based != null + ? t.numericLiteral(column0Based + 1) + : t.nullLiteral(); + + const fileNameProperty = t.objectProperty( + t.identifier("fileName"), + fileNameIdentifier, + ); + const lineNumberProperty = t.objectProperty( + t.identifier("lineNumber"), + fileLineLiteral, + ); + const columnNumberProperty = t.objectProperty( + t.identifier("columnNumber"), + fileColumnLiteral, + ); + return t.objectExpression([ + fileNameProperty, + lineNumberProperty, + columnNumberProperty, + ]); + } + + function makeSource(path, state) { + const location = path.node.loc; + if (!location) { + // the element was generated and doesn't have location information + return; + } + + if (!state.fileNameIdentifier) { + const { filename = "" } = state; + + const fileNameIdentifier = path.scope.generateUidIdentifier( + FILE_NAME_VAR, + ); + const scope = path.hub.getScope(); + if (scope) { + scope.push({ + id: fileNameIdentifier, + init: t.stringLiteral(filename), + }); + } + state.fileNameIdentifier = fileNameIdentifier; + } + + return makeTrace( + state.fileNameIdentifier, + location.start.line, + location.start.column, + ); + } + + function convertJSXIdentifier(node, parent) { + if (t.isJSXIdentifier(node)) { + if (node.name === "this" && t.isReferenced(node, parent)) { + return t.thisExpression(); + } else if (t.isValidIdentifier(node.name, false)) { + node.type = "Identifier"; + } else { + return t.stringLiteral(node.name); + } + } else if (t.isJSXMemberExpression(node)) { + return t.memberExpression( + convertJSXIdentifier(node.object, node), + convertJSXIdentifier(node.property, node), + ); + } else if (t.isJSXNamespacedName(node)) { + /** + * If the flag "throwIfNamespace" is false + * print XMLNamespace like string literal + */ + return t.stringLiteral(`${node.namespace.name}:${node.name.name}`); + } + + return node; + } + + function convertAttributeValue(node) { + if (t.isJSXExpressionContainer(node)) { + return node.expression; + } else { + return node; + } + } + + function convertAttribute(node) { + const value = convertAttributeValue(node.value || t.booleanLiteral(true)); + + if (t.isJSXSpreadAttribute(node)) { + return t.spreadElement(node.argument); + } + + if (t.isStringLiteral(value) && !t.isJSXExpressionContainer(node.value)) { + value.value = value.value.replace(/\n\s+/g, " "); + + // "raw" JSXText should not be used from a StringLiteral because it needs to be escaped. + if (value.extra && value.extra.raw) { + delete value.extra.raw; + } + } + + if (t.isJSXNamespacedName(node.name)) { + node.name = t.stringLiteral( + node.name.namespace.name + ":" + node.name.name.name, + ); + } else if (t.isValidIdentifier(node.name.name, false)) { + node.name.type = "Identifier"; + } else { + node.name = t.stringLiteral(node.name.name); + } + + return t.inherits(t.objectProperty(node.name, value), node); + } + + // Builds JSX into: + // Production: React.jsx(type, arguments, key) + // Development: React.jsxDEV(type, arguments, key, isStaticChildren, source, self) + function buildJSXElementCall(path, file) { + const openingPath = path.get("openingElement"); + openingPath.parent.children = t.react.buildChildren(openingPath.parent); + + const tagExpr = convertJSXIdentifier( + openingPath.node.name, + openingPath.node, + ); + const args = []; + + let tagName; + if (t.isIdentifier(tagExpr)) { + tagName = tagExpr.name; + } else if (t.isLiteral(tagExpr)) { + tagName = tagExpr.value; + } + + const state = { + tagExpr: tagExpr, + tagName: tagName, + args: args, + pure: false, + }; + + if (options.pre) { + options.pre(state, file); + } + + let attribs = []; + const extracted = Object.create(null); + + // for React.jsx, key, __source (dev), and __self (dev) is passed in as + // a separate argument rather than in the args object. We go through the + // props and filter out these three keywords so we can pass them in + // as separate arguments later + for (const attr of openingPath.get("attributes")) { + if (attr.isJSXAttribute() && t.isJSXIdentifier(attr.node.name)) { + const { name } = attr.node.name; + switch (name) { + case "__source": + case "__self": + if (extracted[name]) throw sourceSelfError(path, name); + /* falls through */ + case "key": + extracted[name] = convertAttributeValue(attr.node.value); + break; + default: + attribs.push(attr.node); + } + } else { + attribs.push(attr.node); + } + } + + if (attribs.length || path.node.children.length) { + attribs = buildJSXOpeningElementAttributes( + attribs, + file, + path.node.children, + ); + } else { + // attributes should never be null + attribs = t.objectExpression([]); + } + + args.push(attribs); + + if (!options.development) { + if (extracted.key !== undefined) { + args.push(extracted.key); + } + } else { + // isStaticChildren, __source, and __self are only used in development + // automatically include __source and __self in this plugin + // so we can eliminate the need for separate Babel plugins in Babel 8 + args.push( + extracted.key ?? path.scope.buildUndefinedNode(), + t.booleanLiteral(path.node.children.length > 1), + extracted.__source ?? path.scope.buildUndefinedNode(), + extracted.__self ?? t.thisExpression(), + ); + } + + if (options.post) { + options.post(state, file); + } + + const call = + state.call || + t.callExpression( + path.node.children.length > 1 ? state.jsxStaticCallee : state.jsxCallee, + args, + ); + if (state.pure) annotateAsPure(call); + + return call; + } + + // Builds props for React.jsx. This function adds children into the props + // and ensures that props is always an object + function buildJSXOpeningElementAttributes(attribs, file, children) { + const props = attribs.map(convertAttribute); + + // In React.jsx, children is no longer a separate argument, but passed in + // through the argument object + if (children && children.length > 0) { + if (children.length === 1) { + props.push(t.objectProperty(t.identifier("children"), children[0])); + } else { + props.push( + t.objectProperty( + t.identifier("children"), + t.arrayExpression(children), + ), + ); + } + } + + return t.objectExpression(props); + } + + // Builds JSX Fragment <> into + // Production: React.jsx(type, arguments) + // Development: React.jsxDEV(type, { children}) + function buildJSXFragmentCall(path, file) { + const openingPath = path.get("openingElement"); + openingPath.parent.children = t.react.buildChildren(openingPath.parent); + + const args = []; + const tagName = null; + const tagExpr = file.get("@babel/plugin-react-jsx/jsxFragIdentifier")(); + + const state = { + tagExpr: tagExpr, + tagName: tagName, + args: args, + pure: false, + }; + + if (options.pre) { + options.pre(state, file); + } + + let childrenNode; + if (path.node.children.length > 0) { + if (path.node.children.length === 1) { + childrenNode = path.node.children[0]; + } else { + childrenNode = t.arrayExpression(path.node.children); + } + } + + args.push( + t.objectExpression( + childrenNode !== undefined + ? [t.objectProperty(t.identifier("children"), childrenNode)] + : [], + ), + ); + + if (options.development) { + args.push( + path.scope.buildUndefinedNode(), + t.booleanLiteral(path.node.children.length > 1), + ); + } + + if (options.post) { + options.post(state, file); + } + + const call = + state.call || + t.callExpression( + path.node.children.length > 1 ? state.jsxStaticCallee : state.jsxCallee, + args, + ); + if (state.pure) annotateAsPure(call); + + return call; + } + + function buildCreateElementFragmentCall(path, file) { + if (options.filter && !options.filter(path.node, file)) { + return; + } + + const openingPath = path.get("openingElement"); + openingPath.parent.children = t.react.buildChildren(openingPath.parent); + + const args = []; + const tagName = null; + const tagExpr = file.get("@babel/plugin-react-jsx/jsxFragIdentifier")(); + + const state = { + tagExpr: tagExpr, + tagName: tagName, + args: args, + pure: false, + }; + + if (options.pre) { + options.pre(state, file); + } + + // no attributes are allowed with <> syntax + args.push(t.nullLiteral(), ...path.node.children); + + if (options.post) { + options.post(state, file); + } + + file.set("@babel/plugin-react-jsx/usedFragment", true); + + const call = + state.call || t.callExpression(state.createElementCallee, args); + if (state.pure) annotateAsPure(call); + + return call; + } + + // Builds JSX into: + // Production: React.createElement(type, arguments, children) + // Development: React.createElement(type, arguments, children, source, self) + function buildCreateElementCall(path, file) { + const openingPath = path.get("openingElement"); + openingPath.parent.children = t.react.buildChildren(openingPath.parent); + + const tagExpr = convertJSXIdentifier( + openingPath.node.name, + openingPath.node, + ); + const args = []; + + let tagName; + if (t.isIdentifier(tagExpr)) { + tagName = tagExpr.name; + } else if (t.isLiteral(tagExpr)) { + tagName = tagExpr.value; + } + + const state = { + tagExpr: tagExpr, + tagName: tagName, + args: args, + pure: false, + }; + + if (options.pre) { + options.pre(state, file); + } + + const attribs = buildCreateElementOpeningElementAttributes( + path, + openingPath.node.attributes, + ); + + args.push(attribs, ...path.node.children); + + if (options.post) { + options.post(state, file); + } + + const call = + state.call || t.callExpression(state.createElementCallee, args); + if (state.pure) annotateAsPure(call); + + return call; + } + + /** + * The logic for this is quite terse. It's because we need to + * support spread elements. We loop over all attributes, + * breaking on spreads, we then push a new object containing + * all prior attributes to an array for later processing. + */ + function buildCreateElementOpeningElementAttributes(path, attribs) { + const props = []; + const found = Object.create(null); + + for (const attr of attribs) { + const name = + t.isJSXAttribute(attr) && + t.isJSXIdentifier(attr.name) && + attr.name.name; + + if (name === "__source" || name === "__self") { + if (found[name]) throw sourceSelfError(path, name); + found[name] = true; + if (!options.development) continue; + } + + props.push(convertAttribute(attr)); + } + + return props.length > 0 ? t.objectExpression(props) : t.nullLiteral(); + } + + function sourceSelfError(path, name) { + const pluginName = `transform-react-jsx-${name.slice(2)}`; + + return path.buildCodeFrameError( + `Duplicate ${name} prop found. You are most likely using the deprecated ${pluginName} Babel plugin. Both __source and __self are automatically set when using the automatic runtime. Please remove transform-react-jsx-source and transform-react-jsx-self from your Babel config.`, + ); + } +} diff --git a/packages/babel-helper-builder-react-jsx/package.json b/packages/babel-helper-builder-react-jsx/package.json index 7b13e4b4753a..c8050dcfdb32 100644 --- a/packages/babel-helper-builder-react-jsx/package.json +++ b/packages/babel-helper-builder-react-jsx/package.json @@ -1,6 +1,6 @@ { "name": "@babel/helper-builder-react-jsx", - "version": "7.3.0", + "version": "7.9.0", "description": "Helper function to build react jsx", "repository": "https://github.com/babel/babel/tree/master/packages/babel-helper-builder-react-jsx", "license": "MIT", @@ -9,7 +9,7 @@ }, "main": "lib/index.js", "dependencies": { - "@babel/types": "^7.3.0", - "esutils": "^2.0.0" + "@babel/helper-annotate-as-pure": "^7.8.3", + "@babel/types": "^7.9.0" } } diff --git a/packages/babel-helper-builder-react-jsx/src/index.js b/packages/babel-helper-builder-react-jsx/src/index.js index 3602ecb8496e..f90014fe957d 100644 --- a/packages/babel-helper-builder-react-jsx/src/index.js +++ b/packages/babel-helper-builder-react-jsx/src/index.js @@ -1,11 +1,12 @@ -import esutils from "esutils"; import * as t from "@babel/types"; +import annotateAsPure from "@babel/helper-annotate-as-pure"; type ElementState = { tagExpr: Object, // tag node tagName: ?string, // raw string tag name args: Array, // array of call arguments call?: Object, // optional call property that can be set to override the call expression returned + pure: boolean, // true if the element can be marked with a #__PURE__ annotation }; export default function(opts) { @@ -15,7 +16,7 @@ export default function(opts) { if (opts.throwIfNamespace) { throw path.buildCodeFrameError( `Namespace tags are not supported by default. React's JSX doesn't support namespace tags. \ -You can turn on the 'throwIfNamespace' flag to bypass this warning.`, +You can set \`throwIfNamespace: false\` to bypass this warning.`, ); } }; @@ -55,7 +56,7 @@ You can turn on the 'throwIfNamespace' flag to bypass this warning.`, if (t.isJSXIdentifier(node)) { if (node.name === "this" && t.isReferenced(node, parent)) { return t.thisExpression(); - } else if (esutils.keyword.isIdentifierNameES6(node.name)) { + } else if (t.isValidIdentifier(node.name, false)) { node.type = "Identifier"; } else { return t.stringLiteral(node.name); @@ -87,20 +88,22 @@ You can turn on the 'throwIfNamespace' flag to bypass this warning.`, function convertAttribute(node) { const value = convertAttributeValue(node.value || t.booleanLiteral(true)); + if (t.isJSXSpreadAttribute(node)) { + return t.spreadElement(node.argument); + } + if (t.isStringLiteral(value) && !t.isJSXExpressionContainer(node.value)) { value.value = value.value.replace(/\n\s+/g, " "); // "raw" JSXText should not be used from a StringLiteral because it needs to be escaped. - if (value.extra && value.extra.raw) { - delete value.extra.raw; - } + delete value.extra?.raw; } if (t.isJSXNamespacedName(node.name)) { node.name = t.stringLiteral( node.name.namespace.name + ":" + node.name.name.name, ); - } else if (esutils.keyword.isIdentifierNameES6(node.name.name)) { + } else if (t.isValidIdentifier(node.name.name, false)) { node.name.type = "Identifier"; } else { node.name = t.stringLiteral(node.name.name); @@ -132,6 +135,7 @@ You can turn on the 'throwIfNamespace' flag to bypass this warning.`, tagExpr: tagExpr, tagName: tagName, args: args, + pure: false, }; if (opts.pre) { @@ -151,7 +155,10 @@ You can turn on the 'throwIfNamespace' flag to bypass this warning.`, opts.post(state, file); } - return state.call || t.callExpression(state.callee, args); + const call = state.call || t.callExpression(state.callee, args); + if (state.pure) annotateAsPure(call); + + return call; } function pushProps(_props, objs) { @@ -172,6 +179,14 @@ You can turn on the 'throwIfNamespace' flag to bypass this warning.`, let _props = []; const objs = []; + const { useSpread = false } = file.opts; + if (typeof useSpread !== "boolean") { + throw new Error( + "transform-react-jsx currently only accepts a boolean option for " + + "useSpread (defaults to false)", + ); + } + const useBuiltIns = file.opts.useBuiltIns || false; if (typeof useBuiltIns !== "boolean") { throw new Error( @@ -180,6 +195,18 @@ You can turn on the 'throwIfNamespace' flag to bypass this warning.`, ); } + if (useSpread && useBuiltIns) { + throw new Error( + "transform-react-jsx currently only accepts useBuiltIns or useSpread " + + "but not both", + ); + } + + if (useSpread) { + const props = attribs.map(convertAttribute); + return t.objectExpression(props); + } + while (attribs.length) { const prop = attribs.shift(); if (t.isJSXSpreadAttribute(prop)) { @@ -226,6 +253,7 @@ You can turn on the 'throwIfNamespace' flag to bypass this warning.`, tagExpr: tagExpr, tagName: tagName, args: args, + pure: false, }; if (opts.pre) { @@ -240,6 +268,10 @@ You can turn on the 'throwIfNamespace' flag to bypass this warning.`, } file.set("usedFragment", true); - return state.call || t.callExpression(state.callee, args); + + const call = state.call || t.callExpression(state.callee, args); + if (state.pure) annotateAsPure(call); + + return call; } } diff --git a/packages/babel-helper-call-delegate/package.json b/packages/babel-helper-call-delegate/package.json index 3e7fd81bcf40..b93029073783 100644 --- a/packages/babel-helper-call-delegate/package.json +++ b/packages/babel-helper-call-delegate/package.json @@ -1,6 +1,6 @@ { "name": "@babel/helper-call-delegate", - "version": "7.4.4", + "version": "7.8.7", "description": "Helper function to call delegate", "repository": "https://github.com/babel/babel/tree/master/packages/babel-helper-call-delegate", "license": "MIT", @@ -9,8 +9,8 @@ }, "main": "lib/index.js", "dependencies": { - "@babel/helper-hoist-variables": "^7.4.4", - "@babel/traverse": "^7.4.4", - "@babel/types": "^7.4.4" + "@babel/helper-hoist-variables": "^7.8.3", + "@babel/traverse": "^7.8.3", + "@babel/types": "^7.8.7" } } diff --git a/packages/babel-helper-call-delegate/src/index.js b/packages/babel-helper-call-delegate/src/index.js index d4bf041d0131..7843584620e4 100644 --- a/packages/babel-helper-call-delegate/src/index.js +++ b/packages/babel-helper-call-delegate/src/index.js @@ -18,7 +18,11 @@ const visitor = { }, }; -export default function(path: NodePath, scope = path.scope) { +export default function( + path: NodePath, + scope = path.scope, + shouldHoistVariables = true, +) { const { node } = path; const container = t.functionExpression( null, @@ -31,8 +35,9 @@ export default function(path: NodePath, scope = path.scope) { let callee = container; let args = []; - // todo: only hoist if necessary - hoistVariables(path, id => scope.push({ id })); + if (shouldHoistVariables) { + hoistVariables(path, id => scope.push({ id })); + } const state = { foundThis: false, diff --git a/packages/babel-plugin-syntax-async-generators/.npmignore b/packages/babel-helper-compilation-targets/.npmignore similarity index 100% rename from packages/babel-plugin-syntax-async-generators/.npmignore rename to packages/babel-helper-compilation-targets/.npmignore diff --git a/packages/babel-helper-compilation-targets/package.json b/packages/babel-helper-compilation-targets/package.json new file mode 100644 index 000000000000..00988adaf6ab --- /dev/null +++ b/packages/babel-helper-compilation-targets/package.json @@ -0,0 +1,33 @@ +{ + "name": "@babel/helper-compilation-targets", + "version": "7.8.7", + "author": "The Babel Team (https://babeljs.io/team)", + "license": "MIT", + "description": "Engine compat data used in @babel/preset-env", + "repository": "https://github.com/babel/babel/tree/master/packages/babel-helper-compilation-targets", + "main": "lib/index.js", + "exports": { + ".": "./lib/index.js" + }, + "publishConfig": { + "access": "public" + }, + "keywords": [ + "babel", + "babel-plugin" + ], + "dependencies": { + "@babel/compat-data": "^7.8.6", + "browserslist": "^4.11.1", + "invariant": "^2.2.4", + "levenary": "^1.1.1", + "semver": "^5.5.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0" + }, + "devDependencies": { + "@babel/core": "^7.8.7", + "@babel/helper-plugin-test-runner": "^7.8.3" + } +} diff --git a/packages/babel-helper-compilation-targets/src/debug.js b/packages/babel-helper-compilation-targets/src/debug.js new file mode 100644 index 000000000000..aec840d2eba2 --- /dev/null +++ b/packages/babel-helper-compilation-targets/src/debug.js @@ -0,0 +1,40 @@ +// @flow + +import semver from "semver"; +import { prettifyVersion } from "./pretty"; +import { + semverify, + isUnreleasedVersion, + getLowestImplementedVersion, +} from "./utils"; +import type { Targets } from "./types"; + +export function getInclusionReasons( + item: string, + targetVersions: Targets, + list: { [key: string]: Targets }, +) { + const minVersions = list[item] || {}; + + return Object.keys(targetVersions).reduce((result, env) => { + const minVersion = getLowestImplementedVersion(minVersions, env); + const targetVersion = targetVersions[env]; + + if (!minVersion) { + result[env] = prettifyVersion(targetVersion); + } else { + const minIsUnreleased = isUnreleasedVersion(minVersion, env); + const targetIsUnreleased = isUnreleasedVersion(targetVersion, env); + + if ( + !targetIsUnreleased && + (minIsUnreleased || + semver.lt(targetVersion.toString(), semverify(minVersion))) + ) { + result[env] = prettifyVersion(targetVersion); + } + } + + return result; + }, {}); +} diff --git a/packages/babel-helper-compilation-targets/src/filter-items.js b/packages/babel-helper-compilation-targets/src/filter-items.js new file mode 100644 index 000000000000..ac8809433bb9 --- /dev/null +++ b/packages/babel-helper-compilation-targets/src/filter-items.js @@ -0,0 +1,111 @@ +// @flow + +import semver from "semver"; + +import pluginsCompatData from "@babel/compat-data/plugins"; + +import type { Targets } from "./types"; +import { + getLowestImplementedVersion, + isUnreleasedVersion, + semverify, +} from "./utils"; + +export function targetsSupported(target: Targets, support: Targets) { + const targetEnvironments = Object.keys(target); + + if (targetEnvironments.length === 0) { + return false; + } + + const unsupportedEnvironments = targetEnvironments.filter(environment => { + const lowestImplementedVersion = getLowestImplementedVersion( + support, + environment, + ); + + // Feature is not implemented in that environment + if (!lowestImplementedVersion) { + return true; + } + + const lowestTargetedVersion = target[environment]; + + // If targets has unreleased value as a lowest version, then don't require a plugin. + if (isUnreleasedVersion(lowestTargetedVersion, environment)) { + return false; + } + + // Include plugin if it is supported in the unreleased environment, which wasn't specified in targets + if (isUnreleasedVersion(lowestImplementedVersion, environment)) { + return true; + } + + if (!semver.valid(lowestTargetedVersion.toString())) { + throw new Error( + `Invalid version passed for target "${environment}": "${lowestTargetedVersion}". ` + + "Versions must be in semver format (major.minor.patch)", + ); + } + + return semver.gt( + semverify(lowestImplementedVersion), + lowestTargetedVersion.toString(), + ); + }); + + return unsupportedEnvironments.length === 0; +} + +export function isRequired( + name: string, + targets: Targets, + { + compatData = pluginsCompatData, + includes, + excludes, + }: { + compatData?: { [feature: string]: Targets }, + includes?: Set, + excludes?: Set, + } = {}, +) { + if (excludes && excludes.has(name)) return false; + if (includes && includes.has(name)) return true; + return !targetsSupported(targets, compatData[name]); +} + +export default function filterItems( + list: { [feature: string]: Targets }, + includes: Set, + excludes: Set, + targets: Targets, + defaultIncludes: Array | null, + defaultExcludes?: Array | null, + pluginSyntaxMap?: Map, +) { + const result = new Set(); + const options = { compatData: list, includes, excludes }; + + for (const item in list) { + if (isRequired(item, targets, options)) { + result.add(item); + } else if (pluginSyntaxMap) { + const shippedProposalsSyntax = pluginSyntaxMap.get(item); + + if (shippedProposalsSyntax) { + result.add(shippedProposalsSyntax); + } + } + } + + if (defaultIncludes) { + defaultIncludes.forEach(item => !excludes.has(item) && result.add(item)); + } + + if (defaultExcludes) { + defaultExcludes.forEach(item => !includes.has(item) && result.delete(item)); + } + + return result; +} diff --git a/packages/babel-helper-compilation-targets/src/index.js b/packages/babel-helper-compilation-targets/src/index.js new file mode 100644 index 000000000000..1eca5be3eff9 --- /dev/null +++ b/packages/babel-helper-compilation-targets/src/index.js @@ -0,0 +1,259 @@ +// @flow + +import browserslist from "browserslist"; +import findSuggestion from "levenary"; +import invariant from "invariant"; +import browserModulesData from "@babel/compat-data/native-modules"; + +import { + semverify, + semverMin, + isUnreleasedVersion, + getLowestUnreleased, +} from "./utils"; +import { browserNameMap } from "./targets"; +import { TargetNames } from "./options"; +import type { Targets } from "./types"; + +export type { Targets }; + +export { prettifyTargets } from "./pretty"; +export { getInclusionReasons } from "./debug"; +export { default as filterItems, isRequired } from "./filter-items"; +export { unreleasedLabels } from "./targets"; + +const browserslistDefaults = browserslist.defaults; + +const validBrowserslistTargets = [ + ...Object.keys(browserslist.data), + ...Object.keys(browserslist.aliases), +]; + +function objectToBrowserslist(object: Targets): Array { + return Object.keys(object).reduce((list, targetName) => { + if (validBrowserslistTargets.indexOf(targetName) >= 0) { + const targetVersion = object[targetName]; + return list.concat(`${targetName} ${targetVersion}`); + } + return list; + }, []); +} + +function validateTargetNames(targets: Targets): void { + const validTargets = Object.keys(TargetNames); + for (const target in targets) { + if (!TargetNames[target]) { + throw new Error( + `Invalid Option: '${target}' is not a valid target + Maybe you meant to use '${findSuggestion(target, validTargets)}'?`, + ); + } + } +} + +export function isBrowsersQueryValid( + browsers: string | Array | Targets, +): boolean { + return typeof browsers === "string" || Array.isArray(browsers); +} + +function validateBrowsers(browsers) { + invariant( + typeof browsers === "undefined" || isBrowsersQueryValid(browsers), + `Invalid Option: '${browsers}' is not a valid browserslist query`, + ); + + return browsers; +} + +function mergeBrowsers(fromQuery: Targets, fromTarget: Targets) { + return Object.keys(fromTarget).reduce((queryObj, targKey) => { + if (targKey !== TargetNames.browsers) { + queryObj[targKey] = fromTarget[targKey]; + } + return queryObj; + }, fromQuery); +} + +function getLowestVersions(browsers: Array): Targets { + return browsers.reduce((all: Object, browser: string): Object => { + const [browserName, browserVersion] = browser.split(" "); + const normalizedBrowserName = browserNameMap[browserName]; + + if (!normalizedBrowserName) { + return all; + } + + try { + // Browser version can return as "10.0-10.2" + const splitVersion = browserVersion.split("-")[0].toLowerCase(); + const isSplitUnreleased = isUnreleasedVersion(splitVersion, browserName); + + if (!all[normalizedBrowserName]) { + all[normalizedBrowserName] = isSplitUnreleased + ? splitVersion + : semverify(splitVersion); + return all; + } + + const version = all[normalizedBrowserName]; + const isUnreleased = isUnreleasedVersion(version, browserName); + + if (isUnreleased && isSplitUnreleased) { + all[normalizedBrowserName] = getLowestUnreleased( + version, + splitVersion, + browserName, + ); + } else if (isUnreleased) { + all[normalizedBrowserName] = semverify(splitVersion); + } else if (!isUnreleased && !isSplitUnreleased) { + const parsedBrowserVersion = semverify(splitVersion); + + all[normalizedBrowserName] = semverMin(version, parsedBrowserVersion); + } + } catch (e) {} + + return all; + }, {}); +} + +function outputDecimalWarning(decimalTargets: Array): void { + if (!decimalTargets || !decimalTargets.length) { + return; + } + + console.log("Warning, the following targets are using a decimal version:"); + console.log(""); + decimalTargets.forEach(({ target, value }) => + console.log(` ${target}: ${value}`), + ); + console.log(""); + console.log( + "We recommend using a string for minor/patch versions to avoid numbers like 6.10", + ); + console.log("getting parsed as 6.1, which can lead to unexpected behavior."); + console.log(""); +} + +function semverifyTarget(target, value) { + try { + return semverify(value); + } catch (error) { + throw new Error( + `Invalid Option: '${value}' is not a valid value for 'targets.${target}'.`, + ); + } +} + +const targetParserMap = { + __default(target, value) { + const version = isUnreleasedVersion(value, target) + ? value.toLowerCase() + : semverifyTarget(target, value); + return [target, version]; + }, + + // Parse `node: true` and `node: "current"` to version + node(target, value) { + const parsed = + value === true || value === "current" + ? process.versions.node + : semverifyTarget(target, value); + return [target, parsed]; + }, +}; + +type ParsedResult = { + targets: Targets, + decimalWarnings: Array, +}; + +export default function getTargets( + targets: Object = {}, + options: Object = {}, +): Targets { + const targetOpts: Targets = {}; + + validateTargetNames(targets); + + // `esmodules` as a target indicates the specific set of browsers supporting ES Modules. + // These values OVERRIDE the `browsers` field. + if (targets.esmodules) { + const supportsESModules = browserModulesData["es6.module"]; + targets.browsers = Object.keys(supportsESModules) + .map(browser => `${browser} ${supportsESModules[browser]}`) + .join(", "); + } + + // Remove esmodules after being consumed to fix `hasTargets` below + delete targets.esmodules; + + // Parse browsers target via browserslist + const browsersquery = validateBrowsers(targets.browsers); + + const hasTargets = Object.keys(targets).length > 0; + const shouldParseBrowsers = !!targets.browsers; + const shouldSearchForConfig = + !options.ignoreBrowserslistConfig && !hasTargets; + + if (shouldParseBrowsers || shouldSearchForConfig) { + // If no targets are passed, we need to overwrite browserslist's defaults + // so that we enable all transforms (acting like the now deprecated + // preset-latest). + // + // Note, if browserslist resolves the config (ex. package.json), then usage + // of `defaults` in queries will be different since we don't want to break + // the behavior of "no targets is the same as preset-latest". + if (!hasTargets) { + browserslist.defaults = objectToBrowserslist(targets); + } + + const browsers = browserslist(browsersquery, { + path: options.configPath, + mobileToDesktop: true, + }); + + const queryBrowsers = getLowestVersions(browsers); + targets = mergeBrowsers(queryBrowsers, targets); + + // Reset browserslist defaults + browserslist.defaults = browserslistDefaults; + } + + // Parse remaining targets + const parsed = Object.keys(targets) + .filter(value => value !== TargetNames.esmodules) + .sort() + .reduce( + (results: ParsedResult, target: string): ParsedResult => { + if (target !== TargetNames.browsers) { + const value = targets[target]; + + // Warn when specifying minor/patch as a decimal + if (typeof value === "number" && value % 1 !== 0) { + results.decimalWarnings.push({ target, value }); + } + + // Check if we have a target parser? + const parser = targetParserMap[target] || targetParserMap.__default; + const [parsedTarget, parsedValue] = parser(target, value); + + if (parsedValue) { + // Merge (lowest wins) + results.targets[parsedTarget] = parsedValue; + } + } + + return results; + }, + { + targets: targetOpts, + decimalWarnings: [], + }, + ); + + outputDecimalWarning(parsed.decimalWarnings); + + return parsed.targets; +} diff --git a/packages/babel-helper-compilation-targets/src/options.js b/packages/babel-helper-compilation-targets/src/options.js new file mode 100644 index 000000000000..eadc8dbd43c2 --- /dev/null +++ b/packages/babel-helper-compilation-targets/src/options.js @@ -0,0 +1,20 @@ +// @flow + +export const TargetNames = { + esmodules: "esmodules", + node: "node", + browsers: "browsers", + chrome: "chrome", + opera: "opera", + edge: "edge", + firefox: "firefox", + safari: "safari", + ie: "ie", + ios: "ios", + android: "android", + electron: "electron", + samsung: "samsung", + + // deprecated + uglify: "uglify", +}; diff --git a/packages/babel-helper-compilation-targets/src/pretty.js b/packages/babel-helper-compilation-targets/src/pretty.js new file mode 100644 index 000000000000..bc8bdd96c148 --- /dev/null +++ b/packages/babel-helper-compilation-targets/src/pretty.js @@ -0,0 +1,36 @@ +import semver from "semver"; +import { unreleasedLabels } from "./targets"; + +export function prettifyVersion(version: string) { + if (typeof version !== "string") { + return version; + } + + const parts = [semver.major(version)]; + const minor = semver.minor(version); + const patch = semver.patch(version); + + if (minor || patch) { + parts.push(minor); + } + + if (patch) { + parts.push(patch); + } + + return parts.join("."); +} + +export function prettifyTargets(targets: Targets): Targets { + return Object.keys(targets).reduce((results, target) => { + let value = targets[target]; + + const unreleasedLabel = unreleasedLabels[target]; + if (typeof value === "string" && unreleasedLabel !== value) { + value = prettifyVersion(value); + } + + results[target] = value; + return results; + }, {}); +} diff --git a/packages/babel-helper-compilation-targets/src/targets.js b/packages/babel-helper-compilation-targets/src/targets.js new file mode 100644 index 000000000000..401d7904a995 --- /dev/null +++ b/packages/babel-helper-compilation-targets/src/targets.js @@ -0,0 +1,20 @@ +export const unreleasedLabels = { + safari: "tp", +}; + +export const browserNameMap = { + and_chr: "chrome", + and_ff: "firefox", + android: "android", + chrome: "chrome", + edge: "edge", + firefox: "firefox", + ie: "ie", + ie_mob: "ie", + ios_saf: "ios", + node: "node", + op_mob: "opera", + opera: "opera", + safari: "safari", + samsung: "samsung", +}; diff --git a/packages/babel-helper-compilation-targets/src/types.js b/packages/babel-helper-compilation-targets/src/types.js new file mode 100644 index 000000000000..28b4c2b3f34d --- /dev/null +++ b/packages/babel-helper-compilation-targets/src/types.js @@ -0,0 +1,19 @@ +// @flow + +// Targets +export type Target = + | "node" + | "chrome" + | "opera" + | "edge" + | "firefox" + | "safari" + | "ie" + | "ios" + | "android" + | "electron" + | "samsung"; + +export type Targets = { + [target: Target]: string, +}; diff --git a/packages/babel-helper-compilation-targets/src/utils.js b/packages/babel-helper-compilation-targets/src/utils.js new file mode 100644 index 000000000000..31eeae8c8e23 --- /dev/null +++ b/packages/babel-helper-compilation-targets/src/utils.js @@ -0,0 +1,64 @@ +// @flow + +import invariant from "invariant"; +import semver from "semver"; + +import { unreleasedLabels } from "./targets"; +import type { Target, Targets } from "./types"; + +const versionRegExp = /^(\d+|\d+.\d+)$/; + +export function semverMin(first: ?string, second: string): string { + return first && semver.lt(first, second) ? first : second; +} + +// Convert version to a semver value. +// 2.5 -> 2.5.0; 1 -> 1.0.0; +export function semverify(version: number | string): string { + if (typeof version === "string" && semver.valid(version)) { + return version; + } + + invariant( + typeof version === "number" || + (typeof version === "string" && versionRegExp.test(version)), + `'${version}' is not a valid version`, + ); + + const split = version.toString().split("."); + while (split.length < 3) { + split.push("0"); + } + return split.join("."); +} + +export function isUnreleasedVersion( + version: string | number, + env: string, +): boolean { + const unreleasedLabel = unreleasedLabels[env]; + return ( + !!unreleasedLabel && unreleasedLabel === version.toString().toLowerCase() + ); +} + +export function getLowestUnreleased(a: string, b: string, env: string): string { + const unreleasedLabel = unreleasedLabels[env]; + const hasUnreleased = [a, b].some(item => item === unreleasedLabel); + if (hasUnreleased) { + return a === hasUnreleased ? b : a || b; + } + return semverMin(a, b); +} + +export function getLowestImplementedVersion( + plugin: Targets, + environment: Target, +): string { + const result = plugin[environment]; + // When Android support data is absent, use Chrome data as fallback + if (!result && environment === "android") { + return plugin.chrome; + } + return result; +} diff --git a/packages/babel-helper-compilation-targets/test/pretty.spec.js b/packages/babel-helper-compilation-targets/test/pretty.spec.js new file mode 100644 index 000000000000..6164cde8e918 --- /dev/null +++ b/packages/babel-helper-compilation-targets/test/pretty.spec.js @@ -0,0 +1,32 @@ +import { prettifyTargets, prettifyVersion } from "../lib/pretty"; + +describe("pretty", () => { + describe("prettifyVersion", () => { + it("returns", () => { + expect(prettifyVersion(true)).toBe(true); + expect(prettifyVersion("0.16.0")).toBe("0.16"); + expect(prettifyVersion("1.0.0")).toBe("1"); + expect(prettifyVersion("1.1.0")).toBe("1.1"); + expect(prettifyVersion("1.0.2")).toBe("1.0.2"); + expect(prettifyVersion("1.2.3")).toBe("1.2.3"); + }); + }); + + describe("prettifyTargets", () => { + it("returns", () => { + expect(prettifyTargets({})).toEqual({}); + + expect( + prettifyTargets({ + chrome: "54.0.0", + electron: "1.6.0", + node: "0.12.0", + }), + ).toEqual({ + chrome: "54", + electron: "1.6", + node: "0.12", + }); + }); + }); +}); diff --git a/packages/babel-preset-env/test/targets-parser.spec.js b/packages/babel-helper-compilation-targets/test/targets-parser.spec.js similarity index 92% rename from packages/babel-preset-env/test/targets-parser.spec.js rename to packages/babel-helper-compilation-targets/test/targets-parser.spec.js index 7b9f669d2d01..2c4f1335ef22 100644 --- a/packages/babel-preset-env/test/targets-parser.spec.js +++ b/packages/babel-helper-compilation-targets/test/targets-parser.spec.js @@ -1,5 +1,5 @@ import browserslist from "browserslist"; -import getTargets from "../lib/targets-parser"; +import getTargets from ".."; describe("getTargets", () => { it("parses", () => { @@ -39,6 +39,13 @@ describe("getTargets", () => { expect(browserslist.defaults).toEqual(browserslistDefaults); }); + it("supports region browserslists query", () => { + const actual = getTargets({ browsers: "> 0.5% in GB" }); + // chrome 4 is the first release of chrome, + // it should never be included in this query + expect(parseFloat(actual.chrome)).toBeGreaterThan(4); + }); + describe("validation", () => { it("throws on invalid target name", () => { const invalidTargetName = () => { @@ -185,12 +192,14 @@ describe("getTargets", () => { esmodules: true, }), ).toEqual({ + android: "61.0.0", chrome: "61.0.0", - safari: "10.1.0", + edge: "16.0.0", firefox: "60.0.0", - opera: "48.0.0", ios: "10.3.0", - edge: "16.0.0", + opera: "48.0.0", + safari: "10.1.0", + samsung: "8.2.0", }); }); @@ -201,12 +210,14 @@ describe("getTargets", () => { browsers: "ie 8", }), ).toEqual({ + android: "61.0.0", chrome: "61.0.0", - safari: "10.1.0", + edge: "16.0.0", firefox: "60.0.0", - opera: "48.0.0", ios: "10.3.0", - edge: "16.0.0", + opera: "48.0.0", + safari: "10.1.0", + samsung: "8.2.0", }); }); @@ -217,6 +228,7 @@ describe("getTargets", () => { ie: 11, }), ).toEqual({ + android: "61.0.0", chrome: "61.0.0", safari: "10.1.0", firefox: "60.0.0", @@ -224,6 +236,7 @@ describe("getTargets", () => { ios: "10.3.0", ie: "11.0.0", edge: "16.0.0", + samsung: "8.2.0", }); }); @@ -235,6 +248,7 @@ describe("getTargets", () => { ie: 11, }), ).toEqual({ + android: "61.0.0", chrome: "61.0.0", safari: "10.1.0", ios: "10.3.0", @@ -242,6 +256,7 @@ describe("getTargets", () => { edge: "16.0.0", firefox: "60.0.0", opera: "48.0.0", + samsung: "8.2.0", }); }); }); diff --git a/packages/babel-helper-compilation-targets/test/targets-supported.js b/packages/babel-helper-compilation-targets/test/targets-supported.js new file mode 100644 index 000000000000..fd018172ef29 --- /dev/null +++ b/packages/babel-helper-compilation-targets/test/targets-supported.js @@ -0,0 +1,82 @@ +"use strict"; + +const { targetsSupported } = require("../lib/filter-items"); + +describe("targetsSupported", () => { + const MAX_VERSION = `${Number.MAX_SAFE_INTEGER}.0.0`; + + it("returns false if no targets are specified", () => { + expect(targetsSupported({}, {})).toBe(false); + }); + + it("returns false if plugin feature is not implemented in one or more targets", () => { + let targets; + const plugin = { + edge: false, + firefox: 45, + chrome: 49, + }; + + targets = { + chrome: MAX_VERSION, + firefox: MAX_VERSION, + }; + expect(targetsSupported(targets, plugin)).toBe(true); + + targets = { + edge: "12", + }; + expect(targetsSupported(targets, plugin)).toBe(false); + }); + + it("returns true if plugin feature is implemented by lower than target", () => { + const plugin = { + chrome: 49, + }; + const targets = { + chrome: MAX_VERSION, + }; + + expect(targetsSupported(targets, plugin)).toBe(true); + }); + + it("returns true if plugin feature is implemented is equal to target", () => { + const plugin = { + chrome: 49, + }; + const targets = { + chrome: "49.0.0", + }; + expect(targetsSupported(targets, plugin)).toBe(true); + }); + + it("returns false if plugin feature is implemented is greater than target", () => { + const plugin = { + chrome: 50, + }; + const targets = { + chrome: "49.0.0", + }; + expect(targetsSupported(targets, plugin)).toBe(false); + }); + + it("returns when target is a decimal", () => { + const plugin = { + node: 6.9, + }; + const targets = { + node: "6.10.0", + }; + expect(targetsSupported(targets, plugin)).toBe(true); + }); + + it("throws an error if target version is invalid", () => { + const plugin = { + chrome: 50, + }; + const targets = { + chrome: 55, + }; + expect(() => targetsSupported(targets, plugin)).toThrow(); + }); +}); diff --git a/packages/babel-helper-compilation-targets/test/utils.spec.js b/packages/babel-helper-compilation-targets/test/utils.spec.js new file mode 100644 index 000000000000..77068400663d --- /dev/null +++ b/packages/babel-helper-compilation-targets/test/utils.spec.js @@ -0,0 +1,20 @@ +import { semverify } from "../lib/utils"; + +describe("utils", () => { + describe("semverify", () => { + it("returns", () => { + expect(semverify("1")).toBe("1.0.0"); + expect(semverify("1.0")).toBe("1.0.0"); + expect(semverify("1.0.0")).toBe("1.0.0"); + expect(semverify(1)).toBe("1.0.0"); + expect(semverify(1.2)).toBe("1.2.0"); + }); + + it("throws", () => { + const invalidSemver = () => { + semverify("invalid"); + }; + expect(invalidSemver).toThrow(); + }); + }); +}); diff --git a/packages/babel-helper-create-class-features-plugin/package.json b/packages/babel-helper-create-class-features-plugin/package.json index a5c46704a7db..afdbad9c6a48 100644 --- a/packages/babel-helper-create-class-features-plugin/package.json +++ b/packages/babel-helper-create-class-features-plugin/package.json @@ -1,6 +1,6 @@ { "name": "@babel/helper-create-class-features-plugin", - "version": "7.5.5", + "version": "7.9.5", "author": "The Babel Team (https://babeljs.io/team)", "license": "MIT", "description": "Compile class public and private fields, private methods and decorators to ES6", @@ -14,18 +14,18 @@ "babel-plugin" ], "dependencies": { - "@babel/helper-function-name": "^7.1.0", - "@babel/helper-member-expression-to-functions": "^7.5.5", - "@babel/helper-optimise-call-expression": "^7.0.0", - "@babel/helper-plugin-utils": "^7.0.0", - "@babel/helper-replace-supers": "^7.5.5", - "@babel/helper-split-export-declaration": "^7.4.4" + "@babel/helper-function-name": "^7.9.5", + "@babel/helper-member-expression-to-functions": "^7.8.3", + "@babel/helper-optimise-call-expression": "^7.8.3", + "@babel/helper-plugin-utils": "^7.8.3", + "@babel/helper-replace-supers": "^7.8.6", + "@babel/helper-split-export-declaration": "^7.8.3" }, "peerDependencies": { "@babel/core": "^7.0.0" }, "devDependencies": { - "@babel/core": "^7.5.5", - "@babel/helper-plugin-test-runner": "^7.0.0" + "@babel/core": "^7.8.6", + "@babel/helper-plugin-test-runner": "^7.8.3" } } diff --git a/packages/babel-helper-create-class-features-plugin/src/decorators.js b/packages/babel-helper-create-class-features-plugin/src/decorators.js index 74fc7d059523..49444bbea4ac 100644 --- a/packages/babel-helper-create-class-features-plugin/src/decorators.js +++ b/packages/babel-helper-create-class-features-plugin/src/decorators.js @@ -128,7 +128,10 @@ export function buildDecoratedClass(ref, path, elements, file) { const classDecorators = takeDecorators(node); const definitions = t.arrayExpression( - elements.map(extractElementDescriptor.bind(file, node.id, superId)), + elements + // Ignore TypeScript's abstract methods (see #10514) + .filter(element => !element.node.abstract) + .map(extractElementDescriptor.bind(file, node.id, superId)), ); let replacement = template.expression.ast` diff --git a/packages/babel-helper-create-class-features-plugin/src/features.js b/packages/babel-helper-create-class-features-plugin/src/features.js index fffc0d0014e0..4fc528bff185 100644 --- a/packages/babel-helper-create-class-features-plugin/src/features.js +++ b/packages/babel-helper-create-class-features-plugin/src/features.js @@ -66,12 +66,6 @@ export function verifyUsedFeatures(path, file) { if (!hasFeature(file, FEATURES.privateMethods)) { throw path.buildCodeFrameError("Class private methods are not enabled."); } - - if (path.node.static && path.node.kind !== "method") { - throw path.buildCodeFrameError( - "@babel/plugin-class-features doesn't support class static private accessors yet.", - ); - } } if ( diff --git a/packages/babel-helper-create-class-features-plugin/src/fields.js b/packages/babel-helper-create-class-features-plugin/src/fields.js index c6fb3da40ded..504cf807e68f 100644 --- a/packages/babel-helper-create-class-features-plugin/src/fields.js +++ b/packages/babel-helper-create-class-features-plugin/src/fields.js @@ -5,6 +5,8 @@ import ReplaceSupers, { import memberExpressionToFunctions from "@babel/helper-member-expression-to-functions"; import optimiseCall from "@babel/helper-optimise-call-expression"; +import * as ts from "./typescript"; + export function buildPrivateNamesMap(props) { const privateNamesMap = new Map(); for (const prop of props) { @@ -44,6 +46,7 @@ export function buildPrivateNamesNodes(privateNamesMap, loose, state) { // because static fields are directly assigned to a variable in the // buildPrivateStaticFieldInitSpec function. const { id, static: isStatic, method: isMethod, getId, setId } = value; + const isAccessor = getId || setId; if (loose) { initNodes.push( template.statement.ast` @@ -51,7 +54,7 @@ export function buildPrivateNamesNodes(privateNamesMap, loose, state) { `, ); } else if (isMethod && !isStatic) { - if (getId || setId) { + if (isAccessor) { initNodes.push(template.statement.ast`var ${id} = new WeakMap();`); } else { initNodes.push(template.statement.ast`var ${id} = new WeakSet();`); @@ -82,24 +85,49 @@ const privateNameVisitor = { const { privateNamesMap } = this; const body = path.get("body.body"); + const visiblePrivateNames = new Map(privateNamesMap); + const redeclared = []; for (const prop of body) { - if (!prop.isPrivate()) { - continue; - } - if (!privateNamesMap.has(prop.node.key.id.name)) continue; + if (!prop.isPrivate()) continue; + const { name } = prop.node.key.id; + visiblePrivateNames.delete(name); + redeclared.push(name); + } - // This class redeclares the private name. - // So, we can only evaluate the things in the outer scope. - path.traverse(privateNameInnerVisitor, this); - path.skip(); - break; + // If the class doesn't redeclare any private fields, we can continue with + // our overall traversal. + if (!redeclared.length) { + return; } + + // This class redeclares some private field. We need to process the outer + // environment with access to all the outer privates, then we can process + // the inner environment with only the still-visible outer privates. + path.get("body").traverse(privateNameNestedVisitor, { + ...this, + redeclared, + }); + path.traverse(privateNameVisitor, { + ...this, + privateNamesMap: visiblePrivateNames, + }); + + // We'll eventually hit this class node again with the overall Class + // Features visitor, which'll process the redeclared privates. + path.skipKey("body"); }, }; // Traverses the outer portion of a class, without touching the class's inner // scope, for private names. -const privateNameInnerVisitor = traverse.visitors.merge([ +const privateNameNestedVisitor = traverse.visitors.merge([ + { + PrivateName(path) { + const { redeclared } = this; + const { name } = path.node.id; + if (redeclared.includes(name)) path.skip(); + }, + }, { PrivateName: privateNameVisitor.PrivateName, }, @@ -140,11 +168,13 @@ const privateNameHandlerSpec = { getId, setId, } = privateNamesMap.get(name); + const isAccessor = getId || setId; if (isStatic) { - const helperName = isMethod - ? "classStaticPrivateMethodGet" - : "classStaticPrivateFieldSpecGet"; + const helperName = + isMethod && !isAccessor + ? "classStaticPrivateMethodGet" + : "classStaticPrivateFieldSpecGet"; return t.callExpression(file.addHelper(helperName), [ this.receiver(member), @@ -154,7 +184,7 @@ const privateNameHandlerSpec = { } if (isMethod) { - if (getId || setId) { + if (isAccessor) { return t.callExpression(file.addHelper("classPrivateFieldGet"), [ this.receiver(member), t.cloneNode(id), @@ -180,12 +210,15 @@ const privateNameHandlerSpec = { static: isStatic, method: isMethod, setId, + getId, } = privateNamesMap.get(name); + const isAccessor = getId || setId; if (isStatic) { - const helperName = isMethod - ? "classStaticPrivateMethodSet" - : "classStaticPrivateFieldSpecSet"; + const helperName = + isMethod && !isAccessor + ? "classStaticPrivateMethodSet" + : "classStaticPrivateFieldSpecSet"; return t.callExpression(file.addHelper(helperName), [ this.receiver(member), @@ -255,6 +288,8 @@ export function transformPrivateNamesUsage( loose, state, ) { + if (!privateNamesMap.size) return; + const body = path.get("body"); if (loose) { @@ -300,9 +335,30 @@ function buildPrivateInstanceFieldInitSpec(ref, prop, privateNamesMap) { } function buildPrivateStaticFieldInitSpec(prop, privateNamesMap) { - const { id } = privateNamesMap.get(prop.node.key.id.name); - const value = prop.node.value || prop.scope.buildUndefinedNode(); + const privateName = privateNamesMap.get(prop.node.key.id.name); + const { id, getId, setId, initAdded } = privateName; + const isAccessor = getId || setId; + + if (!prop.isProperty() && (initAdded || !isAccessor)) return; + + if (isAccessor) { + privateNamesMap.set(prop.node.key.id.name, { + ...privateName, + initAdded: true, + }); + + return template.statement.ast` + var ${id.name} = { + // configurable is false by default + // enumerable is false by default + // writable is false by default + get: ${getId ? getId.name : prop.scope.buildUndefinedNode()}, + set: ${setId ? setId.name : prop.scope.buildUndefinedNode()} + } + `; + } + const value = prop.node.value || prop.scope.buildUndefinedNode(); return template.statement.ast` var ${id} = { // configurable is false by default @@ -328,76 +384,44 @@ function buildPrivateMethodInitLoose(ref, prop, privateNamesMap) { }); `; } - - if (getId || setId) { + const isAccessor = getId || setId; + if (isAccessor) { privateNamesMap.set(prop.node.key.id.name, { ...privateName, initAdded: true, }); - if (getId && setId) { - return template.statement.ast` - Object.defineProperty(${ref}, ${id}, { - // configurable is false by default - // enumerable is false by default - // writable is false by default - get: ${getId.name}, - set: ${setId.name} - }); - `; - } else if (getId && !setId) { - return template.statement.ast` - Object.defineProperty(${ref}, ${id}, { - // configurable is false by default - // enumerable is false by default - // writable is false by default - get: ${getId.name} - }); - `; - } else if (!getId && setId) { - return template.statement.ast` - Object.defineProperty(${ref}, ${id}, { - // configurable is false by default - // enumerable is false by default - // writable is false by default - set: ${setId.name} - }); - `; - } + return template.statement.ast` + Object.defineProperty(${ref}, ${id}, { + // configurable is false by default + // enumerable is false by default + // writable is false by default + get: ${getId ? getId.name : prop.scope.buildUndefinedNode()}, + set: ${setId ? setId.name : prop.scope.buildUndefinedNode()} + }); + `; } } function buildPrivateInstanceMethodInitSpec(ref, prop, privateNamesMap) { const privateName = privateNamesMap.get(prop.node.key.id.name); const { id, getId, setId, initAdded } = privateName; + if (initAdded) return; - if (getId || setId) { + const isAccessor = getId || setId; + if (isAccessor) { privateNamesMap.set(prop.node.key.id.name, { ...privateName, initAdded: true, }); - if (getId && setId) { - return template.statement.ast` - ${id}.set(${ref}, { - get: ${getId.name}, - set: ${setId.name} - }); - `; - } else if (getId && !setId) { - return template.statement.ast` - ${id}.set(${ref}, { - get: ${getId.name} - }); - `; - } else if (!getId && setId) { - return template.statement.ast` - ${id}.set(${ref}, { - set: ${setId.name} - }); - `; - } + return template.statement.ast` + ${id}.set(${ref}, { + get: ${getId ? getId.name : prop.scope.buildUndefinedNode()}, + set: ${setId ? setId.name : prop.scope.buildUndefinedNode()} + }); + `; } return template.statement.ast`${id}.add(${ref})`; } @@ -429,7 +453,29 @@ function buildPublicFieldInitSpec(ref, prop, state) { } function buildPrivateStaticMethodInitLoose(ref, prop, state, privateNamesMap) { - const { id, methodId } = privateNamesMap.get(prop.node.key.id.name); + const privateName = privateNamesMap.get(prop.node.key.id.name); + const { id, methodId, getId, setId, initAdded } = privateName; + + if (initAdded) return; + + const isAccessor = getId || setId; + if (isAccessor) { + privateNamesMap.set(prop.node.key.id.name, { + ...privateName, + initAdded: true, + }); + + return template.statement.ast` + Object.defineProperty(${ref}, ${id}, { + // configurable is false by default + // enumerable is false by default + // writable is false by default + get: ${getId ? getId.name : prop.scope.buildUndefinedNode()}, + set: ${setId ? setId.name : prop.scope.buildUndefinedNode()} + }) + `; + } + return template.statement.ast` Object.defineProperty(${ref}, ${id}, { // configurable is false by default @@ -539,6 +585,8 @@ export function buildFieldsInitNodes( let needsClassRef = false; for (const prop of props) { + ts.assertFieldTransformed(prop); + const isStatic = prop.node.static; const isInstance = !isStatic; const isPrivate = prop.isPrivate(); @@ -615,14 +663,14 @@ export function buildFieldsInitNodes( case isStatic && isPrivate && isMethod && !loose: needsClassRef = true; staticNodes.push( + buildPrivateStaticFieldInitSpec(prop, privateNamesMap), + ); + staticNodes.unshift( buildPrivateMethodDeclaration(prop, privateNamesMap, loose), ); break; case isStatic && isPrivate && isMethod && loose: needsClassRef = true; - staticNodes.push( - buildPrivateMethodDeclaration(prop, privateNamesMap, loose), - ); staticNodes.push( buildPrivateStaticMethodInitLoose( t.cloneNode(ref), @@ -631,6 +679,9 @@ export function buildFieldsInitNodes( privateNamesMap, ), ); + staticNodes.unshift( + buildPrivateMethodDeclaration(prop, privateNamesMap, loose), + ); break; case isInstance && isPublic && isField && loose: instanceNodes.push(buildPublicFieldInitLoose(t.thisExpression(), prop)); @@ -646,7 +697,7 @@ export function buildFieldsInitNodes( } return { - staticNodes, + staticNodes: staticNodes.filter(Boolean), instanceNodes: instanceNodes.filter(Boolean), wrapClass(path) { for (const prop of props) { diff --git a/packages/babel-helper-create-class-features-plugin/src/index.js b/packages/babel-helper-create-class-features-plugin/src/index.js index 1ed61a1839c0..57add480d286 100644 --- a/packages/babel-helper-create-class-features-plugin/src/index.js +++ b/packages/babel-helper-create-class-features-plugin/src/index.js @@ -97,7 +97,8 @@ export function createClassFeaturePlugin({ } else { if ( (privateNames.has(name) && - (!privateNames.has(getName) && !privateNames.has(setName))) || + !privateNames.has(getName) && + !privateNames.has(setName)) || (privateNames.has(name) && (privateNames.has(getName) || privateNames.has(setName))) ) { diff --git a/packages/babel-helper-create-class-features-plugin/src/misc.js b/packages/babel-helper-create-class-features-plugin/src/misc.js index ff5178374a56..31f8e0948676 100644 --- a/packages/babel-helper-create-class-features-plugin/src/misc.js +++ b/packages/babel-helper-create-class-features-plugin/src/misc.js @@ -25,26 +25,24 @@ const referenceVisitor = { } }, }; +function handleClassTDZ(path, state) { + if ( + state.classBinding && + state.classBinding === path.scope.getBinding(path.node.name) + ) { + const classNameTDZError = state.file.addHelper("classNameTDZError"); + const throwNode = t.callExpression(classNameTDZError, [ + t.stringLiteral(path.node.name), + ]); + + path.replaceWith(t.sequenceExpression([throwNode, path.node])); + path.skip(); + } +} -const classFieldDefinitionEvaluationTDZVisitor = traverse.visitors.merge([ - { - ReferencedIdentifier(path) { - if ( - this.classBinding && - this.classBinding === path.scope.getBinding(path.node.name) - ) { - const classNameTDZError = this.file.addHelper("classNameTDZError"); - const throwNode = t.callExpression(classNameTDZError, [ - t.stringLiteral(path.node.name), - ]); - - path.replaceWith(t.sequenceExpression([throwNode, path.node])); - path.skip(); - } - }, - }, - environmentVisitor, -]); +const classFieldDefinitionEvaluationTDZVisitor = { + ReferencedIdentifier: handleClassTDZ, +}; export function injectInitialization(path, constructor, nodes, renamer) { if (!nodes.length) return; @@ -84,17 +82,22 @@ export function injectInitialization(path, constructor, nodes, renamer) { export function extractComputedKeys(ref, path, computedPaths, file) { const declarations = []; - + const state = { + classBinding: path.node.id && path.scope.getBinding(path.node.id.name), + file, + }; for (const computedPath of computedPaths) { - computedPath.traverse(classFieldDefinitionEvaluationTDZVisitor, { - classBinding: path.node.id && path.scope.getBinding(path.node.id.name), - file, - }); + const computedKey = computedPath.get("key"); + if (computedKey.isReferencedIdentifier()) { + handleClassTDZ(computedKey, state); + } else { + computedKey.traverse(classFieldDefinitionEvaluationTDZVisitor, state); + } const computedNode = computedPath.node; // Make sure computed property names are only evaluated once (upon class definition) // and in the right order in combination with static properties - if (!computedPath.get("key").isConstantExpression()) { + if (!computedKey.isConstantExpression()) { const ident = path.scope.generateUidIdentifierBasedOnNode( computedNode.key, ); diff --git a/packages/babel-helper-create-class-features-plugin/src/typescript.js b/packages/babel-helper-create-class-features-plugin/src/typescript.js new file mode 100644 index 000000000000..c18f0ea17389 --- /dev/null +++ b/packages/babel-helper-create-class-features-plugin/src/typescript.js @@ -0,0 +1,19 @@ +// @flow + +import type { NodePath } from "@babel/traverse"; + +export function assertFieldTransformed(path: NodePath) { + // TODO (Babel 8): Also check path.node.definite + + if (path.node.declare) { + throw path.buildCodeFrameError( + `TypeScript 'declare' fields must first be transformed by ` + + `@babel/plugin-transform-typescript.\n` + + `If you have already enabled that plugin (or '@babel/preset-typescript'), make sure ` + + `that it runs before any plugin related to additional class features:\n` + + ` - @babel/plugin-proposal-class-properties\n` + + ` - @babel/plugin-proposal-private-methods\n` + + ` - @babel/plugin-proposal-decorators`, + ); + } +} diff --git a/packages/babel-helper-create-class-features-plugin/test/fixtures/plugin-proposal-decorators/ignore-abstract-methods/exec.ts b/packages/babel-helper-create-class-features-plugin/test/fixtures/plugin-proposal-decorators/ignore-abstract-methods/exec.ts new file mode 100644 index 000000000000..e69af08e787b --- /dev/null +++ b/packages/babel-helper-create-class-features-plugin/test/fixtures/plugin-proposal-decorators/ignore-abstract-methods/exec.ts @@ -0,0 +1,27 @@ +function decorate(value: boolean) { + return function( + target: any, + propertyKey: string, + descriptor: PropertyDescriptor + ) {}; +} + +abstract class A { + @decorate(false) + private decoratedMember: boolean; + + abstract myMethod(): number; +} + +class B extends A { + constructor() { + super(); + } + + myMethod(): number { + return 5; + } +} + +const b = new B(); +expect(b.myMethod()).toBe(5); diff --git a/packages/babel-helper-create-class-features-plugin/test/fixtures/plugin-proposal-decorators/ignore-abstract-methods/input.ts b/packages/babel-helper-create-class-features-plugin/test/fixtures/plugin-proposal-decorators/ignore-abstract-methods/input.ts new file mode 100644 index 000000000000..e2169497587d --- /dev/null +++ b/packages/babel-helper-create-class-features-plugin/test/fixtures/plugin-proposal-decorators/ignore-abstract-methods/input.ts @@ -0,0 +1,26 @@ +function decorate(value: boolean) { + return function( + target: any, + propertyKey: string, + descriptor: PropertyDescriptor + ) {}; +} + +abstract class A { + @decorate(false) + private decoratedMember: boolean; + + abstract myMethod(): void; +} + +class B extends A { + constructor() { + super(); + } + + myMethod(): void { + + } +} + +const b = new B(); diff --git a/packages/babel-helper-create-class-features-plugin/test/fixtures/plugin-proposal-decorators/ignore-abstract-methods/options.json b/packages/babel-helper-create-class-features-plugin/test/fixtures/plugin-proposal-decorators/ignore-abstract-methods/options.json new file mode 100644 index 000000000000..d36531b4df09 --- /dev/null +++ b/packages/babel-helper-create-class-features-plugin/test/fixtures/plugin-proposal-decorators/ignore-abstract-methods/options.json @@ -0,0 +1,9 @@ +{ + "presets": [ + ["typescript"] + ], + "plugins": [ + ["proposal-decorators", { "decoratorsBeforeExport": true }], + ["proposal-class-properties"] + ] +} \ No newline at end of file diff --git a/packages/babel-helper-create-class-features-plugin/test/fixtures/plugin-proposal-decorators/ignore-abstract-methods/output.js b/packages/babel-helper-create-class-features-plugin/test/fixtures/plugin-proposal-decorators/ignore-abstract-methods/output.js new file mode 100644 index 000000000000..72350c9679d4 --- /dev/null +++ b/packages/babel-helper-create-class-features-plugin/test/fixtures/plugin-proposal-decorators/ignore-abstract-methods/output.js @@ -0,0 +1,67 @@ +function _decorate(decorators, factory, superClass, mixins) { var api = _getDecoratorsApi(); if (mixins) { for (var i = 0; i < mixins.length; i++) { api = mixins[i](api); } } var r = factory(function initialize(O) { api.initializeInstanceElements(O, decorated.elements); }, superClass); var decorated = api.decorateClass(_coalesceClassElements(r.d.map(_createElementDescriptor)), decorators); api.initializeClassElements(r.F, decorated.elements); return api.runClassFinishers(r.F, decorated.finishers); } + +function _getDecoratorsApi() { _getDecoratorsApi = function () { return api; }; var api = { elementsDefinitionOrder: [["method"], ["field"]], initializeInstanceElements: function (O, elements) { ["method", "field"].forEach(function (kind) { elements.forEach(function (element) { if (element.kind === kind && element.placement === "own") { this.defineClassElement(O, element); } }, this); }, this); }, initializeClassElements: function (F, elements) { var proto = F.prototype; ["method", "field"].forEach(function (kind) { elements.forEach(function (element) { var placement = element.placement; if (element.kind === kind && (placement === "static" || placement === "prototype")) { var receiver = placement === "static" ? F : proto; this.defineClassElement(receiver, element); } }, this); }, this); }, defineClassElement: function (receiver, element) { var descriptor = element.descriptor; if (element.kind === "field") { var initializer = element.initializer; descriptor = { enumerable: descriptor.enumerable, writable: descriptor.writable, configurable: descriptor.configurable, value: initializer === void 0 ? void 0 : initializer.call(receiver) }; } Object.defineProperty(receiver, element.key, descriptor); }, decorateClass: function (elements, decorators) { var newElements = []; var finishers = []; var placements = { static: [], prototype: [], own: [] }; elements.forEach(function (element) { this.addElementPlacement(element, placements); }, this); elements.forEach(function (element) { if (!_hasDecorators(element)) return newElements.push(element); var elementFinishersExtras = this.decorateElement(element, placements); newElements.push(elementFinishersExtras.element); newElements.push.apply(newElements, elementFinishersExtras.extras); finishers.push.apply(finishers, elementFinishersExtras.finishers); }, this); if (!decorators) { return { elements: newElements, finishers: finishers }; } var result = this.decorateConstructor(newElements, decorators); finishers.push.apply(finishers, result.finishers); result.finishers = finishers; return result; }, addElementPlacement: function (element, placements, silent) { var keys = placements[element.placement]; if (!silent && keys.indexOf(element.key) !== -1) { throw new TypeError("Duplicated element (" + element.key + ")"); } keys.push(element.key); }, decorateElement: function (element, placements) { var extras = []; var finishers = []; for (var decorators = element.decorators, i = decorators.length - 1; i >= 0; i--) { var keys = placements[element.placement]; keys.splice(keys.indexOf(element.key), 1); var elementObject = this.fromElementDescriptor(element); var elementFinisherExtras = this.toElementFinisherExtras((0, decorators[i])(elementObject) || elementObject); element = elementFinisherExtras.element; this.addElementPlacement(element, placements); if (elementFinisherExtras.finisher) { finishers.push(elementFinisherExtras.finisher); } var newExtras = elementFinisherExtras.extras; if (newExtras) { for (var j = 0; j < newExtras.length; j++) { this.addElementPlacement(newExtras[j], placements); } extras.push.apply(extras, newExtras); } } return { element: element, finishers: finishers, extras: extras }; }, decorateConstructor: function (elements, decorators) { var finishers = []; for (var i = decorators.length - 1; i >= 0; i--) { var obj = this.fromClassDescriptor(elements); var elementsAndFinisher = this.toClassDescriptor((0, decorators[i])(obj) || obj); if (elementsAndFinisher.finisher !== undefined) { finishers.push(elementsAndFinisher.finisher); } if (elementsAndFinisher.elements !== undefined) { elements = elementsAndFinisher.elements; for (var j = 0; j < elements.length - 1; j++) { for (var k = j + 1; k < elements.length; k++) { if (elements[j].key === elements[k].key && elements[j].placement === elements[k].placement) { throw new TypeError("Duplicated element (" + elements[j].key + ")"); } } } } } return { elements: elements, finishers: finishers }; }, fromElementDescriptor: function (element) { var obj = { kind: element.kind, key: element.key, placement: element.placement, descriptor: element.descriptor }; var desc = { value: "Descriptor", configurable: true }; Object.defineProperty(obj, Symbol.toStringTag, desc); if (element.kind === "field") obj.initializer = element.initializer; return obj; }, toElementDescriptors: function (elementObjects) { if (elementObjects === undefined) return; return _toArray(elementObjects).map(function (elementObject) { var element = this.toElementDescriptor(elementObject); this.disallowProperty(elementObject, "finisher", "An element descriptor"); this.disallowProperty(elementObject, "extras", "An element descriptor"); return element; }, this); }, toElementDescriptor: function (elementObject) { var kind = String(elementObject.kind); if (kind !== "method" && kind !== "field") { throw new TypeError('An element descriptor\'s .kind property must be either "method" or' + ' "field", but a decorator created an element descriptor with' + ' .kind "' + kind + '"'); } var key = _toPropertyKey(elementObject.key); var placement = String(elementObject.placement); if (placement !== "static" && placement !== "prototype" && placement !== "own") { throw new TypeError('An element descriptor\'s .placement property must be one of "static",' + ' "prototype" or "own", but a decorator created an element descriptor' + ' with .placement "' + placement + '"'); } var descriptor = elementObject.descriptor; this.disallowProperty(elementObject, "elements", "An element descriptor"); var element = { kind: kind, key: key, placement: placement, descriptor: Object.assign({}, descriptor) }; if (kind !== "field") { this.disallowProperty(elementObject, "initializer", "A method descriptor"); } else { this.disallowProperty(descriptor, "get", "The property descriptor of a field descriptor"); this.disallowProperty(descriptor, "set", "The property descriptor of a field descriptor"); this.disallowProperty(descriptor, "value", "The property descriptor of a field descriptor"); element.initializer = elementObject.initializer; } return element; }, toElementFinisherExtras: function (elementObject) { var element = this.toElementDescriptor(elementObject); var finisher = _optionalCallableProperty(elementObject, "finisher"); var extras = this.toElementDescriptors(elementObject.extras); return { element: element, finisher: finisher, extras: extras }; }, fromClassDescriptor: function (elements) { var obj = { kind: "class", elements: elements.map(this.fromElementDescriptor, this) }; var desc = { value: "Descriptor", configurable: true }; Object.defineProperty(obj, Symbol.toStringTag, desc); return obj; }, toClassDescriptor: function (obj) { var kind = String(obj.kind); if (kind !== "class") { throw new TypeError('A class descriptor\'s .kind property must be "class", but a decorator' + ' created a class descriptor with .kind "' + kind + '"'); } this.disallowProperty(obj, "key", "A class descriptor"); this.disallowProperty(obj, "placement", "A class descriptor"); this.disallowProperty(obj, "descriptor", "A class descriptor"); this.disallowProperty(obj, "initializer", "A class descriptor"); this.disallowProperty(obj, "extras", "A class descriptor"); var finisher = _optionalCallableProperty(obj, "finisher"); var elements = this.toElementDescriptors(obj.elements); return { elements: elements, finisher: finisher }; }, runClassFinishers: function (constructor, finishers) { for (var i = 0; i < finishers.length; i++) { var newConstructor = (0, finishers[i])(constructor); if (newConstructor !== undefined) { if (typeof newConstructor !== "function") { throw new TypeError("Finishers must return a constructor."); } constructor = newConstructor; } } return constructor; }, disallowProperty: function (obj, name, objectType) { if (obj[name] !== undefined) { throw new TypeError(objectType + " can't have a ." + name + " property."); } } }; return api; } + +function _createElementDescriptor(def) { var key = _toPropertyKey(def.key); var descriptor; if (def.kind === "method") { descriptor = { value: def.value, writable: true, configurable: true, enumerable: false }; } else if (def.kind === "get") { descriptor = { get: def.value, configurable: true, enumerable: false }; } else if (def.kind === "set") { descriptor = { set: def.value, configurable: true, enumerable: false }; } else if (def.kind === "field") { descriptor = { configurable: true, writable: true, enumerable: true }; } var element = { kind: def.kind === "field" ? "field" : "method", key: key, placement: def.static ? "static" : def.kind === "field" ? "own" : "prototype", descriptor: descriptor }; if (def.decorators) element.decorators = def.decorators; if (def.kind === "field") element.initializer = def.value; return element; } + +function _coalesceGetterSetter(element, other) { if (element.descriptor.get !== undefined) { other.descriptor.get = element.descriptor.get; } else { other.descriptor.set = element.descriptor.set; } } + +function _coalesceClassElements(elements) { var newElements = []; var isSameElement = function (other) { return other.kind === "method" && other.key === element.key && other.placement === element.placement; }; for (var i = 0; i < elements.length; i++) { var element = elements[i]; var other; if (element.kind === "method" && (other = newElements.find(isSameElement))) { if (_isDataDescriptor(element.descriptor) || _isDataDescriptor(other.descriptor)) { if (_hasDecorators(element) || _hasDecorators(other)) { throw new ReferenceError("Duplicated methods (" + element.key + ") can't be decorated."); } other.descriptor = element.descriptor; } else { if (_hasDecorators(element)) { if (_hasDecorators(other)) { throw new ReferenceError("Decorators can't be placed on different accessors with for " + "the same property (" + element.key + ")."); } other.decorators = element.decorators; } _coalesceGetterSetter(element, other); } } else { newElements.push(element); } } return newElements; } + +function _hasDecorators(element) { return element.decorators && element.decorators.length; } + +function _isDataDescriptor(desc) { return desc !== undefined && !(desc.value === undefined && desc.writable === undefined); } + +function _optionalCallableProperty(obj, name) { var value = obj[name]; if (value !== undefined && typeof value !== "function") { throw new TypeError("Expected '" + name + "' to be a function"); } return value; } + +function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); } + +function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } + +function _toArray(arr) { return _arrayWithHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableRest(); } + +function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } + +function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } + +function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; } + +function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); } + +function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } + +function decorate(value) { + return function (target, propertyKey, descriptor) {}; +} + +let A = _decorate(null, function (_initialize) { + "use strict"; + + class A { + constructor() { + _initialize(this); + } + + } + + return { + F: A, + d: [{ + kind: "field", + decorators: [decorate(false)], + key: "decoratedMember", + value: void 0 + }] + }; +}); + +class B extends A { + constructor() { + super(); + } + + myMethod() {} + +} + +const b = new B(); diff --git a/packages/babel-helper-create-class-features-plugin/test/fixtures/plugin-proposal-private-methods/loose-false/options.json b/packages/babel-helper-create-class-features-plugin/test/fixtures/plugin-proposal-private-methods/loose-false/options.json index f85119d087cc..31c874fe9097 100644 --- a/packages/babel-helper-create-class-features-plugin/test/fixtures/plugin-proposal-private-methods/loose-false/options.json +++ b/packages/babel-helper-create-class-features-plugin/test/fixtures/plugin-proposal-private-methods/loose-false/options.json @@ -1,5 +1,3 @@ { - "plugins": [ - ["proposal-private-methods", { "loose": false }] - ] + "plugins": [["proposal-private-methods", { "loose": false }]] } diff --git a/packages/babel-helper-create-class-features-plugin/test/fixtures/plugin-proposal-private-methods/loose-true/options.json b/packages/babel-helper-create-class-features-plugin/test/fixtures/plugin-proposal-private-methods/loose-true/options.json index e0ee1124a93a..0d20a8dcadc8 100644 --- a/packages/babel-helper-create-class-features-plugin/test/fixtures/plugin-proposal-private-methods/loose-true/options.json +++ b/packages/babel-helper-create-class-features-plugin/test/fixtures/plugin-proposal-private-methods/loose-true/options.json @@ -1,5 +1,3 @@ { - "plugins": [ - ["proposal-private-methods", { "loose": true }] - ] + "plugins": [["proposal-private-methods", { "loose": true }]] } diff --git a/packages/babel-helper-create-class-features-plugin/test/fixtures/tdz-error-computed-prototypes/loose-false/input.js b/packages/babel-helper-create-class-features-plugin/test/fixtures/tdz-error-computed-prototypes/loose-false/input.js new file mode 100644 index 000000000000..cbebe00211cc --- /dev/null +++ b/packages/babel-helper-create-class-features-plugin/test/fixtures/tdz-error-computed-prototypes/loose-false/input.js @@ -0,0 +1,6 @@ +class Foo { + static nickname = 'Tom'; + ['HELLO']() { + console.log('>>>>', Foo); + } +} \ No newline at end of file diff --git a/packages/babel-helper-create-class-features-plugin/test/fixtures/tdz-error-computed-prototypes/loose-false/options.json b/packages/babel-helper-create-class-features-plugin/test/fixtures/tdz-error-computed-prototypes/loose-false/options.json new file mode 100644 index 000000000000..4a570ff574c8 --- /dev/null +++ b/packages/babel-helper-create-class-features-plugin/test/fixtures/tdz-error-computed-prototypes/loose-false/options.json @@ -0,0 +1,10 @@ +{ + "plugins": [ + [ + "proposal-class-properties", + { + "loose": false + } + ] + ] +} diff --git a/packages/babel-helper-create-class-features-plugin/test/fixtures/tdz-error-computed-prototypes/loose-false/output.js b/packages/babel-helper-create-class-features-plugin/test/fixtures/tdz-error-computed-prototypes/loose-false/output.js new file mode 100644 index 000000000000..b4a5e95cfb40 --- /dev/null +++ b/packages/babel-helper-create-class-features-plugin/test/fixtures/tdz-error-computed-prototypes/loose-false/output.js @@ -0,0 +1,10 @@ +function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } + +class Foo { + ['HELLO']() { + console.log('>>>>', Foo); + } + +} + +_defineProperty(Foo, "nickname", 'Tom'); diff --git a/packages/babel-helper-create-class-features-plugin/test/fixtures/tdz-error-computed-prototypes/loose-true/input.js b/packages/babel-helper-create-class-features-plugin/test/fixtures/tdz-error-computed-prototypes/loose-true/input.js new file mode 100644 index 000000000000..cbebe00211cc --- /dev/null +++ b/packages/babel-helper-create-class-features-plugin/test/fixtures/tdz-error-computed-prototypes/loose-true/input.js @@ -0,0 +1,6 @@ +class Foo { + static nickname = 'Tom'; + ['HELLO']() { + console.log('>>>>', Foo); + } +} \ No newline at end of file diff --git a/packages/babel-helper-create-class-features-plugin/test/fixtures/tdz-error-computed-prototypes/loose-true/options.json b/packages/babel-helper-create-class-features-plugin/test/fixtures/tdz-error-computed-prototypes/loose-true/options.json new file mode 100644 index 000000000000..0a3e4189c2b1 --- /dev/null +++ b/packages/babel-helper-create-class-features-plugin/test/fixtures/tdz-error-computed-prototypes/loose-true/options.json @@ -0,0 +1,10 @@ +{ + "plugins": [ + [ + "proposal-class-properties", + { + "loose": true + } + ] + ] +} diff --git a/packages/babel-helper-create-class-features-plugin/test/fixtures/tdz-error-computed-prototypes/loose-true/output.js b/packages/babel-helper-create-class-features-plugin/test/fixtures/tdz-error-computed-prototypes/loose-true/output.js new file mode 100644 index 000000000000..c42939ebe066 --- /dev/null +++ b/packages/babel-helper-create-class-features-plugin/test/fixtures/tdz-error-computed-prototypes/loose-true/output.js @@ -0,0 +1,8 @@ +class Foo { + ['HELLO']() { + console.log('>>>>', Foo); + } + +} + +Foo.nickname = 'Tom'; diff --git a/packages/babel-plugin-syntax-dynamic-import/.npmignore b/packages/babel-helper-create-regexp-features-plugin/.npmignore similarity index 100% rename from packages/babel-plugin-syntax-dynamic-import/.npmignore rename to packages/babel-helper-create-regexp-features-plugin/.npmignore diff --git a/packages/babel-helper-create-regexp-features-plugin/README.md b/packages/babel-helper-create-regexp-features-plugin/README.md new file mode 100644 index 000000000000..69f661bd987e --- /dev/null +++ b/packages/babel-helper-create-regexp-features-plugin/README.md @@ -0,0 +1,19 @@ +# @babel/helper-create-regexp-features-plugin + +> Compile ESNext Regular Expressions to ES5 + +See our website [@babel/helper-create-regexp-features-plugin](https://babeljs.io/docs/en/next/babel-helper-create-regexp-features-plugin.html) for more information. + +## Install + +Using npm: + +```sh +npm install --save-dev @babel/helper-create-regexp-features-plugin +``` + +or using yarn: + +```sh +yarn add @babel/helper-create-regexp-features-plugin --dev +``` diff --git a/packages/babel-helper-create-regexp-features-plugin/package.json b/packages/babel-helper-create-regexp-features-plugin/package.json new file mode 100644 index 000000000000..020b1f31ca40 --- /dev/null +++ b/packages/babel-helper-create-regexp-features-plugin/package.json @@ -0,0 +1,32 @@ +{ + "name": "@babel/helper-create-regexp-features-plugin", + "version": "7.8.8", + "author": "The Babel Team (https://babeljs.io/team)", + "license": "MIT", + "description": "Compile ESNext Regular Expressions to ES5", + "repository": { + "type": "git", + "url": "https://github.com/babel/babel", + "directory": "packages/babel-helper-create-regexp-features-plugin" + }, + "main": "lib/index.js", + "publishConfig": { + "access": "public" + }, + "keywords": [ + "babel", + "babel-plugin" + ], + "dependencies": { + "@babel/helper-annotate-as-pure": "^7.8.3", + "@babel/helper-regex": "^7.8.3", + "regexpu-core": "^4.7.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0" + }, + "devDependencies": { + "@babel/core": "^7.8.6", + "@babel/helper-plugin-test-runner": "^7.8.3" + } +} diff --git a/packages/babel-helper-create-regexp-features-plugin/src/features.js b/packages/babel-helper-create-regexp-features-plugin/src/features.js new file mode 100644 index 000000000000..8e82b1342e88 --- /dev/null +++ b/packages/babel-helper-create-regexp-features-plugin/src/features.js @@ -0,0 +1,27 @@ +// @flow +export const FEATURES = Object.freeze({ + unicodeFlag: 1 << 0, + dotAllFlag: 1 << 1, + unicodePropertyEscape: 1 << 2, + namedCaptureGroups: 1 << 3, +}); + +// We can't use a symbol because this needs to always be the same, even if +// this package isn't deduped by npm. e.g. +// - node_modules/ +// - @babel/plugin-regexp-features +// - @babel/plugin-proposal-unicode-property-regex +// - node_modules +// - @babel-plugin-regexp-features +export const featuresKey = "@babel/plugin-regexp-features/featuresKey"; +export const runtimeKey = "@babel/plugin-regexp-features/runtimeKey"; + +type FeatureType = $Values; + +export function enableFeature(features: number, feature: FeatureType): number { + return features | feature; +} + +export function hasFeature(features: number, feature: FeatureType) { + return !!(features & feature); +} diff --git a/packages/babel-helper-create-regexp-features-plugin/src/index.js b/packages/babel-helper-create-regexp-features-plugin/src/index.js new file mode 100644 index 000000000000..60b7f2a682d2 --- /dev/null +++ b/packages/babel-helper-create-regexp-features-plugin/src/index.js @@ -0,0 +1,98 @@ +import rewritePattern from "regexpu-core"; +import { + featuresKey, + FEATURES, + enableFeature, + runtimeKey, + hasFeature, +} from "./features"; +import { generateRegexpuOptions } from "./util"; + +import pkg from "../package.json"; +import { types as t } from "@babel/core"; +import { pullFlag } from "@babel/helper-regex"; +import annotateAsPure from "@babel/helper-annotate-as-pure"; + +// Note: Versions are represented as an integer. e.g. 7.1.5 is represented +// as 70000100005. This method is easier than using a semver-parsing +// package, but it breaks if we release x.y.z where x, y or z are +// greater than 99_999. +const version = pkg.version.split(".").reduce((v, x) => v * 1e5 + +x, 0); +const versionKey = "@babel/plugin-regexp-features/version"; + +export function createRegExpFeaturePlugin({ name, feature, options = {} }) { + return { + name, + pre() { + const { file } = this; + const features = file.get(featuresKey) ?? 0; + let newFeatures = enableFeature(features, FEATURES[feature]); + + const { useUnicodeFlag, runtime = true } = options; + if (useUnicodeFlag === false) { + newFeatures = enableFeature(newFeatures, FEATURES.unicodeFlag); + } + if (newFeatures !== features) { + file.set(featuresKey, newFeatures); + } + + if (!runtime) { + file.set(runtimeKey, false); + } + + if (!file.has(versionKey) || file.get(versionKey) < version) { + file.set(versionKey, version); + } + }, + + visitor: { + RegExpLiteral(path) { + const { node } = path; + const { file } = this; + const features = file.get(featuresKey); + const runtime = file.get(runtimeKey) ?? true; + const regexpuOptions = generateRegexpuOptions(node, features); + if (regexpuOptions === null) { + return; + } + const namedCaptureGroups = {}; + if (regexpuOptions.namedGroup) { + regexpuOptions.onNamedGroup = (name, index) => { + namedCaptureGroups[name] = index; + }; + } + node.pattern = rewritePattern(node.pattern, node.flags, regexpuOptions); + + if ( + regexpuOptions.namedGroup && + Object.keys(namedCaptureGroups).length > 0 && + runtime && + !isRegExpTest(path) + ) { + const call = t.callExpression(this.addHelper("wrapRegExp"), [ + node, + t.valueToNode(namedCaptureGroups), + ]); + annotateAsPure(call); + + path.replaceWith(call); + } + if (hasFeature(features, FEATURES.unicodeFlag)) { + pullFlag(node, "u"); + } + if (hasFeature(features, FEATURES.dotAllFlag)) { + pullFlag(node, "s"); + } + }, + }, + }; +} + +function isRegExpTest(path) { + return ( + path.parentPath.isMemberExpression({ + object: path.node, + computed: false, + }) && path.parentPath.get("property").isIdentifier({ name: "test" }) + ); +} diff --git a/packages/babel-helper-create-regexp-features-plugin/src/util.js b/packages/babel-helper-create-regexp-features-plugin/src/util.js new file mode 100644 index 000000000000..bc6f89dcebce --- /dev/null +++ b/packages/babel-helper-create-regexp-features-plugin/src/util.js @@ -0,0 +1,56 @@ +import { FEATURES, hasFeature } from "./features"; + +export function generateRegexpuOptions(node, features) { + let useUnicodeFlag = false, + dotAllFlag = false, + unicodePropertyEscape = false, + namedGroup = false; + const { flags, pattern } = node; + const flagsIncludesU = flags.includes("u"); + + if (flagsIncludesU) { + if (!hasFeature(features, FEATURES.unicodeFlag)) { + useUnicodeFlag = true; + } + if ( + hasFeature(features, FEATURES.unicodePropertyEscape) && + /\\[pP]{/.test(pattern) + ) { + unicodePropertyEscape = true; + } + } + + if (hasFeature(features, FEATURES.dotAllFlag) && flags.indexOf("s") >= 0) { + dotAllFlag = true; + } + if ( + hasFeature(features, FEATURES.namedCaptureGroups) && + /\(\?<(?![=!])/.test(pattern) + ) { + namedGroup = true; + } + if ( + !namedGroup && + !unicodePropertyEscape && + !dotAllFlag && + (!flagsIncludesU || useUnicodeFlag) + ) { + return null; + } + // Now we have to feed regexpu-core the regex + if (flagsIncludesU && flags.indexOf("s") >= 0) { + // When flags includes u, `config.unicode` will be enabled even if `u` is supported natively. + // In this case we have to enable dotAllFlag, otherwise `rewritePattern(/./su)` will return + // incorrect result + // https://github.com/mathiasbynens/regexpu-core/blob/v4.6.0/rewrite-pattern.js#L191 + dotAllFlag = true; + } + return { + useUnicodeFlag, + onNamedGroup: () => {}, + namedGroup, + unicodePropertyEscape, + dotAllFlag, + lookbehind: true, + }; +} diff --git a/packages/babel-helper-create-regexp-features-plugin/test/fixtures/plugin-proposal-unicode-property-regex/use-unicode-flag-false-not-overwritten/input.mjs b/packages/babel-helper-create-regexp-features-plugin/test/fixtures/plugin-proposal-unicode-property-regex/use-unicode-flag-false-not-overwritten/input.mjs new file mode 100644 index 000000000000..f972b98245a9 --- /dev/null +++ b/packages/babel-helper-create-regexp-features-plugin/test/fixtures/plugin-proposal-unicode-property-regex/use-unicode-flag-false-not-overwritten/input.mjs @@ -0,0 +1 @@ +/\p{Script_Extensions=Wancho}/u diff --git a/packages/babel-helper-create-regexp-features-plugin/test/fixtures/plugin-proposal-unicode-property-regex/use-unicode-flag-false-not-overwritten/options.json b/packages/babel-helper-create-regexp-features-plugin/test/fixtures/plugin-proposal-unicode-property-regex/use-unicode-flag-false-not-overwritten/options.json new file mode 100644 index 000000000000..d1c7bd8740ad --- /dev/null +++ b/packages/babel-helper-create-regexp-features-plugin/test/fixtures/plugin-proposal-unicode-property-regex/use-unicode-flag-false-not-overwritten/options.json @@ -0,0 +1,6 @@ +{ + "plugins": [ + ["proposal-unicode-property-regex", { "useUnicodeFlag": false }, "name 1"], + ["proposal-unicode-property-regex", { "useUnicodeFlag": true }, "name 2"] + ] +} diff --git a/packages/babel-helper-create-regexp-features-plugin/test/fixtures/plugin-proposal-unicode-property-regex/use-unicode-flag-false-not-overwritten/output.mjs b/packages/babel-helper-create-regexp-features-plugin/test/fixtures/plugin-proposal-unicode-property-regex/use-unicode-flag-false-not-overwritten/output.mjs new file mode 100644 index 000000000000..f43a80b8405b --- /dev/null +++ b/packages/babel-helper-create-regexp-features-plugin/test/fixtures/plugin-proposal-unicode-property-regex/use-unicode-flag-false-not-overwritten/output.mjs @@ -0,0 +1 @@ +/(?:\uD838[\uDEC0-\uDEF9\uDEFF])/; diff --git a/packages/babel-helper-create-regexp-features-plugin/test/fixtures/plugin-transform-named-capturing-groups-regex/runtime-false-not-overwritten/input.mjs b/packages/babel-helper-create-regexp-features-plugin/test/fixtures/plugin-transform-named-capturing-groups-regex/runtime-false-not-overwritten/input.mjs new file mode 100644 index 000000000000..3d7f5b1517b5 --- /dev/null +++ b/packages/babel-helper-create-regexp-features-plugin/test/fixtures/plugin-transform-named-capturing-groups-regex/runtime-false-not-overwritten/input.mjs @@ -0,0 +1 @@ +/(?\d{4})/ diff --git a/packages/babel-helper-create-regexp-features-plugin/test/fixtures/plugin-transform-named-capturing-groups-regex/runtime-false-not-overwritten/options.json b/packages/babel-helper-create-regexp-features-plugin/test/fixtures/plugin-transform-named-capturing-groups-regex/runtime-false-not-overwritten/options.json new file mode 100644 index 000000000000..ca279789330b --- /dev/null +++ b/packages/babel-helper-create-regexp-features-plugin/test/fixtures/plugin-transform-named-capturing-groups-regex/runtime-false-not-overwritten/options.json @@ -0,0 +1,6 @@ +{ + "plugins": [ + ["transform-named-capturing-groups-regex", { "runtime": false }, "name 1"], + ["transform-named-capturing-groups-regex", { "runtime": true }, "name 2"] + ] +} diff --git a/packages/babel-helper-create-regexp-features-plugin/test/fixtures/plugin-transform-named-capturing-groups-regex/runtime-false-not-overwritten/output.mjs b/packages/babel-helper-create-regexp-features-plugin/test/fixtures/plugin-transform-named-capturing-groups-regex/runtime-false-not-overwritten/output.mjs new file mode 100644 index 000000000000..f47a50b38088 --- /dev/null +++ b/packages/babel-helper-create-regexp-features-plugin/test/fixtures/plugin-transform-named-capturing-groups-regex/runtime-false-not-overwritten/output.mjs @@ -0,0 +1 @@ +/([0-9]{4})/; diff --git a/packages/babel-helper-create-regexp-features-plugin/test/index.js b/packages/babel-helper-create-regexp-features-plugin/test/index.js new file mode 100644 index 000000000000..1b534b8fc64a --- /dev/null +++ b/packages/babel-helper-create-regexp-features-plugin/test/index.js @@ -0,0 +1,3 @@ +import runner from "@babel/helper-plugin-test-runner"; + +runner(__dirname); diff --git a/packages/babel-helper-define-map/package.json b/packages/babel-helper-define-map/package.json index a51713a7f9f5..55a6db635e79 100644 --- a/packages/babel-helper-define-map/package.json +++ b/packages/babel-helper-define-map/package.json @@ -1,6 +1,6 @@ { "name": "@babel/helper-define-map", - "version": "7.5.5", + "version": "7.8.3", "description": "Helper function to define a map", "repository": "https://github.com/babel/babel/tree/master/packages/babel-helper-define-map", "license": "MIT", @@ -9,8 +9,8 @@ }, "main": "lib/index.js", "dependencies": { - "@babel/helper-function-name": "^7.1.0", - "@babel/types": "^7.5.5", + "@babel/helper-function-name": "^7.8.3", + "@babel/types": "^7.8.3", "lodash": "^4.17.13" } } diff --git a/packages/babel-helper-explode-assignable-expression/package.json b/packages/babel-helper-explode-assignable-expression/package.json index cf91ef586e0a..3333f7a1a3c7 100644 --- a/packages/babel-helper-explode-assignable-expression/package.json +++ b/packages/babel-helper-explode-assignable-expression/package.json @@ -1,6 +1,6 @@ { "name": "@babel/helper-explode-assignable-expression", - "version": "7.1.0", + "version": "7.8.3", "description": "Helper function to explode an assignable expression", "repository": "https://github.com/babel/babel/tree/master/packages/babel-helper-explode-assignable-expression", "license": "MIT", @@ -9,7 +9,7 @@ }, "main": "lib/index.js", "dependencies": { - "@babel/traverse": "^7.1.0", - "@babel/types": "^7.0.0" + "@babel/traverse": "^7.8.3", + "@babel/types": "^7.8.3" } } diff --git a/packages/babel-helper-explode-class/package.json b/packages/babel-helper-explode-class/package.json index ce7b0df4a3fe..024ffc3f5b09 100644 --- a/packages/babel-helper-explode-class/package.json +++ b/packages/babel-helper-explode-class/package.json @@ -1,6 +1,6 @@ { "name": "@babel/helper-explode-class", - "version": "7.1.0", + "version": "7.8.3", "description": "Helper function to explode class", "repository": "https://github.com/babel/babel/tree/master/packages/babel-helper-explode-class", "license": "MIT", @@ -9,8 +9,8 @@ }, "main": "lib/index.js", "dependencies": { - "@babel/helper-bindify-decorators": "^7.1.0", - "@babel/traverse": "^7.1.0", - "@babel/types": "^7.0.0" + "@babel/helper-bindify-decorators": "^7.8.3", + "@babel/traverse": "^7.8.3", + "@babel/types": "^7.8.3" } } diff --git a/packages/babel-helper-fixtures/package.json b/packages/babel-helper-fixtures/package.json index 809a91b81c73..4bebc35de488 100644 --- a/packages/babel-helper-fixtures/package.json +++ b/packages/babel-helper-fixtures/package.json @@ -1,6 +1,6 @@ { "name": "@babel/helper-fixtures", - "version": "7.5.5", + "version": "7.8.6", "description": "Helper function to support fixtures", "author": "Sebastian McKenzie ", "license": "MIT", @@ -11,7 +11,6 @@ "main": "lib/index.js", "dependencies": { "lodash": "^4.17.13", - "semver": "^5.3.0", - "try-resolve": "^1.0.0" + "semver": "^5.3.0" } } diff --git a/packages/babel-helper-fixtures/src/index.js b/packages/babel-helper-fixtures/src/index.js index 7fc0cf21a3c7..f0b4cd0914d6 100644 --- a/packages/babel-helper-fixtures/src/index.js +++ b/packages/babel-helper-fixtures/src/index.js @@ -1,6 +1,4 @@ import cloneDeep from "lodash/cloneDeep"; -import trimEnd from "lodash/trimEnd"; -import resolve from "try-resolve"; import clone from "lodash/clone"; import extend from "lodash/extend"; import semver from "semver"; @@ -36,6 +34,13 @@ type Suite = { filename: string, }; +function tryResolve(module) { + try { + return require.resolve(module); + } catch (e) { + return null; + } +} function assertDirectory(loc) { if (!fs.statSync(loc).isDirectory()) { throw new Error(`Expected ${loc} to be a directory.`); @@ -73,11 +78,185 @@ function findFile(filepath: string, allowJSON: boolean) { return matches[0]; } +function pushTask(taskName, taskDir, suite, suiteName) { + const taskDirStats = fs.statSync(taskDir); + let actualLoc = findFile(taskDir + "/input"); + let execLoc = findFile(taskDir + "/exec"); + + // If neither input nor exec is present it is not a real testcase + if (taskDirStats.isDirectory() && !actualLoc && !execLoc) { + if (fs.readdirSync(taskDir).length > 0) { + console.warn(`Skipped test folder with invalid layout: ${taskDir}`); + } + return; + } else if (!actualLoc) { + actualLoc = taskDir + "/input.js"; + } else if (!execLoc) { + execLoc = taskDir + "/exec.js"; + } + + const expectLoc = + findFile(taskDir + "/output", true /* allowJSON */) || + taskDir + "/output.js"; + const stdoutLoc = taskDir + "/stdout.txt"; + const stderrLoc = taskDir + "/stderr.txt"; + + const actualLocAlias = + suiteName + "/" + taskName + "/" + path.basename(actualLoc); + const expectLocAlias = + suiteName + "/" + taskName + "/" + path.basename(actualLoc); + let execLocAlias = + suiteName + "/" + taskName + "/" + path.basename(actualLoc); + + if (taskDirStats.isFile()) { + const ext = path.extname(taskDir); + if (EXTENSIONS.indexOf(ext) === -1) return; + + execLoc = taskDir; + execLocAlias = suiteName + "/" + taskName; + } + + const taskOpts = cloneDeep(suite.options); + + const taskOptsLoc = tryResolve(taskDir + "/options"); + if (taskOptsLoc) extend(taskOpts, require(taskOptsLoc)); + + const test = { + optionsDir: taskOptsLoc ? path.dirname(taskOptsLoc) : null, + title: humanize(taskName, true), + disabled: taskName[0] === ".", + options: taskOpts, + validateLogs: taskOpts.validateLogs, + ignoreOutput: taskOpts.ignoreOutput, + stdout: { loc: stdoutLoc, code: readFile(stdoutLoc) }, + stderr: { loc: stderrLoc, code: readFile(stderrLoc) }, + exec: { + loc: execLoc, + code: readFile(execLoc), + filename: execLocAlias, + }, + actual: { + loc: actualLoc, + code: readFile(actualLoc), + filename: actualLocAlias, + }, + expect: { + loc: expectLoc, + code: readFile(expectLoc), + filename: expectLocAlias, + }, + }; + + // If there's node requirement, check it before pushing task + if (taskOpts.minNodeVersion) { + const minimumVersion = semver.clean(taskOpts.minNodeVersion); + + if (minimumVersion == null) { + throw new Error( + `'minNodeVersion' has invalid semver format: ${taskOpts.minNodeVersion}`, + ); + } + + if (semver.lt(nodeVersion, minimumVersion)) { + return; + } + + // Delete to avoid option validation error + delete taskOpts.minNodeVersion; + } + + if (taskOpts.os) { + let os = taskOpts.os; + + if (!Array.isArray(os) && typeof os !== "string") { + throw new Error( + `'os' should be either string or string array: ${taskOpts.os}`, + ); + } + + if (typeof os === "string") { + os = [os]; + } + + if (!os.includes(process.platform)) { + return; + } + + delete taskOpts.os; + } + + // traceur checks + + if (test.exec.code.indexOf("// Async.") >= 0) { + return; + } + + suite.tests.push(test); + + const sourceMappingsLoc = taskDir + "/source-mappings.json"; + if (fs.existsSync(sourceMappingsLoc)) { + test.sourceMappings = JSON.parse(readFile(sourceMappingsLoc)); + } + + const sourceMapLoc = taskDir + "/source-map.json"; + if (fs.existsSync(sourceMapLoc)) { + test.sourceMap = JSON.parse(readFile(sourceMapLoc)); + } + + const inputMapLoc = taskDir + "/input-source-map.json"; + if (fs.existsSync(inputMapLoc)) { + test.inputSourceMap = JSON.parse(readFile(inputMapLoc)); + } + + if (taskOpts.throws) { + if (test.expect.code) { + throw new Error( + "Test cannot throw and also return output code: " + expectLoc, + ); + } + if (test.sourceMappings) { + throw new Error( + "Test cannot throw and also return sourcemappings: " + + sourceMappingsLoc, + ); + } + if (test.sourceMap) { + throw new Error( + "Test cannot throw and also return sourcemaps: " + sourceMapLoc, + ); + } + } + + if (!test.validateLogs && (test.stdout.code || test.stderr.code)) { + throw new Error( + "stdout.txt and stderr.txt are only allowed when the 'validateLogs' option is enabled: " + + (test.stdout.code ? stdoutLoc : stderrLoc), + ); + } + if (test.options.ignoreOutput) { + if (test.expect.code) { + throw new Error( + "Test cannot ignore its output and also validate it: " + expectLoc, + ); + } + if (!test.validateLogs) { + throw new Error( + "ignoreOutput can only be used when validateLogs is true: " + + taskOptsLoc, + ); + } + } + + // Delete to avoid option validation error + delete test.options.validateLogs; + delete test.options.ignoreOutput; +} + export default function get(entryLoc): Array { const suites = []; let rootOpts = {}; - const rootOptsLoc = resolve(entryLoc + "/options"); + const rootOptsLoc = tryResolve(entryLoc + "/options"); if (rootOptsLoc) rootOpts = require(rootOptsLoc); for (const suiteName of fs.readdirSync(entryLoc)) { @@ -93,137 +272,11 @@ export default function get(entryLoc): Array { assertDirectory(suite.filename); suites.push(suite); - const suiteOptsLoc = resolve(suite.filename + "/options"); + const suiteOptsLoc = tryResolve(suite.filename + "/options"); if (suiteOptsLoc) suite.options = require(suiteOptsLoc); for (const taskName of fs.readdirSync(suite.filename)) { - push(taskName, suite.filename + "/" + taskName); - } - - function push(taskName, taskDir) { - const taskDirStats = fs.statSync(taskDir); - let actualLoc = findFile(taskDir + "/input"); - let execLoc = findFile(taskDir + "/exec"); - - // If neither input nor exec is present it is not a real testcase - if (taskDirStats.isDirectory() && !actualLoc && !execLoc) { - if (fs.readdirSync(taskDir).length > 0) { - console.warn(`Skipped test folder with invalid layout: ${taskDir}`); - } - return; - } else if (!actualLoc) { - actualLoc = taskDir + "/input.js"; - } else if (!execLoc) { - execLoc = taskDir + "/exec.js"; - } - - const expectLoc = - findFile(taskDir + "/output", true /* allowJSON */) || - taskDir + "/output.js"; - - const actualLocAlias = - suiteName + "/" + taskName + "/" + path.basename(actualLoc); - const expectLocAlias = - suiteName + "/" + taskName + "/" + path.basename(actualLoc); - let execLocAlias = - suiteName + "/" + taskName + "/" + path.basename(actualLoc); - - if (taskDirStats.isFile()) { - const ext = path.extname(taskDir); - if (EXTENSIONS.indexOf(ext) === -1) return; - - execLoc = taskDir; - execLocAlias = suiteName + "/" + taskName; - } - - const taskOpts = cloneDeep(suite.options); - - const taskOptsLoc = resolve(taskDir + "/options"); - if (taskOptsLoc) extend(taskOpts, require(taskOptsLoc)); - - const test = { - optionsDir: taskOptsLoc ? path.dirname(taskOptsLoc) : null, - title: humanize(taskName, true), - disabled: taskName[0] === ".", - options: taskOpts, - exec: { - loc: execLoc, - code: readFile(execLoc), - filename: execLocAlias, - }, - actual: { - loc: actualLoc, - code: readFile(actualLoc), - filename: actualLocAlias, - }, - expect: { - loc: expectLoc, - code: readFile(expectLoc), - filename: expectLocAlias, - }, - }; - - // If there's node requirement, check it before pushing task - if (taskOpts.minNodeVersion) { - const minimumVersion = semver.clean(taskOpts.minNodeVersion); - - if (minimumVersion == null) { - throw new Error( - `'minNodeVersion' has invalid semver format: ${ - taskOpts.minNodeVersion - }`, - ); - } - - if (semver.lt(nodeVersion, minimumVersion)) { - return; - } - - // Delete to avoid option validation error - delete taskOpts.minNodeVersion; - } - - // traceur checks - - if (test.exec.code.indexOf("// Async.") >= 0) { - return; - } - - suite.tests.push(test); - - const sourceMappingsLoc = taskDir + "/source-mappings.json"; - if (fs.existsSync(sourceMappingsLoc)) { - test.sourceMappings = JSON.parse(readFile(sourceMappingsLoc)); - } - - const sourceMapLoc = taskDir + "/source-map.json"; - if (fs.existsSync(sourceMapLoc)) { - test.sourceMap = JSON.parse(readFile(sourceMapLoc)); - } - - const inputMapLoc = taskDir + "/input-source-map.json"; - if (fs.existsSync(inputMapLoc)) { - test.inputSourceMap = JSON.parse(readFile(inputMapLoc)); - } - - if (taskOpts.throws) { - if (test.expect.code) { - throw new Error( - "Test cannot throw and also return output code: " + expectLoc, - ); - } - if (test.sourceMappings) { - throw new Error( - "Test cannot throw and also return sourcemappings: " + - sourceMappingsLoc, - ); - } - if (test.sourceMap) { - throw new Error( - "Test cannot throw and also return sourcemaps: " + sourceMapLoc, - ); - } - } + pushTask(taskName, suite.filename + "/" + taskName, suite, suiteName); } } @@ -247,7 +300,7 @@ export function multiple(entryLoc, ignore?: Array) { export function readFile(filename) { if (fs.existsSync(filename)) { - let file = trimEnd(fs.readFileSync(filename, "utf8")); + let file = fs.readFileSync(filename, "utf8").trimRight(); file = file.replace(/\r\n/g, "\n"); return file; } else { diff --git a/packages/babel-helper-function-name/package.json b/packages/babel-helper-function-name/package.json index 77670f935a38..ad409b2ce496 100644 --- a/packages/babel-helper-function-name/package.json +++ b/packages/babel-helper-function-name/package.json @@ -1,6 +1,6 @@ { "name": "@babel/helper-function-name", - "version": "7.1.0", + "version": "7.9.5", "description": "Helper function to change the property 'name' of every function", "repository": "https://github.com/babel/babel/tree/master/packages/babel-helper-function-name", "license": "MIT", @@ -9,8 +9,8 @@ }, "main": "lib/index.js", "dependencies": { - "@babel/helper-get-function-arity": "^7.0.0", - "@babel/template": "^7.1.0", - "@babel/types": "^7.0.0" + "@babel/helper-get-function-arity": "^7.8.3", + "@babel/template": "^7.8.3", + "@babel/types": "^7.9.5" } } diff --git a/packages/babel-helper-function-name/src/index.js b/packages/babel-helper-function-name/src/index.js index bdce1f819c12..b736d76f575a 100644 --- a/packages/babel-helper-function-name/src/index.js +++ b/packages/babel-helper-function-name/src/index.js @@ -179,7 +179,7 @@ export default function({ node, parent, scope, id }, localBinding = false) { return; } } - } else if (t.isAssignmentExpression(parent)) { + } else if (t.isAssignmentExpression(parent, { operator: "=" })) { // foo = function () {}; id = parent.left; } else if (!id) { diff --git a/packages/babel-helper-get-function-arity/package.json b/packages/babel-helper-get-function-arity/package.json index 1ed46aabd225..9869e945fad5 100644 --- a/packages/babel-helper-get-function-arity/package.json +++ b/packages/babel-helper-get-function-arity/package.json @@ -1,6 +1,6 @@ { "name": "@babel/helper-get-function-arity", - "version": "7.0.0", + "version": "7.8.3", "description": "Helper function to get function arity", "repository": "https://github.com/babel/babel/tree/master/packages/babel-helper-get-function-arity", "license": "MIT", @@ -9,6 +9,6 @@ }, "main": "lib/index.js", "dependencies": { - "@babel/types": "^7.0.0" + "@babel/types": "^7.8.3" } } diff --git a/packages/babel-helper-hoist-variables/package.json b/packages/babel-helper-hoist-variables/package.json index dad2e954ce2f..5b7fe5a0fd3a 100644 --- a/packages/babel-helper-hoist-variables/package.json +++ b/packages/babel-helper-hoist-variables/package.json @@ -1,6 +1,6 @@ { "name": "@babel/helper-hoist-variables", - "version": "7.4.4", + "version": "7.8.3", "description": "Helper function to hoist variables", "repository": "https://github.com/babel/babel/tree/master/packages/babel-helper-hoist-variables", "license": "MIT", @@ -9,6 +9,6 @@ }, "main": "lib/index.js", "dependencies": { - "@babel/types": "^7.4.4" + "@babel/types": "^7.8.3" } } diff --git a/packages/babel-helper-member-expression-to-functions/package.json b/packages/babel-helper-member-expression-to-functions/package.json index 4e94f0cdefaf..5cd723b5fce5 100644 --- a/packages/babel-helper-member-expression-to-functions/package.json +++ b/packages/babel-helper-member-expression-to-functions/package.json @@ -1,6 +1,6 @@ { "name": "@babel/helper-member-expression-to-functions", - "version": "7.5.5", + "version": "7.8.3", "description": "Helper function to replace certain member expressions with function calls", "repository": "https://github.com/babel/babel/tree/master/packages/babel-helper-member-expression-to-functions", "license": "MIT", @@ -10,6 +10,6 @@ "main": "lib/index.js", "author": "Justin Ridgewell ", "dependencies": { - "@babel/types": "^7.5.5" + "@babel/types": "^7.8.3" } } diff --git a/packages/babel-helper-module-imports/package.json b/packages/babel-helper-module-imports/package.json index e740d2f546bb..0e0d0e47e24a 100644 --- a/packages/babel-helper-module-imports/package.json +++ b/packages/babel-helper-module-imports/package.json @@ -1,6 +1,6 @@ { "name": "@babel/helper-module-imports", - "version": "7.0.0", + "version": "7.8.3", "description": "Babel helper functions for inserting module loads", "author": "Logan Smyth ", "homepage": "https://babeljs.io/", @@ -11,9 +11,9 @@ "repository": "https://github.com/babel/babel/tree/master/packages/babel-helper-module-imports", "main": "lib/index.js", "dependencies": { - "@babel/types": "^7.0.0" + "@babel/types": "^7.8.3" }, "devDependencies": { - "@babel/core": "^7.0.0" + "@babel/core": "^7.8.3" } } diff --git a/packages/babel-helper-module-imports/src/import-injector.js b/packages/babel-helper-module-imports/src/import-injector.js index 0e38f9188ab9..59375b6c9cac 100644 --- a/packages/babel-helper-module-imports/src/import-injector.js +++ b/packages/babel-helper-module-imports/src/import-injector.js @@ -417,10 +417,10 @@ export default class ImportInjector { node._blockHoist = blockHoist; }); - const targetPath = this._programPath.get("body").filter(p => { + const targetPath = this._programPath.get("body").find(p => { const val = p.node._blockHoist; return Number.isFinite(val) && val < 4; - })[0]; + }); if (targetPath) { targetPath.insertBefore(statements); diff --git a/packages/babel-helper-module-transforms/package.json b/packages/babel-helper-module-transforms/package.json index 3e4d55182dcf..003dd6ede190 100644 --- a/packages/babel-helper-module-transforms/package.json +++ b/packages/babel-helper-module-transforms/package.json @@ -1,6 +1,6 @@ { "name": "@babel/helper-module-transforms", - "version": "7.5.5", + "version": "7.9.0", "description": "Babel helper functions for implementing ES6 module transformations", "author": "Logan Smyth ", "homepage": "https://babeljs.io/", @@ -11,11 +11,12 @@ "repository": "https://github.com/babel/babel/tree/master/packages/babel-helper-module-transforms", "main": "lib/index.js", "dependencies": { - "@babel/helper-module-imports": "^7.0.0", - "@babel/helper-simple-access": "^7.1.0", - "@babel/helper-split-export-declaration": "^7.4.4", - "@babel/template": "^7.4.4", - "@babel/types": "^7.5.5", + "@babel/helper-module-imports": "^7.8.3", + "@babel/helper-replace-supers": "^7.8.6", + "@babel/helper-simple-access": "^7.8.3", + "@babel/helper-split-export-declaration": "^7.8.3", + "@babel/template": "^7.8.6", + "@babel/types": "^7.9.0", "lodash": "^4.17.13" } } diff --git a/packages/babel-helper-module-transforms/src/get-module-name.js b/packages/babel-helper-module-transforms/src/get-module-name.js new file mode 100644 index 000000000000..0e4e81ad3e00 --- /dev/null +++ b/packages/babel-helper-module-transforms/src/get-module-name.js @@ -0,0 +1,52 @@ +// @flow + +export default function getModuleName( + rootOpts: Object, + pluginOpts: Object, +): ?string { + const { + filename, + filenameRelative = filename, + + sourceRoot = pluginOpts.moduleRoot ?? rootOpts.moduleRoot, + } = rootOpts; + + const { + moduleId = rootOpts.moduleId, + moduleIds = rootOpts.moduleIds ?? !!moduleId, + + getModuleId = rootOpts.getModuleId, + + moduleRoot = rootOpts.moduleRoot ?? sourceRoot, + } = pluginOpts; + + if (!moduleIds) return null; + + // moduleId is n/a if a `getModuleId()` is provided + if (moduleId != null && !getModuleId) { + return moduleId; + } + + let moduleName = moduleRoot != null ? moduleRoot + "/" : ""; + + if (filenameRelative) { + const sourceRootReplacer = + sourceRoot != null ? new RegExp("^" + sourceRoot + "/?") : ""; + + moduleName += filenameRelative + // remove sourceRoot from filename + .replace(sourceRootReplacer, "") + // remove extension + .replace(/\.(\w*?)$/, ""); + } + + // normalize path separators + moduleName = moduleName.replace(/\\/g, "/"); + + if (getModuleId) { + // If return is falsy, assume they want us to use our generated default name + return getModuleId(moduleName) || moduleName; + } else { + return moduleName; + } +} diff --git a/packages/babel-helper-module-transforms/src/index.js b/packages/babel-helper-module-transforms/src/index.js index 5735ad951e8d..854a76fcb3f2 100644 --- a/packages/babel-helper-module-transforms/src/index.js +++ b/packages/babel-helper-module-transforms/src/index.js @@ -12,7 +12,9 @@ import normalizeAndLoadModuleMetadata, { isSideEffectImport, } from "./normalize-and-load-metadata"; -export { hasExports, isSideEffectImport, isModule }; +export { default as getModuleName } from "./get-module-name"; + +export { hasExports, isSideEffectImport, isModule, rewriteThis }; /** * Perform all of the generic ES6 module rewriting needed to handle initial diff --git a/packages/babel-helper-module-transforms/src/rewrite-live-references.js b/packages/babel-helper-module-transforms/src/rewrite-live-references.js index 185ba9142220..b98953f70662 100644 --- a/packages/babel-helper-module-transforms/src/rewrite-live-references.js +++ b/packages/babel-helper-module-transforms/src/rewrite-live-references.js @@ -80,10 +80,7 @@ export default function rewriteLiveReferences( * A visitor to inject export update statements during binding initialization. */ const rewriteBindingInitVisitor = { - ClassProperty(path) { - path.skip(); - }, - Function(path) { + Scope(path) { path.skip(); }, ClassDeclaration(path) { @@ -185,7 +182,9 @@ const rewriteReferencesVisitor = { ref.loc = path.node.loc; if ( - path.parentPath.isCallExpression({ callee: path.node }) && + (path.parentPath.isCallExpression({ callee: path.node }) || + path.parentPath.isOptionalCallExpression({ callee: path.node }) || + path.parentPath.isTaggedTemplateExpression({ tag: path.node })) && t.isMemberExpression(ref) ) { path.replaceWith(t.sequenceExpression([t.numericLiteral(0), ref])); @@ -224,6 +223,10 @@ const rewriteReferencesVisitor = { seen.add(path.node); const left = path.get("left"); + + // No change needed + if (left.isMemberExpression()) return; + if (left.isIdentifier()) { // Simple update-assign foo += 1; export { foo }; // => exports.foo = (foo += 1); @@ -234,9 +237,9 @@ const rewriteReferencesVisitor = { return; } - const exportedNames = exported.get(localName) || []; + const exportedNames = exported.get(localName); const importData = imported.get(localName); - if (exportedNames.length > 0 || importData) { + if (exportedNames?.length > 0 || importData) { assert(path.node.operator === "=", "Path was not simplified"); const assignment = path.node; @@ -259,13 +262,14 @@ const rewriteReferencesVisitor = { ); requeueInParent(path); } - } else if (left.isMemberExpression()) { - // No change needed } else { const ids = left.getOuterBindingIdentifiers(); - const id = Object.keys(ids) - .filter(localName => imported.has(localName)) - .pop(); + const programScopeIds = Object.keys(ids).filter( + localName => + scope.getBinding(localName) === path.scope.getBinding(localName), + ); + const id = programScopeIds.find(localName => imported.has(localName)); + if (id) { path.node.right = t.sequenceExpression([ path.node.right, @@ -276,14 +280,7 @@ const rewriteReferencesVisitor = { // Complex ({a, b, c} = {}); export { a, c }; // => ({a, b, c} = {}), (exports.a = a, exports.c = c); const items = []; - Object.keys(ids).forEach(localName => { - // redeclared in this scope - if ( - scope.getBinding(localName) !== path.scope.getBinding(localName) - ) { - return; - } - + programScopeIds.forEach(localName => { const exportedNames = exported.get(localName) || []; if (exportedNames.length > 0) { items.push( @@ -309,4 +306,40 @@ const rewriteReferencesVisitor = { } }, }, + "ForOfStatement|ForInStatement"(path) { + const { scope, node } = path; + const { left } = node; + const { exported, scope: programScope } = this; + + if (!t.isVariableDeclaration(left)) { + let didTransform = false; + const bodyPath = path.get("body"); + const loopBodyScope = bodyPath.scope; + for (const name of Object.keys(t.getOuterBindingIdentifiers(left))) { + if ( + exported.get(name) && + programScope.getBinding(name) === scope.getBinding(name) + ) { + didTransform = true; + if (loopBodyScope.hasOwnBinding(name)) { + loopBodyScope.rename(name); + } + } + } + if (!didTransform) { + return; + } + const newLoopId = scope.generateUidIdentifierBasedOnNode(left); + bodyPath.unshiftContainer( + "body", + t.expressionStatement(t.assignmentExpression("=", left, newLoopId)), + ); + path + .get("left") + .replaceWith( + t.variableDeclaration("let", [t.variableDeclarator(newLoopId)]), + ); + scope.registerDeclaration(path.get("left")); + } + }, }; diff --git a/packages/babel-helper-module-transforms/src/rewrite-this.js b/packages/babel-helper-module-transforms/src/rewrite-this.js index 1c572c2d40e9..cf03366b0ae6 100644 --- a/packages/babel-helper-module-transforms/src/rewrite-this.js +++ b/packages/babel-helper-module-transforms/src/rewrite-this.js @@ -1,3 +1,4 @@ +import { skipAllButComputedKey } from "@babel/helper-replace-supers"; export default function rewriteThis(programPath: NodePath) { // Rewrite "this" to be "undefined". programPath.traverse(rewriteThisVisitor); @@ -12,10 +13,11 @@ const rewriteThisVisitor = { path.replaceWith(path.scope.buildUndefinedNode()); }, Function(path) { - if (!path.isArrowFunctionExpression()) path.skip(); + if (path.isMethod()) skipAllButComputedKey(path); + else if (!path.isArrowFunctionExpression()) path.skip(); }, ClassProperty(path) { - path.skip(); + skipAllButComputedKey(path); }, ClassPrivateProperty(path) { path.skip(); diff --git a/packages/babel-helper-optimise-call-expression/package.json b/packages/babel-helper-optimise-call-expression/package.json index f048cd350075..fbb338e5d292 100644 --- a/packages/babel-helper-optimise-call-expression/package.json +++ b/packages/babel-helper-optimise-call-expression/package.json @@ -1,6 +1,6 @@ { "name": "@babel/helper-optimise-call-expression", - "version": "7.0.0", + "version": "7.8.3", "description": "Helper function to optimise call expression", "repository": "https://github.com/babel/babel/tree/master/packages/babel-helper-optimise-call-expression", "license": "MIT", @@ -9,6 +9,6 @@ }, "main": "lib/index.js", "dependencies": { - "@babel/types": "^7.0.0" + "@babel/types": "^7.8.3" } } diff --git a/packages/babel-helper-plugin-test-runner/package.json b/packages/babel-helper-plugin-test-runner/package.json index 0a1dfe671fad..774c8ca066e5 100644 --- a/packages/babel-helper-plugin-test-runner/package.json +++ b/packages/babel-helper-plugin-test-runner/package.json @@ -1,6 +1,6 @@ { "name": "@babel/helper-plugin-test-runner", - "version": "7.1.0", + "version": "7.8.3", "description": "Helper function to support test runner", "repository": "https://github.com/babel/babel/tree/master/packages/babel-helper-plugin-test-runner", "license": "MIT", @@ -9,6 +9,6 @@ }, "main": "lib/index.js", "dependencies": { - "@babel/helper-transform-fixture-test-runner": "^7.1.0" + "@babel/helper-transform-fixture-test-runner": "^7.8.3" } } diff --git a/packages/babel-helper-plugin-utils/package.json b/packages/babel-helper-plugin-utils/package.json index b35e4dbd1139..7b6f4162040f 100644 --- a/packages/babel-helper-plugin-utils/package.json +++ b/packages/babel-helper-plugin-utils/package.json @@ -1,6 +1,6 @@ { "name": "@babel/helper-plugin-utils", - "version": "7.0.0", + "version": "7.8.3", "description": "General utilities for plugins to use", "author": "Logan Smyth ", "homepage": "https://babeljs.io/", diff --git a/packages/babel-helper-regex/package.json b/packages/babel-helper-regex/package.json index 0fdf8c0aee80..546451b71229 100644 --- a/packages/babel-helper-regex/package.json +++ b/packages/babel-helper-regex/package.json @@ -1,6 +1,6 @@ { "name": "@babel/helper-regex", - "version": "7.5.5", + "version": "7.8.3", "description": "Helper function to check for literal RegEx", "repository": "https://github.com/babel/babel/tree/master/packages/babel-helper-regex", "license": "MIT", diff --git a/packages/babel-helper-remap-async-to-generator/package.json b/packages/babel-helper-remap-async-to-generator/package.json index fb44a863a9c1..b8634e4c55aa 100644 --- a/packages/babel-helper-remap-async-to-generator/package.json +++ b/packages/babel-helper-remap-async-to-generator/package.json @@ -1,6 +1,6 @@ { "name": "@babel/helper-remap-async-to-generator", - "version": "7.1.0", + "version": "7.8.3", "description": "Helper function to remap async functions to generators", "repository": "https://github.com/babel/babel/tree/master/packages/babel-helper-remap-async-to-generator", "license": "MIT", @@ -9,10 +9,10 @@ }, "main": "lib/index.js", "dependencies": { - "@babel/helper-annotate-as-pure": "^7.0.0", - "@babel/helper-wrap-function": "^7.1.0", - "@babel/template": "^7.1.0", - "@babel/traverse": "^7.1.0", - "@babel/types": "^7.0.0" + "@babel/helper-annotate-as-pure": "^7.8.3", + "@babel/helper-wrap-function": "^7.8.3", + "@babel/template": "^7.8.3", + "@babel/traverse": "^7.8.3", + "@babel/types": "^7.8.3" } } diff --git a/packages/babel-helper-replace-supers/package.json b/packages/babel-helper-replace-supers/package.json index a6c6dbc76c2b..f57abf5b2f18 100644 --- a/packages/babel-helper-replace-supers/package.json +++ b/packages/babel-helper-replace-supers/package.json @@ -1,6 +1,6 @@ { "name": "@babel/helper-replace-supers", - "version": "7.5.5", + "version": "7.8.6", "description": "Helper function to replace supers", "repository": "https://github.com/babel/babel/tree/master/packages/babel-helper-replace-supers", "license": "MIT", @@ -9,9 +9,9 @@ }, "main": "lib/index.js", "dependencies": { - "@babel/helper-member-expression-to-functions": "^7.5.5", - "@babel/helper-optimise-call-expression": "^7.0.0", - "@babel/traverse": "^7.5.5", - "@babel/types": "^7.5.5" + "@babel/helper-member-expression-to-functions": "^7.8.3", + "@babel/helper-optimise-call-expression": "^7.8.3", + "@babel/traverse": "^7.8.6", + "@babel/types": "^7.8.6" } } diff --git a/packages/babel-helper-replace-supers/src/index.js b/packages/babel-helper-replace-supers/src/index.js index 3412d321caf2..804d4251805b 100644 --- a/packages/babel-helper-replace-supers/src/index.js +++ b/packages/babel-helper-replace-supers/src/index.js @@ -1,4 +1,5 @@ -import type { NodePath } from "@babel/traverse"; +// @flow +import type { HubInterface, NodePath } from "@babel/traverse"; import traverse from "@babel/traverse"; import memberExpressionToFunctions from "@babel/helper-member-expression-to-functions"; import optimiseCall from "@babel/helper-optimise-call-expression"; @@ -25,7 +26,7 @@ function getPrototypeOfExpression(objectRef, isStatic, file, isPrivateMethod) { return t.callExpression(file.addHelper("getPrototypeOf"), [targetRef]); } -function skipAllButComputedKey(path) { +export function skipAllButComputedKey(path: NodePath) { // If the path isn't computed, just skip everything. if (!path.node.computed) { path.skip(); @@ -40,11 +41,13 @@ function skipAllButComputedKey(path) { } } +// environmentVisitor should be used when traversing the whole class and not for specific class elements/methods. export const environmentVisitor = { - TypeAnnotation(path) { + TypeAnnotation(path: NodePath) { path.skip(); }, - Function(path) { + + Function(path: NodePath) { // Methods will be handled by the Method visit if (path.isMethod()) return; // Arrow functions inherit their parent's environment @@ -52,7 +55,7 @@ export const environmentVisitor = { path.skip(); }, - "Method|ClassProperty|ClassPrivateProperty"(path) { + "Method|ClassProperty|ClassPrivateProperty"(path: NodePath) { skipAllButComputedKey(path); }, }; @@ -98,29 +101,47 @@ const specHandlers = { }, get(superMember) { + return this._get(superMember, this._getThisRefs()); + }, + + _get(superMember, thisRefs) { + const proto = getPrototypeOfExpression( + this.getObjectRef(), + this.isStatic, + this.file, + this.isPrivateMethod, + ); return t.callExpression(this.file.addHelper("get"), [ - getPrototypeOfExpression( - this.getObjectRef(), - this.isStatic, - this.file, - this.isPrivateMethod, - ), + thisRefs.memo ? t.sequenceExpression([thisRefs.memo, proto]) : proto, this.prop(superMember), - t.thisExpression(), + thisRefs.this, ]); }, + _getThisRefs() { + if (!this.isDerivedConstructor) { + return { this: t.thisExpression() }; + } + const thisRef = this.scope.generateDeclaredUidIdentifier("thisSuper"); + return { + memo: t.assignmentExpression("=", thisRef, t.thisExpression()), + this: t.cloneNode(thisRef), + }; + }, + set(superMember, value) { + const thisRefs = this._getThisRefs(); + const proto = getPrototypeOfExpression( + this.getObjectRef(), + this.isStatic, + this.file, + this.isPrivateMethod, + ); return t.callExpression(this.file.addHelper("set"), [ - getPrototypeOfExpression( - this.getObjectRef(), - this.isStatic, - this.file, - this.isPrivateMethod, - ), + thisRefs.memo ? t.sequenceExpression([thisRefs.memo, proto]) : proto, this.prop(superMember), value, - t.thisExpression(), + thisRefs.this, t.booleanLiteral(superMember.isInStrictMode()), ]); }, @@ -132,7 +153,12 @@ const specHandlers = { }, call(superMember, args) { - return optimiseCall(this.get(superMember), t.thisExpression(), args); + const thisRefs = this._getThisRefs(); + return optimiseCall( + this._get(superMember, thisRefs), + t.cloneNode(thisRefs.this), + args, + ); }, }; @@ -187,13 +213,36 @@ const looseHandlers = { return t.memberExpression(t.thisExpression(), prop, computed); }, + + call(superMember, args) { + return optimiseCall(this.get(superMember), t.thisExpression(), args); + }, }; +type ReplaceSupersOptionsBase = {| + methodPath: NodePath, + superRef: Object, + isLoose: boolean, + file: any, +|}; + +type ReplaceSupersOptions = + | {| + ...ReplaceSupersOptionsBase, + getObjectRef: () => BabelNode, + |} + | {| + ...ReplaceSupersOptionsBase, + objectRef: BabelNode, + |}; + export default class ReplaceSupers { - constructor(opts: Object) { + constructor(opts: ReplaceSupersOptions) { const path = opts.methodPath; this.methodPath = path; + this.isDerivedConstructor = + path.isClassMethod({ kind: "constructor" }) && !!opts.superRef; this.isStatic = path.isObjectMethod() || path.node.static; this.isPrivateMethod = path.isPrivate() && path.isMethod(); @@ -203,18 +252,14 @@ export default class ReplaceSupers { this.opts = opts; } + file: HubInterface; + isDerivedConstructor: boolean; + isLoose: boolean; + isPrivateMethod: boolean; + isStatic: boolean; methodPath: NodePath; + opts: ReplaceSupersOptions; superRef: Object; - isStatic: boolean; - isLoose: boolean; - file; - opts: { - getObjetRef: Function, - methodPath: NodePath, - superRef: Object, - isLoose: boolean, - file: any, - }; getObjectRef() { return t.cloneNode(this.opts.objectRef || this.opts.getObjectRef()); @@ -225,6 +270,8 @@ export default class ReplaceSupers { memberExpressionToFunctions(this.methodPath, visitor, { file: this.file, + scope: this.methodPath.scope, + isDerivedConstructor: this.isDerivedConstructor, isStatic: this.isStatic, isPrivateMethod: this.isPrivateMethod, getObjectRef: this.getObjectRef.bind(this), diff --git a/packages/babel-helper-simple-access/package.json b/packages/babel-helper-simple-access/package.json index 51a8abba2b7a..395d72009157 100644 --- a/packages/babel-helper-simple-access/package.json +++ b/packages/babel-helper-simple-access/package.json @@ -1,6 +1,6 @@ { "name": "@babel/helper-simple-access", - "version": "7.1.0", + "version": "7.8.3", "description": "Babel helper for ensuring that access to a given value is performed through simple accesses", "author": "Logan Smyth ", "homepage": "https://babeljs.io/", @@ -11,7 +11,7 @@ "repository": "https://github.com/babel/babel/tree/master/packages/babel-helper-simple-access", "main": "lib/index.js", "dependencies": { - "@babel/template": "^7.1.0", - "@babel/types": "^7.0.0" + "@babel/template": "^7.8.3", + "@babel/types": "^7.8.3" } } diff --git a/packages/babel-helper-split-export-declaration/package.json b/packages/babel-helper-split-export-declaration/package.json index f8510565f9e9..499d3ecc9330 100644 --- a/packages/babel-helper-split-export-declaration/package.json +++ b/packages/babel-helper-split-export-declaration/package.json @@ -1,6 +1,6 @@ { "name": "@babel/helper-split-export-declaration", - "version": "7.4.4", + "version": "7.8.3", "description": "", "repository": "https://github.com/babel/babel/tree/master/packages/babel-helper-split-export-declaration", "license": "MIT", @@ -9,6 +9,6 @@ }, "main": "lib/index.js", "dependencies": { - "@babel/types": "^7.4.4" + "@babel/types": "^7.8.3" } } diff --git a/packages/babel-helper-transform-fixture-test-runner/package.json b/packages/babel-helper-transform-fixture-test-runner/package.json index f1e766baff50..3138c4c0dfbb 100644 --- a/packages/babel-helper-transform-fixture-test-runner/package.json +++ b/packages/babel-helper-transform-fixture-test-runner/package.json @@ -1,6 +1,6 @@ { "name": "@babel/helper-transform-fixture-test-runner", - "version": "7.5.5", + "version": "7.9.2", "description": "Transform test runner for @babel/helper-fixtures module", "author": "Sebastian McKenzie ", "homepage": "https://babeljs.io/", @@ -11,10 +11,10 @@ "repository": "https://github.com/babel/babel/tree/master/packages/babel-helper-transform-fixture-test-runner", "main": "lib/index.js", "dependencies": { - "@babel/code-frame": "^7.5.5", - "@babel/core": "^7.5.5", - "@babel/helper-fixtures": "^7.5.5", - "@babel/polyfill": "^7.4.4", + "@babel/code-frame": "^7.8.3", + "@babel/core": "^7.8.3", + "@babel/helper-fixtures": "^7.8.3", + "@babel/polyfill": "^7.8.3", "babel-check-duplicated-nodes": "^1.0.0", "jest": "^24.8.0", "jest-diff": "^24.8.0", diff --git a/packages/babel-helper-transform-fixture-test-runner/src/index.js b/packages/babel-helper-transform-fixture-test-runner/src/index.js index a83e8ff1c61b..416d03c544e0 100644 --- a/packages/babel-helper-transform-fixture-test-runner/src/index.js +++ b/packages/babel-helper-transform-fixture-test-runner/src/index.js @@ -62,11 +62,12 @@ function runModuleInTestContext(id: string, relativeFilename: string) { const req = id => runModuleInTestContext(id, filename); const src = fs.readFileSync(filename, "utf8"); - const code = `(function (exports, require, module, __filename, __dirname) {${src}\n});`; + const code = `(function (exports, require, module, __filename, __dirname) {\n${src}\n});`; vm.runInContext(code, testContext, { filename, displayErrors: true, + lineOffset: -1, }).call(module.exports, module.exports, req, module, filename, dirname); return module.exports; @@ -94,10 +95,11 @@ export function runCodeInTestContext(code: string, opts: { filename: string }) { // Expose the test options as "opts", but otherwise run the test in a CommonJS-like environment. // Note: This isn't doing .call(module.exports, ...) because some of our tests currently // rely on 'this === global'. - const src = `(function(exports, require, module, __filename, __dirname, opts) {${code}\n});`; + const src = `(function(exports, require, module, __filename, __dirname, opts) {\n${code}\n});`; return vm.runInContext(src, testContext, { filename, displayErrors: true, + lineOffset: -1, })(module.exports, req, module, filename, dirname, opts); } finally { process.chdir(oldCwd); @@ -131,11 +133,17 @@ function wrapPackagesArray(type, names, optionsDir) { } function run(task) { - const actual = task.actual; - const expected = task.expect; - const exec = task.exec; - const opts = task.options; - const optionsDir = task.optionsDir; + const { + actual, + expect: expected, + exec, + options: opts, + optionsDir, + validateLogs, + ignoreOutput, + stdout, + stderr, + } = task; function getOpts(self) { const newOpts = merge( @@ -191,55 +199,66 @@ function run(task) { } } - let actualCode = actual.code; - const expectCode = expected.code; - if (!execCode || actualCode) { - result = babel.transform(actualCode, getOpts(actual)); - const expectedCode = result.code.replace( - escapeRegExp(path.resolve(__dirname, "../../../")), - "", - ); + const inputCode = actual.code; + const expectedCode = expected.code; + if (!execCode || inputCode) { + const actualLogs = { stdout: "", stderr: "" }; + let restoreSpies = null; + if (validateLogs) { + const spy1 = jest.spyOn(console, "log").mockImplementation(msg => { + actualLogs.stdout += `${msg}\n`; + }); + const spy2 = jest.spyOn(console, "warn").mockImplementation(msg => { + actualLogs.stderr += `${msg}\n`; + }); + restoreSpies = () => { + spy1.mockRestore(); + spy2.mockRestore(); + }; + } + + result = babel.transform(inputCode, getOpts(actual)); + + if (restoreSpies) restoreSpies(); + + const outputCode = normalizeOutput(result.code); checkDuplicatedNodes(babel, result.ast); - if ( - !expected.code && - expectedCode && - !opts.throws && - fs.statSync(path.dirname(expected.loc)).isDirectory() && - !process.env.CI - ) { - const expectedFile = expected.loc.replace( - /\.m?js$/, - result.sourceType === "module" ? ".mjs" : ".js", - ); + if (!ignoreOutput) { + if ( + !expected.code && + outputCode && + !opts.throws && + fs.statSync(path.dirname(expected.loc)).isDirectory() && + !process.env.CI + ) { + const expectedFile = expected.loc.replace( + /\.m?js$/, + result.sourceType === "module" ? ".mjs" : ".js", + ); - console.log(`New test file created: ${expectedFile}`); - fs.writeFileSync(expectedFile, `${expectedCode}\n`); + console.log(`New test file created: ${expectedFile}`); + fs.writeFileSync(expectedFile, `${outputCode}\n`); - if (expected.loc !== expectedFile) { - try { - fs.unlinkSync(expected.loc); - } catch (e) {} - } - } else { - actualCode = expectedCode.trim(); - try { - expect(actualCode).toEqualFile({ - filename: expected.loc, - code: expectCode, - }); - } catch (e) { - if (!process.env.OVERWRITE) throw e; + if (expected.loc !== expectedFile) { + try { + fs.unlinkSync(expected.loc); + } catch (e) {} + } + } else { + validateFile(outputCode, expected.loc, expectedCode); - console.log(`Updated test file: ${expected.loc}`); - fs.writeFileSync(expected.loc, `${expectedCode}\n`); + if (inputCode) { + expect(expected.loc).toMatch( + result.sourceType === "module" ? /\.mjs$/ : /\.js$/, + ); + } } + } - if (actualCode) { - expect(expected.loc).toMatch( - result.sourceType === "module" ? /\.mjs$/ : /\.js$/, - ); - } + if (validateLogs) { + validateFile(normalizeOutput(actualLogs.stdout), stdout.loc, stdout.code); + validateFile(normalizeOutput(actualLogs.stderr), stderr.loc, stderr.code); } } @@ -263,6 +282,44 @@ function run(task) { } } +function validateFile(actualCode, expectedLoc, expectedCode) { + try { + expect(actualCode).toEqualFile({ + filename: expectedLoc, + code: expectedCode, + }); + } catch (e) { + if (!process.env.OVERWRITE) throw e; + + console.log(`Updated test file: ${expectedLoc}`); + fs.writeFileSync(expectedLoc, `${actualCode}\n`); + } +} + +function normalizeOutput(code) { + const projectRoot = path.resolve(__dirname, "../../../"); + const cwdSymbol = ""; + let result = code + .trim() + // (non-win32) /foo/babel/packages -> /packages + // (win32) C:\foo\babel\packages -> \packages + .replace(new RegExp(escapeRegExp(projectRoot), "g"), cwdSymbol); + if (process.platform === "win32") { + result = result + // C:/foo/babel/packages -> /packages + .replace( + new RegExp(escapeRegExp(projectRoot.replace(/\\/g, "/")), "g"), + cwdSymbol, + ) + // C:\\foo\\babel\\packages -> \\packages (in js string literal) + .replace( + new RegExp(escapeRegExp(projectRoot.replace(/\\/g, "\\\\")), "g"), + cwdSymbol, + ); + } + return result; +} + const toEqualFile = () => ({ compare: (actual, { filename, code }) => { const pass = actual === code; diff --git a/packages/babel-helper-transform-fixture-test-runner/test/index.js b/packages/babel-helper-transform-fixture-test-runner/test/index.js index 2ec3d6bb2cce..1d02bf80290f 100644 --- a/packages/babel-helper-transform-fixture-test-runner/test/index.js +++ b/packages/babel-helper-transform-fixture-test-runner/test/index.js @@ -35,4 +35,17 @@ describe("helper-transform-fixture-test-runner", function() { ); } }); + it("should print correct trace position when error is thrown in the first line", () => { + const opts = { + filename: `${__filename}.fake4`, + }; + runCodeInTestContext( + `try { throw new Error() } catch (e) { + opts.stack = e.stack + } + `, + opts, + ); + expect(opts.stack).toContain(opts.filename + ":1:13"); + }); }); diff --git a/packages/babel-plugin-syntax-export-namespace-from/.npmignore b/packages/babel-helper-validator-identifier/.npmignore similarity index 100% rename from packages/babel-plugin-syntax-export-namespace-from/.npmignore rename to packages/babel-helper-validator-identifier/.npmignore diff --git a/packages/babel-helper-validator-identifier/README.md b/packages/babel-helper-validator-identifier/README.md new file mode 100644 index 000000000000..ab2dad173149 --- /dev/null +++ b/packages/babel-helper-validator-identifier/README.md @@ -0,0 +1,19 @@ +# @babel/helper-validator-identifier + +> Validate identifier/keywords name + +See our website [@babel/helper-validator-identifier](https://babeljs.io/docs/en/next/babel-helper-validator-identifier.html) for more information. + +## Install + +Using npm: + +```sh +npm install --save-dev @babel/helper-validator-identifier +``` + +or using yarn: + +```sh +yarn add @babel/helper-validator-identifier --dev +``` diff --git a/packages/babel-helper-validator-identifier/package.json b/packages/babel-helper-validator-identifier/package.json new file mode 100644 index 000000000000..a35c17d30631 --- /dev/null +++ b/packages/babel-helper-validator-identifier/package.json @@ -0,0 +1,16 @@ +{ + "name": "@babel/helper-validator-identifier", + "version": "7.9.5", + "description": "Validate identifier/keywords name", + "repository": "https://github.com/babel/babel/tree/master/packages/babel-helper-validator-identifier", + "license": "MIT", + "publishConfig": { + "access": "public" + }, + "main": "./lib/index.js", + "exports": "./lib/index.js", + "devDependencies": { + "charcodes": "^0.2.0", + "unicode-13.0.0": "^0.8.0" + } +} diff --git a/packages/babel-parser/scripts/generate-identifier-regex.js b/packages/babel-helper-validator-identifier/scripts/generate-identifier-regex.js similarity index 98% rename from packages/babel-parser/scripts/generate-identifier-regex.js rename to packages/babel-helper-validator-identifier/scripts/generate-identifier-regex.js index 21e249ad4f28..e0f5b1656b97 100644 --- a/packages/babel-parser/scripts/generate-identifier-regex.js +++ b/packages/babel-helper-validator-identifier/scripts/generate-identifier-regex.js @@ -2,7 +2,7 @@ // Always use the latest available version of Unicode! // https://tc39.github.io/ecma262/#sec-conformance -const version = "12.0.0"; +const version = "13.0.0"; const start = require("unicode-" + version + diff --git a/packages/babel-helper-validator-identifier/src/identifier.js b/packages/babel-helper-validator-identifier/src/identifier.js new file mode 100644 index 000000000000..5088281bbf8e --- /dev/null +++ b/packages/babel-helper-validator-identifier/src/identifier.js @@ -0,0 +1,102 @@ +// @flow + +import * as charCodes from "charcodes"; + +// ## Character categories + +// Big ugly regular expressions that match characters in the +// whitespace, identifier, and identifier-start categories. These +// are only applied when a character is found to actually have a +// code point between 0x80 and 0xffff. +// Generated by `scripts/generate-identifier-regex.js`. + +/* prettier-ignore */ +let nonASCIIidentifierStartChars = "\xaa\xb5\xba\xc0-\xd6\xd8-\xf6\xf8-\u02c1\u02c6-\u02d1\u02e0-\u02e4\u02ec\u02ee\u0370-\u0374\u0376\u0377\u037a-\u037d\u037f\u0386\u0388-\u038a\u038c\u038e-\u03a1\u03a3-\u03f5\u03f7-\u0481\u048a-\u052f\u0531-\u0556\u0559\u0560-\u0588\u05d0-\u05ea\u05ef-\u05f2\u0620-\u064a\u066e\u066f\u0671-\u06d3\u06d5\u06e5\u06e6\u06ee\u06ef\u06fa-\u06fc\u06ff\u0710\u0712-\u072f\u074d-\u07a5\u07b1\u07ca-\u07ea\u07f4\u07f5\u07fa\u0800-\u0815\u081a\u0824\u0828\u0840-\u0858\u0860-\u086a\u08a0-\u08b4\u08b6-\u08c7\u0904-\u0939\u093d\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098c\u098f\u0990\u0993-\u09a8\u09aa-\u09b0\u09b2\u09b6-\u09b9\u09bd\u09ce\u09dc\u09dd\u09df-\u09e1\u09f0\u09f1\u09fc\u0a05-\u0a0a\u0a0f\u0a10\u0a13-\u0a28\u0a2a-\u0a30\u0a32\u0a33\u0a35\u0a36\u0a38\u0a39\u0a59-\u0a5c\u0a5e\u0a72-\u0a74\u0a85-\u0a8d\u0a8f-\u0a91\u0a93-\u0aa8\u0aaa-\u0ab0\u0ab2\u0ab3\u0ab5-\u0ab9\u0abd\u0ad0\u0ae0\u0ae1\u0af9\u0b05-\u0b0c\u0b0f\u0b10\u0b13-\u0b28\u0b2a-\u0b30\u0b32\u0b33\u0b35-\u0b39\u0b3d\u0b5c\u0b5d\u0b5f-\u0b61\u0b71\u0b83\u0b85-\u0b8a\u0b8e-\u0b90\u0b92-\u0b95\u0b99\u0b9a\u0b9c\u0b9e\u0b9f\u0ba3\u0ba4\u0ba8-\u0baa\u0bae-\u0bb9\u0bd0\u0c05-\u0c0c\u0c0e-\u0c10\u0c12-\u0c28\u0c2a-\u0c39\u0c3d\u0c58-\u0c5a\u0c60\u0c61\u0c80\u0c85-\u0c8c\u0c8e-\u0c90\u0c92-\u0ca8\u0caa-\u0cb3\u0cb5-\u0cb9\u0cbd\u0cde\u0ce0\u0ce1\u0cf1\u0cf2\u0d04-\u0d0c\u0d0e-\u0d10\u0d12-\u0d3a\u0d3d\u0d4e\u0d54-\u0d56\u0d5f-\u0d61\u0d7a-\u0d7f\u0d85-\u0d96\u0d9a-\u0db1\u0db3-\u0dbb\u0dbd\u0dc0-\u0dc6\u0e01-\u0e30\u0e32\u0e33\u0e40-\u0e46\u0e81\u0e82\u0e84\u0e86-\u0e8a\u0e8c-\u0ea3\u0ea5\u0ea7-\u0eb0\u0eb2\u0eb3\u0ebd\u0ec0-\u0ec4\u0ec6\u0edc-\u0edf\u0f00\u0f40-\u0f47\u0f49-\u0f6c\u0f88-\u0f8c\u1000-\u102a\u103f\u1050-\u1055\u105a-\u105d\u1061\u1065\u1066\u106e-\u1070\u1075-\u1081\u108e\u10a0-\u10c5\u10c7\u10cd\u10d0-\u10fa\u10fc-\u1248\u124a-\u124d\u1250-\u1256\u1258\u125a-\u125d\u1260-\u1288\u128a-\u128d\u1290-\u12b0\u12b2-\u12b5\u12b8-\u12be\u12c0\u12c2-\u12c5\u12c8-\u12d6\u12d8-\u1310\u1312-\u1315\u1318-\u135a\u1380-\u138f\u13a0-\u13f5\u13f8-\u13fd\u1401-\u166c\u166f-\u167f\u1681-\u169a\u16a0-\u16ea\u16ee-\u16f8\u1700-\u170c\u170e-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176c\u176e-\u1770\u1780-\u17b3\u17d7\u17dc\u1820-\u1878\u1880-\u18a8\u18aa\u18b0-\u18f5\u1900-\u191e\u1950-\u196d\u1970-\u1974\u1980-\u19ab\u19b0-\u19c9\u1a00-\u1a16\u1a20-\u1a54\u1aa7\u1b05-\u1b33\u1b45-\u1b4b\u1b83-\u1ba0\u1bae\u1baf\u1bba-\u1be5\u1c00-\u1c23\u1c4d-\u1c4f\u1c5a-\u1c7d\u1c80-\u1c88\u1c90-\u1cba\u1cbd-\u1cbf\u1ce9-\u1cec\u1cee-\u1cf3\u1cf5\u1cf6\u1cfa\u1d00-\u1dbf\u1e00-\u1f15\u1f18-\u1f1d\u1f20-\u1f45\u1f48-\u1f4d\u1f50-\u1f57\u1f59\u1f5b\u1f5d\u1f5f-\u1f7d\u1f80-\u1fb4\u1fb6-\u1fbc\u1fbe\u1fc2-\u1fc4\u1fc6-\u1fcc\u1fd0-\u1fd3\u1fd6-\u1fdb\u1fe0-\u1fec\u1ff2-\u1ff4\u1ff6-\u1ffc\u2071\u207f\u2090-\u209c\u2102\u2107\u210a-\u2113\u2115\u2118-\u211d\u2124\u2126\u2128\u212a-\u2139\u213c-\u213f\u2145-\u2149\u214e\u2160-\u2188\u2c00-\u2c2e\u2c30-\u2c5e\u2c60-\u2ce4\u2ceb-\u2cee\u2cf2\u2cf3\u2d00-\u2d25\u2d27\u2d2d\u2d30-\u2d67\u2d6f\u2d80-\u2d96\u2da0-\u2da6\u2da8-\u2dae\u2db0-\u2db6\u2db8-\u2dbe\u2dc0-\u2dc6\u2dc8-\u2dce\u2dd0-\u2dd6\u2dd8-\u2dde\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303c\u3041-\u3096\u309b-\u309f\u30a1-\u30fa\u30fc-\u30ff\u3105-\u312f\u3131-\u318e\u31a0-\u31bf\u31f0-\u31ff\u3400-\u4dbf\u4e00-\u9ffc\ua000-\ua48c\ua4d0-\ua4fd\ua500-\ua60c\ua610-\ua61f\ua62a\ua62b\ua640-\ua66e\ua67f-\ua69d\ua6a0-\ua6ef\ua717-\ua71f\ua722-\ua788\ua78b-\ua7bf\ua7c2-\ua7ca\ua7f5-\ua801\ua803-\ua805\ua807-\ua80a\ua80c-\ua822\ua840-\ua873\ua882-\ua8b3\ua8f2-\ua8f7\ua8fb\ua8fd\ua8fe\ua90a-\ua925\ua930-\ua946\ua960-\ua97c\ua984-\ua9b2\ua9cf\ua9e0-\ua9e4\ua9e6-\ua9ef\ua9fa-\ua9fe\uaa00-\uaa28\uaa40-\uaa42\uaa44-\uaa4b\uaa60-\uaa76\uaa7a\uaa7e-\uaaaf\uaab1\uaab5\uaab6\uaab9-\uaabd\uaac0\uaac2\uaadb-\uaadd\uaae0-\uaaea\uaaf2-\uaaf4\uab01-\uab06\uab09-\uab0e\uab11-\uab16\uab20-\uab26\uab28-\uab2e\uab30-\uab5a\uab5c-\uab69\uab70-\uabe2\uac00-\ud7a3\ud7b0-\ud7c6\ud7cb-\ud7fb\uf900-\ufa6d\ufa70-\ufad9\ufb00-\ufb06\ufb13-\ufb17\ufb1d\ufb1f-\ufb28\ufb2a-\ufb36\ufb38-\ufb3c\ufb3e\ufb40\ufb41\ufb43\ufb44\ufb46-\ufbb1\ufbd3-\ufd3d\ufd50-\ufd8f\ufd92-\ufdc7\ufdf0-\ufdfb\ufe70-\ufe74\ufe76-\ufefc\uff21-\uff3a\uff41-\uff5a\uff66-\uffbe\uffc2-\uffc7\uffca-\uffcf\uffd2-\uffd7\uffda-\uffdc"; +/* prettier-ignore */ +let nonASCIIidentifierChars = "\u200c\u200d\xb7\u0300-\u036f\u0387\u0483-\u0487\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u0669\u0670\u06d6-\u06dc\u06df-\u06e4\u06e7\u06e8\u06ea-\u06ed\u06f0-\u06f9\u0711\u0730-\u074a\u07a6-\u07b0\u07c0-\u07c9\u07eb-\u07f3\u07fd\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0859-\u085b\u08d3-\u08e1\u08e3-\u0903\u093a-\u093c\u093e-\u094f\u0951-\u0957\u0962\u0963\u0966-\u096f\u0981-\u0983\u09bc\u09be-\u09c4\u09c7\u09c8\u09cb-\u09cd\u09d7\u09e2\u09e3\u09e6-\u09ef\u09fe\u0a01-\u0a03\u0a3c\u0a3e-\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a66-\u0a71\u0a75\u0a81-\u0a83\u0abc\u0abe-\u0ac5\u0ac7-\u0ac9\u0acb-\u0acd\u0ae2\u0ae3\u0ae6-\u0aef\u0afa-\u0aff\u0b01-\u0b03\u0b3c\u0b3e-\u0b44\u0b47\u0b48\u0b4b-\u0b4d\u0b55-\u0b57\u0b62\u0b63\u0b66-\u0b6f\u0b82\u0bbe-\u0bc2\u0bc6-\u0bc8\u0bca-\u0bcd\u0bd7\u0be6-\u0bef\u0c00-\u0c04\u0c3e-\u0c44\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0c66-\u0c6f\u0c81-\u0c83\u0cbc\u0cbe-\u0cc4\u0cc6-\u0cc8\u0cca-\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0ce6-\u0cef\u0d00-\u0d03\u0d3b\u0d3c\u0d3e-\u0d44\u0d46-\u0d48\u0d4a-\u0d4d\u0d57\u0d62\u0d63\u0d66-\u0d6f\u0d81-\u0d83\u0dca\u0dcf-\u0dd4\u0dd6\u0dd8-\u0ddf\u0de6-\u0def\u0df2\u0df3\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0e50-\u0e59\u0eb1\u0eb4-\u0ebc\u0ec8-\u0ecd\u0ed0-\u0ed9\u0f18\u0f19\u0f20-\u0f29\u0f35\u0f37\u0f39\u0f3e\u0f3f\u0f71-\u0f84\u0f86\u0f87\u0f8d-\u0f97\u0f99-\u0fbc\u0fc6\u102b-\u103e\u1040-\u1049\u1056-\u1059\u105e-\u1060\u1062-\u1064\u1067-\u106d\u1071-\u1074\u1082-\u108d\u108f-\u109d\u135d-\u135f\u1369-\u1371\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b4-\u17d3\u17dd\u17e0-\u17e9\u180b-\u180d\u1810-\u1819\u18a9\u1920-\u192b\u1930-\u193b\u1946-\u194f\u19d0-\u19da\u1a17-\u1a1b\u1a55-\u1a5e\u1a60-\u1a7c\u1a7f-\u1a89\u1a90-\u1a99\u1ab0-\u1abd\u1abf\u1ac0\u1b00-\u1b04\u1b34-\u1b44\u1b50-\u1b59\u1b6b-\u1b73\u1b80-\u1b82\u1ba1-\u1bad\u1bb0-\u1bb9\u1be6-\u1bf3\u1c24-\u1c37\u1c40-\u1c49\u1c50-\u1c59\u1cd0-\u1cd2\u1cd4-\u1ce8\u1ced\u1cf4\u1cf7-\u1cf9\u1dc0-\u1df9\u1dfb-\u1dff\u203f\u2040\u2054\u20d0-\u20dc\u20e1\u20e5-\u20f0\u2cef-\u2cf1\u2d7f\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua620-\ua629\ua66f\ua674-\ua67d\ua69e\ua69f\ua6f0\ua6f1\ua802\ua806\ua80b\ua823-\ua827\ua82c\ua880\ua881\ua8b4-\ua8c5\ua8d0-\ua8d9\ua8e0-\ua8f1\ua8ff-\ua909\ua926-\ua92d\ua947-\ua953\ua980-\ua983\ua9b3-\ua9c0\ua9d0-\ua9d9\ua9e5\ua9f0-\ua9f9\uaa29-\uaa36\uaa43\uaa4c\uaa4d\uaa50-\uaa59\uaa7b-\uaa7d\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uaaeb-\uaaef\uaaf5\uaaf6\uabe3-\uabea\uabec\uabed\uabf0-\uabf9\ufb1e\ufe00-\ufe0f\ufe20-\ufe2f\ufe33\ufe34\ufe4d-\ufe4f\uff10-\uff19\uff3f"; + +const nonASCIIidentifierStart = new RegExp( + "[" + nonASCIIidentifierStartChars + "]", +); +const nonASCIIidentifier = new RegExp( + "[" + nonASCIIidentifierStartChars + nonASCIIidentifierChars + "]", +); + +nonASCIIidentifierStartChars = nonASCIIidentifierChars = null; + +// These are a run-length and offset-encoded representation of the +// >0xffff code points that are a valid part of identifiers. The +// offset starts at 0x10000, and each pair of numbers represents an +// offset to the next range, and then a size of the range. They were +// generated by `scripts/generate-identifier-regex.js`. +/* prettier-ignore */ +/* prettier-ignore */ +const astralIdentifierStartCodes = [0,11,2,25,2,18,2,1,2,14,3,13,35,122,70,52,268,28,4,48,48,31,14,29,6,37,11,29,3,35,5,7,2,4,43,157,19,35,5,35,5,39,9,51,157,310,10,21,11,7,153,5,3,0,2,43,2,1,4,0,3,22,11,22,10,30,66,18,2,1,11,21,11,25,71,55,7,1,65,0,16,3,2,2,2,28,43,28,4,28,36,7,2,27,28,53,11,21,11,18,14,17,111,72,56,50,14,50,14,35,349,41,7,1,79,28,11,0,9,21,107,20,28,22,13,52,76,44,33,24,27,35,30,0,3,0,9,34,4,0,13,47,15,3,22,0,2,0,36,17,2,24,85,6,2,0,2,3,2,14,2,9,8,46,39,7,3,1,3,21,2,6,2,1,2,4,4,0,19,0,13,4,159,52,19,3,21,2,31,47,21,1,2,0,185,46,42,3,37,47,21,0,60,42,14,0,72,26,230,43,117,63,32,7,3,0,3,7,2,1,2,23,16,0,2,0,95,7,3,38,17,0,2,0,29,0,11,39,8,0,22,0,12,45,20,0,35,56,264,8,2,36,18,0,50,29,113,6,2,1,2,37,22,0,26,5,2,1,2,31,15,0,328,18,190,0,80,921,103,110,18,195,2749,1070,4050,582,8634,568,8,30,114,29,19,47,17,3,32,20,6,18,689,63,129,74,6,0,67,12,65,1,2,0,29,6135,9,1237,43,8,8952,286,50,2,18,3,9,395,2309,106,6,12,4,8,8,9,5991,84,2,70,2,1,3,0,3,1,3,3,2,11,2,0,2,6,2,64,2,3,3,7,2,6,2,27,2,3,2,4,2,0,4,6,2,339,3,24,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,7,2357,44,11,6,17,0,370,43,1301,196,60,67,8,0,1205,3,2,26,2,1,2,0,3,0,2,9,2,3,2,0,2,0,7,0,5,0,2,0,2,0,2,2,2,1,2,0,3,0,2,0,2,0,2,0,2,0,2,1,2,0,3,3,2,6,2,3,2,3,2,0,2,9,2,16,6,2,2,4,2,16,4421,42717,35,4148,12,221,3,5761,15,7472,3104,541,1507,4938]; +/* prettier-ignore */ +const astralIdentifierCodes = [509,0,227,0,150,4,294,9,1368,2,2,1,6,3,41,2,5,0,166,1,574,3,9,9,370,1,154,10,176,2,54,14,32,9,16,3,46,10,54,9,7,2,37,13,2,9,6,1,45,0,13,2,49,13,9,3,2,11,83,11,7,0,161,11,6,9,7,3,56,1,2,6,3,1,3,2,10,0,11,1,3,6,4,4,193,17,10,9,5,0,82,19,13,9,214,6,3,8,28,1,83,16,16,9,82,12,9,9,84,14,5,9,243,14,166,9,71,5,2,1,3,3,2,0,2,1,13,9,120,6,3,6,4,0,29,9,41,6,2,3,9,0,10,10,47,15,406,7,2,7,17,9,57,21,2,13,123,5,4,0,2,1,2,6,2,0,9,9,49,4,2,1,2,4,9,9,330,3,19306,9,135,4,60,6,26,9,1014,0,2,54,8,3,82,0,12,1,19628,1,5319,4,4,5,9,7,3,6,31,3,149,2,1418,49,513,54,5,49,9,0,15,0,23,4,2,14,1361,6,2,16,3,6,2,1,2,4,262,6,10,9,419,13,1495,6,110,6,6,9,4759,9,787719,239]; + +// This has a complexity linear to the value of the code. The +// assumption is that looking up astral identifier characters is +// rare. +function isInAstralSet(code: number, set: $ReadOnlyArray): boolean { + let pos = 0x10000; + for (let i = 0, length = set.length; i < length; i += 2) { + pos += set[i]; + if (pos > code) return false; + + pos += set[i + 1]; + if (pos >= code) return true; + } + return false; +} + +// Test whether a given character code starts an identifier. + +export function isIdentifierStart(code: number): boolean { + if (code < charCodes.uppercaseA) return code === charCodes.dollarSign; + if (code <= charCodes.uppercaseZ) return true; + if (code < charCodes.lowercaseA) return code === charCodes.underscore; + if (code <= charCodes.lowercaseZ) return true; + if (code <= 0xffff) { + return ( + code >= 0xaa && nonASCIIidentifierStart.test(String.fromCharCode(code)) + ); + } + return isInAstralSet(code, astralIdentifierStartCodes); +} + +// Test whether a given character is part of an identifier. + +export function isIdentifierChar(code: number): boolean { + if (code < charCodes.digit0) return code === charCodes.dollarSign; + if (code < charCodes.colon) return true; + if (code < charCodes.uppercaseA) return false; + if (code <= charCodes.uppercaseZ) return true; + if (code < charCodes.lowercaseA) return code === charCodes.underscore; + if (code <= charCodes.lowercaseZ) return true; + if (code <= 0xffff) { + return code >= 0xaa && nonASCIIidentifier.test(String.fromCharCode(code)); + } + return ( + isInAstralSet(code, astralIdentifierStartCodes) || + isInAstralSet(code, astralIdentifierCodes) + ); +} + +// Test whether a given string is a valid identifier name + +export function isIdentifierName(name: string): boolean { + let isFirst = true; + for (const char of Array.from(name)) { + const cp = char.codePointAt(0); + if (isFirst) { + if (!isIdentifierStart(cp)) { + return false; + } + isFirst = false; + } else if (!isIdentifierChar(cp)) { + return false; + } + } + return !isFirst; +} diff --git a/packages/babel-helper-validator-identifier/src/index.js b/packages/babel-helper-validator-identifier/src/index.js new file mode 100644 index 000000000000..c0979aba5489 --- /dev/null +++ b/packages/babel-helper-validator-identifier/src/index.js @@ -0,0 +1,12 @@ +export { + isIdentifierName, + isIdentifierChar, + isIdentifierStart, +} from "./identifier"; +export { + isReservedWord, + isStrictBindOnlyReservedWord, + isStrictBindReservedWord, + isStrictReservedWord, + isKeyword, +} from "./keyword"; diff --git a/packages/babel-helper-validator-identifier/src/keyword.js b/packages/babel-helper-validator-identifier/src/keyword.js new file mode 100644 index 000000000000..d062275cc022 --- /dev/null +++ b/packages/babel-helper-validator-identifier/src/keyword.js @@ -0,0 +1,98 @@ +// @flow + +const reservedWords = { + keyword: [ + "break", + "case", + "catch", + "continue", + "debugger", + "default", + "do", + "else", + "finally", + "for", + "function", + "if", + "return", + "switch", + "throw", + "try", + "var", + "const", + "while", + "with", + "new", + "this", + "super", + "class", + "extends", + "export", + "import", + "null", + "true", + "false", + "in", + "instanceof", + "typeof", + "void", + "delete", + ], + strict: [ + "implements", + "interface", + "let", + "package", + "private", + "protected", + "public", + "static", + "yield", + ], + strictBind: ["eval", "arguments"], +}; +const keywords = new Set(reservedWords.keyword); +const reservedWordsStrictSet = new Set(reservedWords.strict); +const reservedWordsStrictBindSet = new Set(reservedWords.strictBind); + +/** + * Checks if word is a reserved word in non-strict mode + */ +export function isReservedWord(word: string, inModule: boolean): boolean { + return (inModule && word === "await") || word === "enum"; +} + +/** + * Checks if word is a reserved word in non-binding strict mode + * + * Includes non-strict reserved words + */ +export function isStrictReservedWord(word: string, inModule: boolean): boolean { + return isReservedWord(word, inModule) || reservedWordsStrictSet.has(word); +} + +/** + * Checks if word is a reserved word in binding strict mode, but it is allowed as + * a normal identifier. + */ +export function isStrictBindOnlyReservedWord(word: string): boolean { + return reservedWordsStrictBindSet.has(word); +} + +/** + * Checks if word is a reserved word in binding strict mode + * + * Includes non-strict reserved words and non-binding strict reserved words + */ +export function isStrictBindReservedWord( + word: string, + inModule: boolean, +): boolean { + return ( + isStrictReservedWord(word, inModule) || isStrictBindOnlyReservedWord(word) + ); +} + +export function isKeyword(word: string): boolean { + return keywords.has(word); +} diff --git a/packages/babel-helper-validator-identifier/test/identifier.spec.js b/packages/babel-helper-validator-identifier/test/identifier.spec.js new file mode 100644 index 000000000000..60a25cb57851 --- /dev/null +++ b/packages/babel-helper-validator-identifier/test/identifier.spec.js @@ -0,0 +1,22 @@ +import { isIdentifierName } from ".."; + +describe("isIdentifierName", function() { + it("returns false if provided string is empty", function() { + expect(isIdentifierName("")).toBe(false); + }); + it.each(["hello", "$", "ゆゆ式", "$20", "hello20", "_", "if"])( + "returns true if provided string %p is an IdentifierName", + function(word) { + expect(isIdentifierName(word)).toBe(true); + }, + ); + it.each(["+hello", "0$", "-ゆゆ式", "#_", "_#"])( + "returns false if provided string %p is not an IdentifierName", + function(word) { + expect(isIdentifierName(word)).toBe(false); + }, + ); + it("supports astral symbols", function() { + expect(isIdentifierName("x\uDB40\uDDD5")).toBe(true); + }); +}); diff --git a/packages/babel-helper-wrap-function/package.json b/packages/babel-helper-wrap-function/package.json index d0a3396e76f5..1d2501888a9d 100644 --- a/packages/babel-helper-wrap-function/package.json +++ b/packages/babel-helper-wrap-function/package.json @@ -1,6 +1,6 @@ { "name": "@babel/helper-wrap-function", - "version": "7.2.0", + "version": "7.8.3", "description": "Helper to wrap functions inside a function call.", "repository": "https://github.com/babel/babel/tree/master/packages/babel-helper-wrap-function", "license": "MIT", @@ -9,9 +9,9 @@ }, "main": "lib/index.js", "dependencies": { - "@babel/helper-function-name": "^7.1.0", - "@babel/template": "^7.1.0", - "@babel/traverse": "^7.1.0", - "@babel/types": "^7.2.0" + "@babel/helper-function-name": "^7.8.3", + "@babel/template": "^7.8.3", + "@babel/traverse": "^7.8.3", + "@babel/types": "^7.8.3" } } diff --git a/packages/babel-helpers/package.json b/packages/babel-helpers/package.json index 54db360349b1..20ee10ab5426 100644 --- a/packages/babel-helpers/package.json +++ b/packages/babel-helpers/package.json @@ -1,6 +1,6 @@ { "name": "@babel/helpers", - "version": "7.5.5", + "version": "7.9.2", "description": "Collection of helper functions used by Babel transforms.", "author": "Sebastian McKenzie ", "homepage": "https://babeljs.io/", @@ -11,11 +11,11 @@ "repository": "https://github.com/babel/babel/tree/master/packages/babel-helpers", "main": "lib/index.js", "dependencies": { - "@babel/template": "^7.4.4", - "@babel/traverse": "^7.5.5", - "@babel/types": "^7.5.5" + "@babel/template": "^7.8.3", + "@babel/traverse": "^7.9.0", + "@babel/types": "^7.9.0" }, "devDependencies": { - "@babel/helper-plugin-test-runner": "^7.0.0" + "@babel/helper-plugin-test-runner": "^7.8.3" } } diff --git a/packages/babel-helpers/src/helpers.js b/packages/babel-helpers/src/helpers.js index 8399fb903e45..5f7ced05a8ec 100644 --- a/packages/babel-helpers/src/helpers.js +++ b/packages/babel-helpers/src/helpers.js @@ -12,6 +12,8 @@ const helper = (minVersion: string) => tpl => ({ helpers.typeof = helper("7.0.0-beta.0")` export default function _typeof(obj) { + "@babel/helpers - typeof"; + if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function (obj) { return typeof obj; }; } else { @@ -47,15 +49,6 @@ helpers.jsx = helper("7.0.0-beta.0")` children: void 0, }; } - if (props && defaultProps) { - for (var propName in defaultProps) { - if (props[propName] === void 0) { - props[propName] = defaultProps[propName]; - } - } - } else if (!props) { - props = defaultProps || {}; - } if (childrenLength === 1) { props.children = children; @@ -67,6 +60,16 @@ helpers.jsx = helper("7.0.0-beta.0")` props.children = childArray; } + if (props && defaultProps) { + for (var propName in defaultProps) { + if (props[propName] === void 0) { + props[propName] = defaultProps[propName]; + } + } + } else if (!props) { + props = defaultProps || {}; + } + return { $$typeof: REACT_ELEMENT_TYPE, type: type, @@ -135,7 +138,7 @@ helpers.AsyncGenerator = helper("7.0.0-beta.0")` Promise.resolve(wrappedAwait ? value.wrapped : value).then( function (arg) { if (wrappedAwait) { - resume("next", arg); + resume(key === "return" ? "return" : "next", arg); return } @@ -237,6 +240,10 @@ helpers.asyncGeneratorDelegate = helper("7.0.0-beta.0")` if (typeof inner.return === "function") { iter.return = function (value) { + if (waiting) { + waiting = false; + return value; + } return pump("return", value); }; } @@ -391,7 +398,7 @@ helpers.objectSpread = helper("7.0.0-beta.0")` export default function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { - var source = (arguments[i] != null) ? arguments[i] : {}; + var source = (arguments[i] != null) ? Object(arguments[i]) : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) { @@ -410,7 +417,7 @@ helpers.objectSpread2 = helper("7.5.0")` import defineProperty from "defineProperty"; // This function is different to "Reflect.ownKeys". The enumerableOnly - // filters on symbol properties only. Returned string properties are always + // filters on symbol properties only. Returned string properties are always // enumerable. It is good to use in objectSpread. function ownKeys(object, enumerableOnly) { @@ -429,13 +436,13 @@ helpers.objectSpread2 = helper("7.5.0")` for (var i = 1; i < arguments.length; i++) { var source = (arguments[i] != null) ? arguments[i] : {}; if (i % 2) { - ownKeys(source, true).forEach(function (key) { + ownKeys(Object(source), true).forEach(function (key) { defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { - ownKeys(source).forEach(function (key) { + ownKeys(Object(source)).forEach(function (key) { Object.defineProperty( target, key, @@ -495,10 +502,8 @@ helpers.setPrototypeOf = helper("7.0.0-beta.0")` } `; -helpers.construct = helper("7.0.0-beta.0")` - import setPrototypeOf from "setPrototypeOf"; - - function isNativeReflectConstruct() { +helpers.isNativeReflectConstruct = helper("7.9.0")` + export default function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; // core-js@3 @@ -522,6 +527,11 @@ helpers.construct = helper("7.0.0-beta.0")` return false; } } +`; + +helpers.construct = helper("7.0.0-beta.0")` + import setPrototypeOf from "setPrototypeOf"; + import isNativeReflectConstruct from "isNativeReflectConstruct"; export default function _construct(Parent, args, Class) { if (isNativeReflectConstruct()) { @@ -606,28 +616,47 @@ helpers.interopRequireDefault = helper("7.0.0-beta.0")` `; helpers.interopRequireWildcard = helper("7.0.0-beta.0")` + function _getRequireWildcardCache() { + if (typeof WeakMap !== "function") return null; + + var cache = new WeakMap(); + _getRequireWildcardCache = function () { return cache; }; + return cache; + } + export default function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; - } else { - var newObj = {}; - if (obj != null) { - for (var key in obj) { - if (Object.prototype.hasOwnProperty.call(obj, key)) { - var desc = Object.defineProperty && Object.getOwnPropertyDescriptor - ? Object.getOwnPropertyDescriptor(obj, key) - : {}; - if (desc.get || desc.set) { - Object.defineProperty(newObj, key, desc); - } else { - newObj[key] = obj[key]; - } - } + } + + if (obj === null || (typeof obj !== "object" && typeof obj !== "function")) { + return { default: obj } + } + + var cache = _getRequireWildcardCache(); + if (cache && cache.has(obj)) { + return cache.get(obj); + } + + var newObj = {}; + var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; + for (var key in obj) { + if (Object.prototype.hasOwnProperty.call(obj, key)) { + var desc = hasPropertyDescriptor + ? Object.getOwnPropertyDescriptor(obj, key) + : null; + if (desc && (desc.get || desc.set)) { + Object.defineProperty(newObj, key, desc); + } else { + newObj[key] = obj[key]; } } - newObj.default = obj; - return newObj; } + newObj.default = obj; + if (cache) { + cache.set(obj, newObj); + } + return newObj; } `; @@ -706,6 +735,29 @@ helpers.possibleConstructorReturn = helper("7.0.0-beta.0")` } `; +// This is duplicated to packages/babel-plugin-transform-classes/src/inline-createSuper-helpers.js +helpers.createSuper = helper("7.9.0")` + import getPrototypeOf from "getPrototypeOf"; + import isNativeReflectConstruct from "isNativeReflectConstruct"; + import possibleConstructorReturn from "possibleConstructorReturn"; + + export default function _createSuper(Derived) { + var hasNativeReflectConstruct = isNativeReflectConstruct(); + + return function () { + var Super = getPrototypeOf(Derived), result; + if (hasNativeReflectConstruct) { + // NOTE: This doesn't work if this.__proto__.constructor has been modified. + var NewTarget = getPrototypeOf(this).constructor; + result = Reflect.construct(Super, arguments, NewTarget); + } else { + result = Super.apply(this, arguments); + } + return possibleConstructorReturn(this, result); + } + } + `; + helpers.superPropBase = helper("7.0.0-beta.0")` import getPrototypeOf from "getPrototypeOf"; @@ -817,18 +869,6 @@ helpers.taggedTemplateLiteralLoose = helper("7.0.0-beta.0")` } `; -helpers.temporalRef = helper("7.0.0-beta.0")` - import undef from "temporalUndefined"; - - export default function _temporalRef(val, name) { - if (val === undef) { - throw new ReferenceError(name + " is not defined - temporal dead zone"); - } else { - return val; - } - } -`; - helpers.readOnlyError = helper("7.0.0-beta.0")` export default function _readOnlyError(name) { throw new Error("\\"" + name + "\\" is read-only"); @@ -842,55 +882,95 @@ helpers.classNameTDZError = helper("7.0.0-beta.0")` `; helpers.temporalUndefined = helper("7.0.0-beta.0")` - export default {}; + // This function isn't mean to be called, but to be used as a reference. + // We can't use a normal object because it isn't hoisted. + export default function _temporalUndefined() {} +`; + +helpers.tdz = helper("7.5.5")` + export default function _tdzError(name) { + throw new ReferenceError(name + " is not defined - temporal dead zone"); + } +`; + +helpers.temporalRef = helper("7.0.0-beta.0")` + import undef from "temporalUndefined"; + import err from "tdz"; + + export default function _temporalRef(val, name) { + return val === undef ? err(name) : val; + } `; helpers.slicedToArray = helper("7.0.0-beta.0")` import arrayWithHoles from "arrayWithHoles"; import iterableToArrayLimit from "iterableToArrayLimit"; + import unsupportedIterableToArray from "unsupportedIterableToArray"; import nonIterableRest from "nonIterableRest"; export default function _slicedToArray(arr, i) { - return arrayWithHoles(arr) || iterableToArrayLimit(arr, i) || nonIterableRest(); + return ( + arrayWithHoles(arr) || + iterableToArrayLimit(arr, i) || + unsupportedIterableToArray(arr, i) || + nonIterableRest() + ); } `; helpers.slicedToArrayLoose = helper("7.0.0-beta.0")` import arrayWithHoles from "arrayWithHoles"; import iterableToArrayLimitLoose from "iterableToArrayLimitLoose"; + import unsupportedIterableToArray from "unsupportedIterableToArray"; import nonIterableRest from "nonIterableRest"; export default function _slicedToArrayLoose(arr, i) { - return arrayWithHoles(arr) || iterableToArrayLimitLoose(arr, i) || nonIterableRest(); + return ( + arrayWithHoles(arr) || + iterableToArrayLimitLoose(arr, i) || + unsupportedIterableToArray(arr, i) || + nonIterableRest() + ); } `; helpers.toArray = helper("7.0.0-beta.0")` import arrayWithHoles from "arrayWithHoles"; import iterableToArray from "iterableToArray"; + import unsupportedIterableToArray from "unsupportedIterableToArray"; import nonIterableRest from "nonIterableRest"; export default function _toArray(arr) { - return arrayWithHoles(arr) || iterableToArray(arr) || nonIterableRest(); + return ( + arrayWithHoles(arr) || + iterableToArray(arr) || + unsupportedIterableToArray(arr) || + nonIterableRest() + ); } `; helpers.toConsumableArray = helper("7.0.0-beta.0")` import arrayWithoutHoles from "arrayWithoutHoles"; import iterableToArray from "iterableToArray"; + import unsupportedIterableToArray from "unsupportedIterableToArray"; import nonIterableSpread from "nonIterableSpread"; export default function _toConsumableArray(arr) { - return arrayWithoutHoles(arr) || iterableToArray(arr) || nonIterableSpread(); + return ( + arrayWithoutHoles(arr) || + iterableToArray(arr) || + unsupportedIterableToArray(arr) || + nonIterableSpread() + ); } `; helpers.arrayWithoutHoles = helper("7.0.0-beta.0")` + import arrayLikeToArray from "arrayLikeToArray"; + export default function _arrayWithoutHoles(arr) { - if (Array.isArray(arr)) { - for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) arr2[i] = arr[i]; - return arr2; - } + if (Array.isArray(arr)) return arrayLikeToArray(arr); } `; @@ -902,10 +982,7 @@ helpers.arrayWithHoles = helper("7.0.0-beta.0")` helpers.iterableToArray = helper("7.0.0-beta.0")` export default function _iterableToArray(iter) { - if ( - Symbol.iterator in Object(iter) || - Object.prototype.toString.call(iter) === "[object Arguments]" - ) return Array.from(iter); + if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); } `; @@ -913,7 +990,7 @@ helpers.iterableToArrayLimit = helper("7.0.0-beta.0")` export default function _iterableToArrayLimit(arr, i) { // this is an expanded form of \`for...of\` that properly supports abrupt completions of // iterators etc. variable names have been minimised to reduce the size of this massive - // helper. sometimes spec compliancy is annoying :( + // helper. sometimes spec compliance is annoying :( // // _n = _iteratorNormalCompletion // _d = _didIteratorError @@ -921,6 +998,8 @@ helpers.iterableToArrayLimit = helper("7.0.0-beta.0")` // _i = _iterator // _s = _step + if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; + var _arr = []; var _n = true; var _d = false; @@ -946,6 +1025,8 @@ helpers.iterableToArrayLimit = helper("7.0.0-beta.0")` helpers.iterableToArrayLimitLoose = helper("7.0.0-beta.0")` export default function _iterableToArrayLimitLoose(arr, i) { + if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; + var _arr = []; for (var _iterator = arr[Symbol.iterator](), _step; !(_step = _iterator.next()).done;) { _arr.push(_step.value); @@ -955,15 +1036,117 @@ helpers.iterableToArrayLimitLoose = helper("7.0.0-beta.0")` } `; +helpers.unsupportedIterableToArray = helper("7.9.0")` + import arrayLikeToArray from "arrayLikeToArray"; + + export default function _unsupportedIterableToArray(o, minLen) { + if (!o) return; + if (typeof o === "string") return arrayLikeToArray(o, minLen); + var n = Object.prototype.toString.call(o).slice(8, -1); + if (n === "Object" && o.constructor) n = o.constructor.name; + if (n === "Map" || n === "Set") return Array.from(o); + if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) + return arrayLikeToArray(o, minLen); + } +`; + +helpers.arrayLikeToArray = helper("7.9.0")` + export default function _arrayLikeToArray(arr, len) { + if (len == null || len > arr.length) len = arr.length; + for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; + return arr2; + } +`; + helpers.nonIterableSpread = helper("7.0.0-beta.0")` export default function _nonIterableSpread() { - throw new TypeError("Invalid attempt to spread non-iterable instance"); + throw new TypeError( + "Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method." + ); } `; helpers.nonIterableRest = helper("7.0.0-beta.0")` export default function _nonIterableRest() { - throw new TypeError("Invalid attempt to destructure non-iterable instance"); + throw new TypeError( + "Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method." + ); + } +`; + +helpers.createForOfIteratorHelper = helper("7.9.0")` + import unsupportedIterableToArray from "unsupportedIterableToArray"; + + // s: start (create the iterator) + // n: next + // e: error (called whenever something throws) + // f: finish (always called at the end) + + export default function _createForOfIteratorHelper(o) { + if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { + // Fallback for engines without symbol support + if (Array.isArray(o) || (o = unsupportedIterableToArray(o))) { + var i = 0; + var F = function(){}; + return { + s: F, + n: function() { + if (i >= o.length) return { done: true }; + return { done: false, value: o[i++] }; + }, + e: function(e) { throw e; }, + f: F, + }; + } + + throw new TypeError("Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); + } + + var it, normalCompletion = true, didErr = false, err; + + return { + s: function() { + it = o[Symbol.iterator](); + }, + n: function() { + var step = it.next(); + normalCompletion = step.done; + return step; + }, + e: function(e) { + didErr = true; + err = e; + }, + f: function() { + try { + if (!normalCompletion && it.return != null) it.return(); + } finally { + if (didErr) throw err; + } + } + }; + } +`; + +helpers.createForOfIteratorHelperLoose = helper("7.9.0")` + import unsupportedIterableToArray from "unsupportedIterableToArray"; + + export default function _createForOfIteratorHelperLoose(o) { + var i = 0; + + if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { + // Fallback for engines without symbol support + if (Array.isArray(o) || (o = unsupportedIterableToArray(o))) + return function() { + if (i >= o.length) return { done: true }; + return { done: false, value: o[i++] }; + } + + throw new TypeError("Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); + } + + i = o[Symbol.iterator](); + return i.next.bind(i); } `; @@ -1010,9 +1193,7 @@ helpers.initializerWarningHelper = helper("7.0.0-beta.0")` export default function _initializerWarningHelper(descriptor, context){ throw new Error( 'Decorating class property failed. Please ensure that ' + - 'proposal-class-properties is enabled and set to use loose mode. ' + - 'To use proposal-class-properties in spec mode with decorators, wait for ' + - 'the next major version of decorators in stage 2.' + 'proposal-class-properties is enabled and runs after the decorators transform.' ); } `; @@ -1154,6 +1335,9 @@ helpers.classStaticPrivateFieldSpecGet = helper("7.0.2")` if (receiver !== classConstructor) { throw new TypeError("Private static access of wrong provenance"); } + if (descriptor.get) { + return descriptor.get.call(receiver); + } return descriptor.value; } `; @@ -1163,13 +1347,18 @@ helpers.classStaticPrivateFieldSpecSet = helper("7.0.2")` if (receiver !== classConstructor) { throw new TypeError("Private static access of wrong provenance"); } - if (!descriptor.writable) { - // This should only throw in strict mode, but class bodies are - // always strict and private fields can only be used inside - // class bodies. - throw new TypeError("attempted to set read only private field"); + if (descriptor.set) { + descriptor.set.call(receiver, value); + } else { + if (!descriptor.writable) { + // This should only throw in strict mode, but class bodies are + // always strict and private fields can only be used inside + // class bodies. + throw new TypeError("attempted to set read only private field"); + } + descriptor.value = value; } - descriptor.value = value; + return value; } `; @@ -1886,16 +2075,17 @@ helpers.wrapRegExp = helper("7.2.6")` export default function _wrapRegExp(re, groups) { _wrapRegExp = function(re, groups) { - return new BabelRegExp(re, groups); + return new BabelRegExp(re, undefined, groups); }; var _RegExp = wrapNativeSuper(RegExp); var _super = RegExp.prototype; var _groups = new WeakMap(); - function BabelRegExp(re, groups) { - var _this = _RegExp.call(this, re); - _groups.set(_this, groups); + function BabelRegExp(re, flags, groups) { + var _this = _RegExp.call(this, re, flags); + // if the regex is recreated with 'g' flag + _groups.set(_this, groups || _groups.get(re)); return _this; } inherits(BabelRegExp, _RegExp); diff --git a/packages/babel-helpers/src/index.js b/packages/babel-helpers/src/index.js index 9dc87ce58916..b7aa97dff1ae 100644 --- a/packages/babel-helpers/src/index.js +++ b/packages/babel-helpers/src/index.js @@ -13,6 +13,7 @@ function makePath(path) { return parts.reverse().join("."); } +let fileClass = undefined; /** * Given a file AST for a given helper, get a bunch of metadata about it so that Babel can quickly render * the helper is whatever context it is needed in. @@ -29,7 +30,7 @@ function getHelperMetadata(file) { const importPaths = []; const importBindingsReferences = []; - traverse(file, { + const dependencyVisitor = { ImportDeclaration(child) { const name = child.node.source.value; if (!helpers[name]) { @@ -72,9 +73,9 @@ function getHelperMetadata(file) { child.skip(); }, - }); + }; - traverse(file, { + const referenceVisitor = { Program(path) { const bindings = path.scope.getAllBindings(); @@ -111,7 +112,10 @@ function getHelperMetadata(file) { exportBindingAssignments.push(makePath(child)); } }, - }); + }; + + traverse(file.ast, dependencyVisitor, file.scope); + traverse(file.ast, referenceVisitor, file.scope); if (!exportPath) throw new Error("Helpers must default-export something."); @@ -170,7 +174,7 @@ function permuteHelperAST(file, metadata, id, localBindings, getDependency) { toRename[exportName] = id.name; } - traverse(file, { + const visitor = { Program(path) { // We need to compute these in advance because removing nodes would // invalidate the paths. @@ -223,7 +227,8 @@ function permuteHelperAST(file, metadata, id, localBindings, getDependency) { // actually doing the traversal. path.stop(); }, - }); + }; + traverse(file.ast, visitor, file.scope); } const helperData = Object.create(null); @@ -238,7 +243,16 @@ function loadHelper(name) { } const fn = () => { - return t.file(helper.ast()); + const file = { ast: t.file(helper.ast()) }; + if (fileClass) { + return new fileClass( + { + filename: `babel-helper://${name}`, + }, + file, + ); + } + return file; }; const metadata = getHelperMetadata(fn()); @@ -249,7 +263,7 @@ function loadHelper(name) { permuteHelperAST(file, metadata, id, localBindings, getDependency); return { - nodes: file.program.body, + nodes: file.ast.program.body, globals: metadata.globals, }; }, @@ -280,7 +294,12 @@ export function getDependencies(name: string): $ReadOnlyArray { return Array.from(loadHelper(name).dependencies.values()); } -export function ensure(name: string) { +export function ensure(name: string, newFileClass?) { + if (!fileClass) { + // optional fileClass used to wrap helper snippets into File instance, + // offering `path.hub` support during traversal + fileClass = newFileClass; + } loadHelper(name); } diff --git a/packages/babel-helpers/test/fixtures/regression/9496/input.js b/packages/babel-helpers/test/fixtures/regression/9496/input.js new file mode 100644 index 000000000000..087837e3f442 --- /dev/null +++ b/packages/babel-helpers/test/fixtures/regression/9496/input.js @@ -0,0 +1 @@ +REPLACE_ME; \ No newline at end of file diff --git a/packages/babel-helpers/test/fixtures/regression/9496/options.json b/packages/babel-helpers/test/fixtures/regression/9496/options.json new file mode 100644 index 000000000000..14af0e5feac8 --- /dev/null +++ b/packages/babel-helpers/test/fixtures/regression/9496/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["./plugin"] +} diff --git a/packages/babel-helpers/test/fixtures/regression/9496/output.js b/packages/babel-helpers/test/fixtures/regression/9496/output.js new file mode 100644 index 000000000000..a1a37645acd7 --- /dev/null +++ b/packages/babel-helpers/test/fixtures/regression/9496/output.js @@ -0,0 +1,3 @@ +function _$_9496_main_hub_is_found() {} + +_$_9496_main_hub_is_found; diff --git a/packages/babel-helpers/test/fixtures/regression/9496/plugin.js b/packages/babel-helpers/test/fixtures/regression/9496/plugin.js new file mode 100644 index 000000000000..4c25ad746fc6 --- /dev/null +++ b/packages/babel-helpers/test/fixtures/regression/9496/plugin.js @@ -0,0 +1,22 @@ +const defineHelper = require("../../../helpers/define-helper").default; + +const main = defineHelper(__dirname, "main", ` + export default function helper() {} +`); + +module.exports = function() { + return { + visitor: { + Identifier(path) { + if (path.node.name !== "REPLACE_ME") { + if (path.hub) { + path.node.name += "_hub_is_found"; + } + return; + } + const helper = this.addHelper(main); + path.replaceWith(helper); + }, + }, + }; +}; diff --git a/packages/babel-highlight/package.json b/packages/babel-highlight/package.json index 66fcb3c2db0f..fab878453389 100644 --- a/packages/babel-highlight/package.json +++ b/packages/babel-highlight/package.json @@ -1,6 +1,6 @@ { "name": "@babel/highlight", - "version": "7.5.0", + "version": "7.9.0", "description": "Syntax highlight JavaScript strings for output in terminals.", "author": "suchipi ", "homepage": "https://babeljs.io/", @@ -11,8 +11,8 @@ "repository": "https://github.com/babel/babel/tree/master/packages/babel-highlight", "main": "lib/index.js", "dependencies": { + "@babel/helper-validator-identifier": "^7.9.0", "chalk": "^2.0.0", - "esutils": "^2.0.2", "js-tokens": "^4.0.0" }, "devDependencies": { diff --git a/packages/babel-highlight/src/index.js b/packages/babel-highlight/src/index.js index cc98a49f85a3..9112f39513af 100644 --- a/packages/babel-highlight/src/index.js +++ b/packages/babel-highlight/src/index.js @@ -1,5 +1,5 @@ import jsTokens, { matchToToken } from "js-tokens"; -import esutils from "esutils"; +import { isReservedWord, isKeyword } from "@babel/helper-validator-identifier"; import Chalk from "chalk"; /** @@ -43,7 +43,7 @@ function getTokenType(match) { const token = matchToToken(match); if (token.type === "name") { - if (esutils.keyword.isReservedWordES6(token.value)) { + if (isKeyword(token.value) || isReservedWord(token.value)) { return "keyword"; } diff --git a/packages/babel-node/package.json b/packages/babel-node/package.json index d613965164c4..de7d9d0fed65 100644 --- a/packages/babel-node/package.json +++ b/packages/babel-node/package.json @@ -1,6 +1,6 @@ { "name": "@babel/node", - "version": "7.5.5", + "version": "7.8.7", "description": "Babel command line", "author": "Sebastian McKenzie ", "homepage": "https://babeljs.io/", @@ -19,21 +19,25 @@ "compiler" ], "dependencies": { - "@babel/polyfill": "^7.0.0", - "@babel/register": "^7.5.5", - "commander": "^2.8.1", + "@babel/register": "^7.8.3", + "commander": "^4.0.1", + "core-js": "^3.2.1", "lodash": "^4.17.13", "node-environment-flags": "^1.0.5", + "regenerator-runtime": "^0.13.4", + "resolve": "^1.13.1", "v8flags": "^3.1.1" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.5.5", - "@babel/helper-fixtures": "^7.5.5", + "@babel/core": "^7.8.7", + "@babel/helper-fixtures": "^7.8.3", + "@babel/runtime": "^7.8.7", "fs-readdir-recursive": "^1.0.0", - "output-file-sync": "^2.0.0" + "make-dir": "^2.1.0", + "rimraf": "^3.0.0" }, "bin": { "babel-node": "./bin/babel-node.js" diff --git a/packages/babel-node/src/_babel-node.js b/packages/babel-node/src/_babel-node.js index ff908a56e6d2..22b8e00b779c 100644 --- a/packages/babel-node/src/_babel-node.js +++ b/packages/babel-node/src/_babel-node.js @@ -5,8 +5,10 @@ import path from "path"; import repl from "repl"; import * as babel from "@babel/core"; import vm from "vm"; -import "@babel/polyfill"; +import "core-js/stable"; +import "regenerator-runtime/runtime"; import register from "@babel/register"; +import resolve from "resolve"; import pkg from "../package.json"; @@ -167,15 +169,15 @@ if (program.eval || program.print) { } if (arg[0] === "-") { - const camelArg = arg - .slice(2) - .replace(/-(\w)/, (s, c) => c.toUpperCase()); - const parsedArg = program[camelArg]; - if ( - arg === "-r" || - arg === "--require" || - (parsedArg && parsedArg !== true) - ) { + const parsedOption = program.options.find(option => { + return option.long === arg || option.short === arg; + }); + if (parsedOption === undefined) { + return; + } + const optionName = parsedOption.attributeName(); + const parsedArg = program[optionName]; + if (optionName === "require" || (parsedArg && parsedArg !== true)) { ignoreNext = true; } } else { @@ -187,11 +189,9 @@ if (program.eval || program.print) { // We have to handle require ourselves, as we want to require it in the context of babel-register if (program.require) { - let requireFileName = program.require; - if (!path.isAbsolute(requireFileName)) { - requireFileName = path.join(process.cwd(), requireFileName); - } - require(requireFileName); + require(resolve.sync(program.require, { + basedir: process.cwd(), + })); } // make the filename absolute @@ -212,7 +212,7 @@ if (program.eval || program.print) { function replStart() { repl.start({ - prompt: "> ", + prompt: "babel > ", input: process.stdin, output: process.stdout, eval: replEval, diff --git a/packages/babel-node/src/babel-node.js b/packages/babel-node/src/babel-node.js index d143e4f756b4..7a3bad135fdb 100755 --- a/packages/babel-node/src/babel-node.js +++ b/packages/babel-node/src/babel-node.js @@ -40,7 +40,10 @@ function getNormalizedV8Flag(arg) { } // These are aliases for node options defined by babel-node. -const aliases = new Map([["-d", "--debug"], ["-gc", "--expose-gc"]]); +const aliases = new Map([ + ["-d", "--debug"], + ["-gc", "--expose-gc"], +]); getV8Flags(function(err, v8Flags) { for (let i = 0; i < babelArgs.length; i++) { @@ -89,13 +92,10 @@ getV8Flags(function(err, v8Flags) { if (signal) { process.kill(process.pid, signal); } else { - process.exit(code); + process.exitCode = code; } }); }); - process.on("SIGINT", () => { - proc.kill("SIGINT"); - process.exit(1); - }); + process.on("SIGINT", () => proc.kill("SIGINT")); } }); diff --git a/packages/babel-node/test/config.json b/packages/babel-node/test/config.json new file mode 100644 index 000000000000..06c1c5853007 --- /dev/null +++ b/packages/babel-node/test/config.json @@ -0,0 +1,11 @@ +{ + "presets": [ + "../../babel-preset-env", + ["../../babel-preset-react"] + ], + "plugins": [ + "../../babel-plugin-transform-strict-mode", + "../../babel-plugin-transform-modules-commonjs" + ], + "only": ["../../../packages/*/test"] +} diff --git a/packages/babel-node/test/fixtures/babel-node/--presets/in-files/index.js b/packages/babel-node/test/fixtures/babel-node/--presets/in-files/index.js new file mode 100644 index 000000000000..85ce559e8f22 --- /dev/null +++ b/packages/babel-node/test/fixtures/babel-node/--presets/in-files/index.js @@ -0,0 +1 @@ +console.log("foo"); diff --git a/packages/babel-node/test/fixtures/babel-node/--presets/in-files/presetFile.js b/packages/babel-node/test/fixtures/babel-node/--presets/in-files/presetFile.js new file mode 100644 index 000000000000..b2d0556f1398 --- /dev/null +++ b/packages/babel-node/test/fixtures/babel-node/--presets/in-files/presetFile.js @@ -0,0 +1,4 @@ +module.exports = function () { + console.log("Preset was loaded, so --presets was used."); + return {}; +}; diff --git a/packages/babel-node/test/fixtures/babel-node/--presets/options.json b/packages/babel-node/test/fixtures/babel-node/--presets/options.json new file mode 100644 index 000000000000..bd14d5f365b2 --- /dev/null +++ b/packages/babel-node/test/fixtures/babel-node/--presets/options.json @@ -0,0 +1,3 @@ +{ + "args": ["--presets", "./presetFile.js", "index"] +} diff --git a/packages/babel-node/test/fixtures/babel-node/--presets/stdout.txt b/packages/babel-node/test/fixtures/babel-node/--presets/stdout.txt new file mode 100644 index 000000000000..69ccc409d020 --- /dev/null +++ b/packages/babel-node/test/fixtures/babel-node/--presets/stdout.txt @@ -0,0 +1,2 @@ +Preset was loaded, so --presets was used. +foo diff --git a/packages/babel-node/test/fixtures/babel-node/--require/in-files/dep.js b/packages/babel-node/test/fixtures/babel-node/--require/in-files/dep.js new file mode 100644 index 000000000000..16f81e8b7061 --- /dev/null +++ b/packages/babel-node/test/fixtures/babel-node/--require/in-files/dep.js @@ -0,0 +1 @@ +console.log("dep"); \ No newline at end of file diff --git a/packages/babel-node/test/fixtures/babel-node/--require/in-files/foo.js b/packages/babel-node/test/fixtures/babel-node/--require/in-files/foo.js new file mode 100644 index 000000000000..85ce559e8f22 --- /dev/null +++ b/packages/babel-node/test/fixtures/babel-node/--require/in-files/foo.js @@ -0,0 +1 @@ +console.log("foo"); diff --git a/packages/babel-node/test/fixtures/babel-node/--require/options.json b/packages/babel-node/test/fixtures/babel-node/--require/options.json new file mode 100644 index 000000000000..1384a0394841 --- /dev/null +++ b/packages/babel-node/test/fixtures/babel-node/--require/options.json @@ -0,0 +1,3 @@ +{ + "args": ["foo", "-r", "./dep"] +} diff --git a/packages/babel-node/test/fixtures/babel-node/--require/stdout.txt b/packages/babel-node/test/fixtures/babel-node/--require/stdout.txt new file mode 100644 index 000000000000..4718ef0fa726 --- /dev/null +++ b/packages/babel-node/test/fixtures/babel-node/--require/stdout.txt @@ -0,0 +1,2 @@ +dep +foo diff --git a/packages/babel-node/test/fixtures/babel-node/--require_node_modules/in-files/foo.js b/packages/babel-node/test/fixtures/babel-node/--require_node_modules/in-files/foo.js new file mode 100644 index 000000000000..85ce559e8f22 --- /dev/null +++ b/packages/babel-node/test/fixtures/babel-node/--require_node_modules/in-files/foo.js @@ -0,0 +1 @@ +console.log("foo"); diff --git a/packages/babel-node/test/fixtures/babel-node/--require_node_modules/in-files/node_modules/dep.js b/packages/babel-node/test/fixtures/babel-node/--require_node_modules/in-files/node_modules/dep.js new file mode 100644 index 000000000000..16f81e8b7061 --- /dev/null +++ b/packages/babel-node/test/fixtures/babel-node/--require_node_modules/in-files/node_modules/dep.js @@ -0,0 +1 @@ +console.log("dep"); \ No newline at end of file diff --git a/packages/babel-node/test/fixtures/babel-node/--require_node_modules/options.json b/packages/babel-node/test/fixtures/babel-node/--require_node_modules/options.json new file mode 100644 index 000000000000..473c909f3949 --- /dev/null +++ b/packages/babel-node/test/fixtures/babel-node/--require_node_modules/options.json @@ -0,0 +1,3 @@ +{ + "args": ["foo", "-r", "dep"] +} diff --git a/packages/babel-node/test/fixtures/babel-node/--require_node_modules/stdout.txt b/packages/babel-node/test/fixtures/babel-node/--require_node_modules/stdout.txt new file mode 100644 index 000000000000..4718ef0fa726 --- /dev/null +++ b/packages/babel-node/test/fixtures/babel-node/--require_node_modules/stdout.txt @@ -0,0 +1,2 @@ +dep +foo diff --git a/packages/babel-node/test/fixtures/babel-node/-b/in-files/index.js b/packages/babel-node/test/fixtures/babel-node/-b/in-files/index.js new file mode 100644 index 000000000000..85ce559e8f22 --- /dev/null +++ b/packages/babel-node/test/fixtures/babel-node/-b/in-files/index.js @@ -0,0 +1 @@ +console.log("foo"); diff --git a/packages/babel-node/test/fixtures/babel-node/-b/in-files/presetFile.js b/packages/babel-node/test/fixtures/babel-node/-b/in-files/presetFile.js new file mode 100644 index 000000000000..6e064ea108f2 --- /dev/null +++ b/packages/babel-node/test/fixtures/babel-node/-b/in-files/presetFile.js @@ -0,0 +1,4 @@ +module.exports = function () { + console.log("Preset was loaded, so -b was used."); + return {}; +}; diff --git a/packages/babel-node/test/fixtures/babel-node/-b/options.json b/packages/babel-node/test/fixtures/babel-node/-b/options.json new file mode 100644 index 000000000000..19044775d5e6 --- /dev/null +++ b/packages/babel-node/test/fixtures/babel-node/-b/options.json @@ -0,0 +1,3 @@ +{ + "args": ["-b", "./presetFile.js", "index"] +} diff --git a/packages/babel-node/test/fixtures/babel-node/-b/stdout.txt b/packages/babel-node/test/fixtures/babel-node/-b/stdout.txt new file mode 100644 index 000000000000..29cee3ef1391 --- /dev/null +++ b/packages/babel-node/test/fixtures/babel-node/-b/stdout.txt @@ -0,0 +1,2 @@ +Preset was loaded, so -b was used. +foo diff --git a/packages/babel-node/test/index.js b/packages/babel-node/test/index.js index dfed556b75df..3ac90c7123f5 100644 --- a/packages/babel-node/test/index.js +++ b/packages/babel-node/test/index.js @@ -2,7 +2,7 @@ const includes = require("lodash/includes"); const readdir = require("fs-readdir-recursive"); const helper = require("@babel/helper-fixtures"); const rimraf = require("rimraf"); -const outputFileSync = require("output-file-sync"); +const { sync: makeDirSync } = require("make-dir"); const child = require("child_process"); const merge = require("lodash/merge"); const path = require("path"); @@ -15,15 +15,10 @@ const fileFilter = function(x) { return x !== ".DS_Store"; }; -const presetLocs = [ - path.join(__dirname, "../../babel-preset-env"), - path.join(__dirname, "../../babel-preset-react"), -].join(","); - -const pluginLocs = [ - path.join(__dirname, "/../../babel-plugin-transform-strict-mode"), - path.join(__dirname, "/../../babel-plugin-transform-modules-commonjs"), -].join(","); +const outputFileSync = function(filePath, data) { + makeDirSync(path.dirname(filePath)); + fs.writeFileSync(filePath, data); +}; const readDir = function(loc, filter) { const files = {}; @@ -77,7 +72,7 @@ const assertTest = function(stdout, stderr, opts) { const actualFiles = readDir(path.join(tmpLoc)); Object.keys(actualFiles).forEach(function(filename) { - if (!opts.inFiles.hasOwnProperty(filename)) { + if (!Object.prototype.hasOwnProperty.call(opts.inFiles, filename)) { const expected = opts.outFiles[filename]; const actual = actualFiles[filename]; @@ -99,14 +94,9 @@ const buildTest = function(binName, testName, opts) { const binLoc = path.join(__dirname, "../lib", binName); return function(callback) { - clear(); saveInFiles(opts.inFiles); - let args = [binLoc]; - - args.push("--presets", presetLocs, "--plugins", pluginLocs); - args.push("--only", "../../../../packages/*/test"); - + args.push("--config-file", "../config.json"); args = args.concat(opts.args); const spawn = child.spawn(process.execPath, args); @@ -146,13 +136,6 @@ const buildTest = function(binName, testName, opts) { }; }; -const clear = function() { - process.chdir(__dirname); - if (fs.existsSync(tmpLoc)) rimraf.sync(tmpLoc); - fs.mkdirSync(tmpLoc); - process.chdir(tmpLoc); -}; - fs.readdirSync(fixtureLoc).forEach(function(binName) { if (binName[0] === ".") return; @@ -162,6 +145,16 @@ fs.readdirSync(fixtureLoc).forEach(function(binName) { beforeEach(() => { cwd = process.cwd(); + + if (fs.existsSync(tmpLoc)) { + for (const child of fs.readdirSync(tmpLoc)) { + rimraf.sync(path.join(tmpLoc, child)); + } + } else { + fs.mkdirSync(tmpLoc); + } + + process.chdir(tmpLoc); }); afterEach(() => { @@ -198,7 +191,7 @@ fs.readdirSync(fixtureLoc).forEach(function(binName) { opts.inFiles[".babelrc"] = helper.readFile(babelrcLoc); } - it(testName, buildTest(binName, testName, opts)); + it(testName, buildTest(binName, testName, opts), 20000); }); }); }); diff --git a/packages/babel-parser/CHANGELOG.md b/packages/babel-parser/CHANGELOG.md index 6ddd17fb8800..8a43406dd600 100644 --- a/packages/babel-parser/CHANGELOG.md +++ b/packages/babel-parser/CHANGELOG.md @@ -2,7 +2,7 @@ > **Tags:** > - :boom: [Breaking Change] -> - :eyeglasses: [Spec Compliancy] +> - :eyeglasses: [Spec Compliance] > - :rocket: [New Feature] > - :bug: [Bug Fix] > - :memo: [Documentation] @@ -56,7 +56,7 @@ See the [Babel Changelog](https://github.com/babel/babel/blob/master/CHANGELOG.m ## 7.0.0-beta.7 (2017-03-22) -### Spec Compliancy +### Spec Compliance * Remove babylon plugin for template revision since it's stage-4 (#426) (Henry Zhu) ### Bug Fix @@ -200,7 +200,7 @@ declare module "C" { } ``` -### :eyeglasses: Spec Compliancy +### :eyeglasses: Spec Compliance Forbid semicolons after decorators in classes ([#352](https://github.com/babel/babylon/pull/352)) (Kevin Gibbons) @@ -305,7 +305,7 @@ AST spec: fix casing of `RegExpLiteral` ([#318](https://github.com/babel/babylon ## 6.15.0 (2017-01-10) -### :eyeglasses: Spec Compliancy +### :eyeglasses: Spec Compliance Add support for Flow shorthand import type ([#267](https://github.com/babel/babylon/pull/267)) (Jeff Morrison) @@ -411,7 +411,7 @@ Will include all parser plugins instead of specifying each one individually. Use ## 6.14.0 (2016-11-16) -### :eyeglasses: Spec Compliancy +### :eyeglasses: Spec Compliance Throw error for reserved words `enum` and `await` ([#195](https://github.com/babel/babylon/pull/195)) (Kai Cataldo) @@ -491,7 +491,7 @@ With that test case, there was a ~95ms savings by removing the need for node to ## v6.13.0 (2016-10-21) -### :eyeglasses: Spec Compliancy +### :eyeglasses: Spec Compliance Property variance type annotations for Flow plugin ([#161](https://github.com/babel/babylon/pull/161)) (Sam Goldman) @@ -549,7 +549,7 @@ Fixes two tests that are failing after the merge of #172 ([#177](https://github. ## v6.12.0 (2016-10-14) -### :eyeglasses: Spec Compliancy +### :eyeglasses: Spec Compliance Implement import() syntax ([#163](https://github.com/babel/babylon/pull/163)) (Jordan Gensler) @@ -643,7 +643,7 @@ export const { foo: [ ,, qux7 ] } = bar; ## v6.11.5 (2016-10-12) -### :eyeglasses: Spec Compliancy +### :eyeglasses: Spec Compliance Fix: Check for duplicate named exports in exported destructuring assignments ([#144](https://github.com/babel/babylon/pull/144)) (Kai Cataldo) @@ -689,7 +689,7 @@ Temporary rollback for erroring on trailing comma with spread (#154) (Henry Zhu) ## v6.11.3 (2016-10-01) -### :eyeglasses: Spec Compliancy +### :eyeglasses: Spec Compliance Add static errors for object rest (#149) ([@danez](https://github.com/danez)) @@ -782,7 +782,7 @@ export toString from './toString'; ## 6.11.0 (2016-09-22) -### Spec Compliancy (will break CI) +### Spec Compliance (will break CI) - Disallow duplicate named exports ([#107](https://github.com/babel/babylon/pull/107)) @kaicataldo @@ -862,9 +862,9 @@ for (+i in {}); ## 6.10.0 (2016-09-19) -> We plan to include some spec compliancy bugs in patch versions. An example was the multiple default exports issue. +> We plan to include some spec compliance bugs in patch versions. An example was the multiple default exports issue. -### Spec Compliancy +### Spec Compliance * Implement ES2016 check for simple parameter list in strict mode ([#106](https://github.com/babel/babylon/pull/106)) (Timothy Gu) @@ -1023,7 +1023,7 @@ declare module "foo" { - The existential type `*` is not a valid type parameter. - The existential type `*` is a primary type -### Spec Compliancy +### Spec Compliance - The param list for type parameter declarations now consists of `TypeParameter` nodes - New `TypeParameter` AST Node (replaces using the `Identifier` node before) diff --git a/packages/babel-parser/ast/spec.md b/packages/babel-parser/ast/spec.md index d1b1a51ca733..8e619674a562 100644 --- a/packages/babel-parser/ast/spec.md +++ b/packages/babel-parser/ast/spec.md @@ -10,6 +10,7 @@ These are the core @babel/parser (babylon) AST node types. - [StringLiteral](#stringliteral) - [BooleanLiteral](#booleanliteral) - [NumericLiteral](#numericliteral) + - [BigIntLiteral](#bigintliteral) - [Programs](#programs) - [Functions](#functions) - [Statements](#statements) @@ -58,6 +59,8 @@ These are the core @babel/parser (babylon) AST node types. - [ObjectMember](#objectmember) - [ObjectProperty](#objectproperty) - [ObjectMethod](#objectmethod) + - [RecordExpression](#recordexpression) + - [TupleExpression](#tupleexpression) - [FunctionExpression](#functionexpression) - [Unary operations](#unary-operations) - [UnaryExpression](#unaryexpression) @@ -107,6 +110,7 @@ These are the core @babel/parser (babylon) AST node types. - [ImportSpecifier](#importspecifier) - [ImportDefaultSpecifier](#importdefaultspecifier) - [ImportNamespaceSpecifier](#importnamespacespecifier) + - [ImportAttribute](#importattribute) - [Exports](#exports) - [ExportNamedDeclaration](#exportnameddeclaration) - [ExportSpecifier](#exportspecifier) @@ -237,6 +241,17 @@ interface NumericLiteral <: Literal { } ``` +## BigIntLiteral + +```js +interface BigIntLiteral <: Literal { + type: "BigIntLiteral"; + value: string; +} +``` + +The `value` property is the string representation of the `BigInt` value. It doesn't include the suffix `n`. + # Programs ```js @@ -447,7 +462,7 @@ A `try` statement. If `handler` is `null` then `finalizer` must be a `BlockState ```js interface CatchClause <: Node { type: "CatchClause"; - param: Pattern | null; + param?: Pattern; body: BlockStatement; } ``` @@ -718,6 +733,24 @@ interface ObjectMethod <: ObjectMember, Function { } ``` +## RecordExpression + +```js +interface RecordExpression <: Expression { + type: "RecordExpression"; + properties: [ ObjectProperty | ObjectMethod | SpreadElement ]; +} +``` + +## TupleExpression + +```js +interface TupleExpression <: Expression { + type: "TupleExpression"; + elements: [ Expression | SpreadElement | null ]; +} +``` + ## FunctionExpression ```js @@ -818,7 +851,7 @@ interface AssignmentExpression <: Expression { } ``` -An assignment operator expression. +An assignment operator expression. It has short-circuiting behaviour if the `operator` is one of `"||="`, `"&&="`, and `"??="`. #### AssignmentOperator @@ -827,6 +860,7 @@ enum AssignmentOperator { "=" | "+=" | "-=" | "*=" | "/=" | "%=" | "**=" | "<<=" | ">>=" | ">>>=" | "|=" | "^=" | "&=" + | "||=" | "&&=" | "??=" } ``` @@ -880,11 +914,10 @@ interface MemberExpression <: Expression, Pattern { object: Expression | Super; property: Expression; computed: boolean; - optional: boolean | null; } ``` -A member expression. If `computed` is `true`, the node corresponds to a computed (`a[b]`) member expression and `property` is an `Expression`. If `computed` is `false`, the node corresponds to a static (`a.b`) member expression and `property` is an `Identifier`. The `optional` flags indicates that the member expression can be called even if the object is null or undefined. If this is the object value (null/undefined) should be returned. +A member expression. If `computed` is `true`, the node corresponds to a computed (`a[b]`) member expression and `property` is an `Expression`. If `computed` is `false`, the node corresponds to a static (`a.b`) member expression and `property` is an `Identifier` or a `PrivateName`. ### BindExpression @@ -966,18 +999,16 @@ interface CallExpression <: Expression { type: "CallExpression"; callee: Expression | Super | Import; arguments: [ Expression | SpreadElement ]; - optional: boolean | null; } ``` -A function or method call expression. +A function or method call expression. When the `callee` is `Import`, the `arguments` must have only one `Expression` element. ## NewExpression ```js interface NewExpression <: CallExpression { type: "NewExpression"; - optional: boolean | null; } ``` @@ -1003,7 +1034,7 @@ interface ParenthesizedExpression <: Expression { } ``` -An expression wrapped by parentheses. +An expression wrapped by parentheses. By default `@babel/parser` does not create this node, unless the `createParenthesizedExpressions: true` option is passed. ## DoExpression @@ -1221,6 +1252,7 @@ interface ImportDeclaration <: ModuleDeclaration { importKind: null | "type" | "typeof" | "value"; specifiers: [ ImportSpecifier | ImportDefaultSpecifier | ImportNamespaceSpecifier ]; source: Literal; + attributes?: [ ImportAttribute ]; } ``` @@ -1259,6 +1291,18 @@ interface ImportNamespaceSpecifier <: ModuleSpecifier { A namespace import specifier, e.g., `* as foo` in `import * as foo from "mod.js"`. +### ImportAttribute + +```js +interface ImportAttribute <: Node { + type: "ImportAttribute"; + key: Identifier; + value: StringLiteral; +} +``` + +An attribute specified on the ImportDeclaration. + ## Exports ### ExportNamedDeclaration @@ -1282,6 +1326,7 @@ _Note: Having `declaration` populated with non-empty `specifiers` or non-null `s interface ExportSpecifier <: ModuleSpecifier { type: "ExportSpecifier"; exported: Identifier; + local?: Identifier; } ``` diff --git a/packages/babel-parser/bin/babel-parser.js b/packages/babel-parser/bin/babel-parser.js index 58f00b845c0c..3aca314533b3 100755 --- a/packages/babel-parser/bin/babel-parser.js +++ b/packages/babel-parser/bin/babel-parser.js @@ -7,10 +7,9 @@ var fs = require("fs"); var filename = process.argv[2]; if (!filename) { console.error("no filename specified"); - process.exit(0); -} - -var file = fs.readFileSync(filename, "utf8"); -var ast = parser.parse(file); +} else { + var file = fs.readFileSync(filename, "utf8"); + var ast = parser.parse(file); -console.log(JSON.stringify(ast, null, " ")); + console.log(JSON.stringify(ast, null, " ")); +} diff --git a/packages/babel-parser/package.json b/packages/babel-parser/package.json index 5fa40c1ff68c..7c5606d56a20 100644 --- a/packages/babel-parser/package.json +++ b/packages/babel-parser/package.json @@ -1,12 +1,12 @@ { "name": "@babel/parser", - "version": "7.5.5", + "version": "7.9.4", "description": "A JavaScript parser", "author": "Sebastian McKenzie ", "homepage": "https://babeljs.io/", "license": "MIT", "publishConfig": { - "tag": "next" + "access": "public" }, "keywords": [ "babel", @@ -28,10 +28,10 @@ "node": ">=6.0.0" }, "devDependencies": { - "@babel/code-frame": "^7.5.5", - "@babel/helper-fixtures": "^7.5.5", - "charcodes": "^0.2.0", - "unicode-12.0.0": "^0.7.9" + "@babel/code-frame": "^7.8.3", + "@babel/helper-fixtures": "^7.8.6", + "@babel/helper-validator-identifier": "^7.9.0", + "charcodes": "^0.2.0" }, "bin": { "parser": "./bin/babel-parser.js" diff --git a/packages/babel-parser/src/index.js b/packages/babel-parser/src/index.js index d9f812695545..3e9696b858fc 100755 --- a/packages/babel-parser/src/index.js +++ b/packages/babel-parser/src/index.js @@ -25,15 +25,32 @@ export function parse(input: string, options?: Options): File { const parser = getParser(options, input); const ast = parser.parse(); - // Rather than try to parse as a script first, we opt to parse as a module and convert back - // to a script where possible to avoid having to do a full re-parse of the input content. - if (!parser.sawUnambiguousESM) ast.program.sourceType = "script"; + if (parser.sawUnambiguousESM) { + return ast; + } + + if (parser.ambiguousScriptDifferentAst) { + // Top level await introduces code which can be both a valid script and + // a valid module, but which produces different ASTs: + // await + // 0 + // can be parsed either as an AwaitExpression, or as two ExpressionStatements. + try { + options.sourceType = "script"; + return getParser(options, input).parse(); + } catch {} + } else { + // This is both a valid module and a valid script, but + // we parse it as a script by default + ast.program.sourceType = "script"; + } + return ast; } catch (moduleError) { try { options.sourceType = "script"; return getParser(options, input).parse(); - } catch (scriptError) {} + } catch {} throw moduleError; } diff --git a/packages/babel-parser/src/options.js b/packages/babel-parser/src/options.js index 8b030847f970..eb4dd6789605 100755 --- a/packages/babel-parser/src/options.js +++ b/packages/babel-parser/src/options.js @@ -21,6 +21,7 @@ export type Options = { ranges: boolean, tokens: boolean, createParenthesizedExpressions: boolean, + errorRecovery: boolean, }; export const defaultOptions: Options = { @@ -62,6 +63,9 @@ export const defaultOptions: Options = { // Whether to create ParenthesizedExpression AST nodes (if false // the parser sets extra.parenthesized on the expression nodes instead). createParenthesizedExpressions: false, + // When enabled, errors are attached to the AST instead of being directly thrown. + // Some errors will still throw, because @babel/parser can't always recover. + errorRecovery: false, }; // Interpret and default an options object diff --git a/packages/babel-parser/src/parser/base.js b/packages/babel-parser/src/parser/base.js index 1e451794158c..6edb7ef063ae 100644 --- a/packages/babel-parser/src/parser/base.js +++ b/packages/babel-parser/src/parser/base.js @@ -4,15 +4,20 @@ import type { Options } from "../options"; import type State from "../tokenizer/state"; import type { PluginsMap } from "./index"; import type ScopeHandler from "../util/scope"; +import type ClassScopeHandler from "../util/class-scope"; +import type ProductionParameterHandler from "../util/production-parameter"; export default class BaseParser { // Properties set by constructor in index.js options: Options; inModule: boolean; scope: ScopeHandler<*>; + classScope: ClassScopeHandler; + prodParam: ProductionParameterHandler; plugins: PluginsMap; filename: ?string; sawUnambiguousESM: boolean = false; + ambiguousScriptDifferentAst: boolean = false; // Initialized by Tokenizer state: State; diff --git a/packages/babel-parser/src/parser/comments.js b/packages/babel-parser/src/parser/comments.js index 7f6b6e2de6e2..bf936d2dce10 100644 --- a/packages/babel-parser/src/parser/comments.js +++ b/packages/babel-parser/src/parser/comments.js @@ -38,6 +38,68 @@ export default class CommentsParser extends BaseParser { this.state.leadingComments.push(comment); } + adjustCommentsAfterTrailingComma( + node: Node, + elements: (Node | null)[], + // When the current node is followed by a token which hasn't a respective AST node, we + // need to take all the trailing comments to prevent them from being attached to an + // unrelated node. e.g. in + // var { x } /* cmt */ = { y } + // we don't want /* cmt */ to be attached to { y }. + // On the other hand, in + // fn(x) [new line] /* cmt */ [new line] y + // /* cmt */ is both a trailing comment of fn(x) and a leading comment of y + takeAllComments?: boolean, + ) { + if (this.state.leadingComments.length === 0) { + return; + } + + let lastElement = null; + let i = elements.length; + while (lastElement === null && i > 0) { + lastElement = elements[--i]; + } + if (lastElement === null) { + return; + } + + for (let j = 0; j < this.state.leadingComments.length; j++) { + if ( + this.state.leadingComments[j].end < this.state.commentPreviousNode.end + ) { + this.state.leadingComments.splice(j, 1); + j--; + } + } + + const newTrailingComments = []; + for (let i = 0; i < this.state.leadingComments.length; i++) { + const leadingComment = this.state.leadingComments[i]; + if (leadingComment.end < node.end) { + newTrailingComments.push(leadingComment); + + // Perf: we don't need to splice if we are going to reset the array anyway + if (!takeAllComments) { + this.state.leadingComments.splice(i, 1); + i--; + } + } else { + if (node.trailingComments === undefined) { + node.trailingComments = []; + } + node.trailingComments.push(leadingComment); + } + } + if (takeAllComments) this.state.leadingComments = []; + + if (newTrailingComments.length > 0) { + lastElement.trailingComments = newTrailingComments; + } else if (lastElement.trailingComments !== undefined) { + lastElement.trailingComments = []; + } + } + processComment(node: Node): void { if (node.type === "Program" && node.body.length > 0) return; @@ -84,60 +146,37 @@ export default class CommentsParser extends BaseParser { if (!lastChild && firstChild) lastChild = firstChild; - // Attach comments that follow a trailing comma on the last - // property in an object literal or a trailing comma in function arguments - // as trailing comments - if (firstChild && this.state.leadingComments.length > 0) { - const lastComment = last(this.state.leadingComments); - - if (firstChild.type === "ObjectProperty") { - if (lastComment.start >= node.start) { - if (this.state.commentPreviousNode) { - for (j = 0; j < this.state.leadingComments.length; j++) { - if ( - this.state.leadingComments[j].end < - this.state.commentPreviousNode.end - ) { - this.state.leadingComments.splice(j, 1); - j--; - } - } - - if (this.state.leadingComments.length > 0) { - firstChild.trailingComments = this.state.leadingComments; - this.state.leadingComments = []; - } - } - } - } else if ( - node.type === "CallExpression" && - node.arguments && - node.arguments.length - ) { - const lastArg = last(node.arguments); - - if ( - lastArg && - lastComment.start >= lastArg.start && - lastComment.end <= node.end - ) { - if (this.state.commentPreviousNode) { - for (j = 0; j < this.state.leadingComments.length; j++) { - if ( - this.state.leadingComments[j].end < - this.state.commentPreviousNode.end - ) { - this.state.leadingComments.splice(j, 1); - j--; - } - } - if (this.state.leadingComments.length > 0) { - lastArg.trailingComments = this.state.leadingComments; - this.state.leadingComments = []; - } - } - } + // Adjust comments that follow a trailing comma on the last element in a + // comma separated list of nodes to be the trailing comments on the last + // element + if (firstChild) { + switch (node.type) { + case "ObjectExpression": + this.adjustCommentsAfterTrailingComma(node, node.properties); + break; + case "ObjectPattern": + this.adjustCommentsAfterTrailingComma(node, node.properties, true); + break; + case "CallExpression": + this.adjustCommentsAfterTrailingComma(node, node.arguments); + break; + case "ArrayExpression": + this.adjustCommentsAfterTrailingComma(node, node.elements); + break; + case "ArrayPattern": + this.adjustCommentsAfterTrailingComma(node, node.elements, true); + break; } + } else if ( + this.state.commentPreviousNode && + ((this.state.commentPreviousNode.type === "ImportSpecifier" && + node.type !== "ImportSpecifier") || + (this.state.commentPreviousNode.type === "ExportSpecifier" && + node.type !== "ExportSpecifier")) + ) { + this.adjustCommentsAfterTrailingComma(node, [ + this.state.commentPreviousNode, + ]); } if (lastChild) { diff --git a/packages/babel-parser/src/parser/expression.js b/packages/babel-parser/src/parser/expression.js index 9b48c7129e2f..06999c46f24b 100644 --- a/packages/babel-parser/src/parser/expression.js +++ b/packages/babel-parser/src/parser/expression.js @@ -19,6 +19,7 @@ // [opp]: http://en.wikipedia.org/wiki/Operator-precedence_parser import { types as tt, type TokenType } from "../tokenizer/types"; +import { types as ct } from "../tokenizer/context"; import * as N from "../types"; import LValParser from "./lval"; import { @@ -32,25 +33,29 @@ import * as charCodes from "charcodes"; import { BIND_OUTSIDE, BIND_VAR, - functionFlags, SCOPE_ARROW, SCOPE_CLASS, SCOPE_DIRECT_SUPER, + SCOPE_FUNCTION, SCOPE_SUPER, SCOPE_PROGRAM, } from "../util/scopeflags"; - -const unwrapParenthesizedExpression = node => { - return node.type === "ParenthesizedExpression" - ? unwrapParenthesizedExpression(node.expression) - : node; -}; +import { ExpressionErrors } from "./util"; +import { + PARAM_AWAIT, + PARAM_RETURN, + PARAM, + functionFlags, +} from "../util/production-parameter"; +import { Errors } from "./location"; export default class ExpressionParser extends LValParser { // Forward-declaration: defined in statement.js + /*:: +parseBlock: ( allowDirectives?: boolean, createNewLexicalScope?: boolean, + afterBlockParse?: (hasStrictModeDirective: boolean) => void, ) => N.BlockStatement; +parseClass: ( node: N.Class, @@ -66,15 +71,16 @@ export default class ExpressionParser extends LValParser { ) => T; +parseFunctionParams: (node: N.Function, allowModifiers?: boolean) => void; +takeDecorators: (node: N.HasDecorators) => void; + */ - // Check if property name clashes with already added. - // Object/class getters and setters are not allowed to clash — - // either with each other or with an init property — and in - // strict mode, init properties are also not allowed to be repeated. + // Check if property __proto__ has been used more than once. + // If the expression is a destructuring assignment, then __proto__ may appear + // multiple times. Otherwise, __proto__ is a duplicated key. - checkPropClash( + checkDuplicatedProto( prop: N.ObjectMember | N.SpreadElement, - propHash: { [key: string]: boolean }, + protoRef: { used: boolean }, + refExpressionErrors: ?ExpressionErrors, ): void { if ( prop.type === "SpreadElement" || @@ -91,22 +97,37 @@ export default class ExpressionParser extends LValParser { const name = key.type === "Identifier" ? key.name : String(key.value); if (name === "__proto__") { - if (propHash.proto) { - this.raise(key.start, "Redefinition of __proto__ property"); + if (protoRef.used) { + if (refExpressionErrors) { + // Store the first redefinition's position, otherwise ignore because + // we are parsing ambiguous pattern + if (refExpressionErrors.doubleProto === -1) { + refExpressionErrors.doubleProto = key.start; + } + } else { + this.raise(key.start, Errors.DuplicateProto); + } } - propHash.proto = true; + + protoRef.used = true; } } // Convenience method to parse an Expression only getExpression(): N.Expression { + let paramFlags = PARAM; + if (this.hasPlugin("topLevelAwait") && this.inModule) { + paramFlags |= PARAM_AWAIT; + } this.scope.enter(SCOPE_PROGRAM); + this.prodParam.enter(paramFlags); this.nextToken(); const expr = this.parseExpression(); if (!this.match(tt.eof)) { this.unexpected(); } expr.comments = this.state.comments; + expr.errors = this.state.errors; return expr; } @@ -118,24 +139,31 @@ export default class ExpressionParser extends LValParser { // and, *if* the syntactic construct they handle is present, wrap // the AST node that the inner parser gave them in another node. - // Parse a full expression. The optional arguments are used to - // forbid the `in` operator (in for loops initialization expressions) - // and provide reference for storing '=' operator inside shorthand - // property assignment in contexts where both object expression - // and object pattern might appear (so it's possible to raise - // delayed syntax error at correct position). - - parseExpression(noIn?: boolean, refShorthandDefaultPos?: Pos): N.Expression { + // Parse a full expression. + // - `noIn` + // is used to forbid the `in` operator (in for loops initialization expressions) + // When `noIn` is true, the production parameter [In] is not present. + // Whenever [?In] appears in the right-hand sides of a production, we pass + // `noIn` to the subroutine calls. + + // - `refExpressionErrors ` + // provides reference for storing '=' operator inside shorthand + // property assignment in contexts where both object expression + // and object pattern might appear (so it's possible to raise + // delayed syntax error at correct position). + + parseExpression( + noIn?: boolean, + refExpressionErrors?: ExpressionErrors, + ): N.Expression { const startPos = this.state.start; const startLoc = this.state.startLoc; - const expr = this.parseMaybeAssign(noIn, refShorthandDefaultPos); + const expr = this.parseMaybeAssign(noIn, refExpressionErrors); if (this.match(tt.comma)) { const node = this.startNodeAt(startPos, startLoc); node.expressions = [expr]; while (this.eat(tt.comma)) { - node.expressions.push( - this.parseMaybeAssign(noIn, refShorthandDefaultPos), - ); + node.expressions.push(this.parseMaybeAssign(noIn, refExpressionErrors)); } this.toReferencedList(node.expressions); return this.finishNode(node, "SequenceExpression"); @@ -148,14 +176,14 @@ export default class ExpressionParser extends LValParser { parseMaybeAssign( noIn?: ?boolean, - refShorthandDefaultPos?: ?Pos, + refExpressionErrors?: ?ExpressionErrors, afterLeftParse?: Function, refNeedsArrowPos?: ?Pos, ): N.Expression { const startPos = this.state.start; const startLoc = this.state.startLoc; if (this.isContextual("yield")) { - if (this.scope.inGenerator) { + if (this.prodParam.hasYield) { let left = this.parseYield(noIn); if (afterLeftParse) { left = afterLeftParse.call(this, left, startPos, startLoc); @@ -168,15 +196,12 @@ export default class ExpressionParser extends LValParser { } } - const oldCommaAfterSpreadAt = this.state.commaAfterSpreadAt; - this.state.commaAfterSpreadAt = -1; - - let failOnShorthandAssign; - if (refShorthandDefaultPos) { - failOnShorthandAssign = false; + let ownExpressionErrors; + if (refExpressionErrors) { + ownExpressionErrors = false; } else { - refShorthandDefaultPos = { start: 0 }; - failOnShorthandAssign = true; + refExpressionErrors = new ExpressionErrors(); + ownExpressionErrors = true; } if (this.match(tt.parenL) || this.match(tt.name)) { @@ -185,7 +210,7 @@ export default class ExpressionParser extends LValParser { let left = this.parseMaybeConditional( noIn, - refShorthandDefaultPos, + refExpressionErrors, refNeedsArrowPos, ); if (afterLeftParse) { @@ -197,51 +222,31 @@ export default class ExpressionParser extends LValParser { node.operator = operator; if (operator === "??=") { - this.expectPlugin("nullishCoalescingOperator"); this.expectPlugin("logicalAssignment"); } if (operator === "||=" || operator === "&&=") { this.expectPlugin("logicalAssignment"); } - node.left = this.match(tt.eq) - ? this.toAssignable(left, undefined, "assignment expression") - : left; - refShorthandDefaultPos.start = 0; // reset because shorthand default was used correctly - - this.checkLVal(left, undefined, undefined, "assignment expression"); - - const maybePattern = unwrapParenthesizedExpression(left); - - let patternErrorMsg; - if (maybePattern.type === "ObjectPattern") { - patternErrorMsg = "`({a}) = 0` use `({a} = 0)`"; - } else if (maybePattern.type === "ArrayPattern") { - patternErrorMsg = "`([a]) = 0` use `([a] = 0)`"; + if (this.match(tt.eq)) { + node.left = this.toAssignable(left); + refExpressionErrors.doubleProto = -1; // reset because double __proto__ is valid in assignment expression + } else { + node.left = left; } - if ( - patternErrorMsg && - ((left.extra && left.extra.parenthesized) || - left.type === "ParenthesizedExpression") - ) { - this.raise( - maybePattern.start, - `You're trying to assign to a parenthesized expression, eg. instead of ${patternErrorMsg}`, - ); + if (refExpressionErrors.shorthandAssign >= node.left.start) { + refExpressionErrors.shorthandAssign = -1; // reset because shorthand default was used correctly } - if (patternErrorMsg) this.checkCommaAfterRestFromSpread(); - this.state.commaAfterSpreadAt = oldCommaAfterSpreadAt; + this.checkLVal(left, undefined, undefined, "assignment expression"); this.next(); node.right = this.parseMaybeAssign(noIn); return this.finishNode(node, "AssignmentExpression"); - } else if (failOnShorthandAssign && refShorthandDefaultPos.start) { - this.unexpected(refShorthandDefaultPos.start); + } else if (ownExpressionErrors) { + this.checkExpressionErrors(refExpressionErrors, true); } - this.state.commaAfterSpreadAt = oldCommaAfterSpreadAt; - return left; } @@ -249,13 +254,13 @@ export default class ExpressionParser extends LValParser { parseMaybeConditional( noIn: ?boolean, - refShorthandDefaultPos: Pos, + refExpressionErrors: ExpressionErrors, refNeedsArrowPos?: ?Pos, ): N.Expression { const startPos = this.state.start; const startLoc = this.state.startLoc; const potentialArrowAt = this.state.potentialArrowAt; - const expr = this.parseExprOps(noIn, refShorthandDefaultPos); + const expr = this.parseExprOps(noIn, refExpressionErrors); if ( expr.type === "ArrowFunctionExpression" && @@ -263,7 +268,7 @@ export default class ExpressionParser extends LValParser { ) { return expr; } - if (refShorthandDefaultPos && refShorthandDefaultPos.start) return expr; + if (this.checkExpressionErrors(refExpressionErrors, false)) return expr; return this.parseConditional( expr, @@ -296,11 +301,14 @@ export default class ExpressionParser extends LValParser { // Start the precedence parser. - parseExprOps(noIn: ?boolean, refShorthandDefaultPos: Pos): N.Expression { + parseExprOps( + noIn: ?boolean, + refExpressionErrors: ExpressionErrors, + ): N.Expression { const startPos = this.state.start; const startLoc = this.state.startLoc; const potentialArrowAt = this.state.potentialArrowAt; - const expr = this.parseMaybeUnary(refShorthandDefaultPos); + const expr = this.parseMaybeUnary(refExpressionErrors); if ( expr.type === "ArrowFunctionExpression" && @@ -308,7 +316,7 @@ export default class ExpressionParser extends LValParser { ) { return expr; } - if (refShorthandDefaultPos && refShorthandDefaultPos.start) { + if (this.checkExpressionErrors(refExpressionErrors, false)) { return expr; } @@ -328,7 +336,7 @@ export default class ExpressionParser extends LValParser { minPrec: number, noIn: ?boolean, ): N.Expression { - const prec = this.state.type.binop; + let prec = this.state.type.binop; if (prec != null && (!noIn || !this.match(tt._in))) { if (prec > minPrec) { const operator = this.state.value; @@ -346,18 +354,22 @@ export default class ExpressionParser extends LValParser { ) { this.raise( left.argument.start, - "Illegal expression. Wrap left hand side or entire exponentiation in parentheses.", + Errors.UnexpectedTokenUnaryExponentiation, ); } const op = this.state.type; + const logical = op === tt.logicalOR || op === tt.logicalAND; + const coalesce = op === tt.nullishCoalescing; if (op === tt.pipeline) { this.expectPlugin("pipelineOperator"); this.state.inPipeline = true; this.checkPipelineAtInfixOperator(left, leftStartPos); - } else if (op === tt.nullishCoalescing) { - this.expectPlugin("nullishCoalescingOperator"); + } else if (coalesce) { + // Handle the precedence of `tt.coalesce` as equal to the range of logical expressions. + // In other words, `node.right` shouldn't contain logical expressions in order to check the mixed error. + prec = ((tt.logicalAND: any): { binop: number }).binop; } this.next(); @@ -369,25 +381,32 @@ export default class ExpressionParser extends LValParser { if ( this.match(tt.name) && this.state.value === "await" && - this.scope.inAsync + this.prodParam.hasAwait ) { throw this.raise( this.state.start, - `Unexpected "await" after pipeline body; await must have parentheses in minimal proposal`, + Errors.UnexpectedAwaitAfterPipelineBody, ); } } node.right = this.parseExprOpRightExpr(op, prec, noIn); - this.finishNode( node, - op === tt.logicalOR || - op === tt.logicalAND || - op === tt.nullishCoalescing - ? "LogicalExpression" - : "BinaryExpression", + logical || coalesce ? "LogicalExpression" : "BinaryExpression", ); + /* this check is for all ?? operators + * a ?? b && c for this example + * when op is coalesce and nextOp is logical (&&), throw at the pos of nextOp that it can not be mixed. + * Symmetrically it also throws when op is logical and nextOp is coalesce + */ + const nextOp = this.state.type; + if ( + (coalesce && (nextOp === tt.logicalOR || nextOp === tt.logicalAND)) || + (logical && nextOp === tt.nullishCoalescing) + ) { + throw this.raise(this.state.start, Errors.MixingCoalesceWithLogical); + } return this.parseExprOp( node, @@ -456,12 +475,8 @@ export default class ExpressionParser extends LValParser { // Parse unary operators, both prefix and postfix. - parseMaybeUnary(refShorthandDefaultPos: ?Pos): N.Expression { - if ( - this.isContextual("await") && - (this.scope.inAsync || - (!this.scope.inFunction && this.options.allowAwaitOutsideFunction)) - ) { + parseMaybeUnary(refExpressionErrors: ?ExpressionErrors): N.Expression { + if (this.isContextual("await") && this.isAwaitAllowed()) { return this.parseAwait(); } else if (this.state.type.prefix) { const node = this.startNode(); @@ -476,9 +491,7 @@ export default class ExpressionParser extends LValParser { node.argument = this.parseMaybeUnary(); - if (refShorthandDefaultPos && refShorthandDefaultPos.start) { - this.unexpected(refShorthandDefaultPos.start); - } + this.checkExpressionErrors(refExpressionErrors, true); if (update) { this.checkLVal(node.argument, undefined, undefined, "prefix operation"); @@ -486,12 +499,12 @@ export default class ExpressionParser extends LValParser { const arg = node.argument; if (arg.type === "Identifier") { - this.raise(node.start, "Deleting local variable in strict mode"); + this.raise(node.start, Errors.StrictDelete); } else if ( arg.type === "MemberExpression" && arg.property.type === "PrivateName" ) { - this.raise(node.start, "Deleting a private field is not allowed"); + this.raise(node.start, Errors.DeletePrivateField); } } @@ -503,8 +516,8 @@ export default class ExpressionParser extends LValParser { const startPos = this.state.start; const startLoc = this.state.startLoc; - let expr = this.parseExprSubscripts(refShorthandDefaultPos); - if (refShorthandDefaultPos && refShorthandDefaultPos.start) return expr; + let expr = this.parseExprSubscripts(refExpressionErrors); + if (this.checkExpressionErrors(refExpressionErrors, false)) return expr; while (this.state.type.postfix && !this.canInsertSemicolon()) { const node = this.startNodeAt(startPos, startLoc); node.operator = this.state.value; @@ -519,11 +532,11 @@ export default class ExpressionParser extends LValParser { // Parse call, dot, and `[]`-subscript expressions. - parseExprSubscripts(refShorthandDefaultPos: ?Pos): N.Expression { + parseExprSubscripts(refExpressionErrors: ?ExpressionErrors): N.Expression { const startPos = this.state.start; const startLoc = this.state.startLoc; const potentialArrowAt = this.state.potentialArrowAt; - const expr = this.parseExprAtom(refShorthandDefaultPos); + const expr = this.parseExprAtom(refExpressionErrors); if ( expr.type === "ArrowFunctionExpression" && @@ -532,10 +545,6 @@ export default class ExpressionParser extends LValParser { return expr; } - if (refShorthandDefaultPos && refShorthandDefaultPos.start) { - return expr; - } - return this.parseSubscripts(expr, startPos, startLoc); } @@ -545,21 +554,21 @@ export default class ExpressionParser extends LValParser { startLoc: Position, noCalls?: ?boolean, ): N.Expression { - const maybeAsyncArrow = this.atPossibleAsync(base); - const state = { optionalChainMember: false, + maybeAsyncArrow: this.atPossibleAsyncArrow(base), stop: false, }; do { - base = this.parseSubscript( - base, - startPos, - startLoc, - noCalls, - state, - maybeAsyncArrow, - ); + const oldMaybeInAsyncArrowHead = this.state.maybeInAsyncArrowHead; + if (state.maybeAsyncArrow) { + this.state.maybeInAsyncArrowHead = true; + } + base = this.parseSubscript(base, startPos, startLoc, noCalls, state); + + // After parsing a subscript, this isn't "async" for sure. + state.maybeAsyncArrow = false; + this.state.maybeInAsyncArrowHead = oldMaybeInAsyncArrowHead; } while (!state.stop); return base; } @@ -574,7 +583,6 @@ export default class ExpressionParser extends LValParser { startLoc: Position, noCalls: ?boolean, state: N.ParseSubscriptState, - maybeAsyncArrow: boolean, ): N.Expression { if (!noCalls && this.eat(tt.doubleColon)) { const node = this.startNodeAt(startPos, startLoc); @@ -587,90 +595,81 @@ export default class ExpressionParser extends LValParser { startLoc, noCalls, ); - } else if (this.match(tt.questionDot)) { - this.expectPlugin("optionalChaining"); - state.optionalChainMember = true; - if (noCalls && this.lookahead().type === tt.parenL) { + } + let optional = false; + if (this.match(tt.questionDot)) { + state.optionalChainMember = optional = true; + if (noCalls && this.lookaheadCharCode() === charCodes.leftParenthesis) { state.stop = true; return base; } this.next(); - + } + const computed = this.eat(tt.bracketL); + if ( + (optional && !this.match(tt.parenL) && !this.match(tt.backQuote)) || + computed || + this.eat(tt.dot) + ) { const node = this.startNodeAt(startPos, startLoc); + node.object = base; + node.property = computed + ? this.parseExpression() + : optional + ? this.parseIdentifier(true) + : this.parseMaybePrivateName(true); + node.computed = computed; + + if (node.property.type === "PrivateName") { + if (node.object.type === "Super") { + this.raise(startPos, Errors.SuperPrivateField); + } + this.classScope.usePrivateName( + node.property.id.name, + node.property.start, + ); + } - if (this.eat(tt.bracketL)) { - node.object = base; - node.property = this.parseExpression(); - node.computed = true; - node.optional = true; + if (computed) { this.expect(tt.bracketR); - return this.finishNode(node, "OptionalMemberExpression"); - } else if (this.eat(tt.parenL)) { - node.callee = base; - node.arguments = this.parseCallExpressionArguments(tt.parenR, false); - node.optional = true; - return this.finishNode(node, "OptionalCallExpression"); - } else { - node.object = base; - node.property = this.parseIdentifier(true); - node.computed = false; - node.optional = true; - return this.finishNode(node, "OptionalMemberExpression"); } - } else if (this.eat(tt.dot)) { - const node = this.startNodeAt(startPos, startLoc); - node.object = base; - node.property = this.parseMaybePrivateName(); - node.computed = false; - if (state.optionalChainMember) { - node.optional = false; - return this.finishNode(node, "OptionalMemberExpression"); - } - return this.finishNode(node, "MemberExpression"); - } else if (this.eat(tt.bracketL)) { - const node = this.startNodeAt(startPos, startLoc); - node.object = base; - node.property = this.parseExpression(); - node.computed = true; - this.expect(tt.bracketR); + if (state.optionalChainMember) { - node.optional = false; + node.optional = optional; return this.finishNode(node, "OptionalMemberExpression"); + } else { + return this.finishNode(node, "MemberExpression"); } - return this.finishNode(node, "MemberExpression"); } else if (!noCalls && this.match(tt.parenL)) { const oldMaybeInArrowParameters = this.state.maybeInArrowParameters; const oldYieldPos = this.state.yieldPos; const oldAwaitPos = this.state.awaitPos; this.state.maybeInArrowParameters = true; - this.state.yieldPos = 0; - this.state.awaitPos = 0; + this.state.yieldPos = -1; + this.state.awaitPos = -1; this.next(); let node = this.startNodeAt(startPos, startLoc); node.callee = base; - const oldCommaAfterSpreadAt = this.state.commaAfterSpreadAt; - this.state.commaAfterSpreadAt = -1; - - node.arguments = this.parseCallExpressionArguments( - tt.parenR, - maybeAsyncArrow, - base.type === "Import", - base.type !== "Super", - ); - if (!state.optionalChainMember) { - this.finishCallExpression(node); + if (optional) { + node.optional = true; + node.arguments = this.parseCallExpressionArguments(tt.parenR, false); } else { - this.finishOptionalCallExpression(node); + node.arguments = this.parseCallExpressionArguments( + tt.parenR, + state.maybeAsyncArrow, + base.type === "Import", + base.type !== "Super", + node, + ); } + this.finishCallExpression(node, state.optionalChainMember); - if (maybeAsyncArrow && this.shouldParseAsyncArrow()) { + if (state.maybeAsyncArrow && this.shouldParseAsyncArrow() && !optional) { state.stop = true; - this.checkCommaAfterRestFromSpread(); - node = this.parseAsyncArrowFromCallExpression( this.startNodeAt(startPos, startLoc), node, @@ -683,12 +682,37 @@ export default class ExpressionParser extends LValParser { // We keep the old value if it isn't null, for cases like // (x = async(yield)) => {} - this.state.yieldPos = oldYieldPos || this.state.yieldPos; - this.state.awaitPos = oldAwaitPos || this.state.awaitPos; + // + // Hi developer of the future :) If you are implementing generator + // arrow functions, please read the note below about "await" and + // verify if the same logic is needed for yield. + if (oldYieldPos !== -1) this.state.yieldPos = oldYieldPos; + + // Await is trickier than yield. When parsing a possible arrow function + // (e.g. something starting with `async(`) we don't know if its possible + // parameters will actually be inside an async arrow function or if it is + // a normal call expression. + // If it ended up being a call expression, if we are in a context where + // await expression are disallowed (and thus "await" is an identifier) + // we must be careful not to leak this.state.awaitPos to an even outer + // context, where "await" could not be an identifier. + // For example, this code is valid because "await" isn't directly inside + // an async function: + // + // async function a() { + // function b(param = async (await)) { + // } + // } + // + if ( + (!this.isAwaitAllowed() && !oldMaybeInArrowParameters) || + oldAwaitPos !== -1 + ) { + this.state.awaitPos = oldAwaitPos; + } } this.state.maybeInArrowParameters = oldMaybeInArrowParameters; - this.state.commaAfterSpreadAt = oldCommaAfterSpreadAt; return node; } else if (this.match(tt.backQuote)) { @@ -719,50 +743,41 @@ export default class ExpressionParser extends LValParser { node.quasi = this.parseTemplate(true); if (typeArguments) node.typeParameters = typeArguments; if (state.optionalChainMember) { - this.raise( - startPos, - "Tagged Template Literals are not allowed in optionalChain", - ); + this.raise(startPos, Errors.OptionalChainingNoTemplate); } return this.finishNode(node, "TaggedTemplateExpression"); } - atPossibleAsync(base: N.Expression): boolean { + atPossibleAsyncArrow(base: N.Expression): boolean { return ( base.type === "Identifier" && base.name === "async" && this.state.lastTokEnd === base.end && !this.canInsertSemicolon() && - this.input.slice(base.start, base.end) === "async" + // check there are no escape sequences, such as \u{61}sync + base.end - base.start === 5 && + base.start === this.state.potentialArrowAt ); } - finishCallExpression(node: N.CallExpression): N.CallExpression { - if (node.callee.type === "Import") { - if (node.arguments.length !== 1) { - this.raise(node.start, "import() requires exactly one argument"); - } - - const importArg = node.arguments[0]; - if (importArg && importArg.type === "SpreadElement") { - this.raise(importArg.start, "... is not allowed in import()"); - } - } - return this.finishNode(node, "CallExpression"); - } - - finishOptionalCallExpression(node: N.CallExpression): N.CallExpression { + finishCallExpression( + node: T, + optional: boolean, + ): N.Expression { if (node.callee.type === "Import") { if (node.arguments.length !== 1) { - this.raise(node.start, "import() requires exactly one argument"); - } - - const importArg = node.arguments[0]; - if (importArg && importArg.type === "SpreadElement") { - this.raise(importArg.start, "... is not allowed in import()"); + this.raise(node.start, Errors.ImportCallArity); + } else { + const importArg = node.arguments[0]; + if (importArg && importArg.type === "SpreadElement") { + this.raise(importArg.start, Errors.ImportCallSpreadArgument); + } } } - return this.finishNode(node, "OptionalCallExpression"); + return this.finishNode( + node, + optional ? "OptionalCallExpression" : "CallExpression", + ); } parseCallExpressionArguments( @@ -770,6 +785,7 @@ export default class ExpressionParser extends LValParser { possibleAsyncArrow: boolean, dynamicImport?: boolean, allowPlaceholder?: boolean, + nodeForExtra?: ?N.Node, ): $ReadOnlyArray { const elts = []; let innerParenStart; @@ -782,13 +798,21 @@ export default class ExpressionParser extends LValParser { first = false; } else { this.expect(tt.comma); - if (this.eat(close)) { + if (this.match(close)) { if (dynamicImport) { this.raise( this.state.lastTokStart, - "Trailing comma is disallowed inside import(...) arguments", + Errors.ImportCallArgumentTrailingComma, + ); + } + if (nodeForExtra) { + this.addExtra( + nodeForExtra, + "trailingComma", + this.state.lastTokStart, ); } + this.next(); break; } } @@ -802,7 +826,7 @@ export default class ExpressionParser extends LValParser { elts.push( this.parseExprListItem( false, - possibleAsyncArrow ? { start: 0 } : undefined, + possibleAsyncArrow ? new ExpressionErrors() : undefined, possibleAsyncArrow ? { start: 0 } : undefined, allowPlaceholder, ), @@ -828,7 +852,12 @@ export default class ExpressionParser extends LValParser { call: N.CallExpression, ): N.ArrowFunctionExpression { this.expect(tt.arrow); - this.parseArrowExpression(node, call.arguments, true); + this.parseArrowExpression( + node, + call.arguments, + true, + call.extra?.trailingComma, + ); return node; } @@ -845,7 +874,7 @@ export default class ExpressionParser extends LValParser { // `new`, or an expression wrapped in punctuation like `()`, `[]`, // or `{}`. - parseExprAtom(refShorthandDefaultPos?: ?Pos): N.Expression { + parseExprAtom(refExpressionErrors?: ?ExpressionErrors): N.Expression { // If a division operator appears in an expression position, the // tokenizer got confused, and we force it to read a regexp instead. if (this.state.type === tt.slash) this.readRegexp(); @@ -855,13 +884,6 @@ export default class ExpressionParser extends LValParser { switch (this.state.type) { case tt._super: - if (!this.scope.allowSuper && !this.options.allowSuperOutsideMethod) { - this.raise( - this.state.start, - "super is only allowed in object methods and classes", - ); - } - node = this.startNode(); this.next(); if ( @@ -869,11 +891,12 @@ export default class ExpressionParser extends LValParser { !this.scope.allowDirectSuper && !this.options.allowSuperOutsideMethod ) { - this.raise( - node.start, - "super() is only valid inside a class constructor of a subclass. " + - "Maybe a typo in the method name ('constructor') or not extending another class?", - ); + this.raise(node.start, Errors.SuperNotAllowed); + } else if ( + !this.scope.allowSuper && + !this.options.allowSuperOutsideMethod + ) { + this.raise(node.start, Errors.UnexpectedSuper); } if ( @@ -881,7 +904,7 @@ export default class ExpressionParser extends LValParser { !this.match(tt.bracketL) && !this.match(tt.dot) ) { - this.unexpected(); + this.raise(node.start, Errors.UnsupportedSuper); } return this.finishNode(node, "Super"); @@ -894,10 +917,8 @@ export default class ExpressionParser extends LValParser { return this.parseImportMetaProperty(node); } - this.expectPlugin("dynamicImport", node.start); - if (!this.match(tt.parenL)) { - this.unexpected(null, tt.parenL); + this.raise(this.state.lastTokStart, Errors.UnsupportedImport); } return this.finishNode(node, "Import"); case tt._this: @@ -916,6 +937,19 @@ export default class ExpressionParser extends LValParser { this.match(tt._function) && !this.canInsertSemicolon() ) { + const last = this.state.context.length - 1; + if (this.state.context[last] !== ct.functionStatement) { + // Since "async" is an identifier and normally identifiers + // can't be followed by expression, the tokenizer assumes + // that "function" starts a statement. + // Fixing it in the tokenizer would mean tracking not only the + // previous token ("async"), but also the one before to know + // its beforeExpr value. + // It's easier and more efficient to adjust the context here. + throw new Error("Internal error"); + } + this.state.context[last] = ct.functionExpression; + this.next(); return this.parseFunction(node, undefined, true); } else if ( @@ -925,8 +959,21 @@ export default class ExpressionParser extends LValParser { this.match(tt.name) && !this.canInsertSemicolon() ) { + const oldMaybeInArrowParameters = this.state.maybeInArrowParameters; + const oldMaybeInAsyncArrowHead = this.state.maybeInAsyncArrowHead; + const oldYieldPos = this.state.yieldPos; + const oldAwaitPos = this.state.awaitPos; + this.state.maybeInArrowParameters = true; + this.state.maybeInAsyncArrowHead = true; + this.state.yieldPos = -1; + this.state.awaitPos = -1; const params = [this.parseIdentifier()]; this.expect(tt.arrow); + this.checkYieldAwaitInDefaultParams(); + this.state.maybeInArrowParameters = oldMaybeInArrowParameters; + this.state.maybeInAsyncArrowHead = oldMaybeInAsyncArrowHead; + this.state.yieldPos = oldYieldPos; + this.state.awaitPos = oldAwaitPos; // let foo = async bar => {}; this.parseArrowExpression(node, params, true); return node; @@ -981,6 +1028,25 @@ export default class ExpressionParser extends LValParser { case tt.parenL: return this.parseParenAndDistinguishExpression(canBeArrow); + case tt.bracketBarL: + case tt.bracketHashL: { + this.expectPlugin("recordAndTuple"); + const oldInFSharpPipelineDirectBody = this.state + .inFSharpPipelineDirectBody; + const close = + this.state.type === tt.bracketBarL ? tt.bracketBarR : tt.bracketR; + this.state.inFSharpPipelineDirectBody = false; + node = this.startNode(); + this.next(); + node.elements = this.parseExprList( + close, + true, + refExpressionErrors, + node, + ); + this.state.inFSharpPipelineDirectBody = oldInFSharpPipelineDirectBody; + return this.finishNode(node, "TupleExpression"); + } case tt.bracketL: { const oldInFSharpPipelineDirectBody = this.state .inFSharpPipelineDirectBody; @@ -990,7 +1056,8 @@ export default class ExpressionParser extends LValParser { node.elements = this.parseExprList( tt.bracketR, true, - refShorthandDefaultPos, + refExpressionErrors, + node, ); if (!this.state.maybeInArrowParameters) { // This could be an array pattern: @@ -1003,11 +1070,23 @@ export default class ExpressionParser extends LValParser { this.state.inFSharpPipelineDirectBody = oldInFSharpPipelineDirectBody; return this.finishNode(node, "ArrayExpression"); } + case tt.braceBarL: + case tt.braceHashL: { + this.expectPlugin("recordAndTuple"); + const oldInFSharpPipelineDirectBody = this.state + .inFSharpPipelineDirectBody; + const close = + this.state.type === tt.braceBarL ? tt.braceBarR : tt.braceR; + this.state.inFSharpPipelineDirectBody = false; + const ret = this.parseObj(close, false, true, refExpressionErrors); + this.state.inFSharpPipelineDirectBody = oldInFSharpPipelineDirectBody; + return ret; + } case tt.braceL: { const oldInFSharpPipelineDirectBody = this.state .inFSharpPipelineDirectBody; this.state.inFSharpPipelineDirectBody = false; - const ret = this.parseObj(false, refShorthandDefaultPos); + const ret = this.parseObj(tt.braceR, false, false, refExpressionErrors); this.state.inFSharpPipelineDirectBody = oldInFSharpPipelineDirectBody; return ret; } @@ -1016,7 +1095,7 @@ export default class ExpressionParser extends LValParser { case tt.at: this.parseDecorators(); - + // fall through case tt._class: node = this.startNode(); this.takeDecorators(node); @@ -1036,10 +1115,7 @@ export default class ExpressionParser extends LValParser { if (callee.type === "MemberExpression") { return this.finishNode(node, "BindExpression"); } else { - throw this.raise( - callee.start, - "Binding should be performed on object property.", - ); + throw this.raise(callee.start, Errors.UnsupportedBind); } } @@ -1050,25 +1126,20 @@ export default class ExpressionParser extends LValParser { if ( this.getPluginOption("pipelineOperator", "proposal") !== "smart" ) { - this.raise( - node.start, - "Primary Topic Reference found but pipelineOperator not passed 'smart' for 'proposal' option.", - ); + this.raise(node.start, Errors.PrimaryTopicRequiresSmartPipeline); } this.next(); - if (this.primaryTopicReferenceIsAllowedInCurrentTopicContext()) { - this.registerTopicReference(); - return this.finishNode(node, "PipelinePrimaryTopicReference"); - } else { - throw this.raise( - node.start, - `Topic reference was used in a lexical context without topic binding`, - ); + + if (!this.primaryTopicReferenceIsAllowedInCurrentTopicContext()) { + this.raise(node.start, Errors.PrimaryTopicNotAllowed); } + + this.registerTopicReference(); + return this.finishNode(node, "PipelinePrimaryTopicReference"); } } - + // fall through default: throw this.unexpected(); } @@ -1081,11 +1152,16 @@ export default class ExpressionParser extends LValParser { return this.finishNode(node, "BooleanLiteral"); } - parseMaybePrivateName(): N.PrivateName | N.Identifier { + parseMaybePrivateName( + isPrivateNameAllowed: boolean, + ): N.PrivateName | N.Identifier { const isPrivate = this.match(tt.hash); if (isPrivate) { this.expectOnePlugin(["classPrivateProperties", "classPrivateMethods"]); + if (!isPrivateNameAllowed) { + this.raise(this.state.pos, Errors.UnexpectedPrivateField); + } const node = this.startNode(); this.next(); this.assertNoSpace("Unexpected space between # and identifier"); @@ -1108,7 +1184,7 @@ export default class ExpressionParser extends LValParser { this.next(); meta = this.createIdentifier(meta, "function"); - if (this.scope.inGenerator && this.eat(tt.dot)) { + if (this.prodParam.hasYield && this.eat(tt.dot)) { return this.parseMetaProperty(node, meta, "sent"); } return this.parseFunction(node); @@ -1137,9 +1213,9 @@ export default class ExpressionParser extends LValParser { if (node.property.name !== propertyName || containsEsc) { this.raise( node.property.start, - `The only valid meta property for ${meta.name} is ${ - meta.name - }.${propertyName}`, + Errors.UnsupportedMetaProperty, + meta.name, + propertyName, ); } @@ -1152,21 +1228,18 @@ export default class ExpressionParser extends LValParser { if (this.isContextual("meta")) { this.expectPlugin("importMeta"); - } else if (!this.hasPlugin("importMeta")) { - this.raise( - id.start, - `Dynamic imports require a parameter: import('a.js')`, - ); - } - if (!this.inModule) { - this.raise( - id.start, - `import.meta may appear only with 'sourceType: "module"'`, - { code: "BABEL_PARSER_SOURCETYPE_MODULE_REQUIRED" }, - ); + if (!this.inModule) { + this.raiseWithData( + id.start, + { code: "BABEL_PARSER_SOURCETYPE_MODULE_REQUIRED" }, + Errors.ImportMetaOutsideModule, + ); + } + this.sawUnambiguousESM = true; + } else if (!this.hasPlugin("importMeta")) { + this.raise(id.start, Errors.ImportCallArityLtOne); } - this.sawUnambiguousESM = true; return this.parseMetaProperty(node, id, "meta"); } @@ -1200,14 +1273,14 @@ export default class ExpressionParser extends LValParser { const oldAwaitPos = this.state.awaitPos; const oldInFSharpPipelineDirectBody = this.state.inFSharpPipelineDirectBody; this.state.maybeInArrowParameters = true; - this.state.yieldPos = 0; - this.state.awaitPos = 0; + this.state.yieldPos = -1; + this.state.awaitPos = -1; this.state.inFSharpPipelineDirectBody = false; const innerStartPos = this.state.start; const innerStartLoc = this.state.startLoc; const exprList = []; - const refShorthandDefaultPos = { start: 0 }; + const refExpressionErrors = new ExpressionErrors(); const refNeedsArrowPos = { start: 0 }; let first = true; let spreadStart; @@ -1236,14 +1309,14 @@ export default class ExpressionParser extends LValParser { ), ); - this.checkCommaAfterRest(); + this.checkCommaAfterRest(charCodes.rightParenthesis); break; } else { exprList.push( this.parseMaybeAssign( false, - refShorthandDefaultPos, + refExpressionErrors, this.parseParenItem, refNeedsArrowPos, ), @@ -1264,6 +1337,9 @@ export default class ExpressionParser extends LValParser { this.shouldParseArrow() && (arrowNode = this.parseArrow(arrowNode)) ) { + if (!this.isAwaitAllowed() && !this.state.maybeInAsyncArrowHead) { + this.state.awaitPos = oldAwaitPos; + } this.checkYieldAwaitInDefaultParams(); this.state.yieldPos = oldYieldPos; this.state.awaitPos = oldAwaitPos; @@ -1279,17 +1355,15 @@ export default class ExpressionParser extends LValParser { // We keep the old value if it isn't null, for cases like // (x = (yield)) => {} - this.state.yieldPos = oldYieldPos || this.state.yieldPos; - this.state.awaitPos = oldAwaitPos || this.state.awaitPos; + if (oldYieldPos !== -1) this.state.yieldPos = oldYieldPos; + if (oldAwaitPos !== -1) this.state.awaitPos = oldAwaitPos; if (!exprList.length) { this.unexpected(this.state.lastTokStart); } if (optionalCommaStart) this.unexpected(optionalCommaStart); if (spreadStart) this.unexpected(spreadStart); - if (refShorthandDefaultPos.start) { - this.unexpected(refShorthandDefaultPos.start); - } + this.checkExpressionErrors(refExpressionErrors, true); if (refNeedsArrowPos.start) this.unexpected(refNeedsArrowPos.start); this.toReferencedListDeep(exprList, /* isParenthesizedExpr */ true); @@ -1339,13 +1413,16 @@ export default class ExpressionParser extends LValParser { parseNew(): N.NewExpression | N.MetaProperty { const node = this.startNode(); - const meta = this.parseIdentifier(true); + + let meta = this.startNode(); + this.next(); + meta = this.createIdentifier(meta, "new"); if (this.eat(tt.dot)) { const metaProp = this.parseMetaProperty(node, meta, "target"); - if (!this.scope.inNonArrowFunction && !this.state.inClassProperty) { - let error = "new.target can only be used in functions"; + if (!this.scope.inNonArrowFunction && !this.scope.inClass) { + let error = Errors.UnexpectedNewTarget; if (this.hasPlugin("classProperties")) { error += " or class properties"; @@ -1360,20 +1437,14 @@ export default class ExpressionParser extends LValParser { node.callee = this.parseNoCallExpr(); if (node.callee.type === "Import") { - this.raise(node.callee.start, "Cannot use new with import(...)"); + this.raise(node.callee.start, Errors.ImportCallNotNewExpression); } else if ( node.callee.type === "OptionalMemberExpression" || node.callee.type === "OptionalCallExpression" ) { - this.raise( - this.state.lastTokEnd, - "constructors in/after an Optional Chain are not allowed", - ); + this.raise(this.state.lastTokEnd, Errors.OptionalChainingNoNew); } else if (this.eat(tt.questionDot)) { - this.raise( - this.state.start, - "constructors in/after an Optional Chain are not allowed", - ); + this.raise(this.state.start, Errors.OptionalChainingNoNew); } this.parseNewArguments(node); @@ -1397,13 +1468,7 @@ export default class ExpressionParser extends LValParser { const elem = this.startNode(); if (this.state.value === null) { if (!isTagged) { - // TODO: fix this - this.raise( - this.state.invalidTemplateEscapePosition || 0, - "Invalid escape sequence in template", - ); - } else { - this.state.invalidTemplateEscapePosition = null; + this.raise(this.state.start + 1, Errors.InvalidEscapeSequenceTemplate); } } elem.value = { @@ -1433,11 +1498,13 @@ export default class ExpressionParser extends LValParser { return this.finishNode(node, "TemplateLiteral"); } - // Parse an object literal or binding pattern. + // Parse an object literal, binding pattern, or record. parseObj( + close: TokenType, isPattern: boolean, - refShorthandDefaultPos?: ?Pos, + isRecord?: ?boolean, + refExpressionErrors?: ?ExpressionErrors, ): T { const propHash: any = Object.create(null); let first = true; @@ -1446,17 +1513,23 @@ export default class ExpressionParser extends LValParser { node.properties = []; this.next(); - while (!this.eat(tt.braceR)) { + while (!this.eat(close)) { if (first) { first = false; } else { this.expect(tt.comma); - if (this.eat(tt.braceR)) break; + if (this.match(close)) { + this.addExtra(node, "trailingComma", this.state.lastTokStart); + this.next(); + break; + } } - const prop = this.parseObjectMember(isPattern, refShorthandDefaultPos); - // $FlowIgnore RestElement will never be returned if !isPattern - if (!isPattern) this.checkPropClash(prop, propHash); + const prop = this.parseObjectMember(isPattern, refExpressionErrors); + if (!isPattern) { + // $FlowIgnore RestElement will never be returned if !isPattern + this.checkDuplicatedProto(prop, propHash, refExpressionErrors); + } // $FlowIgnore if (prop.shorthand) { @@ -1466,10 +1539,13 @@ export default class ExpressionParser extends LValParser { node.properties.push(prop); } - return this.finishNode( - node, - isPattern ? "ObjectPattern" : "ObjectExpression", - ); + let type = "ObjectExpression"; + if (isPattern) { + type = "ObjectPattern"; + } else if (isRecord) { + type = "RecordExpression"; + } + return this.finishNode(node, type); } isAsyncProp(prop: N.ObjectProperty): boolean { @@ -1489,21 +1565,18 @@ export default class ExpressionParser extends LValParser { parseObjectMember( isPattern: boolean, - refShorthandDefaultPos: ?Pos, + refExpressionErrors?: ?ExpressionErrors, ): N.ObjectMember | N.SpreadElement | N.RestElement { let decorators = []; if (this.match(tt.at)) { if (this.hasPlugin("decorators")) { - this.raise( - this.state.start, - "Stage 2 decorators disallow object literal property decorators", - ); - } else { - // we needn't check if decorators (stage 0) plugin is enabled since it's checked by - // the call to this.parseDecorator - while (this.match(tt.at)) { - decorators.push(this.parseDecorator()); - } + this.raise(this.state.start, Errors.UnsupportedPropertyDecorator); + } + + // we needn't check if decorators (stage 0) plugin is enabled since it's checked by + // the call to this.parseDecorator + while (this.match(tt.at)) { + decorators.push(this.parseDecorator()); } } @@ -1519,7 +1592,7 @@ export default class ExpressionParser extends LValParser { this.next(); // Don't use parseRestBinding() as we only allow Identifier here. prop.argument = this.parseIdentifier(); - this.checkCommaAfterRest(); + this.checkCommaAfterRest(charCodes.rightCurlyBrace); return this.finishNode(prop, "RestElement"); } @@ -1533,7 +1606,7 @@ export default class ExpressionParser extends LValParser { prop.method = false; - if (isPattern || refShorthandDefaultPos) { + if (isPattern || refExpressionErrors) { startPos = this.state.start; startLoc = this.state.startLoc; } @@ -1543,12 +1616,12 @@ export default class ExpressionParser extends LValParser { } const containsEsc = this.state.containsEsc; - this.parsePropertyName(prop); + this.parsePropertyName(prop, /* isPrivateNameAllowed */ false); if (!isPattern && !containsEsc && !isGenerator && this.isAsyncProp(prop)) { isAsync = true; isGenerator = this.eat(tt.star); - this.parsePropertyName(prop); + this.parsePropertyName(prop, /* isPrivateNameAllowed */ false); } else { isAsync = false; } @@ -1560,7 +1633,7 @@ export default class ExpressionParser extends LValParser { isGenerator, isAsync, isPattern, - refShorthandDefaultPos, + refExpressionErrors, containsEsc, ); @@ -1594,9 +1667,9 @@ export default class ExpressionParser extends LValParser { const start = method.start; if (method.params.length !== paramCount) { if (method.kind === "get") { - this.raise(start, "getter must not have any formal parameters"); + this.raise(start, Errors.BadGetterArity); } else { - this.raise(start, "setter must have exactly one formal parameter"); + this.raise(start, Errors.BadSetterArity); } } @@ -1604,10 +1677,7 @@ export default class ExpressionParser extends LValParser { method.kind === "set" && method.params[method.params.length - 1].type === "RestElement" ) { - this.raise( - start, - "setter function argument must not be a rest parameter", - ); + this.raise(start, Errors.BadSetterRestParameter); } } @@ -1635,7 +1705,7 @@ export default class ExpressionParser extends LValParser { if (!containsEsc && this.isGetterOrSetterMethod(prop, isPattern)) { if (isGenerator || isAsync) this.unexpected(); prop.kind = prop.key.name; - this.parsePropertyName(prop); + this.parsePropertyName(prop, /* isPrivateNameAllowed */ false); this.parseMethod( prop, /* isGenerator */ false, @@ -1654,14 +1724,14 @@ export default class ExpressionParser extends LValParser { startPos: ?number, startLoc: ?Position, isPattern: boolean, - refShorthandDefaultPos: ?Pos, + refExpressionErrors: ?ExpressionErrors, ): ?N.ObjectProperty { prop.shorthand = false; if (this.eat(tt.colon)) { prop.value = isPattern ? this.parseMaybeDefault(this.state.start, this.state.startLoc) - : this.parseMaybeAssign(false, refShorthandDefaultPos); + : this.parseMaybeAssign(false, refExpressionErrors); return this.finishNode(prop, "ObjectProperty"); } @@ -1675,9 +1745,9 @@ export default class ExpressionParser extends LValParser { startLoc, prop.key.__clone(), ); - } else if (this.match(tt.eq) && refShorthandDefaultPos) { - if (!refShorthandDefaultPos.start) { - refShorthandDefaultPos.start = this.state.start; + } else if (this.match(tt.eq) && refExpressionErrors) { + if (refExpressionErrors.shorthandAssign === -1) { + refExpressionErrors.shorthandAssign = this.state.start; } prop.value = this.parseMaybeDefault( startPos, @@ -1700,7 +1770,7 @@ export default class ExpressionParser extends LValParser { isGenerator: boolean, isAsync: boolean, isPattern: boolean, - refShorthandDefaultPos: ?Pos, + refExpressionErrors?: ?ExpressionErrors, containsEsc: boolean, ): void { const node = @@ -1716,7 +1786,7 @@ export default class ExpressionParser extends LValParser { startPos, startLoc, isPattern, - refShorthandDefaultPos, + refExpressionErrors, ); if (!node) this.unexpected(); @@ -1727,6 +1797,7 @@ export default class ExpressionParser extends LValParser { parsePropertyName( prop: N.ObjectOrClassMember | N.ClassMember | N.TsNamedTypeElementBase, + isPrivateNameAllowed: boolean, ): N.Expression | N.Identifier { if (this.eat(tt.bracketL)) { (prop: $FlowSubtype).computed = true; @@ -1737,9 +1808,9 @@ export default class ExpressionParser extends LValParser { this.state.inPropertyName = true; // We check if it's valid for it to be a private name when we push it. (prop: $FlowFixMe).key = - this.match(tt.num) || this.match(tt.string) + this.match(tt.num) || this.match(tt.string) || this.match(tt.bigint) ? this.parseExprAtom() - : this.parseMaybePrivateName(); + : this.parseMaybePrivateName(isPrivateNameAllowed); if (prop.key.type !== "PrivateName") { // ClassPrivateProperty is never computed, so we don't assign in that case. @@ -1773,21 +1844,22 @@ export default class ExpressionParser extends LValParser { ): T { const oldYieldPos = this.state.yieldPos; const oldAwaitPos = this.state.awaitPos; - this.state.yieldPos = 0; - this.state.awaitPos = 0; + this.state.yieldPos = -1; + this.state.awaitPos = -1; this.initFunction(node, isAsync); node.generator = !!isGenerator; const allowModifiers = isConstructor; // For TypeScript parameter properties this.scope.enter( - functionFlags(isAsync, node.generator) | + SCOPE_FUNCTION | SCOPE_SUPER | (inClassScope ? SCOPE_CLASS : 0) | (allowDirectSuper ? SCOPE_DIRECT_SUPER : 0), ); + this.prodParam.enter(functionFlags(isAsync, node.generator)); this.parseFunctionParams((node: any), allowModifiers); - this.checkYieldAwaitInDefaultParams(); this.parseFunctionBodyAndFinish(node, type, true); + this.prodParam.exit(); this.scope.exit(); this.state.yieldPos = oldYieldPos; @@ -1803,20 +1875,25 @@ export default class ExpressionParser extends LValParser { node: N.ArrowFunctionExpression, params: ?(N.Expression[]), isAsync: boolean, + trailingCommaPos: ?number, ): N.ArrowFunctionExpression { - this.scope.enter(functionFlags(isAsync, false) | SCOPE_ARROW); + this.scope.enter(SCOPE_FUNCTION | SCOPE_ARROW); + this.prodParam.enter(functionFlags(isAsync, false)); this.initFunction(node, isAsync); - const oldMaybeInArrowParameters = this.state.maybeInArrowParameters; const oldYieldPos = this.state.yieldPos; const oldAwaitPos = this.state.awaitPos; - this.state.maybeInArrowParameters = false; - this.state.yieldPos = 0; - this.state.awaitPos = 0; - if (params) this.setArrowFunctionParameters(node, params); + if (params) { + this.state.maybeInArrowParameters = true; + this.setArrowFunctionParameters(node, params, trailingCommaPos); + } + this.state.maybeInArrowParameters = false; + this.state.yieldPos = -1; + this.state.awaitPos = -1; this.parseFunctionBody(node, true); + this.prodParam.exit(); this.scope.exit(); this.state.maybeInArrowParameters = oldMaybeInArrowParameters; this.state.yieldPos = oldYieldPos; @@ -1828,26 +1905,9 @@ export default class ExpressionParser extends LValParser { setArrowFunctionParameters( node: N.ArrowFunctionExpression, params: N.Expression[], + trailingCommaPos: ?number, ): void { - node.params = this.toAssignableList( - params, - true, - "arrow function parameters", - ); - } - - isStrictBody(node: { body: N.BlockStatement }): boolean { - const isBlockStatement = node.body.type === "BlockStatement"; - - if (isBlockStatement && node.body.directives.length) { - for (const directive of node.body.directives) { - if (directive.value.value === "use strict") { - return true; - } - } - } - - return false; + node.params = this.toAssignableList(params, trailingCommaPos); } parseFunctionBodyAndFinish( @@ -1867,59 +1927,70 @@ export default class ExpressionParser extends LValParser { isMethod?: boolean = false, ): void { const isExpression = allowExpression && !this.match(tt.braceL); - const oldStrict = this.state.strict; - let useStrict = false; - const oldInParameters = this.state.inParameters; this.state.inParameters = false; if (isExpression) { node.body = this.parseMaybeAssign(); - this.checkParams(node, false, allowExpression); + this.checkParams(node, false, allowExpression, false); } else { - const nonSimple = !this.isSimpleParamList(node.params); - if (!oldStrict || nonSimple) { - useStrict = this.strictDirective(this.state.end); - // If this is a strict mode function, verify that argument names - // are not repeated, and it does not try to bind the words `eval` - // or `arguments`. - if (useStrict && nonSimple) { - // This logic is here to align the error location with the estree plugin - const errorPos = - // $FlowIgnore - (node.kind === "method" || node.kind === "constructor") && - // $FlowIgnore - !!node.key - ? node.key.end - : node.start; - this.raise( - errorPos, - "Illegal 'use strict' directive in function with non-simple parameter list", - ); - } - } + const oldStrict = this.state.strict; // Start a new scope with regard to labels // flag (restore them to their old value afterwards). const oldLabels = this.state.labels; this.state.labels = []; - if (useStrict) this.state.strict = true; - // Add the params to varDeclaredNames to ensure that an error is thrown - // if a let/const declaration in the function clashes with one of the params. - this.checkParams( - node, - !oldStrict && !useStrict && !allowExpression && !isMethod && !nonSimple, - allowExpression, + + // FunctionBody[Yield, Await]: + // StatementList[?Yield, ?Await, +Return] opt + this.prodParam.enter(this.prodParam.currentFlags() | PARAM_RETURN); + node.body = this.parseBlock( + true, + false, + // Strict mode function checks after we parse the statements in the function body. + (hasStrictModeDirective: boolean) => { + const nonSimple = !this.isSimpleParamList(node.params); + + if (hasStrictModeDirective && nonSimple) { + // This logic is here to align the error location with the ESTree plugin. + const errorPos = + // $FlowIgnore + (node.kind === "method" || node.kind === "constructor") && + // $FlowIgnore + !!node.key + ? node.key.end + : node.start; + this.raise(errorPos, Errors.IllegalLanguageModeDirective); + } + + const strictModeChanged = !oldStrict && this.state.strict; + + // Add the params to varDeclaredNames to ensure that an error is thrown + // if a let/const declaration in the function clashes with one of the params. + this.checkParams( + node, + !this.state.strict && !allowExpression && !isMethod && !nonSimple, + allowExpression, + strictModeChanged, + ); + + // Ensure the function name isn't a forbidden identifier in strict mode, e.g. 'eval' + if (this.state.strict && node.id) { + this.checkLVal( + node.id, + BIND_OUTSIDE, + undefined, + "function name", + undefined, + strictModeChanged, + ); + } + }, ); - node.body = this.parseBlock(true, false); + this.prodParam.exit(); this.state.labels = oldLabels; } this.state.inParameters = oldInParameters; - // Ensure the function name isn't a forbidden identifier in strict mode, e.g. 'eval' - if (this.state.strict && node.id) { - this.checkLVal(node.id, BIND_OUTSIDE, undefined, "function name"); - } - this.state.strict = oldStrict; } isSimpleParamList( @@ -1936,6 +2007,7 @@ export default class ExpressionParser extends LValParser { allowDuplicates: boolean, // eslint-disable-next-line no-unused-vars isArrowFunction: ?boolean, + strictModeChanged?: boolean = true, ): void { // $FlowIssue const nameHash: {} = Object.create(null); @@ -1944,7 +2016,9 @@ export default class ExpressionParser extends LValParser { node.params[i], BIND_VAR, allowDuplicates ? null : nameHash, - "function paramter list", + "function parameter list", + undefined, + strictModeChanged, ); } } @@ -1958,7 +2032,8 @@ export default class ExpressionParser extends LValParser { parseExprList( close: TokenType, allowEmpty?: boolean, - refShorthandDefaultPos?: ?Pos, + refExpressionErrors?: ?ExpressionErrors, + nodeForExtra?: ?N.Node, ): $ReadOnlyArray { const elts = []; let first = true; @@ -1968,17 +2043,27 @@ export default class ExpressionParser extends LValParser { first = false; } else { this.expect(tt.comma); - if (this.eat(close)) break; + if (this.match(close)) { + if (nodeForExtra) { + this.addExtra( + nodeForExtra, + "trailingComma", + this.state.lastTokStart, + ); + } + this.next(); + break; + } } - elts.push(this.parseExprListItem(allowEmpty, refShorthandDefaultPos)); + elts.push(this.parseExprListItem(allowEmpty, refExpressionErrors)); } return elts; } parseExprListItem( allowEmpty: ?boolean, - refShorthandDefaultPos: ?Pos, + refExpressionErrors?: ?ExpressionErrors, refNeedsArrowPos: ?Pos, allowPlaceholder: ?boolean, ): ?N.Expression { @@ -1989,14 +2074,14 @@ export default class ExpressionParser extends LValParser { const spreadNodeStartPos = this.state.start; const spreadNodeStartLoc = this.state.startLoc; elt = this.parseParenItem( - this.parseSpread(refShorthandDefaultPos, refNeedsArrowPos), + this.parseSpread(refExpressionErrors, refNeedsArrowPos), spreadNodeStartPos, spreadNodeStartLoc, ); } else if (this.match(tt.question)) { this.expectPlugin("partialApplication"); if (!allowPlaceholder) { - this.raise(this.state.start, "Unexpected argument placeholder"); + this.raise(this.state.start, Errors.UnexpectedArgumentPlaceholder); } const node = this.startNode(); this.next(); @@ -2004,7 +2089,7 @@ export default class ExpressionParser extends LValParser { } else { elt = this.parseMaybeAssign( false, - refShorthandDefaultPos, + refExpressionErrors, this.parseParenItem, refNeedsArrowPos, ); @@ -2015,6 +2100,8 @@ export default class ExpressionParser extends LValParser { // Parse the next token as an identifier. If `liberal` is true (used // when parsing properties), it will also convert keywords into // identifiers. + // This shouldn't be used to parse the keywords of meta properties, since they + // are not identifiers and cannot contain escape sequences. parseIdentifier(liberal?: boolean): N.Identifier { const node = this.startNode(); @@ -2038,23 +2125,25 @@ export default class ExpressionParser extends LValParser { } else if (this.state.type.keyword) { name = this.state.type.keyword; - // `class` and `function` keywords push new context into this.context. + // `class` and `function` keywords push function-type token context into this.context. // But there is no chance to pop the context if the keyword is consumed // as an identifier such as a property name. - // If the previous token is a dot, this does not apply because the - // context-managing code already ignored the keyword + const context = this.state.context; if ( (name === "class" || name === "function") && - (this.state.lastTokEnd !== this.state.lastTokStart + 1 || - this.input.charCodeAt(this.state.lastTokStart) !== charCodes.dot) + context[context.length - 1].token === "function" ) { - this.state.context.pop(); + context.pop(); } } else { throw this.unexpected(); } - if (!liberal) { + if (liberal) { + // If the current token is not used as a keyword, set its type to "tt.name". + // This will prevent this.next() from throwing about unexpected escapes. + this.state.type = tt.name; + } else { this.checkReservedWord( name, this.state.start, @@ -2074,28 +2163,35 @@ export default class ExpressionParser extends LValParser { checkKeywords: boolean, isBinding: boolean, ): void { - if (this.scope.inGenerator && word === "yield") { - this.raise( - startLoc, - "Can not use 'yield' as identifier inside a generator", - ); + if (this.prodParam.hasYield && word === "yield") { + this.raise(startLoc, Errors.YieldBindingIdentifier); + return; } - if (this.scope.inAsync && word === "await") { - this.raise( - startLoc, - "Can not use 'await' as identifier inside an async function", - ); + if (word === "await") { + if (this.prodParam.hasAwait) { + this.raise(startLoc, Errors.AwaitBindingIdentifier); + return; + } + if ( + this.state.awaitPos === -1 && + (this.state.maybeInAsyncArrowHead || this.isAwaitAllowed()) + ) { + this.state.awaitPos = this.state.start; + } } - if (this.state.inClassProperty && word === "arguments") { - this.raise( - startLoc, - "'arguments' is not allowed in class field initializer", - ); + if ( + this.scope.inClass && + !this.scope.inNonArrowFunction && + word === "arguments" + ) { + this.raise(startLoc, Errors.ArgumentsDisallowedInInitializer); + return; } if (checkKeywords && isKeyword(word)) { - this.raise(startLoc, `Unexpected keyword '${word}'`); + this.raise(startLoc, Errors.UnexpectedKeyword, word); + return; } const reservedTest = !this.state.strict @@ -2105,62 +2201,85 @@ export default class ExpressionParser extends LValParser { : isStrictReservedWord; if (reservedTest(word, this.inModule)) { - if (!this.scope.inAsync && word === "await") { - this.raise( - startLoc, - "Can not use keyword 'await' outside an async function", - ); + if (!this.prodParam.hasAwait && word === "await") { + this.raise(startLoc, Errors.AwaitNotInAsyncFunction); + } else { + this.raise(startLoc, Errors.UnexpectedReservedWord, word); } - this.raise(startLoc, `Unexpected reserved word '${word}'`); } } + isAwaitAllowed(): boolean { + if (this.scope.inFunction) return this.prodParam.hasAwait; + if (this.options.allowAwaitOutsideFunction) return true; + if (this.hasPlugin("topLevelAwait")) { + return this.inModule && this.prodParam.hasAwait; + } + return false; + } + // Parses await expression inside async function. parseAwait(): N.AwaitExpression { - if (!this.state.awaitPos) { - this.state.awaitPos = this.state.start; - } const node = this.startNode(); this.next(); if (this.state.inParameters) { - this.raise( - node.start, - "await is not allowed in async function parameters", - ); + this.raise(node.start, Errors.AwaitExpressionFormalParameter); + } else if (this.state.awaitPos === -1) { + this.state.awaitPos = node.start; } - if (this.match(tt.star)) { - this.raise( - node.start, - "await* has been removed from the async functions proposal. Use Promise.all() instead.", - ); + if (this.eat(tt.star)) { + this.raise(node.start, Errors.ObsoleteAwaitStar); + } + + if (!this.scope.inFunction && !this.options.allowAwaitOutsideFunction) { + if ( + this.hasPrecedingLineBreak() || + // All the following expressions are ambiguous: + // await + 0, await - 0, await ( 0 ), await [ 0 ], await / 0 /u, await `` + this.match(tt.plusMin) || + this.match(tt.parenL) || + this.match(tt.bracketL) || + this.match(tt.backQuote) || + // Sometimes the tokenizer generates tt.slash for regexps, and this is + // handler by parseExprAtom + this.match(tt.regexp) || + this.match(tt.slash) || + // This code could be parsed both as a modulo operator or as an intrinsic: + // await %x(0) + (this.hasPlugin("v8intrinsic") && this.match(tt.modulo)) + ) { + this.ambiguousScriptDifferentAst = true; + } else { + this.sawUnambiguousESM = true; + } } if (!this.state.soloAwait) { node.argument = this.parseMaybeUnary(); } + return this.finishNode(node, "AwaitExpression"); } // Parses yield expression inside generator. parseYield(noIn?: ?boolean): N.YieldExpression { - if (!this.state.yieldPos) { - this.state.yieldPos = this.state.start; - } const node = this.startNode(); if (this.state.inParameters) { - this.raise(node.start, "yield is not allowed in generator parameters"); + this.raise(node.start, Errors.YieldInParameter); + } else if (this.state.yieldPos === -1) { + this.state.yieldPos = node.start; } this.next(); if ( this.match(tt.semi) || (!this.match(tt.star) && !this.state.type.startsExpr) || - this.canInsertSemicolon() + this.hasPrecedingLineBreak() ) { node.delegate = false; node.argument = null; @@ -2179,10 +2298,7 @@ export default class ExpressionParser extends LValParser { if (left.type === "SequenceExpression") { // Ensure that the pipeline head is not a comma-delimited // sequence expression. - throw this.raise( - leftStartPos, - `Pipeline head should not be a comma-separated sequence expression`, - ); + this.raise(leftStartPos, Errors.PipelineHeadSequenceExpression); } } } @@ -2216,18 +2332,12 @@ export default class ExpressionParser extends LValParser { if (this.match(tt.arrow)) { // If the following token is invalidly `=>`, then throw a human-friendly error // instead of something like 'Unexpected token, expected ";"'. - throw this.raise( - this.state.start, - `Unexpected arrow "=>" after pipeline body; arrow function in pipeline body must be parenthesized`, - ); + throw this.raise(this.state.start, Errors.PipelineBodyNoArrow); } else if ( pipelineStyle === "PipelineTopicExpression" && childExpression.type === "SequenceExpression" ) { - throw this.raise( - startPos, - `Pipeline body may not be a comma-separated sequence expression`, - ); + this.raise(startPos, Errors.PipelineBodySequenceExpression); } } @@ -2250,15 +2360,14 @@ export default class ExpressionParser extends LValParser { break; case "PipelineTopicExpression": if (!this.topicReferenceWasUsedInCurrentTopicContext()) { - throw this.raise( - startPos, - `Pipeline is in topic style but does not use topic reference`, - ); + this.raise(startPos, Errors.PipelineTopicUnused); } bodyNode.expression = childExpression; break; default: - throw this.raise(startPos, `Unknown pipeline style ${pipelineStyle}`); + throw new Error( + `Internal @babel/parser error: Unknown pipeline style (${pipelineStyle})`, + ); } return this.finishNode(bodyNode, pipelineStyle); } diff --git a/packages/babel-parser/src/parser/index.js b/packages/babel-parser/src/parser/index.js index 9e75bf6044d3..484a2a8076af 100644 --- a/packages/babel-parser/src/parser/index.js +++ b/packages/babel-parser/src/parser/index.js @@ -1,20 +1,27 @@ // @flow import type { Options } from "../options"; -import type { File, JSXOpeningElement } from "../types"; +import type { File /*::, JSXOpeningElement */ } from "../types"; import type { PluginList } from "../plugin-utils"; import { getOptions } from "../options"; import StatementParser from "./statement"; import { SCOPE_PROGRAM } from "../util/scopeflags"; import ScopeHandler from "../util/scope"; +import ClassScopeHandler from "../util/class-scope"; +import ProductionParameterHandler, { + PARAM_AWAIT, + PARAM, +} from "../util/production-parameter"; export type PluginsMap = Map; export default class Parser extends StatementParser { // Forward-declaration so typescript plugin can override jsx plugin + /*:: +jsxParseOpeningElementAfterName: ( node: JSXOpeningElement, ) => JSXOpeningElement; + */ constructor(options: ?Options, input: string) { options = getOptions(options); @@ -25,6 +32,8 @@ export default class Parser extends StatementParser { this.options = options; this.inModule = this.options.sourceType === "module"; this.scope = new ScopeHandler(this.raise.bind(this), this.inModule); + this.prodParam = new ProductionParameterHandler(); + this.classScope = new ClassScopeHandler(this.raise.bind(this)); this.plugins = pluginsMap(this.options.plugins); this.filename = options.sourceFilename; } @@ -35,11 +44,19 @@ export default class Parser extends StatementParser { } parse(): File { + let paramFlags = PARAM; + if (this.hasPlugin("topLevelAwait") && this.inModule) { + paramFlags |= PARAM_AWAIT; + } this.scope.enter(SCOPE_PROGRAM); + this.prodParam.enter(paramFlags); const file = this.startNode(); const program = this.startNode(); this.nextToken(); - return this.parseTopLevel(file, program); + file.errors = null; + this.parseTopLevel(file, program); + file.errors = this.state.errors; + return file; } } diff --git a/packages/babel-parser/src/parser/location.js b/packages/babel-parser/src/parser/location.js index 1839f359ae4c..035bbc7d0452 100644 --- a/packages/babel-parser/src/parser/location.js +++ b/packages/babel-parser/src/parser/location.js @@ -1,5 +1,5 @@ // @flow - +/* eslint sort-keys: "error" */ import { getLineInfo, type Position } from "../util/location"; import CommentsParser from "./comments"; @@ -9,7 +9,202 @@ import CommentsParser from "./comments"; // of the error message, and then raises a `SyntaxError` with that // message. +type ErrorContext = { + pos: number, + loc: Position, + missingPlugin?: Array, + code?: string, +}; + +// The Errors key follows https://cs.chromium.org/chromium/src/v8/src/common/message-template.h unless it does not exist +export const Errors = Object.freeze({ + ArgumentsDisallowedInInitializer: + "'arguments' is not allowed in class field initializer", + AsyncFunctionInSingleStatementContext: + "Async functions can only be declared at the top level or inside a block", + AwaitBindingIdentifier: + "Can not use 'await' as identifier inside an async function", + AwaitExpressionFormalParameter: + "await is not allowed in async function parameters", + AwaitNotInAsyncFunction: + "Can not use keyword 'await' outside an async function", + BadGetterArity: "getter must not have any formal parameters", + BadSetterArity: "setter must have exactly one formal parameter", + BadSetterRestParameter: + "setter function argument must not be a rest parameter", + ConstructorClassField: "Classes may not have a field named 'constructor'", + ConstructorClassPrivateField: + "Classes may not have a private field named '#constructor'", + ConstructorIsAccessor: "Class constructor may not be an accessor", + ConstructorIsAsync: "Constructor can't be an async function", + ConstructorIsGenerator: "Constructor can't be a generator", + DeclarationMissingInitializer: "%0 require an initialization value", + DecoratorBeforeExport: + "Decorators must be placed *before* the 'export' keyword. You can set the 'decoratorsBeforeExport' option to false to use the 'export @decorator class {}' syntax", + DecoratorConstructor: + "Decorators can't be used with a constructor. Did you mean '@dec class { ... }'?", + DecoratorExportClass: + "Using the export keyword between a decorator and a class is not allowed. Please use `export @dec class` instead.", + DecoratorSemicolon: "Decorators must not be followed by a semicolon", + DeletePrivateField: "Deleting a private field is not allowed", + DestructureNamedImport: + "ES2015 named imports do not destructure. Use another statement for destructuring after the import.", + DuplicateConstructor: "Duplicate constructor in the same class", + DuplicateDefaultExport: "Only one default export allowed per module.", + DuplicateExport: + "`%0` has already been exported. Exported identifiers must be unique.", + DuplicateProto: "Redefinition of __proto__ property", + DuplicateRegExpFlags: "Duplicate regular expression flag", + ElementAfterRest: "Rest element must be last element", + EscapedCharNotAnIdentifier: "Invalid Unicode escape", + ForInOfLoopInitializer: + "%0 loop variable declaration may not have an initializer", + GeneratorInSingleStatementContext: + "Generators can only be declared at the top level or inside a block", + IllegalBreakContinue: "Unsyntactic %0", + IllegalLanguageModeDirective: + "Illegal 'use strict' directive in function with non-simple parameter list", + IllegalReturn: "'return' outside of function", + ImportCallArgumentTrailingComma: + "Trailing comma is disallowed inside import(...) arguments", + ImportCallArity: "import() requires exactly one argument", + ImportCallArityLtOne: "Dynamic imports require a parameter: import('a.js')", + ImportCallNotNewExpression: "Cannot use new with import(...)", + ImportCallSpreadArgument: "... is not allowed in import()", + ImportMetaOutsideModule: `import.meta may appear only with 'sourceType: "module"'`, + ImportOutsideModule: `'import' and 'export' may appear only with 'sourceType: "module"'`, + InvalidCodePoint: "Code point out of bounds", + InvalidDigit: "Expected number in radix %0", + InvalidEscapeSequence: "Bad character escape sequence", + InvalidEscapeSequenceTemplate: "Invalid escape sequence in template", + InvalidEscapedReservedWord: "Escape sequence in keyword %0", + InvalidIdentifier: "Invalid identifier %0", + InvalidLhs: "Invalid left-hand side in %0", + InvalidLhsBinding: "Binding invalid left-hand side in %0", + InvalidNumber: "Invalid number", + InvalidOrUnexpectedToken: "Unexpected character '%0'", + InvalidParenthesizedAssignment: "Invalid parenthesized assignment pattern", + InvalidPrivateFieldResolution: "Private name #%0 is not defined", + InvalidPropertyBindingPattern: "Binding member expression", + InvalidRestAssignmentPattern: "Invalid rest operator's argument", + LabelRedeclaration: "Label '%0' is already declared", + LetInLexicalBinding: + "'let' is not allowed to be used as a name in 'let' or 'const' declarations.", + MalformedRegExpFlags: "Invalid regular expression flag", + MissingClassName: "A class name is required", + MissingEqInAssignment: + "Only '=' operator can be used for specifying default value.", + MissingUnicodeEscape: "Expecting Unicode escape sequence \\uXXXX", + MixingCoalesceWithLogical: + "Nullish coalescing operator(??) requires parens when mixing with logical operators", + ModuleExportUndefined: "Export '%0' is not defined", + MultipleDefaultsInSwitch: "Multiple default clauses", + NewlineAfterThrow: "Illegal newline after throw", + NoCatchOrFinally: "Missing catch or finally clause", + NumberIdentifier: "Identifier directly after number", + NumericSeparatorInEscapeSequence: + "Numeric separators are not allowed inside unicode escape sequences or hex escape sequences", + ObsoleteAwaitStar: + "await* has been removed from the async functions proposal. Use Promise.all() instead.", + OptionalChainingNoNew: + "constructors in/after an Optional Chain are not allowed", + OptionalChainingNoTemplate: + "Tagged Template Literals are not allowed in optionalChain", + ParamDupe: "Argument name clash", + PatternHasAccessor: "Object pattern can't contain getter or setter", + PatternHasMethod: "Object pattern can't contain methods", + PipelineBodyNoArrow: + 'Unexpected arrow "=>" after pipeline body; arrow function in pipeline body must be parenthesized', + PipelineBodySequenceExpression: + "Pipeline body may not be a comma-separated sequence expression", + PipelineHeadSequenceExpression: + "Pipeline head should not be a comma-separated sequence expression", + PipelineTopicUnused: + "Pipeline is in topic style but does not use topic reference", + PrimaryTopicNotAllowed: + "Topic reference was used in a lexical context without topic binding", + PrimaryTopicRequiresSmartPipeline: + "Primary Topic Reference found but pipelineOperator not passed 'smart' for 'proposal' option.", + PrivateNameRedeclaration: "Duplicate private name #%0", + RecordExpressionBarIncorrectEndSyntaxType: + "Record expressions ending with '|}' are only allowed when the 'syntaxType' option of the 'recordAndTuple' plugin is set to 'bar'", + RecordExpressionBarIncorrectStartSyntaxType: + "Record expressions starting with '{|' are only allowed when the 'syntaxType' option of the 'recordAndTuple' plugin is set to 'bar'", + RecordExpressionHashIncorrectStartSyntaxType: + "Record expressions starting with '#{' are only allowed when the 'syntaxType' option of the 'recordAndTuple' plugin is set to 'hash'", + RestTrailingComma: "Unexpected trailing comma after rest element", + SloppyFunction: + "In non-strict mode code, functions can only be declared at top level, inside a block, or as the body of an if statement", + StaticPrototype: "Classes may not have static property named prototype", + StrictDelete: "Deleting local variable in strict mode", + StrictEvalArguments: "Assigning to '%0' in strict mode", + StrictEvalArgumentsBinding: "Binding '%0' in strict mode", + StrictFunction: + "In strict mode code, functions can only be declared at top level or inside a block", + StrictOctalLiteral: "Legacy octal literals are not allowed in strict mode", + StrictWith: "'with' in strict mode", + SuperNotAllowed: + "super() is only valid inside a class constructor of a subclass. Maybe a typo in the method name ('constructor') or not extending another class?", + SuperPrivateField: "Private fields can't be accessed on super", + TrailingDecorator: "Decorators must be attached to a class element", + TupleExpressionBarIncorrectEndSyntaxType: + "Tuple expressions ending with '|]' are only allowed when the 'syntaxType' option of the 'recordAndTuple' plugin is set to 'bar'", + TupleExpressionBarIncorrectStartSyntaxType: + "Tuple expressions starting with '[|' are only allowed when the 'syntaxType' option of the 'recordAndTuple' plugin is set to 'bar'", + TupleExpressionHashIncorrectStartSyntaxType: + "Tuple expressions starting with '#[' are only allowed when the 'syntaxType' option of the 'recordAndTuple' plugin is set to 'hash'", + UnexpectedArgumentPlaceholder: "Unexpected argument placeholder", + UnexpectedAwaitAfterPipelineBody: + 'Unexpected "await" after pipeline body; await must have parentheses in minimal proposal', + UnexpectedDigitAfterHash: "Unexpected digit after hash token", + UnexpectedImportExport: + "'import' and 'export' may only appear at the top level", + UnexpectedKeyword: "Unexpected keyword '%0'", + UnexpectedLeadingDecorator: + "Leading decorators must be attached to a class declaration", + UnexpectedLexicalDeclaration: + "Lexical declaration cannot appear in a single-statement context", + UnexpectedNewTarget: "new.target can only be used in functions", + UnexpectedNumericSeparator: + "A numeric separator is only allowed between two digits", + UnexpectedPrivateField: + "Private names can only be used as the name of a class element (i.e. class C { #p = 42; #m() {} } )\n or a property of member expression (i.e. this.#p).", + UnexpectedReservedWord: "Unexpected reserved word '%0'", + UnexpectedSuper: "super is only allowed in object methods and classes", + UnexpectedToken: "Unexpected token '%'", + UnexpectedTokenUnaryExponentiation: + "Illegal expression. Wrap left hand side or entire exponentiation in parentheses.", + UnsupportedBind: "Binding should be performed on object property.", + UnsupportedDecoratorExport: + "A decorated export must export a class declaration", + UnsupportedDefaultExport: + "Only expressions, functions or classes are allowed as the `default` export.", + UnsupportedImport: "import can only be used in import() or import.meta", + UnsupportedMetaProperty: "The only valid meta property for %0 is %0.%1", + UnsupportedParameterDecorator: + "Decorators cannot be used to decorate parameters", + UnsupportedPropertyDecorator: + "Decorators cannot be used to decorate object literal properties", + UnsupportedSuper: + "super can only be used with function calls (i.e. super()) or in property accesses (i.e. super.prop or super[prop])", + UnterminatedComment: "Unterminated comment", + UnterminatedRegExp: "Unterminated regular expression", + UnterminatedString: "Unterminated string constant", + UnterminatedTemplate: "Unterminated template", + VarRedeclaration: "Identifier '%0' has already been declared", + YieldBindingIdentifier: + "Can not use 'yield' as identifier inside a generator", + YieldInParameter: "yield is not allowed in generator parameters", + ZeroDigitNumericSeparator: + "Numeric separator can not be used after leading 0", +}); + export default class LocationParser extends CommentsParser { + // Forward-declaration: defined in tokenizer/index.js + /*:: + +isLookahead: boolean; + */ + getLocationForPosition(pos: number): Position { let loc; if (pos === this.state.start) loc = this.state.startLoc; @@ -21,32 +216,35 @@ export default class LocationParser extends CommentsParser { return loc; } - raise( + raise(pos: number, errorTemplate: string, ...params: any): Error | empty { + return this.raiseWithData(pos, undefined, errorTemplate, ...params); + } + + raiseWithData( pos: number, - message: string, - { - missingPluginNames, - code, - }: { - missingPluginNames?: Array, + data?: { + missingPlugin?: Array, code?: string, - } = {}, - ): empty { + }, + errorTemplate: string, + ...params: any + ): Error | empty { const loc = this.getLocationForPosition(pos); + const message = + errorTemplate.replace(/%(\d+)/g, (_, i: number) => params[i]) + + ` (${loc.line}:${loc.column})`; + return this._raise(Object.assign(({ loc, pos }: Object), data), message); + } - message += ` (${loc.line}:${loc.column})`; + _raise(errorContext: ErrorContext, message: string): Error | empty { // $FlowIgnore - const err: SyntaxError & { pos: number, loc: Position } = new SyntaxError( - message, - ); - err.pos = pos; - err.loc = loc; - if (missingPluginNames) { - err.missingPlugin = missingPluginNames; - } - if (code !== undefined) { - err.code = code; + const err: SyntaxError & ErrorContext = new SyntaxError(message); + Object.assign(err, errorContext); + if (this.options.errorRecovery) { + if (!this.isLookahead) this.state.errors.push(err); + return err; + } else { + throw err; } - throw err; } } diff --git a/packages/babel-parser/src/parser/lval.js b/packages/babel-parser/src/parser/lval.js index b4281ab2ffb7..ca998f25d7a1 100644 --- a/packages/babel-parser/src/parser/lval.js +++ b/packages/babel-parser/src/parser/lval.js @@ -1,138 +1,153 @@ // @flow +import * as charCodes from "charcodes"; import { types as tt, type TokenType } from "../tokenizer/types"; import type { TSParameterProperty, Decorator, Expression, - Identifier, Node, - ObjectExpression, - ObjectPattern, Pattern, RestElement, SpreadElement, + /*:: Identifier, */ + /*:: ObjectExpression, */ + /*:: ObjectPattern, */ } from "../types"; import type { Pos, Position } from "../util/location"; -import { isStrictBindReservedWord } from "../util/identifier"; +import { + isStrictBindOnlyReservedWord, + isStrictBindReservedWord, +} from "../util/identifier"; import { NodeUtils } from "./node"; -import { type BindingTypes, BIND_NONE, BIND_LEXICAL } from "../util/scopeflags"; +import { type BindingTypes, BIND_NONE } from "../util/scopeflags"; +import { ExpressionErrors } from "./util"; +import { Errors } from "./location"; + +const unwrapParenthesizedExpression = (node: Node) => { + return node.type === "ParenthesizedExpression" + ? unwrapParenthesizedExpression(node.expression) + : node; +}; export default class LValParser extends NodeUtils { // Forward-declaration: defined in expression.js + /*:: +parseIdentifier: (liberal?: boolean) => Identifier; +parseMaybeAssign: ( noIn?: ?boolean, - refShorthandDefaultPos?: ?Pos, + refExpressionErrors?: ?ExpressionErrors, afterLeftParse?: Function, refNeedsArrowPos?: ?Pos, ) => Expression; +parseObj: ( + close: TokenType, isPattern: boolean, - refShorthandDefaultPos?: ?Pos, + isRecord?: ?boolean, + refExpressionErrors?: ?ExpressionErrors, ) => T; + */ // Forward-declaration: defined in statement.js + /*:: +parseDecorator: () => Decorator; + */ // Convert existing expression atom to assignable pattern // if possible. + // NOTE: There is a corresponding "isAssignable" method in flow.js. + // When this one is updated, please check if also that one needs to be updated. + + toAssignable(node: Node): Node { + let parenthesized = undefined; + if (node.type === "ParenthesizedExpression" || node.extra?.parenthesized) { + parenthesized = unwrapParenthesizedExpression(node); + if ( + parenthesized.type !== "Identifier" && + parenthesized.type !== "MemberExpression" + ) { + this.raise(node.start, Errors.InvalidParenthesizedAssignment); + } + } - toAssignable( - node: Node, - isBinding: ?boolean, - contextDescription: string, - ): Node { - if (node) { - switch (node.type) { - case "Identifier": - case "ObjectPattern": - case "ArrayPattern": - case "AssignmentPattern": - break; - - case "ObjectExpression": - node.type = "ObjectPattern"; - for ( - let i = 0, length = node.properties.length, last = length - 1; - i < length; - i++ + switch (node.type) { + case "Identifier": + case "ObjectPattern": + case "ArrayPattern": + case "AssignmentPattern": + break; + + case "ObjectExpression": + node.type = "ObjectPattern"; + for ( + let i = 0, length = node.properties.length, last = length - 1; + i < length; + i++ + ) { + const prop = node.properties[i]; + const isLast = i === last; + this.toAssignableObjectExpressionProp(prop, isLast); + + if ( + isLast && + prop.type === "RestElement" && + node.extra?.trailingComma ) { - const prop = node.properties[i]; - const isLast = i === last; - this.toAssignableObjectExpressionProp(prop, isBinding, isLast); + this.raiseRestNotLast(node.extra.trailingComma); } - break; + } + break; - case "ObjectProperty": - this.toAssignable(node.value, isBinding, contextDescription); - break; + case "ObjectProperty": + this.toAssignable(node.value); + break; + + case "SpreadElement": { + this.checkToRestConversion(node); - case "SpreadElement": { - this.checkToRestConversion(node); + node.type = "RestElement"; + const arg = node.argument; + this.toAssignable(arg); + break; + } - node.type = "RestElement"; - const arg = node.argument; - this.toAssignable(arg, isBinding, contextDescription); - break; + case "ArrayExpression": + node.type = "ArrayPattern"; + this.toAssignableList(node.elements, node.extra?.trailingComma); + break; + + case "AssignmentExpression": + if (node.operator !== "=") { + this.raise(node.left.end, Errors.MissingEqInAssignment); } - case "ArrayExpression": - node.type = "ArrayPattern"; - this.toAssignableList(node.elements, isBinding, contextDescription); - break; + node.type = "AssignmentPattern"; + delete node.operator; + this.toAssignable(node.left); + break; - case "AssignmentExpression": - if (node.operator === "=") { - node.type = "AssignmentPattern"; - delete node.operator; - } else { - this.raise( - node.left.end, - "Only '=' operator can be used for specifying default value.", - ); - } - break; + case "ParenthesizedExpression": + this.toAssignable(((parenthesized: any): Expression)); + break; - case "ParenthesizedExpression": - node.expression = this.toAssignable( - node.expression, - isBinding, - contextDescription, - ); - break; - - case "MemberExpression": - if (!isBinding) break; - - default: { - const message = - "Invalid left-hand side" + - (contextDescription - ? " in " + contextDescription - : /* istanbul ignore next */ "expression"); - this.raise(node.start, message); - } - } + default: + // We don't know how to deal with this node. It will + // be reported by a later call to checkLVal } return node; } - toAssignableObjectExpressionProp( - prop: Node, - isBinding: ?boolean, - isLast: boolean, - ) { + toAssignableObjectExpressionProp(prop: Node, isLast: boolean) { if (prop.type === "ObjectMethod") { const error = prop.kind === "get" || prop.kind === "set" - ? "Object pattern can't contain getter or setter" - : "Object pattern can't contain methods"; + ? Errors.PatternHasAccessor + : Errors.PatternHasMethod; this.raise(prop.key.start, error); } else if (prop.type === "SpreadElement" && !isLast) { this.raiseRestNotLast(prop.start); } else { - this.toAssignable(prop, isBinding, "object destructuring pattern"); + this.toAssignable(prop); } } @@ -140,8 +155,7 @@ export default class LValParser extends NodeUtils { toAssignableList( exprList: Expression[], - isBinding: ?boolean, - contextDescription: string, + trailingCommaPos?: ?number, ): $ReadOnlyArray { let end = exprList.length; if (end) { @@ -151,7 +165,7 @@ export default class LValParser extends NodeUtils { } else if (last && last.type === "SpreadElement") { last.type = "RestElement"; const arg = last.argument; - this.toAssignable(arg, isBinding, contextDescription); + this.toAssignable(arg); if ( arg.type !== "Identifier" && arg.type !== "MemberExpression" && @@ -160,13 +174,18 @@ export default class LValParser extends NodeUtils { ) { this.unexpected(arg.start); } + + if (trailingCommaPos) { + this.raiseTrailingCommaAfterRest(trailingCommaPos); + } + --end; } } for (let i = 0; i < end; i++) { const elt = exprList[i]; if (elt) { - this.toAssignable(elt, isBinding, contextDescription); + this.toAssignable(elt); if (elt.type === "RestElement") { this.raiseRestNotLast(elt.start); } @@ -187,7 +206,7 @@ export default class LValParser extends NodeUtils { toReferencedListDeep( exprList: $ReadOnlyArray, isParenthesizedExpr?: boolean, - ): $ReadOnlyArray { + ): void { this.toReferencedList(exprList, isParenthesizedExpr); for (const expr of exprList) { @@ -195,29 +214,22 @@ export default class LValParser extends NodeUtils { this.toReferencedListDeep(expr.elements); } } - - return exprList; } // Parses spread element. parseSpread( - refShorthandDefaultPos: ?Pos, + refExpressionErrors: ?ExpressionErrors, refNeedsArrowPos?: ?Pos, ): SpreadElement { const node = this.startNode(); this.next(); node.argument = this.parseMaybeAssign( false, - refShorthandDefaultPos, + refExpressionErrors, undefined, refNeedsArrowPos, ); - - if (this.state.commaAfterSpreadAt === -1 && this.match(tt.comma)) { - this.state.commaAfterSpreadAt = this.state.start; - } - return this.finishNode(node, "SpreadElement"); } @@ -234,12 +246,16 @@ export default class LValParser extends NodeUtils { case tt.bracketL: { const node = this.startNode(); this.next(); - node.elements = this.parseBindingList(tt.bracketR, true); + node.elements = this.parseBindingList( + tt.bracketR, + charCodes.rightSquareBracket, + true, + ); return this.finishNode(node, "ArrayPattern"); } case tt.braceL: - return this.parseObj(true); + return this.parseObj(tt.braceR, true); } return this.parseIdentifier(); @@ -247,6 +263,7 @@ export default class LValParser extends NodeUtils { parseBindingList( close: TokenType, + closeCharCode: $Values, allowEmpty?: boolean, allowModifiers?: boolean, ): $ReadOnlyArray { @@ -265,16 +282,13 @@ export default class LValParser extends NodeUtils { break; } else if (this.match(tt.ellipsis)) { elts.push(this.parseAssignableListItemTypes(this.parseRestBinding())); - this.checkCommaAfterRest(); + this.checkCommaAfterRest(closeCharCode); this.expect(close); break; } else { const decorators = []; if (this.match(tt.at) && this.hasPlugin("decorators")) { - this.raise( - this.state.start, - "Stage 2 decorators cannot be used to decorate parameters", - ); + this.raise(this.state.start, Errors.UnsupportedParameterDecorator); } while (this.match(tt.at)) { decorators.push(this.parseDecorator()); @@ -328,18 +342,26 @@ export default class LValParser extends NodeUtils { bindingType: BindingTypes = BIND_NONE, checkClashes: ?{ [key: string]: boolean }, contextDescription: string, + disallowLetBinding?: boolean, + strictModeChanged?: boolean = false, ): void { switch (expr.type) { case "Identifier": if ( this.state.strict && - isStrictBindReservedWord(expr.name, this.inModule) + // "Global" reserved words have already been checked by parseIdentifier, + // unless they have been found in the id or parameters of a strict-mode + // function in a sloppy context. + (strictModeChanged + ? isStrictBindReservedWord(expr.name, this.inModule) + : isStrictBindOnlyReservedWord(expr.name)) ) { this.raise( expr.start, - `${bindingType === BIND_NONE ? "Assigning to" : "Binding"} '${ - expr.name - }' in strict mode`, + bindingType === BIND_NONE + ? Errors.StrictEvalArguments + : Errors.StrictEvalArgumentsBinding, + expr.name, ); } @@ -358,16 +380,13 @@ export default class LValParser extends NodeUtils { const key = `_${expr.name}`; if (checkClashes[key]) { - this.raise(expr.start, "Argument name clash"); + this.raise(expr.start, Errors.ParamDupe); } else { checkClashes[key] = true; } } - if (bindingType === BIND_LEXICAL && expr.name === "let") { - this.raise( - expr.start, - "'let' is not allowed to be used as a name in 'let' or 'const' declarations.", - ); + if (disallowLetBinding && expr.name === "let") { + this.raise(expr.start, Errors.LetInLexicalBinding); } if (!(bindingType & BIND_NONE)) { this.scope.declareName(expr.name, bindingType, expr.start); @@ -376,18 +395,24 @@ export default class LValParser extends NodeUtils { case "MemberExpression": if (bindingType !== BIND_NONE) { - this.raise(expr.start, "Binding member expression"); + this.raise(expr.start, Errors.InvalidPropertyBindingPattern); } break; case "ObjectPattern": for (let prop of expr.properties) { if (prop.type === "ObjectProperty") prop = prop.value; + // If we find here an ObjectMethod, it's because this was originally + // an ObjectExpression which has then been converted. + // toAssignable already reported this error with a nicer message. + else if (prop.type === "ObjectMethod") continue; + this.checkLVal( prop, bindingType, checkClashes, "object destructuring pattern", + disallowLetBinding, ); } break; @@ -400,6 +425,7 @@ export default class LValParser extends NodeUtils { bindingType, checkClashes, "array destructuring pattern", + disallowLetBinding, ); } } @@ -433,15 +459,13 @@ export default class LValParser extends NodeUtils { break; default: { - const message = - (bindingType === BIND_NONE - ? "Invalid" - : /* istanbul ignore next */ "Binding invalid") + - " left-hand side" + - (contextDescription - ? " in " + contextDescription - : /* istanbul ignore next */ "expression"); - this.raise(expr.start, message); + this.raise( + expr.start, + bindingType === BIND_NONE + ? Errors.InvalidLhs + : Errors.InvalidLhsBinding, + contextDescription, + ); } } } @@ -451,23 +475,25 @@ export default class LValParser extends NodeUtils { node.argument.type !== "Identifier" && node.argument.type !== "MemberExpression" ) { - this.raise(node.argument.start, "Invalid rest operator's argument"); + this.raise(node.argument.start, Errors.InvalidRestAssignmentPattern); } } - checkCommaAfterRest(): void { + checkCommaAfterRest(close: $Values): void { if (this.match(tt.comma)) { - this.raiseRestNotLast(this.state.start); + if (this.lookaheadCharCode() === close) { + this.raiseTrailingCommaAfterRest(this.state.start); + } else { + this.raiseRestNotLast(this.state.start); + } } } - checkCommaAfterRestFromSpread(): void { - if (this.state.commaAfterSpreadAt > -1) { - this.raiseRestNotLast(this.state.commaAfterSpreadAt); - } + raiseRestNotLast(pos: number) { + throw this.raise(pos, Errors.ElementAfterRest); } - raiseRestNotLast(pos: number) { - this.raise(pos, `Rest element must be last element`); + raiseTrailingCommaAfterRest(pos: number) { + this.raise(pos, Errors.RestTrailingComma); } } diff --git a/packages/babel-parser/src/parser/statement.js b/packages/babel-parser/src/parser/statement.js index b677bfd0c9e2..5b1d1077712e 100644 --- a/packages/babel-parser/src/parser/statement.js +++ b/packages/babel-parser/src/parser/statement.js @@ -3,24 +3,33 @@ import * as N from "../types"; import { types as tt, type TokenType } from "../tokenizer/types"; import ExpressionParser from "./expression"; +import { Errors } from "./location"; import { isIdentifierChar, isIdentifierStart, keywordRelationalOperator, } from "../util/identifier"; -import { lineBreak, skipWhiteSpace } from "../util/whitespace"; +import { lineBreak } from "../util/whitespace"; import * as charCodes from "charcodes"; import { BIND_CLASS, BIND_LEXICAL, BIND_VAR, BIND_FUNCTION, - functionFlags, SCOPE_CLASS, + SCOPE_FUNCTION, SCOPE_OTHER, SCOPE_SIMPLE_CATCH, SCOPE_SUPER, + CLASS_ELEMENT_OTHER, + CLASS_ELEMENT_INSTANCE_GETTER, + CLASS_ELEMENT_INSTANCE_SETTER, + CLASS_ELEMENT_STATIC_GETTER, + CLASS_ELEMENT_STATIC_SETTER, + type BindingTypes, } from "../util/scopeflags"; +import { ExpressionErrors } from "./util"; +import { PARAM, functionFlags } from "../util/production-parameter"; const loopLabel = { kind: "loop" }, switchLabel = { kind: "switch" }; @@ -53,14 +62,14 @@ export default class StatementParser extends ExpressionParser { for (const [name] of Array.from(this.scope.undefinedExports)) { const pos = this.scope.undefinedExports.get(name); // $FlowIssue - this.raise(pos, `Export '${name}' is not defined`); + this.raise(pos, Errors.ModuleExportUndefined, name); } } file.program = this.finishNode(program, "Program"); file.comments = this.state.comments; - if (this.options.tokens) file.tokens = this.state.tokens; + if (this.options.tokens) file.tokens = this.tokens; return this.finishNode(file, "File"); } @@ -104,10 +113,7 @@ export default class StatementParser extends ExpressionParser { if (!this.isContextual("let")) { return false; } - skipWhiteSpace.lastIndex = this.state.pos; - const skip = skipWhiteSpace.exec(this.input); - // $FlowIgnore - const next = this.state.pos + skip[0].length; + const next = this.nextTokenStart(); const nextCh = this.input.charCodeAt(next); // For ambiguous cases, determine if a LexicalDeclaration (or only a // Statement) is allowed here. If context is not empty then only a Statement @@ -169,19 +175,12 @@ export default class StatementParser extends ExpressionParser { case tt._for: return this.parseForStatement(node); case tt._function: - if (this.lookahead().type === tt.dot) break; + if (this.lookaheadCharCode() === charCodes.dot) break; if (context) { if (this.state.strict) { - this.raise( - this.state.start, - "In strict mode code, functions can only be declared at top level or inside a block", - ); + this.raise(this.state.start, Errors.StrictFunction); } else if (context !== "if" && context !== "label") { - this.raise( - this.state.start, - "In non-strict mode code, functions can only be declared at top level, " + - "inside a block, or as the body of an if statement", - ); + this.raise(this.state.start, Errors.SloppyFunction); } } return this.parseFunctionStatement(node, false, !context); @@ -205,10 +204,7 @@ export default class StatementParser extends ExpressionParser { case tt._var: kind = kind || this.state.value; if (context && kind !== "var") { - this.unexpected( - this.state.start, - "Lexical declaration cannot appear in a single-statement context", - ); + this.raise(this.state.start, Errors.UnexpectedLexicalDeclaration); } return this.parseVarStatement(node, kind); @@ -222,16 +218,16 @@ export default class StatementParser extends ExpressionParser { return this.parseEmptyStatement(node); case tt._export: case tt._import: { - const nextToken = this.lookahead(); - if (nextToken.type === tt.parenL || nextToken.type === tt.dot) { + const nextTokenCharCode = this.lookaheadCharCode(); + if ( + nextTokenCharCode === charCodes.leftParenthesis || + nextTokenCharCode === charCodes.dot + ) { break; } if (!this.options.allowImportExportEverywhere && !topLevel) { - this.raise( - this.state.start, - "'import' and 'export' may only appear at the top level", - ); + this.raise(this.state.start, Errors.UnexpectedImportExport); } this.next(); @@ -268,9 +264,9 @@ export default class StatementParser extends ExpressionParser { default: { if (this.isAsyncFunction()) { if (context) { - this.unexpected( - null, - "Async functions can only be declared at the top level or inside a block", + this.raise( + this.state.start, + Errors.AsyncFunctionInSingleStatementContext, ); } this.next(); @@ -300,12 +296,12 @@ export default class StatementParser extends ExpressionParser { assertModuleNodeAllowed(node: N.Node): void { if (!this.options.allowImportExportEverywhere && !this.inModule) { - this.raise( + this.raiseWithData( node.start, - `'import' and 'export' may appear only with 'sourceType: "module"'`, { code: "BABEL_PARSER_SOURCETYPE_MODULE_REQUIRED", }, + Errors.ImportOutsideModule, ); } } @@ -343,17 +339,10 @@ export default class StatementParser extends ExpressionParser { this.hasPlugin("decorators") && !this.getPluginOption("decorators", "decoratorsBeforeExport") ) { - this.raise( - this.state.start, - "Using the export keyword between a decorator and a class is not allowed. " + - "Please use `export @dec class` instead.", - ); + this.raise(this.state.start, Errors.DecoratorExportClass); } } else if (!this.canHaveLeadingDecorator()) { - this.raise( - this.state.start, - "Leading decorators must be attached to a class declaration", - ); + throw this.raise(this.state.start, Errors.UnexpectedLeadingDecorator); } } @@ -443,7 +432,7 @@ export default class StatementParser extends ExpressionParser { } } if (i === this.state.labels.length) { - this.raise(node.start, "Unsyntactic " + keyword); + this.raise(node.start, Errors.IllegalBreakContinue, keyword); } } @@ -494,11 +483,7 @@ export default class StatementParser extends ExpressionParser { this.state.labels.push(loopLabel); let awaitAt = -1; - if ( - (this.scope.inAsync || - (!this.scope.inFunction && this.options.allowAwaitOutsideFunction)) && - this.eatContextual("await") - ) { + if (this.isAwaitAllowed() && this.eatContextual("await")) { awaitAt = this.state.lastTokStart; } this.scope.enter(SCOPE_OTHER); @@ -531,17 +516,17 @@ export default class StatementParser extends ExpressionParser { return this.parseFor(node, init); } - const refShorthandDefaultPos = { start: 0 }; - const init = this.parseExpression(true, refShorthandDefaultPos); + const refExpressionErrors = new ExpressionErrors(); + const init = this.parseExpression(true, refExpressionErrors); if (this.match(tt._in) || this.isContextual("of")) { + this.toAssignable(init); const description = this.isContextual("of") ? "for-of statement" : "for-in statement"; - this.toAssignable(init, undefined, description); this.checkLVal(init, undefined, undefined, description); return this.parseForIn(node, init, awaitAt); - } else if (refShorthandDefaultPos.start) { - this.unexpected(refShorthandDefaultPos.start); + } else { + this.checkExpressionErrors(refExpressionErrors, true); } if (awaitAt > -1) { this.unexpected(awaitAt); @@ -571,8 +556,8 @@ export default class StatementParser extends ExpressionParser { } parseReturnStatement(node: N.ReturnStatement): N.ReturnStatement { - if (!this.scope.inFunction && !this.options.allowReturnOutsideFunction) { - this.raise(this.state.start, "'return' outside of function"); + if (!this.prodParam.hasReturn && !this.options.allowReturnOutsideFunction) { + this.raise(this.state.start, Errors.IllegalReturn); } this.next(); @@ -615,7 +600,10 @@ export default class StatementParser extends ExpressionParser { cur.test = this.parseExpression(); } else { if (sawDefault) { - this.raise(this.state.lastTokStart, "Multiple default clauses"); + this.raise( + this.state.lastTokStart, + Errors.MultipleDefaultsInSwitch, + ); } sawDefault = true; cur.test = null; @@ -641,7 +629,7 @@ export default class StatementParser extends ExpressionParser { if ( lineBreak.test(this.input.slice(this.state.lastTokEnd, this.state.start)) ) { - this.raise(this.state.lastTokEnd, "Illegal newline after throw"); + this.raise(this.state.lastTokEnd, Errors.NewlineAfterThrow); } node.argument = this.parseExpression(); this.semicolon(); @@ -686,7 +674,7 @@ export default class StatementParser extends ExpressionParser { node.finalizer = this.eat(tt._finally) ? this.parseBlock() : null; if (!node.handler && !node.finalizer) { - this.raise(node.start, "Missing catch or finally clause"); + this.raise(node.start, Errors.NoCatchOrFinally); } return this.finishNode(node, "TryStatement"); @@ -723,7 +711,7 @@ export default class StatementParser extends ExpressionParser { parseWithStatement(node: N.WithStatement): N.WithStatement { if (this.state.strict) { - this.raise(this.state.start, "'with' in strict mode"); + this.raise(this.state.start, Errors.StrictWith); } this.next(); node.object = this.parseHeaderExpression(); @@ -754,7 +742,7 @@ export default class StatementParser extends ExpressionParser { ): N.LabeledStatement { for (const label of this.state.labels) { if (label.name === maybeName) { - this.raise(expr.start, `Label '${maybeName}' is already declared`); + this.raise(expr.start, Errors.LabelRedeclaration, maybeName); } } @@ -807,13 +795,20 @@ export default class StatementParser extends ExpressionParser { parseBlock( allowDirectives?: boolean = false, createNewLexicalScope?: boolean = true, + afterBlockParse?: (hasStrictModeDirective: boolean) => void, ): N.BlockStatement { const node = this.startNode(); this.expect(tt.braceL); if (createNewLexicalScope) { this.scope.enter(SCOPE_OTHER); } - this.parseBlockBody(node, allowDirectives, false, tt.braceR); + this.parseBlockBody( + node, + allowDirectives, + false, + tt.braceR, + afterBlockParse, + ); if (createNewLexicalScope) { this.scope.exit(); } @@ -833,6 +828,7 @@ export default class StatementParser extends ExpressionParser { allowDirectives: ?boolean, topLevel: boolean, end: TokenType, + afterBlockParse?: (hasStrictModeDirective: boolean) => void, ): void { const body = (node.body = []); const directives = (node.directives = []); @@ -841,6 +837,7 @@ export default class StatementParser extends ExpressionParser { allowDirectives ? directives : undefined, topLevel, end, + afterBlockParse, ); } @@ -850,14 +847,17 @@ export default class StatementParser extends ExpressionParser { directives: ?(N.Directive[]), topLevel: boolean, end: TokenType, + afterBlockParse?: (hasStrictModeDirective: boolean) => void, ): void { + const octalPositions = []; + const oldStrict = this.state.strict; + let hasStrictModeDirective = false; let parsedNonDirective = false; - let oldStrict; - let octalPosition; - while (!this.eat(end)) { - if (!parsedNonDirective && this.state.containsOctal && !octalPosition) { - octalPosition = this.state.octalPosition; + while (!this.match(end)) { + // Track octal literals that occur before a "use strict" directive. + if (!parsedNonDirective && this.state.octalPositions.length) { + octalPositions.push(...this.state.octalPositions); } const stmt = this.parseStatement(null, topLevel); @@ -866,13 +866,9 @@ export default class StatementParser extends ExpressionParser { const directive = this.stmtToDirective(stmt); directives.push(directive); - if (oldStrict === undefined && directive.value.value === "use strict") { - oldStrict = this.state.strict; + if (!hasStrictModeDirective && directive.value.value === "use strict") { + hasStrictModeDirective = true; this.setStrict(true); - - if (octalPosition) { - this.raise(octalPosition, "Octal literal in strict mode"); - } } continue; @@ -882,9 +878,24 @@ export default class StatementParser extends ExpressionParser { body.push(stmt); } - if (oldStrict === false) { + // Throw an error for any octal literals found before a + // "use strict" directive. Strict mode will be set at parse + // time for any literals that occur after the directive. + if (this.state.strict && octalPositions.length) { + for (const pos of octalPositions) { + this.raise(pos, Errors.StrictOctalLiteral); + } + } + + if (afterBlockParse) { + afterBlockParse.call(this, hasStrictModeDirective); + } + + if (!oldStrict) { this.setStrict(false); } + + this.next(); } // Parse a regular `for` loop. The disambiguation code in @@ -944,12 +955,11 @@ export default class StatementParser extends ExpressionParser { ) { this.raise( init.start, - `${ - isForIn ? "for-in" : "for-of" - } loop variable declaration may not have an initializer`, + Errors.ForInOfLoopInitializer, + isForIn ? "for-in" : "for-of", ); } else if (init.type === "AssignmentPattern") { - this.raise(init.start, "Invalid left-hand side in for-loop"); + this.raise(init.start, Errors.InvalidLhs, "for-loop"); } node.left = init; @@ -1002,7 +1012,8 @@ export default class StatementParser extends ExpressionParser { ) { this.raise( this.state.lastTokEnd, - "Complex binding patterns require an initialization value", + Errors.DeclarationMissingInitializer, + "Complex binding patterns", ); } decl.init = null; @@ -1020,6 +1031,7 @@ export default class StatementParser extends ExpressionParser { kind === "var" ? BIND_VAR : BIND_LEXICAL, undefined, "variable declaration", + kind !== "var", ); } @@ -1038,10 +1050,7 @@ export default class StatementParser extends ExpressionParser { this.initFunction(node, isAsync); if (this.match(tt.star) && isHangingStatement) { - this.unexpected( - this.state.start, - "Generators can only be declared at the top level or inside a block", - ); + this.raise(this.state.start, Errors.GeneratorInSingleStatementContext); } node.generator = this.eat(tt.star); @@ -1049,13 +1058,14 @@ export default class StatementParser extends ExpressionParser { node.id = this.parseFunctionId(requireId); } - const oldInClassProperty = this.state.inClassProperty; + const oldMaybeInArrowParameters = this.state.maybeInArrowParameters; const oldYieldPos = this.state.yieldPos; const oldAwaitPos = this.state.awaitPos; - this.state.inClassProperty = false; - this.state.yieldPos = 0; - this.state.awaitPos = 0; - this.scope.enter(functionFlags(node.async, node.generator)); + this.state.maybeInArrowParameters = false; + this.state.yieldPos = -1; + this.state.awaitPos = -1; + this.scope.enter(SCOPE_FUNCTION); + this.prodParam.enter(functionFlags(isAsync, node.generator)); if (!isStatement) { node.id = this.parseFunctionId(); @@ -1074,16 +1084,17 @@ export default class StatementParser extends ExpressionParser { ); }); + this.prodParam.exit(); this.scope.exit(); if (isStatement && !isHangingStatement) { - // We need to validate this _after_ parsing the function body + // We need to register this _after_ parsing the function body // because of TypeScript body-less function declarations, // which shouldn't be added to the scope. - this.checkFunctionStatementId(node); + this.registerFunctionStatementId(node); } - this.state.inClassProperty = oldInClassProperty; + this.state.maybeInArrowParameters = oldMaybeInArrowParameters; this.state.yieldPos = oldYieldPos; this.state.awaitPos = oldAwaitPos; @@ -1101,6 +1112,7 @@ export default class StatementParser extends ExpressionParser { this.expect(tt.parenL); node.params = this.parseBindingList( tt.parenR, + charCodes.rightParenthesis, /* allowEmpty */ false, allowModifiers, ); @@ -1109,22 +1121,21 @@ export default class StatementParser extends ExpressionParser { this.checkYieldAwaitInDefaultParams(); } - checkFunctionStatementId(node: N.Function): void { + registerFunctionStatementId(node: N.Function): void { if (!node.id) return; // If it is a regular function declaration in sloppy mode, then it is // subject to Annex B semantics (BIND_FUNCTION). Otherwise, the binding // mode depends on properties of the current scope (see // treatFunctionsAsVar). - this.checkLVal( - node.id, + this.scope.declareName( + node.id.name, this.state.strict || node.generator || node.async ? this.scope.treatFunctionsAsVar ? BIND_VAR : BIND_LEXICAL : BIND_FUNCTION, - null, - "function name", + node.id.start, ); } @@ -1145,7 +1156,7 @@ export default class StatementParser extends ExpressionParser { this.parseClassId(node, isStatement, optionalId); this.parseClassSuper(node); - node.body = this.parseClassBody(!!node.superClass); + node.body = this.parseClassBody(!!node.superClass, oldStrict); this.state.strict = oldStrict; @@ -1172,8 +1183,11 @@ export default class StatementParser extends ExpressionParser { ); } - parseClassBody(constructorAllowsSuper: boolean): N.ClassBody { - this.state.classLevel++; + parseClassBody( + constructorAllowsSuper: boolean, + oldStrict?: boolean, + ): N.ClassBody { + this.classScope.enter(); const state = { hadConstructor: false }; let decorators: N.Decorator[] = []; @@ -1186,13 +1200,10 @@ export default class StatementParser extends ExpressionParser { // contexts within the class body. They are permitted in test expressions, // outside of the class body. this.withTopicForbiddingContext(() => { - while (!this.eat(tt.braceR)) { + while (!this.match(tt.braceR)) { if (this.eat(tt.semi)) { if (decorators.length > 0) { - this.raise( - this.state.lastTokEnd, - "Decorators must not be followed by a semicolon", - ); + throw this.raise(this.state.lastTokEnd, Errors.DecoratorSemicolon); } continue; } @@ -1218,70 +1229,79 @@ export default class StatementParser extends ExpressionParser { member.decorators && member.decorators.length > 0 ) { - this.raise( - member.start, - "Decorators can't be used with a constructor. Did you mean '@dec class { ... }'?", - ); + this.raise(member.start, Errors.DecoratorConstructor); } } }); + if (!oldStrict) { + this.state.strict = false; + } + + this.next(); + if (decorators.length) { - this.raise( - this.state.start, - "You have trailing decorators with no method", - ); + throw this.raise(this.state.start, Errors.TrailingDecorator); } - this.state.classLevel--; + this.classScope.exit(); return this.finishNode(classBody, "ClassBody"); } - parseClassMember( + // returns true if the current identifier is a method/field name, + // false if it is a modifier + parseClassMemberFromModifier( classBody: N.ClassBody, member: N.ClassMember, - state: { hadConstructor: boolean }, - constructorAllowsSuper: boolean, - ): void { - let isStatic = false; + ): boolean { const containsEsc = this.state.containsEsc; + const key = this.parseIdentifier(true); // eats the modifier - if (this.match(tt.name) && this.state.value === "static") { - const key = this.parseIdentifier(true); // eats 'static' + if (this.isClassMethod()) { + const method: N.ClassMethod = (member: any); - if (this.isClassMethod()) { - const method: N.ClassMethod = (member: any); + // a method named like the modifier + method.kind = "method"; + method.computed = false; + method.key = key; + method.static = false; + this.pushClassMethod( + classBody, + method, + false, + false, + /* isConstructor */ false, + false, + ); + return true; + } else if (this.isClassProperty()) { + const prop: N.ClassProperty = (member: any); - // a method named 'static' - method.kind = "method"; - method.computed = false; - method.key = key; - method.static = false; - this.pushClassMethod( - classBody, - method, - false, - false, - /* isConstructor */ false, - false, - ); - return; - } else if (this.isClassProperty()) { - const prop: N.ClassProperty = (member: any); - - // a property named 'static' - prop.computed = false; - prop.key = key; - prop.static = false; - classBody.body.push(this.parseClassProperty(prop)); - return; - } else if (containsEsc) { - throw this.unexpected(); - } + // a property named like the modifier + prop.computed = false; + prop.key = key; + prop.static = false; + classBody.body.push(this.parseClassProperty(prop)); + return true; + } else if (containsEsc) { + throw this.unexpected(); + } + + return false; + } + + parseClassMember( + classBody: N.ClassBody, + member: N.ClassMember, + state: { hadConstructor: boolean }, + constructorAllowsSuper: boolean, + ): void { + const isStatic = this.isContextual("static"); - // otherwise something static - isStatic = true; + if (isStatic && this.parseClassMemberFromModifier(classBody, member)) { + // a class element named 'static' + return; } this.parseClassMemberWithIsStatic( @@ -1322,7 +1342,7 @@ export default class StatementParser extends ExpressionParser { } if (this.isNonstaticConstructor(publicMethod)) { - this.raise(publicMethod.key.start, "Constructor can't be a generator"); + this.raise(publicMethod.key.start, Errors.ConstructorIsGenerator); } this.pushClassMethod( @@ -1342,6 +1362,7 @@ export default class StatementParser extends ExpressionParser { const isPrivate = key.type === "PrivateName"; // Check the key is not a computed expression or string literal. const isSimple = key.type === "Identifier"; + const maybeQuestionTokenStart = this.state.start; this.parsePostMemberNameModifiers(publicMember); @@ -1359,16 +1380,9 @@ export default class StatementParser extends ExpressionParser { if (isConstructor) { publicMethod.kind = "constructor"; - if (publicMethod.decorators) { - this.raise( - publicMethod.start, - "You can't attach decorators to a class constructor", - ); - } - // TypeScript allows multiple overloaded constructor declarations. if (state.hadConstructor && !this.hasPlugin("typescript")) { - this.raise(key.start, "Duplicate constructor in the same class"); + this.raise(key.start, Errors.DuplicateConstructor); } state.hadConstructor = true; allowsDirectSuper = constructorAllowsSuper; @@ -1397,9 +1411,14 @@ export default class StatementParser extends ExpressionParser { // an async method const isGenerator = this.eat(tt.star); + if (publicMember.optional) { + this.unexpected(maybeQuestionTokenStart); + } + method.kind = "method"; // The so-called parsed name would have been "async": get the real name. this.parseClassPropertyName(method); + this.parsePostMemberNameModifiers(publicMember); if (method.key.type === "PrivateName") { // private async method @@ -1411,10 +1430,7 @@ export default class StatementParser extends ExpressionParser { ); } else { if (this.isNonstaticConstructor(publicMethod)) { - this.raise( - publicMethod.key.start, - "Constructor can't be an async function", - ); + this.raise(publicMethod.key.start, Errors.ConstructorIsAsync); } this.pushClassMethod( @@ -1443,10 +1459,7 @@ export default class StatementParser extends ExpressionParser { this.pushClassPrivateMethod(classBody, privateMethod, false, false); } else { if (this.isNonstaticConstructor(publicMethod)) { - this.raise( - publicMethod.key.start, - "Constructor can't have get/set modifier", - ); + this.raise(publicMethod.key.start, Errors.ConstructorIsAccessor); } this.pushClassMethod( classBody, @@ -1472,7 +1485,7 @@ export default class StatementParser extends ExpressionParser { } parseClassPropertyName(member: N.ClassMember): N.Expression | N.Identifier { - const key = this.parsePropertyName(member); + const key = this.parsePropertyName(member, /* isPrivateNameAllowed */ true); if ( !member.computed && @@ -1480,30 +1493,26 @@ export default class StatementParser extends ExpressionParser { ((key: $FlowSubtype).name === "prototype" || (key: $FlowSubtype).value === "prototype") ) { - this.raise( - key.start, - "Classes may not have static property named prototype", - ); + this.raise(key.start, Errors.StaticPrototype); } if (key.type === "PrivateName" && key.id.name === "constructor") { - this.raise( - key.start, - "Classes may not have a private field named '#constructor'", - ); + this.raise(key.start, Errors.ConstructorClassPrivateField); } return key; } pushClassProperty(classBody: N.ClassBody, prop: N.ClassProperty) { - // This only affects properties, not methods. - if (this.isNonstaticConstructor(prop)) { - this.raise( - prop.key.start, - "Classes may not have a non-static field named 'constructor'", - ); + if ( + !prop.computed && + (prop.key.name === "constructor" || prop.key.value === "constructor") + ) { + // Non-computed field, which is either an identifier named "constructor" + // or a string literal named "constructor" + this.raise(prop.key.start, Errors.ConstructorClassField); } + classBody.body.push(this.parseClassProperty(prop)); } @@ -1512,7 +1521,15 @@ export default class StatementParser extends ExpressionParser { prop: N.ClassPrivateProperty, ) { this.expectPlugin("classPrivateProperties", prop.key.start); - classBody.body.push(this.parseClassPrivateProperty(prop)); + + const node = this.parseClassPrivateProperty(prop); + classBody.body.push(node); + + this.classScope.declarePrivateName( + node.key.id.name, + CLASS_ELEMENT_OTHER, + node.key.start, + ); } pushClassMethod( @@ -1543,17 +1560,29 @@ export default class StatementParser extends ExpressionParser { isAsync: boolean, ): void { this.expectPlugin("classPrivateMethods", method.key.start); - classBody.body.push( - this.parseMethod( - method, - isGenerator, - isAsync, - /* isConstructor */ false, - false, - "ClassPrivateMethod", - true, - ), + + const node = this.parseMethod( + method, + isGenerator, + isAsync, + /* isConstructor */ false, + false, + "ClassPrivateMethod", + true, ); + classBody.body.push(node); + + const kind = + node.kind === "get" + ? node.static + ? CLASS_ELEMENT_STATIC_GETTER + : CLASS_ELEMENT_INSTANCE_GETTER + : node.kind === "set" + ? node.static + ? CLASS_ELEMENT_STATIC_SETTER + : CLASS_ELEMENT_INSTANCE_SETTER + : CLASS_ELEMENT_OTHER; + this.classScope.declarePrivateName(node.key.id.name, kind, node.key.start); } // Overridden in typescript.js @@ -1570,13 +1599,13 @@ export default class StatementParser extends ExpressionParser { parseClassPrivateProperty( node: N.ClassPrivateProperty, ): N.ClassPrivateProperty { - this.state.inClassProperty = true; - this.scope.enter(SCOPE_CLASS | SCOPE_SUPER); + // [In] production parameter is tracked in parseMaybeAssign + this.prodParam.enter(PARAM); node.value = this.eat(tt.eq) ? this.parseMaybeAssign() : null; this.semicolon(); - this.state.inClassProperty = false; + this.prodParam.exit(); this.scope.exit(); @@ -1588,9 +1617,9 @@ export default class StatementParser extends ExpressionParser { this.expectPlugin("classProperties"); } - this.state.inClassProperty = true; - this.scope.enter(SCOPE_CLASS | SCOPE_SUPER); + // [In] production parameter is tracked in parseMaybeAssign + this.prodParam.enter(PARAM); if (this.match(tt.eq)) { this.expectPlugin("classProperties"); @@ -1600,8 +1629,8 @@ export default class StatementParser extends ExpressionParser { node.value = null; } this.semicolon(); - this.state.inClassProperty = false; + this.prodParam.exit(); this.scope.exit(); return this.finishNode(node, "ClassProperty"); @@ -1611,17 +1640,18 @@ export default class StatementParser extends ExpressionParser { node: N.Class, isStatement: boolean, optionalId: ?boolean, + bindingType: BindingTypes = BIND_CLASS, ): void { if (this.match(tt.name)) { node.id = this.parseIdentifier(); if (isStatement) { - this.checkLVal(node.id, BIND_CLASS, undefined, "class name"); + this.checkLVal(node.id, bindingType, undefined, "class name"); } } else { if (optionalId || !isStatement) { node.id = null; } else { - this.unexpected(null, "A class name is required"); + this.unexpected(null, Errors.MissingClassName); } } } @@ -1702,7 +1732,6 @@ export default class StatementParser extends ExpressionParser { maybeParseExportNamespaceSpecifier(node: N.Node): boolean { if (this.isContextual("as")) { if (!node.specifiers) node.specifiers = []; - this.expectPlugin("exportNamespaceFrom"); const specifier = this.startNodeAt( this.state.lastTokStart, @@ -1736,11 +1765,11 @@ export default class StatementParser extends ExpressionParser { maybeParseExportDeclaration(node: N.Node): boolean { if (this.shouldParseExportDeclaration()) { if (this.isContextual("async")) { - const next = this.lookahead(); + const next = this.nextTokenStart(); // export async; - if (next.type !== tt._function) { - this.unexpected(next.start, `Unexpected token, expected "function"`); + if (!this.isUnparsedContextual(next, "function")) { + this.unexpected(next, tt._function); } } @@ -1755,21 +1784,10 @@ export default class StatementParser extends ExpressionParser { isAsyncFunction(): boolean { if (!this.isContextual("async")) return false; - - const { pos } = this.state; - - skipWhiteSpace.lastIndex = pos; - const skip = skipWhiteSpace.exec(this.input); - - if (!skip || !skip.length) return false; - - const next = pos + skip[0].length; - + const next = this.nextTokenStart(); return ( - !lineBreak.test(this.input.slice(pos, next)) && - this.input.slice(next, next + 8) === "function" && - (next + 8 === this.length || - !isIdentifierChar(this.input.charCodeAt(next + 8))) + !lineBreak.test(this.input.slice(this.state.pos, next)) && + this.isUnparsedContextual(next, "function") ); } @@ -1796,20 +1814,12 @@ export default class StatementParser extends ExpressionParser { this.hasPlugin("decorators") && this.getPluginOption("decorators", "decoratorsBeforeExport") ) { - this.unexpected( - this.state.start, - "Decorators must be placed *before* the 'export' keyword." + - " You can set the 'decoratorsBeforeExport' option to false to use" + - " the 'export @decorator class {}' syntax", - ); + this.raise(this.state.start, Errors.DecoratorBeforeExport); } this.parseDecorators(false); return this.parseClass(expr, true, true); } else if (this.match(tt._const) || this.match(tt._var) || this.isLet()) { - return this.raise( - this.state.start, - "Only expressions, functions or classes are allowed as the `default` export.", - ); + throw this.raise(this.state.start, Errors.UnsupportedDefaultExport); } else { const res = this.parseMaybeAssign(); this.semicolon(); @@ -1824,17 +1834,35 @@ export default class StatementParser extends ExpressionParser { isExportDefaultSpecifier(): boolean { if (this.match(tt.name)) { - return this.state.value !== "async" && this.state.value !== "let"; - } - - if (!this.match(tt._default)) { + const value = this.state.value; + if (value === "async" || value === "let") { + return false; + } + if ( + (value === "type" || value === "interface") && + !this.state.containsEsc + ) { + const l = this.lookahead(); + // If we see any variable name other than `from` after `type` keyword, + // we consider it as flow/typescript type exports + // note that this approach may fail on some pedantic cases + // export type from = number + if ( + (l.type === tt.name && l.value !== "from") || + l.type === tt.braceL + ) { + this.expectOnePlugin(["flow", "typescript"]); + return false; + } + } + } else if (!this.match(tt._default)) { return false; } - const lookahead = this.lookahead(); + const next = this.nextTokenStart(); return ( - lookahead.type === tt.comma || - (lookahead.type === tt.name && lookahead.value === "from") + this.input.charCodeAt(next) === charCodes.comma || + this.isUnparsedContextual(next, "from") ); } @@ -1858,12 +1886,7 @@ export default class StatementParser extends ExpressionParser { this.expectOnePlugin(["decorators", "decorators-legacy"]); if (this.hasPlugin("decorators")) { if (this.getPluginOption("decorators", "decoratorsBeforeExport")) { - this.unexpected( - this.state.start, - "Decorators must be placed *before* the 'export' keyword." + - " You can set the 'decoratorsBeforeExport' option to false to use" + - " the 'export @decorator class {}' syntax", - ); + this.unexpected(this.state.start, Errors.DecoratorBeforeExport); } else { return true; } @@ -1936,10 +1959,7 @@ export default class StatementParser extends ExpressionParser { (node.declaration.type === "ClassDeclaration" || node.declaration.type === "ClassExpression"); if (!node.declaration || !isClass) { - throw this.raise( - node.start, - "You can only use decorators on an export when exporting a class", - ); + throw this.raise(node.start, Errors.UnsupportedDecoratorExport); } this.takeDecorators(node.declaration); } @@ -1976,11 +1996,12 @@ export default class StatementParser extends ExpressionParser { name: string, ): void { if (this.state.exportedIdentifiers.indexOf(name) > -1) { - throw this.raise( + this.raise( node.start, name === "default" - ? "Only one default export allowed per module." - : `\`${name}\` has already been exported. Exported identifiers must be unique.`, + ? Errors.DuplicateDefaultExport + : Errors.DuplicateExport, + name, ); } this.state.exportedIdentifiers.push(name); @@ -2097,11 +2118,7 @@ export default class StatementParser extends ExpressionParser { } else { // Detect an attempt to deep destructure if (this.eat(tt.colon)) { - this.unexpected( - null, - "ES2015 named imports do not destructure. " + - "Use another statement for destructuring after the import.", - ); + throw this.raise(this.state.start, Errors.DestructureNamedImport); } this.expect(tt.comma); diff --git a/packages/babel-parser/src/parser/util.js b/packages/babel-parser/src/parser/util.js index bd6139a2480a..1ac2dbd7442d 100644 --- a/packages/babel-parser/src/parser/util.js +++ b/packages/babel-parser/src/parser/util.js @@ -2,10 +2,20 @@ import { types as tt, type TokenType } from "../tokenizer/types"; import Tokenizer from "../tokenizer"; +import State from "../tokenizer/state"; import type { Node } from "../types"; -import { lineBreak, skipWhiteSpace } from "../util/whitespace"; - -const literal = /^('|")((?:\\?.)*?)\1/; +import { lineBreak } from "../util/whitespace"; +import { isIdentifierChar } from "../util/identifier"; +import * as charCodes from "charcodes"; +import { Errors } from "./location"; + +type TryParse = { + node: Node, + error: Error, + thrown: Thrown, + aborted: Aborted, + failState: FailState, +}; // ## Parser utilities @@ -26,8 +36,15 @@ export default class UtilParser extends Tokenizer { } isLookaheadRelational(op: "<" | ">"): boolean { - const l = this.lookahead(); - return l.type === tt.relational && l.value === op; + const next = this.nextTokenStart(); + if (this.input.charAt(next) === op) { + if (next + 1 === this.input.length) { + return true; + } + const afterNext = this.input.charCodeAt(next + 1); + return afterNext !== op.charCodeAt(0) && afterNext !== charCodes.equalsTo; + } + return false; } // TODO @@ -40,16 +57,6 @@ export default class UtilParser extends Tokenizer { } } - // eat() for relational operators. - - eatRelational(op: "<" | ">"): boolean { - if (this.isRelational(op)) { - this.next(); - return true; - } - return false; - } - // Tests whether parsed token is a contextual keyword. isContextual(name: string): boolean { @@ -60,9 +67,18 @@ export default class UtilParser extends Tokenizer { ); } + isUnparsedContextual(nameStart: number, name: string): boolean { + const nameEnd = nameStart + name.length; + return ( + this.input.slice(nameStart, nameEnd) === name && + (nameEnd === this.input.length || + !isIdentifierChar(this.input.charCodeAt(nameEnd))) + ); + } + isLookaheadContextual(name: string): boolean { - const l = this.lookahead(); - return l.type === tt.name && l.value === name; + const next = this.nextTokenStart(); + return this.isUnparsedContextual(next, name); } // Consumes contextual keyword if possible. @@ -135,10 +151,10 @@ export default class UtilParser extends Tokenizer { expectPlugin(name: string, pos?: ?number): true { if (!this.hasPlugin(name)) { - throw this.raise( + throw this.raiseWithData( pos != null ? pos : this.state.start, + { missingPlugin: [name] }, `This experimental syntax requires enabling the parser plugin: '${name}'`, - { missingPluginNames: [name] }, ); } @@ -147,27 +163,27 @@ export default class UtilParser extends Tokenizer { expectOnePlugin(names: Array, pos?: ?number): void { if (!names.some(n => this.hasPlugin(n))) { - throw this.raise( + throw this.raiseWithData( pos != null ? pos : this.state.start, + { missingPlugin: names }, `This experimental syntax requires enabling one of the following parser plugin(s): '${names.join( ", ", )}'`, - { missingPluginNames: names }, ); } } checkYieldAwaitInDefaultParams() { if ( - this.state.yieldPos && - (!this.state.awaitPos || this.state.yieldPos < this.state.awaitPos) + this.state.yieldPos !== -1 && + (this.state.awaitPos === -1 || this.state.yieldPos < this.state.awaitPos) ) { this.raise( this.state.yieldPos, "Yield cannot be used as name inside a generator function", ); } - if (this.state.awaitPos) { + if (this.state.awaitPos !== -1) { this.raise( this.state.awaitPos, "Await cannot be used as name inside an async function", @@ -175,26 +191,88 @@ export default class UtilParser extends Tokenizer { } } - strictDirective(start: number): boolean { - for (;;) { - // Try to find string literal. - skipWhiteSpace.lastIndex = start; - // $FlowIgnore - start += skipWhiteSpace.exec(this.input)[0].length; - const match = literal.exec(this.input.slice(start)); - if (!match) break; - if (match[2] === "use strict") return true; - start += match[0].length; - - // Skip semicolon, if any. - skipWhiteSpace.lastIndex = start; - // $FlowIgnore - start += skipWhiteSpace.exec(this.input)[0].length; - if (this.input[start] === ";") { - start++; + // tryParse will clone parser state. + // It is expensive and should be used with cautions + tryParse>( + fn: (abort: (node?: T) => empty) => T, + oldState: State = this.state.clone(), + ): + | TryParse + | TryParse + | TryParse { + const abortSignal: { node: T | null } = { node: null }; + try { + const node = fn((node = null) => { + abortSignal.node = node; + throw abortSignal; + }); + if (this.state.errors.length > oldState.errors.length) { + const failState = this.state; + this.state = oldState; + return { + node, + error: (failState.errors[oldState.errors.length]: SyntaxError), + thrown: false, + aborted: false, + failState, + }; + } + + return { + node, + error: null, + thrown: false, + aborted: false, + failState: null, + }; + } catch (error) { + const failState = this.state; + this.state = oldState; + if (error instanceof SyntaxError) { + return { node: null, error, thrown: true, aborted: false, failState }; + } + if (error === abortSignal) { + return { + node: abortSignal.node, + error: null, + thrown: false, + aborted: true, + failState, + }; } + + throw error; } + } - return false; + checkExpressionErrors( + refExpressionErrors: ?ExpressionErrors, + andThrow: boolean, + ) { + if (!refExpressionErrors) return false; + const { shorthandAssign, doubleProto } = refExpressionErrors; + if (!andThrow) return shorthandAssign >= 0 || doubleProto >= 0; + if (shorthandAssign >= 0) { + this.unexpected(shorthandAssign); + } + if (doubleProto >= 0) { + this.raise(doubleProto, Errors.DuplicateProto); + } } } + +/** + * The ExpressionErrors is a context struct used to track + * - **shorthandAssign**: track initializer `=` position when parsing ambiguous + * patterns. When we are sure the parsed pattern is a RHS, which means it is + * not a pattern, we will throw on this position on invalid assign syntax, + * otherwise it will be reset to -1 + * - **doubleProto**: track the duplicate `__proto__` key position when parsing + * ambiguous object patterns. When we are sure the parsed pattern is a RHS, + * which means it is an object literal, we will throw on this position for + * __proto__ redefinition, otherwise it will be reset to -1 + */ +export class ExpressionErrors { + shorthandAssign = -1; + doubleProto = -1; +} diff --git a/packages/babel-parser/src/plugin-utils.js b/packages/babel-parser/src/plugin-utils.js index c1cb6a6b7e92..021f98f1c083 100644 --- a/packages/babel-parser/src/plugin-utils.js +++ b/packages/babel-parser/src/plugin-utils.js @@ -39,6 +39,7 @@ export function getPluginOption( } const PIPELINE_PROPOSALS = ["minimal", "smart", "fsharp"]; +const RECORD_AND_TUPLE_SYNTAX_TYPES = ["hash", "bar"]; export function validatePlugins(plugins: PluginList) { if (hasPlugin(plugins, "decorators")) { @@ -69,6 +70,10 @@ export function validatePlugins(plugins: PluginList) { throw new Error("Cannot combine flow and typescript plugins."); } + if (hasPlugin(plugins, "placeholders") && hasPlugin(plugins, "v8intrinsic")) { + throw new Error("Cannot combine placeholders and v8intrinsic plugins."); + } + if ( hasPlugin(plugins, "pipelineOperator") && !PIPELINE_PROPOSALS.includes( @@ -80,6 +85,18 @@ export function validatePlugins(plugins: PluginList) { PIPELINE_PROPOSALS.map(p => `'${p}'`).join(", "), ); } + + if ( + hasPlugin(plugins, "recordAndTuple") && + !RECORD_AND_TUPLE_SYNTAX_TYPES.includes( + getPluginOption(plugins, "recordAndTuple", "syntaxType"), + ) + ) { + throw new Error( + "'recordAndTuple' requires 'syntaxType' option whose value should be one of: " + + RECORD_AND_TUPLE_SYNTAX_TYPES.map(p => `'${p}'`).join(", "), + ); + } } // These plugins are defined using a mixin which extends the parser class. @@ -89,6 +106,7 @@ import flow from "./plugins/flow"; import jsx from "./plugins/jsx"; import typescript from "./plugins/typescript"; import placeholders from "./plugins/placeholders"; +import v8intrinsic from "./plugins/v8intrinsic"; // NOTE: order is important. estree must come first; placeholders must come last. export const mixinPlugins: { [name: string]: MixinPlugin } = { @@ -96,6 +114,7 @@ export const mixinPlugins: { [name: string]: MixinPlugin } = { jsx, flow, typescript, + v8intrinsic, placeholders, }; diff --git a/packages/babel-parser/src/plugins/estree.js b/packages/babel-parser/src/plugins/estree.js index a407b8ac84ca..1f04b03e3091 100644 --- a/packages/babel-parser/src/plugins/estree.js +++ b/packages/babel-parser/src/plugins/estree.js @@ -2,9 +2,11 @@ import { types as tt, TokenType } from "../tokenizer/types"; import type Parser from "../parser"; +import type { ExpressionErrors } from "../parser/util"; import * as N from "../types"; -import type { Pos, Position } from "../util/location"; +import type { Position } from "../util/location"; import { type BindingTypes, BIND_NONE } from "../util/scopeflags"; +import { Errors } from "../parser/location"; function isSimpleProperty(node: N.Node): boolean { return ( @@ -31,6 +33,16 @@ export default (superClass: Class): Class => return node; } + estreeParseBigIntLiteral(value: any): N.Node { + // https://github.com/estree/estree/blob/master/es2020.md#bigintliteral + // $FlowIgnore + const bigInt = typeof BigInt !== "undefined" ? BigInt(value) : null; + const node = this.estreeParseLiteral(bigInt); + node.bigint = String(node.value || value); + + return node; + } + estreeParseLiteral(value: any): N.Node { return this.parseLiteral(value, "Literal"); } @@ -88,18 +100,16 @@ export default (superClass: Class): Class => const paramCount = prop.kind === "get" ? 0 : 1; const start = prop.start; if (prop.value.params.length !== paramCount) { - if (prop.kind === "get") { - this.raise(start, "getter must not have any formal parameters"); + if (method.kind === "get") { + this.raise(start, Errors.BadGetterArity); } else { - this.raise(start, "setter must have exactly one formal parameter"); + this.raise(start, Errors.BadSetterArity); } - } - - if (prop.kind === "set" && prop.value.params[0].type === "RestElement") { - this.raise( - start, - "setter function argument must not be a rest parameter", - ); + } else if ( + prop.kind === "set" && + prop.value.params[0].type === "RestElement" + ) { + this.raise(start, Errors.BadSetterRestParameter); } } @@ -108,6 +118,7 @@ export default (superClass: Class): Class => bindingType: BindingTypes = BIND_NONE, checkClashes: ?{ [key: string]: boolean }, contextDescription: string, + disallowLetBinding?: boolean, ): void { switch (expr.type) { case "ObjectPattern": @@ -117,17 +128,25 @@ export default (superClass: Class): Class => bindingType, checkClashes, "object destructuring pattern", + disallowLetBinding, ); }); break; default: - super.checkLVal(expr, bindingType, checkClashes, contextDescription); + super.checkLVal( + expr, + bindingType, + checkClashes, + contextDescription, + disallowLetBinding, + ); } } - checkPropClash( + checkDuplicatedProto( prop: N.ObjectMember | N.SpreadElement, - propHash: { [key: string]: boolean }, + protoRef: { used: boolean }, + refExpressionErrors: ?ExpressionErrors, ): void { if ( prop.type === "SpreadElement" || @@ -144,31 +163,17 @@ export default (superClass: Class): Class => const name = key.type === "Identifier" ? key.name : String(key.value); if (name === "__proto__" && prop.kind === "init") { - if (propHash.proto) { - this.raise(key.start, "Redefinition of __proto__ property"); - } - propHash.proto = true; - } - } - - isStrictBody(node: { body: N.BlockStatement }): boolean { - const isBlockStatement = node.body.type === "BlockStatement"; - - if (isBlockStatement && node.body.body.length > 0) { - for (const directive of node.body.body) { - if ( - directive.type === "ExpressionStatement" && - directive.expression.type === "Literal" - ) { - if (directive.expression.value === "use strict") return true; + // Store the first redefinition's position + if (protoRef.used) { + if (refExpressionErrors && refExpressionErrors.doubleProto === -1) { + refExpressionErrors.doubleProto = key.start; } else { - // Break for the first non literal expression - break; + this.raise(key.start, Errors.DuplicateProto); } } - } - return false; + protoRef.used = true; + } } isValidDirective(stmt: N.Statement): boolean { @@ -231,15 +236,18 @@ export default (superClass: Class): Class => classBody.body.push(method); } - parseExprAtom(refShorthandDefaultPos?: ?Pos): N.Expression { + parseExprAtom(refExpressionErrors?: ?ExpressionErrors): N.Expression { switch (this.state.type) { - case tt.regexp: - return this.estreeParseRegExpLiteral(this.state.value); - case tt.num: case tt.string: return this.estreeParseLiteral(this.state.value); + case tt.regexp: + return this.estreeParseRegExpLiteral(this.state.value); + + case tt.bigint: + return this.estreeParseBigIntLiteral(this.state.value); + case tt._null: return this.estreeParseLiteral(null); @@ -250,7 +258,7 @@ export default (superClass: Class): Class => return this.estreeParseLiteral(false); default: - return super.parseExprAtom(refShorthandDefaultPos); + return super.parseExprAtom(refExpressionErrors); } } @@ -334,14 +342,14 @@ export default (superClass: Class): Class => startPos: ?number, startLoc: ?Position, isPattern: boolean, - refShorthandDefaultPos: ?Pos, + refExpressionErrors: ?ExpressionErrors, ): ?N.ObjectProperty { const node: N.EstreeProperty = (super.parseObjectProperty( prop, startPos, startLoc, isPattern, - refShorthandDefaultPos, + refExpressionErrors, ): any); if (node) { @@ -352,34 +360,75 @@ export default (superClass: Class): Class => return (node: any); } - toAssignable( - node: N.Node, - isBinding: ?boolean, - contextDescription: string, - ): N.Node { + toAssignable(node: N.Node): N.Node { if (isSimpleProperty(node)) { - this.toAssignable(node.value, isBinding, contextDescription); + this.toAssignable(node.value); return node; } - return super.toAssignable(node, isBinding, contextDescription); + return super.toAssignable(node); } - toAssignableObjectExpressionProp( - prop: N.Node, - isBinding: ?boolean, - isLast: boolean, - ) { + toAssignableObjectExpressionProp(prop: N.Node, isLast: boolean) { if (prop.kind === "get" || prop.kind === "set") { - this.raise( - prop.key.start, - "Object pattern can't contain getter or setter", - ); + throw this.raise(prop.key.start, Errors.PatternHasAccessor); } else if (prop.method) { - this.raise(prop.key.start, "Object pattern can't contain methods"); + throw this.raise(prop.key.start, Errors.PatternHasMethod); } else { - super.toAssignableObjectExpressionProp(prop, isBinding, isLast); + super.toAssignableObjectExpressionProp(prop, isLast); } } + + finishCallExpression( + node: T, + optional: boolean, + ): N.Expression { + super.finishCallExpression(node, optional); + + if (node.callee.type === "Import") { + ((node: N.Node): N.EstreeImportExpression).type = "ImportExpression"; + ((node: N.Node): N.EstreeImportExpression).source = node.arguments[0]; + delete node.arguments; + delete node.callee; + } + + return node; + } + + toReferencedListDeep( + exprList: $ReadOnlyArray, + isParenthesizedExpr?: boolean, + ): void { + // ImportExpressions do not have an arguments array. + if (!exprList) { + return; + } + + super.toReferencedListDeep(exprList, isParenthesizedExpr); + } + + parseExport(node: N.Node) { + super.parseExport(node); + + switch (node.type) { + case "ExportAllDeclaration": + node.exported = null; + break; + + case "ExportNamedDeclaration": + if ( + node.specifiers.length === 1 && + node.specifiers[0].type === "ExportNamespaceSpecifier" + ) { + node.type = "ExportAllDeclaration"; + node.exported = node.specifiers[0].exported; + delete node.specifiers; + } + + break; + } + + return node; + } }; diff --git a/packages/babel-parser/src/plugins/flow.js b/packages/babel-parser/src/plugins/flow.js index 024a21baa5ab..f6d81fb6d1f2 100644 --- a/packages/babel-parser/src/plugins/flow.js +++ b/packages/babel-parser/src/plugins/flow.js @@ -1,5 +1,7 @@ // @flow +/*:: declare var invariant; */ + import type Parser from "../parser"; import { types as tt, type TokenType } from "../tokenizer/types"; import * as N from "../types"; @@ -10,20 +12,27 @@ import { types as tc } from "../tokenizer/context"; import * as charCodes from "charcodes"; import { isIteratorStart } from "../util/identifier"; import { - functionFlags, type BindingTypes, BIND_NONE, BIND_LEXICAL, + BIND_VAR, + BIND_FUNCTION, SCOPE_ARROW, + SCOPE_FUNCTION, SCOPE_OTHER, } from "../util/scopeflags"; +import type { ExpressionErrors } from "../parser/util"; +import { Errors } from "../parser/location"; -const reservedTypes = [ +const reservedTypes = new Set([ + "_", "any", "bool", "boolean", "empty", + "extends", "false", + "interface", "mixed", "null", "number", @@ -32,10 +41,84 @@ const reservedTypes = [ "true", "typeof", "void", - "interface", - "extends", - "_", -]; +]); + +/* eslint sort-keys: "error" */ +// The Errors key follows https://github.com/facebook/flow/blob/master/src/parser/parse_error.ml unless it does not exist +const FlowErrors = Object.freeze({ + AmbiguousConditionalArrow: + "Ambiguous expression: wrap the arrow functions in parentheses to disambiguate.", + 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 or they are a CommonJS module", + AssignReservedType: "Cannot overwrite reserved type %0", + DeclareClassElement: + "The `declare` modifier can only appear on class fields.", + DeclareClassFieldInitializer: + "Initializers are not allowed in fields with the `declare` modifier.", + DuplicateDeclareModuleExports: "Duplicate `declare module.exports` statement", + EnumBooleanMemberNotInitialized: + "Boolean enum members need to be initialized. Use either `%0 = true,` or `%0 = false,` in enum `%1`.", + EnumDuplicateMemberName: + "Enum member names need to be unique, but the name `%0` has already been used before in enum `%1`.", + EnumInconsistentMemberValues: + "Enum `%0` has inconsistent member initializers. Either use no initializers, or consistently use literals (either booleans, numbers, or strings) for all member initializers.", + EnumInvalidExplicitType: + "Enum type `%1` is not valid. Use one of `boolean`, `number`, `string`, or `symbol` in enum `%0`.", + EnumInvalidExplicitTypeUnknownSupplied: + "Supplied enum type is not valid. Use one of `boolean`, `number`, `string`, or `symbol` in enum `%0`.", + EnumInvalidMemberInitializerPrimaryType: + "Enum `%0` has type `%2`, so the initializer of `%1` needs to be a %2 literal.", + EnumInvalidMemberInitializerSymbolType: + "Symbol enum members cannot be initialized. Use `%1,` in enum `%0`.", + EnumInvalidMemberInitializerUnknownType: + "The enum member initializer for `%1` needs to be a literal (either a boolean, number, or string) in enum `%0`.", + EnumInvalidMemberName: + "Enum member names cannot start with lowercase 'a' through 'z'. Instead of using `%0`, consider using `%1`, in enum `%2`.", + EnumNumberMemberNotInitialized: + "Number enum members need to be initialized, e.g. `%1 = 1` in enum `%0`.", + EnumStringMemberInconsistentlyInitailized: + "String enum members need to consistently either all use initializers, or use no initializers, in enum `%0`.", + 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", + InexactInsideExact: + "Explicit inexact syntax cannot appear inside an explicit exact object type", + InexactInsideNonObject: + "Explicit inexact syntax cannot appear in class or interface definitions", + InexactVariance: "Explicit inexact syntax cannot have variance", + InvalidNonTypeImportInDeclareModule: + "Imports within a `declare module` body must always be `import type` or `import typeof`", + MissingTypeParamDefault: + "Type parameter declaration needs a default, since a preceding type parameter declaration has a default.", + NestedDeclareModule: + "`declare module` cannot be used inside another `declare module`", + NestedFlowComment: "Cannot have a flow comment inside another flow comment", + OptionalBindingPattern: + "A binding pattern parameter cannot be optional in an implementation signature.", + SpreadVariance: "Spread properties cannot have variance", + TypeBeforeInitializer: + "Type annotations must come before default assignments, e.g. instead of `age = 25: number` use `age: number = 25`", + TypeCastInPattern: + "The type cast expression is expected to be wrapped with parenthesis", + UnexpectedExplicitInexactInObject: + "Explicit inexact syntax must appear at the end of an inexact object", + UnexpectedReservedType: "Unexpected reserved type %0", + UnexpectedReservedUnderscore: + "`_` is only allowed as a type argument to call or new", + UnexpectedSpaceBetweenModuloChecks: + "Spaces between `%` and `checks` are not allowed here.", + UnexpectedSpreadType: + "Spread operator cannot appear in class or interface definitions", + UnexpectedSubtractionOperand: + 'Unexpected token, expected "number" or "bigint"', + UnexpectedTokenAfterTypeParameter: + "Expected an arrow function after this type parameter declaration", + UnsupportedDeclareExportKind: + "`declare export %0` is not supported. Use `%1` instead", + UnsupportedStatementInDeclareModule: + "Only declares and type imports are allowed inside declare module", + UnterminatedFlowComment: "Unterminated flow-comment", +}); +/* eslint-disable sort-keys */ function isEsModuleType(bodyElement: N.Node): boolean { return ( @@ -79,6 +162,20 @@ function partition( const FLOW_PRAGMA_REGEX = /\*?\s*@((?:no)?flow)\b/; +// Flow enums types +type EnumExplicitType = null | "boolean" | "number" | "string" | "symbol"; +type EnumContext = {| + enumName: string, + explicitType: EnumExplicitType, + memberName: string, +|}; +type EnumMemberInit = + | {| type: "number", pos: number, value: N.Node |} + | {| type: "string", pos: number, value: N.Node |} + | {| type: "boolean", pos: number, value: N.Node |} + | {| type: "invalid", pos: number |} + | {| type: "none", pos: number |}; + export default (superClass: Class): Class => class extends superClass { // The value of the @flow/@noflow pragma. Initially undefined, transitions @@ -95,6 +192,10 @@ export default (superClass: Class): Class => return this.getPluginOption("flow", "all") || this.flowPragma === "flow"; } + shouldParseEnums(): boolean { + return !!this.getPluginOption("flow", "enums"); + } + finishToken(type: TokenType, val: any): void { if ( type !== tt.string && @@ -147,10 +248,7 @@ export default (superClass: Class): Class => moduloLoc.line !== checksLoc.line || moduloLoc.column !== checksLoc.column - 1 ) { - this.raise( - moduloPos, - "Spaces between ´%´ and ´checks´ are not allowed here.", - ); + this.raise(moduloPos, FlowErrors.UnexpectedSpaceBetweenModuloChecks); } if (this.eat(tt.parenL)) { node.value = this.parseExpression(); @@ -243,10 +341,7 @@ export default (superClass: Class): Class => return this.flowParseDeclareModuleExports(node); } else { if (insideModule) { - this.unexpected( - this.state.lastTokStart, - "`declare module` cannot be used inside another `declare module`", - ); + this.raise(this.state.lastTokStart, FlowErrors.NestedDeclareModule); } return this.flowParseDeclareModule(node); } @@ -270,6 +365,7 @@ export default (superClass: Class): Class => node.id = this.flowParseTypeAnnotatableIdentifier( /*allowPrimitiveOverride*/ true, ); + this.scope.declareName(node.id.name, BIND_VAR, node.id.start); this.semicolon(); return this.finishNode(node, "DeclareVariable"); } @@ -292,16 +388,16 @@ export default (superClass: Class): Class => if (this.match(tt._import)) { this.next(); if (!this.isContextual("type") && !this.match(tt._typeof)) { - this.unexpected( + this.raise( this.state.lastTokStart, - "Imports within a `declare module` body must always be `import type` or `import typeof`", + FlowErrors.InvalidNonTypeImportInDeclareModule, ); } this.parseImport(bodyNode); } else { this.expectContextual( "declare", - "Only declares and type imports are allowed inside declare module", + FlowErrors.UnsupportedStatementInDeclareModule, ); bodyNode = this.flowParseDeclare(bodyNode, true); @@ -318,23 +414,28 @@ export default (superClass: Class): Class => let kind = null; let hasModuleExport = false; - const errorMessage = - "Found both `declare module.exports` and `declare export` in the same module. " + - "Modules can only have 1 since they are either an ES module or they are a CommonJS module"; body.forEach(bodyElement => { if (isEsModuleType(bodyElement)) { if (kind === "CommonJS") { - this.unexpected(bodyElement.start, errorMessage); + this.raise( + bodyElement.start, + FlowErrors.AmbiguousDeclareModuleKind, + ); } kind = "ES"; } else if (bodyElement.type === "DeclareModuleExports") { if (hasModuleExport) { - this.unexpected( + this.raise( bodyElement.start, - "Duplicate `declare module.exports` statement", + FlowErrors.DuplicateDeclareModuleExports, + ); + } + if (kind === "ES") { + this.raise( + bodyElement.start, + FlowErrors.AmbiguousDeclareModuleKind, ); } - if (kind === "ES") this.unexpected(bodyElement.start, errorMessage); kind = "CommonJS"; hasModuleExport = true; } @@ -372,9 +473,11 @@ export default (superClass: Class): Class => ) { const label = this.state.value; const suggestion = exportSuggestions[label]; - this.unexpected( + throw this.raise( this.state.start, - `\`declare export ${label}\` is not supported. Use \`${suggestion}\` instead`, + FlowErrors.UnsupportedDeclareExportKind, + label, + suggestion, ); } @@ -460,7 +563,16 @@ export default (superClass: Class): Class => node: N.FlowDeclare, isClass?: boolean = false, ): void { - node.id = this.flowParseRestrictedIdentifier(/*liberal*/ !isClass); + node.id = this.flowParseRestrictedIdentifier( + /* liberal */ !isClass, + /* declaration */ true, + ); + + this.scope.declareName( + node.id.name, + isClass ? BIND_FUNCTION : BIND_LEXICAL, + node.id.start, + ); if (this.isRelational("<")) { node.typeParameters = this.flowParseTypeParameterDeclaration(); @@ -521,28 +633,37 @@ export default (superClass: Class): Class => checkNotUnderscore(word: string) { if (word === "_") { - throw this.unexpected( - null, - "`_` is only allowed as a type argument to call or new", - ); + this.raise(this.state.start, FlowErrors.UnexpectedReservedUnderscore); } } - checkReservedType(word: string, startLoc: number) { - if (reservedTypes.indexOf(word) > -1) { - this.raise(startLoc, `Cannot overwrite reserved type ${word}`); - } + checkReservedType(word: string, startLoc: number, declaration?: boolean) { + if (!reservedTypes.has(word)) return; + + this.raise( + startLoc, + declaration + ? FlowErrors.AssignReservedType + : FlowErrors.UnexpectedReservedType, + word, + ); } - flowParseRestrictedIdentifier(liberal?: boolean): N.Identifier { - this.checkReservedType(this.state.value, this.state.start); + flowParseRestrictedIdentifier( + liberal?: boolean, + declaration?: boolean, + ): N.Identifier { + this.checkReservedType(this.state.value, this.state.start, declaration); return this.parseIdentifier(liberal); } // Type aliases flowParseTypeAlias(node: N.FlowTypeAlias): N.FlowTypeAlias { - node.id = this.flowParseRestrictedIdentifier(); + node.id = this.flowParseRestrictedIdentifier( + /* liberal */ false, + /* declaration */ true, + ); this.scope.declareName(node.id.name, BIND_LEXICAL, node.id.start); if (this.isRelational("<")) { @@ -562,7 +683,10 @@ export default (superClass: Class): Class => declare: boolean, ): N.FlowOpaqueType { this.expectContextual("type"); - node.id = this.flowParseRestrictedIdentifier(/*liberal*/ true); + node.id = this.flowParseRestrictedIdentifier( + /* liberal */ true, + /* declaration */ true, + ); this.scope.declareName(node.id.name, BIND_LEXICAL, node.id.start); if (this.isRelational("<")) { @@ -605,11 +729,7 @@ export default (superClass: Class): Class => node.default = this.flowParseType(); } else { if (requireDefault) { - this.unexpected( - nodeStart, - // eslint-disable-next-line max-len - "Type parameter declaration needs a default, since a preceding type parameter declaration has a default.", - ); + this.raise(nodeStart, FlowErrors.MissingTypeParamDefault); } } @@ -851,6 +971,7 @@ export default (superClass: Class): Class => while (!this.match(endDelim)) { let isStatic = false; let protoStart: ?number = null; + let inexactStart: ?number = null; const node = this.startNode(); if (allowProto && this.isContextual("proto")) { @@ -923,17 +1044,29 @@ export default (superClass: Class): Class => variance, kind, allowSpread, - allowInexact, + allowInexact ?? !exact, ); if (propOrInexact === null) { inexact = true; + inexactStart = this.state.lastTokStart; } else { nodeStart.properties.push(propOrInexact); } } this.flowObjectTypeSemicolon(); + + if ( + inexactStart && + !this.match(tt.braceR) && + !this.match(tt.braceBarR) + ) { + this.raise( + inexactStart, + FlowErrors.UnexpectedExplicitInexactInObject, + ); + } } this.expect(endDelim); @@ -963,46 +1096,39 @@ export default (superClass: Class): Class => allowSpread: boolean, allowInexact: boolean, ): (N.FlowObjectTypeProperty | N.FlowObjectTypeSpreadProperty) | null { - if (this.match(tt.ellipsis)) { + if (this.eat(tt.ellipsis)) { + const isInexactToken = + this.match(tt.comma) || + this.match(tt.semi) || + this.match(tt.braceR) || + this.match(tt.braceBarR); + + if (isInexactToken) { + if (!allowSpread) { + this.raise( + this.state.lastTokStart, + FlowErrors.InexactInsideNonObject, + ); + } else if (!allowInexact) { + this.raise(this.state.lastTokStart, FlowErrors.InexactInsideExact); + } + if (variance) { + this.raise(variance.start, FlowErrors.InexactVariance); + } + + return null; + } + if (!allowSpread) { - this.unexpected( - null, - "Spread operator cannot appear in class or interface definitions", - ); + this.raise(this.state.lastTokStart, FlowErrors.UnexpectedSpreadType); } if (protoStart != null) { this.unexpected(protoStart); } if (variance) { - this.unexpected( - variance.start, - "Spread properties cannot have variance", - ); + this.raise(variance.start, FlowErrors.SpreadVariance); } - this.expect(tt.ellipsis); - const isInexactToken = this.eat(tt.comma) || this.eat(tt.semi); - if (this.match(tt.braceR)) { - if (allowInexact) return null; - this.unexpected( - null, - "Explicit inexact syntax is only allowed inside inexact objects", - ); - } - - if (this.match(tt.braceBarR)) { - this.unexpected( - null, - "Explicit inexact syntax cannot appear inside an explicit exact object type", - ); - } - - if (isInexactToken) { - this.unexpected( - null, - "Explicit inexact syntax must appear at the end of an inexact object", - ); - } node.argument = this.flowParseType(); return this.finishNode(node, "ObjectTypeSpreadProperty"); } else { @@ -1058,17 +1184,14 @@ export default (superClass: Class): Class => property.value.params.length + (property.value.rest ? 1 : 0); if (length !== paramCount) { if (property.kind === "get") { - this.raise(start, "getter must not have any formal parameters"); + this.raise(start, Errors.BadGetterArity); } else { - this.raise(start, "setter must have exactly one formal parameter"); + this.raise(start, Errors.BadSetterArity); } } if (property.kind === "set" && property.value.rest) { - this.raise( - start, - "setter function argument must not be a rest parameter", - ); + this.raise(start, Errors.BadSetterRestParameter); } } @@ -1090,12 +1213,12 @@ export default (superClass: Class): Class => ): N.FlowQualifiedTypeIdentifier { startPos = startPos || this.state.start; startLoc = startLoc || this.state.startLoc; - let node = id || this.parseIdentifier(); + let node = id || this.flowParseRestrictedIdentifier(true); while (this.eat(tt.dot)) { const node2 = this.startNodeAt(startPos, startLoc); node2.qualification = node; - node2.id = this.parseIdentifier(); + node2.id = this.flowParseRestrictedIdentifier(true); node = this.finishNode(node2, "QualifiedTypeIdentifier"); } @@ -1213,6 +1336,9 @@ export default (superClass: Class): Class => case "string": return this.finishNode(node, "StringTypeAnnotation"); + case "symbol": + return this.finishNode(node, "SymbolTypeAnnotation"); + default: this.checkNotUnderscore(id.name); return this.flowParseGenericType(startPos, startLoc, id); @@ -1373,13 +1499,13 @@ export default (superClass: Class): Class => ); } - this.unexpected( - null, - `Unexpected token, expected "number" or "bigint"`, + throw this.raise( + this.state.start, + FlowErrors.UnexpectedSubtractionOperand, ); } - this.unexpected(); + throw this.unexpected(); case tt.num: return this.parseLiteral( this.state.value, @@ -1595,7 +1721,7 @@ export default (superClass: Class): Class => super.parseFunctionBodyAndFinish(node, type, isMethod); } - // interfaces + // interfaces and enums parseStatement(context: ?string, topLevel?: boolean): N.Statement { // strict mode handling of `interface` since it's a reserved word if ( @@ -1606,6 +1732,10 @@ export default (superClass: Class): Class => const node = this.startNode(); this.next(); return this.flowParseInterface(node); + } else if (this.shouldParseEnums() && this.isContextual("enum")) { + const node = this.startNode(); + this.next(); + return this.flowParseEnumDeclaration(node); } else { const stmt = super.parseStatement(context, topLevel); // We will parse a flow pragma in any comment before the first statement. @@ -1652,6 +1782,7 @@ export default (superClass: Class): Class => this.isContextual("type") || this.isContextual("interface") || this.isContextual("opaque") || + (this.shouldParseEnums() && this.isContextual("enum")) || super.shouldParseExportDeclaration() ); } @@ -1661,7 +1792,8 @@ export default (superClass: Class): Class => this.match(tt.name) && (this.state.value === "type" || this.state.value === "interface" || - this.state.value === "opaque") + this.state.value === "opaque" || + (this.shouldParseEnums() && this.state.value === "enum")) ) { return false; } @@ -1669,6 +1801,15 @@ export default (superClass: Class): Class => return super.isExportDefaultSpecifier(); } + parseExportDefaultExpression(): N.Expression | N.Declaration { + if (this.shouldParseEnums() && this.isContextual("enum")) { + const node = this.startNode(); + this.next(); + return this.flowParseEnumDeclaration(node); + } + return super.parseExportDefaultExpression(); + } + parseConditional( expr: N.Expression, noIn: ?boolean, @@ -1678,23 +1819,23 @@ export default (superClass: Class): Class => ): N.Expression { if (!this.match(tt.question)) return expr; - // only do the expensive clone if there is a question mark + // only use the expensive "tryParse" method if there is a question mark // and if we come from inside parens if (refNeedsArrowPos) { - const state = this.state.clone(); - try { - return super.parseConditional(expr, noIn, startPos, startLoc); - } catch (err) { - if (err instanceof SyntaxError) { - this.state = state; - refNeedsArrowPos.start = err.pos || this.state.start; - return expr; - } else { - // istanbul ignore next: no such error is expected - throw err; - } + const result = this.tryParse(() => + super.parseConditional(expr, noIn, startPos, startLoc), + ); + + if (!result.node) { + // $FlowIgnore + refNeedsArrowPos.start = result.error.pos || this.state.start; + return expr; } + + if (result.error) this.state = result.failState; + return result.node; } + this.expect(tt.question); const state = this.state.clone(); const originalNoArrowAt = this.state.noArrowAt; @@ -1723,10 +1864,7 @@ export default (superClass: Class): Class => // e.g. Source: a ? (b): c => (d): e => f // Result 1: a ? b : (c => ((d): e => f)) // Result 2: a ? ((b): c => d) : (e => f) - this.raise( - state.start, - "Ambiguous expression: wrap the arrow functions in parentheses to disambiguate.", - ); + this.raise(state.start, FlowErrors.AmbiguousConditionalArrow); } if (failed && valid.length === 1) { @@ -1734,10 +1872,10 @@ export default (superClass: Class): Class => this.state.noArrowAt = noArrowAt.concat(valid[0].start); ({ consequent, failed } = this.tryParseConditionalConsequent()); } - - this.getArrowLikeExpressions(consequent, true); } + this.getArrowLikeExpressions(consequent, true); + this.state.noArrowAt = originalNoArrowAt; this.expect(tt.colon); @@ -1783,18 +1921,7 @@ export default (superClass: Class): Class => if (node.type === "ArrowFunctionExpression") { if (node.typeParameters || !node.returnType) { // This is an arrow expression without ambiguity, so check its parameters - this.toAssignableList( - // node.params is Expression[] instead of $ReadOnlyArray because it - // has not been converted yet. - ((node.params: any): N.Expression[]), - true, - "arrow function parameters", - ); - // Enter scope, as checkParams defines bindings - this.scope.enter(functionFlags(false, false) | SCOPE_ARROW); - // Use super's method to force the parameters to be checked - super.checkParams(node, false, true); - this.scope.exit(); + this.finishArrowValidation(node); } else { arrows.push(node); } @@ -1806,28 +1933,27 @@ export default (superClass: Class): Class => } if (disallowInvalid) { - for (let i = 0; i < arrows.length; i++) { - this.toAssignableList( - ((node.params: any): N.Expression[]), - true, - "arrow function parameters", - ); - } + arrows.forEach(node => this.finishArrowValidation(node)); return [arrows, []]; } - return partition(arrows, node => { - try { - this.toAssignableList( - ((node.params: any): N.Expression[]), - true, - "arrow function parameters", - ); - return true; - } catch (err) { - return false; - } - }); + return partition(arrows, node => + node.params.every(param => this.isAssignable(param, true)), + ); + } + + finishArrowValidation(node: N.ArrowFunctionExpression) { + this.toAssignableList( + // node.params is Expression[] instead of $ReadOnlyArray because it + // has not been converted yet. + ((node.params: any): N.Expression[]), + node.extra?.trailingComma, + ); + // Enter scope, as checkParams defines bindings + this.scope.enter(SCOPE_FUNCTION | SCOPE_ARROW); + // Use super's method to force the parameters to be checked + super.checkParams(node, false, true); + this.scope.exit(); } forwardNoArrowParamsConversionAt(node: N.Node, parse: () => T): T { @@ -1923,6 +2049,11 @@ export default (superClass: Class): Class => const declarationNode = this.startNode(); this.next(); return this.flowParseInterface(declarationNode); + } else if (this.shouldParseEnums() && this.isContextual("enum")) { + node.exportKind = "value"; + const declarationNode = this.startNode(); + this.next(); + return this.flowParseEnumDeclaration(declarationNode); } else { return super.parseExportDeclaration(node); } @@ -1957,6 +2088,39 @@ export default (superClass: Class): Class => } } + parseClassMember( + classBody: N.ClassBody, + member: any, + state: { hadConstructor: boolean }, + constructorAllowsSuper: boolean, + ): void { + const pos = this.state.start; + if (this.isContextual("declare")) { + if (this.parseClassMemberFromModifier(classBody, member)) { + // 'declare' is a class element name + return; + } + + member.declare = true; + } + + super.parseClassMember(classBody, member, state, constructorAllowsSuper); + + if (member.declare) { + if ( + member.type !== "ClassProperty" && + member.type !== "ClassPrivateProperty" + ) { + this.raise(pos, FlowErrors.DeclareClassElement); + } else if (member.value) { + this.raise( + member.value.start, + FlowErrors.DeclareClassFieldInitializer, + ); + } + } + } + // ensure that inside flow types, we bypass the jsx parser plugin getTokenFromCode(code: number): void { const next = this.input.charCodeAt(this.state.pos + 1); @@ -1975,27 +2139,62 @@ export default (superClass: Class): Class => } } - toAssignable( - node: N.Node, - isBinding: ?boolean, - contextDescription: string, - ): N.Node { + isAssignable(node: N.Node, isBinding?: boolean): boolean { + switch (node.type) { + case "Identifier": + case "ObjectPattern": + case "ArrayPattern": + case "AssignmentPattern": + return true; + + case "ObjectExpression": { + const last = node.properties.length - 1; + return node.properties.every((prop, i) => { + return ( + prop.type !== "ObjectMethod" && + (i === last || prop.type === "SpreadElement") && + this.isAssignable(prop) + ); + }); + } + + case "ObjectProperty": + return this.isAssignable(node.value); + + case "SpreadElement": + return this.isAssignable(node.argument); + + case "ArrayExpression": + return node.elements.every(element => this.isAssignable(element)); + + case "AssignmentExpression": + return node.operator === "="; + + case "ParenthesizedExpression": + case "TypeCastExpression": + return this.isAssignable(node.expression); + + case "MemberExpression": + case "OptionalMemberExpression": + return !isBinding; + + default: + return false; + } + } + + toAssignable(node: N.Node): N.Node { if (node.type === "TypeCastExpression") { - return super.toAssignable( - this.typeCastToParameter(node), - isBinding, - contextDescription, - ); + return super.toAssignable(this.typeCastToParameter(node)); } else { - return super.toAssignable(node, isBinding, contextDescription); + return super.toAssignable(node); } } // turn type casts that we found in function parameter head into type annotated params toAssignableList( exprList: N.Expression[], - isBinding: ?boolean, - contextDescription: string, + trailingCommaPos?: ?number, ): $ReadOnlyArray { for (let i = 0; i < exprList.length; i++) { const expr = exprList[i]; @@ -2003,7 +2202,7 @@ export default (superClass: Class): Class => exprList[i] = this.typeCastToParameter(expr); } } - return super.toAssignableList(exprList, isBinding, contextDescription); + return super.toAssignableList(exprList, trailingCommaPos); } // this is a list of nodes, from something like a call expression, we need to filter the @@ -2020,10 +2219,7 @@ export default (superClass: Class): Class => (!expr.extra || !expr.extra.parenthesized) && (exprList.length > 1 || !isParenthesizedExpr) ) { - this.raise( - expr.typeAnnotation.start, - "The type cast expression is expected to be wrapped with parenthesis", - ); + this.raise(expr.typeAnnotation.start, FlowErrors.TypeCastInPattern); } } @@ -2145,9 +2341,10 @@ export default (superClass: Class): Class => parsePropertyName( node: N.ObjectOrClassMember | N.ClassMember | N.TsNamedTypeElementBase, + isPrivateNameAllowed: boolean, ): N.Identifier { const variance = this.flowParseVariance(); - const key = super.parsePropertyName(node); + const key = super.parsePropertyName(node, isPrivateNameAllowed); // $FlowIgnore ("variance" not defined on TsNamedTypeElementBase) node.variance = variance; return key; @@ -2161,7 +2358,7 @@ export default (superClass: Class): Class => isGenerator: boolean, isAsync: boolean, isPattern: boolean, - refShorthandDefaultPos: ?Pos, + refExpressionErrors: ?ExpressionErrors, containsEsc: boolean, ): void { if ((prop: $FlowFixMe).variance) { @@ -2184,7 +2381,7 @@ export default (superClass: Class): Class => isGenerator, isAsync, isPattern, - refShorthandDefaultPos, + refExpressionErrors, containsEsc, ); @@ -2197,13 +2394,10 @@ export default (superClass: Class): Class => parseAssignableListItemTypes(param: N.Pattern): N.Pattern { if (this.eat(tt.question)) { if (param.type !== "Identifier") { - throw this.raise( - param.start, - "A binding pattern parameter cannot be optional in an implementation signature.", - ); + this.raise(param.start, FlowErrors.OptionalBindingPattern); } - param.optional = true; + ((param: any): N.Identifier).optional = true; } if (this.match(tt.colon)) { param.typeAnnotation = this.flowParseTypeAnnotation(); @@ -2224,11 +2418,7 @@ export default (superClass: Class): Class => node.typeAnnotation && node.right.start < node.typeAnnotation.start ) { - this.raise( - node.typeAnnotation.start, - "Type annotations must come before default assignments, " + - "e.g. instead of `age = 25: number` use `age: number = 25`", - ); + this.raise(node.typeAnnotation.start, FlowErrors.TypeBeforeInitializer); } return node; @@ -2249,7 +2439,10 @@ export default (superClass: Class): Class => contextDescription: string, ): void { specifier.local = hasTypeImportKind(node) - ? this.flowParseRestrictedIdentifier(true) + ? this.flowParseRestrictedIdentifier( + /* liberal */ true, + /* declaration */ true, + ) : this.parseIdentifier(); this.checkLVal( @@ -2349,13 +2542,16 @@ export default (superClass: Class): Class => if (nodeIsTypeImport && specifierIsTypeImport) { this.raise( firstIdentLoc, - "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", + FlowErrors.ImportTypeShorthandOnlyInPureImport, ); } if (nodeIsTypeImport || specifierIsTypeImport) { - this.checkReservedType(specifier.local.name, specifier.local.start); + this.checkReservedType( + specifier.local.name, + specifier.local.start, + /* declaration */ true, + ); } if (isBinding && !nodeIsTypeImport && !specifierIsTypeImport) { @@ -2430,79 +2626,107 @@ export default (superClass: Class): Class => // 3. This is neither. Just call the super method parseMaybeAssign( noIn?: ?boolean, - refShorthandDefaultPos?: ?Pos, + refExpressionErrors?: ?ExpressionErrors, afterLeftParse?: Function, refNeedsArrowPos?: ?Pos, ): N.Expression { - let jsxError = null; + let state = null; + + let jsx; + if ( this.hasPlugin("jsx") && (this.match(tt.jsxTagStart) || this.isRelational("<")) ) { - const state = this.state.clone(); - try { - return super.parseMaybeAssign( - noIn, - refShorthandDefaultPos, - afterLeftParse, - refNeedsArrowPos, - ); - } catch (err) { - if (err instanceof SyntaxError) { - this.state = state; - - // Remove `tc.j_expr` and `tc.j_oTag` from context added - // by parsing `jsxTagStart` to stop the JSX plugin from - // messing with the tokens - const cLength = this.state.context.length; - if (this.state.context[cLength - 1] === tc.j_oTag) { - this.state.context.length -= 2; - } - - jsxError = err; - } else { - // istanbul ignore next: no such error is expected - throw err; - } + state = this.state.clone(); + + jsx = this.tryParse( + () => + super.parseMaybeAssign( + noIn, + refExpressionErrors, + afterLeftParse, + refNeedsArrowPos, + ), + state, + ); + /*:: invariant(!jsx.aborted) */ + + if (!jsx.error) return jsx.node; + + // Remove `tc.j_expr` and `tc.j_oTag` from context added + // by parsing `jsxTagStart` to stop the JSX plugin from + // messing with the tokens + const { context } = this.state; + if (context[context.length - 1] === tc.j_oTag) { + context.length -= 2; + } else if (context[context.length - 1] === tc.j_expr) { + context.length -= 1; } } - if (jsxError != null || this.isRelational("<")) { - let arrowExpression; + if ((jsx && jsx.error) || this.isRelational("<")) { + state = state || this.state.clone(); + let typeParameters; - try { + + const arrow = this.tryParse(() => { typeParameters = this.flowParseTypeParameterDeclaration(); - arrowExpression = this.forwardNoArrowParamsConversionAt( + + const arrowExpression = this.forwardNoArrowParamsConversionAt( typeParameters, () => super.parseMaybeAssign( noIn, - refShorthandDefaultPos, + refExpressionErrors, afterLeftParse, refNeedsArrowPos, ), ); arrowExpression.typeParameters = typeParameters; this.resetStartLocationFromNode(arrowExpression, typeParameters); - } catch (err) { - throw jsxError || err; + + return arrowExpression; + }, state); + + const arrowExpression: ?N.ArrowFunctionExpression = + arrow.node && arrow.node.type === "ArrowFunctionExpression" + ? arrow.node + : null; + + if (!arrow.error && arrowExpression) return arrowExpression; + + // If we are here, both JSX and Flow parsing attemps failed. + // Give the precedence to the JSX error, except if JSX had an + // unrecoverable error while Flow didn't. + // If the error is recoverable, we can only re-report it if there is + // a node we can return. + + if (jsx && jsx.node) { + /*:: invariant(jsx.failState) */ + this.state = jsx.failState; + return jsx.node; } - if (arrowExpression.type === "ArrowFunctionExpression") { + if (arrowExpression) { + /*:: invariant(arrow.failState) */ + this.state = arrow.failState; return arrowExpression; - } else if (jsxError != null) { - throw jsxError; - } else { - this.raise( - typeParameters.start, - "Expected an arrow function after this type parameter declaration", - ); } + + if (jsx && jsx.thrown) throw jsx.error; + if (arrow.thrown) throw arrow.error; + + /*:: invariant(typeParameters) */ + throw this.raise( + typeParameters.start, + FlowErrors.UnexpectedTokenAfterTypeParameter, + ); } return super.parseMaybeAssign( noIn, - refShorthandDefaultPos, + refExpressionErrors, afterLeftParse, refNeedsArrowPos, ); @@ -2511,8 +2735,7 @@ export default (superClass: Class): Class => // handle return types for arrow functions parseArrow(node: N.ArrowFunctionExpression): ?N.ArrowFunctionExpression { if (this.match(tt.colon)) { - const state = this.state.clone(); - try { + const result = this.tryParse(() => { const oldNoAnonFunctionType = this.state.noAnonFunctionType; this.state.noAnonFunctionType = true; @@ -2530,18 +2753,18 @@ export default (superClass: Class): Class => if (this.canInsertSemicolon()) this.unexpected(); if (!this.match(tt.arrow)) this.unexpected(); - // assign after it is clear it is an arrow - node.returnType = typeNode.typeAnnotation - ? this.finishNode(typeNode, "TypeAnnotation") - : null; - } catch (err) { - if (err instanceof SyntaxError) { - this.state = state; - } else { - // istanbul ignore next: no such error is expected - throw err; - } - } + return typeNode; + }); + + if (result.thrown) return null; + /*:: invariant(result.node) */ + + if (result.error) this.state = result.failState; + + // assign after it is clear it is an arrow + node.returnType = result.node.typeAnnotation + ? this.finishNode(result.node, "TypeAnnotation") + : null; } return super.parseArrow(node); @@ -2574,7 +2797,7 @@ export default (superClass: Class): Class => return; } - return super.checkParams(node, allowDuplicates, isArrowFunction); + return super.checkParams(...arguments); } parseParenAndDistinguishExpression(canBeArrow: boolean): N.Expression { @@ -2606,23 +2829,33 @@ export default (superClass: Class): Class => this.isRelational("<") ) { const state = this.state.clone(); - let error; - try { - const node = this.parseAsyncArrowWithTypeParameters( - startPos, - startLoc, - ); - if (node) return node; - } catch (e) { - error = e; + const arrow = this.tryParse( + abort => + this.parseAsyncArrowWithTypeParameters(startPos, startLoc) || + abort(), + state, + ); + + if (!arrow.error && !arrow.aborted) return arrow.node; + + const result = this.tryParse( + () => super.parseSubscripts(base, startPos, startLoc, noCalls), + state, + ); + + if (result.node && !result.error) return result.node; + + if (arrow.node) { + this.state = arrow.failState; + return arrow.node; } - this.state = state; - try { - return super.parseSubscripts(base, startPos, startLoc, noCalls); - } catch (e) { - throw error || e; + if (result.node) { + this.state = result.failState; + return result.node; } + + throw arrow.error || result.error; } return super.parseSubscripts(base, startPos, startLoc, noCalls); @@ -2634,10 +2867,8 @@ export default (superClass: Class): Class => startLoc: Position, noCalls: ?boolean, subscriptState: N.ParseSubscriptState, - maybeAsyncArrow: boolean, ): N.Expression { if (this.match(tt.questionDot) && this.isLookaheadRelational("<")) { - this.expectPlugin("optionalChaining"); subscriptState.optionalChainMember = true; if (noCalls) { subscriptState.stop = true; @@ -2654,7 +2885,7 @@ export default (superClass: Class): Class => // $FlowFixMe node.arguments = this.parseCallExpressionArguments(tt.parenR, false); node.optional = true; - return this.finishNode(node, "OptionalCallExpression"); + return this.finishCallExpression(node, /* optional */ true); } else if ( !noCalls && this.shouldParseTypes() && @@ -2662,22 +2893,21 @@ export default (superClass: Class): Class => ) { const node = this.startNodeAt(startPos, startLoc); node.callee = base; - const state = this.state.clone(); - try { + + const result = this.tryParse(() => { node.typeArguments = this.flowParseTypeParameterInstantiationCallOrNew(); this.expect(tt.parenL); node.arguments = this.parseCallExpressionArguments(tt.parenR, false); - if (subscriptState.optionalChainMember) { - node.optional = false; - return this.finishNode(node, "OptionalCallExpression"); - } - return this.finishNode(node, "CallExpression"); - } catch (e) { - if (e instanceof SyntaxError) { - this.state = state; - } else { - throw e; - } + if (subscriptState.optionalChainMember) node.optional = false; + return this.finishCallExpression( + node, + subscriptState.optionalChainMember, + ); + }); + + if (result.node) { + if (result.error) this.state = result.failState; + return result.node; } } @@ -2687,23 +2917,15 @@ export default (superClass: Class): Class => startLoc, noCalls, subscriptState, - maybeAsyncArrow, ); } parseNewArguments(node: N.NewExpression): void { let targs = null; if (this.shouldParseTypes() && this.isRelational("<")) { - const state = this.state.clone(); - try { - targs = this.flowParseTypeParameterInstantiationCallOrNew(); - } catch (e) { - if (e instanceof SyntaxError) { - this.state = state; - } else { - throw e; - } - } + targs = this.tryParse(() => + this.flowParseTypeParameterInstantiationCallOrNew(), + ).node; } node.typeArguments = targs; @@ -2757,7 +2979,7 @@ export default (superClass: Class): Class => parseTopLevel(file: N.File, program: N.Program): N.File { const fileNode = super.parseTopLevel(file, program); if (this.state.hasFlowComment) { - this.unexpected(null, "Unterminated flow-comment"); + this.raise(this.state.pos, FlowErrors.UnterminatedFlowComment); } return fileNode; } @@ -2765,10 +2987,7 @@ export default (superClass: Class): Class => skipBlockComment(): void { if (this.hasPlugin("flowComments") && this.skipFlowComment()) { if (this.state.hasFlowComment) { - this.unexpected( - null, - "Cannot have a flow comment inside another flow comment", - ); + this.unexpected(null, FlowErrors.NestedFlowComment); } this.hasFlowCommentCompletion(); this.state.pos += this.skipFlowComment(); @@ -2778,7 +2997,9 @@ export default (superClass: Class): Class => if (this.state.hasFlowComment) { const end = this.input.indexOf("*-/", (this.state.pos += 2)); - if (end === -1) this.raise(this.state.pos - 2, "Unterminated comment"); + if (end === -1) { + throw this.raise(this.state.pos - 2, Errors.UnterminatedComment); + } this.state.pos = end + 3; return; } @@ -2820,7 +3041,433 @@ export default (superClass: Class): Class => hasFlowCommentCompletion(): void { const end = this.input.indexOf("*/", this.state.pos); if (end === -1) { - this.raise(this.state.pos, "Unterminated comment"); + throw this.raise(this.state.pos, Errors.UnterminatedComment); + } + } + + // Flow enum parsing + + flowEnumErrorBooleanMemberNotInitialized( + pos: number, + { enumName, memberName }: { enumName: string, memberName: string }, + ): void { + this.raise( + pos, + FlowErrors.EnumBooleanMemberNotInitialized, + memberName, + enumName, + ); + } + + flowEnumErrorInvalidMemberName( + pos: number, + { enumName, memberName }: { enumName: string, memberName: string }, + ): void { + const suggestion = memberName[0].toUpperCase() + memberName.slice(1); + this.raise( + pos, + FlowErrors.EnumInvalidMemberName, + memberName, + suggestion, + enumName, + ); + } + + flowEnumErrorDuplicateMemberName( + pos: number, + { enumName, memberName }: { enumName: string, memberName: string }, + ): void { + this.raise(pos, FlowErrors.EnumDuplicateMemberName, memberName, enumName); + } + + flowEnumErrorInconsistentMemberValues( + pos: number, + { enumName }: { enumName: string }, + ): void { + this.raise(pos, FlowErrors.EnumInconsistentMemberValues, enumName); + } + + flowEnumErrorInvalidExplicitType( + pos: number, + { + enumName, + suppliedType, + }: { enumName: string, suppliedType: null | string }, + ) { + return this.raise( + pos, + suppliedType === null + ? FlowErrors.EnumInvalidExplicitTypeUnknownSupplied + : FlowErrors.EnumInvalidExplicitType, + enumName, + suppliedType, + ); + } + + flowEnumErrorInvalidMemberInitializer( + pos: number, + { enumName, explicitType, memberName }: EnumContext, + ) { + let message = null; + switch (explicitType) { + case "boolean": + case "number": + case "string": + message = FlowErrors.EnumInvalidMemberInitializerPrimaryType; + break; + case "symbol": + message = FlowErrors.EnumInvalidMemberInitializerSymbolType; + break; + default: + // null + message = FlowErrors.EnumInvalidMemberInitializerUnknownType; + } + return this.raise(pos, message, enumName, memberName, explicitType); + } + + flowEnumErrorNumberMemberNotInitialized( + pos: number, + { enumName, memberName }: { enumName: string, memberName: string }, + ): void { + this.raise( + pos, + FlowErrors.EnumNumberMemberNotInitialized, + enumName, + memberName, + ); + } + + flowEnumErrorStringMemberInconsistentlyInitailized( + pos: number, + { enumName }: { enumName: string }, + ): void { + this.raise( + pos, + FlowErrors.EnumStringMemberInconsistentlyInitailized, + enumName, + ); + } + + flowEnumMemberInit(): EnumMemberInit { + const startPos = this.state.start; + const endOfInit = () => this.match(tt.comma) || this.match(tt.braceR); + switch (this.state.type) { + case tt.num: { + const literal = this.parseLiteral(this.state.value, "NumericLiteral"); + if (endOfInit()) { + return { type: "number", pos: literal.start, value: literal }; + } + return { type: "invalid", pos: startPos }; + } + case tt.string: { + const literal = this.parseLiteral(this.state.value, "StringLiteral"); + if (endOfInit()) { + return { type: "string", pos: literal.start, value: literal }; + } + return { type: "invalid", pos: startPos }; + } + case tt._true: + case tt._false: { + const literal = this.parseBooleanLiteral(); + if (endOfInit()) { + return { + type: "boolean", + pos: literal.start, + value: literal, + }; + } + return { type: "invalid", pos: startPos }; + } + default: + return { type: "invalid", pos: startPos }; + } + } + + flowEnumMemberRaw(): { id: N.Node, init: EnumMemberInit } { + const pos = this.state.start; + const id = this.parseIdentifier(true); + const init = this.eat(tt.eq) + ? this.flowEnumMemberInit() + : { type: "none", pos }; + return { id, init }; + } + + flowEnumCheckExplicitTypeMismatch( + pos: number, + context: EnumContext, + expectedType: EnumExplicitType, + ): void { + const { explicitType } = context; + if (explicitType === null) { + return; + } + if (explicitType !== expectedType) { + this.flowEnumErrorInvalidMemberInitializer(pos, context); + } + } + + flowEnumMembers({ + enumName, + explicitType, + }: { + enumName: string, + explicitType: EnumExplicitType, + }): {| + booleanMembers: Array, + numberMembers: Array, + stringMembers: Array, + defaultedMembers: Array, + |} { + const seenNames = new Set(); + const members = { + booleanMembers: [], + numberMembers: [], + stringMembers: [], + defaultedMembers: [], + }; + while (!this.match(tt.braceR)) { + const memberNode = this.startNode(); + const { id, init } = this.flowEnumMemberRaw(); + const memberName = id.name; + if (memberName === "") { + continue; + } + if (/^[a-z]/.test(memberName)) { + this.flowEnumErrorInvalidMemberName(id.start, { + enumName, + memberName, + }); + } + if (seenNames.has(memberName)) { + this.flowEnumErrorDuplicateMemberName(id.start, { + enumName, + memberName, + }); + } + seenNames.add(memberName); + const context = { enumName, explicitType, memberName }; + memberNode.id = id; + switch (init.type) { + case "boolean": { + this.flowEnumCheckExplicitTypeMismatch( + init.pos, + context, + "boolean", + ); + memberNode.init = init.value; + members.booleanMembers.push( + this.finishNode(memberNode, "EnumBooleanMember"), + ); + break; + } + case "number": { + this.flowEnumCheckExplicitTypeMismatch(init.pos, context, "number"); + memberNode.init = init.value; + members.numberMembers.push( + this.finishNode(memberNode, "EnumNumberMember"), + ); + break; + } + case "string": { + this.flowEnumCheckExplicitTypeMismatch(init.pos, context, "string"); + memberNode.init = init.value; + members.stringMembers.push( + this.finishNode(memberNode, "EnumStringMember"), + ); + break; + } + case "invalid": { + throw this.flowEnumErrorInvalidMemberInitializer(init.pos, context); + } + case "none": { + switch (explicitType) { + case "boolean": + this.flowEnumErrorBooleanMemberNotInitialized( + init.pos, + context, + ); + break; + case "number": + this.flowEnumErrorNumberMemberNotInitialized(init.pos, context); + break; + default: + members.defaultedMembers.push( + this.finishNode(memberNode, "EnumDefaultedMember"), + ); + } + } + } + + if (!this.match(tt.braceR)) { + this.expect(tt.comma); + } + } + return members; + } + + flowEnumStringMembers( + initializedMembers: Array, + defaultedMembers: Array, + { enumName }: { enumName: string }, + ): Array { + if (initializedMembers.length === 0) { + return defaultedMembers; + } else if (defaultedMembers.length === 0) { + return initializedMembers; + } else if (defaultedMembers.length > initializedMembers.length) { + for (const member of initializedMembers) { + this.flowEnumErrorStringMemberInconsistentlyInitailized( + member.start, + { enumName }, + ); + } + return defaultedMembers; + } else { + for (const member of defaultedMembers) { + this.flowEnumErrorStringMemberInconsistentlyInitailized( + member.start, + { enumName }, + ); + } + return initializedMembers; + } + } + + flowEnumParseExplicitType({ + enumName, + }: { + enumName: string, + }): EnumExplicitType { + if (this.eatContextual("of")) { + if (!this.match(tt.name)) { + throw this.flowEnumErrorInvalidExplicitType(this.state.start, { + enumName, + suppliedType: null, + }); + } + + const { value } = this.state; + this.next(); + + if ( + value !== "boolean" && + value !== "number" && + value !== "string" && + value !== "symbol" + ) { + this.flowEnumErrorInvalidExplicitType(this.state.start, { + enumName, + suppliedType: value, + }); + } + + return value; + } + return null; + } + + flowEnumBody(node: N.Node, { enumName, nameLoc }): N.Node { + const explicitType = this.flowEnumParseExplicitType({ enumName }); + this.expect(tt.braceL); + const members = this.flowEnumMembers({ enumName, explicitType }); + + switch (explicitType) { + case "boolean": + node.explicitType = true; + node.members = members.booleanMembers; + this.expect(tt.braceR); + return this.finishNode(node, "EnumBooleanBody"); + case "number": + node.explicitType = true; + node.members = members.numberMembers; + this.expect(tt.braceR); + return this.finishNode(node, "EnumNumberBody"); + case "string": + node.explicitType = true; + node.members = this.flowEnumStringMembers( + members.stringMembers, + members.defaultedMembers, + { enumName }, + ); + this.expect(tt.braceR); + return this.finishNode(node, "EnumStringBody"); + case "symbol": + node.members = members.defaultedMembers; + this.expect(tt.braceR); + return this.finishNode(node, "EnumSymbolBody"); + default: { + // `explicitType` is `null` + const empty = () => { + node.members = []; + this.expect(tt.braceR); + return this.finishNode(node, "EnumStringBody"); + }; + node.explicitType = false; + + const boolsLen = members.booleanMembers.length; + const numsLen = members.numberMembers.length; + const strsLen = members.stringMembers.length; + const defaultedLen = members.defaultedMembers.length; + + if (!boolsLen && !numsLen && !strsLen && !defaultedLen) { + return empty(); + } else if (!boolsLen && !numsLen) { + node.members = this.flowEnumStringMembers( + members.stringMembers, + members.defaultedMembers, + { enumName }, + ); + this.expect(tt.braceR); + return this.finishNode(node, "EnumStringBody"); + } else if (!numsLen && !strsLen && boolsLen >= defaultedLen) { + for (const member of members.defaultedMembers) { + this.flowEnumErrorBooleanMemberNotInitialized(member.start, { + enumName, + memberName: member.id.name, + }); + } + node.members = members.booleanMembers; + this.expect(tt.braceR); + return this.finishNode(node, "EnumBooleanBody"); + } else if (!boolsLen && !strsLen && numsLen >= defaultedLen) { + for (const member of members.defaultedMembers) { + this.flowEnumErrorNumberMemberNotInitialized(member.start, { + enumName, + memberName: member.id.name, + }); + } + node.members = members.numberMembers; + this.expect(tt.braceR); + return this.finishNode(node, "EnumNumberBody"); + } else { + this.flowEnumErrorInconsistentMemberValues(nameLoc, { enumName }); + return empty(); + } + } + } + } + + flowParseEnumDeclaration(node: N.Node): N.Node { + const id = this.parseIdentifier(); + node.id = id; + node.body = this.flowEnumBody(this.startNode(), { + enumName: id.name, + nameLoc: id.start, + }); + return this.finishNode(node, "EnumDeclaration"); + } + + updateContext(prevType: TokenType): void { + if ( + this.match(tt.name) && + this.state.value === "of" && + prevType === tt.name && + this.input.slice(this.state.lastTokStart, this.state.lastTokEnd) === + "interface" + ) { + this.state.exprAllowed = false; + } else { + super.updateContext(prevType); } } }; diff --git a/packages/babel-parser/src/plugins/jsx/index.js b/packages/babel-parser/src/plugins/jsx/index.js index 5d3c2ec2ece1..6158cae7579a 100644 --- a/packages/babel-parser/src/plugins/jsx/index.js +++ b/packages/babel-parser/src/plugins/jsx/index.js @@ -4,16 +4,30 @@ import * as charCodes from "charcodes"; import XHTMLEntities from "./xhtml"; import type Parser from "../../parser"; +import type { ExpressionErrors } from "../../parser/util"; import { TokenType, types as tt } from "../../tokenizer/types"; import { TokContext, types as tc } from "../../tokenizer/context"; import * as N from "../../types"; import { isIdentifierChar, isIdentifierStart } from "../../util/identifier"; -import type { Pos, Position } from "../../util/location"; +import type { Position } from "../../util/location"; import { isNewLine } from "../../util/whitespace"; +import { Errors } from "../../parser/location"; const HEX_NUMBER = /^[\da-fA-F]+$/; const DECIMAL_NUMBER = /^\d+$/; +const JsxErrors = Object.freeze({ + AttributeIsEmpty: + "JSX attributes must only be assigned a non-empty expression", + MissingClosingTagFragment: "Expected corresponding JSX closing tag for <>", + MissingClosingTagElement: "Expected corresponding JSX closing tag for <%0>", + UnsupportedJsxValue: + "JSX value should be either an expression or a quoted JSX text", + UnterminatedJsxContent: "Unterminated JSX contents", + UnwrappedAdjacentJSXElements: + "Adjacent JSX elements must be wrapped in an enclosing tag. Did you want a JSX fragment <>...?", +}); + // Be aware that this file is always executed and not only when the plugin is enabled. // Therefore this contexts and tokens do always exist. tc.j_oTag = new TokContext("): Class => let chunkStart = this.state.pos; for (;;) { if (this.state.pos >= this.length) { - this.raise(this.state.start, "Unterminated JSX contents"); + throw this.raise(this.state.start, JsxErrors.UnterminatedJsxContent); } const ch = this.input.charCodeAt(this.state.pos); @@ -142,7 +156,7 @@ export default (superClass: Class): Class => let chunkStart = ++this.state.pos; for (;;) { if (this.state.pos >= this.length) { - this.raise(this.state.start, "Unterminated string constant"); + throw this.raise(this.state.start, Errors.UnterminatedString); } const ch = this.input.charCodeAt(this.state.pos); @@ -250,10 +264,16 @@ export default (superClass: Class): Class => // Parses element name in any form - namespaced, member // or single identifier. - jsxParseElementName(): N.JSXNamespacedName | N.JSXMemberExpression { + jsxParseElementName(): + | N.JSXIdentifier + | N.JSXNamespacedName + | N.JSXMemberExpression { const startPos = this.state.start; const startLoc = this.state.startLoc; let node = this.jsxParseNamespacedName(); + if (node.type === "JSXNamespacedName") { + return node; + } while (this.eat(tt.dot)) { const newNode = this.startNodeAt(startPos, startLoc); newNode.object = node; @@ -273,23 +293,16 @@ export default (superClass: Class): Class => this.next(); node = this.jsxParseExpressionContainer(node); if (node.expression.type === "JSXEmptyExpression") { - throw this.raise( - node.start, - "JSX attributes must only be assigned a non-empty expression", - ); - } else { - return node; + this.raise(node.start, JsxErrors.AttributeIsEmpty); } + return node; case tt.jsxTagStart: case tt.string: return this.parseExprAtom(); default: - throw this.raise( - this.state.start, - "JSX value should be either an expression or a quoted JSX text", - ); + throw this.raise(this.state.start, JsxErrors.UnsupportedJsxValue); } } @@ -444,15 +457,14 @@ export default (superClass: Class): Class => this.raise( // $FlowIgnore closingElement.start, - "Expected corresponding JSX closing tag for <>", + JsxErrors.MissingClosingTagFragment, ); } else if (!isFragment(openingElement) && isFragment(closingElement)) { this.raise( // $FlowIgnore closingElement.start, - "Expected corresponding JSX closing tag for <" + - getQualifiedJSXName(openingElement.name) + - ">", + JsxErrors.MissingClosingTagElement, + getQualifiedJSXName(openingElement.name), ); } else if (!isFragment(openingElement) && !isFragment(closingElement)) { if ( @@ -463,9 +475,8 @@ export default (superClass: Class): Class => this.raise( // $FlowIgnore closingElement.start, - "Expected corresponding JSX closing tag for <" + - getQualifiedJSXName(openingElement.name) + - ">", + JsxErrors.MissingClosingTagElement, + getQualifiedJSXName(openingElement.name), ); } } @@ -479,11 +490,10 @@ export default (superClass: Class): Class => node.closingElement = closingElement; } node.children = children; - if (this.match(tt.relational) && this.state.value === "<") { - this.raise( + if (this.isRelational("<")) { + throw this.raise( this.state.start, - "Adjacent JSX elements must be wrapped in an enclosing tag. " + - "Did you want a JSX fragment <>...?", + JsxErrors.UnwrappedAdjacentJSXElements, ); } @@ -505,7 +515,7 @@ export default (superClass: Class): Class => // Overrides // ================================== - parseExprAtom(refShortHandDefaultPos: ?Pos): N.Expression { + parseExprAtom(refExpressionErrors: ?ExpressionErrors): N.Expression { if (this.match(tt.jsxText)) { return this.parseLiteral(this.state.value, "JSXText"); } else if (this.match(tt.jsxTagStart)) { @@ -519,7 +529,7 @@ export default (superClass: Class): Class => this.finishToken(tt.jsxTagStart); return this.jsxParseElement(); } else { - return super.parseExprAtom(refShortHandDefaultPos); + return super.parseExprAtom(refExpressionErrors); } } diff --git a/packages/babel-parser/src/plugins/typescript/index.js b/packages/babel-parser/src/plugins/typescript/index.js index fb6e8363a333..41413e591bd6 100644 --- a/packages/babel-parser/src/plugins/typescript/index.js +++ b/packages/babel-parser/src/plugins/typescript/index.js @@ -1,6 +1,9 @@ // @flow +/*:: declare var invariant; */ + import type { TokenType } from "../../tokenizer/types"; +import type State from "../../tokenizer/state"; import { types as tt } from "../../tokenizer/types"; import { types as ct } from "../../tokenizer/context"; import * as N from "../../types"; @@ -9,19 +12,27 @@ import type Parser from "../../parser"; import { type BindingTypes, BIND_NONE, + SCOPE_TS_MODULE, SCOPE_OTHER, BIND_TS_ENUM, BIND_TS_CONST_ENUM, BIND_TS_TYPE, BIND_TS_INTERFACE, - BIND_TS_FN_TYPE, + BIND_TS_AMBIENT, BIND_TS_NAMESPACE, + BIND_CLASS, + BIND_LEXICAL, } from "../../util/scopeflags"; import TypeScriptScopeHandler from "./scope"; +import * as charCodes from "charcodes"; +import type { ExpressionErrors } from "../../parser/util"; +import { PARAM } from "../../util/production-parameter"; +import { Errors } from "../../parser/location"; type TsModifier = | "readonly" | "abstract" + | "declare" | "static" | "public" | "private" @@ -48,6 +59,42 @@ type ParsingContext = | "TypeMembers" | "TypeParametersOrArguments"; +const TSErrors = Object.freeze({ + ClassMethodHasDeclare: "Class methods cannot have the 'declare' modifier", + ClassMethodHasReadonly: "Class methods cannot have the 'readonly' modifier", + DeclareClassFieldHasInitializer: + "'declare' class fields cannot have an initializer", + DuplicateModifier: "Duplicate modifier: '%0'", + EmptyHeritageClauseType: "'%0' list cannot be empty.", + IndexSignatureHasAbstract: + "Index signatures cannot have the 'abstract' modifier", + IndexSignatureHasAccessibility: + "Index signatures cannot have an accessibility modifier ('%0')", + IndexSignatureHasStatic: "Index signatures cannot have the 'static' modifier", + OptionalTypeBeforeRequired: + "A required element cannot follow an optional element.", + PatternIsOptional: + "A binding pattern parameter cannot be optional in an implementation signature.", + PrivateElementHasAbstract: + "Private elements cannot have the 'abstract' modifier.", + PrivateElementHasAccessibility: + "Private elements cannot have an accessibility modifier ('%0')", + TemplateTypeHasSubstitution: + "Template literal types cannot have any substitution", + TypeAnnotationAfterAssign: + "Type annotations must come before default assignments, e.g. instead of `age = 25: number` use `age: number = 25`", + UnexpectedReadonly: + "'readonly' type modifier is only permitted on array and tuple literal types.", + UnexpectedTypeAnnotation: "Did not expect a type annotation here.", + UnexpectedTypeCastInParameter: "Unexpected type cast in parameter position.", + UnsupportedImportTypeArgument: + "Argument in a type import must be a string literal", + UnsupportedParameterPropertyKind: + "A parameter property may not be declared using a binding pattern.", + UnsupportedSignatureParameterKind: + "Name in a signature must be an Identifier, ObjectPattern or ArrayPattern, instead got %0", +}); + // Doesn't handle "void" or "null" because those are keywords, not identifiers. function keywordTypeFromName( value: string, @@ -123,6 +170,28 @@ export default (superClass: Class): Class => return undefined; } + /** Parses a list of modifiers, in any order. + * If you need a specific order, you must call this function multiple times: + * this.tsParseModifiers(node, ["public"]); + * this.tsParseModifiers(node, ["abstract", "readonly"]); + */ + tsParseModifiers( + modified: { [key: TsModifier]: ?true }, + allowedModifiers: T[], + ): void { + for (;;) { + const startPos = this.state.start; + const modifier: ?T = this.tsParseModifier(allowedModifiers); + + if (!modifier) break; + + if (Object.hasOwnProperty.call(modified, modifier)) { + this.raise(startPos, TSErrors.DuplicateModifier, modifier); + } + modified[modifier] = true; + } + } + tsIsListTerminator(kind: ParsingContext): boolean { switch (kind) { case "EnumMembers": @@ -172,7 +241,7 @@ export default (superClass: Class): Class => ): ?(T[]) { const result = []; - while (true) { + for (;;) { if (this.tsIsListTerminator(kind)) { break; } @@ -231,10 +300,7 @@ export default (superClass: Class): Class => this.expect(tt._import); this.expect(tt.parenL); if (!this.match(tt.string)) { - throw this.unexpected( - null, - "Argument in a type import must be a string literal", - ); + this.raise(this.state.start, TSErrors.UnsupportedImportTypeArgument); } // For compatibility to estree we cannot call parseLiteral directly here @@ -360,22 +426,23 @@ export default (superClass: Class): Class => tsParseBindingListForSignature(): $ReadOnlyArray< N.Identifier | N.RestElement | N.ObjectPattern | N.ArrayPattern, > { - return this.parseBindingList(tt.parenR).map(pattern => { - if ( - pattern.type !== "Identifier" && - pattern.type !== "RestElement" && - pattern.type !== "ObjectPattern" && - pattern.type !== "ArrayPattern" - ) { - throw this.unexpected( - pattern.start, - `Name in a signature must be an Identifier, ObjectPattern or ArrayPattern, instead got ${ - pattern.type - }`, - ); - } - return pattern; - }); + return this.parseBindingList(tt.parenR, charCodes.rightParenthesis).map( + pattern => { + if ( + pattern.type !== "Identifier" && + pattern.type !== "RestElement" && + pattern.type !== "ObjectPattern" && + pattern.type !== "ArrayPattern" + ) { + this.raise( + pattern.start, + TSErrors.UnsupportedSignatureParameterKind, + pattern.type, + ); + } + return (pattern: any); + }, + ); } tsParseTypeMemberSemicolon(): void { @@ -398,7 +465,7 @@ export default (superClass: Class): Class => return this.eat(tt.name) && this.match(tt.colon); } - tsTryParseIndexSignature(node: N.TsIndexSignature): ?N.TsIndexSignature { + tsTryParseIndexSignature(node: N.Node): ?N.TsIndexSignature { if ( !( this.match(tt.bracketL) && @@ -473,7 +540,7 @@ export default (superClass: Class): Class => return idx; } - this.parsePropertyName(node); + this.parsePropertyName(node, /* isPrivateNameAllowed */ false); return this.tsParsePropertyOrMethodSignature(node, readonly); } @@ -568,10 +635,7 @@ export default (superClass: Class): Class => if (elementNode.type === "TSOptionalType") { seenOptionalElement = true; } else if (seenOptionalElement && elementNode.type !== "TSRestType") { - this.raise( - elementNode.start, - "A required element cannot follow an optional element.", - ); + this.raise(elementNode.start, TSErrors.OptionalTypeBeforeRequired); } }); @@ -584,7 +648,12 @@ export default (superClass: Class): Class => const restNode: N.TsRestType = this.startNode(); this.next(); // skips ellipsis restNode.typeAnnotation = this.tsParseType(); - this.checkCommaAfterRest(); + if ( + this.match(tt.comma) && + this.lookaheadCharCode() !== charCodes.rightSquareBracket + ) { + this.raiseRestNotLast(this.state.start); + } return this.finishNode(restNode, "TSRestType"); } @@ -638,15 +707,24 @@ export default (superClass: Class): Class => const node: N.TsLiteralType = this.startNode(); const templateNode = this.parseTemplate(false); if (templateNode.expressions.length > 0) { - throw this.raise( + this.raise( templateNode.expressions[0].start, - "Template literal types cannot have any substitution", + TSErrors.TemplateTypeHasSubstitution, ); } node.literal = templateNode; return this.finishNode(node, "TSLiteralType"); } + tsParseThisTypeOrThisTypePredicate(): N.TsThisType | N.TsTypePredicate { + const thisKeyword = this.tsParseThisTypeNode(); + if (this.isContextual("is") && !this.hasPrecedingLineBreak()) { + return this.tsParseThisTypePredicate(thisKeyword); + } else { + return thisKeyword; + } + } + tsParseNonArrayType(): N.TsType { switch (this.state.type) { case tt.name: @@ -657,7 +735,10 @@ export default (superClass: Class): Class => : this.match(tt._null) ? "TSNullKeyword" : keywordTypeFromName(this.state.value); - if (type !== undefined && this.lookahead().type !== tt.dot) { + if ( + type !== undefined && + this.lookaheadCharCode() !== charCodes.dot + ) { const node: N.TsKeywordType = this.startNode(); this.next(); return this.finishNode(node, type); @@ -679,14 +760,8 @@ export default (superClass: Class): Class => return this.finishNode(node, "TSLiteralType"); } break; - case tt._this: { - const thisKeyword = this.tsParseThisTypeNode(); - if (this.isContextual("is") && !this.hasPrecedingLineBreak()) { - return this.tsParseThisTypePredicate(thisKeyword); - } else { - return thisKeyword; - } - } + case tt._this: + return this.tsParseThisTypeOrThisTypePredicate(); case tt._typeof: return this.tsParseTypeQuery(); case tt._import: @@ -746,10 +821,7 @@ export default (superClass: Class): Class => case "TSArrayType": return; default: - this.raise( - node.start, - "'readonly' type modifier is only permitted on array and tuple literal types.", - ); + this.raise(node.start, TSErrors.UnexpectedReadonly); } } @@ -897,21 +969,52 @@ export default (superClass: Class): Class => const t: N.TsTypeAnnotation = this.startNode(); this.expect(returnToken); + const asserts = this.tsTryParse( + this.tsParseTypePredicateAsserts.bind(this), + ); + + if (asserts && this.match(tt._this)) { + // When asserts is false, thisKeyword is handled by tsParseNonArrayType + // : asserts this is type + let thisTypePredicate = this.tsParseThisTypeOrThisTypePredicate(); + // if it turns out to be a `TSThisType`, wrap it with `TSTypePredicate` + // : asserts this + if (thisTypePredicate.type === "TSThisType") { + const node: N.TsTypePredicate = this.startNodeAtNode(t); + node.parameterName = (thisTypePredicate: N.TsThisType); + node.asserts = true; + thisTypePredicate = this.finishNode(node, "TSTypePredicate"); + } else { + (thisTypePredicate: N.TsTypePredicate).asserts = true; + } + t.typeAnnotation = thisTypePredicate; + return this.finishNode(t, "TSTypeAnnotation"); + } + const typePredicateVariable = this.tsIsIdentifier() && this.tsTryParse(this.tsParseTypePredicatePrefix.bind(this)); if (!typePredicateVariable) { - return this.tsParseTypeAnnotation(/* eatColon */ false, t); + if (!asserts) { + // : type + return this.tsParseTypeAnnotation(/* eatColon */ false, t); + } + + const node: N.TsTypePredicate = this.startNodeAtNode(t); + // : asserts foo + node.parameterName = this.parseIdentifier(); + node.asserts = asserts; + t.typeAnnotation = this.finishNode(node, "TSTypePredicate"); + return this.finishNode(t, "TSTypeAnnotation"); } + // : asserts foo is type const type = this.tsParseTypeAnnotation(/* eatColon */ false); - - const node: N.TsTypePredicate = this.startNodeAtNode( - typePredicateVariable, - ); + const node = this.startNodeAtNode(t); node.parameterName = typePredicateVariable; node.typeAnnotation = type; + node.asserts = asserts; t.typeAnnotation = this.finishNode(node, "TSTypePredicate"); return this.finishNode(t, "TSTypeAnnotation"); }); @@ -939,6 +1042,31 @@ export default (superClass: Class): Class => } } + tsParseTypePredicateAsserts(): boolean { + if ( + !this.match(tt.name) || + this.state.value !== "asserts" || + this.hasPrecedingLineBreak() + ) { + return false; + } + const containsEsc = this.state.containsEsc; + this.next(); + if (!this.match(tt.name) && !this.match(tt._this)) { + return false; + } + + if (containsEsc) { + this.raise( + this.state.lastTokStart, + Errors.InvalidEscapedReservedWord, + "asserts", + ); + } + + return true; + } + tsParseTypeAnnotation( eatColon = true, t: N.TsTypeAnnotation = this.startNode(), @@ -999,7 +1127,7 @@ export default (superClass: Class): Class => ); if (!delimitedList.length) { - this.raise(originalStart, `'${descriptor}' list cannot be empty.`); + this.raise(originalStart, TSErrors.EmptyHeritageClauseType, descriptor); } return delimitedList; @@ -1163,7 +1291,11 @@ export default (superClass: Class): Class => this.tsParseModuleOrNamespaceDeclaration(inner, true); node.body = inner; } else { + this.scope.enter(SCOPE_TS_MODULE); + this.prodParam.enter(PARAM); node.body = this.tsParseModuleBlock(); + this.prodParam.exit(); + this.scope.exit(); } return this.finishNode(node, "TSModuleDeclaration"); } @@ -1179,9 +1311,12 @@ export default (superClass: Class): Class => } else { this.unexpected(); } - if (this.match(tt.braceL)) { + this.scope.enter(SCOPE_TS_MODULE); + this.prodParam.enter(PARAM); node.body = this.tsParseModuleBlock(); + this.prodParam.exit(); + this.scope.exit(); } else { this.semicolon(); } @@ -1195,6 +1330,12 @@ export default (superClass: Class): Class => ): N.TsImportEqualsDeclaration { node.isExport = isExport || false; node.id = this.parseIdentifier(); + this.checkLVal( + node.id, + BIND_LEXICAL, + undefined, + "import equals declaration", + ); this.expect(tt.eq); node.moduleReference = this.tsParseModuleReference(); this.semicolon(); @@ -1203,7 +1344,8 @@ export default (superClass: Class): Class => tsIsExternalModuleReference(): boolean { return ( - this.isContextual("require") && this.lookahead().type === tt.parenL + this.isContextual("require") && + this.lookaheadCharCode() === charCodes.leftParenthesis ); } @@ -1235,17 +1377,12 @@ export default (superClass: Class): Class => return res; } - tsTryParseAndCatch(f: () => T): ?T { - const state = this.state.clone(); - try { - return f(); - } catch (e) { - if (e instanceof SyntaxError) { - this.state = state; - return undefined; - } - throw e; - } + tsTryParseAndCatch(f: () => T): ?T { + const result = this.tryParse(abort => f() || abort()); + + if (result.aborted || !result.node) return undefined; + if (result.error) this.state = result.failState; + return result.node; } tsTryParse(f: () => ?T): ?T { @@ -1279,6 +1416,9 @@ export default (superClass: Class): Class => /* declarationPosition */ true, ); case tt._class: + // While this is also set by tsParseExpressionStatement, we need to set it + // before parsing the class declaration to now how to register it in the scope. + nany.declare = true; return this.parseClass( nany, /* isStatement */ true, @@ -1329,10 +1469,14 @@ export default (superClass: Class): Class => // `global { }` (with no `declare`) may appear inside an ambient module declaration. // Would like to use tsParseAmbientExternalModuleDeclaration here, but already ran past "global". if (this.match(tt.braceL)) { + this.scope.enter(SCOPE_TS_MODULE); + this.prodParam.enter(PARAM); const mod: N.TsModuleDeclaration = node; mod.global = true; mod.id = expr; mod.body = this.tsParseModuleBlock(); + this.scope.exit(); + this.prodParam.exit(); return this.finishNode(mod, "TSModuleDeclaration"); } break; @@ -1417,6 +1561,14 @@ export default (superClass: Class): Class => if (!this.isRelational("<")) { return undefined; } + + const oldMaybeInArrowParameters = this.state.maybeInArrowParameters; + const oldYieldPos = this.state.yieldPos; + const oldAwaitPos = this.state.awaitPos; + this.state.maybeInArrowParameters = true; + this.state.yieldPos = -1; + this.state.awaitPos = -1; + const res: ?N.ArrowFunctionExpression = this.tsTryParseAndCatch(() => { const node: N.ArrowFunctionExpression = this.startNodeAt( startPos, @@ -1430,6 +1582,10 @@ export default (superClass: Class): Class => return node; }); + this.state.maybeInArrowParameters = oldMaybeInArrowParameters; + this.state.yieldPos = oldYieldPos; + this.state.awaitPos = oldAwaitPos; + if (!res) { return undefined; } @@ -1512,12 +1668,9 @@ export default (superClass: Class): Class => if (accessibility) pp.accessibility = accessibility; if (readonly) pp.readonly = readonly; if (elt.type !== "Identifier" && elt.type !== "AssignmentPattern") { - throw this.raise( - pp.start, - "A parameter property may not be declared using a binding pattern.", - ); + this.raise(pp.start, TSErrors.UnsupportedParameterPropertyKind); } - pp.parameter = elt; + pp.parameter = ((elt: any): N.Identifier | N.AssignmentPattern); return this.finishNode(pp, "TSParameterProperty"); } @@ -1551,11 +1704,13 @@ export default (superClass: Class): Class => super.parseFunctionBodyAndFinish(node, type, isMethod); } - checkFunctionStatementId(node: N.Function): void { + registerFunctionStatementId(node: N.Function): void { if (!node.body && node.id) { - this.checkLVal(node.id, BIND_TS_FN_TYPE, null, "function name"); + // Function ids are validated after parsing their body. + // For bodyless function, we need to do it here. + this.checkLVal(node.id, BIND_TS_AMBIENT, null, "function name"); } else { - super.checkFunctionStatementId(...arguments); + super.registerFunctionStatementId(...arguments); } } @@ -1565,7 +1720,6 @@ export default (superClass: Class): Class => startLoc: Position, noCalls: ?boolean, state: N.ParseSubscriptState, - maybeAsyncArrow: boolean, ): N.Expression { if (!this.hasPrecedingLineBreak() && this.match(tt.bang)) { this.state.exprAllowed = false; @@ -1584,7 +1738,7 @@ export default (superClass: Class): Class => // There are number of things we are going to "maybe" parse, like type arguments on // tagged template expressions. If any of them fail, walk it back and continue. const result = this.tsTryParseAndCatch(() => { - if (!noCalls && this.atPossibleAsync(base)) { + if (!noCalls && this.atPossibleAsyncArrow(base)) { // Almost certainly this is a generic async function `async () => ... // But it might be a call with a type argument `async();` const asyncArrowFn = this.tsTryParseGenericAsyncArrowFunction( @@ -1610,7 +1764,7 @@ export default (superClass: Class): Class => /* possibleAsync */ false, ); node.typeParameters = typeArguments; - return this.finishCallExpression(node); + return this.finishCallExpression(node, state.optionalChainMember); } else if (this.match(tt.backQuote)) { return this.parseTaggedTemplateExpression( startPos, @@ -1628,14 +1782,7 @@ export default (superClass: Class): Class => if (result) return result; } - return super.parseSubscript( - base, - startPos, - startLoc, - noCalls, - state, - maybeAsyncArrow, - ); + return super.parseSubscript(base, startPos, startLoc, noCalls, state); } parseNewArguments(node: N.NewExpression): void { @@ -1715,10 +1862,44 @@ export default (superClass: Class): Class => checkDuplicateExports() {} parseImport(node: N.Node): N.AnyImport { - if (this.match(tt.name) && this.lookahead().type === tt.eq) { - return this.tsParseImportEqualsDeclaration(node); + if (this.match(tt.name) || this.match(tt.star) || this.match(tt.braceL)) { + const ahead = this.lookahead(); + + if (this.match(tt.name) && ahead.type === tt.eq) { + return this.tsParseImportEqualsDeclaration(node); + } + + if ( + this.isContextual("type") && + // import type, { a } from "b"; + ahead.type !== tt.comma && + // import type from "a"; + !(ahead.type === tt.name && ahead.value === "from") + ) { + node.importKind = "type"; + this.next(); + } else { + node.importKind = "value"; + } } - return super.parseImport(node); + + const importNode = super.parseImport(node); + /*:: invariant(importNode.type !== "TSImportEqualsDeclaration") */ + + // `import type` can only be used on imports with named imports or with a + // default import - but not both + if ( + importNode.importKind === "type" && + importNode.specifiers.length > 1 && + importNode.specifiers[0].type === "ImportDefaultSpecifier" + ) { + this.raise( + importNode.start, + "A type-only import can specify a default import or named bindings, but not both.", + ); + } + + return importNode; } parseExport(node: N.Node): N.AnyExport { @@ -1741,6 +1922,13 @@ export default (superClass: Class): Class => this.semicolon(); return this.finishNode(decl, "TSNamespaceExportDeclaration"); } else { + if (this.isContextual("type") && this.lookahead().type === tt.braceL) { + this.next(); + node.exportKind = "type"; + } else { + node.exportKind = "value"; + } + return super.parseExport(node); } } @@ -1798,58 +1986,46 @@ export default (superClass: Class): Class => state: { hadConstructor: boolean }, constructorAllowsSuper: boolean, ): void { + this.tsParseModifiers(member, ["declare"]); const accessibility = this.parseAccessModifier(); if (accessibility) member.accessibility = accessibility; + this.tsParseModifiers(member, ["declare"]); super.parseClassMember(classBody, member, state, constructorAllowsSuper); } parseClassMemberWithIsStatic( classBody: N.ClassBody, - member: any, + member: N.ClassMember | N.TsIndexSignature, state: { hadConstructor: boolean }, isStatic: boolean, constructorAllowsSuper: boolean, ): void { - const methodOrProp: N.ClassMethod | N.ClassProperty = member; - const prop: N.ClassProperty = member; - const propOrIdx: N.ClassProperty | N.TsIndexSignature = member; - - let abstract = false, - readonly = false; - - const mod = this.tsParseModifier(["abstract", "readonly"]); - switch (mod) { - case "readonly": - readonly = true; - abstract = !!this.tsParseModifier(["abstract"]); - break; - case "abstract": - abstract = true; - readonly = !!this.tsParseModifier(["readonly"]); - break; - } + this.tsParseModifiers(member, ["abstract", "readonly", "declare"]); - if (abstract) methodOrProp.abstract = true; - if (readonly) propOrIdx.readonly = true; + const idx = this.tsTryParseIndexSignature(member); + if (idx) { + classBody.body.push(idx); - if (!abstract && !isStatic && !methodOrProp.accessibility) { - const idx = this.tsTryParseIndexSignature(member); - if (idx) { - classBody.body.push(idx); - return; + if ((member: any).abstract) { + this.raise(member.start, TSErrors.IndexSignatureHasAbstract); + } + if (isStatic) { + this.raise(member.start, TSErrors.IndexSignatureHasStatic); + } + if ((member: any).accessibility) { + this.raise( + member.start, + TSErrors.IndexSignatureHasAccessibility, + (member: any).accessibility, + ); } - } - if (readonly) { - // Must be a property (if not an index signature). - methodOrProp.static = isStatic; - this.parseClassPropertyName(prop); - this.parsePostMemberNameModifiers(methodOrProp); - this.pushClassProperty(classBody, prop); return; } + /*:: invariant(member.type !== "TSIndexSignature") */ + super.parseClassMemberWithIsStatic( classBody, member, @@ -1860,10 +2036,18 @@ export default (superClass: Class): Class => } parsePostMemberNameModifiers( - methodOrProp: N.ClassMethod | N.ClassProperty, + methodOrProp: N.ClassMethod | N.ClassProperty | N.ClassPrivateProperty, ): void { const optional = this.eat(tt.question); if (optional) methodOrProp.optional = true; + + if ((methodOrProp: any).readonly && this.match(tt.parenL)) { + this.raise(methodOrProp.start, TSErrors.ClassMethodHasReadonly); + } + + if ((methodOrProp: any).declare && this.match(tt.parenL)) { + this.raise(methodOrProp.start, TSErrors.ClassMethodHasDeclare); + } } // Note: The reason we do this in `parseExpressionStatement` and not `parseStatement` @@ -1908,19 +2092,17 @@ export default (superClass: Class): Class => ); } - const state = this.state.clone(); - try { - return super.parseConditional(expr, noIn, startPos, startLoc); - } catch (err) { - if (!(err instanceof SyntaxError)) { - // istanbul ignore next: no such error is expected - throw err; - } + const result = this.tryParse(() => + super.parseConditional(expr, noIn, startPos, startLoc), + ); - this.state = state; - refNeedsArrowPos.start = err.pos || this.state.start; + if (!result.node) { + // $FlowIgnore + refNeedsArrowPos.start = result.error.pos || this.state.start; return expr; } + if (result.error) this.state = result.failState; + return result.node; } // Note: These "type casts" are *not* valid TS expressions. @@ -1969,6 +2151,14 @@ export default (superClass: Class): Class => if (!declaration) { declaration = super.parseExportDeclaration(node); } + if ( + declaration && + (declaration.type === "TSInterfaceDeclaration" || + declaration.type === "TSTypeAliasDeclaration" || + isDeclare) + ) { + node.exportKind = "type"; + } if (declaration && isDeclare) { // Reset location to include `declare` in range @@ -1989,21 +2179,58 @@ export default (superClass: Class): Class => return; } - super.parseClassId(...arguments); + super.parseClassId( + node, + isStatement, + optionalId, + (node: any).declare ? BIND_TS_AMBIENT : BIND_CLASS, + ); const typeParameters = this.tsTryParseTypeParameters(); if (typeParameters) node.typeParameters = typeParameters; } - parseClassProperty(node: N.ClassProperty): N.ClassProperty { + parseClassPropertyAnnotation( + node: N.ClassProperty | N.ClassPrivateProperty, + ): void { if (!node.optional && this.eat(tt.bang)) { node.definite = true; } const type = this.tsTryParseTypeAnnotation(); if (type) node.typeAnnotation = type; + } + + parseClassProperty(node: N.ClassProperty): N.ClassProperty { + this.parseClassPropertyAnnotation(node); + + if (node.declare && this.match(tt.equal)) { + this.raise(this.state.start, TSErrors.DeclareClassFieldHasInitializer); + } + return super.parseClassProperty(node); } + parseClassPrivateProperty( + node: N.ClassPrivateProperty, + ): N.ClassPrivateProperty { + // $FlowIgnore + if (node.abstract) { + this.raise(node.start, TSErrors.PrivateElementHasAbstract); + } + + // $FlowIgnore + if (node.accessibility) { + this.raise( + node.start, + TSErrors.PrivateElementHasAccessibility, + node.accessibility, + ); + } + + this.parseClassPropertyAnnotation(node); + return super.parseClassPrivateProperty(node); + } + pushClassMethod( classBody: N.ClassBody, method: N.ClassMethod, @@ -2089,88 +2316,105 @@ export default (superClass: Class): Class => parseMaybeAssign(...args): N.Expression { // Note: When the JSX plugin is on, type assertions (` x`) aren't valid syntax. - let jsxError: ?SyntaxError; + let state: ?State; + let jsx; + let typeCast; if (this.match(tt.jsxTagStart)) { - const context = this.curContext(); - assert(context === ct.j_oTag); - // Only time j_oTag is pushed is right after j_expr. - assert(this.state.context[this.state.context.length - 2] === ct.j_expr); - // Prefer to parse JSX if possible. But may be an arrow fn. - const state = this.state.clone(); - try { - return super.parseMaybeAssign(...args); - } catch (err) { - if (!(err instanceof SyntaxError)) { - // istanbul ignore next: no such error is expected - throw err; - } + state = this.state.clone(); + + jsx = this.tryParse(() => super.parseMaybeAssign(...args), state); + /*:: invariant(!jsx.aborted) */ - this.state = state; - // Pop the context added by the jsxTagStart. - assert(this.curContext() === ct.j_oTag); - this.state.context.pop(); - assert(this.curContext() === ct.j_expr); - this.state.context.pop(); - jsxError = err; + if (!jsx.error) return jsx.node; + + // Remove `tc.j_expr` and `tc.j_oTag` from context added + // by parsing `jsxTagStart` to stop the JSX plugin from + // messing with the tokens + const { context } = this.state; + if (context[context.length - 1] === ct.j_oTag) { + context.length -= 2; + } else if (context[context.length - 1] === ct.j_expr) { + context.length -= 1; } } - if (jsxError === undefined && !this.isRelational("<")) { + if (!(jsx && jsx.error) && !this.isRelational("<")) { return super.parseMaybeAssign(...args); } // Either way, we're looking at a '<': tt.jsxTagStart or relational. - let arrowExpression; let typeParameters: N.TsTypeParameterDeclaration; - const state = this.state.clone(); - try { + state = state || this.state.clone(); + + const arrow = this.tryParse(abort => { // This is similar to TypeScript's `tryParseParenthesizedArrowFunctionExpression`. typeParameters = this.tsParseTypeParameters(); - arrowExpression = super.parseMaybeAssign(...args); + const expr = super.parseMaybeAssign(...args); + if ( - arrowExpression.type !== "ArrowFunctionExpression" || - (arrowExpression.extra && arrowExpression.extra.parenthesized) + expr.type !== "ArrowFunctionExpression" || + (expr.extra && expr.extra.parenthesized) ) { - this.unexpected(); // Go to the catch block (needs a SyntaxError). - } - } catch (err) { - if (!(err instanceof SyntaxError)) { - // istanbul ignore next: no such error is expected - throw err; + abort(); } - if (jsxError) { - throw jsxError; + // Correct TypeScript code should have at least 1 type parameter, but don't crash on bad code. + if (typeParameters && typeParameters.params.length !== 0) { + this.resetStartLocationFromNode(expr, typeParameters); } + expr.typeParameters = typeParameters; + return expr; + }, state); + + if (!arrow.error && !arrow.aborted) return arrow.node; + if (!jsx) { // Try parsing a type cast instead of an arrow function. // This will never happen outside of JSX. // (Because in JSX the '<' should be a jsxTagStart and not a relational. assert(!this.hasPlugin("jsx")); - // Parsing an arrow function failed, so try a type cast. - this.state = state; + // This will start with a type assertion (via parseMaybeUnary). // But don't directly call `this.tsParseTypeAssertion` because we want to handle any binary after it. - return super.parseMaybeAssign(...args); + typeCast = this.tryParse(() => super.parseMaybeAssign(...args), state); + /*:: invariant(!typeCast.aborted) */ + if (!typeCast.error) return typeCast.node; } - // Correct TypeScript code should have at least 1 type parameter, but don't crash on bad code. - if (typeParameters && typeParameters.params.length !== 0) { - this.resetStartLocationFromNode(arrowExpression, typeParameters); + if (jsx && jsx.node) { + /*:: invariant(jsx.failState) */ + this.state = jsx.failState; + return jsx.node; } - arrowExpression.typeParameters = typeParameters; - return arrowExpression; + + if (arrow.node) { + /*:: invariant(arrow.failState) */ + this.state = arrow.failState; + return arrow.node; + } + + if (typeCast && typeCast.node) { + /*:: invariant(typeCast.failState) */ + this.state = typeCast.failState; + return typeCast.node; + } + + if (jsx && jsx.thrown) throw jsx.error; + if (arrow.thrown) throw arrow.error; + if (typeCast && typeCast.thrown) throw typeCast.error; + + throw (jsx && jsx.error) || arrow.error || (typeCast && typeCast.error); } // Handle type assertions - parseMaybeUnary(refShorthandDefaultPos?: ?Pos): N.Expression { + parseMaybeUnary(refExpressionErrors?: ?ExpressionErrors): N.Expression { if (!this.hasPlugin("jsx") && this.isRelational("<")) { return this.tsParseTypeAssertion(); } else { - return super.parseMaybeUnary(refShorthandDefaultPos); + return super.parseMaybeUnary(refExpressionErrors); } } @@ -2178,23 +2422,20 @@ export default (superClass: Class): Class => if (this.match(tt.colon)) { // This is different from how the TS parser does it. // TS uses lookahead. The Babel Parser parses it as a parenthesized expression and converts. - const state = this.state.clone(); - try { + + const result = this.tryParse(abort => { const returnType = this.tsParseTypeOrTypePredicateAnnotation( tt.colon, ); - if (this.canInsertSemicolon() || !this.match(tt.arrow)) { - this.state = state; - return undefined; - } - node.returnType = returnType; - } catch (err) { - if (err instanceof SyntaxError) { - this.state = state; - } else { - // istanbul ignore next: no such error is expected - throw err; - } + if (this.canInsertSemicolon() || !this.match(tt.arrow)) abort(); + return returnType; + }); + + if (result.aborted) return; + + if (!result.thrown) { + if (result.error) this.state = result.failState; + node.returnType = result.node; } } @@ -2205,13 +2446,10 @@ export default (superClass: Class): Class => parseAssignableListItemTypes(param: N.Pattern) { if (this.eat(tt.question)) { if (param.type !== "Identifier") { - throw this.raise( - param.start, - "A binding pattern parameter cannot be optional in an implementation signature.", - ); + this.raise(param.start, TSErrors.PatternIsOptional); } - param.optional = true; + ((param: any): N.Identifier).optional = true; } const type = this.tsTryParseTypeAnnotation(); if (type) param.typeAnnotation = type; @@ -2220,31 +2458,19 @@ export default (superClass: Class): Class => return param; } - toAssignable( - node: N.Node, - isBinding: ?boolean, - contextDescription: string, - ): N.Node { + toAssignable(node: N.Node): N.Node { switch (node.type) { case "TSTypeCastExpression": - return super.toAssignable( - this.typeCastToParameter(node), - isBinding, - contextDescription, - ); + return super.toAssignable(this.typeCastToParameter(node)); case "TSParameterProperty": - return super.toAssignable(node, isBinding, contextDescription); + return super.toAssignable(node); case "TSAsExpression": case "TSNonNullExpression": case "TSTypeAssertion": - node.expression = this.toAssignable( - node.expression, - isBinding, - contextDescription, - ); + node.expression = this.toAssignable(node.expression); return node; default: - return super.toAssignable(node, isBinding, contextDescription); + return super.toAssignable(node); } } @@ -2335,8 +2561,7 @@ export default (superClass: Class): Class => ) { this.raise( node.typeAnnotation.start, - "Type annotations must come before default assignments, " + - "e.g. instead of `age = 25: number` use `age: number = 25`", + TSErrors.TypeAnnotationAfterAssign, ); } @@ -2352,11 +2577,7 @@ export default (superClass: Class): Class => } } - toAssignableList( - exprList: N.Expression[], - isBinding: ?boolean, - contextDescription: string, - ): $ReadOnlyArray { + toAssignableList(exprList: N.Expression[]): $ReadOnlyArray { for (let i = 0; i < exprList.length; i++) { const expr = exprList[i]; if (!expr) continue; @@ -2366,14 +2587,15 @@ export default (superClass: Class): Class => break; case "TSAsExpression": case "TSTypeAssertion": - this.raise( - expr.start, - "Unexpected type cast in parameter position.", - ); + if (!this.state.maybeInArrowParameters) { + exprList[i] = this.typeCastToParameter(expr); + } else { + this.raise(expr.start, TSErrors.UnexpectedTypeCastInParameter); + } break; } } - return super.toAssignableList(exprList, isBinding, contextDescription); + return super.toAssignableList(...arguments); } typeCastToParameter(node: N.TsTypeCastExpression): N.Node { @@ -2394,12 +2616,8 @@ export default (superClass: Class): Class => ): $ReadOnlyArray { for (let i = 0; i < exprList.length; i++) { const expr = exprList[i]; - if ( - expr && - expr._exprListItem && - expr.type === "TsTypeCastExpression" - ) { - this.raise(expr.start, "Did not expect a type annotation here."); + if (expr && expr.type === "TSTypeCastExpression") { + this.raise(expr.start, TSErrors.UnexpectedTypeAnnotation); } } diff --git a/packages/babel-parser/src/plugins/typescript/scope.js b/packages/babel-parser/src/plugins/typescript/scope.js index f706f1e88e99..085b90e73496 100644 --- a/packages/babel-parser/src/plugins/typescript/scope.js +++ b/packages/babel-parser/src/plugins/typescript/scope.js @@ -25,7 +25,7 @@ class TypeScriptScope extends Scope { // classes (which are also in .lexical) and interface (which are also in .types) classes: string[] = []; - // namespaces and bodyless-functions are too difficult to track, + // namespaces and ambient functions (or classes) are too difficult to track, // especially without type analysis. // We need to track them anyway, to avoid "X is not defined" errors // when exporting them. diff --git a/packages/babel-parser/src/plugins/v8intrinsic.js b/packages/babel-parser/src/plugins/v8intrinsic.js new file mode 100644 index 000000000000..be3a1fbaae0d --- /dev/null +++ b/packages/babel-parser/src/plugins/v8intrinsic.js @@ -0,0 +1,32 @@ +import type Parser from "../parser"; +import { types as tt } from "../tokenizer/types"; +import * as N from "../types"; + +export default (superClass: Class): Class => + class extends superClass { + parseV8Intrinsic(): N.Expression { + if (this.match(tt.modulo)) { + const v8IntrinsicStart = this.state.start; + // let the `loc` of Identifier starts from `%` + const node = this.startNode(); + this.eat(tt.modulo); + if (this.match(tt.name)) { + const name = this.parseIdentifierName(this.state.start); + const identifier = this.createIdentifier(node, name); + identifier.type = "V8IntrinsicIdentifier"; + if (this.match(tt.parenL)) { + return identifier; + } + } + this.unexpected(v8IntrinsicStart); + } + } + + /* ============================================================ * + * parser/expression.js * + * ============================================================ */ + + parseExprAtom(): N.Expression { + return this.parseV8Intrinsic() || super.parseExprAtom(...arguments); + } + }; diff --git a/packages/babel-parser/src/tokenizer/context.js b/packages/babel-parser/src/tokenizer/context.js index 1d8108874f4a..9f973085a168 100644 --- a/packages/babel-parser/src/tokenizer/context.js +++ b/packages/babel-parser/src/tokenizer/context.js @@ -59,8 +59,11 @@ tt.name.updateContext = function(prevType) { let allowed = false; if (prevType !== tt.dot) { if ( - (this.state.value === "of" && !this.state.exprAllowed) || - (this.state.value === "yield" && this.scope.inGenerator) + (this.state.value === "of" && + !this.state.exprAllowed && + prevType !== tt._function && + prevType !== tt._class) || + (this.state.value === "yield" && this.prodParam.hasYield) ) { allowed = true; } @@ -101,7 +104,10 @@ tt.incDec.updateContext = function() { }; tt._function.updateContext = tt._class.updateContext = function(prevType) { - if ( + if (prevType === tt.dot || prevType === tt.questionDot) { + // when function/class follows dot/questionDot, it is part of + // (optional)MemberExpression, then we don't need to push new token context + } else if ( prevType.beforeExpr && prevType !== tt.semi && prevType !== tt._else && @@ -130,3 +136,7 @@ tt.backQuote.updateContext = function() { } this.state.exprAllowed = false; }; + +tt.star.updateContext = function() { + this.state.exprAllowed = false; +}; diff --git a/packages/babel-parser/src/tokenizer/index.js b/packages/babel-parser/src/tokenizer/index.js index ffb8cba8ca6f..96ff0c21297a 100644 --- a/packages/babel-parser/src/tokenizer/index.js +++ b/packages/babel-parser/src/tokenizer/index.js @@ -1,18 +1,20 @@ // @flow import type { Options } from "../options"; +import * as N from "../types"; import type { Position } from "../util/location"; import * as charCodes from "charcodes"; import { isIdentifierStart, isIdentifierChar } from "../util/identifier"; import { types as tt, keywords as keywordTypes, type TokenType } from "./types"; import { type TokContext, types as ct } from "./context"; -import LocationParser from "../parser/location"; +import LocationParser, { Errors } from "../parser/location"; import { SourceLocation } from "../util/location"; import { lineBreak, lineBreakG, isNewLine, isWhitespace, + skipWhiteSpace, } from "../util/whitespace"; import State from "./state"; @@ -109,10 +111,16 @@ export class Token { export default class Tokenizer extends LocationParser { // Forward-declarations // parser/util.js + /*:: +unexpected: (pos?: ?number, messageOrType?: string | TokenType) => empty; + +expectPlugin: (name: string, pos?: ?number) => true; + */ isLookahead: boolean; + // Token store. + tokens: Array = []; + constructor(options: Options, input: string) { super(); this.state = new State(); @@ -122,11 +130,22 @@ export default class Tokenizer extends LocationParser { this.isLookahead = false; } + pushToken(token: Token | N.Comment) { + // Pop out invalid tokens trapped by try-catch parsing. + // Those parsing branches are mainly created by typescript and flow plugins. + this.tokens.length = this.state.tokensLength; + this.tokens.push(token); + ++this.state.tokensLength; + } + // Move to the next token next(): void { - if (this.options.tokens && !this.isLookahead) { - this.state.tokens.push(new Token(this.state)); + if (!this.isLookahead) { + this.checkKeywordEscapes(); + if (this.options.tokens) { + this.pushToken(new Token(this.state)); + } } this.state.lastTokEnd = this.state.end; @@ -168,6 +187,18 @@ export default class Tokenizer extends LocationParser { return curr; } + nextTokenStart(): number { + const thisTokEnd = this.state.pos; + skipWhiteSpace.lastIndex = thisTokEnd; + const skip = skipWhiteSpace.exec(this.input); + // $FlowIgnore: The skipWhiteSpace ensures to match any string + return thisTokEnd + skip[0].length; + } + + lookaheadCharCode(): number { + return this.input.charCodeAt(this.nextTokenStart()); + } + // Toggle strict mode. Re-reads the next number or string to please // pedantic tests (`"use strict"; 010;` should fail). @@ -194,8 +225,7 @@ export default class Tokenizer extends LocationParser { const curContext = this.curContext(); if (!curContext || !curContext.preserveSpace) this.skipSpace(); - this.state.containsOctal = false; - this.state.octalPosition = null; + this.state.octalPositions = []; this.state.start = this.state.pos; this.state.startLoc = this.state.curPosition(); if (this.state.pos >= this.length) { @@ -203,8 +233,9 @@ export default class Tokenizer extends LocationParser { return; } - if (curContext.override) { - curContext.override(this); + const override = curContext?.override; + if (override) { + override(this); } else { this.getTokenFromCode(this.input.codePointAt(this.state.pos)); } @@ -226,7 +257,7 @@ export default class Tokenizer extends LocationParser { loc: new SourceLocation(startLoc, endLoc), }; - if (this.options.tokens) this.state.tokens.push(comment); + if (this.options.tokens) this.pushToken(comment); this.state.comments.push(comment); this.addComment(comment); } @@ -234,8 +265,8 @@ export default class Tokenizer extends LocationParser { skipBlockComment(): void { const startLoc = this.state.curPosition(); const start = this.state.pos; - const end = this.input.indexOf("*/", (this.state.pos += 2)); - if (end === -1) this.raise(this.state.pos - 2, "Unterminated comment"); + const end = this.input.indexOf("*/", this.state.pos + 2); + if (end === -1) throw this.raise(start, Errors.UnterminatedComment); this.state.pos = end + 2; lineBreakG.lastIndex = start; @@ -267,13 +298,7 @@ export default class Tokenizer extends LocationParser { const startLoc = this.state.curPosition(); let ch = this.input.charCodeAt((this.state.pos += startSkip)); if (this.state.pos < this.length) { - while ( - ch !== charCodes.lineFeed && - ch !== charCodes.carriageReturn && - ch !== charCodes.lineSeparator && - ch !== charCodes.paragraphSeparator && - ++this.state.pos < this.length - ) { + while (!isNewLine(ch) && ++this.state.pos < this.length) { ch = this.input.charCodeAt(this.state.pos); } } @@ -310,7 +335,7 @@ export default class Tokenizer extends LocationParser { ) { ++this.state.pos; } - + // fall through case charCodes.lineFeed: case charCodes.lineSeparator: case charCodes.paragraphSeparator: @@ -377,23 +402,37 @@ export default class Tokenizer extends LocationParser { const nextPos = this.state.pos + 1; const next = this.input.charCodeAt(nextPos); if (next >= charCodes.digit0 && next <= charCodes.digit9) { - this.raise(this.state.pos, "Unexpected digit after hash token"); + throw this.raise(this.state.pos, Errors.UnexpectedDigitAfterHash); } if ( - (this.hasPlugin("classPrivateProperties") || - this.hasPlugin("classPrivateMethods")) && - this.state.classLevel > 0 - ) { - ++this.state.pos; - this.finishToken(tt.hash); - return; - } else if ( - this.getPluginOption("pipelineOperator", "proposal") === "smart" + next === charCodes.leftCurlyBrace || + (next === charCodes.leftSquareBracket && this.hasPlugin("recordAndTuple")) ) { - this.finishOp(tt.hash, 1); + // When we see `#{`, it is likely to be a hash record. + // However we don't yell at `#[` since users may intend to use "computed private fields", + // which is not allowed in the spec. Throwing expecting recordAndTuple is + // misleading + this.expectPlugin("recordAndTuple"); + if (this.getPluginOption("recordAndTuple", "syntaxType") !== "hash") { + throw this.raise( + this.state.pos, + next === charCodes.leftCurlyBrace + ? Errors.RecordExpressionHashIncorrectStartSyntaxType + : Errors.TupleExpressionHashIncorrectStartSyntaxType, + ); + } + + if (next === charCodes.leftCurlyBrace) { + // #{ + this.finishToken(tt.braceHashL); + } else { + // #[ + this.finishToken(tt.bracketHashL); + } + this.state.pos += 2; } else { - this.raise(this.state.pos, "Unexpected character '#'"); + this.finishOp(tt.hash, 1); } } @@ -404,8 +443,10 @@ export default class Tokenizer extends LocationParser { return; } - const next2 = this.input.charCodeAt(this.state.pos + 2); - if (next === charCodes.dot && next2 === charCodes.dot) { + if ( + next === charCodes.dot && + this.input.charCodeAt(this.state.pos + 2) === charCodes.dot + ) { this.state.pos += 3; this.finishToken(tt.ellipsis); } else { @@ -433,19 +474,13 @@ export default class Tokenizer extends LocationParser { readToken_interpreter(): boolean { if (this.state.pos !== 0 || this.length < 2) return false; + let ch = this.input.charCodeAt(this.state.pos + 1); + if (ch !== charCodes.exclamationMark) return false; + const start = this.state.pos; this.state.pos += 1; - let ch = this.input.charCodeAt(this.state.pos); - if (ch !== charCodes.exclamationMark) return false; - - while ( - ch !== charCodes.lineFeed && - ch !== charCodes.carriageReturn && - ch !== charCodes.lineSeparator && - ch !== charCodes.paragraphSeparator && - ++this.state.pos < this.length - ) { + while (!isNewLine(ch) && ++this.state.pos < this.length) { ch = this.input.charCodeAt(this.state.pos); } @@ -500,6 +535,37 @@ export default class Tokenizer extends LocationParser { this.finishOp(tt.pipeline, 2); return; } + // '|}' + if ( + this.hasPlugin("recordAndTuple") && + next === charCodes.rightCurlyBrace + ) { + if (this.getPluginOption("recordAndTuple", "syntaxType") !== "bar") { + throw this.raise( + this.state.pos, + Errors.RecordExpressionBarIncorrectEndSyntaxType, + ); + } + + this.finishOp(tt.braceBarR, 2); + return; + } + + // '|]' + if ( + this.hasPlugin("recordAndTuple") && + next === charCodes.rightSquareBracket + ) { + if (this.getPluginOption("recordAndTuple", "syntaxType") !== "bar") { + throw this.raise( + this.state.pos, + Errors.TupleExpressionBarIncorrectEndSyntaxType, + ); + } + + this.finishOp(tt.bracketBarR, 2); + return; + } } if (next === charCodes.equalsTo) { @@ -668,16 +734,48 @@ export default class Tokenizer extends LocationParser { this.finishToken(tt.comma); return; case charCodes.leftSquareBracket: - ++this.state.pos; - this.finishToken(tt.bracketL); + if ( + this.hasPlugin("recordAndTuple") && + this.input.charCodeAt(this.state.pos + 1) === charCodes.verticalBar + ) { + if (this.getPluginOption("recordAndTuple", "syntaxType") !== "bar") { + throw this.raise( + this.state.pos, + Errors.TupleExpressionBarIncorrectStartSyntaxType, + ); + } + + // [| + this.finishToken(tt.bracketBarL); + this.state.pos += 2; + } else { + ++this.state.pos; + this.finishToken(tt.bracketL); + } return; case charCodes.rightSquareBracket: ++this.state.pos; this.finishToken(tt.bracketR); return; case charCodes.leftCurlyBrace: - ++this.state.pos; - this.finishToken(tt.braceL); + if ( + this.hasPlugin("recordAndTuple") && + this.input.charCodeAt(this.state.pos + 1) === charCodes.verticalBar + ) { + if (this.getPluginOption("recordAndTuple", "syntaxType") !== "bar") { + throw this.raise( + this.state.pos, + Errors.RecordExpressionBarIncorrectStartSyntaxType, + ); + } + + // {| + this.finishToken(tt.braceBarL); + this.state.pos += 2; + } else { + ++this.state.pos; + this.finishToken(tt.braceL); + } return; case charCodes.rightCurlyBrace: ++this.state.pos; @@ -724,7 +822,7 @@ export default class Tokenizer extends LocationParser { } } // Anything else beginning with a digit is an integer, octal - // number, or float. + // number, or float. (fall through) case charCodes.digit1: case charCodes.digit2: case charCodes.digit3: @@ -805,9 +903,10 @@ export default class Tokenizer extends LocationParser { } } - this.raise( + throw this.raise( this.state.pos, - `Unexpected character '${String.fromCodePoint(code)}'`, + Errors.InvalidOrUnexpectedToken, + String.fromCodePoint(code), ); } @@ -822,11 +921,11 @@ export default class Tokenizer extends LocationParser { let escaped, inClass; for (;;) { if (this.state.pos >= this.length) { - this.raise(start, "Unterminated regular expression"); + throw this.raise(start, Errors.UnterminatedRegExp); } const ch = this.input.charAt(this.state.pos); if (lineBreak.test(ch)) { - this.raise(start, "Unterminated regular expression"); + throw this.raise(start, Errors.UnterminatedRegExp); } if (escaped) { escaped = false; @@ -853,19 +952,19 @@ export default class Tokenizer extends LocationParser { if (VALID_REGEX_FLAGS.has(char)) { if (mods.indexOf(char) > -1) { - this.raise(this.state.pos + 1, "Duplicate regular expression flag"); + this.raise(this.state.pos + 1, Errors.DuplicateRegExpFlags); } - - ++this.state.pos; - mods += char; } else if ( isIdentifierChar(charCode) || charCode === charCodes.backslash ) { - this.raise(this.state.pos + 1, "Invalid regular expression flag"); + this.raise(this.state.pos + 1, Errors.MalformedRegExpFlags); } else { break; } + + ++this.state.pos; + mods += char; } this.finishToken(tt.regexp, { @@ -877,8 +976,18 @@ export default class Tokenizer extends LocationParser { // Read an integer in the given radix. Return null if zero digits // were read, the integer value otherwise. When `len` is given, this // will return `null` unless the integer has exactly `len` digits. - - readInt(radix: number, len?: number): number | null { + // When `forceLen` is `true`, it means that we already know that in case + // of a malformed number we have to skip `len` characters anyway, instead + // of bailing out early. For example, in "\u{123Z}" we want to read up to } + // anyway, while in "\u00Z" we will stop at Z instead of consuming four + // characters (and thus the closing quote). + + readInt( + radix: number, + len?: number, + forceLen?: boolean, + allowNumSeparator: boolean = true, + ): number | null { const start = this.state.pos; const forbiddenSiblings = radix === 16 @@ -893,6 +1002,7 @@ export default class Tokenizer extends LocationParser { ? allowedNumericSeparatorSiblings.oct : allowedNumericSeparatorSiblings.bin; + let invalid = false; let total = 0; for (let i = 0, e = len == null ? Infinity : len; i < e; ++i) { @@ -900,19 +1010,21 @@ export default class Tokenizer extends LocationParser { let val; if (this.hasPlugin("numericSeparator")) { - const prev = this.input.charCodeAt(this.state.pos - 1); - const next = this.input.charCodeAt(this.state.pos + 1); if (code === charCodes.underscore) { + const prev = this.input.charCodeAt(this.state.pos - 1); + const next = this.input.charCodeAt(this.state.pos + 1); if (allowedSiblings.indexOf(next) === -1) { - this.raise(this.state.pos, "Invalid or unexpected token"); - } - - if ( + this.raise(this.state.pos, Errors.UnexpectedNumericSeparator); + } else if ( forbiddenSiblings.indexOf(prev) > -1 || forbiddenSiblings.indexOf(next) > -1 || Number.isNaN(next) ) { - this.raise(this.state.pos, "Invalid or unexpected token"); + this.raise(this.state.pos, Errors.UnexpectedNumericSeparator); + } + + if (!allowNumSeparator) { + this.raise(this.state.pos, Errors.NumericSeparatorInEscapeSequence); } // Ignore this _ character @@ -930,13 +1042,27 @@ export default class Tokenizer extends LocationParser { } else { val = Infinity; } - if (val >= radix) break; + if (val >= radix) { + // If we are in "errorRecovery" mode and we found a digit which is too big, + // don't break the loop. + + if (this.options.errorRecovery && val <= 9) { + val = 0; + this.raise(this.state.start + i + 2, Errors.InvalidDigit, radix); + } else if (forceLen) { + val = 0; + invalid = true; + } else { + break; + } + } ++this.state.pos; total = total * radix + val; } if ( this.state.pos === start || - (len != null && this.state.pos - start !== len) + (len != null && this.state.pos - start !== len) || + invalid ) { return null; } @@ -951,18 +1077,21 @@ export default class Tokenizer extends LocationParser { this.state.pos += 2; // 0x const val = this.readInt(radix); if (val == null) { - this.raise(this.state.start + 2, "Expected number in radix " + radix); + this.raise(this.state.start + 2, Errors.InvalidDigit, radix); } + const next = this.input.charCodeAt(this.state.pos); - if (this.hasPlugin("bigInt")) { - if (this.input.charCodeAt(this.state.pos) === charCodes.lowercaseN) { - ++this.state.pos; - isBigInt = true; - } + if (next === charCodes.underscore) { + this.expectPlugin("numericSeparator", this.state.pos); + } + + if (next === charCodes.lowercaseN) { + ++this.state.pos; + isBigInt = true; } if (isIdentifierStart(this.input.codePointAt(this.state.pos))) { - this.raise(this.state.pos, "Identifier directly after number"); + throw this.raise(this.state.pos, Errors.NumberIdentifier); } if (isBigInt) { @@ -980,22 +1109,21 @@ export default class Tokenizer extends LocationParser { const start = this.state.pos; let isFloat = false; let isBigInt = false; + let isNonOctalDecimalInt = false; if (!startsWithDot && this.readInt(10) === null) { - this.raise(start, "Invalid number"); + this.raise(start, Errors.InvalidNumber); } let octal = this.state.pos - start >= 2 && this.input.charCodeAt(start) === charCodes.digit0; if (octal) { if (this.state.strict) { - this.raise( - start, - "Legacy octal literals are not allowed in strict mode", - ); + this.raise(start, Errors.StrictOctalLiteral); } if (/[89]/.test(this.input.slice(start, this.state.pos))) { octal = false; + isNonOctalDecimalInt = true; } } @@ -1020,17 +1148,32 @@ export default class Tokenizer extends LocationParser { next = this.input.charCodeAt(this.state.pos); } - if (this.hasPlugin("bigInt")) { - if (next === charCodes.lowercaseN) { - // disallow floats and legacy octal syntax, new style octal ("0o") is handled in this.readRadixNumber - if (isFloat || octal) this.raise(start, "Invalid BigIntLiteral"); - ++this.state.pos; - isBigInt = true; + // disallow numeric separators in non octal decimals and legacy octal likes + if (this.hasPlugin("numericSeparator") && (octal || isNonOctalDecimalInt)) { + const underscorePos = this.input + .slice(start, this.state.pos) + .indexOf("_"); + if (underscorePos > 0) { + this.raise(underscorePos + start, Errors.ZeroDigitNumericSeparator); + } + } + + if (next === charCodes.underscore) { + this.expectPlugin("numericSeparator", this.state.pos); + } + + if (next === charCodes.lowercaseN) { + // disallow floats, legacy octal syntax and non octal decimals + // new style octal ("0o") is handled in this.readRadixNumber + if (isFloat || octal || isNonOctalDecimalInt) { + this.raise(start, "Invalid BigIntLiteral"); } + ++this.state.pos; + isBigInt = true; } if (isIdentifierStart(this.input.codePointAt(this.state.pos))) { - this.raise(this.state.pos, "Identifier directly after number"); + throw this.raise(this.state.pos, Errors.NumberIdentifier); } // remove "_" for numeric literal separator, and "n" for BigInts @@ -1055,22 +1198,19 @@ export default class Tokenizer extends LocationParser { const codePos = ++this.state.pos; code = this.readHexChar( this.input.indexOf("}", this.state.pos) - this.state.pos, + true, throwOnInvalid, ); ++this.state.pos; - if (code === null) { - // $FlowFixMe (is this always non-null?) - --this.state.invalidTemplateEscapePosition; // to point to the '\'' instead of the 'u' - } else if (code > 0x10ffff) { + if (code !== null && code > 0x10ffff) { if (throwOnInvalid) { - this.raise(codePos, "Code point out of bounds"); + this.raise(codePos, Errors.InvalidCodePoint); } else { - this.state.invalidTemplateEscapePosition = codePos - 2; return null; } } } else { - code = this.readHexChar(4, throwOnInvalid); + code = this.readHexChar(4, false, throwOnInvalid); } return code; } @@ -1080,7 +1220,7 @@ export default class Tokenizer extends LocationParser { chunkStart = ++this.state.pos; for (;;) { if (this.state.pos >= this.length) { - this.raise(this.state.start, "Unterminated string constant"); + throw this.raise(this.state.start, Errors.UnterminatedString); } const ch = this.input.charCodeAt(this.state.pos); if (ch === quote) break; @@ -1095,8 +1235,9 @@ export default class Tokenizer extends LocationParser { ) { ++this.state.pos; ++this.state.curLine; + this.state.lineStart = this.state.pos; } else if (isNewLine(ch)) { - this.raise(this.state.start, "Unterminated string constant"); + throw this.raise(this.state.start, Errors.UnterminatedString); } else { ++this.state.pos; } @@ -1113,7 +1254,7 @@ export default class Tokenizer extends LocationParser { containsInvalid = false; for (;;) { if (this.state.pos >= this.length) { - this.raise(this.state.start, "Unterminated template"); + throw this.raise(this.state.start, Errors.UnterminatedTemplate); } const ch = this.input.charCodeAt(this.state.pos); if ( @@ -1154,6 +1295,7 @@ export default class Tokenizer extends LocationParser { if (this.input.charCodeAt(this.state.pos) === charCodes.lineFeed) { ++this.state.pos; } + // fall through case charCodes.lineFeed: out += "\n"; break; @@ -1182,7 +1324,7 @@ export default class Tokenizer extends LocationParser { case charCodes.lowercaseR: return "\r"; case charCodes.lowercaseX: { - const code = this.readHexChar(2, throwOnInvalid); + const code = this.readHexChar(2, false, throwOnInvalid); return code === null ? null : String.fromCharCode(code); } case charCodes.lowercaseU: { @@ -1201,12 +1343,20 @@ export default class Tokenizer extends LocationParser { if (this.input.charCodeAt(this.state.pos) === charCodes.lineFeed) { ++this.state.pos; } + // fall through case charCodes.lineFeed: this.state.lineStart = this.state.pos; ++this.state.curLine; + // fall through case charCodes.lineSeparator: case charCodes.paragraphSeparator: return ""; + case charCodes.digit8: + case charCodes.digit9: + if (inTemplate) { + return null; + } + // fall through default: if (ch >= charCodes.digit0 && ch <= charCodes.digit7) { const codePos = this.state.pos - 1; @@ -1227,15 +1377,14 @@ export default class Tokenizer extends LocationParser { next === charCodes.digit9 ) { if (inTemplate) { - this.state.invalidTemplateEscapePosition = codePos; return null; } else if (this.state.strict) { - this.raise(codePos, "Octal literal in strict mode"); - } else if (!this.state.containsOctal) { - // These properties are only used to throw an error for an octal which occurs - // in a directive which occurs prior to a "use strict" directive. - this.state.containsOctal = true; - this.state.octalPosition = codePos; + this.raise(codePos, Errors.StrictOctalLiteral); + } else { + // This property is used to throw an error for + // an octal literal in a directive that occurs prior + // to a "use strict" directive. + this.state.octalPositions.push(codePos); } } @@ -1248,15 +1397,18 @@ export default class Tokenizer extends LocationParser { // Used to read character escape sequences ('\x', '\u'). - readHexChar(len: number, throwOnInvalid: boolean): number | null { + readHexChar( + len: number, + forceLen: boolean, + throwOnInvalid: boolean, + ): number | null { const codePos = this.state.pos; - const n = this.readInt(16, len); + const n = this.readInt(16, len, forceLen, false); if (n === null) { if (throwOnInvalid) { - this.raise(codePos, "Bad character escape sequence"); + this.raise(codePos, Errors.InvalidEscapeSequence); } else { this.state.pos = codePos - 1; - this.state.invalidTemplateEscapePosition = codePos - 1; } } return n; @@ -1289,24 +1441,19 @@ export default class Tokenizer extends LocationParser { this.state.pos === start ? isIdentifierStart : isIdentifierChar; if (this.input.charCodeAt(++this.state.pos) !== charCodes.lowercaseU) { - this.raise( - this.state.pos, - "Expecting Unicode escape sequence \\uXXXX", - ); + this.raise(this.state.pos, Errors.MissingUnicodeEscape); + continue; } ++this.state.pos; const esc = this.readCodePoint(true); + if (esc !== null) { + if (!identifierCheck(esc)) { + this.raise(escStart, Errors.EscapedCharNotAnIdentifier); + } - if ( - // $FlowFixMe (thinks esc may be null, but throwOnInvalid is true) - !identifierCheck(esc, true) - ) { - this.raise(escStart, "Invalid Unicode escape"); + word += String.fromCodePoint(esc); } - - // $FlowFixMe - word += String.fromCodePoint(esc); chunkStart = this.state.pos; } else { break; @@ -1326,21 +1473,24 @@ export default class Tokenizer extends LocationParser { const word = this.readWord1(); const type = keywordTypes.get(word) || tt.name; - if (type.keyword && this.state.containsEsc) { - this.raise(this.state.pos, `Escape sequence in keyword ${word}`); - } - // Allow @@iterator and @@asyncIterator as a identifier only inside type if ( this.state.isIterator && (!this.isIterator(word) || !this.state.inType) ) { - this.raise(this.state.pos, `Invalid identifier ${word}`); + this.raise(this.state.pos, Errors.InvalidIdentifier, word); } this.finishToken(type, word); } + checkKeywordEscapes(): void { + const kw = this.state.type.keyword; + if (kw && this.state.containsEsc) { + this.raise(this.state.start, Errors.InvalidEscapedReservedWord, kw); + } + } + braceIsBlock(prevType: TokenType): boolean { const parent = this.curContext(); if (parent === ct.functionExpression || parent === ct.functionStatement) { diff --git a/packages/babel-parser/src/tokenizer/state.js b/packages/babel-parser/src/tokenizer/state.js index 80842fbc5103..c9e46a3c962d 100644 --- a/packages/babel-parser/src/tokenizer/state.js +++ b/packages/babel-parser/src/tokenizer/state.js @@ -5,7 +5,6 @@ import * as N from "../types"; import { Position } from "../util/location"; import { types as ct, type TokContext } from "./context"; -import type { Token } from "./index"; import { types as tt, type TokenType } from "./types"; type TopicContextState = { @@ -38,6 +37,8 @@ export default class State { this.startLoc = this.endLoc = this.curPosition(); } + errors: SyntaxError[] = []; + // Used to signify the start of a potential arrow function potentialArrowAt: number = -1; @@ -55,19 +56,18 @@ export default class State { // ^ noArrowParamsConversionAt: number[] = []; - // A comma after "...a" is only allowed in spread, but not in rest. - // Since we parse destructuring patterns as array/object literals - // and then convert them, we need to track it. - commaAfterSpreadAt: number = -1; - // Flags to track inParameters: boolean = false; maybeInArrowParameters: boolean = false; + // This flag is used to track async arrow head across function declarations. + // e.g. async (foo = function (await) {}) => {} + // When parsing `await` in this expression, `maybeInAsyncArrowHead` is true + // but `maybeInArrowParameters` is false + maybeInAsyncArrowHead: boolean = false; inPipeline: boolean = false; inType: boolean = false; noAnonFunctionType: boolean = false; inPropertyName: boolean = false; - inClassProperty: boolean = false; hasFlowComment: boolean = false; isIterator: boolean = false; @@ -81,9 +81,6 @@ export default class State { soloAwait: boolean = false; inFSharpPipelineDirectBody: boolean = false; - // Check whether we are in a (nested) class or not. - classLevel: number = 0; - // Labels in scope. labels: Array<{ kind: ?("loop" | "switch"), @@ -97,11 +94,8 @@ export default class State { decoratorStack: Array> = [[]]; // Positions to delayed-check that yield/await does not exist in default parameters. - yieldPos: number = 0; - awaitPos: number = 0; - - // Token store. - tokens: Array = []; + yieldPos: number = -1; + awaitPos: number = -1; // Comment store. comments: Array = []; @@ -152,15 +146,17 @@ export default class State { // escape sequences must not be interpreted as keywords. containsEsc: boolean = false; - // TODO - containsOctal: boolean = false; - octalPosition: ?number = null; + // This property is used to throw an error for + // an octal literal in a directive that occurs prior + // to a "use strict" directive. + octalPositions: number[] = []; // Names of exports store. `default` is stored as a name for both // `export default foo;` and `export { foo as default };`. exportedIdentifiers: Array = []; - invalidTemplateEscapePosition: ?number = null; + // Tokens length in token store + tokensLength: number = 0; curPosition(): Position { return new Position(this.curLine, this.pos - this.lineStart); diff --git a/packages/babel-parser/src/tokenizer/types.js b/packages/babel-parser/src/tokenizer/types.js index 34fd891c9256..acc456e9f952 100644 --- a/packages/babel-parser/src/tokenizer/types.js +++ b/packages/babel-parser/src/tokenizer/types.js @@ -93,9 +93,13 @@ export const types: { [name: string]: TokenType } = { // Punctuation token types. bracketL: new TokenType("[", { beforeExpr, startsExpr }), + bracketHashL: new TokenType("#[", { beforeExpr, startsExpr }), + bracketBarL: new TokenType("[|", { beforeExpr, startsExpr }), bracketR: new TokenType("]"), + bracketBarR: new TokenType("|]"), braceL: new TokenType("{", { beforeExpr, startsExpr }), braceBarL: new TokenType("{|", { beforeExpr, startsExpr }), + braceHashL: new TokenType("#{", { beforeExpr, startsExpr }), braceR: new TokenType("}"), braceBarR: new TokenType("|}"), parenL: new TokenType("(", { beforeExpr, startsExpr }), @@ -148,7 +152,8 @@ export const types: { [name: string]: TokenType } = { relational: createBinop("/<=/>=", 7), bitShift: createBinop("<>/>>>", 8), plusMin: new TokenType("+/-", { beforeExpr, binop: 9, prefix, startsExpr }), - modulo: createBinop("%", 10), + // startsExpr: required by v8intrinsic plugin + modulo: new TokenType("%", { beforeExpr, binop: 10, startsExpr }), star: createBinop("*", 10), slash: createBinop("/", 10), exponent: new TokenType("**", { @@ -158,6 +163,8 @@ export const types: { [name: string]: TokenType } = { }), // Keywords + // Don't forget to update packages/babel-helper-validator-identifier/src/keyword.js + // when new keywords are added _break: createKeyword("break"), _case: createKeyword("case", { beforeExpr }), _catch: createKeyword("catch"), diff --git a/packages/babel-parser/src/types.js b/packages/babel-parser/src/types.js index 2c5992d2ba6c..17f96dc4934c 100644 --- a/packages/babel-parser/src/types.js +++ b/packages/babel-parser/src/types.js @@ -96,7 +96,8 @@ export type Literal = | NullLiteral | StringLiteral | BooleanLiteral - | NumericLiteral; + | NumericLiteral + | BigIntLiteral; export type RegExpLiteral = NodeBase & { type: "RegExpLiteral", @@ -388,11 +389,21 @@ export type ArrayExpression = NodeBase & { elements: $ReadOnlyArray, }; +export type TupleExpression = NodeBase & { + type: "TupleExpression", + elements: $ReadOnlyArray, +}; + export type ObjectExpression = NodeBase & { type: "ObjectExpression", properties: $ReadOnlyArray, }; +export type RecordExpression = NodeBase & { + type: "RecordExpression", + properties: $ReadOnlyArray, +}; + export type ObjectOrClassMember = ClassMethod | ClassProperty | ObjectMember; export type ObjectMember = ObjectProperty | ObjectMethod; @@ -743,18 +754,19 @@ export type ClassPrivateMethod = NodeBase & computed: false, }; -export type ClassProperty = ClassMemberBase & { - type: "ClassProperty", - key: Expression, - value: ?Expression, // TODO: Not in spec that this is nullable. +export type ClassProperty = ClassMemberBase & + DeclarationBase & { + type: "ClassProperty", + key: Expression, + value: ?Expression, // TODO: Not in spec that this is nullable. - typeAnnotation?: ?TypeAnnotationBase, // TODO: Not in spec - variance?: ?FlowVariance, // TODO: Not in spec + typeAnnotation?: ?TypeAnnotationBase, // TODO: Not in spec + variance?: ?FlowVariance, // TODO: Not in spec - // TypeScript only: (TODO: Not in spec) - readonly?: true, - definite?: true, -}; + // TypeScript only: (TODO: Not in spec) + readonly?: true, + definite?: true, + }; export type ClassPrivateProperty = NodeBase & { type: "ClassPrivateProperty", @@ -762,7 +774,14 @@ export type ClassPrivateProperty = NodeBase & { value: ?Expression, // TODO: Not in spec that this is nullable. static: boolean, computed: false, - typeAnnotation?: ?TypeAnnotation, // TODO: Not in spec + + // Flow and Typescript + typeAnnotation?: ?TypeAnnotationBase, + + // TypeScript only + optional?: true, + definite?: true, + readonly?: true, }; export type OptClassDeclaration = ClassBase & @@ -1004,7 +1023,7 @@ export type FlowInterfaceType = NodeBase & { body: FlowObjectTypeAnnotation, }; -// estree +// ESTree export type EstreeProperty = NodeBase & { type: "Property", @@ -1030,6 +1049,11 @@ export type EstreeMethodDefinition = NodeBase & { variance?: ?FlowVariance, }; +export type EstreeImportExpression = NodeBase & { + type: "ImportExpression", + source: Expression, +}; + // === === === === // TypeScript // === === === === @@ -1219,6 +1243,7 @@ export type TsTypePredicate = TsTypeBase & { type: "TSTypePredicate", parameterName: Identifier | TsThisType, typeAnnotation: TsTypeAnnotation, + asserts?: boolean, }; // `typeof` operator @@ -1447,5 +1472,6 @@ export type Placeholder = NodeBase & { export type ParseSubscriptState = { optionalChainMember: boolean, + maybeAsyncArrow: boolean, stop: boolean, }; diff --git a/packages/babel-parser/src/util/class-scope.js b/packages/babel-parser/src/util/class-scope.js new file mode 100644 index 000000000000..6de6d790ea90 --- /dev/null +++ b/packages/babel-parser/src/util/class-scope.js @@ -0,0 +1,110 @@ +// @flow + +import { + CLASS_ELEMENT_KIND_ACCESSOR, + CLASS_ELEMENT_FLAG_STATIC, + type ClassElementTypes, +} from "./scopeflags"; +import { Errors } from "../parser/location"; + +export class ClassScope { + // A list of private named declared in the current class + privateNames: Set = new Set(); + + // A list of private getters of setters without their counterpart + loneAccessors: Map = new Map(); + + // A list of private names used before being defined, mapping to + // their position. + undefinedPrivateNames: Map = new Map(); +} + +type raiseFunction = (number, string, ...any) => void; + +export default class ClassScopeHandler { + stack: Array = []; + raise: raiseFunction; + undefinedPrivateNames: Map = new Map(); + + constructor(raise: raiseFunction) { + this.raise = raise; + } + + current(): ClassScope { + return this.stack[this.stack.length - 1]; + } + + enter() { + this.stack.push(new ClassScope()); + } + + exit() { + const oldClassScope = this.stack.pop(); + + // Migrate the usage of not yet defined private names to the outer + // class scope, or raise an error if we reached the top-level scope. + + const current = this.current(); + + // Array.from is needed because this is compiled to an array-like for loop + for (const [name, pos] of Array.from(oldClassScope.undefinedPrivateNames)) { + if (current) { + if (!current.undefinedPrivateNames.has(name)) { + current.undefinedPrivateNames.set(name, pos); + } + } else { + this.raise(pos, Errors.InvalidPrivateFieldResolution, name); + } + } + } + + declarePrivateName( + name: string, + elementType: ClassElementTypes, + pos: number, + ) { + const classScope = this.current(); + let redefined = classScope.privateNames.has(name); + + if (elementType & CLASS_ELEMENT_KIND_ACCESSOR) { + const accessor = redefined && classScope.loneAccessors.get(name); + if (accessor) { + const oldStatic = accessor & CLASS_ELEMENT_FLAG_STATIC; + const newStatic = elementType & CLASS_ELEMENT_FLAG_STATIC; + + const oldKind = accessor & CLASS_ELEMENT_KIND_ACCESSOR; + const newKind = elementType & CLASS_ELEMENT_KIND_ACCESSOR; + + // The private name can be duplicated only if it is used by + // two accessors with different kind (get and set), and if + // they have the same placement (static or not). + redefined = oldKind === newKind || oldStatic !== newStatic; + + if (!redefined) classScope.loneAccessors.delete(name); + } else if (!redefined) { + classScope.loneAccessors.set(name, elementType); + } + } + + if (redefined) { + this.raise(pos, Errors.PrivateNameRedeclaration, name); + } + + classScope.privateNames.add(name); + classScope.undefinedPrivateNames.delete(name); + } + + usePrivateName(name: string, pos: number) { + let classScope; + for (classScope of this.stack) { + if (classScope.privateNames.has(name)) return; + } + + if (classScope) { + classScope.undefinedPrivateNames.set(name, pos); + } else { + // top-level + this.raise(pos, Errors.InvalidPrivateFieldResolution, name); + } + } +} diff --git a/packages/babel-parser/src/util/identifier.js b/packages/babel-parser/src/util/identifier.js index 7fda0e27de71..8831967edb85 100644 --- a/packages/babel-parser/src/util/identifier.js +++ b/packages/babel-parser/src/util/identifier.js @@ -3,144 +3,21 @@ // @flow import * as charCodes from "charcodes"; -import { keywords } from "../tokenizer/types"; -const reservedWords = { - strict: [ - "implements", - "interface", - "let", - "package", - "private", - "protected", - "public", - "static", - "yield", - ], - strictBind: ["eval", "arguments"], -}; - -const reservedWordsStrictSet = new Set(reservedWords.strict); -const reservedWordsStrictBindSet = new Set( - reservedWords.strict.concat(reservedWords.strictBind), -); - -/** - * Checks if word is a reserved word in non-strict mode - */ -export const isReservedWord = (word: string, inModule: boolean): boolean => { - return (inModule && word === "await") || word === "enum"; -}; - -/** - * Checks if word is a reserved word in non-binding strict mode - * - * Includes non-strict reserved words - */ -export function isStrictReservedWord(word: string, inModule: boolean): boolean { - return isReservedWord(word, inModule) || reservedWordsStrictSet.has(word); -} - -/** - * Checks if word is a reserved word in binding strict mode - * - * Includes non-strict reserved words and non-binding strict reserved words - */ -export function isStrictBindReservedWord( - word: string, - inModule: boolean, -): boolean { - return isReservedWord(word, inModule) || reservedWordsStrictBindSet.has(word); -} - -export function isKeyword(word: string): boolean { - return keywords.has(word); -} +export { + isIdentifierStart, + isIdentifierChar, + isReservedWord, + isStrictBindOnlyReservedWord, + isStrictBindReservedWord, + isStrictReservedWord, + isKeyword, +} from "@babel/helper-validator-identifier"; export const keywordRelationalOperator = /^in(stanceof)?$/; -// ## Character categories - -// Big ugly regular expressions that match characters in the -// whitespace, identifier, and identifier-start categories. These -// are only applied when a character is found to actually have a -// code point above 0x80. -// Generated by `scripts/generate-identifier-regex.js`. - -/* prettier-ignore */ -let nonASCIIidentifierStartChars = "\xaa\xb5\xba\xc0-\xd6\xd8-\xf6\xf8-\u02c1\u02c6-\u02d1\u02e0-\u02e4\u02ec\u02ee\u0370-\u0374\u0376\u0377\u037a-\u037d\u037f\u0386\u0388-\u038a\u038c\u038e-\u03a1\u03a3-\u03f5\u03f7-\u0481\u048a-\u052f\u0531-\u0556\u0559\u0560-\u0588\u05d0-\u05ea\u05ef-\u05f2\u0620-\u064a\u066e\u066f\u0671-\u06d3\u06d5\u06e5\u06e6\u06ee\u06ef\u06fa-\u06fc\u06ff\u0710\u0712-\u072f\u074d-\u07a5\u07b1\u07ca-\u07ea\u07f4\u07f5\u07fa\u0800-\u0815\u081a\u0824\u0828\u0840-\u0858\u0860-\u086a\u08a0-\u08b4\u08b6-\u08bd\u0904-\u0939\u093d\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098c\u098f\u0990\u0993-\u09a8\u09aa-\u09b0\u09b2\u09b6-\u09b9\u09bd\u09ce\u09dc\u09dd\u09df-\u09e1\u09f0\u09f1\u09fc\u0a05-\u0a0a\u0a0f\u0a10\u0a13-\u0a28\u0a2a-\u0a30\u0a32\u0a33\u0a35\u0a36\u0a38\u0a39\u0a59-\u0a5c\u0a5e\u0a72-\u0a74\u0a85-\u0a8d\u0a8f-\u0a91\u0a93-\u0aa8\u0aaa-\u0ab0\u0ab2\u0ab3\u0ab5-\u0ab9\u0abd\u0ad0\u0ae0\u0ae1\u0af9\u0b05-\u0b0c\u0b0f\u0b10\u0b13-\u0b28\u0b2a-\u0b30\u0b32\u0b33\u0b35-\u0b39\u0b3d\u0b5c\u0b5d\u0b5f-\u0b61\u0b71\u0b83\u0b85-\u0b8a\u0b8e-\u0b90\u0b92-\u0b95\u0b99\u0b9a\u0b9c\u0b9e\u0b9f\u0ba3\u0ba4\u0ba8-\u0baa\u0bae-\u0bb9\u0bd0\u0c05-\u0c0c\u0c0e-\u0c10\u0c12-\u0c28\u0c2a-\u0c39\u0c3d\u0c58-\u0c5a\u0c60\u0c61\u0c80\u0c85-\u0c8c\u0c8e-\u0c90\u0c92-\u0ca8\u0caa-\u0cb3\u0cb5-\u0cb9\u0cbd\u0cde\u0ce0\u0ce1\u0cf1\u0cf2\u0d05-\u0d0c\u0d0e-\u0d10\u0d12-\u0d3a\u0d3d\u0d4e\u0d54-\u0d56\u0d5f-\u0d61\u0d7a-\u0d7f\u0d85-\u0d96\u0d9a-\u0db1\u0db3-\u0dbb\u0dbd\u0dc0-\u0dc6\u0e01-\u0e30\u0e32\u0e33\u0e40-\u0e46\u0e81\u0e82\u0e84\u0e86-\u0e8a\u0e8c-\u0ea3\u0ea5\u0ea7-\u0eb0\u0eb2\u0eb3\u0ebd\u0ec0-\u0ec4\u0ec6\u0edc-\u0edf\u0f00\u0f40-\u0f47\u0f49-\u0f6c\u0f88-\u0f8c\u1000-\u102a\u103f\u1050-\u1055\u105a-\u105d\u1061\u1065\u1066\u106e-\u1070\u1075-\u1081\u108e\u10a0-\u10c5\u10c7\u10cd\u10d0-\u10fa\u10fc-\u1248\u124a-\u124d\u1250-\u1256\u1258\u125a-\u125d\u1260-\u1288\u128a-\u128d\u1290-\u12b0\u12b2-\u12b5\u12b8-\u12be\u12c0\u12c2-\u12c5\u12c8-\u12d6\u12d8-\u1310\u1312-\u1315\u1318-\u135a\u1380-\u138f\u13a0-\u13f5\u13f8-\u13fd\u1401-\u166c\u166f-\u167f\u1681-\u169a\u16a0-\u16ea\u16ee-\u16f8\u1700-\u170c\u170e-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176c\u176e-\u1770\u1780-\u17b3\u17d7\u17dc\u1820-\u1878\u1880-\u18a8\u18aa\u18b0-\u18f5\u1900-\u191e\u1950-\u196d\u1970-\u1974\u1980-\u19ab\u19b0-\u19c9\u1a00-\u1a16\u1a20-\u1a54\u1aa7\u1b05-\u1b33\u1b45-\u1b4b\u1b83-\u1ba0\u1bae\u1baf\u1bba-\u1be5\u1c00-\u1c23\u1c4d-\u1c4f\u1c5a-\u1c7d\u1c80-\u1c88\u1c90-\u1cba\u1cbd-\u1cbf\u1ce9-\u1cec\u1cee-\u1cf3\u1cf5\u1cf6\u1cfa\u1d00-\u1dbf\u1e00-\u1f15\u1f18-\u1f1d\u1f20-\u1f45\u1f48-\u1f4d\u1f50-\u1f57\u1f59\u1f5b\u1f5d\u1f5f-\u1f7d\u1f80-\u1fb4\u1fb6-\u1fbc\u1fbe\u1fc2-\u1fc4\u1fc6-\u1fcc\u1fd0-\u1fd3\u1fd6-\u1fdb\u1fe0-\u1fec\u1ff2-\u1ff4\u1ff6-\u1ffc\u2071\u207f\u2090-\u209c\u2102\u2107\u210a-\u2113\u2115\u2118-\u211d\u2124\u2126\u2128\u212a-\u2139\u213c-\u213f\u2145-\u2149\u214e\u2160-\u2188\u2c00-\u2c2e\u2c30-\u2c5e\u2c60-\u2ce4\u2ceb-\u2cee\u2cf2\u2cf3\u2d00-\u2d25\u2d27\u2d2d\u2d30-\u2d67\u2d6f\u2d80-\u2d96\u2da0-\u2da6\u2da8-\u2dae\u2db0-\u2db6\u2db8-\u2dbe\u2dc0-\u2dc6\u2dc8-\u2dce\u2dd0-\u2dd6\u2dd8-\u2dde\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303c\u3041-\u3096\u309b-\u309f\u30a1-\u30fa\u30fc-\u30ff\u3105-\u312f\u3131-\u318e\u31a0-\u31ba\u31f0-\u31ff\u3400-\u4db5\u4e00-\u9fef\ua000-\ua48c\ua4d0-\ua4fd\ua500-\ua60c\ua610-\ua61f\ua62a\ua62b\ua640-\ua66e\ua67f-\ua69d\ua6a0-\ua6ef\ua717-\ua71f\ua722-\ua788\ua78b-\ua7bf\ua7c2-\ua7c6\ua7f7-\ua801\ua803-\ua805\ua807-\ua80a\ua80c-\ua822\ua840-\ua873\ua882-\ua8b3\ua8f2-\ua8f7\ua8fb\ua8fd\ua8fe\ua90a-\ua925\ua930-\ua946\ua960-\ua97c\ua984-\ua9b2\ua9cf\ua9e0-\ua9e4\ua9e6-\ua9ef\ua9fa-\ua9fe\uaa00-\uaa28\uaa40-\uaa42\uaa44-\uaa4b\uaa60-\uaa76\uaa7a\uaa7e-\uaaaf\uaab1\uaab5\uaab6\uaab9-\uaabd\uaac0\uaac2\uaadb-\uaadd\uaae0-\uaaea\uaaf2-\uaaf4\uab01-\uab06\uab09-\uab0e\uab11-\uab16\uab20-\uab26\uab28-\uab2e\uab30-\uab5a\uab5c-\uab67\uab70-\uabe2\uac00-\ud7a3\ud7b0-\ud7c6\ud7cb-\ud7fb\uf900-\ufa6d\ufa70-\ufad9\ufb00-\ufb06\ufb13-\ufb17\ufb1d\ufb1f-\ufb28\ufb2a-\ufb36\ufb38-\ufb3c\ufb3e\ufb40\ufb41\ufb43\ufb44\ufb46-\ufbb1\ufbd3-\ufd3d\ufd50-\ufd8f\ufd92-\ufdc7\ufdf0-\ufdfb\ufe70-\ufe74\ufe76-\ufefc\uff21-\uff3a\uff41-\uff5a\uff66-\uffbe\uffc2-\uffc7\uffca-\uffcf\uffd2-\uffd7\uffda-\uffdc"; -/* prettier-ignore */ -let nonASCIIidentifierChars = "\u200c\u200d\xb7\u0300-\u036f\u0387\u0483-\u0487\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u0669\u0670\u06d6-\u06dc\u06df-\u06e4\u06e7\u06e8\u06ea-\u06ed\u06f0-\u06f9\u0711\u0730-\u074a\u07a6-\u07b0\u07c0-\u07c9\u07eb-\u07f3\u07fd\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0859-\u085b\u08d3-\u08e1\u08e3-\u0903\u093a-\u093c\u093e-\u094f\u0951-\u0957\u0962\u0963\u0966-\u096f\u0981-\u0983\u09bc\u09be-\u09c4\u09c7\u09c8\u09cb-\u09cd\u09d7\u09e2\u09e3\u09e6-\u09ef\u09fe\u0a01-\u0a03\u0a3c\u0a3e-\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a66-\u0a71\u0a75\u0a81-\u0a83\u0abc\u0abe-\u0ac5\u0ac7-\u0ac9\u0acb-\u0acd\u0ae2\u0ae3\u0ae6-\u0aef\u0afa-\u0aff\u0b01-\u0b03\u0b3c\u0b3e-\u0b44\u0b47\u0b48\u0b4b-\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b66-\u0b6f\u0b82\u0bbe-\u0bc2\u0bc6-\u0bc8\u0bca-\u0bcd\u0bd7\u0be6-\u0bef\u0c00-\u0c04\u0c3e-\u0c44\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0c66-\u0c6f\u0c81-\u0c83\u0cbc\u0cbe-\u0cc4\u0cc6-\u0cc8\u0cca-\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0ce6-\u0cef\u0d00-\u0d03\u0d3b\u0d3c\u0d3e-\u0d44\u0d46-\u0d48\u0d4a-\u0d4d\u0d57\u0d62\u0d63\u0d66-\u0d6f\u0d82\u0d83\u0dca\u0dcf-\u0dd4\u0dd6\u0dd8-\u0ddf\u0de6-\u0def\u0df2\u0df3\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0e50-\u0e59\u0eb1\u0eb4-\u0ebc\u0ec8-\u0ecd\u0ed0-\u0ed9\u0f18\u0f19\u0f20-\u0f29\u0f35\u0f37\u0f39\u0f3e\u0f3f\u0f71-\u0f84\u0f86\u0f87\u0f8d-\u0f97\u0f99-\u0fbc\u0fc6\u102b-\u103e\u1040-\u1049\u1056-\u1059\u105e-\u1060\u1062-\u1064\u1067-\u106d\u1071-\u1074\u1082-\u108d\u108f-\u109d\u135d-\u135f\u1369-\u1371\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b4-\u17d3\u17dd\u17e0-\u17e9\u180b-\u180d\u1810-\u1819\u18a9\u1920-\u192b\u1930-\u193b\u1946-\u194f\u19d0-\u19da\u1a17-\u1a1b\u1a55-\u1a5e\u1a60-\u1a7c\u1a7f-\u1a89\u1a90-\u1a99\u1ab0-\u1abd\u1b00-\u1b04\u1b34-\u1b44\u1b50-\u1b59\u1b6b-\u1b73\u1b80-\u1b82\u1ba1-\u1bad\u1bb0-\u1bb9\u1be6-\u1bf3\u1c24-\u1c37\u1c40-\u1c49\u1c50-\u1c59\u1cd0-\u1cd2\u1cd4-\u1ce8\u1ced\u1cf4\u1cf7-\u1cf9\u1dc0-\u1df9\u1dfb-\u1dff\u203f\u2040\u2054\u20d0-\u20dc\u20e1\u20e5-\u20f0\u2cef-\u2cf1\u2d7f\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua620-\ua629\ua66f\ua674-\ua67d\ua69e\ua69f\ua6f0\ua6f1\ua802\ua806\ua80b\ua823-\ua827\ua880\ua881\ua8b4-\ua8c5\ua8d0-\ua8d9\ua8e0-\ua8f1\ua8ff-\ua909\ua926-\ua92d\ua947-\ua953\ua980-\ua983\ua9b3-\ua9c0\ua9d0-\ua9d9\ua9e5\ua9f0-\ua9f9\uaa29-\uaa36\uaa43\uaa4c\uaa4d\uaa50-\uaa59\uaa7b-\uaa7d\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uaaeb-\uaaef\uaaf5\uaaf6\uabe3-\uabea\uabec\uabed\uabf0-\uabf9\ufb1e\ufe00-\ufe0f\ufe20-\ufe2f\ufe33\ufe34\ufe4d-\ufe4f\uff10-\uff19\uff3f"; - -const nonASCIIidentifierStart = new RegExp( - "[" + nonASCIIidentifierStartChars + "]", -); -const nonASCIIidentifier = new RegExp( - "[" + nonASCIIidentifierStartChars + nonASCIIidentifierChars + "]", -); - -nonASCIIidentifierStartChars = nonASCIIidentifierChars = null; - -// These are a run-length and offset-encoded representation of the -// >0xffff code points that are a valid part of identifiers. The -// offset starts at 0x10000, and each pair of numbers represents an -// offset to the next range, and then a size of the range. They were -// generated by `scripts/generate-identifier-regex.js`. -/* prettier-ignore */ -const astralIdentifierStartCodes = [0,11,2,25,2,18,2,1,2,14,3,13,35,122,70,52,268,28,4,48,48,31,14,29,6,37,11,29,3,35,5,7,2,4,43,157,19,35,5,35,5,39,9,51,157,310,10,21,11,7,153,5,3,0,2,43,2,1,4,0,3,22,11,22,10,30,66,18,2,1,11,21,11,25,71,55,7,1,65,0,16,3,2,2,2,28,43,28,4,28,36,7,2,27,28,53,11,21,11,18,14,17,111,72,56,50,14,50,14,35,477,28,11,0,9,21,155,22,13,52,76,44,33,24,27,35,30,0,12,34,4,0,13,47,15,3,22,0,2,0,36,17,2,24,85,6,2,0,2,3,2,14,2,9,8,46,39,7,3,1,3,21,2,6,2,1,2,4,4,0,19,0,13,4,159,52,19,3,21,0,33,47,21,1,2,0,185,46,42,3,37,47,21,0,60,42,14,0,72,26,230,43,117,63,32,0,161,7,3,38,17,0,2,0,29,0,11,39,8,0,22,0,12,45,20,0,35,56,264,8,2,36,18,0,50,29,113,6,2,1,2,37,22,0,26,5,2,1,2,31,15,0,328,18,270,921,103,110,18,195,2749,1070,4050,582,8634,568,8,30,114,29,19,47,17,3,32,20,6,18,689,63,129,74,6,0,67,12,65,1,2,0,29,6135,9,754,9486,286,50,2,18,3,9,395,2309,106,6,12,4,8,8,9,5991,84,2,70,2,1,3,0,3,1,3,3,2,11,2,0,2,6,2,64,2,3,3,7,2,6,2,27,2,3,2,4,2,0,4,6,2,339,3,24,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,7,2357,44,11,6,17,0,370,43,1301,196,60,67,8,0,1205,3,2,26,2,1,2,0,3,0,2,9,2,3,2,0,2,0,7,0,5,0,2,0,2,0,2,2,2,1,2,0,3,0,2,0,2,0,2,0,2,0,2,1,2,0,3,3,2,6,2,3,2,3,2,0,2,9,2,16,6,2,2,4,2,16,4421,42710,42,4148,12,221,3,5761,15,7472,3104,541]; -/* prettier-ignore */ -const astralIdentifierCodes = [509,0,227,0,150,4,294,9,1368,2,2,1,6,3,41,2,5,0,166,1,574,3,9,9,525,10,176,2,54,14,32,9,16,3,46,10,54,9,7,2,37,13,2,9,6,1,45,0,13,2,49,13,9,3,4,9,83,11,7,0,161,11,6,9,7,3,56,1,2,6,3,1,3,2,10,0,11,1,3,6,4,4,193,17,10,9,5,0,82,19,13,9,214,6,3,8,28,1,83,16,16,9,82,12,9,9,84,14,5,9,243,14,166,9,232,6,3,6,4,0,29,9,41,6,2,3,9,0,10,10,47,15,406,7,2,7,17,9,57,21,2,13,123,5,4,0,2,1,2,6,2,0,9,9,49,4,2,1,2,4,9,9,330,3,19306,9,135,4,60,6,26,9,1014,0,2,54,8,3,19723,1,5319,4,4,5,9,7,3,6,31,3,149,2,1418,49,513,54,5,49,9,0,15,0,23,4,2,14,1361,6,2,16,3,6,2,1,2,4,262,6,10,9,419,13,1495,6,110,6,6,9,792487,239]; - -// This has a complexity linear to the value of the code. The -// assumption is that looking up astral identifier characters is -// rare. -function isInAstralSet(code: number, set: $ReadOnlyArray): boolean { - let pos = 0x10000; - for (let i = 0, length = set.length; i < length; i += 2) { - pos += set[i]; - if (pos > code) return false; - - pos += set[i + 1]; - if (pos >= code) return true; - } - return false; -} - -// Test whether a given character code starts an identifier. - -export function isIdentifierStart(code: number): boolean { - if (code < charCodes.uppercaseA) return code === charCodes.dollarSign; - if (code <= charCodes.uppercaseZ) return true; - if (code < charCodes.lowercaseA) return code === charCodes.underscore; - if (code <= charCodes.lowercaseZ) return true; - if (code <= 0xffff) { - return ( - code >= 0xaa && nonASCIIidentifierStart.test(String.fromCharCode(code)) - ); - } - return isInAstralSet(code, astralIdentifierStartCodes); -} - // Test whether a current state character code and next character code is @ export function isIteratorStart(current: number, next: number): boolean { return current === charCodes.atSign && next === charCodes.atSign; } - -// Test whether a given character is part of an identifier. - -export function isIdentifierChar(code: number): boolean { - if (code < charCodes.digit0) return code === charCodes.dollarSign; - if (code < charCodes.colon) return true; - if (code < charCodes.uppercaseA) return false; - if (code <= charCodes.uppercaseZ) return true; - if (code < charCodes.lowercaseA) return code === charCodes.underscore; - if (code <= charCodes.lowercaseZ) return true; - if (code <= 0xffff) { - return code >= 0xaa && nonASCIIidentifier.test(String.fromCharCode(code)); - } - return ( - isInAstralSet(code, astralIdentifierStartCodes) || - isInAstralSet(code, astralIdentifierCodes) - ); -} diff --git a/packages/babel-parser/src/util/production-parameter.js b/packages/babel-parser/src/util/production-parameter.js new file mode 100644 index 000000000000..43644f6131ce --- /dev/null +++ b/packages/babel-parser/src/util/production-parameter.js @@ -0,0 +1,63 @@ +// @flow +export const PARAM = 0b000, // Initial Parameter flags + PARAM_YIELD = 0b001, // track [Yield] production parameter + PARAM_AWAIT = 0b010, // track [Await] production parameter + PARAM_RETURN = 0b100; // track [Return] production parameter + +// ProductionParameterHandler is a stack fashioned production parameter tracker +// https://tc39.es/ecma262/#sec-grammar-notation +// The tracked parameters are defined above. Note that the [In] parameter is +// tracked in `noIn` argument of `parseExpression`. +// +// Whenever [+Await]/[+Yield] appears in the right-hand sides of a production, +// we must enter a new tracking stack. For example when parsing +// +// AsyncFunctionDeclaration [Yield, Await]: +// async [no LineTerminator here] function BindingIdentifier[?Yield, ?Await] +// ( FormalParameters[~Yield, +Await] ) { AsyncFunctionBody } +// +// we must follow such process: +// +// 1. parse async keyword +// 2. parse function keyword +// 3. parse bindingIdentifier <= inherit current parameters: [?Await] +// 4. enter new stack with (PARAM_AWAIT) +// 5. parse formal parameters <= must have [Await] parameter [+Await] +// 6. parse function body +// 7. exit current stack + +export type ParamKind = typeof PARAM | typeof PARAM_AWAIT | typeof PARAM_YIELD; + +export default class ProductionParameterHandler { + stacks: Array = []; + enter(flags: ParamKind) { + this.stacks.push(flags); + } + + exit() { + this.stacks.pop(); + } + + currentFlags(): ParamKind { + return this.stacks[this.stacks.length - 1]; + } + + get hasAwait(): boolean { + return (this.currentFlags() & PARAM_AWAIT) > 0; + } + + get hasYield(): boolean { + return (this.currentFlags() & PARAM_YIELD) > 0; + } + + get hasReturn(): boolean { + return (this.currentFlags() & PARAM_RETURN) > 0; + } +} + +export function functionFlags( + isAsync: boolean, + isGenerator: boolean, +): ParamKind { + return (isAsync ? PARAM_AWAIT : 0) | (isGenerator ? PARAM_YIELD : 0); +} diff --git a/packages/babel-parser/src/util/scope.js b/packages/babel-parser/src/util/scope.js index e40cb53e3e33..5875cc3f194b 100644 --- a/packages/babel-parser/src/util/scope.js +++ b/packages/babel-parser/src/util/scope.js @@ -1,10 +1,8 @@ // @flow import { SCOPE_ARROW, - SCOPE_ASYNC, SCOPE_DIRECT_SUPER, SCOPE_FUNCTION, - SCOPE_GENERATOR, SCOPE_SIMPLE_CATCH, SCOPE_SUPER, SCOPE_PROGRAM, @@ -18,6 +16,7 @@ import { type BindingTypes, } from "./scopeflags"; import * as N from "../types"; +import { Errors } from "../parser/location"; // Start an AST node, attaching a start offset. export class Scope { @@ -34,7 +33,7 @@ export class Scope { } } -type raiseFunction = (number, string) => void; +type raiseFunction = (number, string, ...any) => void; // The functions in this module keep track of declared variables in the // current scope in order to detect duplicate variable names. @@ -43,6 +42,7 @@ export default class ScopeHandler { raise: raiseFunction; inModule: boolean; undefinedExports: Map = new Map(); + undefinedPrivateNames: Map = new Map(); constructor(raise: raiseFunction, inModule: boolean) { this.raise = raise; @@ -52,18 +52,15 @@ export default class ScopeHandler { get inFunction() { return (this.currentVarScope().flags & SCOPE_FUNCTION) > 0; } - get inGenerator() { - return (this.currentVarScope().flags & SCOPE_GENERATOR) > 0; - } - get inAsync() { - return (this.currentVarScope().flags & SCOPE_ASYNC) > 0; - } get allowSuper() { return (this.currentThisScope().flags & SCOPE_SUPER) > 0; } get allowDirectSuper() { return (this.currentThisScope().flags & SCOPE_DIRECT_SUPER) > 0; } + get inClass() { + return (this.currentThisScope().flags & SCOPE_CLASS) > 0; + } get inNonArrowFunction() { return (this.currentThisScope().flags & SCOPE_FUNCTION) > 0; } @@ -75,7 +72,7 @@ export default class ScopeHandler { return new Scope(flags); } // This method will be overwritten by subclasses - +createScope: (flags: ScopeFlags) => IScope; + /*:: +createScope: (flags: ScopeFlags) => IScope; */ enter(flags: ScopeFlags) { this.scopeStack.push(this.createScope(flags)); @@ -137,7 +134,7 @@ export default class ScopeHandler { pos: number, ) { if (this.isRedeclaredInScope(scope, name, bindingType)) { - this.raise(pos, `Identifier '${name}' has already been declared`); + this.raise(pos, Errors.VarRedeclaration, name); } } @@ -199,7 +196,7 @@ export default class ScopeHandler { } } - // Could be useful for `this`, `new.target`, `super()`, `super.property`, and `super[property]`. + // Could be useful for `arguments`, `this`, `new.target`, `super()`, `super.property`, and `super[property]`. // $FlowIgnore currentThisScope(): IScope { for (let i = this.scopeStack.length - 1; ; i--) { diff --git a/packages/babel-parser/src/util/scopeflags.js b/packages/babel-parser/src/util/scopeflags.js index 8c9697b3a416..65c8fd4a608f 100644 --- a/packages/babel-parser/src/util/scopeflags.js +++ b/packages/babel-parser/src/util/scopeflags.js @@ -2,39 +2,28 @@ // Each scope gets a bitset that may contain these flags // prettier-ignore -export const SCOPE_OTHER = 0b000000000, - SCOPE_PROGRAM = 0b000000001, - SCOPE_FUNCTION = 0b000000010, - SCOPE_ASYNC = 0b000000100, - SCOPE_GENERATOR = 0b000001000, - SCOPE_ARROW = 0b000010000, - SCOPE_SIMPLE_CATCH = 0b000100000, - SCOPE_SUPER = 0b001000000, - SCOPE_DIRECT_SUPER = 0b010000000, - SCOPE_CLASS = 0b100000000, - SCOPE_VAR = SCOPE_PROGRAM | SCOPE_FUNCTION; +export const SCOPE_OTHER = 0b00000000, + SCOPE_PROGRAM = 0b00000001, + SCOPE_FUNCTION = 0b00000010, + SCOPE_ARROW = 0b00000100, + SCOPE_SIMPLE_CATCH = 0b00001000, + SCOPE_SUPER = 0b00010000, + SCOPE_DIRECT_SUPER = 0b00100000, + SCOPE_CLASS = 0b01000000, + SCOPE_TS_MODULE = 0b10000000, + SCOPE_VAR = SCOPE_PROGRAM | SCOPE_FUNCTION | SCOPE_TS_MODULE; export type ScopeFlags = | typeof SCOPE_OTHER | typeof SCOPE_PROGRAM | typeof SCOPE_FUNCTION | typeof SCOPE_VAR - | typeof SCOPE_ASYNC - | typeof SCOPE_GENERATOR | typeof SCOPE_ARROW | typeof SCOPE_SIMPLE_CATCH | typeof SCOPE_SUPER | typeof SCOPE_DIRECT_SUPER | typeof SCOPE_CLASS; -export function functionFlags(isAsync: boolean, isGenerator: boolean) { - return ( - SCOPE_FUNCTION | - (isAsync ? SCOPE_ASYNC : 0) | - (isGenerator ? SCOPE_GENERATOR : 0) - ); -} - // These flags are meant to be _only_ used inside the Scope class (or subclasses). // prettier-ignore export const BIND_KIND_VALUE = 0b00000_0000_01, @@ -62,14 +51,14 @@ export const BIND_CLASS = BIND_KIND_VALUE | BIND_KIND_TYPE | BIND_SCOPE_ BIND_TS_INTERFACE = 0 | BIND_KIND_TYPE | 0 | BIND_FLAGS_CLASS , BIND_TS_TYPE = 0 | BIND_KIND_TYPE | 0 | 0 , BIND_TS_ENUM = BIND_KIND_VALUE | BIND_KIND_TYPE | BIND_SCOPE_LEXICAL | BIND_FLAGS_TS_ENUM, - BIND_TS_FN_TYPE = 0 | 0 | 0 | BIND_FLAGS_TS_EXPORT_ONLY, + BIND_TS_AMBIENT = 0 | 0 | 0 | BIND_FLAGS_TS_EXPORT_ONLY, // These bindings don't introduce anything in the scope. They are used for assignments and // function expressions IDs. BIND_NONE = 0 | 0 | 0 | BIND_FLAGS_NONE , BIND_OUTSIDE = BIND_KIND_VALUE | 0 | 0 | BIND_FLAGS_NONE , BIND_TS_CONST_ENUM = BIND_TS_ENUM | BIND_FLAGS_TS_CONST_ENUM, - BIND_TS_NAMESPACE = BIND_TS_FN_TYPE; + BIND_TS_NAMESPACE = 0 | 0 | 0 | BIND_FLAGS_TS_EXPORT_ONLY; export type BindingTypes = | typeof BIND_NONE @@ -81,5 +70,25 @@ export type BindingTypes = | typeof BIND_TS_INTERFACE | typeof BIND_TS_TYPE | typeof BIND_TS_ENUM - | typeof BIND_TS_FN_TYPE + | typeof BIND_TS_AMBIENT | typeof BIND_TS_NAMESPACE; + +// prettier-ignore +export const CLASS_ELEMENT_FLAG_STATIC = 0b1_00, + CLASS_ELEMENT_KIND_GETTER = 0b0_10, + CLASS_ELEMENT_KIND_SETTER = 0b0_01, + CLASS_ELEMENT_KIND_ACCESSOR = CLASS_ELEMENT_KIND_GETTER | CLASS_ELEMENT_KIND_SETTER; + +// prettier-ignore +export const CLASS_ELEMENT_STATIC_GETTER = CLASS_ELEMENT_KIND_GETTER | CLASS_ELEMENT_FLAG_STATIC, + CLASS_ELEMENT_STATIC_SETTER = CLASS_ELEMENT_KIND_SETTER | CLASS_ELEMENT_FLAG_STATIC, + CLASS_ELEMENT_INSTANCE_GETTER = CLASS_ELEMENT_KIND_GETTER, + CLASS_ELEMENT_INSTANCE_SETTER = CLASS_ELEMENT_KIND_SETTER, + CLASS_ELEMENT_OTHER = 0; + +export type ClassElementTypes = + | typeof CLASS_ELEMENT_STATIC_GETTER + | typeof CLASS_ELEMENT_STATIC_SETTER + | typeof CLASS_ELEMENT_INSTANCE_GETTER + | typeof CLASS_ELEMENT_INSTANCE_SETTER + | typeof CLASS_ELEMENT_OTHER; diff --git a/packages/babel-parser/test/expressions/is-expression-babel-parser/fail/7/options.json b/packages/babel-parser/test/expressions/is-expression-babel-parser/fail/7/options.json deleted file mode 100644 index 12b18792fcc4..000000000000 --- a/packages/babel-parser/test/expressions/is-expression-babel-parser/fail/7/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Illegal 'use strict' directive in function with non-simple parameter list (1:0)" -} diff --git a/packages/babel-parser/test/expressions/is-expression-babel-parser/fail/7/output.json b/packages/babel-parser/test/expressions/is-expression-babel-parser/fail/7/output.json new file mode 100644 index 000000000000..bed17cab3909 --- /dev/null +++ b/packages/babel-parser/test/expressions/is-expression-babel-parser/fail/7/output.json @@ -0,0 +1,128 @@ +{ + "type": "FunctionExpression", + "start": 0, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 40 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "AssignmentPattern", + "start": 10, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "left": { + "type": "Identifier", + "start": 10, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + }, + "identifierName": "a" + }, + "name": "a" + }, + "right": { + "type": "StringLiteral", + "start": 14, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "extra": { + "rawValue": "default", + "raw": "\"default\"" + }, + "value": "default" + } + } + ], + "body": { + "type": "BlockStatement", + "start": 25, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 40 + } + }, + "body": [], + "directives": [ + { + "type": "Directive", + "start": 26, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 26, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 38 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + }, + "errors": [ + "SyntaxError: Illegal 'use strict' directive in function with non-simple parameter list (1:0)" + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/expressions/is-expression-babel-parser/fail/8/options.json b/packages/babel-parser/test/expressions/is-expression-babel-parser/fail/8/options.json index 5f24fc4399ed..4f434cf0aa86 100644 --- a/packages/babel-parser/test/expressions/is-expression-babel-parser/fail/8/options.json +++ b/packages/babel-parser/test/expressions/is-expression-babel-parser/fail/8/options.json @@ -1,4 +1,3 @@ { - "strictMode": true, - "throws": "Unexpected reserved word 'public' (2:0)" -} + "strictMode": true +} \ No newline at end of file diff --git a/packages/babel-parser/test/expressions/is-expression-babel-parser/fail/8/output.json b/packages/babel-parser/test/expressions/is-expression-babel-parser/fail/8/output.json new file mode 100644 index 000000000000..df12702dd8b4 --- /dev/null +++ b/packages/babel-parser/test/expressions/is-expression-babel-parser/fail/8/output.json @@ -0,0 +1,20 @@ +{ + "type": "Identifier", + "start": 1, + "end": 7, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 6 + }, + "identifierName": "public" + }, + "name": "public", + "errors": [ + "SyntaxError: Unexpected reserved word 'public' (2:0)" + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/comments/basic/array-expression-trailing-comma/input.js b/packages/babel-parser/test/fixtures/comments/basic/array-expression-trailing-comma/input.js new file mode 100644 index 000000000000..bc0802b8addd --- /dev/null +++ b/packages/babel-parser/test/fixtures/comments/basic/array-expression-trailing-comma/input.js @@ -0,0 +1,18 @@ +const nonTrailing = [ + "One", // One + // Two + "Two" // Three + // Four +] + +const trailingAfterComma = [ + "One", // One + // Two + "Two", // Three + // Four +] + +const trailingAfterArray = [ + "One", // One + // Two +] // Three diff --git a/packages/babel-parser/test/fixtures/comments/basic/array-expression-trailing-comma/output.json b/packages/babel-parser/test/fixtures/comments/basic/array-expression-trailing-comma/output.json new file mode 100644 index 000000000000..fc95a0db2814 --- /dev/null +++ b/packages/babel-parser/test/fixtures/comments/basic/array-expression-trailing-comma/output.json @@ -0,0 +1,254 @@ +{ + "type": "File", + "start":0,"end":229,"loc":{"start":{"line":1,"column":0},"end":{"line":18,"column":10}}, + "program": { + "type": "Program", + "start":0,"end":229,"loc":{"start":{"line":1,"column":0},"end":{"line":18,"column":10}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start":0,"end":76,"loc":{"start":{"line":1,"column":0},"end":{"line":6,"column":1}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":6,"end":76,"loc":{"start":{"line":1,"column":6},"end":{"line":6,"column":1}}, + "id": { + "type": "Identifier", + "start":6,"end":17,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":17},"identifierName":"nonTrailing"}, + "name": "nonTrailing" + }, + "init": { + "type": "ArrayExpression", + "start":20,"end":76,"loc":{"start":{"line":1,"column":20},"end":{"line":6,"column":1}}, + "elements": [ + { + "type": "StringLiteral", + "start":24,"end":29,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":7}}, + "extra": { + "rawValue": "One", + "raw": "\"One\"" + }, + "value": "One" + }, + { + "type": "StringLiteral", + "start":50,"end":55,"loc":{"start":{"line":4,"column":2},"end":{"line":4,"column":7}}, + "extra": { + "rawValue": "Two", + "raw": "\"Two\"" + }, + "value": "Two", + "leadingComments": [ + { + "type": "CommentLine", + "value": " One", + "start":31,"end":37,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":15}} + }, + { + "type": "CommentLine", + "value": " Two", + "start":41,"end":47,"loc":{"start":{"line":3,"column":3},"end":{"line":3,"column":9}} + } + ], + "trailingComments": [ + { + "type": "CommentLine", + "value": " Three", + "start":56,"end":64,"loc":{"start":{"line":4,"column":8},"end":{"line":4,"column":16}} + }, + { + "type": "CommentLine", + "value": " Four", + "start":67,"end":74,"loc":{"start":{"line":5,"column":2},"end":{"line":5,"column":9}} + } + ] + } + ] + } + } + ], + "kind": "const" + }, + { + "type": "VariableDeclaration", + "start":78,"end":162,"loc":{"start":{"line":8,"column":0},"end":{"line":13,"column":1}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":84,"end":162,"loc":{"start":{"line":8,"column":6},"end":{"line":13,"column":1}}, + "id": { + "type": "Identifier", + "start":84,"end":102,"loc":{"start":{"line":8,"column":6},"end":{"line":8,"column":24},"identifierName":"trailingAfterComma"}, + "name": "trailingAfterComma" + }, + "init": { + "type": "ArrayExpression", + "start":105,"end":162,"loc":{"start":{"line":8,"column":27},"end":{"line":13,"column":1}}, + "extra": { + "trailingComma": 140 + }, + "elements": [ + { + "type": "StringLiteral", + "start":109,"end":114,"loc":{"start":{"line":9,"column":2},"end":{"line":9,"column":7}}, + "extra": { + "rawValue": "One", + "raw": "\"One\"" + }, + "value": "One" + }, + { + "type": "StringLiteral", + "start":135,"end":140,"loc":{"start":{"line":11,"column":2},"end":{"line":11,"column":7}}, + "extra": { + "rawValue": "Two", + "raw": "\"Two\"" + }, + "value": "Two", + "leadingComments": [ + { + "type": "CommentLine", + "value": " One", + "start":116,"end":122,"loc":{"start":{"line":9,"column":9},"end":{"line":9,"column":15}} + }, + { + "type": "CommentLine", + "value": " Two", + "start":126,"end":132,"loc":{"start":{"line":10,"column":3},"end":{"line":10,"column":9}} + } + ], + "trailingComments": [ + { + "type": "CommentLine", + "value": " Three", + "start":142,"end":150,"loc":{"start":{"line":11,"column":9},"end":{"line":11,"column":17}} + }, + { + "type": "CommentLine", + "value": " Four", + "start":153,"end":160,"loc":{"start":{"line":12,"column":2},"end":{"line":12,"column":9}} + } + ] + } + ] + } + } + ], + "kind": "const" + }, + { + "type": "VariableDeclaration", + "start":164,"end":220,"loc":{"start":{"line":15,"column":0},"end":{"line":18,"column":1}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":170,"end":220,"loc":{"start":{"line":15,"column":6},"end":{"line":18,"column":1}}, + "id": { + "type": "Identifier", + "start":170,"end":188,"loc":{"start":{"line":15,"column":6},"end":{"line":15,"column":24},"identifierName":"trailingAfterArray"}, + "name": "trailingAfterArray" + }, + "init": { + "type": "ArrayExpression", + "start":191,"end":220,"loc":{"start":{"line":15,"column":27},"end":{"line":18,"column":1}}, + "extra": { + "trailingComma": 200 + }, + "elements": [ + { + "type": "StringLiteral", + "start":195,"end":200,"loc":{"start":{"line":16,"column":2},"end":{"line":16,"column":7}}, + "extra": { + "rawValue": "One", + "raw": "\"One\"" + }, + "value": "One", + "trailingComments": [ + { + "type": "CommentLine", + "value": " One", + "start":202,"end":208,"loc":{"start":{"line":16,"column":9},"end":{"line":16,"column":15}} + }, + { + "type": "CommentLine", + "value": " Two", + "start":212,"end":218,"loc":{"start":{"line":17,"column":3},"end":{"line":17,"column":9}} + } + ] + } + ] + } + } + ], + "kind": "const", + "trailingComments": [ + { + "type": "CommentLine", + "value": " Three", + "start":221,"end":229,"loc":{"start":{"line":18,"column":2},"end":{"line":18,"column":10}} + } + ] + } + ], + "directives": [] + }, + "comments": [ + { + "type": "CommentLine", + "value": " One", + "start":31,"end":37,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":15}} + }, + { + "type": "CommentLine", + "value": " Two", + "start":41,"end":47,"loc":{"start":{"line":3,"column":3},"end":{"line":3,"column":9}} + }, + { + "type": "CommentLine", + "value": " Three", + "start":56,"end":64,"loc":{"start":{"line":4,"column":8},"end":{"line":4,"column":16}} + }, + { + "type": "CommentLine", + "value": " Four", + "start":67,"end":74,"loc":{"start":{"line":5,"column":2},"end":{"line":5,"column":9}} + }, + { + "type": "CommentLine", + "value": " One", + "start":116,"end":122,"loc":{"start":{"line":9,"column":9},"end":{"line":9,"column":15}} + }, + { + "type": "CommentLine", + "value": " Two", + "start":126,"end":132,"loc":{"start":{"line":10,"column":3},"end":{"line":10,"column":9}} + }, + { + "type": "CommentLine", + "value": " Three", + "start":142,"end":150,"loc":{"start":{"line":11,"column":9},"end":{"line":11,"column":17}} + }, + { + "type": "CommentLine", + "value": " Four", + "start":153,"end":160,"loc":{"start":{"line":12,"column":2},"end":{"line":12,"column":9}} + }, + { + "type": "CommentLine", + "value": " One", + "start":202,"end":208,"loc":{"start":{"line":16,"column":9},"end":{"line":16,"column":15}} + }, + { + "type": "CommentLine", + "value": " Two", + "start":212,"end":218,"loc":{"start":{"line":17,"column":3},"end":{"line":17,"column":9}} + }, + { + "type": "CommentLine", + "value": " Three", + "start":221,"end":229,"loc":{"start":{"line":18,"column":2},"end":{"line":18,"column":10}} + } + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/comments/basic/array-pattern-trailing-comma/input.js b/packages/babel-parser/test/fixtures/comments/basic/array-pattern-trailing-comma/input.js new file mode 100644 index 000000000000..3d234bad027c --- /dev/null +++ b/packages/babel-parser/test/fixtures/comments/basic/array-pattern-trailing-comma/input.js @@ -0,0 +1,6 @@ +const [ + /* One */ + x + /* Two */, + /* Three */ +] /* Four */ = []; diff --git a/packages/babel-parser/test/fixtures/comments/basic/array-pattern-trailing-comma/output.json b/packages/babel-parser/test/fixtures/comments/basic/array-pattern-trailing-comma/output.json new file mode 100644 index 000000000000..9059e207d2f6 --- /dev/null +++ b/packages/babel-parser/test/fixtures/comments/basic/array-pattern-trailing-comma/output.json @@ -0,0 +1,88 @@ +{ + "type": "File", + "start":0,"end":69,"loc":{"start":{"line":1,"column":0},"end":{"line":6,"column":18}}, + "program": { + "type": "Program", + "start":0,"end":69,"loc":{"start":{"line":1,"column":0},"end":{"line":6,"column":18}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start":0,"end":69,"loc":{"start":{"line":1,"column":0},"end":{"line":6,"column":18}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":6,"end":68,"loc":{"start":{"line":1,"column":6},"end":{"line":6,"column":17}}, + "id": { + "type": "ArrayPattern", + "start":6,"end":52,"loc":{"start":{"line":1,"column":6},"end":{"line":6,"column":1}}, + "elements": [ + { + "type": "Identifier", + "start":22,"end":23,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":3},"identifierName":"x"}, + "name": "x", + "leadingComments": [ + { + "type": "CommentBlock", + "value": " One ", + "start":10,"end":19,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":11}} + } + ], + "trailingComments": [ + { + "type": "CommentBlock", + "value": " Two ", + "start":26,"end":35,"loc":{"start":{"line":4,"column":2},"end":{"line":4,"column":11}} + }, + { + "type": "CommentBlock", + "value": " Three ", + "start":39,"end":50,"loc":{"start":{"line":5,"column":2},"end":{"line":5,"column":13}} + } + ] + } + ], + "trailingComments": [ + { + "type": "CommentBlock", + "value": " Four ", + "start":53,"end":63,"loc":{"start":{"line":6,"column":2},"end":{"line":6,"column":12}} + } + ] + }, + "init": { + "type": "ArrayExpression", + "start":66,"end":68,"loc":{"start":{"line":6,"column":15},"end":{"line":6,"column":17}}, + "elements": [] + } + } + ], + "kind": "const" + } + ], + "directives": [] + }, + "comments": [ + { + "type": "CommentBlock", + "value": " One ", + "start":10,"end":19,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":11}} + }, + { + "type": "CommentBlock", + "value": " Two ", + "start":26,"end":35,"loc":{"start":{"line":4,"column":2},"end":{"line":4,"column":11}} + }, + { + "type": "CommentBlock", + "value": " Three ", + "start":39,"end":50,"loc":{"start":{"line":5,"column":2},"end":{"line":5,"column":13}} + }, + { + "type": "CommentBlock", + "value": " Four ", + "start":53,"end":63,"loc":{"start":{"line":6,"column":2},"end":{"line":6,"column":12}} + } + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/comments/basic/block-trailing-comment/output.json b/packages/babel-parser/test/fixtures/comments/basic/block-trailing-comment/output.json index 552cdc20f256..26b2c0163d14 100644 --- a/packages/babel-parser/test/fixtures/comments/basic/block-trailing-comment/output.json +++ b/packages/babel-parser/test/fixtures/comments/basic/block-trailing-comment/output.json @@ -1,92 +1,25 @@ { "type": "File", - "start": 0, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "BlockStatement", - "start": 0, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, "body": [ { "type": "ExpressionStatement", - "start": 6, - "end": 10, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 8 - } - }, + "start":6,"end":10,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":8}}, "expression": { "type": "CallExpression", - "start": 6, - "end": 9, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 7 - } - }, + "start":6,"end":9,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":7}}, "callee": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 5 - }, - "identifierName": "a" - }, + "start":6,"end":7,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":5},"identifierName":"a"}, "name": "a" }, "arguments": [] @@ -95,18 +28,7 @@ { "type": "CommentLine", "value": "comment", - "start": 15, - "end": 24, - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 13 - } - } + "start":15,"end":24,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":13}} } ] } @@ -120,18 +42,7 @@ { "type": "CommentLine", "value": "comment", - "start": 15, - "end": 24, - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 13 - } - } + "start":15,"end":24,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":13}} } ] } \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/comments/basic/call-expression-function-argument/output.json b/packages/babel-parser/test/fixtures/comments/basic/call-expression-function-argument/output.json index a04f1d2886a1..48d502ae192e 100644 --- a/packages/babel-parser/test/fixtures/comments/basic/call-expression-function-argument/output.json +++ b/packages/babel-parser/test/fixtures/comments/basic/call-expression-function-argument/output.json @@ -1,173 +1,50 @@ { "type": "File", - "start": 0, - "end": 51, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 6, - "column": 2 - } - }, + "start":0,"end":51,"loc":{"start":{"line":1,"column":0},"end":{"line":6,"column":2}}, "program": { "type": "Program", - "start": 0, - "end": 51, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 6, - "column": 2 - } - }, + "start":0,"end":51,"loc":{"start":{"line":1,"column":0},"end":{"line":6,"column":2}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 51, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 6, - "column": 2 - } - }, + "start":0,"end":51,"loc":{"start":{"line":1,"column":0},"end":{"line":6,"column":2}}, "expression": { "type": "CallExpression", - "start": 0, - "end": 50, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 6, - "column": 1 - } - }, + "start":0,"end":50,"loc":{"start":{"line":1,"column":0},"end":{"line":6,"column":1}}, "callee": { "type": "Identifier", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - }, - "identifierName": "test" - }, + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4},"identifierName":"test"}, "name": "test" }, "arguments": [ { "type": "FunctionExpression", - "start": 5, - "end": 41, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":5,"end":41,"loc":{"start":{"line":1,"column":5},"end":{"line":4,"column":1}}, "id": null, "generator": false, "async": false, "params": [], "body": { "type": "BlockStatement", - "start": 16, - "end": 41, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":16,"end":41,"loc":{"start":{"line":1,"column":16},"end":{"line":4,"column":1}}, "body": [ { "type": "VariableDeclaration", - "start": 20, - "end": 30, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 12 - } - }, + "start":20,"end":30,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":12}}, "declarations": [ { "type": "VariableDeclarator", - "start": 24, - "end": 29, - "loc": { - "start": { - "line": 2, - "column": 6 - }, - "end": { - "line": 2, - "column": 11 - } - }, + "start":24,"end":29,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":11}}, "id": { "type": "Identifier", - "start": 24, - "end": 25, - "loc": { - "start": { - "line": 2, - "column": 6 - }, - "end": { - "line": 2, - "column": 7 - }, - "identifierName": "a" - }, + "start":24,"end":25,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":7},"identifierName":"a"}, "name": "a" }, "init": { "type": "NumericLiteral", - "start": 28, - "end": 29, - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 11 - } - }, + "start":28,"end":29,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":11}}, "extra": { "rawValue": 1, "raw": "1" @@ -181,18 +58,7 @@ { "type": "CommentLine", "value": " one", - "start": 33, - "end": 39, - "loc": { - "start": { - "line": 3, - "column": 2 - }, - "end": { - "line": 3, - "column": 8 - } - } + "start":33,"end":39,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":8}} } ] } @@ -203,18 +69,7 @@ { "type": "CommentLine", "value": " two", - "start": 42, - "end": 48, - "loc": { - "start": { - "line": 5, - "column": 0 - }, - "end": { - "line": 5, - "column": 6 - } - } + "start":42,"end":48,"loc":{"start":{"line":5,"column":0},"end":{"line":5,"column":6}} } ] } @@ -228,34 +83,12 @@ { "type": "CommentLine", "value": " one", - "start": 33, - "end": 39, - "loc": { - "start": { - "line": 3, - "column": 2 - }, - "end": { - "line": 3, - "column": 8 - } - } + "start":33,"end":39,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":8}} }, { "type": "CommentLine", "value": " two", - "start": 42, - "end": 48, - "loc": { - "start": { - "line": 5, - "column": 0 - }, - "end": { - "line": 5, - "column": 6 - } - } + "start":42,"end":48,"loc":{"start":{"line":5,"column":0},"end":{"line":5,"column":6}} } ] } \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/comments/basic/comment-within-condition/output.json b/packages/babel-parser/test/fixtures/comments/basic/comment-within-condition/output.json index 4c435cd1a595..77c33f844e05 100644 --- a/packages/babel-parser/test/fixtures/comments/basic/comment-within-condition/output.json +++ b/packages/babel-parser/test/fixtures/comments/basic/comment-within-condition/output.json @@ -1,97 +1,30 @@ { "type": "File", - "start": 0, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 20 - } - }, + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":20}}, "program": { "type": "Program", - "start": 0, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 20 - } - }, + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":20}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "IfStatement", - "start": 10, - "end": 30, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 20 - } - }, + "start":10,"end":30,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":20}}, "test": { "type": "Identifier", - "start": 25, - "end": 26, - "loc": { - "start": { - "line": 2, - "column": 15 - }, - "end": { - "line": 2, - "column": 16 - }, - "identifierName": "a" - }, + "start":25,"end":26,"loc":{"start":{"line":2,"column":15},"end":{"line":2,"column":16},"identifierName":"a"}, "name": "a", "leadingComments": [ { "type": "CommentBlock", "value": " bar ", - "start": 14, - "end": 23, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 13 - } - } + "start":14,"end":23,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":13}} } ] }, "consequent": { "type": "BlockStatement", - "start": 28, - "end": 30, - "loc": { - "start": { - "line": 2, - "column": 18 - }, - "end": { - "line": 2, - "column": 20 - } - }, + "start":28,"end":30,"loc":{"start":{"line":2,"column":18},"end":{"line":2,"column":20}}, "body": [], "directives": [] }, @@ -100,18 +33,7 @@ { "type": "CommentBlock", "value": " foo ", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - } + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}} } ] } @@ -122,34 +44,12 @@ { "type": "CommentBlock", "value": " foo ", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - } + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}} }, { "type": "CommentBlock", "value": " bar ", - "start": 14, - "end": 23, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 13 - } - } + "start":14,"end":23,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":13}} } ] } \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/comments/basic/create-parenthesized-expressions/output.json b/packages/babel-parser/test/fixtures/comments/basic/create-parenthesized-expressions/output.json index 761463790803..d8c108f4bfdb 100644 --- a/packages/babel-parser/test/fixtures/comments/basic/create-parenthesized-expressions/output.json +++ b/packages/babel-parser/test/fixtures/comments/basic/create-parenthesized-expressions/output.json @@ -1,76 +1,21 @@ { "type": "File", - "start": 0, - "end": 65, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 12, - "column": 15 - } - }, + "start":0,"end":65,"loc":{"start":{"line":1,"column":0},"end":{"line":12,"column":15}}, "program": { "type": "Program", - "start": 0, - "end": 65, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 12, - "column": 15 - } - }, + "start":0,"end":65,"loc":{"start":{"line":1,"column":0},"end":{"line":12,"column":15}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 7, - "end": 11, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 4 - } - }, + "start":7,"end":11,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":4}}, "expression": { "type": "ParenthesizedExpression", - "start": 7, - "end": 10, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 3 - } - }, + "start":7,"end":10,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":3}}, "expression": { "type": "NumericLiteral", - "start": 8, - "end": 9, - "loc": { - "start": { - "line": 2, - "column": 1 - }, - "end": { - "line": 2, - "column": 2 - } - }, + "start":8,"end":9,"loc":{"start":{"line":2,"column":1},"end":{"line":2,"column":2}}, "extra": { "rawValue": 1, "raw": "1" @@ -82,81 +27,26 @@ { "type": "CommentLine", "value": " One", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - } + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}} } ], "trailingComments": [ { "type": "CommentBlock", "value": " Two ", - "start": 13, - "end": 22, - "loc": { - "start": { - "line": 4, - "column": 0 - }, - "end": { - "line": 4, - "column": 9 - } - } + "start":13,"end":22,"loc":{"start":{"line":4,"column":0},"end":{"line":4,"column":9}} } ] }, { "type": "ExpressionStatement", - "start": 23, - "end": 27, - "loc": { - "start": { - "line": 5, - "column": 0 - }, - "end": { - "line": 5, - "column": 4 - } - }, + "start":23,"end":27,"loc":{"start":{"line":5,"column":0},"end":{"line":5,"column":4}}, "expression": { "type": "ParenthesizedExpression", - "start": 23, - "end": 26, - "loc": { - "start": { - "line": 5, - "column": 0 - }, - "end": { - "line": 5, - "column": 3 - } - }, + "start":23,"end":26,"loc":{"start":{"line":5,"column":0},"end":{"line":5,"column":3}}, "expression": { "type": "NumericLiteral", - "start": 24, - "end": 25, - "loc": { - "start": { - "line": 5, - "column": 1 - }, - "end": { - "line": 5, - "column": 2 - } - }, + "start":24,"end":25,"loc":{"start":{"line":5,"column":1},"end":{"line":5,"column":2}}, "extra": { "rawValue": 2, "raw": "2" @@ -168,63 +58,19 @@ { "type": "CommentBlock", "value": " Two ", - "start": 13, - "end": 22, - "loc": { - "start": { - "line": 4, - "column": 0 - }, - "end": { - "line": 4, - "column": 9 - } - } + "start":13,"end":22,"loc":{"start":{"line":4,"column":0},"end":{"line":4,"column":9}} } ] }, { "type": "ExpressionStatement", - "start": 29, - "end": 48, - "loc": { - "start": { - "line": 7, - "column": 0 - }, - "end": { - "line": 10, - "column": 2 - } - }, + "start":29,"end":48,"loc":{"start":{"line":7,"column":0},"end":{"line":10,"column":2}}, "expression": { "type": "ParenthesizedExpression", - "start": 29, - "end": 47, - "loc": { - "start": { - "line": 7, - "column": 0 - }, - "end": { - "line": 10, - "column": 1 - } - }, + "start":29,"end":47,"loc":{"start":{"line":7,"column":0},"end":{"line":10,"column":1}}, "expression": { "type": "NumericLiteral", - "start": 44, - "end": 45, - "loc": { - "start": { - "line": 9, - "column": 2 - }, - "end": { - "line": 9, - "column": 3 - } - }, + "start":44,"end":45,"loc":{"start":{"line":9,"column":2},"end":{"line":9,"column":3}}, "extra": { "rawValue": 3, "raw": "3" @@ -234,18 +80,7 @@ { "type": "CommentLine", "value": " Three", - "start": 33, - "end": 41, - "loc": { - "start": { - "line": 8, - "column": 2 - }, - "end": { - "line": 8, - "column": 10 - } - } + "start":33,"end":41,"loc":{"start":{"line":8,"column":2},"end":{"line":8,"column":10}} } ] } @@ -253,46 +88,13 @@ }, { "type": "ExpressionStatement", - "start": 50, - "end": 65, - "loc": { - "start": { - "line": 12, - "column": 0 - }, - "end": { - "line": 12, - "column": 15 - } - }, + "start":50,"end":65,"loc":{"start":{"line":12,"column":0},"end":{"line":12,"column":15}}, "expression": { "type": "ParenthesizedExpression", - "start": 50, - "end": 64, - "loc": { - "start": { - "line": 12, - "column": 0 - }, - "end": { - "line": 12, - "column": 14 - } - }, + "start":50,"end":64,"loc":{"start":{"line":12,"column":0},"end":{"line":12,"column":14}}, "expression": { "type": "NumericLiteral", - "start": 62, - "end": 63, - "loc": { - "start": { - "line": 12, - "column": 12 - }, - "end": { - "line": 12, - "column": 13 - } - }, + "start":62,"end":63,"loc":{"start":{"line":12,"column":12},"end":{"line":12,"column":13}}, "extra": { "rawValue": 4, "raw": "4" @@ -302,18 +104,7 @@ { "type": "CommentBlock", "value": " Four ", - "start": 51, - "end": 61, - "loc": { - "start": { - "line": 12, - "column": 1 - }, - "end": { - "line": 12, - "column": 11 - } - } + "start":51,"end":61,"loc":{"start":{"line":12,"column":1},"end":{"line":12,"column":11}} } ] } @@ -326,66 +117,22 @@ { "type": "CommentLine", "value": " One", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - } + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}} }, { "type": "CommentBlock", "value": " Two ", - "start": 13, - "end": 22, - "loc": { - "start": { - "line": 4, - "column": 0 - }, - "end": { - "line": 4, - "column": 9 - } - } + "start":13,"end":22,"loc":{"start":{"line":4,"column":0},"end":{"line":4,"column":9}} }, { "type": "CommentLine", "value": " Three", - "start": 33, - "end": 41, - "loc": { - "start": { - "line": 8, - "column": 2 - }, - "end": { - "line": 8, - "column": 10 - } - } + "start":33,"end":41,"loc":{"start":{"line":8,"column":2},"end":{"line":8,"column":10}} }, { "type": "CommentBlock", "value": " Four ", - "start": 51, - "end": 61, - "loc": { - "start": { - "line": 12, - "column": 1 - }, - "end": { - "line": 12, - "column": 11 - } - } + "start":51,"end":61,"loc":{"start":{"line":12,"column":1},"end":{"line":12,"column":11}} } ] } \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/comments/basic/export-default-anonymous-class/output.json b/packages/babel-parser/test/fixtures/comments/basic/export-default-anonymous-class/output.json index d70b2aedbf3c..4c1fc96c2f9b 100644 --- a/packages/babel-parser/test/fixtures/comments/basic/export-default-anonymous-class/output.json +++ b/packages/babel-parser/test/fixtures/comments/basic/export-default-anonymous-class/output.json @@ -1,109 +1,31 @@ { "type": "File", - "start": 0, - "end": 121, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 10, - "column": 1 - } - }, + "start":0,"end":121,"loc":{"start":{"line":1,"column":0},"end":{"line":10,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 121, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 10, - "column": 1 - } - }, + "start":0,"end":121,"loc":{"start":{"line":1,"column":0},"end":{"line":10,"column":1}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExportDefaultDeclaration", - "start": 36, - "end": 121, - "loc": { - "start": { - "line": 4, - "column": 0 - }, - "end": { - "line": 10, - "column": 1 - } - }, + "start":36,"end":121,"loc":{"start":{"line":4,"column":0},"end":{"line":10,"column":1}}, "declaration": { "type": "ClassDeclaration", - "start": 51, - "end": 121, - "loc": { - "start": { - "line": 4, - "column": 15 - }, - "end": { - "line": 10, - "column": 1 - } - }, + "start":51,"end":121,"loc":{"start":{"line":4,"column":15},"end":{"line":10,"column":1}}, "id": null, "superClass": null, "body": { "type": "ClassBody", - "start": 57, - "end": 121, - "loc": { - "start": { - "line": 4, - "column": 21 - }, - "end": { - "line": 10, - "column": 1 - } - }, + "start":57,"end":121,"loc":{"start":{"line":4,"column":21},"end":{"line":10,"column":1}}, "body": [ { "type": "ClassMethod", - "start": 103, - "end": 119, - "loc": { - "start": { - "line": 8, - "column": 4 - }, - "end": { - "line": 9, - "column": 5 - } - }, + "start":103,"end":119,"loc":{"start":{"line":8,"column":4},"end":{"line":9,"column":5}}, "static": false, "key": { "type": "Identifier", - "start": 103, - "end": 110, - "loc": { - "start": { - "line": 8, - "column": 4 - }, - "end": { - "line": 8, - "column": 11 - }, - "identifierName": "method1" - }, + "start":103,"end":110,"loc":{"start":{"line":8,"column":4},"end":{"line":8,"column":11},"identifierName":"method1"}, "name": "method1" }, "computed": false, @@ -114,18 +36,7 @@ "params": [], "body": { "type": "BlockStatement", - "start": 112, - "end": 119, - "loc": { - "start": { - "line": 8, - "column": 13 - }, - "end": { - "line": 9, - "column": 5 - } - }, + "start":112,"end":119,"loc":{"start":{"line":8,"column":13},"end":{"line":9,"column":5}}, "body": [], "directives": [] }, @@ -133,18 +44,7 @@ { "type": "CommentBlock", "value": "*\n * this is method1.\n ", - "start": 63, - "end": 98, - "loc": { - "start": { - "line": 5, - "column": 4 - }, - "end": { - "line": 7, - "column": 7 - } - } + "start":63,"end":98,"loc":{"start":{"line":5,"column":4},"end":{"line":7,"column":7}} } ] } @@ -155,18 +55,7 @@ { "type": "CommentBlock", "value": "*\n * this is anonymous class.\n ", - "start": 0, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 3 - } - } + "start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":3}} } ] } @@ -177,34 +66,12 @@ { "type": "CommentBlock", "value": "*\n * this is anonymous class.\n ", - "start": 0, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 3 - } - } + "start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":3}} }, { "type": "CommentBlock", "value": "*\n * this is method1.\n ", - "start": 63, - "end": 98, - "loc": { - "start": { - "line": 5, - "column": 4 - }, - "end": { - "line": 7, - "column": 7 - } - } + "start":63,"end":98,"loc":{"start":{"line":5,"column":4},"end":{"line":7,"column":7}} } ] } \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/comments/basic/function-trailing-comma-shorthand/input.js b/packages/babel-parser/test/fixtures/comments/basic/function-trailing-comma-shorthand/input.js index 0936c59b4e55..cbeebe5ee3b6 100644 --- a/packages/babel-parser/test/fixtures/comments/basic/function-trailing-comma-shorthand/input.js +++ b/packages/babel-parser/test/fixtures/comments/basic/function-trailing-comma-shorthand/input.js @@ -1 +1 @@ -fn(a, { b }, /* comment */); +fn(a, { b }, /* comment 1 */) /* comment 2 */; diff --git a/packages/babel-parser/test/fixtures/comments/basic/function-trailing-comma-shorthand/output.json b/packages/babel-parser/test/fixtures/comments/basic/function-trailing-comma-shorthand/output.json index ecc67f22abd0..d26cffc23ca4 100644 --- a/packages/babel-parser/test/fixtures/comments/basic/function-trailing-comma-shorthand/output.json +++ b/packages/babel-parser/test/fixtures/comments/basic/function-trailing-comma-shorthand/output.json @@ -1,161 +1,50 @@ { "type": "File", - "start": 0, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":0,"end":46,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":46}}, "program": { "type": "Program", - "start": 0, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":0,"end":46,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":46}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":0,"end":46,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":46}}, "expression": { "type": "CallExpression", - "start": 0, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, "callee": { "type": "Identifier", - "start": 0, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 2 - }, - "identifierName": "fn" - }, + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2},"identifierName":"fn"}, "name": "fn" }, + "extra": { + "trailingComma": 11 + }, "arguments": [ { "type": "Identifier", - "start": 3, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 4 - }, - "identifierName": "a" - }, + "start":3,"end":4,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":4},"identifierName":"a"}, "name": "a" }, { "type": "ObjectExpression", - "start": 6, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":6,"end":11,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":11}}, "properties": [ { "type": "ObjectProperty", - "start": 8, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":8,"end":9,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":9}}, "method": false, "key": { "type": "Identifier", - "start": 8, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "b" - }, + "start":8,"end":9,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":9},"identifierName":"b"}, "name": "b" }, "computed": false, "shorthand": true, "value": { "type": "Identifier", - "start": 8, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "b" - }, + "start":8,"end":9,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":9},"identifierName":"b"}, "name": "b" }, "extra": { @@ -166,22 +55,18 @@ "trailingComments": [ { "type": "CommentBlock", - "value": " comment ", - "start": 13, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 26 - } - } + "value": " comment 1 ", + "start":13,"end":28,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":28}} } ] } + ], + "trailingComments": [ + { + "type": "CommentBlock", + "value": " comment 2 ", + "start":30,"end":45,"loc":{"start":{"line":1,"column":30},"end":{"line":1,"column":45}} + } ] } } @@ -191,19 +76,13 @@ "comments": [ { "type": "CommentBlock", - "value": " comment ", - "start": 13, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 26 - } - } + "value": " comment 1 ", + "start":13,"end":28,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":28}} + }, + { + "type": "CommentBlock", + "value": " comment 2 ", + "start":30,"end":45,"loc":{"start":{"line":1,"column":30},"end":{"line":1,"column":45}} } ] } \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/comments/basic/function-trailing-comma/input.js b/packages/babel-parser/test/fixtures/comments/basic/function-trailing-comma/input.js index d8611dab0c54..ebebb26100af 100644 --- a/packages/babel-parser/test/fixtures/comments/basic/function-trailing-comma/input.js +++ b/packages/babel-parser/test/fixtures/comments/basic/function-trailing-comma/input.js @@ -1 +1 @@ -fn(a, b, /* comment */); +fn(a, b, /* comment 1 */) /* comment 2*/; diff --git a/packages/babel-parser/test/fixtures/comments/basic/function-trailing-comma/output.json b/packages/babel-parser/test/fixtures/comments/basic/function-trailing-comma/output.json index 756beb301cf3..cdd785a4ab82 100644 --- a/packages/babel-parser/test/fixtures/comments/basic/function-trailing-comma/output.json +++ b/packages/babel-parser/test/fixtures/comments/basic/function-trailing-comma/output.json @@ -1,132 +1,51 @@ { "type": "File", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":41,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":41}}, "program": { "type": "Program", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":41,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":41}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":41,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":41}}, "expression": { "type": "CallExpression", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, "callee": { "type": "Identifier", - "start": 0, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 2 - }, - "identifierName": "fn" - }, + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2},"identifierName":"fn"}, "name": "fn" }, + "extra": { + "trailingComma": 7 + }, "arguments": [ { "type": "Identifier", - "start": 3, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 4 - }, - "identifierName": "a" - }, + "start":3,"end":4,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":4},"identifierName":"a"}, "name": "a" }, { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "b" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"b"}, "name": "b", "trailingComments": [ { "type": "CommentBlock", - "value": " comment ", - "start": 9, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 22 - } - } + "value": " comment 1 ", + "start":9,"end":24,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":24}} } ] } + ], + "trailingComments": [ + { + "type": "CommentBlock", + "value": " comment 2", + "start":26,"end":40,"loc":{"start":{"line":1,"column":26},"end":{"line":1,"column":40}} + } ] } } @@ -136,19 +55,13 @@ "comments": [ { "type": "CommentBlock", - "value": " comment ", - "start": 9, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 22 - } - } + "value": " comment 1 ", + "start":9,"end":24,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":24}} + }, + { + "type": "CommentBlock", + "value": " comment 2", + "start":26,"end":40,"loc":{"start":{"line":1,"column":26},"end":{"line":1,"column":40}} } ] } \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/comments/basic/object-expression-trailing-comma/input.js b/packages/babel-parser/test/fixtures/comments/basic/object-expression-trailing-comma/input.js new file mode 100644 index 000000000000..78f80a9968e5 --- /dev/null +++ b/packages/babel-parser/test/fixtures/comments/basic/object-expression-trailing-comma/input.js @@ -0,0 +1,6 @@ +const { + /* One */ + x + /* Two */, + /* Three */ +} /* Four */ = {}; \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/comments/basic/object-expression-trailing-comma/output.json b/packages/babel-parser/test/fixtures/comments/basic/object-expression-trailing-comma/output.json new file mode 100644 index 000000000000..e016e28ae97c --- /dev/null +++ b/packages/babel-parser/test/fixtures/comments/basic/object-expression-trailing-comma/output.json @@ -0,0 +1,106 @@ +{ + "type": "File", + "start":0,"end":69,"loc":{"start":{"line":1,"column":0},"end":{"line":6,"column":18}}, + "program": { + "type": "Program", + "start":0,"end":69,"loc":{"start":{"line":1,"column":0},"end":{"line":6,"column":18}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start":0,"end":69,"loc":{"start":{"line":1,"column":0},"end":{"line":6,"column":18}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":6,"end":68,"loc":{"start":{"line":1,"column":6},"end":{"line":6,"column":17}}, + "id": { + "type": "ObjectPattern", + "start":6,"end":52,"loc":{"start":{"line":1,"column":6},"end":{"line":6,"column":1}}, + "properties": [ + { + "type": "ObjectProperty", + "start":22,"end":23,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":3}}, + "method": false, + "key": { + "type": "Identifier", + "start":22,"end":23,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":3},"identifierName":"x"}, + "name": "x" + }, + "computed": false, + "shorthand": true, + "value": { + "type": "Identifier", + "start":22,"end":23,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":3},"identifierName":"x"}, + "name": "x" + }, + "leadingComments": [ + { + "type": "CommentBlock", + "value": " One ", + "start":10,"end":19,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":11}} + } + ], + "trailingComments": [ + { + "type": "CommentBlock", + "value": " Two ", + "start":26,"end":35,"loc":{"start":{"line":4,"column":2},"end":{"line":4,"column":11}} + }, + { + "type": "CommentBlock", + "value": " Three ", + "start":39,"end":50,"loc":{"start":{"line":5,"column":2},"end":{"line":5,"column":13}} + } + ], + "extra": { + "shorthand": true + } + } + ], + "extra": { + "trailingComma": 35 + }, + "trailingComments": [ + { + "type": "CommentBlock", + "value": " Four ", + "start":53,"end":63,"loc":{"start":{"line":6,"column":2},"end":{"line":6,"column":12}} + } + ] + }, + "init": { + "type": "ObjectExpression", + "start":66,"end":68,"loc":{"start":{"line":6,"column":15},"end":{"line":6,"column":17}}, + "properties": [] + } + } + ], + "kind": "const" + } + ], + "directives": [] + }, + "comments": [ + { + "type": "CommentBlock", + "value": " One ", + "start":10,"end":19,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":11}} + }, + { + "type": "CommentBlock", + "value": " Two ", + "start":26,"end":35,"loc":{"start":{"line":4,"column":2},"end":{"line":4,"column":11}} + }, + { + "type": "CommentBlock", + "value": " Three ", + "start":39,"end":50,"loc":{"start":{"line":5,"column":2},"end":{"line":5,"column":13}} + }, + { + "type": "CommentBlock", + "value": " Four ", + "start":53,"end":63,"loc":{"start":{"line":6,"column":2},"end":{"line":6,"column":12}} + } + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/comments/basic/object-property-trailing-comma/input.js b/packages/babel-parser/test/fixtures/comments/basic/object-property-trailing-comma/input.js index acd5921a7c0e..695835903290 100644 --- a/packages/babel-parser/test/fixtures/comments/basic/object-property-trailing-comma/input.js +++ b/packages/babel-parser/test/fixtures/comments/basic/object-property-trailing-comma/input.js @@ -2,4 +2,4 @@ var obj = { a: '1', // comment 1 b: '2', // comment 2 c: '3', // comment 3 -}; +}; // comment 4 diff --git a/packages/babel-parser/test/fixtures/comments/basic/object-property-trailing-comma/output.json b/packages/babel-parser/test/fixtures/comments/basic/object-property-trailing-comma/output.json index 0004e27a14fd..2455490bd610 100644 --- a/packages/babel-parser/test/fixtures/comments/basic/object-property-trailing-comma/output.json +++ b/packages/babel-parser/test/fixtures/comments/basic/object-property-trailing-comma/output.json @@ -1,143 +1,42 @@ { "type": "File", - "start": 0, - "end": 83, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 2 - } - }, + "start":0,"end":96,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":15}}, "program": { "type": "Program", - "start": 0, - "end": 83, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 2 - } - }, + "start":0,"end":96,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":15}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 83, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 2 - } - }, + "start":0,"end":83,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":2}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 82, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 5, - "column": 1 - } - }, + "start":4,"end":82,"loc":{"start":{"line":1,"column":4},"end":{"line":5,"column":1}}, "id": { "type": "Identifier", - "start": 4, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "obj" - }, + "start":4,"end":7,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":7},"identifierName":"obj"}, "name": "obj" }, "init": { "type": "ObjectExpression", - "start": 10, - "end": 82, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 5, - "column": 1 - } - }, + "start":10,"end":82,"loc":{"start":{"line":1,"column":10},"end":{"line":5,"column":1}}, "properties": [ { "type": "ObjectProperty", - "start": 14, - "end": 20, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 8 - } - }, + "start":14,"end":20,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":8}}, "method": false, "key": { "type": "Identifier", - "start": 14, - "end": 15, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 3 - }, - "identifierName": "a" - }, + "start":14,"end":15,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":3},"identifierName":"a"}, "name": "a" }, "computed": false, "shorthand": false, "value": { "type": "StringLiteral", - "start": 17, - "end": 20, - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 8 - } - }, + "start":17,"end":20,"loc":{"start":{"line":2,"column":5},"end":{"line":2,"column":8}}, "extra": { "rawValue": "1", "raw": "'1'" @@ -147,52 +46,18 @@ }, { "type": "ObjectProperty", - "start": 37, - "end": 43, - "loc": { - "start": { - "line": 3, - "column": 2 - }, - "end": { - "line": 3, - "column": 8 - } - }, + "start":37,"end":43,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":8}}, "method": false, "key": { "type": "Identifier", - "start": 37, - "end": 38, - "loc": { - "start": { - "line": 3, - "column": 2 - }, - "end": { - "line": 3, - "column": 3 - }, - "identifierName": "b" - }, + "start":37,"end":38,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":3},"identifierName":"b"}, "name": "b" }, "computed": false, "shorthand": false, "value": { "type": "StringLiteral", - "start": 40, - "end": 43, - "loc": { - "start": { - "line": 3, - "column": 5 - }, - "end": { - "line": 3, - "column": 8 - } - }, + "start":40,"end":43,"loc":{"start":{"line":3,"column":5},"end":{"line":3,"column":8}}, "extra": { "rawValue": "2", "raw": "'2'" @@ -203,69 +68,24 @@ { "type": "CommentLine", "value": " comment 1", - "start": 22, - "end": 34, - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 22 - } - } + "start":22,"end":34,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":22}} } ] }, { "type": "ObjectProperty", - "start": 60, - "end": 66, - "loc": { - "start": { - "line": 4, - "column": 2 - }, - "end": { - "line": 4, - "column": 8 - } - }, + "start":60,"end":66,"loc":{"start":{"line":4,"column":2},"end":{"line":4,"column":8}}, "method": false, "key": { "type": "Identifier", - "start": 60, - "end": 61, - "loc": { - "start": { - "line": 4, - "column": 2 - }, - "end": { - "line": 4, - "column": 3 - }, - "identifierName": "c" - }, + "start":60,"end":61,"loc":{"start":{"line":4,"column":2},"end":{"line":4,"column":3},"identifierName":"c"}, "name": "c" }, "computed": false, "shorthand": false, "value": { "type": "StringLiteral", - "start": 63, - "end": 66, - "loc": { - "start": { - "line": 4, - "column": 5 - }, - "end": { - "line": 4, - "column": 8 - } - }, + "start":63,"end":66,"loc":{"start":{"line":4,"column":5},"end":{"line":4,"column":8}}, "extra": { "rawValue": "3", "raw": "'3'" @@ -276,44 +96,32 @@ { "type": "CommentLine", "value": " comment 2", - "start": 45, - "end": 57, - "loc": { - "start": { - "line": 3, - "column": 10 - }, - "end": { - "line": 3, - "column": 22 - } - } + "start":45,"end":57,"loc":{"start":{"line":3,"column":10},"end":{"line":3,"column":22}} } ], "trailingComments": [ { "type": "CommentLine", "value": " comment 3", - "start": 68, - "end": 80, - "loc": { - "start": { - "line": 4, - "column": 10 - }, - "end": { - "line": 4, - "column": 22 - } - } + "start":68,"end":80,"loc":{"start":{"line":4,"column":10},"end":{"line":4,"column":22}} } ] } - ] + ], + "extra": { + "trailingComma": 66 + } } } ], - "kind": "var" + "kind": "var", + "trailingComments": [ + { + "type": "CommentLine", + "value": " comment 4", + "start":84,"end":96,"loc":{"start":{"line":5,"column":3},"end":{"line":5,"column":15}} + } + ] } ], "directives": [] @@ -322,50 +130,22 @@ { "type": "CommentLine", "value": " comment 1", - "start": 22, - "end": 34, - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 22 - } - } + "start":22,"end":34,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":22}} }, { "type": "CommentLine", "value": " comment 2", - "start": 45, - "end": 57, - "loc": { - "start": { - "line": 3, - "column": 10 - }, - "end": { - "line": 3, - "column": 22 - } - } + "start":45,"end":57,"loc":{"start":{"line":3,"column":10},"end":{"line":3,"column":22}} }, { "type": "CommentLine", "value": " comment 3", - "start": 68, - "end": 80, - "loc": { - "start": { - "line": 4, - "column": 10 - }, - "end": { - "line": 4, - "column": 22 - } - } + "start":68,"end":80,"loc":{"start":{"line":4,"column":10},"end":{"line":4,"column":22}} + }, + { + "type": "CommentLine", + "value": " comment 4", + "start":84,"end":96,"loc":{"start":{"line":5,"column":3},"end":{"line":5,"column":15}} } ] } \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/comments/basic/surrounding-call-comments/output.json b/packages/babel-parser/test/fixtures/comments/basic/surrounding-call-comments/output.json index 987906b2aded..ba6cb1038be8 100644 --- a/packages/babel-parser/test/fixtures/comments/basic/surrounding-call-comments/output.json +++ b/packages/babel-parser/test/fixtures/comments/basic/surrounding-call-comments/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 60, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 1 - } - }, + "start":0,"end":60,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 60, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 1 - } - }, + "start":0,"end":60,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 60, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 1 - } - }, + "start":0,"end":60,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, "id": { "type": "Identifier", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - }, - "identifierName": "a" - }, + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"a"}, "name": "a" }, "generator": false, @@ -65,62 +20,17 @@ "params": [], "body": { "type": "BlockStatement", - "start": 13, - "end": 60, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 5, - "column": 1 - } - }, + "start":13,"end":60,"loc":{"start":{"line":1,"column":13},"end":{"line":5,"column":1}}, "body": [ { "type": "ExpressionStatement", - "start": 36, - "end": 42, - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 10 - } - }, + "start":36,"end":42,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":10}}, "expression": { "type": "CallExpression", - "start": 36, - "end": 41, - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 9 - } - }, + "start":36,"end":41,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":9}}, "callee": { "type": "Identifier", - "start": 36, - "end": 39, - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 7 - }, - "identifierName": "foo" - }, + "start":36,"end":39,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":7},"identifierName":"foo"}, "name": "foo" }, "arguments": [] @@ -129,36 +39,14 @@ { "type": "CommentBlock", "value": " before ", - "start": 19, - "end": 31, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 16 - } - } + "start":19,"end":31,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":16}} } ], "trailingComments": [ { "type": "CommentBlock", "value": " after ", - "start": 47, - "end": 58, - "loc": { - "start": { - "line": 4, - "column": 4 - }, - "end": { - "line": 4, - "column": 15 - } - } + "start":47,"end":58,"loc":{"start":{"line":4,"column":4},"end":{"line":4,"column":15}} } ] } @@ -173,34 +61,12 @@ { "type": "CommentBlock", "value": " before ", - "start": 19, - "end": 31, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 16 - } - } + "start":19,"end":31,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":16}} }, { "type": "CommentBlock", "value": " after ", - "start": 47, - "end": 58, - "loc": { - "start": { - "line": 4, - "column": 4 - }, - "end": { - "line": 4, - "column": 15 - } - } + "start":47,"end":58,"loc":{"start":{"line":4,"column":4},"end":{"line":4,"column":15}} } ] } \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/comments/basic/surrounding-debugger-comments/output.json b/packages/babel-parser/test/fixtures/comments/basic/surrounding-debugger-comments/output.json index 1ef29ee9df41..0bb60fc14ce5 100644 --- a/packages/babel-parser/test/fixtures/comments/basic/surrounding-debugger-comments/output.json +++ b/packages/babel-parser/test/fixtures/comments/basic/surrounding-debugger-comments/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 63, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 1 - } - }, + "start":0,"end":63,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 63, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 1 - } - }, + "start":0,"end":63,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 63, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 1 - } - }, + "start":0,"end":63,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, "id": { "type": "Identifier", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - }, - "identifierName": "a" - }, + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"a"}, "name": "a" }, "generator": false, @@ -65,67 +20,23 @@ "params": [], "body": { "type": "BlockStatement", - "start": 13, - "end": 63, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 5, - "column": 1 - } - }, + "start":13,"end":63,"loc":{"start":{"line":1,"column":13},"end":{"line":5,"column":1}}, "body": [ { "type": "DebuggerStatement", - "start": 36, - "end": 45, - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 13 - } - }, + "start":36,"end":45,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":13}}, "leadingComments": [ { "type": "CommentBlock", "value": " before ", - "start": 19, - "end": 31, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 16 - } - } + "start":19,"end":31,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":16}} } ], "trailingComments": [ { "type": "CommentBlock", "value": " after ", - "start": 50, - "end": 61, - "loc": { - "start": { - "line": 4, - "column": 4 - }, - "end": { - "line": 4, - "column": 15 - } - } + "start":50,"end":61,"loc":{"start":{"line":4,"column":4},"end":{"line":4,"column":15}} } ] } @@ -140,34 +51,12 @@ { "type": "CommentBlock", "value": " before ", - "start": 19, - "end": 31, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 16 - } - } + "start":19,"end":31,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":16}} }, { "type": "CommentBlock", "value": " after ", - "start": 50, - "end": 61, - "loc": { - "start": { - "line": 4, - "column": 4 - }, - "end": { - "line": 4, - "column": 15 - } - } + "start":50,"end":61,"loc":{"start":{"line":4,"column":4},"end":{"line":4,"column":15}} } ] } \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/comments/basic/surrounding-return-comments/output.json b/packages/babel-parser/test/fixtures/comments/basic/surrounding-return-comments/output.json index cae6a8fb2da6..2aabdd7f5b83 100644 --- a/packages/babel-parser/test/fixtures/comments/basic/surrounding-return-comments/output.json +++ b/packages/babel-parser/test/fixtures/comments/basic/surrounding-return-comments/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 61, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 1 - } - }, + "start":0,"end":61,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 61, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 1 - } - }, + "start":0,"end":61,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 61, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 1 - } - }, + "start":0,"end":61,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, "id": { "type": "Identifier", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - }, - "identifierName": "a" - }, + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"a"}, "name": "a" }, "generator": false, @@ -65,68 +20,24 @@ "params": [], "body": { "type": "BlockStatement", - "start": 13, - "end": 61, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 5, - "column": 1 - } - }, + "start":13,"end":61,"loc":{"start":{"line":1,"column":13},"end":{"line":5,"column":1}}, "body": [ { "type": "ReturnStatement", - "start": 36, - "end": 43, - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 11 - } - }, + "start":36,"end":43,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":11}}, "argument": null, "leadingComments": [ { "type": "CommentBlock", "value": " before ", - "start": 19, - "end": 31, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 16 - } - } + "start":19,"end":31,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":16}} } ], "trailingComments": [ { "type": "CommentBlock", "value": " after ", - "start": 48, - "end": 59, - "loc": { - "start": { - "line": 4, - "column": 4 - }, - "end": { - "line": 4, - "column": 15 - } - } + "start":48,"end":59,"loc":{"start":{"line":4,"column":4},"end":{"line":4,"column":15}} } ] } @@ -141,34 +52,12 @@ { "type": "CommentBlock", "value": " before ", - "start": 19, - "end": 31, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 16 - } - } + "start":19,"end":31,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":16}} }, { "type": "CommentBlock", "value": " after ", - "start": 48, - "end": 59, - "loc": { - "start": { - "line": 4, - "column": 4 - }, - "end": { - "line": 4, - "column": 15 - } - } + "start":48,"end":59,"loc":{"start":{"line":4,"column":4},"end":{"line":4,"column":15}} } ] } \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/comments/basic/surrounding-throw-comments/output.json b/packages/babel-parser/test/fixtures/comments/basic/surrounding-throw-comments/output.json index 8be69c3aa8f5..6a9003378e41 100644 --- a/packages/babel-parser/test/fixtures/comments/basic/surrounding-throw-comments/output.json +++ b/packages/babel-parser/test/fixtures/comments/basic/surrounding-throw-comments/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 63, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 1 - } - }, + "start":0,"end":63,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 63, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 1 - } - }, + "start":0,"end":63,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 63, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 1 - } - }, + "start":0,"end":63,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, "id": { "type": "Identifier", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - }, - "identifierName": "a" - }, + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"a"}, "name": "a" }, "generator": false, @@ -65,47 +20,14 @@ "params": [], "body": { "type": "BlockStatement", - "start": 13, - "end": 63, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 5, - "column": 1 - } - }, + "start":13,"end":63,"loc":{"start":{"line":1,"column":13},"end":{"line":5,"column":1}}, "body": [ { "type": "ThrowStatement", - "start": 36, - "end": 45, - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 13 - } - }, + "start":36,"end":45,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":13}}, "argument": { "type": "NumericLiteral", - "start": 42, - "end": 44, - "loc": { - "start": { - "line": 3, - "column": 10 - }, - "end": { - "line": 3, - "column": 12 - } - }, + "start":42,"end":44,"loc":{"start":{"line":3,"column":10},"end":{"line":3,"column":12}}, "extra": { "rawValue": 55, "raw": "55" @@ -116,36 +38,14 @@ { "type": "CommentBlock", "value": " before ", - "start": 19, - "end": 31, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 16 - } - } + "start":19,"end":31,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":16}} } ], "trailingComments": [ { "type": "CommentBlock", "value": " after ", - "start": 50, - "end": 61, - "loc": { - "start": { - "line": 4, - "column": 4 - }, - "end": { - "line": 4, - "column": 15 - } - } + "start":50,"end":61,"loc":{"start":{"line":4,"column":4},"end":{"line":4,"column":15}} } ] } @@ -160,34 +60,12 @@ { "type": "CommentBlock", "value": " before ", - "start": 19, - "end": 31, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 16 - } - } + "start":19,"end":31,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":16}} }, { "type": "CommentBlock", "value": " after ", - "start": 50, - "end": 61, - "loc": { - "start": { - "line": 4, - "column": 4 - }, - "end": { - "line": 4, - "column": 15 - } - } + "start":50,"end":61,"loc":{"start":{"line":4,"column":4},"end":{"line":4,"column":15}} } ] } \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/comments/basic/surrounding-while-loop-comments/output.json b/packages/babel-parser/test/fixtures/comments/basic/surrounding-while-loop-comments/output.json index 58347c10e781..d122849e3349 100644 --- a/packages/babel-parser/test/fixtures/comments/basic/surrounding-while-loop-comments/output.json +++ b/packages/babel-parser/test/fixtures/comments/basic/surrounding-while-loop-comments/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 68, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 68 - } - }, + "start":0,"end":68,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":68}}, "program": { "type": "Program", - "start": 0, - "end": 68, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 68 - } - }, + "start":0,"end":68,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":68}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 68, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 68 - } - }, + "start":0,"end":68,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":68}}, "id": { "type": "Identifier", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - }, - "identifierName": "f" - }, + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"f"}, "name": "f" }, "generator": false, @@ -65,63 +20,19 @@ "params": [], "body": { "type": "BlockStatement", - "start": 13, - "end": 68, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 68 - } - }, + "start":13,"end":68,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":68}}, "body": [ { "type": "WhileStatement", - "start": 30, - "end": 46, - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 1, - "column": 46 - } - }, + "start":30,"end":46,"loc":{"start":{"line":1,"column":30},"end":{"line":1,"column":46}}, "test": { "type": "BooleanLiteral", - "start": 37, - "end": 41, - "loc": { - "start": { - "line": 1, - "column": 37 - }, - "end": { - "line": 1, - "column": 41 - } - }, + "start":37,"end":41,"loc":{"start":{"line":1,"column":37},"end":{"line":1,"column":41}}, "value": true }, "body": { "type": "BlockStatement", - "start": 43, - "end": 46, - "loc": { - "start": { - "line": 1, - "column": 43 - }, - "end": { - "line": 1, - "column": 46 - } - }, + "start":43,"end":46,"loc":{"start":{"line":1,"column":43},"end":{"line":1,"column":46}}, "body": [], "directives": [] }, @@ -129,83 +40,27 @@ { "type": "CommentBlock", "value": " infinite ", - "start": 15, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 29 - } - } + "start":15,"end":29,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":29}} } ], "trailingComments": [ { "type": "CommentBlock", "value": " bar ", - "start": 47, - "end": 56, - "loc": { - "start": { - "line": 1, - "column": 47 - }, - "end": { - "line": 1, - "column": 56 - } - } + "start":47,"end":56,"loc":{"start":{"line":1,"column":47},"end":{"line":1,"column":56}} } ] }, { "type": "VariableDeclaration", - "start": 57, - "end": 66, - "loc": { - "start": { - "line": 1, - "column": 57 - }, - "end": { - "line": 1, - "column": 66 - } - }, + "start":57,"end":66,"loc":{"start":{"line":1,"column":57},"end":{"line":1,"column":66}}, "declarations": [ { "type": "VariableDeclarator", - "start": 61, - "end": 65, - "loc": { - "start": { - "line": 1, - "column": 61 - }, - "end": { - "line": 1, - "column": 65 - } - }, + "start":61,"end":65,"loc":{"start":{"line":1,"column":61},"end":{"line":1,"column":65}}, "id": { "type": "Identifier", - "start": 61, - "end": 65, - "loc": { - "start": { - "line": 1, - "column": 61 - }, - "end": { - "line": 1, - "column": 65 - }, - "identifierName": "each" - }, + "start":61,"end":65,"loc":{"start":{"line":1,"column":61},"end":{"line":1,"column":65},"identifierName":"each"}, "name": "each" }, "init": null @@ -216,18 +71,7 @@ { "type": "CommentBlock", "value": " bar ", - "start": 47, - "end": 56, - "loc": { - "start": { - "line": 1, - "column": 47 - }, - "end": { - "line": 1, - "column": 56 - } - } + "start":47,"end":56,"loc":{"start":{"line":1,"column":47},"end":{"line":1,"column":56}} } ] } @@ -242,34 +86,12 @@ { "type": "CommentBlock", "value": " infinite ", - "start": 15, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 29 - } - } + "start":15,"end":29,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":29}} }, { "type": "CommentBlock", "value": " bar ", - "start": 47, - "end": 56, - "loc": { - "start": { - "line": 1, - "column": 47 - }, - "end": { - "line": 1, - "column": 56 - } - } + "start":47,"end":56,"loc":{"start":{"line":1,"column":47},"end":{"line":1,"column":56}} } ] } \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/comments/basic/switch-fallthrough-comment-in-function/output.json b/packages/babel-parser/test/fixtures/comments/basic/switch-fallthrough-comment-in-function/output.json index 7d9c9d9b4ac4..208916dfa2ed 100644 --- a/packages/babel-parser/test/fixtures/comments/basic/switch-fallthrough-comment-in-function/output.json +++ b/packages/babel-parser/test/fixtures/comments/basic/switch-fallthrough-comment-in-function/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 141, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 9, - "column": 1 - } - }, + "start":0,"end":141,"loc":{"start":{"line":1,"column":0},"end":{"line":9,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 141, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 9, - "column": 1 - } - }, + "start":0,"end":141,"loc":{"start":{"line":1,"column":0},"end":{"line":9,"column":1}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 141, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 9, - "column": 1 - } - }, + "start":0,"end":141,"loc":{"start":{"line":1,"column":0},"end":{"line":9,"column":1}}, "id": { "type": "Identifier", - "start": 9, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "bar" - }, + "start":9,"end":12,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":12},"identifierName":"bar"}, "name": "bar" }, "generator": false, @@ -65,98 +20,30 @@ "params": [ { "type": "Identifier", - "start": 13, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 16 - }, - "identifierName": "foo" - }, + "start":13,"end":16,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":16},"identifierName":"foo"}, "name": "foo" } ], "body": { "type": "BlockStatement", - "start": 18, - "end": 141, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 9, - "column": 1 - } - }, + "start":18,"end":141,"loc":{"start":{"line":1,"column":18},"end":{"line":9,"column":1}}, "body": [ { "type": "SwitchStatement", - "start": 24, - "end": 139, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 8, - "column": 5 - } - }, + "start":24,"end":139,"loc":{"start":{"line":2,"column":4},"end":{"line":8,"column":5}}, "discriminant": { "type": "Identifier", - "start": 31, - "end": 34, - "loc": { - "start": { - "line": 2, - "column": 11 - }, - "end": { - "line": 2, - "column": 14 - }, - "identifierName": "foo" - }, + "start":31,"end":34,"loc":{"start":{"line":2,"column":11},"end":{"line":2,"column":14},"identifierName":"foo"}, "name": "foo" }, "cases": [ { "type": "SwitchCase", - "start": 61, - "end": 68, - "loc": { - "start": { - "line": 4, - "column": 8 - }, - "end": { - "line": 4, - "column": 15 - } - }, + "start":61,"end":68,"loc":{"start":{"line":4,"column":8},"end":{"line":4,"column":15}}, "consequent": [], "test": { "type": "NumericLiteral", - "start": 66, - "end": 67, - "loc": { - "start": { - "line": 4, - "column": 13 - }, - "end": { - "line": 4, - "column": 14 - } - }, + "start":66,"end":67,"loc":{"start":{"line":4,"column":13},"end":{"line":4,"column":14}}, "extra": { "rawValue": 1, "raw": "1" @@ -167,97 +54,30 @@ { "type": "CommentLine", "value": " foo", - "start": 46, - "end": 52, - "loc": { - "start": { - "line": 3, - "column": 8 - }, - "end": { - "line": 3, - "column": 14 - } - } + "start":46,"end":52,"loc":{"start":{"line":3,"column":8},"end":{"line":3,"column":14}} } ], "trailingComments": [ { "type": "CommentLine", "value": " falls through", - "start": 81, - "end": 97, - "loc": { - "start": { - "line": 5, - "column": 12 - }, - "end": { - "line": 5, - "column": 28 - } - } + "start":81,"end":97,"loc":{"start":{"line":5,"column":12},"end":{"line":5,"column":28}} } ] }, { "type": "SwitchCase", - "start": 106, - "end": 133, - "loc": { - "start": { - "line": 6, - "column": 8 - }, - "end": { - "line": 7, - "column": 19 - } - }, + "start":106,"end":133,"loc":{"start":{"line":6,"column":8},"end":{"line":7,"column":19}}, "consequent": [ { "type": "ExpressionStatement", - "start": 126, - "end": 133, - "loc": { - "start": { - "line": 7, - "column": 12 - }, - "end": { - "line": 7, - "column": 19 - } - }, + "start":126,"end":133,"loc":{"start":{"line":7,"column":12},"end":{"line":7,"column":19}}, "expression": { "type": "CallExpression", - "start": 126, - "end": 132, - "loc": { - "start": { - "line": 7, - "column": 12 - }, - "end": { - "line": 7, - "column": 18 - } - }, + "start":126,"end":132,"loc":{"start":{"line":7,"column":12},"end":{"line":7,"column":18}}, "callee": { "type": "Identifier", - "start": 126, - "end": 130, - "loc": { - "start": { - "line": 7, - "column": 12 - }, - "end": { - "line": 7, - "column": 16 - }, - "identifierName": "doIt" - }, + "start":126,"end":130,"loc":{"start":{"line":7,"column":12},"end":{"line":7,"column":16},"identifierName":"doIt"}, "name": "doIt" }, "arguments": [] @@ -266,18 +86,7 @@ ], "test": { "type": "NumericLiteral", - "start": 111, - "end": 112, - "loc": { - "start": { - "line": 6, - "column": 13 - }, - "end": { - "line": 6, - "column": 14 - } - }, + "start":111,"end":112,"loc":{"start":{"line":6,"column":13},"end":{"line":6,"column":14}}, "extra": { "rawValue": 2, "raw": "2" @@ -288,18 +97,7 @@ { "type": "CommentLine", "value": " falls through", - "start": 81, - "end": 97, - "loc": { - "start": { - "line": 5, - "column": 12 - }, - "end": { - "line": 5, - "column": 28 - } - } + "start":81,"end":97,"loc":{"start":{"line":5,"column":12},"end":{"line":5,"column":28}} } ] } @@ -316,34 +114,12 @@ { "type": "CommentLine", "value": " foo", - "start": 46, - "end": 52, - "loc": { - "start": { - "line": 3, - "column": 8 - }, - "end": { - "line": 3, - "column": 14 - } - } + "start":46,"end":52,"loc":{"start":{"line":3,"column":8},"end":{"line":3,"column":14}} }, { "type": "CommentLine", "value": " falls through", - "start": 81, - "end": 97, - "loc": { - "start": { - "line": 5, - "column": 12 - }, - "end": { - "line": 5, - "column": 28 - } - } + "start":81,"end":97,"loc":{"start":{"line":5,"column":12},"end":{"line":5,"column":28}} } ] } \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/comments/basic/switch-fallthrough-comment/output.json b/packages/babel-parser/test/fixtures/comments/basic/switch-fallthrough-comment/output.json index 620771ddcd6c..fb5538434aac 100644 --- a/packages/babel-parser/test/fixtures/comments/basic/switch-fallthrough-comment/output.json +++ b/packages/babel-parser/test/fixtures/comments/basic/switch-fallthrough-comment/output.json @@ -1,95 +1,28 @@ { "type": "File", - "start": 0, - "end": 91, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 7, - "column": 1 - } - }, + "start":0,"end":91,"loc":{"start":{"line":1,"column":0},"end":{"line":7,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 91, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 7, - "column": 1 - } - }, + "start":0,"end":91,"loc":{"start":{"line":1,"column":0},"end":{"line":7,"column":1}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "SwitchStatement", - "start": 0, - "end": 91, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 7, - "column": 1 - } - }, + "start":0,"end":91,"loc":{"start":{"line":1,"column":0},"end":{"line":7,"column":1}}, "discriminant": { "type": "Identifier", - "start": 7, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 10 - }, - "identifierName": "foo" - }, + "start":7,"end":10,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":10},"identifierName":"foo"}, "name": "foo" }, "cases": [ { "type": "SwitchCase", - "start": 29, - "end": 36, - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 11 - } - }, + "start":29,"end":36,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":11}}, "consequent": [], "test": { "type": "NumericLiteral", - "start": 34, - "end": 35, - "loc": { - "start": { - "line": 3, - "column": 9 - }, - "end": { - "line": 3, - "column": 10 - } - }, + "start":34,"end":35,"loc":{"start":{"line":3,"column":9},"end":{"line":3,"column":10}}, "extra": { "rawValue": 1, "raw": "1" @@ -100,97 +33,30 @@ { "type": "CommentLine", "value": " foo", - "start": 18, - "end": 24, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 10 - } - } + "start":18,"end":24,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":10}} } ], "trailingComments": [ { "type": "CommentLine", "value": " falls through", - "start": 45, - "end": 61, - "loc": { - "start": { - "line": 4, - "column": 8 - }, - "end": { - "line": 4, - "column": 24 - } - } + "start":45,"end":61,"loc":{"start":{"line":4,"column":8},"end":{"line":4,"column":24}} } ] }, { "type": "SwitchCase", - "start": 66, - "end": 89, - "loc": { - "start": { - "line": 5, - "column": 4 - }, - "end": { - "line": 6, - "column": 15 - } - }, + "start":66,"end":89,"loc":{"start":{"line":5,"column":4},"end":{"line":6,"column":15}}, "consequent": [ { "type": "ExpressionStatement", - "start": 82, - "end": 89, - "loc": { - "start": { - "line": 6, - "column": 8 - }, - "end": { - "line": 6, - "column": 15 - } - }, + "start":82,"end":89,"loc":{"start":{"line":6,"column":8},"end":{"line":6,"column":15}}, "expression": { "type": "CallExpression", - "start": 82, - "end": 88, - "loc": { - "start": { - "line": 6, - "column": 8 - }, - "end": { - "line": 6, - "column": 14 - } - }, + "start":82,"end":88,"loc":{"start":{"line":6,"column":8},"end":{"line":6,"column":14}}, "callee": { "type": "Identifier", - "start": 82, - "end": 86, - "loc": { - "start": { - "line": 6, - "column": 8 - }, - "end": { - "line": 6, - "column": 12 - }, - "identifierName": "doIt" - }, + "start":82,"end":86,"loc":{"start":{"line":6,"column":8},"end":{"line":6,"column":12},"identifierName":"doIt"}, "name": "doIt" }, "arguments": [] @@ -199,18 +65,7 @@ ], "test": { "type": "NumericLiteral", - "start": 71, - "end": 72, - "loc": { - "start": { - "line": 5, - "column": 9 - }, - "end": { - "line": 5, - "column": 10 - } - }, + "start":71,"end":72,"loc":{"start":{"line":5,"column":9},"end":{"line":5,"column":10}}, "extra": { "rawValue": 2, "raw": "2" @@ -221,18 +76,7 @@ { "type": "CommentLine", "value": " falls through", - "start": 45, - "end": 61, - "loc": { - "start": { - "line": 4, - "column": 8 - }, - "end": { - "line": 4, - "column": 24 - } - } + "start":45,"end":61,"loc":{"start":{"line":4,"column":8},"end":{"line":4,"column":24}} } ] } @@ -245,34 +89,12 @@ { "type": "CommentLine", "value": " foo", - "start": 18, - "end": 24, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 10 - } - } + "start":18,"end":24,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":10}} }, { "type": "CommentLine", "value": " falls through", - "start": 45, - "end": 61, - "loc": { - "start": { - "line": 4, - "column": 8 - }, - "end": { - "line": 4, - "column": 24 - } - } + "start":45,"end":61,"loc":{"start":{"line":4,"column":8},"end":{"line":4,"column":24}} } ] } \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/comments/basic/switch-function-call-no-semicolon-no-default/output.json b/packages/babel-parser/test/fixtures/comments/basic/switch-function-call-no-semicolon-no-default/output.json index 0bbd83f2fc21..9912ec343414 100644 --- a/packages/babel-parser/test/fixtures/comments/basic/switch-function-call-no-semicolon-no-default/output.json +++ b/packages/babel-parser/test/fixtures/comments/basic/switch-function-call-no-semicolon-no-default/output.json @@ -1,155 +1,42 @@ { "type": "File", - "start": 0, - "end": 60, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 1 - } - }, + "start":0,"end":60,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 60, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 1 - } - }, + "start":0,"end":60,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "SwitchStatement", - "start": 0, - "end": 60, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 1 - } - }, + "start":0,"end":60,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, "discriminant": { "type": "Identifier", - "start": 8, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "x" - }, + "start":8,"end":9,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":9},"identifierName":"x"}, "name": "x" }, "cases": [ { "type": "SwitchCase", - "start": 15, - "end": 43, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 3, - "column": 20 - } - }, + "start":15,"end":43,"loc":{"start":{"line":2,"column":2},"end":{"line":3,"column":20}}, "consequent": [ { "type": "ExpressionStatement", - "start": 27, - "end": 43, - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 20 - } - }, + "start":27,"end":43,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":20}}, "expression": { "type": "CallExpression", - "start": 27, - "end": 43, - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 20 - } - }, + "start":27,"end":43,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":20}}, "callee": { "type": "MemberExpression", - "start": 27, - "end": 38, - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 15 - } - }, + "start":27,"end":38,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":15}}, "object": { "type": "Identifier", - "start": 27, - "end": 34, - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 11 - }, - "identifierName": "console" - }, + "start":27,"end":34,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":11},"identifierName":"console"}, "name": "console" }, "property": { "type": "Identifier", - "start": 35, - "end": 38, - "loc": { - "start": { - "line": 3, - "column": 12 - }, - "end": { - "line": 3, - "column": 15 - }, - "identifierName": "log" - }, + "start":35,"end":38,"loc":{"start":{"line":3,"column":12},"end":{"line":3,"column":15},"identifierName":"log"}, "name": "log" }, "computed": false @@ -157,18 +44,7 @@ "arguments": [ { "type": "StringLiteral", - "start": 39, - "end": 42, - "loc": { - "start": { - "line": 3, - "column": 16 - }, - "end": { - "line": 3, - "column": 19 - } - }, + "start":39,"end":42,"loc":{"start":{"line":3,"column":16},"end":{"line":3,"column":19}}, "extra": { "rawValue": "1", "raw": "'1'" @@ -181,18 +57,7 @@ ], "test": { "type": "NumericLiteral", - "start": 20, - "end": 21, - "loc": { - "start": { - "line": 2, - "column": 7 - }, - "end": { - "line": 2, - "column": 8 - } - }, + "start":20,"end":21,"loc":{"start":{"line":2,"column":7},"end":{"line":2,"column":8}}, "extra": { "rawValue": 1, "raw": "1" @@ -203,18 +68,7 @@ { "type": "CommentLine", "value": " comment", - "start": 48, - "end": 58, - "loc": { - "start": { - "line": 4, - "column": 4 - }, - "end": { - "line": 4, - "column": 14 - } - } + "start":48,"end":58,"loc":{"start":{"line":4,"column":4},"end":{"line":4,"column":14}} } ] } @@ -227,18 +81,7 @@ { "type": "CommentLine", "value": " comment", - "start": 48, - "end": 58, - "loc": { - "start": { - "line": 4, - "column": 4 - }, - "end": { - "line": 4, - "column": 14 - } - } + "start":48,"end":58,"loc":{"start":{"line":4,"column":4},"end":{"line":4,"column":14}} } ] } \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/comments/basic/switch-function-call-no-semicolon/output.json b/packages/babel-parser/test/fixtures/comments/basic/switch-function-call-no-semicolon/output.json index f732250d6daa..5941def92e3a 100644 --- a/packages/babel-parser/test/fixtures/comments/basic/switch-function-call-no-semicolon/output.json +++ b/packages/babel-parser/test/fixtures/comments/basic/switch-function-call-no-semicolon/output.json @@ -1,155 +1,42 @@ { "type": "File", - "start": 0, - "end": 81, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 7, - "column": 1 - } - }, + "start":0,"end":81,"loc":{"start":{"line":1,"column":0},"end":{"line":7,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 81, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 7, - "column": 1 - } - }, + "start":0,"end":81,"loc":{"start":{"line":1,"column":0},"end":{"line":7,"column":1}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "SwitchStatement", - "start": 0, - "end": 81, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 7, - "column": 1 - } - }, + "start":0,"end":81,"loc":{"start":{"line":1,"column":0},"end":{"line":7,"column":1}}, "discriminant": { "type": "Identifier", - "start": 7, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - }, - "identifierName": "x" - }, + "start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8},"identifierName":"x"}, "name": "x" }, "cases": [ { "type": "SwitchCase", - "start": 14, - "end": 42, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 3, - "column": 20 - } - }, + "start":14,"end":42,"loc":{"start":{"line":2,"column":2},"end":{"line":3,"column":20}}, "consequent": [ { "type": "ExpressionStatement", - "start": 26, - "end": 42, - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 20 - } - }, + "start":26,"end":42,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":20}}, "expression": { "type": "CallExpression", - "start": 26, - "end": 42, - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 20 - } - }, + "start":26,"end":42,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":20}}, "callee": { "type": "MemberExpression", - "start": 26, - "end": 37, - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 15 - } - }, + "start":26,"end":37,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":15}}, "object": { "type": "Identifier", - "start": 26, - "end": 33, - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 11 - }, - "identifierName": "console" - }, + "start":26,"end":33,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":11},"identifierName":"console"}, "name": "console" }, "property": { "type": "Identifier", - "start": 34, - "end": 37, - "loc": { - "start": { - "line": 3, - "column": 12 - }, - "end": { - "line": 3, - "column": 15 - }, - "identifierName": "log" - }, + "start":34,"end":37,"loc":{"start":{"line":3,"column":12},"end":{"line":3,"column":15},"identifierName":"log"}, "name": "log" }, "computed": false @@ -157,18 +44,7 @@ "arguments": [ { "type": "StringLiteral", - "start": 38, - "end": 41, - "loc": { - "start": { - "line": 3, - "column": 16 - }, - "end": { - "line": 3, - "column": 19 - } - }, + "start":38,"end":41,"loc":{"start":{"line":3,"column":16},"end":{"line":3,"column":19}}, "extra": { "rawValue": "1", "raw": "'1'" @@ -181,18 +57,7 @@ ], "test": { "type": "NumericLiteral", - "start": 19, - "end": 20, - "loc": { - "start": { - "line": 2, - "column": 7 - }, - "end": { - "line": 2, - "column": 8 - } - }, + "start":19,"end":20,"loc":{"start":{"line":2,"column":7},"end":{"line":2,"column":8}}, "extra": { "rawValue": 1, "raw": "1" @@ -203,50 +68,17 @@ { "type": "CommentLine", "value": " comment", - "start": 47, - "end": 57, - "loc": { - "start": { - "line": 4, - "column": 4 - }, - "end": { - "line": 4, - "column": 14 - } - } + "start":47,"end":57,"loc":{"start":{"line":4,"column":4},"end":{"line":4,"column":14}} } ] }, { "type": "SwitchCase", - "start": 60, - "end": 79, - "loc": { - "start": { - "line": 5, - "column": 2 - }, - "end": { - "line": 6, - "column": 10 - } - }, + "start":60,"end":79,"loc":{"start":{"line":5,"column":2},"end":{"line":6,"column":10}}, "consequent": [ { "type": "BreakStatement", - "start": 73, - "end": 79, - "loc": { - "start": { - "line": 6, - "column": 4 - }, - "end": { - "line": 6, - "column": 10 - } - }, + "start":73,"end":79,"loc":{"start":{"line":6,"column":4},"end":{"line":6,"column":10}}, "label": null } ], @@ -255,18 +87,7 @@ { "type": "CommentLine", "value": " comment", - "start": 47, - "end": 57, - "loc": { - "start": { - "line": 4, - "column": 4 - }, - "end": { - "line": 4, - "column": 14 - } - } + "start":47,"end":57,"loc":{"start":{"line":4,"column":4},"end":{"line":4,"column":14}} } ] } @@ -279,18 +100,7 @@ { "type": "CommentLine", "value": " comment", - "start": 47, - "end": 57, - "loc": { - "start": { - "line": 4, - "column": 4 - }, - "end": { - "line": 4, - "column": 14 - } - } + "start":47,"end":57,"loc":{"start":{"line":4,"column":4},"end":{"line":4,"column":14}} } ] } \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/comments/basic/switch-no-default-comment-in-function/output.json b/packages/babel-parser/test/fixtures/comments/basic/switch-no-default-comment-in-function/output.json index dded99c82fa6..cab3b14128eb 100644 --- a/packages/babel-parser/test/fixtures/comments/basic/switch-no-default-comment-in-function/output.json +++ b/packages/babel-parser/test/fixtures/comments/basic/switch-no-default-comment-in-function/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 133, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 9, - "column": 1 - } - }, + "start":0,"end":133,"loc":{"start":{"line":1,"column":0},"end":{"line":9,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 133, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 9, - "column": 1 - } - }, + "start":0,"end":133,"loc":{"start":{"line":1,"column":0},"end":{"line":9,"column":1}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 133, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 9, - "column": 1 - } - }, + "start":0,"end":133,"loc":{"start":{"line":1,"column":0},"end":{"line":9,"column":1}}, "id": { "type": "Identifier", - "start": 9, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "bar" - }, + "start":9,"end":12,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":12},"identifierName":"bar"}, "name": "bar" }, "generator": false, @@ -65,115 +20,36 @@ "params": [ { "type": "Identifier", - "start": 13, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - }, - "identifierName": "a" - }, + "start":13,"end":14,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":14},"identifierName":"a"}, "name": "a" } ], "body": { "type": "BlockStatement", - "start": 16, - "end": 133, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 9, - "column": 1 - } - }, + "start":16,"end":133,"loc":{"start":{"line":1,"column":16},"end":{"line":9,"column":1}}, "body": [ { "type": "SwitchStatement", - "start": 22, - "end": 131, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 8, - "column": 5 - } - }, + "start":22,"end":131,"loc":{"start":{"line":2,"column":4},"end":{"line":8,"column":5}}, "discriminant": { "type": "Identifier", - "start": 30, - "end": 31, - "loc": { - "start": { - "line": 2, - "column": 12 - }, - "end": { - "line": 2, - "column": 13 - }, - "identifierName": "a" - }, + "start":30,"end":31,"loc":{"start":{"line":2,"column":12},"end":{"line":2,"column":13},"identifierName":"a"}, "name": "a" }, "cases": [ { "type": "SwitchCase", - "start": 43, - "end": 69, - "loc": { - "start": { - "line": 3, - "column": 8 - }, - "end": { - "line": 4, - "column": 18 - } - }, + "start":43,"end":69,"loc":{"start":{"line":3,"column":8},"end":{"line":4,"column":18}}, "consequent": [ { "type": "BreakStatement", - "start": 63, - "end": 69, - "loc": { - "start": { - "line": 4, - "column": 12 - }, - "end": { - "line": 4, - "column": 18 - } - }, + "start":63,"end":69,"loc":{"start":{"line":4,"column":12},"end":{"line":4,"column":18}}, "label": null } ], "test": { "type": "NumericLiteral", - "start": 48, - "end": 49, - "loc": { - "start": { - "line": 3, - "column": 13 - }, - "end": { - "line": 3, - "column": 14 - } - }, + "start":48,"end":49,"loc":{"start":{"line":3,"column":13},"end":{"line":3,"column":14}}, "extra": { "rawValue": 2, "raw": "2" @@ -183,50 +59,17 @@ }, { "type": "SwitchCase", - "start": 78, - "end": 104, - "loc": { - "start": { - "line": 5, - "column": 8 - }, - "end": { - "line": 6, - "column": 18 - } - }, + "start":78,"end":104,"loc":{"start":{"line":5,"column":8},"end":{"line":6,"column":18}}, "consequent": [ { "type": "BreakStatement", - "start": 98, - "end": 104, - "loc": { - "start": { - "line": 6, - "column": 12 - }, - "end": { - "line": 6, - "column": 18 - } - }, + "start":98,"end":104,"loc":{"start":{"line":6,"column":12},"end":{"line":6,"column":18}}, "label": null } ], "test": { "type": "NumericLiteral", - "start": 83, - "end": 84, - "loc": { - "start": { - "line": 5, - "column": 13 - }, - "end": { - "line": 5, - "column": 14 - } - }, + "start":83,"end":84,"loc":{"start":{"line":5,"column":13},"end":{"line":5,"column":14}}, "extra": { "rawValue": 1, "raw": "1" @@ -237,18 +80,7 @@ { "type": "CommentLine", "value": "no default", - "start": 113, - "end": 125, - "loc": { - "start": { - "line": 7, - "column": 8 - }, - "end": { - "line": 7, - "column": 20 - } - } + "start":113,"end":125,"loc":{"start":{"line":7,"column":8},"end":{"line":7,"column":20}} } ] } @@ -265,18 +97,7 @@ { "type": "CommentLine", "value": "no default", - "start": 113, - "end": 125, - "loc": { - "start": { - "line": 7, - "column": 8 - }, - "end": { - "line": 7, - "column": 20 - } - } + "start":113,"end":125,"loc":{"start":{"line":7,"column":8},"end":{"line":7,"column":20}} } ] } \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/comments/basic/switch-no-default-comment-in-nested-functions/output.json b/packages/babel-parser/test/fixtures/comments/basic/switch-no-default-comment-in-nested-functions/output.json index 926146f69d85..3255fbd32dcd 100644 --- a/packages/babel-parser/test/fixtures/comments/basic/switch-no-default-comment-in-nested-functions/output.json +++ b/packages/babel-parser/test/fixtures/comments/basic/switch-no-default-comment-in-nested-functions/output.json @@ -1,193 +1,57 @@ { "type": "File", - "start": 0, - "end": 296, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 13, - "column": 2 - } - }, + "start":0,"end":296,"loc":{"start":{"line":1,"column":0},"end":{"line":13,"column":2}}, "program": { "type": "Program", - "start": 0, - "end": 296, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 13, - "column": 2 - } - }, + "start":0,"end":296,"loc":{"start":{"line":1,"column":0},"end":{"line":13,"column":2}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 296, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 13, - "column": 2 - } - }, + "start":0,"end":296,"loc":{"start":{"line":1,"column":0},"end":{"line":13,"column":2}}, "expression": { "type": "AssignmentExpression", - "start": 0, - "end": 295, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 13, - "column": 1 - } - }, + "start":0,"end":295,"loc":{"start":{"line":1,"column":0},"end":{"line":13,"column":1}}, "operator": "=", "left": { "type": "MemberExpression", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "object": { "type": "Identifier", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "module" - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6},"identifierName":"module"}, "name": "module" }, "property": { "type": "Identifier", - "start": 7, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 14 - }, - "identifierName": "exports" - }, + "start":7,"end":14,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":14},"identifierName":"exports"}, "name": "exports" }, "computed": false }, "right": { "type": "FunctionExpression", - "start": 17, - "end": 295, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 13, - "column": 1 - } - }, + "start":17,"end":295,"loc":{"start":{"line":1,"column":17},"end":{"line":13,"column":1}}, "id": null, "generator": false, "async": false, "params": [ { "type": "Identifier", - "start": 26, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 33 - }, - "identifierName": "context" - }, + "start":26,"end":33,"loc":{"start":{"line":1,"column":26},"end":{"line":1,"column":33},"identifierName":"context"}, "name": "context" } ], "body": { "type": "BlockStatement", - "start": 35, - "end": 295, - "loc": { - "start": { - "line": 1, - "column": 35 - }, - "end": { - "line": 13, - "column": 1 - } - }, + "start":35,"end":295,"loc":{"start":{"line":1,"column":35},"end":{"line":13,"column":1}}, "body": [ { "type": "FunctionDeclaration", - "start": 42, - "end": 292, - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 11, - "column": 5 - } - }, + "start":42,"end":292,"loc":{"start":{"line":3,"column":4},"end":{"line":11,"column":5}}, "id": { "type": "Identifier", - "start": 51, - "end": 61, - "loc": { - "start": { - "line": 3, - "column": 13 - }, - "end": { - "line": 3, - "column": 23 - }, - "identifierName": "isConstant" - }, + "start":51,"end":61,"loc":{"start":{"line":3,"column":13},"end":{"line":3,"column":23},"identifierName":"isConstant"}, "name": "isConstant" }, "generator": false, @@ -195,97 +59,28 @@ "params": [ { "type": "Identifier", - "start": 62, - "end": 66, - "loc": { - "start": { - "line": 3, - "column": 24 - }, - "end": { - "line": 3, - "column": 28 - }, - "identifierName": "node" - }, + "start":62,"end":66,"loc":{"start":{"line":3,"column":24},"end":{"line":3,"column":28},"identifierName":"node"}, "name": "node" } ], "body": { "type": "BlockStatement", - "start": 68, - "end": 292, - "loc": { - "start": { - "line": 3, - "column": 30 - }, - "end": { - "line": 11, - "column": 5 - } - }, + "start":68,"end":292,"loc":{"start":{"line":3,"column":30},"end":{"line":11,"column":5}}, "body": [ { "type": "SwitchStatement", - "start": 78, - "end": 255, - "loc": { - "start": { - "line": 4, - "column": 8 - }, - "end": { - "line": 8, - "column": 9 - } - }, + "start":78,"end":255,"loc":{"start":{"line":4,"column":8},"end":{"line":8,"column":9}}, "discriminant": { "type": "MemberExpression", - "start": 86, - "end": 95, - "loc": { - "start": { - "line": 4, - "column": 16 - }, - "end": { - "line": 4, - "column": 25 - } - }, + "start":86,"end":95,"loc":{"start":{"line":4,"column":16},"end":{"line":4,"column":25}}, "object": { "type": "Identifier", - "start": 86, - "end": 90, - "loc": { - "start": { - "line": 4, - "column": 16 - }, - "end": { - "line": 4, - "column": 20 - }, - "identifierName": "node" - }, + "start":86,"end":90,"loc":{"start":{"line":4,"column":16},"end":{"line":4,"column":20},"identifierName":"node"}, "name": "node" }, "property": { "type": "Identifier", - "start": 91, - "end": 95, - "loc": { - "start": { - "line": 4, - "column": 21 - }, - "end": { - "line": 4, - "column": 25 - }, - "identifierName": "type" - }, + "start":91,"end":95,"loc":{"start":{"line":4,"column":21},"end":{"line":4,"column":25},"identifierName":"type"}, "name": "type" }, "computed": false @@ -293,222 +88,62 @@ "cases": [ { "type": "SwitchCase", - "start": 111, - "end": 219, - "loc": { - "start": { - "line": 5, - "column": 12 - }, - "end": { - "line": 6, - "column": 81 - } - }, + "start":111,"end":219,"loc":{"start":{"line":5,"column":12},"end":{"line":6,"column":81}}, "consequent": [ { "type": "ReturnStatement", - "start": 154, - "end": 219, - "loc": { - "start": { - "line": 6, - "column": 16 - }, - "end": { - "line": 6, - "column": 81 - } - }, + "start":154,"end":219,"loc":{"start":{"line":6,"column":16},"end":{"line":6,"column":81}}, "argument": { "type": "CallExpression", - "start": 161, - "end": 218, - "loc": { - "start": { - "line": 6, - "column": 23 - }, - "end": { - "line": 6, - "column": 80 - } - }, + "start":161,"end":218,"loc":{"start":{"line":6,"column":23},"end":{"line":6,"column":80}}, "callee": { "type": "Identifier", - "start": 161, - "end": 171, - "loc": { - "start": { - "line": 6, - "column": 23 - }, - "end": { - "line": 6, - "column": 33 - }, - "identifierName": "isConstant" - }, + "start":161,"end":171,"loc":{"start":{"line":6,"column":23},"end":{"line":6,"column":33},"identifierName":"isConstant"}, "name": "isConstant" }, "arguments": [ { "type": "MemberExpression", - "start": 172, - "end": 217, - "loc": { - "start": { - "line": 6, - "column": 34 - }, - "end": { - "line": 6, - "column": 79 - } - }, + "start":172,"end":217,"loc":{"start":{"line":6,"column":34},"end":{"line":6,"column":79}}, "object": { "type": "MemberExpression", - "start": 172, - "end": 188, - "loc": { - "start": { - "line": 6, - "column": 34 - }, - "end": { - "line": 6, - "column": 50 - } - }, + "start":172,"end":188,"loc":{"start":{"line":6,"column":34},"end":{"line":6,"column":50}}, "object": { "type": "Identifier", - "start": 172, - "end": 176, - "loc": { - "start": { - "line": 6, - "column": 34 - }, - "end": { - "line": 6, - "column": 38 - }, - "identifierName": "node" - }, + "start":172,"end":176,"loc":{"start":{"line":6,"column":34},"end":{"line":6,"column":38},"identifierName":"node"}, "name": "node" }, "property": { "type": "Identifier", - "start": 177, - "end": 188, - "loc": { - "start": { - "line": 6, - "column": 39 - }, - "end": { - "line": 6, - "column": 50 - }, - "identifierName": "expressions" - }, + "start":177,"end":188,"loc":{"start":{"line":6,"column":39},"end":{"line":6,"column":50},"identifierName":"expressions"}, "name": "expressions" }, "computed": false }, "property": { "type": "BinaryExpression", - "start": 189, - "end": 216, - "loc": { - "start": { - "line": 6, - "column": 51 - }, - "end": { - "line": 6, - "column": 78 - } - }, + "start":189,"end":216,"loc":{"start":{"line":6,"column":51},"end":{"line":6,"column":78}}, "left": { "type": "MemberExpression", - "start": 189, - "end": 212, - "loc": { - "start": { - "line": 6, - "column": 51 - }, - "end": { - "line": 6, - "column": 74 - } - }, + "start":189,"end":212,"loc":{"start":{"line":6,"column":51},"end":{"line":6,"column":74}}, "object": { "type": "MemberExpression", - "start": 189, - "end": 205, - "loc": { - "start": { - "line": 6, - "column": 51 - }, - "end": { - "line": 6, - "column": 67 - } - }, + "start":189,"end":205,"loc":{"start":{"line":6,"column":51},"end":{"line":6,"column":67}}, "object": { "type": "Identifier", - "start": 189, - "end": 193, - "loc": { - "start": { - "line": 6, - "column": 51 - }, - "end": { - "line": 6, - "column": 55 - }, - "identifierName": "node" - }, + "start":189,"end":193,"loc":{"start":{"line":6,"column":51},"end":{"line":6,"column":55},"identifierName":"node"}, "name": "node" }, "property": { "type": "Identifier", - "start": 194, - "end": 205, - "loc": { - "start": { - "line": 6, - "column": 56 - }, - "end": { - "line": 6, - "column": 67 - }, - "identifierName": "expressions" - }, + "start":194,"end":205,"loc":{"start":{"line":6,"column":56},"end":{"line":6,"column":67},"identifierName":"expressions"}, "name": "expressions" }, "computed": false }, "property": { "type": "Identifier", - "start": 206, - "end": 212, - "loc": { - "start": { - "line": 6, - "column": 68 - }, - "end": { - "line": 6, - "column": 74 - }, - "identifierName": "length" - }, + "start":206,"end":212,"loc":{"start":{"line":6,"column":68},"end":{"line":6,"column":74},"identifierName":"length"}, "name": "length" }, "computed": false @@ -516,18 +151,7 @@ "operator": "-", "right": { "type": "NumericLiteral", - "start": 215, - "end": 216, - "loc": { - "start": { - "line": 6, - "column": 77 - }, - "end": { - "line": 6, - "column": 78 - } - }, + "start":215,"end":216,"loc":{"start":{"line":6,"column":77},"end":{"line":6,"column":78}}, "extra": { "rawValue": 1, "raw": "1" @@ -543,18 +167,7 @@ ], "test": { "type": "StringLiteral", - "start": 116, - "end": 136, - "loc": { - "start": { - "line": 5, - "column": 17 - }, - "end": { - "line": 5, - "column": 37 - } - }, + "start":116,"end":136,"loc":{"start":{"line":5,"column":17},"end":{"line":5,"column":37}}, "extra": { "rawValue": "SequenceExpression", "raw": "\"SequenceExpression\"" @@ -565,18 +178,7 @@ { "type": "CommentLine", "value": " no default", - "start": 232, - "end": 245, - "loc": { - "start": { - "line": 7, - "column": 12 - }, - "end": { - "line": 7, - "column": 25 - } - } + "start":232,"end":245,"loc":{"start":{"line":7,"column":12},"end":{"line":7,"column":25}} } ] } @@ -584,32 +186,10 @@ }, { "type": "ReturnStatement", - "start": 273, - "end": 286, - "loc": { - "start": { - "line": 10, - "column": 8 - }, - "end": { - "line": 10, - "column": 21 - } - }, + "start":273,"end":286,"loc":{"start":{"line":10,"column":8},"end":{"line":10,"column":21}}, "argument": { "type": "BooleanLiteral", - "start": 280, - "end": 285, - "loc": { - "start": { - "line": 10, - "column": 15 - }, - "end": { - "line": 10, - "column": 20 - } - }, + "start":280,"end":285,"loc":{"start":{"line":10,"column":15},"end":{"line":10,"column":20}}, "value": false } } @@ -630,18 +210,7 @@ { "type": "CommentLine", "value": " no default", - "start": 232, - "end": 245, - "loc": { - "start": { - "line": 7, - "column": 12 - }, - "end": { - "line": 7, - "column": 25 - } - } + "start":232,"end":245,"loc":{"start":{"line":7,"column":12},"end":{"line":7,"column":25}} } ] } \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/comments/basic/switch-no-default-comment/output.json b/packages/babel-parser/test/fixtures/comments/basic/switch-no-default-comment/output.json index 5a8fc7b6fa1c..7e06280b4919 100644 --- a/packages/babel-parser/test/fixtures/comments/basic/switch-no-default-comment/output.json +++ b/packages/babel-parser/test/fixtures/comments/basic/switch-no-default-comment/output.json @@ -1,112 +1,34 @@ { "type": "File", - "start": 0, - "end": 58, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 1 - } - }, + "start":0,"end":58,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 58, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 1 - } - }, + "start":0,"end":58,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "SwitchStatement", - "start": 0, - "end": 58, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 1 - } - }, + "start":0,"end":58,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, "discriminant": { "type": "Identifier", - "start": 8, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "a" - }, + "start":8,"end":9,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":9},"identifierName":"a"}, "name": "a" }, "cases": [ { "type": "SwitchCase", - "start": 17, - "end": 39, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 3, - "column": 14 - } - }, + "start":17,"end":39,"loc":{"start":{"line":2,"column":4},"end":{"line":3,"column":14}}, "consequent": [ { "type": "BreakStatement", - "start": 33, - "end": 39, - "loc": { - "start": { - "line": 3, - "column": 8 - }, - "end": { - "line": 3, - "column": 14 - } - }, + "start":33,"end":39,"loc":{"start":{"line":3,"column":8},"end":{"line":3,"column":14}}, "label": null } ], "test": { "type": "NumericLiteral", - "start": 22, - "end": 23, - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 10 - } - }, + "start":22,"end":23,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":10}}, "extra": { "rawValue": 1, "raw": "1" @@ -117,18 +39,7 @@ { "type": "CommentLine", "value": "no default", - "start": 44, - "end": 56, - "loc": { - "start": { - "line": 4, - "column": 4 - }, - "end": { - "line": 4, - "column": 16 - } - } + "start":44,"end":56,"loc":{"start":{"line":4,"column":4},"end":{"line":4,"column":16}} } ] } @@ -141,18 +52,7 @@ { "type": "CommentLine", "value": "no default", - "start": 44, - "end": 56, - "loc": { - "start": { - "line": 4, - "column": 4 - }, - "end": { - "line": 4, - "column": 16 - } - } + "start":44,"end":56,"loc":{"start":{"line":4,"column":4},"end":{"line":4,"column":16}} } ] } \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/comments/html/first-line/output.json b/packages/babel-parser/test/fixtures/comments/html/first-line/output.json index d42874927c64..521b8cf49c20 100644 --- a/packages/babel-parser/test/fixtures/comments/html/first-line/output.json +++ b/packages/babel-parser/test/fixtures/comments/html/first-line/output.json @@ -1,31 +1,9 @@ { "type": "File", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "program": { "type": "Program", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "sourceType": "script", "interpreter": null, "body": [], @@ -34,34 +12,12 @@ { "type": "CommentBlock", "value": "", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - } + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}} }, { "type": "CommentLine", "value": " comment", - "start": 5, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 16 - } - } + "start":5,"end":16,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":16}} } ] }, @@ -69,34 +25,12 @@ { "type": "CommentBlock", "value": "", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - } + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}} }, { "type": "CommentLine", "value": " comment", - "start": 5, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 16 - } - } + "start":5,"end":16,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":16}} } ] } \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/comments/interpreter-directive/interpreter-directive-import/output.json b/packages/babel-parser/test/fixtures/comments/interpreter-directive/interpreter-directive-import/output.json index 2967587b808d..722c14c6842e 100644 --- a/packages/babel-parser/test/fixtures/comments/interpreter-directive/interpreter-directive-import/output.json +++ b/packages/babel-parser/test/fixtures/comments/interpreter-directive/interpreter-directive-import/output.json @@ -1,128 +1,38 @@ { "type": "File", - "start": 0, - "end": 56, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 29 - } - }, + "start":0,"end":56,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":29}}, "program": { "type": "Program", - "start": 0, - "end": 56, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 29 - } - }, + "start":0,"end":56,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":29}}, "sourceType": "module", "interpreter": { "type": "InterpreterDirective", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, "value": "/usr/bin/env babel-node" }, "body": [ { "type": "ImportDeclaration", - "start": 27, - "end": 56, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 29 - } - }, + "start":27,"end":56,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":29}}, "specifiers": [ { "type": "ImportSpecifier", - "start": 35, - "end": 40, - "loc": { - "start": { - "line": 3, - "column": 8 - }, - "end": { - "line": 3, - "column": 13 - } - }, + "start":35,"end":40,"loc":{"start":{"line":3,"column":8},"end":{"line":3,"column":13}}, "imported": { "type": "Identifier", - "start": 35, - "end": 40, - "loc": { - "start": { - "line": 3, - "column": 8 - }, - "end": { - "line": 3, - "column": 13 - }, - "identifierName": "spawn" - }, + "start":35,"end":40,"loc":{"start":{"line":3,"column":8},"end":{"line":3,"column":13},"identifierName":"spawn"}, "name": "spawn" }, "local": { "type": "Identifier", - "start": 35, - "end": 40, - "loc": { - "start": { - "line": 3, - "column": 8 - }, - "end": { - "line": 3, - "column": 13 - }, - "identifierName": "spawn" - }, + "start":35,"end":40,"loc":{"start":{"line":3,"column":8},"end":{"line":3,"column":13},"identifierName":"spawn"}, "name": "spawn" } } ], "source": { "type": "StringLiteral", - "start": 47, - "end": 55, - "loc": { - "start": { - "line": 3, - "column": 20 - }, - "end": { - "line": 3, - "column": 28 - } - }, + "start":47,"end":55,"loc":{"start":{"line":3,"column":20},"end":{"line":3,"column":28}}, "extra": { "rawValue": "foobar", "raw": "'foobar'" diff --git a/packages/babel-parser/test/fixtures/comments/interpreter-directive/interpreter-directive-object/output.json b/packages/babel-parser/test/fixtures/comments/interpreter-directive/interpreter-directive-object/output.json index 43dd91cf3103..2a5e1faa5565 100644 --- a/packages/babel-parser/test/fixtures/comments/interpreter-directive/interpreter-directive-object/output.json +++ b/packages/babel-parser/test/fixtures/comments/interpreter-directive/interpreter-directive-object/output.json @@ -1,142 +1,41 @@ { "type": "File", - "start": 0, - "end": 45, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 18 - } - }, + "start":0,"end":45,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":18}}, "program": { "type": "Program", - "start": 0, - "end": 45, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 18 - } - }, + "start":0,"end":45,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":18}}, "sourceType": "script", "interpreter": { "type": "InterpreterDirective", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, "value": "/usr/bin/env babel-node" }, "body": [ { "type": "VariableDeclaration", - "start": 27, - "end": 45, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 18 - } - }, + "start":27,"end":45,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":18}}, "declarations": [ { "type": "VariableDeclarator", - "start": 31, - "end": 44, - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 17 - } - }, + "start":31,"end":44,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":17}}, "id": { "type": "ObjectPattern", - "start": 31, - "end": 40, - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 13 - } - }, + "start":31,"end":40,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":13}}, "properties": [ { "type": "ObjectProperty", - "start": 33, - "end": 38, - "loc": { - "start": { - "line": 3, - "column": 6 - }, - "end": { - "line": 3, - "column": 11 - } - }, + "start":33,"end":38,"loc":{"start":{"line":3,"column":6},"end":{"line":3,"column":11}}, "method": false, "key": { "type": "Identifier", - "start": 33, - "end": 38, - "loc": { - "start": { - "line": 3, - "column": 6 - }, - "end": { - "line": 3, - "column": 11 - }, - "identifierName": "spawn" - }, + "start":33,"end":38,"loc":{"start":{"line":3,"column":6},"end":{"line":3,"column":11},"identifierName":"spawn"}, "name": "spawn" }, "computed": false, "shorthand": true, "value": { "type": "Identifier", - "start": 33, - "end": 38, - "loc": { - "start": { - "line": 3, - "column": 6 - }, - "end": { - "line": 3, - "column": 11 - }, - "identifierName": "spawn" - }, + "start":33,"end":38,"loc":{"start":{"line":3,"column":6},"end":{"line":3,"column":11},"identifierName":"spawn"}, "name": "spawn" }, "extra": { @@ -147,19 +46,7 @@ }, "init": { "type": "Identifier", - "start": 43, - "end": 44, - "loc": { - "start": { - "line": 3, - "column": 16 - }, - "end": { - "line": 3, - "column": 17 - }, - "identifierName": "x" - }, + "start":43,"end":44,"loc":{"start":{"line":3,"column":16},"end":{"line":3,"column":17},"identifierName":"x"}, "name": "x" } } diff --git a/packages/babel-parser/test/fixtures/comments/regression/10230/input.js b/packages/babel-parser/test/fixtures/comments/regression/10230/input.js new file mode 100644 index 000000000000..131dbd7a00f7 --- /dev/null +++ b/packages/babel-parser/test/fixtures/comments/regression/10230/input.js @@ -0,0 +1,7 @@ +A = { + a: 42, + // One +} + +// Two +B diff --git a/packages/babel-parser/test/fixtures/comments/regression/10230/output.json b/packages/babel-parser/test/fixtures/comments/regression/10230/output.json new file mode 100644 index 000000000000..91107fa6e82e --- /dev/null +++ b/packages/babel-parser/test/fixtures/comments/regression/10230/output.json @@ -0,0 +1,99 @@ +{ + "type": "File", + "start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":7,"column":1}}, + "program": { + "type": "Program", + "start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":7,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "expression": { + "type": "AssignmentExpression", + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "operator": "=", + "left": { + "type": "Identifier", + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"A"}, + "name": "A" + }, + "right": { + "type": "ObjectExpression", + "start":4,"end":25,"loc":{"start":{"line":1,"column":4},"end":{"line":4,"column":1}}, + "properties": [ + { + "type": "ObjectProperty", + "start":8,"end":13,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":7}}, + "method": false, + "key": { + "type": "Identifier", + "start":8,"end":9,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":3},"identifierName":"a"}, + "name": "a" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "NumericLiteral", + "start":11,"end":13,"loc":{"start":{"line":2,"column":5},"end":{"line":2,"column":7}}, + "extra": { + "rawValue": 42, + "raw": "42" + }, + "value": 42 + }, + "trailingComments": [ + { + "type": "CommentLine", + "value": " One", + "start":17,"end":23,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":8}} + } + ] + } + ], + "extra": { + "trailingComma": 13 + } + } + }, + "trailingComments": [ + { + "type": "CommentLine", + "value": " Two", + "start":27,"end":33,"loc":{"start":{"line":6,"column":0},"end":{"line":6,"column":6}} + } + ] + }, + { + "type": "ExpressionStatement", + "start":34,"end":35,"loc":{"start":{"line":7,"column":0},"end":{"line":7,"column":1}}, + "expression": { + "type": "Identifier", + "start":34,"end":35,"loc":{"start":{"line":7,"column":0},"end":{"line":7,"column":1},"identifierName":"B"}, + "name": "B" + }, + "leadingComments": [ + { + "type": "CommentLine", + "value": " Two", + "start":27,"end":33,"loc":{"start":{"line":6,"column":0},"end":{"line":6,"column":6}} + } + ] + } + ], + "directives": [] + }, + "comments": [ + { + "type": "CommentLine", + "value": " One", + "start":17,"end":23,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":8}} + }, + { + "type": "CommentLine", + "value": " Two", + "start":27,"end":33,"loc":{"start":{"line":6,"column":0},"end":{"line":6,"column":6}} + } + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/comments/regression/10432/input.js b/packages/babel-parser/test/fixtures/comments/regression/10432/input.js new file mode 100644 index 000000000000..645dc4cde990 --- /dev/null +++ b/packages/babel-parser/test/fixtures/comments/regression/10432/input.js @@ -0,0 +1,5 @@ +const socket = socketClient(address) +/* istanbul ignore next */ +socket.on('connect', function () { + debug('Connected to ' + address) +}) diff --git a/packages/babel-parser/test/fixtures/comments/regression/10432/output.json b/packages/babel-parser/test/fixtures/comments/regression/10432/output.json new file mode 100644 index 000000000000..c0e2eb4b67c0 --- /dev/null +++ b/packages/babel-parser/test/fixtures/comments/regression/10432/output.json @@ -0,0 +1,149 @@ +{ + "type": "File", + "start":0,"end":136,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":2}}, + "program": { + "type": "Program", + "start":0,"end":136,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":2}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":6,"end":36,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":36}}, + "id": { + "type": "Identifier", + "start":6,"end":12,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":12},"identifierName":"socket"}, + "name": "socket" + }, + "init": { + "type": "CallExpression", + "start":15,"end":36,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":36}}, + "callee": { + "type": "Identifier", + "start":15,"end":27,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":27},"identifierName":"socketClient"}, + "name": "socketClient" + }, + "arguments": [ + { + "type": "Identifier", + "start":28,"end":35,"loc":{"start":{"line":1,"column":28},"end":{"line":1,"column":35},"identifierName":"address"}, + "name": "address" + } + ] + } + } + ], + "kind": "const", + "trailingComments": [ + { + "type": "CommentBlock", + "value": " istanbul ignore next ", + "start":37,"end":63,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":26}} + } + ] + }, + { + "type": "ExpressionStatement", + "start":64,"end":136,"loc":{"start":{"line":3,"column":0},"end":{"line":5,"column":2}}, + "expression": { + "type": "CallExpression", + "start":64,"end":136,"loc":{"start":{"line":3,"column":0},"end":{"line":5,"column":2}}, + "callee": { + "type": "MemberExpression", + "start":64,"end":73,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":9}}, + "object": { + "type": "Identifier", + "start":64,"end":70,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":6},"identifierName":"socket"}, + "name": "socket" + }, + "property": { + "type": "Identifier", + "start":71,"end":73,"loc":{"start":{"line":3,"column":7},"end":{"line":3,"column":9},"identifierName":"on"}, + "name": "on" + }, + "computed": false + }, + "arguments": [ + { + "type": "StringLiteral", + "start":74,"end":83,"loc":{"start":{"line":3,"column":10},"end":{"line":3,"column":19}}, + "extra": { + "rawValue": "connect", + "raw": "'connect'" + }, + "value": "connect" + }, + { + "type": "FunctionExpression", + "start":85,"end":135,"loc":{"start":{"line":3,"column":21},"end":{"line":5,"column":1}}, + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":97,"end":135,"loc":{"start":{"line":3,"column":33},"end":{"line":5,"column":1}}, + "body": [ + { + "type": "ExpressionStatement", + "start":101,"end":133,"loc":{"start":{"line":4,"column":2},"end":{"line":4,"column":34}}, + "expression": { + "type": "CallExpression", + "start":101,"end":133,"loc":{"start":{"line":4,"column":2},"end":{"line":4,"column":34}}, + "callee": { + "type": "Identifier", + "start":101,"end":106,"loc":{"start":{"line":4,"column":2},"end":{"line":4,"column":7},"identifierName":"debug"}, + "name": "debug" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start":107,"end":132,"loc":{"start":{"line":4,"column":8},"end":{"line":4,"column":33}}, + "left": { + "type": "StringLiteral", + "start":107,"end":122,"loc":{"start":{"line":4,"column":8},"end":{"line":4,"column":23}}, + "extra": { + "rawValue": "Connected to ", + "raw": "'Connected to '" + }, + "value": "Connected to " + }, + "operator": "+", + "right": { + "type": "Identifier", + "start":125,"end":132,"loc":{"start":{"line":4,"column":26},"end":{"line":4,"column":33},"identifierName":"address"}, + "name": "address" + } + } + ] + } + } + ], + "directives": [] + } + } + ] + }, + "leadingComments": [ + { + "type": "CommentBlock", + "value": " istanbul ignore next ", + "start":37,"end":63,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":26}} + } + ] + } + ], + "directives": [] + }, + "comments": [ + { + "type": "CommentBlock", + "value": " istanbul ignore next ", + "start":37,"end":63,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":26}} + } + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/comments/regression/10448/input.js b/packages/babel-parser/test/fixtures/comments/regression/10448/input.js new file mode 100644 index 000000000000..c0bd1ccbc1cc --- /dev/null +++ b/packages/babel-parser/test/fixtures/comments/regression/10448/input.js @@ -0,0 +1,2 @@ +function foo([foo, /* not used */, /* not used */]) { +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/comments/regression/10448/output.json b/packages/babel-parser/test/fixtures/comments/regression/10448/output.json new file mode 100644 index 000000000000..69a7bde87a4c --- /dev/null +++ b/packages/babel-parser/test/fixtures/comments/regression/10448/output.json @@ -0,0 +1,68 @@ +{ + "type": "File", + "start":0,"end":55,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":1}}, + "program": { + "type": "Program", + "start":0,"end":55,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":55,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":1}}, + "id": { + "type": "Identifier", + "start":9,"end":12,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":12},"identifierName":"foo"}, + "name": "foo" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "ArrayPattern", + "start":13,"end":50,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":50}}, + "elements": [ + { + "type": "Identifier", + "start":14,"end":17,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":17},"identifierName":"foo"}, + "name": "foo", + "trailingComments": [ + { + "type": "CommentBlock", + "value": " not used ", + "start":19,"end":33,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":33}} + }, + { + "type": "CommentBlock", + "value": " not used ", + "start":35,"end":49,"loc":{"start":{"line":1,"column":35},"end":{"line":1,"column":49}} + } + ] + }, + null + ] + } + ], + "body": { + "type": "BlockStatement", + "start":52,"end":55,"loc":{"start":{"line":1,"column":52},"end":{"line":2,"column":1}}, + "body": [], + "directives": [] + } + } + ], + "directives": [] + }, + "comments": [ + { + "type": "CommentBlock", + "value": " not used ", + "start":19,"end":33,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":33}} + }, + { + "type": "CommentBlock", + "value": " not used ", + "start":35,"end":49,"loc":{"start":{"line":1,"column":35},"end":{"line":1,"column":49}} + } + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/comments/regression/10892/input.js b/packages/babel-parser/test/fixtures/comments/regression/10892/input.js new file mode 100644 index 000000000000..05a56ffa976c --- /dev/null +++ b/packages/babel-parser/test/fixtures/comments/regression/10892/input.js @@ -0,0 +1,7 @@ +import { foo } from "bar" + +/** + * lost comment + */ +export default { +} diff --git a/packages/babel-parser/test/fixtures/experimental/dynamic-import/parses-module/options.json b/packages/babel-parser/test/fixtures/comments/regression/10892/options.json similarity index 100% rename from packages/babel-parser/test/fixtures/experimental/dynamic-import/parses-module/options.json rename to packages/babel-parser/test/fixtures/comments/regression/10892/options.json diff --git a/packages/babel-parser/test/fixtures/comments/regression/10892/output.json b/packages/babel-parser/test/fixtures/comments/regression/10892/output.json new file mode 100644 index 000000000000..efa9a47df667 --- /dev/null +++ b/packages/babel-parser/test/fixtures/comments/regression/10892/output.json @@ -0,0 +1,72 @@ +{ + "type": "File", + "start":0,"end":69,"loc":{"start":{"line":1,"column":0},"end":{"line":7,"column":1}}, + "program": { + "type": "Program", + "start":0,"end":69,"loc":{"start":{"line":1,"column":0},"end":{"line":7,"column":1}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ImportDeclaration", + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, + "specifiers": [ + { + "type": "ImportSpecifier", + "start":9,"end":12,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":12}}, + "imported": { + "type": "Identifier", + "start":9,"end":12,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":12},"identifierName":"foo"}, + "name": "foo" + }, + "local": { + "type": "Identifier", + "start":9,"end":12,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":12},"identifierName":"foo"}, + "name": "foo" + } + } + ], + "source": { + "type": "StringLiteral", + "start":20,"end":25,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":25}}, + "extra": { + "rawValue": "bar", + "raw": "\"bar\"" + }, + "value": "bar" + }, + "trailingComments": [ + { + "type": "CommentBlock", + "value": "*\n * lost comment\n ", + "start":27,"end":50,"loc":{"start":{"line":3,"column":0},"end":{"line":5,"column":3}} + } + ] + }, + { + "type": "ExportDefaultDeclaration", + "start":51,"end":69,"loc":{"start":{"line":6,"column":0},"end":{"line":7,"column":1}}, + "declaration": { + "type": "ObjectExpression", + "start":66,"end":69,"loc":{"start":{"line":6,"column":15},"end":{"line":7,"column":1}}, + "properties": [] + }, + "leadingComments": [ + { + "type": "CommentBlock", + "value": "*\n * lost comment\n ", + "start":27,"end":50,"loc":{"start":{"line":3,"column":0},"end":{"line":5,"column":3}} + } + ] + } + ], + "directives": [] + }, + "comments": [ + { + "type": "CommentBlock", + "value": "*\n * lost comment\n ", + "start":27,"end":50,"loc":{"start":{"line":3,"column":0},"end":{"line":5,"column":3}} + } + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/categorized/01-regex/output.json b/packages/babel-parser/test/fixtures/core/categorized/01-regex/output.json index 7b20bc5bd4bb..f1ac27f9f2d2 100644 --- a/packages/babel-parser/test/fixtures/core/categorized/01-regex/output.json +++ b/packages/babel-parser/test/fixtures/core/categorized/01-regex/output.json @@ -1,137 +1,36 @@ { "type": "File", - "start": 0, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, "program": { "type": "Program", - "start": 0, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, "declarations": [ { "type": "VariableDeclarator", - "start": 6, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":6,"end":33,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":33}}, "id": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "x" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"x"}, "name": "x" }, "init": { "type": "BinaryExpression", - "start": 10, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":10,"end":33,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":33}}, "left": { "type": "BinaryExpression", - "start": 10, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":10,"end":31,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":31}}, "left": { "type": "FunctionExpression", - "start": 10, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":10,"end":27,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":27}}, "id": { "type": "Identifier", - "start": 19, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 22 - }, - "identifierName": "foo" - }, + "start":19,"end":22,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":22},"identifierName":"foo"}, "name": "foo" }, "generator": false, @@ -139,18 +38,7 @@ "params": [], "body": { "type": "BlockStatement", - "start": 25, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":25,"end":27,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":27}}, "body": [], "directives": [] } @@ -158,18 +46,7 @@ "operator": "/", "right": { "type": "NumericLiteral", - "start": 29, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":29,"end":31,"loc":{"start":{"line":1,"column":29},"end":{"line":1,"column":31}}, "extra": { "rawValue": 42, "raw": "42" @@ -180,19 +57,7 @@ "operator": "/", "right": { "type": "Identifier", - "start": 32, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 32 - }, - "end": { - "line": 1, - "column": 33 - }, - "identifierName": "i" - }, + "start":32,"end":33,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":33},"identifierName":"i"}, "name": "i" } } diff --git a/packages/babel-parser/test/fixtures/core/categorized/02-regex/output.json b/packages/babel-parser/test/fixtures/core/categorized/02-regex/output.json index 1a247a92573c..08d6fd2f0fa0 100644 --- a/packages/babel-parser/test/fixtures/core/categorized/02-regex/output.json +++ b/packages/babel-parser/test/fixtures/core/categorized/02-regex/output.json @@ -1,105 +1,27 @@ { "type": "File", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, "program": { "type": "Program", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, "expression": { "type": "BinaryExpression", - "start": 1, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":1,"end":24,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":24}}, "left": { "type": "BinaryExpression", - "start": 1, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":1,"end":22,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":22}}, "left": { "type": "FunctionExpression", - "start": 1, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":1,"end":18,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":18}}, "id": { "type": "Identifier", - "start": 10, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 13 - }, - "identifierName": "foo" - }, + "start":10,"end":13,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":13},"identifierName":"foo"}, "name": "foo" }, "generator": false, @@ -107,18 +29,7 @@ "params": [], "body": { "type": "BlockStatement", - "start": 16, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":16,"end":18,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":18}}, "body": [], "directives": [] } @@ -126,18 +37,7 @@ "operator": "/", "right": { "type": "NumericLiteral", - "start": 20, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":20,"end":22,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":22}}, "extra": { "rawValue": 42, "raw": "42" @@ -148,19 +48,7 @@ "operator": "/", "right": { "type": "Identifier", - "start": 23, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 24 - }, - "identifierName": "i" - }, + "start":23,"end":24,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":24},"identifierName":"i"}, "name": "i" }, "extra": { diff --git a/packages/babel-parser/test/fixtures/core/categorized/03-regex/output.json b/packages/babel-parser/test/fixtures/core/categorized/03-regex/output.json index cc036d7a803f..a8f8ff1f10d4 100644 --- a/packages/babel-parser/test/fixtures/core/categorized/03-regex/output.json +++ b/packages/babel-parser/test/fixtures/core/categorized/03-regex/output.json @@ -1,152 +1,41 @@ { "type": "File", - "start": 0, - "end": 49, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 2 - } - }, + "start":0,"end":49,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":2}}, "program": { "type": "Program", - "start": 0, - "end": 49, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 2 - } - }, + "start":0,"end":49,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":2}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 49, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 2 - } - }, + "start":0,"end":49,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":2}}, "expression": { "type": "FunctionExpression", - "start": 1, - "end": 48, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":1,"end":48,"loc":{"start":{"line":1,"column":1},"end":{"line":3,"column":1}}, "id": null, "generator": false, "async": false, "params": [], "body": { "type": "BlockStatement", - "start": 13, - "end": 48, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":13,"end":48,"loc":{"start":{"line":1,"column":13},"end":{"line":3,"column":1}}, "body": [ { "type": "ReturnStatement", - "start": 17, - "end": 46, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 31 - } - }, + "start":17,"end":46,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":31}}, "argument": { "type": "BinaryExpression", - "start": 24, - "end": 46, - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 31 - } - }, + "start":24,"end":46,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":31}}, "left": { "type": "BinaryExpression", - "start": 24, - "end": 44, - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 29 - } - }, + "start":24,"end":44,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":29}}, "left": { "type": "FunctionExpression", - "start": 24, - "end": 40, - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 25 - } - }, + "start":24,"end":40,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":25}}, "id": { "type": "Identifier", - "start": 33, - "end": 35, - "loc": { - "start": { - "line": 2, - "column": 18 - }, - "end": { - "line": 2, - "column": 20 - }, - "identifierName": "fn" - }, + "start":33,"end":35,"loc":{"start":{"line":2,"column":18},"end":{"line":2,"column":20},"identifierName":"fn"}, "name": "fn" }, "generator": false, @@ -154,18 +43,7 @@ "params": [], "body": { "type": "BlockStatement", - "start": 38, - "end": 40, - "loc": { - "start": { - "line": 2, - "column": 23 - }, - "end": { - "line": 2, - "column": 25 - } - }, + "start":38,"end":40,"loc":{"start":{"line":2,"column":23},"end":{"line":2,"column":25}}, "body": [], "directives": [] } @@ -173,18 +51,7 @@ "operator": "/", "right": { "type": "NumericLiteral", - "start": 42, - "end": 44, - "loc": { - "start": { - "line": 2, - "column": 27 - }, - "end": { - "line": 2, - "column": 29 - } - }, + "start":42,"end":44,"loc":{"start":{"line":2,"column":27},"end":{"line":2,"column":29}}, "extra": { "rawValue": 42, "raw": "42" @@ -195,19 +62,7 @@ "operator": "/", "right": { "type": "Identifier", - "start": 45, - "end": 46, - "loc": { - "start": { - "line": 2, - "column": 30 - }, - "end": { - "line": 2, - "column": 31 - }, - "identifierName": "i" - }, + "start":45,"end":46,"loc":{"start":{"line":2,"column":30},"end":{"line":2,"column":31},"identifierName":"i"}, "name": "i" } } diff --git a/packages/babel-parser/test/fixtures/core/categorized/04-regex/output.json b/packages/babel-parser/test/fixtures/core/categorized/04-regex/output.json index f8ffa275c878..b45e3336f48a 100644 --- a/packages/babel-parser/test/fixtures/core/categorized/04-regex/output.json +++ b/packages/babel-parser/test/fixtures/core/categorized/04-regex/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 54, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 1 - } - }, + "start":0,"end":54,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 54, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 1 - } - }, + "start":0,"end":54,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 54, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 1 - } - }, + "start":0,"end":54,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, "id": { "type": "Identifier", - "start": 9, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "fn" - }, + "start":9,"end":11,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":11},"identifierName":"fn"}, "name": "fn" }, "generator": false, @@ -65,64 +20,19 @@ "params": [], "body": { "type": "BlockStatement", - "start": 14, - "end": 54, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 5, - "column": 1 - } - }, + "start":14,"end":54,"loc":{"start":{"line":1,"column":14},"end":{"line":5,"column":1}}, "body": [ { "type": "ReturnStatement", - "start": 18, - "end": 24, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 8 - } - }, + "start":18,"end":24,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":8}}, "argument": null }, { "type": "FunctionDeclaration", - "start": 27, - "end": 44, - "loc": { - "start": { - "line": 3, - "column": 2 - }, - "end": { - "line": 3, - "column": 19 - } - }, + "start":27,"end":44,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":19}}, "id": { "type": "Identifier", - "start": 36, - "end": 39, - "loc": { - "start": { - "line": 3, - "column": 11 - }, - "end": { - "line": 3, - "column": 14 - }, - "identifierName": "foo" - }, + "start":36,"end":39,"loc":{"start":{"line":3,"column":11},"end":{"line":3,"column":14},"identifierName":"foo"}, "name": "foo" }, "generator": false, @@ -130,50 +40,17 @@ "params": [], "body": { "type": "BlockStatement", - "start": 42, - "end": 44, - "loc": { - "start": { - "line": 3, - "column": 17 - }, - "end": { - "line": 3, - "column": 19 - } - }, + "start":42,"end":44,"loc":{"start":{"line":3,"column":17},"end":{"line":3,"column":19}}, "body": [], "directives": [] } }, { "type": "ExpressionStatement", - "start": 47, - "end": 52, - "loc": { - "start": { - "line": 4, - "column": 2 - }, - "end": { - "line": 4, - "column": 7 - } - }, + "start":47,"end":52,"loc":{"start":{"line":4,"column":2},"end":{"line":4,"column":7}}, "expression": { "type": "RegExpLiteral", - "start": 47, - "end": 52, - "loc": { - "start": { - "line": 4, - "column": 2 - }, - "end": { - "line": 4, - "column": 7 - } - }, + "start":47,"end":52,"loc":{"start":{"line":4,"column":2},"end":{"line":4,"column":7}}, "extra": { "raw": "/42/i" }, diff --git a/packages/babel-parser/test/fixtures/core/categorized/05-regex/output.json b/packages/babel-parser/test/fixtures/core/categorized/05-regex/output.json index 7a2e654f2829..556ea3afcc6b 100644 --- a/packages/babel-parser/test/fixtures/core/categorized/05-regex/output.json +++ b/packages/babel-parser/test/fixtures/core/categorized/05-regex/output.json @@ -1,77 +1,21 @@ { "type": "File", - "start": 0, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, "program": { "type": "Program", - "start": 0, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "expression": { "type": "CallExpression", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "callee": { "type": "Identifier", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - }, - "identifierName": "test" - }, + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4},"identifierName":"test"}, "name": "test" }, "arguments": [] @@ -79,33 +23,10 @@ }, { "type": "FunctionDeclaration", - "start": 8, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":8,"end":25,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":25}}, "id": { "type": "Identifier", - "start": 17, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 20 - }, - "identifierName": "foo" - }, + "start":17,"end":20,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":20},"identifierName":"foo"}, "name": "foo" }, "generator": false, @@ -113,50 +34,17 @@ "params": [], "body": { "type": "BlockStatement", - "start": 23, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":23,"end":25,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":25}}, "body": [], "directives": [] } }, { "type": "ExpressionStatement", - "start": 26, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":26,"end":31,"loc":{"start":{"line":1,"column":26},"end":{"line":1,"column":31}}, "expression": { "type": "RegExpLiteral", - "start": 26, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":26,"end":31,"loc":{"start":{"line":1,"column":26},"end":{"line":1,"column":31}}, "extra": { "raw": "/42/i" }, diff --git a/packages/babel-parser/test/fixtures/core/categorized/06-regex/output.json b/packages/babel-parser/test/fixtures/core/categorized/06-regex/output.json index a17df4edc69f..16e46725aa29 100644 --- a/packages/babel-parser/test/fixtures/core/categorized/06-regex/output.json +++ b/packages/babel-parser/test/fixtures/core/categorized/06-regex/output.json @@ -1,121 +1,32 @@ { "type": "File", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "program": { "type": "Program", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "expression": { "type": "BinaryExpression", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "left": { "type": "BinaryExpression", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, "left": { "type": "UnaryExpression", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "operator": "!", "prefix": true, "argument": { "type": "FunctionExpression", - "start": 1, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":1,"end":17,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":17}}, "id": { "type": "Identifier", - "start": 10, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "fn" - }, + "start":10,"end":12,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":12},"identifierName":"fn"}, "name": "fn" }, "generator": false, @@ -123,18 +34,7 @@ "params": [], "body": { "type": "BlockStatement", - "start": 15, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":15,"end":17,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":17}}, "body": [], "directives": [] } @@ -143,18 +43,7 @@ "operator": "/", "right": { "type": "NumericLiteral", - "start": 19, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":19,"end":21,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":21}}, "extra": { "rawValue": 42, "raw": "42" @@ -165,19 +54,7 @@ "operator": "/", "right": { "type": "Identifier", - "start": 22, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 23 - }, - "identifierName": "i" - }, + "start":22,"end":23,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":23},"identifierName":"i"}, "name": "i" } } diff --git a/packages/babel-parser/test/fixtures/core/categorized/07-regex/output.json b/packages/babel-parser/test/fixtures/core/categorized/07-regex/output.json index 28c34291a938..349455002836 100644 --- a/packages/babel-parser/test/fixtures/core/categorized/07-regex/output.json +++ b/packages/babel-parser/test/fixtures/core/categorized/07-regex/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "program": { "type": "Program", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "id": { "type": "Identifier", - "start": 9, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "foo" - }, + "start":9,"end":12,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":12},"identifierName":"foo"}, "name": "foo" }, "generator": false, @@ -65,50 +20,17 @@ "params": [], "body": { "type": "BlockStatement", - "start": 15, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":15,"end":17,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":17}}, "body": [], "directives": [] } }, { "type": "ExpressionStatement", - "start": 18, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":18,"end":23,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":23}}, "expression": { "type": "RegExpLiteral", - "start": 18, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":18,"end":23,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":23}}, "extra": { "raw": "/42/i" }, diff --git a/packages/babel-parser/test/fixtures/core/categorized/identifier-name-loc/output.json b/packages/babel-parser/test/fixtures/core/categorized/identifier-name-loc/output.json index aea211ae092d..6bc1d79698b9 100644 --- a/packages/babel-parser/test/fixtures/core/categorized/identifier-name-loc/output.json +++ b/packages/babel-parser/test/fixtures/core/categorized/identifier-name-loc/output.json @@ -1,95 +1,27 @@ { "type": "File", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "program": { "type": "Program", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "expression": { "type": "CallExpression", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, "callee": { "type": "Identifier", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - }, - "identifierName": "foo" - }, + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3},"identifierName":"foo"}, "name": "foo" }, "arguments": [ { "type": "Identifier", - "start": 4, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "bar" - }, + "start":4,"end":7,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":7},"identifierName":"bar"}, "name": "bar" } ] diff --git a/packages/babel-parser/test/fixtures/core/categorized/invalid-assignment-pattern-1/input.js b/packages/babel-parser/test/fixtures/core/categorized/invalid-assignment-pattern-1/input.js new file mode 100644 index 000000000000..0a7f8682331a --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/categorized/invalid-assignment-pattern-1/input.js @@ -0,0 +1 @@ +(a = 1) = t \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/categorized/invalid-assignment-pattern-1/options.json b/packages/babel-parser/test/fixtures/core/categorized/invalid-assignment-pattern-1/options.json new file mode 100644 index 000000000000..070d941a7562 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/categorized/invalid-assignment-pattern-1/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["estree"] +} diff --git a/packages/babel-parser/test/fixtures/core/categorized/invalid-assignment-pattern-1/output.json b/packages/babel-parser/test/fixtures/core/categorized/invalid-assignment-pattern-1/output.json new file mode 100644 index 000000000000..64125f64db72 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/categorized/invalid-assignment-pattern-1/output.json @@ -0,0 +1,48 @@ +{ + "type": "File", + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "errors": [ + "SyntaxError: Invalid parenthesized assignment pattern (1:1)" + ], + "program": { + "type": "Program", + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "expression": { + "type": "AssignmentExpression", + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "operator": "=", + "left": { + "type": "AssignmentPattern", + "start":1,"end":6,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":6}}, + "left": { + "type": "Identifier", + "start":1,"end":2,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":2},"identifierName":"a"}, + "name": "a" + }, + "right": { + "type": "Literal", + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, + "value": 1, + "raw": "1" + }, + "extra": { + "parenthesized": true, + "parenStart": 0 + } + }, + "right": { + "type": "Identifier", + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11},"identifierName":"t"}, + "name": "t" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/categorized/invalid-assignment-pattern-2/input.js b/packages/babel-parser/test/fixtures/core/categorized/invalid-assignment-pattern-2/input.js new file mode 100644 index 000000000000..93c05a981b37 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/categorized/invalid-assignment-pattern-2/input.js @@ -0,0 +1 @@ +[(a = 1)] = t \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/categorized/invalid-assignment-pattern-2/options.json b/packages/babel-parser/test/fixtures/core/categorized/invalid-assignment-pattern-2/options.json new file mode 100644 index 000000000000..070d941a7562 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/categorized/invalid-assignment-pattern-2/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["estree"] +} diff --git a/packages/babel-parser/test/fixtures/core/categorized/invalid-assignment-pattern-2/output.json b/packages/babel-parser/test/fixtures/core/categorized/invalid-assignment-pattern-2/output.json new file mode 100644 index 000000000000..340a0dcdbce9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/categorized/invalid-assignment-pattern-2/output.json @@ -0,0 +1,54 @@ +{ + "type": "File", + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "errors": [ + "SyntaxError: Invalid parenthesized assignment pattern (1:2)" + ], + "program": { + "type": "Program", + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "expression": { + "type": "AssignmentExpression", + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "operator": "=", + "left": { + "type": "ArrayPattern", + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "elements": [ + { + "type": "AssignmentPattern", + "start":2,"end":7,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":7}}, + "left": { + "type": "Identifier", + "start":2,"end":3,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":3},"identifierName":"a"}, + "name": "a" + }, + "right": { + "type": "Literal", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7}}, + "value": 1, + "raw": "1" + }, + "extra": { + "parenthesized": true, + "parenStart": 1 + } + } + ] + }, + "right": { + "type": "Identifier", + "start":12,"end":13,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":13},"identifierName":"t"}, + "name": "t" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/categorized/invalid-assignment-pattern-3/input.js b/packages/babel-parser/test/fixtures/core/categorized/invalid-assignment-pattern-3/input.js new file mode 100644 index 000000000000..18b5e0796da0 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/categorized/invalid-assignment-pattern-3/input.js @@ -0,0 +1 @@ +[({ a: [b = 2]})] = t \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/categorized/invalid-assignment-pattern-3/options.json b/packages/babel-parser/test/fixtures/core/categorized/invalid-assignment-pattern-3/options.json new file mode 100644 index 000000000000..070d941a7562 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/categorized/invalid-assignment-pattern-3/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["estree"] +} diff --git a/packages/babel-parser/test/fixtures/core/categorized/invalid-assignment-pattern-3/output.json b/packages/babel-parser/test/fixtures/core/categorized/invalid-assignment-pattern-3/output.json new file mode 100644 index 000000000000..74aeb35dac49 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/categorized/invalid-assignment-pattern-3/output.json @@ -0,0 +1,79 @@ +{ + "type": "File", + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, + "errors": [ + "SyntaxError: Invalid parenthesized assignment pattern (1:2)" + ], + "program": { + "type": "Program", + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, + "expression": { + "type": "AssignmentExpression", + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, + "operator": "=", + "left": { + "type": "ArrayPattern", + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, + "elements": [ + { + "type": "ObjectPattern", + "start":2,"end":15,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":15}}, + "properties": [ + { + "type": "Property", + "start":4,"end":14,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":14}}, + "method": false, + "key": { + "type": "Identifier", + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"a"}, + "name": "a" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "ArrayPattern", + "start":7,"end":14,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":14}}, + "elements": [ + { + "type": "AssignmentPattern", + "start":8,"end":13,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":13}}, + "left": { + "type": "Identifier", + "start":8,"end":9,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":9},"identifierName":"b"}, + "name": "b" + }, + "right": { + "type": "Literal", + "start":12,"end":13,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":13}}, + "value": 2, + "raw": "2" + } + } + ] + }, + "kind": "init" + } + ], + "extra": { + "parenthesized": true, + "parenStart": 1 + } + } + ] + }, + "right": { + "type": "Identifier", + "start":20,"end":21,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":21},"identifierName":"t"}, + "name": "t" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/categorized/invalid-assignment-pattern-4/input.js b/packages/babel-parser/test/fixtures/core/categorized/invalid-assignment-pattern-4/input.js new file mode 100644 index 000000000000..dff398289765 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/categorized/invalid-assignment-pattern-4/input.js @@ -0,0 +1 @@ +[{b: [([a = 1])]}] = t \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/categorized/invalid-assignment-pattern-4/options.json b/packages/babel-parser/test/fixtures/core/categorized/invalid-assignment-pattern-4/options.json new file mode 100644 index 000000000000..070d941a7562 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/categorized/invalid-assignment-pattern-4/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["estree"] +} diff --git a/packages/babel-parser/test/fixtures/core/categorized/invalid-assignment-pattern-4/output.json b/packages/babel-parser/test/fixtures/core/categorized/invalid-assignment-pattern-4/output.json new file mode 100644 index 000000000000..7b5829535204 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/categorized/invalid-assignment-pattern-4/output.json @@ -0,0 +1,85 @@ +{ + "type": "File", + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, + "errors": [ + "SyntaxError: Invalid parenthesized assignment pattern (1:7)" + ], + "program": { + "type": "Program", + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, + "expression": { + "type": "AssignmentExpression", + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, + "operator": "=", + "left": { + "type": "ArrayPattern", + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, + "elements": [ + { + "type": "ObjectPattern", + "start":1,"end":17,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":17}}, + "properties": [ + { + "type": "Property", + "start":2,"end":16,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":16}}, + "method": false, + "key": { + "type": "Identifier", + "start":2,"end":3,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":3},"identifierName":"b"}, + "name": "b" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "ArrayPattern", + "start":5,"end":16,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":16}}, + "elements": [ + { + "type": "ArrayPattern", + "start":7,"end":14,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":14}}, + "elements": [ + { + "type": "AssignmentPattern", + "start":8,"end":13,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":13}}, + "left": { + "type": "Identifier", + "start":8,"end":9,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":9},"identifierName":"a"}, + "name": "a" + }, + "right": { + "type": "Literal", + "start":12,"end":13,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":13}}, + "value": 1, + "raw": "1" + } + } + ], + "extra": { + "parenthesized": true, + "parenStart": 6 + } + } + ] + }, + "kind": "init" + } + ] + } + ] + }, + "right": { + "type": "Identifier", + "start":21,"end":22,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":22},"identifierName":"t"}, + "name": "t" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/categorized/invalid-assignment-pattern-5/input.js b/packages/babel-parser/test/fixtures/core/categorized/invalid-assignment-pattern-5/input.js new file mode 100644 index 000000000000..0100e137ff7f --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/categorized/invalid-assignment-pattern-5/input.js @@ -0,0 +1 @@ +[([x])] = t; \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/categorized/invalid-assignment-pattern-5/options.json b/packages/babel-parser/test/fixtures/core/categorized/invalid-assignment-pattern-5/options.json new file mode 100644 index 000000000000..070d941a7562 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/categorized/invalid-assignment-pattern-5/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["estree"] +} diff --git a/packages/babel-parser/test/fixtures/core/categorized/invalid-assignment-pattern-5/output.json b/packages/babel-parser/test/fixtures/core/categorized/invalid-assignment-pattern-5/output.json new file mode 100644 index 000000000000..22e32af6ebf5 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/categorized/invalid-assignment-pattern-5/output.json @@ -0,0 +1,50 @@ +{ + "type": "File", + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "errors": [ + "SyntaxError: Invalid parenthesized assignment pattern (1:2)" + ], + "program": { + "type": "Program", + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "expression": { + "type": "AssignmentExpression", + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "operator": "=", + "left": { + "type": "ArrayPattern", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "elements": [ + { + "type": "ArrayPattern", + "start":2,"end":5,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":5}}, + "elements": [ + { + "type": "Identifier", + "start":3,"end":4,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":4},"identifierName":"x"}, + "name": "x" + } + ], + "extra": { + "parenthesized": true, + "parenStart": 1 + } + } + ] + }, + "right": { + "type": "Identifier", + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11},"identifierName":"t"}, + "name": "t" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/categorized/invalid-fn-decl-inside-loop/options.json b/packages/babel-parser/test/fixtures/core/categorized/invalid-fn-decl-inside-loop/options.json deleted file mode 100644 index 05a7826ae8ba..000000000000 --- a/packages/babel-parser/test/fixtures/core/categorized/invalid-fn-decl-inside-loop/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "In non-strict mode code, functions can only be declared at top level, inside a block, or as the body of an if statement (1:10)" -} diff --git a/packages/babel-parser/test/fixtures/core/categorized/invalid-fn-decl-inside-loop/output.json b/packages/babel-parser/test/fixtures/core/categorized/invalid-fn-decl-inside-loop/output.json new file mode 100644 index 000000000000..c2f51bff4fbd --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/categorized/invalid-fn-decl-inside-loop/output.json @@ -0,0 +1,47 @@ +{ + "type": "File", + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, + "errors": [ + "SyntaxError: In non-strict mode code, functions can only be declared at top level, inside a block, or as the body of an if statement (1:10)" + ], + "program": { + "type": "Program", + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "WhileStatement", + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, + "test": { + "type": "NumericLiteral", + "start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8}}, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + }, + "body": { + "type": "FunctionDeclaration", + "start":10,"end":26,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":26}}, + "id": { + "type": "Identifier", + "start":19,"end":22,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":22},"identifierName":"foo"}, + "name": "foo" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":24,"end":26,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":26}}, + "body": [], + "directives": [] + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/categorized/invalid-fn-decl-labeled-inside-loop/options.json b/packages/babel-parser/test/fixtures/core/categorized/invalid-fn-decl-labeled-inside-loop/options.json deleted file mode 100644 index 395620bfa2f8..000000000000 --- a/packages/babel-parser/test/fixtures/core/categorized/invalid-fn-decl-labeled-inside-loop/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "In non-strict mode code, functions can only be declared at top level, inside a block, or as the body of an if statement (1:20)" -} diff --git a/packages/babel-parser/test/fixtures/core/categorized/invalid-fn-decl-labeled-inside-loop/output.json b/packages/babel-parser/test/fixtures/core/categorized/invalid-fn-decl-labeled-inside-loop/output.json new file mode 100644 index 000000000000..f39f3fcea78e --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/categorized/invalid-fn-decl-labeled-inside-loop/output.json @@ -0,0 +1,65 @@ +{ + "type": "File", + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, + "errors": [ + "SyntaxError: In non-strict mode code, functions can only be declared at top level, inside a block, or as the body of an if statement (1:20)" + ], + "program": { + "type": "Program", + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "WhileStatement", + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, + "test": { + "type": "NumericLiteral", + "start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8}}, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + }, + "body": { + "type": "LabeledStatement", + "start":10,"end":36,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":36}}, + "body": { + "type": "LabeledStatement", + "start":15,"end":36,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":36}}, + "body": { + "type": "FunctionDeclaration", + "start":20,"end":36,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":36}}, + "id": { + "type": "Identifier", + "start":29,"end":32,"loc":{"start":{"line":1,"column":29},"end":{"line":1,"column":32},"identifierName":"foo"}, + "name": "foo" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":34,"end":36,"loc":{"start":{"line":1,"column":34},"end":{"line":1,"column":36}}, + "body": [], + "directives": [] + } + }, + "label": { + "type": "Identifier", + "start":15,"end":18,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":18},"identifierName":"bar"}, + "name": "bar" + } + }, + "label": { + "type": "Identifier", + "start":10,"end":13,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":13},"identifierName":"foo"}, + "name": "foo" + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/categorized/label-kind-switch/output.json b/packages/babel-parser/test/fixtures/core/categorized/label-kind-switch/output.json index 7da940320363..2ac4e66efbeb 100644 --- a/packages/babel-parser/test/fixtures/core/categorized/label-kind-switch/output.json +++ b/packages/babel-parser/test/fixtures/core/categorized/label-kind-switch/output.json @@ -1,111 +1,32 @@ { "type": "File", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "BlockStatement", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, "body": [ { "type": "LabeledStatement", - "start": 4, - "end": 23, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 3, - "column": 3 - } - }, + "start":4,"end":23,"loc":{"start":{"line":2,"column":2},"end":{"line":3,"column":3}}, "body": { "type": "SwitchStatement", - "start": 7, - "end": 23, - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 3, - "column": 3 - } - }, + "start":7,"end":23,"loc":{"start":{"line":2,"column":5},"end":{"line":3,"column":3}}, "discriminant": { "type": "Identifier", - "start": 15, - "end": 16, - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 14 - }, - "identifierName": "i" - }, + "start":15,"end":16,"loc":{"start":{"line":2,"column":13},"end":{"line":2,"column":14},"identifierName":"i"}, "name": "i" }, "cases": [] }, "label": { "type": "Identifier", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 3 - }, - "identifierName": "a" - }, + "start":4,"end":5,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":3},"identifierName":"a"}, "name": "a" } } diff --git a/packages/babel-parser/test/fixtures/core/categorized/not-directive/input.js b/packages/babel-parser/test/fixtures/core/categorized/not-directive/input.js index 2392784f3177..4ac4c61819e2 100644 --- a/packages/babel-parser/test/fixtures/core/categorized/not-directive/input.js +++ b/packages/babel-parser/test/fixtures/core/categorized/not-directive/input.js @@ -1 +1,118 @@ -("not a directive"); +("use strict"); + +"use strict".foo; +"use strict"[foo]; +"use strict"`foo`; +"use strict"(foo); +"use strict" + .foo; +"use strict" + [foo]; +"use strict" + `foo`; +"use strict" + (foo); + +// Should not be a syntax error because should not be parsed in strict mode. +"\5"; + +function f(){ + "use strict".foo; + "\5"; +} + +function f(){ + "use strict"[foo]; + "\5"; +} + +function f(){ + "use strict"`foo`; + "\5"; +} + +function f(){ + "use strict"(foo); + "\5"; +} + +function f(){ + "use strict" + .foo; + "\5"; +} + +function f(){ + "use strict" + [foo]; + "\5"; +} + +function f(){ + "use strict" + `foo`; + "\5"; +} + +function f(){ + "use strict" + (foo); + "\5"; +} + +function f(){ + foo(); + "use strict".bar; + "\5"; +} + +function f(){ + foo(); + "use strict"[bar]; + "\5"; +} + +function f(){ + foo(); + "use strict"`bar`; + "\5"; +} + +function f(){ + foo(); + "use strict"(bar); + "\5"; +} + +function f(){ + foo(); + "use strict" + .bar; + "\5"; +} + +function f(){ + foo(); + "use strict" + [bar]; + "\5"; +} + +function f(){ + foo(); + "use strict" + `bar`; + "\5"; +} + +function f(){ + foo(); + "use strict" + (bar); + "\5"; +} + +function f(){ + 05; + "use strict"; +} diff --git a/packages/babel-parser/test/fixtures/core/categorized/not-directive/output.json b/packages/babel-parser/test/fixtures/core/categorized/not-directive/output.json index ff0caba1173a..507489c6bcba 100644 --- a/packages/babel-parser/test/fixtures/core/categorized/not-directive/output.json +++ b/packages/babel-parser/test/fixtures/core/categorized/not-directive/output.json @@ -1,72 +1,1349 @@ { "type": "File", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":0,"end":1129,"loc":{"start":{"line":1,"column":0},"end":{"line":118,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":0,"end":1129,"loc":{"start":{"line":1,"column":0},"end":{"line":118,"column":1}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, + "expression": { + "type": "StringLiteral", + "start":1,"end":13,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":13}}, + "extra": { + "rawValue": "use strict", + "raw": "\"use strict\"", + "parenthesized": true, + "parenStart": 0 + }, + "value": "use strict" + } + }, + { + "type": "ExpressionStatement", + "start":17,"end":34,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":17}}, + "expression": { + "type": "MemberExpression", + "start":17,"end":33,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":16}}, + "object": { + "type": "StringLiteral", + "start":17,"end":29,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":12}}, + "extra": { + "rawValue": "use strict", + "raw": "\"use strict\"" + }, + "value": "use strict" + }, + "property": { + "type": "Identifier", + "start":30,"end":33,"loc":{"start":{"line":3,"column":13},"end":{"line":3,"column":16},"identifierName":"foo"}, + "name": "foo" + }, + "computed": false + } + }, + { + "type": "ExpressionStatement", + "start":35,"end":53,"loc":{"start":{"line":4,"column":0},"end":{"line":4,"column":18}}, + "expression": { + "type": "MemberExpression", + "start":35,"end":52,"loc":{"start":{"line":4,"column":0},"end":{"line":4,"column":17}}, + "object": { + "type": "StringLiteral", + "start":35,"end":47,"loc":{"start":{"line":4,"column":0},"end":{"line":4,"column":12}}, + "extra": { + "rawValue": "use strict", + "raw": "\"use strict\"" + }, + "value": "use strict" + }, + "property": { + "type": "Identifier", + "start":48,"end":51,"loc":{"start":{"line":4,"column":13},"end":{"line":4,"column":16},"identifierName":"foo"}, + "name": "foo" + }, + "computed": true + } + }, + { + "type": "ExpressionStatement", + "start":54,"end":72,"loc":{"start":{"line":5,"column":0},"end":{"line":5,"column":18}}, + "expression": { + "type": "TaggedTemplateExpression", + "start":54,"end":71,"loc":{"start":{"line":5,"column":0},"end":{"line":5,"column":17}}, + "tag": { + "type": "StringLiteral", + "start":54,"end":66,"loc":{"start":{"line":5,"column":0},"end":{"line":5,"column":12}}, + "extra": { + "rawValue": "use strict", + "raw": "\"use strict\"" + }, + "value": "use strict" }, - "end": { - "line": 1, - "column": 20 + "quasi": { + "type": "TemplateLiteral", + "start":66,"end":71,"loc":{"start":{"line":5,"column":12},"end":{"line":5,"column":17}}, + "expressions": [], + "quasis": [ + { + "type": "TemplateElement", + "start":67,"end":70,"loc":{"start":{"line":5,"column":13},"end":{"line":5,"column":16}}, + "value": { + "raw": "foo", + "cooked": "foo" + }, + "tail": true + } + ] } - }, + } + }, + { + "type": "ExpressionStatement", + "start":73,"end":91,"loc":{"start":{"line":6,"column":0},"end":{"line":6,"column":18}}, "expression": { - "type": "StringLiteral", - "start": 1, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 1 + "type": "CallExpression", + "start":73,"end":90,"loc":{"start":{"line":6,"column":0},"end":{"line":6,"column":17}}, + "callee": { + "type": "StringLiteral", + "start":73,"end":85,"loc":{"start":{"line":6,"column":0},"end":{"line":6,"column":12}}, + "extra": { + "rawValue": "use strict", + "raw": "\"use strict\"" }, - "end": { - "line": 1, - "column": 18 + "value": "use strict" + }, + "arguments": [ + { + "type": "Identifier", + "start":86,"end":89,"loc":{"start":{"line":6,"column":13},"end":{"line":6,"column":16},"identifierName":"foo"}, + "name": "foo" } + ] + } + }, + { + "type": "ExpressionStatement", + "start":92,"end":112,"loc":{"start":{"line":7,"column":0},"end":{"line":8,"column":7}}, + "expression": { + "type": "MemberExpression", + "start":92,"end":111,"loc":{"start":{"line":7,"column":0},"end":{"line":8,"column":6}}, + "object": { + "type": "StringLiteral", + "start":92,"end":104,"loc":{"start":{"line":7,"column":0},"end":{"line":7,"column":12}}, + "extra": { + "rawValue": "use strict", + "raw": "\"use strict\"" + }, + "value": "use strict" + }, + "property": { + "type": "Identifier", + "start":108,"end":111,"loc":{"start":{"line":8,"column":3},"end":{"line":8,"column":6},"identifierName":"foo"}, + "name": "foo" + }, + "computed": false + } + }, + { + "type": "ExpressionStatement", + "start":113,"end":134,"loc":{"start":{"line":9,"column":0},"end":{"line":10,"column":8}}, + "expression": { + "type": "MemberExpression", + "start":113,"end":133,"loc":{"start":{"line":9,"column":0},"end":{"line":10,"column":7}}, + "object": { + "type": "StringLiteral", + "start":113,"end":125,"loc":{"start":{"line":9,"column":0},"end":{"line":9,"column":12}}, + "extra": { + "rawValue": "use strict", + "raw": "\"use strict\"" + }, + "value": "use strict" + }, + "property": { + "type": "Identifier", + "start":129,"end":132,"loc":{"start":{"line":10,"column":3},"end":{"line":10,"column":6},"identifierName":"foo"}, + "name": "foo" + }, + "computed": true + } + }, + { + "type": "ExpressionStatement", + "start":135,"end":156,"loc":{"start":{"line":11,"column":0},"end":{"line":12,"column":8}}, + "expression": { + "type": "TaggedTemplateExpression", + "start":135,"end":155,"loc":{"start":{"line":11,"column":0},"end":{"line":12,"column":7}}, + "tag": { + "type": "StringLiteral", + "start":135,"end":147,"loc":{"start":{"line":11,"column":0},"end":{"line":11,"column":12}}, + "extra": { + "rawValue": "use strict", + "raw": "\"use strict\"" + }, + "value": "use strict" }, + "quasi": { + "type": "TemplateLiteral", + "start":150,"end":155,"loc":{"start":{"line":12,"column":2},"end":{"line":12,"column":7}}, + "expressions": [], + "quasis": [ + { + "type": "TemplateElement", + "start":151,"end":154,"loc":{"start":{"line":12,"column":3},"end":{"line":12,"column":6}}, + "value": { + "raw": "foo", + "cooked": "foo" + }, + "tail": true + } + ] + } + } + }, + { + "type": "ExpressionStatement", + "start":157,"end":178,"loc":{"start":{"line":13,"column":0},"end":{"line":14,"column":8}}, + "expression": { + "type": "CallExpression", + "start":157,"end":177,"loc":{"start":{"line":13,"column":0},"end":{"line":14,"column":7}}, + "callee": { + "type": "StringLiteral", + "start":157,"end":169,"loc":{"start":{"line":13,"column":0},"end":{"line":13,"column":12}}, + "extra": { + "rawValue": "use strict", + "raw": "\"use strict\"" + }, + "value": "use strict" + }, + "arguments": [ + { + "type": "Identifier", + "start":173,"end":176,"loc":{"start":{"line":14,"column":3},"end":{"line":14,"column":6},"identifierName":"foo"}, + "name": "foo" + } + ] + }, + "trailingComments": [ + { + "type": "CommentLine", + "value": " Should not be a syntax error because should not be parsed in strict mode.", + "start":180,"end":256,"loc":{"start":{"line":16,"column":0},"end":{"line":16,"column":76}} + } + ] + }, + { + "type": "ExpressionStatement", + "start":257,"end":262,"loc":{"start":{"line":17,"column":0},"end":{"line":17,"column":5}}, + "expression": { + "type": "StringLiteral", + "start":257,"end":261,"loc":{"start":{"line":17,"column":0},"end":{"line":17,"column":4}}, "extra": { - "rawValue": "not a directive", - "raw": "\"not a directive\"", - "parenthesized": true, - "parenStart": 0 + "rawValue": "\u0005", + "raw": "\"\\5\"" }, - "value": "not a directive" + "value": "\u0005" + }, + "leadingComments": [ + { + "type": "CommentLine", + "value": " Should not be a syntax error because should not be parsed in strict mode.", + "start":180,"end":256,"loc":{"start":{"line":16,"column":0},"end":{"line":16,"column":76}} + } + ] + }, + { + "type": "FunctionDeclaration", + "start":264,"end":307,"loc":{"start":{"line":19,"column":0},"end":{"line":22,"column":1}}, + "id": { + "type": "Identifier", + "start":273,"end":274,"loc":{"start":{"line":19,"column":9},"end":{"line":19,"column":10},"identifierName":"f"}, + "name": "f" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":276,"end":307,"loc":{"start":{"line":19,"column":12},"end":{"line":22,"column":1}}, + "body": [ + { + "type": "ExpressionStatement", + "start":280,"end":297,"loc":{"start":{"line":20,"column":2},"end":{"line":20,"column":19}}, + "expression": { + "type": "MemberExpression", + "start":280,"end":296,"loc":{"start":{"line":20,"column":2},"end":{"line":20,"column":18}}, + "object": { + "type": "StringLiteral", + "start":280,"end":292,"loc":{"start":{"line":20,"column":2},"end":{"line":20,"column":14}}, + "extra": { + "rawValue": "use strict", + "raw": "\"use strict\"" + }, + "value": "use strict" + }, + "property": { + "type": "Identifier", + "start":293,"end":296,"loc":{"start":{"line":20,"column":15},"end":{"line":20,"column":18},"identifierName":"foo"}, + "name": "foo" + }, + "computed": false + } + }, + { + "type": "ExpressionStatement", + "start":300,"end":305,"loc":{"start":{"line":21,"column":2},"end":{"line":21,"column":7}}, + "expression": { + "type": "StringLiteral", + "start":300,"end":304,"loc":{"start":{"line":21,"column":2},"end":{"line":21,"column":6}}, + "extra": { + "rawValue": "\u0005", + "raw": "\"\\5\"" + }, + "value": "\u0005" + } + } + ], + "directives": [] + } + }, + { + "type": "FunctionDeclaration", + "start":309,"end":353,"loc":{"start":{"line":24,"column":0},"end":{"line":27,"column":1}}, + "id": { + "type": "Identifier", + "start":318,"end":319,"loc":{"start":{"line":24,"column":9},"end":{"line":24,"column":10},"identifierName":"f"}, + "name": "f" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":321,"end":353,"loc":{"start":{"line":24,"column":12},"end":{"line":27,"column":1}}, + "body": [ + { + "type": "ExpressionStatement", + "start":325,"end":343,"loc":{"start":{"line":25,"column":2},"end":{"line":25,"column":20}}, + "expression": { + "type": "MemberExpression", + "start":325,"end":342,"loc":{"start":{"line":25,"column":2},"end":{"line":25,"column":19}}, + "object": { + "type": "StringLiteral", + "start":325,"end":337,"loc":{"start":{"line":25,"column":2},"end":{"line":25,"column":14}}, + "extra": { + "rawValue": "use strict", + "raw": "\"use strict\"" + }, + "value": "use strict" + }, + "property": { + "type": "Identifier", + "start":338,"end":341,"loc":{"start":{"line":25,"column":15},"end":{"line":25,"column":18},"identifierName":"foo"}, + "name": "foo" + }, + "computed": true + } + }, + { + "type": "ExpressionStatement", + "start":346,"end":351,"loc":{"start":{"line":26,"column":2},"end":{"line":26,"column":7}}, + "expression": { + "type": "StringLiteral", + "start":346,"end":350,"loc":{"start":{"line":26,"column":2},"end":{"line":26,"column":6}}, + "extra": { + "rawValue": "\u0005", + "raw": "\"\\5\"" + }, + "value": "\u0005" + } + } + ], + "directives": [] + } + }, + { + "type": "FunctionDeclaration", + "start":355,"end":399,"loc":{"start":{"line":29,"column":0},"end":{"line":32,"column":1}}, + "id": { + "type": "Identifier", + "start":364,"end":365,"loc":{"start":{"line":29,"column":9},"end":{"line":29,"column":10},"identifierName":"f"}, + "name": "f" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":367,"end":399,"loc":{"start":{"line":29,"column":12},"end":{"line":32,"column":1}}, + "body": [ + { + "type": "ExpressionStatement", + "start":371,"end":389,"loc":{"start":{"line":30,"column":2},"end":{"line":30,"column":20}}, + "expression": { + "type": "TaggedTemplateExpression", + "start":371,"end":388,"loc":{"start":{"line":30,"column":2},"end":{"line":30,"column":19}}, + "tag": { + "type": "StringLiteral", + "start":371,"end":383,"loc":{"start":{"line":30,"column":2},"end":{"line":30,"column":14}}, + "extra": { + "rawValue": "use strict", + "raw": "\"use strict\"" + }, + "value": "use strict" + }, + "quasi": { + "type": "TemplateLiteral", + "start":383,"end":388,"loc":{"start":{"line":30,"column":14},"end":{"line":30,"column":19}}, + "expressions": [], + "quasis": [ + { + "type": "TemplateElement", + "start":384,"end":387,"loc":{"start":{"line":30,"column":15},"end":{"line":30,"column":18}}, + "value": { + "raw": "foo", + "cooked": "foo" + }, + "tail": true + } + ] + } + } + }, + { + "type": "ExpressionStatement", + "start":392,"end":397,"loc":{"start":{"line":31,"column":2},"end":{"line":31,"column":7}}, + "expression": { + "type": "StringLiteral", + "start":392,"end":396,"loc":{"start":{"line":31,"column":2},"end":{"line":31,"column":6}}, + "extra": { + "rawValue": "\u0005", + "raw": "\"\\5\"" + }, + "value": "\u0005" + } + } + ], + "directives": [] + } + }, + { + "type": "FunctionDeclaration", + "start":401,"end":445,"loc":{"start":{"line":34,"column":0},"end":{"line":37,"column":1}}, + "id": { + "type": "Identifier", + "start":410,"end":411,"loc":{"start":{"line":34,"column":9},"end":{"line":34,"column":10},"identifierName":"f"}, + "name": "f" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":413,"end":445,"loc":{"start":{"line":34,"column":12},"end":{"line":37,"column":1}}, + "body": [ + { + "type": "ExpressionStatement", + "start":417,"end":435,"loc":{"start":{"line":35,"column":2},"end":{"line":35,"column":20}}, + "expression": { + "type": "CallExpression", + "start":417,"end":434,"loc":{"start":{"line":35,"column":2},"end":{"line":35,"column":19}}, + "callee": { + "type": "StringLiteral", + "start":417,"end":429,"loc":{"start":{"line":35,"column":2},"end":{"line":35,"column":14}}, + "extra": { + "rawValue": "use strict", + "raw": "\"use strict\"" + }, + "value": "use strict" + }, + "arguments": [ + { + "type": "Identifier", + "start":430,"end":433,"loc":{"start":{"line":35,"column":15},"end":{"line":35,"column":18},"identifierName":"foo"}, + "name": "foo" + } + ] + } + }, + { + "type": "ExpressionStatement", + "start":438,"end":443,"loc":{"start":{"line":36,"column":2},"end":{"line":36,"column":7}}, + "expression": { + "type": "StringLiteral", + "start":438,"end":442,"loc":{"start":{"line":36,"column":2},"end":{"line":36,"column":6}}, + "extra": { + "rawValue": "\u0005", + "raw": "\"\\5\"" + }, + "value": "\u0005" + } + } + ], + "directives": [] + } + }, + { + "type": "FunctionDeclaration", + "start":447,"end":493,"loc":{"start":{"line":39,"column":0},"end":{"line":43,"column":1}}, + "id": { + "type": "Identifier", + "start":456,"end":457,"loc":{"start":{"line":39,"column":9},"end":{"line":39,"column":10},"identifierName":"f"}, + "name": "f" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":459,"end":493,"loc":{"start":{"line":39,"column":12},"end":{"line":43,"column":1}}, + "body": [ + { + "type": "ExpressionStatement", + "start":463,"end":483,"loc":{"start":{"line":40,"column":2},"end":{"line":41,"column":7}}, + "expression": { + "type": "MemberExpression", + "start":463,"end":482,"loc":{"start":{"line":40,"column":2},"end":{"line":41,"column":6}}, + "object": { + "type": "StringLiteral", + "start":463,"end":475,"loc":{"start":{"line":40,"column":2},"end":{"line":40,"column":14}}, + "extra": { + "rawValue": "use strict", + "raw": "\"use strict\"" + }, + "value": "use strict" + }, + "property": { + "type": "Identifier", + "start":479,"end":482,"loc":{"start":{"line":41,"column":3},"end":{"line":41,"column":6},"identifierName":"foo"}, + "name": "foo" + }, + "computed": false + } + }, + { + "type": "ExpressionStatement", + "start":486,"end":491,"loc":{"start":{"line":42,"column":2},"end":{"line":42,"column":7}}, + "expression": { + "type": "StringLiteral", + "start":486,"end":490,"loc":{"start":{"line":42,"column":2},"end":{"line":42,"column":6}}, + "extra": { + "rawValue": "\u0005", + "raw": "\"\\5\"" + }, + "value": "\u0005" + } + } + ], + "directives": [] + } + }, + { + "type": "FunctionDeclaration", + "start":495,"end":542,"loc":{"start":{"line":45,"column":0},"end":{"line":49,"column":1}}, + "id": { + "type": "Identifier", + "start":504,"end":505,"loc":{"start":{"line":45,"column":9},"end":{"line":45,"column":10},"identifierName":"f"}, + "name": "f" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":507,"end":542,"loc":{"start":{"line":45,"column":12},"end":{"line":49,"column":1}}, + "body": [ + { + "type": "ExpressionStatement", + "start":511,"end":532,"loc":{"start":{"line":46,"column":2},"end":{"line":47,"column":8}}, + "expression": { + "type": "MemberExpression", + "start":511,"end":531,"loc":{"start":{"line":46,"column":2},"end":{"line":47,"column":7}}, + "object": { + "type": "StringLiteral", + "start":511,"end":523,"loc":{"start":{"line":46,"column":2},"end":{"line":46,"column":14}}, + "extra": { + "rawValue": "use strict", + "raw": "\"use strict\"" + }, + "value": "use strict" + }, + "property": { + "type": "Identifier", + "start":527,"end":530,"loc":{"start":{"line":47,"column":3},"end":{"line":47,"column":6},"identifierName":"foo"}, + "name": "foo" + }, + "computed": true + } + }, + { + "type": "ExpressionStatement", + "start":535,"end":540,"loc":{"start":{"line":48,"column":2},"end":{"line":48,"column":7}}, + "expression": { + "type": "StringLiteral", + "start":535,"end":539,"loc":{"start":{"line":48,"column":2},"end":{"line":48,"column":6}}, + "extra": { + "rawValue": "\u0005", + "raw": "\"\\5\"" + }, + "value": "\u0005" + } + } + ], + "directives": [] + } + }, + { + "type": "FunctionDeclaration", + "start":544,"end":591,"loc":{"start":{"line":51,"column":0},"end":{"line":55,"column":1}}, + "id": { + "type": "Identifier", + "start":553,"end":554,"loc":{"start":{"line":51,"column":9},"end":{"line":51,"column":10},"identifierName":"f"}, + "name": "f" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":556,"end":591,"loc":{"start":{"line":51,"column":12},"end":{"line":55,"column":1}}, + "body": [ + { + "type": "ExpressionStatement", + "start":560,"end":581,"loc":{"start":{"line":52,"column":2},"end":{"line":53,"column":8}}, + "expression": { + "type": "TaggedTemplateExpression", + "start":560,"end":580,"loc":{"start":{"line":52,"column":2},"end":{"line":53,"column":7}}, + "tag": { + "type": "StringLiteral", + "start":560,"end":572,"loc":{"start":{"line":52,"column":2},"end":{"line":52,"column":14}}, + "extra": { + "rawValue": "use strict", + "raw": "\"use strict\"" + }, + "value": "use strict" + }, + "quasi": { + "type": "TemplateLiteral", + "start":575,"end":580,"loc":{"start":{"line":53,"column":2},"end":{"line":53,"column":7}}, + "expressions": [], + "quasis": [ + { + "type": "TemplateElement", + "start":576,"end":579,"loc":{"start":{"line":53,"column":3},"end":{"line":53,"column":6}}, + "value": { + "raw": "foo", + "cooked": "foo" + }, + "tail": true + } + ] + } + } + }, + { + "type": "ExpressionStatement", + "start":584,"end":589,"loc":{"start":{"line":54,"column":2},"end":{"line":54,"column":7}}, + "expression": { + "type": "StringLiteral", + "start":584,"end":588,"loc":{"start":{"line":54,"column":2},"end":{"line":54,"column":6}}, + "extra": { + "rawValue": "\u0005", + "raw": "\"\\5\"" + }, + "value": "\u0005" + } + } + ], + "directives": [] + } + }, + { + "type": "FunctionDeclaration", + "start":593,"end":640,"loc":{"start":{"line":57,"column":0},"end":{"line":61,"column":1}}, + "id": { + "type": "Identifier", + "start":602,"end":603,"loc":{"start":{"line":57,"column":9},"end":{"line":57,"column":10},"identifierName":"f"}, + "name": "f" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":605,"end":640,"loc":{"start":{"line":57,"column":12},"end":{"line":61,"column":1}}, + "body": [ + { + "type": "ExpressionStatement", + "start":609,"end":630,"loc":{"start":{"line":58,"column":2},"end":{"line":59,"column":8}}, + "expression": { + "type": "CallExpression", + "start":609,"end":629,"loc":{"start":{"line":58,"column":2},"end":{"line":59,"column":7}}, + "callee": { + "type": "StringLiteral", + "start":609,"end":621,"loc":{"start":{"line":58,"column":2},"end":{"line":58,"column":14}}, + "extra": { + "rawValue": "use strict", + "raw": "\"use strict\"" + }, + "value": "use strict" + }, + "arguments": [ + { + "type": "Identifier", + "start":625,"end":628,"loc":{"start":{"line":59,"column":3},"end":{"line":59,"column":6},"identifierName":"foo"}, + "name": "foo" + } + ] + } + }, + { + "type": "ExpressionStatement", + "start":633,"end":638,"loc":{"start":{"line":60,"column":2},"end":{"line":60,"column":7}}, + "expression": { + "type": "StringLiteral", + "start":633,"end":637,"loc":{"start":{"line":60,"column":2},"end":{"line":60,"column":6}}, + "extra": { + "rawValue": "\u0005", + "raw": "\"\\5\"" + }, + "value": "\u0005" + } + } + ], + "directives": [] + } + }, + { + "type": "FunctionDeclaration", + "start":642,"end":694,"loc":{"start":{"line":63,"column":0},"end":{"line":67,"column":1}}, + "id": { + "type": "Identifier", + "start":651,"end":652,"loc":{"start":{"line":63,"column":9},"end":{"line":63,"column":10},"identifierName":"f"}, + "name": "f" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":654,"end":694,"loc":{"start":{"line":63,"column":12},"end":{"line":67,"column":1}}, + "body": [ + { + "type": "ExpressionStatement", + "start":658,"end":664,"loc":{"start":{"line":64,"column":2},"end":{"line":64,"column":8}}, + "expression": { + "type": "CallExpression", + "start":658,"end":663,"loc":{"start":{"line":64,"column":2},"end":{"line":64,"column":7}}, + "callee": { + "type": "Identifier", + "start":658,"end":661,"loc":{"start":{"line":64,"column":2},"end":{"line":64,"column":5},"identifierName":"foo"}, + "name": "foo" + }, + "arguments": [] + } + }, + { + "type": "ExpressionStatement", + "start":667,"end":684,"loc":{"start":{"line":65,"column":2},"end":{"line":65,"column":19}}, + "expression": { + "type": "MemberExpression", + "start":667,"end":683,"loc":{"start":{"line":65,"column":2},"end":{"line":65,"column":18}}, + "object": { + "type": "StringLiteral", + "start":667,"end":679,"loc":{"start":{"line":65,"column":2},"end":{"line":65,"column":14}}, + "extra": { + "rawValue": "use strict", + "raw": "\"use strict\"" + }, + "value": "use strict" + }, + "property": { + "type": "Identifier", + "start":680,"end":683,"loc":{"start":{"line":65,"column":15},"end":{"line":65,"column":18},"identifierName":"bar"}, + "name": "bar" + }, + "computed": false + } + }, + { + "type": "ExpressionStatement", + "start":687,"end":692,"loc":{"start":{"line":66,"column":2},"end":{"line":66,"column":7}}, + "expression": { + "type": "StringLiteral", + "start":687,"end":691,"loc":{"start":{"line":66,"column":2},"end":{"line":66,"column":6}}, + "extra": { + "rawValue": "\u0005", + "raw": "\"\\5\"" + }, + "value": "\u0005" + } + } + ], + "directives": [] + } + }, + { + "type": "FunctionDeclaration", + "start":696,"end":749,"loc":{"start":{"line":69,"column":0},"end":{"line":73,"column":1}}, + "id": { + "type": "Identifier", + "start":705,"end":706,"loc":{"start":{"line":69,"column":9},"end":{"line":69,"column":10},"identifierName":"f"}, + "name": "f" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":708,"end":749,"loc":{"start":{"line":69,"column":12},"end":{"line":73,"column":1}}, + "body": [ + { + "type": "ExpressionStatement", + "start":712,"end":718,"loc":{"start":{"line":70,"column":2},"end":{"line":70,"column":8}}, + "expression": { + "type": "CallExpression", + "start":712,"end":717,"loc":{"start":{"line":70,"column":2},"end":{"line":70,"column":7}}, + "callee": { + "type": "Identifier", + "start":712,"end":715,"loc":{"start":{"line":70,"column":2},"end":{"line":70,"column":5},"identifierName":"foo"}, + "name": "foo" + }, + "arguments": [] + } + }, + { + "type": "ExpressionStatement", + "start":721,"end":739,"loc":{"start":{"line":71,"column":2},"end":{"line":71,"column":20}}, + "expression": { + "type": "MemberExpression", + "start":721,"end":738,"loc":{"start":{"line":71,"column":2},"end":{"line":71,"column":19}}, + "object": { + "type": "StringLiteral", + "start":721,"end":733,"loc":{"start":{"line":71,"column":2},"end":{"line":71,"column":14}}, + "extra": { + "rawValue": "use strict", + "raw": "\"use strict\"" + }, + "value": "use strict" + }, + "property": { + "type": "Identifier", + "start":734,"end":737,"loc":{"start":{"line":71,"column":15},"end":{"line":71,"column":18},"identifierName":"bar"}, + "name": "bar" + }, + "computed": true + } + }, + { + "type": "ExpressionStatement", + "start":742,"end":747,"loc":{"start":{"line":72,"column":2},"end":{"line":72,"column":7}}, + "expression": { + "type": "StringLiteral", + "start":742,"end":746,"loc":{"start":{"line":72,"column":2},"end":{"line":72,"column":6}}, + "extra": { + "rawValue": "\u0005", + "raw": "\"\\5\"" + }, + "value": "\u0005" + } + } + ], + "directives": [] + } + }, + { + "type": "FunctionDeclaration", + "start":751,"end":804,"loc":{"start":{"line":75,"column":0},"end":{"line":79,"column":1}}, + "id": { + "type": "Identifier", + "start":760,"end":761,"loc":{"start":{"line":75,"column":9},"end":{"line":75,"column":10},"identifierName":"f"}, + "name": "f" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":763,"end":804,"loc":{"start":{"line":75,"column":12},"end":{"line":79,"column":1}}, + "body": [ + { + "type": "ExpressionStatement", + "start":767,"end":773,"loc":{"start":{"line":76,"column":2},"end":{"line":76,"column":8}}, + "expression": { + "type": "CallExpression", + "start":767,"end":772,"loc":{"start":{"line":76,"column":2},"end":{"line":76,"column":7}}, + "callee": { + "type": "Identifier", + "start":767,"end":770,"loc":{"start":{"line":76,"column":2},"end":{"line":76,"column":5},"identifierName":"foo"}, + "name": "foo" + }, + "arguments": [] + } + }, + { + "type": "ExpressionStatement", + "start":776,"end":794,"loc":{"start":{"line":77,"column":2},"end":{"line":77,"column":20}}, + "expression": { + "type": "TaggedTemplateExpression", + "start":776,"end":793,"loc":{"start":{"line":77,"column":2},"end":{"line":77,"column":19}}, + "tag": { + "type": "StringLiteral", + "start":776,"end":788,"loc":{"start":{"line":77,"column":2},"end":{"line":77,"column":14}}, + "extra": { + "rawValue": "use strict", + "raw": "\"use strict\"" + }, + "value": "use strict" + }, + "quasi": { + "type": "TemplateLiteral", + "start":788,"end":793,"loc":{"start":{"line":77,"column":14},"end":{"line":77,"column":19}}, + "expressions": [], + "quasis": [ + { + "type": "TemplateElement", + "start":789,"end":792,"loc":{"start":{"line":77,"column":15},"end":{"line":77,"column":18}}, + "value": { + "raw": "bar", + "cooked": "bar" + }, + "tail": true + } + ] + } + } + }, + { + "type": "ExpressionStatement", + "start":797,"end":802,"loc":{"start":{"line":78,"column":2},"end":{"line":78,"column":7}}, + "expression": { + "type": "StringLiteral", + "start":797,"end":801,"loc":{"start":{"line":78,"column":2},"end":{"line":78,"column":6}}, + "extra": { + "rawValue": "\u0005", + "raw": "\"\\5\"" + }, + "value": "\u0005" + } + } + ], + "directives": [] + } + }, + { + "type": "FunctionDeclaration", + "start":806,"end":859,"loc":{"start":{"line":81,"column":0},"end":{"line":85,"column":1}}, + "id": { + "type": "Identifier", + "start":815,"end":816,"loc":{"start":{"line":81,"column":9},"end":{"line":81,"column":10},"identifierName":"f"}, + "name": "f" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":818,"end":859,"loc":{"start":{"line":81,"column":12},"end":{"line":85,"column":1}}, + "body": [ + { + "type": "ExpressionStatement", + "start":822,"end":828,"loc":{"start":{"line":82,"column":2},"end":{"line":82,"column":8}}, + "expression": { + "type": "CallExpression", + "start":822,"end":827,"loc":{"start":{"line":82,"column":2},"end":{"line":82,"column":7}}, + "callee": { + "type": "Identifier", + "start":822,"end":825,"loc":{"start":{"line":82,"column":2},"end":{"line":82,"column":5},"identifierName":"foo"}, + "name": "foo" + }, + "arguments": [] + } + }, + { + "type": "ExpressionStatement", + "start":831,"end":849,"loc":{"start":{"line":83,"column":2},"end":{"line":83,"column":20}}, + "expression": { + "type": "CallExpression", + "start":831,"end":848,"loc":{"start":{"line":83,"column":2},"end":{"line":83,"column":19}}, + "callee": { + "type": "StringLiteral", + "start":831,"end":843,"loc":{"start":{"line":83,"column":2},"end":{"line":83,"column":14}}, + "extra": { + "rawValue": "use strict", + "raw": "\"use strict\"" + }, + "value": "use strict" + }, + "arguments": [ + { + "type": "Identifier", + "start":844,"end":847,"loc":{"start":{"line":83,"column":15},"end":{"line":83,"column":18},"identifierName":"bar"}, + "name": "bar" + } + ] + } + }, + { + "type": "ExpressionStatement", + "start":852,"end":857,"loc":{"start":{"line":84,"column":2},"end":{"line":84,"column":7}}, + "expression": { + "type": "StringLiteral", + "start":852,"end":856,"loc":{"start":{"line":84,"column":2},"end":{"line":84,"column":6}}, + "extra": { + "rawValue": "\u0005", + "raw": "\"\\5\"" + }, + "value": "\u0005" + } + } + ], + "directives": [] + } + }, + { + "type": "FunctionDeclaration", + "start":861,"end":916,"loc":{"start":{"line":87,"column":0},"end":{"line":92,"column":1}}, + "id": { + "type": "Identifier", + "start":870,"end":871,"loc":{"start":{"line":87,"column":9},"end":{"line":87,"column":10},"identifierName":"f"}, + "name": "f" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":873,"end":916,"loc":{"start":{"line":87,"column":12},"end":{"line":92,"column":1}}, + "body": [ + { + "type": "ExpressionStatement", + "start":877,"end":883,"loc":{"start":{"line":88,"column":2},"end":{"line":88,"column":8}}, + "expression": { + "type": "CallExpression", + "start":877,"end":882,"loc":{"start":{"line":88,"column":2},"end":{"line":88,"column":7}}, + "callee": { + "type": "Identifier", + "start":877,"end":880,"loc":{"start":{"line":88,"column":2},"end":{"line":88,"column":5},"identifierName":"foo"}, + "name": "foo" + }, + "arguments": [] + } + }, + { + "type": "ExpressionStatement", + "start":886,"end":906,"loc":{"start":{"line":89,"column":2},"end":{"line":90,"column":7}}, + "expression": { + "type": "MemberExpression", + "start":886,"end":905,"loc":{"start":{"line":89,"column":2},"end":{"line":90,"column":6}}, + "object": { + "type": "StringLiteral", + "start":886,"end":898,"loc":{"start":{"line":89,"column":2},"end":{"line":89,"column":14}}, + "extra": { + "rawValue": "use strict", + "raw": "\"use strict\"" + }, + "value": "use strict" + }, + "property": { + "type": "Identifier", + "start":902,"end":905,"loc":{"start":{"line":90,"column":3},"end":{"line":90,"column":6},"identifierName":"bar"}, + "name": "bar" + }, + "computed": false + } + }, + { + "type": "ExpressionStatement", + "start":909,"end":914,"loc":{"start":{"line":91,"column":2},"end":{"line":91,"column":7}}, + "expression": { + "type": "StringLiteral", + "start":909,"end":913,"loc":{"start":{"line":91,"column":2},"end":{"line":91,"column":6}}, + "extra": { + "rawValue": "\u0005", + "raw": "\"\\5\"" + }, + "value": "\u0005" + } + } + ], + "directives": [] + } + }, + { + "type": "FunctionDeclaration", + "start":918,"end":974,"loc":{"start":{"line":94,"column":0},"end":{"line":99,"column":1}}, + "id": { + "type": "Identifier", + "start":927,"end":928,"loc":{"start":{"line":94,"column":9},"end":{"line":94,"column":10},"identifierName":"f"}, + "name": "f" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":930,"end":974,"loc":{"start":{"line":94,"column":12},"end":{"line":99,"column":1}}, + "body": [ + { + "type": "ExpressionStatement", + "start":934,"end":940,"loc":{"start":{"line":95,"column":2},"end":{"line":95,"column":8}}, + "expression": { + "type": "CallExpression", + "start":934,"end":939,"loc":{"start":{"line":95,"column":2},"end":{"line":95,"column":7}}, + "callee": { + "type": "Identifier", + "start":934,"end":937,"loc":{"start":{"line":95,"column":2},"end":{"line":95,"column":5},"identifierName":"foo"}, + "name": "foo" + }, + "arguments": [] + } + }, + { + "type": "ExpressionStatement", + "start":943,"end":964,"loc":{"start":{"line":96,"column":2},"end":{"line":97,"column":8}}, + "expression": { + "type": "MemberExpression", + "start":943,"end":963,"loc":{"start":{"line":96,"column":2},"end":{"line":97,"column":7}}, + "object": { + "type": "StringLiteral", + "start":943,"end":955,"loc":{"start":{"line":96,"column":2},"end":{"line":96,"column":14}}, + "extra": { + "rawValue": "use strict", + "raw": "\"use strict\"" + }, + "value": "use strict" + }, + "property": { + "type": "Identifier", + "start":959,"end":962,"loc":{"start":{"line":97,"column":3},"end":{"line":97,"column":6},"identifierName":"bar"}, + "name": "bar" + }, + "computed": true + } + }, + { + "type": "ExpressionStatement", + "start":967,"end":972,"loc":{"start":{"line":98,"column":2},"end":{"line":98,"column":7}}, + "expression": { + "type": "StringLiteral", + "start":967,"end":971,"loc":{"start":{"line":98,"column":2},"end":{"line":98,"column":6}}, + "extra": { + "rawValue": "\u0005", + "raw": "\"\\5\"" + }, + "value": "\u0005" + } + } + ], + "directives": [] + } + }, + { + "type": "FunctionDeclaration", + "start":976,"end":1032,"loc":{"start":{"line":101,"column":0},"end":{"line":106,"column":1}}, + "id": { + "type": "Identifier", + "start":985,"end":986,"loc":{"start":{"line":101,"column":9},"end":{"line":101,"column":10},"identifierName":"f"}, + "name": "f" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":988,"end":1032,"loc":{"start":{"line":101,"column":12},"end":{"line":106,"column":1}}, + "body": [ + { + "type": "ExpressionStatement", + "start":992,"end":998,"loc":{"start":{"line":102,"column":2},"end":{"line":102,"column":8}}, + "expression": { + "type": "CallExpression", + "start":992,"end":997,"loc":{"start":{"line":102,"column":2},"end":{"line":102,"column":7}}, + "callee": { + "type": "Identifier", + "start":992,"end":995,"loc":{"start":{"line":102,"column":2},"end":{"line":102,"column":5},"identifierName":"foo"}, + "name": "foo" + }, + "arguments": [] + } + }, + { + "type": "ExpressionStatement", + "start":1001,"end":1022,"loc":{"start":{"line":103,"column":2},"end":{"line":104,"column":8}}, + "expression": { + "type": "TaggedTemplateExpression", + "start":1001,"end":1021,"loc":{"start":{"line":103,"column":2},"end":{"line":104,"column":7}}, + "tag": { + "type": "StringLiteral", + "start":1001,"end":1013,"loc":{"start":{"line":103,"column":2},"end":{"line":103,"column":14}}, + "extra": { + "rawValue": "use strict", + "raw": "\"use strict\"" + }, + "value": "use strict" + }, + "quasi": { + "type": "TemplateLiteral", + "start":1016,"end":1021,"loc":{"start":{"line":104,"column":2},"end":{"line":104,"column":7}}, + "expressions": [], + "quasis": [ + { + "type": "TemplateElement", + "start":1017,"end":1020,"loc":{"start":{"line":104,"column":3},"end":{"line":104,"column":6}}, + "value": { + "raw": "bar", + "cooked": "bar" + }, + "tail": true + } + ] + } + } + }, + { + "type": "ExpressionStatement", + "start":1025,"end":1030,"loc":{"start":{"line":105,"column":2},"end":{"line":105,"column":7}}, + "expression": { + "type": "StringLiteral", + "start":1025,"end":1029,"loc":{"start":{"line":105,"column":2},"end":{"line":105,"column":6}}, + "extra": { + "rawValue": "\u0005", + "raw": "\"\\5\"" + }, + "value": "\u0005" + } + } + ], + "directives": [] + } + }, + { + "type": "FunctionDeclaration", + "start":1034,"end":1090,"loc":{"start":{"line":108,"column":0},"end":{"line":113,"column":1}}, + "id": { + "type": "Identifier", + "start":1043,"end":1044,"loc":{"start":{"line":108,"column":9},"end":{"line":108,"column":10},"identifierName":"f"}, + "name": "f" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":1046,"end":1090,"loc":{"start":{"line":108,"column":12},"end":{"line":113,"column":1}}, + "body": [ + { + "type": "ExpressionStatement", + "start":1050,"end":1056,"loc":{"start":{"line":109,"column":2},"end":{"line":109,"column":8}}, + "expression": { + "type": "CallExpression", + "start":1050,"end":1055,"loc":{"start":{"line":109,"column":2},"end":{"line":109,"column":7}}, + "callee": { + "type": "Identifier", + "start":1050,"end":1053,"loc":{"start":{"line":109,"column":2},"end":{"line":109,"column":5},"identifierName":"foo"}, + "name": "foo" + }, + "arguments": [] + } + }, + { + "type": "ExpressionStatement", + "start":1059,"end":1080,"loc":{"start":{"line":110,"column":2},"end":{"line":111,"column":8}}, + "expression": { + "type": "CallExpression", + "start":1059,"end":1079,"loc":{"start":{"line":110,"column":2},"end":{"line":111,"column":7}}, + "callee": { + "type": "StringLiteral", + "start":1059,"end":1071,"loc":{"start":{"line":110,"column":2},"end":{"line":110,"column":14}}, + "extra": { + "rawValue": "use strict", + "raw": "\"use strict\"" + }, + "value": "use strict" + }, + "arguments": [ + { + "type": "Identifier", + "start":1075,"end":1078,"loc":{"start":{"line":111,"column":3},"end":{"line":111,"column":6},"identifierName":"bar"}, + "name": "bar" + } + ] + } + }, + { + "type": "ExpressionStatement", + "start":1083,"end":1088,"loc":{"start":{"line":112,"column":2},"end":{"line":112,"column":7}}, + "expression": { + "type": "StringLiteral", + "start":1083,"end":1087,"loc":{"start":{"line":112,"column":2},"end":{"line":112,"column":6}}, + "extra": { + "rawValue": "\u0005", + "raw": "\"\\5\"" + }, + "value": "\u0005" + } + } + ], + "directives": [] + } + }, + { + "type": "FunctionDeclaration", + "start":1092,"end":1129,"loc":{"start":{"line":115,"column":0},"end":{"line":118,"column":1}}, + "id": { + "type": "Identifier", + "start":1101,"end":1102,"loc":{"start":{"line":115,"column":9},"end":{"line":115,"column":10},"identifierName":"f"}, + "name": "f" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":1104,"end":1129,"loc":{"start":{"line":115,"column":12},"end":{"line":118,"column":1}}, + "body": [ + { + "type": "ExpressionStatement", + "start":1108,"end":1111,"loc":{"start":{"line":116,"column":2},"end":{"line":116,"column":5}}, + "expression": { + "type": "NumericLiteral", + "start":1108,"end":1110,"loc":{"start":{"line":116,"column":2},"end":{"line":116,"column":4}}, + "extra": { + "rawValue": 5, + "raw": "05" + }, + "value": 5 + } + }, + { + "type": "ExpressionStatement", + "start":1114,"end":1127,"loc":{"start":{"line":117,"column":2},"end":{"line":117,"column":15}}, + "expression": { + "type": "StringLiteral", + "start":1114,"end":1126,"loc":{"start":{"line":117,"column":2},"end":{"line":117,"column":14}}, + "extra": { + "rawValue": "use strict", + "raw": "\"use strict\"" + }, + "value": "use strict" + } + } + ], + "directives": [] } } ], "directives": [] - } + }, + "comments": [ + { + "type": "CommentLine", + "value": " Should not be a syntax error because should not be parsed in strict mode.", + "start":180,"end":256,"loc":{"start":{"line":16,"column":0},"end":{"line":16,"column":76}} + } + ] } \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/categorized/regex-after-block/output.json b/packages/babel-parser/test/fixtures/core/categorized/regex-after-block/output.json index 23d47e802bd1..e1770c6a4c76 100644 --- a/packages/babel-parser/test/fixtures/core/categorized/regex-after-block/output.json +++ b/packages/babel-parser/test/fixtures/core/categorized/regex-after-block/output.json @@ -1,78 +1,23 @@ { "type": "File", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 5 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":5}}, "program": { "type": "Program", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 5 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":5}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "IfStatement", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 1 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":1}}, "test": { "type": "BooleanLiteral", - "start": 4, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":4,"end":8,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":8}}, "value": true }, "consequent": { "type": "BlockStatement", - "start": 10, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 2, - "column": 1 - } - }, + "start":10,"end":13,"loc":{"start":{"line":1,"column":10},"end":{"line":2,"column":1}}, "body": [], "directives": [] }, @@ -80,32 +25,10 @@ }, { "type": "ExpressionStatement", - "start": 15, - "end": 20, - "loc": { - "start": { - "line": 4, - "column": 0 - }, - "end": { - "line": 4, - "column": 5 - } - }, + "start":15,"end":20,"loc":{"start":{"line":4,"column":0},"end":{"line":4,"column":5}}, "expression": { "type": "RegExpLiteral", - "start": 15, - "end": 20, - "loc": { - "start": { - "line": 4, - "column": 0 - }, - "end": { - "line": 4, - "column": 5 - } - }, + "start":15,"end":20,"loc":{"start":{"line":4,"column":0},"end":{"line":4,"column":5}}, "extra": { "raw": "/foo/" }, diff --git a/packages/babel-parser/test/fixtures/core/categorized/regex-after-star/input.js b/packages/babel-parser/test/fixtures/core/categorized/regex-after-star/input.js new file mode 100644 index 000000000000..9a85649c5bfc --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/categorized/regex-after-star/input.js @@ -0,0 +1 @@ +a * /b/ diff --git a/packages/babel-parser/test/fixtures/core/categorized/regex-after-star/output.json b/packages/babel-parser/test/fixtures/core/categorized/regex-after-star/output.json new file mode 100644 index 000000000000..2e01bf74071e --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/categorized/regex-after-star/output.json @@ -0,0 +1,36 @@ +{ + "type": "File", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "program": { + "type": "Program", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "expression": { + "type": "BinaryExpression", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "left": { + "type": "Identifier", + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"a"}, + "name": "a" + }, + "operator": "*", + "right": { + "type": "RegExpLiteral", + "start":4,"end":7,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":7}}, + "extra": { + "raw": "/b/" + }, + "pattern": "b", + "flags": "" + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/categorized/startline-specified/output.json b/packages/babel-parser/test/fixtures/core/categorized/startline-specified/output.json index 586292ca2455..891dfcf410e9 100644 --- a/packages/babel-parser/test/fixtures/core/categorized/startline-specified/output.json +++ b/packages/babel-parser/test/fixtures/core/categorized/startline-specified/output.json @@ -1,94 +1,27 @@ { "type": "File", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 4, - "column": 7 - } - }, + "start":0,"end":16,"loc":{"start":{"line":3,"column":0},"end":{"line":4,"column":7}}, "program": { "type": "Program", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 4, - "column": 7 - } - }, + "start":0,"end":16,"loc":{"start":{"line":3,"column":0},"end":{"line":4,"column":7}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 8 - } - }, + "start":0,"end":8,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":8}}, "expression": { "type": "CallExpression", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":7}}, "callee": { "type": "Identifier", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 4 - }, - "identifierName": "call" - }, + "start":0,"end":4,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":4},"identifierName":"call"}, "name": "call" }, "arguments": [ { "type": "NumericLiteral", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 3, - "column": 5 - }, - "end": { - "line": 3, - "column": 6 - } - }, + "start":5,"end":6,"loc":{"start":{"line":3,"column":5},"end":{"line":3,"column":6}}, "extra": { "rawValue": 1, "raw": "1" @@ -100,64 +33,19 @@ }, { "type": "ExpressionStatement", - "start": 9, - "end": 16, - "loc": { - "start": { - "line": 4, - "column": 0 - }, - "end": { - "line": 4, - "column": 7 - } - }, + "start":9,"end":16,"loc":{"start":{"line":4,"column":0},"end":{"line":4,"column":7}}, "expression": { "type": "CallExpression", - "start": 9, - "end": 15, - "loc": { - "start": { - "line": 4, - "column": 0 - }, - "end": { - "line": 4, - "column": 6 - } - }, + "start":9,"end":15,"loc":{"start":{"line":4,"column":0},"end":{"line":4,"column":6}}, "callee": { "type": "Identifier", - "start": 9, - "end": 12, - "loc": { - "start": { - "line": 4, - "column": 0 - }, - "end": { - "line": 4, - "column": 3 - }, - "identifierName": "run" - }, + "start":9,"end":12,"loc":{"start":{"line":4,"column":0},"end":{"line":4,"column":3},"identifierName":"run"}, "name": "run" }, "arguments": [ { "type": "NumericLiteral", - "start": 13, - "end": 14, - "loc": { - "start": { - "line": 4, - "column": 4 - }, - "end": { - "line": 4, - "column": 5 - } - }, + "start":13,"end":14,"loc":{"start":{"line":4,"column":4},"end":{"line":4,"column":5}}, "extra": { "rawValue": 2, "raw": "2" diff --git a/packages/babel-parser/test/fixtures/core/categorized/valid-assignment-pattern-1/input.js b/packages/babel-parser/test/fixtures/core/categorized/valid-assignment-pattern-1/input.js new file mode 100644 index 000000000000..821f2c5a3c37 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/categorized/valid-assignment-pattern-1/input.js @@ -0,0 +1 @@ +[(a.x)] = t; \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/categorized/valid-assignment-pattern-1/output.json b/packages/babel-parser/test/fixtures/core/categorized/valid-assignment-pattern-1/output.json new file mode 100644 index 000000000000..1285d54959ad --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/categorized/valid-assignment-pattern-1/output.json @@ -0,0 +1,52 @@ +{ + "type": "File", + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "program": { + "type": "Program", + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "expression": { + "type": "AssignmentExpression", + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "operator": "=", + "left": { + "type": "ArrayPattern", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "elements": [ + { + "type": "MemberExpression", + "start":2,"end":5,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":5}}, + "object": { + "type": "Identifier", + "start":2,"end":3,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":3},"identifierName":"a"}, + "name": "a" + }, + "property": { + "type": "Identifier", + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"x"}, + "name": "x" + }, + "computed": false, + "extra": { + "parenthesized": true, + "parenStart": 1 + } + } + ] + }, + "right": { + "type": "Identifier", + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11},"identifierName":"t"}, + "name": "t" + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/categorized/valid-assignment-pattern-2/input.js b/packages/babel-parser/test/fixtures/core/categorized/valid-assignment-pattern-2/input.js new file mode 100644 index 000000000000..d2e8408e783a --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/categorized/valid-assignment-pattern-2/input.js @@ -0,0 +1 @@ +[(x)] = t; \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/categorized/valid-assignment-pattern-2/output.json b/packages/babel-parser/test/fixtures/core/categorized/valid-assignment-pattern-2/output.json new file mode 100644 index 000000000000..f4b1a1782cd5 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/categorized/valid-assignment-pattern-2/output.json @@ -0,0 +1,42 @@ +{ + "type": "File", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "program": { + "type": "Program", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "expression": { + "type": "AssignmentExpression", + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "operator": "=", + "left": { + "type": "ArrayPattern", + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, + "elements": [ + { + "type": "Identifier", + "start":2,"end":3,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":3},"identifierName":"x"}, + "name": "x", + "extra": { + "parenthesized": true, + "parenStart": 1 + } + } + ] + }, + "right": { + "type": "Identifier", + "start":8,"end":9,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":9},"identifierName":"t"}, + "name": "t" + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/categorized/valid-assignment-pattern-3/input.js b/packages/babel-parser/test/fixtures/core/categorized/valid-assignment-pattern-3/input.js new file mode 100644 index 000000000000..320748c0282f --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/categorized/valid-assignment-pattern-3/input.js @@ -0,0 +1 @@ +[(((x)))] = t; \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/categorized/valid-assignment-pattern-3/output.json b/packages/babel-parser/test/fixtures/core/categorized/valid-assignment-pattern-3/output.json new file mode 100644 index 000000000000..36a3fb0ada88 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/categorized/valid-assignment-pattern-3/output.json @@ -0,0 +1,42 @@ +{ + "type": "File", + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, + "program": { + "type": "Program", + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, + "expression": { + "type": "AssignmentExpression", + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "operator": "=", + "left": { + "type": "ArrayPattern", + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "elements": [ + { + "type": "Identifier", + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"x"}, + "name": "x", + "extra": { + "parenthesized": true, + "parenStart": 1 + } + } + ] + }, + "right": { + "type": "Identifier", + "start":12,"end":13,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":13},"identifierName":"t"}, + "name": "t" + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/invalid-parenthesized-assignment-pattern-2/input.js b/packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/invalid-parenthesized-assignment-pattern-2/input.js new file mode 100644 index 000000000000..2181f4c1d572 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/invalid-parenthesized-assignment-pattern-2/input.js @@ -0,0 +1 @@ +[{b: [([a = 1])]}] = t \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/557/options.json b/packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/invalid-parenthesized-assignment-pattern-2/options.json similarity index 100% rename from packages/babel-parser/test/fixtures/core/uncategorised/557/options.json rename to packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/invalid-parenthesized-assignment-pattern-2/options.json diff --git a/packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/invalid-parenthesized-assignment-pattern-2/output.json b/packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/invalid-parenthesized-assignment-pattern-2/output.json new file mode 100644 index 000000000000..a71d68fda717 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/invalid-parenthesized-assignment-pattern-2/output.json @@ -0,0 +1,88 @@ +{ + "type": "File", + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, + "errors": [ + "SyntaxError: Invalid parenthesized assignment pattern (1:6)" + ], + "program": { + "type": "Program", + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, + "expression": { + "type": "AssignmentExpression", + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, + "operator": "=", + "left": { + "type": "ArrayPattern", + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, + "elements": [ + { + "type": "ObjectPattern", + "start":1,"end":17,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":17}}, + "properties": [ + { + "type": "ObjectProperty", + "start":2,"end":16,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":16}}, + "method": false, + "key": { + "type": "Identifier", + "start":2,"end":3,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":3},"identifierName":"b"}, + "name": "b" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "ArrayPattern", + "start":5,"end":16,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":16}}, + "elements": [ + { + "type": "ParenthesizedExpression", + "start":6,"end":15,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":15}}, + "expression": { + "type": "ArrayPattern", + "start":7,"end":14,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":14}}, + "elements": [ + { + "type": "AssignmentPattern", + "start":8,"end":13,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":13}}, + "left": { + "type": "Identifier", + "start":8,"end":9,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":9},"identifierName":"a"}, + "name": "a" + }, + "right": { + "type": "NumericLiteral", + "start":12,"end":13,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":13}}, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + ] + } + } + ] + } + } + ] + } + ] + }, + "right": { + "type": "Identifier", + "start":21,"end":22,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":22},"identifierName":"t"}, + "name": "t" + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/invalid-parenthesized-assignment-pattern-3/input.js b/packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/invalid-parenthesized-assignment-pattern-3/input.js new file mode 100644 index 000000000000..18b5e0796da0 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/invalid-parenthesized-assignment-pattern-3/input.js @@ -0,0 +1 @@ +[({ a: [b = 2]})] = t \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/invalid-parenthesized-assignment-pattern-3/options.json b/packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/invalid-parenthesized-assignment-pattern-3/options.json new file mode 100644 index 000000000000..0861962d889d --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/invalid-parenthesized-assignment-pattern-3/options.json @@ -0,0 +1,3 @@ +{ + "createParenthesizedExpressions": true +} diff --git a/packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/invalid-parenthesized-assignment-pattern-3/output.json b/packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/invalid-parenthesized-assignment-pattern-3/output.json new file mode 100644 index 000000000000..27220d222a07 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/invalid-parenthesized-assignment-pattern-3/output.json @@ -0,0 +1,82 @@ +{ + "type": "File", + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, + "errors": [ + "SyntaxError: Invalid parenthesized assignment pattern (1:1)" + ], + "program": { + "type": "Program", + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, + "expression": { + "type": "AssignmentExpression", + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, + "operator": "=", + "left": { + "type": "ArrayPattern", + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, + "elements": [ + { + "type": "ParenthesizedExpression", + "start":1,"end":16,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":16}}, + "expression": { + "type": "ObjectPattern", + "start":2,"end":15,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":15}}, + "properties": [ + { + "type": "ObjectProperty", + "start":4,"end":14,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":14}}, + "method": false, + "key": { + "type": "Identifier", + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"a"}, + "name": "a" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "ArrayPattern", + "start":7,"end":14,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":14}}, + "elements": [ + { + "type": "AssignmentPattern", + "start":8,"end":13,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":13}}, + "left": { + "type": "Identifier", + "start":8,"end":9,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":9},"identifierName":"b"}, + "name": "b" + }, + "right": { + "type": "NumericLiteral", + "start":12,"end":13,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":13}}, + "extra": { + "rawValue": 2, + "raw": "2" + }, + "value": 2 + } + } + ] + } + } + ] + } + } + ] + }, + "right": { + "type": "Identifier", + "start":20,"end":21,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":21},"identifierName":"t"}, + "name": "t" + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/invalid-parenthesized-assignment-pattern-4/input.js b/packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/invalid-parenthesized-assignment-pattern-4/input.js new file mode 100644 index 000000000000..93c05a981b37 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/invalid-parenthesized-assignment-pattern-4/input.js @@ -0,0 +1 @@ +[(a = 1)] = t \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/invalid-parenthesized-assignment-pattern-4/options.json b/packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/invalid-parenthesized-assignment-pattern-4/options.json new file mode 100644 index 000000000000..0861962d889d --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/invalid-parenthesized-assignment-pattern-4/options.json @@ -0,0 +1,3 @@ +{ + "createParenthesizedExpressions": true +} diff --git a/packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/invalid-parenthesized-assignment-pattern-4/output.json b/packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/invalid-parenthesized-assignment-pattern-4/output.json new file mode 100644 index 000000000000..7f0500a929df --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/invalid-parenthesized-assignment-pattern-4/output.json @@ -0,0 +1,58 @@ +{ + "type": "File", + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "errors": [ + "SyntaxError: Invalid parenthesized assignment pattern (1:1)" + ], + "program": { + "type": "Program", + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "expression": { + "type": "AssignmentExpression", + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "operator": "=", + "left": { + "type": "ArrayPattern", + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "elements": [ + { + "type": "ParenthesizedExpression", + "start":1,"end":8,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":8}}, + "expression": { + "type": "AssignmentPattern", + "start":2,"end":7,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":7}}, + "left": { + "type": "Identifier", + "start":2,"end":3,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":3},"identifierName":"a"}, + "name": "a" + }, + "right": { + "type": "NumericLiteral", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7}}, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + } + ] + }, + "right": { + "type": "Identifier", + "start":12,"end":13,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":13},"identifierName":"t"}, + "name": "t" + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/invalid-parenthesized-assignment-pattern-5/input.js b/packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/invalid-parenthesized-assignment-pattern-5/input.js new file mode 100644 index 000000000000..0a7f8682331a --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/invalid-parenthesized-assignment-pattern-5/input.js @@ -0,0 +1 @@ +(a = 1) = t \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/invalid-parenthesized-assignment-pattern-5/options.json b/packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/invalid-parenthesized-assignment-pattern-5/options.json new file mode 100644 index 000000000000..0861962d889d --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/invalid-parenthesized-assignment-pattern-5/options.json @@ -0,0 +1,3 @@ +{ + "createParenthesizedExpressions": true +} diff --git a/packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/invalid-parenthesized-assignment-pattern-5/output.json b/packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/invalid-parenthesized-assignment-pattern-5/output.json new file mode 100644 index 000000000000..bec89d06786c --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/invalid-parenthesized-assignment-pattern-5/output.json @@ -0,0 +1,52 @@ +{ + "type": "File", + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "errors": [ + "SyntaxError: Invalid parenthesized assignment pattern (1:0)" + ], + "program": { + "type": "Program", + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "expression": { + "type": "AssignmentExpression", + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "operator": "=", + "left": { + "type": "ParenthesizedExpression", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "expression": { + "type": "AssignmentPattern", + "start":1,"end":6,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":6}}, + "left": { + "type": "Identifier", + "start":1,"end":2,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":2},"identifierName":"a"}, + "name": "a" + }, + "right": { + "type": "NumericLiteral", + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + }, + "right": { + "type": "Identifier", + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11},"identifierName":"t"}, + "name": "t" + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/558/input.js b/packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/invalid-parenthesized-assignment-pattern-6/input.js similarity index 100% rename from packages/babel-parser/test/fixtures/core/uncategorised/558/input.js rename to packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/invalid-parenthesized-assignment-pattern-6/input.js diff --git a/packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/invalid-parenthesized-assignment-pattern-6/options.json b/packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/invalid-parenthesized-assignment-pattern-6/options.json new file mode 100644 index 000000000000..0861962d889d --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/invalid-parenthesized-assignment-pattern-6/options.json @@ -0,0 +1,3 @@ +{ + "createParenthesizedExpressions": true +} diff --git a/packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/invalid-parenthesized-assignment-pattern-6/output.json b/packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/invalid-parenthesized-assignment-pattern-6/output.json new file mode 100644 index 000000000000..49fc67ea3f47 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/invalid-parenthesized-assignment-pattern-6/output.json @@ -0,0 +1,45 @@ +{ + "type": "File", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "errors": [ + "SyntaxError: Invalid parenthesized assignment pattern (1:0)" + ], + "program": { + "type": "Program", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "expression": { + "type": "AssignmentExpression", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "operator": "=", + "left": { + "type": "ParenthesizedExpression", + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, + "expression": { + "type": "ArrayPattern", + "start":1,"end":4,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":4}}, + "elements": [ + { + "type": "Identifier", + "start":2,"end":3,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":3},"identifierName":"a"}, + "name": "a" + } + ] + } + }, + "right": { + "type": "ArrayExpression", + "start":8,"end":10,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":10}}, + "elements": [] + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/556/input.js b/packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/invalid-parenthesized-assignment-pattern/input.js similarity index 100% rename from packages/babel-parser/test/fixtures/core/uncategorised/556/input.js rename to packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/invalid-parenthesized-assignment-pattern/input.js diff --git a/packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/invalid-parenthesized-assignment-pattern/options.json b/packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/invalid-parenthesized-assignment-pattern/options.json new file mode 100644 index 000000000000..0861962d889d --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/invalid-parenthesized-assignment-pattern/options.json @@ -0,0 +1,3 @@ +{ + "createParenthesizedExpressions": true +} diff --git a/packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/invalid-parenthesized-assignment-pattern/output.json b/packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/invalid-parenthesized-assignment-pattern/output.json new file mode 100644 index 000000000000..3d1d9274415d --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/invalid-parenthesized-assignment-pattern/output.json @@ -0,0 +1,82 @@ +{ + "type": "File", + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, + "errors": [ + "SyntaxError: Invalid parenthesized assignment pattern (1:0)" + ], + "program": { + "type": "Program", + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, + "expression": { + "type": "AssignmentExpression", + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, + "operator": "=", + "left": { + "type": "ParenthesizedExpression", + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, + "expression": { + "type": "ObjectPattern", + "start":1,"end":4,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":4}}, + "properties": [ + { + "type": "ObjectProperty", + "start":2,"end":3,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":3}}, + "method": false, + "key": { + "type": "Identifier", + "start":2,"end":3,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":3},"identifierName":"x"}, + "name": "x" + }, + "computed": false, + "shorthand": true, + "value": { + "type": "Identifier", + "start":2,"end":3,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":3},"identifierName":"x"}, + "name": "x" + }, + "extra": { + "shorthand": true + } + } + ] + } + }, + "right": { + "type": "ObjectExpression", + "start":8,"end":14,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":14}}, + "properties": [ + { + "type": "ObjectProperty", + "start":9,"end":13,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":13}}, + "method": false, + "key": { + "type": "Identifier", + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"x"}, + "name": "x" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "NumericLiteral", + "start":12,"end":13,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":13}}, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + ] + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/invalid-parenthesized-left-hand-side/input.js b/packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/invalid-parenthesized-left-hand-side/input.js new file mode 100644 index 000000000000..0c1c60bc67a9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/invalid-parenthesized-left-hand-side/input.js @@ -0,0 +1 @@ +(!a) += 1 diff --git a/packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/invalid-parenthesized-left-hand-side/options.json b/packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/invalid-parenthesized-left-hand-side/options.json new file mode 100644 index 000000000000..0861962d889d --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/invalid-parenthesized-left-hand-side/options.json @@ -0,0 +1,3 @@ +{ + "createParenthesizedExpressions": true +} diff --git a/packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/invalid-parenthesized-left-hand-side/output.json b/packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/invalid-parenthesized-left-hand-side/output.json new file mode 100644 index 000000000000..342a51f0b192 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/invalid-parenthesized-left-hand-side/output.json @@ -0,0 +1,49 @@ +{ + "type": "File", + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "errors": [ + "SyntaxError: Invalid left-hand side in parenthesized expression (1:1)" + ], + "program": { + "type": "Program", + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "expression": { + "type": "AssignmentExpression", + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "operator": "+=", + "left": { + "type": "ParenthesizedExpression", + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, + "expression": { + "type": "UnaryExpression", + "start":1,"end":3,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":3}}, + "operator": "!", + "prefix": true, + "argument": { + "type": "Identifier", + "start":2,"end":3,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":3},"identifierName":"a"}, + "name": "a" + } + } + }, + "right": { + "type": "NumericLiteral", + "start":8,"end":9,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":9}}, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/valid-parenthesized-assignment-array-pattern-1/input.js b/packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/valid-parenthesized-assignment-array-pattern-1/input.js new file mode 100644 index 000000000000..320748c0282f --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/valid-parenthesized-assignment-array-pattern-1/input.js @@ -0,0 +1 @@ +[(((x)))] = t; \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/valid-parenthesized-assignment-array-pattern-1/options.json b/packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/valid-parenthesized-assignment-array-pattern-1/options.json new file mode 100644 index 000000000000..0861962d889d --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/valid-parenthesized-assignment-array-pattern-1/options.json @@ -0,0 +1,3 @@ +{ + "createParenthesizedExpressions": true +} diff --git a/packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/valid-parenthesized-assignment-array-pattern-1/output.json b/packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/valid-parenthesized-assignment-array-pattern-1/output.json new file mode 100644 index 000000000000..c11287a7b231 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/valid-parenthesized-assignment-array-pattern-1/output.json @@ -0,0 +1,50 @@ +{ + "type": "File", + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, + "program": { + "type": "Program", + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, + "expression": { + "type": "AssignmentExpression", + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "operator": "=", + "left": { + "type": "ArrayPattern", + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "elements": [ + { + "type": "ParenthesizedExpression", + "start":1,"end":8,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":8}}, + "expression": { + "type": "ParenthesizedExpression", + "start":2,"end":7,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":7}}, + "expression": { + "type": "ParenthesizedExpression", + "start":3,"end":6,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":6}}, + "expression": { + "type": "Identifier", + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"x"}, + "name": "x" + } + } + } + } + ] + }, + "right": { + "type": "Identifier", + "start":12,"end":13,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":13},"identifierName":"t"}, + "name": "t" + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/valid-parenthesized-assignment-array-pattern-2/input.js b/packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/valid-parenthesized-assignment-array-pattern-2/input.js new file mode 100644 index 000000000000..d2e8408e783a --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/valid-parenthesized-assignment-array-pattern-2/input.js @@ -0,0 +1 @@ +[(x)] = t; \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/valid-parenthesized-assignment-array-pattern-2/options.json b/packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/valid-parenthesized-assignment-array-pattern-2/options.json new file mode 100644 index 000000000000..0861962d889d --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/valid-parenthesized-assignment-array-pattern-2/options.json @@ -0,0 +1,3 @@ +{ + "createParenthesizedExpressions": true +} diff --git a/packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/valid-parenthesized-assignment-array-pattern-2/output.json b/packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/valid-parenthesized-assignment-array-pattern-2/output.json new file mode 100644 index 000000000000..53782f982cbe --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/valid-parenthesized-assignment-array-pattern-2/output.json @@ -0,0 +1,42 @@ +{ + "type": "File", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "program": { + "type": "Program", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "expression": { + "type": "AssignmentExpression", + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "operator": "=", + "left": { + "type": "ArrayPattern", + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, + "elements": [ + { + "type": "ParenthesizedExpression", + "start":1,"end":4,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":4}}, + "expression": { + "type": "Identifier", + "start":2,"end":3,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":3},"identifierName":"x"}, + "name": "x" + } + } + ] + }, + "right": { + "type": "Identifier", + "start":8,"end":9,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":9},"identifierName":"t"}, + "name": "t" + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/valid-parenthesized-assignment-array-pattern-3/input.js b/packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/valid-parenthesized-assignment-array-pattern-3/input.js new file mode 100644 index 000000000000..0100e137ff7f --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/valid-parenthesized-assignment-array-pattern-3/input.js @@ -0,0 +1 @@ +[([x])] = t; \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/valid-parenthesized-assignment-array-pattern-3/options.json b/packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/valid-parenthesized-assignment-array-pattern-3/options.json new file mode 100644 index 000000000000..0861962d889d --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/valid-parenthesized-assignment-array-pattern-3/options.json @@ -0,0 +1,3 @@ +{ + "createParenthesizedExpressions": true +} diff --git a/packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/valid-parenthesized-assignment-array-pattern-3/output.json b/packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/valid-parenthesized-assignment-array-pattern-3/output.json new file mode 100644 index 000000000000..a655ee4c1fcb --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/valid-parenthesized-assignment-array-pattern-3/output.json @@ -0,0 +1,51 @@ +{ + "type": "File", + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "errors": [ + "SyntaxError: Invalid parenthesized assignment pattern (1:1)" + ], + "program": { + "type": "Program", + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "expression": { + "type": "AssignmentExpression", + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "operator": "=", + "left": { + "type": "ArrayPattern", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "elements": [ + { + "type": "ParenthesizedExpression", + "start":1,"end":6,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":6}}, + "expression": { + "type": "ArrayPattern", + "start":2,"end":5,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":5}}, + "elements": [ + { + "type": "Identifier", + "start":3,"end":4,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":4},"identifierName":"x"}, + "name": "x" + } + ] + } + } + ] + }, + "right": { + "type": "Identifier", + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11},"identifierName":"t"}, + "name": "t" + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/valid-parenthesized-assignment-array-pattern-member-expression/input.js b/packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/valid-parenthesized-assignment-array-pattern-member-expression/input.js new file mode 100644 index 000000000000..821f2c5a3c37 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/valid-parenthesized-assignment-array-pattern-member-expression/input.js @@ -0,0 +1 @@ +[(a.x)] = t; \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/valid-parenthesized-assignment-array-pattern-member-expression/options.json b/packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/valid-parenthesized-assignment-array-pattern-member-expression/options.json new file mode 100644 index 000000000000..0861962d889d --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/valid-parenthesized-assignment-array-pattern-member-expression/options.json @@ -0,0 +1,3 @@ +{ + "createParenthesizedExpressions": true +} diff --git a/packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/valid-parenthesized-assignment-array-pattern-member-expression/output.json b/packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/valid-parenthesized-assignment-array-pattern-member-expression/output.json new file mode 100644 index 000000000000..1318e397e397 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/valid-parenthesized-assignment-array-pattern-member-expression/output.json @@ -0,0 +1,52 @@ +{ + "type": "File", + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "program": { + "type": "Program", + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "expression": { + "type": "AssignmentExpression", + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "operator": "=", + "left": { + "type": "ArrayPattern", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "elements": [ + { + "type": "ParenthesizedExpression", + "start":1,"end":6,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":6}}, + "expression": { + "type": "MemberExpression", + "start":2,"end":5,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":5}}, + "object": { + "type": "Identifier", + "start":2,"end":3,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":3},"identifierName":"a"}, + "name": "a" + }, + "property": { + "type": "Identifier", + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"x"}, + "name": "x" + }, + "computed": false + } + } + ] + }, + "right": { + "type": "Identifier", + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11},"identifierName":"t"}, + "name": "t" + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/557/input.js b/packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/valid-parenthesized-expression/input.js similarity index 100% rename from packages/babel-parser/test/fixtures/core/uncategorised/557/input.js rename to packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/valid-parenthesized-expression/input.js diff --git a/packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/valid-parenthesized-expression/options.json b/packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/valid-parenthesized-expression/options.json new file mode 100644 index 000000000000..0861962d889d --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/valid-parenthesized-expression/options.json @@ -0,0 +1,3 @@ +{ + "createParenthesizedExpressions": true +} diff --git a/packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/valid-parenthesized-expression/output.json b/packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/valid-parenthesized-expression/output.json new file mode 100644 index 000000000000..c765cfd25e75 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/valid-parenthesized-expression/output.json @@ -0,0 +1,30 @@ +{ + "type": "File", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "program": { + "type": "Program", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "expression": { + "type": "ParenthesizedExpression", + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "expression": { + "type": "StringLiteral", + "start":1,"end":8,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":8}}, + "extra": { + "rawValue": "hello", + "raw": "\"hello\"" + }, + "value": "hello" + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/valid-escape/async/input.js b/packages/babel-parser/test/fixtures/core/escape-keyword/async/input.js similarity index 100% rename from packages/babel-parser/test/fixtures/core/valid-escape/async/input.js rename to packages/babel-parser/test/fixtures/core/escape-keyword/async/input.js diff --git a/packages/babel-parser/test/fixtures/core/escape-keyword/async/output.json b/packages/babel-parser/test/fixtures/core/escape-keyword/async/output.json new file mode 100644 index 000000000000..fb945ca37c11 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/escape-keyword/async/output.json @@ -0,0 +1,31 @@ +{ + "type": "File", + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, + "program": { + "type": "Program", + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, + "expression": { + "type": "CallExpression", + "start":1,"end":14,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":14}}, + "callee": { + "type": "Identifier", + "start":1,"end":11,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":11},"identifierName":"async"}, + "name": "async" + }, + "arguments": [], + "extra": { + "parenthesized": true, + "parenStart": 0 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/escape-keyword/invalid/input.js b/packages/babel-parser/test/fixtures/core/escape-keyword/invalid/input.js new file mode 100644 index 000000000000..d3f6f142b83a --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/escape-keyword/invalid/input.js @@ -0,0 +1,3 @@ +var a = { + br\u{65}ak +}; diff --git a/packages/babel-parser/test/fixtures/core/escape-keyword/invalid/output.json b/packages/babel-parser/test/fixtures/core/escape-keyword/invalid/output.json new file mode 100644 index 000000000000..20ba00fd6d9c --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/escape-keyword/invalid/output.json @@ -0,0 +1,58 @@ +{ + "type": "File", + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":2}}, + "errors": [ + "SyntaxError: Unexpected keyword 'break' (2:2)" + ], + "program": { + "type": "Program", + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":2}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":2}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":4,"end":24,"loc":{"start":{"line":1,"column":4},"end":{"line":3,"column":1}}, + "id": { + "type": "Identifier", + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"a"}, + "name": "a" + }, + "init": { + "type": "ObjectExpression", + "start":8,"end":24,"loc":{"start":{"line":1,"column":8},"end":{"line":3,"column":1}}, + "properties": [ + { + "type": "ObjectProperty", + "start":12,"end":22,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":12}}, + "method": false, + "key": { + "type": "Identifier", + "start":12,"end":22,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":12},"identifierName":"break"}, + "name": "break" + }, + "computed": false, + "shorthand": true, + "value": { + "type": "Identifier", + "start":12,"end":22,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":12},"identifierName":"break"}, + "name": "break" + }, + "extra": { + "shorthand": true + } + } + ] + } + } + ], + "kind": "var" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/escape-keyword/used-as-property/input.js b/packages/babel-parser/test/fixtures/core/escape-keyword/used-as-property/input.js new file mode 100644 index 000000000000..d5faad627616 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/escape-keyword/used-as-property/input.js @@ -0,0 +1,3 @@ +var a = { + br\u{65}ak: 2 +}; diff --git a/packages/babel-parser/test/fixtures/core/escape-keyword/used-as-property/output.json b/packages/babel-parser/test/fixtures/core/escape-keyword/used-as-property/output.json new file mode 100644 index 000000000000..945e5d3ad170 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/escape-keyword/used-as-property/output.json @@ -0,0 +1,56 @@ +{ + "type": "File", + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":2}}, + "program": { + "type": "Program", + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":2}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":2}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":4,"end":27,"loc":{"start":{"line":1,"column":4},"end":{"line":3,"column":1}}, + "id": { + "type": "Identifier", + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"a"}, + "name": "a" + }, + "init": { + "type": "ObjectExpression", + "start":8,"end":27,"loc":{"start":{"line":1,"column":8},"end":{"line":3,"column":1}}, + "properties": [ + { + "type": "ObjectProperty", + "start":12,"end":25,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":15}}, + "method": false, + "key": { + "type": "Identifier", + "start":12,"end":22,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":12},"identifierName":"break"}, + "name": "break" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "NumericLiteral", + "start":24,"end":25,"loc":{"start":{"line":2,"column":14},"end":{"line":2,"column":15}}, + "extra": { + "rawValue": 2, + "raw": "2" + }, + "value": 2 + } + } + ] + } + } + ], + "kind": "var" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/escape-template/non-octal-eight/input.js b/packages/babel-parser/test/fixtures/core/escape-template/non-octal-eight/input.js new file mode 100644 index 000000000000..adc52b823a24 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/escape-template/non-octal-eight/input.js @@ -0,0 +1 @@ +`\8`; diff --git a/packages/babel-parser/test/fixtures/core/escape-template/non-octal-eight/output.json b/packages/babel-parser/test/fixtures/core/escape-template/non-octal-eight/output.json new file mode 100644 index 000000000000..97c5ce5eb36d --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/escape-template/non-octal-eight/output.json @@ -0,0 +1,36 @@ +{ + "type": "File", + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:2)" + ], + "program": { + "type": "Program", + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, + "expression": { + "type": "TemplateLiteral", + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, + "expressions": [], + "quasis": [ + { + "type": "TemplateElement", + "start":1,"end":3,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":3}}, + "value": { + "raw": "\\8", + "cooked": null + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/escape-template/non-octal-nine/input.js b/packages/babel-parser/test/fixtures/core/escape-template/non-octal-nine/input.js new file mode 100644 index 000000000000..b5435620b9cb --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/escape-template/non-octal-nine/input.js @@ -0,0 +1 @@ +`\9`; diff --git a/packages/babel-parser/test/fixtures/core/escape-template/non-octal-nine/output.json b/packages/babel-parser/test/fixtures/core/escape-template/non-octal-nine/output.json new file mode 100644 index 000000000000..98905e40ab03 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/escape-template/non-octal-nine/output.json @@ -0,0 +1,36 @@ +{ + "type": "File", + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:2)" + ], + "program": { + "type": "Program", + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, + "expression": { + "type": "TemplateLiteral", + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, + "expressions": [], + "quasis": [ + { + "type": "TemplateElement", + "start":1,"end":3,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":3}}, + "value": { + "raw": "\\9", + "cooked": null + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/object/invalid-escape-get/options.json b/packages/babel-parser/test/fixtures/core/object/invalid-escape-get/options.json index 0cd822570731..99a2bc92f2c0 100644 --- a/packages/babel-parser/test/fixtures/core/object/invalid-escape-get/options.json +++ b/packages/babel-parser/test/fixtures/core/object/invalid-escape-get/options.json @@ -1,3 +1,3 @@ { "throws": "Unexpected token, expected \",\" (1:12)" -} \ No newline at end of file +} diff --git a/packages/babel-parser/test/fixtures/core/object/invalid-property-initializer-1/input.js b/packages/babel-parser/test/fixtures/core/object/invalid-property-initializer-1/input.js new file mode 100644 index 000000000000..9538075c50c3 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/object/invalid-property-initializer-1/input.js @@ -0,0 +1,4 @@ +const obj = { + bar: x = 123, + foo = 123 +}; diff --git a/packages/babel-parser/test/fixtures/core/object/invalid-property-initializer-1/options.json b/packages/babel-parser/test/fixtures/core/object/invalid-property-initializer-1/options.json new file mode 100644 index 000000000000..e92fc4e28742 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/object/invalid-property-initializer-1/options.json @@ -0,0 +1,3 @@ +{ + "throws": "Unexpected token (3:6)" +} diff --git a/packages/babel-parser/test/fixtures/core/object/invalid-property-initializer/input.js b/packages/babel-parser/test/fixtures/core/object/invalid-property-initializer/input.js new file mode 100644 index 000000000000..868f237838df --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/object/invalid-property-initializer/input.js @@ -0,0 +1,4 @@ +const obj = { + foo = 123, + bar: x = 123 +}; diff --git a/packages/babel-parser/test/fixtures/core/object/invalid-property-initializer/options.json b/packages/babel-parser/test/fixtures/core/object/invalid-property-initializer/options.json new file mode 100644 index 000000000000..9660494a29ea --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/object/invalid-property-initializer/options.json @@ -0,0 +1,3 @@ +{ + "throws": "Unexpected token (2:6)" +} diff --git a/packages/babel-parser/test/fixtures/core/object/member-expression-after-property-initializer-1/input.js b/packages/babel-parser/test/fixtures/core/object/member-expression-after-property-initializer-1/input.js new file mode 100644 index 000000000000..c6beddd4d7b5 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/object/member-expression-after-property-initializer-1/input.js @@ -0,0 +1 @@ +({a = 42, b: test.d} = {}) \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/object/member-expression-after-property-initializer-1/output.json b/packages/babel-parser/test/fixtures/core/object/member-expression-after-property-initializer-1/output.json new file mode 100644 index 000000000000..a3fd8b4143c8 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/object/member-expression-after-property-initializer-1/output.json @@ -0,0 +1,97 @@ +{ + "type": "File", + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, + "program": { + "type": "Program", + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, + "expression": { + "type": "AssignmentExpression", + "start":1,"end":25,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":25}}, + "operator": "=", + "left": { + "type": "ObjectPattern", + "start":1,"end":20,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":20}}, + "properties": [ + { + "type": "ObjectProperty", + "start":2,"end":8,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":8}}, + "method": false, + "key": { + "type": "Identifier", + "start":2,"end":3,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":3},"identifierName":"a"}, + "name": "a" + }, + "computed": false, + "shorthand": true, + "value": { + "type": "AssignmentPattern", + "start":2,"end":8,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":8}}, + "left": { + "type": "Identifier", + "start":2,"end":3,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":3},"identifierName":"a"}, + "name": "a" + }, + "right": { + "type": "NumericLiteral", + "start":6,"end":8,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":8}}, + "extra": { + "rawValue": 42, + "raw": "42" + }, + "value": 42 + } + }, + "extra": { + "shorthand": true + } + }, + { + "type": "ObjectProperty", + "start":10,"end":19,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":19}}, + "method": false, + "key": { + "type": "Identifier", + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11},"identifierName":"b"}, + "name": "b" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "MemberExpression", + "start":13,"end":19,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":19}}, + "object": { + "type": "Identifier", + "start":13,"end":17,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":17},"identifierName":"test"}, + "name": "test" + }, + "property": { + "type": "Identifier", + "start":18,"end":19,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":19},"identifierName":"d"}, + "name": "d" + }, + "computed": false + } + } + ] + }, + "right": { + "type": "ObjectExpression", + "start":23,"end":25,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":25}}, + "properties": [] + }, + "extra": { + "parenthesized": true, + "parenStart": 0 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/object/member-expression-after-property-initializer-2/input.js b/packages/babel-parser/test/fixtures/core/object/member-expression-after-property-initializer-2/input.js new file mode 100644 index 000000000000..e02e09a0f5ed --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/object/member-expression-after-property-initializer-2/input.js @@ -0,0 +1 @@ +({a = 42, b: {}.d} = {}) \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/object/member-expression-after-property-initializer-2/output.json b/packages/babel-parser/test/fixtures/core/object/member-expression-after-property-initializer-2/output.json new file mode 100644 index 000000000000..11c1977bfa81 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/object/member-expression-after-property-initializer-2/output.json @@ -0,0 +1,97 @@ +{ + "type": "File", + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, + "program": { + "type": "Program", + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, + "expression": { + "type": "AssignmentExpression", + "start":1,"end":23,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":23}}, + "operator": "=", + "left": { + "type": "ObjectPattern", + "start":1,"end":18,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":18}}, + "properties": [ + { + "type": "ObjectProperty", + "start":2,"end":8,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":8}}, + "method": false, + "key": { + "type": "Identifier", + "start":2,"end":3,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":3},"identifierName":"a"}, + "name": "a" + }, + "computed": false, + "shorthand": true, + "value": { + "type": "AssignmentPattern", + "start":2,"end":8,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":8}}, + "left": { + "type": "Identifier", + "start":2,"end":3,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":3},"identifierName":"a"}, + "name": "a" + }, + "right": { + "type": "NumericLiteral", + "start":6,"end":8,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":8}}, + "extra": { + "rawValue": 42, + "raw": "42" + }, + "value": 42 + } + }, + "extra": { + "shorthand": true + } + }, + { + "type": "ObjectProperty", + "start":10,"end":17,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":17}}, + "method": false, + "key": { + "type": "Identifier", + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11},"identifierName":"b"}, + "name": "b" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "MemberExpression", + "start":13,"end":17,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":17}}, + "object": { + "type": "ObjectExpression", + "start":13,"end":15,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":15}}, + "properties": [] + }, + "property": { + "type": "Identifier", + "start":16,"end":17,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":17},"identifierName":"d"}, + "name": "d" + }, + "computed": false + } + } + ] + }, + "right": { + "type": "ObjectExpression", + "start":21,"end":23,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":23}}, + "properties": [] + }, + "extra": { + "parenthesized": true, + "parenStart": 0 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/object/valid-property-initializer/input.js b/packages/babel-parser/test/fixtures/core/object/valid-property-initializer/input.js new file mode 100644 index 000000000000..0cd0f5146c8d --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/object/valid-property-initializer/input.js @@ -0,0 +1,4 @@ +const obj = { + foo = 123, + bar: x = 123, +} = { foo: 24, bar: 45 }; diff --git a/packages/babel-parser/test/fixtures/core/object/valid-property-initializer/output.json b/packages/babel-parser/test/fixtures/core/object/valid-property-initializer/output.json new file mode 100644 index 000000000000..00cb9573c024 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/object/valid-property-initializer/output.json @@ -0,0 +1,154 @@ +{ + "type": "File", + "start":0,"end":68,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":25}}, + "program": { + "type": "Program", + "start":0,"end":68,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":25}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start":0,"end":68,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":25}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":6,"end":67,"loc":{"start":{"line":1,"column":6},"end":{"line":4,"column":24}}, + "id": { + "type": "Identifier", + "start":6,"end":9,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":9},"identifierName":"obj"}, + "name": "obj" + }, + "init": { + "type": "AssignmentExpression", + "start":12,"end":67,"loc":{"start":{"line":1,"column":12},"end":{"line":4,"column":24}}, + "operator": "=", + "left": { + "type": "ObjectPattern", + "start":12,"end":44,"loc":{"start":{"line":1,"column":12},"end":{"line":4,"column":1}}, + "properties": [ + { + "type": "ObjectProperty", + "start":16,"end":25,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":11}}, + "method": false, + "key": { + "type": "Identifier", + "start":16,"end":19,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":5},"identifierName":"foo"}, + "name": "foo" + }, + "computed": false, + "shorthand": true, + "value": { + "type": "AssignmentPattern", + "start":16,"end":25,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":11}}, + "left": { + "type": "Identifier", + "start":16,"end":19,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":5},"identifierName":"foo"}, + "name": "foo" + }, + "right": { + "type": "NumericLiteral", + "start":22,"end":25,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":11}}, + "extra": { + "rawValue": 123, + "raw": "123" + }, + "value": 123 + } + }, + "extra": { + "shorthand": true + } + }, + { + "type": "ObjectProperty", + "start":29,"end":41,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":14}}, + "method": false, + "key": { + "type": "Identifier", + "start":29,"end":32,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":5},"identifierName":"bar"}, + "name": "bar" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "AssignmentPattern", + "start":34,"end":41,"loc":{"start":{"line":3,"column":7},"end":{"line":3,"column":14}}, + "left": { + "type": "Identifier", + "start":34,"end":35,"loc":{"start":{"line":3,"column":7},"end":{"line":3,"column":8},"identifierName":"x"}, + "name": "x" + }, + "right": { + "type": "NumericLiteral", + "start":38,"end":41,"loc":{"start":{"line":3,"column":11},"end":{"line":3,"column":14}}, + "extra": { + "rawValue": 123, + "raw": "123" + }, + "value": 123 + } + } + } + ], + "extra": { + "trailingComma": 41 + } + }, + "right": { + "type": "ObjectExpression", + "start":47,"end":67,"loc":{"start":{"line":4,"column":4},"end":{"line":4,"column":24}}, + "properties": [ + { + "type": "ObjectProperty", + "start":49,"end":56,"loc":{"start":{"line":4,"column":6},"end":{"line":4,"column":13}}, + "method": false, + "key": { + "type": "Identifier", + "start":49,"end":52,"loc":{"start":{"line":4,"column":6},"end":{"line":4,"column":9},"identifierName":"foo"}, + "name": "foo" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "NumericLiteral", + "start":54,"end":56,"loc":{"start":{"line":4,"column":11},"end":{"line":4,"column":13}}, + "extra": { + "rawValue": 24, + "raw": "24" + }, + "value": 24 + } + }, + { + "type": "ObjectProperty", + "start":58,"end":65,"loc":{"start":{"line":4,"column":15},"end":{"line":4,"column":22}}, + "method": false, + "key": { + "type": "Identifier", + "start":58,"end":61,"loc":{"start":{"line":4,"column":15},"end":{"line":4,"column":18},"identifierName":"bar"}, + "name": "bar" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "NumericLiteral", + "start":63,"end":65,"loc":{"start":{"line":4,"column":20},"end":{"line":4,"column":22}}, + "extra": { + "rawValue": 45, + "raw": "45" + }, + "value": 45 + } + } + ] + } + } + } + ], + "kind": "const" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/opts/allowAwaitOutsideFunction-true/output.json b/packages/babel-parser/test/fixtures/core/opts/allowAwaitOutsideFunction-true/output.json index 259b3ffcf47c..b127e470165f 100644 --- a/packages/babel-parser/test/fixtures/core/opts/allowAwaitOutsideFunction-true/output.json +++ b/packages/babel-parser/test/fixtures/core/opts/allowAwaitOutsideFunction-true/output.json @@ -1,93 +1,26 @@ { "type": "File", - "start": 0, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, "program": { "type": "Program", - "start": 0, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ForOfStatement", - "start": 0, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, "await": true, "left": { "type": "VariableDeclaration", - "start": 11, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":11,"end":18,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":18}}, "declarations": [ { "type": "VariableDeclarator", - "start": 17, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":17,"end":18,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":18}}, "id": { "type": "Identifier", - "start": 17, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - }, - "identifierName": "i" - }, + "start":17,"end":18,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":18},"identifierName":"i"}, "name": "i" }, "init": null @@ -97,35 +30,12 @@ }, "right": { "type": "Identifier", - "start": 22, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 29 - }, - "identifierName": "imports" - }, + "start":22,"end":29,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":29},"identifierName":"imports"}, "name": "imports" }, "body": { "type": "BlockStatement", - "start": 31, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 31 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":31,"end":33,"loc":{"start":{"line":1,"column":31},"end":{"line":1,"column":33}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/core/opts/allowUndeclaredExports/output.json b/packages/babel-parser/test/fixtures/core/opts/allowUndeclaredExports/output.json index a454ef5bbdb2..6cafe7e41c7e 100644 --- a/packages/babel-parser/test/fixtures/core/opts/allowUndeclaredExports/output.json +++ b/packages/babel-parser/test/fixtures/core/opts/allowUndeclaredExports/output.json @@ -1,95 +1,27 @@ { "type": "File", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "program": { "type": "Program", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExportNamedDeclaration", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "specifiers": [ { "type": "ExportSpecifier", - "start": 9, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":9,"end":12,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":12}}, "local": { "type": "Identifier", - "start": 9, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "foo" - }, + "start":9,"end":12,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":12},"identifierName":"foo"}, "name": "foo" }, "exported": { "type": "Identifier", - "start": 9, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "foo" - }, + "start":9,"end":12,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":12},"identifierName":"foo"}, "name": "foo" } } diff --git a/packages/babel-parser/test/fixtures/core/opts/ranges-false/output.json b/packages/babel-parser/test/fixtures/core/opts/ranges-false/output.json index 74684515ddeb..eb51e1bb0421 100644 --- a/packages/babel-parser/test/fixtures/core/opts/ranges-false/output.json +++ b/packages/babel-parser/test/fixtures/core/opts/ranges-false/output.json @@ -1,94 +1,27 @@ { "type": "File", - "start": 0, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 14 - } - }, + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":14}}, "program": { "type": "Program", - "start": 0, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 14 - } - }, + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":14}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":4,"end":9,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":9}}, "id": { "type": "Identifier", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "a" - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"a"}, "name": "a" }, "init": { "type": "NumericLiteral", - "start": 8, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":8,"end":9,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":9}}, "extra": { "rawValue": 1, "raw": "1" @@ -101,96 +34,28 @@ }, { "type": "VariableDeclaration", - "start": 12, - "end": 26, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 14 - } - }, + "start":12,"end":26,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":14}}, "declarations": [ { "type": "VariableDeclarator", - "start": 16, - "end": 25, - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 13 - } - }, + "start":16,"end":25,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":13}}, "id": { "type": "Identifier", - "start": 16, - "end": 17, - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 5 - }, - "identifierName": "b" - }, + "start":16,"end":17,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":5},"identifierName":"b"}, "name": "b" }, "init": { "type": "BinaryExpression", - "start": 20, - "end": 25, - "loc": { - "start": { - "line": 3, - "column": 8 - }, - "end": { - "line": 3, - "column": 13 - } - }, + "start":20,"end":25,"loc":{"start":{"line":3,"column":8},"end":{"line":3,"column":13}}, "left": { "type": "Identifier", - "start": 20, - "end": 21, - "loc": { - "start": { - "line": 3, - "column": 8 - }, - "end": { - "line": 3, - "column": 9 - }, - "identifierName": "a" - }, + "start":20,"end":21,"loc":{"start":{"line":3,"column":8},"end":{"line":3,"column":9},"identifierName":"a"}, "name": "a" }, "operator": "+", "right": { "type": "NumericLiteral", - "start": 24, - "end": 25, - "loc": { - "start": { - "line": 3, - "column": 12 - }, - "end": { - "line": 3, - "column": 13 - } - }, + "start":24,"end":25,"loc":{"start":{"line":3,"column":12},"end":{"line":3,"column":13}}, "extra": { "rawValue": 1, "raw": "1" diff --git a/packages/babel-parser/test/fixtures/core/opts/ranges-true/output.json b/packages/babel-parser/test/fixtures/core/opts/ranges-true/output.json index 3983b0f1997d..9442328131d0 100644 --- a/packages/babel-parser/test/fixtures/core/opts/ranges-true/output.json +++ b/packages/babel-parser/test/fixtures/core/opts/ranges-true/output.json @@ -1,35 +1,13 @@ { "type": "File", - "start": 0, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 14 - } - }, + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":14}}, "range": [ 0, 26 ], "program": { "type": "Program", - "start": 0, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 14 - } - }, + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":14}}, "range": [ 0, 26 @@ -39,18 +17,7 @@ "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, "range": [ 0, 10 @@ -58,37 +25,14 @@ "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":4,"end":9,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":9}}, "range": [ 4, 9 ], "id": { "type": "Identifier", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "a" - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"a"}, "range": [ 4, 5 @@ -97,18 +41,7 @@ }, "init": { "type": "NumericLiteral", - "start": 8, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":8,"end":9,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":9}}, "range": [ 8, 9 @@ -125,18 +58,7 @@ }, { "type": "VariableDeclaration", - "start": 12, - "end": 26, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 14 - } - }, + "start":12,"end":26,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":14}}, "range": [ 12, 26 @@ -144,37 +66,14 @@ "declarations": [ { "type": "VariableDeclarator", - "start": 16, - "end": 25, - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 13 - } - }, + "start":16,"end":25,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":13}}, "range": [ 16, 25 ], "id": { "type": "Identifier", - "start": 16, - "end": 17, - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 5 - }, - "identifierName": "b" - }, + "start":16,"end":17,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":5},"identifierName":"b"}, "range": [ 16, 17 @@ -183,37 +82,14 @@ }, "init": { "type": "BinaryExpression", - "start": 20, - "end": 25, - "loc": { - "start": { - "line": 3, - "column": 8 - }, - "end": { - "line": 3, - "column": 13 - } - }, + "start":20,"end":25,"loc":{"start":{"line":3,"column":8},"end":{"line":3,"column":13}}, "range": [ 20, 25 ], "left": { "type": "Identifier", - "start": 20, - "end": 21, - "loc": { - "start": { - "line": 3, - "column": 8 - }, - "end": { - "line": 3, - "column": 9 - }, - "identifierName": "a" - }, + "start":20,"end":21,"loc":{"start":{"line":3,"column":8},"end":{"line":3,"column":9},"identifierName":"a"}, "range": [ 20, 21 @@ -223,18 +99,7 @@ "operator": "+", "right": { "type": "NumericLiteral", - "start": 24, - "end": 25, - "loc": { - "start": { - "line": 3, - "column": 12 - }, - "end": { - "line": 3, - "column": 13 - } - }, + "start":24,"end":25,"loc":{"start":{"line":3,"column":12},"end":{"line":3,"column":13}}, "range": [ 24, 25 diff --git a/packages/babel-parser/test/fixtures/core/opts/tokens-false/output.json b/packages/babel-parser/test/fixtures/core/opts/tokens-false/output.json index 74684515ddeb..eb51e1bb0421 100644 --- a/packages/babel-parser/test/fixtures/core/opts/tokens-false/output.json +++ b/packages/babel-parser/test/fixtures/core/opts/tokens-false/output.json @@ -1,94 +1,27 @@ { "type": "File", - "start": 0, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 14 - } - }, + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":14}}, "program": { "type": "Program", - "start": 0, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 14 - } - }, + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":14}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":4,"end":9,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":9}}, "id": { "type": "Identifier", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "a" - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"a"}, "name": "a" }, "init": { "type": "NumericLiteral", - "start": 8, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":8,"end":9,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":9}}, "extra": { "rawValue": 1, "raw": "1" @@ -101,96 +34,28 @@ }, { "type": "VariableDeclaration", - "start": 12, - "end": 26, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 14 - } - }, + "start":12,"end":26,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":14}}, "declarations": [ { "type": "VariableDeclarator", - "start": 16, - "end": 25, - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 13 - } - }, + "start":16,"end":25,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":13}}, "id": { "type": "Identifier", - "start": 16, - "end": 17, - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 5 - }, - "identifierName": "b" - }, + "start":16,"end":17,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":5},"identifierName":"b"}, "name": "b" }, "init": { "type": "BinaryExpression", - "start": 20, - "end": 25, - "loc": { - "start": { - "line": 3, - "column": 8 - }, - "end": { - "line": 3, - "column": 13 - } - }, + "start":20,"end":25,"loc":{"start":{"line":3,"column":8},"end":{"line":3,"column":13}}, "left": { "type": "Identifier", - "start": 20, - "end": 21, - "loc": { - "start": { - "line": 3, - "column": 8 - }, - "end": { - "line": 3, - "column": 9 - }, - "identifierName": "a" - }, + "start":20,"end":21,"loc":{"start":{"line":3,"column":8},"end":{"line":3,"column":9},"identifierName":"a"}, "name": "a" }, "operator": "+", "right": { "type": "NumericLiteral", - "start": 24, - "end": 25, - "loc": { - "start": { - "line": 3, - "column": 12 - }, - "end": { - "line": 3, - "column": 13 - } - }, + "start":24,"end":25,"loc":{"start":{"line":3,"column":12},"end":{"line":3,"column":13}}, "extra": { "rawValue": 1, "raw": "1" diff --git a/packages/babel-parser/test/fixtures/core/opts/tokens-true/output.json b/packages/babel-parser/test/fixtures/core/opts/tokens-true/output.json index 47117344de0f..5c0640afffe2 100644 --- a/packages/babel-parser/test/fixtures/core/opts/tokens-true/output.json +++ b/packages/babel-parser/test/fixtures/core/opts/tokens-true/output.json @@ -1,94 +1,27 @@ { "type": "File", - "start": 0, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 14 - } - }, + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":14}}, "program": { "type": "Program", - "start": 0, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 14 - } - }, + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":14}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":4,"end":9,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":9}}, "id": { "type": "Identifier", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "a" - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"a"}, "name": "a" }, "init": { "type": "NumericLiteral", - "start": 8, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":8,"end":9,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":9}}, "extra": { "rawValue": 1, "raw": "1" @@ -101,96 +34,28 @@ }, { "type": "VariableDeclaration", - "start": 12, - "end": 26, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 14 - } - }, + "start":12,"end":26,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":14}}, "declarations": [ { "type": "VariableDeclarator", - "start": 16, - "end": 25, - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 13 - } - }, + "start":16,"end":25,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":13}}, "id": { "type": "Identifier", - "start": 16, - "end": 17, - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 5 - }, - "identifierName": "b" - }, + "start":16,"end":17,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":5},"identifierName":"b"}, "name": "b" }, "init": { "type": "BinaryExpression", - "start": 20, - "end": 25, - "loc": { - "start": { - "line": 3, - "column": 8 - }, - "end": { - "line": 3, - "column": 13 - } - }, + "start":20,"end":25,"loc":{"start":{"line":3,"column":8},"end":{"line":3,"column":13}}, "left": { "type": "Identifier", - "start": 20, - "end": 21, - "loc": { - "start": { - "line": 3, - "column": 8 - }, - "end": { - "line": 3, - "column": 9 - }, - "identifierName": "a" - }, + "start":20,"end":21,"loc":{"start":{"line":3,"column":8},"end":{"line":3,"column":9},"identifierName":"a"}, "name": "a" }, "operator": "+", "right": { "type": "NumericLiteral", - "start": 24, - "end": 25, - "loc": { - "start": { - "line": 3, - "column": 12 - }, - "end": { - "line": 3, - "column": 13 - } - }, + "start":24,"end":25,"loc":{"start":{"line":3,"column":12},"end":{"line":3,"column":13}}, "extra": { "rawValue": 1, "raw": "1" @@ -221,18 +86,7 @@ "updateContext": null }, "value": "var", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - } + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}} }, { "type": { @@ -247,18 +101,7 @@ "binop": null }, "value": "a", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - } + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5}} }, { "type": { @@ -274,18 +117,7 @@ "updateContext": null }, "value": "=", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - } + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7}} }, { "type": { @@ -301,18 +133,7 @@ "updateContext": null }, "value": 1, - "start": 8, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - } + "start":8,"end":9,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":9}} }, { "type": { @@ -327,18 +148,7 @@ "binop": null, "updateContext": null }, - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - } + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10}} }, { "type": { @@ -355,18 +165,7 @@ "updateContext": null }, "value": "var", - "start": 12, - "end": 15, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 3 - } - } + "start":12,"end":15,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":3}} }, { "type": { @@ -381,18 +180,7 @@ "binop": null }, "value": "b", - "start": 16, - "end": 17, - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 5 - } - } + "start":16,"end":17,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":5}} }, { "type": { @@ -408,18 +196,7 @@ "updateContext": null }, "value": "=", - "start": 18, - "end": 19, - "loc": { - "start": { - "line": 3, - "column": 6 - }, - "end": { - "line": 3, - "column": 7 - } - } + "start":18,"end":19,"loc":{"start":{"line":3,"column":6},"end":{"line":3,"column":7}} }, { "type": { @@ -434,18 +211,7 @@ "binop": null }, "value": "a", - "start": 20, - "end": 21, - "loc": { - "start": { - "line": 3, - "column": 8 - }, - "end": { - "line": 3, - "column": 9 - } - } + "start":20,"end":21,"loc":{"start":{"line":3,"column":8},"end":{"line":3,"column":9}} }, { "type": { @@ -461,18 +227,7 @@ "updateContext": null }, "value": "+", - "start": 22, - "end": 23, - "loc": { - "start": { - "line": 3, - "column": 10 - }, - "end": { - "line": 3, - "column": 11 - } - } + "start":22,"end":23,"loc":{"start":{"line":3,"column":10},"end":{"line":3,"column":11}} }, { "type": { @@ -488,18 +243,7 @@ "updateContext": null }, "value": 1, - "start": 24, - "end": 25, - "loc": { - "start": { - "line": 3, - "column": 12 - }, - "end": { - "line": 3, - "column": 13 - } - } + "start":24,"end":25,"loc":{"start":{"line":3,"column":12},"end":{"line":3,"column":13}} }, { "type": { @@ -514,18 +258,7 @@ "binop": null, "updateContext": null }, - "start": 25, - "end": 26, - "loc": { - "start": { - "line": 3, - "column": 13 - }, - "end": { - "line": 3, - "column": 14 - } - } + "start":25,"end":26,"loc":{"start":{"line":3,"column":13},"end":{"line":3,"column":14}} }, { "type": { @@ -540,18 +273,7 @@ "binop": null, "updateContext": null }, - "start": 26, - "end": 26, - "loc": { - "start": { - "line": 3, - "column": 14 - }, - "end": { - "line": 3, - "column": 14 - } - } + "start":26,"end":26,"loc":{"start":{"line":3,"column":14},"end":{"line":3,"column":14}} } ] } \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/regression/2591/output.json b/packages/babel-parser/test/fixtures/core/regression/2591/output.json index 2f34027dcd75..270017fdd9a6 100644 --- a/packages/babel-parser/test/fixtures/core/regression/2591/output.json +++ b/packages/babel-parser/test/fixtures/core/regression/2591/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, "id": { "type": "Identifier", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - }, - "identifierName": "x" - }, + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"x"}, "name": "x" }, "generator": false, @@ -65,63 +20,18 @@ "params": [], "body": { "type": "BlockStatement", - "start": 13, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":13,"end":33,"loc":{"start":{"line":1,"column":13},"end":{"line":4,"column":1}}, "body": [ { "type": "VariableDeclaration", - "start": 17, - "end": 22, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 7 - } - }, + "start":17,"end":22,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":7}}, "declarations": [ { "type": "VariableDeclarator", - "start": 21, - "end": 22, - "loc": { - "start": { - "line": 2, - "column": 6 - }, - "end": { - "line": 2, - "column": 7 - } - }, + "start":21,"end":22,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":7}}, "id": { "type": "Identifier", - "start": 21, - "end": 22, - "loc": { - "start": { - "line": 2, - "column": 6 - }, - "end": { - "line": 2, - "column": 7 - }, - "identifierName": "x" - }, + "start":21,"end":22,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":7},"identifierName":"x"}, "name": "x" }, "init": null @@ -131,32 +41,10 @@ }, { "type": "ExpressionStatement", - "start": 25, - "end": 31, - "loc": { - "start": { - "line": 3, - "column": 2 - }, - "end": { - "line": 3, - "column": 8 - } - }, + "start":25,"end":31,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":8}}, "expression": { "type": "RegExpLiteral", - "start": 25, - "end": 30, - "loc": { - "start": { - "line": 3, - "column": 2 - }, - "end": { - "line": 3, - "column": 7 - } - }, + "start":25,"end":30,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":7}}, "extra": { "raw": "/wow/" }, diff --git a/packages/babel-parser/test/fixtures/core/regression/9374/output.json b/packages/babel-parser/test/fixtures/core/regression/9374/output.json index c32f37d64bc1..75e686beb7d2 100644 --- a/packages/babel-parser/test/fixtures/core/regression/9374/output.json +++ b/packages/babel-parser/test/fixtures/core/regression/9374/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "id": { "type": "Identifier", - "start": 10, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 14 - }, - "identifierName": "test" - }, + "start":10,"end":14,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":14},"identifierName":"test"}, "name": "test" }, "generator": true, @@ -65,77 +20,21 @@ "params": [], "body": { "type": "BlockStatement", - "start": 17, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":17,"end":39,"loc":{"start":{"line":1,"column":17},"end":{"line":3,"column":1}}, "body": [ { "type": "ExpressionStatement", - "start": 21, - "end": 37, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 18 - } - }, + "start":21,"end":37,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":18}}, "expression": { "type": "YieldExpression", - "start": 21, - "end": 36, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 17 - } - }, + "start":21,"end":36,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":17}}, "delegate": false, "argument": { "type": "NewExpression", - "start": 27, - "end": 36, - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 17 - } - }, + "start":27,"end":36,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":17}}, "callee": { "type": "Identifier", - "start": 31, - "end": 34, - "loc": { - "start": { - "line": 2, - "column": 12 - }, - "end": { - "line": 2, - "column": 15 - }, - "identifierName": "Foo" - }, + "start":31,"end":34,"loc":{"start":{"line":2,"column":12},"end":{"line":2,"column":15},"identifierName":"Foo"}, "name": "Foo" }, "arguments": [] diff --git a/packages/babel-parser/test/fixtures/core/regression/invalid-octal-strict-directive-function/input.js b/packages/babel-parser/test/fixtures/core/regression/invalid-octal-strict-directive-function/input.js new file mode 100644 index 000000000000..ff2a818984f2 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/regression/invalid-octal-strict-directive-function/input.js @@ -0,0 +1,32 @@ +function a() { + "\5"; + "use strict"; +} + +function b() { + "\4"; + "\5"; + "use strict"; +} + +function c() { + "use strict"; + "\5"; +} + +function d() { + "use strict"; + "\4"; + "\5"; +} + +function c() { + "use strict"; + 05; +} + +function d() { + "use strict"; + 04; + 05; +} diff --git a/packages/babel-parser/test/fixtures/core/regression/invalid-octal-strict-directive-function/options.json b/packages/babel-parser/test/fixtures/core/regression/invalid-octal-strict-directive-function/options.json new file mode 100644 index 000000000000..b412ffe6712f --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/regression/invalid-octal-strict-directive-function/options.json @@ -0,0 +1,3 @@ +{ + "sourceType": "script" +} diff --git a/packages/babel-parser/test/fixtures/core/regression/invalid-octal-strict-directive-function/output.json b/packages/babel-parser/test/fixtures/core/regression/invalid-octal-strict-directive-function/output.json new file mode 100644 index 000000000000..2eeced4be950 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/regression/invalid-octal-strict-directive-function/output.json @@ -0,0 +1,335 @@ +{ + "type": "File", + "start":0,"end":268,"loc":{"start":{"line":1,"column":0},"end":{"line":32,"column":1}}, + "errors": [ + "SyntaxError: Legacy octal literals are not allowed in strict mode (2:4)", + "SyntaxError: Legacy octal literals are not allowed in strict mode (7:4)", + "SyntaxError: Legacy octal literals are not allowed in strict mode (8:4)", + "SyntaxError: Legacy octal literals are not allowed in strict mode (14:4)", + "SyntaxError: Legacy octal literals are not allowed in strict mode (19:4)", + "SyntaxError: Legacy octal literals are not allowed in strict mode (20:4)", + "SyntaxError: Legacy octal literals are not allowed in strict mode (25:2)", + "SyntaxError: Legacy octal literals are not allowed in strict mode (30:2)", + "SyntaxError: Legacy octal literals are not allowed in strict mode (31:2)" + ], + "program": { + "type": "Program", + "start":0,"end":268,"loc":{"start":{"line":1,"column":0},"end":{"line":32,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":40,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "id": { + "type": "Identifier", + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"a"}, + "name": "a" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":13,"end":40,"loc":{"start":{"line":1,"column":13},"end":{"line":4,"column":1}}, + "body": [], + "directives": [ + { + "type": "Directive", + "start":17,"end":22,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":7}}, + "value": { + "type": "DirectiveLiteral", + "start":17,"end":21,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":6}}, + "value": "\\5", + "extra": { + "raw": "\"\\5\"", + "rawValue": "\\5" + } + } + }, + { + "type": "Directive", + "start":25,"end":38,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":15}}, + "value": { + "type": "DirectiveLiteral", + "start":25,"end":37,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":14}}, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } + }, + { + "type": "FunctionDeclaration", + "start":42,"end":90,"loc":{"start":{"line":6,"column":0},"end":{"line":10,"column":1}}, + "id": { + "type": "Identifier", + "start":51,"end":52,"loc":{"start":{"line":6,"column":9},"end":{"line":6,"column":10},"identifierName":"b"}, + "name": "b" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":55,"end":90,"loc":{"start":{"line":6,"column":13},"end":{"line":10,"column":1}}, + "body": [], + "directives": [ + { + "type": "Directive", + "start":59,"end":64,"loc":{"start":{"line":7,"column":2},"end":{"line":7,"column":7}}, + "value": { + "type": "DirectiveLiteral", + "start":59,"end":63,"loc":{"start":{"line":7,"column":2},"end":{"line":7,"column":6}}, + "value": "\\4", + "extra": { + "raw": "\"\\4\"", + "rawValue": "\\4" + } + } + }, + { + "type": "Directive", + "start":67,"end":72,"loc":{"start":{"line":8,"column":2},"end":{"line":8,"column":7}}, + "value": { + "type": "DirectiveLiteral", + "start":67,"end":71,"loc":{"start":{"line":8,"column":2},"end":{"line":8,"column":6}}, + "value": "\\5", + "extra": { + "raw": "\"\\5\"", + "rawValue": "\\5" + } + } + }, + { + "type": "Directive", + "start":75,"end":88,"loc":{"start":{"line":9,"column":2},"end":{"line":9,"column":15}}, + "value": { + "type": "DirectiveLiteral", + "start":75,"end":87,"loc":{"start":{"line":9,"column":2},"end":{"line":9,"column":14}}, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } + }, + { + "type": "FunctionDeclaration", + "start":92,"end":132,"loc":{"start":{"line":12,"column":0},"end":{"line":15,"column":1}}, + "id": { + "type": "Identifier", + "start":101,"end":102,"loc":{"start":{"line":12,"column":9},"end":{"line":12,"column":10},"identifierName":"c"}, + "name": "c" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":105,"end":132,"loc":{"start":{"line":12,"column":13},"end":{"line":15,"column":1}}, + "body": [], + "directives": [ + { + "type": "Directive", + "start":109,"end":122,"loc":{"start":{"line":13,"column":2},"end":{"line":13,"column":15}}, + "value": { + "type": "DirectiveLiteral", + "start":109,"end":121,"loc":{"start":{"line":13,"column":2},"end":{"line":13,"column":14}}, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + }, + { + "type": "Directive", + "start":125,"end":130,"loc":{"start":{"line":14,"column":2},"end":{"line":14,"column":7}}, + "value": { + "type": "DirectiveLiteral", + "start":125,"end":129,"loc":{"start":{"line":14,"column":2},"end":{"line":14,"column":6}}, + "value": "\\5", + "extra": { + "raw": "\"\\5\"", + "rawValue": "\\5" + } + } + } + ] + } + }, + { + "type": "FunctionDeclaration", + "start":134,"end":182,"loc":{"start":{"line":17,"column":0},"end":{"line":21,"column":1}}, + "id": { + "type": "Identifier", + "start":143,"end":144,"loc":{"start":{"line":17,"column":9},"end":{"line":17,"column":10},"identifierName":"d"}, + "name": "d" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":147,"end":182,"loc":{"start":{"line":17,"column":13},"end":{"line":21,"column":1}}, + "body": [], + "directives": [ + { + "type": "Directive", + "start":151,"end":164,"loc":{"start":{"line":18,"column":2},"end":{"line":18,"column":15}}, + "value": { + "type": "DirectiveLiteral", + "start":151,"end":163,"loc":{"start":{"line":18,"column":2},"end":{"line":18,"column":14}}, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + }, + { + "type": "Directive", + "start":167,"end":172,"loc":{"start":{"line":19,"column":2},"end":{"line":19,"column":7}}, + "value": { + "type": "DirectiveLiteral", + "start":167,"end":171,"loc":{"start":{"line":19,"column":2},"end":{"line":19,"column":6}}, + "value": "\\4", + "extra": { + "raw": "\"\\4\"", + "rawValue": "\\4" + } + } + }, + { + "type": "Directive", + "start":175,"end":180,"loc":{"start":{"line":20,"column":2},"end":{"line":20,"column":7}}, + "value": { + "type": "DirectiveLiteral", + "start":175,"end":179,"loc":{"start":{"line":20,"column":2},"end":{"line":20,"column":6}}, + "value": "\\5", + "extra": { + "raw": "\"\\5\"", + "rawValue": "\\5" + } + } + } + ] + } + }, + { + "type": "FunctionDeclaration", + "start":184,"end":222,"loc":{"start":{"line":23,"column":0},"end":{"line":26,"column":1}}, + "id": { + "type": "Identifier", + "start":193,"end":194,"loc":{"start":{"line":23,"column":9},"end":{"line":23,"column":10},"identifierName":"c"}, + "name": "c" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":197,"end":222,"loc":{"start":{"line":23,"column":13},"end":{"line":26,"column":1}}, + "body": [ + { + "type": "ExpressionStatement", + "start":217,"end":220,"loc":{"start":{"line":25,"column":2},"end":{"line":25,"column":5}}, + "expression": { + "type": "NumericLiteral", + "start":217,"end":219,"loc":{"start":{"line":25,"column":2},"end":{"line":25,"column":4}}, + "extra": { + "rawValue": 5, + "raw": "05" + }, + "value": 5 + } + } + ], + "directives": [ + { + "type": "Directive", + "start":201,"end":214,"loc":{"start":{"line":24,"column":2},"end":{"line":24,"column":15}}, + "value": { + "type": "DirectiveLiteral", + "start":201,"end":213,"loc":{"start":{"line":24,"column":2},"end":{"line":24,"column":14}}, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } + }, + { + "type": "FunctionDeclaration", + "start":224,"end":268,"loc":{"start":{"line":28,"column":0},"end":{"line":32,"column":1}}, + "id": { + "type": "Identifier", + "start":233,"end":234,"loc":{"start":{"line":28,"column":9},"end":{"line":28,"column":10},"identifierName":"d"}, + "name": "d" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":237,"end":268,"loc":{"start":{"line":28,"column":13},"end":{"line":32,"column":1}}, + "body": [ + { + "type": "ExpressionStatement", + "start":257,"end":260,"loc":{"start":{"line":30,"column":2},"end":{"line":30,"column":5}}, + "expression": { + "type": "NumericLiteral", + "start":257,"end":259,"loc":{"start":{"line":30,"column":2},"end":{"line":30,"column":4}}, + "extra": { + "rawValue": 4, + "raw": "04" + }, + "value": 4 + } + }, + { + "type": "ExpressionStatement", + "start":263,"end":266,"loc":{"start":{"line":31,"column":2},"end":{"line":31,"column":5}}, + "expression": { + "type": "NumericLiteral", + "start":263,"end":265,"loc":{"start":{"line":31,"column":2},"end":{"line":31,"column":4}}, + "extra": { + "rawValue": 5, + "raw": "05" + }, + "value": 5 + } + } + ], + "directives": [ + { + "type": "Directive", + "start":241,"end":254,"loc":{"start":{"line":29,"column":2},"end":{"line":29,"column":15}}, + "value": { + "type": "DirectiveLiteral", + "start":241,"end":253,"loc":{"start":{"line":29,"column":2},"end":{"line":29,"column":14}}, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/regression/invalid-octal-strict-directive/input.js b/packages/babel-parser/test/fixtures/core/regression/invalid-octal-strict-directive/input.js new file mode 100644 index 000000000000..ee60917379e9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/regression/invalid-octal-strict-directive/input.js @@ -0,0 +1,14 @@ +"\01 foo \02 bar \03"; + +"\4"; +"\5"; + +"use strict"; + +"\4"; +"\5"; + +04; +05; + +"\04 foo \05 bar \06"; diff --git a/packages/babel-parser/test/fixtures/core/regression/invalid-octal-strict-directive/output.json b/packages/babel-parser/test/fixtures/core/regression/invalid-octal-strict-directive/output.json new file mode 100644 index 000000000000..f4d5ed29410f --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/regression/invalid-octal-strict-directive/output.json @@ -0,0 +1,145 @@ +{ + "type": "File", + "start":0,"end":96,"loc":{"start":{"line":1,"column":0},"end":{"line":14,"column":22}}, + "errors": [ + "SyntaxError: Legacy octal literals are not allowed in strict mode (8:2)", + "SyntaxError: Legacy octal literals are not allowed in strict mode (9:2)", + "SyntaxError: Legacy octal literals are not allowed in strict mode (11:0)", + "SyntaxError: Legacy octal literals are not allowed in strict mode (12:0)", + "SyntaxError: Legacy octal literals are not allowed in strict mode (14:2)", + "SyntaxError: Legacy octal literals are not allowed in strict mode (14:10)", + "SyntaxError: Legacy octal literals are not allowed in strict mode (14:18)", + "SyntaxError: Legacy octal literals are not allowed in strict mode (1:2)", + "SyntaxError: Legacy octal literals are not allowed in strict mode (1:10)", + "SyntaxError: Legacy octal literals are not allowed in strict mode (1:18)", + "SyntaxError: Legacy octal literals are not allowed in strict mode (3:2)", + "SyntaxError: Legacy octal literals are not allowed in strict mode (4:2)" + ], + "program": { + "type": "Program", + "start":0,"end":96,"loc":{"start":{"line":1,"column":0},"end":{"line":14,"column":22}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":65,"end":68,"loc":{"start":{"line":11,"column":0},"end":{"line":11,"column":3}}, + "expression": { + "type": "NumericLiteral", + "start":65,"end":67,"loc":{"start":{"line":11,"column":0},"end":{"line":11,"column":2}}, + "extra": { + "rawValue": 4, + "raw": "04" + }, + "value": 4 + } + }, + { + "type": "ExpressionStatement", + "start":69,"end":72,"loc":{"start":{"line":12,"column":0},"end":{"line":12,"column":3}}, + "expression": { + "type": "NumericLiteral", + "start":69,"end":71,"loc":{"start":{"line":12,"column":0},"end":{"line":12,"column":2}}, + "extra": { + "rawValue": 5, + "raw": "05" + }, + "value": 5 + } + }, + { + "type": "ExpressionStatement", + "start":74,"end":96,"loc":{"start":{"line":14,"column":0},"end":{"line":14,"column":22}}, + "expression": { + "type": "StringLiteral", + "start":74,"end":95,"loc":{"start":{"line":14,"column":0},"end":{"line":14,"column":21}}, + "extra": { + "rawValue": "\u0004 foo \u0005 bar \u0006", + "raw": "\"\\04 foo \\05 bar \\06\"" + }, + "value": "\u0004 foo \u0005 bar \u0006" + } + } + ], + "directives": [ + { + "type": "Directive", + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, + "value": { + "type": "DirectiveLiteral", + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, + "value": "\\01 foo \\02 bar \\03", + "extra": { + "raw": "\"\\01 foo \\02 bar \\03\"", + "rawValue": "\\01 foo \\02 bar \\03" + } + } + }, + { + "type": "Directive", + "start":24,"end":29,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":5}}, + "value": { + "type": "DirectiveLiteral", + "start":24,"end":28,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":4}}, + "value": "\\4", + "extra": { + "raw": "\"\\4\"", + "rawValue": "\\4" + } + } + }, + { + "type": "Directive", + "start":30,"end":35,"loc":{"start":{"line":4,"column":0},"end":{"line":4,"column":5}}, + "value": { + "type": "DirectiveLiteral", + "start":30,"end":34,"loc":{"start":{"line":4,"column":0},"end":{"line":4,"column":4}}, + "value": "\\5", + "extra": { + "raw": "\"\\5\"", + "rawValue": "\\5" + } + } + }, + { + "type": "Directive", + "start":37,"end":50,"loc":{"start":{"line":6,"column":0},"end":{"line":6,"column":13}}, + "value": { + "type": "DirectiveLiteral", + "start":37,"end":49,"loc":{"start":{"line":6,"column":0},"end":{"line":6,"column":12}}, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + }, + { + "type": "Directive", + "start":52,"end":57,"loc":{"start":{"line":8,"column":0},"end":{"line":8,"column":5}}, + "value": { + "type": "DirectiveLiteral", + "start":52,"end":56,"loc":{"start":{"line":8,"column":0},"end":{"line":8,"column":4}}, + "value": "\\4", + "extra": { + "raw": "\"\\4\"", + "rawValue": "\\4" + } + } + }, + { + "type": "Directive", + "start":58,"end":63,"loc":{"start":{"line":9,"column":0},"end":{"line":9,"column":5}}, + "value": { + "type": "DirectiveLiteral", + "start":58,"end":62,"loc":{"start":{"line":9,"column":0},"end":{"line":9,"column":4}}, + "value": "\\5", + "extra": { + "raw": "\"\\5\"", + "rawValue": "\\5" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/regression/non-octal-float-strict-mode/options.json b/packages/babel-parser/test/fixtures/core/regression/non-octal-float-strict-mode/options.json index 8ac5b45f7194..2104ca43283f 100644 --- a/packages/babel-parser/test/fixtures/core/regression/non-octal-float-strict-mode/options.json +++ b/packages/babel-parser/test/fixtures/core/regression/non-octal-float-strict-mode/options.json @@ -1,4 +1,3 @@ { - "sourceType": "module", - "throws": "Legacy octal literals are not allowed in strict mode (1:0)" + "sourceType": "module" } diff --git a/packages/babel-parser/test/fixtures/core/regression/non-octal-float-strict-mode/output.json b/packages/babel-parser/test/fixtures/core/regression/non-octal-float-strict-mode/output.json new file mode 100644 index 000000000000..7cc466fa1ded --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/regression/non-octal-float-strict-mode/output.json @@ -0,0 +1,29 @@ +{ + "type": "File", + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, + "errors": [ + "SyntaxError: Legacy octal literals are not allowed in strict mode (1:0)" + ], + "program": { + "type": "Program", + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, + "expression": { + "type": "NumericLiteral", + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, + "extra": { + "rawValue": 9.5, + "raw": "09.5" + }, + "value": 9.5 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/regression/non-octal-float/output.json b/packages/babel-parser/test/fixtures/core/regression/non-octal-float/output.json index f48f7a786775..922adbe94650 100644 --- a/packages/babel-parser/test/fixtures/core/regression/non-octal-float/output.json +++ b/packages/babel-parser/test/fixtures/core/regression/non-octal-float/output.json @@ -1,62 +1,18 @@ { "type": "File", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - }, + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, "program": { "type": "Program", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - }, + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - }, + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, "expression": { "type": "NumericLiteral", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - }, + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, "extra": { "rawValue": 9.5, "raw": "09.5" diff --git a/packages/babel-parser/test/fixtures/core/regression/use-strict-with-pre-semi/output.json b/packages/babel-parser/test/fixtures/core/regression/use-strict-with-pre-semi/output.json index 694c18f640d7..3b6ea25634f9 100644 --- a/packages/babel-parser/test/fixtures/core/regression/use-strict-with-pre-semi/output.json +++ b/packages/babel-parser/test/fixtures/core/regression/use-strict-with-pre-semi/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 55, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":55,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 55, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":55,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 55, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":55,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "id": { "type": "Identifier", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - }, - "identifierName": "a" - }, + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"a"}, "name": "a" }, "generator": false, @@ -65,128 +20,39 @@ "params": [ { "type": "AssignmentPattern", - "start": 12, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":12,"end":20,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":20}}, "left": { "type": "ArrayPattern", - "start": 12, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":12,"end":15,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":15}}, "elements": [ { "type": "Identifier", - "start": 13, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - }, - "identifierName": "a" - }, + "start":13,"end":14,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":14},"identifierName":"a"}, "name": "a" } ] }, "right": { "type": "ArrayExpression", - "start": 18, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":18,"end":20,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":20}}, "elements": [] } } ], "body": { "type": "BlockStatement", - "start": 22, - "end": 55, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":22,"end":55,"loc":{"start":{"line":1,"column":22},"end":{"line":3,"column":1}}, "body": [ { "type": "EmptyStatement", - "start": 25, - "end": 26, - "loc": { - "start": { - "line": 2, - "column": 1 - }, - "end": { - "line": 2, - "column": 2 - } - } + "start":25,"end":26,"loc":{"start":{"line":2,"column":1},"end":{"line":2,"column":2}} }, { "type": "ExpressionStatement", - "start": 27, - "end": 40, - "loc": { - "start": { - "line": 2, - "column": 3 - }, - "end": { - "line": 2, - "column": 16 - } - }, + "start":27,"end":40,"loc":{"start":{"line":2,"column":3},"end":{"line":2,"column":16}}, "expression": { "type": "StringLiteral", - "start": 27, - "end": 39, - "loc": { - "start": { - "line": 2, - "column": 3 - }, - "end": { - "line": 2, - "column": 15 - } - }, + "start":27,"end":39,"loc":{"start":{"line":2,"column":3},"end":{"line":2,"column":15}}, "extra": { "rawValue": "use strict", "raw": "'use strict'" @@ -196,48 +62,15 @@ }, { "type": "WithStatement", - "start": 41, - "end": 53, - "loc": { - "start": { - "line": 2, - "column": 17 - }, - "end": { - "line": 2, - "column": 29 - } - }, + "start":41,"end":53,"loc":{"start":{"line":2,"column":17},"end":{"line":2,"column":29}}, "object": { "type": "ObjectExpression", - "start": 47, - "end": 49, - "loc": { - "start": { - "line": 2, - "column": 23 - }, - "end": { - "line": 2, - "column": 25 - } - }, + "start":47,"end":49,"loc":{"start":{"line":2,"column":23},"end":{"line":2,"column":25}}, "properties": [] }, "body": { "type": "BlockStatement", - "start": 51, - "end": 53, - "loc": { - "start": { - "line": 2, - "column": 27 - }, - "end": { - "line": 2, - "column": 29 - } - }, + "start":51,"end":53,"loc":{"start":{"line":2,"column":27},"end":{"line":2,"column":29}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-2nd-lvl-lex-nested/options.json b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-2nd-lvl-lex-nested/options.json deleted file mode 100644 index b09098cda9c8..000000000000 --- a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-2nd-lvl-lex-nested/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'foo' has already been declared (4:6)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-2nd-lvl-lex-nested/output.json b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-2nd-lvl-lex-nested/output.json new file mode 100644 index 000000000000..bf01e24b493d --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-2nd-lvl-lex-nested/output.json @@ -0,0 +1,90 @@ +{ + "type": "File", + "start":0,"end":44,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, + "errors": [ + "SyntaxError: Identifier 'foo' has already been declared (4:6)" + ], + "program": { + "type": "Program", + "start":0,"end":44,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "BlockStatement", + "start":0,"end":44,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, + "body": [ + { + "type": "VariableDeclaration", + "start":4,"end":12,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":10}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":8,"end":11,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":9}}, + "id": { + "type": "Identifier", + "start":8,"end":11,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":9},"identifierName":"bar"}, + "name": "bar" + }, + "init": null + } + ], + "kind": "let" + }, + { + "type": "VariableDeclaration", + "start":15,"end":27,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":14}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":19,"end":26,"loc":{"start":{"line":3,"column":6},"end":{"line":3,"column":13}}, + "id": { + "type": "Identifier", + "start":19,"end":22,"loc":{"start":{"line":3,"column":6},"end":{"line":3,"column":9},"identifierName":"foo"}, + "name": "foo" + }, + "init": { + "type": "NumericLiteral", + "start":25,"end":26,"loc":{"start":{"line":3,"column":12},"end":{"line":3,"column":13}}, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + ], + "kind": "var" + }, + { + "type": "VariableDeclaration", + "start":30,"end":42,"loc":{"start":{"line":4,"column":2},"end":{"line":4,"column":14}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":34,"end":41,"loc":{"start":{"line":4,"column":6},"end":{"line":4,"column":13}}, + "id": { + "type": "Identifier", + "start":34,"end":37,"loc":{"start":{"line":4,"column":6},"end":{"line":4,"column":9},"identifierName":"foo"}, + "name": "foo" + }, + "init": { + "type": "NumericLiteral", + "start":40,"end":41,"loc":{"start":{"line":4,"column":12},"end":{"line":4,"column":13}}, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + ], + "kind": "let" + } + ], + "directives": [] + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-2nd-lvl-lex/options.json b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-2nd-lvl-lex/options.json deleted file mode 100644 index 37dd7bff7207..000000000000 --- a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-2nd-lvl-lex/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'foo' has already been declared (3:4)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-2nd-lvl-lex/output.json b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-2nd-lvl-lex/output.json new file mode 100644 index 000000000000..dd515037db96 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-2nd-lvl-lex/output.json @@ -0,0 +1,83 @@ +{ + "type": "File", + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":12}}, + "errors": [ + "SyntaxError: Identifier 'foo' has already been declared (3:4)" + ], + "program": { + "type": "Program", + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":12}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":4,"end":7,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":7}}, + "id": { + "type": "Identifier", + "start":4,"end":7,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":7},"identifierName":"bar"}, + "name": "bar" + }, + "init": null + } + ], + "kind": "let" + }, + { + "type": "VariableDeclaration", + "start":9,"end":21,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":12}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":13,"end":20,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":11}}, + "id": { + "type": "Identifier", + "start":13,"end":16,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":7},"identifierName":"foo"}, + "name": "foo" + }, + "init": { + "type": "NumericLiteral", + "start":19,"end":20,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":11}}, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + ], + "kind": "var" + }, + { + "type": "VariableDeclaration", + "start":22,"end":34,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":12}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":26,"end":33,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":11}}, + "id": { + "type": "Identifier", + "start":26,"end":29,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":7},"identifierName":"foo"}, + "name": "foo" + }, + "init": { + "type": "NumericLiteral", + "start":32,"end":33,"loc":{"start":{"line":3,"column":10},"end":{"line":3,"column":11}}, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + ], + "kind": "let" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-2nd-lvl-var-nested/options.json b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-2nd-lvl-var-nested/options.json deleted file mode 100644 index b09098cda9c8..000000000000 --- a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-2nd-lvl-var-nested/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'foo' has already been declared (4:6)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-2nd-lvl-var-nested/output.json b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-2nd-lvl-var-nested/output.json new file mode 100644 index 000000000000..26e7aee9b70c --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-2nd-lvl-var-nested/output.json @@ -0,0 +1,90 @@ +{ + "type": "File", + "start":0,"end":44,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, + "errors": [ + "SyntaxError: Identifier 'foo' has already been declared (4:6)" + ], + "program": { + "type": "Program", + "start":0,"end":44,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "BlockStatement", + "start":0,"end":44,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, + "body": [ + { + "type": "VariableDeclaration", + "start":4,"end":12,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":10}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":8,"end":11,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":9}}, + "id": { + "type": "Identifier", + "start":8,"end":11,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":9},"identifierName":"bar"}, + "name": "bar" + }, + "init": null + } + ], + "kind": "let" + }, + { + "type": "VariableDeclaration", + "start":15,"end":27,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":14}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":19,"end":26,"loc":{"start":{"line":3,"column":6},"end":{"line":3,"column":13}}, + "id": { + "type": "Identifier", + "start":19,"end":22,"loc":{"start":{"line":3,"column":6},"end":{"line":3,"column":9},"identifierName":"foo"}, + "name": "foo" + }, + "init": { + "type": "NumericLiteral", + "start":25,"end":26,"loc":{"start":{"line":3,"column":12},"end":{"line":3,"column":13}}, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + ], + "kind": "let" + }, + { + "type": "VariableDeclaration", + "start":30,"end":42,"loc":{"start":{"line":4,"column":2},"end":{"line":4,"column":14}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":34,"end":41,"loc":{"start":{"line":4,"column":6},"end":{"line":4,"column":13}}, + "id": { + "type": "Identifier", + "start":34,"end":37,"loc":{"start":{"line":4,"column":6},"end":{"line":4,"column":9},"identifierName":"foo"}, + "name": "foo" + }, + "init": { + "type": "NumericLiteral", + "start":40,"end":41,"loc":{"start":{"line":4,"column":12},"end":{"line":4,"column":13}}, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + ], + "kind": "var" + } + ], + "directives": [] + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-2nd-lvl-var/options.json b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-2nd-lvl-var/options.json deleted file mode 100644 index 37dd7bff7207..000000000000 --- a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-2nd-lvl-var/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'foo' has already been declared (3:4)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-2nd-lvl-var/output.json b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-2nd-lvl-var/output.json new file mode 100644 index 000000000000..9d5f3660774e --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-2nd-lvl-var/output.json @@ -0,0 +1,83 @@ +{ + "type": "File", + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":12}}, + "errors": [ + "SyntaxError: Identifier 'foo' has already been declared (3:4)" + ], + "program": { + "type": "Program", + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":12}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":4,"end":7,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":7}}, + "id": { + "type": "Identifier", + "start":4,"end":7,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":7},"identifierName":"bar"}, + "name": "bar" + }, + "init": null + } + ], + "kind": "let" + }, + { + "type": "VariableDeclaration", + "start":9,"end":21,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":12}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":13,"end":20,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":11}}, + "id": { + "type": "Identifier", + "start":13,"end":16,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":7},"identifierName":"foo"}, + "name": "foo" + }, + "init": { + "type": "NumericLiteral", + "start":19,"end":20,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":11}}, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + ], + "kind": "let" + }, + { + "type": "VariableDeclaration", + "start":22,"end":34,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":12}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":26,"end":33,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":11}}, + "id": { + "type": "Identifier", + "start":26,"end":29,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":7},"identifierName":"foo"}, + "name": "foo" + }, + "init": { + "type": "NumericLiteral", + "start":32,"end":33,"loc":{"start":{"line":3,"column":10},"end":{"line":3,"column":11}}, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + ], + "kind": "var" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-arr-destr/options.json b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-arr-destr/options.json deleted file mode 100644 index 70121ca46ead..000000000000 --- a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-arr-destr/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'foo' has already been declared (2:15)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-arr-destr/output.json b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-arr-destr/output.json new file mode 100644 index 000000000000..294f5fbc9c7f --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-arr-destr/output.json @@ -0,0 +1,53 @@ +{ + "type": "File", + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "errors": [ + "SyntaxError: Identifier 'foo' has already been declared (2:15)" + ], + "program": { + "type": "Program", + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "TryStatement", + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "block": { + "type": "BlockStatement", + "start":4,"end":7,"loc":{"start":{"line":1,"column":4},"end":{"line":2,"column":1}}, + "body": [], + "directives": [] + }, + "handler": { + "type": "CatchClause", + "start":8,"end":30,"loc":{"start":{"line":2,"column":2},"end":{"line":3,"column":1}}, + "param": { + "type": "ArrayPattern", + "start":15,"end":25,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":19}}, + "elements": [ + { + "type": "Identifier", + "start":16,"end":19,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":13},"identifierName":"foo"}, + "name": "foo" + }, + { + "type": "Identifier", + "start":21,"end":24,"loc":{"start":{"line":2,"column":15},"end":{"line":2,"column":18},"identifierName":"foo"}, + "name": "foo" + } + ] + }, + "body": { + "type": "BlockStatement", + "start":27,"end":30,"loc":{"start":{"line":2,"column":21},"end":{"line":3,"column":1}}, + "body": [], + "directives": [] + } + }, + "finalizer": null + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-dbl-let/options.json b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-dbl-let/options.json deleted file mode 100644 index 386e81ecdc4c..000000000000 --- a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-dbl-let/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'foo' has already been declared (1:35)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-dbl-let/output.json b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-dbl-let/output.json new file mode 100644 index 000000000000..532647600b3c --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-dbl-let/output.json @@ -0,0 +1,76 @@ +{ + "type": "File", + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":39}}, + "errors": [ + "SyntaxError: Identifier 'foo' has already been declared (1:35)" + ], + "program": { + "type": "Program", + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":39}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":4,"end":7,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":7}}, + "id": { + "type": "Identifier", + "start":4,"end":7,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":7},"identifierName":"foo"}, + "name": "foo" + }, + "init": null + } + ], + "kind": "let" + }, + { + "type": "TryStatement", + "start":9,"end":30,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":30}}, + "block": { + "type": "BlockStatement", + "start":13,"end":15,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":15}}, + "body": [], + "directives": [] + }, + "handler": { + "type": "CatchClause", + "start":16,"end":30,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":30}}, + "param": { + "type": "Identifier", + "start":23,"end":26,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":26},"identifierName":"foo"}, + "name": "foo" + }, + "body": { + "type": "BlockStatement", + "start":28,"end":30,"loc":{"start":{"line":1,"column":28},"end":{"line":1,"column":30}}, + "body": [], + "directives": [] + } + }, + "finalizer": null + }, + { + "type": "VariableDeclaration", + "start":31,"end":39,"loc":{"start":{"line":1,"column":31},"end":{"line":1,"column":39}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":35,"end":38,"loc":{"start":{"line":1,"column":35},"end":{"line":1,"column":38}}, + "id": { + "type": "Identifier", + "start":35,"end":38,"loc":{"start":{"line":1,"column":35},"end":{"line":1,"column":38},"identifierName":"foo"}, + "name": "foo" + }, + "init": null + } + ], + "kind": "let" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-func/options.json b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-func/options.json deleted file mode 100644 index 62b0c73eb164..000000000000 --- a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-func/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'foo' has already been declared (3:11)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-func/output.json b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-func/output.json new file mode 100644 index 000000000000..680f5225864d --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-func/output.json @@ -0,0 +1,61 @@ +{ + "type": "File", + "start":0,"end":43,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "errors": [ + "SyntaxError: Identifier 'foo' has already been declared (3:11)" + ], + "program": { + "type": "Program", + "start":0,"end":43,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "TryStatement", + "start":0,"end":43,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "block": { + "type": "BlockStatement", + "start":4,"end":7,"loc":{"start":{"line":1,"column":4},"end":{"line":2,"column":1}}, + "body": [], + "directives": [] + }, + "handler": { + "type": "CatchClause", + "start":8,"end":43,"loc":{"start":{"line":2,"column":2},"end":{"line":4,"column":1}}, + "param": { + "type": "Identifier", + "start":15,"end":18,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":12},"identifierName":"foo"}, + "name": "foo" + }, + "body": { + "type": "BlockStatement", + "start":20,"end":43,"loc":{"start":{"line":2,"column":14},"end":{"line":4,"column":1}}, + "body": [ + { + "type": "FunctionDeclaration", + "start":24,"end":41,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":19}}, + "id": { + "type": "Identifier", + "start":33,"end":36,"loc":{"start":{"line":3,"column":11},"end":{"line":3,"column":14},"identifierName":"foo"}, + "name": "foo" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":39,"end":41,"loc":{"start":{"line":3,"column":17},"end":{"line":3,"column":19}}, + "body": [], + "directives": [] + } + } + ], + "directives": [] + } + }, + "finalizer": null + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-hang-func/output.json b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-hang-func/output.json index a465e0c09fb0..814efb6b1328 100644 --- a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-hang-func/output.json +++ b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-hang-func/output.json @@ -1,139 +1,39 @@ { "type": "File", - "start": 0, - "end": 50, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":0,"end":50,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 50, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":0,"end":50,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "TryStatement", - "start": 0, - "end": 50, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":0,"end":50,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, "block": { "type": "BlockStatement", - "start": 4, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 2, - "column": 1 - } - }, + "start":4,"end":7,"loc":{"start":{"line":1,"column":4},"end":{"line":2,"column":1}}, "body": [], "directives": [] }, "handler": { "type": "CatchClause", - "start": 8, - "end": 50, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":8,"end":50,"loc":{"start":{"line":2,"column":2},"end":{"line":4,"column":1}}, "param": { "type": "Identifier", - "start": 15, - "end": 18, - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 12 - }, - "identifierName": "foo" - }, + "start":15,"end":18,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":12},"identifierName":"foo"}, "name": "foo" }, "body": { "type": "BlockStatement", - "start": 20, - "end": 50, - "loc": { - "start": { - "line": 2, - "column": 14 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":20,"end":50,"loc":{"start":{"line":2,"column":14},"end":{"line":4,"column":1}}, "body": [ { "type": "IfStatement", - "start": 24, - "end": 48, - "loc": { - "start": { - "line": 3, - "column": 2 - }, - "end": { - "line": 3, - "column": 26 - } - }, + "start":24,"end":48,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":26}}, "test": { "type": "NumericLiteral", - "start": 28, - "end": 29, - "loc": { - "start": { - "line": 3, - "column": 6 - }, - "end": { - "line": 3, - "column": 7 - } - }, + "start":28,"end":29,"loc":{"start":{"line":3,"column":6},"end":{"line":3,"column":7}}, "extra": { "rawValue": 1, "raw": "1" @@ -142,33 +42,10 @@ }, "consequent": { "type": "FunctionDeclaration", - "start": 31, - "end": 48, - "loc": { - "start": { - "line": 3, - "column": 9 - }, - "end": { - "line": 3, - "column": 26 - } - }, + "start":31,"end":48,"loc":{"start":{"line":3,"column":9},"end":{"line":3,"column":26}}, "id": { "type": "Identifier", - "start": 40, - "end": 43, - "loc": { - "start": { - "line": 3, - "column": 18 - }, - "end": { - "line": 3, - "column": 21 - }, - "identifierName": "foo" - }, + "start":40,"end":43,"loc":{"start":{"line":3,"column":18},"end":{"line":3,"column":21},"identifierName":"foo"}, "name": "foo" }, "generator": false, @@ -176,18 +53,7 @@ "params": [], "body": { "type": "BlockStatement", - "start": 46, - "end": 48, - "loc": { - "start": { - "line": 3, - "column": 24 - }, - "end": { - "line": 3, - "column": 26 - } - }, + "start":46,"end":48,"loc":{"start":{"line":3,"column":24},"end":{"line":3,"column":26}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-let-outside/output.json b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-let-outside/output.json index 8c0ce7e4c006..65c88c1b7f7f 100644 --- a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-let-outside/output.json +++ b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-let-outside/output.json @@ -1,110 +1,32 @@ { "type": "File", - "start": 0, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 8 - } - }, + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":8}}, "program": { "type": "Program", - "start": 0, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 8 - } - }, + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":8}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "TryStatement", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "block": { "type": "BlockStatement", - "start": 4, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 2, - "column": 1 - } - }, + "start":4,"end":7,"loc":{"start":{"line":1,"column":4},"end":{"line":2,"column":1}}, "body": [], "directives": [] }, "handler": { "type": "CatchClause", - "start": 8, - "end": 23, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":8,"end":23,"loc":{"start":{"line":2,"column":2},"end":{"line":3,"column":1}}, "param": { "type": "Identifier", - "start": 15, - "end": 18, - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 12 - }, - "identifierName": "foo" - }, + "start":15,"end":18,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":12},"identifierName":"foo"}, "name": "foo" }, "body": { "type": "BlockStatement", - "start": 20, - "end": 23, - "loc": { - "start": { - "line": 2, - "column": 14 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":20,"end":23,"loc":{"start":{"line":2,"column":14},"end":{"line":3,"column":1}}, "body": [], "directives": [] } @@ -113,48 +35,14 @@ }, { "type": "VariableDeclaration", - "start": 24, - "end": 32, - "loc": { - "start": { - "line": 4, - "column": 0 - }, - "end": { - "line": 4, - "column": 8 - } - }, + "start":24,"end":32,"loc":{"start":{"line":4,"column":0},"end":{"line":4,"column":8}}, "declarations": [ { "type": "VariableDeclarator", - "start": 28, - "end": 31, - "loc": { - "start": { - "line": 4, - "column": 4 - }, - "end": { - "line": 4, - "column": 7 - } - }, + "start":28,"end":31,"loc":{"start":{"line":4,"column":4},"end":{"line":4,"column":7}}, "id": { "type": "Identifier", - "start": 28, - "end": 31, - "loc": { - "start": { - "line": 4, - "column": 4 - }, - "end": { - "line": 4, - "column": 7 - }, - "identifierName": "foo" - }, + "start":28,"end":31,"loc":{"start":{"line":4,"column":4},"end":{"line":4,"column":7},"identifierName":"foo"}, "name": "foo" }, "init": null diff --git a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-let/options.json b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-let/options.json deleted file mode 100644 index 254a763e653e..000000000000 --- a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-let/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'foo' has already been declared (3:6)" -} diff --git a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-let/output.json b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-let/output.json new file mode 100644 index 000000000000..b1c8e29872ae --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-let/output.json @@ -0,0 +1,60 @@ +{ + "type": "File", + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "errors": [ + "SyntaxError: Identifier 'foo' has already been declared (3:6)" + ], + "program": { + "type": "Program", + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "TryStatement", + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "block": { + "type": "BlockStatement", + "start":4,"end":7,"loc":{"start":{"line":1,"column":4},"end":{"line":2,"column":1}}, + "body": [], + "directives": [] + }, + "handler": { + "type": "CatchClause", + "start":8,"end":34,"loc":{"start":{"line":2,"column":2},"end":{"line":4,"column":1}}, + "param": { + "type": "Identifier", + "start":15,"end":18,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":12},"identifierName":"foo"}, + "name": "foo" + }, + "body": { + "type": "BlockStatement", + "start":20,"end":34,"loc":{"start":{"line":2,"column":14},"end":{"line":4,"column":1}}, + "body": [ + { + "type": "VariableDeclaration", + "start":24,"end":32,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":10}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":28,"end":31,"loc":{"start":{"line":3,"column":6},"end":{"line":3,"column":9}}, + "id": { + "type": "Identifier", + "start":28,"end":31,"loc":{"start":{"line":3,"column":6},"end":{"line":3,"column":9},"identifierName":"foo"}, + "name": "foo" + }, + "init": null + } + ], + "kind": "let" + } + ], + "directives": [] + } + }, + "finalizer": null + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-obj-destr/options.json b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-obj-destr/options.json deleted file mode 100644 index a00c2989e1b1..000000000000 --- a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-obj-destr/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'foo' has already been declared (2:28)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-obj-destr/output.json b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-obj-destr/output.json new file mode 100644 index 000000000000..01f965585c34 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-obj-destr/output.json @@ -0,0 +1,101 @@ +{ + "type": "File", + "start":0,"end":47,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "errors": [ + "SyntaxError: Identifier 'foo' has already been declared (2:28)" + ], + "program": { + "type": "Program", + "start":0,"end":47,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "TryStatement", + "start":0,"end":47,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "block": { + "type": "BlockStatement", + "start":4,"end":7,"loc":{"start":{"line":1,"column":4},"end":{"line":2,"column":1}}, + "body": [], + "directives": [] + }, + "handler": { + "type": "CatchClause", + "start":8,"end":47,"loc":{"start":{"line":2,"column":2},"end":{"line":3,"column":1}}, + "param": { + "type": "ObjectPattern", + "start":15,"end":42,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":36}}, + "properties": [ + { + "type": "ObjectProperty", + "start":17,"end":23,"loc":{"start":{"line":2,"column":11},"end":{"line":2,"column":17}}, + "method": false, + "key": { + "type": "Identifier", + "start":17,"end":18,"loc":{"start":{"line":2,"column":11},"end":{"line":2,"column":12},"identifierName":"a"}, + "name": "a" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "Identifier", + "start":20,"end":23,"loc":{"start":{"line":2,"column":14},"end":{"line":2,"column":17},"identifierName":"foo"}, + "name": "foo" + } + }, + { + "type": "ObjectProperty", + "start":25,"end":40,"loc":{"start":{"line":2,"column":19},"end":{"line":2,"column":34}}, + "method": false, + "key": { + "type": "Identifier", + "start":25,"end":26,"loc":{"start":{"line":2,"column":19},"end":{"line":2,"column":20},"identifierName":"b"}, + "name": "b" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "ObjectPattern", + "start":28,"end":40,"loc":{"start":{"line":2,"column":22},"end":{"line":2,"column":34}}, + "properties": [ + { + "type": "ObjectProperty", + "start":30,"end":38,"loc":{"start":{"line":2,"column":24},"end":{"line":2,"column":32}}, + "method": false, + "key": { + "type": "Identifier", + "start":30,"end":31,"loc":{"start":{"line":2,"column":24},"end":{"line":2,"column":25},"identifierName":"c"}, + "name": "c" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "ArrayPattern", + "start":33,"end":38,"loc":{"start":{"line":2,"column":27},"end":{"line":2,"column":32}}, + "elements": [ + { + "type": "Identifier", + "start":34,"end":37,"loc":{"start":{"line":2,"column":28},"end":{"line":2,"column":31},"identifierName":"foo"}, + "name": "foo" + } + ] + } + } + ] + } + } + ] + }, + "body": { + "type": "BlockStatement", + "start":44,"end":47,"loc":{"start":{"line":2,"column":38},"end":{"line":3,"column":1}}, + "body": [], + "directives": [] + } + }, + "finalizer": null + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-var-arr-destr/options.json b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-var-arr-destr/options.json deleted file mode 100644 index ff69adb0860a..000000000000 --- a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-var-arr-destr/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'foo' has already been declared (3:6)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-var-arr-destr/output.json b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-var-arr-destr/output.json new file mode 100644 index 000000000000..8f5d30047039 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-var-arr-destr/output.json @@ -0,0 +1,66 @@ +{ + "type": "File", + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "errors": [ + "SyntaxError: Identifier 'foo' has already been declared (3:6)" + ], + "program": { + "type": "Program", + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "TryStatement", + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "block": { + "type": "BlockStatement", + "start":4,"end":7,"loc":{"start":{"line":1,"column":4},"end":{"line":2,"column":1}}, + "body": [], + "directives": [] + }, + "handler": { + "type": "CatchClause", + "start":8,"end":36,"loc":{"start":{"line":2,"column":2},"end":{"line":4,"column":1}}, + "param": { + "type": "ArrayPattern", + "start":15,"end":20,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":14}}, + "elements": [ + { + "type": "Identifier", + "start":16,"end":19,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":13},"identifierName":"foo"}, + "name": "foo" + } + ] + }, + "body": { + "type": "BlockStatement", + "start":22,"end":36,"loc":{"start":{"line":2,"column":16},"end":{"line":4,"column":1}}, + "body": [ + { + "type": "VariableDeclaration", + "start":26,"end":34,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":10}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":30,"end":33,"loc":{"start":{"line":3,"column":6},"end":{"line":3,"column":9}}, + "id": { + "type": "Identifier", + "start":30,"end":33,"loc":{"start":{"line":3,"column":6},"end":{"line":3,"column":9},"identifierName":"foo"}, + "name": "foo" + }, + "init": null + } + ], + "kind": "var" + } + ], + "directives": [] + } + }, + "finalizer": null + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-var-nested/output.json b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-var-nested/output.json index 1baae9250df9..e69000f54df0 100644 --- a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-var-nested/output.json +++ b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-var-nested/output.json @@ -1,232 +1,64 @@ { "type": "File", - "start": 0, - "end": 64, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 7, - "column": 1 - } - }, + "start":0,"end":64,"loc":{"start":{"line":1,"column":0},"end":{"line":7,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 64, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 7, - "column": 1 - } - }, + "start":0,"end":64,"loc":{"start":{"line":1,"column":0},"end":{"line":7,"column":1}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "TryStatement", - "start": 0, - "end": 64, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 7, - "column": 1 - } - }, + "start":0,"end":64,"loc":{"start":{"line":1,"column":0},"end":{"line":7,"column":1}}, "block": { "type": "BlockStatement", - "start": 4, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 2, - "column": 1 - } - }, + "start":4,"end":7,"loc":{"start":{"line":1,"column":4},"end":{"line":2,"column":1}}, "body": [], "directives": [] }, "handler": { "type": "CatchClause", - "start": 8, - "end": 64, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 7, - "column": 1 - } - }, + "start":8,"end":64,"loc":{"start":{"line":2,"column":2},"end":{"line":7,"column":1}}, "param": { "type": "Identifier", - "start": 15, - "end": 18, - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 12 - }, - "identifierName": "foo" - }, + "start":15,"end":18,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":12},"identifierName":"foo"}, "name": "foo" }, "body": { "type": "BlockStatement", - "start": 20, - "end": 64, - "loc": { - "start": { - "line": 2, - "column": 14 - }, - "end": { - "line": 7, - "column": 1 - } - }, + "start":20,"end":64,"loc":{"start":{"line":2,"column":14},"end":{"line":7,"column":1}}, "body": [ { "type": "TryStatement", - "start": 24, - "end": 62, - "loc": { - "start": { - "line": 3, - "column": 2 - }, - "end": { - "line": 6, - "column": 3 - } - }, + "start":24,"end":62,"loc":{"start":{"line":3,"column":2},"end":{"line":6,"column":3}}, "block": { "type": "BlockStatement", - "start": 28, - "end": 33, - "loc": { - "start": { - "line": 3, - "column": 6 - }, - "end": { - "line": 4, - "column": 3 - } - }, + "start":28,"end":33,"loc":{"start":{"line":3,"column":6},"end":{"line":4,"column":3}}, "body": [], "directives": [] }, "handler": { "type": "CatchClause", - "start": 34, - "end": 62, - "loc": { - "start": { - "line": 4, - "column": 4 - }, - "end": { - "line": 6, - "column": 3 - } - }, + "start":34,"end":62,"loc":{"start":{"line":4,"column":4},"end":{"line":6,"column":3}}, "param": { "type": "Identifier", - "start": 41, - "end": 42, - "loc": { - "start": { - "line": 4, - "column": 11 - }, - "end": { - "line": 4, - "column": 12 - }, - "identifierName": "_" - }, + "start":41,"end":42,"loc":{"start":{"line":4,"column":11},"end":{"line":4,"column":12},"identifierName":"_"}, "name": "_" }, "body": { "type": "BlockStatement", - "start": 44, - "end": 62, - "loc": { - "start": { - "line": 4, - "column": 14 - }, - "end": { - "line": 6, - "column": 3 - } - }, + "start":44,"end":62,"loc":{"start":{"line":4,"column":14},"end":{"line":6,"column":3}}, "body": [ { "type": "VariableDeclaration", - "start": 50, - "end": 58, - "loc": { - "start": { - "line": 5, - "column": 4 - }, - "end": { - "line": 5, - "column": 12 - } - }, + "start":50,"end":58,"loc":{"start":{"line":5,"column":4},"end":{"line":5,"column":12}}, "declarations": [ { "type": "VariableDeclarator", - "start": 54, - "end": 57, - "loc": { - "start": { - "line": 5, - "column": 8 - }, - "end": { - "line": 5, - "column": 11 - } - }, + "start":54,"end":57,"loc":{"start":{"line":5,"column":8},"end":{"line":5,"column":11}}, "id": { "type": "Identifier", - "start": 54, - "end": 57, - "loc": { - "start": { - "line": 5, - "column": 8 - }, - "end": { - "line": 5, - "column": 11 - }, - "identifierName": "foo" - }, + "start":54,"end":57,"loc":{"start":{"line":5,"column":8},"end":{"line":5,"column":11},"identifierName":"foo"}, "name": "foo" }, "init": null diff --git a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-var-obj-destr/options.json b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-var-obj-destr/options.json deleted file mode 100644 index ff69adb0860a..000000000000 --- a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-var-obj-destr/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'foo' has already been declared (3:6)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-var-obj-destr/output.json b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-var-obj-destr/output.json new file mode 100644 index 000000000000..df5372c2f51e --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-var-obj-destr/output.json @@ -0,0 +1,81 @@ +{ + "type": "File", + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "errors": [ + "SyntaxError: Identifier 'foo' has already been declared (3:6)" + ], + "program": { + "type": "Program", + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "TryStatement", + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "block": { + "type": "BlockStatement", + "start":4,"end":7,"loc":{"start":{"line":1,"column":4},"end":{"line":2,"column":1}}, + "body": [], + "directives": [] + }, + "handler": { + "type": "CatchClause", + "start":8,"end":38,"loc":{"start":{"line":2,"column":2},"end":{"line":4,"column":1}}, + "param": { + "type": "ObjectPattern", + "start":15,"end":22,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":16}}, + "properties": [ + { + "type": "ObjectProperty", + "start":17,"end":20,"loc":{"start":{"line":2,"column":11},"end":{"line":2,"column":14}}, + "method": false, + "key": { + "type": "Identifier", + "start":17,"end":20,"loc":{"start":{"line":2,"column":11},"end":{"line":2,"column":14},"identifierName":"foo"}, + "name": "foo" + }, + "computed": false, + "shorthand": true, + "value": { + "type": "Identifier", + "start":17,"end":20,"loc":{"start":{"line":2,"column":11},"end":{"line":2,"column":14},"identifierName":"foo"}, + "name": "foo" + }, + "extra": { + "shorthand": true + } + } + ] + }, + "body": { + "type": "BlockStatement", + "start":24,"end":38,"loc":{"start":{"line":2,"column":18},"end":{"line":4,"column":1}}, + "body": [ + { + "type": "VariableDeclaration", + "start":28,"end":36,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":10}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":32,"end":35,"loc":{"start":{"line":3,"column":6},"end":{"line":3,"column":9}}, + "id": { + "type": "Identifier", + "start":32,"end":35,"loc":{"start":{"line":3,"column":6},"end":{"line":3,"column":9},"identifierName":"foo"}, + "name": "foo" + }, + "init": null + } + ], + "kind": "var" + } + ], + "directives": [] + } + }, + "finalizer": null + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-var-outside/output.json b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-var-outside/output.json index f9626718bb97..80f8d1c3c584 100644 --- a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-var-outside/output.json +++ b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-var-outside/output.json @@ -1,110 +1,32 @@ { "type": "File", - "start": 0, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 8 - } - }, + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":8}}, "program": { "type": "Program", - "start": 0, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 8 - } - }, + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":8}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "TryStatement", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "block": { "type": "BlockStatement", - "start": 4, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 2, - "column": 1 - } - }, + "start":4,"end":7,"loc":{"start":{"line":1,"column":4},"end":{"line":2,"column":1}}, "body": [], "directives": [] }, "handler": { "type": "CatchClause", - "start": 8, - "end": 23, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":8,"end":23,"loc":{"start":{"line":2,"column":2},"end":{"line":3,"column":1}}, "param": { "type": "Identifier", - "start": 15, - "end": 18, - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 12 - }, - "identifierName": "foo" - }, + "start":15,"end":18,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":12},"identifierName":"foo"}, "name": "foo" }, "body": { "type": "BlockStatement", - "start": 20, - "end": 23, - "loc": { - "start": { - "line": 2, - "column": 14 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":20,"end":23,"loc":{"start":{"line":2,"column":14},"end":{"line":3,"column":1}}, "body": [], "directives": [] } @@ -113,48 +35,14 @@ }, { "type": "VariableDeclaration", - "start": 24, - "end": 32, - "loc": { - "start": { - "line": 4, - "column": 0 - }, - "end": { - "line": 4, - "column": 8 - } - }, + "start":24,"end":32,"loc":{"start":{"line":4,"column":0},"end":{"line":4,"column":8}}, "declarations": [ { "type": "VariableDeclarator", - "start": 28, - "end": 31, - "loc": { - "start": { - "line": 4, - "column": 4 - }, - "end": { - "line": 4, - "column": 7 - } - }, + "start":28,"end":31,"loc":{"start":{"line":4,"column":4},"end":{"line":4,"column":7}}, "id": { "type": "Identifier", - "start": 28, - "end": 31, - "loc": { - "start": { - "line": 4, - "column": 4 - }, - "end": { - "line": 4, - "column": 7 - }, - "identifierName": "foo" - }, + "start":28,"end":31,"loc":{"start":{"line":4,"column":4},"end":{"line":4,"column":7},"identifierName":"foo"}, "name": "foo" }, "init": null diff --git a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-var/output.json b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-var/output.json index 54bc80b8062d..26b9977bfcf6 100644 --- a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-var/output.json +++ b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-var/output.json @@ -1,155 +1,43 @@ { "type": "File", - "start": 0, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "TryStatement", - "start": 0, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, "block": { "type": "BlockStatement", - "start": 4, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 2, - "column": 1 - } - }, + "start":4,"end":7,"loc":{"start":{"line":1,"column":4},"end":{"line":2,"column":1}}, "body": [], "directives": [] }, "handler": { "type": "CatchClause", - "start": 8, - "end": 34, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":8,"end":34,"loc":{"start":{"line":2,"column":2},"end":{"line":4,"column":1}}, "param": { "type": "Identifier", - "start": 15, - "end": 18, - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 12 - }, - "identifierName": "foo" - }, + "start":15,"end":18,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":12},"identifierName":"foo"}, "name": "foo" }, "body": { "type": "BlockStatement", - "start": 20, - "end": 34, - "loc": { - "start": { - "line": 2, - "column": 14 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":20,"end":34,"loc":{"start":{"line":2,"column":14},"end":{"line":4,"column":1}}, "body": [ { "type": "VariableDeclaration", - "start": 24, - "end": 32, - "loc": { - "start": { - "line": 3, - "column": 2 - }, - "end": { - "line": 3, - "column": 10 - } - }, + "start":24,"end":32,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":10}}, "declarations": [ { "type": "VariableDeclarator", - "start": 28, - "end": 31, - "loc": { - "start": { - "line": 3, - "column": 6 - }, - "end": { - "line": 3, - "column": 9 - } - }, + "start":28,"end":31,"loc":{"start":{"line":3,"column":6},"end":{"line":3,"column":9}}, "id": { "type": "Identifier", - "start": 28, - "end": 31, - "loc": { - "start": { - "line": 3, - "column": 6 - }, - "end": { - "line": 3, - "column": 9 - }, - "identifierName": "foo" - }, + "start":28,"end":31,"loc":{"start":{"line":3,"column":6},"end":{"line":3,"column":9},"identifierName":"foo"}, "name": "foo" }, "init": null diff --git a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-class-class/options.json b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-class-class/options.json deleted file mode 100644 index cdd0ac832c57..000000000000 --- a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-class-class/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'foo' has already been declared (2:6)" -} diff --git a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-class-class/output.json b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-class-class/output.json new file mode 100644 index 000000000000..9668ddd49b8c --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-class-class/output.json @@ -0,0 +1,54 @@ +{ + "type": "File", + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":13}}, + "errors": [ + "SyntaxError: Identifier 'foo' has already been declared (2:6)" + ], + "program": { + "type": "Program", + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":13}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "id": { + "type": "Identifier", + "start":6,"end":9,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":9},"identifierName":"foo"}, + "name": "foo" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":10,"end":12,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":12}}, + "body": [] + } + }, + { + "type": "EmptyStatement", + "start":12,"end":13,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":13}} + }, + { + "type": "ClassDeclaration", + "start":14,"end":26,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":12}}, + "id": { + "type": "Identifier", + "start":20,"end":23,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":9},"identifierName":"foo"}, + "name": "foo" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":24,"end":26,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":12}}, + "body": [] + } + }, + { + "type": "EmptyStatement", + "start":26,"end":27,"loc":{"start":{"line":2,"column":12},"end":{"line":2,"column":13}} + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-class-const/options.json b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-class-const/options.json deleted file mode 100644 index c45b9bf38290..000000000000 --- a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-class-const/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'foo' has already been declared (2:6)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-class-const/output.json b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-class-const/output.json new file mode 100644 index 000000000000..fcb6f91989b7 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-class-const/output.json @@ -0,0 +1,60 @@ +{ + "type": "File", + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":14}}, + "errors": [ + "SyntaxError: Identifier 'foo' has already been declared (2:6)" + ], + "program": { + "type": "Program", + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":14}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "id": { + "type": "Identifier", + "start":6,"end":9,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":9},"identifierName":"foo"}, + "name": "foo" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":10,"end":12,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":12}}, + "body": [] + } + }, + { + "type": "EmptyStatement", + "start":12,"end":13,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":13}} + }, + { + "type": "VariableDeclaration", + "start":14,"end":28,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":14}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":20,"end":27,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":13}}, + "id": { + "type": "Identifier", + "start":20,"end":23,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":9},"identifierName":"foo"}, + "name": "foo" + }, + "init": { + "type": "NumericLiteral", + "start":26,"end":27,"loc":{"start":{"line":2,"column":12},"end":{"line":2,"column":13}}, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + ], + "kind": "const" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-class-func/options.json b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-class-func/options.json deleted file mode 100644 index 58aaf9d99d22..000000000000 --- a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-class-func/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'foo' has already been declared (2:9)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-class-func/output.json b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-class-func/output.json new file mode 100644 index 000000000000..251519a88b9e --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-class-func/output.json @@ -0,0 +1,57 @@ +{ + "type": "File", + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":19}}, + "errors": [ + "SyntaxError: Identifier 'foo' has already been declared (2:9)" + ], + "program": { + "type": "Program", + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":19}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "id": { + "type": "Identifier", + "start":6,"end":9,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":9},"identifierName":"foo"}, + "name": "foo" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":10,"end":12,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":12}}, + "body": [] + } + }, + { + "type": "EmptyStatement", + "start":12,"end":13,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":13}} + }, + { + "type": "FunctionDeclaration", + "start":14,"end":32,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":18}}, + "id": { + "type": "Identifier", + "start":23,"end":26,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":12},"identifierName":"foo"}, + "name": "foo" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":30,"end":32,"loc":{"start":{"line":2,"column":16},"end":{"line":2,"column":18}}, + "body": [], + "directives": [] + } + }, + { + "type": "EmptyStatement", + "start":32,"end":33,"loc":{"start":{"line":2,"column":18},"end":{"line":2,"column":19}} + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-class-let/options.json b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-class-let/options.json deleted file mode 100644 index bf89e4692c99..000000000000 --- a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-class-let/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'foo' has already been declared (2:4)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-class-let/output.json b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-class-let/output.json new file mode 100644 index 000000000000..40ac7749d89c --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-class-let/output.json @@ -0,0 +1,60 @@ +{ + "type": "File", + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":12}}, + "errors": [ + "SyntaxError: Identifier 'foo' has already been declared (2:4)" + ], + "program": { + "type": "Program", + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":12}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "id": { + "type": "Identifier", + "start":6,"end":9,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":9},"identifierName":"foo"}, + "name": "foo" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":10,"end":12,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":12}}, + "body": [] + } + }, + { + "type": "EmptyStatement", + "start":12,"end":13,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":13}} + }, + { + "type": "VariableDeclaration", + "start":14,"end":26,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":12}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":18,"end":25,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":11}}, + "id": { + "type": "Identifier", + "start":18,"end":21,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":7},"identifierName":"foo"}, + "name": "foo" + }, + "init": { + "type": "NumericLiteral", + "start":24,"end":25,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":11}}, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + ], + "kind": "let" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-class-var/options.json b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-class-var/options.json deleted file mode 100644 index bf89e4692c99..000000000000 --- a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-class-var/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'foo' has already been declared (2:4)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-class-var/output.json b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-class-var/output.json new file mode 100644 index 000000000000..7e9448c87dd3 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-class-var/output.json @@ -0,0 +1,52 @@ +{ + "type": "File", + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":8}}, + "errors": [ + "SyntaxError: Identifier 'foo' has already been declared (2:4)" + ], + "program": { + "type": "Program", + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":8}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "id": { + "type": "Identifier", + "start":6,"end":9,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":9},"identifierName":"foo"}, + "name": "foo" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":10,"end":12,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":12}}, + "body": [] + } + }, + { + "type": "EmptyStatement", + "start":12,"end":13,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":13}} + }, + { + "type": "VariableDeclaration", + "start":14,"end":22,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":8}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":18,"end":21,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":7}}, + "id": { + "type": "Identifier", + "start":18,"end":21,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":7},"identifierName":"foo"}, + "name": "foo" + }, + "init": null + } + ], + "kind": "var" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-const-const/options.json b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-const-const/options.json deleted file mode 100644 index d62aabfd1b07..000000000000 --- a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-const-const/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'foo' has already been declared (1:13)" -} diff --git a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-const-const/output.json b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-const-const/output.json new file mode 100644 index 000000000000..c35c68c75903 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-const-const/output.json @@ -0,0 +1,59 @@ +{ + "type": "File", + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, + "errors": [ + "SyntaxError: Identifier 'foo' has already been declared (1:13)" + ], + "program": { + "type": "Program", + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":6,"end":11,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":11}}, + "id": { + "type": "Identifier", + "start":6,"end":9,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":9},"identifierName":"foo"}, + "name": "foo" + }, + "init": { + "type": "NumericLiteral", + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11}}, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + }, + { + "type": "VariableDeclarator", + "start":13,"end":18,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":18}}, + "id": { + "type": "Identifier", + "start":13,"end":16,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":16},"identifierName":"foo"}, + "name": "foo" + }, + "init": { + "type": "NumericLiteral", + "start":17,"end":18,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":18}}, + "extra": { + "rawValue": 2, + "raw": "2" + }, + "value": 2 + } + } + ], + "kind": "const" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-func-gen/options.json b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-func-gen/options.json deleted file mode 100644 index c083e3d4c063..000000000000 --- a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-func-gen/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'f' has already been declared (1:28)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-func-gen/output.json b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-func-gen/output.json new file mode 100644 index 000000000000..ae3ed9341b75 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-func-gen/output.json @@ -0,0 +1,59 @@ +{ + "type": "File", + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, + "errors": [ + "SyntaxError: Identifier 'f' has already been declared (1:28)" + ], + "program": { + "type": "Program", + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "BlockStatement", + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, + "body": [ + { + "type": "FunctionDeclaration", + "start":2,"end":17,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":17}}, + "id": { + "type": "Identifier", + "start":11,"end":12,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":12},"identifierName":"f"}, + "name": "f" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":15,"end":17,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":17}}, + "body": [], + "directives": [] + } + }, + { + "type": "FunctionDeclaration", + "start":18,"end":34,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":34}}, + "id": { + "type": "Identifier", + "start":28,"end":29,"loc":{"start":{"line":1,"column":28},"end":{"line":1,"column":29},"identifierName":"f"}, + "name": "f" + }, + "generator": true, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":32,"end":34,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":34}}, + "body": [], + "directives": [] + } + } + ], + "directives": [] + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-func-module-sloppy/options.json b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-func-module-sloppy/options.json index 3f4250fbe917..2104ca43283f 100644 --- a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-func-module-sloppy/options.json +++ b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-func-module-sloppy/options.json @@ -1,4 +1,3 @@ { - "sourceType": "module", - "throws": "Identifier 'foo' has already been declared (1:29)" + "sourceType": "module" } diff --git a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-func-module-sloppy/output.json b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-func-module-sloppy/output.json new file mode 100644 index 000000000000..71081aa3160a --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-func-module-sloppy/output.json @@ -0,0 +1,59 @@ +{ + "type": "File", + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":39}}, + "errors": [ + "SyntaxError: Identifier 'foo' has already been declared (1:29)" + ], + "program": { + "type": "Program", + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":39}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "BlockStatement", + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":39}}, + "body": [ + { + "type": "FunctionDeclaration", + "start":2,"end":19,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":19}}, + "id": { + "type": "Identifier", + "start":11,"end":14,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":14},"identifierName":"foo"}, + "name": "foo" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":17,"end":19,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":19}}, + "body": [], + "directives": [] + } + }, + { + "type": "FunctionDeclaration", + "start":20,"end":37,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":37}}, + "id": { + "type": "Identifier", + "start":29,"end":32,"loc":{"start":{"line":1,"column":29},"end":{"line":1,"column":32},"identifierName":"foo"}, + "name": "foo" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":35,"end":37,"loc":{"start":{"line":1,"column":35},"end":{"line":1,"column":37}}, + "body": [], + "directives": [] + } + } + ], + "directives": [] + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-func-module/options.json b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-func-module/options.json index 23553cce3705..2104ca43283f 100644 --- a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-func-module/options.json +++ b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-func-module/options.json @@ -1,4 +1,3 @@ { - "sourceType": "module", - "throws":"Identifier 'foo' has already been declared (2:9)" + "sourceType": "module" } diff --git a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-func-module/output.json b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-func-module/output.json new file mode 100644 index 000000000000..f4d8dbbf8917 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-func-module/output.json @@ -0,0 +1,52 @@ +{ + "type": "File", + "start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":17}}, + "errors": [ + "SyntaxError: Identifier 'foo' has already been declared (2:9)" + ], + "program": { + "type": "Program", + "start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":17}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, + "id": { + "type": "Identifier", + "start":9,"end":12,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":12},"identifierName":"foo"}, + "name": "foo" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":15,"end":17,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":17}}, + "body": [], + "directives": [] + } + }, + { + "type": "FunctionDeclaration", + "start":18,"end":35,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":17}}, + "id": { + "type": "Identifier", + "start":27,"end":30,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":12},"identifierName":"foo"}, + "name": "foo" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":33,"end":35,"loc":{"start":{"line":2,"column":15},"end":{"line":2,"column":17}}, + "body": [], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-func-script-sloppy/output.json b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-func-script-sloppy/output.json index 94ae24d249a9..1da2a0b7558a 100644 --- a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-func-script-sloppy/output.json +++ b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-func-script-sloppy/output.json @@ -1,78 +1,22 @@ { "type": "File", - "start": 0, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 39 - } - }, + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":39}}, "program": { "type": "Program", - "start": 0, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 39 - } - }, + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":39}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "BlockStatement", - "start": 0, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 39 - } - }, + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":39}}, "body": [ { "type": "FunctionDeclaration", - "start": 2, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":2,"end":19,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":19}}, "id": { "type": "Identifier", - "start": 11, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 14 - }, - "identifierName": "foo" - }, + "start":11,"end":14,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":14},"identifierName":"foo"}, "name": "foo" }, "generator": false, @@ -80,51 +24,17 @@ "params": [], "body": { "type": "BlockStatement", - "start": 17, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":17,"end":19,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":19}}, "body": [], "directives": [] } }, { "type": "FunctionDeclaration", - "start": 20, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 37 - } - }, + "start":20,"end":37,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":37}}, "id": { "type": "Identifier", - "start": 29, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 1, - "column": 32 - }, - "identifierName": "foo" - }, + "start":29,"end":32,"loc":{"start":{"line":1,"column":29},"end":{"line":1,"column":32},"identifierName":"foo"}, "name": "foo" }, "generator": false, @@ -132,18 +42,7 @@ "params": [], "body": { "type": "BlockStatement", - "start": 35, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 35 - }, - "end": { - "line": 1, - "column": 37 - } - }, + "start":35,"end":37,"loc":{"start":{"line":1,"column":35},"end":{"line":1,"column":37}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-func-script/output.json b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-func-script/output.json index af377ce80461..b5bdce171b81 100644 --- a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-func-script/output.json +++ b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-func-script/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 17 - } - }, + "start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":17}}, "program": { "type": "Program", - "start": 0, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 17 - } - }, + "start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":17}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "id": { "type": "Identifier", - "start": 9, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "foo" - }, + "start":9,"end":12,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":12},"identifierName":"foo"}, "name": "foo" }, "generator": false, @@ -65,51 +20,17 @@ "params": [], "body": { "type": "BlockStatement", - "start": 15, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":15,"end":17,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":17}}, "body": [], "directives": [] } }, { "type": "FunctionDeclaration", - "start": 18, - "end": 35, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 17 - } - }, + "start":18,"end":35,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":17}}, "id": { "type": "Identifier", - "start": 27, - "end": 30, - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 12 - }, - "identifierName": "foo" - }, + "start":27,"end":30,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":12},"identifierName":"foo"}, "name": "foo" }, "generator": false, @@ -117,18 +38,7 @@ "params": [], "body": { "type": "BlockStatement", - "start": 33, - "end": 35, - "loc": { - "start": { - "line": 2, - "column": 15 - }, - "end": { - "line": 2, - "column": 17 - } - }, + "start":33,"end":35,"loc":{"start":{"line":2,"column":15},"end":{"line":2,"column":17}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-func-var-sloppy/options.json b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-func-var-sloppy/options.json deleted file mode 100644 index ff69adb0860a..000000000000 --- a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-func-var-sloppy/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'foo' has already been declared (3:6)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-func-var-sloppy/output.json b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-func-var-sloppy/output.json new file mode 100644 index 000000000000..7840aedc9085 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-func-var-sloppy/output.json @@ -0,0 +1,66 @@ +{ + "type": "File", + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "errors": [ + "SyntaxError: Identifier 'foo' has already been declared (3:6)" + ], + "program": { + "type": "Program", + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "BlockStatement", + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "body": [ + { + "type": "FunctionDeclaration", + "start":4,"end":21,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":19}}, + "id": { + "type": "Identifier", + "start":13,"end":16,"loc":{"start":{"line":2,"column":11},"end":{"line":2,"column":14},"identifierName":"foo"}, + "name": "foo" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":19,"end":21,"loc":{"start":{"line":2,"column":17},"end":{"line":2,"column":19}}, + "body": [], + "directives": [] + } + }, + { + "type": "VariableDeclaration", + "start":24,"end":36,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":14}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":28,"end":35,"loc":{"start":{"line":3,"column":6},"end":{"line":3,"column":13}}, + "id": { + "type": "Identifier", + "start":28,"end":31,"loc":{"start":{"line":3,"column":6},"end":{"line":3,"column":9},"identifierName":"foo"}, + "name": "foo" + }, + "init": { + "type": "NumericLiteral", + "start":34,"end":35,"loc":{"start":{"line":3,"column":12},"end":{"line":3,"column":13}}, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + ], + "kind": "var" + } + ], + "directives": [] + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-func-var/output.json b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-func-var/output.json index d2a2c6f9982d..81976e9bfc97 100644 --- a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-func-var/output.json +++ b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-func-var/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 12 - } - }, + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":12}}, "program": { "type": "Program", - "start": 0, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 12 - } - }, + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":12}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "id": { "type": "Identifier", - "start": 9, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "foo" - }, + "start":9,"end":12,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":12},"identifierName":"foo"}, "name": "foo" }, "generator": false, @@ -65,82 +20,26 @@ "params": [], "body": { "type": "BlockStatement", - "start": 15, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":15,"end":17,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":17}}, "body": [], "directives": [] } }, { "type": "VariableDeclaration", - "start": 18, - "end": 30, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 12 - } - }, + "start":18,"end":30,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":12}}, "declarations": [ { "type": "VariableDeclarator", - "start": 22, - "end": 29, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 11 - } - }, + "start":22,"end":29,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":11}}, "id": { "type": "Identifier", - "start": 22, - "end": 25, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 7 - }, - "identifierName": "foo" - }, + "start":22,"end":25,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":7},"identifierName":"foo"}, "name": "foo" }, "init": { "type": "NumericLiteral", - "start": 28, - "end": 29, - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 11 - } - }, + "start":28,"end":29,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":11}}, "extra": { "rawValue": 1, "raw": "1" diff --git a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-gen-func/options.json b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-gen-func/options.json deleted file mode 100644 index c083e3d4c063..000000000000 --- a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-gen-func/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'f' has already been declared (1:28)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-gen-func/output.json b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-gen-func/output.json new file mode 100644 index 000000000000..209a1e02c0b6 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-gen-func/output.json @@ -0,0 +1,59 @@ +{ + "type": "File", + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, + "errors": [ + "SyntaxError: Identifier 'f' has already been declared (1:28)" + ], + "program": { + "type": "Program", + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "BlockStatement", + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, + "body": [ + { + "type": "FunctionDeclaration", + "start":2,"end":18,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":18}}, + "id": { + "type": "Identifier", + "start":12,"end":13,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":13},"identifierName":"f"}, + "name": "f" + }, + "generator": true, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":16,"end":18,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":18}}, + "body": [], + "directives": [] + } + }, + { + "type": "FunctionDeclaration", + "start":19,"end":34,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":34}}, + "id": { + "type": "Identifier", + "start":28,"end":29,"loc":{"start":{"line":1,"column":28},"end":{"line":1,"column":29},"identifierName":"f"}, + "name": "f" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":32,"end":34,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":34}}, + "body": [], + "directives": [] + } + } + ], + "directives": [] + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-gen-gen-script/output.json b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-gen-gen-script/output.json index e5bce9fb21da..5b9ae21d2be2 100644 --- a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-gen-gen-script/output.json +++ b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-gen-gen-script/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 19 - } - }, + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":19}}, "program": { "type": "Program", - "start": 0, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 19 - } - }, + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":19}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, "id": { "type": "Identifier", - "start": 10, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 13 - }, - "identifierName": "foo" - }, + "start":10,"end":13,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":13},"identifierName":"foo"}, "name": "foo" }, "generator": true, @@ -65,66 +20,21 @@ "params": [], "body": { "type": "BlockStatement", - "start": 16, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":16,"end":18,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":18}}, "body": [], "directives": [] } }, { "type": "EmptyStatement", - "start": 18, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - } - } + "start":18,"end":19,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":19}} }, { "type": "FunctionDeclaration", - "start": 20, - "end": 38, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 18 - } - }, + "start":20,"end":38,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":18}}, "id": { "type": "Identifier", - "start": 30, - "end": 33, - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 13 - }, - "identifierName": "foo" - }, + "start":30,"end":33,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":13},"identifierName":"foo"}, "name": "foo" }, "generator": true, @@ -132,36 +42,14 @@ "params": [], "body": { "type": "BlockStatement", - "start": 36, - "end": 38, - "loc": { - "start": { - "line": 2, - "column": 16 - }, - "end": { - "line": 2, - "column": 18 - } - }, + "start":36,"end":38,"loc":{"start":{"line":2,"column":16},"end":{"line":2,"column":18}}, "body": [], "directives": [] } }, { "type": "EmptyStatement", - "start": 38, - "end": 39, - "loc": { - "start": { - "line": 2, - "column": 18 - }, - "end": { - "line": 2, - "column": 19 - } - } + "start":38,"end":39,"loc":{"start":{"line":2,"column":18},"end":{"line":2,"column":19}} } ], "directives": [] diff --git a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-let-let/options.json b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-let-let/options.json deleted file mode 100644 index 714354e14501..000000000000 --- a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-let-let/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'foo' has already been declared (1:9)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-let-let/output.json b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-let-let/output.json new file mode 100644 index 000000000000..942dccb6e671 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-let-let/output.json @@ -0,0 +1,43 @@ +{ + "type": "File", + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "errors": [ + "SyntaxError: Identifier 'foo' has already been declared (1:9)" + ], + "program": { + "type": "Program", + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":4,"end":7,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":7}}, + "id": { + "type": "Identifier", + "start":4,"end":7,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":7},"identifierName":"foo"}, + "name": "foo" + }, + "init": null + }, + { + "type": "VariableDeclarator", + "start":9,"end":12,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":12}}, + "id": { + "type": "Identifier", + "start":9,"end":12,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":12},"identifierName":"foo"}, + "name": "foo" + }, + "init": null + } + ], + "kind": "let" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-nested-let-var/options.json b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-nested-let-var/options.json deleted file mode 100644 index a0925d495610..000000000000 --- a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-nested-let-var/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'a' has already been declared (3:8)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-nested-let-var/output.json b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-nested-let-var/output.json new file mode 100644 index 000000000000..047bfbf77f03 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-nested-let-var/output.json @@ -0,0 +1,64 @@ +{ + "type": "File", + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "errors": [ + "SyntaxError: Identifier 'a' has already been declared (3:8)" + ], + "program": { + "type": "Program", + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "BlockStatement", + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "body": [ + { + "type": "VariableDeclaration", + "start":4,"end":10,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":8}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":8,"end":9,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":7}}, + "id": { + "type": "Identifier", + "start":8,"end":9,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":7},"identifierName":"a"}, + "name": "a" + }, + "init": null + } + ], + "kind": "let" + }, + { + "type": "BlockStatement", + "start":13,"end":23,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":12}}, + "body": [ + { + "type": "VariableDeclaration", + "start":15,"end":21,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":10}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":19,"end":20,"loc":{"start":{"line":3,"column":8},"end":{"line":3,"column":9}}, + "id": { + "type": "Identifier", + "start":19,"end":20,"loc":{"start":{"line":3,"column":8},"end":{"line":3,"column":9},"identifierName":"a"}, + "name": "a" + }, + "init": null + } + ], + "kind": "var" + } + ], + "directives": [] + } + ], + "directives": [] + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-nested-var-let/output.json b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-nested-var-let/output.json index 239db26973c2..07b40a61bf02 100644 --- a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-nested-var-let/output.json +++ b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-nested-var-let/output.json @@ -1,93 +1,26 @@ { "type": "File", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "BlockStatement", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, "body": [ { "type": "VariableDeclaration", - "start": 4, - "end": 10, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 8 - } - }, + "start":4,"end":10,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":8}}, "declarations": [ { "type": "VariableDeclarator", - "start": 8, - "end": 9, - "loc": { - "start": { - "line": 2, - "column": 6 - }, - "end": { - "line": 2, - "column": 7 - } - }, + "start":8,"end":9,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":7}}, "id": { "type": "Identifier", - "start": 8, - "end": 9, - "loc": { - "start": { - "line": 2, - "column": 6 - }, - "end": { - "line": 2, - "column": 7 - }, - "identifierName": "a" - }, + "start":8,"end":9,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":7},"identifierName":"a"}, "name": "a" }, "init": null @@ -97,63 +30,18 @@ }, { "type": "BlockStatement", - "start": 13, - "end": 23, - "loc": { - "start": { - "line": 3, - "column": 2 - }, - "end": { - "line": 3, - "column": 12 - } - }, + "start":13,"end":23,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":12}}, "body": [ { "type": "VariableDeclaration", - "start": 15, - "end": 21, - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 10 - } - }, + "start":15,"end":21,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":10}}, "declarations": [ { "type": "VariableDeclarator", - "start": 19, - "end": 20, - "loc": { - "start": { - "line": 3, - "column": 8 - }, - "end": { - "line": 3, - "column": 9 - } - }, + "start":19,"end":20,"loc":{"start":{"line":3,"column":8},"end":{"line":3,"column":9}}, "id": { "type": "Identifier", - "start": 19, - "end": 20, - "loc": { - "start": { - "line": 3, - "column": 8 - }, - "end": { - "line": 3, - "column": 9 - }, - "identifierName": "a" - }, + "start":19,"end":20,"loc":{"start":{"line":3,"column":8},"end":{"line":3,"column":9},"identifierName":"a"}, "name": "a" }, "init": null diff --git a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-var-var/output.json b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-var-var/output.json index 0be8a0eea29f..3a0cc9ec482f 100644 --- a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-var-var/output.json +++ b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-var-var/output.json @@ -1,111 +1,32 @@ { "type": "File", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "program": { "type": "Program", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":4,"end":7,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":7}}, "id": { "type": "Identifier", - "start": 4, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "foo" - }, + "start":4,"end":7,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":7},"identifierName":"foo"}, "name": "foo" }, "init": null }, { "type": "VariableDeclarator", - "start": 9, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":9,"end":12,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":12}}, "id": { "type": "Identifier", - "start": 9, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "foo" - }, + "start":9,"end":12,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":12},"identifierName":"foo"}, "name": "foo" }, "init": null diff --git a/packages/babel-parser/test/fixtures/core/scope/for-let/output.json b/packages/babel-parser/test/fixtures/core/scope/for-let/output.json index 8af98b16aa63..152ece9b2f9a 100644 --- a/packages/babel-parser/test/fixtures/core/scope/for-let/output.json +++ b/packages/babel-parser/test/fixtures/core/scope/for-let/output.json @@ -1,108 +1,30 @@ { "type": "File", - "start": 0, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ForStatement", - "start": 0, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "init": { "type": "VariableDeclaration", - "start": 5, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":5,"end":14,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":14}}, "declarations": [ { "type": "VariableDeclarator", - "start": 9, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":9,"end":14,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":14}}, "id": { "type": "Identifier", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - }, - "identifierName": "i" - }, + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"i"}, "name": "i" }, "init": { "type": "NumericLiteral", - "start": 13, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":13,"end":14,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":14}}, "extra": { "rawValue": 0, "raw": "0" @@ -117,63 +39,18 @@ "update": null, "body": { "type": "BlockStatement", - "start": 18, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":18,"end":32,"loc":{"start":{"line":1,"column":18},"end":{"line":3,"column":1}}, "body": [ { "type": "VariableDeclaration", - "start": 24, - "end": 30, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 10 - } - }, + "start":24,"end":30,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":10}}, "declarations": [ { "type": "VariableDeclarator", - "start": 28, - "end": 29, - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 9 - } - }, + "start":28,"end":29,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":9}}, "id": { "type": "Identifier", - "start": 28, - "end": 29, - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 9 - }, - "identifierName": "i" - }, + "start":28,"end":29,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":9},"identifierName":"i"}, "name": "i" }, "init": null diff --git a/packages/babel-parser/test/fixtures/core/scope/for-var/options.json b/packages/babel-parser/test/fixtures/core/scope/for-var/options.json deleted file mode 100644 index 10e45adf4560..000000000000 --- a/packages/babel-parser/test/fixtures/core/scope/for-var/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'i' has already been declared (2:8)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/scope/for-var/output.json b/packages/babel-parser/test/fixtures/core/scope/for-var/output.json new file mode 100644 index 000000000000..eb373fff2969 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/scope/for-var/output.json @@ -0,0 +1,71 @@ +{ + "type": "File", + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "errors": [ + "SyntaxError: Identifier 'i' has already been declared (2:8)" + ], + "program": { + "type": "Program", + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ForStatement", + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "init": { + "type": "VariableDeclaration", + "start":5,"end":14,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":14}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":9,"end":14,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":14}}, + "id": { + "type": "Identifier", + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"i"}, + "name": "i" + }, + "init": { + "type": "NumericLiteral", + "start":13,"end":14,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":14}}, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + } + ], + "kind": "let" + }, + "test": null, + "update": null, + "body": { + "type": "BlockStatement", + "start":18,"end":32,"loc":{"start":{"line":1,"column":18},"end":{"line":3,"column":1}}, + "body": [ + { + "type": "VariableDeclaration", + "start":24,"end":30,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":10}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":28,"end":29,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":9}}, + "id": { + "type": "Identifier", + "start":28,"end":29,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":9},"identifierName":"i"}, + "name": "i" + }, + "init": null + } + ], + "kind": "var" + } + ], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/scope/let-assign/output.json b/packages/babel-parser/test/fixtures/core/scope/let-assign/output.json index 508af9fc85d2..dfec1320529b 100644 --- a/packages/babel-parser/test/fixtures/core/scope/let-assign/output.json +++ b/packages/babel-parser/test/fixtures/core/scope/let-assign/output.json @@ -1,94 +1,27 @@ { "type": "File", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "program": { "type": "Program", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":4,"end":9,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":9}}, "id": { "type": "Identifier", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "x" - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"x"}, "name": "x" }, "init": { "type": "NumericLiteral", - "start": 8, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":8,"end":9,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":9}}, "extra": { "rawValue": 1, "raw": "1" @@ -101,64 +34,19 @@ }, { "type": "ExpressionStatement", - "start": 11, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":11,"end":17,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":17}}, "expression": { "type": "AssignmentExpression", - "start": 11, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":11,"end":16,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":16}}, "operator": "=", "left": { "type": "Identifier", - "start": 11, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "x" - }, + "start":11,"end":12,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":12},"identifierName":"x"}, "name": "x" }, "right": { "type": "NumericLiteral", - "start": 15, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":15,"end":16,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":16}}, "extra": { "rawValue": 2, "raw": "2" diff --git a/packages/babel-parser/test/fixtures/core/scope/undecl-export-as-default/options.json b/packages/babel-parser/test/fixtures/core/scope/undecl-export-as-default/options.json index 8448889cf253..2104ca43283f 100644 --- a/packages/babel-parser/test/fixtures/core/scope/undecl-export-as-default/options.json +++ b/packages/babel-parser/test/fixtures/core/scope/undecl-export-as-default/options.json @@ -1,4 +1,3 @@ { - "sourceType": "module", - "throws": "Export 'encrypt' is not defined (1:9)" + "sourceType": "module" } diff --git a/packages/babel-parser/test/fixtures/core/scope/undecl-export-as-default/output.json b/packages/babel-parser/test/fixtures/core/scope/undecl-export-as-default/output.json new file mode 100644 index 000000000000..40f3335e7eb5 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/scope/undecl-export-as-default/output.json @@ -0,0 +1,38 @@ +{ + "type": "File", + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, + "errors": [ + "SyntaxError: Export 'encrypt' is not defined (1:9)" + ], + "program": { + "type": "Program", + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExportNamedDeclaration", + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, + "specifiers": [ + { + "type": "ExportSpecifier", + "start":9,"end":27,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":27}}, + "local": { + "type": "Identifier", + "start":9,"end":16,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":16},"identifierName":"encrypt"}, + "name": "encrypt" + }, + "exported": { + "type": "Identifier", + "start":20,"end":27,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":27},"identifierName":"default"}, + "name": "default" + } + } + ], + "source": null, + "declaration": null + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/scope/undecl-export-as/options.json b/packages/babel-parser/test/fixtures/core/scope/undecl-export-as/options.json index 8448889cf253..2104ca43283f 100644 --- a/packages/babel-parser/test/fixtures/core/scope/undecl-export-as/options.json +++ b/packages/babel-parser/test/fixtures/core/scope/undecl-export-as/options.json @@ -1,4 +1,3 @@ { - "sourceType": "module", - "throws": "Export 'encrypt' is not defined (1:9)" + "sourceType": "module" } diff --git a/packages/babel-parser/test/fixtures/core/scope/undecl-export-as/output.json b/packages/babel-parser/test/fixtures/core/scope/undecl-export-as/output.json new file mode 100644 index 000000000000..120ad6bc705e --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/scope/undecl-export-as/output.json @@ -0,0 +1,56 @@ +{ + "type": "File", + "start":0,"end":52,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":21}}, + "errors": [ + "SyntaxError: Export 'encrypt' is not defined (1:9)" + ], + "program": { + "type": "Program", + "start":0,"end":52,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":21}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExportNamedDeclaration", + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, + "specifiers": [ + { + "type": "ExportSpecifier", + "start":9,"end":27,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":27}}, + "local": { + "type": "Identifier", + "start":9,"end":16,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":16},"identifierName":"encrypt"}, + "name": "encrypt" + }, + "exported": { + "type": "Identifier", + "start":20,"end":27,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":27},"identifierName":"decrypt"}, + "name": "decrypt" + } + } + ], + "source": null, + "declaration": null + }, + { + "type": "FunctionDeclaration", + "start":31,"end":52,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":21}}, + "id": { + "type": "Identifier", + "start":40,"end":47,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":16},"identifierName":"decrypt"}, + "name": "decrypt" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":50,"end":52,"loc":{"start":{"line":2,"column":19},"end":{"line":2,"column":21}}, + "body": [], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/scope/undecl-export-block/options.json b/packages/babel-parser/test/fixtures/core/scope/undecl-export-block/options.json index 0844d3e80e68..2104ca43283f 100644 --- a/packages/babel-parser/test/fixtures/core/scope/undecl-export-block/options.json +++ b/packages/babel-parser/test/fixtures/core/scope/undecl-export-block/options.json @@ -1,4 +1,3 @@ { - "sourceType": "module", - "throws": "Export 'encrypt' is not defined (4:9)" + "sourceType": "module" } diff --git a/packages/babel-parser/test/fixtures/core/scope/undecl-export-block/output.json b/packages/babel-parser/test/fixtures/core/scope/undecl-export-block/output.json new file mode 100644 index 000000000000..cedcbba92a8b --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/scope/undecl-export-block/output.json @@ -0,0 +1,63 @@ +{ + "type": "File", + "start":0,"end":46,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":18}}, + "errors": [ + "SyntaxError: Export 'encrypt' is not defined (4:9)" + ], + "program": { + "type": "Program", + "start":0,"end":46,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":18}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "BlockStatement", + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "body": [ + { + "type": "FunctionDeclaration", + "start":4,"end":25,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":23}}, + "id": { + "type": "Identifier", + "start":13,"end":20,"loc":{"start":{"line":2,"column":11},"end":{"line":2,"column":18},"identifierName":"encrypt"}, + "name": "encrypt" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":23,"end":25,"loc":{"start":{"line":2,"column":21},"end":{"line":2,"column":23}}, + "body": [], + "directives": [] + } + } + ], + "directives": [] + }, + { + "type": "ExportNamedDeclaration", + "start":28,"end":46,"loc":{"start":{"line":4,"column":0},"end":{"line":4,"column":18}}, + "specifiers": [ + { + "type": "ExportSpecifier", + "start":37,"end":44,"loc":{"start":{"line":4,"column":9},"end":{"line":4,"column":16}}, + "local": { + "type": "Identifier", + "start":37,"end":44,"loc":{"start":{"line":4,"column":9},"end":{"line":4,"column":16},"identifierName":"encrypt"}, + "name": "encrypt" + }, + "exported": { + "type": "Identifier", + "start":37,"end":44,"loc":{"start":{"line":4,"column":9},"end":{"line":4,"column":16},"identifierName":"encrypt"}, + "name": "encrypt" + } + } + ], + "source": null, + "declaration": null + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/scope/undecl-export-builtin-as/options.json b/packages/babel-parser/test/fixtures/core/scope/undecl-export-builtin-as/options.json index cbab70613300..2104ca43283f 100644 --- a/packages/babel-parser/test/fixtures/core/scope/undecl-export-builtin-as/options.json +++ b/packages/babel-parser/test/fixtures/core/scope/undecl-export-builtin-as/options.json @@ -1,4 +1,3 @@ { - "sourceType": "module", - "throws": "Export 'Object' is not defined (1:9)" + "sourceType": "module" } diff --git a/packages/babel-parser/test/fixtures/core/scope/undecl-export-builtin-as/output.json b/packages/babel-parser/test/fixtures/core/scope/undecl-export-builtin-as/output.json new file mode 100644 index 000000000000..a40f509053a3 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/scope/undecl-export-builtin-as/output.json @@ -0,0 +1,38 @@ +{ + "type": "File", + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, + "errors": [ + "SyntaxError: Export 'Object' is not defined (1:9)" + ], + "program": { + "type": "Program", + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExportNamedDeclaration", + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, + "specifiers": [ + { + "type": "ExportSpecifier", + "start":9,"end":22,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":22}}, + "local": { + "type": "Identifier", + "start":9,"end":15,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":15},"identifierName":"Object"}, + "name": "Object" + }, + "exported": { + "type": "Identifier", + "start":19,"end":22,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":22},"identifierName":"Obj"}, + "name": "Obj" + } + } + ], + "source": null, + "declaration": null + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/scope/undecl-export-builtin/options.json b/packages/babel-parser/test/fixtures/core/scope/undecl-export-builtin/options.json index cbab70613300..2104ca43283f 100644 --- a/packages/babel-parser/test/fixtures/core/scope/undecl-export-builtin/options.json +++ b/packages/babel-parser/test/fixtures/core/scope/undecl-export-builtin/options.json @@ -1,4 +1,3 @@ { - "sourceType": "module", - "throws": "Export 'Object' is not defined (1:9)" + "sourceType": "module" } diff --git a/packages/babel-parser/test/fixtures/core/scope/undecl-export-builtin/output.json b/packages/babel-parser/test/fixtures/core/scope/undecl-export-builtin/output.json new file mode 100644 index 000000000000..faad719a5d09 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/scope/undecl-export-builtin/output.json @@ -0,0 +1,38 @@ +{ + "type": "File", + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, + "errors": [ + "SyntaxError: Export 'Object' is not defined (1:9)" + ], + "program": { + "type": "Program", + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExportNamedDeclaration", + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, + "specifiers": [ + { + "type": "ExportSpecifier", + "start":9,"end":15,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":15}}, + "local": { + "type": "Identifier", + "start":9,"end":15,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":15},"identifierName":"Object"}, + "name": "Object" + }, + "exported": { + "type": "Identifier", + "start":9,"end":15,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":15},"identifierName":"Object"}, + "name": "Object" + } + } + ], + "source": null, + "declaration": null + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/scope/undecl-export-function-loose-mode-1/output.json b/packages/babel-parser/test/fixtures/core/scope/undecl-export-function-loose-mode-1/output.json index e59b53b2e0ed..f4e80f2ef2db 100644 --- a/packages/babel-parser/test/fixtures/core/scope/undecl-export-function-loose-mode-1/output.json +++ b/packages/babel-parser/test/fixtures/core/scope/undecl-export-function-loose-mode-1/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 13 - } - }, + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":13}}, "program": { "type": "Program", - "start": 0, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 13 - } - }, + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":13}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "id": { "type": "Identifier", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - }, - "identifierName": "a" - }, + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"a"}, "name": "a" }, "generator": false, @@ -65,83 +20,26 @@ "params": [], "body": { "type": "BlockStatement", - "start": 13, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":13,"end":15,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":15}}, "body": [], "directives": [] } }, { "type": "ExportNamedDeclaration", - "start": 17, - "end": 30, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 13 - } - }, + "start":17,"end":30,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":13}}, "specifiers": [ { "type": "ExportSpecifier", - "start": 26, - "end": 27, - "loc": { - "start": { - "line": 3, - "column": 9 - }, - "end": { - "line": 3, - "column": 10 - } - }, + "start":26,"end":27,"loc":{"start":{"line":3,"column":9},"end":{"line":3,"column":10}}, "local": { "type": "Identifier", - "start": 26, - "end": 27, - "loc": { - "start": { - "line": 3, - "column": 9 - }, - "end": { - "line": 3, - "column": 10 - }, - "identifierName": "a" - }, + "start":26,"end":27,"loc":{"start":{"line":3,"column":9},"end":{"line":3,"column":10},"identifierName":"a"}, "name": "a" }, "exported": { "type": "Identifier", - "start": 26, - "end": 27, - "loc": { - "start": { - "line": 3, - "column": 9 - }, - "end": { - "line": 3, - "column": 10 - }, - "identifierName": "a" - }, + "start":26,"end":27,"loc":{"start":{"line":3,"column":9},"end":{"line":3,"column":10},"identifierName":"a"}, "name": "a" } } diff --git a/packages/babel-parser/test/fixtures/core/scope/undecl-export-function-loose-mode-2/output.json b/packages/babel-parser/test/fixtures/core/scope/undecl-export-function-loose-mode-2/output.json index 16b50c7b3875..bd90c16b5dc1 100644 --- a/packages/babel-parser/test/fixtures/core/scope/undecl-export-function-loose-mode-2/output.json +++ b/packages/babel-parser/test/fixtures/core/scope/undecl-export-function-loose-mode-2/output.json @@ -1,95 +1,27 @@ { "type": "File", - "start": 0, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 15 - } - }, + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":15}}, "program": { "type": "Program", - "start": 0, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 15 - } - }, + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":15}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExportNamedDeclaration", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "specifiers": [ { "type": "ExportSpecifier", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10}}, "local": { "type": "Identifier", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - }, - "identifierName": "a" - }, + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"a"}, "name": "a" }, "exported": { "type": "Identifier", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - }, - "identifierName": "a" - }, + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"a"}, "name": "a" } } @@ -99,33 +31,10 @@ }, { "type": "FunctionDeclaration", - "start": 14, - "end": 29, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 15 - } - }, + "start":14,"end":29,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":15}}, "id": { "type": "Identifier", - "start": 23, - "end": 24, - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 10 - }, - "identifierName": "a" - }, + "start":23,"end":24,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":10},"identifierName":"a"}, "name": "a" }, "generator": false, @@ -133,18 +42,7 @@ "params": [], "body": { "type": "BlockStatement", - "start": 27, - "end": 29, - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 15 - } - }, + "start":27,"end":29,"loc":{"start":{"line":2,"column":13},"end":{"line":2,"column":15}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/core/scope/undecl-export-if/options.json b/packages/babel-parser/test/fixtures/core/scope/undecl-export-if/options.json index 2c97b3ce5a78..2104ca43283f 100644 --- a/packages/babel-parser/test/fixtures/core/scope/undecl-export-if/options.json +++ b/packages/babel-parser/test/fixtures/core/scope/undecl-export-if/options.json @@ -1,4 +1,3 @@ { - "sourceType": "module", - "throws": "In strict mode code, functions can only be declared at top level or inside a block (2:10)" + "sourceType": "module" } diff --git a/packages/babel-parser/test/fixtures/core/scope/undecl-export-if/output.json b/packages/babel-parser/test/fixtures/core/scope/undecl-export-if/output.json new file mode 100644 index 000000000000..783a60a237c9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/scope/undecl-export-if/output.json @@ -0,0 +1,67 @@ +{ + "type": "File", + "start":0,"end":51,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":31}}, + "errors": [ + "SyntaxError: In strict mode code, functions can only be declared at top level or inside a block (2:10)", + "SyntaxError: Export 'encrypt' is not defined (1:9)" + ], + "program": { + "type": "Program", + "start":0,"end":51,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":31}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExportNamedDeclaration", + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, + "specifiers": [ + { + "type": "ExportSpecifier", + "start":9,"end":16,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":16}}, + "local": { + "type": "Identifier", + "start":9,"end":16,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":16},"identifierName":"encrypt"}, + "name": "encrypt" + }, + "exported": { + "type": "Identifier", + "start":9,"end":16,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":16},"identifierName":"encrypt"}, + "name": "encrypt" + } + } + ], + "source": null, + "declaration": null + }, + { + "type": "IfStatement", + "start":20,"end":51,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":31}}, + "test": { + "type": "BooleanLiteral", + "start":24,"end":28,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":8}}, + "value": true + }, + "consequent": { + "type": "FunctionDeclaration", + "start":30,"end":51,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":31}}, + "id": { + "type": "Identifier", + "start":39,"end":46,"loc":{"start":{"line":2,"column":19},"end":{"line":2,"column":26},"identifierName":"encrypt"}, + "name": "encrypt" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":49,"end":51,"loc":{"start":{"line":2,"column":29},"end":{"line":2,"column":31}}, + "body": [], + "directives": [] + } + }, + "alternate": null + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/scope/undecl-export-var/output.json b/packages/babel-parser/test/fixtures/core/scope/undecl-export-var/output.json index 91e34252dbc5..95c7c7580f87 100644 --- a/packages/babel-parser/test/fixtures/core/scope/undecl-export-var/output.json +++ b/packages/babel-parser/test/fixtures/core/scope/undecl-export-var/output.json @@ -1,93 +1,26 @@ { "type": "File", - "start": 0, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 18 - } - }, + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":18}}, "program": { "type": "Program", - "start": 0, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 18 - } - }, + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":18}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "BlockStatement", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "body": [ { "type": "VariableDeclaration", - "start": 4, - "end": 15, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 13 - } - }, + "start":4,"end":15,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":13}}, "declarations": [ { "type": "VariableDeclarator", - "start": 8, - "end": 15, - "loc": { - "start": { - "line": 2, - "column": 6 - }, - "end": { - "line": 2, - "column": 13 - } - }, + "start":8,"end":15,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":13}}, "id": { "type": "Identifier", - "start": 8, - "end": 15, - "loc": { - "start": { - "line": 2, - "column": 6 - }, - "end": { - "line": 2, - "column": 13 - }, - "identifierName": "encrypt" - }, + "start":8,"end":15,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":13},"identifierName":"encrypt"}, "name": "encrypt" }, "init": null @@ -100,65 +33,19 @@ }, { "type": "ExportNamedDeclaration", - "start": 18, - "end": 36, - "loc": { - "start": { - "line": 4, - "column": 0 - }, - "end": { - "line": 4, - "column": 18 - } - }, + "start":18,"end":36,"loc":{"start":{"line":4,"column":0},"end":{"line":4,"column":18}}, "specifiers": [ { "type": "ExportSpecifier", - "start": 27, - "end": 34, - "loc": { - "start": { - "line": 4, - "column": 9 - }, - "end": { - "line": 4, - "column": 16 - } - }, + "start":27,"end":34,"loc":{"start":{"line":4,"column":9},"end":{"line":4,"column":16}}, "local": { "type": "Identifier", - "start": 27, - "end": 34, - "loc": { - "start": { - "line": 4, - "column": 9 - }, - "end": { - "line": 4, - "column": 16 - }, - "identifierName": "encrypt" - }, + "start":27,"end":34,"loc":{"start":{"line":4,"column":9},"end":{"line":4,"column":16},"identifierName":"encrypt"}, "name": "encrypt" }, "exported": { "type": "Identifier", - "start": 27, - "end": 34, - "loc": { - "start": { - "line": 4, - "column": 9 - }, - "end": { - "line": 4, - "column": 16 - }, - "identifierName": "encrypt" - }, + "start":27,"end":34,"loc":{"start":{"line":4,"column":9},"end":{"line":4,"column":16},"identifierName":"encrypt"}, "name": "encrypt" } } diff --git a/packages/babel-parser/test/fixtures/core/scope/undecl-export/options.json b/packages/babel-parser/test/fixtures/core/scope/undecl-export/options.json index 8448889cf253..2104ca43283f 100644 --- a/packages/babel-parser/test/fixtures/core/scope/undecl-export/options.json +++ b/packages/babel-parser/test/fixtures/core/scope/undecl-export/options.json @@ -1,4 +1,3 @@ { - "sourceType": "module", - "throws": "Export 'encrypt' is not defined (1:9)" + "sourceType": "module" } diff --git a/packages/babel-parser/test/fixtures/core/scope/undecl-export/output.json b/packages/babel-parser/test/fixtures/core/scope/undecl-export/output.json new file mode 100644 index 000000000000..d83b949cce1f --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/scope/undecl-export/output.json @@ -0,0 +1,38 @@ +{ + "type": "File", + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, + "errors": [ + "SyntaxError: Export 'encrypt' is not defined (1:9)" + ], + "program": { + "type": "Program", + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExportNamedDeclaration", + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, + "specifiers": [ + { + "type": "ExportSpecifier", + "start":9,"end":16,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":16}}, + "local": { + "type": "Identifier", + "start":9,"end":16,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":16},"identifierName":"encrypt"}, + "name": "encrypt" + }, + "exported": { + "type": "Identifier", + "start":9,"end":16,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":16},"identifierName":"encrypt"}, + "name": "encrypt" + } + } + ], + "source": null, + "declaration": null + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/sourcetype-unambiguous/commonjs/output.json b/packages/babel-parser/test/fixtures/core/sourcetype-unambiguous/commonjs/output.json index 1fb0ddca3246..91a67c0b14ce 100644 --- a/packages/babel-parser/test/fixtures/core/sourcetype-unambiguous/commonjs/output.json +++ b/packages/babel-parser/test/fixtures/core/sourcetype-unambiguous/commonjs/output.json @@ -1,126 +1,36 @@ { "type": "File", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, "program": { "type": "Program", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":4,"end":24,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":24}}, "id": { "type": "Identifier", - "start": 4, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "foo" - }, + "start":4,"end":7,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":7},"identifierName":"foo"}, "name": "foo" }, "init": { "type": "CallExpression", - "start": 10, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":10,"end":24,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":24}}, "callee": { "type": "Identifier", - "start": 10, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 17 - }, - "identifierName": "require" - }, + "start":10,"end":17,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":17},"identifierName":"require"}, "name": "require" }, "arguments": [ { "type": "StringLiteral", - "start": 18, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":18,"end":23,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":23}}, "extra": { "rawValue": "foo", "raw": "\"foo\"" diff --git a/packages/babel-parser/test/fixtures/core/sourcetype-unambiguous/flow/output.json b/packages/babel-parser/test/fixtures/core/sourcetype-unambiguous/flow/output.json index 970a82515bc0..69c62635c89e 100644 --- a/packages/babel-parser/test/fixtures/core/sourcetype-unambiguous/flow/output.json +++ b/packages/babel-parser/test/fixtures/core/sourcetype-unambiguous/flow/output.json @@ -1,96 +1,28 @@ { "type": "File", - "start": 0, - "end": 78, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 25 - } - }, + "start":0,"end":78,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":25}}, "program": { "type": "Program", - "start": 0, - "end": 78, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 25 - } - }, + "start":0,"end":78,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":25}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ImportDeclaration", - "start": 0, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, "specifiers": [ { "type": "ImportSpecifier", - "start": 14, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":14,"end":17,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":17}}, "imported": { "type": "Identifier", - "start": 14, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 17 - }, - "identifierName": "Foo" - }, + "start":14,"end":17,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":17},"identifierName":"Foo"}, "name": "Foo" }, "importKind": null, "local": { "type": "Identifier", - "start": 14, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 17 - }, - "identifierName": "Foo" - }, + "start":14,"end":17,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":17},"identifierName":"Foo"}, "name": "Foo" } } @@ -98,18 +30,7 @@ "importKind": "type", "source": { "type": "StringLiteral", - "start": 25, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":25,"end":30,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":30}}, "extra": { "rawValue": "bar", "raw": "\"bar\"" @@ -119,65 +40,19 @@ }, { "type": "ExportNamedDeclaration", - "start": 32, - "end": 52, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 20 - } - }, + "start":32,"end":52,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":20}}, "specifiers": [ { "type": "ExportSpecifier", - "start": 46, - "end": 49, - "loc": { - "start": { - "line": 2, - "column": 14 - }, - "end": { - "line": 2, - "column": 17 - } - }, + "start":46,"end":49,"loc":{"start":{"line":2,"column":14},"end":{"line":2,"column":17}}, "local": { "type": "Identifier", - "start": 46, - "end": 49, - "loc": { - "start": { - "line": 2, - "column": 14 - }, - "end": { - "line": 2, - "column": 17 - }, - "identifierName": "Foo" - }, + "start":46,"end":49,"loc":{"start":{"line":2,"column":14},"end":{"line":2,"column":17},"identifierName":"Foo"}, "name": "Foo" }, "exported": { "type": "Identifier", - "start": 46, - "end": 49, - "loc": { - "start": { - "line": 2, - "column": 14 - }, - "end": { - "line": 2, - "column": 17 - }, - "identifierName": "Foo" - }, + "start":46,"end":49,"loc":{"start":{"line":2,"column":14},"end":{"line":2,"column":17},"identifierName":"Foo"}, "name": "Foo" } } @@ -188,33 +63,11 @@ }, { "type": "ExportAllDeclaration", - "start": 53, - "end": 78, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 25 - } - }, + "start":53,"end":78,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":25}}, "exportKind": "type", "source": { "type": "StringLiteral", - "start": 72, - "end": 77, - "loc": { - "start": { - "line": 3, - "column": 19 - }, - "end": { - "line": 3, - "column": 24 - } - }, + "start":72,"end":77,"loc":{"start":{"line":3,"column":19},"end":{"line":3,"column":24}}, "extra": { "rawValue": "bar", "raw": "\"bar\"" diff --git a/packages/babel-parser/test/fixtures/core/sourcetype-unambiguous/import-meta/output.json b/packages/babel-parser/test/fixtures/core/sourcetype-unambiguous/import-meta/output.json index bec71854b068..6b9a913d2dd1 100644 --- a/packages/babel-parser/test/fixtures/core/sourcetype-unambiguous/import-meta/output.json +++ b/packages/babel-parser/test/fixtures/core/sourcetype-unambiguous/import-meta/output.json @@ -1,108 +1,29 @@ { "type": "File", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, "program": { "type": "Program", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, "expression": { "type": "CallExpression", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "callee": { "type": "MemberExpression", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "object": { "type": "Identifier", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "console" - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7},"identifierName":"console"}, "name": "console" }, "property": { "type": "Identifier", - "start": 8, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "log" - }, + "start":8,"end":11,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":11},"identifierName":"log"}, "name": "log" }, "computed": false @@ -110,50 +31,15 @@ "arguments": [ { "type": "MetaProperty", - "start": 12, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":12,"end":23,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":23}}, "meta": { "type": "Identifier", - "start": 12, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 18 - }, - "identifierName": "import" - }, + "start":12,"end":18,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":18},"identifierName":"import"}, "name": "import" }, "property": { "type": "Identifier", - "start": 19, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 23 - }, - "identifierName": "meta" - }, + "start":19,"end":23,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":23},"identifierName":"meta"}, "name": "meta" } } diff --git a/packages/babel-parser/test/fixtures/core/sourcetype-unambiguous/module-export-all/output.json b/packages/babel-parser/test/fixtures/core/sourcetype-unambiguous/module-export-all/output.json index 2ab38b87e88f..c45fef74fd3c 100644 --- a/packages/babel-parser/test/fixtures/core/sourcetype-unambiguous/module-export-all/output.json +++ b/packages/babel-parser/test/fixtures/core/sourcetype-unambiguous/module-export-all/output.json @@ -1,62 +1,18 @@ { "type": "File", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, "program": { "type": "Program", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExportAllDeclaration", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, "source": { "type": "StringLiteral", - "start": 14, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":14,"end":19,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":19}}, "extra": { "rawValue": "foo", "raw": "\"foo\"" diff --git a/packages/babel-parser/test/fixtures/core/sourcetype-unambiguous/module-export-default/output.json b/packages/babel-parser/test/fixtures/core/sourcetype-unambiguous/module-export-default/output.json index ed6720762308..f97a48e3ef0f 100644 --- a/packages/babel-parser/test/fixtures/core/sourcetype-unambiguous/module-export-default/output.json +++ b/packages/babel-parser/test/fixtures/core/sourcetype-unambiguous/module-export-default/output.json @@ -1,62 +1,18 @@ { "type": "File", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, "program": { "type": "Program", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExportDefaultDeclaration", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, "declaration": { "type": "ObjectExpression", - "start": 15, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":15,"end":17,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":17}}, "properties": [] } } diff --git a/packages/babel-parser/test/fixtures/core/sourcetype-unambiguous/module-export-named/output.json b/packages/babel-parser/test/fixtures/core/sourcetype-unambiguous/module-export-named/output.json index d3f3d5769276..3aa29e11dfbd 100644 --- a/packages/babel-parser/test/fixtures/core/sourcetype-unambiguous/module-export-named/output.json +++ b/packages/babel-parser/test/fixtures/core/sourcetype-unambiguous/module-export-named/output.json @@ -1,79 +1,23 @@ { "type": "File", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "program": { "type": "Program", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExportNamedDeclaration", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "specifiers": [], "source": null, "declaration": { "type": "FunctionDeclaration", - "start": 7, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":7,"end":22,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":22}}, "id": { "type": "Identifier", - "start": 16, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 18 - }, - "identifierName": "fn" - }, + "start":16,"end":18,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":18},"identifierName":"fn"}, "name": "fn" }, "generator": false, @@ -81,18 +25,7 @@ "params": [], "body": { "type": "BlockStatement", - "start": 20, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":20,"end":22,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":22}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/core/sourcetype-unambiguous/module-import/output.json b/packages/babel-parser/test/fixtures/core/sourcetype-unambiguous/module-import/output.json index 329db7b04655..95736fdee6c1 100644 --- a/packages/babel-parser/test/fixtures/core/sourcetype-unambiguous/module-import/output.json +++ b/packages/babel-parser/test/fixtures/core/sourcetype-unambiguous/module-import/output.json @@ -1,63 +1,19 @@ { "type": "File", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "program": { "type": "Program", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ImportDeclaration", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "specifiers": [], "source": { "type": "StringLiteral", - "start": 7, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":7,"end":12,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":12}}, "extra": { "rawValue": "foo", "raw": "\"foo\"" diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/1/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/1/output.json index 1cf6441fffc6..066e56384368 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/1/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/1/output.json @@ -1,62 +1,18 @@ { "type": "File", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - }, + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, "program": { "type": "Program", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - }, + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - }, + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, "expression": { "type": "ThisExpression", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - } + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}} } } ], diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/10/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/10/output.json index 3f7e070ca3ac..021db7e307b2 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/10/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/10/output.json @@ -1,109 +1,34 @@ { "type": "File", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "program": { "type": "Program", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "expression": { "type": "AssignmentExpression", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "operator": "=", "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "right": { "type": "ArrayExpression", - "start": 4, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 11 - } + "start":4,"end":11,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":11}}, + "extra": { + "trailingComma": 8 }, "elements": [ { "type": "NumericLiteral", - "start": 6, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":6,"end":8,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":8}}, "extra": { "rawValue": 42, "raw": "42" diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/100/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/100/output.json index 69ff486c62d9..8bbf441a1bd2 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/100/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/100/output.json @@ -1,63 +1,19 @@ { "type": "File", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 6 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":6}}, "program": { "type": "Program", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 6 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":6}}, "sourceType": "script", "interpreter": null, "body": [], "directives": [ { "type": "Directive", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 6 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":6}}, "value": { "type": "DirectiveLiteral", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 6 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":6}}, "value": "Hello\\\nworld", "extra": { "raw": "\"Hello\\\nworld\"", diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/101/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/101/output.json index e95ac9779c07..b34917f7e658 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/101/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/101/output.json @@ -1,63 +1,19 @@ { "type": "File", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "program": { "type": "Program", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "sourceType": "script", "interpreter": null, "body": [], "directives": [ { "type": "Directive", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "value": { "type": "DirectiveLiteral", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "value": "Hello\\1World", "extra": { "raw": "\"Hello\\1World\"", diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/102/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/102/output.json index edf979f658a8..b0e0b89e8fd3 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/102/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/102/output.json @@ -1,94 +1,27 @@ { "type": "File", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "program": { "type": "Program", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":4,"end":16,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":16}}, "id": { "type": "Identifier", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "x" - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"x"}, "name": "x" }, "init": { "type": "RegExpLiteral", - "start": 8, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":8,"end":16,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":16}}, "extra": { "raw": "/[a-z]/i" }, diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/103/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/103/output.json index 4ec3778aaff6..73308081041b 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/103/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/103/output.json @@ -1,94 +1,27 @@ { "type": "File", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "program": { "type": "Program", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":4,"end":16,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":16}}, "id": { "type": "Identifier", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "x" - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"x"}, "name": "x" }, "init": { "type": "RegExpLiteral", - "start": 8, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":8,"end":16,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":16}}, "extra": { "raw": "/[x-z]/i" }, diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/104/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/104/output.json index 7c5bfd0d7d4b..60a5a8fea2af 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/104/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/104/output.json @@ -1,94 +1,27 @@ { "type": "File", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "program": { "type": "Program", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":4,"end":16,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":16}}, "id": { "type": "Identifier", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "x" - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"x"}, "name": "x" }, "init": { "type": "RegExpLiteral", - "start": 8, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":8,"end":16,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":16}}, "extra": { "raw": "/[a-c]/i" }, diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/105/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/105/output.json index c79985fcb2bb..1eea2fed3a3c 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/105/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/105/output.json @@ -1,94 +1,27 @@ { "type": "File", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "program": { "type": "Program", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":4,"end":17,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":17}}, "id": { "type": "Identifier", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "x" - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"x"}, "name": "x" }, "init": { "type": "RegExpLiteral", - "start": 8, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":8,"end":17,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":17}}, "extra": { "raw": "/[P QR]/i" }, diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/106/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/106/output.json index abec94d30ee3..2e5490d094d9 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/106/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/106/output.json @@ -1,94 +1,27 @@ { "type": "File", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, "program": { "type": "Program", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":4,"end":18,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":18}}, "id": { "type": "Identifier", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "x" - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"x"}, "name": "x" }, "init": { "type": "RegExpLiteral", - "start": 8, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":8,"end":18,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":18}}, "extra": { "raw": "/foo\\/bar/" }, diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/107/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/107/output.json index 311090fd6ab9..a9e8ee6e33e1 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/107/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/107/output.json @@ -1,94 +1,27 @@ { "type": "File", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, "program": { "type": "Program", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":4,"end":21,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":21}}, "id": { "type": "Identifier", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "x" - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"x"}, "name": "x" }, "init": { "type": "RegExpLiteral", - "start": 8, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":8,"end":21,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":21}}, "extra": { "raw": "/=([^=\\s])+/g" }, diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/108/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/108/options.json deleted file mode 100644 index 080cb0eaaa8a..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/108/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid regular expression flag (1:17)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/108/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/108/output.json new file mode 100644 index 000000000000..287f2a053320 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/108/output.json @@ -0,0 +1,45 @@ +{ + "type": "File", + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, + "errors": [ + "SyntaxError: Invalid regular expression flag (1:17)", + "SyntaxError: Invalid regular expression flag (1:19)", + "SyntaxError: Invalid regular expression flag (1:20)", + "SyntaxError: Invalid regular expression flag (1:21)", + "SyntaxError: Invalid regular expression flag (1:22)" + ], + "program": { + "type": "Program", + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":4,"end":22,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":22}}, + "id": { + "type": "Identifier", + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"x"}, + "name": "x" + }, + "init": { + "type": "RegExpLiteral", + "start":8,"end":22,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":22}}, + "extra": { + "raw": "/[P QR]/\\u0067" + }, + "pattern": "[P QR]", + "flags": "\\u0067" + } + } + ], + "kind": "var" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/109/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/109/output.json index 832564eca470..d0e31b332f44 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/109/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/109/output.json @@ -1,77 +1,21 @@ { "type": "File", - "start": 0, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, "program": { "type": "Program", - "start": 0, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, "expression": { "type": "NewExpression", - "start": 0, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, "callee": { "type": "Identifier", - "start": 4, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 10 - }, - "identifierName": "Button" - }, + "start":4,"end":10,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":10},"identifierName":"Button"}, "name": "Button" }, "arguments": [] diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/11/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/11/output.json index b0025ea3388c..207c5b961330 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/11/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/11/output.json @@ -1,111 +1,33 @@ { "type": "File", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "program": { "type": "Program", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "expression": { "type": "AssignmentExpression", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "operator": "=", "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "right": { "type": "ArrayExpression", - "start": 4, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":4,"end":13,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":13}}, "elements": [ null, null, { "type": "NumericLiteral", - "start": 9, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":9,"end":11,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":11}}, "extra": { "rawValue": 42, "raw": "42" diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/110/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/110/output.json index 7bd85bcc02e7..31c748c495c7 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/110/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/110/output.json @@ -1,77 +1,21 @@ { "type": "File", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, "program": { "type": "Program", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, "expression": { "type": "NewExpression", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, "callee": { "type": "Identifier", - "start": 4, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 10 - }, - "identifierName": "Button" - }, + "start":4,"end":10,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":10},"identifierName":"Button"}, "name": "Button" }, "arguments": [] diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/111/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/111/output.json index 8890dbc0a524..b700e71957e6 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/111/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/111/output.json @@ -1,91 +1,24 @@ { "type": "File", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "program": { "type": "Program", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "expression": { "type": "NewExpression", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "callee": { "type": "NewExpression", - "start": 4, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":4,"end":11,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":11}}, "callee": { "type": "Identifier", - "start": 8, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "foo" - }, + "start":8,"end":11,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":11},"identifierName":"foo"}, "name": "foo" }, "arguments": [] diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/112/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/112/output.json index 74dfc01529a3..2a305b55c4bb 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/112/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/112/output.json @@ -1,91 +1,24 @@ { "type": "File", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "program": { "type": "Program", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "expression": { "type": "NewExpression", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "callee": { "type": "NewExpression", - "start": 4, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":4,"end":13,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":13}}, "callee": { "type": "Identifier", - "start": 8, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "foo" - }, + "start":8,"end":11,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":11},"identifierName":"foo"}, "name": "foo" }, "arguments": [] diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/113/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/113/output.json index 9a7b0d5681d2..6b3dccf75cd9 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/113/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/113/output.json @@ -1,124 +1,34 @@ { "type": "File", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "program": { "type": "Program", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "expression": { "type": "CallExpression", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "callee": { "type": "MemberExpression", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "object": { "type": "NewExpression", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "callee": { "type": "Identifier", - "start": 4, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "foo" - }, + "start":4,"end":7,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":7},"identifierName":"foo"}, "name": "foo" }, "arguments": [] }, "property": { "type": "Identifier", - "start": 10, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 13 - }, - "identifierName": "bar" - }, + "start":10,"end":13,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":13},"identifierName":"bar"}, "name": "bar" }, "computed": false diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/114/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/114/output.json index aed252faf17d..2a3507d72d53 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/114/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/114/output.json @@ -1,108 +1,29 @@ { "type": "File", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, "program": { "type": "Program", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, "expression": { "type": "NewExpression", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, "callee": { "type": "MemberExpression", - "start": 4, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":4,"end":12,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":12}}, "object": { "type": "Identifier", - "start": 4, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "foo" - }, + "start":4,"end":7,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":7},"identifierName":"foo"}, "name": "foo" }, "property": { "type": "Identifier", - "start": 8, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "bar" - }, + "start":8,"end":11,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":11},"identifierName":"bar"}, "name": "bar" }, "computed": true diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/115/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/115/output.json index 0177eead6074..3a2644e84250 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/115/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/115/output.json @@ -1,108 +1,29 @@ { "type": "File", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "program": { "type": "Program", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "expression": { "type": "NewExpression", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "callee": { "type": "MemberExpression", - "start": 4, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":4,"end":11,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":11}}, "object": { "type": "Identifier", - "start": 4, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "foo" - }, + "start":4,"end":7,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":7},"identifierName":"foo"}, "name": "foo" }, "property": { "type": "Identifier", - "start": 8, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "bar" - }, + "start":8,"end":11,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":11},"identifierName":"bar"}, "name": "bar" }, "computed": false diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/116/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/116/output.json index 2e5825aecfbb..6dfef381edf5 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/116/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/116/output.json @@ -1,105 +1,27 @@ { "type": "File", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "program": { "type": "Program", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "expression": { "type": "CallExpression", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "callee": { "type": "MemberExpression", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "object": { "type": "NewExpression", - "start": 2, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":2,"end":9,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":9}}, "callee": { "type": "Identifier", - "start": 6, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "foo" - }, + "start":6,"end":9,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":9},"identifierName":"foo"}, "name": "foo" }, "arguments": [], @@ -110,19 +32,7 @@ }, "property": { "type": "Identifier", - "start": 11, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 14 - }, - "identifierName": "bar" - }, + "start":11,"end":14,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":14},"identifierName":"bar"}, "name": "bar" }, "computed": false diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/117/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/117/output.json index 38dadd707806..0bbb304c6e3d 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/117/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/117/output.json @@ -1,112 +1,32 @@ { "type": "File", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "program": { "type": "Program", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "expression": { "type": "CallExpression", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "callee": { "type": "Identifier", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - }, - "identifierName": "foo" - }, + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3},"identifierName":"foo"}, "name": "foo" }, "arguments": [ { "type": "Identifier", - "start": 4, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "bar" - }, + "start":4,"end":7,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":7},"identifierName":"bar"}, "name": "bar" }, { "type": "Identifier", - "start": 9, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "baz" - }, + "start":9,"end":12,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":12},"identifierName":"baz"}, "name": "baz" } ] diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/118/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/118/output.json index f8bf7daf5bd2..b86053f12aa9 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/118/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/118/output.json @@ -1,77 +1,21 @@ { "type": "File", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "program": { "type": "Program", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "expression": { "type": "CallExpression", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "callee": { "type": "Identifier", - "start": 5, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 8 - }, - "identifierName": "foo" - }, + "start":5,"end":8,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":8},"identifierName":"foo"}, "name": "foo", "extra": { "parenthesized": true, diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/119/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/119/output.json index 82d3e1035a29..d55ddd1b61ea 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/119/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/119/output.json @@ -1,94 +1,26 @@ { "type": "File", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "program": { "type": "Program", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "expression": { "type": "MemberExpression", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "object": { "type": "Identifier", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - }, - "identifierName": "universe" - }, + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8},"identifierName":"universe"}, "name": "universe" }, "property": { "type": "Identifier", - "start": 9, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 17 - }, - "identifierName": "milkyway" - }, + "start":9,"end":17,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":17},"identifierName":"milkyway"}, "name": "milkyway" }, "computed": false diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/12/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/12/output.json index 573eda5bfa9f..4bc8d58ff2be 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/12/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/12/output.json @@ -1,109 +1,34 @@ { "type": "File", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "program": { "type": "Program", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "expression": { "type": "AssignmentExpression", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "operator": "=", "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "right": { "type": "ArrayExpression", - "start": 4, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 16 - } + "start":4,"end":16,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":16}}, + "extra": { + "trailingComma": 13 }, "elements": [ { "type": "NumericLiteral", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7}}, "extra": { "rawValue": 1, "raw": "1" @@ -112,18 +37,7 @@ }, { "type": "NumericLiteral", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10}}, "extra": { "rawValue": 2, "raw": "2" @@ -132,18 +46,7 @@ }, { "type": "NumericLiteral", - "start": 12, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":12,"end":13,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":13}}, "extra": { "rawValue": 3, "raw": "3" diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/120/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/120/output.json index a446cdb8fba9..90f241ea29b9 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/120/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/120/output.json @@ -1,127 +1,36 @@ { "type": "File", - "start": 0, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, "program": { "type": "Program", - "start": 0, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, "expression": { "type": "MemberExpression", - "start": 0, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, "object": { "type": "MemberExpression", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "object": { "type": "Identifier", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - }, - "identifierName": "universe" - }, + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8},"identifierName":"universe"}, "name": "universe" }, "property": { "type": "Identifier", - "start": 9, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 17 - }, - "identifierName": "milkyway" - }, + "start":9,"end":17,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":17},"identifierName":"milkyway"}, "name": "milkyway" }, "computed": false }, "property": { "type": "Identifier", - "start": 18, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 29 - }, - "identifierName": "solarsystem" - }, + "start":18,"end":29,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":29},"identifierName":"solarsystem"}, "name": "solarsystem" }, "computed": false diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/121/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/121/output.json index cb1cbf606f18..6ebb1a398b70 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/121/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/121/output.json @@ -1,160 +1,46 @@ { "type": "File", - "start": 0, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":35}}, "program": { "type": "Program", - "start": 0, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":35}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":35}}, "expression": { "type": "MemberExpression", - "start": 0, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":35}}, "object": { "type": "MemberExpression", - "start": 0, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, "object": { "type": "MemberExpression", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "object": { "type": "Identifier", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - }, - "identifierName": "universe" - }, + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8},"identifierName":"universe"}, "name": "universe" }, "property": { "type": "Identifier", - "start": 9, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 17 - }, - "identifierName": "milkyway" - }, + "start":9,"end":17,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":17},"identifierName":"milkyway"}, "name": "milkyway" }, "computed": false }, "property": { "type": "Identifier", - "start": 18, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 29 - }, - "identifierName": "solarsystem" - }, + "start":18,"end":29,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":29},"identifierName":"solarsystem"}, "name": "solarsystem" }, "computed": false }, "property": { "type": "Identifier", - "start": 30, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 1, - "column": 35 - }, - "identifierName": "Earth" - }, + "start":30,"end":35,"loc":{"start":{"line":1,"column":30},"end":{"line":1,"column":35},"identifierName":"Earth"}, "name": "Earth" }, "computed": false diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/122/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/122/output.json index fbb61eb44b1f..35c3eaa5e2ba 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/122/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/122/output.json @@ -1,126 +1,35 @@ { "type": "File", - "start": 0, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":38}}, "program": { "type": "Program", - "start": 0, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":38}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":38}}, "expression": { "type": "MemberExpression", - "start": 0, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":38}}, "object": { "type": "Identifier", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - }, - "identifierName": "universe" - }, + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8},"identifierName":"universe"}, "name": "universe" }, "property": { "type": "SequenceExpression", - "start": 9, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 37 - } - }, + "start":9,"end":37,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":37}}, "expressions": [ { "type": "Identifier", - "start": 9, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 19 - }, - "identifierName": "galaxyName" - }, + "start":9,"end":19,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":19},"identifierName":"galaxyName"}, "name": "galaxyName" }, { "type": "Identifier", - "start": 21, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 37 - }, - "identifierName": "otherUselessName" - }, + "start":21,"end":37,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":37},"identifierName":"otherUselessName"}, "name": "otherUselessName" } ] diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/123/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/123/output.json index 4d221db72d8c..5ccfa4a76dee 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/123/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/123/output.json @@ -1,94 +1,26 @@ { "type": "File", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, "program": { "type": "Program", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, "expression": { "type": "MemberExpression", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, "object": { "type": "Identifier", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - }, - "identifierName": "universe" - }, + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8},"identifierName":"universe"}, "name": "universe" }, "property": { "type": "Identifier", - "start": 9, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 19 - }, - "identifierName": "galaxyName" - }, + "start":9,"end":19,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":19},"identifierName":"galaxyName"}, "name": "galaxyName" }, "computed": true diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/124/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/124/output.json index f3ec5d8857d3..5fa10d856cd3 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/124/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/124/output.json @@ -1,107 +1,29 @@ { "type": "File", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, "program": { "type": "Program", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, "expression": { "type": "MemberExpression", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, "object": { "type": "MemberExpression", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, "object": { "type": "Identifier", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - }, - "identifierName": "universe" - }, + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8},"identifierName":"universe"}, "name": "universe" }, "property": { "type": "NumericLiteral", - "start": 9, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":9,"end":11,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":11}}, "extra": { "rawValue": 42, "raw": "42" @@ -112,19 +34,7 @@ }, "property": { "type": "Identifier", - "start": 13, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 21 - }, - "identifierName": "galaxies" - }, + "start":13,"end":21,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":21},"identifierName":"galaxies"}, "name": "galaxies" }, "computed": false diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/125/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/125/output.json index a0d7dd658252..5fe9e49343b7 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/125/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/125/output.json @@ -1,108 +1,30 @@ { "type": "File", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, "program": { "type": "Program", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, "expression": { "type": "MemberExpression", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, "object": { "type": "CallExpression", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, "callee": { "type": "Identifier", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - }, - "identifierName": "universe" - }, + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8},"identifierName":"universe"}, "name": "universe" }, "arguments": [ { "type": "NumericLiteral", - "start": 9, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":9,"end":11,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":11}}, "extra": { "rawValue": 42, "raw": "42" @@ -113,19 +35,7 @@ }, "property": { "type": "Identifier", - "start": 13, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 21 - }, - "identifierName": "galaxies" - }, + "start":13,"end":21,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":21},"identifierName":"galaxies"}, "name": "galaxies" }, "computed": false diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/126/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/126/output.json index 3d93d997f972..e7068fd5cac3 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/126/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/126/output.json @@ -1,136 +1,36 @@ { "type": "File", - "start": 0, - "end": 41, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 41 - } - }, + "start":0,"end":41,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":41}}, "program": { "type": "Program", - "start": 0, - "end": 41, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 41 - } - }, + "start":0,"end":41,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":41}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 41, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 41 - } - }, + "start":0,"end":41,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":41}}, "expression": { "type": "MemberExpression", - "start": 0, - "end": 41, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 41 - } - }, + "start":0,"end":41,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":41}}, "object": { "type": "CallExpression", - "start": 0, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, "callee": { "type": "MemberExpression", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, "object": { "type": "CallExpression", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, "callee": { "type": "Identifier", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - }, - "identifierName": "universe" - }, + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8},"identifierName":"universe"}, "name": "universe" }, "arguments": [ { "type": "NumericLiteral", - "start": 9, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":9,"end":11,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":11}}, "extra": { "rawValue": 42, "raw": "42" @@ -141,19 +41,7 @@ }, "property": { "type": "Identifier", - "start": 13, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 21 - }, - "identifierName": "galaxies" - }, + "start":13,"end":21,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":21},"identifierName":"galaxies"}, "name": "galaxies" }, "computed": false @@ -161,18 +49,7 @@ "arguments": [ { "type": "NumericLiteral", - "start": 22, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":22,"end":24,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":24}}, "extra": { "rawValue": 14, "raw": "14" @@ -181,18 +58,7 @@ }, { "type": "NumericLiteral", - "start": 26, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":26,"end":27,"loc":{"start":{"line":1,"column":26},"end":{"line":1,"column":27}}, "extra": { "rawValue": 3, "raw": "3" @@ -201,18 +67,7 @@ }, { "type": "NumericLiteral", - "start": 29, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":29,"end":31,"loc":{"start":{"line":1,"column":29},"end":{"line":1,"column":31}}, "extra": { "rawValue": 77, "raw": "77" @@ -223,19 +78,7 @@ }, "property": { "type": "Identifier", - "start": 33, - "end": 41, - "loc": { - "start": { - "line": 1, - "column": 33 - }, - "end": { - "line": 1, - "column": 41 - }, - "identifierName": "milkyway" - }, + "start":33,"end":41,"loc":{"start":{"line":1,"column":33},"end":{"line":1,"column":41},"identifierName":"milkyway"}, "name": "milkyway" }, "computed": false diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/127/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/127/output.json index bc3d887ec081..645ac82f5566 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/127/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/127/output.json @@ -1,174 +1,49 @@ { "type": "File", - "start": 0, - "end": 45, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 45 - } - }, + "start":0,"end":45,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":45}}, "program": { "type": "Program", - "start": 0, - "end": 45, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 45 - } - }, + "start":0,"end":45,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":45}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 45, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 45 - } - }, + "start":0,"end":45,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":45}}, "expression": { "type": "CallExpression", - "start": 0, - "end": 45, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 45 - } - }, + "start":0,"end":45,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":45}}, "callee": { "type": "MemberExpression", - "start": 0, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 39 - } - }, + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":39}}, "object": { "type": "MemberExpression", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, "object": { "type": "MemberExpression", - "start": 0, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, "object": { "type": "Identifier", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "earth" - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5},"identifierName":"earth"}, "name": "earth" }, "property": { "type": "Identifier", - "start": 6, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 10 - }, - "identifierName": "asia" - }, + "start":6,"end":10,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":10},"identifierName":"asia"}, "name": "asia" }, "computed": false }, "property": { "type": "Identifier", - "start": 11, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 20 - }, - "identifierName": "Indonesia" - }, + "start":11,"end":20,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":20},"identifierName":"Indonesia"}, "name": "Indonesia" }, "computed": false }, "property": { "type": "Identifier", - "start": 21, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 39 - }, - "identifierName": "prepareForElection" - }, + "start":21,"end":39,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":39},"identifierName":"prepareForElection"}, "name": "prepareForElection" }, "computed": false @@ -176,18 +51,7 @@ "arguments": [ { "type": "NumericLiteral", - "start": 40, - "end": 44, - "loc": { - "start": { - "line": 1, - "column": 40 - }, - "end": { - "line": 1, - "column": 44 - } - }, + "start":40,"end":44,"loc":{"start":{"line":1,"column":40},"end":{"line":1,"column":44}}, "extra": { "rawValue": 2014, "raw": "2014" diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/128/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/128/output.json index 8e2550dfe5dd..96d56d51f44b 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/128/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/128/output.json @@ -1,94 +1,26 @@ { "type": "File", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "program": { "type": "Program", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "expression": { "type": "MemberExpression", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "object": { "type": "Identifier", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - }, - "identifierName": "universe" - }, + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8},"identifierName":"universe"}, "name": "universe" }, "property": { "type": "Identifier", - "start": 9, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "if" - }, + "start":9,"end":11,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":11},"identifierName":"if"}, "name": "if" }, "computed": false diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/129/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/129/output.json index 88fce0c71325..834a12a4ebaf 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/129/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/129/output.json @@ -1,94 +1,26 @@ { "type": "File", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "program": { "type": "Program", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "expression": { "type": "MemberExpression", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "object": { "type": "Identifier", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - }, - "identifierName": "universe" - }, + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8},"identifierName":"universe"}, "name": "universe" }, "property": { "type": "Identifier", - "start": 9, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 13 - }, - "identifierName": "true" - }, + "start":9,"end":13,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":13},"identifierName":"true"}, "name": "true" }, "computed": false diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/13/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/13/output.json index 34c8d7e15c8e..48a925190076 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/13/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/13/output.json @@ -1,109 +1,34 @@ { "type": "File", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "program": { "type": "Program", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "expression": { "type": "AssignmentExpression", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "operator": "=", "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "right": { "type": "ArrayExpression", - "start": 4, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 17 - } + "start":4,"end":17,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":17}}, + "extra": { + "trailingComma": 14 }, "elements": [ { "type": "NumericLiteral", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7}}, "extra": { "rawValue": 1, "raw": "1" @@ -112,18 +37,7 @@ }, { "type": "NumericLiteral", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10}}, "extra": { "rawValue": 2, "raw": "2" @@ -133,18 +47,7 @@ null, { "type": "NumericLiteral", - "start": 13, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":13,"end":14,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":14}}, "extra": { "rawValue": 3, "raw": "3" diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/130/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/130/output.json index c40e59d22d69..e7664cfc936c 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/130/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/130/output.json @@ -1,94 +1,26 @@ { "type": "File", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "program": { "type": "Program", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "expression": { "type": "MemberExpression", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "object": { "type": "Identifier", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - }, - "identifierName": "universe" - }, + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8},"identifierName":"universe"}, "name": "universe" }, "property": { "type": "Identifier", - "start": 9, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 14 - }, - "identifierName": "false" - }, + "start":9,"end":14,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":14},"identifierName":"false"}, "name": "false" }, "computed": false diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/131/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/131/output.json index 9739e7a6f375..d9b4c0dd9e6a 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/131/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/131/output.json @@ -1,94 +1,26 @@ { "type": "File", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "program": { "type": "Program", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "expression": { "type": "MemberExpression", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "object": { "type": "Identifier", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - }, - "identifierName": "universe" - }, + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8},"identifierName":"universe"}, "name": "universe" }, "property": { "type": "Identifier", - "start": 9, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 13 - }, - "identifierName": "null" - }, + "start":9,"end":13,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":13},"identifierName":"null"}, "name": "null" }, "computed": false diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/132/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/132/output.json index 603d0ca75c7e..798e7f2d3c09 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/132/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/132/output.json @@ -1,79 +1,23 @@ { "type": "File", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, "program": { "type": "Program", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, "expression": { "type": "UpdateExpression", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, "operator": "++", "prefix": false, "argument": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" } } diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/133/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/133/output.json index 0c86ed9cfa68..2470e7fd781b 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/133/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/133/output.json @@ -1,79 +1,23 @@ { "type": "File", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, "program": { "type": "Program", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, "expression": { "type": "UpdateExpression", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, "operator": "--", "prefix": false, "argument": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" } } diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/134/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/134/output.json index acdf9d06a913..87c3e0871fce 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/134/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/134/output.json @@ -1,79 +1,23 @@ { "type": "File", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "program": { "type": "Program", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "expression": { "type": "UpdateExpression", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "operator": "++", "prefix": false, "argument": { "type": "Identifier", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - }, - "identifierName": "eval" - }, + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4},"identifierName":"eval"}, "name": "eval" } } diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/135/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/135/output.json index 16a8b4d99781..1798f7e29651 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/135/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/135/output.json @@ -1,79 +1,23 @@ { "type": "File", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "program": { "type": "Program", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "expression": { "type": "UpdateExpression", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "operator": "--", "prefix": false, "argument": { "type": "Identifier", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - }, - "identifierName": "eval" - }, + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4},"identifierName":"eval"}, "name": "eval" } } diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/136/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/136/output.json index 1ae88c0512af..6237a6d3dda1 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/136/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/136/output.json @@ -1,79 +1,23 @@ { "type": "File", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "program": { "type": "Program", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "expression": { "type": "UpdateExpression", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "operator": "++", "prefix": false, "argument": { "type": "Identifier", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "arguments" - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9},"identifierName":"arguments"}, "name": "arguments" } } diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/137/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/137/output.json index f9aca6bfaa5e..31b78a3ccbd9 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/137/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/137/output.json @@ -1,79 +1,23 @@ { "type": "File", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "program": { "type": "Program", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "expression": { "type": "UpdateExpression", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "operator": "--", "prefix": false, "argument": { "type": "Identifier", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "arguments" - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9},"identifierName":"arguments"}, "name": "arguments" } } diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/138/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/138/output.json index 620fca404822..2b55f4dc54ce 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/138/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/138/output.json @@ -1,79 +1,23 @@ { "type": "File", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, "program": { "type": "Program", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, "expression": { "type": "UpdateExpression", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, "operator": "++", "prefix": true, "argument": { "type": "Identifier", - "start": 2, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 3 - }, - "identifierName": "x" - }, + "start":2,"end":3,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":3},"identifierName":"x"}, "name": "x" } } diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/139/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/139/output.json index 2179523b38b9..e9b595563644 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/139/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/139/output.json @@ -1,79 +1,23 @@ { "type": "File", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, "program": { "type": "Program", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, "expression": { "type": "UpdateExpression", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, "operator": "--", "prefix": true, "argument": { "type": "Identifier", - "start": 2, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 3 - }, - "identifierName": "x" - }, + "start":2,"end":3,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":3},"identifierName":"x"}, "name": "x" } } diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/14/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/14/output.json index 4a76c9ff3935..a51e468a580c 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/14/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/14/output.json @@ -1,94 +1,27 @@ { "type": "File", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, "program": { "type": "Program", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, "expression": { "type": "AssignmentExpression", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, "operator": "=", "left": { "type": "Identifier", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - }, - "identifierName": "日本語" - }, + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3},"identifierName":"日本語"}, "name": "日本語" }, "right": { "type": "ArrayExpression", - "start": 6, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":6,"end":8,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":8}}, "elements": [] } } diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/140/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/140/output.json index 82b23bcc25bd..334ceaff24f8 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/140/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/140/output.json @@ -1,79 +1,23 @@ { "type": "File", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "program": { "type": "Program", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "expression": { "type": "UpdateExpression", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "operator": "++", "prefix": true, "argument": { "type": "Identifier", - "start": 2, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "eval" - }, + "start":2,"end":6,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":6},"identifierName":"eval"}, "name": "eval" } } diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/141/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/141/output.json index 88d60f45c549..d2960c20fba4 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/141/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/141/output.json @@ -1,79 +1,23 @@ { "type": "File", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "program": { "type": "Program", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "expression": { "type": "UpdateExpression", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "operator": "--", "prefix": true, "argument": { "type": "Identifier", - "start": 2, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "eval" - }, + "start":2,"end":6,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":6},"identifierName":"eval"}, "name": "eval" } } diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/142/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/142/output.json index 15827d111508..00218c0e04b4 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/142/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/142/output.json @@ -1,79 +1,23 @@ { "type": "File", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "program": { "type": "Program", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "expression": { "type": "UpdateExpression", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "operator": "++", "prefix": true, "argument": { "type": "Identifier", - "start": 2, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "arguments" - }, + "start":2,"end":11,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":11},"identifierName":"arguments"}, "name": "arguments" } } diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/143/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/143/output.json index e9f55cbe3989..f83d741ef5f7 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/143/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/143/output.json @@ -1,79 +1,23 @@ { "type": "File", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "program": { "type": "Program", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "expression": { "type": "UpdateExpression", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "operator": "--", "prefix": true, "argument": { "type": "Identifier", - "start": 2, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "arguments" - }, + "start":2,"end":11,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":11},"identifierName":"arguments"}, "name": "arguments" } } diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/144/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/144/output.json index fd8b54221703..f8707b901884 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/144/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/144/output.json @@ -1,79 +1,23 @@ { "type": "File", - "start": 0, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 2 - } - }, + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}}, "program": { "type": "Program", - "start": 0, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 2 - } - }, + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 2 - } - }, + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}}, "expression": { "type": "UnaryExpression", - "start": 0, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 2 - } - }, + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}}, "operator": "+", "prefix": true, "argument": { "type": "Identifier", - "start": 1, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - }, - "identifierName": "x" - }, + "start":1,"end":2,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":2},"identifierName":"x"}, "name": "x" } } diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/145/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/145/output.json index 00936f4b0f7e..cee848a92aed 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/145/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/145/output.json @@ -1,79 +1,23 @@ { "type": "File", - "start": 0, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 2 - } - }, + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}}, "program": { "type": "Program", - "start": 0, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 2 - } - }, + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 2 - } - }, + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}}, "expression": { "type": "UnaryExpression", - "start": 0, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 2 - } - }, + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}}, "operator": "-", "prefix": true, "argument": { "type": "Identifier", - "start": 1, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - }, - "identifierName": "x" - }, + "start":1,"end":2,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":2},"identifierName":"x"}, "name": "x" } } diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/146/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/146/output.json index 533a669dfc98..38ba1fbd5d15 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/146/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/146/output.json @@ -1,79 +1,23 @@ { "type": "File", - "start": 0, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 2 - } - }, + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}}, "program": { "type": "Program", - "start": 0, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 2 - } - }, + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 2 - } - }, + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}}, "expression": { "type": "UnaryExpression", - "start": 0, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 2 - } - }, + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}}, "operator": "~", "prefix": true, "argument": { "type": "Identifier", - "start": 1, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - }, - "identifierName": "x" - }, + "start":1,"end":2,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":2},"identifierName":"x"}, "name": "x" } } diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/147/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/147/output.json index b017ac4d4b08..37e26f32fe28 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/147/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/147/output.json @@ -1,79 +1,23 @@ { "type": "File", - "start": 0, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 2 - } - }, + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}}, "program": { "type": "Program", - "start": 0, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 2 - } - }, + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 2 - } - }, + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}}, "expression": { "type": "UnaryExpression", - "start": 0, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 2 - } - }, + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}}, "operator": "!", "prefix": true, "argument": { "type": "Identifier", - "start": 1, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - }, - "identifierName": "x" - }, + "start":1,"end":2,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":2},"identifierName":"x"}, "name": "x" } } diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/148/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/148/output.json index 4a0bf74a8a4f..eb5d31ccb83e 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/148/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/148/output.json @@ -1,79 +1,23 @@ { "type": "File", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "program": { "type": "Program", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "expression": { "type": "UnaryExpression", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "operator": "void", "prefix": true, "argument": { "type": "Identifier", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "x" - }, + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"x"}, "name": "x" } } diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/149/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/149/output.json index add0b1fc84de..96c7f5c02425 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/149/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/149/output.json @@ -1,79 +1,23 @@ { "type": "File", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, "program": { "type": "Program", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, "expression": { "type": "UnaryExpression", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, "operator": "delete", "prefix": true, "argument": { "type": "Identifier", - "start": 7, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - }, - "identifierName": "x" - }, + "start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8},"identifierName":"x"}, "name": "x" } } diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/15/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/15/output.json index e0b6f1f741b8..0598d0ee00d5 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/15/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/15/output.json @@ -1,94 +1,27 @@ { "type": "File", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "program": { "type": "Program", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "expression": { "type": "AssignmentExpression", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "operator": "=", "left": { "type": "Identifier", - "start": 0, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 2 - }, - "identifierName": "T‿" - }, + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2},"identifierName":"T‿"}, "name": "T‿" }, "right": { "type": "ArrayExpression", - "start": 5, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":5,"end":7,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":7}}, "elements": [] } } diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/150/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/150/output.json index db311ef3bbf3..b42af7e2ffa1 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/150/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/150/output.json @@ -1,79 +1,23 @@ { "type": "File", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, "program": { "type": "Program", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, "expression": { "type": "UnaryExpression", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, "operator": "typeof", "prefix": true, "argument": { "type": "Identifier", - "start": 7, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - }, - "identifierName": "x" - }, + "start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8},"identifierName":"x"}, "name": "x" } } diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/151/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/151/output.json index d6c2f9a3e0dc..f90dba3c9ca5 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/151/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/151/output.json @@ -1,95 +1,27 @@ { "type": "File", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "program": { "type": "Program", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "expression": { "type": "BinaryExpression", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "operator": "*", "right": { "type": "Identifier", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "y" - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"y"}, "name": "y" } } diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/152/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/152/output.json index edeb7a67b95e..8a3977855df0 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/152/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/152/output.json @@ -1,95 +1,27 @@ { "type": "File", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "program": { "type": "Program", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "expression": { "type": "BinaryExpression", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "operator": "/", "right": { "type": "Identifier", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "y" - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"y"}, "name": "y" } } diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/153/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/153/output.json index 65b21159bd92..7d67196d62ad 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/153/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/153/output.json @@ -1,95 +1,27 @@ { "type": "File", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "program": { "type": "Program", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "expression": { "type": "BinaryExpression", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "operator": "%", "right": { "type": "Identifier", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "y" - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"y"}, "name": "y" } } diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/154/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/154/output.json index c2adfba4b5b5..7d87c8fc6e14 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/154/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/154/output.json @@ -1,95 +1,27 @@ { "type": "File", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "program": { "type": "Program", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "expression": { "type": "BinaryExpression", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "operator": "+", "right": { "type": "Identifier", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "y" - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"y"}, "name": "y" } } diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/155/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/155/output.json index 13cc3bbdfcd9..5226c2ebfb78 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/155/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/155/output.json @@ -1,95 +1,27 @@ { "type": "File", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "program": { "type": "Program", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "expression": { "type": "BinaryExpression", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "operator": "-", "right": { "type": "Identifier", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "y" - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"y"}, "name": "y" } } diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/156/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/156/output.json index a73cf0cf3f64..967c39273de2 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/156/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/156/output.json @@ -1,95 +1,27 @@ { "type": "File", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "program": { "type": "Program", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "expression": { "type": "BinaryExpression", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "operator": "<<", "right": { "type": "Identifier", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "y" - }, + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"y"}, "name": "y" } } diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/157/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/157/output.json index 8a2005065f87..71da5f24f236 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/157/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/157/output.json @@ -1,95 +1,27 @@ { "type": "File", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "program": { "type": "Program", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "expression": { "type": "BinaryExpression", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "operator": ">>", "right": { "type": "Identifier", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "y" - }, + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"y"}, "name": "y" } } diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/158/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/158/output.json index 79e6ab49f074..37f18c8f1c3b 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/158/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/158/output.json @@ -1,95 +1,27 @@ { "type": "File", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "program": { "type": "Program", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "expression": { "type": "BinaryExpression", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "operator": ">>>", "right": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "y" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"y"}, "name": "y" } } diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/159/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/159/output.json index da4b728c5eea..85ab5afc448b 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/159/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/159/output.json @@ -1,95 +1,27 @@ { "type": "File", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "program": { "type": "Program", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "expression": { "type": "BinaryExpression", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "operator": "<", "right": { "type": "Identifier", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "y" - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"y"}, "name": "y" } } diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/16/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/16/output.json index fcbcba00f535..62eafe1037a0 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/16/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/16/output.json @@ -1,94 +1,27 @@ { "type": "File", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "program": { "type": "Program", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "expression": { "type": "AssignmentExpression", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "operator": "=", "left": { "type": "Identifier", - "start": 0, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 2 - }, - "identifierName": "T‌" - }, + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2},"identifierName":"T‌"}, "name": "T‌" }, "right": { "type": "ArrayExpression", - "start": 5, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":5,"end":7,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":7}}, "elements": [] } } diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/160/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/160/output.json index 7e1b9c51b14f..b6ecda2e0a59 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/160/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/160/output.json @@ -1,95 +1,27 @@ { "type": "File", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "program": { "type": "Program", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "expression": { "type": "BinaryExpression", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "operator": ">", "right": { "type": "Identifier", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "y" - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"y"}, "name": "y" } } diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/161/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/161/output.json index 0fb742510be3..75141bc2be24 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/161/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/161/output.json @@ -1,95 +1,27 @@ { "type": "File", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "program": { "type": "Program", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "expression": { "type": "BinaryExpression", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "operator": "<=", "right": { "type": "Identifier", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "y" - }, + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"y"}, "name": "y" } } diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/162/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/162/output.json index ad8dec06b08e..8276ce96fcd7 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/162/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/162/output.json @@ -1,95 +1,27 @@ { "type": "File", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "program": { "type": "Program", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "expression": { "type": "BinaryExpression", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "operator": ">=", "right": { "type": "Identifier", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "y" - }, + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"y"}, "name": "y" } } diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/163/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/163/output.json index bb04fff52615..bd09306d3cbe 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/163/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/163/output.json @@ -1,95 +1,27 @@ { "type": "File", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "program": { "type": "Program", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "expression": { "type": "BinaryExpression", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "operator": "in", "right": { "type": "Identifier", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "y" - }, + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"y"}, "name": "y" } } diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/164/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/164/output.json index 6dc11018bc6b..e636283e423e 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/164/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/164/output.json @@ -1,95 +1,27 @@ { "type": "File", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "program": { "type": "Program", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "expression": { "type": "BinaryExpression", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "operator": "instanceof", "right": { "type": "Identifier", - "start": 13, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - }, - "identifierName": "y" - }, + "start":13,"end":14,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":14},"identifierName":"y"}, "name": "y" } } diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/165/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/165/output.json index 03f750d1dffe..726d741dfc72 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/165/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/165/output.json @@ -1,128 +1,37 @@ { "type": "File", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "program": { "type": "Program", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "expression": { "type": "BinaryExpression", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "left": { "type": "BinaryExpression", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "operator": "<", "right": { "type": "Identifier", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "y" - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"y"}, "name": "y" } }, "operator": "<", "right": { "type": "Identifier", - "start": 8, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "z" - }, + "start":8,"end":9,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":9},"identifierName":"z"}, "name": "z" } } diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/166/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/166/output.json index 1be43c5d3ea3..f9d37f650fdf 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/166/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/166/output.json @@ -1,95 +1,27 @@ { "type": "File", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "program": { "type": "Program", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "expression": { "type": "BinaryExpression", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "operator": "==", "right": { "type": "Identifier", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "y" - }, + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"y"}, "name": "y" } } diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/167/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/167/output.json index 7fdf6f8aa3eb..509a2fa878b7 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/167/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/167/output.json @@ -1,95 +1,27 @@ { "type": "File", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "program": { "type": "Program", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "expression": { "type": "BinaryExpression", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "operator": "!=", "right": { "type": "Identifier", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "y" - }, + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"y"}, "name": "y" } } diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/168/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/168/output.json index 4e3733ed6b77..910c4ace54af 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/168/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/168/output.json @@ -1,95 +1,27 @@ { "type": "File", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "program": { "type": "Program", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "expression": { "type": "BinaryExpression", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "operator": "===", "right": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "y" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"y"}, "name": "y" } } diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/169/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/169/output.json index d439d193a709..b84db6eff743 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/169/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/169/output.json @@ -1,95 +1,27 @@ { "type": "File", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "program": { "type": "Program", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "expression": { "type": "BinaryExpression", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "operator": "!==", "right": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "y" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"y"}, "name": "y" } } diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/17/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/17/output.json index aa17794200f6..a9cc99268998 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/17/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/17/output.json @@ -1,94 +1,27 @@ { "type": "File", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "program": { "type": "Program", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "expression": { "type": "AssignmentExpression", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "operator": "=", "left": { "type": "Identifier", - "start": 0, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 2 - }, - "identifierName": "T‍" - }, + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2},"identifierName":"T‍"}, "name": "T‍" }, "right": { "type": "ArrayExpression", - "start": 5, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":5,"end":7,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":7}}, "elements": [] } } diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/170/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/170/output.json index 0782650869ea..f2ef76b6efc1 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/170/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/170/output.json @@ -1,95 +1,27 @@ { "type": "File", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "program": { "type": "Program", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "expression": { "type": "BinaryExpression", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "operator": "&", "right": { "type": "Identifier", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "y" - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"y"}, "name": "y" } } diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/171/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/171/output.json index a036d7feee03..d1cc74acf793 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/171/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/171/output.json @@ -1,95 +1,27 @@ { "type": "File", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "program": { "type": "Program", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "expression": { "type": "BinaryExpression", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "operator": "^", "right": { "type": "Identifier", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "y" - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"y"}, "name": "y" } } diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/172/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/172/output.json index 3f0401d051f8..793dc10c6cdc 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/172/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/172/output.json @@ -1,95 +1,27 @@ { "type": "File", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "program": { "type": "Program", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "expression": { "type": "BinaryExpression", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "operator": "|", "right": { "type": "Identifier", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "y" - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"y"}, "name": "y" } } diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/173/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/173/output.json index 12c80600d855..94fc52925207 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/173/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/173/output.json @@ -1,128 +1,37 @@ { "type": "File", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "program": { "type": "Program", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "expression": { "type": "BinaryExpression", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "left": { "type": "BinaryExpression", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "operator": "+", "right": { "type": "Identifier", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "y" - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"y"}, "name": "y" } }, "operator": "+", "right": { "type": "Identifier", - "start": 8, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "z" - }, + "start":8,"end":9,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":9},"identifierName":"z"}, "name": "z" } } diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/174/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/174/output.json index 7a4cb9d5bdbb..12de61e60e78 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/174/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/174/output.json @@ -1,128 +1,37 @@ { "type": "File", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "program": { "type": "Program", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "expression": { "type": "BinaryExpression", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "left": { "type": "BinaryExpression", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "operator": "-", "right": { "type": "Identifier", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "y" - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"y"}, "name": "y" } }, "operator": "+", "right": { "type": "Identifier", - "start": 8, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "z" - }, + "start":8,"end":9,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":9},"identifierName":"z"}, "name": "z" } } diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/175/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/175/output.json index d95f951f8eee..68a6d08d7290 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/175/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/175/output.json @@ -1,128 +1,37 @@ { "type": "File", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "program": { "type": "Program", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "expression": { "type": "BinaryExpression", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "left": { "type": "BinaryExpression", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "operator": "+", "right": { "type": "Identifier", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "y" - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"y"}, "name": "y" } }, "operator": "-", "right": { "type": "Identifier", - "start": 8, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "z" - }, + "start":8,"end":9,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":9},"identifierName":"z"}, "name": "z" } } diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/176/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/176/output.json index 4449ac1fc386..cdaf1460cf29 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/176/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/176/output.json @@ -1,128 +1,37 @@ { "type": "File", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "program": { "type": "Program", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "expression": { "type": "BinaryExpression", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "left": { "type": "BinaryExpression", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "operator": "-", "right": { "type": "Identifier", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "y" - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"y"}, "name": "y" } }, "operator": "-", "right": { "type": "Identifier", - "start": 8, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "z" - }, + "start":8,"end":9,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":9},"identifierName":"z"}, "name": "z" } } diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/177/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/177/output.json index 11b4c83b84f4..5d60fa9a4fc9 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/177/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/177/output.json @@ -1,127 +1,36 @@ { "type": "File", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "program": { "type": "Program", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "expression": { "type": "BinaryExpression", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "operator": "+", "right": { "type": "BinaryExpression", - "start": 4, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":4,"end":9,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":9}}, "left": { "type": "Identifier", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "y" - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"y"}, "name": "y" }, "operator": "*", "right": { "type": "Identifier", - "start": 8, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "z" - }, + "start":8,"end":9,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":9},"identifierName":"z"}, "name": "z" } } diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/178/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/178/output.json index 33ebd32af2c5..cfb1d7d325fa 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/178/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/178/output.json @@ -1,127 +1,36 @@ { "type": "File", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "program": { "type": "Program", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "expression": { "type": "BinaryExpression", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "operator": "+", "right": { "type": "BinaryExpression", - "start": 4, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":4,"end":9,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":9}}, "left": { "type": "Identifier", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "y" - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"y"}, "name": "y" }, "operator": "/", "right": { "type": "Identifier", - "start": 8, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "z" - }, + "start":8,"end":9,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":9},"identifierName":"z"}, "name": "z" } } diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/179/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/179/output.json index c6716f6d5b6c..e4ad518b4942 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/179/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/179/output.json @@ -1,127 +1,36 @@ { "type": "File", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "program": { "type": "Program", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "expression": { "type": "BinaryExpression", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "operator": "-", "right": { "type": "BinaryExpression", - "start": 4, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":4,"end":9,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":9}}, "left": { "type": "Identifier", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "y" - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"y"}, "name": "y" }, "operator": "%", "right": { "type": "Identifier", - "start": 8, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "z" - }, + "start":8,"end":9,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":9},"identifierName":"z"}, "name": "z" } } diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/18/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/18/output.json index 77ed83cfe580..ca44a6f181d3 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/18/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/18/output.json @@ -1,94 +1,27 @@ { "type": "File", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "program": { "type": "Program", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "expression": { "type": "AssignmentExpression", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "operator": "=", "left": { "type": "Identifier", - "start": 0, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 2 - }, - "identifierName": "ⅣⅡ" - }, + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2},"identifierName":"ⅣⅡ"}, "name": "ⅣⅡ" }, "right": { "type": "ArrayExpression", - "start": 5, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":5,"end":7,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":7}}, "elements": [] } } diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/180/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/180/output.json index d7d6a0eb4c0b..c9172b4c0ee0 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/180/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/180/output.json @@ -1,128 +1,37 @@ { "type": "File", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "program": { "type": "Program", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "expression": { "type": "BinaryExpression", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "left": { "type": "BinaryExpression", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "operator": "*", "right": { "type": "Identifier", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "y" - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"y"}, "name": "y" } }, "operator": "*", "right": { "type": "Identifier", - "start": 8, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "z" - }, + "start":8,"end":9,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":9},"identifierName":"z"}, "name": "z" } } diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/181/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/181/output.json index 55536bf01e31..928ebf4c4cc3 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/181/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/181/output.json @@ -1,128 +1,37 @@ { "type": "File", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "program": { "type": "Program", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "expression": { "type": "BinaryExpression", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "left": { "type": "BinaryExpression", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "operator": "*", "right": { "type": "Identifier", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "y" - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"y"}, "name": "y" } }, "operator": "/", "right": { "type": "Identifier", - "start": 8, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "z" - }, + "start":8,"end":9,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":9},"identifierName":"z"}, "name": "z" } } diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/182/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/182/output.json index b0249f734e45..b2def55e6015 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/182/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/182/output.json @@ -1,128 +1,37 @@ { "type": "File", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "program": { "type": "Program", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "expression": { "type": "BinaryExpression", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "left": { "type": "BinaryExpression", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "operator": "*", "right": { "type": "Identifier", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "y" - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"y"}, "name": "y" } }, "operator": "%", "right": { "type": "Identifier", - "start": 8, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "z" - }, + "start":8,"end":9,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":9},"identifierName":"z"}, "name": "z" } } diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/183/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/183/output.json index 42134f8776e6..f135242de7eb 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/183/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/183/output.json @@ -1,128 +1,37 @@ { "type": "File", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "program": { "type": "Program", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "expression": { "type": "BinaryExpression", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "left": { "type": "BinaryExpression", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "operator": "%", "right": { "type": "Identifier", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "y" - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"y"}, "name": "y" } }, "operator": "*", "right": { "type": "Identifier", - "start": 8, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "z" - }, + "start":8,"end":9,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":9},"identifierName":"z"}, "name": "z" } } diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/184/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/184/output.json index 64aa2ad30132..ad23fc9dbb1d 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/184/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/184/output.json @@ -1,128 +1,37 @@ { "type": "File", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "program": { "type": "Program", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "expression": { "type": "BinaryExpression", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "left": { "type": "BinaryExpression", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "operator": "<<", "right": { "type": "Identifier", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "y" - }, + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"y"}, "name": "y" } }, "operator": "<<", "right": { "type": "Identifier", - "start": 10, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "z" - }, + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11},"identifierName":"z"}, "name": "z" } } diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/185/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/185/output.json index 8a205f26f6e5..299c2101fd33 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/185/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/185/output.json @@ -1,128 +1,37 @@ { "type": "File", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "program": { "type": "Program", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "expression": { "type": "BinaryExpression", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "left": { "type": "BinaryExpression", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "operator": "|", "right": { "type": "Identifier", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "y" - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"y"}, "name": "y" } }, "operator": "|", "right": { "type": "Identifier", - "start": 8, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "z" - }, + "start":8,"end":9,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":9},"identifierName":"z"}, "name": "z" } } diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/186/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/186/output.json index 76106e9d4fe9..8450ad8b9769 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/186/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/186/output.json @@ -1,128 +1,37 @@ { "type": "File", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "program": { "type": "Program", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "expression": { "type": "BinaryExpression", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "left": { "type": "BinaryExpression", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "operator": "&", "right": { "type": "Identifier", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "y" - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"y"}, "name": "y" } }, "operator": "&", "right": { "type": "Identifier", - "start": 8, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "z" - }, + "start":8,"end":9,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":9},"identifierName":"z"}, "name": "z" } } diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/187/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/187/output.json index 19599c7b1c08..fb85cecd3e35 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/187/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/187/output.json @@ -1,128 +1,37 @@ { "type": "File", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "program": { "type": "Program", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "expression": { "type": "BinaryExpression", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "left": { "type": "BinaryExpression", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "operator": "^", "right": { "type": "Identifier", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "y" - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"y"}, "name": "y" } }, "operator": "^", "right": { "type": "Identifier", - "start": 8, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "z" - }, + "start":8,"end":9,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":9},"identifierName":"z"}, "name": "z" } } diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/188/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/188/output.json index 9e8b8d3fa8fc..3565086f710d 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/188/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/188/output.json @@ -1,128 +1,37 @@ { "type": "File", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "program": { "type": "Program", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "expression": { "type": "BinaryExpression", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "left": { "type": "BinaryExpression", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "operator": "&", "right": { "type": "Identifier", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "y" - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"y"}, "name": "y" } }, "operator": "|", "right": { "type": "Identifier", - "start": 8, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "z" - }, + "start":8,"end":9,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":9},"identifierName":"z"}, "name": "z" } } diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/189/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/189/output.json index c7661fa85d28..9d88d7ba1cc3 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/189/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/189/output.json @@ -1,127 +1,36 @@ { "type": "File", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "program": { "type": "Program", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "expression": { "type": "BinaryExpression", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "operator": "|", "right": { "type": "BinaryExpression", - "start": 4, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":4,"end":9,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":9}}, "left": { "type": "Identifier", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "y" - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"y"}, "name": "y" }, "operator": "^", "right": { "type": "Identifier", - "start": 8, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "z" - }, + "start":8,"end":9,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":9},"identifierName":"z"}, "name": "z" } } diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/19/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/19/output.json index 77ed83cfe580..ca44a6f181d3 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/19/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/19/output.json @@ -1,94 +1,27 @@ { "type": "File", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "program": { "type": "Program", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "expression": { "type": "AssignmentExpression", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "operator": "=", "left": { "type": "Identifier", - "start": 0, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 2 - }, - "identifierName": "ⅣⅡ" - }, + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2},"identifierName":"ⅣⅡ"}, "name": "ⅣⅡ" }, "right": { "type": "ArrayExpression", - "start": 5, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":5,"end":7,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":7}}, "elements": [] } } diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/190/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/190/output.json index fcccd1684f80..ba82d25b8771 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/190/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/190/output.json @@ -1,127 +1,36 @@ { "type": "File", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "program": { "type": "Program", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "expression": { "type": "BinaryExpression", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "operator": "|", "right": { "type": "BinaryExpression", - "start": 4, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":4,"end":9,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":9}}, "left": { "type": "Identifier", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "y" - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"y"}, "name": "y" }, "operator": "&", "right": { "type": "Identifier", - "start": 8, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "z" - }, + "start":8,"end":9,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":9},"identifierName":"z"}, "name": "z" } } diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/191/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/191/output.json index ab60eb5ab717..b9a75b550b6f 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/191/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/191/output.json @@ -1,95 +1,27 @@ { "type": "File", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "program": { "type": "Program", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "expression": { "type": "LogicalExpression", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "operator": "||", "right": { "type": "Identifier", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "y" - }, + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"y"}, "name": "y" } } diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/192/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/192/output.json index beb961a6f029..156e6398fd75 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/192/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/192/output.json @@ -1,95 +1,27 @@ { "type": "File", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "program": { "type": "Program", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "expression": { "type": "LogicalExpression", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "operator": "&&", "right": { "type": "Identifier", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "y" - }, + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"y"}, "name": "y" } } diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/193/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/193/output.json index c2de2c5ec37c..0ece3ff33ff3 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/193/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/193/output.json @@ -1,128 +1,37 @@ { "type": "File", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "program": { "type": "Program", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "expression": { "type": "LogicalExpression", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "left": { "type": "LogicalExpression", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "operator": "||", "right": { "type": "Identifier", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "y" - }, + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"y"}, "name": "y" } }, "operator": "||", "right": { "type": "Identifier", - "start": 10, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "z" - }, + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11},"identifierName":"z"}, "name": "z" } } diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/194/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/194/output.json index 8ef39b3fcd2e..ea8daaf85fb0 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/194/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/194/output.json @@ -1,128 +1,37 @@ { "type": "File", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "program": { "type": "Program", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "expression": { "type": "LogicalExpression", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "left": { "type": "LogicalExpression", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "operator": "&&", "right": { "type": "Identifier", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "y" - }, + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"y"}, "name": "y" } }, "operator": "&&", "right": { "type": "Identifier", - "start": 10, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "z" - }, + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11},"identifierName":"z"}, "name": "z" } } diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/195/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/195/output.json index c75389bc6cc9..776f47eea15c 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/195/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/195/output.json @@ -1,127 +1,36 @@ { "type": "File", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "program": { "type": "Program", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "expression": { "type": "LogicalExpression", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "operator": "||", "right": { "type": "LogicalExpression", - "start": 5, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":5,"end":11,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":11}}, "left": { "type": "Identifier", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "y" - }, + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"y"}, "name": "y" }, "operator": "&&", "right": { "type": "Identifier", - "start": 10, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "z" - }, + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11},"identifierName":"z"}, "name": "z" } } diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/196/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/196/output.json index 0d49dfa5a763..29d1920ab76c 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/196/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/196/output.json @@ -1,127 +1,36 @@ { "type": "File", - "start": 0, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, "program": { "type": "Program", - "start": 0, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, "expression": { "type": "LogicalExpression", - "start": 0, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "operator": "||", "right": { "type": "BinaryExpression", - "start": 5, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":5,"end":10,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":10}}, "left": { "type": "Identifier", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "y" - }, + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"y"}, "name": "y" }, "operator": "^", "right": { "type": "Identifier", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - }, - "identifierName": "z" - }, + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"z"}, "name": "z" } } diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/197/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/197/output.json index 9256d55782d5..6bd9c8a48889 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/197/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/197/output.json @@ -1,93 +1,26 @@ { "type": "File", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "program": { "type": "Program", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "expression": { "type": "ConditionalExpression", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "test": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "y" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"y"}, "name": "y" }, "consequent": { "type": "NumericLiteral", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5}}, "extra": { "rawValue": 1, "raw": "1" @@ -96,18 +29,7 @@ }, "alternate": { "type": "NumericLiteral", - "start": 8, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":8,"end":9,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":9}}, "extra": { "rawValue": 2, "raw": "2" diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/198/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/198/output.json index 78cba5d9924b..73ed52c6a7f5 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/198/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/198/output.json @@ -1,126 +1,36 @@ { "type": "File", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "program": { "type": "Program", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "expression": { "type": "ConditionalExpression", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "test": { "type": "LogicalExpression", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "operator": "&&", "right": { "type": "Identifier", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "y" - }, + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"y"}, "name": "y" } }, "consequent": { "type": "NumericLiteral", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10}}, "extra": { "rawValue": 1, "raw": "1" @@ -129,18 +39,7 @@ }, "alternate": { "type": "NumericLiteral", - "start": 13, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":13,"end":14,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":14}}, "extra": { "rawValue": 2, "raw": "2" diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/199/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/199/output.json index a5a52c1e2db0..53a8bda384b8 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/199/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/199/output.json @@ -1,94 +1,27 @@ { "type": "File", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "program": { "type": "Program", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "expression": { "type": "AssignmentExpression", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "operator": "=", "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "right": { "type": "NumericLiteral", - "start": 4, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":4,"end":6,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":6}}, "extra": { "rawValue": 42, "raw": "42" diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/2/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/2/output.json index 3d18314470cd..4bb0f76377fd 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/2/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/2/output.json @@ -1,62 +1,18 @@ { "type": "File", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - }, + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, "program": { "type": "Program", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - }, + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - }, + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, "expression": { "type": "NullLiteral", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - } + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}} } } ], diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/20/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/20/output.json index ace60cd560f2..b3d6b552a8ff 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/20/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/20/output.json @@ -1,94 +1,27 @@ { "type": "File", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "program": { "type": "Program", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "expression": { "type": "AssignmentExpression", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "operator": "=", "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "right": { "type": "ObjectExpression", - "start": 4, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":4,"end":6,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":6}}, "properties": [] } } diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/200/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/200/output.json index e1363b4f98c6..09238f85c9f7 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/200/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/200/output.json @@ -1,94 +1,27 @@ { "type": "File", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "program": { "type": "Program", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "expression": { "type": "AssignmentExpression", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "operator": "=", "left": { "type": "Identifier", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - }, - "identifierName": "eval" - }, + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4},"identifierName":"eval"}, "name": "eval" }, "right": { "type": "NumericLiteral", - "start": 7, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":7,"end":9,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":9}}, "extra": { "rawValue": 42, "raw": "42" diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/201/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/201/output.json index 9ced89e22512..45ca46801c09 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/201/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/201/output.json @@ -1,94 +1,27 @@ { "type": "File", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "program": { "type": "Program", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "expression": { "type": "AssignmentExpression", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "operator": "=", "left": { "type": "Identifier", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "arguments" - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9},"identifierName":"arguments"}, "name": "arguments" }, "right": { "type": "NumericLiteral", - "start": 12, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":12,"end":14,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":14}}, "extra": { "rawValue": 42, "raw": "42" diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/202/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/202/output.json index 4c6da633f927..4305f9c34d31 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/202/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/202/output.json @@ -1,94 +1,27 @@ { "type": "File", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "program": { "type": "Program", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "expression": { "type": "AssignmentExpression", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "operator": "*=", "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "right": { "type": "NumericLiteral", - "start": 5, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":5,"end":7,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":7}}, "extra": { "rawValue": 42, "raw": "42" diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/203/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/203/output.json index 2ae61364283d..ed4728f171eb 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/203/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/203/output.json @@ -1,94 +1,27 @@ { "type": "File", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "program": { "type": "Program", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "expression": { "type": "AssignmentExpression", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "operator": "/=", "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "right": { "type": "NumericLiteral", - "start": 5, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":5,"end":7,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":7}}, "extra": { "rawValue": 42, "raw": "42" diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/204/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/204/output.json index 62a87b6a4927..c3f3df7e5f5b 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/204/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/204/output.json @@ -1,94 +1,27 @@ { "type": "File", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "program": { "type": "Program", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "expression": { "type": "AssignmentExpression", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "operator": "%=", "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "right": { "type": "NumericLiteral", - "start": 5, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":5,"end":7,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":7}}, "extra": { "rawValue": 42, "raw": "42" diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/205/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/205/output.json index 987e2eb78524..2ccf078c9d9f 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/205/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/205/output.json @@ -1,94 +1,27 @@ { "type": "File", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "program": { "type": "Program", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "expression": { "type": "AssignmentExpression", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "operator": "+=", "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "right": { "type": "NumericLiteral", - "start": 5, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":5,"end":7,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":7}}, "extra": { "rawValue": 42, "raw": "42" diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/206/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/206/output.json index 077c01c70177..2ba631424d4b 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/206/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/206/output.json @@ -1,94 +1,27 @@ { "type": "File", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "program": { "type": "Program", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "expression": { "type": "AssignmentExpression", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "operator": "-=", "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "right": { "type": "NumericLiteral", - "start": 5, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":5,"end":7,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":7}}, "extra": { "rawValue": 42, "raw": "42" diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/207/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/207/output.json index 9fc98d2128b3..5d0d19837127 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/207/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/207/output.json @@ -1,94 +1,27 @@ { "type": "File", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, "program": { "type": "Program", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, "expression": { "type": "AssignmentExpression", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, "operator": "<<=", "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "right": { "type": "NumericLiteral", - "start": 6, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":6,"end":8,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":8}}, "extra": { "rawValue": 42, "raw": "42" diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/208/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/208/output.json index 6cefd83e3214..320ab232013c 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/208/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/208/output.json @@ -1,94 +1,27 @@ { "type": "File", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, "program": { "type": "Program", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, "expression": { "type": "AssignmentExpression", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, "operator": ">>=", "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "right": { "type": "NumericLiteral", - "start": 6, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":6,"end":8,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":8}}, "extra": { "rawValue": 42, "raw": "42" diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/209/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/209/output.json index c12350d6a4bf..9c04a76a8e7b 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/209/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/209/output.json @@ -1,94 +1,27 @@ { "type": "File", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "program": { "type": "Program", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "expression": { "type": "AssignmentExpression", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "operator": ">>>=", "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "right": { "type": "NumericLiteral", - "start": 7, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":7,"end":9,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":9}}, "extra": { "rawValue": 42, "raw": "42" diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/21/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/21/output.json index 475c1afc13f2..dd1feb7b3371 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/21/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/21/output.json @@ -1,94 +1,27 @@ { "type": "File", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "program": { "type": "Program", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "expression": { "type": "AssignmentExpression", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "operator": "=", "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "right": { "type": "ObjectExpression", - "start": 4, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":4,"end":7,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":7}}, "properties": [] } } diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/210/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/210/output.json index f97a88dd993a..b35bbd4d76be 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/210/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/210/output.json @@ -1,94 +1,27 @@ { "type": "File", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "program": { "type": "Program", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "expression": { "type": "AssignmentExpression", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "operator": "&=", "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "right": { "type": "NumericLiteral", - "start": 5, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":5,"end":7,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":7}}, "extra": { "rawValue": 42, "raw": "42" diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/211/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/211/output.json index f12219cdff51..cf0974cabc31 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/211/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/211/output.json @@ -1,94 +1,27 @@ { "type": "File", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "program": { "type": "Program", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "expression": { "type": "AssignmentExpression", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "operator": "^=", "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "right": { "type": "NumericLiteral", - "start": 5, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":5,"end":7,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":7}}, "extra": { "rawValue": 42, "raw": "42" diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/212/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/212/output.json index d29652f48f6c..61416582674e 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/212/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/212/output.json @@ -1,94 +1,27 @@ { "type": "File", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "program": { "type": "Program", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "expression": { "type": "AssignmentExpression", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "operator": "|=", "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "right": { "type": "NumericLiteral", - "start": 5, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":5,"end":7,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":7}}, "extra": { "rawValue": 42, "raw": "42" diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/213/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/213/output.json index 598c96a56b18..c606339577fd 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/213/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/213/output.json @@ -1,78 +1,22 @@ { "type": "File", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "program": { "type": "Program", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "BlockStatement", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "body": [ { "type": "ExpressionStatement", - "start": 2, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":2,"end":5,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":5}}, "expression": { "type": "Identifier", - "start": 2, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "foo" - }, + "start":2,"end":5,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":5},"identifierName":"foo"}, "name": "foo" } } diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/214/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/214/output.json index 9eed13dbf1f6..61bba56429a6 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/214/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/214/output.json @@ -1,92 +1,25 @@ { "type": "File", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "program": { "type": "Program", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "BlockStatement", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "body": [ { "type": "ExpressionStatement", - "start": 2, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":2,"end":11,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":11}}, "expression": { "type": "CallExpression", - "start": 2, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":2,"end":10,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":10}}, "callee": { "type": "Identifier", - "start": 2, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 8 - }, - "identifierName": "doThis" - }, + "start":2,"end":8,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":8},"identifierName":"doThis"}, "name": "doThis" }, "arguments": [] @@ -94,47 +27,13 @@ }, { "type": "ExpressionStatement", - "start": 12, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":12,"end":21,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":21}}, "expression": { "type": "CallExpression", - "start": 12, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":12,"end":20,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":20}}, "callee": { "type": "Identifier", - "start": 12, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 18 - }, - "identifierName": "doThat" - }, + "start":12,"end":18,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":18},"identifierName":"doThat"}, "name": "doThat" }, "arguments": [] diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/215/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/215/output.json index 9c65b7b8cb98..b2560defc565 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/215/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/215/output.json @@ -1,48 +1,15 @@ { "type": "File", - "start": 0, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 2 - } - }, + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}}, "program": { "type": "Program", - "start": 0, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 2 - } - }, + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "BlockStatement", - "start": 0, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 2 - } - }, + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/216/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/216/output.json index c2d1aa9e8258..1fad75e9a989 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/216/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/216/output.json @@ -1,78 +1,22 @@ { "type": "File", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "program": { "type": "Program", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5}}, "id": { "type": "Identifier", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "x" - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"x"}, "name": "x" }, "init": null diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/217/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/217/output.json index 2292f444ff6d..765527f7771e 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/217/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/217/output.json @@ -1,111 +1,32 @@ { "type": "File", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "program": { "type": "Program", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5}}, "id": { "type": "Identifier", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "x" - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"x"}, "name": "x" }, "init": null }, { "type": "VariableDeclarator", - "start": 7, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8}}, "id": { "type": "Identifier", - "start": 7, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - }, - "identifierName": "y" - }, + "start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8},"identifierName":"y"}, "name": "y" }, "init": null diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/218/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/218/output.json index 338b1ef14f8b..26d684ab89aa 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/218/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/218/output.json @@ -1,94 +1,27 @@ { "type": "File", - "start": 0, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, "program": { "type": "Program", - "start": 0, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":4,"end":10,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":10}}, "id": { "type": "Identifier", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "x" - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"x"}, "name": "x" }, "init": { "type": "NumericLiteral", - "start": 8, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":8,"end":10,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":10}}, "extra": { "rawValue": 42, "raw": "42" diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/219/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/219/output.json index 64faa9a0c09c..46dc4683a1c6 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/219/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/219/output.json @@ -1,94 +1,27 @@ { "type": "File", - "start": 0, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, "program": { "type": "Program", - "start": 0, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":4,"end":13,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":13}}, "id": { "type": "Identifier", - "start": 4, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 8 - }, - "identifierName": "eval" - }, + "start":4,"end":8,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":8},"identifierName":"eval"}, "name": "eval" }, "init": { "type": "NumericLiteral", - "start": 11, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":11,"end":13,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":13}}, "extra": { "rawValue": 42, "raw": "42" @@ -98,49 +31,15 @@ }, { "type": "VariableDeclarator", - "start": 15, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":15,"end":29,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":29}}, "id": { "type": "Identifier", - "start": 15, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 24 - }, - "identifierName": "arguments" - }, + "start":15,"end":24,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":24},"identifierName":"arguments"}, "name": "arguments" }, "init": { "type": "NumericLiteral", - "start": 27, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":27,"end":29,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":29}}, "extra": { "rawValue": 42, "raw": "42" diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/22/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/22/output.json index 245feff142cc..e7d5402c9273 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/22/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/22/output.json @@ -1,143 +1,42 @@ { "type": "File", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, "program": { "type": "Program", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, "expression": { "type": "AssignmentExpression", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, "operator": "=", "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "right": { "type": "ObjectExpression", - "start": 4, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":4,"end":18,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":18}}, "properties": [ { "type": "ObjectProperty", - "start": 6, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":6,"end":16,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":16}}, "method": false, "key": { "type": "Identifier", - "start": 6, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "answer" - }, + "start":6,"end":12,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":12},"identifierName":"answer"}, "name": "answer" }, "computed": false, "shorthand": false, "value": { "type": "NumericLiteral", - "start": 14, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":14,"end":16,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":16}}, "extra": { "rawValue": 42, "raw": "42" diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/220/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/220/output.json index cb147f686b55..bdc2834bafdc 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/220/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/220/output.json @@ -1,94 +1,27 @@ { "type": "File", - "start": 0, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, "program": { "type": "Program", - "start": 0, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":4,"end":10,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":10}}, "id": { "type": "Identifier", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "x" - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"x"}, "name": "x" }, "init": { "type": "NumericLiteral", - "start": 8, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":8,"end":10,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":10}}, "extra": { "rawValue": 14, "raw": "14" @@ -98,49 +31,15 @@ }, { "type": "VariableDeclarator", - "start": 12, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":12,"end":17,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":17}}, "id": { "type": "Identifier", - "start": 12, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - }, - "identifierName": "y" - }, + "start":12,"end":13,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":13},"identifierName":"y"}, "name": "y" }, "init": { "type": "NumericLiteral", - "start": 16, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":16,"end":17,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":17}}, "extra": { "rawValue": 3, "raw": "3" @@ -150,49 +49,15 @@ }, { "type": "VariableDeclarator", - "start": 19, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":19,"end":27,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":27}}, "id": { "type": "Identifier", - "start": 19, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 20 - }, - "identifierName": "z" - }, + "start":19,"end":20,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":20},"identifierName":"z"}, "name": "z" }, "init": { "type": "NumericLiteral", - "start": 23, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":23,"end":27,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":27}}, "extra": { "rawValue": 1977, "raw": "1977" diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/221/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/221/output.json index d6d6794fe5b6..1c191ef723d7 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/221/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/221/output.json @@ -1,144 +1,42 @@ { "type": "File", - "start": 0, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, "program": { "type": "Program", - "start": 0, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":4,"end":14,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":14}}, "id": { "type": "Identifier", - "start": 4, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 14 - }, - "identifierName": "implements" - }, + "start":4,"end":14,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":14},"identifierName":"implements"}, "name": "implements" }, "init": null }, { "type": "VariableDeclarator", - "start": 16, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":16,"end":25,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":25}}, "id": { "type": "Identifier", - "start": 16, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 25 - }, - "identifierName": "interface" - }, + "start":16,"end":25,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":25},"identifierName":"interface"}, "name": "interface" }, "init": null }, { "type": "VariableDeclarator", - "start": 27, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":27,"end":34,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":34}}, "id": { "type": "Identifier", - "start": 27, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 34 - }, - "identifierName": "package" - }, + "start":27,"end":34,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":34},"identifierName":"package"}, "name": "package" }, "init": null diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/222/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/222/output.json index 4b8305ce1e0f..8a4c16c4b1cf 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/222/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/222/output.json @@ -1,177 +1,52 @@ { "type": "File", - "start": 0, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":38}}, "program": { "type": "Program", - "start": 0, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":38}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":38}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":4,"end":11,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":11}}, "id": { "type": "Identifier", - "start": 4, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "private" - }, + "start":4,"end":11,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":11},"identifierName":"private"}, "name": "private" }, "init": null }, { "type": "VariableDeclarator", - "start": 13, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":13,"end":22,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":22}}, "id": { "type": "Identifier", - "start": 13, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 22 - }, - "identifierName": "protected" - }, + "start":13,"end":22,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":22},"identifierName":"protected"}, "name": "protected" }, "init": null }, { "type": "VariableDeclarator", - "start": 24, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":24,"end":30,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":30}}, "id": { "type": "Identifier", - "start": 24, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 30 - }, - "identifierName": "public" - }, + "start":24,"end":30,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":30},"identifierName":"public"}, "name": "public" }, "init": null }, { "type": "VariableDeclarator", - "start": 32, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 32 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":32,"end":38,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":38}}, "id": { "type": "Identifier", - "start": 32, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 32 - }, - "end": { - "line": 1, - "column": 38 - }, - "identifierName": "static" - }, + "start":32,"end":38,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":38},"identifierName":"static"}, "name": "static" }, "init": null diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/223/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/223/output.json index 1c109c350cb6..1056212c976e 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/223/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/223/output.json @@ -1,48 +1,15 @@ { "type": "File", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "EmptyStatement", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - } + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1}} } ], "directives": [] diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/224/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/224/output.json index 46cd57504eba..8bb741bae2e4 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/224/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/224/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1}}, "expression": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" } } diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/225/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/225/output.json index 769e912a7e65..c6a529bc13c7 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/225/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/225/output.json @@ -1,95 +1,27 @@ { "type": "File", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - }, + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, "program": { "type": "Program", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - }, + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - }, + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, "expression": { "type": "SequenceExpression", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - }, + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, "expressions": [ { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, { "type": "Identifier", - "start": 3, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 4 - }, - "identifierName": "y" - }, + "start":3,"end":4,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":4},"identifierName":"y"}, "name": "y" } ] diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/226/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/226/output.json index db7aee01cc0c..54266dae6d5b 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/226/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/226/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "program": { "type": "Program", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "expression": { "type": "Identifier", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "a" - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6},"identifierName":"a"}, "name": "a" } } diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/227/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/227/output.json index 8f9a8687f6db..9636de19413e 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/227/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/227/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "program": { "type": "Program", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "expression": { "type": "Identifier", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "aa" - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7},"identifierName":"aa"}, "name": "aa" } } diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/228/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/228/output.json index 078b39d33a01..7dcb2358b5cc 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/228/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/228/output.json @@ -1,108 +1,29 @@ { "type": "File", - "start": 0, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, "program": { "type": "Program", - "start": 0, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "IfStatement", - "start": 0, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, "test": { "type": "Identifier", - "start": 4, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "morning" - }, + "start":4,"end":11,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":11},"identifierName":"morning"}, "name": "morning" }, "consequent": { "type": "ExpressionStatement", - "start": 13, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":13,"end":26,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":26}}, "expression": { "type": "CallExpression", - "start": 13, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":13,"end":26,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":26}}, "callee": { "type": "Identifier", - "start": 13, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 24 - }, - "identifierName": "goodMorning" - }, + "start":13,"end":24,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":24},"identifierName":"goodMorning"}, "name": "goodMorning" }, "arguments": [] diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/229/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/229/output.json index 46b9ab0f4ad1..cfe4ca1e2622 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/229/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/229/output.json @@ -1,111 +1,33 @@ { "type": "File", - "start": 0, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, "program": { "type": "Program", - "start": 0, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "IfStatement", - "start": 0, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, "test": { "type": "Identifier", - "start": 4, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "morning" - }, + "start":4,"end":11,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":11},"identifierName":"morning"}, "name": "morning" }, "consequent": { "type": "ExpressionStatement", - "start": 13, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":13,"end":27,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":27}}, "expression": { "type": "FunctionExpression", - "start": 14, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":14,"end":26,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":26}}, "id": null, "generator": false, "async": false, "params": [], "body": { "type": "BlockStatement", - "start": 24, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":24,"end":26,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":26}}, "body": [], "directives": [] }, diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/23/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/23/output.json index 87c6c0164063..934336937dcf 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/23/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/23/output.json @@ -1,143 +1,42 @@ { "type": "File", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "program": { "type": "Program", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "expression": { "type": "AssignmentExpression", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "operator": "=", "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "right": { "type": "ObjectExpression", - "start": 4, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":4,"end":14,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":14}}, "properties": [ { "type": "ObjectProperty", - "start": 6, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":6,"end":12,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":12}}, "method": false, "key": { "type": "Identifier", - "start": 6, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 8 - }, - "identifierName": "if" - }, + "start":6,"end":8,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":8},"identifierName":"if"}, "name": "if" }, "computed": false, "shorthand": false, "value": { "type": "NumericLiteral", - "start": 10, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":10,"end":12,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":12}}, "extra": { "rawValue": 42, "raw": "42" diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/230/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/230/output.json index d2e4bb70135c..3fb7587ba6e7 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/230/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/230/output.json @@ -1,125 +1,35 @@ { "type": "File", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "program": { "type": "Program", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "IfStatement", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "test": { "type": "Identifier", - "start": 4, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "morning" - }, + "start":4,"end":11,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":11},"identifierName":"morning"}, "name": "morning" }, "consequent": { "type": "VariableDeclaration", - "start": 13, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":13,"end":23,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":23}}, "declarations": [ { "type": "VariableDeclarator", - "start": 17, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":17,"end":22,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":22}}, "id": { "type": "Identifier", - "start": 17, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - }, - "identifierName": "x" - }, + "start":17,"end":18,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":18},"identifierName":"x"}, "name": "x" }, "init": { "type": "NumericLiteral", - "start": 21, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":21,"end":22,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":22}}, "extra": { "rawValue": 0, "raw": "0" diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/231/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/231/output.json index 3a5f512ccc9e..37986cf13198 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/231/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/231/output.json @@ -1,108 +1,29 @@ { "type": "File", - "start": 0, - "end": 42, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 42 - } - }, + "start":0,"end":42,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":42}}, "program": { "type": "Program", - "start": 0, - "end": 42, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 42 - } - }, + "start":0,"end":42,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":42}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "IfStatement", - "start": 0, - "end": 42, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 42 - } - }, + "start":0,"end":42,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":42}}, "test": { "type": "Identifier", - "start": 4, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "morning" - }, + "start":4,"end":11,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":11},"identifierName":"morning"}, "name": "morning" }, "consequent": { "type": "ExpressionStatement", - "start": 13, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":13,"end":27,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":27}}, "expression": { "type": "CallExpression", - "start": 13, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":13,"end":26,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":26}}, "callee": { "type": "Identifier", - "start": 13, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 24 - }, - "identifierName": "goodMorning" - }, + "start":13,"end":24,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":24},"identifierName":"goodMorning"}, "name": "goodMorning" }, "arguments": [] @@ -110,47 +31,13 @@ }, "alternate": { "type": "ExpressionStatement", - "start": 33, - "end": 42, - "loc": { - "start": { - "line": 1, - "column": 33 - }, - "end": { - "line": 1, - "column": 42 - } - }, + "start":33,"end":42,"loc":{"start":{"line":1,"column":33},"end":{"line":1,"column":42}}, "expression": { "type": "CallExpression", - "start": 33, - "end": 42, - "loc": { - "start": { - "line": 1, - "column": 33 - }, - "end": { - "line": 1, - "column": 42 - } - }, + "start":33,"end":42,"loc":{"start":{"line":1,"column":33},"end":{"line":1,"column":42}}, "callee": { "type": "Identifier", - "start": 33, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 33 - }, - "end": { - "line": 1, - "column": 40 - }, - "identifierName": "goodDay" - }, + "start":33,"end":40,"loc":{"start":{"line":1,"column":33},"end":{"line":1,"column":40},"identifierName":"goodDay"}, "name": "goodDay" }, "arguments": [] diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/232/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/232/output.json index ea8f8f1ee102..17cddefa31e3 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/232/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/232/output.json @@ -1,91 +1,24 @@ { "type": "File", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "program": { "type": "Program", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "DoWhileStatement", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "body": { "type": "ExpressionStatement", - "start": 3, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":3,"end":10,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":10}}, "expression": { "type": "CallExpression", - "start": 3, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":3,"end":9,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":9}}, "callee": { "type": "Identifier", - "start": 3, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "keep" - }, + "start":3,"end":7,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":7},"identifierName":"keep"}, "name": "keep" }, "arguments": [] @@ -93,18 +26,7 @@ }, "test": { "type": "BooleanLiteral", - "start": 18, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":18,"end":22,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":22}}, "value": true } } diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/233/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/233/output.json index 58dc5fcc7b7d..8328102958a2 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/233/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/233/output.json @@ -1,91 +1,24 @@ { "type": "File", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "program": { "type": "Program", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "DoWhileStatement", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "body": { "type": "ExpressionStatement", - "start": 3, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":3,"end":10,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":10}}, "expression": { "type": "CallExpression", - "start": 3, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":3,"end":9,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":9}}, "callee": { "type": "Identifier", - "start": 3, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "keep" - }, + "start":3,"end":7,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":7},"identifierName":"keep"}, "name": "keep" }, "arguments": [] @@ -93,18 +26,7 @@ }, "test": { "type": "BooleanLiteral", - "start": 18, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":18,"end":22,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":22}}, "value": true } } diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/234/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/234/output.json index 2dc7a4b042c4..0d0752b80600 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/234/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/234/output.json @@ -1,157 +1,45 @@ { "type": "File", - "start": 0, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, "program": { "type": "Program", - "start": 0, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "DoWhileStatement", - "start": 0, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, "body": { "type": "BlockStatement", - "start": 3, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":3,"end":16,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":16}}, "body": [ { "type": "ExpressionStatement", - "start": 5, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":5,"end":9,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":9}}, "expression": { "type": "UpdateExpression", - "start": 5, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":5,"end":8,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":8}}, "operator": "++", "prefix": false, "argument": { "type": "Identifier", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "x" - }, + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"x"}, "name": "x" } } }, { "type": "ExpressionStatement", - "start": 10, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":10,"end":14,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":14}}, "expression": { "type": "UpdateExpression", - "start": 10, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":10,"end":13,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":13}}, "operator": "--", "prefix": false, "argument": { "type": "Identifier", - "start": 10, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "y" - }, + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11},"identifierName":"y"}, "name": "y" } } @@ -161,50 +49,16 @@ }, "test": { "type": "BinaryExpression", - "start": 24, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":24,"end":30,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":30}}, "left": { "type": "Identifier", - "start": 24, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 25 - }, - "identifierName": "x" - }, + "start":24,"end":25,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":25},"identifierName":"x"}, "name": "x" }, "operator": "<", "right": { "type": "NumericLiteral", - "start": 28, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":28,"end":30,"loc":{"start":{"line":1,"column":28},"end":{"line":1,"column":30}}, "extra": { "rawValue": 10, "raw": "10" diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/235/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/235/output.json index 78775d7e092e..e9a09cf01ba9 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/235/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/235/output.json @@ -1,125 +1,37 @@ { "type": "File", - "start": 0, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, "program": { "type": "Program", - "start": 0, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "BlockStatement", - "start": 0, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, "body": [ { "type": "DoWhileStatement", - "start": 2, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":2,"end":23,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":23}}, "body": { "type": "BlockStatement", - "start": 5, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":5,"end":8,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":8}}, "body": [], "directives": [] }, "test": { "type": "BooleanLiteral", - "start": 16, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":16,"end":21,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":21}}, "value": false } }, { "type": "ExpressionStatement", - "start": 23, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":23,"end":28,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":28}}, "expression": { "type": "BooleanLiteral", - "start": 23, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":23,"end":28,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":28}}, "value": false } } diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/236/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/236/output.json index 4f0b42bf91b2..14379aca37aa 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/236/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/236/output.json @@ -1,107 +1,29 @@ { "type": "File", - "start": 0, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, "program": { "type": "Program", - "start": 0, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "WhileStatement", - "start": 0, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, "test": { "type": "BooleanLiteral", - "start": 7, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":7,"end":11,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":11}}, "value": true }, "body": { "type": "ExpressionStatement", - "start": 13, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":13,"end":26,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":26}}, "expression": { "type": "CallExpression", - "start": 13, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":13,"end":26,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":26}}, "callee": { "type": "Identifier", - "start": 13, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 24 - }, - "identifierName": "doSomething" - }, + "start":13,"end":24,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":24},"identifierName":"doSomething"}, "name": "doSomething" }, "arguments": [] diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/237/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/237/output.json index cab2b6c2898a..855a078a1e41 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/237/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/237/output.json @@ -1,94 +1,27 @@ { "type": "File", - "start": 0, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, "program": { "type": "Program", - "start": 0, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "WhileStatement", - "start": 0, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, "test": { "type": "BinaryExpression", - "start": 7, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":7,"end":13,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":13}}, "left": { "type": "Identifier", - "start": 7, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - }, - "identifierName": "x" - }, + "start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8},"identifierName":"x"}, "name": "x" }, "operator": "<", "right": { "type": "NumericLiteral", - "start": 11, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":11,"end":13,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":13}}, "extra": { "rawValue": 10, "raw": "10" @@ -98,113 +31,34 @@ }, "body": { "type": "BlockStatement", - "start": 15, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":15,"end":28,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":28}}, "body": [ { "type": "ExpressionStatement", - "start": 17, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":17,"end":21,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":21}}, "expression": { "type": "UpdateExpression", - "start": 17, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":17,"end":20,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":20}}, "operator": "++", "prefix": false, "argument": { "type": "Identifier", - "start": 17, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - }, - "identifierName": "x" - }, + "start":17,"end":18,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":18},"identifierName":"x"}, "name": "x" } } }, { "type": "ExpressionStatement", - "start": 22, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":22,"end":26,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":26}}, "expression": { "type": "UpdateExpression", - "start": 22, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":22,"end":25,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":25}}, "operator": "--", "prefix": false, "argument": { "type": "Identifier", - "start": 22, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 23 - }, - "identifierName": "y" - }, + "start":22,"end":23,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":23},"identifierName":"y"}, "name": "y" } } diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/238/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/238/output.json index ef81cf2ef043..2e3d9f6a4377 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/238/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/238/output.json @@ -1,65 +1,21 @@ { "type": "File", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, "program": { "type": "Program", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ForStatement", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, "init": null, "test": null, "update": null, "body": { "type": "EmptyStatement", - "start": 7, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - } + "start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8}} } } ], diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/239/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/239/output.json index eca6e822f6e2..4b8a7f23f0ca 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/239/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/239/output.json @@ -1,65 +1,21 @@ { "type": "File", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "program": { "type": "Program", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ForStatement", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "init": null, "test": null, "update": null, "body": { "type": "BlockStatement", - "start": 7, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":7,"end":9,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":9}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/24/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/24/output.json index 3a19ed468dc6..923dff08f3d6 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/24/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/24/output.json @@ -1,143 +1,42 @@ { "type": "File", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "program": { "type": "Program", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "expression": { "type": "AssignmentExpression", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "operator": "=", "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "right": { "type": "ObjectExpression", - "start": 4, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":4,"end":16,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":16}}, "properties": [ { "type": "ObjectProperty", - "start": 6, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":6,"end":14,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":14}}, "method": false, "key": { "type": "Identifier", - "start": 6, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 10 - }, - "identifierName": "true" - }, + "start":6,"end":10,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":10},"identifierName":"true"}, "name": "true" }, "computed": false, "shorthand": false, "value": { "type": "NumericLiteral", - "start": 12, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":12,"end":14,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":14}}, "extra": { "rawValue": 42, "raw": "42" diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/240/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/240/output.json index 087317911d2f..dbc5316223f1 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/240/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/240/output.json @@ -1,94 +1,27 @@ { "type": "File", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "program": { "type": "Program", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ForStatement", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "init": { "type": "AssignmentExpression", - "start": 4, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":4,"end":9,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":9}}, "operator": "=", "left": { "type": "Identifier", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "x" - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"x"}, "name": "x" }, "right": { "type": "NumericLiteral", - "start": 8, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":8,"end":9,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":9}}, "extra": { "rawValue": 0, "raw": "0" @@ -100,18 +33,7 @@ "update": null, "body": { "type": "EmptyStatement", - "start": 12, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - } + "start":12,"end":13,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":13}} } } ], diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/241/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/241/output.json index aa78dd8a115f..c66442c43c18 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/241/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/241/output.json @@ -1,108 +1,30 @@ { "type": "File", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "program": { "type": "Program", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ForStatement", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "init": { "type": "VariableDeclaration", - "start": 4, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":4,"end":13,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":13}}, "declarations": [ { "type": "VariableDeclarator", - "start": 8, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":8,"end":13,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":13}}, "id": { "type": "Identifier", - "start": 8, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "x" - }, + "start":8,"end":9,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":9},"identifierName":"x"}, "name": "x" }, "init": { "type": "NumericLiteral", - "start": 12, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":12,"end":13,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":13}}, "extra": { "rawValue": 0, "raw": "0" @@ -117,18 +39,7 @@ "update": null, "body": { "type": "EmptyStatement", - "start": 16, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - } + "start":16,"end":17,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":17}} } } ], diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/242/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/242/output.json index 02714a4af3c8..2fd8f619a838 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/242/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/242/output.json @@ -1,108 +1,30 @@ { "type": "File", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "program": { "type": "Program", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ForStatement", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "init": { "type": "VariableDeclaration", - "start": 4, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":4,"end":20,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":20}}, "declarations": [ { "type": "VariableDeclarator", - "start": 8, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":8,"end":13,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":13}}, "id": { "type": "Identifier", - "start": 8, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "x" - }, + "start":8,"end":9,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":9},"identifierName":"x"}, "name": "x" }, "init": { "type": "NumericLiteral", - "start": 12, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":12,"end":13,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":13}}, "extra": { "rawValue": 0, "raw": "0" @@ -112,49 +34,15 @@ }, { "type": "VariableDeclarator", - "start": 15, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":15,"end":20,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":20}}, "id": { "type": "Identifier", - "start": 15, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - }, - "identifierName": "y" - }, + "start":15,"end":16,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":16},"identifierName":"y"}, "name": "y" }, "init": { "type": "NumericLiteral", - "start": 19, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":19,"end":20,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":20}}, "extra": { "rawValue": 1, "raw": "1" @@ -169,18 +57,7 @@ "update": null, "body": { "type": "EmptyStatement", - "start": 23, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 24 - } - } + "start":23,"end":24,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":24}} } } ], diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/243/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/243/output.json index ae77e9c9c0b4..d4c5c67c9404 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/243/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/243/output.json @@ -1,94 +1,27 @@ { "type": "File", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, "program": { "type": "Program", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ForStatement", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, "init": { "type": "AssignmentExpression", - "start": 4, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":4,"end":9,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":9}}, "operator": "=", "left": { "type": "Identifier", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "x" - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"x"}, "name": "x" }, "right": { "type": "NumericLiteral", - "start": 8, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":8,"end":9,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":9}}, "extra": { "rawValue": 0, "raw": "0" @@ -98,50 +31,16 @@ }, "test": { "type": "BinaryExpression", - "start": 11, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":11,"end":17,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":17}}, "left": { "type": "Identifier", - "start": 11, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "x" - }, + "start":11,"end":12,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":12},"identifierName":"x"}, "name": "x" }, "operator": "<", "right": { "type": "NumericLiteral", - "start": 15, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":15,"end":17,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":17}}, "extra": { "rawValue": 42, "raw": "42" @@ -152,18 +51,7 @@ "update": null, "body": { "type": "EmptyStatement", - "start": 19, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 20 - } - } + "start":19,"end":20,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":20}} } } ], diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/244/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/244/output.json index 8cae09284390..cd2ea8ed46f5 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/244/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/244/output.json @@ -1,94 +1,27 @@ { "type": "File", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "program": { "type": "Program", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ForStatement", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "init": { "type": "AssignmentExpression", - "start": 4, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":4,"end":9,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":9}}, "operator": "=", "left": { "type": "Identifier", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "x" - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"x"}, "name": "x" }, "right": { "type": "NumericLiteral", - "start": 8, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":8,"end":9,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":9}}, "extra": { "rawValue": 0, "raw": "0" @@ -98,50 +31,16 @@ }, "test": { "type": "BinaryExpression", - "start": 11, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":11,"end":17,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":17}}, "left": { "type": "Identifier", - "start": 11, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "x" - }, + "start":11,"end":12,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":12},"identifierName":"x"}, "name": "x" }, "operator": "<", "right": { "type": "NumericLiteral", - "start": 15, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":15,"end":17,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":17}}, "extra": { "rawValue": 42, "raw": "42" @@ -151,52 +50,18 @@ }, "update": { "type": "UpdateExpression", - "start": 19, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":19,"end":22,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":22}}, "operator": "++", "prefix": false, "argument": { "type": "Identifier", - "start": 19, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 20 - }, - "identifierName": "x" - }, + "start":19,"end":20,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":20},"identifierName":"x"}, "name": "x" } }, "body": { "type": "EmptyStatement", - "start": 23, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 24 - } - } + "start":23,"end":24,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":24}} } } ], diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/245/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/245/output.json index 0623e2624bc9..35c53b58e73a 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/245/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/245/output.json @@ -1,94 +1,27 @@ { "type": "File", - "start": 0, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":35}}, "program": { "type": "Program", - "start": 0, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":35}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ForStatement", - "start": 0, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":35}}, "init": { "type": "AssignmentExpression", - "start": 4, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":4,"end":9,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":9}}, "operator": "=", "left": { "type": "Identifier", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "x" - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"x"}, "name": "x" }, "right": { "type": "NumericLiteral", - "start": 8, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":8,"end":9,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":9}}, "extra": { "rawValue": 0, "raw": "0" @@ -98,50 +31,16 @@ }, "test": { "type": "BinaryExpression", - "start": 11, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":11,"end":17,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":17}}, "left": { "type": "Identifier", - "start": 11, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "x" - }, + "start":11,"end":12,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":12},"identifierName":"x"}, "name": "x" }, "operator": "<", "right": { "type": "NumericLiteral", - "start": 15, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":15,"end":17,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":17}}, "extra": { "rawValue": 42, "raw": "42" @@ -151,99 +50,30 @@ }, "update": { "type": "UpdateExpression", - "start": 19, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":19,"end":22,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":22}}, "operator": "++", "prefix": false, "argument": { "type": "Identifier", - "start": 19, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 20 - }, - "identifierName": "x" - }, + "start":19,"end":20,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":20},"identifierName":"x"}, "name": "x" } }, "body": { "type": "ExpressionStatement", - "start": 24, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":24,"end":35,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":35}}, "expression": { "type": "CallExpression", - "start": 24, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":24,"end":34,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":34}}, "callee": { "type": "Identifier", - "start": 24, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 31 - }, - "identifierName": "process" - }, + "start":24,"end":31,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":31},"identifierName":"process"}, "name": "process" }, "arguments": [ { "type": "Identifier", - "start": 32, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 32 - }, - "end": { - "line": 1, - "column": 33 - }, - "identifierName": "x" - }, + "start":32,"end":33,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":33},"identifierName":"x"}, "name": "x" } ] diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/246/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/246/output.json index 4ce81575447f..0dcc76e29bfb 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/246/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/246/output.json @@ -1,143 +1,40 @@ { "type": "File", - "start": 0, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, "program": { "type": "Program", - "start": 0, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ForInStatement", - "start": 0, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, "left": { "type": "Identifier", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "x" - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"x"}, "name": "x" }, "right": { "type": "Identifier", - "start": 9, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 13 - }, - "identifierName": "list" - }, + "start":9,"end":13,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":13},"identifierName":"list"}, "name": "list" }, "body": { "type": "ExpressionStatement", - "start": 15, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":15,"end":26,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":26}}, "expression": { "type": "CallExpression", - "start": 15, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":15,"end":25,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":25}}, "callee": { "type": "Identifier", - "start": 15, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 22 - }, - "identifierName": "process" - }, + "start":15,"end":22,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":22},"identifierName":"process"}, "name": "process" }, "arguments": [ { "type": "Identifier", - "start": 23, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 24 - }, - "identifierName": "x" - }, + "start":23,"end":24,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":24},"identifierName":"x"}, "name": "x" } ] diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/247/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/247/output.json index d418bc0ac898..b132a32e5e5a 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/247/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/247/output.json @@ -1,92 +1,25 @@ { "type": "File", - "start": 0, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, "program": { "type": "Program", - "start": 0, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ForInStatement", - "start": 0, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, "left": { "type": "VariableDeclaration", - "start": 5, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":5,"end":10,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":10}}, "declarations": [ { "type": "VariableDeclarator", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10}}, "id": { "type": "Identifier", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - }, - "identifierName": "x" - }, + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"x"}, "name": "x" }, "init": null @@ -96,82 +29,24 @@ }, "right": { "type": "Identifier", - "start": 14, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 18 - }, - "identifierName": "list" - }, + "start":14,"end":18,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":18},"identifierName":"list"}, "name": "list" }, "body": { "type": "ExpressionStatement", - "start": 20, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":20,"end":31,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":31}}, "expression": { "type": "CallExpression", - "start": 20, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":20,"end":30,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":30}}, "callee": { "type": "Identifier", - "start": 20, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 27 - }, - "identifierName": "process" - }, + "start":20,"end":27,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":27},"identifierName":"process"}, "name": "process" }, "arguments": [ { "type": "Identifier", - "start": 28, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 29 - }, - "identifierName": "x" - }, + "start":28,"end":29,"loc":{"start":{"line":1,"column":28},"end":{"line":1,"column":29},"identifierName":"x"}, "name": "x" } ] diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/25/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/25/output.json index dbb1747c7888..024dcc1726ee 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/25/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/25/output.json @@ -1,143 +1,42 @@ { "type": "File", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "program": { "type": "Program", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "expression": { "type": "AssignmentExpression", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "operator": "=", "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "right": { "type": "ObjectExpression", - "start": 4, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":4,"end":17,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":17}}, "properties": [ { "type": "ObjectProperty", - "start": 6, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":6,"end":15,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":15}}, "method": false, "key": { "type": "Identifier", - "start": 6, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "false" - }, + "start":6,"end":11,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":11},"identifierName":"false"}, "name": "false" }, "computed": false, "shorthand": false, "value": { "type": "NumericLiteral", - "start": 13, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":13,"end":15,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":15}}, "extra": { "rawValue": 42, "raw": "42" diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/250/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/250/output.json index 976ebcc7150e..797c741a6e74 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/250/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/250/output.json @@ -1,93 +1,27 @@ { "type": "File", - "start": 0, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, "program": { "type": "Program", - "start": 0, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "WhileStatement", - "start": 0, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, "test": { "type": "BooleanLiteral", - "start": 7, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":7,"end":11,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":11}}, "value": true }, "body": { "type": "BlockStatement", - "start": 13, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":13,"end":26,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":26}}, "body": [ { "type": "ContinueStatement", - "start": 15, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":15,"end":24,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":24}}, "label": null } ], diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/251/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/251/output.json index b14a15b253be..320fd8e86994 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/251/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/251/output.json @@ -1,93 +1,27 @@ { "type": "File", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, "program": { "type": "Program", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "WhileStatement", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, "test": { "type": "BooleanLiteral", - "start": 7, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":7,"end":11,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":11}}, "value": true }, "body": { "type": "BlockStatement", - "start": 13, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":13,"end":25,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":25}}, "body": [ { "type": "ContinueStatement", - "start": 15, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":15,"end":23,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":23}}, "label": null } ], diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/252/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/252/output.json index 618cec22e8a6..d69535cf3576 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/252/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/252/output.json @@ -1,122 +1,33 @@ { "type": "File", - "start": 0, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, "program": { "type": "Program", - "start": 0, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "LabeledStatement", - "start": 0, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, "body": { "type": "WhileStatement", - "start": 6, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":6,"end":36,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":36}}, "test": { "type": "BooleanLiteral", - "start": 13, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":13,"end":17,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":17}}, "value": true }, "body": { "type": "BlockStatement", - "start": 19, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":19,"end":36,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":36}}, "body": [ { "type": "ContinueStatement", - "start": 21, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":21,"end":34,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":34}}, "label": { "type": "Identifier", - "start": 30, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 1, - "column": 34 - }, - "identifierName": "done" - }, + "start":30,"end":34,"loc":{"start":{"line":1,"column":30},"end":{"line":1,"column":34},"identifierName":"done"}, "name": "done" } } @@ -126,19 +37,7 @@ }, "label": { "type": "Identifier", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - }, - "identifierName": "done" - }, + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4},"identifierName":"done"}, "name": "done" } } diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/253/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/253/output.json index 1ae8f40f9740..3036808c3c47 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/253/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/253/output.json @@ -1,122 +1,33 @@ { "type": "File", - "start": 0, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 37 - } - }, + "start":0,"end":37,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":37}}, "program": { "type": "Program", - "start": 0, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 37 - } - }, + "start":0,"end":37,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":37}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "LabeledStatement", - "start": 0, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 37 - } - }, + "start":0,"end":37,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":37}}, "body": { "type": "WhileStatement", - "start": 6, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 37 - } - }, + "start":6,"end":37,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":37}}, "test": { "type": "BooleanLiteral", - "start": 13, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":13,"end":17,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":17}}, "value": true }, "body": { "type": "BlockStatement", - "start": 19, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 37 - } - }, + "start":19,"end":37,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":37}}, "body": [ { "type": "ContinueStatement", - "start": 21, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":21,"end":35,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":35}}, "label": { "type": "Identifier", - "start": 30, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 1, - "column": 34 - }, - "identifierName": "done" - }, + "start":30,"end":34,"loc":{"start":{"line":1,"column":30},"end":{"line":1,"column":34},"identifierName":"done"}, "name": "done" } } @@ -126,19 +37,7 @@ }, "label": { "type": "Identifier", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - }, - "identifierName": "done" - }, + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4},"identifierName":"done"}, "name": "done" } } diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/254/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/254/output.json index f719006e5af9..bdda42876a8f 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/254/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/254/output.json @@ -1,93 +1,27 @@ { "type": "File", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "program": { "type": "Program", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "WhileStatement", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "test": { "type": "BooleanLiteral", - "start": 7, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":7,"end":11,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":11}}, "value": true }, "body": { "type": "BlockStatement", - "start": 13, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":13,"end":22,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":22}}, "body": [ { "type": "BreakStatement", - "start": 15, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":15,"end":20,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":20}}, "label": null } ], diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/255/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/255/output.json index 09cd88be36e1..12f3b1a77a2e 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/255/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/255/output.json @@ -1,122 +1,33 @@ { "type": "File", - "start": 0, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, "program": { "type": "Program", - "start": 0, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "LabeledStatement", - "start": 0, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, "body": { "type": "WhileStatement", - "start": 6, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":6,"end":33,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":33}}, "test": { "type": "BooleanLiteral", - "start": 13, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":13,"end":17,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":17}}, "value": true }, "body": { "type": "BlockStatement", - "start": 19, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":19,"end":33,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":33}}, "body": [ { "type": "BreakStatement", - "start": 21, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":21,"end":31,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":31}}, "label": { "type": "Identifier", - "start": 27, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 31 - }, - "identifierName": "done" - }, + "start":27,"end":31,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":31},"identifierName":"done"}, "name": "done" } } @@ -126,19 +37,7 @@ }, "label": { "type": "Identifier", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - }, - "identifierName": "done" - }, + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4},"identifierName":"done"}, "name": "done" } } diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/256/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/256/output.json index 612f1abd2b91..856e2d676e20 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/256/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/256/output.json @@ -1,122 +1,33 @@ { "type": "File", - "start": 0, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, "program": { "type": "Program", - "start": 0, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "LabeledStatement", - "start": 0, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, "body": { "type": "WhileStatement", - "start": 6, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":6,"end":34,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":34}}, "test": { "type": "BooleanLiteral", - "start": 13, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":13,"end":17,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":17}}, "value": true }, "body": { "type": "BlockStatement", - "start": 19, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":19,"end":34,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":34}}, "body": [ { "type": "BreakStatement", - "start": 21, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":21,"end":32,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":32}}, "label": { "type": "Identifier", - "start": 27, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 31 - }, - "identifierName": "done" - }, + "start":27,"end":31,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":31},"identifierName":"done"}, "name": "done" } } @@ -126,19 +37,7 @@ }, "label": { "type": "Identifier", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - }, - "identifierName": "done" - }, + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4},"identifierName":"done"}, "name": "done" } } diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/257/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/257/output.json index 43f74a614620..da1bb68d7165 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/257/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/257/output.json @@ -1,136 +1,36 @@ { "type": "File", - "start": 0, - "end": 52, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 52 - } - }, + "start":0,"end":52,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":52}}, "program": { "type": "Program", - "start": 0, - "end": 52, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 52 - } - }, + "start":0,"end":52,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":52}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "LabeledStatement", - "start": 0, - "end": 52, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 52 - } - }, + "start":0,"end":52,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":52}}, "body": { "type": "LabeledStatement", - "start": 9, - "end": 52, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 52 - } - }, + "start":9,"end":52,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":52}}, "body": { "type": "WhileStatement", - "start": 18, - "end": 52, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 52 - } - }, + "start":18,"end":52,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":52}}, "test": { "type": "BooleanLiteral", - "start": 25, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":25,"end":29,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":29}}, "value": true }, "body": { "type": "BlockStatement", - "start": 31, - "end": 52, - "loc": { - "start": { - "line": 1, - "column": 31 - }, - "end": { - "line": 1, - "column": 52 - } - }, + "start":31,"end":52,"loc":{"start":{"line":1,"column":31},"end":{"line":1,"column":52}}, "body": [ { "type": "ContinueStatement", - "start": 33, - "end": 50, - "loc": { - "start": { - "line": 1, - "column": 33 - }, - "end": { - "line": 1, - "column": 50 - } - }, + "start":33,"end":50,"loc":{"start":{"line":1,"column":33},"end":{"line":1,"column":50}}, "label": { "type": "Identifier", - "start": 42, - "end": 49, - "loc": { - "start": { - "line": 1, - "column": 42 - }, - "end": { - "line": 1, - "column": 49 - }, - "identifierName": "target1" - }, + "start":42,"end":49,"loc":{"start":{"line":1,"column":42},"end":{"line":1,"column":49},"identifierName":"target1"}, "name": "target1" } } @@ -140,37 +40,13 @@ }, "label": { "type": "Identifier", - "start": 9, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 16 - }, - "identifierName": "target2" - }, + "start":9,"end":16,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":16},"identifierName":"target2"}, "name": "target2" } }, "label": { "type": "Identifier", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "target1" - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7},"identifierName":"target1"}, "name": "target1" } } diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/258/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/258/output.json index fabfd48570db..fb3e701b7455 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/258/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/258/output.json @@ -1,150 +1,39 @@ { "type": "File", - "start": 0, - "end": 61, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 61 - } - }, + "start":0,"end":61,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":61}}, "program": { "type": "Program", - "start": 0, - "end": 61, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 61 - } - }, + "start":0,"end":61,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":61}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "LabeledStatement", - "start": 0, - "end": 61, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 61 - } - }, + "start":0,"end":61,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":61}}, "body": { "type": "LabeledStatement", - "start": 9, - "end": 61, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 61 - } - }, + "start":9,"end":61,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":61}}, "body": { "type": "LabeledStatement", - "start": 18, - "end": 61, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 61 - } - }, + "start":18,"end":61,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":61}}, "body": { "type": "WhileStatement", - "start": 27, - "end": 61, - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 61 - } - }, + "start":27,"end":61,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":61}}, "test": { "type": "BooleanLiteral", - "start": 34, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 34 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":34,"end":38,"loc":{"start":{"line":1,"column":34},"end":{"line":1,"column":38}}, "value": true }, "body": { "type": "BlockStatement", - "start": 40, - "end": 61, - "loc": { - "start": { - "line": 1, - "column": 40 - }, - "end": { - "line": 1, - "column": 61 - } - }, + "start":40,"end":61,"loc":{"start":{"line":1,"column":40},"end":{"line":1,"column":61}}, "body": [ { "type": "ContinueStatement", - "start": 42, - "end": 59, - "loc": { - "start": { - "line": 1, - "column": 42 - }, - "end": { - "line": 1, - "column": 59 - } - }, + "start":42,"end":59,"loc":{"start":{"line":1,"column":42},"end":{"line":1,"column":59}}, "label": { "type": "Identifier", - "start": 51, - "end": 58, - "loc": { - "start": { - "line": 1, - "column": 51 - }, - "end": { - "line": 1, - "column": 58 - }, - "identifierName": "target1" - }, + "start":51,"end":58,"loc":{"start":{"line":1,"column":51},"end":{"line":1,"column":58},"identifierName":"target1"}, "name": "target1" } } @@ -154,55 +43,19 @@ }, "label": { "type": "Identifier", - "start": 18, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 25 - }, - "identifierName": "target3" - }, + "start":18,"end":25,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":25},"identifierName":"target3"}, "name": "target3" } }, "label": { "type": "Identifier", - "start": 9, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 16 - }, - "identifierName": "target2" - }, + "start":9,"end":16,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":16},"identifierName":"target2"}, "name": "target2" } }, "label": { "type": "Identifier", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "target1" - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7},"identifierName":"target1"}, "name": "target1" } } diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/259/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/259/output.json index 34df72d1dd54..12be6ac78804 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/259/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/259/output.json @@ -1,95 +1,29 @@ { "type": "File", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "program": { "type": "Program", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "expression": { "type": "FunctionExpression", - "start": 1, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":1,"end":21,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":21}}, "id": null, "generator": false, "async": false, "params": [], "body": { "type": "BlockStatement", - "start": 11, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":11,"end":21,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":21}}, "body": [ { "type": "ReturnStatement", - "start": 13, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":13,"end":19,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":19}}, "argument": null } ], diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/26/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/26/output.json index 2918b16e85cb..5ee065601ed2 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/26/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/26/output.json @@ -1,143 +1,42 @@ { "type": "File", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "program": { "type": "Program", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "expression": { "type": "AssignmentExpression", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "operator": "=", "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "right": { "type": "ObjectExpression", - "start": 4, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":4,"end":16,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":16}}, "properties": [ { "type": "ObjectProperty", - "start": 6, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":6,"end":14,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":14}}, "method": false, "key": { "type": "Identifier", - "start": 6, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 10 - }, - "identifierName": "null" - }, + "start":6,"end":10,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":10},"identifierName":"null"}, "name": "null" }, "computed": false, "shorthand": false, "value": { "type": "NumericLiteral", - "start": 12, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":12,"end":14,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":14}}, "extra": { "rawValue": 42, "raw": "42" diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/260/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/260/output.json index ea1e209f24bf..23e0a043e22b 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/260/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/260/output.json @@ -1,95 +1,29 @@ { "type": "File", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "program": { "type": "Program", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "expression": { "type": "FunctionExpression", - "start": 1, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":1,"end":22,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":22}}, "id": null, "generator": false, "async": false, "params": [], "body": { "type": "BlockStatement", - "start": 11, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":11,"end":22,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":22}}, "body": [ { "type": "ReturnStatement", - "start": 13, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":13,"end":20,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":20}}, "argument": null } ], diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/261/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/261/output.json index c0cd7f551693..b6cb58fdb09b 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/261/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/261/output.json @@ -1,110 +1,32 @@ { "type": "File", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, "program": { "type": "Program", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, "expression": { "type": "FunctionExpression", - "start": 1, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":1,"end":24,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":24}}, "id": null, "generator": false, "async": false, "params": [], "body": { "type": "BlockStatement", - "start": 11, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":11,"end":24,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":24}}, "body": [ { "type": "ReturnStatement", - "start": 13, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":13,"end":22,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":22}}, "argument": { "type": "Identifier", - "start": 20, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 21 - }, - "identifierName": "x" - }, + "start":20,"end":21,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":21},"identifierName":"x"}, "name": "x" } } diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/262/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/262/output.json index dc6bc1917edf..129603ce64aa 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/262/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/262/output.json @@ -1,142 +1,41 @@ { "type": "File", - "start": 0, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, "program": { "type": "Program", - "start": 0, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, "expression": { "type": "FunctionExpression", - "start": 1, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":1,"end":27,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":27}}, "id": null, "generator": false, "async": false, "params": [], "body": { "type": "BlockStatement", - "start": 11, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":11,"end":27,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":27}}, "body": [ { "type": "ReturnStatement", - "start": 13, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":13,"end":25,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":25}}, "argument": { "type": "BinaryExpression", - "start": 20, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":20,"end":25,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":25}}, "left": { "type": "Identifier", - "start": 20, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 21 - }, - "identifierName": "x" - }, + "start":20,"end":21,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":21},"identifierName":"x"}, "name": "x" }, "operator": "*", "right": { "type": "Identifier", - "start": 24, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 25 - }, - "identifierName": "y" - }, + "start":24,"end":25,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":25},"identifierName":"y"}, "name": "y" } } diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/263/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/263/output.json index 738083370c5c..ccc3410c913f 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/263/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/263/output.json @@ -1,126 +1,35 @@ { "type": "File", - "start": 0, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, "program": { "type": "Program", - "start": 0, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "WithStatement", - "start": 17, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":17,"end":36,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":36}}, "object": { "type": "Identifier", - "start": 23, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 24 - }, - "identifierName": "x" - }, + "start":23,"end":24,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":24},"identifierName":"x"}, "name": "x" }, "body": { "type": "ExpressionStatement", - "start": 26, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":26,"end":36,"loc":{"start":{"line":1,"column":26},"end":{"line":1,"column":36}}, "expression": { "type": "AssignmentExpression", - "start": 26, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":26,"end":35,"loc":{"start":{"line":1,"column":26},"end":{"line":1,"column":35}}, "operator": "=", "left": { "type": "Identifier", - "start": 26, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 29 - }, - "identifierName": "foo" - }, + "start":26,"end":29,"loc":{"start":{"line":1,"column":26},"end":{"line":1,"column":29},"identifierName":"foo"}, "name": "foo" }, "right": { "type": "Identifier", - "start": 32, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 32 - }, - "end": { - "line": 1, - "column": 35 - }, - "identifierName": "bar" - }, + "start":32,"end":35,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":35},"identifierName":"bar"}, "name": "bar" } } @@ -130,32 +39,10 @@ "directives": [ { "type": "Directive", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "value": { "type": "DirectiveLiteral", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "value": "use\\x20strict", "extra": { "raw": "'use\\x20strict'", diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/264/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/264/output.json index 3ff3f82cfe2e..10bfd0ed118e 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/264/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/264/output.json @@ -1,126 +1,35 @@ { "type": "File", - "start": 0, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, "program": { "type": "Program", - "start": 0, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "WithStatement", - "start": 17, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":17,"end":36,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":36}}, "object": { "type": "Identifier", - "start": 23, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 24 - }, - "identifierName": "x" - }, + "start":23,"end":24,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":24},"identifierName":"x"}, "name": "x" }, "body": { "type": "ExpressionStatement", - "start": 26, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":26,"end":36,"loc":{"start":{"line":1,"column":26},"end":{"line":1,"column":36}}, "expression": { "type": "AssignmentExpression", - "start": 26, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":26,"end":35,"loc":{"start":{"line":1,"column":26},"end":{"line":1,"column":35}}, "operator": "=", "left": { "type": "Identifier", - "start": 26, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 29 - }, - "identifierName": "foo" - }, + "start":26,"end":29,"loc":{"start":{"line":1,"column":26},"end":{"line":1,"column":29},"identifierName":"foo"}, "name": "foo" }, "right": { "type": "Identifier", - "start": 32, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 32 - }, - "end": { - "line": 1, - "column": 35 - }, - "identifierName": "bar" - }, + "start":32,"end":35,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":35},"identifierName":"bar"}, "name": "bar" } } @@ -130,32 +39,10 @@ "directives": [ { "type": "Directive", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "value": { "type": "DirectiveLiteral", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "value": "use\\x20strict", "extra": { "raw": "\"use\\x20strict\"", diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/265/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/265/output.json index de556d585469..4e092c03ea2f 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/265/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/265/output.json @@ -1,126 +1,35 @@ { "type": "File", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, "program": { "type": "Program", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "WithStatement", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, "object": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "x" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"x"}, "name": "x" }, "body": { "type": "ExpressionStatement", - "start": 9, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":9,"end":18,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":18}}, "expression": { "type": "AssignmentExpression", - "start": 9, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":9,"end":18,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":18}}, "operator": "=", "left": { "type": "Identifier", - "start": 9, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "foo" - }, + "start":9,"end":12,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":12},"identifierName":"foo"}, "name": "foo" }, "right": { "type": "Identifier", - "start": 15, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 18 - }, - "identifierName": "bar" - }, + "start":15,"end":18,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":18},"identifierName":"bar"}, "name": "bar" } } diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/266/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/266/output.json index b8b637790518..4f5b295c2b96 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/266/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/266/output.json @@ -1,126 +1,35 @@ { "type": "File", - "start": 0, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, "program": { "type": "Program", - "start": 0, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "WithStatement", - "start": 0, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, "object": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "x" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"x"}, "name": "x" }, "body": { "type": "ExpressionStatement", - "start": 9, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":9,"end":19,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":19}}, "expression": { "type": "AssignmentExpression", - "start": 9, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":9,"end":18,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":18}}, "operator": "=", "left": { "type": "Identifier", - "start": 9, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "foo" - }, + "start":9,"end":12,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":12},"identifierName":"foo"}, "name": "foo" }, "right": { "type": "Identifier", - "start": 15, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 18 - }, - "identifierName": "bar" - }, + "start":15,"end":18,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":18},"identifierName":"bar"}, "name": "bar" } } diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/267/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/267/output.json index 67715145c740..7675a5829970 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/267/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/267/output.json @@ -1,141 +1,39 @@ { "type": "File", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "program": { "type": "Program", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "WithStatement", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "object": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "x" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"x"}, "name": "x" }, "body": { "type": "BlockStatement", - "start": 9, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":9,"end":22,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":22}}, "body": [ { "type": "ExpressionStatement", - "start": 11, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":11,"end":20,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":20}}, "expression": { "type": "AssignmentExpression", - "start": 11, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":11,"end":20,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":20}}, "operator": "=", "left": { "type": "Identifier", - "start": 11, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 14 - }, - "identifierName": "foo" - }, + "start":11,"end":14,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":14},"identifierName":"foo"}, "name": "foo" }, "right": { "type": "Identifier", - "start": 17, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 20 - }, - "identifierName": "bar" - }, + "start":17,"end":20,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":20},"identifierName":"bar"}, "name": "bar" } } diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/268/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/268/output.json index 2676e600764f..191390407c53 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/268/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/268/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "program": { "type": "Program", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "SwitchStatement", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "discriminant": { "type": "Identifier", - "start": 8, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "x" - }, + "start":8,"end":9,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":9},"identifierName":"x"}, "name": "x" }, "cases": [] diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/269/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/269/output.json index 26eb0ec7e251..34304235c8c8 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/269/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/269/output.json @@ -1,124 +1,34 @@ { "type": "File", - "start": 0, - "end": 41, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 41 - } - }, + "start":0,"end":41,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":41}}, "program": { "type": "Program", - "start": 0, - "end": 41, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 41 - } - }, + "start":0,"end":41,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":41}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "SwitchStatement", - "start": 0, - "end": 41, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 41 - } - }, + "start":0,"end":41,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":41}}, "discriminant": { "type": "Identifier", - "start": 8, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 14 - }, - "identifierName": "answer" - }, + "start":8,"end":14,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":14},"identifierName":"answer"}, "name": "answer" }, "cases": [ { "type": "SwitchCase", - "start": 18, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 39 - } - }, + "start":18,"end":39,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":39}}, "consequent": [ { "type": "ExpressionStatement", - "start": 27, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":27,"end":32,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":32}}, "expression": { "type": "CallExpression", - "start": 27, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":27,"end":31,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":31}}, "callee": { "type": "Identifier", - "start": 27, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 29 - }, - "identifierName": "hi" - }, + "start":27,"end":29,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":29},"identifierName":"hi"}, "name": "hi" }, "arguments": [] @@ -126,35 +36,13 @@ }, { "type": "BreakStatement", - "start": 33, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 33 - }, - "end": { - "line": 1, - "column": 39 - } - }, + "start":33,"end":39,"loc":{"start":{"line":1,"column":33},"end":{"line":1,"column":39}}, "label": null } ], "test": { "type": "NumericLiteral", - "start": 23, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":23,"end":25,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":25}}, "extra": { "rawValue": 42, "raw": "42" diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/27/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/27/output.json index 367eac531099..e5cdd1426df6 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/27/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/27/output.json @@ -1,124 +1,35 @@ { "type": "File", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, "program": { "type": "Program", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, "expression": { "type": "AssignmentExpression", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, "operator": "=", "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "right": { "type": "ObjectExpression", - "start": 4, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":4,"end":20,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":20}}, "properties": [ { "type": "ObjectProperty", - "start": 6, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":6,"end":18,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":18}}, "method": false, "key": { "type": "StringLiteral", - "start": 6, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":6,"end":14,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":14}}, "extra": { "rawValue": "answer", "raw": "\"answer\"" @@ -129,18 +40,7 @@ "shorthand": false, "value": { "type": "NumericLiteral", - "start": 16, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":16,"end":18,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":18}}, "extra": { "rawValue": 42, "raw": "42" diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/270/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/270/output.json index 1295bdfcf9c2..e91e6f437f78 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/270/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/270/output.json @@ -1,124 +1,34 @@ { "type": "File", - "start": 0, - "end": 56, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 56 - } - }, + "start":0,"end":56,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":56}}, "program": { "type": "Program", - "start": 0, - "end": 56, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 56 - } - }, + "start":0,"end":56,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":56}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "SwitchStatement", - "start": 0, - "end": 56, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 56 - } - }, + "start":0,"end":56,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":56}}, "discriminant": { "type": "Identifier", - "start": 8, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 14 - }, - "identifierName": "answer" - }, + "start":8,"end":14,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":14},"identifierName":"answer"}, "name": "answer" }, "cases": [ { "type": "SwitchCase", - "start": 18, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 39 - } - }, + "start":18,"end":39,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":39}}, "consequent": [ { "type": "ExpressionStatement", - "start": 27, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":27,"end":32,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":32}}, "expression": { "type": "CallExpression", - "start": 27, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":27,"end":31,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":31}}, "callee": { "type": "Identifier", - "start": 27, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 29 - }, - "identifierName": "hi" - }, + "start":27,"end":29,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":29},"identifierName":"hi"}, "name": "hi" }, "arguments": [] @@ -126,35 +36,13 @@ }, { "type": "BreakStatement", - "start": 33, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 33 - }, - "end": { - "line": 1, - "column": 39 - } - }, + "start":33,"end":39,"loc":{"start":{"line":1,"column":33},"end":{"line":1,"column":39}}, "label": null } ], "test": { "type": "NumericLiteral", - "start": 23, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":23,"end":25,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":25}}, "extra": { "rawValue": 42, "raw": "42" @@ -164,33 +52,11 @@ }, { "type": "SwitchCase", - "start": 40, - "end": 54, - "loc": { - "start": { - "line": 1, - "column": 40 - }, - "end": { - "line": 1, - "column": 54 - } - }, + "start":40,"end":54,"loc":{"start":{"line":1,"column":40},"end":{"line":1,"column":54}}, "consequent": [ { "type": "BreakStatement", - "start": 49, - "end": 54, - "loc": { - "start": { - "line": 1, - "column": 49 - }, - "end": { - "line": 1, - "column": 54 - } - }, + "start":49,"end":54,"loc":{"start":{"line":1,"column":49},"end":{"line":1,"column":54}}, "label": null } ], diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/271/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/271/output.json index acbeba45c5e9..9a1c53c8531f 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/271/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/271/output.json @@ -1,113 +1,34 @@ { "type": "File", - "start": 0, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, "program": { "type": "Program", - "start": 0, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "LabeledStatement", - "start": 0, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, "body": { "type": "ForStatement", - "start": 7, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":7,"end":27,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":27}}, "init": null, "test": null, "update": null, "body": { "type": "BreakStatement", - "start": 16, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":16,"end":27,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":27}}, "label": { "type": "Identifier", - "start": 22, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 27 - }, - "identifierName": "start" - }, + "start":22,"end":27,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":27},"identifierName":"start"}, "name": "start" } } }, "label": { "type": "Identifier", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "start" - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5},"identifierName":"start"}, "name": "start" } } diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/272/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/272/output.json index 5251cd078d22..758f4d4bd8dc 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/272/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/272/output.json @@ -1,126 +1,36 @@ { "type": "File", - "start": 0, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, "program": { "type": "Program", - "start": 0, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "LabeledStatement", - "start": 0, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, "body": { "type": "WhileStatement", - "start": 7, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":7,"end":31,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":31}}, "test": { "type": "BooleanLiteral", - "start": 14, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":14,"end":18,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":18}}, "value": true }, "body": { "type": "BreakStatement", - "start": 20, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":20,"end":31,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":31}}, "label": { "type": "Identifier", - "start": 26, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 31 - }, - "identifierName": "start" - }, + "start":26,"end":31,"loc":{"start":{"line":1,"column":26},"end":{"line":1,"column":31},"identifierName":"start"}, "name": "start" } } }, "label": { "type": "Identifier", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "start" - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5},"identifierName":"start"}, "name": "start" } } diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/273/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/273/output.json index 4d485ddd9600..16e82da75c18 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/273/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/273/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, "program": { "type": "Program", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ThrowStatement", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, "argument": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "x" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"x"}, "name": "x" } } diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/274/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/274/output.json index 0099a2d97eaf..2835e746897a 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/274/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/274/output.json @@ -1,95 +1,27 @@ { "type": "File", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "program": { "type": "Program", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ThrowStatement", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "argument": { "type": "BinaryExpression", - "start": 6, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":6,"end":11,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":11}}, "left": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "x" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"x"}, "name": "x" }, "operator": "*", "right": { "type": "Identifier", - "start": 10, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "y" - }, + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11},"identifierName":"y"}, "name": "y" } } diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/275/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/275/output.json index ef879544f9bf..5caef91e52b6 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/275/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/275/output.json @@ -1,111 +1,33 @@ { "type": "File", - "start": 0, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, "program": { "type": "Program", - "start": 0, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ThrowStatement", - "start": 0, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, "argument": { "type": "ObjectExpression", - "start": 6, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":6,"end":26,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":26}}, "properties": [ { "type": "ObjectProperty", - "start": 8, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":8,"end":24,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":24}}, "method": false, "key": { "type": "Identifier", - "start": 8, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 15 - }, - "identifierName": "message" - }, + "start":8,"end":15,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":15},"identifierName":"message"}, "name": "message" }, "computed": false, "shorthand": false, "value": { "type": "StringLiteral", - "start": 17, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":17,"end":24,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":24}}, "extra": { "rawValue": "Error", "raw": "\"Error\"" diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/276/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/276/output.json index 7124a7ba6fff..cb43070c2777 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/276/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/276/output.json @@ -1,110 +1,32 @@ { "type": "File", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, "program": { "type": "Program", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "TryStatement", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, "block": { "type": "BlockStatement", - "start": 4, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":4,"end":7,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":7}}, "body": [], "directives": [] }, "handler": { "type": "CatchClause", - "start": 8, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":8,"end":21,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":21}}, "param": { "type": "Identifier", - "start": 15, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - }, - "identifierName": "e" - }, + "start":15,"end":16,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":16},"identifierName":"e"}, "name": "e" }, "body": { "type": "BlockStatement", - "start": 18, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":18,"end":21,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":21}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/277/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/277/output.json index 0f104da5ae82..bca060357b6c 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/277/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/277/output.json @@ -1,110 +1,32 @@ { "type": "File", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "program": { "type": "Program", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "TryStatement", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "block": { "type": "BlockStatement", - "start": 4, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":4,"end":7,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":7}}, "body": [], "directives": [] }, "handler": { "type": "CatchClause", - "start": 8, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":8,"end":24,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":24}}, "param": { "type": "Identifier", - "start": 15, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 19 - }, - "identifierName": "eval" - }, + "start":15,"end":19,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":19},"identifierName":"eval"}, "name": "eval" }, "body": { "type": "BlockStatement", - "start": 21, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":21,"end":24,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":24}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/278/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/278/output.json index 8721f9d98403..d1a65bb67c2b 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/278/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/278/output.json @@ -1,110 +1,32 @@ { "type": "File", - "start": 0, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, "program": { "type": "Program", - "start": 0, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "TryStatement", - "start": 0, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, "block": { "type": "BlockStatement", - "start": 4, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":4,"end":7,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":7}}, "body": [], "directives": [] }, "handler": { "type": "CatchClause", - "start": 8, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":8,"end":29,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":29}}, "param": { "type": "Identifier", - "start": 15, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 24 - }, - "identifierName": "arguments" - }, + "start":15,"end":24,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":24},"identifierName":"arguments"}, "name": "arguments" }, "body": { "type": "BlockStatement", - "start": 26, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":26,"end":29,"loc":{"start":{"line":1,"column":26},"end":{"line":1,"column":29}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/279/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/279/output.json index 49094bb0e6bd..fb80b314fa31 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/279/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/279/output.json @@ -1,172 +1,48 @@ { "type": "File", - "start": 0, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, "program": { "type": "Program", - "start": 0, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "TryStatement", - "start": 0, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, "block": { "type": "BlockStatement", - "start": 4, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":4,"end":7,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":7}}, "body": [], "directives": [] }, "handler": { "type": "CatchClause", - "start": 8, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":8,"end":28,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":28}}, "param": { "type": "Identifier", - "start": 15, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - }, - "identifierName": "e" - }, + "start":15,"end":16,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":16},"identifierName":"e"}, "name": "e" }, "body": { "type": "BlockStatement", - "start": 18, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":18,"end":28,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":28}}, "body": [ { "type": "ExpressionStatement", - "start": 20, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":20,"end":26,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":26}}, "expression": { "type": "CallExpression", - "start": 20, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":20,"end":26,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":26}}, "callee": { "type": "Identifier", - "start": 20, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 23 - }, - "identifierName": "say" - }, + "start":20,"end":23,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":23},"identifierName":"say"}, "name": "say" }, "arguments": [ { "type": "Identifier", - "start": 24, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 25 - }, - "identifierName": "e" - }, + "start":24,"end":25,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":25},"identifierName":"e"}, "name": "e" } ] diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/28/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/28/output.json index 81194dadc77a..b8f82071b213 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/28/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/28/output.json @@ -1,143 +1,42 @@ { "type": "File", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, "program": { "type": "Program", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, "expression": { "type": "AssignmentExpression", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, "operator": "=", "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "right": { "type": "ObjectExpression", - "start": 4, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":4,"end":18,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":18}}, "properties": [ { "type": "ObjectProperty", - "start": 6, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":6,"end":10,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":10}}, "method": false, "key": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "x" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"x"}, "name": "x" }, "computed": false, "shorthand": false, "value": { "type": "NumericLiteral", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10}}, "extra": { "rawValue": 1, "raw": "1" @@ -147,52 +46,18 @@ }, { "type": "ObjectProperty", - "start": 12, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":12,"end":16,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":16}}, "method": false, "key": { "type": "Identifier", - "start": 12, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - }, - "identifierName": "x" - }, + "start":12,"end":13,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":13},"identifierName":"x"}, "name": "x" }, "computed": false, "shorthand": false, "value": { "type": "NumericLiteral", - "start": 15, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":15,"end":16,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":16}}, "extra": { "rawValue": 2, "raw": "2" diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/280/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/280/output.json index b1589f69dcee..a079acf84911 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/280/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/280/output.json @@ -1,142 +1,41 @@ { "type": "File", - "start": 0, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, "program": { "type": "Program", - "start": 0, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "TryStatement", - "start": 0, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, "block": { "type": "BlockStatement", - "start": 4, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":4,"end":7,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":7}}, "body": [], "directives": [] }, "handler": null, "finalizer": { "type": "BlockStatement", - "start": 16, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":16,"end":34,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":34}}, "body": [ { "type": "ExpressionStatement", - "start": 18, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":18,"end":32,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":32}}, "expression": { "type": "CallExpression", - "start": 18, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":18,"end":32,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":32}}, "callee": { "type": "Identifier", - "start": 18, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 25 - }, - "identifierName": "cleanup" - }, + "start":18,"end":25,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":25},"identifierName":"cleanup"}, "name": "cleanup" }, "arguments": [ { "type": "Identifier", - "start": 26, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 31 - }, - "identifierName": "stuff" - }, + "start":26,"end":31,"loc":{"start":{"line":1,"column":26},"end":{"line":1,"column":31},"identifierName":"stuff"}, "name": "stuff" } ] diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/281/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/281/output.json index 7bb5acfbedbb..0453b860b1e1 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/281/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/281/output.json @@ -1,106 +1,28 @@ { "type": "File", - "start": 0, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":38}}, "program": { "type": "Program", - "start": 0, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":38}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "TryStatement", - "start": 0, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":38}}, "block": { "type": "BlockStatement", - "start": 4, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":4,"end":17,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":17}}, "body": [ { "type": "ExpressionStatement", - "start": 6, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":6,"end":15,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":15}}, "expression": { "type": "CallExpression", - "start": 6, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":6,"end":14,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":14}}, "callee": { "type": "Identifier", - "start": 6, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "doThat" - }, + "start":6,"end":12,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":12},"identifierName":"doThat"}, "name": "doThat" }, "arguments": [] @@ -111,111 +33,31 @@ }, "handler": { "type": "CatchClause", - "start": 18, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":18,"end":38,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":38}}, "param": { "type": "Identifier", - "start": 25, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 26 - }, - "identifierName": "e" - }, + "start":25,"end":26,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":26},"identifierName":"e"}, "name": "e" }, "body": { "type": "BlockStatement", - "start": 28, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":28,"end":38,"loc":{"start":{"line":1,"column":28},"end":{"line":1,"column":38}}, "body": [ { "type": "ExpressionStatement", - "start": 30, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":30,"end":36,"loc":{"start":{"line":1,"column":30},"end":{"line":1,"column":36}}, "expression": { "type": "CallExpression", - "start": 30, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":30,"end":36,"loc":{"start":{"line":1,"column":30},"end":{"line":1,"column":36}}, "callee": { "type": "Identifier", - "start": 30, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 1, - "column": 33 - }, - "identifierName": "say" - }, + "start":30,"end":33,"loc":{"start":{"line":1,"column":30},"end":{"line":1,"column":33},"identifierName":"say"}, "name": "say" }, "arguments": [ { "type": "Identifier", - "start": 34, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 34 - }, - "end": { - "line": 1, - "column": 35 - }, - "identifierName": "e" - }, + "start":34,"end":35,"loc":{"start":{"line":1,"column":34},"end":{"line":1,"column":35},"identifierName":"e"}, "name": "e" } ] diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/282/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/282/output.json index 91b008540089..bddc435c75dc 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/282/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/282/output.json @@ -1,106 +1,28 @@ { "type": "File", - "start": 0, - "end": 65, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 65 - } - }, + "start":0,"end":65,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":65}}, "program": { "type": "Program", - "start": 0, - "end": 65, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 65 - } - }, + "start":0,"end":65,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":65}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "TryStatement", - "start": 0, - "end": 65, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 65 - } - }, + "start":0,"end":65,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":65}}, "block": { "type": "BlockStatement", - "start": 4, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":4,"end":17,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":17}}, "body": [ { "type": "ExpressionStatement", - "start": 6, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":6,"end":15,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":15}}, "expression": { "type": "CallExpression", - "start": 6, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":6,"end":14,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":14}}, "callee": { "type": "Identifier", - "start": 6, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "doThat" - }, + "start":6,"end":12,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":12},"identifierName":"doThat"}, "name": "doThat" }, "arguments": [] @@ -111,111 +33,31 @@ }, "handler": { "type": "CatchClause", - "start": 18, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":18,"end":38,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":38}}, "param": { "type": "Identifier", - "start": 25, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 26 - }, - "identifierName": "e" - }, + "start":25,"end":26,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":26},"identifierName":"e"}, "name": "e" }, "body": { "type": "BlockStatement", - "start": 28, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":28,"end":38,"loc":{"start":{"line":1,"column":28},"end":{"line":1,"column":38}}, "body": [ { "type": "ExpressionStatement", - "start": 30, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":30,"end":36,"loc":{"start":{"line":1,"column":30},"end":{"line":1,"column":36}}, "expression": { "type": "CallExpression", - "start": 30, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":30,"end":36,"loc":{"start":{"line":1,"column":30},"end":{"line":1,"column":36}}, "callee": { "type": "Identifier", - "start": 30, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 1, - "column": 33 - }, - "identifierName": "say" - }, + "start":30,"end":33,"loc":{"start":{"line":1,"column":30},"end":{"line":1,"column":33},"identifierName":"say"}, "name": "say" }, "arguments": [ { "type": "Identifier", - "start": 34, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 34 - }, - "end": { - "line": 1, - "column": 35 - }, - "identifierName": "e" - }, + "start":34,"end":35,"loc":{"start":{"line":1,"column":34},"end":{"line":1,"column":35},"identifierName":"e"}, "name": "e" } ] @@ -227,80 +69,23 @@ }, "finalizer": { "type": "BlockStatement", - "start": 47, - "end": 65, - "loc": { - "start": { - "line": 1, - "column": 47 - }, - "end": { - "line": 1, - "column": 65 - } - }, + "start":47,"end":65,"loc":{"start":{"line":1,"column":47},"end":{"line":1,"column":65}}, "body": [ { "type": "ExpressionStatement", - "start": 49, - "end": 63, - "loc": { - "start": { - "line": 1, - "column": 49 - }, - "end": { - "line": 1, - "column": 63 - } - }, + "start":49,"end":63,"loc":{"start":{"line":1,"column":49},"end":{"line":1,"column":63}}, "expression": { "type": "CallExpression", - "start": 49, - "end": 63, - "loc": { - "start": { - "line": 1, - "column": 49 - }, - "end": { - "line": 1, - "column": 63 - } - }, + "start":49,"end":63,"loc":{"start":{"line":1,"column":49},"end":{"line":1,"column":63}}, "callee": { "type": "Identifier", - "start": 49, - "end": 56, - "loc": { - "start": { - "line": 1, - "column": 49 - }, - "end": { - "line": 1, - "column": 56 - }, - "identifierName": "cleanup" - }, + "start":49,"end":56,"loc":{"start":{"line":1,"column":49},"end":{"line":1,"column":56},"identifierName":"cleanup"}, "name": "cleanup" }, "arguments": [ { "type": "Identifier", - "start": 57, - "end": 62, - "loc": { - "start": { - "line": 1, - "column": 57 - }, - "end": { - "line": 1, - "column": 62 - }, - "identifierName": "stuff" - }, + "start":57,"end":62,"loc":{"start":{"line":1,"column":57},"end":{"line":1,"column":62},"identifierName":"stuff"}, "name": "stuff" } ] diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/283/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/283/output.json index 86fbfde778b7..a0ef6bdc2f5b 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/283/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/283/output.json @@ -1,48 +1,15 @@ { "type": "File", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "program": { "type": "Program", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "DebuggerStatement", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - } + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}} } ], "directives": [] diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/284/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/284/output.json index d5cdac1d3659..352ffb6fc1d5 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/284/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/284/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, "program": { "type": "Program", - "start": 0, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, "id": { "type": "Identifier", - "start": 9, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 14 - }, - "identifierName": "hello" - }, + "start":9,"end":14,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":14},"identifierName":"hello"}, "name": "hello" }, "generator": false, @@ -65,62 +20,17 @@ "params": [], "body": { "type": "BlockStatement", - "start": 17, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":17,"end":29,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":29}}, "body": [ { "type": "ExpressionStatement", - "start": 19, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":19,"end":27,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":27}}, "expression": { "type": "CallExpression", - "start": 19, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":19,"end":26,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":26}}, "callee": { "type": "Identifier", - "start": 19, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 24 - }, - "identifierName": "sayHi" - }, + "start":19,"end":24,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":24},"identifierName":"sayHi"}, "name": "sayHi" }, "arguments": [] diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/285/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/285/output.json index 3104ab9ccf37..91afc6eae077 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/285/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/285/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, "program": { "type": "Program", - "start": 0, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, "id": { "type": "Identifier", - "start": 9, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 13 - }, - "identifierName": "eval" - }, + "start":9,"end":13,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":13},"identifierName":"eval"}, "name": "eval" }, "generator": false, @@ -65,18 +20,7 @@ "params": [], "body": { "type": "BlockStatement", - "start": 16, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":16,"end":19,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":19}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/286/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/286/output.json index d26abaf0e394..e14cc06b048c 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/286/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/286/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "program": { "type": "Program", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "id": { "type": "Identifier", - "start": 9, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 18 - }, - "identifierName": "arguments" - }, + "start":9,"end":18,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":18},"identifierName":"arguments"}, "name": "arguments" }, "generator": false, @@ -65,18 +20,7 @@ "params": [], "body": { "type": "BlockStatement", - "start": 21, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":21,"end":24,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":24}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/287/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/287/output.json index db77094d7822..02b469112a4e 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/287/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/287/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "program": { "type": "Program", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "id": { "type": "Identifier", - "start": 9, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 13 - }, - "identifierName": "test" - }, + "start":9,"end":13,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":13},"identifierName":"test"}, "name": "test" }, "generator": false, @@ -65,53 +20,18 @@ "params": [ { "type": "Identifier", - "start": 14, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - }, - "identifierName": "t" - }, + "start":14,"end":15,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":15},"identifierName":"t"}, "name": "t" }, { "type": "Identifier", - "start": 17, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - }, - "identifierName": "t" - }, + "start":17,"end":18,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":18},"identifierName":"t"}, "name": "t" } ], "body": { "type": "BlockStatement", - "start": 20, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":20,"end":23,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":23}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/288/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/288/output.json index 1d7e31b52684..518d4ff517eb 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/288/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/288/output.json @@ -1,77 +1,21 @@ { "type": "File", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, "program": { "type": "Program", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, "expression": { "type": "FunctionExpression", - "start": 1, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":1,"end":24,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":24}}, "id": { "type": "Identifier", - "start": 10, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 14 - }, - "identifierName": "test" - }, + "start":10,"end":14,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":14},"identifierName":"test"}, "name": "test" }, "generator": false, @@ -79,53 +23,18 @@ "params": [ { "type": "Identifier", - "start": 15, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - }, - "identifierName": "t" - }, + "start":15,"end":16,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":16},"identifierName":"t"}, "name": "t" }, { "type": "Identifier", - "start": 18, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - }, - "identifierName": "t" - }, + "start":18,"end":19,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":19},"identifierName":"t"}, "name": "t" } ], "body": { "type": "BlockStatement", - "start": 21, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":21,"end":24,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":24}}, "body": [], "directives": [] }, diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/289/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/289/output.json index 77acd2e88e34..68368affc159 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/289/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/289/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 53, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 53 - } - }, + "start":0,"end":53,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":53}}, "program": { "type": "Program", - "start": 0, - "end": 53, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 53 - } - }, + "start":0,"end":53,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":53}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 53, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 53 - } - }, + "start":0,"end":53,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":53}}, "id": { "type": "Identifier", - "start": 9, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 13 - }, - "identifierName": "eval" - }, + "start":9,"end":13,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":13},"identifierName":"eval"}, "name": "eval" }, "generator": false, @@ -65,48 +20,14 @@ "params": [], "body": { "type": "BlockStatement", - "start": 16, - "end": 53, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 53 - } - }, + "start":16,"end":53,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":53}}, "body": [ { "type": "FunctionDeclaration", - "start": 18, - "end": 51, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 51 - } - }, + "start":18,"end":51,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":51}}, "id": { "type": "Identifier", - "start": 27, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 32 - }, - "identifierName": "inner" - }, + "start":27,"end":32,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":32},"identifierName":"inner"}, "name": "inner" }, "generator": false, @@ -114,48 +35,15 @@ "params": [], "body": { "type": "BlockStatement", - "start": 35, - "end": 51, - "loc": { - "start": { - "line": 1, - "column": 35 - }, - "end": { - "line": 1, - "column": 51 - } - }, + "start":35,"end":51,"loc":{"start":{"line":1,"column":35},"end":{"line":1,"column":51}}, "body": [], "directives": [ { "type": "Directive", - "start": 37, - "end": 49, - "loc": { - "start": { - "line": 1, - "column": 37 - }, - "end": { - "line": 1, - "column": 49 - } - }, + "start":37,"end":49,"loc":{"start":{"line":1,"column":37},"end":{"line":1,"column":49}}, "value": { "type": "DirectiveLiteral", - "start": 37, - "end": 49, - "loc": { - "start": { - "line": 1, - "column": 37 - }, - "end": { - "line": 1, - "column": 49 - } - }, + "start":37,"end":49,"loc":{"start":{"line":1,"column":37},"end":{"line":1,"column":49}}, "value": "use strict", "extra": { "raw": "\"use strict\"", diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/29/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/29/output.json index ea4245152521..834b20a1ebcd 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/29/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/29/output.json @@ -1,125 +1,35 @@ { "type": "File", - "start": 0, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":38}}, "program": { "type": "Program", - "start": 0, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":38}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":38}}, "expression": { "type": "AssignmentExpression", - "start": 0, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":38}}, "operator": "=", "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "right": { "type": "ObjectExpression", - "start": 4, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":4,"end":38,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":38}}, "properties": [ { "type": "ObjectMethod", - "start": 6, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":6,"end":36,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":36}}, "method": false, "key": { "type": "Identifier", - "start": 10, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 15 - }, - "identifierName": "width" - }, + "start":10,"end":15,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":15},"identifierName":"width"}, "name": "width" }, "computed": false, @@ -130,48 +40,14 @@ "params": [], "body": { "type": "BlockStatement", - "start": 18, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":18,"end":36,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":36}}, "body": [ { "type": "ReturnStatement", - "start": 20, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":20,"end":34,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":34}}, "argument": { "type": "Identifier", - "start": 27, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 34 - }, - "identifierName": "m_width" - }, + "start":27,"end":34,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":34},"identifierName":"m_width"}, "name": "m_width" } } diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/290/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/290/output.json index a0915a8bde84..058bf6f3e4a8 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/290/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/290/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, "program": { "type": "Program", - "start": 0, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, "id": { "type": "Identifier", - "start": 9, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 14 - }, - "identifierName": "hello" - }, + "start":9,"end":14,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":14},"identifierName":"hello"}, "name": "hello" }, "generator": false, @@ -65,80 +20,23 @@ "params": [ { "type": "Identifier", - "start": 15, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - }, - "identifierName": "a" - }, + "start":15,"end":16,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":16},"identifierName":"a"}, "name": "a" } ], "body": { "type": "BlockStatement", - "start": 18, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":18,"end":30,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":30}}, "body": [ { "type": "ExpressionStatement", - "start": 20, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":20,"end":28,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":28}}, "expression": { "type": "CallExpression", - "start": 20, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":20,"end":27,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":27}}, "callee": { "type": "Identifier", - "start": 20, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 25 - }, - "identifierName": "sayHi" - }, + "start":20,"end":25,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":25},"identifierName":"sayHi"}, "name": "sayHi" }, "arguments": [] diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/291/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/291/output.json index 4a6668b95a21..2c224fe25348 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/291/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/291/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, "program": { "type": "Program", - "start": 0, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, "id": { "type": "Identifier", - "start": 9, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 14 - }, - "identifierName": "hello" - }, + "start":9,"end":14,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":14},"identifierName":"hello"}, "name": "hello" }, "generator": false, @@ -65,97 +20,28 @@ "params": [ { "type": "Identifier", - "start": 15, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - }, - "identifierName": "a" - }, + "start":15,"end":16,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":16},"identifierName":"a"}, "name": "a" }, { "type": "Identifier", - "start": 18, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - }, - "identifierName": "b" - }, + "start":18,"end":19,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":19},"identifierName":"b"}, "name": "b" } ], "body": { "type": "BlockStatement", - "start": 21, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":21,"end":33,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":33}}, "body": [ { "type": "ExpressionStatement", - "start": 23, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":23,"end":31,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":31}}, "expression": { "type": "CallExpression", - "start": 23, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":23,"end":30,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":30}}, "callee": { "type": "Identifier", - "start": 23, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 28 - }, - "identifierName": "sayHi" - }, + "start":23,"end":28,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":28},"identifierName":"sayHi"}, "name": "sayHi" }, "arguments": [] diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/292/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/292/output.json index a110a24d4331..fded91217c51 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/292/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/292/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, "program": { "type": "Program", - "start": 0, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, "id": { "type": "Identifier", - "start": 9, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 14 - }, - "identifierName": "hello" - }, + "start":9,"end":14,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":14},"identifierName":"hello"}, "name": "hello" }, "generator": false, @@ -65,51 +20,17 @@ "params": [ { "type": "RestElement", - "start": 15, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":15,"end":22,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":22}}, "argument": { "type": "Identifier", - "start": 18, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 22 - }, - "identifierName": "rest" - }, + "start":18,"end":22,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":22},"identifierName":"rest"}, "name": "rest" } } ], "body": { "type": "BlockStatement", - "start": 24, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":24,"end":27,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":27}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/293/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/293/output.json index 9750c148e9bc..3cacc47f31a2 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/293/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/293/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, "program": { "type": "Program", - "start": 0, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, "id": { "type": "Identifier", - "start": 9, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 14 - }, - "identifierName": "hello" - }, + "start":9,"end":14,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":14},"identifierName":"hello"}, "name": "hello" }, "generator": false, @@ -65,68 +20,22 @@ "params": [ { "type": "Identifier", - "start": 15, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - }, - "identifierName": "a" - }, + "start":15,"end":16,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":16},"identifierName":"a"}, "name": "a" }, { "type": "RestElement", - "start": 18, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":18,"end":25,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":25}}, "argument": { "type": "Identifier", - "start": 21, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 25 - }, - "identifierName": "rest" - }, + "start":21,"end":25,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":25},"identifierName":"rest"}, "name": "rest" } } ], "body": { "type": "BlockStatement", - "start": 27, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":27,"end":30,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":30}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/294/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/294/output.json index ad99f992e1de..834ffa769d2b 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/294/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/294/output.json @@ -1,156 +1,44 @@ { "type": "File", - "start": 0, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, "program": { "type": "Program", - "start": 0, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":4,"end":31,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":31}}, "id": { "type": "Identifier", - "start": 4, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "hi" - }, + "start":4,"end":6,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":6},"identifierName":"hi"}, "name": "hi" }, "init": { "type": "FunctionExpression", - "start": 9, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":9,"end":31,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":31}}, "id": null, "generator": false, "async": false, "params": [], "body": { "type": "BlockStatement", - "start": 20, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":20,"end":31,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":31}}, "body": [ { "type": "ExpressionStatement", - "start": 22, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":22,"end":29,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":29}}, "expression": { "type": "CallExpression", - "start": 22, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":22,"end":29,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":29}}, "callee": { "type": "Identifier", - "start": 22, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 27 - }, - "identifierName": "sayHi" - }, + "start":22,"end":27,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":27},"identifierName":"sayHi"}, "name": "sayHi" }, "arguments": [] diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/295/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/295/output.json index bc58b1136578..843a9d4db0b2 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/295/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/295/output.json @@ -1,189 +1,54 @@ { "type": "File", - "start": 0, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 37 - } - }, + "start":0,"end":37,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":37}}, "program": { "type": "Program", - "start": 0, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 37 - } - }, + "start":0,"end":37,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":37}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 37 - } - }, + "start":0,"end":37,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":37}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":4,"end":36,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":36}}, "id": { "type": "Identifier", - "start": 4, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "hi" - }, + "start":4,"end":6,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":6},"identifierName":"hi"}, "name": "hi" }, "init": { "type": "FunctionExpression", - "start": 9, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":9,"end":36,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":36}}, "id": null, "generator": false, "async": false, "params": [ { "type": "RestElement", - "start": 19, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":19,"end":23,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":23}}, "argument": { "type": "Identifier", - "start": 22, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 23 - }, - "identifierName": "r" - }, + "start":22,"end":23,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":23},"identifierName":"r"}, "name": "r" } } ], "body": { "type": "BlockStatement", - "start": 25, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":25,"end":36,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":36}}, "body": [ { "type": "ExpressionStatement", - "start": 27, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":27,"end":34,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":34}}, "expression": { "type": "CallExpression", - "start": 27, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":27,"end":34,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":34}}, "callee": { "type": "Identifier", - "start": 27, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 32 - }, - "identifierName": "sayHi" - }, + "start":27,"end":32,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":32},"identifierName":"sayHi"}, "name": "sayHi" }, "arguments": [] diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/296/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/296/output.json index c6c506d5446a..902977b89965 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/296/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/296/output.json @@ -1,109 +1,30 @@ { "type": "File", - "start": 0, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, "program": { "type": "Program", - "start": 0, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":4,"end":28,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":28}}, "id": { "type": "Identifier", - "start": 4, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "hi" - }, + "start":4,"end":6,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":6},"identifierName":"hi"}, "name": "hi" }, "init": { "type": "FunctionExpression", - "start": 9, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":9,"end":28,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":28}}, "id": { "type": "Identifier", - "start": 18, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 22 - }, - "identifierName": "eval" - }, + "start":18,"end":22,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":22},"identifierName":"eval"}, "name": "eval" }, "generator": false, @@ -111,18 +32,7 @@ "params": [], "body": { "type": "BlockStatement", - "start": 25, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":25,"end":28,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":28}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/297/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/297/output.json index 2c6c0d75a8da..695e91aedd01 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/297/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/297/output.json @@ -1,109 +1,30 @@ { "type": "File", - "start": 0, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, "program": { "type": "Program", - "start": 0, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":4,"end":33,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":33}}, "id": { "type": "Identifier", - "start": 4, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "hi" - }, + "start":4,"end":6,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":6},"identifierName":"hi"}, "name": "hi" }, "init": { "type": "FunctionExpression", - "start": 9, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":9,"end":33,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":33}}, "id": { "type": "Identifier", - "start": 18, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 27 - }, - "identifierName": "arguments" - }, + "start":18,"end":27,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":27},"identifierName":"arguments"}, "name": "arguments" }, "generator": false, @@ -111,18 +32,7 @@ "params": [], "body": { "type": "BlockStatement", - "start": 30, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":30,"end":33,"loc":{"start":{"line":1,"column":30},"end":{"line":1,"column":33}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/298/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/298/output.json index 7f0a025696fd..26b3458197ef 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/298/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/298/output.json @@ -1,109 +1,30 @@ { "type": "File", - "start": 0, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":38}}, "program": { "type": "Program", - "start": 0, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":38}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":38}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 37 - } - }, + "start":4,"end":37,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":37}}, "id": { "type": "Identifier", - "start": 4, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "hello" - }, + "start":4,"end":9,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":9},"identifierName":"hello"}, "name": "hello" }, "init": { "type": "FunctionExpression", - "start": 12, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 37 - } - }, + "start":12,"end":37,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":37}}, "id": { "type": "Identifier", - "start": 21, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 23 - }, - "identifierName": "hi" - }, + "start":21,"end":23,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":23},"identifierName":"hi"}, "name": "hi" }, "generator": false, @@ -111,62 +32,17 @@ "params": [], "body": { "type": "BlockStatement", - "start": 26, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 37 - } - }, + "start":26,"end":37,"loc":{"start":{"line":1,"column":26},"end":{"line":1,"column":37}}, "body": [ { "type": "ExpressionStatement", - "start": 28, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":28,"end":35,"loc":{"start":{"line":1,"column":28},"end":{"line":1,"column":35}}, "expression": { "type": "CallExpression", - "start": 28, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":28,"end":35,"loc":{"start":{"line":1,"column":28},"end":{"line":1,"column":35}}, "callee": { "type": "Identifier", - "start": 28, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 33 - }, - "identifierName": "sayHi" - }, + "start":28,"end":33,"loc":{"start":{"line":1,"column":28},"end":{"line":1,"column":33},"identifierName":"sayHi"}, "name": "sayHi" }, "arguments": [] diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/299/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/299/output.json index aefb638ad9fc..cbd2d18d221d 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/299/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/299/output.json @@ -1,80 +1,25 @@ { "type": "File", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "program": { "type": "Program", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "expression": { "type": "FunctionExpression", - "start": 1, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":1,"end":13,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":13}}, "id": null, "generator": false, "async": false, "params": [], "body": { "type": "BlockStatement", - "start": 11, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":11,"end":13,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":13}}, "body": [], "directives": [] }, diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/3/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/3/output.json index bf57e074ccea..ab48d0f9efad 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/3/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/3/output.json @@ -1,62 +1,18 @@ { "type": "File", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 6 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":6}}, "program": { "type": "Program", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 6 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":6}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 5, - "end": 7, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 6 - } - }, + "start":5,"end":7,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":6}}, "expression": { "type": "NumericLiteral", - "start": 5, - "end": 7, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 6 - } - }, + "start":5,"end":7,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":6}}, "extra": { "rawValue": 42, "raw": "42" diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/30/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/30/output.json index 9392a4586df7..67a3af336f2c 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/30/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/30/output.json @@ -1,125 +1,35 @@ { "type": "File", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "program": { "type": "Program", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "expression": { "type": "AssignmentExpression", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "operator": "=", "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "right": { "type": "ObjectExpression", - "start": 4, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":4,"end":22,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":22}}, "properties": [ { "type": "ObjectMethod", - "start": 6, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":6,"end":20,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":20}}, "method": false, "key": { "type": "Identifier", - "start": 10, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 15 - }, - "identifierName": "undef" - }, + "start":10,"end":15,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":15},"identifierName":"undef"}, "name": "undef" }, "computed": false, @@ -130,18 +40,7 @@ "params": [], "body": { "type": "BlockStatement", - "start": 18, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":18,"end":20,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":20}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/300/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/300/output.json index 110a8a000bfa..2b437f12048b 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/300/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/300/output.json @@ -1,126 +1,36 @@ { "type": "File", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 5 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":5}}, "program": { "type": "Program", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 5 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":5}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "BlockStatement", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 5 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":5}}, "body": [ { "type": "ExpressionStatement", - "start": 2, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 3 - } - }, + "start":2,"end":3,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":3}}, "expression": { "type": "Identifier", - "start": 2, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 3 - }, - "identifierName": "x" - }, + "start":2,"end":3,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":3},"identifierName":"x"}, "name": "x" } }, { "type": "ExpressionStatement", - "start": 4, - "end": 7, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 3 - } - }, + "start":4,"end":7,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":3}}, "expression": { "type": "UpdateExpression", - "start": 4, - "end": 7, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 3 - } - }, + "start":4,"end":7,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":3}}, "operator": "++", "prefix": true, "argument": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 3 - }, - "identifierName": "y" - }, + "start":6,"end":7,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":3},"identifierName":"y"}, "name": "y" } } diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/301/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/301/output.json index 867fc3fc002c..c289ddae854b 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/301/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/301/output.json @@ -1,126 +1,36 @@ { "type": "File", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 5 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":5}}, "program": { "type": "Program", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 5 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":5}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "BlockStatement", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 5 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":5}}, "body": [ { "type": "ExpressionStatement", - "start": 2, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 3 - } - }, + "start":2,"end":3,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":3}}, "expression": { "type": "Identifier", - "start": 2, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 3 - }, - "identifierName": "x" - }, + "start":2,"end":3,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":3},"identifierName":"x"}, "name": "x" } }, { "type": "ExpressionStatement", - "start": 4, - "end": 7, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 3 - } - }, + "start":4,"end":7,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":3}}, "expression": { "type": "UpdateExpression", - "start": 4, - "end": 7, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 3 - } - }, + "start":4,"end":7,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":3}}, "operator": "--", "prefix": true, "argument": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 3 - }, - "identifierName": "y" - }, + "start":6,"end":7,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":3},"identifierName":"y"}, "name": "y" } } diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/302/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/302/output.json index 412ba4db54fc..6ee561c3d41d 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/302/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/302/output.json @@ -1,78 +1,22 @@ { "type": "File", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, "program": { "type": "Program", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5}}, "id": { "type": "Identifier", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "x" - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"x"}, "name": "x" }, "init": null, @@ -80,18 +24,7 @@ { "type": "CommentBlock", "value": " comment ", - "start": 6, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 19 - } - } + "start":6,"end":19,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":19}} } ] } @@ -105,18 +38,7 @@ { "type": "CommentBlock", "value": " comment ", - "start": 6, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 19 - } - } + "start":6,"end":19,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":19}} } ] } \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/303/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/303/output.json index d4e339d66f8b..fb37cb7dd911 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/303/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/303/output.json @@ -1,109 +1,31 @@ { "type": "File", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 4 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":4}}, "program": { "type": "Program", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 4 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":4}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "BlockStatement", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 4 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":4}}, "body": [ { "type": "VariableDeclaration", - "start": 2, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":2,"end":19,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":19}}, "declarations": [ { "type": "VariableDeclarator", - "start": 6, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":6,"end":12,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":12}}, "id": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "x" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"x"}, "name": "x" }, "init": { "type": "NumericLiteral", - "start": 10, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":10,"end":12,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":12}}, "extra": { "rawValue": 14, "raw": "14" @@ -113,49 +35,15 @@ }, { "type": "VariableDeclarator", - "start": 14, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":14,"end":19,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":19}}, "id": { "type": "Identifier", - "start": 14, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - }, - "identifierName": "y" - }, + "start":14,"end":15,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":15},"identifierName":"y"}, "name": "y" }, "init": { "type": "NumericLiteral", - "start": 18, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":18,"end":19,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":19}}, "extra": { "rawValue": 3, "raw": "3" @@ -168,33 +56,10 @@ }, { "type": "ExpressionStatement", - "start": 20, - "end": 22, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 2 - } - }, + "start":20,"end":22,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":2}}, "expression": { "type": "Identifier", - "start": 20, - "end": 21, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 1 - }, - "identifierName": "z" - }, + "start":20,"end":21,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":1},"identifierName":"z"}, "name": "z" } } diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/304/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/304/output.json index ccd2a5557c69..50691134a049 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/304/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/304/output.json @@ -1,124 +1,35 @@ { "type": "File", - "start": 0, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 8 - } - }, + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":8}}, "program": { "type": "Program", - "start": 0, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 8 - } - }, + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":8}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "WhileStatement", - "start": 0, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 8 - } - }, + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":8}}, "test": { "type": "BooleanLiteral", - "start": 7, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":7,"end":11,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":11}}, "value": true }, "body": { "type": "BlockStatement", - "start": 13, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 2, - "column": 8 - } - }, + "start":13,"end":32,"loc":{"start":{"line":1,"column":13},"end":{"line":2,"column":8}}, "body": [ { "type": "ContinueStatement", - "start": 15, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":15,"end":23,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":23}}, "label": null }, { "type": "ExpressionStatement", - "start": 24, - "end": 30, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 6 - } - }, + "start":24,"end":30,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":6}}, "expression": { "type": "Identifier", - "start": 24, - "end": 29, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 5 - }, - "identifierName": "there" - }, + "start":24,"end":29,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":5},"identifierName":"there"}, "name": "there" } } diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/305/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/305/output.json index 3fcb48aa328a..79fce2dd496e 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/305/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/305/output.json @@ -1,160 +1,49 @@ { "type": "File", - "start": 0, - "end": 43, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 8 - } - }, + "start":0,"end":43,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":8}}, "program": { "type": "Program", - "start": 0, - "end": 43, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 8 - } - }, + "start":0,"end":43,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":8}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "WhileStatement", - "start": 0, - "end": 43, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 8 - } - }, + "start":0,"end":43,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":8}}, "test": { "type": "BooleanLiteral", - "start": 7, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":7,"end":11,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":11}}, "value": true }, "body": { "type": "BlockStatement", - "start": 13, - "end": 43, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 2, - "column": 8 - } - }, + "start":13,"end":43,"loc":{"start":{"line":1,"column":13},"end":{"line":2,"column":8}}, "body": [ { "type": "ContinueStatement", - "start": 15, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":15,"end":23,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":23}}, "label": null, "trailingComments": [ { "type": "CommentLine", "value": " Comment", - "start": 24, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 34 - } - } + "start":24,"end":34,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":34}} } ] }, { "type": "ExpressionStatement", - "start": 35, - "end": 41, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 6 - } - }, + "start":35,"end":41,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":6}}, "expression": { "type": "Identifier", - "start": 35, - "end": 40, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 5 - }, - "identifierName": "there" - }, + "start":35,"end":40,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":5},"identifierName":"there"}, "name": "there" }, "leadingComments": [ { "type": "CommentLine", "value": " Comment", - "start": 24, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 34 - } - } + "start":24,"end":34,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":34}} } ] } @@ -169,18 +58,7 @@ { "type": "CommentLine", "value": " Comment", - "start": 24, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 34 - } - } + "start":24,"end":34,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":34}} } ] } \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/306/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/306/output.json index 395230285f43..a496fcfd3a10 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/306/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/306/output.json @@ -1,160 +1,49 @@ { "type": "File", - "start": 0, - "end": 55, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 18 - } - }, + "start":0,"end":55,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":18}}, "program": { "type": "Program", - "start": 0, - "end": 55, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 18 - } - }, + "start":0,"end":55,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":18}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "WhileStatement", - "start": 0, - "end": 55, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 18 - } - }, + "start":0,"end":55,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":18}}, "test": { "type": "BooleanLiteral", - "start": 7, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":7,"end":11,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":11}}, "value": true }, "body": { "type": "BlockStatement", - "start": 13, - "end": 55, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 2, - "column": 18 - } - }, + "start":13,"end":55,"loc":{"start":{"line":1,"column":13},"end":{"line":2,"column":18}}, "body": [ { "type": "ContinueStatement", - "start": 15, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":15,"end":23,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":23}}, "label": null, "trailingComments": [ { "type": "CommentBlock", "value": " Multiline\nComment ", - "start": 24, - "end": 47, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 2, - "column": 10 - } - } + "start":24,"end":47,"loc":{"start":{"line":1,"column":24},"end":{"line":2,"column":10}} } ] }, { "type": "ExpressionStatement", - "start": 47, - "end": 53, - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 16 - } - }, + "start":47,"end":53,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":16}}, "expression": { "type": "Identifier", - "start": 47, - "end": 52, - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 15 - }, - "identifierName": "there" - }, + "start":47,"end":52,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":15},"identifierName":"there"}, "name": "there" }, "leadingComments": [ { "type": "CommentBlock", "value": " Multiline\nComment ", - "start": 24, - "end": 47, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 2, - "column": 10 - } - } + "start":24,"end":47,"loc":{"start":{"line":1,"column":24},"end":{"line":2,"column":10}} } ] } @@ -169,18 +58,7 @@ { "type": "CommentBlock", "value": " Multiline\nComment ", - "start": 24, - "end": 47, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 2, - "column": 10 - } - } + "start":24,"end":47,"loc":{"start":{"line":1,"column":24},"end":{"line":2,"column":10}} } ] } \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/307/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/307/output.json index 40442d2489fb..8e6358875358 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/307/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/307/output.json @@ -1,124 +1,35 @@ { "type": "File", - "start": 0, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 8 - } - }, + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":8}}, "program": { "type": "Program", - "start": 0, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 8 - } - }, + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":8}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "WhileStatement", - "start": 0, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 8 - } - }, + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":8}}, "test": { "type": "BooleanLiteral", - "start": 7, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":7,"end":11,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":11}}, "value": true }, "body": { "type": "BlockStatement", - "start": 13, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 2, - "column": 8 - } - }, + "start":13,"end":29,"loc":{"start":{"line":1,"column":13},"end":{"line":2,"column":8}}, "body": [ { "type": "BreakStatement", - "start": 15, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":15,"end":20,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":20}}, "label": null }, { "type": "ExpressionStatement", - "start": 21, - "end": 27, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 6 - } - }, + "start":21,"end":27,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":6}}, "expression": { "type": "Identifier", - "start": 21, - "end": 26, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 5 - }, - "identifierName": "there" - }, + "start":21,"end":26,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":5},"identifierName":"there"}, "name": "there" } } diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/308/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/308/output.json index 074c0c8bb638..db5aabc02b2b 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/308/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/308/output.json @@ -1,160 +1,49 @@ { "type": "File", - "start": 0, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 8 - } - }, + "start":0,"end":40,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":8}}, "program": { "type": "Program", - "start": 0, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 8 - } - }, + "start":0,"end":40,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":8}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "WhileStatement", - "start": 0, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 8 - } - }, + "start":0,"end":40,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":8}}, "test": { "type": "BooleanLiteral", - "start": 7, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":7,"end":11,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":11}}, "value": true }, "body": { "type": "BlockStatement", - "start": 13, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 2, - "column": 8 - } - }, + "start":13,"end":40,"loc":{"start":{"line":1,"column":13},"end":{"line":2,"column":8}}, "body": [ { "type": "BreakStatement", - "start": 15, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":15,"end":20,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":20}}, "label": null, "trailingComments": [ { "type": "CommentLine", "value": " Comment", - "start": 21, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 31 - } - } + "start":21,"end":31,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":31}} } ] }, { "type": "ExpressionStatement", - "start": 32, - "end": 38, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 6 - } - }, + "start":32,"end":38,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":6}}, "expression": { "type": "Identifier", - "start": 32, - "end": 37, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 5 - }, - "identifierName": "there" - }, + "start":32,"end":37,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":5},"identifierName":"there"}, "name": "there" }, "leadingComments": [ { "type": "CommentLine", "value": " Comment", - "start": 21, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 31 - } - } + "start":21,"end":31,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":31}} } ] } @@ -169,18 +58,7 @@ { "type": "CommentLine", "value": " Comment", - "start": 21, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 31 - } - } + "start":21,"end":31,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":31}} } ] } \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/309/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/309/output.json index f58cfb077883..07e673f84ee2 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/309/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/309/output.json @@ -1,160 +1,49 @@ { "type": "File", - "start": 0, - "end": 52, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 18 - } - }, + "start":0,"end":52,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":18}}, "program": { "type": "Program", - "start": 0, - "end": 52, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 18 - } - }, + "start":0,"end":52,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":18}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "WhileStatement", - "start": 0, - "end": 52, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 18 - } - }, + "start":0,"end":52,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":18}}, "test": { "type": "BooleanLiteral", - "start": 7, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":7,"end":11,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":11}}, "value": true }, "body": { "type": "BlockStatement", - "start": 13, - "end": 52, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 2, - "column": 18 - } - }, + "start":13,"end":52,"loc":{"start":{"line":1,"column":13},"end":{"line":2,"column":18}}, "body": [ { "type": "BreakStatement", - "start": 15, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":15,"end":20,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":20}}, "label": null, "trailingComments": [ { "type": "CommentBlock", "value": " Multiline\nComment ", - "start": 21, - "end": 44, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 2, - "column": 10 - } - } + "start":21,"end":44,"loc":{"start":{"line":1,"column":21},"end":{"line":2,"column":10}} } ] }, { "type": "ExpressionStatement", - "start": 44, - "end": 50, - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 16 - } - }, + "start":44,"end":50,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":16}}, "expression": { "type": "Identifier", - "start": 44, - "end": 49, - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 15 - }, - "identifierName": "there" - }, + "start":44,"end":49,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":15},"identifierName":"there"}, "name": "there" }, "leadingComments": [ { "type": "CommentBlock", "value": " Multiline\nComment ", - "start": 21, - "end": 44, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 2, - "column": 10 - } - } + "start":21,"end":44,"loc":{"start":{"line":1,"column":21},"end":{"line":2,"column":10}} } ] } @@ -169,18 +58,7 @@ { "type": "CommentBlock", "value": " Multiline\nComment ", - "start": 21, - "end": 44, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 2, - "column": 10 - } - } + "start":21,"end":44,"loc":{"start":{"line":1,"column":21},"end":{"line":2,"column":10}} } ] } \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/31/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/31/output.json index 96fd3b7e93cb..0bd7432907df 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/31/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/31/output.json @@ -1,125 +1,35 @@ { "type": "File", - "start": 0, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, "program": { "type": "Program", - "start": 0, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, "expression": { "type": "AssignmentExpression", - "start": 0, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, "operator": "=", "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "right": { "type": "ObjectExpression", - "start": 4, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":4,"end":19,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":19}}, "properties": [ { "type": "ObjectMethod", - "start": 6, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":6,"end":17,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":17}}, "method": false, "key": { "type": "Identifier", - "start": 10, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "if" - }, + "start":10,"end":12,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":12},"identifierName":"if"}, "name": "if" }, "computed": false, @@ -130,18 +40,7 @@ "params": [], "body": { "type": "BlockStatement", - "start": 15, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":15,"end":17,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":17}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/310/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/310/output.json index a6f087d5e25f..90a7b471fe11 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/310/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/310/output.json @@ -1,126 +1,37 @@ { "type": "File", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 5 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":5}}, "program": { "type": "Program", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 5 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":5}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 5 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":5}}, "expression": { "type": "FunctionExpression", - "start": 1, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 2, - "column": 4 - } - }, + "start":1,"end":24,"loc":{"start":{"line":1,"column":1},"end":{"line":2,"column":4}}, "id": null, "generator": false, "async": false, "params": [], "body": { "type": "BlockStatement", - "start": 11, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 2, - "column": 4 - } - }, + "start":11,"end":24,"loc":{"start":{"line":1,"column":11},"end":{"line":2,"column":4}}, "body": [ { "type": "ReturnStatement", - "start": 13, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":13,"end":19,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":19}}, "argument": null }, { "type": "ExpressionStatement", - "start": 20, - "end": 22, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 2 - } - }, + "start":20,"end":22,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":2}}, "expression": { "type": "Identifier", - "start": 20, - "end": 21, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 1 - }, - "identifierName": "x" - }, + "start":20,"end":21,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":1},"identifierName":"x"}, "name": "x" } } diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/311/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/311/output.json index 205e7e5731fe..636d44f1cad8 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/311/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/311/output.json @@ -1,162 +1,51 @@ { "type": "File", - "start": 0, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 5 - } - }, + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":5}}, "program": { "type": "Program", - "start": 0, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 5 - } - }, + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":5}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 5 - } - }, + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":5}}, "expression": { "type": "FunctionExpression", - "start": 1, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 2, - "column": 4 - } - }, + "start":1,"end":35,"loc":{"start":{"line":1,"column":1},"end":{"line":2,"column":4}}, "id": null, "generator": false, "async": false, "params": [], "body": { "type": "BlockStatement", - "start": 11, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 2, - "column": 4 - } - }, + "start":11,"end":35,"loc":{"start":{"line":1,"column":11},"end":{"line":2,"column":4}}, "body": [ { "type": "ReturnStatement", - "start": 13, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":13,"end":19,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":19}}, "argument": null, "trailingComments": [ { "type": "CommentLine", "value": " Comment", - "start": 20, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 30 - } - } + "start":20,"end":30,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":30}} } ] }, { "type": "ExpressionStatement", - "start": 31, - "end": 33, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 2 - } - }, + "start":31,"end":33,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":2}}, "expression": { "type": "Identifier", - "start": 31, - "end": 32, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 1 - }, - "identifierName": "x" - }, + "start":31,"end":32,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":1},"identifierName":"x"}, "name": "x" }, "leadingComments": [ { "type": "CommentLine", "value": " Comment", - "start": 20, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 30 - } - } + "start":20,"end":30,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":30}} } ] } @@ -176,18 +65,7 @@ { "type": "CommentLine", "value": " Comment", - "start": 20, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 30 - } - } + "start":20,"end":30,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":30}} } ] } \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/312/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/312/output.json index 98570e79f91b..a7c128bbeb82 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/312/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/312/output.json @@ -1,162 +1,51 @@ { "type": "File", - "start": 0, - "end": 47, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 15 - } - }, + "start":0,"end":47,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":15}}, "program": { "type": "Program", - "start": 0, - "end": 47, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 15 - } - }, + "start":0,"end":47,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":15}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 47, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 15 - } - }, + "start":0,"end":47,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":15}}, "expression": { "type": "FunctionExpression", - "start": 1, - "end": 46, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 2, - "column": 14 - } - }, + "start":1,"end":46,"loc":{"start":{"line":1,"column":1},"end":{"line":2,"column":14}}, "id": null, "generator": false, "async": false, "params": [], "body": { "type": "BlockStatement", - "start": 11, - "end": 46, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 2, - "column": 14 - } - }, + "start":11,"end":46,"loc":{"start":{"line":1,"column":11},"end":{"line":2,"column":14}}, "body": [ { "type": "ReturnStatement", - "start": 13, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":13,"end":19,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":19}}, "argument": null, "trailingComments": [ { "type": "CommentBlock", "value": " Multiline\nComment ", - "start": 19, - "end": 42, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 2, - "column": 10 - } - } + "start":19,"end":42,"loc":{"start":{"line":1,"column":19},"end":{"line":2,"column":10}} } ] }, { "type": "ExpressionStatement", - "start": 42, - "end": 44, - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 12 - } - }, + "start":42,"end":44,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":12}}, "expression": { "type": "Identifier", - "start": 42, - "end": 43, - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 11 - }, - "identifierName": "x" - }, + "start":42,"end":43,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":11},"identifierName":"x"}, "name": "x" }, "leadingComments": [ { "type": "CommentBlock", "value": " Multiline\nComment ", - "start": 19, - "end": 42, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 2, - "column": 10 - } - } + "start":19,"end":42,"loc":{"start":{"line":1,"column":19},"end":{"line":2,"column":10}} } ] } @@ -176,18 +65,7 @@ { "type": "CommentBlock", "value": " Multiline\nComment ", - "start": 19, - "end": 42, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 2, - "column": 10 - } - } + "start":19,"end":42,"loc":{"start":{"line":1,"column":19},"end":{"line":2,"column":10}} } ] } \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/313/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/313/output.json index aed9954aa3f8..e6e9eaa784ec 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/313/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/313/output.json @@ -1,110 +1,31 @@ { "type": "File", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 8 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":8}}, "program": { "type": "Program", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 8 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":8}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "BlockStatement", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 8 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":8}}, "body": [ { "type": "ThrowStatement", - "start": 2, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":2,"end":13,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":13}}, "argument": { "type": "Identifier", - "start": 8, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 13 - }, - "identifierName": "error" - }, + "start":8,"end":13,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":13},"identifierName":"error"}, "name": "error" } }, { "type": "ExpressionStatement", - "start": 14, - "end": 20, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 6 - } - }, + "start":14,"end":20,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":6}}, "expression": { "type": "Identifier", - "start": 14, - "end": 19, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 5 - }, - "identifierName": "error" - }, + "start":14,"end":19,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":5},"identifierName":"error"}, "name": "error" } } diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/314/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/314/output.json index ab8810f09c9b..5929da115ce5 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/314/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/314/output.json @@ -1,146 +1,45 @@ { "type": "File", - "start": 0, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 8 - } - }, + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":8}}, "program": { "type": "Program", - "start": 0, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 8 - } - }, + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":8}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "BlockStatement", - "start": 0, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 8 - } - }, + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":8}}, "body": [ { "type": "ThrowStatement", - "start": 2, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":2,"end":13,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":13}}, "argument": { "type": "Identifier", - "start": 8, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 13 - }, - "identifierName": "error" - }, + "start":8,"end":13,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":13},"identifierName":"error"}, "name": "error" }, "trailingComments": [ { "type": "CommentLine", "value": " Comment", - "start": 13, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 23 - } - } + "start":13,"end":23,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":23}} } ] }, { "type": "ExpressionStatement", - "start": 24, - "end": 30, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 6 - } - }, + "start":24,"end":30,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":6}}, "expression": { "type": "Identifier", - "start": 24, - "end": 29, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 5 - }, - "identifierName": "error" - }, + "start":24,"end":29,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":5},"identifierName":"error"}, "name": "error" }, "leadingComments": [ { "type": "CommentLine", "value": " Comment", - "start": 13, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 23 - } - } + "start":13,"end":23,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":23}} } ] } @@ -154,18 +53,7 @@ { "type": "CommentLine", "value": " Comment", - "start": 13, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 23 - } - } + "start":13,"end":23,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":23}} } ] } \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/315/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/315/output.json index 183a587ddc76..97e46379c3fa 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/315/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/315/output.json @@ -1,146 +1,45 @@ { "type": "File", - "start": 0, - "end": 44, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 18 - } - }, + "start":0,"end":44,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":18}}, "program": { "type": "Program", - "start": 0, - "end": 44, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 18 - } - }, + "start":0,"end":44,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":18}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "BlockStatement", - "start": 0, - "end": 44, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 18 - } - }, + "start":0,"end":44,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":18}}, "body": [ { "type": "ThrowStatement", - "start": 2, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":2,"end":13,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":13}}, "argument": { "type": "Identifier", - "start": 8, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 13 - }, - "identifierName": "error" - }, + "start":8,"end":13,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":13},"identifierName":"error"}, "name": "error" }, "trailingComments": [ { "type": "CommentBlock", "value": " Multiline\nComment ", - "start": 13, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 2, - "column": 10 - } - } + "start":13,"end":36,"loc":{"start":{"line":1,"column":13},"end":{"line":2,"column":10}} } ] }, { "type": "ExpressionStatement", - "start": 36, - "end": 42, - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 16 - } - }, + "start":36,"end":42,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":16}}, "expression": { "type": "Identifier", - "start": 36, - "end": 41, - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 15 - }, - "identifierName": "error" - }, + "start":36,"end":41,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":15},"identifierName":"error"}, "name": "error" }, "leadingComments": [ { "type": "CommentBlock", "value": " Multiline\nComment ", - "start": 13, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 2, - "column": 10 - } - } + "start":13,"end":36,"loc":{"start":{"line":1,"column":13},"end":{"line":2,"column":10}} } ] } @@ -154,18 +53,7 @@ { "type": "CommentBlock", "value": " Multiline\nComment ", - "start": 13, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 2, - "column": 10 - } - } + "start":13,"end":36,"loc":{"start":{"line":1,"column":13},"end":{"line":2,"column":10}} } ] } \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/316/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/316/output.json index 145f80b57b91..6146b7973972 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/316/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/316/output.json @@ -1,31 +1,9 @@ { "type": "File", - "start": 0, - "end": 0, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 0 - } - }, + "start":0,"end":0,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":0}}, "program": { "type": "Program", - "start": 0, - "end": 0, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 0 - } - }, + "start":0,"end":0,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":0}}, "sourceType": "script", "interpreter": null, "body": [], diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/317/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/317/output.json index 6ff0a1889e20..91415c46c88b 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/317/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/317/output.json @@ -1,107 +1,29 @@ { "type": "File", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, "program": { "type": "Program", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "LabeledStatement", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, "body": { "type": "IfStatement", - "start": 5, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":5,"end":25,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":25}}, "test": { "type": "BooleanLiteral", - "start": 9, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":9,"end":13,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":13}}, "value": true }, "consequent": { "type": "BreakStatement", - "start": 15, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":15,"end":25,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":25}}, "label": { "type": "Identifier", - "start": 21, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 24 - }, - "identifierName": "foo" - }, + "start":21,"end":24,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":24},"identifierName":"foo"}, "name": "foo" } }, @@ -109,19 +31,7 @@ }, "label": { "type": "Identifier", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - }, - "identifierName": "foo" - }, + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3},"identifierName":"foo"}, "name": "foo" } } diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/318/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/318/output.json index c9d958dcaab5..07b0ebfb1a3c 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/318/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/318/output.json @@ -1,124 +1,36 @@ { "type": "File", - "start": 0, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 4 - } - }, + "start":0,"end":40,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":4}}, "program": { "type": "Program", - "start": 0, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 4 - } - }, + "start":0,"end":40,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":4}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 4 - } - }, + "start":0,"end":40,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":4}}, "expression": { "type": "CallExpression", - "start": 1, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 4, - "column": 3 - } - }, + "start":1,"end":39,"loc":{"start":{"line":1,"column":1},"end":{"line":4,"column":3}}, "callee": { "type": "FunctionExpression", - "start": 1, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":1,"end":37,"loc":{"start":{"line":1,"column":1},"end":{"line":4,"column":1}}, "id": null, "generator": false, "async": false, "params": [], "body": { "type": "BlockStatement", - "start": 13, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":13,"end":37,"loc":{"start":{"line":1,"column":13},"end":{"line":4,"column":1}}, "body": [], "directives": [ { "type": "Directive", - "start": 16, - "end": 29, - "loc": { - "start": { - "line": 2, - "column": 1 - }, - "end": { - "line": 2, - "column": 14 - } - }, + "start":16,"end":29,"loc":{"start":{"line":2,"column":1},"end":{"line":2,"column":14}}, "value": { "type": "DirectiveLiteral", - "start": 16, - "end": 28, - "loc": { - "start": { - "line": 2, - "column": 1 - }, - "end": { - "line": 2, - "column": 13 - } - }, + "start":16,"end":28,"loc":{"start":{"line":2,"column":1},"end":{"line":2,"column":13}}, "value": "use strict", "extra": { "raw": "'use strict'", @@ -128,32 +40,10 @@ }, { "type": "Directive", - "start": 31, - "end": 35, - "loc": { - "start": { - "line": 3, - "column": 1 - }, - "end": { - "line": 3, - "column": 5 - } - }, + "start":31,"end":35,"loc":{"start":{"line":3,"column":1},"end":{"line":3,"column":5}}, "value": { "type": "DirectiveLiteral", - "start": 31, - "end": 34, - "loc": { - "start": { - "line": 3, - "column": 1 - }, - "end": { - "line": 3, - "column": 4 - } - }, + "start":31,"end":34,"loc":{"start":{"line":3,"column":1},"end":{"line":3,"column":4}}, "value": "\u0000", "extra": { "raw": "'\u0000'", diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/319/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/319/output.json index 5f9a3670055e..0652e0f83066 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/319/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/319/output.json @@ -1,90 +1,24 @@ { "type": "File", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "program": { "type": "Program", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "expression": { "type": "CallExpression", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "callee": { "type": "MemberExpression", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "object": { "type": "NumericLiteral", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - }, + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, "extra": { "rawValue": 123, "raw": "123." @@ -93,19 +27,7 @@ }, "property": { "type": "Identifier", - "start": 5, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 13 - }, - "identifierName": "toString" - }, + "start":5,"end":13,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":13},"identifierName":"toString"}, "name": "toString" }, "computed": false @@ -113,18 +35,7 @@ "arguments": [ { "type": "NumericLiteral", - "start": 14, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":14,"end":16,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":16}}, "extra": { "rawValue": 10, "raw": "10" diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/32/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/32/output.json index b3ef7da7cabf..dea4eee607a9 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/32/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/32/output.json @@ -1,125 +1,35 @@ { "type": "File", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, "program": { "type": "Program", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, "expression": { "type": "AssignmentExpression", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, "operator": "=", "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "right": { "type": "ObjectExpression", - "start": 4, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":4,"end":21,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":21}}, "properties": [ { "type": "ObjectMethod", - "start": 6, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":6,"end":19,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":19}}, "method": false, "key": { "type": "Identifier", - "start": 10, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 14 - }, - "identifierName": "true" - }, + "start":10,"end":14,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":14},"identifierName":"true"}, "name": "true" }, "computed": false, @@ -130,18 +40,7 @@ "params": [], "body": { "type": "BlockStatement", - "start": 17, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":17,"end":19,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":19}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/320/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/320/output.json index 1b6d860e3cc0..c4cf365f6234 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/320/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/320/output.json @@ -1,76 +1,21 @@ { "type": "File", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "program": { "type": "Program", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "expression": { "type": "BinaryExpression", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "left": { "type": "NumericLiteral", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - }, + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, "extra": { "rawValue": 123, "raw": "123." @@ -80,18 +25,7 @@ "operator": "+", "right": { "type": "NumericLiteral", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, "extra": { "rawValue": 2, "raw": "2" diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/321/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/321/output.json index adac14cf8876..1f23cac3b631 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/321/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/321/output.json @@ -1,95 +1,27 @@ { "type": "File", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 1 - } - }, + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 1 - } - }, + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":1}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1}}, "expression": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "a" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"a"}, "name": "a" } }, { "type": "ExpressionStatement", - "start": 2, - "end": 3, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 1 - } - }, + "start":2,"end":3,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":1}}, "expression": { "type": "Identifier", - "start": 2, - "end": 3, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 1 - }, - "identifierName": "b" - }, + "start":2,"end":3,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":1},"identifierName":"b"}, "name": "b" } } diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/322/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/322/output.json index 511f68de826a..86a454183f22 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/322/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/322/output.json @@ -1,63 +1,19 @@ { "type": "File", - "start": 0, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, "program": { "type": "Program", - "start": 0, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, "sourceType": "script", "interpreter": null, "body": [], "directives": [ { "type": "Directive", - "start": 0, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, "value": { "type": "DirectiveLiteral", - "start": 0, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, "value": "a\\u0026b", "extra": { "raw": "'a\\u0026b'", diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/323/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/323/output.json index 91c5a480cfef..1f2858e789f1 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/323/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/323/output.json @@ -1,76 +1,21 @@ { "type": "File", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "program": { "type": "Program", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "LabeledStatement", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, "body": { "type": "ExpressionStatement", - "start": 5, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":5,"end":8,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":8}}, "expression": { "type": "NumericLiteral", - "start": 5, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":5,"end":7,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":7}}, "extra": { "rawValue": 10, "raw": "10" @@ -80,64 +25,19 @@ }, "label": { "type": "Identifier", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - }, - "identifierName": "foo" - }, + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3},"identifierName":"foo"}, "name": "foo" } }, { "type": "LabeledStatement", - "start": 9, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":9,"end":17,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":17}}, "body": { "type": "ExpressionStatement", - "start": 14, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":14,"end":17,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":17}}, "expression": { "type": "NumericLiteral", - "start": 14, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":14,"end":16,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":16}}, "extra": { "rawValue": 20, "raw": "20" @@ -147,19 +47,7 @@ }, "label": { "type": "Identifier", - "start": 9, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "foo" - }, + "start":9,"end":12,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":12},"identifierName":"foo"}, "name": "foo" } } diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/324/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/324/output.json index db94d9b88a62..e0a04f74bd22 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/324/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/324/output.json @@ -1,62 +1,18 @@ { "type": "File", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, "program": { "type": "Program", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "IfStatement", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, "test": { "type": "NumericLiteral", - "start": 3, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 4 - } - }, + "start":3,"end":4,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":4}}, "extra": { "rawValue": 1, "raw": "1" @@ -65,32 +21,10 @@ }, "consequent": { "type": "ExpressionStatement", - "start": 5, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":5,"end":12,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":12}}, "expression": { "type": "RegExpLiteral", - "start": 5, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":5,"end":12,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":12}}, "extra": { "raw": "/ foo/" }, diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/325/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/325/output.json index 74d07f2d4c0a..58ddd297b509 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/325/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/325/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "program": { "type": "Program", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "expression": { "type": "Identifier", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - }, - "identifierName": "price_9̶9̶_89" - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13},"identifierName":"price_9̶9̶_89"}, "name": "price_9̶9̶_89" } } diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/326/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/326/output.json index 3c7e8925fac6..f86ce18fe58a 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/326/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/326/output.json @@ -1,108 +1,29 @@ { "type": "File", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, "program": { "type": "Program", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, "expression": { "type": "BinaryExpression", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, "left": { "type": "MemberExpression", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - }, + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, "object": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "a" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"a"}, "name": "a" }, "property": { "type": "Identifier", - "start": 2, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 4 - }, - "identifierName": "in" - }, + "start":2,"end":4,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":4},"identifierName":"in"}, "name": "in" }, "computed": false @@ -110,19 +31,7 @@ "operator": "/", "right": { "type": "Identifier", - "start": 7, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - }, - "identifierName": "b" - }, + "start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8},"identifierName":"b"}, "name": "b" } } diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/327/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/327/output.json index e99a33b544eb..53c2b7304b97 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/327/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/327/output.json @@ -1,93 +1,27 @@ { "type": "File", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "program": { "type": "Program", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ReturnStatement", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "argument": { "type": "BinaryExpression", - "start": 7, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":7,"end":13,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":13}}, "left": { "type": "ObjectExpression", - "start": 7, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":7,"end":9,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":9}}, "properties": [] }, "operator": "/", "right": { "type": "NumericLiteral", - "start": 12, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":12,"end":13,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":13}}, "extra": { "rawValue": 2, "raw": "2" diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/328/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/328/output.json index d3904d2ba2e8..7e3261f57e9e 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/328/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/328/output.json @@ -1,95 +1,29 @@ { "type": "File", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 5 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":5}}, "program": { "type": "Program", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 5 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":5}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ReturnStatement", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "argument": null }, { "type": "BlockStatement", - "start": 7, - "end": 9, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 2 - } - }, + "start":7,"end":9,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":2}}, "body": [], "directives": [] }, { "type": "ExpressionStatement", - "start": 10, - "end": 15, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 5 - } - }, + "start":10,"end":15,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":5}}, "expression": { "type": "RegExpLiteral", - "start": 10, - "end": 15, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 5 - } - }, + "start":10,"end":15,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":5}}, "extra": { "raw": "/foo/" }, diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/329/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/329/output.json index 0625ca759796..6601db05807a 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/329/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/329/output.json @@ -1,110 +1,33 @@ { "type": "File", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "program": { "type": "Program", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "expression": { "type": "BinaryExpression", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "left": { "type": "UnaryExpression", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, "operator": "+", "prefix": true, "argument": { "type": "ObjectExpression", - "start": 1, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 3 - } - }, + "start":1,"end":3,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":3}}, "properties": [] } }, "operator": "/", "right": { "type": "NumericLiteral", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7}}, "extra": { "rawValue": 2, "raw": "2" diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/33/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/33/output.json index e055a31d0008..17909837b80f 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/33/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/33/output.json @@ -1,125 +1,35 @@ { "type": "File", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "program": { "type": "Program", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "expression": { "type": "AssignmentExpression", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "operator": "=", "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "right": { "type": "ObjectExpression", - "start": 4, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":4,"end":22,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":22}}, "properties": [ { "type": "ObjectMethod", - "start": 6, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":6,"end":20,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":20}}, "method": false, "key": { "type": "Identifier", - "start": 10, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 15 - }, - "identifierName": "false" - }, + "start":10,"end":15,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":15},"identifierName":"false"}, "name": "false" }, "computed": false, @@ -130,18 +40,7 @@ "params": [], "body": { "type": "BlockStatement", - "start": 18, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":18,"end":20,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":20}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/330/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/330/output.json index 219acad00806..8b551d3126ba 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/330/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/330/output.json @@ -1,79 +1,24 @@ { "type": "File", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 5 - } - }, + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":5}}, "program": { "type": "Program", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 5 - } - }, + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":5}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "BlockStatement", - "start": 0, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 2 - } - }, + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}}, "body": [], "directives": [] }, { "type": "ExpressionStatement", - "start": 3, - "end": 8, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 5 - } - }, + "start":3,"end":8,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":5}}, "expression": { "type": "RegExpLiteral", - "start": 3, - "end": 8, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 5 - } - }, + "start":3,"end":8,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":5}}, "extra": { "raw": "/foo/" }, diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/331/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/331/output.json index 5d71c2b58f20..afb15fd5fb13 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/331/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/331/output.json @@ -1,128 +1,39 @@ { "type": "File", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 5 - } - }, + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":5}}, "program": { "type": "Program", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 5 - } - }, + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":5}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, "expression": { "type": "UpdateExpression", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, "operator": "++", "prefix": false, "argument": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" } } }, { "type": "BlockStatement", - "start": 4, - "end": 6, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 2 - } - }, + "start":4,"end":6,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":2}}, "body": [], "directives": [] }, { "type": "ExpressionStatement", - "start": 7, - "end": 12, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 5 - } - }, + "start":7,"end":12,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":5}}, "expression": { "type": "RegExpLiteral", - "start": 7, - "end": 12, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 5 - } - }, + "start":7,"end":12,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":5}}, "extra": { "raw": "/foo/" }, diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/332/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/332/output.json index 3ca6c097e9e6..feba7e6eac1e 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/332/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/332/output.json @@ -1,94 +1,28 @@ { "type": "File", - "start": 0, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 6 - } - }, + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":6}}, "program": { "type": "Program", - "start": 0, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 6 - } - }, + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":6}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "BlockStatement", - "start": 0, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 6 - } - }, + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":6}}, "body": [ { "type": "BlockStatement", - "start": 1, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 3 - } - }, + "start":1,"end":3,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":3}}, "body": [], "directives": [] }, { "type": "ExpressionStatement", - "start": 4, - "end": 9, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 5 - } - }, + "start":4,"end":9,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":5}}, "expression": { "type": "RegExpLiteral", - "start": 4, - "end": 9, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 5 - } - }, + "start":4,"end":9,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":5}}, "extra": { "raw": "/foo/" }, diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/333/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/333/output.json index 887b2e1ad18e..256b8c05aef9 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/333/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/333/output.json @@ -1,62 +1,18 @@ { "type": "File", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "program": { "type": "Program", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "WhileStatement", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "test": { "type": "NumericLiteral", - "start": 7, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8}}, "extra": { "rawValue": 1, "raw": "1" @@ -65,32 +21,10 @@ }, "body": { "type": "ExpressionStatement", - "start": 10, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":10,"end":15,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":15}}, "expression": { "type": "RegExpLiteral", - "start": 10, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":10,"end":15,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":15}}, "extra": { "raw": "/foo/" }, diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/334/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/334/output.json index 781d5a1bada4..b2ddf7c3cc14 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/334/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/334/output.json @@ -1,76 +1,21 @@ { "type": "File", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "program": { "type": "Program", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "expression": { "type": "BinaryExpression", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "left": { "type": "NumericLiteral", - "start": 1, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - } - }, + "start":1,"end":2,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":2}}, "extra": { "rawValue": 1, "raw": "1", @@ -82,18 +27,7 @@ "operator": "/", "right": { "type": "NumericLiteral", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7}}, "extra": { "rawValue": 2, "raw": "2" diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/335/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/335/output.json index 56da6db3637d..3d544b67bdda 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/335/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/335/output.json @@ -1,154 +1,43 @@ { "type": "File", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "program": { "type": "Program", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "expression": { "type": "BinaryExpression", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "left": { "type": "BinaryExpression", - "start": 1, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":1,"end":12,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":12}}, "left": { "type": "ObjectExpression", - "start": 1, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":1,"end":9,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":9}}, "properties": [ { "type": "ObjectProperty", - "start": 2, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":2,"end":8,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":8}}, "method": false, "key": { "type": "Identifier", - "start": 2, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 3 - }, - "identifierName": "a" - }, + "start":2,"end":3,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":3},"identifierName":"a"}, "name": "a" }, "computed": false, "shorthand": false, "value": { "type": "ArrayExpression", - "start": 5, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":5,"end":8,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":8}}, "elements": [ { "type": "NumericLiteral", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7}}, "extra": { "rawValue": 1, "raw": "1" @@ -163,18 +52,7 @@ "operator": "+", "right": { "type": "ArrayExpression", - "start": 10, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":10,"end":12,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":12}}, "elements": [] }, "extra": { @@ -185,18 +63,7 @@ "operator": "/", "right": { "type": "NumericLiteral", - "start": 16, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":16,"end":17,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":17}}, "extra": { "rawValue": 2, "raw": "2" diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/336/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/336/output.json index 6687dfac3aea..0f449dfd9739 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/336/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/336/output.json @@ -1,92 +1,26 @@ { "type": "File", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 5 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":5}}, "program": { "type": "Program", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 5 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":5}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "BlockStatement", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "body": [ { "type": "ExpressionStatement", - "start": 1, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 4 - } - }, + "start":1,"end":4,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":4}}, "expression": { "type": "ArrayExpression", - "start": 1, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 4 - } - }, + "start":1,"end":4,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":4}}, "elements": [ { "type": "NumericLiteral", - "start": 2, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 3 - } - }, + "start":2,"end":3,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":3}}, "extra": { "rawValue": 1, "raw": "1" @@ -101,32 +35,10 @@ }, { "type": "ExpressionStatement", - "start": 6, - "end": 11, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 5 - } - }, + "start":6,"end":11,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":5}}, "expression": { "type": "RegExpLiteral", - "start": 6, - "end": 11, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 5 - } - }, + "start":6,"end":11,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":5}}, "extra": { "raw": "/foo/" }, diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/337/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/337/output.json index da4ac2be40ae..4f667276435b 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/337/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/337/output.json @@ -1,126 +1,37 @@ { "type": "File", - "start": 0, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 7 - } - }, + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":7}}, "program": { "type": "Program", - "start": 0, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 7 - } - }, + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":7}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "SwitchStatement", - "start": 0, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 7 - } - }, + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":7}}, "discriminant": { "type": "Identifier", - "start": 7, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - }, - "identifierName": "a" - }, + "start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8},"identifierName":"a"}, "name": "a" }, "cases": [ { "type": "SwitchCase", - "start": 12, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 2, - "column": 5 - } - }, + "start":12,"end":28,"loc":{"start":{"line":1,"column":12},"end":{"line":2,"column":5}}, "consequent": [ { "type": "BlockStatement", - "start": 20, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":20,"end":22,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":22}}, "body": [], "directives": [] }, { "type": "ExpressionStatement", - "start": 23, - "end": 28, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 5 - } - }, + "start":23,"end":28,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":5}}, "expression": { "type": "RegExpLiteral", - "start": 23, - "end": 28, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 5 - } - }, + "start":23,"end":28,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":5}}, "extra": { "raw": "/foo/" }, @@ -131,18 +42,7 @@ ], "test": { "type": "NumericLiteral", - "start": 17, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":17,"end":18,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":18}}, "extra": { "rawValue": 1, "raw": "1" diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/338/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/338/output.json index 77346f390920..9d16601e5669 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/338/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/338/output.json @@ -1,92 +1,26 @@ { "type": "File", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "program": { "type": "Program", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "expression": { "type": "ObjectExpression", - "start": 1, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":1,"end":12,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":12}}, "properties": [ { "type": "ObjectProperty", - "start": 2, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":2,"end":11,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":11}}, "method": false, "key": { "type": "NumericLiteral", - "start": 2, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 3 - } - }, + "start":2,"end":3,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":3}}, "extra": { "rawValue": 1, "raw": "1" @@ -97,49 +31,16 @@ "shorthand": false, "value": { "type": "BinaryExpression", - "start": 5, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":5,"end":11,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":11}}, "left": { "type": "ObjectExpression", - "start": 5, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":5,"end":7,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":7}}, "properties": [] }, "operator": "/", "right": { "type": "NumericLiteral", - "start": 10, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11}}, "extra": { "rawValue": 2, "raw": "2" diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/339/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/339/output.json index 62ef9146ea51..1189e9273727 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/339/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/339/output.json @@ -1,109 +1,31 @@ { "type": "File", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, "program": { "type": "Program", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, "expression": { "type": "BinaryExpression", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, "left": { "type": "UnaryExpression", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - }, + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, "operator": "+", "prefix": true, "argument": { "type": "UpdateExpression", - "start": 1, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 4 - } - }, + "start":1,"end":4,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":4}}, "operator": "++", "prefix": false, "argument": { "type": "Identifier", - "start": 1, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - }, - "identifierName": "x" - }, + "start":1,"end":2,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":2},"identifierName":"x"}, "name": "x" } } @@ -111,18 +33,7 @@ "operator": "/", "right": { "type": "NumericLiteral", - "start": 7, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8}}, "extra": { "rawValue": 2, "raw": "2" diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/34/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/34/output.json index 2ba79ca36077..ac45a4338b73 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/34/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/34/output.json @@ -1,125 +1,35 @@ { "type": "File", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, "program": { "type": "Program", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, "expression": { "type": "AssignmentExpression", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, "operator": "=", "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "right": { "type": "ObjectExpression", - "start": 4, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":4,"end":21,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":21}}, "properties": [ { "type": "ObjectMethod", - "start": 6, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":6,"end":19,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":19}}, "method": false, "key": { "type": "Identifier", - "start": 10, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 14 - }, - "identifierName": "null" - }, + "start":10,"end":14,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":14},"identifierName":"null"}, "name": "null" }, "computed": false, @@ -130,18 +40,7 @@ "params": [], "body": { "type": "BlockStatement", - "start": 17, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":17,"end":19,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":19}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/340/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/340/output.json index 7ccd83051b71..57a5959b416f 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/340/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/340/output.json @@ -1,94 +1,26 @@ { "type": "File", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 5 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":5}}, "program": { "type": "Program", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 5 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":5}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "expression": { "type": "MemberExpression", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "object": { "type": "Identifier", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - }, - "identifierName": "foo" - }, + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3},"identifierName":"foo"}, "name": "foo" }, "property": { "type": "Identifier", - "start": 4, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "in" - }, + "start":4,"end":6,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":6},"identifierName":"in"}, "name": "in" }, "computed": false @@ -96,49 +28,16 @@ }, { "type": "BlockStatement", - "start": 7, - "end": 9, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 2 - } - }, + "start":7,"end":9,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":2}}, "body": [], "directives": [] }, { "type": "ExpressionStatement", - "start": 10, - "end": 15, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 5 - } - }, + "start":10,"end":15,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":5}}, "expression": { "type": "RegExpLiteral", - "start": 10, - "end": 15, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 5 - } - }, + "start":10,"end":15,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":5}}, "extra": { "raw": "/foo/" }, diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/341/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/341/output.json index 395326a8c644..856912990e3e 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/341/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/341/output.json @@ -1,79 +1,24 @@ { "type": "File", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "program": { "type": "Program", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "BlockStatement", - "start": 0, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 2 - } - }, + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}}, "body": [], "directives": [] }, { "type": "ExpressionStatement", - "start": 2, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":2,"end":5,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":5}}, "expression": { "type": "RegExpLiteral", - "start": 2, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":2,"end":5,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":5}}, "extra": { "raw": "/=/" }, diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/342/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/342/output.json index 8db37405c8f9..d6ad31a3e965 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/342/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/342/output.json @@ -1,130 +1,40 @@ { "type": "File", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 4 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":4}}, "program": { "type": "Program", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 4 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":4}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 4 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":4}}, "expression": { "type": "BinaryExpression", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 4 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":4}}, "left": { "type": "Identifier", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - }, - "identifierName": "foo" - }, + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3},"identifierName":"foo"}, "name": "foo", "trailingComments": [ { "type": "CommentLine", "value": "bar", - "start": 4, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 11 - } - } + "start":4,"end":11,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":11}} } ] }, "operator": "+", "right": { "type": "Identifier", - "start": 13, - "end": 16, - "loc": { - "start": { - "line": 2, - "column": 1 - }, - "end": { - "line": 2, - "column": 4 - }, - "identifierName": "baz" - }, + "start":13,"end":16,"loc":{"start":{"line":2,"column":1},"end":{"line":2,"column":4},"identifierName":"baz"}, "name": "baz", "leadingComments": [ { "type": "CommentLine", "value": "bar", - "start": 4, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 11 - } - } + "start":4,"end":11,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":11}} } ] } @@ -137,18 +47,7 @@ { "type": "CommentLine", "value": "bar", - "start": 4, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 11 - } - } + "start":4,"end":11,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":11}} } ] } \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/343/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/343/output.json index 8332cec4ebfb..c4d3d78908c8 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/343/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/343/output.json @@ -1,143 +1,42 @@ { "type": "File", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 12 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":12}}, "program": { "type": "Program", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 12 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":12}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "expression": { "type": "AssignmentExpression", - "start": 0, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, "operator": "=", "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "right": { "type": "BinaryExpression", - "start": 4, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":4,"end":10,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":10}}, "left": { "type": "UpdateExpression", - "start": 4, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":4,"end":7,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":7}}, "operator": "--", "prefix": false, "argument": { "type": "Identifier", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "y" - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"y"}, "name": "y" } }, "operator": ">", "right": { "type": "NumericLiteral", - "start": 8, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":8,"end":10,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":10}}, "extra": { "rawValue": 10, "raw": "10" @@ -150,18 +49,7 @@ { "type": "CommentLine", "value": " nothing", - "start": 13, - "end": 24, - "loc": { - "start": { - "line": 2, - "column": 1 - }, - "end": { - "line": 2, - "column": 12 - } - } + "start":13,"end":24,"loc":{"start":{"line":2,"column":1},"end":{"line":2,"column":12}} } ] } @@ -172,18 +60,7 @@ { "type": "CommentLine", "value": " nothing", - "start": 13, - "end": 24, - "loc": { - "start": { - "line": 2, - "column": 1 - }, - "end": { - "line": 2, - "column": 12 - } - } + "start":13,"end":24,"loc":{"start":{"line":2,"column":1},"end":{"line":2,"column":12}} } ] } \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/344/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/344/output.json index 54af5b6d0b16..faed8b50200a 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/344/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/344/output.json @@ -1,108 +1,29 @@ { "type": "File", - "start": 0, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 16 - } - }, + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":16}}, "program": { "type": "Program", - "start": 0, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 16 - } - }, + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":16}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 14, - "end": 30, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 16 - } - }, + "start":14,"end":30,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":16}}, "expression": { "type": "CallExpression", - "start": 14, - "end": 29, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 15 - } - }, + "start":14,"end":29,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":15}}, "callee": { "type": "MemberExpression", - "start": 14, - "end": 27, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 13 - } - }, + "start":14,"end":27,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":13}}, "object": { "type": "Identifier", - "start": 14, - "end": 20, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 6 - }, - "identifierName": "object" - }, + "start":14,"end":20,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":6},"identifierName":"object"}, "name": "object" }, "property": { "type": "Identifier", - "start": 21, - "end": 27, - "loc": { - "start": { - "line": 2, - "column": 7 - }, - "end": { - "line": 2, - "column": 13 - }, - "identifierName": "static" - }, + "start":21,"end":27,"loc":{"start":{"line":2,"column":7},"end":{"line":2,"column":13},"identifierName":"static"}, "name": "static" }, "computed": false @@ -114,32 +35,10 @@ "directives": [ { "type": "Directive", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "value": { "type": "DirectiveLiteral", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, "value": "use strict", "extra": { "raw": "'use strict'", diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/347/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/347/options.json index 91bb1eef0c0d..ee18527964e7 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/347/options.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/347/options.json @@ -1,3 +1,3 @@ { - "throws": "Invalid number (1:0)" + "throws": "Identifier directly after number (1:2)" } diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/349/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/349/options.json deleted file mode 100644 index 91bb1eef0c0d..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/349/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid number (1:0)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/349/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/349/output.json new file mode 100644 index 000000000000..b2d2e40318a4 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/349/output.json @@ -0,0 +1,29 @@ +{ + "type": "File", + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}}, + "errors": [ + "SyntaxError: Invalid number (1:0)" + ], + "program": { + "type": "Program", + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}}, + "expression": { + "type": "NumericLiteral", + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}}, + "extra": { + "rawValue": 3, + "raw": "3e" + }, + "value": 3 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/35/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/35/output.json index ea3146a858b9..4e52a2f94326 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/35/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/35/output.json @@ -1,124 +1,35 @@ { "type": "File", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "program": { "type": "Program", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "expression": { "type": "AssignmentExpression", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "operator": "=", "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "right": { "type": "ObjectExpression", - "start": 4, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":4,"end":24,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":24}}, "properties": [ { "type": "ObjectMethod", - "start": 6, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":6,"end":22,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":22}}, "method": false, "key": { "type": "StringLiteral", - "start": 10, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":10,"end":17,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":17}}, "extra": { "rawValue": "undef", "raw": "\"undef\"" @@ -133,18 +44,7 @@ "params": [], "body": { "type": "BlockStatement", - "start": 20, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":20,"end":22,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":22}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/350/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/350/options.json deleted file mode 100644 index 91bb1eef0c0d..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/350/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid number (1:0)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/350/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/350/output.json new file mode 100644 index 000000000000..1591ec979e44 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/350/output.json @@ -0,0 +1,29 @@ +{ + "type": "File", + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, + "errors": [ + "SyntaxError: Invalid number (1:0)" + ], + "program": { + "type": "Program", + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, + "expression": { + "type": "NumericLiteral", + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, + "extra": { + "rawValue": 3, + "raw": "3e+" + }, + "value": 3 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/351/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/351/options.json deleted file mode 100644 index 91bb1eef0c0d..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/351/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid number (1:0)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/351/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/351/output.json new file mode 100644 index 000000000000..42c6c5a67aff --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/351/output.json @@ -0,0 +1,29 @@ +{ + "type": "File", + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, + "errors": [ + "SyntaxError: Invalid number (1:0)" + ], + "program": { + "type": "Program", + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, + "expression": { + "type": "NumericLiteral", + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, + "extra": { + "rawValue": 3, + "raw": "3e-" + }, + "value": 3 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/354/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/354/options.json deleted file mode 100644 index 1a0693338eee..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/354/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Expected number in radix 16 (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/354/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/354/output.json new file mode 100644 index 000000000000..9a1a7ea60803 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/354/output.json @@ -0,0 +1,29 @@ +{ + "type": "File", + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}}, + "errors": [ + "SyntaxError: Expected number in radix 16 (1:2)" + ], + "program": { + "type": "Program", + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}}, + "expression": { + "type": "NumericLiteral", + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}}, + "extra": { + "rawValue": null, + "raw": "0x" + }, + "value": null + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/355/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/355/output.json index 22fa47db887b..3e85623558cf 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/355/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/355/output.json @@ -1,62 +1,18 @@ { "type": "File", - "start": 0, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 2 - } - }, + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}}, "program": { "type": "Program", - "start": 0, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 2 - } - }, + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 2 - } - }, + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}}, "expression": { "type": "NumericLiteral", - "start": 0, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 2 - } - }, + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}}, "extra": { "rawValue": 9, "raw": "09" diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/356/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/356/output.json index 5be4b4f8c146..03afc3896cd0 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/356/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/356/output.json @@ -1,62 +1,18 @@ { "type": "File", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, "program": { "type": "Program", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, "expression": { "type": "NumericLiteral", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, "extra": { "rawValue": 18, "raw": "018" diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/36/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/36/output.json index c02bf897d3a7..620c3d2cc9b8 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/36/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/36/output.json @@ -1,124 +1,35 @@ { "type": "File", - "start": 0, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, "program": { "type": "Program", - "start": 0, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, "expression": { "type": "AssignmentExpression", - "start": 0, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, "operator": "=", "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "right": { "type": "ObjectExpression", - "start": 4, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":4,"end":19,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":19}}, "properties": [ { "type": "ObjectMethod", - "start": 6, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":6,"end":17,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":17}}, "method": false, "key": { "type": "NumericLiteral", - "start": 10, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":10,"end":12,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":12}}, "extra": { "rawValue": 10, "raw": "10" @@ -133,18 +44,7 @@ "params": [], "body": { "type": "BlockStatement", - "start": 15, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":15,"end":17,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":17}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/361/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/361/options.json deleted file mode 100644 index 18c53b997b56..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/361/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Expecting Unicode escape sequence \\uXXXX (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/361/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/361/output.json new file mode 100644 index 000000000000..5dd7b5d3fcd6 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/361/output.json @@ -0,0 +1,25 @@ +{ + "type": "File", + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}}, + "errors": [ + "SyntaxError: Expecting Unicode escape sequence \\uXXXX (1:2)" + ], + "program": { + "type": "Program", + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}}, + "expression": { + "type": "Identifier", + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2},"identifierName":"xx\\"}, + "name": "xx\\" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/362/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/362/options.json deleted file mode 100644 index ea7ba01dc69c..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/362/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid Unicode escape (1:1)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/362/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/362/output.json new file mode 100644 index 000000000000..d9a89994f01f --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/362/output.json @@ -0,0 +1,25 @@ +{ + "type": "File", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "errors": [ + "SyntaxError: Invalid Unicode escape (1:1)" + ], + "program": { + "type": "Program", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "expression": { + "type": "Identifier", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7},"identifierName":"x\\"}, + "name": "x\\" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/363/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/363/options.json deleted file mode 100644 index ea7ba01dc69c..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/363/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid Unicode escape (1:1)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/363/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/363/output.json new file mode 100644 index 000000000000..32180fcde928 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/363/output.json @@ -0,0 +1,25 @@ +{ + "type": "File", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "errors": [ + "SyntaxError: Invalid Unicode escape (1:1)" + ], + "program": { + "type": "Program", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "expression": { + "type": "Identifier", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7},"identifierName":"x*"}, + "name": "x*" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/366/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/366/options.json deleted file mode 100644 index adf556b0a352..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/366/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid regular expression flag (1:16)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/366/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/366/output.json new file mode 100644 index 000000000000..d42d61f8a543 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/366/output.json @@ -0,0 +1,42 @@ +{ + "type": "File", + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, + "errors": [ + "SyntaxError: Invalid regular expression flag (1:16)", + "SyntaxError: Invalid regular expression flag (1:18)" + ], + "program": { + "type": "Program", + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":4,"end":18,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":18}}, + "id": { + "type": "Identifier", + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"x"}, + "name": "x" + }, + "init": { + "type": "RegExpLiteral", + "start":8,"end":18,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":18}}, + "extra": { + "raw": "/[a-z]/\\ux" + }, + "pattern": "[a-z]", + "flags": "\\ux" + } + } + ], + "kind": "var" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/367/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/367/options.json deleted file mode 100644 index 6010e96ed144..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/367/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid left-hand side in assignment expression (1:0)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/367/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/367/output.json new file mode 100644 index 000000000000..d4d2cf5dfe67 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/367/output.json @@ -0,0 +1,43 @@ +{ + "type": "File", + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, + "errors": [ + "SyntaxError: Invalid left-hand side in assignment expression (1:0)" + ], + "program": { + "type": "Program", + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, + "expression": { + "type": "AssignmentExpression", + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, + "operator": "=", + "left": { + "type": "NumericLiteral", + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1}}, + "extra": { + "rawValue": 3, + "raw": "3" + }, + "value": 3 + }, + "right": { + "type": "NumericLiteral", + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5}}, + "extra": { + "rawValue": 4, + "raw": "4" + }, + "value": 4 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/368/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/368/options.json deleted file mode 100644 index 6010e96ed144..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/368/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid left-hand side in assignment expression (1:0)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/368/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/368/output.json new file mode 100644 index 000000000000..edc325840380 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/368/output.json @@ -0,0 +1,44 @@ +{ + "type": "File", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "errors": [ + "SyntaxError: Invalid left-hand side in assignment expression (1:0)" + ], + "program": { + "type": "Program", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "expression": { + "type": "AssignmentExpression", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "operator": "=", + "left": { + "type": "CallExpression", + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, + "callee": { + "type": "Identifier", + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4},"identifierName":"func"}, + "name": "func" + }, + "arguments": [] + }, + "right": { + "type": "NumericLiteral", + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10}}, + "extra": { + "rawValue": 4, + "raw": "4" + }, + "value": 4 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/369/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/369/options.json deleted file mode 100644 index 7c5f08eb9ba6..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/369/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid left-hand side in assignment expression (1:1)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/369/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/369/output.json new file mode 100644 index 000000000000..46112c6c8828 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/369/output.json @@ -0,0 +1,62 @@ +{ + "type": "File", + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "errors": [ + "SyntaxError: Invalid parenthesized assignment pattern (1:1)", + "SyntaxError: Invalid left-hand side in assignment expression (1:1)" + ], + "program": { + "type": "Program", + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "expression": { + "type": "AssignmentExpression", + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "operator": "=", + "left": { + "type": "BinaryExpression", + "start":1,"end":6,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":6}}, + "left": { + "type": "NumericLiteral", + "start":1,"end":2,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":2}}, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + }, + "operator": "+", + "right": { + "type": "NumericLiteral", + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + }, + "extra": { + "parenthesized": true, + "parenStart": 0 + } + }, + "right": { + "type": "NumericLiteral", + "start":10,"end":12,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":12}}, + "extra": { + "rawValue": 10, + "raw": "10" + }, + "value": 10 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/37/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/37/output.json index a15882b52dae..6854d518cf5c 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/37/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/37/output.json @@ -1,125 +1,35 @@ { "type": "File", - "start": 0, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, "program": { "type": "Program", - "start": 0, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, "expression": { "type": "AssignmentExpression", - "start": 0, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, "operator": "=", "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "right": { "type": "ObjectExpression", - "start": 4, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":4,"end":36,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":36}}, "properties": [ { "type": "ObjectMethod", - "start": 6, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":6,"end":34,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":34}}, "method": false, "key": { "type": "Identifier", - "start": 10, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 15 - }, - "identifierName": "width" - }, + "start":10,"end":15,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":15},"identifierName":"width"}, "name": "width" }, "computed": false, @@ -130,98 +40,29 @@ "params": [ { "type": "Identifier", - "start": 16, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - }, - "identifierName": "w" - }, + "start":16,"end":17,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":17},"identifierName":"w"}, "name": "w" } ], "body": { "type": "BlockStatement", - "start": 19, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":19,"end":34,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":34}}, "body": [ { "type": "ExpressionStatement", - "start": 21, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":21,"end":32,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":32}}, "expression": { "type": "AssignmentExpression", - "start": 21, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":21,"end":32,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":32}}, "operator": "=", "left": { "type": "Identifier", - "start": 21, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 28 - }, - "identifierName": "m_width" - }, + "start":21,"end":28,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":28},"identifierName":"m_width"}, "name": "m_width" }, "right": { "type": "Identifier", - "start": 31, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 31 - }, - "end": { - "line": 1, - "column": 32 - }, - "identifierName": "w" - }, + "start":31,"end":32,"loc":{"start":{"line":1,"column":31},"end":{"line":1,"column":32},"identifierName":"w"}, "name": "w" } } diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/370/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/370/options.json deleted file mode 100644 index c09dac1301de..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/370/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid left-hand side in postfix operation (1:0)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/370/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/370/output.json new file mode 100644 index 000000000000..89b9c579fa1c --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/370/output.json @@ -0,0 +1,35 @@ +{ + "type": "File", + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, + "errors": [ + "SyntaxError: Invalid left-hand side in postfix operation (1:0)" + ], + "program": { + "type": "Program", + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, + "expression": { + "type": "UpdateExpression", + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, + "operator": "++", + "prefix": false, + "argument": { + "type": "NumericLiteral", + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1}}, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/371/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/371/options.json deleted file mode 100644 index c09dac1301de..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/371/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid left-hand side in postfix operation (1:0)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/371/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/371/output.json new file mode 100644 index 000000000000..b0387fd4ff59 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/371/output.json @@ -0,0 +1,35 @@ +{ + "type": "File", + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, + "errors": [ + "SyntaxError: Invalid left-hand side in postfix operation (1:0)" + ], + "program": { + "type": "Program", + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, + "expression": { + "type": "UpdateExpression", + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, + "operator": "--", + "prefix": false, + "argument": { + "type": "NumericLiteral", + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1}}, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/372/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/372/options.json deleted file mode 100644 index 515e441e8ea7..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/372/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid left-hand side in prefix operation (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/372/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/372/output.json new file mode 100644 index 000000000000..e86e86ca2246 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/372/output.json @@ -0,0 +1,35 @@ +{ + "type": "File", + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, + "errors": [ + "SyntaxError: Invalid left-hand side in prefix operation (1:2)" + ], + "program": { + "type": "Program", + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, + "expression": { + "type": "UpdateExpression", + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, + "operator": "++", + "prefix": true, + "argument": { + "type": "NumericLiteral", + "start":2,"end":3,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":3}}, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/373/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/373/options.json deleted file mode 100644 index 515e441e8ea7..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/373/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid left-hand side in prefix operation (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/373/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/373/output.json new file mode 100644 index 000000000000..de49f7815bd2 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/373/output.json @@ -0,0 +1,35 @@ +{ + "type": "File", + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, + "errors": [ + "SyntaxError: Invalid left-hand side in prefix operation (1:2)" + ], + "program": { + "type": "Program", + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, + "expression": { + "type": "UpdateExpression", + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, + "operator": "--", + "prefix": true, + "argument": { + "type": "NumericLiteral", + "start":2,"end":3,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":3}}, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/374/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/374/options.json deleted file mode 100644 index f8560a7de9d6..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/374/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid left-hand side in for-in statement (1:5)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/374/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/374/output.json new file mode 100644 index 000000000000..609aed8d6228 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/374/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, + "errors": [ + "SyntaxError: Invalid parenthesized assignment pattern (1:5)", + "SyntaxError: Invalid left-hand side in for-in statement (1:5)" + ], + "program": { + "type": "Program", + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ForInStatement", + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, + "left": { + "type": "BinaryExpression", + "start":5,"end":10,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":10}}, + "left": { + "type": "NumericLiteral", + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + }, + "operator": "+", + "right": { + "type": "NumericLiteral", + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10}}, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + }, + "extra": { + "parenthesized": true, + "parenStart": 4 + } + }, + "right": { + "type": "Identifier", + "start":15,"end":19,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":19},"identifierName":"list"}, + "name": "list" + }, + "body": { + "type": "ExpressionStatement", + "start":21,"end":32,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":32}}, + "expression": { + "type": "CallExpression", + "start":21,"end":31,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":31}}, + "callee": { + "type": "Identifier", + "start":21,"end":28,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":28},"identifierName":"process"}, + "name": "process" + }, + "arguments": [ + { + "type": "Identifier", + "start":29,"end":30,"loc":{"start":{"line":1,"column":29},"end":{"line":1,"column":30},"identifierName":"x"}, + "name": "x" + } + ] + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/38/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/38/output.json index d672770fbcdf..c1d2713e76da 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/38/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/38/output.json @@ -1,125 +1,35 @@ { "type": "File", - "start": 0, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, "program": { "type": "Program", - "start": 0, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, "expression": { "type": "AssignmentExpression", - "start": 0, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, "operator": "=", "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "right": { "type": "ObjectExpression", - "start": 4, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":4,"end":30,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":30}}, "properties": [ { "type": "ObjectMethod", - "start": 6, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":6,"end":28,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":28}}, "method": false, "key": { "type": "Identifier", - "start": 10, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "if" - }, + "start":10,"end":12,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":12},"identifierName":"if"}, "name": "if" }, "computed": false, @@ -130,98 +40,29 @@ "params": [ { "type": "Identifier", - "start": 13, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - }, - "identifierName": "w" - }, + "start":13,"end":14,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":14},"identifierName":"w"}, "name": "w" } ], "body": { "type": "BlockStatement", - "start": 16, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":16,"end":28,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":28}}, "body": [ { "type": "ExpressionStatement", - "start": 18, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":18,"end":26,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":26}}, "expression": { "type": "AssignmentExpression", - "start": 18, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":18,"end":26,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":26}}, "operator": "=", "left": { "type": "Identifier", - "start": 18, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 22 - }, - "identifierName": "m_if" - }, + "start":18,"end":22,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":22},"identifierName":"m_if"}, "name": "m_if" }, "right": { "type": "Identifier", - "start": 25, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 26 - }, - "identifierName": "w" - }, + "start":25,"end":26,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":26},"identifierName":"w"}, "name": "w" } } diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/382/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/382/options.json deleted file mode 100644 index 2b91be8d5115..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/382/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected keyword 'if' (1:4)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/382/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/382/output.json new file mode 100644 index 000000000000..71a10a5324e9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/382/output.json @@ -0,0 +1,41 @@ +{ + "type": "File", + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "errors": [ + "SyntaxError: Unexpected keyword 'if' (1:4)" + ], + "program": { + "type": "Program", + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":4,"end":11,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":11}}, + "id": { + "type": "Identifier", + "start":4,"end":6,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":6},"identifierName":"if"}, + "name": "if" + }, + "init": { + "type": "NumericLiteral", + "start":9,"end":11,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":11}}, + "extra": { + "rawValue": 42, + "raw": "42" + }, + "value": 42 + } + } + ], + "kind": "var" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/383/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/383/options.json deleted file mode 100644 index 6010e96ed144..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/383/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid left-hand side in assignment expression (1:0)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/383/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/383/output.json new file mode 100644 index 000000000000..62e99551071a --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/383/output.json @@ -0,0 +1,53 @@ +{ + "type": "File", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "errors": [ + "SyntaxError: Invalid left-hand side in assignment expression (1:0)" + ], + "program": { + "type": "Program", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "expression": { + "type": "AssignmentExpression", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "operator": "=", + "left": { + "type": "BinaryExpression", + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, + "left": { + "type": "Identifier", + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"i"}, + "name": "i" + }, + "operator": "+", + "right": { + "type": "NumericLiteral", + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5}}, + "extra": { + "rawValue": 2, + "raw": "2" + }, + "value": 2 + } + }, + "right": { + "type": "NumericLiteral", + "start":8,"end":10,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":10}}, + "extra": { + "rawValue": 42, + "raw": "42" + }, + "value": 42 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/384/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/384/options.json deleted file mode 100644 index 6010e96ed144..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/384/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid left-hand side in assignment expression (1:0)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/384/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/384/output.json new file mode 100644 index 000000000000..ba27c1c609ba --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/384/output.json @@ -0,0 +1,45 @@ +{ + "type": "File", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "errors": [ + "SyntaxError: Invalid left-hand side in assignment expression (1:0)" + ], + "program": { + "type": "Program", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "expression": { + "type": "AssignmentExpression", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "operator": "=", + "left": { + "type": "UnaryExpression", + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}}, + "operator": "+", + "prefix": true, + "argument": { + "type": "Identifier", + "start":1,"end":2,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":2},"identifierName":"i"}, + "name": "i" + } + }, + "right": { + "type": "NumericLiteral", + "start":5,"end":7,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":7}}, + "extra": { + "rawValue": 42, + "raw": "42" + }, + "value": 42 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/39/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/39/output.json index 3322d7a98a38..daf210e071a3 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/39/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/39/output.json @@ -1,125 +1,35 @@ { "type": "File", - "start": 0, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, "program": { "type": "Program", - "start": 0, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, "expression": { "type": "AssignmentExpression", - "start": 0, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, "operator": "=", "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "right": { "type": "ObjectExpression", - "start": 4, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":4,"end":34,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":34}}, "properties": [ { "type": "ObjectMethod", - "start": 6, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":6,"end":32,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":32}}, "method": false, "key": { "type": "Identifier", - "start": 10, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 14 - }, - "identifierName": "true" - }, + "start":10,"end":14,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":14},"identifierName":"true"}, "name": "true" }, "computed": false, @@ -130,98 +40,29 @@ "params": [ { "type": "Identifier", - "start": 15, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - }, - "identifierName": "w" - }, + "start":15,"end":16,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":16},"identifierName":"w"}, "name": "w" } ], "body": { "type": "BlockStatement", - "start": 18, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":18,"end":32,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":32}}, "body": [ { "type": "ExpressionStatement", - "start": 20, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":20,"end":30,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":30}}, "expression": { "type": "AssignmentExpression", - "start": 20, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":20,"end":30,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":30}}, "operator": "=", "left": { "type": "Identifier", - "start": 20, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 26 - }, - "identifierName": "m_true" - }, + "start":20,"end":26,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":26},"identifierName":"m_true"}, "name": "m_true" }, "right": { "type": "Identifier", - "start": 29, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 1, - "column": 30 - }, - "identifierName": "w" - }, + "start":29,"end":30,"loc":{"start":{"line":1,"column":29},"end":{"line":1,"column":30},"identifierName":"w"}, "name": "w" } } diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/397/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/397/options.json deleted file mode 100644 index f9543317a817..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/397/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected keyword 'if' (1:11)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/397/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/397/output.json new file mode 100644 index 000000000000..e005c14c8e87 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/397/output.json @@ -0,0 +1,40 @@ +{ + "type": "File", + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, + "errors": [ + "SyntaxError: Unexpected keyword 'if' (1:11)" + ], + "program": { + "type": "Program", + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, + "id": { + "type": "Identifier", + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"t"}, + "name": "t" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start":11,"end":13,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":13},"identifierName":"if"}, + "name": "if" + } + ], + "body": { + "type": "BlockStatement", + "start":15,"end":18,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":18}}, + "body": [], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/398/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/398/options.json deleted file mode 100644 index bba7a057d842..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/398/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected keyword 'true' (1:11)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/398/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/398/output.json new file mode 100644 index 000000000000..6ec5cbae6e42 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/398/output.json @@ -0,0 +1,40 @@ +{ + "type": "File", + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, + "errors": [ + "SyntaxError: Unexpected keyword 'true' (1:11)" + ], + "program": { + "type": "Program", + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, + "id": { + "type": "Identifier", + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"t"}, + "name": "t" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start":11,"end":15,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":15},"identifierName":"true"}, + "name": "true" + } + ], + "body": { + "type": "BlockStatement", + "start":17,"end":20,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":20}}, + "body": [], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/399/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/399/options.json deleted file mode 100644 index b04b18396af1..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/399/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected keyword 'false' (1:11)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/399/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/399/output.json new file mode 100644 index 000000000000..52f3a5538421 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/399/output.json @@ -0,0 +1,40 @@ +{ + "type": "File", + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, + "errors": [ + "SyntaxError: Unexpected keyword 'false' (1:11)" + ], + "program": { + "type": "Program", + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, + "id": { + "type": "Identifier", + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"t"}, + "name": "t" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start":11,"end":16,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":16},"identifierName":"false"}, + "name": "false" + } + ], + "body": { + "type": "BlockStatement", + "start":18,"end":21,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":21}}, + "body": [], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/4/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/4/output.json index 812d26fa77ee..7f6c378d08bd 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/4/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/4/output.json @@ -1,62 +1,18 @@ { "type": "File", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, "program": { "type": "Program", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, "expression": { "type": "RegExpLiteral", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, "extra": { "raw": "/foobar/" }, diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/40/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/40/output.json index a26b8b4009e1..c04c402e277f 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/40/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/40/output.json @@ -1,125 +1,35 @@ { "type": "File", - "start": 0, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, "program": { "type": "Program", - "start": 0, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, "expression": { "type": "AssignmentExpression", - "start": 0, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, "operator": "=", "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "right": { "type": "ObjectExpression", - "start": 4, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":4,"end":36,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":36}}, "properties": [ { "type": "ObjectMethod", - "start": 6, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":6,"end":34,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":34}}, "method": false, "key": { "type": "Identifier", - "start": 10, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 15 - }, - "identifierName": "false" - }, + "start":10,"end":15,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":15},"identifierName":"false"}, "name": "false" }, "computed": false, @@ -130,98 +40,29 @@ "params": [ { "type": "Identifier", - "start": 16, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - }, - "identifierName": "w" - }, + "start":16,"end":17,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":17},"identifierName":"w"}, "name": "w" } ], "body": { "type": "BlockStatement", - "start": 19, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":19,"end":34,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":34}}, "body": [ { "type": "ExpressionStatement", - "start": 21, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":21,"end":32,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":32}}, "expression": { "type": "AssignmentExpression", - "start": 21, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":21,"end":32,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":32}}, "operator": "=", "left": { "type": "Identifier", - "start": 21, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 28 - }, - "identifierName": "m_false" - }, + "start":21,"end":28,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":28},"identifierName":"m_false"}, "name": "m_false" }, "right": { "type": "Identifier", - "start": 31, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 31 - }, - "end": { - "line": 1, - "column": 32 - }, - "identifierName": "w" - }, + "start":31,"end":32,"loc":{"start":{"line":1,"column":31},"end":{"line":1,"column":32},"identifierName":"w"}, "name": "w" } } diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/400/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/400/options.json deleted file mode 100644 index 667f2cc8816d..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/400/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected keyword 'null' (1:11)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/400/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/400/output.json new file mode 100644 index 000000000000..501517e632d1 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/400/output.json @@ -0,0 +1,40 @@ +{ + "type": "File", + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, + "errors": [ + "SyntaxError: Unexpected keyword 'null' (1:11)" + ], + "program": { + "type": "Program", + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, + "id": { + "type": "Identifier", + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"t"}, + "name": "t" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start":11,"end":15,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":15},"identifierName":"null"}, + "name": "null" + } + ], + "body": { + "type": "BlockStatement", + "start":17,"end":20,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":20}}, + "body": [], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/401/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/401/options.json deleted file mode 100644 index fa57d4f43f70..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/401/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected keyword 'null' (1:9)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/401/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/401/output.json new file mode 100644 index 000000000000..9ac27929ac37 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/401/output.json @@ -0,0 +1,34 @@ +{ + "type": "File", + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, + "errors": [ + "SyntaxError: Unexpected keyword 'null' (1:9)" + ], + "program": { + "type": "Program", + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, + "id": { + "type": "Identifier", + "start":9,"end":13,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":13},"identifierName":"null"}, + "name": "null" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":16,"end":19,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":19}}, + "body": [], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/402/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/402/options.json deleted file mode 100644 index c4a7ead13704..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/402/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected keyword 'true' (1:9)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/402/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/402/output.json new file mode 100644 index 000000000000..4d6a82553f05 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/402/output.json @@ -0,0 +1,34 @@ +{ + "type": "File", + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, + "errors": [ + "SyntaxError: Unexpected keyword 'true' (1:9)" + ], + "program": { + "type": "Program", + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, + "id": { + "type": "Identifier", + "start":9,"end":13,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":13},"identifierName":"true"}, + "name": "true" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":16,"end":19,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":19}}, + "body": [], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/403/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/403/options.json deleted file mode 100644 index 0e9cf8962aae..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/403/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected keyword 'false' (1:9)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/403/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/403/output.json new file mode 100644 index 000000000000..9939c1143924 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/403/output.json @@ -0,0 +1,34 @@ +{ + "type": "File", + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, + "errors": [ + "SyntaxError: Unexpected keyword 'false' (1:9)" + ], + "program": { + "type": "Program", + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, + "id": { + "type": "Identifier", + "start":9,"end":14,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":14},"identifierName":"false"}, + "name": "false" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":17,"end":20,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":20}}, + "body": [], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/404/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/404/options.json deleted file mode 100644 index a87aa98c0e01..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/404/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected keyword 'if' (1:9)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/404/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/404/output.json new file mode 100644 index 000000000000..18e0bcd2fc99 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/404/output.json @@ -0,0 +1,34 @@ +{ + "type": "File", + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, + "errors": [ + "SyntaxError: Unexpected keyword 'if' (1:9)" + ], + "program": { + "type": "Program", + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, + "id": { + "type": "Identifier", + "start":9,"end":11,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":11},"identifierName":"if"}, + "name": "if" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":14,"end":17,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":17}}, + "body": [], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/409/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/409/options.json deleted file mode 100644 index 701f9fe8f27a..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/409/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unsyntactic break (1:0)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/409/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/409/output.json new file mode 100644 index 000000000000..8ce94b960543 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/409/output.json @@ -0,0 +1,21 @@ +{ + "type": "File", + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, + "errors": [ + "SyntaxError: Unsyntactic break (1:0)" + ], + "program": { + "type": "Program", + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "BreakStatement", + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, + "label": null + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/41/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/41/output.json index 96e1bccd5184..cb6827eebf81 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/41/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/41/output.json @@ -1,125 +1,35 @@ { "type": "File", - "start": 0, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, "program": { "type": "Program", - "start": 0, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, "expression": { "type": "AssignmentExpression", - "start": 0, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, "operator": "=", "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "right": { "type": "ObjectExpression", - "start": 4, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":4,"end":34,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":34}}, "properties": [ { "type": "ObjectMethod", - "start": 6, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":6,"end":32,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":32}}, "method": false, "key": { "type": "Identifier", - "start": 10, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 14 - }, - "identifierName": "null" - }, + "start":10,"end":14,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":14},"identifierName":"null"}, "name": "null" }, "computed": false, @@ -130,98 +40,29 @@ "params": [ { "type": "Identifier", - "start": 15, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - }, - "identifierName": "w" - }, + "start":15,"end":16,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":16},"identifierName":"w"}, "name": "w" } ], "body": { "type": "BlockStatement", - "start": 18, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":18,"end":32,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":32}}, "body": [ { "type": "ExpressionStatement", - "start": 20, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":20,"end":30,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":30}}, "expression": { "type": "AssignmentExpression", - "start": 20, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":20,"end":30,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":30}}, "operator": "=", "left": { "type": "Identifier", - "start": 20, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 26 - }, - "identifierName": "m_null" - }, + "start":20,"end":26,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":26},"identifierName":"m_null"}, "name": "m_null" }, "right": { "type": "Identifier", - "start": 29, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 1, - "column": 30 - }, - "identifierName": "w" - }, + "start":29,"end":30,"loc":{"start":{"line":1,"column":29},"end":{"line":1,"column":30},"identifierName":"w"}, "name": "w" } } diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/411/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/411/options.json deleted file mode 100644 index de66853a7a3d..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/411/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unsyntactic continue (1:0)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/411/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/411/output.json new file mode 100644 index 000000000000..6d89822f1568 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/411/output.json @@ -0,0 +1,21 @@ +{ + "type": "File", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "errors": [ + "SyntaxError: Unsyntactic continue (1:0)" + ], + "program": { + "type": "Program", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ContinueStatement", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "label": null + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/417/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/417/options.json deleted file mode 100644 index f8560a7de9d6..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/417/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid left-hand side in for-in statement (1:5)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/417/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/417/output.json new file mode 100644 index 000000000000..d3af5238b363 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/417/output.json @@ -0,0 +1,48 @@ +{ + "type": "File", + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, + "errors": [ + "SyntaxError: Invalid left-hand side in for-in statement (1:5)" + ], + "program": { + "type": "Program", + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ForInStatement", + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, + "left": { + "type": "BinaryExpression", + "start":5,"end":10,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":10}}, + "left": { + "type": "Identifier", + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"i"}, + "name": "i" + }, + "operator": "+", + "right": { + "type": "NumericLiteral", + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10}}, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + }, + "right": { + "type": "ObjectExpression", + "start":14,"end":16,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":16}}, + "properties": [] + }, + "body": { + "type": "EmptyStatement", + "start":17,"end":18,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":18}} + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/418/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/418/options.json deleted file mode 100644 index f8560a7de9d6..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/418/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid left-hand side in for-in statement (1:5)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/418/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/418/output.json new file mode 100644 index 000000000000..a68f97021f5d --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/418/output.json @@ -0,0 +1,40 @@ +{ + "type": "File", + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, + "errors": [ + "SyntaxError: Invalid left-hand side in for-in statement (1:5)" + ], + "program": { + "type": "Program", + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ForInStatement", + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, + "left": { + "type": "UnaryExpression", + "start":5,"end":7,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":7}}, + "operator": "+", + "prefix": true, + "argument": { + "type": "Identifier", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"i"}, + "name": "i" + } + }, + "right": { + "type": "ObjectExpression", + "start":11,"end":13,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":13}}, + "properties": [] + }, + "body": { + "type": "EmptyStatement", + "start":14,"end":15,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":15}} + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/42/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/42/output.json index 2fa4b803dd1d..185c7ceda3e8 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/42/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/42/output.json @@ -1,124 +1,35 @@ { "type": "File", - "start": 0, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, "program": { "type": "Program", - "start": 0, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, "expression": { "type": "AssignmentExpression", - "start": 0, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, "operator": "=", "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "right": { "type": "ObjectExpression", - "start": 4, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":4,"end":36,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":36}}, "properties": [ { "type": "ObjectMethod", - "start": 6, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":6,"end":34,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":34}}, "method": false, "key": { "type": "StringLiteral", - "start": 10, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":10,"end":16,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":16}}, "extra": { "rawValue": "null", "raw": "\"null\"" @@ -133,98 +44,29 @@ "params": [ { "type": "Identifier", - "start": 17, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - }, - "identifierName": "w" - }, + "start":17,"end":18,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":18},"identifierName":"w"}, "name": "w" } ], "body": { "type": "BlockStatement", - "start": 20, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":20,"end":34,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":34}}, "body": [ { "type": "ExpressionStatement", - "start": 22, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":22,"end":32,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":32}}, "expression": { "type": "AssignmentExpression", - "start": 22, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":22,"end":32,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":32}}, "operator": "=", "left": { "type": "Identifier", - "start": 22, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 28 - }, - "identifierName": "m_null" - }, + "start":22,"end":28,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":28},"identifierName":"m_null"}, "name": "m_null" }, "right": { "type": "Identifier", - "start": 31, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 31 - }, - "end": { - "line": 1, - "column": 32 - }, - "identifierName": "w" - }, + "start":31,"end":32,"loc":{"start":{"line":1,"column":31},"end":{"line":1,"column":32},"identifierName":"w"}, "name": "w" } } diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/425/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/425/options.json deleted file mode 100644 index 429d96ca3f9a..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/425/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Missing catch or finally clause (1:0)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/425/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/425/output.json new file mode 100644 index 000000000000..a0bb1f5c08a4 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/425/output.json @@ -0,0 +1,28 @@ +{ + "type": "File", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "errors": [ + "SyntaxError: Missing catch or finally clause (1:0)" + ], + "program": { + "type": "Program", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "TryStatement", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "block": { + "type": "BlockStatement", + "start":4,"end":7,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":7}}, + "body": [], + "directives": [] + }, + "handler": null, + "finalizer": null + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/427/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/427/options.json deleted file mode 100644 index aadfa63716c2..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/427/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Multiple default clauses (1:22)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/427/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/427/output.json new file mode 100644 index 000000000000..322359217c2d --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/427/output.json @@ -0,0 +1,39 @@ +{ + "type": "File", + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, + "errors": [ + "SyntaxError: Multiple default clauses (1:22)" + ], + "program": { + "type": "Program", + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "SwitchStatement", + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, + "discriminant": { + "type": "Identifier", + "start":8,"end":9,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":9},"identifierName":"c"}, + "name": "c" + }, + "cases": [ + { + "type": "SwitchCase", + "start":13,"end":21,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":21}}, + "consequent": [], + "test": null + }, + { + "type": "SwitchCase", + "start":22,"end":30,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":30}}, + "consequent": [], + "test": null + } + ] + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/43/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/43/output.json index 21dd434a7ad0..c7e5a73217d8 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/43/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/43/output.json @@ -1,124 +1,35 @@ { "type": "File", - "start": 0, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, "program": { "type": "Program", - "start": 0, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, "expression": { "type": "AssignmentExpression", - "start": 0, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, "operator": "=", "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "right": { "type": "ObjectExpression", - "start": 4, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":4,"end":32,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":32}}, "properties": [ { "type": "ObjectMethod", - "start": 6, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":6,"end":30,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":30}}, "method": false, "key": { "type": "NumericLiteral", - "start": 10, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":10,"end":12,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":12}}, "extra": { "rawValue": 10, "raw": "10" @@ -133,98 +44,29 @@ "params": [ { "type": "Identifier", - "start": 13, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - }, - "identifierName": "w" - }, + "start":13,"end":14,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":14},"identifierName":"w"}, "name": "w" } ], "body": { "type": "BlockStatement", - "start": 16, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":16,"end":30,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":30}}, "body": [ { "type": "ExpressionStatement", - "start": 18, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":18,"end":28,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":28}}, "expression": { "type": "AssignmentExpression", - "start": 18, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":18,"end":28,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":28}}, "operator": "=", "left": { "type": "Identifier", - "start": 18, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 24 - }, - "identifierName": "m_null" - }, + "start":18,"end":24,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":24},"identifierName":"m_null"}, "name": "m_null" }, "right": { "type": "Identifier", - "start": 27, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 28 - }, - "identifierName": "w" - }, + "start":27,"end":28,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":28},"identifierName":"w"}, "name": "w" } } diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/44/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/44/output.json index 1a0a1b954720..3ae13a3f41fd 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/44/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/44/output.json @@ -1,143 +1,42 @@ { "type": "File", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "program": { "type": "Program", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "expression": { "type": "AssignmentExpression", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "operator": "=", "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "right": { "type": "ObjectExpression", - "start": 4, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":4,"end":15,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":15}}, "properties": [ { "type": "ObjectProperty", - "start": 6, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":6,"end":13,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":13}}, "method": false, "key": { "type": "Identifier", - "start": 6, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "get" - }, + "start":6,"end":9,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":9},"identifierName":"get"}, "name": "get" }, "computed": false, "shorthand": false, "value": { "type": "NumericLiteral", - "start": 11, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":11,"end":13,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":13}}, "extra": { "rawValue": 42, "raw": "42" diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/446/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/446/options.json deleted file mode 100644 index 381fd12ce2d0..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/446/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Expecting Unicode escape sequence \\uXXXX (1:1)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/446/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/446/output.json new file mode 100644 index 000000000000..f0be819b2d86 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/446/output.json @@ -0,0 +1,26 @@ +{ + "type": "File", + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}}, + "errors": [ + "SyntaxError: Expecting Unicode escape sequence \\uXXXX (1:1)", + "SyntaxError: Expecting Unicode escape sequence \\uXXXX (1:2)" + ], + "program": { + "type": "Program", + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}}, + "expression": { + "type": "Identifier", + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2},"identifierName":"\\\\\\"}, + "name": "\\\\\\" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/447/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/447/options.json deleted file mode 100644 index 82bcfe621c49..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/447/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid Unicode escape (1:0)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/447/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/447/output.json new file mode 100644 index 000000000000..6c34e22a0044 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/447/output.json @@ -0,0 +1,25 @@ +{ + "type": "File", + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, + "errors": [ + "SyntaxError: Invalid Unicode escape (1:0)" + ], + "program": { + "type": "Program", + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, + "expression": { + "type": "Identifier", + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6},"identifierName":"\\"}, + "name": "\\" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/448/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/448/options.json deleted file mode 100644 index 381fd12ce2d0..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/448/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Expecting Unicode escape sequence \\uXXXX (1:1)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/448/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/448/output.json new file mode 100644 index 000000000000..cc7b3b44d69e --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/448/output.json @@ -0,0 +1,25 @@ +{ + "type": "File", + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}}, + "errors": [ + "SyntaxError: Expecting Unicode escape sequence \\uXXXX (1:1)" + ], + "program": { + "type": "Program", + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}}, + "expression": { + "type": "Identifier", + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2},"identifierName":"\\x"}, + "name": "\\x" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/449/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/449/options.json deleted file mode 100644 index 82bcfe621c49..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/449/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid Unicode escape (1:0)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/449/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/449/output.json new file mode 100644 index 000000000000..3af7d55ae127 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/449/output.json @@ -0,0 +1,25 @@ +{ + "type": "File", + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, + "errors": [ + "SyntaxError: Invalid Unicode escape (1:0)" + ], + "program": { + "type": "Program", + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, + "expression": { + "type": "Identifier", + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6},"identifierName":"\u0000"}, + "name": "\u0000" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/45/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/45/output.json index 8caddf6f2a1e..26fa046a1204 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/45/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/45/output.json @@ -1,143 +1,42 @@ { "type": "File", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "program": { "type": "Program", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "expression": { "type": "AssignmentExpression", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "operator": "=", "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "right": { "type": "ObjectExpression", - "start": 4, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":4,"end":15,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":15}}, "properties": [ { "type": "ObjectProperty", - "start": 6, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":6,"end":13,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":13}}, "method": false, "key": { "type": "Identifier", - "start": 6, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "set" - }, + "start":6,"end":9,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":9},"identifierName":"set"}, "name": "set" }, "computed": false, "shorthand": false, "value": { "type": "NumericLiteral", - "start": 11, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":11,"end":13,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":13}}, "extra": { "rawValue": 43, "raw": "43" diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/453/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/453/options.json index 8e0dce66eff8..d732a1630991 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/453/options.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/453/options.json @@ -1,3 +1,3 @@ { - "throws": "Bad character escape sequence (1:3)" + "throws": "Unterminated string constant (1:0)" } diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/454/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/454/options.json deleted file mode 100644 index f9d29c7f328c..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/454/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "'return' outside of function (1:0)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/454/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/454/output.json new file mode 100644 index 000000000000..5875cb58be47 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/454/output.json @@ -0,0 +1,21 @@ +{ + "type": "File", + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, + "errors": [ + "SyntaxError: 'return' outside of function (1:0)" + ], + "program": { + "type": "Program", + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ReturnStatement", + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, + "argument": null + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/455/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/455/options.json deleted file mode 100644 index 701f9fe8f27a..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/455/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unsyntactic break (1:0)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/455/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/455/output.json new file mode 100644 index 000000000000..8ce94b960543 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/455/output.json @@ -0,0 +1,21 @@ +{ + "type": "File", + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, + "errors": [ + "SyntaxError: Unsyntactic break (1:0)" + ], + "program": { + "type": "Program", + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "BreakStatement", + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, + "label": null + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/456/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/456/options.json deleted file mode 100644 index de66853a7a3d..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/456/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unsyntactic continue (1:0)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/456/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/456/output.json new file mode 100644 index 000000000000..6d89822f1568 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/456/output.json @@ -0,0 +1,21 @@ +{ + "type": "File", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "errors": [ + "SyntaxError: Unsyntactic continue (1:0)" + ], + "program": { + "type": "Program", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ContinueStatement", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "label": null + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/457/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/457/options.json deleted file mode 100644 index c726e8fa98e4..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/457/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unsyntactic continue (1:22)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/457/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/457/output.json new file mode 100644 index 000000000000..37451db0ed1b --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/457/output.json @@ -0,0 +1,39 @@ +{ + "type": "File", + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, + "errors": [ + "SyntaxError: Unsyntactic continue (1:22)" + ], + "program": { + "type": "Program", + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "SwitchStatement", + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, + "discriminant": { + "type": "Identifier", + "start":8,"end":9,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":9},"identifierName":"x"}, + "name": "x" + }, + "cases": [ + { + "type": "SwitchCase", + "start":13,"end":31,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":31}}, + "consequent": [ + { + "type": "ContinueStatement", + "start":22,"end":31,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":31}}, + "label": null + } + ], + "test": null + } + ] + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/459/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/459/options.json deleted file mode 100644 index 070e662e80d4..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/459/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unsyntactic break (1:15)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/459/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/459/output.json new file mode 100644 index 000000000000..ae9cb401dddc --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/459/output.json @@ -0,0 +1,41 @@ +{ + "type": "File", + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, + "errors": [ + "SyntaxError: Unsyntactic break (1:15)" + ], + "program": { + "type": "Program", + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "WhileStatement", + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, + "test": { + "type": "BooleanLiteral", + "start":7,"end":11,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":11}}, + "value": true + }, + "body": { + "type": "BlockStatement", + "start":13,"end":25,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":25}}, + "body": [ + { + "type": "BreakStatement", + "start":15,"end":23,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":23}}, + "label": { + "type": "Identifier", + "start":21,"end":22,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":22},"identifierName":"x"}, + "name": "x" + } + } + ], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/46/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/46/output.json index 0a8172ce68fc..9dfe7b1c37fb 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/46/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/46/output.json @@ -1,62 +1,18 @@ { "type": "File", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "program": { "type": "Program", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 20, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":20,"end":22,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":22}}, "expression": { "type": "NumericLiteral", - "start": 20, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":20,"end":22,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":22}}, "extra": { "rawValue": 42, "raw": "42" @@ -67,18 +23,7 @@ { "type": "CommentBlock", "value": " block comment ", - "start": 0, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 19 - } - } + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}} } ] } @@ -89,18 +34,7 @@ { "type": "CommentBlock", "value": " block comment ", - "start": 0, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 19 - } - } + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}} } ] } \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/460/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/460/options.json deleted file mode 100644 index 2a2e15787aa7..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/460/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unsyntactic continue (1:15)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/460/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/460/output.json new file mode 100644 index 000000000000..39c5663443fe --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/460/output.json @@ -0,0 +1,41 @@ +{ + "type": "File", + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, + "errors": [ + "SyntaxError: Unsyntactic continue (1:15)" + ], + "program": { + "type": "Program", + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "WhileStatement", + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, + "test": { + "type": "BooleanLiteral", + "start":7,"end":11,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":11}}, + "value": true + }, + "body": { + "type": "BlockStatement", + "start":13,"end":28,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":28}}, + "body": [ + { + "type": "ContinueStatement", + "start":15,"end":26,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":26}}, + "label": { + "type": "Identifier", + "start":24,"end":25,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":25},"identifierName":"x"}, + "name": "x" + } + } + ], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/461/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/461/options.json deleted file mode 100644 index 464af80a1561..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/461/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unsyntactic break (1:33)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/461/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/461/output.json new file mode 100644 index 000000000000..3939133b3b8a --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/461/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start":0,"end":47,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":47}}, + "errors": [ + "SyntaxError: Unsyntactic break (1:33)" + ], + "program": { + "type": "Program", + "start":0,"end":47,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":47}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "LabeledStatement", + "start":0,"end":47,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":47}}, + "body": { + "type": "WhileStatement", + "start":3,"end":47,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":47}}, + "test": { + "type": "BooleanLiteral", + "start":10,"end":14,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":14}}, + "value": true + }, + "body": { + "type": "BlockStatement", + "start":16,"end":47,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":47}}, + "body": [ + { + "type": "ExpressionStatement", + "start":18,"end":45,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":45}}, + "expression": { + "type": "FunctionExpression", + "start":19,"end":43,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":43}}, + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":31,"end":43,"loc":{"start":{"line":1,"column":31},"end":{"line":1,"column":43}}, + "body": [ + { + "type": "BreakStatement", + "start":33,"end":41,"loc":{"start":{"line":1,"column":33},"end":{"line":1,"column":41}}, + "label": { + "type": "Identifier", + "start":39,"end":40,"loc":{"start":{"line":1,"column":39},"end":{"line":1,"column":40},"identifierName":"x"}, + "name": "x" + } + } + ], + "directives": [] + }, + "extra": { + "parenthesized": true, + "parenStart": 18 + } + } + } + ], + "directives": [] + } + }, + "label": { + "type": "Identifier", + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, + "name": "x" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/462/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/462/options.json deleted file mode 100644 index a056cb50e190..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/462/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unsyntactic continue (1:33)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/462/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/462/output.json new file mode 100644 index 000000000000..d65c7f7da91a --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/462/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start":0,"end":50,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":50}}, + "errors": [ + "SyntaxError: Unsyntactic continue (1:33)" + ], + "program": { + "type": "Program", + "start":0,"end":50,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":50}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "LabeledStatement", + "start":0,"end":50,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":50}}, + "body": { + "type": "WhileStatement", + "start":3,"end":50,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":50}}, + "test": { + "type": "BooleanLiteral", + "start":10,"end":14,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":14}}, + "value": true + }, + "body": { + "type": "BlockStatement", + "start":16,"end":50,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":50}}, + "body": [ + { + "type": "ExpressionStatement", + "start":18,"end":48,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":48}}, + "expression": { + "type": "FunctionExpression", + "start":19,"end":46,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":46}}, + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":31,"end":46,"loc":{"start":{"line":1,"column":31},"end":{"line":1,"column":46}}, + "body": [ + { + "type": "ContinueStatement", + "start":33,"end":44,"loc":{"start":{"line":1,"column":33},"end":{"line":1,"column":44}}, + "label": { + "type": "Identifier", + "start":42,"end":43,"loc":{"start":{"line":1,"column":42},"end":{"line":1,"column":43},"identifierName":"x"}, + "name": "x" + } + } + ], + "directives": [] + }, + "extra": { + "parenthesized": true, + "parenStart": 18 + } + } + } + ], + "directives": [] + } + }, + "label": { + "type": "Identifier", + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, + "name": "x" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/463/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/463/options.json deleted file mode 100644 index 464af80a1561..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/463/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unsyntactic break (1:33)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/463/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/463/output.json new file mode 100644 index 000000000000..336add4fe32c --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/463/output.json @@ -0,0 +1,69 @@ +{ + "type": "File", + "start":0,"end":45,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":45}}, + "errors": [ + "SyntaxError: Unsyntactic break (1:33)" + ], + "program": { + "type": "Program", + "start":0,"end":45,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":45}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "LabeledStatement", + "start":0,"end":45,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":45}}, + "body": { + "type": "WhileStatement", + "start":3,"end":45,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":45}}, + "test": { + "type": "BooleanLiteral", + "start":10,"end":14,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":14}}, + "value": true + }, + "body": { + "type": "BlockStatement", + "start":16,"end":45,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":45}}, + "body": [ + { + "type": "ExpressionStatement", + "start":18,"end":43,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":43}}, + "expression": { + "type": "FunctionExpression", + "start":19,"end":41,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":41}}, + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":31,"end":41,"loc":{"start":{"line":1,"column":31},"end":{"line":1,"column":41}}, + "body": [ + { + "type": "BreakStatement", + "start":33,"end":39,"loc":{"start":{"line":1,"column":33},"end":{"line":1,"column":39}}, + "label": null + } + ], + "directives": [] + }, + "extra": { + "parenthesized": true, + "parenStart": 18 + } + } + } + ], + "directives": [] + } + }, + "label": { + "type": "Identifier", + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, + "name": "x" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/464/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/464/options.json deleted file mode 100644 index a056cb50e190..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/464/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unsyntactic continue (1:33)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/464/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/464/output.json new file mode 100644 index 000000000000..ac86039c659b --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/464/output.json @@ -0,0 +1,69 @@ +{ + "type": "File", + "start":0,"end":48,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":48}}, + "errors": [ + "SyntaxError: Unsyntactic continue (1:33)" + ], + "program": { + "type": "Program", + "start":0,"end":48,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":48}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "LabeledStatement", + "start":0,"end":48,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":48}}, + "body": { + "type": "WhileStatement", + "start":3,"end":48,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":48}}, + "test": { + "type": "BooleanLiteral", + "start":10,"end":14,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":14}}, + "value": true + }, + "body": { + "type": "BlockStatement", + "start":16,"end":48,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":48}}, + "body": [ + { + "type": "ExpressionStatement", + "start":18,"end":46,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":46}}, + "expression": { + "type": "FunctionExpression", + "start":19,"end":44,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":44}}, + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":31,"end":44,"loc":{"start":{"line":1,"column":31},"end":{"line":1,"column":44}}, + "body": [ + { + "type": "ContinueStatement", + "start":33,"end":42,"loc":{"start":{"line":1,"column":33},"end":{"line":1,"column":42}}, + "label": null + } + ], + "directives": [] + }, + "extra": { + "parenthesized": true, + "parenStart": 18 + } + } + } + ], + "directives": [] + } + }, + "label": { + "type": "Identifier", + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, + "name": "x" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/465/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/465/options.json deleted file mode 100644 index da7f2590db0b..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/465/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Label 'x' is already declared (1:18)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/465/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/465/output.json new file mode 100644 index 000000000000..815a430cb2b7 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/465/output.json @@ -0,0 +1,65 @@ +{ + "type": "File", + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":39}}, + "errors": [ + "SyntaxError: Label 'x' is already declared (1:18)" + ], + "program": { + "type": "Program", + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":39}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "LabeledStatement", + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":39}}, + "body": { + "type": "WhileStatement", + "start":3,"end":39,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":39}}, + "test": { + "type": "BooleanLiteral", + "start":10,"end":14,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":14}}, + "value": true + }, + "body": { + "type": "BlockStatement", + "start":16,"end":39,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":39}}, + "body": [ + { + "type": "LabeledStatement", + "start":18,"end":37,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":37}}, + "body": { + "type": "WhileStatement", + "start":21,"end":37,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":37}}, + "test": { + "type": "BooleanLiteral", + "start":28,"end":32,"loc":{"start":{"line":1,"column":28},"end":{"line":1,"column":32}}, + "value": true + }, + "body": { + "type": "BlockStatement", + "start":34,"end":37,"loc":{"start":{"line":1,"column":34},"end":{"line":1,"column":37}}, + "body": [], + "directives": [] + } + }, + "label": { + "type": "Identifier", + "start":18,"end":19,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":19},"identifierName":"x"}, + "name": "x" + } + } + ], + "directives": [] + } + }, + "label": { + "type": "Identifier", + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, + "name": "x" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/466/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/466/options.json deleted file mode 100644 index 1517e1719333..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/466/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Deleting local variable in strict mode (1:29)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/466/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/466/output.json new file mode 100644 index 000000000000..392c525509d1 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/466/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start":0,"end":43,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":43}}, + "errors": [ + "SyntaxError: Deleting local variable in strict mode (1:29)" + ], + "program": { + "type": "Program", + "start":0,"end":43,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":43}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":43,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":43}}, + "expression": { + "type": "CallExpression", + "start":1,"end":42,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":42}}, + "callee": { + "type": "FunctionExpression", + "start":1,"end":40,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":40}}, + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":13,"end":40,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":40}}, + "body": [ + { + "type": "ExpressionStatement", + "start":29,"end":38,"loc":{"start":{"line":1,"column":29},"end":{"line":1,"column":38}}, + "expression": { + "type": "UnaryExpression", + "start":29,"end":37,"loc":{"start":{"line":1,"column":29},"end":{"line":1,"column":37}}, + "operator": "delete", + "prefix": true, + "argument": { + "type": "Identifier", + "start":36,"end":37,"loc":{"start":{"line":1,"column":36},"end":{"line":1,"column":37},"identifierName":"i"}, + "name": "i" + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start":15,"end":28,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":28}}, + "value": { + "type": "DirectiveLiteral", + "start":15,"end":27,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":27}}, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + }, + "arguments": [], + "extra": { + "parenthesized": true, + "parenStart": 0 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/467/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/467/options.json deleted file mode 100644 index 31b4c6d2a040..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/467/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "'with' in strict mode (1:29)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/467/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/467/output.json new file mode 100644 index 000000000000..62cf67d34e04 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/467/output.json @@ -0,0 +1,71 @@ +{ + "type": "File", + "start":0,"end":43,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":43}}, + "errors": [ + "SyntaxError: 'with' in strict mode (1:29)" + ], + "program": { + "type": "Program", + "start":0,"end":43,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":43}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":43,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":43}}, + "expression": { + "type": "CallExpression", + "start":1,"end":42,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":42}}, + "callee": { + "type": "FunctionExpression", + "start":1,"end":40,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":40}}, + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":13,"end":40,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":40}}, + "body": [ + { + "type": "WithStatement", + "start":29,"end":38,"loc":{"start":{"line":1,"column":29},"end":{"line":1,"column":38}}, + "object": { + "type": "Identifier", + "start":35,"end":36,"loc":{"start":{"line":1,"column":35},"end":{"line":1,"column":36},"identifierName":"i"}, + "name": "i" + }, + "body": { + "type": "EmptyStatement", + "start":37,"end":38,"loc":{"start":{"line":1,"column":37},"end":{"line":1,"column":38}} + } + } + ], + "directives": [ + { + "type": "Directive", + "start":15,"end":28,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":28}}, + "value": { + "type": "DirectiveLiteral", + "start":15,"end":27,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":27}}, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + }, + "arguments": [], + "extra": { + "parenthesized": true, + "parenStart": 0 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/468/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/468/options.json deleted file mode 100644 index b463f315f9eb..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/468/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'eval' in strict mode (1:36)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/468/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/468/output.json new file mode 100644 index 000000000000..fcd0ab9858ca --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/468/output.json @@ -0,0 +1,74 @@ +{ + "type": "File", + "start":0,"end":48,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":48}}, + "errors": [ + "SyntaxError: Binding 'eval' in strict mode (1:36)" + ], + "program": { + "type": "Program", + "start":0,"end":48,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":48}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":48,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":48}}, + "id": { + "type": "Identifier", + "start":9,"end":14,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":14},"identifierName":"hello"}, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":17,"end":48,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":48}}, + "body": [ + { + "type": "VariableDeclaration", + "start":32,"end":46,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":46}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":36,"end":45,"loc":{"start":{"line":1,"column":36},"end":{"line":1,"column":45}}, + "id": { + "type": "Identifier", + "start":36,"end":40,"loc":{"start":{"line":1,"column":36},"end":{"line":1,"column":40},"identifierName":"eval"}, + "name": "eval" + }, + "init": { + "type": "NumericLiteral", + "start":43,"end":45,"loc":{"start":{"line":1,"column":43},"end":{"line":1,"column":45}}, + "extra": { + "rawValue": 10, + "raw": "10" + }, + "value": 10 + } + } + ], + "kind": "var" + } + ], + "directives": [ + { + "type": "Directive", + "start":18,"end":31,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":31}}, + "value": { + "type": "DirectiveLiteral", + "start":18,"end":30,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":30}}, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/469/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/469/options.json deleted file mode 100644 index 9e9f875dfbb5..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/469/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'arguments' in strict mode (1:36)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/469/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/469/output.json new file mode 100644 index 000000000000..d557326e9973 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/469/output.json @@ -0,0 +1,74 @@ +{ + "type": "File", + "start":0,"end":53,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":53}}, + "errors": [ + "SyntaxError: Binding 'arguments' in strict mode (1:36)" + ], + "program": { + "type": "Program", + "start":0,"end":53,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":53}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":53,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":53}}, + "id": { + "type": "Identifier", + "start":9,"end":14,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":14},"identifierName":"hello"}, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":17,"end":53,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":53}}, + "body": [ + { + "type": "VariableDeclaration", + "start":32,"end":51,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":51}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":36,"end":50,"loc":{"start":{"line":1,"column":36},"end":{"line":1,"column":50}}, + "id": { + "type": "Identifier", + "start":36,"end":45,"loc":{"start":{"line":1,"column":36},"end":{"line":1,"column":45},"identifierName":"arguments"}, + "name": "arguments" + }, + "init": { + "type": "NumericLiteral", + "start":48,"end":50,"loc":{"start":{"line":1,"column":48},"end":{"line":1,"column":50}}, + "extra": { + "rawValue": 10, + "raw": "10" + }, + "value": 10 + } + } + ], + "kind": "var" + } + ], + "directives": [ + { + "type": "Directive", + "start":18,"end":31,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":31}}, + "value": { + "type": "DirectiveLiteral", + "start":18,"end":30,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":30}}, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/47/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/47/output.json index ea571b1b6b0c..8b919bca3185 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/47/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/47/output.json @@ -1,62 +1,18 @@ { "type": "File", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, "program": { "type": "Program", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 2 - } - }, + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}}, "expression": { "type": "NumericLiteral", - "start": 0, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 2 - } - }, + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}}, "extra": { "rawValue": 42, "raw": "42" @@ -67,34 +23,12 @@ { "type": "CommentBlock", "value": "The", - "start": 3, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 10 - } - } + "start":3,"end":10,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":10}} }, { "type": "CommentBlock", "value": "Answer", - "start": 11, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 21 - } - } + "start":11,"end":21,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":21}} } ] } @@ -105,34 +39,12 @@ { "type": "CommentBlock", "value": "The", - "start": 3, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 10 - } - } + "start":3,"end":10,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":10}} }, { "type": "CommentBlock", "value": "Answer", - "start": 11, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 21 - } - } + "start":11,"end":21,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":21}} } ] } \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/470/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/470/options.json deleted file mode 100644 index b5fd79ff5ff1..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/470/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'eval' in strict mode (1:47)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/470/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/470/output.json new file mode 100644 index 000000000000..3040718fd546 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/470/output.json @@ -0,0 +1,75 @@ +{ + "type": "File", + "start":0,"end":58,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":58}}, + "errors": [ + "SyntaxError: Binding 'eval' in strict mode (1:47)" + ], + "program": { + "type": "Program", + "start":0,"end":58,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":58}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":58,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":58}}, + "id": { + "type": "Identifier", + "start":9,"end":14,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":14},"identifierName":"hello"}, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":17,"end":58,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":58}}, + "body": [ + { + "type": "TryStatement", + "start":32,"end":56,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":56}}, + "block": { + "type": "BlockStatement", + "start":36,"end":39,"loc":{"start":{"line":1,"column":36},"end":{"line":1,"column":39}}, + "body": [], + "directives": [] + }, + "handler": { + "type": "CatchClause", + "start":40,"end":56,"loc":{"start":{"line":1,"column":40},"end":{"line":1,"column":56}}, + "param": { + "type": "Identifier", + "start":47,"end":51,"loc":{"start":{"line":1,"column":47},"end":{"line":1,"column":51},"identifierName":"eval"}, + "name": "eval" + }, + "body": { + "type": "BlockStatement", + "start":53,"end":56,"loc":{"start":{"line":1,"column":53},"end":{"line":1,"column":56}}, + "body": [], + "directives": [] + } + }, + "finalizer": null + } + ], + "directives": [ + { + "type": "Directive", + "start":18,"end":31,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":31}}, + "value": { + "type": "DirectiveLiteral", + "start":18,"end":30,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":30}}, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/471/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/471/options.json deleted file mode 100644 index 15b7ac855374..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/471/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'arguments' in strict mode (1:47)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/471/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/471/output.json new file mode 100644 index 000000000000..429d686ed48c --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/471/output.json @@ -0,0 +1,75 @@ +{ + "type": "File", + "start":0,"end":63,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":63}}, + "errors": [ + "SyntaxError: Binding 'arguments' in strict mode (1:47)" + ], + "program": { + "type": "Program", + "start":0,"end":63,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":63}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":63,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":63}}, + "id": { + "type": "Identifier", + "start":9,"end":14,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":14},"identifierName":"hello"}, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":17,"end":63,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":63}}, + "body": [ + { + "type": "TryStatement", + "start":32,"end":61,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":61}}, + "block": { + "type": "BlockStatement", + "start":36,"end":39,"loc":{"start":{"line":1,"column":36},"end":{"line":1,"column":39}}, + "body": [], + "directives": [] + }, + "handler": { + "type": "CatchClause", + "start":40,"end":61,"loc":{"start":{"line":1,"column":40},"end":{"line":1,"column":61}}, + "param": { + "type": "Identifier", + "start":47,"end":56,"loc":{"start":{"line":1,"column":47},"end":{"line":1,"column":56},"identifierName":"arguments"}, + "name": "arguments" + }, + "body": { + "type": "BlockStatement", + "start":58,"end":61,"loc":{"start":{"line":1,"column":58},"end":{"line":1,"column":61}}, + "body": [], + "directives": [] + } + }, + "finalizer": null + } + ], + "directives": [ + { + "type": "Directive", + "start":18,"end":31,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":31}}, + "value": { + "type": "DirectiveLiteral", + "start":18,"end":30,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":30}}, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/472/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/472/options.json deleted file mode 100644 index 95f470aed511..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/472/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Assigning to 'eval' in strict mode (1:32)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/472/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/472/output.json new file mode 100644 index 000000000000..79c71ebb542f --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/472/output.json @@ -0,0 +1,72 @@ +{ + "type": "File", + "start":0,"end":44,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":44}}, + "errors": [ + "SyntaxError: Assigning to 'eval' in strict mode (1:32)" + ], + "program": { + "type": "Program", + "start":0,"end":44,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":44}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":44,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":44}}, + "id": { + "type": "Identifier", + "start":9,"end":14,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":14},"identifierName":"hello"}, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":17,"end":44,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":44}}, + "body": [ + { + "type": "ExpressionStatement", + "start":32,"end":42,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":42}}, + "expression": { + "type": "AssignmentExpression", + "start":32,"end":41,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":41}}, + "operator": "=", + "left": { + "type": "Identifier", + "start":32,"end":36,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":36},"identifierName":"eval"}, + "name": "eval" + }, + "right": { + "type": "NumericLiteral", + "start":39,"end":41,"loc":{"start":{"line":1,"column":39},"end":{"line":1,"column":41}}, + "extra": { + "rawValue": 10, + "raw": "10" + }, + "value": 10 + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start":18,"end":31,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":31}}, + "value": { + "type": "DirectiveLiteral", + "start":18,"end":30,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":30}}, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/473/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/473/options.json deleted file mode 100644 index ef45890ab53f..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/473/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Assigning to 'arguments' in strict mode (1:32)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/473/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/473/output.json new file mode 100644 index 000000000000..ec34fa9d5ce8 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/473/output.json @@ -0,0 +1,72 @@ +{ + "type": "File", + "start":0,"end":49,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":49}}, + "errors": [ + "SyntaxError: Assigning to 'arguments' in strict mode (1:32)" + ], + "program": { + "type": "Program", + "start":0,"end":49,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":49}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":49,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":49}}, + "id": { + "type": "Identifier", + "start":9,"end":14,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":14},"identifierName":"hello"}, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":17,"end":49,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":49}}, + "body": [ + { + "type": "ExpressionStatement", + "start":32,"end":47,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":47}}, + "expression": { + "type": "AssignmentExpression", + "start":32,"end":46,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":46}}, + "operator": "=", + "left": { + "type": "Identifier", + "start":32,"end":41,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":41},"identifierName":"arguments"}, + "name": "arguments" + }, + "right": { + "type": "NumericLiteral", + "start":44,"end":46,"loc":{"start":{"line":1,"column":44},"end":{"line":1,"column":46}}, + "extra": { + "rawValue": 10, + "raw": "10" + }, + "value": 10 + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start":18,"end":31,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":31}}, + "value": { + "type": "DirectiveLiteral", + "start":18,"end":30,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":30}}, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/474/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/474/options.json deleted file mode 100644 index 2783b68b3d58..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/474/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Assigning to 'eval' in strict mode (1:34)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/474/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/474/output.json new file mode 100644 index 000000000000..2ad942222305 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/474/output.json @@ -0,0 +1,64 @@ +{ + "type": "File", + "start":0,"end":41,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":41}}, + "errors": [ + "SyntaxError: Assigning to 'eval' in strict mode (1:34)" + ], + "program": { + "type": "Program", + "start":0,"end":41,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":41}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":41,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":41}}, + "id": { + "type": "Identifier", + "start":9,"end":14,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":14},"identifierName":"hello"}, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":17,"end":41,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":41}}, + "body": [ + { + "type": "ExpressionStatement", + "start":32,"end":39,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":39}}, + "expression": { + "type": "UpdateExpression", + "start":32,"end":38,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":38}}, + "operator": "++", + "prefix": true, + "argument": { + "type": "Identifier", + "start":34,"end":38,"loc":{"start":{"line":1,"column":34},"end":{"line":1,"column":38},"identifierName":"eval"}, + "name": "eval" + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start":18,"end":31,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":31}}, + "value": { + "type": "DirectiveLiteral", + "start":18,"end":30,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":30}}, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/475/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/475/options.json deleted file mode 100644 index 2783b68b3d58..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/475/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Assigning to 'eval' in strict mode (1:34)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/475/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/475/output.json new file mode 100644 index 000000000000..c85c53c215da --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/475/output.json @@ -0,0 +1,64 @@ +{ + "type": "File", + "start":0,"end":41,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":41}}, + "errors": [ + "SyntaxError: Assigning to 'eval' in strict mode (1:34)" + ], + "program": { + "type": "Program", + "start":0,"end":41,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":41}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":41,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":41}}, + "id": { + "type": "Identifier", + "start":9,"end":14,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":14},"identifierName":"hello"}, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":17,"end":41,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":41}}, + "body": [ + { + "type": "ExpressionStatement", + "start":32,"end":39,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":39}}, + "expression": { + "type": "UpdateExpression", + "start":32,"end":38,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":38}}, + "operator": "--", + "prefix": true, + "argument": { + "type": "Identifier", + "start":34,"end":38,"loc":{"start":{"line":1,"column":34},"end":{"line":1,"column":38},"identifierName":"eval"}, + "name": "eval" + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start":18,"end":31,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":31}}, + "value": { + "type": "DirectiveLiteral", + "start":18,"end":30,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":30}}, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/476/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/476/options.json deleted file mode 100644 index fe2654496fc9..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/476/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Assigning to 'arguments' in strict mode (1:34)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/476/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/476/output.json new file mode 100644 index 000000000000..8635017ed5c5 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/476/output.json @@ -0,0 +1,64 @@ +{ + "type": "File", + "start":0,"end":46,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":46}}, + "errors": [ + "SyntaxError: Assigning to 'arguments' in strict mode (1:34)" + ], + "program": { + "type": "Program", + "start":0,"end":46,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":46}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":46,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":46}}, + "id": { + "type": "Identifier", + "start":9,"end":14,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":14},"identifierName":"hello"}, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":17,"end":46,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":46}}, + "body": [ + { + "type": "ExpressionStatement", + "start":32,"end":44,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":44}}, + "expression": { + "type": "UpdateExpression", + "start":32,"end":43,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":43}}, + "operator": "++", + "prefix": true, + "argument": { + "type": "Identifier", + "start":34,"end":43,"loc":{"start":{"line":1,"column":34},"end":{"line":1,"column":43},"identifierName":"arguments"}, + "name": "arguments" + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start":18,"end":31,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":31}}, + "value": { + "type": "DirectiveLiteral", + "start":18,"end":30,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":30}}, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/477/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/477/options.json deleted file mode 100644 index fe2654496fc9..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/477/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Assigning to 'arguments' in strict mode (1:34)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/477/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/477/output.json new file mode 100644 index 000000000000..0090b6011203 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/477/output.json @@ -0,0 +1,64 @@ +{ + "type": "File", + "start":0,"end":46,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":46}}, + "errors": [ + "SyntaxError: Assigning to 'arguments' in strict mode (1:34)" + ], + "program": { + "type": "Program", + "start":0,"end":46,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":46}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":46,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":46}}, + "id": { + "type": "Identifier", + "start":9,"end":14,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":14},"identifierName":"hello"}, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":17,"end":46,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":46}}, + "body": [ + { + "type": "ExpressionStatement", + "start":32,"end":44,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":44}}, + "expression": { + "type": "UpdateExpression", + "start":32,"end":43,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":43}}, + "operator": "--", + "prefix": true, + "argument": { + "type": "Identifier", + "start":34,"end":43,"loc":{"start":{"line":1,"column":34},"end":{"line":1,"column":43},"identifierName":"arguments"}, + "name": "arguments" + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start":18,"end":31,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":31}}, + "value": { + "type": "DirectiveLiteral", + "start":18,"end":30,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":30}}, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/478/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/478/options.json deleted file mode 100644 index 95f470aed511..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/478/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Assigning to 'eval' in strict mode (1:32)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/478/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/478/output.json new file mode 100644 index 000000000000..439436ef7e82 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/478/output.json @@ -0,0 +1,64 @@ +{ + "type": "File", + "start":0,"end":41,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":41}}, + "errors": [ + "SyntaxError: Assigning to 'eval' in strict mode (1:32)" + ], + "program": { + "type": "Program", + "start":0,"end":41,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":41}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":41,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":41}}, + "id": { + "type": "Identifier", + "start":9,"end":14,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":14},"identifierName":"hello"}, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":17,"end":41,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":41}}, + "body": [ + { + "type": "ExpressionStatement", + "start":32,"end":39,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":39}}, + "expression": { + "type": "UpdateExpression", + "start":32,"end":38,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":38}}, + "operator": "++", + "prefix": false, + "argument": { + "type": "Identifier", + "start":32,"end":36,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":36},"identifierName":"eval"}, + "name": "eval" + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start":18,"end":31,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":31}}, + "value": { + "type": "DirectiveLiteral", + "start":18,"end":30,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":30}}, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/479/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/479/options.json deleted file mode 100644 index 95f470aed511..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/479/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Assigning to 'eval' in strict mode (1:32)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/479/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/479/output.json new file mode 100644 index 000000000000..b68c731a58a7 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/479/output.json @@ -0,0 +1,64 @@ +{ + "type": "File", + "start":0,"end":41,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":41}}, + "errors": [ + "SyntaxError: Assigning to 'eval' in strict mode (1:32)" + ], + "program": { + "type": "Program", + "start":0,"end":41,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":41}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":41,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":41}}, + "id": { + "type": "Identifier", + "start":9,"end":14,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":14},"identifierName":"hello"}, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":17,"end":41,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":41}}, + "body": [ + { + "type": "ExpressionStatement", + "start":32,"end":39,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":39}}, + "expression": { + "type": "UpdateExpression", + "start":32,"end":38,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":38}}, + "operator": "--", + "prefix": false, + "argument": { + "type": "Identifier", + "start":32,"end":36,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":36},"identifierName":"eval"}, + "name": "eval" + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start":18,"end":31,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":31}}, + "value": { + "type": "DirectiveLiteral", + "start":18,"end":30,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":30}}, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/48/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/48/output.json index 7def54a91b1e..06e1564e760d 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/48/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/48/output.json @@ -1,62 +1,18 @@ { "type": "File", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, "program": { "type": "Program", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 2 - } - }, + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}}, "expression": { "type": "NumericLiteral", - "start": 0, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 2 - } - }, + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}}, "extra": { "rawValue": 42, "raw": "42" @@ -67,34 +23,12 @@ { "type": "CommentBlock", "value": "the", - "start": 3, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 10 - } - } + "start":3,"end":10,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":10}} }, { "type": "CommentBlock", "value": "answer", - "start": 11, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 21 - } - } + "start":11,"end":21,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":21}} } ] } @@ -105,34 +39,12 @@ { "type": "CommentBlock", "value": "the", - "start": 3, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 10 - } - } + "start":3,"end":10,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":10}} }, { "type": "CommentBlock", "value": "answer", - "start": 11, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 21 - } - } + "start":11,"end":21,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":21}} } ] } \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/480/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/480/options.json deleted file mode 100644 index ef45890ab53f..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/480/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Assigning to 'arguments' in strict mode (1:32)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/480/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/480/output.json new file mode 100644 index 000000000000..52dbdc3d5ca5 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/480/output.json @@ -0,0 +1,64 @@ +{ + "type": "File", + "start":0,"end":46,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":46}}, + "errors": [ + "SyntaxError: Assigning to 'arguments' in strict mode (1:32)" + ], + "program": { + "type": "Program", + "start":0,"end":46,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":46}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":46,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":46}}, + "id": { + "type": "Identifier", + "start":9,"end":14,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":14},"identifierName":"hello"}, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":17,"end":46,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":46}}, + "body": [ + { + "type": "ExpressionStatement", + "start":32,"end":44,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":44}}, + "expression": { + "type": "UpdateExpression", + "start":32,"end":43,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":43}}, + "operator": "++", + "prefix": false, + "argument": { + "type": "Identifier", + "start":32,"end":41,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":41},"identifierName":"arguments"}, + "name": "arguments" + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start":18,"end":31,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":31}}, + "value": { + "type": "DirectiveLiteral", + "start":18,"end":30,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":30}}, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/481/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/481/options.json deleted file mode 100644 index ef45890ab53f..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/481/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Assigning to 'arguments' in strict mode (1:32)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/481/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/481/output.json new file mode 100644 index 000000000000..48c2df5468eb --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/481/output.json @@ -0,0 +1,64 @@ +{ + "type": "File", + "start":0,"end":46,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":46}}, + "errors": [ + "SyntaxError: Assigning to 'arguments' in strict mode (1:32)" + ], + "program": { + "type": "Program", + "start":0,"end":46,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":46}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":46,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":46}}, + "id": { + "type": "Identifier", + "start":9,"end":14,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":14},"identifierName":"hello"}, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":17,"end":46,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":46}}, + "body": [ + { + "type": "ExpressionStatement", + "start":32,"end":44,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":44}}, + "expression": { + "type": "UpdateExpression", + "start":32,"end":43,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":43}}, + "operator": "--", + "prefix": false, + "argument": { + "type": "Identifier", + "start":32,"end":41,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":41},"identifierName":"arguments"}, + "name": "arguments" + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start":18,"end":31,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":31}}, + "value": { + "type": "DirectiveLiteral", + "start":18,"end":30,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":30}}, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/482/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/482/options.json deleted file mode 100644 index 6db4ae7bf008..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/482/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'eval' in strict mode (1:41)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/482/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/482/output.json new file mode 100644 index 000000000000..3c4ac7fd38dd --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/482/output.json @@ -0,0 +1,67 @@ +{ + "type": "File", + "start":0,"end":53,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":53}}, + "errors": [ + "SyntaxError: Binding 'eval' in strict mode (1:41)" + ], + "program": { + "type": "Program", + "start":0,"end":53,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":53}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":53,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":53}}, + "id": { + "type": "Identifier", + "start":9,"end":14,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":14},"identifierName":"hello"}, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":17,"end":53,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":53}}, + "body": [ + { + "type": "FunctionDeclaration", + "start":32,"end":51,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":51}}, + "id": { + "type": "Identifier", + "start":41,"end":45,"loc":{"start":{"line":1,"column":41},"end":{"line":1,"column":45},"identifierName":"eval"}, + "name": "eval" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":48,"end":51,"loc":{"start":{"line":1,"column":48},"end":{"line":1,"column":51}}, + "body": [], + "directives": [] + } + } + ], + "directives": [ + { + "type": "Directive", + "start":18,"end":31,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":31}}, + "value": { + "type": "DirectiveLiteral", + "start":18,"end":30,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":30}}, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/483/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/483/options.json deleted file mode 100644 index b02fb725c767..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/483/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'arguments' in strict mode (1:41)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/483/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/483/output.json new file mode 100644 index 000000000000..e183294a232f --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/483/output.json @@ -0,0 +1,67 @@ +{ + "type": "File", + "start":0,"end":58,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":58}}, + "errors": [ + "SyntaxError: Binding 'arguments' in strict mode (1:41)" + ], + "program": { + "type": "Program", + "start":0,"end":58,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":58}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":58,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":58}}, + "id": { + "type": "Identifier", + "start":9,"end":14,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":14},"identifierName":"hello"}, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":17,"end":58,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":58}}, + "body": [ + { + "type": "FunctionDeclaration", + "start":32,"end":56,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":56}}, + "id": { + "type": "Identifier", + "start":41,"end":50,"loc":{"start":{"line":1,"column":41},"end":{"line":1,"column":50},"identifierName":"arguments"}, + "name": "arguments" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":53,"end":56,"loc":{"start":{"line":1,"column":53},"end":{"line":1,"column":56}}, + "body": [], + "directives": [] + } + } + ], + "directives": [ + { + "type": "Directive", + "start":18,"end":31,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":31}}, + "value": { + "type": "DirectiveLiteral", + "start":18,"end":30,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":30}}, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/484/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/484/options.json deleted file mode 100644 index a7490f9321d4..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/484/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'eval' in strict mode (1:9)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/484/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/484/output.json new file mode 100644 index 000000000000..c252adad5c36 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/484/output.json @@ -0,0 +1,48 @@ +{ + "type": "File", + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, + "errors": [ + "SyntaxError: Binding 'eval' in strict mode (1:9)" + ], + "program": { + "type": "Program", + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, + "id": { + "type": "Identifier", + "start":9,"end":13,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":13},"identifierName":"eval"}, + "name": "eval" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":16,"end":32,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":32}}, + "body": [], + "directives": [ + { + "type": "Directive", + "start":17,"end":30,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":30}}, + "value": { + "type": "DirectiveLiteral", + "start":17,"end":29,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":29}}, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/485/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/485/options.json deleted file mode 100644 index 80b8b2d85caa..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/485/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'arguments' in strict mode (1:9)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/485/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/485/output.json new file mode 100644 index 000000000000..2c691b4f70f1 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/485/output.json @@ -0,0 +1,48 @@ +{ + "type": "File", + "start":0,"end":37,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":37}}, + "errors": [ + "SyntaxError: Binding 'arguments' in strict mode (1:9)" + ], + "program": { + "type": "Program", + "start":0,"end":37,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":37}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":37,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":37}}, + "id": { + "type": "Identifier", + "start":9,"end":18,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":18},"identifierName":"arguments"}, + "name": "arguments" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":21,"end":37,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":37}}, + "body": [], + "directives": [ + { + "type": "Directive", + "start":22,"end":35,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":35}}, + "value": { + "type": "DirectiveLiteral", + "start":22,"end":34,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":34}}, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/486/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/486/options.json deleted file mode 100644 index 706ba8380c70..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/486/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'eval' in strict mode (1:42)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/486/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/486/output.json new file mode 100644 index 000000000000..9e3046fe279b --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/486/output.json @@ -0,0 +1,80 @@ +{ + "type": "File", + "start":0,"end":57,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":57}}, + "errors": [ + "SyntaxError: Binding 'eval' in strict mode (1:42)" + ], + "program": { + "type": "Program", + "start":0,"end":57,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":57}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":57,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":57}}, + "id": { + "type": "Identifier", + "start":9,"end":14,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":14},"identifierName":"hello"}, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":17,"end":57,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":57}}, + "body": [ + { + "type": "ExpressionStatement", + "start":32,"end":55,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":55}}, + "expression": { + "type": "CallExpression", + "start":33,"end":54,"loc":{"start":{"line":1,"column":33},"end":{"line":1,"column":54}}, + "callee": { + "type": "FunctionExpression", + "start":33,"end":52,"loc":{"start":{"line":1,"column":33},"end":{"line":1,"column":52}}, + "id": { + "type": "Identifier", + "start":42,"end":46,"loc":{"start":{"line":1,"column":42},"end":{"line":1,"column":46},"identifierName":"eval"}, + "name": "eval" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":49,"end":52,"loc":{"start":{"line":1,"column":49},"end":{"line":1,"column":52}}, + "body": [], + "directives": [] + } + }, + "arguments": [], + "extra": { + "parenthesized": true, + "parenStart": 32 + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start":18,"end":31,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":31}}, + "value": { + "type": "DirectiveLiteral", + "start":18,"end":30,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":30}}, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/487/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/487/options.json deleted file mode 100644 index d0e461af3911..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/487/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'arguments' in strict mode (1:42)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/487/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/487/output.json new file mode 100644 index 000000000000..2502c52e184c --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/487/output.json @@ -0,0 +1,80 @@ +{ + "type": "File", + "start":0,"end":62,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":62}}, + "errors": [ + "SyntaxError: Binding 'arguments' in strict mode (1:42)" + ], + "program": { + "type": "Program", + "start":0,"end":62,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":62}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":62,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":62}}, + "id": { + "type": "Identifier", + "start":9,"end":14,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":14},"identifierName":"hello"}, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":17,"end":62,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":62}}, + "body": [ + { + "type": "ExpressionStatement", + "start":32,"end":60,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":60}}, + "expression": { + "type": "CallExpression", + "start":33,"end":59,"loc":{"start":{"line":1,"column":33},"end":{"line":1,"column":59}}, + "callee": { + "type": "FunctionExpression", + "start":33,"end":57,"loc":{"start":{"line":1,"column":33},"end":{"line":1,"column":57}}, + "id": { + "type": "Identifier", + "start":42,"end":51,"loc":{"start":{"line":1,"column":42},"end":{"line":1,"column":51},"identifierName":"arguments"}, + "name": "arguments" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":54,"end":57,"loc":{"start":{"line":1,"column":54},"end":{"line":1,"column":57}}, + "body": [], + "directives": [] + } + }, + "arguments": [], + "extra": { + "parenthesized": true, + "parenStart": 32 + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start":18,"end":31,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":31}}, + "value": { + "type": "DirectiveLiteral", + "start":18,"end":30,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":30}}, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/488/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/488/options.json deleted file mode 100644 index ee2e7d7c7745..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/488/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'eval' in strict mode (1:10)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/488/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/488/output.json new file mode 100644 index 000000000000..887c41149531 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/488/output.json @@ -0,0 +1,61 @@ +{ + "type": "File", + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, + "errors": [ + "SyntaxError: Binding 'eval' in strict mode (1:10)" + ], + "program": { + "type": "Program", + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, + "expression": { + "type": "CallExpression", + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, + "callee": { + "type": "FunctionExpression", + "start":1,"end":33,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":33}}, + "id": { + "type": "Identifier", + "start":10,"end":14,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":14},"identifierName":"eval"}, + "name": "eval" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":17,"end":33,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":33}}, + "body": [], + "directives": [ + { + "type": "Directive", + "start":18,"end":31,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":31}}, + "value": { + "type": "DirectiveLiteral", + "start":18,"end":30,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":30}}, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + }, + "extra": { + "parenthesized": true, + "parenStart": 0 + } + }, + "arguments": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/489/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/489/options.json deleted file mode 100644 index bb4b812bab32..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/489/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'arguments' in strict mode (1:10)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/489/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/489/output.json new file mode 100644 index 000000000000..250afef7d81d --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/489/output.json @@ -0,0 +1,61 @@ +{ + "type": "File", + "start":0,"end":41,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":41}}, + "errors": [ + "SyntaxError: Binding 'arguments' in strict mode (1:10)" + ], + "program": { + "type": "Program", + "start":0,"end":41,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":41}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":41,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":41}}, + "expression": { + "type": "CallExpression", + "start":0,"end":41,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":41}}, + "callee": { + "type": "FunctionExpression", + "start":1,"end":38,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":38}}, + "id": { + "type": "Identifier", + "start":10,"end":19,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":19},"identifierName":"arguments"}, + "name": "arguments" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":22,"end":38,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":38}}, + "body": [], + "directives": [ + { + "type": "Directive", + "start":23,"end":36,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":36}}, + "value": { + "type": "DirectiveLiteral", + "start":23,"end":35,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":35}}, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + }, + "extra": { + "parenthesized": true, + "parenStart": 0 + } + }, + "arguments": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/49/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/49/output.json index 5523233f4763..fe7e90ef9417 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/49/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/49/output.json @@ -1,62 +1,18 @@ { "type": "File", - "start": 0, - "end": 44, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 13 - } - }, + "start":0,"end":44,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":13}}, "program": { "type": "Program", - "start": 0, - "end": 44, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 13 - } - }, + "start":0,"end":44,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":13}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 42, - "end": 44, - "loc": { - "start": { - "line": 5, - "column": 11 - }, - "end": { - "line": 5, - "column": 13 - } - }, + "start":42,"end":44,"loc":{"start":{"line":5,"column":11},"end":{"line":5,"column":13}}, "expression": { "type": "NumericLiteral", - "start": 42, - "end": 44, - "loc": { - "start": { - "line": 5, - "column": 11 - }, - "end": { - "line": 5, - "column": 13 - } - }, + "start":42,"end":44,"loc":{"start":{"line":5,"column":11},"end":{"line":5,"column":13}}, "extra": { "rawValue": 42, "raw": "42" @@ -67,18 +23,7 @@ { "type": "CommentBlock", "value": " multiline\ncomment\nshould\nbe\nignored ", - "start": 0, - "end": 41, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 10 - } - } + "start":0,"end":41,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":10}} } ] } @@ -89,18 +34,7 @@ { "type": "CommentBlock", "value": " multiline\ncomment\nshould\nbe\nignored ", - "start": 0, - "end": 41, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 10 - } - } + "start":0,"end":41,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":10}} } ] } \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/490/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/490/options.json deleted file mode 100644 index b5fd79ff5ff1..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/490/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'eval' in strict mode (1:47)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/490/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/490/output.json new file mode 100644 index 000000000000..03985eff0b57 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/490/output.json @@ -0,0 +1,93 @@ +{ + "type": "File", + "start":0,"end":63,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":63}}, + "errors": [ + "SyntaxError: Binding 'eval' in strict mode (1:47)" + ], + "program": { + "type": "Program", + "start":0,"end":63,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":63}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":63,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":63}}, + "id": { + "type": "Identifier", + "start":9,"end":14,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":14},"identifierName":"hello"}, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":17,"end":63,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":63}}, + "body": [ + { + "type": "ExpressionStatement", + "start":32,"end":61,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":61}}, + "expression": { + "type": "ObjectExpression", + "start":33,"end":59,"loc":{"start":{"line":1,"column":33},"end":{"line":1,"column":59}}, + "properties": [ + { + "type": "ObjectProperty", + "start":35,"end":57,"loc":{"start":{"line":1,"column":35},"end":{"line":1,"column":57}}, + "method": false, + "key": { + "type": "Identifier", + "start":35,"end":36,"loc":{"start":{"line":1,"column":35},"end":{"line":1,"column":36},"identifierName":"s"}, + "name": "s" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "FunctionExpression", + "start":38,"end":57,"loc":{"start":{"line":1,"column":38},"end":{"line":1,"column":57}}, + "id": { + "type": "Identifier", + "start":47,"end":51,"loc":{"start":{"line":1,"column":47},"end":{"line":1,"column":51},"identifierName":"eval"}, + "name": "eval" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":54,"end":57,"loc":{"start":{"line":1,"column":54},"end":{"line":1,"column":57}}, + "body": [], + "directives": [] + } + } + } + ], + "extra": { + "parenthesized": true, + "parenStart": 32 + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start":18,"end":31,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":31}}, + "value": { + "type": "DirectiveLiteral", + "start":18,"end":30,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":30}}, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/491/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/491/options.json deleted file mode 100644 index ff90f09173c4..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/491/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'package' in strict mode (1:10)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/491/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/491/output.json new file mode 100644 index 000000000000..29ce013f0b8b --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/491/output.json @@ -0,0 +1,61 @@ +{ + "type": "File", + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":39}}, + "errors": [ + "SyntaxError: Binding 'package' in strict mode (1:10)" + ], + "program": { + "type": "Program", + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":39}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":39}}, + "expression": { + "type": "CallExpression", + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":39}}, + "callee": { + "type": "FunctionExpression", + "start":1,"end":36,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":36}}, + "id": { + "type": "Identifier", + "start":10,"end":17,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":17},"identifierName":"package"}, + "name": "package" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":20,"end":36,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":36}}, + "body": [], + "directives": [ + { + "type": "Directive", + "start":21,"end":34,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":34}}, + "value": { + "type": "DirectiveLiteral", + "start":21,"end":33,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":33}}, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + }, + "extra": { + "parenthesized": true, + "parenStart": 0 + } + }, + "arguments": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/492/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/492/options.json deleted file mode 100644 index b8f97ca4fe56..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/492/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'eval' in strict mode (1:48)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/492/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/492/output.json new file mode 100644 index 000000000000..60d4df26f9f4 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/492/output.json @@ -0,0 +1,112 @@ +{ + "type": "File", + "start":0,"end":63,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":63}}, + "errors": [ + "SyntaxError: Binding 'eval' in strict mode (1:48)" + ], + "program": { + "type": "Program", + "start":0,"end":63,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":63}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":63,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":63}}, + "id": { + "type": "Identifier", + "start":9,"end":14,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":14},"identifierName":"hello"}, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":17,"end":63,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":63}}, + "body": [ + { + "type": "ExpressionStatement", + "start":32,"end":61,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":61}}, + "expression": { + "type": "ObjectExpression", + "start":33,"end":59,"loc":{"start":{"line":1,"column":33},"end":{"line":1,"column":59}}, + "properties": [ + { + "type": "ObjectProperty", + "start":35,"end":40,"loc":{"start":{"line":1,"column":35},"end":{"line":1,"column":40}}, + "method": false, + "key": { + "type": "Identifier", + "start":35,"end":36,"loc":{"start":{"line":1,"column":35},"end":{"line":1,"column":36},"identifierName":"i"}, + "name": "i" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "NumericLiteral", + "start":38,"end":40,"loc":{"start":{"line":1,"column":38},"end":{"line":1,"column":40}}, + "extra": { + "rawValue": 10, + "raw": "10" + }, + "value": 10 + } + }, + { + "type": "ObjectMethod", + "start":42,"end":57,"loc":{"start":{"line":1,"column":42},"end":{"line":1,"column":57}}, + "method": false, + "key": { + "type": "Identifier", + "start":46,"end":47,"loc":{"start":{"line":1,"column":46},"end":{"line":1,"column":47},"identifierName":"s"}, + "name": "s" + }, + "computed": false, + "kind": "set", + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start":48,"end":52,"loc":{"start":{"line":1,"column":48},"end":{"line":1,"column":52},"identifierName":"eval"}, + "name": "eval" + } + ], + "body": { + "type": "BlockStatement", + "start":54,"end":57,"loc":{"start":{"line":1,"column":54},"end":{"line":1,"column":57}}, + "body": [], + "directives": [] + } + } + ], + "extra": { + "parenthesized": true, + "parenStart": 32 + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start":18,"end":31,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":31}}, + "value": { + "type": "DirectiveLiteral", + "start":18,"end":30,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":30}}, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/493/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/493/options.json deleted file mode 100644 index 6db4ae7bf008..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/493/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'eval' in strict mode (1:41)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/493/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/493/output.json new file mode 100644 index 000000000000..4ee83b14028e --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/493/output.json @@ -0,0 +1,91 @@ +{ + "type": "File", + "start":0,"end":56,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":56}}, + "errors": [ + "SyntaxError: Binding 'eval' in strict mode (1:41)" + ], + "program": { + "type": "Program", + "start":0,"end":56,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":56}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":56,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":56}}, + "id": { + "type": "Identifier", + "start":9,"end":14,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":14},"identifierName":"hello"}, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":17,"end":56,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":56}}, + "body": [ + { + "type": "ExpressionStatement", + "start":32,"end":54,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":54}}, + "expression": { + "type": "ObjectExpression", + "start":33,"end":52,"loc":{"start":{"line":1,"column":33},"end":{"line":1,"column":52}}, + "properties": [ + { + "type": "ObjectMethod", + "start":35,"end":50,"loc":{"start":{"line":1,"column":35},"end":{"line":1,"column":50}}, + "method": false, + "key": { + "type": "Identifier", + "start":39,"end":40,"loc":{"start":{"line":1,"column":39},"end":{"line":1,"column":40},"identifierName":"s"}, + "name": "s" + }, + "computed": false, + "kind": "set", + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start":41,"end":45,"loc":{"start":{"line":1,"column":41},"end":{"line":1,"column":45},"identifierName":"eval"}, + "name": "eval" + } + ], + "body": { + "type": "BlockStatement", + "start":47,"end":50,"loc":{"start":{"line":1,"column":47},"end":{"line":1,"column":50}}, + "body": [], + "directives": [] + } + } + ], + "extra": { + "parenthesized": true, + "parenStart": 32 + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start":18,"end":31,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":31}}, + "value": { + "type": "DirectiveLiteral", + "start":18,"end":30,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":30}}, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/494/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/494/options.json deleted file mode 100644 index e80a856d48a0..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/494/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'eval' in strict mode (1:49)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/494/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/494/output.json new file mode 100644 index 000000000000..0c8905156ab1 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/494/output.json @@ -0,0 +1,99 @@ +{ + "type": "File", + "start":0,"end":64,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":64}}, + "errors": [ + "SyntaxError: Binding 'eval' in strict mode (1:49)" + ], + "program": { + "type": "Program", + "start":0,"end":64,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":64}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":64,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":64}}, + "id": { + "type": "Identifier", + "start":9,"end":14,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":14},"identifierName":"hello"}, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":17,"end":64,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":64}}, + "body": [ + { + "type": "ExpressionStatement", + "start":32,"end":62,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":62}}, + "expression": { + "type": "ObjectExpression", + "start":33,"end":60,"loc":{"start":{"line":1,"column":33},"end":{"line":1,"column":60}}, + "properties": [ + { + "type": "ObjectProperty", + "start":35,"end":58,"loc":{"start":{"line":1,"column":35},"end":{"line":1,"column":58}}, + "method": false, + "key": { + "type": "Identifier", + "start":35,"end":36,"loc":{"start":{"line":1,"column":35},"end":{"line":1,"column":36},"identifierName":"s"}, + "name": "s" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "FunctionExpression", + "start":38,"end":58,"loc":{"start":{"line":1,"column":38},"end":{"line":1,"column":58}}, + "id": { + "type": "Identifier", + "start":47,"end":48,"loc":{"start":{"line":1,"column":47},"end":{"line":1,"column":48},"identifierName":"s"}, + "name": "s" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start":49,"end":53,"loc":{"start":{"line":1,"column":49},"end":{"line":1,"column":53},"identifierName":"eval"}, + "name": "eval" + } + ], + "body": { + "type": "BlockStatement", + "start":55,"end":58,"loc":{"start":{"line":1,"column":55},"end":{"line":1,"column":58}}, + "body": [], + "directives": [] + } + } + } + ], + "extra": { + "parenthesized": true, + "parenStart": 32 + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start":18,"end":31,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":31}}, + "value": { + "type": "DirectiveLiteral", + "start":18,"end":30,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":30}}, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/495/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/495/options.json deleted file mode 100644 index d93d5b2aa62e..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/495/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'eval' in strict mode (1:15)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/495/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/495/output.json new file mode 100644 index 000000000000..3ccaace1b183 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/495/output.json @@ -0,0 +1,54 @@ +{ + "type": "File", + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, + "errors": [ + "SyntaxError: Binding 'eval' in strict mode (1:15)" + ], + "program": { + "type": "Program", + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, + "id": { + "type": "Identifier", + "start":9,"end":14,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":14},"identifierName":"hello"}, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start":15,"end":19,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":19},"identifierName":"eval"}, + "name": "eval" + } + ], + "body": { + "type": "BlockStatement", + "start":21,"end":36,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":36}}, + "body": [], + "directives": [ + { + "type": "Directive", + "start":22,"end":35,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":35}}, + "value": { + "type": "DirectiveLiteral", + "start":22,"end":34,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":34}}, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/496/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/496/options.json deleted file mode 100644 index 5d2dc563b16e..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/496/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'arguments' in strict mode (1:15)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/496/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/496/output.json new file mode 100644 index 000000000000..dc142e76101d --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/496/output.json @@ -0,0 +1,54 @@ +{ + "type": "File", + "start":0,"end":41,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":41}}, + "errors": [ + "SyntaxError: Binding 'arguments' in strict mode (1:15)" + ], + "program": { + "type": "Program", + "start":0,"end":41,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":41}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":41,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":41}}, + "id": { + "type": "Identifier", + "start":9,"end":14,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":14},"identifierName":"hello"}, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start":15,"end":24,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":24},"identifierName":"arguments"}, + "name": "arguments" + } + ], + "body": { + "type": "BlockStatement", + "start":26,"end":41,"loc":{"start":{"line":1,"column":26},"end":{"line":1,"column":41}}, + "body": [], + "directives": [ + { + "type": "Directive", + "start":27,"end":40,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":40}}, + "value": { + "type": "DirectiveLiteral", + "start":27,"end":39,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":39}}, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/497/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/497/options.json deleted file mode 100644 index b8f97ca4fe56..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/497/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'eval' in strict mode (1:48)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/497/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/497/output.json new file mode 100644 index 000000000000..d887db53f5e6 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/497/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start":0,"end":58,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":58}}, + "errors": [ + "SyntaxError: Binding 'eval' in strict mode (1:48)" + ], + "program": { + "type": "Program", + "start":0,"end":58,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":58}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":58,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":58}}, + "id": { + "type": "Identifier", + "start":9,"end":14,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":14},"identifierName":"hello"}, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":17,"end":58,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":58}}, + "body": [ + { + "type": "FunctionDeclaration", + "start":33,"end":56,"loc":{"start":{"line":1,"column":33},"end":{"line":1,"column":56}}, + "id": { + "type": "Identifier", + "start":42,"end":47,"loc":{"start":{"line":1,"column":42},"end":{"line":1,"column":47},"identifierName":"inner"}, + "name": "inner" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start":48,"end":52,"loc":{"start":{"line":1,"column":48},"end":{"line":1,"column":52},"identifierName":"eval"}, + "name": "eval" + } + ], + "body": { + "type": "BlockStatement", + "start":54,"end":56,"loc":{"start":{"line":1,"column":54},"end":{"line":1,"column":56}}, + "body": [], + "directives": [] + } + } + ], + "directives": [ + { + "type": "Directive", + "start":19,"end":32,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":32}}, + "value": { + "type": "DirectiveLiteral", + "start":19,"end":31,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":31}}, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/498/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/498/options.json deleted file mode 100644 index ab7000409bab..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/498/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'arguments' in strict mode (1:48)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/498/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/498/output.json new file mode 100644 index 000000000000..ded181413784 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/498/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start":0,"end":63,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":63}}, + "errors": [ + "SyntaxError: Binding 'arguments' in strict mode (1:48)" + ], + "program": { + "type": "Program", + "start":0,"end":63,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":63}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":63,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":63}}, + "id": { + "type": "Identifier", + "start":9,"end":14,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":14},"identifierName":"hello"}, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":17,"end":63,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":63}}, + "body": [ + { + "type": "FunctionDeclaration", + "start":33,"end":61,"loc":{"start":{"line":1,"column":33},"end":{"line":1,"column":61}}, + "id": { + "type": "Identifier", + "start":42,"end":47,"loc":{"start":{"line":1,"column":42},"end":{"line":1,"column":47},"identifierName":"inner"}, + "name": "inner" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start":48,"end":57,"loc":{"start":{"line":1,"column":48},"end":{"line":1,"column":57},"identifierName":"arguments"}, + "name": "arguments" + } + ], + "body": { + "type": "BlockStatement", + "start":59,"end":61,"loc":{"start":{"line":1,"column":59},"end":{"line":1,"column":61}}, + "body": [], + "directives": [] + } + } + ], + "directives": [ + { + "type": "Directive", + "start":19,"end":32,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":32}}, + "value": { + "type": "DirectiveLiteral", + "start":19,"end":31,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":31}}, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/499/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/499/options.json deleted file mode 100644 index ae2bfab55c68..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/499/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Octal literal in strict mode (1:35)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/499/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/499/output.json new file mode 100644 index 000000000000..a7ce0eaeba38 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/499/output.json @@ -0,0 +1,61 @@ +{ + "type": "File", + "start":0,"end":40,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":40}}, + "errors": [ + "SyntaxError: Legacy octal literals are not allowed in strict mode (1:35)" + ], + "program": { + "type": "Program", + "start":0,"end":40,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":40}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":40,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":40}}, + "id": { + "type": "Identifier", + "start":9,"end":14,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":14},"identifierName":"hello"}, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":17,"end":40,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":40}}, + "body": [], + "directives": [ + { + "type": "Directive", + "start":19,"end":32,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":32}}, + "value": { + "type": "DirectiveLiteral", + "start":19,"end":31,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":31}}, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + }, + { + "type": "Directive", + "start":33,"end":38,"loc":{"start":{"line":1,"column":33},"end":{"line":1,"column":38}}, + "value": { + "type": "DirectiveLiteral", + "start":33,"end":37,"loc":{"start":{"line":1,"column":33},"end":{"line":1,"column":37}}, + "value": "\\1", + "extra": { + "raw": "\"\\1\"", + "rawValue": "\\1" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/5/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/5/output.json index b192978c9ffd..96df76bb0e55 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/5/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/5/output.json @@ -1,62 +1,18 @@ { "type": "File", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, "program": { "type": "Program", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, "expression": { "type": "RegExpLiteral", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, "extra": { "raw": "/[a-z]/g" }, diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/50/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/50/output.json index 666876f21a68..fd256c8b41a4 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/50/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/50/output.json @@ -1,62 +1,18 @@ { "type": "File", - "start": 0, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 6 - } - }, + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":6}}, "program": { "type": "Program", - "start": 0, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 6 - } - }, + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":6}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 8, - "end": 10, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 6 - } - }, + "start":8,"end":10,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":6}}, "expression": { "type": "NumericLiteral", - "start": 8, - "end": 10, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 6 - } - }, + "start":8,"end":10,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":6}}, "extra": { "rawValue": 42, "raw": "42" @@ -67,18 +23,7 @@ { "type": "CommentBlock", "value": "a\nb", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 3 - } - } + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":3}} } ] } @@ -89,18 +34,7 @@ { "type": "CommentBlock", "value": "a\nb", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 3 - } - } + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":3}} } ] } \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/500/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/500/options.json deleted file mode 100644 index 45ca229c1e8e..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/500/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Legacy octal literals are not allowed in strict mode (1:33)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/500/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/500/output.json new file mode 100644 index 000000000000..f4096149d8ed --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/500/output.json @@ -0,0 +1,62 @@ +{ + "type": "File", + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":39}}, + "errors": [ + "SyntaxError: Legacy octal literals are not allowed in strict mode (1:33)" + ], + "program": { + "type": "Program", + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":39}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":39}}, + "id": { + "type": "Identifier", + "start":9,"end":14,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":14},"identifierName":"hello"}, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":17,"end":39,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":39}}, + "body": [ + { + "type": "ExpressionStatement", + "start":33,"end":37,"loc":{"start":{"line":1,"column":33},"end":{"line":1,"column":37}}, + "expression": { + "type": "NumericLiteral", + "start":33,"end":36,"loc":{"start":{"line":1,"column":33},"end":{"line":1,"column":36}}, + "extra": { + "rawValue": 17, + "raw": "021" + }, + "value": 17 + } + } + ], + "directives": [ + { + "type": "Directive", + "start":19,"end":32,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":32}}, + "value": { + "type": "DirectiveLiteral", + "start":19,"end":31,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":31}}, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/501/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/501/options.json deleted file mode 100644 index 7e50b5f9165e..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/501/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Octal literal in strict mode (1:38)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/501/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/501/output.json new file mode 100644 index 000000000000..2c29a7df14b9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/501/output.json @@ -0,0 +1,88 @@ +{ + "type": "File", + "start":0,"end":50,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":50}}, + "errors": [ + "SyntaxError: Legacy octal literals are not allowed in strict mode (1:38)" + ], + "program": { + "type": "Program", + "start":0,"end":50,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":50}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":50,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":50}}, + "id": { + "type": "Identifier", + "start":9,"end":14,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":14},"identifierName":"hello"}, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":17,"end":50,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":50}}, + "body": [ + { + "type": "ExpressionStatement", + "start":33,"end":48,"loc":{"start":{"line":1,"column":33},"end":{"line":1,"column":48}}, + "expression": { + "type": "ObjectExpression", + "start":34,"end":46,"loc":{"start":{"line":1,"column":34},"end":{"line":1,"column":46}}, + "properties": [ + { + "type": "ObjectProperty", + "start":36,"end":44,"loc":{"start":{"line":1,"column":36},"end":{"line":1,"column":44}}, + "method": false, + "key": { + "type": "StringLiteral", + "start":36,"end":40,"loc":{"start":{"line":1,"column":36},"end":{"line":1,"column":40}}, + "extra": { + "rawValue": "\u0001", + "raw": "\"\\1\"" + }, + "value": "\u0001" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "NumericLiteral", + "start":42,"end":44,"loc":{"start":{"line":1,"column":42},"end":{"line":1,"column":44}}, + "extra": { + "rawValue": 42, + "raw": "42" + }, + "value": 42 + } + } + ], + "extra": { + "parenthesized": true, + "parenStart": 33 + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start":19,"end":32,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":32}}, + "value": { + "type": "DirectiveLiteral", + "start":19,"end":31,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":31}}, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/502/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/502/options.json deleted file mode 100644 index 8f6c8218f747..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/502/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Legacy octal literals are not allowed in strict mode (1:36)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/502/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/502/output.json new file mode 100644 index 000000000000..8caf22da60fa --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/502/output.json @@ -0,0 +1,88 @@ +{ + "type": "File", + "start":0,"end":49,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":49}}, + "errors": [ + "SyntaxError: Legacy octal literals are not allowed in strict mode (1:36)" + ], + "program": { + "type": "Program", + "start":0,"end":49,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":49}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":49,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":49}}, + "id": { + "type": "Identifier", + "start":9,"end":14,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":14},"identifierName":"hello"}, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":17,"end":49,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":49}}, + "body": [ + { + "type": "ExpressionStatement", + "start":33,"end":47,"loc":{"start":{"line":1,"column":33},"end":{"line":1,"column":47}}, + "expression": { + "type": "ObjectExpression", + "start":34,"end":45,"loc":{"start":{"line":1,"column":34},"end":{"line":1,"column":45}}, + "properties": [ + { + "type": "ObjectProperty", + "start":36,"end":43,"loc":{"start":{"line":1,"column":36},"end":{"line":1,"column":43}}, + "method": false, + "key": { + "type": "NumericLiteral", + "start":36,"end":39,"loc":{"start":{"line":1,"column":36},"end":{"line":1,"column":39}}, + "extra": { + "rawValue": 17, + "raw": "021" + }, + "value": 17 + }, + "computed": false, + "shorthand": false, + "value": { + "type": "NumericLiteral", + "start":41,"end":43,"loc":{"start":{"line":1,"column":41},"end":{"line":1,"column":43}}, + "extra": { + "rawValue": 42, + "raw": "42" + }, + "value": 42 + } + } + ], + "extra": { + "parenthesized": true, + "parenStart": 33 + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start":19,"end":32,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":32}}, + "value": { + "type": "DirectiveLiteral", + "start":19,"end":31,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":31}}, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/503/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/503/options.json deleted file mode 100644 index 8389b2c726ca..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/503/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Octal literal in strict mode (1:69)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/503/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/503/output.json new file mode 100644 index 000000000000..d559db4b5683 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/503/output.json @@ -0,0 +1,81 @@ +{ + "type": "File", + "start":0,"end":76,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":76}}, + "errors": [ + "SyntaxError: Legacy octal literals are not allowed in strict mode (1:69)" + ], + "program": { + "type": "Program", + "start":0,"end":76,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":76}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":76,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":76}}, + "id": { + "type": "Identifier", + "start":9,"end":14,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":14},"identifierName":"hello"}, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":17,"end":76,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":76}}, + "body": [ + { + "type": "FunctionDeclaration", + "start":33,"end":74,"loc":{"start":{"line":1,"column":33},"end":{"line":1,"column":74}}, + "id": { + "type": "Identifier", + "start":42,"end":47,"loc":{"start":{"line":1,"column":42},"end":{"line":1,"column":47},"identifierName":"inner"}, + "name": "inner" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":50,"end":74,"loc":{"start":{"line":1,"column":50},"end":{"line":1,"column":74}}, + "body": [], + "directives": [ + { + "type": "Directive", + "start":52,"end":72,"loc":{"start":{"line":1,"column":52},"end":{"line":1,"column":72}}, + "value": { + "type": "DirectiveLiteral", + "start":52,"end":71,"loc":{"start":{"line":1,"column":52},"end":{"line":1,"column":71}}, + "value": "octal directive\\1", + "extra": { + "raw": "\"octal directive\\1\"", + "rawValue": "octal directive\\1" + } + } + } + ] + } + } + ], + "directives": [ + { + "type": "Directive", + "start":19,"end":32,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":32}}, + "value": { + "type": "DirectiveLiteral", + "start":19,"end":31,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":31}}, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/504/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/504/options.json deleted file mode 100644 index 0641de45e29a..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/504/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected reserved word 'implements' (1:37)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/504/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/504/output.json new file mode 100644 index 000000000000..a3eee1ca1117 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/504/output.json @@ -0,0 +1,66 @@ +{ + "type": "File", + "start":0,"end":50,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":50}}, + "errors": [ + "SyntaxError: Unexpected reserved word 'implements' (1:37)" + ], + "program": { + "type": "Program", + "start":0,"end":50,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":50}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":50,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":50}}, + "id": { + "type": "Identifier", + "start":9,"end":14,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":14},"identifierName":"hello"}, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":17,"end":50,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":50}}, + "body": [ + { + "type": "VariableDeclaration", + "start":33,"end":48,"loc":{"start":{"line":1,"column":33},"end":{"line":1,"column":48}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":37,"end":47,"loc":{"start":{"line":1,"column":37},"end":{"line":1,"column":47}}, + "id": { + "type": "Identifier", + "start":37,"end":47,"loc":{"start":{"line":1,"column":37},"end":{"line":1,"column":47},"identifierName":"implements"}, + "name": "implements" + }, + "init": null + } + ], + "kind": "var" + } + ], + "directives": [ + { + "type": "Directive", + "start":19,"end":32,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":32}}, + "value": { + "type": "DirectiveLiteral", + "start":19,"end":31,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":31}}, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/505/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/505/options.json deleted file mode 100644 index 859238d0423f..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/505/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected reserved word 'interface' (1:37)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/505/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/505/output.json new file mode 100644 index 000000000000..cffcb241d435 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/505/output.json @@ -0,0 +1,66 @@ +{ + "type": "File", + "start":0,"end":49,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":49}}, + "errors": [ + "SyntaxError: Unexpected reserved word 'interface' (1:37)" + ], + "program": { + "type": "Program", + "start":0,"end":49,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":49}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":49,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":49}}, + "id": { + "type": "Identifier", + "start":9,"end":14,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":14},"identifierName":"hello"}, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":17,"end":49,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":49}}, + "body": [ + { + "type": "VariableDeclaration", + "start":33,"end":47,"loc":{"start":{"line":1,"column":33},"end":{"line":1,"column":47}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":37,"end":46,"loc":{"start":{"line":1,"column":37},"end":{"line":1,"column":46}}, + "id": { + "type": "Identifier", + "start":37,"end":46,"loc":{"start":{"line":1,"column":37},"end":{"line":1,"column":46},"identifierName":"interface"}, + "name": "interface" + }, + "init": null + } + ], + "kind": "var" + } + ], + "directives": [ + { + "type": "Directive", + "start":19,"end":32,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":32}}, + "value": { + "type": "DirectiveLiteral", + "start":19,"end":31,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":31}}, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/506/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/506/options.json deleted file mode 100644 index 344c7075f4bf..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/506/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected reserved word 'package' (1:37)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/506/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/506/output.json new file mode 100644 index 000000000000..3d7bd0ac8ee4 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/506/output.json @@ -0,0 +1,66 @@ +{ + "type": "File", + "start":0,"end":47,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":47}}, + "errors": [ + "SyntaxError: Unexpected reserved word 'package' (1:37)" + ], + "program": { + "type": "Program", + "start":0,"end":47,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":47}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":47,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":47}}, + "id": { + "type": "Identifier", + "start":9,"end":14,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":14},"identifierName":"hello"}, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":17,"end":47,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":47}}, + "body": [ + { + "type": "VariableDeclaration", + "start":33,"end":45,"loc":{"start":{"line":1,"column":33},"end":{"line":1,"column":45}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":37,"end":44,"loc":{"start":{"line":1,"column":37},"end":{"line":1,"column":44}}, + "id": { + "type": "Identifier", + "start":37,"end":44,"loc":{"start":{"line":1,"column":37},"end":{"line":1,"column":44},"identifierName":"package"}, + "name": "package" + }, + "init": null + } + ], + "kind": "var" + } + ], + "directives": [ + { + "type": "Directive", + "start":19,"end":32,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":32}}, + "value": { + "type": "DirectiveLiteral", + "start":19,"end":31,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":31}}, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/507/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/507/options.json deleted file mode 100644 index 9fb9deaf9cba..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/507/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected reserved word 'private' (1:37)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/507/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/507/output.json new file mode 100644 index 000000000000..4c1f2d2844f0 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/507/output.json @@ -0,0 +1,66 @@ +{ + "type": "File", + "start":0,"end":47,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":47}}, + "errors": [ + "SyntaxError: Unexpected reserved word 'private' (1:37)" + ], + "program": { + "type": "Program", + "start":0,"end":47,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":47}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":47,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":47}}, + "id": { + "type": "Identifier", + "start":9,"end":14,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":14},"identifierName":"hello"}, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":17,"end":47,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":47}}, + "body": [ + { + "type": "VariableDeclaration", + "start":33,"end":45,"loc":{"start":{"line":1,"column":33},"end":{"line":1,"column":45}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":37,"end":44,"loc":{"start":{"line":1,"column":37},"end":{"line":1,"column":44}}, + "id": { + "type": "Identifier", + "start":37,"end":44,"loc":{"start":{"line":1,"column":37},"end":{"line":1,"column":44},"identifierName":"private"}, + "name": "private" + }, + "init": null + } + ], + "kind": "var" + } + ], + "directives": [ + { + "type": "Directive", + "start":19,"end":32,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":32}}, + "value": { + "type": "DirectiveLiteral", + "start":19,"end":31,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":31}}, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/508/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/508/options.json deleted file mode 100644 index 292fb56f1cf3..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/508/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected reserved word 'protected' (1:37)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/508/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/508/output.json new file mode 100644 index 000000000000..dcf994402ae1 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/508/output.json @@ -0,0 +1,66 @@ +{ + "type": "File", + "start":0,"end":49,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":49}}, + "errors": [ + "SyntaxError: Unexpected reserved word 'protected' (1:37)" + ], + "program": { + "type": "Program", + "start":0,"end":49,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":49}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":49,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":49}}, + "id": { + "type": "Identifier", + "start":9,"end":14,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":14},"identifierName":"hello"}, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":17,"end":49,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":49}}, + "body": [ + { + "type": "VariableDeclaration", + "start":33,"end":47,"loc":{"start":{"line":1,"column":33},"end":{"line":1,"column":47}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":37,"end":46,"loc":{"start":{"line":1,"column":37},"end":{"line":1,"column":46}}, + "id": { + "type": "Identifier", + "start":37,"end":46,"loc":{"start":{"line":1,"column":37},"end":{"line":1,"column":46},"identifierName":"protected"}, + "name": "protected" + }, + "init": null + } + ], + "kind": "var" + } + ], + "directives": [ + { + "type": "Directive", + "start":19,"end":32,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":32}}, + "value": { + "type": "DirectiveLiteral", + "start":19,"end":31,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":31}}, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/509/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/509/options.json deleted file mode 100644 index d5f48446906a..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/509/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected reserved word 'public' (1:37)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/509/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/509/output.json new file mode 100644 index 000000000000..c7306ecdb68b --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/509/output.json @@ -0,0 +1,66 @@ +{ + "type": "File", + "start":0,"end":46,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":46}}, + "errors": [ + "SyntaxError: Unexpected reserved word 'public' (1:37)" + ], + "program": { + "type": "Program", + "start":0,"end":46,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":46}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":46,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":46}}, + "id": { + "type": "Identifier", + "start":9,"end":14,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":14},"identifierName":"hello"}, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":17,"end":46,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":46}}, + "body": [ + { + "type": "VariableDeclaration", + "start":33,"end":44,"loc":{"start":{"line":1,"column":33},"end":{"line":1,"column":44}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":37,"end":43,"loc":{"start":{"line":1,"column":37},"end":{"line":1,"column":43}}, + "id": { + "type": "Identifier", + "start":37,"end":43,"loc":{"start":{"line":1,"column":37},"end":{"line":1,"column":43},"identifierName":"public"}, + "name": "public" + }, + "init": null + } + ], + "kind": "var" + } + ], + "directives": [ + { + "type": "Directive", + "start":19,"end":32,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":32}}, + "value": { + "type": "DirectiveLiteral", + "start":19,"end":31,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":31}}, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/51/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/51/output.json index 60bb34d552c3..0bcd7848fe1d 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/51/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/51/output.json @@ -1,62 +1,18 @@ { "type": "File", - "start": 0, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 6 - } - }, + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":6}}, "program": { "type": "Program", - "start": 0, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 6 - } - }, + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":6}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 8, - "end": 10, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 6 - } - }, + "start":8,"end":10,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":6}}, "expression": { "type": "NumericLiteral", - "start": 8, - "end": 10, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 6 - } - }, + "start":8,"end":10,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":6}}, "extra": { "rawValue": 42, "raw": "42" @@ -67,18 +23,7 @@ { "type": "CommentBlock", "value": "a\rb", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 3 - } - } + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":3}} } ] } @@ -89,18 +34,7 @@ { "type": "CommentBlock", "value": "a\rb", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 3 - } - } + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":3}} } ] } \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/510/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/510/options.json deleted file mode 100644 index 0f41ff2e6f24..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/510/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected reserved word 'static' (1:37)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/510/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/510/output.json new file mode 100644 index 000000000000..41fd57994528 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/510/output.json @@ -0,0 +1,66 @@ +{ + "type": "File", + "start":0,"end":46,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":46}}, + "errors": [ + "SyntaxError: Unexpected reserved word 'static' (1:37)" + ], + "program": { + "type": "Program", + "start":0,"end":46,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":46}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":46,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":46}}, + "id": { + "type": "Identifier", + "start":9,"end":14,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":14},"identifierName":"hello"}, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":17,"end":46,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":46}}, + "body": [ + { + "type": "VariableDeclaration", + "start":33,"end":44,"loc":{"start":{"line":1,"column":33},"end":{"line":1,"column":44}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":37,"end":43,"loc":{"start":{"line":1,"column":37},"end":{"line":1,"column":43}}, + "id": { + "type": "Identifier", + "start":37,"end":43,"loc":{"start":{"line":1,"column":37},"end":{"line":1,"column":43},"identifierName":"static"}, + "name": "static" + }, + "init": null + } + ], + "kind": "var" + } + ], + "directives": [ + { + "type": "Directive", + "start":19,"end":32,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":32}}, + "value": { + "type": "DirectiveLiteral", + "start":19,"end":31,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":31}}, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/511/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/511/options.json deleted file mode 100644 index fff472344fd7..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/511/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'static' in strict mode (1:15)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/511/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/511/output.json new file mode 100644 index 000000000000..160544579047 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/511/output.json @@ -0,0 +1,54 @@ +{ + "type": "File", + "start":0,"end":40,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":40}}, + "errors": [ + "SyntaxError: Binding 'static' in strict mode (1:15)" + ], + "program": { + "type": "Program", + "start":0,"end":40,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":40}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":40,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":40}}, + "id": { + "type": "Identifier", + "start":9,"end":14,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":14},"identifierName":"hello"}, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start":15,"end":21,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":21},"identifierName":"static"}, + "name": "static" + } + ], + "body": { + "type": "BlockStatement", + "start":23,"end":40,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":40}}, + "body": [], + "directives": [ + { + "type": "Directive", + "start":25,"end":38,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":38}}, + "value": { + "type": "DirectiveLiteral", + "start":25,"end":37,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":37}}, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/512/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/512/options.json deleted file mode 100644 index d4d0a96bfb64..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/512/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'static' in strict mode (1:9)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/512/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/512/output.json new file mode 100644 index 000000000000..b184d5881724 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/512/output.json @@ -0,0 +1,48 @@ +{ + "type": "File", + "start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":35}}, + "errors": [ + "SyntaxError: Binding 'static' in strict mode (1:9)" + ], + "program": { + "type": "Program", + "start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":35}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":35}}, + "id": { + "type": "Identifier", + "start":9,"end":15,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":15},"identifierName":"static"}, + "name": "static" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":18,"end":35,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":35}}, + "body": [], + "directives": [ + { + "type": "Directive", + "start":20,"end":33,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":33}}, + "value": { + "type": "DirectiveLiteral", + "start":20,"end":32,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":32}}, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/513/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/513/options.json deleted file mode 100644 index 91bc36d3f360..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/513/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected reserved word 'static' (1:23)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/513/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/513/output.json new file mode 100644 index 000000000000..07cfc9324623 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/513/output.json @@ -0,0 +1,48 @@ +{ + "type": "File", + "start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":35}}, + "errors": [ + "SyntaxError: Unexpected reserved word 'static' (1:23)" + ], + "program": { + "type": "Program", + "start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":35}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":14,"end":35,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":35}}, + "id": { + "type": "Identifier", + "start":23,"end":29,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":29},"identifierName":"static"}, + "name": "static" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":32,"end":35,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":35}}, + "body": [], + "directives": [] + } + } + ], + "directives": [ + { + "type": "Directive", + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "value": { + "type": "DirectiveLiteral", + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/514/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/514/options.json deleted file mode 100644 index 8b20b9a7df36..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/514/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Argument name clash (1:14)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/514/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/514/output.json new file mode 100644 index 000000000000..3b77c9170b54 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/514/output.json @@ -0,0 +1,59 @@ +{ + "type": "File", + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, + "errors": [ + "SyntaxError: Argument name clash (1:14)" + ], + "program": { + "type": "Program", + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, + "id": { + "type": "Identifier", + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"a"}, + "name": "a" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start":11,"end":12,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":12},"identifierName":"t"}, + "name": "t" + }, + { + "type": "Identifier", + "start":14,"end":15,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":15},"identifierName":"t"}, + "name": "t" + } + ], + "body": { + "type": "BlockStatement", + "start":17,"end":34,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":34}}, + "body": [], + "directives": [ + { + "type": "Directive", + "start":19,"end":32,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":32}}, + "value": { + "type": "DirectiveLiteral", + "start":19,"end":31,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":31}}, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/515/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/515/options.json deleted file mode 100644 index e227bd1a6b74..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/515/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'eval' in strict mode (1:11)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/515/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/515/output.json new file mode 100644 index 000000000000..0581517d990a --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/515/output.json @@ -0,0 +1,54 @@ +{ + "type": "File", + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, + "errors": [ + "SyntaxError: Binding 'eval' in strict mode (1:11)" + ], + "program": { + "type": "Program", + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, + "id": { + "type": "Identifier", + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"a"}, + "name": "a" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start":11,"end":15,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":15},"identifierName":"eval"}, + "name": "eval" + } + ], + "body": { + "type": "BlockStatement", + "start":17,"end":34,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":34}}, + "body": [], + "directives": [ + { + "type": "Directive", + "start":19,"end":32,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":32}}, + "value": { + "type": "DirectiveLiteral", + "start":19,"end":31,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":31}}, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/516/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/516/options.json deleted file mode 100644 index 8e1f9af4ec47..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/516/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'package' in strict mode (1:11)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/516/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/516/output.json new file mode 100644 index 000000000000..aafa09421ccc --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/516/output.json @@ -0,0 +1,54 @@ +{ + "type": "File", + "start":0,"end":37,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":37}}, + "errors": [ + "SyntaxError: Binding 'package' in strict mode (1:11)" + ], + "program": { + "type": "Program", + "start":0,"end":37,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":37}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":37,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":37}}, + "id": { + "type": "Identifier", + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"a"}, + "name": "a" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start":11,"end":18,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":18},"identifierName":"package"}, + "name": "package" + } + ], + "body": { + "type": "BlockStatement", + "start":20,"end":37,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":37}}, + "body": [], + "directives": [ + { + "type": "Directive", + "start":22,"end":35,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":35}}, + "value": { + "type": "DirectiveLiteral", + "start":22,"end":34,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":34}}, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/517/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/517/options.json deleted file mode 100644 index 9d2a58081596..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/517/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Argument name clash (1:43)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/517/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/517/output.json new file mode 100644 index 000000000000..df3094e728a8 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/517/output.json @@ -0,0 +1,82 @@ +{ + "type": "File", + "start":0,"end":52,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":52}}, + "errors": [ + "SyntaxError: Argument name clash (1:43)" + ], + "program": { + "type": "Program", + "start":0,"end":52,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":52}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":52,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":52}}, + "id": { + "type": "Identifier", + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"a"}, + "name": "a" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":13,"end":52,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":52}}, + "body": [ + { + "type": "FunctionDeclaration", + "start":29,"end":49,"loc":{"start":{"line":1,"column":29},"end":{"line":1,"column":49}}, + "id": { + "type": "Identifier", + "start":38,"end":39,"loc":{"start":{"line":1,"column":38},"end":{"line":1,"column":39},"identifierName":"b"}, + "name": "b" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start":40,"end":41,"loc":{"start":{"line":1,"column":40},"end":{"line":1,"column":41},"identifierName":"t"}, + "name": "t" + }, + { + "type": "Identifier", + "start":43,"end":44,"loc":{"start":{"line":1,"column":43},"end":{"line":1,"column":44},"identifierName":"t"}, + "name": "t" + } + ], + "body": { + "type": "BlockStatement", + "start":46,"end":49,"loc":{"start":{"line":1,"column":46},"end":{"line":1,"column":49}}, + "body": [], + "directives": [] + } + }, + { + "type": "EmptyStatement", + "start":49,"end":50,"loc":{"start":{"line":1,"column":49},"end":{"line":1,"column":50}} + } + ], + "directives": [ + { + "type": "Directive", + "start":15,"end":28,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":28}}, + "value": { + "type": "DirectiveLiteral", + "start":15,"end":27,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":27}}, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/518/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/518/options.json deleted file mode 100644 index 61c3bbb5abe0..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/518/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Argument name clash (1:15)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/518/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/518/output.json new file mode 100644 index 000000000000..bcaf874206cd --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/518/output.json @@ -0,0 +1,67 @@ +{ + "type": "File", + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, + "errors": [ + "SyntaxError: Argument name clash (1:15)" + ], + "program": { + "type": "Program", + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, + "expression": { + "type": "FunctionExpression", + "start":1,"end":35,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":35}}, + "id": { + "type": "Identifier", + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11},"identifierName":"a"}, + "name": "a" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start":12,"end":13,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":13},"identifierName":"t"}, + "name": "t" + }, + { + "type": "Identifier", + "start":15,"end":16,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":16},"identifierName":"t"}, + "name": "t" + } + ], + "body": { + "type": "BlockStatement", + "start":18,"end":35,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":35}}, + "body": [], + "directives": [ + { + "type": "Directive", + "start":20,"end":33,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":33}}, + "value": { + "type": "DirectiveLiteral", + "start":20,"end":32,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":32}}, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + }, + "extra": { + "parenthesized": true, + "parenStart": 0 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/519/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/519/options.json deleted file mode 100644 index ae469fbd59da..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/519/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Argument name clash (1:44)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/519/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/519/output.json new file mode 100644 index 000000000000..65f5a908f019 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/519/output.json @@ -0,0 +1,86 @@ +{ + "type": "File", + "start":0,"end":54,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":54}}, + "errors": [ + "SyntaxError: Argument name clash (1:44)" + ], + "program": { + "type": "Program", + "start":0,"end":54,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":54}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":54,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":54}}, + "id": { + "type": "Identifier", + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"a"}, + "name": "a" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":13,"end":54,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":54}}, + "body": [ + { + "type": "ExpressionStatement", + "start":29,"end":52,"loc":{"start":{"line":1,"column":29},"end":{"line":1,"column":52}}, + "expression": { + "type": "FunctionExpression", + "start":30,"end":50,"loc":{"start":{"line":1,"column":30},"end":{"line":1,"column":50}}, + "id": { + "type": "Identifier", + "start":39,"end":40,"loc":{"start":{"line":1,"column":39},"end":{"line":1,"column":40},"identifierName":"b"}, + "name": "b" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start":41,"end":42,"loc":{"start":{"line":1,"column":41},"end":{"line":1,"column":42},"identifierName":"t"}, + "name": "t" + }, + { + "type": "Identifier", + "start":44,"end":45,"loc":{"start":{"line":1,"column":44},"end":{"line":1,"column":45},"identifierName":"t"}, + "name": "t" + } + ], + "body": { + "type": "BlockStatement", + "start":47,"end":50,"loc":{"start":{"line":1,"column":47},"end":{"line":1,"column":50}}, + "body": [], + "directives": [] + }, + "extra": { + "parenthesized": true, + "parenStart": 29 + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start":15,"end":28,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":28}}, + "value": { + "type": "DirectiveLiteral", + "start":15,"end":27,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":27}}, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/52/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/52/output.json index 666876f21a68..fd256c8b41a4 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/52/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/52/output.json @@ -1,62 +1,18 @@ { "type": "File", - "start": 0, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 6 - } - }, + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":6}}, "program": { "type": "Program", - "start": 0, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 6 - } - }, + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":6}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 8, - "end": 10, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 6 - } - }, + "start":8,"end":10,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":6}}, "expression": { "type": "NumericLiteral", - "start": 8, - "end": 10, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 6 - } - }, + "start":8,"end":10,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":6}}, "extra": { "rawValue": 42, "raw": "42" @@ -67,18 +23,7 @@ { "type": "CommentBlock", "value": "a\nb", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 3 - } - } + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":3}} } ] } @@ -89,18 +34,7 @@ { "type": "CommentBlock", "value": "a\nb", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 3 - } - } + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":3}} } ] } \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/520/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/520/options.json deleted file mode 100644 index 3c24c608c88a..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/520/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'eval' in strict mode (1:12)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/520/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/520/output.json new file mode 100644 index 000000000000..a1ab8b4653ea --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/520/output.json @@ -0,0 +1,62 @@ +{ + "type": "File", + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, + "errors": [ + "SyntaxError: Binding 'eval' in strict mode (1:12)" + ], + "program": { + "type": "Program", + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, + "expression": { + "type": "FunctionExpression", + "start":1,"end":35,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":35}}, + "id": { + "type": "Identifier", + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11},"identifierName":"a"}, + "name": "a" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start":12,"end":16,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":16},"identifierName":"eval"}, + "name": "eval" + } + ], + "body": { + "type": "BlockStatement", + "start":18,"end":35,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":35}}, + "body": [], + "directives": [ + { + "type": "Directive", + "start":20,"end":33,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":33}}, + "value": { + "type": "DirectiveLiteral", + "start":20,"end":32,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":32}}, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + }, + "extra": { + "parenthesized": true, + "parenStart": 0 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/521/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/521/options.json deleted file mode 100644 index 96d524816cc9..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/521/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'package' in strict mode (1:12)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/521/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/521/output.json new file mode 100644 index 000000000000..7caed97929d9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/521/output.json @@ -0,0 +1,62 @@ +{ + "type": "File", + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":39}}, + "errors": [ + "SyntaxError: Binding 'package' in strict mode (1:12)" + ], + "program": { + "type": "Program", + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":39}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":39}}, + "expression": { + "type": "FunctionExpression", + "start":1,"end":38,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":38}}, + "id": { + "type": "Identifier", + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11},"identifierName":"a"}, + "name": "a" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start":12,"end":19,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":19},"identifierName":"package"}, + "name": "package" + } + ], + "body": { + "type": "BlockStatement", + "start":21,"end":38,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":38}}, + "body": [], + "directives": [ + { + "type": "Directive", + "start":23,"end":36,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":36}}, + "value": { + "type": "DirectiveLiteral", + "start":23,"end":35,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":35}}, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + }, + "extra": { + "parenthesized": true, + "parenStart": 0 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/522/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/522/options.json deleted file mode 100644 index 0b443b9bacfa..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/522/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Legacy octal literals are not allowed in strict mode (1:65)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/522/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/522/output.json new file mode 100644 index 000000000000..a53f5cb5d29e --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/522/output.json @@ -0,0 +1,106 @@ +{ + "type": "File", + "start":0,"end":69,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":69}}, + "errors": [ + "SyntaxError: Legacy octal literals are not allowed in strict mode (1:65)" + ], + "program": { + "type": "Program", + "start":0,"end":69,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":69}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":13,"end":42,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":42}}, + "id": { + "type": "Identifier", + "start":22,"end":25,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":25},"identifierName":"foo"}, + "name": "foo" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":27,"end":42,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":42}}, + "body": [], + "directives": [ + { + "type": "Directive", + "start":28,"end":41,"loc":{"start":{"line":1,"column":28},"end":{"line":1,"column":41}}, + "value": { + "type": "DirectiveLiteral", + "start":28,"end":40,"loc":{"start":{"line":1,"column":28},"end":{"line":1,"column":40}}, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } + }, + { + "type": "FunctionDeclaration", + "start":42,"end":69,"loc":{"start":{"line":1,"column":42},"end":{"line":1,"column":69}}, + "id": { + "type": "Identifier", + "start":51,"end":54,"loc":{"start":{"line":1,"column":51},"end":{"line":1,"column":54},"identifierName":"bar"}, + "name": "bar" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":56,"end":69,"loc":{"start":{"line":1,"column":56},"end":{"line":1,"column":69}}, + "body": [ + { + "type": "VariableDeclaration", + "start":57,"end":68,"loc":{"start":{"line":1,"column":57},"end":{"line":1,"column":68}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":61,"end":68,"loc":{"start":{"line":1,"column":61},"end":{"line":1,"column":68}}, + "id": { + "type": "Identifier", + "start":61,"end":62,"loc":{"start":{"line":1,"column":61},"end":{"line":1,"column":62},"identifierName":"v"}, + "name": "v" + }, + "init": { + "type": "NumericLiteral", + "start":65,"end":68,"loc":{"start":{"line":1,"column":65},"end":{"line":1,"column":68}}, + "extra": { + "rawValue": 13, + "raw": "015" + }, + "value": 13 + } + } + ], + "kind": "var" + } + ], + "directives": [] + } + } + ], + "directives": [ + { + "type": "Directive", + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "value": { + "type": "DirectiveLiteral", + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/523/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/523/options.json deleted file mode 100644 index 60a9d5934bd2..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/523/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected keyword 'this' (1:4)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/523/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/523/output.json new file mode 100644 index 000000000000..98b811bf5fd6 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/523/output.json @@ -0,0 +1,41 @@ +{ + "type": "File", + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, + "errors": [ + "SyntaxError: Unexpected keyword 'this' (1:4)" + ], + "program": { + "type": "Program", + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":4,"end":13,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":13}}, + "id": { + "type": "Identifier", + "start":4,"end":8,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":8},"identifierName":"this"}, + "name": "this" + }, + "init": { + "type": "NumericLiteral", + "start":11,"end":13,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":13}}, + "extra": { + "rawValue": 10, + "raw": "10" + }, + "value": 10 + } + } + ], + "kind": "var" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/524/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/524/options.json deleted file mode 100644 index d07b41872ba6..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/524/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Illegal newline after throw (1:5)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/524/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/524/output.json new file mode 100644 index 000000000000..4323a83f4c23 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/524/output.json @@ -0,0 +1,29 @@ +{ + "type": "File", + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":3}}, + "errors": [ + "SyntaxError: Illegal newline after throw (1:5)" + ], + "program": { + "type": "Program", + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":3}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ThrowStatement", + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":3}}, + "argument": { + "type": "NumericLiteral", + "start":6,"end":8,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":2}}, + "extra": { + "rawValue": 10, + "raw": "10" + }, + "value": 10 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/525/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/525/output.json index d1a07b1d64a3..b68ff2e27c8f 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/525/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/525/output.json @@ -1,78 +1,22 @@ { "type": "File", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "program": { "type": "Program", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5}}, "id": { "type": "Identifier", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "x" - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"x"}, "name": "x" }, "init": null diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/526/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/526/output.json index 75ffb7751c69..1d8ef585d5da 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/526/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/526/output.json @@ -1,111 +1,32 @@ { "type": "File", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "program": { "type": "Program", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5}}, "id": { "type": "Identifier", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "x" - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"x"}, "name": "x" }, "init": null }, { "type": "VariableDeclarator", - "start": 7, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8}}, "id": { "type": "Identifier", - "start": 7, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - }, - "identifierName": "y" - }, + "start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8},"identifierName":"y"}, "name": "y" }, "init": null diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/527/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/527/output.json index 7316afbc421b..baaa39d495cf 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/527/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/527/output.json @@ -1,94 +1,27 @@ { "type": "File", - "start": 0, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, "program": { "type": "Program", - "start": 0, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":4,"end":10,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":10}}, "id": { "type": "Identifier", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "x" - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"x"}, "name": "x" }, "init": { "type": "NumericLiteral", - "start": 8, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":8,"end":10,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":10}}, "extra": { "rawValue": 42, "raw": "42" diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/528/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/528/output.json index d552a2e28574..3b7901439092 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/528/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/528/output.json @@ -1,94 +1,27 @@ { "type": "File", - "start": 0, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, "program": { "type": "Program", - "start": 0, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":4,"end":13,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":13}}, "id": { "type": "Identifier", - "start": 4, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 8 - }, - "identifierName": "eval" - }, + "start":4,"end":8,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":8},"identifierName":"eval"}, "name": "eval" }, "init": { "type": "NumericLiteral", - "start": 11, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":11,"end":13,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":13}}, "extra": { "rawValue": 42, "raw": "42" @@ -98,49 +31,15 @@ }, { "type": "VariableDeclarator", - "start": 15, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":15,"end":29,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":29}}, "id": { "type": "Identifier", - "start": 15, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 24 - }, - "identifierName": "arguments" - }, + "start":15,"end":24,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":24},"identifierName":"arguments"}, "name": "arguments" }, "init": { "type": "NumericLiteral", - "start": 27, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":27,"end":29,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":29}}, "extra": { "rawValue": 42, "raw": "42" diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/529/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/529/output.json index 69ce880368fd..75cbded09480 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/529/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/529/output.json @@ -1,94 +1,27 @@ { "type": "File", - "start": 0, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, "program": { "type": "Program", - "start": 0, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":4,"end":10,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":10}}, "id": { "type": "Identifier", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "x" - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"x"}, "name": "x" }, "init": { "type": "NumericLiteral", - "start": 8, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":8,"end":10,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":10}}, "extra": { "rawValue": 14, "raw": "14" @@ -98,49 +31,15 @@ }, { "type": "VariableDeclarator", - "start": 12, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":12,"end":17,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":17}}, "id": { "type": "Identifier", - "start": 12, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - }, - "identifierName": "y" - }, + "start":12,"end":13,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":13},"identifierName":"y"}, "name": "y" }, "init": { "type": "NumericLiteral", - "start": 16, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":16,"end":17,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":17}}, "extra": { "rawValue": 3, "raw": "3" @@ -150,49 +49,15 @@ }, { "type": "VariableDeclarator", - "start": 19, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":19,"end":27,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":27}}, "id": { "type": "Identifier", - "start": 19, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 20 - }, - "identifierName": "z" - }, + "start":19,"end":20,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":20},"identifierName":"z"}, "name": "z" }, "init": { "type": "NumericLiteral", - "start": 23, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":23,"end":27,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":27}}, "extra": { "rawValue": 1977, "raw": "1977" diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/53/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/53/output.json index f7a4ee21f42e..1e7689710f10 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/53/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/53/output.json @@ -1,62 +1,18 @@ { "type": "File", - "start": 0, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 6 - } - }, + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":6}}, "program": { "type": "Program", - "start": 0, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 6 - } - }, + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":6}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 8, - "end": 10, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 6 - } - }, + "start":8,"end":10,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":6}}, "expression": { "type": "NumericLiteral", - "start": 8, - "end": 10, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 6 - } - }, + "start":8,"end":10,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":6}}, "extra": { "rawValue": 42, "raw": "42" @@ -67,18 +23,7 @@ { "type": "CommentBlock", "value": "a\nc", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 3 - } - } + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":3}} } ] } @@ -89,18 +34,7 @@ { "type": "CommentBlock", "value": "a\nc", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 3 - } - } + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":3}} } ] } \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/530/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/530/output.json index 8cee92a6a4bd..333c5c39498b 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/530/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/530/output.json @@ -1,108 +1,30 @@ { "type": "File", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "program": { "type": "Program", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ForStatement", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "init": { "type": "VariableDeclaration", - "start": 4, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":4,"end":13,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":13}}, "declarations": [ { "type": "VariableDeclarator", - "start": 8, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":8,"end":13,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":13}}, "id": { "type": "Identifier", - "start": 8, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "x" - }, + "start":8,"end":9,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":9},"identifierName":"x"}, "name": "x" }, "init": { "type": "NumericLiteral", - "start": 12, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":12,"end":13,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":13}}, "extra": { "rawValue": 0, "raw": "0" @@ -117,18 +39,7 @@ "update": null, "body": { "type": "EmptyStatement", - "start": 16, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - } + "start":16,"end":17,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":17}} } } ], diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/531/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/531/output.json index 5f71cebfc7e6..90d05b8eaa65 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/531/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/531/output.json @@ -1,108 +1,30 @@ { "type": "File", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "program": { "type": "Program", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ForStatement", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "init": { "type": "VariableDeclaration", - "start": 4, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":4,"end":20,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":20}}, "declarations": [ { "type": "VariableDeclarator", - "start": 8, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":8,"end":13,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":13}}, "id": { "type": "Identifier", - "start": 8, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "x" - }, + "start":8,"end":9,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":9},"identifierName":"x"}, "name": "x" }, "init": { "type": "NumericLiteral", - "start": 12, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":12,"end":13,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":13}}, "extra": { "rawValue": 0, "raw": "0" @@ -112,49 +34,15 @@ }, { "type": "VariableDeclarator", - "start": 15, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":15,"end":20,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":20}}, "id": { "type": "Identifier", - "start": 15, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - }, - "identifierName": "y" - }, + "start":15,"end":16,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":16},"identifierName":"y"}, "name": "y" }, "init": { "type": "NumericLiteral", - "start": 19, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":19,"end":20,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":20}}, "extra": { "rawValue": 1, "raw": "1" @@ -169,18 +57,7 @@ "update": null, "body": { "type": "EmptyStatement", - "start": 23, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 24 - } - } + "start":23,"end":24,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":24}} } } ], diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/532/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/532/output.json index 3cfd26fb69e7..65791b99b872 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/532/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/532/output.json @@ -1,92 +1,25 @@ { "type": "File", - "start": 0, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, "program": { "type": "Program", - "start": 0, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ForInStatement", - "start": 0, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, "left": { "type": "VariableDeclaration", - "start": 5, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":5,"end":10,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":10}}, "declarations": [ { "type": "VariableDeclarator", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10}}, "id": { "type": "Identifier", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - }, - "identifierName": "x" - }, + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"x"}, "name": "x" }, "init": null @@ -96,82 +29,24 @@ }, "right": { "type": "Identifier", - "start": 14, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 18 - }, - "identifierName": "list" - }, + "start":14,"end":18,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":18},"identifierName":"list"}, "name": "list" }, "body": { "type": "ExpressionStatement", - "start": 20, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":20,"end":31,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":31}}, "expression": { "type": "CallExpression", - "start": 20, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":20,"end":30,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":30}}, "callee": { "type": "Identifier", - "start": 20, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 27 - }, - "identifierName": "process" - }, + "start":20,"end":27,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":27},"identifierName":"process"}, "name": "process" }, "arguments": [ { "type": "Identifier", - "start": 28, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 29 - }, - "identifierName": "x" - }, + "start":28,"end":29,"loc":{"start":{"line":1,"column":28},"end":{"line":1,"column":29},"identifierName":"x"}, "name": "x" } ] diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/533/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/533/output.json index db86a852e1e6..396a6c89cbf9 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/533/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/533/output.json @@ -1,94 +1,27 @@ { "type": "File", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, "program": { "type": "Program", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, "declarations": [ { "type": "VariableDeclarator", - "start": 6, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":6,"end":12,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":12}}, "id": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "x" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"x"}, "name": "x" }, "init": { "type": "NumericLiteral", - "start": 10, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":10,"end":12,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":12}}, "extra": { "rawValue": 42, "raw": "42" diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/534/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/534/output.json index 8c262ae27f29..2f9c843e403a 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/534/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/534/output.json @@ -1,94 +1,27 @@ { "type": "File", - "start": 0, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, "program": { "type": "Program", - "start": 0, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, "declarations": [ { "type": "VariableDeclarator", - "start": 6, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":6,"end":15,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":15}}, "id": { "type": "Identifier", - "start": 6, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 10 - }, - "identifierName": "eval" - }, + "start":6,"end":10,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":10},"identifierName":"eval"}, "name": "eval" }, "init": { "type": "NumericLiteral", - "start": 13, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":13,"end":15,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":15}}, "extra": { "rawValue": 42, "raw": "42" @@ -98,49 +31,15 @@ }, { "type": "VariableDeclarator", - "start": 17, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":17,"end":31,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":31}}, "id": { "type": "Identifier", - "start": 17, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 26 - }, - "identifierName": "arguments" - }, + "start":17,"end":26,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":26},"identifierName":"arguments"}, "name": "arguments" }, "init": { "type": "NumericLiteral", - "start": 29, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":29,"end":31,"loc":{"start":{"line":1,"column":29},"end":{"line":1,"column":31}}, "extra": { "rawValue": 42, "raw": "42" diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/535/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/535/output.json index 8239aac13da5..2b827120af68 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/535/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/535/output.json @@ -1,94 +1,27 @@ { "type": "File", - "start": 0, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, "program": { "type": "Program", - "start": 0, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, "declarations": [ { "type": "VariableDeclarator", - "start": 6, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":6,"end":12,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":12}}, "id": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "x" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"x"}, "name": "x" }, "init": { "type": "NumericLiteral", - "start": 10, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":10,"end":12,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":12}}, "extra": { "rawValue": 14, "raw": "14" @@ -98,49 +31,15 @@ }, { "type": "VariableDeclarator", - "start": 14, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":14,"end":19,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":19}}, "id": { "type": "Identifier", - "start": 14, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - }, - "identifierName": "y" - }, + "start":14,"end":15,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":15},"identifierName":"y"}, "name": "y" }, "init": { "type": "NumericLiteral", - "start": 18, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":18,"end":19,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":19}}, "extra": { "rawValue": 3, "raw": "3" @@ -150,49 +49,15 @@ }, { "type": "VariableDeclarator", - "start": 21, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":21,"end":29,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":29}}, "id": { "type": "Identifier", - "start": 21, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 22 - }, - "identifierName": "z" - }, + "start":21,"end":22,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":22},"identifierName":"z"}, "name": "z" }, "init": { "type": "NumericLiteral", - "start": 25, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":25,"end":29,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":29}}, "extra": { "rawValue": 1977, "raw": "1977" diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/537/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/537/output.json index 318e474d79f3..25ba7b001530 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/537/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/537/output.json @@ -1,108 +1,30 @@ { "type": "File", - "start": 0, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, "program": { "type": "Program", - "start": 0, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ForStatement", - "start": 0, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, "init": { "type": "VariableDeclaration", - "start": 4, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":4,"end":15,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":15}}, "declarations": [ { "type": "VariableDeclarator", - "start": 10, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":10,"end":15,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":15}}, "id": { "type": "Identifier", - "start": 10, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "x" - }, + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11},"identifierName":"x"}, "name": "x" }, "init": { "type": "NumericLiteral", - "start": 14, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":14,"end":15,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":15}}, "extra": { "rawValue": 0, "raw": "0" @@ -117,18 +39,7 @@ "update": null, "body": { "type": "EmptyStatement", - "start": 18, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - } - } + "start":18,"end":19,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":19}} } } ], diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/538/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/538/output.json index 0859973b9dec..b2a7aba814d9 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/538/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/538/output.json @@ -1,64 +1,20 @@ { "type": "File", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 1 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 1 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":1}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "EmptyStatement", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 1 - } - }, + "start":5,"end":6,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":1}}, "leadingComments": [ { "type": "CommentLine", "value": "", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - } + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}} } ] } @@ -69,18 +25,7 @@ { "type": "CommentLine", "value": "", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - } + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}} } ] } \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/539/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/539/output.json index a5c684bd18e6..09dfa5319597 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/539/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/539/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, "program": { "type": "Program", - "start": 0, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, "id": { "type": "Identifier", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - }, - "identifierName": "f" - }, + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"f"}, "name": "f" }, "generator": false, @@ -65,66 +20,21 @@ "params": [ { "type": "Identifier", - "start": 11, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "f" - }, + "start":11,"end":12,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":12},"identifierName":"f"}, "name": "f" } ], "body": { "type": "BlockStatement", - "start": 14, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":14,"end":31,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":31}}, "body": [], "directives": [ { "type": "Directive", - "start": 16, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":16,"end":29,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":29}}, "value": { "type": "DirectiveLiteral", - "start": 16, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":16,"end":28,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":28}}, "value": "use strict", "extra": { "raw": "'use strict'", diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/54/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/54/output.json index 2c263698dcaf..719c0b3bcd48 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/54/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/54/output.json @@ -1,62 +1,18 @@ { "type": "File", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 2 - } - }, + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":2}}, "program": { "type": "Program", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 2 - } - }, + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":2}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 16, - "end": 18, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 2 - } - }, + "start":16,"end":18,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":2}}, "expression": { "type": "NumericLiteral", - "start": 16, - "end": 18, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 2 - } - }, + "start":16,"end":18,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":2}}, "extra": { "rawValue": 42, "raw": "42" @@ -67,18 +23,7 @@ { "type": "CommentLine", "value": " line comment", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - } + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}} } ] } @@ -89,18 +34,7 @@ { "type": "CommentLine", "value": " line comment", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - } + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}} } ] } \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/540/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/540/output.json index 702cd2b59f56..6d43f8fc49f5 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/540/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/540/output.json @@ -1,94 +1,28 @@ { "type": "File", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, "program": { "type": "Program", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, "expression": { "type": "BinaryExpression", - "start": 1, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":1,"end":19,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":19}}, "left": { "type": "FunctionExpression", - "start": 1, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":1,"end":15,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":15}}, "id": null, "generator": false, "async": false, "params": [], "body": { "type": "BlockStatement", - "start": 13, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":13,"end":15,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":15}}, "body": [], "directives": [] } @@ -96,18 +30,7 @@ "operator": "/", "right": { "type": "NumericLiteral", - "start": 18, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":18,"end":19,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":19}}, "extra": { "rawValue": 1, "raw": "1" diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/541/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/541/output.json index 30281e1958c0..e3a3e3b9017d 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/541/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/541/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, "program": { "type": "Program", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "id": { "type": "Identifier", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - }, - "identifierName": "f" - }, + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"f"}, "name": "f" }, "generator": false, @@ -65,50 +20,17 @@ "params": [], "body": { "type": "BlockStatement", - "start": 13, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":13,"end":15,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":15}}, "body": [], "directives": [] } }, { "type": "ExpressionStatement", - "start": 16, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":16,"end":21,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":21}}, "expression": { "type": "RegExpLiteral", - "start": 16, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":16,"end":21,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":21}}, "extra": { "raw": "/ 1 /" }, diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/542/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/542/output.json index c6d8d429fa71..9cbc40e7c5f8 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/542/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/542/output.json @@ -1,90 +1,24 @@ { "type": "File", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 11 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":11}}, "program": { "type": "Program", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 11 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":11}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 11 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":11}}, "expression": { "type": "CallExpression", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 11 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":11}}, "callee": { "type": "MemberExpression", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 6 - } - }, + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":6}}, "object": { "type": "StringLiteral", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "extra": { "rawValue": "foo", "raw": "\"foo\"" @@ -93,19 +27,7 @@ }, "property": { "type": "Identifier", - "start": 7, - "end": 12, - "loc": { - "start": { - "line": 2, - "column": 1 - }, - "end": { - "line": 2, - "column": 6 - }, - "identifierName": "split" - }, + "start":7,"end":12,"loc":{"start":{"line":2,"column":1},"end":{"line":2,"column":6},"identifierName":"split"}, "name": "split" }, "computed": false @@ -113,18 +35,7 @@ "arguments": [ { "type": "StringLiteral", - "start": 13, - "end": 16, - "loc": { - "start": { - "line": 2, - "column": 7 - }, - "end": { - "line": 2, - "column": 10 - } - }, + "start":13,"end":16,"loc":{"start":{"line":2,"column":7},"end":{"line":2,"column":10}}, "extra": { "rawValue": " ", "raw": "\" \"" diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/543/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/543/output.json index befe2fa25a55..0a2344038956 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/543/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/543/output.json @@ -1,142 +1,42 @@ { "type": "File", - "start": 0, - "end": 64, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 6, - "column": 5 - } - }, + "start":0,"end":64,"loc":{"start":{"line":1,"column":0},"end":{"line":6,"column":5}}, "program": { "type": "Program", - "start": 0, - "end": 64, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 6, - "column": 5 - } - }, + "start":0,"end":64,"loc":{"start":{"line":1,"column":0},"end":{"line":6,"column":5}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 57, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 2 - } - }, + "start":0,"end":57,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":2}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 56, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":4,"end":56,"loc":{"start":{"line":1,"column":4},"end":{"line":4,"column":1}}, "id": { "type": "Identifier", - "start": 4, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "fn" - }, + "start":4,"end":6,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":6},"identifierName":"fn"}, "name": "fn" }, "init": { "type": "FunctionExpression", - "start": 9, - "end": 56, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":9,"end":56,"loc":{"start":{"line":1,"column":9},"end":{"line":4,"column":1}}, "id": null, "generator": false, "async": false, "params": [], "body": { "type": "BlockStatement", - "start": 21, - "end": 56, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":21,"end":56,"loc":{"start":{"line":1,"column":21},"end":{"line":4,"column":1}}, "body": [], "directives": [ { "type": "Directive", - "start": 25, - "end": 38, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 15 - } - }, + "start":25,"end":38,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":15}}, "value": { "type": "DirectiveLiteral", - "start": 25, - "end": 37, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 14 - } - }, + "start":25,"end":37,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":14}}, "value": "use strict", "extra": { "raw": "\"use strict\"", @@ -146,32 +46,10 @@ }, { "type": "Directive", - "start": 41, - "end": 54, - "loc": { - "start": { - "line": 3, - "column": 2 - }, - "end": { - "line": 3, - "column": 15 - } - }, + "start":41,"end":54,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":15}}, "value": { "type": "DirectiveLiteral", - "start": 41, - "end": 53, - "loc": { - "start": { - "line": 3, - "column": 2 - }, - "end": { - "line": 3, - "column": 14 - } - }, + "start":41,"end":53,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":14}}, "value": "use strict", "extra": { "raw": "\"use strict\"", @@ -188,32 +66,10 @@ }, { "type": "ExpressionStatement", - "start": 59, - "end": 64, - "loc": { - "start": { - "line": 6, - "column": 0 - }, - "end": { - "line": 6, - "column": 5 - } - }, + "start":59,"end":64,"loc":{"start":{"line":6,"column":0},"end":{"line":6,"column":5}}, "expression": { "type": "NumericLiteral", - "start": 59, - "end": 63, - "loc": { - "start": { - "line": 6, - "column": 0 - }, - "end": { - "line": 6, - "column": 4 - } - }, + "start":59,"end":63,"loc":{"start":{"line":6,"column":0},"end":{"line":6,"column":4}}, "extra": { "rawValue": 64, "raw": "0100" diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/544/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/544/options.json deleted file mode 100644 index 37c243afff2a..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/544/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected reserved word 'public' (2:8)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/544/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/544/output.json new file mode 100644 index 000000000000..87e0021bd4bb --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/544/output.json @@ -0,0 +1,77 @@ +{ + "type": "File", + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":25}}, + "errors": [ + "SyntaxError: Unexpected reserved word 'public' (2:8)" + ], + "program": { + "type": "Program", + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":25}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start":14,"end":39,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":25}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":20,"end":38,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":24}}, + "id": { + "type": "ObjectPattern", + "start":20,"end":30,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":16}}, + "properties": [ + { + "type": "ObjectProperty", + "start":22,"end":28,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":14}}, + "method": false, + "key": { + "type": "Identifier", + "start":22,"end":28,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":14},"identifierName":"public"}, + "name": "public" + }, + "computed": false, + "shorthand": true, + "value": { + "type": "Identifier", + "start":22,"end":28,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":14},"identifierName":"public"}, + "name": "public" + }, + "extra": { + "shorthand": true + } + } + ] + }, + "init": { + "type": "CallExpression", + "start":33,"end":38,"loc":{"start":{"line":2,"column":19},"end":{"line":2,"column":24}}, + "callee": { + "type": "Identifier", + "start":33,"end":36,"loc":{"start":{"line":2,"column":19},"end":{"line":2,"column":22},"identifierName":"foo"}, + "name": "foo" + }, + "arguments": [] + } + } + ], + "kind": "const" + } + ], + "directives": [ + { + "type": "Directive", + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "value": { + "type": "DirectiveLiteral", + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/545/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/545/options.json index b09fdddc9d0a..2104ca43283f 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/545/options.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/545/options.json @@ -1,4 +1,3 @@ { - "sourceType": "module", - "throws": "Unexpected reserved word 'public' (1:8)" + "sourceType": "module" } diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/545/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/545/output.json new file mode 100644 index 000000000000..d0a88458d8f9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/545/output.json @@ -0,0 +1,63 @@ +{ + "type": "File", + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, + "errors": [ + "SyntaxError: Unexpected reserved word 'public' (1:8)" + ], + "program": { + "type": "Program", + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":6,"end":24,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":24}}, + "id": { + "type": "ObjectPattern", + "start":6,"end":16,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":16}}, + "properties": [ + { + "type": "ObjectProperty", + "start":8,"end":14,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":14}}, + "method": false, + "key": { + "type": "Identifier", + "start":8,"end":14,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":14},"identifierName":"public"}, + "name": "public" + }, + "computed": false, + "shorthand": true, + "value": { + "type": "Identifier", + "start":8,"end":14,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":14},"identifierName":"public"}, + "name": "public" + }, + "extra": { + "shorthand": true + } + } + ] + }, + "init": { + "type": "CallExpression", + "start":19,"end":24,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":24}}, + "callee": { + "type": "Identifier", + "start":19,"end":22,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":22},"identifierName":"foo"}, + "name": "foo" + }, + "arguments": [] + } + } + ], + "kind": "const" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/546/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/546/output.json index 21d7b12022aa..5b80a70f2a7a 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/546/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/546/output.json @@ -1,127 +1,37 @@ { "type": "File", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, "program": { "type": "Program", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, "declarations": [ { "type": "VariableDeclarator", - "start": 6, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":6,"end":24,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":24}}, "id": { "type": "ObjectPattern", - "start": 6, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":6,"end":16,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":16}}, "properties": [ { "type": "ObjectProperty", - "start": 8, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":8,"end":14,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":14}}, "method": false, "key": { "type": "Identifier", - "start": 8, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 14 - }, - "identifierName": "public" - }, + "start":8,"end":14,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":14},"identifierName":"public"}, "name": "public" }, "computed": false, "shorthand": true, "value": { "type": "Identifier", - "start": 8, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 14 - }, - "identifierName": "public" - }, + "start":8,"end":14,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":14},"identifierName":"public"}, "name": "public" }, "extra": { @@ -132,33 +42,10 @@ }, "init": { "type": "CallExpression", - "start": 19, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":19,"end":24,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":24}}, "callee": { "type": "Identifier", - "start": 19, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 22 - }, - "identifierName": "foo" - }, + "start":19,"end":22,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":22},"identifierName":"foo"}, "name": "foo" }, "arguments": [] diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/547/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/547/options.json deleted file mode 100644 index c2fb6377e80d..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/547/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected reserved word 'arguments' (2:8)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/547/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/547/output.json new file mode 100644 index 000000000000..c2e81901a1f2 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/547/output.json @@ -0,0 +1,78 @@ +{ + "type": "File", + "start":0,"end":42,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":28}}, + "errors": [ + "SyntaxError: Unexpected reserved word 'arguments' (2:8)", + "SyntaxError: Binding 'arguments' in strict mode (2:8)" + ], + "program": { + "type": "Program", + "start":0,"end":42,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":28}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start":14,"end":42,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":28}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":20,"end":41,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":27}}, + "id": { + "type": "ObjectPattern", + "start":20,"end":33,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":19}}, + "properties": [ + { + "type": "ObjectProperty", + "start":22,"end":31,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":17}}, + "method": false, + "key": { + "type": "Identifier", + "start":22,"end":31,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":17},"identifierName":"arguments"}, + "name": "arguments" + }, + "computed": false, + "shorthand": true, + "value": { + "type": "Identifier", + "start":22,"end":31,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":17},"identifierName":"arguments"}, + "name": "arguments" + }, + "extra": { + "shorthand": true + } + } + ] + }, + "init": { + "type": "CallExpression", + "start":36,"end":41,"loc":{"start":{"line":2,"column":22},"end":{"line":2,"column":27}}, + "callee": { + "type": "Identifier", + "start":36,"end":39,"loc":{"start":{"line":2,"column":22},"end":{"line":2,"column":25},"identifierName":"foo"}, + "name": "foo" + }, + "arguments": [] + } + } + ], + "kind": "const" + } + ], + "directives": [ + { + "type": "Directive", + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "value": { + "type": "DirectiveLiteral", + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/548/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/548/options.json index 4183c2e22534..2104ca43283f 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/548/options.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/548/options.json @@ -1,4 +1,3 @@ { - "sourceType": "module", - "throws": "Unexpected reserved word 'arguments' (1:8)" + "sourceType": "module" } diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/548/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/548/output.json new file mode 100644 index 000000000000..6065ead49801 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/548/output.json @@ -0,0 +1,64 @@ +{ + "type": "File", + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, + "errors": [ + "SyntaxError: Unexpected reserved word 'arguments' (1:8)", + "SyntaxError: Binding 'arguments' in strict mode (1:8)" + ], + "program": { + "type": "Program", + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":6,"end":27,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":27}}, + "id": { + "type": "ObjectPattern", + "start":6,"end":19,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":19}}, + "properties": [ + { + "type": "ObjectProperty", + "start":8,"end":17,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":17}}, + "method": false, + "key": { + "type": "Identifier", + "start":8,"end":17,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":17},"identifierName":"arguments"}, + "name": "arguments" + }, + "computed": false, + "shorthand": true, + "value": { + "type": "Identifier", + "start":8,"end":17,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":17},"identifierName":"arguments"}, + "name": "arguments" + }, + "extra": { + "shorthand": true + } + } + ] + }, + "init": { + "type": "CallExpression", + "start":22,"end":27,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":27}}, + "callee": { + "type": "Identifier", + "start":22,"end":25,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":25},"identifierName":"foo"}, + "name": "foo" + }, + "arguments": [] + } + } + ], + "kind": "const" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/549/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/549/output.json index c49b14fdab31..50c48c3446b4 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/549/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/549/output.json @@ -1,127 +1,37 @@ { "type": "File", - "start": 0, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, "program": { "type": "Program", - "start": 0, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, "declarations": [ { "type": "VariableDeclarator", - "start": 6, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":6,"end":27,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":27}}, "id": { "type": "ObjectPattern", - "start": 6, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":6,"end":19,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":19}}, "properties": [ { "type": "ObjectProperty", - "start": 8, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":8,"end":17,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":17}}, "method": false, "key": { "type": "Identifier", - "start": 8, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 17 - }, - "identifierName": "arguments" - }, + "start":8,"end":17,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":17},"identifierName":"arguments"}, "name": "arguments" }, "computed": false, "shorthand": true, "value": { "type": "Identifier", - "start": 8, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 17 - }, - "identifierName": "arguments" - }, + "start":8,"end":17,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":17},"identifierName":"arguments"}, "name": "arguments" }, "extra": { @@ -132,33 +42,10 @@ }, "init": { "type": "CallExpression", - "start": 22, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":22,"end":27,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":27}}, "callee": { "type": "Identifier", - "start": 22, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 25 - }, - "identifierName": "foo" - }, + "start":22,"end":25,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":25},"identifierName":"foo"}, "name": "foo" }, "arguments": [] diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/55/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/55/output.json index 7afc0a671971..c845e6ff49a3 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/55/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/55/output.json @@ -1,62 +1,18 @@ { "type": "File", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, "program": { "type": "Program", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 2 - } - }, + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}}, "expression": { "type": "NumericLiteral", - "start": 0, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 2 - } - }, + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}}, "extra": { "rawValue": 42, "raw": "42" @@ -67,18 +23,7 @@ { "type": "CommentLine", "value": " line comment", - "start": 3, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 18 - } - } + "start":3,"end":18,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":18}} } ] } @@ -89,18 +34,7 @@ { "type": "CommentLine", "value": " line comment", - "start": 3, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 18 - } - } + "start":3,"end":18,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":18}} } ] } \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/550/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/550/options.json deleted file mode 100644 index 5cee88d901e4..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/550/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Legacy octal literals are not allowed in strict mode (2:10)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/550/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/550/output.json new file mode 100644 index 000000000000..e73c9a97f508 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/550/output.json @@ -0,0 +1,55 @@ +{ + "type": "File", + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":13}}, + "errors": [ + "SyntaxError: Legacy octal literals are not allowed in strict mode (2:10)" + ], + "program": { + "type": "Program", + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":13}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start":14,"end":27,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":13}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":20,"end":26,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":12}}, + "id": { + "type": "Identifier", + "start":20,"end":21,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":7},"identifierName":"a"}, + "name": "a" + }, + "init": { + "type": "NumericLiteral", + "start":24,"end":26,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":12}}, + "extra": { + "rawValue": 7, + "raw": "07" + }, + "value": 7 + } + } + ], + "kind": "const" + } + ], + "directives": [ + { + "type": "Directive", + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "value": { + "type": "DirectiveLiteral", + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/551/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/551/output.json index d52ff8418d12..2aaa38345fac 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/551/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/551/output.json @@ -1,62 +1,18 @@ { "type": "File", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - }, + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, "program": { "type": "Program", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - }, + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - }, + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, "expression": { "type": "NumericLiteral", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - }, + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, "extra": { "rawValue": 73, "raw": "0111" diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/552/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/552/options.json deleted file mode 100644 index 5cee88d901e4..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/552/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Legacy octal literals are not allowed in strict mode (2:10)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/552/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/552/output.json new file mode 100644 index 000000000000..765b5e13a1e5 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/552/output.json @@ -0,0 +1,55 @@ +{ + "type": "File", + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":13}}, + "errors": [ + "SyntaxError: Legacy octal literals are not allowed in strict mode (2:10)" + ], + "program": { + "type": "Program", + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":13}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start":14,"end":27,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":13}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":20,"end":26,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":12}}, + "id": { + "type": "Identifier", + "start":20,"end":21,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":7},"identifierName":"a"}, + "name": "a" + }, + "init": { + "type": "NumericLiteral", + "start":24,"end":26,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":12}}, + "extra": { + "rawValue": 8, + "raw": "08" + }, + "value": 8 + } + } + ], + "kind": "const" + } + ], + "directives": [ + { + "type": "Directive", + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "value": { + "type": "DirectiveLiteral", + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/553/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/553/output.json index 690fd47a348f..a754dc4717cc 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/553/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/553/output.json @@ -1,62 +1,18 @@ { "type": "File", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "program": { "type": "Program", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "expression": { "type": "NumericLiteral", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "extra": { "rawValue": 25257156155, "raw": "0274134317073" diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/556/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/556/options.json deleted file mode 100644 index eff49cbfba64..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/556/options.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "createParenthesizedExpressions": true, - "throws": "You're trying to assign to a parenthesized expression, eg. instead of `({a}) = 0` use `({a} = 0)` (1:1)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/557/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/557/output.json deleted file mode 100644 index b1f49f00e99f..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/557/output.json +++ /dev/null @@ -1,85 +0,0 @@ -{ - "type": "File", - "start": 0, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "program": { - "type": "Program", - "start": 0, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "sourceType": "script", - "interpreter": null, - "body": [ - { - "type": "ExpressionStatement", - "start": 0, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "expression": { - "type": "ParenthesizedExpression", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "expression": { - "type": "StringLiteral", - "start": 1, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "extra": { - "rawValue": "hello", - "raw": "\"hello\"" - }, - "value": "hello" - } - } - } - ], - "directives": [] - } -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/558/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/558/options.json deleted file mode 100644 index f37c4bc95c57..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/558/options.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "createParenthesizedExpressions": true, - "throws": "You're trying to assign to a parenthesized expression, eg. instead of `([a]) = 0` use `([a] = 0)` (1:1)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/56/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/56/output.json index d20fe505db8e..ec6c58c4a7e2 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/56/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/56/output.json @@ -1,62 +1,18 @@ { "type": "File", - "start": 0, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 2 - } - }, + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":2}}, "program": { "type": "Program", - "start": 0, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 2 - } - }, + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":2}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 17, - "end": 19, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 2 - } - }, + "start":17,"end":19,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":2}}, "expression": { "type": "NumericLiteral", - "start": 17, - "end": 19, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 2 - } - }, + "start":17,"end":19,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":2}}, "extra": { "rawValue": 42, "raw": "42" @@ -67,18 +23,7 @@ { "type": "CommentLine", "value": " Hello, world!", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - } + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}} } ] } @@ -89,18 +34,7 @@ { "type": "CommentLine", "value": " Hello, world!", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - } + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}} } ] } \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/57/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/57/output.json index 9618821b33ab..ec09f363c448 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/57/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/57/output.json @@ -1,31 +1,9 @@ { "type": "File", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "program": { "type": "Program", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "sourceType": "script", "interpreter": null, "body": [], @@ -34,18 +12,7 @@ { "type": "CommentLine", "value": " Hello, world!", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - } + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}} } ] }, @@ -53,18 +20,7 @@ { "type": "CommentLine", "value": " Hello, world!", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - } + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}} } ] } \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/58/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/58/output.json index 28d7a52866c7..2e92cc04b615 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/58/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/58/output.json @@ -1,31 +1,9 @@ { "type": "File", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "program": { "type": "Program", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "sourceType": "script", "interpreter": null, "body": [], @@ -34,18 +12,7 @@ { "type": "CommentLine", "value": " Hallo, world!", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - } + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}} } ] }, @@ -53,18 +20,7 @@ { "type": "CommentLine", "value": " Hallo, world!", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - } + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}} } ] } \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/59/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/59/output.json index ec6cf78bf96d..3bbd6360e89d 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/59/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/59/output.json @@ -1,62 +1,18 @@ { "type": "File", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 2 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":2}}, "program": { "type": "Program", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 2 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":2}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 3, - "end": 5, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 2 - } - }, + "start":3,"end":5,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":2}}, "expression": { "type": "NumericLiteral", - "start": 3, - "end": 5, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 2 - } - }, + "start":3,"end":5,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":2}}, "extra": { "rawValue": 42, "raw": "42" @@ -67,18 +23,7 @@ { "type": "CommentLine", "value": "", - "start": 0, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 2 - } - } + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}} } ] } @@ -89,18 +34,7 @@ { "type": "CommentLine", "value": "", - "start": 0, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 2 - } - } + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}} } ] } \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/6/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/6/output.json index e05c37f12629..230f98af8a2e 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/6/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/6/output.json @@ -1,90 +1,24 @@ { "type": "File", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, "program": { "type": "Program", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, "expression": { "type": "BinaryExpression", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, "left": { "type": "BinaryExpression", - "start": 1, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":1,"end":6,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":6}}, "left": { "type": "NumericLiteral", - "start": 1, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - } - }, + "start":1,"end":2,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":2}}, "extra": { "rawValue": 1, "raw": "1" @@ -94,18 +28,7 @@ "operator": "+", "right": { "type": "NumericLiteral", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, "extra": { "rawValue": 2, "raw": "2" @@ -120,18 +43,7 @@ "operator": "*", "right": { "type": "NumericLiteral", - "start": 11, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":11,"end":12,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":12}}, "extra": { "rawValue": 3, "raw": "3" diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/60/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/60/output.json index f9e7a22c6b08..f156dd8eff1d 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/60/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/60/output.json @@ -1,31 +1,9 @@ { "type": "File", - "start": 0, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 2 - } - }, + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}}, "program": { "type": "Program", - "start": 0, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 2 - } - }, + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}}, "sourceType": "script", "interpreter": null, "body": [], @@ -34,18 +12,7 @@ { "type": "CommentLine", "value": "", - "start": 0, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 2 - } - } + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}} } ] }, @@ -53,18 +20,7 @@ { "type": "CommentLine", "value": "", - "start": 0, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 2 - } - } + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}} } ] } \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/61/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/61/output.json index f9e7a22c6b08..f156dd8eff1d 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/61/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/61/output.json @@ -1,31 +1,9 @@ { "type": "File", - "start": 0, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 2 - } - }, + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}}, "program": { "type": "Program", - "start": 0, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 2 - } - }, + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}}, "sourceType": "script", "interpreter": null, "body": [], @@ -34,18 +12,7 @@ { "type": "CommentLine", "value": "", - "start": 0, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 2 - } - } + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}} } ] }, @@ -53,18 +20,7 @@ { "type": "CommentLine", "value": "", - "start": 0, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 2 - } - } + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}} } ] } \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/62/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/62/output.json index 30f3c2d9c3fc..26e4bb1d5e9f 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/62/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/62/output.json @@ -1,62 +1,18 @@ { "type": "File", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "program": { "type": "Program", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 4, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":4,"end":6,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":6}}, "expression": { "type": "NumericLiteral", - "start": 4, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":4,"end":6,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":6}}, "extra": { "rawValue": 42, "raw": "42" @@ -67,18 +23,7 @@ { "type": "CommentBlock", "value": "", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - } + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}} } ] } @@ -89,18 +34,7 @@ { "type": "CommentBlock", "value": "", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - } + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}} } ] } \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/63/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/63/output.json index 4239fdfb2b04..aeae1aa8a71f 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/63/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/63/output.json @@ -1,62 +1,18 @@ { "type": "File", - "start": 0, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 2 - } - }, + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":2}}, "program": { "type": "Program", - "start": 0, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 2 - } - }, + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":2}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 37, - "end": 39, - "loc": { - "start": { - "line": 4, - "column": 0 - }, - "end": { - "line": 4, - "column": 2 - } - }, + "start":37,"end":39,"loc":{"start":{"line":4,"column":0},"end":{"line":4,"column":2}}, "expression": { "type": "NumericLiteral", - "start": 37, - "end": 39, - "loc": { - "start": { - "line": 4, - "column": 0 - }, - "end": { - "line": 4, - "column": 2 - } - }, + "start":37,"end":39,"loc":{"start":{"line":4,"column":0},"end":{"line":4,"column":2}}, "extra": { "rawValue": 42, "raw": "42" @@ -67,34 +23,12 @@ { "type": "CommentLine", "value": " Hello, world!", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - } + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}} }, { "type": "CommentLine", "value": " Another hello", - "start": 18, - "end": 36, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 18 - } - } + "start":18,"end":36,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":18}} } ] } @@ -105,34 +39,12 @@ { "type": "CommentLine", "value": " Hello, world!", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - } + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}} }, { "type": "CommentLine", "value": " Another hello", - "start": 18, - "end": 36, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 18 - } - } + "start":18,"end":36,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":18}} } ] } \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/64/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/64/output.json index 770f5ef71821..d561fe3125e1 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/64/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/64/output.json @@ -1,123 +1,33 @@ { "type": "File", - "start": 0, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 11 - } - }, + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":11}}, "program": { "type": "Program", - "start": 0, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 11 - } - }, + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":11}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "IfStatement", - "start": 0, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 11 - } - }, + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":11}}, "test": { "type": "Identifier", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "x" - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"x"}, "name": "x" }, "consequent": { "type": "BlockStatement", - "start": 7, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 2, - "column": 11 - } - }, + "start":7,"end":36,"loc":{"start":{"line":1,"column":7},"end":{"line":2,"column":11}}, "body": [ { "type": "ExpressionStatement", - "start": 25, - "end": 34, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 9 - } - }, + "start":25,"end":34,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":9}}, "expression": { "type": "CallExpression", - "start": 25, - "end": 33, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 8 - } - }, + "start":25,"end":33,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":8}}, "callee": { "type": "Identifier", - "start": 25, - "end": 31, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 6 - }, - "identifierName": "doThat" - }, + "start":25,"end":31,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":6},"identifierName":"doThat"}, "name": "doThat" }, "arguments": [] @@ -126,18 +36,7 @@ { "type": "CommentLine", "value": " Some comment", - "start": 9, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 24 - } - } + "start":9,"end":24,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":24}} } ] } @@ -153,18 +52,7 @@ { "type": "CommentLine", "value": " Some comment", - "start": 9, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 24 - } - } + "start":9,"end":24,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":24}} } ] } \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/65/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/65/output.json index 75e2c8416701..c6e1f8bf31b5 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/65/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/65/output.json @@ -1,124 +1,34 @@ { "type": "File", - "start": 0, - "end": 50, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 50 - } - }, + "start":0,"end":50,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":50}}, "program": { "type": "Program", - "start": 0, - "end": 50, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 50 - } - }, + "start":0,"end":50,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":50}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "SwitchStatement", - "start": 0, - "end": 50, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 50 - } - }, + "start":0,"end":50,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":50}}, "discriminant": { "type": "Identifier", - "start": 8, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 14 - }, - "identifierName": "answer" - }, + "start":8,"end":14,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":14},"identifierName":"answer"}, "name": "answer" }, "cases": [ { "type": "SwitchCase", - "start": 18, - "end": 48, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 48 - } - }, + "start":18,"end":48,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":48}}, "consequent": [ { "type": "ExpressionStatement", - "start": 41, - "end": 48, - "loc": { - "start": { - "line": 1, - "column": 41 - }, - "end": { - "line": 1, - "column": 48 - } - }, + "start":41,"end":48,"loc":{"start":{"line":1,"column":41},"end":{"line":1,"column":48}}, "expression": { "type": "CallExpression", - "start": 41, - "end": 48, - "loc": { - "start": { - "line": 1, - "column": 41 - }, - "end": { - "line": 1, - "column": 48 - } - }, + "start":41,"end":48,"loc":{"start":{"line":1,"column":41},"end":{"line":1,"column":48}}, "callee": { "type": "Identifier", - "start": 41, - "end": 46, - "loc": { - "start": { - "line": 1, - "column": 41 - }, - "end": { - "line": 1, - "column": 46 - }, - "identifierName": "bingo" - }, + "start":41,"end":46,"loc":{"start":{"line":1,"column":41},"end":{"line":1,"column":46},"identifierName":"bingo"}, "name": "bingo" }, "arguments": [] @@ -127,36 +37,14 @@ { "type": "CommentBlock", "value": " perfect ", - "start": 27, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 40 - } - } + "start":27,"end":40,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":40}} } ] } ], "test": { "type": "NumericLiteral", - "start": 23, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":23,"end":25,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":25}}, "extra": { "rawValue": 42, "raw": "42" @@ -173,18 +61,7 @@ { "type": "CommentBlock", "value": " perfect ", - "start": 27, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 40 - } - } + "start":27,"end":40,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":40}} } ] } \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/66/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/66/output.json index 3b0df6852fce..a1b891f67787 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/66/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/66/output.json @@ -1,62 +1,18 @@ { "type": "File", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1}}, "expression": { "type": "NumericLiteral", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1}}, "extra": { "rawValue": 0, "raw": "0" diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/67/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/67/output.json index b21e99bf2e8a..5ad0d7459559 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/67/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/67/output.json @@ -1,62 +1,18 @@ { "type": "File", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1}}, "expression": { "type": "NumericLiteral", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1}}, "extra": { "rawValue": 3, "raw": "3" diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/68/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/68/output.json index a10e4151e34b..aaeac684c1f4 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/68/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/68/output.json @@ -1,62 +1,18 @@ { "type": "File", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1}}, "expression": { "type": "NumericLiteral", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1}}, "extra": { "rawValue": 5, "raw": "5" diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/69/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/69/output.json index 20849b383b65..db9c867205f3 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/69/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/69/output.json @@ -1,62 +1,18 @@ { "type": "File", - "start": 0, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 2 - } - }, + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}}, "program": { "type": "Program", - "start": 0, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 2 - } - }, + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 2 - } - }, + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}}, "expression": { "type": "NumericLiteral", - "start": 0, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 2 - } - }, + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}}, "extra": { "rawValue": 42, "raw": "42" diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/7/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/7/output.json index 9446cbbae1c5..86fa33c5b8af 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/7/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/7/output.json @@ -1,94 +1,27 @@ { "type": "File", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "program": { "type": "Program", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "expression": { "type": "AssignmentExpression", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "operator": "=", "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "right": { "type": "ArrayExpression", - "start": 4, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":4,"end":6,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":6}}, "elements": [] } } diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/70/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/70/output.json index a5255d5fce90..ac4cc54d118e 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/70/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/70/output.json @@ -1,62 +1,18 @@ { "type": "File", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, "program": { "type": "Program", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, "expression": { "type": "NumericLiteral", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, "extra": { "rawValue": 0.14, "raw": ".14" diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/71/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/71/output.json index bcb0e150eda3..8f33cfd60630 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/71/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/71/output.json @@ -1,62 +1,18 @@ { "type": "File", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "program": { "type": "Program", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "expression": { "type": "NumericLiteral", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "extra": { "rawValue": 3.14159, "raw": "3.14159" diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/72/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/72/output.json index 85fdb9eb27f1..34d1f995b463 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/72/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/72/output.json @@ -1,62 +1,18 @@ { "type": "File", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "program": { "type": "Program", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "expression": { "type": "NumericLiteral", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "extra": { "rawValue": 6.02214179e+23, "raw": "6.02214179e+23" diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/73/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/73/output.json index 570feb3f99a8..782f9c962a58 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/73/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/73/output.json @@ -1,62 +1,18 @@ { "type": "File", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "program": { "type": "Program", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "expression": { "type": "NumericLiteral", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "extra": { "rawValue": 1.49241783e-10, "raw": "1.492417830e-10" diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/74/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/74/output.json index 5dab1af37b3e..2cbe6c5f228f 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/74/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/74/output.json @@ -1,62 +1,18 @@ { "type": "File", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, "program": { "type": "Program", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, "expression": { "type": "NumericLiteral", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, "extra": { "rawValue": 0, "raw": "0x0" diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/75/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/75/output.json index 4d36c6d5cebb..10e5ffff0ec4 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/75/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/75/output.json @@ -1,62 +1,18 @@ { "type": "File", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "program": { "type": "Program", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "expression": { "type": "NumericLiteral", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "extra": { "rawValue": 0, "raw": "0e+100" diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/76/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/76/output.json index ffa4e3f03d34..615599921350 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/76/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/76/output.json @@ -1,62 +1,18 @@ { "type": "File", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "program": { "type": "Program", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "expression": { "type": "NumericLiteral", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "extra": { "rawValue": 2748, "raw": "0xabc" diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/77/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/77/output.json index ca378cfb321e..e713c6daf609 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/77/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/77/output.json @@ -1,62 +1,18 @@ { "type": "File", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "program": { "type": "Program", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "expression": { "type": "NumericLiteral", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "extra": { "rawValue": 3567, "raw": "0xdef" diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/78/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/78/output.json index e88d6a6431f2..273d62967486 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/78/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/78/output.json @@ -1,62 +1,18 @@ { "type": "File", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - }, + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, "program": { "type": "Program", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - }, + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - }, + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, "expression": { "type": "NumericLiteral", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - }, + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, "extra": { "rawValue": 26, "raw": "0X1A" diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/79/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/79/output.json index da0f5a5a077e..b8debd493dbd 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/79/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/79/output.json @@ -1,62 +1,18 @@ { "type": "File", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - }, + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, "program": { "type": "Program", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - }, + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - }, + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, "expression": { "type": "NumericLiteral", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - }, + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, "extra": { "rawValue": 16, "raw": "0x10" diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/8/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/8/output.json index 138fcb2e6263..07143b67c9a1 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/8/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/8/output.json @@ -1,94 +1,27 @@ { "type": "File", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "program": { "type": "Program", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "expression": { "type": "AssignmentExpression", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "operator": "=", "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "right": { "type": "ArrayExpression", - "start": 4, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":4,"end":7,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":7}}, "elements": [] } } diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/80/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/80/output.json index 3aeb059890fd..d269de6f532d 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/80/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/80/output.json @@ -1,62 +1,18 @@ { "type": "File", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "program": { "type": "Program", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "expression": { "type": "NumericLiteral", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "extra": { "rawValue": 256, "raw": "0x100" diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/81/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/81/output.json index 508faca10fbb..9bfb038fdbe3 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/81/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/81/output.json @@ -1,62 +1,18 @@ { "type": "File", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - }, + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, "program": { "type": "Program", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - }, + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - }, + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, "expression": { "type": "NumericLiteral", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - }, + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, "extra": { "rawValue": 4, "raw": "0X04" diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/82/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/82/output.json index 32add9ef9dc3..3e157b067a91 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/82/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/82/output.json @@ -1,62 +1,18 @@ { "type": "File", - "start": 0, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 2 - } - }, + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}}, "program": { "type": "Program", - "start": 0, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 2 - } - }, + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 2 - } - }, + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}}, "expression": { "type": "NumericLiteral", - "start": 0, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 2 - } - }, + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}}, "extra": { "rawValue": 2, "raw": "02" diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/83/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/83/output.json index 25cd08d3e7e6..b173873622d5 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/83/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/83/output.json @@ -1,62 +1,18 @@ { "type": "File", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, "program": { "type": "Program", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, "expression": { "type": "NumericLiteral", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, "extra": { "rawValue": 10, "raw": "012" diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/84/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/84/output.json index 3c9b2c223f85..ef45bffe3959 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/84/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/84/output.json @@ -1,62 +1,18 @@ { "type": "File", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - }, + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, "program": { "type": "Program", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - }, + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - }, + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, "expression": { "type": "NumericLiteral", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - }, + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, "extra": { "rawValue": 10, "raw": "0012" diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/85/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/85/output.json index decc68148f95..06adbec3fdb4 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/85/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/85/output.json @@ -1,63 +1,19 @@ { "type": "File", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "program": { "type": "Program", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "sourceType": "script", "interpreter": null, "body": [], "directives": [ { "type": "Directive", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "value": { "type": "DirectiveLiteral", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "value": "Hello", "extra": { "raw": "\"Hello\"", diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/86/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/86/output.json index 13ba3c4eb97c..85beda94d481 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/86/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/86/output.json @@ -1,63 +1,19 @@ { "type": "File", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "program": { "type": "Program", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "sourceType": "script", "interpreter": null, "body": [], "directives": [ { "type": "Directive", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "value": { "type": "DirectiveLiteral", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "value": "\\n\\r\\t\\v\\b\\f\\\\\\'\\\"\\0", "extra": { "raw": "\"\\n\\r\\t\\v\\b\\f\\\\\\'\\\"\\0\"", diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/87/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/87/output.json index a6f1a992df51..eaa53e603013 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/87/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/87/output.json @@ -1,63 +1,19 @@ { "type": "File", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, "program": { "type": "Program", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, "sourceType": "script", "interpreter": null, "body": [], "directives": [ { "type": "Directive", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, "value": { "type": "DirectiveLiteral", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, "value": "\\u0061", "extra": { "raw": "\"\\u0061\"", diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/88/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/88/output.json index 2b81d94ea76b..fb5e0996bf7b 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/88/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/88/output.json @@ -1,63 +1,19 @@ { "type": "File", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "program": { "type": "Program", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "sourceType": "script", "interpreter": null, "body": [], "directives": [ { "type": "Directive", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "value": { "type": "DirectiveLiteral", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "value": "\\x61", "extra": { "raw": "\"\\x61\"", diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/89/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/89/output.json index 166849449336..2bc5cf54b227 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/89/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/89/output.json @@ -1,63 +1,19 @@ { "type": "File", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "program": { "type": "Program", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "sourceType": "script", "interpreter": null, "body": [], "directives": [ { "type": "Directive", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "value": { "type": "DirectiveLiteral", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "value": "Hello\\nworld", "extra": { "raw": "\"Hello\\nworld\"", diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/9/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/9/output.json index ef826212c27b..ffa484a7df17 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/9/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/9/output.json @@ -1,109 +1,31 @@ { "type": "File", - "start": 0, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, "program": { "type": "Program", - "start": 0, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, "expression": { "type": "AssignmentExpression", - "start": 0, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, "operator": "=", "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "right": { "type": "ArrayExpression", - "start": 4, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":4,"end":10,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":10}}, "elements": [ { "type": "NumericLiteral", - "start": 6, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":6,"end":8,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":8}}, "extra": { "rawValue": 42, "raw": "42" diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/90/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/90/output.json index 69ff486c62d9..8bbf441a1bd2 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/90/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/90/output.json @@ -1,63 +1,19 @@ { "type": "File", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 6 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":6}}, "program": { "type": "Program", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 6 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":6}}, "sourceType": "script", "interpreter": null, "body": [], "directives": [ { "type": "Directive", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 6 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":6}}, "value": { "type": "DirectiveLiteral", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 6 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":6}}, "value": "Hello\\\nworld", "extra": { "raw": "\"Hello\\\nworld\"", diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/91/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/91/output.json index f3046102c20f..7ba45ecc53a6 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/91/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/91/output.json @@ -1,63 +1,19 @@ { "type": "File", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "program": { "type": "Program", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "sourceType": "script", "interpreter": null, "body": [], "directives": [ { "type": "Directive", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "value": { "type": "DirectiveLiteral", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "value": "Hello\\02World", "extra": { "raw": "\"Hello\\02World\"", diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/92/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/92/output.json index 5f31b1a576f3..6ff8b0773cc8 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/92/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/92/output.json @@ -1,63 +1,19 @@ { "type": "File", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "program": { "type": "Program", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "sourceType": "script", "interpreter": null, "body": [], "directives": [ { "type": "Directive", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "value": { "type": "DirectiveLiteral", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "value": "Hello\\012World", "extra": { "raw": "\"Hello\\012World\"", diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/93/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/93/output.json index 9656f26c45a8..43e794894ee1 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/93/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/93/output.json @@ -1,63 +1,19 @@ { "type": "File", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "program": { "type": "Program", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "sourceType": "script", "interpreter": null, "body": [], "directives": [ { "type": "Directive", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "value": { "type": "DirectiveLiteral", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "value": "Hello\\122World", "extra": { "raw": "\"Hello\\122World\"", diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/94/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/94/output.json index 5a8ab1f21115..e51d6f3e5110 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/94/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/94/output.json @@ -1,63 +1,19 @@ { "type": "File", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "program": { "type": "Program", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "sourceType": "script", "interpreter": null, "body": [], "directives": [ { "type": "Directive", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "value": { "type": "DirectiveLiteral", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "value": "Hello\\0122World", "extra": { "raw": "\"Hello\\0122World\"", diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/95/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/95/output.json index e3470fcb4ec5..4dfa59a362d9 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/95/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/95/output.json @@ -1,63 +1,19 @@ { "type": "File", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "program": { "type": "Program", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "sourceType": "script", "interpreter": null, "body": [], "directives": [ { "type": "Directive", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "value": { "type": "DirectiveLiteral", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "value": "Hello\\312World", "extra": { "raw": "\"Hello\\312World\"", diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/96/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/96/output.json index 04f8c8c1df7b..f7c0c7ae2f1c 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/96/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/96/output.json @@ -1,63 +1,19 @@ { "type": "File", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "program": { "type": "Program", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "sourceType": "script", "interpreter": null, "body": [], "directives": [ { "type": "Directive", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "value": { "type": "DirectiveLiteral", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "value": "Hello\\412World", "extra": { "raw": "\"Hello\\412World\"", diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/97/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/97/output.json index fdc28b5e16ef..dc27abbc374a 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/97/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/97/output.json @@ -1,63 +1,19 @@ { "type": "File", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "program": { "type": "Program", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "sourceType": "script", "interpreter": null, "body": [], "directives": [ { "type": "Directive", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "value": { "type": "DirectiveLiteral", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "value": "Hello\\812World", "extra": { "raw": "\"Hello\\812World\"", diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/98/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/98/output.json index 88a3f339c132..7ceb0644f6ce 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/98/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/98/output.json @@ -1,63 +1,19 @@ { "type": "File", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "program": { "type": "Program", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "sourceType": "script", "interpreter": null, "body": [], "directives": [ { "type": "Directive", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "value": { "type": "DirectiveLiteral", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "value": "Hello\\712World", "extra": { "raw": "\"Hello\\712World\"", diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/99/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/99/output.json index d73cfa2bd010..1a8fc198f200 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/99/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/99/output.json @@ -1,63 +1,19 @@ { "type": "File", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "program": { "type": "Program", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "sourceType": "script", "interpreter": null, "body": [], "directives": [ { "type": "Directive", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "value": { "type": "DirectiveLiteral", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "value": "Hello\\0World", "extra": { "raw": "\"Hello\\0World\"", diff --git a/packages/babel-parser/test/fixtures/core/valid-escape/async/output.json b/packages/babel-parser/test/fixtures/core/valid-escape/async/output.json deleted file mode 100644 index e220d3207f6b..000000000000 --- a/packages/babel-parser/test/fixtures/core/valid-escape/async/output.json +++ /dev/null @@ -1,87 +0,0 @@ -{ - "type": "File", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "program": { - "type": "Program", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "sourceType": "script", - "interpreter": null, - "body": [ - { - "type": "ExpressionStatement", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "expression": { - "type": "CallExpression", - "start": 1, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "callee": { - "type": "Identifier", - "start": 1, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "async" - }, - "name": "async" - }, - "arguments": [], - "extra": { - "parenthesized": true, - "parenStart": 0 - } - } - } - ], - "directives": [] - } -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/array-rest-spread/comma-after-rest/options.json b/packages/babel-parser/test/fixtures/es2015/array-rest-spread/comma-after-rest/options.json deleted file mode 100644 index daa827f45cc4..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/array-rest-spread/comma-after-rest/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Rest element must be last element (1:5)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/array-rest-spread/comma-after-rest/output.json b/packages/babel-parser/test/fixtures/es2015/array-rest-spread/comma-after-rest/output.json new file mode 100644 index 000000000000..2770669d1421 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/array-rest-spread/comma-after-rest/output.json @@ -0,0 +1,48 @@ +{ + "type": "File", + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "errors": [ + "SyntaxError: Unexpected trailing comma after rest element (1:5)" + ], + "program": { + "type": "Program", + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "expression": { + "type": "AssignmentExpression", + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "operator": "=", + "left": { + "type": "ArrayPattern", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "extra": { + "trailingComma": 5 + }, + "elements": [ + { + "type": "RestElement", + "start":1,"end":5,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":5}}, + "argument": { + "type": "Identifier", + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"a"}, + "name": "a" + } + } + ] + }, + "right": { + "type": "ArrayExpression", + "start":10,"end":12,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":12}}, + "elements": [] + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/array-rest-spread/comma-after-spread-for-in/input.js b/packages/babel-parser/test/fixtures/es2015/array-rest-spread/comma-after-spread-for-in/input.js new file mode 100644 index 000000000000..b58efbd91c33 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/array-rest-spread/comma-after-spread-for-in/input.js @@ -0,0 +1 @@ +for ([...a,] in []); diff --git a/packages/babel-parser/test/fixtures/es2015/array-rest-spread/comma-after-spread-for-in/output.json b/packages/babel-parser/test/fixtures/es2015/array-rest-spread/comma-after-spread-for-in/output.json new file mode 100644 index 000000000000..e854b9c5e72e --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/array-rest-spread/comma-after-spread-for-in/output.json @@ -0,0 +1,47 @@ +{ + "type": "File", + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, + "errors": [ + "SyntaxError: Unexpected trailing comma after rest element (1:10)" + ], + "program": { + "type": "Program", + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ForInStatement", + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, + "left": { + "type": "ArrayPattern", + "start":5,"end":12,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":12}}, + "extra": { + "trailingComma": 10 + }, + "elements": [ + { + "type": "RestElement", + "start":6,"end":10,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":10}}, + "argument": { + "type": "Identifier", + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"a"}, + "name": "a" + } + } + ] + }, + "right": { + "type": "ArrayExpression", + "start":16,"end":18,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":18}}, + "elements": [] + }, + "body": { + "type": "EmptyStatement", + "start":19,"end":20,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":20}} + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/array-rest-spread/comma-after-spread-nested/input.js b/packages/babel-parser/test/fixtures/es2015/array-rest-spread/comma-after-spread-nested/input.js new file mode 100644 index 000000000000..0e2c4750076e --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/array-rest-spread/comma-after-spread-nested/input.js @@ -0,0 +1 @@ +[[...a,]] = []; \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/array-rest-spread/comma-after-spread-nested/output.json b/packages/babel-parser/test/fixtures/es2015/array-rest-spread/comma-after-spread-nested/output.json new file mode 100644 index 000000000000..9d70fca940ae --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/array-rest-spread/comma-after-spread-nested/output.json @@ -0,0 +1,54 @@ +{ + "type": "File", + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, + "errors": [ + "SyntaxError: Unexpected trailing comma after rest element (1:6)" + ], + "program": { + "type": "Program", + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, + "expression": { + "type": "AssignmentExpression", + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, + "operator": "=", + "left": { + "type": "ArrayPattern", + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "elements": [ + { + "type": "ArrayPattern", + "start":1,"end":8,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":8}}, + "extra": { + "trailingComma": 6 + }, + "elements": [ + { + "type": "RestElement", + "start":2,"end":6,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":6}}, + "argument": { + "type": "Identifier", + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"a"}, + "name": "a" + } + } + ] + } + ] + }, + "right": { + "type": "ArrayExpression", + "start":12,"end":14,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":14}}, + "elements": [] + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/array-rest-spread/comma-after-spread/output.json b/packages/babel-parser/test/fixtures/es2015/array-rest-spread/comma-after-spread/output.json index 5874666e2695..cb05858a6f27 100644 --- a/packages/babel-parser/test/fixtures/es2015/array-rest-spread/comma-after-spread/output.json +++ b/packages/babel-parser/test/fixtures/es2015/array-rest-spread/comma-after-spread/output.json @@ -1,92 +1,28 @@ { "type": "File", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, "program": { "type": "Program", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, "expression": { "type": "ArrayExpression", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "extra": { + "trailingComma": 5 }, "elements": [ { "type": "SpreadElement", - "start": 1, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":1,"end":5,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":5}}, "argument": { "type": "Identifier", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "a" - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"a"}, "name": "a" } } diff --git a/packages/babel-parser/test/fixtures/es2015/array-rest-spread/with-object/output.json b/packages/babel-parser/test/fixtures/es2015/array-rest-spread/with-object/output.json index 00177fa4ac08..9b316c6cf608 100644 --- a/packages/babel-parser/test/fixtures/es2015/array-rest-spread/with-object/output.json +++ b/packages/babel-parser/test/fixtures/es2015/array-rest-spread/with-object/output.json @@ -1,156 +1,44 @@ { "type": "File", - "start": 0, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, "program": { "type": "Program", - "start": 0, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":4,"end":30,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":30}}, "id": { "type": "ArrayPattern", - "start": 4, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":4,"end":17,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":17}}, "elements": [ { "type": "RestElement", - "start": 5, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":5,"end":16,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":16}}, "argument": { "type": "ObjectPattern", - "start": 8, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":8,"end":16,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":16}}, "properties": [ { "type": "ObjectProperty", - "start": 9, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":9,"end":15,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":15}}, "method": false, "key": { "type": "Identifier", - "start": 9, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 15 - }, - "identifierName": "length" - }, + "start":9,"end":15,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":15},"identifierName":"length"}, "name": "length" }, "computed": false, "shorthand": true, "value": { "type": "Identifier", - "start": 9, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 15 - }, - "identifierName": "length" - }, + "start":9,"end":15,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":15},"identifierName":"length"}, "name": "length" }, "extra": { @@ -164,33 +52,11 @@ }, "init": { "type": "ArrayExpression", - "start": 20, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":20,"end":30,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":30}}, "elements": [ { "type": "NumericLiteral", - "start": 22, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":22,"end":23,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":23}}, "extra": { "rawValue": 1, "raw": "1" @@ -199,18 +65,7 @@ }, { "type": "NumericLiteral", - "start": 25, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":25,"end":26,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":26}}, "extra": { "rawValue": 2, "raw": "2" @@ -219,18 +74,7 @@ }, { "type": "NumericLiteral", - "start": 28, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":28,"end":29,"loc":{"start":{"line":1,"column":28},"end":{"line":1,"column":29}}, "extra": { "rawValue": 3, "raw": "3" diff --git a/packages/babel-parser/test/fixtures/es2015/arrow-functions/comma-after-rest-param/options.json b/packages/babel-parser/test/fixtures/es2015/arrow-functions/comma-after-rest-param/options.json index 65ed8c638978..31d4d73d6c85 100644 --- a/packages/babel-parser/test/fixtures/es2015/arrow-functions/comma-after-rest-param/options.json +++ b/packages/babel-parser/test/fixtures/es2015/arrow-functions/comma-after-rest-param/options.json @@ -1,3 +1,3 @@ { - "throws": "Rest element must be last element (1:8)" + "throws": "Unexpected token, expected \")\" (1:8)" } diff --git a/packages/babel-parser/test/fixtures/es2015/arrow-functions/create-parenthesized-expressions/output.json b/packages/babel-parser/test/fixtures/es2015/arrow-functions/create-parenthesized-expressions/output.json index 09568c70bbb9..4ead80d69a56 100644 --- a/packages/babel-parser/test/fixtures/es2015/arrow-functions/create-parenthesized-expressions/output.json +++ b/packages/babel-parser/test/fixtures/es2015/arrow-functions/create-parenthesized-expressions/output.json @@ -1,98 +1,31 @@ { "type": "File", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "program": { "type": "Program", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "expression": { "type": "ArrowFunctionExpression", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "id": null, "generator": false, "async": false, "params": [ { "type": "Identifier", - "start": 1, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 4 - }, - "identifierName": "foo" - }, + "start":1,"end":4,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":4},"identifierName":"foo"}, "name": "foo" } ], "body": { "type": "BlockStatement", - "start": 9, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":9,"end":11,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":11}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/es2015/arrow-functions/in-logic-expression/output.json b/packages/babel-parser/test/fixtures/es2015/arrow-functions/in-logic-expression/output.json index 9eda4fb8ae56..a7556bef8901 100644 --- a/packages/babel-parser/test/fixtures/es2015/arrow-functions/in-logic-expression/output.json +++ b/packages/babel-parser/test/fixtures/es2015/arrow-functions/in-logic-expression/output.json @@ -1,94 +1,28 @@ { "type": "File", - "start": 0, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 19 - } - }, + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":19}}, "program": { "type": "Program", - "start": 0, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 19 - } - }, + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":19}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, "expression": { "type": "LogicalExpression", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, "left": { "type": "ArrowFunctionExpression", - "start": 1, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":1,"end":9,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":9}}, "id": null, "generator": false, "async": false, "params": [], "body": { "type": "BlockStatement", - "start": 7, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":7,"end":9,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":9}}, "body": [], "directives": [] }, @@ -100,82 +34,27 @@ "operator": "||", "right": { "type": "BooleanLiteral", - "start": 14, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":14,"end":18,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":18}}, "value": true } } }, { "type": "ExpressionStatement", - "start": 20, - "end": 39, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 19 - } - }, + "start":20,"end":39,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":19}}, "expression": { "type": "ConditionalExpression", - "start": 20, - "end": 38, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 18 - } - }, + "start":20,"end":38,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":18}}, "test": { "type": "ArrowFunctionExpression", - "start": 21, - "end": 29, - "loc": { - "start": { - "line": 2, - "column": 1 - }, - "end": { - "line": 2, - "column": 9 - } - }, + "start":21,"end":29,"loc":{"start":{"line":2,"column":1},"end":{"line":2,"column":9}}, "id": null, "generator": false, "async": false, "params": [], "body": { "type": "BlockStatement", - "start": 27, - "end": 29, - "loc": { - "start": { - "line": 2, - "column": 7 - }, - "end": { - "line": 2, - "column": 9 - } - }, + "start":27,"end":29,"loc":{"start":{"line":2,"column":7},"end":{"line":2,"column":9}}, "body": [], "directives": [] }, @@ -186,36 +65,12 @@ }, "consequent": { "type": "Identifier", - "start": 33, - "end": 34, - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 14 - }, - "identifierName": "a" - }, + "start":33,"end":34,"loc":{"start":{"line":2,"column":13},"end":{"line":2,"column":14},"identifierName":"a"}, "name": "a" }, "alternate": { "type": "Identifier", - "start": 37, - "end": 38, - "loc": { - "start": { - "line": 2, - "column": 17 - }, - "end": { - "line": 2, - "column": 18 - }, - "identifierName": "b" - }, + "start":37,"end":38,"loc":{"start":{"line":2,"column":17},"end":{"line":2,"column":18},"identifierName":"b"}, "name": "b" } } diff --git a/packages/babel-parser/test/fixtures/es2015/arrow-functions/object-rest-spread/output.json b/packages/babel-parser/test/fixtures/es2015/arrow-functions/object-rest-spread/output.json index 1ab735185892..5207b62072a7 100644 --- a/packages/babel-parser/test/fixtures/es2015/arrow-functions/object-rest-spread/output.json +++ b/packages/babel-parser/test/fixtures/es2015/arrow-functions/object-rest-spread/output.json @@ -1,162 +1,49 @@ { "type": "File", - "start": 0, - "end": 44, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 2 - } - }, + "start":0,"end":44,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":2}}, "program": { "type": "Program", - "start": 0, - "end": 44, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 2 - } - }, + "start":0,"end":44,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":2}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 44, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 2 - } - }, + "start":0,"end":44,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":2}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 43, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":4,"end":43,"loc":{"start":{"line":1,"column":4},"end":{"line":3,"column":1}}, "id": { "type": "Identifier", - "start": 4, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "foo" - }, + "start":4,"end":7,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":7},"identifierName":"foo"}, "name": "foo" }, "init": { "type": "ArrowFunctionExpression", - "start": 10, - "end": 43, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":10,"end":43,"loc":{"start":{"line":1,"column":10},"end":{"line":3,"column":1}}, "id": null, "generator": false, "async": false, "params": [ { "type": "ObjectPattern", - "start": 12, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":12,"end":31,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":31}}, "properties": [ { "type": "ObjectProperty", - "start": 14, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":14,"end":19,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":19}}, "method": false, "key": { "type": "Identifier", - "start": 14, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 19 - }, - "identifierName": "title" - }, + "start":14,"end":19,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":19},"identifierName":"title"}, "name": "title" }, "computed": false, "shorthand": true, "value": { "type": "Identifier", - "start": 14, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 19 - }, - "identifierName": "title" - }, + "start":14,"end":19,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":19},"identifierName":"title"}, "name": "title" }, "extra": { @@ -165,33 +52,10 @@ }, { "type": "RestElement", - "start": 21, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":21,"end":29,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":29}}, "argument": { "type": "Identifier", - "start": 24, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 29 - }, - "identifierName": "other" - }, + "start":24,"end":29,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":29},"identifierName":"other"}, "name": "other" } } @@ -200,18 +64,7 @@ ], "body": { "type": "BlockStatement", - "start": 37, - "end": 43, - "loc": { - "start": { - "line": 1, - "column": 37 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":37,"end":43,"loc":{"start":{"line":1,"column":37},"end":{"line":3,"column":1}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/es2015/class-methods/direct-super-in-object-method/options.json b/packages/babel-parser/test/fixtures/es2015/class-methods/direct-super-in-object-method/options.json deleted file mode 100644 index 660e644cf6a5..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/class-methods/direct-super-in-object-method/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "super is only allowed in object methods and classes (4:13)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/class-methods/direct-super-in-object-method/output.json b/packages/babel-parser/test/fixtures/es2015/class-methods/direct-super-in-object-method/output.json new file mode 100644 index 000000000000..a7fb3e572421 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/class-methods/direct-super-in-object-method/output.json @@ -0,0 +1,115 @@ +{ + "type": "File", + "start":0,"end":87,"loc":{"start":{"line":1,"column":0},"end":{"line":7,"column":3}}, + "errors": [ + "SyntaxError: super is only allowed in object methods and classes (4:13)" + ], + "program": { + "type": "Program", + "start":0,"end":87,"loc":{"start":{"line":1,"column":0},"end":{"line":7,"column":3}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":87,"loc":{"start":{"line":1,"column":0},"end":{"line":7,"column":3}}, + "expression": { + "type": "CallExpression", + "start":0,"end":86,"loc":{"start":{"line":1,"column":0},"end":{"line":7,"column":2}}, + "callee": { + "type": "MemberExpression", + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "object": { + "type": "Identifier", + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6},"identifierName":"Object"}, + "name": "Object" + }, + "property": { + "type": "Identifier", + "start":7,"end":13,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":13},"identifierName":"create"}, + "name": "create" + }, + "computed": false + }, + "arguments": [ + { + "type": "ObjectExpression", + "start":14,"end":16,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":16}}, + "properties": [] + }, + { + "type": "ObjectExpression", + "start":18,"end":85,"loc":{"start":{"line":1,"column":18},"end":{"line":7,"column":1}}, + "properties": [ + { + "type": "ObjectProperty", + "start":22,"end":83,"loc":{"start":{"line":2,"column":2},"end":{"line":6,"column":3}}, + "method": false, + "key": { + "type": "Identifier", + "start":22,"end":25,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":5},"identifierName":"foo"}, + "name": "foo" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "ObjectExpression", + "start":27,"end":83,"loc":{"start":{"line":2,"column":7},"end":{"line":6,"column":3}}, + "properties": [ + { + "type": "ObjectProperty", + "start":33,"end":79,"loc":{"start":{"line":3,"column":4},"end":{"line":5,"column":5}}, + "method": false, + "key": { + "type": "Identifier", + "start":33,"end":36,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":7},"identifierName":"get"}, + "name": "get" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "FunctionExpression", + "start":38,"end":79,"loc":{"start":{"line":3,"column":9},"end":{"line":5,"column":5}}, + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":48,"end":79,"loc":{"start":{"line":3,"column":19},"end":{"line":5,"column":5}}, + "body": [ + { + "type": "ReturnStatement", + "start":56,"end":73,"loc":{"start":{"line":4,"column":6},"end":{"line":4,"column":23}}, + "argument": { + "type": "MemberExpression", + "start":63,"end":72,"loc":{"start":{"line":4,"column":13},"end":{"line":4,"column":22}}, + "object": { + "type": "Super", + "start":63,"end":68,"loc":{"start":{"line":4,"column":13},"end":{"line":4,"column":18}} + }, + "property": { + "type": "Identifier", + "start":69,"end":72,"loc":{"start":{"line":4,"column":19},"end":{"line":4,"column":22},"identifierName":"foo"}, + "name": "foo" + }, + "computed": false + } + } + ], + "directives": [] + } + } + } + ] + } + } + ] + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/class-methods/direct-super-outside-constructor/options.json b/packages/babel-parser/test/fixtures/es2015/class-methods/direct-super-outside-constructor/options.json deleted file mode 100644 index 9461325c423a..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/class-methods/direct-super-outside-constructor/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "super() is only valid inside a class constructor of a subclass. Maybe a typo in the method name ('constructor') or not extending another class? (2:8)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/class-methods/direct-super-outside-constructor/output.json b/packages/babel-parser/test/fixtures/es2015/class-methods/direct-super-outside-constructor/output.json new file mode 100644 index 000000000000..8813fbf71961 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/class-methods/direct-super-outside-constructor/output.json @@ -0,0 +1,68 @@ +{ + "type": "File", + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "errors": [ + "SyntaxError: super() is only valid inside a class constructor of a subclass. Maybe a typo in the method name ('constructor') or not extending another class? (2:8)" + ], + "program": { + "type": "Program", + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "id": { + "type": "Identifier", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":8,"end":28,"loc":{"start":{"line":1,"column":8},"end":{"line":3,"column":1}}, + "body": [ + { + "type": "ClassMethod", + "start":12,"end":26,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":16}}, + "static": false, + "key": { + "type": "Identifier", + "start":12,"end":13,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":3},"identifierName":"x"}, + "name": "x" + }, + "computed": false, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":17,"end":26,"loc":{"start":{"line":2,"column":7},"end":{"line":2,"column":16}}, + "body": [ + { + "type": "ExpressionStatement", + "start":18,"end":25,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":15}}, + "expression": { + "type": "CallExpression", + "start":18,"end":25,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":15}}, + "callee": { + "type": "Super", + "start":18,"end":23,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":13}} + }, + "arguments": [] + } + } + ], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/class-methods/disallow-duplicate-method-params/options.json b/packages/babel-parser/test/fixtures/es2015/class-methods/disallow-duplicate-method-params/options.json deleted file mode 100644 index c7a2c3ba50a0..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/class-methods/disallow-duplicate-method-params/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Argument name clash (2:11)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/class-methods/disallow-duplicate-method-params/output.json b/packages/babel-parser/test/fixtures/es2015/class-methods/disallow-duplicate-method-params/output.json new file mode 100644 index 000000000000..4fa31326d388 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/class-methods/disallow-duplicate-method-params/output.json @@ -0,0 +1,65 @@ +{ + "type": "File", + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "errors": [ + "SyntaxError: Argument name clash (2:11)" + ], + "program": { + "type": "Program", + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "id": { + "type": "Identifier", + "start":6,"end":9,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":9},"identifierName":"Foo"}, + "name": "Foo" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":10,"end":30,"loc":{"start":{"line":1,"column":10},"end":{"line":3,"column":1}}, + "body": [ + { + "type": "ClassMethod", + "start":16,"end":28,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":16}}, + "static": false, + "key": { + "type": "Identifier", + "start":16,"end":19,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":7},"identifierName":"bar"}, + "name": "bar" + }, + "computed": false, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start":20,"end":21,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":9},"identifierName":"a"}, + "name": "a" + }, + { + "type": "Identifier", + "start":23,"end":24,"loc":{"start":{"line":2,"column":11},"end":{"line":2,"column":12},"identifierName":"a"}, + "name": "a" + } + ], + "body": { + "type": "BlockStatement", + "start":26,"end":28,"loc":{"start":{"line":2,"column":14},"end":{"line":2,"column":16}}, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/class-methods/disallow-static-generator-prototype/options.json b/packages/babel-parser/test/fixtures/es2015/class-methods/disallow-static-generator-prototype/options.json deleted file mode 100644 index 524ed587e113..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/class-methods/disallow-static-generator-prototype/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Classes may not have static property named prototype (2:10)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/class-methods/disallow-static-generator-prototype/output.json b/packages/babel-parser/test/fixtures/es2015/class-methods/disallow-static-generator-prototype/output.json new file mode 100644 index 000000000000..d5de1e2c20d6 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/class-methods/disallow-static-generator-prototype/output.json @@ -0,0 +1,54 @@ +{ + "type": "File", + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "errors": [ + "SyntaxError: Classes may not have static property named prototype (2:10)" + ], + "program": { + "type": "Program", + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "id": { + "type": "Identifier", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":8,"end":36,"loc":{"start":{"line":1,"column":8},"end":{"line":3,"column":1}}, + "body": [ + { + "type": "ClassMethod", + "start":12,"end":34,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":24}}, + "static": true, + "kind": "method", + "key": { + "type": "Identifier", + "start":20,"end":29,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":19},"identifierName":"prototype"}, + "name": "prototype" + }, + "computed": false, + "id": null, + "generator": true, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":32,"end":34,"loc":{"start":{"line":2,"column":22},"end":{"line":2,"column":24}}, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/class-methods/disallow-static-prototype/options.json b/packages/babel-parser/test/fixtures/es2015/class-methods/disallow-static-prototype/options.json deleted file mode 100644 index f30c8a49abd3..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/class-methods/disallow-static-prototype/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Classes may not have static property named prototype (2:9)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/class-methods/disallow-static-prototype/output.json b/packages/babel-parser/test/fixtures/es2015/class-methods/disallow-static-prototype/output.json new file mode 100644 index 000000000000..c4d1636033ce --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/class-methods/disallow-static-prototype/output.json @@ -0,0 +1,54 @@ +{ + "type": "File", + "start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "errors": [ + "SyntaxError: Classes may not have static property named prototype (2:9)" + ], + "program": { + "type": "Program", + "start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "id": { + "type": "Identifier", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":8,"end":35,"loc":{"start":{"line":1,"column":8},"end":{"line":3,"column":1}}, + "body": [ + { + "type": "ClassMethod", + "start":12,"end":33,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":23}}, + "static": true, + "key": { + "type": "Identifier", + "start":19,"end":28,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":18},"identifierName":"prototype"}, + "name": "prototype" + }, + "computed": false, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":31,"end":33,"loc":{"start":{"line":2,"column":21},"end":{"line":2,"column":23}}, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/class-methods/getter-signature/options.json b/packages/babel-parser/test/fixtures/es2015/class-methods/getter-signature/options.json deleted file mode 100644 index 65bc24a66fcd..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/class-methods/getter-signature/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "getter must not have any formal parameters (2:2)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/class-methods/getter-signature/output.json b/packages/babel-parser/test/fixtures/es2015/class-methods/getter-signature/output.json new file mode 100644 index 000000000000..a135021f7ae8 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/class-methods/getter-signature/output.json @@ -0,0 +1,60 @@ +{ + "type": "File", + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "errors": [ + "SyntaxError: getter must not have any formal parameters (2:2)" + ], + "program": { + "type": "Program", + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "id": { + "type": "Identifier", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":8,"end":31,"loc":{"start":{"line":1,"column":8},"end":{"line":3,"column":1}}, + "body": [ + { + "type": "ClassMethod", + "start":12,"end":29,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":19}}, + "static": false, + "key": { + "type": "Identifier", + "start":16,"end":20,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":10},"identifierName":"prop"}, + "name": "prop" + }, + "computed": false, + "kind": "get", + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start":22,"end":25,"loc":{"start":{"line":2,"column":12},"end":{"line":2,"column":15},"identifierName":"arg"}, + "name": "arg" + } + ], + "body": { + "type": "BlockStatement", + "start":27,"end":29,"loc":{"start":{"line":2,"column":17},"end":{"line":2,"column":19}}, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/class-methods/linebreaks/output.json b/packages/babel-parser/test/fixtures/es2015/class-methods/linebreaks/output.json index c8f7cb8d1c12..db62df91f9cd 100644 --- a/packages/babel-parser/test/fixtures/es2015/class-methods/linebreaks/output.json +++ b/packages/babel-parser/test/fixtures/es2015/class-methods/linebreaks/output.json @@ -1,111 +1,32 @@ { "type": "File", - "start": 0, - "end": 239, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 42, - "column": 1 - } - }, + "start":0,"end":239,"loc":{"start":{"line":1,"column":0},"end":{"line":42,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 239, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 42, - "column": 1 - } - }, + "start":0,"end":239,"loc":{"start":{"line":1,"column":0},"end":{"line":42,"column":1}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 239, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 42, - "column": 1 - } - }, + "start":0,"end":239,"loc":{"start":{"line":1,"column":0},"end":{"line":42,"column":1}}, "id": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "A" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, "name": "A" }, "superClass": null, "body": { "type": "ClassBody", - "start": 8, - "end": 239, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 42, - "column": 1 - } - }, + "start":8,"end":239,"loc":{"start":{"line":1,"column":8},"end":{"line":42,"column":1}}, "body": [ { "type": "ClassMethod", - "start": 12, - "end": 27, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 4, - "column": 7 - } - }, + "start":12,"end":27,"loc":{"start":{"line":2,"column":2},"end":{"line":4,"column":7}}, "static": false, "key": { "type": "Identifier", - "start": 18, - "end": 19, - "loc": { - "start": { - "line": 3, - "column": 2 - }, - "end": { - "line": 3, - "column": 3 - }, - "identifierName": "a" - }, + "start":18,"end":19,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":3},"identifierName":"a"}, "name": "a" }, "computed": false, @@ -116,52 +37,18 @@ "params": [], "body": { "type": "BlockStatement", - "start": 25, - "end": 27, - "loc": { - "start": { - "line": 4, - "column": 5 - }, - "end": { - "line": 4, - "column": 7 - } - }, + "start":25,"end":27,"loc":{"start":{"line":4,"column":5},"end":{"line":4,"column":7}}, "body": [], "directives": [] } }, { "type": "ClassMethod", - "start": 31, - "end": 47, - "loc": { - "start": { - "line": 6, - "column": 2 - }, - "end": { - "line": 8, - "column": 8 - } - }, + "start":31,"end":47,"loc":{"start":{"line":6,"column":2},"end":{"line":8,"column":8}}, "static": false, "key": { "type": "Identifier", - "start": 37, - "end": 38, - "loc": { - "start": { - "line": 7, - "column": 2 - }, - "end": { - "line": 7, - "column": 3 - }, - "identifierName": "a" - }, + "start":37,"end":38,"loc":{"start":{"line":7,"column":2},"end":{"line":7,"column":3},"identifierName":"a"}, "name": "a" }, "computed": false, @@ -172,70 +59,24 @@ "params": [ { "type": "Identifier", - "start": 42, - "end": 43, - "loc": { - "start": { - "line": 8, - "column": 3 - }, - "end": { - "line": 8, - "column": 4 - }, - "identifierName": "a" - }, + "start":42,"end":43,"loc":{"start":{"line":8,"column":3},"end":{"line":8,"column":4},"identifierName":"a"}, "name": "a" } ], "body": { "type": "BlockStatement", - "start": 45, - "end": 47, - "loc": { - "start": { - "line": 8, - "column": 6 - }, - "end": { - "line": 8, - "column": 8 - } - }, + "start":45,"end":47,"loc":{"start":{"line":8,"column":6},"end":{"line":8,"column":8}}, "body": [], "directives": [] } }, { "type": "ClassMethod", - "start": 51, - "end": 70, - "loc": { - "start": { - "line": 10, - "column": 2 - }, - "end": { - "line": 11, - "column": 7 - } - }, + "start":51,"end":70,"loc":{"start":{"line":10,"column":2},"end":{"line":11,"column":7}}, "static": false, "key": { "type": "Identifier", - "start": 51, - "end": 62, - "loc": { - "start": { - "line": 10, - "column": 2 - }, - "end": { - "line": 10, - "column": 13 - }, - "identifierName": "constructor" - }, + "start":51,"end":62,"loc":{"start":{"line":10,"column":2},"end":{"line":10,"column":13},"identifierName":"constructor"}, "name": "constructor" }, "computed": false, @@ -246,52 +87,18 @@ "params": [], "body": { "type": "BlockStatement", - "start": 68, - "end": 70, - "loc": { - "start": { - "line": 11, - "column": 5 - }, - "end": { - "line": 11, - "column": 7 - } - }, + "start":68,"end":70,"loc":{"start":{"line":11,"column":5},"end":{"line":11,"column":7}}, "body": [], "directives": [] } }, { "type": "ClassMethod", - "start": 74, - "end": 83, - "loc": { - "start": { - "line": 13, - "column": 2 - }, - "end": { - "line": 14, - "column": 7 - } - }, + "start":74,"end":83,"loc":{"start":{"line":13,"column":2},"end":{"line":14,"column":7}}, "static": false, "key": { "type": "Identifier", - "start": 74, - "end": 75, - "loc": { - "start": { - "line": 13, - "column": 2 - }, - "end": { - "line": 13, - "column": 3 - }, - "identifierName": "a" - }, + "start":74,"end":75,"loc":{"start":{"line":13,"column":2},"end":{"line":13,"column":3},"identifierName":"a"}, "name": "a" }, "computed": false, @@ -302,53 +109,19 @@ "params": [], "body": { "type": "BlockStatement", - "start": 81, - "end": 83, - "loc": { - "start": { - "line": 14, - "column": 5 - }, - "end": { - "line": 14, - "column": 7 - } - }, + "start":81,"end":83,"loc":{"start":{"line":14,"column":5},"end":{"line":14,"column":7}}, "body": [], "directives": [] } }, { "type": "ClassMethod", - "start": 87, - "end": 100, - "loc": { - "start": { - "line": 16, - "column": 2 - }, - "end": { - "line": 18, - "column": 7 - } - }, + "start":87,"end":100,"loc":{"start":{"line":16,"column":2},"end":{"line":18,"column":7}}, "static": false, "kind": "method", "key": { "type": "Identifier", - "start": 91, - "end": 92, - "loc": { - "start": { - "line": 17, - "column": 2 - }, - "end": { - "line": 17, - "column": 3 - }, - "identifierName": "a" - }, + "start":91,"end":92,"loc":{"start":{"line":17,"column":2},"end":{"line":17,"column":3},"identifierName":"a"}, "name": "a" }, "computed": false, @@ -358,52 +131,18 @@ "params": [], "body": { "type": "BlockStatement", - "start": 98, - "end": 100, - "loc": { - "start": { - "line": 18, - "column": 5 - }, - "end": { - "line": 18, - "column": 7 - } - }, + "start":98,"end":100,"loc":{"start":{"line":18,"column":5},"end":{"line":18,"column":7}}, "body": [], "directives": [] } }, { "type": "ClassMethod", - "start": 104, - "end": 128, - "loc": { - "start": { - "line": 20, - "column": 2 - }, - "end": { - "line": 23, - "column": 7 - } - }, + "start":104,"end":128,"loc":{"start":{"line":20,"column":2},"end":{"line":23,"column":7}}, "static": true, "key": { "type": "Identifier", - "start": 119, - "end": 120, - "loc": { - "start": { - "line": 22, - "column": 2 - }, - "end": { - "line": 22, - "column": 3 - }, - "identifierName": "a" - }, + "start":119,"end":120,"loc":{"start":{"line":22,"column":2},"end":{"line":22,"column":3},"identifierName":"a"}, "name": "a" }, "computed": false, @@ -414,52 +153,18 @@ "params": [], "body": { "type": "BlockStatement", - "start": 126, - "end": 128, - "loc": { - "start": { - "line": 23, - "column": 5 - }, - "end": { - "line": 23, - "column": 7 - } - }, + "start":126,"end":128,"loc":{"start":{"line":23,"column":5},"end":{"line":23,"column":7}}, "body": [], "directives": [] } }, { "type": "ClassMethod", - "start": 132, - "end": 157, - "loc": { - "start": { - "line": 25, - "column": 2 - }, - "end": { - "line": 28, - "column": 8 - } - }, + "start":132,"end":157,"loc":{"start":{"line":25,"column":2},"end":{"line":28,"column":8}}, "static": true, "key": { "type": "Identifier", - "start": 147, - "end": 148, - "loc": { - "start": { - "line": 27, - "column": 2 - }, - "end": { - "line": 27, - "column": 3 - }, - "identifierName": "a" - }, + "start":147,"end":148,"loc":{"start":{"line":27,"column":2},"end":{"line":27,"column":3},"identifierName":"a"}, "name": "a" }, "computed": false, @@ -470,70 +175,24 @@ "params": [ { "type": "Identifier", - "start": 152, - "end": 153, - "loc": { - "start": { - "line": 28, - "column": 3 - }, - "end": { - "line": 28, - "column": 4 - }, - "identifierName": "a" - }, + "start":152,"end":153,"loc":{"start":{"line":28,"column":3},"end":{"line":28,"column":4},"identifierName":"a"}, "name": "a" } ], "body": { "type": "BlockStatement", - "start": 155, - "end": 157, - "loc": { - "start": { - "line": 28, - "column": 6 - }, - "end": { - "line": 28, - "column": 8 - } - }, + "start":155,"end":157,"loc":{"start":{"line":28,"column":6},"end":{"line":28,"column":8}}, "body": [], "directives": [] } }, { "type": "ClassMethod", - "start": 161, - "end": 189, - "loc": { - "start": { - "line": 30, - "column": 2 - }, - "end": { - "line": 32, - "column": 7 - } - }, + "start":161,"end":189,"loc":{"start":{"line":30,"column":2},"end":{"line":32,"column":7}}, "static": true, "key": { "type": "Identifier", - "start": 170, - "end": 181, - "loc": { - "start": { - "line": 31, - "column": 2 - }, - "end": { - "line": 31, - "column": 13 - }, - "identifierName": "constructor" - }, + "start":170,"end":181,"loc":{"start":{"line":31,"column":2},"end":{"line":31,"column":13},"identifierName":"constructor"}, "name": "constructor" }, "computed": false, @@ -544,52 +203,18 @@ "params": [], "body": { "type": "BlockStatement", - "start": 187, - "end": 189, - "loc": { - "start": { - "line": 32, - "column": 5 - }, - "end": { - "line": 32, - "column": 7 - } - }, + "start":187,"end":189,"loc":{"start":{"line":32,"column":5},"end":{"line":32,"column":7}}, "body": [], "directives": [] } }, { "type": "ClassMethod", - "start": 193, - "end": 211, - "loc": { - "start": { - "line": 34, - "column": 2 - }, - "end": { - "line": 36, - "column": 7 - } - }, + "start":193,"end":211,"loc":{"start":{"line":34,"column":2},"end":{"line":36,"column":7}}, "static": true, "key": { "type": "Identifier", - "start": 202, - "end": 203, - "loc": { - "start": { - "line": 35, - "column": 2 - }, - "end": { - "line": 35, - "column": 3 - }, - "identifierName": "a" - }, + "start":202,"end":203,"loc":{"start":{"line":35,"column":2},"end":{"line":35,"column":3},"identifierName":"a"}, "name": "a" }, "computed": false, @@ -600,53 +225,19 @@ "params": [], "body": { "type": "BlockStatement", - "start": 209, - "end": 211, - "loc": { - "start": { - "line": 36, - "column": 5 - }, - "end": { - "line": 36, - "column": 7 - } - }, + "start":209,"end":211,"loc":{"start":{"line":36,"column":5},"end":{"line":36,"column":7}}, "body": [], "directives": [] } }, { "type": "ClassMethod", - "start": 215, - "end": 237, - "loc": { - "start": { - "line": 38, - "column": 2 - }, - "end": { - "line": 41, - "column": 7 - } - }, + "start":215,"end":237,"loc":{"start":{"line":38,"column":2},"end":{"line":41,"column":7}}, "static": true, "kind": "method", "key": { "type": "Identifier", - "start": 228, - "end": 229, - "loc": { - "start": { - "line": 40, - "column": 2 - }, - "end": { - "line": 40, - "column": 3 - }, - "identifierName": "a" - }, + "start":228,"end":229,"loc":{"start":{"line":40,"column":2},"end":{"line":40,"column":3},"identifierName":"a"}, "name": "a" }, "computed": false, @@ -656,18 +247,7 @@ "params": [], "body": { "type": "BlockStatement", - "start": 235, - "end": 237, - "loc": { - "start": { - "line": 41, - "column": 5 - }, - "end": { - "line": 41, - "column": 7 - } - }, + "start":235,"end":237,"loc":{"start":{"line":41,"column":5},"end":{"line":41,"column":7}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/es2015/class-methods/malformed-super-expression/options.json b/packages/babel-parser/test/fixtures/es2015/class-methods/malformed-super-expression/options.json deleted file mode 100644 index dc41f0b14b5a..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/class-methods/malformed-super-expression/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected token (3:10)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/class-methods/malformed-super-expression/output.json b/packages/babel-parser/test/fixtures/es2015/class-methods/malformed-super-expression/output.json new file mode 100644 index 000000000000..8fa6cbb49774 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/class-methods/malformed-super-expression/output.json @@ -0,0 +1,77 @@ +{ + "type": "File", + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, + "errors": [ + "SyntaxError: super can only be used with function calls (i.e. super()) or in property accesses (i.e. super.prop or super[prop]) (3:4)" + ], + "program": { + "type": "Program", + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, + "id": { + "type": "Identifier", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":8,"end":39,"loc":{"start":{"line":1,"column":8},"end":{"line":5,"column":1}}, + "body": [ + { + "type": "ClassMethod", + "start":12,"end":37,"loc":{"start":{"line":2,"column":2},"end":{"line":4,"column":3}}, + "static": false, + "key": { + "type": "Identifier", + "start":12,"end":13,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":3},"identifierName":"x"}, + "name": "x" + }, + "computed": false, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":17,"end":37,"loc":{"start":{"line":2,"column":7},"end":{"line":4,"column":3}}, + "body": [ + { + "type": "ExpressionStatement", + "start":23,"end":33,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":14}}, + "expression": { + "type": "BinaryExpression", + "start":23,"end":32,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":13}}, + "left": { + "type": "Super", + "start":23,"end":28,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":9}} + }, + "operator": "-", + "right": { + "type": "NumericLiteral", + "start":31,"end":32,"loc":{"start":{"line":3,"column":12},"end":{"line":3,"column":13}}, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + } + ], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/class-methods/tricky-names/output.json b/packages/babel-parser/test/fixtures/es2015/class-methods/tricky-names/output.json index 7c4b9b67d199..05b7dbe0ca80 100644 --- a/packages/babel-parser/test/fixtures/es2015/class-methods/tricky-names/output.json +++ b/packages/babel-parser/test/fixtures/es2015/class-methods/tricky-names/output.json @@ -1,111 +1,32 @@ { "type": "File", - "start": 0, - "end": 311, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 55, - "column": 1 - } - }, + "start":0,"end":311,"loc":{"start":{"line":1,"column":0},"end":{"line":55,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 311, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 55, - "column": 1 - } - }, + "start":0,"end":311,"loc":{"start":{"line":1,"column":0},"end":{"line":55,"column":1}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 311, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 55, - "column": 1 - } - }, + "start":0,"end":311,"loc":{"start":{"line":1,"column":0},"end":{"line":55,"column":1}}, "id": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "A" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, "name": "A" }, "superClass": null, "body": { "type": "ClassBody", - "start": 8, - "end": 311, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 55, - "column": 1 - } - }, + "start":8,"end":311,"loc":{"start":{"line":1,"column":8},"end":{"line":55,"column":1}}, "body": [ { "type": "ClassMethod", - "start": 12, - "end": 23, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 3, - "column": 7 - } - }, + "start":12,"end":23,"loc":{"start":{"line":2,"column":2},"end":{"line":3,"column":7}}, "static": false, "key": { "type": "Identifier", - "start": 12, - "end": 15, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 5 - }, - "identifierName": "get" - }, + "start":12,"end":15,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":5},"identifierName":"get"}, "name": "get" }, "computed": false, @@ -116,52 +37,18 @@ "params": [], "body": { "type": "BlockStatement", - "start": 21, - "end": 23, - "loc": { - "start": { - "line": 3, - "column": 5 - }, - "end": { - "line": 3, - "column": 7 - } - }, + "start":21,"end":23,"loc":{"start":{"line":3,"column":5},"end":{"line":3,"column":7}}, "body": [], "directives": [] } }, { "type": "ClassMethod", - "start": 27, - "end": 38, - "loc": { - "start": { - "line": 5, - "column": 2 - }, - "end": { - "line": 6, - "column": 7 - } - }, + "start":27,"end":38,"loc":{"start":{"line":5,"column":2},"end":{"line":6,"column":7}}, "static": false, "key": { "type": "Identifier", - "start": 27, - "end": 30, - "loc": { - "start": { - "line": 5, - "column": 2 - }, - "end": { - "line": 5, - "column": 5 - }, - "identifierName": "set" - }, + "start":27,"end":30,"loc":{"start":{"line":5,"column":2},"end":{"line":5,"column":5},"identifierName":"set"}, "name": "set" }, "computed": false, @@ -172,53 +59,19 @@ "params": [], "body": { "type": "BlockStatement", - "start": 36, - "end": 38, - "loc": { - "start": { - "line": 6, - "column": 5 - }, - "end": { - "line": 6, - "column": 7 - } - }, + "start":36,"end":38,"loc":{"start":{"line":6,"column":5},"end":{"line":6,"column":7}}, "body": [], "directives": [] } }, { "type": "ClassMethod", - "start": 42, - "end": 56, - "loc": { - "start": { - "line": 8, - "column": 2 - }, - "end": { - "line": 9, - "column": 7 - } - }, + "start":42,"end":56,"loc":{"start":{"line":8,"column":2},"end":{"line":9,"column":7}}, "kind": "method", "computed": false, "key": { "type": "Identifier", - "start": 42, - "end": 48, - "loc": { - "start": { - "line": 8, - "column": 2 - }, - "end": { - "line": 8, - "column": 8 - }, - "identifierName": "static" - }, + "start":42,"end":48,"loc":{"start":{"line":8,"column":2},"end":{"line":8,"column":8},"identifierName":"static"}, "name": "static" }, "static": false, @@ -228,52 +81,18 @@ "params": [], "body": { "type": "BlockStatement", - "start": 54, - "end": 56, - "loc": { - "start": { - "line": 9, - "column": 5 - }, - "end": { - "line": 9, - "column": 7 - } - }, + "start":54,"end":56,"loc":{"start":{"line":9,"column":5},"end":{"line":9,"column":7}}, "body": [], "directives": [] } }, { "type": "ClassMethod", - "start": 60, - "end": 73, - "loc": { - "start": { - "line": 11, - "column": 2 - }, - "end": { - "line": 12, - "column": 7 - } - }, + "start":60,"end":73,"loc":{"start":{"line":11,"column":2},"end":{"line":12,"column":7}}, "static": false, "key": { "type": "Identifier", - "start": 60, - "end": 65, - "loc": { - "start": { - "line": 11, - "column": 2 - }, - "end": { - "line": 11, - "column": 7 - }, - "identifierName": "async" - }, + "start":60,"end":65,"loc":{"start":{"line":11,"column":2},"end":{"line":11,"column":7},"identifierName":"async"}, "name": "async" }, "computed": false, @@ -284,51 +103,18 @@ "params": [], "body": { "type": "BlockStatement", - "start": 71, - "end": 73, - "loc": { - "start": { - "line": 12, - "column": 5 - }, - "end": { - "line": 12, - "column": 7 - } - }, + "start":71,"end":73,"loc":{"start":{"line":12,"column":5},"end":{"line":12,"column":7}}, "body": [], "directives": [] } }, { "type": "ClassMethod", - "start": 78, - "end": 91, - "loc": { - "start": { - "line": 15, - "column": 2 - }, - "end": { - "line": 16, - "column": 7 - } - }, + "start":78,"end":91,"loc":{"start":{"line":15,"column":2},"end":{"line":16,"column":7}}, "static": false, "key": { "type": "StringLiteral", - "start": 78, - "end": 83, - "loc": { - "start": { - "line": 15, - "column": 2 - }, - "end": { - "line": 15, - "column": 7 - } - }, + "start":78,"end":83,"loc":{"start":{"line":15,"column":2},"end":{"line":15,"column":7}}, "extra": { "rawValue": "get", "raw": "'get'" @@ -343,51 +129,18 @@ "params": [], "body": { "type": "BlockStatement", - "start": 89, - "end": 91, - "loc": { - "start": { - "line": 16, - "column": 5 - }, - "end": { - "line": 16, - "column": 7 - } - }, + "start":89,"end":91,"loc":{"start":{"line":16,"column":5},"end":{"line":16,"column":7}}, "body": [], "directives": [] } }, { "type": "ClassMethod", - "start": 95, - "end": 108, - "loc": { - "start": { - "line": 18, - "column": 2 - }, - "end": { - "line": 19, - "column": 7 - } - }, + "start":95,"end":108,"loc":{"start":{"line":18,"column":2},"end":{"line":19,"column":7}}, "static": false, "key": { "type": "StringLiteral", - "start": 95, - "end": 100, - "loc": { - "start": { - "line": 18, - "column": 2 - }, - "end": { - "line": 18, - "column": 7 - } - }, + "start":95,"end":100,"loc":{"start":{"line":18,"column":2},"end":{"line":18,"column":7}}, "extra": { "rawValue": "set", "raw": "'set'" @@ -402,51 +155,18 @@ "params": [], "body": { "type": "BlockStatement", - "start": 106, - "end": 108, - "loc": { - "start": { - "line": 19, - "column": 5 - }, - "end": { - "line": 19, - "column": 7 - } - }, + "start":106,"end":108,"loc":{"start":{"line":19,"column":5},"end":{"line":19,"column":7}}, "body": [], "directives": [] } }, { "type": "ClassMethod", - "start": 112, - "end": 127, - "loc": { - "start": { - "line": 21, - "column": 2 - }, - "end": { - "line": 22, - "column": 7 - } - }, + "start":112,"end":127,"loc":{"start":{"line":21,"column":2},"end":{"line":22,"column":7}}, "static": false, "key": { "type": "StringLiteral", - "start": 112, - "end": 119, - "loc": { - "start": { - "line": 21, - "column": 2 - }, - "end": { - "line": 21, - "column": 9 - } - }, + "start":112,"end":119,"loc":{"start":{"line":21,"column":2},"end":{"line":21,"column":9}}, "extra": { "rawValue": "async", "raw": "'async'" @@ -461,52 +181,18 @@ "params": [], "body": { "type": "BlockStatement", - "start": 125, - "end": 127, - "loc": { - "start": { - "line": 22, - "column": 5 - }, - "end": { - "line": 22, - "column": 7 - } - }, + "start":125,"end":127,"loc":{"start":{"line":22,"column":5},"end":{"line":22,"column":7}}, "body": [], "directives": [] } }, { "type": "ClassMethod", - "start": 132, - "end": 152, - "loc": { - "start": { - "line": 25, - "column": 2 - }, - "end": { - "line": 27, - "column": 7 - } - }, + "start":132,"end":152,"loc":{"start":{"line":25,"column":2},"end":{"line":27,"column":7}}, "static": true, "key": { "type": "Identifier", - "start": 141, - "end": 144, - "loc": { - "start": { - "line": 26, - "column": 2 - }, - "end": { - "line": 26, - "column": 5 - }, - "identifierName": "get" - }, + "start":141,"end":144,"loc":{"start":{"line":26,"column":2},"end":{"line":26,"column":5},"identifierName":"get"}, "name": "get" }, "computed": false, @@ -517,52 +203,18 @@ "params": [], "body": { "type": "BlockStatement", - "start": 150, - "end": 152, - "loc": { - "start": { - "line": 27, - "column": 5 - }, - "end": { - "line": 27, - "column": 7 - } - }, + "start":150,"end":152,"loc":{"start":{"line":27,"column":5},"end":{"line":27,"column":7}}, "body": [], "directives": [] } }, { "type": "ClassMethod", - "start": 156, - "end": 176, - "loc": { - "start": { - "line": 29, - "column": 2 - }, - "end": { - "line": 31, - "column": 7 - } - }, + "start":156,"end":176,"loc":{"start":{"line":29,"column":2},"end":{"line":31,"column":7}}, "static": true, "key": { "type": "Identifier", - "start": 165, - "end": 168, - "loc": { - "start": { - "line": 30, - "column": 2 - }, - "end": { - "line": 30, - "column": 5 - }, - "identifierName": "set" - }, + "start":165,"end":168,"loc":{"start":{"line":30,"column":2},"end":{"line":30,"column":5},"identifierName":"set"}, "name": "set" }, "computed": false, @@ -573,52 +225,18 @@ "params": [], "body": { "type": "BlockStatement", - "start": 174, - "end": 176, - "loc": { - "start": { - "line": 31, - "column": 5 - }, - "end": { - "line": 31, - "column": 7 - } - }, + "start":174,"end":176,"loc":{"start":{"line":31,"column":5},"end":{"line":31,"column":7}}, "body": [], "directives": [] } }, { "type": "ClassMethod", - "start": 180, - "end": 203, - "loc": { - "start": { - "line": 33, - "column": 2 - }, - "end": { - "line": 35, - "column": 7 - } - }, + "start":180,"end":203,"loc":{"start":{"line":33,"column":2},"end":{"line":35,"column":7}}, "static": true, "key": { "type": "Identifier", - "start": 189, - "end": 195, - "loc": { - "start": { - "line": 34, - "column": 2 - }, - "end": { - "line": 34, - "column": 8 - }, - "identifierName": "static" - }, + "start":189,"end":195,"loc":{"start":{"line":34,"column":2},"end":{"line":34,"column":8},"identifierName":"static"}, "name": "static" }, "computed": false, @@ -629,52 +247,18 @@ "params": [], "body": { "type": "BlockStatement", - "start": 201, - "end": 203, - "loc": { - "start": { - "line": 35, - "column": 5 - }, - "end": { - "line": 35, - "column": 7 - } - }, + "start":201,"end":203,"loc":{"start":{"line":35,"column":5},"end":{"line":35,"column":7}}, "body": [], "directives": [] } }, { "type": "ClassMethod", - "start": 207, - "end": 229, - "loc": { - "start": { - "line": 37, - "column": 2 - }, - "end": { - "line": 39, - "column": 7 - } - }, + "start":207,"end":229,"loc":{"start":{"line":37,"column":2},"end":{"line":39,"column":7}}, "static": true, "key": { "type": "Identifier", - "start": 216, - "end": 221, - "loc": { - "start": { - "line": 38, - "column": 2 - }, - "end": { - "line": 38, - "column": 7 - }, - "identifierName": "async" - }, + "start":216,"end":221,"loc":{"start":{"line":38,"column":2},"end":{"line":38,"column":7},"identifierName":"async"}, "name": "async" }, "computed": false, @@ -685,52 +269,18 @@ "params": [], "body": { "type": "BlockStatement", - "start": 227, - "end": 229, - "loc": { - "start": { - "line": 39, - "column": 5 - }, - "end": { - "line": 39, - "column": 7 - } - }, + "start":227,"end":229,"loc":{"start":{"line":39,"column":5},"end":{"line":39,"column":7}}, "body": [], "directives": [] } }, { "type": "ClassMethod", - "start": 233, - "end": 251, - "loc": { - "start": { - "line": 41, - "column": 2 - }, - "end": { - "line": 43, - "column": 7 - } - }, + "start":233,"end":251,"loc":{"start":{"line":41,"column":2},"end":{"line":43,"column":7}}, "static": true, "key": { "type": "Identifier", - "start": 242, - "end": 243, - "loc": { - "start": { - "line": 42, - "column": 2 - }, - "end": { - "line": 42, - "column": 3 - }, - "identifierName": "a" - }, + "start":242,"end":243,"loc":{"start":{"line":42,"column":2},"end":{"line":42,"column":3},"identifierName":"a"}, "name": "a" }, "computed": false, @@ -741,52 +291,18 @@ "params": [], "body": { "type": "BlockStatement", - "start": 249, - "end": 251, - "loc": { - "start": { - "line": 43, - "column": 5 - }, - "end": { - "line": 43, - "column": 7 - } - }, + "start":249,"end":251,"loc":{"start":{"line":43,"column":5},"end":{"line":43,"column":7}}, "body": [], "directives": [] } }, { "type": "ClassMethod", - "start": 256, - "end": 275, - "loc": { - "start": { - "line": 46, - "column": 2 - }, - "end": { - "line": 48, - "column": 7 - } - }, + "start":256,"end":275,"loc":{"start":{"line":46,"column":2},"end":{"line":48,"column":7}}, "static": false, "key": { "type": "Identifier", - "start": 262, - "end": 267, - "loc": { - "start": { - "line": 47, - "column": 2 - }, - "end": { - "line": 47, - "column": 7 - }, - "identifierName": "async" - }, + "start":262,"end":267,"loc":{"start":{"line":47,"column":2},"end":{"line":47,"column":7},"identifierName":"async"}, "name": "async" }, "computed": false, @@ -797,52 +313,18 @@ "params": [], "body": { "type": "BlockStatement", - "start": 273, - "end": 275, - "loc": { - "start": { - "line": 48, - "column": 5 - }, - "end": { - "line": 48, - "column": 7 - } - }, + "start":273,"end":275,"loc":{"start":{"line":48,"column":5},"end":{"line":48,"column":7}}, "body": [], "directives": [] } }, { "type": "ClassMethod", - "start": 280, - "end": 309, - "loc": { - "start": { - "line": 51, - "column": 2 - }, - "end": { - "line": 54, - "column": 7 - } - }, + "start":280,"end":309,"loc":{"start":{"line":51,"column":2},"end":{"line":54,"column":7}}, "static": true, "key": { "type": "Identifier", - "start": 295, - "end": 301, - "loc": { - "start": { - "line": 53, - "column": 2 - }, - "end": { - "line": 53, - "column": 8 - }, - "identifierName": "static" - }, + "start":295,"end":301,"loc":{"start":{"line":53,"column":2},"end":{"line":53,"column":8},"identifierName":"static"}, "name": "static" }, "computed": false, @@ -853,18 +335,7 @@ "params": [], "body": { "type": "BlockStatement", - "start": 307, - "end": 309, - "loc": { - "start": { - "line": 54, - "column": 5 - }, - "end": { - "line": 54, - "column": 7 - } - }, + "start":307,"end":309,"loc":{"start":{"line":54,"column":5},"end":{"line":54,"column":7}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/es2015/class/division/output.json b/packages/babel-parser/test/fixtures/es2015/class/division/output.json index 0a4a21ad4d20..76937cc4f1a5 100644 --- a/packages/babel-parser/test/fixtures/es2015/class/division/output.json +++ b/packages/babel-parser/test/fixtures/es2015/class/division/output.json @@ -1,143 +1,42 @@ { "type": "File", - "start": 0, - "end": 86, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 9, - "column": 10 - } - }, + "start":0,"end":86,"loc":{"start":{"line":1,"column":0},"end":{"line":9,"column":10}}, "program": { "type": "Program", - "start": 0, - "end": 86, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 9, - "column": 10 - } - }, + "start":0,"end":86,"loc":{"start":{"line":1,"column":0},"end":{"line":9,"column":10}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "expression": { "type": "AssignmentExpression", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "operator": "=", "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "right": { "type": "BinaryExpression", - "start": 4, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":4,"end":17,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":17}}, "left": { "type": "ClassExpression", - "start": 4, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":4,"end":11,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":11}}, "id": null, "superClass": null, "body": { "type": "ClassBody", - "start": 9, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":9,"end":11,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":11}}, "body": [] } }, "operator": "/", "right": { "type": "Identifier", - "start": 14, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 17 - }, - "identifierName": "foo" - }, + "start":14,"end":17,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":17},"identifierName":"foo"}, "name": "foo" } } @@ -145,272 +44,80 @@ }, { "type": "ExpressionStatement", - "start": 19, - "end": 86, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 9, - "column": 10 - } - }, + "start":19,"end":86,"loc":{"start":{"line":3,"column":0},"end":{"line":9,"column":10}}, "expression": { "type": "AssignmentExpression", - "start": 19, - "end": 86, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 9, - "column": 10 - } - }, + "start":19,"end":86,"loc":{"start":{"line":3,"column":0},"end":{"line":9,"column":10}}, "operator": "=", "left": { "type": "Identifier", - "start": 19, - "end": 20, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - }, - "identifierName": "x" - }, + "start":19,"end":20,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":1},"identifierName":"x"}, "name": "x" }, "right": { "type": "BinaryExpression", - "start": 23, - "end": 86, - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 9, - "column": 10 - } - }, + "start":23,"end":86,"loc":{"start":{"line":3,"column":4},"end":{"line":9,"column":10}}, "left": { "type": "BinaryExpression", - "start": 23, - "end": 36, - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 4, - "column": 5 - } - }, + "start":23,"end":36,"loc":{"start":{"line":3,"column":4},"end":{"line":4,"column":5}}, "left": { "type": "ClassExpression", - "start": 23, - "end": 30, - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 11 - } - }, + "start":23,"end":30,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":11}}, "id": null, "superClass": null, "body": { "type": "ClassBody", - "start": 28, - "end": 30, - "loc": { - "start": { - "line": 3, - "column": 9 - }, - "end": { - "line": 3, - "column": 11 - } - }, + "start":28,"end":30,"loc":{"start":{"line":3,"column":9},"end":{"line":3,"column":11}}, "body": [] } }, "operator": "/", "right": { "type": "Identifier", - "start": 33, - "end": 36, - "loc": { - "start": { - "line": 4, - "column": 2 - }, - "end": { - "line": 4, - "column": 5 - }, - "identifierName": "foo" - }, + "start":33,"end":36,"loc":{"start":{"line":4,"column":2},"end":{"line":4,"column":5},"identifierName":"foo"}, "name": "foo" } }, "operator": "/", "right": { "type": "CallExpression", - "start": 39, - "end": 86, - "loc": { - "start": { - "line": 4, - "column": 8 - }, - "end": { - "line": 9, - "column": 10 - } - }, + "start":39,"end":86,"loc":{"start":{"line":4,"column":8},"end":{"line":9,"column":10}}, "callee": { "type": "CallExpression", - "start": 39, - "end": 61, - "loc": { - "start": { - "line": 4, - "column": 8 - }, - "end": { - "line": 6, - "column": 19 - } - }, + "start":39,"end":61,"loc":{"start":{"line":4,"column":8},"end":{"line":6,"column":19}}, "callee": { "type": "Identifier", - "start": 39, - "end": 40, - "loc": { - "start": { - "line": 4, - "column": 8 - }, - "end": { - "line": 4, - "column": 9 - }, - "identifierName": "g" - }, + "start":39,"end":40,"loc":{"start":{"line":4,"column":8},"end":{"line":4,"column":9},"identifierName":"g"}, "name": "g" }, "arguments": [ { "type": "AssignmentExpression", - "start": 43, - "end": 60, - "loc": { - "start": { - "line": 6, - "column": 1 - }, - "end": { - "line": 6, - "column": 18 - } - }, + "start":43,"end":60,"loc":{"start":{"line":6,"column":1},"end":{"line":6,"column":18}}, "operator": "=", "left": { "type": "Identifier", - "start": 43, - "end": 44, - "loc": { - "start": { - "line": 6, - "column": 1 - }, - "end": { - "line": 6, - "column": 2 - }, - "identifierName": "x" - }, + "start":43,"end":44,"loc":{"start":{"line":6,"column":1},"end":{"line":6,"column":2},"identifierName":"x"}, "name": "x" }, "right": { "type": "BinaryExpression", - "start": 47, - "end": 60, - "loc": { - "start": { - "line": 6, - "column": 5 - }, - "end": { - "line": 6, - "column": 18 - } - }, + "start":47,"end":60,"loc":{"start":{"line":6,"column":5},"end":{"line":6,"column":18}}, "left": { "type": "ClassExpression", - "start": 47, - "end": 54, - "loc": { - "start": { - "line": 6, - "column": 5 - }, - "end": { - "line": 6, - "column": 12 - } - }, + "start":47,"end":54,"loc":{"start":{"line":6,"column":5},"end":{"line":6,"column":12}}, "id": null, "superClass": null, "body": { "type": "ClassBody", - "start": 52, - "end": 54, - "loc": { - "start": { - "line": 6, - "column": 10 - }, - "end": { - "line": 6, - "column": 12 - } - }, + "start":52,"end":54,"loc":{"start":{"line":6,"column":10},"end":{"line":6,"column":12}}, "body": [] } }, "operator": "/", "right": { "type": "Identifier", - "start": 57, - "end": 60, - "loc": { - "start": { - "line": 6, - "column": 15 - }, - "end": { - "line": 6, - "column": 18 - }, - "identifierName": "foo" - }, + "start":57,"end":60,"loc":{"start":{"line":6,"column":15},"end":{"line":6,"column":18},"identifierName":"foo"}, "name": "foo" } } @@ -420,132 +127,41 @@ "arguments": [ { "type": "AssignmentExpression", - "start": 64, - "end": 85, - "loc": { - "start": { - "line": 8, - "column": 1 - }, - "end": { - "line": 9, - "column": 9 - } - }, + "start":64,"end":85,"loc":{"start":{"line":8,"column":1},"end":{"line":9,"column":9}}, "operator": "=", "left": { "type": "Identifier", - "start": 64, - "end": 65, - "loc": { - "start": { - "line": 8, - "column": 1 - }, - "end": { - "line": 8, - "column": 2 - }, - "identifierName": "x" - }, + "start":64,"end":65,"loc":{"start":{"line":8,"column":1},"end":{"line":8,"column":2},"identifierName":"x"}, "name": "x" }, "right": { "type": "BinaryExpression", - "start": 68, - "end": 85, - "loc": { - "start": { - "line": 8, - "column": 5 - }, - "end": { - "line": 9, - "column": 9 - } - }, + "start":68,"end":85,"loc":{"start":{"line":8,"column":5},"end":{"line":9,"column":9}}, "left": { "type": "BinaryExpression", - "start": 68, - "end": 81, - "loc": { - "start": { - "line": 8, - "column": 5 - }, - "end": { - "line": 9, - "column": 5 - } - }, + "start":68,"end":81,"loc":{"start":{"line":8,"column":5},"end":{"line":9,"column":5}}, "left": { "type": "ClassExpression", - "start": 68, - "end": 75, - "loc": { - "start": { - "line": 8, - "column": 5 - }, - "end": { - "line": 8, - "column": 12 - } - }, + "start":68,"end":75,"loc":{"start":{"line":8,"column":5},"end":{"line":8,"column":12}}, "id": null, "superClass": null, "body": { "type": "ClassBody", - "start": 73, - "end": 75, - "loc": { - "start": { - "line": 8, - "column": 10 - }, - "end": { - "line": 8, - "column": 12 - } - }, + "start":73,"end":75,"loc":{"start":{"line":8,"column":10},"end":{"line":8,"column":12}}, "body": [] } }, "operator": "/", "right": { "type": "Identifier", - "start": 78, - "end": 81, - "loc": { - "start": { - "line": 9, - "column": 2 - }, - "end": { - "line": 9, - "column": 5 - }, - "identifierName": "foo" - }, + "start":78,"end":81,"loc":{"start":{"line":9,"column":2},"end":{"line":9,"column":5},"identifierName":"foo"}, "name": "foo" } }, "operator": "/", "right": { "type": "Identifier", - "start": 84, - "end": 85, - "loc": { - "start": { - "line": 9, - "column": 8 - }, - "end": { - "line": 9, - "column": 9 - }, - "identifierName": "g" - }, + "start":84,"end":85,"loc":{"start":{"line":9,"column":8},"end":{"line":9,"column":9},"identifierName":"g"}, "name": "g" } } diff --git a/packages/babel-parser/test/fixtures/es2015/class/extends-strict/options.json b/packages/babel-parser/test/fixtures/es2015/class/extends-strict/options.json deleted file mode 100644 index 09a1c52e4354..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/class/extends-strict/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "'with' in strict mode (2:2)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/class/extends-strict/output.json b/packages/babel-parser/test/fixtures/es2015/class/extends-strict/output.json new file mode 100644 index 000000000000..5b9c55e234a8 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/class/extends-strict/output.json @@ -0,0 +1,80 @@ +{ + "type": "File", + "start":0,"end":64,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":7}}, + "errors": [ + "SyntaxError: 'with' in strict mode (2:2)" + ], + "program": { + "type": "Program", + "start":0,"end":64,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":7}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start":0,"end":64,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":7}}, + "id": { + "type": "Identifier", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"C"}, + "name": "C" + }, + "superClass": { + "type": "CallExpression", + "start":17,"end":60,"loc":{"start":{"line":1,"column":17},"end":{"line":4,"column":3}}, + "callee": { + "type": "FunctionExpression", + "start":17,"end":58,"loc":{"start":{"line":1,"column":17},"end":{"line":4,"column":1}}, + "id": { + "type": "Identifier", + "start":26,"end":27,"loc":{"start":{"line":1,"column":26},"end":{"line":1,"column":27},"identifierName":"B"}, + "name": "B" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":30,"end":58,"loc":{"start":{"line":1,"column":30},"end":{"line":4,"column":1}}, + "body": [ + { + "type": "WithStatement", + "start":34,"end":44,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":12}}, + "object": { + "type": "ObjectExpression", + "start":40,"end":42,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":10}}, + "properties": [] + }, + "body": { + "type": "EmptyStatement", + "start":43,"end":44,"loc":{"start":{"line":2,"column":11},"end":{"line":2,"column":12}} + } + }, + { + "type": "ReturnStatement", + "start":47,"end":56,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":11}}, + "argument": { + "type": "Identifier", + "start":54,"end":55,"loc":{"start":{"line":3,"column":9},"end":{"line":3,"column":10},"identifierName":"B"}, + "name": "B" + } + } + ], + "directives": [] + } + }, + "arguments": [], + "extra": { + "parenthesized": true, + "parenStart": 16 + } + }, + "body": { + "type": "ClassBody", + "start":62,"end":64,"loc":{"start":{"line":4,"column":5},"end":{"line":4,"column":7}}, + "body": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/class/invalid-escape-get/options.json b/packages/babel-parser/test/fixtures/es2015/class/invalid-escape-get/options.json index 1e730e170733..d5583f7bc5ba 100644 --- a/packages/babel-parser/test/fixtures/es2015/class/invalid-escape-get/options.json +++ b/packages/babel-parser/test/fixtures/es2015/class/invalid-escape-get/options.json @@ -1,3 +1,3 @@ { "throws": "Unexpected token (1:19)" -} \ No newline at end of file +} diff --git a/packages/babel-parser/test/fixtures/es2015/class/invalid-escape-set/options.json b/packages/babel-parser/test/fixtures/es2015/class/invalid-escape-set/options.json index 1e730e170733..d5583f7bc5ba 100644 --- a/packages/babel-parser/test/fixtures/es2015/class/invalid-escape-set/options.json +++ b/packages/babel-parser/test/fixtures/es2015/class/invalid-escape-set/options.json @@ -1,3 +1,3 @@ { "throws": "Unexpected token (1:19)" -} \ No newline at end of file +} diff --git a/packages/babel-parser/test/fixtures/es2015/class/invalid-escape-static/options.json b/packages/babel-parser/test/fixtures/es2015/class/invalid-escape-static/options.json index b23f881870cf..a015cd4108e6 100644 --- a/packages/babel-parser/test/fixtures/es2015/class/invalid-escape-static/options.json +++ b/packages/babel-parser/test/fixtures/es2015/class/invalid-escape-static/options.json @@ -1,3 +1,3 @@ { "throws": "Unexpected token (1:22)" -} \ No newline at end of file +} diff --git a/packages/babel-parser/test/fixtures/es2015/computed-properties/call-expression/output.json b/packages/babel-parser/test/fixtures/es2015/computed-properties/call-expression/output.json index 8f7759b25af0..2e79028e2853 100644 --- a/packages/babel-parser/test/fixtures/es2015/computed-properties/call-expression/output.json +++ b/packages/babel-parser/test/fixtures/es2015/computed-properties/call-expression/output.json @@ -1,140 +1,39 @@ { "type": "File", - "start": 0, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 2 - } - }, + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":2}}, "program": { "type": "Program", - "start": 0, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 2 - } - }, + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":2}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 2 - } - }, + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":2}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":4,"end":27,"loc":{"start":{"line":1,"column":4},"end":{"line":3,"column":1}}, "id": { "type": "Identifier", - "start": 4, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "foo" - }, + "start":4,"end":7,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":7},"identifierName":"foo"}, "name": "foo" }, "init": { "type": "ObjectExpression", - "start": 10, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":10,"end":27,"loc":{"start":{"line":1,"column":10},"end":{"line":3,"column":1}}, "properties": [ { "type": "ObjectProperty", - "start": 14, - "end": 25, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 13 - } - }, + "start":14,"end":25,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":13}}, "method": false, "computed": true, "key": { "type": "CallExpression", - "start": 15, - "end": 20, - "loc": { - "start": { - "line": 2, - "column": 3 - }, - "end": { - "line": 2, - "column": 8 - } - }, + "start":15,"end":20,"loc":{"start":{"line":2,"column":3},"end":{"line":2,"column":8}}, "callee": { "type": "Identifier", - "start": 15, - "end": 18, - "loc": { - "start": { - "line": 2, - "column": 3 - }, - "end": { - "line": 2, - "column": 6 - }, - "identifierName": "bar" - }, + "start":15,"end":18,"loc":{"start":{"line":2,"column":3},"end":{"line":2,"column":6},"identifierName":"bar"}, "name": "bar" }, "arguments": [] @@ -142,18 +41,7 @@ "shorthand": false, "value": { "type": "StringLiteral", - "start": 23, - "end": 25, - "loc": { - "start": { - "line": 2, - "column": 11 - }, - "end": { - "line": 2, - "column": 13 - } - }, + "start":23,"end":25,"loc":{"start":{"line":2,"column":11},"end":{"line":2,"column":13}}, "extra": { "rawValue": "", "raw": "\"\"" diff --git a/packages/babel-parser/test/fixtures/es2015/destructuring/binding-this/input.js b/packages/babel-parser/test/fixtures/es2015/destructuring/binding-this/input.js index 11cebfa18894..42403a50ea26 100644 --- a/packages/babel-parser/test/fixtures/es2015/destructuring/binding-this/input.js +++ b/packages/babel-parser/test/fixtures/es2015/destructuring/binding-this/input.js @@ -1 +1 @@ -var { this }; +var { this } = {}; diff --git a/packages/babel-parser/test/fixtures/es2015/destructuring/binding-this/options.json b/packages/babel-parser/test/fixtures/es2015/destructuring/binding-this/options.json deleted file mode 100644 index 1b54b61689e7..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/destructuring/binding-this/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected keyword 'this' (1:6)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/destructuring/binding-this/output.json b/packages/babel-parser/test/fixtures/es2015/destructuring/binding-this/output.json new file mode 100644 index 000000000000..0c6596304a0d --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/destructuring/binding-this/output.json @@ -0,0 +1,58 @@ +{ + "type": "File", + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, + "errors": [ + "SyntaxError: Unexpected keyword 'this' (1:6)" + ], + "program": { + "type": "Program", + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":4,"end":17,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":17}}, + "id": { + "type": "ObjectPattern", + "start":4,"end":12,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":12}}, + "properties": [ + { + "type": "ObjectProperty", + "start":6,"end":10,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":10}}, + "method": false, + "key": { + "type": "Identifier", + "start":6,"end":10,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":10},"identifierName":"this"}, + "name": "this" + }, + "computed": false, + "shorthand": true, + "value": { + "type": "Identifier", + "start":6,"end":10,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":10},"identifierName":"this"}, + "name": "this" + }, + "extra": { + "shorthand": true + } + } + ] + }, + "init": { + "type": "ObjectExpression", + "start":15,"end":17,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":17}}, + "properties": [] + } + } + ], + "kind": "var" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/destructuring/duplicate-proto-1/input.js b/packages/babel-parser/test/fixtures/es2015/destructuring/duplicate-proto-1/input.js new file mode 100644 index 000000000000..494000aa3793 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/destructuring/duplicate-proto-1/input.js @@ -0,0 +1 @@ +({ __proto__: x, __proto__: y } = {}); diff --git a/packages/babel-parser/test/fixtures/es2015/destructuring/duplicate-proto-1/output.json b/packages/babel-parser/test/fixtures/es2015/destructuring/duplicate-proto-1/output.json new file mode 100644 index 000000000000..0a076f1f941d --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/destructuring/duplicate-proto-1/output.json @@ -0,0 +1,71 @@ +{ + "type": "File", + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":38}}, + "program": { + "type": "Program", + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":38}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":38}}, + "expression": { + "type": "AssignmentExpression", + "start":1,"end":36,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":36}}, + "operator": "=", + "left": { + "type": "ObjectPattern", + "start":1,"end":31,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":31}}, + "properties": [ + { + "type": "ObjectProperty", + "start":3,"end":15,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":15}}, + "method": false, + "key": { + "type": "Identifier", + "start":3,"end":12,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":12},"identifierName":"__proto__"}, + "name": "__proto__" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "Identifier", + "start":14,"end":15,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":15},"identifierName":"x"}, + "name": "x" + } + }, + { + "type": "ObjectProperty", + "start":17,"end":29,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":29}}, + "method": false, + "key": { + "type": "Identifier", + "start":17,"end":26,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":26},"identifierName":"__proto__"}, + "name": "__proto__" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "Identifier", + "start":28,"end":29,"loc":{"start":{"line":1,"column":28},"end":{"line":1,"column":29},"identifierName":"y"}, + "name": "y" + } + } + ] + }, + "right": { + "type": "ObjectExpression", + "start":34,"end":36,"loc":{"start":{"line":1,"column":34},"end":{"line":1,"column":36}}, + "properties": [] + }, + "extra": { + "parenthesized": true, + "parenStart": 0 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/destructuring/duplicate-proto-2/input.js b/packages/babel-parser/test/fixtures/es2015/destructuring/duplicate-proto-2/input.js new file mode 100644 index 000000000000..73d46e315061 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/destructuring/duplicate-proto-2/input.js @@ -0,0 +1 @@ +([{ __proto__: x, __proto__: y }] = [{}]); diff --git a/packages/babel-parser/test/fixtures/es2015/destructuring/duplicate-proto-2/output.json b/packages/babel-parser/test/fixtures/es2015/destructuring/duplicate-proto-2/output.json new file mode 100644 index 000000000000..7b4bfce9c84d --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/destructuring/duplicate-proto-2/output.json @@ -0,0 +1,83 @@ +{ + "type": "File", + "start":0,"end":42,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":42}}, + "program": { + "type": "Program", + "start":0,"end":42,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":42}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":42,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":42}}, + "expression": { + "type": "AssignmentExpression", + "start":1,"end":40,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":40}}, + "operator": "=", + "left": { + "type": "ArrayPattern", + "start":1,"end":33,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":33}}, + "elements": [ + { + "type": "ObjectPattern", + "start":2,"end":32,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":32}}, + "properties": [ + { + "type": "ObjectProperty", + "start":4,"end":16,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":16}}, + "method": false, + "key": { + "type": "Identifier", + "start":4,"end":13,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":13},"identifierName":"__proto__"}, + "name": "__proto__" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "Identifier", + "start":15,"end":16,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":16},"identifierName":"x"}, + "name": "x" + } + }, + { + "type": "ObjectProperty", + "start":18,"end":30,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":30}}, + "method": false, + "key": { + "type": "Identifier", + "start":18,"end":27,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":27},"identifierName":"__proto__"}, + "name": "__proto__" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "Identifier", + "start":29,"end":30,"loc":{"start":{"line":1,"column":29},"end":{"line":1,"column":30},"identifierName":"y"}, + "name": "y" + } + } + ] + } + ] + }, + "right": { + "type": "ArrayExpression", + "start":36,"end":40,"loc":{"start":{"line":1,"column":36},"end":{"line":1,"column":40}}, + "elements": [ + { + "type": "ObjectExpression", + "start":37,"end":39,"loc":{"start":{"line":1,"column":37},"end":{"line":1,"column":39}}, + "properties": [] + } + ] + }, + "extra": { + "parenthesized": true, + "parenStart": 0 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/destructuring/duplicate-proto-3/input.js b/packages/babel-parser/test/fixtures/es2015/destructuring/duplicate-proto-3/input.js new file mode 100644 index 000000000000..478c33774b46 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/destructuring/duplicate-proto-3/input.js @@ -0,0 +1 @@ +({ __proto__: x, __proto__: y }) => {}; diff --git a/packages/babel-parser/test/fixtures/es2015/destructuring/duplicate-proto-3/output.json b/packages/babel-parser/test/fixtures/es2015/destructuring/duplicate-proto-3/output.json new file mode 100644 index 000000000000..405f42004ab4 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/destructuring/duplicate-proto-3/output.json @@ -0,0 +1,72 @@ +{ + "type": "File", + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":39}}, + "program": { + "type": "Program", + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":39}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":39}}, + "expression": { + "type": "ArrowFunctionExpression", + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":38}}, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "ObjectPattern", + "start":1,"end":31,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":31}}, + "properties": [ + { + "type": "ObjectProperty", + "start":3,"end":15,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":15}}, + "method": false, + "key": { + "type": "Identifier", + "start":3,"end":12,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":12},"identifierName":"__proto__"}, + "name": "__proto__" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "Identifier", + "start":14,"end":15,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":15},"identifierName":"x"}, + "name": "x" + } + }, + { + "type": "ObjectProperty", + "start":17,"end":29,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":29}}, + "method": false, + "key": { + "type": "Identifier", + "start":17,"end":26,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":26},"identifierName":"__proto__"}, + "name": "__proto__" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "Identifier", + "start":28,"end":29,"loc":{"start":{"line":1,"column":28},"end":{"line":1,"column":29},"identifierName":"y"}, + "name": "y" + } + } + ] + } + ], + "body": { + "type": "BlockStatement", + "start":36,"end":38,"loc":{"start":{"line":1,"column":36},"end":{"line":1,"column":38}}, + "body": [], + "directives": [] + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/destructuring/duplicate-proto-4/input.js b/packages/babel-parser/test/fixtures/es2015/destructuring/duplicate-proto-4/input.js new file mode 100644 index 000000000000..4a4a220727ab --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/destructuring/duplicate-proto-4/input.js @@ -0,0 +1 @@ +({ __proto__: x, __proto__: y, __proto__: z }) => {}; diff --git a/packages/babel-parser/test/fixtures/es2015/destructuring/duplicate-proto-4/output.json b/packages/babel-parser/test/fixtures/es2015/destructuring/duplicate-proto-4/output.json new file mode 100644 index 000000000000..ef78a8daa03e --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/destructuring/duplicate-proto-4/output.json @@ -0,0 +1,89 @@ +{ + "type": "File", + "start":0,"end":53,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":53}}, + "program": { + "type": "Program", + "start":0,"end":53,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":53}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":53,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":53}}, + "expression": { + "type": "ArrowFunctionExpression", + "start":0,"end":52,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":52}}, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "ObjectPattern", + "start":1,"end":45,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":45}}, + "properties": [ + { + "type": "ObjectProperty", + "start":3,"end":15,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":15}}, + "method": false, + "key": { + "type": "Identifier", + "start":3,"end":12,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":12},"identifierName":"__proto__"}, + "name": "__proto__" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "Identifier", + "start":14,"end":15,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":15},"identifierName":"x"}, + "name": "x" + } + }, + { + "type": "ObjectProperty", + "start":17,"end":29,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":29}}, + "method": false, + "key": { + "type": "Identifier", + "start":17,"end":26,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":26},"identifierName":"__proto__"}, + "name": "__proto__" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "Identifier", + "start":28,"end":29,"loc":{"start":{"line":1,"column":28},"end":{"line":1,"column":29},"identifierName":"y"}, + "name": "y" + } + }, + { + "type": "ObjectProperty", + "start":31,"end":43,"loc":{"start":{"line":1,"column":31},"end":{"line":1,"column":43}}, + "method": false, + "key": { + "type": "Identifier", + "start":31,"end":40,"loc":{"start":{"line":1,"column":31},"end":{"line":1,"column":40},"identifierName":"__proto__"}, + "name": "__proto__" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "Identifier", + "start":42,"end":43,"loc":{"start":{"line":1,"column":42},"end":{"line":1,"column":43},"identifierName":"z"}, + "name": "z" + } + } + ] + } + ], + "body": { + "type": "BlockStatement", + "start":50,"end":52,"loc":{"start":{"line":1,"column":50},"end":{"line":1,"column":52}}, + "body": [], + "directives": [] + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/destructuring/error-operator-for-default/options.json b/packages/babel-parser/test/fixtures/es2015/destructuring/error-operator-for-default/options.json deleted file mode 100644 index f52857170baa..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/destructuring/error-operator-for-default/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Only '=' operator can be used for specifying default value. (1:3)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/destructuring/error-operator-for-default/output.json b/packages/babel-parser/test/fixtures/es2015/destructuring/error-operator-for-default/output.json new file mode 100644 index 000000000000..9c735221c5fd --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/destructuring/error-operator-for-default/output.json @@ -0,0 +1,54 @@ +{ + "type": "File", + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, + "errors": [ + "SyntaxError: Only '=' operator can be used for specifying default value. (1:3)" + ], + "program": { + "type": "Program", + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, + "expression": { + "type": "AssignmentExpression", + "start":1,"end":13,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":13}}, + "operator": "=", + "left": { + "type": "ArrayPattern", + "start":1,"end":9,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":9}}, + "elements": [ + { + "type": "AssignmentPattern", + "start":2,"end":8,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":8}}, + "left": { + "type": "Identifier", + "start":2,"end":3,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":3},"identifierName":"a"}, + "name": "a" + }, + "right": { + "type": "Identifier", + "start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8},"identifierName":"a"}, + "name": "a" + } + } + ] + }, + "right": { + "type": "Identifier", + "start":12,"end":13,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":13},"identifierName":"a"}, + "name": "a" + }, + "extra": { + "parenthesized": true, + "parenStart": 0 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/destructuring/parenthesized-lhs-array/options.json b/packages/babel-parser/test/fixtures/es2015/destructuring/parenthesized-lhs-array/options.json deleted file mode 100644 index dfcad1b5cbf0..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/destructuring/parenthesized-lhs-array/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "You're trying to assign to a parenthesized expression, eg. instead of `([a]) = 0` use `([a] = 0)` (1:1)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/destructuring/parenthesized-lhs-array/output.json b/packages/babel-parser/test/fixtures/es2015/destructuring/parenthesized-lhs-array/output.json new file mode 100644 index 000000000000..f0bbee72ab6c --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/destructuring/parenthesized-lhs-array/output.json @@ -0,0 +1,49 @@ +{ + "type": "File", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "errors": [ + "SyntaxError: Invalid parenthesized assignment pattern (1:1)" + ], + "program": { + "type": "Program", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "expression": { + "type": "AssignmentExpression", + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "operator": "=", + "left": { + "type": "ArrayPattern", + "start":1,"end":4,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":4}}, + "elements": [ + { + "type": "Identifier", + "start":2,"end":3,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":3},"identifierName":"a"}, + "name": "a" + } + ], + "extra": { + "parenthesized": true, + "parenStart": 0 + } + }, + "right": { + "type": "NumericLiteral", + "start":8,"end":9,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":9}}, + "extra": { + "rawValue": 2, + "raw": "2" + }, + "value": 2 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/destructuring/parenthesized-lhs-object/options.json b/packages/babel-parser/test/fixtures/es2015/destructuring/parenthesized-lhs-object/options.json deleted file mode 100644 index d0fb48924093..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/destructuring/parenthesized-lhs-object/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "You're trying to assign to a parenthesized expression, eg. instead of `({a}) = 0` use `({a} = 0)` (1:1)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/destructuring/parenthesized-lhs-object/output.json b/packages/babel-parser/test/fixtures/es2015/destructuring/parenthesized-lhs-object/output.json new file mode 100644 index 000000000000..2519d3595ff6 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/destructuring/parenthesized-lhs-object/output.json @@ -0,0 +1,64 @@ +{ + "type": "File", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "errors": [ + "SyntaxError: Invalid parenthesized assignment pattern (1:1)" + ], + "program": { + "type": "Program", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "expression": { + "type": "AssignmentExpression", + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "operator": "=", + "left": { + "type": "ObjectPattern", + "start":1,"end":4,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":4}}, + "properties": [ + { + "type": "ObjectProperty", + "start":2,"end":3,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":3}}, + "method": false, + "key": { + "type": "Identifier", + "start":2,"end":3,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":3},"identifierName":"a"}, + "name": "a" + }, + "computed": false, + "shorthand": true, + "value": { + "type": "Identifier", + "start":2,"end":3,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":3},"identifierName":"a"}, + "name": "a" + }, + "extra": { + "shorthand": true + } + } + ], + "extra": { + "parenthesized": true, + "parenStart": 0 + } + }, + "right": { + "type": "NumericLiteral", + "start":8,"end":9,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":9}}, + "extra": { + "rawValue": 2, + "raw": "2" + }, + "value": 2 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/duplicate-proto/in-new-expression/input.js b/packages/babel-parser/test/fixtures/es2015/duplicate-proto/in-new-expression/input.js new file mode 100644 index 000000000000..900d3841bc6c --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/duplicate-proto/in-new-expression/input.js @@ -0,0 +1 @@ +new {__proto__: Number, __proto__: Number}.__proto__; diff --git a/packages/babel-parser/test/fixtures/es2015/duplicate-proto/in-new-expression/output.json b/packages/babel-parser/test/fixtures/es2015/duplicate-proto/in-new-expression/output.json new file mode 100644 index 000000000000..41eade104e2b --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/duplicate-proto/in-new-expression/output.json @@ -0,0 +1,75 @@ +{ + "type": "File", + "start":0,"end":53,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":53}}, + "errors": [ + "SyntaxError: Redefinition of __proto__ property (1:24)" + ], + "program": { + "type": "Program", + "start":0,"end":53,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":53}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":53,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":53}}, + "expression": { + "type": "NewExpression", + "start":0,"end":52,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":52}}, + "callee": { + "type": "MemberExpression", + "start":4,"end":52,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":52}}, + "object": { + "type": "ObjectExpression", + "start":4,"end":42,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":42}}, + "properties": [ + { + "type": "ObjectProperty", + "start":5,"end":22,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":22}}, + "method": false, + "key": { + "type": "Identifier", + "start":5,"end":14,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":14},"identifierName":"__proto__"}, + "name": "__proto__" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "Identifier", + "start":16,"end":22,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":22},"identifierName":"Number"}, + "name": "Number" + } + }, + { + "type": "ObjectProperty", + "start":24,"end":41,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":41}}, + "method": false, + "key": { + "type": "Identifier", + "start":24,"end":33,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":33},"identifierName":"__proto__"}, + "name": "__proto__" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "Identifier", + "start":35,"end":41,"loc":{"start":{"line":1,"column":35},"end":{"line":1,"column":41},"identifierName":"Number"}, + "name": "Number" + } + } + ] + }, + "property": { + "type": "Identifier", + "start":43,"end":52,"loc":{"start":{"line":1,"column":43},"end":{"line":1,"column":52},"identifierName":"__proto__"}, + "name": "__proto__" + }, + "computed": false + }, + "arguments": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/for-in/bare-initializer/options.json b/packages/babel-parser/test/fixtures/es2015/for-in/bare-initializer/options.json deleted file mode 100644 index f5710cd7a9c9..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/for-in/bare-initializer/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid left-hand side in for-loop (2:5)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/for-in/bare-initializer/output.json b/packages/babel-parser/test/fixtures/es2015/for-in/bare-initializer/output.json new file mode 100644 index 000000000000..838c1aea7fd3 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/for-in/bare-initializer/output.json @@ -0,0 +1,64 @@ +{ + "type": "File", + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":18}}, + "errors": [ + "SyntaxError: Invalid left-hand side in for-loop (2:5)" + ], + "program": { + "type": "Program", + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":18}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5}}, + "id": { + "type": "Identifier", + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"a"}, + "name": "a" + }, + "init": null + } + ], + "kind": "var" + }, + { + "type": "ForInStatement", + "start":7,"end":25,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":18}}, + "left": { + "type": "AssignmentPattern", + "start":12,"end":17,"loc":{"start":{"line":2,"column":5},"end":{"line":2,"column":10}}, + "left": { + "type": "Identifier", + "start":12,"end":13,"loc":{"start":{"line":2,"column":5},"end":{"line":2,"column":6},"identifierName":"a"}, + "name": "a" + }, + "right": { + "type": "NumericLiteral", + "start":16,"end":17,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":10}}, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + }, + "right": { + "type": "ObjectExpression", + "start":21,"end":23,"loc":{"start":{"line":2,"column":14},"end":{"line":2,"column":16}}, + "properties": [] + }, + "body": { + "type": "EmptyStatement", + "start":24,"end":25,"loc":{"start":{"line":2,"column":17},"end":{"line":2,"column":18}} + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/for-in/const-initializer/options.json b/packages/babel-parser/test/fixtures/es2015/for-in/const-initializer/options.json deleted file mode 100644 index dd3b73e5d533..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/for-in/const-initializer/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "for-in loop variable declaration may not have an initializer (1:5)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/for-in/const-initializer/output.json b/packages/babel-parser/test/fixtures/es2015/for-in/const-initializer/output.json new file mode 100644 index 000000000000..4e70874d2735 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/for-in/const-initializer/output.json @@ -0,0 +1,54 @@ +{ + "type": "File", + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, + "errors": [ + "SyntaxError: for-in loop variable declaration may not have an initializer (1:5)" + ], + "program": { + "type": "Program", + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ForInStatement", + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, + "left": { + "type": "VariableDeclaration", + "start":5,"end":16,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":16}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":11,"end":16,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":16}}, + "id": { + "type": "Identifier", + "start":11,"end":12,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":12},"identifierName":"a"}, + "name": "a" + }, + "init": { + "type": "NumericLiteral", + "start":15,"end":16,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":16}}, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + } + ], + "kind": "const" + }, + "right": { + "type": "ObjectExpression", + "start":20,"end":22,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":22}}, + "properties": [] + }, + "body": { + "type": "EmptyStatement", + "start":23,"end":24,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":24}} + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/for-in/let-initializer/options.json b/packages/babel-parser/test/fixtures/es2015/for-in/let-initializer/options.json deleted file mode 100644 index dd3b73e5d533..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/for-in/let-initializer/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "for-in loop variable declaration may not have an initializer (1:5)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/for-in/let-initializer/output.json b/packages/babel-parser/test/fixtures/es2015/for-in/let-initializer/output.json new file mode 100644 index 000000000000..c3c20c0a10f3 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/for-in/let-initializer/output.json @@ -0,0 +1,54 @@ +{ + "type": "File", + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, + "errors": [ + "SyntaxError: for-in loop variable declaration may not have an initializer (1:5)" + ], + "program": { + "type": "Program", + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ForInStatement", + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, + "left": { + "type": "VariableDeclaration", + "start":5,"end":14,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":14}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":9,"end":14,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":14}}, + "id": { + "type": "Identifier", + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"a"}, + "name": "a" + }, + "init": { + "type": "NumericLiteral", + "start":13,"end":14,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":14}}, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + } + ], + "kind": "let" + }, + "right": { + "type": "ObjectExpression", + "start":18,"end":20,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":20}}, + "properties": [] + }, + "body": { + "type": "EmptyStatement", + "start":21,"end":22,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":22}} + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/for-in/nonstrict-initializer/output.json b/packages/babel-parser/test/fixtures/es2015/for-in/nonstrict-initializer/output.json index 155cc10f02a0..b97f056fd199 100644 --- a/packages/babel-parser/test/fixtures/es2015/for-in/nonstrict-initializer/output.json +++ b/packages/babel-parser/test/fixtures/es2015/for-in/nonstrict-initializer/output.json @@ -1,94 +1,27 @@ { "type": "File", - "start": 0, - "end": 144, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 6, - "column": 3 - } - }, + "start":0,"end":144,"loc":{"start":{"line":1,"column":0},"end":{"line":6,"column":3}}, "program": { "type": "Program", - "start": 0, - "end": 144, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 6, - "column": 3 - } - }, + "start":0,"end":144,"loc":{"start":{"line":1,"column":0},"end":{"line":6,"column":3}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 2, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":2,"end":18,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":18}}, "declarations": [ { "type": "VariableDeclarator", - "start": 6, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":6,"end":17,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":17}}, "id": { "type": "Identifier", - "start": 6, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 13 - }, - "identifierName": "effects" - }, + "start":6,"end":13,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":13},"identifierName":"effects"}, "name": "effects" }, "init": { "type": "NumericLiteral", - "start": 16, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":16,"end":17,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":17}}, "extra": { "rawValue": 0, "raw": "0" @@ -101,64 +34,19 @@ }, { "type": "VariableDeclaration", - "start": 21, - "end": 40, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 21 - } - }, + "start":21,"end":40,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":21}}, "declarations": [ { "type": "VariableDeclarator", - "start": 25, - "end": 39, - "loc": { - "start": { - "line": 2, - "column": 6 - }, - "end": { - "line": 2, - "column": 20 - } - }, + "start":25,"end":39,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":20}}, "id": { "type": "Identifier", - "start": 25, - "end": 35, - "loc": { - "start": { - "line": 2, - "column": 6 - }, - "end": { - "line": 2, - "column": 16 - }, - "identifierName": "iterations" - }, + "start":25,"end":35,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":16},"identifierName":"iterations"}, "name": "iterations" }, "init": { "type": "NumericLiteral", - "start": 38, - "end": 39, - "loc": { - "start": { - "line": 2, - "column": 19 - }, - "end": { - "line": 2, - "column": 20 - } - }, + "start":38,"end":39,"loc":{"start":{"line":2,"column":19},"end":{"line":2,"column":20}}, "extra": { "rawValue": 0, "raw": "0" @@ -171,48 +59,14 @@ }, { "type": "VariableDeclaration", - "start": 43, - "end": 54, - "loc": { - "start": { - "line": 3, - "column": 2 - }, - "end": { - "line": 3, - "column": 13 - } - }, + "start":43,"end":54,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":13}}, "declarations": [ { "type": "VariableDeclarator", - "start": 47, - "end": 53, - "loc": { - "start": { - "line": 3, - "column": 6 - }, - "end": { - "line": 3, - "column": 12 - } - }, + "start":47,"end":53,"loc":{"start":{"line":3,"column":6},"end":{"line":3,"column":12}}, "id": { "type": "Identifier", - "start": 47, - "end": 53, - "loc": { - "start": { - "line": 3, - "column": 6 - }, - "end": { - "line": 3, - "column": 12 - }, - "identifierName": "stored" - }, + "start":47,"end":53,"loc":{"start":{"line":3,"column":6},"end":{"line":3,"column":12},"identifierName":"stored"}, "name": "stored" }, "init": null @@ -222,143 +76,42 @@ }, { "type": "ForInStatement", - "start": 57, - "end": 144, - "loc": { - "start": { - "line": 4, - "column": 2 - }, - "end": { - "line": 6, - "column": 3 - } - }, + "start":57,"end":144,"loc":{"start":{"line":4,"column":2},"end":{"line":6,"column":3}}, "left": { "type": "VariableDeclaration", - "start": 62, - "end": 85, - "loc": { - "start": { - "line": 4, - "column": 7 - }, - "end": { - "line": 4, - "column": 30 - } - }, + "start":62,"end":85,"loc":{"start":{"line":4,"column":7},"end":{"line":4,"column":30}}, "declarations": [ { "type": "VariableDeclarator", - "start": 66, - "end": 85, - "loc": { - "start": { - "line": 4, - "column": 11 - }, - "end": { - "line": 4, - "column": 30 - } - }, + "start":66,"end":85,"loc":{"start":{"line":4,"column":11},"end":{"line":4,"column":30}}, "id": { "type": "Identifier", - "start": 66, - "end": 67, - "loc": { - "start": { - "line": 4, - "column": 11 - }, - "end": { - "line": 4, - "column": 12 - }, - "identifierName": "a" - }, + "start":66,"end":67,"loc":{"start":{"line":4,"column":11},"end":{"line":4,"column":12},"identifierName":"a"}, "name": "a" }, "init": { "type": "SequenceExpression", - "start": 71, - "end": 84, - "loc": { - "start": { - "line": 4, - "column": 16 - }, - "end": { - "line": 4, - "column": 29 - } - }, + "start":71,"end":84,"loc":{"start":{"line":4,"column":16},"end":{"line":4,"column":29}}, "expressions": [ { "type": "UpdateExpression", - "start": 71, - "end": 80, - "loc": { - "start": { - "line": 4, - "column": 16 - }, - "end": { - "line": 4, - "column": 25 - } - }, + "start":71,"end":80,"loc":{"start":{"line":4,"column":16},"end":{"line":4,"column":25}}, "operator": "++", "prefix": true, "argument": { "type": "Identifier", - "start": 73, - "end": 80, - "loc": { - "start": { - "line": 4, - "column": 18 - }, - "end": { - "line": 4, - "column": 25 - }, - "identifierName": "effects" - }, + "start":73,"end":80,"loc":{"start":{"line":4,"column":18},"end":{"line":4,"column":25},"identifierName":"effects"}, "name": "effects" } }, { "type": "UnaryExpression", - "start": 82, - "end": 84, - "loc": { - "start": { - "line": 4, - "column": 27 - }, - "end": { - "line": 4, - "column": 29 - } - }, + "start":82,"end":84,"loc":{"start":{"line":4,"column":27},"end":{"line":4,"column":29}}, "operator": "-", "prefix": true, "argument": { "type": "NumericLiteral", - "start": 83, - "end": 84, - "loc": { - "start": { - "line": 4, - "column": 28 - }, - "end": { - "line": 4, - "column": 29 - } - }, + "start":83,"end":84,"loc":{"start":{"line":4,"column":28},"end":{"line":4,"column":29}}, "extra": { "rawValue": 1, "raw": "1" @@ -378,132 +131,41 @@ }, "right": { "type": "SequenceExpression", - "start": 89, - "end": 119, - "loc": { - "start": { - "line": 4, - "column": 34 - }, - "end": { - "line": 4, - "column": 64 - } - }, + "start":89,"end":119,"loc":{"start":{"line":4,"column":34},"end":{"line":4,"column":64}}, "expressions": [ { "type": "AssignmentExpression", - "start": 89, - "end": 99, - "loc": { - "start": { - "line": 4, - "column": 34 - }, - "end": { - "line": 4, - "column": 44 - } - }, + "start":89,"end":99,"loc":{"start":{"line":4,"column":34},"end":{"line":4,"column":44}}, "operator": "=", "left": { "type": "Identifier", - "start": 89, - "end": 95, - "loc": { - "start": { - "line": 4, - "column": 34 - }, - "end": { - "line": 4, - "column": 40 - }, - "identifierName": "stored" - }, + "start":89,"end":95,"loc":{"start":{"line":4,"column":34},"end":{"line":4,"column":40},"identifierName":"stored"}, "name": "stored" }, "right": { "type": "Identifier", - "start": 98, - "end": 99, - "loc": { - "start": { - "line": 4, - "column": 43 - }, - "end": { - "line": 4, - "column": 44 - }, - "identifierName": "a" - }, + "start":98,"end":99,"loc":{"start":{"line":4,"column":43},"end":{"line":4,"column":44},"identifierName":"a"}, "name": "a" } }, { "type": "ObjectExpression", - "start": 101, - "end": 119, - "loc": { - "start": { - "line": 4, - "column": 46 - }, - "end": { - "line": 4, - "column": 64 - } - }, + "start":101,"end":119,"loc":{"start":{"line":4,"column":46},"end":{"line":4,"column":64}}, "properties": [ { "type": "ObjectProperty", - "start": 102, - "end": 106, - "loc": { - "start": { - "line": 4, - "column": 47 - }, - "end": { - "line": 4, - "column": 51 - } - }, + "start":102,"end":106,"loc":{"start":{"line":4,"column":47},"end":{"line":4,"column":51}}, "method": false, "key": { "type": "Identifier", - "start": 102, - "end": 103, - "loc": { - "start": { - "line": 4, - "column": 47 - }, - "end": { - "line": 4, - "column": 48 - }, - "identifierName": "a" - }, + "start":102,"end":103,"loc":{"start":{"line":4,"column":47},"end":{"line":4,"column":48},"identifierName":"a"}, "name": "a" }, "computed": false, "shorthand": false, "value": { "type": "NumericLiteral", - "start": 105, - "end": 106, - "loc": { - "start": { - "line": 4, - "column": 50 - }, - "end": { - "line": 4, - "column": 51 - } - }, + "start":105,"end":106,"loc":{"start":{"line":4,"column":50},"end":{"line":4,"column":51}}, "extra": { "rawValue": 0, "raw": "0" @@ -513,52 +175,18 @@ }, { "type": "ObjectProperty", - "start": 108, - "end": 112, - "loc": { - "start": { - "line": 4, - "column": 53 - }, - "end": { - "line": 4, - "column": 57 - } - }, + "start":108,"end":112,"loc":{"start":{"line":4,"column":53},"end":{"line":4,"column":57}}, "method": false, "key": { "type": "Identifier", - "start": 108, - "end": 109, - "loc": { - "start": { - "line": 4, - "column": 53 - }, - "end": { - "line": 4, - "column": 54 - }, - "identifierName": "b" - }, + "start":108,"end":109,"loc":{"start":{"line":4,"column":53},"end":{"line":4,"column":54},"identifierName":"b"}, "name": "b" }, "computed": false, "shorthand": false, "value": { "type": "NumericLiteral", - "start": 111, - "end": 112, - "loc": { - "start": { - "line": 4, - "column": 56 - }, - "end": { - "line": 4, - "column": 57 - } - }, + "start":111,"end":112,"loc":{"start":{"line":4,"column":56},"end":{"line":4,"column":57}}, "extra": { "rawValue": 1, "raw": "1" @@ -568,52 +196,18 @@ }, { "type": "ObjectProperty", - "start": 114, - "end": 118, - "loc": { - "start": { - "line": 4, - "column": 59 - }, - "end": { - "line": 4, - "column": 63 - } - }, + "start":114,"end":118,"loc":{"start":{"line":4,"column":59},"end":{"line":4,"column":63}}, "method": false, "key": { "type": "Identifier", - "start": 114, - "end": 115, - "loc": { - "start": { - "line": 4, - "column": 59 - }, - "end": { - "line": 4, - "column": 60 - }, - "identifierName": "c" - }, + "start":114,"end":115,"loc":{"start":{"line":4,"column":59},"end":{"line":4,"column":60},"identifierName":"c"}, "name": "c" }, "computed": false, "shorthand": false, "value": { "type": "NumericLiteral", - "start": 117, - "end": 118, - "loc": { - "start": { - "line": 4, - "column": 62 - }, - "end": { - "line": 4, - "column": 63 - } - }, + "start":117,"end":118,"loc":{"start":{"line":4,"column":62},"end":{"line":4,"column":63}}, "extra": { "rawValue": 2, "raw": "2" @@ -627,64 +221,19 @@ }, "body": { "type": "BlockStatement", - "start": 121, - "end": 144, - "loc": { - "start": { - "line": 4, - "column": 66 - }, - "end": { - "line": 6, - "column": 3 - } - }, + "start":121,"end":144,"loc":{"start":{"line":4,"column":66},"end":{"line":6,"column":3}}, "body": [ { "type": "ExpressionStatement", - "start": 127, - "end": 140, - "loc": { - "start": { - "line": 5, - "column": 4 - }, - "end": { - "line": 5, - "column": 17 - } - }, + "start":127,"end":140,"loc":{"start":{"line":5,"column":4},"end":{"line":5,"column":17}}, "expression": { "type": "UpdateExpression", - "start": 127, - "end": 139, - "loc": { - "start": { - "line": 5, - "column": 4 - }, - "end": { - "line": 5, - "column": 16 - } - }, + "start":127,"end":139,"loc":{"start":{"line":5,"column":4},"end":{"line":5,"column":16}}, "operator": "++", "prefix": true, "argument": { "type": "Identifier", - "start": 129, - "end": 139, - "loc": { - "start": { - "line": 5, - "column": 6 - }, - "end": { - "line": 5, - "column": 16 - }, - "identifierName": "iterations" - }, + "start":129,"end":139,"loc":{"start":{"line":5,"column":6},"end":{"line":5,"column":16},"identifierName":"iterations"}, "name": "iterations" } } diff --git a/packages/babel-parser/test/fixtures/es2015/for-in/strict-initializer/options.json b/packages/babel-parser/test/fixtures/es2015/for-in/strict-initializer/options.json deleted file mode 100644 index 0048427255c0..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/for-in/strict-initializer/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "for-in loop variable declaration may not have an initializer (2:5)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/for-in/strict-initializer/output.json b/packages/babel-parser/test/fixtures/es2015/for-in/strict-initializer/output.json new file mode 100644 index 000000000000..26b3ee955998 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/for-in/strict-initializer/output.json @@ -0,0 +1,68 @@ +{ + "type": "File", + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":22}}, + "errors": [ + "SyntaxError: for-in loop variable declaration may not have an initializer (2:5)" + ], + "program": { + "type": "Program", + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":22}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ForInStatement", + "start":14,"end":36,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":22}}, + "left": { + "type": "VariableDeclaration", + "start":19,"end":28,"loc":{"start":{"line":2,"column":5},"end":{"line":2,"column":14}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":23,"end":28,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":14}}, + "id": { + "type": "Identifier", + "start":23,"end":24,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":10},"identifierName":"a"}, + "name": "a" + }, + "init": { + "type": "NumericLiteral", + "start":27,"end":28,"loc":{"start":{"line":2,"column":13},"end":{"line":2,"column":14}}, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + } + ], + "kind": "var" + }, + "right": { + "type": "ObjectExpression", + "start":32,"end":34,"loc":{"start":{"line":2,"column":18},"end":{"line":2,"column":20}}, + "properties": [] + }, + "body": { + "type": "EmptyStatement", + "start":35,"end":36,"loc":{"start":{"line":2,"column":21},"end":{"line":2,"column":22}} + } + } + ], + "directives": [ + { + "type": "Directive", + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "value": { + "type": "DirectiveLiteral", + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/for-in/var-arraybindingpattern-initializer/options.json b/packages/babel-parser/test/fixtures/es2015/for-in/var-arraybindingpattern-initializer/options.json deleted file mode 100644 index dd3b73e5d533..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/for-in/var-arraybindingpattern-initializer/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "for-in loop variable declaration may not have an initializer (1:5)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/for-in/var-arraybindingpattern-initializer/output.json b/packages/babel-parser/test/fixtures/es2015/for-in/var-arraybindingpattern-initializer/output.json new file mode 100644 index 000000000000..32755b31ea17 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/for-in/var-arraybindingpattern-initializer/output.json @@ -0,0 +1,60 @@ +{ + "type": "File", + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, + "errors": [ + "SyntaxError: for-in loop variable declaration may not have an initializer (1:5)" + ], + "program": { + "type": "Program", + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ForInStatement", + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, + "left": { + "type": "VariableDeclaration", + "start":5,"end":16,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":16}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":9,"end":16,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":16}}, + "id": { + "type": "ArrayPattern", + "start":9,"end":12,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":12}}, + "elements": [ + { + "type": "Identifier", + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11},"identifierName":"a"}, + "name": "a" + } + ] + }, + "init": { + "type": "NumericLiteral", + "start":15,"end":16,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":16}}, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + } + ], + "kind": "var" + }, + "right": { + "type": "ObjectExpression", + "start":20,"end":22,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":22}}, + "properties": [] + }, + "body": { + "type": "EmptyStatement", + "start":23,"end":24,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":24}} + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/for-in/var-objectbindingpattern-initializer/options.json b/packages/babel-parser/test/fixtures/es2015/for-in/var-objectbindingpattern-initializer/options.json deleted file mode 100644 index dd3b73e5d533..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/for-in/var-objectbindingpattern-initializer/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "for-in loop variable declaration may not have an initializer (1:5)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/for-in/var-objectbindingpattern-initializer/output.json b/packages/babel-parser/test/fixtures/es2015/for-in/var-objectbindingpattern-initializer/output.json new file mode 100644 index 000000000000..9bde6c44ee0c --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/for-in/var-objectbindingpattern-initializer/output.json @@ -0,0 +1,75 @@ +{ + "type": "File", + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, + "errors": [ + "SyntaxError: for-in loop variable declaration may not have an initializer (1:5)" + ], + "program": { + "type": "Program", + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ForInStatement", + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, + "left": { + "type": "VariableDeclaration", + "start":5,"end":16,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":16}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":9,"end":16,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":16}}, + "id": { + "type": "ObjectPattern", + "start":9,"end":12,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":12}}, + "properties": [ + { + "type": "ObjectProperty", + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11}}, + "method": false, + "key": { + "type": "Identifier", + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11},"identifierName":"a"}, + "name": "a" + }, + "computed": false, + "shorthand": true, + "value": { + "type": "Identifier", + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11},"identifierName":"a"}, + "name": "a" + }, + "extra": { + "shorthand": true + } + } + ] + }, + "init": { + "type": "NumericLiteral", + "start":15,"end":16,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":16}}, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + } + ], + "kind": "var" + }, + "right": { + "type": "ObjectExpression", + "start":20,"end":22,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":22}}, + "properties": [] + }, + "body": { + "type": "EmptyStatement", + "start":23,"end":24,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":24}} + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/for-of/bare-initializer/options.json b/packages/babel-parser/test/fixtures/es2015/for-of/bare-initializer/options.json deleted file mode 100644 index f5710cd7a9c9..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/for-of/bare-initializer/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid left-hand side in for-loop (2:5)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/for-of/bare-initializer/output.json b/packages/babel-parser/test/fixtures/es2015/for-of/bare-initializer/output.json new file mode 100644 index 000000000000..40500649a6b4 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/for-of/bare-initializer/output.json @@ -0,0 +1,65 @@ +{ + "type": "File", + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":18}}, + "errors": [ + "SyntaxError: Invalid left-hand side in for-loop (2:5)" + ], + "program": { + "type": "Program", + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":18}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5}}, + "id": { + "type": "Identifier", + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"a"}, + "name": "a" + }, + "init": null + } + ], + "kind": "var" + }, + { + "type": "ForOfStatement", + "start":7,"end":25,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":18}}, + "await": false, + "left": { + "type": "AssignmentPattern", + "start":12,"end":17,"loc":{"start":{"line":2,"column":5},"end":{"line":2,"column":10}}, + "left": { + "type": "Identifier", + "start":12,"end":13,"loc":{"start":{"line":2,"column":5},"end":{"line":2,"column":6},"identifierName":"a"}, + "name": "a" + }, + "right": { + "type": "NumericLiteral", + "start":16,"end":17,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":10}}, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + }, + "right": { + "type": "ObjectExpression", + "start":21,"end":23,"loc":{"start":{"line":2,"column":14},"end":{"line":2,"column":16}}, + "properties": [] + }, + "body": { + "type": "EmptyStatement", + "start":24,"end":25,"loc":{"start":{"line":2,"column":17},"end":{"line":2,"column":18}} + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/for-of/brackets-const/output.json b/packages/babel-parser/test/fixtures/es2015/for-of/brackets-const/output.json index e6724bdbc964..5a6b9c5fb01e 100644 --- a/packages/babel-parser/test/fixtures/es2015/for-of/brackets-const/output.json +++ b/packages/babel-parser/test/fixtures/es2015/for-of/brackets-const/output.json @@ -1,142 +1,41 @@ { "type": "File", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, "program": { "type": "Program", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ForOfStatement", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, "await": false, "left": { "type": "VariableDeclaration", - "start": 5, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":5,"end":14,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":14}}, "declarations": [ { "type": "VariableDeclarator", - "start": 11, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":11,"end":14,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":14}}, "id": { "type": "ObjectPattern", - "start": 11, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":11,"end":14,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":14}}, "properties": [ { "type": "ObjectProperty", - "start": 12, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":12,"end":13,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":13}}, "method": false, "key": { "type": "Identifier", - "start": 12, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - }, - "identifierName": "a" - }, + "start":12,"end":13,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":13},"identifierName":"a"}, "name": "a" }, "computed": false, "shorthand": true, "value": { "type": "Identifier", - "start": 12, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - }, - "identifierName": "a" - }, + "start":12,"end":13,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":13},"identifierName":"a"}, "name": "a" }, "extra": { @@ -152,18 +51,7 @@ }, "right": { "type": "RegExpLiteral", - "start": 18, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":18,"end":21,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":21}}, "extra": { "raw": "/b/" }, @@ -172,18 +60,7 @@ }, "body": { "type": "BlockStatement", - "start": 23, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":23,"end":25,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":25}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/es2015/for-of/brackets-let/output.json b/packages/babel-parser/test/fixtures/es2015/for-of/brackets-let/output.json index 6c74fa327abb..553575d2fb39 100644 --- a/packages/babel-parser/test/fixtures/es2015/for-of/brackets-let/output.json +++ b/packages/babel-parser/test/fixtures/es2015/for-of/brackets-let/output.json @@ -1,142 +1,41 @@ { "type": "File", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "program": { "type": "Program", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ForOfStatement", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "await": false, "left": { "type": "VariableDeclaration", - "start": 5, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":5,"end":12,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":12}}, "declarations": [ { "type": "VariableDeclarator", - "start": 9, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":9,"end":12,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":12}}, "id": { "type": "ObjectPattern", - "start": 9, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":9,"end":12,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":12}}, "properties": [ { "type": "ObjectProperty", - "start": 10, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11}}, "method": false, "key": { "type": "Identifier", - "start": 10, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "a" - }, + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11},"identifierName":"a"}, "name": "a" }, "computed": false, "shorthand": true, "value": { "type": "Identifier", - "start": 10, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "a" - }, + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11},"identifierName":"a"}, "name": "a" }, "extra": { @@ -152,18 +51,7 @@ }, "right": { "type": "RegExpLiteral", - "start": 16, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":16,"end":19,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":19}}, "extra": { "raw": "/b/" }, @@ -172,18 +60,7 @@ }, "body": { "type": "BlockStatement", - "start": 21, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":21,"end":23,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":23}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/es2015/for-of/brackets-var/output.json b/packages/babel-parser/test/fixtures/es2015/for-of/brackets-var/output.json index 507f3b6495e3..eff35b30466a 100644 --- a/packages/babel-parser/test/fixtures/es2015/for-of/brackets-var/output.json +++ b/packages/babel-parser/test/fixtures/es2015/for-of/brackets-var/output.json @@ -1,142 +1,41 @@ { "type": "File", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "program": { "type": "Program", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ForOfStatement", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "await": false, "left": { "type": "VariableDeclaration", - "start": 5, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":5,"end":12,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":12}}, "declarations": [ { "type": "VariableDeclarator", - "start": 9, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":9,"end":12,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":12}}, "id": { "type": "ObjectPattern", - "start": 9, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":9,"end":12,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":12}}, "properties": [ { "type": "ObjectProperty", - "start": 10, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11}}, "method": false, "key": { "type": "Identifier", - "start": 10, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "a" - }, + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11},"identifierName":"a"}, "name": "a" }, "computed": false, "shorthand": true, "value": { "type": "Identifier", - "start": 10, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "a" - }, + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11},"identifierName":"a"}, "name": "a" }, "extra": { @@ -152,18 +51,7 @@ }, "right": { "type": "RegExpLiteral", - "start": 16, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":16,"end":19,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":19}}, "extra": { "raw": "/b/" }, @@ -172,18 +60,7 @@ }, "body": { "type": "BlockStatement", - "start": 21, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":21,"end":23,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":23}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/es2015/for-of/invalid-escape-of/options.json b/packages/babel-parser/test/fixtures/es2015/for-of/invalid-escape-of/options.json index 6b9933a77108..8678455a0f9c 100644 --- a/packages/babel-parser/test/fixtures/es2015/for-of/invalid-escape-of/options.json +++ b/packages/babel-parser/test/fixtures/es2015/for-of/invalid-escape-of/options.json @@ -1,3 +1,3 @@ { "throws": "Unexpected token, expected \";\" (1:7)" -} \ No newline at end of file +} diff --git a/packages/babel-parser/test/fixtures/es2015/for-of/invalid-expr/options.json b/packages/babel-parser/test/fixtures/es2015/for-of/invalid-expr/options.json index e4ff6fef3cde..5eaf674e06e0 100644 --- a/packages/babel-parser/test/fixtures/es2015/for-of/invalid-expr/options.json +++ b/packages/babel-parser/test/fixtures/es2015/for-of/invalid-expr/options.json @@ -1,3 +1,3 @@ { "throws": "Unexpected token, expected \")\" (1:15)" -} \ No newline at end of file +} diff --git a/packages/babel-parser/test/fixtures/es2015/for-of/right-regex/output.json b/packages/babel-parser/test/fixtures/es2015/for-of/right-regex/output.json index e3f8d57824b6..c03c0eeb2cbc 100644 --- a/packages/babel-parser/test/fixtures/es2015/for-of/right-regex/output.json +++ b/packages/babel-parser/test/fixtures/es2015/for-of/right-regex/output.json @@ -1,93 +1,26 @@ { "type": "File", - "start": 0, - "end": 50, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 26 - } - }, + "start":0,"end":50,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":26}}, "program": { "type": "Program", - "start": 0, - "end": 50, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 26 - } - }, + "start":0,"end":50,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":26}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ForOfStatement", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "await": false, "left": { "type": "VariableDeclaration", - "start": 5, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":5,"end":10,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":10}}, "declarations": [ { "type": "VariableDeclarator", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10}}, "id": { "type": "Identifier", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - }, - "identifierName": "x" - }, + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"x"}, "name": "x" }, "init": null @@ -97,18 +30,7 @@ }, "right": { "type": "RegExpLiteral", - "start": 14, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":14,"end":20,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":20}}, "extra": { "raw": "/foo/g" }, @@ -117,160 +39,46 @@ }, "body": { "type": "EmptyStatement", - "start": 21, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 22 - } - } + "start":21,"end":22,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":22}} } }, { "type": "ForStatement", - "start": 24, - "end": 50, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 26 - } - }, + "start":24,"end":50,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":26}}, "init": { "type": "VariableDeclaration", - "start": 29, - "end": 46, - "loc": { - "start": { - "line": 3, - "column": 5 - }, - "end": { - "line": 3, - "column": 22 - } - }, + "start":29,"end":46,"loc":{"start":{"line":3,"column":5},"end":{"line":3,"column":22}}, "declarations": [ { "type": "VariableDeclarator", - "start": 33, - "end": 46, - "loc": { - "start": { - "line": 3, - "column": 9 - }, - "end": { - "line": 3, - "column": 22 - } - }, + "start":33,"end":46,"loc":{"start":{"line":3,"column":9},"end":{"line":3,"column":22}}, "id": { "type": "Identifier", - "start": 33, - "end": 34, - "loc": { - "start": { - "line": 3, - "column": 9 - }, - "end": { - "line": 3, - "column": 10 - }, - "identifierName": "x" - }, + "start":33,"end":34,"loc":{"start":{"line":3,"column":9},"end":{"line":3,"column":10},"identifierName":"x"}, "name": "x" }, "init": { "type": "BinaryExpression", - "start": 37, - "end": 46, - "loc": { - "start": { - "line": 3, - "column": 13 - }, - "end": { - "line": 3, - "column": 22 - } - }, + "start":37,"end":46,"loc":{"start":{"line":3,"column":13},"end":{"line":3,"column":22}}, "left": { "type": "BinaryExpression", - "start": 37, - "end": 44, - "loc": { - "start": { - "line": 3, - "column": 13 - }, - "end": { - "line": 3, - "column": 20 - } - }, + "start":37,"end":44,"loc":{"start":{"line":3,"column":13},"end":{"line":3,"column":20}}, "left": { "type": "Identifier", - "start": 37, - "end": 39, - "loc": { - "start": { - "line": 3, - "column": 13 - }, - "end": { - "line": 3, - "column": 15 - }, - "identifierName": "of" - }, + "start":37,"end":39,"loc":{"start":{"line":3,"column":13},"end":{"line":3,"column":15},"identifierName":"of"}, "name": "of" }, "operator": "/", "right": { "type": "Identifier", - "start": 41, - "end": 44, - "loc": { - "start": { - "line": 3, - "column": 17 - }, - "end": { - "line": 3, - "column": 20 - }, - "identifierName": "foo" - }, + "start":41,"end":44,"loc":{"start":{"line":3,"column":17},"end":{"line":3,"column":20},"identifierName":"foo"}, "name": "foo" } }, "operator": "/", "right": { "type": "Identifier", - "start": 45, - "end": 46, - "loc": { - "start": { - "line": 3, - "column": 21 - }, - "end": { - "line": 3, - "column": 22 - }, - "identifierName": "g" - }, + "start":45,"end":46,"loc":{"start":{"line":3,"column":21},"end":{"line":3,"column":22},"identifierName":"g"}, "name": "g" } } @@ -282,18 +90,7 @@ "update": null, "body": { "type": "EmptyStatement", - "start": 49, - "end": 50, - "loc": { - "start": { - "line": 3, - "column": 25 - }, - "end": { - "line": 3, - "column": 26 - } - } + "start":49,"end":50,"loc":{"start":{"line":3,"column":25},"end":{"line":3,"column":26}} } } ], diff --git a/packages/babel-parser/test/fixtures/es2015/generators/invalid-escape-yield/input.js b/packages/babel-parser/test/fixtures/es2015/generators/invalid-escape-yield/input.js index 521b91facbbc..8a89e37a1275 100644 --- a/packages/babel-parser/test/fixtures/es2015/generators/invalid-escape-yield/input.js +++ b/packages/babel-parser/test/fixtures/es2015/generators/invalid-escape-yield/input.js @@ -1 +1 @@ -(function* () { y\u0069eld 10 }) +(function* () { y\u0069eld; }) diff --git a/packages/babel-parser/test/fixtures/es2015/generators/invalid-escape-yield/options.json b/packages/babel-parser/test/fixtures/es2015/generators/invalid-escape-yield/options.json deleted file mode 100644 index dcd45c9b9715..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/generators/invalid-escape-yield/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Can not use 'yield' as identifier inside a generator (1:16)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/generators/invalid-escape-yield/output.json b/packages/babel-parser/test/fixtures/es2015/generators/invalid-escape-yield/output.json new file mode 100644 index 000000000000..f6604179cee6 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/generators/invalid-escape-yield/output.json @@ -0,0 +1,48 @@ +{ + "type": "File", + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, + "errors": [ + "SyntaxError: Can not use 'yield' as identifier inside a generator (1:16)" + ], + "program": { + "type": "Program", + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, + "expression": { + "type": "FunctionExpression", + "start":1,"end":29,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":29}}, + "id": null, + "generator": true, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":14,"end":29,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":29}}, + "body": [ + { + "type": "ExpressionStatement", + "start":16,"end":27,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":27}}, + "expression": { + "type": "Identifier", + "start":16,"end":26,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":26},"identifierName":"yield"}, + "name": "yield" + } + } + ], + "directives": [] + }, + "extra": { + "parenthesized": true, + "parenStart": 0 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/generators/invalid-hanging/options.json b/packages/babel-parser/test/fixtures/es2015/generators/invalid-hanging/options.json deleted file mode 100644 index 8cdac51705a1..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/generators/invalid-hanging/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Generators can only be declared at the top level or inside a block (1:16)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/generators/invalid-hanging/output.json b/packages/babel-parser/test/fixtures/es2015/generators/invalid-hanging/output.json new file mode 100644 index 000000000000..27beba5b2e65 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/generators/invalid-hanging/output.json @@ -0,0 +1,48 @@ +{ + "type": "File", + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, + "errors": [ + "SyntaxError: Generators can only be declared at the top level or inside a block (1:16)" + ], + "program": { + "type": "Program", + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "IfStatement", + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, + "test": { + "type": "NumericLiteral", + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5}}, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + }, + "consequent": { + "type": "FunctionDeclaration", + "start":7,"end":25,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":25}}, + "id": { + "type": "Identifier", + "start":17,"end":20,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":20},"identifierName":"foo"}, + "name": "foo" + }, + "generator": true, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":23,"end":25,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":25}}, + "body": [], + "directives": [] + } + }, + "alternate": null + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/generators/yield-regex/input.js b/packages/babel-parser/test/fixtures/es2015/generators/yield-regex/input.js new file mode 100644 index 000000000000..fad58539e472 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/generators/yield-regex/input.js @@ -0,0 +1 @@ +function* x() { yield* /z/ } diff --git a/packages/babel-parser/test/fixtures/es2015/generators/yield-regex/output.json b/packages/babel-parser/test/fixtures/es2015/generators/yield-regex/output.json new file mode 100644 index 000000000000..4fb61256be14 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/generators/yield-regex/output.json @@ -0,0 +1,50 @@ +{ + "type": "File", + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, + "program": { + "type": "Program", + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, + "id": { + "type": "Identifier", + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11},"identifierName":"x"}, + "name": "x" + }, + "generator": true, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":14,"end":28,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":28}}, + "body": [ + { + "type": "ExpressionStatement", + "start":16,"end":26,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":26}}, + "expression": { + "type": "YieldExpression", + "start":16,"end":26,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":26}}, + "delegate": true, + "argument": { + "type": "RegExpLiteral", + "start":23,"end":26,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":26}}, + "extra": { + "raw": "/z/" + }, + "pattern": "z", + "flags": "" + } + } + } + ], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/identifiers/invalid-escape-seq-const/input.js b/packages/babel-parser/test/fixtures/es2015/identifiers/invalid-escape-seq-const/input.js index 7db67c0d2dc7..3ec83f02b2f4 100644 --- a/packages/babel-parser/test/fixtures/es2015/identifiers/invalid-escape-seq-const/input.js +++ b/packages/babel-parser/test/fixtures/es2015/identifiers/invalid-escape-seq-const/input.js @@ -1 +1,3 @@ var co\u{6e}st = 123; + +co\u{6e}st x = 2; diff --git a/packages/babel-parser/test/fixtures/es2015/identifiers/invalid-escape-seq-const/options.json b/packages/babel-parser/test/fixtures/es2015/identifiers/invalid-escape-seq-const/options.json deleted file mode 100644 index d6c0b22e3090..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/identifiers/invalid-escape-seq-const/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Escape sequence in keyword const (1:14)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/identifiers/invalid-escape-seq-const/output.json b/packages/babel-parser/test/fixtures/es2015/identifiers/invalid-escape-seq-const/output.json new file mode 100644 index 000000000000..425fd47bc027 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/identifiers/invalid-escape-seq-const/output.json @@ -0,0 +1,68 @@ +{ + "type": "File", + "start":0,"end":40,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":17}}, + "errors": [ + "SyntaxError: Unexpected keyword 'const' (1:4)", + "SyntaxError: Escape sequence in keyword const (1:4)", + "SyntaxError: Escape sequence in keyword const (3:0)" + ], + "program": { + "type": "Program", + "start":0,"end":40,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":17}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":4,"end":20,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":20}}, + "id": { + "type": "Identifier", + "start":4,"end":14,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":14},"identifierName":"const"}, + "name": "const" + }, + "init": { + "type": "NumericLiteral", + "start":17,"end":20,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":20}}, + "extra": { + "rawValue": 123, + "raw": "123" + }, + "value": 123 + } + } + ], + "kind": "var" + }, + { + "type": "VariableDeclaration", + "start":23,"end":40,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":17}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":34,"end":39,"loc":{"start":{"line":3,"column":11},"end":{"line":3,"column":16}}, + "id": { + "type": "Identifier", + "start":34,"end":35,"loc":{"start":{"line":3,"column":11},"end":{"line":3,"column":12},"identifierName":"x"}, + "name": "x" + }, + "init": { + "type": "NumericLiteral", + "start":38,"end":39,"loc":{"start":{"line":3,"column":15},"end":{"line":3,"column":16}}, + "extra": { + "rawValue": 2, + "raw": "2" + }, + "value": 2 + } + } + ], + "kind": "const" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/identifiers/invalid-escape-seq-export/input.js b/packages/babel-parser/test/fixtures/es2015/identifiers/invalid-escape-seq-export/input.js index 2c49151ea912..c9bc4e4c28d9 100644 --- a/packages/babel-parser/test/fixtures/es2015/identifiers/invalid-escape-seq-export/input.js +++ b/packages/babel-parser/test/fixtures/es2015/identifiers/invalid-escape-seq-export/input.js @@ -1 +1,4 @@ var expor\u{74} = 123; + +var x; +expor\u{74} { x }; diff --git a/packages/babel-parser/test/fixtures/es2015/identifiers/invalid-escape-seq-export/options.json b/packages/babel-parser/test/fixtures/es2015/identifiers/invalid-escape-seq-export/options.json index 80870219d5cc..2104ca43283f 100644 --- a/packages/babel-parser/test/fixtures/es2015/identifiers/invalid-escape-seq-export/options.json +++ b/packages/babel-parser/test/fixtures/es2015/identifiers/invalid-escape-seq-export/options.json @@ -1,3 +1,3 @@ { - "throws": "Escape sequence in keyword export (1:15)" + "sourceType": "module" } diff --git a/packages/babel-parser/test/fixtures/es2015/identifiers/invalid-escape-seq-export/output.json b/packages/babel-parser/test/fixtures/es2015/identifiers/invalid-escape-seq-export/output.json new file mode 100644 index 000000000000..9aa7fd43bbb8 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/identifiers/invalid-escape-seq-export/output.json @@ -0,0 +1,82 @@ +{ + "type": "File", + "start":0,"end":49,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":18}}, + "errors": [ + "SyntaxError: Unexpected keyword 'export' (1:4)", + "SyntaxError: Escape sequence in keyword export (1:4)", + "SyntaxError: Escape sequence in keyword export (4:0)" + ], + "program": { + "type": "Program", + "start":0,"end":49,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":18}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":4,"end":21,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":21}}, + "id": { + "type": "Identifier", + "start":4,"end":15,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":15},"identifierName":"export"}, + "name": "export" + }, + "init": { + "type": "NumericLiteral", + "start":18,"end":21,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":21}}, + "extra": { + "rawValue": 123, + "raw": "123" + }, + "value": 123 + } + } + ], + "kind": "var" + }, + { + "type": "VariableDeclaration", + "start":24,"end":30,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":6}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":28,"end":29,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":5}}, + "id": { + "type": "Identifier", + "start":28,"end":29,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":5},"identifierName":"x"}, + "name": "x" + }, + "init": null + } + ], + "kind": "var" + }, + { + "type": "ExportNamedDeclaration", + "start":31,"end":49,"loc":{"start":{"line":4,"column":0},"end":{"line":4,"column":18}}, + "specifiers": [ + { + "type": "ExportSpecifier", + "start":45,"end":46,"loc":{"start":{"line":4,"column":14},"end":{"line":4,"column":15}}, + "local": { + "type": "Identifier", + "start":45,"end":46,"loc":{"start":{"line":4,"column":14},"end":{"line":4,"column":15},"identifierName":"x"}, + "name": "x" + }, + "exported": { + "type": "Identifier", + "start":45,"end":46,"loc":{"start":{"line":4,"column":14},"end":{"line":4,"column":15},"identifierName":"x"}, + "name": "x" + } + } + ], + "source": null, + "declaration": null + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/identifiers/invalid-escape-seq-if/options.json b/packages/babel-parser/test/fixtures/es2015/identifiers/invalid-escape-seq-if/options.json deleted file mode 100644 index 52faf91d3656..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/identifiers/invalid-escape-seq-if/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Escape sequence in keyword if (1:12)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/identifiers/invalid-escape-seq-if/output.json b/packages/babel-parser/test/fixtures/es2015/identifiers/invalid-escape-seq-if/output.json new file mode 100644 index 000000000000..a9fc063b1be8 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/identifiers/invalid-escape-seq-if/output.json @@ -0,0 +1,32 @@ +{ + "type": "File", + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, + "errors": [ + "SyntaxError: Escape sequence in keyword if (1:0)" + ], + "program": { + "type": "Program", + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "IfStatement", + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, + "test": { + "type": "BooleanLiteral", + "start":14,"end":18,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":18}}, + "value": true + }, + "consequent": { + "type": "BlockStatement", + "start":20,"end":22,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":22}}, + "body": [], + "directives": [] + }, + "alternate": null + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/identifiers/invalid-escape-seq-import/input.js b/packages/babel-parser/test/fixtures/es2015/identifiers/invalid-escape-seq-import/input.js index f23c79e20fb1..df174d0e56d1 100644 --- a/packages/babel-parser/test/fixtures/es2015/identifiers/invalid-escape-seq-import/input.js +++ b/packages/babel-parser/test/fixtures/es2015/identifiers/invalid-escape-seq-import/input.js @@ -1 +1,3 @@ var \u{69}\u{6d}\u{70}\u{6f}\u{72}\u{74} = 123; + +\u{69}\u{6d}\u{70}\u{6f}\u{72}\u{74} "x"; diff --git a/packages/babel-parser/test/fixtures/es2015/identifiers/invalid-escape-seq-import/options.json b/packages/babel-parser/test/fixtures/es2015/identifiers/invalid-escape-seq-import/options.json index 45763ffa389b..2104ca43283f 100644 --- a/packages/babel-parser/test/fixtures/es2015/identifiers/invalid-escape-seq-import/options.json +++ b/packages/babel-parser/test/fixtures/es2015/identifiers/invalid-escape-seq-import/options.json @@ -1,3 +1,3 @@ { - "throws": "Escape sequence in keyword import (1:40)" + "sourceType": "module" } diff --git a/packages/babel-parser/test/fixtures/es2015/identifiers/invalid-escape-seq-import/output.json b/packages/babel-parser/test/fixtures/es2015/identifiers/invalid-escape-seq-import/output.json new file mode 100644 index 000000000000..0533a2a4de2a --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/identifiers/invalid-escape-seq-import/output.json @@ -0,0 +1,57 @@ +{ + "type": "File", + "start":0,"end":90,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":41}}, + "errors": [ + "SyntaxError: Unexpected keyword 'import' (1:4)", + "SyntaxError: Escape sequence in keyword import (1:4)", + "SyntaxError: Escape sequence in keyword import (3:0)" + ], + "program": { + "type": "Program", + "start":0,"end":90,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":41}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start":0,"end":47,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":47}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":4,"end":46,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":46}}, + "id": { + "type": "Identifier", + "start":4,"end":40,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":40},"identifierName":"import"}, + "name": "import" + }, + "init": { + "type": "NumericLiteral", + "start":43,"end":46,"loc":{"start":{"line":1,"column":43},"end":{"line":1,"column":46}}, + "extra": { + "rawValue": 123, + "raw": "123" + }, + "value": 123 + } + } + ], + "kind": "var" + }, + { + "type": "ImportDeclaration", + "start":49,"end":90,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":41}}, + "specifiers": [], + "source": { + "type": "StringLiteral", + "start":86,"end":89,"loc":{"start":{"line":3,"column":37},"end":{"line":3,"column":40}}, + "extra": { + "rawValue": "x", + "raw": "\"x\"" + }, + "value": "x" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/identifiers/invalid-escape-seq-null/options.json b/packages/babel-parser/test/fixtures/es2015/identifiers/invalid-escape-seq-null/options.json deleted file mode 100644 index 34db9f6413ed..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/identifiers/invalid-escape-seq-null/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Escape sequence in keyword null (1:9)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/identifiers/invalid-escape-seq-null/output.json b/packages/babel-parser/test/fixtures/es2015/identifiers/invalid-escape-seq-null/output.json new file mode 100644 index 000000000000..1205de6403ef --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/identifiers/invalid-escape-seq-null/output.json @@ -0,0 +1,24 @@ +{ + "type": "File", + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "errors": [ + "SyntaxError: Escape sequence in keyword null (1:0)" + ], + "program": { + "type": "Program", + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "expression": { + "type": "NullLiteral", + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}} + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/identifiers/invalid-escape-seq-true/options.json b/packages/babel-parser/test/fixtures/es2015/identifiers/invalid-escape-seq-true/options.json deleted file mode 100644 index c1c2620da097..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/identifiers/invalid-escape-seq-true/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Escape sequence in keyword true (1:9)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/identifiers/invalid-escape-seq-true/output.json b/packages/babel-parser/test/fixtures/es2015/identifiers/invalid-escape-seq-true/output.json new file mode 100644 index 000000000000..13d4895854d3 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/identifiers/invalid-escape-seq-true/output.json @@ -0,0 +1,25 @@ +{ + "type": "File", + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "errors": [ + "SyntaxError: Escape sequence in keyword true (1:0)" + ], + "program": { + "type": "Program", + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "expression": { + "type": "BooleanLiteral", + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "value": true + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/let/invalid-escape/options.json b/packages/babel-parser/test/fixtures/es2015/let/invalid-escape/options.json index 410ecd16fddf..e4ae9a99d01b 100644 --- a/packages/babel-parser/test/fixtures/es2015/let/invalid-escape/options.json +++ b/packages/babel-parser/test/fixtures/es2015/let/invalid-escape/options.json @@ -1,3 +1,3 @@ { "throws": "Unexpected token, expected \";\" (1:9)" -} \ No newline at end of file +} diff --git a/packages/babel-parser/test/fixtures/es2015/let/let-as-identifier-1/output.json b/packages/babel-parser/test/fixtures/es2015/let/let-as-identifier-1/output.json index d5896aa4d598..58f5ce51ab69 100644 --- a/packages/babel-parser/test/fixtures/es2015/let/let-as-identifier-1/output.json +++ b/packages/babel-parser/test/fixtures/es2015/let/let-as-identifier-1/output.json @@ -1,94 +1,27 @@ { "type": "File", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "program": { "type": "Program", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "expression": { "type": "BinaryExpression", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "left": { "type": "Identifier", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - }, - "identifierName": "let" - }, + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3},"identifierName":"let"}, "name": "let" }, "operator": "+", "right": { "type": "NumericLiteral", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7}}, "extra": { "rawValue": 1, "raw": "1" diff --git a/packages/babel-parser/test/fixtures/es2015/let/let-as-identifier-2/output.json b/packages/babel-parser/test/fixtures/es2015/let/let-as-identifier-2/output.json index dc261c3dcbfb..4b446a0ba9fe 100644 --- a/packages/babel-parser/test/fixtures/es2015/let/let-as-identifier-2/output.json +++ b/packages/babel-parser/test/fixtures/es2015/let/let-as-identifier-2/output.json @@ -1,94 +1,27 @@ { "type": "File", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "program": { "type": "Program", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":4,"end":11,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":11}}, "id": { "type": "Identifier", - "start": 4, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "let" - }, + "start":4,"end":7,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":7},"identifierName":"let"}, "name": "let" }, "init": { "type": "NumericLiteral", - "start": 10, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11}}, "extra": { "rawValue": 1, "raw": "1" diff --git a/packages/babel-parser/test/fixtures/es2015/let/let-as-identifier-3/output.json b/packages/babel-parser/test/fixtures/es2015/let/let-as-identifier-3/output.json index b0f5399086e7..ac17d0535968 100644 --- a/packages/babel-parser/test/fixtures/es2015/let/let-as-identifier-3/output.json +++ b/packages/babel-parser/test/fixtures/es2015/let/let-as-identifier-3/output.json @@ -1,95 +1,27 @@ { "type": "File", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, "program": { "type": "Program", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, "expression": { "type": "BinaryExpression", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, "left": { "type": "Identifier", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - }, - "identifierName": "let" - }, + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3},"identifierName":"let"}, "name": "let" }, "operator": "instanceof", "right": { "type": "Identifier", - "start": 15, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 18 - }, - "identifierName": "Foo" - }, + "start":15,"end":18,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":18},"identifierName":"Foo"}, "name": "Foo" } } diff --git a/packages/babel-parser/test/fixtures/es2015/let/let-as-identifier-4/output.json b/packages/babel-parser/test/fixtures/es2015/let/let-as-identifier-4/output.json index 96851ba7aa04..7b98d28e08c6 100644 --- a/packages/babel-parser/test/fixtures/es2015/let/let-as-identifier-4/output.json +++ b/packages/babel-parser/test/fixtures/es2015/let/let-as-identifier-4/output.json @@ -1,94 +1,27 @@ { "type": "File", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "program": { "type": "Program", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "expression": { "type": "BinaryExpression", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "left": { "type": "Identifier", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - }, - "identifierName": "let" - }, + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3},"identifierName":"let"}, "name": "let" }, "operator": "in", "right": { "type": "ObjectExpression", - "start": 7, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":7,"end":9,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":9}}, "properties": [] } } diff --git a/packages/babel-parser/test/fixtures/es2015/let/let-as-identifier-5/output.json b/packages/babel-parser/test/fixtures/es2015/let/let-as-identifier-5/output.json index ade78031a623..aa5c55bce7bd 100644 --- a/packages/babel-parser/test/fixtures/es2015/let/let-as-identifier-5/output.json +++ b/packages/babel-parser/test/fixtures/es2015/let/let-as-identifier-5/output.json @@ -1,62 +1,18 @@ { "type": "File", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 2 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":2}}, "program": { "type": "Program", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 2 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":2}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "IfStatement", - "start": 0, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, "test": { "type": "NumericLiteral", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5}}, "extra": { "rawValue": 1, "raw": "1" @@ -65,33 +21,10 @@ }, "consequent": { "type": "ExpressionStatement", - "start": 7, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":7,"end":10,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":10}}, "expression": { "type": "Identifier", - "start": 7, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 10 - }, - "identifierName": "let" - }, + "start":7,"end":10,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":10},"identifierName":"let"}, "name": "let" } }, @@ -99,18 +32,7 @@ }, { "type": "BlockStatement", - "start": 11, - "end": 13, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 2 - } - }, + "start":11,"end":13,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":2}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/es2015/let/let-as-identifier-6/output.json b/packages/babel-parser/test/fixtures/es2015/let/let-as-identifier-6/output.json index c51c3538f169..c1d3f4cf73f9 100644 --- a/packages/babel-parser/test/fixtures/es2015/let/let-as-identifier-6/output.json +++ b/packages/babel-parser/test/fixtures/es2015/let/let-as-identifier-6/output.json @@ -1,62 +1,18 @@ { "type": "File", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 3 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":3}}, "program": { "type": "Program", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 3 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":3}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "WhileStatement", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "test": { "type": "NumericLiteral", - "start": 7, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8}}, "extra": { "rawValue": 0, "raw": "0" @@ -65,66 +21,20 @@ }, "body": { "type": "ExpressionStatement", - "start": 10, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":10,"end":13,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":13}}, "expression": { "type": "Identifier", - "start": 10, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 13 - }, - "identifierName": "let" - }, + "start":10,"end":13,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":13},"identifierName":"let"}, "name": "let" } } }, { "type": "ExpressionStatement", - "start": 14, - "end": 17, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 3 - } - }, + "start":14,"end":17,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":3}}, "expression": { "type": "Identifier", - "start": 14, - "end": 17, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 3 - }, - "identifierName": "foo" - }, + "start":14,"end":17,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":3},"identifierName":"foo"}, "name": "foo" } } diff --git a/packages/babel-parser/test/fixtures/es2015/let/let-as-identifier-7/output.json b/packages/babel-parser/test/fixtures/es2015/let/let-as-identifier-7/output.json index 721e29212ee3..bd3f171f6164 100644 --- a/packages/babel-parser/test/fixtures/es2015/let/let-as-identifier-7/output.json +++ b/packages/babel-parser/test/fixtures/es2015/let/let-as-identifier-7/output.json @@ -1,62 +1,18 @@ { "type": "File", - "start": 0, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 14 - } - }, + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":14}}, "program": { "type": "Program", - "start": 0, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 14 - } - }, + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":14}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "WhileStatement", - "start": 0, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 14 - } - }, + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":14}}, "test": { "type": "NumericLiteral", - "start": 7, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8}}, "extra": { "rawValue": 0, "raw": "0" @@ -65,65 +21,19 @@ }, "body": { "type": "ExpressionStatement", - "start": 10, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 2, - "column": 14 - } - }, + "start":10,"end":28,"loc":{"start":{"line":1,"column":10},"end":{"line":2,"column":14}}, "expression": { "type": "BinaryExpression", - "start": 10, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 2, - "column": 14 - } - }, + "start":10,"end":28,"loc":{"start":{"line":1,"column":10},"end":{"line":2,"column":14}}, "left": { "type": "Identifier", - "start": 10, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 13 - }, - "identifierName": "let" - }, + "start":10,"end":13,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":13},"identifierName":"let"}, "name": "let" }, "operator": "instanceof", "right": { "type": "Identifier", - "start": 25, - "end": 28, - "loc": { - "start": { - "line": 2, - "column": 11 - }, - "end": { - "line": 2, - "column": 14 - }, - "identifierName": "Foo" - }, + "start":25,"end":28,"loc":{"start":{"line":2,"column":11},"end":{"line":2,"column":14},"identifierName":"Foo"}, "name": "Foo" } } diff --git a/packages/babel-parser/test/fixtures/es2015/let/let-as-identifier-strict-fail/options.json b/packages/babel-parser/test/fixtures/es2015/let/let-as-identifier-strict-fail/options.json deleted file mode 100644 index ab238c8bbff9..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/let/let-as-identifier-strict-fail/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected reserved word 'let' (2:0)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/let/let-as-identifier-strict-fail/output.json b/packages/babel-parser/test/fixtures/es2015/let/let-as-identifier-strict-fail/output.json new file mode 100644 index 000000000000..c45edc3f9592 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/let/let-as-identifier-strict-fail/output.json @@ -0,0 +1,53 @@ +{ + "type": "File", + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":7}}, + "errors": [ + "SyntaxError: Unexpected reserved word 'let' (2:0)" + ], + "program": { + "type": "Program", + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":7}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":14,"end":21,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":7}}, + "expression": { + "type": "BinaryExpression", + "start":14,"end":21,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":7}}, + "left": { + "type": "Identifier", + "start":14,"end":17,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":3},"identifierName":"let"}, + "name": "let" + }, + "operator": "+", + "right": { + "type": "NumericLiteral", + "start":20,"end":21,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":7}}, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "value": { + "type": "DirectiveLiteral", + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/let/let-at-binding-list-fail-1/options.json b/packages/babel-parser/test/fixtures/es2015/let/let-at-binding-list-fail-1/options.json deleted file mode 100644 index f57eb3dfe6c2..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/let/let-at-binding-list-fail-1/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "'let' is not allowed to be used as a name in 'let' or 'const' declarations. (1:6)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/let/let-at-binding-list-fail-1/output.json b/packages/babel-parser/test/fixtures/es2015/let/let-at-binding-list-fail-1/output.json new file mode 100644 index 000000000000..12a2c9548cf4 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/let/let-at-binding-list-fail-1/output.json @@ -0,0 +1,58 @@ +{ + "type": "File", + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, + "errors": [ + "SyntaxError: 'let' is not allowed to be used as a name in 'let' or 'const' declarations. (1:6)" + ], + "program": { + "type": "Program", + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":4,"end":16,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":16}}, + "id": { + "type": "ObjectPattern", + "start":4,"end":11,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":11}}, + "properties": [ + { + "type": "ObjectProperty", + "start":6,"end":9,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":9}}, + "method": false, + "key": { + "type": "Identifier", + "start":6,"end":9,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":9},"identifierName":"let"}, + "name": "let" + }, + "computed": false, + "shorthand": true, + "value": { + "type": "Identifier", + "start":6,"end":9,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":9},"identifierName":"let"}, + "name": "let" + }, + "extra": { + "shorthand": true + } + } + ] + }, + "init": { + "type": "ObjectExpression", + "start":14,"end":16,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":16}}, + "properties": [] + } + } + ], + "kind": "let" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/let/let-at-binding-list-fail-2/options.json b/packages/babel-parser/test/fixtures/es2015/let/let-at-binding-list-fail-2/options.json deleted file mode 100644 index 365d76ddf46e..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/let/let-at-binding-list-fail-2/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "'let' is not allowed to be used as a name in 'let' or 'const' declarations. (1:8)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/let/let-at-binding-list-fail-2/output.json b/packages/babel-parser/test/fixtures/es2015/let/let-at-binding-list-fail-2/output.json new file mode 100644 index 000000000000..978664b05799 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/let/let-at-binding-list-fail-2/output.json @@ -0,0 +1,58 @@ +{ + "type": "File", + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, + "errors": [ + "SyntaxError: 'let' is not allowed to be used as a name in 'let' or 'const' declarations. (1:8)" + ], + "program": { + "type": "Program", + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":6,"end":18,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":18}}, + "id": { + "type": "ObjectPattern", + "start":6,"end":13,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":13}}, + "properties": [ + { + "type": "ObjectProperty", + "start":8,"end":11,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":11}}, + "method": false, + "key": { + "type": "Identifier", + "start":8,"end":11,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":11},"identifierName":"let"}, + "name": "let" + }, + "computed": false, + "shorthand": true, + "value": { + "type": "Identifier", + "start":8,"end":11,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":11},"identifierName":"let"}, + "name": "let" + }, + "extra": { + "shorthand": true + } + } + ] + }, + "init": { + "type": "ObjectExpression", + "start":16,"end":18,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":18}}, + "properties": [] + } + } + ], + "kind": "const" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/let/let-at-binding-list-fail-3/options.json b/packages/babel-parser/test/fixtures/es2015/let/let-at-binding-list-fail-3/options.json deleted file mode 100644 index d83275e4a85a..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/let/let-at-binding-list-fail-3/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "'let' is not allowed to be used as a name in 'let' or 'const' declarations. (1:5)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/let/let-at-binding-list-fail-3/output.json b/packages/babel-parser/test/fixtures/es2015/let/let-at-binding-list-fail-3/output.json new file mode 100644 index 000000000000..5b853db406eb --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/let/let-at-binding-list-fail-3/output.json @@ -0,0 +1,43 @@ +{ + "type": "File", + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, + "errors": [ + "SyntaxError: 'let' is not allowed to be used as a name in 'let' or 'const' declarations. (1:5)" + ], + "program": { + "type": "Program", + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":4,"end":14,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":14}}, + "id": { + "type": "ArrayPattern", + "start":4,"end":9,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":9}}, + "elements": [ + { + "type": "Identifier", + "start":5,"end":8,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":8},"identifierName":"let"}, + "name": "let" + } + ] + }, + "init": { + "type": "ArrayExpression", + "start":12,"end":14,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":14}}, + "elements": [] + } + } + ], + "kind": "let" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/let/let-at-binding-list-fail-4/options.json b/packages/babel-parser/test/fixtures/es2015/let/let-at-binding-list-fail-4/options.json deleted file mode 100644 index 456948bdd272..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/let/let-at-binding-list-fail-4/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "'let' is not allowed to be used as a name in 'let' or 'const' declarations. (1:7)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/let/let-at-binding-list-fail-4/output.json b/packages/babel-parser/test/fixtures/es2015/let/let-at-binding-list-fail-4/output.json new file mode 100644 index 000000000000..908c57bb93e5 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/let/let-at-binding-list-fail-4/output.json @@ -0,0 +1,43 @@ +{ + "type": "File", + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, + "errors": [ + "SyntaxError: 'let' is not allowed to be used as a name in 'let' or 'const' declarations. (1:7)" + ], + "program": { + "type": "Program", + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":6,"end":16,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":16}}, + "id": { + "type": "ArrayPattern", + "start":6,"end":11,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":11}}, + "elements": [ + { + "type": "Identifier", + "start":7,"end":10,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":10},"identifierName":"let"}, + "name": "let" + } + ] + }, + "init": { + "type": "ArrayExpression", + "start":14,"end":16,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":16}}, + "elements": [] + } + } + ], + "kind": "const" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/let/let-at-binding-list-fail-5/options.json b/packages/babel-parser/test/fixtures/es2015/let/let-at-binding-list-fail-5/options.json deleted file mode 100644 index 4ca932f989ae..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/let/let-at-binding-list-fail-5/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "'let' is not allowed to be used as a name in 'let' or 'const' declarations. (1:4)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/let/let-at-binding-list-fail-5/output.json b/packages/babel-parser/test/fixtures/es2015/let/let-at-binding-list-fail-5/output.json new file mode 100644 index 000000000000..b2f6cfd13568 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/let/let-at-binding-list-fail-5/output.json @@ -0,0 +1,33 @@ +{ + "type": "File", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "errors": [ + "SyntaxError: 'let' is not allowed to be used as a name in 'let' or 'const' declarations. (1:4)" + ], + "program": { + "type": "Program", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":4,"end":7,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":7}}, + "id": { + "type": "Identifier", + "start":4,"end":7,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":7},"identifierName":"let"}, + "name": "let" + }, + "init": null + } + ], + "kind": "let" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/let/let-at-binding-list-fail-6/options.json b/packages/babel-parser/test/fixtures/es2015/let/let-at-binding-list-fail-6/options.json deleted file mode 100644 index f57eb3dfe6c2..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/let/let-at-binding-list-fail-6/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "'let' is not allowed to be used as a name in 'let' or 'const' declarations. (1:6)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/let/let-at-binding-list-fail-6/output.json b/packages/babel-parser/test/fixtures/es2015/let/let-at-binding-list-fail-6/output.json new file mode 100644 index 000000000000..1cd48f97ea7b --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/let/let-at-binding-list-fail-6/output.json @@ -0,0 +1,41 @@ +{ + "type": "File", + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, + "errors": [ + "SyntaxError: 'let' is not allowed to be used as a name in 'let' or 'const' declarations. (1:6)" + ], + "program": { + "type": "Program", + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":6,"end":14,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":14}}, + "id": { + "type": "Identifier", + "start":6,"end":9,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":9},"identifierName":"let"}, + "name": "let" + }, + "init": { + "type": "StringLiteral", + "start":12,"end":14,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":14}}, + "extra": { + "rawValue": "", + "raw": "''" + }, + "value": "" + } + } + ], + "kind": "const" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/let/let-at-catch-block/input.js b/packages/babel-parser/test/fixtures/es2015/let/let-at-catch-block/input.js new file mode 100644 index 000000000000..25619fa29b6a --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/let/let-at-catch-block/input.js @@ -0,0 +1,3 @@ +try {} catch (err) { + let let; +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/let/let-at-catch-block/output.json b/packages/babel-parser/test/fixtures/es2015/let/let-at-catch-block/output.json new file mode 100644 index 000000000000..22e958dfc7ad --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/let/let-at-catch-block/output.json @@ -0,0 +1,60 @@ +{ + "type": "File", + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "errors": [ + "SyntaxError: 'let' is not allowed to be used as a name in 'let' or 'const' declarations. (2:6)" + ], + "program": { + "type": "Program", + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "TryStatement", + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "block": { + "type": "BlockStatement", + "start":4,"end":6,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":6}}, + "body": [], + "directives": [] + }, + "handler": { + "type": "CatchClause", + "start":7,"end":33,"loc":{"start":{"line":1,"column":7},"end":{"line":3,"column":1}}, + "param": { + "type": "Identifier", + "start":14,"end":17,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":17},"identifierName":"err"}, + "name": "err" + }, + "body": { + "type": "BlockStatement", + "start":19,"end":33,"loc":{"start":{"line":1,"column":19},"end":{"line":3,"column":1}}, + "body": [ + { + "type": "VariableDeclaration", + "start":23,"end":31,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":10}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":27,"end":30,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":9}}, + "id": { + "type": "Identifier", + "start":27,"end":30,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":9},"identifierName":"let"}, + "name": "let" + }, + "init": null + } + ], + "kind": "let" + } + ], + "directives": [] + } + }, + "finalizer": null + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/let/let-block-with-newline/output.json b/packages/babel-parser/test/fixtures/es2015/let/let-block-with-newline/output.json index c2a68fccc8ec..d3971492101a 100644 --- a/packages/babel-parser/test/fixtures/es2015/let/let-block-with-newline/output.json +++ b/packages/babel-parser/test/fixtures/es2015/let/let-block-with-newline/output.json @@ -1,193 +1,59 @@ { "type": "File", - "start": 0, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "IfStatement", - "start": 0, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, "test": { "type": "BooleanLiteral", - "start": 4, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":4,"end":9,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":9}}, "value": false }, "consequent": { "type": "BlockStatement", - "start": 11, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":11,"end":39,"loc":{"start":{"line":1,"column":11},"end":{"line":4,"column":1}}, "body": [ { "type": "LabeledStatement", - "start": 17, - "end": 23, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 10 - } - }, + "start":17,"end":23,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":10}}, "body": { "type": "ExpressionStatement", - "start": 20, - "end": 23, - "loc": { - "start": { - "line": 2, - "column": 7 - }, - "end": { - "line": 2, - "column": 10 - } - }, + "start":20,"end":23,"loc":{"start":{"line":2,"column":7},"end":{"line":2,"column":10}}, "expression": { "type": "Identifier", - "start": 20, - "end": 23, - "loc": { - "start": { - "line": 2, - "column": 7 - }, - "end": { - "line": 2, - "column": 10 - }, - "identifierName": "let" - }, + "start":20,"end":23,"loc":{"start":{"line":2,"column":7},"end":{"line":2,"column":10},"identifierName":"let"}, "name": "let" } }, "label": { "type": "Identifier", - "start": 17, - "end": 18, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 5 - }, - "identifierName": "L" - }, + "start":17,"end":18,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":5},"identifierName":"L"}, "name": "L" }, "trailingComments": [ { "type": "CommentLine", "value": " ASI", - "start": 24, - "end": 30, - "loc": { - "start": { - "line": 2, - "column": 11 - }, - "end": { - "line": 2, - "column": 17 - } - } + "start":24,"end":30,"loc":{"start":{"line":2,"column":11},"end":{"line":2,"column":17}} } ] }, { "type": "BlockStatement", - "start": 35, - "end": 37, - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 6 - } - }, + "start":35,"end":37,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":6}}, "body": [], "directives": [], "leadingComments": [ { "type": "CommentLine", "value": " ASI", - "start": 24, - "end": 30, - "loc": { - "start": { - "line": 2, - "column": 11 - }, - "end": { - "line": 2, - "column": 17 - } - } + "start":24,"end":30,"loc":{"start":{"line":2,"column":11},"end":{"line":2,"column":17}} } ] } @@ -203,18 +69,7 @@ { "type": "CommentLine", "value": " ASI", - "start": 24, - "end": 30, - "loc": { - "start": { - "line": 2, - "column": 11 - }, - "end": { - "line": 2, - "column": 17 - } - } + "start":24,"end":30,"loc":{"start":{"line":2,"column":11},"end":{"line":2,"column":17}} } ] } \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/let/let-with-linebreak-arr-dstrk/output.json b/packages/babel-parser/test/fixtures/es2015/let/let-with-linebreak-arr-dstrk/output.json index f21958466322..e6e46b39044b 100644 --- a/packages/babel-parser/test/fixtures/es2015/let/let-with-linebreak-arr-dstrk/output.json +++ b/packages/babel-parser/test/fixtures/es2015/let/let-with-linebreak-arr-dstrk/output.json @@ -1,126 +1,37 @@ { "type": "File", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 14 - } - }, + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":14}}, "program": { "type": "Program", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 14 - } - }, + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":14}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 14 - } - }, + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":14}}, "declarations": [ { "type": "VariableDeclarator", - "start": 8, - "end": 17, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 13 - } - }, + "start":8,"end":17,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":13}}, "id": { "type": "ArrayPattern", - "start": 8, - "end": 11, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 7 - } - }, + "start":8,"end":11,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":7}}, "elements": [ { "type": "Identifier", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 6 - }, - "identifierName": "a" - }, + "start":9,"end":10,"loc":{"start":{"line":2,"column":5},"end":{"line":2,"column":6},"identifierName":"a"}, "name": "a" } ] }, "init": { "type": "ArrayExpression", - "start": 14, - "end": 17, - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 13 - } - }, + "start":14,"end":17,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":13}}, "elements": [ { "type": "NumericLiteral", - "start": 15, - "end": 16, - "loc": { - "start": { - "line": 2, - "column": 11 - }, - "end": { - "line": 2, - "column": 12 - } - }, + "start":15,"end":16,"loc":{"start":{"line":2,"column":11},"end":{"line":2,"column":12}}, "extra": { "rawValue": 1, "raw": "1" diff --git a/packages/babel-parser/test/fixtures/es2015/let/let-with-linebreak-obj-dstrk/output.json b/packages/babel-parser/test/fixtures/es2015/let/let-with-linebreak-obj-dstrk/output.json index 3b6eb431c234..7b0cbae5415a 100644 --- a/packages/babel-parser/test/fixtures/es2015/let/let-with-linebreak-obj-dstrk/output.json +++ b/packages/babel-parser/test/fixtures/es2015/let/let-with-linebreak-obj-dstrk/output.json @@ -1,127 +1,37 @@ { "type": "File", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 21 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":21}}, "program": { "type": "Program", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 21 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":21}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 21 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":21}}, "declarations": [ { "type": "VariableDeclarator", - "start": 8, - "end": 24, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 20 - } - }, + "start":8,"end":24,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":20}}, "id": { "type": "ObjectPattern", - "start": 8, - "end": 13, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 9 - } - }, + "start":8,"end":13,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":9}}, "properties": [ { "type": "ObjectProperty", - "start": 10, - "end": 11, - "loc": { - "start": { - "line": 2, - "column": 6 - }, - "end": { - "line": 2, - "column": 7 - } - }, + "start":10,"end":11,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":7}}, "method": false, "key": { "type": "Identifier", - "start": 10, - "end": 11, - "loc": { - "start": { - "line": 2, - "column": 6 - }, - "end": { - "line": 2, - "column": 7 - }, - "identifierName": "a" - }, + "start":10,"end":11,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":7},"identifierName":"a"}, "name": "a" }, "computed": false, "shorthand": true, "value": { "type": "Identifier", - "start": 10, - "end": 11, - "loc": { - "start": { - "line": 2, - "column": 6 - }, - "end": { - "line": 2, - "column": 7 - }, - "identifierName": "a" - }, + "start":10,"end":11,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":7},"identifierName":"a"}, "name": "a" }, "extra": { @@ -132,67 +42,22 @@ }, "init": { "type": "ObjectExpression", - "start": 16, - "end": 24, - "loc": { - "start": { - "line": 2, - "column": 12 - }, - "end": { - "line": 2, - "column": 20 - } - }, + "start":16,"end":24,"loc":{"start":{"line":2,"column":12},"end":{"line":2,"column":20}}, "properties": [ { "type": "ObjectProperty", - "start": 18, - "end": 22, - "loc": { - "start": { - "line": 2, - "column": 14 - }, - "end": { - "line": 2, - "column": 18 - } - }, + "start":18,"end":22,"loc":{"start":{"line":2,"column":14},"end":{"line":2,"column":18}}, "method": false, "key": { "type": "Identifier", - "start": 18, - "end": 19, - "loc": { - "start": { - "line": 2, - "column": 14 - }, - "end": { - "line": 2, - "column": 15 - }, - "identifierName": "a" - }, + "start":18,"end":19,"loc":{"start":{"line":2,"column":14},"end":{"line":2,"column":15},"identifierName":"a"}, "name": "a" }, "computed": false, "shorthand": false, "value": { "type": "NumericLiteral", - "start": 21, - "end": 22, - "loc": { - "start": { - "line": 2, - "column": 17 - }, - "end": { - "line": 2, - "column": 18 - } - }, + "start":21,"end":22,"loc":{"start":{"line":2,"column":17},"end":{"line":2,"column":18}}, "extra": { "rawValue": 1, "raw": "1" diff --git a/packages/babel-parser/test/fixtures/es2015/let/let-with-linebreak/output.json b/packages/babel-parser/test/fixtures/es2015/let/let-with-linebreak/output.json index 53f9ebb8102c..32383a0760e1 100644 --- a/packages/babel-parser/test/fixtures/es2015/let/let-with-linebreak/output.json +++ b/packages/babel-parser/test/fixtures/es2015/let/let-with-linebreak/output.json @@ -1,78 +1,22 @@ { "type": "File", - "start": 0, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 6 - } - }, + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":6}}, "program": { "type": "Program", - "start": 0, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 6 - } - }, + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":6}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 6 - } - }, + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":6}}, "declarations": [ { "type": "VariableDeclarator", - "start": 8, - "end": 9, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 5 - } - }, + "start":8,"end":9,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":5}}, "id": { "type": "Identifier", - "start": 8, - "end": 9, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 5 - }, - "identifierName": "a" - }, + "start":8,"end":9,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":5},"identifierName":"a"}, "name": "a" }, "init": null diff --git a/packages/babel-parser/test/fixtures/es2015/let/try-catch-let/input.js b/packages/babel-parser/test/fixtures/es2015/let/try-catch-let/input.js new file mode 100644 index 000000000000..a96f76fcd513 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/let/try-catch-let/input.js @@ -0,0 +1 @@ +try {} catch (let) {} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/let/try-catch-let/output.json b/packages/babel-parser/test/fixtures/es2015/let/try-catch-let/output.json new file mode 100644 index 000000000000..88d6a935b3d6 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/let/try-catch-let/output.json @@ -0,0 +1,39 @@ +{ + "type": "File", + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, + "program": { + "type": "Program", + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "TryStatement", + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, + "block": { + "type": "BlockStatement", + "start":4,"end":6,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":6}}, + "body": [], + "directives": [] + }, + "handler": { + "type": "CatchClause", + "start":7,"end":21,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":21}}, + "param": { + "type": "Identifier", + "start":14,"end":17,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":17},"identifierName":"let"}, + "name": "let" + }, + "body": { + "type": "BlockStatement", + "start":19,"end":21,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":21}}, + "body": [], + "directives": [] + } + }, + "finalizer": null + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/meta-properties/expression/output.json b/packages/babel-parser/test/fixtures/es2015/meta-properties/expression/output.json index f5f3e41b514d..07be4bef8b99 100644 --- a/packages/babel-parser/test/fixtures/es2015/meta-properties/expression/output.json +++ b/packages/babel-parser/test/fixtures/es2015/meta-properties/expression/output.json @@ -1,173 +1,49 @@ { "type": "File", - "start": 0, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 2 - } - }, + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":2}}, "program": { "type": "Program", - "start": 0, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 2 - } - }, + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":2}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 2 - } - }, + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":2}}, "declarations": [ { "type": "VariableDeclarator", - "start": 6, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":6,"end":38,"loc":{"start":{"line":1,"column":6},"end":{"line":3,"column":1}}, "id": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "A" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, "name": "A" }, "init": { "type": "FunctionExpression", - "start": 10, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":10,"end":38,"loc":{"start":{"line":1,"column":10},"end":{"line":3,"column":1}}, "id": null, "generator": false, "async": false, "params": [], "body": { "type": "BlockStatement", - "start": 21, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":21,"end":38,"loc":{"start":{"line":1,"column":21},"end":{"line":3,"column":1}}, "body": [ { "type": "ExpressionStatement", - "start": 25, - "end": 36, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 13 - } - }, + "start":25,"end":36,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":13}}, "expression": { "type": "MetaProperty", - "start": 25, - "end": 35, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 12 - } - }, + "start":25,"end":35,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":12}}, "meta": { "type": "Identifier", - "start": 25, - "end": 28, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 5 - }, - "identifierName": "new" - }, + "start":25,"end":28,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":5},"identifierName":"new"}, "name": "new" }, "property": { "type": "Identifier", - "start": 29, - "end": 35, - "loc": { - "start": { - "line": 2, - "column": 6 - }, - "end": { - "line": 2, - "column": 12 - }, - "identifierName": "target" - }, + "start":29,"end":35,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":12},"identifierName":"target"}, "name": "target" } } diff --git a/packages/babel-parser/test/fixtures/es2015/meta-properties/invalid-arrow-function/options.json b/packages/babel-parser/test/fixtures/es2015/meta-properties/invalid-arrow-function/options.json deleted file mode 100644 index 4be1533d8e29..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/meta-properties/invalid-arrow-function/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "new.target can only be used in functions (2:2)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/meta-properties/invalid-arrow-function/output.json b/packages/babel-parser/test/fixtures/es2015/meta-properties/invalid-arrow-function/output.json new file mode 100644 index 000000000000..eee1bada9870 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/meta-properties/invalid-arrow-function/output.json @@ -0,0 +1,65 @@ +{ + "type": "File", + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "errors": [ + "SyntaxError: new.target can only be used in functions (2:2)" + ], + "program": { + "type": "Program", + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":6,"end":33,"loc":{"start":{"line":1,"column":6},"end":{"line":3,"column":1}}, + "id": { + "type": "Identifier", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, + "name": "A" + }, + "init": { + "type": "ArrowFunctionExpression", + "start":10,"end":33,"loc":{"start":{"line":1,"column":10},"end":{"line":3,"column":1}}, + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":16,"end":33,"loc":{"start":{"line":1,"column":16},"end":{"line":3,"column":1}}, + "body": [ + { + "type": "ExpressionStatement", + "start":20,"end":31,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":13}}, + "expression": { + "type": "MetaProperty", + "start":20,"end":30,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":12}}, + "meta": { + "type": "Identifier", + "start":20,"end":23,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":5},"identifierName":"new"}, + "name": "new" + }, + "property": { + "type": "Identifier", + "start":24,"end":30,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":12},"identifierName":"target"}, + "name": "target" + } + } + } + ], + "directives": [] + } + } + } + ], + "kind": "const" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/meta-properties/nested-arrow-function/output.json b/packages/babel-parser/test/fixtures/es2015/meta-properties/nested-arrow-function/output.json index 447bc2741c32..55524234b199 100644 --- a/packages/babel-parser/test/fixtures/es2015/meta-properties/nested-arrow-function/output.json +++ b/packages/babel-parser/test/fixtures/es2015/meta-properties/nested-arrow-function/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 40 - } - }, + "start":0,"end":40,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":40}}, "program": { "type": "Program", - "start": 0, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 40 - } - }, + "start":0,"end":40,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":40}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 40 - } - }, + "start":0,"end":40,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":40}}, "id": { "type": "Identifier", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - }, - "identifierName": "A" - }, + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"A"}, "name": "A" }, "generator": false, @@ -65,97 +20,29 @@ "params": [], "body": { "type": "BlockStatement", - "start": 13, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 40 - } - }, + "start":13,"end":40,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":40}}, "body": [ { "type": "ReturnStatement", - "start": 15, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":15,"end":38,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":38}}, "argument": { "type": "ArrowFunctionExpression", - "start": 22, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":22,"end":38,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":38}}, "id": null, "generator": false, "async": false, "params": [], "body": { "type": "MetaProperty", - "start": 28, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":28,"end":38,"loc":{"start":{"line":1,"column":28},"end":{"line":1,"column":38}}, "meta": { "type": "Identifier", - "start": 28, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 31 - }, - "identifierName": "new" - }, + "start":28,"end":31,"loc":{"start":{"line":1,"column":28},"end":{"line":1,"column":31},"identifierName":"new"}, "name": "new" }, "property": { "type": "Identifier", - "start": 32, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 32 - }, - "end": { - "line": 1, - "column": 38 - }, - "identifierName": "target" - }, + "start":32,"end":38,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":38},"identifierName":"target"}, "name": "target" } } diff --git a/packages/babel-parser/test/fixtures/es2015/meta-properties/new-invalid-prop/input.js b/packages/babel-parser/test/fixtures/es2015/meta-properties/new-invalid-prop/input.js index d775807ddef1..1f159ebd65d2 100644 --- a/packages/babel-parser/test/fixtures/es2015/meta-properties/new-invalid-prop/input.js +++ b/packages/babel-parser/test/fixtures/es2015/meta-properties/new-invalid-prop/input.js @@ -1 +1,3 @@ -new.prop \ No newline at end of file +function f() { + new.prop +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/meta-properties/new-invalid-prop/options.json b/packages/babel-parser/test/fixtures/es2015/meta-properties/new-invalid-prop/options.json deleted file mode 100644 index 8a88f91714d0..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/meta-properties/new-invalid-prop/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "The only valid meta property for new is new.target (1:4)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/meta-properties/new-invalid-prop/output.json b/packages/babel-parser/test/fixtures/es2015/meta-properties/new-invalid-prop/output.json new file mode 100644 index 000000000000..525e9f0ba047 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/meta-properties/new-invalid-prop/output.json @@ -0,0 +1,53 @@ +{ + "type": "File", + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "errors": [ + "SyntaxError: The only valid meta property for new is new.target (2:6)" + ], + "program": { + "type": "Program", + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "id": { + "type": "Identifier", + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"f"}, + "name": "f" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":13,"end":27,"loc":{"start":{"line":1,"column":13},"end":{"line":3,"column":1}}, + "body": [ + { + "type": "ExpressionStatement", + "start":17,"end":25,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":10}}, + "expression": { + "type": "MetaProperty", + "start":17,"end":25,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":10}}, + "meta": { + "type": "Identifier", + "start":17,"end":20,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":5},"identifierName":"new"}, + "name": "new" + }, + "property": { + "type": "Identifier", + "start":21,"end":25,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":10},"identifierName":"prop"}, + "name": "prop" + } + } + } + ], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/meta-properties/new-target-inside-params/output.json b/packages/babel-parser/test/fixtures/es2015/meta-properties/new-target-inside-params/output.json index 7fc8d24d386d..bff0e74c85c6 100644 --- a/packages/babel-parser/test/fixtures/es2015/meta-properties/new-target-inside-params/output.json +++ b/packages/babel-parser/test/fixtures/es2015/meta-properties/new-target-inside-params/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 73, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 41 - } - }, + "start":0,"end":73,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":41}}, "program": { "type": "Program", - "start": 0, - "end": 73, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 41 - } - }, + "start":0,"end":73,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":41}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, "id": { "type": "Identifier", - "start": 9, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "Foo" - }, + "start":9,"end":12,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":12},"identifierName":"Foo"}, "name": "Foo" }, "generator": false, @@ -65,81 +20,23 @@ "params": [ { "type": "AssignmentPattern", - "start": 13, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":13,"end":27,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":27}}, "left": { "type": "Identifier", - "start": 13, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - }, - "identifierName": "x" - }, + "start":13,"end":14,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":14},"identifierName":"x"}, "name": "x" }, "right": { "type": "MetaProperty", - "start": 17, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":17,"end":27,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":27}}, "meta": { "type": "Identifier", - "start": 17, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 20 - }, - "identifierName": "new" - }, + "start":17,"end":20,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":20},"identifierName":"new"}, "name": "new" }, "property": { "type": "Identifier", - "start": 21, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 27 - }, - "identifierName": "target" - }, + "start":21,"end":27,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":27},"identifierName":"target"}, "name": "target" } } @@ -147,51 +44,17 @@ ], "body": { "type": "BlockStatement", - "start": 29, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":29,"end":31,"loc":{"start":{"line":1,"column":29},"end":{"line":1,"column":31}}, "body": [], "directives": [] } }, { "type": "FunctionDeclaration", - "start": 32, - "end": 73, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 41 - } - }, + "start":32,"end":73,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":41}}, "id": { "type": "Identifier", - "start": 41, - "end": 44, - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 12 - }, - "identifierName": "Bar" - }, + "start":41,"end":44,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":12},"identifierName":"Bar"}, "name": "Bar" }, "generator": false, @@ -199,128 +62,37 @@ "params": [], "body": { "type": "BlockStatement", - "start": 47, - "end": 73, - "loc": { - "start": { - "line": 2, - "column": 15 - }, - "end": { - "line": 2, - "column": 41 - } - }, + "start":47,"end":73,"loc":{"start":{"line":2,"column":15},"end":{"line":2,"column":41}}, "body": [ { "type": "ExpressionStatement", - "start": 49, - "end": 71, - "loc": { - "start": { - "line": 2, - "column": 17 - }, - "end": { - "line": 2, - "column": 39 - } - }, + "start":49,"end":71,"loc":{"start":{"line":2,"column":17},"end":{"line":2,"column":39}}, "expression": { "type": "ArrowFunctionExpression", - "start": 49, - "end": 71, - "loc": { - "start": { - "line": 2, - "column": 17 - }, - "end": { - "line": 2, - "column": 39 - } - }, + "start":49,"end":71,"loc":{"start":{"line":2,"column":17},"end":{"line":2,"column":39}}, "id": null, "generator": false, "async": false, "params": [ { "type": "AssignmentPattern", - "start": 50, - "end": 64, - "loc": { - "start": { - "line": 2, - "column": 18 - }, - "end": { - "line": 2, - "column": 32 - } - }, + "start":50,"end":64,"loc":{"start":{"line":2,"column":18},"end":{"line":2,"column":32}}, "left": { "type": "Identifier", - "start": 50, - "end": 51, - "loc": { - "start": { - "line": 2, - "column": 18 - }, - "end": { - "line": 2, - "column": 19 - }, - "identifierName": "x" - }, + "start":50,"end":51,"loc":{"start":{"line":2,"column":18},"end":{"line":2,"column":19},"identifierName":"x"}, "name": "x" }, "right": { "type": "MetaProperty", - "start": 54, - "end": 64, - "loc": { - "start": { - "line": 2, - "column": 22 - }, - "end": { - "line": 2, - "column": 32 - } - }, + "start":54,"end":64,"loc":{"start":{"line":2,"column":22},"end":{"line":2,"column":32}}, "meta": { "type": "Identifier", - "start": 54, - "end": 57, - "loc": { - "start": { - "line": 2, - "column": 22 - }, - "end": { - "line": 2, - "column": 25 - }, - "identifierName": "new" - }, + "start":54,"end":57,"loc":{"start":{"line":2,"column":22},"end":{"line":2,"column":25},"identifierName":"new"}, "name": "new" }, "property": { "type": "Identifier", - "start": 58, - "end": 64, - "loc": { - "start": { - "line": 2, - "column": 26 - }, - "end": { - "line": 2, - "column": 32 - }, - "identifierName": "target" - }, + "start":58,"end":64,"loc":{"start":{"line":2,"column":26},"end":{"line":2,"column":32},"identifierName":"target"}, "name": "target" } } @@ -328,18 +100,7 @@ ], "body": { "type": "BlockStatement", - "start": 69, - "end": 71, - "loc": { - "start": { - "line": 2, - "column": 37 - }, - "end": { - "line": 2, - "column": 39 - } - }, + "start":69,"end":71,"loc":{"start":{"line":2,"column":37},"end":{"line":2,"column":39}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/es2015/meta-properties/new-target-invalid-escaped-new/options.json b/packages/babel-parser/test/fixtures/es2015/meta-properties/new-target-invalid-escaped-new/options.json deleted file mode 100644 index 112b0adc3e61..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/meta-properties/new-target-invalid-escaped-new/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Escape sequence in keyword new (1:23)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/meta-properties/new-target-invalid-escaped-new/output.json b/packages/babel-parser/test/fixtures/es2015/meta-properties/new-target-invalid-escaped-new/output.json new file mode 100644 index 000000000000..95fcf34a01ab --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/meta-properties/new-target-invalid-escaped-new/output.json @@ -0,0 +1,53 @@ +{ + "type": "File", + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, + "errors": [ + "SyntaxError: Escape sequence in keyword new (1:15)" + ], + "program": { + "type": "Program", + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, + "id": { + "type": "Identifier", + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"f"}, + "name": "f" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":13,"end":33,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":33}}, + "body": [ + { + "type": "ExpressionStatement", + "start":15,"end":31,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":31}}, + "expression": { + "type": "MetaProperty", + "start":15,"end":30,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":30}}, + "meta": { + "type": "Identifier", + "start":15,"end":23,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":23},"identifierName":"new"}, + "name": "new" + }, + "property": { + "type": "Identifier", + "start":24,"end":30,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":30},"identifierName":"target"}, + "name": "target" + } + } + } + ], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/meta-properties/new-target-invalid-escaped-target/options.json b/packages/babel-parser/test/fixtures/es2015/meta-properties/new-target-invalid-escaped-target/options.json deleted file mode 100644 index 4f4b2be4c186..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/meta-properties/new-target-invalid-escaped-target/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "The only valid meta property for new is new.target (1:19)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/meta-properties/new-target-invalid-escaped-target/output.json b/packages/babel-parser/test/fixtures/es2015/meta-properties/new-target-invalid-escaped-target/output.json new file mode 100644 index 000000000000..6524f1e405ef --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/meta-properties/new-target-invalid-escaped-target/output.json @@ -0,0 +1,53 @@ +{ + "type": "File", + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, + "errors": [ + "SyntaxError: The only valid meta property for new is new.target (1:19)" + ], + "program": { + "type": "Program", + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, + "id": { + "type": "Identifier", + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"f"}, + "name": "f" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":13,"end":33,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":33}}, + "body": [ + { + "type": "ExpressionStatement", + "start":15,"end":31,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":31}}, + "expression": { + "type": "MetaProperty", + "start":15,"end":30,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":30}}, + "meta": { + "type": "Identifier", + "start":15,"end":18,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":18},"identifierName":"new"}, + "name": "new" + }, + "property": { + "type": "Identifier", + "start":19,"end":30,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":30},"identifierName":"target"}, + "name": "target" + } + } + } + ], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/meta-properties/new-target-invalid/options.json b/packages/babel-parser/test/fixtures/es2015/meta-properties/new-target-invalid/options.json deleted file mode 100644 index 092a825444ad..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/meta-properties/new-target-invalid/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "new.target can only be used in functions (1:0)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/meta-properties/new-target-invalid/output.json b/packages/babel-parser/test/fixtures/es2015/meta-properties/new-target-invalid/output.json new file mode 100644 index 000000000000..eac0709d91ee --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/meta-properties/new-target-invalid/output.json @@ -0,0 +1,34 @@ +{ + "type": "File", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "errors": [ + "SyntaxError: new.target can only be used in functions (1:0)" + ], + "program": { + "type": "Program", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "expression": { + "type": "MetaProperty", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "meta": { + "type": "Identifier", + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3},"identifierName":"new"}, + "name": "new" + }, + "property": { + "type": "Identifier", + "start":4,"end":10,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":10},"identifierName":"target"}, + "name": "target" + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/meta-properties/new-target/output.json b/packages/babel-parser/test/fixtures/es2015/meta-properties/new-target/output.json index 84732b39dacd..6e00a6fc7d62 100644 --- a/packages/babel-parser/test/fixtures/es2015/meta-properties/new-target/output.json +++ b/packages/babel-parser/test/fixtures/es2015/meta-properties/new-target/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, "program": { "type": "Program", - "start": 0, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, "id": { "type": "Identifier", - "start": 9, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "foo" - }, + "start":9,"end":12,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":12},"identifierName":"foo"}, "name": "foo" }, "generator": false, @@ -65,79 +20,22 @@ "params": [], "body": { "type": "BlockStatement", - "start": 15, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":15,"end":29,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":29}}, "body": [ { "type": "ExpressionStatement", - "start": 17, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":17,"end":27,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":27}}, "expression": { "type": "MetaProperty", - "start": 17, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":17,"end":27,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":27}}, "meta": { "type": "Identifier", - "start": 17, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 20 - }, - "identifierName": "new" - }, + "start":17,"end":20,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":20},"identifierName":"new"}, "name": "new" }, "property": { "type": "Identifier", - "start": 21, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 27 - }, - "identifierName": "target" - }, + "start":21,"end":27,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":27},"identifierName":"target"}, "name": "target" } } diff --git a/packages/babel-parser/test/fixtures/es2015/meta-properties/statement/output.json b/packages/babel-parser/test/fixtures/es2015/meta-properties/statement/output.json index 80af5ec9a8db..3cee11c8d0e0 100644 --- a/packages/babel-parser/test/fixtures/es2015/meta-properties/statement/output.json +++ b/packages/babel-parser/test/fixtures/es2015/meta-properties/statement/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "id": { "type": "Identifier", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - }, - "identifierName": "A" - }, + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"A"}, "name": "A" }, "generator": false, @@ -65,79 +20,22 @@ "params": [], "body": { "type": "BlockStatement", - "start": 13, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":13,"end":30,"loc":{"start":{"line":1,"column":13},"end":{"line":3,"column":1}}, "body": [ { "type": "ExpressionStatement", - "start": 17, - "end": 28, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 13 - } - }, + "start":17,"end":28,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":13}}, "expression": { "type": "MetaProperty", - "start": 17, - "end": 27, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 12 - } - }, + "start":17,"end":27,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":12}}, "meta": { "type": "Identifier", - "start": 17, - "end": 20, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 5 - }, - "identifierName": "new" - }, + "start":17,"end":20,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":5},"identifierName":"new"}, "name": "new" }, "property": { "type": "Identifier", - "start": 21, - "end": 27, - "loc": { - "start": { - "line": 2, - "column": 6 - }, - "end": { - "line": 2, - "column": 12 - }, - "identifierName": "target" - }, + "start":21,"end":27,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":12},"identifierName":"target"}, "name": "target" } } diff --git a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-export-default-and-export-as-default/options.json b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-export-default-and-export-as-default/options.json index 275e6a57f95f..2104ca43283f 100644 --- a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-export-default-and-export-as-default/options.json +++ b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-export-default-and-export-as-default/options.json @@ -1,3 +1,3 @@ { - "throws": "Only one default export allowed per module. (2:9)" + "sourceType": "module" } diff --git a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-export-default-and-export-as-default/output.json b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-export-default-and-export-as-default/output.json new file mode 100644 index 000000000000..c2f48e113192 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-export-default-and-export-as-default/output.json @@ -0,0 +1,61 @@ +{ + "type": "File", + "start":0,"end":56,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":26}}, + "errors": [ + "SyntaxError: Only one default export allowed per module. (2:9)", + "SyntaxError: Export 'foo' is not defined (2:9)" + ], + "program": { + "type": "Program", + "start":0,"end":56,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":26}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExportDefaultDeclaration", + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, + "declaration": { + "type": "FunctionDeclaration", + "start":15,"end":28,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":28}}, + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":26,"end":28,"loc":{"start":{"line":1,"column":26},"end":{"line":1,"column":28}}, + "body": [], + "directives": [] + } + } + }, + { + "type": "EmptyStatement", + "start":28,"end":29,"loc":{"start":{"line":1,"column":28},"end":{"line":1,"column":29}} + }, + { + "type": "ExportNamedDeclaration", + "start":30,"end":56,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":26}}, + "specifiers": [ + { + "type": "ExportSpecifier", + "start":39,"end":53,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":23}}, + "local": { + "type": "Identifier", + "start":39,"end":42,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":12},"identifierName":"foo"}, + "name": "foo" + }, + "exported": { + "type": "Identifier", + "start":46,"end":53,"loc":{"start":{"line":2,"column":16},"end":{"line":2,"column":23},"identifierName":"default"}, + "name": "default" + } + } + ], + "source": null, + "declaration": null + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-export-default/options.json b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-export-default/options.json index 1ec6a5168f14..2104ca43283f 100644 --- a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-export-default/options.json +++ b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-export-default/options.json @@ -1,3 +1,3 @@ { - "throws": "Only one default export allowed per module. (2:0)" + "sourceType": "module" } diff --git a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-export-default/output.json b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-export-default/output.json new file mode 100644 index 000000000000..59fd6339b34e --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-export-default/output.json @@ -0,0 +1,47 @@ +{ + "type": "File", + "start":0,"end":48,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":29}}, + "errors": [ + "SyntaxError: Only one default export allowed per module. (2:0)" + ], + "program": { + "type": "Program", + "start":0,"end":48,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":29}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExportDefaultDeclaration", + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, + "declaration": { + "type": "ObjectExpression", + "start":15,"end":17,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":17}}, + "properties": [] + } + }, + { + "type": "ExportDefaultDeclaration", + "start":19,"end":47,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":28}}, + "declaration": { + "type": "FunctionDeclaration", + "start":34,"end":47,"loc":{"start":{"line":2,"column":15},"end":{"line":2,"column":28}}, + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":45,"end":47,"loc":{"start":{"line":2,"column":26},"end":{"line":2,"column":28}}, + "body": [], + "directives": [] + } + } + }, + { + "type": "EmptyStatement", + "start":47,"end":48,"loc":{"start":{"line":2,"column":28},"end":{"line":2,"column":29}} + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-builtin/output.json b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-builtin/output.json index 7d37c8dcb67b..2b03656372c1 100644 --- a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-builtin/output.json +++ b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-builtin/output.json @@ -1,94 +1,27 @@ { "type": "File", - "start": 0, - "end": 41, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 20 - } - }, + "start":0,"end":41,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":20}}, "program": { "type": "Program", - "start": 0, - "end": 41, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 20 - } - }, + "start":0,"end":41,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":20}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, "declarations": [ { "type": "VariableDeclarator", - "start": 6, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":6,"end":18,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":18}}, "id": { "type": "Identifier", - "start": 6, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 14 - }, - "identifierName": "toString" - }, + "start":6,"end":14,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":14},"identifierName":"toString"}, "name": "toString" }, "init": { "type": "NumericLiteral", - "start": 17, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":17,"end":18,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":18}}, "extra": { "rawValue": 1, "raw": "1" @@ -101,65 +34,19 @@ }, { "type": "ExportNamedDeclaration", - "start": 21, - "end": 41, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 20 - } - }, + "start":21,"end":41,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":20}}, "specifiers": [ { "type": "ExportSpecifier", - "start": 30, - "end": 38, - "loc": { - "start": { - "line": 3, - "column": 9 - }, - "end": { - "line": 3, - "column": 17 - } - }, + "start":30,"end":38,"loc":{"start":{"line":3,"column":9},"end":{"line":3,"column":17}}, "local": { "type": "Identifier", - "start": 30, - "end": 38, - "loc": { - "start": { - "line": 3, - "column": 9 - }, - "end": { - "line": 3, - "column": 17 - }, - "identifierName": "toString" - }, + "start":30,"end":38,"loc":{"start":{"line":3,"column":9},"end":{"line":3,"column":17},"identifierName":"toString"}, "name": "toString" }, "exported": { "type": "Identifier", - "start": 30, - "end": 38, - "loc": { - "start": { - "line": 3, - "column": 9 - }, - "end": { - "line": 3, - "column": 17 - }, - "identifierName": "toString" - }, + "start":30,"end":38,"loc":{"start":{"line":3,"column":9},"end":{"line":3,"column":17},"identifierName":"toString"}, "name": "toString" } } diff --git a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-class-declaration/options.json b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-class-declaration/options.json index 3bdafe893282..2104ca43283f 100644 --- a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-class-declaration/options.json +++ b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-class-declaration/options.json @@ -1,3 +1,3 @@ { - "throws": "`Foo` has already been exported. Exported identifiers must be unique. (2:0)" + "sourceType": "module" } diff --git a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-class-declaration/output.json b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-class-declaration/output.json new file mode 100644 index 000000000000..2c706885c52f --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-class-declaration/output.json @@ -0,0 +1,63 @@ +{ + "type": "File", + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":20}}, + "errors": [ + "SyntaxError: `Foo` has already been exported. Exported identifiers must be unique. (2:0)" + ], + "program": { + "type": "Program", + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":20}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExportNamedDeclaration", + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, + "specifiers": [ + { + "type": "ExportSpecifier", + "start":9,"end":12,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":12}}, + "local": { + "type": "Identifier", + "start":9,"end":12,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":12},"identifierName":"Foo"}, + "name": "Foo" + }, + "exported": { + "type": "Identifier", + "start":9,"end":12,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":12},"identifierName":"Foo"}, + "name": "Foo" + } + } + ], + "source": null, + "declaration": null + }, + { + "type": "ExportNamedDeclaration", + "start":16,"end":35,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":19}}, + "specifiers": [], + "source": null, + "declaration": { + "type": "ClassDeclaration", + "start":23,"end":35,"loc":{"start":{"line":2,"column":7},"end":{"line":2,"column":19}}, + "id": { + "type": "Identifier", + "start":29,"end":32,"loc":{"start":{"line":2,"column":13},"end":{"line":2,"column":16},"identifierName":"Foo"}, + "name": "Foo" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":33,"end":35,"loc":{"start":{"line":2,"column":17},"end":{"line":2,"column":19}}, + "body": [] + } + } + }, + { + "type": "EmptyStatement", + "start":35,"end":36,"loc":{"start":{"line":2,"column":19},"end":{"line":2,"column":20}} + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring-assignment/options.json b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring-assignment/options.json index d3d3a199e6e0..2104ca43283f 100644 --- a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring-assignment/options.json +++ b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring-assignment/options.json @@ -1,4 +1,3 @@ { - "sourceType": "module", - "throws": "`foo` has already been exported. Exported identifiers must be unique. (2:15)" -} \ No newline at end of file + "sourceType": "module" +} diff --git a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring-assignment/output.json b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring-assignment/output.json new file mode 100644 index 000000000000..254af5e59656 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring-assignment/output.json @@ -0,0 +1,99 @@ +{ + "type": "File", + "start":0,"end":47,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":31}}, + "errors": [ + "SyntaxError: `foo` has already been exported. Exported identifiers must be unique. (2:15)" + ], + "program": { + "type": "Program", + "start":0,"end":47,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":31}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExportNamedDeclaration", + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, + "specifiers": [ + { + "type": "ExportSpecifier", + "start":9,"end":12,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":12}}, + "local": { + "type": "Identifier", + "start":9,"end":12,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":12},"identifierName":"foo"}, + "name": "foo" + }, + "exported": { + "type": "Identifier", + "start":9,"end":12,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":12},"identifierName":"foo"}, + "name": "foo" + } + } + ], + "source": null, + "declaration": null + }, + { + "type": "ExportNamedDeclaration", + "start":16,"end":47,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":31}}, + "specifiers": [], + "source": null, + "declaration": { + "type": "VariableDeclaration", + "start":23,"end":47,"loc":{"start":{"line":2,"column":7},"end":{"line":2,"column":31}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":29,"end":46,"loc":{"start":{"line":2,"column":13},"end":{"line":2,"column":30}}, + "id": { + "type": "ObjectPattern", + "start":29,"end":40,"loc":{"start":{"line":2,"column":13},"end":{"line":2,"column":24}}, + "properties": [ + { + "type": "ObjectProperty", + "start":31,"end":38,"loc":{"start":{"line":2,"column":15},"end":{"line":2,"column":22}}, + "method": false, + "key": { + "type": "Identifier", + "start":31,"end":34,"loc":{"start":{"line":2,"column":15},"end":{"line":2,"column":18},"identifierName":"foo"}, + "name": "foo" + }, + "computed": false, + "shorthand": true, + "value": { + "type": "AssignmentPattern", + "start":31,"end":38,"loc":{"start":{"line":2,"column":15},"end":{"line":2,"column":22}}, + "left": { + "type": "Identifier", + "start":31,"end":34,"loc":{"start":{"line":2,"column":15},"end":{"line":2,"column":18},"identifierName":"foo"}, + "name": "foo" + }, + "right": { + "type": "NumericLiteral", + "start":37,"end":38,"loc":{"start":{"line":2,"column":21},"end":{"line":2,"column":22}}, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + }, + "extra": { + "shorthand": true + } + } + ] + }, + "init": { + "type": "Identifier", + "start":43,"end":46,"loc":{"start":{"line":2,"column":27},"end":{"line":2,"column":30},"identifierName":"bar"}, + "name": "bar" + } + } + ], + "kind": "const" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring/output.json b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring/output.json index 87964bf52560..bf1259afc4a9 100644 --- a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring/output.json +++ b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring/output.json @@ -1,143 +1,42 @@ { "type": "File", - "start": 0, - "end": 522, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 12, - "column": 40 - } - }, + "start":0,"end":522,"loc":{"start":{"line":1,"column":0},"end":{"line":12,"column":40}}, "program": { "type": "Program", - "start": 0, - "end": 522, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 12, - "column": 40 - } - }, + "start":0,"end":522,"loc":{"start":{"line":1,"column":0},"end":{"line":12,"column":40}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExportNamedDeclaration", - "start": 0, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, "specifiers": [], "source": null, "declaration": { "type": "VariableDeclaration", - "start": 7, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":7,"end":27,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":27}}, "declarations": [ { "type": "VariableDeclarator", - "start": 13, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":13,"end":26,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":26}}, "id": { "type": "ObjectPattern", - "start": 13, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":13,"end":20,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":20}}, "properties": [ { "type": "ObjectProperty", - "start": 15, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":15,"end":18,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":18}}, "method": false, "key": { "type": "Identifier", - "start": 15, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 18 - }, - "identifierName": "foo" - }, + "start":15,"end":18,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":18},"identifierName":"foo"}, "name": "foo" }, "computed": false, "shorthand": true, "value": { "type": "Identifier", - "start": 15, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 18 - }, - "identifierName": "foo" - }, + "start":15,"end":18,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":18},"identifierName":"foo"}, "name": "foo" }, "extra": { @@ -148,19 +47,7 @@ }, "init": { "type": "Identifier", - "start": 23, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 26 - }, - "identifierName": "bar" - }, + "start":23,"end":26,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":26},"identifierName":"bar"}, "name": "bar" } } @@ -170,113 +57,34 @@ }, { "type": "ExportNamedDeclaration", - "start": 28, - "end": 61, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 33 - } - }, + "start":28,"end":61,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":33}}, "specifiers": [], "source": null, "declaration": { "type": "VariableDeclaration", - "start": 35, - "end": 61, - "loc": { - "start": { - "line": 2, - "column": 7 - }, - "end": { - "line": 2, - "column": 33 - } - }, + "start":35,"end":61,"loc":{"start":{"line":2,"column":7},"end":{"line":2,"column":33}}, "declarations": [ { "type": "VariableDeclarator", - "start": 41, - "end": 60, - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 32 - } - }, + "start":41,"end":60,"loc":{"start":{"line":2,"column":13},"end":{"line":2,"column":32}}, "id": { "type": "ObjectPattern", - "start": 41, - "end": 54, - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 26 - } - }, + "start":41,"end":54,"loc":{"start":{"line":2,"column":13},"end":{"line":2,"column":26}}, "properties": [ { "type": "ObjectProperty", - "start": 43, - "end": 52, - "loc": { - "start": { - "line": 2, - "column": 15 - }, - "end": { - "line": 2, - "column": 24 - } - }, + "start":43,"end":52,"loc":{"start":{"line":2,"column":15},"end":{"line":2,"column":24}}, "method": false, "key": { "type": "Identifier", - "start": 43, - "end": 46, - "loc": { - "start": { - "line": 2, - "column": 15 - }, - "end": { - "line": 2, - "column": 18 - }, - "identifierName": "foo" - }, + "start":43,"end":46,"loc":{"start":{"line":2,"column":15},"end":{"line":2,"column":18},"identifierName":"foo"}, "name": "foo" }, "computed": false, "shorthand": false, "value": { "type": "Identifier", - "start": 48, - "end": 52, - "loc": { - "start": { - "line": 2, - "column": 20 - }, - "end": { - "line": 2, - "column": 24 - }, - "identifierName": "foo2" - }, + "start":48,"end":52,"loc":{"start":{"line":2,"column":20},"end":{"line":2,"column":24},"identifierName":"foo2"}, "name": "foo2" } } @@ -284,19 +92,7 @@ }, "init": { "type": "Identifier", - "start": 57, - "end": 60, - "loc": { - "start": { - "line": 2, - "column": 29 - }, - "end": { - "line": 2, - "column": 32 - }, - "identifierName": "bar" - }, + "start":57,"end":60,"loc":{"start":{"line":2,"column":29},"end":{"line":2,"column":32},"identifierName":"bar"}, "name": "bar" } } @@ -306,162 +102,49 @@ }, { "type": "ExportNamedDeclaration", - "start": 62, - "end": 98, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 36 - } - }, + "start":62,"end":98,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":36}}, "specifiers": [], "source": null, "declaration": { "type": "VariableDeclaration", - "start": 69, - "end": 98, - "loc": { - "start": { - "line": 3, - "column": 7 - }, - "end": { - "line": 3, - "column": 36 - } - }, + "start":69,"end":98,"loc":{"start":{"line":3,"column":7},"end":{"line":3,"column":36}}, "declarations": [ { "type": "VariableDeclarator", - "start": 75, - "end": 97, - "loc": { - "start": { - "line": 3, - "column": 13 - }, - "end": { - "line": 3, - "column": 35 - } - }, + "start":75,"end":97,"loc":{"start":{"line":3,"column":13},"end":{"line":3,"column":35}}, "id": { "type": "ObjectPattern", - "start": 75, - "end": 91, - "loc": { - "start": { - "line": 3, - "column": 13 - }, - "end": { - "line": 3, - "column": 29 - } - }, + "start":75,"end":91,"loc":{"start":{"line":3,"column":13},"end":{"line":3,"column":29}}, "properties": [ { "type": "ObjectProperty", - "start": 77, - "end": 89, - "loc": { - "start": { - "line": 3, - "column": 15 - }, - "end": { - "line": 3, - "column": 27 - } - }, + "start":77,"end":89,"loc":{"start":{"line":3,"column":15},"end":{"line":3,"column":27}}, "method": false, "key": { "type": "Identifier", - "start": 77, - "end": 80, - "loc": { - "start": { - "line": 3, - "column": 15 - }, - "end": { - "line": 3, - "column": 18 - }, - "identifierName": "foo" - }, + "start":77,"end":80,"loc":{"start":{"line":3,"column":15},"end":{"line":3,"column":18},"identifierName":"foo"}, "name": "foo" }, "computed": false, "shorthand": false, "value": { "type": "ObjectPattern", - "start": 82, - "end": 89, - "loc": { - "start": { - "line": 3, - "column": 20 - }, - "end": { - "line": 3, - "column": 27 - } - }, + "start":82,"end":89,"loc":{"start":{"line":3,"column":20},"end":{"line":3,"column":27}}, "properties": [ { "type": "ObjectProperty", - "start": 84, - "end": 87, - "loc": { - "start": { - "line": 3, - "column": 22 - }, - "end": { - "line": 3, - "column": 25 - } - }, + "start":84,"end":87,"loc":{"start":{"line":3,"column":22},"end":{"line":3,"column":25}}, "method": false, "key": { "type": "Identifier", - "start": 84, - "end": 87, - "loc": { - "start": { - "line": 3, - "column": 22 - }, - "end": { - "line": 3, - "column": 25 - }, - "identifierName": "baz" - }, + "start":84,"end":87,"loc":{"start":{"line":3,"column":22},"end":{"line":3,"column":25},"identifierName":"baz"}, "name": "baz" }, "computed": false, "shorthand": true, "value": { "type": "Identifier", - "start": 84, - "end": 87, - "loc": { - "start": { - "line": 3, - "column": 22 - }, - "end": { - "line": 3, - "column": 25 - }, - "identifierName": "baz" - }, + "start":84,"end":87,"loc":{"start":{"line":3,"column":22},"end":{"line":3,"column":25},"identifierName":"baz"}, "name": "baz" }, "extra": { @@ -475,19 +158,7 @@ }, "init": { "type": "Identifier", - "start": 94, - "end": 97, - "loc": { - "start": { - "line": 3, - "column": 32 - }, - "end": { - "line": 3, - "column": 35 - }, - "identifierName": "bar" - }, + "start":94,"end":97,"loc":{"start":{"line":3,"column":32},"end":{"line":3,"column":35},"identifierName":"bar"}, "name": "bar" } } @@ -497,211 +168,64 @@ }, { "type": "ExportNamedDeclaration", - "start": 99, - "end": 145, - "loc": { - "start": { - "line": 4, - "column": 0 - }, - "end": { - "line": 4, - "column": 46 - } - }, + "start":99,"end":145,"loc":{"start":{"line":4,"column":0},"end":{"line":4,"column":46}}, "specifiers": [], "source": null, "declaration": { "type": "VariableDeclaration", - "start": 106, - "end": 145, - "loc": { - "start": { - "line": 4, - "column": 7 - }, - "end": { - "line": 4, - "column": 46 - } - }, + "start":106,"end":145,"loc":{"start":{"line":4,"column":7},"end":{"line":4,"column":46}}, "declarations": [ { "type": "VariableDeclarator", - "start": 112, - "end": 144, - "loc": { - "start": { - "line": 4, - "column": 13 - }, - "end": { - "line": 4, - "column": 45 - } - }, + "start":112,"end":144,"loc":{"start":{"line":4,"column":13},"end":{"line":4,"column":45}}, "id": { "type": "ObjectPattern", - "start": 112, - "end": 138, - "loc": { - "start": { - "line": 4, - "column": 13 - }, - "end": { - "line": 4, - "column": 39 - } - }, + "start":112,"end":138,"loc":{"start":{"line":4,"column":13},"end":{"line":4,"column":39}}, "properties": [ { "type": "ObjectProperty", - "start": 114, - "end": 136, - "loc": { - "start": { - "line": 4, - "column": 15 - }, - "end": { - "line": 4, - "column": 37 - } - }, + "start":114,"end":136,"loc":{"start":{"line":4,"column":15},"end":{"line":4,"column":37}}, "method": false, "key": { "type": "Identifier", - "start": 114, - "end": 117, - "loc": { - "start": { - "line": 4, - "column": 15 - }, - "end": { - "line": 4, - "column": 18 - }, - "identifierName": "foo" - }, + "start":114,"end":117,"loc":{"start":{"line":4,"column":15},"end":{"line":4,"column":18},"identifierName":"foo"}, "name": "foo" }, "computed": false, "shorthand": false, "value": { "type": "ObjectPattern", - "start": 119, - "end": 136, - "loc": { - "start": { - "line": 4, - "column": 20 - }, - "end": { - "line": 4, - "column": 37 - } - }, + "start":119,"end":136,"loc":{"start":{"line":4,"column":20},"end":{"line":4,"column":37}}, "properties": [ { "type": "ObjectProperty", - "start": 121, - "end": 134, - "loc": { - "start": { - "line": 4, - "column": 22 - }, - "end": { - "line": 4, - "column": 35 - } - }, + "start":121,"end":134,"loc":{"start":{"line":4,"column":22},"end":{"line":4,"column":35}}, "method": false, "key": { "type": "Identifier", - "start": 121, - "end": 124, - "loc": { - "start": { - "line": 4, - "column": 22 - }, - "end": { - "line": 4, - "column": 25 - }, - "identifierName": "baz" - }, + "start":121,"end":124,"loc":{"start":{"line":4,"column":22},"end":{"line":4,"column":25},"identifierName":"baz"}, "name": "baz" }, "computed": false, "shorthand": false, "value": { "type": "ObjectPattern", - "start": 127, - "end": 134, - "loc": { - "start": { - "line": 4, - "column": 28 - }, - "end": { - "line": 4, - "column": 35 - } - }, + "start":127,"end":134,"loc":{"start":{"line":4,"column":28},"end":{"line":4,"column":35}}, "properties": [ { "type": "ObjectProperty", - "start": 129, - "end": 132, - "loc": { - "start": { - "line": 4, - "column": 30 - }, - "end": { - "line": 4, - "column": 33 - } - }, + "start":129,"end":132,"loc":{"start":{"line":4,"column":30},"end":{"line":4,"column":33}}, "method": false, "key": { "type": "Identifier", - "start": 129, - "end": 132, - "loc": { - "start": { - "line": 4, - "column": 30 - }, - "end": { - "line": 4, - "column": 33 - }, - "identifierName": "qux" - }, + "start":129,"end":132,"loc":{"start":{"line":4,"column":30},"end":{"line":4,"column":33},"identifierName":"qux"}, "name": "qux" }, "computed": false, "shorthand": true, "value": { "type": "Identifier", - "start": 129, - "end": 132, - "loc": { - "start": { - "line": 4, - "column": 30 - }, - "end": { - "line": 4, - "column": 33 - }, - "identifierName": "qux" - }, + "start":129,"end":132,"loc":{"start":{"line":4,"column":30},"end":{"line":4,"column":33},"identifierName":"qux"}, "name": "qux" }, "extra": { @@ -718,19 +242,7 @@ }, "init": { "type": "Identifier", - "start": 141, - "end": 144, - "loc": { - "start": { - "line": 4, - "column": 42 - }, - "end": { - "line": 4, - "column": 45 - }, - "identifierName": "bar" - }, + "start":141,"end":144,"loc":{"start":{"line":4,"column":42},"end":{"line":4,"column":45},"identifierName":"bar"}, "name": "bar" } } @@ -740,211 +252,64 @@ }, { "type": "ExportNamedDeclaration", - "start": 146, - "end": 199, - "loc": { - "start": { - "line": 5, - "column": 0 - }, - "end": { - "line": 5, - "column": 53 - } - }, + "start":146,"end":199,"loc":{"start":{"line":5,"column":0},"end":{"line":5,"column":53}}, "specifiers": [], "source": null, "declaration": { "type": "VariableDeclaration", - "start": 153, - "end": 199, - "loc": { - "start": { - "line": 5, - "column": 7 - }, - "end": { - "line": 5, - "column": 53 - } - }, + "start":153,"end":199,"loc":{"start":{"line":5,"column":7},"end":{"line":5,"column":53}}, "declarations": [ { "type": "VariableDeclarator", - "start": 159, - "end": 198, - "loc": { - "start": { - "line": 5, - "column": 13 - }, - "end": { - "line": 5, - "column": 52 - } - }, + "start":159,"end":198,"loc":{"start":{"line":5,"column":13},"end":{"line":5,"column":52}}, "id": { "type": "ObjectPattern", - "start": 159, - "end": 192, - "loc": { - "start": { - "line": 5, - "column": 13 - }, - "end": { - "line": 5, - "column": 46 - } - }, + "start":159,"end":192,"loc":{"start":{"line":5,"column":13},"end":{"line":5,"column":46}}, "properties": [ { "type": "ObjectProperty", - "start": 161, - "end": 184, - "loc": { - "start": { - "line": 5, - "column": 15 - }, - "end": { - "line": 5, - "column": 38 - } - }, + "start":161,"end":184,"loc":{"start":{"line":5,"column":15},"end":{"line":5,"column":38}}, "method": false, "key": { "type": "Identifier", - "start": 161, - "end": 164, - "loc": { - "start": { - "line": 5, - "column": 15 - }, - "end": { - "line": 5, - "column": 18 - }, - "identifierName": "foo" - }, + "start":161,"end":164,"loc":{"start":{"line":5,"column":15},"end":{"line":5,"column":18},"identifierName":"foo"}, "name": "foo" }, "computed": false, "shorthand": false, "value": { "type": "ObjectPattern", - "start": 166, - "end": 184, - "loc": { - "start": { - "line": 5, - "column": 20 - }, - "end": { - "line": 5, - "column": 38 - } - }, + "start":166,"end":184,"loc":{"start":{"line":5,"column":20},"end":{"line":5,"column":38}}, "properties": [ { "type": "ObjectProperty", - "start": 168, - "end": 182, - "loc": { - "start": { - "line": 5, - "column": 22 - }, - "end": { - "line": 5, - "column": 36 - } - }, + "start":168,"end":182,"loc":{"start":{"line":5,"column":22},"end":{"line":5,"column":36}}, "method": false, "key": { "type": "Identifier", - "start": 168, - "end": 171, - "loc": { - "start": { - "line": 5, - "column": 22 - }, - "end": { - "line": 5, - "column": 25 - }, - "identifierName": "baz" - }, + "start":168,"end":171,"loc":{"start":{"line":5,"column":22},"end":{"line":5,"column":25},"identifierName":"baz"}, "name": "baz" }, "computed": false, "shorthand": false, "value": { "type": "ObjectPattern", - "start": 174, - "end": 182, - "loc": { - "start": { - "line": 5, - "column": 28 - }, - "end": { - "line": 5, - "column": 36 - } - }, + "start":174,"end":182,"loc":{"start":{"line":5,"column":28},"end":{"line":5,"column":36}}, "properties": [ { "type": "ObjectProperty", - "start": 176, - "end": 180, - "loc": { - "start": { - "line": 5, - "column": 30 - }, - "end": { - "line": 5, - "column": 34 - } - }, + "start":176,"end":180,"loc":{"start":{"line":5,"column":30},"end":{"line":5,"column":34}}, "method": false, "key": { "type": "Identifier", - "start": 176, - "end": 180, - "loc": { - "start": { - "line": 5, - "column": 30 - }, - "end": { - "line": 5, - "column": 34 - }, - "identifierName": "qux2" - }, + "start":176,"end":180,"loc":{"start":{"line":5,"column":30},"end":{"line":5,"column":34},"identifierName":"qux2"}, "name": "qux2" }, "computed": false, "shorthand": true, "value": { "type": "Identifier", - "start": 176, - "end": 180, - "loc": { - "start": { - "line": 5, - "column": 30 - }, - "end": { - "line": 5, - "column": 34 - }, - "identifierName": "qux2" - }, + "start":176,"end":180,"loc":{"start":{"line":5,"column":30},"end":{"line":5,"column":34},"identifierName":"qux2"}, "name": "qux2" }, "extra": { @@ -959,53 +324,18 @@ }, { "type": "ObjectProperty", - "start": 186, - "end": 190, - "loc": { - "start": { - "line": 5, - "column": 40 - }, - "end": { - "line": 5, - "column": 44 - } - }, + "start":186,"end":190,"loc":{"start":{"line":5,"column":40},"end":{"line":5,"column":44}}, "method": false, "key": { "type": "Identifier", - "start": 186, - "end": 190, - "loc": { - "start": { - "line": 5, - "column": 40 - }, - "end": { - "line": 5, - "column": 44 - }, - "identifierName": "foo3" - }, + "start":186,"end":190,"loc":{"start":{"line":5,"column":40},"end":{"line":5,"column":44},"identifierName":"foo3"}, "name": "foo3" }, "computed": false, "shorthand": true, "value": { "type": "Identifier", - "start": 186, - "end": 190, - "loc": { - "start": { - "line": 5, - "column": 40 - }, - "end": { - "line": 5, - "column": 44 - }, - "identifierName": "foo3" - }, + "start":186,"end":190,"loc":{"start":{"line":5,"column":40},"end":{"line":5,"column":44},"identifierName":"foo3"}, "name": "foo3" }, "extra": { @@ -1016,19 +346,7 @@ }, "init": { "type": "Identifier", - "start": 195, - "end": 198, - "loc": { - "start": { - "line": 5, - "column": 49 - }, - "end": { - "line": 5, - "column": 52 - }, - "identifierName": "bar" - }, + "start":195,"end":198,"loc":{"start":{"line":5,"column":49},"end":{"line":5,"column":52},"identifierName":"bar"}, "name": "bar" } } @@ -1038,98 +356,30 @@ }, { "type": "ExportNamedDeclaration", - "start": 200, - "end": 226, - "loc": { - "start": { - "line": 6, - "column": 0 - }, - "end": { - "line": 6, - "column": 26 - } - }, + "start":200,"end":226,"loc":{"start":{"line":6,"column":0},"end":{"line":6,"column":26}}, "specifiers": [], "source": null, "declaration": { "type": "VariableDeclaration", - "start": 207, - "end": 226, - "loc": { - "start": { - "line": 6, - "column": 7 - }, - "end": { - "line": 6, - "column": 26 - } - }, + "start":207,"end":226,"loc":{"start":{"line":6,"column":7},"end":{"line":6,"column":26}}, "declarations": [ { "type": "VariableDeclarator", - "start": 213, - "end": 225, - "loc": { - "start": { - "line": 6, - "column": 13 - }, - "end": { - "line": 6, - "column": 25 - } - }, + "start":213,"end":225,"loc":{"start":{"line":6,"column":13},"end":{"line":6,"column":25}}, "id": { "type": "ArrayPattern", - "start": 213, - "end": 219, - "loc": { - "start": { - "line": 6, - "column": 13 - }, - "end": { - "line": 6, - "column": 19 - } - }, + "start":213,"end":219,"loc":{"start":{"line":6,"column":13},"end":{"line":6,"column":19}}, "elements": [ { "type": "Identifier", - "start": 214, - "end": 218, - "loc": { - "start": { - "line": 6, - "column": 14 - }, - "end": { - "line": 6, - "column": 18 - }, - "identifierName": "foo4" - }, + "start":214,"end":218,"loc":{"start":{"line":6,"column":14},"end":{"line":6,"column":18},"identifierName":"foo4"}, "name": "foo4" } ] }, "init": { "type": "Identifier", - "start": 222, - "end": 225, - "loc": { - "start": { - "line": 6, - "column": 22 - }, - "end": { - "line": 6, - "column": 25 - }, - "identifierName": "bar" - }, + "start":222,"end":225,"loc":{"start":{"line":6,"column":22},"end":{"line":6,"column":25},"identifierName":"bar"}, "name": "bar" } } @@ -1139,94 +389,27 @@ }, { "type": "ExportNamedDeclaration", - "start": 227, - "end": 255, - "loc": { - "start": { - "line": 7, - "column": 0 - }, - "end": { - "line": 7, - "column": 28 - } - }, + "start":227,"end":255,"loc":{"start":{"line":7,"column":0},"end":{"line":7,"column":28}}, "specifiers": [], "source": null, "declaration": { "type": "VariableDeclaration", - "start": 234, - "end": 255, - "loc": { - "start": { - "line": 7, - "column": 7 - }, - "end": { - "line": 7, - "column": 28 - } - }, + "start":234,"end":255,"loc":{"start":{"line":7,"column":7},"end":{"line":7,"column":28}}, "declarations": [ { "type": "VariableDeclarator", - "start": 240, - "end": 254, - "loc": { - "start": { - "line": 7, - "column": 13 - }, - "end": { - "line": 7, - "column": 27 - } - }, + "start":240,"end":254,"loc":{"start":{"line":7,"column":13},"end":{"line":7,"column":27}}, "id": { "type": "ArrayPattern", - "start": 240, - "end": 248, - "loc": { - "start": { - "line": 7, - "column": 13 - }, - "end": { - "line": 7, - "column": 21 - } - }, + "start":240,"end":248,"loc":{"start":{"line":7,"column":13},"end":{"line":7,"column":21}}, "elements": [ { "type": "ArrayPattern", - "start": 241, - "end": 247, - "loc": { - "start": { - "line": 7, - "column": 14 - }, - "end": { - "line": 7, - "column": 20 - } - }, + "start":241,"end":247,"loc":{"start":{"line":7,"column":14},"end":{"line":7,"column":20}}, "elements": [ { "type": "Identifier", - "start": 242, - "end": 246, - "loc": { - "start": { - "line": 7, - "column": 15 - }, - "end": { - "line": 7, - "column": 19 - }, - "identifierName": "baz2" - }, + "start":242,"end":246,"loc":{"start":{"line":7,"column":15},"end":{"line":7,"column":19},"identifierName":"baz2"}, "name": "baz2" } ] @@ -1235,19 +418,7 @@ }, "init": { "type": "Identifier", - "start": 251, - "end": 254, - "loc": { - "start": { - "line": 7, - "column": 24 - }, - "end": { - "line": 7, - "column": 27 - }, - "identifierName": "bar" - }, + "start":251,"end":254,"loc":{"start":{"line":7,"column":24},"end":{"line":7,"column":27},"identifierName":"bar"}, "name": "bar" } } @@ -1257,143 +428,42 @@ }, { "type": "ExportNamedDeclaration", - "start": 256, - "end": 311, - "loc": { - "start": { - "line": 8, - "column": 0 - }, - "end": { - "line": 8, - "column": 55 - } - }, + "start":256,"end":311,"loc":{"start":{"line":8,"column":0},"end":{"line":8,"column":55}}, "specifiers": [], "source": null, "declaration": { "type": "VariableDeclaration", - "start": 263, - "end": 311, - "loc": { - "start": { - "line": 8, - "column": 7 - }, - "end": { - "line": 8, - "column": 55 - } - }, + "start":263,"end":311,"loc":{"start":{"line":8,"column":7},"end":{"line":8,"column":55}}, "declarations": [ { "type": "VariableDeclarator", - "start": 269, - "end": 310, - "loc": { - "start": { - "line": 8, - "column": 13 - }, - "end": { - "line": 8, - "column": 54 - } - }, + "start":269,"end":310,"loc":{"start":{"line":8,"column":13},"end":{"line":8,"column":54}}, "id": { "type": "ArrayPattern", - "start": 269, - "end": 304, - "loc": { - "start": { - "line": 8, - "column": 13 - }, - "end": { - "line": 8, - "column": 48 - } - }, + "start":269,"end":304,"loc":{"start":{"line":8,"column":13},"end":{"line":8,"column":48}}, "elements": [ { "type": "ObjectPattern", - "start": 270, - "end": 285, - "loc": { - "start": { - "line": 8, - "column": 14 - }, - "end": { - "line": 8, - "column": 29 - } - }, + "start":270,"end":285,"loc":{"start":{"line":8,"column":14},"end":{"line":8,"column":29}}, "properties": [ { "type": "ObjectProperty", - "start": 272, - "end": 283, - "loc": { - "start": { - "line": 8, - "column": 16 - }, - "end": { - "line": 8, - "column": 27 - } - }, + "start":272,"end":283,"loc":{"start":{"line":8,"column":16},"end":{"line":8,"column":27}}, "method": false, "key": { "type": "Identifier", - "start": 272, - "end": 275, - "loc": { - "start": { - "line": 8, - "column": 16 - }, - "end": { - "line": 8, - "column": 19 - }, - "identifierName": "foo" - }, + "start":272,"end":275,"loc":{"start":{"line":8,"column":16},"end":{"line":8,"column":19},"identifierName":"foo"}, "name": "foo" }, "computed": false, "shorthand": false, "value": { "type": "ArrayPattern", - "start": 277, - "end": 283, - "loc": { - "start": { - "line": 8, - "column": 21 - }, - "end": { - "line": 8, - "column": 27 - } - }, + "start":277,"end":283,"loc":{"start":{"line":8,"column":21},"end":{"line":8,"column":27}}, "elements": [ { "type": "Identifier", - "start": 278, - "end": 282, - "loc": { - "start": { - "line": 8, - "column": 22 - }, - "end": { - "line": 8, - "column": 26 - }, - "identifierName": "baz3" - }, + "start":278,"end":282,"loc":{"start":{"line":8,"column":22},"end":{"line":8,"column":26},"identifierName":"baz3"}, "name": "baz3" } ] @@ -1403,83 +473,26 @@ }, { "type": "ObjectPattern", - "start": 287, - "end": 303, - "loc": { - "start": { - "line": 8, - "column": 31 - }, - "end": { - "line": 8, - "column": 47 - } - }, + "start":287,"end":303,"loc":{"start":{"line":8,"column":31},"end":{"line":8,"column":47}}, "properties": [ { "type": "ObjectProperty", - "start": 289, - "end": 301, - "loc": { - "start": { - "line": 8, - "column": 33 - }, - "end": { - "line": 8, - "column": 45 - } - }, + "start":289,"end":301,"loc":{"start":{"line":8,"column":33},"end":{"line":8,"column":45}}, "method": false, "key": { "type": "Identifier", - "start": 289, - "end": 293, - "loc": { - "start": { - "line": 8, - "column": 33 - }, - "end": { - "line": 8, - "column": 37 - }, - "identifierName": "foo2" - }, + "start":289,"end":293,"loc":{"start":{"line":8,"column":33},"end":{"line":8,"column":37},"identifierName":"foo2"}, "name": "foo2" }, "computed": false, "shorthand": false, "value": { "type": "ArrayPattern", - "start": 295, - "end": 301, - "loc": { - "start": { - "line": 8, - "column": 39 - }, - "end": { - "line": 8, - "column": 45 - } - }, + "start":295,"end":301,"loc":{"start":{"line":8,"column":39},"end":{"line":8,"column":45}}, "elements": [ { "type": "Identifier", - "start": 296, - "end": 300, - "loc": { - "start": { - "line": 8, - "column": 40 - }, - "end": { - "line": 8, - "column": 44 - }, - "identifierName": "baz4" - }, + "start":296,"end":300,"loc":{"start":{"line":8,"column":40},"end":{"line":8,"column":44},"identifierName":"baz4"}, "name": "baz4" } ] @@ -1491,19 +504,7 @@ }, "init": { "type": "Identifier", - "start": 307, - "end": 310, - "loc": { - "start": { - "line": 8, - "column": 51 - }, - "end": { - "line": 8, - "column": 54 - }, - "identifierName": "bar" - }, + "start":307,"end":310,"loc":{"start":{"line":8,"column":51},"end":{"line":8,"column":54},"identifierName":"bar"}, "name": "bar" } } @@ -1513,211 +514,64 @@ }, { "type": "ExportNamedDeclaration", - "start": 312, - "end": 381, - "loc": { - "start": { - "line": 9, - "column": 0 - }, - "end": { - "line": 9, - "column": 69 - } - }, + "start":312,"end":381,"loc":{"start":{"line":9,"column":0},"end":{"line":9,"column":69}}, "specifiers": [], "source": null, "declaration": { "type": "VariableDeclaration", - "start": 319, - "end": 381, - "loc": { - "start": { - "line": 9, - "column": 7 - }, - "end": { - "line": 9, - "column": 69 - } - }, + "start":319,"end":381,"loc":{"start":{"line":9,"column":7},"end":{"line":9,"column":69}}, "declarations": [ { "type": "VariableDeclarator", - "start": 325, - "end": 380, - "loc": { - "start": { - "line": 9, - "column": 13 - }, - "end": { - "line": 9, - "column": 68 - } - }, + "start":325,"end":380,"loc":{"start":{"line":9,"column":13},"end":{"line":9,"column":68}}, "id": { "type": "ObjectPattern", - "start": 325, - "end": 374, - "loc": { - "start": { - "line": 9, - "column": 13 - }, - "end": { - "line": 9, - "column": 62 - } - }, + "start":325,"end":374,"loc":{"start":{"line":9,"column":13},"end":{"line":9,"column":62}}, "properties": [ { "type": "ObjectProperty", - "start": 327, - "end": 349, - "loc": { - "start": { - "line": 9, - "column": 15 - }, - "end": { - "line": 9, - "column": 37 - } - }, + "start":327,"end":349,"loc":{"start":{"line":9,"column":15},"end":{"line":9,"column":37}}, "method": false, "key": { "type": "Identifier", - "start": 327, - "end": 330, - "loc": { - "start": { - "line": 9, - "column": 15 - }, - "end": { - "line": 9, - "column": 18 - }, - "identifierName": "foo" - }, + "start":327,"end":330,"loc":{"start":{"line":9,"column":15},"end":{"line":9,"column":18},"identifierName":"foo"}, "name": "foo" }, "computed": false, "shorthand": false, "value": { "type": "ObjectPattern", - "start": 332, - "end": 349, - "loc": { - "start": { - "line": 9, - "column": 20 - }, - "end": { - "line": 9, - "column": 37 - } - }, + "start":332,"end":349,"loc":{"start":{"line":9,"column":20},"end":{"line":9,"column":37}}, "properties": [ { "type": "ObjectProperty", - "start": 334, - "end": 347, - "loc": { - "start": { - "line": 9, - "column": 22 - }, - "end": { - "line": 9, - "column": 35 - } - }, + "start":334,"end":347,"loc":{"start":{"line":9,"column":22},"end":{"line":9,"column":35}}, "method": false, "key": { "type": "Identifier", - "start": 334, - "end": 337, - "loc": { - "start": { - "line": 9, - "column": 22 - }, - "end": { - "line": 9, - "column": 25 - }, - "identifierName": "baz" - }, + "start":334,"end":337,"loc":{"start":{"line":9,"column":22},"end":{"line":9,"column":25},"identifierName":"baz"}, "name": "baz" }, "computed": false, "shorthand": false, "value": { "type": "ObjectPattern", - "start": 339, - "end": 347, - "loc": { - "start": { - "line": 9, - "column": 27 - }, - "end": { - "line": 9, - "column": 35 - } - }, + "start":339,"end":347,"loc":{"start":{"line":9,"column":27},"end":{"line":9,"column":35}}, "properties": [ { "type": "ObjectProperty", - "start": 341, - "end": 345, - "loc": { - "start": { - "line": 9, - "column": 29 - }, - "end": { - "line": 9, - "column": 33 - } - }, + "start":341,"end":345,"loc":{"start":{"line":9,"column":29},"end":{"line":9,"column":33}}, "method": false, "key": { "type": "Identifier", - "start": 341, - "end": 345, - "loc": { - "start": { - "line": 9, - "column": 29 - }, - "end": { - "line": 9, - "column": 33 - }, - "identifierName": "qux3" - }, + "start":341,"end":345,"loc":{"start":{"line":9,"column":29},"end":{"line":9,"column":33},"identifierName":"qux3"}, "name": "qux3" }, "computed": false, "shorthand": true, "value": { "type": "Identifier", - "start": 341, - "end": 345, - "loc": { - "start": { - "line": 9, - "column": 29 - }, - "end": { - "line": 9, - "column": 33 - }, - "identifierName": "qux3" - }, + "start":341,"end":345,"loc":{"start":{"line":9,"column":29},"end":{"line":9,"column":33},"identifierName":"qux3"}, "name": "qux3" }, "extra": { @@ -1732,117 +586,37 @@ }, { "type": "ObjectProperty", - "start": 351, - "end": 372, - "loc": { - "start": { - "line": 9, - "column": 39 - }, - "end": { - "line": 9, - "column": 60 - } - }, + "start":351,"end":372,"loc":{"start":{"line":9,"column":39},"end":{"line":9,"column":60}}, "method": false, "key": { "type": "Identifier", - "start": 351, - "end": 355, - "loc": { - "start": { - "line": 9, - "column": 39 - }, - "end": { - "line": 9, - "column": 43 - }, - "identifierName": "foo2" - }, + "start":351,"end":355,"loc":{"start":{"line":9,"column":39},"end":{"line":9,"column":43},"identifierName":"foo2"}, "name": "foo2" }, "computed": false, "shorthand": false, "value": { "type": "ObjectPattern", - "start": 357, - "end": 372, - "loc": { - "start": { - "line": 9, - "column": 45 - }, - "end": { - "line": 9, - "column": 60 - } - }, + "start":357,"end":372,"loc":{"start":{"line":9,"column":45},"end":{"line":9,"column":60}}, "properties": [ { "type": "ObjectProperty", - "start": 359, - "end": 371, - "loc": { - "start": { - "line": 9, - "column": 47 - }, - "end": { - "line": 9, - "column": 59 - } - }, + "start":359,"end":371,"loc":{"start":{"line":9,"column":47},"end":{"line":9,"column":59}}, "method": false, "key": { "type": "Identifier", - "start": 359, - "end": 363, - "loc": { - "start": { - "line": 9, - "column": 47 - }, - "end": { - "line": 9, - "column": 51 - }, - "identifierName": "baz2" - }, + "start":359,"end":363,"loc":{"start":{"line":9,"column":47},"end":{"line":9,"column":51},"identifierName":"baz2"}, "name": "baz2" }, "computed": false, "shorthand": false, "value": { "type": "ArrayPattern", - "start": 365, - "end": 371, - "loc": { - "start": { - "line": 9, - "column": 53 - }, - "end": { - "line": 9, - "column": 59 - } - }, + "start":365,"end":371,"loc":{"start":{"line":9,"column":53},"end":{"line":9,"column":59}}, "elements": [ { "type": "Identifier", - "start": 366, - "end": 370, - "loc": { - "start": { - "line": 9, - "column": 54 - }, - "end": { - "line": 9, - "column": 58 - }, - "identifierName": "qux4" - }, + "start":366,"end":370,"loc":{"start":{"line":9,"column":54},"end":{"line":9,"column":58},"identifierName":"qux4"}, "name": "qux4" } ] @@ -1855,19 +629,7 @@ }, "init": { "type": "Identifier", - "start": 377, - "end": 380, - "loc": { - "start": { - "line": 9, - "column": 65 - }, - "end": { - "line": 9, - "column": 68 - }, - "identifierName": "bar" - }, + "start":377,"end":380,"loc":{"start":{"line":9,"column":65},"end":{"line":9,"column":68},"identifierName":"bar"}, "name": "bar" } } @@ -1877,211 +639,64 @@ }, { "type": "ExportNamedDeclaration", - "start": 382, - "end": 453, - "loc": { - "start": { - "line": 10, - "column": 0 - }, - "end": { - "line": 10, - "column": 71 - } - }, + "start":382,"end":453,"loc":{"start":{"line":10,"column":0},"end":{"line":10,"column":71}}, "specifiers": [], "source": null, "declaration": { "type": "VariableDeclaration", - "start": 389, - "end": 453, - "loc": { - "start": { - "line": 10, - "column": 7 - }, - "end": { - "line": 10, - "column": 71 - } - }, + "start":389,"end":453,"loc":{"start":{"line":10,"column":7},"end":{"line":10,"column":71}}, "declarations": [ { "type": "VariableDeclarator", - "start": 395, - "end": 452, - "loc": { - "start": { - "line": 10, - "column": 13 - }, - "end": { - "line": 10, - "column": 70 - } - }, + "start":395,"end":452,"loc":{"start":{"line":10,"column":13},"end":{"line":10,"column":70}}, "id": { "type": "ObjectPattern", - "start": 395, - "end": 446, - "loc": { - "start": { - "line": 10, - "column": 13 - }, - "end": { - "line": 10, - "column": 64 - } - }, + "start":395,"end":446,"loc":{"start":{"line":10,"column":13},"end":{"line":10,"column":64}}, "properties": [ { "type": "ObjectProperty", - "start": 397, - "end": 419, - "loc": { - "start": { - "line": 10, - "column": 15 - }, - "end": { - "line": 10, - "column": 37 - } - }, + "start":397,"end":419,"loc":{"start":{"line":10,"column":15},"end":{"line":10,"column":37}}, "method": false, "key": { "type": "Identifier", - "start": 397, - "end": 400, - "loc": { - "start": { - "line": 10, - "column": 15 - }, - "end": { - "line": 10, - "column": 18 - }, - "identifierName": "foo" - }, + "start":397,"end":400,"loc":{"start":{"line":10,"column":15},"end":{"line":10,"column":18},"identifierName":"foo"}, "name": "foo" }, "computed": false, "shorthand": false, "value": { "type": "ObjectPattern", - "start": 402, - "end": 419, - "loc": { - "start": { - "line": 10, - "column": 20 - }, - "end": { - "line": 10, - "column": 37 - } - }, + "start":402,"end":419,"loc":{"start":{"line":10,"column":20},"end":{"line":10,"column":37}}, "properties": [ { "type": "ObjectProperty", - "start": 404, - "end": 417, - "loc": { - "start": { - "line": 10, - "column": 22 - }, - "end": { - "line": 10, - "column": 35 - } - }, + "start":404,"end":417,"loc":{"start":{"line":10,"column":22},"end":{"line":10,"column":35}}, "method": false, "key": { "type": "Identifier", - "start": 404, - "end": 407, - "loc": { - "start": { - "line": 10, - "column": 22 - }, - "end": { - "line": 10, - "column": 25 - }, - "identifierName": "baz" - }, + "start":404,"end":407,"loc":{"start":{"line":10,"column":22},"end":{"line":10,"column":25},"identifierName":"baz"}, "name": "baz" }, "computed": false, "shorthand": false, "value": { "type": "ObjectPattern", - "start": 409, - "end": 417, - "loc": { - "start": { - "line": 10, - "column": 27 - }, - "end": { - "line": 10, - "column": 35 - } - }, + "start":409,"end":417,"loc":{"start":{"line":10,"column":27},"end":{"line":10,"column":35}}, "properties": [ { "type": "ObjectProperty", - "start": 411, - "end": 415, - "loc": { - "start": { - "line": 10, - "column": 29 - }, - "end": { - "line": 10, - "column": 33 - } - }, + "start":411,"end":415,"loc":{"start":{"line":10,"column":29},"end":{"line":10,"column":33}}, "method": false, "key": { "type": "Identifier", - "start": 411, - "end": 415, - "loc": { - "start": { - "line": 10, - "column": 29 - }, - "end": { - "line": 10, - "column": 33 - }, - "identifierName": "qux5" - }, + "start":411,"end":415,"loc":{"start":{"line":10,"column":29},"end":{"line":10,"column":33},"identifierName":"qux5"}, "name": "qux5" }, "computed": false, "shorthand": true, "value": { "type": "Identifier", - "start": 411, - "end": 415, - "loc": { - "start": { - "line": 10, - "column": 29 - }, - "end": { - "line": 10, - "column": 33 - }, - "identifierName": "qux5" - }, + "start":411,"end":415,"loc":{"start":{"line":10,"column":29},"end":{"line":10,"column":33},"identifierName":"qux5"}, "name": "qux5" }, "extra": { @@ -2096,166 +711,52 @@ }, { "type": "ObjectProperty", - "start": 421, - "end": 444, - "loc": { - "start": { - "line": 10, - "column": 39 - }, - "end": { - "line": 10, - "column": 62 - } - }, + "start":421,"end":444,"loc":{"start":{"line":10,"column":39},"end":{"line":10,"column":62}}, "method": false, "key": { "type": "Identifier", - "start": 421, - "end": 425, - "loc": { - "start": { - "line": 10, - "column": 39 - }, - "end": { - "line": 10, - "column": 43 - }, - "identifierName": "foo2" - }, + "start":421,"end":425,"loc":{"start":{"line":10,"column":39},"end":{"line":10,"column":43},"identifierName":"foo2"}, "name": "foo2" }, "computed": false, "shorthand": false, "value": { "type": "ObjectPattern", - "start": 427, - "end": 444, - "loc": { - "start": { - "line": 10, - "column": 45 - }, - "end": { - "line": 10, - "column": 62 - } - }, + "start":427,"end":444,"loc":{"start":{"line":10,"column":45},"end":{"line":10,"column":62}}, "properties": [ { "type": "ObjectProperty", - "start": 429, - "end": 443, - "loc": { - "start": { - "line": 10, - "column": 47 - }, - "end": { - "line": 10, - "column": 61 - } - }, + "start":429,"end":443,"loc":{"start":{"line":10,"column":47},"end":{"line":10,"column":61}}, "method": false, "key": { "type": "Identifier", - "start": 429, - "end": 433, - "loc": { - "start": { - "line": 10, - "column": 47 - }, - "end": { - "line": 10, - "column": 51 - }, - "identifierName": "baz2" - }, + "start":429,"end":433,"loc":{"start":{"line":10,"column":47},"end":{"line":10,"column":51},"identifierName":"baz2"}, "name": "baz2" }, "computed": false, "shorthand": false, "value": { "type": "ArrayPattern", - "start": 435, - "end": 443, - "loc": { - "start": { - "line": 10, - "column": 53 - }, - "end": { - "line": 10, - "column": 61 - } - }, + "start":435,"end":443,"loc":{"start":{"line":10,"column":53},"end":{"line":10,"column":61}}, "elements": [ { "type": "ObjectPattern", - "start": 436, - "end": 442, - "loc": { - "start": { - "line": 10, - "column": 54 - }, - "end": { - "line": 10, - "column": 60 - } - }, + "start":436,"end":442,"loc":{"start":{"line":10,"column":54},"end":{"line":10,"column":60}}, "properties": [ { "type": "ObjectProperty", - "start": 437, - "end": 441, - "loc": { - "start": { - "line": 10, - "column": 55 - }, - "end": { - "line": 10, - "column": 59 - } - }, + "start":437,"end":441,"loc":{"start":{"line":10,"column":55},"end":{"line":10,"column":59}}, "method": false, "key": { "type": "Identifier", - "start": 437, - "end": 441, - "loc": { - "start": { - "line": 10, - "column": 55 - }, - "end": { - "line": 10, - "column": 59 - }, - "identifierName": "qux6" - }, + "start":437,"end":441,"loc":{"start":{"line":10,"column":55},"end":{"line":10,"column":59},"identifierName":"qux6"}, "name": "qux6" }, "computed": false, "shorthand": true, "value": { "type": "Identifier", - "start": 437, - "end": 441, - "loc": { - "start": { - "line": 10, - "column": 55 - }, - "end": { - "line": 10, - "column": 59 - }, - "identifierName": "qux6" - }, + "start":437,"end":441,"loc":{"start":{"line":10,"column":55},"end":{"line":10,"column":59},"identifierName":"qux6"}, "name": "qux6" }, "extra": { @@ -2274,19 +775,7 @@ }, "init": { "type": "Identifier", - "start": 449, - "end": 452, - "loc": { - "start": { - "line": 10, - "column": 67 - }, - "end": { - "line": 10, - "column": 70 - }, - "identifierName": "bar" - }, + "start":449,"end":452,"loc":{"start":{"line":10,"column":67},"end":{"line":10,"column":70},"identifierName":"bar"}, "name": "bar" } } @@ -2296,113 +785,34 @@ }, { "type": "ExportNamedDeclaration", - "start": 454, - "end": 481, - "loc": { - "start": { - "line": 11, - "column": 0 - }, - "end": { - "line": 11, - "column": 27 - } - }, + "start":454,"end":481,"loc":{"start":{"line":11,"column":0},"end":{"line":11,"column":27}}, "specifiers": [], "source": null, "declaration": { "type": "VariableDeclaration", - "start": 461, - "end": 481, - "loc": { - "start": { - "line": 11, - "column": 7 - }, - "end": { - "line": 11, - "column": 27 - } - }, + "start":461,"end":481,"loc":{"start":{"line":11,"column":7},"end":{"line":11,"column":27}}, "declarations": [ { "type": "VariableDeclarator", - "start": 467, - "end": 480, - "loc": { - "start": { - "line": 11, - "column": 13 - }, - "end": { - "line": 11, - "column": 26 - } - }, + "start":467,"end":480,"loc":{"start":{"line":11,"column":13},"end":{"line":11,"column":26}}, "id": { "type": "ObjectPattern", - "start": 467, - "end": 474, - "loc": { - "start": { - "line": 11, - "column": 13 - }, - "end": { - "line": 11, - "column": 20 - } - }, + "start":467,"end":474,"loc":{"start":{"line":11,"column":13},"end":{"line":11,"column":20}}, "properties": [ { "type": "ObjectProperty", - "start": 469, - "end": 472, - "loc": { - "start": { - "line": 11, - "column": 15 - }, - "end": { - "line": 11, - "column": 18 - } - }, + "start":469,"end":472,"loc":{"start":{"line":11,"column":15},"end":{"line":11,"column":18}}, "method": false, "key": { "type": "Identifier", - "start": 469, - "end": 472, - "loc": { - "start": { - "line": 11, - "column": 15 - }, - "end": { - "line": 11, - "column": 18 - }, - "identifierName": "Foo" - }, + "start":469,"end":472,"loc":{"start":{"line":11,"column":15},"end":{"line":11,"column":18},"identifierName":"Foo"}, "name": "Foo" }, "computed": false, "shorthand": true, "value": { "type": "Identifier", - "start": 469, - "end": 472, - "loc": { - "start": { - "line": 11, - "column": 15 - }, - "end": { - "line": 11, - "column": 18 - }, - "identifierName": "Foo" - }, + "start":469,"end":472,"loc":{"start":{"line":11,"column":15},"end":{"line":11,"column":18},"identifierName":"Foo"}, "name": "Foo" }, "extra": { @@ -2413,19 +823,7 @@ }, "init": { "type": "Identifier", - "start": 477, - "end": 480, - "loc": { - "start": { - "line": 11, - "column": 23 - }, - "end": { - "line": 11, - "column": 26 - }, - "identifierName": "bar" - }, + "start":477,"end":480,"loc":{"start":{"line":11,"column":23},"end":{"line":11,"column":26},"identifierName":"bar"}, "name": "bar" } } @@ -2435,130 +833,40 @@ }, { "type": "ExportNamedDeclaration", - "start": 482, - "end": 522, - "loc": { - "start": { - "line": 12, - "column": 0 - }, - "end": { - "line": 12, - "column": 40 - } - }, + "start":482,"end":522,"loc":{"start":{"line":12,"column":0},"end":{"line":12,"column":40}}, "specifiers": [], "source": null, "declaration": { "type": "VariableDeclaration", - "start": 489, - "end": 522, - "loc": { - "start": { - "line": 12, - "column": 7 - }, - "end": { - "line": 12, - "column": 40 - } - }, + "start":489,"end":522,"loc":{"start":{"line":12,"column":7},"end":{"line":12,"column":40}}, "declarations": [ { "type": "VariableDeclarator", - "start": 495, - "end": 521, - "loc": { - "start": { - "line": 12, - "column": 13 - }, - "end": { - "line": 12, - "column": 39 - } - }, + "start":495,"end":521,"loc":{"start":{"line":12,"column":13},"end":{"line":12,"column":39}}, "id": { "type": "ObjectPattern", - "start": 495, - "end": 515, - "loc": { - "start": { - "line": 12, - "column": 13 - }, - "end": { - "line": 12, - "column": 33 - } - }, + "start":495,"end":515,"loc":{"start":{"line":12,"column":13},"end":{"line":12,"column":33}}, "properties": [ { "type": "ObjectProperty", - "start": 497, - "end": 513, - "loc": { - "start": { - "line": 12, - "column": 15 - }, - "end": { - "line": 12, - "column": 31 - } - }, + "start":497,"end":513,"loc":{"start":{"line":12,"column":15},"end":{"line":12,"column":31}}, "method": false, "key": { "type": "Identifier", - "start": 497, - "end": 500, - "loc": { - "start": { - "line": 12, - "column": 15 - }, - "end": { - "line": 12, - "column": 18 - }, - "identifierName": "foo" - }, + "start":497,"end":500,"loc":{"start":{"line":12,"column":15},"end":{"line":12,"column":18},"identifierName":"foo"}, "name": "foo" }, "computed": false, "shorthand": false, "value": { "type": "ArrayPattern", - "start": 502, - "end": 513, - "loc": { - "start": { - "line": 12, - "column": 20 - }, - "end": { - "line": 12, - "column": 31 - } - }, + "start":502,"end":513,"loc":{"start":{"line":12,"column":20},"end":{"line":12,"column":31}}, "elements": [ null, null, { "type": "Identifier", - "start": 507, - "end": 511, - "loc": { - "start": { - "line": 12, - "column": 25 - }, - "end": { - "line": 12, - "column": 29 - }, - "identifierName": "qux7" - }, + "start":507,"end":511,"loc":{"start":{"line":12,"column":25},"end":{"line":12,"column":29},"identifierName":"qux7"}, "name": "qux7" } ] @@ -2568,19 +876,7 @@ }, "init": { "type": "Identifier", - "start": 518, - "end": 521, - "loc": { - "start": { - "line": 12, - "column": 36 - }, - "end": { - "line": 12, - "column": 39 - }, - "identifierName": "bar" - }, + "start":518,"end":521,"loc":{"start":{"line":12,"column":36},"end":{"line":12,"column":39},"identifierName":"bar"}, "name": "bar" } } diff --git a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring10/options.json b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring10/options.json deleted file mode 100644 index 446a980f5409..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring10/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'foo' has already been declared (2:20)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring10/output.json b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring10/output.json new file mode 100644 index 000000000000..119ea1be6c04 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring10/output.json @@ -0,0 +1,117 @@ +{ + "type": "File", + "start":0,"end":60,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":34}}, + "errors": [ + "SyntaxError: Identifier 'foo' has already been declared (2:20)", + "SyntaxError: `foo` has already been exported. Exported identifiers must be unique. (2:20)" + ], + "program": { + "type": "Program", + "start":0,"end":60,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":34}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExportNamedDeclaration", + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, + "specifiers": [], + "source": null, + "declaration": { + "type": "FunctionDeclaration", + "start":7,"end":24,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":24}}, + "id": { + "type": "Identifier", + "start":16,"end":19,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":19},"identifierName":"foo"}, + "name": "foo" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":22,"end":24,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":24}}, + "body": [], + "directives": [] + } + } + }, + { + "type": "EmptyStatement", + "start":24,"end":25,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":25}} + }, + { + "type": "ExportNamedDeclaration", + "start":26,"end":60,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":34}}, + "specifiers": [], + "source": null, + "declaration": { + "type": "VariableDeclaration", + "start":33,"end":60,"loc":{"start":{"line":2,"column":7},"end":{"line":2,"column":34}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":39,"end":59,"loc":{"start":{"line":2,"column":13},"end":{"line":2,"column":33}}, + "id": { + "type": "ObjectPattern", + "start":39,"end":53,"loc":{"start":{"line":2,"column":13},"end":{"line":2,"column":27}}, + "properties": [ + { + "type": "ObjectProperty", + "start":41,"end":51,"loc":{"start":{"line":2,"column":15},"end":{"line":2,"column":25}}, + "method": false, + "key": { + "type": "Identifier", + "start":41,"end":42,"loc":{"start":{"line":2,"column":15},"end":{"line":2,"column":16},"identifierName":"a"}, + "name": "a" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "ArrayPattern", + "start":44,"end":51,"loc":{"start":{"line":2,"column":18},"end":{"line":2,"column":25}}, + "elements": [ + { + "type": "ObjectPattern", + "start":45,"end":50,"loc":{"start":{"line":2,"column":19},"end":{"line":2,"column":24}}, + "properties": [ + { + "type": "ObjectProperty", + "start":46,"end":49,"loc":{"start":{"line":2,"column":20},"end":{"line":2,"column":23}}, + "method": false, + "key": { + "type": "Identifier", + "start":46,"end":49,"loc":{"start":{"line":2,"column":20},"end":{"line":2,"column":23},"identifierName":"foo"}, + "name": "foo" + }, + "computed": false, + "shorthand": true, + "value": { + "type": "Identifier", + "start":46,"end":49,"loc":{"start":{"line":2,"column":20},"end":{"line":2,"column":23},"identifierName":"foo"}, + "name": "foo" + }, + "extra": { + "shorthand": true + } + } + ] + } + ] + } + } + ] + }, + "init": { + "type": "Identifier", + "start":56,"end":59,"loc":{"start":{"line":2,"column":30},"end":{"line":2,"column":33},"identifierName":"bar"}, + "name": "bar" + } + } + ], + "kind": "const" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring11/options.json b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring11/options.json deleted file mode 100644 index 09b3fa97a0d1..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring11/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'foo4' has already been declared (2:50)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring11/output.json b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring11/output.json new file mode 100644 index 000000000000..933af6bc6d6d --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring11/output.json @@ -0,0 +1,182 @@ +{ + "type": "File", + "start":0,"end":96,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":69}}, + "errors": [ + "SyntaxError: Identifier 'foo4' has already been declared (2:50)", + "SyntaxError: `foo4` has already been exported. Exported identifiers must be unique. (2:50)" + ], + "program": { + "type": "Program", + "start":0,"end":96,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":69}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExportNamedDeclaration", + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, + "specifiers": [], + "source": null, + "declaration": { + "type": "FunctionDeclaration", + "start":7,"end":25,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":25}}, + "id": { + "type": "Identifier", + "start":16,"end":20,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":20},"identifierName":"foo4"}, + "name": "foo4" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":23,"end":25,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":25}}, + "body": [], + "directives": [] + } + } + }, + { + "type": "EmptyStatement", + "start":25,"end":26,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":26}} + }, + { + "type": "ExportNamedDeclaration", + "start":27,"end":96,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":69}}, + "specifiers": [], + "source": null, + "declaration": { + "type": "VariableDeclaration", + "start":34,"end":96,"loc":{"start":{"line":2,"column":7},"end":{"line":2,"column":69}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":40,"end":95,"loc":{"start":{"line":2,"column":13},"end":{"line":2,"column":68}}, + "id": { + "type": "ArrayPattern", + "start":40,"end":89,"loc":{"start":{"line":2,"column":13},"end":{"line":2,"column":62}}, + "elements": [ + { + "type": "ObjectPattern", + "start":41,"end":88,"loc":{"start":{"line":2,"column":14},"end":{"line":2,"column":61}}, + "properties": [ + { + "type": "ObjectProperty", + "start":43,"end":55,"loc":{"start":{"line":2,"column":16},"end":{"line":2,"column":28}}, + "method": false, + "key": { + "type": "Identifier", + "start":43,"end":44,"loc":{"start":{"line":2,"column":16},"end":{"line":2,"column":17},"identifierName":"a"}, + "name": "a" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "ArrayPattern", + "start":46,"end":55,"loc":{"start":{"line":2,"column":19},"end":{"line":2,"column":28}}, + "elements": [ + { + "type": "ObjectPattern", + "start":47,"end":54,"loc":{"start":{"line":2,"column":20},"end":{"line":2,"column":27}}, + "properties": [ + { + "type": "ObjectProperty", + "start":49,"end":52,"loc":{"start":{"line":2,"column":22},"end":{"line":2,"column":25}}, + "method": false, + "key": { + "type": "Identifier", + "start":49,"end":52,"loc":{"start":{"line":2,"column":22},"end":{"line":2,"column":25},"identifierName":"foo"}, + "name": "foo" + }, + "computed": false, + "shorthand": true, + "value": { + "type": "Identifier", + "start":49,"end":52,"loc":{"start":{"line":2,"column":22},"end":{"line":2,"column":25},"identifierName":"foo"}, + "name": "foo" + }, + "extra": { + "shorthand": true + } + } + ] + } + ] + } + }, + { + "type": "ObjectProperty", + "start":57,"end":86,"loc":{"start":{"line":2,"column":30},"end":{"line":2,"column":59}}, + "method": false, + "key": { + "type": "Identifier", + "start":57,"end":58,"loc":{"start":{"line":2,"column":30},"end":{"line":2,"column":31},"identifierName":"b"}, + "name": "b" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "ObjectPattern", + "start":60,"end":86,"loc":{"start":{"line":2,"column":33},"end":{"line":2,"column":59}}, + "properties": [ + { + "type": "ObjectProperty", + "start":62,"end":84,"loc":{"start":{"line":2,"column":35},"end":{"line":2,"column":57}}, + "method": false, + "key": { + "type": "Identifier", + "start":62,"end":66,"loc":{"start":{"line":2,"column":35},"end":{"line":2,"column":39},"identifierName":"foo2"}, + "name": "foo2" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "ArrayPattern", + "start":68,"end":84,"loc":{"start":{"line":2,"column":41},"end":{"line":2,"column":57}}, + "elements": [ + { + "type": "ObjectPattern", + "start":69,"end":83,"loc":{"start":{"line":2,"column":42},"end":{"line":2,"column":56}}, + "properties": [ + { + "type": "ObjectProperty", + "start":71,"end":81,"loc":{"start":{"line":2,"column":44},"end":{"line":2,"column":54}}, + "method": false, + "key": { + "type": "Identifier", + "start":71,"end":75,"loc":{"start":{"line":2,"column":44},"end":{"line":2,"column":48},"identifierName":"foo3"}, + "name": "foo3" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "Identifier", + "start":77,"end":81,"loc":{"start":{"line":2,"column":50},"end":{"line":2,"column":54},"identifierName":"foo4"}, + "name": "foo4" + } + } + ] + } + ] + } + } + ] + } + } + ] + } + ] + }, + "init": { + "type": "Identifier", + "start":92,"end":95,"loc":{"start":{"line":2,"column":65},"end":{"line":2,"column":68},"identifierName":"bar"}, + "name": "bar" + } + } + ], + "kind": "const" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring12/options.json b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring12/options.json deleted file mode 100644 index 3a7173c837e3..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring12/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'foo4' has already been declared (2:49)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring12/output.json b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring12/output.json new file mode 100644 index 000000000000..c5c74319fb0f --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring12/output.json @@ -0,0 +1,176 @@ +{ + "type": "File", + "start":0,"end":94,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":67}}, + "errors": [ + "SyntaxError: Identifier 'foo4' has already been declared (2:49)", + "SyntaxError: `foo4` has already been exported. Exported identifiers must be unique. (2:49)" + ], + "program": { + "type": "Program", + "start":0,"end":94,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":67}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExportNamedDeclaration", + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, + "specifiers": [], + "source": null, + "declaration": { + "type": "FunctionDeclaration", + "start":7,"end":25,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":25}}, + "id": { + "type": "Identifier", + "start":16,"end":20,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":20},"identifierName":"foo4"}, + "name": "foo4" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":23,"end":25,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":25}}, + "body": [], + "directives": [] + } + } + }, + { + "type": "EmptyStatement", + "start":25,"end":26,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":26}} + }, + { + "type": "ExportNamedDeclaration", + "start":27,"end":94,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":67}}, + "specifiers": [], + "source": null, + "declaration": { + "type": "VariableDeclaration", + "start":34,"end":94,"loc":{"start":{"line":2,"column":7},"end":{"line":2,"column":67}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":40,"end":93,"loc":{"start":{"line":2,"column":13},"end":{"line":2,"column":66}}, + "id": { + "type": "ObjectPattern", + "start":40,"end":87,"loc":{"start":{"line":2,"column":13},"end":{"line":2,"column":60}}, + "properties": [ + { + "type": "ObjectProperty", + "start":42,"end":54,"loc":{"start":{"line":2,"column":15},"end":{"line":2,"column":27}}, + "method": false, + "key": { + "type": "Identifier", + "start":42,"end":43,"loc":{"start":{"line":2,"column":15},"end":{"line":2,"column":16},"identifierName":"a"}, + "name": "a" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "ArrayPattern", + "start":45,"end":54,"loc":{"start":{"line":2,"column":18},"end":{"line":2,"column":27}}, + "elements": [ + { + "type": "ObjectPattern", + "start":46,"end":53,"loc":{"start":{"line":2,"column":19},"end":{"line":2,"column":26}}, + "properties": [ + { + "type": "ObjectProperty", + "start":48,"end":51,"loc":{"start":{"line":2,"column":21},"end":{"line":2,"column":24}}, + "method": false, + "key": { + "type": "Identifier", + "start":48,"end":51,"loc":{"start":{"line":2,"column":21},"end":{"line":2,"column":24},"identifierName":"foo"}, + "name": "foo" + }, + "computed": false, + "shorthand": true, + "value": { + "type": "Identifier", + "start":48,"end":51,"loc":{"start":{"line":2,"column":21},"end":{"line":2,"column":24},"identifierName":"foo"}, + "name": "foo" + }, + "extra": { + "shorthand": true + } + } + ] + } + ] + } + }, + { + "type": "ObjectProperty", + "start":56,"end":85,"loc":{"start":{"line":2,"column":29},"end":{"line":2,"column":58}}, + "method": false, + "key": { + "type": "Identifier", + "start":56,"end":57,"loc":{"start":{"line":2,"column":29},"end":{"line":2,"column":30},"identifierName":"b"}, + "name": "b" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "ObjectPattern", + "start":59,"end":85,"loc":{"start":{"line":2,"column":32},"end":{"line":2,"column":58}}, + "properties": [ + { + "type": "ObjectProperty", + "start":61,"end":83,"loc":{"start":{"line":2,"column":34},"end":{"line":2,"column":56}}, + "method": false, + "key": { + "type": "Identifier", + "start":61,"end":65,"loc":{"start":{"line":2,"column":34},"end":{"line":2,"column":38},"identifierName":"foo2"}, + "name": "foo2" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "ArrayPattern", + "start":67,"end":83,"loc":{"start":{"line":2,"column":40},"end":{"line":2,"column":56}}, + "elements": [ + { + "type": "ObjectPattern", + "start":68,"end":82,"loc":{"start":{"line":2,"column":41},"end":{"line":2,"column":55}}, + "properties": [ + { + "type": "ObjectProperty", + "start":70,"end":80,"loc":{"start":{"line":2,"column":43},"end":{"line":2,"column":53}}, + "method": false, + "key": { + "type": "Identifier", + "start":70,"end":74,"loc":{"start":{"line":2,"column":43},"end":{"line":2,"column":47},"identifierName":"foo3"}, + "name": "foo3" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "Identifier", + "start":76,"end":80,"loc":{"start":{"line":2,"column":49},"end":{"line":2,"column":53},"identifierName":"foo4"}, + "name": "foo4" + } + } + ] + } + ] + } + } + ] + } + } + ] + }, + "init": { + "type": "Identifier", + "start":90,"end":93,"loc":{"start":{"line":2,"column":63},"end":{"line":2,"column":66},"identifierName":"bar"}, + "name": "bar" + } + } + ], + "kind": "const" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring13/options.json b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring13/options.json deleted file mode 100644 index d3fc42a61ba1..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring13/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'foo4' has already been declared (2:58)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring13/output.json b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring13/output.json new file mode 100644 index 000000000000..2e17d443f69c --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring13/output.json @@ -0,0 +1,193 @@ +{ + "type": "File", + "start":0,"end":103,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":76}}, + "errors": [ + "SyntaxError: Identifier 'foo4' has already been declared (2:58)", + "SyntaxError: `foo4` has already been exported. Exported identifiers must be unique. (2:58)" + ], + "program": { + "type": "Program", + "start":0,"end":103,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":76}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExportNamedDeclaration", + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, + "specifiers": [], + "source": null, + "declaration": { + "type": "FunctionDeclaration", + "start":7,"end":25,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":25}}, + "id": { + "type": "Identifier", + "start":16,"end":20,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":20},"identifierName":"foo4"}, + "name": "foo4" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":23,"end":25,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":25}}, + "body": [], + "directives": [] + } + } + }, + { + "type": "EmptyStatement", + "start":25,"end":26,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":26}} + }, + { + "type": "ExportNamedDeclaration", + "start":27,"end":103,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":76}}, + "specifiers": [], + "source": null, + "declaration": { + "type": "VariableDeclaration", + "start":34,"end":103,"loc":{"start":{"line":2,"column":7},"end":{"line":2,"column":76}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":40,"end":102,"loc":{"start":{"line":2,"column":13},"end":{"line":2,"column":75}}, + "id": { + "type": "ObjectPattern", + "start":40,"end":96,"loc":{"start":{"line":2,"column":13},"end":{"line":2,"column":69}}, + "properties": [ + { + "type": "ObjectProperty", + "start":42,"end":60,"loc":{"start":{"line":2,"column":15},"end":{"line":2,"column":33}}, + "method": false, + "key": { + "type": "Identifier", + "start":42,"end":43,"loc":{"start":{"line":2,"column":15},"end":{"line":2,"column":16},"identifierName":"a"}, + "name": "a" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "ArrayPattern", + "start":45,"end":60,"loc":{"start":{"line":2,"column":18},"end":{"line":2,"column":33}}, + "elements": [ + { + "type": "ObjectPattern", + "start":46,"end":59,"loc":{"start":{"line":2,"column":19},"end":{"line":2,"column":32}}, + "properties": [ + { + "type": "ObjectProperty", + "start":48,"end":57,"loc":{"start":{"line":2,"column":21},"end":{"line":2,"column":30}}, + "method": false, + "key": { + "type": "Identifier", + "start":48,"end":52,"loc":{"start":{"line":2,"column":21},"end":{"line":2,"column":25},"identifierName":"foo4"}, + "name": "foo4" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "Identifier", + "start":54,"end":57,"loc":{"start":{"line":2,"column":27},"end":{"line":2,"column":30},"identifierName":"foo"}, + "name": "foo" + } + } + ] + } + ] + } + }, + { + "type": "ObjectProperty", + "start":62,"end":63,"loc":{"start":{"line":2,"column":35},"end":{"line":2,"column":36}}, + "method": false, + "key": { + "type": "Identifier", + "start":62,"end":63,"loc":{"start":{"line":2,"column":35},"end":{"line":2,"column":36},"identifierName":"b"}, + "name": "b" + }, + "computed": false, + "shorthand": true, + "value": { + "type": "Identifier", + "start":62,"end":63,"loc":{"start":{"line":2,"column":35},"end":{"line":2,"column":36},"identifierName":"b"}, + "name": "b" + }, + "extra": { + "shorthand": true + } + }, + { + "type": "ObjectProperty", + "start":65,"end":94,"loc":{"start":{"line":2,"column":38},"end":{"line":2,"column":67}}, + "method": false, + "key": { + "type": "Identifier", + "start":65,"end":66,"loc":{"start":{"line":2,"column":38},"end":{"line":2,"column":39},"identifierName":"c"}, + "name": "c" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "ObjectPattern", + "start":68,"end":94,"loc":{"start":{"line":2,"column":41},"end":{"line":2,"column":67}}, + "properties": [ + { + "type": "ObjectProperty", + "start":70,"end":92,"loc":{"start":{"line":2,"column":43},"end":{"line":2,"column":65}}, + "method": false, + "key": { + "type": "Identifier", + "start":70,"end":74,"loc":{"start":{"line":2,"column":43},"end":{"line":2,"column":47},"identifierName":"foo2"}, + "name": "foo2" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "ArrayPattern", + "start":76,"end":92,"loc":{"start":{"line":2,"column":49},"end":{"line":2,"column":65}}, + "elements": [ + { + "type": "ObjectPattern", + "start":77,"end":91,"loc":{"start":{"line":2,"column":50},"end":{"line":2,"column":64}}, + "properties": [ + { + "type": "ObjectProperty", + "start":79,"end":89,"loc":{"start":{"line":2,"column":52},"end":{"line":2,"column":62}}, + "method": false, + "key": { + "type": "Identifier", + "start":79,"end":83,"loc":{"start":{"line":2,"column":52},"end":{"line":2,"column":56},"identifierName":"foo3"}, + "name": "foo3" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "Identifier", + "start":85,"end":89,"loc":{"start":{"line":2,"column":58},"end":{"line":2,"column":62},"identifierName":"foo4"}, + "name": "foo4" + } + } + ] + } + ] + } + } + ] + } + } + ] + }, + "init": { + "type": "Identifier", + "start":99,"end":102,"loc":{"start":{"line":2,"column":72},"end":{"line":2,"column":75},"identifierName":"bar"}, + "name": "bar" + } + } + ], + "kind": "const" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring14/options.json b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring14/options.json deleted file mode 100644 index 80640e0ce127..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring14/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'foo' has already been declared (2:21)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring14/output.json b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring14/output.json new file mode 100644 index 000000000000..c0baf34cf9a6 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring14/output.json @@ -0,0 +1,93 @@ +{ + "type": "File", + "start":0,"end":55,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":33}}, + "errors": [ + "SyntaxError: Identifier 'foo' has already been declared (2:21)", + "SyntaxError: `foo` has already been exported. Exported identifiers must be unique. (2:21)" + ], + "program": { + "type": "Program", + "start":0,"end":55,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":33}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExportNamedDeclaration", + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, + "specifiers": [], + "source": null, + "declaration": { + "type": "VariableDeclaration", + "start":7,"end":21,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":21}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":13,"end":20,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":20}}, + "id": { + "type": "Identifier", + "start":13,"end":16,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":16},"identifierName":"foo"}, + "name": "foo" + }, + "init": { + "type": "NumericLiteral", + "start":19,"end":20,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":20}}, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + ], + "kind": "const" + } + }, + { + "type": "ExportNamedDeclaration", + "start":22,"end":55,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":33}}, + "specifiers": [], + "source": null, + "declaration": { + "type": "VariableDeclaration", + "start":29,"end":55,"loc":{"start":{"line":2,"column":7},"end":{"line":2,"column":33}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":35,"end":54,"loc":{"start":{"line":2,"column":13},"end":{"line":2,"column":32}}, + "id": { + "type": "ObjectPattern", + "start":35,"end":48,"loc":{"start":{"line":2,"column":13},"end":{"line":2,"column":26}}, + "properties": [ + { + "type": "ObjectProperty", + "start":37,"end":46,"loc":{"start":{"line":2,"column":15},"end":{"line":2,"column":24}}, + "method": false, + "key": { + "type": "Identifier", + "start":37,"end":41,"loc":{"start":{"line":2,"column":15},"end":{"line":2,"column":19},"identifierName":"foo2"}, + "name": "foo2" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "Identifier", + "start":43,"end":46,"loc":{"start":{"line":2,"column":21},"end":{"line":2,"column":24},"identifierName":"foo"}, + "name": "foo" + } + } + ] + }, + "init": { + "type": "Identifier", + "start":51,"end":54,"loc":{"start":{"line":2,"column":29},"end":{"line":2,"column":32},"identifierName":"bar"}, + "name": "bar" + } + } + ], + "kind": "const" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring15/options.json b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring15/options.json deleted file mode 100644 index ea3a9b62f493..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring15/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'foo2' has already been declared (2:13)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring15/output.json b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring15/output.json new file mode 100644 index 000000000000..3d24d4832079 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring15/output.json @@ -0,0 +1,93 @@ +{ + "type": "File", + "start":0,"end":56,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":22}}, + "errors": [ + "SyntaxError: Identifier 'foo2' has already been declared (2:13)", + "SyntaxError: `foo2` has already been exported. Exported identifiers must be unique. (2:13)" + ], + "program": { + "type": "Program", + "start":0,"end":56,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":22}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExportNamedDeclaration", + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, + "specifiers": [], + "source": null, + "declaration": { + "type": "VariableDeclaration", + "start":7,"end":33,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":33}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":13,"end":32,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":32}}, + "id": { + "type": "ObjectPattern", + "start":13,"end":26,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":26}}, + "properties": [ + { + "type": "ObjectProperty", + "start":15,"end":24,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":24}}, + "method": false, + "key": { + "type": "Identifier", + "start":15,"end":18,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":18},"identifierName":"foo"}, + "name": "foo" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "Identifier", + "start":20,"end":24,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":24},"identifierName":"foo2"}, + "name": "foo2" + } + } + ] + }, + "init": { + "type": "Identifier", + "start":29,"end":32,"loc":{"start":{"line":1,"column":29},"end":{"line":1,"column":32},"identifierName":"bar"}, + "name": "bar" + } + } + ], + "kind": "const" + } + }, + { + "type": "ExportNamedDeclaration", + "start":34,"end":56,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":22}}, + "specifiers": [], + "source": null, + "declaration": { + "type": "VariableDeclaration", + "start":41,"end":56,"loc":{"start":{"line":2,"column":7},"end":{"line":2,"column":22}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":47,"end":55,"loc":{"start":{"line":2,"column":13},"end":{"line":2,"column":21}}, + "id": { + "type": "Identifier", + "start":47,"end":51,"loc":{"start":{"line":2,"column":13},"end":{"line":2,"column":17},"identifierName":"foo2"}, + "name": "foo2" + }, + "init": { + "type": "NumericLiteral", + "start":54,"end":55,"loc":{"start":{"line":2,"column":20},"end":{"line":2,"column":21}}, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + ], + "kind": "const" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring16/options.json b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring16/options.json deleted file mode 100644 index 42c862ad273a..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring16/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'foo' has already been declared (2:22)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring16/output.json b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring16/output.json new file mode 100644 index 000000000000..02547f2eee7d --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring16/output.json @@ -0,0 +1,90 @@ +{ + "type": "File", + "start":0,"end":55,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":33}}, + "errors": [ + "SyntaxError: Identifier 'foo' has already been declared (2:22)", + "SyntaxError: `foo` has already been exported. Exported identifiers must be unique. (2:22)" + ], + "program": { + "type": "Program", + "start":0,"end":55,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":33}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExportNamedDeclaration", + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, + "specifiers": [], + "source": null, + "declaration": { + "type": "VariableDeclaration", + "start":7,"end":21,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":21}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":13,"end":20,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":20}}, + "id": { + "type": "Identifier", + "start":13,"end":16,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":16},"identifierName":"foo"}, + "name": "foo" + }, + "init": { + "type": "NumericLiteral", + "start":19,"end":20,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":20}}, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + ], + "kind": "const" + } + }, + { + "type": "ExportNamedDeclaration", + "start":22,"end":55,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":33}}, + "specifiers": [], + "source": null, + "declaration": { + "type": "VariableDeclaration", + "start":29,"end":55,"loc":{"start":{"line":2,"column":7},"end":{"line":2,"column":33}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":35,"end":54,"loc":{"start":{"line":2,"column":13},"end":{"line":2,"column":32}}, + "id": { + "type": "ArrayPattern", + "start":35,"end":48,"loc":{"start":{"line":2,"column":13},"end":{"line":2,"column":26}}, + "elements": [ + { + "type": "Identifier", + "start":36,"end":39,"loc":{"start":{"line":2,"column":14},"end":{"line":2,"column":17},"identifierName":"bar"}, + "name": "bar" + }, + { + "type": "RestElement", + "start":41,"end":47,"loc":{"start":{"line":2,"column":19},"end":{"line":2,"column":25}}, + "argument": { + "type": "Identifier", + "start":44,"end":47,"loc":{"start":{"line":2,"column":22},"end":{"line":2,"column":25},"identifierName":"foo"}, + "name": "foo" + } + } + ] + }, + "init": { + "type": "Identifier", + "start":51,"end":54,"loc":{"start":{"line":2,"column":29},"end":{"line":2,"column":32},"identifierName":"baz"}, + "name": "baz" + } + } + ], + "kind": "const" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring17/options.json b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring17/options.json deleted file mode 100644 index 125c2618435d..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring17/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'bar' has already been declared (2:13)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring17/output.json b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring17/output.json new file mode 100644 index 000000000000..df81eb4ac1a5 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring17/output.json @@ -0,0 +1,90 @@ +{ + "type": "File", + "start":0,"end":55,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":21}}, + "errors": [ + "SyntaxError: Identifier 'bar' has already been declared (2:13)", + "SyntaxError: `bar` has already been exported. Exported identifiers must be unique. (2:13)" + ], + "program": { + "type": "Program", + "start":0,"end":55,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":21}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExportNamedDeclaration", + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, + "specifiers": [], + "source": null, + "declaration": { + "type": "VariableDeclaration", + "start":7,"end":33,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":33}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":13,"end":32,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":32}}, + "id": { + "type": "ArrayPattern", + "start":13,"end":26,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":26}}, + "elements": [ + { + "type": "Identifier", + "start":14,"end":17,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":17},"identifierName":"foo"}, + "name": "foo" + }, + { + "type": "RestElement", + "start":19,"end":25,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":25}}, + "argument": { + "type": "Identifier", + "start":22,"end":25,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":25},"identifierName":"bar"}, + "name": "bar" + } + } + ] + }, + "init": { + "type": "Identifier", + "start":29,"end":32,"loc":{"start":{"line":1,"column":29},"end":{"line":1,"column":32},"identifierName":"baz"}, + "name": "baz" + } + } + ], + "kind": "const" + } + }, + { + "type": "ExportNamedDeclaration", + "start":34,"end":55,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":21}}, + "specifiers": [], + "source": null, + "declaration": { + "type": "VariableDeclaration", + "start":41,"end":55,"loc":{"start":{"line":2,"column":7},"end":{"line":2,"column":21}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":47,"end":54,"loc":{"start":{"line":2,"column":13},"end":{"line":2,"column":20}}, + "id": { + "type": "Identifier", + "start":47,"end":50,"loc":{"start":{"line":2,"column":13},"end":{"line":2,"column":16},"identifierName":"bar"}, + "name": "bar" + }, + "init": { + "type": "NumericLiteral", + "start":53,"end":54,"loc":{"start":{"line":2,"column":19},"end":{"line":2,"column":20}}, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + ], + "kind": "const" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring18/options.json b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring18/options.json deleted file mode 100644 index bf345ea77127..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring18/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'foo' has already been declared (2:28)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring18/output.json b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring18/output.json new file mode 100644 index 000000000000..23ff7e9f4422 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring18/output.json @@ -0,0 +1,101 @@ +{ + "type": "File", + "start":0,"end":62,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":40}}, + "errors": [ + "SyntaxError: Identifier 'foo' has already been declared (2:28)", + "SyntaxError: `foo` has already been exported. Exported identifiers must be unique. (2:28)" + ], + "program": { + "type": "Program", + "start":0,"end":62,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":40}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExportNamedDeclaration", + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, + "specifiers": [], + "source": null, + "declaration": { + "type": "VariableDeclaration", + "start":7,"end":21,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":21}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":13,"end":20,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":20}}, + "id": { + "type": "Identifier", + "start":13,"end":16,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":16},"identifierName":"foo"}, + "name": "foo" + }, + "init": { + "type": "NumericLiteral", + "start":19,"end":20,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":20}}, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + ], + "kind": "const" + } + }, + { + "type": "ExportNamedDeclaration", + "start":22,"end":62,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":40}}, + "specifiers": [], + "source": null, + "declaration": { + "type": "VariableDeclaration", + "start":29,"end":62,"loc":{"start":{"line":2,"column":7},"end":{"line":2,"column":40}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":35,"end":61,"loc":{"start":{"line":2,"column":13},"end":{"line":2,"column":39}}, + "id": { + "type": "ArrayPattern", + "start":35,"end":55,"loc":{"start":{"line":2,"column":13},"end":{"line":2,"column":33}}, + "elements": [ + { + "type": "Identifier", + "start":36,"end":39,"loc":{"start":{"line":2,"column":14},"end":{"line":2,"column":17},"identifierName":"bar"}, + "name": "bar" + }, + { + "type": "ArrayPattern", + "start":41,"end":54,"loc":{"start":{"line":2,"column":19},"end":{"line":2,"column":32}}, + "elements": [ + { + "type": "Identifier", + "start":42,"end":45,"loc":{"start":{"line":2,"column":20},"end":{"line":2,"column":23},"identifierName":"baz"}, + "name": "baz" + }, + { + "type": "RestElement", + "start":47,"end":53,"loc":{"start":{"line":2,"column":25},"end":{"line":2,"column":31}}, + "argument": { + "type": "Identifier", + "start":50,"end":53,"loc":{"start":{"line":2,"column":28},"end":{"line":2,"column":31},"identifierName":"foo"}, + "name": "foo" + } + } + ] + } + ] + }, + "init": { + "type": "Identifier", + "start":58,"end":61,"loc":{"start":{"line":2,"column":36},"end":{"line":2,"column":39},"identifierName":"qux"}, + "name": "qux" + } + } + ], + "kind": "const" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring19/options.json b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring19/options.json deleted file mode 100644 index bf2483362193..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring19/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'foo' has already been declared (2:29)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring19/output.json b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring19/output.json new file mode 100644 index 000000000000..2c99a1b1d6ae --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring19/output.json @@ -0,0 +1,108 @@ +{ + "type": "File", + "start":0,"end":64,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":42}}, + "errors": [ + "SyntaxError: Identifier 'foo' has already been declared (2:29)", + "SyntaxError: `foo` has already been exported. Exported identifiers must be unique. (2:29)" + ], + "program": { + "type": "Program", + "start":0,"end":64,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":42}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExportNamedDeclaration", + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, + "specifiers": [], + "source": null, + "declaration": { + "type": "VariableDeclaration", + "start":7,"end":21,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":21}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":13,"end":20,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":20}}, + "id": { + "type": "Identifier", + "start":13,"end":16,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":16},"identifierName":"foo"}, + "name": "foo" + }, + "init": { + "type": "NumericLiteral", + "start":19,"end":20,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":20}}, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + ], + "kind": "const" + } + }, + { + "type": "ExportNamedDeclaration", + "start":22,"end":64,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":42}}, + "specifiers": [], + "source": null, + "declaration": { + "type": "VariableDeclaration", + "start":29,"end":64,"loc":{"start":{"line":2,"column":7},"end":{"line":2,"column":42}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":35,"end":63,"loc":{"start":{"line":2,"column":13},"end":{"line":2,"column":41}}, + "id": { + "type": "ObjectPattern", + "start":35,"end":57,"loc":{"start":{"line":2,"column":13},"end":{"line":2,"column":35}}, + "properties": [ + { + "type": "ObjectProperty", + "start":37,"end":55,"loc":{"start":{"line":2,"column":15},"end":{"line":2,"column":33}}, + "method": false, + "key": { + "type": "Identifier", + "start":37,"end":40,"loc":{"start":{"line":2,"column":15},"end":{"line":2,"column":18},"identifierName":"bar"}, + "name": "bar" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "ArrayPattern", + "start":42,"end":55,"loc":{"start":{"line":2,"column":20},"end":{"line":2,"column":33}}, + "elements": [ + { + "type": "Identifier", + "start":43,"end":46,"loc":{"start":{"line":2,"column":21},"end":{"line":2,"column":24},"identifierName":"baz"}, + "name": "baz" + }, + { + "type": "RestElement", + "start":48,"end":54,"loc":{"start":{"line":2,"column":26},"end":{"line":2,"column":32}}, + "argument": { + "type": "Identifier", + "start":51,"end":54,"loc":{"start":{"line":2,"column":29},"end":{"line":2,"column":32},"identifierName":"foo"}, + "name": "foo" + } + } + ] + } + } + ] + }, + "init": { + "type": "Identifier", + "start":60,"end":63,"loc":{"start":{"line":2,"column":38},"end":{"line":2,"column":41},"identifierName":"qux"}, + "name": "qux" + } + } + ], + "kind": "const" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring2/options.json b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring2/options.json deleted file mode 100644 index 2cbe06c40914..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring2/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'foo' has already been declared (2:15)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring2/output.json b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring2/output.json new file mode 100644 index 000000000000..4673f3337235 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring2/output.json @@ -0,0 +1,93 @@ +{ + "type": "File", + "start":0,"end":53,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":27}}, + "errors": [ + "SyntaxError: Identifier 'foo' has already been declared (2:15)", + "SyntaxError: `foo` has already been exported. Exported identifiers must be unique. (2:15)" + ], + "program": { + "type": "Program", + "start":0,"end":53,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":27}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExportNamedDeclaration", + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, + "specifiers": [], + "source": null, + "declaration": { + "type": "FunctionDeclaration", + "start":7,"end":24,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":24}}, + "id": { + "type": "Identifier", + "start":16,"end":19,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":19},"identifierName":"foo"}, + "name": "foo" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":22,"end":24,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":24}}, + "body": [], + "directives": [] + } + } + }, + { + "type": "EmptyStatement", + "start":24,"end":25,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":25}} + }, + { + "type": "ExportNamedDeclaration", + "start":26,"end":53,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":27}}, + "specifiers": [], + "source": null, + "declaration": { + "type": "VariableDeclaration", + "start":33,"end":53,"loc":{"start":{"line":2,"column":7},"end":{"line":2,"column":27}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":39,"end":52,"loc":{"start":{"line":2,"column":13},"end":{"line":2,"column":26}}, + "id": { + "type": "ObjectPattern", + "start":39,"end":46,"loc":{"start":{"line":2,"column":13},"end":{"line":2,"column":20}}, + "properties": [ + { + "type": "ObjectProperty", + "start":41,"end":44,"loc":{"start":{"line":2,"column":15},"end":{"line":2,"column":18}}, + "method": false, + "key": { + "type": "Identifier", + "start":41,"end":44,"loc":{"start":{"line":2,"column":15},"end":{"line":2,"column":18},"identifierName":"foo"}, + "name": "foo" + }, + "computed": false, + "shorthand": true, + "value": { + "type": "Identifier", + "start":41,"end":44,"loc":{"start":{"line":2,"column":15},"end":{"line":2,"column":18},"identifierName":"foo"}, + "name": "foo" + }, + "extra": { + "shorthand": true + } + } + ] + }, + "init": { + "type": "Identifier", + "start":49,"end":52,"loc":{"start":{"line":2,"column":23},"end":{"line":2,"column":26},"identifierName":"bar"}, + "name": "bar" + } + } + ], + "kind": "const" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring3/options.json b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring3/options.json deleted file mode 100644 index d36390356990..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring3/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'foo' has already been declared (2:16)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring3/output.json b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring3/output.json new file mode 100644 index 000000000000..300af91efc82 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring3/output.json @@ -0,0 +1,93 @@ +{ + "type": "File", + "start":0,"end":53,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":25}}, + "errors": [ + "SyntaxError: Identifier 'foo' has already been declared (2:16)", + "SyntaxError: `foo` has already been exported. Exported identifiers must be unique. (2:0)" + ], + "program": { + "type": "Program", + "start":0,"end":53,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":25}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExportNamedDeclaration", + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, + "specifiers": [], + "source": null, + "declaration": { + "type": "VariableDeclaration", + "start":7,"end":27,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":27}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":13,"end":26,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":26}}, + "id": { + "type": "ObjectPattern", + "start":13,"end":20,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":20}}, + "properties": [ + { + "type": "ObjectProperty", + "start":15,"end":18,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":18}}, + "method": false, + "key": { + "type": "Identifier", + "start":15,"end":18,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":18},"identifierName":"foo"}, + "name": "foo" + }, + "computed": false, + "shorthand": true, + "value": { + "type": "Identifier", + "start":15,"end":18,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":18},"identifierName":"foo"}, + "name": "foo" + }, + "extra": { + "shorthand": true + } + } + ] + }, + "init": { + "type": "Identifier", + "start":23,"end":26,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":26},"identifierName":"bar"}, + "name": "bar" + } + } + ], + "kind": "const" + } + }, + { + "type": "ExportNamedDeclaration", + "start":28,"end":52,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":24}}, + "specifiers": [], + "source": null, + "declaration": { + "type": "FunctionDeclaration", + "start":35,"end":52,"loc":{"start":{"line":2,"column":7},"end":{"line":2,"column":24}}, + "id": { + "type": "Identifier", + "start":44,"end":47,"loc":{"start":{"line":2,"column":16},"end":{"line":2,"column":19},"identifierName":"foo"}, + "name": "foo" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":50,"end":52,"loc":{"start":{"line":2,"column":22},"end":{"line":2,"column":24}}, + "body": [], + "directives": [] + } + } + }, + { + "type": "EmptyStatement", + "start":52,"end":53,"loc":{"start":{"line":2,"column":24},"end":{"line":2,"column":25}} + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring4/options.json b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring4/options.json deleted file mode 100644 index 46358493589c..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring4/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'foo' has already been declared (2:14)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring4/output.json b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring4/output.json new file mode 100644 index 000000000000..54ca454dbed6 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring4/output.json @@ -0,0 +1,78 @@ +{ + "type": "File", + "start":0,"end":51,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":25}}, + "errors": [ + "SyntaxError: Identifier 'foo' has already been declared (2:14)", + "SyntaxError: `foo` has already been exported. Exported identifiers must be unique. (2:14)" + ], + "program": { + "type": "Program", + "start":0,"end":51,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":25}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExportNamedDeclaration", + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, + "specifiers": [], + "source": null, + "declaration": { + "type": "FunctionDeclaration", + "start":7,"end":24,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":24}}, + "id": { + "type": "Identifier", + "start":16,"end":19,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":19},"identifierName":"foo"}, + "name": "foo" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":22,"end":24,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":24}}, + "body": [], + "directives": [] + } + } + }, + { + "type": "EmptyStatement", + "start":24,"end":25,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":25}} + }, + { + "type": "ExportNamedDeclaration", + "start":26,"end":51,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":25}}, + "specifiers": [], + "source": null, + "declaration": { + "type": "VariableDeclaration", + "start":33,"end":51,"loc":{"start":{"line":2,"column":7},"end":{"line":2,"column":25}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":39,"end":50,"loc":{"start":{"line":2,"column":13},"end":{"line":2,"column":24}}, + "id": { + "type": "ArrayPattern", + "start":39,"end":44,"loc":{"start":{"line":2,"column":13},"end":{"line":2,"column":18}}, + "elements": [ + { + "type": "Identifier", + "start":40,"end":43,"loc":{"start":{"line":2,"column":14},"end":{"line":2,"column":17},"identifierName":"foo"}, + "name": "foo" + } + ] + }, + "init": { + "type": "Identifier", + "start":47,"end":50,"loc":{"start":{"line":2,"column":21},"end":{"line":2,"column":24},"identifierName":"bar"}, + "name": "bar" + } + } + ], + "kind": "const" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring5/options.json b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring5/options.json deleted file mode 100644 index d36390356990..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring5/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'foo' has already been declared (2:16)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring5/output.json b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring5/output.json new file mode 100644 index 000000000000..f8265d2b7780 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring5/output.json @@ -0,0 +1,78 @@ +{ + "type": "File", + "start":0,"end":51,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":25}}, + "errors": [ + "SyntaxError: Identifier 'foo' has already been declared (2:16)", + "SyntaxError: `foo` has already been exported. Exported identifiers must be unique. (2:0)" + ], + "program": { + "type": "Program", + "start":0,"end":51,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":25}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExportNamedDeclaration", + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, + "specifiers": [], + "source": null, + "declaration": { + "type": "VariableDeclaration", + "start":7,"end":25,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":25}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":13,"end":24,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":24}}, + "id": { + "type": "ArrayPattern", + "start":13,"end":18,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":18}}, + "elements": [ + { + "type": "Identifier", + "start":14,"end":17,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":17},"identifierName":"foo"}, + "name": "foo" + } + ] + }, + "init": { + "type": "Identifier", + "start":21,"end":24,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":24},"identifierName":"bar"}, + "name": "bar" + } + } + ], + "kind": "const" + } + }, + { + "type": "ExportNamedDeclaration", + "start":26,"end":50,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":24}}, + "specifiers": [], + "source": null, + "declaration": { + "type": "FunctionDeclaration", + "start":33,"end":50,"loc":{"start":{"line":2,"column":7},"end":{"line":2,"column":24}}, + "id": { + "type": "Identifier", + "start":42,"end":45,"loc":{"start":{"line":2,"column":16},"end":{"line":2,"column":19},"identifierName":"foo"}, + "name": "foo" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":48,"end":50,"loc":{"start":{"line":2,"column":22},"end":{"line":2,"column":24}}, + "body": [], + "directives": [] + } + } + }, + { + "type": "EmptyStatement", + "start":50,"end":51,"loc":{"start":{"line":2,"column":24},"end":{"line":2,"column":25}} + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring6/options.json b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring6/options.json deleted file mode 100644 index 46358493589c..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring6/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'foo' has already been declared (2:14)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring6/output.json b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring6/output.json new file mode 100644 index 000000000000..74dc3d4b6e5f --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring6/output.json @@ -0,0 +1,98 @@ +{ + "type": "File", + "start":0,"end":54,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":26}}, + "errors": [ + "SyntaxError: Identifier 'foo' has already been declared (2:14)", + "SyntaxError: `foo` has already been exported. Exported identifiers must be unique. (2:14)" + ], + "program": { + "type": "Program", + "start":0,"end":54,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":26}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExportNamedDeclaration", + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, + "specifiers": [], + "source": null, + "declaration": { + "type": "VariableDeclaration", + "start":7,"end":27,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":27}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":13,"end":26,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":26}}, + "id": { + "type": "ObjectPattern", + "start":13,"end":20,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":20}}, + "properties": [ + { + "type": "ObjectProperty", + "start":15,"end":18,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":18}}, + "method": false, + "key": { + "type": "Identifier", + "start":15,"end":18,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":18},"identifierName":"foo"}, + "name": "foo" + }, + "computed": false, + "shorthand": true, + "value": { + "type": "Identifier", + "start":15,"end":18,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":18},"identifierName":"foo"}, + "name": "foo" + }, + "extra": { + "shorthand": true + } + } + ] + }, + "init": { + "type": "Identifier", + "start":23,"end":26,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":26},"identifierName":"bar"}, + "name": "bar" + } + } + ], + "kind": "const" + } + }, + { + "type": "ExportNamedDeclaration", + "start":28,"end":54,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":26}}, + "specifiers": [], + "source": null, + "declaration": { + "type": "VariableDeclaration", + "start":35,"end":54,"loc":{"start":{"line":2,"column":7},"end":{"line":2,"column":26}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":41,"end":53,"loc":{"start":{"line":2,"column":13},"end":{"line":2,"column":25}}, + "id": { + "type": "ArrayPattern", + "start":41,"end":46,"loc":{"start":{"line":2,"column":13},"end":{"line":2,"column":18}}, + "elements": [ + { + "type": "Identifier", + "start":42,"end":45,"loc":{"start":{"line":2,"column":14},"end":{"line":2,"column":17},"identifierName":"foo"}, + "name": "foo" + } + ] + }, + "init": { + "type": "Identifier", + "start":49,"end":53,"loc":{"start":{"line":2,"column":21},"end":{"line":2,"column":25},"identifierName":"bar2"}, + "name": "bar2" + } + } + ], + "kind": "const" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring7/options.json b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring7/options.json deleted file mode 100644 index 2cbe06c40914..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring7/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'foo' has already been declared (2:15)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring7/output.json b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring7/output.json new file mode 100644 index 000000000000..90a9d8e8df78 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring7/output.json @@ -0,0 +1,98 @@ +{ + "type": "File", + "start":0,"end":54,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":28}}, + "errors": [ + "SyntaxError: Identifier 'foo' has already been declared (2:15)", + "SyntaxError: `foo` has already been exported. Exported identifiers must be unique. (2:15)" + ], + "program": { + "type": "Program", + "start":0,"end":54,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":28}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExportNamedDeclaration", + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, + "specifiers": [], + "source": null, + "declaration": { + "type": "VariableDeclaration", + "start":7,"end":25,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":25}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":13,"end":24,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":24}}, + "id": { + "type": "ArrayPattern", + "start":13,"end":18,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":18}}, + "elements": [ + { + "type": "Identifier", + "start":14,"end":17,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":17},"identifierName":"foo"}, + "name": "foo" + } + ] + }, + "init": { + "type": "Identifier", + "start":21,"end":24,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":24},"identifierName":"bar"}, + "name": "bar" + } + } + ], + "kind": "const" + } + }, + { + "type": "ExportNamedDeclaration", + "start":26,"end":54,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":28}}, + "specifiers": [], + "source": null, + "declaration": { + "type": "VariableDeclaration", + "start":33,"end":54,"loc":{"start":{"line":2,"column":7},"end":{"line":2,"column":28}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":39,"end":53,"loc":{"start":{"line":2,"column":13},"end":{"line":2,"column":27}}, + "id": { + "type": "ObjectPattern", + "start":39,"end":46,"loc":{"start":{"line":2,"column":13},"end":{"line":2,"column":20}}, + "properties": [ + { + "type": "ObjectProperty", + "start":41,"end":44,"loc":{"start":{"line":2,"column":15},"end":{"line":2,"column":18}}, + "method": false, + "key": { + "type": "Identifier", + "start":41,"end":44,"loc":{"start":{"line":2,"column":15},"end":{"line":2,"column":18},"identifierName":"foo"}, + "name": "foo" + }, + "computed": false, + "shorthand": true, + "value": { + "type": "Identifier", + "start":41,"end":44,"loc":{"start":{"line":2,"column":15},"end":{"line":2,"column":18},"identifierName":"foo"}, + "name": "foo" + }, + "extra": { + "shorthand": true + } + } + ] + }, + "init": { + "type": "Identifier", + "start":49,"end":53,"loc":{"start":{"line":2,"column":23},"end":{"line":2,"column":27},"identifierName":"bar2"}, + "name": "bar2" + } + } + ], + "kind": "const" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring8/options.json b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring8/options.json deleted file mode 100644 index 982078d803c6..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring8/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'Foo' has already been declared (2:15)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring8/output.json b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring8/output.json new file mode 100644 index 000000000000..b09cb52efb83 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring8/output.json @@ -0,0 +1,90 @@ +{ + "type": "File", + "start":0,"end":48,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":27}}, + "errors": [ + "SyntaxError: Identifier 'Foo' has already been declared (2:15)", + "SyntaxError: `Foo` has already been exported. Exported identifiers must be unique. (2:15)" + ], + "program": { + "type": "Program", + "start":0,"end":48,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":27}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExportNamedDeclaration", + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, + "specifiers": [], + "source": null, + "declaration": { + "type": "ClassDeclaration", + "start":7,"end":19,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":19}}, + "id": { + "type": "Identifier", + "start":13,"end":16,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":16},"identifierName":"Foo"}, + "name": "Foo" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":17,"end":19,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":19}}, + "body": [] + } + } + }, + { + "type": "EmptyStatement", + "start":19,"end":20,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":20}} + }, + { + "type": "ExportNamedDeclaration", + "start":21,"end":48,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":27}}, + "specifiers": [], + "source": null, + "declaration": { + "type": "VariableDeclaration", + "start":28,"end":48,"loc":{"start":{"line":2,"column":7},"end":{"line":2,"column":27}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":34,"end":47,"loc":{"start":{"line":2,"column":13},"end":{"line":2,"column":26}}, + "id": { + "type": "ObjectPattern", + "start":34,"end":41,"loc":{"start":{"line":2,"column":13},"end":{"line":2,"column":20}}, + "properties": [ + { + "type": "ObjectProperty", + "start":36,"end":39,"loc":{"start":{"line":2,"column":15},"end":{"line":2,"column":18}}, + "method": false, + "key": { + "type": "Identifier", + "start":36,"end":39,"loc":{"start":{"line":2,"column":15},"end":{"line":2,"column":18},"identifierName":"Foo"}, + "name": "Foo" + }, + "computed": false, + "shorthand": true, + "value": { + "type": "Identifier", + "start":36,"end":39,"loc":{"start":{"line":2,"column":15},"end":{"line":2,"column":18},"identifierName":"Foo"}, + "name": "Foo" + }, + "extra": { + "shorthand": true + } + } + ] + }, + "init": { + "type": "Identifier", + "start":44,"end":47,"loc":{"start":{"line":2,"column":23},"end":{"line":2,"column":26},"identifierName":"bar"}, + "name": "bar" + } + } + ], + "kind": "const" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring9/options.json b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring9/options.json deleted file mode 100644 index f79b5469b1c0..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring9/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'Foo' has already been declared (2:14)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring9/output.json b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring9/output.json new file mode 100644 index 000000000000..db65b77d4d43 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring9/output.json @@ -0,0 +1,75 @@ +{ + "type": "File", + "start":0,"end":46,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":25}}, + "errors": [ + "SyntaxError: Identifier 'Foo' has already been declared (2:14)", + "SyntaxError: `Foo` has already been exported. Exported identifiers must be unique. (2:14)" + ], + "program": { + "type": "Program", + "start":0,"end":46,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":25}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExportNamedDeclaration", + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, + "specifiers": [], + "source": null, + "declaration": { + "type": "ClassDeclaration", + "start":7,"end":19,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":19}}, + "id": { + "type": "Identifier", + "start":13,"end":16,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":16},"identifierName":"Foo"}, + "name": "Foo" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":17,"end":19,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":19}}, + "body": [] + } + } + }, + { + "type": "EmptyStatement", + "start":19,"end":20,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":20}} + }, + { + "type": "ExportNamedDeclaration", + "start":21,"end":46,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":25}}, + "specifiers": [], + "source": null, + "declaration": { + "type": "VariableDeclaration", + "start":28,"end":46,"loc":{"start":{"line":2,"column":7},"end":{"line":2,"column":25}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":34,"end":45,"loc":{"start":{"line":2,"column":13},"end":{"line":2,"column":24}}, + "id": { + "type": "ArrayPattern", + "start":34,"end":39,"loc":{"start":{"line":2,"column":13},"end":{"line":2,"column":18}}, + "elements": [ + { + "type": "Identifier", + "start":35,"end":38,"loc":{"start":{"line":2,"column":14},"end":{"line":2,"column":17},"identifierName":"Foo"}, + "name": "Foo" + } + ] + }, + "init": { + "type": "Identifier", + "start":42,"end":45,"loc":{"start":{"line":2,"column":21},"end":{"line":2,"column":24},"identifierName":"bar"}, + "name": "bar" + } + } + ], + "kind": "const" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-function-declaration/options.json b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-function-declaration/options.json index 1923e4752336..2104ca43283f 100644 --- a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-function-declaration/options.json +++ b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-function-declaration/options.json @@ -1,3 +1,3 @@ { - "throws": "`foo` has already been exported. Exported identifiers must be unique. (2:0)" + "sourceType": "module" } diff --git a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-function-declaration/output.json b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-function-declaration/output.json new file mode 100644 index 000000000000..411c0c758dce --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-function-declaration/output.json @@ -0,0 +1,66 @@ +{ + "type": "File", + "start":0,"end":41,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":25}}, + "errors": [ + "SyntaxError: `foo` has already been exported. Exported identifiers must be unique. (2:0)" + ], + "program": { + "type": "Program", + "start":0,"end":41,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":25}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExportNamedDeclaration", + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, + "specifiers": [ + { + "type": "ExportSpecifier", + "start":9,"end":12,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":12}}, + "local": { + "type": "Identifier", + "start":9,"end":12,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":12},"identifierName":"foo"}, + "name": "foo" + }, + "exported": { + "type": "Identifier", + "start":9,"end":12,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":12},"identifierName":"foo"}, + "name": "foo" + } + } + ], + "source": null, + "declaration": null + }, + { + "type": "ExportNamedDeclaration", + "start":16,"end":40,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":24}}, + "specifiers": [], + "source": null, + "declaration": { + "type": "FunctionDeclaration", + "start":23,"end":40,"loc":{"start":{"line":2,"column":7},"end":{"line":2,"column":24}}, + "id": { + "type": "Identifier", + "start":32,"end":35,"loc":{"start":{"line":2,"column":16},"end":{"line":2,"column":19},"identifierName":"foo"}, + "name": "foo" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":38,"end":40,"loc":{"start":{"line":2,"column":22},"end":{"line":2,"column":24}}, + "body": [], + "directives": [] + } + } + }, + { + "type": "EmptyStatement", + "start":40,"end":41,"loc":{"start":{"line":2,"column":24},"end":{"line":2,"column":25}} + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-variable-declaration/options.json b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-variable-declaration/options.json index 9fdf7082da17..2104ca43283f 100644 --- a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-variable-declaration/options.json +++ b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-variable-declaration/options.json @@ -1,3 +1,3 @@ { - "throws": "`foo` has already been exported. Exported identifiers must be unique. (2:13)" + "sourceType": "module" } diff --git a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-variable-declaration/output.json b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-variable-declaration/output.json new file mode 100644 index 000000000000..65c91019ea3a --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-variable-declaration/output.json @@ -0,0 +1,65 @@ +{ + "type": "File", + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":23}}, + "errors": [ + "SyntaxError: `foo` has already been exported. Exported identifiers must be unique. (2:13)" + ], + "program": { + "type": "Program", + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":23}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExportNamedDeclaration", + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, + "specifiers": [ + { + "type": "ExportSpecifier", + "start":9,"end":12,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":12}}, + "local": { + "type": "Identifier", + "start":9,"end":12,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":12},"identifierName":"foo"}, + "name": "foo" + }, + "exported": { + "type": "Identifier", + "start":9,"end":12,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":12},"identifierName":"foo"}, + "name": "foo" + } + } + ], + "source": null, + "declaration": null + }, + { + "type": "ExportNamedDeclaration", + "start":16,"end":39,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":23}}, + "specifiers": [], + "source": null, + "declaration": { + "type": "VariableDeclaration", + "start":23,"end":39,"loc":{"start":{"line":2,"column":7},"end":{"line":2,"column":23}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":29,"end":38,"loc":{"start":{"line":2,"column":13},"end":{"line":2,"column":22}}, + "id": { + "type": "Identifier", + "start":29,"end":32,"loc":{"start":{"line":2,"column":13},"end":{"line":2,"column":16},"identifierName":"foo"}, + "name": "foo" + }, + "init": { + "type": "Identifier", + "start":35,"end":38,"loc":{"start":{"line":2,"column":19},"end":{"line":2,"column":22},"identifierName":"bar"}, + "name": "bar" + } + } + ], + "kind": "const" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export/options.json b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export/options.json index 9bb46f4778eb..2104ca43283f 100644 --- a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export/options.json +++ b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export/options.json @@ -1,3 +1,3 @@ { - "throws": "`foo` has already been exported. Exported identifiers must be unique. (2:9)" + "sourceType": "module" } diff --git a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export/output.json b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export/output.json new file mode 100644 index 000000000000..86c07bcfa5b0 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export/output.json @@ -0,0 +1,62 @@ +{ + "type": "File", + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":22}}, + "errors": [ + "SyntaxError: `foo` has already been exported. Exported identifiers must be unique. (2:9)", + "SyntaxError: Export 'foo' is not defined (1:9)", + "SyntaxError: Export 'bar' is not defined (2:9)" + ], + "program": { + "type": "Program", + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":22}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExportNamedDeclaration", + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, + "specifiers": [ + { + "type": "ExportSpecifier", + "start":9,"end":12,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":12}}, + "local": { + "type": "Identifier", + "start":9,"end":12,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":12},"identifierName":"foo"}, + "name": "foo" + }, + "exported": { + "type": "Identifier", + "start":9,"end":12,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":12},"identifierName":"foo"}, + "name": "foo" + } + } + ], + "source": null, + "declaration": null + }, + { + "type": "ExportNamedDeclaration", + "start":16,"end":38,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":22}}, + "specifiers": [ + { + "type": "ExportSpecifier", + "start":25,"end":35,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":19}}, + "local": { + "type": "Identifier", + "start":25,"end":28,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":12},"identifierName":"bar"}, + "name": "bar" + }, + "exported": { + "type": "Identifier", + "start":32,"end":35,"loc":{"start":{"line":2,"column":16},"end":{"line":2,"column":19},"identifierName":"foo"}, + "name": "foo" + } + } + ], + "source": null, + "declaration": null + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/modules/export-declaration-trailing-comma/input.js b/packages/babel-parser/test/fixtures/es2015/modules/export-declaration-trailing-comma/input.js new file mode 100644 index 000000000000..2524b3f08c75 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/modules/export-declaration-trailing-comma/input.js @@ -0,0 +1,5 @@ +export { + /* One */ Foo + /* Two */, + /* Three */ +} /* Four */ from "foo"; diff --git a/packages/babel-parser/test/fixtures/es2015/modules/export-declaration-trailing-comma/output.json b/packages/babel-parser/test/fixtures/es2015/modules/export-declaration-trailing-comma/output.json new file mode 100644 index 000000000000..bbffebd77d3d --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/modules/export-declaration-trailing-comma/output.json @@ -0,0 +1,89 @@ +{ + "type": "File", + "start":0,"end":76,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":24}}, + "program": { + "type": "Program", + "start":0,"end":76,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":24}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExportNamedDeclaration", + "start":0,"end":76,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":24}}, + "specifiers": [ + { + "type": "ExportSpecifier", + "start":21,"end":24,"loc":{"start":{"line":2,"column":12},"end":{"line":2,"column":15}}, + "local": { + "type": "Identifier", + "start":21,"end":24,"loc":{"start":{"line":2,"column":12},"end":{"line":2,"column":15},"identifierName":"Foo"}, + "name": "Foo" + }, + "exported": { + "type": "Identifier", + "start":21,"end":24,"loc":{"start":{"line":2,"column":12},"end":{"line":2,"column":15},"identifierName":"Foo"}, + "name": "Foo" + }, + "leadingComments": [ + { + "type": "CommentBlock", + "value": " One ", + "start":11,"end":20,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":11}} + } + ], + "trailingComments": [ + { + "type": "CommentBlock", + "value": " Two ", + "start":27,"end":36,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":11}} + }, + { + "type": "CommentBlock", + "value": " Three ", + "start":40,"end":51,"loc":{"start":{"line":4,"column":2},"end":{"line":4,"column":13}} + }, + { + "type": "CommentBlock", + "value": " Four ", + "start":54,"end":64,"loc":{"start":{"line":5,"column":2},"end":{"line":5,"column":12}} + } + ] + } + ], + "source": { + "type": "StringLiteral", + "start":70,"end":75,"loc":{"start":{"line":5,"column":18},"end":{"line":5,"column":23}}, + "extra": { + "rawValue": "foo", + "raw": "\"foo\"" + }, + "value": "foo" + }, + "declaration": null + } + ], + "directives": [] + }, + "comments": [ + { + "type": "CommentBlock", + "value": " One ", + "start":11,"end":20,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":11}} + }, + { + "type": "CommentBlock", + "value": " Two ", + "start":27,"end":36,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":11}} + }, + { + "type": "CommentBlock", + "value": " Three ", + "start":40,"end":51,"loc":{"start":{"line":4,"column":2},"end":{"line":4,"column":13}} + }, + { + "type": "CommentBlock", + "value": " Four ", + "start":54,"end":64,"loc":{"start":{"line":5,"column":2},"end":{"line":5,"column":12}} + } + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/modules/export-default-class-declaration/output.json b/packages/babel-parser/test/fixtures/es2015/modules/export-default-class-declaration/output.json index 72680f1b3a62..d10c09f162fa 100644 --- a/packages/babel-parser/test/fixtures/es2015/modules/export-default-class-declaration/output.json +++ b/packages/babel-parser/test/fixtures/es2015/modules/export-default-class-declaration/output.json @@ -1,94 +1,27 @@ { "type": "File", - "start": 0, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, "program": { "type": "Program", - "start": 0, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExportDefaultDeclaration", - "start": 0, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, "declaration": { "type": "ClassDeclaration", - "start": 15, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":15,"end":27,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":27}}, "id": { "type": "Identifier", - "start": 21, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 24 - }, - "identifierName": "Foo" - }, + "start":21,"end":24,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":24},"identifierName":"Foo"}, "name": "Foo" }, "superClass": null, "body": { "type": "ClassBody", - "start": 25, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":25,"end":27,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":27}}, "body": [] } } diff --git a/packages/babel-parser/test/fixtures/es2015/modules/export-default-class-expression/output.json b/packages/babel-parser/test/fixtures/es2015/modules/export-default-class-expression/output.json index 8302a22fd1c0..dd3e6ac4aac3 100644 --- a/packages/babel-parser/test/fixtures/es2015/modules/export-default-class-expression/output.json +++ b/packages/babel-parser/test/fixtures/es2015/modules/export-default-class-expression/output.json @@ -1,94 +1,27 @@ { "type": "File", - "start": 0, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, "program": { "type": "Program", - "start": 0, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExportDefaultDeclaration", - "start": 0, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, "declaration": { "type": "ClassExpression", - "start": 16, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":16,"end":28,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":28}}, "id": { "type": "Identifier", - "start": 22, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 25 - }, - "identifierName": "Foo" - }, + "start":22,"end":25,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":25},"identifierName":"Foo"}, "name": "Foo" }, "superClass": null, "body": { "type": "ClassBody", - "start": 26, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":26,"end":28,"loc":{"start":{"line":1,"column":26},"end":{"line":1,"column":28}}, "body": [] }, "extra": { diff --git a/packages/babel-parser/test/fixtures/es2015/modules/export-default-function-declaration-expression-disambiguation/output.json b/packages/babel-parser/test/fixtures/es2015/modules/export-default-function-declaration-expression-disambiguation/output.json index ac69f354fda6..87fa5a3be34f 100644 --- a/packages/babel-parser/test/fixtures/es2015/modules/export-default-function-declaration-expression-disambiguation/output.json +++ b/packages/babel-parser/test/fixtures/es2015/modules/export-default-function-declaration-expression-disambiguation/output.json @@ -1,80 +1,25 @@ { "type": "File", - "start": 0, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 6 - } - }, + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":6}}, "program": { "type": "Program", - "start": 0, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 6 - } - }, + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":6}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExportDefaultDeclaration", - "start": 0, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, "declaration": { "type": "FunctionDeclaration", - "start": 15, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":15,"end":29,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":29}}, "id": null, "generator": false, "async": false, "params": [], "body": { "type": "BlockStatement", - "start": 27, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":27,"end":29,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":29}}, "body": [], "directives": [] } @@ -82,33 +27,10 @@ }, { "type": "ExpressionStatement", - "start": 30, - "end": 36, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 6 - } - }, + "start":30,"end":36,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":6}}, "expression": { "type": "Identifier", - "start": 31, - "end": 34, - "loc": { - "start": { - "line": 2, - "column": 1 - }, - "end": { - "line": 2, - "column": 4 - }, - "identifierName": "foo" - }, + "start":31,"end":34,"loc":{"start":{"line":2,"column":1},"end":{"line":2,"column":4},"identifierName":"foo"}, "name": "foo", "extra": { "parenthesized": true, diff --git a/packages/babel-parser/test/fixtures/es2015/modules/export-default-function-declaration/output.json b/packages/babel-parser/test/fixtures/es2015/modules/export-default-function-declaration/output.json index bc8661b66b11..60073329efc7 100644 --- a/packages/babel-parser/test/fixtures/es2015/modules/export-default-function-declaration/output.json +++ b/packages/babel-parser/test/fixtures/es2015/modules/export-default-function-declaration/output.json @@ -1,77 +1,21 @@ { "type": "File", - "start": 0, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, "program": { "type": "Program", - "start": 0, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExportDefaultDeclaration", - "start": 0, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, "declaration": { "type": "FunctionDeclaration", - "start": 15, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":15,"end":30,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":30}}, "id": { "type": "Identifier", - "start": 24, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 25 - }, - "identifierName": "a" - }, + "start":24,"end":25,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":25},"identifierName":"a"}, "name": "a" }, "generator": false, @@ -79,18 +23,7 @@ "params": [], "body": { "type": "BlockStatement", - "start": 28, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":28,"end":30,"loc":{"start":{"line":1,"column":28},"end":{"line":1,"column":30}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/es2015/modules/export-default-function-expression/output.json b/packages/babel-parser/test/fixtures/es2015/modules/export-default-function-expression/output.json index 57681450d57c..fed40d5b6a9e 100644 --- a/packages/babel-parser/test/fixtures/es2015/modules/export-default-function-expression/output.json +++ b/packages/babel-parser/test/fixtures/es2015/modules/export-default-function-expression/output.json @@ -1,77 +1,21 @@ { "type": "File", - "start": 0, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, "program": { "type": "Program", - "start": 0, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExportDefaultDeclaration", - "start": 0, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, "declaration": { "type": "FunctionExpression", - "start": 16, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":16,"end":31,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":31}}, "id": { "type": "Identifier", - "start": 25, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 26 - }, - "identifierName": "a" - }, + "start":25,"end":26,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":26},"identifierName":"a"}, "name": "a" }, "generator": false, @@ -79,18 +23,7 @@ "params": [], "body": { "type": "BlockStatement", - "start": 29, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":29,"end":31,"loc":{"start":{"line":1,"column":29},"end":{"line":1,"column":31}}, "body": [], "directives": [] }, diff --git a/packages/babel-parser/test/fixtures/es2015/modules/export-from-valid-reserved-word/output.json b/packages/babel-parser/test/fixtures/es2015/modules/export-from-valid-reserved-word/output.json index 5455a5287944..bc477ba5e0c9 100644 --- a/packages/babel-parser/test/fixtures/es2015/modules/export-from-valid-reserved-word/output.json +++ b/packages/babel-parser/test/fixtures/es2015/modules/export-from-valid-reserved-word/output.json @@ -1,113 +1,34 @@ { "type": "File", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "program": { "type": "Program", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExportNamedDeclaration", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "specifiers": [ { "type": "ExportSpecifier", - "start": 9, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":9,"end":11,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":11}}, "local": { "type": "Identifier", - "start": 9, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "if" - }, + "start":9,"end":11,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":11},"identifierName":"if"}, "name": "if" }, "exported": { "type": "Identifier", - "start": 9, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "if" - }, + "start":9,"end":11,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":11},"identifierName":"if"}, "name": "if" } } ], "source": { "type": "StringLiteral", - "start": 19, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":19,"end":24,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":24}}, "extra": { "rawValue": "foo", "raw": "'foo'" diff --git a/packages/babel-parser/test/fixtures/es2015/modules/import-declaration-trailing-comma/input.js b/packages/babel-parser/test/fixtures/es2015/modules/import-declaration-trailing-comma/input.js new file mode 100644 index 000000000000..1b933ff9af5c --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/modules/import-declaration-trailing-comma/input.js @@ -0,0 +1,5 @@ +import { + /* One */ Foo + /* Two */, + /* Three */ +} /* Four */ from "foo"; diff --git a/packages/babel-parser/test/fixtures/es2015/modules/import-declaration-trailing-comma/output.json b/packages/babel-parser/test/fixtures/es2015/modules/import-declaration-trailing-comma/output.json new file mode 100644 index 000000000000..a968e0267d23 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/modules/import-declaration-trailing-comma/output.json @@ -0,0 +1,88 @@ +{ + "type": "File", + "start":0,"end":76,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":24}}, + "program": { + "type": "Program", + "start":0,"end":76,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":24}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ImportDeclaration", + "start":0,"end":76,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":24}}, + "specifiers": [ + { + "type": "ImportSpecifier", + "start":21,"end":24,"loc":{"start":{"line":2,"column":12},"end":{"line":2,"column":15}}, + "imported": { + "type": "Identifier", + "start":21,"end":24,"loc":{"start":{"line":2,"column":12},"end":{"line":2,"column":15},"identifierName":"Foo"}, + "name": "Foo" + }, + "local": { + "type": "Identifier", + "start":21,"end":24,"loc":{"start":{"line":2,"column":12},"end":{"line":2,"column":15},"identifierName":"Foo"}, + "name": "Foo" + }, + "leadingComments": [ + { + "type": "CommentBlock", + "value": " One ", + "start":11,"end":20,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":11}} + } + ], + "trailingComments": [ + { + "type": "CommentBlock", + "value": " Two ", + "start":27,"end":36,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":11}} + }, + { + "type": "CommentBlock", + "value": " Three ", + "start":40,"end":51,"loc":{"start":{"line":4,"column":2},"end":{"line":4,"column":13}} + }, + { + "type": "CommentBlock", + "value": " Four ", + "start":54,"end":64,"loc":{"start":{"line":5,"column":2},"end":{"line":5,"column":12}} + } + ] + } + ], + "source": { + "type": "StringLiteral", + "start":70,"end":75,"loc":{"start":{"line":5,"column":18},"end":{"line":5,"column":23}}, + "extra": { + "rawValue": "foo", + "raw": "\"foo\"" + }, + "value": "foo" + } + } + ], + "directives": [] + }, + "comments": [ + { + "type": "CommentBlock", + "value": " One ", + "start":11,"end":20,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":11}} + }, + { + "type": "CommentBlock", + "value": " Two ", + "start":27,"end":36,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":11}} + }, + { + "type": "CommentBlock", + "value": " Three ", + "start":40,"end":51,"loc":{"start":{"line":4,"column":2},"end":{"line":4,"column":13}} + }, + { + "type": "CommentBlock", + "value": " Four ", + "start":54,"end":64,"loc":{"start":{"line":5,"column":2},"end":{"line":5,"column":12}} + } + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/modules/import-invalid-keyword-flow/options.json b/packages/babel-parser/test/fixtures/es2015/modules/import-invalid-keyword-flow/options.json index 379fb1f86234..8e6ec258aec2 100644 --- a/packages/babel-parser/test/fixtures/es2015/modules/import-invalid-keyword-flow/options.json +++ b/packages/babel-parser/test/fixtures/es2015/modules/import-invalid-keyword-flow/options.json @@ -1,4 +1,4 @@ { - "plugins": ["flow"], - "throws": "Unexpected keyword 'default' (1:9)" + "sourceType": "module", + "plugins": ["flow"] } diff --git a/packages/babel-parser/test/fixtures/es2015/modules/import-invalid-keyword-flow/output.json b/packages/babel-parser/test/fixtures/es2015/modules/import-invalid-keyword-flow/output.json new file mode 100644 index 000000000000..ab2ca9601162 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/modules/import-invalid-keyword-flow/output.json @@ -0,0 +1,47 @@ +{ + "type": "File", + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, + "errors": [ + "SyntaxError: Unexpected keyword 'default' (1:9)" + ], + "program": { + "type": "Program", + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ImportDeclaration", + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, + "specifiers": [ + { + "type": "ImportSpecifier", + "start":9,"end":16,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":16}}, + "imported": { + "type": "Identifier", + "start":9,"end":16,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":16},"identifierName":"default"}, + "name": "default" + }, + "importKind": null, + "local": { + "type": "Identifier", + "start":9,"end":16,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":16},"identifierName":"default"}, + "name": "default" + } + } + ], + "importKind": "value", + "source": { + "type": "StringLiteral", + "start":24,"end":29,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":29}}, + "extra": { + "rawValue": "foo", + "raw": "\"foo\"" + }, + "value": "foo" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/modules/import-invalid-keyword-typeof-flow/options.json b/packages/babel-parser/test/fixtures/es2015/modules/import-invalid-keyword-typeof-flow/options.json index cda01e8412c3..8e6ec258aec2 100644 --- a/packages/babel-parser/test/fixtures/es2015/modules/import-invalid-keyword-typeof-flow/options.json +++ b/packages/babel-parser/test/fixtures/es2015/modules/import-invalid-keyword-typeof-flow/options.json @@ -1,4 +1,4 @@ { - "plugins": ["flow"], - "throws": "Unexpected keyword 'typeof' (1:9)" + "sourceType": "module", + "plugins": ["flow"] } diff --git a/packages/babel-parser/test/fixtures/es2015/modules/import-invalid-keyword-typeof-flow/output.json b/packages/babel-parser/test/fixtures/es2015/modules/import-invalid-keyword-typeof-flow/output.json new file mode 100644 index 000000000000..d4df45baefea --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/modules/import-invalid-keyword-typeof-flow/output.json @@ -0,0 +1,47 @@ +{ + "type": "File", + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, + "errors": [ + "SyntaxError: Unexpected keyword 'typeof' (1:9)" + ], + "program": { + "type": "Program", + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ImportDeclaration", + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, + "specifiers": [ + { + "type": "ImportSpecifier", + "start":9,"end":15,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":15}}, + "imported": { + "type": "Identifier", + "start":9,"end":15,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":15},"identifierName":"typeof"}, + "name": "typeof" + }, + "importKind": null, + "local": { + "type": "Identifier", + "start":9,"end":15,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":15},"identifierName":"typeof"}, + "name": "typeof" + } + } + ], + "importKind": "value", + "source": { + "type": "StringLiteral", + "start":23,"end":28,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":28}}, + "extra": { + "rawValue": "foo", + "raw": "\"foo\"" + }, + "value": "foo" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/modules/import-invalid-keyword-typeof/options.json b/packages/babel-parser/test/fixtures/es2015/modules/import-invalid-keyword-typeof/options.json index a45cdb986dd1..2104ca43283f 100644 --- a/packages/babel-parser/test/fixtures/es2015/modules/import-invalid-keyword-typeof/options.json +++ b/packages/babel-parser/test/fixtures/es2015/modules/import-invalid-keyword-typeof/options.json @@ -1,3 +1,3 @@ { - "throws": "Unexpected keyword 'typeof' (1:9)" + "sourceType": "module" } diff --git a/packages/babel-parser/test/fixtures/es2015/modules/import-invalid-keyword-typeof/output.json b/packages/babel-parser/test/fixtures/es2015/modules/import-invalid-keyword-typeof/output.json new file mode 100644 index 000000000000..95070d9dab76 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/modules/import-invalid-keyword-typeof/output.json @@ -0,0 +1,45 @@ +{ + "type": "File", + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, + "errors": [ + "SyntaxError: Unexpected keyword 'typeof' (1:9)" + ], + "program": { + "type": "Program", + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ImportDeclaration", + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, + "specifiers": [ + { + "type": "ImportSpecifier", + "start":9,"end":15,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":15}}, + "imported": { + "type": "Identifier", + "start":9,"end":15,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":15},"identifierName":"typeof"}, + "name": "typeof" + }, + "local": { + "type": "Identifier", + "start":9,"end":15,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":15},"identifierName":"typeof"}, + "name": "typeof" + } + } + ], + "source": { + "type": "StringLiteral", + "start":23,"end":28,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":28}}, + "extra": { + "rawValue": "foo", + "raw": "\"foo\"" + }, + "value": "foo" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/modules/import-invalid-keyword/options.json b/packages/babel-parser/test/fixtures/es2015/modules/import-invalid-keyword/options.json index 2c6a46df3f6e..2104ca43283f 100644 --- a/packages/babel-parser/test/fixtures/es2015/modules/import-invalid-keyword/options.json +++ b/packages/babel-parser/test/fixtures/es2015/modules/import-invalid-keyword/options.json @@ -1,3 +1,3 @@ { - "throws": "Unexpected keyword 'debugger' (1:9)" + "sourceType": "module" } diff --git a/packages/babel-parser/test/fixtures/es2015/modules/import-invalid-keyword/output.json b/packages/babel-parser/test/fixtures/es2015/modules/import-invalid-keyword/output.json new file mode 100644 index 000000000000..a627dce5e719 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/modules/import-invalid-keyword/output.json @@ -0,0 +1,45 @@ +{ + "type": "File", + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, + "errors": [ + "SyntaxError: Unexpected keyword 'debugger' (1:9)" + ], + "program": { + "type": "Program", + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ImportDeclaration", + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, + "specifiers": [ + { + "type": "ImportSpecifier", + "start":9,"end":17,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":17}}, + "imported": { + "type": "Identifier", + "start":9,"end":17,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":17},"identifierName":"debugger"}, + "name": "debugger" + }, + "local": { + "type": "Identifier", + "start":9,"end":17,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":17},"identifierName":"debugger"}, + "name": "debugger" + } + } + ], + "source": { + "type": "StringLiteral", + "start":25,"end":30,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":30}}, + "extra": { + "rawValue": "foo", + "raw": "\"foo\"" + }, + "value": "foo" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/modules/invalid-escape-export-as/options.json b/packages/babel-parser/test/fixtures/es2015/modules/invalid-escape-export-as/options.json index 16c061d4dfd4..3e1bec330f62 100644 --- a/packages/babel-parser/test/fixtures/es2015/modules/invalid-escape-export-as/options.json +++ b/packages/babel-parser/test/fixtures/es2015/modules/invalid-escape-export-as/options.json @@ -1,4 +1,4 @@ { "sourceType": "module", "throws": "Unexpected token, expected \",\" (1:11)" -} \ No newline at end of file +} diff --git a/packages/babel-parser/test/fixtures/es2015/modules/invalid-escape-import-from/options.json b/packages/babel-parser/test/fixtures/es2015/modules/invalid-escape-import-from/options.json index 6dab969b1115..5fe96f9ef281 100644 --- a/packages/babel-parser/test/fixtures/es2015/modules/invalid-escape-import-from/options.json +++ b/packages/babel-parser/test/fixtures/es2015/modules/invalid-escape-import-from/options.json @@ -1,4 +1,4 @@ { "sourceType": "module", "throws": "Unexpected token (1:9)" -} \ No newline at end of file +} diff --git a/packages/babel-parser/test/fixtures/es2015/modules/xml-comment-in-module/output.json b/packages/babel-parser/test/fixtures/es2015/modules/xml-comment-in-module/output.json index fa8998be649b..3211da07b691 100644 --- a/packages/babel-parser/test/fixtures/es2015/modules/xml-comment-in-module/output.json +++ b/packages/babel-parser/test/fixtures/es2015/modules/xml-comment-in-module/output.json @@ -1,127 +1,37 @@ { "type": "File", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "program": { "type": "Program", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "expression": { "type": "BinaryExpression", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "left": { "type": "Identifier", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - }, - "identifierName": "foo" - }, + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3},"identifierName":"foo"}, "name": "foo" }, "operator": "<", "right": { "type": "UnaryExpression", - "start": 5, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":5,"end":11,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":11}}, "operator": "!", "prefix": true, "argument": { "type": "UpdateExpression", - "start": 6, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":6,"end":11,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":11}}, "operator": "--", "prefix": true, "argument": { "type": "Identifier", - "start": 8, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "bar" - }, + "start":8,"end":11,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":11},"identifierName":"bar"}, "name": "bar" } } diff --git a/packages/babel-parser/test/fixtures/es2015/modules/xml-comment-in-script/output.json b/packages/babel-parser/test/fixtures/es2015/modules/xml-comment-in-script/output.json index f9ebe108990d..8f86ccd96e9f 100644 --- a/packages/babel-parser/test/fixtures/es2015/modules/xml-comment-in-script/output.json +++ b/packages/babel-parser/test/fixtures/es2015/modules/xml-comment-in-script/output.json @@ -1,81 +1,25 @@ { "type": "File", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "program": { "type": "Program", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, "expression": { "type": "Identifier", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - }, - "identifierName": "foo" - }, + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3},"identifierName":"foo"}, "name": "foo" }, "trailingComments": [ { "type": "CommentLine", "value": "bar", - "start": 4, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 11 - } - } + "start":4,"end":11,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":11}} } ] } @@ -86,18 +30,7 @@ { "type": "CommentLine", "value": "bar", - "start": 4, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 11 - } - } + "start":4,"end":11,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":11}} } ] } \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/object/async-method-linebreak/options.json b/packages/babel-parser/test/fixtures/es2015/object/async-method-linebreak/options.json index 978486d6a57c..cef3a955d6c4 100644 --- a/packages/babel-parser/test/fixtures/es2015/object/async-method-linebreak/options.json +++ b/packages/babel-parser/test/fixtures/es2015/object/async-method-linebreak/options.json @@ -1,3 +1,3 @@ { "throws": "Unexpected token, expected \",\" (3:4)" -} \ No newline at end of file +} diff --git a/packages/babel-parser/test/fixtures/es2015/object/disallow-duplicate-method-params/options.json b/packages/babel-parser/test/fixtures/es2015/object/disallow-duplicate-method-params/options.json deleted file mode 100644 index c7a2c3ba50a0..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/object/disallow-duplicate-method-params/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Argument name clash (2:11)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/object/disallow-duplicate-method-params/output.json b/packages/babel-parser/test/fixtures/es2015/object/disallow-duplicate-method-params/output.json new file mode 100644 index 000000000000..2d66299daa51 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/object/disallow-duplicate-method-params/output.json @@ -0,0 +1,63 @@ +{ + "type": "File", + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":2}}, + "errors": [ + "SyntaxError: Argument name clash (2:11)" + ], + "program": { + "type": "Program", + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":2}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":2}}, + "expression": { + "type": "ObjectExpression", + "start":1,"end":21,"loc":{"start":{"line":1,"column":1},"end":{"line":3,"column":1}}, + "properties": [ + { + "type": "ObjectMethod", + "start":7,"end":19,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":16}}, + "method": true, + "key": { + "type": "Identifier", + "start":7,"end":10,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":7},"identifierName":"bar"}, + "name": "bar" + }, + "computed": false, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start":11,"end":12,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":9},"identifierName":"a"}, + "name": "a" + }, + { + "type": "Identifier", + "start":14,"end":15,"loc":{"start":{"line":2,"column":11},"end":{"line":2,"column":12},"identifierName":"a"}, + "name": "a" + } + ], + "body": { + "type": "BlockStatement", + "start":17,"end":19,"loc":{"start":{"line":2,"column":14},"end":{"line":2,"column":16}}, + "body": [], + "directives": [] + } + } + ], + "extra": { + "parenthesized": true, + "parenStart": 0 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/regex/duplicate-flags/options.json b/packages/babel-parser/test/fixtures/es2015/regex/duplicate-flags/options.json deleted file mode 100644 index 86670c5168d0..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/regex/duplicate-flags/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Duplicate regular expression flag (1:6)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/regex/duplicate-flags/output.json b/packages/babel-parser/test/fixtures/es2015/regex/duplicate-flags/output.json new file mode 100644 index 000000000000..397423695084 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/regex/duplicate-flags/output.json @@ -0,0 +1,29 @@ +{ + "type": "File", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "errors": [ + "SyntaxError: Duplicate regular expression flag (1:6)" + ], + "program": { + "type": "Program", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "expression": { + "type": "RegExpLiteral", + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, + "extra": { + "raw": "/./gii" + }, + "pattern": ".", + "flags": "gii" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/regression/11183/input.js b/packages/babel-parser/test/fixtures/es2015/regression/11183/input.js new file mode 100644 index 000000000000..a64bdeee0804 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/regression/11183/input.js @@ -0,0 +1,5 @@ +class X {} +05 + +function x() { 'use strict' } +05 diff --git a/packages/babel-parser/test/fixtures/es2015/regression/11183/options.json b/packages/babel-parser/test/fixtures/es2015/regression/11183/options.json new file mode 100644 index 000000000000..b412ffe6712f --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/regression/11183/options.json @@ -0,0 +1,3 @@ +{ + "sourceType": "script" +} diff --git a/packages/babel-parser/test/fixtures/es2015/regression/11183/output.json b/packages/babel-parser/test/fixtures/es2015/regression/11183/output.json new file mode 100644 index 000000000000..ea1e5e19d850 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/regression/11183/output.json @@ -0,0 +1,242 @@ +{ + "type": "File", + "start": 0, + "end": 47, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 2 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 47, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 2 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "X" + }, + "name": "X" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 8, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "body": [] + } + }, + { + "type": "ExpressionStatement", + "start": 11, + "end": 13, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 2 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 11, + "end": 13, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 2 + } + }, + "extra": { + "rawValue": 5, + "raw": "05" + }, + "value": 5 + } + }, + { + "type": "FunctionDeclaration", + "start": 15, + "end": 44, + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 4, + "column": 29 + } + }, + "id": { + "type": "Identifier", + "start": 24, + "end": 25, + "loc": { + "start": { + "line": 4, + "column": 9 + }, + "end": { + "line": 4, + "column": 10 + }, + "identifierName": "x" + }, + "name": "x" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 28, + "end": 44, + "loc": { + "start": { + "line": 4, + "column": 13 + }, + "end": { + "line": 4, + "column": 29 + } + }, + "body": [], + "directives": [ + { + "type": "Directive", + "start": 30, + "end": 42, + "loc": { + "start": { + "line": 4, + "column": 15 + }, + "end": { + "line": 4, + "column": 27 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 30, + "end": 42, + "loc": { + "start": { + "line": 4, + "column": 15 + }, + "end": { + "line": 4, + "column": 27 + } + }, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + }, + { + "type": "ExpressionStatement", + "start": 45, + "end": 47, + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 5, + "column": 2 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 45, + "end": 47, + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 5, + "column": 2 + } + }, + "extra": { + "rawValue": 5, + "raw": "05" + }, + "value": 5 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/regression/186/output.json b/packages/babel-parser/test/fixtures/es2015/regression/186/output.json index 5589443444b8..ca80235e39d2 100644 --- a/packages/babel-parser/test/fixtures/es2015/regression/186/output.json +++ b/packages/babel-parser/test/fixtures/es2015/regression/186/output.json @@ -1,144 +1,42 @@ { "type": "File", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "program": { "type": "Program", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "declarations": [ { "type": "VariableDeclarator", - "start": 6, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":6,"end":22,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":22}}, "id": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "x" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"x"}, "name": "x" }, "init": { "type": "ObjectExpression", - "start": 10, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":10,"end":22,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":22}}, "properties": [ { "type": "ObjectProperty", - "start": 11, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":11,"end":16,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":16}}, "method": false, "key": { "type": "Identifier", - "start": 11, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 16 - }, - "identifierName": "async" - }, + "start":11,"end":16,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":16},"identifierName":"async"}, "name": "async" }, "computed": false, "shorthand": true, "value": { "type": "Identifier", - "start": 11, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 16 - }, - "identifierName": "async" - }, + "start":11,"end":16,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":16},"identifierName":"async"}, "name": "async" }, "extra": { @@ -147,53 +45,18 @@ }, { "type": "ObjectProperty", - "start": 18, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":18,"end":21,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":21}}, "method": false, "key": { "type": "Identifier", - "start": 18, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 21 - }, - "identifierName": "bar" - }, + "start":18,"end":21,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":21},"identifierName":"bar"}, "name": "bar" }, "computed": false, "shorthand": true, "value": { "type": "Identifier", - "start": 18, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 21 - }, - "identifierName": "bar" - }, + "start":18,"end":21,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":21},"identifierName":"bar"}, "name": "bar" }, "extra": { diff --git a/packages/babel-parser/test/fixtures/es2015/regression/6864/output.json b/packages/babel-parser/test/fixtures/es2015/regression/6864/output.json index b9f339743802..6bd7cb71dd2e 100644 --- a/packages/babel-parser/test/fixtures/es2015/regression/6864/output.json +++ b/packages/babel-parser/test/fixtures/es2015/regression/6864/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 85, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 1 - } - }, + "start":0,"end":85,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 85, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 1 - } - }, + "start":0,"end":85,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 85, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 1 - } - }, + "start":0,"end":85,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, "id": { "type": "Identifier", - "start": 10, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "f" - }, + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11},"identifierName":"f"}, "name": "f" }, "generator": true, @@ -65,99 +20,31 @@ "params": [], "body": { "type": "BlockStatement", - "start": 14, - "end": 85, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 5, - "column": 1 - } - }, + "start":14,"end":85,"loc":{"start":{"line":1,"column":14},"end":{"line":5,"column":1}}, "body": [ { "type": "ExpressionStatement", - "start": 18, - "end": 33, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 17 - } - }, + "start":18,"end":33,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":17}}, "expression": { "type": "YieldExpression", - "start": 19, - "end": 31, - "loc": { - "start": { - "line": 2, - "column": 3 - }, - "end": { - "line": 2, - "column": 15 - } - }, + "start":19,"end":31,"loc":{"start":{"line":2,"column":3},"end":{"line":2,"column":15}}, "delegate": false, "argument": { "type": "ArrowFunctionExpression", - "start": 25, - "end": 31, - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 15 - } - }, + "start":25,"end":31,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":15}}, "id": null, "generator": false, "async": false, "params": [ { "type": "Identifier", - "start": 25, - "end": 26, - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 10 - }, - "identifierName": "a" - }, + "start":25,"end":26,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":10},"identifierName":"a"}, "name": "a" } ], "body": { "type": "Identifier", - "start": 30, - "end": 31, - "loc": { - "start": { - "line": 2, - "column": 14 - }, - "end": { - "line": 2, - "column": 15 - }, - "identifierName": "a" - }, + "start":30,"end":31,"loc":{"start":{"line":2,"column":14},"end":{"line":2,"column":15},"identifierName":"a"}, "name": "a" } }, @@ -169,84 +56,27 @@ }, { "type": "ExpressionStatement", - "start": 36, - "end": 57, - "loc": { - "start": { - "line": 3, - "column": 2 - }, - "end": { - "line": 3, - "column": 23 - } - }, + "start":36,"end":57,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":23}}, "expression": { "type": "YieldExpression", - "start": 37, - "end": 55, - "loc": { - "start": { - "line": 3, - "column": 3 - }, - "end": { - "line": 3, - "column": 21 - } - }, + "start":37,"end":55,"loc":{"start":{"line":3,"column":3},"end":{"line":3,"column":21}}, "delegate": false, "argument": { "type": "ArrowFunctionExpression", - "start": 43, - "end": 55, - "loc": { - "start": { - "line": 3, - "column": 9 - }, - "end": { - "line": 3, - "column": 21 - } - }, + "start":43,"end":55,"loc":{"start":{"line":3,"column":9},"end":{"line":3,"column":21}}, "id": null, "generator": false, "async": true, "params": [ { "type": "Identifier", - "start": 49, - "end": 50, - "loc": { - "start": { - "line": 3, - "column": 15 - }, - "end": { - "line": 3, - "column": 16 - }, - "identifierName": "a" - }, + "start":49,"end":50,"loc":{"start":{"line":3,"column":15},"end":{"line":3,"column":16},"identifierName":"a"}, "name": "a" } ], "body": { "type": "Identifier", - "start": 54, - "end": 55, - "loc": { - "start": { - "line": 3, - "column": 20 - }, - "end": { - "line": 3, - "column": 21 - }, - "identifierName": "a" - }, + "start":54,"end":55,"loc":{"start":{"line":3,"column":20},"end":{"line":3,"column":21},"identifierName":"a"}, "name": "a" } }, @@ -258,84 +88,27 @@ }, { "type": "ExpressionStatement", - "start": 60, - "end": 83, - "loc": { - "start": { - "line": 4, - "column": 2 - }, - "end": { - "line": 4, - "column": 25 - } - }, + "start":60,"end":83,"loc":{"start":{"line":4,"column":2},"end":{"line":4,"column":25}}, "expression": { "type": "YieldExpression", - "start": 61, - "end": 81, - "loc": { - "start": { - "line": 4, - "column": 3 - }, - "end": { - "line": 4, - "column": 23 - } - }, + "start":61,"end":81,"loc":{"start":{"line":4,"column":3},"end":{"line":4,"column":23}}, "delegate": false, "argument": { "type": "ArrowFunctionExpression", - "start": 67, - "end": 81, - "loc": { - "start": { - "line": 4, - "column": 9 - }, - "end": { - "line": 4, - "column": 23 - } - }, + "start":67,"end":81,"loc":{"start":{"line":4,"column":9},"end":{"line":4,"column":23}}, "id": null, "generator": false, "async": true, "params": [ { "type": "Identifier", - "start": 74, - "end": 75, - "loc": { - "start": { - "line": 4, - "column": 16 - }, - "end": { - "line": 4, - "column": 17 - }, - "identifierName": "a" - }, + "start":74,"end":75,"loc":{"start":{"line":4,"column":16},"end":{"line":4,"column":17},"identifierName":"a"}, "name": "a" } ], "body": { "type": "Identifier", - "start": 80, - "end": 81, - "loc": { - "start": { - "line": 4, - "column": 22 - }, - "end": { - "line": 4, - "column": 23 - }, - "identifierName": "a" - }, + "start":80,"end":81,"loc":{"start":{"line":4,"column":22},"end":{"line":4,"column":23},"identifierName":"a"}, "name": "a" } }, diff --git a/packages/babel-parser/test/fixtures/es2015/shorthand/1/options.json b/packages/babel-parser/test/fixtures/es2015/shorthand/1/options.json deleted file mode 100644 index eaa26955dc77..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/shorthand/1/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected keyword 'const' (1:11)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/shorthand/1/output.json b/packages/babel-parser/test/fixtures/es2015/shorthand/1/output.json new file mode 100644 index 000000000000..7514d1429f5f --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/shorthand/1/output.json @@ -0,0 +1,62 @@ +{ + "type": "File", + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, + "errors": [ + "SyntaxError: Unexpected keyword 'const' (1:11)" + ], + "program": { + "type": "Program", + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":4,"end":19,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":19}}, + "id": { + "type": "Identifier", + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"x"}, + "name": "x" + }, + "init": { + "type": "ObjectExpression", + "start":9,"end":18,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":18}}, + "properties": [ + { + "type": "ObjectProperty", + "start":11,"end":16,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":16}}, + "method": false, + "key": { + "type": "Identifier", + "start":11,"end":16,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":16},"identifierName":"const"}, + "name": "const" + }, + "computed": false, + "shorthand": true, + "value": { + "type": "Identifier", + "start":11,"end":16,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":16},"identifierName":"const"}, + "name": "const" + }, + "extra": { + "shorthand": true + } + } + ], + "extra": { + "parenthesized": true, + "parenStart": 8 + } + } + } + ], + "kind": "var" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/shorthand/2/options.json b/packages/babel-parser/test/fixtures/es2015/shorthand/2/options.json deleted file mode 100644 index be39a4451388..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/shorthand/2/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected keyword 'this' (1:8)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/shorthand/2/output.json b/packages/babel-parser/test/fixtures/es2015/shorthand/2/output.json new file mode 100644 index 000000000000..4ca2311d88fe --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/shorthand/2/output.json @@ -0,0 +1,91 @@ +{ + "type": "File", + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, + "errors": [ + "SyntaxError: Unexpected keyword 'this' (1:8)", + "SyntaxError: Unexpected keyword 'if' (1:14)" + ], + "program": { + "type": "Program", + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, + "expression": { + "type": "ObjectExpression", + "start":1,"end":18,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":18}}, + "properties": [ + { + "type": "ObjectProperty", + "start":3,"end":6,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":6}}, + "method": false, + "key": { + "type": "Identifier", + "start":3,"end":6,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":6},"identifierName":"get"}, + "name": "get" + }, + "computed": false, + "shorthand": true, + "value": { + "type": "Identifier", + "start":3,"end":6,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":6},"identifierName":"get"}, + "name": "get" + }, + "extra": { + "shorthand": true + } + }, + { + "type": "ObjectProperty", + "start":8,"end":12,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":12}}, + "method": false, + "key": { + "type": "Identifier", + "start":8,"end":12,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":12},"identifierName":"this"}, + "name": "this" + }, + "computed": false, + "shorthand": true, + "value": { + "type": "Identifier", + "start":8,"end":12,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":12},"identifierName":"this"}, + "name": "this" + }, + "extra": { + "shorthand": true + } + }, + { + "type": "ObjectProperty", + "start":14,"end":16,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":16}}, + "method": false, + "key": { + "type": "Identifier", + "start":14,"end":16,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":16},"identifierName":"if"}, + "name": "if" + }, + "computed": false, + "shorthand": true, + "value": { + "type": "Identifier", + "start":14,"end":16,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":16},"identifierName":"if"}, + "name": "if" + }, + "extra": { + "shorthand": true + } + } + ], + "extra": { + "parenthesized": true, + "parenStart": 0 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/statements/label-invalid-const/options.json b/packages/babel-parser/test/fixtures/es2015/statements/label-invalid-const/options.json deleted file mode 100644 index a064a678e553..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/statements/label-invalid-const/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Lexical declaration cannot appear in a single-statement context (1:5)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/statements/label-invalid-const/output.json b/packages/babel-parser/test/fixtures/es2015/statements/label-invalid-const/output.json new file mode 100644 index 000000000000..4c65f3b1133e --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/statements/label-invalid-const/output.json @@ -0,0 +1,45 @@ +{ + "type": "File", + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, + "errors": [ + "SyntaxError: Lexical declaration cannot appear in a single-statement context (1:5)" + ], + "program": { + "type": "Program", + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "LabeledStatement", + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, + "body": { + "type": "VariableDeclaration", + "start":5,"end":22,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":22}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":11,"end":21,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":21}}, + "id": { + "type": "Identifier", + "start":11,"end":14,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":14},"identifierName":"bar"}, + "name": "bar" + }, + "init": { + "type": "NullLiteral", + "start":17,"end":21,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":21}} + } + } + ], + "kind": "const" + }, + "label": { + "type": "Identifier", + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3},"identifierName":"foo"}, + "name": "foo" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/statements/label-invalid-func-async/options.json b/packages/babel-parser/test/fixtures/es2015/statements/label-invalid-func-async/options.json deleted file mode 100644 index 95aaacb458f8..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/statements/label-invalid-func-async/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Async functions can only be declared at the top level or inside a block (1:5)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/statements/label-invalid-func-async/output.json b/packages/babel-parser/test/fixtures/es2015/statements/label-invalid-func-async/output.json new file mode 100644 index 000000000000..4ceffd86de0f --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/statements/label-invalid-func-async/output.json @@ -0,0 +1,43 @@ +{ + "type": "File", + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, + "errors": [ + "SyntaxError: Async functions can only be declared at the top level or inside a block (1:5)" + ], + "program": { + "type": "Program", + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "LabeledStatement", + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, + "body": { + "type": "FunctionDeclaration", + "start":5,"end":28,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":28}}, + "id": { + "type": "Identifier", + "start":20,"end":23,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":23},"identifierName":"bar"}, + "name": "bar" + }, + "generator": false, + "async": true, + "params": [], + "body": { + "type": "BlockStatement", + "start":26,"end":28,"loc":{"start":{"line":1,"column":26},"end":{"line":1,"column":28}}, + "body": [], + "directives": [] + } + }, + "label": { + "type": "Identifier", + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3},"identifierName":"foo"}, + "name": "foo" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/statements/label-invalid-func-generator/options.json b/packages/babel-parser/test/fixtures/es2015/statements/label-invalid-func-generator/options.json deleted file mode 100644 index 3f6e90c7cd27..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/statements/label-invalid-func-generator/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Generators can only be declared at the top level or inside a block (1:13)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/statements/label-invalid-func-generator/output.json b/packages/babel-parser/test/fixtures/es2015/statements/label-invalid-func-generator/output.json new file mode 100644 index 000000000000..f71d506d0042 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/statements/label-invalid-func-generator/output.json @@ -0,0 +1,43 @@ +{ + "type": "File", + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, + "errors": [ + "SyntaxError: Generators can only be declared at the top level or inside a block (1:13)" + ], + "program": { + "type": "Program", + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "LabeledStatement", + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, + "body": { + "type": "FunctionDeclaration", + "start":5,"end":23,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":23}}, + "id": { + "type": "Identifier", + "start":15,"end":18,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":18},"identifierName":"bar"}, + "name": "bar" + }, + "generator": true, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":21,"end":23,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":23}}, + "body": [], + "directives": [] + } + }, + "label": { + "type": "Identifier", + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3},"identifierName":"foo"}, + "name": "foo" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/statements/label-invalid-func-strict/options.json b/packages/babel-parser/test/fixtures/es2015/statements/label-invalid-func-strict/options.json deleted file mode 100644 index 1eebe15c408e..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/statements/label-invalid-func-strict/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "In strict mode code, functions can only be declared at top level or inside a block (1:35)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/statements/label-invalid-func-strict/output.json b/packages/babel-parser/test/fixtures/es2015/statements/label-invalid-func-strict/output.json new file mode 100644 index 000000000000..47915b8c2b34 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/statements/label-invalid-func-strict/output.json @@ -0,0 +1,76 @@ +{ + "type": "File", + "start":0,"end":53,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":53}}, + "errors": [ + "SyntaxError: In strict mode code, functions can only be declared at top level or inside a block (1:35)" + ], + "program": { + "type": "Program", + "start":0,"end":53,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":53}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":53,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":53}}, + "id": { + "type": "Identifier", + "start":9,"end":12,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":12},"identifierName":"foo"}, + "name": "foo" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":15,"end":53,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":53}}, + "body": [ + { + "type": "LabeledStatement", + "start":30,"end":52,"loc":{"start":{"line":1,"column":30},"end":{"line":1,"column":52}}, + "body": { + "type": "FunctionDeclaration", + "start":35,"end":52,"loc":{"start":{"line":1,"column":35},"end":{"line":1,"column":52}}, + "id": { + "type": "Identifier", + "start":44,"end":47,"loc":{"start":{"line":1,"column":44},"end":{"line":1,"column":47},"identifierName":"baz"}, + "name": "baz" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":50,"end":52,"loc":{"start":{"line":1,"column":50},"end":{"line":1,"column":52}}, + "body": [], + "directives": [] + } + }, + "label": { + "type": "Identifier", + "start":30,"end":33,"loc":{"start":{"line":1,"column":30},"end":{"line":1,"column":33},"identifierName":"bar"}, + "name": "bar" + } + } + ], + "directives": [ + { + "type": "Directive", + "start":16,"end":29,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":29}}, + "value": { + "type": "DirectiveLiteral", + "start":16,"end":28,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":28}}, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/statements/label-valid-func-non-strict/output.json b/packages/babel-parser/test/fixtures/es2015/statements/label-valid-func-non-strict/output.json index faacd4929881..9495944b51fb 100644 --- a/packages/babel-parser/test/fixtures/es2015/statements/label-valid-func-non-strict/output.json +++ b/packages/babel-parser/test/fixtures/es2015/statements/label-valid-func-non-strict/output.json @@ -1,77 +1,21 @@ { "type": "File", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "program": { "type": "Program", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "LabeledStatement", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "body": { "type": "FunctionDeclaration", - "start": 5, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":5,"end":22,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":22}}, "id": { "type": "Identifier", - "start": 14, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 17 - }, - "identifierName": "bar" - }, + "start":14,"end":17,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":17},"identifierName":"bar"}, "name": "bar" }, "generator": false, @@ -79,37 +23,14 @@ "params": [], "body": { "type": "BlockStatement", - "start": 20, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":20,"end":22,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":22}}, "body": [], "directives": [] } }, "label": { "type": "Identifier", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - }, - "identifierName": "foo" - }, + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3},"identifierName":"foo"}, "name": "foo" } } diff --git a/packages/babel-parser/test/fixtures/es2015/statements/label-valid-var/output.json b/packages/babel-parser/test/fixtures/es2015/statements/label-valid-var/output.json index 65b268ccfc9d..309f477ad78d 100644 --- a/packages/babel-parser/test/fixtures/es2015/statements/label-valid-var/output.json +++ b/packages/babel-parser/test/fixtures/es2015/statements/label-valid-var/output.json @@ -1,92 +1,25 @@ { "type": "File", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "program": { "type": "Program", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "LabeledStatement", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "body": { "type": "VariableDeclaration", - "start": 5, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":5,"end":13,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":13}}, "declarations": [ { "type": "VariableDeclarator", - "start": 9, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":9,"end":12,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":12}}, "id": { "type": "Identifier", - "start": 9, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "bar" - }, + "start":9,"end":12,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":12},"identifierName":"bar"}, "name": "bar" }, "init": null @@ -96,19 +29,7 @@ }, "label": { "type": "Identifier", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - }, - "identifierName": "foo" - }, + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3},"identifierName":"foo"}, "name": "foo" } } diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/1/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/1/output.json index f3a6cff403e7..024e4088a094 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/1/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/1/output.json @@ -1,63 +1,19 @@ { "type": "File", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, "program": { "type": "Program", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, "sourceType": "script", "interpreter": null, "body": [], "directives": [ { "type": "Directive", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, "value": { "type": "DirectiveLiteral", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, "value": "\\u{714E}\\u{8336}", "extra": { "raw": "\"\\u{714E}\\u{8336}\"", diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/10/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/10/output.json index 3ea62bea3f9f..234aaa541640 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/10/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/10/output.json @@ -1,62 +1,18 @@ { "type": "File", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, "program": { "type": "Program", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, "expression": { "type": "NumericLiteral", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, "extra": { "rawValue": 2, "raw": "0O2" diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/105/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/105/output.json index ea40f2c7ccb5..676cf6fc0841 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/105/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/105/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "program": { "type": "Program", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "id": { "type": "Identifier", - "start": 10, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "t" - }, + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11},"identifierName":"t"}, "name": "t" }, "generator": true, @@ -65,18 +20,7 @@ "params": [], "body": { "type": "BlockStatement", - "start": 14, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":14,"end":16,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":16}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/107/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/107/output.json index 6b99a2c67e6f..4f612f17058e 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/107/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/107/output.json @@ -1,144 +1,41 @@ { "type": "File", - "start": 0, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, "program": { "type": "Program", - "start": 0, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ForOfStatement", - "start": 0, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, "await": false, "left": { "type": "Identifier", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "x" - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"x"}, "name": "x" }, "right": { "type": "Identifier", - "start": 9, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 13 - }, - "identifierName": "list" - }, + "start":9,"end":13,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":13},"identifierName":"list"}, "name": "list" }, "body": { "type": "ExpressionStatement", - "start": 15, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":15,"end":26,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":26}}, "expression": { "type": "CallExpression", - "start": 15, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":15,"end":25,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":25}}, "callee": { "type": "Identifier", - "start": 15, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 22 - }, - "identifierName": "process" - }, + "start":15,"end":22,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":22},"identifierName":"process"}, "name": "process" }, "arguments": [ { "type": "Identifier", - "start": 23, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 24 - }, - "identifierName": "x" - }, + "start":23,"end":24,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":24},"identifierName":"x"}, "name": "x" } ] diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/108/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/108/output.json index 737dba8a6e49..487ebb8d252f 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/108/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/108/output.json @@ -1,93 +1,26 @@ { "type": "File", - "start": 0, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, "program": { "type": "Program", - "start": 0, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ForOfStatement", - "start": 0, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, "await": false, "left": { "type": "VariableDeclaration", - "start": 5, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":5,"end":10,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":10}}, "declarations": [ { "type": "VariableDeclarator", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10}}, "id": { "type": "Identifier", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - }, - "identifierName": "x" - }, + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"x"}, "name": "x" }, "init": null @@ -97,82 +30,24 @@ }, "right": { "type": "Identifier", - "start": 14, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 18 - }, - "identifierName": "list" - }, + "start":14,"end":18,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":18},"identifierName":"list"}, "name": "list" }, "body": { "type": "ExpressionStatement", - "start": 20, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":20,"end":31,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":31}}, "expression": { "type": "CallExpression", - "start": 20, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":20,"end":30,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":30}}, "callee": { "type": "Identifier", - "start": 20, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 27 - }, - "identifierName": "process" - }, + "start":20,"end":27,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":27},"identifierName":"process"}, "name": "process" }, "arguments": [ { "type": "Identifier", - "start": 28, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 29 - }, - "identifierName": "x" - }, + "start":28,"end":29,"loc":{"start":{"line":1,"column":28},"end":{"line":1,"column":29},"identifierName":"x"}, "name": "x" } ] diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/109/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/109/options.json deleted file mode 100644 index c145a86bc613..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/109/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "for-of loop variable declaration may not have an initializer (1:5)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/109/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/109/output.json new file mode 100644 index 000000000000..a3d47c9c212e --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/109/output.json @@ -0,0 +1,71 @@ +{ + "type": "File", + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, + "errors": [ + "SyntaxError: for-of loop variable declaration may not have an initializer (1:5)" + ], + "program": { + "type": "Program", + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ForOfStatement", + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, + "await": false, + "left": { + "type": "VariableDeclaration", + "start":5,"end":15,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":15}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":9,"end":15,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":15}}, + "id": { + "type": "Identifier", + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"x"}, + "name": "x" + }, + "init": { + "type": "NumericLiteral", + "start":13,"end":15,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":15}}, + "extra": { + "rawValue": 42, + "raw": "42" + }, + "value": 42 + } + } + ], + "kind": "var" + }, + "right": { + "type": "Identifier", + "start":19,"end":23,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":23},"identifierName":"list"}, + "name": "list" + }, + "body": { + "type": "ExpressionStatement", + "start":25,"end":36,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":36}}, + "expression": { + "type": "CallExpression", + "start":25,"end":35,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":35}}, + "callee": { + "type": "Identifier", + "start":25,"end":32,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":32},"identifierName":"process"}, + "name": "process" + }, + "arguments": [ + { + "type": "Identifier", + "start":33,"end":34,"loc":{"start":{"line":1,"column":33},"end":{"line":1,"column":34},"identifierName":"x"}, + "name": "x" + } + ] + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/11/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/11/output.json index ab48cf7c9e15..374e200bf622 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/11/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/11/output.json @@ -1,62 +1,18 @@ { "type": "File", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - }, + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, "program": { "type": "Program", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - }, + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - }, + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, "expression": { "type": "NumericLiteral", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - }, + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, "extra": { "rawValue": 10, "raw": "0O12" diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/110/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/110/output.json index 651a5c2d4e1e..b0a940cae667 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/110/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/110/output.json @@ -1,93 +1,26 @@ { "type": "File", - "start": 0, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, "program": { "type": "Program", - "start": 0, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ForOfStatement", - "start": 0, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, "await": false, "left": { "type": "VariableDeclaration", - "start": 5, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":5,"end":10,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":10}}, "declarations": [ { "type": "VariableDeclarator", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10}}, "id": { "type": "Identifier", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - }, - "identifierName": "x" - }, + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"x"}, "name": "x" }, "init": null @@ -97,82 +30,24 @@ }, "right": { "type": "Identifier", - "start": 14, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 18 - }, - "identifierName": "list" - }, + "start":14,"end":18,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":18},"identifierName":"list"}, "name": "list" }, "body": { "type": "ExpressionStatement", - "start": 20, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":20,"end":31,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":31}}, "expression": { "type": "CallExpression", - "start": 20, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":20,"end":30,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":30}}, "callee": { "type": "Identifier", - "start": 20, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 27 - }, - "identifierName": "process" - }, + "start":20,"end":27,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":27},"identifierName":"process"}, "name": "process" }, "arguments": [ { "type": "Identifier", - "start": 28, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 29 - }, - "identifierName": "x" - }, + "start":28,"end":29,"loc":{"start":{"line":1,"column":28},"end":{"line":1,"column":29},"identifierName":"x"}, "name": "x" } ] diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/111/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/111/output.json index dcd4ea525f57..d4676622f8a1 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/111/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/111/output.json @@ -1,126 +1,36 @@ { "type": "File", - "start": 0, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, "program": { "type": "Program", - "start": 0, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":4,"end":26,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":26}}, "id": { "type": "Identifier", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "A" - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"A"}, "name": "A" }, "init": { "type": "ClassExpression", - "start": 8, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":8,"end":26,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":26}}, "id": null, "superClass": { "type": "Identifier", - "start": 22, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 23 - }, - "identifierName": "B" - }, + "start":22,"end":23,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":23},"identifierName":"B"}, "name": "B" }, "body": { "type": "ClassBody", - "start": 24, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":24,"end":26,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":26}}, "body": [] } } diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/112/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/112/output.json index b8e2a44c5342..d535de366526 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/112/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/112/output.json @@ -1,144 +1,42 @@ { "type": "File", - "start": 0, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 39 - } - }, + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":39}}, "program": { "type": "Program", - "start": 0, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 39 - } - }, + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":39}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 39 - } - }, + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":39}}, "id": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "A" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, "name": "A" }, "superClass": { "type": "ClassExpression", - "start": 16, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":16,"end":36,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":36}}, "id": { "type": "Identifier", - "start": 22, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 23 - }, - "identifierName": "B" - }, + "start":22,"end":23,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":23},"identifierName":"B"}, "name": "B" }, "superClass": { "type": "Identifier", - "start": 32, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 32 - }, - "end": { - "line": 1, - "column": 33 - }, - "identifierName": "C" - }, + "start":32,"end":33,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":33},"identifierName":"C"}, "name": "C" }, "body": { "type": "ClassBody", - "start": 34, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 34 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":34,"end":36,"loc":{"start":{"line":1,"column":34},"end":{"line":1,"column":36}}, "body": [] } }, "body": { "type": "ClassBody", - "start": 37, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 37 - }, - "end": { - "line": 1, - "column": 39 - } - }, + "start":37,"end":39,"loc":{"start":{"line":1,"column":37},"end":{"line":1,"column":39}}, "body": [] } } diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/113/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/113/output.json index 305d2691fc1a..76746368ca82 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/113/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/113/output.json @@ -1,111 +1,32 @@ { "type": "File", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, "program": { "type": "Program", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, "id": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "A" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, "name": "A" }, "superClass": null, "body": { "type": "ClassBody", - "start": 8, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":8,"end":18,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":18}}, "body": [ { "type": "ClassMethod", - "start": 9, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":9,"end":17,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":17}}, "static": false, "key": { "type": "Identifier", - "start": 9, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "get" - }, + "start":9,"end":12,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":12},"identifierName":"get"}, "name": "get" }, "computed": false, @@ -116,18 +37,7 @@ "params": [], "body": { "type": "BlockStatement", - "start": 15, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":15,"end":17,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":17}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/114/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/114/output.json index 0c66d3d9d4cd..9b7fc3e24f8a 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/114/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/114/output.json @@ -1,111 +1,32 @@ { "type": "File", - "start": 0, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, "program": { "type": "Program", - "start": 0, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, "id": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "A" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, "name": "A" }, "superClass": null, "body": { "type": "ClassBody", - "start": 8, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":8,"end":26,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":26}}, "body": [ { "type": "ClassMethod", - "start": 10, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":10,"end":25,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":25}}, "static": true, "key": { "type": "Identifier", - "start": 17, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 20 - }, - "identifierName": "get" - }, + "start":17,"end":20,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":20},"identifierName":"get"}, "name": "get" }, "computed": false, @@ -116,18 +37,7 @@ "params": [], "body": { "type": "BlockStatement", - "start": 23, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":23,"end":25,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":25}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/115/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/115/output.json index 42b7e94f5611..d714cbf30a45 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/115/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/115/output.json @@ -1,127 +1,36 @@ { "type": "File", - "start": 0, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, "program": { "type": "Program", - "start": 0, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, "id": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "A" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, "name": "A" }, "superClass": { "type": "Identifier", - "start": 16, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - }, - "identifierName": "B" - }, + "start":16,"end":17,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":17},"identifierName":"B"}, "name": "B" }, "body": { "type": "ClassBody", - "start": 18, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":18,"end":32,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":32}}, "body": [ { "type": "ClassMethod", - "start": 19, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":19,"end":31,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":31}}, "static": false, "key": { "type": "Identifier", - "start": 23, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 26 - }, - "identifierName": "foo" - }, + "start":23,"end":26,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":26},"identifierName":"foo"}, "name": "foo" }, "computed": false, @@ -132,18 +41,7 @@ "params": [], "body": { "type": "BlockStatement", - "start": 29, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":29,"end":31,"loc":{"start":{"line":1,"column":29},"end":{"line":1,"column":31}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/116/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/116/output.json index 50381b6fe9c7..de6fccf7752c 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/116/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/116/output.json @@ -1,127 +1,36 @@ { "type": "File", - "start": 0, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 40 - } - }, + "start":0,"end":40,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":40}}, "program": { "type": "Program", - "start": 0, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 40 - } - }, + "start":0,"end":40,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":40}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 40 - } - }, + "start":0,"end":40,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":40}}, "id": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "A" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, "name": "A" }, "superClass": { "type": "Identifier", - "start": 16, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - }, - "identifierName": "B" - }, + "start":16,"end":17,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":17},"identifierName":"B"}, "name": "B" }, "body": { "type": "ClassBody", - "start": 18, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 40 - } - }, + "start":18,"end":40,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":40}}, "body": [ { "type": "ClassMethod", - "start": 20, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 39 - } - }, + "start":20,"end":39,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":39}}, "static": true, "key": { "type": "Identifier", - "start": 31, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 31 - }, - "end": { - "line": 1, - "column": 34 - }, - "identifierName": "foo" - }, + "start":31,"end":34,"loc":{"start":{"line":1,"column":31},"end":{"line":1,"column":34},"identifierName":"foo"}, "name": "foo" }, "computed": false, @@ -132,18 +41,7 @@ "params": [], "body": { "type": "BlockStatement", - "start": 37, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 37 - }, - "end": { - "line": 1, - "column": 39 - } - }, + "start":37,"end":39,"loc":{"start":{"line":1,"column":37},"end":{"line":1,"column":39}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/117/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/117/output.json index 9b82de2a1460..981f70fabb94 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/117/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/117/output.json @@ -1,111 +1,32 @@ { "type": "File", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, "program": { "type": "Program", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, "id": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "A" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, "name": "A" }, "superClass": null, "body": { "type": "ClassBody", - "start": 8, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":8,"end":21,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":21}}, "body": [ { "type": "ClassMethod", - "start": 9, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":9,"end":20,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":20}}, "static": false, "key": { "type": "Identifier", - "start": 13, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - }, - "identifierName": "a" - }, + "start":13,"end":14,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":14},"identifierName":"a"}, "name": "a" }, "computed": false, @@ -116,36 +37,13 @@ "params": [ { "type": "Identifier", - "start": 15, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - }, - "identifierName": "v" - }, + "start":15,"end":16,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":16},"identifierName":"v"}, "name": "v" } ], "body": { "type": "BlockStatement", - "start": 18, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":18,"end":20,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":20}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/118/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/118/output.json index 0fbb2f9cf430..e19c02232bb8 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/118/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/118/output.json @@ -1,111 +1,32 @@ { "type": "File", - "start": 0, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, "program": { "type": "Program", - "start": 0, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, "id": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "A" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, "name": "A" }, "superClass": null, "body": { "type": "ClassBody", - "start": 8, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":8,"end":29,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":29}}, "body": [ { "type": "ClassMethod", - "start": 10, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":10,"end":28,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":28}}, "static": true, "key": { "type": "Identifier", - "start": 21, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 22 - }, - "identifierName": "a" - }, + "start":21,"end":22,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":22},"identifierName":"a"}, "name": "a" }, "computed": false, @@ -116,36 +37,13 @@ "params": [ { "type": "Identifier", - "start": 23, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 24 - }, - "identifierName": "v" - }, + "start":23,"end":24,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":24},"identifierName":"v"}, "name": "v" } ], "body": { "type": "BlockStatement", - "start": 26, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":26,"end":28,"loc":{"start":{"line":1,"column":26},"end":{"line":1,"column":28}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/119/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/119/output.json index b05ad1e2e5c7..e86ffdd1b9c6 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/119/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/119/output.json @@ -1,111 +1,32 @@ { "type": "File", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, "program": { "type": "Program", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, "id": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "A" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, "name": "A" }, "superClass": null, "body": { "type": "ClassBody", - "start": 8, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":8,"end":20,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":20}}, "body": [ { "type": "ClassMethod", - "start": 9, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":9,"end":18,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":18}}, "static": false, "key": { "type": "Identifier", - "start": 9, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "set" - }, + "start":9,"end":12,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":12},"identifierName":"set"}, "name": "set" }, "computed": false, @@ -116,36 +37,13 @@ "params": [ { "type": "Identifier", - "start": 13, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - }, - "identifierName": "v" - }, + "start":13,"end":14,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":14},"identifierName":"v"}, "name": "v" } ], "body": { "type": "BlockStatement", - "start": 16, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":16,"end":18,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":18}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/12/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/12/output.json index c252371102a6..3190f75a5f5f 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/12/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/12/output.json @@ -1,62 +1,18 @@ { "type": "File", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, "program": { "type": "Program", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, "expression": { "type": "NumericLiteral", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, "extra": { "rawValue": 0, "raw": "0b0" diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/120/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/120/output.json index ef265edfeaee..9ce643512b7f 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/120/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/120/output.json @@ -1,111 +1,32 @@ { "type": "File", - "start": 0, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, "program": { "type": "Program", - "start": 0, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, "id": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "A" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, "name": "A" }, "superClass": null, "body": { "type": "ClassBody", - "start": 8, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":8,"end":28,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":28}}, "body": [ { "type": "ClassMethod", - "start": 10, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":10,"end":26,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":26}}, "static": true, "key": { "type": "Identifier", - "start": 17, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 20 - }, - "identifierName": "set" - }, + "start":17,"end":20,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":20},"identifierName":"set"}, "name": "set" }, "computed": false, @@ -116,36 +37,13 @@ "params": [ { "type": "Identifier", - "start": 21, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 22 - }, - "identifierName": "v" - }, + "start":21,"end":22,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":22},"identifierName":"v"}, "name": "v" } ], "body": { "type": "BlockStatement", - "start": 24, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":24,"end":26,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":26}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/121/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/121/output.json index 00ffd8259668..ed60c0b1ec2c 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/121/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/121/output.json @@ -1,112 +1,33 @@ { "type": "File", - "start": 0, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, "program": { "type": "Program", - "start": 0, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, "id": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "A" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, "name": "A" }, "superClass": null, "body": { "type": "ClassBody", - "start": 8, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":8,"end":30,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":30}}, "body": [ { "type": "ClassMethod", - "start": 9, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":9,"end":29,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":29}}, "static": false, "kind": "method", "key": { "type": "Identifier", - "start": 10, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 13 - }, - "identifierName": "gen" - }, + "start":10,"end":13,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":13},"identifierName":"gen"}, "name": "gen" }, "computed": false, @@ -116,81 +37,24 @@ "params": [ { "type": "Identifier", - "start": 14, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - }, - "identifierName": "v" - }, + "start":14,"end":15,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":15},"identifierName":"v"}, "name": "v" } ], "body": { "type": "BlockStatement", - "start": 17, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":17,"end":29,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":29}}, "body": [ { "type": "ExpressionStatement", - "start": 19, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":19,"end":27,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":27}}, "expression": { "type": "YieldExpression", - "start": 19, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":19,"end":26,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":26}}, "delegate": false, "argument": { "type": "Identifier", - "start": 25, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 26 - }, - "identifierName": "v" - }, + "start":25,"end":26,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":26},"identifierName":"v"}, "name": "v" } } diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/122/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/122/output.json index 478423b1ad3f..0ee4c5a36b04 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/122/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/122/output.json @@ -1,112 +1,33 @@ { "type": "File", - "start": 0, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":38}}, "program": { "type": "Program", - "start": 0, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":38}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":38}}, "id": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "A" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, "name": "A" }, "superClass": null, "body": { "type": "ClassBody", - "start": 8, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":8,"end":38,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":38}}, "body": [ { "type": "ClassMethod", - "start": 10, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 37 - } - }, + "start":10,"end":37,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":37}}, "static": true, "kind": "method", "key": { "type": "Identifier", - "start": 18, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 21 - }, - "identifierName": "gen" - }, + "start":18,"end":21,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":21},"identifierName":"gen"}, "name": "gen" }, "computed": false, @@ -116,81 +37,24 @@ "params": [ { "type": "Identifier", - "start": 22, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 23 - }, - "identifierName": "v" - }, + "start":22,"end":23,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":23},"identifierName":"v"}, "name": "v" } ], "body": { "type": "BlockStatement", - "start": 25, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 37 - } - }, + "start":25,"end":37,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":37}}, "body": [ { "type": "ExpressionStatement", - "start": 27, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":27,"end":35,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":35}}, "expression": { "type": "YieldExpression", - "start": 27, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":27,"end":34,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":34}}, "delegate": false, "argument": { "type": "Identifier", - "start": 33, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 33 - }, - "end": { - "line": 1, - "column": 34 - }, - "identifierName": "v" - }, + "start":33,"end":34,"loc":{"start":{"line":1,"column":33},"end":{"line":1,"column":34},"identifierName":"v"}, "name": "v" } } diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/123/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/123/options.json deleted file mode 100644 index fdf74cefe1b2..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/123/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "super() is only valid inside a class constructor of a subclass. Maybe a typo in the method name ('constructor') or not extending another class? (1:40)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/123/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/123/output.json new file mode 100644 index 000000000000..9bf15e6a3a03 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/123/output.json @@ -0,0 +1,90 @@ +{ + "type": "File", + "start":0,"end":51,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":51}}, + "errors": [ + "SyntaxError: super() is only valid inside a class constructor of a subclass. Maybe a typo in the method name ('constructor') or not extending another class? (1:40)" + ], + "program": { + "type": "Program", + "start":0,"end":51,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":51}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":14,"end":51,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":51}}, + "expression": { + "type": "ClassExpression", + "start":15,"end":50,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":50}}, + "id": { + "type": "Identifier", + "start":21,"end":22,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":22},"identifierName":"A"}, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":23,"end":50,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":50}}, + "body": [ + { + "type": "ClassMethod", + "start":24,"end":49,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":49}}, + "static": false, + "key": { + "type": "Identifier", + "start":24,"end":35,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":35},"identifierName":"constructor"}, + "name": "constructor" + }, + "computed": false, + "kind": "constructor", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":38,"end":49,"loc":{"start":{"line":1,"column":38},"end":{"line":1,"column":49}}, + "body": [ + { + "type": "ExpressionStatement", + "start":40,"end":47,"loc":{"start":{"line":1,"column":40},"end":{"line":1,"column":47}}, + "expression": { + "type": "CallExpression", + "start":40,"end":47,"loc":{"start":{"line":1,"column":40},"end":{"line":1,"column":47}}, + "callee": { + "type": "Super", + "start":40,"end":45,"loc":{"start":{"line":1,"column":40},"end":{"line":1,"column":45}} + }, + "arguments": [] + } + } + ], + "directives": [] + } + } + ] + }, + "extra": { + "parenthesized": true, + "parenStart": 14 + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "value": { + "type": "DirectiveLiteral", + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/124/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/124/output.json index 8a4bd53524fb..edecd60c9349 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/124/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/124/output.json @@ -1,110 +1,32 @@ { "type": "File", - "start": 0, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, "program": { "type": "Program", - "start": 0, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, "id": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "A" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, "name": "A" }, "superClass": null, "body": { "type": "ClassBody", - "start": 8, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":8,"end":28,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":28}}, "body": [ { "type": "ClassMethod", - "start": 9, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":9,"end":27,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":27}}, "static": false, "key": { "type": "StringLiteral", - "start": 9, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":9,"end":22,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":22}}, "extra": { "rawValue": "constructor", "raw": "'constructor'" @@ -119,18 +41,7 @@ "params": [], "body": { "type": "BlockStatement", - "start": 25, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":25,"end":27,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":27}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/125/input.js b/packages/babel-parser/test/fixtures/es2015/uncategorised/125/input.js index a7bd428bbfce..83b8fa3b72d4 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/125/input.js +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/125/input.js @@ -1 +1 @@ -class A { constructor() {} 'constructor'() } \ No newline at end of file +class A { constructor() {} 'constructor'() {} } \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/125/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/125/options.json deleted file mode 100644 index 09e50a3d71c3..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/125/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Duplicate constructor in the same class (1:27)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/125/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/125/output.json new file mode 100644 index 000000000000..2d6cbfab112a --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/125/output.json @@ -0,0 +1,80 @@ +{ + "type": "File", + "start":0,"end":47,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":47}}, + "errors": [ + "SyntaxError: Duplicate constructor in the same class (1:27)" + ], + "program": { + "type": "Program", + "start":0,"end":47,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":47}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start":0,"end":47,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":47}}, + "id": { + "type": "Identifier", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":8,"end":47,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":47}}, + "body": [ + { + "type": "ClassMethod", + "start":10,"end":26,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":26}}, + "static": false, + "key": { + "type": "Identifier", + "start":10,"end":21,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":21},"identifierName":"constructor"}, + "name": "constructor" + }, + "computed": false, + "kind": "constructor", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":24,"end":26,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":26}}, + "body": [], + "directives": [] + } + }, + { + "type": "ClassMethod", + "start":27,"end":45,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":45}}, + "static": false, + "key": { + "type": "StringLiteral", + "start":27,"end":40,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":40}}, + "extra": { + "rawValue": "constructor", + "raw": "'constructor'" + }, + "value": "constructor" + }, + "computed": false, + "kind": "constructor", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":43,"end":45,"loc":{"start":{"line":1,"column":43},"end":{"line":1,"column":45}}, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/126/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/126/options.json deleted file mode 100644 index 38e87b07044c..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/126/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Constructor can't have get/set modifier (1:14)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/126/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/126/output.json new file mode 100644 index 000000000000..ccd3aa3f3e7c --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/126/output.json @@ -0,0 +1,54 @@ +{ + "type": "File", + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, + "errors": [ + "SyntaxError: Class constructor may not be an accessor (1:14)" + ], + "program": { + "type": "Program", + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, + "id": { + "type": "Identifier", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":8,"end":32,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":32}}, + "body": [ + { + "type": "ClassMethod", + "start":10,"end":30,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":30}}, + "static": false, + "key": { + "type": "Identifier", + "start":14,"end":25,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":25},"identifierName":"constructor"}, + "name": "constructor" + }, + "computed": false, + "kind": "get", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":28,"end":30,"loc":{"start":{"line":1,"column":28},"end":{"line":1,"column":30}}, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/127/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/127/options.json deleted file mode 100644 index becf560010f4..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/127/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Constructor can't be a generator (1:11)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/127/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/127/output.json new file mode 100644 index 000000000000..8650fd6a5dc4 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/127/output.json @@ -0,0 +1,54 @@ +{ + "type": "File", + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, + "errors": [ + "SyntaxError: Constructor can't be a generator (1:11)" + ], + "program": { + "type": "Program", + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, + "id": { + "type": "Identifier", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":8,"end":29,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":29}}, + "body": [ + { + "type": "ClassMethod", + "start":10,"end":27,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":27}}, + "static": false, + "kind": "method", + "key": { + "type": "Identifier", + "start":11,"end":22,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":22},"identifierName":"constructor"}, + "name": "constructor" + }, + "computed": false, + "id": null, + "generator": true, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":25,"end":27,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":27}}, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/128/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/128/output.json index b186e4ed4d20..b203be1a09be 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/128/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/128/output.json @@ -1,111 +1,32 @@ { "type": "File", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, "program": { "type": "Program", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, "id": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "A" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, "name": "A" }, "superClass": null, "body": { "type": "ClassBody", - "start": 8, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":8,"end":25,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":25}}, "body": [ { "type": "ClassMethod", - "start": 9, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":9,"end":24,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":24}}, "static": true, "key": { "type": "Identifier", - "start": 16, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 19 - }, - "identifierName": "foo" - }, + "start":16,"end":19,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":19},"identifierName":"foo"}, "name": "foo" }, "computed": false, @@ -116,18 +37,7 @@ "params": [], "body": { "type": "BlockStatement", - "start": 22, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":22,"end":24,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":24}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/129/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/129/output.json index 2bd265802fa5..e6f1a12cab4a 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/129/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/129/output.json @@ -1,111 +1,32 @@ { "type": "File", - "start": 0, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, "program": { "type": "Program", - "start": 0, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, "id": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "A" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, "name": "A" }, "superClass": null, "body": { "type": "ClassBody", - "start": 8, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":8,"end":34,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":34}}, "body": [ { "type": "ClassMethod", - "start": 9, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":9,"end":17,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":17}}, "static": false, "key": { "type": "Identifier", - "start": 9, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "foo" - }, + "start":9,"end":12,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":12},"identifierName":"foo"}, "name": "foo" }, "computed": false, @@ -116,52 +37,18 @@ "params": [], "body": { "type": "BlockStatement", - "start": 15, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":15,"end":17,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":17}}, "body": [], "directives": [] } }, { "type": "ClassMethod", - "start": 18, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":18,"end":33,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":33}}, "static": true, "key": { "type": "Identifier", - "start": 25, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 28 - }, - "identifierName": "bar" - }, + "start":25,"end":28,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":28},"identifierName":"bar"}, "name": "bar" }, "computed": false, @@ -172,18 +59,7 @@ "params": [], "body": { "type": "BlockStatement", - "start": 31, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 31 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":31,"end":33,"loc":{"start":{"line":1,"column":31},"end":{"line":1,"column":33}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/13/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/13/output.json index 4cf5cc60dfe5..ce6d2c2cf9dc 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/13/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/13/output.json @@ -1,62 +1,18 @@ { "type": "File", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, "program": { "type": "Program", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, "expression": { "type": "NumericLiteral", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, "extra": { "rawValue": 1, "raw": "0b1" diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/131/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/131/output.json index 4a7592078963..8710090194f9 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/131/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/131/output.json @@ -1,111 +1,32 @@ { "type": "File", - "start": 0, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, "program": { "type": "Program", - "start": 0, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, "id": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "A" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, "name": "A" }, "superClass": null, "body": { "type": "ClassBody", - "start": 8, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":8,"end":28,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":28}}, "body": [ { "type": "ClassMethod", - "start": 10, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":10,"end":18,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":18}}, "static": false, "key": { "type": "Identifier", - "start": 10, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 13 - }, - "identifierName": "foo" - }, + "start":10,"end":13,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":13},"identifierName":"foo"}, "name": "foo" }, "computed": false, @@ -116,52 +37,18 @@ "params": [], "body": { "type": "BlockStatement", - "start": 16, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":16,"end":18,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":18}}, "body": [], "directives": [] } }, { "type": "ClassMethod", - "start": 19, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":19,"end":27,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":27}}, "static": false, "key": { "type": "Identifier", - "start": 19, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 22 - }, - "identifierName": "bar" - }, + "start":19,"end":22,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":22},"identifierName":"bar"}, "name": "bar" }, "computed": false, @@ -172,18 +59,7 @@ "params": [], "body": { "type": "BlockStatement", - "start": 25, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":25,"end":27,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":27}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/132/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/132/output.json index fe2ecee74089..9ff0fad861c4 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/132/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/132/output.json @@ -1,111 +1,32 @@ { "type": "File", - "start": 0, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 37 - } - }, + "start":0,"end":37,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":37}}, "program": { "type": "Program", - "start": 0, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 37 - } - }, + "start":0,"end":37,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":37}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 37 - } - }, + "start":0,"end":37,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":37}}, "id": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "A" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, "name": "A" }, "superClass": null, "body": { "type": "ClassBody", - "start": 8, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 37 - } - }, + "start":8,"end":37,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":37}}, "body": [ { "type": "ClassMethod", - "start": 10, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":10,"end":22,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":22}}, "static": false, "key": { "type": "Identifier", - "start": 14, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 17 - }, - "identifierName": "foo" - }, + "start":14,"end":17,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":17},"identifierName":"foo"}, "name": "foo" }, "computed": false, @@ -116,52 +37,18 @@ "params": [], "body": { "type": "BlockStatement", - "start": 20, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":20,"end":22,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":22}}, "body": [], "directives": [] } }, { "type": "ClassMethod", - "start": 23, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":23,"end":36,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":36}}, "static": false, "key": { "type": "Identifier", - "start": 27, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 30 - }, - "identifierName": "foo" - }, + "start":27,"end":30,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":30},"identifierName":"foo"}, "name": "foo" }, "computed": false, @@ -172,36 +59,13 @@ "params": [ { "type": "Identifier", - "start": 31, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 31 - }, - "end": { - "line": 1, - "column": 32 - }, - "identifierName": "v" - }, + "start":31,"end":32,"loc":{"start":{"line":1,"column":31},"end":{"line":1,"column":32},"identifierName":"v"}, "name": "v" } ], "body": { "type": "BlockStatement", - "start": 34, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 34 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":34,"end":36,"loc":{"start":{"line":1,"column":34},"end":{"line":1,"column":36}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/133/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/133/output.json index a1006607988a..fdc9d9a42d0f 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/133/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/133/output.json @@ -1,111 +1,32 @@ { "type": "File", - "start": 0, - "end": 43, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 43 - } - }, + "start":0,"end":43,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":43}}, "program": { "type": "Program", - "start": 0, - "end": 43, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 43 - } - }, + "start":0,"end":43,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":43}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 43, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 43 - } - }, + "start":0,"end":43,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":43}}, "id": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "A" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, "name": "A" }, "superClass": null, "body": { "type": "ClassBody", - "start": 8, - "end": 43, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 43 - } - }, + "start":8,"end":43,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":43}}, "body": [ { "type": "ClassMethod", - "start": 10, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":10,"end":29,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":29}}, "static": true, "key": { "type": "Identifier", - "start": 21, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 24 - }, - "identifierName": "foo" - }, + "start":21,"end":24,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":24},"identifierName":"foo"}, "name": "foo" }, "computed": false, @@ -116,52 +37,18 @@ "params": [], "body": { "type": "BlockStatement", - "start": 27, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":27,"end":29,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":29}}, "body": [], "directives": [] } }, { "type": "ClassMethod", - "start": 30, - "end": 42, - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 1, - "column": 42 - } - }, + "start":30,"end":42,"loc":{"start":{"line":1,"column":30},"end":{"line":1,"column":42}}, "static": false, "key": { "type": "Identifier", - "start": 34, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 34 - }, - "end": { - "line": 1, - "column": 37 - }, - "identifierName": "foo" - }, + "start":34,"end":37,"loc":{"start":{"line":1,"column":34},"end":{"line":1,"column":37},"identifierName":"foo"}, "name": "foo" }, "computed": false, @@ -172,18 +59,7 @@ "params": [], "body": { "type": "BlockStatement", - "start": 40, - "end": 42, - "loc": { - "start": { - "line": 1, - "column": 40 - }, - "end": { - "line": 1, - "column": 42 - } - }, + "start":40,"end":42,"loc":{"start":{"line":1,"column":40},"end":{"line":1,"column":42}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/134/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/134/output.json index c052ee5949a2..4dc864ad64da 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/134/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/134/output.json @@ -1,111 +1,32 @@ { "type": "File", - "start": 0, - "end": 51, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 51 - } - }, + "start":0,"end":51,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":51}}, "program": { "type": "Program", - "start": 0, - "end": 51, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 51 - } - }, + "start":0,"end":51,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":51}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 51, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 51 - } - }, + "start":0,"end":51,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":51}}, "id": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "A" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, "name": "A" }, "superClass": null, "body": { "type": "ClassBody", - "start": 8, - "end": 51, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 51 - } - }, + "start":8,"end":51,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":51}}, "body": [ { "type": "ClassMethod", - "start": 10, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":10,"end":29,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":29}}, "static": true, "key": { "type": "Identifier", - "start": 21, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 24 - }, - "identifierName": "foo" - }, + "start":21,"end":24,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":24},"identifierName":"foo"}, "name": "foo" }, "computed": false, @@ -116,52 +37,18 @@ "params": [], "body": { "type": "BlockStatement", - "start": 27, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":27,"end":29,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":29}}, "body": [], "directives": [] } }, { "type": "ClassMethod", - "start": 30, - "end": 49, - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 1, - "column": 49 - } - }, + "start":30,"end":49,"loc":{"start":{"line":1,"column":30},"end":{"line":1,"column":49}}, "static": true, "key": { "type": "Identifier", - "start": 41, - "end": 44, - "loc": { - "start": { - "line": 1, - "column": 41 - }, - "end": { - "line": 1, - "column": 44 - }, - "identifierName": "bar" - }, + "start":41,"end":44,"loc":{"start":{"line":1,"column":41},"end":{"line":1,"column":44},"identifierName":"bar"}, "name": "bar" }, "computed": false, @@ -172,18 +59,7 @@ "params": [], "body": { "type": "BlockStatement", - "start": 47, - "end": 49, - "loc": { - "start": { - "line": 1, - "column": 47 - }, - "end": { - "line": 1, - "column": 49 - } - }, + "start":47,"end":49,"loc":{"start":{"line":1,"column":47},"end":{"line":1,"column":49}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/135/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/135/output.json index 41cd92a65266..5162de5b21c8 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/135/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/135/output.json @@ -1,111 +1,32 @@ { "type": "File", - "start": 0, - "end": 78, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 78 - } - }, + "start":0,"end":78,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":78}}, "program": { "type": "Program", - "start": 0, - "end": 78, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 78 - } - }, + "start":0,"end":78,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":78}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 78, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 78 - } - }, + "start":0,"end":78,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":78}}, "id": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "A" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, "name": "A" }, "superClass": null, "body": { "type": "ClassBody", - "start": 8, - "end": 78, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 78 - } - }, + "start":8,"end":78,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":78}}, "body": [ { "type": "ClassMethod", - "start": 10, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":10,"end":29,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":29}}, "static": true, "key": { "type": "Identifier", - "start": 21, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 24 - }, - "identifierName": "foo" - }, + "start":21,"end":24,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":24},"identifierName":"foo"}, "name": "foo" }, "computed": false, @@ -116,52 +37,18 @@ "params": [], "body": { "type": "BlockStatement", - "start": 27, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":27,"end":29,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":29}}, "body": [], "directives": [] } }, { "type": "ClassMethod", - "start": 30, - "end": 50, - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 1, - "column": 50 - } - }, + "start":30,"end":50,"loc":{"start":{"line":1,"column":30},"end":{"line":1,"column":50}}, "static": true, "key": { "type": "Identifier", - "start": 41, - "end": 44, - "loc": { - "start": { - "line": 1, - "column": 41 - }, - "end": { - "line": 1, - "column": 44 - }, - "identifierName": "foo" - }, + "start":41,"end":44,"loc":{"start":{"line":1,"column":41},"end":{"line":1,"column":44},"identifierName":"foo"}, "name": "foo" }, "computed": false, @@ -172,70 +59,24 @@ "params": [ { "type": "Identifier", - "start": 45, - "end": 46, - "loc": { - "start": { - "line": 1, - "column": 45 - }, - "end": { - "line": 1, - "column": 46 - }, - "identifierName": "v" - }, + "start":45,"end":46,"loc":{"start":{"line":1,"column":45},"end":{"line":1,"column":46},"identifierName":"v"}, "name": "v" } ], "body": { "type": "BlockStatement", - "start": 48, - "end": 50, - "loc": { - "start": { - "line": 1, - "column": 48 - }, - "end": { - "line": 1, - "column": 50 - } - }, + "start":48,"end":50,"loc":{"start":{"line":1,"column":48},"end":{"line":1,"column":50}}, "body": [], "directives": [] } }, { "type": "ClassMethod", - "start": 51, - "end": 63, - "loc": { - "start": { - "line": 1, - "column": 51 - }, - "end": { - "line": 1, - "column": 63 - } - }, + "start":51,"end":63,"loc":{"start":{"line":1,"column":51},"end":{"line":1,"column":63}}, "static": false, "key": { "type": "Identifier", - "start": 55, - "end": 58, - "loc": { - "start": { - "line": 1, - "column": 55 - }, - "end": { - "line": 1, - "column": 58 - }, - "identifierName": "foo" - }, + "start":55,"end":58,"loc":{"start":{"line":1,"column":55},"end":{"line":1,"column":58},"identifierName":"foo"}, "name": "foo" }, "computed": false, @@ -246,52 +87,18 @@ "params": [], "body": { "type": "BlockStatement", - "start": 61, - "end": 63, - "loc": { - "start": { - "line": 1, - "column": 61 - }, - "end": { - "line": 1, - "column": 63 - } - }, + "start":61,"end":63,"loc":{"start":{"line":1,"column":61},"end":{"line":1,"column":63}}, "body": [], "directives": [] } }, { "type": "ClassMethod", - "start": 64, - "end": 77, - "loc": { - "start": { - "line": 1, - "column": 64 - }, - "end": { - "line": 1, - "column": 77 - } - }, + "start":64,"end":77,"loc":{"start":{"line":1,"column":64},"end":{"line":1,"column":77}}, "static": false, "key": { "type": "Identifier", - "start": 68, - "end": 71, - "loc": { - "start": { - "line": 1, - "column": 68 - }, - "end": { - "line": 1, - "column": 71 - }, - "identifierName": "foo" - }, + "start":68,"end":71,"loc":{"start":{"line":1,"column":68},"end":{"line":1,"column":71},"identifierName":"foo"}, "name": "foo" }, "computed": false, @@ -302,36 +109,13 @@ "params": [ { "type": "Identifier", - "start": 72, - "end": 73, - "loc": { - "start": { - "line": 1, - "column": 72 - }, - "end": { - "line": 1, - "column": 73 - }, - "identifierName": "v" - }, + "start":72,"end":73,"loc":{"start":{"line":1,"column":72},"end":{"line":1,"column":73},"identifierName":"v"}, "name": "v" } ], "body": { "type": "BlockStatement", - "start": 75, - "end": 77, - "loc": { - "start": { - "line": 1, - "column": 75 - }, - "end": { - "line": 1, - "column": 77 - } - }, + "start":75,"end":77,"loc":{"start":{"line":1,"column":75},"end":{"line":1,"column":77}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/136/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/136/output.json index 8863ca591f3c..619d1cf63a87 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/136/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/136/output.json @@ -1,112 +1,33 @@ { "type": "File", - "start": 0, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, "program": { "type": "Program", - "start": 0, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, "id": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "A" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, "name": "A" }, "superClass": null, "body": { "type": "ClassBody", - "start": 8, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":8,"end":29,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":29}}, "body": [ { "type": "ClassMethod", - "start": 10, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":10,"end":27,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":27}}, "static": true, "computed": true, "key": { "type": "Identifier", - "start": 18, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 21 - }, - "identifierName": "foo" - }, + "start":18,"end":21,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":21},"identifierName":"foo"}, "name": "foo" }, "kind": "method", @@ -116,18 +37,7 @@ "params": [], "body": { "type": "BlockStatement", - "start": 25, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":25,"end":27,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":27}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/137/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/137/output.json index 4dccee7ed98a..305175032f08 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/137/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/137/output.json @@ -1,111 +1,32 @@ { "type": "File", - "start": 0, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, "program": { "type": "Program", - "start": 0, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, "id": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "A" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, "name": "A" }, "superClass": null, "body": { "type": "ClassBody", - "start": 8, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":8,"end":33,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":33}}, "body": [ { "type": "ClassMethod", - "start": 10, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":10,"end":31,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":31}}, "static": true, "key": { "type": "Identifier", - "start": 22, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 25 - }, - "identifierName": "foo" - }, + "start":22,"end":25,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":25},"identifierName":"foo"}, "name": "foo" }, "computed": true, @@ -116,18 +37,7 @@ "params": [], "body": { "type": "BlockStatement", - "start": 29, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":29,"end":31,"loc":{"start":{"line":1,"column":29},"end":{"line":1,"column":31}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/138/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/138/output.json index 0b980b14e0e4..1b2c1116b090 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/138/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/138/output.json @@ -1,111 +1,32 @@ { "type": "File", - "start": 0, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":38}}, "program": { "type": "Program", - "start": 0, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":38}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":38}}, "id": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "A" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, "name": "A" }, "superClass": null, "body": { "type": "ClassBody", - "start": 8, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":8,"end":38,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":38}}, "body": [ { "type": "ClassMethod", - "start": 10, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":10,"end":23,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":23}}, "static": false, "key": { "type": "Identifier", - "start": 14, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 17 - }, - "identifierName": "foo" - }, + "start":14,"end":17,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":17},"identifierName":"foo"}, "name": "foo" }, "computed": false, @@ -116,70 +37,24 @@ "params": [ { "type": "Identifier", - "start": 18, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - }, - "identifierName": "v" - }, + "start":18,"end":19,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":19},"identifierName":"v"}, "name": "v" } ], "body": { "type": "BlockStatement", - "start": 21, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":21,"end":23,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":23}}, "body": [], "directives": [] } }, { "type": "ClassMethod", - "start": 24, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":24,"end":36,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":36}}, "static": false, "key": { "type": "Identifier", - "start": 28, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 31 - }, - "identifierName": "foo" - }, + "start":28,"end":31,"loc":{"start":{"line":1,"column":28},"end":{"line":1,"column":31},"identifierName":"foo"}, "name": "foo" }, "computed": false, @@ -190,18 +65,7 @@ "params": [], "body": { "type": "BlockStatement", - "start": 34, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 34 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":34,"end":36,"loc":{"start":{"line":1,"column":34},"end":{"line":1,"column":36}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/139/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/139/output.json index d81c5e5c9559..4aefcee20c22 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/139/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/139/output.json @@ -1,111 +1,32 @@ { "type": "File", - "start": 0, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, "program": { "type": "Program", - "start": 0, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, "id": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "A" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, "name": "A" }, "superClass": null, "body": { "type": "ClassBody", - "start": 8, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":8,"end":33,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":33}}, "body": [ { "type": "ClassMethod", - "start": 10, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":10,"end":18,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":18}}, "static": false, "key": { "type": "Identifier", - "start": 10, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 13 - }, - "identifierName": "foo" - }, + "start":10,"end":13,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":13},"identifierName":"foo"}, "name": "foo" }, "computed": false, @@ -116,52 +37,18 @@ "params": [], "body": { "type": "BlockStatement", - "start": 16, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":16,"end":18,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":18}}, "body": [], "directives": [] } }, { "type": "ClassMethod", - "start": 19, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":19,"end":31,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":31}}, "static": false, "key": { "type": "Identifier", - "start": 23, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 26 - }, - "identifierName": "foo" - }, + "start":23,"end":26,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":26},"identifierName":"foo"}, "name": "foo" }, "computed": false, @@ -172,18 +59,7 @@ "params": [], "body": { "type": "BlockStatement", - "start": 29, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":29,"end":31,"loc":{"start":{"line":1,"column":29},"end":{"line":1,"column":31}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/14/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/14/output.json index 9a7364a78aaf..2b17ce385b89 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/14/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/14/output.json @@ -1,62 +1,18 @@ { "type": "File", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - }, + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, "program": { "type": "Program", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - }, + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - }, + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, "expression": { "type": "NumericLiteral", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - }, + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, "extra": { "rawValue": 2, "raw": "0b10" diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/140/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/140/output.json index f32fb5ab8d41..2e31b3da9007 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/140/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/140/output.json @@ -1,80 +1,24 @@ { "type": "File", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, "program": { "type": "Program", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, "id": { "type": "Identifier", - "start": 6, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 15 - }, - "identifierName": "Semicolon" - }, + "start":6,"end":15,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":15},"identifierName":"Semicolon"}, "name": "Semicolon" }, "superClass": null, "body": { "type": "ClassBody", - "start": 16, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":16,"end":21,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":21}}, "body": [] } } diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/141/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/141/output.json index 11e3e3f5c2de..49f4e9d40f1f 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/141/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/141/output.json @@ -1,111 +1,33 @@ { "type": "File", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "program": { "type": "Program", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "expression": { "type": "ObjectExpression", - "start": 1, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":1,"end":10,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":10}}, "properties": [ { "type": "ObjectProperty", - "start": 2, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":2,"end":9,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":9}}, "method": false, "computed": true, "key": { "type": "Identifier", - "start": 3, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 4 - }, - "identifierName": "x" - }, + "start":3,"end":4,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":4},"identifierName":"x"}, "name": "x" }, "shorthand": false, "value": { "type": "NumericLiteral", - "start": 7, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":7,"end":9,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":9}}, "extra": { "rawValue": 10, "raw": "10" diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/142/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/142/output.json index a85e52a0611b..ebd88cbcd668 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/142/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/142/output.json @@ -1,107 +1,30 @@ { "type": "File", - "start": 0, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, "program": { "type": "Program", - "start": 0, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, "expression": { "type": "ObjectExpression", - "start": 1, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":1,"end":18,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":18}}, "properties": [ { "type": "ObjectProperty", - "start": 2, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":2,"end":17,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":17}}, "method": false, "computed": true, "key": { "type": "BinaryExpression", - "start": 3, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":3,"end":12,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":12}}, "left": { "type": "StringLiteral", - "start": 3, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":3,"end":6,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":6}}, "extra": { "rawValue": "x", "raw": "\"x\"" @@ -111,18 +34,7 @@ "operator": "+", "right": { "type": "StringLiteral", - "start": 9, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":9,"end":12,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":12}}, "extra": { "rawValue": "y", "raw": "\"y\"" @@ -133,18 +45,7 @@ "shorthand": false, "value": { "type": "NumericLiteral", - "start": 15, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":15,"end":17,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":17}}, "extra": { "rawValue": 10, "raw": "10" diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/143/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/143/output.json index d52f3bfa4c5a..a524c0e5932f 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/143/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/143/output.json @@ -1,129 +1,40 @@ { "type": "File", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "program": { "type": "Program", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "expression": { "type": "ObjectExpression", - "start": 1, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":1,"end":21,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":21}}, "properties": [ { "type": "ObjectProperty", - "start": 2, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":2,"end":20,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":20}}, "method": false, "computed": true, "key": { "type": "Identifier", - "start": 3, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 4 - }, - "identifierName": "x" - }, + "start":3,"end":4,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":4},"identifierName":"x"}, "name": "x" }, "shorthand": false, "value": { "type": "FunctionExpression", - "start": 7, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":7,"end":20,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":20}}, "id": null, "generator": false, "async": false, "params": [], "body": { "type": "BlockStatement", - "start": 18, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":18,"end":20,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":20}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/144/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/144/output.json index 1d76139cb920..1806c83539e0 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/144/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/144/output.json @@ -1,111 +1,33 @@ { "type": "File", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, "program": { "type": "Program", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, "expression": { "type": "ObjectExpression", - "start": 1, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":1,"end":17,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":17}}, "properties": [ { "type": "ObjectProperty", - "start": 2, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":2,"end":9,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":9}}, "method": false, "computed": true, "key": { "type": "Identifier", - "start": 3, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 4 - }, - "identifierName": "x" - }, + "start":3,"end":4,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":4},"identifierName":"x"}, "name": "x" }, "shorthand": false, "value": { "type": "NumericLiteral", - "start": 7, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":7,"end":9,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":9}}, "extra": { "rawValue": 10, "raw": "10" @@ -115,52 +37,18 @@ }, { "type": "ObjectProperty", - "start": 11, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":11,"end":16,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":16}}, "method": false, "key": { "type": "Identifier", - "start": 11, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "y" - }, + "start":11,"end":12,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":12},"identifierName":"y"}, "name": "y" }, "computed": false, "shorthand": false, "value": { "type": "NumericLiteral", - "start": 14, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":14,"end":16,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":16}}, "extra": { "rawValue": 20, "raw": "20" diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/145/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/145/output.json index df2977284680..6c28b86b54e9 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/145/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/145/output.json @@ -1,93 +1,26 @@ { "type": "File", - "start": 0, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, "program": { "type": "Program", - "start": 0, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, "expression": { "type": "ObjectExpression", - "start": 1, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":1,"end":30,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":30}}, "properties": [ { "type": "ObjectMethod", - "start": 2, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":2,"end":14,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":14}}, "method": false, "key": { "type": "Identifier", - "start": 7, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - }, - "identifierName": "x" - }, + "start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8},"identifierName":"x"}, "name": "x" }, "computed": true, @@ -98,52 +31,18 @@ "params": [], "body": { "type": "BlockStatement", - "start": 12, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":12,"end":14,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":14}}, "body": [], "directives": [] } }, { "type": "ObjectMethod", - "start": 16, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":16,"end":29,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":29}}, "method": false, "key": { "type": "Identifier", - "start": 21, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 22 - }, - "identifierName": "x" - }, + "start":21,"end":22,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":22},"identifierName":"x"}, "name": "x" }, "computed": true, @@ -154,36 +53,13 @@ "params": [ { "type": "Identifier", - "start": 24, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 25 - }, - "identifierName": "v" - }, + "start":24,"end":25,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":25},"identifierName":"v"}, "name": "v" } ], "body": { "type": "BlockStatement", - "start": 27, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":27,"end":29,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":29}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/146/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/146/output.json index 7b3e26462d3e..ee51fe8a0298 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/146/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/146/output.json @@ -1,94 +1,27 @@ { "type": "File", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, "program": { "type": "Program", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, "expression": { "type": "ObjectExpression", - "start": 1, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":1,"end":11,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":11}}, "properties": [ { "type": "ObjectMethod", - "start": 2, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":2,"end":10,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":10}}, "method": true, "computed": true, "key": { "type": "Identifier", - "start": 3, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 4 - }, - "identifierName": "x" - }, + "start":3,"end":4,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":4},"identifierName":"x"}, "name": "x" }, "kind": "method", @@ -98,18 +31,7 @@ "params": [], "body": { "type": "BlockStatement", - "start": 8, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":8,"end":10,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":10}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/147/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/147/output.json index 7a5ceef8c8df..5fce016d67af 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/147/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/147/output.json @@ -1,127 +1,37 @@ { "type": "File", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, "program": { "type": "Program", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":4,"end":18,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":18}}, "id": { "type": "ObjectPattern", - "start": 4, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":4,"end":12,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":12}}, "properties": [ { "type": "ObjectProperty", - "start": 5, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":5,"end":11,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":11}}, "method": false, "computed": true, "key": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "x" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"x"}, "name": "x" }, "shorthand": false, "value": { "type": "Identifier", - "start": 10, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "y" - }, + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11},"identifierName":"y"}, "name": "y" } } @@ -129,68 +39,22 @@ }, "init": { "type": "ObjectExpression", - "start": 15, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":15,"end":18,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":18}}, "properties": [ { "type": "ObjectProperty", - "start": 16, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":16,"end":17,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":17}}, "method": false, "key": { "type": "Identifier", - "start": 16, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - }, - "identifierName": "y" - }, + "start":16,"end":17,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":17},"identifierName":"y"}, "name": "y" }, "computed": false, "shorthand": true, "value": { "type": "Identifier", - "start": 16, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - }, - "identifierName": "y" - }, + "start":16,"end":17,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":17},"identifierName":"y"}, "name": "y" }, "extra": { diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/148/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/148/output.json index 59be505f04fd..6f72333a547c 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/148/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/148/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "program": { "type": "Program", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "id": { "type": "Identifier", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - }, - "identifierName": "f" - }, + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"f"}, "name": "f" }, "generator": false, @@ -65,68 +20,22 @@ "params": [ { "type": "ObjectPattern", - "start": 11, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":11,"end":19,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":19}}, "properties": [ { "type": "ObjectProperty", - "start": 12, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":12,"end":18,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":18}}, "method": false, "computed": true, "key": { "type": "Identifier", - "start": 13, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - }, - "identifierName": "x" - }, + "start":13,"end":14,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":14},"identifierName":"x"}, "name": "x" }, "shorthand": false, "value": { "type": "Identifier", - "start": 17, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - }, - "identifierName": "y" - }, + "start":17,"end":18,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":18},"identifierName":"y"}, "name": "y" } } @@ -135,18 +44,7 @@ ], "body": { "type": "BlockStatement", - "start": 21, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":21,"end":23,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":23}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/149/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/149/output.json index b54c65ada22c..6db491d5acf7 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/149/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/149/output.json @@ -1,126 +1,36 @@ { "type": "File", - "start": 0, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, "program": { "type": "Program", - "start": 0, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":4,"end":33,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":33}}, "id": { "type": "Identifier", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "x" - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"x"}, "name": "x" }, "init": { "type": "ObjectExpression", - "start": 8, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":8,"end":33,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":33}}, "properties": [ { "type": "ObjectMethod", - "start": 9, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":9,"end":32,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":32}}, "method": true, "computed": true, "key": { "type": "Identifier", - "start": 11, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 15 - }, - "identifierName": "test" - }, + "start":11,"end":15,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":15},"identifierName":"test"}, "name": "test" }, "kind": "method", @@ -130,63 +40,18 @@ "params": [], "body": { "type": "BlockStatement", - "start": 19, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":19,"end":32,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":32}}, "body": [ { "type": "ExpressionStatement", - "start": 21, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":21,"end":30,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":30}}, "expression": { "type": "YieldExpression", - "start": 21, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":21,"end":29,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":29}}, "delegate": true, "argument": { "type": "Identifier", - "start": 28, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 29 - }, - "identifierName": "v" - }, + "start":28,"end":29,"loc":{"start":{"line":1,"column":28},"end":{"line":1,"column":29},"identifierName":"v"}, "name": "v" } } diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/15/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/15/output.json index 33bb1b2a0ac0..c0f3390f5c0c 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/15/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/15/output.json @@ -1,62 +1,18 @@ { "type": "File", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, "program": { "type": "Program", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, "expression": { "type": "NumericLiteral", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, "extra": { "rawValue": 0, "raw": "0B0" diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/150/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/150/output.json index d7a927cede6a..58d5bb9a8ba4 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/150/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/150/output.json @@ -1,112 +1,33 @@ { "type": "File", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, "program": { "type": "Program", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, "id": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "A" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, "name": "A" }, "superClass": null, "body": { "type": "ClassBody", - "start": 8, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":8,"end":18,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":18}}, "body": [ { "type": "ClassMethod", - "start": 9, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":9,"end":17,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":17}}, "static": false, "computed": true, "key": { "type": "Identifier", - "start": 10, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "x" - }, + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11},"identifierName":"x"}, "name": "x" }, "kind": "method", @@ -116,18 +37,7 @@ "params": [], "body": { "type": "BlockStatement", - "start": 15, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":15,"end":17,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":17}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/152/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/152/output.json index 96cf9360b24c..9466f0d309b4 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/152/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/152/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "program": { "type": "Program", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "id": { "type": "Identifier", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - }, - "identifierName": "f" - }, + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"f"}, "name": "f" }, "generator": false, @@ -65,81 +20,25 @@ "params": [ { "type": "AssignmentPattern", - "start": 11, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":11,"end":20,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":20}}, "left": { "type": "ArrayPattern", - "start": 11, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":11,"end":14,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":14}}, "elements": [ { "type": "Identifier", - "start": 12, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - }, - "identifierName": "x" - }, + "start":12,"end":13,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":13},"identifierName":"x"}, "name": "x" } ] }, "right": { "type": "ArrayExpression", - "start": 17, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":17,"end":20,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":20}}, "elements": [ { "type": "NumericLiteral", - "start": 18, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":18,"end":19,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":19}}, "extra": { "rawValue": 1, "raw": "1" @@ -152,18 +51,7 @@ ], "body": { "type": "BlockStatement", - "start": 22, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":22,"end":24,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":24}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/153/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/153/output.json index 60c6b34a6676..9bf1d8cfb2b3 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/153/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/153/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, "program": { "type": "Program", - "start": 0, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, "id": { "type": "Identifier", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - }, - "identifierName": "f" - }, + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"f"}, "name": "f" }, "generator": false, @@ -65,82 +20,25 @@ "params": [ { "type": "AssignmentPattern", - "start": 11, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":11,"end":24,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":24}}, "left": { "type": "ObjectPattern", - "start": 11, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":11,"end":14,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":14}}, "properties": [ { "type": "ObjectProperty", - "start": 12, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":12,"end":13,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":13}}, "method": false, "key": { "type": "Identifier", - "start": 12, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - }, - "identifierName": "x" - }, + "start":12,"end":13,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":13},"identifierName":"x"}, "name": "x" }, "computed": false, "shorthand": true, "value": { "type": "Identifier", - "start": 12, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - }, - "identifierName": "x" - }, + "start":12,"end":13,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":13},"identifierName":"x"}, "name": "x" }, "extra": { @@ -151,67 +49,22 @@ }, "right": { "type": "ObjectExpression", - "start": 17, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":17,"end":24,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":24}}, "properties": [ { "type": "ObjectProperty", - "start": 18, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":18,"end":23,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":23}}, "method": false, "key": { "type": "Identifier", - "start": 18, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - }, - "identifierName": "x" - }, + "start":18,"end":19,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":19},"identifierName":"x"}, "name": "x" }, "computed": false, "shorthand": false, "value": { "type": "NumericLiteral", - "start": 21, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":21,"end":23,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":23}}, "extra": { "rawValue": 10, "raw": "10" @@ -225,18 +78,7 @@ ], "body": { "type": "BlockStatement", - "start": 26, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":26,"end":28,"loc":{"start":{"line":1,"column":26},"end":{"line":1,"column":28}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/154/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/154/output.json index c7da2eed48b1..a640ee0536bc 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/154/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/154/output.json @@ -1,176 +1,52 @@ { "type": "File", - "start": 0, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, "program": { "type": "Program", - "start": 0, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, "expression": { "type": "AssignmentExpression", - "start": 0, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, "operator": "=", "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "f" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"f"}, "name": "f" }, "right": { "type": "FunctionExpression", - "start": 4, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":4,"end":30,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":30}}, "id": null, "generator": false, "async": false, "params": [ { "type": "AssignmentPattern", - "start": 13, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":13,"end":26,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":26}}, "left": { "type": "ObjectPattern", - "start": 13, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":13,"end":16,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":16}}, "properties": [ { "type": "ObjectProperty", - "start": 14, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":14,"end":15,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":15}}, "method": false, "key": { "type": "Identifier", - "start": 14, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - }, - "identifierName": "x" - }, + "start":14,"end":15,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":15},"identifierName":"x"}, "name": "x" }, "computed": false, "shorthand": true, "value": { "type": "Identifier", - "start": 14, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - }, - "identifierName": "x" - }, + "start":14,"end":15,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":15},"identifierName":"x"}, "name": "x" }, "extra": { @@ -181,67 +57,22 @@ }, "right": { "type": "ObjectExpression", - "start": 19, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":19,"end":26,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":26}}, "properties": [ { "type": "ObjectProperty", - "start": 20, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":20,"end":25,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":25}}, "method": false, "key": { "type": "Identifier", - "start": 20, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 21 - }, - "identifierName": "x" - }, + "start":20,"end":21,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":21},"identifierName":"x"}, "name": "x" }, "computed": false, "shorthand": false, "value": { "type": "NumericLiteral", - "start": 23, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":23,"end":25,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":25}}, "extra": { "rawValue": 10, "raw": "10" @@ -255,18 +86,7 @@ ], "body": { "type": "BlockStatement", - "start": 28, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":28,"end":30,"loc":{"start":{"line":1,"column":28},"end":{"line":1,"column":30}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/155/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/155/output.json index 2154870b9e4b..cf8edbb06db9 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/155/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/155/output.json @@ -1,193 +1,58 @@ { "type": "File", - "start": 0, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, "program": { "type": "Program", - "start": 0, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, "expression": { "type": "ObjectExpression", - "start": 1, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":1,"end":32,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":32}}, "properties": [ { "type": "ObjectProperty", - "start": 2, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":2,"end":31,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":31}}, "method": false, "key": { "type": "Identifier", - "start": 2, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 3 - }, - "identifierName": "f" - }, + "start":2,"end":3,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":3},"identifierName":"f"}, "name": "f" }, "computed": false, "shorthand": false, "value": { "type": "FunctionExpression", - "start": 5, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":5,"end":31,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":31}}, "id": null, "generator": false, "async": false, "params": [ { "type": "AssignmentPattern", - "start": 14, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":14,"end":27,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":27}}, "left": { "type": "ObjectPattern", - "start": 14, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":14,"end":17,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":17}}, "properties": [ { "type": "ObjectProperty", - "start": 15, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":15,"end":16,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":16}}, "method": false, "key": { "type": "Identifier", - "start": 15, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - }, - "identifierName": "x" - }, + "start":15,"end":16,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":16},"identifierName":"x"}, "name": "x" }, "computed": false, "shorthand": true, "value": { "type": "Identifier", - "start": 15, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - }, - "identifierName": "x" - }, + "start":15,"end":16,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":16},"identifierName":"x"}, "name": "x" }, "extra": { @@ -198,67 +63,22 @@ }, "right": { "type": "ObjectExpression", - "start": 20, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":20,"end":27,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":27}}, "properties": [ { "type": "ObjectProperty", - "start": 21, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":21,"end":26,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":26}}, "method": false, "key": { "type": "Identifier", - "start": 21, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 22 - }, - "identifierName": "x" - }, + "start":21,"end":22,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":22},"identifierName":"x"}, "name": "x" }, "computed": false, "shorthand": false, "value": { "type": "NumericLiteral", - "start": 24, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":24,"end":26,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":26}}, "extra": { "rawValue": 10, "raw": "10" @@ -272,18 +92,7 @@ ], "body": { "type": "BlockStatement", - "start": 29, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":29,"end":31,"loc":{"start":{"line":1,"column":29},"end":{"line":1,"column":31}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/156/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/156/output.json index 57250abd107f..292d5f06f2a6 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/156/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/156/output.json @@ -1,93 +1,26 @@ { "type": "File", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "program": { "type": "Program", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "expression": { "type": "ObjectExpression", - "start": 1, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":1,"end":22,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":22}}, "properties": [ { "type": "ObjectMethod", - "start": 2, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":2,"end":21,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":21}}, "method": true, "key": { "type": "Identifier", - "start": 2, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 3 - }, - "identifierName": "f" - }, + "start":2,"end":3,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":3},"identifierName":"f"}, "name": "f" }, "computed": false, @@ -98,82 +31,25 @@ "params": [ { "type": "AssignmentPattern", - "start": 4, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":4,"end":17,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":17}}, "left": { "type": "ObjectPattern", - "start": 4, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":4,"end":7,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":7}}, "properties": [ { "type": "ObjectProperty", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, "method": false, "key": { "type": "Identifier", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "x" - }, + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"x"}, "name": "x" }, "computed": false, "shorthand": true, "value": { "type": "Identifier", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "x" - }, + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"x"}, "name": "x" }, "extra": { @@ -184,67 +60,22 @@ }, "right": { "type": "ObjectExpression", - "start": 10, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":10,"end":17,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":17}}, "properties": [ { "type": "ObjectProperty", - "start": 11, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":11,"end":16,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":16}}, "method": false, "key": { "type": "Identifier", - "start": 11, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "x" - }, + "start":11,"end":12,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":12},"identifierName":"x"}, "name": "x" }, "computed": false, "shorthand": false, "value": { "type": "NumericLiteral", - "start": 14, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":14,"end":16,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":16}}, "extra": { "rawValue": 10, "raw": "10" @@ -258,18 +89,7 @@ ], "body": { "type": "BlockStatement", - "start": 19, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":19,"end":21,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":21}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/157/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/157/output.json index 475447096899..ce79c1d30a3a 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/157/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/157/output.json @@ -1,109 +1,31 @@ { "type": "File", - "start": 0, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, "program": { "type": "Program", - "start": 0, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, "expression": { "type": "ClassExpression", - "start": 1, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":1,"end":28,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":28}}, "id": null, "superClass": null, "body": { "type": "ClassBody", - "start": 7, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":7,"end":28,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":28}}, "body": [ { "type": "ClassMethod", - "start": 8, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":8,"end":27,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":27}}, "static": false, "key": { "type": "Identifier", - "start": 8, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "f" - }, + "start":8,"end":9,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":9},"identifierName":"f"}, "name": "f" }, "computed": false, @@ -114,82 +36,25 @@ "params": [ { "type": "AssignmentPattern", - "start": 10, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":10,"end":23,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":23}}, "left": { "type": "ObjectPattern", - "start": 10, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":10,"end":13,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":13}}, "properties": [ { "type": "ObjectProperty", - "start": 11, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":11,"end":12,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":12}}, "method": false, "key": { "type": "Identifier", - "start": 11, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "x" - }, + "start":11,"end":12,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":12},"identifierName":"x"}, "name": "x" }, "computed": false, "shorthand": true, "value": { "type": "Identifier", - "start": 11, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "x" - }, + "start":11,"end":12,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":12},"identifierName":"x"}, "name": "x" }, "extra": { @@ -200,67 +65,22 @@ }, "right": { "type": "ObjectExpression", - "start": 16, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":16,"end":23,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":23}}, "properties": [ { "type": "ObjectProperty", - "start": 17, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":17,"end":22,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":22}}, "method": false, "key": { "type": "Identifier", - "start": 17, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - }, - "identifierName": "x" - }, + "start":17,"end":18,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":18},"identifierName":"x"}, "name": "x" }, "computed": false, "shorthand": false, "value": { "type": "NumericLiteral", - "start": 20, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":20,"end":22,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":22}}, "extra": { "rawValue": 10, "raw": "10" @@ -274,18 +94,7 @@ ], "body": { "type": "BlockStatement", - "start": 25, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":25,"end":27,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":27}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/158/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/158/output.json index 60d196d4787d..38adf7077246 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/158/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/158/output.json @@ -1,144 +1,43 @@ { "type": "File", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "program": { "type": "Program", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "expression": { "type": "ArrowFunctionExpression", - "start": 1, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":1,"end":22,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":22}}, "id": null, "generator": false, "async": false, "params": [ { "type": "AssignmentPattern", - "start": 2, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":2,"end":15,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":15}}, "left": { "type": "ObjectPattern", - "start": 2, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":2,"end":5,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":5}}, "properties": [ { "type": "ObjectProperty", - "start": 3, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 4 - } - }, + "start":3,"end":4,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":4}}, "method": false, "key": { "type": "Identifier", - "start": 3, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 4 - }, - "identifierName": "x" - }, + "start":3,"end":4,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":4},"identifierName":"x"}, "name": "x" }, "computed": false, "shorthand": true, "value": { "type": "Identifier", - "start": 3, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 4 - }, - "identifierName": "x" - }, + "start":3,"end":4,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":4},"identifierName":"x"}, "name": "x" }, "extra": { @@ -149,67 +48,22 @@ }, "right": { "type": "ObjectExpression", - "start": 8, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":8,"end":15,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":15}}, "properties": [ { "type": "ObjectProperty", - "start": 9, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":9,"end":14,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":14}}, "method": false, "key": { "type": "Identifier", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - }, - "identifierName": "x" - }, + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"x"}, "name": "x" }, "computed": false, "shorthand": false, "value": { "type": "NumericLiteral", - "start": 12, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":12,"end":14,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":14}}, "extra": { "rawValue": 10, "raw": "10" @@ -223,18 +77,7 @@ ], "body": { "type": "BlockStatement", - "start": 20, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":20,"end":22,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":22}}, "body": [], "directives": [] }, diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/159/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/159/output.json index 14f737f82bca..9f560c227fa0 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/159/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/159/output.json @@ -1,143 +1,42 @@ { "type": "File", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "program": { "type": "Program", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "expression": { "type": "AssignmentExpression", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "operator": "=", "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "right": { "type": "FunctionExpression", - "start": 4, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":4,"end":22,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":22}}, "id": null, "generator": false, "async": false, "params": [ { "type": "AssignmentPattern", - "start": 13, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":13,"end":18,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":18}}, "left": { "type": "Identifier", - "start": 13, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - }, - "identifierName": "y" - }, + "start":13,"end":14,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":14},"identifierName":"y"}, "name": "y" }, "right": { "type": "NumericLiteral", - "start": 17, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":17,"end":18,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":18}}, "extra": { "rawValue": 1, "raw": "1" @@ -148,18 +47,7 @@ ], "body": { "type": "BlockStatement", - "start": 20, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":20,"end":22,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":22}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/16/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/16/output.json index 39761f3e94b0..cba05164a592 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/16/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/16/output.json @@ -1,62 +1,18 @@ { "type": "File", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, "program": { "type": "Program", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, "expression": { "type": "NumericLiteral", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, "extra": { "rawValue": 1, "raw": "0B1" diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/160/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/160/output.json index bd6597aab1ca..4e22aa2182c6 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/160/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/160/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, "program": { "type": "Program", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, "id": { "type": "Identifier", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - }, - "identifierName": "f" - }, + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"f"}, "name": "f" }, "generator": false, @@ -65,49 +20,15 @@ "params": [ { "type": "AssignmentPattern", - "start": 11, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":11,"end":16,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":16}}, "left": { "type": "Identifier", - "start": 11, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "a" - }, + "start":11,"end":12,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":12},"identifierName":"a"}, "name": "a" }, "right": { "type": "NumericLiteral", - "start": 15, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":15,"end":16,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":16}}, "extra": { "rawValue": 1, "raw": "1" @@ -118,18 +39,7 @@ ], "body": { "type": "BlockStatement", - "start": 18, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":18,"end":20,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":20}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/161/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/161/output.json index 9f5973150fa8..ecbb4f3fafe7 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/161/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/161/output.json @@ -1,192 +1,57 @@ { "type": "File", - "start": 0, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, "program": { "type": "Program", - "start": 0, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, "expression": { "type": "AssignmentExpression", - "start": 0, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, "operator": "=", "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "right": { "type": "ObjectExpression", - "start": 4, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":4,"end":27,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":27}}, "properties": [ { "type": "ObjectProperty", - "start": 6, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":6,"end":25,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":25}}, "method": false, "key": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "f" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"f"}, "name": "f" }, "computed": false, "shorthand": false, "value": { "type": "FunctionExpression", - "start": 9, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":9,"end":25,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":25}}, "id": null, "generator": false, "async": false, "params": [ { "type": "AssignmentPattern", - "start": 18, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":18,"end":21,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":21}}, "left": { "type": "Identifier", - "start": 18, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - }, - "identifierName": "a" - }, + "start":18,"end":19,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":19},"identifierName":"a"}, "name": "a" }, "right": { "type": "NumericLiteral", - "start": 20, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":20,"end":21,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":21}}, "extra": { "rawValue": 1, "raw": "1" @@ -197,18 +62,7 @@ ], "body": { "type": "BlockStatement", - "start": 23, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":23,"end":25,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":25}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/162/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/162/output.json index 7c18539ce443..f761e901a6c0 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/162/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/162/output.json @@ -1,125 +1,35 @@ { "type": "File", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "program": { "type": "Program", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "expression": { "type": "AssignmentExpression", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "operator": "=", "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "right": { "type": "ObjectExpression", - "start": 4, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":4,"end":17,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":17}}, "properties": [ { "type": "ObjectMethod", - "start": 6, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":6,"end":15,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":15}}, "method": true, "key": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "f" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"f"}, "name": "f" }, "computed": false, @@ -130,49 +40,15 @@ "params": [ { "type": "AssignmentPattern", - "start": 8, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":8,"end":11,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":11}}, "left": { "type": "Identifier", - "start": 8, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "a" - }, + "start":8,"end":9,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":9},"identifierName":"a"}, "name": "a" }, "right": { "type": "NumericLiteral", - "start": 10, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11}}, "extra": { "rawValue": 1, "raw": "1" @@ -183,18 +59,7 @@ ], "body": { "type": "BlockStatement", - "start": 13, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":13,"end":15,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":15}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/163/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/163/output.json index 6d5be9476898..572ab04a242e 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/163/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/163/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "program": { "type": "Program", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "id": { "type": "Identifier", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - }, - "identifierName": "f" - }, + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"f"}, "name": "f" }, "generator": false, @@ -65,68 +20,22 @@ "params": [ { "type": "Identifier", - "start": 11, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "a" - }, + "start":11,"end":12,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":12},"identifierName":"a"}, "name": "a" }, { "type": "RestElement", - "start": 14, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":14,"end":18,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":18}}, "argument": { "type": "Identifier", - "start": 17, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - }, - "identifierName": "b" - }, + "start":17,"end":18,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":18},"identifierName":"b"}, "name": "b" } } ], "body": { "type": "BlockStatement", - "start": 20, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":20,"end":22,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":22}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/164/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/164/output.json index b53938a9d755..e598fc11e12a 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/164/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/164/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "program": { "type": "Program", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "id": { "type": "Identifier", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - }, - "identifierName": "x" - }, + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"x"}, "name": "x" }, "generator": false, @@ -65,51 +20,16 @@ "params": [ { "type": "ArrayPattern", - "start": 11, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":11,"end":19,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":19}}, "elements": [ { "type": "Identifier", - "start": 13, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - }, - "identifierName": "a" - }, + "start":13,"end":14,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":14},"identifierName":"a"}, "name": "a" }, { "type": "Identifier", - "start": 16, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - }, - "identifierName": "b" - }, + "start":16,"end":17,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":17},"identifierName":"b"}, "name": "b" } ] @@ -117,18 +37,7 @@ ], "body": { "type": "BlockStatement", - "start": 20, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":20,"end":22,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":22}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/165/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/165/output.json index 8e8029853734..b6aadc9694af 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/165/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/165/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "program": { "type": "Program", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "id": { "type": "Identifier", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - }, - "identifierName": "x" - }, + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"x"}, "name": "x" }, "generator": false, @@ -65,68 +20,22 @@ "params": [ { "type": "ObjectPattern", - "start": 11, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":11,"end":19,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":19}}, "properties": [ { "type": "ObjectProperty", - "start": 13, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":13,"end":14,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":14}}, "method": false, "key": { "type": "Identifier", - "start": 13, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - }, - "identifierName": "a" - }, + "start":13,"end":14,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":14},"identifierName":"a"}, "name": "a" }, "computed": false, "shorthand": true, "value": { "type": "Identifier", - "start": 13, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - }, - "identifierName": "a" - }, + "start":13,"end":14,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":14},"identifierName":"a"}, "name": "a" }, "extra": { @@ -135,53 +44,18 @@ }, { "type": "ObjectProperty", - "start": 16, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":16,"end":17,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":17}}, "method": false, "key": { "type": "Identifier", - "start": 16, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - }, - "identifierName": "b" - }, + "start":16,"end":17,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":17},"identifierName":"b"}, "name": "b" }, "computed": false, "shorthand": true, "value": { "type": "Identifier", - "start": 16, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - }, - "identifierName": "b" - }, + "start":16,"end":17,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":17},"identifierName":"b"}, "name": "b" }, "extra": { @@ -193,18 +67,7 @@ ], "body": { "type": "BlockStatement", - "start": 20, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":20,"end":22,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":22}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/166/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/166/options.json deleted file mode 100644 index 3481bedf3cc1..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/166/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Argument name clash (1:16)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/166/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/166/output.json new file mode 100644 index 000000000000..e1a64571a1b8 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/166/output.json @@ -0,0 +1,66 @@ +{ + "type": "File", + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, + "errors": [ + "SyntaxError: Argument name clash (1:16)" + ], + "program": { + "type": "Program", + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, + "id": { + "type": "Identifier", + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"x"}, + "name": "x" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start":11,"end":12,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":12},"identifierName":"a"}, + "name": "a" + }, + { + "type": "ObjectPattern", + "start":14,"end":19,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":19}}, + "properties": [ + { + "type": "ObjectProperty", + "start":16,"end":17,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":17}}, + "method": false, + "key": { + "type": "Identifier", + "start":16,"end":17,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":17},"identifierName":"a"}, + "name": "a" + }, + "computed": false, + "shorthand": true, + "value": { + "type": "Identifier", + "start":16,"end":17,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":17},"identifierName":"a"}, + "name": "a" + }, + "extra": { + "shorthand": true + } + } + ] + } + ], + "body": { + "type": "BlockStatement", + "start":20,"end":22,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":22}}, + "body": [], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/167/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/167/output.json index 593610a3989c..3432decb8b3f 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/167/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/167/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, "program": { "type": "Program", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, "id": { "type": "Identifier", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - }, - "identifierName": "x" - }, + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"x"}, "name": "x" }, "generator": false, @@ -65,65 +20,19 @@ "params": [ { "type": "RestElement", - "start": 11, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":11,"end":22,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":22}}, "argument": { "type": "ArrayPattern", - "start": 14, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":14,"end":22,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":22}}, "elements": [ { "type": "Identifier", - "start": 16, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - }, - "identifierName": "a" - }, + "start":16,"end":17,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":17},"identifierName":"a"}, "name": "a" }, { "type": "Identifier", - "start": 19, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 20 - }, - "identifierName": "b" - }, + "start":19,"end":20,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":20},"identifierName":"b"}, "name": "b" } ] @@ -132,18 +41,7 @@ ], "body": { "type": "BlockStatement", - "start": 23, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":23,"end":25,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":25}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/168/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/168/output.json index fe88d43c2a5c..7e2ba23e766c 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/168/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/168/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 54, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 54 - } - }, + "start":0,"end":54,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":54}}, "program": { "type": "Program", - "start": 0, - "end": 54, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 54 - } - }, + "start":0,"end":54,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":54}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 54, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 54 - } - }, + "start":0,"end":54,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":54}}, "id": { "type": "Identifier", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - }, - "identifierName": "x" - }, + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"x"}, "name": "x" }, "generator": false, @@ -65,117 +20,37 @@ "params": [ { "type": "ObjectPattern", - "start": 11, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 37 - } - }, + "start":11,"end":37,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":37}}, "properties": [ { "type": "ObjectProperty", - "start": 13, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":13,"end":24,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":24}}, "method": false, "key": { "type": "Identifier", - "start": 13, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - }, - "identifierName": "a" - }, + "start":13,"end":14,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":14},"identifierName":"a"}, "name": "a" }, "computed": false, "shorthand": false, "value": { "type": "ObjectPattern", - "start": 16, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":16,"end":24,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":24}}, "properties": [ { "type": "ObjectProperty", - "start": 18, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":18,"end":19,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":19}}, "method": false, "key": { "type": "Identifier", - "start": 18, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - }, - "identifierName": "w" - }, + "start":18,"end":19,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":19},"identifierName":"w"}, "name": "w" }, "computed": false, "shorthand": true, "value": { "type": "Identifier", - "start": 18, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - }, - "identifierName": "w" - }, + "start":18,"end":19,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":19},"identifierName":"w"}, "name": "w" }, "extra": { @@ -184,53 +59,18 @@ }, { "type": "ObjectProperty", - "start": 21, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":21,"end":22,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":22}}, "method": false, "key": { "type": "Identifier", - "start": 21, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 22 - }, - "identifierName": "x" - }, + "start":21,"end":22,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":22},"identifierName":"x"}, "name": "x" }, "computed": false, "shorthand": true, "value": { "type": "Identifier", - "start": 21, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 22 - }, - "identifierName": "x" - }, + "start":21,"end":22,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":22},"identifierName":"x"}, "name": "x" }, "extra": { @@ -242,85 +82,27 @@ }, { "type": "ObjectProperty", - "start": 26, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":26,"end":35,"loc":{"start":{"line":1,"column":26},"end":{"line":1,"column":35}}, "method": false, "key": { "type": "Identifier", - "start": 26, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 27 - }, - "identifierName": "b" - }, + "start":26,"end":27,"loc":{"start":{"line":1,"column":26},"end":{"line":1,"column":27},"identifierName":"b"}, "name": "b" }, "computed": false, "shorthand": false, "value": { "type": "ArrayPattern", - "start": 29, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":29,"end":35,"loc":{"start":{"line":1,"column":29},"end":{"line":1,"column":35}}, "elements": [ { "type": "Identifier", - "start": 30, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 1, - "column": 31 - }, - "identifierName": "y" - }, + "start":30,"end":31,"loc":{"start":{"line":1,"column":30},"end":{"line":1,"column":31},"identifierName":"y"}, "name": "y" }, { "type": "Identifier", - "start": 33, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 33 - }, - "end": { - "line": 1, - "column": 34 - }, - "identifierName": "z" - }, + "start":33,"end":34,"loc":{"start":{"line":1,"column":33},"end":{"line":1,"column":34},"identifierName":"z"}, "name": "z" } ] @@ -330,82 +112,24 @@ }, { "type": "RestElement", - "start": 39, - "end": 51, - "loc": { - "start": { - "line": 1, - "column": 39 - }, - "end": { - "line": 1, - "column": 51 - } - }, + "start":39,"end":51,"loc":{"start":{"line":1,"column":39},"end":{"line":1,"column":51}}, "argument": { "type": "ArrayPattern", - "start": 42, - "end": 51, - "loc": { - "start": { - "line": 1, - "column": 42 - }, - "end": { - "line": 1, - "column": 51 - } - }, + "start":42,"end":51,"loc":{"start":{"line":1,"column":42},"end":{"line":1,"column":51}}, "elements": [ { "type": "Identifier", - "start": 43, - "end": 44, - "loc": { - "start": { - "line": 1, - "column": 43 - }, - "end": { - "line": 1, - "column": 44 - }, - "identifierName": "a" - }, + "start":43,"end":44,"loc":{"start":{"line":1,"column":43},"end":{"line":1,"column":44},"identifierName":"a"}, "name": "a" }, { "type": "Identifier", - "start": 46, - "end": 47, - "loc": { - "start": { - "line": 1, - "column": 46 - }, - "end": { - "line": 1, - "column": 47 - }, - "identifierName": "b" - }, + "start":46,"end":47,"loc":{"start":{"line":1,"column":46},"end":{"line":1,"column":47},"identifierName":"b"}, "name": "b" }, { "type": "Identifier", - "start": 49, - "end": 50, - "loc": { - "start": { - "line": 1, - "column": 49 - }, - "end": { - "line": 1, - "column": 50 - }, - "identifierName": "c" - }, + "start":49,"end":50,"loc":{"start":{"line":1,"column":49},"end":{"line":1,"column":50},"identifierName":"c"}, "name": "c" } ] @@ -414,18 +138,7 @@ ], "body": { "type": "BlockStatement", - "start": 52, - "end": 54, - "loc": { - "start": { - "line": 1, - "column": 52 - }, - "end": { - "line": 1, - "column": 54 - } - }, + "start":52,"end":54,"loc":{"start":{"line":1,"column":52},"end":{"line":1,"column":54}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/169/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/169/output.json index c7d49e9dc570..23d5c7769942 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/169/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/169/output.json @@ -1,77 +1,21 @@ { "type": "File", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "program": { "type": "Program", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "expression": { "type": "FunctionExpression", - "start": 1, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":1,"end":23,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":23}}, "id": { "type": "Identifier", - "start": 10, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "x" - }, + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11},"identifierName":"x"}, "name": "x" }, "generator": false, @@ -79,51 +23,16 @@ "params": [ { "type": "ArrayPattern", - "start": 12, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":12,"end":20,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":20}}, "elements": [ { "type": "Identifier", - "start": 14, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - }, - "identifierName": "a" - }, + "start":14,"end":15,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":15},"identifierName":"a"}, "name": "a" }, { "type": "Identifier", - "start": 17, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - }, - "identifierName": "b" - }, + "start":17,"end":18,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":18},"identifierName":"b"}, "name": "b" } ] @@ -131,18 +40,7 @@ ], "body": { "type": "BlockStatement", - "start": 21, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":21,"end":23,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":23}}, "body": [], "directives": [] }, diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/17/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/17/output.json index ea337678ef18..db98ac55e253 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/17/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/17/output.json @@ -1,62 +1,18 @@ { "type": "File", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - }, + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, "program": { "type": "Program", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - }, + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - }, + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, "expression": { "type": "NumericLiteral", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - }, + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, "extra": { "rawValue": 2, "raw": "0B10" diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/170/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/170/output.json index 55a821f84297..4f0552859713 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/170/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/170/output.json @@ -1,77 +1,21 @@ { "type": "File", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "program": { "type": "Program", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "expression": { "type": "FunctionExpression", - "start": 1, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":1,"end":23,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":23}}, "id": { "type": "Identifier", - "start": 10, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "x" - }, + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11},"identifierName":"x"}, "name": "x" }, "generator": false, @@ -79,68 +23,22 @@ "params": [ { "type": "ObjectPattern", - "start": 12, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":12,"end":20,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":20}}, "properties": [ { "type": "ObjectProperty", - "start": 14, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":14,"end":15,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":15}}, "method": false, "key": { "type": "Identifier", - "start": 14, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - }, - "identifierName": "a" - }, + "start":14,"end":15,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":15},"identifierName":"a"}, "name": "a" }, "computed": false, "shorthand": true, "value": { "type": "Identifier", - "start": 14, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - }, - "identifierName": "a" - }, + "start":14,"end":15,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":15},"identifierName":"a"}, "name": "a" }, "extra": { @@ -149,53 +47,18 @@ }, { "type": "ObjectProperty", - "start": 17, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":17,"end":18,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":18}}, "method": false, "key": { "type": "Identifier", - "start": 17, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - }, - "identifierName": "b" - }, + "start":17,"end":18,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":18},"identifierName":"b"}, "name": "b" }, "computed": false, "shorthand": true, "value": { "type": "Identifier", - "start": 17, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - }, - "identifierName": "b" - }, + "start":17,"end":18,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":18},"identifierName":"b"}, "name": "b" }, "extra": { @@ -207,18 +70,7 @@ ], "body": { "type": "BlockStatement", - "start": 21, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":21,"end":23,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":23}}, "body": [], "directives": [] }, diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/171/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/171/output.json index 223612d50266..bc538e58960f 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/171/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/171/output.json @@ -1,77 +1,21 @@ { "type": "File", - "start": 0, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, "program": { "type": "Program", - "start": 0, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, "expression": { "type": "FunctionExpression", - "start": 1, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":1,"end":26,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":26}}, "id": { "type": "Identifier", - "start": 10, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "x" - }, + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11},"identifierName":"x"}, "name": "x" }, "generator": false, @@ -79,65 +23,19 @@ "params": [ { "type": "RestElement", - "start": 12, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":12,"end":23,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":23}}, "argument": { "type": "ArrayPattern", - "start": 15, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":15,"end":23,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":23}}, "elements": [ { "type": "Identifier", - "start": 17, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - }, - "identifierName": "a" - }, + "start":17,"end":18,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":18},"identifierName":"a"}, "name": "a" }, { "type": "Identifier", - "start": 20, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 21 - }, - "identifierName": "b" - }, + "start":20,"end":21,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":21},"identifierName":"b"}, "name": "b" } ] @@ -146,18 +44,7 @@ ], "body": { "type": "BlockStatement", - "start": 24, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":24,"end":26,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":26}}, "body": [], "directives": [] }, diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/172/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/172/output.json index ba67fbfd01cc..4c2b384fa3fe 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/172/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/172/output.json @@ -1,77 +1,21 @@ { "type": "File", - "start": 0, - "end": 56, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 56 - } - }, + "start":0,"end":56,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":56}}, "program": { "type": "Program", - "start": 0, - "end": 56, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 56 - } - }, + "start":0,"end":56,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":56}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 56, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 56 - } - }, + "start":0,"end":56,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":56}}, "expression": { "type": "FunctionExpression", - "start": 1, - "end": 55, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 55 - } - }, + "start":1,"end":55,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":55}}, "id": { "type": "Identifier", - "start": 10, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "x" - }, + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11},"identifierName":"x"}, "name": "x" }, "generator": false, @@ -79,117 +23,37 @@ "params": [ { "type": "ObjectPattern", - "start": 12, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":12,"end":38,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":38}}, "properties": [ { "type": "ObjectProperty", - "start": 14, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":14,"end":25,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":25}}, "method": false, "key": { "type": "Identifier", - "start": 14, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - }, - "identifierName": "a" - }, + "start":14,"end":15,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":15},"identifierName":"a"}, "name": "a" }, "computed": false, "shorthand": false, "value": { "type": "ObjectPattern", - "start": 17, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":17,"end":25,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":25}}, "properties": [ { "type": "ObjectProperty", - "start": 19, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":19,"end":20,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":20}}, "method": false, "key": { "type": "Identifier", - "start": 19, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 20 - }, - "identifierName": "w" - }, + "start":19,"end":20,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":20},"identifierName":"w"}, "name": "w" }, "computed": false, "shorthand": true, "value": { "type": "Identifier", - "start": 19, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 20 - }, - "identifierName": "w" - }, + "start":19,"end":20,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":20},"identifierName":"w"}, "name": "w" }, "extra": { @@ -198,53 +62,18 @@ }, { "type": "ObjectProperty", - "start": 22, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":22,"end":23,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":23}}, "method": false, "key": { "type": "Identifier", - "start": 22, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 23 - }, - "identifierName": "x" - }, + "start":22,"end":23,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":23},"identifierName":"x"}, "name": "x" }, "computed": false, "shorthand": true, "value": { "type": "Identifier", - "start": 22, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 23 - }, - "identifierName": "x" - }, + "start":22,"end":23,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":23},"identifierName":"x"}, "name": "x" }, "extra": { @@ -256,85 +85,27 @@ }, { "type": "ObjectProperty", - "start": 27, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":27,"end":36,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":36}}, "method": false, "key": { "type": "Identifier", - "start": 27, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 28 - }, - "identifierName": "b" - }, + "start":27,"end":28,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":28},"identifierName":"b"}, "name": "b" }, "computed": false, "shorthand": false, "value": { "type": "ArrayPattern", - "start": 30, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":30,"end":36,"loc":{"start":{"line":1,"column":30},"end":{"line":1,"column":36}}, "elements": [ { "type": "Identifier", - "start": 31, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 31 - }, - "end": { - "line": 1, - "column": 32 - }, - "identifierName": "y" - }, + "start":31,"end":32,"loc":{"start":{"line":1,"column":31},"end":{"line":1,"column":32},"identifierName":"y"}, "name": "y" }, { "type": "Identifier", - "start": 34, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 34 - }, - "end": { - "line": 1, - "column": 35 - }, - "identifierName": "z" - }, + "start":34,"end":35,"loc":{"start":{"line":1,"column":34},"end":{"line":1,"column":35},"identifierName":"z"}, "name": "z" } ] @@ -344,82 +115,24 @@ }, { "type": "RestElement", - "start": 40, - "end": 52, - "loc": { - "start": { - "line": 1, - "column": 40 - }, - "end": { - "line": 1, - "column": 52 - } - }, + "start":40,"end":52,"loc":{"start":{"line":1,"column":40},"end":{"line":1,"column":52}}, "argument": { "type": "ArrayPattern", - "start": 43, - "end": 52, - "loc": { - "start": { - "line": 1, - "column": 43 - }, - "end": { - "line": 1, - "column": 52 - } - }, + "start":43,"end":52,"loc":{"start":{"line":1,"column":43},"end":{"line":1,"column":52}}, "elements": [ { "type": "Identifier", - "start": 44, - "end": 45, - "loc": { - "start": { - "line": 1, - "column": 44 - }, - "end": { - "line": 1, - "column": 45 - }, - "identifierName": "a" - }, + "start":44,"end":45,"loc":{"start":{"line":1,"column":44},"end":{"line":1,"column":45},"identifierName":"a"}, "name": "a" }, { "type": "Identifier", - "start": 47, - "end": 48, - "loc": { - "start": { - "line": 1, - "column": 47 - }, - "end": { - "line": 1, - "column": 48 - }, - "identifierName": "b" - }, + "start":47,"end":48,"loc":{"start":{"line":1,"column":47},"end":{"line":1,"column":48},"identifierName":"b"}, "name": "b" }, { "type": "Identifier", - "start": 50, - "end": 51, - "loc": { - "start": { - "line": 1, - "column": 50 - }, - "end": { - "line": 1, - "column": 51 - }, - "identifierName": "c" - }, + "start":50,"end":51,"loc":{"start":{"line":1,"column":50},"end":{"line":1,"column":51},"identifierName":"c"}, "name": "c" } ] @@ -428,18 +141,7 @@ ], "body": { "type": "BlockStatement", - "start": 53, - "end": 55, - "loc": { - "start": { - "line": 1, - "column": 53 - }, - "end": { - "line": 1, - "column": 55 - } - }, + "start":53,"end":55,"loc":{"start":{"line":1,"column":53},"end":{"line":1,"column":55}}, "body": [], "directives": [] }, diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/173/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/173/output.json index 27064ddfcabe..4dd0a32eff23 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/173/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/173/output.json @@ -1,93 +1,26 @@ { "type": "File", - "start": 0, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, "program": { "type": "Program", - "start": 0, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, "expression": { "type": "ObjectExpression", - "start": 1, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":1,"end":18,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":18}}, "properties": [ { "type": "ObjectMethod", - "start": 3, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":3,"end":16,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":16}}, "method": true, "key": { "type": "Identifier", - "start": 3, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 4 - }, - "identifierName": "x" - }, + "start":3,"end":4,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":4},"identifierName":"x"}, "name": "x" }, "computed": false, @@ -98,51 +31,16 @@ "params": [ { "type": "ArrayPattern", - "start": 5, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":5,"end":13,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":13}}, "elements": [ { "type": "Identifier", - "start": 7, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - }, - "identifierName": "a" - }, + "start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8},"identifierName":"a"}, "name": "a" }, { "type": "Identifier", - "start": 10, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "b" - }, + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11},"identifierName":"b"}, "name": "b" } ] @@ -150,18 +48,7 @@ ], "body": { "type": "BlockStatement", - "start": 14, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":14,"end":16,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":16}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/174/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/174/output.json index 43133cf25b45..e81ab2766a2e 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/174/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/174/output.json @@ -1,93 +1,26 @@ { "type": "File", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "program": { "type": "Program", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "expression": { "type": "ObjectExpression", - "start": 1, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":1,"end":21,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":21}}, "properties": [ { "type": "ObjectMethod", - "start": 3, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":3,"end":19,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":19}}, "method": true, "key": { "type": "Identifier", - "start": 3, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 4 - }, - "identifierName": "x" - }, + "start":3,"end":4,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":4},"identifierName":"x"}, "name": "x" }, "computed": false, @@ -98,65 +31,19 @@ "params": [ { "type": "RestElement", - "start": 5, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":5,"end":16,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":16}}, "argument": { "type": "ArrayPattern", - "start": 8, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":8,"end":16,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":16}}, "elements": [ { "type": "Identifier", - "start": 10, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "a" - }, + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11},"identifierName":"a"}, "name": "a" }, { "type": "Identifier", - "start": 13, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - }, - "identifierName": "b" - }, + "start":13,"end":14,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":14},"identifierName":"b"}, "name": "b" } ] @@ -165,18 +52,7 @@ ], "body": { "type": "BlockStatement", - "start": 17, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":17,"end":19,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":19}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/175/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/175/output.json index f88209a1ad30..d9d68b9d017d 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/175/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/175/output.json @@ -1,93 +1,26 @@ { "type": "File", - "start": 0, - "end": 51, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 51 - } - }, + "start":0,"end":51,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":51}}, "program": { "type": "Program", - "start": 0, - "end": 51, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 51 - } - }, + "start":0,"end":51,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":51}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 51, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 51 - } - }, + "start":0,"end":51,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":51}}, "expression": { "type": "ObjectExpression", - "start": 1, - "end": 50, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 50 - } - }, + "start":1,"end":50,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":50}}, "properties": [ { "type": "ObjectMethod", - "start": 3, - "end": 48, - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 48 - } - }, + "start":3,"end":48,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":48}}, "method": true, "key": { "type": "Identifier", - "start": 3, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 4 - }, - "identifierName": "x" - }, + "start":3,"end":4,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":4},"identifierName":"x"}, "name": "x" }, "computed": false, @@ -98,117 +31,37 @@ "params": [ { "type": "ObjectPattern", - "start": 5, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":5,"end":31,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":31}}, "properties": [ { "type": "ObjectProperty", - "start": 7, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":7,"end":18,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":18}}, "method": false, "key": { "type": "Identifier", - "start": 7, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - }, - "identifierName": "a" - }, + "start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8},"identifierName":"a"}, "name": "a" }, "computed": false, "shorthand": false, "value": { "type": "ObjectPattern", - "start": 10, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":10,"end":18,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":18}}, "properties": [ { "type": "ObjectProperty", - "start": 12, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":12,"end":13,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":13}}, "method": false, "key": { "type": "Identifier", - "start": 12, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - }, - "identifierName": "w" - }, + "start":12,"end":13,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":13},"identifierName":"w"}, "name": "w" }, "computed": false, "shorthand": true, "value": { "type": "Identifier", - "start": 12, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - }, - "identifierName": "w" - }, + "start":12,"end":13,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":13},"identifierName":"w"}, "name": "w" }, "extra": { @@ -217,53 +70,18 @@ }, { "type": "ObjectProperty", - "start": 15, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":15,"end":16,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":16}}, "method": false, "key": { "type": "Identifier", - "start": 15, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - }, - "identifierName": "x" - }, + "start":15,"end":16,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":16},"identifierName":"x"}, "name": "x" }, "computed": false, "shorthand": true, "value": { "type": "Identifier", - "start": 15, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - }, - "identifierName": "x" - }, + "start":15,"end":16,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":16},"identifierName":"x"}, "name": "x" }, "extra": { @@ -275,85 +93,27 @@ }, { "type": "ObjectProperty", - "start": 20, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":20,"end":29,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":29}}, "method": false, "key": { "type": "Identifier", - "start": 20, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 21 - }, - "identifierName": "b" - }, + "start":20,"end":21,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":21},"identifierName":"b"}, "name": "b" }, "computed": false, "shorthand": false, "value": { "type": "ArrayPattern", - "start": 23, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":23,"end":29,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":29}}, "elements": [ { "type": "Identifier", - "start": 24, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 25 - }, - "identifierName": "y" - }, + "start":24,"end":25,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":25},"identifierName":"y"}, "name": "y" }, { "type": "Identifier", - "start": 27, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 28 - }, - "identifierName": "z" - }, + "start":27,"end":28,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":28},"identifierName":"z"}, "name": "z" } ] @@ -363,82 +123,24 @@ }, { "type": "RestElement", - "start": 33, - "end": 45, - "loc": { - "start": { - "line": 1, - "column": 33 - }, - "end": { - "line": 1, - "column": 45 - } - }, + "start":33,"end":45,"loc":{"start":{"line":1,"column":33},"end":{"line":1,"column":45}}, "argument": { "type": "ArrayPattern", - "start": 36, - "end": 45, - "loc": { - "start": { - "line": 1, - "column": 36 - }, - "end": { - "line": 1, - "column": 45 - } - }, + "start":36,"end":45,"loc":{"start":{"line":1,"column":36},"end":{"line":1,"column":45}}, "elements": [ { "type": "Identifier", - "start": 37, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 37 - }, - "end": { - "line": 1, - "column": 38 - }, - "identifierName": "a" - }, + "start":37,"end":38,"loc":{"start":{"line":1,"column":37},"end":{"line":1,"column":38},"identifierName":"a"}, "name": "a" }, { "type": "Identifier", - "start": 40, - "end": 41, - "loc": { - "start": { - "line": 1, - "column": 40 - }, - "end": { - "line": 1, - "column": 41 - }, - "identifierName": "b" - }, + "start":40,"end":41,"loc":{"start":{"line":1,"column":40},"end":{"line":1,"column":41},"identifierName":"b"}, "name": "b" }, { "type": "Identifier", - "start": 43, - "end": 44, - "loc": { - "start": { - "line": 1, - "column": 43 - }, - "end": { - "line": 1, - "column": 44 - }, - "identifierName": "c" - }, + "start":43,"end":44,"loc":{"start":{"line":1,"column":43},"end":{"line":1,"column":44},"identifierName":"c"}, "name": "c" } ] @@ -447,18 +149,7 @@ ], "body": { "type": "BlockStatement", - "start": 46, - "end": 48, - "loc": { - "start": { - "line": 1, - "column": 46 - }, - "end": { - "line": 1, - "column": 48 - } - }, + "start":46,"end":48,"loc":{"start":{"line":1,"column":46},"end":{"line":1,"column":48}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/176/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/176/output.json index 348cddf040b9..4cfa553fc2b8 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/176/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/176/output.json @@ -1,113 +1,35 @@ { "type": "File", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, "program": { "type": "Program", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, "expression": { "type": "ArrowFunctionExpression", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, "id": null, "generator": false, "async": false, "params": [ { "type": "RestElement", - "start": 1, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":1,"end":5,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":5}}, "argument": { "type": "Identifier", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "a" - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"a"}, "name": "a" } } ], "body": { "type": "BlockStatement", - "start": 10, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":10,"end":12,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":12}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/177/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/177/output.json index 1a388a201ffe..9225b9f7ca8a 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/177/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/177/output.json @@ -1,130 +1,40 @@ { "type": "File", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "program": { "type": "Program", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "expression": { "type": "ArrowFunctionExpression", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "id": null, "generator": false, "async": false, "params": [ { "type": "Identifier", - "start": 1, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - }, - "identifierName": "a" - }, + "start":1,"end":2,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":2},"identifierName":"a"}, "name": "a" }, { "type": "RestElement", - "start": 4, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":4,"end":8,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":8}}, "argument": { "type": "Identifier", - "start": 7, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - }, - "identifierName": "b" - }, + "start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8},"identifierName":"b"}, "name": "b" } } ], "body": { "type": "BlockStatement", - "start": 13, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":13,"end":15,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":15}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/178/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/178/output.json index 6163701c2356..925f80444dfa 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/178/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/178/output.json @@ -1,130 +1,40 @@ { "type": "File", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "program": { "type": "Program", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "expression": { "type": "ArrowFunctionExpression", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "id": null, "generator": false, "async": false, "params": [ { "type": "ObjectPattern", - "start": 1, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":1,"end":6,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":6}}, "properties": [ { "type": "ObjectProperty", - "start": 3, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 4 - } - }, + "start":3,"end":4,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":4}}, "method": false, "key": { "type": "Identifier", - "start": 3, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 4 - }, - "identifierName": "a" - }, + "start":3,"end":4,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":4},"identifierName":"a"}, "name": "a" }, "computed": false, "shorthand": true, "value": { "type": "Identifier", - "start": 3, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 4 - }, - "identifierName": "a" - }, + "start":3,"end":4,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":4},"identifierName":"a"}, "name": "a" }, "extra": { @@ -136,18 +46,7 @@ ], "body": { "type": "BlockStatement", - "start": 11, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":11,"end":13,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":13}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/179/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/179/output.json index a2d079fcb4a9..c3abc460e573 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/179/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/179/output.json @@ -1,130 +1,40 @@ { "type": "File", - "start": 0, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, "program": { "type": "Program", - "start": 0, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, "expression": { "type": "ArrowFunctionExpression", - "start": 0, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, "id": null, "generator": false, "async": false, "params": [ { "type": "ObjectPattern", - "start": 1, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":1,"end":6,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":6}}, "properties": [ { "type": "ObjectProperty", - "start": 3, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 4 - } - }, + "start":3,"end":4,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":4}}, "method": false, "key": { "type": "Identifier", - "start": 3, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 4 - }, - "identifierName": "a" - }, + "start":3,"end":4,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":4},"identifierName":"a"}, "name": "a" }, "computed": false, "shorthand": true, "value": { "type": "Identifier", - "start": 3, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 4 - }, - "identifierName": "a" - }, + "start":3,"end":4,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":4},"identifierName":"a"}, "name": "a" }, "extra": { @@ -135,51 +45,17 @@ }, { "type": "RestElement", - "start": 8, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":8,"end":12,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":12}}, "argument": { "type": "Identifier", - "start": 11, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "b" - }, + "start":11,"end":12,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":12},"identifierName":"b"}, "name": "b" } } ], "body": { "type": "BlockStatement", - "start": 17, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":17,"end":19,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":19}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/18/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/18/output.json index 1709e7f7bee0..29c7dc50af2f 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/18/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/18/output.json @@ -1,78 +1,23 @@ { "type": "File", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - }, + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, "program": { "type": "Program", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - }, + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - }, + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, "expression": { "type": "TemplateLiteral", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - }, + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, "expressions": [], "quasis": [ { "type": "TemplateElement", - "start": 1, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 3 - } - }, + "start":1,"end":3,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":3}}, "value": { "raw": "42", "cooked": "42" diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/180/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/180/output.json index 990ec4b16356..9a0765520359 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/180/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/180/output.json @@ -1,127 +1,37 @@ { "type": "File", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "program": { "type": "Program", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "expression": { "type": "ArrowFunctionExpression", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "id": null, "generator": false, "async": false, "params": [ { "type": "RestElement", - "start": 1, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":1,"end":10,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":10}}, "argument": { "type": "ArrayPattern", - "start": 4, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":4,"end":10,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":10}}, "elements": [ { "type": "Identifier", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "a" - }, + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"a"}, "name": "a" }, { "type": "Identifier", - "start": 8, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "b" - }, + "start":8,"end":9,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":9},"identifierName":"b"}, "name": "b" } ] @@ -130,18 +40,7 @@ ], "body": { "type": "BlockStatement", - "start": 15, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":15,"end":17,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":17}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/181/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/181/output.json index 1836eebfe418..9c2a505e9a5c 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/181/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/181/output.json @@ -1,127 +1,37 @@ { "type": "File", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "program": { "type": "Program", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "expression": { "type": "ArrowFunctionExpression", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "id": null, "generator": false, "async": false, "params": [ { "type": "Identifier", - "start": 1, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - }, - "identifierName": "a" - }, + "start":1,"end":2,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":2},"identifierName":"a"}, "name": "a" }, { "type": "RestElement", - "start": 4, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":4,"end":10,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":10}}, "argument": { "type": "ArrayPattern", - "start": 7, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":7,"end":10,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":10}}, "elements": [ { "type": "Identifier", - "start": 8, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "b" - }, + "start":8,"end":9,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":9},"identifierName":"b"}, "name": "b" } ] @@ -130,18 +40,7 @@ ], "body": { "type": "BlockStatement", - "start": 15, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":15,"end":17,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":17}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/182/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/182/output.json index 95c3a50ee46f..d8d3880a8779 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/182/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/182/output.json @@ -1,162 +1,49 @@ { "type": "File", - "start": 0, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, "program": { "type": "Program", - "start": 0, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, "expression": { "type": "ArrowFunctionExpression", - "start": 0, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, "id": null, "generator": false, "async": false, "params": [ { "type": "ObjectPattern", - "start": 1, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":1,"end":14,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":14}}, "properties": [ { "type": "ObjectProperty", - "start": 3, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":3,"end":12,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":12}}, "method": false, "key": { "type": "Identifier", - "start": 3, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 4 - }, - "identifierName": "a" - }, + "start":3,"end":4,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":4},"identifierName":"a"}, "name": "a" }, "computed": false, "shorthand": false, "value": { "type": "ArrayPattern", - "start": 6, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":6,"end":12,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":12}}, "elements": [ { "type": "Identifier", - "start": 7, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - }, - "identifierName": "a" - }, + "start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8},"identifierName":"a"}, "name": "a" }, { "type": "Identifier", - "start": 10, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "b" - }, + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11},"identifierName":"b"}, "name": "b" } ] @@ -166,51 +53,17 @@ }, { "type": "RestElement", - "start": 16, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":16,"end":20,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":20}}, "argument": { "type": "Identifier", - "start": 19, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 20 - }, - "identifierName": "c" - }, + "start":19,"end":20,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":20},"identifierName":"c"}, "name": "c" } } ], "body": { "type": "BlockStatement", - "start": 25, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":25,"end":27,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":27}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/183/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/183/output.json index 0edcc63a308b..3a98d3e00373 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/183/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/183/output.json @@ -1,182 +1,57 @@ { "type": "File", - "start": 0, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, "program": { "type": "Program", - "start": 0, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, "expression": { "type": "ArrowFunctionExpression", - "start": 0, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, "id": null, "generator": false, "async": false, "params": [ { "type": "ObjectPattern", - "start": 1, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":1,"end":12,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":12}}, "properties": [ { "type": "ObjectProperty", - "start": 3, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":3,"end":7,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":7}}, "method": false, "key": { "type": "Identifier", - "start": 3, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 4 - }, - "identifierName": "a" - }, + "start":3,"end":4,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":4},"identifierName":"a"}, "name": "a" }, "computed": false, "shorthand": false, "value": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "b" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"b"}, "name": "b" } }, { "type": "ObjectProperty", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10}}, "method": false, "key": { "type": "Identifier", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - }, - "identifierName": "c" - }, + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"c"}, "name": "c" }, "computed": false, "shorthand": true, "value": { "type": "Identifier", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - }, - "identifierName": "c" - }, + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"c"}, "name": "c" }, "extra": { @@ -187,102 +62,33 @@ }, { "type": "ArrayPattern", - "start": 14, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":14,"end":20,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":20}}, "elements": [ { "type": "Identifier", - "start": 15, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - }, - "identifierName": "d" - }, + "start":15,"end":16,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":16},"identifierName":"d"}, "name": "d" }, { "type": "Identifier", - "start": 18, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - }, - "identifierName": "e" - }, + "start":18,"end":19,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":19},"identifierName":"e"}, "name": "e" } ] }, { "type": "RestElement", - "start": 22, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":22,"end":26,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":26}}, "argument": { "type": "Identifier", - "start": 25, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 26 - }, - "identifierName": "f" - }, + "start":25,"end":26,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":26},"identifierName":"f"}, "name": "f" } } ], "body": { "type": "BlockStatement", - "start": 31, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 31 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":31,"end":33,"loc":{"start":{"line":1,"column":31},"end":{"line":1,"column":33}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/184/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/184/output.json index c1d861aac73f..6f95d14f2ee5 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/184/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/184/output.json @@ -1,107 +1,29 @@ { "type": "File", - "start": 0, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, "program": { "type": "Program", - "start": 0, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, "expression": { "type": "AssignmentExpression", - "start": 0, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, "operator": "=", "left": { "type": "ArrayPattern", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "elements": [ { "type": "RestElement", - "start": 1, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":1,"end":5,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":5}}, "argument": { "type": "Identifier", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "a" - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"a"}, "name": "a" } } @@ -109,19 +31,7 @@ }, "right": { "type": "Identifier", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - }, - "identifierName": "b" - }, + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"b"}, "name": "b" } } diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/185/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/185/output.json index 8f828764a31d..7bc14d3a6410 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/185/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/185/output.json @@ -1,124 +1,34 @@ { "type": "File", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "program": { "type": "Program", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "expression": { "type": "AssignmentExpression", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "operator": "=", "left": { "type": "ArrayPattern", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "elements": [ { "type": "Identifier", - "start": 1, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - }, - "identifierName": "a" - }, + "start":1,"end":2,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":2},"identifierName":"a"}, "name": "a" }, { "type": "RestElement", - "start": 4, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":4,"end":8,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":8}}, "argument": { "type": "Identifier", - "start": 7, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - }, - "identifierName": "b" - }, + "start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8},"identifierName":"b"}, "name": "b" } } @@ -126,19 +36,7 @@ }, "right": { "type": "Identifier", - "start": 12, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - }, - "identifierName": "c" - }, + "start":12,"end":13,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":13},"identifierName":"c"}, "name": "c" } } diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/186/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/186/output.json index 2165bb6ae23a..13b1c5aa3aea 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/186/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/186/output.json @@ -1,142 +1,41 @@ { "type": "File", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, "program": { "type": "Program", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, "expression": { "type": "AssignmentExpression", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, "operator": "=", "left": { "type": "ArrayPattern", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "elements": [ { "type": "ObjectPattern", - "start": 1, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":1,"end":9,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":9}}, "properties": [ { "type": "ObjectProperty", - "start": 3, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 4 - } - }, + "start":3,"end":4,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":4}}, "method": false, "key": { "type": "Identifier", - "start": 3, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 4 - }, - "identifierName": "a" - }, + "start":3,"end":4,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":4},"identifierName":"a"}, "name": "a" }, "computed": false, "shorthand": true, "value": { "type": "Identifier", - "start": 3, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 4 - }, - "identifierName": "a" - }, + "start":3,"end":4,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":4},"identifierName":"a"}, "name": "a" }, "extra": { @@ -145,53 +44,18 @@ }, { "type": "ObjectProperty", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7}}, "method": false, "key": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "b" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"b"}, "name": "b" }, "computed": false, "shorthand": true, "value": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "b" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"b"}, "name": "b" }, "extra": { @@ -202,33 +66,10 @@ }, { "type": "RestElement", - "start": 11, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":11,"end":15,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":15}}, "argument": { "type": "Identifier", - "start": 14, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - }, - "identifierName": "c" - }, + "start":14,"end":15,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":15},"identifierName":"c"}, "name": "c" } } @@ -236,19 +77,7 @@ }, "right": { "type": "Identifier", - "start": 19, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 20 - }, - "identifierName": "d" - }, + "start":19,"end":20,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":20},"identifierName":"d"}, "name": "d" } } diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/187/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/187/output.json index 26fa0672023b..b92de7b87d97 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/187/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/187/output.json @@ -1,156 +1,43 @@ { "type": "File", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, "program": { "type": "Program", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, "expression": { "type": "AssignmentExpression", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, "operator": "=", "left": { "type": "ArrayPattern", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "elements": [ { "type": "Identifier", - "start": 1, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - }, - "identifierName": "a" - }, + "start":1,"end":2,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":2},"identifierName":"a"}, "name": "a" }, { "type": "RestElement", - "start": 4, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":4,"end":13,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":13}}, "argument": { "type": "ArrayPattern", - "start": 7, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":7,"end":13,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":13}}, "elements": [ { "type": "Identifier", - "start": 8, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "b" - }, + "start":8,"end":9,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":9},"identifierName":"b"}, "name": "b" }, { "type": "Identifier", - "start": 11, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "c" - }, + "start":11,"end":12,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":12},"identifierName":"c"}, "name": "c" } ] @@ -160,19 +47,7 @@ }, "right": { "type": "Identifier", - "start": 17, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - }, - "identifierName": "d" - }, + "start":17,"end":18,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":18},"identifierName":"d"}, "name": "d" } } diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/188/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/188/output.json index af971d4820b2..76262d60711a 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/188/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/188/output.json @@ -1,107 +1,29 @@ { "type": "File", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "program": { "type": "Program", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":4,"end":14,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":14}}, "id": { "type": "ArrayPattern", - "start": 4, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":4,"end":10,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":10}}, "elements": [ { "type": "RestElement", - "start": 5, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":5,"end":9,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":9}}, "argument": { "type": "Identifier", - "start": 8, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "a" - }, + "start":8,"end":9,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":9},"identifierName":"a"}, "name": "a" } } @@ -109,19 +31,7 @@ }, "init": { "type": "Identifier", - "start": 13, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - }, - "identifierName": "b" - }, + "start":13,"end":14,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":14},"identifierName":"b"}, "name": "b" } } diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/189/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/189/output.json index 1d8b8c08364c..f7d82279e8eb 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/189/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/189/output.json @@ -1,124 +1,34 @@ { "type": "File", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "program": { "type": "Program", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":4,"end":17,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":17}}, "id": { "type": "ArrayPattern", - "start": 4, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":4,"end":13,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":13}}, "elements": [ { "type": "Identifier", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "a" - }, + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"a"}, "name": "a" }, { "type": "RestElement", - "start": 8, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":8,"end":12,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":12}}, "argument": { "type": "Identifier", - "start": 11, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "b" - }, + "start":11,"end":12,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":12},"identifierName":"b"}, "name": "b" } } @@ -126,19 +36,7 @@ }, "init": { "type": "Identifier", - "start": 16, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - }, - "identifierName": "c" - }, + "start":16,"end":17,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":17},"identifierName":"c"}, "name": "c" } } diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/19/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/19/output.json index 9ea44c8e0cc6..afff23398ccc 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/19/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/19/output.json @@ -1,109 +1,31 @@ { "type": "File", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "program": { "type": "Program", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "expression": { "type": "TaggedTemplateExpression", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "tag": { "type": "Identifier", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - }, - "identifierName": "raw" - }, + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3},"identifierName":"raw"}, "name": "raw" }, "quasi": { "type": "TemplateLiteral", - "start": 3, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":3,"end":7,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":7}}, "expressions": [], "quasis": [ { "type": "TemplateElement", - "start": 4, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":4,"end":6,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":6}}, "value": { "raw": "42", "cooked": "42" diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/190/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/190/output.json index 51ab81d96503..99fd55d344ef 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/190/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/190/output.json @@ -1,142 +1,41 @@ { "type": "File", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "program": { "type": "Program", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":4,"end":24,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":24}}, "id": { "type": "ArrayPattern", - "start": 4, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":4,"end":20,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":20}}, "elements": [ { "type": "ObjectPattern", - "start": 5, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":5,"end":13,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":13}}, "properties": [ { "type": "ObjectProperty", - "start": 7, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8}}, "method": false, "key": { "type": "Identifier", - "start": 7, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - }, - "identifierName": "a" - }, + "start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8},"identifierName":"a"}, "name": "a" }, "computed": false, "shorthand": true, "value": { "type": "Identifier", - "start": 7, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - }, - "identifierName": "a" - }, + "start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8},"identifierName":"a"}, "name": "a" }, "extra": { @@ -145,53 +44,18 @@ }, { "type": "ObjectProperty", - "start": 10, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11}}, "method": false, "key": { "type": "Identifier", - "start": 10, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "b" - }, + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11},"identifierName":"b"}, "name": "b" }, "computed": false, "shorthand": true, "value": { "type": "Identifier", - "start": 10, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "b" - }, + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11},"identifierName":"b"}, "name": "b" }, "extra": { @@ -202,33 +66,10 @@ }, { "type": "RestElement", - "start": 15, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":15,"end":19,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":19}}, "argument": { "type": "Identifier", - "start": 18, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - }, - "identifierName": "c" - }, + "start":18,"end":19,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":19},"identifierName":"c"}, "name": "c" } } @@ -236,19 +77,7 @@ }, "init": { "type": "Identifier", - "start": 23, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 24 - }, - "identifierName": "d" - }, + "start":23,"end":24,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":24},"identifierName":"d"}, "name": "d" } } diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/192/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/192/output.json index d0824afb0cb9..48f8c8c02137 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/192/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/192/output.json @@ -1,109 +1,30 @@ { "type": "File", - "start": 0, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, "program": { "type": "Program", - "start": 0, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, "expression": { "type": "CallExpression", - "start": 0, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, "callee": { "type": "Identifier", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - }, - "identifierName": "func" - }, + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4},"identifierName":"func"}, "name": "func" }, "arguments": [ { "type": "SpreadElement", - "start": 5, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":5,"end":9,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":9}}, "argument": { "type": "Identifier", - "start": 8, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "a" - }, + "start":8,"end":9,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":9},"identifierName":"a"}, "name": "a" } } diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/193/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/193/output.json index aad9532c5763..fb33ef71f83d 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/193/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/193/output.json @@ -1,126 +1,35 @@ { "type": "File", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "program": { "type": "Program", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "expression": { "type": "CallExpression", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "callee": { "type": "Identifier", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - }, - "identifierName": "func" - }, + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4},"identifierName":"func"}, "name": "func" }, "arguments": [ { "type": "Identifier", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "a" - }, + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"a"}, "name": "a" }, { "type": "SpreadElement", - "start": 8, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":8,"end":12,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":12}}, "argument": { "type": "Identifier", - "start": 11, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "b" - }, + "start":11,"end":12,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":12},"identifierName":"b"}, "name": "b" } } diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/194/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/194/output.json index baffe722f9d3..a126e05e6ca6 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/194/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/194/output.json @@ -1,127 +1,36 @@ { "type": "File", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "program": { "type": "Program", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "expression": { "type": "CallExpression", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "callee": { "type": "Identifier", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - }, - "identifierName": "func" - }, + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4},"identifierName":"func"}, "name": "func" }, "arguments": [ { "type": "SpreadElement", - "start": 5, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":5,"end":9,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":9}}, "argument": { "type": "Identifier", - "start": 8, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "a" - }, + "start":8,"end":9,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":9},"identifierName":"a"}, "name": "a" } }, { "type": "Identifier", - "start": 11, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "b" - }, + "start":11,"end":12,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":12},"identifierName":"b"}, "name": "b" } ] diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/195/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/195/output.json index 367d87eb14c7..3ecd5ce6796b 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/195/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/195/output.json @@ -1,62 +1,18 @@ { "type": "File", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, "program": { "type": "Program", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, "expression": { "type": "RegExpLiteral", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, "extra": { "raw": "/[a-z]/u" }, diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/196/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/196/output.json index 2c839b2044a8..5a84a2b4e0bf 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/196/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/196/output.json @@ -1,62 +1,18 @@ { "type": "File", - "start": 0, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, "program": { "type": "Program", - "start": 0, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, "expression": { "type": "RegExpLiteral", - "start": 0, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, "extra": { "raw": "/[\\uD834\\uDF06-\\uD834\\uDF08a-z]/u" }, diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/197/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/197/output.json index cc0833f45ca0..4d24a6690e9b 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/197/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/197/output.json @@ -1,125 +1,36 @@ { "type": "File", - "start": 0, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, "program": { "type": "Program", - "start": 0, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "DoWhileStatement", - "start": 0, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, "body": { "type": "BlockStatement", - "start": 3, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":3,"end":5,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":5}}, "body": [], "directives": [] }, "test": { "type": "BooleanLiteral", - "start": 13, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":13,"end":18,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":18}}, "value": false } }, { "type": "ExpressionStatement", - "start": 20, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":20,"end":26,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":26}}, "expression": { "type": "CallExpression", - "start": 20, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":20,"end":25,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":25}}, "callee": { "type": "Identifier", - "start": 20, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 23 - }, - "identifierName": "foo" - }, + "start":20,"end":23,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":23},"identifierName":"foo"}, "name": "foo" }, "arguments": [] diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/198/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/198/options.json deleted file mode 100644 index 3f09c36a5f1c..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/198/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Expected number in radix 8 (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/198/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/198/output.json new file mode 100644 index 000000000000..a880531bce85 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/198/output.json @@ -0,0 +1,29 @@ +{ + "type": "File", + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}}, + "errors": [ + "SyntaxError: Expected number in radix 8 (1:2)" + ], + "program": { + "type": "Program", + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}}, + "expression": { + "type": "NumericLiteral", + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}}, + "extra": { + "rawValue": null, + "raw": "0o" + }, + "value": null + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/2/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/2/output.json index 609d51885478..ba8837d8ed26 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/2/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/2/output.json @@ -1,63 +1,19 @@ { "type": "File", - "start": 0, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, "program": { "type": "Program", - "start": 0, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, "sourceType": "script", "interpreter": null, "body": [], "directives": [ { "type": "Directive", - "start": 0, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, "value": { "type": "DirectiveLiteral", - "start": 0, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, "value": "\\u{20BB7}\\u{91CE}\\u{5BB6}", "extra": { "raw": "\"\\u{20BB7}\\u{91CE}\\u{5BB6}\"", diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/20/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/20/output.json index a036ba998f5a..d54c1eadf69e 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/20/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/20/output.json @@ -1,127 +1,37 @@ { "type": "File", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, "program": { "type": "Program", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, "expression": { "type": "TaggedTemplateExpression", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, "tag": { "type": "Identifier", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - }, - "identifierName": "raw" - }, + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3},"identifierName":"raw"}, "name": "raw" }, "quasi": { "type": "TemplateLiteral", - "start": 3, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":3,"end":18,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":18}}, "expressions": [ { "type": "Identifier", - "start": 12, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 16 - }, - "identifierName": "name" - }, + "start":12,"end":16,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":16},"identifierName":"name"}, "name": "name" } ], "quasis": [ { "type": "TemplateElement", - "start": 4, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":4,"end":10,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":10}}, "value": { "raw": "hello ", "cooked": "hello " @@ -130,18 +40,7 @@ }, { "type": "TemplateElement", - "start": 17, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":17,"end":17,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":17}}, "value": { "raw": "", "cooked": "" diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/200/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/200/options.json deleted file mode 100644 index 3f09c36a5f1c..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/200/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Expected number in radix 8 (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/200/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/200/output.json new file mode 100644 index 000000000000..42696d4924d6 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/200/output.json @@ -0,0 +1,29 @@ +{ + "type": "File", + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, + "errors": [ + "SyntaxError: Expected number in radix 8 (1:2)" + ], + "program": { + "type": "Program", + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, + "expression": { + "type": "NumericLiteral", + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, + "extra": { + "rawValue": 0, + "raw": "0o9" + }, + "value": 0 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/201/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/201/options.json deleted file mode 100644 index d52d9cfac4bc..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/201/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected token, expected \";\" (1:3)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/201/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/201/output.json new file mode 100644 index 000000000000..9ed93409bc00 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/201/output.json @@ -0,0 +1,29 @@ +{ + "type": "File", + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, + "errors": [ + "SyntaxError: Expected number in radix 8 (1:3)" + ], + "program": { + "type": "Program", + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, + "expression": { + "type": "NumericLiteral", + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, + "extra": { + "rawValue": 8, + "raw": "0o18" + }, + "value": 8 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/202/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/202/options.json deleted file mode 100644 index 3f09c36a5f1c..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/202/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Expected number in radix 8 (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/202/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/202/output.json new file mode 100644 index 000000000000..91dec1a23074 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/202/output.json @@ -0,0 +1,29 @@ +{ + "type": "File", + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}}, + "errors": [ + "SyntaxError: Expected number in radix 8 (1:2)" + ], + "program": { + "type": "Program", + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}}, + "expression": { + "type": "NumericLiteral", + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}}, + "extra": { + "rawValue": null, + "raw": "0O" + }, + "value": null + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/204/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/204/options.json deleted file mode 100644 index 3f09c36a5f1c..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/204/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Expected number in radix 8 (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/204/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/204/output.json new file mode 100644 index 000000000000..2fbc3ece3140 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/204/output.json @@ -0,0 +1,29 @@ +{ + "type": "File", + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, + "errors": [ + "SyntaxError: Expected number in radix 8 (1:2)" + ], + "program": { + "type": "Program", + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, + "expression": { + "type": "NumericLiteral", + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, + "extra": { + "rawValue": 0, + "raw": "0O9" + }, + "value": 0 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/205/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/205/options.json deleted file mode 100644 index d52d9cfac4bc..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/205/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected token, expected \";\" (1:3)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/205/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/205/output.json new file mode 100644 index 000000000000..4978bcf4e51b --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/205/output.json @@ -0,0 +1,29 @@ +{ + "type": "File", + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, + "errors": [ + "SyntaxError: Expected number in radix 8 (1:3)" + ], + "program": { + "type": "Program", + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, + "expression": { + "type": "NumericLiteral", + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, + "extra": { + "rawValue": 8, + "raw": "0O18" + }, + "value": 8 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/206/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/206/options.json deleted file mode 100644 index 40dc3da9a8f4..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/206/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Expected number in radix 2 (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/206/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/206/output.json new file mode 100644 index 000000000000..bd3bd49916b3 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/206/output.json @@ -0,0 +1,29 @@ +{ + "type": "File", + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}}, + "errors": [ + "SyntaxError: Expected number in radix 2 (1:2)" + ], + "program": { + "type": "Program", + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}}, + "expression": { + "type": "NumericLiteral", + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}}, + "extra": { + "rawValue": null, + "raw": "0b" + }, + "value": null + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/208/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/208/options.json deleted file mode 100644 index 40dc3da9a8f4..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/208/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Expected number in radix 2 (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/208/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/208/output.json new file mode 100644 index 000000000000..fabbead51492 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/208/output.json @@ -0,0 +1,29 @@ +{ + "type": "File", + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, + "errors": [ + "SyntaxError: Expected number in radix 2 (1:2)" + ], + "program": { + "type": "Program", + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, + "expression": { + "type": "NumericLiteral", + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, + "extra": { + "rawValue": 0, + "raw": "0b9" + }, + "value": 0 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/209/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/209/options.json deleted file mode 100644 index d52d9cfac4bc..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/209/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected token, expected \";\" (1:3)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/209/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/209/output.json new file mode 100644 index 000000000000..c90afe1734e6 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/209/output.json @@ -0,0 +1,29 @@ +{ + "type": "File", + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, + "errors": [ + "SyntaxError: Expected number in radix 2 (1:3)" + ], + "program": { + "type": "Program", + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, + "expression": { + "type": "NumericLiteral", + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, + "extra": { + "rawValue": 2, + "raw": "0b18" + }, + "value": 2 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/21/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/21/output.json index 4e9b217cb08f..9b2b86cb1b28 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/21/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/21/output.json @@ -1,78 +1,23 @@ { "type": "File", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, "program": { "type": "Program", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, "expression": { "type": "TemplateLiteral", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, "expressions": [], "quasis": [ { "type": "TemplateElement", - "start": 1, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - } - }, + "start":1,"end":2,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":2}}, "value": { "raw": "$", "cooked": "$" diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/210/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/210/options.json deleted file mode 100644 index d52d9cfac4bc..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/210/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected token, expected \";\" (1:3)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/210/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/210/output.json new file mode 100644 index 000000000000..2b8e4f22be33 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/210/output.json @@ -0,0 +1,29 @@ +{ + "type": "File", + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, + "errors": [ + "SyntaxError: Expected number in radix 2 (1:3)" + ], + "program": { + "type": "Program", + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, + "expression": { + "type": "NumericLiteral", + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, + "extra": { + "rawValue": 2, + "raw": "0b12" + }, + "value": 2 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/211/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/211/options.json deleted file mode 100644 index 40dc3da9a8f4..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/211/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Expected number in radix 2 (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/211/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/211/output.json new file mode 100644 index 000000000000..6cfde9edb3b5 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/211/output.json @@ -0,0 +1,29 @@ +{ + "type": "File", + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}}, + "errors": [ + "SyntaxError: Expected number in radix 2 (1:2)" + ], + "program": { + "type": "Program", + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}}, + "expression": { + "type": "NumericLiteral", + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}}, + "extra": { + "rawValue": null, + "raw": "0B" + }, + "value": null + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/213/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/213/options.json deleted file mode 100644 index 40dc3da9a8f4..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/213/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Expected number in radix 2 (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/213/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/213/output.json new file mode 100644 index 000000000000..6e3728ace39b --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/213/output.json @@ -0,0 +1,29 @@ +{ + "type": "File", + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, + "errors": [ + "SyntaxError: Expected number in radix 2 (1:2)" + ], + "program": { + "type": "Program", + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, + "expression": { + "type": "NumericLiteral", + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, + "extra": { + "rawValue": 0, + "raw": "0B9" + }, + "value": 0 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/214/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/214/options.json deleted file mode 100644 index d52d9cfac4bc..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/214/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected token, expected \";\" (1:3)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/214/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/214/output.json new file mode 100644 index 000000000000..d5ba308d5906 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/214/output.json @@ -0,0 +1,29 @@ +{ + "type": "File", + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, + "errors": [ + "SyntaxError: Expected number in radix 2 (1:3)" + ], + "program": { + "type": "Program", + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, + "expression": { + "type": "NumericLiteral", + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, + "extra": { + "rawValue": 2, + "raw": "0B18" + }, + "value": 2 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/215/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/215/options.json deleted file mode 100644 index d52d9cfac4bc..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/215/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected token, expected \";\" (1:3)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/215/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/215/output.json new file mode 100644 index 000000000000..af38f05f89fa --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/215/output.json @@ -0,0 +1,29 @@ +{ + "type": "File", + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, + "errors": [ + "SyntaxError: Expected number in radix 2 (1:3)" + ], + "program": { + "type": "Program", + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, + "expression": { + "type": "NumericLiteral", + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, + "extra": { + "rawValue": 2, + "raw": "0B12" + }, + "value": 2 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/216/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/216/options.json index 77b813987217..0cefc1094055 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/216/options.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/216/options.json @@ -1,3 +1,3 @@ { - "throws": "Code point out of bounds (1:4)" + "throws": "Invalid code point 1114112" } diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/217/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/217/options.json deleted file mode 100644 index efaa7d304ccc..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/217/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Bad character escape sequence (1:4)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/217/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/217/output.json new file mode 100644 index 000000000000..8169a2831084 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/217/output.json @@ -0,0 +1,29 @@ +{ + "type": "File", + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, + "errors": [ + "SyntaxError: Bad character escape sequence (1:4)" + ], + "program": { + "type": "Program", + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, + "sourceType": "script", + "interpreter": null, + "body": [], + "directives": [ + { + "type": "Directive", + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, + "value": { + "type": "DirectiveLiteral", + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, + "value": "\\u{}", + "extra": { + "raw": "\"\\u{}\"", + "rawValue": "\\u{}" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/218/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/218/options.json deleted file mode 100644 index efaa7d304ccc..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/218/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Bad character escape sequence (1:4)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/218/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/218/output.json new file mode 100644 index 000000000000..a5b7bb95f356 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/218/output.json @@ -0,0 +1,29 @@ +{ + "type": "File", + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "errors": [ + "SyntaxError: Bad character escape sequence (1:4)" + ], + "program": { + "type": "Program", + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "sourceType": "script", + "interpreter": null, + "body": [], + "directives": [ + { + "type": "Directive", + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "value": { + "type": "DirectiveLiteral", + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "value": "\\u{FFFF", + "extra": { + "raw": "\"\\u{FFFF\"", + "rawValue": "\\u{FFFF" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/219/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/219/options.json deleted file mode 100644 index efaa7d304ccc..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/219/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Bad character escape sequence (1:4)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/219/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/219/output.json new file mode 100644 index 000000000000..5c0123d27a42 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/219/output.json @@ -0,0 +1,29 @@ +{ + "type": "File", + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "errors": [ + "SyntaxError: Bad character escape sequence (1:4)" + ], + "program": { + "type": "Program", + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "sourceType": "script", + "interpreter": null, + "body": [], + "directives": [ + { + "type": "Directive", + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "value": { + "type": "DirectiveLiteral", + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "value": "\\u{FFZ}", + "extra": { + "raw": "\"\\u{FFZ}\"", + "rawValue": "\\u{FFZ}" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/22/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/22/output.json index 0dff1ff533a1..af22fdb927d0 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/22/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/22/output.json @@ -1,80 +1,25 @@ { "type": "File", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 5 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":5}}, "program": { "type": "Program", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 5 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":5}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 5 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":5}}, "expression": { "type": "TemplateLiteral", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 5 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":5}}, "expressions": [], "quasis": [ { "type": "TemplateElement", - "start": 1, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 3, - "column": 4 - } - }, + "start":1,"end":21,"loc":{"start":{"line":1,"column":1},"end":{"line":3,"column":4}}, "value": { - "raw": "\\n\\r\\b\\v\\t\\f\\\n\\\n\\\u2028\\\u2029", + "raw": "\\n\\r\\b\\v\\t\\f\\\n\\\n\\
\\
", "cooked": "\n\r\b\u000b\t\f" }, "tail": true @@ -85,4 +30,4 @@ ], "directives": [] } -} +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/220/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/220/options.json deleted file mode 100644 index 6010e96ed144..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/220/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid left-hand side in assignment expression (1:0)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/220/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/220/output.json new file mode 100644 index 000000000000..146edec02ca3 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/220/output.json @@ -0,0 +1,41 @@ +{ + "type": "File", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "errors": [ + "SyntaxError: Invalid left-hand side in assignment expression (1:0)" + ], + "program": { + "type": "Program", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "expression": { + "type": "AssignmentExpression", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "operator": "+=", + "left": { + "type": "ArrayExpression", + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, + "elements": [ + { + "type": "Identifier", + "start":1,"end":2,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":2},"identifierName":"v"}, + "name": "v" + } + ] + }, + "right": { + "type": "Identifier", + "start":7,"end":10,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":10},"identifierName":"ary"}, + "name": "ary" + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/221/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/221/options.json deleted file mode 100644 index 7c5f08eb9ba6..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/221/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid left-hand side in assignment expression (1:1)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/221/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/221/output.json new file mode 100644 index 000000000000..6e2bf85797f6 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/221/output.json @@ -0,0 +1,49 @@ +{ + "type": "File", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "errors": [ + "SyntaxError: Invalid left-hand side in array destructuring pattern (1:1)" + ], + "program": { + "type": "Program", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "expression": { + "type": "AssignmentExpression", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "operator": "=", + "left": { + "type": "ArrayPattern", + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, + "elements": [ + { + "type": "NumericLiteral", + "start":1,"end":2,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":2}}, + "extra": { + "rawValue": 2, + "raw": "2" + }, + "value": 2 + } + ] + }, + "right": { + "type": "NumericLiteral", + "start":6,"end":8,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":8}}, + "extra": { + "rawValue": 42, + "raw": "42" + }, + "value": 42 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/222/input.js b/packages/babel-parser/test/fixtures/es2015/uncategorised/222/input.js index 67f4e9ae35f3..2e33b3f144ba 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/222/input.js +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/222/input.js @@ -1 +1 @@ -({ obj:20 }) = 42 \ No newline at end of file +({ obj:20 } = 42) \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/222/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/222/options.json deleted file mode 100644 index e6630c3da3e8..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/222/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid left-hand side in object destructuring pattern (1:7)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/222/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/222/output.json new file mode 100644 index 000000000000..c220984197b1 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/222/output.json @@ -0,0 +1,65 @@ +{ + "type": "File", + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, + "errors": [ + "SyntaxError: Invalid left-hand side in object destructuring pattern (1:7)" + ], + "program": { + "type": "Program", + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, + "expression": { + "type": "AssignmentExpression", + "start":1,"end":16,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":16}}, + "operator": "=", + "left": { + "type": "ObjectPattern", + "start":1,"end":11,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":11}}, + "properties": [ + { + "type": "ObjectProperty", + "start":3,"end":9,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":9}}, + "method": false, + "key": { + "type": "Identifier", + "start":3,"end":6,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":6},"identifierName":"obj"}, + "name": "obj" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "NumericLiteral", + "start":7,"end":9,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":9}}, + "extra": { + "rawValue": 20, + "raw": "20" + }, + "value": 20 + } + } + ] + }, + "right": { + "type": "NumericLiteral", + "start":14,"end":16,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":16}}, + "extra": { + "rawValue": 42, + "raw": "42" + }, + "value": 42 + }, + "extra": { + "parenthesized": true, + "parenStart": 0 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/223/input.js b/packages/babel-parser/test/fixtures/es2015/uncategorised/223/input.js index 6c808fb17ea6..040069f16529 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/223/input.js +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/223/input.js @@ -1 +1 @@ -( { get x() {} } ) = 0 \ No newline at end of file +({ get x() {} } = 0) diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/223/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/223/options.json deleted file mode 100644 index da1e10744904..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/223/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Object pattern can't contain getter or setter (1:8)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/223/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/223/output.json new file mode 100644 index 000000000000..475564c6683c --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/223/output.json @@ -0,0 +1,66 @@ +{ + "type": "File", + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, + "errors": [ + "SyntaxError: Object pattern can't contain getter or setter (1:7)" + ], + "program": { + "type": "Program", + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, + "expression": { + "type": "AssignmentExpression", + "start":1,"end":19,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":19}}, + "operator": "=", + "left": { + "type": "ObjectPattern", + "start":1,"end":15,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":15}}, + "properties": [ + { + "type": "ObjectMethod", + "start":3,"end":13,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":13}}, + "method": false, + "key": { + "type": "Identifier", + "start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8},"identifierName":"x"}, + "name": "x" + }, + "computed": false, + "kind": "get", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":11,"end":13,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":13}}, + "body": [], + "directives": [] + } + } + ] + }, + "right": { + "type": "NumericLiteral", + "start":18,"end":19,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":19}}, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + }, + "extra": { + "parenthesized": true, + "parenStart": 0 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/226/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/226/options.json deleted file mode 100644 index 74c1a72d5030..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/226/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected keyword 'default' (1:9)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/226/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/226/output.json new file mode 100644 index 000000000000..dfaa426cebd5 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/226/output.json @@ -0,0 +1,34 @@ +{ + "type": "File", + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, + "errors": [ + "SyntaxError: Unexpected keyword 'default' (1:9)" + ], + "program": { + "type": "Program", + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, + "id": { + "type": "Identifier", + "start":9,"end":16,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":16},"identifierName":"default"}, + "name": "default" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":19,"end":21,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":21}}, + "body": [], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/227/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/227/options.json deleted file mode 100644 index 6c907b0a7009..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/227/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'eval' in strict mode (1:44)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/227/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/227/output.json new file mode 100644 index 000000000000..ddf1b38b6ab3 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/227/output.json @@ -0,0 +1,112 @@ +{ + "type": "File", + "start":0,"end":59,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":59}}, + "errors": [ + "SyntaxError: Binding 'eval' in strict mode (1:44)" + ], + "program": { + "type": "Program", + "start":0,"end":59,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":59}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":59,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":59}}, + "id": { + "type": "Identifier", + "start":9,"end":14,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":14},"identifierName":"hello"}, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":17,"end":59,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":59}}, + "body": [ + { + "type": "ExpressionStatement", + "start":32,"end":57,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":57}}, + "expression": { + "type": "ObjectExpression", + "start":33,"end":55,"loc":{"start":{"line":1,"column":33},"end":{"line":1,"column":55}}, + "properties": [ + { + "type": "ObjectProperty", + "start":35,"end":40,"loc":{"start":{"line":1,"column":35},"end":{"line":1,"column":40}}, + "method": false, + "key": { + "type": "Identifier", + "start":35,"end":36,"loc":{"start":{"line":1,"column":35},"end":{"line":1,"column":36},"identifierName":"i"}, + "name": "i" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "NumericLiteral", + "start":38,"end":40,"loc":{"start":{"line":1,"column":38},"end":{"line":1,"column":40}}, + "extra": { + "rawValue": 10, + "raw": "10" + }, + "value": 10 + } + }, + { + "type": "ObjectMethod", + "start":42,"end":53,"loc":{"start":{"line":1,"column":42},"end":{"line":1,"column":53}}, + "method": true, + "key": { + "type": "Identifier", + "start":42,"end":43,"loc":{"start":{"line":1,"column":42},"end":{"line":1,"column":43},"identifierName":"s"}, + "name": "s" + }, + "computed": false, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start":44,"end":48,"loc":{"start":{"line":1,"column":44},"end":{"line":1,"column":48},"identifierName":"eval"}, + "name": "eval" + } + ], + "body": { + "type": "BlockStatement", + "start":50,"end":53,"loc":{"start":{"line":1,"column":50},"end":{"line":1,"column":53}}, + "body": [], + "directives": [] + } + } + ], + "extra": { + "parenthesized": true, + "parenStart": 32 + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start":18,"end":31,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":31}}, + "value": { + "type": "DirectiveLiteral", + "start":18,"end":30,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":30}}, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/228/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/228/options.json deleted file mode 100644 index a33dde469094..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/228/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Argument name clash (1:37)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/228/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/228/output.json new file mode 100644 index 000000000000..54c485732104 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/228/output.json @@ -0,0 +1,96 @@ +{ + "type": "File", + "start":0,"end":49,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":49}}, + "errors": [ + "SyntaxError: Argument name clash (1:37)" + ], + "program": { + "type": "Program", + "start":0,"end":49,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":49}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":49,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":49}}, + "id": { + "type": "Identifier", + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"a"}, + "name": "a" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":13,"end":49,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":49}}, + "body": [ + { + "type": "ExpressionStatement", + "start":29,"end":47,"loc":{"start":{"line":1,"column":29},"end":{"line":1,"column":47}}, + "expression": { + "type": "ObjectExpression", + "start":30,"end":45,"loc":{"start":{"line":1,"column":30},"end":{"line":1,"column":45}}, + "properties": [ + { + "type": "ObjectMethod", + "start":32,"end":43,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":43}}, + "method": true, + "key": { + "type": "Identifier", + "start":32,"end":33,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":33},"identifierName":"b"}, + "name": "b" + }, + "computed": false, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start":34,"end":35,"loc":{"start":{"line":1,"column":34},"end":{"line":1,"column":35},"identifierName":"t"}, + "name": "t" + }, + { + "type": "Identifier", + "start":37,"end":38,"loc":{"start":{"line":1,"column":37},"end":{"line":1,"column":38},"identifierName":"t"}, + "name": "t" + } + ], + "body": { + "type": "BlockStatement", + "start":40,"end":43,"loc":{"start":{"line":1,"column":40},"end":{"line":1,"column":43}}, + "body": [], + "directives": [] + } + } + ], + "extra": { + "parenthesized": true, + "parenStart": 29 + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start":15,"end":28,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":28}}, + "value": { + "type": "DirectiveLiteral", + "start":15,"end":27,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":27}}, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/229/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/229/options.json deleted file mode 100644 index 5c79fd4f4ff2..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/229/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected keyword 'super' (1:4)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/229/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/229/output.json new file mode 100644 index 000000000000..d30f2d17c2b5 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/229/output.json @@ -0,0 +1,33 @@ +{ + "type": "File", + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "errors": [ + "SyntaxError: Unexpected keyword 'super' (1:4)" + ], + "program": { + "type": "Program", + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":4,"end":9,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":9}}, + "id": { + "type": "Identifier", + "start":4,"end":9,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":9},"identifierName":"super"}, + "name": "super" + }, + "init": null + } + ], + "kind": "var" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/23/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/23/output.json index df40feaba7b7..29d1067d3fb1 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/23/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/23/output.json @@ -1,78 +1,23 @@ { "type": "File", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, "expression": { "type": "TemplateLiteral", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, "expressions": [], "quasis": [ { "type": "TemplateElement", - "start": 1, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 4, - "column": 0 - } - }, + "start":1,"end":4,"loc":{"start":{"line":1,"column":1},"end":{"line":4,"column":0}}, "value": { "raw": "\n\n\n", "cooked": "\n\n\n" diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/230/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/230/options.json deleted file mode 100644 index 8a17d90eba69..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/230/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected keyword 'default' (1:4)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/230/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/230/output.json new file mode 100644 index 000000000000..1a676c59c021 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/230/output.json @@ -0,0 +1,33 @@ +{ + "type": "File", + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "errors": [ + "SyntaxError: Unexpected keyword 'default' (1:4)" + ], + "program": { + "type": "Program", + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":4,"end":11,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":11}}, + "id": { + "type": "Identifier", + "start":4,"end":11,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":11},"identifierName":"default"}, + "name": "default" + }, + "init": null + } + ], + "kind": "var" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/231/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/231/options.json deleted file mode 100644 index 8a17d90eba69..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/231/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected keyword 'default' (1:4)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/231/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/231/output.json new file mode 100644 index 000000000000..0e0111a35a2f --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/231/output.json @@ -0,0 +1,33 @@ +{ + "type": "File", + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "errors": [ + "SyntaxError: Unexpected keyword 'default' (1:4)" + ], + "program": { + "type": "Program", + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":4,"end":11,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":11}}, + "id": { + "type": "Identifier", + "start":4,"end":11,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":11},"identifierName":"default"}, + "name": "default" + }, + "init": null + } + ], + "kind": "let" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/232/input.js b/packages/babel-parser/test/fixtures/es2015/uncategorised/232/input.js index 49ff0434557a..5b6b54d778e4 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/232/input.js +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/232/input.js @@ -1 +1 @@ -const default \ No newline at end of file +const default = 2 \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/232/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/232/options.json deleted file mode 100644 index d91e2a5bbc25..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/232/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected keyword 'default' (1:6)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/232/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/232/output.json new file mode 100644 index 000000000000..154ac5251e77 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/232/output.json @@ -0,0 +1,41 @@ +{ + "type": "File", + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, + "errors": [ + "SyntaxError: Unexpected keyword 'default' (1:6)" + ], + "program": { + "type": "Program", + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":6,"end":17,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":17}}, + "id": { + "type": "Identifier", + "start":6,"end":13,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":13},"identifierName":"default"}, + "name": "default" + }, + "init": { + "type": "NumericLiteral", + "start":16,"end":17,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":17}}, + "extra": { + "rawValue": 2, + "raw": "2" + }, + "value": 2 + } + } + ], + "kind": "const" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/233/input.js b/packages/babel-parser/test/fixtures/es2015/uncategorised/233/input.js index 40ac1e2b4639..7afe6af895a0 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/233/input.js +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/233/input.js @@ -1 +1 @@ -"use strict"; ({ v: eval }) = obj \ No newline at end of file +"use strict"; ({ v: eval } = obj) \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/233/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/233/options.json deleted file mode 100644 index 178fa1e528b2..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/233/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Assigning to 'eval' in strict mode (1:20)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/233/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/233/output.json new file mode 100644 index 000000000000..115652eea1e5 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/233/output.json @@ -0,0 +1,71 @@ +{ + "type": "File", + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, + "errors": [ + "SyntaxError: Assigning to 'eval' in strict mode (1:20)" + ], + "program": { + "type": "Program", + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":14,"end":33,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":33}}, + "expression": { + "type": "AssignmentExpression", + "start":15,"end":32,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":32}}, + "operator": "=", + "left": { + "type": "ObjectPattern", + "start":15,"end":26,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":26}}, + "properties": [ + { + "type": "ObjectProperty", + "start":17,"end":24,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":24}}, + "method": false, + "key": { + "type": "Identifier", + "start":17,"end":18,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":18},"identifierName":"v"}, + "name": "v" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "Identifier", + "start":20,"end":24,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":24},"identifierName":"eval"}, + "name": "eval" + } + } + ] + }, + "right": { + "type": "Identifier", + "start":29,"end":32,"loc":{"start":{"line":1,"column":29},"end":{"line":1,"column":32},"identifierName":"obj"}, + "name": "obj" + }, + "extra": { + "parenthesized": true, + "parenStart": 14 + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "value": { + "type": "DirectiveLiteral", + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/234/input.js b/packages/babel-parser/test/fixtures/es2015/uncategorised/234/input.js index cb924f3bb153..2e399474efe9 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/234/input.js +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/234/input.js @@ -1 +1 @@ -"use strict"; ({ v: arguments }) = obj \ No newline at end of file +"use strict"; ({ v: arguments } = obj) \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/234/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/234/options.json deleted file mode 100644 index 4ca97da7ca86..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/234/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Assigning to 'arguments' in strict mode (1:20)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/234/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/234/output.json new file mode 100644 index 000000000000..5521e0e9a34f --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/234/output.json @@ -0,0 +1,71 @@ +{ + "type": "File", + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":38}}, + "errors": [ + "SyntaxError: Assigning to 'arguments' in strict mode (1:20)" + ], + "program": { + "type": "Program", + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":38}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":14,"end":38,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":38}}, + "expression": { + "type": "AssignmentExpression", + "start":15,"end":37,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":37}}, + "operator": "=", + "left": { + "type": "ObjectPattern", + "start":15,"end":31,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":31}}, + "properties": [ + { + "type": "ObjectProperty", + "start":17,"end":29,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":29}}, + "method": false, + "key": { + "type": "Identifier", + "start":17,"end":18,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":18},"identifierName":"v"}, + "name": "v" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "Identifier", + "start":20,"end":29,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":29},"identifierName":"arguments"}, + "name": "arguments" + } + } + ] + }, + "right": { + "type": "Identifier", + "start":34,"end":37,"loc":{"start":{"line":1,"column":34},"end":{"line":1,"column":37},"identifierName":"obj"}, + "name": "obj" + }, + "extra": { + "parenthesized": true, + "parenStart": 14 + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "value": { + "type": "DirectiveLiteral", + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/235/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/235/options.json deleted file mode 100644 index dd3b73e5d533..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/235/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "for-in loop variable declaration may not have an initializer (1:5)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/235/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/235/output.json new file mode 100644 index 000000000000..ae24a82b749c --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/235/output.json @@ -0,0 +1,70 @@ +{ + "type": "File", + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, + "errors": [ + "SyntaxError: for-in loop variable declaration may not have an initializer (1:5)" + ], + "program": { + "type": "Program", + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ForInStatement", + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, + "left": { + "type": "VariableDeclaration", + "start":5,"end":15,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":15}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":9,"end":15,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":15}}, + "id": { + "type": "Identifier", + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"x"}, + "name": "x" + }, + "init": { + "type": "NumericLiteral", + "start":13,"end":15,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":15}}, + "extra": { + "rawValue": 42, + "raw": "42" + }, + "value": 42 + } + } + ], + "kind": "let" + }, + "right": { + "type": "Identifier", + "start":19,"end":23,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":23},"identifierName":"list"}, + "name": "list" + }, + "body": { + "type": "ExpressionStatement", + "start":25,"end":36,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":36}}, + "expression": { + "type": "CallExpression", + "start":25,"end":35,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":35}}, + "callee": { + "type": "Identifier", + "start":25,"end":32,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":32},"identifierName":"process"}, + "name": "process" + }, + "arguments": [ + { + "type": "Identifier", + "start":33,"end":34,"loc":{"start":{"line":1,"column":33},"end":{"line":1,"column":34},"identifierName":"x"}, + "name": "x" + } + ] + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/236/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/236/options.json deleted file mode 100644 index c145a86bc613..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/236/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "for-of loop variable declaration may not have an initializer (1:5)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/236/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/236/output.json new file mode 100644 index 000000000000..70e5c2df0d16 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/236/output.json @@ -0,0 +1,71 @@ +{ + "type": "File", + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, + "errors": [ + "SyntaxError: for-of loop variable declaration may not have an initializer (1:5)" + ], + "program": { + "type": "Program", + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ForOfStatement", + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, + "await": false, + "left": { + "type": "VariableDeclaration", + "start":5,"end":15,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":15}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":9,"end":15,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":15}}, + "id": { + "type": "Identifier", + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"x"}, + "name": "x" + }, + "init": { + "type": "NumericLiteral", + "start":13,"end":15,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":15}}, + "extra": { + "rawValue": 42, + "raw": "42" + }, + "value": 42 + } + } + ], + "kind": "let" + }, + "right": { + "type": "Identifier", + "start":19,"end":23,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":23},"identifierName":"list"}, + "name": "list" + }, + "body": { + "type": "ExpressionStatement", + "start":25,"end":36,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":36}}, + "expression": { + "type": "CallExpression", + "start":25,"end":35,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":35}}, + "callee": { + "type": "Identifier", + "start":25,"end":32,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":32},"identifierName":"process"}, + "name": "process" + }, + "arguments": [ + { + "type": "Identifier", + "start":33,"end":34,"loc":{"start":{"line":1,"column":33},"end":{"line":1,"column":34},"identifierName":"x"}, + "name": "x" + } + ] + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/24/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/24/output.json index 47aff076cf80..5a206c9a3cd4 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/24/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/24/output.json @@ -1,78 +1,23 @@ { "type": "File", - "start": 0, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, "program": { "type": "Program", - "start": 0, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, "expression": { "type": "TemplateLiteral", - "start": 0, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, "expressions": [], "quasis": [ { "type": "TemplateElement", - "start": 1, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":1,"end":25,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":25}}, "value": { "raw": "\\u{000042}\\u0042\\x42u0\\A", "cooked": "BBBu0A" diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/242/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/242/options.json deleted file mode 100644 index 02a0eafbbbbe..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/242/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Assigning to 'eval' in strict mode (1:15)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/242/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/242/output.json new file mode 100644 index 000000000000..cca401d0d14b --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/242/output.json @@ -0,0 +1,71 @@ +{ + "type": "File", + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, + "errors": [ + "SyntaxError: Assigning to 'eval' in strict mode (1:15)", + "SyntaxError: Binding 'eval' in strict mode (1:15)" + ], + "program": { + "type": "Program", + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":14,"end":31,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":31}}, + "expression": { + "type": "ArrowFunctionExpression", + "start":14,"end":31,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":31}}, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "AssignmentPattern", + "start":15,"end":24,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":24}}, + "left": { + "type": "Identifier", + "start":15,"end":19,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":19},"identifierName":"eval"}, + "name": "eval" + }, + "right": { + "type": "NumericLiteral", + "start":22,"end":24,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":24}}, + "extra": { + "rawValue": 10, + "raw": "10" + }, + "value": 10 + } + } + ], + "body": { + "type": "NumericLiteral", + "start":29,"end":31,"loc":{"start":{"line":1,"column":29},"end":{"line":1,"column":31}}, + "extra": { + "rawValue": 42, + "raw": "42" + }, + "value": 42 + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "value": { + "type": "DirectiveLiteral", + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/243/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/243/options.json deleted file mode 100644 index e4abe279ab29..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/243/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'eval' in strict mode (1:14)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/243/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/243/output.json new file mode 100644 index 000000000000..8e8d8419af7a --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/243/output.json @@ -0,0 +1,57 @@ +{ + "type": "File", + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, + "errors": [ + "SyntaxError: Binding 'eval' in strict mode (1:14)" + ], + "program": { + "type": "Program", + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":14,"end":24,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":24}}, + "expression": { + "type": "ArrowFunctionExpression", + "start":14,"end":24,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":24}}, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start":14,"end":18,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":18},"identifierName":"eval"}, + "name": "eval" + } + ], + "body": { + "type": "NumericLiteral", + "start":22,"end":24,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":24}}, + "extra": { + "rawValue": 42, + "raw": "42" + }, + "value": 42 + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "value": { + "type": "DirectiveLiteral", + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/244/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/244/options.json deleted file mode 100644 index c2a4aaec255e..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/244/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'arguments' in strict mode (1:14)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/244/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/244/output.json new file mode 100644 index 000000000000..5a18ea14d881 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/244/output.json @@ -0,0 +1,57 @@ +{ + "type": "File", + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, + "errors": [ + "SyntaxError: Binding 'arguments' in strict mode (1:14)" + ], + "program": { + "type": "Program", + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":14,"end":29,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":29}}, + "expression": { + "type": "ArrowFunctionExpression", + "start":14,"end":29,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":29}}, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start":14,"end":23,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":23},"identifierName":"arguments"}, + "name": "arguments" + } + ], + "body": { + "type": "NumericLiteral", + "start":27,"end":29,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":29}}, + "extra": { + "rawValue": 42, + "raw": "42" + }, + "value": 42 + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "value": { + "type": "DirectiveLiteral", + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/245/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/245/options.json deleted file mode 100644 index d93d5b2aa62e..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/245/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'eval' in strict mode (1:15)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/245/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/245/output.json new file mode 100644 index 000000000000..c5a150d343ad --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/245/output.json @@ -0,0 +1,62 @@ +{ + "type": "File", + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, + "errors": [ + "SyntaxError: Binding 'eval' in strict mode (1:15)" + ], + "program": { + "type": "Program", + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":14,"end":29,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":29}}, + "expression": { + "type": "ArrowFunctionExpression", + "start":14,"end":29,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":29}}, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start":15,"end":19,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":19},"identifierName":"eval"}, + "name": "eval" + }, + { + "type": "Identifier", + "start":21,"end":22,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":22},"identifierName":"a"}, + "name": "a" + } + ], + "body": { + "type": "NumericLiteral", + "start":27,"end":29,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":29}}, + "extra": { + "rawValue": 42, + "raw": "42" + }, + "value": 42 + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "value": { + "type": "DirectiveLiteral", + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/246/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/246/options.json deleted file mode 100644 index 5d2dc563b16e..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/246/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'arguments' in strict mode (1:15)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/246/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/246/output.json new file mode 100644 index 000000000000..402704e9deb8 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/246/output.json @@ -0,0 +1,62 @@ +{ + "type": "File", + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, + "errors": [ + "SyntaxError: Binding 'arguments' in strict mode (1:15)" + ], + "program": { + "type": "Program", + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":14,"end":34,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":34}}, + "expression": { + "type": "ArrowFunctionExpression", + "start":14,"end":34,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":34}}, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start":15,"end":24,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":24},"identifierName":"arguments"}, + "name": "arguments" + }, + { + "type": "Identifier", + "start":26,"end":27,"loc":{"start":{"line":1,"column":26},"end":{"line":1,"column":27},"identifierName":"a"}, + "name": "a" + } + ], + "body": { + "type": "NumericLiteral", + "start":32,"end":34,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":34}}, + "extra": { + "rawValue": 42, + "raw": "42" + }, + "value": 42 + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "value": { + "type": "DirectiveLiteral", + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/247/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/247/options.json deleted file mode 100644 index d93d5b2aa62e..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/247/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'eval' in strict mode (1:15)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/247/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/247/output.json new file mode 100644 index 000000000000..db4f4a90fe06 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/247/output.json @@ -0,0 +1,75 @@ +{ + "type": "File", + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, + "errors": [ + "SyntaxError: Binding 'eval' in strict mode (1:15)" + ], + "program": { + "type": "Program", + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":14,"end":34,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":34}}, + "expression": { + "type": "ArrowFunctionExpression", + "start":14,"end":34,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":34}}, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start":15,"end":19,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":19},"identifierName":"eval"}, + "name": "eval" + }, + { + "type": "AssignmentPattern", + "start":21,"end":27,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":27}}, + "left": { + "type": "Identifier", + "start":21,"end":22,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":22},"identifierName":"a"}, + "name": "a" + }, + "right": { + "type": "NumericLiteral", + "start":25,"end":27,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":27}}, + "extra": { + "rawValue": 10, + "raw": "10" + }, + "value": 10 + } + } + ], + "body": { + "type": "NumericLiteral", + "start":32,"end":34,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":34}}, + "extra": { + "rawValue": 42, + "raw": "42" + }, + "value": 42 + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "value": { + "type": "DirectiveLiteral", + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/248/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/248/options.json deleted file mode 100644 index b99fd35222b1..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/248/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Argument name clash (1:18)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/248/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/248/output.json new file mode 100644 index 000000000000..e552560189df --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/248/output.json @@ -0,0 +1,62 @@ +{ + "type": "File", + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, + "errors": [ + "SyntaxError: Argument name clash (1:18)" + ], + "program": { + "type": "Program", + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":14,"end":26,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":26}}, + "expression": { + "type": "ArrowFunctionExpression", + "start":14,"end":26,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":26}}, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start":15,"end":16,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":16},"identifierName":"a"}, + "name": "a" + }, + { + "type": "Identifier", + "start":18,"end":19,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":19},"identifierName":"a"}, + "name": "a" + } + ], + "body": { + "type": "NumericLiteral", + "start":24,"end":26,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":26}}, + "extra": { + "rawValue": 42, + "raw": "42" + }, + "value": 42 + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "value": { + "type": "DirectiveLiteral", + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/249/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/249/options.json deleted file mode 100644 index 79a05e62290e..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/249/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Legacy octal literals are not allowed in strict mode (1:21)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/249/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/249/output.json new file mode 100644 index 000000000000..70812a59cc6a --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/249/output.json @@ -0,0 +1,57 @@ +{ + "type": "File", + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, + "errors": [ + "SyntaxError: Legacy octal literals are not allowed in strict mode (1:21)" + ], + "program": { + "type": "Program", + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":14,"end":23,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":23}}, + "expression": { + "type": "ArrowFunctionExpression", + "start":14,"end":23,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":23}}, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start":15,"end":16,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":16},"identifierName":"a"}, + "name": "a" + } + ], + "body": { + "type": "NumericLiteral", + "start":21,"end":23,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":23}}, + "extra": { + "rawValue": 0, + "raw": "00" + }, + "value": 0 + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "value": { + "type": "DirectiveLiteral", + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/25/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/25/output.json index 646a2349df2e..0189e907f5ea 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/25/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/25/output.json @@ -1,123 +1,34 @@ { "type": "File", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "program": { "type": "Program", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "expression": { "type": "NewExpression", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "callee": { "type": "TaggedTemplateExpression", - "start": 4, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":4,"end":11,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":11}}, "tag": { "type": "Identifier", - "start": 4, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "raw" - }, + "start":4,"end":7,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":7},"identifierName":"raw"}, "name": "raw" }, "quasi": { "type": "TemplateLiteral", - "start": 7, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":7,"end":11,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":11}}, "expressions": [], "quasis": [ { "type": "TemplateElement", - "start": 8, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":8,"end":10,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":10}}, "value": { "raw": "42", "cooked": "42" diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/251/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/251/options.json deleted file mode 100644 index 99ffc0de0153..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/251/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid left-hand side in arrow function parameters (1:1)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/251/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/251/output.json new file mode 100644 index 000000000000..6b624a3ee404 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/251/output.json @@ -0,0 +1,47 @@ +{ + "type": "File", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "errors": [ + "SyntaxError: Binding invalid left-hand side in function parameter list (1:1)" + ], + "program": { + "type": "Program", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "expression": { + "type": "ArrowFunctionExpression", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "NumericLiteral", + "start":1,"end":3,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":3}}, + "extra": { + "rawValue": 10, + "raw": "10" + }, + "value": 10 + } + ], + "body": { + "type": "NumericLiteral", + "start":8,"end":10,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":10}}, + "extra": { + "rawValue": 0, + "raw": "00" + }, + "value": 0 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/252/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/252/options.json deleted file mode 100644 index 99ffc0de0153..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/252/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid left-hand side in arrow function parameters (1:1)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/252/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/252/output.json new file mode 100644 index 000000000000..06d87dffa42f --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/252/output.json @@ -0,0 +1,57 @@ +{ + "type": "File", + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, + "errors": [ + "SyntaxError: Binding invalid left-hand side in function parameter list (1:1)", + "SyntaxError: Binding invalid left-hand side in function parameter list (1:5)" + ], + "program": { + "type": "Program", + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, + "expression": { + "type": "ArrowFunctionExpression", + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "NumericLiteral", + "start":1,"end":3,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":3}}, + "extra": { + "rawValue": 10, + "raw": "10" + }, + "value": 10 + }, + { + "type": "NumericLiteral", + "start":5,"end":7,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":7}}, + "extra": { + "rawValue": 20, + "raw": "20" + }, + "value": 20 + } + ], + "body": { + "type": "NumericLiteral", + "start":12,"end":14,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":14}}, + "extra": { + "rawValue": 0, + "raw": "00" + }, + "value": 0 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/26/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/26/output.json index 09b757b7e04c..07eb105001dd 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/26/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/26/output.json @@ -1,175 +1,52 @@ { "type": "File", - "start": 0, - "end": 70, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 70 - } - }, + "start":0,"end":70,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":70}}, "program": { "type": "Program", - "start": 0, - "end": 70, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 70 - } - }, + "start":0,"end":70,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":70}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 70, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 70 - } - }, + "start":0,"end":70,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":70}}, "expression": { "type": "TemplateLiteral", - "start": 0, - "end": 70, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 70 - } - }, + "start":0,"end":70,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":70}}, "expressions": [ { "type": "ObjectExpression", - "start": 8, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":8,"end":20,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":20}}, "properties": [ { "type": "ObjectProperty", - "start": 9, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":9,"end":19,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":19}}, "method": false, "key": { "type": "Identifier", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - }, - "identifierName": "x" - }, + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"x"}, "name": "x" }, "computed": false, "shorthand": false, "value": { "type": "ObjectExpression", - "start": 12, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":12,"end":19,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":19}}, "properties": [ { "type": "ObjectProperty", - "start": 13, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":13,"end":18,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":18}}, "method": false, "key": { "type": "Identifier", - "start": 13, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - }, - "identifierName": "y" - }, + "start":13,"end":14,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":14},"identifierName":"y"}, "name": "y" }, "computed": false, "shorthand": false, "value": { "type": "NumericLiteral", - "start": 16, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":16,"end":18,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":18}}, "extra": { "rawValue": 10, "raw": "10" @@ -184,80 +61,25 @@ }, { "type": "TemplateLiteral", - "start": 26, - "end": 65, - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 65 - } - }, + "start":26,"end":65,"loc":{"start":{"line":1,"column":26},"end":{"line":1,"column":65}}, "expressions": [ { "type": "FunctionExpression", - "start": 35, - "end": 56, - "loc": { - "start": { - "line": 1, - "column": 35 - }, - "end": { - "line": 1, - "column": 56 - } - }, + "start":35,"end":56,"loc":{"start":{"line":1,"column":35},"end":{"line":1,"column":56}}, "id": null, "generator": false, "async": false, "params": [], "body": { "type": "BlockStatement", - "start": 45, - "end": 56, - "loc": { - "start": { - "line": 1, - "column": 45 - }, - "end": { - "line": 1, - "column": 56 - } - }, + "start":45,"end":56,"loc":{"start":{"line":1,"column":45},"end":{"line":1,"column":56}}, "body": [ { "type": "ReturnStatement", - "start": 46, - "end": 55, - "loc": { - "start": { - "line": 1, - "column": 46 - }, - "end": { - "line": 1, - "column": 55 - } - }, + "start":46,"end":55,"loc":{"start":{"line":1,"column":46},"end":{"line":1,"column":55}}, "argument": { "type": "NumericLiteral", - "start": 53, - "end": 54, - "loc": { - "start": { - "line": 1, - "column": 53 - }, - "end": { - "line": 1, - "column": 54 - } - }, + "start":53,"end":54,"loc":{"start":{"line":1,"column":53},"end":{"line":1,"column":54}}, "extra": { "rawValue": 1, "raw": "1" @@ -273,18 +95,7 @@ "quasis": [ { "type": "TemplateElement", - "start": 27, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":27,"end":33,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":33}}, "value": { "raw": "nested", "cooked": "nested" @@ -293,18 +104,7 @@ }, { "type": "TemplateElement", - "start": 57, - "end": 64, - "loc": { - "start": { - "line": 1, - "column": 57 - }, - "end": { - "line": 1, - "column": 64 - } - }, + "start":57,"end":64,"loc":{"start":{"line":1,"column":57},"end":{"line":1,"column":64}}, "value": { "raw": "endnest", "cooked": "endnest" @@ -317,18 +117,7 @@ "quasis": [ { "type": "TemplateElement", - "start": 1, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":1,"end":6,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":6}}, "value": { "raw": "outer", "cooked": "outer" @@ -337,18 +126,7 @@ }, { "type": "TemplateElement", - "start": 21, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":21,"end":24,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":24}}, "value": { "raw": "bar", "cooked": "bar" @@ -357,18 +135,7 @@ }, { "type": "TemplateElement", - "start": 66, - "end": 69, - "loc": { - "start": { - "line": 1, - "column": 66 - }, - "end": { - "line": 1, - "column": 69 - } - }, + "start":66,"end":69,"loc":{"start":{"line":1,"column":66},"end":{"line":1,"column":69}}, "value": { "raw": "end", "cooked": "end" diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/27/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/27/output.json index 0d2a9ed4dc15..4af86db4bc03 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/27/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/27/output.json @@ -1,141 +1,40 @@ { "type": "File", - "start": 0, - "end": 47, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 47 - } - }, + "start":0,"end":47,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":47}}, "program": { "type": "Program", - "start": 0, - "end": 47, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 47 - } - }, + "start":0,"end":47,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":47}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "SwitchStatement", - "start": 0, - "end": 47, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 47 - } - }, + "start":0,"end":47,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":47}}, "discriminant": { "type": "Identifier", - "start": 8, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 14 - }, - "identifierName": "answer" - }, + "start":8,"end":14,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":14},"identifierName":"answer"}, "name": "answer" }, "cases": [ { "type": "SwitchCase", - "start": 18, - "end": 45, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 45 - } - }, + "start":18,"end":45,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":45}}, "consequent": [ { "type": "VariableDeclaration", - "start": 27, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":27,"end":38,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":38}}, "declarations": [ { "type": "VariableDeclarator", - "start": 31, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 31 - }, - "end": { - "line": 1, - "column": 37 - } - }, + "start":31,"end":37,"loc":{"start":{"line":1,"column":31},"end":{"line":1,"column":37}}, "id": { "type": "Identifier", - "start": 31, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 31 - }, - "end": { - "line": 1, - "column": 32 - }, - "identifierName": "t" - }, + "start":31,"end":32,"loc":{"start":{"line":1,"column":31},"end":{"line":1,"column":32},"identifierName":"t"}, "name": "t" }, "init": { "type": "NumericLiteral", - "start": 35, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 35 - }, - "end": { - "line": 1, - "column": 37 - } - }, + "start":35,"end":37,"loc":{"start":{"line":1,"column":35},"end":{"line":1,"column":37}}, "extra": { "rawValue": 42, "raw": "42" @@ -148,35 +47,13 @@ }, { "type": "BreakStatement", - "start": 39, - "end": 45, - "loc": { - "start": { - "line": 1, - "column": 39 - }, - "end": { - "line": 1, - "column": 45 - } - }, + "start":39,"end":45,"loc":{"start":{"line":1,"column":39},"end":{"line":1,"column":45}}, "label": null } ], "test": { "type": "NumericLiteral", - "start": 23, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":23,"end":25,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":25}}, "extra": { "rawValue": 42, "raw": "42" diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/279/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/279/output.json index 081fe15730f0..cfcf370f5c8a 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/279/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/279/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "program": { "type": "Program", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "id": { "type": "Identifier", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - }, - "identifierName": "x" - }, + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"x"}, "name": "x" }, "generator": false, @@ -65,82 +20,25 @@ "params": [ { "type": "RestElement", - "start": 11, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":11,"end":19,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":19}}, "argument": { "type": "ObjectPattern", - "start": 14, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":14,"end":19,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":19}}, "properties": [ { "type": "ObjectProperty", - "start": 16, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":16,"end":17,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":17}}, "method": false, "key": { "type": "Identifier", - "start": 16, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - }, - "identifierName": "a" - }, + "start":16,"end":17,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":17},"identifierName":"a"}, "name": "a" }, "computed": false, "shorthand": true, "value": { "type": "Identifier", - "start": 16, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - }, - "identifierName": "a" - }, + "start":16,"end":17,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":17},"identifierName":"a"}, "name": "a" }, "extra": { @@ -153,18 +51,7 @@ ], "body": { "type": "BlockStatement", - "start": 20, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":20,"end":22,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":22}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/28/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/28/output.json index c59ac797ad5e..c14b141b098f 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/28/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/28/output.json @@ -1,80 +1,25 @@ { "type": "File", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, "program": { "type": "Program", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, "expression": { "type": "ArrowFunctionExpression", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, "id": null, "generator": false, "async": false, "params": [], "body": { "type": "StringLiteral", - "start": 6, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":6,"end":12,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":12}}, "extra": { "rawValue": "test", "raw": "\"test\"" diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/280/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/280/options.json deleted file mode 100644 index 5cbee309bd50..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/280/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Argument name clash (1:30)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/280/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/280/output.json new file mode 100644 index 000000000000..bdb28643723e --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/280/output.json @@ -0,0 +1,80 @@ +{ + "type": "File", + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, + "errors": [ + "SyntaxError: Argument name clash (1:30)" + ], + "program": { + "type": "Program", + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":14,"end":36,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":36}}, + "id": { + "type": "Identifier", + "start":23,"end":24,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":24},"identifierName":"x"}, + "name": "x" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start":25,"end":26,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":26},"identifierName":"a"}, + "name": "a" + }, + { + "type": "ObjectPattern", + "start":28,"end":33,"loc":{"start":{"line":1,"column":28},"end":{"line":1,"column":33}}, + "properties": [ + { + "type": "ObjectProperty", + "start":30,"end":31,"loc":{"start":{"line":1,"column":30},"end":{"line":1,"column":31}}, + "method": false, + "key": { + "type": "Identifier", + "start":30,"end":31,"loc":{"start":{"line":1,"column":30},"end":{"line":1,"column":31},"identifierName":"a"}, + "name": "a" + }, + "computed": false, + "shorthand": true, + "value": { + "type": "Identifier", + "start":30,"end":31,"loc":{"start":{"line":1,"column":30},"end":{"line":1,"column":31},"identifierName":"a"}, + "name": "a" + }, + "extra": { + "shorthand": true + } + } + ] + } + ], + "body": { + "type": "BlockStatement", + "start":34,"end":36,"loc":{"start":{"line":1,"column":34},"end":{"line":1,"column":36}}, + "body": [], + "directives": [] + } + } + ], + "directives": [ + { + "type": "Directive", + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "value": { + "type": "DirectiveLiteral", + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/281/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/281/options.json deleted file mode 100644 index 8dba9882c0dc..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/281/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Argument name clash (1:47)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/281/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/281/output.json new file mode 100644 index 000000000000..f2543aba9796 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/281/output.json @@ -0,0 +1,143 @@ +{ + "type": "File", + "start":0,"end":56,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":56}}, + "errors": [ + "SyntaxError: Argument name clash (1:47)" + ], + "program": { + "type": "Program", + "start":0,"end":56,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":56}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":14,"end":56,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":56}}, + "id": { + "type": "Identifier", + "start":23,"end":24,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":24},"identifierName":"x"}, + "name": "x" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "ObjectPattern", + "start":25,"end":37,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":37}}, + "properties": [ + { + "type": "ObjectProperty", + "start":27,"end":35,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":35}}, + "method": false, + "key": { + "type": "Identifier", + "start":27,"end":28,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":28},"identifierName":"b"}, + "name": "b" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "ObjectPattern", + "start":30,"end":35,"loc":{"start":{"line":1,"column":30},"end":{"line":1,"column":35}}, + "properties": [ + { + "type": "ObjectProperty", + "start":32,"end":33,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":33}}, + "method": false, + "key": { + "type": "Identifier", + "start":32,"end":33,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":33},"identifierName":"a"}, + "name": "a" + }, + "computed": false, + "shorthand": true, + "value": { + "type": "Identifier", + "start":32,"end":33,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":33},"identifierName":"a"}, + "name": "a" + }, + "extra": { + "shorthand": true + } + } + ] + } + } + ] + }, + { + "type": "ArrayPattern", + "start":39,"end":53,"loc":{"start":{"line":1,"column":39},"end":{"line":1,"column":53}}, + "elements": [ + { + "type": "ObjectPattern", + "start":40,"end":52,"loc":{"start":{"line":1,"column":40},"end":{"line":1,"column":52}}, + "properties": [ + { + "type": "ObjectProperty", + "start":42,"end":50,"loc":{"start":{"line":1,"column":42},"end":{"line":1,"column":50}}, + "method": false, + "key": { + "type": "Identifier", + "start":42,"end":43,"loc":{"start":{"line":1,"column":42},"end":{"line":1,"column":43},"identifierName":"b"}, + "name": "b" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "ObjectPattern", + "start":45,"end":50,"loc":{"start":{"line":1,"column":45},"end":{"line":1,"column":50}}, + "properties": [ + { + "type": "ObjectProperty", + "start":47,"end":48,"loc":{"start":{"line":1,"column":47},"end":{"line":1,"column":48}}, + "method": false, + "key": { + "type": "Identifier", + "start":47,"end":48,"loc":{"start":{"line":1,"column":47},"end":{"line":1,"column":48},"identifierName":"a"}, + "name": "a" + }, + "computed": false, + "shorthand": true, + "value": { + "type": "Identifier", + "start":47,"end":48,"loc":{"start":{"line":1,"column":47},"end":{"line":1,"column":48},"identifierName":"a"}, + "name": "a" + }, + "extra": { + "shorthand": true + } + } + ] + } + } + ] + } + ] + } + ], + "body": { + "type": "BlockStatement", + "start":54,"end":56,"loc":{"start":{"line":1,"column":54},"end":{"line":1,"column":56}}, + "body": [], + "directives": [] + } + } + ], + "directives": [ + { + "type": "Directive", + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "value": { + "type": "DirectiveLiteral", + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/284/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/284/options.json deleted file mode 100644 index 71f5061aff9a..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/284/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid left-hand side in arrow function parameters (1:3)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/284/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/284/output.json new file mode 100644 index 000000000000..dba83d09de2a --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/284/output.json @@ -0,0 +1,50 @@ +{ + "type": "File", + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "errors": [ + "SyntaxError: Binding invalid left-hand side in array destructuring pattern (1:3)" + ], + "program": { + "type": "Program", + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "expression": { + "type": "ArrowFunctionExpression", + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "ArrayPattern", + "start":1,"end":6,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":6}}, + "elements": [ + { + "type": "NumericLiteral", + "start":3,"end":4,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":4}}, + "extra": { + "rawValue": 5, + "raw": "5" + }, + "value": 5 + } + ] + } + ], + "body": { + "type": "BlockStatement", + "start":11,"end":13,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":13}}, + "body": [], + "directives": [] + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/287/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/287/output.json index 1c442ac1c6b8..b10e8612e212 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/287/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/287/output.json @@ -1,156 +1,44 @@ { "type": "File", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "program": { "type": "Program", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "expression": { "type": "AssignmentExpression", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "operator": "=", "left": { "type": "ArrayPattern", - "start": 0, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, "elements": [ { "type": "RestElement", - "start": 1, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":1,"end":9,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":9}}, "argument": { "type": "ObjectPattern", - "start": 4, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":4,"end":9,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":9}}, "properties": [ { "type": "ObjectProperty", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7}}, "method": false, "key": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "a" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"a"}, "name": "a" }, "computed": false, "shorthand": true, "value": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "a" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"a"}, "name": "a" }, "extra": { @@ -164,19 +52,7 @@ }, "right": { "type": "Identifier", - "start": 13, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - }, - "identifierName": "b" - }, + "start":13,"end":14,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":14},"identifierName":"b"}, "name": "b" } } diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/289/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/289/options.json deleted file mode 100644 index 8ed5553896c1..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/289/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'eval' in strict mode (1:5)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/289/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/289/output.json new file mode 100644 index 000000000000..38f67c246355 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/289/output.json @@ -0,0 +1,72 @@ +{ + "type": "File", + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, + "errors": [ + "SyntaxError: Binding 'eval' in strict mode (1:5)" + ], + "program": { + "type": "Program", + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, + "expression": { + "type": "ObjectExpression", + "start":1,"end":30,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":30}}, + "properties": [ + { + "type": "ObjectMethod", + "start":3,"end":28,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":28}}, + "method": true, + "key": { + "type": "Identifier", + "start":3,"end":4,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":4},"identifierName":"t"}, + "name": "t" + }, + "computed": false, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start":5,"end":9,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":9},"identifierName":"eval"}, + "name": "eval" + } + ], + "body": { + "type": "BlockStatement", + "start":11,"end":28,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":28}}, + "body": [], + "directives": [ + { + "type": "Directive", + "start":13,"end":26,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":26}}, + "value": { + "type": "DirectiveLiteral", + "start":13,"end":25,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":25}}, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "extra": { + "parenthesized": true, + "parenStart": 0 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/29/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/29/output.json index 728dfb405136..9618fdfb2c40 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/29/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/29/output.json @@ -1,98 +1,31 @@ { "type": "File", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "program": { "type": "Program", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "expression": { "type": "ArrowFunctionExpression", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "id": null, "generator": false, "async": false, "params": [ { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "e" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"e"}, "name": "e" } ], "body": { "type": "StringLiteral", - "start": 5, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":5,"end":11,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":11}}, "extra": { "rawValue": "test", "raw": "\"test\"" diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/290/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/290/options.json deleted file mode 100644 index 473cd470d4f1..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/290/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:23)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/290/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/290/output.json new file mode 100644 index 000000000000..2eb965567548 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/290/output.json @@ -0,0 +1,65 @@ +{ + "type": "File", + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:23)" + ], + "program": { + "type": "Program", + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":14,"end":27,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":27}}, + "expression": { + "type": "TemplateLiteral", + "start":14,"end":26,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":26}}, + "expressions": [ + { + "type": "Identifier", + "start":17,"end":21,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":21},"identifierName":"test"}, + "name": "test" + } + ], + "quasis": [ + { + "type": "TemplateElement", + "start":15,"end":15,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":15}}, + "value": { + "raw": "", + "cooked": "" + }, + "tail": false + }, + { + "type": "TemplateElement", + "start":22,"end":25,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":25}}, + "value": { + "raw": "\\02", + "cooked": null + }, + "tail": true + } + ] + } + } + ], + "directives": [ + { + "type": "Directive", + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "value": { + "type": "DirectiveLiteral", + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/291/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/291/options.json deleted file mode 100644 index ae24fbee33c8..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/291/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "'import' and 'export' may only appear at the top level (1:7)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/291/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/291/output.json new file mode 100644 index 000000000000..c87a88a757b7 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/291/output.json @@ -0,0 +1,45 @@ +{ + "type": "File", + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, + "errors": [ + "SyntaxError: 'import' and 'export' may only appear at the top level (1:7)", + "SyntaxError: 'import' and 'export' may appear only with 'sourceType: \"module\"' (1:7)" + ], + "program": { + "type": "Program", + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "IfStatement", + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, + "test": { + "type": "NumericLiteral", + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5}}, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + }, + "consequent": { + "type": "ImportDeclaration", + "start":7,"end":22,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":22}}, + "specifiers": [], + "source": { + "type": "StringLiteral", + "start":14,"end":21,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":21}}, + "extra": { + "rawValue": "acorn", + "raw": "\"acorn\"" + }, + "value": "acorn" + } + }, + "alternate": null + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/296/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/296/options.json deleted file mode 100644 index d93d5b2aa62e..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/296/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'eval' in strict mode (1:15)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/296/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/296/output.json new file mode 100644 index 000000000000..8515329a04e1 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/296/output.json @@ -0,0 +1,57 @@ +{ + "type": "File", + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, + "errors": [ + "SyntaxError: Binding 'eval' in strict mode (1:15)" + ], + "program": { + "type": "Program", + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":14,"end":26,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":26}}, + "expression": { + "type": "ArrowFunctionExpression", + "start":14,"end":26,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":26}}, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start":15,"end":19,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":19},"identifierName":"eval"}, + "name": "eval" + } + ], + "body": { + "type": "NumericLiteral", + "start":24,"end":26,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":26}}, + "extra": { + "rawValue": 42, + "raw": "42" + }, + "value": 42 + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "value": { + "type": "DirectiveLiteral", + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/297/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/297/options.json deleted file mode 100644 index 224716db8070..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/297/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'eval' in strict mode (1:1)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/297/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/297/output.json new file mode 100644 index 000000000000..16f6411a562b --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/297/output.json @@ -0,0 +1,68 @@ +{ + "type": "File", + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, + "errors": [ + "SyntaxError: Binding 'eval' in strict mode (1:1)" + ], + "program": { + "type": "Program", + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, + "expression": { + "type": "ArrowFunctionExpression", + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start":1,"end":5,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":5},"identifierName":"eval"}, + "name": "eval" + } + ], + "body": { + "type": "BlockStatement", + "start":10,"end":30,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":30}}, + "body": [ + { + "type": "ExpressionStatement", + "start":26,"end":28,"loc":{"start":{"line":1,"column":26},"end":{"line":1,"column":28}}, + "expression": { + "type": "NumericLiteral", + "start":26,"end":28,"loc":{"start":{"line":1,"column":26},"end":{"line":1,"column":28}}, + "extra": { + "rawValue": 42, + "raw": "42" + }, + "value": 42 + } + } + ], + "directives": [ + { + "type": "Directive", + "start":12,"end":25,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":25}}, + "value": { + "type": "DirectiveLiteral", + "start":12,"end":24,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":24}}, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/298/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/298/options.json deleted file mode 100644 index 49d27a1476b0..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/298/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Object pattern can't contain getter or setter (1:7)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/298/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/298/output.json new file mode 100644 index 000000000000..86c9ce21554e --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/298/output.json @@ -0,0 +1,66 @@ +{ + "type": "File", + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, + "errors": [ + "SyntaxError: Object pattern can't contain getter or setter (1:7)" + ], + "program": { + "type": "Program", + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, + "expression": { + "type": "ArrowFunctionExpression", + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "ObjectPattern", + "start":1,"end":19,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":19}}, + "properties": [ + { + "type": "ObjectMethod", + "start":3,"end":17,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":17}}, + "method": false, + "key": { + "type": "Identifier", + "start":7,"end":11,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":11},"identifierName":"test"}, + "name": "test" + }, + "computed": false, + "kind": "get", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":14,"end":17,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":17}}, + "body": [], + "directives": [] + } + } + ] + } + ], + "body": { + "type": "NumericLiteral", + "start":24,"end":26,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":26}}, + "extra": { + "rawValue": 42, + "raw": "42" + }, + "value": 42 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/299/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/299/output.json index 0cd40feef9eb..fffbe0878a53 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/299/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/299/output.json @@ -1,176 +1,50 @@ { "type": "File", - "start": 0, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, "program": { "type": "Program", - "start": 0, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, "expression": { "type": "CallExpression", - "start": 0, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, "callee": { "type": "Identifier", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "doSmth" - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6},"identifierName":"doSmth"}, "name": "doSmth" }, "arguments": [ { "type": "TemplateLiteral", - "start": 7, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":7,"end":31,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":31}}, "expressions": [ { "type": "Identifier", - "start": 10, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "x" - }, + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11},"identifierName":"x"}, "name": "x" }, { "type": "Identifier", - "start": 17, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - }, - "identifierName": "y" - }, + "start":17,"end":18,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":18},"identifierName":"y"}, "name": "y" }, { "type": "BinaryExpression", - "start": 24, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":24,"end":29,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":29}}, "left": { "type": "Identifier", - "start": 24, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 25 - }, - "identifierName": "x" - }, + "start":24,"end":25,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":25},"identifierName":"x"}, "name": "x" }, "operator": "+", "right": { "type": "Identifier", - "start": 28, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 29 - }, - "identifierName": "y" - }, + "start":28,"end":29,"loc":{"start":{"line":1,"column":28},"end":{"line":1,"column":29},"identifierName":"y"}, "name": "y" } } @@ -178,18 +52,7 @@ "quasis": [ { "type": "TemplateElement", - "start": 8, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":8,"end":8,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":8}}, "value": { "raw": "", "cooked": "" @@ -198,18 +61,7 @@ }, { "type": "TemplateElement", - "start": 12, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":12,"end":15,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":15}}, "value": { "raw": " + ", "cooked": " + " @@ -218,18 +70,7 @@ }, { "type": "TemplateElement", - "start": 19, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":19,"end":22,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":22}}, "value": { "raw": " = ", "cooked": " = " @@ -238,18 +79,7 @@ }, { "type": "TemplateElement", - "start": 30, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":30,"end":30,"loc":{"start":{"line":1,"column":30},"end":{"line":1,"column":30}}, "value": { "raw": "", "cooked": "" diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/3/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/3/output.json index b1465d1f5423..fbed9f8857d5 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/3/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/3/output.json @@ -1,62 +1,18 @@ { "type": "File", - "start": 0, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 2 - } - }, + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}}, "program": { "type": "Program", - "start": 0, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 2 - } - }, + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 2 - } - }, + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}}, "expression": { "type": "NumericLiteral", - "start": 0, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 2 - } - }, + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}}, "extra": { "rawValue": 0, "raw": "00" diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/30/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/30/output.json index c2375ef25d9f..0d0d28d7f1bf 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/30/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/30/output.json @@ -1,98 +1,31 @@ { "type": "File", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "program": { "type": "Program", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "expression": { "type": "ArrowFunctionExpression", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "id": null, "generator": false, "async": false, "params": [ { "type": "Identifier", - "start": 1, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - }, - "identifierName": "e" - }, + "start":1,"end":2,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":2},"identifierName":"e"}, "name": "e" } ], "body": { "type": "StringLiteral", - "start": 7, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":7,"end":13,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":13}}, "extra": { "rawValue": "test", "raw": "\"test\"" diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/300/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/300/output.json index 053896a5a9a4..e57a1ec0b95f 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/300/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/300/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, "program": { "type": "Program", - "start": 0, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, "id": { "type": "Identifier", - "start": 9, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 15 - }, - "identifierName": "normal" - }, + "start":9,"end":15,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":15},"identifierName":"normal"}, "name": "normal" }, "generator": false, @@ -65,66 +20,20 @@ "params": [ { "type": "Identifier", - "start": 16, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - }, - "identifierName": "x" - }, + "start":16,"end":17,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":17},"identifierName":"x"}, "name": "x" }, { "type": "AssignmentPattern", - "start": 19, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":19,"end":25,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":25}}, "left": { "type": "Identifier", - "start": 19, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 20 - }, - "identifierName": "y" - }, + "start":19,"end":20,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":20},"identifierName":"y"}, "name": "y" }, "right": { "type": "NumericLiteral", - "start": 23, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":23,"end":25,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":25}}, "extra": { "rawValue": 10, "raw": "10" @@ -135,18 +44,7 @@ ], "body": { "type": "BlockStatement", - "start": 27, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":27,"end":29,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":29}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/301/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/301/output.json index bf47299eba50..fc986dc29395 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/301/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/301/output.json @@ -1,128 +1,38 @@ { "type": "File", - "start": 0, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, "program": { "type": "Program", - "start": 0, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ImportDeclaration", - "start": 0, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, "specifiers": [ { "type": "ImportDefaultSpecifier", - "start": 7, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":7,"end":10,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":10}}, "local": { "type": "Identifier", - "start": 7, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 10 - }, - "identifierName": "foo" - }, + "start":7,"end":10,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":10},"identifierName":"foo"}, "name": "foo" } }, { "type": "ImportNamespaceSpecifier", - "start": 12, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":12,"end":20,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":20}}, "local": { "type": "Identifier", - "start": 17, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 20 - }, - "identifierName": "bar" - }, + "start":17,"end":20,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":20},"identifierName":"bar"}, "name": "bar" } } ], "source": { "type": "StringLiteral", - "start": 26, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":26,"end":31,"loc":{"start":{"line":1,"column":26},"end":{"line":1,"column":31}}, "extra": { "rawValue": "baz", "raw": "'baz'" diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/302/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/302/output.json index 623d4ad5b470..1499ee54d392 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/302/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/302/output.json @@ -1,111 +1,33 @@ { "type": "File", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "program": { "type": "Program", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "expression": { "type": "SequenceExpression", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "expressions": [ { "type": "TemplateLiteral", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, "expressions": [ { "type": "Identifier", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "x" - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"x"}, "name": "x" } ], "quasis": [ { "type": "TemplateElement", - "start": 1, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - } - }, + "start":1,"end":2,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":2}}, "value": { "raw": "{", "cooked": "{" @@ -114,18 +36,7 @@ }, { "type": "TemplateElement", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7}}, "value": { "raw": "}", "cooked": "}" @@ -136,34 +47,12 @@ }, { "type": "TemplateLiteral", - "start": 10, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":10,"end":13,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":13}}, "expressions": [], "quasis": [ { "type": "TemplateElement", - "start": 11, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":11,"end":12,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":12}}, "value": { "raw": "}", "cooked": "}" diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/303/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/303/output.json index 7c5da8e4fa4b..c0512f40932c 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/303/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/303/output.json @@ -1,127 +1,37 @@ { "type": "File", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "program": { "type": "Program", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":4,"end":15,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":15}}, "id": { "type": "ObjectPattern", - "start": 4, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":4,"end":9,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":9}}, "properties": [ { "type": "ObjectProperty", - "start": 5, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":5,"end":8,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":8}}, "method": false, "key": { "type": "Identifier", - "start": 5, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 8 - }, - "identifierName": "get" - }, + "start":5,"end":8,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":8},"identifierName":"get"}, "name": "get" }, "computed": false, "shorthand": true, "value": { "type": "Identifier", - "start": 5, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 8 - }, - "identifierName": "get" - }, + "start":5,"end":8,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":8},"identifierName":"get"}, "name": "get" }, "extra": { @@ -132,19 +42,7 @@ }, "init": { "type": "Identifier", - "start": 12, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 15 - }, - "identifierName": "obj" - }, + "start":12,"end":15,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":15},"identifierName":"obj"}, "name": "obj" } } diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/304/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/304/output.json index 87af851a91ba..3130f6cb9f76 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/304/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/304/output.json @@ -1,158 +1,45 @@ { "type": "File", - "start": 0, - "end": 45, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 45 - } - }, + "start":0,"end":45,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":45}}, "program": { "type": "Program", - "start": 0, - "end": 45, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 45 - } - }, + "start":0,"end":45,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":45}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 45, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 45 - } - }, + "start":0,"end":45,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":45}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 45, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 45 - } - }, + "start":4,"end":45,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":45}}, "id": { "type": "ObjectPattern", - "start": 4, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 39 - } - }, + "start":4,"end":39,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":39}}, "properties": [ { "type": "ObjectProperty", - "start": 5, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":5,"end":38,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":38}}, "method": false, "key": { "type": "Identifier", - "start": 5, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 13 - }, - "identifierName": "propName" - }, + "start":5,"end":13,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":13},"identifierName":"propName"}, "name": "propName" }, "computed": false, "shorthand": false, "value": { "type": "AssignmentPattern", - "start": 15, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":15,"end":38,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":38}}, "left": { "type": "Identifier", - "start": 15, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 23 - }, - "identifierName": "localVar" - }, + "start":15,"end":23,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":23},"identifierName":"localVar"}, "name": "localVar" }, "right": { "type": "Identifier", - "start": 26, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 38 - }, - "identifierName": "defaultValue" - }, + "start":26,"end":38,"loc":{"start":{"line":1,"column":26},"end":{"line":1,"column":38},"identifierName":"defaultValue"}, "name": "defaultValue" } } @@ -161,19 +48,7 @@ }, "init": { "type": "Identifier", - "start": 42, - "end": 45, - "loc": { - "start": { - "line": 1, - "column": 42 - }, - "end": { - "line": 1, - "column": 45 - }, - "identifierName": "obj" - }, + "start":42,"end":45,"loc":{"start":{"line":1,"column":42},"end":{"line":1,"column":45},"identifierName":"obj"}, "name": "obj" } } diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/305/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/305/output.json index 219d24cef1ba..ac7f792906dd 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/305/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/305/output.json @@ -1,158 +1,45 @@ { "type": "File", - "start": 0, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":35}}, "program": { "type": "Program", - "start": 0, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":35}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":35}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":4,"end":35,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":35}}, "id": { "type": "ObjectPattern", - "start": 4, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":4,"end":29,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":29}}, "properties": [ { "type": "ObjectProperty", - "start": 5, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":5,"end":28,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":28}}, "method": false, "key": { "type": "Identifier", - "start": 5, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 13 - }, - "identifierName": "propName" - }, + "start":5,"end":13,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":13},"identifierName":"propName"}, "name": "propName" }, "computed": false, "shorthand": true, "value": { "type": "AssignmentPattern", - "start": 5, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":5,"end":28,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":28}}, "left": { "type": "Identifier", - "start": 5, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 13 - }, - "identifierName": "propName" - }, + "start":5,"end":13,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":13},"identifierName":"propName"}, "name": "propName" }, "right": { "type": "Identifier", - "start": 16, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 28 - }, - "identifierName": "defaultValue" - }, + "start":16,"end":28,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":28},"identifierName":"defaultValue"}, "name": "defaultValue" } }, @@ -164,19 +51,7 @@ }, "init": { "type": "Identifier", - "start": 32, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 32 - }, - "end": { - "line": 1, - "column": 35 - }, - "identifierName": "obj" - }, + "start":32,"end":35,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":35},"identifierName":"obj"}, "name": "obj" } } diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/306/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/306/output.json index 0ebadb028b05..b992a269a4db 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/306/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/306/output.json @@ -1,124 +1,34 @@ { "type": "File", - "start": 0, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":35}}, "program": { "type": "Program", - "start": 0, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":35}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":35}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":4,"end":35,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":35}}, "id": { "type": "ArrayPattern", - "start": 4, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":4,"end":29,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":29}}, "elements": [ { "type": "AssignmentPattern", - "start": 5, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":5,"end":28,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":28}}, "left": { "type": "Identifier", - "start": 5, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 13 - }, - "identifierName": "localVar" - }, + "start":5,"end":13,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":13},"identifierName":"localVar"}, "name": "localVar" }, "right": { "type": "Identifier", - "start": 16, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 28 - }, - "identifierName": "defaultValue" - }, + "start":16,"end":28,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":28},"identifierName":"defaultValue"}, "name": "defaultValue" } } @@ -126,19 +36,7 @@ }, "init": { "type": "Identifier", - "start": 32, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 32 - }, - "end": { - "line": 1, - "column": 35 - }, - "identifierName": "obj" - }, + "start":32,"end":35,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":35},"identifierName":"obj"}, "name": "obj" } } diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/307/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/307/output.json index cd6133289da8..735b339ca7cf 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/307/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/307/output.json @@ -1,157 +1,45 @@ { "type": "File", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "program": { "type": "Program", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "expression": { "type": "AssignmentExpression", - "start": 1, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":1,"end":14,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":14}}, "operator": "=", "left": { "type": "ObjectPattern", - "start": 1, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":1,"end":8,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":8}}, "properties": [ { "type": "ObjectProperty", - "start": 2, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":2,"end":7,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":7}}, "method": false, "key": { "type": "Identifier", - "start": 2, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 3 - }, - "identifierName": "x" - }, + "start":2,"end":3,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":3},"identifierName":"x"}, "name": "x" }, "computed": false, "shorthand": true, "value": { "type": "AssignmentPattern", - "start": 2, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":2,"end":7,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":7}}, "left": { "type": "Identifier", - "start": 2, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 3 - }, - "identifierName": "x" - }, + "start":2,"end":3,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":3},"identifierName":"x"}, "name": "x" }, "right": { "type": "NumericLiteral", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7}}, "extra": { "rawValue": 0, "raw": "0" @@ -167,19 +55,7 @@ }, "right": { "type": "Identifier", - "start": 11, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 14 - }, - "identifierName": "obj" - }, + "start":11,"end":14,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":14},"identifierName":"obj"}, "name": "obj" }, "extra": { diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/308/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/308/output.json index 217356d377c3..23a12f79ff19 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/308/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/308/output.json @@ -1,160 +1,48 @@ { "type": "File", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "program": { "type": "Program", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "expression": { "type": "ArrowFunctionExpression", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "id": null, "generator": false, "async": false, "params": [ { "type": "ObjectPattern", - "start": 1, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":1,"end":8,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":8}}, "properties": [ { "type": "ObjectProperty", - "start": 2, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":2,"end":7,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":7}}, "method": false, "key": { "type": "Identifier", - "start": 2, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 3 - }, - "identifierName": "x" - }, + "start":2,"end":3,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":3},"identifierName":"x"}, "name": "x" }, "computed": false, "shorthand": true, "value": { "type": "AssignmentPattern", - "start": 2, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":2,"end":7,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":7}}, "left": { "type": "Identifier", - "start": 2, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 3 - }, - "identifierName": "x" - }, + "start":2,"end":3,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":3},"identifierName":"x"}, "name": "x" }, "right": { "type": "NumericLiteral", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7}}, "extra": { "rawValue": 0, "raw": "0" @@ -171,19 +59,7 @@ ], "body": { "type": "Identifier", - "start": 13, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - }, - "identifierName": "x" - }, + "start":13,"end":14,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":14},"identifierName":"x"}, "name": "x" } } diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/309/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/309/output.json index f2e1c3bfd494..4da91987fb78 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/309/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/309/output.json @@ -1,238 +1,69 @@ { "type": "File", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "program": { "type": "Program", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "expression": { "type": "AssignmentExpression", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "operator": "=", "left": { "type": "ArrayPattern", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "elements": [ { "type": "Identifier", - "start": 1, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - }, - "identifierName": "a" - }, + "start":1,"end":2,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":2},"identifierName":"a"}, "name": "a" }, { "type": "ObjectPattern", - "start": 4, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":4,"end":16,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":16}}, "properties": [ { "type": "ObjectProperty", - "start": 5, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":5,"end":15,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":15}}, "method": false, "key": { "type": "Identifier", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "b" - }, + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"b"}, "name": "b" }, "computed": false, "shorthand": false, "value": { "type": "ObjectPattern", - "start": 8, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":8,"end":15,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":15}}, "properties": [ { "type": "ObjectProperty", - "start": 9, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":9,"end":14,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":14}}, "method": false, "key": { "type": "Identifier", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - }, - "identifierName": "c" - }, + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"c"}, "name": "c" }, "computed": false, "shorthand": true, "value": { "type": "AssignmentPattern", - "start": 9, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":9,"end":14,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":14}}, "left": { "type": "Identifier", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - }, - "identifierName": "c" - }, + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"c"}, "name": "c" }, "right": { "type": "NumericLiteral", - "start": 13, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":13,"end":14,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":14}}, "extra": { "rawValue": 1, "raw": "1" @@ -253,19 +84,7 @@ }, "right": { "type": "Identifier", - "start": 20, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 23 - }, - "identifierName": "arr" - }, + "start":20,"end":23,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":23},"identifierName":"arr"}, "name": "arr" } } diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/31/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/31/output.json index dda35332152b..dfe12266a2cd 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/31/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/31/output.json @@ -1,115 +1,36 @@ { "type": "File", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "program": { "type": "Program", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "expression": { "type": "ArrowFunctionExpression", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "id": null, "generator": false, "async": false, "params": [ { "type": "Identifier", - "start": 1, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - }, - "identifierName": "a" - }, + "start":1,"end":2,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":2},"identifierName":"a"}, "name": "a" }, { "type": "Identifier", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "b" - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"b"}, "name": "b" } ], "body": { "type": "StringLiteral", - "start": 10, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":10,"end":16,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":16}}, "extra": { "rawValue": "test", "raw": "\"test\"" diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/310/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/310/output.json index daf39840598a..ff2f7de3f1be 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/310/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/310/output.json @@ -1,142 +1,41 @@ { "type": "File", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, "program": { "type": "Program", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ForInStatement", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, "left": { "type": "ObjectPattern", - "start": 5, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":5,"end":12,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":12}}, "properties": [ { "type": "ObjectProperty", - "start": 6, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":6,"end":11,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":11}}, "method": false, "key": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "x" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"x"}, "name": "x" }, "computed": false, "shorthand": true, "value": { "type": "AssignmentPattern", - "start": 6, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":6,"end":11,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":11}}, "left": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "x" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"x"}, "name": "x" }, "right": { "type": "NumericLiteral", - "start": 10, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11}}, "extra": { "rawValue": 0, "raw": "0" @@ -152,35 +51,12 @@ }, "right": { "type": "Identifier", - "start": 16, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 19 - }, - "identifierName": "arr" - }, + "start":16,"end":19,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":19},"identifierName":"arr"}, "name": "arr" }, "body": { "type": "EmptyStatement", - "start": 20, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 21 - } - } + "start":20,"end":21,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":21}} } } ], diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/313/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/313/output.json index 1714f8b7d8a3..e1a0121f3088 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/313/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/313/output.json @@ -1,143 +1,42 @@ { "type": "File", - "start": 0, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, "program": { "type": "Program", - "start": 0, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "TryStatement", - "start": 0, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, "block": { "type": "BlockStatement", - "start": 4, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":4,"end":6,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":6}}, "body": [], "directives": [] }, "handler": { "type": "CatchClause", - "start": 7, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":7,"end":27,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":27}}, "param": { "type": "ObjectPattern", - "start": 14, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":14,"end":23,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":23}}, "properties": [ { "type": "ObjectProperty", - "start": 15, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":15,"end":22,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":22}}, "method": false, "key": { "type": "Identifier", - "start": 15, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 22 - }, - "identifierName": "message" - }, + "start":15,"end":22,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":22},"identifierName":"message"}, "name": "message" }, "computed": false, "shorthand": true, "value": { "type": "Identifier", - "start": 15, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 22 - }, - "identifierName": "message" - }, + "start":15,"end":22,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":22},"identifierName":"message"}, "name": "message" }, "extra": { @@ -148,18 +47,7 @@ }, "body": { "type": "BlockStatement", - "start": 25, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":25,"end":27,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":27}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/314/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/314/output.json index ad7fb88fb62e..d83d3d34f4c7 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/314/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/314/output.json @@ -1,112 +1,33 @@ { "type": "File", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "program": { "type": "Program", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "id": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "A" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, "name": "A" }, "superClass": null, "body": { "type": "ClassBody", - "start": 8, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":8,"end":23,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":23}}, "body": [ { "type": "ClassMethod", - "start": 10, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":10,"end":21,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":21}}, "kind": "method", "computed": false, "key": { "type": "Identifier", - "start": 10, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 16 - }, - "identifierName": "static" - }, + "start":10,"end":16,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":16},"identifierName":"static"}, "name": "static" }, "static": false, @@ -116,18 +37,7 @@ "params": [], "body": { "type": "BlockStatement", - "start": 19, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":19,"end":21,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":21}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/315/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/315/output.json index c70a86da7178..fcc33f37429c 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/315/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/315/output.json @@ -1,93 +1,26 @@ { "type": "File", - "start": 0, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, "program": { "type": "Program", - "start": 0, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ForOfStatement", - "start": 0, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, "await": false, "left": { "type": "VariableDeclaration", - "start": 5, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":5,"end":12,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":12}}, "declarations": [ { "type": "VariableDeclarator", - "start": 11, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":11,"end":12,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":12}}, "id": { "type": "Identifier", - "start": 11, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "x" - }, + "start":11,"end":12,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":12},"identifierName":"x"}, "name": "x" }, "init": null @@ -97,82 +30,24 @@ }, "right": { "type": "Identifier", - "start": 16, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 20 - }, - "identifierName": "list" - }, + "start":16,"end":20,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":20},"identifierName":"list"}, "name": "list" }, "body": { "type": "ExpressionStatement", - "start": 22, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":22,"end":33,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":33}}, "expression": { "type": "CallExpression", - "start": 22, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":22,"end":32,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":32}}, "callee": { "type": "Identifier", - "start": 22, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 29 - }, - "identifierName": "process" - }, + "start":22,"end":29,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":29},"identifierName":"process"}, "name": "process" }, "arguments": [ { "type": "Identifier", - "start": 30, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 1, - "column": 31 - }, - "identifierName": "x" - }, + "start":30,"end":31,"loc":{"start":{"line":1,"column":30},"end":{"line":1,"column":31},"identifierName":"x"}, "name": "x" } ] diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/316/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/316/output.json index e82aed2b8ad8..a50a075e2955 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/316/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/316/output.json @@ -1,112 +1,33 @@ { "type": "File", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "program": { "type": "Program", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "id": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "A" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, "name": "A" }, "superClass": null, "body": { "type": "ClassBody", - "start": 8, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":8,"end":24,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":24}}, "body": [ { "type": "ClassMethod", - "start": 10, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":10,"end":22,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":22}}, "static": false, "kind": "method", "key": { "type": "Identifier", - "start": 11, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 17 - }, - "identifierName": "static" - }, + "start":11,"end":17,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":17},"identifierName":"static"}, "name": "static" }, "computed": false, @@ -116,18 +37,7 @@ "params": [], "body": { "type": "BlockStatement", - "start": 20, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":20,"end":22,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":22}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/317/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/317/output.json index 7fef6fe7c809..28f11eec4638 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/317/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/317/output.json @@ -1,119 +1,31 @@ { "type": "File", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "program": { "type": "Program", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "expression": { "type": "TemplateLiteral", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "expressions": [ { "type": "MemberExpression", - "start": 3, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":3,"end":20,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":20}}, "object": { "type": "CallExpression", - "start": 3, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":3,"end":17,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":17}}, "callee": { "type": "MemberExpression", - "start": 3, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":3,"end":12,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":12}}, "object": { "type": "RegExpLiteral", - "start": 3, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":3,"end":7,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":7}}, "extra": { "raw": "/\\d/" }, @@ -122,19 +34,7 @@ }, "property": { "type": "Identifier", - "start": 8, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "exec" - }, + "start":8,"end":12,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":12},"identifierName":"exec"}, "name": "exec" }, "computed": false @@ -142,18 +42,7 @@ "arguments": [ { "type": "StringLiteral", - "start": 13, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":13,"end":16,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":16}}, "extra": { "rawValue": "1", "raw": "'1'" @@ -164,18 +53,7 @@ }, "property": { "type": "NumericLiteral", - "start": 18, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":18,"end":19,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":19}}, "extra": { "rawValue": 0, "raw": "0" @@ -188,18 +66,7 @@ "quasis": [ { "type": "TemplateElement", - "start": 1, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 1 - } - }, + "start":1,"end":1,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":1}}, "value": { "raw": "", "cooked": "" @@ -208,18 +75,7 @@ }, { "type": "TemplateElement", - "start": 21, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":21,"end":21,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":21}}, "value": { "raw": "", "cooked": "" diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/318/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/318/output.json index 3f69bd915879..0d1ed1d7d8d0 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/318/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/318/output.json @@ -1,94 +1,27 @@ { "type": "File", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "program": { "type": "Program", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":4,"end":12,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":12}}, "id": { "type": "Identifier", - "start": 4, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "_𐒦" - }, + "start":4,"end":7,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":7},"identifierName":"_𐒦"}, "name": "_𐒦" }, "init": { "type": "NumericLiteral", - "start": 10, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":10,"end":12,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":12}}, "extra": { "rawValue": 10, "raw": "10" diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/319/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/319/output.json index 52de80ad5ef1..7a875c41bef5 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/319/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/319/output.json @@ -1,94 +1,27 @@ { "type": "File", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, "program": { "type": "Program", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":4,"end":19,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":19}}, "id": { "type": "Identifier", - "start": 4, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 14 - }, - "identifierName": "_𐒦" - }, + "start":4,"end":14,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":14},"identifierName":"_𐒦"}, "name": "_𐒦" }, "init": { "type": "NumericLiteral", - "start": 17, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":17,"end":19,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":19}}, "extra": { "rawValue": 10, "raw": "10" diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/32/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/32/output.json index 1c6e09f83bb3..b16741cd695c 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/32/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/32/output.json @@ -1,127 +1,38 @@ { "type": "File", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, "program": { "type": "Program", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, "expression": { "type": "ArrowFunctionExpression", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, "id": null, "generator": false, "async": false, "params": [ { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "e" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"e"}, "name": "e" } ], "body": { "type": "BlockStatement", - "start": 5, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":5,"end":12,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":12}}, "body": [ { "type": "ExpressionStatement", - "start": 7, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":7,"end":10,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":10}}, "expression": { "type": "NumericLiteral", - "start": 7, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":7,"end":9,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":9}}, "extra": { "rawValue": 42, "raw": "42" diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/320/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/320/output.json index 6a08a2afa851..9bfbdf26ff64 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/320/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/320/output.json @@ -1,126 +1,37 @@ { "type": "File", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "program": { "type": "Program", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":4,"end":14,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":14}}, "id": { "type": "ArrayPattern", - "start": 4, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":4,"end":8,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":8}}, "elements": [ { "type": "Identifier", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "x" - }, + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"x"}, "name": "x" } ] }, "init": { "type": "ArrayExpression", - "start": 11, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":11,"end":14,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":14}}, "elements": [ { "type": "NumericLiteral", - "start": 12, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":12,"end":13,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":13}}, "extra": { "rawValue": 1, "raw": "1" diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/321/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/321/output.json index f581d7e8cca7..4a82688197fb 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/321/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/321/output.json @@ -1,127 +1,37 @@ { "type": "File", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "program": { "type": "Program", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":4,"end":11,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":11}}, "id": { "type": "ObjectPattern", - "start": 4, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":4,"end":7,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":7}}, "properties": [ { "type": "ObjectProperty", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, "method": false, "key": { "type": "Identifier", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "x" - }, + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"x"}, "name": "x" }, "computed": false, "shorthand": true, "value": { "type": "Identifier", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "x" - }, + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"x"}, "name": "x" }, "extra": { @@ -132,19 +42,7 @@ }, "init": { "type": "Identifier", - "start": 10, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "y" - }, + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11},"identifierName":"y"}, "name": "y" } } diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/322/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/322/output.json index 1749b8360656..56fad205b1d8 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/322/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/322/output.json @@ -1,93 +1,29 @@ { "type": "File", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "program": { "type": "Program", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "expression": { "type": "AssignmentExpression", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "operator": "=", "left": { "type": "ArrayPattern", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, + "extra": { + "trailingComma": 3 }, "elements": [ { "type": "Identifier", - "start": 1, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - }, - "identifierName": "x" - }, + "start":1,"end":2,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":2},"identifierName":"x"}, "name": "x" }, null @@ -95,18 +31,7 @@ }, "right": { "type": "NumericLiteral", - "start": 8, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":8,"end":9,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":9}}, "extra": { "rawValue": 1, "raw": "1" diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/323/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/323/output.json index b02eeda56940..6906bdb578c5 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/323/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/323/output.json @@ -1,124 +1,34 @@ { "type": "File", - "start": 0, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, "program": { "type": "Program", - "start": 0, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ForInStatement", - "start": 0, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, "left": { "type": "VariableDeclaration", - "start": 5, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":5,"end":22,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":22}}, "declarations": [ { "type": "VariableDeclarator", - "start": 9, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":9,"end":22,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":22}}, "id": { "type": "ArrayPattern", - "start": 9, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":9,"end":22,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":22}}, "elements": [ { "type": "Identifier", - "start": 10, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 14 - }, - "identifierName": "name" - }, + "start":10,"end":14,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":14},"identifierName":"name"}, "name": "name" }, { "type": "Identifier", - "start": 16, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 21 - }, - "identifierName": "value" - }, + "start":16,"end":21,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":21},"identifierName":"value"}, "name": "value" } ] @@ -130,35 +40,12 @@ }, "right": { "type": "Identifier", - "start": 26, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 29 - }, - "identifierName": "obj" - }, + "start":26,"end":29,"loc":{"start":{"line":1,"column":26},"end":{"line":1,"column":29},"identifierName":"obj"}, "name": "obj" }, "body": { "type": "BlockStatement", - "start": 31, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 31 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":31,"end":33,"loc":{"start":{"line":1,"column":31},"end":{"line":1,"column":33}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/324/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/324/options.json deleted file mode 100644 index d921abda8ff6..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/324/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Complex binding patterns require an initialization value (1:7)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/324/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/324/output.json new file mode 100644 index 000000000000..95055f68cba7 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/324/output.json @@ -0,0 +1,39 @@ +{ + "type": "File", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "errors": [ + "SyntaxError: Complex binding patterns require an initialization value (1:7)" + ], + "program": { + "type": "Program", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":4,"end":7,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":7}}, + "id": { + "type": "ArrayPattern", + "start":4,"end":7,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":7}}, + "elements": [ + { + "type": "Identifier", + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"x"}, + "name": "x" + } + ] + }, + "init": null + } + ], + "kind": "let" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/325/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/325/options.json deleted file mode 100644 index d921abda8ff6..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/325/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Complex binding patterns require an initialization value (1:7)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/325/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/325/output.json new file mode 100644 index 000000000000..357a7e282e79 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/325/output.json @@ -0,0 +1,39 @@ +{ + "type": "File", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "errors": [ + "SyntaxError: Complex binding patterns require an initialization value (1:7)" + ], + "program": { + "type": "Program", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":4,"end":7,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":7}}, + "id": { + "type": "ArrayPattern", + "start":4,"end":7,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":7}}, + "elements": [ + { + "type": "Identifier", + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"x"}, + "name": "x" + } + ] + }, + "init": null + } + ], + "kind": "var" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/329/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/329/options.json deleted file mode 100644 index 97818d2eea7e..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/329/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Lexical declaration cannot appear in a single-statement context (1:9)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/329/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/329/output.json new file mode 100644 index 000000000000..7e613e65e9f4 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/329/output.json @@ -0,0 +1,48 @@ +{ + "type": "File", + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, + "errors": [ + "SyntaxError: Lexical declaration cannot appear in a single-statement context (1:9)" + ], + "program": { + "type": "Program", + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ForStatement", + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, + "init": null, + "test": null, + "update": null, + "body": { + "type": "VariableDeclaration", + "start":9,"end":22,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":22}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":15,"end":21,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":21}}, + "id": { + "type": "Identifier", + "start":15,"end":16,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":16},"identifierName":"x"}, + "name": "x" + }, + "init": { + "type": "NumericLiteral", + "start":19,"end":21,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":21}}, + "extra": { + "rawValue": 10, + "raw": "10" + }, + "value": 10 + } + } + ], + "kind": "const" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/33/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/33/output.json index b38e5d2c1b6e..d62ccc489695 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/33/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/33/output.json @@ -1,147 +1,46 @@ { "type": "File", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "program": { "type": "Program", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "expression": { "type": "ArrowFunctionExpression", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "id": null, "generator": false, "async": false, "params": [ { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "e" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"e"}, "name": "e" } ], "body": { "type": "ObjectExpression", - "start": 6, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":6,"end":22,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":22}}, "properties": [ { "type": "ObjectProperty", - "start": 8, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":8,"end":20,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":20}}, "method": false, "key": { "type": "Identifier", - "start": 8, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 16 - }, - "identifierName": "property" - }, + "start":8,"end":16,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":16},"identifierName":"property"}, "name": "property" }, "computed": false, "shorthand": false, "value": { "type": "NumericLiteral", - "start": 18, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":18,"end":20,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":20}}, "extra": { "rawValue": 42, "raw": "42" diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/332/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/332/options.json deleted file mode 100644 index 610884bb674c..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/332/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Assigning to 'eval' in strict mode (1:18)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/332/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/332/output.json new file mode 100644 index 000000000000..c604d5892ae5 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/332/output.json @@ -0,0 +1,59 @@ +{ + "type": "File", + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, + "errors": [ + "SyntaxError: Assigning to 'eval' in strict mode (1:18)" + ], + "program": { + "type": "Program", + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":14,"end":29,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":29}}, + "expression": { + "type": "AssignmentExpression", + "start":14,"end":29,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":29}}, + "operator": "=", + "left": { + "type": "ArrayPattern", + "start":14,"end":23,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":23}}, + "elements": [ + { + "type": "RestElement", + "start":15,"end":22,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":22}}, + "argument": { + "type": "Identifier", + "start":18,"end":22,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":22},"identifierName":"eval"}, + "name": "eval" + } + } + ] + }, + "right": { + "type": "Identifier", + "start":26,"end":29,"loc":{"start":{"line":1,"column":26},"end":{"line":1,"column":29},"identifierName":"arr"}, + "name": "arr" + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "value": { + "type": "DirectiveLiteral", + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/333/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/333/options.json deleted file mode 100644 index 567e40541c5b..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/333/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected reserved word 'eval' (1:16)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/333/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/333/output.json new file mode 100644 index 000000000000..df2a6a81e4b1 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/333/output.json @@ -0,0 +1,84 @@ +{ + "type": "File", + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":39}}, + "errors": [ + "SyntaxError: Unexpected reserved word 'eval' (1:16)", + "SyntaxError: Assigning to 'eval' in strict mode (1:16)" + ], + "program": { + "type": "Program", + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":39}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":14,"end":39,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":39}}, + "expression": { + "type": "AssignmentExpression", + "start":15,"end":38,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":38}}, + "operator": "=", + "left": { + "type": "ObjectPattern", + "start":15,"end":32,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":32}}, + "properties": [ + { + "type": "ObjectProperty", + "start":16,"end":31,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":31}}, + "method": false, + "key": { + "type": "Identifier", + "start":16,"end":20,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":20},"identifierName":"eval"}, + "name": "eval" + }, + "computed": false, + "shorthand": true, + "value": { + "type": "AssignmentPattern", + "start":16,"end":31,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":31}}, + "left": { + "type": "Identifier", + "start":16,"end":20,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":20},"identifierName":"eval"}, + "name": "eval" + }, + "right": { + "type": "Identifier", + "start":23,"end":31,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":31},"identifierName":"defValue"}, + "name": "defValue" + } + }, + "extra": { + "shorthand": true + } + } + ] + }, + "right": { + "type": "Identifier", + "start":35,"end":38,"loc":{"start":{"line":1,"column":35},"end":{"line":1,"column":38},"identifierName":"obj"}, + "name": "obj" + }, + "extra": { + "parenthesized": true, + "parenStart": 14 + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "value": { + "type": "DirectiveLiteral", + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/334/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/334/options.json index e45ea16ee8a4..2104ca43283f 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/334/options.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/334/options.json @@ -1,4 +1,3 @@ { - "sourceType": "module", - "throws": "Assigning to 'eval' in strict mode (1:4)" -} \ No newline at end of file + "sourceType": "module" +} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/334/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/334/output.json new file mode 100644 index 000000000000..56ed13d09fb8 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/334/output.json @@ -0,0 +1,45 @@ +{ + "type": "File", + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, + "errors": [ + "SyntaxError: Assigning to 'eval' in strict mode (1:4)" + ], + "program": { + "type": "Program", + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, + "expression": { + "type": "AssignmentExpression", + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, + "operator": "=", + "left": { + "type": "ArrayPattern", + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "elements": [ + { + "type": "RestElement", + "start":1,"end":8,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":8}}, + "argument": { + "type": "Identifier", + "start":4,"end":8,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":8},"identifierName":"eval"}, + "name": "eval" + } + } + ] + }, + "right": { + "type": "Identifier", + "start":12,"end":15,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":15},"identifierName":"arr"}, + "name": "arr" + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/338/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/338/output.json index d10dfda13c98..3659ff0539f2 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/338/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/338/output.json @@ -1,77 +1,21 @@ { "type": "File", - "start": 0, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":38}}, "program": { "type": "Program", - "start": 0, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":38}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExportDefaultDeclaration", - "start": 0, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, "declaration": { "type": "FunctionDeclaration", - "start": 15, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":15,"end":32,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":32}}, "id": { "type": "Identifier", - "start": 24, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 27 - }, - "identifierName": "foo" - }, + "start":24,"end":27,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":27},"identifierName":"foo"}, "name": "foo" }, "generator": false, @@ -79,18 +23,7 @@ "params": [], "body": { "type": "BlockStatement", - "start": 30, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":30,"end":32,"loc":{"start":{"line":1,"column":30},"end":{"line":1,"column":32}}, "body": [], "directives": [] } @@ -98,32 +31,10 @@ }, { "type": "ExpressionStatement", - "start": 33, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 33 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":33,"end":38,"loc":{"start":{"line":1,"column":33},"end":{"line":1,"column":38}}, "expression": { "type": "BooleanLiteral", - "start": 33, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 33 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":33,"end":38,"loc":{"start":{"line":1,"column":33},"end":{"line":1,"column":38}}, "value": false } } diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/339/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/339/options.json deleted file mode 100644 index fd4da953a419..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/339/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/339/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/339/output.json new file mode 100644 index 000000000000..0f3359c66524 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/339/output.json @@ -0,0 +1,36 @@ +{ + "type": "File", + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:2)" + ], + "program": { + "type": "Program", + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, + "expression": { + "type": "TemplateLiteral", + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, + "expressions": [], + "quasis": [ + { + "type": "TemplateElement", + "start":1,"end":4,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":4}}, + "value": { + "raw": "\\07", + "cooked": null + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/34/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/34/output.json index aeaacfb4d40d..00e4c4cd68bc 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/34/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/34/output.json @@ -1,141 +1,41 @@ { "type": "File", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, "program": { "type": "Program", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, "expression": { "type": "ArrowFunctionExpression", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, "id": null, "generator": false, "async": false, "params": [ { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "e" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"e"}, "name": "e" } ], "body": { "type": "BlockStatement", - "start": 5, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":5,"end":18,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":18}}, "body": [ { "type": "LabeledStatement", - "start": 7, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":7,"end":16,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":16}}, "body": { "type": "ExpressionStatement", - "start": 14, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":14,"end":16,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":16}}, "expression": { "type": "NumericLiteral", - "start": 14, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":14,"end":16,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":16}}, "extra": { "rawValue": 42, "raw": "42" @@ -145,19 +45,7 @@ }, "label": { "type": "Identifier", - "start": 7, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "label" - }, + "start":7,"end":12,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":12},"identifierName":"label"}, "name": "label" } } diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/344/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/344/options.json deleted file mode 100644 index ad3fdc7d73f7..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/344/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "super is only allowed in object methods and classes (1:0)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/344/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/344/output.json new file mode 100644 index 000000000000..7cde5ed76296 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/344/output.json @@ -0,0 +1,25 @@ +{ + "type": "File", + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, + "errors": [ + "SyntaxError: super is only allowed in object methods and classes (1:0)", + "SyntaxError: super can only be used with function calls (i.e. super()) or in property accesses (i.e. super.prop or super[prop]) (1:0)" + ], + "program": { + "type": "Program", + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, + "expression": { + "type": "Super", + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}} + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/347/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/347/options.json deleted file mode 100644 index 9a137564eed4..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/347/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "setter must have exactly one formal parameter (1:10)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/347/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/347/output.json new file mode 100644 index 000000000000..875ae6923bec --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/347/output.json @@ -0,0 +1,65 @@ +{ + "type": "File", + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, + "errors": [ + "SyntaxError: setter must have exactly one formal parameter (1:10)" + ], + "program": { + "type": "Program", + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, + "id": { + "type": "Identifier", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":8,"end":29,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":29}}, + "body": [ + { + "type": "ClassMethod", + "start":10,"end":27,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":27}}, + "static": false, + "key": { + "type": "Identifier", + "start":14,"end":18,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":18},"identifierName":"prop"}, + "name": "prop" + }, + "computed": false, + "kind": "set", + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start":19,"end":20,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":20},"identifierName":"x"}, + "name": "x" + }, + { + "type": "Identifier", + "start":22,"end":23,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":23},"identifierName":"y"}, + "name": "y" + } + ], + "body": { + "type": "BlockStatement", + "start":25,"end":27,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":27}}, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/348/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/348/options.json deleted file mode 100644 index c1ac8e1d138d..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/348/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Redefinition of __proto__ property (1:17)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/348/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/348/output.json new file mode 100644 index 000000000000..e976347b716a --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/348/output.json @@ -0,0 +1,72 @@ +{ + "type": "File", + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, + "errors": [ + "SyntaxError: Redefinition of __proto__ property (1:17)" + ], + "program": { + "type": "Program", + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, + "expression": { + "type": "ObjectExpression", + "start":1,"end":31,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":31}}, + "properties": [ + { + "type": "ObjectProperty", + "start":3,"end":15,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":15}}, + "method": false, + "key": { + "type": "Identifier", + "start":3,"end":12,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":12},"identifierName":"__proto__"}, + "name": "__proto__" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "NumericLiteral", + "start":14,"end":15,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":15}}, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + }, + { + "type": "ObjectProperty", + "start":17,"end":29,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":29}}, + "method": false, + "key": { + "type": "Identifier", + "start":17,"end":26,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":26},"identifierName":"__proto__"}, + "name": "__proto__" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "NumericLiteral", + "start":28,"end":29,"loc":{"start":{"line":1,"column":28},"end":{"line":1,"column":29}}, + "extra": { + "rawValue": 2, + "raw": "2" + }, + "value": 2 + } + } + ], + "extra": { + "parenthesized": true, + "parenStart": 0 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/349/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/349/options.json deleted file mode 100644 index 0d3bc321ef03..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/349/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Redefinition of __proto__ property (1:19)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/349/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/349/output.json new file mode 100644 index 000000000000..f3676a82d6ff --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/349/output.json @@ -0,0 +1,76 @@ +{ + "type": "File", + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, + "errors": [ + "SyntaxError: Redefinition of __proto__ property (1:19)" + ], + "program": { + "type": "Program", + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, + "expression": { + "type": "ObjectExpression", + "start":1,"end":33,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":33}}, + "properties": [ + { + "type": "ObjectProperty", + "start":3,"end":17,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":17}}, + "method": false, + "key": { + "type": "StringLiteral", + "start":3,"end":14,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":14}}, + "extra": { + "rawValue": "__proto__", + "raw": "'__proto__'" + }, + "value": "__proto__" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "NumericLiteral", + "start":16,"end":17,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":17}}, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + }, + { + "type": "ObjectProperty", + "start":19,"end":31,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":31}}, + "method": false, + "key": { + "type": "Identifier", + "start":19,"end":28,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":28},"identifierName":"__proto__"}, + "name": "__proto__" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "NumericLiteral", + "start":30,"end":31,"loc":{"start":{"line":1,"column":30},"end":{"line":1,"column":31}}, + "extra": { + "rawValue": 2, + "raw": "2" + }, + "value": 2 + } + } + ], + "extra": { + "parenthesized": true, + "parenStart": 0 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/35/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/35/output.json index 3283c962d68c..e9089f70a568 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/35/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/35/output.json @@ -1,144 +1,43 @@ { "type": "File", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "program": { "type": "Program", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "expression": { "type": "ArrowFunctionExpression", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "id": null, "generator": false, "async": false, "params": [ { "type": "Identifier", - "start": 1, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - }, - "identifierName": "a" - }, + "start":1,"end":2,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":2},"identifierName":"a"}, "name": "a" }, { "type": "Identifier", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "b" - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"b"}, "name": "b" } ], "body": { "type": "BlockStatement", - "start": 10, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":10,"end":17,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":17}}, "body": [ { "type": "ExpressionStatement", - "start": 12, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":12,"end":15,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":15}}, "expression": { "type": "NumericLiteral", - "start": 12, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":12,"end":14,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":14}}, "extra": { "rawValue": 42, "raw": "42" diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/350/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/350/output.json index 6c41f74ec2ea..be737302aead 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/350/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/350/output.json @@ -1,93 +1,27 @@ { "type": "File", - "start": 0, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, "program": { "type": "Program", - "start": 0, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, "expression": { "type": "ObjectExpression", - "start": 1, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":1,"end":35,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":35}}, "properties": [ { "type": "ObjectProperty", - "start": 3, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":3,"end":19,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":19}}, "method": false, "computed": true, "key": { "type": "StringLiteral", - "start": 4, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":4,"end":15,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":15}}, "extra": { "rawValue": "__proto__", "raw": "'__proto__'" @@ -97,18 +31,7 @@ "shorthand": false, "value": { "type": "NumericLiteral", - "start": 18, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":18,"end":19,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":19}}, "extra": { "rawValue": 1, "raw": "1" @@ -118,52 +41,18 @@ }, { "type": "ObjectProperty", - "start": 21, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":21,"end":33,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":33}}, "method": false, "key": { "type": "Identifier", - "start": 21, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 30 - }, - "identifierName": "__proto__" - }, + "start":21,"end":30,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":30},"identifierName":"__proto__"}, "name": "__proto__" }, "computed": false, "shorthand": false, "value": { "type": "NumericLiteral", - "start": 32, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 32 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":32,"end":33,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":33}}, "extra": { "rawValue": 2, "raw": "2" diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/351/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/351/output.json index 72ac1d371e76..a9591c9cb84e 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/351/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/351/output.json @@ -1,93 +1,26 @@ { "type": "File", - "start": 0, - "end": 44, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 44 - } - }, + "start":0,"end":44,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":44}}, "program": { "type": "Program", - "start": 0, - "end": 44, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 44 - } - }, + "start":0,"end":44,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":44}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 44, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 44 - } - }, + "start":0,"end":44,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":44}}, "expression": { "type": "ObjectExpression", - "start": 1, - "end": 43, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 43 - } - }, + "start":1,"end":43,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":43}}, "properties": [ { "type": "ObjectMethod", - "start": 3, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":3,"end":27,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":27}}, "method": true, "key": { "type": "Identifier", - "start": 3, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "__proto__" - }, + "start":3,"end":12,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":12},"identifierName":"__proto__"}, "name": "__proto__" }, "computed": false, @@ -98,47 +31,14 @@ "params": [], "body": { "type": "BlockStatement", - "start": 15, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":15,"end":27,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":27}}, "body": [ { "type": "ReturnStatement", - "start": 17, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":17,"end":25,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":25}}, "argument": { "type": "NumericLiteral", - "start": 24, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":24,"end":25,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":25}}, "extra": { "rawValue": 1, "raw": "1" @@ -152,52 +52,18 @@ }, { "type": "ObjectProperty", - "start": 29, - "end": 41, - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 1, - "column": 41 - } - }, + "start":29,"end":41,"loc":{"start":{"line":1,"column":29},"end":{"line":1,"column":41}}, "method": false, "key": { "type": "Identifier", - "start": 29, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 1, - "column": 38 - }, - "identifierName": "__proto__" - }, + "start":29,"end":38,"loc":{"start":{"line":1,"column":29},"end":{"line":1,"column":38},"identifierName":"__proto__"}, "name": "__proto__" }, "computed": false, "shorthand": false, "value": { "type": "NumericLiteral", - "start": 40, - "end": 41, - "loc": { - "start": { - "line": 1, - "column": 40 - }, - "end": { - "line": 1, - "column": 41 - } - }, + "start":40,"end":41,"loc":{"start":{"line":1,"column":40},"end":{"line":1,"column":41}}, "extra": { "rawValue": 2, "raw": "2" diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/352/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/352/output.json index 2a28996931e1..0d849579ce18 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/352/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/352/output.json @@ -1,93 +1,26 @@ { "type": "File", - "start": 0, - "end": 48, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 48 - } - }, + "start":0,"end":48,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":48}}, "program": { "type": "Program", - "start": 0, - "end": 48, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 48 - } - }, + "start":0,"end":48,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":48}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 48, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 48 - } - }, + "start":0,"end":48,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":48}}, "expression": { "type": "ObjectExpression", - "start": 1, - "end": 47, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 47 - } - }, + "start":1,"end":47,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":47}}, "properties": [ { "type": "ObjectMethod", - "start": 3, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":3,"end":31,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":31}}, "method": false, "key": { "type": "Identifier", - "start": 7, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 16 - }, - "identifierName": "__proto__" - }, + "start":7,"end":16,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":16},"identifierName":"__proto__"}, "name": "__proto__" }, "computed": false, @@ -98,47 +31,14 @@ "params": [], "body": { "type": "BlockStatement", - "start": 19, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":19,"end":31,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":31}}, "body": [ { "type": "ReturnStatement", - "start": 21, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":21,"end":29,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":29}}, "argument": { "type": "NumericLiteral", - "start": 28, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":28,"end":29,"loc":{"start":{"line":1,"column":28},"end":{"line":1,"column":29}}, "extra": { "rawValue": 1, "raw": "1" @@ -152,52 +52,18 @@ }, { "type": "ObjectProperty", - "start": 33, - "end": 45, - "loc": { - "start": { - "line": 1, - "column": 33 - }, - "end": { - "line": 1, - "column": 45 - } - }, + "start":33,"end":45,"loc":{"start":{"line":1,"column":33},"end":{"line":1,"column":45}}, "method": false, "key": { "type": "Identifier", - "start": 33, - "end": 42, - "loc": { - "start": { - "line": 1, - "column": 33 - }, - "end": { - "line": 1, - "column": 42 - }, - "identifierName": "__proto__" - }, + "start":33,"end":42,"loc":{"start":{"line":1,"column":33},"end":{"line":1,"column":42},"identifierName":"__proto__"}, "name": "__proto__" }, "computed": false, "shorthand": false, "value": { "type": "NumericLiteral", - "start": 44, - "end": 45, - "loc": { - "start": { - "line": 1, - "column": 44 - }, - "end": { - "line": 1, - "column": 45 - } - }, + "start":44,"end":45,"loc":{"start":{"line":1,"column":44},"end":{"line":1,"column":45}}, "extra": { "rawValue": 2, "raw": "2" diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/354/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/354/output.json index 9e25d9da5dab..3b7cf678f8d6 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/354/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/354/output.json @@ -1,62 +1,18 @@ { "type": "File", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, "program": { "type": "Program", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExportDefaultDeclaration", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, "declaration": { "type": "RegExpLiteral", - "start": 15, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":15,"end":20,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":20}}, "extra": { "raw": "/foo/" }, diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/355/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/355/output.json index cb43f63dc39a..d95563f2b97f 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/355/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/355/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, "program": { "type": "Program", - "start": 0, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, "id": { "type": "Identifier", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - }, - "identifierName": "x" - }, + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"x"}, "name": "x" }, "generator": false, @@ -65,98 +20,30 @@ "params": [ { "type": "ObjectPattern", - "start": 11, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":11,"end":25,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":25}}, "properties": [ { "type": "ObjectProperty", - "start": 13, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":13,"end":23,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":23}}, "method": false, "key": { "type": "Identifier", - "start": 13, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 16 - }, - "identifierName": "set" - }, + "start":13,"end":16,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":16},"identifierName":"set"}, "name": "set" }, "computed": false, "shorthand": true, "value": { "type": "AssignmentPattern", - "start": 13, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":13,"end":23,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":23}}, "left": { "type": "Identifier", - "start": 13, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 16 - }, - "identifierName": "set" - }, + "start":13,"end":16,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":16},"identifierName":"set"}, "name": "set" }, "right": { "type": "NullLiteral", - "start": 19, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 23 - } - } + "start":19,"end":23,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":23}} } }, "extra": { @@ -168,18 +55,7 @@ ], "body": { "type": "BlockStatement", - "start": 27, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":27,"end":29,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":29}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/356/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/356/output.json index 8555ebc47671..1f426037330d 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/356/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/356/output.json @@ -1,109 +1,30 @@ { "type": "File", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "program": { "type": "Program", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "expression": { "type": "AssignmentExpression", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "operator": "=", "left": { "type": "Identifier", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "await" - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5},"identifierName":"await"}, "name": "await" }, "right": { "type": "CallExpression", - "start": 8, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":8,"end":13,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":13}}, "callee": { "type": "Identifier", - "start": 8, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "foo" - }, + "start":8,"end":11,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":11},"identifierName":"foo"}, "name": "foo" }, "arguments": [] diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/357/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/357/options.json index c148ada0c73a..2104ca43283f 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/357/options.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/357/options.json @@ -1,4 +1,3 @@ { - "sourceType": "module", - "throws": "Can not use keyword 'await' outside an async function (1:0)" + "sourceType": "module" } diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/357/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/357/output.json new file mode 100644 index 000000000000..7c4008d329ad --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/357/output.json @@ -0,0 +1,40 @@ +{ + "type": "File", + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, + "errors": [ + "SyntaxError: Can not use keyword 'await' outside an async function (1:0)" + ], + "program": { + "type": "Program", + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, + "expression": { + "type": "AssignmentExpression", + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "operator": "=", + "left": { + "type": "Identifier", + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5},"identifierName":"await"}, + "name": "await" + }, + "right": { + "type": "CallExpression", + "start":8,"end":13,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":13}}, + "callee": { + "type": "Identifier", + "start":8,"end":11,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":11},"identifierName":"foo"}, + "name": "foo" + }, + "arguments": [] + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/358/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/358/output.json index 7ff3c49080ef..5d77657d82d1 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/358/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/358/output.json @@ -1,109 +1,30 @@ { "type": "File", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, "program": { "type": "Program", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, "declarations": [ { "type": "VariableDeclarator", - "start": 6, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":6,"end":19,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":19}}, "id": { "type": "Identifier", - "start": 6, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "await" - }, + "start":6,"end":11,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":11},"identifierName":"await"}, "name": "await" }, "init": { "type": "CallExpression", - "start": 14, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":14,"end":19,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":19}}, "callee": { "type": "Identifier", - "start": 14, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 17 - }, - "identifierName": "foo" - }, + "start":14,"end":17,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":17},"identifierName":"foo"}, "name": "foo" }, "arguments": [] diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/359/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/359/options.json index fa250ba921b1..2104ca43283f 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/359/options.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/359/options.json @@ -1,4 +1,3 @@ { - "sourceType": "module", - "throws": "Can not use keyword 'await' outside an async function (1:6)" + "sourceType": "module" } diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/359/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/359/output.json new file mode 100644 index 000000000000..290e89d5fcda --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/359/output.json @@ -0,0 +1,42 @@ +{ + "type": "File", + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, + "errors": [ + "SyntaxError: Can not use keyword 'await' outside an async function (1:6)" + ], + "program": { + "type": "Program", + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":6,"end":19,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":19}}, + "id": { + "type": "Identifier", + "start":6,"end":11,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":11},"identifierName":"await"}, + "name": "await" + }, + "init": { + "type": "CallExpression", + "start":14,"end":19,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":19}}, + "callee": { + "type": "Identifier", + "start":14,"end":17,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":17},"identifierName":"foo"}, + "name": "foo" + }, + "arguments": [] + } + } + ], + "kind": "const" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/36/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/36/output.json index 4e41014ff676..fa7e54bcd46f 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/36/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/36/output.json @@ -1,114 +1,35 @@ { "type": "File", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "program": { "type": "Program", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "expression": { "type": "ArrowFunctionExpression", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "id": null, "generator": false, "async": false, "params": [ { "type": "ArrayPattern", - "start": 1, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":1,"end":9,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":9}}, "elements": [ { "type": "Identifier", - "start": 2, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 3 - }, - "identifierName": "a" - }, + "start":2,"end":3,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":3},"identifierName":"a"}, "name": "a" }, null, { "type": "Identifier", - "start": 7, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - }, - "identifierName": "b" - }, + "start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8},"identifierName":"b"}, "name": "b" } ] @@ -116,18 +37,7 @@ ], "body": { "type": "NumericLiteral", - "start": 14, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":14,"end":16,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":16}}, "extra": { "rawValue": 42, "raw": "42" diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/360/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/360/output.json index dc5c92e48a9b..3182e3f3578a 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/360/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/360/output.json @@ -1,127 +1,37 @@ { "type": "File", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "program": { "type": "Program", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "declarations": [ { "type": "VariableDeclarator", - "start": 6, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":6,"end":23,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":23}}, "id": { "type": "ObjectPattern", - "start": 6, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":6,"end":15,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":15}}, "properties": [ { "type": "ObjectProperty", - "start": 8, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":8,"end":13,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":13}}, "method": false, "key": { "type": "Identifier", - "start": 8, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 13 - }, - "identifierName": "await" - }, + "start":8,"end":13,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":13},"identifierName":"await"}, "name": "await" }, "computed": false, "shorthand": true, "value": { "type": "Identifier", - "start": 8, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 13 - }, - "identifierName": "await" - }, + "start":8,"end":13,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":13},"identifierName":"await"}, "name": "await" }, "extra": { @@ -132,33 +42,10 @@ }, "init": { "type": "CallExpression", - "start": 18, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":18,"end":23,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":23}}, "callee": { "type": "Identifier", - "start": 18, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 21 - }, - "identifierName": "foo" - }, + "start":18,"end":21,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":21},"identifierName":"foo"}, "name": "foo" }, "arguments": [] diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/361/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/361/options.json index fd81c5071d1d..2104ca43283f 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/361/options.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/361/options.json @@ -1,4 +1,3 @@ { - "sourceType": "module", - "throws": "Can not use keyword 'await' outside an async function (1:8)" + "sourceType": "module" } diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/361/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/361/output.json new file mode 100644 index 000000000000..8b0aa3cdb23c --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/361/output.json @@ -0,0 +1,63 @@ +{ + "type": "File", + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, + "errors": [ + "SyntaxError: Can not use keyword 'await' outside an async function (1:8)" + ], + "program": { + "type": "Program", + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":6,"end":23,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":23}}, + "id": { + "type": "ObjectPattern", + "start":6,"end":15,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":15}}, + "properties": [ + { + "type": "ObjectProperty", + "start":8,"end":13,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":13}}, + "method": false, + "key": { + "type": "Identifier", + "start":8,"end":13,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":13},"identifierName":"await"}, + "name": "await" + }, + "computed": false, + "shorthand": true, + "value": { + "type": "Identifier", + "start":8,"end":13,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":13},"identifierName":"await"}, + "name": "await" + }, + "extra": { + "shorthand": true + } + } + ] + }, + "init": { + "type": "CallExpression", + "start":18,"end":23,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":23}}, + "callee": { + "type": "Identifier", + "start":18,"end":21,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":21},"identifierName":"foo"}, + "name": "foo" + }, + "arguments": [] + } + } + ], + "kind": "const" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/362/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/362/output.json index 400d7abe654d..f220a5016ad3 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/362/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/362/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, "program": { "type": "Program", - "start": 0, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, "id": { "type": "Identifier", - "start": 9, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "foo" - }, + "start":9,"end":12,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":12},"identifierName":"foo"}, "name": "foo" }, "generator": false, @@ -65,68 +20,22 @@ "params": [ { "type": "ObjectPattern", - "start": 13, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":13,"end":22,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":22}}, "properties": [ { "type": "ObjectProperty", - "start": 15, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":15,"end":20,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":20}}, "method": false, "key": { "type": "Identifier", - "start": 15, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 20 - }, - "identifierName": "await" - }, + "start":15,"end":20,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":20},"identifierName":"await"}, "name": "await" }, "computed": false, "shorthand": true, "value": { "type": "Identifier", - "start": 15, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 20 - }, - "identifierName": "await" - }, + "start":15,"end":20,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":20},"identifierName":"await"}, "name": "await" }, "extra": { @@ -138,18 +47,7 @@ ], "body": { "type": "BlockStatement", - "start": 24, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":24,"end":26,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":26}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/363/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/363/options.json index a72d4ab0ff7f..2104ca43283f 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/363/options.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/363/options.json @@ -1,4 +1,3 @@ { - "sourceType": "module", - "throws": "Can not use keyword 'await' outside an async function (1:15)" + "sourceType": "module" } diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/363/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/363/output.json new file mode 100644 index 000000000000..1ab8abb19099 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/363/output.json @@ -0,0 +1,61 @@ +{ + "type": "File", + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, + "errors": [ + "SyntaxError: Can not use keyword 'await' outside an async function (1:15)" + ], + "program": { + "type": "Program", + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, + "id": { + "type": "Identifier", + "start":9,"end":12,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":12},"identifierName":"foo"}, + "name": "foo" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "ObjectPattern", + "start":13,"end":22,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":22}}, + "properties": [ + { + "type": "ObjectProperty", + "start":15,"end":20,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":20}}, + "method": false, + "key": { + "type": "Identifier", + "start":15,"end":20,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":20},"identifierName":"await"}, + "name": "await" + }, + "computed": false, + "shorthand": true, + "value": { + "type": "Identifier", + "start":15,"end":20,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":20},"identifierName":"await"}, + "name": "await" + }, + "extra": { + "shorthand": true + } + } + ] + } + ], + "body": { + "type": "BlockStatement", + "start":24,"end":26,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":26}}, + "body": [], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/364/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/364/output.json index c3b382f1948d..c0242adce5bf 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/364/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/364/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, "program": { "type": "Program", - "start": 0, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, "id": { "type": "Identifier", - "start": 9, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 14 - }, - "identifierName": "await" - }, + "start":9,"end":14,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":14},"identifierName":"await"}, "name": "await" }, "generator": false, @@ -65,18 +20,7 @@ "params": [], "body": { "type": "BlockStatement", - "start": 17, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":17,"end":19,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":19}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/365/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/365/options.json index 18d9310bd147..2104ca43283f 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/365/options.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/365/options.json @@ -1,4 +1,3 @@ { - "sourceType": "module", - "throws": "Can not use keyword 'await' outside an async function (1:9)" + "sourceType": "module" } diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/365/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/365/output.json new file mode 100644 index 000000000000..f09a6f2813ce --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/365/output.json @@ -0,0 +1,34 @@ +{ + "type": "File", + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, + "errors": [ + "SyntaxError: Can not use keyword 'await' outside an async function (1:9)" + ], + "program": { + "type": "Program", + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, + "id": { + "type": "Identifier", + "start":9,"end":14,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":14},"identifierName":"await"}, + "name": "await" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":17,"end":19,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":19}}, + "body": [], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/366/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/366/output.json index 94fce7f2c8dc..399cf3cbb633 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/366/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/366/output.json @@ -1,80 +1,24 @@ { "type": "File", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "program": { "type": "Program", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "id": { "type": "Identifier", - "start": 6, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "await" - }, + "start":6,"end":11,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":11},"identifierName":"await"}, "name": "await" }, "superClass": null, "body": { "type": "ClassBody", - "start": 12, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":12,"end":14,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":14}}, "body": [] } } diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/367/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/367/options.json index fa250ba921b1..2104ca43283f 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/367/options.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/367/options.json @@ -1,4 +1,3 @@ { - "sourceType": "module", - "throws": "Can not use keyword 'await' outside an async function (1:6)" + "sourceType": "module" } diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/367/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/367/output.json new file mode 100644 index 000000000000..8b3ca71abc97 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/367/output.json @@ -0,0 +1,31 @@ +{ + "type": "File", + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, + "errors": [ + "SyntaxError: Can not use keyword 'await' outside an async function (1:6)" + ], + "program": { + "type": "Program", + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, + "id": { + "type": "Identifier", + "start":6,"end":11,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":11},"identifierName":"await"}, + "name": "await" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":12,"end":14,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":14}}, + "body": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/368/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/368/options.json index bd449d1a1743..b412ffe6712f 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/368/options.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/368/options.json @@ -1,4 +1,3 @@ { - "sourceType": "script", - "throws": "Unexpected reserved word 'enum' (1:0)" -} \ No newline at end of file + "sourceType": "script" +} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/368/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/368/output.json new file mode 100644 index 000000000000..600dd2bbb964 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/368/output.json @@ -0,0 +1,40 @@ +{ + "type": "File", + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "errors": [ + "SyntaxError: Unexpected reserved word 'enum' (1:0)" + ], + "program": { + "type": "Program", + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "expression": { + "type": "AssignmentExpression", + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "operator": "=", + "left": { + "type": "Identifier", + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4},"identifierName":"enum"}, + "name": "enum" + }, + "right": { + "type": "CallExpression", + "start":7,"end":12,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":12}}, + "callee": { + "type": "Identifier", + "start":7,"end":10,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":10},"identifierName":"foo"}, + "name": "foo" + }, + "arguments": [] + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/369/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/369/options.json index a8c4888490b6..2104ca43283f 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/369/options.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/369/options.json @@ -1,4 +1,3 @@ { - "sourceType": "module", - "throws": "Unexpected reserved word 'enum' (1:0)" -} \ No newline at end of file + "sourceType": "module" +} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/369/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/369/output.json new file mode 100644 index 000000000000..5dcad3446852 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/369/output.json @@ -0,0 +1,40 @@ +{ + "type": "File", + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "errors": [ + "SyntaxError: Unexpected reserved word 'enum' (1:0)" + ], + "program": { + "type": "Program", + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "expression": { + "type": "AssignmentExpression", + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "operator": "=", + "left": { + "type": "Identifier", + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4},"identifierName":"enum"}, + "name": "enum" + }, + "right": { + "type": "CallExpression", + "start":7,"end":12,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":12}}, + "callee": { + "type": "Identifier", + "start":7,"end":10,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":10},"identifierName":"foo"}, + "name": "foo" + }, + "arguments": [] + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/37/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/37/options.json deleted file mode 100644 index 401518851fb6..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/37/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid left-hand side in arrow function parameters (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/37/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/37/output.json new file mode 100644 index 000000000000..58ec7c24759d --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/37/output.json @@ -0,0 +1,59 @@ +{ + "type": "File", + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "errors": [ + "SyntaxError: Binding member expression (1:2)" + ], + "program": { + "type": "Program", + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "expression": { + "type": "ArrowFunctionExpression", + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "ArrayPattern", + "start":1,"end":6,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":6}}, + "elements": [ + { + "type": "MemberExpression", + "start":2,"end":5,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":5}}, + "object": { + "type": "Identifier", + "start":2,"end":3,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":3},"identifierName":"a"}, + "name": "a" + }, + "property": { + "type": "Identifier", + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"a"}, + "name": "a" + }, + "computed": false + } + ] + } + ], + "body": { + "type": "NumericLiteral", + "start":11,"end":13,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":13}}, + "extra": { + "rawValue": 42, + "raw": "42" + }, + "value": 42 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/370/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/370/options.json index eb23932ac559..b412ffe6712f 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/370/options.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/370/options.json @@ -1,4 +1,3 @@ { - "sourceType": "script", - "throws": "Unexpected reserved word 'enum' (1:6)" -} \ No newline at end of file + "sourceType": "script" +} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/370/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/370/output.json new file mode 100644 index 000000000000..d702eecd622a --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/370/output.json @@ -0,0 +1,42 @@ +{ + "type": "File", + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, + "errors": [ + "SyntaxError: Unexpected reserved word 'enum' (1:6)" + ], + "program": { + "type": "Program", + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":6,"end":18,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":18}}, + "id": { + "type": "Identifier", + "start":6,"end":10,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":10},"identifierName":"enum"}, + "name": "enum" + }, + "init": { + "type": "CallExpression", + "start":13,"end":18,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":18}}, + "callee": { + "type": "Identifier", + "start":13,"end":16,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":16},"identifierName":"foo"}, + "name": "foo" + }, + "arguments": [] + } + } + ], + "kind": "const" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/371/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/371/options.json index caa406928d15..2104ca43283f 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/371/options.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/371/options.json @@ -1,4 +1,3 @@ { - "sourceType": "module", - "throws": "Unexpected reserved word 'enum' (1:6)" -} \ No newline at end of file + "sourceType": "module" +} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/371/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/371/output.json new file mode 100644 index 000000000000..4333b93e5890 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/371/output.json @@ -0,0 +1,42 @@ +{ + "type": "File", + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, + "errors": [ + "SyntaxError: Unexpected reserved word 'enum' (1:6)" + ], + "program": { + "type": "Program", + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":6,"end":18,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":18}}, + "id": { + "type": "Identifier", + "start":6,"end":10,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":10},"identifierName":"enum"}, + "name": "enum" + }, + "init": { + "type": "CallExpression", + "start":13,"end":18,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":18}}, + "callee": { + "type": "Identifier", + "start":13,"end":16,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":16},"identifierName":"foo"}, + "name": "foo" + }, + "arguments": [] + } + } + ], + "kind": "const" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/372/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/372/options.json index 1b022077e7c6..b412ffe6712f 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/372/options.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/372/options.json @@ -1,4 +1,3 @@ { - "sourceType": "script", - "throws": "Unexpected reserved word 'enum' (1:8)" -} \ No newline at end of file + "sourceType": "script" +} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/372/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/372/output.json new file mode 100644 index 000000000000..6521ee477c9a --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/372/output.json @@ -0,0 +1,63 @@ +{ + "type": "File", + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, + "errors": [ + "SyntaxError: Unexpected reserved word 'enum' (1:8)" + ], + "program": { + "type": "Program", + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":6,"end":22,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":22}}, + "id": { + "type": "ObjectPattern", + "start":6,"end":14,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":14}}, + "properties": [ + { + "type": "ObjectProperty", + "start":8,"end":12,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":12}}, + "method": false, + "key": { + "type": "Identifier", + "start":8,"end":12,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":12},"identifierName":"enum"}, + "name": "enum" + }, + "computed": false, + "shorthand": true, + "value": { + "type": "Identifier", + "start":8,"end":12,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":12},"identifierName":"enum"}, + "name": "enum" + }, + "extra": { + "shorthand": true + } + } + ] + }, + "init": { + "type": "CallExpression", + "start":17,"end":22,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":22}}, + "callee": { + "type": "Identifier", + "start":17,"end":20,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":20},"identifierName":"foo"}, + "name": "foo" + }, + "arguments": [] + } + } + ], + "kind": "const" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/373/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/373/options.json index dd3434fd06e4..2104ca43283f 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/373/options.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/373/options.json @@ -1,4 +1,3 @@ { - "sourceType": "module", - "throws": "Unexpected reserved word 'enum' (1:8)" -} \ No newline at end of file + "sourceType": "module" +} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/373/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/373/output.json new file mode 100644 index 000000000000..dfeea9b4cd37 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/373/output.json @@ -0,0 +1,63 @@ +{ + "type": "File", + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, + "errors": [ + "SyntaxError: Unexpected reserved word 'enum' (1:8)" + ], + "program": { + "type": "Program", + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":6,"end":22,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":22}}, + "id": { + "type": "ObjectPattern", + "start":6,"end":14,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":14}}, + "properties": [ + { + "type": "ObjectProperty", + "start":8,"end":12,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":12}}, + "method": false, + "key": { + "type": "Identifier", + "start":8,"end":12,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":12},"identifierName":"enum"}, + "name": "enum" + }, + "computed": false, + "shorthand": true, + "value": { + "type": "Identifier", + "start":8,"end":12,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":12},"identifierName":"enum"}, + "name": "enum" + }, + "extra": { + "shorthand": true + } + } + ] + }, + "init": { + "type": "CallExpression", + "start":17,"end":22,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":22}}, + "callee": { + "type": "Identifier", + "start":17,"end":20,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":20},"identifierName":"foo"}, + "name": "foo" + }, + "arguments": [] + } + } + ], + "kind": "const" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/374/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/374/options.json index e8900a801461..b412ffe6712f 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/374/options.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/374/options.json @@ -1,4 +1,3 @@ { - "sourceType": "script", - "throws": "Unexpected reserved word 'enum' (1:15)" -} \ No newline at end of file + "sourceType": "script" +} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/374/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/374/output.json new file mode 100644 index 000000000000..19654730cb8b --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/374/output.json @@ -0,0 +1,61 @@ +{ + "type": "File", + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, + "errors": [ + "SyntaxError: Unexpected reserved word 'enum' (1:15)" + ], + "program": { + "type": "Program", + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, + "id": { + "type": "Identifier", + "start":9,"end":12,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":12},"identifierName":"foo"}, + "name": "foo" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "ObjectPattern", + "start":13,"end":21,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":21}}, + "properties": [ + { + "type": "ObjectProperty", + "start":15,"end":19,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":19}}, + "method": false, + "key": { + "type": "Identifier", + "start":15,"end":19,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":19},"identifierName":"enum"}, + "name": "enum" + }, + "computed": false, + "shorthand": true, + "value": { + "type": "Identifier", + "start":15,"end":19,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":19},"identifierName":"enum"}, + "name": "enum" + }, + "extra": { + "shorthand": true + } + } + ] + } + ], + "body": { + "type": "BlockStatement", + "start":23,"end":25,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":25}}, + "body": [], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/375/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/375/options.json index 8169da7d9069..2104ca43283f 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/375/options.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/375/options.json @@ -1,4 +1,3 @@ { - "sourceType": "module", - "throws": "Unexpected reserved word 'enum' (1:15)" -} \ No newline at end of file + "sourceType": "module" +} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/375/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/375/output.json new file mode 100644 index 000000000000..f01eb7211de7 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/375/output.json @@ -0,0 +1,61 @@ +{ + "type": "File", + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, + "errors": [ + "SyntaxError: Unexpected reserved word 'enum' (1:15)" + ], + "program": { + "type": "Program", + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, + "id": { + "type": "Identifier", + "start":9,"end":12,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":12},"identifierName":"foo"}, + "name": "foo" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "ObjectPattern", + "start":13,"end":21,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":21}}, + "properties": [ + { + "type": "ObjectProperty", + "start":15,"end":19,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":19}}, + "method": false, + "key": { + "type": "Identifier", + "start":15,"end":19,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":19},"identifierName":"enum"}, + "name": "enum" + }, + "computed": false, + "shorthand": true, + "value": { + "type": "Identifier", + "start":15,"end":19,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":19},"identifierName":"enum"}, + "name": "enum" + }, + "extra": { + "shorthand": true + } + } + ] + } + ], + "body": { + "type": "BlockStatement", + "start":23,"end":25,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":25}}, + "body": [], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/376/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/376/options.json index 24b609367ea8..b412ffe6712f 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/376/options.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/376/options.json @@ -1,4 +1,3 @@ { - "sourceType": "script", - "throws": "Unexpected reserved word 'enum' (1:9)" -} \ No newline at end of file + "sourceType": "script" +} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/376/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/376/output.json new file mode 100644 index 000000000000..322f8bc8c738 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/376/output.json @@ -0,0 +1,34 @@ +{ + "type": "File", + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, + "errors": [ + "SyntaxError: Unexpected reserved word 'enum' (1:9)" + ], + "program": { + "type": "Program", + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, + "id": { + "type": "Identifier", + "start":9,"end":13,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":13},"identifierName":"enum"}, + "name": "enum" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":16,"end":18,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":18}}, + "body": [], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/377/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/377/options.json index 51b7612a6eef..2104ca43283f 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/377/options.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/377/options.json @@ -1,4 +1,3 @@ { - "sourceType": "module", - "throws": "Unexpected reserved word 'enum' (1:9)" -} \ No newline at end of file + "sourceType": "module" +} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/377/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/377/output.json new file mode 100644 index 000000000000..4b207d606d1a --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/377/output.json @@ -0,0 +1,34 @@ +{ + "type": "File", + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, + "errors": [ + "SyntaxError: Unexpected reserved word 'enum' (1:9)" + ], + "program": { + "type": "Program", + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, + "id": { + "type": "Identifier", + "start":9,"end":13,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":13},"identifierName":"enum"}, + "name": "enum" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":16,"end":18,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":18}}, + "body": [], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/378/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/378/options.json index eb23932ac559..b412ffe6712f 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/378/options.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/378/options.json @@ -1,4 +1,3 @@ { - "sourceType": "script", - "throws": "Unexpected reserved word 'enum' (1:6)" -} \ No newline at end of file + "sourceType": "script" +} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/378/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/378/output.json new file mode 100644 index 000000000000..c7c70afe77b1 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/378/output.json @@ -0,0 +1,31 @@ +{ + "type": "File", + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "errors": [ + "SyntaxError: Unexpected reserved word 'enum' (1:6)" + ], + "program": { + "type": "Program", + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "id": { + "type": "Identifier", + "start":6,"end":10,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":10},"identifierName":"enum"}, + "name": "enum" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":11,"end":13,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":13}}, + "body": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/379/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/379/options.json index caa406928d15..2104ca43283f 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/379/options.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/379/options.json @@ -1,4 +1,3 @@ { - "sourceType": "module", - "throws": "Unexpected reserved word 'enum' (1:6)" -} \ No newline at end of file + "sourceType": "module" +} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/379/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/379/output.json new file mode 100644 index 000000000000..168f8d9cc006 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/379/output.json @@ -0,0 +1,31 @@ +{ + "type": "File", + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "errors": [ + "SyntaxError: Unexpected reserved word 'enum' (1:6)" + ], + "program": { + "type": "Program", + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "id": { + "type": "Identifier", + "start":6,"end":10,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":10},"identifierName":"enum"}, + "name": "enum" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":11,"end":13,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":13}}, + "body": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/380/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/380/output.json index cb95fa84a121..d59a3ac4ccd3 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/380/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/380/output.json @@ -1,110 +1,32 @@ { "type": "File", - "start": 0, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, "program": { "type": "Program", - "start": 0, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExportNamedDeclaration", - "start": 0, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, "specifiers": [], "source": null, "declaration": { "type": "VariableDeclaration", - "start": 7, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":7,"end":19,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":19}}, "declarations": [ { "type": "VariableDeclarator", - "start": 11, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":11,"end":18,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":18}}, "id": { "type": "Identifier", - "start": 11, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 14 - }, - "identifierName": "foo" - }, + "start":11,"end":14,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":14},"identifierName":"foo"}, "name": "foo" }, "init": { "type": "NumericLiteral", - "start": 17, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":17,"end":18,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":18}}, "extra": { "rawValue": 1, "raw": "1" diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/381/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/381/output.json index 99ed085c7128..718eae62c7e3 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/381/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/381/output.json @@ -1,110 +1,32 @@ { "type": "File", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, "program": { "type": "Program", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExportNamedDeclaration", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, "specifiers": [], "source": null, "declaration": { "type": "VariableDeclaration", - "start": 7, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":7,"end":21,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":21}}, "declarations": [ { "type": "VariableDeclarator", - "start": 13, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":13,"end":20,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":20}}, "id": { "type": "Identifier", - "start": 13, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 16 - }, - "identifierName": "foo" - }, + "start":13,"end":16,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":16},"identifierName":"foo"}, "name": "foo" }, "init": { "type": "NumericLiteral", - "start": 19, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":19,"end":20,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":20}}, "extra": { "rawValue": 1, "raw": "1" diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/382/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/382/output.json index d6ca5e1061cd..53d9b742e142 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/382/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/382/output.json @@ -1,110 +1,32 @@ { "type": "File", - "start": 0, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, "program": { "type": "Program", - "start": 0, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExportNamedDeclaration", - "start": 0, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, "specifiers": [], "source": null, "declaration": { "type": "VariableDeclaration", - "start": 7, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":7,"end":19,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":19}}, "declarations": [ { "type": "VariableDeclarator", - "start": 11, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":11,"end":18,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":18}}, "id": { "type": "Identifier", - "start": 11, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 14 - }, - "identifierName": "foo" - }, + "start":11,"end":14,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":14},"identifierName":"foo"}, "name": "foo" }, "init": { "type": "NumericLiteral", - "start": 17, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":17,"end":18,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":18}}, "extra": { "rawValue": 1, "raw": "1" diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/383/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/383/output.json index 1f6fd124cdac..fc4874aa2fc1 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/383/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/383/output.json @@ -1,96 +1,29 @@ { "type": "File", - "start": 0, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, "program": { "type": "Program", - "start": 0, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExportNamedDeclaration", - "start": 0, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, "specifiers": [], "source": null, "declaration": { "type": "ClassDeclaration", - "start": 7, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":7,"end":19,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":19}}, "id": { "type": "Identifier", - "start": 13, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 16 - }, - "identifierName": "Foo" - }, + "start":13,"end":16,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":16},"identifierName":"Foo"}, "name": "Foo" }, "superClass": null, "body": { "type": "ClassBody", - "start": 17, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":17,"end":19,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":19}}, "body": [] } } diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/384/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/384/output.json index f76dab287f78..83ea4a2e0e02 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/384/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/384/output.json @@ -1,79 +1,23 @@ { "type": "File", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "program": { "type": "Program", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExportNamedDeclaration", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "specifiers": [], "source": null, "declaration": { "type": "FunctionDeclaration", - "start": 7, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":7,"end":24,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":24}}, "id": { "type": "Identifier", - "start": 16, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 19 - }, - "identifierName": "foo" - }, + "start":16,"end":19,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":19},"identifierName":"foo"}, "name": "foo" }, "generator": false, @@ -81,18 +25,7 @@ "params": [], "body": { "type": "BlockStatement", - "start": 22, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":22,"end":24,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":24}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/385/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/385/output.json index 5432ec7cac57..a4b4f875f126 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/385/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/385/output.json @@ -1,79 +1,23 @@ { "type": "File", - "start": 0, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, "program": { "type": "Program", - "start": 0, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExportNamedDeclaration", - "start": 0, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, "specifiers": [], "source": null, "declaration": { "type": "FunctionDeclaration", - "start": 7, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":7,"end":30,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":30}}, "id": { "type": "Identifier", - "start": 22, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 25 - }, - "identifierName": "foo" - }, + "start":22,"end":25,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":25},"identifierName":"foo"}, "name": "foo" }, "generator": false, @@ -81,18 +25,7 @@ "params": [], "body": { "type": "BlockStatement", - "start": 28, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":28,"end":30,"loc":{"start":{"line":1,"column":28},"end":{"line":1,"column":30}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/39/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/39/output.json index e60231ec6c36..b2f75a4c1c78 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/39/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/39/output.json @@ -1,111 +1,33 @@ { "type": "File", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "program": { "type": "Program", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "expression": { "type": "ArrowFunctionExpression", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "id": null, "generator": false, "async": false, "params": [ { "type": "AssignmentPattern", - "start": 1, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 4 - } - }, + "start":1,"end":4,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":4}}, "left": { "type": "Identifier", - "start": 1, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - }, - "identifierName": "x" - }, + "start":1,"end":2,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":2},"identifierName":"x"}, "name": "x" }, "right": { "type": "NumericLiteral", - "start": 3, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 4 - } - }, + "start":3,"end":4,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":4}}, "extra": { "rawValue": 1, "raw": "1" @@ -116,51 +38,16 @@ ], "body": { "type": "BinaryExpression", - "start": 9, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":9,"end":14,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":14}}, "left": { "type": "Identifier", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - }, - "identifierName": "x" - }, + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"x"}, "name": "x" }, "operator": "*", "right": { "type": "Identifier", - "start": 13, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - }, - "identifierName": "x" - }, + "start":13,"end":14,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":14},"identifierName":"x"}, "name": "x" } } diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/391/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/391/output.json index 643d6046807d..447c3d253302 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/391/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/391/output.json @@ -1,79 +1,23 @@ { "type": "File", - "start": 0, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, "program": { "type": "Program", - "start": 0, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExportNamedDeclaration", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, "specifiers": [], "source": null, "declaration": { "type": "FunctionDeclaration", - "start": 7, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":7,"end":25,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":25}}, "id": { "type": "Identifier", - "start": 17, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 20 - }, - "identifierName": "foo" - }, + "start":17,"end":20,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":20},"identifierName":"foo"}, "name": "foo" }, "generator": true, @@ -81,18 +25,7 @@ "params": [], "body": { "type": "BlockStatement", - "start": 23, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":23,"end":25,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":25}}, "body": [], "directives": [] } @@ -100,18 +33,7 @@ }, { "type": "EmptyStatement", - "start": 25, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 26 - } - } + "start":25,"end":26,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":26}} } ], "directives": [] diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/393/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/393/output.json index beaa3b4c55c9..e09222b115c1 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/393/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/393/output.json @@ -1,160 +1,48 @@ { "type": "File", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, "program": { "type": "Program", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, "expression": { "type": "ArrowFunctionExpression", - "start": 0, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, "id": null, "generator": false, "async": false, "params": [ { "type": "ObjectPattern", - "start": 1, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":1,"end":11,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":11}}, "properties": [ { "type": "ObjectProperty", - "start": 2, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":2,"end":10,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":10}}, "method": false, "key": { "type": "Identifier", - "start": 2, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "set" - }, + "start":2,"end":5,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":5},"identifierName":"set"}, "name": "set" }, "computed": false, "shorthand": true, "value": { "type": "AssignmentPattern", - "start": 2, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":2,"end":10,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":10}}, "left": { "type": "Identifier", - "start": 2, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "set" - }, + "start":2,"end":5,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":5},"identifierName":"set"}, "name": "set" }, "right": { "type": "ObjectExpression", - "start": 8, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":8,"end":10,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":10}}, "properties": [] } }, @@ -167,19 +55,7 @@ ], "body": { "type": "Identifier", - "start": 16, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 19 - }, - "identifierName": "set" - }, + "start":16,"end":19,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":19},"identifierName":"set"}, "name": "set" } } diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/394/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/394/output.json index 3eccd63cbd63..611110b17d2f 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/394/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/394/output.json @@ -1,78 +1,22 @@ { "type": "File", - "start": 0, - "end": 43, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 14 - } - }, + "start":0,"end":43,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":14}}, "program": { "type": "Program", - "start": 0, - "end": 43, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 14 - } - }, + "start":0,"end":43,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":14}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5}}, "id": { "type": "Identifier", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "a" - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"a"}, "name": "a" }, "init": null @@ -82,172 +26,48 @@ }, { "type": "ExpressionStatement", - "start": 7, - "end": 16, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 9 - } - }, + "start":7,"end":16,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":9}}, "expression": { "type": "AssignmentExpression", - "start": 7, - "end": 15, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 8 - } - }, + "start":7,"end":15,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":8}}, "operator": "=", "left": { "type": "ParenthesizedExpression", - "start": 7, - "end": 10, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 3 - } - }, + "start":7,"end":10,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":3}}, "expression": { "type": "Identifier", - "start": 8, - "end": 9, - "loc": { - "start": { - "line": 2, - "column": 1 - }, - "end": { - "line": 2, - "column": 2 - }, - "identifierName": "a" - }, + "start":8,"end":9,"loc":{"start":{"line":2,"column":1},"end":{"line":2,"column":2},"identifierName":"a"}, "name": "a" } }, "right": { "type": "ObjectExpression", - "start": 13, - "end": 15, - "loc": { - "start": { - "line": 2, - "column": 6 - }, - "end": { - "line": 2, - "column": 8 - } - }, + "start":13,"end":15,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":8}}, "properties": [] } } }, { "type": "ExpressionStatement", - "start": 17, - "end": 28, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 11 - } - }, + "start":17,"end":28,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":11}}, "expression": { "type": "AssignmentExpression", - "start": 17, - "end": 27, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 10 - } - }, + "start":17,"end":27,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":10}}, "operator": "=", "left": { "type": "ParenthesizedExpression", - "start": 17, - "end": 22, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 5 - } - }, + "start":17,"end":22,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":5}}, "expression": { "type": "MemberExpression", - "start": 18, - "end": 21, - "loc": { - "start": { - "line": 3, - "column": 1 - }, - "end": { - "line": 3, - "column": 4 - } - }, + "start":18,"end":21,"loc":{"start":{"line":3,"column":1},"end":{"line":3,"column":4}}, "object": { "type": "Identifier", - "start": 18, - "end": 19, - "loc": { - "start": { - "line": 3, - "column": 1 - }, - "end": { - "line": 3, - "column": 2 - }, - "identifierName": "a" - }, + "start":18,"end":19,"loc":{"start":{"line":3,"column":1},"end":{"line":3,"column":2},"identifierName":"a"}, "name": "a" }, "property": { "type": "Identifier", - "start": 20, - "end": 21, - "loc": { - "start": { - "line": 3, - "column": 3 - }, - "end": { - "line": 3, - "column": 4 - }, - "identifierName": "b" - }, + "start":20,"end":21,"loc":{"start":{"line":3,"column":3},"end":{"line":3,"column":4},"identifierName":"b"}, "name": "b" }, "computed": false @@ -255,110 +75,32 @@ }, "right": { "type": "ObjectExpression", - "start": 25, - "end": 27, - "loc": { - "start": { - "line": 3, - "column": 8 - }, - "end": { - "line": 3, - "column": 10 - } - }, + "start":25,"end":27,"loc":{"start":{"line":3,"column":8},"end":{"line":3,"column":10}}, "properties": [] } } }, { "type": "ExpressionStatement", - "start": 29, - "end": 43, - "loc": { - "start": { - "line": 4, - "column": 0 - }, - "end": { - "line": 4, - "column": 14 - } - }, + "start":29,"end":43,"loc":{"start":{"line":4,"column":0},"end":{"line":4,"column":14}}, "expression": { "type": "AssignmentExpression", - "start": 29, - "end": 42, - "loc": { - "start": { - "line": 4, - "column": 0 - }, - "end": { - "line": 4, - "column": 13 - } - }, + "start":29,"end":42,"loc":{"start":{"line":4,"column":0},"end":{"line":4,"column":13}}, "operator": "=", "left": { "type": "ParenthesizedExpression", - "start": 29, - "end": 37, - "loc": { - "start": { - "line": 4, - "column": 0 - }, - "end": { - "line": 4, - "column": 8 - } - }, + "start":29,"end":37,"loc":{"start":{"line":4,"column":0},"end":{"line":4,"column":8}}, "expression": { "type": "MemberExpression", - "start": 30, - "end": 36, - "loc": { - "start": { - "line": 4, - "column": 1 - }, - "end": { - "line": 4, - "column": 7 - } - }, + "start":30,"end":36,"loc":{"start":{"line":4,"column":1},"end":{"line":4,"column":7}}, "object": { "type": "Identifier", - "start": 30, - "end": 31, - "loc": { - "start": { - "line": 4, - "column": 1 - }, - "end": { - "line": 4, - "column": 2 - }, - "identifierName": "a" - }, + "start":30,"end":31,"loc":{"start":{"line":4,"column":1},"end":{"line":4,"column":2},"identifierName":"a"}, "name": "a" }, "property": { "type": "StringLiteral", - "start": 32, - "end": 35, - "loc": { - "start": { - "line": 4, - "column": 3 - }, - "end": { - "line": 4, - "column": 6 - } - }, + "start":32,"end":35,"loc":{"start":{"line":4,"column":3},"end":{"line":4,"column":6}}, "extra": { "rawValue": "c", "raw": "'c'" @@ -370,18 +112,7 @@ }, "right": { "type": "ObjectExpression", - "start": 40, - "end": 42, - "loc": { - "start": { - "line": 4, - "column": 11 - }, - "end": { - "line": 4, - "column": 13 - } - }, + "start":40,"end":42,"loc":{"start":{"line":4,"column":11},"end":{"line":4,"column":13}}, "properties": [] } } diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/395/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/395/options.json index db72a6af957d..0861962d889d 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/395/options.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/395/options.json @@ -1,4 +1,3 @@ { - "createParenthesizedExpressions": true, - "throws": "Invalid left-hand side in arrow function parameters (1:2)" + "createParenthesizedExpressions": true } diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/395/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/395/output.json new file mode 100644 index 000000000000..58ec7c24759d --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/395/output.json @@ -0,0 +1,59 @@ +{ + "type": "File", + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "errors": [ + "SyntaxError: Binding member expression (1:2)" + ], + "program": { + "type": "Program", + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "expression": { + "type": "ArrowFunctionExpression", + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "ArrayPattern", + "start":1,"end":6,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":6}}, + "elements": [ + { + "type": "MemberExpression", + "start":2,"end":5,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":5}}, + "object": { + "type": "Identifier", + "start":2,"end":3,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":3},"identifierName":"a"}, + "name": "a" + }, + "property": { + "type": "Identifier", + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"a"}, + "name": "a" + }, + "computed": false + } + ] + } + ], + "body": { + "type": "NumericLiteral", + "start":11,"end":13,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":13}}, + "extra": { + "rawValue": 42, + "raw": "42" + }, + "value": 42 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/4/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/4/output.json index ba347ead99ce..69b1fc0dba64 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/4/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/4/output.json @@ -1,62 +1,18 @@ { "type": "File", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, "program": { "type": "Program", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, "expression": { "type": "NumericLiteral", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, "extra": { "rawValue": 0, "raw": "0o0" diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/40/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/40/output.json index 8f40c2b9e5c3..8f63cdd60d01 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/40/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/40/output.json @@ -1,98 +1,31 @@ { "type": "File", - "start": 0, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, "program": { "type": "Program", - "start": 0, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, "expression": { "type": "ArrowFunctionExpression", - "start": 0, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, "id": null, "generator": false, "async": false, "params": [ { "type": "Identifier", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - }, - "identifierName": "eval" - }, + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4},"identifierName":"eval"}, "name": "eval" } ], "body": { "type": "NumericLiteral", - "start": 8, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":8,"end":10,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":10}}, "extra": { "rawValue": 42, "raw": "42" diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/41/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/41/output.json index 13a6a64d0306..d33e35056af2 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/41/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/41/output.json @@ -1,98 +1,31 @@ { "type": "File", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "program": { "type": "Program", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "expression": { "type": "ArrowFunctionExpression", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "id": null, "generator": false, "async": false, "params": [ { "type": "Identifier", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "arguments" - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9},"identifierName":"arguments"}, "name": "arguments" } ], "body": { "type": "NumericLiteral", - "start": 13, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":13,"end":15,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":15}}, "extra": { "rawValue": 42, "raw": "42" diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/42/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/42/output.json index 6ae12c62e3e2..72ab3ece3629 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/42/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/42/output.json @@ -1,98 +1,31 @@ { "type": "File", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "program": { "type": "Program", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "expression": { "type": "ArrowFunctionExpression", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "id": null, "generator": false, "async": false, "params": [ { "type": "Identifier", - "start": 1, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - }, - "identifierName": "a" - }, + "start":1,"end":2,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":2},"identifierName":"a"}, "name": "a" } ], "body": { "type": "NumericLiteral", - "start": 7, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":7,"end":9,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":9}}, "extra": { "rawValue": 0, "raw": "00" diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/43/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/43/output.json index fd7a891d8c4d..ed7c52c2993e 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/43/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/43/output.json @@ -1,115 +1,36 @@ { "type": "File", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "program": { "type": "Program", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "expression": { "type": "ArrowFunctionExpression", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "id": null, "generator": false, "async": false, "params": [ { "type": "Identifier", - "start": 1, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "eval" - }, + "start":1,"end":5,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":5},"identifierName":"eval"}, "name": "eval" }, { "type": "Identifier", - "start": 7, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - }, - "identifierName": "a" - }, + "start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8},"identifierName":"a"}, "name": "a" } ], "body": { "type": "NumericLiteral", - "start": 13, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":13,"end":15,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":15}}, "extra": { "rawValue": 42, "raw": "42" diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/44/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/44/output.json index a51e793b44a2..d13b2732673e 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/44/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/44/output.json @@ -1,111 +1,33 @@ { "type": "File", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "program": { "type": "Program", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "expression": { "type": "ArrowFunctionExpression", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "id": null, "generator": false, "async": false, "params": [ { "type": "AssignmentPattern", - "start": 1, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":1,"end":10,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":10}}, "left": { "type": "Identifier", - "start": 1, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "eval" - }, + "start":1,"end":5,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":5},"identifierName":"eval"}, "name": "eval" }, "right": { "type": "NumericLiteral", - "start": 8, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":8,"end":10,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":10}}, "extra": { "rawValue": 10, "raw": "10" @@ -116,18 +38,7 @@ ], "body": { "type": "NumericLiteral", - "start": 15, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":15,"end":17,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":17}}, "extra": { "rawValue": 42, "raw": "42" diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/45/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/45/output.json index 114403aa5ed5..d3c143b18e69 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/45/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/45/output.json @@ -1,128 +1,38 @@ { "type": "File", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, "program": { "type": "Program", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, "expression": { "type": "ArrowFunctionExpression", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, "id": null, "generator": false, "async": false, "params": [ { "type": "Identifier", - "start": 1, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "eval" - }, + "start":1,"end":5,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":5},"identifierName":"eval"}, "name": "eval" }, { "type": "AssignmentPattern", - "start": 7, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":7,"end":13,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":13}}, "left": { "type": "Identifier", - "start": 7, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - }, - "identifierName": "a" - }, + "start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8},"identifierName":"a"}, "name": "a" }, "right": { "type": "NumericLiteral", - "start": 11, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":11,"end":13,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":13}}, "extra": { "rawValue": 10, "raw": "10" @@ -133,18 +43,7 @@ ], "body": { "type": "NumericLiteral", - "start": 18, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":18,"end":20,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":20}}, "extra": { "rawValue": 42, "raw": "42" diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/46/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/46/output.json index cd821a586b61..245d1b011abf 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/46/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/46/output.json @@ -1,99 +1,31 @@ { "type": "File", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, "program": { "type": "Program", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, "expression": { "type": "ArrowFunctionExpression", - "start": 1, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":1,"end":7,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":7}}, "id": null, "generator": false, "async": false, "params": [ { "type": "Identifier", - "start": 1, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - }, - "identifierName": "x" - }, + "start":1,"end":2,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":2},"identifierName":"x"}, "name": "x" } ], "body": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "x" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"x"}, "name": "x" }, "extra": { diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/47/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/47/output.json index 9250f449ee17..c513497671ef 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/47/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/47/output.json @@ -1,134 +1,44 @@ { "type": "File", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, "program": { "type": "Program", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, "expression": { "type": "ArrowFunctionExpression", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, "id": null, "generator": false, "async": false, "params": [ { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" } ], "body": { "type": "ArrowFunctionExpression", - "start": 5, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":5,"end":12,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":12}}, "id": null, "generator": false, "async": false, "params": [ { "type": "Identifier", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "y" - }, + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"y"}, "name": "y" } ], "body": { "type": "NumericLiteral", - "start": 10, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":10,"end":12,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":12}}, "extra": { "rawValue": 42, "raw": "42" diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/48/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/48/output.json index cdd0d45ecea5..91ad2d7f7a3e 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/48/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/48/output.json @@ -1,201 +1,63 @@ { "type": "File", - "start": 0, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, "program": { "type": "Program", - "start": 0, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, "expression": { "type": "ArrowFunctionExpression", - "start": 0, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, "id": null, "generator": false, "async": false, "params": [ { "type": "Identifier", - "start": 1, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - }, - "identifierName": "x" - }, + "start":1,"end":2,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":2},"identifierName":"x"}, "name": "x" } ], "body": { "type": "ArrowFunctionExpression", - "start": 8, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":8,"end":27,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":27}}, "id": null, "generator": false, "async": false, "params": [ { "type": "Identifier", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - }, - "identifierName": "y" - }, + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"y"}, "name": "y" }, { "type": "Identifier", - "start": 12, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - }, - "identifierName": "z" - }, + "start":12,"end":13,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":13},"identifierName":"z"}, "name": "z" } ], "body": { "type": "SequenceExpression", - "start": 19, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":19,"end":26,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":26}}, "expressions": [ { "type": "Identifier", - "start": 19, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 20 - }, - "identifierName": "x" - }, + "start":19,"end":20,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":20},"identifierName":"x"}, "name": "x" }, { "type": "Identifier", - "start": 22, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 23 - }, - "identifierName": "y" - }, + "start":22,"end":23,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":23},"identifierName":"y"}, "name": "y" }, { "type": "Identifier", - "start": 25, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 26 - }, - "identifierName": "z" - }, + "start":25,"end":26,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":26},"identifierName":"z"}, "name": "z" } ], diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/49/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/49/output.json index fb2194b635f5..1d6b874fa0e3 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/49/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/49/output.json @@ -1,112 +1,34 @@ { "type": "File", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "program": { "type": "Program", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "expression": { "type": "CallExpression", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "callee": { "type": "Identifier", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - }, - "identifierName": "foo" - }, + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3},"identifierName":"foo"}, "name": "foo" }, "arguments": [ { "type": "ArrowFunctionExpression", - "start": 4, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":4,"end":12,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":12}}, "id": null, "generator": false, "async": false, "params": [], "body": { "type": "BlockStatement", - "start": 10, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":10,"end":12,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":12}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/5/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/5/output.json index d5fe344096cb..61be53c7f1b1 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/5/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/5/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 37 - } - }, + "start":0,"end":37,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":37}}, "program": { "type": "Program", - "start": 0, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 37 - } - }, + "start":0,"end":37,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":37}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 37 - } - }, + "start":0,"end":37,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":37}}, "id": { "type": "Identifier", - "start": 9, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 13 - }, - "identifierName": "test" - }, + "start":9,"end":13,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":13},"identifierName":"test"}, "name": "test" }, "generator": false, @@ -65,47 +20,14 @@ "params": [], "body": { "type": "BlockStatement", - "start": 16, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 37 - } - }, + "start":16,"end":37,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":37}}, "body": [ { "type": "ExpressionStatement", - "start": 31, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 31 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":31,"end":35,"loc":{"start":{"line":1,"column":31},"end":{"line":1,"column":35}}, "expression": { "type": "NumericLiteral", - "start": 31, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 31 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":31,"end":34,"loc":{"start":{"line":1,"column":31},"end":{"line":1,"column":34}}, "extra": { "rawValue": 0, "raw": "0o0" @@ -117,32 +39,10 @@ "directives": [ { "type": "Directive", - "start": 17, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":17,"end":30,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":30}}, "value": { "type": "DirectiveLiteral", - "start": 17, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":17,"end":29,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":29}}, "value": "use strict", "extra": { "raw": "'use strict'", diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/50/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/50/output.json index c075ce9f9170..d8574a83a95b 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/50/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/50/output.json @@ -1,147 +1,45 @@ { "type": "File", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "program": { "type": "Program", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "expression": { "type": "CallExpression", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "callee": { "type": "Identifier", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - }, - "identifierName": "foo" - }, + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3},"identifierName":"foo"}, "name": "foo" }, "arguments": [ { "type": "ArrowFunctionExpression", - "start": 4, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":4,"end":16,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":16}}, "id": null, "generator": false, "async": false, "params": [ { "type": "Identifier", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "x" - }, + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"x"}, "name": "x" }, { "type": "Identifier", - "start": 8, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "y" - }, + "start":8,"end":9,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":9},"identifierName":"y"}, "name": "y" } ], "body": { "type": "BlockStatement", - "start": 14, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":14,"end":16,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":16}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/52/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/52/output.json index f21c6941d4bc..5a3a57f142ee 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/52/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/52/output.json @@ -1,125 +1,35 @@ { "type": "File", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, "program": { "type": "Program", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, "expression": { "type": "AssignmentExpression", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, "operator": "=", "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "right": { "type": "ObjectExpression", - "start": 4, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":4,"end":20,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":20}}, "properties": [ { "type": "ObjectMethod", - "start": 6, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":6,"end":18,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":18}}, "method": true, "key": { "type": "Identifier", - "start": 6, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "method" - }, + "start":6,"end":12,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":12},"identifierName":"method"}, "name": "method" }, "computed": false, @@ -130,18 +40,7 @@ "params": [], "body": { "type": "BlockStatement", - "start": 15, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":15,"end":18,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":18}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/53/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/53/output.json index c81975172df7..69bfad8eae51 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/53/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/53/output.json @@ -1,125 +1,35 @@ { "type": "File", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "program": { "type": "Program", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "expression": { "type": "AssignmentExpression", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "operator": "=", "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "right": { "type": "ObjectExpression", - "start": 4, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":4,"end":24,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":24}}, "properties": [ { "type": "ObjectMethod", - "start": 6, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":6,"end":22,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":22}}, "method": true, "key": { "type": "Identifier", - "start": 6, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "method" - }, + "start":6,"end":12,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":12},"identifierName":"method"}, "name": "method" }, "computed": false, @@ -130,36 +40,13 @@ "params": [ { "type": "Identifier", - "start": 13, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 17 - }, - "identifierName": "test" - }, + "start":13,"end":17,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":17},"identifierName":"test"}, "name": "test" } ], "body": { "type": "BlockStatement", - "start": 19, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":19,"end":22,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":22}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/54/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/54/output.json index 1b04fa1a9e0d..9458f1abaebd 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/54/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/54/output.json @@ -1,124 +1,35 @@ { "type": "File", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "program": { "type": "Program", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "expression": { "type": "AssignmentExpression", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "operator": "=", "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "right": { "type": "ObjectExpression", - "start": 4, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":4,"end":22,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":22}}, "properties": [ { "type": "ObjectMethod", - "start": 6, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":6,"end":20,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":20}}, "method": true, "key": { "type": "StringLiteral", - "start": 6, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":6,"end":14,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":14}}, "extra": { "rawValue": "method", "raw": "'method'" @@ -133,18 +44,7 @@ "params": [], "body": { "type": "BlockStatement", - "start": 17, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":17,"end":20,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":20}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/55/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/55/output.json index b741ed8e8cc8..e4fe6bae92ef 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/55/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/55/output.json @@ -1,125 +1,35 @@ { "type": "File", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "program": { "type": "Program", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "expression": { "type": "AssignmentExpression", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "operator": "=", "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "right": { "type": "ObjectExpression", - "start": 4, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":4,"end":17,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":17}}, "properties": [ { "type": "ObjectMethod", - "start": 6, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":6,"end":15,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":15}}, "method": true, "key": { "type": "Identifier", - "start": 6, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "get" - }, + "start":6,"end":9,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":9},"identifierName":"get"}, "name": "get" }, "computed": false, @@ -130,18 +40,7 @@ "params": [], "body": { "type": "BlockStatement", - "start": 12, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":12,"end":15,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":15}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/56/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/56/output.json index dcc857d36a87..501eec0d1df1 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/56/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/56/output.json @@ -1,125 +1,35 @@ { "type": "File", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "program": { "type": "Program", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "expression": { "type": "AssignmentExpression", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "operator": "=", "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "right": { "type": "ObjectExpression", - "start": 4, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":4,"end":17,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":17}}, "properties": [ { "type": "ObjectMethod", - "start": 6, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":6,"end":15,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":15}}, "method": true, "key": { "type": "Identifier", - "start": 6, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "set" - }, + "start":6,"end":9,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":9},"identifierName":"set"}, "name": "set" }, "computed": false, @@ -130,18 +40,7 @@ "params": [], "body": { "type": "BlockStatement", - "start": 12, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":12,"end":15,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":15}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/6/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/6/output.json index 83bb02767b09..8e667f20e78c 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/6/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/6/output.json @@ -1,62 +1,18 @@ { "type": "File", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, "program": { "type": "Program", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, "expression": { "type": "NumericLiteral", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, "extra": { "rawValue": 2, "raw": "0o2" diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/61/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/61/output.json index 4d782bacf314..d3c16c2f9e79 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/61/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/61/output.json @@ -1,144 +1,42 @@ { "type": "File", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, "program": { "type": "Program", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, "expression": { "type": "AssignmentExpression", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, "operator": "=", "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "right": { "type": "ObjectExpression", - "start": 4, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":4,"end":12,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":12}}, "properties": [ { "type": "ObjectProperty", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7}}, "method": false, "key": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "y" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"y"}, "name": "y" }, "computed": false, "shorthand": true, "value": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "y" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"y"}, "name": "y" }, "extra": { @@ -147,53 +45,18 @@ }, { "type": "ObjectProperty", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10}}, "method": false, "key": { "type": "Identifier", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - }, - "identifierName": "z" - }, + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"z"}, "name": "z" }, "computed": false, "shorthand": true, "value": { "type": "Identifier", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - }, - "identifierName": "z" - }, + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"z"}, "name": "z" }, "extra": { diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/62/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/62/output.json index c26d3df644c3..8f81c662bb53 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/62/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/62/output.json @@ -1,161 +1,47 @@ { "type": "File", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "program": { "type": "Program", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "expression": { "type": "AssignmentExpression", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "operator": "=", "left": { "type": "ArrayPattern", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "elements": [ { "type": "Identifier", - "start": 1, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - }, - "identifierName": "a" - }, + "start":1,"end":2,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":2},"identifierName":"a"}, "name": "a" }, { "type": "Identifier", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "b" - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"b"}, "name": "b" } ] }, "right": { "type": "ArrayExpression", - "start": 9, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":9,"end":15,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":15}}, "elements": [ { "type": "Identifier", - "start": 10, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "b" - }, + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11},"identifierName":"b"}, "name": "b" }, { "type": "Identifier", - "start": 13, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - }, - "identifierName": "a" - }, + "start":13,"end":14,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":14},"identifierName":"a"}, "name": "a" } ] diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/63/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/63/output.json index 4f02fd1fd088..bfffdb8bfb6a 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/63/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/63/output.json @@ -1,127 +1,37 @@ { "type": "File", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "program": { "type": "Program", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "declarations": [ { "type": "VariableDeclarator", - "start": 6, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":6,"end":14,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":14}}, "id": { "type": "ObjectPattern", - "start": 6, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":6,"end":9,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":9}}, "properties": [ { "type": "ObjectProperty", - "start": 7, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8}}, "method": false, "key": { "type": "Identifier", - "start": 7, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - }, - "identifierName": "a" - }, + "start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8},"identifierName":"a"}, "name": "a" }, "computed": false, "shorthand": true, "value": { "type": "Identifier", - "start": 7, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - }, - "identifierName": "a" - }, + "start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8},"identifierName":"a"}, "name": "a" }, "extra": { @@ -132,18 +42,7 @@ }, "init": { "type": "ObjectExpression", - "start": 12, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":12,"end":14,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":14}}, "properties": [] } } diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/64/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/64/output.json index 22e50c8fddb6..858f2811a828 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/64/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/64/output.json @@ -1,111 +1,33 @@ { "type": "File", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "program": { "type": "Program", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "declarations": [ { "type": "VariableDeclarator", - "start": 6, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":6,"end":14,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":14}}, "id": { "type": "ArrayPattern", - "start": 6, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":6,"end":9,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":9}}, "elements": [ { "type": "Identifier", - "start": 7, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - }, - "identifierName": "a" - }, + "start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8},"identifierName":"a"}, "name": "a" } ] }, "init": { "type": "ArrayExpression", - "start": 12, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":12,"end":14,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":14}}, "elements": [] } } diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/65/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/65/output.json index 58770afcb58a..78253742ef87 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/65/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/65/output.json @@ -1,127 +1,37 @@ { "type": "File", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, "program": { "type": "Program", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":4,"end":12,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":12}}, "id": { "type": "ObjectPattern", - "start": 4, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":4,"end":7,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":7}}, "properties": [ { "type": "ObjectProperty", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, "method": false, "key": { "type": "Identifier", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "a" - }, + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"a"}, "name": "a" }, "computed": false, "shorthand": true, "value": { "type": "Identifier", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "a" - }, + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"a"}, "name": "a" }, "extra": { @@ -132,18 +42,7 @@ }, "init": { "type": "ObjectExpression", - "start": 10, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":10,"end":12,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":12}}, "properties": [] } } diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/66/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/66/output.json index 4b9e1e2f8f37..ce4e71a130fa 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/66/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/66/output.json @@ -1,111 +1,33 @@ { "type": "File", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, "program": { "type": "Program", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":4,"end":12,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":12}}, "id": { "type": "ArrayPattern", - "start": 4, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":4,"end":7,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":7}}, "elements": [ { "type": "Identifier", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "a" - }, + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"a"}, "name": "a" } ] }, "init": { "type": "ArrayExpression", - "start": 10, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":10,"end":12,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":12}}, "elements": [] } } diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/67/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/67/output.json index 389812ee6da3..8b63047c199c 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/67/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/67/output.json @@ -1,127 +1,37 @@ { "type": "File", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, "program": { "type": "Program", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":4,"end":12,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":12}}, "id": { "type": "ObjectPattern", - "start": 4, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":4,"end":7,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":7}}, "properties": [ { "type": "ObjectProperty", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, "method": false, "key": { "type": "Identifier", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "a" - }, + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"a"}, "name": "a" }, "computed": false, "shorthand": true, "value": { "type": "Identifier", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "a" - }, + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"a"}, "name": "a" }, "extra": { @@ -132,18 +42,7 @@ }, "init": { "type": "ObjectExpression", - "start": 10, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":10,"end":12,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":12}}, "properties": [] } } diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/68/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/68/output.json index b51f000a64d4..3ba59fcb3ece 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/68/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/68/output.json @@ -1,111 +1,33 @@ { "type": "File", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, "program": { "type": "Program", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":4,"end":12,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":12}}, "id": { "type": "ArrayPattern", - "start": 4, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":4,"end":7,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":7}}, "elements": [ { "type": "Identifier", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "a" - }, + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"a"}, "name": "a" } ] }, "init": { "type": "ArrayExpression", - "start": 10, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":10,"end":12,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":12}}, "elements": [] } } diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/69/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/69/output.json index 0255b7eed528..b10331a51b00 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/69/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/69/output.json @@ -1,127 +1,37 @@ { "type": "File", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "program": { "type": "Program", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "declarations": [ { "type": "VariableDeclarator", - "start": 6, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":6,"end":16,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":16}}, "id": { "type": "ObjectPattern", - "start": 6, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":6,"end":11,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":11}}, "properties": [ { "type": "ObjectProperty", - "start": 7, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":7,"end":10,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":10}}, "method": false, "key": { "type": "Identifier", - "start": 7, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - }, - "identifierName": "a" - }, + "start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8},"identifierName":"a"}, "name": "a" }, "computed": false, "shorthand": false, "value": { "type": "Identifier", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - }, - "identifierName": "b" - }, + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"b"}, "name": "b" } } @@ -129,18 +39,7 @@ }, "init": { "type": "ObjectExpression", - "start": 14, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":14,"end":16,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":16}}, "properties": [] } } diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/7/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/7/output.json index b6a8fbeae786..cb18be592388 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/7/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/7/output.json @@ -1,62 +1,18 @@ { "type": "File", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - }, + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, "program": { "type": "Program", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - }, + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - }, + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, "expression": { "type": "NumericLiteral", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - }, + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, "extra": { "rawValue": 10, "raw": "0o12" diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/70/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/70/output.json index cdc69cac50d0..18020adbe1ec 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/70/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/70/output.json @@ -1,127 +1,37 @@ { "type": "File", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "program": { "type": "Program", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":4,"end":14,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":14}}, "id": { "type": "ObjectPattern", - "start": 4, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":4,"end":9,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":9}}, "properties": [ { "type": "ObjectProperty", - "start": 5, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":5,"end":8,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":8}}, "method": false, "key": { "type": "Identifier", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "a" - }, + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"a"}, "name": "a" }, "computed": false, "shorthand": false, "value": { "type": "Identifier", - "start": 7, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - }, - "identifierName": "b" - }, + "start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8},"identifierName":"b"}, "name": "b" } } @@ -129,18 +39,7 @@ }, "init": { "type": "ObjectExpression", - "start": 12, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":12,"end":14,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":14}}, "properties": [] } } diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/71/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/71/output.json index 9340538d885e..d8a1fcb10627 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/71/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/71/output.json @@ -1,127 +1,37 @@ { "type": "File", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "program": { "type": "Program", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":4,"end":14,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":14}}, "id": { "type": "ObjectPattern", - "start": 4, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":4,"end":9,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":9}}, "properties": [ { "type": "ObjectProperty", - "start": 5, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":5,"end":8,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":8}}, "method": false, "key": { "type": "Identifier", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "a" - }, + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"a"}, "name": "a" }, "computed": false, "shorthand": false, "value": { "type": "Identifier", - "start": 7, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - }, - "identifierName": "b" - }, + "start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8},"identifierName":"b"}, "name": "b" } } @@ -129,18 +39,7 @@ }, "init": { "type": "ObjectExpression", - "start": 12, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":12,"end":14,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":14}}, "properties": [] } } diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/72/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/72/output.json index 42877b9e2901..653a4a71e636 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/72/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/72/output.json @@ -1,94 +1,27 @@ { "type": "File", - "start": 0, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, "program": { "type": "Program", - "start": 0, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExportNamedDeclaration", - "start": 0, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, "specifiers": [], "source": null, "declaration": { "type": "VariableDeclaration", - "start": 7, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":7,"end":19,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":19}}, "declarations": [ { "type": "VariableDeclarator", - "start": 11, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":11,"end":19,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":19}}, "id": { "type": "Identifier", - "start": 11, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 19 - }, - "identifierName": "document" - }, + "start":11,"end":19,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":19},"identifierName":"document"}, "name": "document" }, "init": null diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/73/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/73/output.json index 666b9568c377..09f7482c16e7 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/73/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/73/output.json @@ -1,110 +1,32 @@ { "type": "File", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, "program": { "type": "Program", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExportNamedDeclaration", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, "specifiers": [], "source": null, "declaration": { "type": "VariableDeclaration", - "start": 7, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":7,"end":25,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":25}}, "declarations": [ { "type": "VariableDeclarator", - "start": 11, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":11,"end":25,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":25}}, "id": { "type": "Identifier", - "start": 11, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 19 - }, - "identifierName": "document" - }, + "start":11,"end":19,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":19},"identifierName":"document"}, "name": "document" }, "init": { "type": "ObjectExpression", - "start": 22, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":22,"end":25,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":25}}, "properties": [] } } diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/74/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/74/output.json index 2a9c973e47f5..ccd72eb65d02 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/74/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/74/output.json @@ -1,94 +1,27 @@ { "type": "File", - "start": 0, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, "program": { "type": "Program", - "start": 0, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExportNamedDeclaration", - "start": 0, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, "specifiers": [], "source": null, "declaration": { "type": "VariableDeclaration", - "start": 7, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":7,"end":19,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":19}}, "declarations": [ { "type": "VariableDeclarator", - "start": 11, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":11,"end":19,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":19}}, "id": { "type": "Identifier", - "start": 11, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 19 - }, - "identifierName": "document" - }, + "start":11,"end":19,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":19},"identifierName":"document"}, "name": "document" }, "init": null diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/75/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/75/output.json index 9d7617c35873..b1d90d76c4fc 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/75/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/75/output.json @@ -1,110 +1,32 @@ { "type": "File", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, "program": { "type": "Program", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExportNamedDeclaration", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, "specifiers": [], "source": null, "declaration": { "type": "VariableDeclaration", - "start": 7, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":7,"end":25,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":25}}, "declarations": [ { "type": "VariableDeclarator", - "start": 11, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":11,"end":25,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":25}}, "id": { "type": "Identifier", - "start": 11, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 19 - }, - "identifierName": "document" - }, + "start":11,"end":19,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":19},"identifierName":"document"}, "name": "document" }, "init": { "type": "ObjectExpression", - "start": 22, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":22,"end":25,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":25}}, "properties": [] } } diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/76/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/76/output.json index 7262e926c7cc..421458d255eb 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/76/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/76/output.json @@ -1,110 +1,32 @@ { "type": "File", - "start": 0, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, "program": { "type": "Program", - "start": 0, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExportNamedDeclaration", - "start": 0, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, "specifiers": [], "source": null, "declaration": { "type": "VariableDeclaration", - "start": 7, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":7,"end":27,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":27}}, "declarations": [ { "type": "VariableDeclarator", - "start": 13, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":13,"end":27,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":27}}, "id": { "type": "Identifier", - "start": 13, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 21 - }, - "identifierName": "document" - }, + "start":13,"end":21,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":21},"identifierName":"document"}, "name": "document" }, "init": { "type": "ObjectExpression", - "start": 24, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":24,"end":27,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":27}}, "properties": [] } } diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/77/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/77/output.json index 39d4d490b593..7618cbb48f03 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/77/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/77/output.json @@ -1,79 +1,23 @@ { "type": "File", - "start": 0, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, "program": { "type": "Program", - "start": 0, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExportNamedDeclaration", - "start": 0, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, "specifiers": [], "source": null, "declaration": { "type": "FunctionDeclaration", - "start": 7, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":7,"end":27,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":27}}, "id": { "type": "Identifier", - "start": 16, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 21 - }, - "identifierName": "parse" - }, + "start":16,"end":21,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":21},"identifierName":"parse"}, "name": "parse" }, "generator": false, @@ -81,18 +25,7 @@ "params": [], "body": { "type": "BlockStatement", - "start": 24, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":24,"end":27,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":27}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/78/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/78/output.json index 8af62b1cae62..3c3cbd026ac7 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/78/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/78/output.json @@ -1,96 +1,29 @@ { "type": "File", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, "program": { "type": "Program", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExportNamedDeclaration", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, "specifiers": [], "source": null, "declaration": { "type": "ClassDeclaration", - "start": 7, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":7,"end":21,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":21}}, "id": { "type": "Identifier", - "start": 13, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 18 - }, - "identifierName": "Class" - }, + "start":13,"end":18,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":18},"identifierName":"Class"}, "name": "Class" }, "superClass": null, "body": { "type": "ClassBody", - "start": 19, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":19,"end":21,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":21}}, "body": [] } } diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/79/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/79/output.json index cfbfd26932f8..2f511ea7f4e6 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/79/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/79/output.json @@ -1,62 +1,18 @@ { "type": "File", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "program": { "type": "Program", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExportDefaultDeclaration", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "declaration": { "type": "NumericLiteral", - "start": 15, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":15,"end":17,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":17}}, "extra": { "rawValue": 42, "raw": "42" diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/8/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/8/output.json index 28ed79418715..88aa9ec11b21 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/8/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/8/output.json @@ -1,62 +1,18 @@ { "type": "File", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, "program": { "type": "Program", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, "expression": { "type": "NumericLiteral", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, "extra": { "rawValue": 0, "raw": "0O0" diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/80/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/80/output.json index 52f9f4e1dcfe..1689c32a0d00 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/80/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/80/output.json @@ -1,80 +1,25 @@ { "type": "File", - "start": 0, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, "program": { "type": "Program", - "start": 0, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExportDefaultDeclaration", - "start": 0, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, "declaration": { "type": "FunctionDeclaration", - "start": 15, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":15,"end":29,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":29}}, "id": null, "generator": false, "async": false, "params": [], "body": { "type": "BlockStatement", - "start": 27, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":27,"end":29,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":29}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/81/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/81/output.json index a8d8b98ed57d..7afc284a4718 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/81/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/81/output.json @@ -1,77 +1,21 @@ { "type": "File", - "start": 0, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, "program": { "type": "Program", - "start": 0, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExportDefaultDeclaration", - "start": 0, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, "declaration": { "type": "FunctionDeclaration", - "start": 15, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":15,"end":30,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":30}}, "id": { "type": "Identifier", - "start": 24, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 25 - }, - "identifierName": "f" - }, + "start":24,"end":25,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":25},"identifierName":"f"}, "name": "f" }, "generator": false, @@ -79,18 +23,7 @@ "params": [], "body": { "type": "BlockStatement", - "start": 28, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":28,"end":30,"loc":{"start":{"line":1,"column":28},"end":{"line":1,"column":30}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/82/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/82/output.json index a6431fd6f6c4..502e479af681 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/82/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/82/output.json @@ -1,78 +1,23 @@ { "type": "File", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "program": { "type": "Program", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExportDefaultDeclaration", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "declaration": { "type": "ClassDeclaration", - "start": 15, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":15,"end":23,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":23}}, "id": null, "superClass": null, "body": { "type": "ClassBody", - "start": 21, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":21,"end":23,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":23}}, "body": [] } } diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/83/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/83/output.json index 55d9497f893c..67706de2fd52 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/83/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/83/output.json @@ -1,94 +1,27 @@ { "type": "File", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, "program": { "type": "Program", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExportDefaultDeclaration", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, "declaration": { "type": "ClassDeclaration", - "start": 15, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":15,"end":25,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":25}}, "id": { "type": "Identifier", - "start": 21, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 22 - }, - "identifierName": "A" - }, + "start":21,"end":22,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":22},"identifierName":"A"}, "name": "A" }, "superClass": null, "body": { "type": "ClassBody", - "start": 23, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":23,"end":25,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":25}}, "body": [] } } diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/85/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/85/output.json index 8f3f16accc2b..24822f85f3c9 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/85/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/85/output.json @@ -1,62 +1,18 @@ { "type": "File", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "program": { "type": "Program", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExportAllDeclaration", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "source": { "type": "StringLiteral", - "start": 14, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":14,"end":22,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":22}}, "extra": { "rawValue": "crypto", "raw": "\"crypto\"" diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/86/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/86/output.json index 7e4ade49890c..bbaa0eac1877 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/86/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/86/output.json @@ -1,95 +1,27 @@ { "type": "File", - "start": 0, - "end": 41, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 22 - } - }, + "start":0,"end":41,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":22}}, "program": { "type": "Program", - "start": 0, - "end": 41, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 22 - } - }, + "start":0,"end":41,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":22}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExportNamedDeclaration", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, "specifiers": [ { "type": "ExportSpecifier", - "start": 9, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":9,"end":16,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":16}}, "local": { "type": "Identifier", - "start": 9, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 16 - }, - "identifierName": "encrypt" - }, + "start":9,"end":16,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":16},"identifierName":"encrypt"}, "name": "encrypt" }, "exported": { "type": "Identifier", - "start": 9, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 16 - }, - "identifierName": "encrypt" - }, + "start":9,"end":16,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":16},"identifierName":"encrypt"}, "name": "encrypt" } } @@ -99,33 +31,10 @@ }, { "type": "FunctionDeclaration", - "start": 19, - "end": 41, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 22 - } - }, + "start":19,"end":41,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":22}}, "id": { "type": "Identifier", - "start": 28, - "end": 35, - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 16 - }, - "identifierName": "encrypt" - }, + "start":28,"end":35,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":16},"identifierName":"encrypt"}, "name": "encrypt" }, "generator": false, @@ -133,18 +42,7 @@ "params": [], "body": { "type": "BlockStatement", - "start": 39, - "end": 41, - "loc": { - "start": { - "line": 2, - "column": 20 - }, - "end": { - "line": 2, - "column": 22 - } - }, + "start":39,"end":41,"loc":{"start":{"line":2,"column":20},"end":{"line":2,"column":22}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/87/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/87/output.json index 28e7320743b9..34836ef130fd 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/87/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/87/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 66, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 27 - } - }, + "start":0,"end":66,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":27}}, "program": { "type": "Program", - "start": 0, - "end": 66, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 27 - } - }, + "start":0,"end":66,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":27}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "id": { "type": "Identifier", - "start": 9, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 16 - }, - "identifierName": "encrypt" - }, + "start":9,"end":16,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":16},"identifierName":"encrypt"}, "name": "encrypt" }, "generator": false, @@ -65,181 +20,55 @@ "params": [], "body": { "type": "BlockStatement", - "start": 20, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":20,"end":22,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":22}}, "body": [], "directives": [] } }, { "type": "ClassDeclaration", - "start": 23, - "end": 38, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 15 - } - }, + "start":23,"end":38,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":15}}, "id": { "type": "Identifier", - "start": 29, - "end": 36, - "loc": { - "start": { - "line": 2, - "column": 6 - }, - "end": { - "line": 2, - "column": 13 - }, - "identifierName": "decrypt" - }, + "start":29,"end":36,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":13},"identifierName":"decrypt"}, "name": "decrypt" }, "superClass": null, "body": { "type": "ClassBody", - "start": 36, - "end": 38, - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 15 - } - }, + "start":36,"end":38,"loc":{"start":{"line":2,"column":13},"end":{"line":2,"column":15}}, "body": [] } }, { "type": "ExportNamedDeclaration", - "start": 39, - "end": 66, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 27 - } - }, + "start":39,"end":66,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":27}}, "specifiers": [ { "type": "ExportSpecifier", - "start": 48, - "end": 55, - "loc": { - "start": { - "line": 3, - "column": 9 - }, - "end": { - "line": 3, - "column": 16 - } - }, + "start":48,"end":55,"loc":{"start":{"line":3,"column":9},"end":{"line":3,"column":16}}, "local": { "type": "Identifier", - "start": 48, - "end": 55, - "loc": { - "start": { - "line": 3, - "column": 9 - }, - "end": { - "line": 3, - "column": 16 - }, - "identifierName": "encrypt" - }, + "start":48,"end":55,"loc":{"start":{"line":3,"column":9},"end":{"line":3,"column":16},"identifierName":"encrypt"}, "name": "encrypt" }, "exported": { "type": "Identifier", - "start": 48, - "end": 55, - "loc": { - "start": { - "line": 3, - "column": 9 - }, - "end": { - "line": 3, - "column": 16 - }, - "identifierName": "encrypt" - }, + "start":48,"end":55,"loc":{"start":{"line":3,"column":9},"end":{"line":3,"column":16},"identifierName":"encrypt"}, "name": "encrypt" } }, { "type": "ExportSpecifier", - "start": 57, - "end": 64, - "loc": { - "start": { - "line": 3, - "column": 18 - }, - "end": { - "line": 3, - "column": 25 - } - }, + "start":57,"end":64,"loc":{"start":{"line":3,"column":18},"end":{"line":3,"column":25}}, "local": { "type": "Identifier", - "start": 57, - "end": 64, - "loc": { - "start": { - "line": 3, - "column": 18 - }, - "end": { - "line": 3, - "column": 25 - }, - "identifierName": "decrypt" - }, + "start":57,"end":64,"loc":{"start":{"line":3,"column":18},"end":{"line":3,"column":25},"identifierName":"decrypt"}, "name": "decrypt" }, "exported": { "type": "Identifier", - "start": 57, - "end": 64, - "loc": { - "start": { - "line": 3, - "column": 18 - }, - "end": { - "line": 3, - "column": 25 - }, - "identifierName": "decrypt" - }, + "start":57,"end":64,"loc":{"start":{"line":3,"column":18},"end":{"line":3,"column":25},"identifierName":"decrypt"}, "name": "decrypt" } } diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/88/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/88/output.json index 25b0fd97418a..bbc9bf9f48c8 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/88/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/88/output.json @@ -1,96 +1,29 @@ { "type": "File", - "start": 0, - "end": 53, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 29 - } - }, + "start":0,"end":53,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":29}}, "program": { "type": "Program", - "start": 0, - "end": 53, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 29 - } - }, + "start":0,"end":53,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":29}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ImportDeclaration", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "specifiers": [ { "type": "ImportDefaultSpecifier", - "start": 7, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":7,"end":14,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":14}}, "local": { "type": "Identifier", - "start": 7, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 14 - }, - "identifierName": "encrypt" - }, + "start":7,"end":14,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":14},"identifierName":"encrypt"}, "name": "encrypt" } } ], "source": { "type": "StringLiteral", - "start": 20, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":20,"end":22,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":22}}, "extra": { "rawValue": "", "raw": "\"\"" @@ -100,65 +33,19 @@ }, { "type": "ExportNamedDeclaration", - "start": 24, - "end": 53, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 29 - } - }, + "start":24,"end":53,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":29}}, "specifiers": [ { "type": "ExportSpecifier", - "start": 33, - "end": 51, - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 27 - } - }, + "start":33,"end":51,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":27}}, "local": { "type": "Identifier", - "start": 33, - "end": 40, - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 16 - }, - "identifierName": "encrypt" - }, + "start":33,"end":40,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":16},"identifierName":"encrypt"}, "name": "encrypt" }, "exported": { "type": "Identifier", - "start": 44, - "end": 51, - "loc": { - "start": { - "line": 2, - "column": 20 - }, - "end": { - "line": 2, - "column": 27 - }, - "identifierName": "default" - }, + "start":44,"end":51,"loc":{"start":{"line":2,"column":20},"end":{"line":2,"column":27},"identifierName":"default"}, "name": "default" } } diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/89/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/89/output.json index 6e52c6fd4d1f..0057ceda7c2f 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/89/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/89/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 73, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 34 - } - }, + "start":0,"end":73,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":34}}, "program": { "type": "Program", - "start": 0, - "end": 73, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 34 - } - }, + "start":0,"end":73,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":34}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, "id": { "type": "Identifier", - "start": 9, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 16 - }, - "identifierName": "encrypt" - }, + "start":9,"end":16,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":16},"identifierName":"encrypt"}, "name": "encrypt" }, "generator": false, @@ -65,181 +20,55 @@ "params": [], "body": { "type": "BlockStatement", - "start": 19, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":19,"end":21,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":21}}, "body": [], "directives": [] } }, { "type": "ClassDeclaration", - "start": 22, - "end": 38, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 16 - } - }, + "start":22,"end":38,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":16}}, "id": { "type": "Identifier", - "start": 28, - "end": 35, - "loc": { - "start": { - "line": 2, - "column": 6 - }, - "end": { - "line": 2, - "column": 13 - }, - "identifierName": "decrypt" - }, + "start":28,"end":35,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":13},"identifierName":"decrypt"}, "name": "decrypt" }, "superClass": null, "body": { "type": "ClassBody", - "start": 36, - "end": 38, - "loc": { - "start": { - "line": 2, - "column": 14 - }, - "end": { - "line": 2, - "column": 16 - } - }, + "start":36,"end":38,"loc":{"start":{"line":2,"column":14},"end":{"line":2,"column":16}}, "body": [] } }, { "type": "ExportNamedDeclaration", - "start": 39, - "end": 73, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 34 - } - }, + "start":39,"end":73,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":34}}, "specifiers": [ { "type": "ExportSpecifier", - "start": 48, - "end": 55, - "loc": { - "start": { - "line": 3, - "column": 9 - }, - "end": { - "line": 3, - "column": 16 - } - }, + "start":48,"end":55,"loc":{"start":{"line":3,"column":9},"end":{"line":3,"column":16}}, "local": { "type": "Identifier", - "start": 48, - "end": 55, - "loc": { - "start": { - "line": 3, - "column": 9 - }, - "end": { - "line": 3, - "column": 16 - }, - "identifierName": "encrypt" - }, + "start":48,"end":55,"loc":{"start":{"line":3,"column":9},"end":{"line":3,"column":16},"identifierName":"encrypt"}, "name": "encrypt" }, "exported": { "type": "Identifier", - "start": 48, - "end": 55, - "loc": { - "start": { - "line": 3, - "column": 9 - }, - "end": { - "line": 3, - "column": 16 - }, - "identifierName": "encrypt" - }, + "start":48,"end":55,"loc":{"start":{"line":3,"column":9},"end":{"line":3,"column":16},"identifierName":"encrypt"}, "name": "encrypt" } }, { "type": "ExportSpecifier", - "start": 57, - "end": 71, - "loc": { - "start": { - "line": 3, - "column": 18 - }, - "end": { - "line": 3, - "column": 32 - } - }, + "start":57,"end":71,"loc":{"start":{"line":3,"column":18},"end":{"line":3,"column":32}}, "local": { "type": "Identifier", - "start": 57, - "end": 64, - "loc": { - "start": { - "line": 3, - "column": 18 - }, - "end": { - "line": 3, - "column": 25 - }, - "identifierName": "decrypt" - }, + "start":57,"end":64,"loc":{"start":{"line":3,"column":18},"end":{"line":3,"column":25},"identifierName":"decrypt"}, "name": "decrypt" }, "exported": { "type": "Identifier", - "start": 68, - "end": 71, - "loc": { - "start": { - "line": 3, - "column": 29 - }, - "end": { - "line": 3, - "column": 32 - }, - "identifierName": "dec" - }, + "start":68,"end":71,"loc":{"start":{"line":3,"column":29},"end":{"line":3,"column":32},"identifierName":"dec"}, "name": "dec" } } diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/9/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/9/output.json index c8c90942d52b..055a0e3f115c 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/9/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/9/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 37 - } - }, + "start":0,"end":37,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":37}}, "program": { "type": "Program", - "start": 0, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 37 - } - }, + "start":0,"end":37,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":37}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 37 - } - }, + "start":0,"end":37,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":37}}, "id": { "type": "Identifier", - "start": 9, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 13 - }, - "identifierName": "test" - }, + "start":9,"end":13,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":13},"identifierName":"test"}, "name": "test" }, "generator": false, @@ -65,47 +20,14 @@ "params": [], "body": { "type": "BlockStatement", - "start": 16, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 37 - } - }, + "start":16,"end":37,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":37}}, "body": [ { "type": "ExpressionStatement", - "start": 31, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 31 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":31,"end":35,"loc":{"start":{"line":1,"column":31},"end":{"line":1,"column":35}}, "expression": { "type": "NumericLiteral", - "start": 31, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 31 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":31,"end":34,"loc":{"start":{"line":1,"column":31},"end":{"line":1,"column":34}}, "extra": { "rawValue": 0, "raw": "0O0" @@ -117,32 +39,10 @@ "directives": [ { "type": "Directive", - "start": 17, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":17,"end":30,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":30}}, "value": { "type": "DirectiveLiteral", - "start": 17, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":17,"end":29,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":29}}, "value": "use strict", "extra": { "raw": "'use strict'", diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/90/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/90/output.json index 2c1db06fce86..801c6010cd33 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/90/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/90/output.json @@ -1,120 +1,41 @@ { "type": "File", - "start": 0, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, "program": { "type": "Program", - "start": 0, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExportNamedDeclaration", - "start": 0, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } - }, - "declaration": null, + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, "specifiers": [ { "type": "ExportSpecifier", - "start": 9, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":9,"end":16,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":16}}, "local": { "type": "Identifier", - "start": 9, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 16 - }, - "identifierName": "default" - }, + "start":9,"end":16,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":16},"identifierName":"default"}, "name": "default" }, "exported": { "type": "Identifier", - "start": 9, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 16 - }, - "identifierName": "default" - }, + "start":9,"end":16,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":16},"identifierName":"default"}, "name": "default" } } ], "source": { "type": "StringLiteral", - "start": 24, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":24,"end":31,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":31}}, "extra": { "rawValue": "other", "raw": "\"other\"" }, "value": "other" - } + }, + "declaration": null } ], "directives": [] diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/91/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/91/output.json index 12c4be422437..7a55897d48e9 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/91/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/91/output.json @@ -1,63 +1,19 @@ { "type": "File", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "program": { "type": "Program", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ImportDeclaration", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "specifiers": [], "source": { "type": "StringLiteral", - "start": 7, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":7,"end":15,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":15}}, "extra": { "rawValue": "jquery", "raw": "\"jquery\"" diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/92/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/92/output.json index 30cae98f649b..3e36b1ca7765 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/92/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/92/output.json @@ -1,96 +1,29 @@ { "type": "File", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "program": { "type": "Program", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ImportDeclaration", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "specifiers": [ { "type": "ImportDefaultSpecifier", - "start": 7, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8}}, "local": { "type": "Identifier", - "start": 7, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - }, - "identifierName": "$" - }, + "start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8},"identifierName":"$"}, "name": "$" } } ], "source": { "type": "StringLiteral", - "start": 14, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":14,"end":22,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":22}}, "extra": { "rawValue": "jquery", "raw": "\"jquery\"" diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/93/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/93/output.json index 4591fadf23df..6f8d6a652542 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/93/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/93/output.json @@ -1,162 +1,48 @@ { "type": "File", - "start": 0, - "end": 41, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 41 - } - }, + "start":0,"end":41,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":41}}, "program": { "type": "Program", - "start": 0, - "end": 41, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 41 - } - }, + "start":0,"end":41,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":41}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ImportDeclaration", - "start": 0, - "end": 41, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 41 - } - }, + "start":0,"end":41,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":41}}, "specifiers": [ { "type": "ImportSpecifier", - "start": 9, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":9,"end":16,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":16}}, "imported": { "type": "Identifier", - "start": 9, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 16 - }, - "identifierName": "encrypt" - }, + "start":9,"end":16,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":16},"identifierName":"encrypt"}, "name": "encrypt" }, "local": { "type": "Identifier", - "start": 9, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 16 - }, - "identifierName": "encrypt" - }, + "start":9,"end":16,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":16},"identifierName":"encrypt"}, "name": "encrypt" } }, { "type": "ImportSpecifier", - "start": 18, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":18,"end":25,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":25}}, "imported": { "type": "Identifier", - "start": 18, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 25 - }, - "identifierName": "decrypt" - }, + "start":18,"end":25,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":25},"identifierName":"decrypt"}, "name": "decrypt" }, "local": { "type": "Identifier", - "start": 18, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 25 - }, - "identifierName": "decrypt" - }, + "start":18,"end":25,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":25},"identifierName":"decrypt"}, "name": "decrypt" } } ], "source": { "type": "StringLiteral", - "start": 33, - "end": 41, - "loc": { - "start": { - "line": 1, - "column": 33 - }, - "end": { - "line": 1, - "column": 41 - } - }, + "start":33,"end":41,"loc":{"start":{"line":1,"column":33},"end":{"line":1,"column":41}}, "extra": { "rawValue": "crypto", "raw": "\"crypto\"" diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/94/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/94/output.json index f2cd05d58507..e36df8cbfd12 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/94/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/94/output.json @@ -1,113 +1,34 @@ { "type": "File", - "start": 0, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 39 - } - }, + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":39}}, "program": { "type": "Program", - "start": 0, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 39 - } - }, + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":39}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ImportDeclaration", - "start": 0, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 39 - } - }, + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":39}}, "specifiers": [ { "type": "ImportSpecifier", - "start": 9, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":9,"end":23,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":23}}, "imported": { "type": "Identifier", - "start": 9, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 16 - }, - "identifierName": "encrypt" - }, + "start":9,"end":16,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":16},"identifierName":"encrypt"}, "name": "encrypt" }, "local": { "type": "Identifier", - "start": 20, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 23 - }, - "identifierName": "enc" - }, + "start":20,"end":23,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":23},"identifierName":"enc"}, "name": "enc" } } ], "source": { "type": "StringLiteral", - "start": 31, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 31 - }, - "end": { - "line": 1, - "column": 39 - } - }, + "start":31,"end":39,"loc":{"start":{"line":1,"column":31},"end":{"line":1,"column":39}}, "extra": { "rawValue": "crypto", "raw": "\"crypto\"" diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/95/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/95/output.json index 4d1f5f67a529..a391944e5ad3 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/95/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/95/output.json @@ -1,194 +1,57 @@ { "type": "File", - "start": 0, - "end": 56, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 56 - } - }, + "start":0,"end":56,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":56}}, "program": { "type": "Program", - "start": 0, - "end": 56, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 56 - } - }, + "start":0,"end":56,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":56}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ImportDeclaration", - "start": 0, - "end": 56, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 56 - } - }, + "start":0,"end":56,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":56}}, "specifiers": [ { "type": "ImportDefaultSpecifier", - "start": 7, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":7,"end":13,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":13}}, "local": { "type": "Identifier", - "start": 7, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 13 - }, - "identifierName": "crypto" - }, + "start":7,"end":13,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":13},"identifierName":"crypto"}, "name": "crypto" } }, { "type": "ImportSpecifier", - "start": 17, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":17,"end":24,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":24}}, "imported": { "type": "Identifier", - "start": 17, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 24 - }, - "identifierName": "decrypt" - }, + "start":17,"end":24,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":24},"identifierName":"decrypt"}, "name": "decrypt" }, "local": { "type": "Identifier", - "start": 17, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 24 - }, - "identifierName": "decrypt" - }, + "start":17,"end":24,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":24},"identifierName":"decrypt"}, "name": "decrypt" } }, { "type": "ImportSpecifier", - "start": 26, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 40 - } - }, + "start":26,"end":40,"loc":{"start":{"line":1,"column":26},"end":{"line":1,"column":40}}, "imported": { "type": "Identifier", - "start": 26, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 33 - }, - "identifierName": "encrypt" - }, + "start":26,"end":33,"loc":{"start":{"line":1,"column":26},"end":{"line":1,"column":33},"identifierName":"encrypt"}, "name": "encrypt" }, "local": { "type": "Identifier", - "start": 37, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 37 - }, - "end": { - "line": 1, - "column": 40 - }, - "identifierName": "enc" - }, + "start":37,"end":40,"loc":{"start":{"line":1,"column":37},"end":{"line":1,"column":40},"identifierName":"enc"}, "name": "enc" } } ], "source": { "type": "StringLiteral", - "start": 48, - "end": 56, - "loc": { - "start": { - "line": 1, - "column": 48 - }, - "end": { - "line": 1, - "column": 56 - } - }, + "start":48,"end":56,"loc":{"start":{"line":1,"column":48},"end":{"line":1,"column":56}}, "extra": { "rawValue": "crypto", "raw": "\"crypto\"" diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/97/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/97/output.json index d589597abfc8..0c902bf05c85 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/97/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/97/output.json @@ -1,113 +1,34 @@ { "type": "File", - "start": 0, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, "program": { "type": "Program", - "start": 0, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ImportDeclaration", - "start": 0, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, "specifiers": [ { "type": "ImportSpecifier", - "start": 9, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":9,"end":20,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":20}}, "imported": { "type": "Identifier", - "start": 9, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 13 - }, - "identifierName": "null" - }, + "start":9,"end":13,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":13},"identifierName":"null"}, "name": "null" }, "local": { "type": "Identifier", - "start": 17, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 20 - }, - "identifierName": "nil" - }, + "start":17,"end":20,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":20},"identifierName":"nil"}, "name": "nil" } } ], "source": { "type": "StringLiteral", - "start": 28, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":28,"end":33,"loc":{"start":{"line":1,"column":28},"end":{"line":1,"column":33}}, "extra": { "rawValue": "bar", "raw": "\"bar\"" diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/98/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/98/output.json index 6e021038f2b9..628f749c47c5 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/98/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/98/output.json @@ -1,96 +1,29 @@ { "type": "File", - "start": 0, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, "program": { "type": "Program", - "start": 0, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ImportDeclaration", - "start": 0, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, "specifiers": [ { "type": "ImportNamespaceSpecifier", - "start": 7, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":7,"end":18,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":18}}, "local": { "type": "Identifier", - "start": 12, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 18 - }, - "identifierName": "crypto" - }, + "start":12,"end":18,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":18},"identifierName":"crypto"}, "name": "crypto" } } ], "source": { "type": "StringLiteral", - "start": 24, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":24,"end":32,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":32}}, "extra": { "rawValue": "crypto", "raw": "\"crypto\"" diff --git a/packages/babel-parser/test/fixtures/es2015/yield/accessor-name-inst-computed-yield-expr/output.json b/packages/babel-parser/test/fixtures/es2015/yield/accessor-name-inst-computed-yield-expr/output.json index 1082894c21d5..f2e281db8d75 100644 --- a/packages/babel-parser/test/fixtures/es2015/yield/accessor-name-inst-computed-yield-expr/output.json +++ b/packages/babel-parser/test/fixtures/es2015/yield/accessor-name-inst-computed-yield-expr/output.json @@ -1,144 +1,42 @@ { "type": "File", - "start": 0, - "end": 155, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 9, - "column": 1 - } - }, + "start":0,"end":155,"loc":{"start":{"line":1,"column":0},"end":{"line":9,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 155, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 9, - "column": 1 - } - }, + "start":0,"end":155,"loc":{"start":{"line":1,"column":0},"end":{"line":9,"column":1}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":4,"end":12,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":12}}, "id": { "type": "Identifier", - "start": 4, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "yieldSet" - }, + "start":4,"end":12,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":12},"identifierName":"yieldSet"}, "name": "yieldSet" }, "init": null }, { "type": "VariableDeclarator", - "start": 14, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":14,"end":15,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":15}}, "id": { "type": "Identifier", - "start": 14, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - }, - "identifierName": "C" - }, + "start":14,"end":15,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":15},"identifierName":"C"}, "name": "C" }, "init": null }, { "type": "VariableDeclarator", - "start": 17, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":17,"end":21,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":21}}, "id": { "type": "Identifier", - "start": 17, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 21 - }, - "identifierName": "iter" - }, + "start":17,"end":21,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":21},"identifierName":"iter"}, "name": "iter" }, "init": null @@ -148,33 +46,10 @@ }, { "type": "FunctionDeclaration", - "start": 23, - "end": 155, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 9, - "column": 1 - } - }, + "start":23,"end":155,"loc":{"start":{"line":2,"column":0},"end":{"line":9,"column":1}}, "id": { "type": "Identifier", - "start": 33, - "end": 34, - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 11 - }, - "identifierName": "g" - }, + "start":33,"end":34,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":11},"identifierName":"g"}, "name": "g" }, "generator": true, @@ -182,95 +57,28 @@ "params": [], "body": { "type": "BlockStatement", - "start": 37, - "end": 155, - "loc": { - "start": { - "line": 2, - "column": 14 - }, - "end": { - "line": 9, - "column": 1 - } - }, + "start":37,"end":155,"loc":{"start":{"line":2,"column":14},"end":{"line":9,"column":1}}, "body": [ { "type": "ClassDeclaration", - "start": 41, - "end": 142, - "loc": { - "start": { - "line": 3, - "column": 2 - }, - "end": { - "line": 6, - "column": 3 - } - }, + "start":41,"end":142,"loc":{"start":{"line":3,"column":2},"end":{"line":6,"column":3}}, "id": { "type": "Identifier", - "start": 47, - "end": 49, - "loc": { - "start": { - "line": 3, - "column": 8 - }, - "end": { - "line": 3, - "column": 10 - }, - "identifierName": "C_" - }, + "start":47,"end":49,"loc":{"start":{"line":3,"column":8},"end":{"line":3,"column":10},"identifierName":"C_"}, "name": "C_" }, "superClass": null, "body": { "type": "ClassBody", - "start": 50, - "end": 142, - "loc": { - "start": { - "line": 3, - "column": 11 - }, - "end": { - "line": 6, - "column": 3 - } - }, + "start":50,"end":142,"loc":{"start":{"line":3,"column":11},"end":{"line":6,"column":3}}, "body": [ { "type": "ClassMethod", - "start": 56, - "end": 93, - "loc": { - "start": { - "line": 4, - "column": 4 - }, - "end": { - "line": 4, - "column": 41 - } - }, + "start":56,"end":93,"loc":{"start":{"line":4,"column":4},"end":{"line":4,"column":41}}, "static": false, "key": { "type": "YieldExpression", - "start": 61, - "end": 66, - "loc": { - "start": { - "line": 4, - "column": 9 - }, - "end": { - "line": 4, - "column": 14 - } - }, + "start":61,"end":66,"loc":{"start":{"line":4,"column":9},"end":{"line":4,"column":14}}, "delegate": false, "argument": null }, @@ -282,47 +90,14 @@ "params": [], "body": { "type": "BlockStatement", - "start": 70, - "end": 93, - "loc": { - "start": { - "line": 4, - "column": 18 - }, - "end": { - "line": 4, - "column": 41 - } - }, + "start":70,"end":93,"loc":{"start":{"line":4,"column":18},"end":{"line":4,"column":41}}, "body": [ { "type": "ReturnStatement", - "start": 72, - "end": 91, - "loc": { - "start": { - "line": 4, - "column": 20 - }, - "end": { - "line": 4, - "column": 39 - } - }, + "start":72,"end":91,"loc":{"start":{"line":4,"column":20},"end":{"line":4,"column":39}}, "argument": { "type": "StringLiteral", - "start": 79, - "end": 90, - "loc": { - "start": { - "line": 4, - "column": 27 - }, - "end": { - "line": 4, - "column": 38 - } - }, + "start":79,"end":90,"loc":{"start":{"line":4,"column":27},"end":{"line":4,"column":38}}, "extra": { "rawValue": "get yield", "raw": "'get yield'" @@ -336,33 +111,11 @@ }, { "type": "ClassMethod", - "start": 98, - "end": 138, - "loc": { - "start": { - "line": 5, - "column": 4 - }, - "end": { - "line": 5, - "column": 44 - } - }, + "start":98,"end":138,"loc":{"start":{"line":5,"column":4},"end":{"line":5,"column":44}}, "static": false, "key": { "type": "YieldExpression", - "start": 103, - "end": 108, - "loc": { - "start": { - "line": 5, - "column": 9 - }, - "end": { - "line": 5, - "column": 14 - } - }, + "start":103,"end":108,"loc":{"start":{"line":5,"column":9},"end":{"line":5,"column":14}}, "delegate": false, "argument": null }, @@ -374,98 +127,29 @@ "params": [ { "type": "Identifier", - "start": 110, - "end": 115, - "loc": { - "start": { - "line": 5, - "column": 16 - }, - "end": { - "line": 5, - "column": 21 - }, - "identifierName": "param" - }, + "start":110,"end":115,"loc":{"start":{"line":5,"column":16},"end":{"line":5,"column":21},"identifierName":"param"}, "name": "param" } ], "body": { "type": "BlockStatement", - "start": 117, - "end": 138, - "loc": { - "start": { - "line": 5, - "column": 23 - }, - "end": { - "line": 5, - "column": 44 - } - }, + "start":117,"end":138,"loc":{"start":{"line":5,"column":23},"end":{"line":5,"column":44}}, "body": [ { "type": "ExpressionStatement", - "start": 119, - "end": 136, - "loc": { - "start": { - "line": 5, - "column": 25 - }, - "end": { - "line": 5, - "column": 42 - } - }, + "start":119,"end":136,"loc":{"start":{"line":5,"column":25},"end":{"line":5,"column":42}}, "expression": { "type": "AssignmentExpression", - "start": 119, - "end": 135, - "loc": { - "start": { - "line": 5, - "column": 25 - }, - "end": { - "line": 5, - "column": 41 - } - }, + "start":119,"end":135,"loc":{"start":{"line":5,"column":25},"end":{"line":5,"column":41}}, "operator": "=", "left": { "type": "Identifier", - "start": 119, - "end": 127, - "loc": { - "start": { - "line": 5, - "column": 25 - }, - "end": { - "line": 5, - "column": 33 - }, - "identifierName": "yieldSet" - }, + "start":119,"end":127,"loc":{"start":{"line":5,"column":25},"end":{"line":5,"column":33},"identifierName":"yieldSet"}, "name": "yieldSet" }, "right": { "type": "Identifier", - "start": 130, - "end": 135, - "loc": { - "start": { - "line": 5, - "column": 36 - }, - "end": { - "line": 5, - "column": 41 - }, - "identifierName": "param" - }, + "start":130,"end":135,"loc":{"start":{"line":5,"column":36},"end":{"line":5,"column":41},"identifierName":"param"}, "name": "param" } } @@ -479,65 +163,19 @@ }, { "type": "ExpressionStatement", - "start": 146, - "end": 153, - "loc": { - "start": { - "line": 8, - "column": 2 - }, - "end": { - "line": 8, - "column": 9 - } - }, + "start":146,"end":153,"loc":{"start":{"line":8,"column":2},"end":{"line":8,"column":9}}, "expression": { "type": "AssignmentExpression", - "start": 146, - "end": 152, - "loc": { - "start": { - "line": 8, - "column": 2 - }, - "end": { - "line": 8, - "column": 8 - } - }, + "start":146,"end":152,"loc":{"start":{"line":8,"column":2},"end":{"line":8,"column":8}}, "operator": "=", "left": { "type": "Identifier", - "start": 146, - "end": 147, - "loc": { - "start": { - "line": 8, - "column": 2 - }, - "end": { - "line": 8, - "column": 3 - }, - "identifierName": "C" - }, + "start":146,"end":147,"loc":{"start":{"line":8,"column":2},"end":{"line":8,"column":3},"identifierName":"C"}, "name": "C" }, "right": { "type": "Identifier", - "start": 150, - "end": 152, - "loc": { - "start": { - "line": 8, - "column": 6 - }, - "end": { - "line": 8, - "column": 8 - }, - "identifierName": "C_" - }, + "start":150,"end":152,"loc":{"start":{"line":8,"column":6},"end":{"line":8,"column":8},"identifierName":"C_"}, "name": "C_" } } diff --git a/packages/babel-parser/test/fixtures/es2015/yield/asi/output.json b/packages/babel-parser/test/fixtures/es2015/yield/asi/output.json index ca699a63639c..3f78b0f9d2cc 100644 --- a/packages/babel-parser/test/fixtures/es2015/yield/asi/output.json +++ b/packages/babel-parser/test/fixtures/es2015/yield/asi/output.json @@ -1,142 +1,42 @@ { "type": "File", - "start": 0, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 4 - } - }, + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":4}}, "program": { "type": "Program", - "start": 0, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 4 - } - }, + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":4}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 4 - } - }, + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":4}}, "expression": { "type": "FunctionExpression", - "start": 1, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 2, - "column": 3 - } - }, + "start":1,"end":25,"loc":{"start":{"line":1,"column":1},"end":{"line":2,"column":3}}, "id": null, "generator": true, "async": false, "params": [], "body": { "type": "BlockStatement", - "start": 14, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 2, - "column": 3 - } - }, + "start":14,"end":25,"loc":{"start":{"line":1,"column":14},"end":{"line":2,"column":3}}, "body": [ { "type": "ExpressionStatement", - "start": 16, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":16,"end":21,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":21}}, "expression": { "type": "YieldExpression", - "start": 16, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":16,"end":21,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":21}}, "delegate": false, "argument": null } }, { "type": "ExpressionStatement", - "start": 22, - "end": 23, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 1 - } - }, + "start":22,"end":23,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":1}}, "expression": { "type": "Identifier", - "start": 22, - "end": 23, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 1 - }, - "identifierName": "v" - }, + "start":22,"end":23,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":1},"identifierName":"v"}, "name": "v" } } diff --git a/packages/babel-parser/test/fixtures/es2015/yield/asi2/output.json b/packages/babel-parser/test/fixtures/es2015/yield/asi2/output.json index 2d86b5998e19..de3e5e33b03a 100644 --- a/packages/babel-parser/test/fixtures/es2015/yield/asi2/output.json +++ b/packages/babel-parser/test/fixtures/es2015/yield/asi2/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "id": { "type": "Identifier", - "start": 10, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "f" - }, + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11},"identifierName":"f"}, "name": "f" }, "generator": true, @@ -65,96 +20,30 @@ "params": [], "body": { "type": "BlockStatement", - "start": 14, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":14,"end":30,"loc":{"start":{"line":1,"column":14},"end":{"line":3,"column":1}}, "body": [ { "type": "ExpressionStatement", - "start": 16, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":16,"end":21,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":21}}, "expression": { "type": "YieldExpression", - "start": 16, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":16,"end":21,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":21}}, "delegate": false, "argument": null } }, { "type": "BlockStatement", - "start": 22, - "end": 24, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 2 - } - }, + "start":22,"end":24,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":2}}, "body": [], "directives": [] }, { "type": "ExpressionStatement", - "start": 24, - "end": 28, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 6 - } - }, + "start":24,"end":28,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":6}}, "expression": { "type": "RegExpLiteral", - "start": 24, - "end": 28, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 6 - } - }, + "start":24,"end":28,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":6}}, "extra": { "raw": "/1/g" }, diff --git a/packages/babel-parser/test/fixtures/es2015/yield/basic-with-argument/output.json b/packages/babel-parser/test/fixtures/es2015/yield/basic-with-argument/output.json index 2a22f3aa8fd8..00ab717c3abf 100644 --- a/packages/babel-parser/test/fixtures/es2015/yield/basic-with-argument/output.json +++ b/packages/babel-parser/test/fixtures/es2015/yield/basic-with-argument/output.json @@ -1,125 +1,36 @@ { "type": "File", - "start": 0, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, "program": { "type": "Program", - "start": 0, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, "expression": { "type": "FunctionExpression", - "start": 1, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":1,"end":25,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":25}}, "id": null, "generator": true, "async": false, "params": [], "body": { "type": "BlockStatement", - "start": 14, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":14,"end":25,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":25}}, "body": [ { "type": "ExpressionStatement", - "start": 16, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":16,"end":23,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":23}}, "expression": { "type": "YieldExpression", - "start": 16, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":16,"end":23,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":23}}, "delegate": false, "argument": { "type": "Identifier", - "start": 22, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 23 - }, - "identifierName": "v" - }, + "start":22,"end":23,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":23},"identifierName":"v"}, "name": "v" } } diff --git a/packages/babel-parser/test/fixtures/es2015/yield/basic-without-argument/output.json b/packages/babel-parser/test/fixtures/es2015/yield/basic-without-argument/output.json index 20b6ee4b6a37..585d9f7a1a51 100644 --- a/packages/babel-parser/test/fixtures/es2015/yield/basic-without-argument/output.json +++ b/packages/babel-parser/test/fixtures/es2015/yield/basic-without-argument/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 39 - } - }, + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":39}}, "program": { "type": "Program", - "start": 0, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 39 - } - }, + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":39}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 39 - } - }, + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":39}}, "id": { "type": "Identifier", - "start": 10, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 13 - }, - "identifierName": "foo" - }, + "start":10,"end":13,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":13},"identifierName":"foo"}, "name": "foo" }, "generator": true, @@ -65,93 +20,25 @@ "params": [], "body": { "type": "BlockStatement", - "start": 16, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 39 - } - }, + "start":16,"end":39,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":39}}, "body": [ { "type": "ExpressionStatement", - "start": 18, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 37 - } - }, + "start":18,"end":37,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":37}}, "expression": { "type": "CallExpression", - "start": 18, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":18,"end":36,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":36}}, "callee": { "type": "MemberExpression", - "start": 18, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":18,"end":29,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":29}}, "object": { "type": "Identifier", - "start": 18, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 25 - }, - "identifierName": "console" - }, + "start":18,"end":25,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":25},"identifierName":"console"}, "name": "console" }, "property": { "type": "Identifier", - "start": 26, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 29 - }, - "identifierName": "log" - }, + "start":26,"end":29,"loc":{"start":{"line":1,"column":26},"end":{"line":1,"column":29},"identifierName":"log"}, "name": "log" }, "computed": false @@ -159,18 +46,7 @@ "arguments": [ { "type": "YieldExpression", - "start": 30, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":30,"end":35,"loc":{"start":{"line":1,"column":30},"end":{"line":1,"column":35}}, "delegate": false, "argument": null } diff --git a/packages/babel-parser/test/fixtures/es2015/yield/function-name-class-wrapped/output.json b/packages/babel-parser/test/fixtures/es2015/yield/function-name-class-wrapped/output.json index c646340e65e3..fc0de38bd916 100644 --- a/packages/babel-parser/test/fixtures/es2015/yield/function-name-class-wrapped/output.json +++ b/packages/babel-parser/test/fixtures/es2015/yield/function-name-class-wrapped/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 46, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":46,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 46, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":46,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 46, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":46,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "id": { "type": "Identifier", - "start": 10, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 14 - }, - "identifierName": "wrap" - }, + "start":10,"end":14,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":14},"identifierName":"wrap"}, "name": "wrap" }, "generator": true, @@ -65,97 +20,29 @@ "params": [], "body": { "type": "BlockStatement", - "start": 17, - "end": 46, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":17,"end":46,"loc":{"start":{"line":1,"column":17},"end":{"line":3,"column":1}}, "body": [ { "type": "ClassDeclaration", - "start": 23, - "end": 44, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 25 - } - }, + "start":23,"end":44,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":25}}, "id": { "type": "Identifier", - "start": 29, - "end": 30, - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 11 - }, - "identifierName": "A" - }, + "start":29,"end":30,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":11},"identifierName":"A"}, "name": "A" }, "superClass": null, "body": { "type": "ClassBody", - "start": 31, - "end": 44, - "loc": { - "start": { - "line": 2, - "column": 12 - }, - "end": { - "line": 2, - "column": 25 - } - }, + "start":31,"end":44,"loc":{"start":{"line":2,"column":12},"end":{"line":2,"column":25}}, "body": [ { "type": "ClassMethod", - "start": 32, - "end": 43, - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 24 - } - }, + "start":32,"end":43,"loc":{"start":{"line":2,"column":13},"end":{"line":2,"column":24}}, "static": false, "kind": "method", "key": { "type": "Identifier", - "start": 33, - "end": 38, - "loc": { - "start": { - "line": 2, - "column": 14 - }, - "end": { - "line": 2, - "column": 19 - }, - "identifierName": "yield" - }, + "start":33,"end":38,"loc":{"start":{"line":2,"column":14},"end":{"line":2,"column":19},"identifierName":"yield"}, "name": "yield" }, "computed": false, @@ -165,18 +52,7 @@ "params": [], "body": { "type": "BlockStatement", - "start": 41, - "end": 43, - "loc": { - "start": { - "line": 2, - "column": 22 - }, - "end": { - "line": 2, - "column": 24 - } - }, + "start":41,"end":43,"loc":{"start":{"line":2,"column":22},"end":{"line":2,"column":24}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/es2015/yield/function-name-function-declaration-inside-generator/options.json b/packages/babel-parser/test/fixtures/es2015/yield/function-name-function-declaration-inside-generator/options.json deleted file mode 100644 index 37d7f62549c6..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/yield/function-name-function-declaration-inside-generator/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Can not use 'yield' as identifier inside a generator (2:11)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/yield/function-name-function-declaration-inside-generator/output.json b/packages/babel-parser/test/fixtures/es2015/yield/function-name-function-declaration-inside-generator/output.json new file mode 100644 index 000000000000..ced2dbfb6771 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/yield/function-name-function-declaration-inside-generator/output.json @@ -0,0 +1,53 @@ +{ + "type": "File", + "start":0,"end":40,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "errors": [ + "SyntaxError: Can not use 'yield' as identifier inside a generator (2:11)" + ], + "program": { + "type": "Program", + "start":0,"end":40,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":40,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "id": { + "type": "Identifier", + "start":10,"end":12,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":12},"identifierName":"fn"}, + "name": "fn" + }, + "generator": true, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":15,"end":40,"loc":{"start":{"line":1,"column":15},"end":{"line":3,"column":1}}, + "body": [ + { + "type": "FunctionDeclaration", + "start":19,"end":38,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":21}}, + "id": { + "type": "Identifier", + "start":28,"end":33,"loc":{"start":{"line":2,"column":11},"end":{"line":2,"column":16},"identifierName":"yield"}, + "name": "yield" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":36,"end":38,"loc":{"start":{"line":2,"column":19},"end":{"line":2,"column":21}}, + "body": [], + "directives": [] + } + } + ], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/yield/function-name-function-declaration/output.json b/packages/babel-parser/test/fixtures/es2015/yield/function-name-function-declaration/output.json index de221659f026..f339b4a15f10 100644 --- a/packages/babel-parser/test/fixtures/es2015/yield/function-name-function-declaration/output.json +++ b/packages/babel-parser/test/fixtures/es2015/yield/function-name-function-declaration/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, "program": { "type": "Program", - "start": 0, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, "id": { "type": "Identifier", - "start": 9, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 14 - }, - "identifierName": "yield" - }, + "start":9,"end":14,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":14},"identifierName":"yield"}, "name": "yield" }, "generator": false, @@ -65,18 +20,7 @@ "params": [], "body": { "type": "BlockStatement", - "start": 17, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":17,"end":19,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":19}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/es2015/yield/function-name-function-expression-inside-generator/output.json b/packages/babel-parser/test/fixtures/es2015/yield/function-name-function-expression-inside-generator/output.json index 0b39f18573dc..76ba81501be7 100644 --- a/packages/babel-parser/test/fixtures/es2015/yield/function-name-function-expression-inside-generator/output.json +++ b/packages/babel-parser/test/fixtures/es2015/yield/function-name-function-expression-inside-generator/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 43, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":43,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 43, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":43,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 43, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":43,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "id": { "type": "Identifier", - "start": 10, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "fn" - }, + "start":10,"end":12,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":12},"identifierName":"fn"}, "name": "fn" }, "generator": true, @@ -65,62 +20,17 @@ "params": [], "body": { "type": "BlockStatement", - "start": 15, - "end": 43, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":15,"end":43,"loc":{"start":{"line":1,"column":15},"end":{"line":3,"column":1}}, "body": [ { "type": "ExpressionStatement", - "start": 19, - "end": 41, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 24 - } - }, + "start":19,"end":41,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":24}}, "expression": { "type": "FunctionExpression", - "start": 20, - "end": 39, - "loc": { - "start": { - "line": 2, - "column": 3 - }, - "end": { - "line": 2, - "column": 22 - } - }, + "start":20,"end":39,"loc":{"start":{"line":2,"column":3},"end":{"line":2,"column":22}}, "id": { "type": "Identifier", - "start": 29, - "end": 34, - "loc": { - "start": { - "line": 2, - "column": 12 - }, - "end": { - "line": 2, - "column": 17 - }, - "identifierName": "yield" - }, + "start":29,"end":34,"loc":{"start":{"line":2,"column":12},"end":{"line":2,"column":17},"identifierName":"yield"}, "name": "yield" }, "generator": false, @@ -128,18 +38,7 @@ "params": [], "body": { "type": "BlockStatement", - "start": 37, - "end": 39, - "loc": { - "start": { - "line": 2, - "column": 20 - }, - "end": { - "line": 2, - "column": 22 - } - }, + "start":37,"end":39,"loc":{"start":{"line":2,"column":20},"end":{"line":2,"column":22}}, "body": [], "directives": [] }, diff --git a/packages/babel-parser/test/fixtures/es2015/yield/function-name-function-expression/output.json b/packages/babel-parser/test/fixtures/es2015/yield/function-name-function-expression/output.json index bffc0911fd54..23b3d59c7d01 100644 --- a/packages/babel-parser/test/fixtures/es2015/yield/function-name-function-expression/output.json +++ b/packages/babel-parser/test/fixtures/es2015/yield/function-name-function-expression/output.json @@ -1,93 +1,26 @@ { "type": "File", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, "program": { "type": "Program", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, "expression": { "type": "UnaryExpression", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, "operator": "+", "prefix": true, "argument": { "type": "FunctionExpression", - "start": 1, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":1,"end":20,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":20}}, "id": { "type": "Identifier", - "start": 10, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 15 - }, - "identifierName": "yield" - }, + "start":10,"end":15,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":15},"identifierName":"yield"}, "name": "yield" }, "generator": false, @@ -95,18 +28,7 @@ "params": [], "body": { "type": "BlockStatement", - "start": 18, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":18,"end":20,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":20}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/es2015/yield/function-name-function-method/output.json b/packages/babel-parser/test/fixtures/es2015/yield/function-name-function-method/output.json index e30fc7f279d1..e6390c43b05e 100644 --- a/packages/babel-parser/test/fixtures/es2015/yield/function-name-function-method/output.json +++ b/packages/babel-parser/test/fixtures/es2015/yield/function-name-function-method/output.json @@ -1,111 +1,32 @@ { "type": "File", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "id": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "A" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, "name": "A" }, "superClass": null, "body": { "type": "ClassBody", - "start": 8, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":8,"end":24,"loc":{"start":{"line":1,"column":8},"end":{"line":3,"column":1}}, "body": [ { "type": "ClassMethod", - "start": 12, - "end": 22, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 12 - } - }, + "start":12,"end":22,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":12}}, "static": false, "key": { "type": "Identifier", - "start": 12, - "end": 17, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 7 - }, - "identifierName": "yield" - }, + "start":12,"end":17,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":7},"identifierName":"yield"}, "name": "yield" }, "computed": false, @@ -116,18 +37,7 @@ "params": [], "body": { "type": "BlockStatement", - "start": 20, - "end": 22, - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 12 - } - }, + "start":20,"end":22,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":12}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/es2015/yield/function-name-generator-declaration/output.json b/packages/babel-parser/test/fixtures/es2015/yield/function-name-generator-declaration/output.json index 8bbaf7205594..de589f46ac33 100644 --- a/packages/babel-parser/test/fixtures/es2015/yield/function-name-generator-declaration/output.json +++ b/packages/babel-parser/test/fixtures/es2015/yield/function-name-generator-declaration/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, "program": { "type": "Program", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, "id": { "type": "Identifier", - "start": 10, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 15 - }, - "identifierName": "yield" - }, + "start":10,"end":15,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":15},"identifierName":"yield"}, "name": "yield" }, "generator": true, @@ -65,18 +20,7 @@ "params": [], "body": { "type": "BlockStatement", - "start": 18, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":18,"end":20,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":20}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/es2015/yield/function-name-generator-expression/options.json b/packages/babel-parser/test/fixtures/es2015/yield/function-name-generator-expression/options.json deleted file mode 100644 index 72f8d0e0e4c3..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/yield/function-name-generator-expression/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Can not use 'yield' as identifier inside a generator (1:11)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/yield/function-name-generator-expression/output.json b/packages/babel-parser/test/fixtures/es2015/yield/function-name-generator-expression/output.json new file mode 100644 index 000000000000..0026ac0e9383 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/yield/function-name-generator-expression/output.json @@ -0,0 +1,44 @@ +{ + "type": "File", + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, + "errors": [ + "SyntaxError: Can not use 'yield' as identifier inside a generator (1:11)" + ], + "program": { + "type": "Program", + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, + "expression": { + "type": "UnaryExpression", + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, + "operator": "+", + "prefix": true, + "argument": { + "type": "FunctionExpression", + "start":1,"end":21,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":21}}, + "id": { + "type": "Identifier", + "start":11,"end":16,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":16},"identifierName":"yield"}, + "name": "yield" + }, + "generator": true, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":19,"end":21,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":21}}, + "body": [], + "directives": [] + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/yield/function-name-generator-method/output.json b/packages/babel-parser/test/fixtures/es2015/yield/function-name-generator-method/output.json index fa4df3c82ae5..b5a527721e66 100644 --- a/packages/babel-parser/test/fixtures/es2015/yield/function-name-generator-method/output.json +++ b/packages/babel-parser/test/fixtures/es2015/yield/function-name-generator-method/output.json @@ -1,112 +1,33 @@ { "type": "File", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "id": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "A" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, "name": "A" }, "superClass": null, "body": { "type": "ClassBody", - "start": 8, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":8,"end":25,"loc":{"start":{"line":1,"column":8},"end":{"line":3,"column":1}}, "body": [ { "type": "ClassMethod", - "start": 12, - "end": 23, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 13 - } - }, + "start":12,"end":23,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":13}}, "static": false, "kind": "method", "key": { "type": "Identifier", - "start": 13, - "end": 18, - "loc": { - "start": { - "line": 2, - "column": 3 - }, - "end": { - "line": 2, - "column": 8 - }, - "identifierName": "yield" - }, + "start":13,"end":18,"loc":{"start":{"line":2,"column":3},"end":{"line":2,"column":8},"identifierName":"yield"}, "name": "yield" }, "computed": false, @@ -116,18 +37,7 @@ "params": [], "body": { "type": "BlockStatement", - "start": 21, - "end": 23, - "loc": { - "start": { - "line": 2, - "column": 11 - }, - "end": { - "line": 2, - "column": 13 - } - }, + "start":21,"end":23,"loc":{"start":{"line":2,"column":11},"end":{"line":2,"column":13}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/es2015/yield/function-name-generator-wrapped/output.json b/packages/babel-parser/test/fixtures/es2015/yield/function-name-generator-wrapped/output.json index 6856b64eb17a..27e8f94561be 100644 --- a/packages/babel-parser/test/fixtures/es2015/yield/function-name-generator-wrapped/output.json +++ b/packages/babel-parser/test/fixtures/es2015/yield/function-name-generator-wrapped/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":40,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":40,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":40,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "id": { "type": "Identifier", - "start": 10, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 14 - }, - "identifierName": "wrap" - }, + "start":10,"end":14,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":14},"identifierName":"wrap"}, "name": "wrap" }, "generator": true, @@ -65,78 +20,22 @@ "params": [], "body": { "type": "BlockStatement", - "start": 17, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":17,"end":40,"loc":{"start":{"line":1,"column":17},"end":{"line":3,"column":1}}, "body": [ { "type": "ExpressionStatement", - "start": 23, - "end": 38, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 19 - } - }, + "start":23,"end":38,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":19}}, "expression": { "type": "ObjectExpression", - "start": 24, - "end": 37, - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 18 - } - }, + "start":24,"end":37,"loc":{"start":{"line":2,"column":5},"end":{"line":2,"column":18}}, "properties": [ { "type": "ObjectMethod", - "start": 25, - "end": 36, - "loc": { - "start": { - "line": 2, - "column": 6 - }, - "end": { - "line": 2, - "column": 17 - } - }, + "start":25,"end":36,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":17}}, "method": true, "key": { "type": "Identifier", - "start": 26, - "end": 31, - "loc": { - "start": { - "line": 2, - "column": 7 - }, - "end": { - "line": 2, - "column": 12 - }, - "identifierName": "yield" - }, + "start":26,"end":31,"loc":{"start":{"line":2,"column":7},"end":{"line":2,"column":12},"identifierName":"yield"}, "name": "yield" }, "computed": false, @@ -147,18 +46,7 @@ "params": [], "body": { "type": "BlockStatement", - "start": 34, - "end": 36, - "loc": { - "start": { - "line": 2, - "column": 15 - }, - "end": { - "line": 2, - "column": 17 - } - }, + "start":34,"end":36,"loc":{"start":{"line":2,"column":15},"end":{"line":2,"column":17}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/es2015/yield/function-name-inside-function/output.json b/packages/babel-parser/test/fixtures/es2015/yield/function-name-inside-function/output.json index b70dd7de3919..096d8e327261 100644 --- a/packages/babel-parser/test/fixtures/es2015/yield/function-name-inside-function/output.json +++ b/packages/babel-parser/test/fixtures/es2015/yield/function-name-inside-function/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "id": { "type": "Identifier", - "start": 9, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "fn" - }, + "start":9,"end":11,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":11},"identifierName":"fn"}, "name": "fn" }, "generator": false, @@ -65,48 +20,14 @@ "params": [], "body": { "type": "BlockStatement", - "start": 14, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":14,"end":39,"loc":{"start":{"line":1,"column":14},"end":{"line":3,"column":1}}, "body": [ { "type": "FunctionDeclaration", - "start": 18, - "end": 37, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 21 - } - }, + "start":18,"end":37,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":21}}, "id": { "type": "Identifier", - "start": 27, - "end": 32, - "loc": { - "start": { - "line": 2, - "column": 11 - }, - "end": { - "line": 2, - "column": 16 - }, - "identifierName": "yield" - }, + "start":27,"end":32,"loc":{"start":{"line":2,"column":11},"end":{"line":2,"column":16},"identifierName":"yield"}, "name": "yield" }, "generator": false, @@ -114,18 +35,7 @@ "params": [], "body": { "type": "BlockStatement", - "start": 35, - "end": 37, - "loc": { - "start": { - "line": 2, - "column": 19 - }, - "end": { - "line": 2, - "column": 21 - } - }, + "start":35,"end":37,"loc":{"start":{"line":2,"column":19},"end":{"line":2,"column":21}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/es2015/yield/function-name-strict-body/options.json b/packages/babel-parser/test/fixtures/es2015/yield/function-name-strict-body/options.json deleted file mode 100644 index 091e7958db52..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/yield/function-name-strict-body/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'yield' in strict mode (1:9)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/yield/function-name-strict-body/output.json b/packages/babel-parser/test/fixtures/es2015/yield/function-name-strict-body/output.json new file mode 100644 index 000000000000..8b8e3b1ff8ae --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/yield/function-name-strict-body/output.json @@ -0,0 +1,48 @@ +{ + "type": "File", + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, + "errors": [ + "SyntaxError: Binding 'yield' in strict mode (1:9)" + ], + "program": { + "type": "Program", + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, + "id": { + "type": "Identifier", + "start":9,"end":14,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":14},"identifierName":"yield"}, + "name": "yield" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":17,"end":34,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":34}}, + "body": [], + "directives": [ + { + "type": "Directive", + "start":19,"end":32,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":32}}, + "value": { + "type": "DirectiveLiteral", + "start":19,"end":31,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":31}}, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/yield/function-name-strict/options.json b/packages/babel-parser/test/fixtures/es2015/yield/function-name-strict/options.json deleted file mode 100644 index 320734ea2ef7..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/yield/function-name-strict/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected reserved word 'yield' (2:9)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/yield/function-name-strict/output.json b/packages/babel-parser/test/fixtures/es2015/yield/function-name-strict/output.json new file mode 100644 index 000000000000..bd1a0267017c --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/yield/function-name-strict/output.json @@ -0,0 +1,48 @@ +{ + "type": "File", + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":19}}, + "errors": [ + "SyntaxError: Unexpected reserved word 'yield' (2:9)" + ], + "program": { + "type": "Program", + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":19}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":14,"end":33,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":19}}, + "id": { + "type": "Identifier", + "start":23,"end":28,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":14},"identifierName":"yield"}, + "name": "yield" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":31,"end":33,"loc":{"start":{"line":2,"column":17},"end":{"line":2,"column":19}}, + "body": [], + "directives": [] + } + } + ], + "directives": [ + { + "type": "Directive", + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "value": { + "type": "DirectiveLiteral", + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/yield/in-class-heritage/options.json b/packages/babel-parser/test/fixtures/es2015/yield/in-class-heritage/options.json index e817f30acb5c..7fc68d96502e 100644 --- a/packages/babel-parser/test/fixtures/es2015/yield/in-class-heritage/options.json +++ b/packages/babel-parser/test/fixtures/es2015/yield/in-class-heritage/options.json @@ -1,3 +1,3 @@ { - "throws": "Unexpected reserved word 'yield' (1:16)" + "throws": "Unexpected token, expected \"{\" (1:22)" } diff --git a/packages/babel-parser/test/fixtures/es2015/yield/in-iterator-stmt/options.json b/packages/babel-parser/test/fixtures/es2015/yield/in-iterator-stmt/options.json index ad46a65e5082..0ab4d8e9bc1c 100644 --- a/packages/babel-parser/test/fixtures/es2015/yield/in-iterator-stmt/options.json +++ b/packages/babel-parser/test/fixtures/es2015/yield/in-iterator-stmt/options.json @@ -1,3 +1,3 @@ { - "throws": "Invalid left-hand side in for-in statement (2:7)" + "throws": "Unexpected token, expected \")\" (2:21)" } diff --git a/packages/babel-parser/test/fixtures/es2015/yield/input-not-followed-by-regex/output.json b/packages/babel-parser/test/fixtures/es2015/yield/input-not-followed-by-regex/output.json index 7b6b61f8c0b8..3aed36c563e3 100644 --- a/packages/babel-parser/test/fixtures/es2015/yield/input-not-followed-by-regex/output.json +++ b/packages/babel-parser/test/fixtures/es2015/yield/input-not-followed-by-regex/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, "program": { "type": "Program", - "start": 0, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, "id": { "type": "Identifier", - "start": 10, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "f2" - }, + "start":10,"end":12,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":12},"identifierName":"f2"}, "name": "f2" }, "generator": true, @@ -65,97 +20,30 @@ "params": [], "body": { "type": "BlockStatement", - "start": 15, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":15,"end":34,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":34}}, "body": [ { "type": "ExpressionStatement", - "start": 17, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":17,"end":32,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":32}}, "expression": { "type": "ArrowFunctionExpression", - "start": 17, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":17,"end":32,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":32}}, "id": null, "generator": false, "async": false, "params": [], "body": { "type": "BinaryExpression", - "start": 23, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":23,"end":32,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":32}}, "left": { "type": "Identifier", - "start": 23, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 28 - }, - "identifierName": "yield" - }, + "start":23,"end":28,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":28},"identifierName":"yield"}, "name": "yield" }, "operator": "/", "right": { "type": "NumericLiteral", - "start": 31, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 31 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":31,"end":32,"loc":{"start":{"line":1,"column":31},"end":{"line":1,"column":32}}, "extra": { "rawValue": 1, "raw": "1" diff --git a/packages/babel-parser/test/fixtures/es2015/yield/inside-arrow-inside-generator/output.json b/packages/babel-parser/test/fixtures/es2015/yield/inside-arrow-inside-generator/output.json index 389fa52e3a16..10e73e0e5628 100644 --- a/packages/babel-parser/test/fixtures/es2015/yield/inside-arrow-inside-generator/output.json +++ b/packages/babel-parser/test/fixtures/es2015/yield/inside-arrow-inside-generator/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 52, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":0,"end":52,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 52, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":0,"end":52,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 52, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":0,"end":52,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, "id": { "type": "Identifier", - "start": 10, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "fn" - }, + "start":10,"end":12,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":12},"identifierName":"fn"}, "name": "fn" }, "generator": true, @@ -65,146 +20,45 @@ "params": [], "body": { "type": "BlockStatement", - "start": 15, - "end": 52, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":15,"end":52,"loc":{"start":{"line":1,"column":15},"end":{"line":4,"column":1}}, "body": [ { "type": "ExpressionStatement", - "start": 19, - "end": 31, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 14 - } - }, + "start":19,"end":31,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":14}}, "expression": { "type": "ArrowFunctionExpression", - "start": 19, - "end": 30, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 13 - } - }, + "start":19,"end":30,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":13}}, "id": null, "generator": false, "async": false, "params": [], "body": { "type": "Identifier", - "start": 25, - "end": 30, - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 13 - }, - "identifierName": "yield" - }, + "start":25,"end":30,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":13},"identifierName":"yield"}, "name": "yield" } } }, { "type": "ExpressionStatement", - "start": 34, - "end": 50, - "loc": { - "start": { - "line": 3, - "column": 2 - }, - "end": { - "line": 3, - "column": 18 - } - }, + "start":34,"end":50,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":18}}, "expression": { "type": "ArrowFunctionExpression", - "start": 34, - "end": 49, - "loc": { - "start": { - "line": 3, - "column": 2 - }, - "end": { - "line": 3, - "column": 17 - } - }, + "start":34,"end":49,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":17}}, "id": null, "generator": false, "async": false, "params": [], "body": { "type": "BlockStatement", - "start": 40, - "end": 49, - "loc": { - "start": { - "line": 3, - "column": 8 - }, - "end": { - "line": 3, - "column": 17 - } - }, + "start":40,"end":49,"loc":{"start":{"line":3,"column":8},"end":{"line":3,"column":17}}, "body": [ { "type": "ExpressionStatement", - "start": 42, - "end": 47, - "loc": { - "start": { - "line": 3, - "column": 10 - }, - "end": { - "line": 3, - "column": 15 - } - }, + "start":42,"end":47,"loc":{"start":{"line":3,"column":10},"end":{"line":3,"column":15}}, "expression": { "type": "Identifier", - "start": 42, - "end": 47, - "loc": { - "start": { - "line": 3, - "column": 10 - }, - "end": { - "line": 3, - "column": 15 - }, - "identifierName": "yield" - }, + "start":42,"end":47,"loc":{"start":{"line":3,"column":10},"end":{"line":3,"column":15},"identifierName":"yield"}, "name": "yield" } } diff --git a/packages/babel-parser/test/fixtures/es2015/yield/parameter-default-inside-arrow-inside-arrow-inside-generator/output.json b/packages/babel-parser/test/fixtures/es2015/yield/parameter-default-inside-arrow-inside-arrow-inside-generator/output.json index ff8ef778733e..3ae9600e1700 100644 --- a/packages/babel-parser/test/fixtures/es2015/yield/parameter-default-inside-arrow-inside-arrow-inside-generator/output.json +++ b/packages/babel-parser/test/fixtures/es2015/yield/parameter-default-inside-arrow-inside-arrow-inside-generator/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 45, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":45,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 45, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":45,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 45, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":45,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "id": { "type": "Identifier", - "start": 10, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "fn" - }, + "start":10,"end":12,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":12},"identifierName":"fn"}, "name": "fn" }, "generator": true, @@ -65,133 +20,43 @@ "params": [], "body": { "type": "BlockStatement", - "start": 15, - "end": 45, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":15,"end":45,"loc":{"start":{"line":1,"column":15},"end":{"line":3,"column":1}}, "body": [ { "type": "ExpressionStatement", - "start": 19, - "end": 43, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 26 - } - }, + "start":19,"end":43,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":26}}, "expression": { "type": "ArrowFunctionExpression", - "start": 19, - "end": 42, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 25 - } - }, + "start":19,"end":42,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":25}}, "id": null, "generator": false, "async": false, "params": [], "body": { "type": "ArrowFunctionExpression", - "start": 25, - "end": 42, - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 25 - } - }, + "start":25,"end":42,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":25}}, "id": null, "generator": false, "async": false, "params": [ { "type": "AssignmentPattern", - "start": 26, - "end": 35, - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 18 - } - }, + "start":26,"end":35,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":18}}, "left": { "type": "Identifier", - "start": 26, - "end": 27, - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 10 - }, - "identifierName": "x" - }, + "start":26,"end":27,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":10},"identifierName":"x"}, "name": "x" }, "right": { "type": "Identifier", - "start": 30, - "end": 35, - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 18 - }, - "identifierName": "yield" - }, + "start":30,"end":35,"loc":{"start":{"line":2,"column":13},"end":{"line":2,"column":18},"identifierName":"yield"}, "name": "yield" } } ], "body": { "type": "BlockStatement", - "start": 40, - "end": 42, - "loc": { - "start": { - "line": 2, - "column": 23 - }, - "end": { - "line": 2, - "column": 25 - } - }, + "start":40,"end":42,"loc":{"start":{"line":2,"column":23},"end":{"line":2,"column":25}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/es2015/yield/parameter-default-inside-arrow-inside-generator-1/options.json b/packages/babel-parser/test/fixtures/es2015/yield/parameter-default-inside-arrow-inside-generator-1/options.json deleted file mode 100644 index 75b3f62fdacb..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/yield/parameter-default-inside-arrow-inside-generator-1/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Yield cannot be used as name inside a generator function (2:7)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/yield/parameter-default-inside-arrow-inside-generator-1/output.json b/packages/babel-parser/test/fixtures/es2015/yield/parameter-default-inside-arrow-inside-generator-1/output.json new file mode 100644 index 000000000000..7fb0d2ac2cda --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/yield/parameter-default-inside-arrow-inside-generator-1/output.json @@ -0,0 +1,69 @@ +{ + "type": "File", + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "errors": [ + "SyntaxError: Yield cannot be used as name inside a generator function (2:7)" + ], + "program": { + "type": "Program", + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "id": { + "type": "Identifier", + "start":10,"end":12,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":12},"identifierName":"fn"}, + "name": "fn" + }, + "generator": true, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":15,"end":39,"loc":{"start":{"line":1,"column":15},"end":{"line":3,"column":1}}, + "body": [ + { + "type": "ExpressionStatement", + "start":19,"end":37,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":20}}, + "expression": { + "type": "ArrowFunctionExpression", + "start":19,"end":36,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":19}}, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "AssignmentPattern", + "start":20,"end":29,"loc":{"start":{"line":2,"column":3},"end":{"line":2,"column":12}}, + "left": { + "type": "Identifier", + "start":20,"end":21,"loc":{"start":{"line":2,"column":3},"end":{"line":2,"column":4},"identifierName":"x"}, + "name": "x" + }, + "right": { + "type": "YieldExpression", + "start":24,"end":29,"loc":{"start":{"line":2,"column":7},"end":{"line":2,"column":12}}, + "delegate": false, + "argument": null + } + } + ], + "body": { + "type": "BlockStatement", + "start":34,"end":36,"loc":{"start":{"line":2,"column":17},"end":{"line":2,"column":19}}, + "body": [], + "directives": [] + } + } + } + ], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/yield/parameter-default-inside-arrow-inside-generator-2/options.json b/packages/babel-parser/test/fixtures/es2015/yield/parameter-default-inside-arrow-inside-generator-2/options.json deleted file mode 100644 index 9d35f54190c8..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/yield/parameter-default-inside-arrow-inside-generator-2/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Yield cannot be used as name inside a generator function (2:15)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/yield/parameter-default-inside-arrow-inside-generator-2/output.json b/packages/babel-parser/test/fixtures/es2015/yield/parameter-default-inside-arrow-inside-generator-2/output.json new file mode 100644 index 000000000000..f526c3252076 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/yield/parameter-default-inside-arrow-inside-generator-2/output.json @@ -0,0 +1,118 @@ +{ + "type": "File", + "start":0,"end":53,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "errors": [ + "SyntaxError: Yield cannot be used as name inside a generator function (2:15)" + ], + "program": { + "type": "Program", + "start":0,"end":53,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":53,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "id": { + "type": "Identifier", + "start":10,"end":12,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":12},"identifierName":"fn"}, + "name": "fn" + }, + "generator": true, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":15,"end":53,"loc":{"start":{"line":1,"column":15},"end":{"line":3,"column":1}}, + "body": [ + { + "type": "ExpressionStatement", + "start":19,"end":51,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":34}}, + "expression": { + "type": "ArrowFunctionExpression", + "start":19,"end":50,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":33}}, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "AssignmentPattern", + "start":20,"end":43,"loc":{"start":{"line":2,"column":3},"end":{"line":2,"column":26}}, + "left": { + "type": "Identifier", + "start":20,"end":21,"loc":{"start":{"line":2,"column":3},"end":{"line":2,"column":4},"identifierName":"x"}, + "name": "x" + }, + "right": { + "type": "BinaryExpression", + "start":24,"end":43,"loc":{"start":{"line":2,"column":7},"end":{"line":2,"column":26}}, + "left": { + "type": "NumericLiteral", + "start":24,"end":25,"loc":{"start":{"line":2,"column":7},"end":{"line":2,"column":8}}, + "extra": { + "rawValue": 3, + "raw": "3" + }, + "value": 3 + }, + "operator": "+", + "right": { + "type": "BinaryExpression", + "start":28,"end":43,"loc":{"start":{"line":2,"column":11},"end":{"line":2,"column":26}}, + "left": { + "type": "CallExpression", + "start":28,"end":38,"loc":{"start":{"line":2,"column":11},"end":{"line":2,"column":21}}, + "callee": { + "type": "MemberExpression", + "start":28,"end":31,"loc":{"start":{"line":2,"column":11},"end":{"line":2,"column":14}}, + "object": { + "type": "Identifier", + "start":28,"end":29,"loc":{"start":{"line":2,"column":11},"end":{"line":2,"column":12},"identifierName":"a"}, + "name": "a" + }, + "property": { + "type": "Identifier", + "start":30,"end":31,"loc":{"start":{"line":2,"column":13},"end":{"line":2,"column":14},"identifierName":"b"}, + "name": "b" + }, + "computed": false + }, + "arguments": [ + { + "type": "YieldExpression", + "start":32,"end":37,"loc":{"start":{"line":2,"column":15},"end":{"line":2,"column":20}}, + "delegate": false, + "argument": null + } + ] + }, + "operator": "**", + "right": { + "type": "NumericLiteral", + "start":42,"end":43,"loc":{"start":{"line":2,"column":25},"end":{"line":2,"column":26}}, + "extra": { + "rawValue": 2, + "raw": "2" + }, + "value": 2 + } + } + } + } + ], + "body": { + "type": "BlockStatement", + "start":48,"end":50,"loc":{"start":{"line":2,"column":31},"end":{"line":2,"column":33}}, + "body": [], + "directives": [] + } + } + } + ], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/yield/parameter-default-inside-arrow-inside-generator-3/options.json b/packages/babel-parser/test/fixtures/es2015/yield/parameter-default-inside-arrow-inside-generator-3/options.json deleted file mode 100644 index 75b3f62fdacb..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/yield/parameter-default-inside-arrow-inside-generator-3/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Yield cannot be used as name inside a generator function (2:7)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/yield/parameter-default-inside-arrow-inside-generator-3/output.json b/packages/babel-parser/test/fixtures/es2015/yield/parameter-default-inside-arrow-inside-generator-3/output.json new file mode 100644 index 000000000000..f6e29bf0fdb1 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/yield/parameter-default-inside-arrow-inside-generator-3/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start":0,"end":42,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "errors": [ + "SyntaxError: Yield cannot be used as name inside a generator function (2:7)" + ], + "program": { + "type": "Program", + "start":0,"end":42,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":42,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "id": { + "type": "Identifier", + "start":10,"end":12,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":12},"identifierName":"fn"}, + "name": "fn" + }, + "generator": true, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":15,"end":42,"loc":{"start":{"line":1,"column":15},"end":{"line":3,"column":1}}, + "body": [ + { + "type": "ExpressionStatement", + "start":19,"end":40,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":23}}, + "expression": { + "type": "ArrowFunctionExpression", + "start":19,"end":39,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":22}}, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "AssignmentPattern", + "start":20,"end":32,"loc":{"start":{"line":2,"column":3},"end":{"line":2,"column":15}}, + "left": { + "type": "Identifier", + "start":20,"end":21,"loc":{"start":{"line":2,"column":3},"end":{"line":2,"column":4},"identifierName":"x"}, + "name": "x" + }, + "right": { + "type": "YieldExpression", + "start":24,"end":32,"loc":{"start":{"line":2,"column":7},"end":{"line":2,"column":15}}, + "delegate": false, + "argument": { + "type": "Identifier", + "start":30,"end":32,"loc":{"start":{"line":2,"column":13},"end":{"line":2,"column":15},"identifierName":"fn"}, + "name": "fn" + } + } + } + ], + "body": { + "type": "BlockStatement", + "start":37,"end":39,"loc":{"start":{"line":2,"column":20},"end":{"line":2,"column":22}}, + "body": [], + "directives": [] + } + } + } + ], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/yield/parameter-default-inside-arrow-inside-generator-4/options.json b/packages/babel-parser/test/fixtures/es2015/yield/parameter-default-inside-arrow-inside-generator-4/options.json deleted file mode 100644 index b3ac060855bb..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/yield/parameter-default-inside-arrow-inside-generator-4/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Yield cannot be used as name inside a generator function (2:17)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/yield/parameter-default-inside-arrow-inside-generator-4/output.json b/packages/babel-parser/test/fixtures/es2015/yield/parameter-default-inside-arrow-inside-generator-4/output.json new file mode 100644 index 000000000000..427ec4363f69 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/yield/parameter-default-inside-arrow-inside-generator-4/output.json @@ -0,0 +1,92 @@ +{ + "type": "File", + "start":0,"end":49,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "errors": [ + "SyntaxError: Yield cannot be used as name inside a generator function (2:17)" + ], + "program": { + "type": "Program", + "start":0,"end":49,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":49,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "id": { + "type": "Identifier", + "start":10,"end":12,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":12},"identifierName":"fn"}, + "name": "fn" + }, + "generator": true, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":15,"end":49,"loc":{"start":{"line":1,"column":15},"end":{"line":3,"column":1}}, + "body": [ + { + "type": "ExpressionStatement", + "start":19,"end":47,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":30}}, + "expression": { + "type": "ArrowFunctionExpression", + "start":19,"end":46,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":29}}, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start":20,"end":21,"loc":{"start":{"line":2,"column":3},"end":{"line":2,"column":4},"identifierName":"a"}, + "name": "a" + }, + { + "type": "AssignmentPattern", + "start":23,"end":28,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":11}}, + "left": { + "type": "Identifier", + "start":23,"end":24,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":7},"identifierName":"b"}, + "name": "b" + }, + "right": { + "type": "NumericLiteral", + "start":27,"end":28,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":11}}, + "extra": { + "rawValue": 3, + "raw": "3" + }, + "value": 3 + } + }, + { + "type": "AssignmentPattern", + "start":30,"end":39,"loc":{"start":{"line":2,"column":13},"end":{"line":2,"column":22}}, + "left": { + "type": "Identifier", + "start":30,"end":31,"loc":{"start":{"line":2,"column":13},"end":{"line":2,"column":14},"identifierName":"x"}, + "name": "x" + }, + "right": { + "type": "YieldExpression", + "start":34,"end":39,"loc":{"start":{"line":2,"column":17},"end":{"line":2,"column":22}}, + "delegate": false, + "argument": null + } + } + ], + "body": { + "type": "BlockStatement", + "start":44,"end":46,"loc":{"start":{"line":2,"column":27},"end":{"line":2,"column":29}}, + "body": [], + "directives": [] + } + } + } + ], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/yield/parameter-default-inside-arrow-inside-generator-5/options.json b/packages/babel-parser/test/fixtures/es2015/yield/parameter-default-inside-arrow-inside-generator-5/options.json deleted file mode 100644 index 379c08c57e90..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/yield/parameter-default-inside-arrow-inside-generator-5/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Yield cannot be used as name inside a generator function (2:8)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/yield/parameter-default-inside-arrow-inside-generator-5/output.json b/packages/babel-parser/test/fixtures/es2015/yield/parameter-default-inside-arrow-inside-generator-5/output.json new file mode 100644 index 000000000000..4f2ee50da949 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/yield/parameter-default-inside-arrow-inside-generator-5/output.json @@ -0,0 +1,85 @@ +{ + "type": "File", + "start":0,"end":47,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "errors": [ + "SyntaxError: Yield cannot be used as name inside a generator function (2:8)", + "SyntaxError: Binding invalid left-hand side in function parameter list (2:8)" + ], + "program": { + "type": "Program", + "start":0,"end":47,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":47,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "id": { + "type": "Identifier", + "start":10,"end":12,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":12},"identifierName":"fn"}, + "name": "fn" + }, + "generator": true, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":15,"end":47,"loc":{"start":{"line":1,"column":15},"end":{"line":3,"column":1}}, + "body": [ + { + "type": "ExpressionStatement", + "start":19,"end":45,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":28}}, + "expression": { + "type": "ArrowFunctionExpression", + "start":19,"end":44,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":27}}, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "AssignmentPattern", + "start":20,"end":37,"loc":{"start":{"line":2,"column":3},"end":{"line":2,"column":20}}, + "left": { + "type": "Identifier", + "start":20,"end":21,"loc":{"start":{"line":2,"column":3},"end":{"line":2,"column":4},"identifierName":"x"}, + "name": "x" + }, + "right": { + "type": "ArrowFunctionExpression", + "start":24,"end":37,"loc":{"start":{"line":2,"column":7},"end":{"line":2,"column":20}}, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "YieldExpression", + "start":25,"end":30,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":13}}, + "delegate": false, + "argument": null + } + ], + "body": { + "type": "BlockStatement", + "start":35,"end":37,"loc":{"start":{"line":2,"column":18},"end":{"line":2,"column":20}}, + "body": [], + "directives": [] + } + } + } + ], + "body": { + "type": "BlockStatement", + "start":42,"end":44,"loc":{"start":{"line":2,"column":25},"end":{"line":2,"column":27}}, + "body": [], + "directives": [] + } + } + } + ], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/yield/parameter-default-inside-arrow-inside-generator-6/options.json b/packages/babel-parser/test/fixtures/es2015/yield/parameter-default-inside-arrow-inside-generator-6/options.json deleted file mode 100644 index 379c08c57e90..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/yield/parameter-default-inside-arrow-inside-generator-6/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Yield cannot be used as name inside a generator function (2:8)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/yield/parameter-default-inside-arrow-inside-generator-6/output.json b/packages/babel-parser/test/fixtures/es2015/yield/parameter-default-inside-arrow-inside-generator-6/output.json new file mode 100644 index 000000000000..b78292c7993d --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/yield/parameter-default-inside-arrow-inside-generator-6/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start":0,"end":41,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "errors": [ + "SyntaxError: Yield cannot be used as name inside a generator function (2:8)" + ], + "program": { + "type": "Program", + "start":0,"end":41,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":41,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "id": { + "type": "Identifier", + "start":10,"end":12,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":12},"identifierName":"fn"}, + "name": "fn" + }, + "generator": true, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":15,"end":41,"loc":{"start":{"line":1,"column":15},"end":{"line":3,"column":1}}, + "body": [ + { + "type": "ExpressionStatement", + "start":19,"end":39,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":22}}, + "expression": { + "type": "ArrowFunctionExpression", + "start":19,"end":38,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":21}}, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "AssignmentPattern", + "start":20,"end":31,"loc":{"start":{"line":2,"column":3},"end":{"line":2,"column":14}}, + "left": { + "type": "Identifier", + "start":20,"end":21,"loc":{"start":{"line":2,"column":3},"end":{"line":2,"column":4},"identifierName":"x"}, + "name": "x" + }, + "right": { + "type": "YieldExpression", + "start":25,"end":30,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":13}}, + "delegate": false, + "argument": null, + "extra": { + "parenthesized": true, + "parenStart": 24 + } + } + } + ], + "body": { + "type": "BlockStatement", + "start":36,"end":38,"loc":{"start":{"line":2,"column":19},"end":{"line":2,"column":21}}, + "body": [], + "directives": [] + } + } + } + ], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/yield/parameter-default-inside-arrow/output.json b/packages/babel-parser/test/fixtures/es2015/yield/parameter-default-inside-arrow/output.json index 69a580ede4f0..6b7cee11c5de 100644 --- a/packages/babel-parser/test/fixtures/es2015/yield/parameter-default-inside-arrow/output.json +++ b/packages/babel-parser/test/fixtures/es2015/yield/parameter-default-inside-arrow/output.json @@ -1,130 +1,40 @@ { "type": "File", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "program": { "type": "Program", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "expression": { "type": "ArrowFunctionExpression", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "id": null, "generator": false, "async": false, "params": [ { "type": "AssignmentPattern", - "start": 1, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":1,"end":10,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":10}}, "left": { "type": "Identifier", - "start": 1, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - }, - "identifierName": "x" - }, + "start":1,"end":2,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":2},"identifierName":"x"}, "name": "x" }, "right": { "type": "Identifier", - "start": 5, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 10 - }, - "identifierName": "yield" - }, + "start":5,"end":10,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":10},"identifierName":"yield"}, "name": "yield" } } ], "body": { "type": "BlockStatement", - "start": 15, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":15,"end":17,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":17}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/es2015/yield/parameter-default-inside-function-inside-generator/output.json b/packages/babel-parser/test/fixtures/es2015/yield/parameter-default-inside-function-inside-generator/output.json index 9e2b85b224d1..85fdc2e087da 100644 --- a/packages/babel-parser/test/fixtures/es2015/yield/parameter-default-inside-function-inside-generator/output.json +++ b/packages/babel-parser/test/fixtures/es2015/yield/parameter-default-inside-function-inside-generator/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 47, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":47,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 47, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":47,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 47, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":47,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "id": { "type": "Identifier", - "start": 10, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "fn" - }, + "start":10,"end":12,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":12},"identifierName":"fn"}, "name": "fn" }, "generator": true, @@ -65,48 +20,14 @@ "params": [], "body": { "type": "BlockStatement", - "start": 15, - "end": 47, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":15,"end":47,"loc":{"start":{"line":1,"column":15},"end":{"line":3,"column":1}}, "body": [ { "type": "FunctionDeclaration", - "start": 19, - "end": 45, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 28 - } - }, + "start":19,"end":45,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":28}}, "id": { "type": "Identifier", - "start": 28, - "end": 31, - "loc": { - "start": { - "line": 2, - "column": 11 - }, - "end": { - "line": 2, - "column": 14 - }, - "identifierName": "fn2" - }, + "start":28,"end":31,"loc":{"start":{"line":2,"column":11},"end":{"line":2,"column":14},"identifierName":"fn2"}, "name": "fn2" }, "generator": false, @@ -114,68 +35,22 @@ "params": [ { "type": "AssignmentPattern", - "start": 32, - "end": 41, - "loc": { - "start": { - "line": 2, - "column": 15 - }, - "end": { - "line": 2, - "column": 24 - } - }, + "start":32,"end":41,"loc":{"start":{"line":2,"column":15},"end":{"line":2,"column":24}}, "left": { "type": "Identifier", - "start": 32, - "end": 33, - "loc": { - "start": { - "line": 2, - "column": 15 - }, - "end": { - "line": 2, - "column": 16 - }, - "identifierName": "x" - }, + "start":32,"end":33,"loc":{"start":{"line":2,"column":15},"end":{"line":2,"column":16},"identifierName":"x"}, "name": "x" }, "right": { "type": "Identifier", - "start": 36, - "end": 41, - "loc": { - "start": { - "line": 2, - "column": 19 - }, - "end": { - "line": 2, - "column": 24 - }, - "identifierName": "yield" - }, + "start":36,"end":41,"loc":{"start":{"line":2,"column":19},"end":{"line":2,"column":24},"identifierName":"yield"}, "name": "yield" } } ], "body": { "type": "BlockStatement", - "start": 43, - "end": 45, - "loc": { - "start": { - "line": 2, - "column": 26 - }, - "end": { - "line": 2, - "column": 28 - } - }, + "start":43,"end":45,"loc":{"start":{"line":2,"column":26},"end":{"line":2,"column":28}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/es2015/yield/parameter-default-inside-function/output.json b/packages/babel-parser/test/fixtures/es2015/yield/parameter-default-inside-function/output.json index 7db0a927b58a..e4dbca6d9975 100644 --- a/packages/babel-parser/test/fixtures/es2015/yield/parameter-default-inside-function/output.json +++ b/packages/babel-parser/test/fixtures/es2015/yield/parameter-default-inside-function/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, "program": { "type": "Program", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, "id": { "type": "Identifier", - "start": 9, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "fn" - }, + "start":9,"end":11,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":11},"identifierName":"fn"}, "name": "fn" }, "generator": false, @@ -65,68 +20,22 @@ "params": [ { "type": "AssignmentPattern", - "start": 12, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":12,"end":21,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":21}}, "left": { "type": "Identifier", - "start": 12, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - }, - "identifierName": "x" - }, + "start":12,"end":13,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":13},"identifierName":"x"}, "name": "x" }, "right": { "type": "Identifier", - "start": 16, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 21 - }, - "identifierName": "yield" - }, + "start":16,"end":21,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":21},"identifierName":"yield"}, "name": "yield" } } ], "body": { "type": "BlockStatement", - "start": 23, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":23,"end":25,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":25}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/es2015/yield/parameter-default-inside-generator-method/options.json b/packages/babel-parser/test/fixtures/es2015/yield/parameter-default-inside-generator-method/options.json deleted file mode 100644 index 6f5bd40fe357..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/yield/parameter-default-inside-generator-method/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "yield is not allowed in generator parameters (1:15)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/yield/parameter-default-inside-generator-method/output.json b/packages/babel-parser/test/fixtures/es2015/yield/parameter-default-inside-generator-method/output.json new file mode 100644 index 000000000000..b26aaee3a5a3 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/yield/parameter-default-inside-generator-method/output.json @@ -0,0 +1,68 @@ +{ + "type": "File", + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, + "errors": [ + "SyntaxError: yield is not allowed in generator parameters (1:15)" + ], + "program": { + "type": "Program", + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, + "expression": { + "type": "ObjectExpression", + "start":1,"end":26,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":26}}, + "properties": [ + { + "type": "ObjectMethod", + "start":3,"end":24,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":24}}, + "method": true, + "key": { + "type": "Identifier", + "start":4,"end":10,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":10},"identifierName":"method"}, + "name": "method" + }, + "computed": false, + "kind": "method", + "id": null, + "generator": true, + "async": false, + "params": [ + { + "type": "AssignmentPattern", + "start":11,"end":20,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":20}}, + "left": { + "type": "Identifier", + "start":11,"end":12,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":12},"identifierName":"x"}, + "name": "x" + }, + "right": { + "type": "YieldExpression", + "start":15,"end":20,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":20}}, + "delegate": false, + "argument": null + } + } + ], + "body": { + "type": "BlockStatement", + "start":22,"end":24,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":24}}, + "body": [], + "directives": [] + } + } + ], + "extra": { + "parenthesized": true, + "parenStart": 0 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/yield/parameter-default-inside-generator/options.json b/packages/babel-parser/test/fixtures/es2015/yield/parameter-default-inside-generator/options.json deleted file mode 100644 index dd9a684ef928..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/yield/parameter-default-inside-generator/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "yield is not allowed in generator parameters (1:17)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/yield/parameter-default-inside-generator/output.json b/packages/babel-parser/test/fixtures/es2015/yield/parameter-default-inside-generator/output.json new file mode 100644 index 000000000000..4d69a77ac29d --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/yield/parameter-default-inside-generator/output.json @@ -0,0 +1,50 @@ +{ + "type": "File", + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, + "errors": [ + "SyntaxError: yield is not allowed in generator parameters (1:17)" + ], + "program": { + "type": "Program", + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, + "id": { + "type": "Identifier", + "start":10,"end":12,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":12},"identifierName":"fn"}, + "name": "fn" + }, + "generator": true, + "async": false, + "params": [ + { + "type": "AssignmentPattern", + "start":13,"end":22,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":22}}, + "left": { + "type": "Identifier", + "start":13,"end":14,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":14},"identifierName":"x"}, + "name": "x" + }, + "right": { + "type": "YieldExpression", + "start":17,"end":22,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":22}}, + "delegate": false, + "argument": null + } + } + ], + "body": { + "type": "BlockStatement", + "start":24,"end":26,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":26}}, + "body": [], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/yield/parameter-default-strict/options.json b/packages/babel-parser/test/fixtures/es2015/yield/parameter-default-strict/options.json deleted file mode 100644 index ecc179f974cb..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/yield/parameter-default-strict/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected reserved word 'yield' (2:16)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/yield/parameter-default-strict/output.json b/packages/babel-parser/test/fixtures/es2015/yield/parameter-default-strict/output.json new file mode 100644 index 000000000000..edd07f81cc72 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/yield/parameter-default-strict/output.json @@ -0,0 +1,63 @@ +{ + "type": "File", + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":25}}, + "errors": [ + "SyntaxError: Unexpected reserved word 'yield' (2:16)" + ], + "program": { + "type": "Program", + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":25}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":14,"end":39,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":25}}, + "id": { + "type": "Identifier", + "start":23,"end":25,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":11},"identifierName":"fn"}, + "name": "fn" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "AssignmentPattern", + "start":26,"end":35,"loc":{"start":{"line":2,"column":12},"end":{"line":2,"column":21}}, + "left": { + "type": "Identifier", + "start":26,"end":27,"loc":{"start":{"line":2,"column":12},"end":{"line":2,"column":13},"identifierName":"x"}, + "name": "x" + }, + "right": { + "type": "Identifier", + "start":30,"end":35,"loc":{"start":{"line":2,"column":16},"end":{"line":2,"column":21},"identifierName":"yield"}, + "name": "yield" + } + } + ], + "body": { + "type": "BlockStatement", + "start":37,"end":39,"loc":{"start":{"line":2,"column":23},"end":{"line":2,"column":25}}, + "body": [], + "directives": [] + } + } + ], + "directives": [ + { + "type": "Directive", + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "value": { + "type": "DirectiveLiteral", + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/yield/parameter-name-arrow-inside-arrow-inside-generator/output.json b/packages/babel-parser/test/fixtures/es2015/yield/parameter-name-arrow-inside-arrow-inside-generator/output.json index e8b351c39398..8c9639d859e4 100644 --- a/packages/babel-parser/test/fixtures/es2015/yield/parameter-name-arrow-inside-arrow-inside-generator/output.json +++ b/packages/babel-parser/test/fixtures/es2015/yield/parameter-name-arrow-inside-arrow-inside-generator/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 41, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":41,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 41, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":41,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 41, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":41,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "id": { "type": "Identifier", - "start": 10, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "fn" - }, + "start":10,"end":12,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":12},"identifierName":"fn"}, "name": "fn" }, "generator": true, @@ -65,101 +20,34 @@ "params": [], "body": { "type": "BlockStatement", - "start": 15, - "end": 41, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":15,"end":41,"loc":{"start":{"line":1,"column":15},"end":{"line":3,"column":1}}, "body": [ { "type": "ExpressionStatement", - "start": 19, - "end": 39, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 22 - } - }, + "start":19,"end":39,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":22}}, "expression": { "type": "ArrowFunctionExpression", - "start": 19, - "end": 38, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 21 - } - }, + "start":19,"end":38,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":21}}, "id": null, "generator": false, "async": false, "params": [], "body": { "type": "ArrowFunctionExpression", - "start": 25, - "end": 38, - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 21 - } - }, + "start":25,"end":38,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":21}}, "id": null, "generator": false, "async": false, "params": [ { "type": "Identifier", - "start": 26, - "end": 31, - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 14 - }, - "identifierName": "yield" - }, + "start":26,"end":31,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":14},"identifierName":"yield"}, "name": "yield" } ], "body": { "type": "BlockStatement", - "start": 36, - "end": 38, - "loc": { - "start": { - "line": 2, - "column": 19 - }, - "end": { - "line": 2, - "column": 21 - } - }, + "start":36,"end":38,"loc":{"start":{"line":2,"column":19},"end":{"line":2,"column":21}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/es2015/yield/parameter-name-arrow-inside-generator-1/options.json b/packages/babel-parser/test/fixtures/es2015/yield/parameter-name-arrow-inside-generator-1/options.json deleted file mode 100644 index b566d4944c2c..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/yield/parameter-name-arrow-inside-generator-1/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Yield cannot be used as name inside a generator function (2:3)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/yield/parameter-name-arrow-inside-generator-1/output.json b/packages/babel-parser/test/fixtures/es2015/yield/parameter-name-arrow-inside-generator-1/output.json new file mode 100644 index 000000000000..ff99d56fa462 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/yield/parameter-name-arrow-inside-generator-1/output.json @@ -0,0 +1,61 @@ +{ + "type": "File", + "start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "errors": [ + "SyntaxError: Yield cannot be used as name inside a generator function (2:3)", + "SyntaxError: Binding invalid left-hand side in function parameter list (2:3)" + ], + "program": { + "type": "Program", + "start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "id": { + "type": "Identifier", + "start":10,"end":12,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":12},"identifierName":"fn"}, + "name": "fn" + }, + "generator": true, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":15,"end":35,"loc":{"start":{"line":1,"column":15},"end":{"line":3,"column":1}}, + "body": [ + { + "type": "ExpressionStatement", + "start":19,"end":33,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":16}}, + "expression": { + "type": "ArrowFunctionExpression", + "start":19,"end":32,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":15}}, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "YieldExpression", + "start":20,"end":25,"loc":{"start":{"line":2,"column":3},"end":{"line":2,"column":8}}, + "delegate": false, + "argument": null + } + ], + "body": { + "type": "BlockStatement", + "start":30,"end":32,"loc":{"start":{"line":2,"column":13},"end":{"line":2,"column":15}}, + "body": [], + "directives": [] + } + } + } + ], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/yield/parameter-name-arrow-inside-generator-2/options.json b/packages/babel-parser/test/fixtures/es2015/yield/parameter-name-arrow-inside-generator-2/options.json deleted file mode 100644 index b566d4944c2c..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/yield/parameter-name-arrow-inside-generator-2/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Yield cannot be used as name inside a generator function (2:3)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/yield/parameter-name-arrow-inside-generator-2/output.json b/packages/babel-parser/test/fixtures/es2015/yield/parameter-name-arrow-inside-generator-2/output.json new file mode 100644 index 000000000000..fae1c616f040 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/yield/parameter-name-arrow-inside-generator-2/output.json @@ -0,0 +1,65 @@ +{ + "type": "File", + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "errors": [ + "SyntaxError: Yield cannot be used as name inside a generator function (2:3)", + "SyntaxError: Binding invalid left-hand side in function parameter list (2:3)" + ], + "program": { + "type": "Program", + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "id": { + "type": "Identifier", + "start":10,"end":12,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":12},"identifierName":"fn"}, + "name": "fn" + }, + "generator": true, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":15,"end":38,"loc":{"start":{"line":1,"column":15},"end":{"line":3,"column":1}}, + "body": [ + { + "type": "ExpressionStatement", + "start":19,"end":36,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":19}}, + "expression": { + "type": "ArrowFunctionExpression", + "start":19,"end":35,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":18}}, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "YieldExpression", + "start":20,"end":28,"loc":{"start":{"line":2,"column":3},"end":{"line":2,"column":11}}, + "delegate": false, + "argument": { + "type": "Identifier", + "start":26,"end":28,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":11},"identifierName":"fn"}, + "name": "fn" + } + } + ], + "body": { + "type": "BlockStatement", + "start":33,"end":35,"loc":{"start":{"line":2,"column":16},"end":{"line":2,"column":18}}, + "body": [], + "directives": [] + } + } + } + ], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/yield/parameter-name-arrow-inside-generator-3/options.json b/packages/babel-parser/test/fixtures/es2015/yield/parameter-name-arrow-inside-generator-3/options.json deleted file mode 100644 index 479a9a79f900..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/yield/parameter-name-arrow-inside-generator-3/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Yield cannot be used as name inside a generator function (2:9)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/yield/parameter-name-arrow-inside-generator-3/output.json b/packages/babel-parser/test/fixtures/es2015/yield/parameter-name-arrow-inside-generator-3/output.json new file mode 100644 index 000000000000..6e589aab512a --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/yield/parameter-name-arrow-inside-generator-3/output.json @@ -0,0 +1,71 @@ +{ + "type": "File", + "start":0,"end":41,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "errors": [ + "SyntaxError: Yield cannot be used as name inside a generator function (2:9)", + "SyntaxError: Binding invalid left-hand side in function parameter list (2:9)" + ], + "program": { + "type": "Program", + "start":0,"end":41,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":41,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "id": { + "type": "Identifier", + "start":10,"end":12,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":12},"identifierName":"fn"}, + "name": "fn" + }, + "generator": true, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":15,"end":41,"loc":{"start":{"line":1,"column":15},"end":{"line":3,"column":1}}, + "body": [ + { + "type": "ExpressionStatement", + "start":19,"end":39,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":22}}, + "expression": { + "type": "ArrowFunctionExpression", + "start":19,"end":38,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":21}}, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start":20,"end":21,"loc":{"start":{"line":2,"column":3},"end":{"line":2,"column":4},"identifierName":"a"}, + "name": "a" + }, + { + "type": "Identifier", + "start":23,"end":24,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":7},"identifierName":"b"}, + "name": "b" + }, + { + "type": "YieldExpression", + "start":26,"end":31,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":14}}, + "delegate": false, + "argument": null + } + ], + "body": { + "type": "BlockStatement", + "start":36,"end":38,"loc":{"start":{"line":2,"column":19},"end":{"line":2,"column":21}}, + "body": [], + "directives": [] + } + } + } + ], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/yield/parameter-name-arrow-no-parens/output.json b/packages/babel-parser/test/fixtures/es2015/yield/parameter-name-arrow-no-parens/output.json index 129088f1e55b..1f57152ef87b 100644 --- a/packages/babel-parser/test/fixtures/es2015/yield/parameter-name-arrow-no-parens/output.json +++ b/packages/babel-parser/test/fixtures/es2015/yield/parameter-name-arrow-no-parens/output.json @@ -1,98 +1,31 @@ { "type": "File", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, "program": { "type": "Program", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, "expression": { "type": "ArrowFunctionExpression", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "id": null, "generator": false, "async": false, "params": [ { "type": "Identifier", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "yield" - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5},"identifierName":"yield"}, "name": "yield" } ], "body": { "type": "BlockStatement", - "start": 9, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":9,"end":11,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":11}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/es2015/yield/parameter-name-arrow/output.json b/packages/babel-parser/test/fixtures/es2015/yield/parameter-name-arrow/output.json index b92e9f00f48c..afc2aa68b0d7 100644 --- a/packages/babel-parser/test/fixtures/es2015/yield/parameter-name-arrow/output.json +++ b/packages/babel-parser/test/fixtures/es2015/yield/parameter-name-arrow/output.json @@ -1,98 +1,31 @@ { "type": "File", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "program": { "type": "Program", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "expression": { "type": "ArrowFunctionExpression", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "id": null, "generator": false, "async": false, "params": [ { "type": "Identifier", - "start": 1, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "yield" - }, + "start":1,"end":6,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":6},"identifierName":"yield"}, "name": "yield" } ], "body": { "type": "BlockStatement", - "start": 11, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":11,"end":13,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":13}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/es2015/yield/parameter-name-function/output.json b/packages/babel-parser/test/fixtures/es2015/yield/parameter-name-function/output.json index 38dba1c20014..7ad59c55b47a 100644 --- a/packages/babel-parser/test/fixtures/es2015/yield/parameter-name-function/output.json +++ b/packages/babel-parser/test/fixtures/es2015/yield/parameter-name-function/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, "program": { "type": "Program", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, "id": { "type": "Identifier", - "start": 9, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "fn" - }, + "start":9,"end":11,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":11},"identifierName":"fn"}, "name": "fn" }, "generator": false, @@ -65,36 +20,13 @@ "params": [ { "type": "Identifier", - "start": 12, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 17 - }, - "identifierName": "yield" - }, + "start":12,"end":17,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":17},"identifierName":"yield"}, "name": "yield" } ], "body": { "type": "BlockStatement", - "start": 19, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":19,"end":21,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":21}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/es2015/yield/parameter-name-generator-method/options.json b/packages/babel-parser/test/fixtures/es2015/yield/parameter-name-generator-method/options.json deleted file mode 100644 index 72f8d0e0e4c3..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/yield/parameter-name-generator-method/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Can not use 'yield' as identifier inside a generator (1:11)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/yield/parameter-name-generator-method/output.json b/packages/babel-parser/test/fixtures/es2015/yield/parameter-name-generator-method/output.json new file mode 100644 index 000000000000..94529c93e1bf --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/yield/parameter-name-generator-method/output.json @@ -0,0 +1,58 @@ +{ + "type": "File", + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, + "errors": [ + "SyntaxError: Can not use 'yield' as identifier inside a generator (1:11)" + ], + "program": { + "type": "Program", + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, + "expression": { + "type": "ObjectExpression", + "start":1,"end":22,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":22}}, + "properties": [ + { + "type": "ObjectMethod", + "start":3,"end":20,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":20}}, + "method": true, + "key": { + "type": "Identifier", + "start":4,"end":10,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":10},"identifierName":"method"}, + "name": "method" + }, + "computed": false, + "kind": "method", + "id": null, + "generator": true, + "async": false, + "params": [ + { + "type": "Identifier", + "start":11,"end":16,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":16},"identifierName":"yield"}, + "name": "yield" + } + ], + "body": { + "type": "BlockStatement", + "start":18,"end":20,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":20}}, + "body": [], + "directives": [] + } + } + ], + "extra": { + "parenthesized": true, + "parenStart": 0 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/yield/parameter-name-generator/options.json b/packages/babel-parser/test/fixtures/es2015/yield/parameter-name-generator/options.json deleted file mode 100644 index dcab4205d32f..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/yield/parameter-name-generator/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Can not use 'yield' as identifier inside a generator (1:13)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/yield/parameter-name-generator/output.json b/packages/babel-parser/test/fixtures/es2015/yield/parameter-name-generator/output.json new file mode 100644 index 000000000000..e26adaef5ce4 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/yield/parameter-name-generator/output.json @@ -0,0 +1,40 @@ +{ + "type": "File", + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, + "errors": [ + "SyntaxError: Can not use 'yield' as identifier inside a generator (1:13)" + ], + "program": { + "type": "Program", + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, + "id": { + "type": "Identifier", + "start":10,"end":12,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":12},"identifierName":"fn"}, + "name": "fn" + }, + "generator": true, + "async": false, + "params": [ + { + "type": "Identifier", + "start":13,"end":18,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":18},"identifierName":"yield"}, + "name": "yield" + } + ], + "body": { + "type": "BlockStatement", + "start":20,"end":22,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":22}}, + "body": [], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/yield/parameter-name-strict-body/options.json b/packages/babel-parser/test/fixtures/es2015/yield/parameter-name-strict-body/options.json deleted file mode 100644 index cb8efaaa0aff..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/yield/parameter-name-strict-body/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'yield' in strict mode (1:12)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/yield/parameter-name-strict-body/output.json b/packages/babel-parser/test/fixtures/es2015/yield/parameter-name-strict-body/output.json new file mode 100644 index 000000000000..a5d721d8ece0 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/yield/parameter-name-strict-body/output.json @@ -0,0 +1,54 @@ +{ + "type": "File", + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, + "errors": [ + "SyntaxError: Binding 'yield' in strict mode (1:12)" + ], + "program": { + "type": "Program", + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, + "id": { + "type": "Identifier", + "start":9,"end":11,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":11},"identifierName":"fn"}, + "name": "fn" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start":12,"end":17,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":17},"identifierName":"yield"}, + "name": "yield" + } + ], + "body": { + "type": "BlockStatement", + "start":19,"end":36,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":36}}, + "body": [], + "directives": [ + { + "type": "Directive", + "start":21,"end":34,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":34}}, + "value": { + "type": "DirectiveLiteral", + "start":21,"end":33,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":33}}, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/yield/parameter-name-strict/options.json b/packages/babel-parser/test/fixtures/es2015/yield/parameter-name-strict/options.json deleted file mode 100644 index 75bdf3d53d6e..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/yield/parameter-name-strict/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected reserved word 'yield' (2:12)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/yield/parameter-name-strict/output.json b/packages/babel-parser/test/fixtures/es2015/yield/parameter-name-strict/output.json new file mode 100644 index 000000000000..e6116f716d19 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/yield/parameter-name-strict/output.json @@ -0,0 +1,54 @@ +{ + "type": "File", + "start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":21}}, + "errors": [ + "SyntaxError: Unexpected reserved word 'yield' (2:12)" + ], + "program": { + "type": "Program", + "start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":21}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":14,"end":35,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":21}}, + "id": { + "type": "Identifier", + "start":23,"end":25,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":11},"identifierName":"fn"}, + "name": "fn" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start":26,"end":31,"loc":{"start":{"line":2,"column":12},"end":{"line":2,"column":17},"identifierName":"yield"}, + "name": "yield" + } + ], + "body": { + "type": "BlockStatement", + "start":33,"end":35,"loc":{"start":{"line":2,"column":19},"end":{"line":2,"column":21}}, + "body": [], + "directives": [] + } + } + ], + "directives": [ + { + "type": "Directive", + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "value": { + "type": "DirectiveLiteral", + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/yield/yield class/output.json b/packages/babel-parser/test/fixtures/es2015/yield/yield class/output.json index e4526ece7675..e7a96f2b27d8 100644 --- a/packages/babel-parser/test/fixtures/es2015/yield/yield class/output.json +++ b/packages/babel-parser/test/fixtures/es2015/yield/yield class/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, "program": { "type": "Program", - "start": 0, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, "id": { "type": "Identifier", - "start": 10, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 13 - }, - "identifierName": "bar" - }, + "start":10,"end":13,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":13},"identifierName":"bar"}, "name": "bar" }, "generator": true, @@ -65,78 +20,23 @@ "params": [], "body": { "type": "BlockStatement", - "start": 16, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":16,"end":34,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":34}}, "body": [ { "type": "ExpressionStatement", - "start": 18, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":18,"end":32,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":32}}, "expression": { "type": "YieldExpression", - "start": 18, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":18,"end":32,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":32}}, "delegate": false, "argument": { "type": "ClassExpression", - "start": 24, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":24,"end":32,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":32}}, "id": null, "superClass": null, "body": { "type": "ClassBody", - "start": 30, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":30,"end":32,"loc":{"start":{"line":1,"column":30},"end":{"line":1,"column":32}}, "body": [] } } diff --git a/packages/babel-parser/test/fixtures/es2015/yield/yield-as-identifier/output.json b/packages/babel-parser/test/fixtures/es2015/yield/yield-as-identifier/output.json index b0139b0da807..9af89ad88fab 100644 --- a/packages/babel-parser/test/fixtures/es2015/yield/yield-as-identifier/output.json +++ b/packages/babel-parser/test/fixtures/es2015/yield/yield-as-identifier/output.json @@ -1,94 +1,27 @@ { "type": "File", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "program": { "type": "Program", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":4,"end":13,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":13}}, "id": { "type": "Identifier", - "start": 4, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "yield" - }, + "start":4,"end":9,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":9},"identifierName":"yield"}, "name": "yield" }, "init": { "type": "NumericLiteral", - "start": 12, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":12,"end":13,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":13}}, "extra": { "rawValue": 2, "raw": "2" diff --git a/packages/babel-parser/test/fixtures/es2015/yield/yield-star-in-arrow-scope-is-multiplication/output.json b/packages/babel-parser/test/fixtures/es2015/yield/yield-star-in-arrow-scope-is-multiplication/output.json index e1dae05be965..7d44ac03c66e 100644 --- a/packages/babel-parser/test/fixtures/es2015/yield/yield-star-in-arrow-scope-is-multiplication/output.json +++ b/packages/babel-parser/test/fixtures/es2015/yield/yield-star-in-arrow-scope-is-multiplication/output.json @@ -1,130 +1,40 @@ { "type": "File", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "program": { "type": "Program", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "expression": { "type": "ArrowFunctionExpression", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "id": null, "generator": false, "async": false, "params": [ { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "e" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"e"}, "name": "e" } ], "body": { "type": "BinaryExpression", - "start": 5, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":5,"end":14,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":14}}, "left": { "type": "Identifier", - "start": 5, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 10 - }, - "identifierName": "yield" - }, + "start":5,"end":10,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":10},"identifierName":"yield"}, "name": "yield" }, "operator": "*", "right": { "type": "NumericLiteral", - "start": 12, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":12,"end":14,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":14}}, "extra": { "rawValue": 10, "raw": "10" diff --git a/packages/babel-parser/test/fixtures/es2015/yield/yield-star-in-global-scope-is-multiplication/output.json b/packages/babel-parser/test/fixtures/es2015/yield/yield-star-in-global-scope-is-multiplication/output.json index 6615c691c1a6..bd97db980359 100644 --- a/packages/babel-parser/test/fixtures/es2015/yield/yield-star-in-global-scope-is-multiplication/output.json +++ b/packages/babel-parser/test/fixtures/es2015/yield/yield-star-in-global-scope-is-multiplication/output.json @@ -1,94 +1,27 @@ { "type": "File", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "program": { "type": "Program", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "expression": { "type": "BinaryExpression", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "left": { "type": "Identifier", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "yield" - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5},"identifierName":"yield"}, "name": "yield" }, "operator": "*", "right": { "type": "NumericLiteral", - "start": 7, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":7,"end":9,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":9}}, "extra": { "rawValue": 10, "raw": "10" diff --git a/packages/babel-parser/test/fixtures/es2015/yield/yield-star-inside-generator-function-declaration/output.json b/packages/babel-parser/test/fixtures/es2015/yield/yield-star-inside-generator-function-declaration/output.json index 61f2ea2b0990..660626e6a893 100644 --- a/packages/babel-parser/test/fixtures/es2015/yield/yield-star-inside-generator-function-declaration/output.json +++ b/packages/babel-parser/test/fixtures/es2015/yield/yield-star-inside-generator-function-declaration/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, "program": { "type": "Program", - "start": 0, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, "id": { "type": "Identifier", - "start": 10, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 14 - }, - "identifierName": "test" - }, + "start":10,"end":14,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":14},"identifierName":"test"}, "name": "test" }, "generator": true, @@ -65,63 +20,18 @@ "params": [], "body": { "type": "BlockStatement", - "start": 18, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":18,"end":30,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":30}}, "body": [ { "type": "ExpressionStatement", - "start": 20, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":20,"end":28,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":28}}, "expression": { "type": "YieldExpression", - "start": 20, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":20,"end":28,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":28}}, "delegate": true, "argument": { "type": "Identifier", - "start": 27, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 28 - }, - "identifierName": "v" - }, + "start":27,"end":28,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":28},"identifierName":"v"}, "name": "v" } } diff --git a/packages/babel-parser/test/fixtures/es2015/yield/yield-star-inside-generator-function-expression/output.json b/packages/babel-parser/test/fixtures/es2015/yield/yield-star-inside-generator-function-expression/output.json index 91b236468d0b..7e991ebad19c 100644 --- a/packages/babel-parser/test/fixtures/es2015/yield/yield-star-inside-generator-function-expression/output.json +++ b/packages/babel-parser/test/fixtures/es2015/yield/yield-star-inside-generator-function-expression/output.json @@ -1,125 +1,36 @@ { "type": "File", - "start": 0, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, "program": { "type": "Program", - "start": 0, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, "expression": { "type": "FunctionExpression", - "start": 1, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":1,"end":26,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":26}}, "id": null, "generator": true, "async": false, "params": [], "body": { "type": "BlockStatement", - "start": 14, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":14,"end":26,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":26}}, "body": [ { "type": "ExpressionStatement", - "start": 16, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":16,"end":24,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":24}}, "expression": { "type": "YieldExpression", - "start": 16, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":16,"end":24,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":24}}, "delegate": true, "argument": { "type": "Identifier", - "start": 23, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 24 - }, - "identifierName": "v" - }, + "start":23,"end":24,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":24},"identifierName":"v"}, "name": "v" } } diff --git a/packages/babel-parser/test/fixtures/es2015/yield/yield-star-inside-generator-method/output.json b/packages/babel-parser/test/fixtures/es2015/yield/yield-star-inside-generator-method/output.json index 99d39defc2d9..f1770f76ce26 100644 --- a/packages/babel-parser/test/fixtures/es2015/yield/yield-star-inside-generator-method/output.json +++ b/packages/babel-parser/test/fixtures/es2015/yield/yield-star-inside-generator-method/output.json @@ -1,125 +1,35 @@ { "type": "File", - "start": 0, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, "program": { "type": "Program", - "start": 0, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":4,"end":33,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":33}}, "id": { "type": "Identifier", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "x" - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"x"}, "name": "x" }, "init": { "type": "ObjectExpression", - "start": 8, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":8,"end":33,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":33}}, "properties": [ { "type": "ObjectMethod", - "start": 10, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":10,"end":31,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":31}}, "method": true, "key": { "type": "Identifier", - "start": 11, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 15 - }, - "identifierName": "test" - }, + "start":11,"end":15,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":15},"identifierName":"test"}, "name": "test" }, "computed": false, @@ -130,63 +40,18 @@ "params": [], "body": { "type": "BlockStatement", - "start": 19, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":19,"end":31,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":31}}, "body": [ { "type": "ExpressionStatement", - "start": 21, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":21,"end":29,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":29}}, "expression": { "type": "YieldExpression", - "start": 21, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":21,"end":29,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":29}}, "delegate": true, "argument": { "type": "Identifier", - "start": 28, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 29 - }, - "identifierName": "v" - }, + "start":28,"end":29,"loc":{"start":{"line":1,"column":28},"end":{"line":1,"column":29},"identifierName":"v"}, "name": "v" } } diff --git a/packages/babel-parser/test/fixtures/es2015/yield/yield-star-inside-plain-function/output.json b/packages/babel-parser/test/fixtures/es2015/yield/yield-star-inside-plain-function/output.json index a551957cda4b..4b14fc797d57 100644 --- a/packages/babel-parser/test/fixtures/es2015/yield/yield-star-inside-plain-function/output.json +++ b/packages/babel-parser/test/fixtures/es2015/yield/yield-star-inside-plain-function/output.json @@ -1,141 +1,41 @@ { "type": "File", - "start": 0, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, "program": { "type": "Program", - "start": 0, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, "expression": { "type": "FunctionExpression", - "start": 1, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":1,"end":26,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":26}}, "id": null, "generator": false, "async": false, "params": [], "body": { "type": "BlockStatement", - "start": 13, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":13,"end":26,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":26}}, "body": [ { "type": "ExpressionStatement", - "start": 15, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":15,"end":24,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":24}}, "expression": { "type": "BinaryExpression", - "start": 15, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":15,"end":24,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":24}}, "left": { "type": "Identifier", - "start": 15, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 20 - }, - "identifierName": "yield" - }, + "start":15,"end":20,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":20},"identifierName":"yield"}, "name": "yield" }, "operator": "*", "right": { "type": "NumericLiteral", - "start": 22, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":22,"end":24,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":24}}, "extra": { "rawValue": 10, "raw": "10" diff --git a/packages/babel-parser/test/fixtures/es2015/yield/yield-star-parameter-default-inside-function/output.json b/packages/babel-parser/test/fixtures/es2015/yield/yield-star-parameter-default-inside-function/output.json index d9481780b188..fec2cae5e5ab 100644 --- a/packages/babel-parser/test/fixtures/es2015/yield/yield-star-parameter-default-inside-function/output.json +++ b/packages/babel-parser/test/fixtures/es2015/yield/yield-star-parameter-default-inside-function/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, "program": { "type": "Program", - "start": 0, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, "id": { "type": "Identifier", - "start": 9, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "fn" - }, + "start":9,"end":11,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":11},"identifierName":"fn"}, "name": "fn" }, "generator": false, @@ -65,82 +20,24 @@ "params": [ { "type": "AssignmentPattern", - "start": 12, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":12,"end":28,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":28}}, "left": { "type": "Identifier", - "start": 12, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - }, - "identifierName": "x" - }, + "start":12,"end":13,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":13},"identifierName":"x"}, "name": "x" }, "right": { "type": "BinaryExpression", - "start": 16, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":16,"end":28,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":28}}, "left": { "type": "Identifier", - "start": 16, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 21 - }, - "identifierName": "yield" - }, + "start":16,"end":21,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":21},"identifierName":"yield"}, "name": "yield" }, "operator": "*", "right": { "type": "Identifier", - "start": 23, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 28 - }, - "identifierName": "yield" - }, + "start":23,"end":28,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":28},"identifierName":"yield"}, "name": "yield" } } @@ -148,18 +45,7 @@ ], "body": { "type": "BlockStatement", - "start": 30, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":30,"end":32,"loc":{"start":{"line":1,"column":30},"end":{"line":1,"column":32}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/es2015/yield/yield-star-parameter-default-inside-generator/options.json b/packages/babel-parser/test/fixtures/es2015/yield/yield-star-parameter-default-inside-generator/options.json deleted file mode 100644 index dd9a684ef928..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/yield/yield-star-parameter-default-inside-generator/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "yield is not allowed in generator parameters (1:17)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/yield/yield-star-parameter-default-inside-generator/output.json b/packages/babel-parser/test/fixtures/es2015/yield/yield-star-parameter-default-inside-generator/output.json new file mode 100644 index 000000000000..0e6599694fe5 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/yield/yield-star-parameter-default-inside-generator/output.json @@ -0,0 +1,56 @@ +{ + "type": "File", + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, + "errors": [ + "SyntaxError: yield is not allowed in generator parameters (1:17)", + "SyntaxError: yield is not allowed in generator parameters (1:24)" + ], + "program": { + "type": "Program", + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, + "id": { + "type": "Identifier", + "start":10,"end":12,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":12},"identifierName":"fn"}, + "name": "fn" + }, + "generator": true, + "async": false, + "params": [ + { + "type": "AssignmentPattern", + "start":13,"end":29,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":29}}, + "left": { + "type": "Identifier", + "start":13,"end":14,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":14},"identifierName":"x"}, + "name": "x" + }, + "right": { + "type": "YieldExpression", + "start":17,"end":29,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":29}}, + "delegate": true, + "argument": { + "type": "YieldExpression", + "start":24,"end":29,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":29}}, + "delegate": false, + "argument": null + } + } + } + ], + "body": { + "type": "BlockStatement", + "start":31,"end":33,"loc":{"start":{"line":1,"column":31},"end":{"line":1,"column":33}}, + "body": [], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/yield/yield-yield/output.json b/packages/babel-parser/test/fixtures/es2015/yield/yield-yield/output.json index bce2a8a321cb..05b87b7f5374 100644 --- a/packages/babel-parser/test/fixtures/es2015/yield/yield-yield/output.json +++ b/packages/babel-parser/test/fixtures/es2015/yield/yield-yield/output.json @@ -1,139 +1,40 @@ { "type": "File", - "start": 0, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, "program": { "type": "Program", - "start": 0, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, "expression": { "type": "FunctionExpression", - "start": 1, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":1,"end":32,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":32}}, "id": null, "generator": true, "async": false, "params": [], "body": { "type": "BlockStatement", - "start": 14, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":14,"end":32,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":32}}, "body": [ { "type": "ExpressionStatement", - "start": 16, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":16,"end":30,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":30}}, "expression": { "type": "YieldExpression", - "start": 16, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":16,"end":30,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":30}}, "delegate": false, "argument": { "type": "YieldExpression", - "start": 22, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":22,"end":30,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":30}}, "delegate": false, "argument": { "type": "NumericLiteral", - "start": 28, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":28,"end":30,"loc":{"start":{"line":1,"column":28},"end":{"line":1,"column":30}}, "extra": { "rawValue": 10, "raw": "10" diff --git a/packages/babel-parser/test/fixtures/es2016/exponentiation-operator/1/output.json b/packages/babel-parser/test/fixtures/es2016/exponentiation-operator/1/output.json index 192bbad20bb7..c164041f972a 100644 --- a/packages/babel-parser/test/fixtures/es2016/exponentiation-operator/1/output.json +++ b/packages/babel-parser/test/fixtures/es2016/exponentiation-operator/1/output.json @@ -1,76 +1,21 @@ { "type": "File", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "program": { "type": "Program", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "expression": { "type": "BinaryExpression", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "left": { "type": "NumericLiteral", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1}}, "extra": { "rawValue": 3, "raw": "3" @@ -80,18 +25,7 @@ "operator": "**", "right": { "type": "NumericLiteral", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, "extra": { "rawValue": 2, "raw": "2" diff --git a/packages/babel-parser/test/fixtures/es2016/exponentiation-operator/10/options.json b/packages/babel-parser/test/fixtures/es2016/exponentiation-operator/10/options.json deleted file mode 100644 index 2c624e8cec70..000000000000 --- a/packages/babel-parser/test/fixtures/es2016/exponentiation-operator/10/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Illegal expression. Wrap left hand side or entire exponentiation in parentheses. (1:1)" -} diff --git a/packages/babel-parser/test/fixtures/es2016/exponentiation-operator/10/output.json b/packages/babel-parser/test/fixtures/es2016/exponentiation-operator/10/output.json new file mode 100644 index 000000000000..c0305a64da32 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2016/exponentiation-operator/10/output.json @@ -0,0 +1,49 @@ +{ + "type": "File", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "errors": [ + "SyntaxError: Illegal expression. Wrap left hand side or entire exponentiation in parentheses. (1:1)" + ], + "program": { + "type": "Program", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "expression": { + "type": "BinaryExpression", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "left": { + "type": "UnaryExpression", + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}}, + "operator": "-", + "prefix": true, + "argument": { + "type": "NumericLiteral", + "start":1,"end":2,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":2}}, + "extra": { + "rawValue": 5, + "raw": "5" + }, + "value": 5 + } + }, + "operator": "**", + "right": { + "type": "NumericLiteral", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7}}, + "extra": { + "rawValue": 6, + "raw": "6" + }, + "value": 6 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2016/exponentiation-operator/11/options.json b/packages/babel-parser/test/fixtures/es2016/exponentiation-operator/11/options.json deleted file mode 100644 index f04c5c035abb..000000000000 --- a/packages/babel-parser/test/fixtures/es2016/exponentiation-operator/11/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Illegal expression. Wrap left hand side or entire exponentiation in parentheses. (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/es2016/exponentiation-operator/11/output.json b/packages/babel-parser/test/fixtures/es2016/exponentiation-operator/11/output.json new file mode 100644 index 000000000000..b71f64505f0f --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2016/exponentiation-operator/11/output.json @@ -0,0 +1,51 @@ +{ + "type": "File", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "errors": [ + "SyntaxError: Illegal expression. Wrap left hand side or entire exponentiation in parentheses. (1:2)" + ], + "program": { + "type": "Program", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "expression": { + "type": "BinaryExpression", + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "left": { + "type": "UnaryExpression", + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, + "operator": "-", + "prefix": true, + "argument": { + "type": "NumericLiteral", + "start":2,"end":3,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":3}}, + "extra": { + "rawValue": 5, + "raw": "5", + "parenthesized": true, + "parenStart": 1 + }, + "value": 5 + } + }, + "operator": "**", + "right": { + "type": "NumericLiteral", + "start":8,"end":9,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":9}}, + "extra": { + "rawValue": 6, + "raw": "6" + }, + "value": 6 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2016/exponentiation-operator/12/options.json b/packages/babel-parser/test/fixtures/es2016/exponentiation-operator/12/options.json deleted file mode 100644 index f04c5c035abb..000000000000 --- a/packages/babel-parser/test/fixtures/es2016/exponentiation-operator/12/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Illegal expression. Wrap left hand side or entire exponentiation in parentheses. (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/es2016/exponentiation-operator/12/output.json b/packages/babel-parser/test/fixtures/es2016/exponentiation-operator/12/output.json new file mode 100644 index 000000000000..510475c7e450 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2016/exponentiation-operator/12/output.json @@ -0,0 +1,53 @@ +{ + "type": "File", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "errors": [ + "SyntaxError: Illegal expression. Wrap left hand side or entire exponentiation in parentheses. (1:2)" + ], + "program": { + "type": "Program", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "expression": { + "type": "BinaryExpression", + "start":1,"end":8,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":8}}, + "left": { + "type": "UnaryExpression", + "start":1,"end":3,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":3}}, + "operator": "-", + "prefix": true, + "argument": { + "type": "NumericLiteral", + "start":2,"end":3,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":3}}, + "extra": { + "rawValue": 5, + "raw": "5" + }, + "value": 5 + } + }, + "operator": "**", + "right": { + "type": "NumericLiteral", + "start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8}}, + "extra": { + "rawValue": 6, + "raw": "6" + }, + "value": 6 + }, + "extra": { + "parenthesized": true, + "parenStart": 0 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2016/exponentiation-operator/15/options.json b/packages/babel-parser/test/fixtures/es2016/exponentiation-operator/15/options.json index c694133bf2b1..0861962d889d 100644 --- a/packages/babel-parser/test/fixtures/es2016/exponentiation-operator/15/options.json +++ b/packages/babel-parser/test/fixtures/es2016/exponentiation-operator/15/options.json @@ -1,4 +1,3 @@ { - "createParenthesizedExpressions": true, - "throws": "Illegal expression. Wrap left hand side or entire exponentiation in parentheses. (1:1)" + "createParenthesizedExpressions": true } diff --git a/packages/babel-parser/test/fixtures/es2016/exponentiation-operator/15/output.json b/packages/babel-parser/test/fixtures/es2016/exponentiation-operator/15/output.json new file mode 100644 index 000000000000..d0582d584014 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2016/exponentiation-operator/15/output.json @@ -0,0 +1,53 @@ +{ + "type": "File", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "errors": [ + "SyntaxError: Illegal expression. Wrap left hand side or entire exponentiation in parentheses. (1:1)" + ], + "program": { + "type": "Program", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "expression": { + "type": "BinaryExpression", + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "left": { + "type": "UnaryExpression", + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, + "operator": "-", + "prefix": true, + "argument": { + "type": "ParenthesizedExpression", + "start":1,"end":4,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":4}}, + "expression": { + "type": "NumericLiteral", + "start":2,"end":3,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":3}}, + "extra": { + "rawValue": 5, + "raw": "5" + }, + "value": 5 + } + } + }, + "operator": "**", + "right": { + "type": "NumericLiteral", + "start":8,"end":9,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":9}}, + "extra": { + "rawValue": 6, + "raw": "6" + }, + "value": 6 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2016/exponentiation-operator/16/options.json b/packages/babel-parser/test/fixtures/es2016/exponentiation-operator/16/options.json index 19687fbe197a..0861962d889d 100644 --- a/packages/babel-parser/test/fixtures/es2016/exponentiation-operator/16/options.json +++ b/packages/babel-parser/test/fixtures/es2016/exponentiation-operator/16/options.json @@ -1,4 +1,3 @@ { - "createParenthesizedExpressions": true, - "throws": "Illegal expression. Wrap left hand side or entire exponentiation in parentheses. (1:2)" + "createParenthesizedExpressions": true } diff --git a/packages/babel-parser/test/fixtures/es2016/exponentiation-operator/16/output.json b/packages/babel-parser/test/fixtures/es2016/exponentiation-operator/16/output.json new file mode 100644 index 000000000000..33d3d6fe7f0c --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2016/exponentiation-operator/16/output.json @@ -0,0 +1,53 @@ +{ + "type": "File", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "errors": [ + "SyntaxError: Illegal expression. Wrap left hand side or entire exponentiation in parentheses. (1:2)" + ], + "program": { + "type": "Program", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "expression": { + "type": "ParenthesizedExpression", + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "expression": { + "type": "BinaryExpression", + "start":1,"end":8,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":8}}, + "left": { + "type": "UnaryExpression", + "start":1,"end":3,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":3}}, + "operator": "-", + "prefix": true, + "argument": { + "type": "NumericLiteral", + "start":2,"end":3,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":3}}, + "extra": { + "rawValue": 5, + "raw": "5" + }, + "value": 5 + } + }, + "operator": "**", + "right": { + "type": "NumericLiteral", + "start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8}}, + "extra": { + "rawValue": 6, + "raw": "6" + }, + "value": 6 + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2016/exponentiation-operator/2/output.json b/packages/babel-parser/test/fixtures/es2016/exponentiation-operator/2/output.json index e840aecbd18a..9083e2542f5c 100644 --- a/packages/babel-parser/test/fixtures/es2016/exponentiation-operator/2/output.json +++ b/packages/babel-parser/test/fixtures/es2016/exponentiation-operator/2/output.json @@ -1,92 +1,26 @@ { "type": "File", - "start": 0, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, "program": { "type": "Program", - "start": 0, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, "expression": { "type": "UnaryExpression", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "operator": "-", "prefix": true, "argument": { "type": "BinaryExpression", - "start": 2, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":2,"end":8,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":8}}, "left": { "type": "NumericLiteral", - "start": 2, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 3 - } - }, + "start":2,"end":3,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":3}}, "extra": { "rawValue": 5, "raw": "5" @@ -96,18 +30,7 @@ "operator": "**", "right": { "type": "NumericLiteral", - "start": 7, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8}}, "extra": { "rawValue": 6, "raw": "6" @@ -124,4 +47,4 @@ ], "directives": [] } -} +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2016/exponentiation-operator/3/output.json b/packages/babel-parser/test/fixtures/es2016/exponentiation-operator/3/output.json index 3b0d6f0acc6b..c4c070e89afa 100644 --- a/packages/babel-parser/test/fixtures/es2016/exponentiation-operator/3/output.json +++ b/packages/babel-parser/test/fixtures/es2016/exponentiation-operator/3/output.json @@ -1,94 +1,27 @@ { "type": "File", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, "program": { "type": "Program", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, "expression": { "type": "AssignmentExpression", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "operator": "**=", "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "a" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"a"}, "name": "a" }, "right": { "type": "NumericLiteral", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7}}, "extra": { "rawValue": 2, "raw": "2" diff --git a/packages/babel-parser/test/fixtures/es2016/exponentiation-operator/4/output.json b/packages/babel-parser/test/fixtures/es2016/exponentiation-operator/4/output.json index 5c99d2fccba8..3ab4831dddea 100644 --- a/packages/babel-parser/test/fixtures/es2016/exponentiation-operator/4/output.json +++ b/packages/babel-parser/test/fixtures/es2016/exponentiation-operator/4/output.json @@ -1,108 +1,30 @@ { "type": "File", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, "program": { "type": "Program", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":4,"end":20,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":20}}, "id": { "type": "Identifier", - "start": 4, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "squared" - }, + "start":4,"end":11,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":11},"identifierName":"squared"}, "name": "squared" }, "init": { "type": "BinaryExpression", - "start": 14, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":14,"end":20,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":20}}, "left": { "type": "NumericLiteral", - "start": 14, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":14,"end":15,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":15}}, "extra": { "rawValue": 2, "raw": "2" @@ -112,18 +34,7 @@ "operator": "**", "right": { "type": "NumericLiteral", - "start": 19, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":19,"end":20,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":20}}, "extra": { "rawValue": 2, "raw": "2" diff --git a/packages/babel-parser/test/fixtures/es2016/exponentiation-operator/5/output.json b/packages/babel-parser/test/fixtures/es2016/exponentiation-operator/5/output.json index b30c8ca4947c..2cadfcee1388 100644 --- a/packages/babel-parser/test/fixtures/es2016/exponentiation-operator/5/output.json +++ b/packages/babel-parser/test/fixtures/es2016/exponentiation-operator/5/output.json @@ -1,76 +1,21 @@ { "type": "File", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "program": { "type": "Program", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "expression": { "type": "BinaryExpression", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "left": { "type": "NumericLiteral", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1}}, "extra": { "rawValue": 2, "raw": "2" @@ -80,32 +25,10 @@ "operator": "**", "right": { "type": "BinaryExpression", - "start": 6, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":6,"end":12,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":12}}, "left": { "type": "NumericLiteral", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7}}, "extra": { "rawValue": 3, "raw": "3" @@ -115,18 +38,7 @@ "operator": "**", "right": { "type": "NumericLiteral", - "start": 11, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":11,"end":12,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":12}}, "extra": { "rawValue": 2, "raw": "2" diff --git a/packages/babel-parser/test/fixtures/es2016/exponentiation-operator/6/output.json b/packages/babel-parser/test/fixtures/es2016/exponentiation-operator/6/output.json index cb363b79da74..043af14c0bf0 100644 --- a/packages/babel-parser/test/fixtures/es2016/exponentiation-operator/6/output.json +++ b/packages/babel-parser/test/fixtures/es2016/exponentiation-operator/6/output.json @@ -1,76 +1,21 @@ { "type": "File", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "program": { "type": "Program", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "expression": { "type": "BinaryExpression", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "left": { "type": "NumericLiteral", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1}}, "extra": { "rawValue": 2, "raw": "2" @@ -80,32 +25,10 @@ "operator": "**", "right": { "type": "BinaryExpression", - "start": 5, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":5,"end":11,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":11}}, "left": { "type": "NumericLiteral", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, "extra": { "rawValue": 3, "raw": "3" @@ -115,18 +38,7 @@ "operator": "**", "right": { "type": "NumericLiteral", - "start": 10, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11}}, "extra": { "rawValue": 2, "raw": "2" diff --git a/packages/babel-parser/test/fixtures/es2016/exponentiation-operator/7/output.json b/packages/babel-parser/test/fixtures/es2016/exponentiation-operator/7/output.json index 2fb85f363b06..bdd1d891d655 100644 --- a/packages/babel-parser/test/fixtures/es2016/exponentiation-operator/7/output.json +++ b/packages/babel-parser/test/fixtures/es2016/exponentiation-operator/7/output.json @@ -1,90 +1,24 @@ { "type": "File", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "program": { "type": "Program", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "expression": { "type": "BinaryExpression", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "left": { "type": "BinaryExpression", - "start": 1, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":1,"end":8,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":8}}, "left": { "type": "NumericLiteral", - "start": 1, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - } - }, + "start":1,"end":2,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":2}}, "extra": { "rawValue": 2, "raw": "2" @@ -94,34 +28,12 @@ "operator": "**", "right": { "type": "UnaryExpression", - "start": 6, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":6,"end":8,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":8}}, "operator": "-", "prefix": true, "argument": { "type": "NumericLiteral", - "start": 7, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8}}, "extra": { "rawValue": 1, "raw": "1" @@ -137,18 +49,7 @@ "operator": "*", "right": { "type": "NumericLiteral", - "start": 12, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":12,"end":13,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":13}}, "extra": { "rawValue": 2, "raw": "2" @@ -160,4 +61,4 @@ ], "directives": [] } -} +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2016/exponentiation-operator/8/output.json b/packages/babel-parser/test/fixtures/es2016/exponentiation-operator/8/output.json index 56c71d7d2533..294544806c7b 100644 --- a/packages/babel-parser/test/fixtures/es2016/exponentiation-operator/8/output.json +++ b/packages/babel-parser/test/fixtures/es2016/exponentiation-operator/8/output.json @@ -1,90 +1,24 @@ { "type": "File", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "program": { "type": "Program", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "expression": { "type": "BinaryExpression", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "left": { "type": "BinaryExpression", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "left": { "type": "NumericLiteral", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1}}, "extra": { "rawValue": 2, "raw": "2" @@ -94,34 +28,12 @@ "operator": "**", "right": { "type": "UnaryExpression", - "start": 5, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":5,"end":7,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":7}}, "operator": "-", "prefix": true, "argument": { "type": "NumericLiteral", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7}}, "extra": { "rawValue": 1, "raw": "1" @@ -133,18 +45,7 @@ "operator": "*", "right": { "type": "NumericLiteral", - "start": 10, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11}}, "extra": { "rawValue": 2, "raw": "2" @@ -156,4 +57,4 @@ ], "directives": [] } -} +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2016/exponentiation-operator/9/output.json b/packages/babel-parser/test/fixtures/es2016/exponentiation-operator/9/output.json index 2691c6433738..b01a64d1df48 100644 --- a/packages/babel-parser/test/fixtures/es2016/exponentiation-operator/9/output.json +++ b/packages/babel-parser/test/fixtures/es2016/exponentiation-operator/9/output.json @@ -1,92 +1,26 @@ { "type": "File", - "start": 0, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, "program": { "type": "Program", - "start": 0, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, "expression": { "type": "BinaryExpression", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "left": { "type": "UnaryExpression", - "start": 1, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 3 - } - }, + "start":1,"end":3,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":3}}, "operator": "-", "prefix": true, "argument": { "type": "NumericLiteral", - "start": 2, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 3 - } - }, + "start":2,"end":3,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":3}}, "extra": { "rawValue": 5, "raw": "5" @@ -101,18 +35,7 @@ "operator": "**", "right": { "type": "NumericLiteral", - "start": 8, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":8,"end":9,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":9}}, "extra": { "rawValue": 6, "raw": "6" @@ -124,4 +47,4 @@ ], "directives": [] } -} +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/array-pattern-default/options.json b/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/array-pattern-default/options.json deleted file mode 100644 index 12b18792fcc4..000000000000 --- a/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/array-pattern-default/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Illegal 'use strict' directive in function with non-simple parameter list (1:0)" -} diff --git a/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/array-pattern-default/output.json b/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/array-pattern-default/output.json new file mode 100644 index 000000000000..d034afbc9b42 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/array-pattern-default/output.json @@ -0,0 +1,74 @@ +{ + "type": "File", + "start":0,"end":57,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "errors": [ + "SyntaxError: Illegal 'use strict' directive in function with non-simple parameter list (1:0)" + ], + "program": { + "type": "Program", + "start":0,"end":57,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":57,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "id": { + "type": "Identifier", + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"a"}, + "name": "a" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "AssignmentPattern", + "start":11,"end":36,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":36}}, + "left": { + "type": "ArrayPattern", + "start":11,"end":31,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":31}}, + "elements": [ + { + "type": "Identifier", + "start":13,"end":20,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":20},"identifierName":"option1"}, + "name": "option1" + }, + { + "type": "Identifier", + "start":22,"end":29,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":29},"identifierName":"option2"}, + "name": "option2" + } + ] + }, + "right": { + "type": "ArrayExpression", + "start":34,"end":36,"loc":{"start":{"line":1,"column":34},"end":{"line":1,"column":36}}, + "elements": [] + } + } + ], + "body": { + "type": "BlockStatement", + "start":38,"end":57,"loc":{"start":{"line":1,"column":38},"end":{"line":3,"column":1}}, + "body": [], + "directives": [ + { + "type": "Directive", + "start":42,"end":55,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":15}}, + "value": { + "type": "DirectiveLiteral", + "start":42,"end":54,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":14}}, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/array-pattern/options.json b/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/array-pattern/options.json deleted file mode 100644 index 12b18792fcc4..000000000000 --- a/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/array-pattern/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Illegal 'use strict' directive in function with non-simple parameter list (1:0)" -} diff --git a/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/array-pattern/output.json b/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/array-pattern/output.json new file mode 100644 index 000000000000..35fd2a0adb9e --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/array-pattern/output.json @@ -0,0 +1,65 @@ +{ + "type": "File", + "start":0,"end":52,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "errors": [ + "SyntaxError: Illegal 'use strict' directive in function with non-simple parameter list (1:0)" + ], + "program": { + "type": "Program", + "start":0,"end":52,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":52,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "id": { + "type": "Identifier", + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"a"}, + "name": "a" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "ArrayPattern", + "start":11,"end":31,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":31}}, + "elements": [ + { + "type": "Identifier", + "start":13,"end":20,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":20},"identifierName":"option1"}, + "name": "option1" + }, + { + "type": "Identifier", + "start":22,"end":29,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":29},"identifierName":"option2"}, + "name": "option2" + } + ] + } + ], + "body": { + "type": "BlockStatement", + "start":33,"end":52,"loc":{"start":{"line":1,"column":33},"end":{"line":3,"column":1}}, + "body": [], + "directives": [ + { + "type": "Directive", + "start":37,"end":50,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":15}}, + "value": { + "type": "DirectiveLiteral", + "start":37,"end":49,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":14}}, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/arrow-function-concise-body/output.json b/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/arrow-function-concise-body/output.json index 132794e78364..ef61ee97f3d1 100644 --- a/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/arrow-function-concise-body/output.json +++ b/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/arrow-function-concise-body/output.json @@ -1,162 +1,49 @@ { "type": "File", - "start": 0, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, "program": { "type": "Program", - "start": 0, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":4,"end":33,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":33}}, "id": { "type": "Identifier", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "a" - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"a"}, "name": "a" }, "init": { "type": "ArrowFunctionExpression", - "start": 8, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":8,"end":33,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":33}}, "id": null, "generator": false, "async": false, "params": [ { "type": "AssignmentPattern", - "start": 9, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":9,"end":21,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":21}}, "left": { "type": "Identifier", - "start": 9, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 16 - }, - "identifierName": "options" - }, + "start":9,"end":16,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":16},"identifierName":"options"}, "name": "options" }, "right": { "type": "ObjectExpression", - "start": 19, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":19,"end":21,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":21}}, "properties": [] } } ], "body": { "type": "Identifier", - "start": 26, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 33 - }, - "identifierName": "options" - }, + "start":26,"end":33,"loc":{"start":{"line":1,"column":26},"end":{"line":1,"column":33},"identifierName":"options"}, "name": "options" } } diff --git a/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/arrow-function/options.json b/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/arrow-function/options.json deleted file mode 100644 index 089b542c3704..000000000000 --- a/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/arrow-function/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Illegal 'use strict' directive in function with non-simple parameter list (1:8)" -} diff --git a/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/arrow-function/output.json b/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/arrow-function/output.json new file mode 100644 index 000000000000..e10dbf8aa28a --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/arrow-function/output.json @@ -0,0 +1,75 @@ +{ + "type": "File", + "start":0,"end":46,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":2}}, + "errors": [ + "SyntaxError: Illegal 'use strict' directive in function with non-simple parameter list (1:8)" + ], + "program": { + "type": "Program", + "start":0,"end":46,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":2}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start":0,"end":46,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":2}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":4,"end":45,"loc":{"start":{"line":1,"column":4},"end":{"line":3,"column":1}}, + "id": { + "type": "Identifier", + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"a"}, + "name": "a" + }, + "init": { + "type": "ArrowFunctionExpression", + "start":8,"end":45,"loc":{"start":{"line":1,"column":8},"end":{"line":3,"column":1}}, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "AssignmentPattern", + "start":9,"end":21,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":21}}, + "left": { + "type": "Identifier", + "start":9,"end":16,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":16},"identifierName":"options"}, + "name": "options" + }, + "right": { + "type": "ObjectExpression", + "start":19,"end":21,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":21}}, + "properties": [] + } + } + ], + "body": { + "type": "BlockStatement", + "start":26,"end":45,"loc":{"start":{"line":1,"column":26},"end":{"line":3,"column":1}}, + "body": [], + "directives": [ + { + "type": "Directive", + "start":30,"end":43,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":15}}, + "value": { + "type": "DirectiveLiteral", + "start":30,"end":42,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":14}}, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } + } + } + ], + "kind": "var" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/async-arrow-function-after-binary-operator/input.js b/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/async-arrow-function-after-binary-operator/input.js new file mode 100644 index 000000000000..4479b00e3d8a --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/async-arrow-function-after-binary-operator/input.js @@ -0,0 +1 @@ +3 + async() => 2 \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/async-arrow-function-after-binary-operator/options.json b/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/async-arrow-function-after-binary-operator/options.json new file mode 100644 index 000000000000..f6781c9d58a8 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/async-arrow-function-after-binary-operator/options.json @@ -0,0 +1,3 @@ +{ + "throws": "Unexpected token, expected \";\" (1:12)" +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/async-arrow-function-after-unary-operator/input.js b/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/async-arrow-function-after-unary-operator/input.js new file mode 100644 index 000000000000..8d94561ad9b2 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/async-arrow-function-after-unary-operator/input.js @@ -0,0 +1 @@ +delete async () => 3; \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/async-arrow-function-after-unary-operator/options.json b/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/async-arrow-function-after-unary-operator/options.json new file mode 100644 index 000000000000..715f71e32a2e --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/async-arrow-function-after-unary-operator/options.json @@ -0,0 +1,3 @@ +{ + "throws": "Unexpected token, expected \";\" (1:16)" +} diff --git a/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/async-arrow-function-concise-body/output.json b/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/async-arrow-function-concise-body/output.json index c31ea27b02dd..12dd6b193f53 100644 --- a/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/async-arrow-function-concise-body/output.json +++ b/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/async-arrow-function-concise-body/output.json @@ -1,162 +1,49 @@ { "type": "File", - "start": 0, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 40 - } - }, + "start":0,"end":40,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":40}}, "program": { "type": "Program", - "start": 0, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 40 - } - }, + "start":0,"end":40,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":40}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 40 - } - }, + "start":0,"end":40,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":40}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 39 - } - }, + "start":4,"end":39,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":39}}, "id": { "type": "Identifier", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "a" - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"a"}, "name": "a" }, "init": { "type": "ArrowFunctionExpression", - "start": 8, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 39 - } - }, + "start":8,"end":39,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":39}}, "id": null, "generator": false, "async": true, "params": [ { "type": "AssignmentPattern", - "start": 15, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":15,"end":27,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":27}}, "left": { "type": "Identifier", - "start": 15, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 22 - }, - "identifierName": "options" - }, + "start":15,"end":22,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":22},"identifierName":"options"}, "name": "options" }, "right": { "type": "ObjectExpression", - "start": 25, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":25,"end":27,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":27}}, "properties": [] } } ], "body": { "type": "Identifier", - "start": 32, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 32 - }, - "end": { - "line": 1, - "column": 39 - }, - "identifierName": "options" - }, + "start":32,"end":39,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":39},"identifierName":"options"}, "name": "options" } } diff --git a/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/async-arrow-function/options.json b/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/async-arrow-function/options.json deleted file mode 100644 index 089b542c3704..000000000000 --- a/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/async-arrow-function/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Illegal 'use strict' directive in function with non-simple parameter list (1:8)" -} diff --git a/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/async-arrow-function/output.json b/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/async-arrow-function/output.json new file mode 100644 index 000000000000..2b90608b4c2a --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/async-arrow-function/output.json @@ -0,0 +1,75 @@ +{ + "type": "File", + "start":0,"end":52,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":2}}, + "errors": [ + "SyntaxError: Illegal 'use strict' directive in function with non-simple parameter list (1:8)" + ], + "program": { + "type": "Program", + "start":0,"end":52,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":2}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start":0,"end":52,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":2}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":4,"end":51,"loc":{"start":{"line":1,"column":4},"end":{"line":3,"column":1}}, + "id": { + "type": "Identifier", + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"a"}, + "name": "a" + }, + "init": { + "type": "ArrowFunctionExpression", + "start":8,"end":51,"loc":{"start":{"line":1,"column":8},"end":{"line":3,"column":1}}, + "id": null, + "generator": false, + "async": true, + "params": [ + { + "type": "AssignmentPattern", + "start":15,"end":27,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":27}}, + "left": { + "type": "Identifier", + "start":15,"end":22,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":22},"identifierName":"options"}, + "name": "options" + }, + "right": { + "type": "ObjectExpression", + "start":25,"end":27,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":27}}, + "properties": [] + } + } + ], + "body": { + "type": "BlockStatement", + "start":32,"end":51,"loc":{"start":{"line":1,"column":32},"end":{"line":3,"column":1}}, + "body": [], + "directives": [ + { + "type": "Directive", + "start":36,"end":49,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":15}}, + "value": { + "type": "DirectiveLiteral", + "start":36,"end":48,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":14}}, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } + } + } + ], + "kind": "var" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/async-function/options.json b/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/async-function/options.json deleted file mode 100644 index 12b18792fcc4..000000000000 --- a/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/async-function/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Illegal 'use strict' directive in function with non-simple parameter list (1:0)" -} diff --git a/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/async-function/output.json b/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/async-function/output.json new file mode 100644 index 000000000000..7e82b95fea8c --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/async-function/output.json @@ -0,0 +1,63 @@ +{ + "type": "File", + "start":0,"end":50,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "errors": [ + "SyntaxError: Illegal 'use strict' directive in function with non-simple parameter list (1:0)" + ], + "program": { + "type": "Program", + "start":0,"end":50,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":50,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "id": { + "type": "Identifier", + "start":15,"end":16,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":16},"identifierName":"a"}, + "name": "a" + }, + "generator": false, + "async": true, + "params": [ + { + "type": "AssignmentPattern", + "start":17,"end":29,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":29}}, + "left": { + "type": "Identifier", + "start":17,"end":24,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":24},"identifierName":"options"}, + "name": "options" + }, + "right": { + "type": "ObjectExpression", + "start":27,"end":29,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":29}}, + "properties": [] + } + } + ], + "body": { + "type": "BlockStatement", + "start":31,"end":50,"loc":{"start":{"line":1,"column":31},"end":{"line":3,"column":1}}, + "body": [], + "directives": [ + { + "type": "Directive", + "start":35,"end":48,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":15}}, + "value": { + "type": "DirectiveLiteral", + "start":35,"end":47,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":14}}, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/default/options.json b/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/default/options.json deleted file mode 100644 index 12b18792fcc4..000000000000 --- a/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/default/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Illegal 'use strict' directive in function with non-simple parameter list (1:0)" -} diff --git a/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/default/output.json b/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/default/output.json new file mode 100644 index 000000000000..f07a72ed5d2f --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/default/output.json @@ -0,0 +1,63 @@ +{ + "type": "File", + "start":0,"end":44,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "errors": [ + "SyntaxError: Illegal 'use strict' directive in function with non-simple parameter list (1:0)" + ], + "program": { + "type": "Program", + "start":0,"end":44,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":44,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "id": { + "type": "Identifier", + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"a"}, + "name": "a" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "AssignmentPattern", + "start":11,"end":23,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":23}}, + "left": { + "type": "Identifier", + "start":11,"end":18,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":18},"identifierName":"options"}, + "name": "options" + }, + "right": { + "type": "ObjectExpression", + "start":21,"end":23,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":23}}, + "properties": [] + } + } + ], + "body": { + "type": "BlockStatement", + "start":25,"end":44,"loc":{"start":{"line":1,"column":25},"end":{"line":3,"column":1}}, + "body": [], + "directives": [ + { + "type": "Directive", + "start":29,"end":42,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":15}}, + "value": { + "type": "DirectiveLiteral", + "start":29,"end":41,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":14}}, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/generator-function/options.json b/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/generator-function/options.json deleted file mode 100644 index 12b18792fcc4..000000000000 --- a/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/generator-function/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Illegal 'use strict' directive in function with non-simple parameter list (1:0)" -} diff --git a/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/generator-function/output.json b/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/generator-function/output.json new file mode 100644 index 000000000000..a75e2062efad --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/generator-function/output.json @@ -0,0 +1,63 @@ +{ + "type": "File", + "start":0,"end":45,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "errors": [ + "SyntaxError: Illegal 'use strict' directive in function with non-simple parameter list (1:0)" + ], + "program": { + "type": "Program", + "start":0,"end":45,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":45,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "id": { + "type": "Identifier", + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11},"identifierName":"a"}, + "name": "a" + }, + "generator": true, + "async": false, + "params": [ + { + "type": "AssignmentPattern", + "start":12,"end":24,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":24}}, + "left": { + "type": "Identifier", + "start":12,"end":19,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":19},"identifierName":"options"}, + "name": "options" + }, + "right": { + "type": "ObjectExpression", + "start":22,"end":24,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":24}}, + "properties": [] + } + } + ], + "body": { + "type": "BlockStatement", + "start":26,"end":45,"loc":{"start":{"line":1,"column":26},"end":{"line":3,"column":1}}, + "body": [], + "directives": [ + { + "type": "Directive", + "start":30,"end":43,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":15}}, + "value": { + "type": "DirectiveLiteral", + "start":30,"end":42,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":14}}, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/generator-method/options.json b/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/generator-method/options.json deleted file mode 100644 index 9908b496fd2a..000000000000 --- a/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/generator-method/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Illegal 'use strict' directive in function with non-simple parameter list (2:5)" -} diff --git a/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/generator-method/output.json b/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/generator-method/output.json new file mode 100644 index 000000000000..2838eba94dbe --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/generator-method/output.json @@ -0,0 +1,89 @@ +{ + "type": "File", + "start":0,"end":58,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":2}}, + "errors": [ + "SyntaxError: Illegal 'use strict' directive in function with non-simple parameter list (2:5)" + ], + "program": { + "type": "Program", + "start":0,"end":58,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":2}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start":0,"end":58,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":2}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":4,"end":57,"loc":{"start":{"line":1,"column":4},"end":{"line":5,"column":1}}, + "id": { + "type": "Identifier", + "start":4,"end":7,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":7},"identifierName":"obj"}, + "name": "obj" + }, + "init": { + "type": "ObjectExpression", + "start":10,"end":57,"loc":{"start":{"line":1,"column":10},"end":{"line":5,"column":1}}, + "properties": [ + { + "type": "ObjectMethod", + "start":14,"end":55,"loc":{"start":{"line":2,"column":2},"end":{"line":4,"column":3}}, + "method": true, + "key": { + "type": "Identifier", + "start":16,"end":17,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":5},"identifierName":"a"}, + "name": "a" + }, + "computed": false, + "kind": "method", + "id": null, + "generator": true, + "async": false, + "params": [ + { + "type": "AssignmentPattern", + "start":18,"end":30,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":18}}, + "left": { + "type": "Identifier", + "start":18,"end":25,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":13},"identifierName":"options"}, + "name": "options" + }, + "right": { + "type": "ObjectExpression", + "start":28,"end":30,"loc":{"start":{"line":2,"column":16},"end":{"line":2,"column":18}}, + "properties": [] + } + } + ], + "body": { + "type": "BlockStatement", + "start":32,"end":55,"loc":{"start":{"line":2,"column":20},"end":{"line":4,"column":3}}, + "body": [], + "directives": [ + { + "type": "Directive", + "start":38,"end":51,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":17}}, + "value": { + "type": "DirectiveLiteral", + "start":38,"end":50,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":16}}, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } + } + ] + } + } + ], + "kind": "var" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/method/options.json b/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/method/options.json deleted file mode 100644 index 5d0e394f2b9d..000000000000 --- a/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/method/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Illegal 'use strict' directive in function with non-simple parameter list (2:3)" -} diff --git a/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/method/output.json b/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/method/output.json new file mode 100644 index 000000000000..496683da2364 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/method/output.json @@ -0,0 +1,89 @@ +{ + "type": "File", + "start":0,"end":56,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":2}}, + "errors": [ + "SyntaxError: Illegal 'use strict' directive in function with non-simple parameter list (2:3)" + ], + "program": { + "type": "Program", + "start":0,"end":56,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":2}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start":0,"end":56,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":2}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":4,"end":55,"loc":{"start":{"line":1,"column":4},"end":{"line":5,"column":1}}, + "id": { + "type": "Identifier", + "start":4,"end":7,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":7},"identifierName":"obj"}, + "name": "obj" + }, + "init": { + "type": "ObjectExpression", + "start":10,"end":55,"loc":{"start":{"line":1,"column":10},"end":{"line":5,"column":1}}, + "properties": [ + { + "type": "ObjectMethod", + "start":14,"end":53,"loc":{"start":{"line":2,"column":2},"end":{"line":4,"column":3}}, + "method": true, + "key": { + "type": "Identifier", + "start":14,"end":15,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":3},"identifierName":"a"}, + "name": "a" + }, + "computed": false, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "AssignmentPattern", + "start":16,"end":28,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":16}}, + "left": { + "type": "Identifier", + "start":16,"end":23,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":11},"identifierName":"options"}, + "name": "options" + }, + "right": { + "type": "ObjectExpression", + "start":26,"end":28,"loc":{"start":{"line":2,"column":14},"end":{"line":2,"column":16}}, + "properties": [] + } + } + ], + "body": { + "type": "BlockStatement", + "start":30,"end":53,"loc":{"start":{"line":2,"column":18},"end":{"line":4,"column":3}}, + "body": [], + "directives": [ + { + "type": "Directive", + "start":36,"end":49,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":17}}, + "value": { + "type": "DirectiveLiteral", + "start":36,"end":48,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":16}}, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } + } + ] + } + } + ], + "kind": "var" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/object-pattern-default/options.json b/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/object-pattern-default/options.json deleted file mode 100644 index 12b18792fcc4..000000000000 --- a/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/object-pattern-default/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Illegal 'use strict' directive in function with non-simple parameter list (1:0)" -} diff --git a/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/object-pattern-default/output.json b/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/object-pattern-default/output.json new file mode 100644 index 000000000000..ce4565e35ae4 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/object-pattern-default/output.json @@ -0,0 +1,104 @@ +{ + "type": "File", + "start":0,"end":57,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "errors": [ + "SyntaxError: Illegal 'use strict' directive in function with non-simple parameter list (1:0)" + ], + "program": { + "type": "Program", + "start":0,"end":57,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":57,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "id": { + "type": "Identifier", + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"a"}, + "name": "a" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "AssignmentPattern", + "start":11,"end":36,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":36}}, + "left": { + "type": "ObjectPattern", + "start":11,"end":31,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":31}}, + "properties": [ + { + "type": "ObjectProperty", + "start":13,"end":20,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":20}}, + "method": false, + "key": { + "type": "Identifier", + "start":13,"end":20,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":20},"identifierName":"option1"}, + "name": "option1" + }, + "computed": false, + "shorthand": true, + "value": { + "type": "Identifier", + "start":13,"end":20,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":20},"identifierName":"option1"}, + "name": "option1" + }, + "extra": { + "shorthand": true + } + }, + { + "type": "ObjectProperty", + "start":22,"end":29,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":29}}, + "method": false, + "key": { + "type": "Identifier", + "start":22,"end":29,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":29},"identifierName":"option2"}, + "name": "option2" + }, + "computed": false, + "shorthand": true, + "value": { + "type": "Identifier", + "start":22,"end":29,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":29},"identifierName":"option2"}, + "name": "option2" + }, + "extra": { + "shorthand": true + } + } + ] + }, + "right": { + "type": "ObjectExpression", + "start":34,"end":36,"loc":{"start":{"line":1,"column":34},"end":{"line":1,"column":36}}, + "properties": [] + } + } + ], + "body": { + "type": "BlockStatement", + "start":38,"end":57,"loc":{"start":{"line":1,"column":38},"end":{"line":3,"column":1}}, + "body": [], + "directives": [ + { + "type": "Directive", + "start":42,"end":55,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":15}}, + "value": { + "type": "DirectiveLiteral", + "start":42,"end":54,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":14}}, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/object-pattern/options.json b/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/object-pattern/options.json deleted file mode 100644 index 12b18792fcc4..000000000000 --- a/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/object-pattern/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Illegal 'use strict' directive in function with non-simple parameter list (1:0)" -} diff --git a/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/object-pattern/output.json b/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/object-pattern/output.json new file mode 100644 index 000000000000..c51370c9d607 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/object-pattern/output.json @@ -0,0 +1,95 @@ +{ + "type": "File", + "start":0,"end":52,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "errors": [ + "SyntaxError: Illegal 'use strict' directive in function with non-simple parameter list (1:0)" + ], + "program": { + "type": "Program", + "start":0,"end":52,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":52,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "id": { + "type": "Identifier", + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"a"}, + "name": "a" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "ObjectPattern", + "start":11,"end":31,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":31}}, + "properties": [ + { + "type": "ObjectProperty", + "start":13,"end":20,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":20}}, + "method": false, + "key": { + "type": "Identifier", + "start":13,"end":20,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":20},"identifierName":"option1"}, + "name": "option1" + }, + "computed": false, + "shorthand": true, + "value": { + "type": "Identifier", + "start":13,"end":20,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":20},"identifierName":"option1"}, + "name": "option1" + }, + "extra": { + "shorthand": true + } + }, + { + "type": "ObjectProperty", + "start":22,"end":29,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":29}}, + "method": false, + "key": { + "type": "Identifier", + "start":22,"end":29,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":29},"identifierName":"option2"}, + "name": "option2" + }, + "computed": false, + "shorthand": true, + "value": { + "type": "Identifier", + "start":22,"end":29,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":29},"identifierName":"option2"}, + "name": "option2" + }, + "extra": { + "shorthand": true + } + } + ] + } + ], + "body": { + "type": "BlockStatement", + "start":33,"end":52,"loc":{"start":{"line":1,"column":33},"end":{"line":3,"column":1}}, + "body": [], + "directives": [ + { + "type": "Directive", + "start":37,"end":50,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":15}}, + "value": { + "type": "DirectiveLiteral", + "start":37,"end":49,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":14}}, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/rest/options.json b/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/rest/options.json deleted file mode 100644 index 12b18792fcc4..000000000000 --- a/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/rest/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Illegal 'use strict' directive in function with non-simple parameter list (1:0)" -} diff --git a/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/rest/output.json b/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/rest/output.json new file mode 100644 index 000000000000..6287e339526c --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/rest/output.json @@ -0,0 +1,58 @@ +{ + "type": "File", + "start":0,"end":42,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "errors": [ + "SyntaxError: Illegal 'use strict' directive in function with non-simple parameter list (1:0)" + ], + "program": { + "type": "Program", + "start":0,"end":42,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":42,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "id": { + "type": "Identifier", + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"a"}, + "name": "a" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "RestElement", + "start":11,"end":21,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":21}}, + "argument": { + "type": "Identifier", + "start":14,"end":21,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":21},"identifierName":"options"}, + "name": "options" + } + } + ], + "body": { + "type": "BlockStatement", + "start":23,"end":42,"loc":{"start":{"line":1,"column":23},"end":{"line":3,"column":1}}, + "body": [], + "directives": [ + { + "type": "Directive", + "start":27,"end":40,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":15}}, + "value": { + "type": "DirectiveLiteral", + "start":27,"end":39,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":14}}, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/1/output.json b/packages/babel-parser/test/fixtures/es2017/async-functions/1/output.json index 597fa90b29cb..e6c4610e6d25 100644 --- a/packages/babel-parser/test/fixtures/es2017/async-functions/1/output.json +++ b/packages/babel-parser/test/fixtures/es2017/async-functions/1/output.json @@ -1,80 +1,25 @@ { "type": "File", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "program": { "type": "Program", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "expression": { "type": "ArrowFunctionExpression", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "id": null, "generator": false, "async": true, "params": [], "body": { "type": "BlockStatement", - "start": 12, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":12,"end":14,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":14}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/11/output.json b/packages/babel-parser/test/fixtures/es2017/async-functions/11/output.json index 50562955365c..441aa474112e 100644 --- a/packages/babel-parser/test/fixtures/es2017/async-functions/11/output.json +++ b/packages/babel-parser/test/fixtures/es2017/async-functions/11/output.json @@ -1,95 +1,27 @@ { "type": "File", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 17 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":17}}, "program": { "type": "Program", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 17 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":17}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "expression": { "type": "Identifier", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "async" - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5},"identifierName":"async"}, "name": "async" } }, { "type": "FunctionDeclaration", - "start": 6, - "end": 23, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 17 - } - }, + "start":6,"end":23,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":17}}, "id": { "type": "Identifier", - "start": 15, - "end": 18, - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 12 - }, - "identifierName": "foo" - }, + "start":15,"end":18,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":12},"identifierName":"foo"}, "name": "foo" }, "generator": false, @@ -97,18 +29,7 @@ "params": [], "body": { "type": "BlockStatement", - "start": 21, - "end": 23, - "loc": { - "start": { - "line": 2, - "column": 15 - }, - "end": { - "line": 2, - "column": 17 - } - }, + "start":21,"end":23,"loc":{"start":{"line":2,"column":15},"end":{"line":2,"column":17}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/12/output.json b/packages/babel-parser/test/fixtures/es2017/async-functions/12/output.json index 56efca553c6a..f6a637bb56b6 100644 --- a/packages/babel-parser/test/fixtures/es2017/async-functions/12/output.json +++ b/packages/babel-parser/test/fixtures/es2017/async-functions/12/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 46, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 46 - } - }, + "start":0,"end":46,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":46}}, "program": { "type": "Program", - "start": 0, - "end": 46, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 46 - } - }, + "start":0,"end":46,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":46}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 46, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 46 - } - }, + "start":0,"end":46,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":46}}, "id": { "type": "Identifier", - "start": 15, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 18 - }, - "identifierName": "foo" - }, + "start":15,"end":18,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":18},"identifierName":"foo"}, "name": "foo" }, "generator": false, @@ -65,80 +20,23 @@ "params": [ { "type": "Identifier", - "start": 19, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 26 - }, - "identifierName": "promise" - }, + "start":19,"end":26,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":26},"identifierName":"promise"}, "name": "promise" } ], "body": { "type": "BlockStatement", - "start": 28, - "end": 46, - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 46 - } - }, + "start":28,"end":46,"loc":{"start":{"line":1,"column":28},"end":{"line":1,"column":46}}, "body": [ { "type": "ExpressionStatement", - "start": 30, - "end": 44, - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 1, - "column": 44 - } - }, + "start":30,"end":44,"loc":{"start":{"line":1,"column":30},"end":{"line":1,"column":44}}, "expression": { "type": "AwaitExpression", - "start": 30, - "end": 43, - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 1, - "column": 43 - } - }, + "start":30,"end":43,"loc":{"start":{"line":1,"column":30},"end":{"line":1,"column":43}}, "argument": { "type": "Identifier", - "start": 36, - "end": 43, - "loc": { - "start": { - "line": 1, - "column": 36 - }, - "end": { - "line": 1, - "column": 43 - }, - "identifierName": "promise" - }, + "start":36,"end":43,"loc":{"start":{"line":1,"column":36},"end":{"line":1,"column":43},"identifierName":"promise"}, "name": "promise" } } diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/13/output.json b/packages/babel-parser/test/fixtures/es2017/async-functions/13/output.json index dca847dd4673..c0d40ca4f455 100644 --- a/packages/babel-parser/test/fixtures/es2017/async-functions/13/output.json +++ b/packages/babel-parser/test/fixtures/es2017/async-functions/13/output.json @@ -1,128 +1,38 @@ { "type": "File", - "start": 0, - "end": 52, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 52 - } - }, + "start":0,"end":52,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":52}}, "program": { "type": "Program", - "start": 0, - "end": 52, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 52 - } - }, + "start":0,"end":52,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":52}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 52, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 52 - } - }, + "start":0,"end":52,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":52}}, "expression": { "type": "FunctionExpression", - "start": 1, - "end": 51, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 51 - } - }, + "start":1,"end":51,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":51}}, "id": null, "generator": false, "async": false, "params": [ { "type": "Identifier", - "start": 10, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "x" - }, + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11},"identifierName":"x"}, "name": "x" } ], "body": { "type": "BlockStatement", - "start": 13, - "end": 51, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 51 - } - }, + "start":13,"end":51,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":51}}, "body": [ { "type": "FunctionDeclaration", - "start": 15, - "end": 49, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 49 - } - }, + "start":15,"end":49,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":49}}, "id": { "type": "Identifier", - "start": 30, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 1, - "column": 35 - }, - "identifierName": "inner" - }, + "start":30,"end":35,"loc":{"start":{"line":1,"column":30},"end":{"line":1,"column":35},"identifierName":"inner"}, "name": "inner" }, "generator": false, @@ -130,62 +40,17 @@ "params": [], "body": { "type": "BlockStatement", - "start": 38, - "end": 49, - "loc": { - "start": { - "line": 1, - "column": 38 - }, - "end": { - "line": 1, - "column": 49 - } - }, + "start":38,"end":49,"loc":{"start":{"line":1,"column":38},"end":{"line":1,"column":49}}, "body": [ { "type": "ExpressionStatement", - "start": 40, - "end": 47, - "loc": { - "start": { - "line": 1, - "column": 40 - }, - "end": { - "line": 1, - "column": 47 - } - }, + "start":40,"end":47,"loc":{"start":{"line":1,"column":40},"end":{"line":1,"column":47}}, "expression": { "type": "AwaitExpression", - "start": 40, - "end": 47, - "loc": { - "start": { - "line": 1, - "column": 40 - }, - "end": { - "line": 1, - "column": 47 - } - }, + "start":40,"end":47,"loc":{"start":{"line":1,"column":40},"end":{"line":1,"column":47}}, "argument": { "type": "Identifier", - "start": 46, - "end": 47, - "loc": { - "start": { - "line": 1, - "column": 46 - }, - "end": { - "line": 1, - "column": 47 - }, - "identifierName": "x" - }, + "start":46,"end":47,"loc":{"start":{"line":1,"column":46},"end":{"line":1,"column":47},"identifierName":"x"}, "name": "x" } } diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/14/output.json b/packages/babel-parser/test/fixtures/es2017/async-functions/14/output.json index 7105d5ba25b9..edb18cfcdfc1 100644 --- a/packages/babel-parser/test/fixtures/es2017/async-functions/14/output.json +++ b/packages/babel-parser/test/fixtures/es2017/async-functions/14/output.json @@ -1,174 +1,50 @@ { "type": "File", - "start": 0, - "end": 52, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 52 - } - }, + "start":0,"end":52,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":52}}, "program": { "type": "Program", - "start": 0, - "end": 52, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 52 - } - }, + "start":0,"end":52,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":52}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 52, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 52 - } - }, + "start":0,"end":52,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":52}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 52, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 52 - } - }, + "start":4,"end":52,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":52}}, "id": { "type": "Identifier", - "start": 4, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "foo" - }, + "start":4,"end":7,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":7},"identifierName":"foo"}, "name": "foo" }, "init": { "type": "FunctionExpression", - "start": 10, - "end": 52, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 52 - } - }, + "start":10,"end":52,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":52}}, "id": null, "generator": false, "async": true, "params": [ { "type": "Identifier", - "start": 25, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 32 - }, - "identifierName": "promise" - }, + "start":25,"end":32,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":32},"identifierName":"promise"}, "name": "promise" } ], "body": { "type": "BlockStatement", - "start": 34, - "end": 52, - "loc": { - "start": { - "line": 1, - "column": 34 - }, - "end": { - "line": 1, - "column": 52 - } - }, + "start":34,"end":52,"loc":{"start":{"line":1,"column":34},"end":{"line":1,"column":52}}, "body": [ { "type": "ExpressionStatement", - "start": 36, - "end": 50, - "loc": { - "start": { - "line": 1, - "column": 36 - }, - "end": { - "line": 1, - "column": 50 - } - }, + "start":36,"end":50,"loc":{"start":{"line":1,"column":36},"end":{"line":1,"column":50}}, "expression": { "type": "AwaitExpression", - "start": 36, - "end": 49, - "loc": { - "start": { - "line": 1, - "column": 36 - }, - "end": { - "line": 1, - "column": 49 - } - }, + "start":36,"end":49,"loc":{"start":{"line":1,"column":36},"end":{"line":1,"column":49}}, "argument": { "type": "Identifier", - "start": 42, - "end": 49, - "loc": { - "start": { - "line": 1, - "column": 42 - }, - "end": { - "line": 1, - "column": 49 - }, - "identifierName": "promise" - }, + "start":42,"end":49,"loc":{"start":{"line":1,"column":42},"end":{"line":1,"column":49},"identifierName":"promise"}, "name": "promise" } } diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/15/output.json b/packages/babel-parser/test/fixtures/es2017/async-functions/15/output.json index 429d56963cb7..adaa351c6cd1 100644 --- a/packages/babel-parser/test/fixtures/es2017/async-functions/15/output.json +++ b/packages/babel-parser/test/fixtures/es2017/async-functions/15/output.json @@ -1,143 +1,42 @@ { "type": "File", - "start": 0, - "end": 54, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 54 - } - }, + "start":0,"end":54,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":54}}, "program": { "type": "Program", - "start": 0, - "end": 54, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 54 - } - }, + "start":0,"end":54,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":54}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 54, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 54 - } - }, + "start":0,"end":54,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":54}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 54, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 54 - } - }, + "start":4,"end":54,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":54}}, "id": { "type": "Identifier", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "o" - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"o"}, "name": "o" }, "init": { "type": "ObjectExpression", - "start": 8, - "end": 54, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 54 - } - }, + "start":8,"end":54,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":54}}, "properties": [ { "type": "ObjectProperty", - "start": 10, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":10,"end":14,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":14}}, "method": false, "key": { "type": "Identifier", - "start": 10, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "a" - }, + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11},"identifierName":"a"}, "name": "a" }, "computed": false, "shorthand": false, "value": { "type": "NumericLiteral", - "start": 13, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":13,"end":14,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":14}}, "extra": { "rawValue": 1, "raw": "1" @@ -147,34 +46,11 @@ }, { "type": "ObjectMethod", - "start": 16, - "end": 52, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 52 - } - }, + "start":16,"end":52,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":52}}, "method": true, "key": { "type": "Identifier", - "start": 22, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 25 - }, - "identifierName": "foo" - }, + "start":22,"end":25,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":25},"identifierName":"foo"}, "name": "foo" }, "computed": false, @@ -185,80 +61,23 @@ "params": [ { "type": "Identifier", - "start": 26, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 33 - }, - "identifierName": "promise" - }, + "start":26,"end":33,"loc":{"start":{"line":1,"column":26},"end":{"line":1,"column":33},"identifierName":"promise"}, "name": "promise" } ], "body": { "type": "BlockStatement", - "start": 35, - "end": 52, - "loc": { - "start": { - "line": 1, - "column": 35 - }, - "end": { - "line": 1, - "column": 52 - } - }, + "start":35,"end":52,"loc":{"start":{"line":1,"column":35},"end":{"line":1,"column":52}}, "body": [ { "type": "ExpressionStatement", - "start": 37, - "end": 50, - "loc": { - "start": { - "line": 1, - "column": 37 - }, - "end": { - "line": 1, - "column": 50 - } - }, + "start":37,"end":50,"loc":{"start":{"line":1,"column":37},"end":{"line":1,"column":50}}, "expression": { "type": "AwaitExpression", - "start": 37, - "end": 50, - "loc": { - "start": { - "line": 1, - "column": 37 - }, - "end": { - "line": 1, - "column": 50 - } - }, + "start":37,"end":50,"loc":{"start":{"line":1,"column":37},"end":{"line":1,"column":50}}, "argument": { "type": "Identifier", - "start": 43, - "end": 50, - "loc": { - "start": { - "line": 1, - "column": 43 - }, - "end": { - "line": 1, - "column": 50 - }, - "identifierName": "promise" - }, + "start":43,"end":50,"loc":{"start":{"line":1,"column":43},"end":{"line":1,"column":50},"identifierName":"promise"}, "name": "promise" } } diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/16/output.json b/packages/babel-parser/test/fixtures/es2017/async-functions/16/output.json index 3cc1f0503cbf..2c00d1043906 100644 --- a/packages/babel-parser/test/fixtures/es2017/async-functions/16/output.json +++ b/packages/babel-parser/test/fixtures/es2017/async-functions/16/output.json @@ -1,111 +1,32 @@ { "type": "File", - "start": 0, - "end": 50, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 50 - } - }, + "start":0,"end":50,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":50}}, "program": { "type": "Program", - "start": 0, - "end": 50, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 50 - } - }, + "start":0,"end":50,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":50}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 50, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 50 - } - }, + "start":0,"end":50,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":50}}, "id": { "type": "Identifier", - "start": 6, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "Foo" - }, + "start":6,"end":9,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":9},"identifierName":"Foo"}, "name": "Foo" }, "superClass": null, "body": { "type": "ClassBody", - "start": 10, - "end": 50, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 50 - } - }, + "start":10,"end":50,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":50}}, "body": [ { "type": "ClassMethod", - "start": 12, - "end": 48, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 48 - } - }, + "start":12,"end":48,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":48}}, "static": false, "key": { "type": "Identifier", - "start": 18, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 21 - }, - "identifierName": "bar" - }, + "start":18,"end":21,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":21},"identifierName":"bar"}, "name": "bar" }, "computed": false, @@ -116,80 +37,23 @@ "params": [ { "type": "Identifier", - "start": 22, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 29 - }, - "identifierName": "promise" - }, + "start":22,"end":29,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":29},"identifierName":"promise"}, "name": "promise" } ], "body": { "type": "BlockStatement", - "start": 31, - "end": 48, - "loc": { - "start": { - "line": 1, - "column": 31 - }, - "end": { - "line": 1, - "column": 48 - } - }, + "start":31,"end":48,"loc":{"start":{"line":1,"column":31},"end":{"line":1,"column":48}}, "body": [ { "type": "ExpressionStatement", - "start": 33, - "end": 46, - "loc": { - "start": { - "line": 1, - "column": 33 - }, - "end": { - "line": 1, - "column": 46 - } - }, + "start":33,"end":46,"loc":{"start":{"line":1,"column":33},"end":{"line":1,"column":46}}, "expression": { "type": "AwaitExpression", - "start": 33, - "end": 46, - "loc": { - "start": { - "line": 1, - "column": 33 - }, - "end": { - "line": 1, - "column": 46 - } - }, + "start":33,"end":46,"loc":{"start":{"line":1,"column":33},"end":{"line":1,"column":46}}, "argument": { "type": "Identifier", - "start": 39, - "end": 46, - "loc": { - "start": { - "line": 1, - "column": 39 - }, - "end": { - "line": 1, - "column": 46 - }, - "identifierName": "promise" - }, + "start":39,"end":46,"loc":{"start":{"line":1,"column":39},"end":{"line":1,"column":46},"identifierName":"promise"}, "name": "promise" } } diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/17/output.json b/packages/babel-parser/test/fixtures/es2017/async-functions/17/output.json index 5f917cbbc080..c80804bc9eae 100644 --- a/packages/babel-parser/test/fixtures/es2017/async-functions/17/output.json +++ b/packages/babel-parser/test/fixtures/es2017/async-functions/17/output.json @@ -1,162 +1,48 @@ { "type": "File", - "start": 0, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, "program": { "type": "Program", - "start": 0, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, "expression": { "type": "CallExpression", - "start": 0, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, "callee": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "f" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"f"}, "name": "f" }, "arguments": [ { "type": "Identifier", - "start": 2, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 3 - }, - "identifierName": "a" - }, + "start":2,"end":3,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":3},"identifierName":"a"}, "name": "a" }, { "type": "ArrowFunctionExpression", - "start": 5, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":5,"end":35,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":35}}, "id": null, "generator": false, "async": true, "params": [ { "type": "Identifier", - "start": 11, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 18 - }, - "identifierName": "promise" - }, + "start":11,"end":18,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":18},"identifierName":"promise"}, "name": "promise" } ], "body": { "type": "AwaitExpression", - "start": 22, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":22,"end":35,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":35}}, "argument": { "type": "Identifier", - "start": 28, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 35 - }, - "identifierName": "promise" - }, + "start":28,"end":35,"loc":{"start":{"line":1,"column":28},"end":{"line":1,"column":35},"identifierName":"promise"}, "name": "promise" } } diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/18/output.json b/packages/babel-parser/test/fixtures/es2017/async-functions/18/output.json index 26729dfbbe24..129b29306dce 100644 --- a/packages/babel-parser/test/fixtures/es2017/async-functions/18/output.json +++ b/packages/babel-parser/test/fixtures/es2017/async-functions/18/output.json @@ -1,174 +1,50 @@ { "type": "File", - "start": 0, - "end": 44, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 44 - } - }, + "start":0,"end":44,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":44}}, "program": { "type": "Program", - "start": 0, - "end": 44, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 44 - } - }, + "start":0,"end":44,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":44}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 44, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 44 - } - }, + "start":0,"end":44,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":44}}, "expression": { "type": "CallExpression", - "start": 0, - "end": 44, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 44 - } - }, + "start":0,"end":44,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":44}}, "callee": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "f" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"f"}, "name": "f" }, "arguments": [ { "type": "FunctionExpression", - "start": 2, - "end": 43, - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 43 - } - }, + "start":2,"end":43,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":43}}, "id": null, "generator": false, "async": true, "params": [ { "type": "Identifier", - "start": 17, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 24 - }, - "identifierName": "promise" - }, + "start":17,"end":24,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":24},"identifierName":"promise"}, "name": "promise" } ], "body": { "type": "BlockStatement", - "start": 26, - "end": 43, - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 43 - } - }, + "start":26,"end":43,"loc":{"start":{"line":1,"column":26},"end":{"line":1,"column":43}}, "body": [ { "type": "ExpressionStatement", - "start": 28, - "end": 41, - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 41 - } - }, + "start":28,"end":41,"loc":{"start":{"line":1,"column":28},"end":{"line":1,"column":41}}, "expression": { "type": "AwaitExpression", - "start": 28, - "end": 41, - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 41 - } - }, + "start":28,"end":41,"loc":{"start":{"line":1,"column":28},"end":{"line":1,"column":41}}, "argument": { "type": "Identifier", - "start": 34, - "end": 41, - "loc": { - "start": { - "line": 1, - "column": 34 - }, - "end": { - "line": 1, - "column": 41 - }, - "identifierName": "promise" - }, + "start":34,"end":41,"loc":{"start":{"line":1,"column":34},"end":{"line":1,"column":41},"identifierName":"promise"}, "name": "promise" } } diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/19/output.json b/packages/babel-parser/test/fixtures/es2017/async-functions/19/output.json index 11f837c1d2a8..715c8131b5b6 100644 --- a/packages/babel-parser/test/fixtures/es2017/async-functions/19/output.json +++ b/packages/babel-parser/test/fixtures/es2017/async-functions/19/output.json @@ -1,143 +1,41 @@ { "type": "File", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, "program": { "type": "Program", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, "expression": { "type": "CallExpression", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, "callee": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "f" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"f"}, "name": "f" }, "arguments": [ { "type": "Identifier", - "start": 2, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 3 - }, - "identifierName": "a" - }, + "start":2,"end":3,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":3},"identifierName":"a"}, "name": "a" }, { "type": "CallExpression", - "start": 5, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":5,"end":16,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":16}}, "callee": { "type": "Identifier", - "start": 5, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 10 - }, - "identifierName": "async" - }, + "start":5,"end":10,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":10},"identifierName":"async"}, "name": "async" }, "arguments": [ { "type": "NumericLiteral", - "start": 11, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":11,"end":12,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":12}}, "extra": { "rawValue": 1, "raw": "1" @@ -146,18 +44,7 @@ }, { "type": "NumericLiteral", - "start": 14, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":14,"end":15,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":15}}, "extra": { "rawValue": 2, "raw": "2" @@ -168,19 +55,7 @@ }, { "type": "Identifier", - "start": 18, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - }, - "identifierName": "b" - }, + "start":18,"end":19,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":19},"identifierName":"b"}, "name": "b" } ] diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/2/options.json b/packages/babel-parser/test/fixtures/es2017/async-functions/2/options.json deleted file mode 100644 index c6f19067ee66..000000000000 --- a/packages/babel-parser/test/fixtures/es2017/async-functions/2/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "await* has been removed from the async functions proposal. Use Promise.all() instead. (2:2)" -} diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/2/output.json b/packages/babel-parser/test/fixtures/es2017/async-functions/2/output.json new file mode 100644 index 000000000000..78391ab5a0e9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2017/async-functions/2/output.json @@ -0,0 +1,53 @@ +{ + "type": "File", + "start":0,"end":40,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "errors": [ + "SyntaxError: await* has been removed from the async functions proposal. Use Promise.all() instead. (2:2)" + ], + "program": { + "type": "Program", + "start":0,"end":40,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":40,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "id": { + "type": "Identifier", + "start":15,"end":18,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":18},"identifierName":"bar"}, + "name": "bar" + }, + "generator": false, + "async": true, + "params": [], + "body": { + "type": "BlockStatement", + "start":21,"end":40,"loc":{"start":{"line":1,"column":21},"end":{"line":3,"column":1}}, + "body": [ + { + "type": "ExpressionStatement", + "start":25,"end":38,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":15}}, + "expression": { + "type": "AwaitExpression", + "start":25,"end":37,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":14}}, + "argument": { + "type": "CallExpression", + "start":32,"end":37,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":14}}, + "callee": { + "type": "Identifier", + "start":32,"end":35,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":12},"identifierName":"foo"}, + "name": "foo" + }, + "arguments": [] + } + } + } + ], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/20/output.json b/packages/babel-parser/test/fixtures/es2017/async-functions/20/output.json index 7493b94dd090..57d50fd7b865 100644 --- a/packages/babel-parser/test/fixtures/es2017/async-functions/20/output.json +++ b/packages/babel-parser/test/fixtures/es2017/async-functions/20/output.json @@ -1,127 +1,36 @@ { "type": "File", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "program": { "type": "Program", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":4,"end":17,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":17}}, "id": { "type": "Identifier", - "start": 4, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "ok" - }, + "start":4,"end":6,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":6},"identifierName":"ok"}, "name": "ok" }, "init": { "type": "CallExpression", - "start": 9, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":9,"end":17,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":17}}, "callee": { "type": "Identifier", - "start": 9, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 14 - }, - "identifierName": "async" - }, + "start":9,"end":14,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":14},"identifierName":"async"}, "name": "async" }, "arguments": [ { "type": "Identifier", - "start": 15, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - }, - "identifierName": "x" - }, + "start":15,"end":16,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":16},"identifierName":"x"}, "name": "x" } ] diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/21/output.json b/packages/babel-parser/test/fixtures/es2017/async-functions/21/output.json index 5f3d3227166b..528d37a079de 100644 --- a/packages/babel-parser/test/fixtures/es2017/async-functions/21/output.json +++ b/packages/babel-parser/test/fixtures/es2017/async-functions/21/output.json @@ -1,125 +1,36 @@ { "type": "File", - "start": 0, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":38}}, "program": { "type": "Program", - "start": 0, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":38}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":38}}, "expression": { "type": "FunctionExpression", - "start": 1, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 37 - } - }, + "start":1,"end":37,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":37}}, "id": null, "generator": false, "async": false, "params": [], "body": { "type": "BlockStatement", - "start": 12, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 37 - } - }, + "start":12,"end":37,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":37}}, "body": [ { "type": "VariableDeclaration", - "start": 14, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":14,"end":24,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":24}}, "declarations": [ { "type": "VariableDeclarator", - "start": 18, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":18,"end":23,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":23}}, "id": { "type": "Identifier", - "start": 18, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 23 - }, - "identifierName": "async" - }, + "start":18,"end":23,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":23},"identifierName":"async"}, "name": "async" }, "init": null @@ -129,64 +40,19 @@ }, { "type": "ExpressionStatement", - "start": 25, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":25,"end":35,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":35}}, "expression": { "type": "AssignmentExpression", - "start": 25, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":25,"end":35,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":35}}, "operator": "=", "left": { "type": "Identifier", - "start": 25, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 30 - }, - "identifierName": "async" - }, + "start":25,"end":30,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":30},"identifierName":"async"}, "name": "async" }, "right": { "type": "NumericLiteral", - "start": 33, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 33 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":33,"end":35,"loc":{"start":{"line":1,"column":33},"end":{"line":1,"column":35}}, "extra": { "rawValue": 10, "raw": "10" diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/22/output.json b/packages/babel-parser/test/fixtures/es2017/async-functions/22/output.json index 762d2fceec24..63432da84dcb 100644 --- a/packages/babel-parser/test/fixtures/es2017/async-functions/22/output.json +++ b/packages/babel-parser/test/fixtures/es2017/async-functions/22/output.json @@ -1,111 +1,32 @@ { "type": "File", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, "program": { "type": "Program", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, "id": { "type": "Identifier", - "start": 6, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 10 - }, - "identifierName": "Test" - }, + "start":6,"end":10,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":10},"identifierName":"Test"}, "name": "Test" }, "superClass": null, "body": { "type": "ClassBody", - "start": 11, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":11,"end":25,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":25}}, "body": [ { "type": "ClassMethod", - "start": 13, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":13,"end":23,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":23}}, "static": false, "key": { "type": "Identifier", - "start": 13, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 18 - }, - "identifierName": "async" - }, + "start":13,"end":18,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":18},"identifierName":"async"}, "name": "async" }, "computed": false, @@ -116,18 +37,7 @@ "params": [], "body": { "type": "BlockStatement", - "start": 21, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":21,"end":23,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":23}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/23/output.json b/packages/babel-parser/test/fixtures/es2017/async-functions/23/output.json index 8f07a5227a24..ff53c76d8553 100644 --- a/packages/babel-parser/test/fixtures/es2017/async-functions/23/output.json +++ b/packages/babel-parser/test/fixtures/es2017/async-functions/23/output.json @@ -1,143 +1,42 @@ { "type": "File", - "start": 0, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, "program": { "type": "Program", - "start": 0, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":4,"end":27,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":27}}, "id": { "type": "Identifier", - "start": 4, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "obj" - }, + "start":4,"end":7,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":7},"identifierName":"obj"}, "name": "obj" }, "init": { "type": "ObjectExpression", - "start": 10, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":10,"end":27,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":27}}, "properties": [ { "type": "ObjectProperty", - "start": 12, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":12,"end":25,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":25}}, "method": false, "key": { "type": "Identifier", - "start": 12, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 17 - }, - "identifierName": "async" - }, + "start":12,"end":17,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":17},"identifierName":"async"}, "name": "async" }, "computed": false, "shorthand": false, "value": { "type": "StringLiteral", - "start": 19, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":19,"end":25,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":25}}, "extra": { "rawValue": "test", "raw": "\"test\"" diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/24/output.json b/packages/babel-parser/test/fixtures/es2017/async-functions/24/output.json index 7867e7d8e758..befcd7055bc2 100644 --- a/packages/babel-parser/test/fixtures/es2017/async-functions/24/output.json +++ b/packages/babel-parser/test/fixtures/es2017/async-functions/24/output.json @@ -1,125 +1,35 @@ { "type": "File", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, "program": { "type": "Program", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":4,"end":24,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":24}}, "id": { "type": "Identifier", - "start": 4, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "obj" - }, + "start":4,"end":7,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":7},"identifierName":"obj"}, "name": "obj" }, "init": { "type": "ObjectExpression", - "start": 10, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":10,"end":24,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":24}}, "properties": [ { "type": "ObjectMethod", - "start": 12, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":12,"end":22,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":22}}, "method": true, "key": { "type": "Identifier", - "start": 12, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 17 - }, - "identifierName": "async" - }, + "start":12,"end":17,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":17},"identifierName":"async"}, "name": "async" }, "computed": false, @@ -130,18 +40,7 @@ "params": [], "body": { "type": "BlockStatement", - "start": 20, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":20,"end":22,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":22}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/25/output.json b/packages/babel-parser/test/fixtures/es2017/async-functions/25/output.json index 5432ec7cac57..a4b4f875f126 100644 --- a/packages/babel-parser/test/fixtures/es2017/async-functions/25/output.json +++ b/packages/babel-parser/test/fixtures/es2017/async-functions/25/output.json @@ -1,79 +1,23 @@ { "type": "File", - "start": 0, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, "program": { "type": "Program", - "start": 0, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExportNamedDeclaration", - "start": 0, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, "specifiers": [], "source": null, "declaration": { "type": "FunctionDeclaration", - "start": 7, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":7,"end":30,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":30}}, "id": { "type": "Identifier", - "start": 22, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 25 - }, - "identifierName": "foo" - }, + "start":22,"end":25,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":25},"identifierName":"foo"}, "name": "foo" }, "generator": false, @@ -81,18 +25,7 @@ "params": [], "body": { "type": "BlockStatement", - "start": 28, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":28,"end":30,"loc":{"start":{"line":1,"column":28},"end":{"line":1,"column":30}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/26/output.json b/packages/babel-parser/test/fixtures/es2017/async-functions/26/output.json index aa3160913c2d..59b59c8b5b9f 100644 --- a/packages/babel-parser/test/fixtures/es2017/async-functions/26/output.json +++ b/packages/babel-parser/test/fixtures/es2017/async-functions/26/output.json @@ -1,211 +1,62 @@ { "type": "File", - "start": 0, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, "program": { "type": "Program", - "start": 0, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, "expression": { "type": "CallExpression", - "start": 0, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, "callee": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "f" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"f"}, "name": "f" }, "arguments": [ { "type": "Identifier", - "start": 2, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 3 - }, - "identifierName": "a" - }, + "start":2,"end":3,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":3},"identifierName":"a"}, "name": "a" }, { "type": "ArrowFunctionExpression", - "start": 5, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":5,"end":32,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":32}}, "id": null, "generator": false, "async": true, "params": [ { "type": "Identifier", - "start": 11, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "x" - }, + "start":11,"end":12,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":12},"identifierName":"x"}, "name": "x" }, { "type": "Identifier", - "start": 14, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - }, - "identifierName": "y" - }, + "start":14,"end":15,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":15},"identifierName":"y"}, "name": "y" } ], "body": { "type": "AwaitExpression", - "start": 20, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":20,"end":32,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":32}}, "argument": { "type": "ArrayExpression", - "start": 26, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":26,"end":32,"loc":{"start":{"line":1,"column":26},"end":{"line":1,"column":32}}, "elements": [ { "type": "Identifier", - "start": 27, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 28 - }, - "identifierName": "x" - }, + "start":27,"end":28,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":28},"identifierName":"x"}, "name": "x" }, { "type": "Identifier", - "start": 30, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 1, - "column": 31 - }, - "identifierName": "y" - }, + "start":30,"end":31,"loc":{"start":{"line":1,"column":30},"end":{"line":1,"column":31},"identifierName":"y"}, "name": "y" } ] @@ -214,19 +65,7 @@ }, { "type": "Identifier", - "start": 34, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 34 - }, - "end": { - "line": 1, - "column": 35 - }, - "identifierName": "b" - }, + "start":34,"end":35,"loc":{"start":{"line":1,"column":34},"end":{"line":1,"column":35},"identifierName":"b"}, "name": "b" } ] diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/27/output.json b/packages/babel-parser/test/fixtures/es2017/async-functions/27/output.json index 5768fef8a736..5f1b2eebf8fe 100644 --- a/packages/babel-parser/test/fixtures/es2017/async-functions/27/output.json +++ b/packages/babel-parser/test/fixtures/es2017/async-functions/27/output.json @@ -1,192 +1,57 @@ { "type": "File", - "start": 0, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 37 - } - }, + "start":0,"end":37,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":37}}, "program": { "type": "Program", - "start": 0, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 37 - } - }, + "start":0,"end":37,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":37}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 37 - } - }, + "start":0,"end":37,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":37}}, "declarations": [ { "type": "VariableDeclarator", - "start": 6, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":6,"end":36,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":36}}, "id": { "type": "Identifier", - "start": 6, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "foo" - }, + "start":6,"end":9,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":9},"identifierName":"foo"}, "name": "foo" }, "init": { "type": "ArrowFunctionExpression", - "start": 12, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":12,"end":36,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":36}}, "id": null, "generator": false, "async": false, "params": [ { "type": "ObjectPattern", - "start": 13, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":13,"end":29,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":29}}, "properties": [ { "type": "ObjectProperty", - "start": 15, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":15,"end":27,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":27}}, "method": false, "key": { "type": "Identifier", - "start": 15, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 20 - }, - "identifierName": "async" - }, + "start":15,"end":20,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":20},"identifierName":"async"}, "name": "async" }, "computed": false, "shorthand": true, "value": { "type": "AssignmentPattern", - "start": 15, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":15,"end":27,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":27}}, "left": { "type": "Identifier", - "start": 15, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 20 - }, - "identifierName": "async" - }, + "start":15,"end":20,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":20},"identifierName":"async"}, "name": "async" }, "right": { "type": "BooleanLiteral", - "start": 23, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":23,"end":27,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":27}}, "value": true } }, @@ -199,18 +64,7 @@ ], "body": { "type": "BlockStatement", - "start": 34, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 34 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":34,"end":36,"loc":{"start":{"line":1,"column":34},"end":{"line":1,"column":36}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/28/output.json b/packages/babel-parser/test/fixtures/es2017/async-functions/28/output.json index 43dd8a794c51..dfcc899c1abc 100644 --- a/packages/babel-parser/test/fixtures/es2017/async-functions/28/output.json +++ b/packages/babel-parser/test/fixtures/es2017/async-functions/28/output.json @@ -1,162 +1,49 @@ { "type": "File", - "start": 0, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":35}}, "program": { "type": "Program", - "start": 0, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":35}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":35}}, "declarations": [ { "type": "VariableDeclarator", - "start": 6, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":6,"end":34,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":34}}, "id": { "type": "Identifier", - "start": 6, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "foo" - }, + "start":6,"end":9,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":9},"identifierName":"foo"}, "name": "foo" }, "init": { "type": "ArrowFunctionExpression", - "start": 12, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":12,"end":34,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":34}}, "id": null, "generator": false, "async": false, "params": [ { "type": "ObjectPattern", - "start": 13, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":13,"end":27,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":27}}, "properties": [ { "type": "ObjectProperty", - "start": 15, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":15,"end":25,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":25}}, "method": false, "key": { "type": "Identifier", - "start": 15, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 20 - }, - "identifierName": "async" - }, + "start":15,"end":20,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":20},"identifierName":"async"}, "name": "async" }, "computed": false, "shorthand": false, "value": { "type": "Identifier", - "start": 22, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 25 - }, - "identifierName": "bar" - }, + "start":22,"end":25,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":25},"identifierName":"bar"}, "name": "bar" } } @@ -165,18 +52,7 @@ ], "body": { "type": "BlockStatement", - "start": 32, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 32 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":32,"end":34,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":34}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/29/output.json b/packages/babel-parser/test/fixtures/es2017/async-functions/29/output.json index e2487bab9782..4fd39cd12008 100644 --- a/packages/babel-parser/test/fixtures/es2017/async-functions/29/output.json +++ b/packages/babel-parser/test/fixtures/es2017/async-functions/29/output.json @@ -1,192 +1,57 @@ { "type": "File", - "start": 0, - "end": 42, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 42 - } - }, + "start":0,"end":42,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":42}}, "program": { "type": "Program", - "start": 0, - "end": 42, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 42 - } - }, + "start":0,"end":42,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":42}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 42, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 42 - } - }, + "start":0,"end":42,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":42}}, "declarations": [ { "type": "VariableDeclarator", - "start": 6, - "end": 41, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 41 - } - }, + "start":6,"end":41,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":41}}, "id": { "type": "Identifier", - "start": 6, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "foo" - }, + "start":6,"end":9,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":9},"identifierName":"foo"}, "name": "foo" }, "init": { "type": "FunctionExpression", - "start": 12, - "end": 41, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 41 - } - }, + "start":12,"end":41,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":41}}, "id": null, "generator": false, "async": false, "params": [ { "type": "ObjectPattern", - "start": 21, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 37 - } - }, + "start":21,"end":37,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":37}}, "properties": [ { "type": "ObjectProperty", - "start": 23, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":23,"end":35,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":35}}, "method": false, "key": { "type": "Identifier", - "start": 23, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 28 - }, - "identifierName": "async" - }, + "start":23,"end":28,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":28},"identifierName":"async"}, "name": "async" }, "computed": false, "shorthand": true, "value": { "type": "AssignmentPattern", - "start": 23, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":23,"end":35,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":35}}, "left": { "type": "Identifier", - "start": 23, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 28 - }, - "identifierName": "async" - }, + "start":23,"end":28,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":28},"identifierName":"async"}, "name": "async" }, "right": { "type": "BooleanLiteral", - "start": 31, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 31 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":31,"end":35,"loc":{"start":{"line":1,"column":31},"end":{"line":1,"column":35}}, "value": true } }, @@ -199,18 +64,7 @@ ], "body": { "type": "BlockStatement", - "start": 39, - "end": 41, - "loc": { - "start": { - "line": 1, - "column": 39 - }, - "end": { - "line": 1, - "column": 41 - } - }, + "start":39,"end":41,"loc":{"start":{"line":1,"column":39},"end":{"line":1,"column":41}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/30/output.json b/packages/babel-parser/test/fixtures/es2017/async-functions/30/output.json index b1bef6eada66..c4992f473c62 100644 --- a/packages/babel-parser/test/fixtures/es2017/async-functions/30/output.json +++ b/packages/babel-parser/test/fixtures/es2017/async-functions/30/output.json @@ -1,162 +1,49 @@ { "type": "File", - "start": 0, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 40 - } - }, + "start":0,"end":40,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":40}}, "program": { "type": "Program", - "start": 0, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 40 - } - }, + "start":0,"end":40,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":40}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 40 - } - }, + "start":0,"end":40,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":40}}, "declarations": [ { "type": "VariableDeclarator", - "start": 6, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 39 - } - }, + "start":6,"end":39,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":39}}, "id": { "type": "Identifier", - "start": 6, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "foo" - }, + "start":6,"end":9,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":9},"identifierName":"foo"}, "name": "foo" }, "init": { "type": "FunctionExpression", - "start": 12, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 39 - } - }, + "start":12,"end":39,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":39}}, "id": null, "generator": false, "async": false, "params": [ { "type": "ObjectPattern", - "start": 21, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":21,"end":35,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":35}}, "properties": [ { "type": "ObjectProperty", - "start": 23, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":23,"end":33,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":33}}, "method": false, "key": { "type": "Identifier", - "start": 23, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 28 - }, - "identifierName": "async" - }, + "start":23,"end":28,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":28},"identifierName":"async"}, "name": "async" }, "computed": false, "shorthand": false, "value": { "type": "Identifier", - "start": 30, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 1, - "column": 33 - }, - "identifierName": "bar" - }, + "start":30,"end":33,"loc":{"start":{"line":1,"column":30},"end":{"line":1,"column":33},"identifierName":"bar"}, "name": "bar" } } @@ -165,18 +52,7 @@ ], "body": { "type": "BlockStatement", - "start": 37, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 37 - }, - "end": { - "line": 1, - "column": 39 - } - }, + "start":37,"end":39,"loc":{"start":{"line":1,"column":37},"end":{"line":1,"column":39}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/31/output.json b/packages/babel-parser/test/fixtures/es2017/async-functions/31/output.json index fc0cb9d7f54a..0b5c81b4674d 100644 --- a/packages/babel-parser/test/fixtures/es2017/async-functions/31/output.json +++ b/packages/babel-parser/test/fixtures/es2017/async-functions/31/output.json @@ -1,162 +1,49 @@ { "type": "File", - "start": 0, - "end": 55, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 2 - } - }, + "start":0,"end":55,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":2}}, "program": { "type": "Program", - "start": 0, - "end": 55, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 2 - } - }, + "start":0,"end":55,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":2}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 55, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 2 - } - }, + "start":0,"end":55,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":2}}, "declarations": [ { "type": "VariableDeclarator", - "start": 6, - "end": 54, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":6,"end":54,"loc":{"start":{"line":1,"column":6},"end":{"line":3,"column":1}}, "id": { "type": "Identifier", - "start": 6, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "foo" - }, + "start":6,"end":9,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":9},"identifierName":"foo"}, "name": "foo" }, "init": { "type": "ArrowFunctionExpression", - "start": 12, - "end": 54, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":12,"end":54,"loc":{"start":{"line":1,"column":12},"end":{"line":3,"column":1}}, "id": null, "generator": false, "async": true, "params": [ { "type": "ObjectPattern", - "start": 19, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":19,"end":33,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":33}}, "properties": [ { "type": "ObjectProperty", - "start": 21, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":21,"end":31,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":31}}, "method": false, "key": { "type": "Identifier", - "start": 21, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 26 - }, - "identifierName": "async" - }, + "start":21,"end":26,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":26},"identifierName":"async"}, "name": "async" }, "computed": false, "shorthand": false, "value": { "type": "Identifier", - "start": 28, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 31 - }, - "identifierName": "bar" - }, + "start":28,"end":31,"loc":{"start":{"line":1,"column":28},"end":{"line":1,"column":31},"identifierName":"bar"}, "name": "bar" } } @@ -165,62 +52,17 @@ ], "body": { "type": "BlockStatement", - "start": 38, - "end": 54, - "loc": { - "start": { - "line": 1, - "column": 38 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":38,"end":54,"loc":{"start":{"line":1,"column":38},"end":{"line":3,"column":1}}, "body": [ { "type": "ExpressionStatement", - "start": 42, - "end": 52, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 12 - } - }, + "start":42,"end":52,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":12}}, "expression": { "type": "AwaitExpression", - "start": 42, - "end": 51, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 11 - } - }, + "start":42,"end":51,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":11}}, "argument": { "type": "Identifier", - "start": 48, - "end": 51, - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 11 - }, - "identifierName": "baz" - }, + "start":48,"end":51,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":11},"identifierName":"baz"}, "name": "baz" } } diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/32/output.json b/packages/babel-parser/test/fixtures/es2017/async-functions/32/output.json index 0a1dd11478cd..b22103cb4461 100644 --- a/packages/babel-parser/test/fixtures/es2017/async-functions/32/output.json +++ b/packages/babel-parser/test/fixtures/es2017/async-functions/32/output.json @@ -1,193 +1,57 @@ { "type": "File", - "start": 0, - "end": 56, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 2 - } - }, + "start":0,"end":56,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":2}}, "program": { "type": "Program", - "start": 0, - "end": 56, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 2 - } - }, + "start":0,"end":56,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":2}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 56, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 2 - } - }, + "start":0,"end":56,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":2}}, "declarations": [ { "type": "VariableDeclarator", - "start": 6, - "end": 55, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":6,"end":55,"loc":{"start":{"line":1,"column":6},"end":{"line":3,"column":1}}, "id": { "type": "Identifier", - "start": 6, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "foo" - }, + "start":6,"end":9,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":9},"identifierName":"foo"}, "name": "foo" }, "init": { "type": "ArrowFunctionExpression", - "start": 12, - "end": 55, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":12,"end":55,"loc":{"start":{"line":1,"column":12},"end":{"line":3,"column":1}}, "id": null, "generator": false, "async": true, "params": [ { "type": "ObjectPattern", - "start": 19, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":19,"end":34,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":34}}, "properties": [ { "type": "ObjectProperty", - "start": 21, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":21,"end":32,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":32}}, "method": false, "key": { "type": "Identifier", - "start": 21, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 26 - }, - "identifierName": "async" - }, + "start":21,"end":26,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":26},"identifierName":"async"}, "name": "async" }, "computed": false, "shorthand": true, "value": { "type": "AssignmentPattern", - "start": 21, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":21,"end":32,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":32}}, "left": { "type": "Identifier", - "start": 21, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 26 - }, - "identifierName": "async" - }, + "start":21,"end":26,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":26},"identifierName":"async"}, "name": "async" }, "right": { "type": "Identifier", - "start": 29, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 1, - "column": 32 - }, - "identifierName": "bar" - }, + "start":29,"end":32,"loc":{"start":{"line":1,"column":29},"end":{"line":1,"column":32},"identifierName":"bar"}, "name": "bar" } }, @@ -200,62 +64,17 @@ ], "body": { "type": "BlockStatement", - "start": 39, - "end": 55, - "loc": { - "start": { - "line": 1, - "column": 39 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":39,"end":55,"loc":{"start":{"line":1,"column":39},"end":{"line":3,"column":1}}, "body": [ { "type": "ExpressionStatement", - "start": 43, - "end": 53, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 12 - } - }, + "start":43,"end":53,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":12}}, "expression": { "type": "AwaitExpression", - "start": 43, - "end": 52, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 11 - } - }, + "start":43,"end":52,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":11}}, "argument": { "type": "Identifier", - "start": 49, - "end": 52, - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 11 - }, - "identifierName": "baz" - }, + "start":49,"end":52,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":11},"identifierName":"baz"}, "name": "baz" } } diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/33/output.json b/packages/babel-parser/test/fixtures/es2017/async-functions/33/output.json index eb5cabf9ced2..3626c5879af1 100644 --- a/packages/babel-parser/test/fixtures/es2017/async-functions/33/output.json +++ b/packages/babel-parser/test/fixtures/es2017/async-functions/33/output.json @@ -1,162 +1,49 @@ { "type": "File", - "start": 0, - "end": 60, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 2 - } - }, + "start":0,"end":60,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":2}}, "program": { "type": "Program", - "start": 0, - "end": 60, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 2 - } - }, + "start":0,"end":60,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":2}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 60, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 2 - } - }, + "start":0,"end":60,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":2}}, "declarations": [ { "type": "VariableDeclarator", - "start": 6, - "end": 59, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":6,"end":59,"loc":{"start":{"line":1,"column":6},"end":{"line":3,"column":1}}, "id": { "type": "Identifier", - "start": 6, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "foo" - }, + "start":6,"end":9,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":9},"identifierName":"foo"}, "name": "foo" }, "init": { "type": "FunctionExpression", - "start": 12, - "end": 59, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":12,"end":59,"loc":{"start":{"line":1,"column":12},"end":{"line":3,"column":1}}, "id": null, "generator": false, "async": true, "params": [ { "type": "ObjectPattern", - "start": 27, - "end": 41, - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 41 - } - }, + "start":27,"end":41,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":41}}, "properties": [ { "type": "ObjectProperty", - "start": 29, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 1, - "column": 39 - } - }, + "start":29,"end":39,"loc":{"start":{"line":1,"column":29},"end":{"line":1,"column":39}}, "method": false, "key": { "type": "Identifier", - "start": 29, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 1, - "column": 34 - }, - "identifierName": "async" - }, + "start":29,"end":34,"loc":{"start":{"line":1,"column":29},"end":{"line":1,"column":34},"identifierName":"async"}, "name": "async" }, "computed": false, "shorthand": false, "value": { "type": "Identifier", - "start": 36, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 36 - }, - "end": { - "line": 1, - "column": 39 - }, - "identifierName": "bar" - }, + "start":36,"end":39,"loc":{"start":{"line":1,"column":36},"end":{"line":1,"column":39},"identifierName":"bar"}, "name": "bar" } } @@ -165,62 +52,17 @@ ], "body": { "type": "BlockStatement", - "start": 43, - "end": 59, - "loc": { - "start": { - "line": 1, - "column": 43 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":43,"end":59,"loc":{"start":{"line":1,"column":43},"end":{"line":3,"column":1}}, "body": [ { "type": "ExpressionStatement", - "start": 47, - "end": 57, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 12 - } - }, + "start":47,"end":57,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":12}}, "expression": { "type": "AwaitExpression", - "start": 47, - "end": 56, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 11 - } - }, + "start":47,"end":56,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":11}}, "argument": { "type": "Identifier", - "start": 53, - "end": 56, - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 11 - }, - "identifierName": "baz" - }, + "start":53,"end":56,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":11},"identifierName":"baz"}, "name": "baz" } } diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/34/output.json b/packages/babel-parser/test/fixtures/es2017/async-functions/34/output.json index b3eb53b70e6b..3381a94ff2e4 100644 --- a/packages/babel-parser/test/fixtures/es2017/async-functions/34/output.json +++ b/packages/babel-parser/test/fixtures/es2017/async-functions/34/output.json @@ -1,193 +1,57 @@ { "type": "File", - "start": 0, - "end": 61, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 2 - } - }, + "start":0,"end":61,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":2}}, "program": { "type": "Program", - "start": 0, - "end": 61, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 2 - } - }, + "start":0,"end":61,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":2}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 61, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 2 - } - }, + "start":0,"end":61,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":2}}, "declarations": [ { "type": "VariableDeclarator", - "start": 6, - "end": 60, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":6,"end":60,"loc":{"start":{"line":1,"column":6},"end":{"line":3,"column":1}}, "id": { "type": "Identifier", - "start": 6, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "foo" - }, + "start":6,"end":9,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":9},"identifierName":"foo"}, "name": "foo" }, "init": { "type": "FunctionExpression", - "start": 12, - "end": 60, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":12,"end":60,"loc":{"start":{"line":1,"column":12},"end":{"line":3,"column":1}}, "id": null, "generator": false, "async": true, "params": [ { "type": "ObjectPattern", - "start": 27, - "end": 42, - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 42 - } - }, + "start":27,"end":42,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":42}}, "properties": [ { "type": "ObjectProperty", - "start": 29, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 1, - "column": 40 - } - }, + "start":29,"end":40,"loc":{"start":{"line":1,"column":29},"end":{"line":1,"column":40}}, "method": false, "key": { "type": "Identifier", - "start": 29, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 1, - "column": 34 - }, - "identifierName": "async" - }, + "start":29,"end":34,"loc":{"start":{"line":1,"column":29},"end":{"line":1,"column":34},"identifierName":"async"}, "name": "async" }, "computed": false, "shorthand": true, "value": { "type": "AssignmentPattern", - "start": 29, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 1, - "column": 40 - } - }, + "start":29,"end":40,"loc":{"start":{"line":1,"column":29},"end":{"line":1,"column":40}}, "left": { "type": "Identifier", - "start": 29, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 1, - "column": 34 - }, - "identifierName": "async" - }, + "start":29,"end":34,"loc":{"start":{"line":1,"column":29},"end":{"line":1,"column":34},"identifierName":"async"}, "name": "async" }, "right": { "type": "Identifier", - "start": 37, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 37 - }, - "end": { - "line": 1, - "column": 40 - }, - "identifierName": "bar" - }, + "start":37,"end":40,"loc":{"start":{"line":1,"column":37},"end":{"line":1,"column":40},"identifierName":"bar"}, "name": "bar" } }, @@ -200,62 +64,17 @@ ], "body": { "type": "BlockStatement", - "start": 44, - "end": 60, - "loc": { - "start": { - "line": 1, - "column": 44 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":44,"end":60,"loc":{"start":{"line":1,"column":44},"end":{"line":3,"column":1}}, "body": [ { "type": "ExpressionStatement", - "start": 48, - "end": 58, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 12 - } - }, + "start":48,"end":58,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":12}}, "expression": { "type": "AwaitExpression", - "start": 48, - "end": 57, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 11 - } - }, + "start":48,"end":57,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":11}}, "argument": { "type": "Identifier", - "start": 54, - "end": 57, - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 11 - }, - "identifierName": "baz" - }, + "start":54,"end":57,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":11},"identifierName":"baz"}, "name": "baz" } } diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/37/output.json b/packages/babel-parser/test/fixtures/es2017/async-functions/37/output.json index f5c50075ec2b..1a3678ab7042 100644 --- a/packages/babel-parser/test/fixtures/es2017/async-functions/37/output.json +++ b/packages/babel-parser/test/fixtures/es2017/async-functions/37/output.json @@ -1,157 +1,45 @@ { "type": "File", - "start": 0, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, "program": { "type": "Program", - "start": 0, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, "declarations": [ { "type": "VariableDeclarator", - "start": 6, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":6,"end":28,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":28}}, "id": { "type": "ObjectPattern", - "start": 6, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":6,"end":22,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":22}}, "properties": [ { "type": "ObjectProperty", - "start": 8, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":8,"end":20,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":20}}, "method": false, "key": { "type": "Identifier", - "start": 8, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 13 - }, - "identifierName": "async" - }, + "start":8,"end":13,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":13},"identifierName":"async"}, "name": "async" }, "computed": false, "shorthand": true, "value": { "type": "AssignmentPattern", - "start": 8, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":8,"end":20,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":20}}, "left": { "type": "Identifier", - "start": 8, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 13 - }, - "identifierName": "async" - }, + "start":8,"end":13,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":13},"identifierName":"async"}, "name": "async" }, "right": { "type": "BooleanLiteral", - "start": 16, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":16,"end":20,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":20}}, "value": true } }, @@ -163,19 +51,7 @@ }, "init": { "type": "Identifier", - "start": 25, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 28 - }, - "identifierName": "foo" - }, + "start":25,"end":28,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":28},"identifierName":"foo"}, "name": "foo" } } diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/38/output.json b/packages/babel-parser/test/fixtures/es2017/async-functions/38/output.json index 3f73e77b69e8..11e80fe9c0ee 100644 --- a/packages/babel-parser/test/fixtures/es2017/async-functions/38/output.json +++ b/packages/babel-parser/test/fixtures/es2017/async-functions/38/output.json @@ -1,127 +1,37 @@ { "type": "File", - "start": 0, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, "program": { "type": "Program", - "start": 0, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, "declarations": [ { "type": "VariableDeclarator", - "start": 6, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":6,"end":26,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":26}}, "id": { "type": "ObjectPattern", - "start": 6, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":6,"end":20,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":20}}, "properties": [ { "type": "ObjectProperty", - "start": 8, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":8,"end":18,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":18}}, "method": false, "key": { "type": "Identifier", - "start": 8, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 13 - }, - "identifierName": "async" - }, + "start":8,"end":13,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":13},"identifierName":"async"}, "name": "async" }, "computed": false, "shorthand": false, "value": { "type": "Identifier", - "start": 15, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 18 - }, - "identifierName": "foo" - }, + "start":15,"end":18,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":18},"identifierName":"foo"}, "name": "foo" } } @@ -129,19 +39,7 @@ }, "init": { "type": "Identifier", - "start": 23, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 26 - }, - "identifierName": "bar" - }, + "start":23,"end":26,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":26},"identifierName":"bar"}, "name": "bar" } } diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/7/output.json b/packages/babel-parser/test/fixtures/es2017/async-functions/7/output.json index 0b7a650552d4..3d7b20d5c118 100644 --- a/packages/babel-parser/test/fixtures/es2017/async-functions/7/output.json +++ b/packages/babel-parser/test/fixtures/es2017/async-functions/7/output.json @@ -1,144 +1,42 @@ { "type": "File", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "program": { "type": "Program", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "expression": { "type": "CallExpression", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "callee": { "type": "Identifier", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - }, - "identifierName": "foo" - }, + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3},"identifierName":"foo"}, "name": "foo" }, "arguments": [ { "type": "ObjectExpression", - "start": 4, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":4,"end":13,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":13}}, "properties": [ { "type": "ObjectProperty", - "start": 6, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":6,"end":11,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":11}}, "method": false, "key": { "type": "Identifier", - "start": 6, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "async" - }, + "start":6,"end":11,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":11},"identifierName":"async"}, "name": "async" }, "computed": false, "shorthand": true, "value": { "type": "Identifier", - "start": 6, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "async" - }, + "start":6,"end":11,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":11},"identifierName":"async"}, "name": "async" }, "extra": { diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/8/output.json b/packages/babel-parser/test/fixtures/es2017/async-functions/8/output.json index dee1edbd1520..0c972c1f69fd 100644 --- a/packages/babel-parser/test/fixtures/es2017/async-functions/8/output.json +++ b/packages/babel-parser/test/fixtures/es2017/async-functions/8/output.json @@ -1,127 +1,37 @@ { "type": "File", - "start": 0, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 39 - } - }, + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":39}}, "program": { "type": "Program", - "start": 0, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 39 - } - }, + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":39}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 39 - } - }, + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":39}}, "declarations": [ { "type": "VariableDeclarator", - "start": 6, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 39 - } - }, + "start":6,"end":39,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":39}}, "id": { "type": "ObjectPattern", - "start": 6, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":6,"end":13,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":13}}, "properties": [ { "type": "ObjectProperty", - "start": 7, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":7,"end":12,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":12}}, "method": false, "key": { "type": "Identifier", - "start": 7, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "async" - }, + "start":7,"end":12,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":12},"identifierName":"async"}, "name": "async" }, "computed": false, "shorthand": true, "value": { "type": "Identifier", - "start": 7, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "async" - }, + "start":7,"end":12,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":12},"identifierName":"async"}, "name": "async" }, "extra": { @@ -132,50 +42,16 @@ }, "init": { "type": "CallExpression", - "start": 16, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 39 - } - }, + "start":16,"end":39,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":39}}, "callee": { "type": "Identifier", - "start": 16, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 23 - }, - "identifierName": "require" - }, + "start":16,"end":23,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":23},"identifierName":"require"}, "name": "require" }, "arguments": [ { "type": "StringLiteral", - "start": 24, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":24,"end":38,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":38}}, "extra": { "rawValue": "../lang/task", "raw": "'../lang/task'" diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/allow-await-outside-function/output.json b/packages/babel-parser/test/fixtures/es2017/async-functions/allow-await-outside-function/output.json index 1f1d637ff0b7..878b81ab502c 100644 --- a/packages/babel-parser/test/fixtures/es2017/async-functions/allow-await-outside-function/output.json +++ b/packages/babel-parser/test/fixtures/es2017/async-functions/allow-await-outside-function/output.json @@ -1,76 +1,21 @@ { "type": "File", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "program": { "type": "Program", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "expression": { "type": "AwaitExpression", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "argument": { "type": "NumericLiteral", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7}}, "extra": { "rawValue": 1, "raw": "1" diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/async-await-as-arrow-binding-identifier/input.js b/packages/babel-parser/test/fixtures/es2017/async-functions/async-await-as-arrow-binding-identifier/input.js new file mode 100644 index 000000000000..769cb1594534 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2017/async-functions/async-await-as-arrow-binding-identifier/input.js @@ -0,0 +1 @@ +async await => {} diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/async-await-as-arrow-binding-identifier/output.json b/packages/babel-parser/test/fixtures/es2017/async-functions/async-await-as-arrow-binding-identifier/output.json new file mode 100644 index 000000000000..f41c5e0fe4e6 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2017/async-functions/async-await-as-arrow-binding-identifier/output.json @@ -0,0 +1,40 @@ +{ + "type": "File", + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, + "errors": [ + "SyntaxError: Await cannot be used as name inside an async function (1:6)" + ], + "program": { + "type": "Program", + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, + "expression": { + "type": "ArrowFunctionExpression", + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, + "id": null, + "generator": false, + "async": true, + "params": [ + { + "type": "Identifier", + "start":6,"end":11,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":11},"identifierName":"await"}, + "name": "await" + } + ], + "body": { + "type": "BlockStatement", + "start":15,"end":17,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":17}}, + "body": [], + "directives": [] + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/await-as-argument-identifier-in-non-async-functions/input.js b/packages/babel-parser/test/fixtures/es2017/async-functions/await-as-argument-identifier-in-non-async-functions/input.js new file mode 100644 index 000000000000..37af6577300e --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2017/async-functions/await-as-argument-identifier-in-non-async-functions/input.js @@ -0,0 +1 @@ +(await) => {} diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/await-as-argument-identifier-in-non-async-functions/output.json b/packages/babel-parser/test/fixtures/es2017/async-functions/await-as-argument-identifier-in-non-async-functions/output.json new file mode 100644 index 000000000000..b99bac3df29d --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2017/async-functions/await-as-argument-identifier-in-non-async-functions/output.json @@ -0,0 +1,37 @@ +{ + "type": "File", + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "program": { + "type": "Program", + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "expression": { + "type": "ArrowFunctionExpression", + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start":1,"end":6,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":6},"identifierName":"await"}, + "name": "await" + } + ], + "body": { + "type": "BlockStatement", + "start":11,"end":13,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":13}}, + "body": [], + "directives": [] + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/await-async-function-declaration-name/output.json b/packages/babel-parser/test/fixtures/es2017/async-functions/await-async-function-declaration-name/output.json index 2d128072e784..d98029d55094 100644 --- a/packages/babel-parser/test/fixtures/es2017/async-functions/await-async-function-declaration-name/output.json +++ b/packages/babel-parser/test/fixtures/es2017/async-functions/await-async-function-declaration-name/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, "program": { "type": "Program", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, "id": { "type": "Identifier", - "start": 15, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 20 - }, - "identifierName": "await" - }, + "start":15,"end":20,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":20},"identifierName":"await"}, "name": "await" }, "generator": false, @@ -65,18 +20,7 @@ "params": [], "body": { "type": "BlockStatement", - "start": 23, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":23,"end":25,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":25}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/await-async-function-expression-name/options.json b/packages/babel-parser/test/fixtures/es2017/async-functions/await-async-function-expression-name/options.json deleted file mode 100644 index 022428647fee..000000000000 --- a/packages/babel-parser/test/fixtures/es2017/async-functions/await-async-function-expression-name/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Can not use 'await' as identifier inside an async function (1:16)" -} diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/await-async-function-expression-name/output.json b/packages/babel-parser/test/fixtures/es2017/async-functions/await-async-function-expression-name/output.json new file mode 100644 index 000000000000..db893c17265e --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2017/async-functions/await-async-function-expression-name/output.json @@ -0,0 +1,42 @@ +{ + "type": "File", + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, + "errors": [ + "SyntaxError: Can not use 'await' as identifier inside an async function (1:16)" + ], + "program": { + "type": "Program", + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, + "expression": { + "type": "FunctionExpression", + "start":1,"end":26,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":26}}, + "id": { + "type": "Identifier", + "start":16,"end":21,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":21},"identifierName":"await"}, + "name": "await" + }, + "generator": false, + "async": true, + "params": [], + "body": { + "type": "BlockStatement", + "start":24,"end":26,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":26}}, + "body": [], + "directives": [] + }, + "extra": { + "parenthesized": true, + "parenStart": 0 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/await-binding-inside-arrow-params-inside-async-arrow-params/input.js b/packages/babel-parser/test/fixtures/es2017/async-functions/await-binding-inside-arrow-params-inside-async-arrow-params/input.js new file mode 100644 index 000000000000..5b6e6b2866ae --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2017/async-functions/await-binding-inside-arrow-params-inside-async-arrow-params/input.js @@ -0,0 +1 @@ +async (a = ({ await }) => {}) => {}; diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/await-binding-inside-arrow-params-inside-async-arrow-params/output.json b/packages/babel-parser/test/fixtures/es2017/async-functions/await-binding-inside-arrow-params-inside-async-arrow-params/output.json new file mode 100644 index 000000000000..c6a76429a103 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2017/async-functions/await-binding-inside-arrow-params-inside-async-arrow-params/output.json @@ -0,0 +1,85 @@ +{ + "type": "File", + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, + "errors": [ + "SyntaxError: Await cannot be used as name inside an async function (1:20)" + ], + "program": { + "type": "Program", + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, + "expression": { + "type": "ArrowFunctionExpression", + "start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":35}}, + "id": null, + "generator": false, + "async": true, + "params": [ + { + "type": "AssignmentPattern", + "start":7,"end":28,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":28}}, + "left": { + "type": "Identifier", + "start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8},"identifierName":"a"}, + "name": "a" + }, + "right": { + "type": "ArrowFunctionExpression", + "start":11,"end":28,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":28}}, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "ObjectPattern", + "start":12,"end":21,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":21}}, + "properties": [ + { + "type": "ObjectProperty", + "start":14,"end":19,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":19}}, + "method": false, + "key": { + "type": "Identifier", + "start":14,"end":19,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":19},"identifierName":"await"}, + "name": "await" + }, + "computed": false, + "shorthand": true, + "value": { + "type": "Identifier", + "start":14,"end":19,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":19},"identifierName":"await"}, + "name": "await" + }, + "extra": { + "shorthand": true + } + } + ] + } + ], + "body": { + "type": "BlockStatement", + "start":26,"end":28,"loc":{"start":{"line":1,"column":26},"end":{"line":1,"column":28}}, + "body": [], + "directives": [] + } + } + } + ], + "body": { + "type": "BlockStatement", + "start":33,"end":35,"loc":{"start":{"line":1,"column":33},"end":{"line":1,"column":35}}, + "body": [], + "directives": [] + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/await-function-declaration-name-inside-async-function/options.json b/packages/babel-parser/test/fixtures/es2017/async-functions/await-function-declaration-name-inside-async-function/options.json deleted file mode 100644 index d45274982dc1..000000000000 --- a/packages/babel-parser/test/fixtures/es2017/async-functions/await-function-declaration-name-inside-async-function/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Can not use 'await' as identifier inside an async function (2:11)" -} diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/await-function-declaration-name-inside-async-function/output.json b/packages/babel-parser/test/fixtures/es2017/async-functions/await-function-declaration-name-inside-async-function/output.json new file mode 100644 index 000000000000..1f579129c72b --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2017/async-functions/await-function-declaration-name-inside-async-function/output.json @@ -0,0 +1,53 @@ +{ + "type": "File", + "start":0,"end":46,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "errors": [ + "SyntaxError: Can not use 'await' as identifier inside an async function (2:11)" + ], + "program": { + "type": "Program", + "start":0,"end":46,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":46,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "id": { + "type": "Identifier", + "start":15,"end":18,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":18},"identifierName":"foo"}, + "name": "foo" + }, + "generator": false, + "async": true, + "params": [], + "body": { + "type": "BlockStatement", + "start":21,"end":46,"loc":{"start":{"line":1,"column":21},"end":{"line":3,"column":1}}, + "body": [ + { + "type": "FunctionDeclaration", + "start":25,"end":44,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":21}}, + "id": { + "type": "Identifier", + "start":34,"end":39,"loc":{"start":{"line":2,"column":11},"end":{"line":2,"column":16},"identifierName":"await"}, + "name": "await" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":42,"end":44,"loc":{"start":{"line":2,"column":19},"end":{"line":2,"column":21}}, + "body": [], + "directives": [] + } + } + ], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/await-function-expression-name-inside-async-function/output.json b/packages/babel-parser/test/fixtures/es2017/async-functions/await-function-expression-name-inside-async-function/output.json index 701abef485a0..064e27566347 100644 --- a/packages/babel-parser/test/fixtures/es2017/async-functions/await-function-expression-name-inside-async-function/output.json +++ b/packages/babel-parser/test/fixtures/es2017/async-functions/await-function-expression-name-inside-async-function/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 48, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":48,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 48, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":48,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 48, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":48,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "id": { "type": "Identifier", - "start": 15, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 17 - }, - "identifierName": "fn" - }, + "start":15,"end":17,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":17},"identifierName":"fn"}, "name": "fn" }, "generator": false, @@ -65,62 +20,17 @@ "params": [], "body": { "type": "BlockStatement", - "start": 20, - "end": 48, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":20,"end":48,"loc":{"start":{"line":1,"column":20},"end":{"line":3,"column":1}}, "body": [ { "type": "ExpressionStatement", - "start": 24, - "end": 46, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 24 - } - }, + "start":24,"end":46,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":24}}, "expression": { "type": "FunctionExpression", - "start": 25, - "end": 44, - "loc": { - "start": { - "line": 2, - "column": 3 - }, - "end": { - "line": 2, - "column": 22 - } - }, + "start":25,"end":44,"loc":{"start":{"line":2,"column":3},"end":{"line":2,"column":22}}, "id": { "type": "Identifier", - "start": 34, - "end": 39, - "loc": { - "start": { - "line": 2, - "column": 12 - }, - "end": { - "line": 2, - "column": 17 - }, - "identifierName": "await" - }, + "start":34,"end":39,"loc":{"start":{"line":2,"column":12},"end":{"line":2,"column":17},"identifierName":"await"}, "name": "await" }, "generator": false, @@ -128,18 +38,7 @@ "params": [], "body": { "type": "BlockStatement", - "start": 42, - "end": 44, - "loc": { - "start": { - "line": 2, - "column": 20 - }, - "end": { - "line": 2, - "column": 22 - } - }, + "start":42,"end":44,"loc":{"start":{"line":2,"column":20},"end":{"line":2,"column":22}}, "body": [], "directives": [] }, diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/await-identifier-inside-parameters-of-nested-function/output.json b/packages/babel-parser/test/fixtures/es2017/async-functions/await-identifier-inside-parameters-of-nested-function/output.json index 1ad9f719af7c..e7edf5e4bde1 100644 --- a/packages/babel-parser/test/fixtures/es2017/async-functions/await-identifier-inside-parameters-of-nested-function/output.json +++ b/packages/babel-parser/test/fixtures/es2017/async-functions/await-identifier-inside-parameters-of-nested-function/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 50, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":50,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 50, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":50,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 50, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":50,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "id": { "type": "Identifier", - "start": 15, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 17 - }, - "identifierName": "fn" - }, + "start":15,"end":17,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":17},"identifierName":"fn"}, "name": "fn" }, "generator": false, @@ -65,48 +20,14 @@ "params": [], "body": { "type": "BlockStatement", - "start": 20, - "end": 50, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":20,"end":50,"loc":{"start":{"line":1,"column":20},"end":{"line":3,"column":1}}, "body": [ { "type": "FunctionDeclaration", - "start": 24, - "end": 48, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 26 - } - }, + "start":24,"end":48,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":26}}, "id": { "type": "Identifier", - "start": 33, - "end": 34, - "loc": { - "start": { - "line": 2, - "column": 11 - }, - "end": { - "line": 2, - "column": 12 - }, - "identifierName": "g" - }, + "start":33,"end":34,"loc":{"start":{"line":2,"column":11},"end":{"line":2,"column":12},"identifierName":"g"}, "name": "g" }, "generator": false, @@ -114,68 +35,22 @@ "params": [ { "type": "AssignmentPattern", - "start": 35, - "end": 44, - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 22 - } - }, + "start":35,"end":44,"loc":{"start":{"line":2,"column":13},"end":{"line":2,"column":22}}, "left": { "type": "Identifier", - "start": 35, - "end": 36, - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 14 - }, - "identifierName": "x" - }, + "start":35,"end":36,"loc":{"start":{"line":2,"column":13},"end":{"line":2,"column":14},"identifierName":"x"}, "name": "x" }, "right": { "type": "Identifier", - "start": 39, - "end": 44, - "loc": { - "start": { - "line": 2, - "column": 17 - }, - "end": { - "line": 2, - "column": 22 - }, - "identifierName": "await" - }, + "start":39,"end":44,"loc":{"start":{"line":2,"column":17},"end":{"line":2,"column":22},"identifierName":"await"}, "name": "await" } } ], "body": { "type": "BlockStatement", - "start": 46, - "end": 48, - "loc": { - "start": { - "line": 2, - "column": 24 - }, - "end": { - "line": 2, - "column": 26 - } - }, + "start":46,"end":48,"loc":{"start":{"line":2,"column":24},"end":{"line":2,"column":26}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/await-inside-arguments-of-async-call-inside-parameters-of-async-arrow-function/options.json b/packages/babel-parser/test/fixtures/es2017/async-functions/await-inside-arguments-of-async-call-inside-parameters-of-async-arrow-function/options.json deleted file mode 100644 index 9a4cb65743b5..000000000000 --- a/packages/babel-parser/test/fixtures/es2017/async-functions/await-inside-arguments-of-async-call-inside-parameters-of-async-arrow-function/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Await cannot be used as name inside an async function (2:23)" -} diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/await-inside-arguments-of-async-call-inside-parameters-of-async-arrow-function/output.json b/packages/babel-parser/test/fixtures/es2017/async-functions/await-inside-arguments-of-async-call-inside-parameters-of-async-arrow-function/output.json new file mode 100644 index 000000000000..fe9f611da097 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2017/async-functions/await-inside-arguments-of-async-call-inside-parameters-of-async-arrow-function/output.json @@ -0,0 +1,97 @@ +{ + "type": "File", + "start":0,"end":63,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "errors": [ + "SyntaxError: Await cannot be used as name inside an async function (2:23)" + ], + "program": { + "type": "Program", + "start":0,"end":63,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":63,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "id": { + "type": "Identifier", + "start":15,"end":17,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":17},"identifierName":"fn"}, + "name": "fn" + }, + "generator": false, + "async": true, + "params": [], + "body": { + "type": "BlockStatement", + "start":20,"end":63,"loc":{"start":{"line":1,"column":20},"end":{"line":3,"column":1}}, + "body": [ + { + "type": "ExpressionStatement", + "start":24,"end":61,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":39}}, + "expression": { + "type": "ArrowFunctionExpression", + "start":24,"end":60,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":38}}, + "id": null, + "generator": false, + "async": true, + "params": [ + { + "type": "AssignmentPattern", + "start":31,"end":53,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":31}}, + "left": { + "type": "Identifier", + "start":31,"end":32,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":10},"identifierName":"x"}, + "name": "x" + }, + "right": { + "type": "CallExpression", + "start":35,"end":53,"loc":{"start":{"line":2,"column":13},"end":{"line":2,"column":31}}, + "callee": { + "type": "Identifier", + "start":35,"end":40,"loc":{"start":{"line":2,"column":13},"end":{"line":2,"column":18},"identifierName":"async"}, + "name": "async" + }, + "arguments": [ + { + "type": "AssignmentExpression", + "start":41,"end":52,"loc":{"start":{"line":2,"column":19},"end":{"line":2,"column":30}}, + "operator": "=", + "left": { + "type": "Identifier", + "start":41,"end":42,"loc":{"start":{"line":2,"column":19},"end":{"line":2,"column":20},"identifierName":"y"}, + "name": "y" + }, + "right": { + "type": "AwaitExpression", + "start":45,"end":52,"loc":{"start":{"line":2,"column":23},"end":{"line":2,"column":30}}, + "argument": { + "type": "NumericLiteral", + "start":51,"end":52,"loc":{"start":{"line":2,"column":29},"end":{"line":2,"column":30}}, + "extra": { + "rawValue": 2, + "raw": "2" + }, + "value": 2 + } + } + } + ] + } + } + ], + "body": { + "type": "BlockStatement", + "start":58,"end":60,"loc":{"start":{"line":2,"column":36},"end":{"line":2,"column":38}}, + "body": [], + "directives": [] + } + } + } + ], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/await-inside-arguments-of-async-function-call/output.json b/packages/babel-parser/test/fixtures/es2017/async-functions/await-inside-arguments-of-async-function-call/output.json index 39c5735ec936..316c54dd43e6 100644 --- a/packages/babel-parser/test/fixtures/es2017/async-functions/await-inside-arguments-of-async-function-call/output.json +++ b/packages/babel-parser/test/fixtures/es2017/async-functions/await-inside-arguments-of-async-function-call/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 45, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":45,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 45, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":45,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 45, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":45,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "id": { "type": "Identifier", - "start": 15, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 17 - }, - "identifierName": "fn" - }, + "start":15,"end":17,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":17},"identifierName":"fn"}, "name": "fn" }, "generator": false, @@ -65,125 +20,35 @@ "params": [], "body": { "type": "BlockStatement", - "start": 20, - "end": 45, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":20,"end":45,"loc":{"start":{"line":1,"column":20},"end":{"line":3,"column":1}}, "body": [ { "type": "ExpressionStatement", - "start": 24, - "end": 43, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 21 - } - }, + "start":24,"end":43,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":21}}, "expression": { "type": "CallExpression", - "start": 24, - "end": 42, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 20 - } - }, + "start":24,"end":42,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":20}}, "callee": { "type": "Identifier", - "start": 24, - "end": 29, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 7 - }, - "identifierName": "async" - }, + "start":24,"end":29,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":7},"identifierName":"async"}, "name": "async" }, "arguments": [ { "type": "AssignmentExpression", - "start": 30, - "end": 41, - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 19 - } - }, + "start":30,"end":41,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":19}}, "operator": "=", "left": { "type": "Identifier", - "start": 30, - "end": 31, - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 9 - }, - "identifierName": "x" - }, + "start":30,"end":31,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":9},"identifierName":"x"}, "name": "x" }, "right": { "type": "AwaitExpression", - "start": 34, - "end": 41, - "loc": { - "start": { - "line": 2, - "column": 12 - }, - "end": { - "line": 2, - "column": 19 - } - }, + "start":34,"end":41,"loc":{"start":{"line":2,"column":12},"end":{"line":2,"column":19}}, "argument": { "type": "NumericLiteral", - "start": 40, - "end": 41, - "loc": { - "start": { - "line": 2, - "column": 18 - }, - "end": { - "line": 2, - "column": 19 - } - }, + "start":40,"end":41,"loc":{"start":{"line":2,"column":18},"end":{"line":2,"column":19}}, "extra": { "rawValue": 2, "raw": "2" diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/await-inside-arrow-identifier-allowed/output.json b/packages/babel-parser/test/fixtures/es2017/async-functions/await-inside-arrow-identifier-allowed/output.json index f6ca7cfa0d20..efe20a5c6b63 100644 --- a/packages/babel-parser/test/fixtures/es2017/async-functions/await-inside-arrow-identifier-allowed/output.json +++ b/packages/babel-parser/test/fixtures/es2017/async-functions/await-inside-arrow-identifier-allowed/output.json @@ -1,110 +1,32 @@ { "type": "File", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "program": { "type": "Program", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "expression": { "type": "ArrowFunctionExpression", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "id": null, "generator": false, "async": false, "params": [], "body": { "type": "BlockStatement", - "start": 6, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":6,"end":15,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":15}}, "body": [ { "type": "ExpressionStatement", - "start": 8, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":8,"end":13,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":13}}, "expression": { "type": "Identifier", - "start": 8, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 13 - }, - "identifierName": "await" - }, + "start":8,"end":13,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":13},"identifierName":"await"}, "name": "await" } } diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/await-inside-async-call-inside-parameters-of-function-inside-async-function/input.js b/packages/babel-parser/test/fixtures/es2017/async-functions/await-inside-async-call-inside-parameters-of-function-inside-async-function/input.js new file mode 100644 index 000000000000..1c99cb921526 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2017/async-functions/await-inside-async-call-inside-parameters-of-function-inside-async-function/input.js @@ -0,0 +1,3 @@ +async function f() { + function g(x = async(await)) {} +} diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/await-inside-async-call-inside-parameters-of-function-inside-async-function/output.json b/packages/babel-parser/test/fixtures/es2017/async-functions/await-inside-async-call-inside-parameters-of-function-inside-async-function/output.json new file mode 100644 index 000000000000..85fbbd7594c6 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2017/async-functions/await-inside-async-call-inside-parameters-of-function-inside-async-function/output.json @@ -0,0 +1,76 @@ +{ + "type": "File", + "start":0,"end":56,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "program": { + "type": "Program", + "start":0,"end":56,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":56,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "id": { + "type": "Identifier", + "start":15,"end":16,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":16},"identifierName":"f"}, + "name": "f" + }, + "generator": false, + "async": true, + "params": [], + "body": { + "type": "BlockStatement", + "start":19,"end":56,"loc":{"start":{"line":1,"column":19},"end":{"line":3,"column":1}}, + "body": [ + { + "type": "FunctionDeclaration", + "start":23,"end":54,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":33}}, + "id": { + "type": "Identifier", + "start":32,"end":33,"loc":{"start":{"line":2,"column":11},"end":{"line":2,"column":12},"identifierName":"g"}, + "name": "g" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "AssignmentPattern", + "start":34,"end":50,"loc":{"start":{"line":2,"column":13},"end":{"line":2,"column":29}}, + "left": { + "type": "Identifier", + "start":34,"end":35,"loc":{"start":{"line":2,"column":13},"end":{"line":2,"column":14},"identifierName":"x"}, + "name": "x" + }, + "right": { + "type": "CallExpression", + "start":38,"end":50,"loc":{"start":{"line":2,"column":17},"end":{"line":2,"column":29}}, + "callee": { + "type": "Identifier", + "start":38,"end":43,"loc":{"start":{"line":2,"column":17},"end":{"line":2,"column":22},"identifierName":"async"}, + "name": "async" + }, + "arguments": [ + { + "type": "Identifier", + "start":44,"end":49,"loc":{"start":{"line":2,"column":23},"end":{"line":2,"column":28},"identifierName":"await"}, + "name": "await" + } + ] + } + } + ], + "body": { + "type": "BlockStatement", + "start":52,"end":54,"loc":{"start":{"line":2,"column":31},"end":{"line":2,"column":33}}, + "body": [], + "directives": [] + } + } + ], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/await-inside-class-methods/input.js b/packages/babel-parser/test/fixtures/es2017/async-functions/await-inside-class-methods/input.js new file mode 100644 index 000000000000..7a48dfc20087 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2017/async-functions/await-inside-class-methods/input.js @@ -0,0 +1,3 @@ +() => class { + async m() { await 42 } +} diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/await-inside-class-methods/output.json b/packages/babel-parser/test/fixtures/es2017/async-functions/await-inside-class-methods/output.json new file mode 100644 index 000000000000..4466a94f87a5 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2017/async-functions/await-inside-class-methods/output.json @@ -0,0 +1,77 @@ +{ + "type": "File", + "start":0,"end":40,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "program": { + "type": "Program", + "start":0,"end":40,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":40,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "expression": { + "type": "ArrowFunctionExpression", + "start":0,"end":40,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "ClassExpression", + "start":6,"end":40,"loc":{"start":{"line":1,"column":6},"end":{"line":3,"column":1}}, + "id": null, + "superClass": null, + "body": { + "type": "ClassBody", + "start":12,"end":40,"loc":{"start":{"line":1,"column":12},"end":{"line":3,"column":1}}, + "body": [ + { + "type": "ClassMethod", + "start":16,"end":38,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":24}}, + "static": false, + "key": { + "type": "Identifier", + "start":22,"end":23,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":9},"identifierName":"m"}, + "name": "m" + }, + "computed": false, + "kind": "method", + "id": null, + "generator": false, + "async": true, + "params": [], + "body": { + "type": "BlockStatement", + "start":26,"end":38,"loc":{"start":{"line":2,"column":12},"end":{"line":2,"column":24}}, + "body": [ + { + "type": "ExpressionStatement", + "start":28,"end":36,"loc":{"start":{"line":2,"column":14},"end":{"line":2,"column":22}}, + "expression": { + "type": "AwaitExpression", + "start":28,"end":36,"loc":{"start":{"line":2,"column":14},"end":{"line":2,"column":22}}, + "argument": { + "type": "NumericLiteral", + "start":34,"end":36,"loc":{"start":{"line":2,"column":20},"end":{"line":2,"column":22}}, + "extra": { + "rawValue": 42, + "raw": "42" + }, + "value": 42 + } + } + } + ], + "directives": [] + } + } + ] + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/await-inside-computed-class-property/input.js b/packages/babel-parser/test/fixtures/es2017/async-functions/await-inside-computed-class-property/input.js new file mode 100644 index 000000000000..d18a372142f7 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2017/async-functions/await-inside-computed-class-property/input.js @@ -0,0 +1,3 @@ +async () => class { + [await 42]() { } +} diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/await-inside-computed-class-property/output.json b/packages/babel-parser/test/fixtures/es2017/async-functions/await-inside-computed-class-property/output.json new file mode 100644 index 000000000000..aacdba1de7c3 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2017/async-functions/await-inside-computed-class-property/output.json @@ -0,0 +1,67 @@ +{ + "type": "File", + "start":0,"end":40,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "program": { + "type": "Program", + "start":0,"end":40,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":40,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "expression": { + "type": "ArrowFunctionExpression", + "start":0,"end":40,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "id": null, + "generator": false, + "async": true, + "params": [], + "body": { + "type": "ClassExpression", + "start":12,"end":40,"loc":{"start":{"line":1,"column":12},"end":{"line":3,"column":1}}, + "id": null, + "superClass": null, + "body": { + "type": "ClassBody", + "start":18,"end":40,"loc":{"start":{"line":1,"column":18},"end":{"line":3,"column":1}}, + "body": [ + { + "type": "ClassMethod", + "start":22,"end":38,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":18}}, + "static": false, + "computed": true, + "key": { + "type": "AwaitExpression", + "start":23,"end":31,"loc":{"start":{"line":2,"column":3},"end":{"line":2,"column":11}}, + "argument": { + "type": "NumericLiteral", + "start":29,"end":31,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":11}}, + "extra": { + "rawValue": 42, + "raw": "42" + }, + "value": 42 + } + }, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":35,"end":38,"loc":{"start":{"line":2,"column":15},"end":{"line":2,"column":18}}, + "body": [], + "directives": [] + } + } + ] + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/await-inside-parameters-of-nested-arrow-function/options.json b/packages/babel-parser/test/fixtures/es2017/async-functions/await-inside-parameters-of-nested-arrow-function/options.json deleted file mode 100644 index 7cec39290c2a..000000000000 --- a/packages/babel-parser/test/fixtures/es2017/async-functions/await-inside-parameters-of-nested-arrow-function/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Await cannot be used as name inside an async function (2:7)" -} diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/await-inside-parameters-of-nested-arrow-function/output.json b/packages/babel-parser/test/fixtures/es2017/async-functions/await-inside-parameters-of-nested-arrow-function/output.json new file mode 100644 index 000000000000..46e14510807e --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2017/async-functions/await-inside-parameters-of-nested-arrow-function/output.json @@ -0,0 +1,76 @@ +{ + "type": "File", + "start":0,"end":46,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "errors": [ + "SyntaxError: Await cannot be used as name inside an async function (2:7)" + ], + "program": { + "type": "Program", + "start":0,"end":46,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":46,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "id": { + "type": "Identifier", + "start":15,"end":17,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":17},"identifierName":"fn"}, + "name": "fn" + }, + "generator": false, + "async": true, + "params": [], + "body": { + "type": "BlockStatement", + "start":20,"end":46,"loc":{"start":{"line":1,"column":20},"end":{"line":3,"column":1}}, + "body": [ + { + "type": "ExpressionStatement", + "start":24,"end":44,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":22}}, + "expression": { + "type": "ArrowFunctionExpression", + "start":24,"end":43,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":21}}, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "AssignmentPattern", + "start":25,"end":36,"loc":{"start":{"line":2,"column":3},"end":{"line":2,"column":14}}, + "left": { + "type": "Identifier", + "start":25,"end":26,"loc":{"start":{"line":2,"column":3},"end":{"line":2,"column":4},"identifierName":"x"}, + "name": "x" + }, + "right": { + "type": "AwaitExpression", + "start":29,"end":36,"loc":{"start":{"line":2,"column":7},"end":{"line":2,"column":14}}, + "argument": { + "type": "NumericLiteral", + "start":35,"end":36,"loc":{"start":{"line":2,"column":13},"end":{"line":2,"column":14}}, + "extra": { + "rawValue": 2, + "raw": "2" + }, + "value": 2 + } + } + } + ], + "body": { + "type": "BlockStatement", + "start":41,"end":43,"loc":{"start":{"line":2,"column":19},"end":{"line":2,"column":21}}, + "body": [], + "directives": [] + } + } + } + ], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/await-inside-parameters-of-nested-async-arrow-function/options.json b/packages/babel-parser/test/fixtures/es2017/async-functions/await-inside-parameters-of-nested-async-arrow-function/options.json deleted file mode 100644 index b45bba7cab4a..000000000000 --- a/packages/babel-parser/test/fixtures/es2017/async-functions/await-inside-parameters-of-nested-async-arrow-function/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Await cannot be used as name inside an async function (2:13)" -} diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/await-inside-parameters-of-nested-async-arrow-function/output.json b/packages/babel-parser/test/fixtures/es2017/async-functions/await-inside-parameters-of-nested-async-arrow-function/output.json new file mode 100644 index 000000000000..da4bfb18b9e8 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2017/async-functions/await-inside-parameters-of-nested-async-arrow-function/output.json @@ -0,0 +1,76 @@ +{ + "type": "File", + "start":0,"end":52,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "errors": [ + "SyntaxError: Await cannot be used as name inside an async function (2:13)" + ], + "program": { + "type": "Program", + "start":0,"end":52,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":52,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "id": { + "type": "Identifier", + "start":15,"end":17,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":17},"identifierName":"fn"}, + "name": "fn" + }, + "generator": false, + "async": true, + "params": [], + "body": { + "type": "BlockStatement", + "start":20,"end":52,"loc":{"start":{"line":1,"column":20},"end":{"line":3,"column":1}}, + "body": [ + { + "type": "ExpressionStatement", + "start":24,"end":50,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":28}}, + "expression": { + "type": "ArrowFunctionExpression", + "start":24,"end":49,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":27}}, + "id": null, + "generator": false, + "async": true, + "params": [ + { + "type": "AssignmentPattern", + "start":31,"end":42,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":20}}, + "left": { + "type": "Identifier", + "start":31,"end":32,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":10},"identifierName":"x"}, + "name": "x" + }, + "right": { + "type": "AwaitExpression", + "start":35,"end":42,"loc":{"start":{"line":2,"column":13},"end":{"line":2,"column":20}}, + "argument": { + "type": "NumericLiteral", + "start":41,"end":42,"loc":{"start":{"line":2,"column":19},"end":{"line":2,"column":20}}, + "extra": { + "rawValue": 2, + "raw": "2" + }, + "value": 2 + } + } + } + ], + "body": { + "type": "BlockStatement", + "start":47,"end":49,"loc":{"start":{"line":2,"column":25},"end":{"line":2,"column":27}}, + "body": [], + "directives": [] + } + } + } + ], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/await-inside-parameters/options.json b/packages/babel-parser/test/fixtures/es2017/async-functions/await-inside-parameters/options.json deleted file mode 100644 index f4af75f31164..000000000000 --- a/packages/babel-parser/test/fixtures/es2017/async-functions/await-inside-parameters/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "await is not allowed in async function parameters (1:22)" -} diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/await-inside-parameters/output.json b/packages/babel-parser/test/fixtures/es2017/async-functions/await-inside-parameters/output.json new file mode 100644 index 000000000000..fcf89fb5daef --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2017/async-functions/await-inside-parameters/output.json @@ -0,0 +1,57 @@ +{ + "type": "File", + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, + "errors": [ + "SyntaxError: await is not allowed in async function parameters (1:22)" + ], + "program": { + "type": "Program", + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, + "id": { + "type": "Identifier", + "start":15,"end":17,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":17},"identifierName":"fn"}, + "name": "fn" + }, + "generator": false, + "async": true, + "params": [ + { + "type": "AssignmentPattern", + "start":18,"end":29,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":29}}, + "left": { + "type": "Identifier", + "start":18,"end":19,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":19},"identifierName":"x"}, + "name": "x" + }, + "right": { + "type": "AwaitExpression", + "start":22,"end":29,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":29}}, + "argument": { + "type": "NumericLiteral", + "start":28,"end":29,"loc":{"start":{"line":1,"column":28},"end":{"line":1,"column":29}}, + "extra": { + "rawValue": 2, + "raw": "2" + }, + "value": 2 + } + } + } + ], + "body": { + "type": "BlockStatement", + "start":31,"end":33,"loc":{"start":{"line":1,"column":31},"end":{"line":1,"column":33}}, + "body": [], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/await-inside-parenthesized-assign/output.json b/packages/babel-parser/test/fixtures/es2017/async-functions/await-inside-parenthesized-assign/output.json index 76cec56e0208..d15d303d4099 100644 --- a/packages/babel-parser/test/fixtures/es2017/async-functions/await-inside-parenthesized-assign/output.json +++ b/packages/babel-parser/test/fixtures/es2017/async-functions/await-inside-parenthesized-assign/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":40,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":40,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":40,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "id": { "type": "Identifier", - "start": 15, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 17 - }, - "identifierName": "fn" - }, + "start":15,"end":17,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":17},"identifierName":"fn"}, "name": "fn" }, "generator": false, @@ -65,93 +20,26 @@ "params": [], "body": { "type": "BlockStatement", - "start": 20, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":20,"end":40,"loc":{"start":{"line":1,"column":20},"end":{"line":3,"column":1}}, "body": [ { "type": "ExpressionStatement", - "start": 24, - "end": 38, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 16 - } - }, + "start":24,"end":38,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":16}}, "expression": { "type": "AssignmentExpression", - "start": 25, - "end": 36, - "loc": { - "start": { - "line": 2, - "column": 3 - }, - "end": { - "line": 2, - "column": 14 - } - }, + "start":25,"end":36,"loc":{"start":{"line":2,"column":3},"end":{"line":2,"column":14}}, "operator": "=", "left": { "type": "Identifier", - "start": 25, - "end": 26, - "loc": { - "start": { - "line": 2, - "column": 3 - }, - "end": { - "line": 2, - "column": 4 - }, - "identifierName": "x" - }, + "start":25,"end":26,"loc":{"start":{"line":2,"column":3},"end":{"line":2,"column":4},"identifierName":"x"}, "name": "x" }, "right": { "type": "AwaitExpression", - "start": 29, - "end": 36, - "loc": { - "start": { - "line": 2, - "column": 7 - }, - "end": { - "line": 2, - "column": 14 - } - }, + "start":29,"end":36,"loc":{"start":{"line":2,"column":7},"end":{"line":2,"column":14}}, "argument": { "type": "NumericLiteral", - "start": 35, - "end": 36, - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 14 - } - }, + "start":35,"end":36,"loc":{"start":{"line":2,"column":13},"end":{"line":2,"column":14}}, "extra": { "rawValue": 2, "raw": "2" diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/await-object-key-inside-arrow-params-inside-async-arrow-params copy/input.js b/packages/babel-parser/test/fixtures/es2017/async-functions/await-object-key-inside-arrow-params-inside-async-arrow-params copy/input.js new file mode 100644 index 000000000000..72058aa6dd6b --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2017/async-functions/await-object-key-inside-arrow-params-inside-async-arrow-params copy/input.js @@ -0,0 +1 @@ +async (a = ({ await: x }) => {}) => {}; diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/await-object-key-inside-arrow-params-inside-async-arrow-params copy/output.json b/packages/babel-parser/test/fixtures/es2017/async-functions/await-object-key-inside-arrow-params-inside-async-arrow-params copy/output.json new file mode 100644 index 000000000000..22b6c9ddd0fe --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2017/async-functions/await-object-key-inside-arrow-params-inside-async-arrow-params copy/output.json @@ -0,0 +1,79 @@ +{ + "type": "File", + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":39}}, + "program": { + "type": "Program", + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":39}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":39}}, + "expression": { + "type": "ArrowFunctionExpression", + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":38}}, + "id": null, + "generator": false, + "async": true, + "params": [ + { + "type": "AssignmentPattern", + "start":7,"end":31,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":31}}, + "left": { + "type": "Identifier", + "start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8},"identifierName":"a"}, + "name": "a" + }, + "right": { + "type": "ArrowFunctionExpression", + "start":11,"end":31,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":31}}, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "ObjectPattern", + "start":12,"end":24,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":24}}, + "properties": [ + { + "type": "ObjectProperty", + "start":14,"end":22,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":22}}, + "method": false, + "key": { + "type": "Identifier", + "start":14,"end":19,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":19},"identifierName":"await"}, + "name": "await" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "Identifier", + "start":21,"end":22,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":22},"identifierName":"x"}, + "name": "x" + } + } + ] + } + ], + "body": { + "type": "BlockStatement", + "start":29,"end":31,"loc":{"start":{"line":1,"column":29},"end":{"line":1,"column":31}}, + "body": [], + "directives": [] + } + } + } + ], + "body": { + "type": "BlockStatement", + "start":36,"end":38,"loc":{"start":{"line":1,"column":36},"end":{"line":1,"column":38}}, + "body": [], + "directives": [] + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/context-division-after-expression/input.js b/packages/babel-parser/test/fixtures/es2017/async-functions/context-division-after-expression/input.js new file mode 100644 index 000000000000..1415f9866a40 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2017/async-functions/context-division-after-expression/input.js @@ -0,0 +1,2 @@ +void async function fn() {} +/foo/g \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/context-division-after-expression/output.json b/packages/babel-parser/test/fixtures/es2017/async-functions/context-division-after-expression/output.json new file mode 100644 index 000000000000..790c225cc266 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2017/async-functions/context-division-after-expression/output.json @@ -0,0 +1,61 @@ +{ + "type": "File", + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":6}}, + "program": { + "type": "Program", + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":6}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":6}}, + "expression": { + "type": "BinaryExpression", + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":6}}, + "left": { + "type": "BinaryExpression", + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":4}}, + "left": { + "type": "UnaryExpression", + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, + "operator": "void", + "prefix": true, + "argument": { + "type": "FunctionExpression", + "start":5,"end":27,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":27}}, + "id": { + "type": "Identifier", + "start":20,"end":22,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":22},"identifierName":"fn"}, + "name": "fn" + }, + "generator": false, + "async": true, + "params": [], + "body": { + "type": "BlockStatement", + "start":25,"end":27,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":27}}, + "body": [], + "directives": [] + } + } + }, + "operator": "/", + "right": { + "type": "Identifier", + "start":29,"end":32,"loc":{"start":{"line":2,"column":1},"end":{"line":2,"column":4},"identifierName":"foo"}, + "name": "foo" + } + }, + "operator": "/", + "right": { + "type": "Identifier", + "start":33,"end":34,"loc":{"start":{"line":2,"column":5},"end":{"line":2,"column":6},"identifierName":"g"}, + "name": "g" + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/context-regex-after-statement/input.js b/packages/babel-parser/test/fixtures/es2017/async-functions/context-regex-after-statement/input.js new file mode 100644 index 000000000000..beb4d4ea4675 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2017/async-functions/context-regex-after-statement/input.js @@ -0,0 +1,2 @@ +async function fn() {} +/foo/g \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/context-regex-after-statement/output.json b/packages/babel-parser/test/fixtures/es2017/async-functions/context-regex-after-statement/output.json new file mode 100644 index 000000000000..0e40e99acd88 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2017/async-functions/context-regex-after-statement/output.json @@ -0,0 +1,44 @@ +{ + "type": "File", + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":6}}, + "program": { + "type": "Program", + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":6}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, + "id": { + "type": "Identifier", + "start":15,"end":17,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":17},"identifierName":"fn"}, + "name": "fn" + }, + "generator": false, + "async": true, + "params": [], + "body": { + "type": "BlockStatement", + "start":20,"end":22,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":22}}, + "body": [], + "directives": [] + } + }, + { + "type": "ExpressionStatement", + "start":23,"end":29,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":6}}, + "expression": { + "type": "RegExpLiteral", + "start":23,"end":29,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":6}}, + "extra": { + "raw": "/foo/g" + }, + "pattern": "foo", + "flags": "g" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/export-arrow/output.json b/packages/babel-parser/test/fixtures/es2017/async-functions/export-arrow/output.json index acea8f1a29f9..ae0b862723ed 100644 --- a/packages/babel-parser/test/fixtures/es2017/async-functions/export-arrow/output.json +++ b/packages/babel-parser/test/fixtures/es2017/async-functions/export-arrow/output.json @@ -1,109 +1,31 @@ { "type": "File", - "start": 0, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":38}}, "program": { "type": "Program", - "start": 0, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":38}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExportDefaultDeclaration", - "start": 0, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":38}}, "declaration": { "type": "ArrowFunctionExpression", - "start": 15, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":15,"end":38,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":38}}, "id": null, "generator": false, "async": true, "params": [], "body": { "type": "AwaitExpression", - "start": 27, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":27,"end":38,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":38}}, "argument": { "type": "CallExpression", - "start": 33, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 33 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":33,"end":38,"loc":{"start":{"line":1,"column":33},"end":{"line":1,"column":38}}, "callee": { "type": "Identifier", - "start": 33, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 33 - }, - "end": { - "line": 1, - "column": 36 - }, - "identifierName": "foo" - }, + "start":33,"end":36,"loc":{"start":{"line":1,"column":33},"end":{"line":1,"column":36},"identifierName":"foo"}, "name": "foo" }, "arguments": [] diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/export-default-newline/output.json b/packages/babel-parser/test/fixtures/es2017/async-functions/export-default-newline/output.json index 9179ea920b9e..0f8838870ace 100644 --- a/packages/babel-parser/test/fixtures/es2017/async-functions/export-default-newline/output.json +++ b/packages/babel-parser/test/fixtures/es2017/async-functions/export-default-newline/output.json @@ -1,95 +1,27 @@ { "type": "File", - "start": 0, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 17 - } - }, + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":17}}, "program": { "type": "Program", - "start": 0, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 17 - } - }, + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":17}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExportDefaultDeclaration", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, "declaration": { "type": "Identifier", - "start": 15, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 20 - }, - "identifierName": "async" - }, + "start":15,"end":20,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":20},"identifierName":"async"}, "name": "async" } }, { "type": "FunctionDeclaration", - "start": 21, - "end": 38, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 17 - } - }, + "start":21,"end":38,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":17}}, "id": { "type": "Identifier", - "start": 30, - "end": 33, - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 12 - }, - "identifierName": "bar" - }, + "start":30,"end":33,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":12},"identifierName":"bar"}, "name": "bar" }, "generator": false, @@ -97,18 +29,7 @@ "params": [], "body": { "type": "BlockStatement", - "start": 36, - "end": 38, - "loc": { - "start": { - "line": 2, - "column": 15 - }, - "end": { - "line": 2, - "column": 17 - } - }, + "start":36,"end":38,"loc":{"start":{"line":2,"column":15},"end":{"line":2,"column":17}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/export/output.json b/packages/babel-parser/test/fixtures/es2017/async-functions/export/output.json index 25a3bfc7d1b8..91120752ac78 100644 --- a/packages/babel-parser/test/fixtures/es2017/async-functions/export/output.json +++ b/packages/babel-parser/test/fixtures/es2017/async-functions/export/output.json @@ -1,79 +1,23 @@ { "type": "File", - "start": 0, - "end": 69, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 38 - } - }, + "start":0,"end":69,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":38}}, "program": { "type": "Program", - "start": 0, - "end": 69, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 38 - } - }, + "start":0,"end":69,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":38}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExportNamedDeclaration", - "start": 0, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, "specifiers": [], "source": null, "declaration": { "type": "FunctionDeclaration", - "start": 7, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":7,"end":30,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":30}}, "id": { "type": "Identifier", - "start": 22, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 25 - }, - "identifierName": "foo" - }, + "start":22,"end":25,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":25},"identifierName":"foo"}, "name": "foo" }, "generator": false, @@ -81,18 +25,7 @@ "params": [], "body": { "type": "BlockStatement", - "start": 28, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":28,"end":30,"loc":{"start":{"line":1,"column":28},"end":{"line":1,"column":30}}, "body": [], "directives": [] } @@ -100,47 +33,13 @@ }, { "type": "ExportDefaultDeclaration", - "start": 31, - "end": 69, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 38 - } - }, + "start":31,"end":69,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":38}}, "declaration": { "type": "FunctionDeclaration", - "start": 46, - "end": 69, - "loc": { - "start": { - "line": 2, - "column": 15 - }, - "end": { - "line": 2, - "column": 38 - } - }, + "start":46,"end":69,"loc":{"start":{"line":2,"column":15},"end":{"line":2,"column":38}}, "id": { "type": "Identifier", - "start": 61, - "end": 64, - "loc": { - "start": { - "line": 2, - "column": 30 - }, - "end": { - "line": 2, - "column": 33 - }, - "identifierName": "bar" - }, + "start":61,"end":64,"loc":{"start":{"line":2,"column":30},"end":{"line":2,"column":33},"identifierName":"bar"}, "name": "bar" }, "generator": false, @@ -148,18 +47,7 @@ "params": [], "body": { "type": "BlockStatement", - "start": 67, - "end": 69, - "loc": { - "start": { - "line": 2, - "column": 36 - }, - "end": { - "line": 2, - "column": 38 - } - }, + "start":67,"end":69,"loc":{"start":{"line":2,"column":36},"end":{"line":2,"column":38}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/invalid-escape-async-class-method/options.json b/packages/babel-parser/test/fixtures/es2017/async-functions/invalid-escape-async-class-method/options.json index b81bee7fa2e4..3e7adc2e54dd 100644 --- a/packages/babel-parser/test/fixtures/es2017/async-functions/invalid-escape-async-class-method/options.json +++ b/packages/babel-parser/test/fixtures/es2017/async-functions/invalid-escape-async-class-method/options.json @@ -1,3 +1,3 @@ { "throws": "Unexpected token (1:21)" -} \ No newline at end of file +} diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/invalid-escape-async-obj-method/options.json b/packages/babel-parser/test/fixtures/es2017/async-functions/invalid-escape-async-obj-method/options.json index f0907a448458..4f0d43b57042 100644 --- a/packages/babel-parser/test/fixtures/es2017/async-functions/invalid-escape-async-obj-method/options.json +++ b/packages/babel-parser/test/fixtures/es2017/async-functions/invalid-escape-async-obj-method/options.json @@ -1,3 +1,3 @@ { "throws": "Unexpected token, expected \",\" (1:14)" -} \ No newline at end of file +} diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/invalid-escape-async-static-class-method/options.json b/packages/babel-parser/test/fixtures/es2017/async-functions/invalid-escape-async-static-class-method/options.json index f55830c1c373..c7dd7266de69 100644 --- a/packages/babel-parser/test/fixtures/es2017/async-functions/invalid-escape-async-static-class-method/options.json +++ b/packages/babel-parser/test/fixtures/es2017/async-functions/invalid-escape-async-static-class-method/options.json @@ -1,3 +1,3 @@ { "throws": "Unexpected token (1:28)" -} \ No newline at end of file +} diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/invalid-escape-await/options.json b/packages/babel-parser/test/fixtures/es2017/async-functions/invalid-escape-await/options.json index ac6c5914cec6..1cd92c2a1ffd 100644 --- a/packages/babel-parser/test/fixtures/es2017/async-functions/invalid-escape-await/options.json +++ b/packages/babel-parser/test/fixtures/es2017/async-functions/invalid-escape-await/options.json @@ -1,3 +1,3 @@ { - "throws": "Can not use 'await' as identifier inside an async function (1:20)" -} \ No newline at end of file + "throws": "Unexpected token, expected \";\" (1:31)" +} diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/invalid-escape-export-async-function/options.json b/packages/babel-parser/test/fixtures/es2017/async-functions/invalid-escape-export-async-function/options.json index 9d60866b80c3..f2ecbd9741e7 100644 --- a/packages/babel-parser/test/fixtures/es2017/async-functions/invalid-escape-export-async-function/options.json +++ b/packages/babel-parser/test/fixtures/es2017/async-functions/invalid-escape-export-async-function/options.json @@ -1,3 +1,3 @@ { "throws": "Unexpected token, expected \"{\" (1:7)" -} \ No newline at end of file +} diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/invalid-escape-export-dflt-async-function/options.json b/packages/babel-parser/test/fixtures/es2017/async-functions/invalid-escape-export-dflt-async-function/options.json index b0e5516212f3..1e1812883385 100644 --- a/packages/babel-parser/test/fixtures/es2017/async-functions/invalid-escape-export-dflt-async-function/options.json +++ b/packages/babel-parser/test/fixtures/es2017/async-functions/invalid-escape-export-dflt-async-function/options.json @@ -1,3 +1,3 @@ { "throws": "Unexpected token, expected \";\" (1:26)" -} \ No newline at end of file +} diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/invalid-escape-sequence-arrow-list/options.json b/packages/babel-parser/test/fixtures/es2017/async-functions/invalid-escape-sequence-arrow-list/options.json index 0cd822570731..99a2bc92f2c0 100644 --- a/packages/babel-parser/test/fixtures/es2017/async-functions/invalid-escape-sequence-arrow-list/options.json +++ b/packages/babel-parser/test/fixtures/es2017/async-functions/invalid-escape-sequence-arrow-list/options.json @@ -1,3 +1,3 @@ { "throws": "Unexpected token, expected \",\" (1:12)" -} \ No newline at end of file +} diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/invalid-escape-sequence-arrow/options.json b/packages/babel-parser/test/fixtures/es2017/async-functions/invalid-escape-sequence-arrow/options.json index f6eb197b1dd8..b98beb83593e 100644 --- a/packages/babel-parser/test/fixtures/es2017/async-functions/invalid-escape-sequence-arrow/options.json +++ b/packages/babel-parser/test/fixtures/es2017/async-functions/invalid-escape-sequence-arrow/options.json @@ -1,3 +1,3 @@ { "throws": "Unexpected token, expected \";\" (1:11)" -} \ No newline at end of file +} diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/invalid-escape-sequence-function-list/options.json b/packages/babel-parser/test/fixtures/es2017/async-functions/invalid-escape-sequence-function-list/options.json index 0cd822570731..99a2bc92f2c0 100644 --- a/packages/babel-parser/test/fixtures/es2017/async-functions/invalid-escape-sequence-function-list/options.json +++ b/packages/babel-parser/test/fixtures/es2017/async-functions/invalid-escape-sequence-function-list/options.json @@ -1,3 +1,3 @@ { "throws": "Unexpected token, expected \",\" (1:12)" -} \ No newline at end of file +} diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/invalid-escape-sequence-function/options.json b/packages/babel-parser/test/fixtures/es2017/async-functions/invalid-escape-sequence-function/options.json index f6eb197b1dd8..b98beb83593e 100644 --- a/packages/babel-parser/test/fixtures/es2017/async-functions/invalid-escape-sequence-function/options.json +++ b/packages/babel-parser/test/fixtures/es2017/async-functions/invalid-escape-sequence-function/options.json @@ -1,3 +1,3 @@ { "throws": "Unexpected token, expected \";\" (1:11)" -} \ No newline at end of file +} diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/invalid-inside-loop/options.json b/packages/babel-parser/test/fixtures/es2017/async-functions/invalid-inside-loop/options.json deleted file mode 100644 index 4bcd823e98be..000000000000 --- a/packages/babel-parser/test/fixtures/es2017/async-functions/invalid-inside-loop/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Async functions can only be declared at the top level or inside a block (1:10)" -} diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/invalid-inside-loop/output.json b/packages/babel-parser/test/fixtures/es2017/async-functions/invalid-inside-loop/output.json new file mode 100644 index 000000000000..139be62a2f65 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2017/async-functions/invalid-inside-loop/output.json @@ -0,0 +1,47 @@ +{ + "type": "File", + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, + "errors": [ + "SyntaxError: Async functions can only be declared at the top level or inside a block (1:10)" + ], + "program": { + "type": "Program", + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "WhileStatement", + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, + "test": { + "type": "NumericLiteral", + "start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8}}, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + }, + "body": { + "type": "FunctionDeclaration", + "start":10,"end":32,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":32}}, + "id": { + "type": "Identifier", + "start":25,"end":28,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":28},"identifierName":"foo"}, + "name": "foo" + }, + "generator": false, + "async": true, + "params": [], + "body": { + "type": "BlockStatement", + "start":30,"end":32,"loc":{"start":{"line":1,"column":30},"end":{"line":1,"column":32}}, + "body": [], + "directives": [] + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/invalid-newline-after-params/options.json b/packages/babel-parser/test/fixtures/es2017/async-functions/invalid-newline-after-params/options.json index 0361d7c7d2b2..7d847e99c88e 100644 --- a/packages/babel-parser/test/fixtures/es2017/async-functions/invalid-newline-after-params/options.json +++ b/packages/babel-parser/test/fixtures/es2017/async-functions/invalid-newline-after-params/options.json @@ -1,3 +1,3 @@ { "throws": "Unexpected token (2:0)" -} \ No newline at end of file +} diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/invalid-parens-async-arrow/options.json b/packages/babel-parser/test/fixtures/es2017/async-functions/invalid-parens-async-arrow/options.json index f6eb197b1dd8..b98beb83593e 100644 --- a/packages/babel-parser/test/fixtures/es2017/async-functions/invalid-parens-async-arrow/options.json +++ b/packages/babel-parser/test/fixtures/es2017/async-functions/invalid-parens-async-arrow/options.json @@ -1,3 +1,3 @@ { "throws": "Unexpected token, expected \";\" (1:11)" -} \ No newline at end of file +} diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/invalid-parens-async-func/options.json b/packages/babel-parser/test/fixtures/es2017/async-functions/invalid-parens-async-func/options.json index c2fcdb08cf9f..cf30cd9156b7 100644 --- a/packages/babel-parser/test/fixtures/es2017/async-functions/invalid-parens-async-func/options.json +++ b/packages/babel-parser/test/fixtures/es2017/async-functions/invalid-parens-async-func/options.json @@ -1,3 +1,3 @@ { "throws": "Unexpected token, expected \";\" (1:8)" -} \ No newline at end of file +} diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/newline-arrow/output.json b/packages/babel-parser/test/fixtures/es2017/async-functions/newline-arrow/output.json index 4c44c118638d..fe6c0b495bb8 100644 --- a/packages/babel-parser/test/fixtures/es2017/async-functions/newline-arrow/output.json +++ b/packages/babel-parser/test/fixtures/es2017/async-functions/newline-arrow/output.json @@ -1,131 +1,40 @@ { "type": "File", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 6 - } - }, + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":6}}, "program": { "type": "Program", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 6 - } - }, + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":6}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "expression": { "type": "Identifier", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "async" - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5},"identifierName":"async"}, "name": "async" } }, { "type": "ExpressionStatement", - "start": 6, - "end": 12, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 6 - } - }, + "start":6,"end":12,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":6}}, "expression": { "type": "ArrowFunctionExpression", - "start": 6, - "end": 12, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 6 - } - }, + "start":6,"end":12,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":6}}, "id": null, "generator": false, "async": false, "params": [ { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 1 - }, - "identifierName": "x" - }, + "start":6,"end":7,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":1},"identifierName":"x"}, "name": "x" } ], "body": { "type": "Identifier", - "start": 11, - "end": 12, - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 6 - }, - "identifierName": "x" - }, + "start":11,"end":12,"loc":{"start":{"line":2,"column":5},"end":{"line":2,"column":6},"identifierName":"x"}, "name": "x" } } diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/newline/output.json b/packages/babel-parser/test/fixtures/es2017/async-functions/newline/output.json index bed2c37da9e6..3f90482d93e4 100644 --- a/packages/babel-parser/test/fixtures/es2017/async-functions/newline/output.json +++ b/packages/babel-parser/test/fixtures/es2017/async-functions/newline/output.json @@ -1,95 +1,27 @@ { "type": "File", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 18 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":18}}, "program": { "type": "Program", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 18 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":18}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "expression": { "type": "Identifier", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "async" - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5},"identifierName":"async"}, "name": "async" } }, { "type": "FunctionDeclaration", - "start": 6, - "end": 24, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 18 - } - }, + "start":6,"end":24,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":18}}, "id": { "type": "Identifier", - "start": 15, - "end": 18, - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 12 - }, - "identifierName": "foo" - }, + "start":15,"end":18,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":12},"identifierName":"foo"}, "name": "foo" }, "generator": false, @@ -97,18 +29,7 @@ "params": [], "body": { "type": "BlockStatement", - "start": 21, - "end": 24, - "loc": { - "start": { - "line": 2, - "column": 15 - }, - "end": { - "line": 2, - "column": 18 - } - }, + "start":21,"end":24,"loc":{"start":{"line":2,"column":15},"end":{"line":2,"column":18}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/no-constructor/options.json b/packages/babel-parser/test/fixtures/es2017/async-functions/no-constructor/options.json deleted file mode 100644 index 49a2f478c663..000000000000 --- a/packages/babel-parser/test/fixtures/es2017/async-functions/no-constructor/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Constructor can't be an async function (2:8)" -} diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/no-constructor/output.json b/packages/babel-parser/test/fixtures/es2017/async-functions/no-constructor/output.json new file mode 100644 index 000000000000..abbe3abb2682 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2017/async-functions/no-constructor/output.json @@ -0,0 +1,54 @@ +{ + "type": "File", + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "errors": [ + "SyntaxError: Constructor can't be an async function (2:8)" + ], + "program": { + "type": "Program", + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "id": { + "type": "Identifier", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":8,"end":36,"loc":{"start":{"line":1,"column":8},"end":{"line":3,"column":1}}, + "body": [ + { + "type": "ClassMethod", + "start":12,"end":34,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":24}}, + "static": false, + "key": { + "type": "Identifier", + "start":18,"end":29,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":19},"identifierName":"constructor"}, + "name": "constructor" + }, + "computed": false, + "kind": "method", + "id": null, + "generator": false, + "async": true, + "params": [], + "body": { + "type": "BlockStatement", + "start":32,"end":34,"loc":{"start":{"line":2,"column":22},"end":{"line":2,"column":24}}, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/object-default-params/output.json b/packages/babel-parser/test/fixtures/es2017/async-functions/object-default-params/output.json index 15647855a395..eacde0dd2515 100644 --- a/packages/babel-parser/test/fixtures/es2017/async-functions/object-default-params/output.json +++ b/packages/babel-parser/test/fixtures/es2017/async-functions/object-default-params/output.json @@ -1,192 +1,57 @@ { "type": "File", - "start": 0, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 37 - } - }, + "start":0,"end":37,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":37}}, "program": { "type": "Program", - "start": 0, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 37 - } - }, + "start":0,"end":37,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":37}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 37 - } - }, + "start":0,"end":37,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":37}}, "declarations": [ { "type": "VariableDeclarator", - "start": 6, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 37 - } - }, + "start":6,"end":37,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":37}}, "id": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "b" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"b"}, "name": "b" }, "init": { "type": "ArrowFunctionExpression", - "start": 10, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 37 - } - }, + "start":10,"end":37,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":37}}, "id": null, "generator": false, "async": true, "params": [ { "type": "ObjectPattern", - "start": 17, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":17,"end":30,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":30}}, "properties": [ { "type": "ObjectProperty", - "start": 18, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":18,"end":29,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":29}}, "method": false, "key": { "type": "Identifier", - "start": 18, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 21 - }, - "identifierName": "bar" - }, + "start":18,"end":21,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":21},"identifierName":"bar"}, "name": "bar" }, "computed": false, "shorthand": true, "value": { "type": "AssignmentPattern", - "start": 18, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":18,"end":29,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":29}}, "left": { "type": "Identifier", - "start": 18, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 21 - }, - "identifierName": "bar" - }, + "start":18,"end":21,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":21},"identifierName":"bar"}, "name": "bar" }, "right": { "type": "StringLiteral", - "start": 24, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":24,"end":29,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":29}}, "extra": { "rawValue": "bar", "raw": "\"bar\"" @@ -203,18 +68,7 @@ ], "body": { "type": "BlockStatement", - "start": 35, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 35 - }, - "end": { - "line": 1, - "column": 37 - } - }, + "start":35,"end":37,"loc":{"start":{"line":1,"column":35},"end":{"line":1,"column":37}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/params-invalid-rest-trailing-comma/options.json b/packages/babel-parser/test/fixtures/es2017/async-functions/params-invalid-rest-trailing-comma/options.json deleted file mode 100644 index f686fb60b45e..000000000000 --- a/packages/babel-parser/test/fixtures/es2017/async-functions/params-invalid-rest-trailing-comma/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Rest element must be last element (1:11)" -} diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/params-invalid-rest-trailing-comma/output.json b/packages/babel-parser/test/fixtures/es2017/async-functions/params-invalid-rest-trailing-comma/output.json new file mode 100644 index 000000000000..630b3e12ebc1 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2017/async-functions/params-invalid-rest-trailing-comma/output.json @@ -0,0 +1,44 @@ +{ + "type": "File", + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, + "errors": [ + "SyntaxError: Unexpected trailing comma after rest element (1:11)" + ], + "program": { + "type": "Program", + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, + "expression": { + "type": "ArrowFunctionExpression", + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, + "id": null, + "generator": false, + "async": true, + "params": [ + { + "type": "RestElement", + "start":7,"end":11,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":11}}, + "argument": { + "type": "Identifier", + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11},"identifierName":"a"}, + "name": "a" + } + } + ], + "body": { + "type": "BlockStatement", + "start":17,"end":19,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":19}}, + "body": [], + "directives": [] + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2017/trailing-function-commas/1/output.json b/packages/babel-parser/test/fixtures/es2017/trailing-function-commas/1/output.json index 2373fc85c177..8fe4e28db025 100644 --- a/packages/babel-parser/test/fixtures/es2017/trailing-function-commas/1/output.json +++ b/packages/babel-parser/test/fixtures/es2017/trailing-function-commas/1/output.json @@ -1,111 +1,35 @@ { "type": "File", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "program": { "type": "Program", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "expression": { "type": "CallExpression", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "callee": { "type": "Identifier", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - }, - "identifierName": "log" - }, + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3},"identifierName":"log"}, "name": "log" }, + "extra": { + "trailingComma": 13 + }, "arguments": [ { "type": "Identifier", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "n" - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"n"}, "name": "n" }, { "type": "StringLiteral", - "start": 7, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":7,"end":10,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":10}}, "extra": { "rawValue": "=", "raw": "'='" @@ -114,18 +38,7 @@ }, { "type": "NumericLiteral", - "start": 12, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":12,"end":13,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":13}}, "extra": { "rawValue": 2, "raw": "2" diff --git a/packages/babel-parser/test/fixtures/es2017/trailing-function-commas/2/output.json b/packages/babel-parser/test/fixtures/es2017/trailing-function-commas/2/output.json index b36b03f4095f..a09840875ef5 100644 --- a/packages/babel-parser/test/fixtures/es2017/trailing-function-commas/2/output.json +++ b/packages/babel-parser/test/fixtures/es2017/trailing-function-commas/2/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, "program": { "type": "Program", - "start": 0, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, "id": { "type": "Identifier", - "start": 9, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "log" - }, + "start":9,"end":12,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":12},"identifierName":"log"}, "name": "log" }, "generator": false, @@ -65,70 +20,23 @@ "params": [ { "type": "Identifier", - "start": 13, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - }, - "identifierName": "n" - }, + "start":13,"end":14,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":14},"identifierName":"n"}, "name": "n" }, { "type": "Identifier", - "start": 16, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 18 - }, - "identifierName": "op" - }, + "start":16,"end":18,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":18},"identifierName":"op"}, "name": "op" }, { "type": "Identifier", - "start": 20, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 23 - }, - "identifierName": "val" - }, + "start":20,"end":23,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":23},"identifierName":"val"}, "name": "val" } ], "body": { "type": "BlockStatement", - "start": 26, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":26,"end":29,"loc":{"start":{"line":1,"column":26},"end":{"line":1,"column":29}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/es2017/trailing-function-commas/3/output.json b/packages/babel-parser/test/fixtures/es2017/trailing-function-commas/3/output.json index e04f346772e2..530e87408664 100644 --- a/packages/babel-parser/test/fixtures/es2017/trailing-function-commas/3/output.json +++ b/packages/babel-parser/test/fixtures/es2017/trailing-function-commas/3/output.json @@ -1,111 +1,32 @@ { "type": "File", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, "program": { "type": "Program", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, "id": { "type": "Identifier", - "start": 6, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "Foo" - }, + "start":6,"end":9,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":9},"identifierName":"Foo"}, "name": "Foo" }, "superClass": null, "body": { "type": "ClassBody", - "start": 10, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":10,"end":25,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":25}}, "body": [ { "type": "ClassMethod", - "start": 12, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":12,"end":23,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":23}}, "static": false, "key": { "type": "Identifier", - "start": 12, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 15 - }, - "identifierName": "bar" - }, + "start":12,"end":15,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":15},"identifierName":"bar"}, "name": "bar" }, "computed": false, @@ -116,36 +37,13 @@ "params": [ { "type": "Identifier", - "start": 16, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - }, - "identifierName": "a" - }, + "start":16,"end":17,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":17},"identifierName":"a"}, "name": "a" } ], "body": { "type": "BlockStatement", - "start": 20, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":20,"end":23,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":23}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/es2017/trailing-function-commas/4/output.json b/packages/babel-parser/test/fixtures/es2017/trailing-function-commas/4/output.json index 39f347e0431a..8c83452cddfb 100644 --- a/packages/babel-parser/test/fixtures/es2017/trailing-function-commas/4/output.json +++ b/packages/babel-parser/test/fixtures/es2017/trailing-function-commas/4/output.json @@ -1,115 +1,36 @@ { "type": "File", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "program": { "type": "Program", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "expression": { "type": "ArrowFunctionExpression", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "id": null, "generator": false, "async": false, "params": [ { "type": "Identifier", - "start": 1, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - }, - "identifierName": "x" - }, + "start":1,"end":2,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":2},"identifierName":"x"}, "name": "x" }, { "type": "Identifier", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "y" - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"y"}, "name": "y" } ], "body": { "type": "NumericLiteral", - "start": 12, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":12,"end":13,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":13}}, "extra": { "rawValue": 1, "raw": "1" diff --git a/packages/babel-parser/test/fixtures/es2018/async-generators/class-method-2/output.json b/packages/babel-parser/test/fixtures/es2018/async-generators/class-method-2/output.json index daf37aab3af6..64027acd5b1b 100644 --- a/packages/babel-parser/test/fixtures/es2018/async-generators/class-method-2/output.json +++ b/packages/babel-parser/test/fixtures/es2018/async-generators/class-method-2/output.json @@ -1,111 +1,32 @@ { "type": "File", - "start": 0, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, "id": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "A" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, "name": "A" }, "superClass": null, "body": { "type": "ClassBody", - "start": 8, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":8,"end":29,"loc":{"start":{"line":1,"column":8},"end":{"line":4,"column":1}}, "body": [ { "type": "ClassMethod", - "start": 12, - "end": 27, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 3, - "column": 7 - } - }, + "start":12,"end":27,"loc":{"start":{"line":2,"column":2},"end":{"line":3,"column":7}}, "static": false, "key": { "type": "Identifier", - "start": 22, - "end": 23, - "loc": { - "start": { - "line": 3, - "column": 2 - }, - "end": { - "line": 3, - "column": 3 - }, - "identifierName": "a" - }, + "start":22,"end":23,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":3},"identifierName":"a"}, "name": "a" }, "computed": false, @@ -116,18 +37,7 @@ "params": [], "body": { "type": "BlockStatement", - "start": 25, - "end": 27, - "loc": { - "start": { - "line": 3, - "column": 5 - }, - "end": { - "line": 3, - "column": 7 - } - }, + "start":25,"end":27,"loc":{"start":{"line":3,"column":5},"end":{"line":3,"column":7}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/es2018/async-generators/class-method/output.json b/packages/babel-parser/test/fixtures/es2018/async-generators/class-method/output.json index 14cc3bddeedc..3cddfe78deaf 100644 --- a/packages/babel-parser/test/fixtures/es2018/async-generators/class-method/output.json +++ b/packages/babel-parser/test/fixtures/es2018/async-generators/class-method/output.json @@ -1,111 +1,32 @@ { "type": "File", - "start": 0, - "end": 130, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 7, - "column": 1 - } - }, + "start":0,"end":130,"loc":{"start":{"line":1,"column":0},"end":{"line":7,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 130, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 7, - "column": 1 - } - }, + "start":0,"end":130,"loc":{"start":{"line":1,"column":0},"end":{"line":7,"column":1}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 130, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 7, - "column": 1 - } - }, + "start":0,"end":130,"loc":{"start":{"line":1,"column":0},"end":{"line":7,"column":1}}, "id": { "type": "Identifier", - "start": 6, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "Query" - }, + "start":6,"end":11,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":11},"identifierName":"Query"}, "name": "Query" }, "superClass": null, "body": { "type": "ClassBody", - "start": 12, - "end": 130, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 7, - "column": 1 - } - }, + "start":12,"end":130,"loc":{"start":{"line":1,"column":12},"end":{"line":7,"column":1}}, "body": [ { "type": "ClassMethod", - "start": 18, - "end": 128, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 6, - "column": 5 - } - }, + "start":18,"end":128,"loc":{"start":{"line":2,"column":4},"end":{"line":6,"column":5}}, "static": false, "key": { "type": "Identifier", - "start": 25, - "end": 33, - "loc": { - "start": { - "line": 2, - "column": 11 - }, - "end": { - "line": 2, - "column": 19 - }, - "identifierName": "queryAll" - }, + "start":25,"end":33,"loc":{"start":{"line":2,"column":11},"end":{"line":2,"column":19},"identifierName":"queryAll"}, "name": "queryAll" }, "computed": false, @@ -116,96 +37,28 @@ "params": [ { "type": "Identifier", - "start": 34, - "end": 37, - "loc": { - "start": { - "line": 2, - "column": 20 - }, - "end": { - "line": 2, - "column": 23 - }, - "identifierName": "ids" - }, + "start":34,"end":37,"loc":{"start":{"line":2,"column":20},"end":{"line":2,"column":23},"identifierName":"ids"}, "name": "ids" } ], "body": { "type": "BlockStatement", - "start": 39, - "end": 128, - "loc": { - "start": { - "line": 2, - "column": 25 - }, - "end": { - "line": 6, - "column": 5 - } - }, + "start":39,"end":128,"loc":{"start":{"line":2,"column":25},"end":{"line":6,"column":5}}, "body": [ { "type": "ForOfStatement", - "start": 49, - "end": 122, - "loc": { - "start": { - "line": 3, - "column": 8 - }, - "end": { - "line": 5, - "column": 9 - } - }, + "start":49,"end":122,"loc":{"start":{"line":3,"column":8},"end":{"line":5,"column":9}}, "await": false, "left": { "type": "VariableDeclaration", - "start": 54, - "end": 62, - "loc": { - "start": { - "line": 3, - "column": 13 - }, - "end": { - "line": 3, - "column": 21 - } - }, + "start":54,"end":62,"loc":{"start":{"line":3,"column":13},"end":{"line":3,"column":21}}, "declarations": [ { "type": "VariableDeclarator", - "start": 60, - "end": 62, - "loc": { - "start": { - "line": 3, - "column": 19 - }, - "end": { - "line": 3, - "column": 21 - } - }, + "start":60,"end":62,"loc":{"start":{"line":3,"column":19},"end":{"line":3,"column":21}}, "id": { "type": "Identifier", - "start": 60, - "end": 62, - "loc": { - "start": { - "line": 3, - "column": 19 - }, - "end": { - "line": 3, - "column": 21 - }, - "identifierName": "id" - }, + "start":60,"end":62,"loc":{"start":{"line":3,"column":19},"end":{"line":3,"column":21},"identifierName":"id"}, "name": "id" }, "init": null @@ -215,137 +68,36 @@ }, "right": { "type": "Identifier", - "start": 66, - "end": 69, - "loc": { - "start": { - "line": 3, - "column": 25 - }, - "end": { - "line": 3, - "column": 28 - }, - "identifierName": "ids" - }, + "start":66,"end":69,"loc":{"start":{"line":3,"column":25},"end":{"line":3,"column":28},"identifierName":"ids"}, "name": "ids" }, "body": { "type": "BlockStatement", - "start": 71, - "end": 122, - "loc": { - "start": { - "line": 3, - "column": 30 - }, - "end": { - "line": 5, - "column": 9 - } - }, + "start":71,"end":122,"loc":{"start":{"line":3,"column":30},"end":{"line":5,"column":9}}, "body": [ { "type": "ExpressionStatement", - "start": 85, - "end": 112, - "loc": { - "start": { - "line": 4, - "column": 12 - }, - "end": { - "line": 4, - "column": 39 - } - }, + "start":85,"end":112,"loc":{"start":{"line":4,"column":12},"end":{"line":4,"column":39}}, "expression": { "type": "YieldExpression", - "start": 85, - "end": 111, - "loc": { - "start": { - "line": 4, - "column": 12 - }, - "end": { - "line": 4, - "column": 38 - } - }, + "start":85,"end":111,"loc":{"start":{"line":4,"column":12},"end":{"line":4,"column":38}}, "delegate": false, "argument": { "type": "AwaitExpression", - "start": 91, - "end": 111, - "loc": { - "start": { - "line": 4, - "column": 18 - }, - "end": { - "line": 4, - "column": 38 - } - }, + "start":91,"end":111,"loc":{"start":{"line":4,"column":18},"end":{"line":4,"column":38}}, "argument": { "type": "CallExpression", - "start": 97, - "end": 111, - "loc": { - "start": { - "line": 4, - "column": 24 - }, - "end": { - "line": 4, - "column": 38 - } - }, + "start":97,"end":111,"loc":{"start":{"line":4,"column":24},"end":{"line":4,"column":38}}, "callee": { "type": "MemberExpression", - "start": 97, - "end": 107, - "loc": { - "start": { - "line": 4, - "column": 24 - }, - "end": { - "line": 4, - "column": 34 - } - }, + "start":97,"end":107,"loc":{"start":{"line":4,"column":24},"end":{"line":4,"column":34}}, "object": { "type": "ThisExpression", - "start": 97, - "end": 101, - "loc": { - "start": { - "line": 4, - "column": 24 - }, - "end": { - "line": 4, - "column": 28 - } - } + "start":97,"end":101,"loc":{"start":{"line":4,"column":24},"end":{"line":4,"column":28}} }, "property": { "type": "Identifier", - "start": 102, - "end": 107, - "loc": { - "start": { - "line": 4, - "column": 29 - }, - "end": { - "line": 4, - "column": 34 - }, - "identifierName": "query" - }, + "start":102,"end":107,"loc":{"start":{"line":4,"column":29},"end":{"line":4,"column":34},"identifierName":"query"}, "name": "query" }, "computed": false @@ -353,19 +105,7 @@ "arguments": [ { "type": "Identifier", - "start": 108, - "end": 110, - "loc": { - "start": { - "line": 4, - "column": 35 - }, - "end": { - "line": 4, - "column": 37 - }, - "identifierName": "id" - }, + "start":108,"end":110,"loc":{"start":{"line":4,"column":35},"end":{"line":4,"column":37},"identifierName":"id"}, "name": "id" } ] diff --git a/packages/babel-parser/test/fixtures/es2018/async-generators/for-await-no-in/options.json b/packages/babel-parser/test/fixtures/es2018/async-generators/for-await-no-in/options.json index f86bbd48e917..9660494a29ea 100644 --- a/packages/babel-parser/test/fixtures/es2018/async-generators/for-await-no-in/options.json +++ b/packages/babel-parser/test/fixtures/es2018/async-generators/for-await-no-in/options.json @@ -1,3 +1,3 @@ { "throws": "Unexpected token (2:6)" -} \ No newline at end of file +} diff --git a/packages/babel-parser/test/fixtures/es2018/async-generators/for-await/output.json b/packages/babel-parser/test/fixtures/es2018/async-generators/for-await/output.json index d096f12b193c..74f0ff526dcb 100644 --- a/packages/babel-parser/test/fixtures/es2018/async-generators/for-await/output.json +++ b/packages/babel-parser/test/fixtures/es2018/async-generators/for-await/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 48, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":48,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 48, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":48,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 48, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":48,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "id": { "type": "Identifier", - "start": 15, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - }, - "identifierName": "f" - }, + "start":15,"end":16,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":16},"identifierName":"f"}, "name": "f" }, "generator": false, @@ -65,78 +20,22 @@ "params": [], "body": { "type": "BlockStatement", - "start": 19, - "end": 48, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":19,"end":48,"loc":{"start":{"line":1,"column":19},"end":{"line":3,"column":1}}, "body": [ { "type": "ForOfStatement", - "start": 23, - "end": 46, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 25 - } - }, + "start":23,"end":46,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":25}}, "await": true, "left": { "type": "VariableDeclaration", - "start": 34, - "end": 39, - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 18 - } - }, + "start":34,"end":39,"loc":{"start":{"line":2,"column":13},"end":{"line":2,"column":18}}, "declarations": [ { "type": "VariableDeclarator", - "start": 38, - "end": 39, - "loc": { - "start": { - "line": 2, - "column": 17 - }, - "end": { - "line": 2, - "column": 18 - } - }, + "start":38,"end":39,"loc":{"start":{"line":2,"column":17},"end":{"line":2,"column":18}}, "id": { "type": "Identifier", - "start": 38, - "end": 39, - "loc": { - "start": { - "line": 2, - "column": 17 - }, - "end": { - "line": 2, - "column": 18 - }, - "identifierName": "x" - }, + "start":38,"end":39,"loc":{"start":{"line":2,"column":17},"end":{"line":2,"column":18},"identifierName":"x"}, "name": "x" }, "init": null @@ -146,35 +45,12 @@ }, "right": { "type": "Identifier", - "start": 43, - "end": 44, - "loc": { - "start": { - "line": 2, - "column": 22 - }, - "end": { - "line": 2, - "column": 23 - }, - "identifierName": "y" - }, + "start":43,"end":44,"loc":{"start":{"line":2,"column":22},"end":{"line":2,"column":23},"identifierName":"y"}, "name": "y" }, "body": { "type": "EmptyStatement", - "start": 45, - "end": 46, - "loc": { - "start": { - "line": 2, - "column": 24 - }, - "end": { - "line": 2, - "column": 25 - } - } + "start":45,"end":46,"loc":{"start":{"line":2,"column":24},"end":{"line":2,"column":25}} } } ], diff --git a/packages/babel-parser/test/fixtures/es2018/async-generators/object-method/output.json b/packages/babel-parser/test/fixtures/es2018/async-generators/object-method/output.json index 0dedcfd42144..47180d5c7567 100644 --- a/packages/babel-parser/test/fixtures/es2018/async-generators/object-method/output.json +++ b/packages/babel-parser/test/fixtures/es2018/async-generators/object-method/output.json @@ -1,125 +1,35 @@ { "type": "File", - "start": 0, - "end": 133, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 7, - "column": 2 - } - }, + "start":0,"end":133,"loc":{"start":{"line":1,"column":0},"end":{"line":7,"column":2}}, "program": { "type": "Program", - "start": 0, - "end": 133, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 7, - "column": 2 - } - }, + "start":0,"end":133,"loc":{"start":{"line":1,"column":0},"end":{"line":7,"column":2}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 133, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 7, - "column": 2 - } - }, + "start":0,"end":133,"loc":{"start":{"line":1,"column":0},"end":{"line":7,"column":2}}, "declarations": [ { "type": "VariableDeclarator", - "start": 6, - "end": 132, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 7, - "column": 1 - } - }, + "start":6,"end":132,"loc":{"start":{"line":1,"column":6},"end":{"line":7,"column":1}}, "id": { "type": "Identifier", - "start": 6, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "query" - }, + "start":6,"end":11,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":11},"identifierName":"query"}, "name": "query" }, "init": { "type": "ObjectExpression", - "start": 14, - "end": 132, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 7, - "column": 1 - } - }, + "start":14,"end":132,"loc":{"start":{"line":1,"column":14},"end":{"line":7,"column":1}}, "properties": [ { "type": "ObjectMethod", - "start": 20, - "end": 130, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 6, - "column": 5 - } - }, + "start":20,"end":130,"loc":{"start":{"line":2,"column":4},"end":{"line":6,"column":5}}, "method": true, "key": { "type": "Identifier", - "start": 27, - "end": 35, - "loc": { - "start": { - "line": 2, - "column": 11 - }, - "end": { - "line": 2, - "column": 19 - }, - "identifierName": "queryAll" - }, + "start":27,"end":35,"loc":{"start":{"line":2,"column":11},"end":{"line":2,"column":19},"identifierName":"queryAll"}, "name": "queryAll" }, "computed": false, @@ -130,96 +40,28 @@ "params": [ { "type": "Identifier", - "start": 36, - "end": 39, - "loc": { - "start": { - "line": 2, - "column": 20 - }, - "end": { - "line": 2, - "column": 23 - }, - "identifierName": "ids" - }, + "start":36,"end":39,"loc":{"start":{"line":2,"column":20},"end":{"line":2,"column":23},"identifierName":"ids"}, "name": "ids" } ], "body": { "type": "BlockStatement", - "start": 41, - "end": 130, - "loc": { - "start": { - "line": 2, - "column": 25 - }, - "end": { - "line": 6, - "column": 5 - } - }, + "start":41,"end":130,"loc":{"start":{"line":2,"column":25},"end":{"line":6,"column":5}}, "body": [ { "type": "ForOfStatement", - "start": 51, - "end": 124, - "loc": { - "start": { - "line": 3, - "column": 8 - }, - "end": { - "line": 5, - "column": 9 - } - }, + "start":51,"end":124,"loc":{"start":{"line":3,"column":8},"end":{"line":5,"column":9}}, "await": false, "left": { "type": "VariableDeclaration", - "start": 56, - "end": 64, - "loc": { - "start": { - "line": 3, - "column": 13 - }, - "end": { - "line": 3, - "column": 21 - } - }, + "start":56,"end":64,"loc":{"start":{"line":3,"column":13},"end":{"line":3,"column":21}}, "declarations": [ { "type": "VariableDeclarator", - "start": 62, - "end": 64, - "loc": { - "start": { - "line": 3, - "column": 19 - }, - "end": { - "line": 3, - "column": 21 - } - }, + "start":62,"end":64,"loc":{"start":{"line":3,"column":19},"end":{"line":3,"column":21}}, "id": { "type": "Identifier", - "start": 62, - "end": 64, - "loc": { - "start": { - "line": 3, - "column": 19 - }, - "end": { - "line": 3, - "column": 21 - }, - "identifierName": "id" - }, + "start":62,"end":64,"loc":{"start":{"line":3,"column":19},"end":{"line":3,"column":21},"identifierName":"id"}, "name": "id" }, "init": null @@ -229,137 +71,36 @@ }, "right": { "type": "Identifier", - "start": 68, - "end": 71, - "loc": { - "start": { - "line": 3, - "column": 25 - }, - "end": { - "line": 3, - "column": 28 - }, - "identifierName": "ids" - }, + "start":68,"end":71,"loc":{"start":{"line":3,"column":25},"end":{"line":3,"column":28},"identifierName":"ids"}, "name": "ids" }, "body": { "type": "BlockStatement", - "start": 73, - "end": 124, - "loc": { - "start": { - "line": 3, - "column": 30 - }, - "end": { - "line": 5, - "column": 9 - } - }, + "start":73,"end":124,"loc":{"start":{"line":3,"column":30},"end":{"line":5,"column":9}}, "body": [ { "type": "ExpressionStatement", - "start": 87, - "end": 114, - "loc": { - "start": { - "line": 4, - "column": 12 - }, - "end": { - "line": 4, - "column": 39 - } - }, + "start":87,"end":114,"loc":{"start":{"line":4,"column":12},"end":{"line":4,"column":39}}, "expression": { "type": "YieldExpression", - "start": 87, - "end": 113, - "loc": { - "start": { - "line": 4, - "column": 12 - }, - "end": { - "line": 4, - "column": 38 - } - }, + "start":87,"end":113,"loc":{"start":{"line":4,"column":12},"end":{"line":4,"column":38}}, "delegate": false, "argument": { "type": "AwaitExpression", - "start": 93, - "end": 113, - "loc": { - "start": { - "line": 4, - "column": 18 - }, - "end": { - "line": 4, - "column": 38 - } - }, + "start":93,"end":113,"loc":{"start":{"line":4,"column":18},"end":{"line":4,"column":38}}, "argument": { "type": "CallExpression", - "start": 99, - "end": 113, - "loc": { - "start": { - "line": 4, - "column": 24 - }, - "end": { - "line": 4, - "column": 38 - } - }, + "start":99,"end":113,"loc":{"start":{"line":4,"column":24},"end":{"line":4,"column":38}}, "callee": { "type": "MemberExpression", - "start": 99, - "end": 109, - "loc": { - "start": { - "line": 4, - "column": 24 - }, - "end": { - "line": 4, - "column": 34 - } - }, + "start":99,"end":109,"loc":{"start":{"line":4,"column":24},"end":{"line":4,"column":34}}, "object": { "type": "ThisExpression", - "start": 99, - "end": 103, - "loc": { - "start": { - "line": 4, - "column": 24 - }, - "end": { - "line": 4, - "column": 28 - } - } + "start":99,"end":103,"loc":{"start":{"line":4,"column":24},"end":{"line":4,"column":28}} }, "property": { "type": "Identifier", - "start": 104, - "end": 109, - "loc": { - "start": { - "line": 4, - "column": 29 - }, - "end": { - "line": 4, - "column": 34 - }, - "identifierName": "query" - }, + "start":104,"end":109,"loc":{"start":{"line":4,"column":29},"end":{"line":4,"column":34},"identifierName":"query"}, "name": "query" }, "computed": false @@ -367,19 +108,7 @@ "arguments": [ { "type": "Identifier", - "start": 110, - "end": 112, - "loc": { - "start": { - "line": 4, - "column": 35 - }, - "end": { - "line": 4, - "column": 37 - }, - "identifierName": "id" - }, + "start":110,"end":112,"loc":{"start":{"line":4,"column":35},"end":{"line":4,"column":37},"identifierName":"id"}, "name": "id" } ] diff --git a/packages/babel-parser/test/fixtures/es2018/object-rest-spread/1/output.json b/packages/babel-parser/test/fixtures/es2018/object-rest-spread/1/output.json index 9e70bac9135b..6c5006b4fa10 100644 --- a/packages/babel-parser/test/fixtures/es2018/object-rest-spread/1/output.json +++ b/packages/babel-parser/test/fixtures/es2018/object-rest-spread/1/output.json @@ -1,107 +1,29 @@ { "type": "File", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "program": { "type": "Program", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":4,"end":14,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":14}}, "id": { "type": "ObjectPattern", - "start": 4, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":4,"end":10,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":10}}, "properties": [ { "type": "RestElement", - "start": 5, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":5,"end":9,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":9}}, "argument": { "type": "Identifier", - "start": 8, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "x" - }, + "start":8,"end":9,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":9},"identifierName":"x"}, "name": "x" } } @@ -109,19 +31,7 @@ }, "init": { "type": "Identifier", - "start": 13, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - }, - "identifierName": "z" - }, + "start":13,"end":14,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":14},"identifierName":"z"}, "name": "z" } } diff --git a/packages/babel-parser/test/fixtures/es2018/object-rest-spread/10/output.json b/packages/babel-parser/test/fixtures/es2018/object-rest-spread/10/output.json index 485e729af53e..aa56d0ec559b 100644 --- a/packages/babel-parser/test/fixtures/es2018/object-rest-spread/10/output.json +++ b/packages/babel-parser/test/fixtures/es2018/object-rest-spread/10/output.json @@ -1,127 +1,37 @@ { "type": "File", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, "program": { "type": "Program", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":4,"end":19,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":19}}, "id": { "type": "ObjectPattern", - "start": 4, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":4,"end":13,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":13}}, "properties": [ { "type": "ObjectProperty", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7}}, "method": false, "key": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "x" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"x"}, "name": "x" }, "computed": false, "shorthand": true, "value": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "x" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"x"}, "name": "x" }, "extra": { @@ -130,76 +40,32 @@ }, { "type": "ObjectProperty", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10}}, "method": false, "key": { "type": "Identifier", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - }, - "identifierName": "y" - }, + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"y"}, "name": "y" }, "computed": false, "shorthand": true, "value": { "type": "Identifier", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - }, - "identifierName": "y" - }, + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"y"}, "name": "y" }, "extra": { "shorthand": true } } - ] + ], + "extra": { + "trailingComma": 10 + } }, "init": { "type": "Identifier", - "start": 16, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 19 - }, - "identifierName": "obj" - }, + "start":16,"end":19,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":19},"identifierName":"obj"}, "name": "obj" } } diff --git a/packages/babel-parser/test/fixtures/es2018/object-rest-spread/11/options.json b/packages/babel-parser/test/fixtures/es2018/object-rest-spread/11/options.json index 6dad74eebd16..2104ca43283f 100644 --- a/packages/babel-parser/test/fixtures/es2018/object-rest-spread/11/options.json +++ b/packages/babel-parser/test/fixtures/es2018/object-rest-spread/11/options.json @@ -1,4 +1,3 @@ { - "sourceType": "module", - "throws": "Identifier 'foo' has already been declared (2:23)" + "sourceType": "module" } diff --git a/packages/babel-parser/test/fixtures/es2018/object-rest-spread/11/output.json b/packages/babel-parser/test/fixtures/es2018/object-rest-spread/11/output.json new file mode 100644 index 000000000000..9107e6623d36 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2018/object-rest-spread/11/output.json @@ -0,0 +1,105 @@ +{ + "type": "File", + "start":0,"end":57,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":35}}, + "errors": [ + "SyntaxError: Identifier 'foo' has already been declared (2:23)", + "SyntaxError: `foo` has already been exported. Exported identifiers must be unique. (2:23)" + ], + "program": { + "type": "Program", + "start":0,"end":57,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":35}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExportNamedDeclaration", + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, + "specifiers": [], + "source": null, + "declaration": { + "type": "VariableDeclaration", + "start":7,"end":21,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":21}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":13,"end":20,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":20}}, + "id": { + "type": "Identifier", + "start":13,"end":16,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":16},"identifierName":"foo"}, + "name": "foo" + }, + "init": { + "type": "NumericLiteral", + "start":19,"end":20,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":20}}, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + ], + "kind": "const" + } + }, + { + "type": "ExportNamedDeclaration", + "start":22,"end":57,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":35}}, + "specifiers": [], + "source": null, + "declaration": { + "type": "VariableDeclaration", + "start":29,"end":57,"loc":{"start":{"line":2,"column":7},"end":{"line":2,"column":35}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":35,"end":56,"loc":{"start":{"line":2,"column":13},"end":{"line":2,"column":34}}, + "id": { + "type": "ObjectPattern", + "start":35,"end":50,"loc":{"start":{"line":2,"column":13},"end":{"line":2,"column":28}}, + "properties": [ + { + "type": "ObjectProperty", + "start":37,"end":40,"loc":{"start":{"line":2,"column":15},"end":{"line":2,"column":18}}, + "method": false, + "key": { + "type": "Identifier", + "start":37,"end":40,"loc":{"start":{"line":2,"column":15},"end":{"line":2,"column":18},"identifierName":"bar"}, + "name": "bar" + }, + "computed": false, + "shorthand": true, + "value": { + "type": "Identifier", + "start":37,"end":40,"loc":{"start":{"line":2,"column":15},"end":{"line":2,"column":18},"identifierName":"bar"}, + "name": "bar" + }, + "extra": { + "shorthand": true + } + }, + { + "type": "RestElement", + "start":42,"end":48,"loc":{"start":{"line":2,"column":20},"end":{"line":2,"column":26}}, + "argument": { + "type": "Identifier", + "start":45,"end":48,"loc":{"start":{"line":2,"column":23},"end":{"line":2,"column":26},"identifierName":"foo"}, + "name": "foo" + } + } + ] + }, + "init": { + "type": "Identifier", + "start":53,"end":56,"loc":{"start":{"line":2,"column":31},"end":{"line":2,"column":34},"identifierName":"baz"}, + "name": "baz" + } + } + ], + "kind": "const" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2018/object-rest-spread/12/options.json b/packages/babel-parser/test/fixtures/es2018/object-rest-spread/12/options.json index 165223a448a3..2104ca43283f 100644 --- a/packages/babel-parser/test/fixtures/es2018/object-rest-spread/12/options.json +++ b/packages/babel-parser/test/fixtures/es2018/object-rest-spread/12/options.json @@ -1,4 +1,3 @@ { - "sourceType": "module", - "throws": "Identifier 'bar' has already been declared (2:13)" + "sourceType": "module" } diff --git a/packages/babel-parser/test/fixtures/es2018/object-rest-spread/12/output.json b/packages/babel-parser/test/fixtures/es2018/object-rest-spread/12/output.json new file mode 100644 index 000000000000..ff6a186270d8 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2018/object-rest-spread/12/output.json @@ -0,0 +1,105 @@ +{ + "type": "File", + "start":0,"end":57,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":21}}, + "errors": [ + "SyntaxError: Identifier 'bar' has already been declared (2:13)", + "SyntaxError: `bar` has already been exported. Exported identifiers must be unique. (2:13)" + ], + "program": { + "type": "Program", + "start":0,"end":57,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":21}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExportNamedDeclaration", + "start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":35}}, + "specifiers": [], + "source": null, + "declaration": { + "type": "VariableDeclaration", + "start":7,"end":35,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":35}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":13,"end":34,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":34}}, + "id": { + "type": "ObjectPattern", + "start":13,"end":28,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":28}}, + "properties": [ + { + "type": "ObjectProperty", + "start":15,"end":18,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":18}}, + "method": false, + "key": { + "type": "Identifier", + "start":15,"end":18,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":18},"identifierName":"foo"}, + "name": "foo" + }, + "computed": false, + "shorthand": true, + "value": { + "type": "Identifier", + "start":15,"end":18,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":18},"identifierName":"foo"}, + "name": "foo" + }, + "extra": { + "shorthand": true + } + }, + { + "type": "RestElement", + "start":20,"end":26,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":26}}, + "argument": { + "type": "Identifier", + "start":23,"end":26,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":26},"identifierName":"bar"}, + "name": "bar" + } + } + ] + }, + "init": { + "type": "Identifier", + "start":31,"end":34,"loc":{"start":{"line":1,"column":31},"end":{"line":1,"column":34},"identifierName":"baz"}, + "name": "baz" + } + } + ], + "kind": "const" + } + }, + { + "type": "ExportNamedDeclaration", + "start":36,"end":57,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":21}}, + "specifiers": [], + "source": null, + "declaration": { + "type": "VariableDeclaration", + "start":43,"end":57,"loc":{"start":{"line":2,"column":7},"end":{"line":2,"column":21}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":49,"end":56,"loc":{"start":{"line":2,"column":13},"end":{"line":2,"column":20}}, + "id": { + "type": "Identifier", + "start":49,"end":52,"loc":{"start":{"line":2,"column":13},"end":{"line":2,"column":16},"identifierName":"bar"}, + "name": "bar" + }, + "init": { + "type": "NumericLiteral", + "start":55,"end":56,"loc":{"start":{"line":2,"column":19},"end":{"line":2,"column":20}}, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + ], + "kind": "const" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2018/object-rest-spread/13/options.json b/packages/babel-parser/test/fixtures/es2018/object-rest-spread/13/options.json index 68df28e41c41..2104ca43283f 100644 --- a/packages/babel-parser/test/fixtures/es2018/object-rest-spread/13/options.json +++ b/packages/babel-parser/test/fixtures/es2018/object-rest-spread/13/options.json @@ -1,4 +1,3 @@ { - "sourceType": "module", - "throws": "Identifier 'foo' has already been declared (2:30)" + "sourceType": "module" } diff --git a/packages/babel-parser/test/fixtures/es2018/object-rest-spread/13/output.json b/packages/babel-parser/test/fixtures/es2018/object-rest-spread/13/output.json new file mode 100644 index 000000000000..4488d18649b4 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2018/object-rest-spread/13/output.json @@ -0,0 +1,123 @@ +{ + "type": "File", + "start":0,"end":66,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":44}}, + "errors": [ + "SyntaxError: Identifier 'foo' has already been declared (2:30)", + "SyntaxError: `foo` has already been exported. Exported identifiers must be unique. (2:30)" + ], + "program": { + "type": "Program", + "start":0,"end":66,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":44}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExportNamedDeclaration", + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, + "specifiers": [], + "source": null, + "declaration": { + "type": "VariableDeclaration", + "start":7,"end":21,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":21}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":13,"end":20,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":20}}, + "id": { + "type": "Identifier", + "start":13,"end":16,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":16},"identifierName":"foo"}, + "name": "foo" + }, + "init": { + "type": "NumericLiteral", + "start":19,"end":20,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":20}}, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + ], + "kind": "const" + } + }, + { + "type": "ExportNamedDeclaration", + "start":22,"end":66,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":44}}, + "specifiers": [], + "source": null, + "declaration": { + "type": "VariableDeclaration", + "start":29,"end":66,"loc":{"start":{"line":2,"column":7},"end":{"line":2,"column":44}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":35,"end":65,"loc":{"start":{"line":2,"column":13},"end":{"line":2,"column":43}}, + "id": { + "type": "ObjectPattern", + "start":35,"end":59,"loc":{"start":{"line":2,"column":13},"end":{"line":2,"column":37}}, + "properties": [ + { + "type": "ObjectProperty", + "start":37,"end":57,"loc":{"start":{"line":2,"column":15},"end":{"line":2,"column":35}}, + "method": false, + "key": { + "type": "Identifier", + "start":37,"end":40,"loc":{"start":{"line":2,"column":15},"end":{"line":2,"column":18},"identifierName":"bar"}, + "name": "bar" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "ObjectPattern", + "start":42,"end":57,"loc":{"start":{"line":2,"column":20},"end":{"line":2,"column":35}}, + "properties": [ + { + "type": "ObjectProperty", + "start":44,"end":47,"loc":{"start":{"line":2,"column":22},"end":{"line":2,"column":25}}, + "method": false, + "key": { + "type": "Identifier", + "start":44,"end":47,"loc":{"start":{"line":2,"column":22},"end":{"line":2,"column":25},"identifierName":"baz"}, + "name": "baz" + }, + "computed": false, + "shorthand": true, + "value": { + "type": "Identifier", + "start":44,"end":47,"loc":{"start":{"line":2,"column":22},"end":{"line":2,"column":25},"identifierName":"baz"}, + "name": "baz" + }, + "extra": { + "shorthand": true + } + }, + { + "type": "RestElement", + "start":49,"end":55,"loc":{"start":{"line":2,"column":27},"end":{"line":2,"column":33}}, + "argument": { + "type": "Identifier", + "start":52,"end":55,"loc":{"start":{"line":2,"column":30},"end":{"line":2,"column":33},"identifierName":"foo"}, + "name": "foo" + } + } + ] + } + } + ] + }, + "init": { + "type": "Identifier", + "start":62,"end":65,"loc":{"start":{"line":2,"column":40},"end":{"line":2,"column":43},"identifierName":"qux"}, + "name": "qux" + } + } + ], + "kind": "const" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2018/object-rest-spread/14/options.json b/packages/babel-parser/test/fixtures/es2018/object-rest-spread/14/options.json index 280073b140f0..2104ca43283f 100644 --- a/packages/babel-parser/test/fixtures/es2018/object-rest-spread/14/options.json +++ b/packages/babel-parser/test/fixtures/es2018/object-rest-spread/14/options.json @@ -1,4 +1,3 @@ { - "sourceType": "module", - "throws": "Identifier 'foo' has already been declared (2:29)" + "sourceType": "module" } diff --git a/packages/babel-parser/test/fixtures/es2018/object-rest-spread/14/output.json b/packages/babel-parser/test/fixtures/es2018/object-rest-spread/14/output.json new file mode 100644 index 000000000000..e3429dd5577b --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2018/object-rest-spread/14/output.json @@ -0,0 +1,116 @@ +{ + "type": "File", + "start":0,"end":64,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":42}}, + "errors": [ + "SyntaxError: Identifier 'foo' has already been declared (2:29)", + "SyntaxError: `foo` has already been exported. Exported identifiers must be unique. (2:29)" + ], + "program": { + "type": "Program", + "start":0,"end":64,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":42}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExportNamedDeclaration", + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, + "specifiers": [], + "source": null, + "declaration": { + "type": "VariableDeclaration", + "start":7,"end":21,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":21}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":13,"end":20,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":20}}, + "id": { + "type": "Identifier", + "start":13,"end":16,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":16},"identifierName":"foo"}, + "name": "foo" + }, + "init": { + "type": "NumericLiteral", + "start":19,"end":20,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":20}}, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + ], + "kind": "const" + } + }, + { + "type": "ExportNamedDeclaration", + "start":22,"end":64,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":42}}, + "specifiers": [], + "source": null, + "declaration": { + "type": "VariableDeclaration", + "start":29,"end":64,"loc":{"start":{"line":2,"column":7},"end":{"line":2,"column":42}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":35,"end":63,"loc":{"start":{"line":2,"column":13},"end":{"line":2,"column":41}}, + "id": { + "type": "ArrayPattern", + "start":35,"end":57,"loc":{"start":{"line":2,"column":13},"end":{"line":2,"column":35}}, + "elements": [ + { + "type": "Identifier", + "start":36,"end":39,"loc":{"start":{"line":2,"column":14},"end":{"line":2,"column":17},"identifierName":"bar"}, + "name": "bar" + }, + { + "type": "ObjectPattern", + "start":41,"end":56,"loc":{"start":{"line":2,"column":19},"end":{"line":2,"column":34}}, + "properties": [ + { + "type": "ObjectProperty", + "start":43,"end":46,"loc":{"start":{"line":2,"column":21},"end":{"line":2,"column":24}}, + "method": false, + "key": { + "type": "Identifier", + "start":43,"end":46,"loc":{"start":{"line":2,"column":21},"end":{"line":2,"column":24},"identifierName":"baz"}, + "name": "baz" + }, + "computed": false, + "shorthand": true, + "value": { + "type": "Identifier", + "start":43,"end":46,"loc":{"start":{"line":2,"column":21},"end":{"line":2,"column":24},"identifierName":"baz"}, + "name": "baz" + }, + "extra": { + "shorthand": true + } + }, + { + "type": "RestElement", + "start":48,"end":54,"loc":{"start":{"line":2,"column":26},"end":{"line":2,"column":32}}, + "argument": { + "type": "Identifier", + "start":51,"end":54,"loc":{"start":{"line":2,"column":29},"end":{"line":2,"column":32},"identifierName":"foo"}, + "name": "foo" + } + } + ] + } + ] + }, + "init": { + "type": "Identifier", + "start":60,"end":63,"loc":{"start":{"line":2,"column":38},"end":{"line":2,"column":41},"identifierName":"qux"}, + "name": "qux" + } + } + ], + "kind": "const" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2018/object-rest-spread/15/options.json b/packages/babel-parser/test/fixtures/es2018/object-rest-spread/15/options.json index 68df28e41c41..2104ca43283f 100644 --- a/packages/babel-parser/test/fixtures/es2018/object-rest-spread/15/options.json +++ b/packages/babel-parser/test/fixtures/es2018/object-rest-spread/15/options.json @@ -1,4 +1,3 @@ { - "sourceType": "module", - "throws": "Identifier 'foo' has already been declared (2:30)" + "sourceType": "module" } diff --git a/packages/babel-parser/test/fixtures/es2018/object-rest-spread/15/output.json b/packages/babel-parser/test/fixtures/es2018/object-rest-spread/15/output.json new file mode 100644 index 000000000000..ebce9c22593d --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2018/object-rest-spread/15/output.json @@ -0,0 +1,122 @@ +{ + "type": "File", + "start":0,"end":66,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":44}}, + "errors": [ + "SyntaxError: Identifier 'foo' has already been declared (2:30)", + "SyntaxError: `foo` has already been exported. Exported identifiers must be unique. (2:30)" + ], + "program": { + "type": "Program", + "start":0,"end":66,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":44}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExportNamedDeclaration", + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, + "specifiers": [], + "source": null, + "declaration": { + "type": "VariableDeclaration", + "start":7,"end":21,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":21}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":13,"end":20,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":20}}, + "id": { + "type": "Identifier", + "start":13,"end":16,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":16},"identifierName":"foo"}, + "name": "foo" + }, + "init": { + "type": "NumericLiteral", + "start":19,"end":20,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":20}}, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + ], + "kind": "const" + } + }, + { + "type": "ExportNamedDeclaration", + "start":22,"end":66,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":44}}, + "specifiers": [], + "source": null, + "declaration": { + "type": "VariableDeclaration", + "start":29,"end":66,"loc":{"start":{"line":2,"column":7},"end":{"line":2,"column":44}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":35,"end":65,"loc":{"start":{"line":2,"column":13},"end":{"line":2,"column":43}}, + "id": { + "type": "ArrayPattern", + "start":35,"end":59,"loc":{"start":{"line":2,"column":13},"end":{"line":2,"column":37}}, + "elements": [ + { + "type": "Identifier", + "start":36,"end":39,"loc":{"start":{"line":2,"column":14},"end":{"line":2,"column":17},"identifierName":"bar"}, + "name": "bar" + }, + { + "type": "ArrayPattern", + "start":41,"end":58,"loc":{"start":{"line":2,"column":19},"end":{"line":2,"column":36}}, + "elements": [ + { + "type": "ObjectPattern", + "start":42,"end":57,"loc":{"start":{"line":2,"column":20},"end":{"line":2,"column":35}}, + "properties": [ + { + "type": "ObjectProperty", + "start":44,"end":47,"loc":{"start":{"line":2,"column":22},"end":{"line":2,"column":25}}, + "method": false, + "key": { + "type": "Identifier", + "start":44,"end":47,"loc":{"start":{"line":2,"column":22},"end":{"line":2,"column":25},"identifierName":"baz"}, + "name": "baz" + }, + "computed": false, + "shorthand": true, + "value": { + "type": "Identifier", + "start":44,"end":47,"loc":{"start":{"line":2,"column":22},"end":{"line":2,"column":25},"identifierName":"baz"}, + "name": "baz" + }, + "extra": { + "shorthand": true + } + }, + { + "type": "RestElement", + "start":49,"end":55,"loc":{"start":{"line":2,"column":27},"end":{"line":2,"column":33}}, + "argument": { + "type": "Identifier", + "start":52,"end":55,"loc":{"start":{"line":2,"column":30},"end":{"line":2,"column":33},"identifierName":"foo"}, + "name": "foo" + } + } + ] + } + ] + } + ] + }, + "init": { + "type": "Identifier", + "start":62,"end":65,"loc":{"start":{"line":2,"column":40},"end":{"line":2,"column":43},"identifierName":"qux"}, + "name": "qux" + } + } + ], + "kind": "const" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2018/object-rest-spread/18/options.json b/packages/babel-parser/test/fixtures/es2018/object-rest-spread/18/options.json deleted file mode 100644 index b447c590ab2c..000000000000 --- a/packages/babel-parser/test/fixtures/es2018/object-rest-spread/18/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid rest operator's argument (1:5)" -} diff --git a/packages/babel-parser/test/fixtures/es2018/object-rest-spread/18/output.json b/packages/babel-parser/test/fixtures/es2018/object-rest-spread/18/output.json new file mode 100644 index 000000000000..5f904177a72c --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2018/object-rest-spread/18/output.json @@ -0,0 +1,49 @@ +{ + "type": "File", + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, + "errors": [ + "SyntaxError: Invalid rest operator's argument (1:5)" + ], + "program": { + "type": "Program", + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, + "expression": { + "type": "AssignmentExpression", + "start":1,"end":13,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":13}}, + "operator": "=", + "left": { + "type": "ObjectPattern", + "start":1,"end":8,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":8}}, + "properties": [ + { + "type": "RestElement", + "start":2,"end":7,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":7}}, + "argument": { + "type": "ObjectPattern", + "start":5,"end":7,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":7}}, + "properties": [] + } + } + ] + }, + "right": { + "type": "ObjectExpression", + "start":11,"end":13,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":13}}, + "properties": [] + }, + "extra": { + "parenthesized": true, + "parenStart": 0 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2018/object-rest-spread/2/output.json b/packages/babel-parser/test/fixtures/es2018/object-rest-spread/2/output.json index 63ab7890b83a..e55b048ed3f0 100644 --- a/packages/babel-parser/test/fixtures/es2018/object-rest-spread/2/output.json +++ b/packages/babel-parser/test/fixtures/es2018/object-rest-spread/2/output.json @@ -1,127 +1,37 @@ { "type": "File", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "program": { "type": "Program", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":4,"end":17,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":17}}, "id": { "type": "ObjectPattern", - "start": 4, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":4,"end":13,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":13}}, "properties": [ { "type": "ObjectProperty", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, "method": false, "key": { "type": "Identifier", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "x" - }, + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"x"}, "name": "x" }, "computed": false, "shorthand": true, "value": { "type": "Identifier", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "x" - }, + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"x"}, "name": "x" }, "extra": { @@ -130,33 +40,10 @@ }, { "type": "RestElement", - "start": 8, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":8,"end":12,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":12}}, "argument": { "type": "Identifier", - "start": 11, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "y" - }, + "start":11,"end":12,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":12},"identifierName":"y"}, "name": "y" } } @@ -164,19 +51,7 @@ }, "init": { "type": "Identifier", - "start": 16, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - }, - "identifierName": "z" - }, + "start":16,"end":17,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":17},"identifierName":"z"}, "name": "z" } } diff --git a/packages/babel-parser/test/fixtures/es2018/object-rest-spread/21/options.json b/packages/babel-parser/test/fixtures/es2018/object-rest-spread/21/options.json deleted file mode 100644 index b447c590ab2c..000000000000 --- a/packages/babel-parser/test/fixtures/es2018/object-rest-spread/21/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid rest operator's argument (1:5)" -} diff --git a/packages/babel-parser/test/fixtures/es2018/object-rest-spread/21/output.json b/packages/babel-parser/test/fixtures/es2018/object-rest-spread/21/output.json new file mode 100644 index 000000000000..53d79afbca84 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2018/object-rest-spread/21/output.json @@ -0,0 +1,62 @@ +{ + "type": "File", + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, + "errors": [ + "SyntaxError: Invalid rest operator's argument (1:5)" + ], + "program": { + "type": "Program", + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, + "expression": { + "type": "AssignmentExpression", + "start":1,"end":16,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":16}}, + "operator": "=", + "left": { + "type": "ObjectPattern", + "start":1,"end":11,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":11}}, + "properties": [ + { + "type": "RestElement", + "start":2,"end":10,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":10}}, + "argument": { + "type": "AssignmentPattern", + "start":5,"end":10,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":10}}, + "left": { + "type": "Identifier", + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"x"}, + "name": "x" + }, + "right": { + "type": "NumericLiteral", + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10}}, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + } + ] + }, + "right": { + "type": "ObjectExpression", + "start":14,"end":16,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":16}}, + "properties": [] + }, + "extra": { + "parenthesized": true, + "parenStart": 0 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2018/object-rest-spread/24/options.json b/packages/babel-parser/test/fixtures/es2018/object-rest-spread/24/options.json deleted file mode 100644 index b447c590ab2c..000000000000 --- a/packages/babel-parser/test/fixtures/es2018/object-rest-spread/24/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid rest operator's argument (1:5)" -} diff --git a/packages/babel-parser/test/fixtures/es2018/object-rest-spread/24/output.json b/packages/babel-parser/test/fixtures/es2018/object-rest-spread/24/output.json new file mode 100644 index 000000000000..95a5979a014e --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2018/object-rest-spread/24/output.json @@ -0,0 +1,49 @@ +{ + "type": "File", + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, + "errors": [ + "SyntaxError: Invalid rest operator's argument (1:5)" + ], + "program": { + "type": "Program", + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, + "expression": { + "type": "AssignmentExpression", + "start":1,"end":13,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":13}}, + "operator": "=", + "left": { + "type": "ObjectPattern", + "start":1,"end":8,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":8}}, + "properties": [ + { + "type": "RestElement", + "start":2,"end":7,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":7}}, + "argument": { + "type": "ArrayPattern", + "start":5,"end":7,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":7}}, + "elements": [] + } + } + ] + }, + "right": { + "type": "ObjectExpression", + "start":11,"end":13,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":13}}, + "properties": [] + }, + "extra": { + "parenthesized": true, + "parenStart": 0 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2018/object-rest-spread/3/output.json b/packages/babel-parser/test/fixtures/es2018/object-rest-spread/3/output.json index 5ecd8287f4c3..5e3c5f7d229a 100644 --- a/packages/babel-parser/test/fixtures/es2018/object-rest-spread/3/output.json +++ b/packages/babel-parser/test/fixtures/es2018/object-rest-spread/3/output.json @@ -1,130 +1,40 @@ { "type": "File", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, "program": { "type": "Program", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, "expression": { "type": "FunctionExpression", - "start": 1, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":1,"end":24,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":24}}, "id": null, "generator": false, "async": false, "params": [ { "type": "ObjectPattern", - "start": 10, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":10,"end":19,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":19}}, "properties": [ { "type": "ObjectProperty", - "start": 11, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":11,"end":12,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":12}}, "method": false, "key": { "type": "Identifier", - "start": 11, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "x" - }, + "start":11,"end":12,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":12},"identifierName":"x"}, "name": "x" }, "computed": false, "shorthand": true, "value": { "type": "Identifier", - "start": 11, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "x" - }, + "start":11,"end":12,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":12},"identifierName":"x"}, "name": "x" }, "extra": { @@ -133,33 +43,10 @@ }, { "type": "RestElement", - "start": 14, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":14,"end":18,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":18}}, "argument": { "type": "Identifier", - "start": 17, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - }, - "identifierName": "y" - }, + "start":17,"end":18,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":18},"identifierName":"y"}, "name": "y" } } @@ -168,18 +55,7 @@ ], "body": { "type": "BlockStatement", - "start": 21, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":21,"end":24,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":24}}, "body": [], "directives": [] }, diff --git a/packages/babel-parser/test/fixtures/es2018/object-rest-spread/4/output.json b/packages/babel-parser/test/fixtures/es2018/object-rest-spread/4/output.json index 3cd19d49408c..102243b3cb95 100644 --- a/packages/babel-parser/test/fixtures/es2018/object-rest-spread/4/output.json +++ b/packages/babel-parser/test/fixtures/es2018/object-rest-spread/4/output.json @@ -1,124 +1,34 @@ { "type": "File", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "program": { "type": "Program", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":4,"end":14,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":14}}, "id": { "type": "Identifier", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "z" - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"z"}, "name": "z" }, "init": { "type": "ObjectExpression", - "start": 8, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":8,"end":14,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":14}}, "properties": [ { "type": "SpreadElement", - "start": 9, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":9,"end":13,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":13}}, "argument": { "type": "Identifier", - "start": 12, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - }, - "identifierName": "x" - }, + "start":12,"end":13,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":13},"identifierName":"x"}, "name": "x" } } diff --git a/packages/babel-parser/test/fixtures/es2018/object-rest-spread/5/output.json b/packages/babel-parser/test/fixtures/es2018/object-rest-spread/5/output.json index d3f66418df30..d02edb84bd14 100644 --- a/packages/babel-parser/test/fixtures/es2018/object-rest-spread/5/output.json +++ b/packages/babel-parser/test/fixtures/es2018/object-rest-spread/5/output.json @@ -1,144 +1,42 @@ { "type": "File", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "program": { "type": "Program", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "expression": { "type": "AssignmentExpression", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "operator": "=", "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "z" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"z"}, "name": "z" }, "right": { "type": "ObjectExpression", - "start": 4, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":4,"end":13,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":13}}, "properties": [ { "type": "ObjectProperty", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, "method": false, "key": { "type": "Identifier", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "x" - }, + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"x"}, "name": "x" }, "computed": false, "shorthand": true, "value": { "type": "Identifier", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "x" - }, + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"x"}, "name": "x" }, "extra": { @@ -147,33 +45,10 @@ }, { "type": "SpreadElement", - "start": 8, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":8,"end":12,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":12}}, "argument": { "type": "Identifier", - "start": 11, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "y" - }, + "start":11,"end":12,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":12},"identifierName":"y"}, "name": "y" } } diff --git a/packages/babel-parser/test/fixtures/es2018/object-rest-spread/6/output.json b/packages/babel-parser/test/fixtures/es2018/object-rest-spread/6/output.json index 1e1e8979748a..12c936bbd4ae 100644 --- a/packages/babel-parser/test/fixtures/es2018/object-rest-spread/6/output.json +++ b/packages/babel-parser/test/fixtures/es2018/object-rest-spread/6/output.json @@ -1,112 +1,33 @@ { "type": "File", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, "program": { "type": "Program", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, "expression": { "type": "ObjectExpression", - "start": 1, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":1,"end":24,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":24}}, "properties": [ { "type": "ObjectProperty", - "start": 2, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 3 - } - }, + "start":2,"end":3,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":3}}, "method": false, "key": { "type": "Identifier", - "start": 2, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 3 - }, - "identifierName": "x" - }, + "start":2,"end":3,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":3},"identifierName":"x"}, "name": "x" }, "computed": false, "shorthand": true, "value": { "type": "Identifier", - "start": 2, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 3 - }, - "identifierName": "x" - }, + "start":2,"end":3,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":3},"identifierName":"x"}, "name": "x" }, "extra": { @@ -115,85 +36,27 @@ }, { "type": "SpreadElement", - "start": 5, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":5,"end":9,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":9}}, "argument": { "type": "Identifier", - "start": 8, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "y" - }, + "start":8,"end":9,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":9},"identifierName":"y"}, "name": "y" } }, { "type": "ObjectProperty", - "start": 11, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":11,"end":12,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":12}}, "method": false, "key": { "type": "Identifier", - "start": 11, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "a" - }, + "start":11,"end":12,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":12},"identifierName":"a"}, "name": "a" }, "computed": false, "shorthand": true, "value": { "type": "Identifier", - "start": 11, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "a" - }, + "start":11,"end":12,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":12},"identifierName":"a"}, "name": "a" }, "extra": { @@ -202,85 +65,27 @@ }, { "type": "SpreadElement", - "start": 14, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":14,"end":18,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":18}}, "argument": { "type": "Identifier", - "start": 17, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - }, - "identifierName": "b" - }, + "start":17,"end":18,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":18},"identifierName":"b"}, "name": "b" } }, { "type": "ObjectProperty", - "start": 20, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":20,"end":21,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":21}}, "method": false, "key": { "type": "Identifier", - "start": 20, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 21 - }, - "identifierName": "c" - }, + "start":20,"end":21,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":21},"identifierName":"c"}, "name": "c" }, "computed": false, "shorthand": true, "value": { "type": "Identifier", - "start": 20, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 21 - }, - "identifierName": "c" - }, + "start":20,"end":21,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":21},"identifierName":"c"}, "name": "c" }, "extra": { @@ -289,6 +94,7 @@ } ], "extra": { + "trailingComma": 21, "parenthesized": true, "parenStart": 0 } diff --git a/packages/babel-parser/test/fixtures/es2018/object-rest-spread/8/options.json b/packages/babel-parser/test/fixtures/es2018/object-rest-spread/8/options.json deleted file mode 100644 index c49db16e2821..000000000000 --- a/packages/babel-parser/test/fixtures/es2018/object-rest-spread/8/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Rest element must be last element (1:16)" -} diff --git a/packages/babel-parser/test/fixtures/es2018/object-rest-spread/8/output.json b/packages/babel-parser/test/fixtures/es2018/object-rest-spread/8/output.json new file mode 100644 index 000000000000..507c8b34b2b7 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2018/object-rest-spread/8/output.json @@ -0,0 +1,90 @@ +{ + "type": "File", + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, + "errors": [ + "SyntaxError: Unexpected trailing comma after rest element (1:16)" + ], + "program": { + "type": "Program", + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":4,"end":25,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":25}}, + "id": { + "type": "ObjectPattern", + "start":4,"end":19,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":19}}, + "properties": [ + { + "type": "ObjectProperty", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7}}, + "method": false, + "key": { + "type": "Identifier", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"x"}, + "name": "x" + }, + "computed": false, + "shorthand": true, + "value": { + "type": "Identifier", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"x"}, + "name": "x" + }, + "extra": { + "shorthand": true + } + }, + { + "type": "ObjectProperty", + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10}}, + "method": false, + "key": { + "type": "Identifier", + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"y"}, + "name": "y" + }, + "computed": false, + "shorthand": true, + "value": { + "type": "Identifier", + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"y"}, + "name": "y" + }, + "extra": { + "shorthand": true + } + }, + { + "type": "RestElement", + "start":12,"end":16,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":16}}, + "argument": { + "type": "Identifier", + "start":15,"end":16,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":16},"identifierName":"z"}, + "name": "z" + } + } + ], + "extra": { + "trailingComma": 16 + } + }, + "init": { + "type": "Identifier", + "start":22,"end":25,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":25},"identifierName":"obj"}, + "name": "obj" + } + } + ], + "kind": "let" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2018/object-rest-spread/comma-after-spread-for-in/input.js b/packages/babel-parser/test/fixtures/es2018/object-rest-spread/comma-after-spread-for-in/input.js new file mode 100644 index 000000000000..f06e08484719 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2018/object-rest-spread/comma-after-spread-for-in/input.js @@ -0,0 +1 @@ +for ({...a,} in []); diff --git a/packages/babel-parser/test/fixtures/es2018/object-rest-spread/comma-after-spread-for-in/options.json b/packages/babel-parser/test/fixtures/es2018/object-rest-spread/comma-after-spread-for-in/options.json new file mode 100644 index 000000000000..b86f80dc4a72 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2018/object-rest-spread/comma-after-spread-for-in/options.json @@ -0,0 +1,3 @@ +{ + "throws": "Rest element must be last element (1:10)" +} diff --git a/packages/babel-parser/test/fixtures/es2018/object-rest-spread/comma-after-spread-nested/input.js b/packages/babel-parser/test/fixtures/es2018/object-rest-spread/comma-after-spread-nested/input.js new file mode 100644 index 000000000000..d532e288fbaf --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2018/object-rest-spread/comma-after-spread-nested/input.js @@ -0,0 +1 @@ +[{...a,}] = []; \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2018/object-rest-spread/comma-after-spread-nested/options.json b/packages/babel-parser/test/fixtures/es2018/object-rest-spread/comma-after-spread-nested/options.json new file mode 100644 index 000000000000..935d087d7ee5 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2018/object-rest-spread/comma-after-spread-nested/options.json @@ -0,0 +1,3 @@ +{ + "throws": "Rest element must be last element (1:6)" +} diff --git a/packages/babel-parser/test/fixtures/es2018/object-rest-spread/comma-after-spread/output.json b/packages/babel-parser/test/fixtures/es2018/object-rest-spread/comma-after-spread/output.json index ffb978345c27..aa360d1055ed 100644 --- a/packages/babel-parser/test/fixtures/es2018/object-rest-spread/comma-after-spread/output.json +++ b/packages/babel-parser/test/fixtures/es2018/object-rest-spread/comma-after-spread/output.json @@ -1,97 +1,31 @@ { "type": "File", - "start": 0, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, "program": { "type": "Program", - "start": 0, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, "expression": { "type": "ObjectExpression", - "start": 1, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":1,"end":8,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":8}}, "properties": [ { "type": "SpreadElement", - "start": 2, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":2,"end":6,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":6}}, "argument": { "type": "Identifier", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "a" - }, + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"a"}, "name": "a" } } ], "extra": { + "trailingComma": 6, "parenthesized": true, "parenStart": 0 } diff --git a/packages/babel-parser/test/fixtures/es2019/json-strings/directive-line-separator/output.json b/packages/babel-parser/test/fixtures/es2019/json-strings/directive-line-separator/output.json index 8bf9f02e8706..cce89e8969d0 100644 --- a/packages/babel-parser/test/fixtures/es2019/json-strings/directive-line-separator/output.json +++ b/packages/babel-parser/test/fixtures/es2019/json-strings/directive-line-separator/output.json @@ -1,63 +1,19 @@ { "type": "File", - "start": 0, - "end": 98, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 82 - } - }, + "start":0,"end":98,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":82}}, "program": { "type": "Program", - "start": 0, - "end": 98, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 82 - } - }, + "start":0,"end":98,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":82}}, "sourceType": "script", "interpreter": null, "body": [], "directives": [ { "type": "Directive", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":7}}, "value": { "type": "DirectiveLiteral", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":6}}, "value": "before
after", "extra": { "raw": "\"before
after\"", @@ -68,18 +24,7 @@ { "type": "CommentLine", "value": " ^ That's a U+2028 LINE SEPARATOR UTF-16 char (between 'before' and 'after')", - "start": 16, - "end": 98, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 82 - } - } + "start":16,"end":98,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":82}} } ] } @@ -89,18 +34,7 @@ { "type": "CommentLine", "value": " ^ That's a U+2028 LINE SEPARATOR UTF-16 char (between 'before' and 'after')", - "start": 16, - "end": 98, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 82 - } - } + "start":16,"end":98,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":82}} } ] } \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2019/json-strings/directive-paragraph-separator/output.json b/packages/babel-parser/test/fixtures/es2019/json-strings/directive-paragraph-separator/output.json index f83d867447e7..2c98f4193473 100644 --- a/packages/babel-parser/test/fixtures/es2019/json-strings/directive-paragraph-separator/output.json +++ b/packages/babel-parser/test/fixtures/es2019/json-strings/directive-paragraph-separator/output.json @@ -1,63 +1,19 @@ { "type": "File", - "start": 0, - "end": 103, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 87 - } - }, + "start":0,"end":103,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":87}}, "program": { "type": "Program", - "start": 0, - "end": 103, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 87 - } - }, + "start":0,"end":103,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":87}}, "sourceType": "script", "interpreter": null, "body": [], "directives": [ { "type": "Directive", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":7}}, "value": { "type": "DirectiveLiteral", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":6}}, "value": "before
after", "extra": { "raw": "\"before
after\"", @@ -68,18 +24,7 @@ { "type": "CommentLine", "value": " ^ That's a U+2029 PARAGRAPH SEPARATOR UTF-16 char (between 'before' and 'after')", - "start": 16, - "end": 103, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 87 - } - } + "start":16,"end":103,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":87}} } ] } @@ -89,18 +34,7 @@ { "type": "CommentLine", "value": " ^ That's a U+2029 PARAGRAPH SEPARATOR UTF-16 char (between 'before' and 'after')", - "start": 16, - "end": 103, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 87 - } - } + "start":16,"end":103,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":87}} } ] } \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2019/json-strings/string-line-separator/output.json b/packages/babel-parser/test/fixtures/es2019/json-strings/string-line-separator/output.json index 388733cc206a..66e271be1549 100644 --- a/packages/babel-parser/test/fixtures/es2019/json-strings/string-line-separator/output.json +++ b/packages/babel-parser/test/fixtures/es2019/json-strings/string-line-separator/output.json @@ -1,62 +1,18 @@ { "type": "File", - "start": 0, - "end": 101, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 83 - } - }, + "start":0,"end":101,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":83}}, "program": { "type": "Program", - "start": 0, - "end": 101, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 83 - } - }, + "start":0,"end":101,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":83}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":8}}, "expression": { "type": "StringLiteral", - "start": 1, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 2, - "column": 15 - } - }, + "start":1,"end":15,"loc":{"start":{"line":1,"column":1},"end":{"line":2,"column":6}}, "extra": { "rawValue": "before
after", "raw": "\"before
after\"", @@ -69,18 +25,7 @@ { "type": "CommentLine", "value": " ^ That's a U+2028 LINE SEPARATOR UTF-16 char (between 'before' and 'after')", - "start": 18, - "end": 101, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 83 - } - } + "start":18,"end":101,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":83}} } ] } @@ -91,18 +36,7 @@ { "type": "CommentLine", "value": " ^ That's a U+2028 LINE SEPARATOR UTF-16 char (between 'before' and 'after')", - "start": 18, - "end": 101, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 83 - } - } + "start":18,"end":101,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":83}} } ] } \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2019/json-strings/string-paragraph-separator/output.json b/packages/babel-parser/test/fixtures/es2019/json-strings/string-paragraph-separator/output.json index a482ccfb266a..2db0f44e8bc8 100644 --- a/packages/babel-parser/test/fixtures/es2019/json-strings/string-paragraph-separator/output.json +++ b/packages/babel-parser/test/fixtures/es2019/json-strings/string-paragraph-separator/output.json @@ -1,62 +1,18 @@ { "type": "File", - "start": 0, - "end": 106, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 88 - } - }, + "start":0,"end":106,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":88}}, "program": { "type": "Program", - "start": 0, - "end": 106, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 88 - } - }, + "start":0,"end":106,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":88}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":8}}, "expression": { "type": "StringLiteral", - "start": 1, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 2, - "column": 15 - } - }, + "start":1,"end":15,"loc":{"start":{"line":1,"column":1},"end":{"line":2,"column":6}}, "extra": { "rawValue": "before
after", "raw": "\"before
after\"", @@ -69,18 +25,7 @@ { "type": "CommentLine", "value": " ^ That's a U+2029 PARAGRAPH SEPARATOR UTF-16 char (between 'before' and 'after')", - "start": 18, - "end": 106, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 88 - } - } + "start":18,"end":106,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":88}} } ] } @@ -91,18 +36,7 @@ { "type": "CommentLine", "value": " ^ That's a U+2029 PARAGRAPH SEPARATOR UTF-16 char (between 'before' and 'after')", - "start": 18, - "end": 106, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 88 - } - } + "start":18,"end":106,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":88}} } ] } \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2019/json-strings/template-line-separator/input.js b/packages/babel-parser/test/fixtures/es2019/json-strings/template-line-separator/input.js new file mode 100644 index 000000000000..73604d9cd234 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2019/json-strings/template-line-separator/input.js @@ -0,0 +1,2 @@ +(`before
after`); +// ^ That's a U+2028 LINE SEPARATOR UTF-16 char (between 'before' and 'after') diff --git a/packages/babel-parser/test/fixtures/es2019/json-strings/template-line-separator/output.json b/packages/babel-parser/test/fixtures/es2019/json-strings/template-line-separator/output.json new file mode 100644 index 000000000000..b0b26b4e1e72 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2019/json-strings/template-line-separator/output.json @@ -0,0 +1,51 @@ +{ + "type": "File", + "start":0,"end":101,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":83}}, + "program": { + "type": "Program", + "start":0,"end":101,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":83}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":8}}, + "expression": { + "type": "TemplateLiteral", + "start":1,"end":15,"loc":{"start":{"line":1,"column":1},"end":{"line":2,"column":6}}, + "expressions": [], + "quasis": [ + { + "type": "TemplateElement", + "start":2,"end":14,"loc":{"start":{"line":1,"column":2},"end":{"line":2,"column":5}}, + "value": { + "raw": "before
after", + "cooked": "before
after" + }, + "tail": true + } + ], + "extra": { + "parenthesized": true, + "parenStart": 0 + } + }, + "trailingComments": [ + { + "type": "CommentLine", + "value": " ^ That's a U+2028 LINE SEPARATOR UTF-16 char (between 'before' and 'after')", + "start":18,"end":101,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":83}} + } + ] + } + ], + "directives": [] + }, + "comments": [ + { + "type": "CommentLine", + "value": " ^ That's a U+2028 LINE SEPARATOR UTF-16 char (between 'before' and 'after')", + "start":18,"end":101,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":83}} + } + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2019/json-strings/template-paragraph-separator/input.js b/packages/babel-parser/test/fixtures/es2019/json-strings/template-paragraph-separator/input.js new file mode 100644 index 000000000000..9272512911d9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2019/json-strings/template-paragraph-separator/input.js @@ -0,0 +1,2 @@ +(`before
after`); +// ^ That's a U+2029 PARAGRAPH SEPARATOR UTF-16 char (between 'before' and 'after') diff --git a/packages/babel-parser/test/fixtures/es2019/json-strings/template-paragraph-separator/output.json b/packages/babel-parser/test/fixtures/es2019/json-strings/template-paragraph-separator/output.json new file mode 100644 index 000000000000..b3e8de1e9b68 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2019/json-strings/template-paragraph-separator/output.json @@ -0,0 +1,51 @@ +{ + "type": "File", + "start":0,"end":106,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":88}}, + "program": { + "type": "Program", + "start":0,"end":106,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":88}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":8}}, + "expression": { + "type": "TemplateLiteral", + "start":1,"end":15,"loc":{"start":{"line":1,"column":1},"end":{"line":2,"column":6}}, + "expressions": [], + "quasis": [ + { + "type": "TemplateElement", + "start":2,"end":14,"loc":{"start":{"line":1,"column":2},"end":{"line":2,"column":5}}, + "value": { + "raw": "before
after", + "cooked": "before
after" + }, + "tail": true + } + ], + "extra": { + "parenthesized": true, + "parenStart": 0 + } + }, + "trailingComments": [ + { + "type": "CommentLine", + "value": " ^ That's a U+2029 PARAGRAPH SEPARATOR UTF-16 char (between 'before' and 'after')", + "start":18,"end":106,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":88}} + } + ] + } + ], + "directives": [] + }, + "comments": [ + { + "type": "CommentLine", + "value": " ^ That's a U+2029 PARAGRAPH SEPARATOR UTF-16 char (between 'before' and 'after')", + "start":18,"end":106,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":88}} + } + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2019/optional-catch-binding/no-binding-finally/output.json b/packages/babel-parser/test/fixtures/es2019/optional-catch-binding/no-binding-finally/output.json index 564ba035b454..4e4a9131154b 100644 --- a/packages/babel-parser/test/fixtures/es2019/optional-catch-binding/no-binding-finally/output.json +++ b/packages/babel-parser/test/fixtures/es2019/optional-catch-binding/no-binding-finally/output.json @@ -1,112 +1,35 @@ { "type": "File", - "start": 0, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 9, - "column": 1 - } - }, + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":9,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 9, - "column": 1 - } - }, + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":9,"column":1}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "TryStatement", - "start": 0, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 9, - "column": 1 - } - }, + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":9,"column":1}}, "block": { "type": "BlockStatement", - "start": 4, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":4,"end":8,"loc":{"start":{"line":1,"column":4},"end":{"line":3,"column":1}}, "body": [], "directives": [] }, "handler": { "type": "CatchClause", - "start": 9, - "end": 19, - "loc": { - "start": { - "line": 4, - "column": 0 - }, - "end": { - "line": 6, - "column": 1 - } - }, + "start":9,"end":19,"loc":{"start":{"line":4,"column":0},"end":{"line":6,"column":1}}, "param": null, "body": { "type": "BlockStatement", - "start": 15, - "end": 19, - "loc": { - "start": { - "line": 4, - "column": 6 - }, - "end": { - "line": 6, - "column": 1 - } - }, + "start":15,"end":19,"loc":{"start":{"line":4,"column":6},"end":{"line":6,"column":1}}, "body": [], "directives": [] } }, "finalizer": { "type": "BlockStatement", - "start": 28, - "end": 34, - "loc": { - "start": { - "line": 7, - "column": 8 - }, - "end": { - "line": 9, - "column": 1 - } - }, + "start":28,"end":34,"loc":{"start":{"line":7,"column":8},"end":{"line":9,"column":1}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/es2019/optional-catch-binding/no-binding/output.json b/packages/babel-parser/test/fixtures/es2019/optional-catch-binding/no-binding/output.json index 0948185b8e4e..e1a072d5ff43 100644 --- a/packages/babel-parser/test/fixtures/es2019/optional-catch-binding/no-binding/output.json +++ b/packages/babel-parser/test/fixtures/es2019/optional-catch-binding/no-binding/output.json @@ -1,94 +1,28 @@ { "type": "File", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 6, - "column": 1 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":6,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 6, - "column": 1 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":6,"column":1}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "TryStatement", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 6, - "column": 1 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":6,"column":1}}, "block": { "type": "BlockStatement", - "start": 4, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":4,"end":8,"loc":{"start":{"line":1,"column":4},"end":{"line":3,"column":1}}, "body": [], "directives": [] }, "handler": { "type": "CatchClause", - "start": 9, - "end": 21, - "loc": { - "start": { - "line": 4, - "column": 0 - }, - "end": { - "line": 6, - "column": 1 - } - }, + "start":9,"end":21,"loc":{"start":{"line":4,"column":0},"end":{"line":6,"column":1}}, "param": null, "body": { "type": "BlockStatement", - "start": 15, - "end": 21, - "loc": { - "start": { - "line": 4, - "column": 6 - }, - "end": { - "line": 6, - "column": 1 - } - }, + "start":15,"end":21,"loc":{"start":{"line":4,"column":6},"end":{"line":6,"column":1}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/es2020/bigint/decimal-as-property-name/input.js b/packages/babel-parser/test/fixtures/es2020/bigint/decimal-as-property-name/input.js new file mode 100644 index 000000000000..f6c9c2b0d01f --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2020/bigint/decimal-as-property-name/input.js @@ -0,0 +1 @@ +({ 0n: 0 }); diff --git a/packages/babel-parser/test/fixtures/es2020/bigint/decimal-as-property-name/output.json b/packages/babel-parser/test/fixtures/es2020/bigint/decimal-as-property-name/output.json new file mode 100644 index 000000000000..38dbce72748a --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2020/bigint/decimal-as-property-name/output.json @@ -0,0 +1,52 @@ +{ + "type": "File", + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "program": { + "type": "Program", + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "expression": { + "type": "ObjectExpression", + "start":1,"end":10,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":10}}, + "properties": [ + { + "type": "ObjectProperty", + "start":3,"end":8,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":8}}, + "method": false, + "key": { + "type": "BigIntLiteral", + "start":3,"end":5,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":5}}, + "extra": { + "rawValue": "0", + "raw": "0n" + }, + "value": "0" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "NumericLiteral", + "start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8}}, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + } + ], + "extra": { + "parenthesized": true, + "parenStart": 0 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2020/bigint/hex-as-property-name/input.js b/packages/babel-parser/test/fixtures/es2020/bigint/hex-as-property-name/input.js new file mode 100644 index 000000000000..537fddf64fc1 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2020/bigint/hex-as-property-name/input.js @@ -0,0 +1 @@ +({ 0xbeefban: 0 }); diff --git a/packages/babel-parser/test/fixtures/es2020/bigint/hex-as-property-name/output.json b/packages/babel-parser/test/fixtures/es2020/bigint/hex-as-property-name/output.json new file mode 100644 index 000000000000..02c95be55bf7 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2020/bigint/hex-as-property-name/output.json @@ -0,0 +1,52 @@ +{ + "type": "File", + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, + "program": { + "type": "Program", + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, + "expression": { + "type": "ObjectExpression", + "start":1,"end":17,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":17}}, + "properties": [ + { + "type": "ObjectProperty", + "start":3,"end":15,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":15}}, + "method": false, + "key": { + "type": "BigIntLiteral", + "start":3,"end":12,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":12}}, + "extra": { + "rawValue": "0xbeefba", + "raw": "0xbeefban" + }, + "value": "0xbeefba" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "NumericLiteral", + "start":14,"end":15,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":15}}, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + } + ], + "extra": { + "parenthesized": true, + "parenStart": 0 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/bigint/invalid-decimal/input.js b/packages/babel-parser/test/fixtures/es2020/bigint/invalid-decimal/input.js similarity index 100% rename from packages/babel-parser/test/fixtures/experimental/bigint/invalid-decimal/input.js rename to packages/babel-parser/test/fixtures/es2020/bigint/invalid-decimal/input.js diff --git a/packages/babel-parser/test/fixtures/es2020/bigint/invalid-decimal/output.json b/packages/babel-parser/test/fixtures/es2020/bigint/invalid-decimal/output.json new file mode 100644 index 000000000000..65fe5c762cc1 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2020/bigint/invalid-decimal/output.json @@ -0,0 +1,29 @@ +{ + "type": "File", + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, + "errors": [ + "SyntaxError: Invalid BigIntLiteral (1:0)" + ], + "program": { + "type": "Program", + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, + "expression": { + "type": "BigIntLiteral", + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, + "extra": { + "rawValue": "1.0", + "raw": "1.0n" + }, + "value": "1.0" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/bigint/invalid-e/input.js b/packages/babel-parser/test/fixtures/es2020/bigint/invalid-e/input.js similarity index 100% rename from packages/babel-parser/test/fixtures/experimental/bigint/invalid-e/input.js rename to packages/babel-parser/test/fixtures/es2020/bigint/invalid-e/input.js diff --git a/packages/babel-parser/test/fixtures/es2020/bigint/invalid-e/output.json b/packages/babel-parser/test/fixtures/es2020/bigint/invalid-e/output.json new file mode 100644 index 000000000000..ece9adc5b936 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2020/bigint/invalid-e/output.json @@ -0,0 +1,29 @@ +{ + "type": "File", + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, + "errors": [ + "SyntaxError: Invalid BigIntLiteral (1:0)" + ], + "program": { + "type": "Program", + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, + "expression": { + "type": "BigIntLiteral", + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, + "extra": { + "rawValue": "2e9", + "raw": "2e9n" + }, + "value": "2e9" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2020/bigint/invalid-non-octal-decimal-int/input.js b/packages/babel-parser/test/fixtures/es2020/bigint/invalid-non-octal-decimal-int/input.js new file mode 100644 index 000000000000..488077f06c3f --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2020/bigint/invalid-non-octal-decimal-int/input.js @@ -0,0 +1 @@ +089n \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2020/bigint/invalid-non-octal-decimal-int/output.json b/packages/babel-parser/test/fixtures/es2020/bigint/invalid-non-octal-decimal-int/output.json new file mode 100644 index 000000000000..c7ff73f0e76a --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2020/bigint/invalid-non-octal-decimal-int/output.json @@ -0,0 +1,29 @@ +{ + "type": "File", + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, + "errors": [ + "SyntaxError: Invalid BigIntLiteral (1:0)" + ], + "program": { + "type": "Program", + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, + "expression": { + "type": "BigIntLiteral", + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, + "extra": { + "rawValue": "089", + "raw": "089n" + }, + "value": "089" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/bigint/invalid-octal-legacy/input.js b/packages/babel-parser/test/fixtures/es2020/bigint/invalid-octal-legacy/input.js similarity index 100% rename from packages/babel-parser/test/fixtures/experimental/bigint/invalid-octal-legacy/input.js rename to packages/babel-parser/test/fixtures/es2020/bigint/invalid-octal-legacy/input.js diff --git a/packages/babel-parser/test/fixtures/es2020/bigint/invalid-octal-legacy/output.json b/packages/babel-parser/test/fixtures/es2020/bigint/invalid-octal-legacy/output.json new file mode 100644 index 000000000000..8f1e2836cd40 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2020/bigint/invalid-octal-legacy/output.json @@ -0,0 +1,29 @@ +{ + "type": "File", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "errors": [ + "SyntaxError: Invalid BigIntLiteral (1:0)" + ], + "program": { + "type": "Program", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "expression": { + "type": "BigIntLiteral", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "extra": { + "rawValue": "016432", + "raw": "016432n" + }, + "value": "016432" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/bigint/valid-binary/input.js b/packages/babel-parser/test/fixtures/es2020/bigint/valid-binary/input.js similarity index 100% rename from packages/babel-parser/test/fixtures/experimental/bigint/valid-binary/input.js rename to packages/babel-parser/test/fixtures/es2020/bigint/valid-binary/input.js diff --git a/packages/babel-parser/test/fixtures/es2020/bigint/valid-binary/output.json b/packages/babel-parser/test/fixtures/es2020/bigint/valid-binary/output.json new file mode 100644 index 000000000000..ee97cc16205a --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2020/bigint/valid-binary/output.json @@ -0,0 +1,26 @@ +{ + "type": "File", + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "program": { + "type": "Program", + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "expression": { + "type": "BigIntLiteral", + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "extra": { + "rawValue": "0b101011101", + "raw": "0b101011101n" + }, + "value": "0b101011101" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/bigint/valid-hex/input.js b/packages/babel-parser/test/fixtures/es2020/bigint/valid-hex/input.js similarity index 100% rename from packages/babel-parser/test/fixtures/experimental/bigint/valid-hex/input.js rename to packages/babel-parser/test/fixtures/es2020/bigint/valid-hex/input.js diff --git a/packages/babel-parser/test/fixtures/es2020/bigint/valid-hex/output.json b/packages/babel-parser/test/fixtures/es2020/bigint/valid-hex/output.json new file mode 100644 index 000000000000..643986655140 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2020/bigint/valid-hex/output.json @@ -0,0 +1,26 @@ +{ + "type": "File", + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "program": { + "type": "Program", + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "expression": { + "type": "BigIntLiteral", + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "extra": { + "rawValue": "0xFFF123", + "raw": "0xFFF123n" + }, + "value": "0xFFF123" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/bigint/valid-large/input.js b/packages/babel-parser/test/fixtures/es2020/bigint/valid-large/input.js similarity index 100% rename from packages/babel-parser/test/fixtures/experimental/bigint/valid-large/input.js rename to packages/babel-parser/test/fixtures/es2020/bigint/valid-large/input.js diff --git a/packages/babel-parser/test/fixtures/es2020/bigint/valid-large/output.json b/packages/babel-parser/test/fixtures/es2020/bigint/valid-large/output.json new file mode 100644 index 000000000000..2f6c43363a73 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2020/bigint/valid-large/output.json @@ -0,0 +1,26 @@ +{ + "type": "File", + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, + "program": { + "type": "Program", + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, + "expression": { + "type": "BigIntLiteral", + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, + "extra": { + "rawValue": "9223372036854775807", + "raw": "9223372036854775807n" + }, + "value": "9223372036854775807" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/bigint/valid-octal-new/input.js b/packages/babel-parser/test/fixtures/es2020/bigint/valid-octal-new/input.js similarity index 100% rename from packages/babel-parser/test/fixtures/experimental/bigint/valid-octal-new/input.js rename to packages/babel-parser/test/fixtures/es2020/bigint/valid-octal-new/input.js diff --git a/packages/babel-parser/test/fixtures/es2020/bigint/valid-octal-new/output.json b/packages/babel-parser/test/fixtures/es2020/bigint/valid-octal-new/output.json new file mode 100644 index 000000000000..509af20126eb --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2020/bigint/valid-octal-new/output.json @@ -0,0 +1,26 @@ +{ + "type": "File", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "program": { + "type": "Program", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "expression": { + "type": "BigIntLiteral", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "extra": { + "rawValue": "0o16432", + "raw": "0o16432n" + }, + "value": "0o16432" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/bigint/valid-small/input.js b/packages/babel-parser/test/fixtures/es2020/bigint/valid-small/input.js similarity index 100% rename from packages/babel-parser/test/fixtures/experimental/bigint/valid-small/input.js rename to packages/babel-parser/test/fixtures/es2020/bigint/valid-small/input.js diff --git a/packages/babel-parser/test/fixtures/es2020/bigint/valid-small/output.json b/packages/babel-parser/test/fixtures/es2020/bigint/valid-small/output.json new file mode 100644 index 000000000000..48429544d645 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2020/bigint/valid-small/output.json @@ -0,0 +1,26 @@ +{ + "type": "File", + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, + "program": { + "type": "Program", + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, + "expression": { + "type": "BigIntLiteral", + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, + "extra": { + "rawValue": "100", + "raw": "100n" + }, + "value": "100" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/dynamic-import/direct-calls-only/input.js b/packages/babel-parser/test/fixtures/es2020/dynamic-import/direct-calls-only/input.js similarity index 100% rename from packages/babel-parser/test/fixtures/experimental/dynamic-import/direct-calls-only/input.js rename to packages/babel-parser/test/fixtures/es2020/dynamic-import/direct-calls-only/input.js diff --git a/packages/babel-parser/test/fixtures/es2020/dynamic-import/direct-calls-only/output.json b/packages/babel-parser/test/fixtures/es2020/dynamic-import/direct-calls-only/output.json new file mode 100644 index 000000000000..c091e5986ab8 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2020/dynamic-import/direct-calls-only/output.json @@ -0,0 +1,59 @@ +{ + "type": "File", + "start":0,"end":49,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "errors": [ + "SyntaxError: Dynamic imports require a parameter: import('a.js') (2:9)", + "SyntaxError: The only valid meta property for import is import.meta (2:16)" + ], + "program": { + "type": "Program", + "start":0,"end":49,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":49,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "id": { + "type": "Identifier", + "start":9,"end":19,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":19},"identifierName":"failsParse"}, + "name": "failsParse" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":22,"end":49,"loc":{"start":{"line":1,"column":22},"end":{"line":3,"column":1}}, + "body": [ + { + "type": "ReturnStatement", + "start":26,"end":47,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":23}}, + "argument": { + "type": "CallExpression", + "start":33,"end":46,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":22}}, + "callee": { + "type": "MetaProperty", + "start":33,"end":44,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":20}}, + "meta": { + "type": "Identifier", + "start":33,"end":39,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":15},"identifierName":"import"}, + "name": "import" + }, + "property": { + "type": "Identifier", + "start":40,"end":44,"loc":{"start":{"line":2,"column":16},"end":{"line":2,"column":20},"identifierName":"then"}, + "name": "then" + } + }, + "arguments": [] + } + } + ], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/dynamic-import/generator/input.js b/packages/babel-parser/test/fixtures/es2020/dynamic-import/generator/input.js similarity index 100% rename from packages/babel-parser/test/fixtures/experimental/dynamic-import/generator/input.js rename to packages/babel-parser/test/fixtures/es2020/dynamic-import/generator/input.js diff --git a/packages/babel-parser/test/fixtures/es2020/dynamic-import/generator/output.json b/packages/babel-parser/test/fixtures/es2020/dynamic-import/generator/output.json new file mode 100644 index 000000000000..5c9dba006a29 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2020/dynamic-import/generator/output.json @@ -0,0 +1,60 @@ +{ + "type": "File", + "start":0,"end":41,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "program": { + "type": "Program", + "start":0,"end":41,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":41,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "id": { + "type": "Identifier", + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11},"identifierName":"a"}, + "name": "a" + }, + "generator": true, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":14,"end":41,"loc":{"start":{"line":1,"column":14},"end":{"line":3,"column":1}}, + "body": [ + { + "type": "ExpressionStatement", + "start":18,"end":39,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":23}}, + "expression": { + "type": "YieldExpression", + "start":18,"end":38,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":22}}, + "delegate": false, + "argument": { + "type": "CallExpression", + "start":24,"end":38,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":22}}, + "callee": { + "type": "Import", + "start":24,"end":30,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":14}} + }, + "arguments": [ + { + "type": "StringLiteral", + "start":31,"end":37,"loc":{"start":{"line":2,"column":15},"end":{"line":2,"column":21}}, + "extra": { + "rawValue": "http", + "raw": "'http'" + }, + "value": "http" + } + ] + } + } + } + ], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/dynamic-import/inside-function/input.js b/packages/babel-parser/test/fixtures/es2020/dynamic-import/inside-function/input.js similarity index 100% rename from packages/babel-parser/test/fixtures/experimental/dynamic-import/inside-function/input.js rename to packages/babel-parser/test/fixtures/es2020/dynamic-import/inside-function/input.js diff --git a/packages/babel-parser/test/fixtures/es2020/dynamic-import/inside-function/output.json b/packages/babel-parser/test/fixtures/es2020/dynamic-import/inside-function/output.json new file mode 100644 index 000000000000..31948b66472d --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2020/dynamic-import/inside-function/output.json @@ -0,0 +1,83 @@ +{ + "type": "File", + "start":0,"end":65,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "program": { + "type": "Program", + "start":0,"end":65,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":65,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "id": { + "type": "Identifier", + "start":9,"end":19,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":19},"identifierName":"loadImport"}, + "name": "loadImport" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start":20,"end":24,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":24},"identifierName":"file"}, + "name": "file" + } + ], + "body": { + "type": "BlockStatement", + "start":26,"end":65,"loc":{"start":{"line":1,"column":26},"end":{"line":3,"column":1}}, + "body": [ + { + "type": "ReturnStatement", + "start":30,"end":63,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":35}}, + "argument": { + "type": "CallExpression", + "start":37,"end":62,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":34}}, + "callee": { + "type": "Import", + "start":37,"end":43,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":15}} + }, + "arguments": [ + { + "type": "TemplateLiteral", + "start":44,"end":61,"loc":{"start":{"line":2,"column":16},"end":{"line":2,"column":33}}, + "expressions": [ + { + "type": "Identifier", + "start":52,"end":56,"loc":{"start":{"line":2,"column":24},"end":{"line":2,"column":28},"identifierName":"file"}, + "name": "file" + } + ], + "quasis": [ + { + "type": "TemplateElement", + "start":45,"end":50,"loc":{"start":{"line":2,"column":17},"end":{"line":2,"column":22}}, + "value": { + "raw": "test/", + "cooked": "test/" + }, + "tail": false + }, + { + "type": "TemplateElement", + "start":57,"end":60,"loc":{"start":{"line":2,"column":29},"end":{"line":2,"column":32}}, + "value": { + "raw": ".js", + "cooked": ".js" + }, + "tail": true + } + ] + } + ] + } + } + ], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/dynamic-import/invalid-arguments-spread/input.js b/packages/babel-parser/test/fixtures/es2020/dynamic-import/invalid-arguments-spread/input.js similarity index 100% rename from packages/babel-parser/test/fixtures/experimental/dynamic-import/invalid-arguments-spread/input.js rename to packages/babel-parser/test/fixtures/es2020/dynamic-import/invalid-arguments-spread/input.js diff --git a/packages/babel-parser/test/fixtures/es2020/dynamic-import/invalid-arguments-spread/output.json b/packages/babel-parser/test/fixtures/es2020/dynamic-import/invalid-arguments-spread/output.json new file mode 100644 index 000000000000..11c9e8f7db62 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2020/dynamic-import/invalid-arguments-spread/output.json @@ -0,0 +1,49 @@ +{ + "type": "File", + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, + "errors": [ + "SyntaxError: ... is not allowed in import() (1:7)" + ], + "program": { + "type": "Program", + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, + "expression": { + "type": "CallExpression", + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, + "callee": { + "type": "Import", + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}} + }, + "arguments": [ + { + "type": "SpreadElement", + "start":7,"end":13,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":13}}, + "argument": { + "type": "ArrayExpression", + "start":10,"end":13,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":13}}, + "elements": [ + { + "type": "NumericLiteral", + "start":11,"end":12,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":12}}, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + ] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/dynamic-import/invalid-new/input.js b/packages/babel-parser/test/fixtures/es2020/dynamic-import/invalid-new/input.js similarity index 100% rename from packages/babel-parser/test/fixtures/experimental/dynamic-import/invalid-new/input.js rename to packages/babel-parser/test/fixtures/es2020/dynamic-import/invalid-new/input.js diff --git a/packages/babel-parser/test/fixtures/es2020/dynamic-import/invalid-new/output.json b/packages/babel-parser/test/fixtures/es2020/dynamic-import/invalid-new/output.json new file mode 100644 index 000000000000..246d3d373cb5 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2020/dynamic-import/invalid-new/output.json @@ -0,0 +1,39 @@ +{ + "type": "File", + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, + "errors": [ + "SyntaxError: Cannot use new with import(...) (1:4)" + ], + "program": { + "type": "Program", + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, + "expression": { + "type": "NewExpression", + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, + "callee": { + "type": "Import", + "start":4,"end":10,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":10}} + }, + "arguments": [ + { + "type": "StringLiteral", + "start":11,"end":16,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":16}}, + "extra": { + "rawValue": "foo", + "raw": "\"foo\"" + }, + "value": "foo" + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/dynamic-import/invalid-trailing-comma/input.js b/packages/babel-parser/test/fixtures/es2020/dynamic-import/invalid-trailing-comma/input.js similarity index 100% rename from packages/babel-parser/test/fixtures/experimental/dynamic-import/invalid-trailing-comma/input.js rename to packages/babel-parser/test/fixtures/es2020/dynamic-import/invalid-trailing-comma/input.js diff --git a/packages/babel-parser/test/fixtures/es2020/dynamic-import/invalid-trailing-comma/output.json b/packages/babel-parser/test/fixtures/es2020/dynamic-import/invalid-trailing-comma/output.json new file mode 100644 index 000000000000..6e5fa8365696 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2020/dynamic-import/invalid-trailing-comma/output.json @@ -0,0 +1,42 @@ +{ + "type": "File", + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, + "errors": [ + "SyntaxError: Trailing comma is disallowed inside import(...) arguments (1:12)" + ], + "program": { + "type": "Program", + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, + "expression": { + "type": "CallExpression", + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, + "callee": { + "type": "Import", + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}} + }, + "extra": { + "trailingComma": 12 + }, + "arguments": [ + { + "type": "StringLiteral", + "start":7,"end":12,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":12}}, + "extra": { + "rawValue": "foo", + "raw": "\"foo\"" + }, + "value": "foo" + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/dynamic-import/multiple-args/input.js b/packages/babel-parser/test/fixtures/es2020/dynamic-import/multiple-args/input.js similarity index 100% rename from packages/babel-parser/test/fixtures/experimental/dynamic-import/multiple-args/input.js rename to packages/babel-parser/test/fixtures/es2020/dynamic-import/multiple-args/input.js diff --git a/packages/babel-parser/test/fixtures/es2020/dynamic-import/multiple-args/output.json b/packages/babel-parser/test/fixtures/es2020/dynamic-import/multiple-args/output.json new file mode 100644 index 000000000000..46409dca7a6b --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2020/dynamic-import/multiple-args/output.json @@ -0,0 +1,48 @@ +{ + "type": "File", + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, + "errors": [ + "SyntaxError: import() requires exactly one argument (1:0)" + ], + "program": { + "type": "Program", + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, + "expression": { + "type": "CallExpression", + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, + "callee": { + "type": "Import", + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}} + }, + "arguments": [ + { + "type": "StringLiteral", + "start":7,"end":14,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":14}}, + "extra": { + "rawValue": "hello", + "raw": "'hello'" + }, + "value": "hello" + }, + { + "type": "StringLiteral", + "start":16,"end":23,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":23}}, + "extra": { + "rawValue": "world", + "raw": "'world'" + }, + "value": "world" + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/dynamic-import/no-args/input.js b/packages/babel-parser/test/fixtures/es2020/dynamic-import/no-args/input.js similarity index 100% rename from packages/babel-parser/test/fixtures/experimental/dynamic-import/no-args/input.js rename to packages/babel-parser/test/fixtures/es2020/dynamic-import/no-args/input.js diff --git a/packages/babel-parser/test/fixtures/es2020/dynamic-import/no-args/output.json b/packages/babel-parser/test/fixtures/es2020/dynamic-import/no-args/output.json new file mode 100644 index 000000000000..fe2978c702f4 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2020/dynamic-import/no-args/output.json @@ -0,0 +1,29 @@ +{ + "type": "File", + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "errors": [ + "SyntaxError: import() requires exactly one argument (1:0)" + ], + "program": { + "type": "Program", + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "expression": { + "type": "CallExpression", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "callee": { + "type": "Import", + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}} + }, + "arguments": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/dynamic-import/no-plugin/input.js b/packages/babel-parser/test/fixtures/es2020/dynamic-import/parses-module/input.js similarity index 100% rename from packages/babel-parser/test/fixtures/experimental/dynamic-import/no-plugin/input.js rename to packages/babel-parser/test/fixtures/es2020/dynamic-import/parses-module/input.js diff --git a/packages/babel-parser/test/fixtures/es2020/dynamic-import/parses-module/options.json b/packages/babel-parser/test/fixtures/es2020/dynamic-import/parses-module/options.json new file mode 100644 index 000000000000..2104ca43283f --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2020/dynamic-import/parses-module/options.json @@ -0,0 +1,3 @@ +{ + "sourceType": "module" +} diff --git a/packages/babel-parser/test/fixtures/es2020/dynamic-import/parses-module/output.json b/packages/babel-parser/test/fixtures/es2020/dynamic-import/parses-module/output.json new file mode 100644 index 000000000000..739eeadcdbfc --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2020/dynamic-import/parses-module/output.json @@ -0,0 +1,36 @@ +{ + "type": "File", + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, + "program": { + "type": "Program", + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, + "expression": { + "type": "CallExpression", + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, + "callee": { + "type": "Import", + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}} + }, + "arguments": [ + { + "type": "StringLiteral", + "start":7,"end":16,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":16}}, + "extra": { + "rawValue": "test.js", + "raw": "'test.js'" + }, + "value": "test.js" + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/dynamic-import/parses-strict/input.js b/packages/babel-parser/test/fixtures/es2020/dynamic-import/parses-strict/input.js similarity index 100% rename from packages/babel-parser/test/fixtures/experimental/dynamic-import/parses-strict/input.js rename to packages/babel-parser/test/fixtures/es2020/dynamic-import/parses-strict/input.js diff --git a/packages/babel-parser/test/fixtures/es2020/dynamic-import/parses-strict/output.json b/packages/babel-parser/test/fixtures/es2020/dynamic-import/parses-strict/output.json new file mode 100644 index 000000000000..d6607373b77a --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2020/dynamic-import/parses-strict/output.json @@ -0,0 +1,50 @@ +{ + "type": "File", + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":18}}, + "program": { + "type": "Program", + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":18}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":15,"end":33,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":18}}, + "expression": { + "type": "CallExpression", + "start":15,"end":32,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":17}}, + "callee": { + "type": "Import", + "start":15,"end":21,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":6}} + }, + "arguments": [ + { + "type": "StringLiteral", + "start":22,"end":31,"loc":{"start":{"line":3,"column":7},"end":{"line":3,"column":16}}, + "extra": { + "rawValue": "test.js", + "raw": "'test.js'" + }, + "value": "test.js" + } + ] + } + } + ], + "directives": [ + { + "type": "Directive", + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "value": { + "type": "DirectiveLiteral", + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/dynamic-import/return-value/input.js b/packages/babel-parser/test/fixtures/es2020/dynamic-import/return-value/input.js similarity index 100% rename from packages/babel-parser/test/fixtures/experimental/dynamic-import/return-value/input.js rename to packages/babel-parser/test/fixtures/es2020/dynamic-import/return-value/input.js diff --git a/packages/babel-parser/test/fixtures/es2020/dynamic-import/return-value/output.json b/packages/babel-parser/test/fixtures/es2020/dynamic-import/return-value/output.json new file mode 100644 index 000000000000..5fb7d58a8ea1 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2020/dynamic-import/return-value/output.json @@ -0,0 +1,48 @@ +{ + "type": "File", + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":39}}, + "program": { + "type": "Program", + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":39}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":39}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":6,"end":38,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":38}}, + "id": { + "type": "Identifier", + "start":6,"end":18,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":18},"identifierName":"importResult"}, + "name": "importResult" + }, + "init": { + "type": "CallExpression", + "start":21,"end":38,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":38}}, + "callee": { + "type": "Import", + "start":21,"end":27,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":27}} + }, + "arguments": [ + { + "type": "StringLiteral", + "start":28,"end":37,"loc":{"start":{"line":1,"column":28},"end":{"line":1,"column":37}}, + "extra": { + "rawValue": "test.js", + "raw": "'test.js'" + }, + "value": "test.js" + } + ] + } + } + ], + "kind": "const" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/dynamic-import/top-level/input.js b/packages/babel-parser/test/fixtures/es2020/dynamic-import/top-level/input.js similarity index 100% rename from packages/babel-parser/test/fixtures/experimental/dynamic-import/top-level/input.js rename to packages/babel-parser/test/fixtures/es2020/dynamic-import/top-level/input.js diff --git a/packages/babel-parser/test/fixtures/es2020/dynamic-import/top-level/output.json b/packages/babel-parser/test/fixtures/es2020/dynamic-import/top-level/output.json new file mode 100644 index 000000000000..af065bea07c6 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2020/dynamic-import/top-level/output.json @@ -0,0 +1,159 @@ +{ + "type": "File", + "start":0,"end":112,"loc":{"start":{"line":1,"column":0},"end":{"line":6,"column":36}}, + "program": { + "type": "Program", + "start":0,"end":112,"loc":{"start":{"line":1,"column":0},"end":{"line":6,"column":36}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, + "expression": { + "type": "CallExpression", + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, + "callee": { + "type": "Import", + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}} + }, + "arguments": [ + { + "type": "StringLiteral", + "start":7,"end":19,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":19}}, + "extra": { + "rawValue": "testing.js", + "raw": "'testing.js'" + }, + "value": "testing.js" + } + ] + } + }, + { + "type": "VariableDeclaration", + "start":23,"end":44,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":21}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":29,"end":43,"loc":{"start":{"line":3,"column":6},"end":{"line":3,"column":20}}, + "id": { + "type": "Identifier", + "start":29,"end":33,"loc":{"start":{"line":3,"column":6},"end":{"line":3,"column":10},"identifierName":"test"}, + "name": "test" + }, + "init": { + "type": "StringLiteral", + "start":36,"end":43,"loc":{"start":{"line":3,"column":13},"end":{"line":3,"column":20}}, + "extra": { + "rawValue": "hello", + "raw": "'hello'" + }, + "value": "hello" + } + } + ], + "kind": "const" + }, + { + "type": "ExpressionStatement", + "start":45,"end":74,"loc":{"start":{"line":4,"column":0},"end":{"line":4,"column":29}}, + "expression": { + "type": "CallExpression", + "start":45,"end":73,"loc":{"start":{"line":4,"column":0},"end":{"line":4,"column":28}}, + "callee": { + "type": "Import", + "start":45,"end":51,"loc":{"start":{"line":4,"column":0},"end":{"line":4,"column":6}} + }, + "arguments": [ + { + "type": "TemplateLiteral", + "start":52,"end":72,"loc":{"start":{"line":4,"column":7},"end":{"line":4,"column":27}}, + "expressions": [ + { + "type": "Identifier", + "start":63,"end":67,"loc":{"start":{"line":4,"column":18},"end":{"line":4,"column":22},"identifierName":"test"}, + "name": "test" + } + ], + "quasis": [ + { + "type": "TemplateElement", + "start":53,"end":61,"loc":{"start":{"line":4,"column":8},"end":{"line":4,"column":16}}, + "value": { + "raw": "testing/", + "cooked": "testing/" + }, + "tail": false + }, + { + "type": "TemplateElement", + "start":68,"end":71,"loc":{"start":{"line":4,"column":23},"end":{"line":4,"column":26}}, + "value": { + "raw": ".js", + "cooked": ".js" + }, + "tail": true + } + ] + } + ] + } + }, + { + "type": "ExpressionStatement", + "start":76,"end":112,"loc":{"start":{"line":6,"column":0},"end":{"line":6,"column":36}}, + "expression": { + "type": "CallExpression", + "start":76,"end":111,"loc":{"start":{"line":6,"column":0},"end":{"line":6,"column":35}}, + "callee": { + "type": "MemberExpression", + "start":76,"end":101,"loc":{"start":{"line":6,"column":0},"end":{"line":6,"column":25}}, + "object": { + "type": "CallExpression", + "start":76,"end":96,"loc":{"start":{"line":6,"column":0},"end":{"line":6,"column":20}}, + "callee": { + "type": "Import", + "start":76,"end":82,"loc":{"start":{"line":6,"column":0},"end":{"line":6,"column":6}} + }, + "arguments": [ + { + "type": "StringLiteral", + "start":83,"end":95,"loc":{"start":{"line":6,"column":7},"end":{"line":6,"column":19}}, + "extra": { + "rawValue": "testing.js", + "raw": "'testing.js'" + }, + "value": "testing.js" + } + ] + }, + "property": { + "type": "Identifier", + "start":97,"end":101,"loc":{"start":{"line":6,"column":21},"end":{"line":6,"column":25},"identifierName":"then"}, + "name": "then" + }, + "computed": false + }, + "arguments": [ + { + "type": "ArrowFunctionExpression", + "start":102,"end":110,"loc":{"start":{"line":6,"column":26},"end":{"line":6,"column":34}}, + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":108,"end":110,"loc":{"start":{"line":6,"column":32},"end":{"line":6,"column":34}}, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/dynamic-import/variable-arguments/input.js b/packages/babel-parser/test/fixtures/es2020/dynamic-import/variable-arguments/input.js similarity index 100% rename from packages/babel-parser/test/fixtures/experimental/dynamic-import/variable-arguments/input.js rename to packages/babel-parser/test/fixtures/es2020/dynamic-import/variable-arguments/input.js diff --git a/packages/babel-parser/test/fixtures/es2020/dynamic-import/variable-arguments/output.json b/packages/babel-parser/test/fixtures/es2020/dynamic-import/variable-arguments/output.json new file mode 100644 index 000000000000..b631aff245b2 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2020/dynamic-import/variable-arguments/output.json @@ -0,0 +1,87 @@ +{ + "type": "File", + "start":0,"end":66,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":35}}, + "program": { + "type": "Program", + "start":0,"end":66,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":35}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":6,"end":29,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":29}}, + "id": { + "type": "Identifier", + "start":6,"end":17,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":17},"identifierName":"testVarible"}, + "name": "testVarible" + }, + "init": { + "type": "StringLiteral", + "start":20,"end":29,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":29}}, + "extra": { + "rawValue": "test.js", + "raw": "'test.js'" + }, + "value": "test.js" + } + } + ], + "kind": "const" + }, + { + "type": "ExpressionStatement", + "start":31,"end":66,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":35}}, + "expression": { + "type": "CallExpression", + "start":31,"end":65,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":34}}, + "callee": { + "type": "MemberExpression", + "start":31,"end":55,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":24}}, + "object": { + "type": "CallExpression", + "start":31,"end":50,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":19}}, + "callee": { + "type": "Import", + "start":31,"end":37,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":6}} + }, + "arguments": [ + { + "type": "Identifier", + "start":38,"end":49,"loc":{"start":{"line":2,"column":7},"end":{"line":2,"column":18},"identifierName":"testVarible"}, + "name": "testVarible" + } + ] + }, + "property": { + "type": "Identifier", + "start":51,"end":55,"loc":{"start":{"line":2,"column":20},"end":{"line":2,"column":24},"identifierName":"then"}, + "name": "then" + }, + "computed": false + }, + "arguments": [ + { + "type": "ArrowFunctionExpression", + "start":56,"end":64,"loc":{"start":{"line":2,"column":25},"end":{"line":2,"column":33}}, + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":62,"end":64,"loc":{"start":{"line":2,"column":31},"end":{"line":2,"column":33}}, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/export-extensions/ns-and-named/input.js b/packages/babel-parser/test/fixtures/es2020/export-ns-from/ns-and-named/input.js similarity index 100% rename from packages/babel-parser/test/fixtures/experimental/export-extensions/ns-and-named/input.js rename to packages/babel-parser/test/fixtures/es2020/export-ns-from/ns-and-named/input.js diff --git a/packages/babel-parser/test/fixtures/es2020/export-ns-from/ns-and-named/output.json b/packages/babel-parser/test/fixtures/es2020/export-ns-from/ns-and-named/output.json new file mode 100644 index 000000000000..f4954b348fc1 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2020/export-ns-from/ns-and-named/output.json @@ -0,0 +1,52 @@ +{ + "type": "File", + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, + "program": { + "type": "Program", + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExportNamedDeclaration", + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, + "specifiers": [ + { + "type": "ExportNamespaceSpecifier", + "start":7,"end":15,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":15}}, + "exported": { + "type": "Identifier", + "start":12,"end":15,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":15},"identifierName":"foo"}, + "name": "foo" + } + }, + { + "type": "ExportSpecifier", + "start":19,"end":22,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":22}}, + "local": { + "type": "Identifier", + "start":19,"end":22,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":22},"identifierName":"bar"}, + "name": "bar" + }, + "exported": { + "type": "Identifier", + "start":19,"end":22,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":22},"identifierName":"bar"}, + "name": "bar" + } + } + ], + "source": { + "type": "StringLiteral", + "start":30,"end":35,"loc":{"start":{"line":1,"column":30},"end":{"line":1,"column":35}}, + "extra": { + "rawValue": "bar", + "raw": "\"bar\"" + }, + "value": "bar" + }, + "declaration": null + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/export-extensions/ns-default/input.js b/packages/babel-parser/test/fixtures/es2020/export-ns-from/ns-default/input.js similarity index 100% rename from packages/babel-parser/test/fixtures/experimental/export-extensions/ns-default/input.js rename to packages/babel-parser/test/fixtures/es2020/export-ns-from/ns-default/input.js diff --git a/packages/babel-parser/test/fixtures/es2020/export-ns-from/ns-default/output.json b/packages/babel-parser/test/fixtures/es2020/export-ns-from/ns-default/output.json new file mode 100644 index 000000000000..920b02e4e9b0 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2020/export-ns-from/ns-default/output.json @@ -0,0 +1,37 @@ +{ + "type": "File", + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, + "program": { + "type": "Program", + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExportNamedDeclaration", + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, + "specifiers": [ + { + "type": "ExportNamespaceSpecifier", + "start":7,"end":19,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":19}}, + "exported": { + "type": "Identifier", + "start":12,"end":19,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":19},"identifierName":"default"}, + "name": "default" + } + } + ], + "source": { + "type": "StringLiteral", + "start":25,"end":30,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":30}}, + "extra": { + "rawValue": "foo", + "raw": "\"foo\"" + }, + "value": "foo" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/_no-plugin/export-namespace/input.js b/packages/babel-parser/test/fixtures/es2020/export-ns-from/ns/input.js similarity index 100% rename from packages/babel-parser/test/fixtures/experimental/_no-plugin/export-namespace/input.js rename to packages/babel-parser/test/fixtures/es2020/export-ns-from/ns/input.js diff --git a/packages/babel-parser/test/fixtures/es2020/export-ns-from/ns/output.json b/packages/babel-parser/test/fixtures/es2020/export-ns-from/ns/output.json new file mode 100644 index 000000000000..20dd04d14eb6 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2020/export-ns-from/ns/output.json @@ -0,0 +1,37 @@ +{ + "type": "File", + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, + "program": { + "type": "Program", + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExportNamedDeclaration", + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, + "specifiers": [ + { + "type": "ExportNamespaceSpecifier", + "start":7,"end":13,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":13}}, + "exported": { + "type": "Identifier", + "start":12,"end":13,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":13},"identifierName":"A"}, + "name": "A" + } + } + ], + "source": { + "type": "StringLiteral", + "start":19,"end":25,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":25}}, + "extra": { + "rawValue": "test", + "raw": "'test'" + }, + "value": "test" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2020/export-ns-from/options.json b/packages/babel-parser/test/fixtures/es2020/export-ns-from/options.json new file mode 100644 index 000000000000..2104ca43283f --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2020/export-ns-from/options.json @@ -0,0 +1,3 @@ +{ + "sourceType": "module" +} diff --git a/packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/and-nullish/input.js b/packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/and-nullish/input.js new file mode 100644 index 000000000000..4080eadc3962 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/and-nullish/input.js @@ -0,0 +1 @@ +(a && b) ?? c; diff --git a/packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/and-nullish/output.json b/packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/and-nullish/output.json new file mode 100644 index 000000000000..5a11d8ff2b9d --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/and-nullish/output.json @@ -0,0 +1,46 @@ +{ + "type": "File", + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, + "program": { + "type": "Program", + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, + "expression": { + "type": "LogicalExpression", + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "left": { + "type": "LogicalExpression", + "start":1,"end":7,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":7}}, + "left": { + "type": "Identifier", + "start":1,"end":2,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":2},"identifierName":"a"}, + "name": "a" + }, + "operator": "&&", + "right": { + "type": "Identifier", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"b"}, + "name": "b" + }, + "extra": { + "parenthesized": true, + "parenStart": 0 + } + }, + "operator": "??", + "right": { + "type": "Identifier", + "start":12,"end":13,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":13},"identifierName":"c"}, + "name": "c" + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/associativity/input.js b/packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/associativity/input.js similarity index 100% rename from packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/associativity/input.js rename to packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/associativity/input.js diff --git a/packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/associativity/output.json b/packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/associativity/output.json new file mode 100644 index 000000000000..a6503f5fad6f --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/associativity/output.json @@ -0,0 +1,42 @@ +{ + "type": "File", + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "program": { + "type": "Program", + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "expression": { + "type": "LogicalExpression", + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "left": { + "type": "LogicalExpression", + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, + "left": { + "type": "Identifier", + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"a"}, + "name": "a" + }, + "operator": "??", + "right": { + "type": "Identifier", + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"b"}, + "name": "b" + } + }, + "operator": "??", + "right": { + "type": "Identifier", + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11},"identifierName":"c"}, + "name": "c" + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/expression/input.js b/packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/expression/input.js similarity index 100% rename from packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/expression/input.js rename to packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/expression/input.js diff --git a/packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/expression/output.json b/packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/expression/output.json new file mode 100644 index 000000000000..653f62c77c35 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/expression/output.json @@ -0,0 +1,36 @@ +{ + "type": "File", + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "program": { + "type": "Program", + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "expression": { + "type": "LogicalExpression", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "left": { + "type": "Identifier", + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3},"identifierName":"foo"}, + "name": "foo" + }, + "operator": "??", + "right": { + "type": "NumericLiteral", + "start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8}}, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/multiline/input.js b/packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/multiline/input.js similarity index 100% rename from packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/multiline/input.js rename to packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/multiline/input.js diff --git a/packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/multiline/output.json b/packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/multiline/output.json new file mode 100644 index 000000000000..b164d4b5b60d --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/multiline/output.json @@ -0,0 +1,42 @@ +{ + "type": "File", + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":7}}, + "program": { + "type": "Program", + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":7}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":7}}, + "expression": { + "type": "LogicalExpression", + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":6}}, + "left": { + "type": "LogicalExpression", + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":6}}, + "left": { + "type": "Identifier", + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"a"}, + "name": "a" + }, + "operator": "??", + "right": { + "type": "Identifier", + "start":8,"end":9,"loc":{"start":{"line":2,"column":5},"end":{"line":2,"column":6},"identifierName":"b"}, + "name": "b" + } + }, + "operator": "??", + "right": { + "type": "Identifier", + "start":15,"end":16,"loc":{"start":{"line":3,"column":5},"end":{"line":3,"column":6},"identifierName":"c"}, + "name": "c" + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/no-paren-and-nullish/input.js b/packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/no-paren-and-nullish/input.js new file mode 100644 index 000000000000..650d93b39a30 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/no-paren-and-nullish/input.js @@ -0,0 +1 @@ +c && d ?? e; diff --git a/packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/no-paren-and-nullish/options.json b/packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/no-paren-and-nullish/options.json new file mode 100644 index 000000000000..8b9f24dff59d --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/no-paren-and-nullish/options.json @@ -0,0 +1,4 @@ +{ + "plugins": ["estree"], + "throws": "Nullish coalescing operator(??) requires parens when mixing with logical operators (1:7)" +} diff --git a/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/nullish-and/input.js b/packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/no-paren-nullish-and/input.js similarity index 100% rename from packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/nullish-and/input.js rename to packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/no-paren-nullish-and/input.js diff --git a/packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/no-paren-nullish-and/options.json b/packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/no-paren-nullish-and/options.json new file mode 100644 index 000000000000..75afb6e1feec --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/no-paren-nullish-and/options.json @@ -0,0 +1,3 @@ +{ + "throws": "Nullish coalescing operator(??) requires parens when mixing with logical operators (1:7)" +} diff --git a/packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/no-paren-nullish-or/input.js b/packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/no-paren-nullish-or/input.js new file mode 100644 index 000000000000..1fd223be11f9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/no-paren-nullish-or/input.js @@ -0,0 +1 @@ +e ?? f ?? g || h; diff --git a/packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/no-paren-nullish-or/options.json b/packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/no-paren-nullish-or/options.json new file mode 100644 index 000000000000..9fed7e79262b --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/no-paren-nullish-or/options.json @@ -0,0 +1,3 @@ +{ + "throws": "Nullish coalescing operator(??) requires parens when mixing with logical operators (1:12)" +} diff --git a/packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/no-paren-or-nullish/input.js b/packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/no-paren-or-nullish/input.js new file mode 100644 index 000000000000..5647ff20498f --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/no-paren-or-nullish/input.js @@ -0,0 +1 @@ +h || i ?? j; diff --git a/packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/no-paren-or-nullish/options.json b/packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/no-paren-or-nullish/options.json new file mode 100644 index 000000000000..8b9f24dff59d --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/no-paren-or-nullish/options.json @@ -0,0 +1,4 @@ +{ + "plugins": ["estree"], + "throws": "Nullish coalescing operator(??) requires parens when mixing with logical operators (1:7)" +} diff --git a/packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/nullish-and/input.js b/packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/nullish-and/input.js new file mode 100644 index 000000000000..886259bfb68d --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/nullish-and/input.js @@ -0,0 +1 @@ +a ?? (b && c); diff --git a/packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/nullish-and/output.json b/packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/nullish-and/output.json new file mode 100644 index 000000000000..217d82a457d9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/nullish-and/output.json @@ -0,0 +1,46 @@ +{ + "type": "File", + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, + "program": { + "type": "Program", + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, + "expression": { + "type": "LogicalExpression", + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "left": { + "type": "Identifier", + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"a"}, + "name": "a" + }, + "operator": "??", + "right": { + "type": "LogicalExpression", + "start":6,"end":12,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":12}}, + "left": { + "type": "Identifier", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"b"}, + "name": "b" + }, + "operator": "&&", + "right": { + "type": "Identifier", + "start":11,"end":12,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":12},"identifierName":"c"}, + "name": "c" + }, + "extra": { + "parenthesized": true, + "parenStart": 5 + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/nullish-or/input.js b/packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/nullish-or/input.js new file mode 100644 index 000000000000..12162ba162d9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/nullish-or/input.js @@ -0,0 +1 @@ +a ?? (b || c); diff --git a/packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/nullish-or/output.json b/packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/nullish-or/output.json new file mode 100644 index 000000000000..50d17cbea2a0 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/nullish-or/output.json @@ -0,0 +1,46 @@ +{ + "type": "File", + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, + "program": { + "type": "Program", + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, + "expression": { + "type": "LogicalExpression", + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "left": { + "type": "Identifier", + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"a"}, + "name": "a" + }, + "operator": "??", + "right": { + "type": "LogicalExpression", + "start":6,"end":12,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":12}}, + "left": { + "type": "Identifier", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"b"}, + "name": "b" + }, + "operator": "||", + "right": { + "type": "Identifier", + "start":11,"end":12,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":12},"identifierName":"c"}, + "name": "c" + }, + "extra": { + "parenthesized": true, + "parenStart": 5 + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/or-nullish/input.js b/packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/or-nullish/input.js new file mode 100644 index 000000000000..a8204525df1a --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/or-nullish/input.js @@ -0,0 +1 @@ +(a || b) ?? c; diff --git a/packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/or-nullish/output.json b/packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/or-nullish/output.json new file mode 100644 index 000000000000..de4361349237 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/or-nullish/output.json @@ -0,0 +1,46 @@ +{ + "type": "File", + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, + "program": { + "type": "Program", + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, + "expression": { + "type": "LogicalExpression", + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "left": { + "type": "LogicalExpression", + "start":1,"end":7,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":7}}, + "left": { + "type": "Identifier", + "start":1,"end":2,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":2},"identifierName":"a"}, + "name": "a" + }, + "operator": "||", + "right": { + "type": "Identifier", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"b"}, + "name": "b" + }, + "extra": { + "parenthesized": true, + "parenStart": 0 + } + }, + "operator": "??", + "right": { + "type": "Identifier", + "start":12,"end":13,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":13},"identifierName":"c"}, + "name": "c" + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/with-pipeline/input.js b/packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/with-pipeline/input.js similarity index 100% rename from packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/with-pipeline/input.js rename to packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/with-pipeline/input.js diff --git a/packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/with-pipeline/options.json b/packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/with-pipeline/options.json new file mode 100644 index 000000000000..f96a57c74821 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/with-pipeline/options.json @@ -0,0 +1,5 @@ +{ + "plugins": [ + ["pipelineOperator", { "proposal": "minimal" }] + ] +} diff --git a/packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/with-pipeline/output.json b/packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/with-pipeline/output.json new file mode 100644 index 000000000000..3753b0798446 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/with-pipeline/output.json @@ -0,0 +1,42 @@ +{ + "type": "File", + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "program": { + "type": "Program", + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "expression": { + "type": "BinaryExpression", + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "left": { + "type": "Identifier", + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"a"}, + "name": "a" + }, + "operator": "|>", + "right": { + "type": "LogicalExpression", + "start":5,"end":11,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":11}}, + "left": { + "type": "Identifier", + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"b"}, + "name": "b" + }, + "operator": "??", + "right": { + "type": "Identifier", + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11},"identifierName":"c"}, + "name": "c" + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2020/optional-chaining/chaining-off-optionally-chained-keys-named-class-or-function/input.js b/packages/babel-parser/test/fixtures/es2020/optional-chaining/chaining-off-optionally-chained-keys-named-class-or-function/input.js new file mode 100644 index 000000000000..5428e236f796 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2020/optional-chaining/chaining-off-optionally-chained-keys-named-class-or-function/input.js @@ -0,0 +1,4 @@ +foo?.class.bar +foo?.function.bar +foo?.bar?.class.bar +foo?.function?.bar diff --git a/packages/babel-parser/test/fixtures/es2020/optional-chaining/chaining-off-optionally-chained-keys-named-class-or-function/output.json b/packages/babel-parser/test/fixtures/es2020/optional-chaining/chaining-off-optionally-chained-keys-named-class-or-function/output.json new file mode 100644 index 000000000000..705c98e5d1fa --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2020/optional-chaining/chaining-off-optionally-chained-keys-named-class-or-function/output.json @@ -0,0 +1,148 @@ +{ + "type": "File", + "start":0,"end":71,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":18}}, + "program": { + "type": "Program", + "start":0,"end":71,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":18}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, + "expression": { + "type": "OptionalMemberExpression", + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, + "object": { + "type": "OptionalMemberExpression", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "object": { + "type": "Identifier", + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3},"identifierName":"foo"}, + "name": "foo" + }, + "property": { + "type": "Identifier", + "start":5,"end":10,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":10},"identifierName":"class"}, + "name": "class" + }, + "computed": false, + "optional": true + }, + "property": { + "type": "Identifier", + "start":11,"end":14,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":14},"identifierName":"bar"}, + "name": "bar" + }, + "computed": false, + "optional": false + } + }, + { + "type": "ExpressionStatement", + "start":15,"end":32,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":17}}, + "expression": { + "type": "OptionalMemberExpression", + "start":15,"end":32,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":17}}, + "object": { + "type": "OptionalMemberExpression", + "start":15,"end":28,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":13}}, + "object": { + "type": "Identifier", + "start":15,"end":18,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":3},"identifierName":"foo"}, + "name": "foo" + }, + "property": { + "type": "Identifier", + "start":20,"end":28,"loc":{"start":{"line":2,"column":5},"end":{"line":2,"column":13},"identifierName":"function"}, + "name": "function" + }, + "computed": false, + "optional": true + }, + "property": { + "type": "Identifier", + "start":29,"end":32,"loc":{"start":{"line":2,"column":14},"end":{"line":2,"column":17},"identifierName":"bar"}, + "name": "bar" + }, + "computed": false, + "optional": false + } + }, + { + "type": "ExpressionStatement", + "start":33,"end":52,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":19}}, + "expression": { + "type": "OptionalMemberExpression", + "start":33,"end":52,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":19}}, + "object": { + "type": "OptionalMemberExpression", + "start":33,"end":48,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":15}}, + "object": { + "type": "OptionalMemberExpression", + "start":33,"end":41,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":8}}, + "object": { + "type": "Identifier", + "start":33,"end":36,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":3},"identifierName":"foo"}, + "name": "foo" + }, + "property": { + "type": "Identifier", + "start":38,"end":41,"loc":{"start":{"line":3,"column":5},"end":{"line":3,"column":8},"identifierName":"bar"}, + "name": "bar" + }, + "computed": false, + "optional": true + }, + "property": { + "type": "Identifier", + "start":43,"end":48,"loc":{"start":{"line":3,"column":10},"end":{"line":3,"column":15},"identifierName":"class"}, + "name": "class" + }, + "computed": false, + "optional": true + }, + "property": { + "type": "Identifier", + "start":49,"end":52,"loc":{"start":{"line":3,"column":16},"end":{"line":3,"column":19},"identifierName":"bar"}, + "name": "bar" + }, + "computed": false, + "optional": false + } + }, + { + "type": "ExpressionStatement", + "start":53,"end":71,"loc":{"start":{"line":4,"column":0},"end":{"line":4,"column":18}}, + "expression": { + "type": "OptionalMemberExpression", + "start":53,"end":71,"loc":{"start":{"line":4,"column":0},"end":{"line":4,"column":18}}, + "object": { + "type": "OptionalMemberExpression", + "start":53,"end":66,"loc":{"start":{"line":4,"column":0},"end":{"line":4,"column":13}}, + "object": { + "type": "Identifier", + "start":53,"end":56,"loc":{"start":{"line":4,"column":0},"end":{"line":4,"column":3},"identifierName":"foo"}, + "name": "foo" + }, + "property": { + "type": "Identifier", + "start":58,"end":66,"loc":{"start":{"line":4,"column":5},"end":{"line":4,"column":13},"identifierName":"function"}, + "name": "function" + }, + "computed": false, + "optional": true + }, + "property": { + "type": "Identifier", + "start":68,"end":71,"loc":{"start":{"line":4,"column":15},"end":{"line":4,"column":18},"identifierName":"bar"}, + "name": "bar" + }, + "computed": false, + "optional": true + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/optional-chaining/class-contructor-call/input.js b/packages/babel-parser/test/fixtures/es2020/optional-chaining/class-contructor-call/input.js similarity index 100% rename from packages/babel-parser/test/fixtures/experimental/optional-chaining/class-contructor-call/input.js rename to packages/babel-parser/test/fixtures/es2020/optional-chaining/class-contructor-call/input.js diff --git a/packages/babel-parser/test/fixtures/es2020/optional-chaining/class-contructor-call/output.json b/packages/babel-parser/test/fixtures/es2020/optional-chaining/class-contructor-call/output.json new file mode 100644 index 000000000000..c5497bf4eb8d --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2020/optional-chaining/class-contructor-call/output.json @@ -0,0 +1,52 @@ +{ + "type": "File", + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "errors": [ + "SyntaxError: constructors in/after an Optional Chain are not allowed (1:10)" + ], + "program": { + "type": "Program", + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "expression": { + "type": "NewExpression", + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "callee": { + "type": "OptionalMemberExpression", + "start":4,"end":10,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":10}}, + "object": { + "type": "OptionalMemberExpression", + "start":4,"end":8,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":8}}, + "object": { + "type": "Identifier", + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"C"}, + "name": "C" + }, + "property": { + "type": "Identifier", + "start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8},"identifierName":"b"}, + "name": "b" + }, + "computed": false, + "optional": true + }, + "property": { + "type": "Identifier", + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"d"}, + "name": "d" + }, + "computed": false, + "optional": false + }, + "arguments": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/optional-chaining/conditional-decimal/input.js b/packages/babel-parser/test/fixtures/es2020/optional-chaining/conditional-decimal/input.js similarity index 100% rename from packages/babel-parser/test/fixtures/experimental/optional-chaining/conditional-decimal/input.js rename to packages/babel-parser/test/fixtures/es2020/optional-chaining/conditional-decimal/input.js diff --git a/packages/babel-parser/test/fixtures/es2020/optional-chaining/conditional-decimal/output.json b/packages/babel-parser/test/fixtures/es2020/optional-chaining/conditional-decimal/output.json new file mode 100644 index 000000000000..3cdd7bc2cb5a --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2020/optional-chaining/conditional-decimal/output.json @@ -0,0 +1,75 @@ +{ + "type": "File", + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":13}}, + "program": { + "type": "Program", + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":13}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "expression": { + "type": "ConditionalExpression", + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "test": { + "type": "BooleanLiteral", + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, + "value": true + }, + "consequent": { + "type": "NumericLiteral", + "start":5,"end":7,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":7}}, + "extra": { + "rawValue": 0.3, + "raw": ".3" + }, + "value": 0.3 + }, + "alternate": { + "type": "NumericLiteral", + "start":8,"end":9,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":9}}, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + } + }, + { + "type": "ExpressionStatement", + "start":11,"end":24,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":13}}, + "expression": { + "type": "ConditionalExpression", + "start":11,"end":24,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":13}}, + "test": { + "type": "BooleanLiteral", + "start":11,"end":15,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":4}}, + "value": true + }, + "consequent": { + "type": "NumericLiteral", + "start":18,"end":20,"loc":{"start":{"line":3,"column":7},"end":{"line":3,"column":9}}, + "extra": { + "rawValue": 0.3, + "raw": ".3" + }, + "value": 0.3 + }, + "alternate": { + "type": "NumericLiteral", + "start":23,"end":24,"loc":{"start":{"line":3,"column":12},"end":{"line":3,"column":13}}, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/optional-chaining/function-call/input.js b/packages/babel-parser/test/fixtures/es2020/optional-chaining/function-call/input.js similarity index 100% rename from packages/babel-parser/test/fixtures/experimental/optional-chaining/function-call/input.js rename to packages/babel-parser/test/fixtures/es2020/optional-chaining/function-call/input.js diff --git a/packages/babel-parser/test/fixtures/es2020/optional-chaining/function-call/output.json b/packages/babel-parser/test/fixtures/es2020/optional-chaining/function-call/output.json new file mode 100644 index 000000000000..81a9ea975a85 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2020/optional-chaining/function-call/output.json @@ -0,0 +1,142 @@ +{ + "type": "File", + "start":0,"end":64,"loc":{"start":{"line":1,"column":0},"end":{"line":9,"column":10}}, + "program": { + "type": "Program", + "start":0,"end":64,"loc":{"start":{"line":1,"column":0},"end":{"line":9,"column":10}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "expression": { + "type": "OptionalCallExpression", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "callee": { + "type": "Identifier", + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4},"identifierName":"func"}, + "name": "func" + }, + "optional": true, + "arguments": [] + } + }, + { + "type": "ExpressionStatement", + "start":10,"end":22,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":12}}, + "expression": { + "type": "OptionalCallExpression", + "start":10,"end":22,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":12}}, + "callee": { + "type": "Identifier", + "start":10,"end":14,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":4},"identifierName":"func"}, + "name": "func" + }, + "optional": true, + "arguments": [ + { + "type": "Identifier", + "start":17,"end":18,"loc":{"start":{"line":3,"column":7},"end":{"line":3,"column":8},"identifierName":"a"}, + "name": "a" + }, + { + "type": "Identifier", + "start":20,"end":21,"loc":{"start":{"line":3,"column":10},"end":{"line":3,"column":11},"identifierName":"b"}, + "name": "b" + } + ] + } + }, + { + "type": "ExpressionStatement", + "start":24,"end":35,"loc":{"start":{"line":5,"column":0},"end":{"line":5,"column":11}}, + "expression": { + "type": "OptionalCallExpression", + "start":24,"end":35,"loc":{"start":{"line":5,"column":0},"end":{"line":5,"column":11}}, + "callee": { + "type": "OptionalMemberExpression", + "start":24,"end":31,"loc":{"start":{"line":5,"column":0},"end":{"line":5,"column":7}}, + "object": { + "type": "Identifier", + "start":24,"end":25,"loc":{"start":{"line":5,"column":0},"end":{"line":5,"column":1},"identifierName":"a"}, + "name": "a" + }, + "property": { + "type": "Identifier", + "start":27,"end":31,"loc":{"start":{"line":5,"column":3},"end":{"line":5,"column":7},"identifierName":"func"}, + "name": "func" + }, + "computed": false, + "optional": true + }, + "optional": true, + "arguments": [] + } + }, + { + "type": "ExpressionStatement", + "start":37,"end":52,"loc":{"start":{"line":7,"column":0},"end":{"line":7,"column":15}}, + "expression": { + "type": "OptionalCallExpression", + "start":37,"end":52,"loc":{"start":{"line":7,"column":0},"end":{"line":7,"column":15}}, + "callee": { + "type": "OptionalMemberExpression", + "start":37,"end":44,"loc":{"start":{"line":7,"column":0},"end":{"line":7,"column":7}}, + "object": { + "type": "Identifier", + "start":37,"end":38,"loc":{"start":{"line":7,"column":0},"end":{"line":7,"column":1},"identifierName":"a"}, + "name": "a" + }, + "property": { + "type": "Identifier", + "start":40,"end":44,"loc":{"start":{"line":7,"column":3},"end":{"line":7,"column":7},"identifierName":"func"}, + "name": "func" + }, + "computed": false, + "optional": true + }, + "optional": true, + "arguments": [ + { + "type": "Identifier", + "start":47,"end":48,"loc":{"start":{"line":7,"column":10},"end":{"line":7,"column":11},"identifierName":"a"}, + "name": "a" + }, + { + "type": "Identifier", + "start":50,"end":51,"loc":{"start":{"line":7,"column":13},"end":{"line":7,"column":14},"identifierName":"b"}, + "name": "b" + } + ] + } + }, + { + "type": "ExpressionStatement", + "start":54,"end":64,"loc":{"start":{"line":9,"column":0},"end":{"line":9,"column":10}}, + "expression": { + "type": "OptionalCallExpression", + "start":54,"end":64,"loc":{"start":{"line":9,"column":0},"end":{"line":9,"column":10}}, + "callee": { + "type": "MemberExpression", + "start":54,"end":60,"loc":{"start":{"line":9,"column":0},"end":{"line":9,"column":6}}, + "object": { + "type": "Identifier", + "start":54,"end":55,"loc":{"start":{"line":9,"column":0},"end":{"line":9,"column":1},"identifierName":"a"}, + "name": "a" + }, + "property": { + "type": "Identifier", + "start":56,"end":60,"loc":{"start":{"line":9,"column":2},"end":{"line":9,"column":6},"identifierName":"func"}, + "name": "func" + }, + "computed": false + }, + "optional": true, + "arguments": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/optional-chaining/member-access-bracket/input.js b/packages/babel-parser/test/fixtures/es2020/optional-chaining/member-access-bracket/input.js similarity index 100% rename from packages/babel-parser/test/fixtures/experimental/optional-chaining/member-access-bracket/input.js rename to packages/babel-parser/test/fixtures/es2020/optional-chaining/member-access-bracket/input.js diff --git a/packages/babel-parser/test/fixtures/es2020/optional-chaining/member-access-bracket/output.json b/packages/babel-parser/test/fixtures/es2020/optional-chaining/member-access-bracket/output.json new file mode 100644 index 000000000000..22f3e7a04fb6 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2020/optional-chaining/member-access-bracket/output.json @@ -0,0 +1,175 @@ +{ + "type": "File", + "start":0,"end":97,"loc":{"start":{"line":1,"column":0},"end":{"line":11,"column":13}}, + "program": { + "type": "Program", + "start":0,"end":97,"loc":{"start":{"line":1,"column":0},"end":{"line":11,"column":13}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "expression": { + "type": "OptionalMemberExpression", + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "object": { + "type": "Identifier", + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3},"identifierName":"obj"}, + "name": "obj" + }, + "property": { + "type": "Identifier", + "start":6,"end":10,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":10},"identifierName":"expr"}, + "name": "expr" + }, + "computed": true, + "optional": true + } + }, + { + "type": "ExpressionStatement", + "start":13,"end":33,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":20}}, + "expression": { + "type": "OptionalMemberExpression", + "start":13,"end":33,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":20}}, + "object": { + "type": "OptionalMemberExpression", + "start":13,"end":24,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":11}}, + "object": { + "type": "Identifier", + "start":13,"end":16,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":3},"identifierName":"obj"}, + "name": "obj" + }, + "property": { + "type": "Identifier", + "start":19,"end":23,"loc":{"start":{"line":3,"column":6},"end":{"line":3,"column":10},"identifierName":"expr"}, + "name": "expr" + }, + "computed": true, + "optional": true + }, + "property": { + "type": "Identifier", + "start":27,"end":32,"loc":{"start":{"line":3,"column":14},"end":{"line":3,"column":19},"identifierName":"other"}, + "name": "other" + }, + "computed": true, + "optional": true + } + }, + { + "type": "ExpressionStatement", + "start":35,"end":46,"loc":{"start":{"line":5,"column":0},"end":{"line":5,"column":11}}, + "expression": { + "type": "OptionalMemberExpression", + "start":35,"end":46,"loc":{"start":{"line":5,"column":0},"end":{"line":5,"column":11}}, + "object": { + "type": "Identifier", + "start":35,"end":38,"loc":{"start":{"line":5,"column":0},"end":{"line":5,"column":3},"identifierName":"obj"}, + "name": "obj" + }, + "property": { + "type": "BooleanLiteral", + "start":41,"end":45,"loc":{"start":{"line":5,"column":6},"end":{"line":5,"column":10}}, + "value": true + }, + "computed": true, + "optional": true + } + }, + { + "type": "ExpressionStatement", + "start":48,"end":67,"loc":{"start":{"line":7,"column":0},"end":{"line":7,"column":19}}, + "expression": { + "type": "OptionalMemberExpression", + "start":48,"end":67,"loc":{"start":{"line":7,"column":0},"end":{"line":7,"column":19}}, + "object": { + "type": "OptionalMemberExpression", + "start":48,"end":59,"loc":{"start":{"line":7,"column":0},"end":{"line":7,"column":11}}, + "object": { + "type": "Identifier", + "start":48,"end":51,"loc":{"start":{"line":7,"column":0},"end":{"line":7,"column":3},"identifierName":"obj"}, + "name": "obj" + }, + "property": { + "type": "BooleanLiteral", + "start":54,"end":58,"loc":{"start":{"line":7,"column":6},"end":{"line":7,"column":10}}, + "value": true + }, + "computed": true, + "optional": true + }, + "property": { + "type": "BooleanLiteral", + "start":62,"end":66,"loc":{"start":{"line":7,"column":14},"end":{"line":7,"column":18}}, + "value": true + }, + "computed": true, + "optional": true + } + }, + { + "type": "ExpressionStatement", + "start":69,"end":82,"loc":{"start":{"line":9,"column":0},"end":{"line":9,"column":13}}, + "expression": { + "type": "OptionalMemberExpression", + "start":69,"end":82,"loc":{"start":{"line":9,"column":0},"end":{"line":9,"column":13}}, + "object": { + "type": "MemberExpression", + "start":69,"end":74,"loc":{"start":{"line":9,"column":0},"end":{"line":9,"column":5}}, + "object": { + "type": "Identifier", + "start":69,"end":72,"loc":{"start":{"line":9,"column":0},"end":{"line":9,"column":3},"identifierName":"obj"}, + "name": "obj" + }, + "property": { + "type": "Identifier", + "start":73,"end":74,"loc":{"start":{"line":9,"column":4},"end":{"line":9,"column":5},"identifierName":"a"}, + "name": "a" + }, + "computed": false + }, + "property": { + "type": "Identifier", + "start":77,"end":81,"loc":{"start":{"line":9,"column":8},"end":{"line":9,"column":12},"identifierName":"expr"}, + "name": "expr" + }, + "computed": true, + "optional": true + } + }, + { + "type": "ExpressionStatement", + "start":84,"end":97,"loc":{"start":{"line":11,"column":0},"end":{"line":11,"column":13}}, + "expression": { + "type": "OptionalMemberExpression", + "start":84,"end":97,"loc":{"start":{"line":11,"column":0},"end":{"line":11,"column":13}}, + "object": { + "type": "MemberExpression", + "start":84,"end":89,"loc":{"start":{"line":11,"column":0},"end":{"line":11,"column":5}}, + "object": { + "type": "Identifier", + "start":84,"end":87,"loc":{"start":{"line":11,"column":0},"end":{"line":11,"column":3},"identifierName":"obj"}, + "name": "obj" + }, + "property": { + "type": "Identifier", + "start":88,"end":89,"loc":{"start":{"line":11,"column":4},"end":{"line":11,"column":5},"identifierName":"a"}, + "name": "a" + }, + "computed": false + }, + "property": { + "type": "BooleanLiteral", + "start":92,"end":96,"loc":{"start":{"line":11,"column":8},"end":{"line":11,"column":12}}, + "value": true + }, + "computed": true, + "optional": true + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/optional-chaining/member-access/input.js b/packages/babel-parser/test/fixtures/es2020/optional-chaining/member-access/input.js similarity index 100% rename from packages/babel-parser/test/fixtures/experimental/optional-chaining/member-access/input.js rename to packages/babel-parser/test/fixtures/es2020/optional-chaining/member-access/input.js diff --git a/packages/babel-parser/test/fixtures/es2020/optional-chaining/member-access/output.json b/packages/babel-parser/test/fixtures/es2020/optional-chaining/member-access/output.json new file mode 100644 index 000000000000..fcb6aa51b077 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2020/optional-chaining/member-access/output.json @@ -0,0 +1,94 @@ +{ + "type": "File", + "start":0,"end":37,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":12}}, + "program": { + "type": "Program", + "start":0,"end":37,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":12}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "expression": { + "type": "OptionalMemberExpression", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "object": { + "type": "Identifier", + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3},"identifierName":"foo"}, + "name": "foo" + }, + "property": { + "type": "Identifier", + "start":5,"end":8,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":8},"identifierName":"bar"}, + "name": "bar" + }, + "computed": false, + "optional": true + } + }, + { + "type": "ExpressionStatement", + "start":10,"end":23,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":13}}, + "expression": { + "type": "OptionalMemberExpression", + "start":10,"end":23,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":13}}, + "object": { + "type": "OptionalMemberExpression", + "start":10,"end":18,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":8}}, + "object": { + "type": "Identifier", + "start":10,"end":13,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":3},"identifierName":"foo"}, + "name": "foo" + }, + "property": { + "type": "Identifier", + "start":15,"end":18,"loc":{"start":{"line":3,"column":5},"end":{"line":3,"column":8},"identifierName":"bar"}, + "name": "bar" + }, + "computed": false, + "optional": true + }, + "property": { + "type": "Identifier", + "start":20,"end":23,"loc":{"start":{"line":3,"column":10},"end":{"line":3,"column":13},"identifierName":"baz"}, + "name": "baz" + }, + "computed": false, + "optional": true + } + }, + { + "type": "ExpressionStatement", + "start":25,"end":37,"loc":{"start":{"line":5,"column":0},"end":{"line":5,"column":12}}, + "expression": { + "type": "OptionalMemberExpression", + "start":25,"end":37,"loc":{"start":{"line":5,"column":0},"end":{"line":5,"column":12}}, + "object": { + "type": "MemberExpression", + "start":25,"end":32,"loc":{"start":{"line":5,"column":0},"end":{"line":5,"column":7}}, + "object": { + "type": "Identifier", + "start":25,"end":28,"loc":{"start":{"line":5,"column":0},"end":{"line":5,"column":3},"identifierName":"foo"}, + "name": "foo" + }, + "property": { + "type": "Identifier", + "start":29,"end":32,"loc":{"start":{"line":5,"column":4},"end":{"line":5,"column":7},"identifierName":"bar"}, + "name": "bar" + }, + "computed": false + }, + "property": { + "type": "Identifier", + "start":34,"end":37,"loc":{"start":{"line":5,"column":9},"end":{"line":5,"column":12},"identifierName":"baz"}, + "name": "baz" + }, + "computed": false, + "optional": true + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/optional-chaining/optioanl-chain-expression/input.js b/packages/babel-parser/test/fixtures/es2020/optional-chaining/optioanl-chain-expression/input.js similarity index 100% rename from packages/babel-parser/test/fixtures/experimental/optional-chaining/optioanl-chain-expression/input.js rename to packages/babel-parser/test/fixtures/es2020/optional-chaining/optioanl-chain-expression/input.js diff --git a/packages/babel-parser/test/fixtures/es2020/optional-chaining/optioanl-chain-expression/output.json b/packages/babel-parser/test/fixtures/es2020/optional-chaining/optioanl-chain-expression/output.json new file mode 100644 index 000000000000..64874e4b02fe --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2020/optional-chaining/optioanl-chain-expression/output.json @@ -0,0 +1,48 @@ +{ + "type": "File", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "program": { + "type": "Program", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "expression": { + "type": "OptionalCallExpression", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "callee": { + "type": "OptionalMemberExpression", + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, + "object": { + "type": "MemberExpression", + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, + "object": { + "type": "Identifier", + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"a"}, + "name": "a" + }, + "property": { + "type": "Identifier", + "start":2,"end":3,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":3},"identifierName":"b"}, + "name": "b" + }, + "computed": false + }, + "property": { + "type": "Identifier", + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"c"}, + "name": "c" + }, + "computed": false, + "optional": true + }, + "arguments": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/optional-chaining/optional-constructor/input.js b/packages/babel-parser/test/fixtures/es2020/optional-chaining/optional-constructor/input.js similarity index 100% rename from packages/babel-parser/test/fixtures/experimental/optional-chaining/optional-constructor/input.js rename to packages/babel-parser/test/fixtures/es2020/optional-chaining/optional-constructor/input.js diff --git a/packages/babel-parser/test/fixtures/es2020/optional-chaining/optional-constructor/output.json b/packages/babel-parser/test/fixtures/es2020/optional-chaining/optional-constructor/output.json new file mode 100644 index 000000000000..5039bd06d927 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2020/optional-chaining/optional-constructor/output.json @@ -0,0 +1,30 @@ +{ + "type": "File", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "errors": [ + "SyntaxError: constructors in/after an Optional Chain are not allowed (1:7)" + ], + "program": { + "type": "Program", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "expression": { + "type": "NewExpression", + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "callee": { + "type": "Identifier", + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"a"}, + "name": "a" + }, + "arguments": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/optional-chaining/optional-super-property-class/input.js b/packages/babel-parser/test/fixtures/es2020/optional-chaining/optional-super-property-class/input.js similarity index 100% rename from packages/babel-parser/test/fixtures/experimental/optional-chaining/optional-super-property-class/input.js rename to packages/babel-parser/test/fixtures/es2020/optional-chaining/optional-super-property-class/input.js diff --git a/packages/babel-parser/test/fixtures/es2020/optional-chaining/optional-super-property-class/output.json b/packages/babel-parser/test/fixtures/es2020/optional-chaining/optional-super-property-class/output.json new file mode 100644 index 000000000000..dc31af9de392 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2020/optional-chaining/optional-super-property-class/output.json @@ -0,0 +1,74 @@ +{ + "type": "File", + "start":0,"end":50,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, + "errors": [ + "SyntaxError: super can only be used with function calls (i.e. super()) or in property accesses (i.e. super.prop or super[prop]) (3:15)" + ], + "program": { + "type": "Program", + "start":0,"end":50,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start":0,"end":50,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, + "id": { + "type": "Identifier", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":7,"end":50,"loc":{"start":{"line":1,"column":7},"end":{"line":5,"column":1}}, + "body": [ + { + "type": "ClassMethod", + "start":13,"end":48,"loc":{"start":{"line":2,"column":4},"end":{"line":4,"column":5}}, + "static": false, + "key": { + "type": "Identifier", + "start":13,"end":14,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":5},"identifierName":"b"}, + "name": "b" + }, + "computed": false, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":16,"end":48,"loc":{"start":{"line":2,"column":7},"end":{"line":4,"column":5}}, + "body": [ + { + "type": "ReturnStatement", + "start":26,"end":42,"loc":{"start":{"line":3,"column":8},"end":{"line":3,"column":24}}, + "argument": { + "type": "OptionalMemberExpression", + "start":33,"end":41,"loc":{"start":{"line":3,"column":15},"end":{"line":3,"column":23}}, + "object": { + "type": "Super", + "start":33,"end":38,"loc":{"start":{"line":3,"column":15},"end":{"line":3,"column":20}} + }, + "property": { + "type": "Identifier", + "start":40,"end":41,"loc":{"start":{"line":3,"column":22},"end":{"line":3,"column":23},"identifierName":"b"}, + "name": "b" + }, + "computed": false, + "optional": true + } + } + ], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/optional-chaining/optional-super-property/input.js b/packages/babel-parser/test/fixtures/es2020/optional-chaining/optional-super-property/input.js similarity index 100% rename from packages/babel-parser/test/fixtures/experimental/optional-chaining/optional-super-property/input.js rename to packages/babel-parser/test/fixtures/es2020/optional-chaining/optional-super-property/input.js diff --git a/packages/babel-parser/test/fixtures/es2020/optional-chaining/optional-super-property/output.json b/packages/babel-parser/test/fixtures/es2020/optional-chaining/optional-super-property/output.json new file mode 100644 index 000000000000..393e2fd7451f --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2020/optional-chaining/optional-super-property/output.json @@ -0,0 +1,80 @@ +{ + "type": "File", + "start":0,"end":53,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, + "errors": [ + "SyntaxError: super can only be used with function calls (i.e. super()) or in property accesses (i.e. super.prop or super[prop]) (3:15)" + ], + "program": { + "type": "Program", + "start":0,"end":53,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start":0,"end":53,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":6,"end":53,"loc":{"start":{"line":1,"column":6},"end":{"line":5,"column":1}}, + "id": { + "type": "Identifier", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"a"}, + "name": "a" + }, + "init": { + "type": "ObjectExpression", + "start":10,"end":53,"loc":{"start":{"line":1,"column":10},"end":{"line":5,"column":1}}, + "properties": [ + { + "type": "ObjectMethod", + "start":16,"end":51,"loc":{"start":{"line":2,"column":4},"end":{"line":4,"column":5}}, + "method": true, + "key": { + "type": "Identifier", + "start":16,"end":17,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":5},"identifierName":"b"}, + "name": "b" + }, + "computed": false, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":19,"end":51,"loc":{"start":{"line":2,"column":7},"end":{"line":4,"column":5}}, + "body": [ + { + "type": "ReturnStatement", + "start":29,"end":45,"loc":{"start":{"line":3,"column":8},"end":{"line":3,"column":24}}, + "argument": { + "type": "OptionalMemberExpression", + "start":36,"end":44,"loc":{"start":{"line":3,"column":15},"end":{"line":3,"column":23}}, + "object": { + "type": "Super", + "start":36,"end":41,"loc":{"start":{"line":3,"column":15},"end":{"line":3,"column":20}} + }, + "property": { + "type": "Identifier", + "start":43,"end":44,"loc":{"start":{"line":3,"column":22},"end":{"line":3,"column":23},"identifierName":"c"}, + "name": "c" + }, + "computed": false, + "optional": true + } + } + ], + "directives": [] + } + } + ] + } + } + ], + "kind": "const" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/optional-chaining/optional-tagged-template-literals/input.js b/packages/babel-parser/test/fixtures/es2020/optional-chaining/optional-tagged-template-literals/input.js similarity index 100% rename from packages/babel-parser/test/fixtures/experimental/optional-chaining/optional-tagged-template-literals/input.js rename to packages/babel-parser/test/fixtures/es2020/optional-chaining/optional-tagged-template-literals/input.js diff --git a/packages/babel-parser/test/fixtures/es2020/optional-chaining/optional-tagged-template-literals/output.json b/packages/babel-parser/test/fixtures/es2020/optional-chaining/optional-tagged-template-literals/output.json new file mode 100644 index 000000000000..344f3d26b695 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2020/optional-chaining/optional-tagged-template-literals/output.json @@ -0,0 +1,56 @@ +{ + "type": "File", + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "errors": [ + "SyntaxError: Tagged Template Literals are not allowed in optionalChain (1:0)" + ], + "program": { + "type": "Program", + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "expression": { + "type": "TaggedTemplateExpression", + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "tag": { + "type": "OptionalMemberExpression", + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, + "object": { + "type": "Identifier", + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"a"}, + "name": "a" + }, + "property": { + "type": "Identifier", + "start":3,"end":4,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":4},"identifierName":"b"}, + "name": "b" + }, + "computed": false, + "optional": true + }, + "quasi": { + "type": "TemplateLiteral", + "start":4,"end":9,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":9}}, + "expressions": [], + "quasis": [ + { + "type": "TemplateElement", + "start":5,"end":8,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":8}}, + "value": { + "raw": "foo", + "cooked": "foo" + }, + "tail": true + } + ] + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/optional-chaining/parenthised-chain/input.js b/packages/babel-parser/test/fixtures/es2020/optional-chaining/parenthised-chain/input.js similarity index 100% rename from packages/babel-parser/test/fixtures/experimental/optional-chaining/parenthised-chain/input.js rename to packages/babel-parser/test/fixtures/es2020/optional-chaining/parenthised-chain/input.js diff --git a/packages/babel-parser/test/fixtures/es2020/optional-chaining/parenthised-chain/output.json b/packages/babel-parser/test/fixtures/es2020/optional-chaining/parenthised-chain/output.json new file mode 100644 index 000000000000..fc353364c2d1 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2020/optional-chaining/parenthised-chain/output.json @@ -0,0 +1,143 @@ +{ + "type": "File", + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":15}}, + "program": { + "type": "Program", + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":15}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "expression": { + "type": "MemberExpression", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "object": { + "type": "OptionalMemberExpression", + "start":1,"end":5,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":5}}, + "object": { + "type": "Identifier", + "start":1,"end":2,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":2},"identifierName":"a"}, + "name": "a" + }, + "property": { + "type": "Identifier", + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"b"}, + "name": "b" + }, + "computed": false, + "optional": true, + "extra": { + "parenthesized": true, + "parenStart": 0 + } + }, + "property": { + "type": "Identifier", + "start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8},"identifierName":"c"}, + "name": "c" + }, + "computed": false + } + }, + { + "type": "ExpressionStatement", + "start":11,"end":22,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":11}}, + "expression": { + "type": "CallExpression", + "start":11,"end":21,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":10}}, + "callee": { + "type": "MemberExpression", + "start":11,"end":19,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":8}}, + "object": { + "type": "OptionalMemberExpression", + "start":12,"end":16,"loc":{"start":{"line":3,"column":1},"end":{"line":3,"column":5}}, + "object": { + "type": "Identifier", + "start":12,"end":13,"loc":{"start":{"line":3,"column":1},"end":{"line":3,"column":2},"identifierName":"a"}, + "name": "a" + }, + "property": { + "type": "Identifier", + "start":15,"end":16,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":5},"identifierName":"b"}, + "name": "b" + }, + "computed": false, + "optional": true, + "extra": { + "parenthesized": true, + "parenStart": 11 + } + }, + "property": { + "type": "Identifier", + "start":18,"end":19,"loc":{"start":{"line":3,"column":7},"end":{"line":3,"column":8},"identifierName":"c"}, + "name": "c" + }, + "computed": false + }, + "arguments": [] + } + }, + { + "type": "ExpressionStatement", + "start":24,"end":39,"loc":{"start":{"line":5,"column":0},"end":{"line":5,"column":15}}, + "expression": { + "type": "OptionalMemberExpression", + "start":24,"end":38,"loc":{"start":{"line":5,"column":0},"end":{"line":5,"column":14}}, + "object": { + "type": "OptionalMemberExpression", + "start":24,"end":35,"loc":{"start":{"line":5,"column":0},"end":{"line":5,"column":11}}, + "object": { + "type": "OptionalMemberExpression", + "start":24,"end":33,"loc":{"start":{"line":5,"column":0},"end":{"line":5,"column":9}}, + "object": { + "type": "OptionalMemberExpression", + "start":25,"end":29,"loc":{"start":{"line":5,"column":1},"end":{"line":5,"column":5}}, + "object": { + "type": "Identifier", + "start":25,"end":26,"loc":{"start":{"line":5,"column":1},"end":{"line":5,"column":2},"identifierName":"a"}, + "name": "a" + }, + "property": { + "type": "Identifier", + "start":28,"end":29,"loc":{"start":{"line":5,"column":4},"end":{"line":5,"column":5},"identifierName":"b"}, + "name": "b" + }, + "computed": false, + "optional": true, + "extra": { + "parenthesized": true, + "parenStart": 24 + } + }, + "property": { + "type": "Identifier", + "start":32,"end":33,"loc":{"start":{"line":5,"column":8},"end":{"line":5,"column":9},"identifierName":"c"}, + "name": "c" + }, + "computed": false, + "optional": true + }, + "property": { + "type": "Identifier", + "start":34,"end":35,"loc":{"start":{"line":5,"column":10},"end":{"line":5,"column":11},"identifierName":"d"}, + "name": "d" + }, + "computed": false, + "optional": false + }, + "property": { + "type": "Identifier", + "start":37,"end":38,"loc":{"start":{"line":5,"column":13},"end":{"line":5,"column":14},"identifierName":"e"}, + "name": "e" + }, + "computed": false, + "optional": true + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/optional-chaining/separated-chaining/input.js b/packages/babel-parser/test/fixtures/es2020/optional-chaining/separated-chaining/input.js similarity index 100% rename from packages/babel-parser/test/fixtures/experimental/optional-chaining/separated-chaining/input.js rename to packages/babel-parser/test/fixtures/es2020/optional-chaining/separated-chaining/input.js diff --git a/packages/babel-parser/test/fixtures/es2020/optional-chaining/separated-chaining/output.json b/packages/babel-parser/test/fixtures/es2020/optional-chaining/separated-chaining/output.json new file mode 100644 index 000000000000..83b934aec188 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2020/optional-chaining/separated-chaining/output.json @@ -0,0 +1,139 @@ +{ + "type": "File", + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":12}}, + "program": { + "type": "Program", + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":12}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "expression": { + "type": "OptionalMemberExpression", + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "object": { + "type": "OptionalMemberExpression", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "object": { + "type": "OptionalMemberExpression", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "object": { + "type": "OptionalMemberExpression", + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, + "object": { + "type": "OptionalMemberExpression", + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, + "object": { + "type": "Identifier", + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"a"}, + "name": "a" + }, + "property": { + "type": "Identifier", + "start":3,"end":4,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":4},"identifierName":"b"}, + "name": "b" + }, + "computed": false, + "optional": true + }, + "property": { + "type": "Identifier", + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"c"}, + "name": "c" + }, + "computed": false, + "optional": false + }, + "property": { + "type": "Identifier", + "start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8},"identifierName":"d"}, + "name": "d" + }, + "computed": false, + "optional": false + }, + "property": { + "type": "Identifier", + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"e"}, + "name": "e" + }, + "computed": false, + "optional": false + }, + "property": { + "type": "Identifier", + "start":12,"end":13,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":13},"identifierName":"f"}, + "name": "f" + }, + "computed": false, + "optional": true + } + }, + { + "type": "ExpressionStatement", + "start":15,"end":27,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":12}}, + "expression": { + "type": "OptionalMemberExpression", + "start":15,"end":27,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":12}}, + "object": { + "type": "OptionalMemberExpression", + "start":15,"end":25,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":10}}, + "object": { + "type": "OptionalMemberExpression", + "start":15,"end":23,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":8}}, + "object": { + "type": "MemberExpression", + "start":15,"end":20,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":5}}, + "object": { + "type": "MemberExpression", + "start":15,"end":18,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":3}}, + "object": { + "type": "Identifier", + "start":15,"end":16,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":1},"identifierName":"a"}, + "name": "a" + }, + "property": { + "type": "Identifier", + "start":17,"end":18,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":3},"identifierName":"b"}, + "name": "b" + }, + "computed": false + }, + "property": { + "type": "Identifier", + "start":19,"end":20,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":5},"identifierName":"c"}, + "name": "c" + }, + "computed": false + }, + "property": { + "type": "Identifier", + "start":22,"end":23,"loc":{"start":{"line":3,"column":7},"end":{"line":3,"column":8},"identifierName":"d"}, + "name": "d" + }, + "computed": false, + "optional": true + }, + "property": { + "type": "Identifier", + "start":24,"end":25,"loc":{"start":{"line":3,"column":9},"end":{"line":3,"column":10},"identifierName":"e"}, + "name": "e" + }, + "computed": false, + "optional": false + }, + "property": { + "type": "Identifier", + "start":26,"end":27,"loc":{"start":{"line":3,"column":11},"end":{"line":3,"column":12},"identifierName":"f"}, + "name": "f" + }, + "computed": false, + "optional": false + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/optional-chaining/super-method-class/input.js b/packages/babel-parser/test/fixtures/es2020/optional-chaining/super-method-class/input.js similarity index 100% rename from packages/babel-parser/test/fixtures/experimental/optional-chaining/super-method-class/input.js rename to packages/babel-parser/test/fixtures/es2020/optional-chaining/super-method-class/input.js diff --git a/packages/babel-parser/test/fixtures/es2020/optional-chaining/super-method-class/output.json b/packages/babel-parser/test/fixtures/es2020/optional-chaining/super-method-class/output.json new file mode 100644 index 000000000000..b0b4f5871fa7 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2020/optional-chaining/super-method-class/output.json @@ -0,0 +1,80 @@ +{ + "type": "File", + "start":0,"end":66,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, + "program": { + "type": "Program", + "start":0,"end":66,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start":0,"end":66,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, + "id": { + "type": "Identifier", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, + "name": "A" + }, + "superClass": { + "type": "Identifier", + "start":16,"end":17,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":17},"identifierName":"B"}, + "name": "B" + }, + "body": { + "type": "ClassBody", + "start":18,"end":66,"loc":{"start":{"line":1,"column":18},"end":{"line":5,"column":1}}, + "body": [ + { + "type": "ClassMethod", + "start":24,"end":64,"loc":{"start":{"line":2,"column":4},"end":{"line":4,"column":5}}, + "static": false, + "key": { + "type": "Identifier", + "start":24,"end":35,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":15},"identifierName":"constructor"}, + "name": "constructor" + }, + "computed": false, + "kind": "constructor", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":37,"end":64,"loc":{"start":{"line":2,"column":17},"end":{"line":4,"column":5}}, + "body": [ + { + "type": "ExpressionStatement", + "start":47,"end":58,"loc":{"start":{"line":3,"column":8},"end":{"line":3,"column":19}}, + "expression": { + "type": "OptionalMemberExpression", + "start":47,"end":57,"loc":{"start":{"line":3,"column":8},"end":{"line":3,"column":18}}, + "object": { + "type": "CallExpression", + "start":47,"end":54,"loc":{"start":{"line":3,"column":8},"end":{"line":3,"column":15}}, + "callee": { + "type": "Super", + "start":47,"end":52,"loc":{"start":{"line":3,"column":8},"end":{"line":3,"column":13}} + }, + "arguments": [] + }, + "property": { + "type": "Identifier", + "start":56,"end":57,"loc":{"start":{"line":3,"column":17},"end":{"line":3,"column":18},"identifierName":"b"}, + "name": "b" + }, + "computed": false, + "optional": true + } + } + ], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/automatic-semicolon-insertion/migrated_0000/output.json b/packages/babel-parser/test/fixtures/esprima/automatic-semicolon-insertion/migrated_0000/output.json index 110a8a000bfa..2b437f12048b 100644 --- a/packages/babel-parser/test/fixtures/esprima/automatic-semicolon-insertion/migrated_0000/output.json +++ b/packages/babel-parser/test/fixtures/esprima/automatic-semicolon-insertion/migrated_0000/output.json @@ -1,126 +1,36 @@ { "type": "File", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 5 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":5}}, "program": { "type": "Program", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 5 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":5}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "BlockStatement", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 5 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":5}}, "body": [ { "type": "ExpressionStatement", - "start": 2, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 3 - } - }, + "start":2,"end":3,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":3}}, "expression": { "type": "Identifier", - "start": 2, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 3 - }, - "identifierName": "x" - }, + "start":2,"end":3,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":3},"identifierName":"x"}, "name": "x" } }, { "type": "ExpressionStatement", - "start": 4, - "end": 7, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 3 - } - }, + "start":4,"end":7,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":3}}, "expression": { "type": "UpdateExpression", - "start": 4, - "end": 7, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 3 - } - }, + "start":4,"end":7,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":3}}, "operator": "++", "prefix": true, "argument": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 3 - }, - "identifierName": "y" - }, + "start":6,"end":7,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":3},"identifierName":"y"}, "name": "y" } } diff --git a/packages/babel-parser/test/fixtures/esprima/automatic-semicolon-insertion/migrated_0001/output.json b/packages/babel-parser/test/fixtures/esprima/automatic-semicolon-insertion/migrated_0001/output.json index 867fc3fc002c..c289ddae854b 100644 --- a/packages/babel-parser/test/fixtures/esprima/automatic-semicolon-insertion/migrated_0001/output.json +++ b/packages/babel-parser/test/fixtures/esprima/automatic-semicolon-insertion/migrated_0001/output.json @@ -1,126 +1,36 @@ { "type": "File", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 5 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":5}}, "program": { "type": "Program", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 5 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":5}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "BlockStatement", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 5 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":5}}, "body": [ { "type": "ExpressionStatement", - "start": 2, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 3 - } - }, + "start":2,"end":3,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":3}}, "expression": { "type": "Identifier", - "start": 2, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 3 - }, - "identifierName": "x" - }, + "start":2,"end":3,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":3},"identifierName":"x"}, "name": "x" } }, { "type": "ExpressionStatement", - "start": 4, - "end": 7, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 3 - } - }, + "start":4,"end":7,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":3}}, "expression": { "type": "UpdateExpression", - "start": 4, - "end": 7, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 3 - } - }, + "start":4,"end":7,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":3}}, "operator": "--", "prefix": true, "argument": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 3 - }, - "identifierName": "y" - }, + "start":6,"end":7,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":3},"identifierName":"y"}, "name": "y" } } diff --git a/packages/babel-parser/test/fixtures/esprima/automatic-semicolon-insertion/migrated_0002/output.json b/packages/babel-parser/test/fixtures/esprima/automatic-semicolon-insertion/migrated_0002/output.json index 412ba4db54fc..6ee561c3d41d 100644 --- a/packages/babel-parser/test/fixtures/esprima/automatic-semicolon-insertion/migrated_0002/output.json +++ b/packages/babel-parser/test/fixtures/esprima/automatic-semicolon-insertion/migrated_0002/output.json @@ -1,78 +1,22 @@ { "type": "File", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, "program": { "type": "Program", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5}}, "id": { "type": "Identifier", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "x" - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"x"}, "name": "x" }, "init": null, @@ -80,18 +24,7 @@ { "type": "CommentBlock", "value": " comment ", - "start": 6, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 19 - } - } + "start":6,"end":19,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":19}} } ] } @@ -105,18 +38,7 @@ { "type": "CommentBlock", "value": " comment ", - "start": 6, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 19 - } - } + "start":6,"end":19,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":19}} } ] } \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/automatic-semicolon-insertion/migrated_0003/output.json b/packages/babel-parser/test/fixtures/esprima/automatic-semicolon-insertion/migrated_0003/output.json index d4e339d66f8b..fb37cb7dd911 100644 --- a/packages/babel-parser/test/fixtures/esprima/automatic-semicolon-insertion/migrated_0003/output.json +++ b/packages/babel-parser/test/fixtures/esprima/automatic-semicolon-insertion/migrated_0003/output.json @@ -1,109 +1,31 @@ { "type": "File", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 4 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":4}}, "program": { "type": "Program", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 4 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":4}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "BlockStatement", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 4 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":4}}, "body": [ { "type": "VariableDeclaration", - "start": 2, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":2,"end":19,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":19}}, "declarations": [ { "type": "VariableDeclarator", - "start": 6, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":6,"end":12,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":12}}, "id": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "x" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"x"}, "name": "x" }, "init": { "type": "NumericLiteral", - "start": 10, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":10,"end":12,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":12}}, "extra": { "rawValue": 14, "raw": "14" @@ -113,49 +35,15 @@ }, { "type": "VariableDeclarator", - "start": 14, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":14,"end":19,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":19}}, "id": { "type": "Identifier", - "start": 14, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - }, - "identifierName": "y" - }, + "start":14,"end":15,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":15},"identifierName":"y"}, "name": "y" }, "init": { "type": "NumericLiteral", - "start": 18, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":18,"end":19,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":19}}, "extra": { "rawValue": 3, "raw": "3" @@ -168,33 +56,10 @@ }, { "type": "ExpressionStatement", - "start": 20, - "end": 22, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 2 - } - }, + "start":20,"end":22,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":2}}, "expression": { "type": "Identifier", - "start": 20, - "end": 21, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 1 - }, - "identifierName": "z" - }, + "start":20,"end":21,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":1},"identifierName":"z"}, "name": "z" } } diff --git a/packages/babel-parser/test/fixtures/esprima/automatic-semicolon-insertion/migrated_0004/output.json b/packages/babel-parser/test/fixtures/esprima/automatic-semicolon-insertion/migrated_0004/output.json index ccd2a5557c69..50691134a049 100644 --- a/packages/babel-parser/test/fixtures/esprima/automatic-semicolon-insertion/migrated_0004/output.json +++ b/packages/babel-parser/test/fixtures/esprima/automatic-semicolon-insertion/migrated_0004/output.json @@ -1,124 +1,35 @@ { "type": "File", - "start": 0, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 8 - } - }, + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":8}}, "program": { "type": "Program", - "start": 0, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 8 - } - }, + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":8}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "WhileStatement", - "start": 0, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 8 - } - }, + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":8}}, "test": { "type": "BooleanLiteral", - "start": 7, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":7,"end":11,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":11}}, "value": true }, "body": { "type": "BlockStatement", - "start": 13, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 2, - "column": 8 - } - }, + "start":13,"end":32,"loc":{"start":{"line":1,"column":13},"end":{"line":2,"column":8}}, "body": [ { "type": "ContinueStatement", - "start": 15, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":15,"end":23,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":23}}, "label": null }, { "type": "ExpressionStatement", - "start": 24, - "end": 30, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 6 - } - }, + "start":24,"end":30,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":6}}, "expression": { "type": "Identifier", - "start": 24, - "end": 29, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 5 - }, - "identifierName": "there" - }, + "start":24,"end":29,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":5},"identifierName":"there"}, "name": "there" } } diff --git a/packages/babel-parser/test/fixtures/esprima/automatic-semicolon-insertion/migrated_0005/output.json b/packages/babel-parser/test/fixtures/esprima/automatic-semicolon-insertion/migrated_0005/output.json index 3fcb48aa328a..79fce2dd496e 100644 --- a/packages/babel-parser/test/fixtures/esprima/automatic-semicolon-insertion/migrated_0005/output.json +++ b/packages/babel-parser/test/fixtures/esprima/automatic-semicolon-insertion/migrated_0005/output.json @@ -1,160 +1,49 @@ { "type": "File", - "start": 0, - "end": 43, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 8 - } - }, + "start":0,"end":43,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":8}}, "program": { "type": "Program", - "start": 0, - "end": 43, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 8 - } - }, + "start":0,"end":43,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":8}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "WhileStatement", - "start": 0, - "end": 43, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 8 - } - }, + "start":0,"end":43,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":8}}, "test": { "type": "BooleanLiteral", - "start": 7, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":7,"end":11,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":11}}, "value": true }, "body": { "type": "BlockStatement", - "start": 13, - "end": 43, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 2, - "column": 8 - } - }, + "start":13,"end":43,"loc":{"start":{"line":1,"column":13},"end":{"line":2,"column":8}}, "body": [ { "type": "ContinueStatement", - "start": 15, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":15,"end":23,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":23}}, "label": null, "trailingComments": [ { "type": "CommentLine", "value": " Comment", - "start": 24, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 34 - } - } + "start":24,"end":34,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":34}} } ] }, { "type": "ExpressionStatement", - "start": 35, - "end": 41, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 6 - } - }, + "start":35,"end":41,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":6}}, "expression": { "type": "Identifier", - "start": 35, - "end": 40, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 5 - }, - "identifierName": "there" - }, + "start":35,"end":40,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":5},"identifierName":"there"}, "name": "there" }, "leadingComments": [ { "type": "CommentLine", "value": " Comment", - "start": 24, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 34 - } - } + "start":24,"end":34,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":34}} } ] } @@ -169,18 +58,7 @@ { "type": "CommentLine", "value": " Comment", - "start": 24, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 34 - } - } + "start":24,"end":34,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":34}} } ] } \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/automatic-semicolon-insertion/migrated_0006/output.json b/packages/babel-parser/test/fixtures/esprima/automatic-semicolon-insertion/migrated_0006/output.json index 395230285f43..a496fcfd3a10 100644 --- a/packages/babel-parser/test/fixtures/esprima/automatic-semicolon-insertion/migrated_0006/output.json +++ b/packages/babel-parser/test/fixtures/esprima/automatic-semicolon-insertion/migrated_0006/output.json @@ -1,160 +1,49 @@ { "type": "File", - "start": 0, - "end": 55, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 18 - } - }, + "start":0,"end":55,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":18}}, "program": { "type": "Program", - "start": 0, - "end": 55, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 18 - } - }, + "start":0,"end":55,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":18}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "WhileStatement", - "start": 0, - "end": 55, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 18 - } - }, + "start":0,"end":55,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":18}}, "test": { "type": "BooleanLiteral", - "start": 7, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":7,"end":11,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":11}}, "value": true }, "body": { "type": "BlockStatement", - "start": 13, - "end": 55, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 2, - "column": 18 - } - }, + "start":13,"end":55,"loc":{"start":{"line":1,"column":13},"end":{"line":2,"column":18}}, "body": [ { "type": "ContinueStatement", - "start": 15, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":15,"end":23,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":23}}, "label": null, "trailingComments": [ { "type": "CommentBlock", "value": " Multiline\nComment ", - "start": 24, - "end": 47, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 2, - "column": 10 - } - } + "start":24,"end":47,"loc":{"start":{"line":1,"column":24},"end":{"line":2,"column":10}} } ] }, { "type": "ExpressionStatement", - "start": 47, - "end": 53, - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 16 - } - }, + "start":47,"end":53,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":16}}, "expression": { "type": "Identifier", - "start": 47, - "end": 52, - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 15 - }, - "identifierName": "there" - }, + "start":47,"end":52,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":15},"identifierName":"there"}, "name": "there" }, "leadingComments": [ { "type": "CommentBlock", "value": " Multiline\nComment ", - "start": 24, - "end": 47, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 2, - "column": 10 - } - } + "start":24,"end":47,"loc":{"start":{"line":1,"column":24},"end":{"line":2,"column":10}} } ] } @@ -169,18 +58,7 @@ { "type": "CommentBlock", "value": " Multiline\nComment ", - "start": 24, - "end": 47, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 2, - "column": 10 - } - } + "start":24,"end":47,"loc":{"start":{"line":1,"column":24},"end":{"line":2,"column":10}} } ] } \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/automatic-semicolon-insertion/migrated_0007/output.json b/packages/babel-parser/test/fixtures/esprima/automatic-semicolon-insertion/migrated_0007/output.json index 40442d2489fb..8e6358875358 100644 --- a/packages/babel-parser/test/fixtures/esprima/automatic-semicolon-insertion/migrated_0007/output.json +++ b/packages/babel-parser/test/fixtures/esprima/automatic-semicolon-insertion/migrated_0007/output.json @@ -1,124 +1,35 @@ { "type": "File", - "start": 0, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 8 - } - }, + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":8}}, "program": { "type": "Program", - "start": 0, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 8 - } - }, + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":8}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "WhileStatement", - "start": 0, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 8 - } - }, + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":8}}, "test": { "type": "BooleanLiteral", - "start": 7, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":7,"end":11,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":11}}, "value": true }, "body": { "type": "BlockStatement", - "start": 13, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 2, - "column": 8 - } - }, + "start":13,"end":29,"loc":{"start":{"line":1,"column":13},"end":{"line":2,"column":8}}, "body": [ { "type": "BreakStatement", - "start": 15, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":15,"end":20,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":20}}, "label": null }, { "type": "ExpressionStatement", - "start": 21, - "end": 27, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 6 - } - }, + "start":21,"end":27,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":6}}, "expression": { "type": "Identifier", - "start": 21, - "end": 26, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 5 - }, - "identifierName": "there" - }, + "start":21,"end":26,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":5},"identifierName":"there"}, "name": "there" } } diff --git a/packages/babel-parser/test/fixtures/esprima/automatic-semicolon-insertion/migrated_0008/output.json b/packages/babel-parser/test/fixtures/esprima/automatic-semicolon-insertion/migrated_0008/output.json index 074c0c8bb638..db5aabc02b2b 100644 --- a/packages/babel-parser/test/fixtures/esprima/automatic-semicolon-insertion/migrated_0008/output.json +++ b/packages/babel-parser/test/fixtures/esprima/automatic-semicolon-insertion/migrated_0008/output.json @@ -1,160 +1,49 @@ { "type": "File", - "start": 0, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 8 - } - }, + "start":0,"end":40,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":8}}, "program": { "type": "Program", - "start": 0, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 8 - } - }, + "start":0,"end":40,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":8}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "WhileStatement", - "start": 0, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 8 - } - }, + "start":0,"end":40,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":8}}, "test": { "type": "BooleanLiteral", - "start": 7, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":7,"end":11,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":11}}, "value": true }, "body": { "type": "BlockStatement", - "start": 13, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 2, - "column": 8 - } - }, + "start":13,"end":40,"loc":{"start":{"line":1,"column":13},"end":{"line":2,"column":8}}, "body": [ { "type": "BreakStatement", - "start": 15, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":15,"end":20,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":20}}, "label": null, "trailingComments": [ { "type": "CommentLine", "value": " Comment", - "start": 21, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 31 - } - } + "start":21,"end":31,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":31}} } ] }, { "type": "ExpressionStatement", - "start": 32, - "end": 38, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 6 - } - }, + "start":32,"end":38,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":6}}, "expression": { "type": "Identifier", - "start": 32, - "end": 37, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 5 - }, - "identifierName": "there" - }, + "start":32,"end":37,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":5},"identifierName":"there"}, "name": "there" }, "leadingComments": [ { "type": "CommentLine", "value": " Comment", - "start": 21, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 31 - } - } + "start":21,"end":31,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":31}} } ] } @@ -169,18 +58,7 @@ { "type": "CommentLine", "value": " Comment", - "start": 21, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 31 - } - } + "start":21,"end":31,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":31}} } ] } \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/automatic-semicolon-insertion/migrated_0009/output.json b/packages/babel-parser/test/fixtures/esprima/automatic-semicolon-insertion/migrated_0009/output.json index f58cfb077883..07e673f84ee2 100644 --- a/packages/babel-parser/test/fixtures/esprima/automatic-semicolon-insertion/migrated_0009/output.json +++ b/packages/babel-parser/test/fixtures/esprima/automatic-semicolon-insertion/migrated_0009/output.json @@ -1,160 +1,49 @@ { "type": "File", - "start": 0, - "end": 52, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 18 - } - }, + "start":0,"end":52,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":18}}, "program": { "type": "Program", - "start": 0, - "end": 52, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 18 - } - }, + "start":0,"end":52,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":18}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "WhileStatement", - "start": 0, - "end": 52, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 18 - } - }, + "start":0,"end":52,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":18}}, "test": { "type": "BooleanLiteral", - "start": 7, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":7,"end":11,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":11}}, "value": true }, "body": { "type": "BlockStatement", - "start": 13, - "end": 52, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 2, - "column": 18 - } - }, + "start":13,"end":52,"loc":{"start":{"line":1,"column":13},"end":{"line":2,"column":18}}, "body": [ { "type": "BreakStatement", - "start": 15, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":15,"end":20,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":20}}, "label": null, "trailingComments": [ { "type": "CommentBlock", "value": " Multiline\nComment ", - "start": 21, - "end": 44, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 2, - "column": 10 - } - } + "start":21,"end":44,"loc":{"start":{"line":1,"column":21},"end":{"line":2,"column":10}} } ] }, { "type": "ExpressionStatement", - "start": 44, - "end": 50, - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 16 - } - }, + "start":44,"end":50,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":16}}, "expression": { "type": "Identifier", - "start": 44, - "end": 49, - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 15 - }, - "identifierName": "there" - }, + "start":44,"end":49,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":15},"identifierName":"there"}, "name": "there" }, "leadingComments": [ { "type": "CommentBlock", "value": " Multiline\nComment ", - "start": 21, - "end": 44, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 2, - "column": 10 - } - } + "start":21,"end":44,"loc":{"start":{"line":1,"column":21},"end":{"line":2,"column":10}} } ] } @@ -169,18 +58,7 @@ { "type": "CommentBlock", "value": " Multiline\nComment ", - "start": 21, - "end": 44, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 2, - "column": 10 - } - } + "start":21,"end":44,"loc":{"start":{"line":1,"column":21},"end":{"line":2,"column":10}} } ] } \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/automatic-semicolon-insertion/migrated_0010/output.json b/packages/babel-parser/test/fixtures/esprima/automatic-semicolon-insertion/migrated_0010/output.json index a6f087d5e25f..90a7b471fe11 100644 --- a/packages/babel-parser/test/fixtures/esprima/automatic-semicolon-insertion/migrated_0010/output.json +++ b/packages/babel-parser/test/fixtures/esprima/automatic-semicolon-insertion/migrated_0010/output.json @@ -1,126 +1,37 @@ { "type": "File", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 5 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":5}}, "program": { "type": "Program", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 5 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":5}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 5 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":5}}, "expression": { "type": "FunctionExpression", - "start": 1, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 2, - "column": 4 - } - }, + "start":1,"end":24,"loc":{"start":{"line":1,"column":1},"end":{"line":2,"column":4}}, "id": null, "generator": false, "async": false, "params": [], "body": { "type": "BlockStatement", - "start": 11, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 2, - "column": 4 - } - }, + "start":11,"end":24,"loc":{"start":{"line":1,"column":11},"end":{"line":2,"column":4}}, "body": [ { "type": "ReturnStatement", - "start": 13, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":13,"end":19,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":19}}, "argument": null }, { "type": "ExpressionStatement", - "start": 20, - "end": 22, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 2 - } - }, + "start":20,"end":22,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":2}}, "expression": { "type": "Identifier", - "start": 20, - "end": 21, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 1 - }, - "identifierName": "x" - }, + "start":20,"end":21,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":1},"identifierName":"x"}, "name": "x" } } diff --git a/packages/babel-parser/test/fixtures/esprima/automatic-semicolon-insertion/migrated_0011/output.json b/packages/babel-parser/test/fixtures/esprima/automatic-semicolon-insertion/migrated_0011/output.json index 205e7e5731fe..636d44f1cad8 100644 --- a/packages/babel-parser/test/fixtures/esprima/automatic-semicolon-insertion/migrated_0011/output.json +++ b/packages/babel-parser/test/fixtures/esprima/automatic-semicolon-insertion/migrated_0011/output.json @@ -1,162 +1,51 @@ { "type": "File", - "start": 0, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 5 - } - }, + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":5}}, "program": { "type": "Program", - "start": 0, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 5 - } - }, + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":5}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 5 - } - }, + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":5}}, "expression": { "type": "FunctionExpression", - "start": 1, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 2, - "column": 4 - } - }, + "start":1,"end":35,"loc":{"start":{"line":1,"column":1},"end":{"line":2,"column":4}}, "id": null, "generator": false, "async": false, "params": [], "body": { "type": "BlockStatement", - "start": 11, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 2, - "column": 4 - } - }, + "start":11,"end":35,"loc":{"start":{"line":1,"column":11},"end":{"line":2,"column":4}}, "body": [ { "type": "ReturnStatement", - "start": 13, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":13,"end":19,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":19}}, "argument": null, "trailingComments": [ { "type": "CommentLine", "value": " Comment", - "start": 20, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 30 - } - } + "start":20,"end":30,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":30}} } ] }, { "type": "ExpressionStatement", - "start": 31, - "end": 33, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 2 - } - }, + "start":31,"end":33,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":2}}, "expression": { "type": "Identifier", - "start": 31, - "end": 32, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 1 - }, - "identifierName": "x" - }, + "start":31,"end":32,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":1},"identifierName":"x"}, "name": "x" }, "leadingComments": [ { "type": "CommentLine", "value": " Comment", - "start": 20, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 30 - } - } + "start":20,"end":30,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":30}} } ] } @@ -176,18 +65,7 @@ { "type": "CommentLine", "value": " Comment", - "start": 20, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 30 - } - } + "start":20,"end":30,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":30}} } ] } \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/automatic-semicolon-insertion/migrated_0012/output.json b/packages/babel-parser/test/fixtures/esprima/automatic-semicolon-insertion/migrated_0012/output.json index 98570e79f91b..a7c128bbeb82 100644 --- a/packages/babel-parser/test/fixtures/esprima/automatic-semicolon-insertion/migrated_0012/output.json +++ b/packages/babel-parser/test/fixtures/esprima/automatic-semicolon-insertion/migrated_0012/output.json @@ -1,162 +1,51 @@ { "type": "File", - "start": 0, - "end": 47, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 15 - } - }, + "start":0,"end":47,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":15}}, "program": { "type": "Program", - "start": 0, - "end": 47, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 15 - } - }, + "start":0,"end":47,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":15}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 47, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 15 - } - }, + "start":0,"end":47,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":15}}, "expression": { "type": "FunctionExpression", - "start": 1, - "end": 46, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 2, - "column": 14 - } - }, + "start":1,"end":46,"loc":{"start":{"line":1,"column":1},"end":{"line":2,"column":14}}, "id": null, "generator": false, "async": false, "params": [], "body": { "type": "BlockStatement", - "start": 11, - "end": 46, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 2, - "column": 14 - } - }, + "start":11,"end":46,"loc":{"start":{"line":1,"column":11},"end":{"line":2,"column":14}}, "body": [ { "type": "ReturnStatement", - "start": 13, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":13,"end":19,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":19}}, "argument": null, "trailingComments": [ { "type": "CommentBlock", "value": " Multiline\nComment ", - "start": 19, - "end": 42, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 2, - "column": 10 - } - } + "start":19,"end":42,"loc":{"start":{"line":1,"column":19},"end":{"line":2,"column":10}} } ] }, { "type": "ExpressionStatement", - "start": 42, - "end": 44, - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 12 - } - }, + "start":42,"end":44,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":12}}, "expression": { "type": "Identifier", - "start": 42, - "end": 43, - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 11 - }, - "identifierName": "x" - }, + "start":42,"end":43,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":11},"identifierName":"x"}, "name": "x" }, "leadingComments": [ { "type": "CommentBlock", "value": " Multiline\nComment ", - "start": 19, - "end": 42, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 2, - "column": 10 - } - } + "start":19,"end":42,"loc":{"start":{"line":1,"column":19},"end":{"line":2,"column":10}} } ] } @@ -176,18 +65,7 @@ { "type": "CommentBlock", "value": " Multiline\nComment ", - "start": 19, - "end": 42, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 2, - "column": 10 - } - } + "start":19,"end":42,"loc":{"start":{"line":1,"column":19},"end":{"line":2,"column":10}} } ] } \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/automatic-semicolon-insertion/migrated_0013/output.json b/packages/babel-parser/test/fixtures/esprima/automatic-semicolon-insertion/migrated_0013/output.json index aed9954aa3f8..e6e9eaa784ec 100644 --- a/packages/babel-parser/test/fixtures/esprima/automatic-semicolon-insertion/migrated_0013/output.json +++ b/packages/babel-parser/test/fixtures/esprima/automatic-semicolon-insertion/migrated_0013/output.json @@ -1,110 +1,31 @@ { "type": "File", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 8 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":8}}, "program": { "type": "Program", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 8 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":8}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "BlockStatement", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 8 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":8}}, "body": [ { "type": "ThrowStatement", - "start": 2, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":2,"end":13,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":13}}, "argument": { "type": "Identifier", - "start": 8, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 13 - }, - "identifierName": "error" - }, + "start":8,"end":13,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":13},"identifierName":"error"}, "name": "error" } }, { "type": "ExpressionStatement", - "start": 14, - "end": 20, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 6 - } - }, + "start":14,"end":20,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":6}}, "expression": { "type": "Identifier", - "start": 14, - "end": 19, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 5 - }, - "identifierName": "error" - }, + "start":14,"end":19,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":5},"identifierName":"error"}, "name": "error" } } diff --git a/packages/babel-parser/test/fixtures/esprima/automatic-semicolon-insertion/migrated_0014/output.json b/packages/babel-parser/test/fixtures/esprima/automatic-semicolon-insertion/migrated_0014/output.json index ab8810f09c9b..5929da115ce5 100644 --- a/packages/babel-parser/test/fixtures/esprima/automatic-semicolon-insertion/migrated_0014/output.json +++ b/packages/babel-parser/test/fixtures/esprima/automatic-semicolon-insertion/migrated_0014/output.json @@ -1,146 +1,45 @@ { "type": "File", - "start": 0, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 8 - } - }, + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":8}}, "program": { "type": "Program", - "start": 0, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 8 - } - }, + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":8}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "BlockStatement", - "start": 0, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 8 - } - }, + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":8}}, "body": [ { "type": "ThrowStatement", - "start": 2, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":2,"end":13,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":13}}, "argument": { "type": "Identifier", - "start": 8, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 13 - }, - "identifierName": "error" - }, + "start":8,"end":13,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":13},"identifierName":"error"}, "name": "error" }, "trailingComments": [ { "type": "CommentLine", "value": " Comment", - "start": 13, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 23 - } - } + "start":13,"end":23,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":23}} } ] }, { "type": "ExpressionStatement", - "start": 24, - "end": 30, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 6 - } - }, + "start":24,"end":30,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":6}}, "expression": { "type": "Identifier", - "start": 24, - "end": 29, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 5 - }, - "identifierName": "error" - }, + "start":24,"end":29,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":5},"identifierName":"error"}, "name": "error" }, "leadingComments": [ { "type": "CommentLine", "value": " Comment", - "start": 13, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 23 - } - } + "start":13,"end":23,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":23}} } ] } @@ -154,18 +53,7 @@ { "type": "CommentLine", "value": " Comment", - "start": 13, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 23 - } - } + "start":13,"end":23,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":23}} } ] } \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/automatic-semicolon-insertion/migrated_0015/output.json b/packages/babel-parser/test/fixtures/esprima/automatic-semicolon-insertion/migrated_0015/output.json index 183a587ddc76..97e46379c3fa 100644 --- a/packages/babel-parser/test/fixtures/esprima/automatic-semicolon-insertion/migrated_0015/output.json +++ b/packages/babel-parser/test/fixtures/esprima/automatic-semicolon-insertion/migrated_0015/output.json @@ -1,146 +1,45 @@ { "type": "File", - "start": 0, - "end": 44, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 18 - } - }, + "start":0,"end":44,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":18}}, "program": { "type": "Program", - "start": 0, - "end": 44, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 18 - } - }, + "start":0,"end":44,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":18}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "BlockStatement", - "start": 0, - "end": 44, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 18 - } - }, + "start":0,"end":44,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":18}}, "body": [ { "type": "ThrowStatement", - "start": 2, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":2,"end":13,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":13}}, "argument": { "type": "Identifier", - "start": 8, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 13 - }, - "identifierName": "error" - }, + "start":8,"end":13,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":13},"identifierName":"error"}, "name": "error" }, "trailingComments": [ { "type": "CommentBlock", "value": " Multiline\nComment ", - "start": 13, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 2, - "column": 10 - } - } + "start":13,"end":36,"loc":{"start":{"line":1,"column":13},"end":{"line":2,"column":10}} } ] }, { "type": "ExpressionStatement", - "start": 36, - "end": 42, - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 16 - } - }, + "start":36,"end":42,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":16}}, "expression": { "type": "Identifier", - "start": 36, - "end": 41, - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 15 - }, - "identifierName": "error" - }, + "start":36,"end":41,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":15},"identifierName":"error"}, "name": "error" }, "leadingComments": [ { "type": "CommentBlock", "value": " Multiline\nComment ", - "start": 13, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 2, - "column": 10 - } - } + "start":13,"end":36,"loc":{"start":{"line":1,"column":13},"end":{"line":2,"column":10}} } ] } @@ -154,18 +53,7 @@ { "type": "CommentBlock", "value": " Multiline\nComment ", - "start": 13, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 2, - "column": 10 - } - } + "start":13,"end":36,"loc":{"start":{"line":1,"column":13},"end":{"line":2,"column":10}} } ] } \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/declaration-const/migrated_0000/output.json b/packages/babel-parser/test/fixtures/esprima/declaration-const/migrated_0000/output.json index db86a852e1e6..396a6c89cbf9 100644 --- a/packages/babel-parser/test/fixtures/esprima/declaration-const/migrated_0000/output.json +++ b/packages/babel-parser/test/fixtures/esprima/declaration-const/migrated_0000/output.json @@ -1,94 +1,27 @@ { "type": "File", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, "program": { "type": "Program", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, "declarations": [ { "type": "VariableDeclarator", - "start": 6, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":6,"end":12,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":12}}, "id": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "x" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"x"}, "name": "x" }, "init": { "type": "NumericLiteral", - "start": 10, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":10,"end":12,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":12}}, "extra": { "rawValue": 42, "raw": "42" diff --git a/packages/babel-parser/test/fixtures/esprima/declaration-const/migrated_0001/output.json b/packages/babel-parser/test/fixtures/esprima/declaration-const/migrated_0001/output.json index 691def9334d3..656b96520ed0 100644 --- a/packages/babel-parser/test/fixtures/esprima/declaration-const/migrated_0001/output.json +++ b/packages/babel-parser/test/fixtures/esprima/declaration-const/migrated_0001/output.json @@ -1,109 +1,31 @@ { "type": "File", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "program": { "type": "Program", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "BlockStatement", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "body": [ { "type": "VariableDeclaration", - "start": 2, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":2,"end":14,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":14}}, "declarations": [ { "type": "VariableDeclarator", - "start": 8, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":8,"end":14,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":14}}, "id": { "type": "Identifier", - "start": 8, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "x" - }, + "start":8,"end":9,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":9},"identifierName":"x"}, "name": "x" }, "init": { "type": "NumericLiteral", - "start": 12, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":12,"end":14,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":14}}, "extra": { "rawValue": 42, "raw": "42" diff --git a/packages/babel-parser/test/fixtures/esprima/declaration-const/migrated_0002/output.json b/packages/babel-parser/test/fixtures/esprima/declaration-const/migrated_0002/output.json index 41c281d3dc18..3c2375875863 100644 --- a/packages/babel-parser/test/fixtures/esprima/declaration-const/migrated_0002/output.json +++ b/packages/babel-parser/test/fixtures/esprima/declaration-const/migrated_0002/output.json @@ -1,109 +1,31 @@ { "type": "File", - "start": 0, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, "program": { "type": "Program", - "start": 0, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "BlockStatement", - "start": 0, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, "body": [ { "type": "VariableDeclaration", - "start": 2, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":2,"end":31,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":31}}, "declarations": [ { "type": "VariableDeclarator", - "start": 8, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":8,"end":14,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":14}}, "id": { "type": "Identifier", - "start": 8, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "x" - }, + "start":8,"end":9,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":9},"identifierName":"x"}, "name": "x" }, "init": { "type": "NumericLiteral", - "start": 12, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":12,"end":14,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":14}}, "extra": { "rawValue": 14, "raw": "14" @@ -113,49 +35,15 @@ }, { "type": "VariableDeclarator", - "start": 16, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":16,"end":21,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":21}}, "id": { "type": "Identifier", - "start": 16, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - }, - "identifierName": "y" - }, + "start":16,"end":17,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":17},"identifierName":"y"}, "name": "y" }, "init": { "type": "NumericLiteral", - "start": 20, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":20,"end":21,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":21}}, "extra": { "rawValue": 3, "raw": "3" @@ -165,49 +53,15 @@ }, { "type": "VariableDeclarator", - "start": 23, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":23,"end":31,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":31}}, "id": { "type": "Identifier", - "start": 23, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 24 - }, - "identifierName": "z" - }, + "start":23,"end":24,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":24},"identifierName":"z"}, "name": "z" }, "init": { "type": "NumericLiteral", - "start": 27, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":27,"end":31,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":31}}, "extra": { "rawValue": 1977, "raw": "1977" diff --git a/packages/babel-parser/test/fixtures/esprima/declaration-function/dupe-param/options.json b/packages/babel-parser/test/fixtures/esprima/declaration-function/dupe-param/options.json deleted file mode 100644 index 8b20b9a7df36..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/declaration-function/dupe-param/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Argument name clash (1:14)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/declaration-function/dupe-param/output.json b/packages/babel-parser/test/fixtures/esprima/declaration-function/dupe-param/output.json new file mode 100644 index 000000000000..94ce8601abd3 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/declaration-function/dupe-param/output.json @@ -0,0 +1,59 @@ +{ + "type": "File", + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, + "errors": [ + "SyntaxError: Argument name clash (1:14)" + ], + "program": { + "type": "Program", + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, + "id": { + "type": "Identifier", + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"a"}, + "name": "a" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start":11,"end":12,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":12},"identifierName":"x"}, + "name": "x" + }, + { + "type": "Identifier", + "start":14,"end":15,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":15},"identifierName":"x"}, + "name": "x" + } + ], + "body": { + "type": "BlockStatement", + "start":17,"end":32,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":32}}, + "body": [], + "directives": [ + { + "type": "Directive", + "start":18,"end":31,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":31}}, + "value": { + "type": "DirectiveLiteral", + "start":18,"end":30,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":30}}, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/declaration-function/migrated_0000/output.json b/packages/babel-parser/test/fixtures/esprima/declaration-function/migrated_0000/output.json index d5cdac1d3659..352ffb6fc1d5 100644 --- a/packages/babel-parser/test/fixtures/esprima/declaration-function/migrated_0000/output.json +++ b/packages/babel-parser/test/fixtures/esprima/declaration-function/migrated_0000/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, "program": { "type": "Program", - "start": 0, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, "id": { "type": "Identifier", - "start": 9, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 14 - }, - "identifierName": "hello" - }, + "start":9,"end":14,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":14},"identifierName":"hello"}, "name": "hello" }, "generator": false, @@ -65,62 +20,17 @@ "params": [], "body": { "type": "BlockStatement", - "start": 17, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":17,"end":29,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":29}}, "body": [ { "type": "ExpressionStatement", - "start": 19, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":19,"end":27,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":27}}, "expression": { "type": "CallExpression", - "start": 19, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":19,"end":26,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":26}}, "callee": { "type": "Identifier", - "start": 19, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 24 - }, - "identifierName": "sayHi" - }, + "start":19,"end":24,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":24},"identifierName":"sayHi"}, "name": "sayHi" }, "arguments": [] diff --git a/packages/babel-parser/test/fixtures/esprima/declaration-function/migrated_0001/output.json b/packages/babel-parser/test/fixtures/esprima/declaration-function/migrated_0001/output.json index 3104ab9ccf37..91afc6eae077 100644 --- a/packages/babel-parser/test/fixtures/esprima/declaration-function/migrated_0001/output.json +++ b/packages/babel-parser/test/fixtures/esprima/declaration-function/migrated_0001/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, "program": { "type": "Program", - "start": 0, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, "id": { "type": "Identifier", - "start": 9, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 13 - }, - "identifierName": "eval" - }, + "start":9,"end":13,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":13},"identifierName":"eval"}, "name": "eval" }, "generator": false, @@ -65,18 +20,7 @@ "params": [], "body": { "type": "BlockStatement", - "start": 16, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":16,"end":19,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":19}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/esprima/declaration-function/migrated_0002/output.json b/packages/babel-parser/test/fixtures/esprima/declaration-function/migrated_0002/output.json index d26abaf0e394..e14cc06b048c 100644 --- a/packages/babel-parser/test/fixtures/esprima/declaration-function/migrated_0002/output.json +++ b/packages/babel-parser/test/fixtures/esprima/declaration-function/migrated_0002/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "program": { "type": "Program", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "id": { "type": "Identifier", - "start": 9, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 18 - }, - "identifierName": "arguments" - }, + "start":9,"end":18,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":18},"identifierName":"arguments"}, "name": "arguments" }, "generator": false, @@ -65,18 +20,7 @@ "params": [], "body": { "type": "BlockStatement", - "start": 21, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":21,"end":24,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":24}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/esprima/declaration-function/migrated_0003/output.json b/packages/babel-parser/test/fixtures/esprima/declaration-function/migrated_0003/output.json index db77094d7822..02b469112a4e 100644 --- a/packages/babel-parser/test/fixtures/esprima/declaration-function/migrated_0003/output.json +++ b/packages/babel-parser/test/fixtures/esprima/declaration-function/migrated_0003/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "program": { "type": "Program", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "id": { "type": "Identifier", - "start": 9, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 13 - }, - "identifierName": "test" - }, + "start":9,"end":13,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":13},"identifierName":"test"}, "name": "test" }, "generator": false, @@ -65,53 +20,18 @@ "params": [ { "type": "Identifier", - "start": 14, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - }, - "identifierName": "t" - }, + "start":14,"end":15,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":15},"identifierName":"t"}, "name": "t" }, { "type": "Identifier", - "start": 17, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - }, - "identifierName": "t" - }, + "start":17,"end":18,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":18},"identifierName":"t"}, "name": "t" } ], "body": { "type": "BlockStatement", - "start": 20, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":20,"end":23,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":23}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/esprima/declaration-function/migrated_0004/output.json b/packages/babel-parser/test/fixtures/esprima/declaration-function/migrated_0004/output.json index 1d7e31b52684..518d4ff517eb 100644 --- a/packages/babel-parser/test/fixtures/esprima/declaration-function/migrated_0004/output.json +++ b/packages/babel-parser/test/fixtures/esprima/declaration-function/migrated_0004/output.json @@ -1,77 +1,21 @@ { "type": "File", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, "program": { "type": "Program", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, "expression": { "type": "FunctionExpression", - "start": 1, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":1,"end":24,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":24}}, "id": { "type": "Identifier", - "start": 10, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 14 - }, - "identifierName": "test" - }, + "start":10,"end":14,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":14},"identifierName":"test"}, "name": "test" }, "generator": false, @@ -79,53 +23,18 @@ "params": [ { "type": "Identifier", - "start": 15, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - }, - "identifierName": "t" - }, + "start":15,"end":16,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":16},"identifierName":"t"}, "name": "t" }, { "type": "Identifier", - "start": 18, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - }, - "identifierName": "t" - }, + "start":18,"end":19,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":19},"identifierName":"t"}, "name": "t" } ], "body": { "type": "BlockStatement", - "start": 21, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":21,"end":24,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":24}}, "body": [], "directives": [] }, diff --git a/packages/babel-parser/test/fixtures/esprima/declaration-function/migrated_0005/output.json b/packages/babel-parser/test/fixtures/esprima/declaration-function/migrated_0005/output.json index 77acd2e88e34..68368affc159 100644 --- a/packages/babel-parser/test/fixtures/esprima/declaration-function/migrated_0005/output.json +++ b/packages/babel-parser/test/fixtures/esprima/declaration-function/migrated_0005/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 53, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 53 - } - }, + "start":0,"end":53,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":53}}, "program": { "type": "Program", - "start": 0, - "end": 53, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 53 - } - }, + "start":0,"end":53,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":53}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 53, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 53 - } - }, + "start":0,"end":53,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":53}}, "id": { "type": "Identifier", - "start": 9, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 13 - }, - "identifierName": "eval" - }, + "start":9,"end":13,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":13},"identifierName":"eval"}, "name": "eval" }, "generator": false, @@ -65,48 +20,14 @@ "params": [], "body": { "type": "BlockStatement", - "start": 16, - "end": 53, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 53 - } - }, + "start":16,"end":53,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":53}}, "body": [ { "type": "FunctionDeclaration", - "start": 18, - "end": 51, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 51 - } - }, + "start":18,"end":51,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":51}}, "id": { "type": "Identifier", - "start": 27, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 32 - }, - "identifierName": "inner" - }, + "start":27,"end":32,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":32},"identifierName":"inner"}, "name": "inner" }, "generator": false, @@ -114,48 +35,15 @@ "params": [], "body": { "type": "BlockStatement", - "start": 35, - "end": 51, - "loc": { - "start": { - "line": 1, - "column": 35 - }, - "end": { - "line": 1, - "column": 51 - } - }, + "start":35,"end":51,"loc":{"start":{"line":1,"column":35},"end":{"line":1,"column":51}}, "body": [], "directives": [ { "type": "Directive", - "start": 37, - "end": 49, - "loc": { - "start": { - "line": 1, - "column": 37 - }, - "end": { - "line": 1, - "column": 49 - } - }, + "start":37,"end":49,"loc":{"start":{"line":1,"column":37},"end":{"line":1,"column":49}}, "value": { "type": "DirectiveLiteral", - "start": 37, - "end": 49, - "loc": { - "start": { - "line": 1, - "column": 37 - }, - "end": { - "line": 1, - "column": 49 - } - }, + "start":37,"end":49,"loc":{"start":{"line":1,"column":37},"end":{"line":1,"column":49}}, "value": "use strict", "extra": { "raw": "\"use strict\"", diff --git a/packages/babel-parser/test/fixtures/esprima/declaration-function/migrated_0006/output.json b/packages/babel-parser/test/fixtures/esprima/declaration-function/migrated_0006/output.json index a0915a8bde84..058bf6f3e4a8 100644 --- a/packages/babel-parser/test/fixtures/esprima/declaration-function/migrated_0006/output.json +++ b/packages/babel-parser/test/fixtures/esprima/declaration-function/migrated_0006/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, "program": { "type": "Program", - "start": 0, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, "id": { "type": "Identifier", - "start": 9, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 14 - }, - "identifierName": "hello" - }, + "start":9,"end":14,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":14},"identifierName":"hello"}, "name": "hello" }, "generator": false, @@ -65,80 +20,23 @@ "params": [ { "type": "Identifier", - "start": 15, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - }, - "identifierName": "a" - }, + "start":15,"end":16,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":16},"identifierName":"a"}, "name": "a" } ], "body": { "type": "BlockStatement", - "start": 18, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":18,"end":30,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":30}}, "body": [ { "type": "ExpressionStatement", - "start": 20, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":20,"end":28,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":28}}, "expression": { "type": "CallExpression", - "start": 20, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":20,"end":27,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":27}}, "callee": { "type": "Identifier", - "start": 20, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 25 - }, - "identifierName": "sayHi" - }, + "start":20,"end":25,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":25},"identifierName":"sayHi"}, "name": "sayHi" }, "arguments": [] diff --git a/packages/babel-parser/test/fixtures/esprima/declaration-function/migrated_0007/output.json b/packages/babel-parser/test/fixtures/esprima/declaration-function/migrated_0007/output.json index 4a6668b95a21..2c224fe25348 100644 --- a/packages/babel-parser/test/fixtures/esprima/declaration-function/migrated_0007/output.json +++ b/packages/babel-parser/test/fixtures/esprima/declaration-function/migrated_0007/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, "program": { "type": "Program", - "start": 0, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, "id": { "type": "Identifier", - "start": 9, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 14 - }, - "identifierName": "hello" - }, + "start":9,"end":14,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":14},"identifierName":"hello"}, "name": "hello" }, "generator": false, @@ -65,97 +20,28 @@ "params": [ { "type": "Identifier", - "start": 15, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - }, - "identifierName": "a" - }, + "start":15,"end":16,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":16},"identifierName":"a"}, "name": "a" }, { "type": "Identifier", - "start": 18, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - }, - "identifierName": "b" - }, + "start":18,"end":19,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":19},"identifierName":"b"}, "name": "b" } ], "body": { "type": "BlockStatement", - "start": 21, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":21,"end":33,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":33}}, "body": [ { "type": "ExpressionStatement", - "start": 23, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":23,"end":31,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":31}}, "expression": { "type": "CallExpression", - "start": 23, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":23,"end":30,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":30}}, "callee": { "type": "Identifier", - "start": 23, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 28 - }, - "identifierName": "sayHi" - }, + "start":23,"end":28,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":28},"identifierName":"sayHi"}, "name": "sayHi" }, "arguments": [] diff --git a/packages/babel-parser/test/fixtures/esprima/declaration-function/migrated_0008/output.json b/packages/babel-parser/test/fixtures/esprima/declaration-function/migrated_0008/output.json index ad99f992e1de..834ffa769d2b 100644 --- a/packages/babel-parser/test/fixtures/esprima/declaration-function/migrated_0008/output.json +++ b/packages/babel-parser/test/fixtures/esprima/declaration-function/migrated_0008/output.json @@ -1,156 +1,44 @@ { "type": "File", - "start": 0, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, "program": { "type": "Program", - "start": 0, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":4,"end":31,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":31}}, "id": { "type": "Identifier", - "start": 4, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "hi" - }, + "start":4,"end":6,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":6},"identifierName":"hi"}, "name": "hi" }, "init": { "type": "FunctionExpression", - "start": 9, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":9,"end":31,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":31}}, "id": null, "generator": false, "async": false, "params": [], "body": { "type": "BlockStatement", - "start": 20, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":20,"end":31,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":31}}, "body": [ { "type": "ExpressionStatement", - "start": 22, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":22,"end":29,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":29}}, "expression": { "type": "CallExpression", - "start": 22, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":22,"end":29,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":29}}, "callee": { "type": "Identifier", - "start": 22, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 27 - }, - "identifierName": "sayHi" - }, + "start":22,"end":27,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":27},"identifierName":"sayHi"}, "name": "sayHi" }, "arguments": [] diff --git a/packages/babel-parser/test/fixtures/esprima/declaration-function/migrated_0009/output.json b/packages/babel-parser/test/fixtures/esprima/declaration-function/migrated_0009/output.json index c6c506d5446a..902977b89965 100644 --- a/packages/babel-parser/test/fixtures/esprima/declaration-function/migrated_0009/output.json +++ b/packages/babel-parser/test/fixtures/esprima/declaration-function/migrated_0009/output.json @@ -1,109 +1,30 @@ { "type": "File", - "start": 0, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, "program": { "type": "Program", - "start": 0, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":4,"end":28,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":28}}, "id": { "type": "Identifier", - "start": 4, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "hi" - }, + "start":4,"end":6,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":6},"identifierName":"hi"}, "name": "hi" }, "init": { "type": "FunctionExpression", - "start": 9, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":9,"end":28,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":28}}, "id": { "type": "Identifier", - "start": 18, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 22 - }, - "identifierName": "eval" - }, + "start":18,"end":22,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":22},"identifierName":"eval"}, "name": "eval" }, "generator": false, @@ -111,18 +32,7 @@ "params": [], "body": { "type": "BlockStatement", - "start": 25, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":25,"end":28,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":28}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/esprima/declaration-function/migrated_0010/output.json b/packages/babel-parser/test/fixtures/esprima/declaration-function/migrated_0010/output.json index 2c6c0d75a8da..695e91aedd01 100644 --- a/packages/babel-parser/test/fixtures/esprima/declaration-function/migrated_0010/output.json +++ b/packages/babel-parser/test/fixtures/esprima/declaration-function/migrated_0010/output.json @@ -1,109 +1,30 @@ { "type": "File", - "start": 0, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, "program": { "type": "Program", - "start": 0, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":4,"end":33,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":33}}, "id": { "type": "Identifier", - "start": 4, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "hi" - }, + "start":4,"end":6,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":6},"identifierName":"hi"}, "name": "hi" }, "init": { "type": "FunctionExpression", - "start": 9, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":9,"end":33,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":33}}, "id": { "type": "Identifier", - "start": 18, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 27 - }, - "identifierName": "arguments" - }, + "start":18,"end":27,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":27},"identifierName":"arguments"}, "name": "arguments" }, "generator": false, @@ -111,18 +32,7 @@ "params": [], "body": { "type": "BlockStatement", - "start": 30, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":30,"end":33,"loc":{"start":{"line":1,"column":30},"end":{"line":1,"column":33}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/esprima/declaration-function/migrated_0011/output.json b/packages/babel-parser/test/fixtures/esprima/declaration-function/migrated_0011/output.json index 7f0a025696fd..26b3458197ef 100644 --- a/packages/babel-parser/test/fixtures/esprima/declaration-function/migrated_0011/output.json +++ b/packages/babel-parser/test/fixtures/esprima/declaration-function/migrated_0011/output.json @@ -1,109 +1,30 @@ { "type": "File", - "start": 0, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":38}}, "program": { "type": "Program", - "start": 0, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":38}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":38}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 37 - } - }, + "start":4,"end":37,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":37}}, "id": { "type": "Identifier", - "start": 4, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "hello" - }, + "start":4,"end":9,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":9},"identifierName":"hello"}, "name": "hello" }, "init": { "type": "FunctionExpression", - "start": 12, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 37 - } - }, + "start":12,"end":37,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":37}}, "id": { "type": "Identifier", - "start": 21, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 23 - }, - "identifierName": "hi" - }, + "start":21,"end":23,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":23},"identifierName":"hi"}, "name": "hi" }, "generator": false, @@ -111,62 +32,17 @@ "params": [], "body": { "type": "BlockStatement", - "start": 26, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 37 - } - }, + "start":26,"end":37,"loc":{"start":{"line":1,"column":26},"end":{"line":1,"column":37}}, "body": [ { "type": "ExpressionStatement", - "start": 28, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":28,"end":35,"loc":{"start":{"line":1,"column":28},"end":{"line":1,"column":35}}, "expression": { "type": "CallExpression", - "start": 28, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":28,"end":35,"loc":{"start":{"line":1,"column":28},"end":{"line":1,"column":35}}, "callee": { "type": "Identifier", - "start": 28, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 33 - }, - "identifierName": "sayHi" - }, + "start":28,"end":33,"loc":{"start":{"line":1,"column":28},"end":{"line":1,"column":33},"identifierName":"sayHi"}, "name": "sayHi" }, "arguments": [] diff --git a/packages/babel-parser/test/fixtures/esprima/declaration-function/migrated_0012/output.json b/packages/babel-parser/test/fixtures/esprima/declaration-function/migrated_0012/output.json index aefb638ad9fc..cbd2d18d221d 100644 --- a/packages/babel-parser/test/fixtures/esprima/declaration-function/migrated_0012/output.json +++ b/packages/babel-parser/test/fixtures/esprima/declaration-function/migrated_0012/output.json @@ -1,80 +1,25 @@ { "type": "File", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "program": { "type": "Program", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "expression": { "type": "FunctionExpression", - "start": 1, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":1,"end":13,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":13}}, "id": null, "generator": false, "async": false, "params": [], "body": { "type": "BlockStatement", - "start": 11, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":11,"end":13,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":13}}, "body": [], "directives": [] }, diff --git a/packages/babel-parser/test/fixtures/esprima/declaration-function/migrated_0013/output.json b/packages/babel-parser/test/fixtures/esprima/declaration-function/migrated_0013/output.json index 275ac41e936b..89092f952956 100644 --- a/packages/babel-parser/test/fixtures/esprima/declaration-function/migrated_0013/output.json +++ b/packages/babel-parser/test/fixtures/esprima/declaration-function/migrated_0013/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, "program": { "type": "Program", - "start": 0, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, "id": { "type": "Identifier", - "start": 9, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 17 - }, - "identifierName": "universe" - }, + "start":9,"end":17,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":17},"identifierName":"universe"}, "name": "universe" }, "generator": false, @@ -65,36 +20,13 @@ "params": [ { "type": "Identifier", - "start": 18, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 27 - }, - "identifierName": "__proto__" - }, + "start":18,"end":27,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":27},"identifierName":"__proto__"}, "name": "__proto__" } ], "body": { "type": "BlockStatement", - "start": 29, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":29,"end":32,"loc":{"start":{"line":1,"column":29},"end":{"line":1,"column":32}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/esprima/declaration-function/migrated_0014/output.json b/packages/babel-parser/test/fixtures/esprima/declaration-function/migrated_0014/output.json index 71f1b8bd187e..227aa8271943 100644 --- a/packages/babel-parser/test/fixtures/esprima/declaration-function/migrated_0014/output.json +++ b/packages/babel-parser/test/fixtures/esprima/declaration-function/migrated_0014/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":38}}, "program": { "type": "Program", - "start": 0, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":38}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":38}}, "id": { "type": "Identifier", - "start": 9, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 13 - }, - "identifierName": "test" - }, + "start":9,"end":13,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":13},"identifierName":"test"}, "name": "test" }, "generator": false, @@ -65,61 +20,17 @@ "params": [], "body": { "type": "BlockStatement", - "start": 16, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":16,"end":38,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":38}}, "body": [ { "type": "ExpressionStatement", - "start": 18, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":18,"end":36,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":36}}, "expression": { "type": "BinaryExpression", - "start": 18, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":18,"end":35,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":35}}, "left": { "type": "StringLiteral", - "start": 18, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":18,"end":30,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":30}}, "extra": { "rawValue": "use strict", "raw": "\"use strict\"" @@ -129,18 +40,7 @@ "operator": "+", "right": { "type": "NumericLiteral", - "start": 33, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 33 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":33,"end":35,"loc":{"start":{"line":1,"column":33},"end":{"line":1,"column":35}}, "extra": { "rawValue": 42, "raw": "42" diff --git a/packages/babel-parser/test/fixtures/esprima/declaration-let/migrated_0000/output.json b/packages/babel-parser/test/fixtures/esprima/declaration-let/migrated_0000/output.json index d1a07b1d64a3..b68ff2e27c8f 100644 --- a/packages/babel-parser/test/fixtures/esprima/declaration-let/migrated_0000/output.json +++ b/packages/babel-parser/test/fixtures/esprima/declaration-let/migrated_0000/output.json @@ -1,78 +1,22 @@ { "type": "File", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "program": { "type": "Program", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5}}, "id": { "type": "Identifier", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "x" - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"x"}, "name": "x" }, "init": null diff --git a/packages/babel-parser/test/fixtures/esprima/declaration-let/migrated_0001/output.json b/packages/babel-parser/test/fixtures/esprima/declaration-let/migrated_0001/output.json index b1b3dddbea30..fa8fbdd9633f 100644 --- a/packages/babel-parser/test/fixtures/esprima/declaration-let/migrated_0001/output.json +++ b/packages/babel-parser/test/fixtures/esprima/declaration-let/migrated_0001/output.json @@ -1,93 +1,26 @@ { "type": "File", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "program": { "type": "Program", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "BlockStatement", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "body": [ { "type": "VariableDeclaration", - "start": 2, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":2,"end":7,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":7}}, "declarations": [ { "type": "VariableDeclarator", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7}}, "id": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "x" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"x"}, "name": "x" }, "init": null diff --git a/packages/babel-parser/test/fixtures/esprima/declaration-let/migrated_0002/output.json b/packages/babel-parser/test/fixtures/esprima/declaration-let/migrated_0002/output.json index 477b83093b51..744b22efd01e 100644 --- a/packages/babel-parser/test/fixtures/esprima/declaration-let/migrated_0002/output.json +++ b/packages/babel-parser/test/fixtures/esprima/declaration-let/migrated_0002/output.json @@ -1,109 +1,31 @@ { "type": "File", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "program": { "type": "Program", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "BlockStatement", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "body": [ { "type": "VariableDeclaration", - "start": 2, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":2,"end":12,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":12}}, "declarations": [ { "type": "VariableDeclarator", - "start": 6, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":6,"end":12,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":12}}, "id": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "x" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"x"}, "name": "x" }, "init": { "type": "NumericLiteral", - "start": 10, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":10,"end":12,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":12}}, "extra": { "rawValue": 42, "raw": "42" diff --git a/packages/babel-parser/test/fixtures/esprima/declaration-let/migrated_0003/output.json b/packages/babel-parser/test/fixtures/esprima/declaration-let/migrated_0003/output.json index 532e5a2d6a4e..0c7546766c3d 100644 --- a/packages/babel-parser/test/fixtures/esprima/declaration-let/migrated_0003/output.json +++ b/packages/babel-parser/test/fixtures/esprima/declaration-let/migrated_0003/output.json @@ -1,109 +1,31 @@ { "type": "File", - "start": 0, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, "program": { "type": "Program", - "start": 0, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "BlockStatement", - "start": 0, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, "body": [ { "type": "VariableDeclaration", - "start": 2, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":2,"end":29,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":29}}, "declarations": [ { "type": "VariableDeclarator", - "start": 6, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":6,"end":12,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":12}}, "id": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "x" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"x"}, "name": "x" }, "init": { "type": "NumericLiteral", - "start": 10, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":10,"end":12,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":12}}, "extra": { "rawValue": 14, "raw": "14" @@ -113,49 +35,15 @@ }, { "type": "VariableDeclarator", - "start": 14, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":14,"end":19,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":19}}, "id": { "type": "Identifier", - "start": 14, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - }, - "identifierName": "y" - }, + "start":14,"end":15,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":15},"identifierName":"y"}, "name": "y" }, "init": { "type": "NumericLiteral", - "start": 18, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":18,"end":19,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":19}}, "extra": { "rawValue": 3, "raw": "3" @@ -165,49 +53,15 @@ }, { "type": "VariableDeclarator", - "start": 21, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":21,"end":29,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":29}}, "id": { "type": "Identifier", - "start": 21, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 22 - }, - "identifierName": "z" - }, + "start":21,"end":22,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":22},"identifierName":"z"}, "name": "z" }, "init": { "type": "NumericLiteral", - "start": 25, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":25,"end":29,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":29}}, "extra": { "rawValue": 1977, "raw": "1977" diff --git a/packages/babel-parser/test/fixtures/esprima/directive-prolog/migrated_0000/output.json b/packages/babel-parser/test/fixtures/esprima/directive-prolog/migrated_0000/output.json index 69d467e3c9ee..d9f6fda13c07 100644 --- a/packages/babel-parser/test/fixtures/esprima/directive-prolog/migrated_0000/output.json +++ b/packages/babel-parser/test/fixtures/esprima/directive-prolog/migrated_0000/output.json @@ -1,172 +1,50 @@ { "type": "File", - "start": 0, - "end": 46, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 46 - } - }, + "start":0,"end":46,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":46}}, "program": { "type": "Program", - "start": 0, - "end": 46, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 46 - } - }, + "start":0,"end":46,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":46}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 46, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 46 - } - }, + "start":0,"end":46,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":46}}, "expression": { "type": "CallExpression", - "start": 1, - "end": 45, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 45 - } - }, + "start":1,"end":45,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":45}}, "callee": { "type": "FunctionExpression", - "start": 1, - "end": 43, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 43 - } - }, + "start":1,"end":43,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":43}}, "id": null, "generator": false, "async": false, "params": [], "body": { "type": "BlockStatement", - "start": 13, - "end": 43, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 43 - } - }, + "start":13,"end":43,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":43}}, "body": [ { "type": "WithStatement", - "start": 32, - "end": 41, - "loc": { - "start": { - "line": 1, - "column": 32 - }, - "end": { - "line": 1, - "column": 41 - } - }, + "start":32,"end":41,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":41}}, "object": { "type": "Identifier", - "start": 38, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 38 - }, - "end": { - "line": 1, - "column": 39 - }, - "identifierName": "i" - }, + "start":38,"end":39,"loc":{"start":{"line":1,"column":38},"end":{"line":1,"column":39},"identifierName":"i"}, "name": "i" }, "body": { "type": "EmptyStatement", - "start": 40, - "end": 41, - "loc": { - "start": { - "line": 1, - "column": 40 - }, - "end": { - "line": 1, - "column": 41 - } - } + "start":40,"end":41,"loc":{"start":{"line":1,"column":40},"end":{"line":1,"column":41}} } } ], "directives": [ { "type": "Directive", - "start": 15, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":15,"end":31,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":31}}, "value": { "type": "DirectiveLiteral", - "start": 15, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":15,"end":30,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":30}}, "value": "use\\x20strict", "extra": { "raw": "'use\\x20strict'", diff --git a/packages/babel-parser/test/fixtures/esprima/directive-prolog/migrated_0001/output.json b/packages/babel-parser/test/fixtures/esprima/directive-prolog/migrated_0001/output.json index fc292877c8a6..b2aee3e01fc8 100644 --- a/packages/babel-parser/test/fixtures/esprima/directive-prolog/migrated_0001/output.json +++ b/packages/babel-parser/test/fixtures/esprima/directive-prolog/migrated_0001/output.json @@ -1,172 +1,50 @@ { "type": "File", - "start": 0, - "end": 44, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 44 - } - }, + "start":0,"end":44,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":44}}, "program": { "type": "Program", - "start": 0, - "end": 44, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 44 - } - }, + "start":0,"end":44,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":44}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 44, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 44 - } - }, + "start":0,"end":44,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":44}}, "expression": { "type": "CallExpression", - "start": 1, - "end": 43, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 43 - } - }, + "start":1,"end":43,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":43}}, "callee": { "type": "FunctionExpression", - "start": 1, - "end": 41, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 41 - } - }, + "start":1,"end":41,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":41}}, "id": null, "generator": false, "async": false, "params": [], "body": { "type": "BlockStatement", - "start": 13, - "end": 41, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 41 - } - }, + "start":13,"end":41,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":41}}, "body": [ { "type": "WithStatement", - "start": 30, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 1, - "column": 39 - } - }, + "start":30,"end":39,"loc":{"start":{"line":1,"column":30},"end":{"line":1,"column":39}}, "object": { "type": "Identifier", - "start": 36, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 36 - }, - "end": { - "line": 1, - "column": 37 - }, - "identifierName": "i" - }, + "start":36,"end":37,"loc":{"start":{"line":1,"column":36},"end":{"line":1,"column":37},"identifierName":"i"}, "name": "i" }, "body": { "type": "EmptyStatement", - "start": 38, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 38 - }, - "end": { - "line": 1, - "column": 39 - } - } + "start":38,"end":39,"loc":{"start":{"line":1,"column":38},"end":{"line":1,"column":39}} } } ], "directives": [ { "type": "Directive", - "start": 15, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":15,"end":29,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":29}}, "value": { "type": "DirectiveLiteral", - "start": 15, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":15,"end":28,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":28}}, "value": "use\\nstrict", "extra": { "raw": "'use\\nstrict'", diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-array-binding-pattern/array-binding-pattern-01/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-array-binding-pattern/array-binding-pattern-01/output.json index b15acf390f65..9e31dda05942 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-array-binding-pattern/array-binding-pattern-01/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-array-binding-pattern/array-binding-pattern-01/output.json @@ -1,96 +1,29 @@ { "type": "File", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "program": { "type": "Program", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "expression": { "type": "ArrowFunctionExpression", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, "id": null, "generator": false, "async": false, "params": [ { "type": "ArrayPattern", - "start": 1, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 4 - } - }, + "start":1,"end":4,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":4}}, "elements": [ { "type": "Identifier", - "start": 2, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 3 - }, - "identifierName": "a" - }, + "start":2,"end":3,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":3},"identifierName":"a"}, "name": "a" } ] @@ -98,33 +31,11 @@ ], "body": { "type": "ArrayExpression", - "start": 9, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":9,"end":12,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":12}}, "elements": [ { "type": "NumericLiteral", - "start": 10, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11}}, "extra": { "rawValue": 0, "raw": "0" diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-array-binding-pattern/array-binding-pattern-02/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-array-binding-pattern/array-binding-pattern-02/output.json index 189fe30109a1..a603fe1d0708 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-array-binding-pattern/array-binding-pattern-02/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-array-binding-pattern/array-binding-pattern-02/output.json @@ -1,113 +1,34 @@ { "type": "File", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "program": { "type": "Program", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "expression": { "type": "ArrowFunctionExpression", - "start": 0, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, "id": null, "generator": false, "async": false, "params": [ { "type": "ArrayPattern", - "start": 1, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":1,"end":6,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":6}}, "elements": [ { "type": "Identifier", - "start": 2, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 3 - }, - "identifierName": "a" - }, + "start":2,"end":3,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":3},"identifierName":"a"}, "name": "a" }, { "type": "Identifier", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "b" - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"b"}, "name": "b" } ] @@ -115,18 +36,7 @@ ], "body": { "type": "NumericLiteral", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10}}, "extra": { "rawValue": 0, "raw": "0" diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-array-binding-pattern/array-binding-pattern-03/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-array-binding-pattern/array-binding-pattern-03/output.json index fca15c38d67e..5642bc19a157 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-array-binding-pattern/array-binding-pattern-03/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-array-binding-pattern/array-binding-pattern-03/output.json @@ -1,127 +1,37 @@ { "type": "File", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "program": { "type": "Program", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "expression": { "type": "ArrowFunctionExpression", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "id": null, "generator": false, "async": false, "params": [ { "type": "ArrayPattern", - "start": 1, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":1,"end":9,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":9}}, "elements": [ { "type": "Identifier", - "start": 2, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 3 - }, - "identifierName": "a" - }, + "start":2,"end":3,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":3},"identifierName":"a"}, "name": "a" }, { "type": "RestElement", - "start": 4, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":4,"end":8,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":8}}, "argument": { "type": "Identifier", - "start": 7, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - }, - "identifierName": "b" - }, + "start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8},"identifierName":"b"}, "name": "b" } } @@ -130,18 +40,7 @@ ], "body": { "type": "NumericLiteral", - "start": 12, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":12,"end":13,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":13}}, "extra": { "rawValue": 0, "raw": "0" diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-array-binding-pattern/array-binding-pattern-empty/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-array-binding-pattern/array-binding-pattern-empty/output.json index 49e718ed823e..fdba048fd702 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-array-binding-pattern/array-binding-pattern-empty/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-array-binding-pattern/array-binding-pattern-empty/output.json @@ -1,97 +1,31 @@ { "type": "File", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, "program": { "type": "Program", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, "expression": { "type": "ArrowFunctionExpression", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "id": null, "generator": false, "async": false, "params": [ { "type": "ArrayPattern", - "start": 1, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 3 - } - }, + "start":1,"end":3,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":3}}, "elements": [] } ], "body": { "type": "NumericLiteral", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7}}, "extra": { "rawValue": 0, "raw": "0" diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-array-binding-pattern/elision/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-array-binding-pattern/elision/output.json index 10c96101b155..4c9cd14a8d0b 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-array-binding-pattern/elision/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-array-binding-pattern/elision/output.json @@ -1,79 +1,27 @@ { "type": "File", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "program": { "type": "Program", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "expression": { "type": "ArrowFunctionExpression", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "id": null, "generator": false, "async": false, "params": [ { "type": "ArrayPattern", - "start": 1, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 5 - } + "start":1,"end":5,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":5}}, + "extra": { + "trailingComma": 3 }, "elements": [ null, @@ -83,18 +31,7 @@ ], "body": { "type": "NumericLiteral", - "start": 8, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":8,"end":9,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":9}}, "extra": { "rawValue": 0, "raw": "0" diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-array-binding-pattern/invalid-dup-param/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-array-binding-pattern/invalid-dup-param/options.json deleted file mode 100644 index a4a6e207d28c..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-array-binding-pattern/invalid-dup-param/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Argument name clash (1:11)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-array-binding-pattern/invalid-dup-param/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-array-binding-pattern/invalid-dup-param/output.json new file mode 100644 index 000000000000..cd41333b8b6a --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-array-binding-pattern/invalid-dup-param/output.json @@ -0,0 +1,69 @@ +{ + "type": "File", + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, + "errors": [ + "SyntaxError: Argument name clash (1:11)" + ], + "program": { + "type": "Program", + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, + "expression": { + "type": "ArrowFunctionExpression", + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "ArrayPattern", + "start":1,"end":13,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":13}}, + "elements": [ + { + "type": "Identifier", + "start":2,"end":3,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":3},"identifierName":"a"}, + "name": "a" + }, + { + "type": "ArrayPattern", + "start":4,"end":7,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":7}}, + "elements": [ + { + "type": "Identifier", + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"b"}, + "name": "b" + } + ] + }, + { + "type": "RestElement", + "start":8,"end":12,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":12}}, + "argument": { + "type": "Identifier", + "start":11,"end":12,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":12},"identifierName":"b"}, + "name": "b" + } + } + ] + } + ], + "body": { + "type": "NumericLiteral", + "start":16,"end":17,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":17}}, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-array-pattern/dupe-param-1/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-array-pattern/dupe-param-1/options.json deleted file mode 100644 index 49e8d8e86314..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-array-pattern/dupe-param-1/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Argument name clash (2:14)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-array-pattern/dupe-param-1/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-array-pattern/dupe-param-1/output.json new file mode 100644 index 000000000000..2bcffbf3a427 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-array-pattern/dupe-param-1/output.json @@ -0,0 +1,65 @@ +{ + "type": "File", + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":20}}, + "errors": [ + "SyntaxError: Argument name clash (2:14)" + ], + "program": { + "type": "Program", + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":20}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":14,"end":34,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":20}}, + "id": { + "type": "Identifier", + "start":23,"end":24,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":10},"identifierName":"a"}, + "name": "a" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "ArrayPattern", + "start":25,"end":30,"loc":{"start":{"line":2,"column":11},"end":{"line":2,"column":16}}, + "elements": [ + { + "type": "Identifier", + "start":26,"end":27,"loc":{"start":{"line":2,"column":12},"end":{"line":2,"column":13},"identifierName":"a"}, + "name": "a" + }, + { + "type": "Identifier", + "start":28,"end":29,"loc":{"start":{"line":2,"column":14},"end":{"line":2,"column":15},"identifierName":"a"}, + "name": "a" + } + ] + } + ], + "body": { + "type": "BlockStatement", + "start":31,"end":34,"loc":{"start":{"line":2,"column":17},"end":{"line":2,"column":20}}, + "body": [], + "directives": [] + } + } + ], + "directives": [ + { + "type": "Directive", + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "value": { + "type": "DirectiveLiteral", + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-array-pattern/dupe-param-2/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-array-pattern/dupe-param-2/options.json deleted file mode 100644 index 3829082a4878..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-array-pattern/dupe-param-2/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Argument name clash (2:17)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-array-pattern/dupe-param-2/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-array-pattern/dupe-param-2/output.json new file mode 100644 index 000000000000..cc0e0ad645c9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-array-pattern/dupe-param-2/output.json @@ -0,0 +1,69 @@ +{ + "type": "File", + "start":0,"end":37,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":23}}, + "errors": [ + "SyntaxError: Argument name clash (2:17)" + ], + "program": { + "type": "Program", + "start":0,"end":37,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":23}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":14,"end":37,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":23}}, + "id": { + "type": "Identifier", + "start":23,"end":24,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":10},"identifierName":"a"}, + "name": "a" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "ArrayPattern", + "start":25,"end":33,"loc":{"start":{"line":2,"column":11},"end":{"line":2,"column":19}}, + "elements": [ + { + "type": "Identifier", + "start":26,"end":27,"loc":{"start":{"line":2,"column":12},"end":{"line":2,"column":13},"identifierName":"a"}, + "name": "a" + }, + { + "type": "RestElement", + "start":28,"end":32,"loc":{"start":{"line":2,"column":14},"end":{"line":2,"column":18}}, + "argument": { + "type": "Identifier", + "start":31,"end":32,"loc":{"start":{"line":2,"column":17},"end":{"line":2,"column":18},"identifierName":"a"}, + "name": "a" + } + } + ] + } + ], + "body": { + "type": "BlockStatement", + "start":34,"end":37,"loc":{"start":{"line":2,"column":20},"end":{"line":2,"column":23}}, + "body": [], + "directives": [] + } + } + ], + "directives": [ + { + "type": "Directive", + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "value": { + "type": "DirectiveLiteral", + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-array-pattern/dupe-param-3/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-array-pattern/dupe-param-3/options.json deleted file mode 100644 index 782073313a19..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-array-pattern/dupe-param-3/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Argument name clash (2:19)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-array-pattern/dupe-param-3/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-array-pattern/dupe-param-3/output.json new file mode 100644 index 000000000000..22f0d1704663 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-array-pattern/dupe-param-3/output.json @@ -0,0 +1,90 @@ +{ + "type": "File", + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":25}}, + "errors": [ + "SyntaxError: Argument name clash (2:19)" + ], + "program": { + "type": "Program", + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":25}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":14,"end":39,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":25}}, + "id": { + "type": "Identifier", + "start":23,"end":24,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":10},"identifierName":"a"}, + "name": "a" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "ArrayPattern", + "start":25,"end":35,"loc":{"start":{"line":2,"column":11},"end":{"line":2,"column":21}}, + "elements": [ + { + "type": "ObjectPattern", + "start":26,"end":29,"loc":{"start":{"line":2,"column":12},"end":{"line":2,"column":15}}, + "properties": [ + { + "type": "ObjectProperty", + "start":27,"end":28,"loc":{"start":{"line":2,"column":13},"end":{"line":2,"column":14}}, + "method": false, + "key": { + "type": "Identifier", + "start":27,"end":28,"loc":{"start":{"line":2,"column":13},"end":{"line":2,"column":14},"identifierName":"a"}, + "name": "a" + }, + "computed": false, + "shorthand": true, + "value": { + "type": "Identifier", + "start":27,"end":28,"loc":{"start":{"line":2,"column":13},"end":{"line":2,"column":14},"identifierName":"a"}, + "name": "a" + }, + "extra": { + "shorthand": true + } + } + ] + }, + { + "type": "RestElement", + "start":30,"end":34,"loc":{"start":{"line":2,"column":16},"end":{"line":2,"column":20}}, + "argument": { + "type": "Identifier", + "start":33,"end":34,"loc":{"start":{"line":2,"column":19},"end":{"line":2,"column":20},"identifierName":"a"}, + "name": "a" + } + } + ] + } + ], + "body": { + "type": "BlockStatement", + "start":36,"end":39,"loc":{"start":{"line":2,"column":22},"end":{"line":2,"column":25}}, + "body": [], + "directives": [] + } + } + ], + "directives": [ + { + "type": "Directive", + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "value": { + "type": "DirectiveLiteral", + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-array-pattern/elision/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-array-pattern/elision/output.json index 0fc500c1c07f..04b0ddfa026a 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-array-pattern/elision/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-array-pattern/elision/output.json @@ -1,111 +1,33 @@ { "type": "File", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "program": { "type": "Program", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":4,"end":12,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":12}}, "id": { "type": "ArrayPattern", - "start": 4, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":4,"end":8,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":8}}, "elements": [ { "type": "Identifier", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "a" - }, + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"a"}, "name": "a" } ] }, "init": { "type": "NumericLiteral", - "start": 11, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":11,"end":12,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":12}}, "extra": { "rawValue": 0, "raw": "0" diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-array-pattern/empty-pattern-catch-param/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-array-pattern/empty-pattern-catch-param/output.json index 91b847669991..cae989f54020 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-array-pattern/empty-pattern-catch-param/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-array-pattern/empty-pattern-catch-param/output.json @@ -1,109 +1,32 @@ { "type": "File", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, "program": { "type": "Program", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "TryStatement", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, "block": { "type": "BlockStatement", - "start": 4, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":4,"end":7,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":7}}, "body": [], "directives": [] }, "handler": { "type": "CatchClause", - "start": 8, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":8,"end":21,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":21}}, "param": { "type": "ArrayPattern", - "start": 15, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":15,"end":17,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":17}}, "elements": [] }, "body": { "type": "BlockStatement", - "start": 19, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":19,"end":21,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":21}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-array-pattern/empty-pattern-fn/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-array-pattern/empty-pattern-fn/output.json index cfdc0f3edd87..2864855b5018 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-array-pattern/empty-pattern-fn/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-array-pattern/empty-pattern-fn/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "program": { "type": "Program", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "id": { "type": "Identifier", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - }, - "identifierName": "a" - }, + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"a"}, "name": "a" }, "generator": false, @@ -65,35 +20,13 @@ "params": [ { "type": "ArrayPattern", - "start": 11, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":11,"end":13,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":13}}, "elements": [] } ], "body": { "type": "BlockStatement", - "start": 15, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":15,"end":17,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":17}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-array-pattern/empty-pattern-lexical/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-array-pattern/empty-pattern-lexical/output.json index f4cd58a8536b..5ad2528dac93 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-array-pattern/empty-pattern-lexical/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-array-pattern/empty-pattern-lexical/output.json @@ -1,93 +1,27 @@ { "type": "File", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, "program": { "type": "Program", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":4,"end":11,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":11}}, "id": { "type": "ArrayPattern", - "start": 4, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":4,"end":6,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":6}}, "elements": [] }, "init": { "type": "ArrayExpression", - "start": 9, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":9,"end":11,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":11}}, "elements": [] } } diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-array-pattern/empty-pattern-var/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-array-pattern/empty-pattern-var/output.json index 4541489a9620..0e6ad4f2d22c 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-array-pattern/empty-pattern-var/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-array-pattern/empty-pattern-var/output.json @@ -1,93 +1,27 @@ { "type": "File", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "program": { "type": "Program", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":4,"end":10,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":10}}, "id": { "type": "ArrayPattern", - "start": 4, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":4,"end":6,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":6}}, "elements": [] }, "init": { "type": "NumericLiteral", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10}}, "extra": { "rawValue": 0, "raw": "0" diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-array-pattern/hole/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-array-pattern/hole/output.json index a8823231e514..d9f6ce38a04e 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-array-pattern/hole/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-array-pattern/hole/output.json @@ -1,129 +1,39 @@ { "type": "File", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, "program": { "type": "Program", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":4,"end":12,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":12}}, "id": { "type": "ArrayPattern", - "start": 4, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":4,"end":10,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":10}}, "elements": [ { "type": "Identifier", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "a" - }, + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"a"}, "name": "a" }, null, { "type": "Identifier", - "start": 8, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "b" - }, + "start":8,"end":9,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":9},"identifierName":"b"}, "name": "b" } ] }, "init": { "type": "NumericLiteral", - "start": 11, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":11,"end":12,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":12}}, "extra": { "rawValue": 0, "raw": "0" diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-array-pattern/nested-pattern/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-array-pattern/nested-pattern/output.json index 800161b9495f..fb9d0dae8a88 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-array-pattern/nested-pattern/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-array-pattern/nested-pattern/output.json @@ -1,110 +1,33 @@ { "type": "File", - "start": 0, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, "program": { "type": "Program", - "start": 0, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":4,"end":10,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":10}}, "id": { "type": "ArrayPattern", - "start": 4, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":4,"end":8,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":8}}, "elements": [ { "type": "ArrayPattern", - "start": 5, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":5,"end":7,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":7}}, "elements": [] } ] }, "init": { "type": "NumericLiteral", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10}}, "extra": { "rawValue": 0, "raw": "0" diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-array-pattern/patterned-catch/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-array-pattern/patterned-catch/output.json index 48dd0332f9cd..88ca34bec2dc 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-array-pattern/patterned-catch/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-array-pattern/patterned-catch/output.json @@ -1,192 +1,56 @@ { "type": "File", - "start": 0, - "end": 49, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 49 - } - }, + "start":0,"end":49,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":49}}, "program": { "type": "Program", - "start": 0, - "end": 49, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 49 - } - }, + "start":0,"end":49,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":49}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "TryStatement", - "start": 0, - "end": 49, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 49 - } - }, + "start":0,"end":49,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":49}}, "block": { "type": "BlockStatement", - "start": 4, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":4,"end":6,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":6}}, "body": [], "directives": [] }, "handler": { "type": "CatchClause", - "start": 7, - "end": 49, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 49 - } - }, + "start":7,"end":49,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":49}}, "param": { "type": "ArrayPattern", - "start": 14, - "end": 45, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 45 - } - }, + "start":14,"end":45,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":45}}, "elements": [ { "type": "Identifier", - "start": 15, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - }, - "identifierName": "a" - }, + "start":15,"end":16,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":16},"identifierName":"a"}, "name": "a" }, { "type": "Identifier", - "start": 17, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - }, - "identifierName": "b" - }, + "start":17,"end":18,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":18},"identifierName":"b"}, "name": "b" }, { "type": "ObjectPattern", - "start": 20, - "end": 44, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 44 - } - }, + "start":20,"end":44,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":44}}, "properties": [ { "type": "ObjectProperty", - "start": 21, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":21,"end":22,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":22}}, "method": false, "key": { "type": "Identifier", - "start": 21, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 22 - }, - "identifierName": "c" - }, + "start":21,"end":22,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":22},"identifierName":"c"}, "name": "c" }, "computed": false, "shorthand": true, "value": { "type": "Identifier", - "start": 21, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 22 - }, - "identifierName": "c" - }, + "start":21,"end":22,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":22},"identifierName":"c"}, "name": "c" }, "extra": { @@ -195,83 +59,26 @@ }, { "type": "ObjectProperty", - "start": 24, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":24,"end":29,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":29}}, "method": false, "key": { "type": "Identifier", - "start": 24, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 25 - }, - "identifierName": "d" - }, + "start":24,"end":25,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":25},"identifierName":"d"}, "name": "d" }, "computed": false, "shorthand": false, "value": { "type": "AssignmentPattern", - "start": 26, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":26,"end":29,"loc":{"start":{"line":1,"column":26},"end":{"line":1,"column":29}}, "left": { "type": "Identifier", - "start": 26, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 27 - }, - "identifierName": "e" - }, + "start":26,"end":27,"loc":{"start":{"line":1,"column":26},"end":{"line":1,"column":27},"identifierName":"e"}, "name": "e" }, "right": { "type": "NumericLiteral", - "start": 28, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":28,"end":29,"loc":{"start":{"line":1,"column":28},"end":{"line":1,"column":29}}, "extra": { "rawValue": 0, "raw": "0" @@ -282,83 +89,26 @@ }, { "type": "ObjectProperty", - "start": 31, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 31 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":31,"end":38,"loc":{"start":{"line":1,"column":31},"end":{"line":1,"column":38}}, "method": false, "computed": true, "key": { "type": "Identifier", - "start": 32, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 32 - }, - "end": { - "line": 1, - "column": 33 - }, - "identifierName": "f" - }, + "start":32,"end":33,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":33},"identifierName":"f"}, "name": "f" }, "shorthand": false, "value": { "type": "AssignmentPattern", - "start": 35, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 35 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":35,"end":38,"loc":{"start":{"line":1,"column":35},"end":{"line":1,"column":38}}, "left": { "type": "Identifier", - "start": 35, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 35 - }, - "end": { - "line": 1, - "column": 36 - }, - "identifierName": "g" - }, + "start":35,"end":36,"loc":{"start":{"line":1,"column":35},"end":{"line":1,"column":36},"identifierName":"g"}, "name": "g" }, "right": { "type": "NumericLiteral", - "start": 37, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 37 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":37,"end":38,"loc":{"start":{"line":1,"column":37},"end":{"line":1,"column":38}}, "extra": { "rawValue": 0, "raw": "0" @@ -369,84 +119,26 @@ }, { "type": "ObjectProperty", - "start": 40, - "end": 43, - "loc": { - "start": { - "line": 1, - "column": 40 - }, - "end": { - "line": 1, - "column": 43 - } - }, + "start":40,"end":43,"loc":{"start":{"line":1,"column":40},"end":{"line":1,"column":43}}, "method": false, "key": { "type": "Identifier", - "start": 40, - "end": 41, - "loc": { - "start": { - "line": 1, - "column": 40 - }, - "end": { - "line": 1, - "column": 41 - }, - "identifierName": "h" - }, + "start":40,"end":41,"loc":{"start":{"line":1,"column":40},"end":{"line":1,"column":41},"identifierName":"h"}, "name": "h" }, "computed": false, "shorthand": true, "value": { "type": "AssignmentPattern", - "start": 40, - "end": 43, - "loc": { - "start": { - "line": 1, - "column": 40 - }, - "end": { - "line": 1, - "column": 43 - } - }, + "start":40,"end":43,"loc":{"start":{"line":1,"column":40},"end":{"line":1,"column":43}}, "left": { "type": "Identifier", - "start": 40, - "end": 41, - "loc": { - "start": { - "line": 1, - "column": 40 - }, - "end": { - "line": 1, - "column": 41 - }, - "identifierName": "h" - }, + "start":40,"end":41,"loc":{"start":{"line":1,"column":40},"end":{"line":1,"column":41},"identifierName":"h"}, "name": "h" }, "right": { "type": "Identifier", - "start": 42, - "end": 43, - "loc": { - "start": { - "line": 1, - "column": 42 - }, - "end": { - "line": 1, - "column": 43 - }, - "identifierName": "i" - }, + "start":42,"end":43,"loc":{"start":{"line":1,"column":42},"end":{"line":1,"column":43},"identifierName":"i"}, "name": "i" } }, @@ -460,18 +152,7 @@ }, "body": { "type": "BlockStatement", - "start": 47, - "end": 49, - "loc": { - "start": { - "line": 1, - "column": 47 - }, - "end": { - "line": 1, - "column": 49 - } - }, + "start":47,"end":49,"loc":{"start":{"line":1,"column":47},"end":{"line":1,"column":49}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-array-pattern/rest/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-array-pattern/rest/output.json index b454e3f7a1cf..ddaa8680e60d 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-array-pattern/rest/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-array-pattern/rest/output.json @@ -1,107 +1,29 @@ { "type": "File", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "program": { "type": "Program", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":4,"end":14,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":14}}, "id": { "type": "ArrayPattern", - "start": 4, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":4,"end":10,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":10}}, "elements": [ { "type": "RestElement", - "start": 5, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":5,"end":9,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":9}}, "argument": { "type": "Identifier", - "start": 8, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "a" - }, + "start":8,"end":9,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":9},"identifierName":"a"}, "name": "a" } } @@ -109,18 +31,7 @@ }, "init": { "type": "NumericLiteral", - "start": 13, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":13,"end":14,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":14}}, "extra": { "rawValue": 0, "raw": "0" diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-array-pattern/tailing-hold/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-array-pattern/tailing-hold/output.json index 09cb074e0ef3..ef60dd713e4e 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-array-pattern/tailing-hold/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-array-pattern/tailing-hold/output.json @@ -1,93 +1,26 @@ { "type": "File", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "program": { "type": "Program", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":4,"end":11,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":11}}, "id": { "type": "ArrayPattern", - "start": 4, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":4,"end":9,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":9}}, "elements": [ { "type": "Identifier", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "a" - }, + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"a"}, "name": "a" }, null @@ -95,18 +28,7 @@ }, "init": { "type": "NumericLiteral", - "start": 10, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11}}, "extra": { "rawValue": 0, "raw": "0" diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-array-pattern/with-default-catch-param/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-array-pattern/with-default-catch-param/output.json index 3ea9eda80fdc..044fb5c7b408 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-array-pattern/with-default-catch-param/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-array-pattern/with-default-catch-param/output.json @@ -1,139 +1,39 @@ { "type": "File", - "start": 0, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, "program": { "type": "Program", - "start": 0, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "TryStatement", - "start": 0, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, "block": { "type": "BlockStatement", - "start": 4, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":4,"end":7,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":7}}, "body": [], "directives": [] }, "handler": { "type": "CatchClause", - "start": 8, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":8,"end":27,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":27}}, "param": { "type": "ArrayPattern", - "start": 15, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":15,"end":22,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":22}}, "elements": [ { "type": "AssignmentPattern", - "start": 16, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":16,"end":21,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":21}}, "left": { "type": "Identifier", - "start": 16, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - }, - "identifierName": "a" - }, + "start":16,"end":17,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":17},"identifierName":"a"}, "name": "a" }, "right": { "type": "NumericLiteral", - "start": 20, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":20,"end":21,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":21}}, "extra": { "rawValue": 0, "raw": "0" @@ -145,18 +45,7 @@ }, "body": { "type": "BlockStatement", - "start": 24, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":24,"end":27,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":27}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-array-pattern/with-default-fn/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-array-pattern/with-default-fn/output.json index a507e6b1af27..e4ab30e9fc55 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-array-pattern/with-default-fn/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-array-pattern/with-default-fn/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, "program": { "type": "Program", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, "id": { "type": "Identifier", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - }, - "identifierName": "a" - }, + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"a"}, "name": "a" }, "generator": false, @@ -65,64 +20,19 @@ "params": [ { "type": "ArrayPattern", - "start": 11, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":11,"end":16,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":16}}, "elements": [ { "type": "AssignmentPattern", - "start": 12, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":12,"end":15,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":15}}, "left": { "type": "Identifier", - "start": 12, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - }, - "identifierName": "a" - }, + "start":12,"end":13,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":13},"identifierName":"a"}, "name": "a" }, "right": { "type": "NumericLiteral", - "start": 14, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":14,"end":15,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":15}}, "extra": { "rawValue": 0, "raw": "0" @@ -135,18 +45,7 @@ ], "body": { "type": "BlockStatement", - "start": 18, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":18,"end":20,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":20}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-array-pattern/with-object-pattern/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-array-pattern/with-object-pattern/output.json index f1dbff4cc84b..0f3b7a515f6a 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-array-pattern/with-object-pattern/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-array-pattern/with-object-pattern/output.json @@ -1,142 +1,41 @@ { "type": "File", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "program": { "type": "Program", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":4,"end":13,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":13}}, "id": { "type": "ArrayPattern", - "start": 4, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":4,"end":9,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":9}}, "elements": [ { "type": "ObjectPattern", - "start": 5, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":5,"end":8,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":8}}, "properties": [ { "type": "ObjectProperty", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7}}, "method": false, "key": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "a" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"a"}, "name": "a" }, "computed": false, "shorthand": true, "value": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "a" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"a"}, "name": "a" }, "extra": { @@ -149,18 +48,7 @@ }, "init": { "type": "NumericLiteral", - "start": 12, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":12,"end":13,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":13}}, "extra": { "rawValue": 0, "raw": "0" diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/arrow-with-multiple-arg-and-rest/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/arrow-with-multiple-arg-and-rest/output.json index 05e544a731df..3254ae4d7acc 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/arrow-with-multiple-arg-and-rest/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/arrow-with-multiple-arg-and-rest/output.json @@ -1,147 +1,45 @@ { "type": "File", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "program": { "type": "Program", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "expression": { "type": "ArrowFunctionExpression", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "id": null, "generator": false, "async": false, "params": [ { "type": "Identifier", - "start": 1, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - }, - "identifierName": "a" - }, + "start":1,"end":2,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":2},"identifierName":"a"}, "name": "a" }, { "type": "Identifier", - "start": 3, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 4 - }, - "identifierName": "b" - }, + "start":3,"end":4,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":4},"identifierName":"b"}, "name": "b" }, { "type": "RestElement", - "start": 5, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":5,"end":9,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":9}}, "argument": { "type": "Identifier", - "start": 8, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "c" - }, + "start":8,"end":9,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":9},"identifierName":"c"}, "name": "c" } } ], "body": { "type": "NumericLiteral", - "start": 14, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":14,"end":15,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":15}}, "extra": { "rawValue": 0, "raw": "0" diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/arrow-with-only-rest/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/arrow-with-only-rest/output.json index 28ed0df0c339..e10f67b1df35 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/arrow-with-only-rest/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/arrow-with-only-rest/output.json @@ -1,113 +1,35 @@ { "type": "File", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "program": { "type": "Program", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "expression": { "type": "ArrowFunctionExpression", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "id": null, "generator": false, "async": false, "params": [ { "type": "RestElement", - "start": 1, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":1,"end":5,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":5}}, "argument": { "type": "Identifier", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "a" - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"a"}, "name": "a" } } ], "body": { "type": "NumericLiteral", - "start": 10, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11}}, "extra": { "rawValue": 0, "raw": "0" diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/complex-rest-in-arrow-not-allowed/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/complex-rest-in-arrow-not-allowed/options.json deleted file mode 100644 index fd74c5228531..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/complex-rest-in-arrow-not-allowed/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Argument name clash (1:7)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/complex-rest-in-arrow-not-allowed/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/complex-rest-in-arrow-not-allowed/output.json new file mode 100644 index 000000000000..dfab13123cb4 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/complex-rest-in-arrow-not-allowed/output.json @@ -0,0 +1,58 @@ +{ + "type": "File", + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, + "errors": [ + "SyntaxError: Argument name clash (1:7)" + ], + "program": { + "type": "Program", + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, + "expression": { + "type": "ArrowFunctionExpression", + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start":1,"end":2,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":2},"identifierName":"a"}, + "name": "a" + }, + { + "type": "RestElement", + "start":3,"end":9,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":9}}, + "argument": { + "type": "ArrayPattern", + "start":6,"end":9,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":9}}, + "elements": [ + { + "type": "Identifier", + "start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8},"identifierName":"a"}, + "name": "a" + } + ] + } + } + ], + "body": { + "type": "NumericLiteral", + "start":14,"end":15,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":15}}, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/invalid-duplicated-params/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/invalid-duplicated-params/options.json deleted file mode 100644 index 368006ae58bd..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/invalid-duplicated-params/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Argument name clash (1:4)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/invalid-duplicated-params/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/invalid-duplicated-params/output.json new file mode 100644 index 000000000000..54a0b8dc4637 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/invalid-duplicated-params/output.json @@ -0,0 +1,44 @@ +{ + "type": "File", + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "errors": [ + "SyntaxError: Argument name clash (1:4)" + ], + "program": { + "type": "Program", + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "expression": { + "type": "ArrowFunctionExpression", + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start":1,"end":2,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":2},"identifierName":"x"}, + "name": "x" + }, + { + "type": "Identifier", + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"x"}, + "name": "x" + } + ], + "body": { + "type": "Identifier", + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11},"identifierName":"y"}, + "name": "y" + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/invalid-param-strict-mode/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/invalid-param-strict-mode/options.json deleted file mode 100644 index 2e6d7156cf57..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/invalid-param-strict-mode/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'eval' in strict mode (1:0)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/invalid-param-strict-mode/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/invalid-param-strict-mode/output.json new file mode 100644 index 000000000000..3dcc69133bee --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/invalid-param-strict-mode/output.json @@ -0,0 +1,54 @@ +{ + "type": "File", + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, + "errors": [ + "SyntaxError: Binding 'eval' in strict mode (1:0)" + ], + "program": { + "type": "Program", + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, + "expression": { + "type": "ArrowFunctionExpression", + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4},"identifierName":"eval"}, + "name": "eval" + } + ], + "body": { + "type": "BlockStatement", + "start":8,"end":22,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":22}}, + "body": [], + "directives": [ + { + "type": "Directive", + "start":9,"end":21,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":21}}, + "value": { + "type": "DirectiveLiteral", + "start":9,"end":21,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":21}}, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/migrated_0000/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/migrated_0000/output.json index c59ac797ad5e..c14b141b098f 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/migrated_0000/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/migrated_0000/output.json @@ -1,80 +1,25 @@ { "type": "File", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, "program": { "type": "Program", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, "expression": { "type": "ArrowFunctionExpression", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, "id": null, "generator": false, "async": false, "params": [], "body": { "type": "StringLiteral", - "start": 6, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":6,"end":12,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":12}}, "extra": { "rawValue": "test", "raw": "\"test\"" diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/migrated_0001/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/migrated_0001/output.json index 728dfb405136..9618fdfb2c40 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/migrated_0001/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/migrated_0001/output.json @@ -1,98 +1,31 @@ { "type": "File", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "program": { "type": "Program", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "expression": { "type": "ArrowFunctionExpression", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "id": null, "generator": false, "async": false, "params": [ { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "e" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"e"}, "name": "e" } ], "body": { "type": "StringLiteral", - "start": 5, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":5,"end":11,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":11}}, "extra": { "rawValue": "test", "raw": "\"test\"" diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/migrated_0002/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/migrated_0002/output.json index c2375ef25d9f..0d0d28d7f1bf 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/migrated_0002/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/migrated_0002/output.json @@ -1,98 +1,31 @@ { "type": "File", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "program": { "type": "Program", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "expression": { "type": "ArrowFunctionExpression", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "id": null, "generator": false, "async": false, "params": [ { "type": "Identifier", - "start": 1, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - }, - "identifierName": "e" - }, + "start":1,"end":2,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":2},"identifierName":"e"}, "name": "e" } ], "body": { "type": "StringLiteral", - "start": 7, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":7,"end":13,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":13}}, "extra": { "rawValue": "test", "raw": "\"test\"" diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/migrated_0003/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/migrated_0003/output.json index dda35332152b..dfe12266a2cd 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/migrated_0003/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/migrated_0003/output.json @@ -1,115 +1,36 @@ { "type": "File", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "program": { "type": "Program", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "expression": { "type": "ArrowFunctionExpression", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "id": null, "generator": false, "async": false, "params": [ { "type": "Identifier", - "start": 1, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - }, - "identifierName": "a" - }, + "start":1,"end":2,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":2},"identifierName":"a"}, "name": "a" }, { "type": "Identifier", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "b" - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"b"}, "name": "b" } ], "body": { "type": "StringLiteral", - "start": 10, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":10,"end":16,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":16}}, "extra": { "rawValue": "test", "raw": "\"test\"" diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/migrated_0004/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/migrated_0004/output.json index 1c6e09f83bb3..b16741cd695c 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/migrated_0004/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/migrated_0004/output.json @@ -1,127 +1,38 @@ { "type": "File", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, "program": { "type": "Program", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, "expression": { "type": "ArrowFunctionExpression", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, "id": null, "generator": false, "async": false, "params": [ { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "e" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"e"}, "name": "e" } ], "body": { "type": "BlockStatement", - "start": 5, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":5,"end":12,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":12}}, "body": [ { "type": "ExpressionStatement", - "start": 7, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":7,"end":10,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":10}}, "expression": { "type": "NumericLiteral", - "start": 7, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":7,"end":9,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":9}}, "extra": { "rawValue": 42, "raw": "42" diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/migrated_0005/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/migrated_0005/output.json index b38e5d2c1b6e..d62ccc489695 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/migrated_0005/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/migrated_0005/output.json @@ -1,147 +1,46 @@ { "type": "File", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "program": { "type": "Program", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "expression": { "type": "ArrowFunctionExpression", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "id": null, "generator": false, "async": false, "params": [ { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "e" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"e"}, "name": "e" } ], "body": { "type": "ObjectExpression", - "start": 6, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":6,"end":22,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":22}}, "properties": [ { "type": "ObjectProperty", - "start": 8, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":8,"end":20,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":20}}, "method": false, "key": { "type": "Identifier", - "start": 8, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 16 - }, - "identifierName": "property" - }, + "start":8,"end":16,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":16},"identifierName":"property"}, "name": "property" }, "computed": false, "shorthand": false, "value": { "type": "NumericLiteral", - "start": 18, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":18,"end":20,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":20}}, "extra": { "rawValue": 42, "raw": "42" diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/migrated_0006/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/migrated_0006/output.json index aeaacfb4d40d..00e4c4cd68bc 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/migrated_0006/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/migrated_0006/output.json @@ -1,141 +1,41 @@ { "type": "File", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, "program": { "type": "Program", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, "expression": { "type": "ArrowFunctionExpression", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, "id": null, "generator": false, "async": false, "params": [ { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "e" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"e"}, "name": "e" } ], "body": { "type": "BlockStatement", - "start": 5, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":5,"end":18,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":18}}, "body": [ { "type": "LabeledStatement", - "start": 7, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":7,"end":16,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":16}}, "body": { "type": "ExpressionStatement", - "start": 14, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":14,"end":16,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":16}}, "expression": { "type": "NumericLiteral", - "start": 14, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":14,"end":16,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":16}}, "extra": { "rawValue": 42, "raw": "42" @@ -145,19 +45,7 @@ }, "label": { "type": "Identifier", - "start": 7, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "label" - }, + "start":7,"end":12,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":12},"identifierName":"label"}, "name": "label" } } diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/migrated_0007/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/migrated_0007/output.json index 3283c962d68c..e9089f70a568 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/migrated_0007/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/migrated_0007/output.json @@ -1,144 +1,43 @@ { "type": "File", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "program": { "type": "Program", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "expression": { "type": "ArrowFunctionExpression", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "id": null, "generator": false, "async": false, "params": [ { "type": "Identifier", - "start": 1, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - }, - "identifierName": "a" - }, + "start":1,"end":2,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":2},"identifierName":"a"}, "name": "a" }, { "type": "Identifier", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "b" - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"b"}, "name": "b" } ], "body": { "type": "BlockStatement", - "start": 10, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":10,"end":17,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":17}}, "body": [ { "type": "ExpressionStatement", - "start": 12, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":12,"end":15,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":15}}, "expression": { "type": "NumericLiteral", - "start": 12, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":12,"end":14,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":14}}, "extra": { "rawValue": 42, "raw": "42" diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/migrated_0008/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/migrated_0008/output.json index e60231ec6c36..b2f75a4c1c78 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/migrated_0008/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/migrated_0008/output.json @@ -1,111 +1,33 @@ { "type": "File", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "program": { "type": "Program", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "expression": { "type": "ArrowFunctionExpression", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "id": null, "generator": false, "async": false, "params": [ { "type": "AssignmentPattern", - "start": 1, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 4 - } - }, + "start":1,"end":4,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":4}}, "left": { "type": "Identifier", - "start": 1, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - }, - "identifierName": "x" - }, + "start":1,"end":2,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":2},"identifierName":"x"}, "name": "x" }, "right": { "type": "NumericLiteral", - "start": 3, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 4 - } - }, + "start":3,"end":4,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":4}}, "extra": { "rawValue": 1, "raw": "1" @@ -116,51 +38,16 @@ ], "body": { "type": "BinaryExpression", - "start": 9, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":9,"end":14,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":14}}, "left": { "type": "Identifier", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - }, - "identifierName": "x" - }, + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"x"}, "name": "x" }, "operator": "*", "right": { "type": "Identifier", - "start": 13, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - }, - "identifierName": "x" - }, + "start":13,"end":14,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":14},"identifierName":"x"}, "name": "x" } } diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/migrated_0009/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/migrated_0009/output.json index 8f40c2b9e5c3..8f63cdd60d01 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/migrated_0009/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/migrated_0009/output.json @@ -1,98 +1,31 @@ { "type": "File", - "start": 0, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, "program": { "type": "Program", - "start": 0, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, "expression": { "type": "ArrowFunctionExpression", - "start": 0, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, "id": null, "generator": false, "async": false, "params": [ { "type": "Identifier", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - }, - "identifierName": "eval" - }, + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4},"identifierName":"eval"}, "name": "eval" } ], "body": { "type": "NumericLiteral", - "start": 8, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":8,"end":10,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":10}}, "extra": { "rawValue": 42, "raw": "42" diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/migrated_0010/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/migrated_0010/output.json index 13a6a64d0306..d33e35056af2 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/migrated_0010/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/migrated_0010/output.json @@ -1,98 +1,31 @@ { "type": "File", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "program": { "type": "Program", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "expression": { "type": "ArrowFunctionExpression", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "id": null, "generator": false, "async": false, "params": [ { "type": "Identifier", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "arguments" - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9},"identifierName":"arguments"}, "name": "arguments" } ], "body": { "type": "NumericLiteral", - "start": 13, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":13,"end":15,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":15}}, "extra": { "rawValue": 42, "raw": "42" diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/migrated_0011/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/migrated_0011/output.json index 6ae12c62e3e2..72ab3ece3629 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/migrated_0011/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/migrated_0011/output.json @@ -1,98 +1,31 @@ { "type": "File", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "program": { "type": "Program", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "expression": { "type": "ArrowFunctionExpression", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "id": null, "generator": false, "async": false, "params": [ { "type": "Identifier", - "start": 1, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - }, - "identifierName": "a" - }, + "start":1,"end":2,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":2},"identifierName":"a"}, "name": "a" } ], "body": { "type": "NumericLiteral", - "start": 7, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":7,"end":9,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":9}}, "extra": { "rawValue": 0, "raw": "00" diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/migrated_0012/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/migrated_0012/output.json index fd7a891d8c4d..ed7c52c2993e 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/migrated_0012/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/migrated_0012/output.json @@ -1,115 +1,36 @@ { "type": "File", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "program": { "type": "Program", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "expression": { "type": "ArrowFunctionExpression", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "id": null, "generator": false, "async": false, "params": [ { "type": "Identifier", - "start": 1, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "eval" - }, + "start":1,"end":5,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":5},"identifierName":"eval"}, "name": "eval" }, { "type": "Identifier", - "start": 7, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - }, - "identifierName": "a" - }, + "start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8},"identifierName":"a"}, "name": "a" } ], "body": { "type": "NumericLiteral", - "start": 13, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":13,"end":15,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":15}}, "extra": { "rawValue": 42, "raw": "42" diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/migrated_0013/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/migrated_0013/output.json index a51e793b44a2..d13b2732673e 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/migrated_0013/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/migrated_0013/output.json @@ -1,111 +1,33 @@ { "type": "File", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "program": { "type": "Program", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "expression": { "type": "ArrowFunctionExpression", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "id": null, "generator": false, "async": false, "params": [ { "type": "AssignmentPattern", - "start": 1, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":1,"end":10,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":10}}, "left": { "type": "Identifier", - "start": 1, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "eval" - }, + "start":1,"end":5,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":5},"identifierName":"eval"}, "name": "eval" }, "right": { "type": "NumericLiteral", - "start": 8, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":8,"end":10,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":10}}, "extra": { "rawValue": 10, "raw": "10" @@ -116,18 +38,7 @@ ], "body": { "type": "NumericLiteral", - "start": 15, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":15,"end":17,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":17}}, "extra": { "rawValue": 42, "raw": "42" diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/migrated_0014/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/migrated_0014/output.json index 114403aa5ed5..d3c143b18e69 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/migrated_0014/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/migrated_0014/output.json @@ -1,128 +1,38 @@ { "type": "File", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, "program": { "type": "Program", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, "expression": { "type": "ArrowFunctionExpression", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, "id": null, "generator": false, "async": false, "params": [ { "type": "Identifier", - "start": 1, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "eval" - }, + "start":1,"end":5,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":5},"identifierName":"eval"}, "name": "eval" }, { "type": "AssignmentPattern", - "start": 7, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":7,"end":13,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":13}}, "left": { "type": "Identifier", - "start": 7, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - }, - "identifierName": "a" - }, + "start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8},"identifierName":"a"}, "name": "a" }, "right": { "type": "NumericLiteral", - "start": 11, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":11,"end":13,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":13}}, "extra": { "rawValue": 10, "raw": "10" @@ -133,18 +43,7 @@ ], "body": { "type": "NumericLiteral", - "start": 18, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":18,"end":20,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":20}}, "extra": { "rawValue": 42, "raw": "42" diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/migrated_0015/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/migrated_0015/output.json index cd821a586b61..245d1b011abf 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/migrated_0015/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/migrated_0015/output.json @@ -1,99 +1,31 @@ { "type": "File", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, "program": { "type": "Program", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, "expression": { "type": "ArrowFunctionExpression", - "start": 1, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":1,"end":7,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":7}}, "id": null, "generator": false, "async": false, "params": [ { "type": "Identifier", - "start": 1, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - }, - "identifierName": "x" - }, + "start":1,"end":2,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":2},"identifierName":"x"}, "name": "x" } ], "body": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "x" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"x"}, "name": "x" }, "extra": { diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/migrated_0016/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/migrated_0016/output.json index 9250f449ee17..c513497671ef 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/migrated_0016/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/migrated_0016/output.json @@ -1,134 +1,44 @@ { "type": "File", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, "program": { "type": "Program", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, "expression": { "type": "ArrowFunctionExpression", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, "id": null, "generator": false, "async": false, "params": [ { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" } ], "body": { "type": "ArrowFunctionExpression", - "start": 5, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":5,"end":12,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":12}}, "id": null, "generator": false, "async": false, "params": [ { "type": "Identifier", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "y" - }, + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"y"}, "name": "y" } ], "body": { "type": "NumericLiteral", - "start": 10, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":10,"end":12,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":12}}, "extra": { "rawValue": 42, "raw": "42" diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/migrated_0017/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/migrated_0017/output.json index cdd0d45ecea5..91ad2d7f7a3e 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/migrated_0017/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/migrated_0017/output.json @@ -1,201 +1,63 @@ { "type": "File", - "start": 0, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, "program": { "type": "Program", - "start": 0, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, "expression": { "type": "ArrowFunctionExpression", - "start": 0, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, "id": null, "generator": false, "async": false, "params": [ { "type": "Identifier", - "start": 1, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - }, - "identifierName": "x" - }, + "start":1,"end":2,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":2},"identifierName":"x"}, "name": "x" } ], "body": { "type": "ArrowFunctionExpression", - "start": 8, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":8,"end":27,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":27}}, "id": null, "generator": false, "async": false, "params": [ { "type": "Identifier", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - }, - "identifierName": "y" - }, + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"y"}, "name": "y" }, { "type": "Identifier", - "start": 12, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - }, - "identifierName": "z" - }, + "start":12,"end":13,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":13},"identifierName":"z"}, "name": "z" } ], "body": { "type": "SequenceExpression", - "start": 19, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":19,"end":26,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":26}}, "expressions": [ { "type": "Identifier", - "start": 19, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 20 - }, - "identifierName": "x" - }, + "start":19,"end":20,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":20},"identifierName":"x"}, "name": "x" }, { "type": "Identifier", - "start": 22, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 23 - }, - "identifierName": "y" - }, + "start":22,"end":23,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":23},"identifierName":"y"}, "name": "y" }, { "type": "Identifier", - "start": 25, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 26 - }, - "identifierName": "z" - }, + "start":25,"end":26,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":26},"identifierName":"z"}, "name": "z" } ], diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/migrated_0018/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/migrated_0018/output.json index fb2194b635f5..1d6b874fa0e3 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/migrated_0018/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/migrated_0018/output.json @@ -1,112 +1,34 @@ { "type": "File", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "program": { "type": "Program", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "expression": { "type": "CallExpression", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "callee": { "type": "Identifier", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - }, - "identifierName": "foo" - }, + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3},"identifierName":"foo"}, "name": "foo" }, "arguments": [ { "type": "ArrowFunctionExpression", - "start": 4, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":4,"end":12,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":12}}, "id": null, "generator": false, "async": false, "params": [], "body": { "type": "BlockStatement", - "start": 10, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":10,"end":12,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":12}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/migrated_0019/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/migrated_0019/output.json index c075ce9f9170..d8574a83a95b 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/migrated_0019/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/migrated_0019/output.json @@ -1,147 +1,45 @@ { "type": "File", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "program": { "type": "Program", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "expression": { "type": "CallExpression", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "callee": { "type": "Identifier", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - }, - "identifierName": "foo" - }, + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3},"identifierName":"foo"}, "name": "foo" }, "arguments": [ { "type": "ArrowFunctionExpression", - "start": 4, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":4,"end":16,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":16}}, "id": null, "generator": false, "async": false, "params": [ { "type": "Identifier", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "x" - }, + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"x"}, "name": "x" }, { "type": "Identifier", - "start": 8, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "y" - }, + "start":8,"end":9,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":9},"identifierName":"y"}, "name": "y" } ], "body": { "type": "BlockStatement", - "start": 14, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":14,"end":16,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":16}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/migrated_0020/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/migrated_0020/output.json index 089ace58b0a9..796d5e9f1fad 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/migrated_0020/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/migrated_0020/output.json @@ -1,99 +1,31 @@ { "type": "File", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "program": { "type": "Program", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "expression": { "type": "ArrowFunctionExpression", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "id": null, "generator": false, "async": false, "params": [ { "type": "Identifier", - "start": 1, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 4 - }, - "identifierName": "sun" - }, + "start":1,"end":4,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":4},"identifierName":"sun"}, "name": "sun" } ], "body": { "type": "Identifier", - "start": 9, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 14 - }, - "identifierName": "earth" - }, + "start":9,"end":14,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":14},"identifierName":"earth"}, "name": "earth" } } diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/object-binding-pattern-01/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/object-binding-pattern-01/output.json index 04622ffb5ea7..9e8e266f2db4 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/object-binding-pattern-01/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/object-binding-pattern-01/output.json @@ -1,130 +1,40 @@ { "type": "File", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, "program": { "type": "Program", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, "expression": { "type": "ArrowFunctionExpression", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "id": null, "generator": false, "async": false, "params": [ { "type": "ObjectPattern", - "start": 1, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":1,"end":20,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":20}}, "properties": [ { "type": "ObjectProperty", - "start": 2, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 3 - } - }, + "start":2,"end":3,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":3}}, "method": false, "key": { "type": "Identifier", - "start": 2, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 3 - }, - "identifierName": "a" - }, + "start":2,"end":3,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":3},"identifierName":"a"}, "name": "a" }, "computed": false, "shorthand": true, "value": { "type": "Identifier", - "start": 2, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 3 - }, - "identifierName": "a" - }, + "start":2,"end":3,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":3},"identifierName":"a"}, "name": "a" }, "extra": { @@ -133,84 +43,26 @@ }, { "type": "ObjectProperty", - "start": 4, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":4,"end":7,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":7}}, "method": false, "key": { "type": "Identifier", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "b" - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"b"}, "name": "b" }, "computed": false, "shorthand": true, "value": { "type": "AssignmentPattern", - "start": 4, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":4,"end":7,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":7}}, "left": { "type": "Identifier", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "b" - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"b"}, "name": "b" }, "right": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "b" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"b"}, "name": "b" } }, @@ -220,120 +72,39 @@ }, { "type": "ObjectProperty", - "start": 8, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":8,"end":11,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":11}}, "method": false, "key": { "type": "Identifier", - "start": 8, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "a" - }, + "start":8,"end":9,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":9},"identifierName":"a"}, "name": "a" }, "computed": false, "shorthand": false, "value": { "type": "Identifier", - "start": 10, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "c" - }, + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11},"identifierName":"c"}, "name": "c" } }, { "type": "ObjectProperty", - "start": 12, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":12,"end":19,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":19}}, "method": false, "computed": true, "key": { "type": "Identifier", - "start": 13, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - }, - "identifierName": "a" - }, + "start":13,"end":14,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":14},"identifierName":"a"}, "name": "a" }, "shorthand": false, "value": { "type": "ArrayPattern", - "start": 16, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":16,"end":19,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":19}}, "elements": [ { "type": "Identifier", - "start": 17, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - }, - "identifierName": "d" - }, + "start":17,"end":18,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":18},"identifierName":"d"}, "name": "d" } ] @@ -344,18 +115,7 @@ ], "body": { "type": "NumericLiteral", - "start": 23, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":23,"end":24,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":24}}, "extra": { "rawValue": 0, "raw": "0" diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/object-binding-pattern-empty/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/object-binding-pattern-empty/output.json index 6a745736a149..3e49f877b65d 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/object-binding-pattern-empty/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/object-binding-pattern-empty/output.json @@ -1,97 +1,31 @@ { "type": "File", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, "program": { "type": "Program", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, "expression": { "type": "ArrowFunctionExpression", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "id": null, "generator": false, "async": false, "params": [ { "type": "ObjectPattern", - "start": 1, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 3 - } - }, + "start":1,"end":3,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":3}}, "properties": [] } ], "body": { "type": "NumericLiteral", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7}}, "extra": { "rawValue": 0, "raw": "0" diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/object-binding-pattern-invalid-member-expr/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/object-binding-pattern-invalid-member-expr/options.json deleted file mode 100644 index bf0f292caad2..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/object-binding-pattern-invalid-member-expr/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid left-hand side in object destructuring pattern (1:4)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/object-binding-pattern-invalid-member-expr/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/object-binding-pattern-invalid-member-expr/output.json new file mode 100644 index 000000000000..2bdcc96c2d26 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/object-binding-pattern-invalid-member-expr/output.json @@ -0,0 +1,75 @@ +{ + "type": "File", + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "errors": [ + "SyntaxError: Binding member expression (1:4)" + ], + "program": { + "type": "Program", + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "expression": { + "type": "ArrowFunctionExpression", + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "ObjectPattern", + "start":1,"end":9,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":9}}, + "properties": [ + { + "type": "ObjectProperty", + "start":2,"end":8,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":8}}, + "method": false, + "key": { + "type": "Identifier", + "start":2,"end":3,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":3},"identifierName":"a"}, + "name": "a" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "MemberExpression", + "start":4,"end":8,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":8}}, + "object": { + "type": "Identifier", + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"b"}, + "name": "b" + }, + "property": { + "type": "NumericLiteral", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7}}, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + }, + "computed": true + } + } + ] + } + ], + "body": { + "type": "NumericLiteral", + "start":12,"end":13,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":13}}, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/object-binding-pattern-invalid-method-in-pattern/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/object-binding-pattern-invalid-method-in-pattern/options.json deleted file mode 100644 index 559cc4e11a41..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/object-binding-pattern-invalid-method-in-pattern/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Object pattern can't contain getter or setter (1:6)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/object-binding-pattern-invalid-method-in-pattern/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/object-binding-pattern-invalid-method-in-pattern/output.json new file mode 100644 index 000000000000..55af5740543d --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/object-binding-pattern-invalid-method-in-pattern/output.json @@ -0,0 +1,66 @@ +{ + "type": "File", + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, + "errors": [ + "SyntaxError: Object pattern can't contain getter or setter (1:6)" + ], + "program": { + "type": "Program", + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, + "expression": { + "type": "ArrowFunctionExpression", + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "ObjectPattern", + "start":1,"end":12,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":12}}, + "properties": [ + { + "type": "ObjectMethod", + "start":2,"end":11,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":11}}, + "method": false, + "key": { + "type": "Identifier", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"a"}, + "name": "a" + }, + "computed": false, + "kind": "get", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":9,"end":11,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":11}}, + "body": [], + "directives": [] + } + } + ] + } + ], + "body": { + "type": "NumericLiteral", + "start":17,"end":18,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":18}}, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/object-binding-pattern-invalid-nested-param/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/object-binding-pattern-invalid-nested-param/options.json deleted file mode 100644 index 30f209db8f07..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/object-binding-pattern-invalid-nested-param/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid left-hand side in object destructuring pattern (1:24)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/object-binding-pattern-invalid-nested-param/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/object-binding-pattern-invalid-nested-param/output.json new file mode 100644 index 000000000000..cb2922c87ca7 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/object-binding-pattern-invalid-nested-param/output.json @@ -0,0 +1,195 @@ +{ + "type": "File", + "start":0,"end":54,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":54}}, + "errors": [ + "SyntaxError: Binding member expression (1:24)" + ], + "program": { + "type": "Program", + "start":0,"end":54,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":54}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":54,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":54}}, + "expression": { + "type": "ArrowFunctionExpression", + "start":0,"end":53,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":53}}, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "ArrayPattern", + "start":1,"end":49,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":49}}, + "elements": [ + { + "type": "ArrayPattern", + "start":2,"end":48,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":48}}, + "elements": [ + { + "type": "ArrayPattern", + "start":3,"end":47,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":47}}, + "elements": [ + { + "type": "ArrayPattern", + "start":4,"end":46,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":46}}, + "elements": [ + { + "type": "ArrayPattern", + "start":5,"end":45,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":45}}, + "elements": [ + { + "type": "ArrayPattern", + "start":6,"end":44,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":44}}, + "elements": [ + { + "type": "ArrayPattern", + "start":7,"end":43,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":43}}, + "elements": [ + { + "type": "ArrayPattern", + "start":8,"end":42,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":42}}, + "elements": [ + { + "type": "ArrayPattern", + "start":9,"end":41,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":41}}, + "elements": [ + { + "type": "ArrayPattern", + "start":10,"end":40,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":40}}, + "elements": [ + { + "type": "ArrayPattern", + "start":11,"end":39,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":39}}, + "elements": [ + { + "type": "ArrayPattern", + "start":12,"end":38,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":38}}, + "elements": [ + { + "type": "ArrayPattern", + "start":13,"end":37,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":37}}, + "elements": [ + { + "type": "ArrayPattern", + "start":14,"end":36,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":36}}, + "elements": [ + { + "type": "ArrayPattern", + "start":15,"end":35,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":35}}, + "elements": [ + { + "type": "ArrayPattern", + "start":16,"end":34,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":34}}, + "elements": [ + { + "type": "ArrayPattern", + "start":17,"end":33,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":33}}, + "elements": [ + { + "type": "ArrayPattern", + "start":18,"end":32,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":32}}, + "elements": [ + { + "type": "ArrayPattern", + "start":19,"end":31,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":31}}, + "elements": [ + { + "type": "ArrayPattern", + "start":20,"end":30,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":30}}, + "elements": [ + { + "type": "ObjectPattern", + "start":21,"end":29,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":29}}, + "properties": [ + { + "type": "ObjectProperty", + "start":22,"end":28,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":28}}, + "method": false, + "key": { + "type": "Identifier", + "start":22,"end":23,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":23},"identifierName":"a"}, + "name": "a" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "MemberExpression", + "start":24,"end":28,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":28}}, + "object": { + "type": "Identifier", + "start":24,"end":25,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":25},"identifierName":"b"}, + "name": "b" + }, + "property": { + "type": "NumericLiteral", + "start":26,"end":27,"loc":{"start":{"line":1,"column":26},"end":{"line":1,"column":27}}, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + }, + "computed": true + } + } + ] + } + ] + } + ] + } + ] + } + ] + } + ] + } + ] + } + ] + } + ] + } + ] + } + ] + } + ] + } + ] + } + ] + } + ] + } + ] + } + ] + } + ] + } + ] + } + ] + } + ] + } + ], + "body": { + "type": "NumericLiteral", + "start":52,"end":53,"loc":{"start":{"line":1,"column":52},"end":{"line":1,"column":53}}, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/object-binding-pattern-invalid-rest-in-object-pattern/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/object-binding-pattern-invalid-rest-in-object-pattern/output.json index 7061f23c0fb3..eae114c7aece 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/object-binding-pattern-invalid-rest-in-object-pattern/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/object-binding-pattern-invalid-rest-in-object-pattern/output.json @@ -1,130 +1,40 @@ { "type": "File", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "program": { "type": "Program", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "expression": { "type": "ArrowFunctionExpression", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "id": null, "generator": false, "async": false, "params": [ { "type": "ObjectPattern", - "start": 1, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":1,"end":9,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":9}}, "properties": [ { "type": "ObjectProperty", - "start": 2, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 3 - } - }, + "start":2,"end":3,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":3}}, "method": false, "key": { "type": "Identifier", - "start": 2, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 3 - }, - "identifierName": "a" - }, + "start":2,"end":3,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":3},"identifierName":"a"}, "name": "a" }, "computed": false, "shorthand": true, "value": { "type": "Identifier", - "start": 2, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 3 - }, - "identifierName": "a" - }, + "start":2,"end":3,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":3},"identifierName":"a"}, "name": "a" }, "extra": { @@ -133,33 +43,10 @@ }, { "type": "RestElement", - "start": 4, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":4,"end":8,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":8}}, "argument": { "type": "Identifier", - "start": 7, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - }, - "identifierName": "b" - }, + "start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8},"identifierName":"b"}, "name": "b" } } @@ -168,18 +55,7 @@ ], "body": { "type": "NumericLiteral", - "start": 14, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":14,"end":15,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":15}}, "extra": { "rawValue": 0, "raw": "0" diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/object-binding-pattern-nested-cover-grammar/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/object-binding-pattern-nested-cover-grammar/output.json index 81e10cda57c0..f61835740a29 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/object-binding-pattern-nested-cover-grammar/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/object-binding-pattern-nested-cover-grammar/output.json @@ -1,461 +1,128 @@ { "type": "File", - "start": 0, - "end": 51, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 51 - } - }, + "start":0,"end":51,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":51}}, "program": { "type": "Program", - "start": 0, - "end": 51, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 51 - } - }, + "start":0,"end":51,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":51}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 51, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 51 - } - }, + "start":0,"end":51,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":51}}, "expression": { "type": "ArrowFunctionExpression", - "start": 0, - "end": 50, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 50 - } - }, + "start":0,"end":50,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":50}}, "id": null, "generator": false, "async": false, "params": [ { "type": "ArrayPattern", - "start": 1, - "end": 46, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 46 - } - }, + "start":1,"end":46,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":46}}, "elements": [ { "type": "ArrayPattern", - "start": 2, - "end": 45, - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 45 - } - }, + "start":2,"end":45,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":45}}, "elements": [ { "type": "ArrayPattern", - "start": 3, - "end": 44, - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 44 - } - }, + "start":3,"end":44,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":44}}, "elements": [ { "type": "ArrayPattern", - "start": 4, - "end": 43, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 43 - } - }, + "start":4,"end":43,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":43}}, "elements": [ { "type": "ArrayPattern", - "start": 5, - "end": 42, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 42 - } - }, + "start":5,"end":42,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":42}}, "elements": [ { "type": "ArrayPattern", - "start": 6, - "end": 41, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 41 - } - }, + "start":6,"end":41,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":41}}, "elements": [ { "type": "ArrayPattern", - "start": 7, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 40 - } - }, + "start":7,"end":40,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":40}}, "elements": [ { "type": "ArrayPattern", - "start": 8, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 39 - } - }, + "start":8,"end":39,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":39}}, "elements": [ { "type": "ArrayPattern", - "start": 9, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":9,"end":38,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":38}}, "elements": [ { "type": "ArrayPattern", - "start": 10, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 37 - } - }, + "start":10,"end":37,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":37}}, "elements": [ { "type": "ArrayPattern", - "start": 11, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":11,"end":36,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":36}}, "elements": [ { "type": "ArrayPattern", - "start": 12, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":12,"end":35,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":35}}, "elements": [ { "type": "ArrayPattern", - "start": 13, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":13,"end":34,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":34}}, "elements": [ { "type": "ArrayPattern", - "start": 14, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":14,"end":33,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":33}}, "elements": [ { "type": "ArrayPattern", - "start": 15, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":15,"end":32,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":32}}, "elements": [ { "type": "ArrayPattern", - "start": 16, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":16,"end":31,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":31}}, "elements": [ { "type": "ArrayPattern", - "start": 17, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":17,"end":30,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":30}}, "elements": [ { "type": "ArrayPattern", - "start": 18, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":18,"end":29,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":29}}, "elements": [ { "type": "ArrayPattern", - "start": 19, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":19,"end":28,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":28}}, "elements": [ { "type": "ArrayPattern", - "start": 20, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":20,"end":27,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":27}}, "elements": [ { "type": "ObjectPattern", - "start": 21, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":21,"end":26,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":26}}, "properties": [ { "type": "ObjectProperty", - "start": 22, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":22,"end":25,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":25}}, "method": false, "key": { "type": "Identifier", - "start": 22, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 23 - }, - "identifierName": "a" - }, + "start":22,"end":23,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":23},"identifierName":"a"}, "name": "a" }, "computed": false, "shorthand": true, "value": { "type": "AssignmentPattern", - "start": 22, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":22,"end":25,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":25}}, "left": { "type": "Identifier", - "start": 22, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 23 - }, - "identifierName": "a" - }, + "start":22,"end":23,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":23},"identifierName":"a"}, "name": "a" }, "right": { "type": "Identifier", - "start": 24, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 25 - }, - "identifierName": "b" - }, + "start":24,"end":25,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":25},"identifierName":"b"}, "name": "b" } }, @@ -508,18 +175,7 @@ ], "body": { "type": "NumericLiteral", - "start": 49, - "end": 50, - "loc": { - "start": { - "line": 1, - "column": 49 - }, - "end": { - "line": 1, - "column": 50 - } - }, + "start":49,"end":50,"loc":{"start":{"line":1,"column":49},"end":{"line":1,"column":50}}, "extra": { "rawValue": 0, "raw": "0" diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-binary-integer-literal/migrated_0000/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-binary-integer-literal/migrated_0000/output.json index c252371102a6..3190f75a5f5f 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-binary-integer-literal/migrated_0000/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-binary-integer-literal/migrated_0000/output.json @@ -1,62 +1,18 @@ { "type": "File", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, "program": { "type": "Program", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, "expression": { "type": "NumericLiteral", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, "extra": { "rawValue": 0, "raw": "0b0" diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-binary-integer-literal/migrated_0001/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-binary-integer-literal/migrated_0001/output.json index 4cf5cc60dfe5..ce6d2c2cf9dc 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-binary-integer-literal/migrated_0001/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-binary-integer-literal/migrated_0001/output.json @@ -1,62 +1,18 @@ { "type": "File", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, "program": { "type": "Program", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, "expression": { "type": "NumericLiteral", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, "extra": { "rawValue": 1, "raw": "0b1" diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-binary-integer-literal/migrated_0002/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-binary-integer-literal/migrated_0002/output.json index 9a7364a78aaf..2b17ce385b89 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-binary-integer-literal/migrated_0002/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-binary-integer-literal/migrated_0002/output.json @@ -1,62 +1,18 @@ { "type": "File", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - }, + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, "program": { "type": "Program", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - }, + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - }, + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, "expression": { "type": "NumericLiteral", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - }, + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, "extra": { "rawValue": 2, "raw": "0b10" diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-binary-integer-literal/migrated_0003/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-binary-integer-literal/migrated_0003/output.json index 33bb1b2a0ac0..c0f3390f5c0c 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-binary-integer-literal/migrated_0003/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-binary-integer-literal/migrated_0003/output.json @@ -1,62 +1,18 @@ { "type": "File", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, "program": { "type": "Program", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, "expression": { "type": "NumericLiteral", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, "extra": { "rawValue": 0, "raw": "0B0" diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-binary-integer-literal/migrated_0004/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-binary-integer-literal/migrated_0004/output.json index 39761f3e94b0..cba05164a592 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-binary-integer-literal/migrated_0004/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-binary-integer-literal/migrated_0004/output.json @@ -1,62 +1,18 @@ { "type": "File", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, "program": { "type": "Program", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, "expression": { "type": "NumericLiteral", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, "extra": { "rawValue": 1, "raw": "0B1" diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-binary-integer-literal/migrated_0005/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-binary-integer-literal/migrated_0005/output.json index ea337678ef18..db98ac55e253 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-binary-integer-literal/migrated_0005/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-binary-integer-literal/migrated_0005/output.json @@ -1,62 +1,18 @@ { "type": "File", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - }, + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, "program": { "type": "Program", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - }, + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - }, + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, "expression": { "type": "NumericLiteral", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - }, + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, "extra": { "rawValue": 2, "raw": "0B10" diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-class/migrated_0000/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-class/migrated_0000/output.json index e0a1cd35bf2d..60e9af204817 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-class/migrated_0000/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-class/migrated_0000/output.json @@ -1,80 +1,24 @@ { "type": "File", - "start": 0, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, "program": { "type": "Program", - "start": 0, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, "id": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "A" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, "name": "A" }, "superClass": null, "body": { "type": "ClassBody", - "start": 8, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":8,"end":10,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":10}}, "body": [] } } diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-class/migrated_0001/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-class/migrated_0001/output.json index e9f7e48176cd..6b4cbe003a11 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-class/migrated_0001/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-class/migrated_0001/output.json @@ -1,79 +1,23 @@ { "type": "File", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, "program": { "type": "Program", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, "id": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "A" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, "name": "A" }, "superClass": { "type": "NumericLiteral", - "start": 16, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":16,"end":17,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":17}}, "extra": { "rawValue": 0, "raw": "0" @@ -82,18 +26,7 @@ }, "body": { "type": "ClassBody", - "start": 18, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":18,"end":20,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":20}}, "body": [] } } diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-class/migrated_0002/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-class/migrated_0002/output.json index affcbae43094..7620949ebb40 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-class/migrated_0002/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-class/migrated_0002/output.json @@ -1,80 +1,24 @@ { "type": "File", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "program": { "type": "Program", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "id": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "A" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, "name": "A" }, "superClass": null, "body": { "type": "ClassBody", - "start": 8, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":8,"end":11,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":11}}, "body": [] } } diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-class/migrated_0003/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-class/migrated_0003/output.json index c9662fc16e5d..a0317edfc83c 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-class/migrated_0003/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-class/migrated_0003/output.json @@ -1,80 +1,24 @@ { "type": "File", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, "program": { "type": "Program", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, "id": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "A" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, "name": "A" }, "superClass": null, "body": { "type": "ClassBody", - "start": 8, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":8,"end":12,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":12}}, "body": [] } } diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-class/migrated_0004/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-class/migrated_0004/output.json index f8723468bd20..2bfde2ea57c6 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-class/migrated_0004/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-class/migrated_0004/output.json @@ -1,111 +1,32 @@ { "type": "File", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "program": { "type": "Program", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "id": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "A" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, "name": "A" }, "superClass": null, "body": { "type": "ClassBody", - "start": 8, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":8,"end":15,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":15}}, "body": [ { "type": "ClassMethod", - "start": 9, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":9,"end":14,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":14}}, "static": false, "key": { "type": "Identifier", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - }, - "identifierName": "a" - }, + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"a"}, "name": "a" }, "computed": false, @@ -116,18 +37,7 @@ "params": [], "body": { "type": "BlockStatement", - "start": 12, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":12,"end":14,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":14}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-class/migrated_0005/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-class/migrated_0005/output.json index d1b7ccb7f88a..4af9a181287b 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-class/migrated_0005/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-class/migrated_0005/output.json @@ -1,111 +1,32 @@ { "type": "File", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, "program": { "type": "Program", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, "id": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "A" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, "name": "A" }, "superClass": null, "body": { "type": "ClassBody", - "start": 8, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":8,"end":20,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":20}}, "body": [ { "type": "ClassMethod", - "start": 9, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":9,"end":14,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":14}}, "static": false, "key": { "type": "Identifier", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - }, - "identifierName": "a" - }, + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"a"}, "name": "a" }, "computed": false, @@ -116,52 +37,18 @@ "params": [], "body": { "type": "BlockStatement", - "start": 12, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":12,"end":14,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":14}}, "body": [], "directives": [] } }, { "type": "ClassMethod", - "start": 14, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":14,"end":19,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":19}}, "static": false, "key": { "type": "Identifier", - "start": 14, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - }, - "identifierName": "b" - }, + "start":14,"end":15,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":15},"identifierName":"b"}, "name": "b" }, "computed": false, @@ -172,18 +59,7 @@ "params": [], "body": { "type": "BlockStatement", - "start": 17, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":17,"end":19,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":19}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-class/migrated_0006/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-class/migrated_0006/output.json index 05b83780ebe7..0d6a432ca731 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-class/migrated_0006/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-class/migrated_0006/output.json @@ -1,111 +1,32 @@ { "type": "File", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, "program": { "type": "Program", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, "id": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "A" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, "name": "A" }, "superClass": null, "body": { "type": "ClassBody", - "start": 8, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":8,"end":21,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":21}}, "body": [ { "type": "ClassMethod", - "start": 9, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":9,"end":14,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":14}}, "static": false, "key": { "type": "Identifier", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - }, - "identifierName": "a" - }, + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"a"}, "name": "a" }, "computed": false, @@ -116,52 +37,18 @@ "params": [], "body": { "type": "BlockStatement", - "start": 12, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":12,"end":14,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":14}}, "body": [], "directives": [] } }, { "type": "ClassMethod", - "start": 15, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":15,"end":20,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":20}}, "static": false, "key": { "type": "Identifier", - "start": 15, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - }, - "identifierName": "b" - }, + "start":15,"end":16,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":16},"identifierName":"b"}, "name": "b" }, "computed": false, @@ -172,18 +59,7 @@ "params": [], "body": { "type": "BlockStatement", - "start": 18, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":18,"end":20,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":20}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-class/migrated_0007/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-class/migrated_0007/output.json index ad258e950568..c8e915a8b062 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-class/migrated_0007/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-class/migrated_0007/output.json @@ -1,111 +1,32 @@ { "type": "File", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "program": { "type": "Program", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "id": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "A" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, "name": "A" }, "superClass": null, "body": { "type": "ClassBody", - "start": 8, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":8,"end":22,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":22}}, "body": [ { "type": "ClassMethod", - "start": 9, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":9,"end":14,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":14}}, "static": false, "key": { "type": "Identifier", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - }, - "identifierName": "a" - }, + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"a"}, "name": "a" }, "computed": false, @@ -116,52 +37,18 @@ "params": [], "body": { "type": "BlockStatement", - "start": 12, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":12,"end":14,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":14}}, "body": [], "directives": [] } }, { "type": "ClassMethod", - "start": 15, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":15,"end":20,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":20}}, "static": false, "key": { "type": "Identifier", - "start": 15, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - }, - "identifierName": "b" - }, + "start":15,"end":16,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":16},"identifierName":"b"}, "name": "b" }, "computed": false, @@ -172,18 +59,7 @@ "params": [], "body": { "type": "BlockStatement", - "start": 18, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":18,"end":20,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":20}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-class/migrated_0008/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-class/migrated_0008/output.json index cfe130ffbfb4..333db551c2a3 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-class/migrated_0008/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-class/migrated_0008/output.json @@ -1,111 +1,32 @@ { "type": "File", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "program": { "type": "Program", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "id": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "A" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, "name": "A" }, "superClass": null, "body": { "type": "ClassBody", - "start": 8, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":8,"end":23,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":23}}, "body": [ { "type": "ClassMethod", - "start": 10, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":10,"end":15,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":15}}, "static": false, "key": { "type": "Identifier", - "start": 10, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "a" - }, + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11},"identifierName":"a"}, "name": "a" }, "computed": false, @@ -116,52 +37,18 @@ "params": [], "body": { "type": "BlockStatement", - "start": 13, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":13,"end":15,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":15}}, "body": [], "directives": [] } }, { "type": "ClassMethod", - "start": 16, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":16,"end":21,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":21}}, "static": false, "key": { "type": "Identifier", - "start": 16, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - }, - "identifierName": "b" - }, + "start":16,"end":17,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":17},"identifierName":"b"}, "name": "b" }, "computed": false, @@ -172,18 +59,7 @@ "params": [], "body": { "type": "BlockStatement", - "start": 19, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":19,"end":21,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":21}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-class/migrated_0009/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-class/migrated_0009/output.json index 883a08030f79..174b9e59a078 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-class/migrated_0009/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-class/migrated_0009/output.json @@ -1,112 +1,33 @@ { "type": "File", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, "program": { "type": "Program", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, "id": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "A" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, "name": "A" }, "superClass": null, "body": { "type": "ClassBody", - "start": 8, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":8,"end":21,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":21}}, "body": [ { "type": "ClassMethod", - "start": 9, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":9,"end":19,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":19}}, "kind": "method", "computed": false, "key": { "type": "Identifier", - "start": 9, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 15 - }, - "identifierName": "static" - }, + "start":9,"end":15,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":15},"identifierName":"static"}, "name": "static" }, "static": false, @@ -116,18 +37,7 @@ "params": [], "body": { "type": "BlockStatement", - "start": 17, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":17,"end":19,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":19}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-class/migrated_0010/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-class/migrated_0010/output.json index 29a9d118b412..d45546f7fa53 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-class/migrated_0010/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-class/migrated_0010/output.json @@ -1,111 +1,32 @@ { "type": "File", - "start": 0, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, "program": { "type": "Program", - "start": 0, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, "id": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "A" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, "name": "A" }, "superClass": null, "body": { "type": "ClassBody", - "start": 8, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":8,"end":31,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":31}}, "body": [ { "type": "ClassMethod", - "start": 9, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":9,"end":18,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":18}}, "static": false, "key": { "type": "Identifier", - "start": 13, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - }, - "identifierName": "a" - }, + "start":13,"end":14,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":14},"identifierName":"a"}, "name": "a" }, "computed": false, @@ -116,52 +37,18 @@ "params": [], "body": { "type": "BlockStatement", - "start": 16, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":16,"end":18,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":18}}, "body": [], "directives": [] } }, { "type": "ClassMethod", - "start": 19, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":19,"end":29,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":29}}, "static": false, "key": { "type": "Identifier", - "start": 23, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 24 - }, - "identifierName": "b" - }, + "start":23,"end":24,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":24},"identifierName":"b"}, "name": "b" }, "computed": false, @@ -172,36 +59,13 @@ "params": [ { "type": "Identifier", - "start": 25, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 26 - }, - "identifierName": "c" - }, + "start":25,"end":26,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":26},"identifierName":"c"}, "name": "c" } ], "body": { "type": "BlockStatement", - "start": 27, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":27,"end":29,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":29}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-class/migrated_0011/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-class/migrated_0011/output.json index 9e63dfdcd658..5f649b7d17a3 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-class/migrated_0011/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-class/migrated_0011/output.json @@ -1,111 +1,32 @@ { "type": "File", - "start": 0, - "end": 58, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 58 - } - }, + "start":0,"end":58,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":58}}, "program": { "type": "Program", - "start": 0, - "end": 58, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 58 - } - }, + "start":0,"end":58,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":58}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 58, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 58 - } - }, + "start":0,"end":58,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":58}}, "id": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "A" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, "name": "A" }, "superClass": null, "body": { "type": "ClassBody", - "start": 8, - "end": 58, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 58 - } - }, + "start":8,"end":58,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":58}}, "body": [ { "type": "ClassMethod", - "start": 9, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":9,"end":21,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":21}}, "static": true, "key": { "type": "Identifier", - "start": 16, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - }, - "identifierName": "a" - }, + "start":16,"end":17,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":17},"identifierName":"a"}, "name": "a" }, "computed": false, @@ -116,52 +37,18 @@ "params": [], "body": { "type": "BlockStatement", - "start": 19, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":19,"end":21,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":21}}, "body": [], "directives": [] } }, { "type": "ClassMethod", - "start": 22, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":22,"end":38,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":38}}, "static": true, "key": { "type": "Identifier", - "start": 33, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 33 - }, - "end": { - "line": 1, - "column": 34 - }, - "identifierName": "a" - }, + "start":33,"end":34,"loc":{"start":{"line":1,"column":33},"end":{"line":1,"column":34},"identifierName":"a"}, "name": "a" }, "computed": false, @@ -172,52 +59,18 @@ "params": [], "body": { "type": "BlockStatement", - "start": 36, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 36 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":36,"end":38,"loc":{"start":{"line":1,"column":36},"end":{"line":1,"column":38}}, "body": [], "directives": [] } }, { "type": "ClassMethod", - "start": 39, - "end": 56, - "loc": { - "start": { - "line": 1, - "column": 39 - }, - "end": { - "line": 1, - "column": 56 - } - }, + "start":39,"end":56,"loc":{"start":{"line":1,"column":39},"end":{"line":1,"column":56}}, "static": true, "key": { "type": "Identifier", - "start": 50, - "end": 51, - "loc": { - "start": { - "line": 1, - "column": 50 - }, - "end": { - "line": 1, - "column": 51 - }, - "identifierName": "a" - }, + "start":50,"end":51,"loc":{"start":{"line":1,"column":50},"end":{"line":1,"column":51},"identifierName":"a"}, "name": "a" }, "computed": false, @@ -228,36 +81,13 @@ "params": [ { "type": "Identifier", - "start": 52, - "end": 53, - "loc": { - "start": { - "line": 1, - "column": 52 - }, - "end": { - "line": 1, - "column": 53 - }, - "identifierName": "b" - }, + "start":52,"end":53,"loc":{"start":{"line":1,"column":52},"end":{"line":1,"column":53},"identifierName":"b"}, "name": "b" } ], "body": { "type": "BlockStatement", - "start": 54, - "end": 56, - "loc": { - "start": { - "line": 1, - "column": 54 - }, - "end": { - "line": 1, - "column": 56 - } - }, + "start":54,"end":56,"loc":{"start":{"line":1,"column":54},"end":{"line":1,"column":56}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-class/migrated_0012/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-class/migrated_0012/output.json index 7f90fed606ce..986bcdfa2b8a 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-class/migrated_0012/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-class/migrated_0012/output.json @@ -1,111 +1,32 @@ { "type": "File", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "program": { "type": "Program", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "id": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "A" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, "name": "A" }, "superClass": null, "body": { "type": "ClassBody", - "start": 8, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":8,"end":23,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":23}}, "body": [ { "type": "ClassMethod", - "start": 9, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":9,"end":21,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":21}}, "static": true, "key": { "type": "Identifier", - "start": 16, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - }, - "identifierName": "a" - }, + "start":16,"end":17,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":17},"identifierName":"a"}, "name": "a" }, "computed": false, @@ -116,18 +37,7 @@ "params": [], "body": { "type": "BlockStatement", - "start": 19, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":19,"end":21,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":21}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-class/migrated_0013/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-class/migrated_0013/output.json index 0d381454d56f..32100b8de396 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-class/migrated_0013/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-class/migrated_0013/output.json @@ -1,112 +1,33 @@ { "type": "File", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, "program": { "type": "Program", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, "id": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "A" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, "name": "A" }, "superClass": null, "body": { "type": "ClassBody", - "start": 8, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":8,"end":25,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":25}}, "body": [ { "type": "ClassMethod", - "start": 9, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":9,"end":23,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":23}}, "static": true, "computed": true, "key": { "type": "Identifier", - "start": 17, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - }, - "identifierName": "a" - }, + "start":17,"end":18,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":18},"identifierName":"a"}, "name": "a" }, "kind": "method", @@ -116,18 +37,7 @@ "params": [], "body": { "type": "BlockStatement", - "start": 21, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":21,"end":23,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":23}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-class/migrated_0014/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-class/migrated_0014/output.json index 99de476125cb..ac3916d37081 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-class/migrated_0014/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-class/migrated_0014/output.json @@ -1,112 +1,33 @@ { "type": "File", - "start": 0, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":38}}, "program": { "type": "Program", - "start": 0, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":38}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":38}}, "id": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "A" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, "name": "A" }, "superClass": null, "body": { "type": "ClassBody", - "start": 8, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":8,"end":38,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":38}}, "body": [ { "type": "ClassMethod", - "start": 9, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":9,"end":22,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":22}}, "static": true, "computed": true, "key": { "type": "Identifier", - "start": 16, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - }, - "identifierName": "a" - }, + "start":16,"end":17,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":17},"identifierName":"a"}, "name": "a" }, "kind": "method", @@ -116,53 +37,19 @@ "params": [], "body": { "type": "BlockStatement", - "start": 20, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":20,"end":22,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":22}}, "body": [], "directives": [] } }, { "type": "ClassMethod", - "start": 24, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 37 - } - }, + "start":24,"end":37,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":37}}, "static": true, "computed": true, "key": { "type": "Identifier", - "start": 31, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 31 - }, - "end": { - "line": 1, - "column": 32 - }, - "identifierName": "b" - }, + "start":31,"end":32,"loc":{"start":{"line":1,"column":31},"end":{"line":1,"column":32},"identifierName":"b"}, "name": "b" }, "kind": "method", @@ -172,18 +59,7 @@ "params": [], "body": { "type": "BlockStatement", - "start": 35, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 35 - }, - "end": { - "line": 1, - "column": 37 - } - }, + "start":35,"end":37,"loc":{"start":{"line":1,"column":35},"end":{"line":1,"column":37}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-class/migrated_0015/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-class/migrated_0015/output.json index 44b77f49f1fe..5914e8c3631a 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-class/migrated_0015/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-class/migrated_0015/output.json @@ -1,111 +1,32 @@ { "type": "File", - "start": 0, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, "program": { "type": "Program", - "start": 0, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, "id": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "A" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, "name": "A" }, "superClass": null, "body": { "type": "ClassBody", - "start": 8, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":8,"end":28,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":28}}, "body": [ { "type": "ClassMethod", - "start": 9, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":9,"end":26,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":26}}, "static": true, "key": { "type": "Identifier", - "start": 16, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 22 - }, - "identifierName": "static" - }, + "start":16,"end":22,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":22},"identifierName":"static"}, "name": "static" }, "computed": false, @@ -116,18 +37,7 @@ "params": [], "body": { "type": "BlockStatement", - "start": 24, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":24,"end":26,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":26}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-class/migrated_0016/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-class/migrated_0016/output.json index ef8d19db2271..3accea13037a 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-class/migrated_0016/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-class/migrated_0016/output.json @@ -1,125 +1,35 @@ { "type": "File", - "start": 0, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, "program": { "type": "Program", - "start": 0, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":4,"end":27,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":27}}, "id": { "type": "Identifier", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "x" - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"x"}, "name": "x" }, "init": { "type": "ClassExpression", - "start": 8, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":8,"end":27,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":27}}, "id": { "type": "Identifier", - "start": 14, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - }, - "identifierName": "A" - }, + "start":14,"end":15,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":15},"identifierName":"A"}, "name": "A" }, "superClass": { "type": "NumericLiteral", - "start": 24, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":24,"end":25,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":25}}, "extra": { "rawValue": 0, "raw": "0" @@ -128,18 +38,7 @@ }, "body": { "type": "ClassBody", - "start": 25, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":25,"end":27,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":27}}, "body": [] } } diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-class/migrated_0017/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-class/migrated_0017/output.json index b873f53f35af..7f4c674fde17 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-class/migrated_0017/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-class/migrated_0017/output.json @@ -1,111 +1,32 @@ { "type": "File", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "program": { "type": "Program", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "id": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "A" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, "name": "A" }, "superClass": null, "body": { "type": "ClassBody", - "start": 8, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":8,"end":23,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":23}}, "body": [ { "type": "ClassMethod", - "start": 9, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":9,"end":22,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":22}}, "static": false, "key": { "type": "Identifier", - "start": 9, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 18 - }, - "identifierName": "prototype" - }, + "start":9,"end":18,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":18},"identifierName":"prototype"}, "name": "prototype" }, "computed": false, @@ -116,18 +37,7 @@ "params": [], "body": { "type": "BlockStatement", - "start": 20, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":20,"end":22,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":22}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-class/migrated_0018/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-class/migrated_0018/output.json index 3d629ecba383..2f5ad3c90740 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-class/migrated_0018/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-class/migrated_0018/output.json @@ -1,111 +1,32 @@ { "type": "File", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, "program": { "type": "Program", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, "id": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "A" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, "name": "A" }, "superClass": null, "body": { "type": "ClassBody", - "start": 8, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":8,"end":25,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":25}}, "body": [ { "type": "ClassMethod", - "start": 9, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":9,"end":24,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":24}}, "static": false, "key": { "type": "Identifier", - "start": 9, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 20 - }, - "identifierName": "constructor" - }, + "start":9,"end":20,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":20},"identifierName":"constructor"}, "name": "constructor" }, "computed": false, @@ -116,18 +37,7 @@ "params": [], "body": { "type": "BlockStatement", - "start": 22, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":22,"end":24,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":24}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-class/migrated_0019/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-class/migrated_0019/output.json index 2f04a27ec7ad..450831a85d47 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-class/migrated_0019/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-class/migrated_0019/output.json @@ -1,110 +1,32 @@ { "type": "File", - "start": 0, - "end": 47, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 47 - } - }, + "start":0,"end":47,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":47}}, "program": { "type": "Program", - "start": 0, - "end": 47, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 47 - } - }, + "start":0,"end":47,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":47}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 47, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 47 - } - }, + "start":0,"end":47,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":47}}, "id": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "A" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, "name": "A" }, "superClass": null, "body": { "type": "ClassBody", - "start": 8, - "end": 47, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 47 - } - }, + "start":8,"end":47,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":47}}, "body": [ { "type": "ClassMethod", - "start": 9, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":9,"end":26,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":26}}, "static": false, "key": { "type": "StringLiteral", - "start": 9, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":9,"end":22,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":22}}, "extra": { "rawValue": "constructor", "raw": "\"constructor\"" @@ -119,52 +41,19 @@ "params": [], "body": { "type": "BlockStatement", - "start": 24, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":24,"end":26,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":26}}, "body": [], "directives": [] } }, { "type": "ClassMethod", - "start": 27, - "end": 46, - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 46 - } - }, + "start":27,"end":46,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":46}}, "static": false, "computed": true, "key": { "type": "StringLiteral", - "start": 28, - "end": 41, - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 41 - } - }, + "start":28,"end":41,"loc":{"start":{"line":1,"column":28},"end":{"line":1,"column":41}}, "extra": { "rawValue": "constructor", "raw": "\"constructor\"" @@ -178,18 +67,7 @@ "params": [], "body": { "type": "BlockStatement", - "start": 44, - "end": 46, - "loc": { - "start": { - "line": 1, - "column": 44 - }, - "end": { - "line": 1, - "column": 46 - } - }, + "start":44,"end":46,"loc":{"start":{"line":1,"column":44},"end":{"line":1,"column":46}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-class/migrated_0020/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-class/migrated_0020/output.json index d9e0aedd6a8f..14b2ac281ff5 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-class/migrated_0020/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-class/migrated_0020/output.json @@ -1,111 +1,32 @@ { "type": "File", - "start": 0, - "end": 55, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 55 - } - }, + "start":0,"end":55,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":55}}, "program": { "type": "Program", - "start": 0, - "end": 55, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 55 - } - }, + "start":0,"end":55,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":55}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 55, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 55 - } - }, + "start":0,"end":55,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":55}}, "id": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "A" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, "name": "A" }, "superClass": null, "body": { "type": "ClassBody", - "start": 8, - "end": 55, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 55 - } - }, + "start":8,"end":55,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":55}}, "body": [ { "type": "ClassMethod", - "start": 9, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":9,"end":31,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":31}}, "static": true, "key": { "type": "Identifier", - "start": 16, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 27 - }, - "identifierName": "constructor" - }, + "start":16,"end":27,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":27},"identifierName":"constructor"}, "name": "constructor" }, "computed": false, @@ -116,52 +37,18 @@ "params": [], "body": { "type": "BlockStatement", - "start": 29, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":29,"end":31,"loc":{"start":{"line":1,"column":29},"end":{"line":1,"column":31}}, "body": [], "directives": [] } }, { "type": "ClassMethod", - "start": 32, - "end": 54, - "loc": { - "start": { - "line": 1, - "column": 32 - }, - "end": { - "line": 1, - "column": 54 - } - }, + "start":32,"end":54,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":54}}, "static": true, "key": { "type": "Identifier", - "start": 39, - "end": 50, - "loc": { - "start": { - "line": 1, - "column": 39 - }, - "end": { - "line": 1, - "column": 50 - }, - "identifierName": "constructor" - }, + "start":39,"end":50,"loc":{"start":{"line":1,"column":39},"end":{"line":1,"column":50},"identifierName":"constructor"}, "name": "constructor" }, "computed": false, @@ -172,18 +59,7 @@ "params": [], "body": { "type": "BlockStatement", - "start": 52, - "end": 54, - "loc": { - "start": { - "line": 1, - "column": 52 - }, - "end": { - "line": 1, - "column": 54 - } - }, + "start":52,"end":54,"loc":{"start":{"line":1,"column":52},"end":{"line":1,"column":54}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-class/migrated_0021/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-class/migrated_0021/output.json index 6467ddd1af26..88d0ad2a09fa 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-class/migrated_0021/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-class/migrated_0021/output.json @@ -1,111 +1,33 @@ { "type": "File", - "start": 0, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, "program": { "type": "Program", - "start": 0, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, "id": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "A" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, "name": "A" }, "superClass": null, "body": { "type": "ClassBody", - "start": 8, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":8,"end":34,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":34}}, "body": [ { "type": "ClassMethod", - "start": 9, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":9,"end":33,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":33}}, "static": true, "computed": true, "key": { "type": "StringLiteral", - "start": 17, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":17,"end":28,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":28}}, "extra": { "rawValue": "prototype", "raw": "\"prototype\"" @@ -119,18 +41,7 @@ "params": [], "body": { "type": "BlockStatement", - "start": 31, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 31 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":31,"end":33,"loc":{"start":{"line":1,"column":31},"end":{"line":1,"column":33}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-class/migrated_0022/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-class/migrated_0022/output.json index 6eda12df85fd..3e4845f7a6a7 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-class/migrated_0022/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-class/migrated_0022/output.json @@ -1,78 +1,23 @@ { "type": "File", - "start": 0, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, "program": { "type": "Program", - "start": 0, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, "expression": { "type": "ClassExpression", - "start": 1, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":1,"end":9,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":9}}, "id": null, "superClass": null, "body": { "type": "ClassBody", - "start": 7, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":7,"end":9,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":9}}, "body": [] }, "extra": { diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-class/migrated_0023/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-class/migrated_0023/output.json index 6d0f936901f7..583264386a4c 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-class/migrated_0023/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-class/migrated_0023/output.json @@ -1,94 +1,27 @@ { "type": "File", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, "program": { "type": "Program", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, "expression": { "type": "ClassExpression", - "start": 1, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":1,"end":11,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":11}}, "id": { "type": "Identifier", - "start": 7, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - }, - "identifierName": "A" - }, + "start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8},"identifierName":"A"}, "name": "A" }, "superClass": null, "body": { "type": "ClassBody", - "start": 9, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":9,"end":11,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":11}}, "body": [] }, "extra": { diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-class/migrated_0024/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-class/migrated_0024/output.json index 954a44205fff..1ac9ff2484a5 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-class/migrated_0024/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-class/migrated_0024/output.json @@ -1,77 +1,22 @@ { "type": "File", - "start": 0, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, "program": { "type": "Program", - "start": 0, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, "expression": { "type": "ClassExpression", - "start": 1, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":1,"end":18,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":18}}, "id": null, "superClass": { "type": "NumericLiteral", - "start": 15, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":15,"end":16,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":16}}, "extra": { "rawValue": 0, "raw": "0" @@ -80,18 +25,7 @@ }, "body": { "type": "ClassBody", - "start": 16, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":16,"end":18,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":18}}, "body": [] }, "extra": { diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-class/migrated_0025/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-class/migrated_0025/output.json index 3a18f87634b4..7ce7952ccb88 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-class/migrated_0025/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-class/migrated_0025/output.json @@ -1,93 +1,26 @@ { "type": "File", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, "program": { "type": "Program", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, "expression": { "type": "ClassExpression", - "start": 1, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":1,"end":20,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":20}}, "id": { "type": "Identifier", - "start": 7, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - }, - "identifierName": "A" - }, + "start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8},"identifierName":"A"}, "name": "A" }, "superClass": { "type": "NumericLiteral", - "start": 17, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":17,"end":18,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":18}}, "extra": { "rawValue": 0, "raw": "0" @@ -96,18 +29,7 @@ }, "body": { "type": "ClassBody", - "start": 18, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":18,"end":20,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":20}}, "body": [] }, "extra": { diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-default-parameter-value/migrated_0000/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-default-parameter-value/migrated_0000/output.json index 14f737f82bca..9f560c227fa0 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-default-parameter-value/migrated_0000/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-default-parameter-value/migrated_0000/output.json @@ -1,143 +1,42 @@ { "type": "File", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "program": { "type": "Program", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "expression": { "type": "AssignmentExpression", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "operator": "=", "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "right": { "type": "FunctionExpression", - "start": 4, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":4,"end":22,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":22}}, "id": null, "generator": false, "async": false, "params": [ { "type": "AssignmentPattern", - "start": 13, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":13,"end":18,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":18}}, "left": { "type": "Identifier", - "start": 13, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - }, - "identifierName": "y" - }, + "start":13,"end":14,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":14},"identifierName":"y"}, "name": "y" }, "right": { "type": "NumericLiteral", - "start": 17, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":17,"end":18,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":18}}, "extra": { "rawValue": 1, "raw": "1" @@ -148,18 +47,7 @@ ], "body": { "type": "BlockStatement", - "start": 20, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":20,"end":22,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":22}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-default-parameter-value/migrated_0001/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-default-parameter-value/migrated_0001/output.json index bd6597aab1ca..4e22aa2182c6 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-default-parameter-value/migrated_0001/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-default-parameter-value/migrated_0001/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, "program": { "type": "Program", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, "id": { "type": "Identifier", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - }, - "identifierName": "f" - }, + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"f"}, "name": "f" }, "generator": false, @@ -65,49 +20,15 @@ "params": [ { "type": "AssignmentPattern", - "start": 11, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":11,"end":16,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":16}}, "left": { "type": "Identifier", - "start": 11, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "a" - }, + "start":11,"end":12,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":12},"identifierName":"a"}, "name": "a" }, "right": { "type": "NumericLiteral", - "start": 15, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":15,"end":16,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":16}}, "extra": { "rawValue": 1, "raw": "1" @@ -118,18 +39,7 @@ ], "body": { "type": "BlockStatement", - "start": 18, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":18,"end":20,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":20}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-default-parameter-value/migrated_0002/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-default-parameter-value/migrated_0002/output.json index 9f5973150fa8..ecbb4f3fafe7 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-default-parameter-value/migrated_0002/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-default-parameter-value/migrated_0002/output.json @@ -1,192 +1,57 @@ { "type": "File", - "start": 0, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, "program": { "type": "Program", - "start": 0, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, "expression": { "type": "AssignmentExpression", - "start": 0, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, "operator": "=", "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "right": { "type": "ObjectExpression", - "start": 4, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":4,"end":27,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":27}}, "properties": [ { "type": "ObjectProperty", - "start": 6, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":6,"end":25,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":25}}, "method": false, "key": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "f" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"f"}, "name": "f" }, "computed": false, "shorthand": false, "value": { "type": "FunctionExpression", - "start": 9, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":9,"end":25,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":25}}, "id": null, "generator": false, "async": false, "params": [ { "type": "AssignmentPattern", - "start": 18, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":18,"end":21,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":21}}, "left": { "type": "Identifier", - "start": 18, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - }, - "identifierName": "a" - }, + "start":18,"end":19,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":19},"identifierName":"a"}, "name": "a" }, "right": { "type": "NumericLiteral", - "start": 20, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":20,"end":21,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":21}}, "extra": { "rawValue": 1, "raw": "1" @@ -197,18 +62,7 @@ ], "body": { "type": "BlockStatement", - "start": 23, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":23,"end":25,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":25}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-destructuring-assignment-array-pattern/dup-assignment/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-destructuring-assignment-array-pattern/dup-assignment/output.json index 957dd5070e58..dba74d3f06f1 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-destructuring-assignment-array-pattern/dup-assignment/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-destructuring-assignment-array-pattern/dup-assignment/output.json @@ -1,142 +1,40 @@ { "type": "File", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "program": { "type": "Program", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "expression": { "type": "AssignmentExpression", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "operator": "=", "left": { "type": "ArrayPattern", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "elements": [ { "type": "Identifier", - "start": 1, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - }, - "identifierName": "a" - }, + "start":1,"end":2,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":2},"identifierName":"a"}, "name": "a" }, { "type": "Identifier", - "start": 3, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 4 - }, - "identifierName": "a" - }, + "start":3,"end":4,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":4},"identifierName":"a"}, "name": "a" }, null, { "type": "RestElement", - "start": 6, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":6,"end":10,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":10}}, "argument": { "type": "Identifier", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - }, - "identifierName": "a" - }, + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"a"}, "name": "a" } } @@ -144,18 +42,7 @@ }, "right": { "type": "NumericLiteral", - "start": 12, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":12,"end":13,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":13}}, "extra": { "rawValue": 0, "raw": "0" diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-destructuring-assignment-array-pattern/elision/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-destructuring-assignment-array-pattern/elision/output.json index eebd569aa2e6..3ad3009e10af 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-destructuring-assignment-array-pattern/elision/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-destructuring-assignment-array-pattern/elision/output.json @@ -1,76 +1,24 @@ { "type": "File", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "program": { "type": "Program", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "expression": { "type": "AssignmentExpression", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "operator": "=", "left": { "type": "ArrayPattern", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, + "extra": { + "trailingComma": 2 }, "elements": [ null, @@ -79,18 +27,7 @@ }, "right": { "type": "NumericLiteral", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, "extra": { "rawValue": 0, "raw": "0" diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-destructuring-assignment-array-pattern/member-expr-in-rest/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-destructuring-assignment-array-pattern/member-expr-in-rest/output.json index 512019e9c748..c22df6a3de5f 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-destructuring-assignment-array-pattern/member-expr-in-rest/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-destructuring-assignment-array-pattern/member-expr-in-rest/output.json @@ -1,137 +1,37 @@ { "type": "File", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "program": { "type": "Program", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "expression": { "type": "AssignmentExpression", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "operator": "=", "left": { "type": "ArrayPattern", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "elements": [ { "type": "RestElement", - "start": 1, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":1,"end":8,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":8}}, "argument": { "type": "MemberExpression", - "start": 4, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":4,"end":8,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":8}}, "object": { "type": "Identifier", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "a" - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"a"}, "name": "a" }, "property": { "type": "NumericLiteral", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7}}, "extra": { "rawValue": 0, "raw": "0" @@ -145,18 +45,7 @@ }, "right": { "type": "NumericLiteral", - "start": 12, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":12,"end":13,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":13}}, "extra": { "rawValue": 0, "raw": "0" diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-destructuring-assignment-array-pattern/nested-assignment/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-destructuring-assignment-array-pattern/nested-assignment/output.json index b80f1cb77fb1..6a8e67cf93fe 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-destructuring-assignment-array-pattern/nested-assignment/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-destructuring-assignment-array-pattern/nested-assignment/output.json @@ -1,140 +1,39 @@ { "type": "File", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, "program": { "type": "Program", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, "expression": { "type": "AssignmentExpression", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "operator": "=", "left": { "type": "ArrayPattern", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "elements": [ { "type": "Identifier", - "start": 1, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - }, - "identifierName": "a" - }, + "start":1,"end":2,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":2},"identifierName":"a"}, "name": "a" }, { "type": "AssignmentPattern", - "start": 3, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":3,"end":6,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":6}}, "left": { "type": "Identifier", - "start": 3, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 4 - }, - "identifierName": "b" - }, + "start":3,"end":4,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":4},"identifierName":"b"}, "name": "b" }, "right": { "type": "NumericLiteral", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, "extra": { "rawValue": 0, "raw": "0" @@ -144,109 +43,30 @@ }, { "type": "AssignmentPattern", - "start": 7, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":7,"end":21,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":21}}, "left": { "type": "ArrayPattern", - "start": 7, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":7,"end":18,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":18}}, "elements": [ { "type": "Identifier", - "start": 8, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "c" - }, + "start":8,"end":9,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":9},"identifierName":"c"}, "name": "c" }, { "type": "RestElement", - "start": 10, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":10,"end":17,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":17}}, "argument": { "type": "MemberExpression", - "start": 13, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":13,"end":17,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":17}}, "object": { "type": "Identifier", - "start": 13, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - }, - "identifierName": "a" - }, + "start":13,"end":14,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":14},"identifierName":"a"}, "name": "a" }, "property": { "type": "NumericLiteral", - "start": 15, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":15,"end":16,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":16}}, "extra": { "rawValue": 0, "raw": "0" @@ -260,18 +80,7 @@ }, "right": { "type": "ObjectExpression", - "start": 19, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":19,"end":21,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":21}}, "properties": [] } } @@ -279,18 +88,7 @@ }, "right": { "type": "NumericLiteral", - "start": 23, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":23,"end":24,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":24}}, "extra": { "rawValue": 0, "raw": "0" diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-destructuring-assignment-array-pattern/nested-cover-grammar/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-destructuring-assignment-array-pattern/nested-cover-grammar/output.json index cbf81a2877ca..287266bfe577 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-destructuring-assignment-array-pattern/nested-cover-grammar/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-destructuring-assignment-array-pattern/nested-cover-grammar/output.json @@ -1,173 +1,49 @@ { "type": "File", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "program": { "type": "Program", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "expression": { "type": "ArrayExpression", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "elements": [ { "type": "AssignmentExpression", - "start": 1, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":1,"end":8,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":8}}, "operator": "=", "left": { "type": "ObjectPattern", - "start": 1, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":1,"end":6,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":6}}, "properties": [ { "type": "ObjectProperty", - "start": 2, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":2,"end":5,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":5}}, "method": false, "key": { "type": "Identifier", - "start": 2, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 3 - }, - "identifierName": "a" - }, + "start":2,"end":3,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":3},"identifierName":"a"}, "name": "a" }, "computed": false, "shorthand": true, "value": { "type": "AssignmentPattern", - "start": 2, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":2,"end":5,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":5}}, "left": { "type": "Identifier", - "start": 2, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 3 - }, - "identifierName": "a" - }, + "start":2,"end":3,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":3},"identifierName":"a"}, "name": "a" }, "right": { "type": "Identifier", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "b" - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"b"}, "name": "b" } }, @@ -179,18 +55,7 @@ }, "right": { "type": "NumericLiteral", - "start": 7, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8}}, "extra": { "rawValue": 0, "raw": "0" diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-destructuring-assignment-array-pattern/simple-assignment/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-destructuring-assignment-array-pattern/simple-assignment/output.json index 18babe6d835b..952d1864c5c5 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-destructuring-assignment-array-pattern/simple-assignment/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-destructuring-assignment-array-pattern/simple-assignment/output.json @@ -1,111 +1,33 @@ { "type": "File", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, "program": { "type": "Program", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, "expression": { "type": "AssignmentExpression", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "operator": "=", "left": { "type": "ArrayPattern", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, "elements": [ { "type": "Identifier", - "start": 1, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - }, - "identifierName": "a" - }, + "start":1,"end":2,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":2},"identifierName":"a"}, "name": "a" } ] }, "right": { "type": "NumericLiteral", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7}}, "extra": { "rawValue": 0, "raw": "0" diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-destructuring-assignment-object-pattern/empty-object-pattern-assignment/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-destructuring-assignment-object-pattern/empty-object-pattern-assignment/output.json index 78326d2bf3d7..0d18228ad581 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-destructuring-assignment-object-pattern/empty-object-pattern-assignment/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-destructuring-assignment-object-pattern/empty-object-pattern-assignment/output.json @@ -1,93 +1,27 @@ { "type": "File", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "program": { "type": "Program", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "expression": { "type": "AssignmentExpression", - "start": 1, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":1,"end":7,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":7}}, "operator": "=", "left": { "type": "ObjectPattern", - "start": 1, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 3 - } - }, + "start":1,"end":3,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":3}}, "properties": [] }, "right": { "type": "NumericLiteral", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7}}, "extra": { "rawValue": 0, "raw": "0" diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-destructuring-assignment-object-pattern/invalid-lhs-01/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-destructuring-assignment-object-pattern/invalid-lhs-01/options.json deleted file mode 100644 index bf0f292caad2..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-destructuring-assignment-object-pattern/invalid-lhs-01/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid left-hand side in object destructuring pattern (1:4)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-destructuring-assignment-object-pattern/invalid-lhs-01/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-destructuring-assignment-object-pattern/invalid-lhs-01/output.json new file mode 100644 index 000000000000..41ad542d8b26 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-destructuring-assignment-object-pattern/invalid-lhs-01/output.json @@ -0,0 +1,60 @@ +{ + "type": "File", + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "errors": [ + "SyntaxError: Invalid left-hand side in object destructuring pattern (1:4)" + ], + "program": { + "type": "Program", + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "expression": { + "type": "AssignmentExpression", + "start":1,"end":11,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":11}}, + "operator": "=", + "left": { + "type": "ObjectPattern", + "start":1,"end":9,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":9}}, + "properties": [ + { + "type": "ObjectProperty", + "start":2,"end":8,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":8}}, + "method": false, + "key": { + "type": "Identifier", + "start":2,"end":3,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":3},"identifierName":"a"}, + "name": "a" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "ThisExpression", + "start":4,"end":8,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":8}} + } + } + ] + }, + "right": { + "type": "NumericLiteral", + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11}}, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + }, + "extra": { + "parenthesized": true, + "parenStart": 0 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-destructuring-assignment-object-pattern/invalid-lhs-02/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-destructuring-assignment-object-pattern/invalid-lhs-02/options.json deleted file mode 100644 index 2cfe61cdc033..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-destructuring-assignment-object-pattern/invalid-lhs-02/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid left-hand side in object destructuring pattern (1:5)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-destructuring-assignment-object-pattern/invalid-lhs-02/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-destructuring-assignment-object-pattern/invalid-lhs-02/output.json new file mode 100644 index 000000000000..7c1957004b43 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-destructuring-assignment-object-pattern/invalid-lhs-02/output.json @@ -0,0 +1,60 @@ +{ + "type": "File", + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, + "errors": [ + "SyntaxError: Invalid left-hand side in object destructuring pattern (1:5)" + ], + "program": { + "type": "Program", + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, + "expression": { + "type": "AssignmentExpression", + "start":1,"end":14,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":14}}, + "operator": "=", + "left": { + "type": "ObjectPattern", + "start":1,"end":10,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":10}}, + "properties": [ + { + "type": "ObjectProperty", + "start":2,"end":9,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":9}}, + "method": false, + "key": { + "type": "Identifier", + "start":2,"end":3,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":3},"identifierName":"a"}, + "name": "a" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "ThisExpression", + "start":5,"end":9,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":9}} + } + } + ] + }, + "right": { + "type": "NumericLiteral", + "start":13,"end":14,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":14}}, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + }, + "extra": { + "parenthesized": true, + "parenStart": 0 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-destructuring-assignment-object-pattern/invalid-pattern-with-method/input.js b/packages/babel-parser/test/fixtures/esprima/es2015-destructuring-assignment-object-pattern/invalid-pattern-with-method/input.js index 1dcb7ce683e6..dd21753e3550 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-destructuring-assignment-object-pattern/invalid-pattern-with-method/input.js +++ b/packages/babel-parser/test/fixtures/esprima/es2015-destructuring-assignment-object-pattern/invalid-pattern-with-method/input.js @@ -1 +1 @@ -({a(){}})=0 +({a(){}}=0) diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-destructuring-assignment-object-pattern/invalid-pattern-with-method/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-destructuring-assignment-object-pattern/invalid-pattern-with-method/options.json deleted file mode 100644 index 081535f854c6..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-destructuring-assignment-object-pattern/invalid-pattern-with-method/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Object pattern can't contain methods (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-destructuring-assignment-object-pattern/invalid-pattern-with-method/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-destructuring-assignment-object-pattern/invalid-pattern-with-method/output.json new file mode 100644 index 000000000000..9ad5276de4e3 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-destructuring-assignment-object-pattern/invalid-pattern-with-method/output.json @@ -0,0 +1,66 @@ +{ + "type": "File", + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "errors": [ + "SyntaxError: Object pattern can't contain methods (1:2)" + ], + "program": { + "type": "Program", + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "expression": { + "type": "AssignmentExpression", + "start":1,"end":10,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":10}}, + "operator": "=", + "left": { + "type": "ObjectPattern", + "start":1,"end":8,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":8}}, + "properties": [ + { + "type": "ObjectMethod", + "start":2,"end":7,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":7}}, + "method": true, + "key": { + "type": "Identifier", + "start":2,"end":3,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":3},"identifierName":"a"}, + "name": "a" + }, + "computed": false, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":5,"end":7,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":7}}, + "body": [], + "directives": [] + } + } + ] + }, + "right": { + "type": "NumericLiteral", + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10}}, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + }, + "extra": { + "parenthesized": true, + "parenStart": 0 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-destructuring-assignment-object-pattern/nested-cover-grammar/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-destructuring-assignment-object-pattern/nested-cover-grammar/output.json index cbc63e56e19f..a57907e16d7b 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-destructuring-assignment-object-pattern/nested-cover-grammar/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-destructuring-assignment-object-pattern/nested-cover-grammar/output.json @@ -1,488 +1,133 @@ { "type": "File", - "start": 0, - "end": 51, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 51 - } - }, + "start":0,"end":51,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":51}}, "program": { "type": "Program", - "start": 0, - "end": 51, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 51 - } - }, + "start":0,"end":51,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":51}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 51, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 51 - } - }, + "start":0,"end":51,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":51}}, "expression": { "type": "AssignmentExpression", - "start": 0, - "end": 50, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 50 - } - }, + "start":0,"end":50,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":50}}, "operator": "=", "left": { "type": "ArrayPattern", - "start": 0, - "end": 48, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 48 - } - }, + "start":0,"end":48,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":48}}, "elements": [ { "type": "ArrayPattern", - "start": 1, - "end": 47, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 47 - } - }, + "start":1,"end":47,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":47}}, "elements": [ { "type": "ArrayPattern", - "start": 2, - "end": 46, - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 46 - } - }, + "start":2,"end":46,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":46}}, "elements": [ { "type": "ArrayPattern", - "start": 3, - "end": 45, - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 45 - } - }, + "start":3,"end":45,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":45}}, "elements": [ { "type": "ArrayPattern", - "start": 4, - "end": 44, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 44 - } - }, + "start":4,"end":44,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":44}}, "elements": [ { "type": "ArrayPattern", - "start": 5, - "end": 43, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 43 - } - }, + "start":5,"end":43,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":43}}, "elements": [ { "type": "ArrayPattern", - "start": 6, - "end": 42, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 42 - } - }, + "start":6,"end":42,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":42}}, "elements": [ { "type": "ArrayPattern", - "start": 7, - "end": 41, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 41 - } - }, + "start":7,"end":41,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":41}}, "elements": [ { "type": "ArrayPattern", - "start": 8, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 40 - } - }, + "start":8,"end":40,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":40}}, "elements": [ { "type": "ArrayPattern", - "start": 9, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 39 - } - }, + "start":9,"end":39,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":39}}, "elements": [ { "type": "ArrayPattern", - "start": 10, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":10,"end":38,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":38}}, "elements": [ { "type": "ArrayPattern", - "start": 11, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 37 - } - }, + "start":11,"end":37,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":37}}, "elements": [ { "type": "ArrayPattern", - "start": 12, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":12,"end":36,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":36}}, "elements": [ { "type": "ArrayPattern", - "start": 13, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":13,"end":35,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":35}}, "elements": [ { "type": "ArrayPattern", - "start": 14, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":14,"end":34,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":34}}, "elements": [ { "type": "ArrayPattern", - "start": 15, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":15,"end":33,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":33}}, "elements": [ { "type": "ArrayPattern", - "start": 16, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":16,"end":32,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":32}}, "elements": [ { "type": "ArrayPattern", - "start": 17, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":17,"end":31,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":31}}, "elements": [ { "type": "ArrayPattern", - "start": 18, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":18,"end":30,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":30}}, "elements": [ { "type": "ArrayPattern", - "start": 19, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":19,"end":29,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":29}}, "elements": [ { "type": "ObjectPattern", - "start": 20, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":20,"end":28,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":28}}, "properties": [ { "type": "ObjectProperty", - "start": 21, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":21,"end":27,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":27}}, "method": false, "key": { "type": "Identifier", - "start": 21, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 22 - }, - "identifierName": "a" - }, + "start":21,"end":22,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":22},"identifierName":"a"}, "name": "a" }, "computed": false, "shorthand": true, "value": { "type": "AssignmentPattern", - "start": 21, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":21,"end":27,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":27}}, "left": { "type": "Identifier", - "start": 21, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 22 - }, - "identifierName": "a" - }, + "start":21,"end":22,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":22},"identifierName":"a"}, "name": "a" }, "right": { "type": "MemberExpression", - "start": 23, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":23,"end":27,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":27}}, "object": { "type": "Identifier", - "start": 23, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 24 - }, - "identifierName": "b" - }, + "start":23,"end":24,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":24},"identifierName":"b"}, "name": "b" }, "property": { "type": "NumericLiteral", - "start": 25, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":25,"end":26,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":26}}, "extra": { "rawValue": 0, "raw": "0" @@ -540,18 +185,7 @@ }, "right": { "type": "NumericLiteral", - "start": 49, - "end": 50, - "loc": { - "start": { - "line": 1, - "column": 49 - }, - "end": { - "line": 1, - "column": 50 - } - }, + "start":49,"end":50,"loc":{"start":{"line":1,"column":49},"end":{"line":1,"column":50}}, "extra": { "rawValue": 0, "raw": "0" diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-destructuring-assignment-object-pattern/object-pattern-assignment/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-destructuring-assignment-object-pattern/object-pattern-assignment/output.json index 60b6c5f4b454..bc2ea2163609 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-destructuring-assignment-object-pattern/object-pattern-assignment/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-destructuring-assignment-object-pattern/object-pattern-assignment/output.json @@ -1,127 +1,37 @@ { "type": "File", - "start": 0, - "end": 85, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 8, - "column": 7 - } - }, + "start":0,"end":85,"loc":{"start":{"line":1,"column":0},"end":{"line":8,"column":7}}, "program": { "type": "Program", - "start": 0, - "end": 85, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 8, - "column": 7 - } - }, + "start":0,"end":85,"loc":{"start":{"line":1,"column":0},"end":{"line":8,"column":7}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 85, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 8, - "column": 7 - } - }, + "start":0,"end":85,"loc":{"start":{"line":1,"column":0},"end":{"line":8,"column":7}}, "expression": { "type": "AssignmentExpression", - "start": 1, - "end": 83, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 8, - "column": 5 - } - }, + "start":1,"end":83,"loc":{"start":{"line":1,"column":1},"end":{"line":8,"column":5}}, "operator": "=", "left": { "type": "ObjectPattern", - "start": 1, - "end": 79, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 8, - "column": 1 - } - }, + "start":1,"end":79,"loc":{"start":{"line":1,"column":1},"end":{"line":8,"column":1}}, "properties": [ { "type": "ObjectProperty", - "start": 7, - "end": 8, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 5 - } - }, + "start":7,"end":8,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":5}}, "method": false, "key": { "type": "Identifier", - "start": 7, - "end": 8, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 5 - }, - "identifierName": "a" - }, + "start":7,"end":8,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":5},"identifierName":"a"}, "name": "a" }, "computed": false, "shorthand": true, "value": { "type": "Identifier", - "start": 7, - "end": 8, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 5 - }, - "identifierName": "a" - }, + "start":7,"end":8,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":5},"identifierName":"a"}, "name": "a" }, "extra": { @@ -130,238 +40,76 @@ }, { "type": "ObjectProperty", - "start": 14, - "end": 17, - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 7 - } - }, + "start":14,"end":17,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":7}}, "method": false, "key": { "type": "Identifier", - "start": 14, - "end": 15, - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 5 - }, - "identifierName": "a" - }, + "start":14,"end":15,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":5},"identifierName":"a"}, "name": "a" }, "computed": false, "shorthand": false, "value": { "type": "Identifier", - "start": 16, - "end": 17, - "loc": { - "start": { - "line": 3, - "column": 6 - }, - "end": { - "line": 3, - "column": 7 - }, - "identifierName": "a" - }, + "start":16,"end":17,"loc":{"start":{"line":3,"column":6},"end":{"line":3,"column":7},"identifierName":"a"}, "name": "a" } }, { "type": "ObjectProperty", - "start": 23, - "end": 28, - "loc": { - "start": { - "line": 4, - "column": 4 - }, - "end": { - "line": 4, - "column": 9 - } - }, + "start":23,"end":28,"loc":{"start":{"line":4,"column":4},"end":{"line":4,"column":9}}, "method": false, "key": { "type": "Identifier", - "start": 23, - "end": 24, - "loc": { - "start": { - "line": 4, - "column": 4 - }, - "end": { - "line": 4, - "column": 5 - }, - "identifierName": "a" - }, + "start":23,"end":24,"loc":{"start":{"line":4,"column":4},"end":{"line":4,"column":5},"identifierName":"a"}, "name": "a" }, "computed": false, "shorthand": false, "value": { "type": "AssignmentPattern", - "start": 25, - "end": 28, - "loc": { - "start": { - "line": 4, - "column": 6 - }, - "end": { - "line": 4, - "column": 9 - } - }, + "start":25,"end":28,"loc":{"start":{"line":4,"column":6},"end":{"line":4,"column":9}}, "left": { "type": "Identifier", - "start": 25, - "end": 26, - "loc": { - "start": { - "line": 4, - "column": 6 - }, - "end": { - "line": 4, - "column": 7 - }, - "identifierName": "a" - }, + "start":25,"end":26,"loc":{"start":{"line":4,"column":6},"end":{"line":4,"column":7},"identifierName":"a"}, "name": "a" }, "right": { "type": "Identifier", - "start": 27, - "end": 28, - "loc": { - "start": { - "line": 4, - "column": 8 - }, - "end": { - "line": 4, - "column": 9 - }, - "identifierName": "a" - }, + "start":27,"end":28,"loc":{"start":{"line":4,"column":8},"end":{"line":4,"column":9},"identifierName":"a"}, "name": "a" } } }, { "type": "ObjectProperty", - "start": 34, - "end": 41, - "loc": { - "start": { - "line": 5, - "column": 4 - }, - "end": { - "line": 5, - "column": 11 - } - }, + "start":34,"end":41,"loc":{"start":{"line":5,"column":4},"end":{"line":5,"column":11}}, "method": false, "computed": true, "key": { "type": "Identifier", - "start": 35, - "end": 36, - "loc": { - "start": { - "line": 5, - "column": 5 - }, - "end": { - "line": 5, - "column": 6 - }, - "identifierName": "a" - }, + "start":35,"end":36,"loc":{"start":{"line":5,"column":5},"end":{"line":5,"column":6},"identifierName":"a"}, "name": "a" }, "shorthand": false, "value": { "type": "ObjectPattern", - "start": 38, - "end": 41, - "loc": { - "start": { - "line": 5, - "column": 8 - }, - "end": { - "line": 5, - "column": 11 - } - }, + "start":38,"end":41,"loc":{"start":{"line":5,"column":8},"end":{"line":5,"column":11}}, "properties": [ { "type": "ObjectProperty", - "start": 39, - "end": 40, - "loc": { - "start": { - "line": 5, - "column": 9 - }, - "end": { - "line": 5, - "column": 10 - } - }, + "start":39,"end":40,"loc":{"start":{"line":5,"column":9},"end":{"line":5,"column":10}}, "method": false, "key": { "type": "Identifier", - "start": 39, - "end": 40, - "loc": { - "start": { - "line": 5, - "column": 9 - }, - "end": { - "line": 5, - "column": 10 - }, - "identifierName": "a" - }, + "start":39,"end":40,"loc":{"start":{"line":5,"column":9},"end":{"line":5,"column":10},"identifierName":"a"}, "name": "a" }, "computed": false, "shorthand": true, "value": { "type": "Identifier", - "start": 39, - "end": 40, - "loc": { - "start": { - "line": 5, - "column": 9 - }, - "end": { - "line": 5, - "column": 10 - }, - "identifierName": "a" - }, + "start":39,"end":40,"loc":{"start":{"line":5,"column":9},"end":{"line":5,"column":10},"identifierName":"a"}, "name": "a" }, "extra": { @@ -373,100 +121,31 @@ }, { "type": "ObjectProperty", - "start": 47, - "end": 63, - "loc": { - "start": { - "line": 6, - "column": 4 - }, - "end": { - "line": 6, - "column": 20 - } - }, + "start":47,"end":63,"loc":{"start":{"line":6,"column":4},"end":{"line":6,"column":20}}, "method": false, "key": { "type": "Identifier", - "start": 47, - "end": 48, - "loc": { - "start": { - "line": 6, - "column": 4 - }, - "end": { - "line": 6, - "column": 5 - }, - "identifierName": "a" - }, + "start":47,"end":48,"loc":{"start":{"line":6,"column":4},"end":{"line":6,"column":5},"identifierName":"a"}, "name": "a" }, "computed": false, "shorthand": false, "value": { "type": "MemberExpression", - "start": 49, - "end": 63, - "loc": { - "start": { - "line": 6, - "column": 6 - }, - "end": { - "line": 6, - "column": 20 - } - }, + "start":49,"end":63,"loc":{"start":{"line":6,"column":6},"end":{"line":6,"column":20}}, "object": { "type": "CallExpression", - "start": 49, - "end": 60, - "loc": { - "start": { - "line": 6, - "column": 6 - }, - "end": { - "line": 6, - "column": 17 - } - }, + "start":49,"end":60,"loc":{"start":{"line":6,"column":6},"end":{"line":6,"column":17}}, "callee": { "type": "Identifier", - "start": 49, - "end": 58, - "loc": { - "start": { - "line": 6, - "column": 6 - }, - "end": { - "line": 6, - "column": 15 - }, - "identifierName": "some_call" - }, + "start":49,"end":58,"loc":{"start":{"line":6,"column":6},"end":{"line":6,"column":15},"identifierName":"some_call"}, "name": "some_call" }, "arguments": [] }, "property": { "type": "Identifier", - "start": 61, - "end": 62, - "loc": { - "start": { - "line": 6, - "column": 18 - }, - "end": { - "line": 6, - "column": 19 - }, - "identifierName": "a" - }, + "start":61,"end":62,"loc":{"start":{"line":6,"column":18},"end":{"line":6,"column":19},"identifierName":"a"}, "name": "a" }, "computed": true @@ -474,82 +153,25 @@ }, { "type": "ObjectProperty", - "start": 69, - "end": 77, - "loc": { - "start": { - "line": 7, - "column": 4 - }, - "end": { - "line": 7, - "column": 12 - } - }, + "start":69,"end":77,"loc":{"start":{"line":7,"column":4},"end":{"line":7,"column":12}}, "method": false, "key": { "type": "Identifier", - "start": 69, - "end": 70, - "loc": { - "start": { - "line": 7, - "column": 4 - }, - "end": { - "line": 7, - "column": 5 - }, - "identifierName": "a" - }, + "start":69,"end":70,"loc":{"start":{"line":7,"column":4},"end":{"line":7,"column":5},"identifierName":"a"}, "name": "a" }, "computed": false, "shorthand": false, "value": { "type": "MemberExpression", - "start": 71, - "end": 77, - "loc": { - "start": { - "line": 7, - "column": 6 - }, - "end": { - "line": 7, - "column": 12 - } - }, + "start":71,"end":77,"loc":{"start":{"line":7,"column":6},"end":{"line":7,"column":12}}, "object": { "type": "ThisExpression", - "start": 71, - "end": 75, - "loc": { - "start": { - "line": 7, - "column": 6 - }, - "end": { - "line": 7, - "column": 10 - } - } + "start":71,"end":75,"loc":{"start":{"line":7,"column":6},"end":{"line":7,"column":10}} }, "property": { "type": "Identifier", - "start": 76, - "end": 77, - "loc": { - "start": { - "line": 7, - "column": 11 - }, - "end": { - "line": 7, - "column": 12 - }, - "identifierName": "a" - }, + "start":76,"end":77,"loc":{"start":{"line":7,"column":11},"end":{"line":7,"column":12},"identifierName":"a"}, "name": "a" }, "computed": false @@ -559,18 +181,7 @@ }, "right": { "type": "NumericLiteral", - "start": 82, - "end": 83, - "loc": { - "start": { - "line": 8, - "column": 4 - }, - "end": { - "line": 8, - "column": 5 - } - }, + "start":82,"end":83,"loc":{"start":{"line":8,"column":4},"end":{"line":8,"column":5}}, "extra": { "rawValue": 0, "raw": "0" diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-destructuring-assignment/invalid-group-assignment/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-destructuring-assignment/invalid-group-assignment/options.json deleted file mode 100644 index 7c5f08eb9ba6..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-destructuring-assignment/invalid-group-assignment/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid left-hand side in assignment expression (1:1)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-destructuring-assignment/invalid-group-assignment/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-destructuring-assignment/invalid-group-assignment/output.json new file mode 100644 index 000000000000..7f8cd55c22f0 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-destructuring-assignment/invalid-group-assignment/output.json @@ -0,0 +1,66 @@ +{ + "type": "File", + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "errors": [ + "SyntaxError: Invalid parenthesized assignment pattern (1:1)", + "SyntaxError: Invalid left-hand side in assignment expression (1:1)" + ], + "program": { + "type": "Program", + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "expression": { + "type": "AssignmentExpression", + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "operator": "=", + "left": { + "type": "SequenceExpression", + "start":1,"end":4,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":4}}, + "expressions": [ + { + "type": "Identifier", + "start":1,"end":2,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":2},"identifierName":"a"}, + "name": "a" + }, + { + "type": "Identifier", + "start":3,"end":4,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":4},"identifierName":"b"}, + "name": "b" + } + ], + "extra": { + "parenthesized": true, + "parenStart": 0 + } + }, + "right": { + "type": "SequenceExpression", + "start":7,"end":10,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":10}}, + "expressions": [ + { + "type": "Identifier", + "start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8},"identifierName":"c"}, + "name": "c" + }, + { + "type": "Identifier", + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"d"}, + "name": "d" + } + ], + "extra": { + "parenthesized": true, + "parenStart": 6 + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-export-declaration/export-const-number/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-export-declaration/export-const-number/output.json index 99ed085c7128..718eae62c7e3 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-export-declaration/export-const-number/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-export-declaration/export-const-number/output.json @@ -1,110 +1,32 @@ { "type": "File", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, "program": { "type": "Program", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExportNamedDeclaration", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, "specifiers": [], "source": null, "declaration": { "type": "VariableDeclaration", - "start": 7, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":7,"end":21,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":21}}, "declarations": [ { "type": "VariableDeclarator", - "start": 13, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":13,"end":20,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":20}}, "id": { "type": "Identifier", - "start": 13, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 16 - }, - "identifierName": "foo" - }, + "start":13,"end":16,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":16},"identifierName":"foo"}, "name": "foo" }, "init": { "type": "NumericLiteral", - "start": 19, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":19,"end":20,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":20}}, "extra": { "rawValue": 1, "raw": "1" diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-export-declaration/export-default-array/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-export-declaration/export-default-array/output.json index ebdcfd3b6cb7..cbc61f434e31 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-export-declaration/export-default-array/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-export-declaration/export-default-array/output.json @@ -1,62 +1,18 @@ { "type": "File", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, "program": { "type": "Program", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExportDefaultDeclaration", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, "declaration": { "type": "ArrayExpression", - "start": 15, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":15,"end":17,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":17}}, "elements": [] } } diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-export-declaration/export-default-class/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-export-declaration/export-default-class/output.json index a6431fd6f6c4..502e479af681 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-export-declaration/export-default-class/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-export-declaration/export-default-class/output.json @@ -1,78 +1,23 @@ { "type": "File", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "program": { "type": "Program", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExportDefaultDeclaration", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "declaration": { "type": "ClassDeclaration", - "start": 15, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":15,"end":23,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":23}}, "id": null, "superClass": null, "body": { "type": "ClassBody", - "start": 21, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":21,"end":23,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":23}}, "body": [] } } diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-export-declaration/export-default-expression/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-export-declaration/export-default-expression/output.json index 5a4e8daa8bf5..5cc2cc85e6f1 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-export-declaration/export-default-expression/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-export-declaration/export-default-expression/output.json @@ -1,76 +1,21 @@ { "type": "File", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "program": { "type": "Program", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExportDefaultDeclaration", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "declaration": { "type": "BinaryExpression", - "start": 16, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":16,"end":21,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":21}}, "left": { "type": "NumericLiteral", - "start": 16, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":16,"end":17,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":17}}, "extra": { "rawValue": 1, "raw": "1" @@ -80,18 +25,7 @@ "operator": "+", "right": { "type": "NumericLiteral", - "start": 20, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":20,"end":21,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":21}}, "extra": { "rawValue": 2, "raw": "2" diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-export-declaration/export-default-function/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-export-declaration/export-default-function/output.json index 52f9f4e1dcfe..1689c32a0d00 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-export-declaration/export-default-function/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-export-declaration/export-default-function/output.json @@ -1,80 +1,25 @@ { "type": "File", - "start": 0, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, "program": { "type": "Program", - "start": 0, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExportDefaultDeclaration", - "start": 0, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, "declaration": { "type": "FunctionDeclaration", - "start": 15, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":15,"end":29,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":29}}, "id": null, "generator": false, "async": false, "params": [], "body": { "type": "BlockStatement", - "start": 27, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":27,"end":29,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":29}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-export-declaration/export-default-named-function/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-export-declaration/export-default-named-function/output.json index 66eb1ea4c6d8..3409ea6ea2fe 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-export-declaration/export-default-named-function/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-export-declaration/export-default-named-function/output.json @@ -1,77 +1,21 @@ { "type": "File", - "start": 0, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, "program": { "type": "Program", - "start": 0, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExportDefaultDeclaration", - "start": 0, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, "declaration": { "type": "FunctionDeclaration", - "start": 15, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":15,"end":32,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":32}}, "id": { "type": "Identifier", - "start": 24, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 27 - }, - "identifierName": "foo" - }, + "start":24,"end":27,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":27},"identifierName":"foo"}, "name": "foo" }, "generator": false, @@ -79,18 +23,7 @@ "params": [], "body": { "type": "BlockStatement", - "start": 30, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":30,"end":32,"loc":{"start":{"line":1,"column":30},"end":{"line":1,"column":32}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-export-declaration/export-default-number/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-export-declaration/export-default-number/output.json index 7f633802f8ba..bc86254ee3ae 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-export-declaration/export-default-number/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-export-declaration/export-default-number/output.json @@ -1,62 +1,18 @@ { "type": "File", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, "program": { "type": "Program", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExportDefaultDeclaration", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, "declaration": { "type": "NumericLiteral", - "start": 15, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":15,"end":17,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":17}}, "extra": { "rawValue": 42, "raw": "42" diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-export-declaration/export-default-object/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-export-declaration/export-default-object/output.json index 5161d7a26eb2..7957d21d96f6 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-export-declaration/export-default-object/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-export-declaration/export-default-object/output.json @@ -1,111 +1,33 @@ { "type": "File", - "start": 0, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, "program": { "type": "Program", - "start": 0, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExportDefaultDeclaration", - "start": 0, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, "declaration": { "type": "ObjectExpression", - "start": 15, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":15,"end":25,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":25}}, "properties": [ { "type": "ObjectProperty", - "start": 17, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":17,"end":23,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":23}}, "method": false, "key": { "type": "Identifier", - "start": 17, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 20 - }, - "identifierName": "foo" - }, + "start":17,"end":20,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":20},"identifierName":"foo"}, "name": "foo" }, "computed": false, "shorthand": false, "value": { "type": "NumericLiteral", - "start": 22, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":22,"end":23,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":23}}, "extra": { "rawValue": 1, "raw": "1" diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-export-declaration/export-default-value/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-export-declaration/export-default-value/output.json index 3793b0720164..cb666228836c 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-export-declaration/export-default-value/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-export-declaration/export-default-value/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, "program": { "type": "Program", - "start": 0, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExportDefaultDeclaration", - "start": 0, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, "declaration": { "type": "Identifier", - "start": 15, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 18 - }, - "identifierName": "foo" - }, + "start":15,"end":18,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":18},"identifierName":"foo"}, "name": "foo" } } diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-export-declaration/export-from-batch/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-export-declaration/export-from-batch/output.json index 2ab38b87e88f..c45fef74fd3c 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-export-declaration/export-from-batch/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-export-declaration/export-from-batch/output.json @@ -1,62 +1,18 @@ { "type": "File", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, "program": { "type": "Program", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExportAllDeclaration", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, "source": { "type": "StringLiteral", - "start": 14, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":14,"end":19,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":19}}, "extra": { "rawValue": "foo", "raw": "\"foo\"" diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-export-declaration/export-from-default/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-export-declaration/export-from-default/output.json index 7d6db627a47f..c6a98d9941cc 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-export-declaration/export-from-default/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-export-declaration/export-from-default/output.json @@ -1,120 +1,41 @@ { "type": "File", - "start": 0, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, "program": { "type": "Program", - "start": 0, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExportNamedDeclaration", - "start": 0, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 28 - } - }, - "declaration": null, + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, "specifiers": [ { "type": "ExportSpecifier", - "start": 8, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":8,"end":15,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":15}}, "local": { "type": "Identifier", - "start": 8, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 15 - }, - "identifierName": "default" - }, + "start":8,"end":15,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":15},"identifierName":"default"}, "name": "default" }, "exported": { "type": "Identifier", - "start": 8, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 15 - }, - "identifierName": "default" - }, + "start":8,"end":15,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":15},"identifierName":"default"}, "name": "default" } } ], "source": { "type": "StringLiteral", - "start": 22, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":22,"end":27,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":27}}, "extra": { "rawValue": "foo", "raw": "\"foo\"" }, "value": "foo" - } + }, + "declaration": null } ], "directives": [] diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-export-declaration/export-from-named-as-default/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-export-declaration/export-from-named-as-default/output.json index fef0983ec607..c99efd2f174c 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-export-declaration/export-from-named-as-default/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-export-declaration/export-from-named-as-default/output.json @@ -1,120 +1,41 @@ { "type": "File", - "start": 0, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":35}}, "program": { "type": "Program", - "start": 0, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":35}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExportNamedDeclaration", - "start": 0, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 35 - } - }, - "declaration": null, + "start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":35}}, "specifiers": [ { "type": "ExportSpecifier", - "start": 8, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":8,"end":22,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":22}}, "local": { "type": "Identifier", - "start": 8, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "foo" - }, + "start":8,"end":11,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":11},"identifierName":"foo"}, "name": "foo" }, "exported": { "type": "Identifier", - "start": 15, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 22 - }, - "identifierName": "default" - }, + "start":15,"end":22,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":22},"identifierName":"default"}, "name": "default" } } ], "source": { "type": "StringLiteral", - "start": 29, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":29,"end":34,"loc":{"start":{"line":1,"column":29},"end":{"line":1,"column":34}}, "extra": { "rawValue": "foo", "raw": "\"foo\"" }, "value": "foo" - } + }, + "declaration": null } ], "directives": [] diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-export-declaration/export-from-named-as-specifier/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-export-declaration/export-from-named-as-specifier/output.json index 16bafeb6e9d4..471a4c152d20 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-export-declaration/export-from-named-as-specifier/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-export-declaration/export-from-named-as-specifier/output.json @@ -1,120 +1,41 @@ { "type": "File", - "start": 0, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, "program": { "type": "Program", - "start": 0, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExportNamedDeclaration", - "start": 0, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } - }, - "declaration": null, + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, "specifiers": [ { "type": "ExportSpecifier", - "start": 8, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":8,"end":18,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":18}}, "local": { "type": "Identifier", - "start": 8, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "foo" - }, + "start":8,"end":11,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":11},"identifierName":"foo"}, "name": "foo" }, "exported": { "type": "Identifier", - "start": 15, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 18 - }, - "identifierName": "bar" - }, + "start":15,"end":18,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":18},"identifierName":"bar"}, "name": "bar" } } ], "source": { "type": "StringLiteral", - "start": 25, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":25,"end":30,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":30}}, "extra": { "rawValue": "foo", "raw": "\"foo\"" }, "value": "foo" - } + }, + "declaration": null } ], "directives": [] diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-export-declaration/export-from-named-as-specifiers/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-export-declaration/export-from-named-as-specifiers/output.json index 6e865059d6ee..fd31ae512c88 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-export-declaration/export-from-named-as-specifiers/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-export-declaration/export-from-named-as-specifiers/output.json @@ -1,169 +1,55 @@ { "type": "File", - "start": 0, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 40 - } - }, + "start":0,"end":40,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":40}}, "program": { "type": "Program", - "start": 0, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 40 - } - }, + "start":0,"end":40,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":40}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExportNamedDeclaration", - "start": 0, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 40 - } - }, - "declaration": null, + "start":0,"end":40,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":40}}, "specifiers": [ { "type": "ExportSpecifier", - "start": 8, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":8,"end":22,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":22}}, "local": { "type": "Identifier", - "start": 8, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "foo" - }, + "start":8,"end":11,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":11},"identifierName":"foo"}, "name": "foo" }, "exported": { "type": "Identifier", - "start": 15, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 22 - }, - "identifierName": "default" - }, + "start":15,"end":22,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":22},"identifierName":"default"}, "name": "default" } }, { "type": "ExportSpecifier", - "start": 24, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":24,"end":27,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":27}}, "local": { "type": "Identifier", - "start": 24, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 27 - }, - "identifierName": "bar" - }, + "start":24,"end":27,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":27},"identifierName":"bar"}, "name": "bar" }, "exported": { "type": "Identifier", - "start": 24, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 27 - }, - "identifierName": "bar" - }, + "start":24,"end":27,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":27},"identifierName":"bar"}, "name": "bar" } } ], "source": { "type": "StringLiteral", - "start": 34, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 34 - }, - "end": { - "line": 1, - "column": 39 - } - }, + "start":34,"end":39,"loc":{"start":{"line":1,"column":34},"end":{"line":1,"column":39}}, "extra": { "rawValue": "foo", "raw": "\"foo\"" }, "value": "foo" - } + }, + "declaration": null } ], "directives": [] diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-export-declaration/export-from-specifier/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-export-declaration/export-from-specifier/output.json index 6a4e6615ad3c..eb3aad57255d 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-export-declaration/export-from-specifier/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-export-declaration/export-from-specifier/output.json @@ -1,120 +1,41 @@ { "type": "File", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "program": { "type": "Program", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExportNamedDeclaration", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, - "declaration": null, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "specifiers": [ { "type": "ExportSpecifier", - "start": 8, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":8,"end":11,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":11}}, "local": { "type": "Identifier", - "start": 8, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "foo" - }, + "start":8,"end":11,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":11},"identifierName":"foo"}, "name": "foo" }, "exported": { "type": "Identifier", - "start": 8, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "foo" - }, + "start":8,"end":11,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":11},"identifierName":"foo"}, "name": "foo" } } ], "source": { "type": "StringLiteral", - "start": 18, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":18,"end":23,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":23}}, "extra": { "rawValue": "foo", "raw": "\"foo\"" }, "value": "foo" - } + }, + "declaration": null } ], "directives": [] diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-export-declaration/export-from-specifiers/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-export-declaration/export-from-specifiers/output.json index 4f1af1fb8a82..003667938889 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-export-declaration/export-from-specifiers/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-export-declaration/export-from-specifiers/output.json @@ -1,169 +1,55 @@ { "type": "File", - "start": 0, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, "program": { "type": "Program", - "start": 0, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExportNamedDeclaration", - "start": 0, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 29 - } - }, - "declaration": null, + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, "specifiers": [ { "type": "ExportSpecifier", - "start": 8, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":8,"end":11,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":11}}, "local": { "type": "Identifier", - "start": 8, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "foo" - }, + "start":8,"end":11,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":11},"identifierName":"foo"}, "name": "foo" }, "exported": { "type": "Identifier", - "start": 8, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "foo" - }, + "start":8,"end":11,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":11},"identifierName":"foo"}, "name": "foo" } }, { "type": "ExportSpecifier", - "start": 13, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":13,"end":16,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":16}}, "local": { "type": "Identifier", - "start": 13, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 16 - }, - "identifierName": "bar" - }, + "start":13,"end":16,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":16},"identifierName":"bar"}, "name": "bar" }, "exported": { "type": "Identifier", - "start": 13, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 16 - }, - "identifierName": "bar" - }, + "start":13,"end":16,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":16},"identifierName":"bar"}, "name": "bar" } } ], "source": { "type": "StringLiteral", - "start": 23, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":23,"end":28,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":28}}, "extra": { "rawValue": "foo", "raw": "\"foo\"" }, "value": "foo" - } + }, + "declaration": null } ], "directives": [] diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-export-declaration/export-function-declaration/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-export-declaration/export-function-declaration/output.json index 17164deb23bc..c119a1a11bea 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-export-declaration/export-function-declaration/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-export-declaration/export-function-declaration/output.json @@ -1,79 +1,23 @@ { "type": "File", - "start": 0, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, "program": { "type": "Program", - "start": 0, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExportNamedDeclaration", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, "specifiers": [], "source": null, "declaration": { "type": "FunctionDeclaration", - "start": 7, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":7,"end":25,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":25}}, "id": { "type": "Identifier", - "start": 16, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 19 - }, - "identifierName": "foo" - }, + "start":16,"end":19,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":19},"identifierName":"foo"}, "name": "foo" }, "generator": false, @@ -81,18 +25,7 @@ "params": [], "body": { "type": "BlockStatement", - "start": 23, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":23,"end":25,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":25}}, "body": [], "directives": [] } @@ -100,32 +33,10 @@ }, { "type": "ExpressionStatement", - "start": 26, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":26,"end":31,"loc":{"start":{"line":1,"column":26},"end":{"line":1,"column":31}}, "expression": { "type": "BooleanLiteral", - "start": 26, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":26,"end":31,"loc":{"start":{"line":1,"column":26},"end":{"line":1,"column":31}}, "value": false } } diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-export-declaration/export-function/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-export-declaration/export-function/output.json index 7ff223f9b3d0..987044663f0a 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-export-declaration/export-function/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-export-declaration/export-function/output.json @@ -1,79 +1,23 @@ { "type": "File", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, "program": { "type": "Program", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExportNamedDeclaration", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, "specifiers": [], "source": null, "declaration": { "type": "FunctionDeclaration", - "start": 7, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":7,"end":25,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":25}}, "id": { "type": "Identifier", - "start": 16, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 19 - }, - "identifierName": "foo" - }, + "start":16,"end":19,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":19},"identifierName":"foo"}, "name": "foo" }, "generator": false, @@ -81,18 +25,7 @@ "params": [], "body": { "type": "BlockStatement", - "start": 23, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":23,"end":25,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":25}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-export-declaration/export-let-number/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-export-declaration/export-let-number/output.json index d6ca5e1061cd..53d9b742e142 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-export-declaration/export-let-number/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-export-declaration/export-let-number/output.json @@ -1,110 +1,32 @@ { "type": "File", - "start": 0, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, "program": { "type": "Program", - "start": 0, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExportNamedDeclaration", - "start": 0, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, "specifiers": [], "source": null, "declaration": { "type": "VariableDeclaration", - "start": 7, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":7,"end":19,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":19}}, "declarations": [ { "type": "VariableDeclarator", - "start": 11, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":11,"end":18,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":18}}, "id": { "type": "Identifier", - "start": 11, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 14 - }, - "identifierName": "foo" - }, + "start":11,"end":14,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":14},"identifierName":"foo"}, "name": "foo" }, "init": { "type": "NumericLiteral", - "start": 17, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":17,"end":18,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":18}}, "extra": { "rawValue": 1, "raw": "1" diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-export-declaration/export-named-as-default/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-export-declaration/export-named-as-default/output.json index ab9dd47bd5f1..c9ca89ea27d0 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-export-declaration/export-named-as-default/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-export-declaration/export-named-as-default/output.json @@ -1,95 +1,27 @@ { "type": "File", - "start": 0, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 8 - } - }, + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":8}}, "program": { "type": "Program", - "start": 0, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 8 - } - }, + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":8}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExportNamedDeclaration", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "specifiers": [ { "type": "ExportSpecifier", - "start": 8, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":8,"end":22,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":22}}, "local": { "type": "Identifier", - "start": 8, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "foo" - }, + "start":8,"end":11,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":11},"identifierName":"foo"}, "name": "foo" }, "exported": { "type": "Identifier", - "start": 15, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 22 - }, - "identifierName": "default" - }, + "start":15,"end":22,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":22},"identifierName":"default"}, "name": "default" } } @@ -99,48 +31,14 @@ }, { "type": "VariableDeclaration", - "start": 25, - "end": 33, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 8 - } - }, + "start":25,"end":33,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":8}}, "declarations": [ { "type": "VariableDeclarator", - "start": 29, - "end": 32, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 7 - } - }, + "start":29,"end":32,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":7}}, "id": { "type": "Identifier", - "start": 29, - "end": 32, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 7 - }, - "identifierName": "foo" - }, + "start":29,"end":32,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":7},"identifierName":"foo"}, "name": "foo" }, "init": null diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-export-declaration/export-named-as-specifier/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-export-declaration/export-named-as-specifier/output.json index 0b8670ce2ef3..410a834f42a2 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-export-declaration/export-named-as-specifier/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-export-declaration/export-named-as-specifier/output.json @@ -1,111 +1,32 @@ { "type": "File", - "start": 0, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 20 - } - }, + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":20}}, "program": { "type": "Program", - "start": 0, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 20 - } - }, + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":20}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":4,"end":7,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":7}}, "id": { "type": "Identifier", - "start": 4, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "foo" - }, + "start":4,"end":7,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":7},"identifierName":"foo"}, "name": "foo" }, "init": null }, { "type": "VariableDeclarator", - "start": 9, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":9,"end":12,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":12}}, "id": { "type": "Identifier", - "start": 9, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "bar" - }, + "start":9,"end":12,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":12},"identifierName":"bar"}, "name": "bar" }, "init": null @@ -115,65 +36,19 @@ }, { "type": "ExportNamedDeclaration", - "start": 14, - "end": 34, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 20 - } - }, + "start":14,"end":34,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":20}}, "specifiers": [ { "type": "ExportSpecifier", - "start": 22, - "end": 32, - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 18 - } - }, + "start":22,"end":32,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":18}}, "local": { "type": "Identifier", - "start": 22, - "end": 25, - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 11 - }, - "identifierName": "foo" - }, + "start":22,"end":25,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":11},"identifierName":"foo"}, "name": "foo" }, "exported": { "type": "Identifier", - "start": 29, - "end": 32, - "loc": { - "start": { - "line": 2, - "column": 15 - }, - "end": { - "line": 2, - "column": 18 - }, - "identifierName": "bar" - }, + "start":29,"end":32,"loc":{"start":{"line":2,"column":15},"end":{"line":2,"column":18},"identifierName":"bar"}, "name": "bar" } } diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-export-declaration/export-named-as-specifiers/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-export-declaration/export-named-as-specifiers/output.json index 2a876f042ed1..25f7c6ea3082 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-export-declaration/export-named-as-specifiers/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-export-declaration/export-named-as-specifiers/output.json @@ -1,144 +1,41 @@ { "type": "File", - "start": 0, - "end": 43, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 13 - } - }, + "start":0,"end":43,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":13}}, "program": { "type": "Program", - "start": 0, - "end": 43, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 13 - } - }, + "start":0,"end":43,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":13}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExportNamedDeclaration", - "start": 0, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, "specifiers": [ { "type": "ExportSpecifier", - "start": 8, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":8,"end":22,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":22}}, "local": { "type": "Identifier", - "start": 8, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "foo" - }, + "start":8,"end":11,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":11},"identifierName":"foo"}, "name": "foo" }, "exported": { "type": "Identifier", - "start": 15, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 22 - }, - "identifierName": "default" - }, + "start":15,"end":22,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":22},"identifierName":"default"}, "name": "default" } }, { "type": "ExportSpecifier", - "start": 24, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":24,"end":27,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":27}}, "local": { "type": "Identifier", - "start": 24, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 27 - }, - "identifierName": "bar" - }, + "start":24,"end":27,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":27},"identifierName":"bar"}, "name": "bar" }, "exported": { "type": "Identifier", - "start": 24, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 27 - }, - "identifierName": "bar" - }, + "start":24,"end":27,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":27},"identifierName":"bar"}, "name": "bar" } } @@ -148,81 +45,24 @@ }, { "type": "VariableDeclaration", - "start": 30, - "end": 43, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 13 - } - }, + "start":30,"end":43,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":13}}, "declarations": [ { "type": "VariableDeclarator", - "start": 34, - "end": 37, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 7 - } - }, + "start":34,"end":37,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":7}}, "id": { "type": "Identifier", - "start": 34, - "end": 37, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 7 - }, - "identifierName": "foo" - }, + "start":34,"end":37,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":7},"identifierName":"foo"}, "name": "foo" }, "init": null }, { "type": "VariableDeclarator", - "start": 39, - "end": 42, - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 12 - } - }, + "start":39,"end":42,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":12}}, "id": { "type": "Identifier", - "start": 39, - "end": 42, - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 12 - }, - "identifierName": "bar" - }, + "start":39,"end":42,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":12},"identifierName":"bar"}, "name": "bar" }, "init": null diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-export-declaration/export-named-empty/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-export-declaration/export-named-empty/output.json index 192d9b03ac11..87c7c4544885 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-export-declaration/export-named-empty/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-export-declaration/export-named-empty/output.json @@ -1,51 +1,18 @@ { "type": "File", - "start": 0, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, "program": { "type": "Program", - "start": 0, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExportNamedDeclaration", - "start": 0, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "declaration": null, + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, "specifiers": [], - "source": null + "source": null, + "declaration": null } ], "directives": [] diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-export-declaration/export-named-specifier/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-export-declaration/export-named-specifier/output.json index 4faa60a28feb..52c7e7e5ec88 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-export-declaration/export-named-specifier/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-export-declaration/export-named-specifier/output.json @@ -1,78 +1,22 @@ { "type": "File", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 13 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":13}}, "program": { "type": "Program", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 13 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":13}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":4,"end":7,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":7}}, "id": { "type": "Identifier", - "start": 4, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "foo" - }, + "start":4,"end":7,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":7},"identifierName":"foo"}, "name": "foo" }, "init": null @@ -82,65 +26,19 @@ }, { "type": "ExportNamedDeclaration", - "start": 9, - "end": 22, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 13 - } - }, + "start":9,"end":22,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":13}}, "specifiers": [ { "type": "ExportSpecifier", - "start": 17, - "end": 20, - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 11 - } - }, + "start":17,"end":20,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":11}}, "local": { "type": "Identifier", - "start": 17, - "end": 20, - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 11 - }, - "identifierName": "foo" - }, + "start":17,"end":20,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":11},"identifierName":"foo"}, "name": "foo" }, "exported": { "type": "Identifier", - "start": 17, - "end": 20, - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 11 - }, - "identifierName": "foo" - }, + "start":17,"end":20,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":11},"identifierName":"foo"}, "name": "foo" } } diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-export-declaration/export-named-specifiers-comma/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-export-declaration/export-named-specifiers-comma/output.json index 3616570c157d..1fba409df4b9 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-export-declaration/export-named-specifiers-comma/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-export-declaration/export-named-specifiers-comma/output.json @@ -1,78 +1,22 @@ { "type": "File", - "start": 0, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 8 - } - }, + "start":0,"end":37,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":8}}, "program": { "type": "Program", - "start": 0, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 8 - } - }, + "start":0,"end":37,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":8}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":4,"end":7,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":7}}, "id": { "type": "Identifier", - "start": 4, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "bar" - }, + "start":4,"end":7,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":7},"identifierName":"bar"}, "name": "bar" }, "init": null @@ -82,114 +26,33 @@ }, { "type": "ExportNamedDeclaration", - "start": 9, - "end": 28, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 19 - } - }, + "start":9,"end":28,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":19}}, "specifiers": [ { "type": "ExportSpecifier", - "start": 17, - "end": 20, - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 11 - } - }, + "start":17,"end":20,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":11}}, "local": { "type": "Identifier", - "start": 17, - "end": 20, - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 11 - }, - "identifierName": "foo" - }, + "start":17,"end":20,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":11},"identifierName":"foo"}, "name": "foo" }, "exported": { "type": "Identifier", - "start": 17, - "end": 20, - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 11 - }, - "identifierName": "foo" - }, + "start":17,"end":20,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":11},"identifierName":"foo"}, "name": "foo" } }, { "type": "ExportSpecifier", - "start": 22, - "end": 25, - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 16 - } - }, + "start":22,"end":25,"loc":{"start":{"line":2,"column":13},"end":{"line":2,"column":16}}, "local": { "type": "Identifier", - "start": 22, - "end": 25, - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 16 - }, - "identifierName": "bar" - }, + "start":22,"end":25,"loc":{"start":{"line":2,"column":13},"end":{"line":2,"column":16},"identifierName":"bar"}, "name": "bar" }, "exported": { "type": "Identifier", - "start": 22, - "end": 25, - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 16 - }, - "identifierName": "bar" - }, + "start":22,"end":25,"loc":{"start":{"line":2,"column":13},"end":{"line":2,"column":16},"identifierName":"bar"}, "name": "bar" } } @@ -199,48 +62,14 @@ }, { "type": "VariableDeclaration", - "start": 29, - "end": 37, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 8 - } - }, + "start":29,"end":37,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":8}}, "declarations": [ { "type": "VariableDeclarator", - "start": 33, - "end": 36, - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 7 - } - }, + "start":33,"end":36,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":7}}, "id": { "type": "Identifier", - "start": 33, - "end": 36, - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 7 - }, - "identifierName": "foo" - }, + "start":33,"end":36,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":7},"identifierName":"foo"}, "name": "foo" }, "init": null diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-export-declaration/export-named-specifiers/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-export-declaration/export-named-specifiers/output.json index 51d2d56a1f4d..e5ffeb5b049a 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-export-declaration/export-named-specifiers/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-export-declaration/export-named-specifiers/output.json @@ -1,78 +1,22 @@ { "type": "File", - "start": 0, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 8 - } - }, + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":8}}, "program": { "type": "Program", - "start": 0, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 8 - } - }, + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":8}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":4,"end":7,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":7}}, "id": { "type": "Identifier", - "start": 4, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "foo" - }, + "start":4,"end":7,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":7},"identifierName":"foo"}, "name": "foo" }, "init": null @@ -82,114 +26,33 @@ }, { "type": "ExportNamedDeclaration", - "start": 9, - "end": 27, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 18 - } - }, + "start":9,"end":27,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":18}}, "specifiers": [ { "type": "ExportSpecifier", - "start": 17, - "end": 20, - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 11 - } - }, + "start":17,"end":20,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":11}}, "local": { "type": "Identifier", - "start": 17, - "end": 20, - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 11 - }, - "identifierName": "foo" - }, + "start":17,"end":20,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":11},"identifierName":"foo"}, "name": "foo" }, "exported": { "type": "Identifier", - "start": 17, - "end": 20, - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 11 - }, - "identifierName": "foo" - }, + "start":17,"end":20,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":11},"identifierName":"foo"}, "name": "foo" } }, { "type": "ExportSpecifier", - "start": 22, - "end": 25, - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 16 - } - }, + "start":22,"end":25,"loc":{"start":{"line":2,"column":13},"end":{"line":2,"column":16}}, "local": { "type": "Identifier", - "start": 22, - "end": 25, - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 16 - }, - "identifierName": "bar" - }, + "start":22,"end":25,"loc":{"start":{"line":2,"column":13},"end":{"line":2,"column":16},"identifierName":"bar"}, "name": "bar" }, "exported": { "type": "Identifier", - "start": 22, - "end": 25, - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 16 - }, - "identifierName": "bar" - }, + "start":22,"end":25,"loc":{"start":{"line":2,"column":13},"end":{"line":2,"column":16},"identifierName":"bar"}, "name": "bar" } } @@ -199,48 +62,14 @@ }, { "type": "VariableDeclaration", - "start": 28, - "end": 36, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 8 - } - }, + "start":28,"end":36,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":8}}, "declarations": [ { "type": "VariableDeclarator", - "start": 32, - "end": 35, - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 7 - } - }, + "start":32,"end":35,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":7}}, "id": { "type": "Identifier", - "start": 32, - "end": 35, - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 7 - }, - "identifierName": "bar" - }, + "start":32,"end":35,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":7},"identifierName":"bar"}, "name": "bar" }, "init": null diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-export-declaration/export-var-anonymous-function/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-export-declaration/export-var-anonymous-function/output.json index 23fac0d03dc9..252bc32b2ef5 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-export-declaration/export-var-anonymous-function/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-export-declaration/export-var-anonymous-function/output.json @@ -1,128 +1,39 @@ { "type": "File", - "start": 0, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, "program": { "type": "Program", - "start": 0, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExportNamedDeclaration", - "start": 0, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, "specifiers": [], "source": null, "declaration": { "type": "VariableDeclaration", - "start": 7, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":7,"end":32,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":32}}, "declarations": [ { "type": "VariableDeclarator", - "start": 11, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":11,"end":31,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":31}}, "id": { "type": "Identifier", - "start": 11, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 14 - }, - "identifierName": "foo" - }, + "start":11,"end":14,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":14},"identifierName":"foo"}, "name": "foo" }, "init": { "type": "FunctionExpression", - "start": 17, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":17,"end":31,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":31}}, "id": null, "generator": false, "async": false, "params": [], "body": { "type": "BlockStatement", - "start": 29, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":29,"end":31,"loc":{"start":{"line":1,"column":29},"end":{"line":1,"column":31}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-export-declaration/export-var-number/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-export-declaration/export-var-number/output.json index cb95fa84a121..d59a3ac4ccd3 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-export-declaration/export-var-number/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-export-declaration/export-var-number/output.json @@ -1,110 +1,32 @@ { "type": "File", - "start": 0, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, "program": { "type": "Program", - "start": 0, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExportNamedDeclaration", - "start": 0, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, "specifiers": [], "source": null, "declaration": { "type": "VariableDeclaration", - "start": 7, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":7,"end":19,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":19}}, "declarations": [ { "type": "VariableDeclarator", - "start": 11, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":11,"end":18,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":18}}, "id": { "type": "Identifier", - "start": 11, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 14 - }, - "identifierName": "foo" - }, + "start":11,"end":14,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":14},"identifierName":"foo"}, "name": "foo" }, "init": { "type": "NumericLiteral", - "start": 17, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":17,"end":18,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":18}}, "extra": { "rawValue": 1, "raw": "1" diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-export-declaration/export-var/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-export-declaration/export-var/output.json index ae44c6412927..bb61a86de494 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-export-declaration/export-var/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-export-declaration/export-var/output.json @@ -1,94 +1,27 @@ { "type": "File", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "program": { "type": "Program", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExportNamedDeclaration", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "specifiers": [], "source": null, "declaration": { "type": "VariableDeclaration", - "start": 7, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":7,"end":15,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":15}}, "declarations": [ { "type": "VariableDeclarator", - "start": 11, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":11,"end":14,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":14}}, "id": { "type": "Identifier", - "start": 11, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 14 - }, - "identifierName": "bar" - }, + "start":11,"end":14,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":14},"identifierName":"bar"}, "name": "bar" }, "init": null diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-export-declaration/invalid-export-default-token/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-export-declaration/invalid-export-default-token/options.json index b6ce2c43af87..8c1430963ecf 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-export-declaration/invalid-export-default-token/options.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-export-declaration/invalid-export-default-token/options.json @@ -1,4 +1,4 @@ { "sourceType": "module", "throws": "Unexpected token, expected \";\" (1:17)" -} \ No newline at end of file +} diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-export-declaration/invalid-export-named-default/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-export-declaration/invalid-export-named-default/options.json index e03d273fdcd5..2104ca43283f 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-export-declaration/invalid-export-named-default/options.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-export-declaration/invalid-export-named-default/options.json @@ -1,4 +1,3 @@ { - "sourceType": "module", - "throws": "Unexpected keyword 'default' (1:8)" -} \ No newline at end of file + "sourceType": "module" +} diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-export-declaration/invalid-export-named-default/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-export-declaration/invalid-export-named-default/output.json new file mode 100644 index 000000000000..8d53b1d88989 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-export-declaration/invalid-export-named-default/output.json @@ -0,0 +1,39 @@ +{ + "type": "File", + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, + "errors": [ + "SyntaxError: Unexpected keyword 'default' (1:8)", + "SyntaxError: Export 'default' is not defined (1:8)" + ], + "program": { + "type": "Program", + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExportNamedDeclaration", + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, + "specifiers": [ + { + "type": "ExportSpecifier", + "start":8,"end":15,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":15}}, + "local": { + "type": "Identifier", + "start":8,"end":15,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":15},"identifierName":"default"}, + "name": "default" + }, + "exported": { + "type": "Identifier", + "start":8,"end":15,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":15},"identifierName":"default"}, + "name": "default" + } + } + ], + "source": null, + "declaration": null + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-for-of/for-of-array-pattern-let/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-for-of/for-of-array-pattern-let/output.json index c05eb9cca9a4..197b3818fcc6 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-for-of/for-of-array-pattern-let/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-for-of/for-of-array-pattern-let/output.json @@ -1,125 +1,35 @@ { "type": "File", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "program": { "type": "Program", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ForOfStatement", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "await": false, "left": { "type": "VariableDeclaration", - "start": 5, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":5,"end":15,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":15}}, "declarations": [ { "type": "VariableDeclarator", - "start": 9, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":9,"end":15,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":15}}, "id": { "type": "ArrayPattern", - "start": 9, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":9,"end":15,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":15}}, "elements": [ { "type": "Identifier", - "start": 10, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "p" - }, + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11},"identifierName":"p"}, "name": "p" }, { "type": "Identifier", - "start": 13, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - }, - "identifierName": "q" - }, + "start":13,"end":14,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":14},"identifierName":"q"}, "name": "q" } ] @@ -131,35 +41,12 @@ }, "right": { "type": "Identifier", - "start": 19, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 20 - }, - "identifierName": "r" - }, + "start":19,"end":20,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":20},"identifierName":"r"}, "name": "r" }, "body": { "type": "EmptyStatement", - "start": 21, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 22 - } - } + "start":21,"end":22,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":22}} } } ], diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-for-of/for-of-array-pattern/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-for-of/for-of-array-pattern/output.json index 4f401a2e09be..ff6db0c80887 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-for-of/for-of-array-pattern/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-for-of/for-of-array-pattern/output.json @@ -1,131 +1,40 @@ { "type": "File", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, "program": { "type": "Program", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ForOfStatement", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, "await": false, "left": { "type": "ArrayPattern", - "start": 5, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":5,"end":11,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":11}}, "elements": [ { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "p" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"p"}, "name": "p" }, { "type": "Identifier", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - }, - "identifierName": "q" - }, + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"q"}, "name": "q" } ] }, "right": { "type": "Identifier", - "start": 15, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - }, - "identifierName": "r" - }, + "start":15,"end":16,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":16},"identifierName":"r"}, "name": "r" }, "body": { "type": "EmptyStatement", - "start": 17, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - } - } + "start":17,"end":18,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":18}} } } ], diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-for-of/for-of-object-pattern-const/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-for-of/for-of-object-pattern-const/output.json index 8d59901e297f..c38f51d39c96 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-for-of/for-of-object-pattern-const/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-for-of/for-of-object-pattern-const/output.json @@ -1,142 +1,41 @@ { "type": "File", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "program": { "type": "Program", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ForOfStatement", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "await": false, "left": { "type": "VariableDeclaration", - "start": 5, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":5,"end":17,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":17}}, "declarations": [ { "type": "VariableDeclarator", - "start": 11, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":11,"end":17,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":17}}, "id": { "type": "ObjectPattern", - "start": 11, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":11,"end":17,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":17}}, "properties": [ { "type": "ObjectProperty", - "start": 12, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":12,"end":13,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":13}}, "method": false, "key": { "type": "Identifier", - "start": 12, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - }, - "identifierName": "x" - }, + "start":12,"end":13,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":13},"identifierName":"x"}, "name": "x" }, "computed": false, "shorthand": true, "value": { "type": "Identifier", - "start": 12, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - }, - "identifierName": "x" - }, + "start":12,"end":13,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":13},"identifierName":"x"}, "name": "x" }, "extra": { @@ -145,53 +44,18 @@ }, { "type": "ObjectProperty", - "start": 15, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":15,"end":16,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":16}}, "method": false, "key": { "type": "Identifier", - "start": 15, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - }, - "identifierName": "y" - }, + "start":15,"end":16,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":16},"identifierName":"y"}, "name": "y" }, "computed": false, "shorthand": true, "value": { "type": "Identifier", - "start": 15, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - }, - "identifierName": "y" - }, + "start":15,"end":16,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":16},"identifierName":"y"}, "name": "y" }, "extra": { @@ -207,35 +71,12 @@ }, "right": { "type": "Identifier", - "start": 21, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 22 - }, - "identifierName": "z" - }, + "start":21,"end":22,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":22},"identifierName":"z"}, "name": "z" }, "body": { "type": "EmptyStatement", - "start": 23, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 24 - } - } + "start":23,"end":24,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":24}} } } ], diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-for-of/for-of-object-pattern/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-for-of/for-of-object-pattern/output.json index 8bdd5bd10e81..663ab85c8f54 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-for-of/for-of-object-pattern/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-for-of/for-of-object-pattern/output.json @@ -1,113 +1,34 @@ { "type": "File", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, "program": { "type": "Program", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ForOfStatement", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, "await": false, "left": { "type": "ObjectPattern", - "start": 5, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":5,"end":11,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":11}}, "properties": [ { "type": "ObjectProperty", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7}}, "method": false, "key": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "x" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"x"}, "name": "x" }, "computed": false, "shorthand": true, "value": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "x" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"x"}, "name": "x" }, "extra": { @@ -116,53 +37,18 @@ }, { "type": "ObjectProperty", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10}}, "method": false, "key": { "type": "Identifier", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - }, - "identifierName": "y" - }, + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"y"}, "name": "y" }, "computed": false, "shorthand": true, "value": { "type": "Identifier", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - }, - "identifierName": "y" - }, + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"y"}, "name": "y" }, "extra": { @@ -173,35 +59,12 @@ }, "right": { "type": "Identifier", - "start": 15, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - }, - "identifierName": "z" - }, + "start":15,"end":16,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":16},"identifierName":"z"}, "name": "z" }, "body": { "type": "EmptyStatement", - "start": 17, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - } - } + "start":17,"end":18,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":18}} } } ], diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-for-of/for-of-with-const/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-for-of/for-of-with-const/output.json index 6e16548c21de..62a4545231d5 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-for-of/for-of-with-const/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-for-of/for-of-with-const/output.json @@ -1,93 +1,26 @@ { "type": "File", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "program": { "type": "Program", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ForOfStatement", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "await": false, "left": { "type": "VariableDeclaration", - "start": 5, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":5,"end":12,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":12}}, "declarations": [ { "type": "VariableDeclarator", - "start": 11, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":11,"end":12,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":12}}, "id": { "type": "Identifier", - "start": 11, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "y" - }, + "start":11,"end":12,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":12},"identifierName":"y"}, "name": "y" }, "init": null @@ -97,35 +30,12 @@ }, "right": { "type": "Identifier", - "start": 16, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 20 - }, - "identifierName": "list" - }, + "start":16,"end":20,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":20},"identifierName":"list"}, "name": "list" }, "body": { "type": "EmptyStatement", - "start": 21, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 22 - } - } + "start":21,"end":22,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":22}} } } ], diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-for-of/for-of-with-let/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-for-of/for-of-with-let/output.json index 9d64e35ce8b8..a8974a6dfd01 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-for-of/for-of-with-let/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-for-of/for-of-with-let/output.json @@ -1,93 +1,26 @@ { "type": "File", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, "program": { "type": "Program", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ForOfStatement", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, "await": false, "left": { "type": "VariableDeclaration", - "start": 5, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":5,"end":10,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":10}}, "declarations": [ { "type": "VariableDeclarator", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10}}, "id": { "type": "Identifier", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - }, - "identifierName": "z" - }, + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"z"}, "name": "z" }, "init": null @@ -97,35 +30,12 @@ }, "right": { "type": "Identifier", - "start": 14, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 18 - }, - "identifierName": "list" - }, + "start":14,"end":18,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":18},"identifierName":"list"}, "name": "list" }, "body": { "type": "EmptyStatement", - "start": 19, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 20 - } - } + "start":19,"end":20,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":20}} } } ], diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-for-of/for-of-with-var/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-for-of/for-of-with-var/output.json index c8b1fbfd9650..b338da14dbc9 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-for-of/for-of-with-var/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-for-of/for-of-with-var/output.json @@ -1,93 +1,26 @@ { "type": "File", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, "program": { "type": "Program", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ForOfStatement", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, "await": false, "left": { "type": "VariableDeclaration", - "start": 5, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":5,"end":10,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":10}}, "declarations": [ { "type": "VariableDeclarator", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10}}, "id": { "type": "Identifier", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - }, - "identifierName": "x" - }, + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"x"}, "name": "x" }, "init": null @@ -97,35 +30,12 @@ }, "right": { "type": "Identifier", - "start": 14, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 18 - }, - "identifierName": "list" - }, + "start":14,"end":18,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":18},"identifierName":"list"}, "name": "list" }, "body": { "type": "EmptyStatement", - "start": 19, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 20 - } - } + "start":19,"end":20,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":20}} } } ], diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-for-of/for-of/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-for-of/for-of/output.json index 11ce457a83b5..ea41120a3ed3 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-for-of/for-of/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-for-of/for-of/output.json @@ -1,97 +1,29 @@ { "type": "File", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "program": { "type": "Program", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ForOfStatement", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "await": false, "left": { "type": "Identifier", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "p" - }, + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"p"}, "name": "p" }, "right": { "type": "Identifier", - "start": 10, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "q" - }, + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11},"identifierName":"q"}, "name": "q" }, "body": { "type": "EmptyStatement", - "start": 12, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - } + "start":12,"end":13,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":13}} } } ], diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-for-of/invalid-const-init/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-for-of/invalid-const-init/options.json deleted file mode 100644 index c145a86bc613..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-for-of/invalid-const-init/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "for-of loop variable declaration may not have an initializer (1:5)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-for-of/invalid-const-init/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-for-of/invalid-const-init/output.json new file mode 100644 index 000000000000..6ddebf209368 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-for-of/invalid-const-init/output.json @@ -0,0 +1,55 @@ +{ + "type": "File", + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, + "errors": [ + "SyntaxError: for-of loop variable declaration may not have an initializer (1:5)" + ], + "program": { + "type": "Program", + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ForOfStatement", + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, + "await": false, + "left": { + "type": "VariableDeclaration", + "start":5,"end":16,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":16}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":11,"end":16,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":16}}, + "id": { + "type": "Identifier", + "start":11,"end":12,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":12},"identifierName":"x"}, + "name": "x" + }, + "init": { + "type": "NumericLiteral", + "start":15,"end":16,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":16}}, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + ], + "kind": "const" + }, + "right": { + "type": "Identifier", + "start":20,"end":21,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":21},"identifierName":"y"}, + "name": "y" + }, + "body": { + "type": "EmptyStatement", + "start":22,"end":23,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":23}} + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-for-of/invalid-let-init/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-for-of/invalid-let-init/options.json deleted file mode 100644 index c145a86bc613..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-for-of/invalid-let-init/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "for-of loop variable declaration may not have an initializer (1:5)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-for-of/invalid-let-init/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-for-of/invalid-let-init/output.json new file mode 100644 index 000000000000..a98d3e9a56df --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-for-of/invalid-let-init/output.json @@ -0,0 +1,55 @@ +{ + "type": "File", + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, + "errors": [ + "SyntaxError: for-of loop variable declaration may not have an initializer (1:5)" + ], + "program": { + "type": "Program", + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ForOfStatement", + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, + "await": false, + "left": { + "type": "VariableDeclaration", + "start":5,"end":14,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":14}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":9,"end":14,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":14}}, + "id": { + "type": "Identifier", + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"x"}, + "name": "x" + }, + "init": { + "type": "NumericLiteral", + "start":13,"end":14,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":14}}, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + ], + "kind": "let" + }, + "right": { + "type": "Identifier", + "start":18,"end":19,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":19},"identifierName":"y"}, + "name": "y" + }, + "body": { + "type": "EmptyStatement", + "start":20,"end":21,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":21}} + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-for-of/invalid-lhs-init/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-for-of/invalid-lhs-init/options.json deleted file mode 100644 index a4dd545935e8..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-for-of/invalid-lhs-init/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid left-hand side in for-of statement (1:5)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-for-of/invalid-lhs-init/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-for-of/invalid-lhs-init/output.json new file mode 100644 index 000000000000..e48c18d4d102 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-for-of/invalid-lhs-init/output.json @@ -0,0 +1,34 @@ +{ + "type": "File", + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, + "errors": [ + "SyntaxError: Invalid left-hand side in for-of statement (1:5)" + ], + "program": { + "type": "Program", + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ForOfStatement", + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, + "await": false, + "left": { + "type": "ThisExpression", + "start":5,"end":9,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":9}} + }, + "right": { + "type": "Identifier", + "start":13,"end":17,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":17},"identifierName":"that"}, + "name": "that" + }, + "body": { + "type": "EmptyStatement", + "start":18,"end":19,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":19}} + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-for-of/invalid-var-init/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-for-of/invalid-var-init/options.json deleted file mode 100644 index c145a86bc613..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-for-of/invalid-var-init/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "for-of loop variable declaration may not have an initializer (1:5)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-for-of/invalid-var-init/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-for-of/invalid-var-init/output.json new file mode 100644 index 000000000000..9c90d03acc48 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-for-of/invalid-var-init/output.json @@ -0,0 +1,55 @@ +{ + "type": "File", + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, + "errors": [ + "SyntaxError: for-of loop variable declaration may not have an initializer (1:5)" + ], + "program": { + "type": "Program", + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ForOfStatement", + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, + "await": false, + "left": { + "type": "VariableDeclaration", + "start":5,"end":14,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":14}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":9,"end":14,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":14}}, + "id": { + "type": "Identifier", + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"x"}, + "name": "x" + }, + "init": { + "type": "NumericLiteral", + "start":13,"end":14,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":14}}, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + ], + "kind": "var" + }, + "right": { + "type": "Identifier", + "start":18,"end":19,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":19},"identifierName":"y"}, + "name": "y" + }, + "body": { + "type": "EmptyStatement", + "start":20,"end":21,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":21}} + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-for-of/let-of-of/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-for-of/let-of-of/output.json index da544e66fa93..176eeaabd335 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-for-of/let-of-of/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-for-of/let-of-of/output.json @@ -1,93 +1,26 @@ { "type": "File", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, "program": { "type": "Program", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ForOfStatement", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, "await": false, "left": { "type": "VariableDeclaration", - "start": 5, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":5,"end":11,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":11}}, "declarations": [ { "type": "VariableDeclarator", - "start": 9, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":9,"end":11,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":11}}, "id": { "type": "Identifier", - "start": 9, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "of" - }, + "start":9,"end":11,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":11},"identifierName":"of"}, "name": "of" }, "init": null @@ -97,35 +30,12 @@ }, "right": { "type": "Identifier", - "start": 15, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 18 - }, - "identifierName": "xyz" - }, + "start":15,"end":18,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":18},"identifierName":"xyz"}, "name": "xyz" }, "body": { "type": "EmptyStatement", - "start": 19, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 20 - } - } + "start":19,"end":20,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":20}} } } ], diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-generator/generator-declaration-with-params/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-generator/generator-declaration-with-params/output.json index 91ec774a75a0..c525c475d0c6 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-generator/generator-declaration-with-params/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-generator/generator-declaration-with-params/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, "program": { "type": "Program", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, "id": { "type": "Identifier", - "start": 10, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 13 - }, - "identifierName": "foo" - }, + "start":10,"end":13,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":13},"identifierName":"foo"}, "name": "foo" }, "generator": true, @@ -65,70 +20,23 @@ "params": [ { "type": "Identifier", - "start": 14, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - }, - "identifierName": "x" - }, + "start":14,"end":15,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":15},"identifierName":"x"}, "name": "x" }, { "type": "Identifier", - "start": 17, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - }, - "identifierName": "y" - }, + "start":17,"end":18,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":18},"identifierName":"y"}, "name": "y" }, { "type": "Identifier", - "start": 20, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 21 - }, - "identifierName": "z" - }, + "start":20,"end":21,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":21},"identifierName":"z"}, "name": "z" } ], "body": { "type": "BlockStatement", - "start": 23, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":23,"end":25,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":25}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-generator/generator-declaration-with-yield-delegate/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-generator/generator-declaration-with-yield-delegate/output.json index 0436a729d413..222f1fe29391 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-generator/generator-declaration-with-yield-delegate/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-generator/generator-declaration-with-yield-delegate/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, "program": { "type": "Program", - "start": 0, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, "id": { "type": "Identifier", - "start": 10, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 13 - }, - "identifierName": "foo" - }, + "start":10,"end":13,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":13},"identifierName":"foo"}, "name": "foo" }, "generator": true, @@ -65,62 +20,18 @@ "params": [], "body": { "type": "BlockStatement", - "start": 16, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":16,"end":29,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":29}}, "body": [ { "type": "ExpressionStatement", - "start": 18, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":18,"end":27,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":27}}, "expression": { "type": "YieldExpression", - "start": 18, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":18,"end":26,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":26}}, "delegate": true, "argument": { "type": "NumericLiteral", - "start": 25, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":25,"end":26,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":26}}, "extra": { "rawValue": 3, "raw": "3" diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-generator/generator-declaration-with-yield/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-generator/generator-declaration-with-yield/output.json index 0b14ec63ddcb..8dba9139bc31 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-generator/generator-declaration-with-yield/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-generator/generator-declaration-with-yield/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, "program": { "type": "Program", - "start": 0, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, "id": { "type": "Identifier", - "start": 10, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 13 - }, - "identifierName": "foo" - }, + "start":10,"end":13,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":13},"identifierName":"foo"}, "name": "foo" }, "generator": true, @@ -65,62 +20,18 @@ "params": [], "body": { "type": "BlockStatement", - "start": 16, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":16,"end":28,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":28}}, "body": [ { "type": "ExpressionStatement", - "start": 18, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":18,"end":26,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":26}}, "expression": { "type": "YieldExpression", - "start": 18, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":18,"end":25,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":25}}, "delegate": false, "argument": { "type": "NumericLiteral", - "start": 24, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":24,"end":25,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":25}}, "extra": { "rawValue": 3, "raw": "3" diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-generator/generator-declaration/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-generator/generator-declaration/output.json index 8a6d8362f00a..b8d0ba2285b6 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-generator/generator-declaration/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-generator/generator-declaration/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, "program": { "type": "Program", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, "id": { "type": "Identifier", - "start": 10, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 13 - }, - "identifierName": "foo" - }, + "start":10,"end":13,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":13},"identifierName":"foo"}, "name": "foo" }, "generator": true, @@ -65,18 +20,7 @@ "params": [], "body": { "type": "BlockStatement", - "start": 16, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":16,"end":18,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":18}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-generator/generator-expression-rest-param/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-generator/generator-expression-rest-param/output.json index 5b70bb51c5f9..eeb0e8d87a9d 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-generator/generator-expression-rest-param/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-generator/generator-expression-rest-param/output.json @@ -1,113 +1,35 @@ { "type": "File", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, "program": { "type": "Program", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, "expression": { "type": "FunctionExpression", - "start": 1, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":1,"end":19,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":19}}, "id": null, "generator": true, "async": false, "params": [ { "type": "RestElement", - "start": 11, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":11,"end":15,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":15}}, "argument": { "type": "Identifier", - "start": 14, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - }, - "identifierName": "x" - }, + "start":14,"end":15,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":15},"identifierName":"x"}, "name": "x" } } ], "body": { "type": "BlockStatement", - "start": 17, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":17,"end":19,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":19}}, "body": [], "directives": [] }, diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-generator/generator-expression-with-params/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-generator/generator-expression-with-params/output.json index 3ef0daf02c91..90facc9d5c61 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-generator/generator-expression-with-params/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-generator/generator-expression-with-params/output.json @@ -1,132 +1,41 @@ { "type": "File", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "program": { "type": "Program", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "expression": { "type": "FunctionExpression", - "start": 1, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":1,"end":22,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":22}}, "id": null, "generator": true, "async": false, "params": [ { "type": "Identifier", - "start": 11, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "x" - }, + "start":11,"end":12,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":12},"identifierName":"x"}, "name": "x" }, { "type": "Identifier", - "start": 14, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - }, - "identifierName": "y" - }, + "start":14,"end":15,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":15},"identifierName":"y"}, "name": "y" }, { "type": "Identifier", - "start": 17, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - }, - "identifierName": "z" - }, + "start":17,"end":18,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":18},"identifierName":"z"}, "name": "z" } ], "body": { "type": "BlockStatement", - "start": 20, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":20,"end":22,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":22}}, "body": [], "directives": [] }, diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-generator/generator-expression-with-yield-delegate/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-generator/generator-expression-with-yield-delegate/output.json index 9d5919d1e5c8..4171fb619cd3 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-generator/generator-expression-with-yield-delegate/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-generator/generator-expression-with-yield-delegate/output.json @@ -1,177 +1,52 @@ { "type": "File", - "start": 0, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, "program": { "type": "Program", - "start": 0, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, "expression": { "type": "FunctionExpression", - "start": 1, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":1,"end":33,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":33}}, "id": null, "generator": true, "async": false, "params": [ { "type": "Identifier", - "start": 11, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "x" - }, + "start":11,"end":12,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":12},"identifierName":"x"}, "name": "x" }, { "type": "Identifier", - "start": 14, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - }, - "identifierName": "y" - }, + "start":14,"end":15,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":15},"identifierName":"y"}, "name": "y" }, { "type": "Identifier", - "start": 17, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - }, - "identifierName": "z" - }, + "start":17,"end":18,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":18},"identifierName":"z"}, "name": "z" } ], "body": { "type": "BlockStatement", - "start": 20, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":20,"end":33,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":33}}, "body": [ { "type": "ExpressionStatement", - "start": 22, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":22,"end":31,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":31}}, "expression": { "type": "YieldExpression", - "start": 22, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":22,"end":30,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":30}}, "delegate": true, "argument": { "type": "Identifier", - "start": 29, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 1, - "column": 30 - }, - "identifierName": "x" - }, + "start":29,"end":30,"loc":{"start":{"line":1,"column":29},"end":{"line":1,"column":30},"identifierName":"x"}, "name": "x" } } diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-generator/generator-expression-with-yield/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-generator/generator-expression-with-yield/output.json index 97e545959738..27892c16d301 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-generator/generator-expression-with-yield/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-generator/generator-expression-with-yield/output.json @@ -1,124 +1,36 @@ { "type": "File", - "start": 0, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, "program": { "type": "Program", - "start": 0, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, "expression": { "type": "FunctionExpression", - "start": 1, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":1,"end":25,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":25}}, "id": null, "generator": true, "async": false, "params": [], "body": { "type": "BlockStatement", - "start": 13, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":13,"end":25,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":25}}, "body": [ { "type": "ExpressionStatement", - "start": 15, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":15,"end":23,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":23}}, "expression": { "type": "YieldExpression", - "start": 15, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":15,"end":22,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":22}}, "delegate": false, "argument": { "type": "NumericLiteral", - "start": 21, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":21,"end":22,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":22}}, "extra": { "rawValue": 3, "raw": "3" diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-generator/generator-expression/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-generator/generator-expression/output.json index 866b55c382f0..c0bd452fc4e4 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-generator/generator-expression/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-generator/generator-expression/output.json @@ -1,80 +1,25 @@ { "type": "File", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "program": { "type": "Program", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "expression": { "type": "FunctionExpression", - "start": 1, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":1,"end":15,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":15}}, "id": null, "generator": true, "async": false, "params": [], "body": { "type": "BlockStatement", - "start": 13, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":13,"end":15,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":15}}, "body": [], "directives": [] }, diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-generator/generator-method-with-computed-name/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-generator/generator-method-with-computed-name/output.json index 2da9d7230aeb..775e150a30b9 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-generator/generator-method-with-computed-name/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-generator/generator-method-with-computed-name/output.json @@ -1,156 +1,45 @@ { "type": "File", - "start": 0, - "end": 51, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 2 - } - }, + "start":0,"end":51,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":2}}, "program": { "type": "Program", - "start": 0, - "end": 51, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 2 - } - }, + "start":0,"end":51,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":2}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 51, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 2 - } - }, + "start":0,"end":51,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":2}}, "expression": { "type": "FunctionExpression", - "start": 1, - "end": 50, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":1,"end":50,"loc":{"start":{"line":1,"column":1},"end":{"line":3,"column":1}}, "id": null, "generator": true, "async": false, "params": [], "body": { "type": "BlockStatement", - "start": 13, - "end": 50, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":13,"end":50,"loc":{"start":{"line":1,"column":13},"end":{"line":3,"column":1}}, "body": [ { "type": "ReturnStatement", - "start": 19, - "end": 48, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 33 - } - }, + "start":19,"end":48,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":33}}, "argument": { "type": "ObjectExpression", - "start": 26, - "end": 48, - "loc": { - "start": { - "line": 2, - "column": 11 - }, - "end": { - "line": 2, - "column": 33 - } - }, + "start":26,"end":48,"loc":{"start":{"line":2,"column":11},"end":{"line":2,"column":33}}, "properties": [ { "type": "ObjectMethod", - "start": 28, - "end": 46, - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 31 - } - }, + "start":28,"end":46,"loc":{"start":{"line":2,"column":13},"end":{"line":2,"column":31}}, "method": true, "computed": true, "key": { "type": "YieldExpression", - "start": 30, - "end": 40, - "loc": { - "start": { - "line": 2, - "column": 15 - }, - "end": { - "line": 2, - "column": 25 - } - }, + "start":30,"end":40,"loc":{"start":{"line":2,"column":15},"end":{"line":2,"column":25}}, "delegate": false, "argument": { "type": "Identifier", - "start": 36, - "end": 40, - "loc": { - "start": { - "line": 2, - "column": 21 - }, - "end": { - "line": 2, - "column": 25 - }, - "identifierName": "iter" - }, + "start":36,"end":40,"loc":{"start":{"line":2,"column":21},"end":{"line":2,"column":25},"identifierName":"iter"}, "name": "iter" } }, @@ -161,18 +50,7 @@ "params": [], "body": { "type": "BlockStatement", - "start": 44, - "end": 46, - "loc": { - "start": { - "line": 2, - "column": 29 - }, - "end": { - "line": 2, - "column": 31 - } - }, + "start":44,"end":46,"loc":{"start":{"line":2,"column":29},"end":{"line":2,"column":31}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-generator/generator-method-with-params/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-generator/generator-method-with-params/output.json index 9ae0c2e522aa..11f4540942c4 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-generator/generator-method-with-params/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-generator/generator-method-with-params/output.json @@ -1,93 +1,26 @@ { "type": "File", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "program": { "type": "Program", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "expression": { "type": "ObjectExpression", - "start": 1, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":1,"end":21,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":21}}, "properties": [ { "type": "ObjectMethod", - "start": 3, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":3,"end":19,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":19}}, "method": true, "key": { "type": "Identifier", - "start": 4, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "foo" - }, + "start":4,"end":7,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":7},"identifierName":"foo"}, "name": "foo" }, "computed": false, @@ -98,70 +31,23 @@ "params": [ { "type": "Identifier", - "start": 8, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "x" - }, + "start":8,"end":9,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":9},"identifierName":"x"}, "name": "x" }, { "type": "Identifier", - "start": 11, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "y" - }, + "start":11,"end":12,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":12},"identifierName":"y"}, "name": "y" }, { "type": "Identifier", - "start": 14, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - }, - "identifierName": "z" - }, + "start":14,"end":15,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":15},"identifierName":"z"}, "name": "z" } ], "body": { "type": "BlockStatement", - "start": 17, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":17,"end":19,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":19}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-generator/generator-method-with-yield-delegate/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-generator/generator-method-with-yield-delegate/output.json index 977b214148fa..8e4f99d303d8 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-generator/generator-method-with-yield-delegate/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-generator/generator-method-with-yield-delegate/output.json @@ -1,93 +1,26 @@ { "type": "File", - "start": 0, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, "program": { "type": "Program", - "start": 0, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, "expression": { "type": "ObjectExpression", - "start": 1, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":1,"end":25,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":25}}, "properties": [ { "type": "ObjectMethod", - "start": 3, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":3,"end":23,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":23}}, "method": true, "key": { "type": "Identifier", - "start": 4, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "foo" - }, + "start":4,"end":7,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":7},"identifierName":"foo"}, "name": "foo" }, "computed": false, @@ -98,62 +31,18 @@ "params": [], "body": { "type": "BlockStatement", - "start": 10, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":10,"end":23,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":23}}, "body": [ { "type": "ExpressionStatement", - "start": 12, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":12,"end":21,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":21}}, "expression": { "type": "YieldExpression", - "start": 12, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":12,"end":20,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":20}}, "delegate": true, "argument": { "type": "NumericLiteral", - "start": 19, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":19,"end":20,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":20}}, "extra": { "rawValue": 3, "raw": "3" diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-generator/generator-method-with-yield-expression/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-generator/generator-method-with-yield-expression/output.json index d1fc512f80f3..901a4601f9f5 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-generator/generator-method-with-yield-expression/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-generator/generator-method-with-yield-expression/output.json @@ -1,93 +1,26 @@ { "type": "File", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, "program": { "type": "Program", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, "expression": { "type": "ObjectExpression", - "start": 1, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":1,"end":24,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":24}}, "properties": [ { "type": "ObjectMethod", - "start": 3, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":3,"end":22,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":22}}, "method": true, "key": { "type": "Identifier", - "start": 4, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "foo" - }, + "start":4,"end":7,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":7},"identifierName":"foo"}, "name": "foo" }, "computed": false, @@ -98,62 +31,18 @@ "params": [], "body": { "type": "BlockStatement", - "start": 10, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":10,"end":22,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":22}}, "body": [ { "type": "ExpressionStatement", - "start": 12, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":12,"end":20,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":20}}, "expression": { "type": "YieldExpression", - "start": 12, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":12,"end":19,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":19}}, "delegate": false, "argument": { "type": "NumericLiteral", - "start": 18, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":18,"end":19,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":19}}, "extra": { "rawValue": 3, "raw": "3" diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-generator/generator-method-with-yield-line-terminator/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-generator/generator-method-with-yield-line-terminator/output.json index b26adc4fcb5f..ced9d493b228 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-generator/generator-method-with-yield-line-terminator/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-generator/generator-method-with-yield-line-terminator/output.json @@ -1,93 +1,26 @@ { "type": "File", - "start": 0, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 4 - } - }, + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":4}}, "program": { "type": "Program", - "start": 0, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 4 - } - }, + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":4}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 4 - } - }, + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":4}}, "expression": { "type": "ObjectExpression", - "start": 1, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 4, - "column": 3 - } - }, + "start":1,"end":28,"loc":{"start":{"line":1,"column":1},"end":{"line":4,"column":3}}, "properties": [ { "type": "ObjectMethod", - "start": 3, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":3,"end":26,"loc":{"start":{"line":1,"column":3},"end":{"line":4,"column":1}}, "method": true, "key": { "type": "Identifier", - "start": 4, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "foo" - }, + "start":4,"end":7,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":7},"identifierName":"foo"}, "name": "foo" }, "computed": false, @@ -98,79 +31,24 @@ "params": [], "body": { "type": "BlockStatement", - "start": 10, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":10,"end":26,"loc":{"start":{"line":1,"column":10},"end":{"line":4,"column":1}}, "body": [ { "type": "ExpressionStatement", - "start": 15, - "end": 20, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 7 - } - }, + "start":15,"end":20,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":7}}, "expression": { "type": "YieldExpression", - "start": 15, - "end": 20, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 7 - } - }, + "start":15,"end":20,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":7}}, "delegate": false, "argument": null } }, { "type": "ExpressionStatement", - "start": 23, - "end": 24, - "loc": { - "start": { - "line": 3, - "column": 2 - }, - "end": { - "line": 3, - "column": 3 - } - }, + "start":23,"end":24,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":3}}, "expression": { "type": "NumericLiteral", - "start": 23, - "end": 24, - "loc": { - "start": { - "line": 3, - "column": 2 - }, - "end": { - "line": 3, - "column": 3 - } - }, + "start":23,"end":24,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":3}}, "extra": { "rawValue": 3, "raw": "3" diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-generator/generator-method-with-yield/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-generator/generator-method-with-yield/output.json index d05afab8aa66..f678eced09de 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-generator/generator-method-with-yield/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-generator/generator-method-with-yield/output.json @@ -1,93 +1,26 @@ { "type": "File", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "program": { "type": "Program", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "expression": { "type": "ObjectExpression", - "start": 1, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":1,"end":22,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":22}}, "properties": [ { "type": "ObjectMethod", - "start": 3, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":3,"end":20,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":20}}, "method": true, "key": { "type": "Identifier", - "start": 4, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "foo" - }, + "start":4,"end":7,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":7},"identifierName":"foo"}, "name": "foo" }, "computed": false, @@ -98,47 +31,14 @@ "params": [], "body": { "type": "BlockStatement", - "start": 10, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":10,"end":20,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":20}}, "body": [ { "type": "ExpressionStatement", - "start": 12, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":12,"end":18,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":18}}, "expression": { "type": "YieldExpression", - "start": 12, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":12,"end":17,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":17}}, "delegate": false, "argument": null } diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-generator/generator-method/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-generator/generator-method/output.json index 280504bbdf50..23c182d5329e 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-generator/generator-method/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-generator/generator-method/output.json @@ -1,93 +1,26 @@ { "type": "File", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "program": { "type": "Program", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "expression": { "type": "ObjectExpression", - "start": 1, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":1,"end":14,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":14}}, "properties": [ { "type": "ObjectMethod", - "start": 3, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":3,"end":12,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":12}}, "method": true, "key": { "type": "Identifier", - "start": 4, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "foo" - }, + "start":4,"end":7,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":7},"identifierName":"foo"}, "name": "foo" }, "computed": false, @@ -98,18 +31,7 @@ "params": [], "body": { "type": "BlockStatement", - "start": 10, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":10,"end":12,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":12}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-generator/static-generator-method-with-computed-name/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-generator/static-generator-method-with-computed-name/output.json index 6bcafdb4a8ca..79238865f3ea 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-generator/static-generator-method-with-computed-name/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-generator/static-generator-method-with-computed-name/output.json @@ -1,113 +1,34 @@ { "type": "File", - "start": 0, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, "program": { "type": "Program", - "start": 0, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, "id": { "type": "Identifier", - "start": 6, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "Foo" - }, + "start":6,"end":9,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":9},"identifierName":"Foo"}, "name": "Foo" }, "superClass": null, "body": { "type": "ClassBody", - "start": 10, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":10,"end":32,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":32}}, "body": [ { "type": "ClassMethod", - "start": 12, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":12,"end":30,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":30}}, "static": true, "kind": "method", "computed": true, "key": { "type": "Identifier", - "start": 21, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 24 - }, - "identifierName": "foo" - }, + "start":21,"end":24,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":24},"identifierName":"foo"}, "name": "foo" }, "id": null, @@ -116,18 +37,7 @@ "params": [], "body": { "type": "BlockStatement", - "start": 28, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":28,"end":30,"loc":{"start":{"line":1,"column":28},"end":{"line":1,"column":30}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-generator/static-generator-method/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-generator/static-generator-method/output.json index 86d54a693de7..1660aced2c08 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-generator/static-generator-method/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-generator/static-generator-method/output.json @@ -1,112 +1,33 @@ { "type": "File", - "start": 0, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, "program": { "type": "Program", - "start": 0, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, "id": { "type": "Identifier", - "start": 6, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "Foo" - }, + "start":6,"end":9,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":9},"identifierName":"Foo"}, "name": "Foo" }, "superClass": null, "body": { "type": "ClassBody", - "start": 10, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":10,"end":30,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":30}}, "body": [ { "type": "ClassMethod", - "start": 12, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":12,"end":28,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":28}}, "static": true, "kind": "method", "key": { "type": "Identifier", - "start": 20, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 23 - }, - "identifierName": "foo" - }, + "start":20,"end":23,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":23},"identifierName":"foo"}, "name": "foo" }, "computed": false, @@ -116,18 +37,7 @@ "params": [], "body": { "type": "BlockStatement", - "start": 26, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":26,"end":28,"loc":{"start":{"line":1,"column":26},"end":{"line":1,"column":28}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-identifier/dakuten_handakuten/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-identifier/dakuten_handakuten/output.json index 68f1fb8a062d..8c6994bb9ea6 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-identifier/dakuten_handakuten/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-identifier/dakuten_handakuten/output.json @@ -1,95 +1,27 @@ { "type": "File", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - }, + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, "program": { "type": "Program", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - }, + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - }, + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, "expression": { "type": "BinaryExpression", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - }, + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "゛" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"゛"}, "name": "゛" }, "operator": "+", "right": { "type": "Identifier", - "start": 3, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 4 - }, - "identifierName": "゜" - }, + "start":3,"end":4,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":4},"identifierName":"゜"}, "name": "゜" } } diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-identifier/escaped_all/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-identifier/escaped_all/output.json index e92dc30494a2..332fba83c5bf 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-identifier/escaped_all/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-identifier/escaped_all/output.json @@ -1,78 +1,22 @@ { "type": "File", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "program": { "type": "Program", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":4,"end":22,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":22}}, "id": { "type": "Identifier", - "start": 4, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 22 - }, - "identifierName": "ABC" - }, + "start":4,"end":22,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":22},"identifierName":"ABC"}, "name": "ABC" }, "init": null diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-identifier/escaped_math_alef/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-identifier/escaped_math_alef/output.json index 6bdccdd72d7a..e011a9c04864 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-identifier/escaped_math_alef/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-identifier/escaped_math_alef/output.json @@ -1,78 +1,22 @@ { "type": "File", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "program": { "type": "Program", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":4,"end":13,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":13}}, "id": { "type": "Identifier", - "start": 4, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 13 - }, - "identifierName": "𞸀" - }, + "start":4,"end":13,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":13},"identifierName":"𞸀"}, "name": "𞸀" }, "init": null diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-identifier/escaped_math_dal_part/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-identifier/escaped_math_dal_part/output.json index edb32771b7e7..dbf7415fa197 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-identifier/escaped_math_dal_part/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-identifier/escaped_math_dal_part/output.json @@ -1,78 +1,22 @@ { "type": "File", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "program": { "type": "Program", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":4,"end":14,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":14}}, "id": { "type": "Identifier", - "start": 4, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 14 - }, - "identifierName": "_𞸃" - }, + "start":4,"end":14,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":14},"identifierName":"_𞸃"}, "name": "_𞸃" }, "init": null diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-identifier/escaped_math_kaf_lam/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-identifier/escaped_math_kaf_lam/output.json index f724a3b10eb8..ac11e2a59f35 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-identifier/escaped_math_kaf_lam/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-identifier/escaped_math_kaf_lam/output.json @@ -1,78 +1,22 @@ { "type": "File", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "program": { "type": "Program", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":4,"end":22,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":22}}, "id": { "type": "Identifier", - "start": 4, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 22 - }, - "identifierName": "𞸊𞸋" - }, + "start":4,"end":22,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":22},"identifierName":"𞸊𞸋"}, "name": "𞸊𞸋" }, "init": null diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-identifier/escaped_math_zain_start/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-identifier/escaped_math_zain_start/output.json index facd3e367daf..07fb3606dbfa 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-identifier/escaped_math_zain_start/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-identifier/escaped_math_zain_start/output.json @@ -1,78 +1,22 @@ { "type": "File", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "program": { "type": "Program", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":4,"end":15,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":15}}, "id": { "type": "Identifier", - "start": 4, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 15 - }, - "identifierName": "𞸆_$" - }, + "start":4,"end":15,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":15},"identifierName":"𞸆_$"}, "name": "𞸆_$" }, "init": null diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-identifier/escaped_part/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-identifier/escaped_part/output.json index 9570a48b5063..a680603d0e7f 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-identifier/escaped_part/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-identifier/escaped_part/output.json @@ -1,78 +1,22 @@ { "type": "File", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "program": { "type": "Program", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":4,"end":12,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":12}}, "id": { "type": "Identifier", - "start": 4, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "ABC" - }, + "start":4,"end":12,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":12},"identifierName":"ABC"}, "name": "ABC" }, "init": null diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-identifier/escaped_start/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-identifier/escaped_start/output.json index 9570a48b5063..a680603d0e7f 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-identifier/escaped_start/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-identifier/escaped_start/output.json @@ -1,78 +1,22 @@ { "type": "File", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "program": { "type": "Program", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":4,"end":12,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":12}}, "id": { "type": "Identifier", - "start": 4, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "ABC" - }, + "start":4,"end":12,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":12},"identifierName":"ABC"}, "name": "ABC" }, "init": null diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-identifier/estimated/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-identifier/estimated/output.json index 811527d5f48a..25f930eef347 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-identifier/estimated/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-identifier/estimated/output.json @@ -1,78 +1,22 @@ { "type": "File", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "program": { "type": "Program", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5}}, "id": { "type": "Identifier", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "℮" - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"℮"}, "name": "℮" }, "init": null diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-identifier/ethiopic_digits/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-identifier/ethiopic_digits/output.json index 26a11aeee6dc..4d508df917b6 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-identifier/ethiopic_digits/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-identifier/ethiopic_digits/output.json @@ -1,78 +1,22 @@ { "type": "File", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "program": { "type": "Program", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":4,"end":14,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":14}}, "id": { "type": "Identifier", - "start": 4, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 14 - }, - "identifierName": "_፩፪፫፬፭፮፯፰፱" - }, + "start":4,"end":14,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":14},"identifierName":"_፩፪፫፬፭፮፯፰፱"}, "name": "_፩፪፫፬፭፮፯፰፱" }, "init": null diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-identifier/invalid_escaped_surrogate_pairs/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-identifier/invalid_escaped_surrogate_pairs/options.json deleted file mode 100644 index df97a8ee679f..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-identifier/invalid_escaped_surrogate_pairs/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid Unicode escape (1:4)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-identifier/invalid_escaped_surrogate_pairs/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-identifier/invalid_escaped_surrogate_pairs/output.json new file mode 100644 index 000000000000..c59f2314f4c6 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-identifier/invalid_escaped_surrogate_pairs/output.json @@ -0,0 +1,34 @@ +{ + "type": "File", + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, + "errors": [ + "SyntaxError: Invalid Unicode escape (1:4)", + "SyntaxError: Invalid Unicode escape (1:10)" + ], + "program": { + "type": "Program", + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":4,"end":16,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":16}}, + "id": { + "type": "Identifier", + "start":4,"end":16,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":16},"identifierName":"𞸀"}, + "name": "𞸀" + }, + "init": null + } + ], + "kind": "var" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-identifier/invalid_expression_await/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-identifier/invalid_expression_await/options.json deleted file mode 100644 index afbed324e92a..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-identifier/invalid_expression_await/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "'import' and 'export' may appear only with 'sourceType: \"module\"' (1:0)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-identifier/invalid_expression_await/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-identifier/invalid_expression_await/output.json new file mode 100644 index 000000000000..3b41003b9891 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-identifier/invalid_expression_await/output.json @@ -0,0 +1,57 @@ +{ + "type": "File", + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, + "errors": [ + "SyntaxError: 'import' and 'export' may appear only with 'sourceType: \"module\"' (1:0)" + ], + "program": { + "type": "Program", + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExportNamedDeclaration", + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, + "specifiers": [], + "source": null, + "declaration": { + "type": "VariableDeclaration", + "start":7,"end":30,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":30}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":11,"end":29,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":29}}, + "id": { + "type": "Identifier", + "start":11,"end":17,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":17},"identifierName":"answer"}, + "name": "answer" + }, + "init": { + "type": "BinaryExpression", + "start":20,"end":29,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":29}}, + "left": { + "type": "Identifier", + "start":20,"end":25,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":25},"identifierName":"await"}, + "name": "await" + }, + "operator": "+", + "right": { + "type": "NumericLiteral", + "start":28,"end":29,"loc":{"start":{"line":1,"column":28},"end":{"line":1,"column":29}}, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + } + ], + "kind": "var" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-identifier/invalid_var_await/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-identifier/invalid_var_await/options.json deleted file mode 100644 index afbed324e92a..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-identifier/invalid_var_await/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "'import' and 'export' may appear only with 'sourceType: \"module\"' (1:0)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-identifier/invalid_var_await/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-identifier/invalid_var_await/output.json new file mode 100644 index 000000000000..8b141a65c33b --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-identifier/invalid_var_await/output.json @@ -0,0 +1,39 @@ +{ + "type": "File", + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, + "errors": [ + "SyntaxError: 'import' and 'export' may appear only with 'sourceType: \"module\"' (1:0)" + ], + "program": { + "type": "Program", + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExportNamedDeclaration", + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, + "specifiers": [], + "source": null, + "declaration": { + "type": "VariableDeclaration", + "start":7,"end":17,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":17}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":11,"end":16,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":16}}, + "id": { + "type": "Identifier", + "start":11,"end":16,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":16},"identifierName":"await"}, + "name": "await" + }, + "init": null + } + ], + "kind": "var" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-identifier/math_alef/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-identifier/math_alef/output.json index 17c60d705ef3..9b4532561e0c 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-identifier/math_alef/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-identifier/math_alef/output.json @@ -1,78 +1,22 @@ { "type": "File", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "program": { "type": "Program", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":4,"end":6,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":6}}, "id": { "type": "Identifier", - "start": 4, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "𞸀" - }, + "start":4,"end":6,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":6},"identifierName":"𞸀"}, "name": "𞸀" }, "init": null diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-identifier/math_dal_part/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-identifier/math_dal_part/output.json index 34b916d50e52..61e8ddec8d74 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-identifier/math_dal_part/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-identifier/math_dal_part/output.json @@ -1,78 +1,22 @@ { "type": "File", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "program": { "type": "Program", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":4,"end":7,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":7}}, "id": { "type": "Identifier", - "start": 4, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "_𞸃" - }, + "start":4,"end":7,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":7},"identifierName":"_𞸃"}, "name": "_𞸃" }, "init": null diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-identifier/math_kaf_lam/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-identifier/math_kaf_lam/output.json index 126731813b78..386c605c079f 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-identifier/math_kaf_lam/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-identifier/math_kaf_lam/output.json @@ -1,78 +1,22 @@ { "type": "File", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, "program": { "type": "Program", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":4,"end":8,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":8}}, "id": { "type": "Identifier", - "start": 4, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 8 - }, - "identifierName": "𞸊𞸋" - }, + "start":4,"end":8,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":8},"identifierName":"𞸊𞸋"}, "name": "𞸊𞸋" }, "init": null diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-identifier/math_zain_start/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-identifier/math_zain_start/output.json index 17798e62e169..6377988b056f 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-identifier/math_zain_start/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-identifier/math_zain_start/output.json @@ -1,78 +1,22 @@ { "type": "File", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, "program": { "type": "Program", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":4,"end":8,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":8}}, "id": { "type": "Identifier", - "start": 4, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 8 - }, - "identifierName": "𞸆_$" - }, + "start":4,"end":8,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":8},"identifierName":"𞸆_$"}, "name": "𞸆_$" }, "init": null diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-identifier/module_await/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-identifier/module_await/output.json index 76431bad3d25..be14db709b1f 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-identifier/module_await/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-identifier/module_await/output.json @@ -1,94 +1,27 @@ { "type": "File", - "start": 0, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, "program": { "type": "Program", - "start": 0, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, "expression": { "type": "AssignmentExpression", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "operator": "=", "left": { "type": "Identifier", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "await" - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5},"identifierName":"await"}, "name": "await" }, "right": { "type": "NumericLiteral", - "start": 8, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":8,"end":9,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":9}}, "extra": { "rawValue": 0, "raw": "0" diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-identifier/valid_await/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-identifier/valid_await/output.json index 0b5cfe9866a9..1205ffb67954 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-identifier/valid_await/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-identifier/valid_await/output.json @@ -1,78 +1,22 @@ { "type": "File", - "start": 0, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, "program": { "type": "Program", - "start": 0, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":4,"end":9,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":9}}, "id": { "type": "Identifier", - "start": 4, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "await" - }, + "start":4,"end":9,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":9},"identifierName":"await"}, "name": "await" }, "init": null @@ -82,33 +26,10 @@ }, { "type": "ExpressionStatement", - "start": 11, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":11,"end":19,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":19}}, "expression": { "type": "Identifier", - "start": 12, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 17 - }, - "identifierName": "await" - }, + "start":12,"end":17,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":17},"identifierName":"await"}, "name": "await", "extra": { "parenthesized": true, diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-identifier/weierstrass/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-identifier/weierstrass/output.json index 2388da9114eb..7463d2925bf9 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-identifier/weierstrass/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-identifier/weierstrass/output.json @@ -1,78 +1,22 @@ { "type": "File", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "program": { "type": "Program", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5}}, "id": { "type": "Identifier", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "℘" - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"℘"}, "name": "℘" }, "init": null diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-identifier/weierstrass_weierstrass/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-identifier/weierstrass_weierstrass/output.json index 76c4522a69ee..9c3c2c6b1ac4 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-identifier/weierstrass_weierstrass/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-identifier/weierstrass_weierstrass/output.json @@ -1,78 +1,22 @@ { "type": "File", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "program": { "type": "Program", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":4,"end":11,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":11}}, "id": { "type": "Identifier", - "start": 4, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "℘℘" - }, + "start":4,"end":11,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":11},"identifierName":"℘℘"}, "name": "℘℘" }, "init": null diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-import-declaration/import-default-and-named-specifiers/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-import-declaration/import-default-and-named-specifiers/output.json index 13a5ef7f4abd..05f4b187ee88 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-import-declaration/import-default-and-named-specifiers/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-import-declaration/import-default-and-named-specifiers/output.json @@ -1,145 +1,43 @@ { "type": "File", - "start": 0, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, "program": { "type": "Program", - "start": 0, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ImportDeclaration", - "start": 0, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, "specifiers": [ { "type": "ImportDefaultSpecifier", - "start": 7, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":7,"end":10,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":10}}, "local": { "type": "Identifier", - "start": 7, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 10 - }, - "identifierName": "foo" - }, + "start":7,"end":10,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":10},"identifierName":"foo"}, "name": "foo" } }, { "type": "ImportSpecifier", - "start": 13, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":13,"end":16,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":16}}, "imported": { "type": "Identifier", - "start": 13, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 16 - }, - "identifierName": "bar" - }, + "start":13,"end":16,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":16},"identifierName":"bar"}, "name": "bar" }, "local": { "type": "Identifier", - "start": 13, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 16 - }, - "identifierName": "bar" - }, + "start":13,"end":16,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":16},"identifierName":"bar"}, "name": "bar" } } ], "source": { "type": "StringLiteral", - "start": 23, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":23,"end":28,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":28}}, "extra": { "rawValue": "foo", "raw": "\"foo\"" diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-import-declaration/import-default-and-namespace-specifiers/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-import-declaration/import-default-and-namespace-specifiers/output.json index 0458b69aea73..9985ba0bfaed 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-import-declaration/import-default-and-namespace-specifiers/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-import-declaration/import-default-and-namespace-specifiers/output.json @@ -1,128 +1,38 @@ { "type": "File", - "start": 0, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, "program": { "type": "Program", - "start": 0, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ImportDeclaration", - "start": 0, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, "specifiers": [ { "type": "ImportDefaultSpecifier", - "start": 7, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":7,"end":10,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":10}}, "local": { "type": "Identifier", - "start": 7, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 10 - }, - "identifierName": "foo" - }, + "start":7,"end":10,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":10},"identifierName":"foo"}, "name": "foo" } }, { "type": "ImportNamespaceSpecifier", - "start": 12, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":12,"end":20,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":20}}, "local": { "type": "Identifier", - "start": 17, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 20 - }, - "identifierName": "bar" - }, + "start":17,"end":20,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":20},"identifierName":"bar"}, "name": "bar" } } ], "source": { "type": "StringLiteral", - "start": 26, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":26,"end":31,"loc":{"start":{"line":1,"column":26},"end":{"line":1,"column":31}}, "extra": { "rawValue": "foo", "raw": "\"foo\"" diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-import-declaration/import-default-as/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-import-declaration/import-default-as/output.json index 347b3be44413..b14f5cdb95e0 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-import-declaration/import-default-as/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-import-declaration/import-default-as/output.json @@ -1,113 +1,34 @@ { "type": "File", - "start": 0, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":35}}, "program": { "type": "Program", - "start": 0, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":35}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ImportDeclaration", - "start": 0, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":35}}, "specifiers": [ { "type": "ImportSpecifier", - "start": 8, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":8,"end":22,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":22}}, "imported": { "type": "Identifier", - "start": 8, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 15 - }, - "identifierName": "default" - }, + "start":8,"end":15,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":15},"identifierName":"default"}, "name": "default" }, "local": { "type": "Identifier", - "start": 19, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 22 - }, - "identifierName": "foo" - }, + "start":19,"end":22,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":22},"identifierName":"foo"}, "name": "foo" } } ], "source": { "type": "StringLiteral", - "start": 29, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":29,"end":34,"loc":{"start":{"line":1,"column":29},"end":{"line":1,"column":34}}, "extra": { "rawValue": "foo", "raw": "\"foo\"" diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-import-declaration/import-default/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-import-declaration/import-default/output.json index 5a75f863c506..22597cae7cae 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-import-declaration/import-default/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-import-declaration/import-default/output.json @@ -1,96 +1,29 @@ { "type": "File", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "program": { "type": "Program", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ImportDeclaration", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "specifiers": [ { "type": "ImportDefaultSpecifier", - "start": 7, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":7,"end":10,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":10}}, "local": { "type": "Identifier", - "start": 7, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 10 - }, - "identifierName": "foo" - }, + "start":7,"end":10,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":10},"identifierName":"foo"}, "name": "foo" } } ], "source": { "type": "StringLiteral", - "start": 16, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":16,"end":21,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":21}}, "extra": { "rawValue": "foo", "raw": "\"foo\"" diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-import-declaration/import-jquery/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-import-declaration/import-jquery/output.json index 30cae98f649b..3e36b1ca7765 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-import-declaration/import-jquery/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-import-declaration/import-jquery/output.json @@ -1,96 +1,29 @@ { "type": "File", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "program": { "type": "Program", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ImportDeclaration", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "specifiers": [ { "type": "ImportDefaultSpecifier", - "start": 7, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8}}, "local": { "type": "Identifier", - "start": 7, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - }, - "identifierName": "$" - }, + "start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8},"identifierName":"$"}, "name": "$" } } ], "source": { "type": "StringLiteral", - "start": 14, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":14,"end":22,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":22}}, "extra": { "rawValue": "jquery", "raw": "\"jquery\"" diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-import-declaration/import-module/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-import-declaration/import-module/output.json index 329db7b04655..95736fdee6c1 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-import-declaration/import-module/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-import-declaration/import-module/output.json @@ -1,63 +1,19 @@ { "type": "File", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "program": { "type": "Program", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ImportDeclaration", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "specifiers": [], "source": { "type": "StringLiteral", - "start": 7, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":7,"end":12,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":12}}, "extra": { "rawValue": "foo", "raw": "\"foo\"" diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-import-declaration/import-named-as-specifier/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-import-declaration/import-named-as-specifier/output.json index 7051af9018ad..cf9dd503a4c4 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-import-declaration/import-named-as-specifier/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-import-declaration/import-named-as-specifier/output.json @@ -1,113 +1,34 @@ { "type": "File", - "start": 0, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, "program": { "type": "Program", - "start": 0, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ImportDeclaration", - "start": 0, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, "specifiers": [ { "type": "ImportSpecifier", - "start": 8, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":8,"end":18,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":18}}, "imported": { "type": "Identifier", - "start": 8, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "bar" - }, + "start":8,"end":11,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":11},"identifierName":"bar"}, "name": "bar" }, "local": { "type": "Identifier", - "start": 15, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 18 - }, - "identifierName": "baz" - }, + "start":15,"end":18,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":18},"identifierName":"baz"}, "name": "baz" } } ], "source": { "type": "StringLiteral", - "start": 25, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":25,"end":30,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":30}}, "extra": { "rawValue": "foo", "raw": "\"foo\"" diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-import-declaration/import-named-as-specifiers/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-import-declaration/import-named-as-specifiers/output.json index bad31cd6088a..6bcc40f19ba1 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-import-declaration/import-named-as-specifiers/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-import-declaration/import-named-as-specifiers/output.json @@ -1,162 +1,48 @@ { "type": "File", - "start": 0, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, "program": { "type": "Program", - "start": 0, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ImportDeclaration", - "start": 0, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, "specifiers": [ { "type": "ImportSpecifier", - "start": 8, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":8,"end":18,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":18}}, "imported": { "type": "Identifier", - "start": 8, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "bar" - }, + "start":8,"end":11,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":11},"identifierName":"bar"}, "name": "bar" }, "local": { "type": "Identifier", - "start": 15, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 18 - }, - "identifierName": "baz" - }, + "start":15,"end":18,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":18},"identifierName":"baz"}, "name": "baz" } }, { "type": "ImportSpecifier", - "start": 20, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":20,"end":23,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":23}}, "imported": { "type": "Identifier", - "start": 20, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 23 - }, - "identifierName": "xyz" - }, + "start":20,"end":23,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":23},"identifierName":"xyz"}, "name": "xyz" }, "local": { "type": "Identifier", - "start": 20, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 23 - }, - "identifierName": "xyz" - }, + "start":20,"end":23,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":23},"identifierName":"xyz"}, "name": "xyz" } } ], "source": { "type": "StringLiteral", - "start": 30, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":30,"end":35,"loc":{"start":{"line":1,"column":30},"end":{"line":1,"column":35}}, "extra": { "rawValue": "foo", "raw": "\"foo\"" diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-import-declaration/import-named-empty/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-import-declaration/import-named-empty/output.json index b149b8db92f9..b5f711497e31 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-import-declaration/import-named-empty/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-import-declaration/import-named-empty/output.json @@ -1,63 +1,19 @@ { "type": "File", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, "program": { "type": "Program", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ImportDeclaration", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, "specifiers": [], "source": { "type": "StringLiteral", - "start": 15, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":15,"end":20,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":20}}, "extra": { "rawValue": "foo", "raw": "\"foo\"" diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-import-declaration/import-named-specifier/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-import-declaration/import-named-specifier/output.json index 3a62a458d615..a54a3104a79a 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-import-declaration/import-named-specifier/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-import-declaration/import-named-specifier/output.json @@ -1,113 +1,34 @@ { "type": "File", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "program": { "type": "Program", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ImportDeclaration", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "specifiers": [ { "type": "ImportSpecifier", - "start": 8, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":8,"end":11,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":11}}, "imported": { "type": "Identifier", - "start": 8, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "bar" - }, + "start":8,"end":11,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":11},"identifierName":"bar"}, "name": "bar" }, "local": { "type": "Identifier", - "start": 8, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "bar" - }, + "start":8,"end":11,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":11},"identifierName":"bar"}, "name": "bar" } } ], "source": { "type": "StringLiteral", - "start": 18, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":18,"end":23,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":23}}, "extra": { "rawValue": "foo", "raw": "\"foo\"" diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-import-declaration/import-named-specifiers-comma/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-import-declaration/import-named-specifiers-comma/output.json index ec9898e4ef40..388349480ddf 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-import-declaration/import-named-specifiers-comma/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-import-declaration/import-named-specifiers-comma/output.json @@ -1,162 +1,48 @@ { "type": "File", - "start": 0, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, "program": { "type": "Program", - "start": 0, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ImportDeclaration", - "start": 0, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, "specifiers": [ { "type": "ImportSpecifier", - "start": 8, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":8,"end":11,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":11}}, "imported": { "type": "Identifier", - "start": 8, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "bar" - }, + "start":8,"end":11,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":11},"identifierName":"bar"}, "name": "bar" }, "local": { "type": "Identifier", - "start": 8, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "bar" - }, + "start":8,"end":11,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":11},"identifierName":"bar"}, "name": "bar" } }, { "type": "ImportSpecifier", - "start": 13, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":13,"end":16,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":16}}, "imported": { "type": "Identifier", - "start": 13, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 16 - }, - "identifierName": "baz" - }, + "start":13,"end":16,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":16},"identifierName":"baz"}, "name": "baz" }, "local": { "type": "Identifier", - "start": 13, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 16 - }, - "identifierName": "baz" - }, + "start":13,"end":16,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":16},"identifierName":"baz"}, "name": "baz" } } ], "source": { "type": "StringLiteral", - "start": 24, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":24,"end":29,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":29}}, "extra": { "rawValue": "foo", "raw": "\"foo\"" diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-import-declaration/import-named-specifiers/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-import-declaration/import-named-specifiers/output.json index cc54edc053cb..88915ea0223a 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-import-declaration/import-named-specifiers/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-import-declaration/import-named-specifiers/output.json @@ -1,162 +1,48 @@ { "type": "File", - "start": 0, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, "program": { "type": "Program", - "start": 0, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ImportDeclaration", - "start": 0, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, "specifiers": [ { "type": "ImportSpecifier", - "start": 8, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":8,"end":11,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":11}}, "imported": { "type": "Identifier", - "start": 8, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "bar" - }, + "start":8,"end":11,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":11},"identifierName":"bar"}, "name": "bar" }, "local": { "type": "Identifier", - "start": 8, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "bar" - }, + "start":8,"end":11,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":11},"identifierName":"bar"}, "name": "bar" } }, { "type": "ImportSpecifier", - "start": 13, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":13,"end":16,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":16}}, "imported": { "type": "Identifier", - "start": 13, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 16 - }, - "identifierName": "baz" - }, + "start":13,"end":16,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":16},"identifierName":"baz"}, "name": "baz" }, "local": { "type": "Identifier", - "start": 13, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 16 - }, - "identifierName": "baz" - }, + "start":13,"end":16,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":16},"identifierName":"baz"}, "name": "baz" } } ], "source": { "type": "StringLiteral", - "start": 23, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":23,"end":28,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":28}}, "extra": { "rawValue": "foo", "raw": "\"foo\"" diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-import-declaration/import-namespace-specifier/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-import-declaration/import-namespace-specifier/output.json index 9c4d87ac49a4..3d082bcf7a65 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-import-declaration/import-namespace-specifier/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-import-declaration/import-namespace-specifier/output.json @@ -1,96 +1,29 @@ { "type": "File", - "start": 0, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, "program": { "type": "Program", - "start": 0, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ImportDeclaration", - "start": 0, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, "specifiers": [ { "type": "ImportNamespaceSpecifier", - "start": 7, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":7,"end":15,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":15}}, "local": { "type": "Identifier", - "start": 12, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 15 - }, - "identifierName": "foo" - }, + "start":12,"end":15,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":15},"identifierName":"foo"}, "name": "foo" } } ], "source": { "type": "StringLiteral", - "start": 21, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":21,"end":26,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":26}}, "extra": { "rawValue": "foo", "raw": "\"foo\"" diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-import-declaration/import-null-as-nil/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-import-declaration/import-null-as-nil/output.json index d589597abfc8..0c902bf05c85 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-import-declaration/import-null-as-nil/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-import-declaration/import-null-as-nil/output.json @@ -1,113 +1,34 @@ { "type": "File", - "start": 0, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, "program": { "type": "Program", - "start": 0, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ImportDeclaration", - "start": 0, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, "specifiers": [ { "type": "ImportSpecifier", - "start": 9, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":9,"end":20,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":20}}, "imported": { "type": "Identifier", - "start": 9, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 13 - }, - "identifierName": "null" - }, + "start":9,"end":13,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":13},"identifierName":"null"}, "name": "null" }, "local": { "type": "Identifier", - "start": 17, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 20 - }, - "identifierName": "nil" - }, + "start":17,"end":20,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":20},"identifierName":"nil"}, "name": "nil" } } ], "source": { "type": "StringLiteral", - "start": 28, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":28,"end":33,"loc":{"start":{"line":1,"column":28},"end":{"line":1,"column":33}}, "extra": { "rawValue": "bar", "raw": "\"bar\"" diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-lexical-declaration/invalid_complex_binding_without_init/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-lexical-declaration/invalid_complex_binding_without_init/options.json deleted file mode 100644 index 57893e4eee56..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-lexical-declaration/invalid_complex_binding_without_init/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Complex binding patterns require an initialization value (1:6)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-lexical-declaration/invalid_complex_binding_without_init/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-lexical-declaration/invalid_complex_binding_without_init/output.json new file mode 100644 index 000000000000..a6a8254f883c --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-lexical-declaration/invalid_complex_binding_without_init/output.json @@ -0,0 +1,33 @@ +{ + "type": "File", + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, + "errors": [ + "SyntaxError: Complex binding patterns require an initialization value (1:6)" + ], + "program": { + "type": "Program", + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":4,"end":6,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":6}}, + "id": { + "type": "ArrayPattern", + "start":4,"end":6,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":6}}, + "elements": [] + }, + "init": null + } + ], + "kind": "let" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-lexical-declaration/invalid_const_forin/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-lexical-declaration/invalid_const_forin/options.json deleted file mode 100644 index dd3b73e5d533..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-lexical-declaration/invalid_const_forin/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "for-in loop variable declaration may not have an initializer (1:5)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-lexical-declaration/invalid_const_forin/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-lexical-declaration/invalid_const_forin/output.json new file mode 100644 index 000000000000..8ed4dab050de --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-lexical-declaration/invalid_const_forin/output.json @@ -0,0 +1,56 @@ +{ + "type": "File", + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, + "errors": [ + "SyntaxError: for-in loop variable declaration may not have an initializer (1:5)" + ], + "program": { + "type": "Program", + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ForInStatement", + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, + "left": { + "type": "VariableDeclaration", + "start":5,"end":16,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":16}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":11,"end":16,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":16}}, + "id": { + "type": "Identifier", + "start":11,"end":12,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":12},"identifierName":"x"}, + "name": "x" + }, + "init": { + "type": "NumericLiteral", + "start":15,"end":16,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":16}}, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + } + ], + "kind": "const" + }, + "right": { + "type": "Identifier", + "start":20,"end":21,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":21},"identifierName":"y"}, + "name": "y" + }, + "body": { + "type": "BlockStatement", + "start":22,"end":24,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":24}}, + "body": [], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-lexical-declaration/invalid_let_forin/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-lexical-declaration/invalid_let_forin/options.json deleted file mode 100644 index dd3b73e5d533..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-lexical-declaration/invalid_let_forin/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "for-in loop variable declaration may not have an initializer (1:5)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-lexical-declaration/invalid_let_forin/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-lexical-declaration/invalid_let_forin/output.json new file mode 100644 index 000000000000..4602d099aa90 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-lexical-declaration/invalid_let_forin/output.json @@ -0,0 +1,56 @@ +{ + "type": "File", + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, + "errors": [ + "SyntaxError: for-in loop variable declaration may not have an initializer (1:5)" + ], + "program": { + "type": "Program", + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ForInStatement", + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, + "left": { + "type": "VariableDeclaration", + "start":5,"end":14,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":14}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":9,"end":14,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":14}}, + "id": { + "type": "Identifier", + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"x"}, + "name": "x" + }, + "init": { + "type": "NumericLiteral", + "start":13,"end":14,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":14}}, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + } + ], + "kind": "let" + }, + "right": { + "type": "Identifier", + "start":18,"end":19,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":19},"identifierName":"y"}, + "name": "y" + }, + "body": { + "type": "BlockStatement", + "start":20,"end":22,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":22}}, + "body": [], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-lexical-declaration/migrated_0000/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-lexical-declaration/migrated_0000/output.json index 0d2a9ed4dc15..4af86db4bc03 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-lexical-declaration/migrated_0000/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-lexical-declaration/migrated_0000/output.json @@ -1,141 +1,40 @@ { "type": "File", - "start": 0, - "end": 47, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 47 - } - }, + "start":0,"end":47,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":47}}, "program": { "type": "Program", - "start": 0, - "end": 47, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 47 - } - }, + "start":0,"end":47,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":47}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "SwitchStatement", - "start": 0, - "end": 47, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 47 - } - }, + "start":0,"end":47,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":47}}, "discriminant": { "type": "Identifier", - "start": 8, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 14 - }, - "identifierName": "answer" - }, + "start":8,"end":14,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":14},"identifierName":"answer"}, "name": "answer" }, "cases": [ { "type": "SwitchCase", - "start": 18, - "end": 45, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 45 - } - }, + "start":18,"end":45,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":45}}, "consequent": [ { "type": "VariableDeclaration", - "start": 27, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":27,"end":38,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":38}}, "declarations": [ { "type": "VariableDeclarator", - "start": 31, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 31 - }, - "end": { - "line": 1, - "column": 37 - } - }, + "start":31,"end":37,"loc":{"start":{"line":1,"column":31},"end":{"line":1,"column":37}}, "id": { "type": "Identifier", - "start": 31, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 31 - }, - "end": { - "line": 1, - "column": 32 - }, - "identifierName": "t" - }, + "start":31,"end":32,"loc":{"start":{"line":1,"column":31},"end":{"line":1,"column":32},"identifierName":"t"}, "name": "t" }, "init": { "type": "NumericLiteral", - "start": 35, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 35 - }, - "end": { - "line": 1, - "column": 37 - } - }, + "start":35,"end":37,"loc":{"start":{"line":1,"column":35},"end":{"line":1,"column":37}}, "extra": { "rawValue": 42, "raw": "42" @@ -148,35 +47,13 @@ }, { "type": "BreakStatement", - "start": 39, - "end": 45, - "loc": { - "start": { - "line": 1, - "column": 39 - }, - "end": { - "line": 1, - "column": 45 - } - }, + "start":39,"end":45,"loc":{"start":{"line":1,"column":39},"end":{"line":1,"column":45}}, "label": null } ], "test": { "type": "NumericLiteral", - "start": 23, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":23,"end":25,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":25}}, "extra": { "rawValue": 42, "raw": "42" diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-meta-property/assign-new-target/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-meta-property/assign-new-target/output.json index 02f31aba69e6..6cab0ec83dc8 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-meta-property/assign-new-target/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-meta-property/assign-new-target/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":40,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":40,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":40,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "id": { "type": "Identifier", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - }, - "identifierName": "f" - }, + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"f"}, "name": "f" }, "generator": false, @@ -65,111 +20,31 @@ "params": [], "body": { "type": "BlockStatement", - "start": 13, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":13,"end":40,"loc":{"start":{"line":1,"column":13},"end":{"line":3,"column":1}}, "body": [ { "type": "VariableDeclaration", - "start": 19, - "end": 38, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 23 - } - }, + "start":19,"end":38,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":23}}, "declarations": [ { "type": "VariableDeclarator", - "start": 23, - "end": 37, - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 22 - } - }, + "start":23,"end":37,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":22}}, "id": { "type": "Identifier", - "start": 23, - "end": 24, - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 9 - }, - "identifierName": "x" - }, + "start":23,"end":24,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":9},"identifierName":"x"}, "name": "x" }, "init": { "type": "MetaProperty", - "start": 27, - "end": 37, - "loc": { - "start": { - "line": 2, - "column": 12 - }, - "end": { - "line": 2, - "column": 22 - } - }, + "start":27,"end":37,"loc":{"start":{"line":2,"column":12},"end":{"line":2,"column":22}}, "meta": { "type": "Identifier", - "start": 27, - "end": 30, - "loc": { - "start": { - "line": 2, - "column": 12 - }, - "end": { - "line": 2, - "column": 15 - }, - "identifierName": "new" - }, + "start":27,"end":30,"loc":{"start":{"line":2,"column":12},"end":{"line":2,"column":15},"identifierName":"new"}, "name": "new" }, "property": { "type": "Identifier", - "start": 31, - "end": 37, - "loc": { - "start": { - "line": 2, - "column": 16 - }, - "end": { - "line": 2, - "column": 22 - }, - "identifierName": "target" - }, + "start":31,"end":37,"loc":{"start":{"line":2,"column":16},"end":{"line":2,"column":22},"identifierName":"target"}, "name": "target" } } diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-meta-property/invalid-new-target/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-meta-property/invalid-new-target/options.json deleted file mode 100644 index a8a536e737f3..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-meta-property/invalid-new-target/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "new.target can only be used in functions (1:8)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-meta-property/invalid-new-target/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-meta-property/invalid-new-target/output.json new file mode 100644 index 000000000000..d5f6e644d765 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-meta-property/invalid-new-target/output.json @@ -0,0 +1,46 @@ +{ + "type": "File", + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, + "errors": [ + "SyntaxError: new.target can only be used in functions (1:8)" + ], + "program": { + "type": "Program", + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":4,"end":18,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":18}}, + "id": { + "type": "Identifier", + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"x"}, + "name": "x" + }, + "init": { + "type": "MetaProperty", + "start":8,"end":18,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":18}}, + "meta": { + "type": "Identifier", + "start":8,"end":11,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":11},"identifierName":"new"}, + "name": "new" + }, + "property": { + "type": "Identifier", + "start":12,"end":18,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":18},"identifierName":"target"}, + "name": "target" + } + } + } + ], + "kind": "var" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-meta-property/new-new-target/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-meta-property/new-new-target/output.json index 506e791dd0c4..3acee47b0cbe 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-meta-property/new-new-target/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-meta-property/new-new-target/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "id": { "type": "Identifier", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - }, - "identifierName": "f" - }, + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"f"}, "name": "f" }, "generator": false, @@ -65,93 +20,25 @@ "params": [], "body": { "type": "BlockStatement", - "start": 13, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":13,"end":36,"loc":{"start":{"line":1,"column":13},"end":{"line":3,"column":1}}, "body": [ { "type": "ExpressionStatement", - "start": 19, - "end": 34, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 19 - } - }, + "start":19,"end":34,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":19}}, "expression": { "type": "NewExpression", - "start": 19, - "end": 33, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 18 - } - }, + "start":19,"end":33,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":18}}, "callee": { "type": "MetaProperty", - "start": 23, - "end": 33, - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 18 - } - }, + "start":23,"end":33,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":18}}, "meta": { "type": "Identifier", - "start": 23, - "end": 26, - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 11 - }, - "identifierName": "new" - }, + "start":23,"end":26,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":11},"identifierName":"new"}, "name": "new" }, "property": { "type": "Identifier", - "start": 27, - "end": 33, - "loc": { - "start": { - "line": 2, - "column": 12 - }, - "end": { - "line": 2, - "column": 18 - }, - "identifierName": "target" - }, + "start":27,"end":33,"loc":{"start":{"line":2,"column":12},"end":{"line":2,"column":18},"identifierName":"target"}, "name": "target" } }, diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-meta-property/new-target-declaration/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-meta-property/new-target-declaration/output.json index 6f4a4a11e94c..72fa8218caaf 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-meta-property/new-target-declaration/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-meta-property/new-target-declaration/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "id": { "type": "Identifier", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - }, - "identifierName": "f" - }, + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"f"}, "name": "f" }, "generator": false, @@ -65,79 +20,22 @@ "params": [], "body": { "type": "BlockStatement", - "start": 13, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":13,"end":32,"loc":{"start":{"line":1,"column":13},"end":{"line":3,"column":1}}, "body": [ { "type": "ExpressionStatement", - "start": 19, - "end": 30, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 15 - } - }, + "start":19,"end":30,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":15}}, "expression": { "type": "MetaProperty", - "start": 19, - "end": 29, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 14 - } - }, + "start":19,"end":29,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":14}}, "meta": { "type": "Identifier", - "start": 19, - "end": 22, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 7 - }, - "identifierName": "new" - }, + "start":19,"end":22,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":7},"identifierName":"new"}, "name": "new" }, "property": { "type": "Identifier", - "start": 23, - "end": 29, - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 14 - }, - "identifierName": "target" - }, + "start":23,"end":29,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":14},"identifierName":"target"}, "name": "target" } } diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-meta-property/new-target-expression/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-meta-property/new-target-expression/output.json index 0fc069591e3f..d3a7ed6fe7ee 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-meta-property/new-target-expression/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-meta-property/new-target-expression/output.json @@ -1,173 +1,49 @@ { "type": "File", - "start": 0, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, "program": { "type": "Program", - "start": 0, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":4,"end":34,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":34}}, "id": { "type": "Identifier", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "f" - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"f"}, "name": "f" }, "init": { "type": "FunctionExpression", - "start": 8, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":8,"end":34,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":34}}, "id": null, "generator": false, "async": false, "params": [], "body": { "type": "BlockStatement", - "start": 19, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":19,"end":34,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":34}}, "body": [ { "type": "ExpressionStatement", - "start": 21, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":21,"end":32,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":32}}, "expression": { "type": "MetaProperty", - "start": 21, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":21,"end":31,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":31}}, "meta": { "type": "Identifier", - "start": 21, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 24 - }, - "identifierName": "new" - }, + "start":21,"end":24,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":24},"identifierName":"new"}, "name": "new" }, "property": { "type": "Identifier", - "start": 25, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 31 - }, - "identifierName": "target" - }, + "start":25,"end":31,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":31},"identifierName":"target"}, "name": "target" } } diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-meta-property/new-target-invoke/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-meta-property/new-target-invoke/output.json index 0cfa3ce2b577..1f12694d2cda 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-meta-property/new-target-invoke/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-meta-property/new-target-invoke/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "id": { "type": "Identifier", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - }, - "identifierName": "f" - }, + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"f"}, "name": "f" }, "generator": false, @@ -65,93 +20,25 @@ "params": [], "body": { "type": "BlockStatement", - "start": 13, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":13,"end":34,"loc":{"start":{"line":1,"column":13},"end":{"line":3,"column":1}}, "body": [ { "type": "ExpressionStatement", - "start": 19, - "end": 32, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 17 - } - }, + "start":19,"end":32,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":17}}, "expression": { "type": "CallExpression", - "start": 19, - "end": 31, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 16 - } - }, + "start":19,"end":31,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":16}}, "callee": { "type": "MetaProperty", - "start": 19, - "end": 29, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 14 - } - }, + "start":19,"end":29,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":14}}, "meta": { "type": "Identifier", - "start": 19, - "end": 22, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 7 - }, - "identifierName": "new" - }, + "start":19,"end":22,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":7},"identifierName":"new"}, "name": "new" }, "property": { "type": "Identifier", - "start": 23, - "end": 29, - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 14 - }, - "identifierName": "target" - }, + "start":23,"end":29,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":14},"identifierName":"target"}, "name": "target" } }, diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-meta-property/new-target-precedence/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-meta-property/new-target-precedence/output.json index ca5e20d82343..136a010baa85 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-meta-property/new-target-precedence/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-meta-property/new-target-precedence/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":40,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":40,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":40,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "id": { "type": "Identifier", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - }, - "identifierName": "f" - }, + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"f"}, "name": "f" }, "generator": false, @@ -65,107 +20,28 @@ "params": [], "body": { "type": "BlockStatement", - "start": 13, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":13,"end":40,"loc":{"start":{"line":1,"column":13},"end":{"line":3,"column":1}}, "body": [ { "type": "ExpressionStatement", - "start": 19, - "end": 38, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 23 - } - }, + "start":19,"end":38,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":23}}, "expression": { "type": "CallExpression", - "start": 19, - "end": 37, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 22 - } - }, + "start":19,"end":37,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":22}}, "callee": { "type": "NewExpression", - "start": 19, - "end": 35, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 20 - } - }, + "start":19,"end":35,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":20}}, "callee": { "type": "MetaProperty", - "start": 23, - "end": 33, - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 18 - } - }, + "start":23,"end":33,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":18}}, "meta": { "type": "Identifier", - "start": 23, - "end": 26, - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 11 - }, - "identifierName": "new" - }, + "start":23,"end":26,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":11},"identifierName":"new"}, "name": "new" }, "property": { "type": "Identifier", - "start": 27, - "end": 33, - "loc": { - "start": { - "line": 2, - "column": 12 - }, - "end": { - "line": 2, - "column": 18 - }, - "identifierName": "target" - }, + "start":27,"end":33,"loc":{"start":{"line":2,"column":12},"end":{"line":2,"column":18},"identifierName":"target"}, "name": "target" } }, diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-meta-property/unknown-property/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-meta-property/unknown-property/options.json deleted file mode 100644 index f1d291c3e468..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-meta-property/unknown-property/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "The only valid meta property for new is new.target (1:25)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-meta-property/unknown-property/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-meta-property/unknown-property/output.json new file mode 100644 index 000000000000..61fc62e13aca --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-meta-property/unknown-property/output.json @@ -0,0 +1,65 @@ +{ + "type": "File", + "start":0,"end":44,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":44}}, + "errors": [ + "SyntaxError: The only valid meta property for new is new.target (1:25)" + ], + "program": { + "type": "Program", + "start":0,"end":44,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":44}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start":0,"end":44,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":44}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":4,"end":44,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":44}}, + "id": { + "type": "Identifier", + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"f"}, + "name": "f" + }, + "init": { + "type": "FunctionExpression", + "start":8,"end":44,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":44}}, + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":19,"end":44,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":44}}, + "body": [ + { + "type": "ExpressionStatement", + "start":21,"end":42,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":42}}, + "expression": { + "type": "MetaProperty", + "start":21,"end":41,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":41}}, + "meta": { + "type": "Identifier", + "start":21,"end":24,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":24},"identifierName":"new"}, + "name": "new" + }, + "property": { + "type": "Identifier", + "start":25,"end":41,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":41},"identifierName":"unknown_property"}, + "name": "unknown_property" + } + } + } + ], + "directives": [] + } + } + } + ], + "kind": "var" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-method-definition/migrated_0000/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-method-definition/migrated_0000/output.json index f21c6941d4bc..5a3a57f142ee 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-method-definition/migrated_0000/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-method-definition/migrated_0000/output.json @@ -1,125 +1,35 @@ { "type": "File", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, "program": { "type": "Program", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, "expression": { "type": "AssignmentExpression", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, "operator": "=", "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "right": { "type": "ObjectExpression", - "start": 4, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":4,"end":20,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":20}}, "properties": [ { "type": "ObjectMethod", - "start": 6, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":6,"end":18,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":18}}, "method": true, "key": { "type": "Identifier", - "start": 6, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "method" - }, + "start":6,"end":12,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":12},"identifierName":"method"}, "name": "method" }, "computed": false, @@ -130,18 +40,7 @@ "params": [], "body": { "type": "BlockStatement", - "start": 15, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":15,"end":18,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":18}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-method-definition/migrated_0001/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-method-definition/migrated_0001/output.json index c81975172df7..69bfad8eae51 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-method-definition/migrated_0001/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-method-definition/migrated_0001/output.json @@ -1,125 +1,35 @@ { "type": "File", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "program": { "type": "Program", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "expression": { "type": "AssignmentExpression", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "operator": "=", "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "right": { "type": "ObjectExpression", - "start": 4, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":4,"end":24,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":24}}, "properties": [ { "type": "ObjectMethod", - "start": 6, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":6,"end":22,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":22}}, "method": true, "key": { "type": "Identifier", - "start": 6, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "method" - }, + "start":6,"end":12,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":12},"identifierName":"method"}, "name": "method" }, "computed": false, @@ -130,36 +40,13 @@ "params": [ { "type": "Identifier", - "start": 13, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 17 - }, - "identifierName": "test" - }, + "start":13,"end":17,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":17},"identifierName":"test"}, "name": "test" } ], "body": { "type": "BlockStatement", - "start": 19, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":19,"end":22,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":22}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-method-definition/migrated_0002/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-method-definition/migrated_0002/output.json index 1b04fa1a9e0d..9458f1abaebd 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-method-definition/migrated_0002/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-method-definition/migrated_0002/output.json @@ -1,124 +1,35 @@ { "type": "File", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "program": { "type": "Program", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "expression": { "type": "AssignmentExpression", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "operator": "=", "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "right": { "type": "ObjectExpression", - "start": 4, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":4,"end":22,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":22}}, "properties": [ { "type": "ObjectMethod", - "start": 6, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":6,"end":20,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":20}}, "method": true, "key": { "type": "StringLiteral", - "start": 6, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":6,"end":14,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":14}}, "extra": { "rawValue": "method", "raw": "'method'" @@ -133,18 +44,7 @@ "params": [], "body": { "type": "BlockStatement", - "start": 17, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":17,"end":20,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":20}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-method-definition/migrated_0003/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-method-definition/migrated_0003/output.json index b741ed8e8cc8..e4fe6bae92ef 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-method-definition/migrated_0003/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-method-definition/migrated_0003/output.json @@ -1,125 +1,35 @@ { "type": "File", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "program": { "type": "Program", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "expression": { "type": "AssignmentExpression", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "operator": "=", "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "right": { "type": "ObjectExpression", - "start": 4, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":4,"end":17,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":17}}, "properties": [ { "type": "ObjectMethod", - "start": 6, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":6,"end":15,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":15}}, "method": true, "key": { "type": "Identifier", - "start": 6, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "get" - }, + "start":6,"end":9,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":9},"identifierName":"get"}, "name": "get" }, "computed": false, @@ -130,18 +40,7 @@ "params": [], "body": { "type": "BlockStatement", - "start": 12, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":12,"end":15,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":15}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-method-definition/migrated_0004/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-method-definition/migrated_0004/output.json index dcc857d36a87..501eec0d1df1 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-method-definition/migrated_0004/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-method-definition/migrated_0004/output.json @@ -1,125 +1,35 @@ { "type": "File", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "program": { "type": "Program", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "expression": { "type": "AssignmentExpression", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "operator": "=", "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "right": { "type": "ObjectExpression", - "start": 4, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":4,"end":17,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":17}}, "properties": [ { "type": "ObjectMethod", - "start": 6, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":6,"end":15,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":15}}, "method": true, "key": { "type": "Identifier", - "start": 6, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "set" - }, + "start":6,"end":9,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":9},"identifierName":"set"}, "name": "set" }, "computed": false, @@ -130,18 +40,7 @@ "params": [], "body": { "type": "BlockStatement", - "start": 12, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":12,"end":15,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":15}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/invalid-proto-getter-literal-identifier/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/invalid-proto-getter-literal-identifier/options.json deleted file mode 100644 index de857a114a82..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/invalid-proto-getter-literal-identifier/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Redefinition of __proto__ property (1:39)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/invalid-proto-getter-literal-identifier/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/invalid-proto-getter-literal-identifier/output.json new file mode 100644 index 000000000000..ff24f919512d --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/invalid-proto-getter-literal-identifier/output.json @@ -0,0 +1,89 @@ +{ + "type": "File", + "start":0,"end":58,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":58}}, + "errors": [ + "SyntaxError: Redefinition of __proto__ property (1:39)" + ], + "program": { + "type": "Program", + "start":0,"end":58,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":58}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":58,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":58}}, + "expression": { + "type": "ObjectExpression", + "start":1,"end":57,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":57}}, + "properties": [ + { + "type": "ObjectMethod", + "start":3,"end":18,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":18}}, + "method": false, + "key": { + "type": "Identifier", + "start":7,"end":14,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":14},"identifierName":"__proto"}, + "name": "__proto" + }, + "computed": false, + "kind": "get", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":16,"end":18,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":18}}, + "body": [], + "directives": [] + } + }, + { + "type": "ObjectProperty", + "start":20,"end":37,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":37}}, + "method": false, + "key": { + "type": "StringLiteral", + "start":20,"end":31,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":31}}, + "extra": { + "rawValue": "__proto__", + "raw": "\"__proto__\"" + }, + "value": "__proto__" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "NullLiteral", + "start":33,"end":37,"loc":{"start":{"line":1,"column":33},"end":{"line":1,"column":37}} + } + }, + { + "type": "ObjectProperty", + "start":39,"end":54,"loc":{"start":{"line":1,"column":39},"end":{"line":1,"column":54}}, + "method": false, + "key": { + "type": "Identifier", + "start":39,"end":48,"loc":{"start":{"line":1,"column":39},"end":{"line":1,"column":48},"identifierName":"__proto__"}, + "name": "__proto__" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "NullLiteral", + "start":50,"end":54,"loc":{"start":{"line":1,"column":50},"end":{"line":1,"column":54}} + } + } + ], + "extra": { + "trailingComma": 54, + "parenthesized": true, + "parenStart": 0 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/invalid-proto-identifier-literal/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/invalid-proto-identifier-literal/options.json deleted file mode 100644 index 5c966843f4fa..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/invalid-proto-identifier-literal/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Redefinition of __proto__ property (1:20)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/invalid-proto-identifier-literal/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/invalid-proto-identifier-literal/output.json new file mode 100644 index 000000000000..036a85e2ef45 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/invalid-proto-identifier-literal/output.json @@ -0,0 +1,66 @@ +{ + "type": "File", + "start":0,"end":40,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":40}}, + "errors": [ + "SyntaxError: Redefinition of __proto__ property (1:20)" + ], + "program": { + "type": "Program", + "start":0,"end":40,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":40}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":40,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":40}}, + "expression": { + "type": "ObjectExpression", + "start":1,"end":39,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":39}}, + "properties": [ + { + "type": "ObjectProperty", + "start":3,"end":18,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":18}}, + "method": false, + "key": { + "type": "Identifier", + "start":3,"end":12,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":12},"identifierName":"__proto__"}, + "name": "__proto__" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "NullLiteral", + "start":14,"end":18,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":18}} + } + }, + { + "type": "ObjectProperty", + "start":20,"end":37,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":37}}, + "method": false, + "key": { + "type": "StringLiteral", + "start":20,"end":31,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":31}}, + "extra": { + "rawValue": "__proto__", + "raw": "\"__proto__\"" + }, + "value": "__proto__" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "NullLiteral", + "start":33,"end":37,"loc":{"start":{"line":1,"column":33},"end":{"line":1,"column":37}} + } + } + ], + "extra": { + "parenthesized": true, + "parenStart": 0 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/invalid-proto-identifiers/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/invalid-proto-identifiers/options.json deleted file mode 100644 index 5c966843f4fa..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/invalid-proto-identifiers/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Redefinition of __proto__ property (1:20)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/invalid-proto-identifiers/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/invalid-proto-identifiers/output.json new file mode 100644 index 000000000000..cea3f4803586 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/invalid-proto-identifiers/output.json @@ -0,0 +1,62 @@ +{ + "type": "File", + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":38}}, + "errors": [ + "SyntaxError: Redefinition of __proto__ property (1:20)" + ], + "program": { + "type": "Program", + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":38}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":38}}, + "expression": { + "type": "ObjectExpression", + "start":1,"end":37,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":37}}, + "properties": [ + { + "type": "ObjectProperty", + "start":3,"end":18,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":18}}, + "method": false, + "key": { + "type": "Identifier", + "start":3,"end":12,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":12},"identifierName":"__proto__"}, + "name": "__proto__" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "NullLiteral", + "start":14,"end":18,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":18}} + } + }, + { + "type": "ObjectProperty", + "start":20,"end":35,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":35}}, + "method": false, + "key": { + "type": "Identifier", + "start":20,"end":29,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":29},"identifierName":"__proto__"}, + "name": "__proto__" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "NullLiteral", + "start":31,"end":35,"loc":{"start":{"line":1,"column":31},"end":{"line":1,"column":35}} + } + } + ], + "extra": { + "parenthesized": true, + "parenStart": 0 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/invalid-proto-literal-identifier/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/invalid-proto-literal-identifier/options.json deleted file mode 100644 index e19950ad14df..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/invalid-proto-literal-identifier/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Redefinition of __proto__ property (1:22)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/invalid-proto-literal-identifier/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/invalid-proto-literal-identifier/output.json new file mode 100644 index 000000000000..f8a8b6f0e06f --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/invalid-proto-literal-identifier/output.json @@ -0,0 +1,66 @@ +{ + "type": "File", + "start":0,"end":40,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":40}}, + "errors": [ + "SyntaxError: Redefinition of __proto__ property (1:22)" + ], + "program": { + "type": "Program", + "start":0,"end":40,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":40}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":40,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":40}}, + "expression": { + "type": "ObjectExpression", + "start":1,"end":39,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":39}}, + "properties": [ + { + "type": "ObjectProperty", + "start":3,"end":20,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":20}}, + "method": false, + "key": { + "type": "StringLiteral", + "start":3,"end":14,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":14}}, + "extra": { + "rawValue": "__proto__", + "raw": "\"__proto__\"" + }, + "value": "__proto__" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "NullLiteral", + "start":16,"end":20,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":20}} + } + }, + { + "type": "ObjectProperty", + "start":22,"end":37,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":37}}, + "method": false, + "key": { + "type": "Identifier", + "start":22,"end":31,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":31},"identifierName":"__proto__"}, + "name": "__proto__" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "NullLiteral", + "start":33,"end":37,"loc":{"start":{"line":1,"column":33},"end":{"line":1,"column":37}} + } + } + ], + "extra": { + "parenthesized": true, + "parenStart": 0 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/invalid-proto-literals/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/invalid-proto-literals/options.json deleted file mode 100644 index e19950ad14df..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/invalid-proto-literals/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Redefinition of __proto__ property (1:22)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/invalid-proto-literals/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/invalid-proto-literals/output.json new file mode 100644 index 000000000000..6c50c95aa2f0 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/invalid-proto-literals/output.json @@ -0,0 +1,70 @@ +{ + "type": "File", + "start":0,"end":42,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":42}}, + "errors": [ + "SyntaxError: Redefinition of __proto__ property (1:22)" + ], + "program": { + "type": "Program", + "start":0,"end":42,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":42}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":42,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":42}}, + "expression": { + "type": "ObjectExpression", + "start":1,"end":41,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":41}}, + "properties": [ + { + "type": "ObjectProperty", + "start":3,"end":20,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":20}}, + "method": false, + "key": { + "type": "StringLiteral", + "start":3,"end":14,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":14}}, + "extra": { + "rawValue": "__proto__", + "raw": "\"__proto__\"" + }, + "value": "__proto__" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "NullLiteral", + "start":16,"end":20,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":20}} + } + }, + { + "type": "ObjectProperty", + "start":22,"end":39,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":39}}, + "method": false, + "key": { + "type": "StringLiteral", + "start":22,"end":33,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":33}}, + "extra": { + "rawValue": "__proto__", + "raw": "'__proto__'" + }, + "value": "__proto__" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "NullLiteral", + "start":35,"end":39,"loc":{"start":{"line":1,"column":35},"end":{"line":1,"column":39}} + } + } + ], + "extra": { + "parenthesized": true, + "parenStart": 0 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/invalid-proto-setter-literal-identifier/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/invalid-proto-setter-literal-identifier/options.json deleted file mode 100644 index f364ee918462..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/invalid-proto-setter-literal-identifier/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Redefinition of __proto__ property (1:42)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/invalid-proto-setter-literal-identifier/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/invalid-proto-setter-literal-identifier/output.json new file mode 100644 index 000000000000..9ee4dd7e6aab --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/invalid-proto-setter-literal-identifier/output.json @@ -0,0 +1,95 @@ +{ + "type": "File", + "start":0,"end":61,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":61}}, + "errors": [ + "SyntaxError: Redefinition of __proto__ property (1:42)" + ], + "program": { + "type": "Program", + "start":0,"end":61,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":61}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":61,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":61}}, + "expression": { + "type": "ObjectExpression", + "start":1,"end":60,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":60}}, + "properties": [ + { + "type": "ObjectMethod", + "start":3,"end":21,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":21}}, + "method": false, + "key": { + "type": "Identifier", + "start":7,"end":16,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":16},"identifierName":"__proto__"}, + "name": "__proto__" + }, + "computed": false, + "kind": "set", + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start":17,"end":18,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":18},"identifierName":"x"}, + "name": "x" + } + ], + "body": { + "type": "BlockStatement", + "start":19,"end":21,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":21}}, + "body": [], + "directives": [] + } + }, + { + "type": "ObjectProperty", + "start":23,"end":40,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":40}}, + "method": false, + "key": { + "type": "StringLiteral", + "start":23,"end":34,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":34}}, + "extra": { + "rawValue": "__proto__", + "raw": "\"__proto__\"" + }, + "value": "__proto__" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "NullLiteral", + "start":36,"end":40,"loc":{"start":{"line":1,"column":36},"end":{"line":1,"column":40}} + } + }, + { + "type": "ObjectProperty", + "start":42,"end":57,"loc":{"start":{"line":1,"column":42},"end":{"line":1,"column":57}}, + "method": false, + "key": { + "type": "Identifier", + "start":42,"end":51,"loc":{"start":{"line":1,"column":42},"end":{"line":1,"column":51},"identifierName":"__proto__"}, + "name": "__proto__" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "NullLiteral", + "start":53,"end":57,"loc":{"start":{"line":1,"column":53},"end":{"line":1,"column":57}} + } + } + ], + "extra": { + "trailingComma": 57, + "parenthesized": true, + "parenStart": 0 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/proto-identifier-getter-setter/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/proto-identifier-getter-setter/output.json index f462e8df71fa..a8ceef6250f8 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/proto-identifier-getter-setter/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/proto-identifier-getter-setter/output.json @@ -1,143 +1,42 @@ { "type": "File", - "start": 0, - "end": 60, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 60 - } - }, + "start":0,"end":60,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":60}}, "program": { "type": "Program", - "start": 0, - "end": 60, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 60 - } - }, + "start":0,"end":60,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":60}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 60, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 60 - } - }, + "start":0,"end":60,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":60}}, "expression": { "type": "ObjectExpression", - "start": 1, - "end": 59, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 59 - } - }, + "start":1,"end":59,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":59}}, "properties": [ { "type": "ObjectProperty", - "start": 3, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":3,"end":18,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":18}}, "method": false, "key": { "type": "Identifier", - "start": 3, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "__proto__" - }, + "start":3,"end":12,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":12},"identifierName":"__proto__"}, "name": "__proto__" }, "computed": false, "shorthand": false, "value": { "type": "NullLiteral", - "start": 14, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 18 - } - } + "start":14,"end":18,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":18}} } }, { "type": "ObjectMethod", - "start": 20, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 37 - } - }, + "start":20,"end":37,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":37}}, "method": false, "key": { "type": "Identifier", - "start": 24, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 33 - }, - "identifierName": "__proto__" - }, + "start":24,"end":33,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":33},"identifierName":"__proto__"}, "name": "__proto__" }, "computed": false, @@ -148,52 +47,18 @@ "params": [], "body": { "type": "BlockStatement", - "start": 35, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 35 - }, - "end": { - "line": 1, - "column": 37 - } - }, + "start":35,"end":37,"loc":{"start":{"line":1,"column":35},"end":{"line":1,"column":37}}, "body": [], "directives": [] } }, { "type": "ObjectMethod", - "start": 39, - "end": 57, - "loc": { - "start": { - "line": 1, - "column": 39 - }, - "end": { - "line": 1, - "column": 57 - } - }, + "start":39,"end":57,"loc":{"start":{"line":1,"column":39},"end":{"line":1,"column":57}}, "method": false, "key": { "type": "Identifier", - "start": 43, - "end": 52, - "loc": { - "start": { - "line": 1, - "column": 43 - }, - "end": { - "line": 1, - "column": 52 - }, - "identifierName": "__proto__" - }, + "start":43,"end":52,"loc":{"start":{"line":1,"column":43},"end":{"line":1,"column":52},"identifierName":"__proto__"}, "name": "__proto__" }, "computed": false, @@ -204,36 +69,13 @@ "params": [ { "type": "Identifier", - "start": 53, - "end": 54, - "loc": { - "start": { - "line": 1, - "column": 53 - }, - "end": { - "line": 1, - "column": 54 - }, - "identifierName": "x" - }, + "start":53,"end":54,"loc":{"start":{"line":1,"column":53},"end":{"line":1,"column":54},"identifierName":"x"}, "name": "x" } ], "body": { "type": "BlockStatement", - "start": 55, - "end": 57, - "loc": { - "start": { - "line": 1, - "column": 55 - }, - "end": { - "line": 1, - "column": 57 - } - }, + "start":55,"end":57,"loc":{"start":{"line":1,"column":55},"end":{"line":1,"column":57}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/proto-identifier-getter/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/proto-identifier-getter/output.json index d628d7fbf939..2c7e4152b429 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/proto-identifier-getter/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/proto-identifier-getter/output.json @@ -1,143 +1,42 @@ { "type": "File", - "start": 0, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 40 - } - }, + "start":0,"end":40,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":40}}, "program": { "type": "Program", - "start": 0, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 40 - } - }, + "start":0,"end":40,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":40}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 40 - } - }, + "start":0,"end":40,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":40}}, "expression": { "type": "ObjectExpression", - "start": 1, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 39 - } - }, + "start":1,"end":39,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":39}}, "properties": [ { "type": "ObjectProperty", - "start": 3, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":3,"end":18,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":18}}, "method": false, "key": { "type": "Identifier", - "start": 3, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "__proto__" - }, + "start":3,"end":12,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":12},"identifierName":"__proto__"}, "name": "__proto__" }, "computed": false, "shorthand": false, "value": { "type": "NullLiteral", - "start": 14, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 18 - } - } + "start":14,"end":18,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":18}} } }, { "type": "ObjectMethod", - "start": 20, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 37 - } - }, + "start":20,"end":37,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":37}}, "method": false, "key": { "type": "Identifier", - "start": 24, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 33 - }, - "identifierName": "__proto__" - }, + "start":24,"end":33,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":33},"identifierName":"__proto__"}, "name": "__proto__" }, "computed": false, @@ -148,18 +47,7 @@ "params": [], "body": { "type": "BlockStatement", - "start": 35, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 35 - }, - "end": { - "line": 1, - "column": 37 - } - }, + "start":35,"end":37,"loc":{"start":{"line":1,"column":35},"end":{"line":1,"column":37}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/proto-identifier-method/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/proto-identifier-method/output.json index d6a917129034..efdf56efcc27 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/proto-identifier-method/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/proto-identifier-method/output.json @@ -1,143 +1,42 @@ { "type": "File", - "start": 0, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 37 - } - }, + "start":0,"end":37,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":37}}, "program": { "type": "Program", - "start": 0, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 37 - } - }, + "start":0,"end":37,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":37}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 37 - } - }, + "start":0,"end":37,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":37}}, "expression": { "type": "ObjectExpression", - "start": 1, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":1,"end":36,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":36}}, "properties": [ { "type": "ObjectProperty", - "start": 3, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":3,"end":18,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":18}}, "method": false, "key": { "type": "Identifier", - "start": 3, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "__proto__" - }, + "start":3,"end":12,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":12},"identifierName":"__proto__"}, "name": "__proto__" }, "computed": false, "shorthand": false, "value": { "type": "NullLiteral", - "start": 14, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 18 - } - } + "start":14,"end":18,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":18}} } }, { "type": "ObjectMethod", - "start": 20, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":20,"end":33,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":33}}, "method": true, "key": { "type": "Identifier", - "start": 20, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 29 - }, - "identifierName": "__proto__" - }, + "start":20,"end":29,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":29},"identifierName":"__proto__"}, "name": "__proto__" }, "computed": false, @@ -148,24 +47,14 @@ "params": [], "body": { "type": "BlockStatement", - "start": 31, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 31 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":31,"end":33,"loc":{"start":{"line":1,"column":31},"end":{"line":1,"column":33}}, "body": [], "directives": [] } } ], "extra": { + "trailingComma": 33, "parenthesized": true, "parenStart": 0 } diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/proto-identifier-setter/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/proto-identifier-setter/output.json index 2c2439583c55..c161a16c9d31 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/proto-identifier-setter/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/proto-identifier-setter/output.json @@ -1,143 +1,42 @@ { "type": "File", - "start": 0, - "end": 41, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 41 - } - }, + "start":0,"end":41,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":41}}, "program": { "type": "Program", - "start": 0, - "end": 41, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 41 - } - }, + "start":0,"end":41,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":41}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 41, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 41 - } - }, + "start":0,"end":41,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":41}}, "expression": { "type": "ObjectExpression", - "start": 1, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 40 - } - }, + "start":1,"end":40,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":40}}, "properties": [ { "type": "ObjectProperty", - "start": 3, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":3,"end":18,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":18}}, "method": false, "key": { "type": "Identifier", - "start": 3, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "__proto__" - }, + "start":3,"end":12,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":12},"identifierName":"__proto__"}, "name": "__proto__" }, "computed": false, "shorthand": false, "value": { "type": "NullLiteral", - "start": 14, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 18 - } - } + "start":14,"end":18,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":18}} } }, { "type": "ObjectMethod", - "start": 20, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":20,"end":38,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":38}}, "method": false, "key": { "type": "Identifier", - "start": 24, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 33 - }, - "identifierName": "__proto__" - }, + "start":24,"end":33,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":33},"identifierName":"__proto__"}, "name": "__proto__" }, "computed": false, @@ -148,36 +47,13 @@ "params": [ { "type": "Identifier", - "start": 34, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 34 - }, - "end": { - "line": 1, - "column": 35 - }, - "identifierName": "x" - }, + "start":34,"end":35,"loc":{"start":{"line":1,"column":34},"end":{"line":1,"column":35},"identifierName":"x"}, "name": "x" } ], "body": { "type": "BlockStatement", - "start": 36, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 36 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":36,"end":38,"loc":{"start":{"line":1,"column":36},"end":{"line":1,"column":38}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/proto-identifier-shorthand/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/proto-identifier-shorthand/output.json index 20867c4f1d25..5c58609e4bce 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/proto-identifier-shorthand/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/proto-identifier-shorthand/output.json @@ -1,162 +1,49 @@ { "type": "File", - "start": 0, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, "program": { "type": "Program", - "start": 0, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, "expression": { "type": "ObjectExpression", - "start": 1, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":1,"end":31,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":31}}, "properties": [ { "type": "ObjectProperty", - "start": 3, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":3,"end":18,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":18}}, "method": false, "key": { "type": "Identifier", - "start": 3, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "__proto__" - }, + "start":3,"end":12,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":12},"identifierName":"__proto__"}, "name": "__proto__" }, "computed": false, "shorthand": false, "value": { "type": "NullLiteral", - "start": 14, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 18 - } - } + "start":14,"end":18,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":18}} } }, { "type": "ObjectProperty", - "start": 20, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":20,"end":29,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":29}}, "method": false, "key": { "type": "Identifier", - "start": 20, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 29 - }, - "identifierName": "__proto__" - }, + "start":20,"end":29,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":29},"identifierName":"__proto__"}, "name": "__proto__" }, "computed": false, "shorthand": true, "value": { "type": "Identifier", - "start": 20, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 29 - }, - "identifierName": "__proto__" - }, + "start":20,"end":29,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":29},"identifierName":"__proto__"}, "name": "__proto__" }, "extra": { diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/proto-literal-getter-setter/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/proto-literal-getter-setter/output.json index 78db3aba0b3e..94da8534c5e2 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/proto-literal-getter-setter/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/proto-literal-getter-setter/output.json @@ -1,92 +1,26 @@ { "type": "File", - "start": 0, - "end": 62, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 62 - } - }, + "start":0,"end":62,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":62}}, "program": { "type": "Program", - "start": 0, - "end": 62, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 62 - } - }, + "start":0,"end":62,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":62}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 62, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 62 - } - }, + "start":0,"end":62,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":62}}, "expression": { "type": "ObjectExpression", - "start": 1, - "end": 61, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 61 - } - }, + "start":1,"end":61,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":61}}, "properties": [ { "type": "ObjectProperty", - "start": 3, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":3,"end":20,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":20}}, "method": false, "key": { "type": "StringLiteral", - "start": 3, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":3,"end":14,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":14}}, "extra": { "rawValue": "__proto__", "raw": "\"__proto__\"" @@ -97,50 +31,16 @@ "shorthand": false, "value": { "type": "NullLiteral", - "start": 16, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 20 - } - } + "start":16,"end":20,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":20}} } }, { "type": "ObjectMethod", - "start": 22, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 39 - } - }, + "start":22,"end":39,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":39}}, "method": false, "key": { "type": "Identifier", - "start": 26, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 35 - }, - "identifierName": "__proto__" - }, + "start":26,"end":35,"loc":{"start":{"line":1,"column":26},"end":{"line":1,"column":35},"identifierName":"__proto__"}, "name": "__proto__" }, "computed": false, @@ -151,52 +51,18 @@ "params": [], "body": { "type": "BlockStatement", - "start": 37, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 37 - }, - "end": { - "line": 1, - "column": 39 - } - }, + "start":37,"end":39,"loc":{"start":{"line":1,"column":37},"end":{"line":1,"column":39}}, "body": [], "directives": [] } }, { "type": "ObjectMethod", - "start": 41, - "end": 59, - "loc": { - "start": { - "line": 1, - "column": 41 - }, - "end": { - "line": 1, - "column": 59 - } - }, + "start":41,"end":59,"loc":{"start":{"line":1,"column":41},"end":{"line":1,"column":59}}, "method": false, "key": { "type": "Identifier", - "start": 45, - "end": 54, - "loc": { - "start": { - "line": 1, - "column": 45 - }, - "end": { - "line": 1, - "column": 54 - }, - "identifierName": "__proto__" - }, + "start":45,"end":54,"loc":{"start":{"line":1,"column":45},"end":{"line":1,"column":54},"identifierName":"__proto__"}, "name": "__proto__" }, "computed": false, @@ -207,36 +73,13 @@ "params": [ { "type": "Identifier", - "start": 55, - "end": 56, - "loc": { - "start": { - "line": 1, - "column": 55 - }, - "end": { - "line": 1, - "column": 56 - }, - "identifierName": "x" - }, + "start":55,"end":56,"loc":{"start":{"line":1,"column":55},"end":{"line":1,"column":56},"identifierName":"x"}, "name": "x" } ], "body": { "type": "BlockStatement", - "start": 57, - "end": 59, - "loc": { - "start": { - "line": 1, - "column": 57 - }, - "end": { - "line": 1, - "column": 59 - } - }, + "start":57,"end":59,"loc":{"start":{"line":1,"column":57},"end":{"line":1,"column":59}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/proto-literal-getter/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/proto-literal-getter/output.json index 6dc20f542bfa..bc0b2f3ecc47 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/proto-literal-getter/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/proto-literal-getter/output.json @@ -1,92 +1,26 @@ { "type": "File", - "start": 0, - "end": 42, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 42 - } - }, + "start":0,"end":42,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":42}}, "program": { "type": "Program", - "start": 0, - "end": 42, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 42 - } - }, + "start":0,"end":42,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":42}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 42, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 42 - } - }, + "start":0,"end":42,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":42}}, "expression": { "type": "ObjectExpression", - "start": 1, - "end": 41, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 41 - } - }, + "start":1,"end":41,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":41}}, "properties": [ { "type": "ObjectProperty", - "start": 3, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":3,"end":20,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":20}}, "method": false, "key": { "type": "StringLiteral", - "start": 3, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":3,"end":14,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":14}}, "extra": { "rawValue": "__proto__", "raw": "\"__proto__\"" @@ -97,50 +31,16 @@ "shorthand": false, "value": { "type": "NullLiteral", - "start": 16, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 20 - } - } + "start":16,"end":20,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":20}} } }, { "type": "ObjectMethod", - "start": 22, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 39 - } - }, + "start":22,"end":39,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":39}}, "method": false, "key": { "type": "Identifier", - "start": 26, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 35 - }, - "identifierName": "__proto__" - }, + "start":26,"end":35,"loc":{"start":{"line":1,"column":26},"end":{"line":1,"column":35},"identifierName":"__proto__"}, "name": "__proto__" }, "computed": false, @@ -151,18 +51,7 @@ "params": [], "body": { "type": "BlockStatement", - "start": 37, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 37 - }, - "end": { - "line": 1, - "column": 39 - } - }, + "start":37,"end":39,"loc":{"start":{"line":1,"column":37},"end":{"line":1,"column":39}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/proto-literal-method/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/proto-literal-method/output.json index 0995b435bf70..7c3e91646b63 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/proto-literal-method/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/proto-literal-method/output.json @@ -1,92 +1,26 @@ { "type": "File", - "start": 0, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 39 - } - }, + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":39}}, "program": { "type": "Program", - "start": 0, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 39 - } - }, + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":39}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 39 - } - }, + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":39}}, "expression": { "type": "ObjectExpression", - "start": 1, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":1,"end":38,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":38}}, "properties": [ { "type": "ObjectProperty", - "start": 3, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":3,"end":20,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":20}}, "method": false, "key": { "type": "StringLiteral", - "start": 3, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":3,"end":14,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":14}}, "extra": { "rawValue": "__proto__", "raw": "\"__proto__\"" @@ -97,50 +31,16 @@ "shorthand": false, "value": { "type": "NullLiteral", - "start": 16, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 20 - } - } + "start":16,"end":20,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":20}} } }, { "type": "ObjectMethod", - "start": 22, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":22,"end":35,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":35}}, "method": true, "key": { "type": "Identifier", - "start": 22, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 31 - }, - "identifierName": "__proto__" - }, + "start":22,"end":31,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":31},"identifierName":"__proto__"}, "name": "__proto__" }, "computed": false, @@ -151,24 +51,14 @@ "params": [], "body": { "type": "BlockStatement", - "start": 33, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 33 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":33,"end":35,"loc":{"start":{"line":1,"column":33},"end":{"line":1,"column":35}}, "body": [], "directives": [] } } ], "extra": { + "trailingComma": 35, "parenthesized": true, "parenStart": 0 } diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/proto-literal-setter/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/proto-literal-setter/output.json index b9973f045030..786fd46e74fd 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/proto-literal-setter/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/proto-literal-setter/output.json @@ -1,92 +1,26 @@ { "type": "File", - "start": 0, - "end": 43, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 43 - } - }, + "start":0,"end":43,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":43}}, "program": { "type": "Program", - "start": 0, - "end": 43, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 43 - } - }, + "start":0,"end":43,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":43}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 43, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 43 - } - }, + "start":0,"end":43,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":43}}, "expression": { "type": "ObjectExpression", - "start": 1, - "end": 42, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 42 - } - }, + "start":1,"end":42,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":42}}, "properties": [ { "type": "ObjectProperty", - "start": 3, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":3,"end":20,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":20}}, "method": false, "key": { "type": "StringLiteral", - "start": 3, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":3,"end":14,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":14}}, "extra": { "rawValue": "__proto__", "raw": "\"__proto__\"" @@ -97,50 +31,16 @@ "shorthand": false, "value": { "type": "NullLiteral", - "start": 16, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 20 - } - } + "start":16,"end":20,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":20}} } }, { "type": "ObjectMethod", - "start": 22, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 40 - } - }, + "start":22,"end":40,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":40}}, "method": false, "key": { "type": "Identifier", - "start": 26, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 35 - }, - "identifierName": "__proto__" - }, + "start":26,"end":35,"loc":{"start":{"line":1,"column":26},"end":{"line":1,"column":35},"identifierName":"__proto__"}, "name": "__proto__" }, "computed": false, @@ -151,36 +51,13 @@ "params": [ { "type": "Identifier", - "start": 36, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 36 - }, - "end": { - "line": 1, - "column": 37 - }, - "identifierName": "x" - }, + "start":36,"end":37,"loc":{"start":{"line":1,"column":36},"end":{"line":1,"column":37},"identifierName":"x"}, "name": "x" } ], "body": { "type": "BlockStatement", - "start": 38, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 38 - }, - "end": { - "line": 1, - "column": 40 - } - }, + "start":38,"end":40,"loc":{"start":{"line":1,"column":38},"end":{"line":1,"column":40}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/proto-literal-shorthand/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/proto-literal-shorthand/output.json index 43f28e81ab32..f74df79bf831 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/proto-literal-shorthand/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/proto-literal-shorthand/output.json @@ -1,92 +1,26 @@ { "type": "File", - "start": 0, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, "program": { "type": "Program", - "start": 0, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, "expression": { "type": "ObjectExpression", - "start": 1, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":1,"end":33,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":33}}, "properties": [ { "type": "ObjectProperty", - "start": 3, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":3,"end":20,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":20}}, "method": false, "key": { "type": "StringLiteral", - "start": 3, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":3,"end":14,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":14}}, "extra": { "rawValue": "__proto__", "raw": "\"__proto__\"" @@ -97,69 +31,23 @@ "shorthand": false, "value": { "type": "NullLiteral", - "start": 16, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 20 - } - } + "start":16,"end":20,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":20}} } }, { "type": "ObjectProperty", - "start": 22, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":22,"end":31,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":31}}, "method": false, "key": { "type": "Identifier", - "start": 22, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 31 - }, - "identifierName": "__proto__" - }, + "start":22,"end":31,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":31},"identifierName":"__proto__"}, "name": "__proto__" }, "computed": false, "shorthand": true, "value": { "type": "Identifier", - "start": 22, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 31 - }, - "identifierName": "__proto__" - }, + "start":22,"end":31,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":31},"identifierName":"__proto__"}, "name": "__proto__" }, "extra": { diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/proto-shorthand-identifier/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/proto-shorthand-identifier/output.json index 28fc9127cd03..2dd25f658726 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/proto-shorthand-identifier/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/proto-shorthand-identifier/output.json @@ -1,112 +1,33 @@ { "type": "File", - "start": 0, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, "program": { "type": "Program", - "start": 0, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, "expression": { "type": "ObjectExpression", - "start": 1, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":1,"end":31,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":31}}, "properties": [ { "type": "ObjectProperty", - "start": 3, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":3,"end":12,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":12}}, "method": false, "key": { "type": "Identifier", - "start": 3, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "__proto__" - }, + "start":3,"end":12,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":12},"identifierName":"__proto__"}, "name": "__proto__" }, "computed": false, "shorthand": true, "value": { "type": "Identifier", - "start": 3, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "__proto__" - }, + "start":3,"end":12,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":12},"identifierName":"__proto__"}, "name": "__proto__" }, "extra": { @@ -115,52 +36,18 @@ }, { "type": "ObjectProperty", - "start": 14, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":14,"end":29,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":29}}, "method": false, "key": { "type": "Identifier", - "start": 14, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 23 - }, - "identifierName": "__proto__" - }, + "start":14,"end":23,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":23},"identifierName":"__proto__"}, "name": "__proto__" }, "computed": false, "shorthand": false, "value": { "type": "NullLiteral", - "start": 25, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 29 - } - } + "start":25,"end":29,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":29}} } } ], diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/proto-shorthand-literal/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/proto-shorthand-literal/output.json index 5bfefd1a3925..c667c59f9a30 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/proto-shorthand-literal/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/proto-shorthand-literal/output.json @@ -1,112 +1,33 @@ { "type": "File", - "start": 0, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, "program": { "type": "Program", - "start": 0, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, "expression": { "type": "ObjectExpression", - "start": 1, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":1,"end":33,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":33}}, "properties": [ { "type": "ObjectProperty", - "start": 3, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":3,"end":12,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":12}}, "method": false, "key": { "type": "Identifier", - "start": 3, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "__proto__" - }, + "start":3,"end":12,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":12},"identifierName":"__proto__"}, "name": "__proto__" }, "computed": false, "shorthand": true, "value": { "type": "Identifier", - "start": 3, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "__proto__" - }, + "start":3,"end":12,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":12},"identifierName":"__proto__"}, "name": "__proto__" }, "extra": { @@ -115,33 +36,11 @@ }, { "type": "ObjectProperty", - "start": 14, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":14,"end":31,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":31}}, "method": false, "key": { "type": "StringLiteral", - "start": 14, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":14,"end":25,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":25}}, "extra": { "rawValue": "__proto__", "raw": "\"__proto__\"" @@ -152,18 +51,7 @@ "shorthand": false, "value": { "type": "NullLiteral", - "start": 27, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 31 - } - } + "start":27,"end":31,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":31}} } } ], diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/proto-shorthands/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/proto-shorthands/output.json index 23f3d43707e1..1b1324a6d487 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/proto-shorthands/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/proto-shorthands/output.json @@ -1,112 +1,33 @@ { "type": "File", - "start": 0, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, "program": { "type": "Program", - "start": 0, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, "expression": { "type": "ObjectExpression", - "start": 1, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":1,"end":25,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":25}}, "properties": [ { "type": "ObjectProperty", - "start": 3, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":3,"end":12,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":12}}, "method": false, "key": { "type": "Identifier", - "start": 3, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "__proto__" - }, + "start":3,"end":12,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":12},"identifierName":"__proto__"}, "name": "__proto__" }, "computed": false, "shorthand": true, "value": { "type": "Identifier", - "start": 3, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "__proto__" - }, + "start":3,"end":12,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":12},"identifierName":"__proto__"}, "name": "__proto__" }, "extra": { @@ -115,53 +36,18 @@ }, { "type": "ObjectProperty", - "start": 14, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":14,"end":23,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":23}}, "method": false, "key": { "type": "Identifier", - "start": 14, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 23 - }, - "identifierName": "__proto__" - }, + "start":14,"end":23,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":23},"identifierName":"__proto__"}, "name": "__proto__" }, "computed": false, "shorthand": true, "value": { "type": "Identifier", - "start": 14, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 23 - }, - "identifierName": "__proto__" - }, + "start":14,"end":23,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":23},"identifierName":"__proto__"}, "name": "__proto__" }, "extra": { diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-object-literal-property-value-shorthand/migrated_0000/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-object-literal-property-value-shorthand/migrated_0000/output.json index 4d782bacf314..d3c16c2f9e79 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-object-literal-property-value-shorthand/migrated_0000/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-object-literal-property-value-shorthand/migrated_0000/output.json @@ -1,144 +1,42 @@ { "type": "File", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, "program": { "type": "Program", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, "expression": { "type": "AssignmentExpression", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, "operator": "=", "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "right": { "type": "ObjectExpression", - "start": 4, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":4,"end":12,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":12}}, "properties": [ { "type": "ObjectProperty", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7}}, "method": false, "key": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "y" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"y"}, "name": "y" }, "computed": false, "shorthand": true, "value": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "y" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"y"}, "name": "y" }, "extra": { @@ -147,53 +45,18 @@ }, { "type": "ObjectProperty", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10}}, "method": false, "key": { "type": "Identifier", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - }, - "identifierName": "z" - }, + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"z"}, "name": "z" }, "computed": false, "shorthand": true, "value": { "type": "Identifier", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - }, - "identifierName": "z" - }, + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"z"}, "name": "z" }, "extra": { diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-object-pattern/elision/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-object-pattern/elision/output.json index 4f6c7b8f2be5..05304c5be13a 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-object-pattern/elision/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-object-pattern/elision/output.json @@ -1,149 +1,51 @@ { "type": "File", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, "program": { "type": "Program", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":4,"end":12,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":12}}, "id": { "type": "ObjectPattern", - "start": 4, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":4,"end":8,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":8}}, "properties": [ { "type": "ObjectProperty", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, "method": false, "key": { "type": "Identifier", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "a" - }, + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"a"}, "name": "a" }, "computed": false, "shorthand": true, "value": { "type": "Identifier", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "a" - }, + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"a"}, "name": "a" }, "extra": { "shorthand": true } } - ] + ], + "extra": { + "trailingComma": 6 + } }, "init": { "type": "NumericLiteral", - "start": 11, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":11,"end":12,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":12}}, "extra": { "rawValue": 0, "raw": "0" diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-object-pattern/empty-catch-param/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-object-pattern/empty-catch-param/output.json index 528fb144b23c..c558c55697da 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-object-pattern/empty-catch-param/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-object-pattern/empty-catch-param/output.json @@ -1,109 +1,32 @@ { "type": "File", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, "program": { "type": "Program", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "TryStatement", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, "block": { "type": "BlockStatement", - "start": 4, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":4,"end":7,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":7}}, "body": [], "directives": [] }, "handler": { "type": "CatchClause", - "start": 8, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":8,"end":21,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":21}}, "param": { "type": "ObjectPattern", - "start": 15, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":15,"end":17,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":17}}, "properties": [] }, "body": { "type": "BlockStatement", - "start": 19, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":19,"end":21,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":21}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-object-pattern/empty-fn/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-object-pattern/empty-fn/output.json index eff1ea1fd4be..1bca4ed97b3a 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-object-pattern/empty-fn/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-object-pattern/empty-fn/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "program": { "type": "Program", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "id": { "type": "Identifier", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - }, - "identifierName": "a" - }, + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"a"}, "name": "a" }, "generator": false, @@ -65,35 +20,13 @@ "params": [ { "type": "ObjectPattern", - "start": 11, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":11,"end":13,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":13}}, "properties": [] } ], "body": { "type": "BlockStatement", - "start": 15, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":15,"end":17,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":17}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-object-pattern/empty-for-lex/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-object-pattern/empty-for-lex/output.json index 4a0563260817..44eb28b6aa3f 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-object-pattern/empty-for-lex/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-object-pattern/empty-for-lex/output.json @@ -1,91 +1,25 @@ { "type": "File", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, "program": { "type": "Program", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ForInStatement", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, "left": { "type": "VariableDeclaration", - "start": 5, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":5,"end":11,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":11}}, "declarations": [ { "type": "VariableDeclarator", - "start": 9, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":9,"end":11,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":11}}, "id": { "type": "ObjectPattern", - "start": 9, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":9,"end":11,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":11}}, "properties": [] }, "init": null @@ -95,18 +29,7 @@ }, "right": { "type": "NumericLiteral", - "start": 15, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":15,"end":16,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":16}}, "extra": { "rawValue": 0, "raw": "0" @@ -115,18 +38,7 @@ }, "body": { "type": "EmptyStatement", - "start": 17, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - } - } + "start":17,"end":18,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":18}} } } ], diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-object-pattern/empty-lexical/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-object-pattern/empty-lexical/output.json index d154c58b0009..50c06e1b755b 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-object-pattern/empty-lexical/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-object-pattern/empty-lexical/output.json @@ -1,93 +1,27 @@ { "type": "File", - "start": 0, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, "program": { "type": "Program", - "start": 0, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":4,"end":10,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":10}}, "id": { "type": "ObjectPattern", - "start": 4, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":4,"end":6,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":6}}, "properties": [] }, "init": { "type": "NumericLiteral", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10}}, "extra": { "rawValue": 0, "raw": "0" diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-object-pattern/empty-var/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-object-pattern/empty-var/output.json index ab870af50ec0..cf0391f09f1c 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-object-pattern/empty-var/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-object-pattern/empty-var/output.json @@ -1,93 +1,27 @@ { "type": "File", - "start": 0, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, "program": { "type": "Program", - "start": 0, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":4,"end":10,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":10}}, "id": { "type": "ObjectPattern", - "start": 4, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":4,"end":6,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":6}}, "properties": [] }, "init": { "type": "NumericLiteral", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10}}, "extra": { "rawValue": 0, "raw": "0" diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-object-pattern/nested/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-object-pattern/nested/output.json index 995c478e846a..3c7f97dae6bf 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-object-pattern/nested/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-object-pattern/nested/output.json @@ -1,126 +1,37 @@ { "type": "File", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "program": { "type": "Program", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":4,"end":14,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":14}}, "id": { "type": "ObjectPattern", - "start": 4, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":4,"end":10,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":10}}, "properties": [ { "type": "ObjectProperty", - "start": 5, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":5,"end":9,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":9}}, "method": false, "key": { "type": "Identifier", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "a" - }, + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"a"}, "name": "a" }, "computed": false, "shorthand": false, "value": { "type": "ObjectPattern", - "start": 7, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":7,"end":9,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":9}}, "properties": [] } } @@ -128,18 +39,7 @@ }, "init": { "type": "NumericLiteral", - "start": 13, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":13,"end":14,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":14}}, "extra": { "rawValue": 0, "raw": "0" diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-object-pattern/properties/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-object-pattern/properties/output.json index ee694093e22f..8a00d0c2d9ba 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-object-pattern/properties/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-object-pattern/properties/output.json @@ -1,127 +1,37 @@ { "type": "File", - "start": 0, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, "program": { "type": "Program", - "start": 0, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":4,"end":31,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":31}}, "id": { "type": "ObjectPattern", - "start": 4, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":4,"end":29,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":29}}, "properties": [ { "type": "ObjectProperty", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, "method": false, "key": { "type": "Identifier", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "a" - }, + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"a"}, "name": "a" }, "computed": false, "shorthand": true, "value": { "type": "Identifier", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "a" - }, + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"a"}, "name": "a" }, "extra": { @@ -130,83 +40,26 @@ }, { "type": "ObjectProperty", - "start": 7, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":7,"end":10,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":10}}, "method": false, "key": { "type": "Identifier", - "start": 7, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - }, - "identifierName": "b" - }, + "start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8},"identifierName":"b"}, "name": "b" }, "computed": false, "shorthand": true, "value": { "type": "AssignmentPattern", - "start": 7, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":7,"end":10,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":10}}, "left": { "type": "Identifier", - "start": 7, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - }, - "identifierName": "b" - }, + "start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8},"identifierName":"b"}, "name": "b" }, "right": { "type": "NumericLiteral", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10}}, "extra": { "rawValue": 0, "raw": "0" @@ -220,135 +73,43 @@ }, { "type": "ObjectProperty", - "start": 11, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":11,"end":14,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":14}}, "method": false, "key": { "type": "Identifier", - "start": 11, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "c" - }, + "start":11,"end":12,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":12},"identifierName":"c"}, "name": "c" }, "computed": false, "shorthand": false, "value": { "type": "Identifier", - "start": 13, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - }, - "identifierName": "d" - }, + "start":13,"end":14,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":14},"identifierName":"d"}, "name": "d" } }, { "type": "ObjectProperty", - "start": 15, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":15,"end":20,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":20}}, "method": false, "key": { "type": "Identifier", - "start": 15, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - }, - "identifierName": "e" - }, + "start":15,"end":16,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":16},"identifierName":"e"}, "name": "e" }, "computed": false, "shorthand": false, "value": { "type": "AssignmentPattern", - "start": 17, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":17,"end":20,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":20}}, "left": { "type": "Identifier", - "start": 17, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - }, - "identifierName": "f" - }, + "start":17,"end":18,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":18},"identifierName":"f"}, "name": "f" }, "right": { "type": "NumericLiteral", - "start": 19, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":19,"end":20,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":20}}, "extra": { "rawValue": 0, "raw": "0" @@ -359,68 +120,22 @@ }, { "type": "ObjectProperty", - "start": 21, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":21,"end":28,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":28}}, "method": false, "computed": true, "key": { "type": "Identifier", - "start": 22, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 23 - }, - "identifierName": "g" - }, + "start":22,"end":23,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":23},"identifierName":"g"}, "name": "g" }, "shorthand": false, "value": { "type": "ArrayPattern", - "start": 25, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":25,"end":28,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":28}}, "elements": [ { "type": "Identifier", - "start": 26, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 27 - }, - "identifierName": "h" - }, + "start":26,"end":27,"loc":{"start":{"line":1,"column":26},"end":{"line":1,"column":27},"identifierName":"h"}, "name": "h" } ] @@ -430,18 +145,7 @@ }, "init": { "type": "NumericLiteral", - "start": 30, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":30,"end":31,"loc":{"start":{"line":1,"column":30},"end":{"line":1,"column":31}}, "extra": { "rawValue": 0, "raw": "0" diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-octal-integer-literal/migrated_0000/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-octal-integer-literal/migrated_0000/output.json index b1465d1f5423..fbed9f8857d5 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-octal-integer-literal/migrated_0000/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-octal-integer-literal/migrated_0000/output.json @@ -1,62 +1,18 @@ { "type": "File", - "start": 0, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 2 - } - }, + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}}, "program": { "type": "Program", - "start": 0, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 2 - } - }, + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 2 - } - }, + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}}, "expression": { "type": "NumericLiteral", - "start": 0, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 2 - } - }, + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}}, "extra": { "rawValue": 0, "raw": "00" diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-octal-integer-literal/migrated_0001/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-octal-integer-literal/migrated_0001/output.json index ba347ead99ce..69b1fc0dba64 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-octal-integer-literal/migrated_0001/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-octal-integer-literal/migrated_0001/output.json @@ -1,62 +1,18 @@ { "type": "File", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, "program": { "type": "Program", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, "expression": { "type": "NumericLiteral", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, "extra": { "rawValue": 0, "raw": "0o0" diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-octal-integer-literal/migrated_0002/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-octal-integer-literal/migrated_0002/output.json index d5fe344096cb..61be53c7f1b1 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-octal-integer-literal/migrated_0002/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-octal-integer-literal/migrated_0002/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 37 - } - }, + "start":0,"end":37,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":37}}, "program": { "type": "Program", - "start": 0, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 37 - } - }, + "start":0,"end":37,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":37}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 37 - } - }, + "start":0,"end":37,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":37}}, "id": { "type": "Identifier", - "start": 9, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 13 - }, - "identifierName": "test" - }, + "start":9,"end":13,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":13},"identifierName":"test"}, "name": "test" }, "generator": false, @@ -65,47 +20,14 @@ "params": [], "body": { "type": "BlockStatement", - "start": 16, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 37 - } - }, + "start":16,"end":37,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":37}}, "body": [ { "type": "ExpressionStatement", - "start": 31, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 31 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":31,"end":35,"loc":{"start":{"line":1,"column":31},"end":{"line":1,"column":35}}, "expression": { "type": "NumericLiteral", - "start": 31, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 31 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":31,"end":34,"loc":{"start":{"line":1,"column":31},"end":{"line":1,"column":34}}, "extra": { "rawValue": 0, "raw": "0o0" @@ -117,32 +39,10 @@ "directives": [ { "type": "Directive", - "start": 17, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":17,"end":30,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":30}}, "value": { "type": "DirectiveLiteral", - "start": 17, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":17,"end":29,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":29}}, "value": "use strict", "extra": { "raw": "'use strict'", diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-octal-integer-literal/migrated_0003/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-octal-integer-literal/migrated_0003/output.json index 83bb02767b09..8e667f20e78c 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-octal-integer-literal/migrated_0003/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-octal-integer-literal/migrated_0003/output.json @@ -1,62 +1,18 @@ { "type": "File", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, "program": { "type": "Program", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, "expression": { "type": "NumericLiteral", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, "extra": { "rawValue": 2, "raw": "0o2" diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-octal-integer-literal/migrated_0004/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-octal-integer-literal/migrated_0004/output.json index b6a8fbeae786..cb18be592388 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-octal-integer-literal/migrated_0004/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-octal-integer-literal/migrated_0004/output.json @@ -1,62 +1,18 @@ { "type": "File", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - }, + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, "program": { "type": "Program", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - }, + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - }, + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, "expression": { "type": "NumericLiteral", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - }, + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, "extra": { "rawValue": 10, "raw": "0o12" diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-octal-integer-literal/migrated_0005/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-octal-integer-literal/migrated_0005/output.json index 28ed79418715..88aa9ec11b21 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-octal-integer-literal/migrated_0005/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-octal-integer-literal/migrated_0005/output.json @@ -1,62 +1,18 @@ { "type": "File", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, "program": { "type": "Program", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, "expression": { "type": "NumericLiteral", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, "extra": { "rawValue": 0, "raw": "0O0" diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-octal-integer-literal/migrated_0006/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-octal-integer-literal/migrated_0006/output.json index c8c90942d52b..055a0e3f115c 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-octal-integer-literal/migrated_0006/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-octal-integer-literal/migrated_0006/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 37 - } - }, + "start":0,"end":37,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":37}}, "program": { "type": "Program", - "start": 0, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 37 - } - }, + "start":0,"end":37,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":37}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 37 - } - }, + "start":0,"end":37,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":37}}, "id": { "type": "Identifier", - "start": 9, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 13 - }, - "identifierName": "test" - }, + "start":9,"end":13,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":13},"identifierName":"test"}, "name": "test" }, "generator": false, @@ -65,47 +20,14 @@ "params": [], "body": { "type": "BlockStatement", - "start": 16, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 37 - } - }, + "start":16,"end":37,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":37}}, "body": [ { "type": "ExpressionStatement", - "start": 31, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 31 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":31,"end":35,"loc":{"start":{"line":1,"column":31},"end":{"line":1,"column":35}}, "expression": { "type": "NumericLiteral", - "start": 31, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 31 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":31,"end":34,"loc":{"start":{"line":1,"column":31},"end":{"line":1,"column":34}}, "extra": { "rawValue": 0, "raw": "0O0" @@ -117,32 +39,10 @@ "directives": [ { "type": "Directive", - "start": 17, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":17,"end":30,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":30}}, "value": { "type": "DirectiveLiteral", - "start": 17, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":17,"end":29,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":29}}, "value": "use strict", "extra": { "raw": "'use strict'", diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-rest-parameter/function-declaration/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-rest-parameter/function-declaration/output.json index 6d5be9476898..572ab04a242e 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-rest-parameter/function-declaration/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-rest-parameter/function-declaration/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "program": { "type": "Program", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "id": { "type": "Identifier", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - }, - "identifierName": "f" - }, + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"f"}, "name": "f" }, "generator": false, @@ -65,68 +20,22 @@ "params": [ { "type": "Identifier", - "start": 11, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "a" - }, + "start":11,"end":12,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":12},"identifierName":"a"}, "name": "a" }, { "type": "RestElement", - "start": 14, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":14,"end":18,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":18}}, "argument": { "type": "Identifier", - "start": 17, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - }, - "identifierName": "b" - }, + "start":17,"end":18,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":18},"identifierName":"b"}, "name": "b" } } ], "body": { "type": "BlockStatement", - "start": 20, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":20,"end":22,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":22}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-rest-parameter/function-expression/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-rest-parameter/function-expression/output.json index 292e5947e006..efed9fb6b3fe 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-rest-parameter/function-expression/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-rest-parameter/function-expression/output.json @@ -1,162 +1,49 @@ { "type": "File", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "program": { "type": "Program", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "expression": { "type": "AssignmentExpression", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "operator": "=", "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "f" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"f"}, "name": "f" }, "right": { "type": "FunctionExpression", - "start": 4, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":4,"end":24,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":24}}, "id": null, "generator": false, "async": false, "params": [ { "type": "Identifier", - "start": 13, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - }, - "identifierName": "a" - }, + "start":13,"end":14,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":14},"identifierName":"a"}, "name": "a" }, { "type": "RestElement", - "start": 16, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":16,"end":20,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":20}}, "argument": { "type": "Identifier", - "start": 19, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 20 - }, - "identifierName": "b" - }, + "start":19,"end":20,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":20},"identifierName":"b"}, "name": "b" } } ], "body": { "type": "BlockStatement", - "start": 22, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":22,"end":24,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":24}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-rest-parameter/object-method/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-rest-parameter/object-method/output.json index 2a7cf3384295..b47cdbe229fc 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-rest-parameter/object-method/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-rest-parameter/object-method/output.json @@ -1,211 +1,64 @@ { "type": "File", - "start": 0, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, "program": { "type": "Program", - "start": 0, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, "expression": { "type": "AssignmentExpression", - "start": 0, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, "operator": "=", "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "o" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"o"}, "name": "o" }, "right": { "type": "ObjectExpression", - "start": 4, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":4,"end":31,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":31}}, "properties": [ { "type": "ObjectProperty", - "start": 6, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":6,"end":29,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":29}}, "method": false, "key": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "f" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"f"}, "name": "f" }, "computed": false, "shorthand": false, "value": { "type": "FunctionExpression", - "start": 9, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":9,"end":29,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":29}}, "id": null, "generator": false, "async": false, "params": [ { "type": "Identifier", - "start": 18, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - }, - "identifierName": "a" - }, + "start":18,"end":19,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":19},"identifierName":"a"}, "name": "a" }, { "type": "RestElement", - "start": 21, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":21,"end":25,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":25}}, "argument": { "type": "Identifier", - "start": 24, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 25 - }, - "identifierName": "b" - }, + "start":24,"end":25,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":25},"identifierName":"b"}, "name": "b" } } ], "body": { "type": "BlockStatement", - "start": 27, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":27,"end":29,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":29}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-rest-parameter/object-shorthand-method/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-rest-parameter/object-shorthand-method/output.json index 2b0e6f95c3e3..0e1543e81b8b 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-rest-parameter/object-shorthand-method/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-rest-parameter/object-shorthand-method/output.json @@ -1,125 +1,35 @@ { "type": "File", - "start": 0, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, "program": { "type": "Program", - "start": 0, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, "expression": { "type": "AssignmentExpression", - "start": 0, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, "operator": "=", "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "right": { "type": "ObjectExpression", - "start": 4, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":4,"end":27,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":27}}, "properties": [ { "type": "ObjectMethod", - "start": 6, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":6,"end":25,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":25}}, "method": true, "key": { "type": "Identifier", - "start": 6, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "method" - }, + "start":6,"end":12,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":12},"identifierName":"method"}, "name": "method" }, "computed": false, @@ -130,51 +40,17 @@ "params": [ { "type": "RestElement", - "start": 13, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":13,"end":20,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":20}}, "argument": { "type": "Identifier", - "start": 16, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 20 - }, - "identifierName": "test" - }, + "start":16,"end":20,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":20},"identifierName":"test"}, "name": "test" } } ], "body": { "type": "BlockStatement", - "start": 22, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":22,"end":25,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":25}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-spread-element/call-multi-spread/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-spread-element/call-multi-spread/output.json index 7f2e414d39be..03a2baa18703 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-spread-element/call-multi-spread/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-spread-element/call-multi-spread/output.json @@ -1,173 +1,48 @@ { "type": "File", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, "program": { "type": "Program", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, "expression": { "type": "CallExpression", - "start": 0, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, "callee": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "f" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"f"}, "name": "f" }, "arguments": [ { "type": "SpreadElement", - "start": 2, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":2,"end":6,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":6}}, "argument": { "type": "Identifier", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "x" - }, + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"x"}, "name": "x" } }, { "type": "SpreadElement", - "start": 8, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":8,"end":12,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":12}}, "argument": { "type": "Identifier", - "start": 11, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "y" - }, + "start":11,"end":12,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":12},"identifierName":"y"}, "name": "y" } }, { "type": "SpreadElement", - "start": 14, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":14,"end":18,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":18}}, "argument": { "type": "Identifier", - "start": 17, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - }, - "identifierName": "z" - }, + "start":17,"end":18,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":18},"identifierName":"z"}, "name": "z" } } diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-spread-element/call-spread-default/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-spread-element/call-spread-default/output.json index d184a8264914..7be40e58091b 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-spread-element/call-spread-default/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-spread-element/call-spread-default/output.json @@ -1,158 +1,44 @@ { "type": "File", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "program": { "type": "Program", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "expression": { "type": "CallExpression", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "callee": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "f" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"f"}, "name": "f" }, "arguments": [ { "type": "Identifier", - "start": 2, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 3 - }, - "identifierName": "g" - }, + "start":2,"end":3,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":3},"identifierName":"g"}, "name": "g" }, { "type": "SpreadElement", - "start": 5, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":5,"end":13,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":13}}, "argument": { "type": "AssignmentExpression", - "start": 8, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":8,"end":13,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":13}}, "operator": "=", "left": { "type": "Identifier", - "start": 8, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "h" - }, + "start":8,"end":9,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":9},"identifierName":"h"}, "name": "h" }, "right": { "type": "Identifier", - "start": 12, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - }, - "identifierName": "i" - }, + "start":12,"end":13,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":13},"identifierName":"i"}, "name": "i" } } diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-spread-element/call-spread-first/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-spread-element/call-spread-first/output.json index dd7f63dd5914..843b7d41c97e 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-spread-element/call-spread-first/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-spread-element/call-spread-first/output.json @@ -1,144 +1,41 @@ { "type": "File", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "program": { "type": "Program", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "expression": { "type": "CallExpression", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "callee": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "f" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"f"}, "name": "f" }, "arguments": [ { "type": "SpreadElement", - "start": 2, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":2,"end":6,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":6}}, "argument": { "type": "Identifier", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "x" - }, + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"x"}, "name": "x" } }, { "type": "Identifier", - "start": 8, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "y" - }, + "start":8,"end":9,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":9},"identifierName":"y"}, "name": "y" }, { "type": "Identifier", - "start": 11, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "z" - }, + "start":11,"end":12,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":12},"identifierName":"z"}, "name": "z" } ] diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-spread-element/call-spread-number/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-spread-element/call-spread-number/output.json index 616ce67a709e..954d701bc5c7 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-spread-element/call-spread-number/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-spread-element/call-spread-number/output.json @@ -1,108 +1,30 @@ { "type": "File", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "program": { "type": "Program", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "expression": { "type": "CallExpression", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, "callee": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "f" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"f"}, "name": "f" }, "arguments": [ { "type": "SpreadElement", - "start": 2, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":2,"end":7,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":7}}, "argument": { "type": "NumericLiteral", - "start": 5, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":5,"end":7,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":7}}, "extra": { "rawValue": 0.5, "raw": ".5" diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-spread-element/call-spread/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-spread-element/call-spread/output.json index da2f1ba24cf7..5db111120b8d 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-spread-element/call-spread/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-spread-element/call-spread/output.json @@ -1,109 +1,30 @@ { "type": "File", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, "program": { "type": "Program", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, "expression": { "type": "CallExpression", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "callee": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "f" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"f"}, "name": "f" }, "arguments": [ { "type": "SpreadElement", - "start": 2, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":2,"end":6,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":6}}, "argument": { "type": "Identifier", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "g" - }, + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"g"}, "name": "g" } } diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-spread-element/new-multi-spread/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-spread-element/new-multi-spread/output.json index 57dc83daf32a..ebd1a9ff4a57 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-spread-element/new-multi-spread/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-spread-element/new-multi-spread/output.json @@ -1,173 +1,48 @@ { "type": "File", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "program": { "type": "Program", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "expression": { "type": "NewExpression", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "callee": { "type": "Identifier", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "f" - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"f"}, "name": "f" }, "arguments": [ { "type": "SpreadElement", - "start": 6, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":6,"end":10,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":10}}, "argument": { "type": "Identifier", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - }, - "identifierName": "x" - }, + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"x"}, "name": "x" } }, { "type": "SpreadElement", - "start": 12, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":12,"end":16,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":16}}, "argument": { "type": "Identifier", - "start": 15, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - }, - "identifierName": "y" - }, + "start":15,"end":16,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":16},"identifierName":"y"}, "name": "y" } }, { "type": "SpreadElement", - "start": 18, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":18,"end":22,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":22}}, "argument": { "type": "Identifier", - "start": 21, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 22 - }, - "identifierName": "z" - }, + "start":21,"end":22,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":22},"identifierName":"z"}, "name": "z" } } diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-spread-element/new-spread-default/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-spread-element/new-spread-default/output.json index 5a8f135f2345..4d96ec0b3bec 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-spread-element/new-spread-default/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-spread-element/new-spread-default/output.json @@ -1,158 +1,44 @@ { "type": "File", - "start": 0, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, "program": { "type": "Program", - "start": 0, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, "expression": { "type": "NewExpression", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, "callee": { "type": "Identifier", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "f" - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"f"}, "name": "f" }, "arguments": [ { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "g" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"g"}, "name": "g" }, { "type": "SpreadElement", - "start": 9, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":9,"end":17,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":17}}, "argument": { "type": "AssignmentExpression", - "start": 12, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":12,"end":17,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":17}}, "operator": "=", "left": { "type": "Identifier", - "start": 12, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - }, - "identifierName": "h" - }, + "start":12,"end":13,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":13},"identifierName":"h"}, "name": "h" }, "right": { "type": "Identifier", - "start": 16, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - }, - "identifierName": "i" - }, + "start":16,"end":17,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":17},"identifierName":"i"}, "name": "i" } } diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-spread-element/new-spread-first/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-spread-element/new-spread-first/output.json index caa4e829ed56..89a6fa716122 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-spread-element/new-spread-first/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-spread-element/new-spread-first/output.json @@ -1,144 +1,41 @@ { "type": "File", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, "program": { "type": "Program", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, "expression": { "type": "NewExpression", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "callee": { "type": "Identifier", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "f" - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"f"}, "name": "f" }, "arguments": [ { "type": "SpreadElement", - "start": 6, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":6,"end":10,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":10}}, "argument": { "type": "Identifier", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - }, - "identifierName": "x" - }, + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"x"}, "name": "x" } }, { "type": "Identifier", - "start": 12, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - }, - "identifierName": "y" - }, + "start":12,"end":13,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":13},"identifierName":"y"}, "name": "y" }, { "type": "Identifier", - "start": 15, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - }, - "identifierName": "z" - }, + "start":15,"end":16,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":16},"identifierName":"z"}, "name": "z" } ] diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-spread-element/new-spread-number/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-spread-element/new-spread-number/output.json index abac9752fcac..e2e970159f55 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-spread-element/new-spread-number/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-spread-element/new-spread-number/output.json @@ -1,108 +1,30 @@ { "type": "File", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "program": { "type": "Program", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "expression": { "type": "NewExpression", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, "callee": { "type": "Identifier", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "f" - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"f"}, "name": "f" }, "arguments": [ { "type": "SpreadElement", - "start": 6, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":6,"end":11,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":11}}, "argument": { "type": "NumericLiteral", - "start": 9, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":9,"end":11,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":11}}, "extra": { "rawValue": 0.5, "raw": ".5" diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-spread-element/new-spread/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-spread-element/new-spread/output.json index 31dcf569b5ee..5461886da3e0 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-spread-element/new-spread/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-spread-element/new-spread/output.json @@ -1,109 +1,30 @@ { "type": "File", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, "program": { "type": "Program", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, "expression": { "type": "NewExpression", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "callee": { "type": "Identifier", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "f" - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"f"}, "name": "f" }, "arguments": [ { "type": "SpreadElement", - "start": 6, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":6,"end":10,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":10}}, "argument": { "type": "Identifier", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - }, - "identifierName": "g" - }, + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"g"}, "name": "g" } } diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-super-property/arrow_super/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-super-property/arrow_super/output.json index dd71fe58b840..6482545deec4 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-super-property/arrow_super/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-super-property/arrow_super/output.json @@ -1,127 +1,36 @@ { "type": "File", - "start": 0, - "end": 69, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 1 - } - }, + "start":0,"end":69,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 69, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 1 - } - }, + "start":0,"end":69,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 69, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 1 - } - }, + "start":0,"end":69,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, "id": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "A" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, "name": "A" }, "superClass": { "type": "Identifier", - "start": 16, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - }, - "identifierName": "B" - }, + "start":16,"end":17,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":17},"identifierName":"B"}, "name": "B" }, "body": { "type": "ClassBody", - "start": 18, - "end": 69, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 5, - "column": 1 - } - }, + "start":18,"end":69,"loc":{"start":{"line":1,"column":18},"end":{"line":5,"column":1}}, "body": [ { "type": "ClassMethod", - "start": 24, - "end": 67, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 4, - "column": 5 - } - }, + "start":24,"end":67,"loc":{"start":{"line":2,"column":4},"end":{"line":4,"column":5}}, "static": false, "key": { "type": "Identifier", - "start": 24, - "end": 35, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 15 - }, - "identifierName": "constructor" - }, + "start":24,"end":35,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":15},"identifierName":"constructor"}, "name": "constructor" }, "computed": false, @@ -132,79 +41,24 @@ "params": [], "body": { "type": "BlockStatement", - "start": 38, - "end": 67, - "loc": { - "start": { - "line": 2, - "column": 18 - }, - "end": { - "line": 4, - "column": 5 - } - }, + "start":38,"end":67,"loc":{"start":{"line":2,"column":18},"end":{"line":4,"column":5}}, "body": [ { "type": "ExpressionStatement", - "start": 48, - "end": 61, - "loc": { - "start": { - "line": 3, - "column": 8 - }, - "end": { - "line": 3, - "column": 21 - } - }, + "start":48,"end":61,"loc":{"start":{"line":3,"column":8},"end":{"line":3,"column":21}}, "expression": { "type": "ArrowFunctionExpression", - "start": 48, - "end": 61, - "loc": { - "start": { - "line": 3, - "column": 8 - }, - "end": { - "line": 3, - "column": 21 - } - }, + "start":48,"end":61,"loc":{"start":{"line":3,"column":8},"end":{"line":3,"column":21}}, "id": null, "generator": false, "async": false, "params": [], "body": { "type": "CallExpression", - "start": 54, - "end": 61, - "loc": { - "start": { - "line": 3, - "column": 14 - }, - "end": { - "line": 3, - "column": 21 - } - }, + "start":54,"end":61,"loc":{"start":{"line":3,"column":14},"end":{"line":3,"column":21}}, "callee": { "type": "Super", - "start": 54, - "end": 59, - "loc": { - "start": { - "line": 3, - "column": 14 - }, - "end": { - "line": 3, - "column": 19 - } - } + "start":54,"end":59,"loc":{"start":{"line":3,"column":14},"end":{"line":3,"column":19}} }, "arguments": [] } diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-super-property/constructor_super/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-super-property/constructor_super/output.json index 3e043c1b39b5..6cde1b39d6a9 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-super-property/constructor_super/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-super-property/constructor_super/output.json @@ -1,127 +1,36 @@ { "type": "File", - "start": 0, - "end": 64, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 1 - } - }, + "start":0,"end":64,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 64, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 1 - } - }, + "start":0,"end":64,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 64, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 1 - } - }, + "start":0,"end":64,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, "id": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "A" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, "name": "A" }, "superClass": { "type": "Identifier", - "start": 16, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - }, - "identifierName": "B" - }, + "start":16,"end":17,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":17},"identifierName":"B"}, "name": "B" }, "body": { "type": "ClassBody", - "start": 18, - "end": 64, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 5, - "column": 1 - } - }, + "start":18,"end":64,"loc":{"start":{"line":1,"column":18},"end":{"line":5,"column":1}}, "body": [ { "type": "ClassMethod", - "start": 24, - "end": 62, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 4, - "column": 5 - } - }, + "start":24,"end":62,"loc":{"start":{"line":2,"column":4},"end":{"line":4,"column":5}}, "static": false, "key": { "type": "Identifier", - "start": 24, - "end": 35, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 15 - }, - "identifierName": "constructor" - }, + "start":24,"end":35,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":15},"identifierName":"constructor"}, "name": "constructor" }, "computed": false, @@ -132,61 +41,17 @@ "params": [], "body": { "type": "BlockStatement", - "start": 38, - "end": 62, - "loc": { - "start": { - "line": 2, - "column": 18 - }, - "end": { - "line": 4, - "column": 5 - } - }, + "start":38,"end":62,"loc":{"start":{"line":2,"column":18},"end":{"line":4,"column":5}}, "body": [ { "type": "ExpressionStatement", - "start": 48, - "end": 56, - "loc": { - "start": { - "line": 3, - "column": 8 - }, - "end": { - "line": 3, - "column": 16 - } - }, + "start":48,"end":56,"loc":{"start":{"line":3,"column":8},"end":{"line":3,"column":16}}, "expression": { "type": "CallExpression", - "start": 48, - "end": 55, - "loc": { - "start": { - "line": 3, - "column": 8 - }, - "end": { - "line": 3, - "column": 15 - } - }, + "start":48,"end":55,"loc":{"start":{"line":3,"column":8},"end":{"line":3,"column":15}}, "callee": { "type": "Super", - "start": 48, - "end": 53, - "loc": { - "start": { - "line": 3, - "column": 8 - }, - "end": { - "line": 3, - "column": 13 - } - } + "start":48,"end":53,"loc":{"start":{"line":3,"column":8},"end":{"line":3,"column":13}} }, "arguments": [] } diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-super-property/invalid_super_not_inside_function/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-super-property/invalid_super_not_inside_function/options.json deleted file mode 100644 index cf468e48541b..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-super-property/invalid_super_not_inside_function/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "super is only allowed in object methods and classes (1:8)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-super-property/invalid_super_not_inside_function/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-super-property/invalid_super_not_inside_function/output.json new file mode 100644 index 000000000000..581568e109df --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-super-property/invalid_super_not_inside_function/output.json @@ -0,0 +1,41 @@ +{ + "type": "File", + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, + "errors": [ + "SyntaxError: super() is only valid inside a class constructor of a subclass. Maybe a typo in the method name ('constructor') or not extending another class? (1:8)" + ], + "program": { + "type": "Program", + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":4,"end":15,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":15}}, + "id": { + "type": "Identifier", + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"x"}, + "name": "x" + }, + "init": { + "type": "CallExpression", + "start":8,"end":15,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":15}}, + "callee": { + "type": "Super", + "start":8,"end":13,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":13}} + }, + "arguments": [] + } + } + ], + "kind": "var" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-super-property/new_super/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-super-property/new_super/output.json index 539008280033..7f6068365fea 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-super-property/new_super/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-super-property/new_super/output.json @@ -1,127 +1,36 @@ { "type": "File", - "start": 0, - "end": 63, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 1 - } - }, + "start":0,"end":63,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 63, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 1 - } - }, + "start":0,"end":63,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 63, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 1 - } - }, + "start":0,"end":63,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, "id": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "A" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, "name": "A" }, "superClass": { "type": "Identifier", - "start": 16, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - }, - "identifierName": "B" - }, + "start":16,"end":17,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":17},"identifierName":"B"}, "name": "B" }, "body": { "type": "ClassBody", - "start": 18, - "end": 63, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 5, - "column": 1 - } - }, + "start":18,"end":63,"loc":{"start":{"line":1,"column":18},"end":{"line":5,"column":1}}, "body": [ { "type": "ClassMethod", - "start": 24, - "end": 61, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 4, - "column": 5 - } - }, + "start":24,"end":61,"loc":{"start":{"line":2,"column":4},"end":{"line":4,"column":5}}, "static": false, "key": { "type": "Identifier", - "start": 24, - "end": 27, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 7 - }, - "identifierName": "foo" - }, + "start":24,"end":27,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":7},"identifierName":"foo"}, "name": "foo" }, "computed": false, @@ -132,91 +41,24 @@ "params": [], "body": { "type": "BlockStatement", - "start": 30, - "end": 61, - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 4, - "column": 5 - } - }, + "start":30,"end":61,"loc":{"start":{"line":2,"column":10},"end":{"line":4,"column":5}}, "body": [ { "type": "ExpressionStatement", - "start": 40, - "end": 55, - "loc": { - "start": { - "line": 3, - "column": 8 - }, - "end": { - "line": 3, - "column": 23 - } - }, + "start":40,"end":55,"loc":{"start":{"line":3,"column":8},"end":{"line":3,"column":23}}, "expression": { "type": "NewExpression", - "start": 40, - "end": 55, - "loc": { - "start": { - "line": 3, - "column": 8 - }, - "end": { - "line": 3, - "column": 23 - } - }, + "start":40,"end":55,"loc":{"start":{"line":3,"column":8},"end":{"line":3,"column":23}}, "callee": { "type": "MemberExpression", - "start": 44, - "end": 53, - "loc": { - "start": { - "line": 3, - "column": 12 - }, - "end": { - "line": 3, - "column": 21 - } - }, + "start":44,"end":53,"loc":{"start":{"line":3,"column":12},"end":{"line":3,"column":21}}, "object": { "type": "Super", - "start": 44, - "end": 49, - "loc": { - "start": { - "line": 3, - "column": 12 - }, - "end": { - "line": 3, - "column": 17 - } - } + "start":44,"end":49,"loc":{"start":{"line":3,"column":12},"end":{"line":3,"column":17}} }, "property": { "type": "Identifier", - "start": 50, - "end": 53, - "loc": { - "start": { - "line": 3, - "column": 18 - }, - "end": { - "line": 3, - "column": 21 - }, - "identifierName": "bar" - }, + "start":50,"end":53,"loc":{"start":{"line":3,"column":18},"end":{"line":3,"column":21},"identifierName":"bar"}, "name": "bar" }, "computed": false diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-super-property/super_computed/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-super-property/super_computed/output.json index 8489fd988638..948a5de3742c 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-super-property/super_computed/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-super-property/super_computed/output.json @@ -1,127 +1,36 @@ { "type": "File", - "start": 0, - "end": 61, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 1 - } - }, + "start":0,"end":61,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 61, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 1 - } - }, + "start":0,"end":61,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 61, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 1 - } - }, + "start":0,"end":61,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, "id": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "A" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, "name": "A" }, "superClass": { "type": "Identifier", - "start": 16, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - }, - "identifierName": "B" - }, + "start":16,"end":17,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":17},"identifierName":"B"}, "name": "B" }, "body": { "type": "ClassBody", - "start": 18, - "end": 61, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 5, - "column": 1 - } - }, + "start":18,"end":61,"loc":{"start":{"line":1,"column":18},"end":{"line":5,"column":1}}, "body": [ { "type": "ClassMethod", - "start": 24, - "end": 59, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 4, - "column": 5 - } - }, + "start":24,"end":59,"loc":{"start":{"line":2,"column":4},"end":{"line":4,"column":5}}, "static": false, "key": { "type": "Identifier", - "start": 24, - "end": 25, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 5 - }, - "identifierName": "X" - }, + "start":24,"end":25,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":5},"identifierName":"X"}, "name": "X" }, "computed": false, @@ -132,76 +41,21 @@ "params": [], "body": { "type": "BlockStatement", - "start": 28, - "end": 59, - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 4, - "column": 5 - } - }, + "start":28,"end":59,"loc":{"start":{"line":2,"column":8},"end":{"line":4,"column":5}}, "body": [ { "type": "ReturnStatement", - "start": 38, - "end": 53, - "loc": { - "start": { - "line": 3, - "column": 8 - }, - "end": { - "line": 3, - "column": 23 - } - }, + "start":38,"end":53,"loc":{"start":{"line":3,"column":8},"end":{"line":3,"column":23}}, "argument": { "type": "MemberExpression", - "start": 45, - "end": 53, - "loc": { - "start": { - "line": 3, - "column": 15 - }, - "end": { - "line": 3, - "column": 23 - } - }, + "start":45,"end":53,"loc":{"start":{"line":3,"column":15},"end":{"line":3,"column":23}}, "object": { "type": "Super", - "start": 45, - "end": 50, - "loc": { - "start": { - "line": 3, - "column": 15 - }, - "end": { - "line": 3, - "column": 20 - } - } + "start":45,"end":50,"loc":{"start":{"line":3,"column":15},"end":{"line":3,"column":20}} }, "property": { "type": "NumericLiteral", - "start": 51, - "end": 52, - "loc": { - "start": { - "line": 3, - "column": 21 - }, - "end": { - "line": 3, - "column": 22 - } - }, + "start":51,"end":52,"loc":{"start":{"line":3,"column":21},"end":{"line":3,"column":22}}, "extra": { "rawValue": 1, "raw": "1" diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-super-property/super_member/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-super-property/super_member/output.json index cae838de0a89..1c2d10dbfcf9 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-super-property/super_member/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-super-property/super_member/output.json @@ -1,127 +1,36 @@ { "type": "File", - "start": 0, - "end": 60, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 1 - } - }, + "start":0,"end":60,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 60, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 1 - } - }, + "start":0,"end":60,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 60, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 1 - } - }, + "start":0,"end":60,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, "id": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "A" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, "name": "A" }, "superClass": { "type": "Identifier", - "start": 16, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - }, - "identifierName": "B" - }, + "start":16,"end":17,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":17},"identifierName":"B"}, "name": "B" }, "body": { "type": "ClassBody", - "start": 18, - "end": 60, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 5, - "column": 1 - } - }, + "start":18,"end":60,"loc":{"start":{"line":1,"column":18},"end":{"line":5,"column":1}}, "body": [ { "type": "ClassMethod", - "start": 24, - "end": 58, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 4, - "column": 5 - } - }, + "start":24,"end":58,"loc":{"start":{"line":2,"column":4},"end":{"line":4,"column":5}}, "static": false, "key": { "type": "Identifier", - "start": 24, - "end": 25, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 5 - }, - "identifierName": "X" - }, + "start":24,"end":25,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":5},"identifierName":"X"}, "name": "X" }, "computed": false, @@ -132,77 +41,21 @@ "params": [], "body": { "type": "BlockStatement", - "start": 28, - "end": 58, - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 4, - "column": 5 - } - }, + "start":28,"end":58,"loc":{"start":{"line":2,"column":8},"end":{"line":4,"column":5}}, "body": [ { "type": "ReturnStatement", - "start": 38, - "end": 52, - "loc": { - "start": { - "line": 3, - "column": 8 - }, - "end": { - "line": 3, - "column": 22 - } - }, + "start":38,"end":52,"loc":{"start":{"line":3,"column":8},"end":{"line":3,"column":22}}, "argument": { "type": "MemberExpression", - "start": 45, - "end": 52, - "loc": { - "start": { - "line": 3, - "column": 15 - }, - "end": { - "line": 3, - "column": 22 - } - }, + "start":45,"end":52,"loc":{"start":{"line":3,"column":15},"end":{"line":3,"column":22}}, "object": { "type": "Super", - "start": 45, - "end": 50, - "loc": { - "start": { - "line": 3, - "column": 15 - }, - "end": { - "line": 3, - "column": 20 - } - } + "start":45,"end":50,"loc":{"start":{"line":3,"column":15},"end":{"line":3,"column":20}} }, "property": { "type": "Identifier", - "start": 51, - "end": 52, - "loc": { - "start": { - "line": 3, - "column": 21 - }, - "end": { - "line": 3, - "column": 22 - }, - "identifierName": "y" - }, + "start":51,"end":52,"loc":{"start":{"line":3,"column":21},"end":{"line":3,"column":22},"identifierName":"y"}, "name": "y" }, "computed": false diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-template-literals/dollar-sign/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-template-literals/dollar-sign/output.json index 4e9b217cb08f..9b2b86cb1b28 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-template-literals/dollar-sign/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-template-literals/dollar-sign/output.json @@ -1,78 +1,23 @@ { "type": "File", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, "program": { "type": "Program", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, "expression": { "type": "TemplateLiteral", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, "expressions": [], "quasis": [ { "type": "TemplateElement", - "start": 1, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - } - }, + "start":1,"end":2,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":2}}, "value": { "raw": "$", "cooked": "$" diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-template-literals/escape-sequences/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-template-literals/escape-sequences/output.json index 27c7864d3380..dd0d55ac7e1d 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-template-literals/escape-sequences/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-template-literals/escape-sequences/output.json @@ -1,78 +1,23 @@ { "type": "File", - "start": 0, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, "program": { "type": "Program", - "start": 0, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, "expression": { "type": "TemplateLiteral", - "start": 0, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, "expressions": [], "quasis": [ { "type": "TemplateElement", - "start": 1, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":1,"end":29,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":29}}, "value": { "raw": "\\\\n\\\\r\\\\b\\\\v\\\\t\\\\f\\\\\\n\\\\\\r\\n", "cooked": "\\n\\r\\b\\v\\t\\f\\\n\\\r\n" diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-template-literals/invalid-escape/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-template-literals/invalid-escape/options.json deleted file mode 100644 index fd4da953a419..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-template-literals/invalid-escape/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-template-literals/invalid-escape/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-template-literals/invalid-escape/output.json new file mode 100644 index 000000000000..6218e2b71584 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-template-literals/invalid-escape/output.json @@ -0,0 +1,36 @@ +{ + "type": "File", + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:2)" + ], + "program": { + "type": "Program", + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, + "expression": { + "type": "TemplateLiteral", + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, + "expressions": [], + "quasis": [ + { + "type": "TemplateElement", + "start":1,"end":3,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":3}}, + "value": { + "raw": "\\1", + "cooked": null + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-template-literals/line-terminators/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-template-literals/line-terminators/output.json index 3987e50bf77c..06a0ed65acbb 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-template-literals/line-terminators/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-template-literals/line-terminators/output.json @@ -1,78 +1,23 @@ { "type": "File", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, "program": { "type": "Program", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, "expression": { "type": "TemplateLiteral", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, "expressions": [], "quasis": [ { "type": "TemplateElement", - "start": 1, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":1,"end":7,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":7}}, "value": { "raw": "\\n\\r\\n", "cooked": "\n\r\n" diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-template-literals/literal-escape-sequences/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-template-literals/literal-escape-sequences/output.json index 5aa224c4dff5..c88712741943 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-template-literals/literal-escape-sequences/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-template-literals/literal-escape-sequences/output.json @@ -1,78 +1,23 @@ { "type": "File", - "start": 0, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":35}}, "program": { "type": "Program", - "start": 0, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":35}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":35}}, "expression": { "type": "TemplateLiteral", - "start": 0, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":35}}, "expressions": [], "quasis": [ { "type": "TemplateElement", - "start": 1, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":1,"end":34,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":34}}, "value": { "raw": "\\\\u{000042}\\\\u0042\\\\x42\\\\u0\\\\A\\\\0", "cooked": "\\u{000042}\\u0042\\x42\\u0\\A\\0" diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-template-literals/new-expression/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-template-literals/new-expression/output.json index 646a2349df2e..0189e907f5ea 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-template-literals/new-expression/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-template-literals/new-expression/output.json @@ -1,123 +1,34 @@ { "type": "File", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "program": { "type": "Program", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "expression": { "type": "NewExpression", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "callee": { "type": "TaggedTemplateExpression", - "start": 4, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":4,"end":11,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":11}}, "tag": { "type": "Identifier", - "start": 4, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "raw" - }, + "start":4,"end":7,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":7},"identifierName":"raw"}, "name": "raw" }, "quasi": { "type": "TemplateLiteral", - "start": 7, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":7,"end":11,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":11}}, "expressions": [], "quasis": [ { "type": "TemplateElement", - "start": 8, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":8,"end":10,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":10}}, "value": { "raw": "42", "cooked": "42" diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-template-literals/tagged-interpolation/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-template-literals/tagged-interpolation/output.json index a036ba998f5a..d54c1eadf69e 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-template-literals/tagged-interpolation/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-template-literals/tagged-interpolation/output.json @@ -1,127 +1,37 @@ { "type": "File", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, "program": { "type": "Program", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, "expression": { "type": "TaggedTemplateExpression", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, "tag": { "type": "Identifier", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - }, - "identifierName": "raw" - }, + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3},"identifierName":"raw"}, "name": "raw" }, "quasi": { "type": "TemplateLiteral", - "start": 3, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":3,"end":18,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":18}}, "expressions": [ { "type": "Identifier", - "start": 12, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 16 - }, - "identifierName": "name" - }, + "start":12,"end":16,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":16},"identifierName":"name"}, "name": "name" } ], "quasis": [ { "type": "TemplateElement", - "start": 4, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":4,"end":10,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":10}}, "value": { "raw": "hello ", "cooked": "hello " @@ -130,18 +40,7 @@ }, { "type": "TemplateElement", - "start": 17, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":17,"end":17,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":17}}, "value": { "raw": "", "cooked": "" diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-template-literals/tagged-nested-with-object-literal/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-template-literals/tagged-nested-with-object-literal/output.json index 48aa72ea2dc0..812808de9f35 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-template-literals/tagged-nested-with-object-literal/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-template-literals/tagged-nested-with-object-literal/output.json @@ -1,153 +1,42 @@ { "type": "File", - "start": 0, - "end": 44, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 44 - } - }, + "start":0,"end":44,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":44}}, "program": { "type": "Program", - "start": 0, - "end": 44, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 44 - } - }, + "start":0,"end":44,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":44}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 44, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 44 - } - }, + "start":0,"end":44,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":44}}, "expression": { "type": "TaggedTemplateExpression", - "start": 0, - "end": 44, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 44 - } - }, + "start":0,"end":44,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":44}}, "tag": { "type": "Identifier", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - }, - "identifierName": "raw" - }, + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3},"identifierName":"raw"}, "name": "raw" }, "quasi": { "type": "TemplateLiteral", - "start": 3, - "end": 44, - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 44 - } - }, + "start":3,"end":44,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":44}}, "expressions": [ { "type": "TemplateLiteral", - "start": 12, - "end": 42, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 42 - } - }, + "start":12,"end":42,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":42}}, "expressions": [ { "type": "BinaryExpression", - "start": 22, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":22,"end":35,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":35}}, "left": { "type": "TemplateLiteral", - "start": 22, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":22,"end":30,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":30}}, "expressions": [], "quasis": [ { "type": "TemplateElement", - "start": 23, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":23,"end":29,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":29}}, "value": { "raw": "deeply", "cooked": "deeply" @@ -159,18 +48,7 @@ "operator": "+", "right": { "type": "ObjectExpression", - "start": 33, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 33 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":33,"end":35,"loc":{"start":{"line":1,"column":33},"end":{"line":1,"column":35}}, "properties": [] } } @@ -178,18 +56,7 @@ "quasis": [ { "type": "TemplateElement", - "start": 13, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":13,"end":20,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":20}}, "value": { "raw": "nested ", "cooked": "nested " @@ -198,18 +65,7 @@ }, { "type": "TemplateElement", - "start": 36, - "end": 41, - "loc": { - "start": { - "line": 1, - "column": 36 - }, - "end": { - "line": 1, - "column": 41 - } - }, + "start":36,"end":41,"loc":{"start":{"line":1,"column":36},"end":{"line":1,"column":41}}, "value": { "raw": " blah", "cooked": " blah" @@ -222,18 +78,7 @@ "quasis": [ { "type": "TemplateElement", - "start": 4, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":4,"end":10,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":10}}, "value": { "raw": "token ", "cooked": "token " @@ -242,18 +87,7 @@ }, { "type": "TemplateElement", - "start": 43, - "end": 43, - "loc": { - "start": { - "line": 1, - "column": 43 - }, - "end": { - "line": 1, - "column": 43 - } - }, + "start":43,"end":43,"loc":{"start":{"line":1,"column":43},"end":{"line":1,"column":43}}, "value": { "raw": "", "cooked": "" diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-template-literals/tagged/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-template-literals/tagged/output.json index 9ea44c8e0cc6..afff23398ccc 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-template-literals/tagged/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-template-literals/tagged/output.json @@ -1,109 +1,31 @@ { "type": "File", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "program": { "type": "Program", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "expression": { "type": "TaggedTemplateExpression", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "tag": { "type": "Identifier", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - }, - "identifierName": "raw" - }, + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3},"identifierName":"raw"}, "name": "raw" }, "quasi": { "type": "TemplateLiteral", - "start": 3, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":3,"end":7,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":7}}, "expressions": [], "quasis": [ { "type": "TemplateElement", - "start": 4, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":4,"end":6,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":6}}, "value": { "raw": "42", "cooked": "42" diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-template-literals/untagged/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-template-literals/untagged/output.json index 1709e7f7bee0..29c7dc50af2f 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-template-literals/untagged/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-template-literals/untagged/output.json @@ -1,78 +1,23 @@ { "type": "File", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - }, + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, "program": { "type": "Program", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - }, + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - }, + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, "expression": { "type": "TemplateLiteral", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - }, + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, "expressions": [], "quasis": [ { "type": "TemplateElement", - "start": 1, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 3 - } - }, + "start":1,"end":3,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":3}}, "value": { "raw": "42", "cooked": "42" diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-unicode-code-point-escape-sequence/migrated_0000/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-unicode-code-point-escape-sequence/migrated_0000/output.json index 6cf40d966283..5e53dbc37a3d 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-unicode-code-point-escape-sequence/migrated_0000/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-unicode-code-point-escape-sequence/migrated_0000/output.json @@ -1,63 +1,19 @@ { "type": "File", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, "program": { "type": "Program", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, "sourceType": "script", "interpreter": null, "body": [], "directives": [ { "type": "Directive", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, "value": { "type": "DirectiveLiteral", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, "value": "\\\\u{714E}\\\\u{8336}", "extra": { "raw": "\"\\\\u{714E}\\\\u{8336}\"", diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-unicode-code-point-escape-sequence/migrated_0001/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-unicode-code-point-escape-sequence/migrated_0001/output.json index 3f3b3439082c..7f865efa666d 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-unicode-code-point-escape-sequence/migrated_0001/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-unicode-code-point-escape-sequence/migrated_0001/output.json @@ -1,63 +1,19 @@ { "type": "File", - "start": 0, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, "program": { "type": "Program", - "start": 0, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, "sourceType": "script", "interpreter": null, "body": [], "directives": [ { "type": "Directive", - "start": 0, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, "value": { "type": "DirectiveLiteral", - "start": 0, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, "value": "\\\\u{20BB7}\\\\u{91CE}\\\\u{5BB6}", "extra": { "raw": "\"\\\\u{20BB7}\\\\u{91CE}\\\\u{5BB6}\"", diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-unicode-code-point-escape-sequence/migrated_0002/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-unicode-code-point-escape-sequence/migrated_0002/output.json index 4331e2b8c367..f32f1372bdda 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-unicode-code-point-escape-sequence/migrated_0002/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-unicode-code-point-escape-sequence/migrated_0002/output.json @@ -1,63 +1,19 @@ { "type": "File", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, "program": { "type": "Program", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, "sourceType": "script", "interpreter": null, "body": [], "directives": [ { "type": "Directive", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, "value": { "type": "DirectiveLiteral", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, "value": "\\\\u{00000000034}", "extra": { "raw": "\"\\\\u{00000000034}\"", diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-arrow-default/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-arrow-default/options.json deleted file mode 100644 index f81e206da65d..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-arrow-default/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Yield cannot be used as name inside a generator function (1:21)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-arrow-default/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-arrow-default/output.json new file mode 100644 index 000000000000..4081ebee04bb --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-arrow-default/output.json @@ -0,0 +1,77 @@ +{ + "type": "File", + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":38}}, + "errors": [ + "SyntaxError: Yield cannot be used as name inside a generator function (1:21)" + ], + "program": { + "type": "Program", + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":38}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":38}}, + "id": { + "type": "Identifier", + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11},"identifierName":"g"}, + "name": "g" + }, + "generator": true, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":14,"end":38,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":38}}, + "body": [ + { + "type": "ExpressionStatement", + "start":16,"end":36,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":36}}, + "expression": { + "type": "ArrowFunctionExpression", + "start":16,"end":36,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":36}}, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "AssignmentPattern", + "start":17,"end":29,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":29}}, + "left": { + "type": "Identifier", + "start":17,"end":18,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":18},"identifierName":"x"}, + "name": "x" + }, + "right": { + "type": "YieldExpression", + "start":21,"end":29,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":29}}, + "delegate": false, + "argument": { + "type": "NumericLiteral", + "start":27,"end":29,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":29}}, + "extra": { + "rawValue": 42, + "raw": "42" + }, + "value": 42 + } + } + } + ], + "body": { + "type": "BlockStatement", + "start":34,"end":36,"loc":{"start":{"line":1,"column":34},"end":{"line":1,"column":36}}, + "body": [], + "directives": [] + } + } + } + ], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-arrow-parameter/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-arrow-parameter/options.json deleted file mode 100644 index efa8ac523c48..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-arrow-parameter/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Yield cannot be used as name inside a generator function (1:16)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-arrow-parameter/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-arrow-parameter/output.json new file mode 100644 index 000000000000..2ef911f25615 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-arrow-parameter/output.json @@ -0,0 +1,64 @@ +{ + "type": "File", + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, + "errors": [ + "SyntaxError: Yield cannot be used as name inside a generator function (1:16)", + "SyntaxError: Binding invalid left-hand side in function parameter list (1:16)" + ], + "program": { + "type": "Program", + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, + "id": { + "type": "Identifier", + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11},"identifierName":"g"}, + "name": "g" + }, + "generator": true, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":13,"end":30,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":30}}, + "body": [ + { + "type": "ExpressionStatement", + "start":15,"end":28,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":28}}, + "expression": { + "type": "ArrowFunctionExpression", + "start":15,"end":28,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":28}}, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "YieldExpression", + "start":16,"end":21,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":21}}, + "delegate": false, + "argument": null + } + ], + "body": { + "type": "NumericLiteral", + "start":26,"end":28,"loc":{"start":{"line":1,"column":26},"end":{"line":1,"column":28}}, + "extra": { + "rawValue": 42, + "raw": "42" + }, + "value": 42 + } + } + } + ], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-arrow-parameters/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-arrow-parameters/options.json deleted file mode 100644 index 185008241333..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-arrow-parameters/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Yield cannot be used as name inside a generator function (1:25)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-arrow-parameters/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-arrow-parameters/output.json new file mode 100644 index 000000000000..5656f98e9947 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-arrow-parameters/output.json @@ -0,0 +1,79 @@ +{ + "type": "File", + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":39}}, + "errors": [ + "SyntaxError: Yield cannot be used as name inside a generator function (1:25)", + "SyntaxError: Binding invalid left-hand side in function parameter list (1:25)" + ], + "program": { + "type": "Program", + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":39}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":39}}, + "id": { + "type": "Identifier", + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11},"identifierName":"g"}, + "name": "g" + }, + "generator": true, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":13,"end":39,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":39}}, + "body": [ + { + "type": "ExpressionStatement", + "start":15,"end":37,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":37}}, + "expression": { + "type": "ArrowFunctionExpression", + "start":15,"end":37,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":37}}, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start":16,"end":17,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":17},"identifierName":"a"}, + "name": "a" + }, + { + "type": "Identifier", + "start":19,"end":20,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":20},"identifierName":"b"}, + "name": "b" + }, + { + "type": "Identifier", + "start":22,"end":23,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":23},"identifierName":"c"}, + "name": "c" + }, + { + "type": "YieldExpression", + "start":25,"end":30,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":30}}, + "delegate": false, + "argument": null + } + ], + "body": { + "type": "NumericLiteral", + "start":35,"end":37,"loc":{"start":{"line":1,"column":35},"end":{"line":1,"column":37}}, + "extra": { + "rawValue": 42, + "raw": "42" + }, + "value": 42 + } + } + } + ], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-catch/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-catch/options.json deleted file mode 100644 index 8c287a1d5b36..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-catch/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Can not use 'yield' as identifier inside a generator (1:30)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-catch/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-catch/output.json new file mode 100644 index 000000000000..02857ebe4be5 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-catch/output.json @@ -0,0 +1,61 @@ +{ + "type": "File", + "start":0,"end":41,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":41}}, + "errors": [ + "SyntaxError: Can not use 'yield' as identifier inside a generator (1:30)" + ], + "program": { + "type": "Program", + "start":0,"end":41,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":41}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":41,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":41}}, + "id": { + "type": "Identifier", + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11},"identifierName":"g"}, + "name": "g" + }, + "generator": true, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":14,"end":41,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":41}}, + "body": [ + { + "type": "TryStatement", + "start":16,"end":39,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":39}}, + "block": { + "type": "BlockStatement", + "start":20,"end":22,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":22}}, + "body": [], + "directives": [] + }, + "handler": { + "type": "CatchClause", + "start":23,"end":39,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":39}}, + "param": { + "type": "Identifier", + "start":30,"end":35,"loc":{"start":{"line":1,"column":30},"end":{"line":1,"column":35},"identifierName":"yield"}, + "name": "yield" + }, + "body": { + "type": "BlockStatement", + "start":37,"end":39,"loc":{"start":{"line":1,"column":37},"end":{"line":1,"column":39}}, + "body": [], + "directives": [] + } + }, + "finalizer": null + } + ], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-declaration/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-declaration/options.json deleted file mode 100644 index 3ceff8546d37..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-declaration/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Can not use 'yield' as identifier inside a generator (1:26)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-declaration/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-declaration/output.json new file mode 100644 index 000000000000..bbdafe45b1f9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-declaration/output.json @@ -0,0 +1,53 @@ +{ + "type": "File", + "start":0,"end":37,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":37}}, + "errors": [ + "SyntaxError: Can not use 'yield' as identifier inside a generator (1:26)" + ], + "program": { + "type": "Program", + "start":0,"end":37,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":37}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":37,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":37}}, + "id": { + "type": "Identifier", + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11},"identifierName":"g"}, + "name": "g" + }, + "generator": true, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":14,"end":37,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":37}}, + "body": [ + { + "type": "FunctionDeclaration", + "start":16,"end":35,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":35}}, + "id": { + "type": "Identifier", + "start":26,"end":31,"loc":{"start":{"line":1,"column":26},"end":{"line":1,"column":31},"identifierName":"yield"}, + "name": "yield" + }, + "generator": true, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":33,"end":35,"loc":{"start":{"line":1,"column":33},"end":{"line":1,"column":35}}, + "body": [], + "directives": [] + } + } + ], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-export-default/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-export-default/options.json index 23a96f285fe4..2104ca43283f 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-export-default/options.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-export-default/options.json @@ -1,4 +1,3 @@ { - "sourceType": "module", - "throws": "Unexpected reserved word 'yield' (1:25)" + "sourceType": "module" } diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-export-default/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-export-default/output.json new file mode 100644 index 000000000000..03ac7846dcdc --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-export-default/output.json @@ -0,0 +1,38 @@ +{ + "type": "File", + "start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":35}}, + "errors": [ + "SyntaxError: Unexpected reserved word 'yield' (1:25)" + ], + "program": { + "type": "Program", + "start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":35}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExportDefaultDeclaration", + "start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":35}}, + "declaration": { + "type": "FunctionDeclaration", + "start":15,"end":35,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":35}}, + "id": { + "type": "Identifier", + "start":25,"end":30,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":30},"identifierName":"yield"}, + "name": "yield" + }, + "generator": true, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":33,"end":35,"loc":{"start":{"line":1,"column":33},"end":{"line":1,"column":35}}, + "body": [], + "directives": [] + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-expression-name/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-expression-name/options.json deleted file mode 100644 index c32eaf81f281..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-expression-name/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Can not use 'yield' as identifier inside a generator (1:10)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-expression-name/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-expression-name/output.json new file mode 100644 index 000000000000..4824a8b5211c --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-expression-name/output.json @@ -0,0 +1,42 @@ +{ + "type": "File", + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, + "errors": [ + "SyntaxError: Can not use 'yield' as identifier inside a generator (1:10)" + ], + "program": { + "type": "Program", + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, + "expression": { + "type": "FunctionExpression", + "start":1,"end":19,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":19}}, + "id": { + "type": "Identifier", + "start":10,"end":15,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":15},"identifierName":"yield"}, + "name": "yield" + }, + "generator": true, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":17,"end":19,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":19}}, + "body": [], + "directives": [] + }, + "extra": { + "parenthesized": true, + "parenStart": 0 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-expression-parameter/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-expression-parameter/options.json deleted file mode 100644 index 28b734910647..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-expression-parameter/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Can not use 'yield' as identifier inside a generator (1:12)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-expression-parameter/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-expression-parameter/output.json new file mode 100644 index 000000000000..4ace3553e7e6 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-expression-parameter/output.json @@ -0,0 +1,44 @@ +{ + "type": "File", + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, + "errors": [ + "SyntaxError: Can not use 'yield' as identifier inside a generator (1:12)" + ], + "program": { + "type": "Program", + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, + "expression": { + "type": "FunctionExpression", + "start":1,"end":20,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":20}}, + "id": null, + "generator": true, + "async": false, + "params": [ + { + "type": "Identifier", + "start":12,"end":17,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":17},"identifierName":"yield"}, + "name": "yield" + } + ], + "body": { + "type": "BlockStatement", + "start":18,"end":20,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":20}}, + "body": [], + "directives": [] + }, + "extra": { + "parenthesized": true, + "parenStart": 0 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-expression-rest/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-expression-rest/options.json deleted file mode 100644 index aef4d7f4f9a2..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-expression-rest/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Can not use 'yield' as identifier inside a generator (1:18)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-expression-rest/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-expression-rest/output.json new file mode 100644 index 000000000000..2f778cc2fe3b --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-expression-rest/output.json @@ -0,0 +1,53 @@ +{ + "type": "File", + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, + "errors": [ + "SyntaxError: Can not use 'yield' as identifier inside a generator (1:18)" + ], + "program": { + "type": "Program", + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, + "expression": { + "type": "FunctionExpression", + "start":1,"end":26,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":26}}, + "id": null, + "generator": true, + "async": false, + "params": [ + { + "type": "Identifier", + "start":12,"end":13,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":13},"identifierName":"x"}, + "name": "x" + }, + { + "type": "RestElement", + "start":15,"end":23,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":23}}, + "argument": { + "type": "Identifier", + "start":18,"end":23,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":23},"identifierName":"yield"}, + "name": "yield" + } + } + ], + "body": { + "type": "BlockStatement", + "start":24,"end":26,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":26}}, + "body": [], + "directives": [] + }, + "extra": { + "parenthesized": true, + "parenStart": 0 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-function-declaration/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-function-declaration/options.json deleted file mode 100644 index 6993832643f1..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-function-declaration/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Can not use 'yield' as identifier inside a generator (1:25)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-function-declaration/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-function-declaration/output.json new file mode 100644 index 000000000000..81b4ea1bb52c --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-function-declaration/output.json @@ -0,0 +1,53 @@ +{ + "type": "File", + "start":0,"end":37,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":37}}, + "errors": [ + "SyntaxError: Can not use 'yield' as identifier inside a generator (1:25)" + ], + "program": { + "type": "Program", + "start":0,"end":37,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":37}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":37,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":37}}, + "id": { + "type": "Identifier", + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11},"identifierName":"g"}, + "name": "g" + }, + "generator": true, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":14,"end":37,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":37}}, + "body": [ + { + "type": "FunctionDeclaration", + "start":16,"end":35,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":35}}, + "id": { + "type": "Identifier", + "start":25,"end":30,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":30},"identifierName":"yield"}, + "name": "yield" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":33,"end":35,"loc":{"start":{"line":1,"column":33},"end":{"line":1,"column":35}}, + "body": [], + "directives": [] + } + } + ], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-lexical-declaration/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-lexical-declaration/options.json deleted file mode 100644 index ad818f81f136..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-lexical-declaration/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Can not use 'yield' as identifier inside a generator (1:20)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-lexical-declaration/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-lexical-declaration/output.json new file mode 100644 index 000000000000..7f30d1206584 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-lexical-declaration/output.json @@ -0,0 +1,52 @@ +{ + "type": "File", + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, + "errors": [ + "SyntaxError: Can not use 'yield' as identifier inside a generator (1:20)" + ], + "program": { + "type": "Program", + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, + "id": { + "type": "Identifier", + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11},"identifierName":"g"}, + "name": "g" + }, + "generator": true, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":14,"end":28,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":28}}, + "body": [ + { + "type": "VariableDeclaration", + "start":16,"end":26,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":26}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":20,"end":25,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":25}}, + "id": { + "type": "Identifier", + "start":20,"end":25,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":25},"identifierName":"yield"}, + "name": "yield" + }, + "init": null + } + ], + "kind": "let" + } + ], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-parameter/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-parameter/options.json deleted file mode 100644 index 28b734910647..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-parameter/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Can not use 'yield' as identifier inside a generator (1:12)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-parameter/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-parameter/output.json new file mode 100644 index 000000000000..5746a0c95c79 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-parameter/output.json @@ -0,0 +1,40 @@ +{ + "type": "File", + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, + "errors": [ + "SyntaxError: Can not use 'yield' as identifier inside a generator (1:12)" + ], + "program": { + "type": "Program", + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, + "id": { + "type": "Identifier", + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11},"identifierName":"g"}, + "name": "g" + }, + "generator": true, + "async": false, + "params": [ + { + "type": "Identifier", + "start":12,"end":17,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":17},"identifierName":"yield"}, + "name": "yield" + } + ], + "body": { + "type": "BlockStatement", + "start":18,"end":20,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":20}}, + "body": [], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-rest/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-rest/options.json deleted file mode 100644 index c811689d9abd..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-rest/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Can not use 'yield' as identifier inside a generator (1:24)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-rest/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-rest/output.json new file mode 100644 index 000000000000..aabcbd49fd0c --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-rest/output.json @@ -0,0 +1,59 @@ +{ + "type": "File", + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, + "errors": [ + "SyntaxError: Can not use 'yield' as identifier inside a generator (1:24)" + ], + "program": { + "type": "Program", + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, + "id": { + "type": "Identifier", + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11},"identifierName":"g"}, + "name": "g" + }, + "generator": true, + "async": false, + "params": [ + { + "type": "Identifier", + "start":12,"end":13,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":13},"identifierName":"a"}, + "name": "a" + }, + { + "type": "Identifier", + "start":15,"end":16,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":16},"identifierName":"b"}, + "name": "b" + }, + { + "type": "Identifier", + "start":18,"end":19,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":19},"identifierName":"c"}, + "name": "c" + }, + { + "type": "RestElement", + "start":21,"end":29,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":29}}, + "argument": { + "type": "Identifier", + "start":24,"end":29,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":29},"identifierName":"yield"}, + "name": "yield" + } + } + ], + "body": { + "type": "BlockStatement", + "start":30,"end":32,"loc":{"start":{"line":1,"column":30},"end":{"line":1,"column":32}}, + "body": [], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-strict-function-expression/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-strict-function-expression/options.json deleted file mode 100644 index 865e081676d6..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-strict-function-expression/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected reserved word 'yield' (1:46)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-strict-function-expression/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-strict-function-expression/output.json new file mode 100644 index 000000000000..6e1c91ec0ff4 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-strict-function-expression/output.json @@ -0,0 +1,83 @@ +{ + "type": "File", + "start":0,"end":58,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":58}}, + "errors": [ + "SyntaxError: Unexpected reserved word 'yield' (1:46)" + ], + "program": { + "type": "Program", + "start":0,"end":58,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":58}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":14,"end":58,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":58}}, + "id": { + "type": "Identifier", + "start":24,"end":25,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":25},"identifierName":"g"}, + "name": "g" + }, + "generator": true, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":27,"end":58,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":58}}, + "body": [ + { + "type": "VariableDeclaration", + "start":29,"end":56,"loc":{"start":{"line":1,"column":29},"end":{"line":1,"column":56}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":33,"end":55,"loc":{"start":{"line":1,"column":33},"end":{"line":1,"column":55}}, + "id": { + "type": "Identifier", + "start":33,"end":34,"loc":{"start":{"line":1,"column":33},"end":{"line":1,"column":34},"identifierName":"y"}, + "name": "y" + }, + "init": { + "type": "FunctionExpression", + "start":37,"end":55,"loc":{"start":{"line":1,"column":37},"end":{"line":1,"column":55}}, + "id": { + "type": "Identifier", + "start":46,"end":51,"loc":{"start":{"line":1,"column":46},"end":{"line":1,"column":51},"identifierName":"yield"}, + "name": "yield" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":53,"end":55,"loc":{"start":{"line":1,"column":53},"end":{"line":1,"column":55}}, + "body": [], + "directives": [] + } + } + } + ], + "kind": "var" + } + ], + "directives": [] + } + } + ], + "directives": [ + { + "type": "Directive", + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "value": { + "type": "DirectiveLiteral", + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-strict-function-parameter/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-strict-function-parameter/options.json deleted file mode 100644 index 21348af52377..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-strict-function-parameter/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected reserved word 'yield' (1:47)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-strict-function-parameter/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-strict-function-parameter/output.json new file mode 100644 index 000000000000..84e6c9206347 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-strict-function-parameter/output.json @@ -0,0 +1,85 @@ +{ + "type": "File", + "start":0,"end":58,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":58}}, + "errors": [ + "SyntaxError: Unexpected reserved word 'yield' (1:47)" + ], + "program": { + "type": "Program", + "start":0,"end":58,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":58}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":14,"end":58,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":58}}, + "id": { + "type": "Identifier", + "start":24,"end":25,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":25},"identifierName":"g"}, + "name": "g" + }, + "generator": true, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":28,"end":58,"loc":{"start":{"line":1,"column":28},"end":{"line":1,"column":58}}, + "body": [ + { + "type": "VariableDeclaration", + "start":30,"end":56,"loc":{"start":{"line":1,"column":30},"end":{"line":1,"column":56}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":34,"end":56,"loc":{"start":{"line":1,"column":34},"end":{"line":1,"column":56}}, + "id": { + "type": "Identifier", + "start":34,"end":35,"loc":{"start":{"line":1,"column":34},"end":{"line":1,"column":35},"identifierName":"z"}, + "name": "z" + }, + "init": { + "type": "FunctionExpression", + "start":38,"end":56,"loc":{"start":{"line":1,"column":38},"end":{"line":1,"column":56}}, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start":47,"end":52,"loc":{"start":{"line":1,"column":47},"end":{"line":1,"column":52},"identifierName":"yield"}, + "name": "yield" + } + ], + "body": { + "type": "BlockStatement", + "start":54,"end":56,"loc":{"start":{"line":1,"column":54},"end":{"line":1,"column":56}}, + "body": [], + "directives": [] + } + } + } + ], + "kind": "var" + } + ], + "directives": [] + } + } + ], + "directives": [ + { + "type": "Directive", + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "value": { + "type": "DirectiveLiteral", + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-variable-declaration/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-variable-declaration/options.json deleted file mode 100644 index ad818f81f136..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-variable-declaration/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Can not use 'yield' as identifier inside a generator (1:20)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-variable-declaration/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-variable-declaration/output.json new file mode 100644 index 000000000000..0dd81b4d0dad --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-variable-declaration/output.json @@ -0,0 +1,52 @@ +{ + "type": "File", + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, + "errors": [ + "SyntaxError: Can not use 'yield' as identifier inside a generator (1:20)" + ], + "program": { + "type": "Program", + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, + "id": { + "type": "Identifier", + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11},"identifierName":"g"}, + "name": "g" + }, + "generator": true, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":14,"end":28,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":28}}, + "body": [ + { + "type": "VariableDeclaration", + "start":16,"end":26,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":26}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":20,"end":25,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":25}}, + "id": { + "type": "Identifier", + "start":20,"end":25,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":25},"identifierName":"yield"}, + "name": "yield" + }, + "init": null + } + ], + "kind": "var" + } + ], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-array-pattern/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-array-pattern/options.json deleted file mode 100644 index e817f30acb5c..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-array-pattern/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected reserved word 'yield' (1:16)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-array-pattern/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-array-pattern/output.json new file mode 100644 index 000000000000..a662f4e01bbc --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-array-pattern/output.json @@ -0,0 +1,59 @@ +{ + "type": "File", + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, + "errors": [ + "SyntaxError: Unexpected reserved word 'yield' (1:16)" + ], + "program": { + "type": "Program", + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":14,"end":27,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":27}}, + "expression": { + "type": "AssignmentExpression", + "start":15,"end":26,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":26}}, + "operator": "=", + "left": { + "type": "ArrayPattern", + "start":15,"end":22,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":22}}, + "elements": [ + { + "type": "Identifier", + "start":16,"end":21,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":21},"identifierName":"yield"}, + "name": "yield" + } + ] + }, + "right": { + "type": "Identifier", + "start":25,"end":26,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":26},"identifierName":"x"}, + "name": "x" + }, + "extra": { + "parenthesized": true, + "parenStart": 14 + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "value": { + "type": "DirectiveLiteral", + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-arrow-parameter-default/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-arrow-parameter-default/options.json deleted file mode 100644 index e80b46c31b86..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-arrow-parameter-default/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected reserved word 'yield' (1:19)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-arrow-parameter-default/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-arrow-parameter-default/output.json new file mode 100644 index 000000000000..c6814edc8a57 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-arrow-parameter-default/output.json @@ -0,0 +1,63 @@ +{ + "type": "File", + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, + "errors": [ + "SyntaxError: Unexpected reserved word 'yield' (1:19)" + ], + "program": { + "type": "Program", + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":14,"end":31,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":31}}, + "expression": { + "type": "ArrowFunctionExpression", + "start":14,"end":31,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":31}}, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "AssignmentPattern", + "start":15,"end":24,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":24}}, + "left": { + "type": "Identifier", + "start":15,"end":16,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":16},"identifierName":"x"}, + "name": "x" + }, + "right": { + "type": "Identifier", + "start":19,"end":24,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":24},"identifierName":"yield"}, + "name": "yield" + } + } + ], + "body": { + "type": "BlockStatement", + "start":29,"end":31,"loc":{"start":{"line":1,"column":29},"end":{"line":1,"column":31}}, + "body": [], + "directives": [] + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "value": { + "type": "DirectiveLiteral", + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-arrow-parameter-name/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-arrow-parameter-name/options.json deleted file mode 100644 index 27b38d28f986..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-arrow-parameter-name/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected reserved word 'yield' (1:15)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-arrow-parameter-name/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-arrow-parameter-name/output.json new file mode 100644 index 000000000000..bf2fe8474748 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-arrow-parameter-name/output.json @@ -0,0 +1,57 @@ +{ + "type": "File", + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, + "errors": [ + "SyntaxError: Unexpected reserved word 'yield' (1:15)" + ], + "program": { + "type": "Program", + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":14,"end":27,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":27}}, + "expression": { + "type": "ArrowFunctionExpression", + "start":14,"end":27,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":27}}, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start":15,"end":20,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":20},"identifierName":"yield"}, + "name": "yield" + } + ], + "body": { + "type": "NumericLiteral", + "start":25,"end":27,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":27}}, + "extra": { + "rawValue": 42, + "raw": "42" + }, + "value": 42 + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "value": { + "type": "DirectiveLiteral", + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-binding-element/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-binding-element/options.json deleted file mode 100644 index 5d111aab9319..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-binding-element/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected reserved word 'yield' (1:23)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-binding-element/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-binding-element/output.json new file mode 100644 index 000000000000..c1253768e7a1 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-binding-element/output.json @@ -0,0 +1,69 @@ +{ + "type": "File", + "start":0,"end":37,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":37}}, + "errors": [ + "SyntaxError: Unexpected reserved word 'yield' (1:23)" + ], + "program": { + "type": "Program", + "start":0,"end":37,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":37}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start":14,"end":37,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":37}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":18,"end":36,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":36}}, + "id": { + "type": "ObjectPattern", + "start":18,"end":30,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":30}}, + "properties": [ + { + "type": "ObjectProperty", + "start":20,"end":28,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":28}}, + "method": false, + "key": { + "type": "Identifier", + "start":20,"end":21,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":21},"identifierName":"x"}, + "name": "x" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "Identifier", + "start":23,"end":28,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":28},"identifierName":"yield"}, + "name": "yield" + } + } + ] + }, + "init": { + "type": "Identifier", + "start":33,"end":36,"loc":{"start":{"line":1,"column":33},"end":{"line":1,"column":36},"identifierName":"foo"}, + "name": "foo" + } + } + ], + "kind": "var" + } + ], + "directives": [ + { + "type": "Directive", + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "value": { + "type": "DirectiveLiteral", + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-catch-parameter/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-catch-parameter/options.json deleted file mode 100644 index 01aca4591cea..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-catch-parameter/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected reserved word 'yield' (1:28)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-catch-parameter/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-catch-parameter/output.json new file mode 100644 index 000000000000..dda9f41982b5 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-catch-parameter/output.json @@ -0,0 +1,56 @@ +{ + "type": "File", + "start":0,"end":37,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":37}}, + "errors": [ + "SyntaxError: Unexpected reserved word 'yield' (1:28)" + ], + "program": { + "type": "Program", + "start":0,"end":37,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":37}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "TryStatement", + "start":14,"end":37,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":37}}, + "block": { + "type": "BlockStatement", + "start":18,"end":20,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":20}}, + "body": [], + "directives": [] + }, + "handler": { + "type": "CatchClause", + "start":21,"end":37,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":37}}, + "param": { + "type": "Identifier", + "start":28,"end":33,"loc":{"start":{"line":1,"column":28},"end":{"line":1,"column":33},"identifierName":"yield"}, + "name": "yield" + }, + "body": { + "type": "BlockStatement", + "start":35,"end":37,"loc":{"start":{"line":1,"column":35},"end":{"line":1,"column":37}}, + "body": [], + "directives": [] + } + }, + "finalizer": null + } + ], + "directives": [ + { + "type": "Directive", + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "value": { + "type": "DirectiveLiteral", + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-formal-parameter/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-formal-parameter/options.json deleted file mode 100644 index a4a677fb3136..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-formal-parameter/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected reserved word 'yield' (1:25)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-formal-parameter/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-formal-parameter/output.json new file mode 100644 index 000000000000..0d2aafc8542d --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-formal-parameter/output.json @@ -0,0 +1,54 @@ +{ + "type": "File", + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, + "errors": [ + "SyntaxError: Unexpected reserved word 'yield' (1:25)" + ], + "program": { + "type": "Program", + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":14,"end":34,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":34}}, + "id": { + "type": "Identifier", + "start":23,"end":24,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":24},"identifierName":"f"}, + "name": "f" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start":25,"end":30,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":30},"identifierName":"yield"}, + "name": "yield" + } + ], + "body": { + "type": "BlockStatement", + "start":32,"end":34,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":34}}, + "body": [], + "directives": [] + } + } + ], + "directives": [ + { + "type": "Directive", + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "value": { + "type": "DirectiveLiteral", + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-function-declaration/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-function-declaration/options.json deleted file mode 100644 index 091e7958db52..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-function-declaration/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'yield' in strict mode (1:9)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-function-declaration/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-function-declaration/output.json new file mode 100644 index 000000000000..5f2d921752e9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-function-declaration/output.json @@ -0,0 +1,48 @@ +{ + "type": "File", + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, + "errors": [ + "SyntaxError: Binding 'yield' in strict mode (1:9)" + ], + "program": { + "type": "Program", + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, + "id": { + "type": "Identifier", + "start":9,"end":14,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":14},"identifierName":"yield"}, + "name": "yield" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":16,"end":33,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":33}}, + "body": [], + "directives": [ + { + "type": "Directive", + "start":18,"end":31,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":31}}, + "value": { + "type": "DirectiveLiteral", + "start":18,"end":30,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":30}}, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-function-expression/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-function-expression/options.json deleted file mode 100644 index 1c3817f8e018..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-function-expression/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'yield' in strict mode (1:10)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-function-expression/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-function-expression/output.json new file mode 100644 index 000000000000..f9eae4038a76 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-function-expression/output.json @@ -0,0 +1,56 @@ +{ + "type": "File", + "start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":35}}, + "errors": [ + "SyntaxError: Binding 'yield' in strict mode (1:10)" + ], + "program": { + "type": "Program", + "start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":35}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":35}}, + "expression": { + "type": "FunctionExpression", + "start":1,"end":34,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":34}}, + "id": { + "type": "Identifier", + "start":10,"end":15,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":15},"identifierName":"yield"}, + "name": "yield" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":17,"end":34,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":34}}, + "body": [], + "directives": [ + { + "type": "Directive", + "start":19,"end":32,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":32}}, + "value": { + "type": "DirectiveLiteral", + "start":19,"end":31,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":31}}, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + }, + "extra": { + "parenthesized": true, + "parenStart": 0 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-identifier/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-identifier/options.json deleted file mode 100644 index 412431249548..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-identifier/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected reserved word 'yield' (1:29)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-identifier/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-identifier/output.json new file mode 100644 index 000000000000..6ea37fe80964 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-identifier/output.json @@ -0,0 +1,58 @@ +{ + "type": "File", + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, + "errors": [ + "SyntaxError: Unexpected reserved word 'yield' (1:29)" + ], + "program": { + "type": "Program", + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":14,"end":36,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":36}}, + "id": { + "type": "Identifier", + "start":23,"end":24,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":24},"identifierName":"f"}, + "name": "f" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":27,"end":36,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":36}}, + "body": [ + { + "type": "ExpressionStatement", + "start":29,"end":34,"loc":{"start":{"line":1,"column":29},"end":{"line":1,"column":34}}, + "expression": { + "type": "Identifier", + "start":29,"end":34,"loc":{"start":{"line":1,"column":29},"end":{"line":1,"column":34},"identifierName":"yield"}, + "name": "yield" + } + } + ], + "directives": [] + } + } + ], + "directives": [ + { + "type": "Directive", + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "value": { + "type": "DirectiveLiteral", + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-lexical-declaration/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-lexical-declaration/options.json deleted file mode 100644 index 53a8921cb309..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-lexical-declaration/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected reserved word 'yield' (1:18)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-lexical-declaration/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-lexical-declaration/output.json new file mode 100644 index 000000000000..9a8eac94acf9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-lexical-declaration/output.json @@ -0,0 +1,55 @@ +{ + "type": "File", + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, + "errors": [ + "SyntaxError: Unexpected reserved word 'yield' (1:18)" + ], + "program": { + "type": "Program", + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start":14,"end":29,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":29}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":18,"end":28,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":28}}, + "id": { + "type": "Identifier", + "start":18,"end":23,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":23},"identifierName":"yield"}, + "name": "yield" + }, + "init": { + "type": "NumericLiteral", + "start":26,"end":28,"loc":{"start":{"line":1,"column":26},"end":{"line":1,"column":28}}, + "extra": { + "rawValue": 42, + "raw": "42" + }, + "value": 42 + } + } + ], + "kind": "let" + } + ], + "directives": [ + { + "type": "Directive", + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "value": { + "type": "DirectiveLiteral", + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-rest-parameter/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-rest-parameter/options.json deleted file mode 100644 index 01aca4591cea..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-rest-parameter/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected reserved word 'yield' (1:28)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-rest-parameter/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-rest-parameter/output.json new file mode 100644 index 000000000000..2aaef66deac6 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-rest-parameter/output.json @@ -0,0 +1,58 @@ +{ + "type": "File", + "start":0,"end":37,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":37}}, + "errors": [ + "SyntaxError: Unexpected reserved word 'yield' (1:28)" + ], + "program": { + "type": "Program", + "start":0,"end":37,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":37}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":14,"end":37,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":37}}, + "id": { + "type": "Identifier", + "start":23,"end":24,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":24},"identifierName":"f"}, + "name": "f" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "RestElement", + "start":25,"end":33,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":33}}, + "argument": { + "type": "Identifier", + "start":28,"end":33,"loc":{"start":{"line":1,"column":28},"end":{"line":1,"column":33},"identifierName":"yield"}, + "name": "yield" + } + } + ], + "body": { + "type": "BlockStatement", + "start":35,"end":37,"loc":{"start":{"line":1,"column":35},"end":{"line":1,"column":37}}, + "body": [], + "directives": [] + } + } + ], + "directives": [ + { + "type": "Directive", + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "value": { + "type": "DirectiveLiteral", + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-variable-declaration/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-variable-declaration/options.json deleted file mode 100644 index 53a8921cb309..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-variable-declaration/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected reserved word 'yield' (1:18)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-variable-declaration/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-variable-declaration/output.json new file mode 100644 index 000000000000..5554975e11c5 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-variable-declaration/output.json @@ -0,0 +1,47 @@ +{ + "type": "File", + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, + "errors": [ + "SyntaxError: Unexpected reserved word 'yield' (1:18)" + ], + "program": { + "type": "Program", + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start":14,"end":24,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":24}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":18,"end":23,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":23}}, + "id": { + "type": "Identifier", + "start":18,"end":23,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":23},"identifierName":"yield"}, + "name": "yield" + }, + "init": null + } + ], + "kind": "var" + } + ], + "directives": [ + { + "type": "Directive", + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "value": { + "type": "DirectiveLiteral", + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/yield-array-pattern/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/yield-array-pattern/output.json index d999f3d55fed..6f8f572cb399 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-yield/yield-array-pattern/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-yield/yield-array-pattern/output.json @@ -1,112 +1,33 @@ { "type": "File", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "program": { "type": "Program", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "expression": { "type": "AssignmentExpression", - "start": 1, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":1,"end":12,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":12}}, "operator": "=", "left": { "type": "ArrayPattern", - "start": 1, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":1,"end":8,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":8}}, "elements": [ { "type": "Identifier", - "start": 2, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "yield" - }, + "start":2,"end":7,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":7},"identifierName":"yield"}, "name": "yield" } ] }, "right": { "type": "Identifier", - "start": 11, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "x" - }, + "start":11,"end":12,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":12},"identifierName":"x"}, "name": "x" }, "extra": { diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/yield-arrow-concise-body/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/yield-arrow-concise-body/output.json index cd0cda43dee4..65930bc7e3db 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-yield/yield-arrow-concise-body/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-yield/yield-arrow-concise-body/output.json @@ -1,131 +1,40 @@ { "type": "File", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "program": { "type": "Program", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "expression": { "type": "ArrowFunctionExpression", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "id": null, "generator": false, "async": false, "params": [ { "type": "Identifier", - "start": 1, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - }, - "identifierName": "x" - }, + "start":1,"end":2,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":2},"identifierName":"x"}, "name": "x" } ], "body": { "type": "BinaryExpression", - "start": 7, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":7,"end":16,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":16}}, "left": { "type": "Identifier", - "start": 7, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - }, - "identifierName": "x" - }, + "start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8},"identifierName":"x"}, "name": "x" }, "operator": "*", "right": { "type": "Identifier", - "start": 11, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 16 - }, - "identifierName": "yield" - }, + "start":11,"end":16,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":16},"identifierName":"yield"}, "name": "yield" } } diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/yield-arrow-function-body/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/yield-arrow-function-body/output.json index 0b9ab0f10aa8..b4b946f8533b 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-yield/yield-arrow-function-body/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-yield/yield-arrow-function-body/output.json @@ -1,160 +1,47 @@ { "type": "File", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, "program": { "type": "Program", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, "expression": { "type": "ArrowFunctionExpression", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, "id": null, "generator": false, "async": false, "params": [ { "type": "Identifier", - "start": 1, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - }, - "identifierName": "z" - }, + "start":1,"end":2,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":2},"identifierName":"z"}, "name": "z" } ], "body": { "type": "BlockStatement", - "start": 7, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":7,"end":20,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":20}}, "body": [ { "type": "ExpressionStatement", - "start": 9, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":9,"end":18,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":18}}, "expression": { "type": "BinaryExpression", - "start": 9, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":9,"end":18,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":18}}, "left": { "type": "Identifier", - "start": 9, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 14 - }, - "identifierName": "yield" - }, + "start":9,"end":14,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":14},"identifierName":"yield"}, "name": "yield" }, "operator": "+", "right": { "type": "Identifier", - "start": 17, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - }, - "identifierName": "z" - }, + "start":17,"end":18,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":18},"identifierName":"z"}, "name": "z" } } diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/yield-arrow-parameter-default/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/yield-arrow-parameter-default/output.json index 69a580ede4f0..6b7cee11c5de 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-yield/yield-arrow-parameter-default/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-yield/yield-arrow-parameter-default/output.json @@ -1,130 +1,40 @@ { "type": "File", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "program": { "type": "Program", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "expression": { "type": "ArrowFunctionExpression", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "id": null, "generator": false, "async": false, "params": [ { "type": "AssignmentPattern", - "start": 1, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":1,"end":10,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":10}}, "left": { "type": "Identifier", - "start": 1, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - }, - "identifierName": "x" - }, + "start":1,"end":2,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":2},"identifierName":"x"}, "name": "x" }, "right": { "type": "Identifier", - "start": 5, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 10 - }, - "identifierName": "yield" - }, + "start":5,"end":10,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":10},"identifierName":"yield"}, "name": "yield" } } ], "body": { "type": "BlockStatement", - "start": 15, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":15,"end":17,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":17}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/yield-arrow-parameter-name/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/yield-arrow-parameter-name/output.json index 9761a349a4a3..b08def12d45f 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-yield/yield-arrow-parameter-name/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-yield/yield-arrow-parameter-name/output.json @@ -1,98 +1,31 @@ { "type": "File", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "program": { "type": "Program", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "expression": { "type": "ArrowFunctionExpression", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "id": null, "generator": false, "async": false, "params": [ { "type": "Identifier", - "start": 1, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "yield" - }, + "start":1,"end":6,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":6},"identifierName":"yield"}, "name": "yield" } ], "body": { "type": "NumericLiteral", - "start": 11, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":11,"end":13,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":13}}, "extra": { "rawValue": 42, "raw": "42" diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/yield-binding-element/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/yield-binding-element/output.json index eb617eadfb7d..0709ed0ce7d6 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-yield/yield-binding-element/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-yield/yield-binding-element/output.json @@ -1,127 +1,37 @@ { "type": "File", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "program": { "type": "Program", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":4,"end":22,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":22}}, "id": { "type": "ObjectPattern", - "start": 4, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":4,"end":16,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":16}}, "properties": [ { "type": "ObjectProperty", - "start": 6, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":6,"end":14,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":14}}, "method": false, "key": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "x" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"x"}, "name": "x" }, "computed": false, "shorthand": false, "value": { "type": "Identifier", - "start": 9, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 14 - }, - "identifierName": "yield" - }, + "start":9,"end":14,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":14},"identifierName":"yield"}, "name": "yield" } } @@ -129,19 +39,7 @@ }, "init": { "type": "Identifier", - "start": 19, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 22 - }, - "identifierName": "foo" - }, + "start":19,"end":22,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":22},"identifierName":"foo"}, "name": "foo" } } diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/yield-binding-property/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/yield-binding-property/output.json index 46407c45500c..b352004bc7ea 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-yield/yield-binding-property/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-yield/yield-binding-property/output.json @@ -1,127 +1,37 @@ { "type": "File", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "program": { "type": "Program", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":4,"end":22,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":22}}, "id": { "type": "ObjectPattern", - "start": 4, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":4,"end":16,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":16}}, "properties": [ { "type": "ObjectProperty", - "start": 6, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":6,"end":14,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":14}}, "method": false, "key": { "type": "Identifier", - "start": 6, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "yield" - }, + "start":6,"end":11,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":11},"identifierName":"yield"}, "name": "yield" }, "computed": false, "shorthand": false, "value": { "type": "Identifier", - "start": 13, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - }, - "identifierName": "x" - }, + "start":13,"end":14,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":14},"identifierName":"x"}, "name": "x" } } @@ -129,19 +39,7 @@ }, "init": { "type": "Identifier", - "start": 19, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 22 - }, - "identifierName": "foo" - }, + "start":19,"end":22,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":22},"identifierName":"foo"}, "name": "foo" } } diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/yield-call-expression-property/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/yield-call-expression-property/output.json index bcf17d861f11..9bdfc1389496 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-yield/yield-call-expression-property/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-yield/yield-call-expression-property/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, "program": { "type": "Program", - "start": 0, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, "id": { "type": "Identifier", - "start": 10, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "g" - }, + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11},"identifierName":"g"}, "name": "g" }, "generator": true, @@ -65,93 +20,25 @@ "params": [], "body": { "type": "BlockStatement", - "start": 14, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":14,"end":30,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":30}}, "body": [ { "type": "ExpressionStatement", - "start": 16, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":16,"end":28,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":28}}, "expression": { "type": "CallExpression", - "start": 16, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":16,"end":27,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":27}}, "callee": { "type": "MemberExpression", - "start": 16, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":16,"end":25,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":25}}, "object": { "type": "Identifier", - "start": 16, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 19 - }, - "identifierName": "obj" - }, + "start":16,"end":19,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":19},"identifierName":"obj"}, "name": "obj" }, "property": { "type": "Identifier", - "start": 20, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 25 - }, - "identifierName": "yield" - }, + "start":20,"end":25,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":25},"identifierName":"yield"}, "name": "yield" }, "computed": false diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/yield-catch-parameter/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/yield-catch-parameter/output.json index 1fad434f6ac5..231f24f3574c 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-yield/yield-catch-parameter/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-yield/yield-catch-parameter/output.json @@ -1,110 +1,32 @@ { "type": "File", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "program": { "type": "Program", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "TryStatement", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "block": { "type": "BlockStatement", - "start": 4, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":4,"end":6,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":6}}, "body": [], "directives": [] }, "handler": { "type": "CatchClause", - "start": 7, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":7,"end":23,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":23}}, "param": { "type": "Identifier", - "start": 14, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 19 - }, - "identifierName": "yield" - }, + "start":14,"end":19,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":19},"identifierName":"yield"}, "name": "yield" }, "body": { "type": "BlockStatement", - "start": 21, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":21,"end":23,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":23}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/yield-expression-precedence/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/yield-expression-precedence/output.json index 49d3c999d40a..a298e396b5d2 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-yield/yield-expression-precedence/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-yield/yield-expression-precedence/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 42, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 42 - } - }, + "start":0,"end":42,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":42}}, "program": { "type": "Program", - "start": 0, - "end": 42, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 42 - } - }, + "start":0,"end":42,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":42}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 42, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 42 - } - }, + "start":0,"end":42,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":42}}, "id": { "type": "Identifier", - "start": 10, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "g" - }, + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11},"identifierName":"g"}, "name": "g" }, "generator": true, @@ -65,195 +20,58 @@ "params": [], "body": { "type": "BlockStatement", - "start": 14, - "end": 42, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 42 - } - }, + "start":14,"end":42,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":42}}, "body": [ { "type": "ExpressionStatement", - "start": 16, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 40 - } - }, + "start":16,"end":40,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":40}}, "expression": { "type": "SequenceExpression", - "start": 16, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 40 - } - }, + "start":16,"end":40,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":40}}, "expressions": [ { "type": "YieldExpression", - "start": 16, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":16,"end":25,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":25}}, "delegate": false, "argument": { "type": "AssignmentExpression", - "start": 22, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":22,"end":25,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":25}}, "operator": "=", "left": { "type": "Identifier", - "start": 22, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 23 - }, - "identifierName": "a" - }, + "start":22,"end":23,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":23},"identifierName":"a"}, "name": "a" }, "right": { "type": "Identifier", - "start": 24, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 25 - }, - "identifierName": "b" - }, + "start":24,"end":25,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":25},"identifierName":"b"}, "name": "b" } } }, { "type": "YieldExpression", - "start": 27, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 37 - } - }, + "start":27,"end":37,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":37}}, "delegate": true, "argument": { "type": "AssignmentExpression", - "start": 34, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 34 - }, - "end": { - "line": 1, - "column": 37 - } - }, + "start":34,"end":37,"loc":{"start":{"line":1,"column":34},"end":{"line":1,"column":37}}, "operator": "=", "left": { "type": "Identifier", - "start": 34, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 34 - }, - "end": { - "line": 1, - "column": 35 - }, - "identifierName": "c" - }, + "start":34,"end":35,"loc":{"start":{"line":1,"column":34},"end":{"line":1,"column":35},"identifierName":"c"}, "name": "c" }, "right": { "type": "Identifier", - "start": 36, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 36 - }, - "end": { - "line": 1, - "column": 37 - }, - "identifierName": "d" - }, + "start":36,"end":37,"loc":{"start":{"line":1,"column":36},"end":{"line":1,"column":37},"identifierName":"d"}, "name": "d" } } }, { "type": "Identifier", - "start": 39, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 39 - }, - "end": { - "line": 1, - "column": 40 - }, - "identifierName": "e" - }, + "start":39,"end":40,"loc":{"start":{"line":1,"column":39},"end":{"line":1,"column":40},"identifierName":"e"}, "name": "e" } ] diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/yield-function-declaration-formal-parameter/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/yield-function-declaration-formal-parameter/output.json index 572970e4d664..9c5fe29a0869 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-yield/yield-function-declaration-formal-parameter/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-yield/yield-function-declaration-formal-parameter/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, "program": { "type": "Program", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, "id": { "type": "Identifier", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - }, - "identifierName": "f" - }, + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"f"}, "name": "f" }, "generator": false, @@ -65,36 +20,13 @@ "params": [ { "type": "Identifier", - "start": 11, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 16 - }, - "identifierName": "yield" - }, + "start":11,"end":16,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":16},"identifierName":"yield"}, "name": "yield" } ], "body": { "type": "BlockStatement", - "start": 18, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":18,"end":20,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":20}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/yield-function-declaration/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/yield-function-declaration/output.json index 61394aecd8fa..4a5bbb8bddc6 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-yield/yield-function-declaration/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-yield/yield-function-declaration/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, "program": { "type": "Program", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, "id": { "type": "Identifier", - "start": 9, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 14 - }, - "identifierName": "yield" - }, + "start":9,"end":14,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":14},"identifierName":"yield"}, "name": "yield" }, "generator": false, @@ -65,18 +20,7 @@ "params": [], "body": { "type": "BlockStatement", - "start": 16, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":16,"end":18,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":18}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/yield-function-expression-parameter/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/yield-function-expression-parameter/output.json index 70fedd18278c..efa054fe93fa 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-yield/yield-function-expression-parameter/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-yield/yield-function-expression-parameter/output.json @@ -1,98 +1,31 @@ { "type": "File", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, "program": { "type": "Program", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, "expression": { "type": "FunctionExpression", - "start": 1, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":1,"end":19,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":19}}, "id": null, "generator": false, "async": false, "params": [ { "type": "Identifier", - "start": 10, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 15 - }, - "identifierName": "yield" - }, + "start":10,"end":15,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":15},"identifierName":"yield"}, "name": "yield" } ], "body": { "type": "BlockStatement", - "start": 17, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":17,"end":19,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":19}}, "body": [], "directives": [] }, diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/yield-function-expression/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/yield-function-expression/output.json index 878904bed999..a58725e51e0d 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-yield/yield-function-expression/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-yield/yield-function-expression/output.json @@ -1,77 +1,21 @@ { "type": "File", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, "program": { "type": "Program", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, "expression": { "type": "FunctionExpression", - "start": 1, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":1,"end":19,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":19}}, "id": { "type": "Identifier", - "start": 10, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 15 - }, - "identifierName": "yield" - }, + "start":10,"end":15,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":15},"identifierName":"yield"}, "name": "yield" }, "generator": false, @@ -79,18 +23,7 @@ "params": [], "body": { "type": "BlockStatement", - "start": 17, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":17,"end":19,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":19}}, "body": [], "directives": [] }, diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/yield-generator-arrow-concise-body/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/yield-generator-arrow-concise-body/output.json index 5ad3fb767682..b372faa4e2fd 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-yield/yield-generator-arrow-concise-body/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-yield/yield-generator-arrow-concise-body/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":35}}, "program": { "type": "Program", - "start": 0, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":35}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":35}}, "id": { "type": "Identifier", - "start": 10, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "g" - }, + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11},"identifierName":"g"}, "name": "g" }, "generator": true, @@ -65,116 +20,36 @@ "params": [], "body": { "type": "BlockStatement", - "start": 14, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":14,"end":35,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":35}}, "body": [ { "type": "ExpressionStatement", - "start": 16, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":16,"end":33,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":33}}, "expression": { "type": "ArrowFunctionExpression", - "start": 16, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":16,"end":32,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":32}}, "id": null, "generator": false, "async": false, "params": [ { "type": "Identifier", - "start": 17, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - }, - "identifierName": "x" - }, + "start":17,"end":18,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":18},"identifierName":"x"}, "name": "x" } ], "body": { "type": "BinaryExpression", - "start": 23, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":23,"end":32,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":32}}, "left": { "type": "Identifier", - "start": 23, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 24 - }, - "identifierName": "x" - }, + "start":23,"end":24,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":24},"identifierName":"x"}, "name": "x" }, "operator": "*", "right": { "type": "Identifier", - "start": 27, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 32 - }, - "identifierName": "yield" - }, + "start":27,"end":32,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":32},"identifierName":"yield"}, "name": "yield" } } diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/yield-generator-arrow-default/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/yield-generator-arrow-default/options.json deleted file mode 100644 index f81e206da65d..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-yield/yield-generator-arrow-default/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Yield cannot be used as name inside a generator function (1:21)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/yield-generator-arrow-default/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/yield-generator-arrow-default/output.json new file mode 100644 index 000000000000..a560dd2c5e32 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-yield/yield-generator-arrow-default/output.json @@ -0,0 +1,69 @@ +{ + "type": "File", + "start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":35}}, + "errors": [ + "SyntaxError: Yield cannot be used as name inside a generator function (1:21)" + ], + "program": { + "type": "Program", + "start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":35}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":35}}, + "id": { + "type": "Identifier", + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11},"identifierName":"g"}, + "name": "g" + }, + "generator": true, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":14,"end":35,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":35}}, + "body": [ + { + "type": "ExpressionStatement", + "start":16,"end":33,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":33}}, + "expression": { + "type": "ArrowFunctionExpression", + "start":16,"end":33,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":33}}, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "AssignmentPattern", + "start":17,"end":26,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":26}}, + "left": { + "type": "Identifier", + "start":17,"end":18,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":18},"identifierName":"x"}, + "name": "x" + }, + "right": { + "type": "YieldExpression", + "start":21,"end":26,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":26}}, + "delegate": false, + "argument": null + } + } + ], + "body": { + "type": "BlockStatement", + "start":31,"end":33,"loc":{"start":{"line":1,"column":31},"end":{"line":1,"column":33}}, + "body": [], + "directives": [] + } + } + } + ], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/yield-generator-arrow-function-body/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/yield-generator-arrow-function-body/output.json index fb8baff364ea..f7986e071a95 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-yield/yield-generator-arrow-function-body/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-yield/yield-generator-arrow-function-body/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 39 - } - }, + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":39}}, "program": { "type": "Program", - "start": 0, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 39 - } - }, + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":39}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 39 - } - }, + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":39}}, "id": { "type": "Identifier", - "start": 10, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "g" - }, + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11},"identifierName":"g"}, "name": "g" }, "generator": true, @@ -65,145 +20,43 @@ "params": [], "body": { "type": "BlockStatement", - "start": 14, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 39 - } - }, + "start":14,"end":39,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":39}}, "body": [ { "type": "ExpressionStatement", - "start": 16, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 37 - } - }, + "start":16,"end":37,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":37}}, "expression": { "type": "ArrowFunctionExpression", - "start": 16, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":16,"end":36,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":36}}, "id": null, "generator": false, "async": false, "params": [ { "type": "Identifier", - "start": 17, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - }, - "identifierName": "z" - }, + "start":17,"end":18,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":18},"identifierName":"z"}, "name": "z" } ], "body": { "type": "BlockStatement", - "start": 23, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":23,"end":36,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":36}}, "body": [ { "type": "ExpressionStatement", - "start": 25, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":25,"end":34,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":34}}, "expression": { "type": "BinaryExpression", - "start": 25, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":25,"end":34,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":34}}, "left": { "type": "Identifier", - "start": 25, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 30 - }, - "identifierName": "yield" - }, + "start":25,"end":30,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":30},"identifierName":"yield"}, "name": "yield" }, "operator": "+", "right": { "type": "Identifier", - "start": 33, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 33 - }, - "end": { - "line": 1, - "column": 34 - }, - "identifierName": "z" - }, + "start":33,"end":34,"loc":{"start":{"line":1,"column":33},"end":{"line":1,"column":34},"identifierName":"z"}, "name": "z" } } diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/yield-generator-declaration/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/yield-generator-declaration/output.json index 90c754ee67d1..03908ae672a3 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-yield/yield-generator-declaration/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-yield/yield-generator-declaration/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, "program": { "type": "Program", - "start": 0, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, "id": { "type": "Identifier", - "start": 10, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 15 - }, - "identifierName": "yield" - }, + "start":10,"end":15,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":15},"identifierName":"yield"}, "name": "yield" }, "generator": true, @@ -65,18 +20,7 @@ "params": [], "body": { "type": "BlockStatement", - "start": 17, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":17,"end":19,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":19}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/yield-generator-function-expression/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/yield-generator-function-expression/output.json index 0a82a0249975..2ed9e26310d9 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-yield/yield-generator-function-expression/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-yield/yield-generator-function-expression/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 44, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 44 - } - }, + "start":0,"end":44,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":44}}, "program": { "type": "Program", - "start": 0, - "end": 44, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 44 - } - }, + "start":0,"end":44,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":44}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 44, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 44 - } - }, + "start":0,"end":44,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":44}}, "id": { "type": "Identifier", - "start": 10, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "g" - }, + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11},"identifierName":"g"}, "name": "g" }, "generator": true, @@ -65,94 +20,26 @@ "params": [], "body": { "type": "BlockStatement", - "start": 13, - "end": 44, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 44 - } - }, + "start":13,"end":44,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":44}}, "body": [ { "type": "VariableDeclaration", - "start": 15, - "end": 42, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 42 - } - }, + "start":15,"end":42,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":42}}, "declarations": [ { "type": "VariableDeclarator", - "start": 19, - "end": 41, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 41 - } - }, + "start":19,"end":41,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":41}}, "id": { "type": "Identifier", - "start": 19, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 20 - }, - "identifierName": "y" - }, + "start":19,"end":20,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":20},"identifierName":"y"}, "name": "y" }, "init": { "type": "FunctionExpression", - "start": 23, - "end": 41, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 41 - } - }, + "start":23,"end":41,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":41}}, "id": { "type": "Identifier", - "start": 32, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 32 - }, - "end": { - "line": 1, - "column": 37 - }, - "identifierName": "yield" - }, + "start":32,"end":37,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":37},"identifierName":"yield"}, "name": "yield" }, "generator": false, @@ -160,18 +47,7 @@ "params": [], "body": { "type": "BlockStatement", - "start": 39, - "end": 41, - "loc": { - "start": { - "line": 1, - "column": 39 - }, - "end": { - "line": 1, - "column": 41 - } - }, + "start":39,"end":41,"loc":{"start":{"line":1,"column":39},"end":{"line":1,"column":41}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/yield-generator-function-parameter/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/yield-generator-function-parameter/output.json index 4179e6acc511..b20ac0b62208 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-yield/yield-generator-function-parameter/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-yield/yield-generator-function-parameter/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 44, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 44 - } - }, + "start":0,"end":44,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":44}}, "program": { "type": "Program", - "start": 0, - "end": 44, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 44 - } - }, + "start":0,"end":44,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":44}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 44, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 44 - } - }, + "start":0,"end":44,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":44}}, "id": { "type": "Identifier", - "start": 10, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "g" - }, + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11},"identifierName":"g"}, "name": "g" }, "generator": true, @@ -65,115 +20,36 @@ "params": [], "body": { "type": "BlockStatement", - "start": 14, - "end": 44, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 44 - } - }, + "start":14,"end":44,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":44}}, "body": [ { "type": "VariableDeclaration", - "start": 16, - "end": 42, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 42 - } - }, + "start":16,"end":42,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":42}}, "declarations": [ { "type": "VariableDeclarator", - "start": 20, - "end": 42, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 42 - } - }, + "start":20,"end":42,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":42}}, "id": { "type": "Identifier", - "start": 20, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 21 - }, - "identifierName": "z" - }, + "start":20,"end":21,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":21},"identifierName":"z"}, "name": "z" }, "init": { "type": "FunctionExpression", - "start": 24, - "end": 42, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 42 - } - }, + "start":24,"end":42,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":42}}, "id": null, "generator": false, "async": false, "params": [ { "type": "Identifier", - "start": 33, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 33 - }, - "end": { - "line": 1, - "column": 38 - }, - "identifierName": "yield" - }, + "start":33,"end":38,"loc":{"start":{"line":1,"column":33},"end":{"line":1,"column":38},"identifierName":"yield"}, "name": "yield" } ], "body": { "type": "BlockStatement", - "start": 40, - "end": 42, - "loc": { - "start": { - "line": 1, - "column": 40 - }, - "end": { - "line": 1, - "column": 42 - } - }, + "start":40,"end":42,"loc":{"start":{"line":1,"column":40},"end":{"line":1,"column":42}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/yield-generator-method/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/yield-generator-method/output.json index 33f0ac110101..714d9d2b8685 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-yield/yield-generator-method/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-yield/yield-generator-method/output.json @@ -1,93 +1,26 @@ { "type": "File", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "program": { "type": "Program", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "expression": { "type": "ObjectExpression", - "start": 1, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":1,"end":16,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":16}}, "properties": [ { "type": "ObjectMethod", - "start": 3, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":3,"end":14,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":14}}, "method": true, "key": { "type": "Identifier", - "start": 4, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "yield" - }, + "start":4,"end":9,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":9},"identifierName":"yield"}, "name": "yield" }, "computed": false, @@ -98,18 +31,7 @@ "params": [], "body": { "type": "BlockStatement", - "start": 12, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":12,"end":14,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":14}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/yield-generator-parameter-object-pattern/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/yield-generator-parameter-object-pattern/output.json index 7819b0e506d9..f51023215026 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-yield/yield-generator-parameter-object-pattern/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-yield/yield-generator-parameter-object-pattern/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, "program": { "type": "Program", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, "id": { "type": "Identifier", - "start": 10, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "g" - }, + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11},"identifierName":"g"}, "name": "g" }, "generator": true, @@ -65,68 +20,22 @@ "params": [ { "type": "ObjectPattern", - "start": 12, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":12,"end":22,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":22}}, "properties": [ { "type": "ObjectProperty", - "start": 13, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":13,"end":21,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":21}}, "method": false, "key": { "type": "Identifier", - "start": 13, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 18 - }, - "identifierName": "yield" - }, + "start":13,"end":18,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":18},"identifierName":"yield"}, "name": "yield" }, "computed": false, "shorthand": false, "value": { "type": "Identifier", - "start": 20, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 21 - }, - "identifierName": "y" - }, + "start":20,"end":21,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":21},"identifierName":"y"}, "name": "y" } } @@ -135,18 +44,7 @@ ], "body": { "type": "BlockStatement", - "start": 23, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":23,"end":25,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":25}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/yield-lexical-declaration/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/yield-lexical-declaration/output.json index 2e898291cf6d..9edf66fdf058 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-yield/yield-lexical-declaration/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-yield/yield-lexical-declaration/output.json @@ -1,94 +1,27 @@ { "type": "File", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "program": { "type": "Program", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":4,"end":14,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":14}}, "id": { "type": "Identifier", - "start": 4, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "yield" - }, + "start":4,"end":9,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":9},"identifierName":"yield"}, "name": "yield" }, "init": { "type": "NumericLiteral", - "start": 12, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":12,"end":14,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":14}}, "extra": { "rawValue": 42, "raw": "42" diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/yield-member-expression-property/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/yield-member-expression-property/output.json index d73ff4d58e66..9d9e642fdf7e 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-yield/yield-member-expression-property/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-yield/yield-member-expression-property/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, "program": { "type": "Program", - "start": 0, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, "id": { "type": "Identifier", - "start": 10, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "g" - }, + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11},"identifierName":"g"}, "name": "g" }, "generator": true, @@ -65,94 +20,26 @@ "params": [], "body": { "type": "BlockStatement", - "start": 14, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":14,"end":34,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":34}}, "body": [ { "type": "ExpressionStatement", - "start": 16, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":16,"end":32,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":32}}, "expression": { "type": "YieldExpression", - "start": 16, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":16,"end":31,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":31}}, "delegate": false, "argument": { "type": "MemberExpression", - "start": 22, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":22,"end":31,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":31}}, "object": { "type": "Identifier", - "start": 22, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 25 - }, - "identifierName": "obj" - }, + "start":22,"end":25,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":25},"identifierName":"obj"}, "name": "obj" }, "property": { "type": "Identifier", - "start": 26, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 31 - }, - "identifierName": "yield" - }, + "start":26,"end":31,"loc":{"start":{"line":1,"column":26},"end":{"line":1,"column":31},"identifierName":"yield"}, "name": "yield" }, "computed": false diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/yield-method/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/yield-method/output.json index eeee1072cace..504479fdc219 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-yield/yield-method/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-yield/yield-method/output.json @@ -1,93 +1,26 @@ { "type": "File", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "program": { "type": "Program", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "expression": { "type": "ObjectExpression", - "start": 1, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":1,"end":15,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":15}}, "properties": [ { "type": "ObjectMethod", - "start": 3, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":3,"end":13,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":13}}, "method": true, "key": { "type": "Identifier", - "start": 3, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 8 - }, - "identifierName": "yield" - }, + "start":3,"end":8,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":8},"identifierName":"yield"}, "name": "yield" }, "computed": false, @@ -98,18 +31,7 @@ "params": [], "body": { "type": "BlockStatement", - "start": 11, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":11,"end":13,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":13}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/yield-parameter-object-pattern/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/yield-parameter-object-pattern/output.json index 289ebcbb1b09..2a587715caa4 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-yield/yield-parameter-object-pattern/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-yield/yield-parameter-object-pattern/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "program": { "type": "Program", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "id": { "type": "Identifier", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - }, - "identifierName": "f" - }, + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"f"}, "name": "f" }, "generator": false, @@ -65,68 +20,22 @@ "params": [ { "type": "ObjectPattern", - "start": 11, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":11,"end":21,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":21}}, "properties": [ { "type": "ObjectProperty", - "start": 12, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":12,"end":20,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":20}}, "method": false, "key": { "type": "Identifier", - "start": 12, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 17 - }, - "identifierName": "yield" - }, + "start":12,"end":17,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":17},"identifierName":"yield"}, "name": "yield" }, "computed": false, "shorthand": false, "value": { "type": "Identifier", - "start": 19, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 20 - }, - "identifierName": "y" - }, + "start":19,"end":20,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":20},"identifierName":"y"}, "name": "y" } } @@ -135,18 +44,7 @@ ], "body": { "type": "BlockStatement", - "start": 22, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":22,"end":24,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":24}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/yield-rest-parameter/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/yield-rest-parameter/output.json index 39b07b258e08..72490114fdcf 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-yield/yield-rest-parameter/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-yield/yield-rest-parameter/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "program": { "type": "Program", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "id": { "type": "Identifier", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - }, - "identifierName": "f" - }, + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"f"}, "name": "f" }, "generator": false, @@ -65,51 +20,17 @@ "params": [ { "type": "RestElement", - "start": 11, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":11,"end":19,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":19}}, "argument": { "type": "Identifier", - "start": 14, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 19 - }, - "identifierName": "yield" - }, + "start":14,"end":19,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":19},"identifierName":"yield"}, "name": "yield" } } ], "body": { "type": "BlockStatement", - "start": 21, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":21,"end":23,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":23}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/yield-strict-binding-property/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/yield-strict-binding-property/output.json index 643588f06514..f0e05e25a50b 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-yield/yield-strict-binding-property/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-yield/yield-strict-binding-property/output.json @@ -1,127 +1,37 @@ { "type": "File", - "start": 0, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 37 - } - }, + "start":0,"end":37,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":37}}, "program": { "type": "Program", - "start": 0, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 37 - } - }, + "start":0,"end":37,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":37}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 14, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 37 - } - }, + "start":14,"end":37,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":37}}, "declarations": [ { "type": "VariableDeclarator", - "start": 18, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":18,"end":36,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":36}}, "id": { "type": "ObjectPattern", - "start": 18, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":18,"end":30,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":30}}, "properties": [ { "type": "ObjectProperty", - "start": 20, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":20,"end":28,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":28}}, "method": false, "key": { "type": "Identifier", - "start": 20, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 25 - }, - "identifierName": "yield" - }, + "start":20,"end":25,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":25},"identifierName":"yield"}, "name": "yield" }, "computed": false, "shorthand": false, "value": { "type": "Identifier", - "start": 27, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 28 - }, - "identifierName": "x" - }, + "start":27,"end":28,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":28},"identifierName":"x"}, "name": "x" } } @@ -129,19 +39,7 @@ }, "init": { "type": "Identifier", - "start": 33, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 33 - }, - "end": { - "line": 1, - "column": 36 - }, - "identifierName": "foo" - }, + "start":33,"end":36,"loc":{"start":{"line":1,"column":33},"end":{"line":1,"column":36},"identifierName":"foo"}, "name": "foo" } } @@ -152,32 +50,10 @@ "directives": [ { "type": "Directive", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "value": { "type": "DirectiveLiteral", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, "value": "use strict", "extra": { "raw": "\"use strict\"", diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/yield-strict-method/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/yield-strict-method/output.json index 2fca4d2661af..d5baf7a875eb 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-yield/yield-strict-method/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-yield/yield-strict-method/output.json @@ -1,93 +1,26 @@ { "type": "File", - "start": 0, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, "program": { "type": "Program", - "start": 0, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 14, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":14,"end":30,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":30}}, "expression": { "type": "ObjectExpression", - "start": 15, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":15,"end":29,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":29}}, "properties": [ { "type": "ObjectMethod", - "start": 17, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":17,"end":27,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":27}}, "method": true, "key": { "type": "Identifier", - "start": 17, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 22 - }, - "identifierName": "yield" - }, + "start":17,"end":22,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":22},"identifierName":"yield"}, "name": "yield" }, "computed": false, @@ -98,18 +31,7 @@ "params": [], "body": { "type": "BlockStatement", - "start": 25, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":25,"end":27,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":27}}, "body": [], "directives": [] } @@ -125,32 +47,10 @@ "directives": [ { "type": "Directive", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "value": { "type": "DirectiveLiteral", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, "value": "use strict", "extra": { "raw": "\"use strict\"", diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/yield-super-property/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/yield-super-property/output.json index 6e60912b666e..88ed22b68da5 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-yield/yield-super-property/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-yield/yield-super-property/output.json @@ -1,127 +1,36 @@ { "type": "File", - "start": 0, - "end": 41, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 41 - } - }, + "start":0,"end":41,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":41}}, "program": { "type": "Program", - "start": 0, - "end": 41, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 41 - } - }, + "start":0,"end":41,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":41}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 41, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 41 - } - }, + "start":0,"end":41,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":41}}, "id": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "A" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, "name": "A" }, "superClass": { "type": "Identifier", - "start": 16, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - }, - "identifierName": "B" - }, + "start":16,"end":17,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":17},"identifierName":"B"}, "name": "B" }, "body": { "type": "ClassBody", - "start": 18, - "end": 41, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 41 - } - }, + "start":18,"end":41,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":41}}, "body": [ { "type": "ClassMethod", - "start": 20, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 39 - } - }, + "start":20,"end":39,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":39}}, "static": false, "key": { "type": "Identifier", - "start": 20, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 21 - }, - "identifierName": "X" - }, + "start":20,"end":21,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":21},"identifierName":"X"}, "name": "X" }, "computed": false, @@ -132,77 +41,21 @@ "params": [], "body": { "type": "BlockStatement", - "start": 24, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 39 - } - }, + "start":24,"end":39,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":39}}, "body": [ { "type": "ExpressionStatement", - "start": 26, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 37 - } - }, + "start":26,"end":37,"loc":{"start":{"line":1,"column":26},"end":{"line":1,"column":37}}, "expression": { "type": "MemberExpression", - "start": 26, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 37 - } - }, + "start":26,"end":37,"loc":{"start":{"line":1,"column":26},"end":{"line":1,"column":37}}, "object": { "type": "Super", - "start": 26, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 31 - } - } + "start":26,"end":31,"loc":{"start":{"line":1,"column":26},"end":{"line":1,"column":31}} }, "property": { "type": "Identifier", - "start": 32, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 32 - }, - "end": { - "line": 1, - "column": 37 - }, - "identifierName": "yield" - }, + "start":32,"end":37,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":37},"identifierName":"yield"}, "name": "yield" }, "computed": false diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/yield-variable-declaration/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/yield-variable-declaration/output.json index ed44a5fcd01f..d66d1be6b30b 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-yield/yield-variable-declaration/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-yield/yield-variable-declaration/output.json @@ -1,78 +1,22 @@ { "type": "File", - "start": 0, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, "program": { "type": "Program", - "start": 0, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":4,"end":9,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":9}}, "id": { "type": "Identifier", - "start": 4, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "yield" - }, + "start":4,"end":9,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":9},"identifierName":"yield"}, "name": "yield" }, "init": null diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/yield-yield-expression-delegate/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/yield-yield-expression-delegate/output.json index 7d36e1025f48..674b069a64b2 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-yield/yield-yield-expression-delegate/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-yield/yield-yield-expression-delegate/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, "program": { "type": "Program", - "start": 0, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, "id": { "type": "Identifier", - "start": 10, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "g" - }, + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11},"identifierName":"g"}, "name": "g" }, "generator": true, @@ -65,62 +20,18 @@ "params": [], "body": { "type": "BlockStatement", - "start": 14, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":14,"end":30,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":30}}, "body": [ { "type": "ExpressionStatement", - "start": 16, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":16,"end":28,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":28}}, "expression": { "type": "YieldExpression", - "start": 16, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":16,"end":28,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":28}}, "delegate": true, "argument": { "type": "YieldExpression", - "start": 23, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":23,"end":28,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":28}}, "delegate": false, "argument": null } diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/yield-yield-expression/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/yield-yield-expression/output.json index aa219449eb62..8004ac04b6b3 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-yield/yield-yield-expression/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-yield/yield-yield-expression/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, "program": { "type": "Program", - "start": 0, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, "id": { "type": "Identifier", - "start": 10, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "g" - }, + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11},"identifierName":"g"}, "name": "g" }, "generator": true, @@ -65,62 +20,18 @@ "params": [], "body": { "type": "BlockStatement", - "start": 14, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":14,"end":29,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":29}}, "body": [ { "type": "ExpressionStatement", - "start": 16, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":16,"end":27,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":27}}, "expression": { "type": "YieldExpression", - "start": 16, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":16,"end":27,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":27}}, "delegate": false, "argument": { "type": "YieldExpression", - "start": 22, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":22,"end":27,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":27}}, "delegate": false, "argument": null } diff --git a/packages/babel-parser/test/fixtures/esprima/expression-additive/migrated_0000/output.json b/packages/babel-parser/test/fixtures/esprima/expression-additive/migrated_0000/output.json index c2adfba4b5b5..7d87c8fc6e14 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-additive/migrated_0000/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-additive/migrated_0000/output.json @@ -1,95 +1,27 @@ { "type": "File", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "program": { "type": "Program", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "expression": { "type": "BinaryExpression", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "operator": "+", "right": { "type": "Identifier", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "y" - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"y"}, "name": "y" } } diff --git a/packages/babel-parser/test/fixtures/esprima/expression-additive/migrated_0001/output.json b/packages/babel-parser/test/fixtures/esprima/expression-additive/migrated_0001/output.json index 13cc3bbdfcd9..5226c2ebfb78 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-additive/migrated_0001/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-additive/migrated_0001/output.json @@ -1,95 +1,27 @@ { "type": "File", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "program": { "type": "Program", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "expression": { "type": "BinaryExpression", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "operator": "-", "right": { "type": "Identifier", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "y" - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"y"}, "name": "y" } } diff --git a/packages/babel-parser/test/fixtures/esprima/expression-additive/migrated_0002/output.json b/packages/babel-parser/test/fixtures/esprima/expression-additive/migrated_0002/output.json index 6663391c9d77..48c90f6fdb0e 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-additive/migrated_0002/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-additive/migrated_0002/output.json @@ -1,76 +1,21 @@ { "type": "File", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "program": { "type": "Program", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "expression": { "type": "BinaryExpression", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "left": { "type": "StringLiteral", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, "extra": { "rawValue": "use strict", "raw": "\"use strict\"" @@ -80,18 +25,7 @@ "operator": "+", "right": { "type": "NumericLiteral", - "start": 15, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":15,"end":17,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":17}}, "extra": { "rawValue": 42, "raw": "42" diff --git a/packages/babel-parser/test/fixtures/esprima/expression-assignment/migrated_0000/output.json b/packages/babel-parser/test/fixtures/esprima/expression-assignment/migrated_0000/output.json index a5a52c1e2db0..53a8bda384b8 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-assignment/migrated_0000/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-assignment/migrated_0000/output.json @@ -1,94 +1,27 @@ { "type": "File", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "program": { "type": "Program", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "expression": { "type": "AssignmentExpression", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "operator": "=", "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "right": { "type": "NumericLiteral", - "start": 4, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":4,"end":6,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":6}}, "extra": { "rawValue": 42, "raw": "42" diff --git a/packages/babel-parser/test/fixtures/esprima/expression-assignment/migrated_0001/output.json b/packages/babel-parser/test/fixtures/esprima/expression-assignment/migrated_0001/output.json index e1363b4f98c6..09238f85c9f7 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-assignment/migrated_0001/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-assignment/migrated_0001/output.json @@ -1,94 +1,27 @@ { "type": "File", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "program": { "type": "Program", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "expression": { "type": "AssignmentExpression", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "operator": "=", "left": { "type": "Identifier", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - }, - "identifierName": "eval" - }, + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4},"identifierName":"eval"}, "name": "eval" }, "right": { "type": "NumericLiteral", - "start": 7, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":7,"end":9,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":9}}, "extra": { "rawValue": 42, "raw": "42" diff --git a/packages/babel-parser/test/fixtures/esprima/expression-assignment/migrated_0002/output.json b/packages/babel-parser/test/fixtures/esprima/expression-assignment/migrated_0002/output.json index 9ced89e22512..45ca46801c09 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-assignment/migrated_0002/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-assignment/migrated_0002/output.json @@ -1,94 +1,27 @@ { "type": "File", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "program": { "type": "Program", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "expression": { "type": "AssignmentExpression", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "operator": "=", "left": { "type": "Identifier", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "arguments" - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9},"identifierName":"arguments"}, "name": "arguments" }, "right": { "type": "NumericLiteral", - "start": 12, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":12,"end":14,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":14}}, "extra": { "rawValue": 42, "raw": "42" diff --git a/packages/babel-parser/test/fixtures/esprima/expression-assignment/migrated_0003/output.json b/packages/babel-parser/test/fixtures/esprima/expression-assignment/migrated_0003/output.json index 4c6da633f927..4305f9c34d31 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-assignment/migrated_0003/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-assignment/migrated_0003/output.json @@ -1,94 +1,27 @@ { "type": "File", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "program": { "type": "Program", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "expression": { "type": "AssignmentExpression", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "operator": "*=", "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "right": { "type": "NumericLiteral", - "start": 5, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":5,"end":7,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":7}}, "extra": { "rawValue": 42, "raw": "42" diff --git a/packages/babel-parser/test/fixtures/esprima/expression-assignment/migrated_0004/output.json b/packages/babel-parser/test/fixtures/esprima/expression-assignment/migrated_0004/output.json index 2ae61364283d..ed4728f171eb 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-assignment/migrated_0004/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-assignment/migrated_0004/output.json @@ -1,94 +1,27 @@ { "type": "File", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "program": { "type": "Program", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "expression": { "type": "AssignmentExpression", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "operator": "/=", "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "right": { "type": "NumericLiteral", - "start": 5, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":5,"end":7,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":7}}, "extra": { "rawValue": 42, "raw": "42" diff --git a/packages/babel-parser/test/fixtures/esprima/expression-assignment/migrated_0005/output.json b/packages/babel-parser/test/fixtures/esprima/expression-assignment/migrated_0005/output.json index 62a87b6a4927..c3f3df7e5f5b 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-assignment/migrated_0005/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-assignment/migrated_0005/output.json @@ -1,94 +1,27 @@ { "type": "File", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "program": { "type": "Program", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "expression": { "type": "AssignmentExpression", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "operator": "%=", "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "right": { "type": "NumericLiteral", - "start": 5, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":5,"end":7,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":7}}, "extra": { "rawValue": 42, "raw": "42" diff --git a/packages/babel-parser/test/fixtures/esprima/expression-assignment/migrated_0006/output.json b/packages/babel-parser/test/fixtures/esprima/expression-assignment/migrated_0006/output.json index 987e2eb78524..2ccf078c9d9f 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-assignment/migrated_0006/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-assignment/migrated_0006/output.json @@ -1,94 +1,27 @@ { "type": "File", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "program": { "type": "Program", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "expression": { "type": "AssignmentExpression", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "operator": "+=", "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "right": { "type": "NumericLiteral", - "start": 5, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":5,"end":7,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":7}}, "extra": { "rawValue": 42, "raw": "42" diff --git a/packages/babel-parser/test/fixtures/esprima/expression-assignment/migrated_0007/output.json b/packages/babel-parser/test/fixtures/esprima/expression-assignment/migrated_0007/output.json index 077c01c70177..2ba631424d4b 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-assignment/migrated_0007/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-assignment/migrated_0007/output.json @@ -1,94 +1,27 @@ { "type": "File", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "program": { "type": "Program", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "expression": { "type": "AssignmentExpression", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "operator": "-=", "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "right": { "type": "NumericLiteral", - "start": 5, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":5,"end":7,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":7}}, "extra": { "rawValue": 42, "raw": "42" diff --git a/packages/babel-parser/test/fixtures/esprima/expression-assignment/migrated_0008/output.json b/packages/babel-parser/test/fixtures/esprima/expression-assignment/migrated_0008/output.json index 9fc98d2128b3..5d0d19837127 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-assignment/migrated_0008/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-assignment/migrated_0008/output.json @@ -1,94 +1,27 @@ { "type": "File", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, "program": { "type": "Program", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, "expression": { "type": "AssignmentExpression", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, "operator": "<<=", "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "right": { "type": "NumericLiteral", - "start": 6, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":6,"end":8,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":8}}, "extra": { "rawValue": 42, "raw": "42" diff --git a/packages/babel-parser/test/fixtures/esprima/expression-assignment/migrated_0009/output.json b/packages/babel-parser/test/fixtures/esprima/expression-assignment/migrated_0009/output.json index 6cefd83e3214..320ab232013c 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-assignment/migrated_0009/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-assignment/migrated_0009/output.json @@ -1,94 +1,27 @@ { "type": "File", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, "program": { "type": "Program", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, "expression": { "type": "AssignmentExpression", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, "operator": ">>=", "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "right": { "type": "NumericLiteral", - "start": 6, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":6,"end":8,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":8}}, "extra": { "rawValue": 42, "raw": "42" diff --git a/packages/babel-parser/test/fixtures/esprima/expression-assignment/migrated_0010/output.json b/packages/babel-parser/test/fixtures/esprima/expression-assignment/migrated_0010/output.json index c12350d6a4bf..9c04a76a8e7b 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-assignment/migrated_0010/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-assignment/migrated_0010/output.json @@ -1,94 +1,27 @@ { "type": "File", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "program": { "type": "Program", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "expression": { "type": "AssignmentExpression", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "operator": ">>>=", "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "right": { "type": "NumericLiteral", - "start": 7, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":7,"end":9,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":9}}, "extra": { "rawValue": 42, "raw": "42" diff --git a/packages/babel-parser/test/fixtures/esprima/expression-assignment/migrated_0011/output.json b/packages/babel-parser/test/fixtures/esprima/expression-assignment/migrated_0011/output.json index f97a88dd993a..b35bbd4d76be 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-assignment/migrated_0011/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-assignment/migrated_0011/output.json @@ -1,94 +1,27 @@ { "type": "File", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "program": { "type": "Program", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "expression": { "type": "AssignmentExpression", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "operator": "&=", "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "right": { "type": "NumericLiteral", - "start": 5, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":5,"end":7,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":7}}, "extra": { "rawValue": 42, "raw": "42" diff --git a/packages/babel-parser/test/fixtures/esprima/expression-assignment/migrated_0012/output.json b/packages/babel-parser/test/fixtures/esprima/expression-assignment/migrated_0012/output.json index f12219cdff51..cf0974cabc31 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-assignment/migrated_0012/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-assignment/migrated_0012/output.json @@ -1,94 +1,27 @@ { "type": "File", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "program": { "type": "Program", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "expression": { "type": "AssignmentExpression", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "operator": "^=", "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "right": { "type": "NumericLiteral", - "start": 5, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":5,"end":7,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":7}}, "extra": { "rawValue": 42, "raw": "42" diff --git a/packages/babel-parser/test/fixtures/esprima/expression-assignment/migrated_0013/output.json b/packages/babel-parser/test/fixtures/esprima/expression-assignment/migrated_0013/output.json index d29652f48f6c..61416582674e 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-assignment/migrated_0013/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-assignment/migrated_0013/output.json @@ -1,94 +1,27 @@ { "type": "File", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "program": { "type": "Program", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "expression": { "type": "AssignmentExpression", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "operator": "|=", "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "right": { "type": "NumericLiteral", - "start": 5, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":5,"end":7,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":7}}, "extra": { "rawValue": 42, "raw": "42" diff --git a/packages/babel-parser/test/fixtures/esprima/expression-binary-bitwise/migrated_0000/output.json b/packages/babel-parser/test/fixtures/esprima/expression-binary-bitwise/migrated_0000/output.json index 0782650869ea..f2ef76b6efc1 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-binary-bitwise/migrated_0000/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-binary-bitwise/migrated_0000/output.json @@ -1,95 +1,27 @@ { "type": "File", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "program": { "type": "Program", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "expression": { "type": "BinaryExpression", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "operator": "&", "right": { "type": "Identifier", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "y" - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"y"}, "name": "y" } } diff --git a/packages/babel-parser/test/fixtures/esprima/expression-binary-bitwise/migrated_0001/output.json b/packages/babel-parser/test/fixtures/esprima/expression-binary-bitwise/migrated_0001/output.json index a036d7feee03..d1cc74acf793 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-binary-bitwise/migrated_0001/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-binary-bitwise/migrated_0001/output.json @@ -1,95 +1,27 @@ { "type": "File", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "program": { "type": "Program", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "expression": { "type": "BinaryExpression", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "operator": "^", "right": { "type": "Identifier", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "y" - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"y"}, "name": "y" } } diff --git a/packages/babel-parser/test/fixtures/esprima/expression-binary-bitwise/migrated_0002/output.json b/packages/babel-parser/test/fixtures/esprima/expression-binary-bitwise/migrated_0002/output.json index 3f0401d051f8..793dc10c6cdc 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-binary-bitwise/migrated_0002/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-binary-bitwise/migrated_0002/output.json @@ -1,95 +1,27 @@ { "type": "File", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "program": { "type": "Program", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "expression": { "type": "BinaryExpression", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "operator": "|", "right": { "type": "Identifier", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "y" - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"y"}, "name": "y" } } diff --git a/packages/babel-parser/test/fixtures/esprima/expression-binary-logical/migrated_0000/output.json b/packages/babel-parser/test/fixtures/esprima/expression-binary-logical/migrated_0000/output.json index ab60eb5ab717..b9a75b550b6f 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-binary-logical/migrated_0000/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-binary-logical/migrated_0000/output.json @@ -1,95 +1,27 @@ { "type": "File", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "program": { "type": "Program", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "expression": { "type": "LogicalExpression", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "operator": "||", "right": { "type": "Identifier", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "y" - }, + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"y"}, "name": "y" } } diff --git a/packages/babel-parser/test/fixtures/esprima/expression-binary-logical/migrated_0001/output.json b/packages/babel-parser/test/fixtures/esprima/expression-binary-logical/migrated_0001/output.json index beb961a6f029..156e6398fd75 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-binary-logical/migrated_0001/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-binary-logical/migrated_0001/output.json @@ -1,95 +1,27 @@ { "type": "File", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "program": { "type": "Program", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "expression": { "type": "LogicalExpression", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "operator": "&&", "right": { "type": "Identifier", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "y" - }, + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"y"}, "name": "y" } } diff --git a/packages/babel-parser/test/fixtures/esprima/expression-binary-logical/migrated_0002/output.json b/packages/babel-parser/test/fixtures/esprima/expression-binary-logical/migrated_0002/output.json index c2de2c5ec37c..0ece3ff33ff3 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-binary-logical/migrated_0002/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-binary-logical/migrated_0002/output.json @@ -1,128 +1,37 @@ { "type": "File", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "program": { "type": "Program", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "expression": { "type": "LogicalExpression", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "left": { "type": "LogicalExpression", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "operator": "||", "right": { "type": "Identifier", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "y" - }, + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"y"}, "name": "y" } }, "operator": "||", "right": { "type": "Identifier", - "start": 10, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "z" - }, + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11},"identifierName":"z"}, "name": "z" } } diff --git a/packages/babel-parser/test/fixtures/esprima/expression-binary-logical/migrated_0003/output.json b/packages/babel-parser/test/fixtures/esprima/expression-binary-logical/migrated_0003/output.json index 8ef39b3fcd2e..ea8daaf85fb0 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-binary-logical/migrated_0003/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-binary-logical/migrated_0003/output.json @@ -1,128 +1,37 @@ { "type": "File", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "program": { "type": "Program", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "expression": { "type": "LogicalExpression", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "left": { "type": "LogicalExpression", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "operator": "&&", "right": { "type": "Identifier", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "y" - }, + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"y"}, "name": "y" } }, "operator": "&&", "right": { "type": "Identifier", - "start": 10, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "z" - }, + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11},"identifierName":"z"}, "name": "z" } } diff --git a/packages/babel-parser/test/fixtures/esprima/expression-binary-logical/migrated_0004/output.json b/packages/babel-parser/test/fixtures/esprima/expression-binary-logical/migrated_0004/output.json index c75389bc6cc9..776f47eea15c 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-binary-logical/migrated_0004/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-binary-logical/migrated_0004/output.json @@ -1,127 +1,36 @@ { "type": "File", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "program": { "type": "Program", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "expression": { "type": "LogicalExpression", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "operator": "||", "right": { "type": "LogicalExpression", - "start": 5, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":5,"end":11,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":11}}, "left": { "type": "Identifier", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "y" - }, + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"y"}, "name": "y" }, "operator": "&&", "right": { "type": "Identifier", - "start": 10, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "z" - }, + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11},"identifierName":"z"}, "name": "z" } } diff --git a/packages/babel-parser/test/fixtures/esprima/expression-binary-logical/migrated_0005/output.json b/packages/babel-parser/test/fixtures/esprima/expression-binary-logical/migrated_0005/output.json index 0d49dfa5a763..29d1920ab76c 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-binary-logical/migrated_0005/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-binary-logical/migrated_0005/output.json @@ -1,127 +1,36 @@ { "type": "File", - "start": 0, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, "program": { "type": "Program", - "start": 0, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, "expression": { "type": "LogicalExpression", - "start": 0, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "operator": "||", "right": { "type": "BinaryExpression", - "start": 5, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":5,"end":10,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":10}}, "left": { "type": "Identifier", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "y" - }, + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"y"}, "name": "y" }, "operator": "^", "right": { "type": "Identifier", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - }, - "identifierName": "z" - }, + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"z"}, "name": "z" } } diff --git a/packages/babel-parser/test/fixtures/esprima/expression-binary/migrated_0000/output.json b/packages/babel-parser/test/fixtures/esprima/expression-binary/migrated_0000/output.json index 12c80600d855..94fc52925207 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-binary/migrated_0000/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-binary/migrated_0000/output.json @@ -1,128 +1,37 @@ { "type": "File", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "program": { "type": "Program", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "expression": { "type": "BinaryExpression", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "left": { "type": "BinaryExpression", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "operator": "+", "right": { "type": "Identifier", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "y" - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"y"}, "name": "y" } }, "operator": "+", "right": { "type": "Identifier", - "start": 8, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "z" - }, + "start":8,"end":9,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":9},"identifierName":"z"}, "name": "z" } } diff --git a/packages/babel-parser/test/fixtures/esprima/expression-binary/migrated_0001/output.json b/packages/babel-parser/test/fixtures/esprima/expression-binary/migrated_0001/output.json index 7a4cb9d5bdbb..12de61e60e78 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-binary/migrated_0001/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-binary/migrated_0001/output.json @@ -1,128 +1,37 @@ { "type": "File", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "program": { "type": "Program", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "expression": { "type": "BinaryExpression", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "left": { "type": "BinaryExpression", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "operator": "-", "right": { "type": "Identifier", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "y" - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"y"}, "name": "y" } }, "operator": "+", "right": { "type": "Identifier", - "start": 8, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "z" - }, + "start":8,"end":9,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":9},"identifierName":"z"}, "name": "z" } } diff --git a/packages/babel-parser/test/fixtures/esprima/expression-binary/migrated_0002/output.json b/packages/babel-parser/test/fixtures/esprima/expression-binary/migrated_0002/output.json index d95f951f8eee..68a6d08d7290 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-binary/migrated_0002/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-binary/migrated_0002/output.json @@ -1,128 +1,37 @@ { "type": "File", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "program": { "type": "Program", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "expression": { "type": "BinaryExpression", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "left": { "type": "BinaryExpression", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "operator": "+", "right": { "type": "Identifier", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "y" - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"y"}, "name": "y" } }, "operator": "-", "right": { "type": "Identifier", - "start": 8, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "z" - }, + "start":8,"end":9,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":9},"identifierName":"z"}, "name": "z" } } diff --git a/packages/babel-parser/test/fixtures/esprima/expression-binary/migrated_0003/output.json b/packages/babel-parser/test/fixtures/esprima/expression-binary/migrated_0003/output.json index 4449ac1fc386..cdaf1460cf29 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-binary/migrated_0003/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-binary/migrated_0003/output.json @@ -1,128 +1,37 @@ { "type": "File", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "program": { "type": "Program", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "expression": { "type": "BinaryExpression", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "left": { "type": "BinaryExpression", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "operator": "-", "right": { "type": "Identifier", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "y" - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"y"}, "name": "y" } }, "operator": "-", "right": { "type": "Identifier", - "start": 8, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "z" - }, + "start":8,"end":9,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":9},"identifierName":"z"}, "name": "z" } } diff --git a/packages/babel-parser/test/fixtures/esprima/expression-binary/migrated_0004/output.json b/packages/babel-parser/test/fixtures/esprima/expression-binary/migrated_0004/output.json index 11b4c83b84f4..5d60fa9a4fc9 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-binary/migrated_0004/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-binary/migrated_0004/output.json @@ -1,127 +1,36 @@ { "type": "File", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "program": { "type": "Program", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "expression": { "type": "BinaryExpression", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "operator": "+", "right": { "type": "BinaryExpression", - "start": 4, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":4,"end":9,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":9}}, "left": { "type": "Identifier", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "y" - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"y"}, "name": "y" }, "operator": "*", "right": { "type": "Identifier", - "start": 8, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "z" - }, + "start":8,"end":9,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":9},"identifierName":"z"}, "name": "z" } } diff --git a/packages/babel-parser/test/fixtures/esprima/expression-binary/migrated_0005/output.json b/packages/babel-parser/test/fixtures/esprima/expression-binary/migrated_0005/output.json index 33ebd32af2c5..cfb1d7d325fa 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-binary/migrated_0005/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-binary/migrated_0005/output.json @@ -1,127 +1,36 @@ { "type": "File", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "program": { "type": "Program", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "expression": { "type": "BinaryExpression", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "operator": "+", "right": { "type": "BinaryExpression", - "start": 4, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":4,"end":9,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":9}}, "left": { "type": "Identifier", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "y" - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"y"}, "name": "y" }, "operator": "/", "right": { "type": "Identifier", - "start": 8, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "z" - }, + "start":8,"end":9,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":9},"identifierName":"z"}, "name": "z" } } diff --git a/packages/babel-parser/test/fixtures/esprima/expression-binary/migrated_0006/output.json b/packages/babel-parser/test/fixtures/esprima/expression-binary/migrated_0006/output.json index c6716f6d5b6c..e4ad518b4942 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-binary/migrated_0006/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-binary/migrated_0006/output.json @@ -1,127 +1,36 @@ { "type": "File", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "program": { "type": "Program", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "expression": { "type": "BinaryExpression", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "operator": "-", "right": { "type": "BinaryExpression", - "start": 4, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":4,"end":9,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":9}}, "left": { "type": "Identifier", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "y" - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"y"}, "name": "y" }, "operator": "%", "right": { "type": "Identifier", - "start": 8, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "z" - }, + "start":8,"end":9,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":9},"identifierName":"z"}, "name": "z" } } diff --git a/packages/babel-parser/test/fixtures/esprima/expression-binary/migrated_0007/output.json b/packages/babel-parser/test/fixtures/esprima/expression-binary/migrated_0007/output.json index d7d6a0eb4c0b..c9172b4c0ee0 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-binary/migrated_0007/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-binary/migrated_0007/output.json @@ -1,128 +1,37 @@ { "type": "File", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "program": { "type": "Program", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "expression": { "type": "BinaryExpression", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "left": { "type": "BinaryExpression", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "operator": "*", "right": { "type": "Identifier", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "y" - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"y"}, "name": "y" } }, "operator": "*", "right": { "type": "Identifier", - "start": 8, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "z" - }, + "start":8,"end":9,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":9},"identifierName":"z"}, "name": "z" } } diff --git a/packages/babel-parser/test/fixtures/esprima/expression-binary/migrated_0008/output.json b/packages/babel-parser/test/fixtures/esprima/expression-binary/migrated_0008/output.json index 55536bf01e31..928ebf4c4cc3 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-binary/migrated_0008/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-binary/migrated_0008/output.json @@ -1,128 +1,37 @@ { "type": "File", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "program": { "type": "Program", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "expression": { "type": "BinaryExpression", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "left": { "type": "BinaryExpression", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "operator": "*", "right": { "type": "Identifier", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "y" - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"y"}, "name": "y" } }, "operator": "/", "right": { "type": "Identifier", - "start": 8, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "z" - }, + "start":8,"end":9,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":9},"identifierName":"z"}, "name": "z" } } diff --git a/packages/babel-parser/test/fixtures/esprima/expression-binary/migrated_0009/output.json b/packages/babel-parser/test/fixtures/esprima/expression-binary/migrated_0009/output.json index b0249f734e45..b2def55e6015 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-binary/migrated_0009/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-binary/migrated_0009/output.json @@ -1,128 +1,37 @@ { "type": "File", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "program": { "type": "Program", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "expression": { "type": "BinaryExpression", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "left": { "type": "BinaryExpression", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "operator": "*", "right": { "type": "Identifier", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "y" - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"y"}, "name": "y" } }, "operator": "%", "right": { "type": "Identifier", - "start": 8, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "z" - }, + "start":8,"end":9,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":9},"identifierName":"z"}, "name": "z" } } diff --git a/packages/babel-parser/test/fixtures/esprima/expression-binary/migrated_0010/output.json b/packages/babel-parser/test/fixtures/esprima/expression-binary/migrated_0010/output.json index 42134f8776e6..f135242de7eb 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-binary/migrated_0010/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-binary/migrated_0010/output.json @@ -1,128 +1,37 @@ { "type": "File", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "program": { "type": "Program", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "expression": { "type": "BinaryExpression", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "left": { "type": "BinaryExpression", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "operator": "%", "right": { "type": "Identifier", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "y" - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"y"}, "name": "y" } }, "operator": "*", "right": { "type": "Identifier", - "start": 8, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "z" - }, + "start":8,"end":9,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":9},"identifierName":"z"}, "name": "z" } } diff --git a/packages/babel-parser/test/fixtures/esprima/expression-binary/migrated_0011/output.json b/packages/babel-parser/test/fixtures/esprima/expression-binary/migrated_0011/output.json index 64aa2ad30132..ad23fc9dbb1d 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-binary/migrated_0011/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-binary/migrated_0011/output.json @@ -1,128 +1,37 @@ { "type": "File", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "program": { "type": "Program", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "expression": { "type": "BinaryExpression", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "left": { "type": "BinaryExpression", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "operator": "<<", "right": { "type": "Identifier", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "y" - }, + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"y"}, "name": "y" } }, "operator": "<<", "right": { "type": "Identifier", - "start": 10, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "z" - }, + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11},"identifierName":"z"}, "name": "z" } } diff --git a/packages/babel-parser/test/fixtures/esprima/expression-binary/migrated_0012/output.json b/packages/babel-parser/test/fixtures/esprima/expression-binary/migrated_0012/output.json index 8a205f26f6e5..299c2101fd33 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-binary/migrated_0012/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-binary/migrated_0012/output.json @@ -1,128 +1,37 @@ { "type": "File", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "program": { "type": "Program", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "expression": { "type": "BinaryExpression", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "left": { "type": "BinaryExpression", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "operator": "|", "right": { "type": "Identifier", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "y" - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"y"}, "name": "y" } }, "operator": "|", "right": { "type": "Identifier", - "start": 8, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "z" - }, + "start":8,"end":9,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":9},"identifierName":"z"}, "name": "z" } } diff --git a/packages/babel-parser/test/fixtures/esprima/expression-binary/migrated_0013/output.json b/packages/babel-parser/test/fixtures/esprima/expression-binary/migrated_0013/output.json index 76106e9d4fe9..8450ad8b9769 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-binary/migrated_0013/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-binary/migrated_0013/output.json @@ -1,128 +1,37 @@ { "type": "File", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "program": { "type": "Program", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "expression": { "type": "BinaryExpression", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "left": { "type": "BinaryExpression", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "operator": "&", "right": { "type": "Identifier", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "y" - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"y"}, "name": "y" } }, "operator": "&", "right": { "type": "Identifier", - "start": 8, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "z" - }, + "start":8,"end":9,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":9},"identifierName":"z"}, "name": "z" } } diff --git a/packages/babel-parser/test/fixtures/esprima/expression-binary/migrated_0014/output.json b/packages/babel-parser/test/fixtures/esprima/expression-binary/migrated_0014/output.json index 19599c7b1c08..fb85cecd3e35 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-binary/migrated_0014/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-binary/migrated_0014/output.json @@ -1,128 +1,37 @@ { "type": "File", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "program": { "type": "Program", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "expression": { "type": "BinaryExpression", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "left": { "type": "BinaryExpression", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "operator": "^", "right": { "type": "Identifier", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "y" - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"y"}, "name": "y" } }, "operator": "^", "right": { "type": "Identifier", - "start": 8, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "z" - }, + "start":8,"end":9,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":9},"identifierName":"z"}, "name": "z" } } diff --git a/packages/babel-parser/test/fixtures/esprima/expression-binary/migrated_0015/output.json b/packages/babel-parser/test/fixtures/esprima/expression-binary/migrated_0015/output.json index 9e8b8d3fa8fc..3565086f710d 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-binary/migrated_0015/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-binary/migrated_0015/output.json @@ -1,128 +1,37 @@ { "type": "File", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "program": { "type": "Program", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "expression": { "type": "BinaryExpression", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "left": { "type": "BinaryExpression", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "operator": "&", "right": { "type": "Identifier", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "y" - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"y"}, "name": "y" } }, "operator": "|", "right": { "type": "Identifier", - "start": 8, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "z" - }, + "start":8,"end":9,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":9},"identifierName":"z"}, "name": "z" } } diff --git a/packages/babel-parser/test/fixtures/esprima/expression-binary/migrated_0016/output.json b/packages/babel-parser/test/fixtures/esprima/expression-binary/migrated_0016/output.json index c7661fa85d28..9d88d7ba1cc3 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-binary/migrated_0016/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-binary/migrated_0016/output.json @@ -1,127 +1,36 @@ { "type": "File", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "program": { "type": "Program", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "expression": { "type": "BinaryExpression", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "operator": "|", "right": { "type": "BinaryExpression", - "start": 4, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":4,"end":9,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":9}}, "left": { "type": "Identifier", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "y" - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"y"}, "name": "y" }, "operator": "^", "right": { "type": "Identifier", - "start": 8, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "z" - }, + "start":8,"end":9,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":9},"identifierName":"z"}, "name": "z" } } diff --git a/packages/babel-parser/test/fixtures/esprima/expression-binary/migrated_0017/output.json b/packages/babel-parser/test/fixtures/esprima/expression-binary/migrated_0017/output.json index fcccd1684f80..ba82d25b8771 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-binary/migrated_0017/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-binary/migrated_0017/output.json @@ -1,127 +1,36 @@ { "type": "File", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "program": { "type": "Program", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "expression": { "type": "BinaryExpression", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "operator": "|", "right": { "type": "BinaryExpression", - "start": 4, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":4,"end":9,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":9}}, "left": { "type": "Identifier", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "y" - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"y"}, "name": "y" }, "operator": "&", "right": { "type": "Identifier", - "start": 8, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "z" - }, + "start":8,"end":9,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":9},"identifierName":"z"}, "name": "z" } } diff --git a/packages/babel-parser/test/fixtures/esprima/expression-bitwise-shift/migrated_0000/output.json b/packages/babel-parser/test/fixtures/esprima/expression-bitwise-shift/migrated_0000/output.json index a73cf0cf3f64..967c39273de2 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-bitwise-shift/migrated_0000/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-bitwise-shift/migrated_0000/output.json @@ -1,95 +1,27 @@ { "type": "File", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "program": { "type": "Program", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "expression": { "type": "BinaryExpression", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "operator": "<<", "right": { "type": "Identifier", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "y" - }, + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"y"}, "name": "y" } } diff --git a/packages/babel-parser/test/fixtures/esprima/expression-bitwise-shift/migrated_0001/output.json b/packages/babel-parser/test/fixtures/esprima/expression-bitwise-shift/migrated_0001/output.json index 8a2005065f87..71da5f24f236 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-bitwise-shift/migrated_0001/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-bitwise-shift/migrated_0001/output.json @@ -1,95 +1,27 @@ { "type": "File", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "program": { "type": "Program", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "expression": { "type": "BinaryExpression", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "operator": ">>", "right": { "type": "Identifier", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "y" - }, + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"y"}, "name": "y" } } diff --git a/packages/babel-parser/test/fixtures/esprima/expression-bitwise-shift/migrated_0002/output.json b/packages/babel-parser/test/fixtures/esprima/expression-bitwise-shift/migrated_0002/output.json index 79e6ab49f074..37f18c8f1c3b 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-bitwise-shift/migrated_0002/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-bitwise-shift/migrated_0002/output.json @@ -1,95 +1,27 @@ { "type": "File", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "program": { "type": "Program", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "expression": { "type": "BinaryExpression", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "operator": ">>>", "right": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "y" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"y"}, "name": "y" } } diff --git a/packages/babel-parser/test/fixtures/esprima/expression-complex/migrated_0000/output.json b/packages/babel-parser/test/fixtures/esprima/expression-complex/migrated_0000/output.json index fc67569d5be6..52f97b491566 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-complex/migrated_0000/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-complex/migrated_0000/output.json @@ -1,383 +1,108 @@ { "type": "File", - "start": 0, - "end": 46, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 46 - } - }, + "start":0,"end":46,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":46}}, "program": { "type": "Program", - "start": 0, - "end": 46, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 46 - } - }, + "start":0,"end":46,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":46}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 46, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 46 - } - }, + "start":0,"end":46,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":46}}, "expression": { "type": "LogicalExpression", - "start": 0, - "end": 46, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 46 - } - }, + "start":0,"end":46,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":46}}, "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "a" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"a"}, "name": "a" }, "operator": "||", "right": { "type": "LogicalExpression", - "start": 5, - "end": 46, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 46 - } - }, + "start":5,"end":46,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":46}}, "left": { "type": "Identifier", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "b" - }, + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"b"}, "name": "b" }, "operator": "&&", "right": { "type": "BinaryExpression", - "start": 10, - "end": 46, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 46 - } - }, + "start":10,"end":46,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":46}}, "left": { "type": "Identifier", - "start": 10, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "c" - }, + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11},"identifierName":"c"}, "name": "c" }, "operator": "|", "right": { "type": "BinaryExpression", - "start": 14, - "end": 46, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 46 - } - }, + "start":14,"end":46,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":46}}, "left": { "type": "Identifier", - "start": 14, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - }, - "identifierName": "d" - }, + "start":14,"end":15,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":15},"identifierName":"d"}, "name": "d" }, "operator": "^", "right": { "type": "BinaryExpression", - "start": 18, - "end": 46, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 46 - } - }, + "start":18,"end":46,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":46}}, "left": { "type": "Identifier", - "start": 18, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - }, - "identifierName": "e" - }, + "start":18,"end":19,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":19},"identifierName":"e"}, "name": "e" }, "operator": "&", "right": { "type": "BinaryExpression", - "start": 22, - "end": 46, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 46 - } - }, + "start":22,"end":46,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":46}}, "left": { "type": "Identifier", - "start": 22, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 23 - }, - "identifierName": "f" - }, + "start":22,"end":23,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":23},"identifierName":"f"}, "name": "f" }, "operator": "==", "right": { "type": "BinaryExpression", - "start": 27, - "end": 46, - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 46 - } - }, + "start":27,"end":46,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":46}}, "left": { "type": "Identifier", - "start": 27, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 28 - }, - "identifierName": "g" - }, + "start":27,"end":28,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":28},"identifierName":"g"}, "name": "g" }, "operator": "<", "right": { "type": "BinaryExpression", - "start": 31, - "end": 46, - "loc": { - "start": { - "line": 1, - "column": 31 - }, - "end": { - "line": 1, - "column": 46 - } - }, + "start":31,"end":46,"loc":{"start":{"line":1,"column":31},"end":{"line":1,"column":46}}, "left": { "type": "Identifier", - "start": 31, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 31 - }, - "end": { - "line": 1, - "column": 32 - }, - "identifierName": "h" - }, + "start":31,"end":32,"loc":{"start":{"line":1,"column":31},"end":{"line":1,"column":32},"identifierName":"h"}, "name": "h" }, "operator": ">>>", "right": { "type": "BinaryExpression", - "start": 37, - "end": 46, - "loc": { - "start": { - "line": 1, - "column": 37 - }, - "end": { - "line": 1, - "column": 46 - } - }, + "start":37,"end":46,"loc":{"start":{"line":1,"column":37},"end":{"line":1,"column":46}}, "left": { "type": "Identifier", - "start": 37, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 37 - }, - "end": { - "line": 1, - "column": 38 - }, - "identifierName": "i" - }, + "start":37,"end":38,"loc":{"start":{"line":1,"column":37},"end":{"line":1,"column":38},"identifierName":"i"}, "name": "i" }, "operator": "+", "right": { "type": "BinaryExpression", - "start": 41, - "end": 46, - "loc": { - "start": { - "line": 1, - "column": 41 - }, - "end": { - "line": 1, - "column": 46 - } - }, + "start":41,"end":46,"loc":{"start":{"line":1,"column":41},"end":{"line":1,"column":46}}, "left": { "type": "Identifier", - "start": 41, - "end": 42, - "loc": { - "start": { - "line": 1, - "column": 41 - }, - "end": { - "line": 1, - "column": 42 - }, - "identifierName": "j" - }, + "start":41,"end":42,"loc":{"start":{"line":1,"column":41},"end":{"line":1,"column":42},"identifierName":"j"}, "name": "j" }, "operator": "*", "right": { "type": "Identifier", - "start": 45, - "end": 46, - "loc": { - "start": { - "line": 1, - "column": 45 - }, - "end": { - "line": 1, - "column": 46 - }, - "identifierName": "k" - }, + "start":45,"end":46,"loc":{"start":{"line":1,"column":45},"end":{"line":1,"column":46},"identifierName":"k"}, "name": "k" } } diff --git a/packages/babel-parser/test/fixtures/esprima/expression-conditional/migrated_0000/output.json b/packages/babel-parser/test/fixtures/esprima/expression-conditional/migrated_0000/output.json index 9256d55782d5..6bd9c8a48889 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-conditional/migrated_0000/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-conditional/migrated_0000/output.json @@ -1,93 +1,26 @@ { "type": "File", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "program": { "type": "Program", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "expression": { "type": "ConditionalExpression", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "test": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "y" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"y"}, "name": "y" }, "consequent": { "type": "NumericLiteral", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5}}, "extra": { "rawValue": 1, "raw": "1" @@ -96,18 +29,7 @@ }, "alternate": { "type": "NumericLiteral", - "start": 8, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":8,"end":9,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":9}}, "extra": { "rawValue": 2, "raw": "2" diff --git a/packages/babel-parser/test/fixtures/esprima/expression-conditional/migrated_0001/output.json b/packages/babel-parser/test/fixtures/esprima/expression-conditional/migrated_0001/output.json index 78cba5d9924b..73ed52c6a7f5 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-conditional/migrated_0001/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-conditional/migrated_0001/output.json @@ -1,126 +1,36 @@ { "type": "File", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "program": { "type": "Program", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "expression": { "type": "ConditionalExpression", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "test": { "type": "LogicalExpression", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "operator": "&&", "right": { "type": "Identifier", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "y" - }, + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"y"}, "name": "y" } }, "consequent": { "type": "NumericLiteral", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10}}, "extra": { "rawValue": 1, "raw": "1" @@ -129,18 +39,7 @@ }, "alternate": { "type": "NumericLiteral", - "start": 13, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":13,"end":14,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":14}}, "extra": { "rawValue": 2, "raw": "2" diff --git a/packages/babel-parser/test/fixtures/esprima/expression-conditional/migrated_0002/output.json b/packages/babel-parser/test/fixtures/esprima/expression-conditional/migrated_0002/output.json index e4d9c2138739..3701d003855f 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-conditional/migrated_0002/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-conditional/migrated_0002/output.json @@ -1,108 +1,30 @@ { "type": "File", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "program": { "type": "Program", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "expression": { "type": "AssignmentExpression", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "operator": "=", "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "right": { "type": "ConditionalExpression", - "start": 4, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":4,"end":15,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":15}}, "test": { "type": "NumericLiteral", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, "extra": { "rawValue": 0, "raw": "0", @@ -113,18 +35,7 @@ }, "consequent": { "type": "NumericLiteral", - "start": 10, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11}}, "extra": { "rawValue": 1, "raw": "1" @@ -133,18 +44,7 @@ }, "alternate": { "type": "NumericLiteral", - "start": 14, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":14,"end":15,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":15}}, "extra": { "rawValue": 2, "raw": "2" diff --git a/packages/babel-parser/test/fixtures/esprima/expression-equality/migrated_0000/output.json b/packages/babel-parser/test/fixtures/esprima/expression-equality/migrated_0000/output.json index 1be43c5d3ea3..f9d37f650fdf 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-equality/migrated_0000/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-equality/migrated_0000/output.json @@ -1,95 +1,27 @@ { "type": "File", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "program": { "type": "Program", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "expression": { "type": "BinaryExpression", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "operator": "==", "right": { "type": "Identifier", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "y" - }, + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"y"}, "name": "y" } } diff --git a/packages/babel-parser/test/fixtures/esprima/expression-equality/migrated_0001/output.json b/packages/babel-parser/test/fixtures/esprima/expression-equality/migrated_0001/output.json index 7fdf6f8aa3eb..509a2fa878b7 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-equality/migrated_0001/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-equality/migrated_0001/output.json @@ -1,95 +1,27 @@ { "type": "File", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "program": { "type": "Program", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "expression": { "type": "BinaryExpression", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "operator": "!=", "right": { "type": "Identifier", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "y" - }, + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"y"}, "name": "y" } } diff --git a/packages/babel-parser/test/fixtures/esprima/expression-equality/migrated_0002/output.json b/packages/babel-parser/test/fixtures/esprima/expression-equality/migrated_0002/output.json index 4e3733ed6b77..910c4ace54af 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-equality/migrated_0002/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-equality/migrated_0002/output.json @@ -1,95 +1,27 @@ { "type": "File", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "program": { "type": "Program", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "expression": { "type": "BinaryExpression", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "operator": "===", "right": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "y" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"y"}, "name": "y" } } diff --git a/packages/babel-parser/test/fixtures/esprima/expression-equality/migrated_0003/output.json b/packages/babel-parser/test/fixtures/esprima/expression-equality/migrated_0003/output.json index d439d193a709..b84db6eff743 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-equality/migrated_0003/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-equality/migrated_0003/output.json @@ -1,95 +1,27 @@ { "type": "File", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "program": { "type": "Program", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "expression": { "type": "BinaryExpression", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "operator": "!==", "right": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "y" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"y"}, "name": "y" } } diff --git a/packages/babel-parser/test/fixtures/esprima/expression-grouping/migrated_0000/output.json b/packages/babel-parser/test/fixtures/esprima/expression-grouping/migrated_0000/output.json index d248e9f318c9..6911226652fb 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-grouping/migrated_0000/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-grouping/migrated_0000/output.json @@ -1,90 +1,24 @@ { "type": "File", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "program": { "type": "Program", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "expression": { "type": "BinaryExpression", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "left": { "type": "BinaryExpression", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "left": { "type": "NumericLiteral", - "start": 1, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - } - }, + "start":1,"end":2,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":2}}, "extra": { "rawValue": 1, "raw": "1", @@ -96,18 +30,7 @@ "operator": "+", "right": { "type": "NumericLiteral", - "start": 7, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8}}, "extra": { "rawValue": 2, "raw": "2", @@ -120,18 +43,7 @@ "operator": "+", "right": { "type": "NumericLiteral", - "start": 14, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":14,"end":15,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":15}}, "extra": { "rawValue": 3, "raw": "3" diff --git a/packages/babel-parser/test/fixtures/esprima/expression-grouping/migrated_0001/output.json b/packages/babel-parser/test/fixtures/esprima/expression-grouping/migrated_0001/output.json index 02385c5aac11..5b219a39af43 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-grouping/migrated_0001/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-grouping/migrated_0001/output.json @@ -1,90 +1,24 @@ { "type": "File", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, "program": { "type": "Program", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, "expression": { "type": "BinaryExpression", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, "left": { "type": "BinaryExpression", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "left": { "type": "NumericLiteral", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1}}, "extra": { "rawValue": 4, "raw": "4" @@ -94,18 +28,7 @@ "operator": "+", "right": { "type": "NumericLiteral", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5}}, "extra": { "rawValue": 5, "raw": "5" @@ -116,18 +39,7 @@ "operator": "<<", "right": { "type": "NumericLiteral", - "start": 10, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11}}, "extra": { "rawValue": 6, "raw": "6", diff --git a/packages/babel-parser/test/fixtures/esprima/expression-left-hand-side/migrated_0000/output.json b/packages/babel-parser/test/fixtures/esprima/expression-left-hand-side/migrated_0000/output.json index 832564eca470..d0e31b332f44 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-left-hand-side/migrated_0000/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-left-hand-side/migrated_0000/output.json @@ -1,77 +1,21 @@ { "type": "File", - "start": 0, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, "program": { "type": "Program", - "start": 0, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, "expression": { "type": "NewExpression", - "start": 0, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, "callee": { "type": "Identifier", - "start": 4, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 10 - }, - "identifierName": "Button" - }, + "start":4,"end":10,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":10},"identifierName":"Button"}, "name": "Button" }, "arguments": [] diff --git a/packages/babel-parser/test/fixtures/esprima/expression-left-hand-side/migrated_0001/output.json b/packages/babel-parser/test/fixtures/esprima/expression-left-hand-side/migrated_0001/output.json index 7bd85bcc02e7..31c748c495c7 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-left-hand-side/migrated_0001/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-left-hand-side/migrated_0001/output.json @@ -1,77 +1,21 @@ { "type": "File", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, "program": { "type": "Program", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, "expression": { "type": "NewExpression", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, "callee": { "type": "Identifier", - "start": 4, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 10 - }, - "identifierName": "Button" - }, + "start":4,"end":10,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":10},"identifierName":"Button"}, "name": "Button" }, "arguments": [] diff --git a/packages/babel-parser/test/fixtures/esprima/expression-left-hand-side/migrated_0002/output.json b/packages/babel-parser/test/fixtures/esprima/expression-left-hand-side/migrated_0002/output.json index 8890dbc0a524..b700e71957e6 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-left-hand-side/migrated_0002/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-left-hand-side/migrated_0002/output.json @@ -1,91 +1,24 @@ { "type": "File", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "program": { "type": "Program", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "expression": { "type": "NewExpression", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "callee": { "type": "NewExpression", - "start": 4, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":4,"end":11,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":11}}, "callee": { "type": "Identifier", - "start": 8, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "foo" - }, + "start":8,"end":11,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":11},"identifierName":"foo"}, "name": "foo" }, "arguments": [] diff --git a/packages/babel-parser/test/fixtures/esprima/expression-left-hand-side/migrated_0003/output.json b/packages/babel-parser/test/fixtures/esprima/expression-left-hand-side/migrated_0003/output.json index 74dfc01529a3..2a305b55c4bb 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-left-hand-side/migrated_0003/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-left-hand-side/migrated_0003/output.json @@ -1,91 +1,24 @@ { "type": "File", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "program": { "type": "Program", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "expression": { "type": "NewExpression", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "callee": { "type": "NewExpression", - "start": 4, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":4,"end":13,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":13}}, "callee": { "type": "Identifier", - "start": 8, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "foo" - }, + "start":8,"end":11,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":11},"identifierName":"foo"}, "name": "foo" }, "arguments": [] diff --git a/packages/babel-parser/test/fixtures/esprima/expression-left-hand-side/migrated_0004/output.json b/packages/babel-parser/test/fixtures/esprima/expression-left-hand-side/migrated_0004/output.json index 9a7b0d5681d2..6b3dccf75cd9 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-left-hand-side/migrated_0004/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-left-hand-side/migrated_0004/output.json @@ -1,124 +1,34 @@ { "type": "File", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "program": { "type": "Program", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "expression": { "type": "CallExpression", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "callee": { "type": "MemberExpression", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "object": { "type": "NewExpression", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "callee": { "type": "Identifier", - "start": 4, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "foo" - }, + "start":4,"end":7,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":7},"identifierName":"foo"}, "name": "foo" }, "arguments": [] }, "property": { "type": "Identifier", - "start": 10, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 13 - }, - "identifierName": "bar" - }, + "start":10,"end":13,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":13},"identifierName":"bar"}, "name": "bar" }, "computed": false diff --git a/packages/babel-parser/test/fixtures/esprima/expression-left-hand-side/migrated_0005/output.json b/packages/babel-parser/test/fixtures/esprima/expression-left-hand-side/migrated_0005/output.json index aed252faf17d..2a3507d72d53 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-left-hand-side/migrated_0005/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-left-hand-side/migrated_0005/output.json @@ -1,108 +1,29 @@ { "type": "File", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, "program": { "type": "Program", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, "expression": { "type": "NewExpression", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, "callee": { "type": "MemberExpression", - "start": 4, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":4,"end":12,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":12}}, "object": { "type": "Identifier", - "start": 4, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "foo" - }, + "start":4,"end":7,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":7},"identifierName":"foo"}, "name": "foo" }, "property": { "type": "Identifier", - "start": 8, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "bar" - }, + "start":8,"end":11,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":11},"identifierName":"bar"}, "name": "bar" }, "computed": true diff --git a/packages/babel-parser/test/fixtures/esprima/expression-left-hand-side/migrated_0006/output.json b/packages/babel-parser/test/fixtures/esprima/expression-left-hand-side/migrated_0006/output.json index 0177eead6074..3a2644e84250 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-left-hand-side/migrated_0006/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-left-hand-side/migrated_0006/output.json @@ -1,108 +1,29 @@ { "type": "File", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "program": { "type": "Program", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "expression": { "type": "NewExpression", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "callee": { "type": "MemberExpression", - "start": 4, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":4,"end":11,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":11}}, "object": { "type": "Identifier", - "start": 4, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "foo" - }, + "start":4,"end":7,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":7},"identifierName":"foo"}, "name": "foo" }, "property": { "type": "Identifier", - "start": 8, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "bar" - }, + "start":8,"end":11,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":11},"identifierName":"bar"}, "name": "bar" }, "computed": false diff --git a/packages/babel-parser/test/fixtures/esprima/expression-left-hand-side/migrated_0007/output.json b/packages/babel-parser/test/fixtures/esprima/expression-left-hand-side/migrated_0007/output.json index 2e5825aecfbb..6dfef381edf5 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-left-hand-side/migrated_0007/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-left-hand-side/migrated_0007/output.json @@ -1,105 +1,27 @@ { "type": "File", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "program": { "type": "Program", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "expression": { "type": "CallExpression", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "callee": { "type": "MemberExpression", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "object": { "type": "NewExpression", - "start": 2, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":2,"end":9,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":9}}, "callee": { "type": "Identifier", - "start": 6, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "foo" - }, + "start":6,"end":9,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":9},"identifierName":"foo"}, "name": "foo" }, "arguments": [], @@ -110,19 +32,7 @@ }, "property": { "type": "Identifier", - "start": 11, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 14 - }, - "identifierName": "bar" - }, + "start":11,"end":14,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":14},"identifierName":"bar"}, "name": "bar" }, "computed": false diff --git a/packages/babel-parser/test/fixtures/esprima/expression-left-hand-side/migrated_0008/output.json b/packages/babel-parser/test/fixtures/esprima/expression-left-hand-side/migrated_0008/output.json index 38dadd707806..0bbb304c6e3d 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-left-hand-side/migrated_0008/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-left-hand-side/migrated_0008/output.json @@ -1,112 +1,32 @@ { "type": "File", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "program": { "type": "Program", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "expression": { "type": "CallExpression", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "callee": { "type": "Identifier", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - }, - "identifierName": "foo" - }, + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3},"identifierName":"foo"}, "name": "foo" }, "arguments": [ { "type": "Identifier", - "start": 4, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "bar" - }, + "start":4,"end":7,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":7},"identifierName":"bar"}, "name": "bar" }, { "type": "Identifier", - "start": 9, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "baz" - }, + "start":9,"end":12,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":12},"identifierName":"baz"}, "name": "baz" } ] diff --git a/packages/babel-parser/test/fixtures/esprima/expression-left-hand-side/migrated_0009/output.json b/packages/babel-parser/test/fixtures/esprima/expression-left-hand-side/migrated_0009/output.json index f8bf7daf5bd2..b86053f12aa9 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-left-hand-side/migrated_0009/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-left-hand-side/migrated_0009/output.json @@ -1,77 +1,21 @@ { "type": "File", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "program": { "type": "Program", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "expression": { "type": "CallExpression", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "callee": { "type": "Identifier", - "start": 5, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 8 - }, - "identifierName": "foo" - }, + "start":5,"end":8,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":8},"identifierName":"foo"}, "name": "foo", "extra": { "parenthesized": true, diff --git a/packages/babel-parser/test/fixtures/esprima/expression-left-hand-side/migrated_0010/output.json b/packages/babel-parser/test/fixtures/esprima/expression-left-hand-side/migrated_0010/output.json index 82d3e1035a29..d55ddd1b61ea 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-left-hand-side/migrated_0010/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-left-hand-side/migrated_0010/output.json @@ -1,94 +1,26 @@ { "type": "File", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "program": { "type": "Program", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "expression": { "type": "MemberExpression", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "object": { "type": "Identifier", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - }, - "identifierName": "universe" - }, + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8},"identifierName":"universe"}, "name": "universe" }, "property": { "type": "Identifier", - "start": 9, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 17 - }, - "identifierName": "milkyway" - }, + "start":9,"end":17,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":17},"identifierName":"milkyway"}, "name": "milkyway" }, "computed": false diff --git a/packages/babel-parser/test/fixtures/esprima/expression-left-hand-side/migrated_0011/output.json b/packages/babel-parser/test/fixtures/esprima/expression-left-hand-side/migrated_0011/output.json index a446cdb8fba9..90f241ea29b9 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-left-hand-side/migrated_0011/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-left-hand-side/migrated_0011/output.json @@ -1,127 +1,36 @@ { "type": "File", - "start": 0, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, "program": { "type": "Program", - "start": 0, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, "expression": { "type": "MemberExpression", - "start": 0, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, "object": { "type": "MemberExpression", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "object": { "type": "Identifier", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - }, - "identifierName": "universe" - }, + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8},"identifierName":"universe"}, "name": "universe" }, "property": { "type": "Identifier", - "start": 9, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 17 - }, - "identifierName": "milkyway" - }, + "start":9,"end":17,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":17},"identifierName":"milkyway"}, "name": "milkyway" }, "computed": false }, "property": { "type": "Identifier", - "start": 18, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 29 - }, - "identifierName": "solarsystem" - }, + "start":18,"end":29,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":29},"identifierName":"solarsystem"}, "name": "solarsystem" }, "computed": false diff --git a/packages/babel-parser/test/fixtures/esprima/expression-left-hand-side/migrated_0012/output.json b/packages/babel-parser/test/fixtures/esprima/expression-left-hand-side/migrated_0012/output.json index cb1cbf606f18..6ebb1a398b70 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-left-hand-side/migrated_0012/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-left-hand-side/migrated_0012/output.json @@ -1,160 +1,46 @@ { "type": "File", - "start": 0, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":35}}, "program": { "type": "Program", - "start": 0, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":35}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":35}}, "expression": { "type": "MemberExpression", - "start": 0, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":35}}, "object": { "type": "MemberExpression", - "start": 0, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, "object": { "type": "MemberExpression", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "object": { "type": "Identifier", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - }, - "identifierName": "universe" - }, + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8},"identifierName":"universe"}, "name": "universe" }, "property": { "type": "Identifier", - "start": 9, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 17 - }, - "identifierName": "milkyway" - }, + "start":9,"end":17,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":17},"identifierName":"milkyway"}, "name": "milkyway" }, "computed": false }, "property": { "type": "Identifier", - "start": 18, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 29 - }, - "identifierName": "solarsystem" - }, + "start":18,"end":29,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":29},"identifierName":"solarsystem"}, "name": "solarsystem" }, "computed": false }, "property": { "type": "Identifier", - "start": 30, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 1, - "column": 35 - }, - "identifierName": "Earth" - }, + "start":30,"end":35,"loc":{"start":{"line":1,"column":30},"end":{"line":1,"column":35},"identifierName":"Earth"}, "name": "Earth" }, "computed": false diff --git a/packages/babel-parser/test/fixtures/esprima/expression-left-hand-side/migrated_0013/output.json b/packages/babel-parser/test/fixtures/esprima/expression-left-hand-side/migrated_0013/output.json index fbb61eb44b1f..35c3eaa5e2ba 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-left-hand-side/migrated_0013/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-left-hand-side/migrated_0013/output.json @@ -1,126 +1,35 @@ { "type": "File", - "start": 0, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":38}}, "program": { "type": "Program", - "start": 0, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":38}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":38}}, "expression": { "type": "MemberExpression", - "start": 0, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":38}}, "object": { "type": "Identifier", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - }, - "identifierName": "universe" - }, + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8},"identifierName":"universe"}, "name": "universe" }, "property": { "type": "SequenceExpression", - "start": 9, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 37 - } - }, + "start":9,"end":37,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":37}}, "expressions": [ { "type": "Identifier", - "start": 9, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 19 - }, - "identifierName": "galaxyName" - }, + "start":9,"end":19,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":19},"identifierName":"galaxyName"}, "name": "galaxyName" }, { "type": "Identifier", - "start": 21, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 37 - }, - "identifierName": "otherUselessName" - }, + "start":21,"end":37,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":37},"identifierName":"otherUselessName"}, "name": "otherUselessName" } ] diff --git a/packages/babel-parser/test/fixtures/esprima/expression-left-hand-side/migrated_0014/output.json b/packages/babel-parser/test/fixtures/esprima/expression-left-hand-side/migrated_0014/output.json index 4d221db72d8c..5ccfa4a76dee 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-left-hand-side/migrated_0014/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-left-hand-side/migrated_0014/output.json @@ -1,94 +1,26 @@ { "type": "File", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, "program": { "type": "Program", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, "expression": { "type": "MemberExpression", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, "object": { "type": "Identifier", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - }, - "identifierName": "universe" - }, + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8},"identifierName":"universe"}, "name": "universe" }, "property": { "type": "Identifier", - "start": 9, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 19 - }, - "identifierName": "galaxyName" - }, + "start":9,"end":19,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":19},"identifierName":"galaxyName"}, "name": "galaxyName" }, "computed": true diff --git a/packages/babel-parser/test/fixtures/esprima/expression-left-hand-side/migrated_0015/output.json b/packages/babel-parser/test/fixtures/esprima/expression-left-hand-side/migrated_0015/output.json index f3ec5d8857d3..5fa10d856cd3 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-left-hand-side/migrated_0015/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-left-hand-side/migrated_0015/output.json @@ -1,107 +1,29 @@ { "type": "File", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, "program": { "type": "Program", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, "expression": { "type": "MemberExpression", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, "object": { "type": "MemberExpression", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, "object": { "type": "Identifier", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - }, - "identifierName": "universe" - }, + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8},"identifierName":"universe"}, "name": "universe" }, "property": { "type": "NumericLiteral", - "start": 9, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":9,"end":11,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":11}}, "extra": { "rawValue": 42, "raw": "42" @@ -112,19 +34,7 @@ }, "property": { "type": "Identifier", - "start": 13, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 21 - }, - "identifierName": "galaxies" - }, + "start":13,"end":21,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":21},"identifierName":"galaxies"}, "name": "galaxies" }, "computed": false diff --git a/packages/babel-parser/test/fixtures/esprima/expression-left-hand-side/migrated_0016/output.json b/packages/babel-parser/test/fixtures/esprima/expression-left-hand-side/migrated_0016/output.json index a0d7dd658252..5fe9e49343b7 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-left-hand-side/migrated_0016/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-left-hand-side/migrated_0016/output.json @@ -1,108 +1,30 @@ { "type": "File", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, "program": { "type": "Program", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, "expression": { "type": "MemberExpression", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, "object": { "type": "CallExpression", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, "callee": { "type": "Identifier", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - }, - "identifierName": "universe" - }, + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8},"identifierName":"universe"}, "name": "universe" }, "arguments": [ { "type": "NumericLiteral", - "start": 9, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":9,"end":11,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":11}}, "extra": { "rawValue": 42, "raw": "42" @@ -113,19 +35,7 @@ }, "property": { "type": "Identifier", - "start": 13, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 21 - }, - "identifierName": "galaxies" - }, + "start":13,"end":21,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":21},"identifierName":"galaxies"}, "name": "galaxies" }, "computed": false diff --git a/packages/babel-parser/test/fixtures/esprima/expression-left-hand-side/migrated_0017/output.json b/packages/babel-parser/test/fixtures/esprima/expression-left-hand-side/migrated_0017/output.json index 3d93d997f972..e7068fd5cac3 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-left-hand-side/migrated_0017/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-left-hand-side/migrated_0017/output.json @@ -1,136 +1,36 @@ { "type": "File", - "start": 0, - "end": 41, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 41 - } - }, + "start":0,"end":41,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":41}}, "program": { "type": "Program", - "start": 0, - "end": 41, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 41 - } - }, + "start":0,"end":41,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":41}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 41, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 41 - } - }, + "start":0,"end":41,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":41}}, "expression": { "type": "MemberExpression", - "start": 0, - "end": 41, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 41 - } - }, + "start":0,"end":41,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":41}}, "object": { "type": "CallExpression", - "start": 0, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, "callee": { "type": "MemberExpression", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, "object": { "type": "CallExpression", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, "callee": { "type": "Identifier", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - }, - "identifierName": "universe" - }, + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8},"identifierName":"universe"}, "name": "universe" }, "arguments": [ { "type": "NumericLiteral", - "start": 9, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":9,"end":11,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":11}}, "extra": { "rawValue": 42, "raw": "42" @@ -141,19 +41,7 @@ }, "property": { "type": "Identifier", - "start": 13, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 21 - }, - "identifierName": "galaxies" - }, + "start":13,"end":21,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":21},"identifierName":"galaxies"}, "name": "galaxies" }, "computed": false @@ -161,18 +49,7 @@ "arguments": [ { "type": "NumericLiteral", - "start": 22, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":22,"end":24,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":24}}, "extra": { "rawValue": 14, "raw": "14" @@ -181,18 +58,7 @@ }, { "type": "NumericLiteral", - "start": 26, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":26,"end":27,"loc":{"start":{"line":1,"column":26},"end":{"line":1,"column":27}}, "extra": { "rawValue": 3, "raw": "3" @@ -201,18 +67,7 @@ }, { "type": "NumericLiteral", - "start": 29, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":29,"end":31,"loc":{"start":{"line":1,"column":29},"end":{"line":1,"column":31}}, "extra": { "rawValue": 77, "raw": "77" @@ -223,19 +78,7 @@ }, "property": { "type": "Identifier", - "start": 33, - "end": 41, - "loc": { - "start": { - "line": 1, - "column": 33 - }, - "end": { - "line": 1, - "column": 41 - }, - "identifierName": "milkyway" - }, + "start":33,"end":41,"loc":{"start":{"line":1,"column":33},"end":{"line":1,"column":41},"identifierName":"milkyway"}, "name": "milkyway" }, "computed": false diff --git a/packages/babel-parser/test/fixtures/esprima/expression-left-hand-side/migrated_0018/output.json b/packages/babel-parser/test/fixtures/esprima/expression-left-hand-side/migrated_0018/output.json index bc3d887ec081..645ac82f5566 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-left-hand-side/migrated_0018/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-left-hand-side/migrated_0018/output.json @@ -1,174 +1,49 @@ { "type": "File", - "start": 0, - "end": 45, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 45 - } - }, + "start":0,"end":45,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":45}}, "program": { "type": "Program", - "start": 0, - "end": 45, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 45 - } - }, + "start":0,"end":45,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":45}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 45, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 45 - } - }, + "start":0,"end":45,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":45}}, "expression": { "type": "CallExpression", - "start": 0, - "end": 45, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 45 - } - }, + "start":0,"end":45,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":45}}, "callee": { "type": "MemberExpression", - "start": 0, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 39 - } - }, + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":39}}, "object": { "type": "MemberExpression", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, "object": { "type": "MemberExpression", - "start": 0, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, "object": { "type": "Identifier", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "earth" - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5},"identifierName":"earth"}, "name": "earth" }, "property": { "type": "Identifier", - "start": 6, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 10 - }, - "identifierName": "asia" - }, + "start":6,"end":10,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":10},"identifierName":"asia"}, "name": "asia" }, "computed": false }, "property": { "type": "Identifier", - "start": 11, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 20 - }, - "identifierName": "Indonesia" - }, + "start":11,"end":20,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":20},"identifierName":"Indonesia"}, "name": "Indonesia" }, "computed": false }, "property": { "type": "Identifier", - "start": 21, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 39 - }, - "identifierName": "prepareForElection" - }, + "start":21,"end":39,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":39},"identifierName":"prepareForElection"}, "name": "prepareForElection" }, "computed": false @@ -176,18 +51,7 @@ "arguments": [ { "type": "NumericLiteral", - "start": 40, - "end": 44, - "loc": { - "start": { - "line": 1, - "column": 40 - }, - "end": { - "line": 1, - "column": 44 - } - }, + "start":40,"end":44,"loc":{"start":{"line":1,"column":40},"end":{"line":1,"column":44}}, "extra": { "rawValue": 2014, "raw": "2014" diff --git a/packages/babel-parser/test/fixtures/esprima/expression-left-hand-side/migrated_0019/output.json b/packages/babel-parser/test/fixtures/esprima/expression-left-hand-side/migrated_0019/output.json index 8e2550dfe5dd..96d56d51f44b 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-left-hand-side/migrated_0019/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-left-hand-side/migrated_0019/output.json @@ -1,94 +1,26 @@ { "type": "File", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "program": { "type": "Program", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "expression": { "type": "MemberExpression", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "object": { "type": "Identifier", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - }, - "identifierName": "universe" - }, + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8},"identifierName":"universe"}, "name": "universe" }, "property": { "type": "Identifier", - "start": 9, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "if" - }, + "start":9,"end":11,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":11},"identifierName":"if"}, "name": "if" }, "computed": false diff --git a/packages/babel-parser/test/fixtures/esprima/expression-left-hand-side/migrated_0020/output.json b/packages/babel-parser/test/fixtures/esprima/expression-left-hand-side/migrated_0020/output.json index 88fce0c71325..834a12a4ebaf 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-left-hand-side/migrated_0020/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-left-hand-side/migrated_0020/output.json @@ -1,94 +1,26 @@ { "type": "File", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "program": { "type": "Program", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "expression": { "type": "MemberExpression", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "object": { "type": "Identifier", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - }, - "identifierName": "universe" - }, + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8},"identifierName":"universe"}, "name": "universe" }, "property": { "type": "Identifier", - "start": 9, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 13 - }, - "identifierName": "true" - }, + "start":9,"end":13,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":13},"identifierName":"true"}, "name": "true" }, "computed": false diff --git a/packages/babel-parser/test/fixtures/esprima/expression-left-hand-side/migrated_0021/output.json b/packages/babel-parser/test/fixtures/esprima/expression-left-hand-side/migrated_0021/output.json index c40e59d22d69..e7664cfc936c 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-left-hand-side/migrated_0021/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-left-hand-side/migrated_0021/output.json @@ -1,94 +1,26 @@ { "type": "File", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "program": { "type": "Program", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "expression": { "type": "MemberExpression", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "object": { "type": "Identifier", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - }, - "identifierName": "universe" - }, + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8},"identifierName":"universe"}, "name": "universe" }, "property": { "type": "Identifier", - "start": 9, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 14 - }, - "identifierName": "false" - }, + "start":9,"end":14,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":14},"identifierName":"false"}, "name": "false" }, "computed": false diff --git a/packages/babel-parser/test/fixtures/esprima/expression-left-hand-side/migrated_0022/output.json b/packages/babel-parser/test/fixtures/esprima/expression-left-hand-side/migrated_0022/output.json index 9739e7a6f375..d9b4c0dd9e6a 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-left-hand-side/migrated_0022/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-left-hand-side/migrated_0022/output.json @@ -1,94 +1,26 @@ { "type": "File", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "program": { "type": "Program", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "expression": { "type": "MemberExpression", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "object": { "type": "Identifier", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - }, - "identifierName": "universe" - }, + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8},"identifierName":"universe"}, "name": "universe" }, "property": { "type": "Identifier", - "start": 9, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 13 - }, - "identifierName": "null" - }, + "start":9,"end":13,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":13},"identifierName":"null"}, "name": "null" }, "computed": false diff --git a/packages/babel-parser/test/fixtures/esprima/expression-multiplicative/migrated_0000/output.json b/packages/babel-parser/test/fixtures/esprima/expression-multiplicative/migrated_0000/output.json index d6c2f9a3e0dc..f90dba3c9ca5 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-multiplicative/migrated_0000/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-multiplicative/migrated_0000/output.json @@ -1,95 +1,27 @@ { "type": "File", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "program": { "type": "Program", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "expression": { "type": "BinaryExpression", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "operator": "*", "right": { "type": "Identifier", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "y" - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"y"}, "name": "y" } } diff --git a/packages/babel-parser/test/fixtures/esprima/expression-multiplicative/migrated_0001/output.json b/packages/babel-parser/test/fixtures/esprima/expression-multiplicative/migrated_0001/output.json index edeb7a67b95e..8a3977855df0 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-multiplicative/migrated_0001/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-multiplicative/migrated_0001/output.json @@ -1,95 +1,27 @@ { "type": "File", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "program": { "type": "Program", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "expression": { "type": "BinaryExpression", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "operator": "/", "right": { "type": "Identifier", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "y" - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"y"}, "name": "y" } } diff --git a/packages/babel-parser/test/fixtures/esprima/expression-multiplicative/migrated_0002/output.json b/packages/babel-parser/test/fixtures/esprima/expression-multiplicative/migrated_0002/output.json index 65b21159bd92..7d67196d62ad 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-multiplicative/migrated_0002/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-multiplicative/migrated_0002/output.json @@ -1,95 +1,27 @@ { "type": "File", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "program": { "type": "Program", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "expression": { "type": "BinaryExpression", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "operator": "%", "right": { "type": "Identifier", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "y" - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"y"}, "name": "y" } } diff --git a/packages/babel-parser/test/fixtures/esprima/expression-postfix/migrated_0000/output.json b/packages/babel-parser/test/fixtures/esprima/expression-postfix/migrated_0000/output.json index 603d0ca75c7e..798e7f2d3c09 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-postfix/migrated_0000/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-postfix/migrated_0000/output.json @@ -1,79 +1,23 @@ { "type": "File", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, "program": { "type": "Program", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, "expression": { "type": "UpdateExpression", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, "operator": "++", "prefix": false, "argument": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" } } diff --git a/packages/babel-parser/test/fixtures/esprima/expression-postfix/migrated_0001/output.json b/packages/babel-parser/test/fixtures/esprima/expression-postfix/migrated_0001/output.json index 0c86ed9cfa68..2470e7fd781b 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-postfix/migrated_0001/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-postfix/migrated_0001/output.json @@ -1,79 +1,23 @@ { "type": "File", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, "program": { "type": "Program", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, "expression": { "type": "UpdateExpression", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, "operator": "--", "prefix": false, "argument": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" } } diff --git a/packages/babel-parser/test/fixtures/esprima/expression-postfix/migrated_0002/output.json b/packages/babel-parser/test/fixtures/esprima/expression-postfix/migrated_0002/output.json index acdf9d06a913..87c3e0871fce 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-postfix/migrated_0002/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-postfix/migrated_0002/output.json @@ -1,79 +1,23 @@ { "type": "File", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "program": { "type": "Program", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "expression": { "type": "UpdateExpression", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "operator": "++", "prefix": false, "argument": { "type": "Identifier", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - }, - "identifierName": "eval" - }, + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4},"identifierName":"eval"}, "name": "eval" } } diff --git a/packages/babel-parser/test/fixtures/esprima/expression-postfix/migrated_0003/output.json b/packages/babel-parser/test/fixtures/esprima/expression-postfix/migrated_0003/output.json index 16a8b4d99781..1798f7e29651 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-postfix/migrated_0003/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-postfix/migrated_0003/output.json @@ -1,79 +1,23 @@ { "type": "File", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "program": { "type": "Program", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "expression": { "type": "UpdateExpression", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "operator": "--", "prefix": false, "argument": { "type": "Identifier", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - }, - "identifierName": "eval" - }, + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4},"identifierName":"eval"}, "name": "eval" } } diff --git a/packages/babel-parser/test/fixtures/esprima/expression-postfix/migrated_0004/output.json b/packages/babel-parser/test/fixtures/esprima/expression-postfix/migrated_0004/output.json index 1ae88c0512af..6237a6d3dda1 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-postfix/migrated_0004/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-postfix/migrated_0004/output.json @@ -1,79 +1,23 @@ { "type": "File", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "program": { "type": "Program", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "expression": { "type": "UpdateExpression", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "operator": "++", "prefix": false, "argument": { "type": "Identifier", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "arguments" - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9},"identifierName":"arguments"}, "name": "arguments" } } diff --git a/packages/babel-parser/test/fixtures/esprima/expression-postfix/migrated_0005/output.json b/packages/babel-parser/test/fixtures/esprima/expression-postfix/migrated_0005/output.json index f9aca6bfaa5e..31b78a3ccbd9 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-postfix/migrated_0005/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-postfix/migrated_0005/output.json @@ -1,79 +1,23 @@ { "type": "File", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "program": { "type": "Program", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "expression": { "type": "UpdateExpression", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "operator": "--", "prefix": false, "argument": { "type": "Identifier", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "arguments" - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9},"identifierName":"arguments"}, "name": "arguments" } } diff --git a/packages/babel-parser/test/fixtures/esprima/expression-primary-array/migrated_0000/output.json b/packages/babel-parser/test/fixtures/esprima/expression-primary-array/migrated_0000/output.json index 9446cbbae1c5..86fa33c5b8af 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-primary-array/migrated_0000/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-primary-array/migrated_0000/output.json @@ -1,94 +1,27 @@ { "type": "File", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "program": { "type": "Program", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "expression": { "type": "AssignmentExpression", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "operator": "=", "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "right": { "type": "ArrayExpression", - "start": 4, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":4,"end":6,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":6}}, "elements": [] } } diff --git a/packages/babel-parser/test/fixtures/esprima/expression-primary-array/migrated_0001/output.json b/packages/babel-parser/test/fixtures/esprima/expression-primary-array/migrated_0001/output.json index 138fcb2e6263..07143b67c9a1 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-primary-array/migrated_0001/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-primary-array/migrated_0001/output.json @@ -1,94 +1,27 @@ { "type": "File", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "program": { "type": "Program", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "expression": { "type": "AssignmentExpression", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "operator": "=", "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "right": { "type": "ArrayExpression", - "start": 4, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":4,"end":7,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":7}}, "elements": [] } } diff --git a/packages/babel-parser/test/fixtures/esprima/expression-primary-array/migrated_0002/output.json b/packages/babel-parser/test/fixtures/esprima/expression-primary-array/migrated_0002/output.json index ef826212c27b..ffa484a7df17 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-primary-array/migrated_0002/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-primary-array/migrated_0002/output.json @@ -1,109 +1,31 @@ { "type": "File", - "start": 0, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, "program": { "type": "Program", - "start": 0, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, "expression": { "type": "AssignmentExpression", - "start": 0, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, "operator": "=", "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "right": { "type": "ArrayExpression", - "start": 4, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":4,"end":10,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":10}}, "elements": [ { "type": "NumericLiteral", - "start": 6, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":6,"end":8,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":8}}, "extra": { "rawValue": 42, "raw": "42" diff --git a/packages/babel-parser/test/fixtures/esprima/expression-primary-array/migrated_0003/output.json b/packages/babel-parser/test/fixtures/esprima/expression-primary-array/migrated_0003/output.json index 3f7e070ca3ac..021db7e307b2 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-primary-array/migrated_0003/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-primary-array/migrated_0003/output.json @@ -1,109 +1,34 @@ { "type": "File", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "program": { "type": "Program", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "expression": { "type": "AssignmentExpression", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "operator": "=", "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "right": { "type": "ArrayExpression", - "start": 4, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 11 - } + "start":4,"end":11,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":11}}, + "extra": { + "trailingComma": 8 }, "elements": [ { "type": "NumericLiteral", - "start": 6, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":6,"end":8,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":8}}, "extra": { "rawValue": 42, "raw": "42" diff --git a/packages/babel-parser/test/fixtures/esprima/expression-primary-array/migrated_0004/output.json b/packages/babel-parser/test/fixtures/esprima/expression-primary-array/migrated_0004/output.json index b0025ea3388c..207c5b961330 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-primary-array/migrated_0004/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-primary-array/migrated_0004/output.json @@ -1,111 +1,33 @@ { "type": "File", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "program": { "type": "Program", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "expression": { "type": "AssignmentExpression", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "operator": "=", "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "right": { "type": "ArrayExpression", - "start": 4, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":4,"end":13,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":13}}, "elements": [ null, null, { "type": "NumericLiteral", - "start": 9, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":9,"end":11,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":11}}, "extra": { "rawValue": 42, "raw": "42" diff --git a/packages/babel-parser/test/fixtures/esprima/expression-primary-array/migrated_0005/output.json b/packages/babel-parser/test/fixtures/esprima/expression-primary-array/migrated_0005/output.json index 573eda5bfa9f..4bc8d58ff2be 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-primary-array/migrated_0005/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-primary-array/migrated_0005/output.json @@ -1,109 +1,34 @@ { "type": "File", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "program": { "type": "Program", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "expression": { "type": "AssignmentExpression", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "operator": "=", "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "right": { "type": "ArrayExpression", - "start": 4, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 16 - } + "start":4,"end":16,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":16}}, + "extra": { + "trailingComma": 13 }, "elements": [ { "type": "NumericLiteral", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7}}, "extra": { "rawValue": 1, "raw": "1" @@ -112,18 +37,7 @@ }, { "type": "NumericLiteral", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10}}, "extra": { "rawValue": 2, "raw": "2" @@ -132,18 +46,7 @@ }, { "type": "NumericLiteral", - "start": 12, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":12,"end":13,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":13}}, "extra": { "rawValue": 3, "raw": "3" diff --git a/packages/babel-parser/test/fixtures/esprima/expression-primary-array/migrated_0006/output.json b/packages/babel-parser/test/fixtures/esprima/expression-primary-array/migrated_0006/output.json index 34c8d7e15c8e..48a925190076 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-primary-array/migrated_0006/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-primary-array/migrated_0006/output.json @@ -1,109 +1,34 @@ { "type": "File", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "program": { "type": "Program", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "expression": { "type": "AssignmentExpression", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "operator": "=", "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "right": { "type": "ArrayExpression", - "start": 4, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 17 - } + "start":4,"end":17,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":17}}, + "extra": { + "trailingComma": 14 }, "elements": [ { "type": "NumericLiteral", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7}}, "extra": { "rawValue": 1, "raw": "1" @@ -112,18 +37,7 @@ }, { "type": "NumericLiteral", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10}}, "extra": { "rawValue": 2, "raw": "2" @@ -133,18 +47,7 @@ null, { "type": "NumericLiteral", - "start": 13, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":13,"end":14,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":14}}, "extra": { "rawValue": 3, "raw": "3" diff --git a/packages/babel-parser/test/fixtures/esprima/expression-primary-array/migrated_0007/output.json b/packages/babel-parser/test/fixtures/esprima/expression-primary-array/migrated_0007/output.json index 4a76c9ff3935..a51e468a580c 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-primary-array/migrated_0007/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-primary-array/migrated_0007/output.json @@ -1,94 +1,27 @@ { "type": "File", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, "program": { "type": "Program", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, "expression": { "type": "AssignmentExpression", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, "operator": "=", "left": { "type": "Identifier", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - }, - "identifierName": "日本語" - }, + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3},"identifierName":"日本語"}, "name": "日本語" }, "right": { "type": "ArrayExpression", - "start": 6, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":6,"end":8,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":8}}, "elements": [] } } diff --git a/packages/babel-parser/test/fixtures/esprima/expression-primary-array/migrated_0008/output.json b/packages/babel-parser/test/fixtures/esprima/expression-primary-array/migrated_0008/output.json index 5aa9eb08425a..30fa8120728d 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-primary-array/migrated_0008/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-primary-array/migrated_0008/output.json @@ -1,94 +1,27 @@ { "type": "File", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, "program": { "type": "Program", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, "expression": { "type": "AssignmentExpression", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, "operator": "=", "left": { "type": "Identifier", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "T‿" - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7},"identifierName":"T‿"}, "name": "T‿" }, "right": { "type": "ArrayExpression", - "start": 10, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":10,"end":12,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":12}}, "elements": [] } } diff --git a/packages/babel-parser/test/fixtures/esprima/expression-primary-array/migrated_0009/output.json b/packages/babel-parser/test/fixtures/esprima/expression-primary-array/migrated_0009/output.json index d6c768be8953..36dc80226613 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-primary-array/migrated_0009/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-primary-array/migrated_0009/output.json @@ -1,94 +1,27 @@ { "type": "File", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, "program": { "type": "Program", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, "expression": { "type": "AssignmentExpression", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, "operator": "=", "left": { "type": "Identifier", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "T‌" - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7},"identifierName":"T‌"}, "name": "T‌" }, "right": { "type": "ArrayExpression", - "start": 10, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":10,"end":12,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":12}}, "elements": [] } } diff --git a/packages/babel-parser/test/fixtures/esprima/expression-primary-array/migrated_0010/output.json b/packages/babel-parser/test/fixtures/esprima/expression-primary-array/migrated_0010/output.json index ff1dbdcfacbe..dc4a4b78264b 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-primary-array/migrated_0010/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-primary-array/migrated_0010/output.json @@ -1,94 +1,27 @@ { "type": "File", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, "program": { "type": "Program", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, "expression": { "type": "AssignmentExpression", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, "operator": "=", "left": { "type": "Identifier", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "T‍" - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7},"identifierName":"T‍"}, "name": "T‍" }, "right": { "type": "ArrayExpression", - "start": 10, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":10,"end":12,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":12}}, "elements": [] } } diff --git a/packages/babel-parser/test/fixtures/esprima/expression-primary-array/migrated_0011/output.json b/packages/babel-parser/test/fixtures/esprima/expression-primary-array/migrated_0011/output.json index d48fa35f8a00..53c0a13b7022 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-primary-array/migrated_0011/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-primary-array/migrated_0011/output.json @@ -1,94 +1,27 @@ { "type": "File", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "program": { "type": "Program", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "expression": { "type": "AssignmentExpression", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "operator": "=", "left": { "type": "Identifier", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "ⅣⅡ" - }, + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12},"identifierName":"ⅣⅡ"}, "name": "ⅣⅡ" }, "right": { "type": "ArrayExpression", - "start": 15, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":15,"end":17,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":17}}, "elements": [] } } diff --git a/packages/babel-parser/test/fixtures/esprima/expression-primary-array/migrated_0012/input.js b/packages/babel-parser/test/fixtures/esprima/expression-primary-array/migrated_0012/input.js index 79581f8529b7..cbd842119b94 100755 --- a/packages/babel-parser/test/fixtures/esprima/expression-primary-array/migrated_0012/input.js +++ b/packages/babel-parser/test/fixtures/esprima/expression-primary-array/migrated_0012/input.js @@ -1 +1 @@ -\u2163\u2161\u200A=\u2009[] +\u2163\u2161\u200A diff --git a/packages/babel-parser/test/fixtures/esprima/expression-primary-array/migrated_0012/options.json b/packages/babel-parser/test/fixtures/esprima/expression-primary-array/migrated_0012/options.json deleted file mode 100644 index abe9f835b84b..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/expression-primary-array/migrated_0012/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid Unicode escape (1:12)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/expression-primary-array/migrated_0012/output.json b/packages/babel-parser/test/fixtures/esprima/expression-primary-array/migrated_0012/output.json new file mode 100644 index 000000000000..ba8f74f4e0f4 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/expression-primary-array/migrated_0012/output.json @@ -0,0 +1,37 @@ +{ + "type": "File", + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, + "errors": [ + "SyntaxError: Invalid Unicode escape (1:12)" + ], + "program": { + "type": "Program", + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, + "expression": { + "type": "Identifier", + "start": 0, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + }, + "identifierName": "ⅣⅡ " + }, + "name": "ⅣⅡ " + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-numeric/migrated_0000/output.json b/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-numeric/migrated_0000/output.json index 3b0df6852fce..a1b891f67787 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-numeric/migrated_0000/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-numeric/migrated_0000/output.json @@ -1,62 +1,18 @@ { "type": "File", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1}}, "expression": { "type": "NumericLiteral", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1}}, "extra": { "rawValue": 0, "raw": "0" diff --git a/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-numeric/migrated_0001/output.json b/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-numeric/migrated_0001/output.json index 20849b383b65..db9c867205f3 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-numeric/migrated_0001/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-numeric/migrated_0001/output.json @@ -1,62 +1,18 @@ { "type": "File", - "start": 0, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 2 - } - }, + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}}, "program": { "type": "Program", - "start": 0, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 2 - } - }, + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 2 - } - }, + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}}, "expression": { "type": "NumericLiteral", - "start": 0, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 2 - } - }, + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}}, "extra": { "rawValue": 42, "raw": "42" diff --git a/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-numeric/migrated_0002/output.json b/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-numeric/migrated_0002/output.json index b21e99bf2e8a..5ad0d7459559 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-numeric/migrated_0002/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-numeric/migrated_0002/output.json @@ -1,62 +1,18 @@ { "type": "File", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1}}, "expression": { "type": "NumericLiteral", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1}}, "extra": { "rawValue": 3, "raw": "3" diff --git a/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-numeric/migrated_0003/output.json b/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-numeric/migrated_0003/output.json index a10e4151e34b..aaeac684c1f4 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-numeric/migrated_0003/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-numeric/migrated_0003/output.json @@ -1,62 +1,18 @@ { "type": "File", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1}}, "expression": { "type": "NumericLiteral", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1}}, "extra": { "rawValue": 5, "raw": "5" diff --git a/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-numeric/migrated_0004/output.json b/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-numeric/migrated_0004/output.json index a5255d5fce90..ac4cc54d118e 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-numeric/migrated_0004/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-numeric/migrated_0004/output.json @@ -1,62 +1,18 @@ { "type": "File", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, "program": { "type": "Program", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, "expression": { "type": "NumericLiteral", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, "extra": { "rawValue": 0.14, "raw": ".14" diff --git a/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-numeric/migrated_0005/output.json b/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-numeric/migrated_0005/output.json index bcb0e150eda3..8f33cfd60630 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-numeric/migrated_0005/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-numeric/migrated_0005/output.json @@ -1,62 +1,18 @@ { "type": "File", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "program": { "type": "Program", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "expression": { "type": "NumericLiteral", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "extra": { "rawValue": 3.14159, "raw": "3.14159" diff --git a/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-numeric/migrated_0006/output.json b/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-numeric/migrated_0006/output.json index 85fdb9eb27f1..34d1f995b463 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-numeric/migrated_0006/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-numeric/migrated_0006/output.json @@ -1,62 +1,18 @@ { "type": "File", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "program": { "type": "Program", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "expression": { "type": "NumericLiteral", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "extra": { "rawValue": 6.02214179e+23, "raw": "6.02214179e+23" diff --git a/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-numeric/migrated_0007/output.json b/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-numeric/migrated_0007/output.json index 570feb3f99a8..782f9c962a58 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-numeric/migrated_0007/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-numeric/migrated_0007/output.json @@ -1,62 +1,18 @@ { "type": "File", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "program": { "type": "Program", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "expression": { "type": "NumericLiteral", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "extra": { "rawValue": 1.49241783e-10, "raw": "1.492417830e-10" diff --git a/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-numeric/migrated_0008/output.json b/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-numeric/migrated_0008/output.json index 5dab1af37b3e..2cbe6c5f228f 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-numeric/migrated_0008/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-numeric/migrated_0008/output.json @@ -1,62 +1,18 @@ { "type": "File", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, "program": { "type": "Program", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, "expression": { "type": "NumericLiteral", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, "extra": { "rawValue": 0, "raw": "0x0" diff --git a/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-numeric/migrated_0009/output.json b/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-numeric/migrated_0009/output.json index 2c80770e1150..fdd2f3fa3c36 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-numeric/migrated_0009/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-numeric/migrated_0009/output.json @@ -1,62 +1,18 @@ { "type": "File", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - }, + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, "program": { "type": "Program", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - }, + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - }, + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, "expression": { "type": "NumericLiteral", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, "extra": { "rawValue": 0, "raw": "0x0" diff --git a/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-numeric/migrated_0010/output.json b/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-numeric/migrated_0010/output.json index 4d36c6d5cebb..10e5ffff0ec4 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-numeric/migrated_0010/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-numeric/migrated_0010/output.json @@ -1,62 +1,18 @@ { "type": "File", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "program": { "type": "Program", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "expression": { "type": "NumericLiteral", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "extra": { "rawValue": 0, "raw": "0e+100" diff --git a/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-numeric/migrated_0011/output.json b/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-numeric/migrated_0011/output.json index 4d36c6d5cebb..10e5ffff0ec4 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-numeric/migrated_0011/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-numeric/migrated_0011/output.json @@ -1,62 +1,18 @@ { "type": "File", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "program": { "type": "Program", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "expression": { "type": "NumericLiteral", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "extra": { "rawValue": 0, "raw": "0e+100" diff --git a/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-numeric/migrated_0012/output.json b/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-numeric/migrated_0012/output.json index ffa4e3f03d34..615599921350 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-numeric/migrated_0012/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-numeric/migrated_0012/output.json @@ -1,62 +1,18 @@ { "type": "File", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "program": { "type": "Program", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "expression": { "type": "NumericLiteral", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "extra": { "rawValue": 2748, "raw": "0xabc" diff --git a/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-numeric/migrated_0013/output.json b/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-numeric/migrated_0013/output.json index ca378cfb321e..e713c6daf609 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-numeric/migrated_0013/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-numeric/migrated_0013/output.json @@ -1,62 +1,18 @@ { "type": "File", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "program": { "type": "Program", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "expression": { "type": "NumericLiteral", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "extra": { "rawValue": 3567, "raw": "0xdef" diff --git a/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-numeric/migrated_0014/output.json b/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-numeric/migrated_0014/output.json index e88d6a6431f2..273d62967486 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-numeric/migrated_0014/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-numeric/migrated_0014/output.json @@ -1,62 +1,18 @@ { "type": "File", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - }, + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, "program": { "type": "Program", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - }, + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - }, + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, "expression": { "type": "NumericLiteral", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - }, + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, "extra": { "rawValue": 26, "raw": "0X1A" diff --git a/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-numeric/migrated_0015/output.json b/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-numeric/migrated_0015/output.json index da0f5a5a077e..b8debd493dbd 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-numeric/migrated_0015/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-numeric/migrated_0015/output.json @@ -1,62 +1,18 @@ { "type": "File", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - }, + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, "program": { "type": "Program", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - }, + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - }, + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, "expression": { "type": "NumericLiteral", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - }, + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, "extra": { "rawValue": 16, "raw": "0x10" diff --git a/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-numeric/migrated_0016/output.json b/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-numeric/migrated_0016/output.json index 3aeb059890fd..d269de6f532d 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-numeric/migrated_0016/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-numeric/migrated_0016/output.json @@ -1,62 +1,18 @@ { "type": "File", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "program": { "type": "Program", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "expression": { "type": "NumericLiteral", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "extra": { "rawValue": 256, "raw": "0x100" diff --git a/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-numeric/migrated_0017/output.json b/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-numeric/migrated_0017/output.json index 508faca10fbb..9bfb038fdbe3 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-numeric/migrated_0017/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-numeric/migrated_0017/output.json @@ -1,62 +1,18 @@ { "type": "File", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - }, + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, "program": { "type": "Program", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - }, + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - }, + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, "expression": { "type": "NumericLiteral", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - }, + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, "extra": { "rawValue": 4, "raw": "0X04" diff --git a/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-numeric/migrated_0018/output.json b/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-numeric/migrated_0018/output.json index 32add9ef9dc3..3e157b067a91 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-numeric/migrated_0018/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-numeric/migrated_0018/output.json @@ -1,62 +1,18 @@ { "type": "File", - "start": 0, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 2 - } - }, + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}}, "program": { "type": "Program", - "start": 0, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 2 - } - }, + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 2 - } - }, + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}}, "expression": { "type": "NumericLiteral", - "start": 0, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 2 - } - }, + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}}, "extra": { "rawValue": 2, "raw": "02" diff --git a/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-numeric/migrated_0019/output.json b/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-numeric/migrated_0019/output.json index 25cd08d3e7e6..b173873622d5 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-numeric/migrated_0019/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-numeric/migrated_0019/output.json @@ -1,62 +1,18 @@ { "type": "File", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, "program": { "type": "Program", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, "expression": { "type": "NumericLiteral", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, "extra": { "rawValue": 10, "raw": "012" diff --git a/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-numeric/migrated_0020/output.json b/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-numeric/migrated_0020/output.json index 3c9b2c223f85..ef45bffe3959 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-numeric/migrated_0020/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-numeric/migrated_0020/output.json @@ -1,62 +1,18 @@ { "type": "File", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - }, + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, "program": { "type": "Program", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - }, + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - }, + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, "expression": { "type": "NumericLiteral", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - }, + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, "extra": { "rawValue": 10, "raw": "0012" diff --git a/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-numeric/migrated_0021/output.json b/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-numeric/migrated_0021/output.json index 877e589c1492..1d2b07a4bd55 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-numeric/migrated_0021/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-numeric/migrated_0021/output.json @@ -1,62 +1,18 @@ { "type": "File", - "start": 0, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 2 - } - }, + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}}, "program": { "type": "Program", - "start": 0, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 2 - } - }, + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 2 - } - }, + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}}, "expression": { "type": "NumericLiteral", - "start": 0, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 2 - } - }, + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}}, "extra": { "rawValue": 8, "raw": "08" diff --git a/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-numeric/migrated_0022/output.json b/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-numeric/migrated_0022/output.json index cb6c2286193c..696c4989aabe 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-numeric/migrated_0022/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-numeric/migrated_0022/output.json @@ -1,62 +1,18 @@ { "type": "File", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - }, + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, "program": { "type": "Program", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - }, + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - }, + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, "expression": { "type": "NumericLiteral", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - }, + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, "extra": { "rawValue": 8, "raw": "0008" diff --git a/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-numeric/migrated_0023/output.json b/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-numeric/migrated_0023/output.json index 22fa47db887b..3e85623558cf 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-numeric/migrated_0023/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-numeric/migrated_0023/output.json @@ -1,62 +1,18 @@ { "type": "File", - "start": 0, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 2 - } - }, + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}}, "program": { "type": "Program", - "start": 0, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 2 - } - }, + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 2 - } - }, + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}}, "expression": { "type": "NumericLiteral", - "start": 0, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 2 - } - }, + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}}, "extra": { "rawValue": 9, "raw": "09" diff --git a/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-numeric/migrated_0024/output.json b/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-numeric/migrated_0024/output.json index f48f7a786775..922adbe94650 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-numeric/migrated_0024/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-numeric/migrated_0024/output.json @@ -1,62 +1,18 @@ { "type": "File", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - }, + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, "program": { "type": "Program", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - }, + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - }, + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, "expression": { "type": "NumericLiteral", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - }, + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, "extra": { "rawValue": 9.5, "raw": "09.5" diff --git a/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-regular-expression/migrated_0000/output.json b/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-regular-expression/migrated_0000/output.json index a6d0d7facf75..d66077168e42 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-regular-expression/migrated_0000/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-regular-expression/migrated_0000/output.json @@ -1,62 +1,18 @@ { "type": "File", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - }, + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, "program": { "type": "Program", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - }, + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - }, + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, "expression": { "type": "RegExpLiteral", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, "extra": { "raw": "/p/" }, diff --git a/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-regular-expression/migrated_0001/output.json b/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-regular-expression/migrated_0001/output.json index 118076195367..b5a042c5d444 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-regular-expression/migrated_0001/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-regular-expression/migrated_0001/output.json @@ -1,77 +1,22 @@ { "type": "File", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "program": { "type": "Program", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "expression": { "type": "ArrayExpression", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "elements": [ { "type": "RegExpLiteral", - "start": 1, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 4 - } - }, + "start":1,"end":4,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":4}}, "extra": { "raw": "/q/" }, diff --git a/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-regular-expression/migrated_0002/output.json b/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-regular-expression/migrated_0002/output.json index edf979f658a8..b0e0b89e8fd3 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-regular-expression/migrated_0002/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-regular-expression/migrated_0002/output.json @@ -1,94 +1,27 @@ { "type": "File", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "program": { "type": "Program", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":4,"end":16,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":16}}, "id": { "type": "Identifier", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "x" - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"x"}, "name": "x" }, "init": { "type": "RegExpLiteral", - "start": 8, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":8,"end":16,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":16}}, "extra": { "raw": "/[a-z]/i" }, diff --git a/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-regular-expression/migrated_0003/output.json b/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-regular-expression/migrated_0003/output.json index 06f89a41d6c9..4668f70d8d2e 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-regular-expression/migrated_0003/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-regular-expression/migrated_0003/output.json @@ -1,94 +1,27 @@ { "type": "File", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "program": { "type": "Program", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":4,"end":16,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":16}}, "id": { "type": "Identifier", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "x" - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"x"}, "name": "x" }, "init": { "type": "RegExpLiteral", - "start": 8, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":8,"end":16,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":16}}, "extra": { "raw": "/[a-z]/y" }, diff --git a/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-regular-expression/migrated_0004/output.json b/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-regular-expression/migrated_0004/output.json index 8c5d9482f12d..594b9d2a64fa 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-regular-expression/migrated_0004/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-regular-expression/migrated_0004/output.json @@ -1,94 +1,27 @@ { "type": "File", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "program": { "type": "Program", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":4,"end":16,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":16}}, "id": { "type": "Identifier", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "x" - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"x"}, "name": "x" }, "init": { "type": "RegExpLiteral", - "start": 8, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":8,"end":16,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":16}}, "extra": { "raw": "/[a-z]/u" }, diff --git a/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-regular-expression/migrated_0007/output.json b/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-regular-expression/migrated_0007/output.json index 4ec3778aaff6..73308081041b 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-regular-expression/migrated_0007/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-regular-expression/migrated_0007/output.json @@ -1,94 +1,27 @@ { "type": "File", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "program": { "type": "Program", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":4,"end":16,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":16}}, "id": { "type": "Identifier", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "x" - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"x"}, "name": "x" }, "init": { "type": "RegExpLiteral", - "start": 8, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":8,"end":16,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":16}}, "extra": { "raw": "/[x-z]/i" }, diff --git a/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-regular-expression/migrated_0008/output.json b/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-regular-expression/migrated_0008/output.json index 7c5bfd0d7d4b..60a5a8fea2af 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-regular-expression/migrated_0008/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-regular-expression/migrated_0008/output.json @@ -1,94 +1,27 @@ { "type": "File", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "program": { "type": "Program", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":4,"end":16,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":16}}, "id": { "type": "Identifier", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "x" - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"x"}, "name": "x" }, "init": { "type": "RegExpLiteral", - "start": 8, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":8,"end":16,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":16}}, "extra": { "raw": "/[a-c]/i" }, diff --git a/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-regular-expression/migrated_0009/output.json b/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-regular-expression/migrated_0009/output.json index c79985fcb2bb..1eea2fed3a3c 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-regular-expression/migrated_0009/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-regular-expression/migrated_0009/output.json @@ -1,94 +1,27 @@ { "type": "File", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "program": { "type": "Program", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":4,"end":17,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":17}}, "id": { "type": "Identifier", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "x" - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"x"}, "name": "x" }, "init": { "type": "RegExpLiteral", - "start": 8, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":8,"end":17,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":17}}, "extra": { "raw": "/[P QR]/i" }, diff --git a/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-regular-expression/migrated_0010/output.json b/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-regular-expression/migrated_0010/output.json index bc5ceb3e0e4b..c4e58bd99b7d 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-regular-expression/migrated_0010/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-regular-expression/migrated_0010/output.json @@ -1,94 +1,27 @@ { "type": "File", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "program": { "type": "Program", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":4,"end":15,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":15}}, "id": { "type": "Identifier", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "x" - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"x"}, "name": "x" }, "init": { "type": "RegExpLiteral", - "start": 8, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":8,"end":15,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":15}}, "extra": { "raw": "/[\\]/]/" }, diff --git a/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-regular-expression/migrated_0011/output.json b/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-regular-expression/migrated_0011/output.json index abec94d30ee3..2e5490d094d9 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-regular-expression/migrated_0011/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-regular-expression/migrated_0011/output.json @@ -1,94 +1,27 @@ { "type": "File", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, "program": { "type": "Program", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":4,"end":18,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":18}}, "id": { "type": "Identifier", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "x" - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"x"}, "name": "x" }, "init": { "type": "RegExpLiteral", - "start": 8, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":8,"end":18,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":18}}, "extra": { "raw": "/foo\\/bar/" }, diff --git a/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-regular-expression/migrated_0012/output.json b/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-regular-expression/migrated_0012/output.json index 311090fd6ab9..a9e8ee6e33e1 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-regular-expression/migrated_0012/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-regular-expression/migrated_0012/output.json @@ -1,94 +1,27 @@ { "type": "File", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, "program": { "type": "Program", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":4,"end":21,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":21}}, "id": { "type": "Identifier", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "x" - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"x"}, "name": "x" }, "init": { "type": "RegExpLiteral", - "start": 8, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":8,"end":21,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":21}}, "extra": { "raw": "/=([^=\\s])+/g" }, diff --git a/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-regular-expression/migrated_0013/output.json b/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-regular-expression/migrated_0013/output.json index 1dc2cf3956e3..031ffabf4659 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-regular-expression/migrated_0013/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-regular-expression/migrated_0013/output.json @@ -1,108 +1,30 @@ { "type": "File", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, "program": { "type": "Program", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":4,"end":18,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":18}}, "id": { "type": "Identifier", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "x" - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"x"}, "name": "x" }, "init": { "type": "MemberExpression", - "start": 8, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":8,"end":18,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":18}}, "object": { "type": "RegExpLiteral", - "start": 8, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":8,"end":13,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":13}}, "extra": { "raw": "/42/g" }, @@ -111,19 +33,7 @@ }, "property": { "type": "Identifier", - "start": 14, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 18 - }, - "identifierName": "test" - }, + "start":14,"end":18,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":18},"identifierName":"test"}, "name": "test" }, "computed": false diff --git a/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-regular-expression/u-flag-surrogate-pair/output.json b/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-regular-expression/u-flag-surrogate-pair/output.json index b94b022ea7c0..565162df3ccf 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-regular-expression/u-flag-surrogate-pair/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-regular-expression/u-flag-surrogate-pair/output.json @@ -1,94 +1,27 @@ { "type": "File", - "start": 0, - "end": 41, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 41 - } - }, + "start":0,"end":41,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":41}}, "program": { "type": "Program", - "start": 0, - "end": 41, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 41 - } - }, + "start":0,"end":41,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":41}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 41, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 41 - } - }, + "start":0,"end":41,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":41}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 41, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 41 - } - }, + "start":4,"end":41,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":41}}, "id": { "type": "Identifier", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "x" - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"x"}, "name": "x" }, "init": { "type": "RegExpLiteral", - "start": 8, - "end": 41, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 41 - } - }, + "start":8,"end":41,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":41}}, "extra": { "raw": "/[\\uD834\\uDF06-\\uD834\\uDF08a-z]/u" }, diff --git a/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-regular-expression/u-flag-valid-range/output.json b/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-regular-expression/u-flag-valid-range/output.json index 20d499776ad9..84dbe6b65f03 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-regular-expression/u-flag-valid-range/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-regular-expression/u-flag-valid-range/output.json @@ -1,94 +1,27 @@ { "type": "File", - "start": 0, - "end": 61, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 61 - } - }, + "start":0,"end":61,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":61}}, "program": { "type": "Program", - "start": 0, - "end": 61, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 61 - } - }, + "start":0,"end":61,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":61}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 61, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 61 - } - }, + "start":0,"end":61,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":61}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 60, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 60 - } - }, + "start":4,"end":60,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":60}}, "id": { "type": "Identifier", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "x" - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"x"}, "name": "x" }, "init": { "type": "RegExpLiteral", - "start": 8, - "end": 60, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 60 - } - }, + "start":8,"end":60,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":60}}, "extra": { "raw": "/[\\u{61}-b][\\u0061-b][a-\\u{62}][a-\\u0062]\\u{1ffff}/u" }, diff --git a/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-string/migrated_0000/output.json b/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-string/migrated_0000/output.json index decc68148f95..06adbec3fdb4 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-string/migrated_0000/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-string/migrated_0000/output.json @@ -1,63 +1,19 @@ { "type": "File", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "program": { "type": "Program", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "sourceType": "script", "interpreter": null, "body": [], "directives": [ { "type": "Directive", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "value": { "type": "DirectiveLiteral", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "value": "Hello", "extra": { "raw": "\"Hello\"", diff --git a/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-string/migrated_0001/output.json b/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-string/migrated_0001/output.json index 13ba3c4eb97c..85beda94d481 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-string/migrated_0001/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-string/migrated_0001/output.json @@ -1,63 +1,19 @@ { "type": "File", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "program": { "type": "Program", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "sourceType": "script", "interpreter": null, "body": [], "directives": [ { "type": "Directive", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "value": { "type": "DirectiveLiteral", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "value": "\\n\\r\\t\\v\\b\\f\\\\\\'\\\"\\0", "extra": { "raw": "\"\\n\\r\\t\\v\\b\\f\\\\\\'\\\"\\0\"", diff --git a/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-string/migrated_0002/output.json b/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-string/migrated_0002/output.json index d9fbb2b999e5..4e09c13fd6ed 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-string/migrated_0002/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-string/migrated_0002/output.json @@ -1,63 +1,19 @@ { "type": "File", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "program": { "type": "Program", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "sourceType": "script", "interpreter": null, "body": [], "directives": [ { "type": "Directive", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "value": { "type": "DirectiveLiteral", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "value": "\\\\u0061", "extra": { "raw": "\"\\\\u0061\"", diff --git a/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-string/migrated_0003/output.json b/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-string/migrated_0003/output.json index 2b81d94ea76b..fb5e0996bf7b 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-string/migrated_0003/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-string/migrated_0003/output.json @@ -1,63 +1,19 @@ { "type": "File", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "program": { "type": "Program", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "sourceType": "script", "interpreter": null, "body": [], "directives": [ { "type": "Directive", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "value": { "type": "DirectiveLiteral", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "value": "\\x61", "extra": { "raw": "\"\\x61\"", diff --git a/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-string/migrated_0006/output.json b/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-string/migrated_0006/output.json index 166849449336..2bc5cf54b227 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-string/migrated_0006/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-string/migrated_0006/output.json @@ -1,63 +1,19 @@ { "type": "File", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "program": { "type": "Program", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "sourceType": "script", "interpreter": null, "body": [], "directives": [ { "type": "Directive", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "value": { "type": "DirectiveLiteral", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "value": "Hello\\nworld", "extra": { "raw": "\"Hello\\nworld\"", diff --git a/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-string/migrated_0007/output.json b/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-string/migrated_0007/output.json index 69ff486c62d9..8bbf441a1bd2 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-string/migrated_0007/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-string/migrated_0007/output.json @@ -1,63 +1,19 @@ { "type": "File", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 6 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":6}}, "program": { "type": "Program", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 6 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":6}}, "sourceType": "script", "interpreter": null, "body": [], "directives": [ { "type": "Directive", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 6 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":6}}, "value": { "type": "DirectiveLiteral", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 6 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":6}}, "value": "Hello\\\nworld", "extra": { "raw": "\"Hello\\\nworld\"", diff --git a/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-string/migrated_0008/output.json b/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-string/migrated_0008/output.json index f3046102c20f..7ba45ecc53a6 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-string/migrated_0008/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-string/migrated_0008/output.json @@ -1,63 +1,19 @@ { "type": "File", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "program": { "type": "Program", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "sourceType": "script", "interpreter": null, "body": [], "directives": [ { "type": "Directive", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "value": { "type": "DirectiveLiteral", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "value": "Hello\\02World", "extra": { "raw": "\"Hello\\02World\"", diff --git a/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-string/migrated_0009/output.json b/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-string/migrated_0009/output.json index 5f31b1a576f3..6ff8b0773cc8 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-string/migrated_0009/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-string/migrated_0009/output.json @@ -1,63 +1,19 @@ { "type": "File", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "program": { "type": "Program", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "sourceType": "script", "interpreter": null, "body": [], "directives": [ { "type": "Directive", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "value": { "type": "DirectiveLiteral", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "value": "Hello\\012World", "extra": { "raw": "\"Hello\\012World\"", diff --git a/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-string/migrated_0010/output.json b/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-string/migrated_0010/output.json index 9656f26c45a8..43e794894ee1 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-string/migrated_0010/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-string/migrated_0010/output.json @@ -1,63 +1,19 @@ { "type": "File", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "program": { "type": "Program", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "sourceType": "script", "interpreter": null, "body": [], "directives": [ { "type": "Directive", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "value": { "type": "DirectiveLiteral", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "value": "Hello\\122World", "extra": { "raw": "\"Hello\\122World\"", diff --git a/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-string/migrated_0011/output.json b/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-string/migrated_0011/output.json index 5a8ab1f21115..e51d6f3e5110 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-string/migrated_0011/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-string/migrated_0011/output.json @@ -1,63 +1,19 @@ { "type": "File", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "program": { "type": "Program", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "sourceType": "script", "interpreter": null, "body": [], "directives": [ { "type": "Directive", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "value": { "type": "DirectiveLiteral", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "value": "Hello\\0122World", "extra": { "raw": "\"Hello\\0122World\"", diff --git a/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-string/migrated_0012/output.json b/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-string/migrated_0012/output.json index e3470fcb4ec5..4dfa59a362d9 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-string/migrated_0012/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-string/migrated_0012/output.json @@ -1,63 +1,19 @@ { "type": "File", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "program": { "type": "Program", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "sourceType": "script", "interpreter": null, "body": [], "directives": [ { "type": "Directive", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "value": { "type": "DirectiveLiteral", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "value": "Hello\\312World", "extra": { "raw": "\"Hello\\312World\"", diff --git a/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-string/migrated_0013/output.json b/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-string/migrated_0013/output.json index 04f8c8c1df7b..f7c0c7ae2f1c 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-string/migrated_0013/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-string/migrated_0013/output.json @@ -1,63 +1,19 @@ { "type": "File", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "program": { "type": "Program", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "sourceType": "script", "interpreter": null, "body": [], "directives": [ { "type": "Directive", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "value": { "type": "DirectiveLiteral", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "value": "Hello\\412World", "extra": { "raw": "\"Hello\\412World\"", diff --git a/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-string/migrated_0015/output.json b/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-string/migrated_0015/output.json index 88a3f339c132..7ceb0644f6ce 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-string/migrated_0015/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-string/migrated_0015/output.json @@ -1,63 +1,19 @@ { "type": "File", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "program": { "type": "Program", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "sourceType": "script", "interpreter": null, "body": [], "directives": [ { "type": "Directive", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "value": { "type": "DirectiveLiteral", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "value": "Hello\\712World", "extra": { "raw": "\"Hello\\712World\"", diff --git a/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-string/migrated_0016/output.json b/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-string/migrated_0016/output.json index d73cfa2bd010..1a8fc198f200 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-string/migrated_0016/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-string/migrated_0016/output.json @@ -1,63 +1,19 @@ { "type": "File", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "program": { "type": "Program", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "sourceType": "script", "interpreter": null, "body": [], "directives": [ { "type": "Directive", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "value": { "type": "DirectiveLiteral", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "value": "Hello\\0World", "extra": { "raw": "\"Hello\\0World\"", diff --git a/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-string/migrated_0017/output.json b/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-string/migrated_0017/output.json index 69ff486c62d9..8bbf441a1bd2 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-string/migrated_0017/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-string/migrated_0017/output.json @@ -1,63 +1,19 @@ { "type": "File", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 6 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":6}}, "program": { "type": "Program", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 6 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":6}}, "sourceType": "script", "interpreter": null, "body": [], "directives": [ { "type": "Directive", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 6 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":6}}, "value": { "type": "DirectiveLiteral", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 6 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":6}}, "value": "Hello\\\nworld", "extra": { "raw": "\"Hello\\\nworld\"", diff --git a/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-string/migrated_0018/output.json b/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-string/migrated_0018/output.json index e95ac9779c07..b34917f7e658 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-string/migrated_0018/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-primary-literal-string/migrated_0018/output.json @@ -1,63 +1,19 @@ { "type": "File", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "program": { "type": "Program", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "sourceType": "script", "interpreter": null, "body": [], "directives": [ { "type": "Directive", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "value": { "type": "DirectiveLiteral", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "value": "Hello\\1World", "extra": { "raw": "\"Hello\\1World\"", diff --git a/packages/babel-parser/test/fixtures/esprima/expression-primary-object/migrated_0000/output.json b/packages/babel-parser/test/fixtures/esprima/expression-primary-object/migrated_0000/output.json index ace60cd560f2..b3d6b552a8ff 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-primary-object/migrated_0000/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-primary-object/migrated_0000/output.json @@ -1,94 +1,27 @@ { "type": "File", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "program": { "type": "Program", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "expression": { "type": "AssignmentExpression", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "operator": "=", "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "right": { "type": "ObjectExpression", - "start": 4, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":4,"end":6,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":6}}, "properties": [] } } diff --git a/packages/babel-parser/test/fixtures/esprima/expression-primary-object/migrated_0001/output.json b/packages/babel-parser/test/fixtures/esprima/expression-primary-object/migrated_0001/output.json index 475c1afc13f2..dd1feb7b3371 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-primary-object/migrated_0001/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-primary-object/migrated_0001/output.json @@ -1,94 +1,27 @@ { "type": "File", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "program": { "type": "Program", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "expression": { "type": "AssignmentExpression", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "operator": "=", "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "right": { "type": "ObjectExpression", - "start": 4, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":4,"end":7,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":7}}, "properties": [] } } diff --git a/packages/babel-parser/test/fixtures/esprima/expression-primary-object/migrated_0002/output.json b/packages/babel-parser/test/fixtures/esprima/expression-primary-object/migrated_0002/output.json index 245feff142cc..e7d5402c9273 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-primary-object/migrated_0002/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-primary-object/migrated_0002/output.json @@ -1,143 +1,42 @@ { "type": "File", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, "program": { "type": "Program", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, "expression": { "type": "AssignmentExpression", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, "operator": "=", "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "right": { "type": "ObjectExpression", - "start": 4, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":4,"end":18,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":18}}, "properties": [ { "type": "ObjectProperty", - "start": 6, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":6,"end":16,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":16}}, "method": false, "key": { "type": "Identifier", - "start": 6, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "answer" - }, + "start":6,"end":12,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":12},"identifierName":"answer"}, "name": "answer" }, "computed": false, "shorthand": false, "value": { "type": "NumericLiteral", - "start": 14, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":14,"end":16,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":16}}, "extra": { "rawValue": 42, "raw": "42" diff --git a/packages/babel-parser/test/fixtures/esprima/expression-primary-object/migrated_0003/output.json b/packages/babel-parser/test/fixtures/esprima/expression-primary-object/migrated_0003/output.json index 87c6c0164063..934336937dcf 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-primary-object/migrated_0003/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-primary-object/migrated_0003/output.json @@ -1,143 +1,42 @@ { "type": "File", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "program": { "type": "Program", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "expression": { "type": "AssignmentExpression", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "operator": "=", "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "right": { "type": "ObjectExpression", - "start": 4, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":4,"end":14,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":14}}, "properties": [ { "type": "ObjectProperty", - "start": 6, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":6,"end":12,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":12}}, "method": false, "key": { "type": "Identifier", - "start": 6, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 8 - }, - "identifierName": "if" - }, + "start":6,"end":8,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":8},"identifierName":"if"}, "name": "if" }, "computed": false, "shorthand": false, "value": { "type": "NumericLiteral", - "start": 10, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":10,"end":12,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":12}}, "extra": { "rawValue": 42, "raw": "42" diff --git a/packages/babel-parser/test/fixtures/esprima/expression-primary-object/migrated_0004/output.json b/packages/babel-parser/test/fixtures/esprima/expression-primary-object/migrated_0004/output.json index 3a19ed468dc6..923dff08f3d6 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-primary-object/migrated_0004/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-primary-object/migrated_0004/output.json @@ -1,143 +1,42 @@ { "type": "File", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "program": { "type": "Program", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "expression": { "type": "AssignmentExpression", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "operator": "=", "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "right": { "type": "ObjectExpression", - "start": 4, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":4,"end":16,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":16}}, "properties": [ { "type": "ObjectProperty", - "start": 6, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":6,"end":14,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":14}}, "method": false, "key": { "type": "Identifier", - "start": 6, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 10 - }, - "identifierName": "true" - }, + "start":6,"end":10,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":10},"identifierName":"true"}, "name": "true" }, "computed": false, "shorthand": false, "value": { "type": "NumericLiteral", - "start": 12, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":12,"end":14,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":14}}, "extra": { "rawValue": 42, "raw": "42" diff --git a/packages/babel-parser/test/fixtures/esprima/expression-primary-object/migrated_0005/output.json b/packages/babel-parser/test/fixtures/esprima/expression-primary-object/migrated_0005/output.json index dbb1747c7888..024dcc1726ee 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-primary-object/migrated_0005/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-primary-object/migrated_0005/output.json @@ -1,143 +1,42 @@ { "type": "File", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "program": { "type": "Program", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "expression": { "type": "AssignmentExpression", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "operator": "=", "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "right": { "type": "ObjectExpression", - "start": 4, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":4,"end":17,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":17}}, "properties": [ { "type": "ObjectProperty", - "start": 6, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":6,"end":15,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":15}}, "method": false, "key": { "type": "Identifier", - "start": 6, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "false" - }, + "start":6,"end":11,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":11},"identifierName":"false"}, "name": "false" }, "computed": false, "shorthand": false, "value": { "type": "NumericLiteral", - "start": 13, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":13,"end":15,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":15}}, "extra": { "rawValue": 42, "raw": "42" diff --git a/packages/babel-parser/test/fixtures/esprima/expression-primary-object/migrated_0006/output.json b/packages/babel-parser/test/fixtures/esprima/expression-primary-object/migrated_0006/output.json index 2918b16e85cb..5ee065601ed2 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-primary-object/migrated_0006/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-primary-object/migrated_0006/output.json @@ -1,143 +1,42 @@ { "type": "File", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "program": { "type": "Program", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "expression": { "type": "AssignmentExpression", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "operator": "=", "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "right": { "type": "ObjectExpression", - "start": 4, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":4,"end":16,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":16}}, "properties": [ { "type": "ObjectProperty", - "start": 6, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":6,"end":14,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":14}}, "method": false, "key": { "type": "Identifier", - "start": 6, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 10 - }, - "identifierName": "null" - }, + "start":6,"end":10,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":10},"identifierName":"null"}, "name": "null" }, "computed": false, "shorthand": false, "value": { "type": "NumericLiteral", - "start": 12, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":12,"end":14,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":14}}, "extra": { "rawValue": 42, "raw": "42" diff --git a/packages/babel-parser/test/fixtures/esprima/expression-primary-object/migrated_0007/output.json b/packages/babel-parser/test/fixtures/esprima/expression-primary-object/migrated_0007/output.json index 367eac531099..e5cdd1426df6 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-primary-object/migrated_0007/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-primary-object/migrated_0007/output.json @@ -1,124 +1,35 @@ { "type": "File", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, "program": { "type": "Program", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, "expression": { "type": "AssignmentExpression", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, "operator": "=", "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "right": { "type": "ObjectExpression", - "start": 4, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":4,"end":20,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":20}}, "properties": [ { "type": "ObjectProperty", - "start": 6, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":6,"end":18,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":18}}, "method": false, "key": { "type": "StringLiteral", - "start": 6, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":6,"end":14,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":14}}, "extra": { "rawValue": "answer", "raw": "\"answer\"" @@ -129,18 +40,7 @@ "shorthand": false, "value": { "type": "NumericLiteral", - "start": 16, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":16,"end":18,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":18}}, "extra": { "rawValue": 42, "raw": "42" diff --git a/packages/babel-parser/test/fixtures/esprima/expression-primary-object/migrated_0008/output.json b/packages/babel-parser/test/fixtures/esprima/expression-primary-object/migrated_0008/output.json index 81194dadc77a..b8f82071b213 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-primary-object/migrated_0008/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-primary-object/migrated_0008/output.json @@ -1,143 +1,42 @@ { "type": "File", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, "program": { "type": "Program", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, "expression": { "type": "AssignmentExpression", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, "operator": "=", "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "right": { "type": "ObjectExpression", - "start": 4, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":4,"end":18,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":18}}, "properties": [ { "type": "ObjectProperty", - "start": 6, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":6,"end":10,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":10}}, "method": false, "key": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "x" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"x"}, "name": "x" }, "computed": false, "shorthand": false, "value": { "type": "NumericLiteral", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10}}, "extra": { "rawValue": 1, "raw": "1" @@ -147,52 +46,18 @@ }, { "type": "ObjectProperty", - "start": 12, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":12,"end":16,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":16}}, "method": false, "key": { "type": "Identifier", - "start": 12, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - }, - "identifierName": "x" - }, + "start":12,"end":13,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":13},"identifierName":"x"}, "name": "x" }, "computed": false, "shorthand": false, "value": { "type": "NumericLiteral", - "start": 15, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":15,"end":16,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":16}}, "extra": { "rawValue": 2, "raw": "2" diff --git a/packages/babel-parser/test/fixtures/esprima/expression-primary-object/migrated_0009/output.json b/packages/babel-parser/test/fixtures/esprima/expression-primary-object/migrated_0009/output.json index ea4245152521..834b20a1ebcd 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-primary-object/migrated_0009/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-primary-object/migrated_0009/output.json @@ -1,125 +1,35 @@ { "type": "File", - "start": 0, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":38}}, "program": { "type": "Program", - "start": 0, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":38}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":38}}, "expression": { "type": "AssignmentExpression", - "start": 0, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":38}}, "operator": "=", "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "right": { "type": "ObjectExpression", - "start": 4, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":4,"end":38,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":38}}, "properties": [ { "type": "ObjectMethod", - "start": 6, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":6,"end":36,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":36}}, "method": false, "key": { "type": "Identifier", - "start": 10, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 15 - }, - "identifierName": "width" - }, + "start":10,"end":15,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":15},"identifierName":"width"}, "name": "width" }, "computed": false, @@ -130,48 +40,14 @@ "params": [], "body": { "type": "BlockStatement", - "start": 18, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":18,"end":36,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":36}}, "body": [ { "type": "ReturnStatement", - "start": 20, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":20,"end":34,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":34}}, "argument": { "type": "Identifier", - "start": 27, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 34 - }, - "identifierName": "m_width" - }, + "start":27,"end":34,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":34},"identifierName":"m_width"}, "name": "m_width" } } diff --git a/packages/babel-parser/test/fixtures/esprima/expression-primary-object/migrated_0010/output.json b/packages/babel-parser/test/fixtures/esprima/expression-primary-object/migrated_0010/output.json index 9392a4586df7..67a3af336f2c 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-primary-object/migrated_0010/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-primary-object/migrated_0010/output.json @@ -1,125 +1,35 @@ { "type": "File", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "program": { "type": "Program", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "expression": { "type": "AssignmentExpression", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "operator": "=", "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "right": { "type": "ObjectExpression", - "start": 4, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":4,"end":22,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":22}}, "properties": [ { "type": "ObjectMethod", - "start": 6, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":6,"end":20,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":20}}, "method": false, "key": { "type": "Identifier", - "start": 10, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 15 - }, - "identifierName": "undef" - }, + "start":10,"end":15,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":15},"identifierName":"undef"}, "name": "undef" }, "computed": false, @@ -130,18 +40,7 @@ "params": [], "body": { "type": "BlockStatement", - "start": 18, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":18,"end":20,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":20}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/esprima/expression-primary-object/migrated_0011/output.json b/packages/babel-parser/test/fixtures/esprima/expression-primary-object/migrated_0011/output.json index 96fd3b7e93cb..0bd7432907df 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-primary-object/migrated_0011/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-primary-object/migrated_0011/output.json @@ -1,125 +1,35 @@ { "type": "File", - "start": 0, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, "program": { "type": "Program", - "start": 0, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, "expression": { "type": "AssignmentExpression", - "start": 0, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, "operator": "=", "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "right": { "type": "ObjectExpression", - "start": 4, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":4,"end":19,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":19}}, "properties": [ { "type": "ObjectMethod", - "start": 6, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":6,"end":17,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":17}}, "method": false, "key": { "type": "Identifier", - "start": 10, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "if" - }, + "start":10,"end":12,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":12},"identifierName":"if"}, "name": "if" }, "computed": false, @@ -130,18 +40,7 @@ "params": [], "body": { "type": "BlockStatement", - "start": 15, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":15,"end":17,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":17}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/esprima/expression-primary-object/migrated_0012/output.json b/packages/babel-parser/test/fixtures/esprima/expression-primary-object/migrated_0012/output.json index b3ef7da7cabf..dea4eee607a9 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-primary-object/migrated_0012/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-primary-object/migrated_0012/output.json @@ -1,125 +1,35 @@ { "type": "File", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, "program": { "type": "Program", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, "expression": { "type": "AssignmentExpression", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, "operator": "=", "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "right": { "type": "ObjectExpression", - "start": 4, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":4,"end":21,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":21}}, "properties": [ { "type": "ObjectMethod", - "start": 6, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":6,"end":19,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":19}}, "method": false, "key": { "type": "Identifier", - "start": 10, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 14 - }, - "identifierName": "true" - }, + "start":10,"end":14,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":14},"identifierName":"true"}, "name": "true" }, "computed": false, @@ -130,18 +40,7 @@ "params": [], "body": { "type": "BlockStatement", - "start": 17, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":17,"end":19,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":19}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/esprima/expression-primary-object/migrated_0013/output.json b/packages/babel-parser/test/fixtures/esprima/expression-primary-object/migrated_0013/output.json index e055a31d0008..17909837b80f 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-primary-object/migrated_0013/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-primary-object/migrated_0013/output.json @@ -1,125 +1,35 @@ { "type": "File", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "program": { "type": "Program", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "expression": { "type": "AssignmentExpression", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "operator": "=", "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "right": { "type": "ObjectExpression", - "start": 4, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":4,"end":22,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":22}}, "properties": [ { "type": "ObjectMethod", - "start": 6, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":6,"end":20,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":20}}, "method": false, "key": { "type": "Identifier", - "start": 10, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 15 - }, - "identifierName": "false" - }, + "start":10,"end":15,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":15},"identifierName":"false"}, "name": "false" }, "computed": false, @@ -130,18 +40,7 @@ "params": [], "body": { "type": "BlockStatement", - "start": 18, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":18,"end":20,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":20}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/esprima/expression-primary-object/migrated_0014/output.json b/packages/babel-parser/test/fixtures/esprima/expression-primary-object/migrated_0014/output.json index 2ba79ca36077..ac45a4338b73 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-primary-object/migrated_0014/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-primary-object/migrated_0014/output.json @@ -1,125 +1,35 @@ { "type": "File", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, "program": { "type": "Program", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, "expression": { "type": "AssignmentExpression", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, "operator": "=", "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "right": { "type": "ObjectExpression", - "start": 4, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":4,"end":21,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":21}}, "properties": [ { "type": "ObjectMethod", - "start": 6, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":6,"end":19,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":19}}, "method": false, "key": { "type": "Identifier", - "start": 10, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 14 - }, - "identifierName": "null" - }, + "start":10,"end":14,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":14},"identifierName":"null"}, "name": "null" }, "computed": false, @@ -130,18 +40,7 @@ "params": [], "body": { "type": "BlockStatement", - "start": 17, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":17,"end":19,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":19}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/esprima/expression-primary-object/migrated_0015/output.json b/packages/babel-parser/test/fixtures/esprima/expression-primary-object/migrated_0015/output.json index ea3146a858b9..4e52a2f94326 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-primary-object/migrated_0015/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-primary-object/migrated_0015/output.json @@ -1,124 +1,35 @@ { "type": "File", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "program": { "type": "Program", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "expression": { "type": "AssignmentExpression", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "operator": "=", "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "right": { "type": "ObjectExpression", - "start": 4, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":4,"end":24,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":24}}, "properties": [ { "type": "ObjectMethod", - "start": 6, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":6,"end":22,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":22}}, "method": false, "key": { "type": "StringLiteral", - "start": 10, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":10,"end":17,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":17}}, "extra": { "rawValue": "undef", "raw": "\"undef\"" @@ -133,18 +44,7 @@ "params": [], "body": { "type": "BlockStatement", - "start": 20, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":20,"end":22,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":22}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/esprima/expression-primary-object/migrated_0016/output.json b/packages/babel-parser/test/fixtures/esprima/expression-primary-object/migrated_0016/output.json index c02bf897d3a7..620c3d2cc9b8 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-primary-object/migrated_0016/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-primary-object/migrated_0016/output.json @@ -1,124 +1,35 @@ { "type": "File", - "start": 0, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, "program": { "type": "Program", - "start": 0, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, "expression": { "type": "AssignmentExpression", - "start": 0, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, "operator": "=", "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "right": { "type": "ObjectExpression", - "start": 4, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":4,"end":19,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":19}}, "properties": [ { "type": "ObjectMethod", - "start": 6, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":6,"end":17,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":17}}, "method": false, "key": { "type": "NumericLiteral", - "start": 10, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":10,"end":12,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":12}}, "extra": { "rawValue": 10, "raw": "10" @@ -133,18 +44,7 @@ "params": [], "body": { "type": "BlockStatement", - "start": 15, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":15,"end":17,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":17}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/esprima/expression-primary-object/migrated_0017/output.json b/packages/babel-parser/test/fixtures/esprima/expression-primary-object/migrated_0017/output.json index a15882b52dae..6854d518cf5c 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-primary-object/migrated_0017/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-primary-object/migrated_0017/output.json @@ -1,125 +1,35 @@ { "type": "File", - "start": 0, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, "program": { "type": "Program", - "start": 0, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, "expression": { "type": "AssignmentExpression", - "start": 0, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, "operator": "=", "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "right": { "type": "ObjectExpression", - "start": 4, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":4,"end":36,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":36}}, "properties": [ { "type": "ObjectMethod", - "start": 6, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":6,"end":34,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":34}}, "method": false, "key": { "type": "Identifier", - "start": 10, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 15 - }, - "identifierName": "width" - }, + "start":10,"end":15,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":15},"identifierName":"width"}, "name": "width" }, "computed": false, @@ -130,98 +40,29 @@ "params": [ { "type": "Identifier", - "start": 16, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - }, - "identifierName": "w" - }, + "start":16,"end":17,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":17},"identifierName":"w"}, "name": "w" } ], "body": { "type": "BlockStatement", - "start": 19, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":19,"end":34,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":34}}, "body": [ { "type": "ExpressionStatement", - "start": 21, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":21,"end":32,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":32}}, "expression": { "type": "AssignmentExpression", - "start": 21, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":21,"end":32,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":32}}, "operator": "=", "left": { "type": "Identifier", - "start": 21, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 28 - }, - "identifierName": "m_width" - }, + "start":21,"end":28,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":28},"identifierName":"m_width"}, "name": "m_width" }, "right": { "type": "Identifier", - "start": 31, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 31 - }, - "end": { - "line": 1, - "column": 32 - }, - "identifierName": "w" - }, + "start":31,"end":32,"loc":{"start":{"line":1,"column":31},"end":{"line":1,"column":32},"identifierName":"w"}, "name": "w" } } diff --git a/packages/babel-parser/test/fixtures/esprima/expression-primary-object/migrated_0018/output.json b/packages/babel-parser/test/fixtures/esprima/expression-primary-object/migrated_0018/output.json index d672770fbcdf..c1d2713e76da 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-primary-object/migrated_0018/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-primary-object/migrated_0018/output.json @@ -1,125 +1,35 @@ { "type": "File", - "start": 0, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, "program": { "type": "Program", - "start": 0, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, "expression": { "type": "AssignmentExpression", - "start": 0, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, "operator": "=", "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "right": { "type": "ObjectExpression", - "start": 4, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":4,"end":30,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":30}}, "properties": [ { "type": "ObjectMethod", - "start": 6, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":6,"end":28,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":28}}, "method": false, "key": { "type": "Identifier", - "start": 10, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "if" - }, + "start":10,"end":12,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":12},"identifierName":"if"}, "name": "if" }, "computed": false, @@ -130,98 +40,29 @@ "params": [ { "type": "Identifier", - "start": 13, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - }, - "identifierName": "w" - }, + "start":13,"end":14,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":14},"identifierName":"w"}, "name": "w" } ], "body": { "type": "BlockStatement", - "start": 16, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":16,"end":28,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":28}}, "body": [ { "type": "ExpressionStatement", - "start": 18, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":18,"end":26,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":26}}, "expression": { "type": "AssignmentExpression", - "start": 18, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":18,"end":26,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":26}}, "operator": "=", "left": { "type": "Identifier", - "start": 18, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 22 - }, - "identifierName": "m_if" - }, + "start":18,"end":22,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":22},"identifierName":"m_if"}, "name": "m_if" }, "right": { "type": "Identifier", - "start": 25, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 26 - }, - "identifierName": "w" - }, + "start":25,"end":26,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":26},"identifierName":"w"}, "name": "w" } } diff --git a/packages/babel-parser/test/fixtures/esprima/expression-primary-object/migrated_0019/output.json b/packages/babel-parser/test/fixtures/esprima/expression-primary-object/migrated_0019/output.json index 3322d7a98a38..daf210e071a3 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-primary-object/migrated_0019/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-primary-object/migrated_0019/output.json @@ -1,125 +1,35 @@ { "type": "File", - "start": 0, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, "program": { "type": "Program", - "start": 0, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, "expression": { "type": "AssignmentExpression", - "start": 0, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, "operator": "=", "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "right": { "type": "ObjectExpression", - "start": 4, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":4,"end":34,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":34}}, "properties": [ { "type": "ObjectMethod", - "start": 6, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":6,"end":32,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":32}}, "method": false, "key": { "type": "Identifier", - "start": 10, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 14 - }, - "identifierName": "true" - }, + "start":10,"end":14,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":14},"identifierName":"true"}, "name": "true" }, "computed": false, @@ -130,98 +40,29 @@ "params": [ { "type": "Identifier", - "start": 15, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - }, - "identifierName": "w" - }, + "start":15,"end":16,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":16},"identifierName":"w"}, "name": "w" } ], "body": { "type": "BlockStatement", - "start": 18, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":18,"end":32,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":32}}, "body": [ { "type": "ExpressionStatement", - "start": 20, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":20,"end":30,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":30}}, "expression": { "type": "AssignmentExpression", - "start": 20, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":20,"end":30,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":30}}, "operator": "=", "left": { "type": "Identifier", - "start": 20, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 26 - }, - "identifierName": "m_true" - }, + "start":20,"end":26,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":26},"identifierName":"m_true"}, "name": "m_true" }, "right": { "type": "Identifier", - "start": 29, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 1, - "column": 30 - }, - "identifierName": "w" - }, + "start":29,"end":30,"loc":{"start":{"line":1,"column":29},"end":{"line":1,"column":30},"identifierName":"w"}, "name": "w" } } diff --git a/packages/babel-parser/test/fixtures/esprima/expression-primary-object/migrated_0020/output.json b/packages/babel-parser/test/fixtures/esprima/expression-primary-object/migrated_0020/output.json index a26b8b4009e1..c04c402e277f 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-primary-object/migrated_0020/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-primary-object/migrated_0020/output.json @@ -1,125 +1,35 @@ { "type": "File", - "start": 0, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, "program": { "type": "Program", - "start": 0, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, "expression": { "type": "AssignmentExpression", - "start": 0, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, "operator": "=", "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "right": { "type": "ObjectExpression", - "start": 4, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":4,"end":36,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":36}}, "properties": [ { "type": "ObjectMethod", - "start": 6, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":6,"end":34,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":34}}, "method": false, "key": { "type": "Identifier", - "start": 10, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 15 - }, - "identifierName": "false" - }, + "start":10,"end":15,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":15},"identifierName":"false"}, "name": "false" }, "computed": false, @@ -130,98 +40,29 @@ "params": [ { "type": "Identifier", - "start": 16, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - }, - "identifierName": "w" - }, + "start":16,"end":17,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":17},"identifierName":"w"}, "name": "w" } ], "body": { "type": "BlockStatement", - "start": 19, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":19,"end":34,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":34}}, "body": [ { "type": "ExpressionStatement", - "start": 21, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":21,"end":32,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":32}}, "expression": { "type": "AssignmentExpression", - "start": 21, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":21,"end":32,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":32}}, "operator": "=", "left": { "type": "Identifier", - "start": 21, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 28 - }, - "identifierName": "m_false" - }, + "start":21,"end":28,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":28},"identifierName":"m_false"}, "name": "m_false" }, "right": { "type": "Identifier", - "start": 31, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 31 - }, - "end": { - "line": 1, - "column": 32 - }, - "identifierName": "w" - }, + "start":31,"end":32,"loc":{"start":{"line":1,"column":31},"end":{"line":1,"column":32},"identifierName":"w"}, "name": "w" } } diff --git a/packages/babel-parser/test/fixtures/esprima/expression-primary-object/migrated_0021/output.json b/packages/babel-parser/test/fixtures/esprima/expression-primary-object/migrated_0021/output.json index 96e1bccd5184..cb6827eebf81 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-primary-object/migrated_0021/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-primary-object/migrated_0021/output.json @@ -1,125 +1,35 @@ { "type": "File", - "start": 0, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, "program": { "type": "Program", - "start": 0, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, "expression": { "type": "AssignmentExpression", - "start": 0, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, "operator": "=", "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "right": { "type": "ObjectExpression", - "start": 4, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":4,"end":34,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":34}}, "properties": [ { "type": "ObjectMethod", - "start": 6, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":6,"end":32,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":32}}, "method": false, "key": { "type": "Identifier", - "start": 10, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 14 - }, - "identifierName": "null" - }, + "start":10,"end":14,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":14},"identifierName":"null"}, "name": "null" }, "computed": false, @@ -130,98 +40,29 @@ "params": [ { "type": "Identifier", - "start": 15, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - }, - "identifierName": "w" - }, + "start":15,"end":16,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":16},"identifierName":"w"}, "name": "w" } ], "body": { "type": "BlockStatement", - "start": 18, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":18,"end":32,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":32}}, "body": [ { "type": "ExpressionStatement", - "start": 20, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":20,"end":30,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":30}}, "expression": { "type": "AssignmentExpression", - "start": 20, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":20,"end":30,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":30}}, "operator": "=", "left": { "type": "Identifier", - "start": 20, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 26 - }, - "identifierName": "m_null" - }, + "start":20,"end":26,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":26},"identifierName":"m_null"}, "name": "m_null" }, "right": { "type": "Identifier", - "start": 29, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 1, - "column": 30 - }, - "identifierName": "w" - }, + "start":29,"end":30,"loc":{"start":{"line":1,"column":29},"end":{"line":1,"column":30},"identifierName":"w"}, "name": "w" } } diff --git a/packages/babel-parser/test/fixtures/esprima/expression-primary-object/migrated_0022/output.json b/packages/babel-parser/test/fixtures/esprima/expression-primary-object/migrated_0022/output.json index 2fa4b803dd1d..185c7ceda3e8 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-primary-object/migrated_0022/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-primary-object/migrated_0022/output.json @@ -1,124 +1,35 @@ { "type": "File", - "start": 0, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, "program": { "type": "Program", - "start": 0, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, "expression": { "type": "AssignmentExpression", - "start": 0, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, "operator": "=", "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "right": { "type": "ObjectExpression", - "start": 4, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":4,"end":36,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":36}}, "properties": [ { "type": "ObjectMethod", - "start": 6, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":6,"end":34,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":34}}, "method": false, "key": { "type": "StringLiteral", - "start": 10, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":10,"end":16,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":16}}, "extra": { "rawValue": "null", "raw": "\"null\"" @@ -133,98 +44,29 @@ "params": [ { "type": "Identifier", - "start": 17, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - }, - "identifierName": "w" - }, + "start":17,"end":18,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":18},"identifierName":"w"}, "name": "w" } ], "body": { "type": "BlockStatement", - "start": 20, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":20,"end":34,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":34}}, "body": [ { "type": "ExpressionStatement", - "start": 22, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":22,"end":32,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":32}}, "expression": { "type": "AssignmentExpression", - "start": 22, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":22,"end":32,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":32}}, "operator": "=", "left": { "type": "Identifier", - "start": 22, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 28 - }, - "identifierName": "m_null" - }, + "start":22,"end":28,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":28},"identifierName":"m_null"}, "name": "m_null" }, "right": { "type": "Identifier", - "start": 31, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 31 - }, - "end": { - "line": 1, - "column": 32 - }, - "identifierName": "w" - }, + "start":31,"end":32,"loc":{"start":{"line":1,"column":31},"end":{"line":1,"column":32},"identifierName":"w"}, "name": "w" } } diff --git a/packages/babel-parser/test/fixtures/esprima/expression-primary-object/migrated_0023/output.json b/packages/babel-parser/test/fixtures/esprima/expression-primary-object/migrated_0023/output.json index 21dd434a7ad0..c7e5a73217d8 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-primary-object/migrated_0023/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-primary-object/migrated_0023/output.json @@ -1,124 +1,35 @@ { "type": "File", - "start": 0, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, "program": { "type": "Program", - "start": 0, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, "expression": { "type": "AssignmentExpression", - "start": 0, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, "operator": "=", "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "right": { "type": "ObjectExpression", - "start": 4, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":4,"end":32,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":32}}, "properties": [ { "type": "ObjectMethod", - "start": 6, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":6,"end":30,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":30}}, "method": false, "key": { "type": "NumericLiteral", - "start": 10, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":10,"end":12,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":12}}, "extra": { "rawValue": 10, "raw": "10" @@ -133,98 +44,29 @@ "params": [ { "type": "Identifier", - "start": 13, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - }, - "identifierName": "w" - }, + "start":13,"end":14,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":14},"identifierName":"w"}, "name": "w" } ], "body": { "type": "BlockStatement", - "start": 16, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":16,"end":30,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":30}}, "body": [ { "type": "ExpressionStatement", - "start": 18, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":18,"end":28,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":28}}, "expression": { "type": "AssignmentExpression", - "start": 18, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":18,"end":28,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":28}}, "operator": "=", "left": { "type": "Identifier", - "start": 18, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 24 - }, - "identifierName": "m_null" - }, + "start":18,"end":24,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":24},"identifierName":"m_null"}, "name": "m_null" }, "right": { "type": "Identifier", - "start": 27, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 28 - }, - "identifierName": "w" - }, + "start":27,"end":28,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":28},"identifierName":"w"}, "name": "w" } } diff --git a/packages/babel-parser/test/fixtures/esprima/expression-primary-object/migrated_0024/output.json b/packages/babel-parser/test/fixtures/esprima/expression-primary-object/migrated_0024/output.json index 1a0a1b954720..3ae13a3f41fd 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-primary-object/migrated_0024/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-primary-object/migrated_0024/output.json @@ -1,143 +1,42 @@ { "type": "File", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "program": { "type": "Program", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "expression": { "type": "AssignmentExpression", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "operator": "=", "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "right": { "type": "ObjectExpression", - "start": 4, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":4,"end":15,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":15}}, "properties": [ { "type": "ObjectProperty", - "start": 6, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":6,"end":13,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":13}}, "method": false, "key": { "type": "Identifier", - "start": 6, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "get" - }, + "start":6,"end":9,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":9},"identifierName":"get"}, "name": "get" }, "computed": false, "shorthand": false, "value": { "type": "NumericLiteral", - "start": 11, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":11,"end":13,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":13}}, "extra": { "rawValue": 42, "raw": "42" diff --git a/packages/babel-parser/test/fixtures/esprima/expression-primary-object/migrated_0025/output.json b/packages/babel-parser/test/fixtures/esprima/expression-primary-object/migrated_0025/output.json index 8caddf6f2a1e..26fa046a1204 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-primary-object/migrated_0025/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-primary-object/migrated_0025/output.json @@ -1,143 +1,42 @@ { "type": "File", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "program": { "type": "Program", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "expression": { "type": "AssignmentExpression", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "operator": "=", "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "right": { "type": "ObjectExpression", - "start": 4, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":4,"end":15,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":15}}, "properties": [ { "type": "ObjectProperty", - "start": 6, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":6,"end":13,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":13}}, "method": false, "key": { "type": "Identifier", - "start": 6, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "set" - }, + "start":6,"end":9,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":9},"identifierName":"set"}, "name": "set" }, "computed": false, "shorthand": false, "value": { "type": "NumericLiteral", - "start": 11, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":11,"end":13,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":13}}, "extra": { "rawValue": 43, "raw": "43" diff --git a/packages/babel-parser/test/fixtures/esprima/expression-primary-object/migrated_0026/output.json b/packages/babel-parser/test/fixtures/esprima/expression-primary-object/migrated_0026/output.json index 52ea78d41c51..568a99de6347 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-primary-object/migrated_0026/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-primary-object/migrated_0026/output.json @@ -1,143 +1,42 @@ { "type": "File", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, "program": { "type": "Program", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, "expression": { "type": "AssignmentExpression", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, "operator": "=", "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "right": { "type": "ObjectExpression", - "start": 4, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":4,"end":20,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":20}}, "properties": [ { "type": "ObjectProperty", - "start": 6, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":6,"end":18,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":18}}, "method": false, "key": { "type": "Identifier", - "start": 6, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 15 - }, - "identifierName": "__proto__" - }, + "start":6,"end":15,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":15},"identifierName":"__proto__"}, "name": "__proto__" }, "computed": false, "shorthand": false, "value": { "type": "NumericLiteral", - "start": 17, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":17,"end":18,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":18}}, "extra": { "rawValue": 2, "raw": "2" diff --git a/packages/babel-parser/test/fixtures/esprima/expression-primary-object/migrated_0027/output.json b/packages/babel-parser/test/fixtures/esprima/expression-primary-object/migrated_0027/output.json index bf57bae53f88..e2a33949bad1 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-primary-object/migrated_0027/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-primary-object/migrated_0027/output.json @@ -1,124 +1,35 @@ { "type": "File", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, "program": { "type": "Program", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, "expression": { "type": "AssignmentExpression", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, "operator": "=", "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "right": { "type": "ObjectExpression", - "start": 4, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":4,"end":21,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":21}}, "properties": [ { "type": "ObjectProperty", - "start": 5, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":5,"end":19,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":19}}, "method": false, "key": { "type": "StringLiteral", - "start": 5, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":5,"end":16,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":16}}, "extra": { "rawValue": "__proto__", "raw": "\"__proto__\"" @@ -129,18 +40,7 @@ "shorthand": false, "value": { "type": "NumericLiteral", - "start": 18, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":18,"end":19,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":19}}, "extra": { "rawValue": 2, "raw": "2" diff --git a/packages/babel-parser/test/fixtures/esprima/expression-primary-object/migrated_0028/output.json b/packages/babel-parser/test/fixtures/esprima/expression-primary-object/migrated_0028/output.json index e68e602741d1..f0cd92951df9 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-primary-object/migrated_0028/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-primary-object/migrated_0028/output.json @@ -1,125 +1,35 @@ { "type": "File", - "start": 0, - "end": 77, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 77 - } - }, + "start":0,"end":77,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":77}}, "program": { "type": "Program", - "start": 0, - "end": 77, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 77 - } - }, + "start":0,"end":77,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":77}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 77, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 77 - } - }, + "start":0,"end":77,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":77}}, "expression": { "type": "AssignmentExpression", - "start": 0, - "end": 77, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 77 - } - }, + "start":0,"end":77,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":77}}, "operator": "=", "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "right": { "type": "ObjectExpression", - "start": 4, - "end": 77, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 77 - } - }, + "start":4,"end":77,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":77}}, "properties": [ { "type": "ObjectMethod", - "start": 6, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":6,"end":36,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":36}}, "method": false, "key": { "type": "Identifier", - "start": 10, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 15 - }, - "identifierName": "width" - }, + "start":10,"end":15,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":15},"identifierName":"width"}, "name": "width" }, "computed": false, @@ -130,48 +40,14 @@ "params": [], "body": { "type": "BlockStatement", - "start": 18, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":18,"end":36,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":36}}, "body": [ { "type": "ReturnStatement", - "start": 20, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":20,"end":34,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":34}}, "argument": { "type": "Identifier", - "start": 27, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 34 - }, - "identifierName": "m_width" - }, + "start":27,"end":34,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":34},"identifierName":"m_width"}, "name": "m_width" } } @@ -181,34 +57,11 @@ }, { "type": "ObjectMethod", - "start": 38, - "end": 75, - "loc": { - "start": { - "line": 1, - "column": 38 - }, - "end": { - "line": 1, - "column": 75 - } - }, + "start":38,"end":75,"loc":{"start":{"line":1,"column":38},"end":{"line":1,"column":75}}, "method": false, "key": { "type": "Identifier", - "start": 42, - "end": 47, - "loc": { - "start": { - "line": 1, - "column": 42 - }, - "end": { - "line": 1, - "column": 47 - }, - "identifierName": "width" - }, + "start":42,"end":47,"loc":{"start":{"line":1,"column":42},"end":{"line":1,"column":47},"identifierName":"width"}, "name": "width" }, "computed": false, @@ -219,98 +72,29 @@ "params": [ { "type": "Identifier", - "start": 48, - "end": 53, - "loc": { - "start": { - "line": 1, - "column": 48 - }, - "end": { - "line": 1, - "column": 53 - }, - "identifierName": "width" - }, + "start":48,"end":53,"loc":{"start":{"line":1,"column":48},"end":{"line":1,"column":53},"identifierName":"width"}, "name": "width" } ], "body": { "type": "BlockStatement", - "start": 55, - "end": 75, - "loc": { - "start": { - "line": 1, - "column": 55 - }, - "end": { - "line": 1, - "column": 75 - } - }, + "start":55,"end":75,"loc":{"start":{"line":1,"column":55},"end":{"line":1,"column":75}}, "body": [ { "type": "ExpressionStatement", - "start": 57, - "end": 73, - "loc": { - "start": { - "line": 1, - "column": 57 - }, - "end": { - "line": 1, - "column": 73 - } - }, + "start":57,"end":73,"loc":{"start":{"line":1,"column":57},"end":{"line":1,"column":73}}, "expression": { "type": "AssignmentExpression", - "start": 57, - "end": 72, - "loc": { - "start": { - "line": 1, - "column": 57 - }, - "end": { - "line": 1, - "column": 72 - } - }, + "start":57,"end":72,"loc":{"start":{"line":1,"column":57},"end":{"line":1,"column":72}}, "operator": "=", "left": { "type": "Identifier", - "start": 57, - "end": 64, - "loc": { - "start": { - "line": 1, - "column": 57 - }, - "end": { - "line": 1, - "column": 64 - }, - "identifierName": "m_width" - }, + "start":57,"end":64,"loc":{"start":{"line":1,"column":57},"end":{"line":1,"column":64},"identifierName":"m_width"}, "name": "m_width" }, "right": { "type": "Identifier", - "start": 67, - "end": 72, - "loc": { - "start": { - "line": 1, - "column": 67 - }, - "end": { - "line": 1, - "column": 72 - }, - "identifierName": "width" - }, + "start":67,"end":72,"loc":{"start":{"line":1,"column":67},"end":{"line":1,"column":72},"identifierName":"width"}, "name": "width" } } diff --git a/packages/babel-parser/test/fixtures/esprima/expression-primary-object/migrated_0029/output.json b/packages/babel-parser/test/fixtures/esprima/expression-primary-object/migrated_0029/output.json index 157cf63a8362..aa4cb1e9c31e 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-primary-object/migrated_0029/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-primary-object/migrated_0029/output.json @@ -1,93 +1,26 @@ { "type": "File", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "program": { "type": "Program", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "expression": { "type": "ObjectExpression", - "start": 1, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":1,"end":23,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":23}}, "properties": [ { "type": "ObjectMethod", - "start": 3, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":3,"end":14,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":14}}, "method": false, "key": { "type": "Identifier", - "start": 7, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - }, - "identifierName": "i" - }, + "start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8},"identifierName":"i"}, "name": "i" }, "computed": false, @@ -98,70 +31,25 @@ "params": [], "body": { "type": "BlockStatement", - "start": 11, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":11,"end":14,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":14}}, "body": [], "directives": [] } }, { "type": "ObjectProperty", - "start": 16, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":16,"end":21,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":21}}, "method": false, "key": { "type": "Identifier", - "start": 16, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - }, - "identifierName": "i" - }, + "start":16,"end":17,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":17},"identifierName":"i"}, "name": "i" }, "computed": false, "shorthand": false, "value": { "type": "NumericLiteral", - "start": 19, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":19,"end":21,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":21}}, "extra": { "rawValue": 42, "raw": "42" diff --git a/packages/babel-parser/test/fixtures/esprima/expression-primary-object/migrated_0030/output.json b/packages/babel-parser/test/fixtures/esprima/expression-primary-object/migrated_0030/output.json index 9000ad963094..2e6287a36247 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-primary-object/migrated_0030/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-primary-object/migrated_0030/output.json @@ -1,143 +1,42 @@ { "type": "File", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "program": { "type": "Program", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 13, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":13,"end":24,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":24}}, "expression": { "type": "AssignmentExpression", - "start": 13, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":13,"end":24,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":24}}, "operator": "=", "left": { "type": "Identifier", - "start": 13, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - }, - "identifierName": "x" - }, + "start":13,"end":14,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":14},"identifierName":"x"}, "name": "x" }, "right": { "type": "ObjectExpression", - "start": 15, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":15,"end":24,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":24}}, "properties": [ { "type": "ObjectProperty", - "start": 16, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":16,"end":19,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":19}}, "method": false, "key": { "type": "Identifier", - "start": 16, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - }, - "identifierName": "y" - }, + "start":16,"end":17,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":17},"identifierName":"y"}, "name": "y" }, "computed": false, "shorthand": false, "value": { "type": "NumericLiteral", - "start": 18, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":18,"end":19,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":19}}, "extra": { "rawValue": 1, "raw": "1" @@ -147,52 +46,18 @@ }, { "type": "ObjectProperty", - "start": 20, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":20,"end":23,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":23}}, "method": false, "key": { "type": "Identifier", - "start": 20, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 21 - }, - "identifierName": "y" - }, + "start":20,"end":21,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":21},"identifierName":"y"}, "name": "y" }, "computed": false, "shorthand": false, "value": { "type": "NumericLiteral", - "start": 22, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":22,"end":23,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":23}}, "extra": { "rawValue": 1, "raw": "1" @@ -208,32 +73,10 @@ "directives": [ { "type": "Directive", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "value": { "type": "DirectiveLiteral", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, "value": "use strict", "extra": { "raw": "\"use strict\"", diff --git a/packages/babel-parser/test/fixtures/esprima/expression-primary-object/migrated_0031/output.json b/packages/babel-parser/test/fixtures/esprima/expression-primary-object/migrated_0031/output.json index 7754e9f31d1b..31e2398fac1a 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-primary-object/migrated_0031/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-primary-object/migrated_0031/output.json @@ -1,125 +1,35 @@ { "type": "File", - "start": 0, - "end": 48, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 48 - } - }, + "start":0,"end":48,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":48}}, "program": { "type": "Program", - "start": 0, - "end": 48, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 48 - } - }, + "start":0,"end":48,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":48}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 14, - "end": 48, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 48 - } - }, + "start":14,"end":48,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":48}}, "declarations": [ { "type": "VariableDeclarator", - "start": 18, - "end": 48, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 48 - } - }, + "start":18,"end":48,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":48}}, "id": { "type": "Identifier", - "start": 18, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - }, - "identifierName": "x" - }, + "start":18,"end":19,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":19},"identifierName":"x"}, "name": "x" }, "init": { "type": "ObjectExpression", - "start": 22, - "end": 48, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 48 - } - }, + "start":22,"end":48,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":48}}, "properties": [ { "type": "ObjectMethod", - "start": 24, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":24,"end":34,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":34}}, "method": false, "key": { "type": "Identifier", - "start": 28, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 29 - }, - "identifierName": "i" - }, + "start":28,"end":29,"loc":{"start":{"line":1,"column":28},"end":{"line":1,"column":29},"identifierName":"i"}, "name": "i" }, "computed": false, @@ -130,52 +40,18 @@ "params": [], "body": { "type": "BlockStatement", - "start": 32, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 32 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":32,"end":34,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":34}}, "body": [], "directives": [] } }, { "type": "ObjectMethod", - "start": 36, - "end": 46, - "loc": { - "start": { - "line": 1, - "column": 36 - }, - "end": { - "line": 1, - "column": 46 - } - }, + "start":36,"end":46,"loc":{"start":{"line":1,"column":36},"end":{"line":1,"column":46}}, "method": false, "key": { "type": "Identifier", - "start": 40, - "end": 41, - "loc": { - "start": { - "line": 1, - "column": 40 - }, - "end": { - "line": 1, - "column": 41 - }, - "identifierName": "i" - }, + "start":40,"end":41,"loc":{"start":{"line":1,"column":40},"end":{"line":1,"column":41},"identifierName":"i"}, "name": "i" }, "computed": false, @@ -186,18 +62,7 @@ "params": [], "body": { "type": "BlockStatement", - "start": 44, - "end": 46, - "loc": { - "start": { - "line": 1, - "column": 44 - }, - "end": { - "line": 1, - "column": 46 - } - }, + "start":44,"end":46,"loc":{"start":{"line":1,"column":44},"end":{"line":1,"column":46}}, "body": [], "directives": [] } @@ -212,32 +77,10 @@ "directives": [ { "type": "Directive", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "value": { "type": "DirectiveLiteral", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, "value": "use strict", "extra": { "raw": "\"use strict\"", diff --git a/packages/babel-parser/test/fixtures/esprima/expression-primary-object/migrated_0032/output.json b/packages/babel-parser/test/fixtures/esprima/expression-primary-object/migrated_0032/output.json index d6a2610514cb..2a1ff4f91407 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-primary-object/migrated_0032/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-primary-object/migrated_0032/output.json @@ -1,143 +1,42 @@ { "type": "File", - "start": 0, - "end": 43, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 43 - } - }, + "start":0,"end":43,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":43}}, "program": { "type": "Program", - "start": 0, - "end": 43, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 43 - } - }, + "start":0,"end":43,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":43}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 14, - "end": 43, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 43 - } - }, + "start":14,"end":43,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":43}}, "declarations": [ { "type": "VariableDeclarator", - "start": 18, - "end": 43, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 43 - } - }, + "start":18,"end":43,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":43}}, "id": { "type": "Identifier", - "start": 18, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - }, - "identifierName": "x" - }, + "start":18,"end":19,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":19},"identifierName":"x"}, "name": "x" }, "init": { "type": "ObjectExpression", - "start": 22, - "end": 43, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 43 - } - }, + "start":22,"end":43,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":43}}, "properties": [ { "type": "ObjectProperty", - "start": 24, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":24,"end":29,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":29}}, "method": false, "key": { "type": "Identifier", - "start": 24, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 25 - }, - "identifierName": "i" - }, + "start":24,"end":25,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":25},"identifierName":"i"}, "name": "i" }, "computed": false, "shorthand": false, "value": { "type": "NumericLiteral", - "start": 27, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":27,"end":29,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":29}}, "extra": { "rawValue": 42, "raw": "42" @@ -147,34 +46,11 @@ }, { "type": "ObjectMethod", - "start": 31, - "end": 41, - "loc": { - "start": { - "line": 1, - "column": 31 - }, - "end": { - "line": 1, - "column": 41 - } - }, + "start":31,"end":41,"loc":{"start":{"line":1,"column":31},"end":{"line":1,"column":41}}, "method": false, "key": { "type": "Identifier", - "start": 35, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 35 - }, - "end": { - "line": 1, - "column": 36 - }, - "identifierName": "i" - }, + "start":35,"end":36,"loc":{"start":{"line":1,"column":35},"end":{"line":1,"column":36},"identifierName":"i"}, "name": "i" }, "computed": false, @@ -185,18 +61,7 @@ "params": [], "body": { "type": "BlockStatement", - "start": 39, - "end": 41, - "loc": { - "start": { - "line": 1, - "column": 39 - }, - "end": { - "line": 1, - "column": 41 - } - }, + "start":39,"end":41,"loc":{"start":{"line":1,"column":39},"end":{"line":1,"column":41}}, "body": [], "directives": [] } @@ -211,32 +76,10 @@ "directives": [ { "type": "Directive", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "value": { "type": "DirectiveLiteral", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, "value": "use strict", "extra": { "raw": "\"use strict\"", diff --git a/packages/babel-parser/test/fixtures/esprima/expression-primary-object/migrated_0033/output.json b/packages/babel-parser/test/fixtures/esprima/expression-primary-object/migrated_0033/output.json index 93bb4ad6958e..a912cee46623 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-primary-object/migrated_0033/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-primary-object/migrated_0033/output.json @@ -1,125 +1,35 @@ { "type": "File", - "start": 0, - "end": 44, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 44 - } - }, + "start":0,"end":44,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":44}}, "program": { "type": "Program", - "start": 0, - "end": 44, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 44 - } - }, + "start":0,"end":44,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":44}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 14, - "end": 44, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 44 - } - }, + "start":14,"end":44,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":44}}, "declarations": [ { "type": "VariableDeclarator", - "start": 18, - "end": 44, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 44 - } - }, + "start":18,"end":44,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":44}}, "id": { "type": "Identifier", - "start": 18, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - }, - "identifierName": "x" - }, + "start":18,"end":19,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":19},"identifierName":"x"}, "name": "x" }, "init": { "type": "ObjectExpression", - "start": 22, - "end": 44, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 44 - } - }, + "start":22,"end":44,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":44}}, "properties": [ { "type": "ObjectMethod", - "start": 24, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":24,"end":35,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":35}}, "method": false, "key": { "type": "Identifier", - "start": 28, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 29 - }, - "identifierName": "i" - }, + "start":28,"end":29,"loc":{"start":{"line":1,"column":28},"end":{"line":1,"column":29},"identifierName":"i"}, "name": "i" }, "computed": false, @@ -130,88 +40,31 @@ "params": [ { "type": "Identifier", - "start": 30, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 1, - "column": 31 - }, - "identifierName": "x" - }, + "start":30,"end":31,"loc":{"start":{"line":1,"column":30},"end":{"line":1,"column":31},"identifierName":"x"}, "name": "x" } ], "body": { "type": "BlockStatement", - "start": 33, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 33 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":33,"end":35,"loc":{"start":{"line":1,"column":33},"end":{"line":1,"column":35}}, "body": [], "directives": [] } }, { "type": "ObjectProperty", - "start": 37, - "end": 42, - "loc": { - "start": { - "line": 1, - "column": 37 - }, - "end": { - "line": 1, - "column": 42 - } - }, + "start":37,"end":42,"loc":{"start":{"line":1,"column":37},"end":{"line":1,"column":42}}, "method": false, "key": { "type": "Identifier", - "start": 37, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 37 - }, - "end": { - "line": 1, - "column": 38 - }, - "identifierName": "i" - }, + "start":37,"end":38,"loc":{"start":{"line":1,"column":37},"end":{"line":1,"column":38},"identifierName":"i"}, "name": "i" }, "computed": false, "shorthand": false, "value": { "type": "NumericLiteral", - "start": 40, - "end": 42, - "loc": { - "start": { - "line": 1, - "column": 40 - }, - "end": { - "line": 1, - "column": 42 - } - }, + "start":40,"end":42,"loc":{"start":{"line":1,"column":40},"end":{"line":1,"column":42}}, "extra": { "rawValue": 42, "raw": "42" @@ -229,32 +82,10 @@ "directives": [ { "type": "Directive", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "value": { "type": "DirectiveLiteral", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, "value": "use strict", "extra": { "raw": "\"use strict\"", diff --git a/packages/babel-parser/test/fixtures/esprima/expression-primary-object/migrated_0034/output.json b/packages/babel-parser/test/fixtures/esprima/expression-primary-object/migrated_0034/output.json index 1dc5a28897fa..bf72c40e96cf 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-primary-object/migrated_0034/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-primary-object/migrated_0034/output.json @@ -1,94 +1,27 @@ { "type": "File", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "program": { "type": "Program", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "expression": { "type": "ObjectExpression", - "start": 1, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":1,"end":10,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":10}}, "properties": [ { "type": "ObjectMethod", - "start": 2, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":2,"end":9,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":9}}, "method": true, "computed": true, "key": { "type": "Identifier", - "start": 3, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 4 - }, - "identifierName": "a" - }, + "start":3,"end":4,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":4},"identifierName":"a"}, "name": "a" }, "kind": "method", @@ -98,18 +31,7 @@ "params": [], "body": { "type": "BlockStatement", - "start": 7, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":7,"end":9,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":9}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/esprima/expression-primary-object/migrated_0035/output.json b/packages/babel-parser/test/fixtures/esprima/expression-primary-object/migrated_0035/output.json index 2b50d0f0aea2..5b57ca24624e 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-primary-object/migrated_0035/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-primary-object/migrated_0035/output.json @@ -1,129 +1,40 @@ { "type": "File", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "program": { "type": "Program", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "expression": { "type": "ObjectExpression", - "start": 1, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":1,"end":13,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":13}}, "properties": [ { "type": "ObjectProperty", - "start": 2, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":2,"end":12,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":12}}, "method": false, "computed": true, "key": { "type": "Identifier", - "start": 3, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 4 - }, - "identifierName": "a" - }, + "start":3,"end":4,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":4},"identifierName":"a"}, "name": "a" }, "shorthand": false, "value": { "type": "ArrowFunctionExpression", - "start": 6, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":6,"end":12,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":12}}, "id": null, "generator": false, "async": false, "params": [], "body": { "type": "BlockStatement", - "start": 10, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":10,"end":12,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":12}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/esprima/expression-primary-object/migrated_0036/output.json b/packages/babel-parser/test/fixtures/esprima/expression-primary-object/migrated_0036/output.json index 8ecd159198d0..a5feee6475c2 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-primary-object/migrated_0036/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-primary-object/migrated_0036/output.json @@ -1,93 +1,27 @@ { "type": "File", - "start": 0, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, "program": { "type": "Program", - "start": 0, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, "expression": { "type": "ObjectExpression", - "start": 1, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":1,"end":35,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":35}}, "properties": [ { "type": "ObjectProperty", - "start": 2, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":2,"end":17,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":17}}, "method": false, "computed": true, "key": { "type": "StringLiteral", - "start": 3, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":3,"end":14,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":14}}, "extra": { "rawValue": "__proto__", "raw": "\"__proto__\"" @@ -97,18 +31,7 @@ "shorthand": false, "value": { "type": "NumericLiteral", - "start": 16, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":16,"end":17,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":17}}, "extra": { "rawValue": 0, "raw": "0" @@ -118,34 +41,12 @@ }, { "type": "ObjectProperty", - "start": 19, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":19,"end":34,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":34}}, "method": false, "computed": true, "key": { "type": "StringLiteral", - "start": 20, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":20,"end":31,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":31}}, "extra": { "rawValue": "__proto__", "raw": "\"__proto__\"" @@ -155,18 +56,7 @@ "shorthand": false, "value": { "type": "NumericLiteral", - "start": 33, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 33 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":33,"end":34,"loc":{"start":{"line":1,"column":33},"end":{"line":1,"column":34}}, "extra": { "rawValue": 0, "raw": "0" diff --git a/packages/babel-parser/test/fixtures/esprima/expression-primary-object/migrated_0037/output.json b/packages/babel-parser/test/fixtures/esprima/expression-primary-object/migrated_0037/output.json index 5fcc5ff585f6..ae075f3bcd74 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-primary-object/migrated_0037/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-primary-object/migrated_0037/output.json @@ -1,92 +1,26 @@ { "type": "File", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "program": { "type": "Program", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "expression": { "type": "ObjectExpression", - "start": 1, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":1,"end":10,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":10}}, "properties": [ { "type": "ObjectProperty", - "start": 2, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":2,"end":9,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":9}}, "method": false, "key": { "type": "StringLiteral", - "start": 2, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":2,"end":5,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":5}}, "extra": { "rawValue": "[", "raw": "\"[\"" @@ -97,18 +31,7 @@ "shorthand": false, "value": { "type": "NumericLiteral", - "start": 7, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":7,"end":9,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":9}}, "extra": { "rawValue": 42, "raw": "42" diff --git a/packages/babel-parser/test/fixtures/esprima/expression-primary-object/migrated_0038/output.json b/packages/babel-parser/test/fixtures/esprima/expression-primary-object/migrated_0038/output.json index 925deed2a00b..e7131fb94932 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-primary-object/migrated_0038/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-primary-object/migrated_0038/output.json @@ -1,93 +1,26 @@ { "type": "File", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "program": { "type": "Program", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "expression": { "type": "ObjectExpression", - "start": 1, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":1,"end":15,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":15}}, "properties": [ { "type": "ObjectMethod", - "start": 2, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":2,"end":14,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":14}}, "method": false, "key": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "x" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"x"}, "name": "x" }, "computed": false, @@ -98,49 +31,15 @@ "params": [ { "type": "AssignmentPattern", - "start": 8, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":8,"end":11,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":11}}, "left": { "type": "Identifier", - "start": 8, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "a" - }, + "start":8,"end":9,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":9},"identifierName":"a"}, "name": "a" }, "right": { "type": "NumericLiteral", - "start": 10, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11}}, "extra": { "rawValue": 0, "raw": "0" @@ -151,18 +50,7 @@ ], "body": { "type": "BlockStatement", - "start": 12, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":12,"end":14,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":14}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/esprima/expression-primary-other/migrated_0000/output.json b/packages/babel-parser/test/fixtures/esprima/expression-primary-other/migrated_0000/output.json index 1cf6441fffc6..066e56384368 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-primary-other/migrated_0000/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-primary-other/migrated_0000/output.json @@ -1,62 +1,18 @@ { "type": "File", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - }, + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, "program": { "type": "Program", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - }, + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - }, + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, "expression": { "type": "ThisExpression", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - } + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}} } } ], diff --git a/packages/babel-parser/test/fixtures/esprima/expression-primary-other/migrated_0001/output.json b/packages/babel-parser/test/fixtures/esprima/expression-primary-other/migrated_0001/output.json index 3d18314470cd..4bb0f76377fd 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-primary-other/migrated_0001/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-primary-other/migrated_0001/output.json @@ -1,62 +1,18 @@ { "type": "File", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - }, + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, "program": { "type": "Program", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - }, + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - }, + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, "expression": { "type": "NullLiteral", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - } + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}} } } ], diff --git a/packages/babel-parser/test/fixtures/esprima/expression-primary-other/migrated_0002/output.json b/packages/babel-parser/test/fixtures/esprima/expression-primary-other/migrated_0002/output.json index bf57e074ccea..ab48d0f9efad 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-primary-other/migrated_0002/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-primary-other/migrated_0002/output.json @@ -1,62 +1,18 @@ { "type": "File", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 6 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":6}}, "program": { "type": "Program", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 6 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":6}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 5, - "end": 7, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 6 - } - }, + "start":5,"end":7,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":6}}, "expression": { "type": "NumericLiteral", - "start": 5, - "end": 7, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 6 - } - }, + "start":5,"end":7,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":6}}, "extra": { "rawValue": 42, "raw": "42" diff --git a/packages/babel-parser/test/fixtures/esprima/expression-primary-other/migrated_0003/output.json b/packages/babel-parser/test/fixtures/esprima/expression-primary-other/migrated_0003/output.json index e05c37f12629..230f98af8a2e 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-primary-other/migrated_0003/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-primary-other/migrated_0003/output.json @@ -1,90 +1,24 @@ { "type": "File", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, "program": { "type": "Program", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, "expression": { "type": "BinaryExpression", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, "left": { "type": "BinaryExpression", - "start": 1, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":1,"end":6,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":6}}, "left": { "type": "NumericLiteral", - "start": 1, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - } - }, + "start":1,"end":2,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":2}}, "extra": { "rawValue": 1, "raw": "1" @@ -94,18 +28,7 @@ "operator": "+", "right": { "type": "NumericLiteral", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, "extra": { "rawValue": 2, "raw": "2" @@ -120,18 +43,7 @@ "operator": "*", "right": { "type": "NumericLiteral", - "start": 11, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":11,"end":12,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":12}}, "extra": { "rawValue": 3, "raw": "3" diff --git a/packages/babel-parser/test/fixtures/esprima/expression-relational/migrated_0000/output.json b/packages/babel-parser/test/fixtures/esprima/expression-relational/migrated_0000/output.json index da4b728c5eea..85ab5afc448b 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-relational/migrated_0000/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-relational/migrated_0000/output.json @@ -1,95 +1,27 @@ { "type": "File", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "program": { "type": "Program", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "expression": { "type": "BinaryExpression", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "operator": "<", "right": { "type": "Identifier", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "y" - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"y"}, "name": "y" } } diff --git a/packages/babel-parser/test/fixtures/esprima/expression-relational/migrated_0001/output.json b/packages/babel-parser/test/fixtures/esprima/expression-relational/migrated_0001/output.json index 7e1b9c51b14f..b6ecda2e0a59 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-relational/migrated_0001/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-relational/migrated_0001/output.json @@ -1,95 +1,27 @@ { "type": "File", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "program": { "type": "Program", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "expression": { "type": "BinaryExpression", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "operator": ">", "right": { "type": "Identifier", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "y" - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"y"}, "name": "y" } } diff --git a/packages/babel-parser/test/fixtures/esprima/expression-relational/migrated_0002/output.json b/packages/babel-parser/test/fixtures/esprima/expression-relational/migrated_0002/output.json index 0fb742510be3..75141bc2be24 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-relational/migrated_0002/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-relational/migrated_0002/output.json @@ -1,95 +1,27 @@ { "type": "File", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "program": { "type": "Program", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "expression": { "type": "BinaryExpression", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "operator": "<=", "right": { "type": "Identifier", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "y" - }, + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"y"}, "name": "y" } } diff --git a/packages/babel-parser/test/fixtures/esprima/expression-relational/migrated_0003/output.json b/packages/babel-parser/test/fixtures/esprima/expression-relational/migrated_0003/output.json index ad8dec06b08e..8276ce96fcd7 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-relational/migrated_0003/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-relational/migrated_0003/output.json @@ -1,95 +1,27 @@ { "type": "File", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "program": { "type": "Program", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "expression": { "type": "BinaryExpression", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "operator": ">=", "right": { "type": "Identifier", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "y" - }, + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"y"}, "name": "y" } } diff --git a/packages/babel-parser/test/fixtures/esprima/expression-relational/migrated_0004/output.json b/packages/babel-parser/test/fixtures/esprima/expression-relational/migrated_0004/output.json index bb04fff52615..bd09306d3cbe 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-relational/migrated_0004/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-relational/migrated_0004/output.json @@ -1,95 +1,27 @@ { "type": "File", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "program": { "type": "Program", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "expression": { "type": "BinaryExpression", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "operator": "in", "right": { "type": "Identifier", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "y" - }, + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"y"}, "name": "y" } } diff --git a/packages/babel-parser/test/fixtures/esprima/expression-relational/migrated_0005/output.json b/packages/babel-parser/test/fixtures/esprima/expression-relational/migrated_0005/output.json index 6dc11018bc6b..e636283e423e 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-relational/migrated_0005/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-relational/migrated_0005/output.json @@ -1,95 +1,27 @@ { "type": "File", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "program": { "type": "Program", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "expression": { "type": "BinaryExpression", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "operator": "instanceof", "right": { "type": "Identifier", - "start": 13, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - }, - "identifierName": "y" - }, + "start":13,"end":14,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":14},"identifierName":"y"}, "name": "y" } } diff --git a/packages/babel-parser/test/fixtures/esprima/expression-relational/migrated_0006/output.json b/packages/babel-parser/test/fixtures/esprima/expression-relational/migrated_0006/output.json index 03f750d1dffe..726d741dfc72 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-relational/migrated_0006/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-relational/migrated_0006/output.json @@ -1,128 +1,37 @@ { "type": "File", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "program": { "type": "Program", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "expression": { "type": "BinaryExpression", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "left": { "type": "BinaryExpression", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "operator": "<", "right": { "type": "Identifier", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "y" - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"y"}, "name": "y" } }, "operator": "<", "right": { "type": "Identifier", - "start": 8, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "z" - }, + "start":8,"end":9,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":9},"identifierName":"z"}, "name": "z" } } diff --git a/packages/babel-parser/test/fixtures/esprima/expression-unary/migrated_0000/output.json b/packages/babel-parser/test/fixtures/esprima/expression-unary/migrated_0000/output.json index 620fca404822..2b55f4dc54ce 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-unary/migrated_0000/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-unary/migrated_0000/output.json @@ -1,79 +1,23 @@ { "type": "File", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, "program": { "type": "Program", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, "expression": { "type": "UpdateExpression", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, "operator": "++", "prefix": true, "argument": { "type": "Identifier", - "start": 2, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 3 - }, - "identifierName": "x" - }, + "start":2,"end":3,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":3},"identifierName":"x"}, "name": "x" } } diff --git a/packages/babel-parser/test/fixtures/esprima/expression-unary/migrated_0001/output.json b/packages/babel-parser/test/fixtures/esprima/expression-unary/migrated_0001/output.json index 2179523b38b9..e9b595563644 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-unary/migrated_0001/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-unary/migrated_0001/output.json @@ -1,79 +1,23 @@ { "type": "File", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, "program": { "type": "Program", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, "expression": { "type": "UpdateExpression", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, "operator": "--", "prefix": true, "argument": { "type": "Identifier", - "start": 2, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 3 - }, - "identifierName": "x" - }, + "start":2,"end":3,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":3},"identifierName":"x"}, "name": "x" } } diff --git a/packages/babel-parser/test/fixtures/esprima/expression-unary/migrated_0002/output.json b/packages/babel-parser/test/fixtures/esprima/expression-unary/migrated_0002/output.json index 82b23bcc25bd..334ceaff24f8 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-unary/migrated_0002/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-unary/migrated_0002/output.json @@ -1,79 +1,23 @@ { "type": "File", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "program": { "type": "Program", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "expression": { "type": "UpdateExpression", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "operator": "++", "prefix": true, "argument": { "type": "Identifier", - "start": 2, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "eval" - }, + "start":2,"end":6,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":6},"identifierName":"eval"}, "name": "eval" } } diff --git a/packages/babel-parser/test/fixtures/esprima/expression-unary/migrated_0003/output.json b/packages/babel-parser/test/fixtures/esprima/expression-unary/migrated_0003/output.json index 88d60f45c549..d2960c20fba4 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-unary/migrated_0003/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-unary/migrated_0003/output.json @@ -1,79 +1,23 @@ { "type": "File", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "program": { "type": "Program", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "expression": { "type": "UpdateExpression", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "operator": "--", "prefix": true, "argument": { "type": "Identifier", - "start": 2, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "eval" - }, + "start":2,"end":6,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":6},"identifierName":"eval"}, "name": "eval" } } diff --git a/packages/babel-parser/test/fixtures/esprima/expression-unary/migrated_0004/output.json b/packages/babel-parser/test/fixtures/esprima/expression-unary/migrated_0004/output.json index 15827d111508..00218c0e04b4 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-unary/migrated_0004/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-unary/migrated_0004/output.json @@ -1,79 +1,23 @@ { "type": "File", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "program": { "type": "Program", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "expression": { "type": "UpdateExpression", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "operator": "++", "prefix": true, "argument": { "type": "Identifier", - "start": 2, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "arguments" - }, + "start":2,"end":11,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":11},"identifierName":"arguments"}, "name": "arguments" } } diff --git a/packages/babel-parser/test/fixtures/esprima/expression-unary/migrated_0005/output.json b/packages/babel-parser/test/fixtures/esprima/expression-unary/migrated_0005/output.json index e9f55cbe3989..f83d741ef5f7 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-unary/migrated_0005/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-unary/migrated_0005/output.json @@ -1,79 +1,23 @@ { "type": "File", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "program": { "type": "Program", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "expression": { "type": "UpdateExpression", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "operator": "--", "prefix": true, "argument": { "type": "Identifier", - "start": 2, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "arguments" - }, + "start":2,"end":11,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":11},"identifierName":"arguments"}, "name": "arguments" } } diff --git a/packages/babel-parser/test/fixtures/esprima/expression-unary/migrated_0006/output.json b/packages/babel-parser/test/fixtures/esprima/expression-unary/migrated_0006/output.json index fd8b54221703..f8707b901884 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-unary/migrated_0006/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-unary/migrated_0006/output.json @@ -1,79 +1,23 @@ { "type": "File", - "start": 0, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 2 - } - }, + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}}, "program": { "type": "Program", - "start": 0, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 2 - } - }, + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 2 - } - }, + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}}, "expression": { "type": "UnaryExpression", - "start": 0, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 2 - } - }, + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}}, "operator": "+", "prefix": true, "argument": { "type": "Identifier", - "start": 1, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - }, - "identifierName": "x" - }, + "start":1,"end":2,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":2},"identifierName":"x"}, "name": "x" } } diff --git a/packages/babel-parser/test/fixtures/esprima/expression-unary/migrated_0007/output.json b/packages/babel-parser/test/fixtures/esprima/expression-unary/migrated_0007/output.json index 00936f4b0f7e..cee848a92aed 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-unary/migrated_0007/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-unary/migrated_0007/output.json @@ -1,79 +1,23 @@ { "type": "File", - "start": 0, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 2 - } - }, + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}}, "program": { "type": "Program", - "start": 0, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 2 - } - }, + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 2 - } - }, + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}}, "expression": { "type": "UnaryExpression", - "start": 0, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 2 - } - }, + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}}, "operator": "-", "prefix": true, "argument": { "type": "Identifier", - "start": 1, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - }, - "identifierName": "x" - }, + "start":1,"end":2,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":2},"identifierName":"x"}, "name": "x" } } diff --git a/packages/babel-parser/test/fixtures/esprima/expression-unary/migrated_0008/output.json b/packages/babel-parser/test/fixtures/esprima/expression-unary/migrated_0008/output.json index 533a669dfc98..38ba1fbd5d15 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-unary/migrated_0008/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-unary/migrated_0008/output.json @@ -1,79 +1,23 @@ { "type": "File", - "start": 0, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 2 - } - }, + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}}, "program": { "type": "Program", - "start": 0, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 2 - } - }, + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 2 - } - }, + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}}, "expression": { "type": "UnaryExpression", - "start": 0, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 2 - } - }, + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}}, "operator": "~", "prefix": true, "argument": { "type": "Identifier", - "start": 1, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - }, - "identifierName": "x" - }, + "start":1,"end":2,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":2},"identifierName":"x"}, "name": "x" } } diff --git a/packages/babel-parser/test/fixtures/esprima/expression-unary/migrated_0009/output.json b/packages/babel-parser/test/fixtures/esprima/expression-unary/migrated_0009/output.json index b017ac4d4b08..37e26f32fe28 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-unary/migrated_0009/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-unary/migrated_0009/output.json @@ -1,79 +1,23 @@ { "type": "File", - "start": 0, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 2 - } - }, + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}}, "program": { "type": "Program", - "start": 0, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 2 - } - }, + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 2 - } - }, + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}}, "expression": { "type": "UnaryExpression", - "start": 0, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 2 - } - }, + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}}, "operator": "!", "prefix": true, "argument": { "type": "Identifier", - "start": 1, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - }, - "identifierName": "x" - }, + "start":1,"end":2,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":2},"identifierName":"x"}, "name": "x" } } diff --git a/packages/babel-parser/test/fixtures/esprima/expression-unary/migrated_0010/output.json b/packages/babel-parser/test/fixtures/esprima/expression-unary/migrated_0010/output.json index 4a0bf74a8a4f..eb5d31ccb83e 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-unary/migrated_0010/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-unary/migrated_0010/output.json @@ -1,79 +1,23 @@ { "type": "File", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "program": { "type": "Program", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "expression": { "type": "UnaryExpression", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "operator": "void", "prefix": true, "argument": { "type": "Identifier", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "x" - }, + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"x"}, "name": "x" } } diff --git a/packages/babel-parser/test/fixtures/esprima/expression-unary/migrated_0011/output.json b/packages/babel-parser/test/fixtures/esprima/expression-unary/migrated_0011/output.json index add0b1fc84de..96c7f5c02425 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-unary/migrated_0011/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-unary/migrated_0011/output.json @@ -1,79 +1,23 @@ { "type": "File", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, "program": { "type": "Program", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, "expression": { "type": "UnaryExpression", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, "operator": "delete", "prefix": true, "argument": { "type": "Identifier", - "start": 7, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - }, - "identifierName": "x" - }, + "start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8},"identifierName":"x"}, "name": "x" } } diff --git a/packages/babel-parser/test/fixtures/esprima/expression-unary/migrated_0012/output.json b/packages/babel-parser/test/fixtures/esprima/expression-unary/migrated_0012/output.json index db311ef3bbf3..b42af7e2ffa1 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-unary/migrated_0012/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-unary/migrated_0012/output.json @@ -1,79 +1,23 @@ { "type": "File", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, "program": { "type": "Program", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, "expression": { "type": "UnaryExpression", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, "operator": "typeof", "prefix": true, "argument": { "type": "Identifier", - "start": 7, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - }, - "identifierName": "x" - }, + "start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8},"identifierName":"x"}, "name": "x" } } diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/GH-1106-00/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/GH-1106-00/options.json deleted file mode 100644 index 8e0dce66eff8..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/GH-1106-00/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Bad character escape sequence (1:3)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/GH-1106-00/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/GH-1106-00/output.json new file mode 100644 index 000000000000..88942a742b03 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/GH-1106-00/output.json @@ -0,0 +1,29 @@ +{ + "type": "File", + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, + "errors": [ + "SyntaxError: Bad character escape sequence (1:3)" + ], + "program": { + "type": "Program", + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, + "sourceType": "script", + "interpreter": null, + "body": [], + "directives": [ + { + "type": "Directive", + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, + "value": { + "type": "DirectiveLiteral", + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, + "value": "\\x", + "extra": { + "raw": "\"\\x\"", + "rawValue": "\\x" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/GH-1106-01/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/GH-1106-01/options.json deleted file mode 100644 index 8e0dce66eff8..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/GH-1106-01/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Bad character escape sequence (1:3)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/GH-1106-01/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/GH-1106-01/output.json new file mode 100644 index 000000000000..f306e9f02374 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/GH-1106-01/output.json @@ -0,0 +1,29 @@ +{ + "type": "File", + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, + "errors": [ + "SyntaxError: Bad character escape sequence (1:3)" + ], + "program": { + "type": "Program", + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, + "sourceType": "script", + "interpreter": null, + "body": [], + "directives": [ + { + "type": "Directive", + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, + "value": { + "type": "DirectiveLiteral", + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, + "value": "\\x0", + "extra": { + "raw": "\"\\x0\"", + "rawValue": "\\x0" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/GH-1106-02/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/GH-1106-02/options.json deleted file mode 100644 index 8e0dce66eff8..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/GH-1106-02/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Bad character escape sequence (1:3)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/GH-1106-02/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/GH-1106-02/output.json new file mode 100644 index 000000000000..c25ed8c8341b --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/GH-1106-02/output.json @@ -0,0 +1,29 @@ +{ + "type": "File", + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, + "errors": [ + "SyntaxError: Bad character escape sequence (1:3)" + ], + "program": { + "type": "Program", + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, + "sourceType": "script", + "interpreter": null, + "body": [], + "directives": [ + { + "type": "Directive", + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, + "value": { + "type": "DirectiveLiteral", + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, + "value": "\\xx", + "extra": { + "raw": "\"\\xx\"", + "rawValue": "\\xx" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/GH-1106-03/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/GH-1106-03/options.json deleted file mode 100644 index 8e0dce66eff8..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/GH-1106-03/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Bad character escape sequence (1:3)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/GH-1106-03/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/GH-1106-03/output.json new file mode 100644 index 000000000000..a9e327e586d0 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/GH-1106-03/output.json @@ -0,0 +1,29 @@ +{ + "type": "File", + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, + "errors": [ + "SyntaxError: Bad character escape sequence (1:3)" + ], + "program": { + "type": "Program", + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, + "sourceType": "script", + "interpreter": null, + "body": [], + "directives": [ + { + "type": "Directive", + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, + "value": { + "type": "DirectiveLiteral", + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, + "value": "\\u", + "extra": { + "raw": "\"\\u\"", + "rawValue": "\\u" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/GH-1106-04/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/GH-1106-04/options.json deleted file mode 100644 index 8e0dce66eff8..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/GH-1106-04/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Bad character escape sequence (1:3)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/GH-1106-04/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/GH-1106-04/output.json new file mode 100644 index 000000000000..93cf7ff8ffba --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/GH-1106-04/output.json @@ -0,0 +1,29 @@ +{ + "type": "File", + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, + "errors": [ + "SyntaxError: Bad character escape sequence (1:3)" + ], + "program": { + "type": "Program", + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, + "sourceType": "script", + "interpreter": null, + "body": [], + "directives": [ + { + "type": "Directive", + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, + "value": { + "type": "DirectiveLiteral", + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, + "value": "\\u0", + "extra": { + "raw": "\"\\u0\"", + "rawValue": "\\u0" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/GH-1106-05/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/GH-1106-05/options.json deleted file mode 100644 index 8e0dce66eff8..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/GH-1106-05/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Bad character escape sequence (1:3)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/GH-1106-05/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/GH-1106-05/output.json new file mode 100644 index 000000000000..0964301530d5 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/GH-1106-05/output.json @@ -0,0 +1,29 @@ +{ + "type": "File", + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, + "errors": [ + "SyntaxError: Bad character escape sequence (1:3)" + ], + "program": { + "type": "Program", + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, + "sourceType": "script", + "interpreter": null, + "body": [], + "directives": [ + { + "type": "Directive", + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, + "value": { + "type": "DirectiveLiteral", + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, + "value": "\\ux", + "extra": { + "raw": "\"\\ux\"", + "rawValue": "\\ux" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/GH-1106-06/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/GH-1106-06/options.json deleted file mode 100644 index 8e0dce66eff8..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/GH-1106-06/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Bad character escape sequence (1:3)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/GH-1106-06/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/GH-1106-06/output.json new file mode 100644 index 000000000000..9d296488f002 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/GH-1106-06/output.json @@ -0,0 +1,29 @@ +{ + "type": "File", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "errors": [ + "SyntaxError: Bad character escape sequence (1:3)" + ], + "program": { + "type": "Program", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "sourceType": "script", + "interpreter": null, + "body": [], + "directives": [ + { + "type": "Directive", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "value": { + "type": "DirectiveLiteral", + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, + "value": "\\u00", + "extra": { + "raw": "\"\\u00\"", + "rawValue": "\\u00" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/GH-1106-07/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/GH-1106-07/options.json deleted file mode 100644 index 8e0dce66eff8..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/GH-1106-07/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Bad character escape sequence (1:3)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/GH-1106-07/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/GH-1106-07/output.json new file mode 100644 index 000000000000..667e2055d9f2 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/GH-1106-07/output.json @@ -0,0 +1,29 @@ +{ + "type": "File", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "errors": [ + "SyntaxError: Bad character escape sequence (1:3)" + ], + "program": { + "type": "Program", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "sourceType": "script", + "interpreter": null, + "body": [], + "directives": [ + { + "type": "Directive", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "value": { + "type": "DirectiveLiteral", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "value": "\\u000", + "extra": { + "raw": "\"\\u000\"", + "rawValue": "\\u000" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0002/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0002/options.json index 91bb1eef0c0d..ee18527964e7 100644 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0002/options.json +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0002/options.json @@ -1,3 +1,3 @@ { - "throws": "Invalid number (1:0)" + "throws": "Identifier directly after number (1:2)" } diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0004/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0004/options.json deleted file mode 100644 index 91bb1eef0c0d..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0004/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid number (1:0)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0004/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0004/output.json new file mode 100644 index 000000000000..b2d2e40318a4 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0004/output.json @@ -0,0 +1,29 @@ +{ + "type": "File", + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}}, + "errors": [ + "SyntaxError: Invalid number (1:0)" + ], + "program": { + "type": "Program", + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}}, + "expression": { + "type": "NumericLiteral", + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}}, + "extra": { + "rawValue": 3, + "raw": "3e" + }, + "value": 3 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0005/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0005/options.json deleted file mode 100644 index 91bb1eef0c0d..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0005/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid number (1:0)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0005/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0005/output.json new file mode 100644 index 000000000000..1591ec979e44 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0005/output.json @@ -0,0 +1,29 @@ +{ + "type": "File", + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, + "errors": [ + "SyntaxError: Invalid number (1:0)" + ], + "program": { + "type": "Program", + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, + "expression": { + "type": "NumericLiteral", + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, + "extra": { + "rawValue": 3, + "raw": "3e+" + }, + "value": 3 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0006/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0006/options.json deleted file mode 100644 index 91bb1eef0c0d..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0006/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid number (1:0)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0006/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0006/output.json new file mode 100644 index 000000000000..42c6c5a67aff --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0006/output.json @@ -0,0 +1,29 @@ +{ + "type": "File", + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, + "errors": [ + "SyntaxError: Invalid number (1:0)" + ], + "program": { + "type": "Program", + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, + "expression": { + "type": "NumericLiteral", + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, + "extra": { + "rawValue": 3, + "raw": "3e-" + }, + "value": 3 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0009/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0009/options.json deleted file mode 100644 index 1a0693338eee..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0009/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Expected number in radix 16 (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0009/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0009/output.json new file mode 100644 index 000000000000..9a1a7ea60803 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0009/output.json @@ -0,0 +1,29 @@ +{ + "type": "File", + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}}, + "errors": [ + "SyntaxError: Expected number in radix 16 (1:2)" + ], + "program": { + "type": "Program", + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}}, + "expression": { + "type": "NumericLiteral", + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}}, + "extra": { + "rawValue": null, + "raw": "0x" + }, + "value": null + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0012/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0012/options.json deleted file mode 100644 index 3f09c36a5f1c..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0012/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Expected number in radix 8 (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0012/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0012/output.json new file mode 100644 index 000000000000..a880531bce85 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0012/output.json @@ -0,0 +1,29 @@ +{ + "type": "File", + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}}, + "errors": [ + "SyntaxError: Expected number in radix 8 (1:2)" + ], + "program": { + "type": "Program", + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}}, + "expression": { + "type": "NumericLiteral", + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}}, + "extra": { + "rawValue": null, + "raw": "0o" + }, + "value": null + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0013/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0013/options.json deleted file mode 100644 index 3f09c36a5f1c..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0013/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Expected number in radix 8 (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0013/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0013/output.json new file mode 100644 index 000000000000..91dec1a23074 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0013/output.json @@ -0,0 +1,29 @@ +{ + "type": "File", + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}}, + "errors": [ + "SyntaxError: Expected number in radix 8 (1:2)" + ], + "program": { + "type": "Program", + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}}, + "expression": { + "type": "NumericLiteral", + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}}, + "extra": { + "rawValue": null, + "raw": "0O" + }, + "value": null + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0014/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0014/options.json deleted file mode 100644 index 3f09c36a5f1c..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0014/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Expected number in radix 8 (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0014/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0014/output.json new file mode 100644 index 000000000000..42696d4924d6 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0014/output.json @@ -0,0 +1,29 @@ +{ + "type": "File", + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, + "errors": [ + "SyntaxError: Expected number in radix 8 (1:2)" + ], + "program": { + "type": "Program", + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, + "expression": { + "type": "NumericLiteral", + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, + "extra": { + "rawValue": 0, + "raw": "0o9" + }, + "value": 0 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0015/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0015/options.json deleted file mode 100644 index d52d9cfac4bc..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0015/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected token, expected \";\" (1:3)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0015/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0015/output.json new file mode 100644 index 000000000000..9ed93409bc00 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0015/output.json @@ -0,0 +1,29 @@ +{ + "type": "File", + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, + "errors": [ + "SyntaxError: Expected number in radix 8 (1:3)" + ], + "program": { + "type": "Program", + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, + "expression": { + "type": "NumericLiteral", + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, + "extra": { + "rawValue": 8, + "raw": "0o18" + }, + "value": 8 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0017/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0017/options.json deleted file mode 100644 index 40dc3da9a8f4..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0017/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Expected number in radix 2 (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0017/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0017/output.json new file mode 100644 index 000000000000..bd3bd49916b3 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0017/output.json @@ -0,0 +1,29 @@ +{ + "type": "File", + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}}, + "errors": [ + "SyntaxError: Expected number in radix 2 (1:2)" + ], + "program": { + "type": "Program", + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}}, + "expression": { + "type": "NumericLiteral", + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}}, + "extra": { + "rawValue": null, + "raw": "0b" + }, + "value": null + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0019/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0019/options.json deleted file mode 100644 index 40dc3da9a8f4..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0019/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Expected number in radix 2 (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0019/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0019/output.json new file mode 100644 index 000000000000..fabbead51492 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0019/output.json @@ -0,0 +1,29 @@ +{ + "type": "File", + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, + "errors": [ + "SyntaxError: Expected number in radix 2 (1:2)" + ], + "program": { + "type": "Program", + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, + "expression": { + "type": "NumericLiteral", + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, + "extra": { + "rawValue": 0, + "raw": "0b9" + }, + "value": 0 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0020/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0020/options.json deleted file mode 100644 index d52d9cfac4bc..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0020/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected token, expected \";\" (1:3)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0020/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0020/output.json new file mode 100644 index 000000000000..c90afe1734e6 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0020/output.json @@ -0,0 +1,29 @@ +{ + "type": "File", + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, + "errors": [ + "SyntaxError: Expected number in radix 2 (1:3)" + ], + "program": { + "type": "Program", + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, + "expression": { + "type": "NumericLiteral", + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, + "extra": { + "rawValue": 2, + "raw": "0b18" + }, + "value": 2 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0021/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0021/options.json deleted file mode 100644 index d52d9cfac4bc..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0021/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected token, expected \";\" (1:3)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0021/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0021/output.json new file mode 100644 index 000000000000..2b8e4f22be33 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0021/output.json @@ -0,0 +1,29 @@ +{ + "type": "File", + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, + "errors": [ + "SyntaxError: Expected number in radix 2 (1:3)" + ], + "program": { + "type": "Program", + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, + "expression": { + "type": "NumericLiteral", + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, + "extra": { + "rawValue": 2, + "raw": "0b12" + }, + "value": 2 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0022/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0022/options.json deleted file mode 100644 index 40dc3da9a8f4..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0022/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Expected number in radix 2 (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0022/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0022/output.json new file mode 100644 index 000000000000..6cfde9edb3b5 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0022/output.json @@ -0,0 +1,29 @@ +{ + "type": "File", + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}}, + "errors": [ + "SyntaxError: Expected number in radix 2 (1:2)" + ], + "program": { + "type": "Program", + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}}, + "expression": { + "type": "NumericLiteral", + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}}, + "extra": { + "rawValue": null, + "raw": "0B" + }, + "value": null + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0024/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0024/options.json deleted file mode 100644 index 40dc3da9a8f4..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0024/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Expected number in radix 2 (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0024/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0024/output.json new file mode 100644 index 000000000000..6e3728ace39b --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0024/output.json @@ -0,0 +1,29 @@ +{ + "type": "File", + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, + "errors": [ + "SyntaxError: Expected number in radix 2 (1:2)" + ], + "program": { + "type": "Program", + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, + "expression": { + "type": "NumericLiteral", + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, + "extra": { + "rawValue": 0, + "raw": "0B9" + }, + "value": 0 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0025/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0025/options.json deleted file mode 100644 index d52d9cfac4bc..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0025/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected token, expected \";\" (1:3)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0025/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0025/output.json new file mode 100644 index 000000000000..d5ba308d5906 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0025/output.json @@ -0,0 +1,29 @@ +{ + "type": "File", + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, + "errors": [ + "SyntaxError: Expected number in radix 2 (1:3)" + ], + "program": { + "type": "Program", + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, + "expression": { + "type": "NumericLiteral", + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, + "extra": { + "rawValue": 2, + "raw": "0B18" + }, + "value": 2 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0026/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0026/options.json deleted file mode 100644 index d52d9cfac4bc..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0026/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected token, expected \";\" (1:3)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0026/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0026/output.json new file mode 100644 index 000000000000..af38f05f89fa --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0026/output.json @@ -0,0 +1,29 @@ +{ + "type": "File", + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, + "errors": [ + "SyntaxError: Expected number in radix 2 (1:3)" + ], + "program": { + "type": "Program", + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, + "expression": { + "type": "NumericLiteral", + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, + "extra": { + "rawValue": 2, + "raw": "0B12" + }, + "value": 2 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0027/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0027/options.json deleted file mode 100644 index 3f09c36a5f1c..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0027/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Expected number in radix 8 (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0027/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0027/output.json new file mode 100644 index 000000000000..2fbc3ece3140 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0027/output.json @@ -0,0 +1,29 @@ +{ + "type": "File", + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, + "errors": [ + "SyntaxError: Expected number in radix 8 (1:2)" + ], + "program": { + "type": "Program", + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, + "expression": { + "type": "NumericLiteral", + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, + "extra": { + "rawValue": 0, + "raw": "0O9" + }, + "value": 0 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0028/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0028/options.json deleted file mode 100644 index d52d9cfac4bc..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0028/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected token, expected \";\" (1:3)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0028/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0028/output.json new file mode 100644 index 000000000000..4978bcf4e51b --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0028/output.json @@ -0,0 +1,29 @@ +{ + "type": "File", + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, + "errors": [ + "SyntaxError: Expected number in radix 8 (1:3)" + ], + "program": { + "type": "Program", + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, + "expression": { + "type": "NumericLiteral", + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, + "extra": { + "rawValue": 8, + "raw": "0O18" + }, + "value": 8 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0032/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0032/options.json deleted file mode 100644 index 18c53b997b56..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0032/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Expecting Unicode escape sequence \\uXXXX (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0032/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0032/output.json new file mode 100644 index 000000000000..5dd7b5d3fcd6 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0032/output.json @@ -0,0 +1,25 @@ +{ + "type": "File", + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}}, + "errors": [ + "SyntaxError: Expecting Unicode escape sequence \\uXXXX (1:2)" + ], + "program": { + "type": "Program", + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}}, + "expression": { + "type": "Identifier", + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2},"identifierName":"xx\\"}, + "name": "xx\\" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0033/input.js b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0033/input.js index fff580f2044f..0d9e932087f0 100644 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0033/input.js +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0033/input.js @@ -1 +1 @@ -x\\u005c +x\u005c diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0033/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0033/options.json deleted file mode 100644 index 18c53b997b56..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0033/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Expecting Unicode escape sequence \\uXXXX (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0033/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0033/output.json new file mode 100644 index 000000000000..d9a89994f01f --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0033/output.json @@ -0,0 +1,25 @@ +{ + "type": "File", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "errors": [ + "SyntaxError: Invalid Unicode escape (1:1)" + ], + "program": { + "type": "Program", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "expression": { + "type": "Identifier", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7},"identifierName":"x\\"}, + "name": "x\\" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0034/input.js b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0034/input.js index 17112246786b..2999f29197cd 100644 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0034/input.js +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0034/input.js @@ -1 +1 @@ -x\\u002a +x\u002a diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0034/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0034/options.json deleted file mode 100644 index 18c53b997b56..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0034/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Expecting Unicode escape sequence \\uXXXX (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0034/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0034/output.json new file mode 100644 index 000000000000..32180fcde928 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0034/output.json @@ -0,0 +1,25 @@ +{ + "type": "File", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "errors": [ + "SyntaxError: Invalid Unicode escape (1:1)" + ], + "program": { + "type": "Program", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "expression": { + "type": "Identifier", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7},"identifierName":"x*"}, + "name": "x*" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0036/input.js b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0036/input.js index 3177052a225a..9cfc5e1cb357 100644 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0036/input.js +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0036/input.js @@ -1 +1 @@ -a\\u +a\u diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0036/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0036/options.json deleted file mode 100644 index 18c53b997b56..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0036/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Expecting Unicode escape sequence \\uXXXX (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0036/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0036/output.json new file mode 100644 index 000000000000..f676471df15f --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0036/output.json @@ -0,0 +1,25 @@ +{ + "type": "File", + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, + "errors": [ + "SyntaxError: Bad character escape sequence (1:3)" + ], + "program": { + "type": "Program", + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, + "expression": { + "type": "Identifier", + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3},"identifierName":"a"}, + "name": "a" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0037/input.js b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0037/input.js index d56d7c190d02..fa959cc0ecce 100644 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0037/input.js +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0037/input.js @@ -1 +1 @@ -\\ua +\ua diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0037/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0037/options.json deleted file mode 100644 index 381fd12ce2d0..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0037/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Expecting Unicode escape sequence \\uXXXX (1:1)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0037/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0037/output.json new file mode 100644 index 000000000000..8bc86d6bda14 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0037/output.json @@ -0,0 +1,37 @@ +{ + "type": "File", + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, + "errors": [ + "SyntaxError: Bad character escape sequence (1:2)" + ], + "program": { + "type": "Program", + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, + "expression": { + "type": "Identifier", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + }, + "identifierName": "" + }, + "name": "" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0041/input.js b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0041/input.js index 9a2dc1767685..7f54fa707500 100644 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0041/input.js +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0041/input.js @@ -1 +1 @@ -var x = /[a-z]/\\ux +var x = /[a-z]/\ux diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0041/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0041/options.json deleted file mode 100644 index adf556b0a352..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0041/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid regular expression flag (1:16)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0041/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0041/output.json new file mode 100644 index 000000000000..d42d61f8a543 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0041/output.json @@ -0,0 +1,42 @@ +{ + "type": "File", + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, + "errors": [ + "SyntaxError: Invalid regular expression flag (1:16)", + "SyntaxError: Invalid regular expression flag (1:18)" + ], + "program": { + "type": "Program", + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":4,"end":18,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":18}}, + "id": { + "type": "Identifier", + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"x"}, + "name": "x" + }, + "init": { + "type": "RegExpLiteral", + "start":8,"end":18,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":18}}, + "extra": { + "raw": "/[a-z]/\\ux" + }, + "pattern": "[a-z]", + "flags": "\\ux" + } + } + ], + "kind": "var" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0042/input.js b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0042/input.js index fdbf86f1d023..e8f66bb867d1 100644 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0042/input.js +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0042/input.js @@ -1 +1 @@ -var x = /[a-z\n]/\\ux +var x = /[a-z\n]/\ux diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0042/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0042/options.json deleted file mode 100644 index eae3757f4451..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0042/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid regular expression flag (1:18)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0042/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0042/output.json new file mode 100644 index 000000000000..1e07f7e127f8 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0042/output.json @@ -0,0 +1,42 @@ +{ + "type": "File", + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, + "errors": [ + "SyntaxError: Invalid regular expression flag (1:18)", + "SyntaxError: Invalid regular expression flag (1:20)" + ], + "program": { + "type": "Program", + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":4,"end":20,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":20}}, + "id": { + "type": "Identifier", + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"x"}, + "name": "x" + }, + "init": { + "type": "RegExpLiteral", + "start":8,"end":20,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":20}}, + "extra": { + "raw": "/[a-z\\n]/\\ux" + }, + "pattern": "[a-z\\n]", + "flags": "\\ux" + } + } + ], + "kind": "var" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0043/input.js b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0043/input.js index e2a2d371e229..9a2dc1767685 100644 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0043/input.js +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0043/input.js @@ -1 +1 @@ -var x = /[a-z]/\\\\ux +var x = /[a-z]/\\ux diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0043/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0043/options.json deleted file mode 100644 index adf556b0a352..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0043/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid regular expression flag (1:16)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0043/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0043/output.json new file mode 100644 index 000000000000..471a965aa78c --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0043/output.json @@ -0,0 +1,43 @@ +{ + "type": "File", + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, + "errors": [ + "SyntaxError: Invalid regular expression flag (1:16)", + "SyntaxError: Invalid regular expression flag (1:17)", + "SyntaxError: Invalid regular expression flag (1:19)" + ], + "program": { + "type": "Program", + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":4,"end":19,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":19}}, + "id": { + "type": "Identifier", + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"x"}, + "name": "x" + }, + "init": { + "type": "RegExpLiteral", + "start":8,"end":19,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":19}}, + "extra": { + "raw": "/[a-z]/\\\\ux" + }, + "pattern": "[a-z]", + "flags": "\\\\ux" + } + } + ], + "kind": "var" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0044/input.js b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0044/input.js index fc48dffd74dc..405b48568aa8 100644 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0044/input.js +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0044/input.js @@ -1 +1 @@ -var x = /[P QR]/\\\\u0067 +var x = /[P QR]/\\u0067 diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0044/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0044/options.json deleted file mode 100644 index 080cb0eaaa8a..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0044/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid regular expression flag (1:17)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0044/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0044/output.json new file mode 100644 index 000000000000..c783115307d9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0044/output.json @@ -0,0 +1,46 @@ +{ + "type": "File", + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, + "errors": [ + "SyntaxError: Invalid regular expression flag (1:17)", + "SyntaxError: Invalid regular expression flag (1:18)", + "SyntaxError: Invalid regular expression flag (1:20)", + "SyntaxError: Invalid regular expression flag (1:21)", + "SyntaxError: Invalid regular expression flag (1:22)", + "SyntaxError: Invalid regular expression flag (1:23)" + ], + "program": { + "type": "Program", + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":4,"end":23,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":23}}, + "id": { + "type": "Identifier", + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"x"}, + "name": "x" + }, + "init": { + "type": "RegExpLiteral", + "start":8,"end":23,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":23}}, + "extra": { + "raw": "/[P QR]/\\\\u0067" + }, + "pattern": "[P QR]", + "flags": "\\\\u0067" + } + } + ], + "kind": "var" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0045/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0045/options.json deleted file mode 100644 index 6010e96ed144..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0045/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid left-hand side in assignment expression (1:0)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0045/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0045/output.json new file mode 100644 index 000000000000..d4d2cf5dfe67 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0045/output.json @@ -0,0 +1,43 @@ +{ + "type": "File", + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, + "errors": [ + "SyntaxError: Invalid left-hand side in assignment expression (1:0)" + ], + "program": { + "type": "Program", + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, + "expression": { + "type": "AssignmentExpression", + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, + "operator": "=", + "left": { + "type": "NumericLiteral", + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1}}, + "extra": { + "rawValue": 3, + "raw": "3" + }, + "value": 3 + }, + "right": { + "type": "NumericLiteral", + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5}}, + "extra": { + "rawValue": 4, + "raw": "4" + }, + "value": 4 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0046/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0046/options.json deleted file mode 100644 index 6010e96ed144..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0046/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid left-hand side in assignment expression (1:0)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0046/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0046/output.json new file mode 100644 index 000000000000..edc325840380 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0046/output.json @@ -0,0 +1,44 @@ +{ + "type": "File", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "errors": [ + "SyntaxError: Invalid left-hand side in assignment expression (1:0)" + ], + "program": { + "type": "Program", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "expression": { + "type": "AssignmentExpression", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "operator": "=", + "left": { + "type": "CallExpression", + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, + "callee": { + "type": "Identifier", + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4},"identifierName":"func"}, + "name": "func" + }, + "arguments": [] + }, + "right": { + "type": "NumericLiteral", + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10}}, + "extra": { + "rawValue": 4, + "raw": "4" + }, + "value": 4 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0047/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0047/options.json deleted file mode 100644 index 7c5f08eb9ba6..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0047/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid left-hand side in assignment expression (1:1)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0047/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0047/output.json new file mode 100644 index 000000000000..46112c6c8828 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0047/output.json @@ -0,0 +1,62 @@ +{ + "type": "File", + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "errors": [ + "SyntaxError: Invalid parenthesized assignment pattern (1:1)", + "SyntaxError: Invalid left-hand side in assignment expression (1:1)" + ], + "program": { + "type": "Program", + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "expression": { + "type": "AssignmentExpression", + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "operator": "=", + "left": { + "type": "BinaryExpression", + "start":1,"end":6,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":6}}, + "left": { + "type": "NumericLiteral", + "start":1,"end":2,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":2}}, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + }, + "operator": "+", + "right": { + "type": "NumericLiteral", + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + }, + "extra": { + "parenthesized": true, + "parenStart": 0 + } + }, + "right": { + "type": "NumericLiteral", + "start":10,"end":12,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":12}}, + "extra": { + "rawValue": 10, + "raw": "10" + }, + "value": 10 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0048/input.js b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0048/input.js index 2bbf7ac4d47c..1d1226dada02 100644 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0048/input.js +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0048/input.js @@ -1 +1 @@ -\\u{110000} +\u{110000} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0048/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0048/options.json index 381fd12ce2d0..0cefc1094055 100644 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0048/options.json +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0048/options.json @@ -1,3 +1,3 @@ { - "throws": "Expecting Unicode escape sequence \\uXXXX (1:1)" + "throws": "Invalid code point 1114112" } diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0049/input.js b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0049/input.js index 9943cc7906a5..aabe8d74272e 100644 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0049/input.js +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0049/input.js @@ -1 +1 @@ -\\u{} +\u{} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0049/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0049/options.json deleted file mode 100644 index 381fd12ce2d0..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0049/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Expecting Unicode escape sequence \\uXXXX (1:1)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0049/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0049/output.json new file mode 100644 index 000000000000..53070d6b82ec --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0049/output.json @@ -0,0 +1,37 @@ +{ + "type": "File", + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, + "errors": [ + "SyntaxError: Bad character escape sequence (1:3)" + ], + "program": { + "type": "Program", + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, + "expression": { + "type": "Identifier", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + }, + "identifierName": "" + }, + "name": "" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0050/input.js b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0050/input.js index 5d4f24cb8271..170edba55da6 100644 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0050/input.js +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0050/input.js @@ -1 +1 @@ -\\u{FFFF +\u{FFFF diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0050/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0050/options.json deleted file mode 100644 index 381fd12ce2d0..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0050/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Expecting Unicode escape sequence \\uXXXX (1:1)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0050/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0050/output.json new file mode 100644 index 000000000000..b43e07489eca --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0050/output.json @@ -0,0 +1,25 @@ +{ + "type": "File", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "errors": [ + "SyntaxError: Bad character escape sequence (1:3)" + ], + "program": { + "type": "Program", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "expression": { + "type": "Identifier", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7},"identifierName":"FFF"}, + "name": "FFF" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0051/input.js b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0051/input.js index 11e05c81c1e8..0c65088d077b 100644 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0051/input.js +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0051/input.js @@ -1 +1 @@ -\\u{FFZ} +\u{FFZ} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0051/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0051/options.json deleted file mode 100644 index 381fd12ce2d0..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0051/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Expecting Unicode escape sequence \\uXXXX (1:1)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0051/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0051/output.json new file mode 100644 index 000000000000..ff97ec8233c7 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0051/output.json @@ -0,0 +1,37 @@ +{ + "type": "File", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "errors": [ + "SyntaxError: Bad character escape sequence (1:3)" + ], + "program": { + "type": "Program", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "expression": { + "type": "Identifier", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "" + }, + "name": "" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0052/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0052/options.json deleted file mode 100644 index c09dac1301de..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0052/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid left-hand side in postfix operation (1:0)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0052/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0052/output.json new file mode 100644 index 000000000000..89b9c579fa1c --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0052/output.json @@ -0,0 +1,35 @@ +{ + "type": "File", + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, + "errors": [ + "SyntaxError: Invalid left-hand side in postfix operation (1:0)" + ], + "program": { + "type": "Program", + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, + "expression": { + "type": "UpdateExpression", + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, + "operator": "++", + "prefix": false, + "argument": { + "type": "NumericLiteral", + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1}}, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0053/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0053/options.json deleted file mode 100644 index c09dac1301de..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0053/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid left-hand side in postfix operation (1:0)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0053/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0053/output.json new file mode 100644 index 000000000000..b0387fd4ff59 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0053/output.json @@ -0,0 +1,35 @@ +{ + "type": "File", + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, + "errors": [ + "SyntaxError: Invalid left-hand side in postfix operation (1:0)" + ], + "program": { + "type": "Program", + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, + "expression": { + "type": "UpdateExpression", + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, + "operator": "--", + "prefix": false, + "argument": { + "type": "NumericLiteral", + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1}}, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0054/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0054/options.json deleted file mode 100644 index 515e441e8ea7..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0054/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid left-hand side in prefix operation (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0054/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0054/output.json new file mode 100644 index 000000000000..e86e86ca2246 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0054/output.json @@ -0,0 +1,35 @@ +{ + "type": "File", + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, + "errors": [ + "SyntaxError: Invalid left-hand side in prefix operation (1:2)" + ], + "program": { + "type": "Program", + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, + "expression": { + "type": "UpdateExpression", + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, + "operator": "++", + "prefix": true, + "argument": { + "type": "NumericLiteral", + "start":2,"end":3,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":3}}, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0055/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0055/options.json deleted file mode 100644 index 515e441e8ea7..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0055/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid left-hand side in prefix operation (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0055/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0055/output.json new file mode 100644 index 000000000000..de49f7815bd2 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0055/output.json @@ -0,0 +1,35 @@ +{ + "type": "File", + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, + "errors": [ + "SyntaxError: Invalid left-hand side in prefix operation (1:2)" + ], + "program": { + "type": "Program", + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, + "expression": { + "type": "UpdateExpression", + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, + "operator": "--", + "prefix": true, + "argument": { + "type": "NumericLiteral", + "start":2,"end":3,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":3}}, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0056/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0056/options.json deleted file mode 100644 index f8560a7de9d6..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0056/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid left-hand side in for-in statement (1:5)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0056/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0056/output.json new file mode 100644 index 000000000000..609aed8d6228 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0056/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, + "errors": [ + "SyntaxError: Invalid parenthesized assignment pattern (1:5)", + "SyntaxError: Invalid left-hand side in for-in statement (1:5)" + ], + "program": { + "type": "Program", + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ForInStatement", + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, + "left": { + "type": "BinaryExpression", + "start":5,"end":10,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":10}}, + "left": { + "type": "NumericLiteral", + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + }, + "operator": "+", + "right": { + "type": "NumericLiteral", + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10}}, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + }, + "extra": { + "parenthesized": true, + "parenStart": 4 + } + }, + "right": { + "type": "Identifier", + "start":15,"end":19,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":19},"identifierName":"list"}, + "name": "list" + }, + "body": { + "type": "ExpressionStatement", + "start":21,"end":32,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":32}}, + "expression": { + "type": "CallExpression", + "start":21,"end":31,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":31}}, + "callee": { + "type": "Identifier", + "start":21,"end":28,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":28},"identifierName":"process"}, + "name": "process" + }, + "arguments": [ + { + "type": "Identifier", + "start":29,"end":30,"loc":{"start":{"line":1,"column":29},"end":{"line":1,"column":30},"identifierName":"x"}, + "name": "x" + } + ] + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0064/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0064/options.json deleted file mode 100644 index 2b91be8d5115..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0064/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected keyword 'if' (1:4)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0064/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0064/output.json new file mode 100644 index 000000000000..71a10a5324e9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0064/output.json @@ -0,0 +1,41 @@ +{ + "type": "File", + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "errors": [ + "SyntaxError: Unexpected keyword 'if' (1:4)" + ], + "program": { + "type": "Program", + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":4,"end":11,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":11}}, + "id": { + "type": "Identifier", + "start":4,"end":6,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":6},"identifierName":"if"}, + "name": "if" + }, + "init": { + "type": "NumericLiteral", + "start":9,"end":11,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":11}}, + "extra": { + "rawValue": 42, + "raw": "42" + }, + "value": 42 + } + } + ], + "kind": "var" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0065/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0065/options.json index 895412e4e5f7..ff1ac8247e68 100644 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0065/options.json +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0065/options.json @@ -1,3 +1,3 @@ { - "throws": "Unexpected character '#' (1:2)" -} + "throws": "Unexpected token, expected \";\" (1:2)" +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0066/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0066/options.json deleted file mode 100644 index 6010e96ed144..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0066/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid left-hand side in assignment expression (1:0)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0066/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0066/output.json new file mode 100644 index 000000000000..62e99551071a --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0066/output.json @@ -0,0 +1,53 @@ +{ + "type": "File", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "errors": [ + "SyntaxError: Invalid left-hand side in assignment expression (1:0)" + ], + "program": { + "type": "Program", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "expression": { + "type": "AssignmentExpression", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "operator": "=", + "left": { + "type": "BinaryExpression", + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, + "left": { + "type": "Identifier", + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"i"}, + "name": "i" + }, + "operator": "+", + "right": { + "type": "NumericLiteral", + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5}}, + "extra": { + "rawValue": 2, + "raw": "2" + }, + "value": 2 + } + }, + "right": { + "type": "NumericLiteral", + "start":8,"end":10,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":10}}, + "extra": { + "rawValue": 42, + "raw": "42" + }, + "value": 42 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0067/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0067/options.json deleted file mode 100644 index 6010e96ed144..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0067/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid left-hand side in assignment expression (1:0)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0067/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0067/output.json new file mode 100644 index 000000000000..ba27c1c609ba --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0067/output.json @@ -0,0 +1,45 @@ +{ + "type": "File", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "errors": [ + "SyntaxError: Invalid left-hand side in assignment expression (1:0)" + ], + "program": { + "type": "Program", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "expression": { + "type": "AssignmentExpression", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "operator": "=", + "left": { + "type": "UnaryExpression", + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}}, + "operator": "+", + "prefix": true, + "argument": { + "type": "Identifier", + "start":1,"end":2,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":2},"identifierName":"i"}, + "name": "i" + } + }, + "right": { + "type": "NumericLiteral", + "start":5,"end":7,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":7}}, + "extra": { + "rawValue": 42, + "raw": "42" + }, + "value": 42 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0075/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0075/options.json index aa55ec4f840f..070d941a7562 100644 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0075/options.json +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0075/options.json @@ -1,3 +1,3 @@ { - "throws": "setter must have exactly one formal parameter (1:3)" + "plugins": ["estree"] } diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0075/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0075/output.json new file mode 100644 index 000000000000..d704a0cb48a6 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0075/output.json @@ -0,0 +1,56 @@ +{ + "type": "File", + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, + "errors": [ + "SyntaxError: setter must have exactly one formal parameter (1:3)" + ], + "program": { + "type": "Program", + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, + "expression": { + "type": "ObjectExpression", + "start":1,"end":16,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":16}}, + "properties": [ + { + "type": "Property", + "start":3,"end":14,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":14}}, + "method": false, + "key": { + "type": "Identifier", + "start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8},"identifierName":"s"}, + "name": "s" + }, + "computed": false, + "kind": "set", + "value": { + "type": "FunctionExpression", + "start":8,"end":14,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":14}}, + "id": null, + "generator": false, + "async": false, + "expression": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":11,"end":14,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":14}}, + "body": [] + } + }, + "shorthand": false + } + ], + "extra": { + "parenthesized": true, + "parenStart": 0 + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0087/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0087/options.json deleted file mode 100644 index 02a0eafbbbbe..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0087/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Assigning to 'eval' in strict mode (1:15)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0087/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0087/output.json new file mode 100644 index 000000000000..cca401d0d14b --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0087/output.json @@ -0,0 +1,71 @@ +{ + "type": "File", + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, + "errors": [ + "SyntaxError: Assigning to 'eval' in strict mode (1:15)", + "SyntaxError: Binding 'eval' in strict mode (1:15)" + ], + "program": { + "type": "Program", + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":14,"end":31,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":31}}, + "expression": { + "type": "ArrowFunctionExpression", + "start":14,"end":31,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":31}}, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "AssignmentPattern", + "start":15,"end":24,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":24}}, + "left": { + "type": "Identifier", + "start":15,"end":19,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":19},"identifierName":"eval"}, + "name": "eval" + }, + "right": { + "type": "NumericLiteral", + "start":22,"end":24,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":24}}, + "extra": { + "rawValue": 10, + "raw": "10" + }, + "value": 10 + } + } + ], + "body": { + "type": "NumericLiteral", + "start":29,"end":31,"loc":{"start":{"line":1,"column":29},"end":{"line":1,"column":31}}, + "extra": { + "rawValue": 42, + "raw": "42" + }, + "value": 42 + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "value": { + "type": "DirectiveLiteral", + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0088/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0088/options.json deleted file mode 100644 index e4abe279ab29..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0088/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'eval' in strict mode (1:14)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0088/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0088/output.json new file mode 100644 index 000000000000..8e8d8419af7a --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0088/output.json @@ -0,0 +1,57 @@ +{ + "type": "File", + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, + "errors": [ + "SyntaxError: Binding 'eval' in strict mode (1:14)" + ], + "program": { + "type": "Program", + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":14,"end":24,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":24}}, + "expression": { + "type": "ArrowFunctionExpression", + "start":14,"end":24,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":24}}, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start":14,"end":18,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":18},"identifierName":"eval"}, + "name": "eval" + } + ], + "body": { + "type": "NumericLiteral", + "start":22,"end":24,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":24}}, + "extra": { + "rawValue": 42, + "raw": "42" + }, + "value": 42 + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "value": { + "type": "DirectiveLiteral", + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0089/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0089/options.json deleted file mode 100644 index c2a4aaec255e..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0089/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'arguments' in strict mode (1:14)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0089/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0089/output.json new file mode 100644 index 000000000000..5a18ea14d881 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0089/output.json @@ -0,0 +1,57 @@ +{ + "type": "File", + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, + "errors": [ + "SyntaxError: Binding 'arguments' in strict mode (1:14)" + ], + "program": { + "type": "Program", + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":14,"end":29,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":29}}, + "expression": { + "type": "ArrowFunctionExpression", + "start":14,"end":29,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":29}}, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start":14,"end":23,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":23},"identifierName":"arguments"}, + "name": "arguments" + } + ], + "body": { + "type": "NumericLiteral", + "start":27,"end":29,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":29}}, + "extra": { + "rawValue": 42, + "raw": "42" + }, + "value": 42 + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "value": { + "type": "DirectiveLiteral", + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0090/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0090/options.json deleted file mode 100644 index d93d5b2aa62e..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0090/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'eval' in strict mode (1:15)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0090/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0090/output.json new file mode 100644 index 000000000000..c5a150d343ad --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0090/output.json @@ -0,0 +1,62 @@ +{ + "type": "File", + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, + "errors": [ + "SyntaxError: Binding 'eval' in strict mode (1:15)" + ], + "program": { + "type": "Program", + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":14,"end":29,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":29}}, + "expression": { + "type": "ArrowFunctionExpression", + "start":14,"end":29,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":29}}, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start":15,"end":19,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":19},"identifierName":"eval"}, + "name": "eval" + }, + { + "type": "Identifier", + "start":21,"end":22,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":22},"identifierName":"a"}, + "name": "a" + } + ], + "body": { + "type": "NumericLiteral", + "start":27,"end":29,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":29}}, + "extra": { + "rawValue": 42, + "raw": "42" + }, + "value": 42 + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "value": { + "type": "DirectiveLiteral", + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0091/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0091/options.json deleted file mode 100644 index 5d2dc563b16e..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0091/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'arguments' in strict mode (1:15)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0091/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0091/output.json new file mode 100644 index 000000000000..402704e9deb8 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0091/output.json @@ -0,0 +1,62 @@ +{ + "type": "File", + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, + "errors": [ + "SyntaxError: Binding 'arguments' in strict mode (1:15)" + ], + "program": { + "type": "Program", + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":14,"end":34,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":34}}, + "expression": { + "type": "ArrowFunctionExpression", + "start":14,"end":34,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":34}}, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start":15,"end":24,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":24},"identifierName":"arguments"}, + "name": "arguments" + }, + { + "type": "Identifier", + "start":26,"end":27,"loc":{"start":{"line":1,"column":26},"end":{"line":1,"column":27},"identifierName":"a"}, + "name": "a" + } + ], + "body": { + "type": "NumericLiteral", + "start":32,"end":34,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":34}}, + "extra": { + "rawValue": 42, + "raw": "42" + }, + "value": 42 + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "value": { + "type": "DirectiveLiteral", + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0092/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0092/options.json deleted file mode 100644 index 368006ae58bd..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0092/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Argument name clash (1:4)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0092/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0092/output.json new file mode 100644 index 000000000000..4cfc4cd77e70 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0092/output.json @@ -0,0 +1,48 @@ +{ + "type": "File", + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "errors": [ + "SyntaxError: Argument name clash (1:4)" + ], + "program": { + "type": "Program", + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "expression": { + "type": "ArrowFunctionExpression", + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start":1,"end":2,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":2},"identifierName":"a"}, + "name": "a" + }, + { + "type": "Identifier", + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"a"}, + "name": "a" + } + ], + "body": { + "type": "NumericLiteral", + "start":10,"end":12,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":12}}, + "extra": { + "rawValue": 42, + "raw": "42" + }, + "value": 42 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0093/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0093/options.json deleted file mode 100644 index b99fd35222b1..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0093/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Argument name clash (1:18)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0093/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0093/output.json new file mode 100644 index 000000000000..e552560189df --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0093/output.json @@ -0,0 +1,62 @@ +{ + "type": "File", + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, + "errors": [ + "SyntaxError: Argument name clash (1:18)" + ], + "program": { + "type": "Program", + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":14,"end":26,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":26}}, + "expression": { + "type": "ArrowFunctionExpression", + "start":14,"end":26,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":26}}, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start":15,"end":16,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":16},"identifierName":"a"}, + "name": "a" + }, + { + "type": "Identifier", + "start":18,"end":19,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":19},"identifierName":"a"}, + "name": "a" + } + ], + "body": { + "type": "NumericLiteral", + "start":24,"end":26,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":26}}, + "extra": { + "rawValue": 42, + "raw": "42" + }, + "value": 42 + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "value": { + "type": "DirectiveLiteral", + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0094/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0094/options.json deleted file mode 100644 index 79a05e62290e..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0094/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Legacy octal literals are not allowed in strict mode (1:21)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0094/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0094/output.json new file mode 100644 index 000000000000..70812a59cc6a --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0094/output.json @@ -0,0 +1,57 @@ +{ + "type": "File", + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, + "errors": [ + "SyntaxError: Legacy octal literals are not allowed in strict mode (1:21)" + ], + "program": { + "type": "Program", + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":14,"end":23,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":23}}, + "expression": { + "type": "ArrowFunctionExpression", + "start":14,"end":23,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":23}}, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start":15,"end":16,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":16},"identifierName":"a"}, + "name": "a" + } + ], + "body": { + "type": "NumericLiteral", + "start":21,"end":23,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":23}}, + "extra": { + "rawValue": 0, + "raw": "00" + }, + "value": 0 + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "value": { + "type": "DirectiveLiteral", + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0098/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0098/options.json deleted file mode 100644 index 99ffc0de0153..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0098/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid left-hand side in arrow function parameters (1:1)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0098/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0098/output.json new file mode 100644 index 000000000000..6b624a3ee404 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0098/output.json @@ -0,0 +1,47 @@ +{ + "type": "File", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "errors": [ + "SyntaxError: Binding invalid left-hand side in function parameter list (1:1)" + ], + "program": { + "type": "Program", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "expression": { + "type": "ArrowFunctionExpression", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "NumericLiteral", + "start":1,"end":3,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":3}}, + "extra": { + "rawValue": 10, + "raw": "10" + }, + "value": 10 + } + ], + "body": { + "type": "NumericLiteral", + "start":8,"end":10,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":10}}, + "extra": { + "rawValue": 0, + "raw": "00" + }, + "value": 0 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0099/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0099/options.json deleted file mode 100644 index 99ffc0de0153..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0099/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid left-hand side in arrow function parameters (1:1)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0099/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0099/output.json new file mode 100644 index 000000000000..06d87dffa42f --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0099/output.json @@ -0,0 +1,57 @@ +{ + "type": "File", + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, + "errors": [ + "SyntaxError: Binding invalid left-hand side in function parameter list (1:1)", + "SyntaxError: Binding invalid left-hand side in function parameter list (1:5)" + ], + "program": { + "type": "Program", + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, + "expression": { + "type": "ArrowFunctionExpression", + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "NumericLiteral", + "start":1,"end":3,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":3}}, + "extra": { + "rawValue": 10, + "raw": "10" + }, + "value": 10 + }, + { + "type": "NumericLiteral", + "start":5,"end":7,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":7}}, + "extra": { + "rawValue": 20, + "raw": "20" + }, + "value": 20 + } + ], + "body": { + "type": "NumericLiteral", + "start":12,"end":14,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":14}}, + "extra": { + "rawValue": 0, + "raw": "00" + }, + "value": 0 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0100/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0100/options.json deleted file mode 100644 index d93d5b2aa62e..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0100/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'eval' in strict mode (1:15)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0100/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0100/output.json new file mode 100644 index 000000000000..8515329a04e1 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0100/output.json @@ -0,0 +1,57 @@ +{ + "type": "File", + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, + "errors": [ + "SyntaxError: Binding 'eval' in strict mode (1:15)" + ], + "program": { + "type": "Program", + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":14,"end":26,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":26}}, + "expression": { + "type": "ArrowFunctionExpression", + "start":14,"end":26,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":26}}, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start":15,"end":19,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":19},"identifierName":"eval"}, + "name": "eval" + } + ], + "body": { + "type": "NumericLiteral", + "start":24,"end":26,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":26}}, + "extra": { + "rawValue": 42, + "raw": "42" + }, + "value": 42 + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "value": { + "type": "DirectiveLiteral", + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0101/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0101/options.json deleted file mode 100644 index 224716db8070..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0101/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'eval' in strict mode (1:1)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0101/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0101/output.json new file mode 100644 index 000000000000..16f6411a562b --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0101/output.json @@ -0,0 +1,68 @@ +{ + "type": "File", + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, + "errors": [ + "SyntaxError: Binding 'eval' in strict mode (1:1)" + ], + "program": { + "type": "Program", + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, + "expression": { + "type": "ArrowFunctionExpression", + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start":1,"end":5,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":5},"identifierName":"eval"}, + "name": "eval" + } + ], + "body": { + "type": "BlockStatement", + "start":10,"end":30,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":30}}, + "body": [ + { + "type": "ExpressionStatement", + "start":26,"end":28,"loc":{"start":{"line":1,"column":26},"end":{"line":1,"column":28}}, + "expression": { + "type": "NumericLiteral", + "start":26,"end":28,"loc":{"start":{"line":1,"column":26},"end":{"line":1,"column":28}}, + "extra": { + "rawValue": 42, + "raw": "42" + }, + "value": 42 + } + } + ], + "directives": [ + { + "type": "Directive", + "start":12,"end":25,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":25}}, + "value": { + "type": "DirectiveLiteral", + "start":12,"end":24,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":24}}, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0116/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0116/options.json deleted file mode 100644 index 701f9fe8f27a..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0116/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unsyntactic break (1:0)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0116/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0116/output.json new file mode 100644 index 000000000000..8ce94b960543 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0116/output.json @@ -0,0 +1,21 @@ +{ + "type": "File", + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, + "errors": [ + "SyntaxError: Unsyntactic break (1:0)" + ], + "program": { + "type": "Program", + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "BreakStatement", + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, + "label": null + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0118/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0118/options.json deleted file mode 100644 index de66853a7a3d..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0118/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unsyntactic continue (1:0)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0118/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0118/output.json new file mode 100644 index 000000000000..6d89822f1568 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0118/output.json @@ -0,0 +1,21 @@ +{ + "type": "File", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "errors": [ + "SyntaxError: Unsyntactic continue (1:0)" + ], + "program": { + "type": "Program", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ContinueStatement", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "label": null + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0125/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0125/options.json deleted file mode 100644 index f8560a7de9d6..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0125/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid left-hand side in for-in statement (1:5)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0125/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0125/output.json new file mode 100644 index 000000000000..d3af5238b363 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0125/output.json @@ -0,0 +1,48 @@ +{ + "type": "File", + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, + "errors": [ + "SyntaxError: Invalid left-hand side in for-in statement (1:5)" + ], + "program": { + "type": "Program", + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ForInStatement", + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, + "left": { + "type": "BinaryExpression", + "start":5,"end":10,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":10}}, + "left": { + "type": "Identifier", + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"i"}, + "name": "i" + }, + "operator": "+", + "right": { + "type": "NumericLiteral", + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10}}, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + }, + "right": { + "type": "ObjectExpression", + "start":14,"end":16,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":16}}, + "properties": [] + }, + "body": { + "type": "EmptyStatement", + "start":17,"end":18,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":18}} + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0126/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0126/options.json deleted file mode 100644 index f8560a7de9d6..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0126/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid left-hand side in for-in statement (1:5)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0126/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0126/output.json new file mode 100644 index 000000000000..a68f97021f5d --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0126/output.json @@ -0,0 +1,40 @@ +{ + "type": "File", + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, + "errors": [ + "SyntaxError: Invalid left-hand side in for-in statement (1:5)" + ], + "program": { + "type": "Program", + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ForInStatement", + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, + "left": { + "type": "UnaryExpression", + "start":5,"end":7,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":7}}, + "operator": "+", + "prefix": true, + "argument": { + "type": "Identifier", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"i"}, + "name": "i" + } + }, + "right": { + "type": "ObjectExpression", + "start":11,"end":13,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":13}}, + "properties": [] + }, + "body": { + "type": "EmptyStatement", + "start":14,"end":15,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":15}} + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0133/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0133/options.json deleted file mode 100644 index 429d96ca3f9a..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0133/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Missing catch or finally clause (1:0)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0133/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0133/output.json new file mode 100644 index 000000000000..a0bb1f5c08a4 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0133/output.json @@ -0,0 +1,28 @@ +{ + "type": "File", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "errors": [ + "SyntaxError: Missing catch or finally clause (1:0)" + ], + "program": { + "type": "Program", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "TryStatement", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "block": { + "type": "BlockStatement", + "start":4,"end":7,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":7}}, + "body": [], + "directives": [] + }, + "handler": null, + "finalizer": null + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0137/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0137/options.json deleted file mode 100644 index 82bcfe621c49..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0137/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid Unicode escape (1:0)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0137/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0137/output.json new file mode 100644 index 000000000000..8515bc8f1fb0 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0137/output.json @@ -0,0 +1,39 @@ +{ + "type": "File", + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "errors": [ + "SyntaxError: Invalid Unicode escape (1:0)" + ], + "program": { + "type": "Program", + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "expression": { + "type": "AssignmentExpression", + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "operator": "=", + "left": { + "type": "Identifier", + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6},"identifierName":"‿"}, + "name": "‿" + }, + "right": { + "type": "NumericLiteral", + "start":9,"end":11,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":11}}, + "extra": { + "rawValue": 10, + "raw": "10" + }, + "value": 10 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0142/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0142/options.json deleted file mode 100644 index 97818d2eea7e..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0142/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Lexical declaration cannot appear in a single-statement context (1:9)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0142/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0142/output.json new file mode 100644 index 000000000000..65a76ea528d1 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0142/output.json @@ -0,0 +1,51 @@ +{ + "type": "File", + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, + "errors": [ + "SyntaxError: Lexical declaration cannot appear in a single-statement context (1:9)" + ], + "program": { + "type": "Program", + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "IfStatement", + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, + "test": { + "type": "BooleanLiteral", + "start":3,"end":7,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":7}}, + "value": true + }, + "consequent": { + "type": "VariableDeclaration", + "start":9,"end":21,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":21}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":15,"end":20,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":20}}, + "id": { + "type": "Identifier", + "start":15,"end":16,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":16},"identifierName":"a"}, + "name": "a" + }, + "init": { + "type": "NumericLiteral", + "start":19,"end":20,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":20}}, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + ], + "kind": "const" + }, + "alternate": null + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0143/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0143/options.json deleted file mode 100644 index aadfa63716c2..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0143/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Multiple default clauses (1:22)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0143/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0143/output.json new file mode 100644 index 000000000000..322359217c2d --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0143/output.json @@ -0,0 +1,39 @@ +{ + "type": "File", + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, + "errors": [ + "SyntaxError: Multiple default clauses (1:22)" + ], + "program": { + "type": "Program", + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "SwitchStatement", + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, + "discriminant": { + "type": "Identifier", + "start":8,"end":9,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":9},"identifierName":"c"}, + "name": "c" + }, + "cases": [ + { + "type": "SwitchCase", + "start":13,"end":21,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":21}}, + "consequent": [], + "test": null + }, + { + "type": "SwitchCase", + "start":22,"end":30,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":30}}, + "consequent": [], + "test": null + } + ] + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0162/input.js b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0162/input.js index adcf3cef4357..57ddad2aec5d 100644 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0162/input.js +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0162/input.js @@ -1 +1 @@ -\\ +\ diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0162/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0162/options.json deleted file mode 100644 index 381fd12ce2d0..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0162/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Expecting Unicode escape sequence \\uXXXX (1:1)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0162/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0162/output.json new file mode 100644 index 000000000000..4e21f3ee7b93 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0162/output.json @@ -0,0 +1,25 @@ +{ + "type": "File", + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1}}, + "errors": [ + "SyntaxError: Expecting Unicode escape sequence \\uXXXX (1:1)" + ], + "program": { + "type": "Program", + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1}}, + "expression": { + "type": "Identifier", + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"\\"}, + "name": "\\" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0163/input.js b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0163/input.js index b9e12b2eff54..65bd7cf67b3f 100644 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0163/input.js +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0163/input.js @@ -1 +1 @@ -\\u005c +\u005c diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0163/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0163/options.json deleted file mode 100644 index 381fd12ce2d0..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0163/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Expecting Unicode escape sequence \\uXXXX (1:1)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0163/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0163/output.json new file mode 100644 index 000000000000..6c34e22a0044 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0163/output.json @@ -0,0 +1,25 @@ +{ + "type": "File", + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, + "errors": [ + "SyntaxError: Invalid Unicode escape (1:0)" + ], + "program": { + "type": "Program", + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, + "expression": { + "type": "Identifier", + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6},"identifierName":"\\"}, + "name": "\\" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0164/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0164/options.json deleted file mode 100644 index 381fd12ce2d0..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0164/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Expecting Unicode escape sequence \\uXXXX (1:1)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0164/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0164/output.json new file mode 100644 index 000000000000..cc7b3b44d69e --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0164/output.json @@ -0,0 +1,25 @@ +{ + "type": "File", + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}}, + "errors": [ + "SyntaxError: Expecting Unicode escape sequence \\uXXXX (1:1)" + ], + "program": { + "type": "Program", + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}}, + "expression": { + "type": "Identifier", + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2},"identifierName":"\\x"}, + "name": "\\x" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0165/input.js b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0165/input.js index a6e819ccd18b..ecb0a859c956 100644 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0165/input.js +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0165/input.js @@ -1 +1 @@ -\\u0000 +\u0000 diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0165/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0165/options.json deleted file mode 100644 index 381fd12ce2d0..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0165/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Expecting Unicode escape sequence \\uXXXX (1:1)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0165/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0165/output.json new file mode 100644 index 000000000000..3af7d55ae127 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0165/output.json @@ -0,0 +1,25 @@ +{ + "type": "File", + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, + "errors": [ + "SyntaxError: Invalid Unicode escape (1:0)" + ], + "program": { + "type": "Program", + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, + "expression": { + "type": "Identifier", + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6},"identifierName":"\u0000"}, + "name": "\u0000" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0166/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0166/options.json deleted file mode 100644 index 82bcfe621c49..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0166/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid Unicode escape (1:0)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0166/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0166/output.json new file mode 100644 index 000000000000..b79101954c7c --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0166/output.json @@ -0,0 +1,35 @@ +{ + "type": "File", + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "errors": [ + "SyntaxError: Invalid Unicode escape (1:0)" + ], + "program": { + "type": "Program", + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "expression": { + "type": "AssignmentExpression", + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "operator": "=", + "left": { + "type": "Identifier", + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6},"identifierName":"‌"}, + "name": "‌" + }, + "right": { + "type": "ArrayExpression", + "start":9,"end":11,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":11}}, + "elements": [] + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0167/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0167/options.json deleted file mode 100644 index 82bcfe621c49..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0167/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid Unicode escape (1:0)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0167/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0167/output.json new file mode 100644 index 000000000000..88eefa8ba7ab --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0167/output.json @@ -0,0 +1,35 @@ +{ + "type": "File", + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "errors": [ + "SyntaxError: Invalid Unicode escape (1:0)" + ], + "program": { + "type": "Program", + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "expression": { + "type": "AssignmentExpression", + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "operator": "=", + "left": { + "type": "Identifier", + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6},"identifierName":"‍"}, + "name": "‍" + }, + "right": { + "type": "ArrayExpression", + "start":9,"end":11,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":11}}, + "elements": [] + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0169/input.js b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0169/input.js index 2775e915bb92..1ef32f79a66e 100644 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0169/input.js +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0169/input.js @@ -1 +1 @@ -"\\u +"\u diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0171/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0171/options.json deleted file mode 100644 index f9d29c7f328c..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0171/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "'return' outside of function (1:0)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0171/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0171/output.json new file mode 100644 index 000000000000..5875cb58be47 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0171/output.json @@ -0,0 +1,21 @@ +{ + "type": "File", + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, + "errors": [ + "SyntaxError: 'return' outside of function (1:0)" + ], + "program": { + "type": "Program", + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ReturnStatement", + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, + "argument": null + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0172/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0172/options.json deleted file mode 100644 index 701f9fe8f27a..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0172/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unsyntactic break (1:0)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0172/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0172/output.json new file mode 100644 index 000000000000..8ce94b960543 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0172/output.json @@ -0,0 +1,21 @@ +{ + "type": "File", + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, + "errors": [ + "SyntaxError: Unsyntactic break (1:0)" + ], + "program": { + "type": "Program", + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "BreakStatement", + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, + "label": null + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0173/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0173/options.json deleted file mode 100644 index de66853a7a3d..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0173/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unsyntactic continue (1:0)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0173/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0173/output.json new file mode 100644 index 000000000000..6d89822f1568 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0173/output.json @@ -0,0 +1,21 @@ +{ + "type": "File", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "errors": [ + "SyntaxError: Unsyntactic continue (1:0)" + ], + "program": { + "type": "Program", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ContinueStatement", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "label": null + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0174/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0174/options.json deleted file mode 100644 index c726e8fa98e4..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0174/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unsyntactic continue (1:22)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0174/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0174/output.json new file mode 100644 index 000000000000..37451db0ed1b --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0174/output.json @@ -0,0 +1,39 @@ +{ + "type": "File", + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, + "errors": [ + "SyntaxError: Unsyntactic continue (1:22)" + ], + "program": { + "type": "Program", + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "SwitchStatement", + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, + "discriminant": { + "type": "Identifier", + "start":8,"end":9,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":9},"identifierName":"x"}, + "name": "x" + }, + "cases": [ + { + "type": "SwitchCase", + "start":13,"end":31,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":31}}, + "consequent": [ + { + "type": "ContinueStatement", + "start":22,"end":31,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":31}}, + "label": null + } + ], + "test": null + } + ] + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0176/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0176/options.json deleted file mode 100644 index 070e662e80d4..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0176/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unsyntactic break (1:15)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0176/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0176/output.json new file mode 100644 index 000000000000..ae9cb401dddc --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0176/output.json @@ -0,0 +1,41 @@ +{ + "type": "File", + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, + "errors": [ + "SyntaxError: Unsyntactic break (1:15)" + ], + "program": { + "type": "Program", + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "WhileStatement", + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, + "test": { + "type": "BooleanLiteral", + "start":7,"end":11,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":11}}, + "value": true + }, + "body": { + "type": "BlockStatement", + "start":13,"end":25,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":25}}, + "body": [ + { + "type": "BreakStatement", + "start":15,"end":23,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":23}}, + "label": { + "type": "Identifier", + "start":21,"end":22,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":22},"identifierName":"x"}, + "name": "x" + } + } + ], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0177/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0177/options.json deleted file mode 100644 index 2a2e15787aa7..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0177/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unsyntactic continue (1:15)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0177/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0177/output.json new file mode 100644 index 000000000000..39c5663443fe --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0177/output.json @@ -0,0 +1,41 @@ +{ + "type": "File", + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, + "errors": [ + "SyntaxError: Unsyntactic continue (1:15)" + ], + "program": { + "type": "Program", + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "WhileStatement", + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, + "test": { + "type": "BooleanLiteral", + "start":7,"end":11,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":11}}, + "value": true + }, + "body": { + "type": "BlockStatement", + "start":13,"end":28,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":28}}, + "body": [ + { + "type": "ContinueStatement", + "start":15,"end":26,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":26}}, + "label": { + "type": "Identifier", + "start":24,"end":25,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":25},"identifierName":"x"}, + "name": "x" + } + } + ], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0178/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0178/options.json deleted file mode 100644 index 464af80a1561..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0178/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unsyntactic break (1:33)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0178/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0178/output.json new file mode 100644 index 000000000000..3939133b3b8a --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0178/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start":0,"end":47,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":47}}, + "errors": [ + "SyntaxError: Unsyntactic break (1:33)" + ], + "program": { + "type": "Program", + "start":0,"end":47,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":47}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "LabeledStatement", + "start":0,"end":47,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":47}}, + "body": { + "type": "WhileStatement", + "start":3,"end":47,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":47}}, + "test": { + "type": "BooleanLiteral", + "start":10,"end":14,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":14}}, + "value": true + }, + "body": { + "type": "BlockStatement", + "start":16,"end":47,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":47}}, + "body": [ + { + "type": "ExpressionStatement", + "start":18,"end":45,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":45}}, + "expression": { + "type": "FunctionExpression", + "start":19,"end":43,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":43}}, + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":31,"end":43,"loc":{"start":{"line":1,"column":31},"end":{"line":1,"column":43}}, + "body": [ + { + "type": "BreakStatement", + "start":33,"end":41,"loc":{"start":{"line":1,"column":33},"end":{"line":1,"column":41}}, + "label": { + "type": "Identifier", + "start":39,"end":40,"loc":{"start":{"line":1,"column":39},"end":{"line":1,"column":40},"identifierName":"x"}, + "name": "x" + } + } + ], + "directives": [] + }, + "extra": { + "parenthesized": true, + "parenStart": 18 + } + } + } + ], + "directives": [] + } + }, + "label": { + "type": "Identifier", + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, + "name": "x" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0179/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0179/options.json deleted file mode 100644 index a056cb50e190..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0179/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unsyntactic continue (1:33)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0179/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0179/output.json new file mode 100644 index 000000000000..d65c7f7da91a --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0179/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start":0,"end":50,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":50}}, + "errors": [ + "SyntaxError: Unsyntactic continue (1:33)" + ], + "program": { + "type": "Program", + "start":0,"end":50,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":50}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "LabeledStatement", + "start":0,"end":50,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":50}}, + "body": { + "type": "WhileStatement", + "start":3,"end":50,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":50}}, + "test": { + "type": "BooleanLiteral", + "start":10,"end":14,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":14}}, + "value": true + }, + "body": { + "type": "BlockStatement", + "start":16,"end":50,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":50}}, + "body": [ + { + "type": "ExpressionStatement", + "start":18,"end":48,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":48}}, + "expression": { + "type": "FunctionExpression", + "start":19,"end":46,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":46}}, + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":31,"end":46,"loc":{"start":{"line":1,"column":31},"end":{"line":1,"column":46}}, + "body": [ + { + "type": "ContinueStatement", + "start":33,"end":44,"loc":{"start":{"line":1,"column":33},"end":{"line":1,"column":44}}, + "label": { + "type": "Identifier", + "start":42,"end":43,"loc":{"start":{"line":1,"column":42},"end":{"line":1,"column":43},"identifierName":"x"}, + "name": "x" + } + } + ], + "directives": [] + }, + "extra": { + "parenthesized": true, + "parenStart": 18 + } + } + } + ], + "directives": [] + } + }, + "label": { + "type": "Identifier", + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, + "name": "x" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0180/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0180/options.json deleted file mode 100644 index 464af80a1561..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0180/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unsyntactic break (1:33)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0180/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0180/output.json new file mode 100644 index 000000000000..336add4fe32c --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0180/output.json @@ -0,0 +1,69 @@ +{ + "type": "File", + "start":0,"end":45,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":45}}, + "errors": [ + "SyntaxError: Unsyntactic break (1:33)" + ], + "program": { + "type": "Program", + "start":0,"end":45,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":45}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "LabeledStatement", + "start":0,"end":45,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":45}}, + "body": { + "type": "WhileStatement", + "start":3,"end":45,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":45}}, + "test": { + "type": "BooleanLiteral", + "start":10,"end":14,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":14}}, + "value": true + }, + "body": { + "type": "BlockStatement", + "start":16,"end":45,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":45}}, + "body": [ + { + "type": "ExpressionStatement", + "start":18,"end":43,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":43}}, + "expression": { + "type": "FunctionExpression", + "start":19,"end":41,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":41}}, + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":31,"end":41,"loc":{"start":{"line":1,"column":31},"end":{"line":1,"column":41}}, + "body": [ + { + "type": "BreakStatement", + "start":33,"end":39,"loc":{"start":{"line":1,"column":33},"end":{"line":1,"column":39}}, + "label": null + } + ], + "directives": [] + }, + "extra": { + "parenthesized": true, + "parenStart": 18 + } + } + } + ], + "directives": [] + } + }, + "label": { + "type": "Identifier", + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, + "name": "x" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0181/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0181/options.json deleted file mode 100644 index a056cb50e190..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0181/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unsyntactic continue (1:33)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0181/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0181/output.json new file mode 100644 index 000000000000..ac86039c659b --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0181/output.json @@ -0,0 +1,69 @@ +{ + "type": "File", + "start":0,"end":48,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":48}}, + "errors": [ + "SyntaxError: Unsyntactic continue (1:33)" + ], + "program": { + "type": "Program", + "start":0,"end":48,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":48}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "LabeledStatement", + "start":0,"end":48,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":48}}, + "body": { + "type": "WhileStatement", + "start":3,"end":48,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":48}}, + "test": { + "type": "BooleanLiteral", + "start":10,"end":14,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":14}}, + "value": true + }, + "body": { + "type": "BlockStatement", + "start":16,"end":48,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":48}}, + "body": [ + { + "type": "ExpressionStatement", + "start":18,"end":46,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":46}}, + "expression": { + "type": "FunctionExpression", + "start":19,"end":44,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":44}}, + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":31,"end":44,"loc":{"start":{"line":1,"column":31},"end":{"line":1,"column":44}}, + "body": [ + { + "type": "ContinueStatement", + "start":33,"end":42,"loc":{"start":{"line":1,"column":33},"end":{"line":1,"column":42}}, + "label": null + } + ], + "directives": [] + }, + "extra": { + "parenthesized": true, + "parenStart": 18 + } + } + } + ], + "directives": [] + } + }, + "label": { + "type": "Identifier", + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, + "name": "x" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0182/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0182/options.json deleted file mode 100644 index da7f2590db0b..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0182/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Label 'x' is already declared (1:18)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0182/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0182/output.json new file mode 100644 index 000000000000..815a430cb2b7 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0182/output.json @@ -0,0 +1,65 @@ +{ + "type": "File", + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":39}}, + "errors": [ + "SyntaxError: Label 'x' is already declared (1:18)" + ], + "program": { + "type": "Program", + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":39}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "LabeledStatement", + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":39}}, + "body": { + "type": "WhileStatement", + "start":3,"end":39,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":39}}, + "test": { + "type": "BooleanLiteral", + "start":10,"end":14,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":14}}, + "value": true + }, + "body": { + "type": "BlockStatement", + "start":16,"end":39,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":39}}, + "body": [ + { + "type": "LabeledStatement", + "start":18,"end":37,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":37}}, + "body": { + "type": "WhileStatement", + "start":21,"end":37,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":37}}, + "test": { + "type": "BooleanLiteral", + "start":28,"end":32,"loc":{"start":{"line":1,"column":28},"end":{"line":1,"column":32}}, + "value": true + }, + "body": { + "type": "BlockStatement", + "start":34,"end":37,"loc":{"start":{"line":1,"column":34},"end":{"line":1,"column":37}}, + "body": [], + "directives": [] + } + }, + "label": { + "type": "Identifier", + "start":18,"end":19,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":19},"identifierName":"x"}, + "name": "x" + } + } + ], + "directives": [] + } + }, + "label": { + "type": "Identifier", + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, + "name": "x" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0183/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0183/options.json deleted file mode 100644 index 1517e1719333..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0183/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Deleting local variable in strict mode (1:29)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0183/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0183/output.json new file mode 100644 index 000000000000..392c525509d1 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0183/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start":0,"end":43,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":43}}, + "errors": [ + "SyntaxError: Deleting local variable in strict mode (1:29)" + ], + "program": { + "type": "Program", + "start":0,"end":43,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":43}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":43,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":43}}, + "expression": { + "type": "CallExpression", + "start":1,"end":42,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":42}}, + "callee": { + "type": "FunctionExpression", + "start":1,"end":40,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":40}}, + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":13,"end":40,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":40}}, + "body": [ + { + "type": "ExpressionStatement", + "start":29,"end":38,"loc":{"start":{"line":1,"column":29},"end":{"line":1,"column":38}}, + "expression": { + "type": "UnaryExpression", + "start":29,"end":37,"loc":{"start":{"line":1,"column":29},"end":{"line":1,"column":37}}, + "operator": "delete", + "prefix": true, + "argument": { + "type": "Identifier", + "start":36,"end":37,"loc":{"start":{"line":1,"column":36},"end":{"line":1,"column":37},"identifierName":"i"}, + "name": "i" + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start":15,"end":28,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":28}}, + "value": { + "type": "DirectiveLiteral", + "start":15,"end":27,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":27}}, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + }, + "arguments": [], + "extra": { + "parenthesized": true, + "parenStart": 0 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0184/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0184/options.json deleted file mode 100644 index 31b4c6d2a040..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0184/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "'with' in strict mode (1:29)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0184/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0184/output.json new file mode 100644 index 000000000000..62cf67d34e04 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0184/output.json @@ -0,0 +1,71 @@ +{ + "type": "File", + "start":0,"end":43,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":43}}, + "errors": [ + "SyntaxError: 'with' in strict mode (1:29)" + ], + "program": { + "type": "Program", + "start":0,"end":43,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":43}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":43,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":43}}, + "expression": { + "type": "CallExpression", + "start":1,"end":42,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":42}}, + "callee": { + "type": "FunctionExpression", + "start":1,"end":40,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":40}}, + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":13,"end":40,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":40}}, + "body": [ + { + "type": "WithStatement", + "start":29,"end":38,"loc":{"start":{"line":1,"column":29},"end":{"line":1,"column":38}}, + "object": { + "type": "Identifier", + "start":35,"end":36,"loc":{"start":{"line":1,"column":35},"end":{"line":1,"column":36},"identifierName":"i"}, + "name": "i" + }, + "body": { + "type": "EmptyStatement", + "start":37,"end":38,"loc":{"start":{"line":1,"column":37},"end":{"line":1,"column":38}} + } + } + ], + "directives": [ + { + "type": "Directive", + "start":15,"end":28,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":28}}, + "value": { + "type": "DirectiveLiteral", + "start":15,"end":27,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":27}}, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + }, + "arguments": [], + "extra": { + "parenthesized": true, + "parenStart": 0 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0185/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0185/options.json deleted file mode 100644 index b463f315f9eb..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0185/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'eval' in strict mode (1:36)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0185/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0185/output.json new file mode 100644 index 000000000000..fcd0ab9858ca --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0185/output.json @@ -0,0 +1,74 @@ +{ + "type": "File", + "start":0,"end":48,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":48}}, + "errors": [ + "SyntaxError: Binding 'eval' in strict mode (1:36)" + ], + "program": { + "type": "Program", + "start":0,"end":48,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":48}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":48,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":48}}, + "id": { + "type": "Identifier", + "start":9,"end":14,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":14},"identifierName":"hello"}, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":17,"end":48,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":48}}, + "body": [ + { + "type": "VariableDeclaration", + "start":32,"end":46,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":46}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":36,"end":45,"loc":{"start":{"line":1,"column":36},"end":{"line":1,"column":45}}, + "id": { + "type": "Identifier", + "start":36,"end":40,"loc":{"start":{"line":1,"column":36},"end":{"line":1,"column":40},"identifierName":"eval"}, + "name": "eval" + }, + "init": { + "type": "NumericLiteral", + "start":43,"end":45,"loc":{"start":{"line":1,"column":43},"end":{"line":1,"column":45}}, + "extra": { + "rawValue": 10, + "raw": "10" + }, + "value": 10 + } + } + ], + "kind": "var" + } + ], + "directives": [ + { + "type": "Directive", + "start":18,"end":31,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":31}}, + "value": { + "type": "DirectiveLiteral", + "start":18,"end":30,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":30}}, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0186/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0186/options.json deleted file mode 100644 index 9e9f875dfbb5..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0186/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'arguments' in strict mode (1:36)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0186/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0186/output.json new file mode 100644 index 000000000000..d557326e9973 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0186/output.json @@ -0,0 +1,74 @@ +{ + "type": "File", + "start":0,"end":53,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":53}}, + "errors": [ + "SyntaxError: Binding 'arguments' in strict mode (1:36)" + ], + "program": { + "type": "Program", + "start":0,"end":53,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":53}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":53,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":53}}, + "id": { + "type": "Identifier", + "start":9,"end":14,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":14},"identifierName":"hello"}, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":17,"end":53,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":53}}, + "body": [ + { + "type": "VariableDeclaration", + "start":32,"end":51,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":51}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":36,"end":50,"loc":{"start":{"line":1,"column":36},"end":{"line":1,"column":50}}, + "id": { + "type": "Identifier", + "start":36,"end":45,"loc":{"start":{"line":1,"column":36},"end":{"line":1,"column":45},"identifierName":"arguments"}, + "name": "arguments" + }, + "init": { + "type": "NumericLiteral", + "start":48,"end":50,"loc":{"start":{"line":1,"column":48},"end":{"line":1,"column":50}}, + "extra": { + "rawValue": 10, + "raw": "10" + }, + "value": 10 + } + } + ], + "kind": "var" + } + ], + "directives": [ + { + "type": "Directive", + "start":18,"end":31,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":31}}, + "value": { + "type": "DirectiveLiteral", + "start":18,"end":30,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":30}}, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0187/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0187/options.json deleted file mode 100644 index b5fd79ff5ff1..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0187/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'eval' in strict mode (1:47)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0187/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0187/output.json new file mode 100644 index 000000000000..3040718fd546 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0187/output.json @@ -0,0 +1,75 @@ +{ + "type": "File", + "start":0,"end":58,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":58}}, + "errors": [ + "SyntaxError: Binding 'eval' in strict mode (1:47)" + ], + "program": { + "type": "Program", + "start":0,"end":58,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":58}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":58,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":58}}, + "id": { + "type": "Identifier", + "start":9,"end":14,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":14},"identifierName":"hello"}, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":17,"end":58,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":58}}, + "body": [ + { + "type": "TryStatement", + "start":32,"end":56,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":56}}, + "block": { + "type": "BlockStatement", + "start":36,"end":39,"loc":{"start":{"line":1,"column":36},"end":{"line":1,"column":39}}, + "body": [], + "directives": [] + }, + "handler": { + "type": "CatchClause", + "start":40,"end":56,"loc":{"start":{"line":1,"column":40},"end":{"line":1,"column":56}}, + "param": { + "type": "Identifier", + "start":47,"end":51,"loc":{"start":{"line":1,"column":47},"end":{"line":1,"column":51},"identifierName":"eval"}, + "name": "eval" + }, + "body": { + "type": "BlockStatement", + "start":53,"end":56,"loc":{"start":{"line":1,"column":53},"end":{"line":1,"column":56}}, + "body": [], + "directives": [] + } + }, + "finalizer": null + } + ], + "directives": [ + { + "type": "Directive", + "start":18,"end":31,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":31}}, + "value": { + "type": "DirectiveLiteral", + "start":18,"end":30,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":30}}, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0188/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0188/options.json deleted file mode 100644 index 15b7ac855374..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0188/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'arguments' in strict mode (1:47)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0188/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0188/output.json new file mode 100644 index 000000000000..429d686ed48c --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0188/output.json @@ -0,0 +1,75 @@ +{ + "type": "File", + "start":0,"end":63,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":63}}, + "errors": [ + "SyntaxError: Binding 'arguments' in strict mode (1:47)" + ], + "program": { + "type": "Program", + "start":0,"end":63,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":63}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":63,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":63}}, + "id": { + "type": "Identifier", + "start":9,"end":14,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":14},"identifierName":"hello"}, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":17,"end":63,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":63}}, + "body": [ + { + "type": "TryStatement", + "start":32,"end":61,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":61}}, + "block": { + "type": "BlockStatement", + "start":36,"end":39,"loc":{"start":{"line":1,"column":36},"end":{"line":1,"column":39}}, + "body": [], + "directives": [] + }, + "handler": { + "type": "CatchClause", + "start":40,"end":61,"loc":{"start":{"line":1,"column":40},"end":{"line":1,"column":61}}, + "param": { + "type": "Identifier", + "start":47,"end":56,"loc":{"start":{"line":1,"column":47},"end":{"line":1,"column":56},"identifierName":"arguments"}, + "name": "arguments" + }, + "body": { + "type": "BlockStatement", + "start":58,"end":61,"loc":{"start":{"line":1,"column":58},"end":{"line":1,"column":61}}, + "body": [], + "directives": [] + } + }, + "finalizer": null + } + ], + "directives": [ + { + "type": "Directive", + "start":18,"end":31,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":31}}, + "value": { + "type": "DirectiveLiteral", + "start":18,"end":30,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":30}}, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0189/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0189/options.json deleted file mode 100644 index 95f470aed511..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0189/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Assigning to 'eval' in strict mode (1:32)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0189/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0189/output.json new file mode 100644 index 000000000000..79c71ebb542f --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0189/output.json @@ -0,0 +1,72 @@ +{ + "type": "File", + "start":0,"end":44,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":44}}, + "errors": [ + "SyntaxError: Assigning to 'eval' in strict mode (1:32)" + ], + "program": { + "type": "Program", + "start":0,"end":44,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":44}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":44,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":44}}, + "id": { + "type": "Identifier", + "start":9,"end":14,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":14},"identifierName":"hello"}, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":17,"end":44,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":44}}, + "body": [ + { + "type": "ExpressionStatement", + "start":32,"end":42,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":42}}, + "expression": { + "type": "AssignmentExpression", + "start":32,"end":41,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":41}}, + "operator": "=", + "left": { + "type": "Identifier", + "start":32,"end":36,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":36},"identifierName":"eval"}, + "name": "eval" + }, + "right": { + "type": "NumericLiteral", + "start":39,"end":41,"loc":{"start":{"line":1,"column":39},"end":{"line":1,"column":41}}, + "extra": { + "rawValue": 10, + "raw": "10" + }, + "value": 10 + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start":18,"end":31,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":31}}, + "value": { + "type": "DirectiveLiteral", + "start":18,"end":30,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":30}}, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0190/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0190/options.json deleted file mode 100644 index ef45890ab53f..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0190/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Assigning to 'arguments' in strict mode (1:32)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0190/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0190/output.json new file mode 100644 index 000000000000..ec34fa9d5ce8 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0190/output.json @@ -0,0 +1,72 @@ +{ + "type": "File", + "start":0,"end":49,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":49}}, + "errors": [ + "SyntaxError: Assigning to 'arguments' in strict mode (1:32)" + ], + "program": { + "type": "Program", + "start":0,"end":49,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":49}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":49,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":49}}, + "id": { + "type": "Identifier", + "start":9,"end":14,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":14},"identifierName":"hello"}, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":17,"end":49,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":49}}, + "body": [ + { + "type": "ExpressionStatement", + "start":32,"end":47,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":47}}, + "expression": { + "type": "AssignmentExpression", + "start":32,"end":46,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":46}}, + "operator": "=", + "left": { + "type": "Identifier", + "start":32,"end":41,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":41},"identifierName":"arguments"}, + "name": "arguments" + }, + "right": { + "type": "NumericLiteral", + "start":44,"end":46,"loc":{"start":{"line":1,"column":44},"end":{"line":1,"column":46}}, + "extra": { + "rawValue": 10, + "raw": "10" + }, + "value": 10 + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start":18,"end":31,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":31}}, + "value": { + "type": "DirectiveLiteral", + "start":18,"end":30,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":30}}, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0191/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0191/options.json deleted file mode 100644 index 2783b68b3d58..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0191/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Assigning to 'eval' in strict mode (1:34)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0191/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0191/output.json new file mode 100644 index 000000000000..2ad942222305 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0191/output.json @@ -0,0 +1,64 @@ +{ + "type": "File", + "start":0,"end":41,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":41}}, + "errors": [ + "SyntaxError: Assigning to 'eval' in strict mode (1:34)" + ], + "program": { + "type": "Program", + "start":0,"end":41,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":41}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":41,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":41}}, + "id": { + "type": "Identifier", + "start":9,"end":14,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":14},"identifierName":"hello"}, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":17,"end":41,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":41}}, + "body": [ + { + "type": "ExpressionStatement", + "start":32,"end":39,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":39}}, + "expression": { + "type": "UpdateExpression", + "start":32,"end":38,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":38}}, + "operator": "++", + "prefix": true, + "argument": { + "type": "Identifier", + "start":34,"end":38,"loc":{"start":{"line":1,"column":34},"end":{"line":1,"column":38},"identifierName":"eval"}, + "name": "eval" + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start":18,"end":31,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":31}}, + "value": { + "type": "DirectiveLiteral", + "start":18,"end":30,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":30}}, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0192/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0192/options.json deleted file mode 100644 index 2783b68b3d58..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0192/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Assigning to 'eval' in strict mode (1:34)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0192/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0192/output.json new file mode 100644 index 000000000000..c85c53c215da --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0192/output.json @@ -0,0 +1,64 @@ +{ + "type": "File", + "start":0,"end":41,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":41}}, + "errors": [ + "SyntaxError: Assigning to 'eval' in strict mode (1:34)" + ], + "program": { + "type": "Program", + "start":0,"end":41,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":41}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":41,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":41}}, + "id": { + "type": "Identifier", + "start":9,"end":14,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":14},"identifierName":"hello"}, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":17,"end":41,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":41}}, + "body": [ + { + "type": "ExpressionStatement", + "start":32,"end":39,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":39}}, + "expression": { + "type": "UpdateExpression", + "start":32,"end":38,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":38}}, + "operator": "--", + "prefix": true, + "argument": { + "type": "Identifier", + "start":34,"end":38,"loc":{"start":{"line":1,"column":34},"end":{"line":1,"column":38},"identifierName":"eval"}, + "name": "eval" + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start":18,"end":31,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":31}}, + "value": { + "type": "DirectiveLiteral", + "start":18,"end":30,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":30}}, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0193/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0193/options.json deleted file mode 100644 index fe2654496fc9..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0193/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Assigning to 'arguments' in strict mode (1:34)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0193/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0193/output.json new file mode 100644 index 000000000000..8635017ed5c5 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0193/output.json @@ -0,0 +1,64 @@ +{ + "type": "File", + "start":0,"end":46,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":46}}, + "errors": [ + "SyntaxError: Assigning to 'arguments' in strict mode (1:34)" + ], + "program": { + "type": "Program", + "start":0,"end":46,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":46}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":46,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":46}}, + "id": { + "type": "Identifier", + "start":9,"end":14,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":14},"identifierName":"hello"}, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":17,"end":46,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":46}}, + "body": [ + { + "type": "ExpressionStatement", + "start":32,"end":44,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":44}}, + "expression": { + "type": "UpdateExpression", + "start":32,"end":43,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":43}}, + "operator": "++", + "prefix": true, + "argument": { + "type": "Identifier", + "start":34,"end":43,"loc":{"start":{"line":1,"column":34},"end":{"line":1,"column":43},"identifierName":"arguments"}, + "name": "arguments" + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start":18,"end":31,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":31}}, + "value": { + "type": "DirectiveLiteral", + "start":18,"end":30,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":30}}, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0194/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0194/options.json deleted file mode 100644 index fe2654496fc9..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0194/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Assigning to 'arguments' in strict mode (1:34)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0194/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0194/output.json new file mode 100644 index 000000000000..0090b6011203 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0194/output.json @@ -0,0 +1,64 @@ +{ + "type": "File", + "start":0,"end":46,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":46}}, + "errors": [ + "SyntaxError: Assigning to 'arguments' in strict mode (1:34)" + ], + "program": { + "type": "Program", + "start":0,"end":46,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":46}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":46,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":46}}, + "id": { + "type": "Identifier", + "start":9,"end":14,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":14},"identifierName":"hello"}, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":17,"end":46,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":46}}, + "body": [ + { + "type": "ExpressionStatement", + "start":32,"end":44,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":44}}, + "expression": { + "type": "UpdateExpression", + "start":32,"end":43,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":43}}, + "operator": "--", + "prefix": true, + "argument": { + "type": "Identifier", + "start":34,"end":43,"loc":{"start":{"line":1,"column":34},"end":{"line":1,"column":43},"identifierName":"arguments"}, + "name": "arguments" + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start":18,"end":31,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":31}}, + "value": { + "type": "DirectiveLiteral", + "start":18,"end":30,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":30}}, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0195/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0195/options.json deleted file mode 100644 index 95f470aed511..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0195/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Assigning to 'eval' in strict mode (1:32)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0195/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0195/output.json new file mode 100644 index 000000000000..439436ef7e82 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0195/output.json @@ -0,0 +1,64 @@ +{ + "type": "File", + "start":0,"end":41,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":41}}, + "errors": [ + "SyntaxError: Assigning to 'eval' in strict mode (1:32)" + ], + "program": { + "type": "Program", + "start":0,"end":41,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":41}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":41,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":41}}, + "id": { + "type": "Identifier", + "start":9,"end":14,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":14},"identifierName":"hello"}, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":17,"end":41,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":41}}, + "body": [ + { + "type": "ExpressionStatement", + "start":32,"end":39,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":39}}, + "expression": { + "type": "UpdateExpression", + "start":32,"end":38,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":38}}, + "operator": "++", + "prefix": false, + "argument": { + "type": "Identifier", + "start":32,"end":36,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":36},"identifierName":"eval"}, + "name": "eval" + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start":18,"end":31,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":31}}, + "value": { + "type": "DirectiveLiteral", + "start":18,"end":30,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":30}}, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0196/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0196/options.json deleted file mode 100644 index 95f470aed511..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0196/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Assigning to 'eval' in strict mode (1:32)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0196/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0196/output.json new file mode 100644 index 000000000000..b68c731a58a7 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0196/output.json @@ -0,0 +1,64 @@ +{ + "type": "File", + "start":0,"end":41,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":41}}, + "errors": [ + "SyntaxError: Assigning to 'eval' in strict mode (1:32)" + ], + "program": { + "type": "Program", + "start":0,"end":41,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":41}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":41,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":41}}, + "id": { + "type": "Identifier", + "start":9,"end":14,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":14},"identifierName":"hello"}, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":17,"end":41,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":41}}, + "body": [ + { + "type": "ExpressionStatement", + "start":32,"end":39,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":39}}, + "expression": { + "type": "UpdateExpression", + "start":32,"end":38,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":38}}, + "operator": "--", + "prefix": false, + "argument": { + "type": "Identifier", + "start":32,"end":36,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":36},"identifierName":"eval"}, + "name": "eval" + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start":18,"end":31,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":31}}, + "value": { + "type": "DirectiveLiteral", + "start":18,"end":30,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":30}}, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0197/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0197/options.json deleted file mode 100644 index ef45890ab53f..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0197/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Assigning to 'arguments' in strict mode (1:32)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0197/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0197/output.json new file mode 100644 index 000000000000..52dbdc3d5ca5 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0197/output.json @@ -0,0 +1,64 @@ +{ + "type": "File", + "start":0,"end":46,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":46}}, + "errors": [ + "SyntaxError: Assigning to 'arguments' in strict mode (1:32)" + ], + "program": { + "type": "Program", + "start":0,"end":46,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":46}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":46,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":46}}, + "id": { + "type": "Identifier", + "start":9,"end":14,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":14},"identifierName":"hello"}, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":17,"end":46,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":46}}, + "body": [ + { + "type": "ExpressionStatement", + "start":32,"end":44,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":44}}, + "expression": { + "type": "UpdateExpression", + "start":32,"end":43,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":43}}, + "operator": "++", + "prefix": false, + "argument": { + "type": "Identifier", + "start":32,"end":41,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":41},"identifierName":"arguments"}, + "name": "arguments" + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start":18,"end":31,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":31}}, + "value": { + "type": "DirectiveLiteral", + "start":18,"end":30,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":30}}, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0198/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0198/options.json deleted file mode 100644 index ef45890ab53f..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0198/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Assigning to 'arguments' in strict mode (1:32)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0198/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0198/output.json new file mode 100644 index 000000000000..48c2df5468eb --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0198/output.json @@ -0,0 +1,64 @@ +{ + "type": "File", + "start":0,"end":46,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":46}}, + "errors": [ + "SyntaxError: Assigning to 'arguments' in strict mode (1:32)" + ], + "program": { + "type": "Program", + "start":0,"end":46,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":46}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":46,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":46}}, + "id": { + "type": "Identifier", + "start":9,"end":14,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":14},"identifierName":"hello"}, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":17,"end":46,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":46}}, + "body": [ + { + "type": "ExpressionStatement", + "start":32,"end":44,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":44}}, + "expression": { + "type": "UpdateExpression", + "start":32,"end":43,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":43}}, + "operator": "--", + "prefix": false, + "argument": { + "type": "Identifier", + "start":32,"end":41,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":41},"identifierName":"arguments"}, + "name": "arguments" + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start":18,"end":31,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":31}}, + "value": { + "type": "DirectiveLiteral", + "start":18,"end":30,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":30}}, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0199/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0199/options.json deleted file mode 100644 index 6db4ae7bf008..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0199/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'eval' in strict mode (1:41)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0199/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0199/output.json new file mode 100644 index 000000000000..3c4ac7fd38dd --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0199/output.json @@ -0,0 +1,67 @@ +{ + "type": "File", + "start":0,"end":53,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":53}}, + "errors": [ + "SyntaxError: Binding 'eval' in strict mode (1:41)" + ], + "program": { + "type": "Program", + "start":0,"end":53,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":53}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":53,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":53}}, + "id": { + "type": "Identifier", + "start":9,"end":14,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":14},"identifierName":"hello"}, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":17,"end":53,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":53}}, + "body": [ + { + "type": "FunctionDeclaration", + "start":32,"end":51,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":51}}, + "id": { + "type": "Identifier", + "start":41,"end":45,"loc":{"start":{"line":1,"column":41},"end":{"line":1,"column":45},"identifierName":"eval"}, + "name": "eval" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":48,"end":51,"loc":{"start":{"line":1,"column":48},"end":{"line":1,"column":51}}, + "body": [], + "directives": [] + } + } + ], + "directives": [ + { + "type": "Directive", + "start":18,"end":31,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":31}}, + "value": { + "type": "DirectiveLiteral", + "start":18,"end":30,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":30}}, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0200/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0200/options.json deleted file mode 100644 index b02fb725c767..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0200/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'arguments' in strict mode (1:41)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0200/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0200/output.json new file mode 100644 index 000000000000..e183294a232f --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0200/output.json @@ -0,0 +1,67 @@ +{ + "type": "File", + "start":0,"end":58,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":58}}, + "errors": [ + "SyntaxError: Binding 'arguments' in strict mode (1:41)" + ], + "program": { + "type": "Program", + "start":0,"end":58,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":58}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":58,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":58}}, + "id": { + "type": "Identifier", + "start":9,"end":14,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":14},"identifierName":"hello"}, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":17,"end":58,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":58}}, + "body": [ + { + "type": "FunctionDeclaration", + "start":32,"end":56,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":56}}, + "id": { + "type": "Identifier", + "start":41,"end":50,"loc":{"start":{"line":1,"column":41},"end":{"line":1,"column":50},"identifierName":"arguments"}, + "name": "arguments" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":53,"end":56,"loc":{"start":{"line":1,"column":53},"end":{"line":1,"column":56}}, + "body": [], + "directives": [] + } + } + ], + "directives": [ + { + "type": "Directive", + "start":18,"end":31,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":31}}, + "value": { + "type": "DirectiveLiteral", + "start":18,"end":30,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":30}}, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0201/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0201/options.json deleted file mode 100644 index a7490f9321d4..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0201/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'eval' in strict mode (1:9)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0201/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0201/output.json new file mode 100644 index 000000000000..c252adad5c36 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0201/output.json @@ -0,0 +1,48 @@ +{ + "type": "File", + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, + "errors": [ + "SyntaxError: Binding 'eval' in strict mode (1:9)" + ], + "program": { + "type": "Program", + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, + "id": { + "type": "Identifier", + "start":9,"end":13,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":13},"identifierName":"eval"}, + "name": "eval" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":16,"end":32,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":32}}, + "body": [], + "directives": [ + { + "type": "Directive", + "start":17,"end":30,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":30}}, + "value": { + "type": "DirectiveLiteral", + "start":17,"end":29,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":29}}, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0202/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0202/options.json deleted file mode 100644 index 80b8b2d85caa..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0202/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'arguments' in strict mode (1:9)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0202/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0202/output.json new file mode 100644 index 000000000000..2c691b4f70f1 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0202/output.json @@ -0,0 +1,48 @@ +{ + "type": "File", + "start":0,"end":37,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":37}}, + "errors": [ + "SyntaxError: Binding 'arguments' in strict mode (1:9)" + ], + "program": { + "type": "Program", + "start":0,"end":37,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":37}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":37,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":37}}, + "id": { + "type": "Identifier", + "start":9,"end":18,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":18},"identifierName":"arguments"}, + "name": "arguments" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":21,"end":37,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":37}}, + "body": [], + "directives": [ + { + "type": "Directive", + "start":22,"end":35,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":35}}, + "value": { + "type": "DirectiveLiteral", + "start":22,"end":34,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":34}}, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0203/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0203/options.json deleted file mode 100644 index 706ba8380c70..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0203/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'eval' in strict mode (1:42)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0203/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0203/output.json new file mode 100644 index 000000000000..9e3046fe279b --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0203/output.json @@ -0,0 +1,80 @@ +{ + "type": "File", + "start":0,"end":57,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":57}}, + "errors": [ + "SyntaxError: Binding 'eval' in strict mode (1:42)" + ], + "program": { + "type": "Program", + "start":0,"end":57,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":57}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":57,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":57}}, + "id": { + "type": "Identifier", + "start":9,"end":14,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":14},"identifierName":"hello"}, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":17,"end":57,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":57}}, + "body": [ + { + "type": "ExpressionStatement", + "start":32,"end":55,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":55}}, + "expression": { + "type": "CallExpression", + "start":33,"end":54,"loc":{"start":{"line":1,"column":33},"end":{"line":1,"column":54}}, + "callee": { + "type": "FunctionExpression", + "start":33,"end":52,"loc":{"start":{"line":1,"column":33},"end":{"line":1,"column":52}}, + "id": { + "type": "Identifier", + "start":42,"end":46,"loc":{"start":{"line":1,"column":42},"end":{"line":1,"column":46},"identifierName":"eval"}, + "name": "eval" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":49,"end":52,"loc":{"start":{"line":1,"column":49},"end":{"line":1,"column":52}}, + "body": [], + "directives": [] + } + }, + "arguments": [], + "extra": { + "parenthesized": true, + "parenStart": 32 + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start":18,"end":31,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":31}}, + "value": { + "type": "DirectiveLiteral", + "start":18,"end":30,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":30}}, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0204/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0204/options.json deleted file mode 100644 index d0e461af3911..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0204/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'arguments' in strict mode (1:42)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0204/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0204/output.json new file mode 100644 index 000000000000..2502c52e184c --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0204/output.json @@ -0,0 +1,80 @@ +{ + "type": "File", + "start":0,"end":62,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":62}}, + "errors": [ + "SyntaxError: Binding 'arguments' in strict mode (1:42)" + ], + "program": { + "type": "Program", + "start":0,"end":62,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":62}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":62,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":62}}, + "id": { + "type": "Identifier", + "start":9,"end":14,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":14},"identifierName":"hello"}, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":17,"end":62,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":62}}, + "body": [ + { + "type": "ExpressionStatement", + "start":32,"end":60,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":60}}, + "expression": { + "type": "CallExpression", + "start":33,"end":59,"loc":{"start":{"line":1,"column":33},"end":{"line":1,"column":59}}, + "callee": { + "type": "FunctionExpression", + "start":33,"end":57,"loc":{"start":{"line":1,"column":33},"end":{"line":1,"column":57}}, + "id": { + "type": "Identifier", + "start":42,"end":51,"loc":{"start":{"line":1,"column":42},"end":{"line":1,"column":51},"identifierName":"arguments"}, + "name": "arguments" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":54,"end":57,"loc":{"start":{"line":1,"column":54},"end":{"line":1,"column":57}}, + "body": [], + "directives": [] + } + }, + "arguments": [], + "extra": { + "parenthesized": true, + "parenStart": 32 + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start":18,"end":31,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":31}}, + "value": { + "type": "DirectiveLiteral", + "start":18,"end":30,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":30}}, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0205/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0205/options.json deleted file mode 100644 index ee2e7d7c7745..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0205/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'eval' in strict mode (1:10)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0205/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0205/output.json new file mode 100644 index 000000000000..887c41149531 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0205/output.json @@ -0,0 +1,61 @@ +{ + "type": "File", + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, + "errors": [ + "SyntaxError: Binding 'eval' in strict mode (1:10)" + ], + "program": { + "type": "Program", + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, + "expression": { + "type": "CallExpression", + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, + "callee": { + "type": "FunctionExpression", + "start":1,"end":33,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":33}}, + "id": { + "type": "Identifier", + "start":10,"end":14,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":14},"identifierName":"eval"}, + "name": "eval" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":17,"end":33,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":33}}, + "body": [], + "directives": [ + { + "type": "Directive", + "start":18,"end":31,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":31}}, + "value": { + "type": "DirectiveLiteral", + "start":18,"end":30,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":30}}, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + }, + "extra": { + "parenthesized": true, + "parenStart": 0 + } + }, + "arguments": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0206/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0206/options.json deleted file mode 100644 index bb4b812bab32..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0206/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'arguments' in strict mode (1:10)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0206/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0206/output.json new file mode 100644 index 000000000000..250afef7d81d --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0206/output.json @@ -0,0 +1,61 @@ +{ + "type": "File", + "start":0,"end":41,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":41}}, + "errors": [ + "SyntaxError: Binding 'arguments' in strict mode (1:10)" + ], + "program": { + "type": "Program", + "start":0,"end":41,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":41}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":41,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":41}}, + "expression": { + "type": "CallExpression", + "start":0,"end":41,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":41}}, + "callee": { + "type": "FunctionExpression", + "start":1,"end":38,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":38}}, + "id": { + "type": "Identifier", + "start":10,"end":19,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":19},"identifierName":"arguments"}, + "name": "arguments" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":22,"end":38,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":38}}, + "body": [], + "directives": [ + { + "type": "Directive", + "start":23,"end":36,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":36}}, + "value": { + "type": "DirectiveLiteral", + "start":23,"end":35,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":35}}, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + }, + "extra": { + "parenthesized": true, + "parenStart": 0 + } + }, + "arguments": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0207/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0207/options.json deleted file mode 100644 index b5fd79ff5ff1..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0207/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'eval' in strict mode (1:47)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0207/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0207/output.json new file mode 100644 index 000000000000..03985eff0b57 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0207/output.json @@ -0,0 +1,93 @@ +{ + "type": "File", + "start":0,"end":63,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":63}}, + "errors": [ + "SyntaxError: Binding 'eval' in strict mode (1:47)" + ], + "program": { + "type": "Program", + "start":0,"end":63,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":63}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":63,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":63}}, + "id": { + "type": "Identifier", + "start":9,"end":14,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":14},"identifierName":"hello"}, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":17,"end":63,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":63}}, + "body": [ + { + "type": "ExpressionStatement", + "start":32,"end":61,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":61}}, + "expression": { + "type": "ObjectExpression", + "start":33,"end":59,"loc":{"start":{"line":1,"column":33},"end":{"line":1,"column":59}}, + "properties": [ + { + "type": "ObjectProperty", + "start":35,"end":57,"loc":{"start":{"line":1,"column":35},"end":{"line":1,"column":57}}, + "method": false, + "key": { + "type": "Identifier", + "start":35,"end":36,"loc":{"start":{"line":1,"column":35},"end":{"line":1,"column":36},"identifierName":"s"}, + "name": "s" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "FunctionExpression", + "start":38,"end":57,"loc":{"start":{"line":1,"column":38},"end":{"line":1,"column":57}}, + "id": { + "type": "Identifier", + "start":47,"end":51,"loc":{"start":{"line":1,"column":47},"end":{"line":1,"column":51},"identifierName":"eval"}, + "name": "eval" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":54,"end":57,"loc":{"start":{"line":1,"column":54},"end":{"line":1,"column":57}}, + "body": [], + "directives": [] + } + } + } + ], + "extra": { + "parenthesized": true, + "parenStart": 32 + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start":18,"end":31,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":31}}, + "value": { + "type": "DirectiveLiteral", + "start":18,"end":30,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":30}}, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0208/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0208/options.json deleted file mode 100644 index ff90f09173c4..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0208/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'package' in strict mode (1:10)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0208/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0208/output.json new file mode 100644 index 000000000000..29ce013f0b8b --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0208/output.json @@ -0,0 +1,61 @@ +{ + "type": "File", + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":39}}, + "errors": [ + "SyntaxError: Binding 'package' in strict mode (1:10)" + ], + "program": { + "type": "Program", + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":39}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":39}}, + "expression": { + "type": "CallExpression", + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":39}}, + "callee": { + "type": "FunctionExpression", + "start":1,"end":36,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":36}}, + "id": { + "type": "Identifier", + "start":10,"end":17,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":17},"identifierName":"package"}, + "name": "package" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":20,"end":36,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":36}}, + "body": [], + "directives": [ + { + "type": "Directive", + "start":21,"end":34,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":34}}, + "value": { + "type": "DirectiveLiteral", + "start":21,"end":33,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":33}}, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + }, + "extra": { + "parenthesized": true, + "parenStart": 0 + } + }, + "arguments": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0209/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0209/options.json deleted file mode 100644 index b8f97ca4fe56..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0209/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'eval' in strict mode (1:48)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0209/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0209/output.json new file mode 100644 index 000000000000..60d4df26f9f4 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0209/output.json @@ -0,0 +1,112 @@ +{ + "type": "File", + "start":0,"end":63,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":63}}, + "errors": [ + "SyntaxError: Binding 'eval' in strict mode (1:48)" + ], + "program": { + "type": "Program", + "start":0,"end":63,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":63}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":63,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":63}}, + "id": { + "type": "Identifier", + "start":9,"end":14,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":14},"identifierName":"hello"}, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":17,"end":63,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":63}}, + "body": [ + { + "type": "ExpressionStatement", + "start":32,"end":61,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":61}}, + "expression": { + "type": "ObjectExpression", + "start":33,"end":59,"loc":{"start":{"line":1,"column":33},"end":{"line":1,"column":59}}, + "properties": [ + { + "type": "ObjectProperty", + "start":35,"end":40,"loc":{"start":{"line":1,"column":35},"end":{"line":1,"column":40}}, + "method": false, + "key": { + "type": "Identifier", + "start":35,"end":36,"loc":{"start":{"line":1,"column":35},"end":{"line":1,"column":36},"identifierName":"i"}, + "name": "i" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "NumericLiteral", + "start":38,"end":40,"loc":{"start":{"line":1,"column":38},"end":{"line":1,"column":40}}, + "extra": { + "rawValue": 10, + "raw": "10" + }, + "value": 10 + } + }, + { + "type": "ObjectMethod", + "start":42,"end":57,"loc":{"start":{"line":1,"column":42},"end":{"line":1,"column":57}}, + "method": false, + "key": { + "type": "Identifier", + "start":46,"end":47,"loc":{"start":{"line":1,"column":46},"end":{"line":1,"column":47},"identifierName":"s"}, + "name": "s" + }, + "computed": false, + "kind": "set", + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start":48,"end":52,"loc":{"start":{"line":1,"column":48},"end":{"line":1,"column":52},"identifierName":"eval"}, + "name": "eval" + } + ], + "body": { + "type": "BlockStatement", + "start":54,"end":57,"loc":{"start":{"line":1,"column":54},"end":{"line":1,"column":57}}, + "body": [], + "directives": [] + } + } + ], + "extra": { + "parenthesized": true, + "parenStart": 32 + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start":18,"end":31,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":31}}, + "value": { + "type": "DirectiveLiteral", + "start":18,"end":30,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":30}}, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0210/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0210/options.json deleted file mode 100644 index 6db4ae7bf008..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0210/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'eval' in strict mode (1:41)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0210/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0210/output.json new file mode 100644 index 000000000000..4ee83b14028e --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0210/output.json @@ -0,0 +1,91 @@ +{ + "type": "File", + "start":0,"end":56,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":56}}, + "errors": [ + "SyntaxError: Binding 'eval' in strict mode (1:41)" + ], + "program": { + "type": "Program", + "start":0,"end":56,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":56}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":56,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":56}}, + "id": { + "type": "Identifier", + "start":9,"end":14,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":14},"identifierName":"hello"}, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":17,"end":56,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":56}}, + "body": [ + { + "type": "ExpressionStatement", + "start":32,"end":54,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":54}}, + "expression": { + "type": "ObjectExpression", + "start":33,"end":52,"loc":{"start":{"line":1,"column":33},"end":{"line":1,"column":52}}, + "properties": [ + { + "type": "ObjectMethod", + "start":35,"end":50,"loc":{"start":{"line":1,"column":35},"end":{"line":1,"column":50}}, + "method": false, + "key": { + "type": "Identifier", + "start":39,"end":40,"loc":{"start":{"line":1,"column":39},"end":{"line":1,"column":40},"identifierName":"s"}, + "name": "s" + }, + "computed": false, + "kind": "set", + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start":41,"end":45,"loc":{"start":{"line":1,"column":41},"end":{"line":1,"column":45},"identifierName":"eval"}, + "name": "eval" + } + ], + "body": { + "type": "BlockStatement", + "start":47,"end":50,"loc":{"start":{"line":1,"column":47},"end":{"line":1,"column":50}}, + "body": [], + "directives": [] + } + } + ], + "extra": { + "parenthesized": true, + "parenStart": 32 + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start":18,"end":31,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":31}}, + "value": { + "type": "DirectiveLiteral", + "start":18,"end":30,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":30}}, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0211/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0211/options.json deleted file mode 100644 index e80a856d48a0..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0211/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'eval' in strict mode (1:49)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0211/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0211/output.json new file mode 100644 index 000000000000..0c8905156ab1 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0211/output.json @@ -0,0 +1,99 @@ +{ + "type": "File", + "start":0,"end":64,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":64}}, + "errors": [ + "SyntaxError: Binding 'eval' in strict mode (1:49)" + ], + "program": { + "type": "Program", + "start":0,"end":64,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":64}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":64,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":64}}, + "id": { + "type": "Identifier", + "start":9,"end":14,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":14},"identifierName":"hello"}, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":17,"end":64,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":64}}, + "body": [ + { + "type": "ExpressionStatement", + "start":32,"end":62,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":62}}, + "expression": { + "type": "ObjectExpression", + "start":33,"end":60,"loc":{"start":{"line":1,"column":33},"end":{"line":1,"column":60}}, + "properties": [ + { + "type": "ObjectProperty", + "start":35,"end":58,"loc":{"start":{"line":1,"column":35},"end":{"line":1,"column":58}}, + "method": false, + "key": { + "type": "Identifier", + "start":35,"end":36,"loc":{"start":{"line":1,"column":35},"end":{"line":1,"column":36},"identifierName":"s"}, + "name": "s" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "FunctionExpression", + "start":38,"end":58,"loc":{"start":{"line":1,"column":38},"end":{"line":1,"column":58}}, + "id": { + "type": "Identifier", + "start":47,"end":48,"loc":{"start":{"line":1,"column":47},"end":{"line":1,"column":48},"identifierName":"s"}, + "name": "s" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start":49,"end":53,"loc":{"start":{"line":1,"column":49},"end":{"line":1,"column":53},"identifierName":"eval"}, + "name": "eval" + } + ], + "body": { + "type": "BlockStatement", + "start":55,"end":58,"loc":{"start":{"line":1,"column":55},"end":{"line":1,"column":58}}, + "body": [], + "directives": [] + } + } + } + ], + "extra": { + "parenthesized": true, + "parenStart": 32 + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start":18,"end":31,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":31}}, + "value": { + "type": "DirectiveLiteral", + "start":18,"end":30,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":30}}, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0212/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0212/options.json deleted file mode 100644 index d93d5b2aa62e..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0212/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'eval' in strict mode (1:15)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0212/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0212/output.json new file mode 100644 index 000000000000..3ccaace1b183 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0212/output.json @@ -0,0 +1,54 @@ +{ + "type": "File", + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, + "errors": [ + "SyntaxError: Binding 'eval' in strict mode (1:15)" + ], + "program": { + "type": "Program", + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, + "id": { + "type": "Identifier", + "start":9,"end":14,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":14},"identifierName":"hello"}, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start":15,"end":19,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":19},"identifierName":"eval"}, + "name": "eval" + } + ], + "body": { + "type": "BlockStatement", + "start":21,"end":36,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":36}}, + "body": [], + "directives": [ + { + "type": "Directive", + "start":22,"end":35,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":35}}, + "value": { + "type": "DirectiveLiteral", + "start":22,"end":34,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":34}}, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0213/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0213/options.json deleted file mode 100644 index 5d2dc563b16e..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0213/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'arguments' in strict mode (1:15)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0213/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0213/output.json new file mode 100644 index 000000000000..dc142e76101d --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0213/output.json @@ -0,0 +1,54 @@ +{ + "type": "File", + "start":0,"end":41,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":41}}, + "errors": [ + "SyntaxError: Binding 'arguments' in strict mode (1:15)" + ], + "program": { + "type": "Program", + "start":0,"end":41,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":41}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":41,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":41}}, + "id": { + "type": "Identifier", + "start":9,"end":14,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":14},"identifierName":"hello"}, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start":15,"end":24,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":24},"identifierName":"arguments"}, + "name": "arguments" + } + ], + "body": { + "type": "BlockStatement", + "start":26,"end":41,"loc":{"start":{"line":1,"column":26},"end":{"line":1,"column":41}}, + "body": [], + "directives": [ + { + "type": "Directive", + "start":27,"end":40,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":40}}, + "value": { + "type": "DirectiveLiteral", + "start":27,"end":39,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":39}}, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0214/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0214/options.json deleted file mode 100644 index b8f97ca4fe56..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0214/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'eval' in strict mode (1:48)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0214/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0214/output.json new file mode 100644 index 000000000000..d887db53f5e6 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0214/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start":0,"end":58,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":58}}, + "errors": [ + "SyntaxError: Binding 'eval' in strict mode (1:48)" + ], + "program": { + "type": "Program", + "start":0,"end":58,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":58}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":58,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":58}}, + "id": { + "type": "Identifier", + "start":9,"end":14,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":14},"identifierName":"hello"}, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":17,"end":58,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":58}}, + "body": [ + { + "type": "FunctionDeclaration", + "start":33,"end":56,"loc":{"start":{"line":1,"column":33},"end":{"line":1,"column":56}}, + "id": { + "type": "Identifier", + "start":42,"end":47,"loc":{"start":{"line":1,"column":42},"end":{"line":1,"column":47},"identifierName":"inner"}, + "name": "inner" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start":48,"end":52,"loc":{"start":{"line":1,"column":48},"end":{"line":1,"column":52},"identifierName":"eval"}, + "name": "eval" + } + ], + "body": { + "type": "BlockStatement", + "start":54,"end":56,"loc":{"start":{"line":1,"column":54},"end":{"line":1,"column":56}}, + "body": [], + "directives": [] + } + } + ], + "directives": [ + { + "type": "Directive", + "start":19,"end":32,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":32}}, + "value": { + "type": "DirectiveLiteral", + "start":19,"end":31,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":31}}, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0215/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0215/options.json deleted file mode 100644 index ab7000409bab..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0215/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'arguments' in strict mode (1:48)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0215/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0215/output.json new file mode 100644 index 000000000000..ded181413784 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0215/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start":0,"end":63,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":63}}, + "errors": [ + "SyntaxError: Binding 'arguments' in strict mode (1:48)" + ], + "program": { + "type": "Program", + "start":0,"end":63,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":63}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":63,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":63}}, + "id": { + "type": "Identifier", + "start":9,"end":14,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":14},"identifierName":"hello"}, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":17,"end":63,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":63}}, + "body": [ + { + "type": "FunctionDeclaration", + "start":33,"end":61,"loc":{"start":{"line":1,"column":33},"end":{"line":1,"column":61}}, + "id": { + "type": "Identifier", + "start":42,"end":47,"loc":{"start":{"line":1,"column":42},"end":{"line":1,"column":47},"identifierName":"inner"}, + "name": "inner" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start":48,"end":57,"loc":{"start":{"line":1,"column":48},"end":{"line":1,"column":57},"identifierName":"arguments"}, + "name": "arguments" + } + ], + "body": { + "type": "BlockStatement", + "start":59,"end":61,"loc":{"start":{"line":1,"column":59},"end":{"line":1,"column":61}}, + "body": [], + "directives": [] + } + } + ], + "directives": [ + { + "type": "Directive", + "start":19,"end":32,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":32}}, + "value": { + "type": "DirectiveLiteral", + "start":19,"end":31,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":31}}, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0216/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0216/options.json deleted file mode 100644 index 61a5834b639e..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0216/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Octal literal in strict mode (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0216/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0216/output.json new file mode 100644 index 000000000000..7d00761d5560 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0216/output.json @@ -0,0 +1,42 @@ +{ + "type": "File", + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, + "errors": [ + "SyntaxError: Legacy octal literals are not allowed in strict mode (1:2)" + ], + "program": { + "type": "Program", + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, + "sourceType": "script", + "interpreter": null, + "body": [], + "directives": [ + { + "type": "Directive", + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, + "value": { + "type": "DirectiveLiteral", + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, + "value": "\\1", + "extra": { + "raw": "\"\\1\"", + "rawValue": "\\1" + } + } + }, + { + "type": "Directive", + "start":6,"end":19,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":19}}, + "value": { + "type": "DirectiveLiteral", + "start":6,"end":18,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":18}}, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0217/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0217/options.json deleted file mode 100644 index ae2bfab55c68..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0217/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Octal literal in strict mode (1:35)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0217/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0217/output.json new file mode 100644 index 000000000000..a7ce0eaeba38 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0217/output.json @@ -0,0 +1,61 @@ +{ + "type": "File", + "start":0,"end":40,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":40}}, + "errors": [ + "SyntaxError: Legacy octal literals are not allowed in strict mode (1:35)" + ], + "program": { + "type": "Program", + "start":0,"end":40,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":40}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":40,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":40}}, + "id": { + "type": "Identifier", + "start":9,"end":14,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":14},"identifierName":"hello"}, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":17,"end":40,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":40}}, + "body": [], + "directives": [ + { + "type": "Directive", + "start":19,"end":32,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":32}}, + "value": { + "type": "DirectiveLiteral", + "start":19,"end":31,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":31}}, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + }, + { + "type": "Directive", + "start":33,"end":38,"loc":{"start":{"line":1,"column":33},"end":{"line":1,"column":38}}, + "value": { + "type": "DirectiveLiteral", + "start":33,"end":37,"loc":{"start":{"line":1,"column":33},"end":{"line":1,"column":37}}, + "value": "\\1", + "extra": { + "raw": "\"\\1\"", + "rawValue": "\\1" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0218/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0218/options.json deleted file mode 100644 index 45ca229c1e8e..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0218/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Legacy octal literals are not allowed in strict mode (1:33)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0218/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0218/output.json new file mode 100644 index 000000000000..f4096149d8ed --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0218/output.json @@ -0,0 +1,62 @@ +{ + "type": "File", + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":39}}, + "errors": [ + "SyntaxError: Legacy octal literals are not allowed in strict mode (1:33)" + ], + "program": { + "type": "Program", + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":39}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":39}}, + "id": { + "type": "Identifier", + "start":9,"end":14,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":14},"identifierName":"hello"}, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":17,"end":39,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":39}}, + "body": [ + { + "type": "ExpressionStatement", + "start":33,"end":37,"loc":{"start":{"line":1,"column":33},"end":{"line":1,"column":37}}, + "expression": { + "type": "NumericLiteral", + "start":33,"end":36,"loc":{"start":{"line":1,"column":33},"end":{"line":1,"column":36}}, + "extra": { + "rawValue": 17, + "raw": "021" + }, + "value": 17 + } + } + ], + "directives": [ + { + "type": "Directive", + "start":19,"end":32,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":32}}, + "value": { + "type": "DirectiveLiteral", + "start":19,"end":31,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":31}}, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0219/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0219/options.json deleted file mode 100644 index 7e50b5f9165e..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0219/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Octal literal in strict mode (1:38)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0219/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0219/output.json new file mode 100644 index 000000000000..2c29a7df14b9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0219/output.json @@ -0,0 +1,88 @@ +{ + "type": "File", + "start":0,"end":50,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":50}}, + "errors": [ + "SyntaxError: Legacy octal literals are not allowed in strict mode (1:38)" + ], + "program": { + "type": "Program", + "start":0,"end":50,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":50}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":50,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":50}}, + "id": { + "type": "Identifier", + "start":9,"end":14,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":14},"identifierName":"hello"}, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":17,"end":50,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":50}}, + "body": [ + { + "type": "ExpressionStatement", + "start":33,"end":48,"loc":{"start":{"line":1,"column":33},"end":{"line":1,"column":48}}, + "expression": { + "type": "ObjectExpression", + "start":34,"end":46,"loc":{"start":{"line":1,"column":34},"end":{"line":1,"column":46}}, + "properties": [ + { + "type": "ObjectProperty", + "start":36,"end":44,"loc":{"start":{"line":1,"column":36},"end":{"line":1,"column":44}}, + "method": false, + "key": { + "type": "StringLiteral", + "start":36,"end":40,"loc":{"start":{"line":1,"column":36},"end":{"line":1,"column":40}}, + "extra": { + "rawValue": "\u0001", + "raw": "\"\\1\"" + }, + "value": "\u0001" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "NumericLiteral", + "start":42,"end":44,"loc":{"start":{"line":1,"column":42},"end":{"line":1,"column":44}}, + "extra": { + "rawValue": 42, + "raw": "42" + }, + "value": 42 + } + } + ], + "extra": { + "parenthesized": true, + "parenStart": 33 + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start":19,"end":32,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":32}}, + "value": { + "type": "DirectiveLiteral", + "start":19,"end":31,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":31}}, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0220/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0220/options.json deleted file mode 100644 index 8f6c8218f747..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0220/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Legacy octal literals are not allowed in strict mode (1:36)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0220/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0220/output.json new file mode 100644 index 000000000000..8caf22da60fa --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0220/output.json @@ -0,0 +1,88 @@ +{ + "type": "File", + "start":0,"end":49,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":49}}, + "errors": [ + "SyntaxError: Legacy octal literals are not allowed in strict mode (1:36)" + ], + "program": { + "type": "Program", + "start":0,"end":49,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":49}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":49,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":49}}, + "id": { + "type": "Identifier", + "start":9,"end":14,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":14},"identifierName":"hello"}, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":17,"end":49,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":49}}, + "body": [ + { + "type": "ExpressionStatement", + "start":33,"end":47,"loc":{"start":{"line":1,"column":33},"end":{"line":1,"column":47}}, + "expression": { + "type": "ObjectExpression", + "start":34,"end":45,"loc":{"start":{"line":1,"column":34},"end":{"line":1,"column":45}}, + "properties": [ + { + "type": "ObjectProperty", + "start":36,"end":43,"loc":{"start":{"line":1,"column":36},"end":{"line":1,"column":43}}, + "method": false, + "key": { + "type": "NumericLiteral", + "start":36,"end":39,"loc":{"start":{"line":1,"column":36},"end":{"line":1,"column":39}}, + "extra": { + "rawValue": 17, + "raw": "021" + }, + "value": 17 + }, + "computed": false, + "shorthand": false, + "value": { + "type": "NumericLiteral", + "start":41,"end":43,"loc":{"start":{"line":1,"column":41},"end":{"line":1,"column":43}}, + "extra": { + "rawValue": 42, + "raw": "42" + }, + "value": 42 + } + } + ], + "extra": { + "parenthesized": true, + "parenStart": 33 + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start":19,"end":32,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":32}}, + "value": { + "type": "DirectiveLiteral", + "start":19,"end":31,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":31}}, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0221/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0221/options.json deleted file mode 100644 index d094fe0284b1..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0221/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Octal literal in strict mode (1:36)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0221/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0221/output.json new file mode 100644 index 000000000000..13226ad50009 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0221/output.json @@ -0,0 +1,61 @@ +{ + "type": "File", + "start":0,"end":55,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":55}}, + "errors": [ + "SyntaxError: Legacy octal literals are not allowed in strict mode (1:36)" + ], + "program": { + "type": "Program", + "start":0,"end":55,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":55}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":55,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":55}}, + "id": { + "type": "Identifier", + "start":9,"end":14,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":14},"identifierName":"hello"}, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":17,"end":55,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":55}}, + "body": [], + "directives": [ + { + "type": "Directive", + "start":19,"end":39,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":39}}, + "value": { + "type": "DirectiveLiteral", + "start":19,"end":38,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":38}}, + "value": "octal directive\\1", + "extra": { + "raw": "\"octal directive\\1\"", + "rawValue": "octal directive\\1" + } + } + }, + { + "type": "Directive", + "start":40,"end":53,"loc":{"start":{"line":1,"column":40},"end":{"line":1,"column":53}}, + "value": { + "type": "DirectiveLiteral", + "start":40,"end":52,"loc":{"start":{"line":1,"column":40},"end":{"line":1,"column":52}}, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0222/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0222/options.json deleted file mode 100644 index d094fe0284b1..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0222/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Octal literal in strict mode (1:36)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0222/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0222/output.json new file mode 100644 index 000000000000..43d10e291259 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0222/output.json @@ -0,0 +1,75 @@ +{ + "type": "File", + "start":0,"end":76,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":76}}, + "errors": [ + "SyntaxError: Legacy octal literals are not allowed in strict mode (1:36)", + "SyntaxError: Legacy octal literals are not allowed in strict mode (1:57)" + ], + "program": { + "type": "Program", + "start":0,"end":76,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":76}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":76,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":76}}, + "id": { + "type": "Identifier", + "start":9,"end":14,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":14},"identifierName":"hello"}, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":17,"end":76,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":76}}, + "body": [], + "directives": [ + { + "type": "Directive", + "start":19,"end":39,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":39}}, + "value": { + "type": "DirectiveLiteral", + "start":19,"end":38,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":38}}, + "value": "octal directive\\1", + "extra": { + "raw": "\"octal directive\\1\"", + "rawValue": "octal directive\\1" + } + } + }, + { + "type": "Directive", + "start":40,"end":60,"loc":{"start":{"line":1,"column":40},"end":{"line":1,"column":60}}, + "value": { + "type": "DirectiveLiteral", + "start":40,"end":59,"loc":{"start":{"line":1,"column":40},"end":{"line":1,"column":59}}, + "value": "octal directive\\2", + "extra": { + "raw": "\"octal directive\\2\"", + "rawValue": "octal directive\\2" + } + } + }, + { + "type": "Directive", + "start":61,"end":74,"loc":{"start":{"line":1,"column":61},"end":{"line":1,"column":74}}, + "value": { + "type": "DirectiveLiteral", + "start":61,"end":73,"loc":{"start":{"line":1,"column":61},"end":{"line":1,"column":73}}, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0223/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0223/options.json deleted file mode 100644 index 8389b2c726ca..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0223/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Octal literal in strict mode (1:69)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0223/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0223/output.json new file mode 100644 index 000000000000..d559db4b5683 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0223/output.json @@ -0,0 +1,81 @@ +{ + "type": "File", + "start":0,"end":76,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":76}}, + "errors": [ + "SyntaxError: Legacy octal literals are not allowed in strict mode (1:69)" + ], + "program": { + "type": "Program", + "start":0,"end":76,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":76}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":76,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":76}}, + "id": { + "type": "Identifier", + "start":9,"end":14,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":14},"identifierName":"hello"}, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":17,"end":76,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":76}}, + "body": [ + { + "type": "FunctionDeclaration", + "start":33,"end":74,"loc":{"start":{"line":1,"column":33},"end":{"line":1,"column":74}}, + "id": { + "type": "Identifier", + "start":42,"end":47,"loc":{"start":{"line":1,"column":42},"end":{"line":1,"column":47},"identifierName":"inner"}, + "name": "inner" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":50,"end":74,"loc":{"start":{"line":1,"column":50},"end":{"line":1,"column":74}}, + "body": [], + "directives": [ + { + "type": "Directive", + "start":52,"end":72,"loc":{"start":{"line":1,"column":52},"end":{"line":1,"column":72}}, + "value": { + "type": "DirectiveLiteral", + "start":52,"end":71,"loc":{"start":{"line":1,"column":52},"end":{"line":1,"column":71}}, + "value": "octal directive\\1", + "extra": { + "raw": "\"octal directive\\1\"", + "rawValue": "octal directive\\1" + } + } + } + ] + } + } + ], + "directives": [ + { + "type": "Directive", + "start":19,"end":32,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":32}}, + "value": { + "type": "DirectiveLiteral", + "start":19,"end":31,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":31}}, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0224/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0224/options.json deleted file mode 100644 index 0641de45e29a..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0224/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected reserved word 'implements' (1:37)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0224/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0224/output.json new file mode 100644 index 000000000000..a3eee1ca1117 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0224/output.json @@ -0,0 +1,66 @@ +{ + "type": "File", + "start":0,"end":50,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":50}}, + "errors": [ + "SyntaxError: Unexpected reserved word 'implements' (1:37)" + ], + "program": { + "type": "Program", + "start":0,"end":50,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":50}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":50,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":50}}, + "id": { + "type": "Identifier", + "start":9,"end":14,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":14},"identifierName":"hello"}, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":17,"end":50,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":50}}, + "body": [ + { + "type": "VariableDeclaration", + "start":33,"end":48,"loc":{"start":{"line":1,"column":33},"end":{"line":1,"column":48}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":37,"end":47,"loc":{"start":{"line":1,"column":37},"end":{"line":1,"column":47}}, + "id": { + "type": "Identifier", + "start":37,"end":47,"loc":{"start":{"line":1,"column":37},"end":{"line":1,"column":47},"identifierName":"implements"}, + "name": "implements" + }, + "init": null + } + ], + "kind": "var" + } + ], + "directives": [ + { + "type": "Directive", + "start":19,"end":32,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":32}}, + "value": { + "type": "DirectiveLiteral", + "start":19,"end":31,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":31}}, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0225/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0225/options.json deleted file mode 100644 index 859238d0423f..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0225/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected reserved word 'interface' (1:37)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0225/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0225/output.json new file mode 100644 index 000000000000..cffcb241d435 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0225/output.json @@ -0,0 +1,66 @@ +{ + "type": "File", + "start":0,"end":49,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":49}}, + "errors": [ + "SyntaxError: Unexpected reserved word 'interface' (1:37)" + ], + "program": { + "type": "Program", + "start":0,"end":49,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":49}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":49,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":49}}, + "id": { + "type": "Identifier", + "start":9,"end":14,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":14},"identifierName":"hello"}, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":17,"end":49,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":49}}, + "body": [ + { + "type": "VariableDeclaration", + "start":33,"end":47,"loc":{"start":{"line":1,"column":33},"end":{"line":1,"column":47}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":37,"end":46,"loc":{"start":{"line":1,"column":37},"end":{"line":1,"column":46}}, + "id": { + "type": "Identifier", + "start":37,"end":46,"loc":{"start":{"line":1,"column":37},"end":{"line":1,"column":46},"identifierName":"interface"}, + "name": "interface" + }, + "init": null + } + ], + "kind": "var" + } + ], + "directives": [ + { + "type": "Directive", + "start":19,"end":32,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":32}}, + "value": { + "type": "DirectiveLiteral", + "start":19,"end":31,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":31}}, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0226/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0226/options.json deleted file mode 100644 index 344c7075f4bf..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0226/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected reserved word 'package' (1:37)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0226/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0226/output.json new file mode 100644 index 000000000000..3d7bd0ac8ee4 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0226/output.json @@ -0,0 +1,66 @@ +{ + "type": "File", + "start":0,"end":47,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":47}}, + "errors": [ + "SyntaxError: Unexpected reserved word 'package' (1:37)" + ], + "program": { + "type": "Program", + "start":0,"end":47,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":47}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":47,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":47}}, + "id": { + "type": "Identifier", + "start":9,"end":14,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":14},"identifierName":"hello"}, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":17,"end":47,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":47}}, + "body": [ + { + "type": "VariableDeclaration", + "start":33,"end":45,"loc":{"start":{"line":1,"column":33},"end":{"line":1,"column":45}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":37,"end":44,"loc":{"start":{"line":1,"column":37},"end":{"line":1,"column":44}}, + "id": { + "type": "Identifier", + "start":37,"end":44,"loc":{"start":{"line":1,"column":37},"end":{"line":1,"column":44},"identifierName":"package"}, + "name": "package" + }, + "init": null + } + ], + "kind": "var" + } + ], + "directives": [ + { + "type": "Directive", + "start":19,"end":32,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":32}}, + "value": { + "type": "DirectiveLiteral", + "start":19,"end":31,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":31}}, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0227/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0227/options.json deleted file mode 100644 index 9fb9deaf9cba..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0227/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected reserved word 'private' (1:37)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0227/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0227/output.json new file mode 100644 index 000000000000..4c1f2d2844f0 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0227/output.json @@ -0,0 +1,66 @@ +{ + "type": "File", + "start":0,"end":47,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":47}}, + "errors": [ + "SyntaxError: Unexpected reserved word 'private' (1:37)" + ], + "program": { + "type": "Program", + "start":0,"end":47,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":47}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":47,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":47}}, + "id": { + "type": "Identifier", + "start":9,"end":14,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":14},"identifierName":"hello"}, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":17,"end":47,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":47}}, + "body": [ + { + "type": "VariableDeclaration", + "start":33,"end":45,"loc":{"start":{"line":1,"column":33},"end":{"line":1,"column":45}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":37,"end":44,"loc":{"start":{"line":1,"column":37},"end":{"line":1,"column":44}}, + "id": { + "type": "Identifier", + "start":37,"end":44,"loc":{"start":{"line":1,"column":37},"end":{"line":1,"column":44},"identifierName":"private"}, + "name": "private" + }, + "init": null + } + ], + "kind": "var" + } + ], + "directives": [ + { + "type": "Directive", + "start":19,"end":32,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":32}}, + "value": { + "type": "DirectiveLiteral", + "start":19,"end":31,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":31}}, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0228/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0228/options.json deleted file mode 100644 index 292fb56f1cf3..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0228/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected reserved word 'protected' (1:37)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0228/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0228/output.json new file mode 100644 index 000000000000..dcf994402ae1 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0228/output.json @@ -0,0 +1,66 @@ +{ + "type": "File", + "start":0,"end":49,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":49}}, + "errors": [ + "SyntaxError: Unexpected reserved word 'protected' (1:37)" + ], + "program": { + "type": "Program", + "start":0,"end":49,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":49}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":49,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":49}}, + "id": { + "type": "Identifier", + "start":9,"end":14,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":14},"identifierName":"hello"}, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":17,"end":49,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":49}}, + "body": [ + { + "type": "VariableDeclaration", + "start":33,"end":47,"loc":{"start":{"line":1,"column":33},"end":{"line":1,"column":47}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":37,"end":46,"loc":{"start":{"line":1,"column":37},"end":{"line":1,"column":46}}, + "id": { + "type": "Identifier", + "start":37,"end":46,"loc":{"start":{"line":1,"column":37},"end":{"line":1,"column":46},"identifierName":"protected"}, + "name": "protected" + }, + "init": null + } + ], + "kind": "var" + } + ], + "directives": [ + { + "type": "Directive", + "start":19,"end":32,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":32}}, + "value": { + "type": "DirectiveLiteral", + "start":19,"end":31,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":31}}, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0229/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0229/options.json deleted file mode 100644 index d5f48446906a..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0229/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected reserved word 'public' (1:37)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0229/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0229/output.json new file mode 100644 index 000000000000..c7306ecdb68b --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0229/output.json @@ -0,0 +1,66 @@ +{ + "type": "File", + "start":0,"end":46,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":46}}, + "errors": [ + "SyntaxError: Unexpected reserved word 'public' (1:37)" + ], + "program": { + "type": "Program", + "start":0,"end":46,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":46}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":46,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":46}}, + "id": { + "type": "Identifier", + "start":9,"end":14,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":14},"identifierName":"hello"}, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":17,"end":46,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":46}}, + "body": [ + { + "type": "VariableDeclaration", + "start":33,"end":44,"loc":{"start":{"line":1,"column":33},"end":{"line":1,"column":44}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":37,"end":43,"loc":{"start":{"line":1,"column":37},"end":{"line":1,"column":43}}, + "id": { + "type": "Identifier", + "start":37,"end":43,"loc":{"start":{"line":1,"column":37},"end":{"line":1,"column":43},"identifierName":"public"}, + "name": "public" + }, + "init": null + } + ], + "kind": "var" + } + ], + "directives": [ + { + "type": "Directive", + "start":19,"end":32,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":32}}, + "value": { + "type": "DirectiveLiteral", + "start":19,"end":31,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":31}}, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0230/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0230/options.json deleted file mode 100644 index 0f41ff2e6f24..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0230/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected reserved word 'static' (1:37)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0230/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0230/output.json new file mode 100644 index 000000000000..41fd57994528 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0230/output.json @@ -0,0 +1,66 @@ +{ + "type": "File", + "start":0,"end":46,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":46}}, + "errors": [ + "SyntaxError: Unexpected reserved word 'static' (1:37)" + ], + "program": { + "type": "Program", + "start":0,"end":46,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":46}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":46,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":46}}, + "id": { + "type": "Identifier", + "start":9,"end":14,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":14},"identifierName":"hello"}, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":17,"end":46,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":46}}, + "body": [ + { + "type": "VariableDeclaration", + "start":33,"end":44,"loc":{"start":{"line":1,"column":33},"end":{"line":1,"column":44}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":37,"end":43,"loc":{"start":{"line":1,"column":37},"end":{"line":1,"column":43}}, + "id": { + "type": "Identifier", + "start":37,"end":43,"loc":{"start":{"line":1,"column":37},"end":{"line":1,"column":43},"identifierName":"static"}, + "name": "static" + }, + "init": null + } + ], + "kind": "var" + } + ], + "directives": [ + { + "type": "Directive", + "start":19,"end":32,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":32}}, + "value": { + "type": "DirectiveLiteral", + "start":19,"end":31,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":31}}, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0231/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0231/options.json deleted file mode 100644 index 6ab197f35dc9..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0231/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected reserved word 'yield' (1:37)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0231/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0231/output.json new file mode 100644 index 000000000000..52018c7cba22 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0231/output.json @@ -0,0 +1,66 @@ +{ + "type": "File", + "start":0,"end":45,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":45}}, + "errors": [ + "SyntaxError: Unexpected reserved word 'yield' (1:37)" + ], + "program": { + "type": "Program", + "start":0,"end":45,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":45}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":45,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":45}}, + "id": { + "type": "Identifier", + "start":9,"end":14,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":14},"identifierName":"hello"}, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":17,"end":45,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":45}}, + "body": [ + { + "type": "VariableDeclaration", + "start":33,"end":43,"loc":{"start":{"line":1,"column":33},"end":{"line":1,"column":43}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":37,"end":42,"loc":{"start":{"line":1,"column":37},"end":{"line":1,"column":42}}, + "id": { + "type": "Identifier", + "start":37,"end":42,"loc":{"start":{"line":1,"column":37},"end":{"line":1,"column":42},"identifierName":"yield"}, + "name": "yield" + }, + "init": null + } + ], + "kind": "var" + } + ], + "directives": [ + { + "type": "Directive", + "start":19,"end":32,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":32}}, + "value": { + "type": "DirectiveLiteral", + "start":19,"end":31,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":31}}, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0232/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0232/options.json deleted file mode 100644 index d2f3cbc2e116..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0232/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected reserved word 'let' (1:37)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0232/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0232/output.json new file mode 100644 index 000000000000..d714b3e28e2e --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0232/output.json @@ -0,0 +1,66 @@ +{ + "type": "File", + "start":0,"end":43,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":43}}, + "errors": [ + "SyntaxError: Unexpected reserved word 'let' (1:37)" + ], + "program": { + "type": "Program", + "start":0,"end":43,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":43}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":43,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":43}}, + "id": { + "type": "Identifier", + "start":9,"end":14,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":14},"identifierName":"hello"}, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":17,"end":43,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":43}}, + "body": [ + { + "type": "VariableDeclaration", + "start":33,"end":41,"loc":{"start":{"line":1,"column":33},"end":{"line":1,"column":41}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":37,"end":40,"loc":{"start":{"line":1,"column":37},"end":{"line":1,"column":40}}, + "id": { + "type": "Identifier", + "start":37,"end":40,"loc":{"start":{"line":1,"column":37},"end":{"line":1,"column":40},"identifierName":"let"}, + "name": "let" + }, + "init": null + } + ], + "kind": "var" + } + ], + "directives": [ + { + "type": "Directive", + "start":19,"end":32,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":32}}, + "value": { + "type": "DirectiveLiteral", + "start":19,"end":31,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":31}}, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0233/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0233/options.json deleted file mode 100644 index fff472344fd7..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0233/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'static' in strict mode (1:15)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0233/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0233/output.json new file mode 100644 index 000000000000..160544579047 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0233/output.json @@ -0,0 +1,54 @@ +{ + "type": "File", + "start":0,"end":40,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":40}}, + "errors": [ + "SyntaxError: Binding 'static' in strict mode (1:15)" + ], + "program": { + "type": "Program", + "start":0,"end":40,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":40}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":40,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":40}}, + "id": { + "type": "Identifier", + "start":9,"end":14,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":14},"identifierName":"hello"}, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start":15,"end":21,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":21},"identifierName":"static"}, + "name": "static" + } + ], + "body": { + "type": "BlockStatement", + "start":23,"end":40,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":40}}, + "body": [], + "directives": [ + { + "type": "Directive", + "start":25,"end":38,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":38}}, + "value": { + "type": "DirectiveLiteral", + "start":25,"end":37,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":37}}, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0234/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0234/options.json deleted file mode 100644 index d4d0a96bfb64..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0234/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'static' in strict mode (1:9)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0234/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0234/output.json new file mode 100644 index 000000000000..b184d5881724 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0234/output.json @@ -0,0 +1,48 @@ +{ + "type": "File", + "start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":35}}, + "errors": [ + "SyntaxError: Binding 'static' in strict mode (1:9)" + ], + "program": { + "type": "Program", + "start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":35}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":35}}, + "id": { + "type": "Identifier", + "start":9,"end":15,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":15},"identifierName":"static"}, + "name": "static" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":18,"end":35,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":35}}, + "body": [], + "directives": [ + { + "type": "Directive", + "start":20,"end":33,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":33}}, + "value": { + "type": "DirectiveLiteral", + "start":20,"end":32,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":32}}, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0235/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0235/options.json deleted file mode 100644 index a7490f9321d4..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0235/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'eval' in strict mode (1:9)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0235/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0235/output.json new file mode 100644 index 000000000000..5704449178a7 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0235/output.json @@ -0,0 +1,54 @@ +{ + "type": "File", + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, + "errors": [ + "SyntaxError: Binding 'eval' in strict mode (1:9)" + ], + "program": { + "type": "Program", + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, + "id": { + "type": "Identifier", + "start":9,"end":13,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":13},"identifierName":"eval"}, + "name": "eval" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start":14,"end":15,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":15},"identifierName":"a"}, + "name": "a" + } + ], + "body": { + "type": "BlockStatement", + "start":17,"end":34,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":34}}, + "body": [], + "directives": [ + { + "type": "Directive", + "start":19,"end":32,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":32}}, + "value": { + "type": "DirectiveLiteral", + "start":19,"end":31,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":31}}, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0236/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0236/options.json deleted file mode 100644 index 80b8b2d85caa..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0236/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'arguments' in strict mode (1:9)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0236/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0236/output.json new file mode 100644 index 000000000000..4f8e8d897e7d --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0236/output.json @@ -0,0 +1,54 @@ +{ + "type": "File", + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":39}}, + "errors": [ + "SyntaxError: Binding 'arguments' in strict mode (1:9)" + ], + "program": { + "type": "Program", + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":39}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":39}}, + "id": { + "type": "Identifier", + "start":9,"end":18,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":18},"identifierName":"arguments"}, + "name": "arguments" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start":19,"end":20,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":20},"identifierName":"a"}, + "name": "a" + } + ], + "body": { + "type": "BlockStatement", + "start":22,"end":39,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":39}}, + "body": [], + "directives": [ + { + "type": "Directive", + "start":24,"end":37,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":37}}, + "value": { + "type": "DirectiveLiteral", + "start":24,"end":36,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":36}}, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0239/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0239/options.json deleted file mode 100644 index 91bc36d3f360..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0239/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected reserved word 'static' (1:23)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0239/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0239/output.json new file mode 100644 index 000000000000..07cfc9324623 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0239/output.json @@ -0,0 +1,48 @@ +{ + "type": "File", + "start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":35}}, + "errors": [ + "SyntaxError: Unexpected reserved word 'static' (1:23)" + ], + "program": { + "type": "Program", + "start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":35}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":14,"end":35,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":35}}, + "id": { + "type": "Identifier", + "start":23,"end":29,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":29},"identifierName":"static"}, + "name": "static" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":32,"end":35,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":35}}, + "body": [], + "directives": [] + } + } + ], + "directives": [ + { + "type": "Directive", + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "value": { + "type": "DirectiveLiteral", + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0240/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0240/options.json deleted file mode 100644 index 8b20b9a7df36..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0240/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Argument name clash (1:14)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0240/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0240/output.json new file mode 100644 index 000000000000..3b77c9170b54 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0240/output.json @@ -0,0 +1,59 @@ +{ + "type": "File", + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, + "errors": [ + "SyntaxError: Argument name clash (1:14)" + ], + "program": { + "type": "Program", + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, + "id": { + "type": "Identifier", + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"a"}, + "name": "a" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start":11,"end":12,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":12},"identifierName":"t"}, + "name": "t" + }, + { + "type": "Identifier", + "start":14,"end":15,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":15},"identifierName":"t"}, + "name": "t" + } + ], + "body": { + "type": "BlockStatement", + "start":17,"end":34,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":34}}, + "body": [], + "directives": [ + { + "type": "Directive", + "start":19,"end":32,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":32}}, + "value": { + "type": "DirectiveLiteral", + "start":19,"end":31,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":31}}, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0241/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0241/options.json deleted file mode 100644 index e227bd1a6b74..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0241/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'eval' in strict mode (1:11)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0241/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0241/output.json new file mode 100644 index 000000000000..0581517d990a --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0241/output.json @@ -0,0 +1,54 @@ +{ + "type": "File", + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, + "errors": [ + "SyntaxError: Binding 'eval' in strict mode (1:11)" + ], + "program": { + "type": "Program", + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, + "id": { + "type": "Identifier", + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"a"}, + "name": "a" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start":11,"end":15,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":15},"identifierName":"eval"}, + "name": "eval" + } + ], + "body": { + "type": "BlockStatement", + "start":17,"end":34,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":34}}, + "body": [], + "directives": [ + { + "type": "Directive", + "start":19,"end":32,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":32}}, + "value": { + "type": "DirectiveLiteral", + "start":19,"end":31,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":31}}, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0242/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0242/options.json deleted file mode 100644 index 8e1f9af4ec47..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0242/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'package' in strict mode (1:11)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0242/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0242/output.json new file mode 100644 index 000000000000..aafa09421ccc --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0242/output.json @@ -0,0 +1,54 @@ +{ + "type": "File", + "start":0,"end":37,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":37}}, + "errors": [ + "SyntaxError: Binding 'package' in strict mode (1:11)" + ], + "program": { + "type": "Program", + "start":0,"end":37,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":37}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":37,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":37}}, + "id": { + "type": "Identifier", + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"a"}, + "name": "a" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start":11,"end":18,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":18},"identifierName":"package"}, + "name": "package" + } + ], + "body": { + "type": "BlockStatement", + "start":20,"end":37,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":37}}, + "body": [], + "directives": [ + { + "type": "Directive", + "start":22,"end":35,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":35}}, + "value": { + "type": "DirectiveLiteral", + "start":22,"end":34,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":34}}, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0243/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0243/options.json deleted file mode 100644 index 9d2a58081596..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0243/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Argument name clash (1:43)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0243/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0243/output.json new file mode 100644 index 000000000000..df3094e728a8 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0243/output.json @@ -0,0 +1,82 @@ +{ + "type": "File", + "start":0,"end":52,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":52}}, + "errors": [ + "SyntaxError: Argument name clash (1:43)" + ], + "program": { + "type": "Program", + "start":0,"end":52,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":52}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":52,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":52}}, + "id": { + "type": "Identifier", + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"a"}, + "name": "a" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":13,"end":52,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":52}}, + "body": [ + { + "type": "FunctionDeclaration", + "start":29,"end":49,"loc":{"start":{"line":1,"column":29},"end":{"line":1,"column":49}}, + "id": { + "type": "Identifier", + "start":38,"end":39,"loc":{"start":{"line":1,"column":38},"end":{"line":1,"column":39},"identifierName":"b"}, + "name": "b" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start":40,"end":41,"loc":{"start":{"line":1,"column":40},"end":{"line":1,"column":41},"identifierName":"t"}, + "name": "t" + }, + { + "type": "Identifier", + "start":43,"end":44,"loc":{"start":{"line":1,"column":43},"end":{"line":1,"column":44},"identifierName":"t"}, + "name": "t" + } + ], + "body": { + "type": "BlockStatement", + "start":46,"end":49,"loc":{"start":{"line":1,"column":46},"end":{"line":1,"column":49}}, + "body": [], + "directives": [] + } + }, + { + "type": "EmptyStatement", + "start":49,"end":50,"loc":{"start":{"line":1,"column":49},"end":{"line":1,"column":50}} + } + ], + "directives": [ + { + "type": "Directive", + "start":15,"end":28,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":28}}, + "value": { + "type": "DirectiveLiteral", + "start":15,"end":27,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":27}}, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0244/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0244/options.json deleted file mode 100644 index 61c3bbb5abe0..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0244/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Argument name clash (1:15)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0244/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0244/output.json new file mode 100644 index 000000000000..bcaf874206cd --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0244/output.json @@ -0,0 +1,67 @@ +{ + "type": "File", + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, + "errors": [ + "SyntaxError: Argument name clash (1:15)" + ], + "program": { + "type": "Program", + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, + "expression": { + "type": "FunctionExpression", + "start":1,"end":35,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":35}}, + "id": { + "type": "Identifier", + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11},"identifierName":"a"}, + "name": "a" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start":12,"end":13,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":13},"identifierName":"t"}, + "name": "t" + }, + { + "type": "Identifier", + "start":15,"end":16,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":16},"identifierName":"t"}, + "name": "t" + } + ], + "body": { + "type": "BlockStatement", + "start":18,"end":35,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":35}}, + "body": [], + "directives": [ + { + "type": "Directive", + "start":20,"end":33,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":33}}, + "value": { + "type": "DirectiveLiteral", + "start":20,"end":32,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":32}}, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + }, + "extra": { + "parenthesized": true, + "parenStart": 0 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0245/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0245/options.json deleted file mode 100644 index ae469fbd59da..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0245/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Argument name clash (1:44)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0245/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0245/output.json new file mode 100644 index 000000000000..65f5a908f019 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0245/output.json @@ -0,0 +1,86 @@ +{ + "type": "File", + "start":0,"end":54,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":54}}, + "errors": [ + "SyntaxError: Argument name clash (1:44)" + ], + "program": { + "type": "Program", + "start":0,"end":54,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":54}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":54,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":54}}, + "id": { + "type": "Identifier", + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"a"}, + "name": "a" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":13,"end":54,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":54}}, + "body": [ + { + "type": "ExpressionStatement", + "start":29,"end":52,"loc":{"start":{"line":1,"column":29},"end":{"line":1,"column":52}}, + "expression": { + "type": "FunctionExpression", + "start":30,"end":50,"loc":{"start":{"line":1,"column":30},"end":{"line":1,"column":50}}, + "id": { + "type": "Identifier", + "start":39,"end":40,"loc":{"start":{"line":1,"column":39},"end":{"line":1,"column":40},"identifierName":"b"}, + "name": "b" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start":41,"end":42,"loc":{"start":{"line":1,"column":41},"end":{"line":1,"column":42},"identifierName":"t"}, + "name": "t" + }, + { + "type": "Identifier", + "start":44,"end":45,"loc":{"start":{"line":1,"column":44},"end":{"line":1,"column":45},"identifierName":"t"}, + "name": "t" + } + ], + "body": { + "type": "BlockStatement", + "start":47,"end":50,"loc":{"start":{"line":1,"column":47},"end":{"line":1,"column":50}}, + "body": [], + "directives": [] + }, + "extra": { + "parenthesized": true, + "parenStart": 29 + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start":15,"end":28,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":28}}, + "value": { + "type": "DirectiveLiteral", + "start":15,"end":27,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":27}}, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0246/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0246/options.json deleted file mode 100644 index 3c24c608c88a..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0246/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'eval' in strict mode (1:12)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0246/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0246/output.json new file mode 100644 index 000000000000..a1ab8b4653ea --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0246/output.json @@ -0,0 +1,62 @@ +{ + "type": "File", + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, + "errors": [ + "SyntaxError: Binding 'eval' in strict mode (1:12)" + ], + "program": { + "type": "Program", + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, + "expression": { + "type": "FunctionExpression", + "start":1,"end":35,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":35}}, + "id": { + "type": "Identifier", + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11},"identifierName":"a"}, + "name": "a" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start":12,"end":16,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":16},"identifierName":"eval"}, + "name": "eval" + } + ], + "body": { + "type": "BlockStatement", + "start":18,"end":35,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":35}}, + "body": [], + "directives": [ + { + "type": "Directive", + "start":20,"end":33,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":33}}, + "value": { + "type": "DirectiveLiteral", + "start":20,"end":32,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":32}}, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + }, + "extra": { + "parenthesized": true, + "parenStart": 0 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0247/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0247/options.json deleted file mode 100644 index 96d524816cc9..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0247/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'package' in strict mode (1:12)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0247/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0247/output.json new file mode 100644 index 000000000000..7caed97929d9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0247/output.json @@ -0,0 +1,62 @@ +{ + "type": "File", + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":39}}, + "errors": [ + "SyntaxError: Binding 'package' in strict mode (1:12)" + ], + "program": { + "type": "Program", + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":39}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":39}}, + "expression": { + "type": "FunctionExpression", + "start":1,"end":38,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":38}}, + "id": { + "type": "Identifier", + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11},"identifierName":"a"}, + "name": "a" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start":12,"end":19,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":19},"identifierName":"package"}, + "name": "package" + } + ], + "body": { + "type": "BlockStatement", + "start":21,"end":38,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":38}}, + "body": [], + "directives": [ + { + "type": "Directive", + "start":23,"end":36,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":36}}, + "value": { + "type": "DirectiveLiteral", + "start":23,"end":35,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":35}}, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + }, + "extra": { + "parenthesized": true, + "parenStart": 0 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0248/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0248/options.json deleted file mode 100644 index cb5abd9f7401..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0248/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Label '__proto__' is already declared (1:11)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0248/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0248/output.json new file mode 100644 index 000000000000..df42b7ac7db9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0248/output.json @@ -0,0 +1,47 @@ +{ + "type": "File", + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, + "errors": [ + "SyntaxError: Label '__proto__' is already declared (1:11)" + ], + "program": { + "type": "Program", + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "LabeledStatement", + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, + "body": { + "type": "LabeledStatement", + "start":11,"end":25,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":25}}, + "body": { + "type": "ExpressionStatement", + "start":22,"end":25,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":25}}, + "expression": { + "type": "NumericLiteral", + "start":22,"end":24,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":24}}, + "extra": { + "rawValue": 42, + "raw": "42" + }, + "value": 42 + } + }, + "label": { + "type": "Identifier", + "start":11,"end":20,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":20},"identifierName":"__proto__"}, + "name": "__proto__" + } + }, + "label": { + "type": "Identifier", + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9},"identifierName":"__proto__"}, + "name": "__proto__" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0249/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0249/options.json deleted file mode 100644 index 505798d5a203..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0249/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Argument name clash (1:36)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0249/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0249/output.json new file mode 100644 index 000000000000..27c0fb2e3a31 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0249/output.json @@ -0,0 +1,59 @@ +{ + "type": "File", + "start":0,"end":50,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":50}}, + "errors": [ + "SyntaxError: Argument name clash (1:36)" + ], + "program": { + "type": "Program", + "start":0,"end":50,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":50}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":14,"end":50,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":50}}, + "id": { + "type": "Identifier", + "start":23,"end":24,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":24},"identifierName":"t"}, + "name": "t" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start":25,"end":34,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":34},"identifierName":"__proto__"}, + "name": "__proto__" + }, + { + "type": "Identifier", + "start":36,"end":45,"loc":{"start":{"line":1,"column":36},"end":{"line":1,"column":45},"identifierName":"__proto__"}, + "name": "__proto__" + } + ], + "body": { + "type": "BlockStatement", + "start":47,"end":50,"loc":{"start":{"line":1,"column":47},"end":{"line":1,"column":50}}, + "body": [], + "directives": [] + } + } + ], + "directives": [ + { + "type": "Directive", + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "value": { + "type": "DirectiveLiteral", + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0250/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0250/options.json deleted file mode 100644 index 8e9b9f585996..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0250/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Redefinition of __proto__ property (1:21)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0250/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0250/output.json new file mode 100644 index 000000000000..5b2a545950f5 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0250/output.json @@ -0,0 +1,78 @@ +{ + "type": "File", + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, + "errors": [ + "SyntaxError: Redefinition of __proto__ property (1:21)" + ], + "program": { + "type": "Program", + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, + "expression": { + "type": "AssignmentExpression", + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, + "operator": "=", + "left": { + "type": "Identifier", + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, + "name": "x" + }, + "right": { + "type": "ObjectExpression", + "start":4,"end":36,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":36}}, + "properties": [ + { + "type": "ObjectProperty", + "start":6,"end":19,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":19}}, + "method": false, + "key": { + "type": "Identifier", + "start":6,"end":15,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":15},"identifierName":"__proto__"}, + "name": "__proto__" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "NumericLiteral", + "start":17,"end":19,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":19}}, + "extra": { + "rawValue": 42, + "raw": "42" + }, + "value": 42 + } + }, + { + "type": "ObjectProperty", + "start":21,"end":34,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":34}}, + "method": false, + "key": { + "type": "Identifier", + "start":21,"end":30,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":30},"identifierName":"__proto__"}, + "name": "__proto__" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "NumericLiteral", + "start":32,"end":34,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":34}}, + "extra": { + "rawValue": 43, + "raw": "43" + }, + "value": 43 + } + } + ] + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0270/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0270/options.json deleted file mode 100644 index 8df109cb3c33..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0270/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Classes may not have static property named prototype (1:16)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0270/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0270/output.json new file mode 100644 index 000000000000..cedce7bc2cc8 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0270/output.json @@ -0,0 +1,54 @@ +{ + "type": "File", + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, + "errors": [ + "SyntaxError: Classes may not have static property named prototype (1:16)" + ], + "program": { + "type": "Program", + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, + "id": { + "type": "Identifier", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":8,"end":30,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":30}}, + "body": [ + { + "type": "ClassMethod", + "start":9,"end":29,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":29}}, + "static": true, + "key": { + "type": "Identifier", + "start":16,"end":25,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":25},"identifierName":"prototype"}, + "name": "prototype" + }, + "computed": false, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":27,"end":29,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":29}}, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0271/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0271/options.json deleted file mode 100644 index 8df109cb3c33..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0271/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Classes may not have static property named prototype (1:16)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0271/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0271/output.json new file mode 100644 index 000000000000..5d43814f1619 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0271/output.json @@ -0,0 +1,58 @@ +{ + "type": "File", + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, + "errors": [ + "SyntaxError: Classes may not have static property named prototype (1:16)" + ], + "program": { + "type": "Program", + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, + "id": { + "type": "Identifier", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":8,"end":32,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":32}}, + "body": [ + { + "type": "ClassMethod", + "start":9,"end":31,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":31}}, + "static": true, + "key": { + "type": "StringLiteral", + "start":16,"end":27,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":27}}, + "extra": { + "rawValue": "prototype", + "raw": "\"prototype\"" + }, + "value": "prototype" + }, + "computed": false, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":29,"end":31,"loc":{"start":{"line":1,"column":29},"end":{"line":1,"column":31}}, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0272/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0272/options.json deleted file mode 100644 index f4b1d256a4ab..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0272/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Constructor can't have get/set modifier (1:13)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0272/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0272/output.json new file mode 100644 index 000000000000..ab3b4e1d0f4b --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0272/output.json @@ -0,0 +1,54 @@ +{ + "type": "File", + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, + "errors": [ + "SyntaxError: Class constructor may not be an accessor (1:13)" + ], + "program": { + "type": "Program", + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, + "id": { + "type": "Identifier", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":8,"end":29,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":29}}, + "body": [ + { + "type": "ClassMethod", + "start":9,"end":28,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":28}}, + "static": false, + "key": { + "type": "Identifier", + "start":13,"end":24,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":24},"identifierName":"constructor"}, + "name": "constructor" + }, + "computed": false, + "kind": "get", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":26,"end":28,"loc":{"start":{"line":1,"column":26},"end":{"line":1,"column":28}}, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0273/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0273/options.json deleted file mode 100644 index f4b1d256a4ab..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0273/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Constructor can't have get/set modifier (1:13)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0273/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0273/output.json new file mode 100644 index 000000000000..937104c770ac --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0273/output.json @@ -0,0 +1,60 @@ +{ + "type": "File", + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, + "errors": [ + "SyntaxError: Class constructor may not be an accessor (1:13)" + ], + "program": { + "type": "Program", + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, + "id": { + "type": "Identifier", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":8,"end":30,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":30}}, + "body": [ + { + "type": "ClassMethod", + "start":9,"end":29,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":29}}, + "static": false, + "key": { + "type": "Identifier", + "start":13,"end":24,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":24},"identifierName":"constructor"}, + "name": "constructor" + }, + "computed": false, + "kind": "set", + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start":25,"end":26,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":26},"identifierName":"m"}, + "name": "m" + } + ], + "body": { + "type": "BlockStatement", + "start":27,"end":29,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":29}}, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0274/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0274/options.json deleted file mode 100644 index 4d892adceff9..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0274/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Duplicate constructor in the same class (1:25)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0274/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0274/output.json new file mode 100644 index 000000000000..ed124fb20e3e --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0274/output.json @@ -0,0 +1,80 @@ +{ + "type": "File", + "start":0,"end":43,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":43}}, + "errors": [ + "SyntaxError: Duplicate constructor in the same class (1:25)" + ], + "program": { + "type": "Program", + "start":0,"end":43,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":43}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start":0,"end":43,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":43}}, + "id": { + "type": "Identifier", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":8,"end":43,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":43}}, + "body": [ + { + "type": "ClassMethod", + "start":9,"end":24,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":24}}, + "static": false, + "key": { + "type": "Identifier", + "start":9,"end":20,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":20},"identifierName":"constructor"}, + "name": "constructor" + }, + "computed": false, + "kind": "constructor", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":22,"end":24,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":24}}, + "body": [], + "directives": [] + } + }, + { + "type": "ClassMethod", + "start":25,"end":42,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":42}}, + "static": false, + "key": { + "type": "StringLiteral", + "start":25,"end":38,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":38}}, + "extra": { + "rawValue": "constructor", + "raw": "\"constructor\"" + }, + "value": "constructor" + }, + "computed": false, + "kind": "constructor", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":40,"end":42,"loc":{"start":{"line":1,"column":40},"end":{"line":1,"column":42}}, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0277/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0277/options.json deleted file mode 100644 index aef7f56007e9..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0277/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected reserved word 'enum' (1:11)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0277/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0277/output.json new file mode 100644 index 000000000000..fbd817014273 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0277/output.json @@ -0,0 +1,60 @@ +{ + "type": "File", + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, + "errors": [ + "SyntaxError: Unexpected reserved word 'enum' (1:11)" + ], + "program": { + "type": "Program", + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, + "id": { + "type": "Identifier", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":8,"end":19,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":19}}, + "body": [ + { + "type": "ClassMethod", + "start":9,"end":18,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":18}}, + "static": false, + "key": { + "type": "Identifier", + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"a"}, + "name": "a" + }, + "computed": false, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start":11,"end":15,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":15},"identifierName":"enum"}, + "name": "enum" + } + ], + "body": { + "type": "BlockStatement", + "start":16,"end":18,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":18}}, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0278/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0278/options.json deleted file mode 100644 index 757b207f0ef2..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0278/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected reserved word 'static' (1:17)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0278/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0278/output.json new file mode 100644 index 000000000000..d1c541915d19 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0278/output.json @@ -0,0 +1,54 @@ +{ + "type": "File", + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, + "errors": [ + "SyntaxError: Unexpected reserved word 'static' (1:17)" + ], + "program": { + "type": "Program", + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, + "id": { + "type": "Identifier", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":8,"end":30,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":30}}, + "body": [ + { + "type": "ClassMethod", + "start":9,"end":28,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":28}}, + "static": true, + "computed": true, + "key": { + "type": "Identifier", + "start":17,"end":23,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":23},"identifierName":"static"}, + "name": "static" + }, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":26,"end":28,"loc":{"start":{"line":1,"column":26},"end":{"line":1,"column":28}}, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/rest-parameter/arrow-rest-parameter-array/output.json b/packages/babel-parser/test/fixtures/esprima/rest-parameter/arrow-rest-parameter-array/output.json index 274656622ac9..70f1ba7669c1 100644 --- a/packages/babel-parser/test/fixtures/esprima/rest-parameter/arrow-rest-parameter-array/output.json +++ b/packages/babel-parser/test/fixtures/esprima/rest-parameter/arrow-rest-parameter-array/output.json @@ -1,127 +1,37 @@ { "type": "File", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "program": { "type": "Program", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "expression": { "type": "ArrowFunctionExpression", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "id": null, "generator": false, "async": false, "params": [ { "type": "Identifier", - "start": 1, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - }, - "identifierName": "a" - }, + "start":1,"end":2,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":2},"identifierName":"a"}, "name": "a" }, { "type": "RestElement", - "start": 4, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":4,"end":10,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":10}}, "argument": { "type": "ArrayPattern", - "start": 7, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":7,"end":10,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":10}}, "elements": [ { "type": "Identifier", - "start": 8, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "b" - }, + "start":8,"end":9,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":9},"identifierName":"b"}, "name": "b" } ] @@ -130,19 +40,7 @@ ], "body": { "type": "Identifier", - "start": 15, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - }, - "identifierName": "c" - }, + "start":15,"end":16,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":16},"identifierName":"c"}, "name": "c" } } diff --git a/packages/babel-parser/test/fixtures/esprima/rest-parameter/arrow-rest-parameter-object/output.json b/packages/babel-parser/test/fixtures/esprima/rest-parameter/arrow-rest-parameter-object/output.json index d2f4d73a6ec4..016842ff5ea1 100644 --- a/packages/babel-parser/test/fixtures/esprima/rest-parameter/arrow-rest-parameter-object/output.json +++ b/packages/babel-parser/test/fixtures/esprima/rest-parameter/arrow-rest-parameter-object/output.json @@ -1,161 +1,48 @@ { "type": "File", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "program": { "type": "Program", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "expression": { "type": "ArrowFunctionExpression", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "id": null, "generator": false, "async": false, "params": [ { "type": "Identifier", - "start": 1, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - }, - "identifierName": "a" - }, + "start":1,"end":2,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":2},"identifierName":"a"}, "name": "a" }, { "type": "RestElement", - "start": 4, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":4,"end":10,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":10}}, "argument": { "type": "ObjectPattern", - "start": 7, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":7,"end":10,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":10}}, "properties": [ { "type": "ObjectProperty", - "start": 8, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":8,"end":9,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":9}}, "method": false, "key": { "type": "Identifier", - "start": 8, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "b" - }, + "start":8,"end":9,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":9},"identifierName":"b"}, "name": "b" }, "computed": false, "shorthand": true, "value": { "type": "Identifier", - "start": 8, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "b" - }, + "start":8,"end":9,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":9},"identifierName":"b"}, "name": "b" }, "extra": { @@ -168,19 +55,7 @@ ], "body": { "type": "Identifier", - "start": 15, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - }, - "identifierName": "c" - }, + "start":15,"end":16,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":16},"identifierName":"c"}, "name": "c" } } diff --git a/packages/babel-parser/test/fixtures/esprima/rest-parameter/function-declaration/output.json b/packages/babel-parser/test/fixtures/esprima/rest-parameter/function-declaration/output.json index 6d5be9476898..572ab04a242e 100644 --- a/packages/babel-parser/test/fixtures/esprima/rest-parameter/function-declaration/output.json +++ b/packages/babel-parser/test/fixtures/esprima/rest-parameter/function-declaration/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "program": { "type": "Program", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "id": { "type": "Identifier", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - }, - "identifierName": "f" - }, + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"f"}, "name": "f" }, "generator": false, @@ -65,68 +20,22 @@ "params": [ { "type": "Identifier", - "start": 11, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "a" - }, + "start":11,"end":12,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":12},"identifierName":"a"}, "name": "a" }, { "type": "RestElement", - "start": 14, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":14,"end":18,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":18}}, "argument": { "type": "Identifier", - "start": 17, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - }, - "identifierName": "b" - }, + "start":17,"end":18,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":18},"identifierName":"b"}, "name": "b" } } ], "body": { "type": "BlockStatement", - "start": 20, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":20,"end":22,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":22}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/esprima/rest-parameter/function-expression/output.json b/packages/babel-parser/test/fixtures/esprima/rest-parameter/function-expression/output.json index 292e5947e006..efed9fb6b3fe 100644 --- a/packages/babel-parser/test/fixtures/esprima/rest-parameter/function-expression/output.json +++ b/packages/babel-parser/test/fixtures/esprima/rest-parameter/function-expression/output.json @@ -1,162 +1,49 @@ { "type": "File", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "program": { "type": "Program", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "expression": { "type": "AssignmentExpression", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "operator": "=", "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "f" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"f"}, "name": "f" }, "right": { "type": "FunctionExpression", - "start": 4, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":4,"end":24,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":24}}, "id": null, "generator": false, "async": false, "params": [ { "type": "Identifier", - "start": 13, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - }, - "identifierName": "a" - }, + "start":13,"end":14,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":14},"identifierName":"a"}, "name": "a" }, { "type": "RestElement", - "start": 16, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":16,"end":20,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":20}}, "argument": { "type": "Identifier", - "start": 19, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 20 - }, - "identifierName": "b" - }, + "start":19,"end":20,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":20},"identifierName":"b"}, "name": "b" } } ], "body": { "type": "BlockStatement", - "start": 22, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":22,"end":24,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":24}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/esprima/rest-parameter/invalid-setter-rest/options.json b/packages/babel-parser/test/fixtures/esprima/rest-parameter/invalid-setter-rest/options.json deleted file mode 100644 index 0006fbf98e5c..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/rest-parameter/invalid-setter-rest/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "setter function argument must not be a rest parameter (1:6)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/rest-parameter/invalid-setter-rest/output.json b/packages/babel-parser/test/fixtures/esprima/rest-parameter/invalid-setter-rest/output.json new file mode 100644 index 000000000000..b36068b690ed --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/rest-parameter/invalid-setter-rest/output.json @@ -0,0 +1,68 @@ +{ + "type": "File", + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, + "errors": [ + "SyntaxError: setter function argument must not be a rest parameter (1:6)" + ], + "program": { + "type": "Program", + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, + "expression": { + "type": "AssignmentExpression", + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, + "operator": "=", + "left": { + "type": "Identifier", + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, + "name": "x" + }, + "right": { + "type": "ObjectExpression", + "start":4,"end":22,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":22}}, + "properties": [ + { + "type": "ObjectMethod", + "start":6,"end":20,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":20}}, + "method": false, + "key": { + "type": "Identifier", + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11},"identifierName":"f"}, + "name": "f" + }, + "computed": false, + "kind": "set", + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "RestElement", + "start":12,"end":16,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":16}}, + "argument": { + "type": "Identifier", + "start":15,"end":16,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":16},"identifierName":"y"}, + "name": "y" + } + } + ], + "body": { + "type": "BlockStatement", + "start":18,"end":20,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":20}}, + "body": [], + "directives": [] + } + } + ] + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/rest-parameter/object-method/output.json b/packages/babel-parser/test/fixtures/esprima/rest-parameter/object-method/output.json index 2a7cf3384295..b47cdbe229fc 100644 --- a/packages/babel-parser/test/fixtures/esprima/rest-parameter/object-method/output.json +++ b/packages/babel-parser/test/fixtures/esprima/rest-parameter/object-method/output.json @@ -1,211 +1,64 @@ { "type": "File", - "start": 0, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, "program": { "type": "Program", - "start": 0, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, "expression": { "type": "AssignmentExpression", - "start": 0, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, "operator": "=", "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "o" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"o"}, "name": "o" }, "right": { "type": "ObjectExpression", - "start": 4, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":4,"end":31,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":31}}, "properties": [ { "type": "ObjectProperty", - "start": 6, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":6,"end":29,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":29}}, "method": false, "key": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "f" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"f"}, "name": "f" }, "computed": false, "shorthand": false, "value": { "type": "FunctionExpression", - "start": 9, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":9,"end":29,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":29}}, "id": null, "generator": false, "async": false, "params": [ { "type": "Identifier", - "start": 18, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - }, - "identifierName": "a" - }, + "start":18,"end":19,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":19},"identifierName":"a"}, "name": "a" }, { "type": "RestElement", - "start": 21, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":21,"end":25,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":25}}, "argument": { "type": "Identifier", - "start": 24, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 25 - }, - "identifierName": "b" - }, + "start":24,"end":25,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":25},"identifierName":"b"}, "name": "b" } } ], "body": { "type": "BlockStatement", - "start": 27, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":27,"end":29,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":29}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/esprima/rest-parameter/object-shorthand-method/output.json b/packages/babel-parser/test/fixtures/esprima/rest-parameter/object-shorthand-method/output.json index 2b0e6f95c3e3..0e1543e81b8b 100644 --- a/packages/babel-parser/test/fixtures/esprima/rest-parameter/object-shorthand-method/output.json +++ b/packages/babel-parser/test/fixtures/esprima/rest-parameter/object-shorthand-method/output.json @@ -1,125 +1,35 @@ { "type": "File", - "start": 0, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, "program": { "type": "Program", - "start": 0, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, "expression": { "type": "AssignmentExpression", - "start": 0, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, "operator": "=", "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "right": { "type": "ObjectExpression", - "start": 4, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":4,"end":27,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":27}}, "properties": [ { "type": "ObjectMethod", - "start": 6, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":6,"end":25,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":25}}, "method": true, "key": { "type": "Identifier", - "start": 6, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "method" - }, + "start":6,"end":12,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":12},"identifierName":"method"}, "name": "method" }, "computed": false, @@ -130,51 +40,17 @@ "params": [ { "type": "RestElement", - "start": 13, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":13,"end":20,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":20}}, "argument": { "type": "Identifier", - "start": 16, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 20 - }, - "identifierName": "test" - }, + "start":16,"end":20,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":20},"identifierName":"test"}, "name": "test" } } ], "body": { "type": "BlockStatement", - "start": 22, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":22,"end":25,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":25}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/esprima/rest-parameter/rest-parameter-array/output.json b/packages/babel-parser/test/fixtures/esprima/rest-parameter/rest-parameter-array/output.json index 6ec46b27f645..8a74440beec0 100644 --- a/packages/babel-parser/test/fixtures/esprima/rest-parameter/rest-parameter-array/output.json +++ b/packages/babel-parser/test/fixtures/esprima/rest-parameter/rest-parameter-array/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, "program": { "type": "Program", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, "id": { "type": "Identifier", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - }, - "identifierName": "f" - }, + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"f"}, "name": "f" }, "generator": false, @@ -65,48 +20,14 @@ "params": [ { "type": "RestElement", - "start": 11, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":11,"end":17,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":17}}, "argument": { "type": "ArrayPattern", - "start": 14, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":14,"end":17,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":17}}, "elements": [ { "type": "Identifier", - "start": 15, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - }, - "identifierName": "a" - }, + "start":15,"end":16,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":16},"identifierName":"a"}, "name": "a" } ] @@ -115,18 +36,7 @@ ], "body": { "type": "BlockStatement", - "start": 19, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":19,"end":21,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":21}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/esprima/rest-parameter/rest-parameter-object/output.json b/packages/babel-parser/test/fixtures/esprima/rest-parameter/rest-parameter-object/output.json index d6665939ce44..8e46e83105ec 100644 --- a/packages/babel-parser/test/fixtures/esprima/rest-parameter/rest-parameter-object/output.json +++ b/packages/babel-parser/test/fixtures/esprima/rest-parameter/rest-parameter-object/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, "program": { "type": "Program", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, "id": { "type": "Identifier", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - }, - "identifierName": "f" - }, + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"f"}, "name": "f" }, "generator": false, @@ -65,82 +20,25 @@ "params": [ { "type": "RestElement", - "start": 11, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":11,"end":17,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":17}}, "argument": { "type": "ObjectPattern", - "start": 14, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":14,"end":17,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":17}}, "properties": [ { "type": "ObjectProperty", - "start": 15, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":15,"end":16,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":16}}, "method": false, "key": { "type": "Identifier", - "start": 15, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - }, - "identifierName": "a" - }, + "start":15,"end":16,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":16},"identifierName":"a"}, "name": "a" }, "computed": false, "shorthand": true, "value": { "type": "Identifier", - "start": 15, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - }, - "identifierName": "a" - }, + "start":15,"end":16,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":16},"identifierName":"a"}, "name": "a" }, "extra": { @@ -153,18 +51,7 @@ ], "body": { "type": "BlockStatement", - "start": 19, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":19,"end":21,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":21}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/esprima/statement-block/migrated_0000/output.json b/packages/babel-parser/test/fixtures/esprima/statement-block/migrated_0000/output.json index 598c96a56b18..c606339577fd 100644 --- a/packages/babel-parser/test/fixtures/esprima/statement-block/migrated_0000/output.json +++ b/packages/babel-parser/test/fixtures/esprima/statement-block/migrated_0000/output.json @@ -1,78 +1,22 @@ { "type": "File", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "program": { "type": "Program", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "BlockStatement", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "body": [ { "type": "ExpressionStatement", - "start": 2, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":2,"end":5,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":5}}, "expression": { "type": "Identifier", - "start": 2, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "foo" - }, + "start":2,"end":5,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":5},"identifierName":"foo"}, "name": "foo" } } diff --git a/packages/babel-parser/test/fixtures/esprima/statement-block/migrated_0001/output.json b/packages/babel-parser/test/fixtures/esprima/statement-block/migrated_0001/output.json index 9eed13dbf1f6..61bba56429a6 100644 --- a/packages/babel-parser/test/fixtures/esprima/statement-block/migrated_0001/output.json +++ b/packages/babel-parser/test/fixtures/esprima/statement-block/migrated_0001/output.json @@ -1,92 +1,25 @@ { "type": "File", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "program": { "type": "Program", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "BlockStatement", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "body": [ { "type": "ExpressionStatement", - "start": 2, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":2,"end":11,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":11}}, "expression": { "type": "CallExpression", - "start": 2, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":2,"end":10,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":10}}, "callee": { "type": "Identifier", - "start": 2, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 8 - }, - "identifierName": "doThis" - }, + "start":2,"end":8,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":8},"identifierName":"doThis"}, "name": "doThis" }, "arguments": [] @@ -94,47 +27,13 @@ }, { "type": "ExpressionStatement", - "start": 12, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":12,"end":21,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":21}}, "expression": { "type": "CallExpression", - "start": 12, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":12,"end":20,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":20}}, "callee": { "type": "Identifier", - "start": 12, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 18 - }, - "identifierName": "doThat" - }, + "start":12,"end":18,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":18},"identifierName":"doThat"}, "name": "doThat" }, "arguments": [] diff --git a/packages/babel-parser/test/fixtures/esprima/statement-block/migrated_0002/output.json b/packages/babel-parser/test/fixtures/esprima/statement-block/migrated_0002/output.json index 9c65b7b8cb98..b2560defc565 100644 --- a/packages/babel-parser/test/fixtures/esprima/statement-block/migrated_0002/output.json +++ b/packages/babel-parser/test/fixtures/esprima/statement-block/migrated_0002/output.json @@ -1,48 +1,15 @@ { "type": "File", - "start": 0, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 2 - } - }, + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}}, "program": { "type": "Program", - "start": 0, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 2 - } - }, + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "BlockStatement", - "start": 0, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 2 - } - }, + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/esprima/statement-break/migrated_0000/output.json b/packages/babel-parser/test/fixtures/esprima/statement-break/migrated_0000/output.json index f719006e5af9..bdda42876a8f 100644 --- a/packages/babel-parser/test/fixtures/esprima/statement-break/migrated_0000/output.json +++ b/packages/babel-parser/test/fixtures/esprima/statement-break/migrated_0000/output.json @@ -1,93 +1,27 @@ { "type": "File", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "program": { "type": "Program", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "WhileStatement", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "test": { "type": "BooleanLiteral", - "start": 7, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":7,"end":11,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":11}}, "value": true }, "body": { "type": "BlockStatement", - "start": 13, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":13,"end":22,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":22}}, "body": [ { "type": "BreakStatement", - "start": 15, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":15,"end":20,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":20}}, "label": null } ], diff --git a/packages/babel-parser/test/fixtures/esprima/statement-break/migrated_0001/output.json b/packages/babel-parser/test/fixtures/esprima/statement-break/migrated_0001/output.json index 09cd88be36e1..12f3b1a77a2e 100644 --- a/packages/babel-parser/test/fixtures/esprima/statement-break/migrated_0001/output.json +++ b/packages/babel-parser/test/fixtures/esprima/statement-break/migrated_0001/output.json @@ -1,122 +1,33 @@ { "type": "File", - "start": 0, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, "program": { "type": "Program", - "start": 0, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "LabeledStatement", - "start": 0, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, "body": { "type": "WhileStatement", - "start": 6, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":6,"end":33,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":33}}, "test": { "type": "BooleanLiteral", - "start": 13, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":13,"end":17,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":17}}, "value": true }, "body": { "type": "BlockStatement", - "start": 19, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":19,"end":33,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":33}}, "body": [ { "type": "BreakStatement", - "start": 21, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":21,"end":31,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":31}}, "label": { "type": "Identifier", - "start": 27, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 31 - }, - "identifierName": "done" - }, + "start":27,"end":31,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":31},"identifierName":"done"}, "name": "done" } } @@ -126,19 +37,7 @@ }, "label": { "type": "Identifier", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - }, - "identifierName": "done" - }, + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4},"identifierName":"done"}, "name": "done" } } diff --git a/packages/babel-parser/test/fixtures/esprima/statement-break/migrated_0002/output.json b/packages/babel-parser/test/fixtures/esprima/statement-break/migrated_0002/output.json index 612f1abd2b91..856e2d676e20 100644 --- a/packages/babel-parser/test/fixtures/esprima/statement-break/migrated_0002/output.json +++ b/packages/babel-parser/test/fixtures/esprima/statement-break/migrated_0002/output.json @@ -1,122 +1,33 @@ { "type": "File", - "start": 0, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, "program": { "type": "Program", - "start": 0, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "LabeledStatement", - "start": 0, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, "body": { "type": "WhileStatement", - "start": 6, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":6,"end":34,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":34}}, "test": { "type": "BooleanLiteral", - "start": 13, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":13,"end":17,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":17}}, "value": true }, "body": { "type": "BlockStatement", - "start": 19, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":19,"end":34,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":34}}, "body": [ { "type": "BreakStatement", - "start": 21, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":21,"end":32,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":32}}, "label": { "type": "Identifier", - "start": 27, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 31 - }, - "identifierName": "done" - }, + "start":27,"end":31,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":31},"identifierName":"done"}, "name": "done" } } @@ -126,19 +37,7 @@ }, "label": { "type": "Identifier", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - }, - "identifierName": "done" - }, + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4},"identifierName":"done"}, "name": "done" } } diff --git a/packages/babel-parser/test/fixtures/esprima/statement-break/migrated_0003/output.json b/packages/babel-parser/test/fixtures/esprima/statement-break/migrated_0003/output.json index 320152a60638..9b2756dbb4d2 100644 --- a/packages/babel-parser/test/fixtures/esprima/statement-break/migrated_0003/output.json +++ b/packages/babel-parser/test/fixtures/esprima/statement-break/migrated_0003/output.json @@ -1,122 +1,33 @@ { "type": "File", - "start": 0, - "end": 44, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 44 - } - }, + "start":0,"end":44,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":44}}, "program": { "type": "Program", - "start": 0, - "end": 44, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 44 - } - }, + "start":0,"end":44,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":44}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "LabeledStatement", - "start": 0, - "end": 44, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 44 - } - }, + "start":0,"end":44,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":44}}, "body": { "type": "WhileStatement", - "start": 11, - "end": 44, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 44 - } - }, + "start":11,"end":44,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":44}}, "test": { "type": "BooleanLiteral", - "start": 18, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":18,"end":22,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":22}}, "value": true }, "body": { "type": "BlockStatement", - "start": 24, - "end": 44, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 44 - } - }, + "start":24,"end":44,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":44}}, "body": [ { "type": "BreakStatement", - "start": 26, - "end": 42, - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 42 - } - }, + "start":26,"end":42,"loc":{"start":{"line":1,"column":26},"end":{"line":1,"column":42}}, "label": { "type": "Identifier", - "start": 32, - "end": 41, - "loc": { - "start": { - "line": 1, - "column": 32 - }, - "end": { - "line": 1, - "column": 41 - }, - "identifierName": "__proto__" - }, + "start":32,"end":41,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":41},"identifierName":"__proto__"}, "name": "__proto__" } } @@ -126,19 +37,7 @@ }, "label": { "type": "Identifier", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "__proto__" - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9},"identifierName":"__proto__"}, "name": "__proto__" } } diff --git a/packages/babel-parser/test/fixtures/esprima/statement-continue/migrated_0000/output.json b/packages/babel-parser/test/fixtures/esprima/statement-continue/migrated_0000/output.json index 976ebcc7150e..797c741a6e74 100644 --- a/packages/babel-parser/test/fixtures/esprima/statement-continue/migrated_0000/output.json +++ b/packages/babel-parser/test/fixtures/esprima/statement-continue/migrated_0000/output.json @@ -1,93 +1,27 @@ { "type": "File", - "start": 0, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, "program": { "type": "Program", - "start": 0, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "WhileStatement", - "start": 0, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, "test": { "type": "BooleanLiteral", - "start": 7, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":7,"end":11,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":11}}, "value": true }, "body": { "type": "BlockStatement", - "start": 13, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":13,"end":26,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":26}}, "body": [ { "type": "ContinueStatement", - "start": 15, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":15,"end":24,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":24}}, "label": null } ], diff --git a/packages/babel-parser/test/fixtures/esprima/statement-continue/migrated_0001/output.json b/packages/babel-parser/test/fixtures/esprima/statement-continue/migrated_0001/output.json index b14a15b253be..320fd8e86994 100644 --- a/packages/babel-parser/test/fixtures/esprima/statement-continue/migrated_0001/output.json +++ b/packages/babel-parser/test/fixtures/esprima/statement-continue/migrated_0001/output.json @@ -1,93 +1,27 @@ { "type": "File", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, "program": { "type": "Program", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "WhileStatement", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, "test": { "type": "BooleanLiteral", - "start": 7, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":7,"end":11,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":11}}, "value": true }, "body": { "type": "BlockStatement", - "start": 13, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":13,"end":25,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":25}}, "body": [ { "type": "ContinueStatement", - "start": 15, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":15,"end":23,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":23}}, "label": null } ], diff --git a/packages/babel-parser/test/fixtures/esprima/statement-continue/migrated_0002/output.json b/packages/babel-parser/test/fixtures/esprima/statement-continue/migrated_0002/output.json index 618cec22e8a6..d69535cf3576 100644 --- a/packages/babel-parser/test/fixtures/esprima/statement-continue/migrated_0002/output.json +++ b/packages/babel-parser/test/fixtures/esprima/statement-continue/migrated_0002/output.json @@ -1,122 +1,33 @@ { "type": "File", - "start": 0, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, "program": { "type": "Program", - "start": 0, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "LabeledStatement", - "start": 0, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, "body": { "type": "WhileStatement", - "start": 6, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":6,"end":36,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":36}}, "test": { "type": "BooleanLiteral", - "start": 13, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":13,"end":17,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":17}}, "value": true }, "body": { "type": "BlockStatement", - "start": 19, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":19,"end":36,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":36}}, "body": [ { "type": "ContinueStatement", - "start": 21, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":21,"end":34,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":34}}, "label": { "type": "Identifier", - "start": 30, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 1, - "column": 34 - }, - "identifierName": "done" - }, + "start":30,"end":34,"loc":{"start":{"line":1,"column":30},"end":{"line":1,"column":34},"identifierName":"done"}, "name": "done" } } @@ -126,19 +37,7 @@ }, "label": { "type": "Identifier", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - }, - "identifierName": "done" - }, + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4},"identifierName":"done"}, "name": "done" } } diff --git a/packages/babel-parser/test/fixtures/esprima/statement-continue/migrated_0003/output.json b/packages/babel-parser/test/fixtures/esprima/statement-continue/migrated_0003/output.json index 1ae8f40f9740..3036808c3c47 100644 --- a/packages/babel-parser/test/fixtures/esprima/statement-continue/migrated_0003/output.json +++ b/packages/babel-parser/test/fixtures/esprima/statement-continue/migrated_0003/output.json @@ -1,122 +1,33 @@ { "type": "File", - "start": 0, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 37 - } - }, + "start":0,"end":37,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":37}}, "program": { "type": "Program", - "start": 0, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 37 - } - }, + "start":0,"end":37,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":37}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "LabeledStatement", - "start": 0, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 37 - } - }, + "start":0,"end":37,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":37}}, "body": { "type": "WhileStatement", - "start": 6, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 37 - } - }, + "start":6,"end":37,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":37}}, "test": { "type": "BooleanLiteral", - "start": 13, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":13,"end":17,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":17}}, "value": true }, "body": { "type": "BlockStatement", - "start": 19, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 37 - } - }, + "start":19,"end":37,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":37}}, "body": [ { "type": "ContinueStatement", - "start": 21, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":21,"end":35,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":35}}, "label": { "type": "Identifier", - "start": 30, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 1, - "column": 34 - }, - "identifierName": "done" - }, + "start":30,"end":34,"loc":{"start":{"line":1,"column":30},"end":{"line":1,"column":34},"identifierName":"done"}, "name": "done" } } @@ -126,19 +37,7 @@ }, "label": { "type": "Identifier", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - }, - "identifierName": "done" - }, + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4},"identifierName":"done"}, "name": "done" } } diff --git a/packages/babel-parser/test/fixtures/esprima/statement-continue/migrated_0004/output.json b/packages/babel-parser/test/fixtures/esprima/statement-continue/migrated_0004/output.json index 2340c94c691a..27feea5222a7 100644 --- a/packages/babel-parser/test/fixtures/esprima/statement-continue/migrated_0004/output.json +++ b/packages/babel-parser/test/fixtures/esprima/statement-continue/migrated_0004/output.json @@ -1,122 +1,33 @@ { "type": "File", - "start": 0, - "end": 47, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 47 - } - }, + "start":0,"end":47,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":47}}, "program": { "type": "Program", - "start": 0, - "end": 47, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 47 - } - }, + "start":0,"end":47,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":47}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "LabeledStatement", - "start": 0, - "end": 47, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 47 - } - }, + "start":0,"end":47,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":47}}, "body": { "type": "WhileStatement", - "start": 11, - "end": 47, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 47 - } - }, + "start":11,"end":47,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":47}}, "test": { "type": "BooleanLiteral", - "start": 18, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":18,"end":22,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":22}}, "value": true }, "body": { "type": "BlockStatement", - "start": 24, - "end": 47, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 47 - } - }, + "start":24,"end":47,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":47}}, "body": [ { "type": "ContinueStatement", - "start": 26, - "end": 45, - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 45 - } - }, + "start":26,"end":45,"loc":{"start":{"line":1,"column":26},"end":{"line":1,"column":45}}, "label": { "type": "Identifier", - "start": 35, - "end": 44, - "loc": { - "start": { - "line": 1, - "column": 35 - }, - "end": { - "line": 1, - "column": 44 - }, - "identifierName": "__proto__" - }, + "start":35,"end":44,"loc":{"start":{"line":1,"column":35},"end":{"line":1,"column":44},"identifierName":"__proto__"}, "name": "__proto__" } } @@ -126,19 +37,7 @@ }, "label": { "type": "Identifier", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "__proto__" - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9},"identifierName":"__proto__"}, "name": "__proto__" } } diff --git a/packages/babel-parser/test/fixtures/esprima/statement-debugger/migrated_0000/output.json b/packages/babel-parser/test/fixtures/esprima/statement-debugger/migrated_0000/output.json index 86fbfde778b7..a0ef6bdc2f5b 100644 --- a/packages/babel-parser/test/fixtures/esprima/statement-debugger/migrated_0000/output.json +++ b/packages/babel-parser/test/fixtures/esprima/statement-debugger/migrated_0000/output.json @@ -1,48 +1,15 @@ { "type": "File", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "program": { "type": "Program", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "DebuggerStatement", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - } + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}} } ], "directives": [] diff --git a/packages/babel-parser/test/fixtures/esprima/statement-empty/migrated_0000/output.json b/packages/babel-parser/test/fixtures/esprima/statement-empty/migrated_0000/output.json index 1c109c350cb6..1056212c976e 100644 --- a/packages/babel-parser/test/fixtures/esprima/statement-empty/migrated_0000/output.json +++ b/packages/babel-parser/test/fixtures/esprima/statement-empty/migrated_0000/output.json @@ -1,48 +1,15 @@ { "type": "File", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "EmptyStatement", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - } + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1}} } ], "directives": [] diff --git a/packages/babel-parser/test/fixtures/esprima/statement-expression/migrated_0000/output.json b/packages/babel-parser/test/fixtures/esprima/statement-expression/migrated_0000/output.json index 46cd57504eba..8bb741bae2e4 100644 --- a/packages/babel-parser/test/fixtures/esprima/statement-expression/migrated_0000/output.json +++ b/packages/babel-parser/test/fixtures/esprima/statement-expression/migrated_0000/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1}}, "expression": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" } } diff --git a/packages/babel-parser/test/fixtures/esprima/statement-expression/migrated_0001/output.json b/packages/babel-parser/test/fixtures/esprima/statement-expression/migrated_0001/output.json index 769e912a7e65..c6a529bc13c7 100644 --- a/packages/babel-parser/test/fixtures/esprima/statement-expression/migrated_0001/output.json +++ b/packages/babel-parser/test/fixtures/esprima/statement-expression/migrated_0001/output.json @@ -1,95 +1,27 @@ { "type": "File", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - }, + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, "program": { "type": "Program", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - }, + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - }, + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, "expression": { "type": "SequenceExpression", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - }, + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, "expressions": [ { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, { "type": "Identifier", - "start": 3, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 4 - }, - "identifierName": "y" - }, + "start":3,"end":4,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":4},"identifierName":"y"}, "name": "y" } ] diff --git a/packages/babel-parser/test/fixtures/esprima/statement-expression/migrated_0002/options.json b/packages/babel-parser/test/fixtures/esprima/statement-expression/migrated_0002/options.json deleted file mode 100644 index 381fd12ce2d0..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/statement-expression/migrated_0002/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Expecting Unicode escape sequence \\uXXXX (1:1)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/statement-expression/migrated_0002/output.json b/packages/babel-parser/test/fixtures/esprima/statement-expression/migrated_0002/output.json new file mode 100644 index 000000000000..03c94d829aa7 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/statement-expression/migrated_0002/output.json @@ -0,0 +1,25 @@ +{ + "type": "File", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "errors": [ + "SyntaxError: Expecting Unicode escape sequence \\uXXXX (1:1)" + ], + "program": { + "type": "Program", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "expression": { + "type": "Identifier", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7},"identifierName":"\\a"}, + "name": "\\a" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/statement-expression/migrated_0003/options.json b/packages/babel-parser/test/fixtures/esprima/statement-expression/migrated_0003/options.json deleted file mode 100644 index 18c53b997b56..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/statement-expression/migrated_0003/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Expecting Unicode escape sequence \\uXXXX (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/statement-expression/migrated_0003/output.json b/packages/babel-parser/test/fixtures/esprima/statement-expression/migrated_0003/output.json new file mode 100644 index 000000000000..f88db15c7fd9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/statement-expression/migrated_0003/output.json @@ -0,0 +1,25 @@ +{ + "type": "File", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "errors": [ + "SyntaxError: Expecting Unicode escape sequence \\uXXXX (1:2)" + ], + "program": { + "type": "Program", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "expression": { + "type": "Identifier", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8},"identifierName":"aa\\a"}, + "name": "aa\\a" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/statement-expression/migrated_0004/options.json b/packages/babel-parser/test/fixtures/esprima/statement-expression/migrated_0004/options.json deleted file mode 100644 index 381fd12ce2d0..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/statement-expression/migrated_0004/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Expecting Unicode escape sequence \\uXXXX (1:1)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/statement-expression/migrated_0004/output.json b/packages/babel-parser/test/fixtures/esprima/statement-expression/migrated_0004/output.json new file mode 100644 index 000000000000..389c8a589fb8 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/statement-expression/migrated_0004/output.json @@ -0,0 +1,25 @@ +{ + "type": "File", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "errors": [ + "SyntaxError: Expecting Unicode escape sequence \\uXXXX (1:1)" + ], + "program": { + "type": "Program", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "expression": { + "type": "Identifier", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8},"identifierName":"\\aa"}, + "name": "\\aa" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/statement-expression/migrated_0005/options.json b/packages/babel-parser/test/fixtures/esprima/statement-expression/migrated_0005/options.json deleted file mode 100644 index 381fd12ce2d0..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/statement-expression/migrated_0005/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Expecting Unicode escape sequence \\uXXXX (1:1)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/statement-expression/migrated_0005/output.json b/packages/babel-parser/test/fixtures/esprima/statement-expression/migrated_0005/output.json new file mode 100644 index 000000000000..389c8a589fb8 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/statement-expression/migrated_0005/output.json @@ -0,0 +1,25 @@ +{ + "type": "File", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "errors": [ + "SyntaxError: Expecting Unicode escape sequence \\uXXXX (1:1)" + ], + "program": { + "type": "Program", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "expression": { + "type": "Identifier", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8},"identifierName":"\\aa"}, + "name": "\\aa" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/statement-if/migrated_0000/output.json b/packages/babel-parser/test/fixtures/esprima/statement-if/migrated_0000/output.json index 078b39d33a01..7dcb2358b5cc 100644 --- a/packages/babel-parser/test/fixtures/esprima/statement-if/migrated_0000/output.json +++ b/packages/babel-parser/test/fixtures/esprima/statement-if/migrated_0000/output.json @@ -1,108 +1,29 @@ { "type": "File", - "start": 0, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, "program": { "type": "Program", - "start": 0, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "IfStatement", - "start": 0, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, "test": { "type": "Identifier", - "start": 4, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "morning" - }, + "start":4,"end":11,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":11},"identifierName":"morning"}, "name": "morning" }, "consequent": { "type": "ExpressionStatement", - "start": 13, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":13,"end":26,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":26}}, "expression": { "type": "CallExpression", - "start": 13, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":13,"end":26,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":26}}, "callee": { "type": "Identifier", - "start": 13, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 24 - }, - "identifierName": "goodMorning" - }, + "start":13,"end":24,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":24},"identifierName":"goodMorning"}, "name": "goodMorning" }, "arguments": [] diff --git a/packages/babel-parser/test/fixtures/esprima/statement-if/migrated_0001/output.json b/packages/babel-parser/test/fixtures/esprima/statement-if/migrated_0001/output.json index 46b9ab0f4ad1..cfe4ca1e2622 100644 --- a/packages/babel-parser/test/fixtures/esprima/statement-if/migrated_0001/output.json +++ b/packages/babel-parser/test/fixtures/esprima/statement-if/migrated_0001/output.json @@ -1,111 +1,33 @@ { "type": "File", - "start": 0, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, "program": { "type": "Program", - "start": 0, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "IfStatement", - "start": 0, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, "test": { "type": "Identifier", - "start": 4, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "morning" - }, + "start":4,"end":11,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":11},"identifierName":"morning"}, "name": "morning" }, "consequent": { "type": "ExpressionStatement", - "start": 13, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":13,"end":27,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":27}}, "expression": { "type": "FunctionExpression", - "start": 14, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":14,"end":26,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":26}}, "id": null, "generator": false, "async": false, "params": [], "body": { "type": "BlockStatement", - "start": 24, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":24,"end":26,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":26}}, "body": [], "directives": [] }, diff --git a/packages/babel-parser/test/fixtures/esprima/statement-if/migrated_0002/output.json b/packages/babel-parser/test/fixtures/esprima/statement-if/migrated_0002/output.json index d2e4bb70135c..3fb7587ba6e7 100644 --- a/packages/babel-parser/test/fixtures/esprima/statement-if/migrated_0002/output.json +++ b/packages/babel-parser/test/fixtures/esprima/statement-if/migrated_0002/output.json @@ -1,125 +1,35 @@ { "type": "File", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "program": { "type": "Program", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "IfStatement", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "test": { "type": "Identifier", - "start": 4, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "morning" - }, + "start":4,"end":11,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":11},"identifierName":"morning"}, "name": "morning" }, "consequent": { "type": "VariableDeclaration", - "start": 13, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":13,"end":23,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":23}}, "declarations": [ { "type": "VariableDeclarator", - "start": 17, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":17,"end":22,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":22}}, "id": { "type": "Identifier", - "start": 17, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - }, - "identifierName": "x" - }, + "start":17,"end":18,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":18},"identifierName":"x"}, "name": "x" }, "init": { "type": "NumericLiteral", - "start": 21, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":21,"end":22,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":22}}, "extra": { "rawValue": 0, "raw": "0" diff --git a/packages/babel-parser/test/fixtures/esprima/statement-if/migrated_0004/output.json b/packages/babel-parser/test/fixtures/esprima/statement-if/migrated_0004/output.json index 3a5f512ccc9e..37986cf13198 100644 --- a/packages/babel-parser/test/fixtures/esprima/statement-if/migrated_0004/output.json +++ b/packages/babel-parser/test/fixtures/esprima/statement-if/migrated_0004/output.json @@ -1,108 +1,29 @@ { "type": "File", - "start": 0, - "end": 42, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 42 - } - }, + "start":0,"end":42,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":42}}, "program": { "type": "Program", - "start": 0, - "end": 42, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 42 - } - }, + "start":0,"end":42,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":42}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "IfStatement", - "start": 0, - "end": 42, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 42 - } - }, + "start":0,"end":42,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":42}}, "test": { "type": "Identifier", - "start": 4, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "morning" - }, + "start":4,"end":11,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":11},"identifierName":"morning"}, "name": "morning" }, "consequent": { "type": "ExpressionStatement", - "start": 13, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":13,"end":27,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":27}}, "expression": { "type": "CallExpression", - "start": 13, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":13,"end":26,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":26}}, "callee": { "type": "Identifier", - "start": 13, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 24 - }, - "identifierName": "goodMorning" - }, + "start":13,"end":24,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":24},"identifierName":"goodMorning"}, "name": "goodMorning" }, "arguments": [] @@ -110,47 +31,13 @@ }, "alternate": { "type": "ExpressionStatement", - "start": 33, - "end": 42, - "loc": { - "start": { - "line": 1, - "column": 33 - }, - "end": { - "line": 1, - "column": 42 - } - }, + "start":33,"end":42,"loc":{"start":{"line":1,"column":33},"end":{"line":1,"column":42}}, "expression": { "type": "CallExpression", - "start": 33, - "end": 42, - "loc": { - "start": { - "line": 1, - "column": 33 - }, - "end": { - "line": 1, - "column": 42 - } - }, + "start":33,"end":42,"loc":{"start":{"line":1,"column":33},"end":{"line":1,"column":42}}, "callee": { "type": "Identifier", - "start": 33, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 33 - }, - "end": { - "line": 1, - "column": 40 - }, - "identifierName": "goodDay" - }, + "start":33,"end":40,"loc":{"start":{"line":1,"column":33},"end":{"line":1,"column":40},"identifierName":"goodDay"}, "name": "goodDay" }, "arguments": [] diff --git a/packages/babel-parser/test/fixtures/esprima/statement-if/migrated_0005/output.json b/packages/babel-parser/test/fixtures/esprima/statement-if/migrated_0005/output.json index 9bdda240be5c..2b5173ab82b6 100644 --- a/packages/babel-parser/test/fixtures/esprima/statement-if/migrated_0005/output.json +++ b/packages/babel-parser/test/fixtures/esprima/statement-if/migrated_0005/output.json @@ -1,107 +1,29 @@ { "type": "File", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 7 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":7}}, "program": { "type": "Program", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 7 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":7}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "IfStatement", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 7 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":7}}, "test": { "type": "BooleanLiteral", - "start": 4, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":4,"end":8,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":8}}, "value": true }, "consequent": { "type": "ExpressionStatement", - "start": 10, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 2, - "column": 1 - } - }, + "start":10,"end":18,"loc":{"start":{"line":1,"column":10},"end":{"line":2,"column":1}}, "expression": { "type": "CallExpression", - "start": 10, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":10,"end":16,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":16}}, "callee": { "type": "Identifier", - "start": 10, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 14 - }, - "identifierName": "that" - }, + "start":10,"end":14,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":14},"identifierName":"that"}, "name": "that" }, "arguments": [] @@ -109,18 +31,7 @@ }, "alternate": { "type": "EmptyStatement", - "start": 23, - "end": 24, - "loc": { - "start": { - "line": 2, - "column": 6 - }, - "end": { - "line": 2, - "column": 7 - } - } + "start":23,"end":24,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":7}} } } ], diff --git a/packages/babel-parser/test/fixtures/esprima/statement-if/migrated_0006/output.json b/packages/babel-parser/test/fixtures/esprima/statement-if/migrated_0006/output.json index abdcda955905..c0a36d1894b6 100644 --- a/packages/babel-parser/test/fixtures/esprima/statement-if/migrated_0006/output.json +++ b/packages/babel-parser/test/fixtures/esprima/statement-if/migrated_0006/output.json @@ -1,107 +1,29 @@ { "type": "File", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "program": { "type": "Program", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "IfStatement", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "test": { "type": "BooleanLiteral", - "start": 4, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":4,"end":8,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":8}}, "value": true }, "consequent": { "type": "ExpressionStatement", - "start": 10, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":10,"end":17,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":17}}, "expression": { "type": "CallExpression", - "start": 10, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":10,"end":16,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":16}}, "callee": { "type": "Identifier", - "start": 10, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 14 - }, - "identifierName": "that" - }, + "start":10,"end":14,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":14},"identifierName":"that"}, "name": "that" }, "arguments": [] @@ -109,18 +31,7 @@ }, "alternate": { "type": "EmptyStatement", - "start": 22, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 23 - } - } + "start":22,"end":23,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":23}} } } ], diff --git a/packages/babel-parser/test/fixtures/esprima/statement-iteration/const_forin/output.json b/packages/babel-parser/test/fixtures/esprima/statement-iteration/const_forin/output.json index e2464ea28f4c..d29ec1396d4c 100644 --- a/packages/babel-parser/test/fixtures/esprima/statement-iteration/const_forin/output.json +++ b/packages/babel-parser/test/fixtures/esprima/statement-iteration/const_forin/output.json @@ -1,92 +1,25 @@ { "type": "File", - "start": 0, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, "program": { "type": "Program", - "start": 0, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ForInStatement", - "start": 0, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, "left": { "type": "VariableDeclaration", - "start": 5, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":5,"end":12,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":12}}, "declarations": [ { "type": "VariableDeclarator", - "start": 11, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":11,"end":12,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":12}}, "id": { "type": "Identifier", - "start": 11, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "x" - }, + "start":11,"end":12,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":12},"identifierName":"x"}, "name": "x" }, "init": null @@ -96,82 +29,24 @@ }, "right": { "type": "Identifier", - "start": 16, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 20 - }, - "identifierName": "list" - }, + "start":16,"end":20,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":20},"identifierName":"list"}, "name": "list" }, "body": { "type": "ExpressionStatement", - "start": 22, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":22,"end":33,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":33}}, "expression": { "type": "CallExpression", - "start": 22, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":22,"end":32,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":32}}, "callee": { "type": "Identifier", - "start": 22, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 29 - }, - "identifierName": "process" - }, + "start":22,"end":29,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":29},"identifierName":"process"}, "name": "process" }, "arguments": [ { "type": "Identifier", - "start": 30, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 1, - "column": 31 - }, - "identifierName": "x" - }, + "start":30,"end":31,"loc":{"start":{"line":1,"column":30},"end":{"line":1,"column":31},"identifierName":"x"}, "name": "x" } ] diff --git a/packages/babel-parser/test/fixtures/esprima/statement-iteration/for-statement-with-seq/output.json b/packages/babel-parser/test/fixtures/esprima/statement-iteration/for-statement-with-seq/output.json index 4263383a0bbf..a8b45fca99fb 100644 --- a/packages/babel-parser/test/fixtures/esprima/statement-iteration/for-statement-with-seq/output.json +++ b/packages/babel-parser/test/fixtures/esprima/statement-iteration/for-statement-with-seq/output.json @@ -1,112 +1,32 @@ { "type": "File", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "program": { "type": "Program", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ForStatement", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "init": { "type": "SequenceExpression", - "start": 4, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":4,"end":9,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":9}}, "expressions": [ { "type": "Identifier", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "a" - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"a"}, "name": "a" }, { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "b" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"b"}, "name": "b" }, { "type": "Identifier", - "start": 8, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "c" - }, + "start":8,"end":9,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":9},"identifierName":"c"}, "name": "c" } ] @@ -115,18 +35,7 @@ "update": null, "body": { "type": "EmptyStatement", - "start": 12, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - } + "start":12,"end":13,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":13}} } } ], diff --git a/packages/babel-parser/test/fixtures/esprima/statement-iteration/migrated_0000/output.json b/packages/babel-parser/test/fixtures/esprima/statement-iteration/migrated_0000/output.json index ea8f8f1ee102..17cddefa31e3 100644 --- a/packages/babel-parser/test/fixtures/esprima/statement-iteration/migrated_0000/output.json +++ b/packages/babel-parser/test/fixtures/esprima/statement-iteration/migrated_0000/output.json @@ -1,91 +1,24 @@ { "type": "File", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "program": { "type": "Program", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "DoWhileStatement", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "body": { "type": "ExpressionStatement", - "start": 3, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":3,"end":10,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":10}}, "expression": { "type": "CallExpression", - "start": 3, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":3,"end":9,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":9}}, "callee": { "type": "Identifier", - "start": 3, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "keep" - }, + "start":3,"end":7,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":7},"identifierName":"keep"}, "name": "keep" }, "arguments": [] @@ -93,18 +26,7 @@ }, "test": { "type": "BooleanLiteral", - "start": 18, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":18,"end":22,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":22}}, "value": true } } diff --git a/packages/babel-parser/test/fixtures/esprima/statement-iteration/migrated_0001/output.json b/packages/babel-parser/test/fixtures/esprima/statement-iteration/migrated_0001/output.json index 58dc5fcc7b7d..8328102958a2 100644 --- a/packages/babel-parser/test/fixtures/esprima/statement-iteration/migrated_0001/output.json +++ b/packages/babel-parser/test/fixtures/esprima/statement-iteration/migrated_0001/output.json @@ -1,91 +1,24 @@ { "type": "File", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "program": { "type": "Program", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "DoWhileStatement", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "body": { "type": "ExpressionStatement", - "start": 3, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":3,"end":10,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":10}}, "expression": { "type": "CallExpression", - "start": 3, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":3,"end":9,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":9}}, "callee": { "type": "Identifier", - "start": 3, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "keep" - }, + "start":3,"end":7,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":7},"identifierName":"keep"}, "name": "keep" }, "arguments": [] @@ -93,18 +26,7 @@ }, "test": { "type": "BooleanLiteral", - "start": 18, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":18,"end":22,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":22}}, "value": true } } diff --git a/packages/babel-parser/test/fixtures/esprima/statement-iteration/migrated_0002/output.json b/packages/babel-parser/test/fixtures/esprima/statement-iteration/migrated_0002/output.json index 2dc7a4b042c4..0d0752b80600 100644 --- a/packages/babel-parser/test/fixtures/esprima/statement-iteration/migrated_0002/output.json +++ b/packages/babel-parser/test/fixtures/esprima/statement-iteration/migrated_0002/output.json @@ -1,157 +1,45 @@ { "type": "File", - "start": 0, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, "program": { "type": "Program", - "start": 0, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "DoWhileStatement", - "start": 0, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, "body": { "type": "BlockStatement", - "start": 3, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":3,"end":16,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":16}}, "body": [ { "type": "ExpressionStatement", - "start": 5, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":5,"end":9,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":9}}, "expression": { "type": "UpdateExpression", - "start": 5, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":5,"end":8,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":8}}, "operator": "++", "prefix": false, "argument": { "type": "Identifier", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "x" - }, + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"x"}, "name": "x" } } }, { "type": "ExpressionStatement", - "start": 10, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":10,"end":14,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":14}}, "expression": { "type": "UpdateExpression", - "start": 10, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":10,"end":13,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":13}}, "operator": "--", "prefix": false, "argument": { "type": "Identifier", - "start": 10, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "y" - }, + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11},"identifierName":"y"}, "name": "y" } } @@ -161,50 +49,16 @@ }, "test": { "type": "BinaryExpression", - "start": 24, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":24,"end":30,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":30}}, "left": { "type": "Identifier", - "start": 24, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 25 - }, - "identifierName": "x" - }, + "start":24,"end":25,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":25},"identifierName":"x"}, "name": "x" }, "operator": "<", "right": { "type": "NumericLiteral", - "start": 28, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":28,"end":30,"loc":{"start":{"line":1,"column":28},"end":{"line":1,"column":30}}, "extra": { "rawValue": 10, "raw": "10" diff --git a/packages/babel-parser/test/fixtures/esprima/statement-iteration/migrated_0003/output.json b/packages/babel-parser/test/fixtures/esprima/statement-iteration/migrated_0003/output.json index 0ae53e012bb0..7a8450a177f3 100644 --- a/packages/babel-parser/test/fixtures/esprima/statement-iteration/migrated_0003/output.json +++ b/packages/babel-parser/test/fixtures/esprima/statement-iteration/migrated_0003/output.json @@ -1,125 +1,37 @@ { "type": "File", - "start": 0, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, "program": { "type": "Program", - "start": 0, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "BlockStatement", - "start": 0, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, "body": [ { "type": "DoWhileStatement", - "start": 2, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":2,"end":22,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":22}}, "body": { "type": "BlockStatement", - "start": 5, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":5,"end":8,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":8}}, "body": [], "directives": [] }, "test": { "type": "BooleanLiteral", - "start": 16, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":16,"end":21,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":21}}, "value": false } }, { "type": "ExpressionStatement", - "start": 23, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":23,"end":28,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":28}}, "expression": { "type": "BooleanLiteral", - "start": 23, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":23,"end":28,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":28}}, "value": false } } diff --git a/packages/babel-parser/test/fixtures/esprima/statement-iteration/migrated_0004/output.json b/packages/babel-parser/test/fixtures/esprima/statement-iteration/migrated_0004/output.json index 56f02c219f15..60e0d1e828c2 100644 --- a/packages/babel-parser/test/fixtures/esprima/statement-iteration/migrated_0004/output.json +++ b/packages/babel-parser/test/fixtures/esprima/statement-iteration/migrated_0004/output.json @@ -1,91 +1,24 @@ { "type": "File", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "program": { "type": "Program", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "DoWhileStatement", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "body": { "type": "ExpressionStatement", - "start": 3, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":3,"end":10,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":10}}, "expression": { "type": "CallExpression", - "start": 3, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":3,"end":9,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":9}}, "callee": { "type": "Identifier", - "start": 3, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "that" - }, + "start":3,"end":7,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":7},"identifierName":"that"}, "name": "that" }, "arguments": [] @@ -93,18 +26,7 @@ }, "test": { "type": "BooleanLiteral", - "start": 17, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":17,"end":21,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":21}}, "value": true } } diff --git a/packages/babel-parser/test/fixtures/esprima/statement-iteration/migrated_0005/output.json b/packages/babel-parser/test/fixtures/esprima/statement-iteration/migrated_0005/output.json index d51c3bce84c8..9e9585db2e7f 100644 --- a/packages/babel-parser/test/fixtures/esprima/statement-iteration/migrated_0005/output.json +++ b/packages/babel-parser/test/fixtures/esprima/statement-iteration/migrated_0005/output.json @@ -1,91 +1,24 @@ { "type": "File", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 13 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":13}}, "program": { "type": "Program", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 13 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":13}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "DoWhileStatement", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 13 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":13}}, "body": { "type": "ExpressionStatement", - "start": 3, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 2, - "column": 1 - } - }, + "start":3,"end":11,"loc":{"start":{"line":1,"column":3},"end":{"line":2,"column":1}}, "expression": { "type": "CallExpression", - "start": 3, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":3,"end":9,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":9}}, "callee": { "type": "Identifier", - "start": 3, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "that" - }, + "start":3,"end":7,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":7},"identifierName":"that"}, "name": "that" }, "arguments": [] @@ -93,18 +26,7 @@ }, "test": { "type": "BooleanLiteral", - "start": 18, - "end": 22, - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 12 - } - }, + "start":18,"end":22,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":12}}, "value": true } } diff --git a/packages/babel-parser/test/fixtures/esprima/statement-iteration/migrated_0006/output.json b/packages/babel-parser/test/fixtures/esprima/statement-iteration/migrated_0006/output.json index 4f0b42bf91b2..14379aca37aa 100644 --- a/packages/babel-parser/test/fixtures/esprima/statement-iteration/migrated_0006/output.json +++ b/packages/babel-parser/test/fixtures/esprima/statement-iteration/migrated_0006/output.json @@ -1,107 +1,29 @@ { "type": "File", - "start": 0, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, "program": { "type": "Program", - "start": 0, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "WhileStatement", - "start": 0, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, "test": { "type": "BooleanLiteral", - "start": 7, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":7,"end":11,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":11}}, "value": true }, "body": { "type": "ExpressionStatement", - "start": 13, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":13,"end":26,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":26}}, "expression": { "type": "CallExpression", - "start": 13, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":13,"end":26,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":26}}, "callee": { "type": "Identifier", - "start": 13, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 24 - }, - "identifierName": "doSomething" - }, + "start":13,"end":24,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":24},"identifierName":"doSomething"}, "name": "doSomething" }, "arguments": [] diff --git a/packages/babel-parser/test/fixtures/esprima/statement-iteration/migrated_0007/output.json b/packages/babel-parser/test/fixtures/esprima/statement-iteration/migrated_0007/output.json index cab2b6c2898a..855a078a1e41 100644 --- a/packages/babel-parser/test/fixtures/esprima/statement-iteration/migrated_0007/output.json +++ b/packages/babel-parser/test/fixtures/esprima/statement-iteration/migrated_0007/output.json @@ -1,94 +1,27 @@ { "type": "File", - "start": 0, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, "program": { "type": "Program", - "start": 0, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "WhileStatement", - "start": 0, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, "test": { "type": "BinaryExpression", - "start": 7, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":7,"end":13,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":13}}, "left": { "type": "Identifier", - "start": 7, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - }, - "identifierName": "x" - }, + "start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8},"identifierName":"x"}, "name": "x" }, "operator": "<", "right": { "type": "NumericLiteral", - "start": 11, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":11,"end":13,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":13}}, "extra": { "rawValue": 10, "raw": "10" @@ -98,113 +31,34 @@ }, "body": { "type": "BlockStatement", - "start": 15, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":15,"end":28,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":28}}, "body": [ { "type": "ExpressionStatement", - "start": 17, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":17,"end":21,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":21}}, "expression": { "type": "UpdateExpression", - "start": 17, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":17,"end":20,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":20}}, "operator": "++", "prefix": false, "argument": { "type": "Identifier", - "start": 17, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - }, - "identifierName": "x" - }, + "start":17,"end":18,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":18},"identifierName":"x"}, "name": "x" } } }, { "type": "ExpressionStatement", - "start": 22, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":22,"end":26,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":26}}, "expression": { "type": "UpdateExpression", - "start": 22, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":22,"end":25,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":25}}, "operator": "--", "prefix": false, "argument": { "type": "Identifier", - "start": 22, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 23 - }, - "identifierName": "y" - }, + "start":22,"end":23,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":23},"identifierName":"y"}, "name": "y" } } diff --git a/packages/babel-parser/test/fixtures/esprima/statement-iteration/migrated_0008/output.json b/packages/babel-parser/test/fixtures/esprima/statement-iteration/migrated_0008/output.json index ef81cf2ef043..2e3d9f6a4377 100644 --- a/packages/babel-parser/test/fixtures/esprima/statement-iteration/migrated_0008/output.json +++ b/packages/babel-parser/test/fixtures/esprima/statement-iteration/migrated_0008/output.json @@ -1,65 +1,21 @@ { "type": "File", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, "program": { "type": "Program", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ForStatement", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, "init": null, "test": null, "update": null, "body": { "type": "EmptyStatement", - "start": 7, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - } + "start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8}} } } ], diff --git a/packages/babel-parser/test/fixtures/esprima/statement-iteration/migrated_0009/output.json b/packages/babel-parser/test/fixtures/esprima/statement-iteration/migrated_0009/output.json index eca6e822f6e2..4b8a7f23f0ca 100644 --- a/packages/babel-parser/test/fixtures/esprima/statement-iteration/migrated_0009/output.json +++ b/packages/babel-parser/test/fixtures/esprima/statement-iteration/migrated_0009/output.json @@ -1,65 +1,21 @@ { "type": "File", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "program": { "type": "Program", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ForStatement", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "init": null, "test": null, "update": null, "body": { "type": "BlockStatement", - "start": 7, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":7,"end":9,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":9}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/esprima/statement-iteration/migrated_0010/output.json b/packages/babel-parser/test/fixtures/esprima/statement-iteration/migrated_0010/output.json index 087317911d2f..dbc5316223f1 100644 --- a/packages/babel-parser/test/fixtures/esprima/statement-iteration/migrated_0010/output.json +++ b/packages/babel-parser/test/fixtures/esprima/statement-iteration/migrated_0010/output.json @@ -1,94 +1,27 @@ { "type": "File", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "program": { "type": "Program", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ForStatement", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "init": { "type": "AssignmentExpression", - "start": 4, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":4,"end":9,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":9}}, "operator": "=", "left": { "type": "Identifier", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "x" - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"x"}, "name": "x" }, "right": { "type": "NumericLiteral", - "start": 8, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":8,"end":9,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":9}}, "extra": { "rawValue": 0, "raw": "0" @@ -100,18 +33,7 @@ "update": null, "body": { "type": "EmptyStatement", - "start": 12, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - } + "start":12,"end":13,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":13}} } } ], diff --git a/packages/babel-parser/test/fixtures/esprima/statement-iteration/migrated_0011/output.json b/packages/babel-parser/test/fixtures/esprima/statement-iteration/migrated_0011/output.json index aa78dd8a115f..c66442c43c18 100644 --- a/packages/babel-parser/test/fixtures/esprima/statement-iteration/migrated_0011/output.json +++ b/packages/babel-parser/test/fixtures/esprima/statement-iteration/migrated_0011/output.json @@ -1,108 +1,30 @@ { "type": "File", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "program": { "type": "Program", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ForStatement", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "init": { "type": "VariableDeclaration", - "start": 4, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":4,"end":13,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":13}}, "declarations": [ { "type": "VariableDeclarator", - "start": 8, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":8,"end":13,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":13}}, "id": { "type": "Identifier", - "start": 8, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "x" - }, + "start":8,"end":9,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":9},"identifierName":"x"}, "name": "x" }, "init": { "type": "NumericLiteral", - "start": 12, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":12,"end":13,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":13}}, "extra": { "rawValue": 0, "raw": "0" @@ -117,18 +39,7 @@ "update": null, "body": { "type": "EmptyStatement", - "start": 16, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - } + "start":16,"end":17,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":17}} } } ], diff --git a/packages/babel-parser/test/fixtures/esprima/statement-iteration/migrated_0012/output.json b/packages/babel-parser/test/fixtures/esprima/statement-iteration/migrated_0012/output.json index 8cee92a6a4bd..333c5c39498b 100644 --- a/packages/babel-parser/test/fixtures/esprima/statement-iteration/migrated_0012/output.json +++ b/packages/babel-parser/test/fixtures/esprima/statement-iteration/migrated_0012/output.json @@ -1,108 +1,30 @@ { "type": "File", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "program": { "type": "Program", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ForStatement", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "init": { "type": "VariableDeclaration", - "start": 4, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":4,"end":13,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":13}}, "declarations": [ { "type": "VariableDeclarator", - "start": 8, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":8,"end":13,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":13}}, "id": { "type": "Identifier", - "start": 8, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "x" - }, + "start":8,"end":9,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":9},"identifierName":"x"}, "name": "x" }, "init": { "type": "NumericLiteral", - "start": 12, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":12,"end":13,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":13}}, "extra": { "rawValue": 0, "raw": "0" @@ -117,18 +39,7 @@ "update": null, "body": { "type": "EmptyStatement", - "start": 16, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - } + "start":16,"end":17,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":17}} } } ], diff --git a/packages/babel-parser/test/fixtures/esprima/statement-iteration/migrated_0013/output.json b/packages/babel-parser/test/fixtures/esprima/statement-iteration/migrated_0013/output.json index 02714a4af3c8..2fd8f619a838 100644 --- a/packages/babel-parser/test/fixtures/esprima/statement-iteration/migrated_0013/output.json +++ b/packages/babel-parser/test/fixtures/esprima/statement-iteration/migrated_0013/output.json @@ -1,108 +1,30 @@ { "type": "File", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "program": { "type": "Program", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ForStatement", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "init": { "type": "VariableDeclaration", - "start": 4, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":4,"end":20,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":20}}, "declarations": [ { "type": "VariableDeclarator", - "start": 8, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":8,"end":13,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":13}}, "id": { "type": "Identifier", - "start": 8, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "x" - }, + "start":8,"end":9,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":9},"identifierName":"x"}, "name": "x" }, "init": { "type": "NumericLiteral", - "start": 12, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":12,"end":13,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":13}}, "extra": { "rawValue": 0, "raw": "0" @@ -112,49 +34,15 @@ }, { "type": "VariableDeclarator", - "start": 15, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":15,"end":20,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":20}}, "id": { "type": "Identifier", - "start": 15, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - }, - "identifierName": "y" - }, + "start":15,"end":16,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":16},"identifierName":"y"}, "name": "y" }, "init": { "type": "NumericLiteral", - "start": 19, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":19,"end":20,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":20}}, "extra": { "rawValue": 1, "raw": "1" @@ -169,18 +57,7 @@ "update": null, "body": { "type": "EmptyStatement", - "start": 23, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 24 - } - } + "start":23,"end":24,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":24}} } } ], diff --git a/packages/babel-parser/test/fixtures/esprima/statement-iteration/migrated_0014/output.json b/packages/babel-parser/test/fixtures/esprima/statement-iteration/migrated_0014/output.json index ae77e9c9c0b4..d4c5c67c9404 100644 --- a/packages/babel-parser/test/fixtures/esprima/statement-iteration/migrated_0014/output.json +++ b/packages/babel-parser/test/fixtures/esprima/statement-iteration/migrated_0014/output.json @@ -1,94 +1,27 @@ { "type": "File", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, "program": { "type": "Program", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ForStatement", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, "init": { "type": "AssignmentExpression", - "start": 4, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":4,"end":9,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":9}}, "operator": "=", "left": { "type": "Identifier", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "x" - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"x"}, "name": "x" }, "right": { "type": "NumericLiteral", - "start": 8, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":8,"end":9,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":9}}, "extra": { "rawValue": 0, "raw": "0" @@ -98,50 +31,16 @@ }, "test": { "type": "BinaryExpression", - "start": 11, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":11,"end":17,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":17}}, "left": { "type": "Identifier", - "start": 11, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "x" - }, + "start":11,"end":12,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":12},"identifierName":"x"}, "name": "x" }, "operator": "<", "right": { "type": "NumericLiteral", - "start": 15, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":15,"end":17,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":17}}, "extra": { "rawValue": 42, "raw": "42" @@ -152,18 +51,7 @@ "update": null, "body": { "type": "EmptyStatement", - "start": 19, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 20 - } - } + "start":19,"end":20,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":20}} } } ], diff --git a/packages/babel-parser/test/fixtures/esprima/statement-iteration/migrated_0015/output.json b/packages/babel-parser/test/fixtures/esprima/statement-iteration/migrated_0015/output.json index 8cae09284390..cd2ea8ed46f5 100644 --- a/packages/babel-parser/test/fixtures/esprima/statement-iteration/migrated_0015/output.json +++ b/packages/babel-parser/test/fixtures/esprima/statement-iteration/migrated_0015/output.json @@ -1,94 +1,27 @@ { "type": "File", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "program": { "type": "Program", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ForStatement", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "init": { "type": "AssignmentExpression", - "start": 4, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":4,"end":9,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":9}}, "operator": "=", "left": { "type": "Identifier", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "x" - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"x"}, "name": "x" }, "right": { "type": "NumericLiteral", - "start": 8, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":8,"end":9,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":9}}, "extra": { "rawValue": 0, "raw": "0" @@ -98,50 +31,16 @@ }, "test": { "type": "BinaryExpression", - "start": 11, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":11,"end":17,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":17}}, "left": { "type": "Identifier", - "start": 11, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "x" - }, + "start":11,"end":12,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":12},"identifierName":"x"}, "name": "x" }, "operator": "<", "right": { "type": "NumericLiteral", - "start": 15, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":15,"end":17,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":17}}, "extra": { "rawValue": 42, "raw": "42" @@ -151,52 +50,18 @@ }, "update": { "type": "UpdateExpression", - "start": 19, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":19,"end":22,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":22}}, "operator": "++", "prefix": false, "argument": { "type": "Identifier", - "start": 19, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 20 - }, - "identifierName": "x" - }, + "start":19,"end":20,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":20},"identifierName":"x"}, "name": "x" } }, "body": { "type": "EmptyStatement", - "start": 23, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 24 - } - } + "start":23,"end":24,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":24}} } } ], diff --git a/packages/babel-parser/test/fixtures/esprima/statement-iteration/migrated_0016/output.json b/packages/babel-parser/test/fixtures/esprima/statement-iteration/migrated_0016/output.json index 0623e2624bc9..35c53b58e73a 100644 --- a/packages/babel-parser/test/fixtures/esprima/statement-iteration/migrated_0016/output.json +++ b/packages/babel-parser/test/fixtures/esprima/statement-iteration/migrated_0016/output.json @@ -1,94 +1,27 @@ { "type": "File", - "start": 0, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":35}}, "program": { "type": "Program", - "start": 0, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":35}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ForStatement", - "start": 0, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":35}}, "init": { "type": "AssignmentExpression", - "start": 4, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":4,"end":9,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":9}}, "operator": "=", "left": { "type": "Identifier", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "x" - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"x"}, "name": "x" }, "right": { "type": "NumericLiteral", - "start": 8, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":8,"end":9,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":9}}, "extra": { "rawValue": 0, "raw": "0" @@ -98,50 +31,16 @@ }, "test": { "type": "BinaryExpression", - "start": 11, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":11,"end":17,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":17}}, "left": { "type": "Identifier", - "start": 11, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "x" - }, + "start":11,"end":12,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":12},"identifierName":"x"}, "name": "x" }, "operator": "<", "right": { "type": "NumericLiteral", - "start": 15, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":15,"end":17,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":17}}, "extra": { "rawValue": 42, "raw": "42" @@ -151,99 +50,30 @@ }, "update": { "type": "UpdateExpression", - "start": 19, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":19,"end":22,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":22}}, "operator": "++", "prefix": false, "argument": { "type": "Identifier", - "start": 19, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 20 - }, - "identifierName": "x" - }, + "start":19,"end":20,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":20},"identifierName":"x"}, "name": "x" } }, "body": { "type": "ExpressionStatement", - "start": 24, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":24,"end":35,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":35}}, "expression": { "type": "CallExpression", - "start": 24, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":24,"end":34,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":34}}, "callee": { "type": "Identifier", - "start": 24, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 31 - }, - "identifierName": "process" - }, + "start":24,"end":31,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":31},"identifierName":"process"}, "name": "process" }, "arguments": [ { "type": "Identifier", - "start": 32, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 32 - }, - "end": { - "line": 1, - "column": 33 - }, - "identifierName": "x" - }, + "start":32,"end":33,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":33},"identifierName":"x"}, "name": "x" } ] diff --git a/packages/babel-parser/test/fixtures/esprima/statement-iteration/migrated_0017/output.json b/packages/babel-parser/test/fixtures/esprima/statement-iteration/migrated_0017/output.json index 4ce81575447f..0dcc76e29bfb 100644 --- a/packages/babel-parser/test/fixtures/esprima/statement-iteration/migrated_0017/output.json +++ b/packages/babel-parser/test/fixtures/esprima/statement-iteration/migrated_0017/output.json @@ -1,143 +1,40 @@ { "type": "File", - "start": 0, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, "program": { "type": "Program", - "start": 0, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ForInStatement", - "start": 0, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, "left": { "type": "Identifier", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "x" - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"x"}, "name": "x" }, "right": { "type": "Identifier", - "start": 9, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 13 - }, - "identifierName": "list" - }, + "start":9,"end":13,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":13},"identifierName":"list"}, "name": "list" }, "body": { "type": "ExpressionStatement", - "start": 15, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":15,"end":26,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":26}}, "expression": { "type": "CallExpression", - "start": 15, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":15,"end":25,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":25}}, "callee": { "type": "Identifier", - "start": 15, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 22 - }, - "identifierName": "process" - }, + "start":15,"end":22,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":22},"identifierName":"process"}, "name": "process" }, "arguments": [ { "type": "Identifier", - "start": 23, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 24 - }, - "identifierName": "x" - }, + "start":23,"end":24,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":24},"identifierName":"x"}, "name": "x" } ] diff --git a/packages/babel-parser/test/fixtures/esprima/statement-iteration/migrated_0018/output.json b/packages/babel-parser/test/fixtures/esprima/statement-iteration/migrated_0018/output.json index d418bc0ac898..b132a32e5e5a 100644 --- a/packages/babel-parser/test/fixtures/esprima/statement-iteration/migrated_0018/output.json +++ b/packages/babel-parser/test/fixtures/esprima/statement-iteration/migrated_0018/output.json @@ -1,92 +1,25 @@ { "type": "File", - "start": 0, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, "program": { "type": "Program", - "start": 0, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ForInStatement", - "start": 0, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, "left": { "type": "VariableDeclaration", - "start": 5, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":5,"end":10,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":10}}, "declarations": [ { "type": "VariableDeclarator", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10}}, "id": { "type": "Identifier", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - }, - "identifierName": "x" - }, + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"x"}, "name": "x" }, "init": null @@ -96,82 +29,24 @@ }, "right": { "type": "Identifier", - "start": 14, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 18 - }, - "identifierName": "list" - }, + "start":14,"end":18,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":18},"identifierName":"list"}, "name": "list" }, "body": { "type": "ExpressionStatement", - "start": 20, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":20,"end":31,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":31}}, "expression": { "type": "CallExpression", - "start": 20, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":20,"end":30,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":30}}, "callee": { "type": "Identifier", - "start": 20, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 27 - }, - "identifierName": "process" - }, + "start":20,"end":27,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":27},"identifierName":"process"}, "name": "process" }, "arguments": [ { "type": "Identifier", - "start": 28, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 29 - }, - "identifierName": "x" - }, + "start":28,"end":29,"loc":{"start":{"line":1,"column":28},"end":{"line":1,"column":29},"identifierName":"x"}, "name": "x" } ] diff --git a/packages/babel-parser/test/fixtures/esprima/statement-iteration/migrated_0020/output.json b/packages/babel-parser/test/fixtures/esprima/statement-iteration/migrated_0020/output.json index 3cfd26fb69e7..65791b99b872 100644 --- a/packages/babel-parser/test/fixtures/esprima/statement-iteration/migrated_0020/output.json +++ b/packages/babel-parser/test/fixtures/esprima/statement-iteration/migrated_0020/output.json @@ -1,92 +1,25 @@ { "type": "File", - "start": 0, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, "program": { "type": "Program", - "start": 0, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ForInStatement", - "start": 0, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, "left": { "type": "VariableDeclaration", - "start": 5, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":5,"end":10,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":10}}, "declarations": [ { "type": "VariableDeclarator", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10}}, "id": { "type": "Identifier", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - }, - "identifierName": "x" - }, + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"x"}, "name": "x" }, "init": null @@ -96,82 +29,24 @@ }, "right": { "type": "Identifier", - "start": 14, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 18 - }, - "identifierName": "list" - }, + "start":14,"end":18,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":18},"identifierName":"list"}, "name": "list" }, "body": { "type": "ExpressionStatement", - "start": 20, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":20,"end":31,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":31}}, "expression": { "type": "CallExpression", - "start": 20, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":20,"end":30,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":30}}, "callee": { "type": "Identifier", - "start": 20, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 27 - }, - "identifierName": "process" - }, + "start":20,"end":27,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":27},"identifierName":"process"}, "name": "process" }, "arguments": [ { "type": "Identifier", - "start": 28, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 29 - }, - "identifierName": "x" - }, + "start":28,"end":29,"loc":{"start":{"line":1,"column":28},"end":{"line":1,"column":29},"identifierName":"x"}, "name": "x" } ] diff --git a/packages/babel-parser/test/fixtures/esprima/statement-iteration/migrated_0024/output.json b/packages/babel-parser/test/fixtures/esprima/statement-iteration/migrated_0024/output.json index 7a1b2313cead..2bf7aed2fcc6 100644 --- a/packages/babel-parser/test/fixtures/esprima/statement-iteration/migrated_0024/output.json +++ b/packages/babel-parser/test/fixtures/esprima/statement-iteration/migrated_0024/output.json @@ -1,126 +1,35 @@ { "type": "File", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, "program": { "type": "Program", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ForInStatement", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, "left": { "type": "MemberExpression", - "start": 5, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":5,"end":14,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":14}}, "object": { "type": "Identifier", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "a" - }, + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"a"}, "name": "a" }, "property": { "type": "BinaryExpression", - "start": 7, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":7,"end":13,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":13}}, "left": { "type": "Identifier", - "start": 7, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - }, - "identifierName": "b" - }, + "start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8},"identifierName":"b"}, "name": "b" }, "operator": "in", "right": { "type": "Identifier", - "start": 12, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - }, - "identifierName": "c" - }, + "start":12,"end":13,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":13},"identifierName":"c"}, "name": "c" } }, @@ -128,35 +37,12 @@ }, "right": { "type": "Identifier", - "start": 18, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - }, - "identifierName": "d" - }, + "start":18,"end":19,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":19},"identifierName":"d"}, "name": "d" }, "body": { "type": "EmptyStatement", - "start": 20, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 21 - } - } + "start":20,"end":21,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":21}} } } ], diff --git a/packages/babel-parser/test/fixtures/esprima/statement-iteration/migrated_0025/output.json b/packages/babel-parser/test/fixtures/esprima/statement-iteration/migrated_0025/output.json index f25bf92484d2..783531a21214 100644 --- a/packages/babel-parser/test/fixtures/esprima/statement-iteration/migrated_0025/output.json +++ b/packages/babel-parser/test/fixtures/esprima/statement-iteration/migrated_0025/output.json @@ -1,141 +1,39 @@ { "type": "File", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "program": { "type": "Program", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ForInStatement", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "left": { "type": "MemberExpression", - "start": 5, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":5,"end":17,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":17}}, "object": { "type": "CallExpression", - "start": 5, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":5,"end":14,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":14}}, "callee": { "type": "Identifier", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "a" - }, + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"a"}, "name": "a" }, "arguments": [ { "type": "BinaryExpression", - "start": 7, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":7,"end":13,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":13}}, "left": { "type": "Identifier", - "start": 7, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - }, - "identifierName": "b" - }, + "start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8},"identifierName":"b"}, "name": "b" }, "operator": "in", "right": { "type": "Identifier", - "start": 12, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - }, - "identifierName": "c" - }, + "start":12,"end":13,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":13},"identifierName":"c"}, "name": "c" } } @@ -143,18 +41,7 @@ }, "property": { "type": "NumericLiteral", - "start": 15, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":15,"end":16,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":16}}, "extra": { "rawValue": 0, "raw": "0" @@ -165,35 +52,12 @@ }, "right": { "type": "Identifier", - "start": 21, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 22 - }, - "identifierName": "d" - }, + "start":21,"end":22,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":22},"identifierName":"d"}, "name": "d" }, "body": { "type": "EmptyStatement", - "start": 23, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 24 - } - } + "start":23,"end":24,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":24}} } } ], diff --git a/packages/babel-parser/test/fixtures/esprima/statement-iteration/migrated_0026/output.json b/packages/babel-parser/test/fixtures/esprima/statement-iteration/migrated_0026/output.json index b89167e9aa9d..0a0bb5e03a01 100644 --- a/packages/babel-parser/test/fixtures/esprima/statement-iteration/migrated_0026/output.json +++ b/packages/babel-parser/test/fixtures/esprima/statement-iteration/migrated_0026/output.json @@ -1,129 +1,38 @@ { "type": "File", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "program": { "type": "Program", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ForInStatement", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "left": { "type": "MemberExpression", - "start": 5, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":5,"end":9,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":9}}, "object": { "type": "Identifier", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "a" - }, + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"a"}, "name": "a" }, "property": { "type": "Identifier", - "start": 7, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "in" - }, + "start":7,"end":9,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":9},"identifierName":"in"}, "name": "in" }, "computed": false }, "right": { "type": "Identifier", - "start": 13, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - }, - "identifierName": "a" - }, + "start":13,"end":14,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":14},"identifierName":"a"}, "name": "a" }, "body": { "type": "EmptyStatement", - "start": 15, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - } - } + "start":15,"end":16,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":16}} } } ], diff --git a/packages/babel-parser/test/fixtures/esprima/statement-labelled/migrated_0000/output.json b/packages/babel-parser/test/fixtures/esprima/statement-labelled/migrated_0000/output.json index acbeba45c5e9..9a1c53c8531f 100644 --- a/packages/babel-parser/test/fixtures/esprima/statement-labelled/migrated_0000/output.json +++ b/packages/babel-parser/test/fixtures/esprima/statement-labelled/migrated_0000/output.json @@ -1,113 +1,34 @@ { "type": "File", - "start": 0, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, "program": { "type": "Program", - "start": 0, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "LabeledStatement", - "start": 0, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, "body": { "type": "ForStatement", - "start": 7, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":7,"end":27,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":27}}, "init": null, "test": null, "update": null, "body": { "type": "BreakStatement", - "start": 16, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":16,"end":27,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":27}}, "label": { "type": "Identifier", - "start": 22, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 27 - }, - "identifierName": "start" - }, + "start":22,"end":27,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":27},"identifierName":"start"}, "name": "start" } } }, "label": { "type": "Identifier", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "start" - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5},"identifierName":"start"}, "name": "start" } } diff --git a/packages/babel-parser/test/fixtures/esprima/statement-labelled/migrated_0001/output.json b/packages/babel-parser/test/fixtures/esprima/statement-labelled/migrated_0001/output.json index 5251cd078d22..758f4d4bd8dc 100644 --- a/packages/babel-parser/test/fixtures/esprima/statement-labelled/migrated_0001/output.json +++ b/packages/babel-parser/test/fixtures/esprima/statement-labelled/migrated_0001/output.json @@ -1,126 +1,36 @@ { "type": "File", - "start": 0, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, "program": { "type": "Program", - "start": 0, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "LabeledStatement", - "start": 0, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, "body": { "type": "WhileStatement", - "start": 7, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":7,"end":31,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":31}}, "test": { "type": "BooleanLiteral", - "start": 14, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":14,"end":18,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":18}}, "value": true }, "body": { "type": "BreakStatement", - "start": 20, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":20,"end":31,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":31}}, "label": { "type": "Identifier", - "start": 26, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 31 - }, - "identifierName": "start" - }, + "start":26,"end":31,"loc":{"start":{"line":1,"column":26},"end":{"line":1,"column":31},"identifierName":"start"}, "name": "start" } } }, "label": { "type": "Identifier", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "start" - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5},"identifierName":"start"}, "name": "start" } } diff --git a/packages/babel-parser/test/fixtures/esprima/statement-labelled/migrated_0002/output.json b/packages/babel-parser/test/fixtures/esprima/statement-labelled/migrated_0002/output.json index 1fd4ea1925c7..607fea4fa994 100644 --- a/packages/babel-parser/test/fixtures/esprima/statement-labelled/migrated_0002/output.json +++ b/packages/babel-parser/test/fixtures/esprima/statement-labelled/migrated_0002/output.json @@ -1,95 +1,27 @@ { "type": "File", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "program": { "type": "Program", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "LabeledStatement", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "body": { "type": "ExpressionStatement", - "start": 11, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":11,"end":15,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":15}}, "expression": { "type": "Identifier", - "start": 11, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 15 - }, - "identifierName": "test" - }, + "start":11,"end":15,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":15},"identifierName":"test"}, "name": "test" } }, "label": { "type": "Identifier", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "__proto__" - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9},"identifierName":"__proto__"}, "name": "__proto__" } } diff --git a/packages/babel-parser/test/fixtures/esprima/statement-return/migrated_0000/output.json b/packages/babel-parser/test/fixtures/esprima/statement-return/migrated_0000/output.json index 34df72d1dd54..12be6ac78804 100644 --- a/packages/babel-parser/test/fixtures/esprima/statement-return/migrated_0000/output.json +++ b/packages/babel-parser/test/fixtures/esprima/statement-return/migrated_0000/output.json @@ -1,95 +1,29 @@ { "type": "File", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "program": { "type": "Program", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "expression": { "type": "FunctionExpression", - "start": 1, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":1,"end":21,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":21}}, "id": null, "generator": false, "async": false, "params": [], "body": { "type": "BlockStatement", - "start": 11, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":11,"end":21,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":21}}, "body": [ { "type": "ReturnStatement", - "start": 13, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":13,"end":19,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":19}}, "argument": null } ], diff --git a/packages/babel-parser/test/fixtures/esprima/statement-return/migrated_0001/output.json b/packages/babel-parser/test/fixtures/esprima/statement-return/migrated_0001/output.json index ea1e209f24bf..23e0a043e22b 100644 --- a/packages/babel-parser/test/fixtures/esprima/statement-return/migrated_0001/output.json +++ b/packages/babel-parser/test/fixtures/esprima/statement-return/migrated_0001/output.json @@ -1,95 +1,29 @@ { "type": "File", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "program": { "type": "Program", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "expression": { "type": "FunctionExpression", - "start": 1, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":1,"end":22,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":22}}, "id": null, "generator": false, "async": false, "params": [], "body": { "type": "BlockStatement", - "start": 11, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":11,"end":22,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":22}}, "body": [ { "type": "ReturnStatement", - "start": 13, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":13,"end":20,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":20}}, "argument": null } ], diff --git a/packages/babel-parser/test/fixtures/esprima/statement-return/migrated_0002/output.json b/packages/babel-parser/test/fixtures/esprima/statement-return/migrated_0002/output.json index c0cd7f551693..b6cb58fdb09b 100644 --- a/packages/babel-parser/test/fixtures/esprima/statement-return/migrated_0002/output.json +++ b/packages/babel-parser/test/fixtures/esprima/statement-return/migrated_0002/output.json @@ -1,110 +1,32 @@ { "type": "File", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, "program": { "type": "Program", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, "expression": { "type": "FunctionExpression", - "start": 1, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":1,"end":24,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":24}}, "id": null, "generator": false, "async": false, "params": [], "body": { "type": "BlockStatement", - "start": 11, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":11,"end":24,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":24}}, "body": [ { "type": "ReturnStatement", - "start": 13, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":13,"end":22,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":22}}, "argument": { "type": "Identifier", - "start": 20, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 21 - }, - "identifierName": "x" - }, + "start":20,"end":21,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":21},"identifierName":"x"}, "name": "x" } } diff --git a/packages/babel-parser/test/fixtures/esprima/statement-return/migrated_0003/output.json b/packages/babel-parser/test/fixtures/esprima/statement-return/migrated_0003/output.json index dc6bc1917edf..129603ce64aa 100644 --- a/packages/babel-parser/test/fixtures/esprima/statement-return/migrated_0003/output.json +++ b/packages/babel-parser/test/fixtures/esprima/statement-return/migrated_0003/output.json @@ -1,142 +1,41 @@ { "type": "File", - "start": 0, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, "program": { "type": "Program", - "start": 0, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, "expression": { "type": "FunctionExpression", - "start": 1, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":1,"end":27,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":27}}, "id": null, "generator": false, "async": false, "params": [], "body": { "type": "BlockStatement", - "start": 11, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":11,"end":27,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":27}}, "body": [ { "type": "ReturnStatement", - "start": 13, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":13,"end":25,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":25}}, "argument": { "type": "BinaryExpression", - "start": 20, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":20,"end":25,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":25}}, "left": { "type": "Identifier", - "start": 20, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 21 - }, - "identifierName": "x" - }, + "start":20,"end":21,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":21},"identifierName":"x"}, "name": "x" }, "operator": "*", "right": { "type": "Identifier", - "start": 24, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 25 - }, - "identifierName": "y" - }, + "start":24,"end":25,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":25},"identifierName":"y"}, "name": "y" } } diff --git a/packages/babel-parser/test/fixtures/esprima/statement-switch/migrated_0000/output.json b/packages/babel-parser/test/fixtures/esprima/statement-switch/migrated_0000/output.json index 2676e600764f..191390407c53 100644 --- a/packages/babel-parser/test/fixtures/esprima/statement-switch/migrated_0000/output.json +++ b/packages/babel-parser/test/fixtures/esprima/statement-switch/migrated_0000/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "program": { "type": "Program", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "SwitchStatement", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "discriminant": { "type": "Identifier", - "start": 8, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "x" - }, + "start":8,"end":9,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":9},"identifierName":"x"}, "name": "x" }, "cases": [] diff --git a/packages/babel-parser/test/fixtures/esprima/statement-switch/migrated_0001/output.json b/packages/babel-parser/test/fixtures/esprima/statement-switch/migrated_0001/output.json index 26eb0ec7e251..34304235c8c8 100644 --- a/packages/babel-parser/test/fixtures/esprima/statement-switch/migrated_0001/output.json +++ b/packages/babel-parser/test/fixtures/esprima/statement-switch/migrated_0001/output.json @@ -1,124 +1,34 @@ { "type": "File", - "start": 0, - "end": 41, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 41 - } - }, + "start":0,"end":41,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":41}}, "program": { "type": "Program", - "start": 0, - "end": 41, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 41 - } - }, + "start":0,"end":41,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":41}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "SwitchStatement", - "start": 0, - "end": 41, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 41 - } - }, + "start":0,"end":41,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":41}}, "discriminant": { "type": "Identifier", - "start": 8, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 14 - }, - "identifierName": "answer" - }, + "start":8,"end":14,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":14},"identifierName":"answer"}, "name": "answer" }, "cases": [ { "type": "SwitchCase", - "start": 18, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 39 - } - }, + "start":18,"end":39,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":39}}, "consequent": [ { "type": "ExpressionStatement", - "start": 27, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":27,"end":32,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":32}}, "expression": { "type": "CallExpression", - "start": 27, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":27,"end":31,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":31}}, "callee": { "type": "Identifier", - "start": 27, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 29 - }, - "identifierName": "hi" - }, + "start":27,"end":29,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":29},"identifierName":"hi"}, "name": "hi" }, "arguments": [] @@ -126,35 +36,13 @@ }, { "type": "BreakStatement", - "start": 33, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 33 - }, - "end": { - "line": 1, - "column": 39 - } - }, + "start":33,"end":39,"loc":{"start":{"line":1,"column":33},"end":{"line":1,"column":39}}, "label": null } ], "test": { "type": "NumericLiteral", - "start": 23, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":23,"end":25,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":25}}, "extra": { "rawValue": 42, "raw": "42" diff --git a/packages/babel-parser/test/fixtures/esprima/statement-switch/migrated_0002/output.json b/packages/babel-parser/test/fixtures/esprima/statement-switch/migrated_0002/output.json index 1295bdfcf9c2..e91e6f437f78 100644 --- a/packages/babel-parser/test/fixtures/esprima/statement-switch/migrated_0002/output.json +++ b/packages/babel-parser/test/fixtures/esprima/statement-switch/migrated_0002/output.json @@ -1,124 +1,34 @@ { "type": "File", - "start": 0, - "end": 56, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 56 - } - }, + "start":0,"end":56,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":56}}, "program": { "type": "Program", - "start": 0, - "end": 56, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 56 - } - }, + "start":0,"end":56,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":56}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "SwitchStatement", - "start": 0, - "end": 56, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 56 - } - }, + "start":0,"end":56,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":56}}, "discriminant": { "type": "Identifier", - "start": 8, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 14 - }, - "identifierName": "answer" - }, + "start":8,"end":14,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":14},"identifierName":"answer"}, "name": "answer" }, "cases": [ { "type": "SwitchCase", - "start": 18, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 39 - } - }, + "start":18,"end":39,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":39}}, "consequent": [ { "type": "ExpressionStatement", - "start": 27, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":27,"end":32,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":32}}, "expression": { "type": "CallExpression", - "start": 27, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":27,"end":31,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":31}}, "callee": { "type": "Identifier", - "start": 27, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 29 - }, - "identifierName": "hi" - }, + "start":27,"end":29,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":29},"identifierName":"hi"}, "name": "hi" }, "arguments": [] @@ -126,35 +36,13 @@ }, { "type": "BreakStatement", - "start": 33, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 33 - }, - "end": { - "line": 1, - "column": 39 - } - }, + "start":33,"end":39,"loc":{"start":{"line":1,"column":33},"end":{"line":1,"column":39}}, "label": null } ], "test": { "type": "NumericLiteral", - "start": 23, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":23,"end":25,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":25}}, "extra": { "rawValue": 42, "raw": "42" @@ -164,33 +52,11 @@ }, { "type": "SwitchCase", - "start": 40, - "end": 54, - "loc": { - "start": { - "line": 1, - "column": 40 - }, - "end": { - "line": 1, - "column": 54 - } - }, + "start":40,"end":54,"loc":{"start":{"line":1,"column":40},"end":{"line":1,"column":54}}, "consequent": [ { "type": "BreakStatement", - "start": 49, - "end": 54, - "loc": { - "start": { - "line": 1, - "column": 49 - }, - "end": { - "line": 1, - "column": 54 - } - }, + "start":49,"end":54,"loc":{"start":{"line":1,"column":49},"end":{"line":1,"column":54}}, "label": null } ], diff --git a/packages/babel-parser/test/fixtures/esprima/statement-throw/migrated_0000/output.json b/packages/babel-parser/test/fixtures/esprima/statement-throw/migrated_0000/output.json index 4d485ddd9600..16e82da75c18 100644 --- a/packages/babel-parser/test/fixtures/esprima/statement-throw/migrated_0000/output.json +++ b/packages/babel-parser/test/fixtures/esprima/statement-throw/migrated_0000/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, "program": { "type": "Program", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ThrowStatement", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, "argument": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "x" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"x"}, "name": "x" } } diff --git a/packages/babel-parser/test/fixtures/esprima/statement-throw/migrated_0001/output.json b/packages/babel-parser/test/fixtures/esprima/statement-throw/migrated_0001/output.json index 0099a2d97eaf..2835e746897a 100644 --- a/packages/babel-parser/test/fixtures/esprima/statement-throw/migrated_0001/output.json +++ b/packages/babel-parser/test/fixtures/esprima/statement-throw/migrated_0001/output.json @@ -1,95 +1,27 @@ { "type": "File", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "program": { "type": "Program", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ThrowStatement", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "argument": { "type": "BinaryExpression", - "start": 6, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":6,"end":11,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":11}}, "left": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "x" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"x"}, "name": "x" }, "operator": "*", "right": { "type": "Identifier", - "start": 10, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "y" - }, + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11},"identifierName":"y"}, "name": "y" } } diff --git a/packages/babel-parser/test/fixtures/esprima/statement-throw/migrated_0002/output.json b/packages/babel-parser/test/fixtures/esprima/statement-throw/migrated_0002/output.json index ef879544f9bf..5caef91e52b6 100644 --- a/packages/babel-parser/test/fixtures/esprima/statement-throw/migrated_0002/output.json +++ b/packages/babel-parser/test/fixtures/esprima/statement-throw/migrated_0002/output.json @@ -1,111 +1,33 @@ { "type": "File", - "start": 0, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, "program": { "type": "Program", - "start": 0, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ThrowStatement", - "start": 0, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, "argument": { "type": "ObjectExpression", - "start": 6, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":6,"end":26,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":26}}, "properties": [ { "type": "ObjectProperty", - "start": 8, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":8,"end":24,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":24}}, "method": false, "key": { "type": "Identifier", - "start": 8, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 15 - }, - "identifierName": "message" - }, + "start":8,"end":15,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":15},"identifierName":"message"}, "name": "message" }, "computed": false, "shorthand": false, "value": { "type": "StringLiteral", - "start": 17, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":17,"end":24,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":24}}, "extra": { "rawValue": "Error", "raw": "\"Error\"" diff --git a/packages/babel-parser/test/fixtures/esprima/statement-try/migrated_0000/output.json b/packages/babel-parser/test/fixtures/esprima/statement-try/migrated_0000/output.json index 7124a7ba6fff..cb43070c2777 100644 --- a/packages/babel-parser/test/fixtures/esprima/statement-try/migrated_0000/output.json +++ b/packages/babel-parser/test/fixtures/esprima/statement-try/migrated_0000/output.json @@ -1,110 +1,32 @@ { "type": "File", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, "program": { "type": "Program", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "TryStatement", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, "block": { "type": "BlockStatement", - "start": 4, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":4,"end":7,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":7}}, "body": [], "directives": [] }, "handler": { "type": "CatchClause", - "start": 8, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":8,"end":21,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":21}}, "param": { "type": "Identifier", - "start": 15, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - }, - "identifierName": "e" - }, + "start":15,"end":16,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":16},"identifierName":"e"}, "name": "e" }, "body": { "type": "BlockStatement", - "start": 18, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":18,"end":21,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":21}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/esprima/statement-try/migrated_0001/output.json b/packages/babel-parser/test/fixtures/esprima/statement-try/migrated_0001/output.json index 0f104da5ae82..bca060357b6c 100644 --- a/packages/babel-parser/test/fixtures/esprima/statement-try/migrated_0001/output.json +++ b/packages/babel-parser/test/fixtures/esprima/statement-try/migrated_0001/output.json @@ -1,110 +1,32 @@ { "type": "File", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "program": { "type": "Program", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "TryStatement", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "block": { "type": "BlockStatement", - "start": 4, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":4,"end":7,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":7}}, "body": [], "directives": [] }, "handler": { "type": "CatchClause", - "start": 8, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":8,"end":24,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":24}}, "param": { "type": "Identifier", - "start": 15, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 19 - }, - "identifierName": "eval" - }, + "start":15,"end":19,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":19},"identifierName":"eval"}, "name": "eval" }, "body": { "type": "BlockStatement", - "start": 21, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":21,"end":24,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":24}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/esprima/statement-try/migrated_0002/output.json b/packages/babel-parser/test/fixtures/esprima/statement-try/migrated_0002/output.json index 8721f9d98403..d1a65bb67c2b 100644 --- a/packages/babel-parser/test/fixtures/esprima/statement-try/migrated_0002/output.json +++ b/packages/babel-parser/test/fixtures/esprima/statement-try/migrated_0002/output.json @@ -1,110 +1,32 @@ { "type": "File", - "start": 0, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, "program": { "type": "Program", - "start": 0, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "TryStatement", - "start": 0, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, "block": { "type": "BlockStatement", - "start": 4, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":4,"end":7,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":7}}, "body": [], "directives": [] }, "handler": { "type": "CatchClause", - "start": 8, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":8,"end":29,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":29}}, "param": { "type": "Identifier", - "start": 15, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 24 - }, - "identifierName": "arguments" - }, + "start":15,"end":24,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":24},"identifierName":"arguments"}, "name": "arguments" }, "body": { "type": "BlockStatement", - "start": 26, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":26,"end":29,"loc":{"start":{"line":1,"column":26},"end":{"line":1,"column":29}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/esprima/statement-try/migrated_0003/output.json b/packages/babel-parser/test/fixtures/esprima/statement-try/migrated_0003/output.json index 49094bb0e6bd..fb80b314fa31 100644 --- a/packages/babel-parser/test/fixtures/esprima/statement-try/migrated_0003/output.json +++ b/packages/babel-parser/test/fixtures/esprima/statement-try/migrated_0003/output.json @@ -1,172 +1,48 @@ { "type": "File", - "start": 0, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, "program": { "type": "Program", - "start": 0, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "TryStatement", - "start": 0, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, "block": { "type": "BlockStatement", - "start": 4, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":4,"end":7,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":7}}, "body": [], "directives": [] }, "handler": { "type": "CatchClause", - "start": 8, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":8,"end":28,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":28}}, "param": { "type": "Identifier", - "start": 15, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - }, - "identifierName": "e" - }, + "start":15,"end":16,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":16},"identifierName":"e"}, "name": "e" }, "body": { "type": "BlockStatement", - "start": 18, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":18,"end":28,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":28}}, "body": [ { "type": "ExpressionStatement", - "start": 20, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":20,"end":26,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":26}}, "expression": { "type": "CallExpression", - "start": 20, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":20,"end":26,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":26}}, "callee": { "type": "Identifier", - "start": 20, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 23 - }, - "identifierName": "say" - }, + "start":20,"end":23,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":23},"identifierName":"say"}, "name": "say" }, "arguments": [ { "type": "Identifier", - "start": 24, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 25 - }, - "identifierName": "e" - }, + "start":24,"end":25,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":25},"identifierName":"e"}, "name": "e" } ] diff --git a/packages/babel-parser/test/fixtures/esprima/statement-try/migrated_0004/output.json b/packages/babel-parser/test/fixtures/esprima/statement-try/migrated_0004/output.json index b1589f69dcee..a079acf84911 100644 --- a/packages/babel-parser/test/fixtures/esprima/statement-try/migrated_0004/output.json +++ b/packages/babel-parser/test/fixtures/esprima/statement-try/migrated_0004/output.json @@ -1,142 +1,41 @@ { "type": "File", - "start": 0, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, "program": { "type": "Program", - "start": 0, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "TryStatement", - "start": 0, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, "block": { "type": "BlockStatement", - "start": 4, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":4,"end":7,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":7}}, "body": [], "directives": [] }, "handler": null, "finalizer": { "type": "BlockStatement", - "start": 16, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":16,"end":34,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":34}}, "body": [ { "type": "ExpressionStatement", - "start": 18, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":18,"end":32,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":32}}, "expression": { "type": "CallExpression", - "start": 18, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":18,"end":32,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":32}}, "callee": { "type": "Identifier", - "start": 18, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 25 - }, - "identifierName": "cleanup" - }, + "start":18,"end":25,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":25},"identifierName":"cleanup"}, "name": "cleanup" }, "arguments": [ { "type": "Identifier", - "start": 26, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 31 - }, - "identifierName": "stuff" - }, + "start":26,"end":31,"loc":{"start":{"line":1,"column":26},"end":{"line":1,"column":31},"identifierName":"stuff"}, "name": "stuff" } ] diff --git a/packages/babel-parser/test/fixtures/esprima/statement-try/migrated_0005/output.json b/packages/babel-parser/test/fixtures/esprima/statement-try/migrated_0005/output.json index 7bb5acfbedbb..0453b860b1e1 100644 --- a/packages/babel-parser/test/fixtures/esprima/statement-try/migrated_0005/output.json +++ b/packages/babel-parser/test/fixtures/esprima/statement-try/migrated_0005/output.json @@ -1,106 +1,28 @@ { "type": "File", - "start": 0, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":38}}, "program": { "type": "Program", - "start": 0, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":38}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "TryStatement", - "start": 0, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":38}}, "block": { "type": "BlockStatement", - "start": 4, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":4,"end":17,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":17}}, "body": [ { "type": "ExpressionStatement", - "start": 6, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":6,"end":15,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":15}}, "expression": { "type": "CallExpression", - "start": 6, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":6,"end":14,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":14}}, "callee": { "type": "Identifier", - "start": 6, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "doThat" - }, + "start":6,"end":12,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":12},"identifierName":"doThat"}, "name": "doThat" }, "arguments": [] @@ -111,111 +33,31 @@ }, "handler": { "type": "CatchClause", - "start": 18, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":18,"end":38,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":38}}, "param": { "type": "Identifier", - "start": 25, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 26 - }, - "identifierName": "e" - }, + "start":25,"end":26,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":26},"identifierName":"e"}, "name": "e" }, "body": { "type": "BlockStatement", - "start": 28, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":28,"end":38,"loc":{"start":{"line":1,"column":28},"end":{"line":1,"column":38}}, "body": [ { "type": "ExpressionStatement", - "start": 30, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":30,"end":36,"loc":{"start":{"line":1,"column":30},"end":{"line":1,"column":36}}, "expression": { "type": "CallExpression", - "start": 30, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":30,"end":36,"loc":{"start":{"line":1,"column":30},"end":{"line":1,"column":36}}, "callee": { "type": "Identifier", - "start": 30, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 1, - "column": 33 - }, - "identifierName": "say" - }, + "start":30,"end":33,"loc":{"start":{"line":1,"column":30},"end":{"line":1,"column":33},"identifierName":"say"}, "name": "say" }, "arguments": [ { "type": "Identifier", - "start": 34, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 34 - }, - "end": { - "line": 1, - "column": 35 - }, - "identifierName": "e" - }, + "start":34,"end":35,"loc":{"start":{"line":1,"column":34},"end":{"line":1,"column":35},"identifierName":"e"}, "name": "e" } ] diff --git a/packages/babel-parser/test/fixtures/esprima/statement-try/migrated_0006/output.json b/packages/babel-parser/test/fixtures/esprima/statement-try/migrated_0006/output.json index 91b008540089..bddc435c75dc 100644 --- a/packages/babel-parser/test/fixtures/esprima/statement-try/migrated_0006/output.json +++ b/packages/babel-parser/test/fixtures/esprima/statement-try/migrated_0006/output.json @@ -1,106 +1,28 @@ { "type": "File", - "start": 0, - "end": 65, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 65 - } - }, + "start":0,"end":65,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":65}}, "program": { "type": "Program", - "start": 0, - "end": 65, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 65 - } - }, + "start":0,"end":65,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":65}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "TryStatement", - "start": 0, - "end": 65, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 65 - } - }, + "start":0,"end":65,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":65}}, "block": { "type": "BlockStatement", - "start": 4, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":4,"end":17,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":17}}, "body": [ { "type": "ExpressionStatement", - "start": 6, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":6,"end":15,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":15}}, "expression": { "type": "CallExpression", - "start": 6, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":6,"end":14,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":14}}, "callee": { "type": "Identifier", - "start": 6, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "doThat" - }, + "start":6,"end":12,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":12},"identifierName":"doThat"}, "name": "doThat" }, "arguments": [] @@ -111,111 +33,31 @@ }, "handler": { "type": "CatchClause", - "start": 18, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":18,"end":38,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":38}}, "param": { "type": "Identifier", - "start": 25, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 26 - }, - "identifierName": "e" - }, + "start":25,"end":26,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":26},"identifierName":"e"}, "name": "e" }, "body": { "type": "BlockStatement", - "start": 28, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":28,"end":38,"loc":{"start":{"line":1,"column":28},"end":{"line":1,"column":38}}, "body": [ { "type": "ExpressionStatement", - "start": 30, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":30,"end":36,"loc":{"start":{"line":1,"column":30},"end":{"line":1,"column":36}}, "expression": { "type": "CallExpression", - "start": 30, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":30,"end":36,"loc":{"start":{"line":1,"column":30},"end":{"line":1,"column":36}}, "callee": { "type": "Identifier", - "start": 30, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 1, - "column": 33 - }, - "identifierName": "say" - }, + "start":30,"end":33,"loc":{"start":{"line":1,"column":30},"end":{"line":1,"column":33},"identifierName":"say"}, "name": "say" }, "arguments": [ { "type": "Identifier", - "start": 34, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 34 - }, - "end": { - "line": 1, - "column": 35 - }, - "identifierName": "e" - }, + "start":34,"end":35,"loc":{"start":{"line":1,"column":34},"end":{"line":1,"column":35},"identifierName":"e"}, "name": "e" } ] @@ -227,80 +69,23 @@ }, "finalizer": { "type": "BlockStatement", - "start": 47, - "end": 65, - "loc": { - "start": { - "line": 1, - "column": 47 - }, - "end": { - "line": 1, - "column": 65 - } - }, + "start":47,"end":65,"loc":{"start":{"line":1,"column":47},"end":{"line":1,"column":65}}, "body": [ { "type": "ExpressionStatement", - "start": 49, - "end": 63, - "loc": { - "start": { - "line": 1, - "column": 49 - }, - "end": { - "line": 1, - "column": 63 - } - }, + "start":49,"end":63,"loc":{"start":{"line":1,"column":49},"end":{"line":1,"column":63}}, "expression": { "type": "CallExpression", - "start": 49, - "end": 63, - "loc": { - "start": { - "line": 1, - "column": 49 - }, - "end": { - "line": 1, - "column": 63 - } - }, + "start":49,"end":63,"loc":{"start":{"line":1,"column":49},"end":{"line":1,"column":63}}, "callee": { "type": "Identifier", - "start": 49, - "end": 56, - "loc": { - "start": { - "line": 1, - "column": 49 - }, - "end": { - "line": 1, - "column": 56 - }, - "identifierName": "cleanup" - }, + "start":49,"end":56,"loc":{"start":{"line":1,"column":49},"end":{"line":1,"column":56},"identifierName":"cleanup"}, "name": "cleanup" }, "arguments": [ { "type": "Identifier", - "start": 57, - "end": 62, - "loc": { - "start": { - "line": 1, - "column": 57 - }, - "end": { - "line": 1, - "column": 62 - }, - "identifierName": "stuff" - }, + "start":57,"end":62,"loc":{"start":{"line":1,"column":57},"end":{"line":1,"column":62},"identifierName":"stuff"}, "name": "stuff" } ] diff --git a/packages/babel-parser/test/fixtures/esprima/statement-variable/complex-pattern-requires-init/options.json b/packages/babel-parser/test/fixtures/esprima/statement-variable/complex-pattern-requires-init/options.json deleted file mode 100644 index 57893e4eee56..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/statement-variable/complex-pattern-requires-init/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Complex binding patterns require an initialization value (1:6)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/statement-variable/complex-pattern-requires-init/output.json b/packages/babel-parser/test/fixtures/esprima/statement-variable/complex-pattern-requires-init/output.json new file mode 100644 index 000000000000..0763ff948104 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/statement-variable/complex-pattern-requires-init/output.json @@ -0,0 +1,33 @@ +{ + "type": "File", + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, + "errors": [ + "SyntaxError: Complex binding patterns require an initialization value (1:6)" + ], + "program": { + "type": "Program", + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":4,"end":6,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":6}}, + "id": { + "type": "ArrayPattern", + "start":4,"end":6,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":6}}, + "elements": [] + }, + "init": null + } + ], + "kind": "var" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/statement-variable/migrated_0000/output.json b/packages/babel-parser/test/fixtures/esprima/statement-variable/migrated_0000/output.json index c2d1aa9e8258..1fad75e9a989 100644 --- a/packages/babel-parser/test/fixtures/esprima/statement-variable/migrated_0000/output.json +++ b/packages/babel-parser/test/fixtures/esprima/statement-variable/migrated_0000/output.json @@ -1,78 +1,22 @@ { "type": "File", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "program": { "type": "Program", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5}}, "id": { "type": "Identifier", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "x" - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"x"}, "name": "x" }, "init": null diff --git a/packages/babel-parser/test/fixtures/esprima/statement-variable/migrated_0001/output.json b/packages/babel-parser/test/fixtures/esprima/statement-variable/migrated_0001/output.json index 2292f444ff6d..765527f7771e 100644 --- a/packages/babel-parser/test/fixtures/esprima/statement-variable/migrated_0001/output.json +++ b/packages/babel-parser/test/fixtures/esprima/statement-variable/migrated_0001/output.json @@ -1,111 +1,32 @@ { "type": "File", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "program": { "type": "Program", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5}}, "id": { "type": "Identifier", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "x" - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"x"}, "name": "x" }, "init": null }, { "type": "VariableDeclarator", - "start": 7, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8}}, "id": { "type": "Identifier", - "start": 7, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - }, - "identifierName": "y" - }, + "start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8},"identifierName":"y"}, "name": "y" }, "init": null diff --git a/packages/babel-parser/test/fixtures/esprima/statement-variable/migrated_0002/output.json b/packages/babel-parser/test/fixtures/esprima/statement-variable/migrated_0002/output.json index 338b1ef14f8b..26d684ab89aa 100644 --- a/packages/babel-parser/test/fixtures/esprima/statement-variable/migrated_0002/output.json +++ b/packages/babel-parser/test/fixtures/esprima/statement-variable/migrated_0002/output.json @@ -1,94 +1,27 @@ { "type": "File", - "start": 0, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, "program": { "type": "Program", - "start": 0, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":4,"end":10,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":10}}, "id": { "type": "Identifier", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "x" - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"x"}, "name": "x" }, "init": { "type": "NumericLiteral", - "start": 8, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":8,"end":10,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":10}}, "extra": { "rawValue": 42, "raw": "42" diff --git a/packages/babel-parser/test/fixtures/esprima/statement-variable/migrated_0003/output.json b/packages/babel-parser/test/fixtures/esprima/statement-variable/migrated_0003/output.json index 64faa9a0c09c..46dc4683a1c6 100644 --- a/packages/babel-parser/test/fixtures/esprima/statement-variable/migrated_0003/output.json +++ b/packages/babel-parser/test/fixtures/esprima/statement-variable/migrated_0003/output.json @@ -1,94 +1,27 @@ { "type": "File", - "start": 0, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, "program": { "type": "Program", - "start": 0, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":4,"end":13,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":13}}, "id": { "type": "Identifier", - "start": 4, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 8 - }, - "identifierName": "eval" - }, + "start":4,"end":8,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":8},"identifierName":"eval"}, "name": "eval" }, "init": { "type": "NumericLiteral", - "start": 11, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":11,"end":13,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":13}}, "extra": { "rawValue": 42, "raw": "42" @@ -98,49 +31,15 @@ }, { "type": "VariableDeclarator", - "start": 15, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":15,"end":29,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":29}}, "id": { "type": "Identifier", - "start": 15, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 24 - }, - "identifierName": "arguments" - }, + "start":15,"end":24,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":24},"identifierName":"arguments"}, "name": "arguments" }, "init": { "type": "NumericLiteral", - "start": 27, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":27,"end":29,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":29}}, "extra": { "rawValue": 42, "raw": "42" diff --git a/packages/babel-parser/test/fixtures/esprima/statement-variable/migrated_0004/output.json b/packages/babel-parser/test/fixtures/esprima/statement-variable/migrated_0004/output.json index cb147f686b55..bdc2834bafdc 100644 --- a/packages/babel-parser/test/fixtures/esprima/statement-variable/migrated_0004/output.json +++ b/packages/babel-parser/test/fixtures/esprima/statement-variable/migrated_0004/output.json @@ -1,94 +1,27 @@ { "type": "File", - "start": 0, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, "program": { "type": "Program", - "start": 0, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":4,"end":10,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":10}}, "id": { "type": "Identifier", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "x" - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"x"}, "name": "x" }, "init": { "type": "NumericLiteral", - "start": 8, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":8,"end":10,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":10}}, "extra": { "rawValue": 14, "raw": "14" @@ -98,49 +31,15 @@ }, { "type": "VariableDeclarator", - "start": 12, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":12,"end":17,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":17}}, "id": { "type": "Identifier", - "start": 12, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - }, - "identifierName": "y" - }, + "start":12,"end":13,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":13},"identifierName":"y"}, "name": "y" }, "init": { "type": "NumericLiteral", - "start": 16, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":16,"end":17,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":17}}, "extra": { "rawValue": 3, "raw": "3" @@ -150,49 +49,15 @@ }, { "type": "VariableDeclarator", - "start": 19, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":19,"end":27,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":27}}, "id": { "type": "Identifier", - "start": 19, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 20 - }, - "identifierName": "z" - }, + "start":19,"end":20,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":20},"identifierName":"z"}, "name": "z" }, "init": { "type": "NumericLiteral", - "start": 23, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":23,"end":27,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":27}}, "extra": { "rawValue": 1977, "raw": "1977" diff --git a/packages/babel-parser/test/fixtures/esprima/statement-variable/migrated_0005/output.json b/packages/babel-parser/test/fixtures/esprima/statement-variable/migrated_0005/output.json index d6d6794fe5b6..1c191ef723d7 100644 --- a/packages/babel-parser/test/fixtures/esprima/statement-variable/migrated_0005/output.json +++ b/packages/babel-parser/test/fixtures/esprima/statement-variable/migrated_0005/output.json @@ -1,144 +1,42 @@ { "type": "File", - "start": 0, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, "program": { "type": "Program", - "start": 0, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":4,"end":14,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":14}}, "id": { "type": "Identifier", - "start": 4, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 14 - }, - "identifierName": "implements" - }, + "start":4,"end":14,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":14},"identifierName":"implements"}, "name": "implements" }, "init": null }, { "type": "VariableDeclarator", - "start": 16, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":16,"end":25,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":25}}, "id": { "type": "Identifier", - "start": 16, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 25 - }, - "identifierName": "interface" - }, + "start":16,"end":25,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":25},"identifierName":"interface"}, "name": "interface" }, "init": null }, { "type": "VariableDeclarator", - "start": 27, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":27,"end":34,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":34}}, "id": { "type": "Identifier", - "start": 27, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 34 - }, - "identifierName": "package" - }, + "start":27,"end":34,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":34},"identifierName":"package"}, "name": "package" }, "init": null diff --git a/packages/babel-parser/test/fixtures/esprima/statement-variable/migrated_0006/output.json b/packages/babel-parser/test/fixtures/esprima/statement-variable/migrated_0006/output.json index 4b8305ce1e0f..8a4c16c4b1cf 100644 --- a/packages/babel-parser/test/fixtures/esprima/statement-variable/migrated_0006/output.json +++ b/packages/babel-parser/test/fixtures/esprima/statement-variable/migrated_0006/output.json @@ -1,177 +1,52 @@ { "type": "File", - "start": 0, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":38}}, "program": { "type": "Program", - "start": 0, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":38}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":38}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":4,"end":11,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":11}}, "id": { "type": "Identifier", - "start": 4, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "private" - }, + "start":4,"end":11,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":11},"identifierName":"private"}, "name": "private" }, "init": null }, { "type": "VariableDeclarator", - "start": 13, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":13,"end":22,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":22}}, "id": { "type": "Identifier", - "start": 13, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 22 - }, - "identifierName": "protected" - }, + "start":13,"end":22,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":22},"identifierName":"protected"}, "name": "protected" }, "init": null }, { "type": "VariableDeclarator", - "start": 24, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":24,"end":30,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":30}}, "id": { "type": "Identifier", - "start": 24, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 30 - }, - "identifierName": "public" - }, + "start":24,"end":30,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":30},"identifierName":"public"}, "name": "public" }, "init": null }, { "type": "VariableDeclarator", - "start": 32, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 32 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":32,"end":38,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":38}}, "id": { "type": "Identifier", - "start": 32, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 32 - }, - "end": { - "line": 1, - "column": 38 - }, - "identifierName": "static" - }, + "start":32,"end":38,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":38},"identifierName":"static"}, "name": "static" }, "init": null diff --git a/packages/babel-parser/test/fixtures/esprima/statement-with/migrated_0000/output.json b/packages/babel-parser/test/fixtures/esprima/statement-with/migrated_0000/output.json index de556d585469..4e092c03ea2f 100644 --- a/packages/babel-parser/test/fixtures/esprima/statement-with/migrated_0000/output.json +++ b/packages/babel-parser/test/fixtures/esprima/statement-with/migrated_0000/output.json @@ -1,126 +1,35 @@ { "type": "File", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, "program": { "type": "Program", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "WithStatement", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, "object": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "x" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"x"}, "name": "x" }, "body": { "type": "ExpressionStatement", - "start": 9, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":9,"end":18,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":18}}, "expression": { "type": "AssignmentExpression", - "start": 9, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":9,"end":18,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":18}}, "operator": "=", "left": { "type": "Identifier", - "start": 9, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "foo" - }, + "start":9,"end":12,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":12},"identifierName":"foo"}, "name": "foo" }, "right": { "type": "Identifier", - "start": 15, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 18 - }, - "identifierName": "bar" - }, + "start":15,"end":18,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":18},"identifierName":"bar"}, "name": "bar" } } diff --git a/packages/babel-parser/test/fixtures/esprima/statement-with/migrated_0001/output.json b/packages/babel-parser/test/fixtures/esprima/statement-with/migrated_0001/output.json index b8b637790518..4f5b295c2b96 100644 --- a/packages/babel-parser/test/fixtures/esprima/statement-with/migrated_0001/output.json +++ b/packages/babel-parser/test/fixtures/esprima/statement-with/migrated_0001/output.json @@ -1,126 +1,35 @@ { "type": "File", - "start": 0, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, "program": { "type": "Program", - "start": 0, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "WithStatement", - "start": 0, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, "object": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "x" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"x"}, "name": "x" }, "body": { "type": "ExpressionStatement", - "start": 9, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":9,"end":19,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":19}}, "expression": { "type": "AssignmentExpression", - "start": 9, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":9,"end":18,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":18}}, "operator": "=", "left": { "type": "Identifier", - "start": 9, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "foo" - }, + "start":9,"end":12,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":12},"identifierName":"foo"}, "name": "foo" }, "right": { "type": "Identifier", - "start": 15, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 18 - }, - "identifierName": "bar" - }, + "start":15,"end":18,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":18},"identifierName":"bar"}, "name": "bar" } } diff --git a/packages/babel-parser/test/fixtures/esprima/statement-with/migrated_0002/output.json b/packages/babel-parser/test/fixtures/esprima/statement-with/migrated_0002/output.json index 67715145c740..7675a5829970 100644 --- a/packages/babel-parser/test/fixtures/esprima/statement-with/migrated_0002/output.json +++ b/packages/babel-parser/test/fixtures/esprima/statement-with/migrated_0002/output.json @@ -1,141 +1,39 @@ { "type": "File", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "program": { "type": "Program", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "WithStatement", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "object": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "x" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"x"}, "name": "x" }, "body": { "type": "BlockStatement", - "start": 9, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":9,"end":22,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":22}}, "body": [ { "type": "ExpressionStatement", - "start": 11, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":11,"end":20,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":20}}, "expression": { "type": "AssignmentExpression", - "start": 11, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":11,"end":20,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":20}}, "operator": "=", "left": { "type": "Identifier", - "start": 11, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 14 - }, - "identifierName": "foo" - }, + "start":11,"end":14,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":14},"identifierName":"foo"}, "name": "foo" }, "right": { "type": "Identifier", - "start": 17, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 20 - }, - "identifierName": "bar" - }, + "start":17,"end":20,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":20},"identifierName":"bar"}, "name": "bar" } } diff --git a/packages/babel-parser/test/fixtures/estree/bigInt/basic/input.js b/packages/babel-parser/test/fixtures/estree/bigInt/basic/input.js new file mode 100644 index 000000000000..b01de9749f99 --- /dev/null +++ b/packages/babel-parser/test/fixtures/estree/bigInt/basic/input.js @@ -0,0 +1 @@ +const a = 1n; diff --git a/packages/babel-parser/test/fixtures/estree/bigInt/basic/output.json b/packages/babel-parser/test/fixtures/estree/bigInt/basic/output.json new file mode 100644 index 000000000000..610eff55feff --- /dev/null +++ b/packages/babel-parser/test/fixtures/estree/bigInt/basic/output.json @@ -0,0 +1,38 @@ +{ + "type": "File", + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "program": { + "type": "Program", + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":6,"end":12,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":12}}, + "id": { + "type": "Identifier", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"a"}, + "name": "a" + }, + "init": { + "type": "Literal", + "start":10,"end":12,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":12}}, + "value": { + "$$ babel internal serialized type": "BigInt", + "value": "1" + }, + "raw": "1n", + "bigint": "1" + } + } + ], + "kind": "const" + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/estree/bigInt/options.json b/packages/babel-parser/test/fixtures/estree/bigInt/options.json new file mode 100644 index 000000000000..070d941a7562 --- /dev/null +++ b/packages/babel-parser/test/fixtures/estree/bigInt/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["estree"] +} diff --git a/packages/babel-parser/test/fixtures/estree/class-method/basic/output.json b/packages/babel-parser/test/fixtures/estree/class-method/basic/output.json index 8d314eae24de..61eec15d105f 100644 --- a/packages/babel-parser/test/fixtures/estree/class-method/basic/output.json +++ b/packages/babel-parser/test/fixtures/estree/class-method/basic/output.json @@ -1,129 +1,39 @@ { "type": "File", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "id": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "A" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, "name": "A" }, "superClass": null, "body": { "type": "ClassBody", - "start": 8, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":8,"end":22,"loc":{"start":{"line":1,"column":8},"end":{"line":3,"column":1}}, "body": [ { "type": "MethodDefinition", - "start": 12, - "end": 20, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 10 - } - }, + "start":12,"end":20,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":10}}, "static": false, "key": { "type": "Identifier", - "start": 12, - "end": 15, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 5 - }, - "identifierName": "foo" - }, + "start":12,"end":15,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":5},"identifierName":"foo"}, "name": "foo" }, "computed": false, "kind": "method", "value": { "type": "FunctionExpression", - "start": 15, - "end": 20, - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 10 - } - }, + "start":15,"end":20,"loc":{"start":{"line":2,"column":5},"end":{"line":2,"column":10}}, "id": null, "generator": false, "async": false, @@ -131,18 +41,7 @@ "params": [], "body": { "type": "BlockStatement", - "start": 18, - "end": 20, - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 10 - } - }, + "start":18,"end":20,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":10}}, "body": [] } } diff --git a/packages/babel-parser/test/fixtures/estree/class-method/flow/output.json b/packages/babel-parser/test/fixtures/estree/class-method/flow/output.json index acc15e6c1a33..7e8990aa69cf 100644 --- a/packages/babel-parser/test/fixtures/estree/class-method/flow/output.json +++ b/packages/babel-parser/test/fixtures/estree/class-method/flow/output.json @@ -1,145 +1,43 @@ { "type": "File", - "start": 0, - "end": 102, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 1 - } - }, + "start":0,"end":102,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 102, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 1 - } - }, + "start":0,"end":102,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 102, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 1 - } - }, + "start":0,"end":102,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, "id": { "type": "Identifier", - "start": 6, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 15 - }, - "identifierName": "NodeUtils" - }, + "start":6,"end":15,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":15},"identifierName":"NodeUtils"}, "name": "NodeUtils" }, "superClass": { "type": "Identifier", - "start": 24, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 34 - }, - "identifierName": "UtilParser" - }, + "start":24,"end":34,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":34},"identifierName":"UtilParser"}, "name": "UtilParser" }, "body": { "type": "ClassBody", - "start": 35, - "end": 102, - "loc": { - "start": { - "line": 1, - "column": 35 - }, - "end": { - "line": 5, - "column": 1 - } - }, + "start":35,"end":102,"loc":{"start":{"line":1,"column":35},"end":{"line":5,"column":1}}, "body": [ { "type": "MethodDefinition", - "start": 39, - "end": 100, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 4, - "column": 3 - } - }, + "start":39,"end":100,"loc":{"start":{"line":2,"column":2},"end":{"line":4,"column":3}}, "static": false, "key": { "type": "Identifier", - "start": 39, - "end": 51, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 14 - }, - "identifierName": "finishNodeAt" - }, + "start":39,"end":51,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":14},"identifierName":"finishNodeAt"}, "name": "finishNodeAt" }, "computed": false, "kind": "method", "value": { "type": "FunctionExpression", - "start": 65, - "end": 100, - "loc": { - "start": { - "line": 2, - "column": 28 - }, - "end": { - "line": 4, - "column": 3 - } - }, + "start":65,"end":100,"loc":{"start":{"line":2,"column":28},"end":{"line":4,"column":3}}, "id": null, "generator": false, "async": false, @@ -147,64 +45,18 @@ "params": [ { "type": "Identifier", - "start": 66, - "end": 73, - "loc": { - "start": { - "line": 2, - "column": 29 - }, - "end": { - "line": 2, - "column": 36 - }, - "identifierName": "node" - }, + "start":66,"end":73,"loc":{"start":{"line":2,"column":29},"end":{"line":2,"column":36},"identifierName":"node"}, "name": "node", "typeAnnotation": { "type": "TypeAnnotation", - "start": 70, - "end": 73, - "loc": { - "start": { - "line": 2, - "column": 33 - }, - "end": { - "line": 2, - "column": 36 - } - }, + "start":70,"end":73,"loc":{"start":{"line":2,"column":33},"end":{"line":2,"column":36}}, "typeAnnotation": { "type": "GenericTypeAnnotation", - "start": 72, - "end": 73, - "loc": { - "start": { - "line": 2, - "column": 35 - }, - "end": { - "line": 2, - "column": 36 - } - }, + "start":72,"end":73,"loc":{"start":{"line":2,"column":35},"end":{"line":2,"column":36}}, "typeParameters": null, "id": { "type": "Identifier", - "start": 72, - "end": 73, - "loc": { - "start": { - "line": 2, - "column": 35 - }, - "end": { - "line": 2, - "column": 36 - }, - "identifierName": "T" - }, + "start":72,"end":73,"loc":{"start":{"line":2,"column":35},"end":{"line":2,"column":36},"identifierName":"T"}, "name": "T" } } @@ -214,96 +66,28 @@ "predicate": null, "returnType": { "type": "TypeAnnotation", - "start": 74, - "end": 77, - "loc": { - "start": { - "line": 2, - "column": 37 - }, - "end": { - "line": 2, - "column": 40 - } - }, + "start":74,"end":77,"loc":{"start":{"line":2,"column":37},"end":{"line":2,"column":40}}, "typeAnnotation": { "type": "GenericTypeAnnotation", - "start": 76, - "end": 77, - "loc": { - "start": { - "line": 2, - "column": 39 - }, - "end": { - "line": 2, - "column": 40 - } - }, + "start":76,"end":77,"loc":{"start":{"line":2,"column":39},"end":{"line":2,"column":40}}, "typeParameters": null, "id": { "type": "Identifier", - "start": 76, - "end": 77, - "loc": { - "start": { - "line": 2, - "column": 39 - }, - "end": { - "line": 2, - "column": 40 - }, - "identifierName": "T" - }, + "start":76,"end":77,"loc":{"start":{"line":2,"column":39},"end":{"line":2,"column":40},"identifierName":"T"}, "name": "T" } } }, "body": { "type": "BlockStatement", - "start": 78, - "end": 100, - "loc": { - "start": { - "line": 2, - "column": 41 - }, - "end": { - "line": 4, - "column": 3 - } - }, + "start":78,"end":100,"loc":{"start":{"line":2,"column":41},"end":{"line":4,"column":3}}, "body": [ { "type": "ReturnStatement", - "start": 84, - "end": 96, - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 16 - } - }, + "start":84,"end":96,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":16}}, "argument": { "type": "Identifier", - "start": 91, - "end": 95, - "loc": { - "start": { - "line": 3, - "column": 11 - }, - "end": { - "line": 3, - "column": 15 - }, - "identifierName": "node" - }, + "start":91,"end":95,"loc":{"start":{"line":3,"column":11},"end":{"line":3,"column":15},"identifierName":"node"}, "name": "node" } } @@ -311,79 +95,23 @@ }, "typeParameters": { "type": "TypeParameterDeclaration", - "start": 51, - "end": 65, - "loc": { - "start": { - "line": 2, - "column": 14 - }, - "end": { - "line": 2, - "column": 28 - } - }, + "start":51,"end":65,"loc":{"start":{"line":2,"column":14},"end":{"line":2,"column":28}}, "params": [ { "type": "TypeParameter", - "start": 52, - "end": 64, - "loc": { - "start": { - "line": 2, - "column": 15 - }, - "end": { - "line": 2, - "column": 27 - } - }, + "start":52,"end":64,"loc":{"start":{"line":2,"column":15},"end":{"line":2,"column":27}}, "name": "T", "variance": null, "bound": { "type": "TypeAnnotation", - "start": 54, - "end": 64, - "loc": { - "start": { - "line": 2, - "column": 17 - }, - "end": { - "line": 2, - "column": 27 - } - }, + "start":54,"end":64,"loc":{"start":{"line":2,"column":17},"end":{"line":2,"column":27}}, "typeAnnotation": { "type": "GenericTypeAnnotation", - "start": 56, - "end": 64, - "loc": { - "start": { - "line": 2, - "column": 19 - }, - "end": { - "line": 2, - "column": 27 - } - }, + "start":56,"end":64,"loc":{"start":{"line":2,"column":19},"end":{"line":2,"column":27}}, "typeParameters": null, "id": { "type": "Identifier", - "start": 56, - "end": 64, - "loc": { - "start": { - "line": 2, - "column": 19 - }, - "end": { - "line": 2, - "column": 27 - }, - "identifierName": "NodeType" - }, + "start":56,"end":64,"loc":{"start":{"line":2,"column":19},"end":{"line":2,"column":27},"identifierName":"NodeType"}, "name": "NodeType" } } diff --git a/packages/babel-parser/test/fixtures/estree/class-method/typescript/output.json b/packages/babel-parser/test/fixtures/estree/class-method/typescript/output.json index 83a633725788..82f61bd8b864 100644 --- a/packages/babel-parser/test/fixtures/estree/class-method/typescript/output.json +++ b/packages/babel-parser/test/fixtures/estree/class-method/typescript/output.json @@ -1,131 +1,41 @@ { "type": "File", - "start": 0, - "end": 73, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":73,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 73, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":73,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 73, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":73,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "abstract": true, "id": { "type": "Identifier", - "start": 15, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 30 - }, - "identifierName": "TSAbstractClass" - }, + "start":15,"end":30,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":30},"identifierName":"TSAbstractClass"}, "name": "TSAbstractClass" }, "superClass": null, "body": { "type": "ClassBody", - "start": 31, - "end": 73, - "loc": { - "start": { - "line": 1, - "column": 31 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":31,"end":73,"loc":{"start":{"line":1,"column":31},"end":{"line":3,"column":1}}, "body": [ { "type": "MethodDefinition", - "start": 35, - "end": 71, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 38 - } - }, + "start":35,"end":71,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":38}}, "abstract": true, "static": false, "key": { "type": "Identifier", - "start": 44, - "end": 47, - "loc": { - "start": { - "line": 2, - "column": 11 - }, - "end": { - "line": 2, - "column": 14 - }, - "identifierName": "foo" - }, + "start":44,"end":47,"loc":{"start":{"line":2,"column":11},"end":{"line":2,"column":14},"identifierName":"foo"}, "name": "foo" }, "computed": false, "kind": "method", "value": { "type": "FunctionExpression", - "start": 47, - "end": 71, - "loc": { - "start": { - "line": 2, - "column": 14 - }, - "end": { - "line": 2, - "column": 38 - } - }, + "start":47,"end":71,"loc":{"start":{"line":2,"column":14},"end":{"line":2,"column":38}}, "id": null, "generator": false, "async": false, @@ -133,80 +43,24 @@ "params": [ { "type": "Identifier", - "start": 48, - "end": 60, - "loc": { - "start": { - "line": 2, - "column": 15 - }, - "end": { - "line": 2, - "column": 27 - }, - "identifierName": "name" - }, + "start":48,"end":60,"loc":{"start":{"line":2,"column":15},"end":{"line":2,"column":27},"identifierName":"name"}, "name": "name", "typeAnnotation": { "type": "TSTypeAnnotation", - "start": 52, - "end": 60, - "loc": { - "start": { - "line": 2, - "column": 19 - }, - "end": { - "line": 2, - "column": 27 - } - }, + "start":52,"end":60,"loc":{"start":{"line":2,"column":19},"end":{"line":2,"column":27}}, "typeAnnotation": { "type": "TSStringKeyword", - "start": 54, - "end": 60, - "loc": { - "start": { - "line": 2, - "column": 21 - }, - "end": { - "line": 2, - "column": 27 - } - } + "start":54,"end":60,"loc":{"start":{"line":2,"column":21},"end":{"line":2,"column":27}} } } } ], "returnType": { "type": "TSTypeAnnotation", - "start": 61, - "end": 70, - "loc": { - "start": { - "line": 2, - "column": 28 - }, - "end": { - "line": 2, - "column": 37 - } - }, + "start":61,"end":70,"loc":{"start":{"line":2,"column":28},"end":{"line":2,"column":37}}, "typeAnnotation": { "type": "TSBooleanKeyword", - "start": 63, - "end": 70, - "loc": { - "start": { - "line": 2, - "column": 30 - }, - "end": { - "line": 2, - "column": 37 - } - } + "start":63,"end":70,"loc":{"start":{"line":2,"column":30},"end":{"line":2,"column":37}} } } } diff --git a/packages/babel-parser/test/fixtures/estree/directives/block/output.json b/packages/babel-parser/test/fixtures/estree/directives/block/output.json index 75a911187c46..81955a57f998 100644 --- a/packages/babel-parser/test/fixtures/estree/directives/block/output.json +++ b/packages/babel-parser/test/fixtures/estree/directives/block/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 63, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 1 - } - }, + "start":0,"end":63,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 63, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 1 - } - }, + "start":0,"end":63,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 63, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 1 - } - }, + "start":0,"end":63,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, "id": { "type": "Identifier", - "start": 9, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "foo" - }, + "start":9,"end":12,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":12},"identifierName":"foo"}, "name": "foo" }, "generator": false, @@ -66,47 +21,14 @@ "params": [], "body": { "type": "BlockStatement", - "start": 15, - "end": 63, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 5, - "column": 1 - } - }, + "start":15,"end":63,"loc":{"start":{"line":1,"column":15},"end":{"line":5,"column":1}}, "body": [ { "type": "ExpressionStatement", - "start": 19, - "end": 32, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 15 - } - }, + "start":19,"end":32,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":15}}, "expression": { "type": "Literal", - "start": 19, - "end": 31, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 14 - } - }, + "start":19,"end":31,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":14}}, "value": "use strict", "raw": "\"use strict\"" }, @@ -114,64 +36,19 @@ }, { "type": "VariableDeclaration", - "start": 35, - "end": 45, - "loc": { - "start": { - "line": 3, - "column": 2 - }, - "end": { - "line": 3, - "column": 12 - } - }, + "start":35,"end":45,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":12}}, "declarations": [ { "type": "VariableDeclarator", - "start": 39, - "end": 44, - "loc": { - "start": { - "line": 3, - "column": 6 - }, - "end": { - "line": 3, - "column": 11 - } - }, + "start":39,"end":44,"loc":{"start":{"line":3,"column":6},"end":{"line":3,"column":11}}, "id": { "type": "Identifier", - "start": 39, - "end": 40, - "loc": { - "start": { - "line": 3, - "column": 6 - }, - "end": { - "line": 3, - "column": 7 - }, - "identifierName": "a" - }, + "start":39,"end":40,"loc":{"start":{"line":3,"column":6},"end":{"line":3,"column":7},"identifierName":"a"}, "name": "a" }, "init": { "type": "Literal", - "start": 43, - "end": 44, - "loc": { - "start": { - "line": 3, - "column": 10 - }, - "end": { - "line": 3, - "column": 11 - } - }, + "start":43,"end":44,"loc":{"start":{"line":3,"column":10},"end":{"line":3,"column":11}}, "value": 1, "raw": "1" } @@ -181,32 +58,10 @@ }, { "type": "ExpressionStatement", - "start": 48, - "end": 61, - "loc": { - "start": { - "line": 4, - "column": 2 - }, - "end": { - "line": 4, - "column": 15 - } - }, + "start":48,"end":61,"loc":{"start":{"line":4,"column":2},"end":{"line":4,"column":15}}, "expression": { "type": "Literal", - "start": 48, - "end": 60, - "loc": { - "start": { - "line": 4, - "column": 2 - }, - "end": { - "line": 4, - "column": 14 - } - }, + "start":48,"end":60,"loc":{"start":{"line":4,"column":2},"end":{"line":4,"column":14}}, "value": "use strict", "raw": "\"use strict\"" } diff --git a/packages/babel-parser/test/fixtures/estree/directives/function-non-strict/output.json b/packages/babel-parser/test/fixtures/estree/directives/function-non-strict/output.json index b886b1ed169a..18f57d0b02ee 100644 --- a/packages/babel-parser/test/fixtures/estree/directives/function-non-strict/output.json +++ b/packages/babel-parser/test/fixtures/estree/directives/function-non-strict/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, "id": { "type": "Identifier", - "start": 9, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "foo" - }, + "start":9,"end":12,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":12},"identifierName":"foo"}, "name": "foo" }, "generator": false, @@ -66,47 +21,14 @@ "params": [], "body": { "type": "BlockStatement", - "start": 16, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":16,"end":39,"loc":{"start":{"line":1,"column":16},"end":{"line":4,"column":1}}, "body": [ { "type": "ExpressionStatement", - "start": 20, - "end": 30, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 12 - } - }, + "start":20,"end":30,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":12}}, "expression": { "type": "Literal", - "start": 20, - "end": 30, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 12 - } - }, + "start":20,"end":30,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":12}}, "value": "use smth", "raw": "\"use smth\"" }, @@ -114,64 +36,20 @@ }, { "type": "ExpressionStatement", - "start": 33, - "end": 37, - "loc": { - "start": { - "line": 3, - "column": 2 - }, - "end": { - "line": 3, - "column": 6 - } - }, + "start":33,"end":37,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":6}}, "expression": { "type": "BinaryExpression", - "start": 33, - "end": 36, - "loc": { - "start": { - "line": 3, - "column": 2 - }, - "end": { - "line": 3, - "column": 5 - } - }, + "start":33,"end":36,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":5}}, "left": { "type": "Literal", - "start": 33, - "end": 34, - "loc": { - "start": { - "line": 3, - "column": 2 - }, - "end": { - "line": 3, - "column": 3 - } - }, + "start":33,"end":34,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":3}}, "value": 1, "raw": "1" }, "operator": "+", "right": { "type": "Literal", - "start": 35, - "end": 36, - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 5 - } - }, + "start":35,"end":36,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":5}}, "value": 1, "raw": "1" } diff --git a/packages/babel-parser/test/fixtures/estree/directives/program-order/output.json b/packages/babel-parser/test/fixtures/estree/directives/program-order/output.json index 80b8812fef99..c03eb506b44b 100644 --- a/packages/babel-parser/test/fixtures/estree/directives/program-order/output.json +++ b/packages/babel-parser/test/fixtures/estree/directives/program-order/output.json @@ -1,62 +1,18 @@ { "type": "File", - "start": 0, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 6 - } - }, + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":6}}, "program": { "type": "Program", - "start": 0, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 6 - } - }, + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":6}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "expression": { "type": "Literal", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, "value": "use strict", "raw": "\"use strict\"" }, @@ -64,32 +20,10 @@ }, { "type": "ExpressionStatement", - "start": 14, - "end": 26, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 12 - } - }, + "start":14,"end":26,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":12}}, "expression": { "type": "Literal", - "start": 14, - "end": 25, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 11 - } - }, + "start":14,"end":25,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":11}}, "value": "use loose", "raw": "\"use loose\"" }, @@ -97,48 +31,14 @@ }, { "type": "VariableDeclaration", - "start": 27, - "end": 33, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 6 - } - }, + "start":27,"end":33,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":6}}, "declarations": [ { "type": "VariableDeclarator", - "start": 31, - "end": 32, - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 5 - } - }, + "start":31,"end":32,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":5}}, "id": { "type": "Identifier", - "start": 31, - "end": 32, - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 5 - }, - "identifierName": "a" - }, + "start":31,"end":32,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":5},"identifierName":"a"}, "name": "a" }, "init": null diff --git a/packages/babel-parser/test/fixtures/estree/directives/program/output.json b/packages/babel-parser/test/fixtures/estree/directives/program/output.json index 60cb5221f5e6..645a584e4521 100644 --- a/packages/babel-parser/test/fixtures/estree/directives/program/output.json +++ b/packages/babel-parser/test/fixtures/estree/directives/program/output.json @@ -1,62 +1,18 @@ { "type": "File", - "start": 0, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 13 - } - }, + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":13}}, "program": { "type": "Program", - "start": 0, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 13 - } - }, + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":13}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "expression": { "type": "Literal", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, "value": "use strict", "raw": "\"use strict\"" }, @@ -64,64 +20,19 @@ }, { "type": "VariableDeclaration", - "start": 14, - "end": 24, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 10 - } - }, + "start":14,"end":24,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":10}}, "declarations": [ { "type": "VariableDeclarator", - "start": 18, - "end": 23, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 9 - } - }, + "start":18,"end":23,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":9}}, "id": { "type": "Identifier", - "start": 18, - "end": 19, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 5 - }, - "identifierName": "a" - }, + "start":18,"end":19,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":5},"identifierName":"a"}, "name": "a" }, "init": { "type": "Literal", - "start": 22, - "end": 23, - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 9 - } - }, + "start":22,"end":23,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":9}}, "value": 1, "raw": "1" } @@ -131,32 +42,10 @@ }, { "type": "ExpressionStatement", - "start": 25, - "end": 38, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 13 - } - }, + "start":25,"end":38,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":13}}, "expression": { "type": "Literal", - "start": 25, - "end": 37, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 12 - } - }, + "start":25,"end":37,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":12}}, "value": "use strict", "raw": "\"use strict\"" } diff --git a/packages/babel-parser/test/fixtures/estree/directives/raw/output.json b/packages/babel-parser/test/fixtures/estree/directives/raw/output.json index 8193286a8cf5..97494837e452 100644 --- a/packages/babel-parser/test/fixtures/estree/directives/raw/output.json +++ b/packages/babel-parser/test/fixtures/estree/directives/raw/output.json @@ -1,62 +1,18 @@ { "type": "File", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "program": { "type": "Program", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "expression": { "type": "Literal", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "value": "use strict", "raw": "\"use\\x20strict\"" }, diff --git a/packages/babel-parser/test/fixtures/estree/dynamic-import/basic/input.js b/packages/babel-parser/test/fixtures/estree/dynamic-import/basic/input.js new file mode 100644 index 000000000000..7fc63cc0957a --- /dev/null +++ b/packages/babel-parser/test/fixtures/estree/dynamic-import/basic/input.js @@ -0,0 +1 @@ +const a = import("a"); diff --git a/packages/babel-parser/test/fixtures/estree/dynamic-import/basic/output.json b/packages/babel-parser/test/fixtures/estree/dynamic-import/basic/output.json new file mode 100644 index 000000000000..342f38a3d580 --- /dev/null +++ b/packages/babel-parser/test/fixtures/estree/dynamic-import/basic/output.json @@ -0,0 +1,38 @@ +{ + "type": "File", + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, + "program": { + "type": "Program", + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":6,"end":21,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":21}}, + "id": { + "type": "Identifier", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"a"}, + "name": "a" + }, + "init": { + "type": "ImportExpression", + "start":10,"end":21,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":21}}, + "source": { + "type": "Literal", + "start":17,"end":20,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":20}}, + "value": "a", + "raw": "\"a\"" + } + } + } + ], + "kind": "const" + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/estree/dynamic-import/options.json b/packages/babel-parser/test/fixtures/estree/dynamic-import/options.json new file mode 100644 index 000000000000..9e48801bb9eb --- /dev/null +++ b/packages/babel-parser/test/fixtures/estree/dynamic-import/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["estree", "dynamicImport"] +} diff --git a/packages/babel-parser/test/fixtures/estree/export/batch/input.js b/packages/babel-parser/test/fixtures/estree/export/batch/input.js new file mode 100644 index 000000000000..9ec8f63ab2fd --- /dev/null +++ b/packages/babel-parser/test/fixtures/estree/export/batch/input.js @@ -0,0 +1 @@ +export * from "foo"; diff --git a/packages/babel-parser/test/fixtures/estree/export/batch/output.json b/packages/babel-parser/test/fixtures/estree/export/batch/output.json new file mode 100644 index 000000000000..0cc8a7ebf294 --- /dev/null +++ b/packages/babel-parser/test/fixtures/estree/export/batch/output.json @@ -0,0 +1,23 @@ +{ + "type": "File", + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, + "program": { + "type": "Program", + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExportAllDeclaration", + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, + "source": { + "type": "Literal", + "start":14,"end":19,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":19}}, + "value": "foo", + "raw": "\"foo\"" + }, + "exported": null + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/export-extensions/ns/input.js b/packages/babel-parser/test/fixtures/estree/export/ns-from/input.js similarity index 100% rename from packages/babel-parser/test/fixtures/experimental/export-extensions/ns/input.js rename to packages/babel-parser/test/fixtures/estree/export/ns-from/input.js diff --git a/packages/babel-parser/test/fixtures/estree/export/ns-from/output.json b/packages/babel-parser/test/fixtures/estree/export/ns-from/output.json new file mode 100644 index 000000000000..35d3ad7ebe51 --- /dev/null +++ b/packages/babel-parser/test/fixtures/estree/export/ns-from/output.json @@ -0,0 +1,27 @@ +{ + "type": "File", + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, + "program": { + "type": "Program", + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExportAllDeclaration", + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, + "source": { + "type": "Literal", + "start":19,"end":25,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":25}}, + "value": "test", + "raw": "'test'" + }, + "exported": { + "type": "Identifier", + "start":12,"end":13,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":13},"identifierName":"A"}, + "name": "A" + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/estree/export/options.json b/packages/babel-parser/test/fixtures/estree/export/options.json new file mode 100644 index 000000000000..9cb285f13a10 --- /dev/null +++ b/packages/babel-parser/test/fixtures/estree/export/options.json @@ -0,0 +1,4 @@ +{ + "plugins": ["estree"], + "sourceType": "module" +} diff --git a/packages/babel-parser/test/fixtures/estree/flow/string-literal-annotation/output.json b/packages/babel-parser/test/fixtures/estree/flow/string-literal-annotation/output.json index 3d767e959f32..d9c4cd6d8ac9 100644 --- a/packages/babel-parser/test/fixtures/estree/flow/string-literal-annotation/output.json +++ b/packages/babel-parser/test/fixtures/estree/flow/string-literal-annotation/output.json @@ -1,107 +1,29 @@ { "type": "File", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "program": { "type": "Program", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":4,"end":15,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":15}}, "id": { "type": "Identifier", - "start": 4, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 15 - }, - "identifierName": "x" - }, + "start":4,"end":15,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":15},"identifierName":"x"}, "name": "x", "typeAnnotation": { "type": "TypeAnnotation", - "start": 5, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":5,"end":15,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":15}}, "typeAnnotation": { "type": "StringLiteralTypeAnnotation", - "start": 7, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":7,"end":15,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":15}}, "value": "string", "raw": "\"string\"" } diff --git a/packages/babel-parser/test/fixtures/estree/literal/boolean/output.json b/packages/babel-parser/test/fixtures/estree/literal/boolean/output.json index 4b390246bd8b..247785e656d3 100644 --- a/packages/babel-parser/test/fixtures/estree/literal/boolean/output.json +++ b/packages/babel-parser/test/fixtures/estree/literal/boolean/output.json @@ -1,94 +1,27 @@ { "type": "File", - "start": 0, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 14 - } - }, + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":14}}, "program": { "type": "Program", - "start": 0, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 14 - } - }, + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":14}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":4,"end":12,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":12}}, "id": { "type": "Identifier", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "a" - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"a"}, "name": "a" }, "init": { "type": "Literal", - "start": 8, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":8,"end":12,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":12}}, "value": true, "raw": "true" } @@ -98,64 +31,19 @@ }, { "type": "VariableDeclaration", - "start": 14, - "end": 28, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 14 - } - }, + "start":14,"end":28,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":14}}, "declarations": [ { "type": "VariableDeclarator", - "start": 18, - "end": 27, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 13 - } - }, + "start":18,"end":27,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":13}}, "id": { "type": "Identifier", - "start": 18, - "end": 19, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 5 - }, - "identifierName": "b" - }, + "start":18,"end":19,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":5},"identifierName":"b"}, "name": "b" }, "init": { "type": "Literal", - "start": 22, - "end": 27, - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 13 - } - }, + "start":22,"end":27,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":13}}, "value": false, "raw": "false" } diff --git a/packages/babel-parser/test/fixtures/estree/literal/null/output.json b/packages/babel-parser/test/fixtures/estree/literal/null/output.json index 450588b8a035..e262d408ca0e 100644 --- a/packages/babel-parser/test/fixtures/estree/literal/null/output.json +++ b/packages/babel-parser/test/fixtures/estree/literal/null/output.json @@ -1,94 +1,27 @@ { "type": "File", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "program": { "type": "Program", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":4,"end":12,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":12}}, "id": { "type": "Identifier", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "a" - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"a"}, "name": "a" }, "init": { "type": "Literal", - "start": 8, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":8,"end":12,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":12}}, "value": null, "raw": "null" } diff --git a/packages/babel-parser/test/fixtures/estree/literal/number/output.json b/packages/babel-parser/test/fixtures/estree/literal/number/output.json index 46cbb6ce3aa8..a10c4906a669 100644 --- a/packages/babel-parser/test/fixtures/estree/literal/number/output.json +++ b/packages/babel-parser/test/fixtures/estree/literal/number/output.json @@ -1,94 +1,27 @@ { "type": "File", - "start": 0, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, "program": { "type": "Program", - "start": 0, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":4,"end":9,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":9}}, "id": { "type": "Identifier", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "a" - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"a"}, "name": "a" }, "init": { "type": "Literal", - "start": 8, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":8,"end":9,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":9}}, "value": 1, "raw": "1" } diff --git a/packages/babel-parser/test/fixtures/estree/literal/regexp/output.json b/packages/babel-parser/test/fixtures/estree/literal/regexp/output.json index cfdf13c59ac9..40d890c79579 100644 --- a/packages/babel-parser/test/fixtures/estree/literal/regexp/output.json +++ b/packages/babel-parser/test/fixtures/estree/literal/regexp/output.json @@ -1,95 +1,32 @@ { "type": "File", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "program": { "type": "Program", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":4,"end":13,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":13}}, "id": { "type": "Identifier", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "a" - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"a"}, "name": "a" }, "init": { "type": "Literal", - "start": 8, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 13 - } + "start":8,"end":13,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":13}}, + "value": { + "$$ babel internal serialized type": "RegExp", + "source": ".*", + "flags": "i" }, - "value": "/.*/i", "raw": "/.*/i", "regex": { "pattern": ".*", diff --git a/packages/babel-parser/test/fixtures/estree/literal/string/output.json b/packages/babel-parser/test/fixtures/estree/literal/string/output.json index 5647bff910ff..a67865ea951e 100644 --- a/packages/babel-parser/test/fixtures/estree/literal/string/output.json +++ b/packages/babel-parser/test/fixtures/estree/literal/string/output.json @@ -1,94 +1,27 @@ { "type": "File", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "program": { "type": "Program", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":4,"end":16,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":16}}, "id": { "type": "Identifier", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "a" - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"a"}, "name": "a" }, "init": { "type": "Literal", - "start": 8, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":8,"end":16,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":16}}, "value": "string", "raw": "\"string\"" } diff --git a/packages/babel-parser/test/fixtures/estree/object-method/basic/output.json b/packages/babel-parser/test/fixtures/estree/object-method/basic/output.json index 2f6b9a5c0422..852471d6a7c1 100644 --- a/packages/babel-parser/test/fixtures/estree/object-method/basic/output.json +++ b/packages/babel-parser/test/fixtures/estree/object-method/basic/output.json @@ -1,143 +1,42 @@ { "type": "File", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 2 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":2}}, "program": { "type": "Program", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 2 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":2}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 2 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":2}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":4,"end":24,"loc":{"start":{"line":1,"column":4},"end":{"line":3,"column":1}}, "id": { "type": "Identifier", - "start": 4, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "bar" - }, + "start":4,"end":7,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":7},"identifierName":"bar"}, "name": "bar" }, "init": { "type": "ObjectExpression", - "start": 10, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":10,"end":24,"loc":{"start":{"line":1,"column":10},"end":{"line":3,"column":1}}, "properties": [ { "type": "Property", - "start": 14, - "end": 22, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 10 - } - }, + "start":14,"end":22,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":10}}, "method": true, "key": { "type": "Identifier", - "start": 14, - "end": 17, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 5 - }, - "identifierName": "foo" - }, + "start":14,"end":17,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":5},"identifierName":"foo"}, "name": "foo" }, "computed": false, "kind": "init", "value": { "type": "FunctionExpression", - "start": 17, - "end": 22, - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 10 - } - }, + "start":17,"end":22,"loc":{"start":{"line":2,"column":5},"end":{"line":2,"column":10}}, "id": null, "generator": false, "async": false, @@ -145,18 +44,7 @@ "params": [], "body": { "type": "BlockStatement", - "start": 20, - "end": 22, - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 10 - } - }, + "start":20,"end":22,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":10}}, "body": [] } }, diff --git a/packages/babel-parser/test/fixtures/estree/object-property/basic/output.json b/packages/babel-parser/test/fixtures/estree/object-property/basic/output.json index 8efc7583c387..760fb02d63c7 100644 --- a/packages/babel-parser/test/fixtures/estree/object-property/basic/output.json +++ b/packages/babel-parser/test/fixtures/estree/object-property/basic/output.json @@ -1,143 +1,42 @@ { "type": "File", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, "program": { "type": "Program", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, "declarations": [ { "type": "VariableDeclarator", - "start": 6, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":6,"end":20,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":20}}, "id": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "a" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"a"}, "name": "a" }, "init": { "type": "ObjectExpression", - "start": 10, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":10,"end":20,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":20}}, "properties": [ { "type": "Property", - "start": 12, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":12,"end":18,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":18}}, "method": false, "key": { "type": "Identifier", - "start": 12, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 15 - }, - "identifierName": "foo" - }, + "start":12,"end":15,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":15},"identifierName":"foo"}, "name": "foo" }, "computed": false, "shorthand": false, "value": { "type": "Literal", - "start": 17, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":17,"end":18,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":18}}, "value": 1, "raw": "1" }, diff --git a/packages/babel-parser/test/fixtures/estree/typescript/enum/output.json b/packages/babel-parser/test/fixtures/estree/typescript/enum/output.json index 7a0e9a0cbb8d..0fe89b60ba8a 100644 --- a/packages/babel-parser/test/fixtures/estree/typescript/enum/output.json +++ b/packages/babel-parser/test/fixtures/estree/typescript/enum/output.json @@ -1,126 +1,36 @@ { "type": "File", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "TSEnumDeclaration", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, "id": { "type": "Identifier", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "A" - }, + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"A"}, "name": "A" }, "members": [ { "type": "TSEnumMember", - "start": 11, - "end": 12, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 3 - } - }, + "start":11,"end":12,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":3}}, "id": { "type": "Identifier", - "start": 11, - "end": 12, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 3 - }, - "identifierName": "a" - }, + "start":11,"end":12,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":3},"identifierName":"a"}, "name": "a" } }, { "type": "TSEnumMember", - "start": 16, - "end": 19, - "loc": { - "start": { - "line": 3, - "column": 2 - }, - "end": { - "line": 3, - "column": 5 - } - }, + "start":16,"end":19,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":5}}, "id": { "type": "Literal", - "start": 16, - "end": 19, - "loc": { - "start": { - "line": 3, - "column": 2 - }, - "end": { - "line": 3, - "column": 5 - } - }, + "start":16,"end":19,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":5}}, "value": "r", "raw": "\"r\"" } diff --git a/packages/babel-parser/test/fixtures/estree/typescript/import-require/output.json b/packages/babel-parser/test/fixtures/estree/typescript/import-require/output.json index 65361fdc837c..5457c5086a37 100644 --- a/packages/babel-parser/test/fixtures/estree/typescript/import-require/output.json +++ b/packages/babel-parser/test/fixtures/estree/typescript/import-require/output.json @@ -1,94 +1,27 @@ { "type": "File", - "start": 0, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, "program": { "type": "Program", - "start": 0, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "TSImportEqualsDeclaration", - "start": 0, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, "isExport": false, "id": { "type": "Identifier", - "start": 7, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - }, - "identifierName": "x" - }, + "start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8},"identifierName":"x"}, "name": "x" }, "moduleReference": { "type": "TSExternalModuleReference", - "start": 11, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":11,"end":31,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":31}}, "expression": { "type": "Literal", - "start": 20, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":20,"end":30,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":30}}, "value": "asdfasdf", "raw": "\"asdfasdf\"" } diff --git a/packages/babel-parser/test/fixtures/estree/typescript/import/output.json b/packages/babel-parser/test/fixtures/estree/typescript/import/output.json index 48ff04ded091..813e43851e8d 100644 --- a/packages/babel-parser/test/fixtures/estree/typescript/import/output.json +++ b/packages/babel-parser/test/fixtures/estree/typescript/import/output.json @@ -1,135 +1,35 @@ { "type": "File", - "start": 0, - "end": 89, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 36 - } - }, + "start":0,"end":89,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":36}}, "program": { "type": "Program", - "start": 0, - "end": 89, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 36 - } - }, + "start":0,"end":89,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":36}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":4,"end":27,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":27}}, "id": { "type": "Identifier", - "start": 4, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 27 - }, - "identifierName": "x" - }, + "start":4,"end":27,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":27},"identifierName":"x"}, "name": "x", "typeAnnotation": { "type": "TSTypeAnnotation", - "start": 5, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":5,"end":27,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":27}}, "typeAnnotation": { "type": "TSTypeQuery", - "start": 7, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":7,"end":27,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":27}}, "exprName": { "type": "TSImportType", - "start": 14, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":14,"end":27,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":27}}, "argument": { "type": "Literal", - "start": 21, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":21,"end":26,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":26}}, "value": "./x", "raw": "'./x'" } @@ -144,109 +44,30 @@ }, { "type": "VariableDeclaration", - "start": 29, - "end": 52, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 23 - } - }, + "start":29,"end":52,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":23}}, "declarations": [ { "type": "VariableDeclarator", - "start": 33, - "end": 51, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 22 - } - }, + "start":33,"end":51,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":22}}, "id": { "type": "Identifier", - "start": 33, - "end": 51, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 22 - }, - "identifierName": "Y" - }, + "start":33,"end":51,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":22},"identifierName":"Y"}, "name": "Y", "typeAnnotation": { "type": "TSTypeAnnotation", - "start": 34, - "end": 51, - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 22 - } - }, + "start":34,"end":51,"loc":{"start":{"line":2,"column":5},"end":{"line":2,"column":22}}, "typeAnnotation": { "type": "TSImportType", - "start": 36, - "end": 51, - "loc": { - "start": { - "line": 2, - "column": 7 - }, - "end": { - "line": 2, - "column": 22 - } - }, + "start":36,"end":51,"loc":{"start":{"line":2,"column":7},"end":{"line":2,"column":22}}, "argument": { "type": "Literal", - "start": 43, - "end": 48, - "loc": { - "start": { - "line": 2, - "column": 14 - }, - "end": { - "line": 2, - "column": 19 - } - }, + "start":43,"end":48,"loc":{"start":{"line":2,"column":14},"end":{"line":2,"column":19}}, "value": "./y", "raw": "'./y'" }, "qualifier": { "type": "Identifier", - "start": 50, - "end": 51, - "loc": { - "start": { - "line": 2, - "column": 21 - }, - "end": { - "line": 2, - "column": 22 - }, - "identifierName": "Y" - }, + "start":50,"end":51,"loc":{"start":{"line":2,"column":21},"end":{"line":2,"column":22},"identifierName":"Y"}, "name": "Y" } } @@ -259,172 +80,48 @@ }, { "type": "VariableDeclaration", - "start": 53, - "end": 89, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 36 - } - }, + "start":53,"end":89,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":36}}, "declarations": [ { "type": "VariableDeclarator", - "start": 57, - "end": 88, - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 35 - } - }, + "start":57,"end":88,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":35}}, "id": { "type": "Identifier", - "start": 57, - "end": 88, - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 35 - }, - "identifierName": "z" - }, + "start":57,"end":88,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":35},"identifierName":"z"}, "name": "z", "typeAnnotation": { "type": "TSTypeAnnotation", - "start": 58, - "end": 88, - "loc": { - "start": { - "line": 3, - "column": 5 - }, - "end": { - "line": 3, - "column": 35 - } - }, + "start":58,"end":88,"loc":{"start":{"line":3,"column":5},"end":{"line":3,"column":35}}, "typeAnnotation": { "type": "TSImportType", - "start": 60, - "end": 88, - "loc": { - "start": { - "line": 3, - "column": 7 - }, - "end": { - "line": 3, - "column": 35 - } - }, + "start":60,"end":88,"loc":{"start":{"line":3,"column":7},"end":{"line":3,"column":35}}, "argument": { "type": "Literal", - "start": 67, - "end": 71, - "loc": { - "start": { - "line": 3, - "column": 14 - }, - "end": { - "line": 3, - "column": 18 - } - }, + "start":67,"end":71,"loc":{"start":{"line":3,"column":14},"end":{"line":3,"column":18}}, "value": "/z", "raw": "\"/z\"" }, "qualifier": { "type": "TSQualifiedName", - "start": 73, - "end": 80, - "loc": { - "start": { - "line": 3, - "column": 20 - }, - "end": { - "line": 3, - "column": 27 - } - }, + "start":73,"end":80,"loc":{"start":{"line":3,"column":20},"end":{"line":3,"column":27}}, "left": { "type": "Identifier", - "start": 73, - "end": 76, - "loc": { - "start": { - "line": 3, - "column": 20 - }, - "end": { - "line": 3, - "column": 23 - }, - "identifierName": "foo" - }, + "start":73,"end":76,"loc":{"start":{"line":3,"column":20},"end":{"line":3,"column":23},"identifierName":"foo"}, "name": "foo" }, "right": { "type": "Identifier", - "start": 77, - "end": 80, - "loc": { - "start": { - "line": 3, - "column": 24 - }, - "end": { - "line": 3, - "column": 27 - }, - "identifierName": "bar" - }, + "start":77,"end":80,"loc":{"start":{"line":3,"column":24},"end":{"line":3,"column":27},"identifierName":"bar"}, "name": "bar" } }, "typeParameters": { "type": "TSTypeParameterInstantiation", - "start": 80, - "end": 88, - "loc": { - "start": { - "line": 3, - "column": 27 - }, - "end": { - "line": 3, - "column": 35 - } - }, + "start":80,"end":88,"loc":{"start":{"line":3,"column":27},"end":{"line":3,"column":35}}, "params": [ { "type": "TSStringKeyword", - "start": 81, - "end": 87, - "loc": { - "start": { - "line": 3, - "column": 28 - }, - "end": { - "line": 3, - "column": 34 - } - } + "start":81,"end":87,"loc":{"start":{"line":3,"column":28},"end":{"line":3,"column":34}} } ] } diff --git a/packages/babel-parser/test/fixtures/estree/typescript/literals/output.json b/packages/babel-parser/test/fixtures/estree/typescript/literals/output.json index e08c9b31db6d..a0c8c7bd1370 100644 --- a/packages/babel-parser/test/fixtures/estree/typescript/literals/output.json +++ b/packages/babel-parser/test/fixtures/estree/typescript/literals/output.json @@ -1,93 +1,26 @@ { "type": "File", - "start": 0, - "end": 131, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 7, - "column": 19 - } - }, + "start":0,"end":131,"loc":{"start":{"line":1,"column":0},"end":{"line":7,"column":19}}, "program": { "type": "Program", - "start": 0, - "end": 131, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 7, - "column": 19 - } - }, + "start":0,"end":131,"loc":{"start":{"line":1,"column":0},"end":{"line":7,"column":19}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "TSTypeAliasDeclaration", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "id": { "type": "Identifier", - "start": 5, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 8 - }, - "identifierName": "Foo" - }, + "start":5,"end":8,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":8},"identifierName":"Foo"}, "name": "Foo" }, "typeAnnotation": { "type": "TSLiteralType", - "start": 11, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":11,"end":16,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":16}}, "literal": { "type": "Literal", - "start": 11, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":11,"end":16,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":16}}, "value": false, "raw": "false" } @@ -95,63 +28,18 @@ }, { "type": "TSTypeAliasDeclaration", - "start": 18, - "end": 35, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 17 - } - }, + "start":18,"end":35,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":17}}, "id": { "type": "Identifier", - "start": 23, - "end": 27, - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 9 - }, - "identifierName": "Foo2" - }, + "start":23,"end":27,"loc":{"start":{"line":2,"column":5},"end":{"line":2,"column":9},"identifierName":"Foo2"}, "name": "Foo2" }, "typeAnnotation": { "type": "TSLiteralType", - "start": 30, - "end": 34, - "loc": { - "start": { - "line": 2, - "column": 12 - }, - "end": { - "line": 2, - "column": 16 - } - }, + "start":30,"end":34,"loc":{"start":{"line":2,"column":12},"end":{"line":2,"column":16}}, "literal": { "type": "Literal", - "start": 30, - "end": 34, - "loc": { - "start": { - "line": 2, - "column": 12 - }, - "end": { - "line": 2, - "column": 16 - } - }, + "start":30,"end":34,"loc":{"start":{"line":2,"column":12},"end":{"line":2,"column":16}}, "value": true, "raw": "true" } @@ -159,63 +47,18 @@ }, { "type": "TSTypeAliasDeclaration", - "start": 36, - "end": 57, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 21 - } - }, + "start":36,"end":57,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":21}}, "id": { "type": "Identifier", - "start": 41, - "end": 45, - "loc": { - "start": { - "line": 3, - "column": 5 - }, - "end": { - "line": 3, - "column": 9 - }, - "identifierName": "Foo3" - }, + "start":41,"end":45,"loc":{"start":{"line":3,"column":5},"end":{"line":3,"column":9},"identifierName":"Foo3"}, "name": "Foo3" }, "typeAnnotation": { "type": "TSLiteralType", - "start": 48, - "end": 56, - "loc": { - "start": { - "line": 3, - "column": 12 - }, - "end": { - "line": 3, - "column": 20 - } - }, + "start":48,"end":56,"loc":{"start":{"line":3,"column":12},"end":{"line":3,"column":20}}, "literal": { "type": "Literal", - "start": 48, - "end": 56, - "loc": { - "start": { - "line": 3, - "column": 12 - }, - "end": { - "line": 3, - "column": 20 - } - }, + "start":48,"end":56,"loc":{"start":{"line":3,"column":12},"end":{"line":3,"column":20}}, "value": "string", "raw": "\"string\"" } @@ -223,63 +66,18 @@ }, { "type": "TSTypeAliasDeclaration", - "start": 58, - "end": 74, - "loc": { - "start": { - "line": 4, - "column": 0 - }, - "end": { - "line": 4, - "column": 16 - } - }, + "start":58,"end":74,"loc":{"start":{"line":4,"column":0},"end":{"line":4,"column":16}}, "id": { "type": "Identifier", - "start": 63, - "end": 67, - "loc": { - "start": { - "line": 4, - "column": 5 - }, - "end": { - "line": 4, - "column": 9 - }, - "identifierName": "Foo4" - }, + "start":63,"end":67,"loc":{"start":{"line":4,"column":5},"end":{"line":4,"column":9},"identifierName":"Foo4"}, "name": "Foo4" }, "typeAnnotation": { "type": "TSLiteralType", - "start": 70, - "end": 73, - "loc": { - "start": { - "line": 4, - "column": 12 - }, - "end": { - "line": 4, - "column": 15 - } - }, + "start":70,"end":73,"loc":{"start":{"line":4,"column":12},"end":{"line":4,"column":15}}, "literal": { "type": "Literal", - "start": 70, - "end": 73, - "loc": { - "start": { - "line": 4, - "column": 12 - }, - "end": { - "line": 4, - "column": 15 - } - }, + "start":70,"end":73,"loc":{"start":{"line":4,"column":12},"end":{"line":4,"column":15}}, "value": 123, "raw": "123" } @@ -287,63 +85,18 @@ }, { "type": "TSTypeAliasDeclaration", - "start": 75, - "end": 93, - "loc": { - "start": { - "line": 5, - "column": 0 - }, - "end": { - "line": 5, - "column": 18 - } - }, + "start":75,"end":93,"loc":{"start":{"line":5,"column":0},"end":{"line":5,"column":18}}, "id": { "type": "Identifier", - "start": 80, - "end": 84, - "loc": { - "start": { - "line": 5, - "column": 5 - }, - "end": { - "line": 5, - "column": 9 - }, - "identifierName": "Foo5" - }, + "start":80,"end":84,"loc":{"start":{"line":5,"column":5},"end":{"line":5,"column":9},"identifierName":"Foo5"}, "name": "Foo5" }, "typeAnnotation": { "type": "TSLiteralType", - "start": 87, - "end": 92, - "loc": { - "start": { - "line": 5, - "column": 12 - }, - "end": { - "line": 5, - "column": 17 - } - }, + "start":87,"end":92,"loc":{"start":{"line":5,"column":12},"end":{"line":5,"column":17}}, "literal": { "type": "Literal", - "start": 87, - "end": 92, - "loc": { - "start": { - "line": 5, - "column": 12 - }, - "end": { - "line": 5, - "column": 17 - } - }, + "start":87,"end":92,"loc":{"start":{"line":5,"column":12},"end":{"line":5,"column":17}}, "value": 123.4, "raw": "123.4" } @@ -351,79 +104,23 @@ }, { "type": "TSTypeAliasDeclaration", - "start": 94, - "end": 111, - "loc": { - "start": { - "line": 6, - "column": 0 - }, - "end": { - "line": 6, - "column": 17 - } - }, + "start":94,"end":111,"loc":{"start":{"line":6,"column":0},"end":{"line":6,"column":17}}, "id": { "type": "Identifier", - "start": 99, - "end": 103, - "loc": { - "start": { - "line": 6, - "column": 5 - }, - "end": { - "line": 6, - "column": 9 - }, - "identifierName": "Foo6" - }, + "start":99,"end":103,"loc":{"start":{"line":6,"column":5},"end":{"line":6,"column":9},"identifierName":"Foo6"}, "name": "Foo6" }, "typeAnnotation": { "type": "TSLiteralType", - "start": 106, - "end": 110, - "loc": { - "start": { - "line": 6, - "column": 12 - }, - "end": { - "line": 6, - "column": 16 - } - }, + "start":106,"end":110,"loc":{"start":{"line":6,"column":12},"end":{"line":6,"column":16}}, "literal": { "type": "UnaryExpression", - "start": 106, - "end": 110, - "loc": { - "start": { - "line": 6, - "column": 12 - }, - "end": { - "line": 6, - "column": 16 - } - }, + "start":106,"end":110,"loc":{"start":{"line":6,"column":12},"end":{"line":6,"column":16}}, "operator": "-", "prefix": true, "argument": { "type": "Literal", - "start": 107, - "end": 110, - "loc": { - "start": { - "line": 6, - "column": 13 - }, - "end": { - "line": 6, - "column": 16 - } - }, + "start":107,"end":110,"loc":{"start":{"line":6,"column":13},"end":{"line":6,"column":16}}, "value": 123, "raw": "123" } @@ -432,79 +129,23 @@ }, { "type": "TSTypeAliasDeclaration", - "start": 112, - "end": 131, - "loc": { - "start": { - "line": 7, - "column": 0 - }, - "end": { - "line": 7, - "column": 19 - } - }, + "start":112,"end":131,"loc":{"start":{"line":7,"column":0},"end":{"line":7,"column":19}}, "id": { "type": "Identifier", - "start": 117, - "end": 121, - "loc": { - "start": { - "line": 7, - "column": 5 - }, - "end": { - "line": 7, - "column": 9 - }, - "identifierName": "Foo7" - }, + "start":117,"end":121,"loc":{"start":{"line":7,"column":5},"end":{"line":7,"column":9},"identifierName":"Foo7"}, "name": "Foo7" }, "typeAnnotation": { "type": "TSLiteralType", - "start": 124, - "end": 130, - "loc": { - "start": { - "line": 7, - "column": 12 - }, - "end": { - "line": 7, - "column": 18 - } - }, + "start":124,"end":130,"loc":{"start":{"line":7,"column":12},"end":{"line":7,"column":18}}, "literal": { "type": "UnaryExpression", - "start": 124, - "end": 130, - "loc": { - "start": { - "line": 7, - "column": 12 - }, - "end": { - "line": 7, - "column": 18 - } - }, + "start":124,"end":130,"loc":{"start":{"line":7,"column":12},"end":{"line":7,"column":18}}, "operator": "-", "prefix": true, "argument": { "type": "Literal", - "start": 125, - "end": 130, - "loc": { - "start": { - "line": 7, - "column": 13 - }, - "end": { - "line": 7, - "column": 18 - } - }, + "start":125,"end":130,"loc":{"start":{"line":7,"column":13},"end":{"line":7,"column":18}}, "value": 123.5, "raw": "123.5" } diff --git a/packages/babel-parser/test/fixtures/experimental/_no-plugin/.bigint/input.js b/packages/babel-parser/test/fixtures/experimental/_no-plugin/.bigint/input.js deleted file mode 100644 index 7a5a058e169c..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/_no-plugin/.bigint/input.js +++ /dev/null @@ -1 +0,0 @@ -1n diff --git a/packages/babel-parser/test/fixtures/experimental/_no-plugin/.bigint/options.json b/packages/babel-parser/test/fixtures/experimental/_no-plugin/.bigint/options.json deleted file mode 100644 index 8e44fabed2f5..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/_no-plugin/.bigint/options.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "throws": "This experimental syntax requires enabling the parser plugin: 'bigInt' (1:1)", - "plugins": [] -} diff --git a/packages/babel-parser/test/fixtures/experimental/_no-plugin/.class-private-properties/options.json b/packages/babel-parser/test/fixtures/experimental/_no-plugin/.class-private-properties/options.json deleted file mode 100644 index 85d7fee65f66..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/_no-plugin/.class-private-properties/options.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "throws": "This experimental syntax requires enabling the parser plugin: 'classPrivateProperties' (2:3)", - "plugins": [] -} diff --git a/packages/babel-parser/test/fixtures/experimental/_no-plugin/.numeric-separator/options.json b/packages/babel-parser/test/fixtures/experimental/_no-plugin/.numeric-separator/options.json deleted file mode 100644 index 6996ba6f1573..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/_no-plugin/.numeric-separator/options.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "throws": "This experimental syntax requires enabling the parser plugin: 'numericSeparator' (1:17)", - "plugins": [] -} diff --git a/packages/babel-parser/test/fixtures/experimental/_no-plugin/.class-private-properties/input.js b/packages/babel-parser/test/fixtures/experimental/_no-plugin/class-private-properties/input.js similarity index 100% rename from packages/babel-parser/test/fixtures/experimental/_no-plugin/.class-private-properties/input.js rename to packages/babel-parser/test/fixtures/experimental/_no-plugin/class-private-properties/input.js diff --git a/packages/babel-parser/test/fixtures/experimental/_no-plugin/class-private-properties/options.json b/packages/babel-parser/test/fixtures/experimental/_no-plugin/class-private-properties/options.json new file mode 100644 index 000000000000..6904d075e9f1 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/_no-plugin/class-private-properties/options.json @@ -0,0 +1,3 @@ +{ + "throws": "This experimental syntax requires enabling one of the following parser plugin(s): 'classPrivateProperties, classPrivateMethods' (2:2)" +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/_no-plugin/dynamic-import/input.js b/packages/babel-parser/test/fixtures/experimental/_no-plugin/dynamic-import/input.js deleted file mode 100644 index f0038a3c11fd..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/_no-plugin/dynamic-import/input.js +++ /dev/null @@ -1 +0,0 @@ -var $ = import("jquery"); diff --git a/packages/babel-parser/test/fixtures/experimental/_no-plugin/dynamic-import/options.json b/packages/babel-parser/test/fixtures/experimental/_no-plugin/dynamic-import/options.json deleted file mode 100644 index 90bbfd5623c9..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/_no-plugin/dynamic-import/options.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "throws": "This experimental syntax requires enabling the parser plugin: 'dynamicImport' (1:8)", - "plugins": [] -} diff --git a/packages/babel-parser/test/fixtures/experimental/_no-plugin/export-namespace/options.json b/packages/babel-parser/test/fixtures/experimental/_no-plugin/export-namespace/options.json deleted file mode 100644 index b8b7c829daad..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/_no-plugin/export-namespace/options.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "throws": "This experimental syntax requires enabling the parser plugin: 'exportNamespaceFrom' (1:9)", - "plugins": [] -} diff --git a/packages/babel-parser/test/fixtures/experimental/_no-plugin/numeric-separator-radix/input.js b/packages/babel-parser/test/fixtures/experimental/_no-plugin/numeric-separator-radix/input.js new file mode 100644 index 000000000000..0fa2562844bb --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/_no-plugin/numeric-separator-radix/input.js @@ -0,0 +1 @@ +0b1_0 diff --git a/packages/babel-parser/test/fixtures/experimental/_no-plugin/numeric-separator-radix/options.json b/packages/babel-parser/test/fixtures/experimental/_no-plugin/numeric-separator-radix/options.json new file mode 100644 index 000000000000..180f7a692d48 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/_no-plugin/numeric-separator-radix/options.json @@ -0,0 +1,3 @@ +{ + "throws": "This experimental syntax requires enabling the parser plugin: 'numericSeparator' (1:3)" +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/_no-plugin/.numeric-separator/input.js b/packages/babel-parser/test/fixtures/experimental/_no-plugin/numeric-separator/input.js similarity index 100% rename from packages/babel-parser/test/fixtures/experimental/_no-plugin/.numeric-separator/input.js rename to packages/babel-parser/test/fixtures/experimental/_no-plugin/numeric-separator/input.js diff --git a/packages/babel-parser/test/fixtures/experimental/_no-plugin/numeric-separator/options.json b/packages/babel-parser/test/fixtures/experimental/_no-plugin/numeric-separator/options.json new file mode 100644 index 000000000000..ed83acd92c8c --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/_no-plugin/numeric-separator/options.json @@ -0,0 +1,3 @@ +{ + "throws": "This experimental syntax requires enabling the parser plugin: 'numericSeparator' (1:1)" +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/_no-plugin/optional-chaining/input.js b/packages/babel-parser/test/fixtures/experimental/_no-plugin/optional-chaining/input.js deleted file mode 100644 index 280754611364..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/_no-plugin/optional-chaining/input.js +++ /dev/null @@ -1 +0,0 @@ -a?.b diff --git a/packages/babel-parser/test/fixtures/experimental/_no-plugin/optional-chaining/options.json b/packages/babel-parser/test/fixtures/experimental/_no-plugin/optional-chaining/options.json deleted file mode 100644 index b8e170c94adb..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/_no-plugin/optional-chaining/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "This experimental syntax requires enabling the parser plugin: 'optionalChaining' (1:1)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/bigint/invalid-decimal/options.json b/packages/babel-parser/test/fixtures/experimental/bigint/invalid-decimal/options.json deleted file mode 100644 index a1fd77a3341e..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/bigint/invalid-decimal/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid BigIntLiteral (1:0)" } diff --git a/packages/babel-parser/test/fixtures/experimental/bigint/invalid-e/options.json b/packages/babel-parser/test/fixtures/experimental/bigint/invalid-e/options.json deleted file mode 100644 index a1fd77a3341e..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/bigint/invalid-e/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid BigIntLiteral (1:0)" } diff --git a/packages/babel-parser/test/fixtures/experimental/bigint/invalid-octal-legacy/options.json b/packages/babel-parser/test/fixtures/experimental/bigint/invalid-octal-legacy/options.json deleted file mode 100644 index a1fd77a3341e..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/bigint/invalid-octal-legacy/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid BigIntLiteral (1:0)" } diff --git a/packages/babel-parser/test/fixtures/experimental/bigint/options.json b/packages/babel-parser/test/fixtures/experimental/bigint/options.json deleted file mode 100644 index f6a5fb21f1c3..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/bigint/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "plugins": ["bigInt"] -} diff --git a/packages/babel-parser/test/fixtures/experimental/bigint/valid-binary/output.json b/packages/babel-parser/test/fixtures/experimental/bigint/valid-binary/output.json deleted file mode 100644 index 2af634126e98..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/bigint/valid-binary/output.json +++ /dev/null @@ -1,70 +0,0 @@ -{ - "type": "File", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "program": { - "type": "Program", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "sourceType": "script", - "interpreter": null, - "body": [ - { - "type": "ExpressionStatement", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "expression": { - "type": "BigIntLiteral", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "extra": { - "rawValue": "0b101011101", - "raw": "0b101011101n" - }, - "value": "0b101011101" - } - } - ], - "directives": [] - } -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/bigint/valid-hex/output.json b/packages/babel-parser/test/fixtures/experimental/bigint/valid-hex/output.json deleted file mode 100644 index 220e28950091..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/bigint/valid-hex/output.json +++ /dev/null @@ -1,70 +0,0 @@ -{ - "type": "File", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "program": { - "type": "Program", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "sourceType": "script", - "interpreter": null, - "body": [ - { - "type": "ExpressionStatement", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "expression": { - "type": "BigIntLiteral", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "extra": { - "rawValue": "0xFFF123", - "raw": "0xFFF123n" - }, - "value": "0xFFF123" - } - } - ], - "directives": [] - } -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/bigint/valid-large/output.json b/packages/babel-parser/test/fixtures/experimental/bigint/valid-large/output.json deleted file mode 100644 index 0839fb9bb614..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/bigint/valid-large/output.json +++ /dev/null @@ -1,70 +0,0 @@ -{ - "type": "File", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, - "program": { - "type": "Program", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, - "sourceType": "script", - "interpreter": null, - "body": [ - { - "type": "ExpressionStatement", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, - "expression": { - "type": "BigIntLiteral", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, - "extra": { - "rawValue": "9223372036854775807", - "raw": "9223372036854775807n" - }, - "value": "9223372036854775807" - } - } - ], - "directives": [] - } -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/bigint/valid-octal-new/output.json b/packages/babel-parser/test/fixtures/experimental/bigint/valid-octal-new/output.json deleted file mode 100644 index 626731276445..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/bigint/valid-octal-new/output.json +++ /dev/null @@ -1,70 +0,0 @@ -{ - "type": "File", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "program": { - "type": "Program", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "sourceType": "script", - "interpreter": null, - "body": [ - { - "type": "ExpressionStatement", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "expression": { - "type": "BigIntLiteral", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "extra": { - "rawValue": "0o16432", - "raw": "0o16432n" - }, - "value": "0o16432" - } - } - ], - "directives": [] - } -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/bigint/valid-small/output.json b/packages/babel-parser/test/fixtures/experimental/bigint/valid-small/output.json deleted file mode 100644 index 1300d0c9314e..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/bigint/valid-small/output.json +++ /dev/null @@ -1,70 +0,0 @@ -{ - "type": "File", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - }, - "program": { - "type": "Program", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - }, - "sourceType": "script", - "interpreter": null, - "body": [ - { - "type": "ExpressionStatement", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - }, - "expression": { - "type": "BigIntLiteral", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - }, - "extra": { - "rawValue": "100", - "raw": "100n" - }, - "value": "100" - } - } - ], - "directives": [] - } -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-methods/async-generator/output.json b/packages/babel-parser/test/fixtures/experimental/class-private-methods/async-generator/output.json index 15456d810c09..b8cbd6ca0aff 100644 --- a/packages/babel-parser/test/fixtures/experimental/class-private-methods/async-generator/output.json +++ b/packages/babel-parser/test/fixtures/experimental/class-private-methods/async-generator/output.json @@ -1,125 +1,35 @@ { "type": "File", - "start": 0, - "end": 212, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 13, - "column": 1 - } - }, + "start":0,"end":212,"loc":{"start":{"line":1,"column":0},"end":{"line":13,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 212, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 13, - "column": 1 - } - }, + "start":0,"end":212,"loc":{"start":{"line":1,"column":0},"end":{"line":13,"column":1}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 212, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 13, - "column": 1 - } - }, + "start":0,"end":212,"loc":{"start":{"line":1,"column":0},"end":{"line":13,"column":1}}, "id": { "type": "Identifier", - "start": 6, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "Foo" - }, + "start":6,"end":9,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":9},"identifierName":"Foo"}, "name": "Foo" }, "superClass": null, "body": { "type": "ClassBody", - "start": 10, - "end": 212, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 13, - "column": 1 - } - }, + "start":10,"end":212,"loc":{"start":{"line":1,"column":10},"end":{"line":13,"column":1}}, "body": [ { "type": "ClassPrivateMethod", - "start": 14, - "end": 210, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 12, - "column": 3 - } - }, + "start":14,"end":210,"loc":{"start":{"line":2,"column":2},"end":{"line":12,"column":3}}, "static": false, "key": { "type": "PrivateName", - "start": 21, - "end": 31, - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 19 - } - }, + "start":21,"end":31,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":19}}, "id": { "type": "Identifier", - "start": 22, - "end": 31, - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 19 - }, - "identifierName": "readLines" - }, + "start":22,"end":31,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":19},"identifierName":"readLines"}, "name": "readLines" } }, @@ -131,144 +41,41 @@ "params": [ { "type": "Identifier", - "start": 32, - "end": 36, - "loc": { - "start": { - "line": 2, - "column": 20 - }, - "end": { - "line": 2, - "column": 24 - }, - "identifierName": "path" - }, + "start":32,"end":36,"loc":{"start":{"line":2,"column":20},"end":{"line":2,"column":24},"identifierName":"path"}, "name": "path" } ], "body": { "type": "BlockStatement", - "start": 38, - "end": 210, - "loc": { - "start": { - "line": 2, - "column": 26 - }, - "end": { - "line": 12, - "column": 3 - } - }, + "start":38,"end":210,"loc":{"start":{"line":2,"column":26},"end":{"line":12,"column":3}}, "body": [ { "type": "VariableDeclaration", - "start": 44, - "end": 76, - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 36 - } - }, + "start":44,"end":76,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":36}}, "declarations": [ { "type": "VariableDeclarator", - "start": 48, - "end": 75, - "loc": { - "start": { - "line": 3, - "column": 8 - }, - "end": { - "line": 3, - "column": 35 - } - }, + "start":48,"end":75,"loc":{"start":{"line":3,"column":8},"end":{"line":3,"column":35}}, "id": { "type": "Identifier", - "start": 48, - "end": 52, - "loc": { - "start": { - "line": 3, - "column": 8 - }, - "end": { - "line": 3, - "column": 12 - }, - "identifierName": "file" - }, + "start":48,"end":52,"loc":{"start":{"line":3,"column":8},"end":{"line":3,"column":12},"identifierName":"file"}, "name": "file" }, "init": { "type": "AwaitExpression", - "start": 55, - "end": 75, - "loc": { - "start": { - "line": 3, - "column": 15 - }, - "end": { - "line": 3, - "column": 35 - } - }, + "start":55,"end":75,"loc":{"start":{"line":3,"column":15},"end":{"line":3,"column":35}}, "argument": { "type": "CallExpression", - "start": 61, - "end": 75, - "loc": { - "start": { - "line": 3, - "column": 21 - }, - "end": { - "line": 3, - "column": 35 - } - }, + "start":61,"end":75,"loc":{"start":{"line":3,"column":21},"end":{"line":3,"column":35}}, "callee": { "type": "Identifier", - "start": 61, - "end": 69, - "loc": { - "start": { - "line": 3, - "column": 21 - }, - "end": { - "line": 3, - "column": 29 - }, - "identifierName": "fileOpen" - }, + "start":61,"end":69,"loc":{"start":{"line":3,"column":21},"end":{"line":3,"column":29},"identifierName":"fileOpen"}, "name": "fileOpen" }, "arguments": [ { "type": "Identifier", - "start": 70, - "end": 74, - "loc": { - "start": { - "line": 3, - "column": 30 - }, - "end": { - "line": 3, - "column": 34 - }, - "identifierName": "path" - }, + "start":70,"end":74,"loc":{"start":{"line":3,"column":30},"end":{"line":3,"column":34},"identifierName":"path"}, "name": "path" } ] @@ -280,109 +87,30 @@ }, { "type": "TryStatement", - "start": 82, - "end": 206, - "loc": { - "start": { - "line": 5, - "column": 4 - }, - "end": { - "line": 11, - "column": 5 - } - }, + "start":82,"end":206,"loc":{"start":{"line":5,"column":4},"end":{"line":11,"column":5}}, "block": { "type": "BlockStatement", - "start": 86, - "end": 164, - "loc": { - "start": { - "line": 5, - "column": 8 - }, - "end": { - "line": 9, - "column": 5 - } - }, + "start":86,"end":164,"loc":{"start":{"line":5,"column":8},"end":{"line":9,"column":5}}, "body": [ { "type": "WhileStatement", - "start": 94, - "end": 158, - "loc": { - "start": { - "line": 6, - "column": 6 - }, - "end": { - "line": 8, - "column": 7 - } - }, + "start":94,"end":158,"loc":{"start":{"line":6,"column":6},"end":{"line":8,"column":7}}, "test": { "type": "UnaryExpression", - "start": 101, - "end": 110, - "loc": { - "start": { - "line": 6, - "column": 13 - }, - "end": { - "line": 6, - "column": 22 - } - }, + "start":101,"end":110,"loc":{"start":{"line":6,"column":13},"end":{"line":6,"column":22}}, "operator": "!", "prefix": true, "argument": { "type": "MemberExpression", - "start": 102, - "end": 110, - "loc": { - "start": { - "line": 6, - "column": 14 - }, - "end": { - "line": 6, - "column": 22 - } - }, + "start":102,"end":110,"loc":{"start":{"line":6,"column":14},"end":{"line":6,"column":22}}, "object": { "type": "Identifier", - "start": 102, - "end": 106, - "loc": { - "start": { - "line": 6, - "column": 14 - }, - "end": { - "line": 6, - "column": 18 - }, - "identifierName": "file" - }, + "start":102,"end":106,"loc":{"start":{"line":6,"column":14},"end":{"line":6,"column":18},"identifierName":"file"}, "name": "file" }, "property": { "type": "Identifier", - "start": 107, - "end": 110, - "loc": { - "start": { - "line": 6, - "column": 19 - }, - "end": { - "line": 6, - "column": 22 - }, - "identifierName": "EOF" - }, + "start":107,"end":110,"loc":{"start":{"line":6,"column":19},"end":{"line":6,"column":22},"identifierName":"EOF"}, "name": "EOF" }, "computed": false @@ -390,122 +118,32 @@ }, "body": { "type": "BlockStatement", - "start": 112, - "end": 158, - "loc": { - "start": { - "line": 6, - "column": 24 - }, - "end": { - "line": 8, - "column": 7 - } - }, + "start":112,"end":158,"loc":{"start":{"line":6,"column":24},"end":{"line":8,"column":7}}, "body": [ { "type": "ExpressionStatement", - "start": 122, - "end": 150, - "loc": { - "start": { - "line": 7, - "column": 8 - }, - "end": { - "line": 7, - "column": 36 - } - }, + "start":122,"end":150,"loc":{"start":{"line":7,"column":8},"end":{"line":7,"column":36}}, "expression": { "type": "YieldExpression", - "start": 122, - "end": 149, - "loc": { - "start": { - "line": 7, - "column": 8 - }, - "end": { - "line": 7, - "column": 35 - } - }, + "start":122,"end":149,"loc":{"start":{"line":7,"column":8},"end":{"line":7,"column":35}}, "delegate": false, "argument": { "type": "AwaitExpression", - "start": 128, - "end": 149, - "loc": { - "start": { - "line": 7, - "column": 14 - }, - "end": { - "line": 7, - "column": 35 - } - }, + "start":128,"end":149,"loc":{"start":{"line":7,"column":14},"end":{"line":7,"column":35}}, "argument": { "type": "CallExpression", - "start": 134, - "end": 149, - "loc": { - "start": { - "line": 7, - "column": 20 - }, - "end": { - "line": 7, - "column": 35 - } - }, + "start":134,"end":149,"loc":{"start":{"line":7,"column":20},"end":{"line":7,"column":35}}, "callee": { "type": "MemberExpression", - "start": 134, - "end": 147, - "loc": { - "start": { - "line": 7, - "column": 20 - }, - "end": { - "line": 7, - "column": 33 - } - }, + "start":134,"end":147,"loc":{"start":{"line":7,"column":20},"end":{"line":7,"column":33}}, "object": { "type": "Identifier", - "start": 134, - "end": 138, - "loc": { - "start": { - "line": 7, - "column": 20 - }, - "end": { - "line": 7, - "column": 24 - }, - "identifierName": "file" - }, + "start":134,"end":138,"loc":{"start":{"line":7,"column":20},"end":{"line":7,"column":24},"identifierName":"file"}, "name": "file" }, "property": { "type": "Identifier", - "start": 139, - "end": 147, - "loc": { - "start": { - "line": 7, - "column": 25 - }, - "end": { - "line": 7, - "column": 33 - }, - "identifierName": "readLine" - }, + "start":139,"end":147,"loc":{"start":{"line":7,"column":25},"end":{"line":7,"column":33},"identifierName":"readLine"}, "name": "readLine" }, "computed": false @@ -525,107 +163,28 @@ "handler": null, "finalizer": { "type": "BlockStatement", - "start": 173, - "end": 206, - "loc": { - "start": { - "line": 9, - "column": 14 - }, - "end": { - "line": 11, - "column": 5 - } - }, + "start":173,"end":206,"loc":{"start":{"line":9,"column":14},"end":{"line":11,"column":5}}, "body": [ { "type": "ExpressionStatement", - "start": 181, - "end": 200, - "loc": { - "start": { - "line": 10, - "column": 6 - }, - "end": { - "line": 10, - "column": 25 - } - }, + "start":181,"end":200,"loc":{"start":{"line":10,"column":6},"end":{"line":10,"column":25}}, "expression": { "type": "AwaitExpression", - "start": 181, - "end": 199, - "loc": { - "start": { - "line": 10, - "column": 6 - }, - "end": { - "line": 10, - "column": 24 - } - }, + "start":181,"end":199,"loc":{"start":{"line":10,"column":6},"end":{"line":10,"column":24}}, "argument": { "type": "CallExpression", - "start": 187, - "end": 199, - "loc": { - "start": { - "line": 10, - "column": 12 - }, - "end": { - "line": 10, - "column": 24 - } - }, + "start":187,"end":199,"loc":{"start":{"line":10,"column":12},"end":{"line":10,"column":24}}, "callee": { "type": "MemberExpression", - "start": 187, - "end": 197, - "loc": { - "start": { - "line": 10, - "column": 12 - }, - "end": { - "line": 10, - "column": 22 - } - }, + "start":187,"end":197,"loc":{"start":{"line":10,"column":12},"end":{"line":10,"column":22}}, "object": { "type": "Identifier", - "start": 187, - "end": 191, - "loc": { - "start": { - "line": 10, - "column": 12 - }, - "end": { - "line": 10, - "column": 16 - }, - "identifierName": "file" - }, + "start":187,"end":191,"loc":{"start":{"line":10,"column":12},"end":{"line":10,"column":16},"identifierName":"file"}, "name": "file" }, "property": { "type": "Identifier", - "start": 192, - "end": 197, - "loc": { - "start": { - "line": 10, - "column": 17 - }, - "end": { - "line": 10, - "column": 22 - }, - "identifierName": "close" - }, + "start":192,"end":197,"loc":{"start":{"line":10,"column":17},"end":{"line":10,"column":22},"identifierName":"close"}, "name": "close" }, "computed": false diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-methods/async/output.json b/packages/babel-parser/test/fixtures/experimental/class-private-methods/async/output.json index f1d0b408d34f..110900de77f5 100644 --- a/packages/babel-parser/test/fixtures/experimental/class-private-methods/async/output.json +++ b/packages/babel-parser/test/fixtures/experimental/class-private-methods/async/output.json @@ -1,125 +1,35 @@ { "type": "File", - "start": 0, - "end": 60, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 1 - } - }, + "start":0,"end":60,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 60, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 1 - } - }, + "start":0,"end":60,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 60, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 1 - } - }, + "start":0,"end":60,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, "id": { "type": "Identifier", - "start": 6, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "Hotel" - }, + "start":6,"end":11,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":11},"identifierName":"Hotel"}, "name": "Hotel" }, "superClass": null, "body": { "type": "ClassBody", - "start": 12, - "end": 60, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 5, - "column": 1 - } - }, + "start":12,"end":60,"loc":{"start":{"line":1,"column":12},"end":{"line":5,"column":1}}, "body": [ { "type": "ClassPrivateMethod", - "start": 16, - "end": 58, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 4, - "column": 3 - } - }, + "start":16,"end":58,"loc":{"start":{"line":2,"column":2},"end":{"line":4,"column":3}}, "static": false, "key": { "type": "PrivateName", - "start": 22, - "end": 27, - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 13 - } - }, + "start":22,"end":27,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":13}}, "id": { "type": "Identifier", - "start": 23, - "end": 27, - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 13 - }, - "identifierName": "evil" - }, + "start":23,"end":27,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":13},"identifierName":"evil"}, "name": "evil" } }, @@ -131,76 +41,20 @@ "params": [], "body": { "type": "BlockStatement", - "start": 30, - "end": 58, - "loc": { - "start": { - "line": 2, - "column": 16 - }, - "end": { - "line": 4, - "column": 3 - } - }, + "start":30,"end":58,"loc":{"start":{"line":2,"column":16},"end":{"line":4,"column":3}}, "body": [ { "type": "ExpressionStatement", - "start": 36, - "end": 54, - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 22 - } - }, + "start":36,"end":54,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":22}}, "expression": { "type": "AwaitExpression", - "start": 36, - "end": 53, - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 21 - } - }, + "start":36,"end":53,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":21}}, "argument": { "type": "CallExpression", - "start": 42, - "end": 53, - "loc": { - "start": { - "line": 3, - "column": 10 - }, - "end": { - "line": 3, - "column": 21 - } - }, + "start":42,"end":53,"loc":{"start":{"line":3,"column":10},"end":{"line":3,"column":21}}, "callee": { "type": "Identifier", - "start": 42, - "end": 51, - "loc": { - "start": { - "line": 3, - "column": 10 - }, - "end": { - "line": 3, - "column": 19 - }, - "identifierName": "notReally" - }, + "start":42,"end":51,"loc":{"start":{"line":3,"column":10},"end":{"line":3,"column":19},"identifierName":"notReally"}, "name": "notReally" }, "arguments": [] diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-methods/combined/output.json b/packages/babel-parser/test/fixtures/experimental/class-private-methods/combined/output.json index 68e29ceab98f..d423f26aebbf 100644 --- a/packages/babel-parser/test/fixtures/experimental/class-private-methods/combined/output.json +++ b/packages/babel-parser/test/fixtures/experimental/class-private-methods/combined/output.json @@ -1,128 +1,38 @@ { "type": "File", - "start": 0, - "end": 159, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 16, - "column": 1 - } - }, + "start":0,"end":159,"loc":{"start":{"line":1,"column":0},"end":{"line":16,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 159, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 16, - "column": 1 - } - }, + "start":0,"end":159,"loc":{"start":{"line":1,"column":0},"end":{"line":16,"column":1}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 159, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 16, - "column": 1 - } - }, + "start":0,"end":159,"loc":{"start":{"line":1,"column":0},"end":{"line":16,"column":1}}, "id": { "type": "Identifier", - "start": 6, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "Foo" - }, + "start":6,"end":9,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":9},"identifierName":"Foo"}, "name": "Foo" }, "superClass": null, "body": { "type": "ClassBody", - "start": 10, - "end": 159, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 16, - "column": 1 - } - }, + "start":10,"end":159,"loc":{"start":{"line":1,"column":10},"end":{"line":16,"column":1}}, "body": [ { "type": "ClassProperty", - "start": 14, - "end": 20, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 8 - } - }, + "start":14,"end":20,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":8}}, "static": false, "key": { "type": "Identifier", - "start": 14, - "end": 15, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 3 - }, - "identifierName": "a" - }, + "start":14,"end":15,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":3},"identifierName":"a"}, "name": "a" }, "computed": false, "value": { "type": "NumericLiteral", - "start": 18, - "end": 19, - "loc": { - "start": { - "line": 2, - "column": 6 - }, - "end": { - "line": 2, - "column": 7 - } - }, + "start":18,"end":19,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":7}}, "extra": { "rawValue": 1, "raw": "1" @@ -132,49 +42,15 @@ }, { "type": "ClassPrivateMethod", - "start": 24, - "end": 52, - "loc": { - "start": { - "line": 4, - "column": 2 - }, - "end": { - "line": 6, - "column": 3 - } - }, + "start":24,"end":52,"loc":{"start":{"line":4,"column":2},"end":{"line":6,"column":3}}, "static": false, "kind": "method", "key": { "type": "PrivateName", - "start": 25, - "end": 27, - "loc": { - "start": { - "line": 4, - "column": 3 - }, - "end": { - "line": 4, - "column": 5 - } - }, + "start":25,"end":27,"loc":{"start":{"line":4,"column":3},"end":{"line":4,"column":5}}, "id": { "type": "Identifier", - "start": 26, - "end": 27, - "loc": { - "start": { - "line": 4, - "column": 4 - }, - "end": { - "line": 4, - "column": 5 - }, - "identifierName": "a" - }, + "start":26,"end":27,"loc":{"start":{"line":4,"column":4},"end":{"line":4,"column":5},"identifierName":"a"}, "name": "a" } }, @@ -184,77 +60,21 @@ "params": [], "body": { "type": "BlockStatement", - "start": 30, - "end": 52, - "loc": { - "start": { - "line": 4, - "column": 8 - }, - "end": { - "line": 6, - "column": 3 - } - }, + "start":30,"end":52,"loc":{"start":{"line":4,"column":8},"end":{"line":6,"column":3}}, "body": [ { "type": "ExpressionStatement", - "start": 36, - "end": 48, - "loc": { - "start": { - "line": 5, - "column": 4 - }, - "end": { - "line": 5, - "column": 16 - } - }, + "start":36,"end":48,"loc":{"start":{"line":5,"column":4},"end":{"line":5,"column":16}}, "expression": { "type": "YieldExpression", - "start": 36, - "end": 47, - "loc": { - "start": { - "line": 5, - "column": 4 - }, - "end": { - "line": 5, - "column": 15 - } - }, + "start":36,"end":47,"loc":{"start":{"line":5,"column":4},"end":{"line":5,"column":15}}, "delegate": false, "argument": { "type": "CallExpression", - "start": 42, - "end": 47, - "loc": { - "start": { - "line": 5, - "column": 10 - }, - "end": { - "line": 5, - "column": 15 - } - }, + "start":42,"end":47,"loc":{"start":{"line":5,"column":10},"end":{"line":5,"column":15}}, "callee": { "type": "Identifier", - "start": 42, - "end": 45, - "loc": { - "start": { - "line": 5, - "column": 10 - }, - "end": { - "line": 5, - "column": 13 - }, - "identifierName": "bar" - }, + "start":42,"end":45,"loc":{"start":{"line":5,"column":10},"end":{"line":5,"column":13},"identifierName":"bar"}, "name": "bar" }, "arguments": [] @@ -267,65 +87,20 @@ }, { "type": "ClassPrivateProperty", - "start": 56, - "end": 63, - "loc": { - "start": { - "line": 8, - "column": 2 - }, - "end": { - "line": 8, - "column": 9 - } - }, + "start":56,"end":63,"loc":{"start":{"line":8,"column":2},"end":{"line":8,"column":9}}, "static": false, "key": { "type": "PrivateName", - "start": 56, - "end": 58, - "loc": { - "start": { - "line": 8, - "column": 2 - }, - "end": { - "line": 8, - "column": 4 - } - }, + "start":56,"end":58,"loc":{"start":{"line":8,"column":2},"end":{"line":8,"column":4}}, "id": { "type": "Identifier", - "start": 57, - "end": 58, - "loc": { - "start": { - "line": 8, - "column": 3 - }, - "end": { - "line": 8, - "column": 4 - }, - "identifierName": "b" - }, + "start":57,"end":58,"loc":{"start":{"line":8,"column":3},"end":{"line":8,"column":4},"identifierName":"b"}, "name": "b" } }, "value": { "type": "NumericLiteral", - "start": 61, - "end": 62, - "loc": { - "start": { - "line": 8, - "column": 7 - }, - "end": { - "line": 8, - "column": 8 - } - }, + "start":61,"end":62,"loc":{"start":{"line":8,"column":7},"end":{"line":8,"column":8}}, "extra": { "rawValue": 2, "raw": "2" @@ -335,34 +110,11 @@ }, { "type": "ClassMethod", - "start": 67, - "end": 91, - "loc": { - "start": { - "line": 10, - "column": 2 - }, - "end": { - "line": 10, - "column": 26 - } - }, + "start":67,"end":91,"loc":{"start":{"line":10,"column":2},"end":{"line":10,"column":26}}, "static": false, "key": { "type": "Identifier", - "start": 71, - "end": 72, - "loc": { - "start": { - "line": 10, - "column": 6 - }, - "end": { - "line": 10, - "column": 7 - }, - "identifierName": "b" - }, + "start":71,"end":72,"loc":{"start":{"line":10,"column":6},"end":{"line":10,"column":7},"identifierName":"b"}, "name": "b" }, "computed": false, @@ -373,47 +125,14 @@ "params": [], "body": { "type": "BlockStatement", - "start": 75, - "end": 91, - "loc": { - "start": { - "line": 10, - "column": 10 - }, - "end": { - "line": 10, - "column": 26 - } - }, + "start":75,"end":91,"loc":{"start":{"line":10,"column":10},"end":{"line":10,"column":26}}, "body": [ { "type": "ReturnStatement", - "start": 77, - "end": 89, - "loc": { - "start": { - "line": 10, - "column": 12 - }, - "end": { - "line": 10, - "column": 24 - } - }, + "start":77,"end":89,"loc":{"start":{"line":10,"column":12},"end":{"line":10,"column":24}}, "argument": { "type": "NumericLiteral", - "start": 84, - "end": 88, - "loc": { - "start": { - "line": 10, - "column": 19 - }, - "end": { - "line": 10, - "column": 23 - } - }, + "start":84,"end":88,"loc":{"start":{"line":10,"column":19},"end":{"line":10,"column":23}}, "extra": { "rawValue": 9999, "raw": "9999" @@ -427,48 +146,14 @@ }, { "type": "ClassPrivateMethod", - "start": 94, - "end": 117, - "loc": { - "start": { - "line": 11, - "column": 2 - }, - "end": { - "line": 11, - "column": 25 - } - }, + "start":94,"end":117,"loc":{"start":{"line":11,"column":2},"end":{"line":11,"column":25}}, "static": false, "key": { "type": "PrivateName", - "start": 98, - "end": 100, - "loc": { - "start": { - "line": 11, - "column": 6 - }, - "end": { - "line": 11, - "column": 8 - } - }, + "start":98,"end":100,"loc":{"start":{"line":11,"column":6},"end":{"line":11,"column":8}}, "id": { "type": "Identifier", - "start": 99, - "end": 100, - "loc": { - "start": { - "line": 11, - "column": 7 - }, - "end": { - "line": 11, - "column": 8 - }, - "identifierName": "c" - }, + "start":99,"end":100,"loc":{"start":{"line":11,"column":7},"end":{"line":11,"column":8},"identifierName":"c"}, "name": "c" } }, @@ -480,66 +165,20 @@ "params": [ { "type": "Identifier", - "start": 101, - "end": 102, - "loc": { - "start": { - "line": 11, - "column": 9 - }, - "end": { - "line": 11, - "column": 10 - }, - "identifierName": "x" - }, + "start":101,"end":102,"loc":{"start":{"line":11,"column":9},"end":{"line":11,"column":10},"identifierName":"x"}, "name": "x" } ], "body": { "type": "BlockStatement", - "start": 104, - "end": 117, - "loc": { - "start": { - "line": 11, - "column": 12 - }, - "end": { - "line": 11, - "column": 25 - } - }, + "start":104,"end":117,"loc":{"start":{"line":11,"column":12},"end":{"line":11,"column":25}}, "body": [ { "type": "ReturnStatement", - "start": 106, - "end": 115, - "loc": { - "start": { - "line": 11, - "column": 14 - }, - "end": { - "line": 11, - "column": 23 - } - }, + "start":106,"end":115,"loc":{"start":{"line":11,"column":14},"end":{"line":11,"column":23}}, "argument": { "type": "Identifier", - "start": 113, - "end": 114, - "loc": { - "start": { - "line": 11, - "column": 21 - }, - "end": { - "line": 11, - "column": 22 - }, - "identifierName": "x" - }, + "start":113,"end":114,"loc":{"start":{"line":11,"column":21},"end":{"line":11,"column":22},"identifierName":"x"}, "name": "x" } } @@ -549,48 +188,14 @@ }, { "type": "ClassPrivateMethod", - "start": 121, - "end": 157, - "loc": { - "start": { - "line": 13, - "column": 2 - }, - "end": { - "line": 15, - "column": 3 - } - }, + "start":121,"end":157,"loc":{"start":{"line":13,"column":2},"end":{"line":15,"column":3}}, "static": false, "key": { "type": "PrivateName", - "start": 121, - "end": 123, - "loc": { - "start": { - "line": 13, - "column": 2 - }, - "end": { - "line": 13, - "column": 4 - } - }, + "start":121,"end":123,"loc":{"start":{"line":13,"column":2},"end":{"line":13,"column":4}}, "id": { "type": "Identifier", - "start": 122, - "end": 123, - "loc": { - "start": { - "line": 13, - "column": 3 - }, - "end": { - "line": 13, - "column": 4 - }, - "identifierName": "d" - }, + "start":122,"end":123,"loc":{"start":{"line":13,"column":3},"end":{"line":13,"column":4},"identifierName":"d"}, "name": "d" } }, @@ -601,93 +206,25 @@ "params": [], "body": { "type": "BlockStatement", - "start": 126, - "end": 157, - "loc": { - "start": { - "line": 13, - "column": 7 - }, - "end": { - "line": 15, - "column": 3 - } - }, + "start":126,"end":157,"loc":{"start":{"line":13,"column":7},"end":{"line":15,"column":3}}, "body": [ { "type": "ReturnStatement", - "start": 132, - "end": 153, - "loc": { - "start": { - "line": 14, - "column": 4 - }, - "end": { - "line": 14, - "column": 25 - } - }, + "start":132,"end":153,"loc":{"start":{"line":14,"column":4},"end":{"line":14,"column":25}}, "argument": { "type": "CallExpression", - "start": 139, - "end": 152, - "loc": { - "start": { - "line": 14, - "column": 11 - }, - "end": { - "line": 14, - "column": 24 - } - }, + "start":139,"end":152,"loc":{"start":{"line":14,"column":11},"end":{"line":14,"column":24}}, "callee": { "type": "MemberExpression", - "start": 139, - "end": 150, - "loc": { - "start": { - "line": 14, - "column": 11 - }, - "end": { - "line": 14, - "column": 22 - } - }, + "start":139,"end":150,"loc":{"start":{"line":14,"column":11},"end":{"line":14,"column":22}}, "object": { "type": "Identifier", - "start": 139, - "end": 143, - "loc": { - "start": { - "line": 14, - "column": 11 - }, - "end": { - "line": 14, - "column": 15 - }, - "identifierName": "Math" - }, + "start":139,"end":143,"loc":{"start":{"line":14,"column":11},"end":{"line":14,"column":15},"identifierName":"Math"}, "name": "Math" }, "property": { "type": "Identifier", - "start": 144, - "end": 150, - "loc": { - "start": { - "line": 14, - "column": 16 - }, - "end": { - "line": 14, - "column": 22 - }, - "identifierName": "random" - }, + "start":144,"end":150,"loc":{"start":{"line":14,"column":16},"end":{"line":14,"column":22},"identifierName":"random"}, "name": "random" }, "computed": false diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-methods/failure-name-constructor/options.json b/packages/babel-parser/test/fixtures/experimental/class-private-methods/failure-name-constructor/options.json index d702f4db972b..8d265ec66c23 100644 --- a/packages/babel-parser/test/fixtures/experimental/class-private-methods/failure-name-constructor/options.json +++ b/packages/babel-parser/test/fixtures/experimental/class-private-methods/failure-name-constructor/options.json @@ -1,4 +1,3 @@ { - "throws": "Classes may not have a private field named '#constructor' (2:2)", "plugins": ["classPrivateMethods"] } diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-methods/failure-name-constructor/output.json b/packages/babel-parser/test/fixtures/experimental/class-private-methods/failure-name-constructor/output.json new file mode 100644 index 000000000000..b1975e9de194 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-methods/failure-name-constructor/output.json @@ -0,0 +1,57 @@ +{ + "type": "File", + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "errors": [ + "SyntaxError: Classes may not have a private field named '#constructor' (2:2)" + ], + "program": { + "type": "Program", + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "id": { + "type": "Identifier", + "start":6,"end":9,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":9},"identifierName":"Foo"}, + "name": "Foo" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":10,"end":34,"loc":{"start":{"line":1,"column":10},"end":{"line":3,"column":1}}, + "body": [ + { + "type": "ClassPrivateMethod", + "start":14,"end":31,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":19}}, + "static": false, + "key": { + "type": "PrivateName", + "start":14,"end":26,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":14}}, + "id": { + "type": "Identifier", + "start":15,"end":26,"loc":{"start":{"line":2,"column":3},"end":{"line":2,"column":14},"identifierName":"constructor"}, + "name": "constructor" + } + }, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":29,"end":31,"loc":{"start":{"line":2,"column":17},"end":{"line":2,"column":19}}, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-methods/failure-spaces/options.json b/packages/babel-parser/test/fixtures/experimental/class-private-methods/failure-spaces/options.json index 9914950b66fe..8d265ec66c23 100644 --- a/packages/babel-parser/test/fixtures/experimental/class-private-methods/failure-spaces/options.json +++ b/packages/babel-parser/test/fixtures/experimental/class-private-methods/failure-spaces/options.json @@ -1,4 +1,3 @@ { - "throws": "Unexpected space between # and identifier (2:3)", "plugins": ["classPrivateMethods"] } diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-methods/failure-spaces/output.json b/packages/babel-parser/test/fixtures/experimental/class-private-methods/failure-spaces/output.json new file mode 100644 index 000000000000..bda07d6588d0 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-methods/failure-spaces/output.json @@ -0,0 +1,72 @@ +{ + "type": "File", + "start":0,"end":60,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, + "errors": [ + "SyntaxError: Unexpected space between # and identifier (2:3)" + ], + "program": { + "type": "Program", + "start":0,"end":60,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start":0,"end":60,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, + "id": { + "type": "Identifier", + "start":6,"end":12,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":12},"identifierName":"Spaces"}, + "name": "Spaces" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":13,"end":60,"loc":{"start":{"line":1,"column":13},"end":{"line":5,"column":1}}, + "body": [ + { + "type": "ClassPrivateMethod", + "start":17,"end":58,"loc":{"start":{"line":2,"column":2},"end":{"line":4,"column":3}}, + "static": false, + "key": { + "type": "PrivateName", + "start":17,"end":31,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":16}}, + "id": { + "type": "Identifier", + "start":20,"end":31,"loc":{"start":{"line":2,"column":5},"end":{"line":2,"column":16},"identifierName":"wrongSpaces"}, + "name": "wrongSpaces" + } + }, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":34,"end":58,"loc":{"start":{"line":2,"column":19},"end":{"line":4,"column":3}}, + "body": [ + { + "type": "ReturnStatement", + "start":40,"end":54,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":18}}, + "argument": { + "type": "CallExpression", + "start":47,"end":53,"loc":{"start":{"line":3,"column":11},"end":{"line":3,"column":17}}, + "callee": { + "type": "Identifier", + "start":47,"end":51,"loc":{"start":{"line":3,"column":11},"end":{"line":3,"column":15},"identifierName":"fail"}, + "name": "fail" + }, + "arguments": [] + } + } + ], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-methods/generator/output.json b/packages/babel-parser/test/fixtures/experimental/class-private-methods/generator/output.json index 03ba9622642d..8f10de0fce6b 100644 --- a/packages/babel-parser/test/fixtures/experimental/class-private-methods/generator/output.json +++ b/packages/babel-parser/test/fixtures/experimental/class-private-methods/generator/output.json @@ -1,126 +1,36 @@ { "type": "File", - "start": 0, - "end": 55, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 1 - } - }, + "start":0,"end":55,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 55, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 1 - } - }, + "start":0,"end":55,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 55, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 1 - } - }, + "start":0,"end":55,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, "id": { "type": "Identifier", - "start": 6, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "Hotel" - }, + "start":6,"end":11,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":11},"identifierName":"Hotel"}, "name": "Hotel" }, "superClass": null, "body": { "type": "ClassBody", - "start": 12, - "end": 55, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 5, - "column": 1 - } - }, + "start":12,"end":55,"loc":{"start":{"line":1,"column":12},"end":{"line":5,"column":1}}, "body": [ { "type": "ClassPrivateMethod", - "start": 16, - "end": 53, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 4, - "column": 3 - } - }, + "start":16,"end":53,"loc":{"start":{"line":2,"column":2},"end":{"line":4,"column":3}}, "static": false, "kind": "method", "key": { "type": "PrivateName", - "start": 17, - "end": 22, - "loc": { - "start": { - "line": 2, - "column": 3 - }, - "end": { - "line": 2, - "column": 8 - } - }, + "start":17,"end":22,"loc":{"start":{"line":2,"column":3},"end":{"line":2,"column":8}}, "id": { "type": "Identifier", - "start": 18, - "end": 22, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 8 - }, - "identifierName": "evil" - }, + "start":18,"end":22,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":8},"identifierName":"evil"}, "name": "evil" } }, @@ -130,77 +40,21 @@ "params": [], "body": { "type": "BlockStatement", - "start": 25, - "end": 53, - "loc": { - "start": { - "line": 2, - "column": 11 - }, - "end": { - "line": 4, - "column": 3 - } - }, + "start":25,"end":53,"loc":{"start":{"line":2,"column":11},"end":{"line":4,"column":3}}, "body": [ { "type": "ExpressionStatement", - "start": 31, - "end": 49, - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 22 - } - }, + "start":31,"end":49,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":22}}, "expression": { "type": "YieldExpression", - "start": 31, - "end": 48, - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 21 - } - }, + "start":31,"end":48,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":21}}, "delegate": false, "argument": { "type": "CallExpression", - "start": 37, - "end": 48, - "loc": { - "start": { - "line": 3, - "column": 10 - }, - "end": { - "line": 3, - "column": 21 - } - }, + "start":37,"end":48,"loc":{"start":{"line":3,"column":10},"end":{"line":3,"column":21}}, "callee": { "type": "Identifier", - "start": 37, - "end": 46, - "loc": { - "start": { - "line": 3, - "column": 10 - }, - "end": { - "line": 3, - "column": 19 - }, - "identifierName": "notReally" - }, + "start":37,"end":46,"loc":{"start":{"line":3,"column":10},"end":{"line":3,"column":19},"identifierName":"notReally"}, "name": "notReally" }, "arguments": [] diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-methods/get-set/output.json b/packages/babel-parser/test/fixtures/experimental/class-private-methods/get-set/output.json index 70e119694395..4d6dc0a81a07 100644 --- a/packages/babel-parser/test/fixtures/experimental/class-private-methods/get-set/output.json +++ b/packages/babel-parser/test/fixtures/experimental/class-private-methods/get-set/output.json @@ -1,125 +1,35 @@ { "type": "File", - "start": 0, - "end": 99, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 8, - "column": 1 - } - }, + "start":0,"end":99,"loc":{"start":{"line":1,"column":0},"end":{"line":8,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 99, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 8, - "column": 1 - } - }, + "start":0,"end":99,"loc":{"start":{"line":1,"column":0},"end":{"line":8,"column":1}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 99, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 8, - "column": 1 - } - }, + "start":0,"end":99,"loc":{"start":{"line":1,"column":0},"end":{"line":8,"column":1}}, "id": { "type": "Identifier", - "start": 6, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "Hotel" - }, + "start":6,"end":11,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":11},"identifierName":"Hotel"}, "name": "Hotel" }, "superClass": null, "body": { "type": "ClassBody", - "start": 12, - "end": 99, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 8, - "column": 1 - } - }, + "start":12,"end":99,"loc":{"start":{"line":1,"column":12},"end":{"line":8,"column":1}}, "body": [ { "type": "ClassPrivateMethod", - "start": 16, - "end": 52, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 4, - "column": 3 - } - }, + "start":16,"end":52,"loc":{"start":{"line":2,"column":2},"end":{"line":4,"column":3}}, "static": false, "key": { "type": "PrivateName", - "start": 20, - "end": 25, - "loc": { - "start": { - "line": 2, - "column": 6 - }, - "end": { - "line": 2, - "column": 11 - } - }, + "start":20,"end":25,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":11}}, "id": { "type": "Identifier", - "start": 21, - "end": 25, - "loc": { - "start": { - "line": 2, - "column": 7 - }, - "end": { - "line": 2, - "column": 11 - }, - "identifierName": "evil" - }, + "start":21,"end":25,"loc":{"start":{"line":2,"column":7},"end":{"line":2,"column":11},"identifierName":"evil"}, "name": "evil" } }, @@ -131,62 +41,17 @@ "params": [], "body": { "type": "BlockStatement", - "start": 28, - "end": 52, - "loc": { - "start": { - "line": 2, - "column": 14 - }, - "end": { - "line": 4, - "column": 3 - } - }, + "start":28,"end":52,"loc":{"start":{"line":2,"column":14},"end":{"line":4,"column":3}}, "body": [ { "type": "ReturnStatement", - "start": 34, - "end": 48, - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 18 - } - }, + "start":34,"end":48,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":18}}, "argument": { "type": "CallExpression", - "start": 41, - "end": 47, - "loc": { - "start": { - "line": 3, - "column": 11 - }, - "end": { - "line": 3, - "column": 17 - } - }, + "start":41,"end":47,"loc":{"start":{"line":3,"column":11},"end":{"line":3,"column":17}}, "callee": { "type": "Identifier", - "start": 41, - "end": 45, - "loc": { - "start": { - "line": 3, - "column": 11 - }, - "end": { - "line": 3, - "column": 15 - }, - "identifierName": "ohNo" - }, + "start":41,"end":45,"loc":{"start":{"line":3,"column":11},"end":{"line":3,"column":15},"identifierName":"ohNo"}, "name": "ohNo" }, "arguments": [] @@ -198,48 +63,14 @@ }, { "type": "ClassPrivateMethod", - "start": 55, - "end": 97, - "loc": { - "start": { - "line": 5, - "column": 2 - }, - "end": { - "line": 7, - "column": 3 - } - }, + "start":55,"end":97,"loc":{"start":{"line":5,"column":2},"end":{"line":7,"column":3}}, "static": false, "key": { "type": "PrivateName", - "start": 59, - "end": 64, - "loc": { - "start": { - "line": 5, - "column": 6 - }, - "end": { - "line": 5, - "column": 11 - } - }, + "start":59,"end":64,"loc":{"start":{"line":5,"column":6},"end":{"line":5,"column":11}}, "id": { "type": "Identifier", - "start": 60, - "end": 64, - "loc": { - "start": { - "line": 5, - "column": 7 - }, - "end": { - "line": 5, - "column": 11 - }, - "identifierName": "evil" - }, + "start":60,"end":64,"loc":{"start":{"line":5,"column":7},"end":{"line":5,"column":11},"identifierName":"evil"}, "name": "evil" } }, @@ -251,98 +82,29 @@ "params": [ { "type": "Identifier", - "start": 65, - "end": 66, - "loc": { - "start": { - "line": 5, - "column": 12 - }, - "end": { - "line": 5, - "column": 13 - }, - "identifierName": "x" - }, + "start":65,"end":66,"loc":{"start":{"line":5,"column":12},"end":{"line":5,"column":13},"identifierName":"x"}, "name": "x" } ], "body": { "type": "BlockStatement", - "start": 68, - "end": 97, - "loc": { - "start": { - "line": 5, - "column": 15 - }, - "end": { - "line": 7, - "column": 3 - } - }, + "start":68,"end":97,"loc":{"start":{"line":5,"column":15},"end":{"line":7,"column":3}}, "body": [ { "type": "ReturnStatement", - "start": 74, - "end": 93, - "loc": { - "start": { - "line": 6, - "column": 4 - }, - "end": { - "line": 6, - "column": 23 - } - }, + "start":74,"end":93,"loc":{"start":{"line":6,"column":4},"end":{"line":6,"column":23}}, "argument": { "type": "CallExpression", - "start": 81, - "end": 92, - "loc": { - "start": { - "line": 6, - "column": 11 - }, - "end": { - "line": 6, - "column": 22 - } - }, + "start":81,"end":92,"loc":{"start":{"line":6,"column":11},"end":{"line":6,"column":22}}, "callee": { "type": "Identifier", - "start": 81, - "end": 89, - "loc": { - "start": { - "line": 6, - "column": 11 - }, - "end": { - "line": 6, - "column": 19 - }, - "identifierName": "makeEvil" - }, + "start":81,"end":89,"loc":{"start":{"line":6,"column":11},"end":{"line":6,"column":19},"identifierName":"makeEvil"}, "name": "makeEvil" }, "arguments": [ { "type": "Identifier", - "start": 90, - "end": 91, - "loc": { - "start": { - "line": 6, - "column": 20 - }, - "end": { - "line": 6, - "column": 21 - }, - "identifierName": "x" - }, + "start":90,"end":91,"loc":{"start":{"line":6,"column":20},"end":{"line":6,"column":21},"identifierName":"x"}, "name": "x" } ] diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-methods/method/output.json b/packages/babel-parser/test/fixtures/experimental/class-private-methods/method/output.json index 6946c14c5af3..524174017a14 100644 --- a/packages/babel-parser/test/fixtures/experimental/class-private-methods/method/output.json +++ b/packages/babel-parser/test/fixtures/experimental/class-private-methods/method/output.json @@ -1,125 +1,35 @@ { "type": "File", - "start": 0, - "end": 64, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 1 - } - }, + "start":0,"end":64,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 64, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 1 - } - }, + "start":0,"end":64,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 64, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 1 - } - }, + "start":0,"end":64,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, "id": { "type": "Identifier", - "start": 6, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "Hotel" - }, + "start":6,"end":11,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":11},"identifierName":"Hotel"}, "name": "Hotel" }, "superClass": null, "body": { "type": "ClassBody", - "start": 12, - "end": 64, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 5, - "column": 1 - } - }, + "start":12,"end":64,"loc":{"start":{"line":1,"column":12},"end":{"line":5,"column":1}}, "body": [ { "type": "ClassPrivateMethod", - "start": 16, - "end": 62, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 4, - "column": 3 - } - }, + "start":16,"end":62,"loc":{"start":{"line":2,"column":2},"end":{"line":4,"column":3}}, "static": false, "key": { "type": "PrivateName", - "start": 16, - "end": 26, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 12 - } - }, + "start":16,"end":26,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":12}}, "id": { "type": "Identifier", - "start": 17, - "end": 26, - "loc": { - "start": { - "line": 2, - "column": 3 - }, - "end": { - "line": 2, - "column": 12 - }, - "identifierName": "getBanned" - }, + "start":17,"end":26,"loc":{"start":{"line":2,"column":3},"end":{"line":2,"column":12},"identifierName":"getBanned"}, "name": "getBanned" } }, @@ -130,62 +40,17 @@ "params": [], "body": { "type": "BlockStatement", - "start": 29, - "end": 62, - "loc": { - "start": { - "line": 2, - "column": 15 - }, - "end": { - "line": 4, - "column": 3 - } - }, + "start":29,"end":62,"loc":{"start":{"line":2,"column":15},"end":{"line":4,"column":3}}, "body": [ { "type": "ReturnStatement", - "start": 35, - "end": 58, - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 27 - } - }, + "start":35,"end":58,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":27}}, "argument": { "type": "CallExpression", - "start": 42, - "end": 57, - "loc": { - "start": { - "line": 3, - "column": 11 - }, - "end": { - "line": 3, - "column": 26 - } - }, + "start":42,"end":57,"loc":{"start":{"line":3,"column":11},"end":{"line":3,"column":26}}, "callee": { "type": "Identifier", - "start": 42, - "end": 55, - "loc": { - "start": { - "line": 3, - "column": 11 - }, - "end": { - "line": 3, - "column": 24 - }, - "identifierName": "violentPeople" - }, + "start":42,"end":55,"loc":{"start":{"line":3,"column":11},"end":{"line":3,"column":24},"identifierName":"violentPeople"}, "name": "violentPeople" }, "arguments": [] diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/README.md b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/README.md new file mode 100644 index 000000000000..d8f726880604 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/README.md @@ -0,0 +1,26 @@ +These tests have been generated using the following script: + +```js +var feat = { + "field": "#x = 0;", + "method": "#x() {}", + "get": "get #x() {}", + "set": "set #x(_) {}", +}; +var placement = { + "static": "static ", + "instance": "" +} + +for (var f1 in feat) for (var f2 in feat) for (var p1 in placement) for (var p2 in placement) { + var code = `class A { + ${placement[p1]}${feat[f1]} + ${placement[p2]}${feat[f2]} +}`; + var name = `${p1}-${f1}-${p2}-${f2}`; + var folder = "packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/" + name; + + if (!fs.existsSync(folder)) fs.mkdirSync(folder); + fs.writeFileSync(folder + "/input.js", code); +} +``` \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-field-instance-field/input.js b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-field-instance-field/input.js new file mode 100644 index 000000000000..bb68229716d6 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-field-instance-field/input.js @@ -0,0 +1,4 @@ +class A { + #x = 0; + #x = 0; +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-field-instance-field/output.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-field-instance-field/output.json new file mode 100644 index 000000000000..365b9b97a943 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-field-instance-field/output.json @@ -0,0 +1,78 @@ +{ + "type": "File", + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "errors": [ + "SyntaxError: Duplicate private name #x (3:2)" + ], + "program": { + "type": "Program", + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "id": { + "type": "Identifier", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":8,"end":31,"loc":{"start":{"line":1,"column":8},"end":{"line":4,"column":1}}, + "body": [ + { + "type": "ClassPrivateProperty", + "start":12,"end":19,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":9}}, + "static": false, + "key": { + "type": "PrivateName", + "start":12,"end":14,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":4}}, + "id": { + "type": "Identifier", + "start":13,"end":14,"loc":{"start":{"line":2,"column":3},"end":{"line":2,"column":4},"identifierName":"x"}, + "name": "x" + } + }, + "value": { + "type": "NumericLiteral", + "start":17,"end":18,"loc":{"start":{"line":2,"column":7},"end":{"line":2,"column":8}}, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + }, + { + "type": "ClassPrivateProperty", + "start":22,"end":29,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":9}}, + "static": false, + "key": { + "type": "PrivateName", + "start":22,"end":24,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":4}}, + "id": { + "type": "Identifier", + "start":23,"end":24,"loc":{"start":{"line":3,"column":3},"end":{"line":3,"column":4},"identifierName":"x"}, + "name": "x" + } + }, + "value": { + "type": "NumericLiteral", + "start":27,"end":28,"loc":{"start":{"line":3,"column":7},"end":{"line":3,"column":8}}, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-field-instance-get/input.js b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-field-instance-get/input.js new file mode 100644 index 000000000000..95514f1d83fd --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-field-instance-get/input.js @@ -0,0 +1,4 @@ +class A { + #x = 0; + get #x() {} +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-field-instance-get/options.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-field-instance-get/options.json new file mode 100644 index 000000000000..af02072af9d9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-field-instance-get/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["classPrivateProperties", "classPrivateMethods"] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-field-instance-get/output.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-field-instance-get/output.json new file mode 100644 index 000000000000..dbd141f36516 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-field-instance-get/output.json @@ -0,0 +1,81 @@ +{ + "type": "File", + "start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "errors": [ + "SyntaxError: Duplicate private name #x (3:6)" + ], + "program": { + "type": "Program", + "start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "id": { + "type": "Identifier", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":8,"end":35,"loc":{"start":{"line":1,"column":8},"end":{"line":4,"column":1}}, + "body": [ + { + "type": "ClassPrivateProperty", + "start":12,"end":19,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":9}}, + "static": false, + "key": { + "type": "PrivateName", + "start":12,"end":14,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":4}}, + "id": { + "type": "Identifier", + "start":13,"end":14,"loc":{"start":{"line":2,"column":3},"end":{"line":2,"column":4},"identifierName":"x"}, + "name": "x" + } + }, + "value": { + "type": "NumericLiteral", + "start":17,"end":18,"loc":{"start":{"line":2,"column":7},"end":{"line":2,"column":8}}, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + }, + { + "type": "ClassPrivateMethod", + "start":22,"end":33,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":13}}, + "static": false, + "key": { + "type": "PrivateName", + "start":26,"end":28,"loc":{"start":{"line":3,"column":6},"end":{"line":3,"column":8}}, + "id": { + "type": "Identifier", + "start":27,"end":28,"loc":{"start":{"line":3,"column":7},"end":{"line":3,"column":8},"identifierName":"x"}, + "name": "x" + } + }, + "computed": false, + "kind": "get", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":31,"end":33,"loc":{"start":{"line":3,"column":11},"end":{"line":3,"column":13}}, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-field-instance-method/input.js b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-field-instance-method/input.js new file mode 100644 index 000000000000..82fa3236ab43 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-field-instance-method/input.js @@ -0,0 +1,4 @@ +class A { + #x = 0; + #x() {} +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-field-instance-method/options.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-field-instance-method/options.json new file mode 100644 index 000000000000..af02072af9d9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-field-instance-method/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["classPrivateProperties", "classPrivateMethods"] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-field-instance-method/output.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-field-instance-method/output.json new file mode 100644 index 000000000000..860696f144c4 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-field-instance-method/output.json @@ -0,0 +1,80 @@ +{ + "type": "File", + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "errors": [ + "SyntaxError: Duplicate private name #x (3:2)" + ], + "program": { + "type": "Program", + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "id": { + "type": "Identifier", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":8,"end":31,"loc":{"start":{"line":1,"column":8},"end":{"line":4,"column":1}}, + "body": [ + { + "type": "ClassPrivateProperty", + "start":12,"end":19,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":9}}, + "static": false, + "key": { + "type": "PrivateName", + "start":12,"end":14,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":4}}, + "id": { + "type": "Identifier", + "start":13,"end":14,"loc":{"start":{"line":2,"column":3},"end":{"line":2,"column":4},"identifierName":"x"}, + "name": "x" + } + }, + "value": { + "type": "NumericLiteral", + "start":17,"end":18,"loc":{"start":{"line":2,"column":7},"end":{"line":2,"column":8}}, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + }, + { + "type": "ClassPrivateMethod", + "start":22,"end":29,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":9}}, + "static": false, + "key": { + "type": "PrivateName", + "start":22,"end":24,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":4}}, + "id": { + "type": "Identifier", + "start":23,"end":24,"loc":{"start":{"line":3,"column":3},"end":{"line":3,"column":4},"identifierName":"x"}, + "name": "x" + } + }, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":27,"end":29,"loc":{"start":{"line":3,"column":7},"end":{"line":3,"column":9}}, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-field-instance-set/input.js b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-field-instance-set/input.js new file mode 100644 index 000000000000..4bb80c110229 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-field-instance-set/input.js @@ -0,0 +1,4 @@ +class A { + #x = 0; + set #x(_) {} +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-field-instance-set/options.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-field-instance-set/options.json new file mode 100644 index 000000000000..af02072af9d9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-field-instance-set/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["classPrivateProperties", "classPrivateMethods"] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-field-instance-set/output.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-field-instance-set/output.json new file mode 100644 index 000000000000..fc48d9672da0 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-field-instance-set/output.json @@ -0,0 +1,87 @@ +{ + "type": "File", + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "errors": [ + "SyntaxError: Duplicate private name #x (3:6)" + ], + "program": { + "type": "Program", + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "id": { + "type": "Identifier", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":8,"end":36,"loc":{"start":{"line":1,"column":8},"end":{"line":4,"column":1}}, + "body": [ + { + "type": "ClassPrivateProperty", + "start":12,"end":19,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":9}}, + "static": false, + "key": { + "type": "PrivateName", + "start":12,"end":14,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":4}}, + "id": { + "type": "Identifier", + "start":13,"end":14,"loc":{"start":{"line":2,"column":3},"end":{"line":2,"column":4},"identifierName":"x"}, + "name": "x" + } + }, + "value": { + "type": "NumericLiteral", + "start":17,"end":18,"loc":{"start":{"line":2,"column":7},"end":{"line":2,"column":8}}, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + }, + { + "type": "ClassPrivateMethod", + "start":22,"end":34,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":14}}, + "static": false, + "key": { + "type": "PrivateName", + "start":26,"end":28,"loc":{"start":{"line":3,"column":6},"end":{"line":3,"column":8}}, + "id": { + "type": "Identifier", + "start":27,"end":28,"loc":{"start":{"line":3,"column":7},"end":{"line":3,"column":8},"identifierName":"x"}, + "name": "x" + } + }, + "computed": false, + "kind": "set", + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start":29,"end":30,"loc":{"start":{"line":3,"column":9},"end":{"line":3,"column":10},"identifierName":"_"}, + "name": "_" + } + ], + "body": { + "type": "BlockStatement", + "start":32,"end":34,"loc":{"start":{"line":3,"column":12},"end":{"line":3,"column":14}}, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-field-static-field/input.js b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-field-static-field/input.js new file mode 100644 index 000000000000..67c3cc794ef3 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-field-static-field/input.js @@ -0,0 +1,4 @@ +class A { + #x = 0; + static #x = 0; +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-field-static-field/options.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-field-static-field/options.json new file mode 100644 index 000000000000..af02072af9d9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-field-static-field/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["classPrivateProperties", "classPrivateMethods"] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-field-static-field/output.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-field-static-field/output.json new file mode 100644 index 000000000000..6bdc11432ece --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-field-static-field/output.json @@ -0,0 +1,78 @@ +{ + "type": "File", + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "errors": [ + "SyntaxError: Duplicate private name #x (3:9)" + ], + "program": { + "type": "Program", + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "id": { + "type": "Identifier", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":8,"end":38,"loc":{"start":{"line":1,"column":8},"end":{"line":4,"column":1}}, + "body": [ + { + "type": "ClassPrivateProperty", + "start":12,"end":19,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":9}}, + "static": false, + "key": { + "type": "PrivateName", + "start":12,"end":14,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":4}}, + "id": { + "type": "Identifier", + "start":13,"end":14,"loc":{"start":{"line":2,"column":3},"end":{"line":2,"column":4},"identifierName":"x"}, + "name": "x" + } + }, + "value": { + "type": "NumericLiteral", + "start":17,"end":18,"loc":{"start":{"line":2,"column":7},"end":{"line":2,"column":8}}, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + }, + { + "type": "ClassPrivateProperty", + "start":22,"end":36,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":16}}, + "static": true, + "key": { + "type": "PrivateName", + "start":29,"end":31,"loc":{"start":{"line":3,"column":9},"end":{"line":3,"column":11}}, + "id": { + "type": "Identifier", + "start":30,"end":31,"loc":{"start":{"line":3,"column":10},"end":{"line":3,"column":11},"identifierName":"x"}, + "name": "x" + } + }, + "value": { + "type": "NumericLiteral", + "start":34,"end":35,"loc":{"start":{"line":3,"column":14},"end":{"line":3,"column":15}}, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-field-static-get/input.js b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-field-static-get/input.js new file mode 100644 index 000000000000..1f53201d6970 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-field-static-get/input.js @@ -0,0 +1,4 @@ +class A { + #x = 0; + static get #x() {} +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-field-static-get/options.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-field-static-get/options.json new file mode 100644 index 000000000000..af02072af9d9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-field-static-get/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["classPrivateProperties", "classPrivateMethods"] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-field-static-get/output.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-field-static-get/output.json new file mode 100644 index 000000000000..78af3bf7c711 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-field-static-get/output.json @@ -0,0 +1,81 @@ +{ + "type": "File", + "start":0,"end":42,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "errors": [ + "SyntaxError: Duplicate private name #x (3:13)" + ], + "program": { + "type": "Program", + "start":0,"end":42,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start":0,"end":42,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "id": { + "type": "Identifier", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":8,"end":42,"loc":{"start":{"line":1,"column":8},"end":{"line":4,"column":1}}, + "body": [ + { + "type": "ClassPrivateProperty", + "start":12,"end":19,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":9}}, + "static": false, + "key": { + "type": "PrivateName", + "start":12,"end":14,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":4}}, + "id": { + "type": "Identifier", + "start":13,"end":14,"loc":{"start":{"line":2,"column":3},"end":{"line":2,"column":4},"identifierName":"x"}, + "name": "x" + } + }, + "value": { + "type": "NumericLiteral", + "start":17,"end":18,"loc":{"start":{"line":2,"column":7},"end":{"line":2,"column":8}}, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + }, + { + "type": "ClassPrivateMethod", + "start":22,"end":40,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":20}}, + "static": true, + "key": { + "type": "PrivateName", + "start":33,"end":35,"loc":{"start":{"line":3,"column":13},"end":{"line":3,"column":15}}, + "id": { + "type": "Identifier", + "start":34,"end":35,"loc":{"start":{"line":3,"column":14},"end":{"line":3,"column":15},"identifierName":"x"}, + "name": "x" + } + }, + "computed": false, + "kind": "get", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":38,"end":40,"loc":{"start":{"line":3,"column":18},"end":{"line":3,"column":20}}, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-field-static-method/input.js b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-field-static-method/input.js new file mode 100644 index 000000000000..a1229c8992f1 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-field-static-method/input.js @@ -0,0 +1,4 @@ +class A { + #x = 0; + static #x() {} +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-field-static-method/options.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-field-static-method/options.json new file mode 100644 index 000000000000..af02072af9d9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-field-static-method/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["classPrivateProperties", "classPrivateMethods"] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-field-static-method/output.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-field-static-method/output.json new file mode 100644 index 000000000000..4d7e2c8824b2 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-field-static-method/output.json @@ -0,0 +1,80 @@ +{ + "type": "File", + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "errors": [ + "SyntaxError: Duplicate private name #x (3:9)" + ], + "program": { + "type": "Program", + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "id": { + "type": "Identifier", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":8,"end":38,"loc":{"start":{"line":1,"column":8},"end":{"line":4,"column":1}}, + "body": [ + { + "type": "ClassPrivateProperty", + "start":12,"end":19,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":9}}, + "static": false, + "key": { + "type": "PrivateName", + "start":12,"end":14,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":4}}, + "id": { + "type": "Identifier", + "start":13,"end":14,"loc":{"start":{"line":2,"column":3},"end":{"line":2,"column":4},"identifierName":"x"}, + "name": "x" + } + }, + "value": { + "type": "NumericLiteral", + "start":17,"end":18,"loc":{"start":{"line":2,"column":7},"end":{"line":2,"column":8}}, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + }, + { + "type": "ClassPrivateMethod", + "start":22,"end":36,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":16}}, + "static": true, + "key": { + "type": "PrivateName", + "start":29,"end":31,"loc":{"start":{"line":3,"column":9},"end":{"line":3,"column":11}}, + "id": { + "type": "Identifier", + "start":30,"end":31,"loc":{"start":{"line":3,"column":10},"end":{"line":3,"column":11},"identifierName":"x"}, + "name": "x" + } + }, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":34,"end":36,"loc":{"start":{"line":3,"column":14},"end":{"line":3,"column":16}}, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-field-static-set/input.js b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-field-static-set/input.js new file mode 100644 index 000000000000..4221a39406f9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-field-static-set/input.js @@ -0,0 +1,4 @@ +class A { + #x = 0; + static set #x(_) {} +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-field-static-set/options.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-field-static-set/options.json new file mode 100644 index 000000000000..af02072af9d9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-field-static-set/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["classPrivateProperties", "classPrivateMethods"] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-field-static-set/output.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-field-static-set/output.json new file mode 100644 index 000000000000..1267a637ac79 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-field-static-set/output.json @@ -0,0 +1,87 @@ +{ + "type": "File", + "start":0,"end":43,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "errors": [ + "SyntaxError: Duplicate private name #x (3:13)" + ], + "program": { + "type": "Program", + "start":0,"end":43,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start":0,"end":43,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "id": { + "type": "Identifier", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":8,"end":43,"loc":{"start":{"line":1,"column":8},"end":{"line":4,"column":1}}, + "body": [ + { + "type": "ClassPrivateProperty", + "start":12,"end":19,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":9}}, + "static": false, + "key": { + "type": "PrivateName", + "start":12,"end":14,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":4}}, + "id": { + "type": "Identifier", + "start":13,"end":14,"loc":{"start":{"line":2,"column":3},"end":{"line":2,"column":4},"identifierName":"x"}, + "name": "x" + } + }, + "value": { + "type": "NumericLiteral", + "start":17,"end":18,"loc":{"start":{"line":2,"column":7},"end":{"line":2,"column":8}}, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + }, + { + "type": "ClassPrivateMethod", + "start":22,"end":41,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":21}}, + "static": true, + "key": { + "type": "PrivateName", + "start":33,"end":35,"loc":{"start":{"line":3,"column":13},"end":{"line":3,"column":15}}, + "id": { + "type": "Identifier", + "start":34,"end":35,"loc":{"start":{"line":3,"column":14},"end":{"line":3,"column":15},"identifierName":"x"}, + "name": "x" + } + }, + "computed": false, + "kind": "set", + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start":36,"end":37,"loc":{"start":{"line":3,"column":16},"end":{"line":3,"column":17},"identifierName":"_"}, + "name": "_" + } + ], + "body": { + "type": "BlockStatement", + "start":39,"end":41,"loc":{"start":{"line":3,"column":19},"end":{"line":3,"column":21}}, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-get-instance-field/input.js b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-get-instance-field/input.js new file mode 100644 index 000000000000..45adc3907e0a --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-get-instance-field/input.js @@ -0,0 +1,4 @@ +class A { + get #x() {} + #x = 0; +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-get-instance-field/options.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-get-instance-field/options.json new file mode 100644 index 000000000000..af02072af9d9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-get-instance-field/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["classPrivateProperties", "classPrivateMethods"] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-get-instance-field/output.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-get-instance-field/output.json new file mode 100644 index 000000000000..326584989c7f --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-get-instance-field/output.json @@ -0,0 +1,81 @@ +{ + "type": "File", + "start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "errors": [ + "SyntaxError: Duplicate private name #x (3:2)" + ], + "program": { + "type": "Program", + "start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "id": { + "type": "Identifier", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":8,"end":35,"loc":{"start":{"line":1,"column":8},"end":{"line":4,"column":1}}, + "body": [ + { + "type": "ClassPrivateMethod", + "start":12,"end":23,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":13}}, + "static": false, + "key": { + "type": "PrivateName", + "start":16,"end":18,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":8}}, + "id": { + "type": "Identifier", + "start":17,"end":18,"loc":{"start":{"line":2,"column":7},"end":{"line":2,"column":8},"identifierName":"x"}, + "name": "x" + } + }, + "computed": false, + "kind": "get", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":21,"end":23,"loc":{"start":{"line":2,"column":11},"end":{"line":2,"column":13}}, + "body": [], + "directives": [] + } + }, + { + "type": "ClassPrivateProperty", + "start":26,"end":33,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":9}}, + "static": false, + "key": { + "type": "PrivateName", + "start":26,"end":28,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":4}}, + "id": { + "type": "Identifier", + "start":27,"end":28,"loc":{"start":{"line":3,"column":3},"end":{"line":3,"column":4},"identifierName":"x"}, + "name": "x" + } + }, + "value": { + "type": "NumericLiteral", + "start":31,"end":32,"loc":{"start":{"line":3,"column":7},"end":{"line":3,"column":8}}, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-get-instance-get/input.js b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-get-instance-get/input.js new file mode 100644 index 000000000000..7818246e3fd0 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-get-instance-get/input.js @@ -0,0 +1,4 @@ +class A { + get #x() {} + get #x() {} +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-get-instance-get/options.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-get-instance-get/options.json new file mode 100644 index 000000000000..af02072af9d9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-get-instance-get/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["classPrivateProperties", "classPrivateMethods"] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-get-instance-get/output.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-get-instance-get/output.json new file mode 100644 index 000000000000..d1d6acb5f0d5 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-get-instance-get/output.json @@ -0,0 +1,84 @@ +{ + "type": "File", + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "errors": [ + "SyntaxError: Duplicate private name #x (3:6)" + ], + "program": { + "type": "Program", + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "id": { + "type": "Identifier", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":8,"end":39,"loc":{"start":{"line":1,"column":8},"end":{"line":4,"column":1}}, + "body": [ + { + "type": "ClassPrivateMethod", + "start":12,"end":23,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":13}}, + "static": false, + "key": { + "type": "PrivateName", + "start":16,"end":18,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":8}}, + "id": { + "type": "Identifier", + "start":17,"end":18,"loc":{"start":{"line":2,"column":7},"end":{"line":2,"column":8},"identifierName":"x"}, + "name": "x" + } + }, + "computed": false, + "kind": "get", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":21,"end":23,"loc":{"start":{"line":2,"column":11},"end":{"line":2,"column":13}}, + "body": [], + "directives": [] + } + }, + { + "type": "ClassPrivateMethod", + "start":26,"end":37,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":13}}, + "static": false, + "key": { + "type": "PrivateName", + "start":30,"end":32,"loc":{"start":{"line":3,"column":6},"end":{"line":3,"column":8}}, + "id": { + "type": "Identifier", + "start":31,"end":32,"loc":{"start":{"line":3,"column":7},"end":{"line":3,"column":8},"identifierName":"x"}, + "name": "x" + } + }, + "computed": false, + "kind": "get", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":35,"end":37,"loc":{"start":{"line":3,"column":11},"end":{"line":3,"column":13}}, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-get-instance-method/input.js b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-get-instance-method/input.js new file mode 100644 index 000000000000..00d50846e973 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-get-instance-method/input.js @@ -0,0 +1,4 @@ +class A { + get #x() {} + #x() {} +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-get-instance-method/options.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-get-instance-method/options.json new file mode 100644 index 000000000000..af02072af9d9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-get-instance-method/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["classPrivateProperties", "classPrivateMethods"] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-get-instance-method/output.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-get-instance-method/output.json new file mode 100644 index 000000000000..995f7b083808 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-get-instance-method/output.json @@ -0,0 +1,83 @@ +{ + "type": "File", + "start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "errors": [ + "SyntaxError: Duplicate private name #x (3:2)" + ], + "program": { + "type": "Program", + "start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "id": { + "type": "Identifier", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":8,"end":35,"loc":{"start":{"line":1,"column":8},"end":{"line":4,"column":1}}, + "body": [ + { + "type": "ClassPrivateMethod", + "start":12,"end":23,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":13}}, + "static": false, + "key": { + "type": "PrivateName", + "start":16,"end":18,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":8}}, + "id": { + "type": "Identifier", + "start":17,"end":18,"loc":{"start":{"line":2,"column":7},"end":{"line":2,"column":8},"identifierName":"x"}, + "name": "x" + } + }, + "computed": false, + "kind": "get", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":21,"end":23,"loc":{"start":{"line":2,"column":11},"end":{"line":2,"column":13}}, + "body": [], + "directives": [] + } + }, + { + "type": "ClassPrivateMethod", + "start":26,"end":33,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":9}}, + "static": false, + "key": { + "type": "PrivateName", + "start":26,"end":28,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":4}}, + "id": { + "type": "Identifier", + "start":27,"end":28,"loc":{"start":{"line":3,"column":3},"end":{"line":3,"column":4},"identifierName":"x"}, + "name": "x" + } + }, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":31,"end":33,"loc":{"start":{"line":3,"column":7},"end":{"line":3,"column":9}}, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-get-instance-set/input.js b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-get-instance-set/input.js new file mode 100644 index 000000000000..f5b4f4bb8764 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-get-instance-set/input.js @@ -0,0 +1,4 @@ +class A { + get #x() {} + set #x(_) {} +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-get-instance-set/output.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-get-instance-set/output.json new file mode 100644 index 000000000000..ce4251ad8e71 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-get-instance-set/output.json @@ -0,0 +1,87 @@ +{ + "type": "File", + "start":0,"end":40,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "program": { + "type": "Program", + "start":0,"end":40,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start":0,"end":40,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "id": { + "type": "Identifier", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":8,"end":40,"loc":{"start":{"line":1,"column":8},"end":{"line":4,"column":1}}, + "body": [ + { + "type": "ClassPrivateMethod", + "start":12,"end":23,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":13}}, + "static": false, + "key": { + "type": "PrivateName", + "start":16,"end":18,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":8}}, + "id": { + "type": "Identifier", + "start":17,"end":18,"loc":{"start":{"line":2,"column":7},"end":{"line":2,"column":8},"identifierName":"x"}, + "name": "x" + } + }, + "computed": false, + "kind": "get", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":21,"end":23,"loc":{"start":{"line":2,"column":11},"end":{"line":2,"column":13}}, + "body": [], + "directives": [] + } + }, + { + "type": "ClassPrivateMethod", + "start":26,"end":38,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":14}}, + "static": false, + "key": { + "type": "PrivateName", + "start":30,"end":32,"loc":{"start":{"line":3,"column":6},"end":{"line":3,"column":8}}, + "id": { + "type": "Identifier", + "start":31,"end":32,"loc":{"start":{"line":3,"column":7},"end":{"line":3,"column":8},"identifierName":"x"}, + "name": "x" + } + }, + "computed": false, + "kind": "set", + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start":33,"end":34,"loc":{"start":{"line":3,"column":9},"end":{"line":3,"column":10},"identifierName":"_"}, + "name": "_" + } + ], + "body": { + "type": "BlockStatement", + "start":36,"end":38,"loc":{"start":{"line":3,"column":12},"end":{"line":3,"column":14}}, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-get-static-field/input.js b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-get-static-field/input.js new file mode 100644 index 000000000000..c915535f827c --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-get-static-field/input.js @@ -0,0 +1,4 @@ +class A { + get #x() {} + static #x = 0; +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-get-static-field/options.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-get-static-field/options.json new file mode 100644 index 000000000000..af02072af9d9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-get-static-field/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["classPrivateProperties", "classPrivateMethods"] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-get-static-field/output.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-get-static-field/output.json new file mode 100644 index 000000000000..35d9b789e28e --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-get-static-field/output.json @@ -0,0 +1,81 @@ +{ + "type": "File", + "start":0,"end":42,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "errors": [ + "SyntaxError: Duplicate private name #x (3:9)" + ], + "program": { + "type": "Program", + "start":0,"end":42,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start":0,"end":42,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "id": { + "type": "Identifier", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":8,"end":42,"loc":{"start":{"line":1,"column":8},"end":{"line":4,"column":1}}, + "body": [ + { + "type": "ClassPrivateMethod", + "start":12,"end":23,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":13}}, + "static": false, + "key": { + "type": "PrivateName", + "start":16,"end":18,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":8}}, + "id": { + "type": "Identifier", + "start":17,"end":18,"loc":{"start":{"line":2,"column":7},"end":{"line":2,"column":8},"identifierName":"x"}, + "name": "x" + } + }, + "computed": false, + "kind": "get", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":21,"end":23,"loc":{"start":{"line":2,"column":11},"end":{"line":2,"column":13}}, + "body": [], + "directives": [] + } + }, + { + "type": "ClassPrivateProperty", + "start":26,"end":40,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":16}}, + "static": true, + "key": { + "type": "PrivateName", + "start":33,"end":35,"loc":{"start":{"line":3,"column":9},"end":{"line":3,"column":11}}, + "id": { + "type": "Identifier", + "start":34,"end":35,"loc":{"start":{"line":3,"column":10},"end":{"line":3,"column":11},"identifierName":"x"}, + "name": "x" + } + }, + "value": { + "type": "NumericLiteral", + "start":38,"end":39,"loc":{"start":{"line":3,"column":14},"end":{"line":3,"column":15}}, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-get-static-get/input.js b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-get-static-get/input.js new file mode 100644 index 000000000000..88136bae1fe0 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-get-static-get/input.js @@ -0,0 +1,4 @@ +class A { + get #x() {} + static get #x() {} +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-get-static-get/options.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-get-static-get/options.json new file mode 100644 index 000000000000..af02072af9d9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-get-static-get/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["classPrivateProperties", "classPrivateMethods"] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-get-static-get/output.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-get-static-get/output.json new file mode 100644 index 000000000000..cb4da3ca4552 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-get-static-get/output.json @@ -0,0 +1,84 @@ +{ + "type": "File", + "start":0,"end":46,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "errors": [ + "SyntaxError: Duplicate private name #x (3:13)" + ], + "program": { + "type": "Program", + "start":0,"end":46,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start":0,"end":46,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "id": { + "type": "Identifier", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":8,"end":46,"loc":{"start":{"line":1,"column":8},"end":{"line":4,"column":1}}, + "body": [ + { + "type": "ClassPrivateMethod", + "start":12,"end":23,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":13}}, + "static": false, + "key": { + "type": "PrivateName", + "start":16,"end":18,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":8}}, + "id": { + "type": "Identifier", + "start":17,"end":18,"loc":{"start":{"line":2,"column":7},"end":{"line":2,"column":8},"identifierName":"x"}, + "name": "x" + } + }, + "computed": false, + "kind": "get", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":21,"end":23,"loc":{"start":{"line":2,"column":11},"end":{"line":2,"column":13}}, + "body": [], + "directives": [] + } + }, + { + "type": "ClassPrivateMethod", + "start":26,"end":44,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":20}}, + "static": true, + "key": { + "type": "PrivateName", + "start":37,"end":39,"loc":{"start":{"line":3,"column":13},"end":{"line":3,"column":15}}, + "id": { + "type": "Identifier", + "start":38,"end":39,"loc":{"start":{"line":3,"column":14},"end":{"line":3,"column":15},"identifierName":"x"}, + "name": "x" + } + }, + "computed": false, + "kind": "get", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":42,"end":44,"loc":{"start":{"line":3,"column":18},"end":{"line":3,"column":20}}, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-get-static-method/input.js b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-get-static-method/input.js new file mode 100644 index 000000000000..73288616ed47 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-get-static-method/input.js @@ -0,0 +1,4 @@ +class A { + get #x() {} + static #x() {} +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-get-static-method/options.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-get-static-method/options.json new file mode 100644 index 000000000000..af02072af9d9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-get-static-method/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["classPrivateProperties", "classPrivateMethods"] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-get-static-method/output.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-get-static-method/output.json new file mode 100644 index 000000000000..af9987434013 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-get-static-method/output.json @@ -0,0 +1,83 @@ +{ + "type": "File", + "start":0,"end":42,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "errors": [ + "SyntaxError: Duplicate private name #x (3:9)" + ], + "program": { + "type": "Program", + "start":0,"end":42,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start":0,"end":42,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "id": { + "type": "Identifier", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":8,"end":42,"loc":{"start":{"line":1,"column":8},"end":{"line":4,"column":1}}, + "body": [ + { + "type": "ClassPrivateMethod", + "start":12,"end":23,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":13}}, + "static": false, + "key": { + "type": "PrivateName", + "start":16,"end":18,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":8}}, + "id": { + "type": "Identifier", + "start":17,"end":18,"loc":{"start":{"line":2,"column":7},"end":{"line":2,"column":8},"identifierName":"x"}, + "name": "x" + } + }, + "computed": false, + "kind": "get", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":21,"end":23,"loc":{"start":{"line":2,"column":11},"end":{"line":2,"column":13}}, + "body": [], + "directives": [] + } + }, + { + "type": "ClassPrivateMethod", + "start":26,"end":40,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":16}}, + "static": true, + "key": { + "type": "PrivateName", + "start":33,"end":35,"loc":{"start":{"line":3,"column":9},"end":{"line":3,"column":11}}, + "id": { + "type": "Identifier", + "start":34,"end":35,"loc":{"start":{"line":3,"column":10},"end":{"line":3,"column":11},"identifierName":"x"}, + "name": "x" + } + }, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":38,"end":40,"loc":{"start":{"line":3,"column":14},"end":{"line":3,"column":16}}, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-get-static-set/input.js b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-get-static-set/input.js new file mode 100644 index 000000000000..bce8d6c24669 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-get-static-set/input.js @@ -0,0 +1,4 @@ +class A { + get #x() {} + static set #x(_) {} +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-get-static-set/options.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-get-static-set/options.json new file mode 100644 index 000000000000..af02072af9d9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-get-static-set/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["classPrivateProperties", "classPrivateMethods"] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-get-static-set/output.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-get-static-set/output.json new file mode 100644 index 000000000000..42d1371ce7dd --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-get-static-set/output.json @@ -0,0 +1,90 @@ +{ + "type": "File", + "start":0,"end":47,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "errors": [ + "SyntaxError: Duplicate private name #x (3:13)" + ], + "program": { + "type": "Program", + "start":0,"end":47,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start":0,"end":47,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "id": { + "type": "Identifier", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":8,"end":47,"loc":{"start":{"line":1,"column":8},"end":{"line":4,"column":1}}, + "body": [ + { + "type": "ClassPrivateMethod", + "start":12,"end":23,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":13}}, + "static": false, + "key": { + "type": "PrivateName", + "start":16,"end":18,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":8}}, + "id": { + "type": "Identifier", + "start":17,"end":18,"loc":{"start":{"line":2,"column":7},"end":{"line":2,"column":8},"identifierName":"x"}, + "name": "x" + } + }, + "computed": false, + "kind": "get", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":21,"end":23,"loc":{"start":{"line":2,"column":11},"end":{"line":2,"column":13}}, + "body": [], + "directives": [] + } + }, + { + "type": "ClassPrivateMethod", + "start":26,"end":45,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":21}}, + "static": true, + "key": { + "type": "PrivateName", + "start":37,"end":39,"loc":{"start":{"line":3,"column":13},"end":{"line":3,"column":15}}, + "id": { + "type": "Identifier", + "start":38,"end":39,"loc":{"start":{"line":3,"column":14},"end":{"line":3,"column":15},"identifierName":"x"}, + "name": "x" + } + }, + "computed": false, + "kind": "set", + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start":40,"end":41,"loc":{"start":{"line":3,"column":16},"end":{"line":3,"column":17},"identifierName":"_"}, + "name": "_" + } + ], + "body": { + "type": "BlockStatement", + "start":43,"end":45,"loc":{"start":{"line":3,"column":19},"end":{"line":3,"column":21}}, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-method-instance-field/input.js b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-method-instance-field/input.js new file mode 100644 index 000000000000..48e8c322691f --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-method-instance-field/input.js @@ -0,0 +1,4 @@ +class A { + #x() {} + #x = 0; +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-method-instance-field/options.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-method-instance-field/options.json new file mode 100644 index 000000000000..af02072af9d9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-method-instance-field/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["classPrivateProperties", "classPrivateMethods"] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-method-instance-field/output.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-method-instance-field/output.json new file mode 100644 index 000000000000..122a0e829f30 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-method-instance-field/output.json @@ -0,0 +1,80 @@ +{ + "type": "File", + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "errors": [ + "SyntaxError: Duplicate private name #x (3:2)" + ], + "program": { + "type": "Program", + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "id": { + "type": "Identifier", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":8,"end":31,"loc":{"start":{"line":1,"column":8},"end":{"line":4,"column":1}}, + "body": [ + { + "type": "ClassPrivateMethod", + "start":12,"end":19,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":9}}, + "static": false, + "key": { + "type": "PrivateName", + "start":12,"end":14,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":4}}, + "id": { + "type": "Identifier", + "start":13,"end":14,"loc":{"start":{"line":2,"column":3},"end":{"line":2,"column":4},"identifierName":"x"}, + "name": "x" + } + }, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":17,"end":19,"loc":{"start":{"line":2,"column":7},"end":{"line":2,"column":9}}, + "body": [], + "directives": [] + } + }, + { + "type": "ClassPrivateProperty", + "start":22,"end":29,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":9}}, + "static": false, + "key": { + "type": "PrivateName", + "start":22,"end":24,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":4}}, + "id": { + "type": "Identifier", + "start":23,"end":24,"loc":{"start":{"line":3,"column":3},"end":{"line":3,"column":4},"identifierName":"x"}, + "name": "x" + } + }, + "value": { + "type": "NumericLiteral", + "start":27,"end":28,"loc":{"start":{"line":3,"column":7},"end":{"line":3,"column":8}}, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-method-instance-get/input.js b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-method-instance-get/input.js new file mode 100644 index 000000000000..b1d19924d288 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-method-instance-get/input.js @@ -0,0 +1,4 @@ +class A { + #x() {} + get #x() {} +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-method-instance-get/options.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-method-instance-get/options.json new file mode 100644 index 000000000000..af02072af9d9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-method-instance-get/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["classPrivateProperties", "classPrivateMethods"] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-method-instance-get/output.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-method-instance-get/output.json new file mode 100644 index 000000000000..9c3051a38021 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-method-instance-get/output.json @@ -0,0 +1,83 @@ +{ + "type": "File", + "start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "errors": [ + "SyntaxError: Duplicate private name #x (3:6)" + ], + "program": { + "type": "Program", + "start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "id": { + "type": "Identifier", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":8,"end":35,"loc":{"start":{"line":1,"column":8},"end":{"line":4,"column":1}}, + "body": [ + { + "type": "ClassPrivateMethod", + "start":12,"end":19,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":9}}, + "static": false, + "key": { + "type": "PrivateName", + "start":12,"end":14,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":4}}, + "id": { + "type": "Identifier", + "start":13,"end":14,"loc":{"start":{"line":2,"column":3},"end":{"line":2,"column":4},"identifierName":"x"}, + "name": "x" + } + }, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":17,"end":19,"loc":{"start":{"line":2,"column":7},"end":{"line":2,"column":9}}, + "body": [], + "directives": [] + } + }, + { + "type": "ClassPrivateMethod", + "start":22,"end":33,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":13}}, + "static": false, + "key": { + "type": "PrivateName", + "start":26,"end":28,"loc":{"start":{"line":3,"column":6},"end":{"line":3,"column":8}}, + "id": { + "type": "Identifier", + "start":27,"end":28,"loc":{"start":{"line":3,"column":7},"end":{"line":3,"column":8},"identifierName":"x"}, + "name": "x" + } + }, + "computed": false, + "kind": "get", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":31,"end":33,"loc":{"start":{"line":3,"column":11},"end":{"line":3,"column":13}}, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-method-instance-method/input.js b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-method-instance-method/input.js new file mode 100644 index 000000000000..c1a8a11a361a --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-method-instance-method/input.js @@ -0,0 +1,4 @@ +class A { + #x() {} + #x() {} +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-method-instance-method/options.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-method-instance-method/options.json new file mode 100644 index 000000000000..af02072af9d9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-method-instance-method/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["classPrivateProperties", "classPrivateMethods"] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-method-instance-method/output.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-method-instance-method/output.json new file mode 100644 index 000000000000..9e05934745d3 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-method-instance-method/output.json @@ -0,0 +1,82 @@ +{ + "type": "File", + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "errors": [ + "SyntaxError: Duplicate private name #x (3:2)" + ], + "program": { + "type": "Program", + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "id": { + "type": "Identifier", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":8,"end":31,"loc":{"start":{"line":1,"column":8},"end":{"line":4,"column":1}}, + "body": [ + { + "type": "ClassPrivateMethod", + "start":12,"end":19,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":9}}, + "static": false, + "key": { + "type": "PrivateName", + "start":12,"end":14,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":4}}, + "id": { + "type": "Identifier", + "start":13,"end":14,"loc":{"start":{"line":2,"column":3},"end":{"line":2,"column":4},"identifierName":"x"}, + "name": "x" + } + }, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":17,"end":19,"loc":{"start":{"line":2,"column":7},"end":{"line":2,"column":9}}, + "body": [], + "directives": [] + } + }, + { + "type": "ClassPrivateMethod", + "start":22,"end":29,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":9}}, + "static": false, + "key": { + "type": "PrivateName", + "start":22,"end":24,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":4}}, + "id": { + "type": "Identifier", + "start":23,"end":24,"loc":{"start":{"line":3,"column":3},"end":{"line":3,"column":4},"identifierName":"x"}, + "name": "x" + } + }, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":27,"end":29,"loc":{"start":{"line":3,"column":7},"end":{"line":3,"column":9}}, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-method-instance-set/input.js b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-method-instance-set/input.js new file mode 100644 index 000000000000..3ac461db7a73 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-method-instance-set/input.js @@ -0,0 +1,4 @@ +class A { + #x() {} + set #x(_) {} +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-method-instance-set/options.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-method-instance-set/options.json new file mode 100644 index 000000000000..af02072af9d9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-method-instance-set/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["classPrivateProperties", "classPrivateMethods"] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-method-instance-set/output.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-method-instance-set/output.json new file mode 100644 index 000000000000..792fec48d7ce --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-method-instance-set/output.json @@ -0,0 +1,89 @@ +{ + "type": "File", + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "errors": [ + "SyntaxError: Duplicate private name #x (3:6)" + ], + "program": { + "type": "Program", + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "id": { + "type": "Identifier", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":8,"end":36,"loc":{"start":{"line":1,"column":8},"end":{"line":4,"column":1}}, + "body": [ + { + "type": "ClassPrivateMethod", + "start":12,"end":19,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":9}}, + "static": false, + "key": { + "type": "PrivateName", + "start":12,"end":14,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":4}}, + "id": { + "type": "Identifier", + "start":13,"end":14,"loc":{"start":{"line":2,"column":3},"end":{"line":2,"column":4},"identifierName":"x"}, + "name": "x" + } + }, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":17,"end":19,"loc":{"start":{"line":2,"column":7},"end":{"line":2,"column":9}}, + "body": [], + "directives": [] + } + }, + { + "type": "ClassPrivateMethod", + "start":22,"end":34,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":14}}, + "static": false, + "key": { + "type": "PrivateName", + "start":26,"end":28,"loc":{"start":{"line":3,"column":6},"end":{"line":3,"column":8}}, + "id": { + "type": "Identifier", + "start":27,"end":28,"loc":{"start":{"line":3,"column":7},"end":{"line":3,"column":8},"identifierName":"x"}, + "name": "x" + } + }, + "computed": false, + "kind": "set", + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start":29,"end":30,"loc":{"start":{"line":3,"column":9},"end":{"line":3,"column":10},"identifierName":"_"}, + "name": "_" + } + ], + "body": { + "type": "BlockStatement", + "start":32,"end":34,"loc":{"start":{"line":3,"column":12},"end":{"line":3,"column":14}}, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-method-static-field/input.js b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-method-static-field/input.js new file mode 100644 index 000000000000..f9f1b1015567 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-method-static-field/input.js @@ -0,0 +1,4 @@ +class A { + #x() {} + static #x = 0; +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-method-static-field/options.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-method-static-field/options.json new file mode 100644 index 000000000000..af02072af9d9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-method-static-field/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["classPrivateProperties", "classPrivateMethods"] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-method-static-field/output.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-method-static-field/output.json new file mode 100644 index 000000000000..91b3df114cef --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-method-static-field/output.json @@ -0,0 +1,80 @@ +{ + "type": "File", + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "errors": [ + "SyntaxError: Duplicate private name #x (3:9)" + ], + "program": { + "type": "Program", + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "id": { + "type": "Identifier", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":8,"end":38,"loc":{"start":{"line":1,"column":8},"end":{"line":4,"column":1}}, + "body": [ + { + "type": "ClassPrivateMethod", + "start":12,"end":19,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":9}}, + "static": false, + "key": { + "type": "PrivateName", + "start":12,"end":14,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":4}}, + "id": { + "type": "Identifier", + "start":13,"end":14,"loc":{"start":{"line":2,"column":3},"end":{"line":2,"column":4},"identifierName":"x"}, + "name": "x" + } + }, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":17,"end":19,"loc":{"start":{"line":2,"column":7},"end":{"line":2,"column":9}}, + "body": [], + "directives": [] + } + }, + { + "type": "ClassPrivateProperty", + "start":22,"end":36,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":16}}, + "static": true, + "key": { + "type": "PrivateName", + "start":29,"end":31,"loc":{"start":{"line":3,"column":9},"end":{"line":3,"column":11}}, + "id": { + "type": "Identifier", + "start":30,"end":31,"loc":{"start":{"line":3,"column":10},"end":{"line":3,"column":11},"identifierName":"x"}, + "name": "x" + } + }, + "value": { + "type": "NumericLiteral", + "start":34,"end":35,"loc":{"start":{"line":3,"column":14},"end":{"line":3,"column":15}}, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-method-static-get/input.js b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-method-static-get/input.js new file mode 100644 index 000000000000..fdf3bef6984c --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-method-static-get/input.js @@ -0,0 +1,4 @@ +class A { + #x() {} + static get #x() {} +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-method-static-get/options.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-method-static-get/options.json new file mode 100644 index 000000000000..af02072af9d9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-method-static-get/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["classPrivateProperties", "classPrivateMethods"] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-method-static-get/output.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-method-static-get/output.json new file mode 100644 index 000000000000..9ee1d22c1b87 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-method-static-get/output.json @@ -0,0 +1,83 @@ +{ + "type": "File", + "start":0,"end":42,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "errors": [ + "SyntaxError: Duplicate private name #x (3:13)" + ], + "program": { + "type": "Program", + "start":0,"end":42,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start":0,"end":42,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "id": { + "type": "Identifier", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":8,"end":42,"loc":{"start":{"line":1,"column":8},"end":{"line":4,"column":1}}, + "body": [ + { + "type": "ClassPrivateMethod", + "start":12,"end":19,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":9}}, + "static": false, + "key": { + "type": "PrivateName", + "start":12,"end":14,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":4}}, + "id": { + "type": "Identifier", + "start":13,"end":14,"loc":{"start":{"line":2,"column":3},"end":{"line":2,"column":4},"identifierName":"x"}, + "name": "x" + } + }, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":17,"end":19,"loc":{"start":{"line":2,"column":7},"end":{"line":2,"column":9}}, + "body": [], + "directives": [] + } + }, + { + "type": "ClassPrivateMethod", + "start":22,"end":40,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":20}}, + "static": true, + "key": { + "type": "PrivateName", + "start":33,"end":35,"loc":{"start":{"line":3,"column":13},"end":{"line":3,"column":15}}, + "id": { + "type": "Identifier", + "start":34,"end":35,"loc":{"start":{"line":3,"column":14},"end":{"line":3,"column":15},"identifierName":"x"}, + "name": "x" + } + }, + "computed": false, + "kind": "get", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":38,"end":40,"loc":{"start":{"line":3,"column":18},"end":{"line":3,"column":20}}, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-method-static-method/input.js b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-method-static-method/input.js new file mode 100644 index 000000000000..a1aa1d542441 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-method-static-method/input.js @@ -0,0 +1,4 @@ +class A { + #x() {} + static #x() {} +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-method-static-method/options.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-method-static-method/options.json new file mode 100644 index 000000000000..af02072af9d9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-method-static-method/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["classPrivateProperties", "classPrivateMethods"] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-method-static-method/output.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-method-static-method/output.json new file mode 100644 index 000000000000..17a3f7593137 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-method-static-method/output.json @@ -0,0 +1,82 @@ +{ + "type": "File", + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "errors": [ + "SyntaxError: Duplicate private name #x (3:9)" + ], + "program": { + "type": "Program", + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "id": { + "type": "Identifier", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":8,"end":38,"loc":{"start":{"line":1,"column":8},"end":{"line":4,"column":1}}, + "body": [ + { + "type": "ClassPrivateMethod", + "start":12,"end":19,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":9}}, + "static": false, + "key": { + "type": "PrivateName", + "start":12,"end":14,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":4}}, + "id": { + "type": "Identifier", + "start":13,"end":14,"loc":{"start":{"line":2,"column":3},"end":{"line":2,"column":4},"identifierName":"x"}, + "name": "x" + } + }, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":17,"end":19,"loc":{"start":{"line":2,"column":7},"end":{"line":2,"column":9}}, + "body": [], + "directives": [] + } + }, + { + "type": "ClassPrivateMethod", + "start":22,"end":36,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":16}}, + "static": true, + "key": { + "type": "PrivateName", + "start":29,"end":31,"loc":{"start":{"line":3,"column":9},"end":{"line":3,"column":11}}, + "id": { + "type": "Identifier", + "start":30,"end":31,"loc":{"start":{"line":3,"column":10},"end":{"line":3,"column":11},"identifierName":"x"}, + "name": "x" + } + }, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":34,"end":36,"loc":{"start":{"line":3,"column":14},"end":{"line":3,"column":16}}, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-method-static-set/input.js b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-method-static-set/input.js new file mode 100644 index 000000000000..3b2e1e37704a --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-method-static-set/input.js @@ -0,0 +1,4 @@ +class A { + #x() {} + static set #x(_) {} +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-method-static-set/options.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-method-static-set/options.json new file mode 100644 index 000000000000..af02072af9d9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-method-static-set/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["classPrivateProperties", "classPrivateMethods"] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-method-static-set/output.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-method-static-set/output.json new file mode 100644 index 000000000000..f7d4c6d3a12f --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-method-static-set/output.json @@ -0,0 +1,89 @@ +{ + "type": "File", + "start":0,"end":43,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "errors": [ + "SyntaxError: Duplicate private name #x (3:13)" + ], + "program": { + "type": "Program", + "start":0,"end":43,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start":0,"end":43,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "id": { + "type": "Identifier", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":8,"end":43,"loc":{"start":{"line":1,"column":8},"end":{"line":4,"column":1}}, + "body": [ + { + "type": "ClassPrivateMethod", + "start":12,"end":19,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":9}}, + "static": false, + "key": { + "type": "PrivateName", + "start":12,"end":14,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":4}}, + "id": { + "type": "Identifier", + "start":13,"end":14,"loc":{"start":{"line":2,"column":3},"end":{"line":2,"column":4},"identifierName":"x"}, + "name": "x" + } + }, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":17,"end":19,"loc":{"start":{"line":2,"column":7},"end":{"line":2,"column":9}}, + "body": [], + "directives": [] + } + }, + { + "type": "ClassPrivateMethod", + "start":22,"end":41,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":21}}, + "static": true, + "key": { + "type": "PrivateName", + "start":33,"end":35,"loc":{"start":{"line":3,"column":13},"end":{"line":3,"column":15}}, + "id": { + "type": "Identifier", + "start":34,"end":35,"loc":{"start":{"line":3,"column":14},"end":{"line":3,"column":15},"identifierName":"x"}, + "name": "x" + } + }, + "computed": false, + "kind": "set", + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start":36,"end":37,"loc":{"start":{"line":3,"column":16},"end":{"line":3,"column":17},"identifierName":"_"}, + "name": "_" + } + ], + "body": { + "type": "BlockStatement", + "start":39,"end":41,"loc":{"start":{"line":3,"column":19},"end":{"line":3,"column":21}}, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-set-instance-field/input.js b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-set-instance-field/input.js new file mode 100644 index 000000000000..095f191f877b --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-set-instance-field/input.js @@ -0,0 +1,4 @@ +class A { + set #x(_) {} + #x = 0; +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-set-instance-field/options.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-set-instance-field/options.json new file mode 100644 index 000000000000..af02072af9d9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-set-instance-field/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["classPrivateProperties", "classPrivateMethods"] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-set-instance-field/output.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-set-instance-field/output.json new file mode 100644 index 000000000000..f0e607109c92 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-set-instance-field/output.json @@ -0,0 +1,87 @@ +{ + "type": "File", + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "errors": [ + "SyntaxError: Duplicate private name #x (3:2)" + ], + "program": { + "type": "Program", + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "id": { + "type": "Identifier", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":8,"end":36,"loc":{"start":{"line":1,"column":8},"end":{"line":4,"column":1}}, + "body": [ + { + "type": "ClassPrivateMethod", + "start":12,"end":24,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":14}}, + "static": false, + "key": { + "type": "PrivateName", + "start":16,"end":18,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":8}}, + "id": { + "type": "Identifier", + "start":17,"end":18,"loc":{"start":{"line":2,"column":7},"end":{"line":2,"column":8},"identifierName":"x"}, + "name": "x" + } + }, + "computed": false, + "kind": "set", + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start":19,"end":20,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":10},"identifierName":"_"}, + "name": "_" + } + ], + "body": { + "type": "BlockStatement", + "start":22,"end":24,"loc":{"start":{"line":2,"column":12},"end":{"line":2,"column":14}}, + "body": [], + "directives": [] + } + }, + { + "type": "ClassPrivateProperty", + "start":27,"end":34,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":9}}, + "static": false, + "key": { + "type": "PrivateName", + "start":27,"end":29,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":4}}, + "id": { + "type": "Identifier", + "start":28,"end":29,"loc":{"start":{"line":3,"column":3},"end":{"line":3,"column":4},"identifierName":"x"}, + "name": "x" + } + }, + "value": { + "type": "NumericLiteral", + "start":32,"end":33,"loc":{"start":{"line":3,"column":7},"end":{"line":3,"column":8}}, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-set-instance-get/input.js b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-set-instance-get/input.js new file mode 100644 index 000000000000..8e7e5544b96e --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-set-instance-get/input.js @@ -0,0 +1,4 @@ +class A { + set #x(_) {} + get #x() {} +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-set-instance-get/output.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-set-instance-get/output.json new file mode 100644 index 000000000000..9f600515531d --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-set-instance-get/output.json @@ -0,0 +1,87 @@ +{ + "type": "File", + "start":0,"end":40,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "program": { + "type": "Program", + "start":0,"end":40,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start":0,"end":40,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "id": { + "type": "Identifier", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":8,"end":40,"loc":{"start":{"line":1,"column":8},"end":{"line":4,"column":1}}, + "body": [ + { + "type": "ClassPrivateMethod", + "start":12,"end":24,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":14}}, + "static": false, + "key": { + "type": "PrivateName", + "start":16,"end":18,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":8}}, + "id": { + "type": "Identifier", + "start":17,"end":18,"loc":{"start":{"line":2,"column":7},"end":{"line":2,"column":8},"identifierName":"x"}, + "name": "x" + } + }, + "computed": false, + "kind": "set", + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start":19,"end":20,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":10},"identifierName":"_"}, + "name": "_" + } + ], + "body": { + "type": "BlockStatement", + "start":22,"end":24,"loc":{"start":{"line":2,"column":12},"end":{"line":2,"column":14}}, + "body": [], + "directives": [] + } + }, + { + "type": "ClassPrivateMethod", + "start":27,"end":38,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":13}}, + "static": false, + "key": { + "type": "PrivateName", + "start":31,"end":33,"loc":{"start":{"line":3,"column":6},"end":{"line":3,"column":8}}, + "id": { + "type": "Identifier", + "start":32,"end":33,"loc":{"start":{"line":3,"column":7},"end":{"line":3,"column":8},"identifierName":"x"}, + "name": "x" + } + }, + "computed": false, + "kind": "get", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":36,"end":38,"loc":{"start":{"line":3,"column":11},"end":{"line":3,"column":13}}, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-set-instance-method/input.js b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-set-instance-method/input.js new file mode 100644 index 000000000000..f0d912243eef --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-set-instance-method/input.js @@ -0,0 +1,4 @@ +class A { + set #x(_) {} + #x() {} +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-set-instance-method/options.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-set-instance-method/options.json new file mode 100644 index 000000000000..af02072af9d9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-set-instance-method/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["classPrivateProperties", "classPrivateMethods"] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-set-instance-method/output.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-set-instance-method/output.json new file mode 100644 index 000000000000..816bb3ac1410 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-set-instance-method/output.json @@ -0,0 +1,89 @@ +{ + "type": "File", + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "errors": [ + "SyntaxError: Duplicate private name #x (3:2)" + ], + "program": { + "type": "Program", + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "id": { + "type": "Identifier", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":8,"end":36,"loc":{"start":{"line":1,"column":8},"end":{"line":4,"column":1}}, + "body": [ + { + "type": "ClassPrivateMethod", + "start":12,"end":24,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":14}}, + "static": false, + "key": { + "type": "PrivateName", + "start":16,"end":18,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":8}}, + "id": { + "type": "Identifier", + "start":17,"end":18,"loc":{"start":{"line":2,"column":7},"end":{"line":2,"column":8},"identifierName":"x"}, + "name": "x" + } + }, + "computed": false, + "kind": "set", + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start":19,"end":20,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":10},"identifierName":"_"}, + "name": "_" + } + ], + "body": { + "type": "BlockStatement", + "start":22,"end":24,"loc":{"start":{"line":2,"column":12},"end":{"line":2,"column":14}}, + "body": [], + "directives": [] + } + }, + { + "type": "ClassPrivateMethod", + "start":27,"end":34,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":9}}, + "static": false, + "key": { + "type": "PrivateName", + "start":27,"end":29,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":4}}, + "id": { + "type": "Identifier", + "start":28,"end":29,"loc":{"start":{"line":3,"column":3},"end":{"line":3,"column":4},"identifierName":"x"}, + "name": "x" + } + }, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":32,"end":34,"loc":{"start":{"line":3,"column":7},"end":{"line":3,"column":9}}, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-set-instance-set/input.js b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-set-instance-set/input.js new file mode 100644 index 000000000000..d4e2624635cb --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-set-instance-set/input.js @@ -0,0 +1,4 @@ +class A { + set #x(_) {} + set #x(_) {} +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-set-instance-set/options.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-set-instance-set/options.json new file mode 100644 index 000000000000..af02072af9d9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-set-instance-set/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["classPrivateProperties", "classPrivateMethods"] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-set-instance-set/output.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-set-instance-set/output.json new file mode 100644 index 000000000000..6fe3015ccf76 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-set-instance-set/output.json @@ -0,0 +1,96 @@ +{ + "type": "File", + "start":0,"end":41,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "errors": [ + "SyntaxError: Duplicate private name #x (3:6)" + ], + "program": { + "type": "Program", + "start":0,"end":41,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start":0,"end":41,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "id": { + "type": "Identifier", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":8,"end":41,"loc":{"start":{"line":1,"column":8},"end":{"line":4,"column":1}}, + "body": [ + { + "type": "ClassPrivateMethod", + "start":12,"end":24,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":14}}, + "static": false, + "key": { + "type": "PrivateName", + "start":16,"end":18,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":8}}, + "id": { + "type": "Identifier", + "start":17,"end":18,"loc":{"start":{"line":2,"column":7},"end":{"line":2,"column":8},"identifierName":"x"}, + "name": "x" + } + }, + "computed": false, + "kind": "set", + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start":19,"end":20,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":10},"identifierName":"_"}, + "name": "_" + } + ], + "body": { + "type": "BlockStatement", + "start":22,"end":24,"loc":{"start":{"line":2,"column":12},"end":{"line":2,"column":14}}, + "body": [], + "directives": [] + } + }, + { + "type": "ClassPrivateMethod", + "start":27,"end":39,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":14}}, + "static": false, + "key": { + "type": "PrivateName", + "start":31,"end":33,"loc":{"start":{"line":3,"column":6},"end":{"line":3,"column":8}}, + "id": { + "type": "Identifier", + "start":32,"end":33,"loc":{"start":{"line":3,"column":7},"end":{"line":3,"column":8},"identifierName":"x"}, + "name": "x" + } + }, + "computed": false, + "kind": "set", + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start":34,"end":35,"loc":{"start":{"line":3,"column":9},"end":{"line":3,"column":10},"identifierName":"_"}, + "name": "_" + } + ], + "body": { + "type": "BlockStatement", + "start":37,"end":39,"loc":{"start":{"line":3,"column":12},"end":{"line":3,"column":14}}, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-set-static-field/input.js b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-set-static-field/input.js new file mode 100644 index 000000000000..3e3b25f208b6 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-set-static-field/input.js @@ -0,0 +1,4 @@ +class A { + set #x(_) {} + static #x = 0; +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-set-static-field/options.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-set-static-field/options.json new file mode 100644 index 000000000000..af02072af9d9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-set-static-field/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["classPrivateProperties", "classPrivateMethods"] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-set-static-field/output.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-set-static-field/output.json new file mode 100644 index 000000000000..7c3c0b0a5e41 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-set-static-field/output.json @@ -0,0 +1,87 @@ +{ + "type": "File", + "start":0,"end":43,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "errors": [ + "SyntaxError: Duplicate private name #x (3:9)" + ], + "program": { + "type": "Program", + "start":0,"end":43,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start":0,"end":43,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "id": { + "type": "Identifier", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":8,"end":43,"loc":{"start":{"line":1,"column":8},"end":{"line":4,"column":1}}, + "body": [ + { + "type": "ClassPrivateMethod", + "start":12,"end":24,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":14}}, + "static": false, + "key": { + "type": "PrivateName", + "start":16,"end":18,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":8}}, + "id": { + "type": "Identifier", + "start":17,"end":18,"loc":{"start":{"line":2,"column":7},"end":{"line":2,"column":8},"identifierName":"x"}, + "name": "x" + } + }, + "computed": false, + "kind": "set", + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start":19,"end":20,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":10},"identifierName":"_"}, + "name": "_" + } + ], + "body": { + "type": "BlockStatement", + "start":22,"end":24,"loc":{"start":{"line":2,"column":12},"end":{"line":2,"column":14}}, + "body": [], + "directives": [] + } + }, + { + "type": "ClassPrivateProperty", + "start":27,"end":41,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":16}}, + "static": true, + "key": { + "type": "PrivateName", + "start":34,"end":36,"loc":{"start":{"line":3,"column":9},"end":{"line":3,"column":11}}, + "id": { + "type": "Identifier", + "start":35,"end":36,"loc":{"start":{"line":3,"column":10},"end":{"line":3,"column":11},"identifierName":"x"}, + "name": "x" + } + }, + "value": { + "type": "NumericLiteral", + "start":39,"end":40,"loc":{"start":{"line":3,"column":14},"end":{"line":3,"column":15}}, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-set-static-get/input.js b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-set-static-get/input.js new file mode 100644 index 000000000000..3c0764dfad45 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-set-static-get/input.js @@ -0,0 +1,4 @@ +class A { + set #x(_) {} + static get #x() {} +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-set-static-get/options.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-set-static-get/options.json new file mode 100644 index 000000000000..af02072af9d9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-set-static-get/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["classPrivateProperties", "classPrivateMethods"] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-set-static-get/output.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-set-static-get/output.json new file mode 100644 index 000000000000..ee2325e1bddb --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-set-static-get/output.json @@ -0,0 +1,90 @@ +{ + "type": "File", + "start":0,"end":47,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "errors": [ + "SyntaxError: Duplicate private name #x (3:13)" + ], + "program": { + "type": "Program", + "start":0,"end":47,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start":0,"end":47,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "id": { + "type": "Identifier", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":8,"end":47,"loc":{"start":{"line":1,"column":8},"end":{"line":4,"column":1}}, + "body": [ + { + "type": "ClassPrivateMethod", + "start":12,"end":24,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":14}}, + "static": false, + "key": { + "type": "PrivateName", + "start":16,"end":18,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":8}}, + "id": { + "type": "Identifier", + "start":17,"end":18,"loc":{"start":{"line":2,"column":7},"end":{"line":2,"column":8},"identifierName":"x"}, + "name": "x" + } + }, + "computed": false, + "kind": "set", + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start":19,"end":20,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":10},"identifierName":"_"}, + "name": "_" + } + ], + "body": { + "type": "BlockStatement", + "start":22,"end":24,"loc":{"start":{"line":2,"column":12},"end":{"line":2,"column":14}}, + "body": [], + "directives": [] + } + }, + { + "type": "ClassPrivateMethod", + "start":27,"end":45,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":20}}, + "static": true, + "key": { + "type": "PrivateName", + "start":38,"end":40,"loc":{"start":{"line":3,"column":13},"end":{"line":3,"column":15}}, + "id": { + "type": "Identifier", + "start":39,"end":40,"loc":{"start":{"line":3,"column":14},"end":{"line":3,"column":15},"identifierName":"x"}, + "name": "x" + } + }, + "computed": false, + "kind": "get", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":43,"end":45,"loc":{"start":{"line":3,"column":18},"end":{"line":3,"column":20}}, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-set-static-method/input.js b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-set-static-method/input.js new file mode 100644 index 000000000000..ce3a89c61108 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-set-static-method/input.js @@ -0,0 +1,4 @@ +class A { + set #x(_) {} + static #x() {} +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-set-static-method/options.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-set-static-method/options.json new file mode 100644 index 000000000000..af02072af9d9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-set-static-method/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["classPrivateProperties", "classPrivateMethods"] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-set-static-method/output.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-set-static-method/output.json new file mode 100644 index 000000000000..fe58593dfba5 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-set-static-method/output.json @@ -0,0 +1,89 @@ +{ + "type": "File", + "start":0,"end":43,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "errors": [ + "SyntaxError: Duplicate private name #x (3:9)" + ], + "program": { + "type": "Program", + "start":0,"end":43,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start":0,"end":43,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "id": { + "type": "Identifier", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":8,"end":43,"loc":{"start":{"line":1,"column":8},"end":{"line":4,"column":1}}, + "body": [ + { + "type": "ClassPrivateMethod", + "start":12,"end":24,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":14}}, + "static": false, + "key": { + "type": "PrivateName", + "start":16,"end":18,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":8}}, + "id": { + "type": "Identifier", + "start":17,"end":18,"loc":{"start":{"line":2,"column":7},"end":{"line":2,"column":8},"identifierName":"x"}, + "name": "x" + } + }, + "computed": false, + "kind": "set", + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start":19,"end":20,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":10},"identifierName":"_"}, + "name": "_" + } + ], + "body": { + "type": "BlockStatement", + "start":22,"end":24,"loc":{"start":{"line":2,"column":12},"end":{"line":2,"column":14}}, + "body": [], + "directives": [] + } + }, + { + "type": "ClassPrivateMethod", + "start":27,"end":41,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":16}}, + "static": true, + "key": { + "type": "PrivateName", + "start":34,"end":36,"loc":{"start":{"line":3,"column":9},"end":{"line":3,"column":11}}, + "id": { + "type": "Identifier", + "start":35,"end":36,"loc":{"start":{"line":3,"column":10},"end":{"line":3,"column":11},"identifierName":"x"}, + "name": "x" + } + }, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":39,"end":41,"loc":{"start":{"line":3,"column":14},"end":{"line":3,"column":16}}, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-set-static-set/input.js b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-set-static-set/input.js new file mode 100644 index 000000000000..7a5e410fdd91 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-set-static-set/input.js @@ -0,0 +1,4 @@ +class A { + set #x(_) {} + static set #x(_) {} +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-set-static-set/options.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-set-static-set/options.json new file mode 100644 index 000000000000..af02072af9d9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-set-static-set/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["classPrivateProperties", "classPrivateMethods"] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-set-static-set/output.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-set-static-set/output.json new file mode 100644 index 000000000000..e029e983ee76 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-set-static-set/output.json @@ -0,0 +1,96 @@ +{ + "type": "File", + "start":0,"end":48,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "errors": [ + "SyntaxError: Duplicate private name #x (3:13)" + ], + "program": { + "type": "Program", + "start":0,"end":48,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start":0,"end":48,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "id": { + "type": "Identifier", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":8,"end":48,"loc":{"start":{"line":1,"column":8},"end":{"line":4,"column":1}}, + "body": [ + { + "type": "ClassPrivateMethod", + "start":12,"end":24,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":14}}, + "static": false, + "key": { + "type": "PrivateName", + "start":16,"end":18,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":8}}, + "id": { + "type": "Identifier", + "start":17,"end":18,"loc":{"start":{"line":2,"column":7},"end":{"line":2,"column":8},"identifierName":"x"}, + "name": "x" + } + }, + "computed": false, + "kind": "set", + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start":19,"end":20,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":10},"identifierName":"_"}, + "name": "_" + } + ], + "body": { + "type": "BlockStatement", + "start":22,"end":24,"loc":{"start":{"line":2,"column":12},"end":{"line":2,"column":14}}, + "body": [], + "directives": [] + } + }, + { + "type": "ClassPrivateMethod", + "start":27,"end":46,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":21}}, + "static": true, + "key": { + "type": "PrivateName", + "start":38,"end":40,"loc":{"start":{"line":3,"column":13},"end":{"line":3,"column":15}}, + "id": { + "type": "Identifier", + "start":39,"end":40,"loc":{"start":{"line":3,"column":14},"end":{"line":3,"column":15},"identifierName":"x"}, + "name": "x" + } + }, + "computed": false, + "kind": "set", + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start":41,"end":42,"loc":{"start":{"line":3,"column":16},"end":{"line":3,"column":17},"identifierName":"_"}, + "name": "_" + } + ], + "body": { + "type": "BlockStatement", + "start":44,"end":46,"loc":{"start":{"line":3,"column":19},"end":{"line":3,"column":21}}, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/options.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/options.json new file mode 100644 index 000000000000..af02072af9d9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["classPrivateProperties", "classPrivateMethods"] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-field-instance-field/input.js b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-field-instance-field/input.js new file mode 100644 index 000000000000..3de944035833 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-field-instance-field/input.js @@ -0,0 +1,4 @@ +class A { + static #x = 0; + #x = 0; +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-field-instance-field/options.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-field-instance-field/options.json new file mode 100644 index 000000000000..af02072af9d9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-field-instance-field/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["classPrivateProperties", "classPrivateMethods"] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-field-instance-field/output.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-field-instance-field/output.json new file mode 100644 index 000000000000..cf003ba438c6 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-field-instance-field/output.json @@ -0,0 +1,78 @@ +{ + "type": "File", + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "errors": [ + "SyntaxError: Duplicate private name #x (3:2)" + ], + "program": { + "type": "Program", + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "id": { + "type": "Identifier", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":8,"end":38,"loc":{"start":{"line":1,"column":8},"end":{"line":4,"column":1}}, + "body": [ + { + "type": "ClassPrivateProperty", + "start":12,"end":26,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":16}}, + "static": true, + "key": { + "type": "PrivateName", + "start":19,"end":21,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":11}}, + "id": { + "type": "Identifier", + "start":20,"end":21,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":11},"identifierName":"x"}, + "name": "x" + } + }, + "value": { + "type": "NumericLiteral", + "start":24,"end":25,"loc":{"start":{"line":2,"column":14},"end":{"line":2,"column":15}}, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + }, + { + "type": "ClassPrivateProperty", + "start":29,"end":36,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":9}}, + "static": false, + "key": { + "type": "PrivateName", + "start":29,"end":31,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":4}}, + "id": { + "type": "Identifier", + "start":30,"end":31,"loc":{"start":{"line":3,"column":3},"end":{"line":3,"column":4},"identifierName":"x"}, + "name": "x" + } + }, + "value": { + "type": "NumericLiteral", + "start":34,"end":35,"loc":{"start":{"line":3,"column":7},"end":{"line":3,"column":8}}, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-field-instance-get/input.js b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-field-instance-get/input.js new file mode 100644 index 000000000000..dd34390358ee --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-field-instance-get/input.js @@ -0,0 +1,4 @@ +class A { + static #x = 0; + get #x() {} +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-field-instance-get/options.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-field-instance-get/options.json new file mode 100644 index 000000000000..af02072af9d9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-field-instance-get/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["classPrivateProperties", "classPrivateMethods"] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-field-instance-get/output.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-field-instance-get/output.json new file mode 100644 index 000000000000..d0f7aa76dbc7 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-field-instance-get/output.json @@ -0,0 +1,81 @@ +{ + "type": "File", + "start":0,"end":42,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "errors": [ + "SyntaxError: Duplicate private name #x (3:6)" + ], + "program": { + "type": "Program", + "start":0,"end":42,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start":0,"end":42,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "id": { + "type": "Identifier", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":8,"end":42,"loc":{"start":{"line":1,"column":8},"end":{"line":4,"column":1}}, + "body": [ + { + "type": "ClassPrivateProperty", + "start":12,"end":26,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":16}}, + "static": true, + "key": { + "type": "PrivateName", + "start":19,"end":21,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":11}}, + "id": { + "type": "Identifier", + "start":20,"end":21,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":11},"identifierName":"x"}, + "name": "x" + } + }, + "value": { + "type": "NumericLiteral", + "start":24,"end":25,"loc":{"start":{"line":2,"column":14},"end":{"line":2,"column":15}}, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + }, + { + "type": "ClassPrivateMethod", + "start":29,"end":40,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":13}}, + "static": false, + "key": { + "type": "PrivateName", + "start":33,"end":35,"loc":{"start":{"line":3,"column":6},"end":{"line":3,"column":8}}, + "id": { + "type": "Identifier", + "start":34,"end":35,"loc":{"start":{"line":3,"column":7},"end":{"line":3,"column":8},"identifierName":"x"}, + "name": "x" + } + }, + "computed": false, + "kind": "get", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":38,"end":40,"loc":{"start":{"line":3,"column":11},"end":{"line":3,"column":13}}, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-field-instance-method/input.js b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-field-instance-method/input.js new file mode 100644 index 000000000000..ae2b2f980b8a --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-field-instance-method/input.js @@ -0,0 +1,4 @@ +class A { + static #x = 0; + #x() {} +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-field-instance-method/options.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-field-instance-method/options.json new file mode 100644 index 000000000000..af02072af9d9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-field-instance-method/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["classPrivateProperties", "classPrivateMethods"] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-field-instance-method/output.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-field-instance-method/output.json new file mode 100644 index 000000000000..b740b3d3bd61 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-field-instance-method/output.json @@ -0,0 +1,80 @@ +{ + "type": "File", + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "errors": [ + "SyntaxError: Duplicate private name #x (3:2)" + ], + "program": { + "type": "Program", + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "id": { + "type": "Identifier", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":8,"end":38,"loc":{"start":{"line":1,"column":8},"end":{"line":4,"column":1}}, + "body": [ + { + "type": "ClassPrivateProperty", + "start":12,"end":26,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":16}}, + "static": true, + "key": { + "type": "PrivateName", + "start":19,"end":21,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":11}}, + "id": { + "type": "Identifier", + "start":20,"end":21,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":11},"identifierName":"x"}, + "name": "x" + } + }, + "value": { + "type": "NumericLiteral", + "start":24,"end":25,"loc":{"start":{"line":2,"column":14},"end":{"line":2,"column":15}}, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + }, + { + "type": "ClassPrivateMethod", + "start":29,"end":36,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":9}}, + "static": false, + "key": { + "type": "PrivateName", + "start":29,"end":31,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":4}}, + "id": { + "type": "Identifier", + "start":30,"end":31,"loc":{"start":{"line":3,"column":3},"end":{"line":3,"column":4},"identifierName":"x"}, + "name": "x" + } + }, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":34,"end":36,"loc":{"start":{"line":3,"column":7},"end":{"line":3,"column":9}}, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-field-instance-set/input.js b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-field-instance-set/input.js new file mode 100644 index 000000000000..8962661873c3 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-field-instance-set/input.js @@ -0,0 +1,4 @@ +class A { + static #x = 0; + set #x(_) {} +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-field-instance-set/options.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-field-instance-set/options.json new file mode 100644 index 000000000000..af02072af9d9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-field-instance-set/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["classPrivateProperties", "classPrivateMethods"] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-field-instance-set/output.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-field-instance-set/output.json new file mode 100644 index 000000000000..d4337b4f6ddf --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-field-instance-set/output.json @@ -0,0 +1,87 @@ +{ + "type": "File", + "start":0,"end":43,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "errors": [ + "SyntaxError: Duplicate private name #x (3:6)" + ], + "program": { + "type": "Program", + "start":0,"end":43,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start":0,"end":43,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "id": { + "type": "Identifier", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":8,"end":43,"loc":{"start":{"line":1,"column":8},"end":{"line":4,"column":1}}, + "body": [ + { + "type": "ClassPrivateProperty", + "start":12,"end":26,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":16}}, + "static": true, + "key": { + "type": "PrivateName", + "start":19,"end":21,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":11}}, + "id": { + "type": "Identifier", + "start":20,"end":21,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":11},"identifierName":"x"}, + "name": "x" + } + }, + "value": { + "type": "NumericLiteral", + "start":24,"end":25,"loc":{"start":{"line":2,"column":14},"end":{"line":2,"column":15}}, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + }, + { + "type": "ClassPrivateMethod", + "start":29,"end":41,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":14}}, + "static": false, + "key": { + "type": "PrivateName", + "start":33,"end":35,"loc":{"start":{"line":3,"column":6},"end":{"line":3,"column":8}}, + "id": { + "type": "Identifier", + "start":34,"end":35,"loc":{"start":{"line":3,"column":7},"end":{"line":3,"column":8},"identifierName":"x"}, + "name": "x" + } + }, + "computed": false, + "kind": "set", + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start":36,"end":37,"loc":{"start":{"line":3,"column":9},"end":{"line":3,"column":10},"identifierName":"_"}, + "name": "_" + } + ], + "body": { + "type": "BlockStatement", + "start":39,"end":41,"loc":{"start":{"line":3,"column":12},"end":{"line":3,"column":14}}, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-field-static-field/input.js b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-field-static-field/input.js new file mode 100644 index 000000000000..f30eaf46a76c --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-field-static-field/input.js @@ -0,0 +1,4 @@ +class A { + static #x = 0; + static #x = 0; +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-field-static-field/options.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-field-static-field/options.json new file mode 100644 index 000000000000..af02072af9d9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-field-static-field/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["classPrivateProperties", "classPrivateMethods"] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-field-static-field/output.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-field-static-field/output.json new file mode 100644 index 000000000000..4e1bc28f2660 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-field-static-field/output.json @@ -0,0 +1,78 @@ +{ + "type": "File", + "start":0,"end":45,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "errors": [ + "SyntaxError: Duplicate private name #x (3:9)" + ], + "program": { + "type": "Program", + "start":0,"end":45,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start":0,"end":45,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "id": { + "type": "Identifier", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":8,"end":45,"loc":{"start":{"line":1,"column":8},"end":{"line":4,"column":1}}, + "body": [ + { + "type": "ClassPrivateProperty", + "start":12,"end":26,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":16}}, + "static": true, + "key": { + "type": "PrivateName", + "start":19,"end":21,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":11}}, + "id": { + "type": "Identifier", + "start":20,"end":21,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":11},"identifierName":"x"}, + "name": "x" + } + }, + "value": { + "type": "NumericLiteral", + "start":24,"end":25,"loc":{"start":{"line":2,"column":14},"end":{"line":2,"column":15}}, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + }, + { + "type": "ClassPrivateProperty", + "start":29,"end":43,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":16}}, + "static": true, + "key": { + "type": "PrivateName", + "start":36,"end":38,"loc":{"start":{"line":3,"column":9},"end":{"line":3,"column":11}}, + "id": { + "type": "Identifier", + "start":37,"end":38,"loc":{"start":{"line":3,"column":10},"end":{"line":3,"column":11},"identifierName":"x"}, + "name": "x" + } + }, + "value": { + "type": "NumericLiteral", + "start":41,"end":42,"loc":{"start":{"line":3,"column":14},"end":{"line":3,"column":15}}, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-field-static-get/input.js b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-field-static-get/input.js new file mode 100644 index 000000000000..27598cc9b1ef --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-field-static-get/input.js @@ -0,0 +1,4 @@ +class A { + static #x = 0; + static get #x() {} +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-field-static-get/options.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-field-static-get/options.json new file mode 100644 index 000000000000..af02072af9d9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-field-static-get/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["classPrivateProperties", "classPrivateMethods"] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-field-static-get/output.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-field-static-get/output.json new file mode 100644 index 000000000000..82cf9bd9f557 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-field-static-get/output.json @@ -0,0 +1,81 @@ +{ + "type": "File", + "start":0,"end":49,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "errors": [ + "SyntaxError: Duplicate private name #x (3:13)" + ], + "program": { + "type": "Program", + "start":0,"end":49,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start":0,"end":49,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "id": { + "type": "Identifier", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":8,"end":49,"loc":{"start":{"line":1,"column":8},"end":{"line":4,"column":1}}, + "body": [ + { + "type": "ClassPrivateProperty", + "start":12,"end":26,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":16}}, + "static": true, + "key": { + "type": "PrivateName", + "start":19,"end":21,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":11}}, + "id": { + "type": "Identifier", + "start":20,"end":21,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":11},"identifierName":"x"}, + "name": "x" + } + }, + "value": { + "type": "NumericLiteral", + "start":24,"end":25,"loc":{"start":{"line":2,"column":14},"end":{"line":2,"column":15}}, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + }, + { + "type": "ClassPrivateMethod", + "start":29,"end":47,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":20}}, + "static": true, + "key": { + "type": "PrivateName", + "start":40,"end":42,"loc":{"start":{"line":3,"column":13},"end":{"line":3,"column":15}}, + "id": { + "type": "Identifier", + "start":41,"end":42,"loc":{"start":{"line":3,"column":14},"end":{"line":3,"column":15},"identifierName":"x"}, + "name": "x" + } + }, + "computed": false, + "kind": "get", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":45,"end":47,"loc":{"start":{"line":3,"column":18},"end":{"line":3,"column":20}}, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-field-static-method/input.js b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-field-static-method/input.js new file mode 100644 index 000000000000..3530aef207c1 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-field-static-method/input.js @@ -0,0 +1,4 @@ +class A { + static #x = 0; + static #x() {} +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-field-static-method/options.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-field-static-method/options.json new file mode 100644 index 000000000000..af02072af9d9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-field-static-method/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["classPrivateProperties", "classPrivateMethods"] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-field-static-method/output.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-field-static-method/output.json new file mode 100644 index 000000000000..baad4ea0cde9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-field-static-method/output.json @@ -0,0 +1,80 @@ +{ + "type": "File", + "start":0,"end":45,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "errors": [ + "SyntaxError: Duplicate private name #x (3:9)" + ], + "program": { + "type": "Program", + "start":0,"end":45,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start":0,"end":45,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "id": { + "type": "Identifier", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":8,"end":45,"loc":{"start":{"line":1,"column":8},"end":{"line":4,"column":1}}, + "body": [ + { + "type": "ClassPrivateProperty", + "start":12,"end":26,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":16}}, + "static": true, + "key": { + "type": "PrivateName", + "start":19,"end":21,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":11}}, + "id": { + "type": "Identifier", + "start":20,"end":21,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":11},"identifierName":"x"}, + "name": "x" + } + }, + "value": { + "type": "NumericLiteral", + "start":24,"end":25,"loc":{"start":{"line":2,"column":14},"end":{"line":2,"column":15}}, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + }, + { + "type": "ClassPrivateMethod", + "start":29,"end":43,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":16}}, + "static": true, + "key": { + "type": "PrivateName", + "start":36,"end":38,"loc":{"start":{"line":3,"column":9},"end":{"line":3,"column":11}}, + "id": { + "type": "Identifier", + "start":37,"end":38,"loc":{"start":{"line":3,"column":10},"end":{"line":3,"column":11},"identifierName":"x"}, + "name": "x" + } + }, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":41,"end":43,"loc":{"start":{"line":3,"column":14},"end":{"line":3,"column":16}}, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-field-static-set/input.js b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-field-static-set/input.js new file mode 100644 index 000000000000..705e02850f9c --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-field-static-set/input.js @@ -0,0 +1,4 @@ +class A { + static #x = 0; + static set #x(_) {} +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-field-static-set/options.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-field-static-set/options.json new file mode 100644 index 000000000000..af02072af9d9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-field-static-set/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["classPrivateProperties", "classPrivateMethods"] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-field-static-set/output.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-field-static-set/output.json new file mode 100644 index 000000000000..53103a600f1d --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-field-static-set/output.json @@ -0,0 +1,87 @@ +{ + "type": "File", + "start":0,"end":50,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "errors": [ + "SyntaxError: Duplicate private name #x (3:13)" + ], + "program": { + "type": "Program", + "start":0,"end":50,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start":0,"end":50,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "id": { + "type": "Identifier", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":8,"end":50,"loc":{"start":{"line":1,"column":8},"end":{"line":4,"column":1}}, + "body": [ + { + "type": "ClassPrivateProperty", + "start":12,"end":26,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":16}}, + "static": true, + "key": { + "type": "PrivateName", + "start":19,"end":21,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":11}}, + "id": { + "type": "Identifier", + "start":20,"end":21,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":11},"identifierName":"x"}, + "name": "x" + } + }, + "value": { + "type": "NumericLiteral", + "start":24,"end":25,"loc":{"start":{"line":2,"column":14},"end":{"line":2,"column":15}}, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + }, + { + "type": "ClassPrivateMethod", + "start":29,"end":48,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":21}}, + "static": true, + "key": { + "type": "PrivateName", + "start":40,"end":42,"loc":{"start":{"line":3,"column":13},"end":{"line":3,"column":15}}, + "id": { + "type": "Identifier", + "start":41,"end":42,"loc":{"start":{"line":3,"column":14},"end":{"line":3,"column":15},"identifierName":"x"}, + "name": "x" + } + }, + "computed": false, + "kind": "set", + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start":43,"end":44,"loc":{"start":{"line":3,"column":16},"end":{"line":3,"column":17},"identifierName":"_"}, + "name": "_" + } + ], + "body": { + "type": "BlockStatement", + "start":46,"end":48,"loc":{"start":{"line":3,"column":19},"end":{"line":3,"column":21}}, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-get-instance-field/input.js b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-get-instance-field/input.js new file mode 100644 index 000000000000..5063908de961 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-get-instance-field/input.js @@ -0,0 +1,4 @@ +class A { + static get #x() {} + #x = 0; +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-get-instance-field/options.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-get-instance-field/options.json new file mode 100644 index 000000000000..af02072af9d9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-get-instance-field/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["classPrivateProperties", "classPrivateMethods"] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-get-instance-field/output.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-get-instance-field/output.json new file mode 100644 index 000000000000..752fd3b1a71c --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-get-instance-field/output.json @@ -0,0 +1,81 @@ +{ + "type": "File", + "start":0,"end":42,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "errors": [ + "SyntaxError: Duplicate private name #x (3:2)" + ], + "program": { + "type": "Program", + "start":0,"end":42,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start":0,"end":42,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "id": { + "type": "Identifier", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":8,"end":42,"loc":{"start":{"line":1,"column":8},"end":{"line":4,"column":1}}, + "body": [ + { + "type": "ClassPrivateMethod", + "start":12,"end":30,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":20}}, + "static": true, + "key": { + "type": "PrivateName", + "start":23,"end":25,"loc":{"start":{"line":2,"column":13},"end":{"line":2,"column":15}}, + "id": { + "type": "Identifier", + "start":24,"end":25,"loc":{"start":{"line":2,"column":14},"end":{"line":2,"column":15},"identifierName":"x"}, + "name": "x" + } + }, + "computed": false, + "kind": "get", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":28,"end":30,"loc":{"start":{"line":2,"column":18},"end":{"line":2,"column":20}}, + "body": [], + "directives": [] + } + }, + { + "type": "ClassPrivateProperty", + "start":33,"end":40,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":9}}, + "static": false, + "key": { + "type": "PrivateName", + "start":33,"end":35,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":4}}, + "id": { + "type": "Identifier", + "start":34,"end":35,"loc":{"start":{"line":3,"column":3},"end":{"line":3,"column":4},"identifierName":"x"}, + "name": "x" + } + }, + "value": { + "type": "NumericLiteral", + "start":38,"end":39,"loc":{"start":{"line":3,"column":7},"end":{"line":3,"column":8}}, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-get-instance-get/input.js b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-get-instance-get/input.js new file mode 100644 index 000000000000..819cf9b38c3c --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-get-instance-get/input.js @@ -0,0 +1,4 @@ +class A { + static get #x() {} + get #x() {} +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-get-instance-get/options.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-get-instance-get/options.json new file mode 100644 index 000000000000..af02072af9d9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-get-instance-get/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["classPrivateProperties", "classPrivateMethods"] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-get-instance-get/output.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-get-instance-get/output.json new file mode 100644 index 000000000000..35b89e838974 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-get-instance-get/output.json @@ -0,0 +1,84 @@ +{ + "type": "File", + "start":0,"end":46,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "errors": [ + "SyntaxError: Duplicate private name #x (3:6)" + ], + "program": { + "type": "Program", + "start":0,"end":46,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start":0,"end":46,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "id": { + "type": "Identifier", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":8,"end":46,"loc":{"start":{"line":1,"column":8},"end":{"line":4,"column":1}}, + "body": [ + { + "type": "ClassPrivateMethod", + "start":12,"end":30,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":20}}, + "static": true, + "key": { + "type": "PrivateName", + "start":23,"end":25,"loc":{"start":{"line":2,"column":13},"end":{"line":2,"column":15}}, + "id": { + "type": "Identifier", + "start":24,"end":25,"loc":{"start":{"line":2,"column":14},"end":{"line":2,"column":15},"identifierName":"x"}, + "name": "x" + } + }, + "computed": false, + "kind": "get", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":28,"end":30,"loc":{"start":{"line":2,"column":18},"end":{"line":2,"column":20}}, + "body": [], + "directives": [] + } + }, + { + "type": "ClassPrivateMethod", + "start":33,"end":44,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":13}}, + "static": false, + "key": { + "type": "PrivateName", + "start":37,"end":39,"loc":{"start":{"line":3,"column":6},"end":{"line":3,"column":8}}, + "id": { + "type": "Identifier", + "start":38,"end":39,"loc":{"start":{"line":3,"column":7},"end":{"line":3,"column":8},"identifierName":"x"}, + "name": "x" + } + }, + "computed": false, + "kind": "get", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":42,"end":44,"loc":{"start":{"line":3,"column":11},"end":{"line":3,"column":13}}, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-get-instance-method/input.js b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-get-instance-method/input.js new file mode 100644 index 000000000000..e22778f87886 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-get-instance-method/input.js @@ -0,0 +1,4 @@ +class A { + static get #x() {} + #x() {} +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-get-instance-method/options.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-get-instance-method/options.json new file mode 100644 index 000000000000..af02072af9d9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-get-instance-method/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["classPrivateProperties", "classPrivateMethods"] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-get-instance-method/output.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-get-instance-method/output.json new file mode 100644 index 000000000000..c826d1bd510f --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-get-instance-method/output.json @@ -0,0 +1,83 @@ +{ + "type": "File", + "start":0,"end":42,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "errors": [ + "SyntaxError: Duplicate private name #x (3:2)" + ], + "program": { + "type": "Program", + "start":0,"end":42,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start":0,"end":42,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "id": { + "type": "Identifier", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":8,"end":42,"loc":{"start":{"line":1,"column":8},"end":{"line":4,"column":1}}, + "body": [ + { + "type": "ClassPrivateMethod", + "start":12,"end":30,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":20}}, + "static": true, + "key": { + "type": "PrivateName", + "start":23,"end":25,"loc":{"start":{"line":2,"column":13},"end":{"line":2,"column":15}}, + "id": { + "type": "Identifier", + "start":24,"end":25,"loc":{"start":{"line":2,"column":14},"end":{"line":2,"column":15},"identifierName":"x"}, + "name": "x" + } + }, + "computed": false, + "kind": "get", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":28,"end":30,"loc":{"start":{"line":2,"column":18},"end":{"line":2,"column":20}}, + "body": [], + "directives": [] + } + }, + { + "type": "ClassPrivateMethod", + "start":33,"end":40,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":9}}, + "static": false, + "key": { + "type": "PrivateName", + "start":33,"end":35,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":4}}, + "id": { + "type": "Identifier", + "start":34,"end":35,"loc":{"start":{"line":3,"column":3},"end":{"line":3,"column":4},"identifierName":"x"}, + "name": "x" + } + }, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":38,"end":40,"loc":{"start":{"line":3,"column":7},"end":{"line":3,"column":9}}, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-get-instance-set/input.js b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-get-instance-set/input.js new file mode 100644 index 000000000000..21bab2d3e874 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-get-instance-set/input.js @@ -0,0 +1,4 @@ +class A { + static get #x() {} + set #x(_) {} +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-get-instance-set/options.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-get-instance-set/options.json new file mode 100644 index 000000000000..af02072af9d9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-get-instance-set/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["classPrivateProperties", "classPrivateMethods"] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-get-instance-set/output.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-get-instance-set/output.json new file mode 100644 index 000000000000..e337e3d268c3 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-get-instance-set/output.json @@ -0,0 +1,90 @@ +{ + "type": "File", + "start":0,"end":47,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "errors": [ + "SyntaxError: Duplicate private name #x (3:6)" + ], + "program": { + "type": "Program", + "start":0,"end":47,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start":0,"end":47,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "id": { + "type": "Identifier", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":8,"end":47,"loc":{"start":{"line":1,"column":8},"end":{"line":4,"column":1}}, + "body": [ + { + "type": "ClassPrivateMethod", + "start":12,"end":30,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":20}}, + "static": true, + "key": { + "type": "PrivateName", + "start":23,"end":25,"loc":{"start":{"line":2,"column":13},"end":{"line":2,"column":15}}, + "id": { + "type": "Identifier", + "start":24,"end":25,"loc":{"start":{"line":2,"column":14},"end":{"line":2,"column":15},"identifierName":"x"}, + "name": "x" + } + }, + "computed": false, + "kind": "get", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":28,"end":30,"loc":{"start":{"line":2,"column":18},"end":{"line":2,"column":20}}, + "body": [], + "directives": [] + } + }, + { + "type": "ClassPrivateMethod", + "start":33,"end":45,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":14}}, + "static": false, + "key": { + "type": "PrivateName", + "start":37,"end":39,"loc":{"start":{"line":3,"column":6},"end":{"line":3,"column":8}}, + "id": { + "type": "Identifier", + "start":38,"end":39,"loc":{"start":{"line":3,"column":7},"end":{"line":3,"column":8},"identifierName":"x"}, + "name": "x" + } + }, + "computed": false, + "kind": "set", + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start":40,"end":41,"loc":{"start":{"line":3,"column":9},"end":{"line":3,"column":10},"identifierName":"_"}, + "name": "_" + } + ], + "body": { + "type": "BlockStatement", + "start":43,"end":45,"loc":{"start":{"line":3,"column":12},"end":{"line":3,"column":14}}, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-get-static-field/input.js b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-get-static-field/input.js new file mode 100644 index 000000000000..70ab10f5eafd --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-get-static-field/input.js @@ -0,0 +1,4 @@ +class A { + static get #x() {} + static #x = 0; +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-get-static-field/options.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-get-static-field/options.json new file mode 100644 index 000000000000..af02072af9d9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-get-static-field/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["classPrivateProperties", "classPrivateMethods"] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-get-static-field/output.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-get-static-field/output.json new file mode 100644 index 000000000000..1039c1e056e4 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-get-static-field/output.json @@ -0,0 +1,81 @@ +{ + "type": "File", + "start":0,"end":49,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "errors": [ + "SyntaxError: Duplicate private name #x (3:9)" + ], + "program": { + "type": "Program", + "start":0,"end":49,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start":0,"end":49,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "id": { + "type": "Identifier", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":8,"end":49,"loc":{"start":{"line":1,"column":8},"end":{"line":4,"column":1}}, + "body": [ + { + "type": "ClassPrivateMethod", + "start":12,"end":30,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":20}}, + "static": true, + "key": { + "type": "PrivateName", + "start":23,"end":25,"loc":{"start":{"line":2,"column":13},"end":{"line":2,"column":15}}, + "id": { + "type": "Identifier", + "start":24,"end":25,"loc":{"start":{"line":2,"column":14},"end":{"line":2,"column":15},"identifierName":"x"}, + "name": "x" + } + }, + "computed": false, + "kind": "get", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":28,"end":30,"loc":{"start":{"line":2,"column":18},"end":{"line":2,"column":20}}, + "body": [], + "directives": [] + } + }, + { + "type": "ClassPrivateProperty", + "start":33,"end":47,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":16}}, + "static": true, + "key": { + "type": "PrivateName", + "start":40,"end":42,"loc":{"start":{"line":3,"column":9},"end":{"line":3,"column":11}}, + "id": { + "type": "Identifier", + "start":41,"end":42,"loc":{"start":{"line":3,"column":10},"end":{"line":3,"column":11},"identifierName":"x"}, + "name": "x" + } + }, + "value": { + "type": "NumericLiteral", + "start":45,"end":46,"loc":{"start":{"line":3,"column":14},"end":{"line":3,"column":15}}, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-get-static-get/input.js b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-get-static-get/input.js new file mode 100644 index 000000000000..dcb23a94a7fa --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-get-static-get/input.js @@ -0,0 +1,4 @@ +class A { + static get #x() {} + static get #x() {} +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-get-static-get/options.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-get-static-get/options.json new file mode 100644 index 000000000000..af02072af9d9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-get-static-get/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["classPrivateProperties", "classPrivateMethods"] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-get-static-get/output.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-get-static-get/output.json new file mode 100644 index 000000000000..6e37550db85e --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-get-static-get/output.json @@ -0,0 +1,84 @@ +{ + "type": "File", + "start":0,"end":53,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "errors": [ + "SyntaxError: Duplicate private name #x (3:13)" + ], + "program": { + "type": "Program", + "start":0,"end":53,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start":0,"end":53,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "id": { + "type": "Identifier", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":8,"end":53,"loc":{"start":{"line":1,"column":8},"end":{"line":4,"column":1}}, + "body": [ + { + "type": "ClassPrivateMethod", + "start":12,"end":30,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":20}}, + "static": true, + "key": { + "type": "PrivateName", + "start":23,"end":25,"loc":{"start":{"line":2,"column":13},"end":{"line":2,"column":15}}, + "id": { + "type": "Identifier", + "start":24,"end":25,"loc":{"start":{"line":2,"column":14},"end":{"line":2,"column":15},"identifierName":"x"}, + "name": "x" + } + }, + "computed": false, + "kind": "get", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":28,"end":30,"loc":{"start":{"line":2,"column":18},"end":{"line":2,"column":20}}, + "body": [], + "directives": [] + } + }, + { + "type": "ClassPrivateMethod", + "start":33,"end":51,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":20}}, + "static": true, + "key": { + "type": "PrivateName", + "start":44,"end":46,"loc":{"start":{"line":3,"column":13},"end":{"line":3,"column":15}}, + "id": { + "type": "Identifier", + "start":45,"end":46,"loc":{"start":{"line":3,"column":14},"end":{"line":3,"column":15},"identifierName":"x"}, + "name": "x" + } + }, + "computed": false, + "kind": "get", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":49,"end":51,"loc":{"start":{"line":3,"column":18},"end":{"line":3,"column":20}}, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-get-static-method/input.js b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-get-static-method/input.js new file mode 100644 index 000000000000..5cf7a3e6524f --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-get-static-method/input.js @@ -0,0 +1,4 @@ +class A { + static get #x() {} + static #x() {} +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-get-static-method/options.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-get-static-method/options.json new file mode 100644 index 000000000000..af02072af9d9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-get-static-method/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["classPrivateProperties", "classPrivateMethods"] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-get-static-method/output.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-get-static-method/output.json new file mode 100644 index 000000000000..98629c2614f1 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-get-static-method/output.json @@ -0,0 +1,83 @@ +{ + "type": "File", + "start":0,"end":49,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "errors": [ + "SyntaxError: Duplicate private name #x (3:9)" + ], + "program": { + "type": "Program", + "start":0,"end":49,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start":0,"end":49,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "id": { + "type": "Identifier", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":8,"end":49,"loc":{"start":{"line":1,"column":8},"end":{"line":4,"column":1}}, + "body": [ + { + "type": "ClassPrivateMethod", + "start":12,"end":30,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":20}}, + "static": true, + "key": { + "type": "PrivateName", + "start":23,"end":25,"loc":{"start":{"line":2,"column":13},"end":{"line":2,"column":15}}, + "id": { + "type": "Identifier", + "start":24,"end":25,"loc":{"start":{"line":2,"column":14},"end":{"line":2,"column":15},"identifierName":"x"}, + "name": "x" + } + }, + "computed": false, + "kind": "get", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":28,"end":30,"loc":{"start":{"line":2,"column":18},"end":{"line":2,"column":20}}, + "body": [], + "directives": [] + } + }, + { + "type": "ClassPrivateMethod", + "start":33,"end":47,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":16}}, + "static": true, + "key": { + "type": "PrivateName", + "start":40,"end":42,"loc":{"start":{"line":3,"column":9},"end":{"line":3,"column":11}}, + "id": { + "type": "Identifier", + "start":41,"end":42,"loc":{"start":{"line":3,"column":10},"end":{"line":3,"column":11},"identifierName":"x"}, + "name": "x" + } + }, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":45,"end":47,"loc":{"start":{"line":3,"column":14},"end":{"line":3,"column":16}}, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-get-static-set/input.js b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-get-static-set/input.js new file mode 100644 index 000000000000..f13a22c0b724 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-get-static-set/input.js @@ -0,0 +1,4 @@ +class A { + static get #x() {} + static set #x(_) {} +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-get-static-set/output.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-get-static-set/output.json new file mode 100644 index 000000000000..91b5799d0414 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-get-static-set/output.json @@ -0,0 +1,87 @@ +{ + "type": "File", + "start":0,"end":54,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "program": { + "type": "Program", + "start":0,"end":54,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start":0,"end":54,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "id": { + "type": "Identifier", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":8,"end":54,"loc":{"start":{"line":1,"column":8},"end":{"line":4,"column":1}}, + "body": [ + { + "type": "ClassPrivateMethod", + "start":12,"end":30,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":20}}, + "static": true, + "key": { + "type": "PrivateName", + "start":23,"end":25,"loc":{"start":{"line":2,"column":13},"end":{"line":2,"column":15}}, + "id": { + "type": "Identifier", + "start":24,"end":25,"loc":{"start":{"line":2,"column":14},"end":{"line":2,"column":15},"identifierName":"x"}, + "name": "x" + } + }, + "computed": false, + "kind": "get", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":28,"end":30,"loc":{"start":{"line":2,"column":18},"end":{"line":2,"column":20}}, + "body": [], + "directives": [] + } + }, + { + "type": "ClassPrivateMethod", + "start":33,"end":52,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":21}}, + "static": true, + "key": { + "type": "PrivateName", + "start":44,"end":46,"loc":{"start":{"line":3,"column":13},"end":{"line":3,"column":15}}, + "id": { + "type": "Identifier", + "start":45,"end":46,"loc":{"start":{"line":3,"column":14},"end":{"line":3,"column":15},"identifierName":"x"}, + "name": "x" + } + }, + "computed": false, + "kind": "set", + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start":47,"end":48,"loc":{"start":{"line":3,"column":16},"end":{"line":3,"column":17},"identifierName":"_"}, + "name": "_" + } + ], + "body": { + "type": "BlockStatement", + "start":50,"end":52,"loc":{"start":{"line":3,"column":19},"end":{"line":3,"column":21}}, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-method-instance-field/input.js b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-method-instance-field/input.js new file mode 100644 index 000000000000..2e87605b197c --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-method-instance-field/input.js @@ -0,0 +1,4 @@ +class A { + static #x() {} + #x = 0; +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-method-instance-field/options.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-method-instance-field/options.json new file mode 100644 index 000000000000..af02072af9d9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-method-instance-field/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["classPrivateProperties", "classPrivateMethods"] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-method-instance-field/output.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-method-instance-field/output.json new file mode 100644 index 000000000000..ebc7cc92dc53 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-method-instance-field/output.json @@ -0,0 +1,80 @@ +{ + "type": "File", + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "errors": [ + "SyntaxError: Duplicate private name #x (3:2)" + ], + "program": { + "type": "Program", + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "id": { + "type": "Identifier", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":8,"end":38,"loc":{"start":{"line":1,"column":8},"end":{"line":4,"column":1}}, + "body": [ + { + "type": "ClassPrivateMethod", + "start":12,"end":26,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":16}}, + "static": true, + "key": { + "type": "PrivateName", + "start":19,"end":21,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":11}}, + "id": { + "type": "Identifier", + "start":20,"end":21,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":11},"identifierName":"x"}, + "name": "x" + } + }, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":24,"end":26,"loc":{"start":{"line":2,"column":14},"end":{"line":2,"column":16}}, + "body": [], + "directives": [] + } + }, + { + "type": "ClassPrivateProperty", + "start":29,"end":36,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":9}}, + "static": false, + "key": { + "type": "PrivateName", + "start":29,"end":31,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":4}}, + "id": { + "type": "Identifier", + "start":30,"end":31,"loc":{"start":{"line":3,"column":3},"end":{"line":3,"column":4},"identifierName":"x"}, + "name": "x" + } + }, + "value": { + "type": "NumericLiteral", + "start":34,"end":35,"loc":{"start":{"line":3,"column":7},"end":{"line":3,"column":8}}, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-method-instance-get/input.js b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-method-instance-get/input.js new file mode 100644 index 000000000000..d714c04e0f50 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-method-instance-get/input.js @@ -0,0 +1,4 @@ +class A { + static #x() {} + get #x() {} +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-method-instance-get/options.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-method-instance-get/options.json new file mode 100644 index 000000000000..af02072af9d9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-method-instance-get/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["classPrivateProperties", "classPrivateMethods"] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-method-instance-get/output.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-method-instance-get/output.json new file mode 100644 index 000000000000..e8403e51a8ee --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-method-instance-get/output.json @@ -0,0 +1,83 @@ +{ + "type": "File", + "start":0,"end":42,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "errors": [ + "SyntaxError: Duplicate private name #x (3:6)" + ], + "program": { + "type": "Program", + "start":0,"end":42,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start":0,"end":42,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "id": { + "type": "Identifier", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":8,"end":42,"loc":{"start":{"line":1,"column":8},"end":{"line":4,"column":1}}, + "body": [ + { + "type": "ClassPrivateMethod", + "start":12,"end":26,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":16}}, + "static": true, + "key": { + "type": "PrivateName", + "start":19,"end":21,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":11}}, + "id": { + "type": "Identifier", + "start":20,"end":21,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":11},"identifierName":"x"}, + "name": "x" + } + }, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":24,"end":26,"loc":{"start":{"line":2,"column":14},"end":{"line":2,"column":16}}, + "body": [], + "directives": [] + } + }, + { + "type": "ClassPrivateMethod", + "start":29,"end":40,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":13}}, + "static": false, + "key": { + "type": "PrivateName", + "start":33,"end":35,"loc":{"start":{"line":3,"column":6},"end":{"line":3,"column":8}}, + "id": { + "type": "Identifier", + "start":34,"end":35,"loc":{"start":{"line":3,"column":7},"end":{"line":3,"column":8},"identifierName":"x"}, + "name": "x" + } + }, + "computed": false, + "kind": "get", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":38,"end":40,"loc":{"start":{"line":3,"column":11},"end":{"line":3,"column":13}}, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-method-instance-method/input.js b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-method-instance-method/input.js new file mode 100644 index 000000000000..520c9088d109 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-method-instance-method/input.js @@ -0,0 +1,4 @@ +class A { + static #x() {} + #x() {} +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-method-instance-method/options.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-method-instance-method/options.json new file mode 100644 index 000000000000..af02072af9d9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-method-instance-method/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["classPrivateProperties", "classPrivateMethods"] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-method-instance-method/output.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-method-instance-method/output.json new file mode 100644 index 000000000000..254811183570 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-method-instance-method/output.json @@ -0,0 +1,82 @@ +{ + "type": "File", + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "errors": [ + "SyntaxError: Duplicate private name #x (3:2)" + ], + "program": { + "type": "Program", + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "id": { + "type": "Identifier", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":8,"end":38,"loc":{"start":{"line":1,"column":8},"end":{"line":4,"column":1}}, + "body": [ + { + "type": "ClassPrivateMethod", + "start":12,"end":26,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":16}}, + "static": true, + "key": { + "type": "PrivateName", + "start":19,"end":21,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":11}}, + "id": { + "type": "Identifier", + "start":20,"end":21,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":11},"identifierName":"x"}, + "name": "x" + } + }, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":24,"end":26,"loc":{"start":{"line":2,"column":14},"end":{"line":2,"column":16}}, + "body": [], + "directives": [] + } + }, + { + "type": "ClassPrivateMethod", + "start":29,"end":36,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":9}}, + "static": false, + "key": { + "type": "PrivateName", + "start":29,"end":31,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":4}}, + "id": { + "type": "Identifier", + "start":30,"end":31,"loc":{"start":{"line":3,"column":3},"end":{"line":3,"column":4},"identifierName":"x"}, + "name": "x" + } + }, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":34,"end":36,"loc":{"start":{"line":3,"column":7},"end":{"line":3,"column":9}}, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-method-instance-set/input.js b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-method-instance-set/input.js new file mode 100644 index 000000000000..b2c76dfa77f4 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-method-instance-set/input.js @@ -0,0 +1,4 @@ +class A { + static #x() {} + set #x(_) {} +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-method-instance-set/options.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-method-instance-set/options.json new file mode 100644 index 000000000000..af02072af9d9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-method-instance-set/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["classPrivateProperties", "classPrivateMethods"] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-method-instance-set/output.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-method-instance-set/output.json new file mode 100644 index 000000000000..0e28cc4938ff --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-method-instance-set/output.json @@ -0,0 +1,89 @@ +{ + "type": "File", + "start":0,"end":43,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "errors": [ + "SyntaxError: Duplicate private name #x (3:6)" + ], + "program": { + "type": "Program", + "start":0,"end":43,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start":0,"end":43,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "id": { + "type": "Identifier", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":8,"end":43,"loc":{"start":{"line":1,"column":8},"end":{"line":4,"column":1}}, + "body": [ + { + "type": "ClassPrivateMethod", + "start":12,"end":26,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":16}}, + "static": true, + "key": { + "type": "PrivateName", + "start":19,"end":21,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":11}}, + "id": { + "type": "Identifier", + "start":20,"end":21,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":11},"identifierName":"x"}, + "name": "x" + } + }, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":24,"end":26,"loc":{"start":{"line":2,"column":14},"end":{"line":2,"column":16}}, + "body": [], + "directives": [] + } + }, + { + "type": "ClassPrivateMethod", + "start":29,"end":41,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":14}}, + "static": false, + "key": { + "type": "PrivateName", + "start":33,"end":35,"loc":{"start":{"line":3,"column":6},"end":{"line":3,"column":8}}, + "id": { + "type": "Identifier", + "start":34,"end":35,"loc":{"start":{"line":3,"column":7},"end":{"line":3,"column":8},"identifierName":"x"}, + "name": "x" + } + }, + "computed": false, + "kind": "set", + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start":36,"end":37,"loc":{"start":{"line":3,"column":9},"end":{"line":3,"column":10},"identifierName":"_"}, + "name": "_" + } + ], + "body": { + "type": "BlockStatement", + "start":39,"end":41,"loc":{"start":{"line":3,"column":12},"end":{"line":3,"column":14}}, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-method-static-field/input.js b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-method-static-field/input.js new file mode 100644 index 000000000000..24d63ae53646 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-method-static-field/input.js @@ -0,0 +1,4 @@ +class A { + static #x() {} + static #x = 0; +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-method-static-field/options.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-method-static-field/options.json new file mode 100644 index 000000000000..af02072af9d9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-method-static-field/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["classPrivateProperties", "classPrivateMethods"] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-method-static-field/output.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-method-static-field/output.json new file mode 100644 index 000000000000..4abec1e40b1c --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-method-static-field/output.json @@ -0,0 +1,80 @@ +{ + "type": "File", + "start":0,"end":45,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "errors": [ + "SyntaxError: Duplicate private name #x (3:9)" + ], + "program": { + "type": "Program", + "start":0,"end":45,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start":0,"end":45,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "id": { + "type": "Identifier", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":8,"end":45,"loc":{"start":{"line":1,"column":8},"end":{"line":4,"column":1}}, + "body": [ + { + "type": "ClassPrivateMethod", + "start":12,"end":26,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":16}}, + "static": true, + "key": { + "type": "PrivateName", + "start":19,"end":21,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":11}}, + "id": { + "type": "Identifier", + "start":20,"end":21,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":11},"identifierName":"x"}, + "name": "x" + } + }, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":24,"end":26,"loc":{"start":{"line":2,"column":14},"end":{"line":2,"column":16}}, + "body": [], + "directives": [] + } + }, + { + "type": "ClassPrivateProperty", + "start":29,"end":43,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":16}}, + "static": true, + "key": { + "type": "PrivateName", + "start":36,"end":38,"loc":{"start":{"line":3,"column":9},"end":{"line":3,"column":11}}, + "id": { + "type": "Identifier", + "start":37,"end":38,"loc":{"start":{"line":3,"column":10},"end":{"line":3,"column":11},"identifierName":"x"}, + "name": "x" + } + }, + "value": { + "type": "NumericLiteral", + "start":41,"end":42,"loc":{"start":{"line":3,"column":14},"end":{"line":3,"column":15}}, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-method-static-get/input.js b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-method-static-get/input.js new file mode 100644 index 000000000000..8a3c3ff6a962 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-method-static-get/input.js @@ -0,0 +1,4 @@ +class A { + static #x() {} + static get #x() {} +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-method-static-get/options.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-method-static-get/options.json new file mode 100644 index 000000000000..af02072af9d9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-method-static-get/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["classPrivateProperties", "classPrivateMethods"] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-method-static-get/output.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-method-static-get/output.json new file mode 100644 index 000000000000..967cd567b4a4 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-method-static-get/output.json @@ -0,0 +1,83 @@ +{ + "type": "File", + "start":0,"end":49,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "errors": [ + "SyntaxError: Duplicate private name #x (3:13)" + ], + "program": { + "type": "Program", + "start":0,"end":49,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start":0,"end":49,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "id": { + "type": "Identifier", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":8,"end":49,"loc":{"start":{"line":1,"column":8},"end":{"line":4,"column":1}}, + "body": [ + { + "type": "ClassPrivateMethod", + "start":12,"end":26,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":16}}, + "static": true, + "key": { + "type": "PrivateName", + "start":19,"end":21,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":11}}, + "id": { + "type": "Identifier", + "start":20,"end":21,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":11},"identifierName":"x"}, + "name": "x" + } + }, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":24,"end":26,"loc":{"start":{"line":2,"column":14},"end":{"line":2,"column":16}}, + "body": [], + "directives": [] + } + }, + { + "type": "ClassPrivateMethod", + "start":29,"end":47,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":20}}, + "static": true, + "key": { + "type": "PrivateName", + "start":40,"end":42,"loc":{"start":{"line":3,"column":13},"end":{"line":3,"column":15}}, + "id": { + "type": "Identifier", + "start":41,"end":42,"loc":{"start":{"line":3,"column":14},"end":{"line":3,"column":15},"identifierName":"x"}, + "name": "x" + } + }, + "computed": false, + "kind": "get", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":45,"end":47,"loc":{"start":{"line":3,"column":18},"end":{"line":3,"column":20}}, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-method-static-method/input.js b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-method-static-method/input.js new file mode 100644 index 000000000000..316f6d89f48f --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-method-static-method/input.js @@ -0,0 +1,4 @@ +class A { + static #x() {} + static #x() {} +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-method-static-method/options.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-method-static-method/options.json new file mode 100644 index 000000000000..af02072af9d9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-method-static-method/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["classPrivateProperties", "classPrivateMethods"] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-method-static-method/output.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-method-static-method/output.json new file mode 100644 index 000000000000..3b74b77a4b3a --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-method-static-method/output.json @@ -0,0 +1,82 @@ +{ + "type": "File", + "start":0,"end":45,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "errors": [ + "SyntaxError: Duplicate private name #x (3:9)" + ], + "program": { + "type": "Program", + "start":0,"end":45,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start":0,"end":45,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "id": { + "type": "Identifier", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":8,"end":45,"loc":{"start":{"line":1,"column":8},"end":{"line":4,"column":1}}, + "body": [ + { + "type": "ClassPrivateMethod", + "start":12,"end":26,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":16}}, + "static": true, + "key": { + "type": "PrivateName", + "start":19,"end":21,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":11}}, + "id": { + "type": "Identifier", + "start":20,"end":21,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":11},"identifierName":"x"}, + "name": "x" + } + }, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":24,"end":26,"loc":{"start":{"line":2,"column":14},"end":{"line":2,"column":16}}, + "body": [], + "directives": [] + } + }, + { + "type": "ClassPrivateMethod", + "start":29,"end":43,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":16}}, + "static": true, + "key": { + "type": "PrivateName", + "start":36,"end":38,"loc":{"start":{"line":3,"column":9},"end":{"line":3,"column":11}}, + "id": { + "type": "Identifier", + "start":37,"end":38,"loc":{"start":{"line":3,"column":10},"end":{"line":3,"column":11},"identifierName":"x"}, + "name": "x" + } + }, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":41,"end":43,"loc":{"start":{"line":3,"column":14},"end":{"line":3,"column":16}}, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-method-static-set/input.js b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-method-static-set/input.js new file mode 100644 index 000000000000..590b70f3987e --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-method-static-set/input.js @@ -0,0 +1,4 @@ +class A { + static #x() {} + static set #x(_) {} +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-method-static-set/options.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-method-static-set/options.json new file mode 100644 index 000000000000..af02072af9d9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-method-static-set/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["classPrivateProperties", "classPrivateMethods"] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-method-static-set/output.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-method-static-set/output.json new file mode 100644 index 000000000000..b611d45935c7 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-method-static-set/output.json @@ -0,0 +1,89 @@ +{ + "type": "File", + "start":0,"end":50,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "errors": [ + "SyntaxError: Duplicate private name #x (3:13)" + ], + "program": { + "type": "Program", + "start":0,"end":50,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start":0,"end":50,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "id": { + "type": "Identifier", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":8,"end":50,"loc":{"start":{"line":1,"column":8},"end":{"line":4,"column":1}}, + "body": [ + { + "type": "ClassPrivateMethod", + "start":12,"end":26,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":16}}, + "static": true, + "key": { + "type": "PrivateName", + "start":19,"end":21,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":11}}, + "id": { + "type": "Identifier", + "start":20,"end":21,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":11},"identifierName":"x"}, + "name": "x" + } + }, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":24,"end":26,"loc":{"start":{"line":2,"column":14},"end":{"line":2,"column":16}}, + "body": [], + "directives": [] + } + }, + { + "type": "ClassPrivateMethod", + "start":29,"end":48,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":21}}, + "static": true, + "key": { + "type": "PrivateName", + "start":40,"end":42,"loc":{"start":{"line":3,"column":13},"end":{"line":3,"column":15}}, + "id": { + "type": "Identifier", + "start":41,"end":42,"loc":{"start":{"line":3,"column":14},"end":{"line":3,"column":15},"identifierName":"x"}, + "name": "x" + } + }, + "computed": false, + "kind": "set", + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start":43,"end":44,"loc":{"start":{"line":3,"column":16},"end":{"line":3,"column":17},"identifierName":"_"}, + "name": "_" + } + ], + "body": { + "type": "BlockStatement", + "start":46,"end":48,"loc":{"start":{"line":3,"column":19},"end":{"line":3,"column":21}}, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-set-instance-field/input.js b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-set-instance-field/input.js new file mode 100644 index 000000000000..315703f68bce --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-set-instance-field/input.js @@ -0,0 +1,4 @@ +class A { + static set #x(_) {} + #x = 0; +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-set-instance-field/options.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-set-instance-field/options.json new file mode 100644 index 000000000000..af02072af9d9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-set-instance-field/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["classPrivateProperties", "classPrivateMethods"] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-set-instance-field/output.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-set-instance-field/output.json new file mode 100644 index 000000000000..bbbd7d10bec0 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-set-instance-field/output.json @@ -0,0 +1,87 @@ +{ + "type": "File", + "start":0,"end":43,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "errors": [ + "SyntaxError: Duplicate private name #x (3:2)" + ], + "program": { + "type": "Program", + "start":0,"end":43,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start":0,"end":43,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "id": { + "type": "Identifier", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":8,"end":43,"loc":{"start":{"line":1,"column":8},"end":{"line":4,"column":1}}, + "body": [ + { + "type": "ClassPrivateMethod", + "start":12,"end":31,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":21}}, + "static": true, + "key": { + "type": "PrivateName", + "start":23,"end":25,"loc":{"start":{"line":2,"column":13},"end":{"line":2,"column":15}}, + "id": { + "type": "Identifier", + "start":24,"end":25,"loc":{"start":{"line":2,"column":14},"end":{"line":2,"column":15},"identifierName":"x"}, + "name": "x" + } + }, + "computed": false, + "kind": "set", + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start":26,"end":27,"loc":{"start":{"line":2,"column":16},"end":{"line":2,"column":17},"identifierName":"_"}, + "name": "_" + } + ], + "body": { + "type": "BlockStatement", + "start":29,"end":31,"loc":{"start":{"line":2,"column":19},"end":{"line":2,"column":21}}, + "body": [], + "directives": [] + } + }, + { + "type": "ClassPrivateProperty", + "start":34,"end":41,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":9}}, + "static": false, + "key": { + "type": "PrivateName", + "start":34,"end":36,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":4}}, + "id": { + "type": "Identifier", + "start":35,"end":36,"loc":{"start":{"line":3,"column":3},"end":{"line":3,"column":4},"identifierName":"x"}, + "name": "x" + } + }, + "value": { + "type": "NumericLiteral", + "start":39,"end":40,"loc":{"start":{"line":3,"column":7},"end":{"line":3,"column":8}}, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-set-instance-get/input.js b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-set-instance-get/input.js new file mode 100644 index 000000000000..b2515ac17405 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-set-instance-get/input.js @@ -0,0 +1,4 @@ +class A { + static set #x(_) {} + get #x() {} +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-set-instance-get/options.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-set-instance-get/options.json new file mode 100644 index 000000000000..af02072af9d9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-set-instance-get/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["classPrivateProperties", "classPrivateMethods"] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-set-instance-get/output.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-set-instance-get/output.json new file mode 100644 index 000000000000..0b33c76ec3b3 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-set-instance-get/output.json @@ -0,0 +1,90 @@ +{ + "type": "File", + "start":0,"end":47,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "errors": [ + "SyntaxError: Duplicate private name #x (3:6)" + ], + "program": { + "type": "Program", + "start":0,"end":47,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start":0,"end":47,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "id": { + "type": "Identifier", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":8,"end":47,"loc":{"start":{"line":1,"column":8},"end":{"line":4,"column":1}}, + "body": [ + { + "type": "ClassPrivateMethod", + "start":12,"end":31,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":21}}, + "static": true, + "key": { + "type": "PrivateName", + "start":23,"end":25,"loc":{"start":{"line":2,"column":13},"end":{"line":2,"column":15}}, + "id": { + "type": "Identifier", + "start":24,"end":25,"loc":{"start":{"line":2,"column":14},"end":{"line":2,"column":15},"identifierName":"x"}, + "name": "x" + } + }, + "computed": false, + "kind": "set", + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start":26,"end":27,"loc":{"start":{"line":2,"column":16},"end":{"line":2,"column":17},"identifierName":"_"}, + "name": "_" + } + ], + "body": { + "type": "BlockStatement", + "start":29,"end":31,"loc":{"start":{"line":2,"column":19},"end":{"line":2,"column":21}}, + "body": [], + "directives": [] + } + }, + { + "type": "ClassPrivateMethod", + "start":34,"end":45,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":13}}, + "static": false, + "key": { + "type": "PrivateName", + "start":38,"end":40,"loc":{"start":{"line":3,"column":6},"end":{"line":3,"column":8}}, + "id": { + "type": "Identifier", + "start":39,"end":40,"loc":{"start":{"line":3,"column":7},"end":{"line":3,"column":8},"identifierName":"x"}, + "name": "x" + } + }, + "computed": false, + "kind": "get", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":43,"end":45,"loc":{"start":{"line":3,"column":11},"end":{"line":3,"column":13}}, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-set-instance-method/input.js b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-set-instance-method/input.js new file mode 100644 index 000000000000..8249487ab52e --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-set-instance-method/input.js @@ -0,0 +1,4 @@ +class A { + static set #x(_) {} + #x() {} +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-set-instance-method/options.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-set-instance-method/options.json new file mode 100644 index 000000000000..af02072af9d9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-set-instance-method/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["classPrivateProperties", "classPrivateMethods"] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-set-instance-method/output.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-set-instance-method/output.json new file mode 100644 index 000000000000..3d2ee186456a --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-set-instance-method/output.json @@ -0,0 +1,89 @@ +{ + "type": "File", + "start":0,"end":43,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "errors": [ + "SyntaxError: Duplicate private name #x (3:2)" + ], + "program": { + "type": "Program", + "start":0,"end":43,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start":0,"end":43,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "id": { + "type": "Identifier", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":8,"end":43,"loc":{"start":{"line":1,"column":8},"end":{"line":4,"column":1}}, + "body": [ + { + "type": "ClassPrivateMethod", + "start":12,"end":31,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":21}}, + "static": true, + "key": { + "type": "PrivateName", + "start":23,"end":25,"loc":{"start":{"line":2,"column":13},"end":{"line":2,"column":15}}, + "id": { + "type": "Identifier", + "start":24,"end":25,"loc":{"start":{"line":2,"column":14},"end":{"line":2,"column":15},"identifierName":"x"}, + "name": "x" + } + }, + "computed": false, + "kind": "set", + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start":26,"end":27,"loc":{"start":{"line":2,"column":16},"end":{"line":2,"column":17},"identifierName":"_"}, + "name": "_" + } + ], + "body": { + "type": "BlockStatement", + "start":29,"end":31,"loc":{"start":{"line":2,"column":19},"end":{"line":2,"column":21}}, + "body": [], + "directives": [] + } + }, + { + "type": "ClassPrivateMethod", + "start":34,"end":41,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":9}}, + "static": false, + "key": { + "type": "PrivateName", + "start":34,"end":36,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":4}}, + "id": { + "type": "Identifier", + "start":35,"end":36,"loc":{"start":{"line":3,"column":3},"end":{"line":3,"column":4},"identifierName":"x"}, + "name": "x" + } + }, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":39,"end":41,"loc":{"start":{"line":3,"column":7},"end":{"line":3,"column":9}}, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-set-instance-set/input.js b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-set-instance-set/input.js new file mode 100644 index 000000000000..3b7d8653ee40 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-set-instance-set/input.js @@ -0,0 +1,4 @@ +class A { + static set #x(_) {} + set #x(_) {} +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-set-instance-set/options.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-set-instance-set/options.json new file mode 100644 index 000000000000..af02072af9d9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-set-instance-set/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["classPrivateProperties", "classPrivateMethods"] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-set-instance-set/output.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-set-instance-set/output.json new file mode 100644 index 000000000000..241a017c8eb0 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-set-instance-set/output.json @@ -0,0 +1,96 @@ +{ + "type": "File", + "start":0,"end":48,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "errors": [ + "SyntaxError: Duplicate private name #x (3:6)" + ], + "program": { + "type": "Program", + "start":0,"end":48,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start":0,"end":48,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "id": { + "type": "Identifier", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":8,"end":48,"loc":{"start":{"line":1,"column":8},"end":{"line":4,"column":1}}, + "body": [ + { + "type": "ClassPrivateMethod", + "start":12,"end":31,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":21}}, + "static": true, + "key": { + "type": "PrivateName", + "start":23,"end":25,"loc":{"start":{"line":2,"column":13},"end":{"line":2,"column":15}}, + "id": { + "type": "Identifier", + "start":24,"end":25,"loc":{"start":{"line":2,"column":14},"end":{"line":2,"column":15},"identifierName":"x"}, + "name": "x" + } + }, + "computed": false, + "kind": "set", + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start":26,"end":27,"loc":{"start":{"line":2,"column":16},"end":{"line":2,"column":17},"identifierName":"_"}, + "name": "_" + } + ], + "body": { + "type": "BlockStatement", + "start":29,"end":31,"loc":{"start":{"line":2,"column":19},"end":{"line":2,"column":21}}, + "body": [], + "directives": [] + } + }, + { + "type": "ClassPrivateMethod", + "start":34,"end":46,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":14}}, + "static": false, + "key": { + "type": "PrivateName", + "start":38,"end":40,"loc":{"start":{"line":3,"column":6},"end":{"line":3,"column":8}}, + "id": { + "type": "Identifier", + "start":39,"end":40,"loc":{"start":{"line":3,"column":7},"end":{"line":3,"column":8},"identifierName":"x"}, + "name": "x" + } + }, + "computed": false, + "kind": "set", + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start":41,"end":42,"loc":{"start":{"line":3,"column":9},"end":{"line":3,"column":10},"identifierName":"_"}, + "name": "_" + } + ], + "body": { + "type": "BlockStatement", + "start":44,"end":46,"loc":{"start":{"line":3,"column":12},"end":{"line":3,"column":14}}, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-set-static-field/input.js b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-set-static-field/input.js new file mode 100644 index 000000000000..3dfbfe2861d4 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-set-static-field/input.js @@ -0,0 +1,4 @@ +class A { + static set #x(_) {} + static #x = 0; +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-set-static-field/options.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-set-static-field/options.json new file mode 100644 index 000000000000..af02072af9d9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-set-static-field/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["classPrivateProperties", "classPrivateMethods"] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-set-static-field/output.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-set-static-field/output.json new file mode 100644 index 000000000000..ae3787b17496 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-set-static-field/output.json @@ -0,0 +1,87 @@ +{ + "type": "File", + "start":0,"end":50,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "errors": [ + "SyntaxError: Duplicate private name #x (3:9)" + ], + "program": { + "type": "Program", + "start":0,"end":50,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start":0,"end":50,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "id": { + "type": "Identifier", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":8,"end":50,"loc":{"start":{"line":1,"column":8},"end":{"line":4,"column":1}}, + "body": [ + { + "type": "ClassPrivateMethod", + "start":12,"end":31,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":21}}, + "static": true, + "key": { + "type": "PrivateName", + "start":23,"end":25,"loc":{"start":{"line":2,"column":13},"end":{"line":2,"column":15}}, + "id": { + "type": "Identifier", + "start":24,"end":25,"loc":{"start":{"line":2,"column":14},"end":{"line":2,"column":15},"identifierName":"x"}, + "name": "x" + } + }, + "computed": false, + "kind": "set", + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start":26,"end":27,"loc":{"start":{"line":2,"column":16},"end":{"line":2,"column":17},"identifierName":"_"}, + "name": "_" + } + ], + "body": { + "type": "BlockStatement", + "start":29,"end":31,"loc":{"start":{"line":2,"column":19},"end":{"line":2,"column":21}}, + "body": [], + "directives": [] + } + }, + { + "type": "ClassPrivateProperty", + "start":34,"end":48,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":16}}, + "static": true, + "key": { + "type": "PrivateName", + "start":41,"end":43,"loc":{"start":{"line":3,"column":9},"end":{"line":3,"column":11}}, + "id": { + "type": "Identifier", + "start":42,"end":43,"loc":{"start":{"line":3,"column":10},"end":{"line":3,"column":11},"identifierName":"x"}, + "name": "x" + } + }, + "value": { + "type": "NumericLiteral", + "start":46,"end":47,"loc":{"start":{"line":3,"column":14},"end":{"line":3,"column":15}}, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-set-static-get/input.js b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-set-static-get/input.js new file mode 100644 index 000000000000..5ac842d7dc2f --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-set-static-get/input.js @@ -0,0 +1,4 @@ +class A { + static set #x(_) {} + static get #x() {} +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-set-static-get/output.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-set-static-get/output.json new file mode 100644 index 000000000000..0b825cb17d45 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-set-static-get/output.json @@ -0,0 +1,87 @@ +{ + "type": "File", + "start":0,"end":54,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "program": { + "type": "Program", + "start":0,"end":54,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start":0,"end":54,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "id": { + "type": "Identifier", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":8,"end":54,"loc":{"start":{"line":1,"column":8},"end":{"line":4,"column":1}}, + "body": [ + { + "type": "ClassPrivateMethod", + "start":12,"end":31,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":21}}, + "static": true, + "key": { + "type": "PrivateName", + "start":23,"end":25,"loc":{"start":{"line":2,"column":13},"end":{"line":2,"column":15}}, + "id": { + "type": "Identifier", + "start":24,"end":25,"loc":{"start":{"line":2,"column":14},"end":{"line":2,"column":15},"identifierName":"x"}, + "name": "x" + } + }, + "computed": false, + "kind": "set", + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start":26,"end":27,"loc":{"start":{"line":2,"column":16},"end":{"line":2,"column":17},"identifierName":"_"}, + "name": "_" + } + ], + "body": { + "type": "BlockStatement", + "start":29,"end":31,"loc":{"start":{"line":2,"column":19},"end":{"line":2,"column":21}}, + "body": [], + "directives": [] + } + }, + { + "type": "ClassPrivateMethod", + "start":34,"end":52,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":20}}, + "static": true, + "key": { + "type": "PrivateName", + "start":45,"end":47,"loc":{"start":{"line":3,"column":13},"end":{"line":3,"column":15}}, + "id": { + "type": "Identifier", + "start":46,"end":47,"loc":{"start":{"line":3,"column":14},"end":{"line":3,"column":15},"identifierName":"x"}, + "name": "x" + } + }, + "computed": false, + "kind": "get", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":50,"end":52,"loc":{"start":{"line":3,"column":18},"end":{"line":3,"column":20}}, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-set-static-method/input.js b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-set-static-method/input.js new file mode 100644 index 000000000000..3f3537bcb0a0 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-set-static-method/input.js @@ -0,0 +1,4 @@ +class A { + static set #x(_) {} + static #x() {} +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-set-static-method/options.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-set-static-method/options.json new file mode 100644 index 000000000000..af02072af9d9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-set-static-method/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["classPrivateProperties", "classPrivateMethods"] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-set-static-method/output.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-set-static-method/output.json new file mode 100644 index 000000000000..6df9c23ccf95 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-set-static-method/output.json @@ -0,0 +1,89 @@ +{ + "type": "File", + "start":0,"end":50,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "errors": [ + "SyntaxError: Duplicate private name #x (3:9)" + ], + "program": { + "type": "Program", + "start":0,"end":50,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start":0,"end":50,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "id": { + "type": "Identifier", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":8,"end":50,"loc":{"start":{"line":1,"column":8},"end":{"line":4,"column":1}}, + "body": [ + { + "type": "ClassPrivateMethod", + "start":12,"end":31,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":21}}, + "static": true, + "key": { + "type": "PrivateName", + "start":23,"end":25,"loc":{"start":{"line":2,"column":13},"end":{"line":2,"column":15}}, + "id": { + "type": "Identifier", + "start":24,"end":25,"loc":{"start":{"line":2,"column":14},"end":{"line":2,"column":15},"identifierName":"x"}, + "name": "x" + } + }, + "computed": false, + "kind": "set", + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start":26,"end":27,"loc":{"start":{"line":2,"column":16},"end":{"line":2,"column":17},"identifierName":"_"}, + "name": "_" + } + ], + "body": { + "type": "BlockStatement", + "start":29,"end":31,"loc":{"start":{"line":2,"column":19},"end":{"line":2,"column":21}}, + "body": [], + "directives": [] + } + }, + { + "type": "ClassPrivateMethod", + "start":34,"end":48,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":16}}, + "static": true, + "key": { + "type": "PrivateName", + "start":41,"end":43,"loc":{"start":{"line":3,"column":9},"end":{"line":3,"column":11}}, + "id": { + "type": "Identifier", + "start":42,"end":43,"loc":{"start":{"line":3,"column":10},"end":{"line":3,"column":11},"identifierName":"x"}, + "name": "x" + } + }, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":46,"end":48,"loc":{"start":{"line":3,"column":14},"end":{"line":3,"column":16}}, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-set-static-set/input.js b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-set-static-set/input.js new file mode 100644 index 000000000000..d6337e16b74f --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-set-static-set/input.js @@ -0,0 +1,4 @@ +class A { + static set #x(_) {} + static set #x(_) {} +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-set-static-set/options.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-set-static-set/options.json new file mode 100644 index 000000000000..af02072af9d9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-set-static-set/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["classPrivateProperties", "classPrivateMethods"] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-set-static-set/output.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-set-static-set/output.json new file mode 100644 index 000000000000..dff968e97984 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-set-static-set/output.json @@ -0,0 +1,96 @@ +{ + "type": "File", + "start":0,"end":55,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "errors": [ + "SyntaxError: Duplicate private name #x (3:13)" + ], + "program": { + "type": "Program", + "start":0,"end":55,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start":0,"end":55,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "id": { + "type": "Identifier", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":8,"end":55,"loc":{"start":{"line":1,"column":8},"end":{"line":4,"column":1}}, + "body": [ + { + "type": "ClassPrivateMethod", + "start":12,"end":31,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":21}}, + "static": true, + "key": { + "type": "PrivateName", + "start":23,"end":25,"loc":{"start":{"line":2,"column":13},"end":{"line":2,"column":15}}, + "id": { + "type": "Identifier", + "start":24,"end":25,"loc":{"start":{"line":2,"column":14},"end":{"line":2,"column":15},"identifierName":"x"}, + "name": "x" + } + }, + "computed": false, + "kind": "set", + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start":26,"end":27,"loc":{"start":{"line":2,"column":16},"end":{"line":2,"column":17},"identifierName":"_"}, + "name": "_" + } + ], + "body": { + "type": "BlockStatement", + "start":29,"end":31,"loc":{"start":{"line":2,"column":19},"end":{"line":2,"column":21}}, + "body": [], + "directives": [] + } + }, + { + "type": "ClassPrivateMethod", + "start":34,"end":53,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":21}}, + "static": true, + "key": { + "type": "PrivateName", + "start":45,"end":47,"loc":{"start":{"line":3,"column":13},"end":{"line":3,"column":15}}, + "id": { + "type": "Identifier", + "start":46,"end":47,"loc":{"start":{"line":3,"column":14},"end":{"line":3,"column":15},"identifierName":"x"}, + "name": "x" + } + }, + "computed": false, + "kind": "set", + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start":48,"end":49,"loc":{"start":{"line":3,"column":16},"end":{"line":3,"column":17},"identifierName":"_"}, + "name": "_" + } + ], + "body": { + "type": "BlockStatement", + "start":51,"end":53,"loc":{"start":{"line":3,"column":19},"end":{"line":3,"column":21}}, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-properties/asi-success/output.json b/packages/babel-parser/test/fixtures/experimental/class-private-properties/asi-success/output.json index 7b8015061dc4..84dfd671cc3d 100644 --- a/packages/babel-parser/test/fixtures/experimental/class-private-properties/asi-success/output.json +++ b/packages/babel-parser/test/fixtures/experimental/class-private-properties/asi-success/output.json @@ -1,125 +1,35 @@ { "type": "File", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, "id": { "type": "Identifier", - "start": 6, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "Foo" - }, + "start":6,"end":9,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":9},"identifierName":"Foo"}, "name": "Foo" }, "superClass": null, "body": { "type": "ClassBody", - "start": 10, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":10,"end":23,"loc":{"start":{"line":1,"column":10},"end":{"line":4,"column":1}}, "body": [ { "type": "ClassPrivateProperty", - "start": 14, - "end": 16, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 4 - } - }, + "start":14,"end":16,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":4}}, "static": false, "key": { "type": "PrivateName", - "start": 14, - "end": 16, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 4 - } - }, + "start":14,"end":16,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":4}}, "id": { "type": "Identifier", - "start": 15, - "end": 16, - "loc": { - "start": { - "line": 2, - "column": 3 - }, - "end": { - "line": 2, - "column": 4 - }, - "identifierName": "x" - }, + "start":15,"end":16,"loc":{"start":{"line":2,"column":3},"end":{"line":2,"column":4},"identifierName":"x"}, "name": "x" } }, @@ -127,48 +37,14 @@ }, { "type": "ClassPrivateProperty", - "start": 19, - "end": 21, - "loc": { - "start": { - "line": 3, - "column": 2 - }, - "end": { - "line": 3, - "column": 4 - } - }, + "start":19,"end":21,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":4}}, "static": false, "key": { "type": "PrivateName", - "start": 19, - "end": 21, - "loc": { - "start": { - "line": 3, - "column": 2 - }, - "end": { - "line": 3, - "column": 4 - } - }, + "start":19,"end":21,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":4}}, "id": { "type": "Identifier", - "start": 20, - "end": 21, - "loc": { - "start": { - "line": 3, - "column": 3 - }, - "end": { - "line": 3, - "column": 4 - }, - "identifierName": "y" - }, + "start":20,"end":21,"loc":{"start":{"line":3,"column":3},"end":{"line":3,"column":4},"identifierName":"y"}, "name": "y" } }, diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-properties/await-in-async-in-private-property/input.js b/packages/babel-parser/test/fixtures/experimental/class-private-properties/await-in-async-in-private-property/input.js new file mode 100644 index 000000000000..f01601af7a3a --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-properties/await-in-async-in-private-property/input.js @@ -0,0 +1,3 @@ +class C { + #p = async () => await 42; +} diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-properties/await-in-async-in-private-property/options.json b/packages/babel-parser/test/fixtures/experimental/class-private-properties/await-in-async-in-private-property/options.json new file mode 100644 index 000000000000..f26e916957c8 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-properties/await-in-async-in-private-property/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["classPrivateProperties"] +} diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-properties/await-in-async-in-private-property/output.json b/packages/babel-parser/test/fixtures/experimental/class-private-properties/await-in-async-in-private-property/output.json new file mode 100644 index 000000000000..51393c7016b5 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-properties/await-in-async-in-private-property/output.json @@ -0,0 +1,64 @@ +{ + "type": "File", + "start":0,"end":40,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "program": { + "type": "Program", + "start":0,"end":40,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start":0,"end":40,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "id": { + "type": "Identifier", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"C"}, + "name": "C" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":8,"end":40,"loc":{"start":{"line":1,"column":8},"end":{"line":3,"column":1}}, + "body": [ + { + "type": "ClassPrivateProperty", + "start":12,"end":38,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":28}}, + "static": false, + "key": { + "type": "PrivateName", + "start":12,"end":14,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":4}}, + "id": { + "type": "Identifier", + "start":13,"end":14,"loc":{"start":{"line":2,"column":3},"end":{"line":2,"column":4},"identifierName":"p"}, + "name": "p" + } + }, + "value": { + "type": "ArrowFunctionExpression", + "start":17,"end":37,"loc":{"start":{"line":2,"column":7},"end":{"line":2,"column":27}}, + "id": null, + "generator": false, + "async": true, + "params": [], + "body": { + "type": "AwaitExpression", + "start":29,"end":37,"loc":{"start":{"line":2,"column":19},"end":{"line":2,"column":27}}, + "argument": { + "type": "NumericLiteral", + "start":35,"end":37,"loc":{"start":{"line":2,"column":25},"end":{"line":2,"column":27}}, + "extra": { + "rawValue": 42, + "raw": "42" + }, + "value": 42 + } + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-properties/await-in-private-property-in-async/input.js b/packages/babel-parser/test/fixtures/experimental/class-private-properties/await-in-private-property-in-async/input.js new file mode 100644 index 000000000000..f2cbab75f49c --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-properties/await-in-private-property-in-async/input.js @@ -0,0 +1,6 @@ +async () => { + class C { + // here await is an identifier reference + #p = await + 42; + } +} diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-properties/await-in-private-property-in-async/options.json b/packages/babel-parser/test/fixtures/experimental/class-private-properties/await-in-private-property-in-async/options.json new file mode 100644 index 000000000000..f26e916957c8 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-properties/await-in-private-property-in-async/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["classPrivateProperties"] +} diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-properties/await-in-private-property-in-async/output.json b/packages/babel-parser/test/fixtures/experimental/class-private-properties/await-in-private-property-in-async/output.json new file mode 100644 index 000000000000..43274b4f1ab2 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-properties/await-in-private-property-in-async/output.json @@ -0,0 +1,95 @@ +{ + "type": "File", + "start":0,"end":97,"loc":{"start":{"line":1,"column":0},"end":{"line":6,"column":1}}, + "program": { + "type": "Program", + "start":0,"end":97,"loc":{"start":{"line":1,"column":0},"end":{"line":6,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":97,"loc":{"start":{"line":1,"column":0},"end":{"line":6,"column":1}}, + "expression": { + "type": "ArrowFunctionExpression", + "start":0,"end":97,"loc":{"start":{"line":1,"column":0},"end":{"line":6,"column":1}}, + "id": null, + "generator": false, + "async": true, + "params": [], + "body": { + "type": "BlockStatement", + "start":12,"end":97,"loc":{"start":{"line":1,"column":12},"end":{"line":6,"column":1}}, + "body": [ + { + "type": "ClassDeclaration", + "start":16,"end":95,"loc":{"start":{"line":2,"column":2},"end":{"line":5,"column":3}}, + "id": { + "type": "Identifier", + "start":22,"end":23,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":9},"identifierName":"C"}, + "name": "C" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":24,"end":95,"loc":{"start":{"line":2,"column":10},"end":{"line":5,"column":3}}, + "body": [ + { + "type": "ClassPrivateProperty", + "start":75,"end":91,"loc":{"start":{"line":4,"column":4},"end":{"line":4,"column":20}}, + "static": false, + "key": { + "type": "PrivateName", + "start":75,"end":77,"loc":{"start":{"line":4,"column":4},"end":{"line":4,"column":6}}, + "id": { + "type": "Identifier", + "start":76,"end":77,"loc":{"start":{"line":4,"column":5},"end":{"line":4,"column":6},"identifierName":"p"}, + "name": "p" + } + }, + "value": { + "type": "BinaryExpression", + "start":80,"end":90,"loc":{"start":{"line":4,"column":9},"end":{"line":4,"column":19}}, + "left": { + "type": "Identifier", + "start":80,"end":85,"loc":{"start":{"line":4,"column":9},"end":{"line":4,"column":14},"identifierName":"await"}, + "name": "await" + }, + "operator": "+", + "right": { + "type": "NumericLiteral", + "start":88,"end":90,"loc":{"start":{"line":4,"column":17},"end":{"line":4,"column":19}}, + "extra": { + "rawValue": 42, + "raw": "42" + }, + "value": 42 + } + }, + "leadingComments": [ + { + "type": "CommentLine", + "value": " here await is an identifier reference", + "start":30,"end":70,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":44}} + } + ] + } + ] + } + } + ], + "directives": [] + } + } + } + ], + "directives": [] + }, + "comments": [ + { + "type": "CommentLine", + "value": " here await is an identifier reference", + "start":30,"end":70,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":44}} + } + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-properties/declared-later-outer-class/input.js b/packages/babel-parser/test/fixtures/experimental/class-private-properties/declared-later-outer-class/input.js new file mode 100644 index 000000000000..e4e3ae4c3870 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-properties/declared-later-outer-class/input.js @@ -0,0 +1,9 @@ +class B { + meth() { + class A { + #x = this.#y; + } + } + + #y; +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-properties/declared-later-outer-class/options.json b/packages/babel-parser/test/fixtures/experimental/class-private-properties/declared-later-outer-class/options.json new file mode 100644 index 000000000000..25819769bb20 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-properties/declared-later-outer-class/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["classPrivateProperties"] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-properties/declared-later-outer-class/output.json b/packages/babel-parser/test/fixtures/experimental/class-private-properties/declared-later-outer-class/output.json new file mode 100644 index 000000000000..61bcf07c5a6b --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-properties/declared-later-outer-class/output.json @@ -0,0 +1,115 @@ +{ + "type": "File", + "start":0,"end":73,"loc":{"start":{"line":1,"column":0},"end":{"line":9,"column":1}}, + "program": { + "type": "Program", + "start":0,"end":73,"loc":{"start":{"line":1,"column":0},"end":{"line":9,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start":0,"end":73,"loc":{"start":{"line":1,"column":0},"end":{"line":9,"column":1}}, + "id": { + "type": "Identifier", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"B"}, + "name": "B" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":8,"end":73,"loc":{"start":{"line":1,"column":8},"end":{"line":9,"column":1}}, + "body": [ + { + "type": "ClassMethod", + "start":12,"end":64,"loc":{"start":{"line":2,"column":2},"end":{"line":6,"column":3}}, + "static": false, + "key": { + "type": "Identifier", + "start":12,"end":16,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":6},"identifierName":"meth"}, + "name": "meth" + }, + "computed": false, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":19,"end":64,"loc":{"start":{"line":2,"column":9},"end":{"line":6,"column":3}}, + "body": [ + { + "type": "ClassDeclaration", + "start":25,"end":60,"loc":{"start":{"line":3,"column":4},"end":{"line":5,"column":5}}, + "id": { + "type": "Identifier", + "start":31,"end":32,"loc":{"start":{"line":3,"column":10},"end":{"line":3,"column":11},"identifierName":"A"}, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":33,"end":60,"loc":{"start":{"line":3,"column":12},"end":{"line":5,"column":5}}, + "body": [ + { + "type": "ClassPrivateProperty", + "start":41,"end":54,"loc":{"start":{"line":4,"column":6},"end":{"line":4,"column":19}}, + "static": false, + "key": { + "type": "PrivateName", + "start":41,"end":43,"loc":{"start":{"line":4,"column":6},"end":{"line":4,"column":8}}, + "id": { + "type": "Identifier", + "start":42,"end":43,"loc":{"start":{"line":4,"column":7},"end":{"line":4,"column":8},"identifierName":"x"}, + "name": "x" + } + }, + "value": { + "type": "MemberExpression", + "start":46,"end":53,"loc":{"start":{"line":4,"column":11},"end":{"line":4,"column":18}}, + "object": { + "type": "ThisExpression", + "start":46,"end":50,"loc":{"start":{"line":4,"column":11},"end":{"line":4,"column":15}} + }, + "property": { + "type": "PrivateName", + "start":51,"end":53,"loc":{"start":{"line":4,"column":16},"end":{"line":4,"column":18}}, + "id": { + "type": "Identifier", + "start":52,"end":53,"loc":{"start":{"line":4,"column":17},"end":{"line":4,"column":18},"identifierName":"y"}, + "name": "y" + } + }, + "computed": false + } + } + ] + } + } + ], + "directives": [] + } + }, + { + "type": "ClassPrivateProperty", + "start":68,"end":71,"loc":{"start":{"line":8,"column":2},"end":{"line":8,"column":5}}, + "static": false, + "key": { + "type": "PrivateName", + "start":68,"end":70,"loc":{"start":{"line":8,"column":2},"end":{"line":8,"column":4}}, + "id": { + "type": "Identifier", + "start":69,"end":70,"loc":{"start":{"line":8,"column":3},"end":{"line":8,"column":4},"identifierName":"y"}, + "name": "y" + } + }, + "value": null + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-properties/declared-later-same-class/input.js b/packages/babel-parser/test/fixtures/experimental/class-private-properties/declared-later-same-class/input.js new file mode 100644 index 000000000000..bd7c6a515696 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-properties/declared-later-same-class/input.js @@ -0,0 +1,4 @@ +class A { + #x = this.#y; + #y; +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-properties/declared-later-same-class/options.json b/packages/babel-parser/test/fixtures/experimental/class-private-properties/declared-later-same-class/options.json new file mode 100644 index 000000000000..25819769bb20 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-properties/declared-later-same-class/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["classPrivateProperties"] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-properties/declared-later-same-class/output.json b/packages/babel-parser/test/fixtures/experimental/class-private-properties/declared-later-same-class/output.json new file mode 100644 index 000000000000..f610c07abe36 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-properties/declared-later-same-class/output.json @@ -0,0 +1,76 @@ +{ + "type": "File", + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "program": { + "type": "Program", + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "id": { + "type": "Identifier", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":8,"end":33,"loc":{"start":{"line":1,"column":8},"end":{"line":4,"column":1}}, + "body": [ + { + "type": "ClassPrivateProperty", + "start":12,"end":25,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":15}}, + "static": false, + "key": { + "type": "PrivateName", + "start":12,"end":14,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":4}}, + "id": { + "type": "Identifier", + "start":13,"end":14,"loc":{"start":{"line":2,"column":3},"end":{"line":2,"column":4},"identifierName":"x"}, + "name": "x" + } + }, + "value": { + "type": "MemberExpression", + "start":17,"end":24,"loc":{"start":{"line":2,"column":7},"end":{"line":2,"column":14}}, + "object": { + "type": "ThisExpression", + "start":17,"end":21,"loc":{"start":{"line":2,"column":7},"end":{"line":2,"column":11}} + }, + "property": { + "type": "PrivateName", + "start":22,"end":24,"loc":{"start":{"line":2,"column":12},"end":{"line":2,"column":14}}, + "id": { + "type": "Identifier", + "start":23,"end":24,"loc":{"start":{"line":2,"column":13},"end":{"line":2,"column":14},"identifierName":"y"}, + "name": "y" + } + }, + "computed": false + } + }, + { + "type": "ClassPrivateProperty", + "start":28,"end":31,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":5}}, + "static": false, + "key": { + "type": "PrivateName", + "start":28,"end":30,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":4}}, + "id": { + "type": "Identifier", + "start":29,"end":30,"loc":{"start":{"line":3,"column":3},"end":{"line":3,"column":4},"identifierName":"y"}, + "name": "y" + } + }, + "value": null + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-properties/failure-delete-private-property/options.json b/packages/babel-parser/test/fixtures/experimental/class-private-properties/failure-delete-private-property/options.json index e9f18e93d1d5..f26e916957c8 100644 --- a/packages/babel-parser/test/fixtures/experimental/class-private-properties/failure-delete-private-property/options.json +++ b/packages/babel-parser/test/fixtures/experimental/class-private-properties/failure-delete-private-property/options.json @@ -1,4 +1,3 @@ { - "throws": "Deleting a private field is not allowed (4:4)", "plugins": ["classPrivateProperties"] } diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-properties/failure-delete-private-property/output.json b/packages/babel-parser/test/fixtures/experimental/class-private-properties/failure-delete-private-property/output.json new file mode 100644 index 000000000000..edd09ae38e67 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-properties/failure-delete-private-property/output.json @@ -0,0 +1,98 @@ +{ + "type": "File", + "start":0,"end":61,"loc":{"start":{"line":1,"column":0},"end":{"line":6,"column":1}}, + "errors": [ + "SyntaxError: Deleting a private field is not allowed (4:4)" + ], + "program": { + "type": "Program", + "start":0,"end":61,"loc":{"start":{"line":1,"column":0},"end":{"line":6,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start":0,"end":61,"loc":{"start":{"line":1,"column":0},"end":{"line":6,"column":1}}, + "id": { + "type": "Identifier", + "start":6,"end":9,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":9},"identifierName":"Foo"}, + "name": "Foo" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":10,"end":61,"loc":{"start":{"line":1,"column":10},"end":{"line":6,"column":1}}, + "body": [ + { + "type": "ClassPrivateProperty", + "start":14,"end":17,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":5}}, + "static": false, + "key": { + "type": "PrivateName", + "start":14,"end":16,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":4}}, + "id": { + "type": "Identifier", + "start":15,"end":16,"loc":{"start":{"line":2,"column":3},"end":{"line":2,"column":4},"identifierName":"x"}, + "name": "x" + } + }, + "value": null + }, + { + "type": "ClassMethod", + "start":20,"end":59,"loc":{"start":{"line":3,"column":2},"end":{"line":5,"column":3}}, + "static": false, + "key": { + "type": "Identifier", + "start":20,"end":31,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":13},"identifierName":"constructor"}, + "name": "constructor" + }, + "computed": false, + "kind": "constructor", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":34,"end":59,"loc":{"start":{"line":3,"column":16},"end":{"line":5,"column":3}}, + "body": [ + { + "type": "ExpressionStatement", + "start":40,"end":55,"loc":{"start":{"line":4,"column":4},"end":{"line":4,"column":19}}, + "expression": { + "type": "UnaryExpression", + "start":40,"end":54,"loc":{"start":{"line":4,"column":4},"end":{"line":4,"column":18}}, + "operator": "delete", + "prefix": true, + "argument": { + "type": "MemberExpression", + "start":47,"end":54,"loc":{"start":{"line":4,"column":11},"end":{"line":4,"column":18}}, + "object": { + "type": "ThisExpression", + "start":47,"end":51,"loc":{"start":{"line":4,"column":11},"end":{"line":4,"column":15}} + }, + "property": { + "type": "PrivateName", + "start":52,"end":54,"loc":{"start":{"line":4,"column":16},"end":{"line":4,"column":18}}, + "id": { + "type": "Identifier", + "start":53,"end":54,"loc":{"start":{"line":4,"column":17},"end":{"line":4,"column":18},"identifierName":"x"}, + "name": "x" + } + }, + "computed": false + } + } + } + ], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-properties/failure-name-constructor/options.json b/packages/babel-parser/test/fixtures/experimental/class-private-properties/failure-name-constructor/options.json index 51343aac3b23..f26e916957c8 100644 --- a/packages/babel-parser/test/fixtures/experimental/class-private-properties/failure-name-constructor/options.json +++ b/packages/babel-parser/test/fixtures/experimental/class-private-properties/failure-name-constructor/options.json @@ -1,4 +1,3 @@ { - "throws": "Classes may not have a private field named '#constructor' (2:2)", "plugins": ["classPrivateProperties"] } diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-properties/failure-name-constructor/output.json b/packages/babel-parser/test/fixtures/experimental/class-private-properties/failure-name-constructor/output.json new file mode 100644 index 000000000000..56f268a84707 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-properties/failure-name-constructor/output.json @@ -0,0 +1,47 @@ +{ + "type": "File", + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "errors": [ + "SyntaxError: Classes may not have a private field named '#constructor' (2:2)" + ], + "program": { + "type": "Program", + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "id": { + "type": "Identifier", + "start":6,"end":9,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":9},"identifierName":"Foo"}, + "name": "Foo" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":10,"end":29,"loc":{"start":{"line":1,"column":10},"end":{"line":3,"column":1}}, + "body": [ + { + "type": "ClassPrivateProperty", + "start":14,"end":27,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":15}}, + "static": false, + "key": { + "type": "PrivateName", + "start":14,"end":26,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":14}}, + "id": { + "type": "Identifier", + "start":15,"end":26,"loc":{"start":{"line":2,"column":3},"end":{"line":2,"column":14},"identifierName":"constructor"}, + "name": "constructor" + } + }, + "value": null + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-properties/failure-spaces/options.json b/packages/babel-parser/test/fixtures/experimental/class-private-properties/failure-spaces/options.json index 9914950b66fe..f26e916957c8 100644 --- a/packages/babel-parser/test/fixtures/experimental/class-private-properties/failure-spaces/options.json +++ b/packages/babel-parser/test/fixtures/experimental/class-private-properties/failure-spaces/options.json @@ -1,4 +1,3 @@ { - "throws": "Unexpected space between # and identifier (2:3)", - "plugins": ["classPrivateMethods"] + "plugins": ["classPrivateProperties"] } diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-properties/failure-spaces/output.json b/packages/babel-parser/test/fixtures/experimental/class-private-properties/failure-spaces/output.json new file mode 100644 index 000000000000..8e3342fe9f68 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-properties/failure-spaces/output.json @@ -0,0 +1,47 @@ +{ + "type": "File", + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "errors": [ + "SyntaxError: Unexpected space between # and identifier (2:3)" + ], + "program": { + "type": "Program", + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "id": { + "type": "Identifier", + "start":6,"end":12,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":12},"identifierName":"Spaces"}, + "name": "Spaces" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":13,"end":34,"loc":{"start":{"line":1,"column":13},"end":{"line":3,"column":1}}, + "body": [ + { + "type": "ClassPrivateProperty", + "start":17,"end":32,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":17}}, + "static": false, + "key": { + "type": "PrivateName", + "start":17,"end":31,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":16}}, + "id": { + "type": "Identifier", + "start":20,"end":31,"loc":{"start":{"line":2,"column":5},"end":{"line":2,"column":16},"identifierName":"wrongSpaces"}, + "name": "wrongSpaces" + } + }, + "value": null + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-properties/inline/output.json b/packages/babel-parser/test/fixtures/experimental/class-private-properties/inline/output.json index fed43d6977b7..041c7fcf4f5e 100644 --- a/packages/babel-parser/test/fixtures/experimental/class-private-properties/inline/output.json +++ b/packages/babel-parser/test/fixtures/experimental/class-private-properties/inline/output.json @@ -1,125 +1,35 @@ { "type": "File", - "start": 0, - "end": 48, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 27 - } - }, + "start":0,"end":48,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":27}}, "program": { "type": "Program", - "start": 0, - "end": 48, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 27 - } - }, + "start":0,"end":48,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":27}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, "id": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "A" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, "name": "A" }, "superClass": null, "body": { "type": "ClassBody", - "start": 8, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":8,"end":19,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":19}}, "body": [ { "type": "ClassPrivateProperty", - "start": 10, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":10,"end":13,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":13}}, "static": false, "key": { "type": "PrivateName", - "start": 10, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":10,"end":12,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":12}}, "id": { "type": "Identifier", - "start": 11, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "x" - }, + "start":11,"end":12,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":12},"identifierName":"x"}, "name": "x" } }, @@ -127,48 +37,14 @@ }, { "type": "ClassPrivateProperty", - "start": 14, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":14,"end":17,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":17}}, "static": false, "key": { "type": "PrivateName", - "start": 14, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":14,"end":16,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":16}}, "id": { "type": "Identifier", - "start": 15, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - }, - "identifierName": "y" - }, + "start":15,"end":16,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":16},"identifierName":"y"}, "name": "y" } }, @@ -179,112 +55,33 @@ }, { "type": "ClassDeclaration", - "start": 21, - "end": 48, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 27 - } - }, + "start":21,"end":48,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":27}}, "id": { "type": "Identifier", - "start": 27, - "end": 28, - "loc": { - "start": { - "line": 3, - "column": 6 - }, - "end": { - "line": 3, - "column": 7 - }, - "identifierName": "B" - }, + "start":27,"end":28,"loc":{"start":{"line":3,"column":6},"end":{"line":3,"column":7},"identifierName":"B"}, "name": "B" }, "superClass": null, "body": { "type": "ClassBody", - "start": 29, - "end": 48, - "loc": { - "start": { - "line": 3, - "column": 8 - }, - "end": { - "line": 3, - "column": 27 - } - }, + "start":29,"end":48,"loc":{"start":{"line":3,"column":8},"end":{"line":3,"column":27}}, "body": [ { "type": "ClassPrivateProperty", - "start": 31, - "end": 38, - "loc": { - "start": { - "line": 3, - "column": 10 - }, - "end": { - "line": 3, - "column": 17 - } - }, + "start":31,"end":38,"loc":{"start":{"line":3,"column":10},"end":{"line":3,"column":17}}, "static": false, "key": { "type": "PrivateName", - "start": 31, - "end": 33, - "loc": { - "start": { - "line": 3, - "column": 10 - }, - "end": { - "line": 3, - "column": 12 - } - }, + "start":31,"end":33,"loc":{"start":{"line":3,"column":10},"end":{"line":3,"column":12}}, "id": { "type": "Identifier", - "start": 32, - "end": 33, - "loc": { - "start": { - "line": 3, - "column": 11 - }, - "end": { - "line": 3, - "column": 12 - }, - "identifierName": "x" - }, + "start":32,"end":33,"loc":{"start":{"line":3,"column":11},"end":{"line":3,"column":12},"identifierName":"x"}, "name": "x" } }, "value": { "type": "NumericLiteral", - "start": 36, - "end": 37, - "loc": { - "start": { - "line": 3, - "column": 15 - }, - "end": { - "line": 3, - "column": 16 - } - }, + "start":36,"end":37,"loc":{"start":{"line":3,"column":15},"end":{"line":3,"column":16}}, "extra": { "rawValue": 0, "raw": "0" @@ -294,65 +91,20 @@ }, { "type": "ClassPrivateProperty", - "start": 39, - "end": 46, - "loc": { - "start": { - "line": 3, - "column": 18 - }, - "end": { - "line": 3, - "column": 25 - } - }, + "start":39,"end":46,"loc":{"start":{"line":3,"column":18},"end":{"line":3,"column":25}}, "static": false, "key": { "type": "PrivateName", - "start": 39, - "end": 41, - "loc": { - "start": { - "line": 3, - "column": 18 - }, - "end": { - "line": 3, - "column": 20 - } - }, + "start":39,"end":41,"loc":{"start":{"line":3,"column":18},"end":{"line":3,"column":20}}, "id": { "type": "Identifier", - "start": 40, - "end": 41, - "loc": { - "start": { - "line": 3, - "column": 19 - }, - "end": { - "line": 3, - "column": 20 - }, - "identifierName": "y" - }, + "start":40,"end":41,"loc":{"start":{"line":3,"column":19},"end":{"line":3,"column":20},"identifierName":"y"}, "name": "y" } }, "value": { "type": "NumericLiteral", - "start": 44, - "end": 45, - "loc": { - "start": { - "line": 3, - "column": 23 - }, - "end": { - "line": 3, - "column": 24 - } - }, + "start":44,"end":45,"loc":{"start":{"line":3,"column":23},"end":{"line":3,"column":24}}, "extra": { "rawValue": 1, "raw": "1" diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-properties/invalid-destructuring-arguments/input.js b/packages/babel-parser/test/fixtures/experimental/class-private-properties/invalid-destructuring-arguments/input.js new file mode 100644 index 000000000000..efc69f1bc6eb --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-properties/invalid-destructuring-arguments/input.js @@ -0,0 +1,4 @@ +class C { + #x = 1; + #p = ({ #x: x }) => {} +} diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-properties/invalid-destructuring-arguments/options.json b/packages/babel-parser/test/fixtures/experimental/class-private-properties/invalid-destructuring-arguments/options.json new file mode 100644 index 000000000000..f26e916957c8 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-properties/invalid-destructuring-arguments/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["classPrivateProperties"] +} diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-properties/invalid-destructuring-arguments/output.json b/packages/babel-parser/test/fixtures/experimental/class-private-properties/invalid-destructuring-arguments/output.json new file mode 100644 index 000000000000..8a1f3e458127 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-properties/invalid-destructuring-arguments/output.json @@ -0,0 +1,110 @@ +{ + "type": "File", + "start":0,"end":46,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "errors": [ + "SyntaxError: Private names can only be used as the name of a class element (i.e. class C { #p = 42; #m() {} } )\n or a property of member expression (i.e. this.#p). (3:11)" + ], + "program": { + "type": "Program", + "start":0,"end":46,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start":0,"end":46,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "id": { + "type": "Identifier", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"C"}, + "name": "C" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":8,"end":46,"loc":{"start":{"line":1,"column":8},"end":{"line":4,"column":1}}, + "body": [ + { + "type": "ClassPrivateProperty", + "start":12,"end":19,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":9}}, + "static": false, + "key": { + "type": "PrivateName", + "start":12,"end":14,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":4}}, + "id": { + "type": "Identifier", + "start":13,"end":14,"loc":{"start":{"line":2,"column":3},"end":{"line":2,"column":4},"identifierName":"x"}, + "name": "x" + } + }, + "value": { + "type": "NumericLiteral", + "start":17,"end":18,"loc":{"start":{"line":2,"column":7},"end":{"line":2,"column":8}}, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + }, + { + "type": "ClassPrivateProperty", + "start":22,"end":44,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":24}}, + "static": false, + "key": { + "type": "PrivateName", + "start":22,"end":24,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":4}}, + "id": { + "type": "Identifier", + "start":23,"end":24,"loc":{"start":{"line":3,"column":3},"end":{"line":3,"column":4},"identifierName":"p"}, + "name": "p" + } + }, + "value": { + "type": "ArrowFunctionExpression", + "start":27,"end":44,"loc":{"start":{"line":3,"column":7},"end":{"line":3,"column":24}}, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "ObjectPattern", + "start":28,"end":37,"loc":{"start":{"line":3,"column":8},"end":{"line":3,"column":17}}, + "properties": [ + { + "type": "ObjectProperty", + "start":30,"end":35,"loc":{"start":{"line":3,"column":10},"end":{"line":3,"column":15}}, + "method": false, + "key": { + "type": "PrivateName", + "start":30,"end":32,"loc":{"start":{"line":3,"column":10},"end":{"line":3,"column":12}}, + "id": { + "type": "Identifier", + "start":31,"end":32,"loc":{"start":{"line":3,"column":11},"end":{"line":3,"column":12},"identifierName":"x"}, + "name": "x" + } + }, + "shorthand": false, + "value": { + "type": "Identifier", + "start":34,"end":35,"loc":{"start":{"line":3,"column":14},"end":{"line":3,"column":15},"identifierName":"x"}, + "name": "x" + } + } + ] + } + ], + "body": { + "type": "BlockStatement", + "start":42,"end":44,"loc":{"start":{"line":3,"column":22},"end":{"line":3,"column":24}}, + "body": [], + "directives": [] + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-properties/invalid-destructuring/input.js b/packages/babel-parser/test/fixtures/experimental/class-private-properties/invalid-destructuring/input.js new file mode 100644 index 000000000000..980a785949d2 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-properties/invalid-destructuring/input.js @@ -0,0 +1,6 @@ +class C { + #x = 1; + m() { + const {#x: x} = this; + } +} diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-properties/invalid-destructuring/options.json b/packages/babel-parser/test/fixtures/experimental/class-private-properties/invalid-destructuring/options.json new file mode 100644 index 000000000000..f26e916957c8 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-properties/invalid-destructuring/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["classPrivateProperties"] +} diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-properties/invalid-destructuring/output.json b/packages/babel-parser/test/fixtures/experimental/class-private-properties/invalid-destructuring/output.json new file mode 100644 index 000000000000..0f46840ba8c7 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-properties/invalid-destructuring/output.json @@ -0,0 +1,119 @@ +{ + "type": "File", + "start":0,"end":59,"loc":{"start":{"line":1,"column":0},"end":{"line":6,"column":1}}, + "errors": [ + "SyntaxError: Private names can only be used as the name of a class element (i.e. class C { #p = 42; #m() {} } )\n or a property of member expression (i.e. this.#p). (4:12)" + ], + "program": { + "type": "Program", + "start":0,"end":59,"loc":{"start":{"line":1,"column":0},"end":{"line":6,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start":0,"end":59,"loc":{"start":{"line":1,"column":0},"end":{"line":6,"column":1}}, + "id": { + "type": "Identifier", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"C"}, + "name": "C" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":8,"end":59,"loc":{"start":{"line":1,"column":8},"end":{"line":6,"column":1}}, + "body": [ + { + "type": "ClassPrivateProperty", + "start":12,"end":19,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":9}}, + "static": false, + "key": { + "type": "PrivateName", + "start":12,"end":14,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":4}}, + "id": { + "type": "Identifier", + "start":13,"end":14,"loc":{"start":{"line":2,"column":3},"end":{"line":2,"column":4},"identifierName":"x"}, + "name": "x" + } + }, + "value": { + "type": "NumericLiteral", + "start":17,"end":18,"loc":{"start":{"line":2,"column":7},"end":{"line":2,"column":8}}, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + }, + { + "type": "ClassMethod", + "start":22,"end":57,"loc":{"start":{"line":3,"column":2},"end":{"line":5,"column":3}}, + "static": false, + "key": { + "type": "Identifier", + "start":22,"end":23,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":3},"identifierName":"m"}, + "name": "m" + }, + "computed": false, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":26,"end":57,"loc":{"start":{"line":3,"column":6},"end":{"line":5,"column":3}}, + "body": [ + { + "type": "VariableDeclaration", + "start":32,"end":53,"loc":{"start":{"line":4,"column":4},"end":{"line":4,"column":25}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":38,"end":52,"loc":{"start":{"line":4,"column":10},"end":{"line":4,"column":24}}, + "id": { + "type": "ObjectPattern", + "start":38,"end":45,"loc":{"start":{"line":4,"column":10},"end":{"line":4,"column":17}}, + "properties": [ + { + "type": "ObjectProperty", + "start":39,"end":44,"loc":{"start":{"line":4,"column":11},"end":{"line":4,"column":16}}, + "method": false, + "key": { + "type": "PrivateName", + "start":39,"end":41,"loc":{"start":{"line":4,"column":11},"end":{"line":4,"column":13}}, + "id": { + "type": "Identifier", + "start":40,"end":41,"loc":{"start":{"line":4,"column":12},"end":{"line":4,"column":13},"identifierName":"x"}, + "name": "x" + } + }, + "shorthand": false, + "value": { + "type": "Identifier", + "start":43,"end":44,"loc":{"start":{"line":4,"column":15},"end":{"line":4,"column":16},"identifierName":"x"}, + "name": "x" + } + } + ] + }, + "init": { + "type": "ThisExpression", + "start":48,"end":52,"loc":{"start":{"line":4,"column":20},"end":{"line":4,"column":24}} + } + } + ], + "kind": "const" + } + ], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-properties/invalid-object-method/input.js b/packages/babel-parser/test/fixtures/experimental/class-private-properties/invalid-object-method/input.js new file mode 100644 index 000000000000..234c9a49371e --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-properties/invalid-object-method/input.js @@ -0,0 +1,3 @@ +class C { + #p = ({ #x: 42 }); +} diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-properties/invalid-object-method/options.json b/packages/babel-parser/test/fixtures/experimental/class-private-properties/invalid-object-method/options.json new file mode 100644 index 000000000000..f26e916957c8 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-properties/invalid-object-method/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["classPrivateProperties"] +} diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-properties/invalid-object-method/output.json b/packages/babel-parser/test/fixtures/experimental/class-private-properties/invalid-object-method/output.json new file mode 100644 index 000000000000..7c27ba1380b6 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-properties/invalid-object-method/output.json @@ -0,0 +1,80 @@ +{ + "type": "File", + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "errors": [ + "SyntaxError: Private names can only be used as the name of a class element (i.e. class C { #p = 42; #m() {} } )\n or a property of member expression (i.e. this.#p). (2:11)" + ], + "program": { + "type": "Program", + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "id": { + "type": "Identifier", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"C"}, + "name": "C" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":8,"end":32,"loc":{"start":{"line":1,"column":8},"end":{"line":3,"column":1}}, + "body": [ + { + "type": "ClassPrivateProperty", + "start":12,"end":30,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":20}}, + "static": false, + "key": { + "type": "PrivateName", + "start":12,"end":14,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":4}}, + "id": { + "type": "Identifier", + "start":13,"end":14,"loc":{"start":{"line":2,"column":3},"end":{"line":2,"column":4},"identifierName":"p"}, + "name": "p" + } + }, + "value": { + "type": "ObjectExpression", + "start":18,"end":28,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":18}}, + "properties": [ + { + "type": "ObjectProperty", + "start":20,"end":26,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":16}}, + "method": false, + "key": { + "type": "PrivateName", + "start":20,"end":22,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":12}}, + "id": { + "type": "Identifier", + "start":21,"end":22,"loc":{"start":{"line":2,"column":11},"end":{"line":2,"column":12},"identifierName":"x"}, + "name": "x" + } + }, + "shorthand": false, + "value": { + "type": "NumericLiteral", + "start":24,"end":26,"loc":{"start":{"line":2,"column":14},"end":{"line":2,"column":16}}, + "extra": { + "rawValue": 42, + "raw": "42" + }, + "value": 42 + } + } + ], + "extra": { + "parenthesized": true, + "parenStart": 17 + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-properties/invalid-ts-type-literal/input.js b/packages/babel-parser/test/fixtures/experimental/class-private-properties/invalid-ts-type-literal/input.js new file mode 100644 index 000000000000..dd79bd88301a --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-properties/invalid-ts-type-literal/input.js @@ -0,0 +1,3 @@ +interface I { + #p: string +} diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-properties/invalid-ts-type-literal/options.json b/packages/babel-parser/test/fixtures/experimental/class-private-properties/invalid-ts-type-literal/options.json new file mode 100644 index 000000000000..cb835ce4233c --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-properties/invalid-ts-type-literal/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["classPrivateProperties", "typescript"] +} diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-properties/invalid-ts-type-literal/output.json b/packages/babel-parser/test/fixtures/experimental/class-private-properties/invalid-ts-type-literal/output.json new file mode 100644 index 000000000000..abaf592123d0 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-properties/invalid-ts-type-literal/output.json @@ -0,0 +1,52 @@ +{ + "type": "File", + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "errors": [ + "SyntaxError: Private names can only be used as the name of a class element (i.e. class C { #p = 42; #m() {} } )\n or a property of member expression (i.e. this.#p). (2:3)" + ], + "program": { + "type": "Program", + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "TSInterfaceDeclaration", + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "id": { + "type": "Identifier", + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11},"identifierName":"I"}, + "name": "I" + }, + "body": { + "type": "TSInterfaceBody", + "start":12,"end":28,"loc":{"start":{"line":1,"column":12},"end":{"line":3,"column":1}}, + "body": [ + { + "type": "TSPropertySignature", + "start":16,"end":26,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":12}}, + "key": { + "type": "PrivateName", + "start":16,"end":18,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":4}}, + "id": { + "type": "Identifier", + "start":17,"end":18,"loc":{"start":{"line":2,"column":3},"end":{"line":2,"column":4},"identifierName":"p"}, + "name": "p" + } + }, + "typeAnnotation": { + "type": "TSTypeAnnotation", + "start":18,"end":26,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":12}}, + "typeAnnotation": { + "type": "TSStringKeyword", + "start":20,"end":26,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":12}} + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-properties/nested/output.json b/packages/babel-parser/test/fixtures/experimental/class-private-properties/nested/output.json index 085141ac53e7..6aabfae0aadb 100644 --- a/packages/babel-parser/test/fixtures/experimental/class-private-properties/nested/output.json +++ b/packages/babel-parser/test/fixtures/experimental/class-private-properties/nested/output.json @@ -1,142 +1,41 @@ { "type": "File", - "start": 0, - "end": 782, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 39, - "column": 1 - } - }, + "start":0,"end":782,"loc":{"start":{"line":1,"column":0},"end":{"line":39,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 782, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 39, - "column": 1 - } - }, + "start":0,"end":782,"loc":{"start":{"line":1,"column":0},"end":{"line":39,"column":1}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 782, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 39, - "column": 1 - } - }, + "start":0,"end":782,"loc":{"start":{"line":1,"column":0},"end":{"line":39,"column":1}}, "id": { "type": "Identifier", - "start": 6, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "Point" - }, + "start":6,"end":11,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":11},"identifierName":"Point"}, "name": "Point" }, "superClass": null, "body": { "type": "ClassBody", - "start": 12, - "end": 782, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 39, - "column": 1 - } - }, + "start":12,"end":782,"loc":{"start":{"line":1,"column":12},"end":{"line":39,"column":1}}, "body": [ { "type": "ClassPrivateProperty", - "start": 16, - "end": 23, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 9 - } - }, + "start":16,"end":23,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":9}}, "static": false, "key": { "type": "PrivateName", - "start": 16, - "end": 18, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 4 - } - }, + "start":16,"end":18,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":4}}, "id": { "type": "Identifier", - "start": 17, - "end": 18, - "loc": { - "start": { - "line": 2, - "column": 3 - }, - "end": { - "line": 2, - "column": 4 - }, - "identifierName": "x" - }, + "start":17,"end":18,"loc":{"start":{"line":2,"column":3},"end":{"line":2,"column":4},"identifierName":"x"}, "name": "x" } }, "value": { "type": "NumericLiteral", - "start": 21, - "end": 22, - "loc": { - "start": { - "line": 2, - "column": 7 - }, - "end": { - "line": 2, - "column": 8 - } - }, + "start":21,"end":22,"loc":{"start":{"line":2,"column":7},"end":{"line":2,"column":8}}, "extra": { "rawValue": 1, "raw": "1" @@ -146,65 +45,20 @@ }, { "type": "ClassPrivateProperty", - "start": 26, - "end": 33, - "loc": { - "start": { - "line": 3, - "column": 2 - }, - "end": { - "line": 3, - "column": 9 - } - }, + "start":26,"end":33,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":9}}, "static": false, "key": { "type": "PrivateName", - "start": 26, - "end": 28, - "loc": { - "start": { - "line": 3, - "column": 2 - }, - "end": { - "line": 3, - "column": 4 - } - }, + "start":26,"end":28,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":4}}, "id": { "type": "Identifier", - "start": 27, - "end": 28, - "loc": { - "start": { - "line": 3, - "column": 3 - }, - "end": { - "line": 3, - "column": 4 - }, - "identifierName": "y" - }, + "start":27,"end":28,"loc":{"start":{"line":3,"column":3},"end":{"line":3,"column":4},"identifierName":"y"}, "name": "y" } }, "value": { "type": "NumericLiteral", - "start": 31, - "end": 32, - "loc": { - "start": { - "line": 3, - "column": 7 - }, - "end": { - "line": 3, - "column": 8 - } - }, + "start":31,"end":32,"loc":{"start":{"line":3,"column":7},"end":{"line":3,"column":8}}, "extra": { "rawValue": 2, "raw": "2" @@ -214,34 +68,11 @@ }, { "type": "ClassMethod", - "start": 37, - "end": 527, - "loc": { - "start": { - "line": 5, - "column": 2 - }, - "end": { - "line": 28, - "column": 3 - } - }, + "start":37,"end":527,"loc":{"start":{"line":5,"column":2},"end":{"line":28,"column":3}}, "static": false, "key": { "type": "Identifier", - "start": 37, - "end": 48, - "loc": { - "start": { - "line": 5, - "column": 2 - }, - "end": { - "line": 5, - "column": 13 - }, - "identifierName": "constructor" - }, + "start":37,"end":48,"loc":{"start":{"line":5,"column":2},"end":{"line":5,"column":13},"identifierName":"constructor"}, "name": "constructor" }, "computed": false, @@ -252,49 +83,15 @@ "params": [ { "type": "AssignmentPattern", - "start": 49, - "end": 54, - "loc": { - "start": { - "line": 5, - "column": 14 - }, - "end": { - "line": 5, - "column": 19 - } - }, + "start":49,"end":54,"loc":{"start":{"line":5,"column":14},"end":{"line":5,"column":19}}, "left": { "type": "Identifier", - "start": 49, - "end": 50, - "loc": { - "start": { - "line": 5, - "column": 14 - }, - "end": { - "line": 5, - "column": 15 - }, - "identifierName": "x" - }, + "start":49,"end":50,"loc":{"start":{"line":5,"column":14},"end":{"line":5,"column":15},"identifierName":"x"}, "name": "x" }, "right": { "type": "NumericLiteral", - "start": 53, - "end": 54, - "loc": { - "start": { - "line": 5, - "column": 18 - }, - "end": { - "line": 5, - "column": 19 - } - }, + "start":53,"end":54,"loc":{"start":{"line":5,"column":18},"end":{"line":5,"column":19}}, "extra": { "rawValue": 0, "raw": "0" @@ -304,49 +101,15 @@ }, { "type": "AssignmentPattern", - "start": 56, - "end": 61, - "loc": { - "start": { - "line": 5, - "column": 21 - }, - "end": { - "line": 5, - "column": 26 - } - }, + "start":56,"end":61,"loc":{"start":{"line":5,"column":21},"end":{"line":5,"column":26}}, "left": { "type": "Identifier", - "start": 56, - "end": 57, - "loc": { - "start": { - "line": 5, - "column": 21 - }, - "end": { - "line": 5, - "column": 22 - }, - "identifierName": "y" - }, + "start":56,"end":57,"loc":{"start":{"line":5,"column":21},"end":{"line":5,"column":22},"identifierName":"y"}, "name": "y" }, "right": { "type": "NumericLiteral", - "start": 60, - "end": 61, - "loc": { - "start": { - "line": 5, - "column": 25 - }, - "end": { - "line": 5, - "column": 26 - } - }, + "start":60,"end":61,"loc":{"start":{"line":5,"column":25},"end":{"line":5,"column":26}}, "extra": { "rawValue": 0, "raw": "0" @@ -357,106 +120,28 @@ ], "body": { "type": "BlockStatement", - "start": 63, - "end": 527, - "loc": { - "start": { - "line": 5, - "column": 28 - }, - "end": { - "line": 28, - "column": 3 - } - }, + "start":63,"end":527,"loc":{"start":{"line":5,"column":28},"end":{"line":28,"column":3}}, "body": [ { "type": "ExpressionStatement", - "start": 69, - "end": 82, - "loc": { - "start": { - "line": 6, - "column": 4 - }, - "end": { - "line": 6, - "column": 17 - } - }, + "start":69,"end":82,"loc":{"start":{"line":6,"column":4},"end":{"line":6,"column":17}}, "expression": { "type": "AssignmentExpression", - "start": 69, - "end": 81, - "loc": { - "start": { - "line": 6, - "column": 4 - }, - "end": { - "line": 6, - "column": 16 - } - }, + "start":69,"end":81,"loc":{"start":{"line":6,"column":4},"end":{"line":6,"column":16}}, "operator": "=", "left": { "type": "MemberExpression", - "start": 69, - "end": 76, - "loc": { - "start": { - "line": 6, - "column": 4 - }, - "end": { - "line": 6, - "column": 11 - } - }, + "start":69,"end":76,"loc":{"start":{"line":6,"column":4},"end":{"line":6,"column":11}}, "object": { "type": "ThisExpression", - "start": 69, - "end": 73, - "loc": { - "start": { - "line": 6, - "column": 4 - }, - "end": { - "line": 6, - "column": 8 - } - } + "start":69,"end":73,"loc":{"start":{"line":6,"column":4},"end":{"line":6,"column":8}} }, "property": { "type": "PrivateName", - "start": 74, - "end": 76, - "loc": { - "start": { - "line": 6, - "column": 9 - }, - "end": { - "line": 6, - "column": 11 - } - }, + "start":74,"end":76,"loc":{"start":{"line":6,"column":9},"end":{"line":6,"column":11}}, "id": { "type": "Identifier", - "start": 75, - "end": 76, - "loc": { - "start": { - "line": 6, - "column": 10 - }, - "end": { - "line": 6, - "column": 11 - }, - "identifierName": "x" - }, + "start":75,"end":76,"loc":{"start":{"line":6,"column":10},"end":{"line":6,"column":11},"identifierName":"x"}, "name": "x" } }, @@ -464,35 +149,12 @@ }, "right": { "type": "UnaryExpression", - "start": 79, - "end": 81, - "loc": { - "start": { - "line": 6, - "column": 14 - }, - "end": { - "line": 6, - "column": 16 - } - }, + "start":79,"end":81,"loc":{"start":{"line":6,"column":14},"end":{"line":6,"column":16}}, "operator": "+", "prefix": true, "argument": { "type": "Identifier", - "start": 80, - "end": 81, - "loc": { - "start": { - "line": 6, - "column": 15 - }, - "end": { - "line": 6, - "column": 16 - }, - "identifierName": "x" - }, + "start":80,"end":81,"loc":{"start":{"line":6,"column":15},"end":{"line":6,"column":16},"identifierName":"x"}, "name": "x" } } @@ -500,91 +162,24 @@ }, { "type": "ExpressionStatement", - "start": 87, - "end": 100, - "loc": { - "start": { - "line": 7, - "column": 4 - }, - "end": { - "line": 7, - "column": 17 - } - }, + "start":87,"end":100,"loc":{"start":{"line":7,"column":4},"end":{"line":7,"column":17}}, "expression": { "type": "AssignmentExpression", - "start": 87, - "end": 99, - "loc": { - "start": { - "line": 7, - "column": 4 - }, - "end": { - "line": 7, - "column": 16 - } - }, + "start":87,"end":99,"loc":{"start":{"line":7,"column":4},"end":{"line":7,"column":16}}, "operator": "=", "left": { "type": "MemberExpression", - "start": 87, - "end": 94, - "loc": { - "start": { - "line": 7, - "column": 4 - }, - "end": { - "line": 7, - "column": 11 - } - }, + "start":87,"end":94,"loc":{"start":{"line":7,"column":4},"end":{"line":7,"column":11}}, "object": { "type": "ThisExpression", - "start": 87, - "end": 91, - "loc": { - "start": { - "line": 7, - "column": 4 - }, - "end": { - "line": 7, - "column": 8 - } - } + "start":87,"end":91,"loc":{"start":{"line":7,"column":4},"end":{"line":7,"column":8}} }, "property": { "type": "PrivateName", - "start": 92, - "end": 94, - "loc": { - "start": { - "line": 7, - "column": 9 - }, - "end": { - "line": 7, - "column": 11 - } - }, + "start":92,"end":94,"loc":{"start":{"line":7,"column":9},"end":{"line":7,"column":11}}, "id": { "type": "Identifier", - "start": 93, - "end": 94, - "loc": { - "start": { - "line": 7, - "column": 10 - }, - "end": { - "line": 7, - "column": 11 - }, - "identifierName": "y" - }, + "start":93,"end":94,"loc":{"start":{"line":7,"column":10},"end":{"line":7,"column":11},"identifierName":"y"}, "name": "y" } }, @@ -592,35 +187,12 @@ }, "right": { "type": "UnaryExpression", - "start": 97, - "end": 99, - "loc": { - "start": { - "line": 7, - "column": 14 - }, - "end": { - "line": 7, - "column": 16 - } - }, + "start":97,"end":99,"loc":{"start":{"line":7,"column":14},"end":{"line":7,"column":16}}, "operator": "+", "prefix": true, "argument": { "type": "Identifier", - "start": 98, - "end": 99, - "loc": { - "start": { - "line": 7, - "column": 15 - }, - "end": { - "line": 7, - "column": 16 - }, - "identifierName": "y" - }, + "start":98,"end":99,"loc":{"start":{"line":7,"column":15},"end":{"line":7,"column":16},"identifierName":"y"}, "name": "y" } } @@ -628,173 +200,50 @@ }, { "type": "ExpressionStatement", - "start": 106, - "end": 523, - "loc": { - "start": { - "line": 9, - "column": 4 - }, - "end": { - "line": 27, - "column": 6 - } - }, + "start":106,"end":523,"loc":{"start":{"line":9,"column":4},"end":{"line":27,"column":6}}, "expression": { "type": "AssignmentExpression", - "start": 106, - "end": 522, - "loc": { - "start": { - "line": 9, - "column": 4 - }, - "end": { - "line": 27, - "column": 5 - } - }, + "start":106,"end":522,"loc":{"start":{"line":9,"column":4},"end":{"line":27,"column":5}}, "operator": "=", "left": { "type": "MemberExpression", - "start": 106, - "end": 114, - "loc": { - "start": { - "line": 9, - "column": 4 - }, - "end": { - "line": 9, - "column": 12 - } - }, + "start":106,"end":114,"loc":{"start":{"line":9,"column":4},"end":{"line":9,"column":12}}, "object": { "type": "ThisExpression", - "start": 106, - "end": 110, - "loc": { - "start": { - "line": 9, - "column": 4 - }, - "end": { - "line": 9, - "column": 8 - } - } + "start":106,"end":110,"loc":{"start":{"line":9,"column":4},"end":{"line":9,"column":8}} }, "property": { "type": "Identifier", - "start": 111, - "end": 114, - "loc": { - "start": { - "line": 9, - "column": 9 - }, - "end": { - "line": 9, - "column": 12 - }, - "identifierName": "foo" - }, + "start":111,"end":114,"loc":{"start":{"line":9,"column":9},"end":{"line":9,"column":12},"identifierName":"foo"}, "name": "foo" }, "computed": false }, "right": { "type": "ClassExpression", - "start": 117, - "end": 522, - "loc": { - "start": { - "line": 9, - "column": 15 - }, - "end": { - "line": 27, - "column": 5 - } - }, + "start":117,"end":522,"loc":{"start":{"line":9,"column":15},"end":{"line":27,"column":5}}, "id": null, "superClass": null, "body": { "type": "ClassBody", - "start": 123, - "end": 522, - "loc": { - "start": { - "line": 9, - "column": 21 - }, - "end": { - "line": 27, - "column": 5 - } - }, + "start":123,"end":522,"loc":{"start":{"line":9,"column":21},"end":{"line":27,"column":5}}, "body": [ { "type": "ClassPrivateProperty", - "start": 131, - "end": 138, - "loc": { - "start": { - "line": 10, - "column": 6 - }, - "end": { - "line": 10, - "column": 13 - } - }, + "start":131,"end":138,"loc":{"start":{"line":10,"column":6},"end":{"line":10,"column":13}}, "static": false, "key": { "type": "PrivateName", - "start": 131, - "end": 133, - "loc": { - "start": { - "line": 10, - "column": 6 - }, - "end": { - "line": 10, - "column": 8 - } - }, + "start":131,"end":133,"loc":{"start":{"line":10,"column":6},"end":{"line":10,"column":8}}, "id": { "type": "Identifier", - "start": 132, - "end": 133, - "loc": { - "start": { - "line": 10, - "column": 7 - }, - "end": { - "line": 10, - "column": 8 - }, - "identifierName": "x" - }, + "start":132,"end":133,"loc":{"start":{"line":10,"column":7},"end":{"line":10,"column":8},"identifierName":"x"}, "name": "x" } }, "value": { "type": "NumericLiteral", - "start": 136, - "end": 137, - "loc": { - "start": { - "line": 10, - "column": 11 - }, - "end": { - "line": 10, - "column": 12 - } - }, + "start":136,"end":137,"loc":{"start":{"line":10,"column":11},"end":{"line":10,"column":12}}, "extra": { "rawValue": 1, "raw": "1" @@ -804,65 +253,20 @@ }, { "type": "ClassPrivateProperty", - "start": 145, - "end": 152, - "loc": { - "start": { - "line": 11, - "column": 6 - }, - "end": { - "line": 11, - "column": 13 - } - }, + "start":145,"end":152,"loc":{"start":{"line":11,"column":6},"end":{"line":11,"column":13}}, "static": false, "key": { "type": "PrivateName", - "start": 145, - "end": 147, - "loc": { - "start": { - "line": 11, - "column": 6 - }, - "end": { - "line": 11, - "column": 8 - } - }, + "start":145,"end":147,"loc":{"start":{"line":11,"column":6},"end":{"line":11,"column":8}}, "id": { "type": "Identifier", - "start": 146, - "end": 147, - "loc": { - "start": { - "line": 11, - "column": 7 - }, - "end": { - "line": 11, - "column": 8 - }, - "identifierName": "y" - }, + "start":146,"end":147,"loc":{"start":{"line":11,"column":7},"end":{"line":11,"column":8},"identifierName":"y"}, "name": "y" } }, "value": { "type": "NumericLiteral", - "start": 150, - "end": 151, - "loc": { - "start": { - "line": 11, - "column": 11 - }, - "end": { - "line": 11, - "column": 12 - } - }, + "start":150,"end":151,"loc":{"start":{"line":11,"column":11},"end":{"line":11,"column":12}}, "extra": { "rawValue": 2, "raw": "2" @@ -872,34 +276,11 @@ }, { "type": "ClassMethod", - "start": 160, - "end": 239, - "loc": { - "start": { - "line": 13, - "column": 6 - }, - "end": { - "line": 16, - "column": 7 - } - }, + "start":160,"end":239,"loc":{"start":{"line":13,"column":6},"end":{"line":16,"column":7}}, "static": false, "key": { "type": "Identifier", - "start": 160, - "end": 171, - "loc": { - "start": { - "line": 13, - "column": 6 - }, - "end": { - "line": 13, - "column": 17 - }, - "identifierName": "constructor" - }, + "start":160,"end":171,"loc":{"start":{"line":13,"column":6},"end":{"line":13,"column":17},"identifierName":"constructor"}, "name": "constructor" }, "computed": false, @@ -910,49 +291,15 @@ "params": [ { "type": "AssignmentPattern", - "start": 172, - "end": 177, - "loc": { - "start": { - "line": 13, - "column": 18 - }, - "end": { - "line": 13, - "column": 23 - } - }, + "start":172,"end":177,"loc":{"start":{"line":13,"column":18},"end":{"line":13,"column":23}}, "left": { "type": "Identifier", - "start": 172, - "end": 173, - "loc": { - "start": { - "line": 13, - "column": 18 - }, - "end": { - "line": 13, - "column": 19 - }, - "identifierName": "x" - }, + "start":172,"end":173,"loc":{"start":{"line":13,"column":18},"end":{"line":13,"column":19},"identifierName":"x"}, "name": "x" }, "right": { "type": "NumericLiteral", - "start": 176, - "end": 177, - "loc": { - "start": { - "line": 13, - "column": 22 - }, - "end": { - "line": 13, - "column": 23 - } - }, + "start":176,"end":177,"loc":{"start":{"line":13,"column":22},"end":{"line":13,"column":23}}, "extra": { "rawValue": 0, "raw": "0" @@ -962,49 +309,15 @@ }, { "type": "AssignmentPattern", - "start": 179, - "end": 184, - "loc": { - "start": { - "line": 13, - "column": 25 - }, - "end": { - "line": 13, - "column": 30 - } - }, + "start":179,"end":184,"loc":{"start":{"line":13,"column":25},"end":{"line":13,"column":30}}, "left": { "type": "Identifier", - "start": 179, - "end": 180, - "loc": { - "start": { - "line": 13, - "column": 25 - }, - "end": { - "line": 13, - "column": 26 - }, - "identifierName": "y" - }, + "start":179,"end":180,"loc":{"start":{"line":13,"column":25},"end":{"line":13,"column":26},"identifierName":"y"}, "name": "y" }, "right": { "type": "NumericLiteral", - "start": 183, - "end": 184, - "loc": { - "start": { - "line": 13, - "column": 29 - }, - "end": { - "line": 13, - "column": 30 - } - }, + "start":183,"end":184,"loc":{"start":{"line":13,"column":29},"end":{"line":13,"column":30}}, "extra": { "rawValue": 0, "raw": "0" @@ -1015,106 +328,28 @@ ], "body": { "type": "BlockStatement", - "start": 186, - "end": 239, - "loc": { - "start": { - "line": 13, - "column": 32 - }, - "end": { - "line": 16, - "column": 7 - } - }, + "start":186,"end":239,"loc":{"start":{"line":13,"column":32},"end":{"line":16,"column":7}}, "body": [ { "type": "ExpressionStatement", - "start": 196, - "end": 209, - "loc": { - "start": { - "line": 14, - "column": 8 - }, - "end": { - "line": 14, - "column": 21 - } - }, + "start":196,"end":209,"loc":{"start":{"line":14,"column":8},"end":{"line":14,"column":21}}, "expression": { "type": "AssignmentExpression", - "start": 196, - "end": 208, - "loc": { - "start": { - "line": 14, - "column": 8 - }, - "end": { - "line": 14, - "column": 20 - } - }, + "start":196,"end":208,"loc":{"start":{"line":14,"column":8},"end":{"line":14,"column":20}}, "operator": "=", "left": { "type": "MemberExpression", - "start": 196, - "end": 203, - "loc": { - "start": { - "line": 14, - "column": 8 - }, - "end": { - "line": 14, - "column": 15 - } - }, + "start":196,"end":203,"loc":{"start":{"line":14,"column":8},"end":{"line":14,"column":15}}, "object": { "type": "ThisExpression", - "start": 196, - "end": 200, - "loc": { - "start": { - "line": 14, - "column": 8 - }, - "end": { - "line": 14, - "column": 12 - } - } + "start":196,"end":200,"loc":{"start":{"line":14,"column":8},"end":{"line":14,"column":12}} }, "property": { "type": "PrivateName", - "start": 201, - "end": 203, - "loc": { - "start": { - "line": 14, - "column": 13 - }, - "end": { - "line": 14, - "column": 15 - } - }, + "start":201,"end":203,"loc":{"start":{"line":14,"column":13},"end":{"line":14,"column":15}}, "id": { "type": "Identifier", - "start": 202, - "end": 203, - "loc": { - "start": { - "line": 14, - "column": 14 - }, - "end": { - "line": 14, - "column": 15 - }, - "identifierName": "x" - }, + "start":202,"end":203,"loc":{"start":{"line":14,"column":14},"end":{"line":14,"column":15},"identifierName":"x"}, "name": "x" } }, @@ -1122,35 +357,12 @@ }, "right": { "type": "UnaryExpression", - "start": 206, - "end": 208, - "loc": { - "start": { - "line": 14, - "column": 18 - }, - "end": { - "line": 14, - "column": 20 - } - }, + "start":206,"end":208,"loc":{"start":{"line":14,"column":18},"end":{"line":14,"column":20}}, "operator": "+", "prefix": true, "argument": { "type": "Identifier", - "start": 207, - "end": 208, - "loc": { - "start": { - "line": 14, - "column": 19 - }, - "end": { - "line": 14, - "column": 20 - }, - "identifierName": "x" - }, + "start":207,"end":208,"loc":{"start":{"line":14,"column":19},"end":{"line":14,"column":20},"identifierName":"x"}, "name": "x" } } @@ -1158,91 +370,24 @@ }, { "type": "ExpressionStatement", - "start": 218, - "end": 231, - "loc": { - "start": { - "line": 15, - "column": 8 - }, - "end": { - "line": 15, - "column": 21 - } - }, + "start":218,"end":231,"loc":{"start":{"line":15,"column":8},"end":{"line":15,"column":21}}, "expression": { "type": "AssignmentExpression", - "start": 218, - "end": 230, - "loc": { - "start": { - "line": 15, - "column": 8 - }, - "end": { - "line": 15, - "column": 20 - } - }, + "start":218,"end":230,"loc":{"start":{"line":15,"column":8},"end":{"line":15,"column":20}}, "operator": "=", "left": { "type": "MemberExpression", - "start": 218, - "end": 225, - "loc": { - "start": { - "line": 15, - "column": 8 - }, - "end": { - "line": 15, - "column": 15 - } - }, + "start":218,"end":225,"loc":{"start":{"line":15,"column":8},"end":{"line":15,"column":15}}, "object": { "type": "ThisExpression", - "start": 218, - "end": 222, - "loc": { - "start": { - "line": 15, - "column": 8 - }, - "end": { - "line": 15, - "column": 12 - } - } + "start":218,"end":222,"loc":{"start":{"line":15,"column":8},"end":{"line":15,"column":12}} }, "property": { "type": "PrivateName", - "start": 223, - "end": 225, - "loc": { - "start": { - "line": 15, - "column": 13 - }, - "end": { - "line": 15, - "column": 15 - } - }, + "start":223,"end":225,"loc":{"start":{"line":15,"column":13},"end":{"line":15,"column":15}}, "id": { "type": "Identifier", - "start": 224, - "end": 225, - "loc": { - "start": { - "line": 15, - "column": 14 - }, - "end": { - "line": 15, - "column": 15 - }, - "identifierName": "y" - }, + "start":224,"end":225,"loc":{"start":{"line":15,"column":14},"end":{"line":15,"column":15},"identifierName":"y"}, "name": "y" } }, @@ -1250,35 +395,12 @@ }, "right": { "type": "UnaryExpression", - "start": 228, - "end": 230, - "loc": { - "start": { - "line": 15, - "column": 18 - }, - "end": { - "line": 15, - "column": 20 - } - }, + "start":228,"end":230,"loc":{"start":{"line":15,"column":18},"end":{"line":15,"column":20}}, "operator": "+", "prefix": true, "argument": { "type": "Identifier", - "start": 229, - "end": 230, - "loc": { - "start": { - "line": 15, - "column": 19 - }, - "end": { - "line": 15, - "column": 20 - }, - "identifierName": "y" - }, + "start":229,"end":230,"loc":{"start":{"line":15,"column":19},"end":{"line":15,"column":20},"identifierName":"y"}, "name": "y" } } @@ -1290,34 +412,11 @@ }, { "type": "ClassMethod", - "start": 247, - "end": 273, - "loc": { - "start": { - "line": 18, - "column": 6 - }, - "end": { - "line": 18, - "column": 32 - } - }, + "start":247,"end":273,"loc":{"start":{"line":18,"column":6},"end":{"line":18,"column":32}}, "static": false, "key": { "type": "Identifier", - "start": 251, - "end": 252, - "loc": { - "start": { - "line": 18, - "column": 10 - }, - "end": { - "line": 18, - "column": 11 - }, - "identifierName": "x" - }, + "start":251,"end":252,"loc":{"start":{"line":18,"column":10},"end":{"line":18,"column":11},"identifierName":"x"}, "name": "x" }, "computed": false, @@ -1328,91 +427,24 @@ "params": [], "body": { "type": "BlockStatement", - "start": 255, - "end": 273, - "loc": { - "start": { - "line": 18, - "column": 14 - }, - "end": { - "line": 18, - "column": 32 - } - }, + "start":255,"end":273,"loc":{"start":{"line":18,"column":14},"end":{"line":18,"column":32}}, "body": [ { "type": "ReturnStatement", - "start": 257, - "end": 271, - "loc": { - "start": { - "line": 18, - "column": 16 - }, - "end": { - "line": 18, - "column": 30 - } - }, + "start":257,"end":271,"loc":{"start":{"line":18,"column":16},"end":{"line":18,"column":30}}, "argument": { "type": "MemberExpression", - "start": 264, - "end": 271, - "loc": { - "start": { - "line": 18, - "column": 23 - }, - "end": { - "line": 18, - "column": 30 - } - }, + "start":264,"end":271,"loc":{"start":{"line":18,"column":23},"end":{"line":18,"column":30}}, "object": { "type": "ThisExpression", - "start": 264, - "end": 268, - "loc": { - "start": { - "line": 18, - "column": 23 - }, - "end": { - "line": 18, - "column": 27 - } - } + "start":264,"end":268,"loc":{"start":{"line":18,"column":23},"end":{"line":18,"column":27}} }, "property": { "type": "PrivateName", - "start": 269, - "end": 271, - "loc": { - "start": { - "line": 18, - "column": 28 - }, - "end": { - "line": 18, - "column": 30 - } - }, + "start":269,"end":271,"loc":{"start":{"line":18,"column":28},"end":{"line":18,"column":30}}, "id": { "type": "Identifier", - "start": 270, - "end": 271, - "loc": { - "start": { - "line": 18, - "column": 29 - }, - "end": { - "line": 18, - "column": 30 - }, - "identifierName": "x" - }, + "start":270,"end":271,"loc":{"start":{"line":18,"column":29},"end":{"line":18,"column":30},"identifierName":"x"}, "name": "x" } }, @@ -1425,34 +457,11 @@ }, { "type": "ClassMethod", - "start": 280, - "end": 313, - "loc": { - "start": { - "line": 19, - "column": 6 - }, - "end": { - "line": 19, - "column": 39 - } - }, + "start":280,"end":313,"loc":{"start":{"line":19,"column":6},"end":{"line":19,"column":39}}, "static": false, "key": { "type": "Identifier", - "start": 284, - "end": 285, - "loc": { - "start": { - "line": 19, - "column": 10 - }, - "end": { - "line": 19, - "column": 11 - }, - "identifierName": "x" - }, + "start":284,"end":285,"loc":{"start":{"line":19,"column":10},"end":{"line":19,"column":11},"identifierName":"x"}, "name": "x" }, "computed": false, @@ -1463,124 +472,34 @@ "params": [ { "type": "Identifier", - "start": 286, - "end": 291, - "loc": { - "start": { - "line": 19, - "column": 12 - }, - "end": { - "line": 19, - "column": 17 - }, - "identifierName": "value" - }, + "start":286,"end":291,"loc":{"start":{"line":19,"column":12},"end":{"line":19,"column":17},"identifierName":"value"}, "name": "value" } ], "body": { "type": "BlockStatement", - "start": 293, - "end": 313, - "loc": { - "start": { - "line": 19, - "column": 19 - }, - "end": { - "line": 19, - "column": 39 - } - }, + "start":293,"end":313,"loc":{"start":{"line":19,"column":19},"end":{"line":19,"column":39}}, "body": [ { "type": "ExpressionStatement", - "start": 295, - "end": 311, - "loc": { - "start": { - "line": 19, - "column": 21 - }, - "end": { - "line": 19, - "column": 37 - } - }, + "start":295,"end":311,"loc":{"start":{"line":19,"column":21},"end":{"line":19,"column":37}}, "expression": { "type": "AssignmentExpression", - "start": 295, - "end": 311, - "loc": { - "start": { - "line": 19, - "column": 21 - }, - "end": { - "line": 19, - "column": 37 - } - }, + "start":295,"end":311,"loc":{"start":{"line":19,"column":21},"end":{"line":19,"column":37}}, "operator": "=", "left": { "type": "MemberExpression", - "start": 295, - "end": 302, - "loc": { - "start": { - "line": 19, - "column": 21 - }, - "end": { - "line": 19, - "column": 28 - } - }, + "start":295,"end":302,"loc":{"start":{"line":19,"column":21},"end":{"line":19,"column":28}}, "object": { "type": "ThisExpression", - "start": 295, - "end": 299, - "loc": { - "start": { - "line": 19, - "column": 21 - }, - "end": { - "line": 19, - "column": 25 - } - } + "start":295,"end":299,"loc":{"start":{"line":19,"column":21},"end":{"line":19,"column":25}} }, "property": { "type": "PrivateName", - "start": 300, - "end": 302, - "loc": { - "start": { - "line": 19, - "column": 26 - }, - "end": { - "line": 19, - "column": 28 - } - }, + "start":300,"end":302,"loc":{"start":{"line":19,"column":26},"end":{"line":19,"column":28}}, "id": { "type": "Identifier", - "start": 301, - "end": 302, - "loc": { - "start": { - "line": 19, - "column": 27 - }, - "end": { - "line": 19, - "column": 28 - }, - "identifierName": "x" - }, + "start":301,"end":302,"loc":{"start":{"line":19,"column":27},"end":{"line":19,"column":28},"identifierName":"x"}, "name": "x" } }, @@ -1588,35 +507,12 @@ }, "right": { "type": "UnaryExpression", - "start": 305, - "end": 311, - "loc": { - "start": { - "line": 19, - "column": 31 - }, - "end": { - "line": 19, - "column": 37 - } - }, + "start":305,"end":311,"loc":{"start":{"line":19,"column":31},"end":{"line":19,"column":37}}, "operator": "+", "prefix": true, "argument": { "type": "Identifier", - "start": 306, - "end": 311, - "loc": { - "start": { - "line": 19, - "column": 32 - }, - "end": { - "line": 19, - "column": 37 - }, - "identifierName": "value" - }, + "start":306,"end":311,"loc":{"start":{"line":19,"column":32},"end":{"line":19,"column":37},"identifierName":"value"}, "name": "value" } } @@ -1628,34 +524,11 @@ }, { "type": "ClassMethod", - "start": 321, - "end": 347, - "loc": { - "start": { - "line": 21, - "column": 6 - }, - "end": { - "line": 21, - "column": 32 - } - }, + "start":321,"end":347,"loc":{"start":{"line":21,"column":6},"end":{"line":21,"column":32}}, "static": false, "key": { "type": "Identifier", - "start": 325, - "end": 326, - "loc": { - "start": { - "line": 21, - "column": 10 - }, - "end": { - "line": 21, - "column": 11 - }, - "identifierName": "y" - }, + "start":325,"end":326,"loc":{"start":{"line":21,"column":10},"end":{"line":21,"column":11},"identifierName":"y"}, "name": "y" }, "computed": false, @@ -1666,91 +539,24 @@ "params": [], "body": { "type": "BlockStatement", - "start": 329, - "end": 347, - "loc": { - "start": { - "line": 21, - "column": 14 - }, - "end": { - "line": 21, - "column": 32 - } - }, + "start":329,"end":347,"loc":{"start":{"line":21,"column":14},"end":{"line":21,"column":32}}, "body": [ { "type": "ReturnStatement", - "start": 331, - "end": 345, - "loc": { - "start": { - "line": 21, - "column": 16 - }, - "end": { - "line": 21, - "column": 30 - } - }, + "start":331,"end":345,"loc":{"start":{"line":21,"column":16},"end":{"line":21,"column":30}}, "argument": { "type": "MemberExpression", - "start": 338, - "end": 345, - "loc": { - "start": { - "line": 21, - "column": 23 - }, - "end": { - "line": 21, - "column": 30 - } - }, + "start":338,"end":345,"loc":{"start":{"line":21,"column":23},"end":{"line":21,"column":30}}, "object": { "type": "ThisExpression", - "start": 338, - "end": 342, - "loc": { - "start": { - "line": 21, - "column": 23 - }, - "end": { - "line": 21, - "column": 27 - } - } + "start":338,"end":342,"loc":{"start":{"line":21,"column":23},"end":{"line":21,"column":27}} }, "property": { "type": "PrivateName", - "start": 343, - "end": 345, - "loc": { - "start": { - "line": 21, - "column": 28 - }, - "end": { - "line": 21, - "column": 30 - } - }, + "start":343,"end":345,"loc":{"start":{"line":21,"column":28},"end":{"line":21,"column":30}}, "id": { "type": "Identifier", - "start": 344, - "end": 345, - "loc": { - "start": { - "line": 21, - "column": 29 - }, - "end": { - "line": 21, - "column": 30 - }, - "identifierName": "y" - }, + "start":344,"end":345,"loc":{"start":{"line":21,"column":29},"end":{"line":21,"column":30},"identifierName":"y"}, "name": "y" } }, @@ -1763,34 +569,11 @@ }, { "type": "ClassMethod", - "start": 354, - "end": 387, - "loc": { - "start": { - "line": 22, - "column": 6 - }, - "end": { - "line": 22, - "column": 39 - } - }, + "start":354,"end":387,"loc":{"start":{"line":22,"column":6},"end":{"line":22,"column":39}}, "static": false, "key": { "type": "Identifier", - "start": 358, - "end": 359, - "loc": { - "start": { - "line": 22, - "column": 10 - }, - "end": { - "line": 22, - "column": 11 - }, - "identifierName": "y" - }, + "start":358,"end":359,"loc":{"start":{"line":22,"column":10},"end":{"line":22,"column":11},"identifierName":"y"}, "name": "y" }, "computed": false, @@ -1801,124 +584,34 @@ "params": [ { "type": "Identifier", - "start": 360, - "end": 365, - "loc": { - "start": { - "line": 22, - "column": 12 - }, - "end": { - "line": 22, - "column": 17 - }, - "identifierName": "value" - }, + "start":360,"end":365,"loc":{"start":{"line":22,"column":12},"end":{"line":22,"column":17},"identifierName":"value"}, "name": "value" } ], "body": { "type": "BlockStatement", - "start": 367, - "end": 387, - "loc": { - "start": { - "line": 22, - "column": 19 - }, - "end": { - "line": 22, - "column": 39 - } - }, + "start":367,"end":387,"loc":{"start":{"line":22,"column":19},"end":{"line":22,"column":39}}, "body": [ { "type": "ExpressionStatement", - "start": 369, - "end": 385, - "loc": { - "start": { - "line": 22, - "column": 21 - }, - "end": { - "line": 22, - "column": 37 - } - }, + "start":369,"end":385,"loc":{"start":{"line":22,"column":21},"end":{"line":22,"column":37}}, "expression": { "type": "AssignmentExpression", - "start": 369, - "end": 385, - "loc": { - "start": { - "line": 22, - "column": 21 - }, - "end": { - "line": 22, - "column": 37 - } - }, + "start":369,"end":385,"loc":{"start":{"line":22,"column":21},"end":{"line":22,"column":37}}, "operator": "=", "left": { "type": "MemberExpression", - "start": 369, - "end": 376, - "loc": { - "start": { - "line": 22, - "column": 21 - }, - "end": { - "line": 22, - "column": 28 - } - }, + "start":369,"end":376,"loc":{"start":{"line":22,"column":21},"end":{"line":22,"column":28}}, "object": { "type": "ThisExpression", - "start": 369, - "end": 373, - "loc": { - "start": { - "line": 22, - "column": 21 - }, - "end": { - "line": 22, - "column": 25 - } - } + "start":369,"end":373,"loc":{"start":{"line":22,"column":21},"end":{"line":22,"column":25}} }, "property": { "type": "PrivateName", - "start": 374, - "end": 376, - "loc": { - "start": { - "line": 22, - "column": 26 - }, - "end": { - "line": 22, - "column": 28 - } - }, + "start":374,"end":376,"loc":{"start":{"line":22,"column":26},"end":{"line":22,"column":28}}, "id": { "type": "Identifier", - "start": 375, - "end": 376, - "loc": { - "start": { - "line": 22, - "column": 27 - }, - "end": { - "line": 22, - "column": 28 - }, - "identifierName": "y" - }, + "start":375,"end":376,"loc":{"start":{"line":22,"column":27},"end":{"line":22,"column":28},"identifierName":"y"}, "name": "y" } }, @@ -1926,35 +619,12 @@ }, "right": { "type": "UnaryExpression", - "start": 379, - "end": 385, - "loc": { - "start": { - "line": 22, - "column": 31 - }, - "end": { - "line": 22, - "column": 37 - } - }, + "start":379,"end":385,"loc":{"start":{"line":22,"column":31},"end":{"line":22,"column":37}}, "operator": "+", "prefix": true, "argument": { "type": "Identifier", - "start": 380, - "end": 385, - "loc": { - "start": { - "line": 22, - "column": 32 - }, - "end": { - "line": 22, - "column": 37 - }, - "identifierName": "value" - }, + "start":380,"end":385,"loc":{"start":{"line":22,"column":32},"end":{"line":22,"column":37},"identifierName":"value"}, "name": "value" } } @@ -1966,34 +636,11 @@ }, { "type": "ClassMethod", - "start": 395, - "end": 452, - "loc": { - "start": { - "line": 24, - "column": 6 - }, - "end": { - "line": 24, - "column": 63 - } - }, + "start":395,"end":452,"loc":{"start":{"line":24,"column":6},"end":{"line":24,"column":63}}, "static": false, "key": { "type": "Identifier", - "start": 395, - "end": 401, - "loc": { - "start": { - "line": 24, - "column": 6 - }, - "end": { - "line": 24, - "column": 12 - }, - "identifierName": "equals" - }, + "start":395,"end":401,"loc":{"start":{"line":24,"column":6},"end":{"line":24,"column":12},"identifierName":"equals"}, "name": "equals" }, "computed": false, @@ -2004,137 +651,36 @@ "params": [ { "type": "Identifier", - "start": 402, - "end": 403, - "loc": { - "start": { - "line": 24, - "column": 13 - }, - "end": { - "line": 24, - "column": 14 - }, - "identifierName": "p" - }, + "start":402,"end":403,"loc":{"start":{"line":24,"column":13},"end":{"line":24,"column":14},"identifierName":"p"}, "name": "p" } ], "body": { "type": "BlockStatement", - "start": 405, - "end": 452, - "loc": { - "start": { - "line": 24, - "column": 16 - }, - "end": { - "line": 24, - "column": 63 - } - }, + "start":405,"end":452,"loc":{"start":{"line":24,"column":16},"end":{"line":24,"column":63}}, "body": [ { "type": "ReturnStatement", - "start": 407, - "end": 450, - "loc": { - "start": { - "line": 24, - "column": 18 - }, - "end": { - "line": 24, - "column": 61 - } - }, + "start":407,"end":450,"loc":{"start":{"line":24,"column":18},"end":{"line":24,"column":61}}, "argument": { "type": "LogicalExpression", - "start": 414, - "end": 450, - "loc": { - "start": { - "line": 24, - "column": 25 - }, - "end": { - "line": 24, - "column": 61 - } - }, + "start":414,"end":450,"loc":{"start":{"line":24,"column":25},"end":{"line":24,"column":61}}, "left": { "type": "BinaryExpression", - "start": 414, - "end": 430, - "loc": { - "start": { - "line": 24, - "column": 25 - }, - "end": { - "line": 24, - "column": 41 - } - }, + "start":414,"end":430,"loc":{"start":{"line":24,"column":25},"end":{"line":24,"column":41}}, "left": { "type": "MemberExpression", - "start": 414, - "end": 421, - "loc": { - "start": { - "line": 24, - "column": 25 - }, - "end": { - "line": 24, - "column": 32 - } - }, + "start":414,"end":421,"loc":{"start":{"line":24,"column":25},"end":{"line":24,"column":32}}, "object": { "type": "ThisExpression", - "start": 414, - "end": 418, - "loc": { - "start": { - "line": 24, - "column": 25 - }, - "end": { - "line": 24, - "column": 29 - } - } + "start":414,"end":418,"loc":{"start":{"line":24,"column":25},"end":{"line":24,"column":29}} }, "property": { "type": "PrivateName", - "start": 419, - "end": 421, - "loc": { - "start": { - "line": 24, - "column": 30 - }, - "end": { - "line": 24, - "column": 32 - } - }, + "start":419,"end":421,"loc":{"start":{"line":24,"column":30},"end":{"line":24,"column":32}}, "id": { "type": "Identifier", - "start": 420, - "end": 421, - "loc": { - "start": { - "line": 24, - "column": 31 - }, - "end": { - "line": 24, - "column": 32 - }, - "identifierName": "x" - }, + "start":420,"end":421,"loc":{"start":{"line":24,"column":31},"end":{"line":24,"column":32},"identifierName":"x"}, "name": "x" } }, @@ -2143,64 +689,18 @@ "operator": "===", "right": { "type": "MemberExpression", - "start": 426, - "end": 430, - "loc": { - "start": { - "line": 24, - "column": 37 - }, - "end": { - "line": 24, - "column": 41 - } - }, + "start":426,"end":430,"loc":{"start":{"line":24,"column":37},"end":{"line":24,"column":41}}, "object": { "type": "Identifier", - "start": 426, - "end": 427, - "loc": { - "start": { - "line": 24, - "column": 37 - }, - "end": { - "line": 24, - "column": 38 - }, - "identifierName": "p" - }, + "start":426,"end":427,"loc":{"start":{"line":24,"column":37},"end":{"line":24,"column":38},"identifierName":"p"}, "name": "p" }, "property": { "type": "PrivateName", - "start": 428, - "end": 430, - "loc": { - "start": { - "line": 24, - "column": 39 - }, - "end": { - "line": 24, - "column": 41 - } - }, + "start":428,"end":430,"loc":{"start":{"line":24,"column":39},"end":{"line":24,"column":41}}, "id": { "type": "Identifier", - "start": 429, - "end": 430, - "loc": { - "start": { - "line": 24, - "column": 40 - }, - "end": { - "line": 24, - "column": 41 - }, - "identifierName": "x" - }, + "start":429,"end":430,"loc":{"start":{"line":24,"column":40},"end":{"line":24,"column":41},"identifierName":"x"}, "name": "x" } }, @@ -2210,76 +710,20 @@ "operator": "&&", "right": { "type": "BinaryExpression", - "start": 434, - "end": 450, - "loc": { - "start": { - "line": 24, - "column": 45 - }, - "end": { - "line": 24, - "column": 61 - } - }, + "start":434,"end":450,"loc":{"start":{"line":24,"column":45},"end":{"line":24,"column":61}}, "left": { "type": "MemberExpression", - "start": 434, - "end": 441, - "loc": { - "start": { - "line": 24, - "column": 45 - }, - "end": { - "line": 24, - "column": 52 - } - }, + "start":434,"end":441,"loc":{"start":{"line":24,"column":45},"end":{"line":24,"column":52}}, "object": { "type": "ThisExpression", - "start": 434, - "end": 438, - "loc": { - "start": { - "line": 24, - "column": 45 - }, - "end": { - "line": 24, - "column": 49 - } - } + "start":434,"end":438,"loc":{"start":{"line":24,"column":45},"end":{"line":24,"column":49}} }, "property": { "type": "PrivateName", - "start": 439, - "end": 441, - "loc": { - "start": { - "line": 24, - "column": 50 - }, - "end": { - "line": 24, - "column": 52 - } - }, + "start":439,"end":441,"loc":{"start":{"line":24,"column":50},"end":{"line":24,"column":52}}, "id": { "type": "Identifier", - "start": 440, - "end": 441, - "loc": { - "start": { - "line": 24, - "column": 51 - }, - "end": { - "line": 24, - "column": 52 - }, - "identifierName": "y" - }, + "start":440,"end":441,"loc":{"start":{"line":24,"column":51},"end":{"line":24,"column":52},"identifierName":"y"}, "name": "y" } }, @@ -2288,64 +732,18 @@ "operator": "===", "right": { "type": "MemberExpression", - "start": 446, - "end": 450, - "loc": { - "start": { - "line": 24, - "column": 57 - }, - "end": { - "line": 24, - "column": 61 - } - }, + "start":446,"end":450,"loc":{"start":{"line":24,"column":57},"end":{"line":24,"column":61}}, "object": { "type": "Identifier", - "start": 446, - "end": 447, - "loc": { - "start": { - "line": 24, - "column": 57 - }, - "end": { - "line": 24, - "column": 58 - }, - "identifierName": "p" - }, + "start":446,"end":447,"loc":{"start":{"line":24,"column":57},"end":{"line":24,"column":58},"identifierName":"p"}, "name": "p" }, "property": { "type": "PrivateName", - "start": 448, - "end": 450, - "loc": { - "start": { - "line": 24, - "column": 59 - }, - "end": { - "line": 24, - "column": 61 - } - }, + "start":448,"end":450,"loc":{"start":{"line":24,"column":59},"end":{"line":24,"column":61}}, "id": { "type": "Identifier", - "start": 449, - "end": 450, - "loc": { - "start": { - "line": 24, - "column": 60 - }, - "end": { - "line": 24, - "column": 61 - }, - "identifierName": "y" - }, + "start":449,"end":450,"loc":{"start":{"line":24,"column":60},"end":{"line":24,"column":61},"identifierName":"y"}, "name": "y" } }, @@ -2360,34 +758,11 @@ }, { "type": "ClassMethod", - "start": 460, - "end": 516, - "loc": { - "start": { - "line": 26, - "column": 6 - }, - "end": { - "line": 26, - "column": 62 - } - }, + "start":460,"end":516,"loc":{"start":{"line":26,"column":6},"end":{"line":26,"column":62}}, "static": false, "key": { "type": "Identifier", - "start": 460, - "end": 468, - "loc": { - "start": { - "line": 26, - "column": 6 - }, - "end": { - "line": 26, - "column": 14 - }, - "identifierName": "toString" - }, + "start":460,"end":468,"loc":{"start":{"line":26,"column":6},"end":{"line":26,"column":14},"identifierName":"toString"}, "name": "toString" }, "computed": false, @@ -2398,106 +773,28 @@ "params": [], "body": { "type": "BlockStatement", - "start": 471, - "end": 516, - "loc": { - "start": { - "line": 26, - "column": 17 - }, - "end": { - "line": 26, - "column": 62 - } - }, + "start":471,"end":516,"loc":{"start":{"line":26,"column":17},"end":{"line":26,"column":62}}, "body": [ { - "type": "ReturnStatement", - "start": 473, - "end": 514, - "loc": { - "start": { - "line": 26, - "column": 19 - }, - "end": { - "line": 26, - "column": 60 - } - }, + "type": "ReturnStatement", + "start":473,"end":514,"loc":{"start":{"line":26,"column":19},"end":{"line":26,"column":60}}, "argument": { "type": "TemplateLiteral", - "start": 480, - "end": 514, - "loc": { - "start": { - "line": 26, - "column": 26 - }, - "end": { - "line": 26, - "column": 60 - } - }, + "start":480,"end":514,"loc":{"start":{"line":26,"column":26},"end":{"line":26,"column":60}}, "expressions": [ { "type": "MemberExpression", - "start": 490, - "end": 497, - "loc": { - "start": { - "line": 26, - "column": 36 - }, - "end": { - "line": 26, - "column": 43 - } - }, + "start":490,"end":497,"loc":{"start":{"line":26,"column":36},"end":{"line":26,"column":43}}, "object": { "type": "ThisExpression", - "start": 490, - "end": 494, - "loc": { - "start": { - "line": 26, - "column": 36 - }, - "end": { - "line": 26, - "column": 40 - } - } + "start":490,"end":494,"loc":{"start":{"line":26,"column":36},"end":{"line":26,"column":40}} }, "property": { "type": "PrivateName", - "start": 495, - "end": 497, - "loc": { - "start": { - "line": 26, - "column": 41 - }, - "end": { - "line": 26, - "column": 43 - } - }, + "start":495,"end":497,"loc":{"start":{"line":26,"column":41},"end":{"line":26,"column":43}}, "id": { "type": "Identifier", - "start": 496, - "end": 497, - "loc": { - "start": { - "line": 26, - "column": 42 - }, - "end": { - "line": 26, - "column": 43 - }, - "identifierName": "x" - }, + "start":496,"end":497,"loc":{"start":{"line":26,"column":42},"end":{"line":26,"column":43},"identifierName":"x"}, "name": "x" } }, @@ -2505,62 +802,17 @@ }, { "type": "MemberExpression", - "start": 503, - "end": 510, - "loc": { - "start": { - "line": 26, - "column": 49 - }, - "end": { - "line": 26, - "column": 56 - } - }, + "start":503,"end":510,"loc":{"start":{"line":26,"column":49},"end":{"line":26,"column":56}}, "object": { "type": "ThisExpression", - "start": 503, - "end": 507, - "loc": { - "start": { - "line": 26, - "column": 49 - }, - "end": { - "line": 26, - "column": 53 - } - } + "start":503,"end":507,"loc":{"start":{"line":26,"column":49},"end":{"line":26,"column":53}} }, "property": { "type": "PrivateName", - "start": 508, - "end": 510, - "loc": { - "start": { - "line": 26, - "column": 54 - }, - "end": { - "line": 26, - "column": 56 - } - }, + "start":508,"end":510,"loc":{"start":{"line":26,"column":54},"end":{"line":26,"column":56}}, "id": { "type": "Identifier", - "start": 509, - "end": 510, - "loc": { - "start": { - "line": 26, - "column": 55 - }, - "end": { - "line": 26, - "column": 56 - }, - "identifierName": "y" - }, + "start":509,"end":510,"loc":{"start":{"line":26,"column":55},"end":{"line":26,"column":56},"identifierName":"y"}, "name": "y" } }, @@ -2570,18 +822,7 @@ "quasis": [ { "type": "TemplateElement", - "start": 481, - "end": 487, - "loc": { - "start": { - "line": 26, - "column": 27 - }, - "end": { - "line": 26, - "column": 33 - } - }, + "start":481,"end":487,"loc":{"start":{"line":26,"column":27},"end":{"line":26,"column":33}}, "value": { "raw": "Point<", "cooked": "Point<" @@ -2590,18 +831,7 @@ }, { "type": "TemplateElement", - "start": 499, - "end": 500, - "loc": { - "start": { - "line": 26, - "column": 45 - }, - "end": { - "line": 26, - "column": 46 - } - }, + "start":499,"end":500,"loc":{"start":{"line":26,"column":45},"end":{"line":26,"column":46}}, "value": { "raw": ",", "cooked": "," @@ -2610,18 +840,7 @@ }, { "type": "TemplateElement", - "start": 512, - "end": 513, - "loc": { - "start": { - "line": 26, - "column": 58 - }, - "end": { - "line": 26, - "column": 59 - } - }, + "start":512,"end":513,"loc":{"start":{"line":26,"column":58},"end":{"line":26,"column":59}}, "value": { "raw": ">", "cooked": ">" @@ -2646,34 +865,11 @@ }, { "type": "ClassMethod", - "start": 531, - "end": 557, - "loc": { - "start": { - "line": 30, - "column": 2 - }, - "end": { - "line": 30, - "column": 28 - } - }, + "start":531,"end":557,"loc":{"start":{"line":30,"column":2},"end":{"line":30,"column":28}}, "static": false, "key": { "type": "Identifier", - "start": 535, - "end": 536, - "loc": { - "start": { - "line": 30, - "column": 6 - }, - "end": { - "line": 30, - "column": 7 - }, - "identifierName": "x" - }, + "start":535,"end":536,"loc":{"start":{"line":30,"column":6},"end":{"line":30,"column":7},"identifierName":"x"}, "name": "x" }, "computed": false, @@ -2684,91 +880,24 @@ "params": [], "body": { "type": "BlockStatement", - "start": 539, - "end": 557, - "loc": { - "start": { - "line": 30, - "column": 10 - }, - "end": { - "line": 30, - "column": 28 - } - }, + "start":539,"end":557,"loc":{"start":{"line":30,"column":10},"end":{"line":30,"column":28}}, "body": [ { "type": "ReturnStatement", - "start": 541, - "end": 555, - "loc": { - "start": { - "line": 30, - "column": 12 - }, - "end": { - "line": 30, - "column": 26 - } - }, + "start":541,"end":555,"loc":{"start":{"line":30,"column":12},"end":{"line":30,"column":26}}, "argument": { "type": "MemberExpression", - "start": 548, - "end": 555, - "loc": { - "start": { - "line": 30, - "column": 19 - }, - "end": { - "line": 30, - "column": 26 - } - }, + "start":548,"end":555,"loc":{"start":{"line":30,"column":19},"end":{"line":30,"column":26}}, "object": { "type": "ThisExpression", - "start": 548, - "end": 552, - "loc": { - "start": { - "line": 30, - "column": 19 - }, - "end": { - "line": 30, - "column": 23 - } - } + "start":548,"end":552,"loc":{"start":{"line":30,"column":19},"end":{"line":30,"column":23}} }, "property": { "type": "PrivateName", - "start": 553, - "end": 555, - "loc": { - "start": { - "line": 30, - "column": 24 - }, - "end": { - "line": 30, - "column": 26 - } - }, + "start":553,"end":555,"loc":{"start":{"line":30,"column":24},"end":{"line":30,"column":26}}, "id": { "type": "Identifier", - "start": 554, - "end": 555, - "loc": { - "start": { - "line": 30, - "column": 25 - }, - "end": { - "line": 30, - "column": 26 - }, - "identifierName": "x" - }, + "start":554,"end":555,"loc":{"start":{"line":30,"column":25},"end":{"line":30,"column":26},"identifierName":"x"}, "name": "x" } }, @@ -2781,34 +910,11 @@ }, { "type": "ClassMethod", - "start": 560, - "end": 593, - "loc": { - "start": { - "line": 31, - "column": 2 - }, - "end": { - "line": 31, - "column": 35 - } - }, + "start":560,"end":593,"loc":{"start":{"line":31,"column":2},"end":{"line":31,"column":35}}, "static": false, "key": { "type": "Identifier", - "start": 564, - "end": 565, - "loc": { - "start": { - "line": 31, - "column": 6 - }, - "end": { - "line": 31, - "column": 7 - }, - "identifierName": "x" - }, + "start":564,"end":565,"loc":{"start":{"line":31,"column":6},"end":{"line":31,"column":7},"identifierName":"x"}, "name": "x" }, "computed": false, @@ -2819,124 +925,34 @@ "params": [ { "type": "Identifier", - "start": 566, - "end": 571, - "loc": { - "start": { - "line": 31, - "column": 8 - }, - "end": { - "line": 31, - "column": 13 - }, - "identifierName": "value" - }, + "start":566,"end":571,"loc":{"start":{"line":31,"column":8},"end":{"line":31,"column":13},"identifierName":"value"}, "name": "value" } ], "body": { "type": "BlockStatement", - "start": 573, - "end": 593, - "loc": { - "start": { - "line": 31, - "column": 15 - }, - "end": { - "line": 31, - "column": 35 - } - }, + "start":573,"end":593,"loc":{"start":{"line":31,"column":15},"end":{"line":31,"column":35}}, "body": [ { "type": "ExpressionStatement", - "start": 575, - "end": 591, - "loc": { - "start": { - "line": 31, - "column": 17 - }, - "end": { - "line": 31, - "column": 33 - } - }, + "start":575,"end":591,"loc":{"start":{"line":31,"column":17},"end":{"line":31,"column":33}}, "expression": { "type": "AssignmentExpression", - "start": 575, - "end": 591, - "loc": { - "start": { - "line": 31, - "column": 17 - }, - "end": { - "line": 31, - "column": 33 - } - }, + "start":575,"end":591,"loc":{"start":{"line":31,"column":17},"end":{"line":31,"column":33}}, "operator": "=", "left": { "type": "MemberExpression", - "start": 575, - "end": 582, - "loc": { - "start": { - "line": 31, - "column": 17 - }, - "end": { - "line": 31, - "column": 24 - } - }, + "start":575,"end":582,"loc":{"start":{"line":31,"column":17},"end":{"line":31,"column":24}}, "object": { "type": "ThisExpression", - "start": 575, - "end": 579, - "loc": { - "start": { - "line": 31, - "column": 17 - }, - "end": { - "line": 31, - "column": 21 - } - } + "start":575,"end":579,"loc":{"start":{"line":31,"column":17},"end":{"line":31,"column":21}} }, "property": { "type": "PrivateName", - "start": 580, - "end": 582, - "loc": { - "start": { - "line": 31, - "column": 22 - }, - "end": { - "line": 31, - "column": 24 - } - }, + "start":580,"end":582,"loc":{"start":{"line":31,"column":22},"end":{"line":31,"column":24}}, "id": { "type": "Identifier", - "start": 581, - "end": 582, - "loc": { - "start": { - "line": 31, - "column": 23 - }, - "end": { - "line": 31, - "column": 24 - }, - "identifierName": "x" - }, + "start":581,"end":582,"loc":{"start":{"line":31,"column":23},"end":{"line":31,"column":24},"identifierName":"x"}, "name": "x" } }, @@ -2944,35 +960,12 @@ }, "right": { "type": "UnaryExpression", - "start": 585, - "end": 591, - "loc": { - "start": { - "line": 31, - "column": 27 - }, - "end": { - "line": 31, - "column": 33 - } - }, + "start":585,"end":591,"loc":{"start":{"line":31,"column":27},"end":{"line":31,"column":33}}, "operator": "+", "prefix": true, "argument": { "type": "Identifier", - "start": 586, - "end": 591, - "loc": { - "start": { - "line": 31, - "column": 28 - }, - "end": { - "line": 31, - "column": 33 - }, - "identifierName": "value" - }, + "start":586,"end":591,"loc":{"start":{"line":31,"column":28},"end":{"line":31,"column":33},"identifierName":"value"}, "name": "value" } } @@ -2984,34 +977,11 @@ }, { "type": "ClassMethod", - "start": 597, - "end": 623, - "loc": { - "start": { - "line": 33, - "column": 2 - }, - "end": { - "line": 33, - "column": 28 - } - }, + "start":597,"end":623,"loc":{"start":{"line":33,"column":2},"end":{"line":33,"column":28}}, "static": false, "key": { "type": "Identifier", - "start": 601, - "end": 602, - "loc": { - "start": { - "line": 33, - "column": 6 - }, - "end": { - "line": 33, - "column": 7 - }, - "identifierName": "y" - }, + "start":601,"end":602,"loc":{"start":{"line":33,"column":6},"end":{"line":33,"column":7},"identifierName":"y"}, "name": "y" }, "computed": false, @@ -3022,91 +992,24 @@ "params": [], "body": { "type": "BlockStatement", - "start": 605, - "end": 623, - "loc": { - "start": { - "line": 33, - "column": 10 - }, - "end": { - "line": 33, - "column": 28 - } - }, + "start":605,"end":623,"loc":{"start":{"line":33,"column":10},"end":{"line":33,"column":28}}, "body": [ { "type": "ReturnStatement", - "start": 607, - "end": 621, - "loc": { - "start": { - "line": 33, - "column": 12 - }, - "end": { - "line": 33, - "column": 26 - } - }, + "start":607,"end":621,"loc":{"start":{"line":33,"column":12},"end":{"line":33,"column":26}}, "argument": { "type": "MemberExpression", - "start": 614, - "end": 621, - "loc": { - "start": { - "line": 33, - "column": 19 - }, - "end": { - "line": 33, - "column": 26 - } - }, + "start":614,"end":621,"loc":{"start":{"line":33,"column":19},"end":{"line":33,"column":26}}, "object": { "type": "ThisExpression", - "start": 614, - "end": 618, - "loc": { - "start": { - "line": 33, - "column": 19 - }, - "end": { - "line": 33, - "column": 23 - } - } + "start":614,"end":618,"loc":{"start":{"line":33,"column":19},"end":{"line":33,"column":23}} }, "property": { "type": "PrivateName", - "start": 619, - "end": 621, - "loc": { - "start": { - "line": 33, - "column": 24 - }, - "end": { - "line": 33, - "column": 26 - } - }, + "start":619,"end":621,"loc":{"start":{"line":33,"column":24},"end":{"line":33,"column":26}}, "id": { "type": "Identifier", - "start": 620, - "end": 621, - "loc": { - "start": { - "line": 33, - "column": 25 - }, - "end": { - "line": 33, - "column": 26 - }, - "identifierName": "y" - }, + "start":620,"end":621,"loc":{"start":{"line":33,"column":25},"end":{"line":33,"column":26},"identifierName":"y"}, "name": "y" } }, @@ -3119,34 +1022,11 @@ }, { "type": "ClassMethod", - "start": 626, - "end": 659, - "loc": { - "start": { - "line": 34, - "column": 2 - }, - "end": { - "line": 34, - "column": 35 - } - }, + "start":626,"end":659,"loc":{"start":{"line":34,"column":2},"end":{"line":34,"column":35}}, "static": false, "key": { "type": "Identifier", - "start": 630, - "end": 631, - "loc": { - "start": { - "line": 34, - "column": 6 - }, - "end": { - "line": 34, - "column": 7 - }, - "identifierName": "y" - }, + "start":630,"end":631,"loc":{"start":{"line":34,"column":6},"end":{"line":34,"column":7},"identifierName":"y"}, "name": "y" }, "computed": false, @@ -3157,124 +1037,34 @@ "params": [ { "type": "Identifier", - "start": 632, - "end": 637, - "loc": { - "start": { - "line": 34, - "column": 8 - }, - "end": { - "line": 34, - "column": 13 - }, - "identifierName": "value" - }, + "start":632,"end":637,"loc":{"start":{"line":34,"column":8},"end":{"line":34,"column":13},"identifierName":"value"}, "name": "value" } ], "body": { "type": "BlockStatement", - "start": 639, - "end": 659, - "loc": { - "start": { - "line": 34, - "column": 15 - }, - "end": { - "line": 34, - "column": 35 - } - }, + "start":639,"end":659,"loc":{"start":{"line":34,"column":15},"end":{"line":34,"column":35}}, "body": [ { "type": "ExpressionStatement", - "start": 641, - "end": 657, - "loc": { - "start": { - "line": 34, - "column": 17 - }, - "end": { - "line": 34, - "column": 33 - } - }, + "start":641,"end":657,"loc":{"start":{"line":34,"column":17},"end":{"line":34,"column":33}}, "expression": { "type": "AssignmentExpression", - "start": 641, - "end": 657, - "loc": { - "start": { - "line": 34, - "column": 17 - }, - "end": { - "line": 34, - "column": 33 - } - }, + "start":641,"end":657,"loc":{"start":{"line":34,"column":17},"end":{"line":34,"column":33}}, "operator": "=", "left": { "type": "MemberExpression", - "start": 641, - "end": 648, - "loc": { - "start": { - "line": 34, - "column": 17 - }, - "end": { - "line": 34, - "column": 24 - } - }, + "start":641,"end":648,"loc":{"start":{"line":34,"column":17},"end":{"line":34,"column":24}}, "object": { "type": "ThisExpression", - "start": 641, - "end": 645, - "loc": { - "start": { - "line": 34, - "column": 17 - }, - "end": { - "line": 34, - "column": 21 - } - } + "start":641,"end":645,"loc":{"start":{"line":34,"column":17},"end":{"line":34,"column":21}} }, "property": { "type": "PrivateName", - "start": 646, - "end": 648, - "loc": { - "start": { - "line": 34, - "column": 22 - }, - "end": { - "line": 34, - "column": 24 - } - }, + "start":646,"end":648,"loc":{"start":{"line":34,"column":22},"end":{"line":34,"column":24}}, "id": { "type": "Identifier", - "start": 647, - "end": 648, - "loc": { - "start": { - "line": 34, - "column": 23 - }, - "end": { - "line": 34, - "column": 24 - }, - "identifierName": "y" - }, + "start":647,"end":648,"loc":{"start":{"line":34,"column":23},"end":{"line":34,"column":24},"identifierName":"y"}, "name": "y" } }, @@ -3282,35 +1072,12 @@ }, "right": { "type": "UnaryExpression", - "start": 651, - "end": 657, - "loc": { - "start": { - "line": 34, - "column": 27 - }, - "end": { - "line": 34, - "column": 33 - } - }, + "start":651,"end":657,"loc":{"start":{"line":34,"column":27},"end":{"line":34,"column":33}}, "operator": "+", "prefix": true, "argument": { "type": "Identifier", - "start": 652, - "end": 657, - "loc": { - "start": { - "line": 34, - "column": 28 - }, - "end": { - "line": 34, - "column": 33 - }, - "identifierName": "value" - }, + "start":652,"end":657,"loc":{"start":{"line":34,"column":28},"end":{"line":34,"column":33},"identifierName":"value"}, "name": "value" } } @@ -3322,34 +1089,11 @@ }, { "type": "ClassMethod", - "start": 663, - "end": 720, - "loc": { - "start": { - "line": 36, - "column": 2 - }, - "end": { - "line": 36, - "column": 59 - } - }, + "start":663,"end":720,"loc":{"start":{"line":36,"column":2},"end":{"line":36,"column":59}}, "static": false, "key": { "type": "Identifier", - "start": 663, - "end": 669, - "loc": { - "start": { - "line": 36, - "column": 2 - }, - "end": { - "line": 36, - "column": 8 - }, - "identifierName": "equals" - }, + "start":663,"end":669,"loc":{"start":{"line":36,"column":2},"end":{"line":36,"column":8},"identifierName":"equals"}, "name": "equals" }, "computed": false, @@ -3360,137 +1104,36 @@ "params": [ { "type": "Identifier", - "start": 670, - "end": 671, - "loc": { - "start": { - "line": 36, - "column": 9 - }, - "end": { - "line": 36, - "column": 10 - }, - "identifierName": "p" - }, + "start":670,"end":671,"loc":{"start":{"line":36,"column":9},"end":{"line":36,"column":10},"identifierName":"p"}, "name": "p" } ], "body": { "type": "BlockStatement", - "start": 673, - "end": 720, - "loc": { - "start": { - "line": 36, - "column": 12 - }, - "end": { - "line": 36, - "column": 59 - } - }, + "start":673,"end":720,"loc":{"start":{"line":36,"column":12},"end":{"line":36,"column":59}}, "body": [ { "type": "ReturnStatement", - "start": 675, - "end": 718, - "loc": { - "start": { - "line": 36, - "column": 14 - }, - "end": { - "line": 36, - "column": 57 - } - }, + "start":675,"end":718,"loc":{"start":{"line":36,"column":14},"end":{"line":36,"column":57}}, "argument": { "type": "LogicalExpression", - "start": 682, - "end": 718, - "loc": { - "start": { - "line": 36, - "column": 21 - }, - "end": { - "line": 36, - "column": 57 - } - }, + "start":682,"end":718,"loc":{"start":{"line":36,"column":21},"end":{"line":36,"column":57}}, "left": { "type": "BinaryExpression", - "start": 682, - "end": 698, - "loc": { - "start": { - "line": 36, - "column": 21 - }, - "end": { - "line": 36, - "column": 37 - } - }, + "start":682,"end":698,"loc":{"start":{"line":36,"column":21},"end":{"line":36,"column":37}}, "left": { "type": "MemberExpression", - "start": 682, - "end": 689, - "loc": { - "start": { - "line": 36, - "column": 21 - }, - "end": { - "line": 36, - "column": 28 - } - }, + "start":682,"end":689,"loc":{"start":{"line":36,"column":21},"end":{"line":36,"column":28}}, "object": { "type": "ThisExpression", - "start": 682, - "end": 686, - "loc": { - "start": { - "line": 36, - "column": 21 - }, - "end": { - "line": 36, - "column": 25 - } - } + "start":682,"end":686,"loc":{"start":{"line":36,"column":21},"end":{"line":36,"column":25}} }, "property": { "type": "PrivateName", - "start": 687, - "end": 689, - "loc": { - "start": { - "line": 36, - "column": 26 - }, - "end": { - "line": 36, - "column": 28 - } - }, + "start":687,"end":689,"loc":{"start":{"line":36,"column":26},"end":{"line":36,"column":28}}, "id": { "type": "Identifier", - "start": 688, - "end": 689, - "loc": { - "start": { - "line": 36, - "column": 27 - }, - "end": { - "line": 36, - "column": 28 - }, - "identifierName": "x" - }, + "start":688,"end":689,"loc":{"start":{"line":36,"column":27},"end":{"line":36,"column":28},"identifierName":"x"}, "name": "x" } }, @@ -3499,64 +1142,18 @@ "operator": "===", "right": { "type": "MemberExpression", - "start": 694, - "end": 698, - "loc": { - "start": { - "line": 36, - "column": 33 - }, - "end": { - "line": 36, - "column": 37 - } - }, + "start":694,"end":698,"loc":{"start":{"line":36,"column":33},"end":{"line":36,"column":37}}, "object": { "type": "Identifier", - "start": 694, - "end": 695, - "loc": { - "start": { - "line": 36, - "column": 33 - }, - "end": { - "line": 36, - "column": 34 - }, - "identifierName": "p" - }, + "start":694,"end":695,"loc":{"start":{"line":36,"column":33},"end":{"line":36,"column":34},"identifierName":"p"}, "name": "p" }, "property": { "type": "PrivateName", - "start": 696, - "end": 698, - "loc": { - "start": { - "line": 36, - "column": 35 - }, - "end": { - "line": 36, - "column": 37 - } - }, + "start":696,"end":698,"loc":{"start":{"line":36,"column":35},"end":{"line":36,"column":37}}, "id": { "type": "Identifier", - "start": 697, - "end": 698, - "loc": { - "start": { - "line": 36, - "column": 36 - }, - "end": { - "line": 36, - "column": 37 - }, - "identifierName": "x" - }, + "start":697,"end":698,"loc":{"start":{"line":36,"column":36},"end":{"line":36,"column":37},"identifierName":"x"}, "name": "x" } }, @@ -3566,76 +1163,20 @@ "operator": "&&", "right": { "type": "BinaryExpression", - "start": 702, - "end": 718, - "loc": { - "start": { - "line": 36, - "column": 41 - }, - "end": { - "line": 36, - "column": 57 - } - }, + "start":702,"end":718,"loc":{"start":{"line":36,"column":41},"end":{"line":36,"column":57}}, "left": { "type": "MemberExpression", - "start": 702, - "end": 709, - "loc": { - "start": { - "line": 36, - "column": 41 - }, - "end": { - "line": 36, - "column": 48 - } - }, + "start":702,"end":709,"loc":{"start":{"line":36,"column":41},"end":{"line":36,"column":48}}, "object": { "type": "ThisExpression", - "start": 702, - "end": 706, - "loc": { - "start": { - "line": 36, - "column": 41 - }, - "end": { - "line": 36, - "column": 45 - } - } + "start":702,"end":706,"loc":{"start":{"line":36,"column":41},"end":{"line":36,"column":45}} }, "property": { "type": "PrivateName", - "start": 707, - "end": 709, - "loc": { - "start": { - "line": 36, - "column": 46 - }, - "end": { - "line": 36, - "column": 48 - } - }, + "start":707,"end":709,"loc":{"start":{"line":36,"column":46},"end":{"line":36,"column":48}}, "id": { "type": "Identifier", - "start": 708, - "end": 709, - "loc": { - "start": { - "line": 36, - "column": 47 - }, - "end": { - "line": 36, - "column": 48 - }, - "identifierName": "y" - }, + "start":708,"end":709,"loc":{"start":{"line":36,"column":47},"end":{"line":36,"column":48},"identifierName":"y"}, "name": "y" } }, @@ -3644,64 +1185,18 @@ "operator": "===", "right": { "type": "MemberExpression", - "start": 714, - "end": 718, - "loc": { - "start": { - "line": 36, - "column": 53 - }, - "end": { - "line": 36, - "column": 57 - } - }, + "start":714,"end":718,"loc":{"start":{"line":36,"column":53},"end":{"line":36,"column":57}}, "object": { "type": "Identifier", - "start": 714, - "end": 715, - "loc": { - "start": { - "line": 36, - "column": 53 - }, - "end": { - "line": 36, - "column": 54 - }, - "identifierName": "p" - }, + "start":714,"end":715,"loc":{"start":{"line":36,"column":53},"end":{"line":36,"column":54},"identifierName":"p"}, "name": "p" }, "property": { "type": "PrivateName", - "start": 716, - "end": 718, - "loc": { - "start": { - "line": 36, - "column": 55 - }, - "end": { - "line": 36, - "column": 57 - } - }, + "start":716,"end":718,"loc":{"start":{"line":36,"column":55},"end":{"line":36,"column":57}}, "id": { "type": "Identifier", - "start": 717, - "end": 718, - "loc": { - "start": { - "line": 36, - "column": 56 - }, - "end": { - "line": 36, - "column": 57 - }, - "identifierName": "y" - }, + "start":717,"end":718,"loc":{"start":{"line":36,"column":56},"end":{"line":36,"column":57},"identifierName":"y"}, "name": "y" } }, @@ -3716,34 +1211,11 @@ }, { "type": "ClassMethod", - "start": 724, - "end": 780, - "loc": { - "start": { - "line": 38, - "column": 2 - }, - "end": { - "line": 38, - "column": 58 - } - }, + "start":724,"end":780,"loc":{"start":{"line":38,"column":2},"end":{"line":38,"column":58}}, "static": false, "key": { "type": "Identifier", - "start": 724, - "end": 732, - "loc": { - "start": { - "line": 38, - "column": 2 - }, - "end": { - "line": 38, - "column": 10 - }, - "identifierName": "toString" - }, + "start":724,"end":732,"loc":{"start":{"line":38,"column":2},"end":{"line":38,"column":10},"identifierName":"toString"}, "name": "toString" }, "computed": false, @@ -3754,106 +1226,28 @@ "params": [], "body": { "type": "BlockStatement", - "start": 735, - "end": 780, - "loc": { - "start": { - "line": 38, - "column": 13 - }, - "end": { - "line": 38, - "column": 58 - } - }, + "start":735,"end":780,"loc":{"start":{"line":38,"column":13},"end":{"line":38,"column":58}}, "body": [ { "type": "ReturnStatement", - "start": 737, - "end": 778, - "loc": { - "start": { - "line": 38, - "column": 15 - }, - "end": { - "line": 38, - "column": 56 - } - }, + "start":737,"end":778,"loc":{"start":{"line":38,"column":15},"end":{"line":38,"column":56}}, "argument": { "type": "TemplateLiteral", - "start": 744, - "end": 778, - "loc": { - "start": { - "line": 38, - "column": 22 - }, - "end": { - "line": 38, - "column": 56 - } - }, + "start":744,"end":778,"loc":{"start":{"line":38,"column":22},"end":{"line":38,"column":56}}, "expressions": [ { "type": "MemberExpression", - "start": 754, - "end": 761, - "loc": { - "start": { - "line": 38, - "column": 32 - }, - "end": { - "line": 38, - "column": 39 - } - }, + "start":754,"end":761,"loc":{"start":{"line":38,"column":32},"end":{"line":38,"column":39}}, "object": { "type": "ThisExpression", - "start": 754, - "end": 758, - "loc": { - "start": { - "line": 38, - "column": 32 - }, - "end": { - "line": 38, - "column": 36 - } - } + "start":754,"end":758,"loc":{"start":{"line":38,"column":32},"end":{"line":38,"column":36}} }, "property": { "type": "PrivateName", - "start": 759, - "end": 761, - "loc": { - "start": { - "line": 38, - "column": 37 - }, - "end": { - "line": 38, - "column": 39 - } - }, + "start":759,"end":761,"loc":{"start":{"line":38,"column":37},"end":{"line":38,"column":39}}, "id": { "type": "Identifier", - "start": 760, - "end": 761, - "loc": { - "start": { - "line": 38, - "column": 38 - }, - "end": { - "line": 38, - "column": 39 - }, - "identifierName": "x" - }, + "start":760,"end":761,"loc":{"start":{"line":38,"column":38},"end":{"line":38,"column":39},"identifierName":"x"}, "name": "x" } }, @@ -3861,62 +1255,17 @@ }, { "type": "MemberExpression", - "start": 767, - "end": 774, - "loc": { - "start": { - "line": 38, - "column": 45 - }, - "end": { - "line": 38, - "column": 52 - } - }, + "start":767,"end":774,"loc":{"start":{"line":38,"column":45},"end":{"line":38,"column":52}}, "object": { "type": "ThisExpression", - "start": 767, - "end": 771, - "loc": { - "start": { - "line": 38, - "column": 45 - }, - "end": { - "line": 38, - "column": 49 - } - } + "start":767,"end":771,"loc":{"start":{"line":38,"column":45},"end":{"line":38,"column":49}} }, "property": { "type": "PrivateName", - "start": 772, - "end": 774, - "loc": { - "start": { - "line": 38, - "column": 50 - }, - "end": { - "line": 38, - "column": 52 - } - }, + "start":772,"end":774,"loc":{"start":{"line":38,"column":50},"end":{"line":38,"column":52}}, "id": { "type": "Identifier", - "start": 773, - "end": 774, - "loc": { - "start": { - "line": 38, - "column": 51 - }, - "end": { - "line": 38, - "column": 52 - }, - "identifierName": "y" - }, + "start":773,"end":774,"loc":{"start":{"line":38,"column":51},"end":{"line":38,"column":52},"identifierName":"y"}, "name": "y" } }, @@ -3926,18 +1275,7 @@ "quasis": [ { "type": "TemplateElement", - "start": 745, - "end": 751, - "loc": { - "start": { - "line": 38, - "column": 23 - }, - "end": { - "line": 38, - "column": 29 - } - }, + "start":745,"end":751,"loc":{"start":{"line":38,"column":23},"end":{"line":38,"column":29}}, "value": { "raw": "Point<", "cooked": "Point<" @@ -3946,18 +1284,7 @@ }, { "type": "TemplateElement", - "start": 763, - "end": 764, - "loc": { - "start": { - "line": 38, - "column": 41 - }, - "end": { - "line": 38, - "column": 42 - } - }, + "start":763,"end":764,"loc":{"start":{"line":38,"column":41},"end":{"line":38,"column":42}}, "value": { "raw": ",", "cooked": "," @@ -3966,18 +1293,7 @@ }, { "type": "TemplateElement", - "start": 776, - "end": 777, - "loc": { - "start": { - "line": 38, - "column": 54 - }, - "end": { - "line": 38, - "column": 55 - } - }, + "start":776,"end":777,"loc":{"start":{"line":38,"column":54},"end":{"line":38,"column":55}}, "value": { "raw": ">", "cooked": ">" diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-properties/pbn-success/output.json b/packages/babel-parser/test/fixtures/experimental/class-private-properties/pbn-success/output.json index 23703cf19b25..31ce19c94ef4 100644 --- a/packages/babel-parser/test/fixtures/experimental/class-private-properties/pbn-success/output.json +++ b/packages/babel-parser/test/fixtures/experimental/class-private-properties/pbn-success/output.json @@ -1,142 +1,41 @@ { "type": "File", - "start": 0, - "end": 359, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 19, - "column": 1 - } - }, + "start":0,"end":359,"loc":{"start":{"line":1,"column":0},"end":{"line":19,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 359, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 19, - "column": 1 - } - }, + "start":0,"end":359,"loc":{"start":{"line":1,"column":0},"end":{"line":19,"column":1}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 359, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 19, - "column": 1 - } - }, + "start":0,"end":359,"loc":{"start":{"line":1,"column":0},"end":{"line":19,"column":1}}, "id": { "type": "Identifier", - "start": 6, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "Point" - }, + "start":6,"end":11,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":11},"identifierName":"Point"}, "name": "Point" }, "superClass": null, "body": { "type": "ClassBody", - "start": 12, - "end": 359, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 19, - "column": 1 - } - }, + "start":12,"end":359,"loc":{"start":{"line":1,"column":12},"end":{"line":19,"column":1}}, "body": [ { "type": "ClassPrivateProperty", - "start": 16, - "end": 23, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 9 - } - }, + "start":16,"end":23,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":9}}, "static": false, "key": { "type": "PrivateName", - "start": 16, - "end": 18, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 4 - } - }, + "start":16,"end":18,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":4}}, "id": { "type": "Identifier", - "start": 17, - "end": 18, - "loc": { - "start": { - "line": 2, - "column": 3 - }, - "end": { - "line": 2, - "column": 4 - }, - "identifierName": "x" - }, + "start":17,"end":18,"loc":{"start":{"line":2,"column":3},"end":{"line":2,"column":4},"identifierName":"x"}, "name": "x" } }, "value": { "type": "NumericLiteral", - "start": 21, - "end": 22, - "loc": { - "start": { - "line": 2, - "column": 7 - }, - "end": { - "line": 2, - "column": 8 - } - }, + "start":21,"end":22,"loc":{"start":{"line":2,"column":7},"end":{"line":2,"column":8}}, "extra": { "rawValue": 1, "raw": "1" @@ -146,65 +45,20 @@ }, { "type": "ClassPrivateProperty", - "start": 26, - "end": 33, - "loc": { - "start": { - "line": 3, - "column": 2 - }, - "end": { - "line": 3, - "column": 9 - } - }, + "start":26,"end":33,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":9}}, "static": false, "key": { "type": "PrivateName", - "start": 26, - "end": 28, - "loc": { - "start": { - "line": 3, - "column": 2 - }, - "end": { - "line": 3, - "column": 4 - } - }, + "start":26,"end":28,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":4}}, "id": { "type": "Identifier", - "start": 27, - "end": 28, - "loc": { - "start": { - "line": 3, - "column": 3 - }, - "end": { - "line": 3, - "column": 4 - }, - "identifierName": "y" - }, + "start":27,"end":28,"loc":{"start":{"line":3,"column":3},"end":{"line":3,"column":4},"identifierName":"y"}, "name": "y" } }, "value": { "type": "NumericLiteral", - "start": 31, - "end": 32, - "loc": { - "start": { - "line": 3, - "column": 7 - }, - "end": { - "line": 3, - "column": 8 - } - }, + "start":31,"end":32,"loc":{"start":{"line":3,"column":7},"end":{"line":3,"column":8}}, "extra": { "rawValue": 2, "raw": "2" @@ -214,34 +68,11 @@ }, { "type": "ClassMethod", - "start": 37, - "end": 104, - "loc": { - "start": { - "line": 5, - "column": 2 - }, - "end": { - "line": 8, - "column": 3 - } - }, + "start":37,"end":104,"loc":{"start":{"line":5,"column":2},"end":{"line":8,"column":3}}, "static": false, "key": { "type": "Identifier", - "start": 37, - "end": 48, - "loc": { - "start": { - "line": 5, - "column": 2 - }, - "end": { - "line": 5, - "column": 13 - }, - "identifierName": "constructor" - }, + "start":37,"end":48,"loc":{"start":{"line":5,"column":2},"end":{"line":5,"column":13},"identifierName":"constructor"}, "name": "constructor" }, "computed": false, @@ -252,49 +83,15 @@ "params": [ { "type": "AssignmentPattern", - "start": 49, - "end": 54, - "loc": { - "start": { - "line": 5, - "column": 14 - }, - "end": { - "line": 5, - "column": 19 - } - }, + "start":49,"end":54,"loc":{"start":{"line":5,"column":14},"end":{"line":5,"column":19}}, "left": { "type": "Identifier", - "start": 49, - "end": 50, - "loc": { - "start": { - "line": 5, - "column": 14 - }, - "end": { - "line": 5, - "column": 15 - }, - "identifierName": "x" - }, + "start":49,"end":50,"loc":{"start":{"line":5,"column":14},"end":{"line":5,"column":15},"identifierName":"x"}, "name": "x" }, "right": { "type": "NumericLiteral", - "start": 53, - "end": 54, - "loc": { - "start": { - "line": 5, - "column": 18 - }, - "end": { - "line": 5, - "column": 19 - } - }, + "start":53,"end":54,"loc":{"start":{"line":5,"column":18},"end":{"line":5,"column":19}}, "extra": { "rawValue": 0, "raw": "0" @@ -304,49 +101,15 @@ }, { "type": "AssignmentPattern", - "start": 56, - "end": 61, - "loc": { - "start": { - "line": 5, - "column": 21 - }, - "end": { - "line": 5, - "column": 26 - } - }, + "start":56,"end":61,"loc":{"start":{"line":5,"column":21},"end":{"line":5,"column":26}}, "left": { "type": "Identifier", - "start": 56, - "end": 57, - "loc": { - "start": { - "line": 5, - "column": 21 - }, - "end": { - "line": 5, - "column": 22 - }, - "identifierName": "y" - }, + "start":56,"end":57,"loc":{"start":{"line":5,"column":21},"end":{"line":5,"column":22},"identifierName":"y"}, "name": "y" }, "right": { "type": "NumericLiteral", - "start": 60, - "end": 61, - "loc": { - "start": { - "line": 5, - "column": 25 - }, - "end": { - "line": 5, - "column": 26 - } - }, + "start":60,"end":61,"loc":{"start":{"line":5,"column":25},"end":{"line":5,"column":26}}, "extra": { "rawValue": 0, "raw": "0" @@ -357,106 +120,28 @@ ], "body": { "type": "BlockStatement", - "start": 63, - "end": 104, - "loc": { - "start": { - "line": 5, - "column": 28 - }, - "end": { - "line": 8, - "column": 3 - } - }, + "start":63,"end":104,"loc":{"start":{"line":5,"column":28},"end":{"line":8,"column":3}}, "body": [ { "type": "ExpressionStatement", - "start": 69, - "end": 82, - "loc": { - "start": { - "line": 6, - "column": 4 - }, - "end": { - "line": 6, - "column": 17 - } - }, + "start":69,"end":82,"loc":{"start":{"line":6,"column":4},"end":{"line":6,"column":17}}, "expression": { "type": "AssignmentExpression", - "start": 69, - "end": 81, - "loc": { - "start": { - "line": 6, - "column": 4 - }, - "end": { - "line": 6, - "column": 16 - } - }, + "start":69,"end":81,"loc":{"start":{"line":6,"column":4},"end":{"line":6,"column":16}}, "operator": "=", "left": { "type": "MemberExpression", - "start": 69, - "end": 76, - "loc": { - "start": { - "line": 6, - "column": 4 - }, - "end": { - "line": 6, - "column": 11 - } - }, + "start":69,"end":76,"loc":{"start":{"line":6,"column":4},"end":{"line":6,"column":11}}, "object": { "type": "ThisExpression", - "start": 69, - "end": 73, - "loc": { - "start": { - "line": 6, - "column": 4 - }, - "end": { - "line": 6, - "column": 8 - } - } + "start":69,"end":73,"loc":{"start":{"line":6,"column":4},"end":{"line":6,"column":8}} }, "property": { "type": "PrivateName", - "start": 74, - "end": 76, - "loc": { - "start": { - "line": 6, - "column": 9 - }, - "end": { - "line": 6, - "column": 11 - } - }, + "start":74,"end":76,"loc":{"start":{"line":6,"column":9},"end":{"line":6,"column":11}}, "id": { "type": "Identifier", - "start": 75, - "end": 76, - "loc": { - "start": { - "line": 6, - "column": 10 - }, - "end": { - "line": 6, - "column": 11 - }, - "identifierName": "x" - }, + "start":75,"end":76,"loc":{"start":{"line":6,"column":10},"end":{"line":6,"column":11},"identifierName":"x"}, "name": "x" } }, @@ -464,35 +149,12 @@ }, "right": { "type": "UnaryExpression", - "start": 79, - "end": 81, - "loc": { - "start": { - "line": 6, - "column": 14 - }, - "end": { - "line": 6, - "column": 16 - } - }, + "start":79,"end":81,"loc":{"start":{"line":6,"column":14},"end":{"line":6,"column":16}}, "operator": "+", "prefix": true, "argument": { "type": "Identifier", - "start": 80, - "end": 81, - "loc": { - "start": { - "line": 6, - "column": 15 - }, - "end": { - "line": 6, - "column": 16 - }, - "identifierName": "x" - }, + "start":80,"end":81,"loc":{"start":{"line":6,"column":15},"end":{"line":6,"column":16},"identifierName":"x"}, "name": "x" } } @@ -500,91 +162,24 @@ }, { "type": "ExpressionStatement", - "start": 87, - "end": 100, - "loc": { - "start": { - "line": 7, - "column": 4 - }, - "end": { - "line": 7, - "column": 17 - } - }, + "start":87,"end":100,"loc":{"start":{"line":7,"column":4},"end":{"line":7,"column":17}}, "expression": { "type": "AssignmentExpression", - "start": 87, - "end": 99, - "loc": { - "start": { - "line": 7, - "column": 4 - }, - "end": { - "line": 7, - "column": 16 - } - }, + "start":87,"end":99,"loc":{"start":{"line":7,"column":4},"end":{"line":7,"column":16}}, "operator": "=", "left": { "type": "MemberExpression", - "start": 87, - "end": 94, - "loc": { - "start": { - "line": 7, - "column": 4 - }, - "end": { - "line": 7, - "column": 11 - } - }, + "start":87,"end":94,"loc":{"start":{"line":7,"column":4},"end":{"line":7,"column":11}}, "object": { "type": "ThisExpression", - "start": 87, - "end": 91, - "loc": { - "start": { - "line": 7, - "column": 4 - }, - "end": { - "line": 7, - "column": 8 - } - } + "start":87,"end":91,"loc":{"start":{"line":7,"column":4},"end":{"line":7,"column":8}} }, "property": { "type": "PrivateName", - "start": 92, - "end": 94, - "loc": { - "start": { - "line": 7, - "column": 9 - }, - "end": { - "line": 7, - "column": 11 - } - }, + "start":92,"end":94,"loc":{"start":{"line":7,"column":9},"end":{"line":7,"column":11}}, "id": { "type": "Identifier", - "start": 93, - "end": 94, - "loc": { - "start": { - "line": 7, - "column": 10 - }, - "end": { - "line": 7, - "column": 11 - }, - "identifierName": "y" - }, + "start":93,"end":94,"loc":{"start":{"line":7,"column":10},"end":{"line":7,"column":11},"identifierName":"y"}, "name": "y" } }, @@ -592,35 +187,12 @@ }, "right": { "type": "UnaryExpression", - "start": 97, - "end": 99, - "loc": { - "start": { - "line": 7, - "column": 14 - }, - "end": { - "line": 7, - "column": 16 - } - }, + "start":97,"end":99,"loc":{"start":{"line":7,"column":14},"end":{"line":7,"column":16}}, "operator": "+", "prefix": true, "argument": { "type": "Identifier", - "start": 98, - "end": 99, - "loc": { - "start": { - "line": 7, - "column": 15 - }, - "end": { - "line": 7, - "column": 16 - }, - "identifierName": "y" - }, + "start":98,"end":99,"loc":{"start":{"line":7,"column":15},"end":{"line":7,"column":16},"identifierName":"y"}, "name": "y" } } @@ -632,34 +204,11 @@ }, { "type": "ClassMethod", - "start": 108, - "end": 134, - "loc": { - "start": { - "line": 10, - "column": 2 - }, - "end": { - "line": 10, - "column": 28 - } - }, + "start":108,"end":134,"loc":{"start":{"line":10,"column":2},"end":{"line":10,"column":28}}, "static": false, "key": { "type": "Identifier", - "start": 112, - "end": 113, - "loc": { - "start": { - "line": 10, - "column": 6 - }, - "end": { - "line": 10, - "column": 7 - }, - "identifierName": "x" - }, + "start":112,"end":113,"loc":{"start":{"line":10,"column":6},"end":{"line":10,"column":7},"identifierName":"x"}, "name": "x" }, "computed": false, @@ -670,91 +219,24 @@ "params": [], "body": { "type": "BlockStatement", - "start": 116, - "end": 134, - "loc": { - "start": { - "line": 10, - "column": 10 - }, - "end": { - "line": 10, - "column": 28 - } - }, + "start":116,"end":134,"loc":{"start":{"line":10,"column":10},"end":{"line":10,"column":28}}, "body": [ { "type": "ReturnStatement", - "start": 118, - "end": 132, - "loc": { - "start": { - "line": 10, - "column": 12 - }, - "end": { - "line": 10, - "column": 26 - } - }, + "start":118,"end":132,"loc":{"start":{"line":10,"column":12},"end":{"line":10,"column":26}}, "argument": { "type": "MemberExpression", - "start": 125, - "end": 132, - "loc": { - "start": { - "line": 10, - "column": 19 - }, - "end": { - "line": 10, - "column": 26 - } - }, + "start":125,"end":132,"loc":{"start":{"line":10,"column":19},"end":{"line":10,"column":26}}, "object": { "type": "ThisExpression", - "start": 125, - "end": 129, - "loc": { - "start": { - "line": 10, - "column": 19 - }, - "end": { - "line": 10, - "column": 23 - } - } + "start":125,"end":129,"loc":{"start":{"line":10,"column":19},"end":{"line":10,"column":23}} }, "property": { "type": "PrivateName", - "start": 130, - "end": 132, - "loc": { - "start": { - "line": 10, - "column": 24 - }, - "end": { - "line": 10, - "column": 26 - } - }, + "start":130,"end":132,"loc":{"start":{"line":10,"column":24},"end":{"line":10,"column":26}}, "id": { "type": "Identifier", - "start": 131, - "end": 132, - "loc": { - "start": { - "line": 10, - "column": 25 - }, - "end": { - "line": 10, - "column": 26 - }, - "identifierName": "x" - }, + "start":131,"end":132,"loc":{"start":{"line":10,"column":25},"end":{"line":10,"column":26},"identifierName":"x"}, "name": "x" } }, @@ -767,34 +249,11 @@ }, { "type": "ClassMethod", - "start": 137, - "end": 170, - "loc": { - "start": { - "line": 11, - "column": 2 - }, - "end": { - "line": 11, - "column": 35 - } - }, + "start":137,"end":170,"loc":{"start":{"line":11,"column":2},"end":{"line":11,"column":35}}, "static": false, "key": { "type": "Identifier", - "start": 141, - "end": 142, - "loc": { - "start": { - "line": 11, - "column": 6 - }, - "end": { - "line": 11, - "column": 7 - }, - "identifierName": "x" - }, + "start":141,"end":142,"loc":{"start":{"line":11,"column":6},"end":{"line":11,"column":7},"identifierName":"x"}, "name": "x" }, "computed": false, @@ -805,124 +264,34 @@ "params": [ { "type": "Identifier", - "start": 143, - "end": 148, - "loc": { - "start": { - "line": 11, - "column": 8 - }, - "end": { - "line": 11, - "column": 13 - }, - "identifierName": "value" - }, + "start":143,"end":148,"loc":{"start":{"line":11,"column":8},"end":{"line":11,"column":13},"identifierName":"value"}, "name": "value" } ], "body": { "type": "BlockStatement", - "start": 150, - "end": 170, - "loc": { - "start": { - "line": 11, - "column": 15 - }, - "end": { - "line": 11, - "column": 35 - } - }, + "start":150,"end":170,"loc":{"start":{"line":11,"column":15},"end":{"line":11,"column":35}}, "body": [ { "type": "ExpressionStatement", - "start": 152, - "end": 168, - "loc": { - "start": { - "line": 11, - "column": 17 - }, - "end": { - "line": 11, - "column": 33 - } - }, + "start":152,"end":168,"loc":{"start":{"line":11,"column":17},"end":{"line":11,"column":33}}, "expression": { "type": "AssignmentExpression", - "start": 152, - "end": 168, - "loc": { - "start": { - "line": 11, - "column": 17 - }, - "end": { - "line": 11, - "column": 33 - } - }, + "start":152,"end":168,"loc":{"start":{"line":11,"column":17},"end":{"line":11,"column":33}}, "operator": "=", "left": { "type": "MemberExpression", - "start": 152, - "end": 159, - "loc": { - "start": { - "line": 11, - "column": 17 - }, - "end": { - "line": 11, - "column": 24 - } - }, + "start":152,"end":159,"loc":{"start":{"line":11,"column":17},"end":{"line":11,"column":24}}, "object": { "type": "ThisExpression", - "start": 152, - "end": 156, - "loc": { - "start": { - "line": 11, - "column": 17 - }, - "end": { - "line": 11, - "column": 21 - } - } + "start":152,"end":156,"loc":{"start":{"line":11,"column":17},"end":{"line":11,"column":21}} }, "property": { "type": "PrivateName", - "start": 157, - "end": 159, - "loc": { - "start": { - "line": 11, - "column": 22 - }, - "end": { - "line": 11, - "column": 24 - } - }, + "start":157,"end":159,"loc":{"start":{"line":11,"column":22},"end":{"line":11,"column":24}}, "id": { "type": "Identifier", - "start": 158, - "end": 159, - "loc": { - "start": { - "line": 11, - "column": 23 - }, - "end": { - "line": 11, - "column": 24 - }, - "identifierName": "x" - }, + "start":158,"end":159,"loc":{"start":{"line":11,"column":23},"end":{"line":11,"column":24},"identifierName":"x"}, "name": "x" } }, @@ -930,35 +299,12 @@ }, "right": { "type": "UnaryExpression", - "start": 162, - "end": 168, - "loc": { - "start": { - "line": 11, - "column": 27 - }, - "end": { - "line": 11, - "column": 33 - } - }, + "start":162,"end":168,"loc":{"start":{"line":11,"column":27},"end":{"line":11,"column":33}}, "operator": "+", "prefix": true, "argument": { "type": "Identifier", - "start": 163, - "end": 168, - "loc": { - "start": { - "line": 11, - "column": 28 - }, - "end": { - "line": 11, - "column": 33 - }, - "identifierName": "value" - }, + "start":163,"end":168,"loc":{"start":{"line":11,"column":28},"end":{"line":11,"column":33},"identifierName":"value"}, "name": "value" } } @@ -970,34 +316,11 @@ }, { "type": "ClassMethod", - "start": 174, - "end": 200, - "loc": { - "start": { - "line": 13, - "column": 2 - }, - "end": { - "line": 13, - "column": 28 - } - }, + "start":174,"end":200,"loc":{"start":{"line":13,"column":2},"end":{"line":13,"column":28}}, "static": false, "key": { "type": "Identifier", - "start": 178, - "end": 179, - "loc": { - "start": { - "line": 13, - "column": 6 - }, - "end": { - "line": 13, - "column": 7 - }, - "identifierName": "y" - }, + "start":178,"end":179,"loc":{"start":{"line":13,"column":6},"end":{"line":13,"column":7},"identifierName":"y"}, "name": "y" }, "computed": false, @@ -1008,91 +331,24 @@ "params": [], "body": { "type": "BlockStatement", - "start": 182, - "end": 200, - "loc": { - "start": { - "line": 13, - "column": 10 - }, - "end": { - "line": 13, - "column": 28 - } - }, + "start":182,"end":200,"loc":{"start":{"line":13,"column":10},"end":{"line":13,"column":28}}, "body": [ { "type": "ReturnStatement", - "start": 184, - "end": 198, - "loc": { - "start": { - "line": 13, - "column": 12 - }, - "end": { - "line": 13, - "column": 26 - } - }, + "start":184,"end":198,"loc":{"start":{"line":13,"column":12},"end":{"line":13,"column":26}}, "argument": { "type": "MemberExpression", - "start": 191, - "end": 198, - "loc": { - "start": { - "line": 13, - "column": 19 - }, - "end": { - "line": 13, - "column": 26 - } - }, + "start":191,"end":198,"loc":{"start":{"line":13,"column":19},"end":{"line":13,"column":26}}, "object": { "type": "ThisExpression", - "start": 191, - "end": 195, - "loc": { - "start": { - "line": 13, - "column": 19 - }, - "end": { - "line": 13, - "column": 23 - } - } + "start":191,"end":195,"loc":{"start":{"line":13,"column":19},"end":{"line":13,"column":23}} }, "property": { "type": "PrivateName", - "start": 196, - "end": 198, - "loc": { - "start": { - "line": 13, - "column": 24 - }, - "end": { - "line": 13, - "column": 26 - } - }, + "start":196,"end":198,"loc":{"start":{"line":13,"column":24},"end":{"line":13,"column":26}}, "id": { "type": "Identifier", - "start": 197, - "end": 198, - "loc": { - "start": { - "line": 13, - "column": 25 - }, - "end": { - "line": 13, - "column": 26 - }, - "identifierName": "y" - }, + "start":197,"end":198,"loc":{"start":{"line":13,"column":25},"end":{"line":13,"column":26},"identifierName":"y"}, "name": "y" } }, @@ -1105,34 +361,11 @@ }, { "type": "ClassMethod", - "start": 203, - "end": 236, - "loc": { - "start": { - "line": 14, - "column": 2 - }, - "end": { - "line": 14, - "column": 35 - } - }, + "start":203,"end":236,"loc":{"start":{"line":14,"column":2},"end":{"line":14,"column":35}}, "static": false, "key": { "type": "Identifier", - "start": 207, - "end": 208, - "loc": { - "start": { - "line": 14, - "column": 6 - }, - "end": { - "line": 14, - "column": 7 - }, - "identifierName": "y" - }, + "start":207,"end":208,"loc":{"start":{"line":14,"column":6},"end":{"line":14,"column":7},"identifierName":"y"}, "name": "y" }, "computed": false, @@ -1143,124 +376,34 @@ "params": [ { "type": "Identifier", - "start": 209, - "end": 214, - "loc": { - "start": { - "line": 14, - "column": 8 - }, - "end": { - "line": 14, - "column": 13 - }, - "identifierName": "value" - }, + "start":209,"end":214,"loc":{"start":{"line":14,"column":8},"end":{"line":14,"column":13},"identifierName":"value"}, "name": "value" } ], "body": { "type": "BlockStatement", - "start": 216, - "end": 236, - "loc": { - "start": { - "line": 14, - "column": 15 - }, - "end": { - "line": 14, - "column": 35 - } - }, + "start":216,"end":236,"loc":{"start":{"line":14,"column":15},"end":{"line":14,"column":35}}, "body": [ { "type": "ExpressionStatement", - "start": 218, - "end": 234, - "loc": { - "start": { - "line": 14, - "column": 17 - }, - "end": { - "line": 14, - "column": 33 - } - }, + "start":218,"end":234,"loc":{"start":{"line":14,"column":17},"end":{"line":14,"column":33}}, "expression": { "type": "AssignmentExpression", - "start": 218, - "end": 234, - "loc": { - "start": { - "line": 14, - "column": 17 - }, - "end": { - "line": 14, - "column": 33 - } - }, + "start":218,"end":234,"loc":{"start":{"line":14,"column":17},"end":{"line":14,"column":33}}, "operator": "=", "left": { "type": "MemberExpression", - "start": 218, - "end": 225, - "loc": { - "start": { - "line": 14, - "column": 17 - }, - "end": { - "line": 14, - "column": 24 - } - }, + "start":218,"end":225,"loc":{"start":{"line":14,"column":17},"end":{"line":14,"column":24}}, "object": { "type": "ThisExpression", - "start": 218, - "end": 222, - "loc": { - "start": { - "line": 14, - "column": 17 - }, - "end": { - "line": 14, - "column": 21 - } - } + "start":218,"end":222,"loc":{"start":{"line":14,"column":17},"end":{"line":14,"column":21}} }, "property": { "type": "PrivateName", - "start": 223, - "end": 225, - "loc": { - "start": { - "line": 14, - "column": 22 - }, - "end": { - "line": 14, - "column": 24 - } - }, + "start":223,"end":225,"loc":{"start":{"line":14,"column":22},"end":{"line":14,"column":24}}, "id": { "type": "Identifier", - "start": 224, - "end": 225, - "loc": { - "start": { - "line": 14, - "column": 23 - }, - "end": { - "line": 14, - "column": 24 - }, - "identifierName": "y" - }, + "start":224,"end":225,"loc":{"start":{"line":14,"column":23},"end":{"line":14,"column":24},"identifierName":"y"}, "name": "y" } }, @@ -1268,35 +411,12 @@ }, "right": { "type": "UnaryExpression", - "start": 228, - "end": 234, - "loc": { - "start": { - "line": 14, - "column": 27 - }, - "end": { - "line": 14, - "column": 33 - } - }, + "start":228,"end":234,"loc":{"start":{"line":14,"column":27},"end":{"line":14,"column":33}}, "operator": "+", "prefix": true, "argument": { "type": "Identifier", - "start": 229, - "end": 234, - "loc": { - "start": { - "line": 14, - "column": 28 - }, - "end": { - "line": 14, - "column": 33 - }, - "identifierName": "value" - }, + "start":229,"end":234,"loc":{"start":{"line":14,"column":28},"end":{"line":14,"column":33},"identifierName":"value"}, "name": "value" } } @@ -1308,34 +428,11 @@ }, { "type": "ClassMethod", - "start": 240, - "end": 297, - "loc": { - "start": { - "line": 16, - "column": 2 - }, - "end": { - "line": 16, - "column": 59 - } - }, + "start":240,"end":297,"loc":{"start":{"line":16,"column":2},"end":{"line":16,"column":59}}, "static": false, "key": { "type": "Identifier", - "start": 240, - "end": 246, - "loc": { - "start": { - "line": 16, - "column": 2 - }, - "end": { - "line": 16, - "column": 8 - }, - "identifierName": "equals" - }, + "start":240,"end":246,"loc":{"start":{"line":16,"column":2},"end":{"line":16,"column":8},"identifierName":"equals"}, "name": "equals" }, "computed": false, @@ -1346,137 +443,36 @@ "params": [ { "type": "Identifier", - "start": 247, - "end": 248, - "loc": { - "start": { - "line": 16, - "column": 9 - }, - "end": { - "line": 16, - "column": 10 - }, - "identifierName": "p" - }, + "start":247,"end":248,"loc":{"start":{"line":16,"column":9},"end":{"line":16,"column":10},"identifierName":"p"}, "name": "p" } ], "body": { "type": "BlockStatement", - "start": 250, - "end": 297, - "loc": { - "start": { - "line": 16, - "column": 12 - }, - "end": { - "line": 16, - "column": 59 - } - }, + "start":250,"end":297,"loc":{"start":{"line":16,"column":12},"end":{"line":16,"column":59}}, "body": [ { "type": "ReturnStatement", - "start": 252, - "end": 295, - "loc": { - "start": { - "line": 16, - "column": 14 - }, - "end": { - "line": 16, - "column": 57 - } - }, + "start":252,"end":295,"loc":{"start":{"line":16,"column":14},"end":{"line":16,"column":57}}, "argument": { "type": "LogicalExpression", - "start": 259, - "end": 295, - "loc": { - "start": { - "line": 16, - "column": 21 - }, - "end": { - "line": 16, - "column": 57 - } - }, + "start":259,"end":295,"loc":{"start":{"line":16,"column":21},"end":{"line":16,"column":57}}, "left": { "type": "BinaryExpression", - "start": 259, - "end": 275, - "loc": { - "start": { - "line": 16, - "column": 21 - }, - "end": { - "line": 16, - "column": 37 - } - }, + "start":259,"end":275,"loc":{"start":{"line":16,"column":21},"end":{"line":16,"column":37}}, "left": { "type": "MemberExpression", - "start": 259, - "end": 266, - "loc": { - "start": { - "line": 16, - "column": 21 - }, - "end": { - "line": 16, - "column": 28 - } - }, + "start":259,"end":266,"loc":{"start":{"line":16,"column":21},"end":{"line":16,"column":28}}, "object": { "type": "ThisExpression", - "start": 259, - "end": 263, - "loc": { - "start": { - "line": 16, - "column": 21 - }, - "end": { - "line": 16, - "column": 25 - } - } + "start":259,"end":263,"loc":{"start":{"line":16,"column":21},"end":{"line":16,"column":25}} }, "property": { "type": "PrivateName", - "start": 264, - "end": 266, - "loc": { - "start": { - "line": 16, - "column": 26 - }, - "end": { - "line": 16, - "column": 28 - } - }, + "start":264,"end":266,"loc":{"start":{"line":16,"column":26},"end":{"line":16,"column":28}}, "id": { "type": "Identifier", - "start": 265, - "end": 266, - "loc": { - "start": { - "line": 16, - "column": 27 - }, - "end": { - "line": 16, - "column": 28 - }, - "identifierName": "x" - }, + "start":265,"end":266,"loc":{"start":{"line":16,"column":27},"end":{"line":16,"column":28},"identifierName":"x"}, "name": "x" } }, @@ -1485,64 +481,18 @@ "operator": "===", "right": { "type": "MemberExpression", - "start": 271, - "end": 275, - "loc": { - "start": { - "line": 16, - "column": 33 - }, - "end": { - "line": 16, - "column": 37 - } - }, + "start":271,"end":275,"loc":{"start":{"line":16,"column":33},"end":{"line":16,"column":37}}, "object": { "type": "Identifier", - "start": 271, - "end": 272, - "loc": { - "start": { - "line": 16, - "column": 33 - }, - "end": { - "line": 16, - "column": 34 - }, - "identifierName": "p" - }, + "start":271,"end":272,"loc":{"start":{"line":16,"column":33},"end":{"line":16,"column":34},"identifierName":"p"}, "name": "p" }, "property": { "type": "PrivateName", - "start": 273, - "end": 275, - "loc": { - "start": { - "line": 16, - "column": 35 - }, - "end": { - "line": 16, - "column": 37 - } - }, + "start":273,"end":275,"loc":{"start":{"line":16,"column":35},"end":{"line":16,"column":37}}, "id": { "type": "Identifier", - "start": 274, - "end": 275, - "loc": { - "start": { - "line": 16, - "column": 36 - }, - "end": { - "line": 16, - "column": 37 - }, - "identifierName": "x" - }, + "start":274,"end":275,"loc":{"start":{"line":16,"column":36},"end":{"line":16,"column":37},"identifierName":"x"}, "name": "x" } }, @@ -1552,76 +502,20 @@ "operator": "&&", "right": { "type": "BinaryExpression", - "start": 279, - "end": 295, - "loc": { - "start": { - "line": 16, - "column": 41 - }, - "end": { - "line": 16, - "column": 57 - } - }, + "start":279,"end":295,"loc":{"start":{"line":16,"column":41},"end":{"line":16,"column":57}}, "left": { "type": "MemberExpression", - "start": 279, - "end": 286, - "loc": { - "start": { - "line": 16, - "column": 41 - }, - "end": { - "line": 16, - "column": 48 - } - }, + "start":279,"end":286,"loc":{"start":{"line":16,"column":41},"end":{"line":16,"column":48}}, "object": { "type": "ThisExpression", - "start": 279, - "end": 283, - "loc": { - "start": { - "line": 16, - "column": 41 - }, - "end": { - "line": 16, - "column": 45 - } - } + "start":279,"end":283,"loc":{"start":{"line":16,"column":41},"end":{"line":16,"column":45}} }, "property": { "type": "PrivateName", - "start": 284, - "end": 286, - "loc": { - "start": { - "line": 16, - "column": 46 - }, - "end": { - "line": 16, - "column": 48 - } - }, + "start":284,"end":286,"loc":{"start":{"line":16,"column":46},"end":{"line":16,"column":48}}, "id": { "type": "Identifier", - "start": 285, - "end": 286, - "loc": { - "start": { - "line": 16, - "column": 47 - }, - "end": { - "line": 16, - "column": 48 - }, - "identifierName": "y" - }, + "start":285,"end":286,"loc":{"start":{"line":16,"column":47},"end":{"line":16,"column":48},"identifierName":"y"}, "name": "y" } }, @@ -1630,64 +524,18 @@ "operator": "===", "right": { "type": "MemberExpression", - "start": 291, - "end": 295, - "loc": { - "start": { - "line": 16, - "column": 53 - }, - "end": { - "line": 16, - "column": 57 - } - }, + "start":291,"end":295,"loc":{"start":{"line":16,"column":53},"end":{"line":16,"column":57}}, "object": { "type": "Identifier", - "start": 291, - "end": 292, - "loc": { - "start": { - "line": 16, - "column": 53 - }, - "end": { - "line": 16, - "column": 54 - }, - "identifierName": "p" - }, + "start":291,"end":292,"loc":{"start":{"line":16,"column":53},"end":{"line":16,"column":54},"identifierName":"p"}, "name": "p" }, "property": { "type": "PrivateName", - "start": 293, - "end": 295, - "loc": { - "start": { - "line": 16, - "column": 55 - }, - "end": { - "line": 16, - "column": 57 - } - }, + "start":293,"end":295,"loc":{"start":{"line":16,"column":55},"end":{"line":16,"column":57}}, "id": { "type": "Identifier", - "start": 294, - "end": 295, - "loc": { - "start": { - "line": 16, - "column": 56 - }, - "end": { - "line": 16, - "column": 57 - }, - "identifierName": "y" - }, + "start":294,"end":295,"loc":{"start":{"line":16,"column":56},"end":{"line":16,"column":57},"identifierName":"y"}, "name": "y" } }, @@ -1702,34 +550,11 @@ }, { "type": "ClassMethod", - "start": 301, - "end": 357, - "loc": { - "start": { - "line": 18, - "column": 2 - }, - "end": { - "line": 18, - "column": 58 - } - }, + "start":301,"end":357,"loc":{"start":{"line":18,"column":2},"end":{"line":18,"column":58}}, "static": false, "key": { "type": "Identifier", - "start": 301, - "end": 309, - "loc": { - "start": { - "line": 18, - "column": 2 - }, - "end": { - "line": 18, - "column": 10 - }, - "identifierName": "toString" - }, + "start":301,"end":309,"loc":{"start":{"line":18,"column":2},"end":{"line":18,"column":10},"identifierName":"toString"}, "name": "toString" }, "computed": false, @@ -1740,106 +565,28 @@ "params": [], "body": { "type": "BlockStatement", - "start": 312, - "end": 357, - "loc": { - "start": { - "line": 18, - "column": 13 - }, - "end": { - "line": 18, - "column": 58 - } - }, + "start":312,"end":357,"loc":{"start":{"line":18,"column":13},"end":{"line":18,"column":58}}, "body": [ { "type": "ReturnStatement", - "start": 314, - "end": 355, - "loc": { - "start": { - "line": 18, - "column": 15 - }, - "end": { - "line": 18, - "column": 56 - } - }, + "start":314,"end":355,"loc":{"start":{"line":18,"column":15},"end":{"line":18,"column":56}}, "argument": { "type": "TemplateLiteral", - "start": 321, - "end": 355, - "loc": { - "start": { - "line": 18, - "column": 22 - }, - "end": { - "line": 18, - "column": 56 - } - }, + "start":321,"end":355,"loc":{"start":{"line":18,"column":22},"end":{"line":18,"column":56}}, "expressions": [ { "type": "MemberExpression", - "start": 331, - "end": 338, - "loc": { - "start": { - "line": 18, - "column": 32 - }, - "end": { - "line": 18, - "column": 39 - } - }, + "start":331,"end":338,"loc":{"start":{"line":18,"column":32},"end":{"line":18,"column":39}}, "object": { "type": "ThisExpression", - "start": 331, - "end": 335, - "loc": { - "start": { - "line": 18, - "column": 32 - }, - "end": { - "line": 18, - "column": 36 - } - } + "start":331,"end":335,"loc":{"start":{"line":18,"column":32},"end":{"line":18,"column":36}} }, "property": { "type": "PrivateName", - "start": 336, - "end": 338, - "loc": { - "start": { - "line": 18, - "column": 37 - }, - "end": { - "line": 18, - "column": 39 - } - }, + "start":336,"end":338,"loc":{"start":{"line":18,"column":37},"end":{"line":18,"column":39}}, "id": { "type": "Identifier", - "start": 337, - "end": 338, - "loc": { - "start": { - "line": 18, - "column": 38 - }, - "end": { - "line": 18, - "column": 39 - }, - "identifierName": "x" - }, + "start":337,"end":338,"loc":{"start":{"line":18,"column":38},"end":{"line":18,"column":39},"identifierName":"x"}, "name": "x" } }, @@ -1847,62 +594,17 @@ }, { "type": "MemberExpression", - "start": 344, - "end": 351, - "loc": { - "start": { - "line": 18, - "column": 45 - }, - "end": { - "line": 18, - "column": 52 - } - }, + "start":344,"end":351,"loc":{"start":{"line":18,"column":45},"end":{"line":18,"column":52}}, "object": { "type": "ThisExpression", - "start": 344, - "end": 348, - "loc": { - "start": { - "line": 18, - "column": 45 - }, - "end": { - "line": 18, - "column": 49 - } - } + "start":344,"end":348,"loc":{"start":{"line":18,"column":45},"end":{"line":18,"column":49}} }, "property": { "type": "PrivateName", - "start": 349, - "end": 351, - "loc": { - "start": { - "line": 18, - "column": 50 - }, - "end": { - "line": 18, - "column": 52 - } - }, + "start":349,"end":351,"loc":{"start":{"line":18,"column":50},"end":{"line":18,"column":52}}, "id": { "type": "Identifier", - "start": 350, - "end": 351, - "loc": { - "start": { - "line": 18, - "column": 51 - }, - "end": { - "line": 18, - "column": 52 - }, - "identifierName": "y" - }, + "start":350,"end":351,"loc":{"start":{"line":18,"column":51},"end":{"line":18,"column":52},"identifierName":"y"}, "name": "y" } }, @@ -1912,18 +614,7 @@ "quasis": [ { "type": "TemplateElement", - "start": 322, - "end": 328, - "loc": { - "start": { - "line": 18, - "column": 23 - }, - "end": { - "line": 18, - "column": 29 - } - }, + "start":322,"end":328,"loc":{"start":{"line":18,"column":23},"end":{"line":18,"column":29}}, "value": { "raw": "Point<", "cooked": "Point<" @@ -1932,18 +623,7 @@ }, { "type": "TemplateElement", - "start": 340, - "end": 341, - "loc": { - "start": { - "line": 18, - "column": 41 - }, - "end": { - "line": 18, - "column": 42 - } - }, + "start":340,"end":341,"loc":{"start":{"line":18,"column":41},"end":{"line":18,"column":42}}, "value": { "raw": ",", "cooked": "," @@ -1952,18 +632,7 @@ }, { "type": "TemplateElement", - "start": 353, - "end": 354, - "loc": { - "start": { - "line": 18, - "column": 54 - }, - "end": { - "line": 18, - "column": 55 - } - }, + "start":353,"end":354,"loc":{"start":{"line":18,"column":54},"end":{"line":18,"column":55}}, "value": { "raw": ">", "cooked": ">" diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-properties/static/output.json b/packages/babel-parser/test/fixtures/experimental/class-private-properties/static/output.json index 0d05ba3223fd..824195dc1993 100644 --- a/packages/babel-parser/test/fixtures/experimental/class-private-properties/static/output.json +++ b/packages/babel-parser/test/fixtures/experimental/class-private-properties/static/output.json @@ -1,125 +1,35 @@ { "type": "File", - "start": 0, - "end": 41, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":0,"end":41,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 41, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":0,"end":41,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 41, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":0,"end":41,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, "id": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "A" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, "name": "A" }, "superClass": null, "body": { "type": "ClassBody", - "start": 8, - "end": 41, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":8,"end":41,"loc":{"start":{"line":1,"column":8},"end":{"line":4,"column":1}}, "body": [ { "type": "ClassPrivateProperty", - "start": 12, - "end": 22, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 12 - } - }, + "start":12,"end":22,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":12}}, "static": true, "key": { "type": "PrivateName", - "start": 19, - "end": 21, - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 11 - } - }, + "start":19,"end":21,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":11}}, "id": { "type": "Identifier", - "start": 20, - "end": 21, - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 11 - }, - "identifierName": "x" - }, + "start":20,"end":21,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":11},"identifierName":"x"}, "name": "x" } }, @@ -127,65 +37,20 @@ }, { "type": "ClassPrivateProperty", - "start": 25, - "end": 39, - "loc": { - "start": { - "line": 3, - "column": 2 - }, - "end": { - "line": 3, - "column": 16 - } - }, + "start":25,"end":39,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":16}}, "static": true, "key": { "type": "PrivateName", - "start": 32, - "end": 34, - "loc": { - "start": { - "line": 3, - "column": 9 - }, - "end": { - "line": 3, - "column": 11 - } - }, + "start":32,"end":34,"loc":{"start":{"line":3,"column":9},"end":{"line":3,"column":11}}, "id": { "type": "Identifier", - "start": 33, - "end": 34, - "loc": { - "start": { - "line": 3, - "column": 10 - }, - "end": { - "line": 3, - "column": 11 - }, - "identifierName": "y" - }, + "start":33,"end":34,"loc":{"start":{"line":3,"column":10},"end":{"line":3,"column":11},"identifierName":"y"}, "name": "y" } }, "value": { "type": "NumericLiteral", - "start": 37, - "end": 38, - "loc": { - "start": { - "line": 3, - "column": 14 - }, - "end": { - "line": 3, - "column": 15 - } - }, + "start":37,"end":38,"loc":{"start":{"line":3,"column":14},"end":{"line":3,"column":15}}, "extra": { "rawValue": 1, "raw": "1" diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-properties/super-call/options.json b/packages/babel-parser/test/fixtures/experimental/class-private-properties/super-call/options.json index 2154c844bfd7..f26e916957c8 100644 --- a/packages/babel-parser/test/fixtures/experimental/class-private-properties/super-call/options.json +++ b/packages/babel-parser/test/fixtures/experimental/class-private-properties/super-call/options.json @@ -1,4 +1,3 @@ { - "plugins": ["classPrivateProperties"], - "throws": "super() is only valid inside a class constructor of a subclass. Maybe a typo in the method name ('constructor') or not extending another class? (4:13)" + "plugins": ["classPrivateProperties"] } diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-properties/super-call/output.json b/packages/babel-parser/test/fixtures/experimental/class-private-properties/super-call/output.json new file mode 100644 index 000000000000..8010b9a5b411 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-properties/super-call/output.json @@ -0,0 +1,102 @@ +{ + "type": "File", + "start":0,"end":95,"loc":{"start":{"line":1,"column":0},"end":{"line":7,"column":1}}, + "errors": [ + "SyntaxError: super() is only valid inside a class constructor of a subclass. Maybe a typo in the method name ('constructor') or not extending another class? (4:13)" + ], + "program": { + "type": "Program", + "start":0,"end":95,"loc":{"start":{"line":1,"column":0},"end":{"line":7,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start":0,"end":95,"loc":{"start":{"line":1,"column":0},"end":{"line":7,"column":1}}, + "id": { + "type": "Identifier", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, + "name": "A" + }, + "superClass": { + "type": "Identifier", + "start":16,"end":17,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":17},"identifierName":"B"}, + "name": "B" + }, + "body": { + "type": "ClassBody", + "start":18,"end":95,"loc":{"start":{"line":1,"column":18},"end":{"line":7,"column":1}}, + "body": [ + { + "type": "ClassMethod", + "start":22,"end":93,"loc":{"start":{"line":2,"column":2},"end":{"line":6,"column":3}}, + "static": false, + "key": { + "type": "Identifier", + "start":22,"end":33,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":13},"identifierName":"constructor"}, + "name": "constructor" + }, + "computed": false, + "kind": "constructor", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":36,"end":93,"loc":{"start":{"line":2,"column":16},"end":{"line":6,"column":3}}, + "body": [ + { + "type": "ClassDeclaration", + "start":42,"end":89,"loc":{"start":{"line":3,"column":4},"end":{"line":5,"column":5}}, + "id": { + "type": "Identifier", + "start":48,"end":49,"loc":{"start":{"line":3,"column":10},"end":{"line":3,"column":11},"identifierName":"C"}, + "name": "C" + }, + "superClass": { + "type": "Identifier", + "start":58,"end":59,"loc":{"start":{"line":3,"column":20},"end":{"line":3,"column":21},"identifierName":"D"}, + "name": "D" + }, + "body": { + "type": "ClassBody", + "start":60,"end":89,"loc":{"start":{"line":3,"column":22},"end":{"line":5,"column":5}}, + "body": [ + { + "type": "ClassPrivateProperty", + "start":68,"end":83,"loc":{"start":{"line":4,"column":6},"end":{"line":4,"column":21}}, + "static": false, + "key": { + "type": "PrivateName", + "start":68,"end":72,"loc":{"start":{"line":4,"column":6},"end":{"line":4,"column":10}}, + "id": { + "type": "Identifier", + "start":69,"end":72,"loc":{"start":{"line":4,"column":7},"end":{"line":4,"column":10},"identifierName":"foo"}, + "name": "foo" + } + }, + "value": { + "type": "CallExpression", + "start":75,"end":82,"loc":{"start":{"line":4,"column":13},"end":{"line":4,"column":20}}, + "callee": { + "type": "Super", + "start":75,"end":80,"loc":{"start":{"line":4,"column":13},"end":{"line":4,"column":18}} + }, + "arguments": [] + } + } + ] + } + } + ], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-properties/super-private-member-access/input.js b/packages/babel-parser/test/fixtures/experimental/class-private-properties/super-private-member-access/input.js new file mode 100644 index 000000000000..5cd2ffd252f7 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-properties/super-private-member-access/input.js @@ -0,0 +1,7 @@ +class A extends B { + #x; + + method() { + super.#x; + } +} diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-properties/super-private-member-access/options.json b/packages/babel-parser/test/fixtures/experimental/class-private-properties/super-private-member-access/options.json new file mode 100644 index 000000000000..f26e916957c8 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-properties/super-private-member-access/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["classPrivateProperties"] +} diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-properties/super-private-member-access/output.json b/packages/babel-parser/test/fixtures/experimental/class-private-properties/super-private-member-access/output.json new file mode 100644 index 000000000000..e1645e9fd57e --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-properties/super-private-member-access/output.json @@ -0,0 +1,96 @@ +{ + "type": "File", + "start":0,"end":59,"loc":{"start":{"line":1,"column":0},"end":{"line":7,"column":1}}, + "errors": [ + "SyntaxError: Private fields can't be accessed on super (5:4)" + ], + "program": { + "type": "Program", + "start":0,"end":59,"loc":{"start":{"line":1,"column":0},"end":{"line":7,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start":0,"end":59,"loc":{"start":{"line":1,"column":0},"end":{"line":7,"column":1}}, + "id": { + "type": "Identifier", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, + "name": "A" + }, + "superClass": { + "type": "Identifier", + "start":16,"end":17,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":17},"identifierName":"B"}, + "name": "B" + }, + "body": { + "type": "ClassBody", + "start":18,"end":59,"loc":{"start":{"line":1,"column":18},"end":{"line":7,"column":1}}, + "body": [ + { + "type": "ClassPrivateProperty", + "start":22,"end":25,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":5}}, + "static": false, + "key": { + "type": "PrivateName", + "start":22,"end":24,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":4}}, + "id": { + "type": "Identifier", + "start":23,"end":24,"loc":{"start":{"line":2,"column":3},"end":{"line":2,"column":4},"identifierName":"x"}, + "name": "x" + } + }, + "value": null + }, + { + "type": "ClassMethod", + "start":29,"end":57,"loc":{"start":{"line":4,"column":2},"end":{"line":6,"column":3}}, + "static": false, + "key": { + "type": "Identifier", + "start":29,"end":35,"loc":{"start":{"line":4,"column":2},"end":{"line":4,"column":8},"identifierName":"method"}, + "name": "method" + }, + "computed": false, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":38,"end":57,"loc":{"start":{"line":4,"column":11},"end":{"line":6,"column":3}}, + "body": [ + { + "type": "ExpressionStatement", + "start":44,"end":53,"loc":{"start":{"line":5,"column":4},"end":{"line":5,"column":13}}, + "expression": { + "type": "MemberExpression", + "start":44,"end":52,"loc":{"start":{"line":5,"column":4},"end":{"line":5,"column":12}}, + "object": { + "type": "Super", + "start":44,"end":49,"loc":{"start":{"line":5,"column":4},"end":{"line":5,"column":9}} + }, + "property": { + "type": "PrivateName", + "start":50,"end":52,"loc":{"start":{"line":5,"column":10},"end":{"line":5,"column":12}}, + "id": { + "type": "Identifier", + "start":51,"end":52,"loc":{"start":{"line":5,"column":11},"end":{"line":5,"column":12},"identifierName":"x"}, + "name": "x" + } + }, + "computed": false + } + } + ], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-properties/undeclared-nested/input.js b/packages/babel-parser/test/fixtures/experimental/class-private-properties/undeclared-nested/input.js new file mode 100644 index 000000000000..3177068d7eb0 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-properties/undeclared-nested/input.js @@ -0,0 +1,6 @@ +class A { + #x; + meth() { + var prop = foo.#priv; + } +} diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-properties/undeclared-nested/options.json b/packages/babel-parser/test/fixtures/experimental/class-private-properties/undeclared-nested/options.json new file mode 100644 index 000000000000..1ca5069a3a2f --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-properties/undeclared-nested/options.json @@ -0,0 +1,5 @@ +{ + "plugins": [ + "classPrivateProperties" + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-properties/undeclared-nested/output.json b/packages/babel-parser/test/fixtures/experimental/class-private-properties/undeclared-nested/output.json new file mode 100644 index 000000000000..72c04ef4fff9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-properties/undeclared-nested/output.json @@ -0,0 +1,105 @@ +{ + "type": "File", + "start":0,"end":58,"loc":{"start":{"line":1,"column":0},"end":{"line":6,"column":1}}, + "errors": [ + "SyntaxError: Private name #priv is not defined (4:19)" + ], + "program": { + "type": "Program", + "start":0,"end":58,"loc":{"start":{"line":1,"column":0},"end":{"line":6,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start":0,"end":58,"loc":{"start":{"line":1,"column":0},"end":{"line":6,"column":1}}, + "id": { + "type": "Identifier", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":8,"end":58,"loc":{"start":{"line":1,"column":8},"end":{"line":6,"column":1}}, + "body": [ + { + "type": "ClassPrivateProperty", + "start":12,"end":15,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":5}}, + "static": false, + "key": { + "type": "PrivateName", + "start":12,"end":14,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":4}}, + "id": { + "type": "Identifier", + "start":13,"end":14,"loc":{"start":{"line":2,"column":3},"end":{"line":2,"column":4},"identifierName":"x"}, + "name": "x" + } + }, + "value": null + }, + { + "type": "ClassMethod", + "start":18,"end":56,"loc":{"start":{"line":3,"column":2},"end":{"line":5,"column":3}}, + "static": false, + "key": { + "type": "Identifier", + "start":18,"end":22,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":6},"identifierName":"meth"}, + "name": "meth" + }, + "computed": false, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":25,"end":56,"loc":{"start":{"line":3,"column":9},"end":{"line":5,"column":3}}, + "body": [ + { + "type": "VariableDeclaration", + "start":31,"end":52,"loc":{"start":{"line":4,"column":4},"end":{"line":4,"column":25}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":35,"end":51,"loc":{"start":{"line":4,"column":8},"end":{"line":4,"column":24}}, + "id": { + "type": "Identifier", + "start":35,"end":39,"loc":{"start":{"line":4,"column":8},"end":{"line":4,"column":12},"identifierName":"prop"}, + "name": "prop" + }, + "init": { + "type": "MemberExpression", + "start":42,"end":51,"loc":{"start":{"line":4,"column":15},"end":{"line":4,"column":24}}, + "object": { + "type": "Identifier", + "start":42,"end":45,"loc":{"start":{"line":4,"column":15},"end":{"line":4,"column":18},"identifierName":"foo"}, + "name": "foo" + }, + "property": { + "type": "PrivateName", + "start":46,"end":51,"loc":{"start":{"line":4,"column":19},"end":{"line":4,"column":24}}, + "id": { + "type": "Identifier", + "start":47,"end":51,"loc":{"start":{"line":4,"column":20},"end":{"line":4,"column":24},"identifierName":"priv"}, + "name": "priv" + } + }, + "computed": false + } + } + ], + "kind": "var" + } + ], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-properties/undeclared-top-level/input.js b/packages/babel-parser/test/fixtures/experimental/class-private-properties/undeclared-top-level/input.js new file mode 100644 index 000000000000..10607b89b6db --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-properties/undeclared-top-level/input.js @@ -0,0 +1 @@ +var prop = foo.#priv; \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-properties/undeclared-top-level/options.json b/packages/babel-parser/test/fixtures/experimental/class-private-properties/undeclared-top-level/options.json new file mode 100644 index 000000000000..1ca5069a3a2f --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-properties/undeclared-top-level/options.json @@ -0,0 +1,5 @@ +{ + "plugins": [ + "classPrivateProperties" + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-properties/undeclared-top-level/output.json b/packages/babel-parser/test/fixtures/experimental/class-private-properties/undeclared-top-level/output.json new file mode 100644 index 000000000000..6cc1bce62569 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-properties/undeclared-top-level/output.json @@ -0,0 +1,51 @@ +{ + "type": "File", + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, + "errors": [ + "SyntaxError: Private name #priv is not defined (1:15)" + ], + "program": { + "type": "Program", + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":4,"end":20,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":20}}, + "id": { + "type": "Identifier", + "start":4,"end":8,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":8},"identifierName":"prop"}, + "name": "prop" + }, + "init": { + "type": "MemberExpression", + "start":11,"end":20,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":20}}, + "object": { + "type": "Identifier", + "start":11,"end":14,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":14},"identifierName":"foo"}, + "name": "foo" + }, + "property": { + "type": "PrivateName", + "start":15,"end":20,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":20}}, + "id": { + "type": "Identifier", + "start":16,"end":20,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":20},"identifierName":"priv"}, + "name": "priv" + } + }, + "computed": false + } + } + ], + "kind": "var" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-properties/arguments-in-arrow-function/options.json b/packages/babel-parser/test/fixtures/experimental/class-properties/arguments-in-arrow-function/options.json index a567b19a72cb..9c27576d4ad0 100644 --- a/packages/babel-parser/test/fixtures/experimental/class-properties/arguments-in-arrow-function/options.json +++ b/packages/babel-parser/test/fixtures/experimental/class-properties/arguments-in-arrow-function/options.json @@ -1,4 +1,3 @@ { - "plugins": ["classProperties"], - "throws": "'arguments' is not allowed in class field initializer (3:16)" + "plugins": ["classProperties"] } diff --git a/packages/babel-parser/test/fixtures/experimental/class-properties/arguments-in-arrow-function/output.json b/packages/babel-parser/test/fixtures/experimental/class-properties/arguments-in-arrow-function/output.json new file mode 100644 index 000000000000..17dd38b5c5b0 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-properties/arguments-in-arrow-function/output.json @@ -0,0 +1,75 @@ +{ + "type": "File", + "start":0,"end":60,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, + "errors": [ + "SyntaxError: 'arguments' is not allowed in class field initializer (3:16)" + ], + "program": { + "type": "Program", + "start":0,"end":60,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":60,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, + "id": { + "type": "Identifier", + "start":9,"end":11,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":11},"identifierName":"fn"}, + "name": "fn" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":14,"end":60,"loc":{"start":{"line":1,"column":14},"end":{"line":5,"column":1}}, + "body": [ + { + "type": "ClassDeclaration", + "start":18,"end":58,"loc":{"start":{"line":2,"column":2},"end":{"line":4,"column":3}}, + "id": { + "type": "Identifier", + "start":24,"end":25,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":9},"identifierName":"A"}, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":26,"end":58,"loc":{"start":{"line":2,"column":10},"end":{"line":4,"column":3}}, + "body": [ + { + "type": "ClassProperty", + "start":32,"end":54,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":26}}, + "static": false, + "key": { + "type": "Identifier", + "start":32,"end":35,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":7},"identifierName":"foo"}, + "name": "foo" + }, + "computed": false, + "value": { + "type": "ArrowFunctionExpression", + "start":38,"end":53,"loc":{"start":{"line":3,"column":10},"end":{"line":3,"column":25}}, + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "Identifier", + "start":44,"end":53,"loc":{"start":{"line":3,"column":16},"end":{"line":3,"column":25},"identifierName":"arguments"}, + "name": "arguments" + } + } + } + ] + } + } + ], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-properties/arguments-in-function/output.json b/packages/babel-parser/test/fixtures/experimental/class-properties/arguments-in-function/output.json index b368a372254e..80d1655ddfd8 100644 --- a/packages/babel-parser/test/fixtures/experimental/class-properties/arguments-in-function/output.json +++ b/packages/babel-parser/test/fixtures/experimental/class-properties/arguments-in-function/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 71, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 1 - } - }, + "start":0,"end":71,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 71, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 1 - } - }, + "start":0,"end":71,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 71, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 1 - } - }, + "start":0,"end":71,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, "id": { "type": "Identifier", - "start": 9, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "fn" - }, + "start":9,"end":11,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":11},"identifierName":"fn"}, "name": "fn" }, "generator": false, @@ -65,128 +20,37 @@ "params": [], "body": { "type": "BlockStatement", - "start": 14, - "end": 71, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 5, - "column": 1 - } - }, + "start":14,"end":71,"loc":{"start":{"line":1,"column":14},"end":{"line":5,"column":1}}, "body": [ { "type": "ClassDeclaration", - "start": 18, - "end": 69, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 4, - "column": 3 - } - }, + "start":18,"end":69,"loc":{"start":{"line":2,"column":2},"end":{"line":4,"column":3}}, "id": { "type": "Identifier", - "start": 24, - "end": 25, - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 9 - }, - "identifierName": "A" - }, + "start":24,"end":25,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":9},"identifierName":"A"}, "name": "A" }, "superClass": null, "body": { "type": "ClassBody", - "start": 26, - "end": 69, - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 4, - "column": 3 - } - }, + "start":26,"end":69,"loc":{"start":{"line":2,"column":10},"end":{"line":4,"column":3}}, "body": [ { "type": "ClassProperty", - "start": 32, - "end": 65, - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 37 - } - }, + "start":32,"end":65,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":37}}, "static": false, "key": { "type": "Identifier", - "start": 32, - "end": 35, - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 7 - }, - "identifierName": "foo" - }, + "start":32,"end":35,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":7},"identifierName":"foo"}, "name": "foo" }, "computed": false, "value": { "type": "FunctionExpression", - "start": 38, - "end": 64, - "loc": { - "start": { - "line": 3, - "column": 10 - }, - "end": { - "line": 3, - "column": 36 - } - }, + "start":38,"end":64,"loc":{"start":{"line":3,"column":10},"end":{"line":3,"column":36}}, "id": { "type": "Identifier", - "start": 47, - "end": 48, - "loc": { - "start": { - "line": 3, - "column": 19 - }, - "end": { - "line": 3, - "column": 20 - }, - "identifierName": "f" - }, + "start":47,"end":48,"loc":{"start":{"line":3,"column":19},"end":{"line":3,"column":20},"identifierName":"f"}, "name": "f" }, "generator": false, @@ -194,48 +58,14 @@ "params": [], "body": { "type": "BlockStatement", - "start": 51, - "end": 64, - "loc": { - "start": { - "line": 3, - "column": 23 - }, - "end": { - "line": 3, - "column": 36 - } - }, + "start":51,"end":64,"loc":{"start":{"line":3,"column":23},"end":{"line":3,"column":36}}, "body": [ { "type": "ExpressionStatement", - "start": 53, - "end": 62, - "loc": { - "start": { - "line": 3, - "column": 25 - }, - "end": { - "line": 3, - "column": 34 - } - }, + "start":53,"end":62,"loc":{"start":{"line":3,"column":25},"end":{"line":3,"column":34}}, "expression": { "type": "Identifier", - "start": 53, - "end": 62, - "loc": { - "start": { - "line": 3, - "column": 25 - }, - "end": { - "line": 3, - "column": 34 - }, - "identifierName": "arguments" - }, + "start":53,"end":62,"loc":{"start":{"line":3,"column":25},"end":{"line":3,"column":34},"identifierName":"arguments"}, "name": "arguments" } } diff --git a/packages/babel-parser/test/fixtures/experimental/class-properties/arguments-in-key/output.json b/packages/babel-parser/test/fixtures/experimental/class-properties/arguments-in-key/output.json index 1478f40e097d..a1c8be9580e2 100644 --- a/packages/babel-parser/test/fixtures/experimental/class-properties/arguments-in-key/output.json +++ b/packages/babel-parser/test/fixtures/experimental/class-properties/arguments-in-key/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 54, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 1 - } - }, + "start":0,"end":54,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 54, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 1 - } - }, + "start":0,"end":54,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 54, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 1 - } - }, + "start":0,"end":54,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, "id": { "type": "Identifier", - "start": 9, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "fn" - }, + "start":9,"end":11,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":11},"identifierName":"fn"}, "name": "fn" }, "generator": false, @@ -65,113 +20,34 @@ "params": [], "body": { "type": "BlockStatement", - "start": 14, - "end": 54, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 5, - "column": 1 - } - }, + "start":14,"end":54,"loc":{"start":{"line":1,"column":14},"end":{"line":5,"column":1}}, "body": [ { "type": "ClassDeclaration", - "start": 18, - "end": 52, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 4, - "column": 3 - } - }, + "start":18,"end":52,"loc":{"start":{"line":2,"column":2},"end":{"line":4,"column":3}}, "id": { "type": "Identifier", - "start": 24, - "end": 25, - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 9 - }, - "identifierName": "A" - }, + "start":24,"end":25,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":9},"identifierName":"A"}, "name": "A" }, "superClass": null, "body": { "type": "ClassBody", - "start": 26, - "end": 52, - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 4, - "column": 3 - } - }, + "start":26,"end":52,"loc":{"start":{"line":2,"column":10},"end":{"line":4,"column":3}}, "body": [ { "type": "ClassProperty", - "start": 32, - "end": 48, - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 20 - } - }, + "start":32,"end":48,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":20}}, "static": false, "computed": true, "key": { "type": "Identifier", - "start": 33, - "end": 42, - "loc": { - "start": { - "line": 3, - "column": 5 - }, - "end": { - "line": 3, - "column": 14 - }, - "identifierName": "arguments" - }, + "start":33,"end":42,"loc":{"start":{"line":3,"column":5},"end":{"line":3,"column":14},"identifierName":"arguments"}, "name": "arguments" }, "value": { "type": "NumericLiteral", - "start": 46, - "end": 47, - "loc": { - "start": { - "line": 3, - "column": 18 - }, - "end": { - "line": 3, - "column": 19 - } - }, + "start":46,"end":47,"loc":{"start":{"line":3,"column":18},"end":{"line":3,"column":19}}, "extra": { "rawValue": 2, "raw": "2" diff --git a/packages/babel-parser/test/fixtures/experimental/class-properties/arguments-in-nested-class-decorator-call-expression/input.js b/packages/babel-parser/test/fixtures/experimental/class-properties/arguments-in-nested-class-decorator-call-expression/input.js new file mode 100644 index 000000000000..4594b01a45b6 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-properties/arguments-in-nested-class-decorator-call-expression/input.js @@ -0,0 +1,5 @@ +function fn() { + class A { + foo = class B { @bar(arguments) foo }; + } +} diff --git a/packages/babel-parser/test/fixtures/experimental/class-properties/arguments-in-nested-class-decorator-call-expression/options.json b/packages/babel-parser/test/fixtures/experimental/class-properties/arguments-in-nested-class-decorator-call-expression/options.json new file mode 100644 index 000000000000..4ee4c944603d --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-properties/arguments-in-nested-class-decorator-call-expression/options.json @@ -0,0 +1,6 @@ +{ + "plugins": [ + "classProperties", + ["decorators", { "decoratorsBeforeExport": false }] + ] +} diff --git a/packages/babel-parser/test/fixtures/experimental/class-properties/arguments-in-nested-class-decorator-call-expression/output.json b/packages/babel-parser/test/fixtures/experimental/class-properties/arguments-in-nested-class-decorator-call-expression/output.json new file mode 100644 index 000000000000..226c11bd0fe2 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-properties/arguments-in-nested-class-decorator-call-expression/output.json @@ -0,0 +1,112 @@ +{ + "type": "File", + "start":0,"end":76,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, + "errors": [ + "SyntaxError: 'arguments' is not allowed in class field initializer (3:25)" + ], + "program": { + "type": "Program", + "start":0,"end":76,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":76,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, + "id": { + "type": "Identifier", + "start":9,"end":11,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":11},"identifierName":"fn"}, + "name": "fn" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":14,"end":76,"loc":{"start":{"line":1,"column":14},"end":{"line":5,"column":1}}, + "body": [ + { + "type": "ClassDeclaration", + "start":18,"end":74,"loc":{"start":{"line":2,"column":2},"end":{"line":4,"column":3}}, + "id": { + "type": "Identifier", + "start":24,"end":25,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":9},"identifierName":"A"}, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":26,"end":74,"loc":{"start":{"line":2,"column":10},"end":{"line":4,"column":3}}, + "body": [ + { + "type": "ClassProperty", + "start":32,"end":70,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":42}}, + "static": false, + "key": { + "type": "Identifier", + "start":32,"end":35,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":7},"identifierName":"foo"}, + "name": "foo" + }, + "computed": false, + "value": { + "type": "ClassExpression", + "start":38,"end":69,"loc":{"start":{"line":3,"column":10},"end":{"line":3,"column":41}}, + "id": { + "type": "Identifier", + "start":44,"end":45,"loc":{"start":{"line":3,"column":16},"end":{"line":3,"column":17},"identifierName":"B"}, + "name": "B" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":46,"end":69,"loc":{"start":{"line":3,"column":18},"end":{"line":3,"column":41}}, + "body": [ + { + "type": "ClassProperty", + "start":48,"end":67,"loc":{"start":{"line":3,"column":20},"end":{"line":3,"column":39}}, + "decorators": [ + { + "type": "Decorator", + "start":48,"end":63,"loc":{"start":{"line":3,"column":20},"end":{"line":3,"column":35}}, + "expression": { + "type": "CallExpression", + "start":49,"end":63,"loc":{"start":{"line":3,"column":21},"end":{"line":3,"column":35}}, + "callee": { + "type": "Identifier", + "start":49,"end":52,"loc":{"start":{"line":3,"column":21},"end":{"line":3,"column":24},"identifierName":"bar"}, + "name": "bar" + }, + "arguments": [ + { + "type": "Identifier", + "start":53,"end":62,"loc":{"start":{"line":3,"column":25},"end":{"line":3,"column":34},"identifierName":"arguments"}, + "name": "arguments" + } + ] + } + } + ], + "static": false, + "key": { + "type": "Identifier", + "start":64,"end":67,"loc":{"start":{"line":3,"column":36},"end":{"line":3,"column":39},"identifierName":"foo"}, + "name": "foo" + }, + "computed": false, + "value": null + } + ] + } + } + } + ] + } + } + ], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-properties/arguments-in-nested-class/input.js b/packages/babel-parser/test/fixtures/experimental/class-properties/arguments-in-nested-class/input.js new file mode 100644 index 000000000000..5bcc6b3ee5fa --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-properties/arguments-in-nested-class/input.js @@ -0,0 +1,5 @@ +function fn() { + class A { + foo = class B { bar() { arguments } }; + } +} diff --git a/packages/babel-parser/test/fixtures/experimental/class-properties/arguments-in-nested-class/options.json b/packages/babel-parser/test/fixtures/experimental/class-properties/arguments-in-nested-class/options.json new file mode 100644 index 000000000000..9c27576d4ad0 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-properties/arguments-in-nested-class/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["classProperties"] +} diff --git a/packages/babel-parser/test/fixtures/experimental/class-properties/arguments-in-nested-class/output.json b/packages/babel-parser/test/fixtures/experimental/class-properties/arguments-in-nested-class/output.json new file mode 100644 index 000000000000..c119e2e0c73c --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-properties/arguments-in-nested-class/output.json @@ -0,0 +1,107 @@ +{ + "type": "File", + "start":0,"end":76,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, + "program": { + "type": "Program", + "start":0,"end":76,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":76,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, + "id": { + "type": "Identifier", + "start":9,"end":11,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":11},"identifierName":"fn"}, + "name": "fn" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":14,"end":76,"loc":{"start":{"line":1,"column":14},"end":{"line":5,"column":1}}, + "body": [ + { + "type": "ClassDeclaration", + "start":18,"end":74,"loc":{"start":{"line":2,"column":2},"end":{"line":4,"column":3}}, + "id": { + "type": "Identifier", + "start":24,"end":25,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":9},"identifierName":"A"}, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":26,"end":74,"loc":{"start":{"line":2,"column":10},"end":{"line":4,"column":3}}, + "body": [ + { + "type": "ClassProperty", + "start":32,"end":70,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":42}}, + "static": false, + "key": { + "type": "Identifier", + "start":32,"end":35,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":7},"identifierName":"foo"}, + "name": "foo" + }, + "computed": false, + "value": { + "type": "ClassExpression", + "start":38,"end":69,"loc":{"start":{"line":3,"column":10},"end":{"line":3,"column":41}}, + "id": { + "type": "Identifier", + "start":44,"end":45,"loc":{"start":{"line":3,"column":16},"end":{"line":3,"column":17},"identifierName":"B"}, + "name": "B" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":46,"end":69,"loc":{"start":{"line":3,"column":18},"end":{"line":3,"column":41}}, + "body": [ + { + "type": "ClassMethod", + "start":48,"end":67,"loc":{"start":{"line":3,"column":20},"end":{"line":3,"column":39}}, + "static": false, + "key": { + "type": "Identifier", + "start":48,"end":51,"loc":{"start":{"line":3,"column":20},"end":{"line":3,"column":23},"identifierName":"bar"}, + "name": "bar" + }, + "computed": false, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":54,"end":67,"loc":{"start":{"line":3,"column":26},"end":{"line":3,"column":39}}, + "body": [ + { + "type": "ExpressionStatement", + "start":56,"end":65,"loc":{"start":{"line":3,"column":28},"end":{"line":3,"column":37}}, + "expression": { + "type": "Identifier", + "start":56,"end":65,"loc":{"start":{"line":3,"column":28},"end":{"line":3,"column":37},"identifierName":"arguments"}, + "name": "arguments" + } + } + ], + "directives": [] + } + } + ] + } + } + } + ] + } + } + ], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-properties/arguments/options.json b/packages/babel-parser/test/fixtures/experimental/class-properties/arguments/options.json index e79a44db0bef..9c27576d4ad0 100644 --- a/packages/babel-parser/test/fixtures/experimental/class-properties/arguments/options.json +++ b/packages/babel-parser/test/fixtures/experimental/class-properties/arguments/options.json @@ -1,4 +1,3 @@ { - "plugins": ["classProperties"], - "throws": "'arguments' is not allowed in class field initializer (3:10)" + "plugins": ["classProperties"] } diff --git a/packages/babel-parser/test/fixtures/experimental/class-properties/arguments/output.json b/packages/babel-parser/test/fixtures/experimental/class-properties/arguments/output.json new file mode 100644 index 000000000000..ffd15aa2c2b3 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-properties/arguments/output.json @@ -0,0 +1,67 @@ +{ + "type": "File", + "start":0,"end":54,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, + "errors": [ + "SyntaxError: 'arguments' is not allowed in class field initializer (3:10)" + ], + "program": { + "type": "Program", + "start":0,"end":54,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":54,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, + "id": { + "type": "Identifier", + "start":9,"end":11,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":11},"identifierName":"fn"}, + "name": "fn" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":14,"end":54,"loc":{"start":{"line":1,"column":14},"end":{"line":5,"column":1}}, + "body": [ + { + "type": "ClassDeclaration", + "start":18,"end":52,"loc":{"start":{"line":2,"column":2},"end":{"line":4,"column":3}}, + "id": { + "type": "Identifier", + "start":24,"end":25,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":9},"identifierName":"A"}, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":26,"end":52,"loc":{"start":{"line":2,"column":10},"end":{"line":4,"column":3}}, + "body": [ + { + "type": "ClassProperty", + "start":32,"end":48,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":20}}, + "static": false, + "key": { + "type": "Identifier", + "start":32,"end":35,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":7},"identifierName":"foo"}, + "name": "foo" + }, + "computed": false, + "value": { + "type": "Identifier", + "start":38,"end":47,"loc":{"start":{"line":3,"column":10},"end":{"line":3,"column":19},"identifierName":"arguments"}, + "name": "arguments" + } + } + ] + } + } + ], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-properties/asi-success/output.json b/packages/babel-parser/test/fixtures/experimental/class-properties/asi-success/output.json index 1b75f5865de8..0491fc9e8991 100644 --- a/packages/babel-parser/test/fixtures/experimental/class-properties/asi-success/output.json +++ b/packages/babel-parser/test/fixtures/experimental/class-properties/asi-success/output.json @@ -1,111 +1,32 @@ { "type": "File", - "start": 0, - "end": 53, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 9, - "column": 1 - } - }, + "start":0,"end":53,"loc":{"start":{"line":1,"column":0},"end":{"line":9,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 53, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 9, - "column": 1 - } - }, + "start":0,"end":53,"loc":{"start":{"line":1,"column":0},"end":{"line":9,"column":1}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, "id": { "type": "Identifier", - "start": 6, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "Foo" - }, + "start":6,"end":9,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":9},"identifierName":"Foo"}, "name": "Foo" }, "superClass": null, "body": { "type": "ClassBody", - "start": 10, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":10,"end":21,"loc":{"start":{"line":1,"column":10},"end":{"line":4,"column":1}}, "body": [ { "type": "ClassProperty", - "start": 14, - "end": 15, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 3 - } - }, + "start":14,"end":15,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":3}}, "static": false, "key": { "type": "Identifier", - "start": 14, - "end": 15, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 3 - }, - "identifierName": "x" - }, + "start":14,"end":15,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":3},"identifierName":"x"}, "name": "x" }, "computed": false, @@ -113,34 +34,11 @@ }, { "type": "ClassProperty", - "start": 18, - "end": 19, - "loc": { - "start": { - "line": 3, - "column": 2 - }, - "end": { - "line": 3, - "column": 3 - } - }, + "start":18,"end":19,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":3}}, "static": false, "key": { "type": "Identifier", - "start": 18, - "end": 19, - "loc": { - "start": { - "line": 3, - "column": 2 - }, - "end": { - "line": 3, - "column": 3 - }, - "identifierName": "y" - }, + "start":18,"end":19,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":3},"identifierName":"y"}, "name": "y" }, "computed": false, @@ -151,81 +49,24 @@ }, { "type": "ClassDeclaration", - "start": 23, - "end": 53, - "loc": { - "start": { - "line": 6, - "column": 0 - }, - "end": { - "line": 9, - "column": 1 - } - }, + "start":23,"end":53,"loc":{"start":{"line":6,"column":0},"end":{"line":9,"column":1}}, "id": { "type": "Identifier", - "start": 29, - "end": 33, - "loc": { - "start": { - "line": 6, - "column": 6 - }, - "end": { - "line": 6, - "column": 10 - }, - "identifierName": "Foo2" - }, + "start":29,"end":33,"loc":{"start":{"line":6,"column":6},"end":{"line":6,"column":10},"identifierName":"Foo2"}, "name": "Foo2" }, "superClass": null, "body": { "type": "ClassBody", - "start": 34, - "end": 53, - "loc": { - "start": { - "line": 6, - "column": 11 - }, - "end": { - "line": 9, - "column": 1 - } - }, + "start":34,"end":53,"loc":{"start":{"line":6,"column":11},"end":{"line":9,"column":1}}, "body": [ { "type": "ClassProperty", - "start": 38, - "end": 39, - "loc": { - "start": { - "line": 7, - "column": 2 - }, - "end": { - "line": 7, - "column": 3 - } - }, + "start":38,"end":39,"loc":{"start":{"line":7,"column":2},"end":{"line":7,"column":3}}, "static": false, "key": { "type": "Identifier", - "start": 38, - "end": 39, - "loc": { - "start": { - "line": 7, - "column": 2 - }, - "end": { - "line": 7, - "column": 3 - }, - "identifierName": "p" - }, + "start":38,"end":39,"loc":{"start":{"line":7,"column":2},"end":{"line":7,"column":3},"identifierName":"p"}, "name": "p" }, "computed": false, @@ -233,35 +74,12 @@ }, { "type": "ClassMethod", - "start": 42, - "end": 51, - "loc": { - "start": { - "line": 8, - "column": 2 - }, - "end": { - "line": 8, - "column": 11 - } - }, + "start":42,"end":51,"loc":{"start":{"line":8,"column":2},"end":{"line":8,"column":11}}, "static": false, "computed": true, "key": { "type": "Identifier", - "start": 43, - "end": 44, - "loc": { - "start": { - "line": 8, - "column": 3 - }, - "end": { - "line": 8, - "column": 4 - }, - "identifierName": "m" - }, + "start":43,"end":44,"loc":{"start":{"line":8,"column":3},"end":{"line":8,"column":4},"identifierName":"m"}, "name": "m" }, "kind": "method", @@ -271,18 +89,7 @@ "params": [], "body": { "type": "BlockStatement", - "start": 49, - "end": 51, - "loc": { - "start": { - "line": 8, - "column": 9 - }, - "end": { - "line": 8, - "column": 11 - } - }, + "start":49,"end":51,"loc":{"start":{"line":8,"column":9},"end":{"line":8,"column":11}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/experimental/class-properties/await-in-async-in-class-property/input.js b/packages/babel-parser/test/fixtures/experimental/class-properties/await-in-async-in-class-property/input.js new file mode 100644 index 000000000000..388ae60d9f00 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-properties/await-in-async-in-class-property/input.js @@ -0,0 +1,3 @@ +class C { + p = async () => await + 42; +} diff --git a/packages/babel-parser/test/fixtures/experimental/class-properties/await-in-async-in-class-property/options.json b/packages/babel-parser/test/fixtures/experimental/class-properties/await-in-async-in-class-property/options.json new file mode 100644 index 000000000000..9c27576d4ad0 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-properties/await-in-async-in-class-property/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["classProperties"] +} diff --git a/packages/babel-parser/test/fixtures/experimental/class-properties/await-in-async-in-class-property/output.json b/packages/babel-parser/test/fixtures/experimental/class-properties/await-in-async-in-class-property/output.json new file mode 100644 index 000000000000..b065c96cb131 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-properties/await-in-async-in-class-property/output.json @@ -0,0 +1,67 @@ +{ + "type": "File", + "start":0,"end":41,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "program": { + "type": "Program", + "start":0,"end":41,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start":0,"end":41,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "id": { + "type": "Identifier", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"C"}, + "name": "C" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":8,"end":41,"loc":{"start":{"line":1,"column":8},"end":{"line":3,"column":1}}, + "body": [ + { + "type": "ClassProperty", + "start":12,"end":39,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":29}}, + "static": false, + "key": { + "type": "Identifier", + "start":12,"end":13,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":3},"identifierName":"p"}, + "name": "p" + }, + "computed": false, + "value": { + "type": "ArrowFunctionExpression", + "start":16,"end":38,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":28}}, + "id": null, + "generator": false, + "async": true, + "params": [], + "body": { + "type": "AwaitExpression", + "start":28,"end":38,"loc":{"start":{"line":2,"column":18},"end":{"line":2,"column":28}}, + "argument": { + "type": "UnaryExpression", + "start":34,"end":38,"loc":{"start":{"line":2,"column":24},"end":{"line":2,"column":28}}, + "operator": "+", + "prefix": true, + "argument": { + "type": "NumericLiteral", + "start":36,"end":38,"loc":{"start":{"line":2,"column":26},"end":{"line":2,"column":28}}, + "extra": { + "rawValue": 42, + "raw": "42" + }, + "value": 42 + } + } + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-properties/await-in-class-property-in-async/input.js b/packages/babel-parser/test/fixtures/experimental/class-properties/await-in-class-property-in-async/input.js new file mode 100644 index 000000000000..84a94bd55ed8 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-properties/await-in-class-property-in-async/input.js @@ -0,0 +1,6 @@ +async () => { + class C { + // here await is an identifier reference + p = await + 42; + } +} diff --git a/packages/babel-parser/test/fixtures/experimental/class-properties/await-in-class-property-in-async/options.json b/packages/babel-parser/test/fixtures/experimental/class-properties/await-in-class-property-in-async/options.json new file mode 100644 index 000000000000..9c27576d4ad0 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-properties/await-in-class-property-in-async/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["classProperties"] +} diff --git a/packages/babel-parser/test/fixtures/experimental/class-properties/await-in-class-property-in-async/output.json b/packages/babel-parser/test/fixtures/experimental/class-properties/await-in-class-property-in-async/output.json new file mode 100644 index 000000000000..c58d4a6533da --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-properties/await-in-class-property-in-async/output.json @@ -0,0 +1,92 @@ +{ + "type": "File", + "start":0,"end":96,"loc":{"start":{"line":1,"column":0},"end":{"line":6,"column":1}}, + "program": { + "type": "Program", + "start":0,"end":96,"loc":{"start":{"line":1,"column":0},"end":{"line":6,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":96,"loc":{"start":{"line":1,"column":0},"end":{"line":6,"column":1}}, + "expression": { + "type": "ArrowFunctionExpression", + "start":0,"end":96,"loc":{"start":{"line":1,"column":0},"end":{"line":6,"column":1}}, + "id": null, + "generator": false, + "async": true, + "params": [], + "body": { + "type": "BlockStatement", + "start":12,"end":96,"loc":{"start":{"line":1,"column":12},"end":{"line":6,"column":1}}, + "body": [ + { + "type": "ClassDeclaration", + "start":16,"end":94,"loc":{"start":{"line":2,"column":2},"end":{"line":5,"column":3}}, + "id": { + "type": "Identifier", + "start":22,"end":23,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":9},"identifierName":"C"}, + "name": "C" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":24,"end":94,"loc":{"start":{"line":2,"column":10},"end":{"line":5,"column":3}}, + "body": [ + { + "type": "ClassProperty", + "start":75,"end":90,"loc":{"start":{"line":4,"column":4},"end":{"line":4,"column":19}}, + "static": false, + "key": { + "type": "Identifier", + "start":75,"end":76,"loc":{"start":{"line":4,"column":4},"end":{"line":4,"column":5},"identifierName":"p"}, + "name": "p" + }, + "computed": false, + "value": { + "type": "BinaryExpression", + "start":79,"end":89,"loc":{"start":{"line":4,"column":8},"end":{"line":4,"column":18}}, + "left": { + "type": "Identifier", + "start":79,"end":84,"loc":{"start":{"line":4,"column":8},"end":{"line":4,"column":13},"identifierName":"await"}, + "name": "await" + }, + "operator": "+", + "right": { + "type": "NumericLiteral", + "start":87,"end":89,"loc":{"start":{"line":4,"column":16},"end":{"line":4,"column":18}}, + "extra": { + "rawValue": 42, + "raw": "42" + }, + "value": 42 + } + }, + "leadingComments": [ + { + "type": "CommentLine", + "value": " here await is an identifier reference", + "start":30,"end":70,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":44}} + } + ] + } + ] + } + } + ], + "directives": [] + } + } + } + ], + "directives": [] + }, + "comments": [ + { + "type": "CommentLine", + "value": " here await is an identifier reference", + "start":30,"end":70,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":44}} + } + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-properties/computed/output.json b/packages/babel-parser/test/fixtures/experimental/class-properties/computed/output.json index 40771337a35f..9dcd00dceb49 100644 --- a/packages/babel-parser/test/fixtures/experimental/class-properties/computed/output.json +++ b/packages/babel-parser/test/fixtures/experimental/class-properties/computed/output.json @@ -1,146 +1,45 @@ { "type": "File", - "start": 0, - "end": 61, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 9, - "column": 1 - } - }, + "start":0,"end":61,"loc":{"start":{"line":1,"column":0},"end":{"line":9,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 61, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 9, - "column": 1 - } - }, + "start":0,"end":61,"loc":{"start":{"line":1,"column":0},"end":{"line":9,"column":1}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, "id": { "type": "Identifier", - "start": 6, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "Foo" - }, + "start":6,"end":9,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":9},"identifierName":"Foo"}, "name": "Foo" }, "superClass": null, "body": { "type": "ClassBody", - "start": 10, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":10,"end":27,"loc":{"start":{"line":1,"column":10},"end":{"line":4,"column":1}}, "body": [ { "type": "ClassProperty", - "start": 14, - "end": 17, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 5 - } - }, + "start":14,"end":17,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":5}}, "static": false, "computed": true, "key": { "type": "Identifier", - "start": 15, - "end": 16, - "loc": { - "start": { - "line": 2, - "column": 3 - }, - "end": { - "line": 2, - "column": 4 - }, - "identifierName": "x" - }, + "start":15,"end":16,"loc":{"start":{"line":2,"column":3},"end":{"line":2,"column":4},"identifierName":"x"}, "name": "x" }, "value": null }, { "type": "ClassProperty", - "start": 20, - "end": 25, - "loc": { - "start": { - "line": 3, - "column": 2 - }, - "end": { - "line": 3, - "column": 7 - } - }, + "start":20,"end":25,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":7}}, "static": false, "computed": true, "key": { "type": "StringLiteral", - "start": 21, - "end": 24, - "loc": { - "start": { - "line": 3, - "column": 3 - }, - "end": { - "line": 3, - "column": 6 - } - }, + "start":21,"end":24,"loc":{"start":{"line":3,"column":3},"end":{"line":3,"column":6}}, "extra": { "rawValue": "y", "raw": "'y'" @@ -154,117 +53,37 @@ }, { "type": "ClassDeclaration", - "start": 29, - "end": 61, - "loc": { - "start": { - "line": 6, - "column": 0 - }, - "end": { - "line": 9, - "column": 1 - } - }, + "start":29,"end":61,"loc":{"start":{"line":6,"column":0},"end":{"line":9,"column":1}}, "id": { "type": "Identifier", - "start": 35, - "end": 39, - "loc": { - "start": { - "line": 6, - "column": 6 - }, - "end": { - "line": 6, - "column": 10 - }, - "identifierName": "Foo2" - }, + "start":35,"end":39,"loc":{"start":{"line":6,"column":6},"end":{"line":6,"column":10},"identifierName":"Foo2"}, "name": "Foo2" }, "superClass": null, "body": { "type": "ClassBody", - "start": 40, - "end": 61, - "loc": { - "start": { - "line": 6, - "column": 11 - }, - "end": { - "line": 9, - "column": 1 - } - }, + "start":40,"end":61,"loc":{"start":{"line":6,"column":11},"end":{"line":9,"column":1}}, "body": [ { "type": "ClassProperty", - "start": 44, - "end": 47, - "loc": { - "start": { - "line": 7, - "column": 2 - }, - "end": { - "line": 7, - "column": 5 - } - }, + "start":44,"end":47,"loc":{"start":{"line":7,"column":2},"end":{"line":7,"column":5}}, "static": false, "computed": true, "key": { "type": "Identifier", - "start": 45, - "end": 46, - "loc": { - "start": { - "line": 7, - "column": 3 - }, - "end": { - "line": 7, - "column": 4 - }, - "identifierName": "p" - }, + "start":45,"end":46,"loc":{"start":{"line":7,"column":3},"end":{"line":7,"column":4},"identifierName":"p"}, "name": "p" }, "value": null }, { "type": "ClassMethod", - "start": 50, - "end": 59, - "loc": { - "start": { - "line": 8, - "column": 2 - }, - "end": { - "line": 8, - "column": 11 - } - }, + "start":50,"end":59,"loc":{"start":{"line":8,"column":2},"end":{"line":8,"column":11}}, "static": false, "computed": true, "key": { "type": "Identifier", - "start": 51, - "end": 52, - "loc": { - "start": { - "line": 8, - "column": 3 - }, - "end": { - "line": 8, - "column": 4 - }, - "identifierName": "m" - }, + "start":51,"end":52,"loc":{"start":{"line":8,"column":3},"end":{"line":8,"column":4},"identifierName":"m"}, "name": "m" }, "kind": "method", @@ -274,18 +93,7 @@ "params": [], "body": { "type": "BlockStatement", - "start": 57, - "end": 59, - "loc": { - "start": { - "line": 8, - "column": 9 - }, - "end": { - "line": 8, - "column": 11 - } - }, + "start":57,"end":59,"loc":{"start":{"line":8,"column":9},"end":{"line":8,"column":11}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/experimental/class-properties/edge-cases/output.json b/packages/babel-parser/test/fixtures/experimental/class-properties/edge-cases/output.json index 6a69ac76f332..b73acc4a8d3f 100644 --- a/packages/babel-parser/test/fixtures/experimental/class-properties/edge-cases/output.json +++ b/packages/babel-parser/test/fixtures/experimental/class-properties/edge-cases/output.json @@ -1,111 +1,32 @@ { "type": "File", - "start": 0, - "end": 381, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 50, - "column": 1 - } - }, + "start":0,"end":381,"loc":{"start":{"line":1,"column":0},"end":{"line":50,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 381, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 50, - "column": 1 - } - }, + "start":0,"end":381,"loc":{"start":{"line":1,"column":0},"end":{"line":50,"column":1}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 1 - } - }, + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, "id": { "type": "Identifier", - "start": 6, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 8 - }, - "identifierName": "A1" - }, + "start":6,"end":8,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":8},"identifierName":"A1"}, "name": "A1" }, "superClass": null, "body": { "type": "ClassBody", - "start": 9, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 5, - "column": 1 - } - }, + "start":9,"end":34,"loc":{"start":{"line":1,"column":9},"end":{"line":5,"column":1}}, "body": [ { "type": "ClassProperty", - "start": 13, - "end": 23, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 3, - "column": 3 - } - }, + "start":13,"end":23,"loc":{"start":{"line":2,"column":2},"end":{"line":3,"column":3}}, "static": true, "key": { "type": "Identifier", - "start": 22, - "end": 23, - "loc": { - "start": { - "line": 3, - "column": 2 - }, - "end": { - "line": 3, - "column": 3 - }, - "identifierName": "a" - }, + "start":22,"end":23,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":3},"identifierName":"a"}, "name": "a" }, "computed": false, @@ -113,34 +34,11 @@ }, { "type": "ClassProperty", - "start": 26, - "end": 32, - "loc": { - "start": { - "line": 4, - "column": 2 - }, - "end": { - "line": 4, - "column": 8 - } - }, + "start":26,"end":32,"loc":{"start":{"line":4,"column":2},"end":{"line":4,"column":8}}, "computed": false, "key": { "type": "Identifier", - "start": 26, - "end": 32, - "loc": { - "start": { - "line": 4, - "column": 2 - }, - "end": { - "line": 4, - "column": 8 - }, - "identifierName": "static" - }, + "start":26,"end":32,"loc":{"start":{"line":4,"column":2},"end":{"line":4,"column":8},"identifierName":"static"}, "name": "static" }, "static": false, @@ -151,81 +49,24 @@ }, { "type": "ClassDeclaration", - "start": 36, - "end": 50, - "loc": { - "start": { - "line": 7, - "column": 0 - }, - "end": { - "line": 7, - "column": 14 - } - }, + "start":36,"end":50,"loc":{"start":{"line":7,"column":0},"end":{"line":7,"column":14}}, "id": { "type": "Identifier", - "start": 42, - "end": 44, - "loc": { - "start": { - "line": 7, - "column": 6 - }, - "end": { - "line": 7, - "column": 8 - }, - "identifierName": "A2" - }, + "start":42,"end":44,"loc":{"start":{"line":7,"column":6},"end":{"line":7,"column":8},"identifierName":"A2"}, "name": "A2" }, "superClass": null, "body": { "type": "ClassBody", - "start": 45, - "end": 50, - "loc": { - "start": { - "line": 7, - "column": 9 - }, - "end": { - "line": 7, - "column": 14 - } - }, + "start":45,"end":50,"loc":{"start":{"line":7,"column":9},"end":{"line":7,"column":14}}, "body": [ { "type": "ClassProperty", - "start": 47, - "end": 48, - "loc": { - "start": { - "line": 7, - "column": 11 - }, - "end": { - "line": 7, - "column": 12 - } - }, + "start":47,"end":48,"loc":{"start":{"line":7,"column":11},"end":{"line":7,"column":12}}, "static": false, "key": { "type": "Identifier", - "start": 47, - "end": 48, - "loc": { - "start": { - "line": 7, - "column": 11 - }, - "end": { - "line": 7, - "column": 12 - }, - "identifierName": "a" - }, + "start":47,"end":48,"loc":{"start":{"line":7,"column":11},"end":{"line":7,"column":12},"identifierName":"a"}, "name": "a" }, "computed": false, @@ -236,81 +77,24 @@ }, { "type": "ClassDeclaration", - "start": 51, - "end": 67, - "loc": { - "start": { - "line": 8, - "column": 0 - }, - "end": { - "line": 8, - "column": 16 - } - }, + "start":51,"end":67,"loc":{"start":{"line":8,"column":0},"end":{"line":8,"column":16}}, "id": { "type": "Identifier", - "start": 57, - "end": 59, - "loc": { - "start": { - "line": 8, - "column": 6 - }, - "end": { - "line": 8, - "column": 8 - }, - "identifierName": "A3" - }, + "start":57,"end":59,"loc":{"start":{"line":8,"column":6},"end":{"line":8,"column":8},"identifierName":"A3"}, "name": "A3" }, "superClass": null, "body": { "type": "ClassBody", - "start": 60, - "end": 67, - "loc": { - "start": { - "line": 8, - "column": 9 - }, - "end": { - "line": 8, - "column": 16 - } - }, + "start":60,"end":67,"loc":{"start":{"line":8,"column":9},"end":{"line":8,"column":16}}, "body": [ { "type": "ClassProperty", - "start": 62, - "end": 65, - "loc": { - "start": { - "line": 8, - "column": 11 - }, - "end": { - "line": 8, - "column": 14 - } - }, + "start":62,"end":65,"loc":{"start":{"line":8,"column":11},"end":{"line":8,"column":14}}, "static": false, "key": { "type": "Identifier", - "start": 62, - "end": 65, - "loc": { - "start": { - "line": 8, - "column": 11 - }, - "end": { - "line": 8, - "column": 14 - }, - "identifierName": "get" - }, + "start":62,"end":65,"loc":{"start":{"line":8,"column":11},"end":{"line":8,"column":14},"identifierName":"get"}, "name": "get" }, "computed": false, @@ -321,81 +105,24 @@ }, { "type": "ClassDeclaration", - "start": 68, - "end": 84, - "loc": { - "start": { - "line": 9, - "column": 0 - }, - "end": { - "line": 9, - "column": 16 - } - }, + "start":68,"end":84,"loc":{"start":{"line":9,"column":0},"end":{"line":9,"column":16}}, "id": { "type": "Identifier", - "start": 74, - "end": 76, - "loc": { - "start": { - "line": 9, - "column": 6 - }, - "end": { - "line": 9, - "column": 8 - }, - "identifierName": "A4" - }, + "start":74,"end":76,"loc":{"start":{"line":9,"column":6},"end":{"line":9,"column":8},"identifierName":"A4"}, "name": "A4" }, "superClass": null, "body": { "type": "ClassBody", - "start": 77, - "end": 84, - "loc": { - "start": { - "line": 9, - "column": 9 - }, - "end": { - "line": 9, - "column": 16 - } - }, + "start":77,"end":84,"loc":{"start":{"line":9,"column":9},"end":{"line":9,"column":16}}, "body": [ { "type": "ClassProperty", - "start": 79, - "end": 82, - "loc": { - "start": { - "line": 9, - "column": 11 - }, - "end": { - "line": 9, - "column": 14 - } - }, + "start":79,"end":82,"loc":{"start":{"line":9,"column":11},"end":{"line":9,"column":14}}, "static": false, "key": { "type": "Identifier", - "start": 79, - "end": 82, - "loc": { - "start": { - "line": 9, - "column": 11 - }, - "end": { - "line": 9, - "column": 14 - }, - "identifierName": "set" - }, + "start":79,"end":82,"loc":{"start":{"line":9,"column":11},"end":{"line":9,"column":14},"identifierName":"set"}, "name": "set" }, "computed": false, @@ -406,81 +133,24 @@ }, { "type": "ClassDeclaration", - "start": 85, - "end": 104, - "loc": { - "start": { - "line": 10, - "column": 0 - }, - "end": { - "line": 10, - "column": 19 - } - }, + "start":85,"end":104,"loc":{"start":{"line":10,"column":0},"end":{"line":10,"column":19}}, "id": { "type": "Identifier", - "start": 91, - "end": 93, - "loc": { - "start": { - "line": 10, - "column": 6 - }, - "end": { - "line": 10, - "column": 8 - }, - "identifierName": "A5" - }, + "start":91,"end":93,"loc":{"start":{"line":10,"column":6},"end":{"line":10,"column":8},"identifierName":"A5"}, "name": "A5" }, "superClass": null, "body": { "type": "ClassBody", - "start": 94, - "end": 104, - "loc": { - "start": { - "line": 10, - "column": 9 - }, - "end": { - "line": 10, - "column": 19 - } - }, + "start":94,"end":104,"loc":{"start":{"line":10,"column":9},"end":{"line":10,"column":19}}, "body": [ { "type": "ClassProperty", - "start": 96, - "end": 102, - "loc": { - "start": { - "line": 10, - "column": 11 - }, - "end": { - "line": 10, - "column": 17 - } - }, + "start":96,"end":102,"loc":{"start":{"line":10,"column":11},"end":{"line":10,"column":17}}, "computed": false, "key": { "type": "Identifier", - "start": 96, - "end": 102, - "loc": { - "start": { - "line": 10, - "column": 11 - }, - "end": { - "line": 10, - "column": 17 - }, - "identifierName": "static" - }, + "start":96,"end":102,"loc":{"start":{"line":10,"column":11},"end":{"line":10,"column":17},"identifierName":"static"}, "name": "static" }, "static": false, @@ -491,81 +161,24 @@ }, { "type": "ClassDeclaration", - "start": 105, - "end": 123, - "loc": { - "start": { - "line": 11, - "column": 0 - }, - "end": { - "line": 11, - "column": 18 - } - }, + "start":105,"end":123,"loc":{"start":{"line":11,"column":0},"end":{"line":11,"column":18}}, "id": { "type": "Identifier", - "start": 111, - "end": 113, - "loc": { - "start": { - "line": 11, - "column": 6 - }, - "end": { - "line": 11, - "column": 8 - }, - "identifierName": "A6" - }, + "start":111,"end":113,"loc":{"start":{"line":11,"column":6},"end":{"line":11,"column":8},"identifierName":"A6"}, "name": "A6" }, "superClass": null, "body": { "type": "ClassBody", - "start": 114, - "end": 123, - "loc": { - "start": { - "line": 11, - "column": 9 - }, - "end": { - "line": 11, - "column": 18 - } - }, + "start":114,"end":123,"loc":{"start":{"line":11,"column":9},"end":{"line":11,"column":18}}, "body": [ { "type": "ClassProperty", - "start": 116, - "end": 121, - "loc": { - "start": { - "line": 11, - "column": 11 - }, - "end": { - "line": 11, - "column": 16 - } - }, + "start":116,"end":121,"loc":{"start":{"line":11,"column":11},"end":{"line":11,"column":16}}, "static": false, "key": { "type": "Identifier", - "start": 116, - "end": 121, - "loc": { - "start": { - "line": 11, - "column": 11 - }, - "end": { - "line": 11, - "column": 16 - }, - "identifierName": "async" - }, + "start":116,"end":121,"loc":{"start":{"line":11,"column":11},"end":{"line":11,"column":16},"identifierName":"async"}, "name": "async" }, "computed": false, @@ -576,81 +189,24 @@ }, { "type": "ClassDeclaration", - "start": 125, - "end": 152, - "loc": { - "start": { - "line": 13, - "column": 0 - }, - "end": { - "line": 16, - "column": 1 - } - }, + "start":125,"end":152,"loc":{"start":{"line":13,"column":0},"end":{"line":16,"column":1}}, "id": { "type": "Identifier", - "start": 131, - "end": 133, - "loc": { - "start": { - "line": 13, - "column": 6 - }, - "end": { - "line": 13, - "column": 8 - }, - "identifierName": "A7" - }, + "start":131,"end":133,"loc":{"start":{"line":13,"column":6},"end":{"line":13,"column":8},"identifierName":"A7"}, "name": "A7" }, "superClass": null, "body": { "type": "ClassBody", - "start": 134, - "end": 152, - "loc": { - "start": { - "line": 13, - "column": 9 - }, - "end": { - "line": 16, - "column": 1 - } - }, + "start":134,"end":152,"loc":{"start":{"line":13,"column":9},"end":{"line":16,"column":1}}, "body": [ { "type": "ClassProperty", - "start": 138, - "end": 141, - "loc": { - "start": { - "line": 14, - "column": 2 - }, - "end": { - "line": 14, - "column": 5 - } - }, + "start":138,"end":141,"loc":{"start":{"line":14,"column":2},"end":{"line":14,"column":5}}, "static": false, "key": { "type": "Identifier", - "start": 138, - "end": 141, - "loc": { - "start": { - "line": 14, - "column": 2 - }, - "end": { - "line": 14, - "column": 5 - }, - "identifierName": "get" - }, + "start":138,"end":141,"loc":{"start":{"line":14,"column":2},"end":{"line":14,"column":5},"identifierName":"get"}, "name": "get" }, "computed": false, @@ -658,35 +214,12 @@ }, { "type": "ClassMethod", - "start": 144, - "end": 150, - "loc": { - "start": { - "line": 15, - "column": 2 - }, - "end": { - "line": 15, - "column": 8 - } - }, + "start":144,"end":150,"loc":{"start":{"line":15,"column":2},"end":{"line":15,"column":8}}, "static": false, "kind": "method", "key": { "type": "Identifier", - "start": 145, - "end": 146, - "loc": { - "start": { - "line": 15, - "column": 3 - }, - "end": { - "line": 15, - "column": 4 - }, - "identifierName": "a" - }, + "start":145,"end":146,"loc":{"start":{"line":15,"column":3},"end":{"line":15,"column":4},"identifierName":"a"}, "name": "a" }, "computed": false, @@ -696,18 +229,7 @@ "params": [], "body": { "type": "BlockStatement", - "start": 148, - "end": 150, - "loc": { - "start": { - "line": 15, - "column": 6 - }, - "end": { - "line": 15, - "column": 8 - } - }, + "start":148,"end":150,"loc":{"start":{"line":15,"column":6},"end":{"line":15,"column":8}}, "body": [], "directives": [] } @@ -717,82 +239,25 @@ }, { "type": "ClassDeclaration", - "start": 154, - "end": 184, - "loc": { - "start": { - "line": 18, - "column": 0 - }, - "end": { - "line": 21, - "column": 1 - } - }, + "start":154,"end":184,"loc":{"start":{"line":18,"column":0},"end":{"line":21,"column":1}}, "id": { "type": "Identifier", - "start": 160, - "end": 162, - "loc": { - "start": { - "line": 18, - "column": 6 - }, - "end": { - "line": 18, - "column": 8 - }, - "identifierName": "A8" - }, + "start":160,"end":162,"loc":{"start":{"line":18,"column":6},"end":{"line":18,"column":8},"identifierName":"A8"}, "name": "A8" }, "superClass": null, "body": { "type": "ClassBody", - "start": 163, - "end": 184, - "loc": { - "start": { - "line": 18, - "column": 9 - }, - "end": { - "line": 21, - "column": 1 - } - }, + "start":163,"end":184,"loc":{"start":{"line":18,"column":9},"end":{"line":21,"column":1}}, "body": [ { "type": "ClassMethod", - "start": 167, - "end": 182, - "loc": { - "start": { - "line": 19, - "column": 2 - }, - "end": { - "line": 20, - "column": 8 - } - }, + "start":167,"end":182,"loc":{"start":{"line":19,"column":2},"end":{"line":20,"column":8}}, "static": true, "kind": "method", "key": { "type": "Identifier", - "start": 177, - "end": 178, - "loc": { - "start": { - "line": 20, - "column": 3 - }, - "end": { - "line": 20, - "column": 4 - }, - "identifierName": "a" - }, + "start":177,"end":178,"loc":{"start":{"line":20,"column":3},"end":{"line":20,"column":4},"identifierName":"a"}, "name": "a" }, "computed": false, @@ -802,18 +267,7 @@ "params": [], "body": { "type": "BlockStatement", - "start": 180, - "end": 182, - "loc": { - "start": { - "line": 20, - "column": 6 - }, - "end": { - "line": 20, - "column": 8 - } - }, + "start":180,"end":182,"loc":{"start":{"line":20,"column":6},"end":{"line":20,"column":8}}, "body": [], "directives": [] } @@ -823,81 +277,24 @@ }, { "type": "ClassDeclaration", - "start": 186, - "end": 214, - "loc": { - "start": { - "line": 23, - "column": 0 - }, - "end": { - "line": 26, - "column": 1 - } - }, + "start":186,"end":214,"loc":{"start":{"line":23,"column":0},"end":{"line":26,"column":1}}, "id": { "type": "Identifier", - "start": 192, - "end": 194, - "loc": { - "start": { - "line": 23, - "column": 6 - }, - "end": { - "line": 23, - "column": 8 - }, - "identifierName": "A9" - }, + "start":192,"end":194,"loc":{"start":{"line":23,"column":6},"end":{"line":23,"column":8},"identifierName":"A9"}, "name": "A9" }, "superClass": null, "body": { "type": "ClassBody", - "start": 195, - "end": 214, - "loc": { - "start": { - "line": 23, - "column": 9 - }, - "end": { - "line": 26, - "column": 1 - } - }, + "start":195,"end":214,"loc":{"start":{"line":23,"column":9},"end":{"line":26,"column":1}}, "body": [ { "type": "ClassProperty", - "start": 199, - "end": 204, - "loc": { - "start": { - "line": 24, - "column": 2 - }, - "end": { - "line": 24, - "column": 7 - } - }, + "start":199,"end":204,"loc":{"start":{"line":24,"column":2},"end":{"line":24,"column":7}}, "static": false, "key": { "type": "Identifier", - "start": 199, - "end": 204, - "loc": { - "start": { - "line": 24, - "column": 2 - }, - "end": { - "line": 24, - "column": 7 - }, - "identifierName": "async" - }, + "start":199,"end":204,"loc":{"start":{"line":24,"column":2},"end":{"line":24,"column":7},"identifierName":"async"}, "name": "async" }, "computed": false, @@ -905,34 +302,11 @@ }, { "type": "ClassMethod", - "start": 207, - "end": 212, - "loc": { - "start": { - "line": 25, - "column": 2 - }, - "end": { - "line": 25, - "column": 7 - } - }, + "start":207,"end":212,"loc":{"start":{"line":25,"column":2},"end":{"line":25,"column":7}}, "static": false, "key": { "type": "Identifier", - "start": 207, - "end": 208, - "loc": { - "start": { - "line": 25, - "column": 2 - }, - "end": { - "line": 25, - "column": 3 - }, - "identifierName": "a" - }, + "start":207,"end":208,"loc":{"start":{"line":25,"column":2},"end":{"line":25,"column":3},"identifierName":"a"}, "name": "a" }, "computed": false, @@ -943,18 +317,7 @@ "params": [], "body": { "type": "BlockStatement", - "start": 210, - "end": 212, - "loc": { - "start": { - "line": 25, - "column": 5 - }, - "end": { - "line": 25, - "column": 7 - } - }, + "start":210,"end":212,"loc":{"start":{"line":25,"column":5},"end":{"line":25,"column":7}}, "body": [], "directives": [] } @@ -964,81 +327,24 @@ }, { "type": "ClassDeclaration", - "start": 216, - "end": 250, - "loc": { - "start": { - "line": 28, - "column": 0 - }, - "end": { - "line": 32, - "column": 1 - } - }, + "start":216,"end":250,"loc":{"start":{"line":28,"column":0},"end":{"line":32,"column":1}}, "id": { "type": "Identifier", - "start": 222, - "end": 225, - "loc": { - "start": { - "line": 28, - "column": 6 - }, - "end": { - "line": 28, - "column": 9 - }, - "identifierName": "A10" - }, + "start":222,"end":225,"loc":{"start":{"line":28,"column":6},"end":{"line":28,"column":9},"identifierName":"A10"}, "name": "A10" }, "superClass": null, "body": { "type": "ClassBody", - "start": 226, - "end": 250, - "loc": { - "start": { - "line": 28, - "column": 10 - }, - "end": { - "line": 32, - "column": 1 - } - }, + "start":226,"end":250,"loc":{"start":{"line":28,"column":10},"end":{"line":32,"column":1}}, "body": [ { "type": "ClassProperty", - "start": 230, - "end": 244, - "loc": { - "start": { - "line": 29, - "column": 2 - }, - "end": { - "line": 30, - "column": 7 - } - }, + "start":230,"end":244,"loc":{"start":{"line":29,"column":2},"end":{"line":30,"column":7}}, "static": true, "key": { "type": "Identifier", - "start": 239, - "end": 244, - "loc": { - "start": { - "line": 30, - "column": 2 - }, - "end": { - "line": 30, - "column": 7 - }, - "identifierName": "async" - }, + "start":239,"end":244,"loc":{"start":{"line":30,"column":2},"end":{"line":30,"column":7},"identifierName":"async"}, "name": "async" }, "computed": false, @@ -1046,34 +352,11 @@ }, { "type": "ClassProperty", - "start": 247, - "end": 248, - "loc": { - "start": { - "line": 31, - "column": 2 - }, - "end": { - "line": 31, - "column": 3 - } - }, + "start":247,"end":248,"loc":{"start":{"line":31,"column":2},"end":{"line":31,"column":3}}, "static": false, "key": { "type": "Identifier", - "start": 247, - "end": 248, - "loc": { - "start": { - "line": 31, - "column": 2 - }, - "end": { - "line": 31, - "column": 3 - }, - "identifierName": "a" - }, + "start":247,"end":248,"loc":{"start":{"line":31,"column":2},"end":{"line":31,"column":3},"identifierName":"a"}, "name": "a" }, "computed": false, @@ -1084,81 +367,24 @@ }, { "type": "ClassDeclaration", - "start": 252, - "end": 273, - "loc": { - "start": { - "line": 34, - "column": 0 - }, - "end": { - "line": 34, - "column": 21 - } - }, + "start":252,"end":273,"loc":{"start":{"line":34,"column":0},"end":{"line":34,"column":21}}, "id": { "type": "Identifier", - "start": 258, - "end": 261, - "loc": { - "start": { - "line": 34, - "column": 6 - }, - "end": { - "line": 34, - "column": 9 - }, - "identifierName": "A11" - }, + "start":258,"end":261,"loc":{"start":{"line":34,"column":6},"end":{"line":34,"column":9},"identifierName":"A11"}, "name": "A11" }, "superClass": null, "body": { "type": "ClassBody", - "start": 262, - "end": 273, - "loc": { - "start": { - "line": 34, - "column": 10 - }, - "end": { - "line": 34, - "column": 21 - } - }, + "start":262,"end":273,"loc":{"start":{"line":34,"column":10},"end":{"line":34,"column":21}}, "body": [ { "type": "ClassProperty", - "start": 264, - "end": 271, - "loc": { - "start": { - "line": 34, - "column": 12 - }, - "end": { - "line": 34, - "column": 19 - } - }, + "start":264,"end":271,"loc":{"start":{"line":34,"column":12},"end":{"line":34,"column":19}}, "computed": false, "key": { "type": "Identifier", - "start": 264, - "end": 270, - "loc": { - "start": { - "line": 34, - "column": 12 - }, - "end": { - "line": 34, - "column": 18 - }, - "identifierName": "static" - }, + "start":264,"end":270,"loc":{"start":{"line":34,"column":12},"end":{"line":34,"column":18},"identifierName":"static"}, "name": "static" }, "static": false, @@ -1169,98 +395,30 @@ }, { "type": "ClassDeclaration", - "start": 275, - "end": 302, - "loc": { - "start": { - "line": 36, - "column": 0 - }, - "end": { - "line": 38, - "column": 1 - } - }, + "start":275,"end":302,"loc":{"start":{"line":36,"column":0},"end":{"line":38,"column":1}}, "id": { "type": "Identifier", - "start": 281, - "end": 284, - "loc": { - "start": { - "line": 36, - "column": 6 - }, - "end": { - "line": 36, - "column": 9 - }, - "identifierName": "A12" - }, + "start":281,"end":284,"loc":{"start":{"line":36,"column":6},"end":{"line":36,"column":9},"identifierName":"A12"}, "name": "A12" }, "superClass": null, "body": { "type": "ClassBody", - "start": 285, - "end": 302, - "loc": { - "start": { - "line": 36, - "column": 10 - }, - "end": { - "line": 38, - "column": 1 - } - }, + "start":285,"end":302,"loc":{"start":{"line":36,"column":10},"end":{"line":38,"column":1}}, "body": [ { "type": "ClassProperty", - "start": 289, - "end": 300, - "loc": { - "start": { - "line": 37, - "column": 2 - }, - "end": { - "line": 37, - "column": 13 - } - }, + "start":289,"end":300,"loc":{"start":{"line":37,"column":2},"end":{"line":37,"column":13}}, "computed": false, "key": { "type": "Identifier", - "start": 289, - "end": 295, - "loc": { - "start": { - "line": 37, - "column": 2 - }, - "end": { - "line": 37, - "column": 8 - }, - "identifierName": "static" - }, + "start":289,"end":295,"loc":{"start":{"line":37,"column":2},"end":{"line":37,"column":8},"identifierName":"static"}, "name": "static" }, "static": false, "value": { "type": "NumericLiteral", - "start": 298, - "end": 299, - "loc": { - "start": { - "line": 37, - "column": 11 - }, - "end": { - "line": 37, - "column": 12 - } - }, + "start":298,"end":299,"loc":{"start":{"line":37,"column":11},"end":{"line":37,"column":12}}, "extra": { "rawValue": 0, "raw": "0" @@ -1273,80 +431,24 @@ }, { "type": "ClassDeclaration", - "start": 304, - "end": 335, - "loc": { - "start": { - "line": 40, - "column": 0 - }, - "end": { - "line": 43, - "column": 1 - } - }, + "start":304,"end":335,"loc":{"start":{"line":40,"column":0},"end":{"line":43,"column":1}}, "id": { "type": "Identifier", - "start": 310, - "end": 313, - "loc": { - "start": { - "line": 40, - "column": 6 - }, - "end": { - "line": 40, - "column": 9 - }, - "identifierName": "A13" - }, + "start":310,"end":313,"loc":{"start":{"line":40,"column":6},"end":{"line":40,"column":9},"identifierName":"A13"}, "name": "A13" }, "superClass": null, "body": { "type": "ClassBody", - "start": 314, - "end": 335, - "loc": { - "start": { - "line": 40, - "column": 10 - }, - "end": { - "line": 43, - "column": 1 - } - }, + "start":314,"end":335,"loc":{"start":{"line":40,"column":10},"end":{"line":43,"column":1}}, "body": [ { "type": "ClassMethod", - "start": 318, - "end": 333, - "loc": { - "start": { - "line": 41, - "column": 2 - }, - "end": { - "line": 42, - "column": 11 - } - }, + "start":318,"end":333,"loc":{"start":{"line":41,"column":2},"end":{"line":42,"column":11}}, "static": false, "key": { "type": "StringLiteral", - "start": 325, - "end": 328, - "loc": { - "start": { - "line": 42, - "column": 3 - }, - "end": { - "line": 42, - "column": 6 - } - }, + "start":325,"end":328,"loc":{"start":{"line":42,"column":3},"end":{"line":42,"column":6}}, "extra": { "rawValue": "a", "raw": "'a'" @@ -1361,18 +463,7 @@ "params": [], "body": { "type": "BlockStatement", - "start": 331, - "end": 333, - "loc": { - "start": { - "line": 42, - "column": 9 - }, - "end": { - "line": 42, - "column": 11 - } - }, + "start":331,"end":333,"loc":{"start":{"line":42,"column":9},"end":{"line":42,"column":11}}, "body": [], "directives": [] } @@ -1382,81 +473,24 @@ }, { "type": "ClassDeclaration", - "start": 337, - "end": 381, - "loc": { - "start": { - "line": 45, - "column": 0 - }, - "end": { - "line": 50, - "column": 1 - } - }, + "start":337,"end":381,"loc":{"start":{"line":45,"column":0},"end":{"line":50,"column":1}}, "id": { "type": "Identifier", - "start": 343, - "end": 346, - "loc": { - "start": { - "line": 45, - "column": 6 - }, - "end": { - "line": 45, - "column": 9 - }, - "identifierName": "A14" - }, + "start":343,"end":346,"loc":{"start":{"line":45,"column":6},"end":{"line":45,"column":9},"identifierName":"A14"}, "name": "A14" }, "superClass": null, "body": { "type": "ClassBody", - "start": 347, - "end": 381, - "loc": { - "start": { - "line": 45, - "column": 10 - }, - "end": { - "line": 50, - "column": 1 - } - }, + "start":347,"end":381,"loc":{"start":{"line":45,"column":10},"end":{"line":50,"column":1}}, "body": [ { "type": "ClassMethod", - "start": 351, - "end": 379, - "loc": { - "start": { - "line": 46, - "column": 2 - }, - "end": { - "line": 49, - "column": 6 - } - }, + "start":351,"end":379,"loc":{"start":{"line":46,"column":2},"end":{"line":49,"column":6}}, "static": true, "key": { "type": "Identifier", - "start": 366, - "end": 372, - "loc": { - "start": { - "line": 48, - "column": 2 - }, - "end": { - "line": 48, - "column": 8 - }, - "identifierName": "static" - }, + "start":366,"end":372,"loc":{"start":{"line":48,"column":2},"end":{"line":48,"column":8},"identifierName":"static"}, "name": "static" }, "computed": false, @@ -1467,18 +501,7 @@ "params": [], "body": { "type": "BlockStatement", - "start": 377, - "end": 379, - "loc": { - "start": { - "line": 49, - "column": 4 - }, - "end": { - "line": 49, - "column": 6 - } - }, + "start":377,"end":379,"loc":{"start":{"line":49,"column":4},"end":{"line":49,"column":6}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/experimental/class-properties/inline/output.json b/packages/babel-parser/test/fixtures/experimental/class-properties/inline/output.json index 01efea8ee23f..80cff7767730 100644 --- a/packages/babel-parser/test/fixtures/experimental/class-properties/inline/output.json +++ b/packages/babel-parser/test/fixtures/experimental/class-properties/inline/output.json @@ -1,111 +1,32 @@ { "type": "File", - "start": 0, - "end": 44, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 25 - } - }, + "start":0,"end":44,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":25}}, "program": { "type": "Program", - "start": 0, - "end": 44, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 25 - } - }, + "start":0,"end":44,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":25}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "id": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "A" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, "name": "A" }, "superClass": null, "body": { "type": "ClassBody", - "start": 8, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":8,"end":17,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":17}}, "body": [ { "type": "ClassProperty", - "start": 10, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":10,"end":12,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":12}}, "static": false, "key": { "type": "Identifier", - "start": 10, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "x" - }, + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11},"identifierName":"x"}, "name": "x" }, "computed": false, @@ -113,34 +34,11 @@ }, { "type": "ClassProperty", - "start": 13, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":13,"end":15,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":15}}, "static": false, "key": { "type": "Identifier", - "start": 13, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - }, - "identifierName": "y" - }, + "start":13,"end":14,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":14},"identifierName":"y"}, "name": "y" }, "computed": false, @@ -151,98 +49,30 @@ }, { "type": "ClassDeclaration", - "start": 19, - "end": 44, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 25 - } - }, + "start":19,"end":44,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":25}}, "id": { "type": "Identifier", - "start": 25, - "end": 26, - "loc": { - "start": { - "line": 3, - "column": 6 - }, - "end": { - "line": 3, - "column": 7 - }, - "identifierName": "B" - }, + "start":25,"end":26,"loc":{"start":{"line":3,"column":6},"end":{"line":3,"column":7},"identifierName":"B"}, "name": "B" }, "superClass": null, "body": { "type": "ClassBody", - "start": 27, - "end": 44, - "loc": { - "start": { - "line": 3, - "column": 8 - }, - "end": { - "line": 3, - "column": 25 - } - }, + "start":27,"end":44,"loc":{"start":{"line":3,"column":8},"end":{"line":3,"column":25}}, "body": [ { "type": "ClassProperty", - "start": 29, - "end": 35, - "loc": { - "start": { - "line": 3, - "column": 10 - }, - "end": { - "line": 3, - "column": 16 - } - }, + "start":29,"end":35,"loc":{"start":{"line":3,"column":10},"end":{"line":3,"column":16}}, "static": false, "key": { "type": "Identifier", - "start": 29, - "end": 30, - "loc": { - "start": { - "line": 3, - "column": 10 - }, - "end": { - "line": 3, - "column": 11 - }, - "identifierName": "x" - }, + "start":29,"end":30,"loc":{"start":{"line":3,"column":10},"end":{"line":3,"column":11},"identifierName":"x"}, "name": "x" }, "computed": false, "value": { "type": "NumericLiteral", - "start": 33, - "end": 34, - "loc": { - "start": { - "line": 3, - "column": 14 - }, - "end": { - "line": 3, - "column": 15 - } - }, + "start":33,"end":34,"loc":{"start":{"line":3,"column":14},"end":{"line":3,"column":15}}, "extra": { "rawValue": 0, "raw": "0" @@ -252,51 +82,17 @@ }, { "type": "ClassProperty", - "start": 36, - "end": 42, - "loc": { - "start": { - "line": 3, - "column": 17 - }, - "end": { - "line": 3, - "column": 23 - } - }, + "start":36,"end":42,"loc":{"start":{"line":3,"column":17},"end":{"line":3,"column":23}}, "static": false, "key": { "type": "Identifier", - "start": 36, - "end": 37, - "loc": { - "start": { - "line": 3, - "column": 17 - }, - "end": { - "line": 3, - "column": 18 - }, - "identifierName": "y" - }, + "start":36,"end":37,"loc":{"start":{"line":3,"column":17},"end":{"line":3,"column":18},"identifierName":"y"}, "name": "y" }, "computed": false, "value": { "type": "NumericLiteral", - "start": 40, - "end": 41, - "loc": { - "start": { - "line": 3, - "column": 21 - }, - "end": { - "line": 3, - "column": 22 - } - }, + "start":40,"end":41,"loc":{"start":{"line":3,"column":21},"end":{"line":3,"column":22}}, "extra": { "rawValue": 1, "raw": "1" diff --git a/packages/babel-parser/test/fixtures/experimental/class-properties/new-target-invalid/options.json b/packages/babel-parser/test/fixtures/experimental/class-properties/new-target-invalid/options.json index 8d36a47b9f64..9c27576d4ad0 100644 --- a/packages/babel-parser/test/fixtures/experimental/class-properties/new-target-invalid/options.json +++ b/packages/babel-parser/test/fixtures/experimental/class-properties/new-target-invalid/options.json @@ -1,4 +1,3 @@ { - "plugins": ["classProperties"], - "throws": "new.target can only be used in functions or class properties (1:8)" + "plugins": ["classProperties"] } diff --git a/packages/babel-parser/test/fixtures/experimental/class-properties/new-target-invalid/output.json b/packages/babel-parser/test/fixtures/experimental/class-properties/new-target-invalid/output.json new file mode 100644 index 000000000000..166fd813daca --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-properties/new-target-invalid/output.json @@ -0,0 +1,46 @@ +{ + "type": "File", + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, + "errors": [ + "SyntaxError: new.target can only be used in functions or class properties (1:8)" + ], + "program": { + "type": "Program", + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":4,"end":18,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":18}}, + "id": { + "type": "Identifier", + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"x"}, + "name": "x" + }, + "init": { + "type": "MetaProperty", + "start":8,"end":18,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":18}}, + "meta": { + "type": "Identifier", + "start":8,"end":11,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":11},"identifierName":"new"}, + "name": "new" + }, + "property": { + "type": "Identifier", + "start":12,"end":18,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":18},"identifierName":"target"}, + "name": "target" + } + } + } + ], + "kind": "var" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-properties/new-target-with-flow/output.json b/packages/babel-parser/test/fixtures/experimental/class-properties/new-target-with-flow/output.json index d3d00ee7bb86..1bce1392d067 100644 --- a/packages/babel-parser/test/fixtures/experimental/class-properties/new-target-with-flow/output.json +++ b/packages/babel-parser/test/fixtures/experimental/class-properties/new-target-with-flow/output.json @@ -1,259 +1,77 @@ { "type": "File", - "start": 0, - "end": 257, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 10, - "column": 1 - } - }, + "start":0,"end":257,"loc":{"start":{"line":1,"column":0},"end":{"line":10,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 257, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 10, - "column": 1 - } - }, + "start":0,"end":257,"loc":{"start":{"line":1,"column":0},"end":{"line":10,"column":1}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 257, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 10, - "column": 1 - } - }, + "start":0,"end":257,"loc":{"start":{"line":1,"column":0},"end":{"line":10,"column":1}}, "id": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "X" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"X"}, "name": "X" }, "superClass": null, "body": { "type": "ClassBody", - "start": 8, - "end": 257, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 10, - "column": 1 - } - }, + "start":8,"end":257,"loc":{"start":{"line":1,"column":8},"end":{"line":10,"column":1}}, "body": [ { "type": "ClassProperty", - "start": 12, - "end": 34, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 24 - } - }, + "start":12,"end":34,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":24}}, "static": true, "key": { "type": "Identifier", - "start": 19, - "end": 20, - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 10 - }, - "identifierName": "a" - }, + "start":19,"end":20,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":10},"identifierName":"a"}, "name": "a" }, "computed": false, "variance": null, "value": { "type": "MetaProperty", - "start": 23, - "end": 33, - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 23 - } - }, + "start":23,"end":33,"loc":{"start":{"line":2,"column":13},"end":{"line":2,"column":23}}, "meta": { "type": "Identifier", - "start": 23, - "end": 26, - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 16 - }, - "identifierName": "new" - }, + "start":23,"end":26,"loc":{"start":{"line":2,"column":13},"end":{"line":2,"column":16},"identifierName":"new"}, "name": "new" }, "property": { "type": "Identifier", - "start": 27, - "end": 33, - "loc": { - "start": { - "line": 2, - "column": 17 - }, - "end": { - "line": 2, - "column": 23 - }, - "identifierName": "target" - }, + "start":27,"end":33,"loc":{"start":{"line":2,"column":17},"end":{"line":2,"column":23},"identifierName":"target"}, "name": "target" } } }, { "type": "ClassProperty", - "start": 37, - "end": 76, - "loc": { - "start": { - "line": 3, - "column": 2 - }, - "end": { - "line": 3, - "column": 41 - } - }, + "start":37,"end":76,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":41}}, "static": true, "key": { "type": "Identifier", - "start": 44, - "end": 45, - "loc": { - "start": { - "line": 3, - "column": 9 - }, - "end": { - "line": 3, - "column": 10 - }, - "identifierName": "b" - }, + "start":44,"end":45,"loc":{"start":{"line":3,"column":9},"end":{"line":3,"column":10},"identifierName":"b"}, "name": "b" }, "computed": false, "variance": null, "value": { "type": "AssignmentExpression", - "start": 49, - "end": 74, - "loc": { - "start": { - "line": 3, - "column": 14 - }, - "end": { - "line": 3, - "column": 39 - } - }, + "start":49,"end":74,"loc":{"start":{"line":3,"column":14},"end":{"line":3,"column":39}}, "operator": "=", "left": { "type": "Identifier", - "start": 49, - "end": 52, - "loc": { - "start": { - "line": 3, - "column": 14 - }, - "end": { - "line": 3, - "column": 17 - }, - "identifierName": "foo" - }, + "start":49,"end":52,"loc":{"start":{"line":3,"column":14},"end":{"line":3,"column":17},"identifierName":"foo"}, "name": "foo" }, "right": { "type": "BinaryExpression", - "start": 55, - "end": 74, - "loc": { - "start": { - "line": 3, - "column": 20 - }, - "end": { - "line": 3, - "column": 39 - } - }, + "start":55,"end":74,"loc":{"start":{"line":3,"column":20},"end":{"line":3,"column":39}}, "left": { "type": "NumericLiteral", - "start": 55, - "end": 56, - "loc": { - "start": { - "line": 3, - "column": 20 - }, - "end": { - "line": 3, - "column": 21 - } - }, + "start":55,"end":56,"loc":{"start":{"line":3,"column":20},"end":{"line":3,"column":21}}, "extra": { "rawValue": 1, "raw": "1" @@ -263,82 +81,24 @@ "operator": "+", "right": { "type": "CallExpression", - "start": 59, - "end": 74, - "loc": { - "start": { - "line": 3, - "column": 24 - }, - "end": { - "line": 3, - "column": 39 - } - }, + "start":59,"end":74,"loc":{"start":{"line":3,"column":24},"end":{"line":3,"column":39}}, "callee": { "type": "Identifier", - "start": 59, - "end": 62, - "loc": { - "start": { - "line": 3, - "column": 24 - }, - "end": { - "line": 3, - "column": 27 - }, - "identifierName": "bar" - }, + "start":59,"end":62,"loc":{"start":{"line":3,"column":24},"end":{"line":3,"column":27},"identifierName":"bar"}, "name": "bar" }, "arguments": [ { "type": "MetaProperty", - "start": 63, - "end": 73, - "loc": { - "start": { - "line": 3, - "column": 28 - }, - "end": { - "line": 3, - "column": 38 - } - }, + "start":63,"end":73,"loc":{"start":{"line":3,"column":28},"end":{"line":3,"column":38}}, "meta": { "type": "Identifier", - "start": 63, - "end": 66, - "loc": { - "start": { - "line": 3, - "column": 28 - }, - "end": { - "line": 3, - "column": 31 - }, - "identifierName": "new" - }, + "start":63,"end":66,"loc":{"start":{"line":3,"column":28},"end":{"line":3,"column":31},"identifierName":"new"}, "name": "new" }, "property": { "type": "Identifier", - "start": 67, - "end": 73, - "loc": { - "start": { - "line": 3, - "column": 32 - }, - "end": { - "line": 3, - "column": 38 - }, - "identifierName": "target" - }, + "start":67,"end":73,"loc":{"start":{"line":3,"column":32},"end":{"line":3,"column":38},"identifierName":"target"}, "name": "target" } } @@ -353,102 +113,33 @@ }, { "type": "ClassProperty", - "start": 79, - "end": 107, - "loc": { - "start": { - "line": 4, - "column": 2 - }, - "end": { - "line": 4, - "column": 30 - } - }, + "start":79,"end":107,"loc":{"start":{"line":4,"column":2},"end":{"line":4,"column":30}}, "static": true, "key": { "type": "Identifier", - "start": 86, - "end": 87, - "loc": { - "start": { - "line": 4, - "column": 9 - }, - "end": { - "line": 4, - "column": 10 - }, - "identifierName": "c" - }, + "start":86,"end":87,"loc":{"start":{"line":4,"column":9},"end":{"line":4,"column":10},"identifierName":"c"}, "name": "c" }, "computed": false, "variance": null, "value": { "type": "ArrowFunctionExpression", - "start": 90, - "end": 106, - "loc": { - "start": { - "line": 4, - "column": 13 - }, - "end": { - "line": 4, - "column": 29 - } - }, + "start":90,"end":106,"loc":{"start":{"line":4,"column":13},"end":{"line":4,"column":29}}, "id": null, "generator": false, "async": false, "params": [], "body": { "type": "MetaProperty", - "start": 96, - "end": 106, - "loc": { - "start": { - "line": 4, - "column": 19 - }, - "end": { - "line": 4, - "column": 29 - } - }, + "start":96,"end":106,"loc":{"start":{"line":4,"column":19},"end":{"line":4,"column":29}}, "meta": { "type": "Identifier", - "start": 96, - "end": 99, - "loc": { - "start": { - "line": 4, - "column": 19 - }, - "end": { - "line": 4, - "column": 22 - }, - "identifierName": "new" - }, + "start":96,"end":99,"loc":{"start":{"line":4,"column":19},"end":{"line":4,"column":22},"identifierName":"new"}, "name": "new" }, "property": { "type": "Identifier", - "start": 100, - "end": 106, - "loc": { - "start": { - "line": 4, - "column": 23 - }, - "end": { - "line": 4, - "column": 29 - }, - "identifierName": "target" - }, + "start":100,"end":106,"loc":{"start":{"line":4,"column":23},"end":{"line":4,"column":29},"identifierName":"target"}, "name": "target" } } @@ -456,133 +147,41 @@ }, { "type": "ClassProperty", - "start": 110, - "end": 146, - "loc": { - "start": { - "line": 5, - "column": 2 - }, - "end": { - "line": 5, - "column": 38 - } - }, + "start":110,"end":146,"loc":{"start":{"line":5,"column":2},"end":{"line":5,"column":38}}, "static": true, "key": { "type": "Identifier", - "start": 117, - "end": 118, - "loc": { - "start": { - "line": 5, - "column": 9 - }, - "end": { - "line": 5, - "column": 10 - }, - "identifierName": "d" - }, + "start":117,"end":118,"loc":{"start":{"line":5,"column":9},"end":{"line":5,"column":10},"identifierName":"d"}, "name": "d" }, "computed": false, "variance": null, "value": { "type": "ArrowFunctionExpression", - "start": 121, - "end": 145, - "loc": { - "start": { - "line": 5, - "column": 13 - }, - "end": { - "line": 5, - "column": 37 - } - }, + "start":121,"end":145,"loc":{"start":{"line":5,"column":13},"end":{"line":5,"column":37}}, "id": null, "generator": false, "async": false, "params": [ { "type": "AssignmentPattern", - "start": 122, - "end": 138, - "loc": { - "start": { - "line": 5, - "column": 14 - }, - "end": { - "line": 5, - "column": 30 - } - }, + "start":122,"end":138,"loc":{"start":{"line":5,"column":14},"end":{"line":5,"column":30}}, "left": { "type": "Identifier", - "start": 122, - "end": 125, - "loc": { - "start": { - "line": 5, - "column": 14 - }, - "end": { - "line": 5, - "column": 17 - }, - "identifierName": "foo" - }, + "start":122,"end":125,"loc":{"start":{"line":5,"column":14},"end":{"line":5,"column":17},"identifierName":"foo"}, "name": "foo" }, "right": { "type": "MetaProperty", - "start": 128, - "end": 138, - "loc": { - "start": { - "line": 5, - "column": 20 - }, - "end": { - "line": 5, - "column": 30 - } - }, + "start":128,"end":138,"loc":{"start":{"line":5,"column":20},"end":{"line":5,"column":30}}, "meta": { "type": "Identifier", - "start": 128, - "end": 131, - "loc": { - "start": { - "line": 5, - "column": 20 - }, - "end": { - "line": 5, - "column": 23 - }, - "identifierName": "new" - }, + "start":128,"end":131,"loc":{"start":{"line":5,"column":20},"end":{"line":5,"column":23},"identifierName":"new"}, "name": "new" }, "property": { "type": "Identifier", - "start": 132, - "end": 138, - "loc": { - "start": { - "line": 5, - "column": 24 - }, - "end": { - "line": 5, - "column": 30 - }, - "identifierName": "target" - }, + "start":132,"end":138,"loc":{"start":{"line":5,"column":24},"end":{"line":5,"column":30},"identifierName":"target"}, "name": "target" } } @@ -590,18 +189,7 @@ ], "body": { "type": "BlockStatement", - "start": 143, - "end": 145, - "loc": { - "start": { - "line": 5, - "column": 35 - }, - "end": { - "line": 5, - "column": 37 - } - }, + "start":143,"end":145,"loc":{"start":{"line":5,"column":35},"end":{"line":5,"column":37}}, "body": [], "directives": [] } @@ -609,182 +197,56 @@ }, { "type": "ClassProperty", - "start": 149, - "end": 164, - "loc": { - "start": { - "line": 6, - "column": 2 - }, - "end": { - "line": 6, - "column": 17 - } - }, + "start":149,"end":164,"loc":{"start":{"line":6,"column":2},"end":{"line":6,"column":17}}, "static": false, "key": { "type": "Identifier", - "start": 149, - "end": 150, - "loc": { - "start": { - "line": 6, - "column": 2 - }, - "end": { - "line": 6, - "column": 3 - }, - "identifierName": "e" - }, + "start":149,"end":150,"loc":{"start":{"line":6,"column":2},"end":{"line":6,"column":3},"identifierName":"e"}, "name": "e" }, "computed": false, "variance": null, "value": { "type": "MetaProperty", - "start": 153, - "end": 163, - "loc": { - "start": { - "line": 6, - "column": 6 - }, - "end": { - "line": 6, - "column": 16 - } - }, + "start":153,"end":163,"loc":{"start":{"line":6,"column":6},"end":{"line":6,"column":16}}, "meta": { "type": "Identifier", - "start": 153, - "end": 156, - "loc": { - "start": { - "line": 6, - "column": 6 - }, - "end": { - "line": 6, - "column": 9 - }, - "identifierName": "new" - }, + "start":153,"end":156,"loc":{"start":{"line":6,"column":6},"end":{"line":6,"column":9},"identifierName":"new"}, "name": "new" }, "property": { "type": "Identifier", - "start": 157, - "end": 163, - "loc": { - "start": { - "line": 6, - "column": 10 - }, - "end": { - "line": 6, - "column": 16 - }, - "identifierName": "target" - }, + "start":157,"end":163,"loc":{"start":{"line":6,"column":10},"end":{"line":6,"column":16},"identifierName":"target"}, "name": "target" } } }, { "type": "ClassProperty", - "start": 167, - "end": 199, - "loc": { - "start": { - "line": 7, - "column": 2 - }, - "end": { - "line": 7, - "column": 34 - } - }, + "start":167,"end":199,"loc":{"start":{"line":7,"column":2},"end":{"line":7,"column":34}}, "static": false, "key": { "type": "Identifier", - "start": 167, - "end": 168, - "loc": { - "start": { - "line": 7, - "column": 2 - }, - "end": { - "line": 7, - "column": 3 - }, - "identifierName": "f" - }, + "start":167,"end":168,"loc":{"start":{"line":7,"column":2},"end":{"line":7,"column":3},"identifierName":"f"}, "name": "f" }, "computed": false, "variance": null, "value": { "type": "AssignmentExpression", - "start": 172, - "end": 197, - "loc": { - "start": { - "line": 7, - "column": 7 - }, - "end": { - "line": 7, - "column": 32 - } - }, + "start":172,"end":197,"loc":{"start":{"line":7,"column":7},"end":{"line":7,"column":32}}, "operator": "=", "left": { "type": "Identifier", - "start": 172, - "end": 175, - "loc": { - "start": { - "line": 7, - "column": 7 - }, - "end": { - "line": 7, - "column": 10 - }, - "identifierName": "foo" - }, + "start":172,"end":175,"loc":{"start":{"line":7,"column":7},"end":{"line":7,"column":10},"identifierName":"foo"}, "name": "foo" }, "right": { "type": "BinaryExpression", - "start": 178, - "end": 197, - "loc": { - "start": { - "line": 7, - "column": 13 - }, - "end": { - "line": 7, - "column": 32 - } - }, + "start":178,"end":197,"loc":{"start":{"line":7,"column":13},"end":{"line":7,"column":32}}, "left": { "type": "NumericLiteral", - "start": 178, - "end": 179, - "loc": { - "start": { - "line": 7, - "column": 13 - }, - "end": { - "line": 7, - "column": 14 - } - }, + "start":178,"end":179,"loc":{"start":{"line":7,"column":13},"end":{"line":7,"column":14}}, "extra": { "rawValue": 1, "raw": "1" @@ -794,82 +256,24 @@ "operator": "+", "right": { "type": "CallExpression", - "start": 182, - "end": 197, - "loc": { - "start": { - "line": 7, - "column": 17 - }, - "end": { - "line": 7, - "column": 32 - } - }, + "start":182,"end":197,"loc":{"start":{"line":7,"column":17},"end":{"line":7,"column":32}}, "callee": { "type": "Identifier", - "start": 182, - "end": 185, - "loc": { - "start": { - "line": 7, - "column": 17 - }, - "end": { - "line": 7, - "column": 20 - }, - "identifierName": "bar" - }, + "start":182,"end":185,"loc":{"start":{"line":7,"column":17},"end":{"line":7,"column":20},"identifierName":"bar"}, "name": "bar" }, "arguments": [ { "type": "MetaProperty", - "start": 186, - "end": 196, - "loc": { - "start": { - "line": 7, - "column": 21 - }, - "end": { - "line": 7, - "column": 31 - } - }, + "start":186,"end":196,"loc":{"start":{"line":7,"column":21},"end":{"line":7,"column":31}}, "meta": { "type": "Identifier", - "start": 186, - "end": 189, - "loc": { - "start": { - "line": 7, - "column": 21 - }, - "end": { - "line": 7, - "column": 24 - }, - "identifierName": "new" - }, + "start":186,"end":189,"loc":{"start":{"line":7,"column":21},"end":{"line":7,"column":24},"identifierName":"new"}, "name": "new" }, "property": { "type": "Identifier", - "start": 190, - "end": 196, - "loc": { - "start": { - "line": 7, - "column": 25 - }, - "end": { - "line": 7, - "column": 31 - }, - "identifierName": "target" - }, + "start":190,"end":196,"loc":{"start":{"line":7,"column":25},"end":{"line":7,"column":31},"identifierName":"target"}, "name": "target" } } @@ -884,102 +288,33 @@ }, { "type": "ClassProperty", - "start": 202, - "end": 223, - "loc": { - "start": { - "line": 8, - "column": 2 - }, - "end": { - "line": 8, - "column": 23 - } - }, + "start":202,"end":223,"loc":{"start":{"line":8,"column":2},"end":{"line":8,"column":23}}, "static": false, "key": { "type": "Identifier", - "start": 202, - "end": 203, - "loc": { - "start": { - "line": 8, - "column": 2 - }, - "end": { - "line": 8, - "column": 3 - }, - "identifierName": "g" - }, + "start":202,"end":203,"loc":{"start":{"line":8,"column":2},"end":{"line":8,"column":3},"identifierName":"g"}, "name": "g" }, "computed": false, "variance": null, "value": { "type": "ArrowFunctionExpression", - "start": 206, - "end": 222, - "loc": { - "start": { - "line": 8, - "column": 6 - }, - "end": { - "line": 8, - "column": 22 - } - }, + "start":206,"end":222,"loc":{"start":{"line":8,"column":6},"end":{"line":8,"column":22}}, "id": null, "generator": false, "async": false, "params": [], "body": { "type": "MetaProperty", - "start": 212, - "end": 222, - "loc": { - "start": { - "line": 8, - "column": 12 - }, - "end": { - "line": 8, - "column": 22 - } - }, + "start":212,"end":222,"loc":{"start":{"line":8,"column":12},"end":{"line":8,"column":22}}, "meta": { "type": "Identifier", - "start": 212, - "end": 215, - "loc": { - "start": { - "line": 8, - "column": 12 - }, - "end": { - "line": 8, - "column": 15 - }, - "identifierName": "new" - }, + "start":212,"end":215,"loc":{"start":{"line":8,"column":12},"end":{"line":8,"column":15},"identifierName":"new"}, "name": "new" }, "property": { "type": "Identifier", - "start": 216, - "end": 222, - "loc": { - "start": { - "line": 8, - "column": 16 - }, - "end": { - "line": 8, - "column": 22 - }, - "identifierName": "target" - }, + "start":216,"end":222,"loc":{"start":{"line":8,"column":16},"end":{"line":8,"column":22},"identifierName":"target"}, "name": "target" } } @@ -987,133 +322,41 @@ }, { "type": "ClassProperty", - "start": 226, - "end": 255, - "loc": { - "start": { - "line": 9, - "column": 2 - }, - "end": { - "line": 9, - "column": 31 - } - }, + "start":226,"end":255,"loc":{"start":{"line":9,"column":2},"end":{"line":9,"column":31}}, "static": false, "key": { "type": "Identifier", - "start": 226, - "end": 227, - "loc": { - "start": { - "line": 9, - "column": 2 - }, - "end": { - "line": 9, - "column": 3 - }, - "identifierName": "h" - }, + "start":226,"end":227,"loc":{"start":{"line":9,"column":2},"end":{"line":9,"column":3},"identifierName":"h"}, "name": "h" }, "computed": false, "variance": null, "value": { "type": "ArrowFunctionExpression", - "start": 230, - "end": 254, - "loc": { - "start": { - "line": 9, - "column": 6 - }, - "end": { - "line": 9, - "column": 30 - } - }, + "start":230,"end":254,"loc":{"start":{"line":9,"column":6},"end":{"line":9,"column":30}}, "id": null, "generator": false, "async": false, "params": [ { "type": "AssignmentPattern", - "start": 231, - "end": 247, - "loc": { - "start": { - "line": 9, - "column": 7 - }, - "end": { - "line": 9, - "column": 23 - } - }, + "start":231,"end":247,"loc":{"start":{"line":9,"column":7},"end":{"line":9,"column":23}}, "left": { "type": "Identifier", - "start": 231, - "end": 234, - "loc": { - "start": { - "line": 9, - "column": 7 - }, - "end": { - "line": 9, - "column": 10 - }, - "identifierName": "foo" - }, + "start":231,"end":234,"loc":{"start":{"line":9,"column":7},"end":{"line":9,"column":10},"identifierName":"foo"}, "name": "foo" }, "right": { "type": "MetaProperty", - "start": 237, - "end": 247, - "loc": { - "start": { - "line": 9, - "column": 13 - }, - "end": { - "line": 9, - "column": 23 - } - }, + "start":237,"end":247,"loc":{"start":{"line":9,"column":13},"end":{"line":9,"column":23}}, "meta": { "type": "Identifier", - "start": 237, - "end": 240, - "loc": { - "start": { - "line": 9, - "column": 13 - }, - "end": { - "line": 9, - "column": 16 - }, - "identifierName": "new" - }, + "start":237,"end":240,"loc":{"start":{"line":9,"column":13},"end":{"line":9,"column":16},"identifierName":"new"}, "name": "new" }, "property": { "type": "Identifier", - "start": 241, - "end": 247, - "loc": { - "start": { - "line": 9, - "column": 17 - }, - "end": { - "line": 9, - "column": 23 - }, - "identifierName": "target" - }, + "start":241,"end":247,"loc":{"start":{"line":9,"column":17},"end":{"line":9,"column":23},"identifierName":"target"}, "name": "target" } } @@ -1121,18 +364,7 @@ ], "body": { "type": "BlockStatement", - "start": 252, - "end": 254, - "loc": { - "start": { - "line": 9, - "column": 28 - }, - "end": { - "line": 9, - "column": 30 - } - }, + "start":252,"end":254,"loc":{"start":{"line":9,"column":28},"end":{"line":9,"column":30}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/experimental/class-properties/new-target/output.json b/packages/babel-parser/test/fixtures/experimental/class-properties/new-target/output.json index 909e3ddcd0a4..5f0cc9d12fbb 100644 --- a/packages/babel-parser/test/fixtures/experimental/class-properties/new-target/output.json +++ b/packages/babel-parser/test/fixtures/experimental/class-properties/new-target/output.json @@ -1,257 +1,75 @@ { "type": "File", - "start": 0, - "end": 257, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 10, - "column": 1 - } - }, + "start":0,"end":257,"loc":{"start":{"line":1,"column":0},"end":{"line":10,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 257, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 10, - "column": 1 - } - }, + "start":0,"end":257,"loc":{"start":{"line":1,"column":0},"end":{"line":10,"column":1}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 257, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 10, - "column": 1 - } - }, + "start":0,"end":257,"loc":{"start":{"line":1,"column":0},"end":{"line":10,"column":1}}, "id": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "X" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"X"}, "name": "X" }, "superClass": null, "body": { "type": "ClassBody", - "start": 8, - "end": 257, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 10, - "column": 1 - } - }, + "start":8,"end":257,"loc":{"start":{"line":1,"column":8},"end":{"line":10,"column":1}}, "body": [ { "type": "ClassProperty", - "start": 12, - "end": 34, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 24 - } - }, + "start":12,"end":34,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":24}}, "static": true, "key": { "type": "Identifier", - "start": 19, - "end": 20, - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 10 - }, - "identifierName": "a" - }, + "start":19,"end":20,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":10},"identifierName":"a"}, "name": "a" }, "computed": false, "value": { "type": "MetaProperty", - "start": 23, - "end": 33, - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 23 - } - }, + "start":23,"end":33,"loc":{"start":{"line":2,"column":13},"end":{"line":2,"column":23}}, "meta": { "type": "Identifier", - "start": 23, - "end": 26, - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 16 - }, - "identifierName": "new" - }, + "start":23,"end":26,"loc":{"start":{"line":2,"column":13},"end":{"line":2,"column":16},"identifierName":"new"}, "name": "new" }, "property": { "type": "Identifier", - "start": 27, - "end": 33, - "loc": { - "start": { - "line": 2, - "column": 17 - }, - "end": { - "line": 2, - "column": 23 - }, - "identifierName": "target" - }, + "start":27,"end":33,"loc":{"start":{"line":2,"column":17},"end":{"line":2,"column":23},"identifierName":"target"}, "name": "target" } } }, { "type": "ClassProperty", - "start": 37, - "end": 76, - "loc": { - "start": { - "line": 3, - "column": 2 - }, - "end": { - "line": 3, - "column": 41 - } - }, + "start":37,"end":76,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":41}}, "static": true, "key": { "type": "Identifier", - "start": 44, - "end": 45, - "loc": { - "start": { - "line": 3, - "column": 9 - }, - "end": { - "line": 3, - "column": 10 - }, - "identifierName": "b" - }, + "start":44,"end":45,"loc":{"start":{"line":3,"column":9},"end":{"line":3,"column":10},"identifierName":"b"}, "name": "b" }, "computed": false, "value": { "type": "AssignmentExpression", - "start": 49, - "end": 74, - "loc": { - "start": { - "line": 3, - "column": 14 - }, - "end": { - "line": 3, - "column": 39 - } - }, + "start":49,"end":74,"loc":{"start":{"line":3,"column":14},"end":{"line":3,"column":39}}, "operator": "=", "left": { "type": "Identifier", - "start": 49, - "end": 52, - "loc": { - "start": { - "line": 3, - "column": 14 - }, - "end": { - "line": 3, - "column": 17 - }, - "identifierName": "foo" - }, + "start":49,"end":52,"loc":{"start":{"line":3,"column":14},"end":{"line":3,"column":17},"identifierName":"foo"}, "name": "foo" }, "right": { "type": "BinaryExpression", - "start": 55, - "end": 74, - "loc": { - "start": { - "line": 3, - "column": 20 - }, - "end": { - "line": 3, - "column": 39 - } - }, + "start":55,"end":74,"loc":{"start":{"line":3,"column":20},"end":{"line":3,"column":39}}, "left": { "type": "NumericLiteral", - "start": 55, - "end": 56, - "loc": { - "start": { - "line": 3, - "column": 20 - }, - "end": { - "line": 3, - "column": 21 - } - }, + "start":55,"end":56,"loc":{"start":{"line":3,"column":20},"end":{"line":3,"column":21}}, "extra": { "rawValue": 1, "raw": "1" @@ -261,82 +79,24 @@ "operator": "+", "right": { "type": "CallExpression", - "start": 59, - "end": 74, - "loc": { - "start": { - "line": 3, - "column": 24 - }, - "end": { - "line": 3, - "column": 39 - } - }, + "start":59,"end":74,"loc":{"start":{"line":3,"column":24},"end":{"line":3,"column":39}}, "callee": { "type": "Identifier", - "start": 59, - "end": 62, - "loc": { - "start": { - "line": 3, - "column": 24 - }, - "end": { - "line": 3, - "column": 27 - }, - "identifierName": "bar" - }, + "start":59,"end":62,"loc":{"start":{"line":3,"column":24},"end":{"line":3,"column":27},"identifierName":"bar"}, "name": "bar" }, "arguments": [ { "type": "MetaProperty", - "start": 63, - "end": 73, - "loc": { - "start": { - "line": 3, - "column": 28 - }, - "end": { - "line": 3, - "column": 38 - } - }, + "start":63,"end":73,"loc":{"start":{"line":3,"column":28},"end":{"line":3,"column":38}}, "meta": { "type": "Identifier", - "start": 63, - "end": 66, - "loc": { - "start": { - "line": 3, - "column": 28 - }, - "end": { - "line": 3, - "column": 31 - }, - "identifierName": "new" - }, + "start":63,"end":66,"loc":{"start":{"line":3,"column":28},"end":{"line":3,"column":31},"identifierName":"new"}, "name": "new" }, "property": { "type": "Identifier", - "start": 67, - "end": 73, - "loc": { - "start": { - "line": 3, - "column": 32 - }, - "end": { - "line": 3, - "column": 38 - }, - "identifierName": "target" - }, + "start":67,"end":73,"loc":{"start":{"line":3,"column":32},"end":{"line":3,"column":38},"identifierName":"target"}, "name": "target" } } @@ -351,101 +111,32 @@ }, { "type": "ClassProperty", - "start": 79, - "end": 107, - "loc": { - "start": { - "line": 4, - "column": 2 - }, - "end": { - "line": 4, - "column": 30 - } - }, + "start":79,"end":107,"loc":{"start":{"line":4,"column":2},"end":{"line":4,"column":30}}, "static": true, "key": { "type": "Identifier", - "start": 86, - "end": 87, - "loc": { - "start": { - "line": 4, - "column": 9 - }, - "end": { - "line": 4, - "column": 10 - }, - "identifierName": "c" - }, + "start":86,"end":87,"loc":{"start":{"line":4,"column":9},"end":{"line":4,"column":10},"identifierName":"c"}, "name": "c" }, "computed": false, "value": { "type": "ArrowFunctionExpression", - "start": 90, - "end": 106, - "loc": { - "start": { - "line": 4, - "column": 13 - }, - "end": { - "line": 4, - "column": 29 - } - }, + "start":90,"end":106,"loc":{"start":{"line":4,"column":13},"end":{"line":4,"column":29}}, "id": null, "generator": false, "async": false, "params": [], "body": { "type": "MetaProperty", - "start": 96, - "end": 106, - "loc": { - "start": { - "line": 4, - "column": 19 - }, - "end": { - "line": 4, - "column": 29 - } - }, + "start":96,"end":106,"loc":{"start":{"line":4,"column":19},"end":{"line":4,"column":29}}, "meta": { "type": "Identifier", - "start": 96, - "end": 99, - "loc": { - "start": { - "line": 4, - "column": 19 - }, - "end": { - "line": 4, - "column": 22 - }, - "identifierName": "new" - }, + "start":96,"end":99,"loc":{"start":{"line":4,"column":19},"end":{"line":4,"column":22},"identifierName":"new"}, "name": "new" }, "property": { "type": "Identifier", - "start": 100, - "end": 106, - "loc": { - "start": { - "line": 4, - "column": 23 - }, - "end": { - "line": 4, - "column": 29 - }, - "identifierName": "target" - }, + "start":100,"end":106,"loc":{"start":{"line":4,"column":23},"end":{"line":4,"column":29},"identifierName":"target"}, "name": "target" } } @@ -453,132 +144,40 @@ }, { "type": "ClassProperty", - "start": 110, - "end": 146, - "loc": { - "start": { - "line": 5, - "column": 2 - }, - "end": { - "line": 5, - "column": 38 - } - }, + "start":110,"end":146,"loc":{"start":{"line":5,"column":2},"end":{"line":5,"column":38}}, "static": true, "key": { "type": "Identifier", - "start": 117, - "end": 118, - "loc": { - "start": { - "line": 5, - "column": 9 - }, - "end": { - "line": 5, - "column": 10 - }, - "identifierName": "d" - }, + "start":117,"end":118,"loc":{"start":{"line":5,"column":9},"end":{"line":5,"column":10},"identifierName":"d"}, "name": "d" }, "computed": false, "value": { "type": "ArrowFunctionExpression", - "start": 121, - "end": 145, - "loc": { - "start": { - "line": 5, - "column": 13 - }, - "end": { - "line": 5, - "column": 37 - } - }, + "start":121,"end":145,"loc":{"start":{"line":5,"column":13},"end":{"line":5,"column":37}}, "id": null, "generator": false, "async": false, "params": [ { "type": "AssignmentPattern", - "start": 122, - "end": 138, - "loc": { - "start": { - "line": 5, - "column": 14 - }, - "end": { - "line": 5, - "column": 30 - } - }, + "start":122,"end":138,"loc":{"start":{"line":5,"column":14},"end":{"line":5,"column":30}}, "left": { "type": "Identifier", - "start": 122, - "end": 125, - "loc": { - "start": { - "line": 5, - "column": 14 - }, - "end": { - "line": 5, - "column": 17 - }, - "identifierName": "foo" - }, + "start":122,"end":125,"loc":{"start":{"line":5,"column":14},"end":{"line":5,"column":17},"identifierName":"foo"}, "name": "foo" }, "right": { "type": "MetaProperty", - "start": 128, - "end": 138, - "loc": { - "start": { - "line": 5, - "column": 20 - }, - "end": { - "line": 5, - "column": 30 - } - }, + "start":128,"end":138,"loc":{"start":{"line":5,"column":20},"end":{"line":5,"column":30}}, "meta": { "type": "Identifier", - "start": 128, - "end": 131, - "loc": { - "start": { - "line": 5, - "column": 20 - }, - "end": { - "line": 5, - "column": 23 - }, - "identifierName": "new" - }, + "start":128,"end":131,"loc":{"start":{"line":5,"column":20},"end":{"line":5,"column":23},"identifierName":"new"}, "name": "new" }, "property": { "type": "Identifier", - "start": 132, - "end": 138, - "loc": { - "start": { - "line": 5, - "column": 24 - }, - "end": { - "line": 5, - "column": 30 - }, - "identifierName": "target" - }, + "start":132,"end":138,"loc":{"start":{"line":5,"column":24},"end":{"line":5,"column":30},"identifierName":"target"}, "name": "target" } } @@ -586,18 +185,7 @@ ], "body": { "type": "BlockStatement", - "start": 143, - "end": 145, - "loc": { - "start": { - "line": 5, - "column": 35 - }, - "end": { - "line": 5, - "column": 37 - } - }, + "start":143,"end":145,"loc":{"start":{"line":5,"column":35},"end":{"line":5,"column":37}}, "body": [], "directives": [] } @@ -605,180 +193,54 @@ }, { "type": "ClassProperty", - "start": 149, - "end": 164, - "loc": { - "start": { - "line": 6, - "column": 2 - }, - "end": { - "line": 6, - "column": 17 - } - }, + "start":149,"end":164,"loc":{"start":{"line":6,"column":2},"end":{"line":6,"column":17}}, "static": false, "key": { "type": "Identifier", - "start": 149, - "end": 150, - "loc": { - "start": { - "line": 6, - "column": 2 - }, - "end": { - "line": 6, - "column": 3 - }, - "identifierName": "e" - }, + "start":149,"end":150,"loc":{"start":{"line":6,"column":2},"end":{"line":6,"column":3},"identifierName":"e"}, "name": "e" }, "computed": false, "value": { "type": "MetaProperty", - "start": 153, - "end": 163, - "loc": { - "start": { - "line": 6, - "column": 6 - }, - "end": { - "line": 6, - "column": 16 - } - }, + "start":153,"end":163,"loc":{"start":{"line":6,"column":6},"end":{"line":6,"column":16}}, "meta": { "type": "Identifier", - "start": 153, - "end": 156, - "loc": { - "start": { - "line": 6, - "column": 6 - }, - "end": { - "line": 6, - "column": 9 - }, - "identifierName": "new" - }, + "start":153,"end":156,"loc":{"start":{"line":6,"column":6},"end":{"line":6,"column":9},"identifierName":"new"}, "name": "new" }, "property": { "type": "Identifier", - "start": 157, - "end": 163, - "loc": { - "start": { - "line": 6, - "column": 10 - }, - "end": { - "line": 6, - "column": 16 - }, - "identifierName": "target" - }, + "start":157,"end":163,"loc":{"start":{"line":6,"column":10},"end":{"line":6,"column":16},"identifierName":"target"}, "name": "target" } } }, { "type": "ClassProperty", - "start": 167, - "end": 199, - "loc": { - "start": { - "line": 7, - "column": 2 - }, - "end": { - "line": 7, - "column": 34 - } - }, + "start":167,"end":199,"loc":{"start":{"line":7,"column":2},"end":{"line":7,"column":34}}, "static": false, "key": { "type": "Identifier", - "start": 167, - "end": 168, - "loc": { - "start": { - "line": 7, - "column": 2 - }, - "end": { - "line": 7, - "column": 3 - }, - "identifierName": "f" - }, + "start":167,"end":168,"loc":{"start":{"line":7,"column":2},"end":{"line":7,"column":3},"identifierName":"f"}, "name": "f" }, "computed": false, "value": { "type": "AssignmentExpression", - "start": 172, - "end": 197, - "loc": { - "start": { - "line": 7, - "column": 7 - }, - "end": { - "line": 7, - "column": 32 - } - }, + "start":172,"end":197,"loc":{"start":{"line":7,"column":7},"end":{"line":7,"column":32}}, "operator": "=", "left": { "type": "Identifier", - "start": 172, - "end": 175, - "loc": { - "start": { - "line": 7, - "column": 7 - }, - "end": { - "line": 7, - "column": 10 - }, - "identifierName": "foo" - }, + "start":172,"end":175,"loc":{"start":{"line":7,"column":7},"end":{"line":7,"column":10},"identifierName":"foo"}, "name": "foo" }, "right": { "type": "BinaryExpression", - "start": 178, - "end": 197, - "loc": { - "start": { - "line": 7, - "column": 13 - }, - "end": { - "line": 7, - "column": 32 - } - }, + "start":178,"end":197,"loc":{"start":{"line":7,"column":13},"end":{"line":7,"column":32}}, "left": { "type": "NumericLiteral", - "start": 178, - "end": 179, - "loc": { - "start": { - "line": 7, - "column": 13 - }, - "end": { - "line": 7, - "column": 14 - } - }, + "start":178,"end":179,"loc":{"start":{"line":7,"column":13},"end":{"line":7,"column":14}}, "extra": { "rawValue": 1, "raw": "1" @@ -788,82 +250,24 @@ "operator": "+", "right": { "type": "CallExpression", - "start": 182, - "end": 197, - "loc": { - "start": { - "line": 7, - "column": 17 - }, - "end": { - "line": 7, - "column": 32 - } - }, + "start":182,"end":197,"loc":{"start":{"line":7,"column":17},"end":{"line":7,"column":32}}, "callee": { "type": "Identifier", - "start": 182, - "end": 185, - "loc": { - "start": { - "line": 7, - "column": 17 - }, - "end": { - "line": 7, - "column": 20 - }, - "identifierName": "bar" - }, + "start":182,"end":185,"loc":{"start":{"line":7,"column":17},"end":{"line":7,"column":20},"identifierName":"bar"}, "name": "bar" }, "arguments": [ { "type": "MetaProperty", - "start": 186, - "end": 196, - "loc": { - "start": { - "line": 7, - "column": 21 - }, - "end": { - "line": 7, - "column": 31 - } - }, + "start":186,"end":196,"loc":{"start":{"line":7,"column":21},"end":{"line":7,"column":31}}, "meta": { "type": "Identifier", - "start": 186, - "end": 189, - "loc": { - "start": { - "line": 7, - "column": 21 - }, - "end": { - "line": 7, - "column": 24 - }, - "identifierName": "new" - }, + "start":186,"end":189,"loc":{"start":{"line":7,"column":21},"end":{"line":7,"column":24},"identifierName":"new"}, "name": "new" }, "property": { "type": "Identifier", - "start": 190, - "end": 196, - "loc": { - "start": { - "line": 7, - "column": 25 - }, - "end": { - "line": 7, - "column": 31 - }, - "identifierName": "target" - }, + "start":190,"end":196,"loc":{"start":{"line":7,"column":25},"end":{"line":7,"column":31},"identifierName":"target"}, "name": "target" } } @@ -878,101 +282,32 @@ }, { "type": "ClassProperty", - "start": 202, - "end": 223, - "loc": { - "start": { - "line": 8, - "column": 2 - }, - "end": { - "line": 8, - "column": 23 - } - }, + "start":202,"end":223,"loc":{"start":{"line":8,"column":2},"end":{"line":8,"column":23}}, "static": false, "key": { "type": "Identifier", - "start": 202, - "end": 203, - "loc": { - "start": { - "line": 8, - "column": 2 - }, - "end": { - "line": 8, - "column": 3 - }, - "identifierName": "g" - }, + "start":202,"end":203,"loc":{"start":{"line":8,"column":2},"end":{"line":8,"column":3},"identifierName":"g"}, "name": "g" }, "computed": false, "value": { "type": "ArrowFunctionExpression", - "start": 206, - "end": 222, - "loc": { - "start": { - "line": 8, - "column": 6 - }, - "end": { - "line": 8, - "column": 22 - } - }, + "start":206,"end":222,"loc":{"start":{"line":8,"column":6},"end":{"line":8,"column":22}}, "id": null, "generator": false, "async": false, "params": [], "body": { "type": "MetaProperty", - "start": 212, - "end": 222, - "loc": { - "start": { - "line": 8, - "column": 12 - }, - "end": { - "line": 8, - "column": 22 - } - }, + "start":212,"end":222,"loc":{"start":{"line":8,"column":12},"end":{"line":8,"column":22}}, "meta": { "type": "Identifier", - "start": 212, - "end": 215, - "loc": { - "start": { - "line": 8, - "column": 12 - }, - "end": { - "line": 8, - "column": 15 - }, - "identifierName": "new" - }, + "start":212,"end":215,"loc":{"start":{"line":8,"column":12},"end":{"line":8,"column":15},"identifierName":"new"}, "name": "new" }, "property": { "type": "Identifier", - "start": 216, - "end": 222, - "loc": { - "start": { - "line": 8, - "column": 16 - }, - "end": { - "line": 8, - "column": 22 - }, - "identifierName": "target" - }, + "start":216,"end":222,"loc":{"start":{"line":8,"column":16},"end":{"line":8,"column":22},"identifierName":"target"}, "name": "target" } } @@ -980,132 +315,40 @@ }, { "type": "ClassProperty", - "start": 226, - "end": 255, - "loc": { - "start": { - "line": 9, - "column": 2 - }, - "end": { - "line": 9, - "column": 31 - } - }, + "start":226,"end":255,"loc":{"start":{"line":9,"column":2},"end":{"line":9,"column":31}}, "static": false, "key": { "type": "Identifier", - "start": 226, - "end": 227, - "loc": { - "start": { - "line": 9, - "column": 2 - }, - "end": { - "line": 9, - "column": 3 - }, - "identifierName": "h" - }, + "start":226,"end":227,"loc":{"start":{"line":9,"column":2},"end":{"line":9,"column":3},"identifierName":"h"}, "name": "h" }, "computed": false, "value": { "type": "ArrowFunctionExpression", - "start": 230, - "end": 254, - "loc": { - "start": { - "line": 9, - "column": 6 - }, - "end": { - "line": 9, - "column": 30 - } - }, + "start":230,"end":254,"loc":{"start":{"line":9,"column":6},"end":{"line":9,"column":30}}, "id": null, "generator": false, "async": false, "params": [ { "type": "AssignmentPattern", - "start": 231, - "end": 247, - "loc": { - "start": { - "line": 9, - "column": 7 - }, - "end": { - "line": 9, - "column": 23 - } - }, + "start":231,"end":247,"loc":{"start":{"line":9,"column":7},"end":{"line":9,"column":23}}, "left": { "type": "Identifier", - "start": 231, - "end": 234, - "loc": { - "start": { - "line": 9, - "column": 7 - }, - "end": { - "line": 9, - "column": 10 - }, - "identifierName": "foo" - }, + "start":231,"end":234,"loc":{"start":{"line":9,"column":7},"end":{"line":9,"column":10},"identifierName":"foo"}, "name": "foo" }, "right": { "type": "MetaProperty", - "start": 237, - "end": 247, - "loc": { - "start": { - "line": 9, - "column": 13 - }, - "end": { - "line": 9, - "column": 23 - } - }, + "start":237,"end":247,"loc":{"start":{"line":9,"column":13},"end":{"line":9,"column":23}}, "meta": { "type": "Identifier", - "start": 237, - "end": 240, - "loc": { - "start": { - "line": 9, - "column": 13 - }, - "end": { - "line": 9, - "column": 16 - }, - "identifierName": "new" - }, + "start":237,"end":240,"loc":{"start":{"line":9,"column":13},"end":{"line":9,"column":16},"identifierName":"new"}, "name": "new" }, "property": { "type": "Identifier", - "start": 241, - "end": 247, - "loc": { - "start": { - "line": 9, - "column": 17 - }, - "end": { - "line": 9, - "column": 23 - }, - "identifierName": "target" - }, + "start":241,"end":247,"loc":{"start":{"line":9,"column":17},"end":{"line":9,"column":23},"identifierName":"target"}, "name": "target" } } @@ -1113,18 +356,7 @@ ], "body": { "type": "BlockStatement", - "start": 252, - "end": 254, - "loc": { - "start": { - "line": 9, - "column": 28 - }, - "end": { - "line": 9, - "column": 30 - } - }, + "start":252,"end":254,"loc":{"start":{"line":9,"column":28},"end":{"line":9,"column":30}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/experimental/class-properties/no-ctor-2/options.json b/packages/babel-parser/test/fixtures/experimental/class-properties/no-ctor-2/options.json index 9884529d32d7..9c27576d4ad0 100644 --- a/packages/babel-parser/test/fixtures/experimental/class-properties/no-ctor-2/options.json +++ b/packages/babel-parser/test/fixtures/experimental/class-properties/no-ctor-2/options.json @@ -1,4 +1,3 @@ { - "throws": "Classes may not have a non-static field named 'constructor' (2:2)", "plugins": ["classProperties"] } diff --git a/packages/babel-parser/test/fixtures/experimental/class-properties/no-ctor-2/output.json b/packages/babel-parser/test/fixtures/experimental/class-properties/no-ctor-2/output.json new file mode 100644 index 000000000000..9d09ab7b33e5 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-properties/no-ctor-2/output.json @@ -0,0 +1,66 @@ +{ + "type": "File", + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "errors": [ + "SyntaxError: Classes may not have a field named 'constructor' (2:2)" + ], + "program": { + "type": "Program", + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "id": { + "type": "Identifier", + "start":6,"end":9,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":9},"identifierName":"Foo"}, + "name": "Foo" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":10,"end":36,"loc":{"start":{"line":1,"column":10},"end":{"line":4,"column":1}}, + "body": [ + { + "type": "ClassProperty", + "start":14,"end":25,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":13}}, + "static": false, + "key": { + "type": "Identifier", + "start":14,"end":25,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":13},"identifierName":"constructor"}, + "name": "constructor" + }, + "computed": false, + "value": null + }, + { + "type": "ClassMethod", + "start":28,"end":34,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":8}}, + "static": false, + "kind": "method", + "key": { + "type": "Identifier", + "start":29,"end":30,"loc":{"start":{"line":3,"column":3},"end":{"line":3,"column":4},"identifierName":"x"}, + "name": "x" + }, + "computed": false, + "id": null, + "generator": true, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":32,"end":34,"loc":{"start":{"line":3,"column":6},"end":{"line":3,"column":8}}, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-properties/no-ctor/options.json b/packages/babel-parser/test/fixtures/experimental/class-properties/no-ctor/options.json index 9884529d32d7..9c27576d4ad0 100644 --- a/packages/babel-parser/test/fixtures/experimental/class-properties/no-ctor/options.json +++ b/packages/babel-parser/test/fixtures/experimental/class-properties/no-ctor/options.json @@ -1,4 +1,3 @@ { - "throws": "Classes may not have a non-static field named 'constructor' (2:2)", "plugins": ["classProperties"] } diff --git a/packages/babel-parser/test/fixtures/experimental/class-properties/no-ctor/output.json b/packages/babel-parser/test/fixtures/experimental/class-properties/no-ctor/output.json new file mode 100644 index 000000000000..67687aa331a8 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-properties/no-ctor/output.json @@ -0,0 +1,44 @@ +{ + "type": "File", + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "errors": [ + "SyntaxError: Classes may not have a field named 'constructor' (2:2)" + ], + "program": { + "type": "Program", + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "id": { + "type": "Identifier", + "start":6,"end":9,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":9},"identifierName":"Foo"}, + "name": "Foo" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":10,"end":27,"loc":{"start":{"line":1,"column":10},"end":{"line":3,"column":1}}, + "body": [ + { + "type": "ClassProperty", + "start":14,"end":25,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":13}}, + "static": false, + "key": { + "type": "Identifier", + "start":14,"end":25,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":13},"identifierName":"constructor"}, + "name": "constructor" + }, + "computed": false, + "value": null + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-properties/no-static-prototype-2/options.json b/packages/babel-parser/test/fixtures/experimental/class-properties/no-static-prototype-2/options.json index 5bde2716ebdd..9c27576d4ad0 100644 --- a/packages/babel-parser/test/fixtures/experimental/class-properties/no-static-prototype-2/options.json +++ b/packages/babel-parser/test/fixtures/experimental/class-properties/no-static-prototype-2/options.json @@ -1,4 +1,3 @@ { - "throws": "Classes may not have static property named prototype (2:9)", "plugins": ["classProperties"] } diff --git a/packages/babel-parser/test/fixtures/experimental/class-properties/no-static-prototype-2/output.json b/packages/babel-parser/test/fixtures/experimental/class-properties/no-static-prototype-2/output.json new file mode 100644 index 000000000000..2850861ad8fc --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-properties/no-static-prototype-2/output.json @@ -0,0 +1,66 @@ +{ + "type": "File", + "start":0,"end":41,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "errors": [ + "SyntaxError: Classes may not have static property named prototype (2:9)" + ], + "program": { + "type": "Program", + "start":0,"end":41,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start":0,"end":41,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "id": { + "type": "Identifier", + "start":6,"end":9,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":9},"identifierName":"Foo"}, + "name": "Foo" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":10,"end":41,"loc":{"start":{"line":1,"column":10},"end":{"line":4,"column":1}}, + "body": [ + { + "type": "ClassProperty", + "start":14,"end":30,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":18}}, + "static": true, + "key": { + "type": "Identifier", + "start":21,"end":30,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":18},"identifierName":"prototype"}, + "name": "prototype" + }, + "computed": false, + "value": null + }, + { + "type": "ClassMethod", + "start":33,"end":39,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":8}}, + "static": false, + "kind": "method", + "key": { + "type": "Identifier", + "start":34,"end":35,"loc":{"start":{"line":3,"column":3},"end":{"line":3,"column":4},"identifierName":"x"}, + "name": "x" + }, + "computed": false, + "id": null, + "generator": true, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":37,"end":39,"loc":{"start":{"line":3,"column":6},"end":{"line":3,"column":8}}, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-properties/no-static-prototype/options.json b/packages/babel-parser/test/fixtures/experimental/class-properties/no-static-prototype/options.json index 5bde2716ebdd..9c27576d4ad0 100644 --- a/packages/babel-parser/test/fixtures/experimental/class-properties/no-static-prototype/options.json +++ b/packages/babel-parser/test/fixtures/experimental/class-properties/no-static-prototype/options.json @@ -1,4 +1,3 @@ { - "throws": "Classes may not have static property named prototype (2:9)", "plugins": ["classProperties"] } diff --git a/packages/babel-parser/test/fixtures/experimental/class-properties/no-static-prototype/output.json b/packages/babel-parser/test/fixtures/experimental/class-properties/no-static-prototype/output.json new file mode 100644 index 000000000000..2e1a73e9731d --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-properties/no-static-prototype/output.json @@ -0,0 +1,44 @@ +{ + "type": "File", + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "errors": [ + "SyntaxError: Classes may not have static property named prototype (2:9)" + ], + "program": { + "type": "Program", + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "id": { + "type": "Identifier", + "start":6,"end":9,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":9},"identifierName":"Foo"}, + "name": "Foo" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":10,"end":32,"loc":{"start":{"line":1,"column":10},"end":{"line":3,"column":1}}, + "body": [ + { + "type": "ClassProperty", + "start":14,"end":30,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":18}}, + "static": true, + "key": { + "type": "Identifier", + "start":21,"end":30,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":18},"identifierName":"prototype"}, + "name": "prototype" + }, + "computed": false, + "value": null + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-properties/static-field-named-constructor/input.js b/packages/babel-parser/test/fixtures/experimental/class-properties/static-field-named-constructor/input.js new file mode 100644 index 000000000000..d9180dcec0cc --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-properties/static-field-named-constructor/input.js @@ -0,0 +1,3 @@ +class Foo { + static constructor; +} diff --git a/packages/babel-parser/test/fixtures/experimental/class-properties/static-field-named-constructor/options.json b/packages/babel-parser/test/fixtures/experimental/class-properties/static-field-named-constructor/options.json new file mode 100644 index 000000000000..9c27576d4ad0 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-properties/static-field-named-constructor/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["classProperties"] +} diff --git a/packages/babel-parser/test/fixtures/experimental/class-properties/static-field-named-constructor/output.json b/packages/babel-parser/test/fixtures/experimental/class-properties/static-field-named-constructor/output.json new file mode 100644 index 000000000000..789ddb0c28e4 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-properties/static-field-named-constructor/output.json @@ -0,0 +1,44 @@ +{ + "type": "File", + "start":0,"end":37,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "errors": [ + "SyntaxError: Classes may not have a field named 'constructor' (2:11)" + ], + "program": { + "type": "Program", + "start":0,"end":37,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start":0,"end":37,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "id": { + "type": "Identifier", + "start":6,"end":9,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":9},"identifierName":"Foo"}, + "name": "Foo" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":10,"end":37,"loc":{"start":{"line":1,"column":10},"end":{"line":3,"column":1}}, + "body": [ + { + "type": "ClassProperty", + "start":16,"end":35,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":23}}, + "static": true, + "key": { + "type": "Identifier", + "start":23,"end":34,"loc":{"start":{"line":2,"column":11},"end":{"line":2,"column":22},"identifierName":"constructor"}, + "name": "constructor" + }, + "computed": false, + "value": null + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-properties/super-call/options.json b/packages/babel-parser/test/fixtures/experimental/class-properties/super-call/options.json index e8d509e27740..9c27576d4ad0 100644 --- a/packages/babel-parser/test/fixtures/experimental/class-properties/super-call/options.json +++ b/packages/babel-parser/test/fixtures/experimental/class-properties/super-call/options.json @@ -1,4 +1,3 @@ { - "plugins": ["classProperties"], - "throws": "super() is only valid inside a class constructor of a subclass. Maybe a typo in the method name ('constructor') or not extending another class? (4:12)" + "plugins": ["classProperties"] } diff --git a/packages/babel-parser/test/fixtures/experimental/class-properties/super-call/output.json b/packages/babel-parser/test/fixtures/experimental/class-properties/super-call/output.json new file mode 100644 index 000000000000..e93888eeb6f2 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-properties/super-call/output.json @@ -0,0 +1,99 @@ +{ + "type": "File", + "start":0,"end":94,"loc":{"start":{"line":1,"column":0},"end":{"line":7,"column":1}}, + "errors": [ + "SyntaxError: super() is only valid inside a class constructor of a subclass. Maybe a typo in the method name ('constructor') or not extending another class? (4:12)" + ], + "program": { + "type": "Program", + "start":0,"end":94,"loc":{"start":{"line":1,"column":0},"end":{"line":7,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start":0,"end":94,"loc":{"start":{"line":1,"column":0},"end":{"line":7,"column":1}}, + "id": { + "type": "Identifier", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, + "name": "A" + }, + "superClass": { + "type": "Identifier", + "start":16,"end":17,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":17},"identifierName":"B"}, + "name": "B" + }, + "body": { + "type": "ClassBody", + "start":18,"end":94,"loc":{"start":{"line":1,"column":18},"end":{"line":7,"column":1}}, + "body": [ + { + "type": "ClassMethod", + "start":22,"end":92,"loc":{"start":{"line":2,"column":2},"end":{"line":6,"column":3}}, + "static": false, + "key": { + "type": "Identifier", + "start":22,"end":33,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":13},"identifierName":"constructor"}, + "name": "constructor" + }, + "computed": false, + "kind": "constructor", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":36,"end":92,"loc":{"start":{"line":2,"column":16},"end":{"line":6,"column":3}}, + "body": [ + { + "type": "ClassDeclaration", + "start":42,"end":88,"loc":{"start":{"line":3,"column":4},"end":{"line":5,"column":5}}, + "id": { + "type": "Identifier", + "start":48,"end":49,"loc":{"start":{"line":3,"column":10},"end":{"line":3,"column":11},"identifierName":"C"}, + "name": "C" + }, + "superClass": { + "type": "Identifier", + "start":58,"end":59,"loc":{"start":{"line":3,"column":20},"end":{"line":3,"column":21},"identifierName":"D"}, + "name": "D" + }, + "body": { + "type": "ClassBody", + "start":60,"end":88,"loc":{"start":{"line":3,"column":22},"end":{"line":5,"column":5}}, + "body": [ + { + "type": "ClassProperty", + "start":68,"end":82,"loc":{"start":{"line":4,"column":6},"end":{"line":4,"column":20}}, + "static": false, + "key": { + "type": "Identifier", + "start":68,"end":71,"loc":{"start":{"line":4,"column":6},"end":{"line":4,"column":9},"identifierName":"foo"}, + "name": "foo" + }, + "computed": false, + "value": { + "type": "CallExpression", + "start":74,"end":81,"loc":{"start":{"line":4,"column":12},"end":{"line":4,"column":19}}, + "callee": { + "type": "Super", + "start":74,"end":79,"loc":{"start":{"line":4,"column":12},"end":{"line":4,"column":17}} + }, + "arguments": [] + } + } + ] + } + } + ], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-properties/super-inside-arrow-function/output.json b/packages/babel-parser/test/fixtures/experimental/class-properties/super-inside-arrow-function/output.json index d411c6ff6e6f..7b6feb810065 100644 --- a/packages/babel-parser/test/fixtures/experimental/class-properties/super-inside-arrow-function/output.json +++ b/packages/babel-parser/test/fixtures/experimental/class-properties/super-inside-arrow-function/output.json @@ -1,206 +1,59 @@ { "type": "File", - "start": 0, - "end": 46, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":46,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 46, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":46,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 46, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":46,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "id": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "A" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, "name": "A" }, "superClass": { "type": "Identifier", - "start": 16, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - }, - "identifierName": "B" - }, + "start":16,"end":17,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":17},"identifierName":"B"}, "name": "B" }, "body": { "type": "ClassBody", - "start": 18, - "end": 46, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":18,"end":46,"loc":{"start":{"line":1,"column":18},"end":{"line":3,"column":1}}, "body": [ { "type": "ClassProperty", - "start": 22, - "end": 44, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 24 - } - }, + "start":22,"end":44,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":24}}, "static": false, "key": { "type": "Identifier", - "start": 22, - "end": 25, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 5 - }, - "identifierName": "foo" - }, + "start":22,"end":25,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":5},"identifierName":"foo"}, "name": "foo" }, "computed": false, "value": { "type": "ArrowFunctionExpression", - "start": 28, - "end": 43, - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 23 - } - }, + "start":28,"end":43,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":23}}, "id": null, "generator": false, "async": false, "params": [], "body": { "type": "CallExpression", - "start": 34, - "end": 43, - "loc": { - "start": { - "line": 2, - "column": 14 - }, - "end": { - "line": 2, - "column": 23 - } - }, + "start":34,"end":43,"loc":{"start":{"line":2,"column":14},"end":{"line":2,"column":23}}, "callee": { "type": "MemberExpression", - "start": 34, - "end": 41, - "loc": { - "start": { - "line": 2, - "column": 14 - }, - "end": { - "line": 2, - "column": 21 - } - }, + "start":34,"end":41,"loc":{"start":{"line":2,"column":14},"end":{"line":2,"column":21}}, "object": { "type": "Super", - "start": 34, - "end": 39, - "loc": { - "start": { - "line": 2, - "column": 14 - }, - "end": { - "line": 2, - "column": 19 - } - } + "start":34,"end":39,"loc":{"start":{"line":2,"column":14},"end":{"line":2,"column":19}} }, "property": { "type": "Identifier", - "start": 40, - "end": 41, - "loc": { - "start": { - "line": 2, - "column": 20 - }, - "end": { - "line": 2, - "column": 21 - }, - "identifierName": "x" - }, + "start":40,"end":41,"loc":{"start":{"line":2,"column":20},"end":{"line":2,"column":21},"identifierName":"x"}, "name": "x" }, "computed": false diff --git a/packages/babel-parser/test/fixtures/experimental/class-properties/super-inside-function/options.json b/packages/babel-parser/test/fixtures/experimental/class-properties/super-inside-function/options.json index 386c2968e7b0..9c27576d4ad0 100644 --- a/packages/babel-parser/test/fixtures/experimental/class-properties/super-inside-function/options.json +++ b/packages/babel-parser/test/fixtures/experimental/class-properties/super-inside-function/options.json @@ -1,4 +1,3 @@ { - "plugins": ["classProperties"], - "throws": "super is only allowed in object methods and classes (3:4)" + "plugins": ["classProperties"] } diff --git a/packages/babel-parser/test/fixtures/experimental/class-properties/super-inside-function/output.json b/packages/babel-parser/test/fixtures/experimental/class-properties/super-inside-function/output.json new file mode 100644 index 000000000000..c69a435a1046 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-properties/super-inside-function/output.json @@ -0,0 +1,85 @@ +{ + "type": "File", + "start":0,"end":54,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, + "errors": [ + "SyntaxError: super is only allowed in object methods and classes (3:4)" + ], + "program": { + "type": "Program", + "start":0,"end":54,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start":0,"end":54,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, + "id": { + "type": "Identifier", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":8,"end":54,"loc":{"start":{"line":1,"column":8},"end":{"line":5,"column":1}}, + "body": [ + { + "type": "ClassProperty", + "start":12,"end":52,"loc":{"start":{"line":2,"column":2},"end":{"line":4,"column":3}}, + "static": false, + "key": { + "type": "Identifier", + "start":12,"end":15,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":5},"identifierName":"foo"}, + "name": "foo" + }, + "computed": false, + "value": { + "type": "FunctionExpression", + "start":18,"end":52,"loc":{"start":{"line":2,"column":8},"end":{"line":4,"column":3}}, + "id": { + "type": "Identifier", + "start":27,"end":29,"loc":{"start":{"line":2,"column":17},"end":{"line":2,"column":19},"identifierName":"fn"}, + "name": "fn" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":32,"end":52,"loc":{"start":{"line":2,"column":22},"end":{"line":4,"column":3}}, + "body": [ + { + "type": "ExpressionStatement", + "start":38,"end":48,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":14}}, + "expression": { + "type": "CallExpression", + "start":38,"end":47,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":13}}, + "callee": { + "type": "MemberExpression", + "start":38,"end":45,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":11}}, + "object": { + "type": "Super", + "start":38,"end":43,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":9}} + }, + "property": { + "type": "Identifier", + "start":44,"end":45,"loc":{"start":{"line":3,"column":10},"end":{"line":3,"column":11},"identifierName":"x"}, + "name": "x" + }, + "computed": false + }, + "arguments": [] + } + } + ], + "directives": [] + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-properties/super/output.json b/packages/babel-parser/test/fixtures/experimental/class-properties/super/output.json index 75716a4009d7..6952e399c10a 100644 --- a/packages/babel-parser/test/fixtures/experimental/class-properties/super/output.json +++ b/packages/babel-parser/test/fixtures/experimental/class-properties/super/output.json @@ -1,126 +1,36 @@ { "type": "File", - "start": 0, - "end": 56, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":56,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 56, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":56,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 56, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":56,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "id": { "type": "Identifier", - "start": 6, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "Fails" - }, + "start":6,"end":11,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":11},"identifierName":"Fails"}, "name": "Fails" }, "superClass": { "type": "ClassExpression", - "start": 20, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":20,"end":35,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":35}}, "id": null, "superClass": null, "body": { "type": "ClassBody", - "start": 26, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":26,"end":35,"loc":{"start":{"line":1,"column":26},"end":{"line":1,"column":35}}, "body": [ { "type": "ClassMethod", - "start": 28, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":28,"end":33,"loc":{"start":{"line":1,"column":28},"end":{"line":1,"column":33}}, "static": false, "key": { "type": "Identifier", - "start": 28, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 29 - }, - "identifierName": "c" - }, + "start":28,"end":29,"loc":{"start":{"line":1,"column":28},"end":{"line":1,"column":29},"identifierName":"c"}, "name": "c" }, "computed": false, @@ -131,18 +41,7 @@ "params": [], "body": { "type": "BlockStatement", - "start": 31, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 31 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":31,"end":33,"loc":{"start":{"line":1,"column":31},"end":{"line":1,"column":33}}, "body": [], "directives": [] } @@ -152,110 +51,31 @@ }, "body": { "type": "ClassBody", - "start": 36, - "end": 56, - "loc": { - "start": { - "line": 1, - "column": 36 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":36,"end":56,"loc":{"start":{"line":1,"column":36},"end":{"line":3,"column":1}}, "body": [ { "type": "ClassProperty", - "start": 40, - "end": 54, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 16 - } - }, + "start":40,"end":54,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":16}}, "static": false, "key": { "type": "Identifier", - "start": 40, - "end": 41, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 3 - }, - "identifierName": "c" - }, + "start":40,"end":41,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":3},"identifierName":"c"}, "name": "c" }, "computed": false, "value": { "type": "CallExpression", - "start": 44, - "end": 53, - "loc": { - "start": { - "line": 2, - "column": 6 - }, - "end": { - "line": 2, - "column": 15 - } - }, + "start":44,"end":53,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":15}}, "callee": { "type": "MemberExpression", - "start": 44, - "end": 51, - "loc": { - "start": { - "line": 2, - "column": 6 - }, - "end": { - "line": 2, - "column": 13 - } - }, + "start":44,"end":51,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":13}}, "object": { "type": "Super", - "start": 44, - "end": 49, - "loc": { - "start": { - "line": 2, - "column": 6 - }, - "end": { - "line": 2, - "column": 11 - } - } + "start":44,"end":49,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":11}} }, "property": { "type": "Identifier", - "start": 50, - "end": 51, - "loc": { - "start": { - "line": 2, - "column": 12 - }, - "end": { - "line": 2, - "column": 13 - }, - "identifierName": "c" - }, + "start":50,"end":51,"loc":{"start":{"line":2,"column":12},"end":{"line":2,"column":13},"identifierName":"c"}, "name": "c" }, "computed": false diff --git a/packages/babel-parser/test/fixtures/experimental/class-properties/yield-in-class-property-in-generator/input.js b/packages/babel-parser/test/fixtures/experimental/class-properties/yield-in-class-property-in-generator/input.js new file mode 100644 index 000000000000..25ecb3345bc9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-properties/yield-in-class-property-in-generator/input.js @@ -0,0 +1,6 @@ +function* foo() { + class C { + // here yield is an identifier reference + p = yield + 42; + } +} diff --git a/packages/babel-parser/test/fixtures/experimental/class-properties/yield-in-class-property-in-generator/options.json b/packages/babel-parser/test/fixtures/experimental/class-properties/yield-in-class-property-in-generator/options.json new file mode 100644 index 000000000000..9c27576d4ad0 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-properties/yield-in-class-property-in-generator/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["classProperties"] +} diff --git a/packages/babel-parser/test/fixtures/experimental/class-properties/yield-in-class-property-in-generator/output.json b/packages/babel-parser/test/fixtures/experimental/class-properties/yield-in-class-property-in-generator/output.json new file mode 100644 index 000000000000..c50fc16839fe --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-properties/yield-in-class-property-in-generator/output.json @@ -0,0 +1,95 @@ +{ + "type": "File", + "start":0,"end":100,"loc":{"start":{"line":1,"column":0},"end":{"line":6,"column":1}}, + "errors": [ + "SyntaxError: Unexpected reserved word 'yield' (4:8)" + ], + "program": { + "type": "Program", + "start":0,"end":100,"loc":{"start":{"line":1,"column":0},"end":{"line":6,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":100,"loc":{"start":{"line":1,"column":0},"end":{"line":6,"column":1}}, + "id": { + "type": "Identifier", + "start":10,"end":13,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":13},"identifierName":"foo"}, + "name": "foo" + }, + "generator": true, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":16,"end":100,"loc":{"start":{"line":1,"column":16},"end":{"line":6,"column":1}}, + "body": [ + { + "type": "ClassDeclaration", + "start":20,"end":98,"loc":{"start":{"line":2,"column":2},"end":{"line":5,"column":3}}, + "id": { + "type": "Identifier", + "start":26,"end":27,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":9},"identifierName":"C"}, + "name": "C" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":28,"end":98,"loc":{"start":{"line":2,"column":10},"end":{"line":5,"column":3}}, + "body": [ + { + "type": "ClassProperty", + "start":79,"end":94,"loc":{"start":{"line":4,"column":4},"end":{"line":4,"column":19}}, + "static": false, + "key": { + "type": "Identifier", + "start":79,"end":80,"loc":{"start":{"line":4,"column":4},"end":{"line":4,"column":5},"identifierName":"p"}, + "name": "p" + }, + "computed": false, + "value": { + "type": "BinaryExpression", + "start":83,"end":93,"loc":{"start":{"line":4,"column":8},"end":{"line":4,"column":18}}, + "left": { + "type": "Identifier", + "start":83,"end":88,"loc":{"start":{"line":4,"column":8},"end":{"line":4,"column":13},"identifierName":"yield"}, + "name": "yield" + }, + "operator": "+", + "right": { + "type": "NumericLiteral", + "start":91,"end":93,"loc":{"start":{"line":4,"column":16},"end":{"line":4,"column":18}}, + "extra": { + "rawValue": 42, + "raw": "42" + }, + "value": 42 + } + }, + "leadingComments": [ + { + "type": "CommentLine", + "value": " here yield is an identifier reference", + "start":34,"end":74,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":44}} + } + ] + } + ] + } + } + ], + "directives": [] + } + } + ], + "directives": [] + }, + "comments": [ + { + "type": "CommentLine", + "value": " here yield is an identifier reference", + "start":34,"end":74,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":44}} + } + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-properties/yield-in-generator-in-class-property/input.js b/packages/babel-parser/test/fixtures/experimental/class-properties/yield-in-generator-in-class-property/input.js new file mode 100644 index 000000000000..6eed441a87a6 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-properties/yield-in-generator-in-class-property/input.js @@ -0,0 +1,3 @@ +class C { + p = function* () { yield + 42 }; +} diff --git a/packages/babel-parser/test/fixtures/experimental/class-properties/yield-in-generator-in-class-property/options.json b/packages/babel-parser/test/fixtures/experimental/class-properties/yield-in-generator-in-class-property/options.json new file mode 100644 index 000000000000..9c27576d4ad0 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-properties/yield-in-generator-in-class-property/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["classProperties"] +} diff --git a/packages/babel-parser/test/fixtures/experimental/class-properties/yield-in-generator-in-class-property/output.json b/packages/babel-parser/test/fixtures/experimental/class-properties/yield-in-generator-in-class-property/output.json new file mode 100644 index 000000000000..004925a92410 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-properties/yield-in-generator-in-class-property/output.json @@ -0,0 +1,79 @@ +{ + "type": "File", + "start":0,"end":46,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "program": { + "type": "Program", + "start":0,"end":46,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start":0,"end":46,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "id": { + "type": "Identifier", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"C"}, + "name": "C" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":8,"end":46,"loc":{"start":{"line":1,"column":8},"end":{"line":3,"column":1}}, + "body": [ + { + "type": "ClassProperty", + "start":12,"end":44,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":34}}, + "static": false, + "key": { + "type": "Identifier", + "start":12,"end":13,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":3},"identifierName":"p"}, + "name": "p" + }, + "computed": false, + "value": { + "type": "FunctionExpression", + "start":16,"end":43,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":33}}, + "id": null, + "generator": true, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":29,"end":43,"loc":{"start":{"line":2,"column":19},"end":{"line":2,"column":33}}, + "body": [ + { + "type": "ExpressionStatement", + "start":31,"end":41,"loc":{"start":{"line":2,"column":21},"end":{"line":2,"column":31}}, + "expression": { + "type": "YieldExpression", + "start":31,"end":41,"loc":{"start":{"line":2,"column":21},"end":{"line":2,"column":31}}, + "delegate": false, + "argument": { + "type": "UnaryExpression", + "start":37,"end":41,"loc":{"start":{"line":2,"column":27},"end":{"line":2,"column":31}}, + "operator": "+", + "prefix": true, + "argument": { + "type": "NumericLiteral", + "start":39,"end":41,"loc":{"start":{"line":2,"column":29},"end":{"line":2,"column":31}}, + "extra": { + "rawValue": 42, + "raw": "42" + }, + "value": 42 + } + } + } + } + ], + "directives": [] + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/decorators-2/class-decorator-call-expr/output.json b/packages/babel-parser/test/fixtures/experimental/decorators-2/class-decorator-call-expr/output.json index 73a9e36039c4..d1e510436a43 100644 --- a/packages/babel-parser/test/fixtures/experimental/decorators-2/class-decorator-call-expr/output.json +++ b/packages/babel-parser/test/fixtures/experimental/decorators-2/class-decorator-call-expr/output.json @@ -1,109 +1,31 @@ { "type": "File", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 12 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":12}}, "program": { "type": "Program", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 12 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":12}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 12 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":12}}, "decorators": [ { "type": "Decorator", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "expression": { "type": "CallExpression", - "start": 1, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":1,"end":11,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":11}}, "callee": { "type": "Identifier", - "start": 1, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 4 - }, - "identifierName": "foo" - }, + "start":1,"end":4,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":4},"identifierName":"foo"}, "name": "foo" }, "arguments": [ { "type": "StringLiteral", - "start": 5, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":5,"end":10,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":10}}, "extra": { "rawValue": "bar", "raw": "'bar'" @@ -116,36 +38,13 @@ ], "id": { "type": "Identifier", - "start": 18, - "end": 21, - "loc": { - "start": { - "line": 2, - "column": 6 - }, - "end": { - "line": 2, - "column": 9 - }, - "identifierName": "Foo" - }, + "start":18,"end":21,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":9},"identifierName":"Foo"}, "name": "Foo" }, "superClass": null, "body": { "type": "ClassBody", - "start": 22, - "end": 24, - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 12 - } - }, + "start":22,"end":24,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":12}}, "body": [] } } diff --git a/packages/babel-parser/test/fixtures/experimental/decorators-2/class-decorator/output.json b/packages/babel-parser/test/fixtures/experimental/decorators-2/class-decorator/output.json index 2f219a49939a..1977b5cbd495 100644 --- a/packages/babel-parser/test/fixtures/experimental/decorators-2/class-decorator/output.json +++ b/packages/babel-parser/test/fixtures/experimental/decorators-2/class-decorator/output.json @@ -1,114 +1,35 @@ { "type": "File", - "start": 0, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, "decorators": [ { "type": "Decorator", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - }, + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, "expression": { "type": "Identifier", - "start": 1, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 4 - }, - "identifierName": "abc" - }, + "start":1,"end":4,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":4},"identifierName":"abc"}, "name": "abc" } } ], "id": { "type": "Identifier", - "start": 11, - "end": 14, - "loc": { - "start": { - "line": 2, - "column": 6 - }, - "end": { - "line": 2, - "column": 9 - }, - "identifierName": "Foo" - }, + "start":11,"end":14,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":9},"identifierName":"Foo"}, "name": "Foo" }, "superClass": null, "body": { "type": "ClassBody", - "start": 15, - "end": 19, - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":15,"end":19,"loc":{"start":{"line":2,"column":10},"end":{"line":4,"column":1}}, "body": [] } } diff --git a/packages/babel-parser/test/fixtures/experimental/decorators-2/class-expression/output.json b/packages/babel-parser/test/fixtures/experimental/decorators-2/class-expression/output.json index a3f0718a28dd..66302d642b12 100644 --- a/packages/babel-parser/test/fixtures/experimental/decorators-2/class-expression/output.json +++ b/packages/babel-parser/test/fixtures/experimental/decorators-2/class-expression/output.json @@ -1,205 +1,58 @@ { "type": "File", - "start": 0, - "end": 58, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 6, - "column": 1 - } - }, + "start":0,"end":58,"loc":{"start":{"line":1,"column":0},"end":{"line":6,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 58, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 6, - "column": 1 - } - }, + "start":0,"end":58,"loc":{"start":{"line":1,"column":0},"end":{"line":6,"column":1}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 58, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 6, - "column": 1 - } - }, + "start":0,"end":58,"loc":{"start":{"line":1,"column":0},"end":{"line":6,"column":1}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 58, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 6, - "column": 1 - } - }, + "start":4,"end":58,"loc":{"start":{"line":1,"column":4},"end":{"line":6,"column":1}}, "id": { "type": "Identifier", - "start": 4, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "foo" - }, + "start":4,"end":7,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":7},"identifierName":"foo"}, "name": "foo" }, "init": { "type": "ClassExpression", - "start": 10, - "end": 58, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 6, - "column": 1 - } - }, + "start":10,"end":58,"loc":{"start":{"line":1,"column":10},"end":{"line":6,"column":1}}, "decorators": [ { "type": "Decorator", - "start": 10, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":10,"end":14,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":14}}, "expression": { "type": "Identifier", - "start": 11, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 14 - }, - "identifierName": "dec" - }, + "start":11,"end":14,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":14},"identifierName":"dec"}, "name": "dec" } } ], "id": { "type": "Identifier", - "start": 21, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 24 - }, - "identifierName": "Bar" - }, + "start":21,"end":24,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":24},"identifierName":"Bar"}, "name": "Bar" }, "superClass": null, "body": { "type": "ClassBody", - "start": 25, - "end": 58, - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 6, - "column": 1 - } - }, + "start":25,"end":58,"loc":{"start":{"line":1,"column":25},"end":{"line":6,"column":1}}, "body": [ { "type": "ClassMethod", - "start": 29, - "end": 56, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 5, - "column": 3 - } - }, + "start":29,"end":56,"loc":{"start":{"line":2,"column":2},"end":{"line":5,"column":3}}, "decorators": [ { "type": "Decorator", - "start": 29, - "end": 33, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 6 - } - }, + "start":29,"end":33,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":6}}, "expression": { "type": "Identifier", - "start": 30, - "end": 33, - "loc": { - "start": { - "line": 2, - "column": 3 - }, - "end": { - "line": 2, - "column": 6 - }, - "identifierName": "baz" - }, + "start":30,"end":33,"loc":{"start":{"line":2,"column":3},"end":{"line":2,"column":6},"identifierName":"baz"}, "name": "baz" } } @@ -207,19 +60,7 @@ "static": false, "key": { "type": "Identifier", - "start": 36, - "end": 39, - "loc": { - "start": { - "line": 3, - "column": 2 - }, - "end": { - "line": 3, - "column": 5 - }, - "identifierName": "bam" - }, + "start":36,"end":39,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":5},"identifierName":"bam"}, "name": "bam" }, "computed": false, @@ -230,62 +71,17 @@ "params": [], "body": { "type": "BlockStatement", - "start": 42, - "end": 56, - "loc": { - "start": { - "line": 3, - "column": 8 - }, - "end": { - "line": 5, - "column": 3 - } - }, + "start":42,"end":56,"loc":{"start":{"line":3,"column":8},"end":{"line":5,"column":3}}, "body": [ { "type": "ExpressionStatement", - "start": 48, - "end": 52, - "loc": { - "start": { - "line": 4, - "column": 4 - }, - "end": { - "line": 4, - "column": 8 - } - }, + "start":48,"end":52,"loc":{"start":{"line":4,"column":4},"end":{"line":4,"column":8}}, "expression": { "type": "CallExpression", - "start": 48, - "end": 51, - "loc": { - "start": { - "line": 4, - "column": 4 - }, - "end": { - "line": 4, - "column": 7 - } - }, + "start":48,"end":51,"loc":{"start":{"line":4,"column":4},"end":{"line":4,"column":7}}, "callee": { "type": "Identifier", - "start": 48, - "end": 49, - "loc": { - "start": { - "line": 4, - "column": 4 - }, - "end": { - "line": 4, - "column": 5 - }, - "identifierName": "f" - }, + "start":48,"end":49,"loc":{"start":{"line":4,"column":4},"end":{"line":4,"column":5},"identifierName":"f"}, "name": "f" }, "arguments": [] diff --git a/packages/babel-parser/test/fixtures/experimental/decorators-2/class-generator/output.json b/packages/babel-parser/test/fixtures/experimental/decorators-2/class-generator/output.json index e1051a68e29b..4da6a4271827 100644 --- a/packages/babel-parser/test/fixtures/experimental/decorators-2/class-generator/output.json +++ b/packages/babel-parser/test/fixtures/experimental/decorators-2/class-generator/output.json @@ -1,125 +1,35 @@ { "type": "File", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "id": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "A" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, "name": "A" }, "superClass": null, "body": { "type": "ClassBody", - "start": 8, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":8,"end":25,"loc":{"start":{"line":1,"column":8},"end":{"line":3,"column":1}}, "body": [ { "type": "ClassMethod", - "start": 12, - "end": 23, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 13 - } - }, + "start":12,"end":23,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":13}}, "decorators": [ { "type": "Decorator", - "start": 12, - "end": 16, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 6 - } - }, + "start":12,"end":16,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":6}}, "expression": { "type": "Identifier", - "start": 13, - "end": 16, - "loc": { - "start": { - "line": 2, - "column": 3 - }, - "end": { - "line": 2, - "column": 6 - }, - "identifierName": "dec" - }, + "start":13,"end":16,"loc":{"start":{"line":2,"column":3},"end":{"line":2,"column":6},"identifierName":"dec"}, "name": "dec" } } @@ -128,19 +38,7 @@ "kind": "method", "key": { "type": "Identifier", - "start": 18, - "end": 19, - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 9 - }, - "identifierName": "m" - }, + "start":18,"end":19,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":9},"identifierName":"m"}, "name": "m" }, "computed": false, @@ -150,18 +48,7 @@ "params": [], "body": { "type": "BlockStatement", - "start": 21, - "end": 23, - "loc": { - "start": { - "line": 2, - "column": 11 - }, - "end": { - "line": 2, - "column": 13 - } - }, + "start":21,"end":23,"loc":{"start":{"line":2,"column":11},"end":{"line":2,"column":13}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/experimental/decorators-2/class-property/output.json b/packages/babel-parser/test/fixtures/experimental/decorators-2/class-property/output.json index 81617ba6f123..d3973e7ce798 100644 --- a/packages/babel-parser/test/fixtures/experimental/decorators-2/class-property/output.json +++ b/packages/babel-parser/test/fixtures/experimental/decorators-2/class-property/output.json @@ -1,125 +1,35 @@ { "type": "File", - "start": 0, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "id": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "A" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, "name": "A" }, "superClass": null, "body": { "type": "ClassBody", - "start": 8, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":8,"end":27,"loc":{"start":{"line":1,"column":8},"end":{"line":3,"column":1}}, "body": [ { "type": "ClassProperty", - "start": 12, - "end": 25, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 15 - } - }, + "start":12,"end":25,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":15}}, "decorators": [ { "type": "Decorator", - "start": 12, - "end": 16, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 6 - } - }, + "start":12,"end":16,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":6}}, "expression": { "type": "Identifier", - "start": 13, - "end": 16, - "loc": { - "start": { - "line": 2, - "column": 3 - }, - "end": { - "line": 2, - "column": 6 - }, - "identifierName": "dec" - }, + "start":13,"end":16,"loc":{"start":{"line":2,"column":3},"end":{"line":2,"column":6},"identifierName":"dec"}, "name": "dec" } } @@ -127,36 +37,13 @@ "static": false, "key": { "type": "Identifier", - "start": 17, - "end": 21, - "loc": { - "start": { - "line": 2, - "column": 7 - }, - "end": { - "line": 2, - "column": 11 - }, - "identifierName": "name" - }, + "start":17,"end":21,"loc":{"start":{"line":2,"column":7},"end":{"line":2,"column":11},"identifierName":"name"}, "name": "name" }, "computed": false, "value": { "type": "NumericLiteral", - "start": 24, - "end": 25, - "loc": { - "start": { - "line": 2, - "column": 14 - }, - "end": { - "line": 2, - "column": 15 - } - }, + "start":24,"end":25,"loc":{"start":{"line":2,"column":14},"end":{"line":2,"column":15}}, "extra": { "rawValue": 0, "raw": "0" diff --git a/packages/babel-parser/test/fixtures/experimental/decorators-2/complex-expr/output.json b/packages/babel-parser/test/fixtures/experimental/decorators-2/complex-expr/output.json index d70b2148db25..c69d5147cef1 100644 --- a/packages/babel-parser/test/fixtures/experimental/decorators-2/complex-expr/output.json +++ b/packages/babel-parser/test/fixtures/experimental/decorators-2/complex-expr/output.json @@ -1,236 +1,66 @@ { "type": "File", - "start": 0, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, "id": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "A" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, "name": "A" }, "superClass": null, "body": { "type": "ClassBody", - "start": 8, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":8,"end":36,"loc":{"start":{"line":1,"column":8},"end":{"line":4,"column":1}}, "body": [ { "type": "ClassMethod", - "start": 12, - "end": 34, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 3, - "column": 7 - } - }, + "start":12,"end":34,"loc":{"start":{"line":2,"column":2},"end":{"line":3,"column":7}}, "decorators": [ { "type": "Decorator", - "start": 12, - "end": 26, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 16 - } - }, + "start":12,"end":26,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":16}}, "expression": { "type": "CallExpression", - "start": 13, - "end": 26, - "loc": { - "start": { - "line": 2, - "column": 3 - }, - "end": { - "line": 2, - "column": 16 - } - }, + "start":13,"end":26,"loc":{"start":{"line":2,"column":3},"end":{"line":2,"column":16}}, "callee": { "type": "MemberExpression", - "start": 13, - "end": 20, - "loc": { - "start": { - "line": 2, - "column": 3 - }, - "end": { - "line": 2, - "column": 10 - } - }, + "start":13,"end":20,"loc":{"start":{"line":2,"column":3},"end":{"line":2,"column":10}}, "object": { "type": "MemberExpression", - "start": 13, - "end": 18, - "loc": { - "start": { - "line": 2, - "column": 3 - }, - "end": { - "line": 2, - "column": 8 - } - }, + "start":13,"end":18,"loc":{"start":{"line":2,"column":3},"end":{"line":2,"column":8}}, "object": { "type": "MemberExpression", - "start": 13, - "end": 16, - "loc": { - "start": { - "line": 2, - "column": 3 - }, - "end": { - "line": 2, - "column": 6 - } - }, + "start":13,"end":16,"loc":{"start":{"line":2,"column":3},"end":{"line":2,"column":6}}, "object": { "type": "Identifier", - "start": 13, - "end": 14, - "loc": { - "start": { - "line": 2, - "column": 3 - }, - "end": { - "line": 2, - "column": 4 - }, - "identifierName": "a" - }, + "start":13,"end":14,"loc":{"start":{"line":2,"column":3},"end":{"line":2,"column":4},"identifierName":"a"}, "name": "a" }, "property": { "type": "Identifier", - "start": 15, - "end": 16, - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 6 - }, - "identifierName": "b" - }, + "start":15,"end":16,"loc":{"start":{"line":2,"column":5},"end":{"line":2,"column":6},"identifierName":"b"}, "name": "b" }, "computed": false }, "property": { "type": "Identifier", - "start": 17, - "end": 18, - "loc": { - "start": { - "line": 2, - "column": 7 - }, - "end": { - "line": 2, - "column": 8 - }, - "identifierName": "c" - }, + "start":17,"end":18,"loc":{"start":{"line":2,"column":7},"end":{"line":2,"column":8},"identifierName":"c"}, "name": "c" }, "computed": false }, "property": { "type": "Identifier", - "start": 19, - "end": 20, - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 10 - }, - "identifierName": "d" - }, + "start":19,"end":20,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":10},"identifierName":"d"}, "name": "d" }, "computed": false @@ -238,36 +68,12 @@ "arguments": [ { "type": "Identifier", - "start": 21, - "end": 22, - "loc": { - "start": { - "line": 2, - "column": 11 - }, - "end": { - "line": 2, - "column": 12 - }, - "identifierName": "e" - }, + "start":21,"end":22,"loc":{"start":{"line":2,"column":11},"end":{"line":2,"column":12},"identifierName":"e"}, "name": "e" }, { "type": "Identifier", - "start": 24, - "end": 25, - "loc": { - "start": { - "line": 2, - "column": 14 - }, - "end": { - "line": 2, - "column": 15 - }, - "identifierName": "f" - }, + "start":24,"end":25,"loc":{"start":{"line":2,"column":14},"end":{"line":2,"column":15},"identifierName":"f"}, "name": "f" } ] @@ -277,19 +83,7 @@ "static": false, "key": { "type": "Identifier", - "start": 29, - "end": 30, - "loc": { - "start": { - "line": 3, - "column": 2 - }, - "end": { - "line": 3, - "column": 3 - }, - "identifierName": "m" - }, + "start":29,"end":30,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":3},"identifierName":"m"}, "name": "m" }, "computed": false, @@ -300,18 +94,7 @@ "params": [], "body": { "type": "BlockStatement", - "start": 32, - "end": 34, - "loc": { - "start": { - "line": 3, - "column": 5 - }, - "end": { - "line": 3, - "column": 7 - } - }, + "start":32,"end":34,"loc":{"start":{"line":3,"column":5},"end":{"line":3,"column":7}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/experimental/decorators-2/compued-property/output.json b/packages/babel-parser/test/fixtures/experimental/decorators-2/compued-property/output.json index 5f87a8eafa27..19e3e441beb7 100644 --- a/packages/babel-parser/test/fixtures/experimental/decorators-2/compued-property/output.json +++ b/packages/babel-parser/test/fixtures/experimental/decorators-2/compued-property/output.json @@ -1,125 +1,35 @@ { "type": "File", - "start": 0, - "end": 42, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 6, - "column": 1 - } - }, + "start":0,"end":42,"loc":{"start":{"line":1,"column":0},"end":{"line":6,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 42, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 6, - "column": 1 - } - }, + "start":0,"end":42,"loc":{"start":{"line":1,"column":0},"end":{"line":6,"column":1}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 42, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 6, - "column": 1 - } - }, + "start":0,"end":42,"loc":{"start":{"line":1,"column":0},"end":{"line":6,"column":1}}, "id": { "type": "Identifier", - "start": 6, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "Foo" - }, + "start":6,"end":9,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":9},"identifierName":"Foo"}, "name": "Foo" }, "superClass": null, "body": { "type": "ClassBody", - "start": 10, - "end": 42, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 6, - "column": 1 - } - }, + "start":10,"end":42,"loc":{"start":{"line":1,"column":10},"end":{"line":6,"column":1}}, "body": [ { "type": "ClassProperty", - "start": 14, - "end": 25, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 13 - } - }, + "start":14,"end":25,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":13}}, "decorators": [ { "type": "Decorator", - "start": 14, - "end": 18, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 6 - } - }, + "start":14,"end":18,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":6}}, "expression": { "type": "Identifier", - "start": 15, - "end": 18, - "loc": { - "start": { - "line": 2, - "column": 3 - }, - "end": { - "line": 2, - "column": 6 - }, - "identifierName": "bar" - }, + "start":15,"end":18,"loc":{"start":{"line":2,"column":3},"end":{"line":2,"column":6},"identifierName":"bar"}, "name": "bar" } } @@ -128,53 +38,18 @@ "computed": true, "key": { "type": "Identifier", - "start": 20, - "end": 24, - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 12 - }, - "identifierName": "bizz" - }, + "start":20,"end":24,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":12},"identifierName":"bizz"}, "name": "bizz" }, "value": null }, { "type": "ClassMethod", - "start": 28, - "end": 40, - "loc": { - "start": { - "line": 3, - "column": 2 - }, - "end": { - "line": 5, - "column": 3 - } - }, + "start":28,"end":40,"loc":{"start":{"line":3,"column":2},"end":{"line":5,"column":3}}, "static": false, "key": { "type": "Identifier", - "start": 28, - "end": 31, - "loc": { - "start": { - "line": 3, - "column": 2 - }, - "end": { - "line": 3, - "column": 5 - }, - "identifierName": "abc" - }, + "start":28,"end":31,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":5},"identifierName":"abc"}, "name": "abc" }, "computed": false, @@ -185,18 +60,7 @@ "params": [], "body": { "type": "BlockStatement", - "start": 34, - "end": 40, - "loc": { - "start": { - "line": 3, - "column": 8 - }, - "end": { - "line": 5, - "column": 3 - } - }, + "start":34,"end":40,"loc":{"start":{"line":3,"column":8},"end":{"line":5,"column":3}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/experimental/decorators-2/decoratorsBeforeExport-export-default-decorated-expression-with-parens/output.json b/packages/babel-parser/test/fixtures/experimental/decorators-2/decoratorsBeforeExport-export-default-decorated-expression-with-parens/output.json index c50380d9a517..65327624c062 100644 --- a/packages/babel-parser/test/fixtures/experimental/decorators-2/decoratorsBeforeExport-export-default-decorated-expression-with-parens/output.json +++ b/packages/babel-parser/test/fixtures/experimental/decorators-2/decoratorsBeforeExport-export-default-decorated-expression-with-parens/output.json @@ -1,128 +1,38 @@ { "type": "File", - "start": 0, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 40 - } - }, + "start":0,"end":40,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":40}}, "program": { "type": "Program", - "start": 0, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 40 - } - }, + "start":0,"end":40,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":40}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExportDefaultDeclaration", - "start": 0, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 40 - } - }, + "start":0,"end":40,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":40}}, "declaration": { "type": "ClassExpression", - "start": 16, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 39 - } - }, + "start":16,"end":39,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":39}}, "decorators": [ { "type": "Decorator", - "start": 16, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":16,"end":26,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":26}}, "expression": { "type": "Identifier", - "start": 17, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 26 - }, - "identifierName": "decorator" - }, + "start":17,"end":26,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":26},"identifierName":"decorator"}, "name": "decorator" } } ], "id": { "type": "Identifier", - "start": 33, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 33 - }, - "end": { - "line": 1, - "column": 36 - }, - "identifierName": "Foo" - }, + "start":33,"end":36,"loc":{"start":{"line":1,"column":33},"end":{"line":1,"column":36},"identifierName":"Foo"}, "name": "Foo" }, "superClass": null, "body": { "type": "ClassBody", - "start": 37, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 37 - }, - "end": { - "line": 1, - "column": 39 - } - }, + "start":37,"end":39,"loc":{"start":{"line":1,"column":37},"end":{"line":1,"column":39}}, "body": [] }, "extra": { diff --git a/packages/babel-parser/test/fixtures/experimental/decorators-2/decoratorsBeforeExport-export-default-decorated-expression-without-parens/options.json b/packages/babel-parser/test/fixtures/experimental/decorators-2/decoratorsBeforeExport-export-default-decorated-expression-without-parens/options.json index 39592e4eb294..0845f9c79e6c 100644 --- a/packages/babel-parser/test/fixtures/experimental/decorators-2/decoratorsBeforeExport-export-default-decorated-expression-without-parens/options.json +++ b/packages/babel-parser/test/fixtures/experimental/decorators-2/decoratorsBeforeExport-export-default-decorated-expression-without-parens/options.json @@ -1,5 +1,11 @@ { - "sourceType": "module", - "plugins": [["decorators", { "decoratorsBeforeExport": true }]], - "throws": "Decorators must be placed *before* the 'export' keyword. You can set the 'decoratorsBeforeExport' option to false to use the 'export @decorator class {}' syntax (1:15)" + "plugins": [ + [ + "decorators", + { + "decoratorsBeforeExport": true + } + ] + ], + "sourceType": "module" } diff --git a/packages/babel-parser/test/fixtures/experimental/decorators-2/decoratorsBeforeExport-export-default-decorated-expression-without-parens/output.json b/packages/babel-parser/test/fixtures/experimental/decorators-2/decoratorsBeforeExport-export-default-decorated-expression-without-parens/output.json new file mode 100644 index 000000000000..083fa746f96b --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/decorators-2/decoratorsBeforeExport-export-default-decorated-expression-without-parens/output.json @@ -0,0 +1,46 @@ +{ + "type": "File", + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":38}}, + "errors": [ + "SyntaxError: Decorators must be placed *before* the 'export' keyword. You can set the 'decoratorsBeforeExport' option to false to use the 'export @decorator class {}' syntax (1:15)" + ], + "program": { + "type": "Program", + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":38}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExportDefaultDeclaration", + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":38}}, + "declaration": { + "type": "ClassDeclaration", + "start":15,"end":38,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":38}}, + "decorators": [ + { + "type": "Decorator", + "start":15,"end":25,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":25}}, + "expression": { + "type": "Identifier", + "start":16,"end":25,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":25},"identifierName":"decorator"}, + "name": "decorator" + } + } + ], + "id": { + "type": "Identifier", + "start":32,"end":35,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":35},"identifierName":"Foo"}, + "name": "Foo" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":36,"end":38,"loc":{"start":{"line":1,"column":36},"end":{"line":1,"column":38}}, + "body": [] + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/decorators-2/decoratorsBeforeExport-export-default/output.json b/packages/babel-parser/test/fixtures/experimental/decorators-2/decoratorsBeforeExport-export-default/output.json index ce1316960a9a..3213ec7e4c23 100644 --- a/packages/babel-parser/test/fixtures/experimental/decorators-2/decoratorsBeforeExport-export-default/output.json +++ b/packages/babel-parser/test/fixtures/experimental/decorators-2/decoratorsBeforeExport-export-default/output.json @@ -1,128 +1,38 @@ { "type": "File", - "start": 0, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 27 - } - }, + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":27}}, "program": { "type": "Program", - "start": 0, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 27 - } - }, + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":27}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExportDefaultDeclaration", - "start": 11, - "end": 38, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 27 - } - }, + "start":11,"end":38,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":27}}, "declaration": { "type": "ClassDeclaration", - "start": 0, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 27 - } - }, + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":27}}, "decorators": [ { "type": "Decorator", - "start": 0, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, "expression": { "type": "Identifier", - "start": 1, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 10 - }, - "identifierName": "decorator" - }, + "start":1,"end":10,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":10},"identifierName":"decorator"}, "name": "decorator" } } ], "id": { "type": "Identifier", - "start": 32, - "end": 35, - "loc": { - "start": { - "line": 2, - "column": 21 - }, - "end": { - "line": 2, - "column": 24 - }, - "identifierName": "Foo" - }, + "start":32,"end":35,"loc":{"start":{"line":2,"column":21},"end":{"line":2,"column":24},"identifierName":"Foo"}, "name": "Foo" }, "superClass": null, "body": { "type": "ClassBody", - "start": 36, - "end": 38, - "loc": { - "start": { - "line": 2, - "column": 25 - }, - "end": { - "line": 2, - "column": 27 - } - }, + "start":36,"end":38,"loc":{"start":{"line":2,"column":25},"end":{"line":2,"column":27}}, "body": [] } } diff --git a/packages/babel-parser/test/fixtures/experimental/decorators-2/decoratorsBeforeExport-export/output.json b/packages/babel-parser/test/fixtures/experimental/decorators-2/decoratorsBeforeExport-export/output.json index 367972bf3190..251c4ce6bacc 100644 --- a/packages/babel-parser/test/fixtures/experimental/decorators-2/decoratorsBeforeExport-export/output.json +++ b/packages/babel-parser/test/fixtures/experimental/decorators-2/decoratorsBeforeExport-export/output.json @@ -1,130 +1,40 @@ { "type": "File", - "start": 0, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 19 - } - }, + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":19}}, "program": { "type": "Program", - "start": 0, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 19 - } - }, + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":19}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExportNamedDeclaration", - "start": 11, - "end": 30, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 19 - } - }, + "start":11,"end":30,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":19}}, "specifiers": [], "source": null, "declaration": { "type": "ClassDeclaration", - "start": 0, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 19 - } - }, + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":19}}, "decorators": [ { "type": "Decorator", - "start": 0, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, "expression": { "type": "Identifier", - "start": 1, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 10 - }, - "identifierName": "decorator" - }, + "start":1,"end":10,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":10},"identifierName":"decorator"}, "name": "decorator" } } ], "id": { "type": "Identifier", - "start": 24, - "end": 27, - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 16 - }, - "identifierName": "Foo" - }, + "start":24,"end":27,"loc":{"start":{"line":2,"column":13},"end":{"line":2,"column":16},"identifierName":"Foo"}, "name": "Foo" }, "superClass": null, "body": { "type": "ClassBody", - "start": 28, - "end": 30, - "loc": { - "start": { - "line": 2, - "column": 17 - }, - "end": { - "line": 2, - "column": 19 - } - }, + "start":28,"end":30,"loc":{"start":{"line":2,"column":17},"end":{"line":2,"column":19}}, "body": [] } } diff --git a/packages/babel-parser/test/fixtures/experimental/decorators-2/export-decorated-class/output.json b/packages/babel-parser/test/fixtures/experimental/decorators-2/export-decorated-class/output.json index 930ce09662d1..77b3d90da307 100644 --- a/packages/babel-parser/test/fixtures/experimental/decorators-2/export-decorated-class/output.json +++ b/packages/babel-parser/test/fixtures/experimental/decorators-2/export-decorated-class/output.json @@ -1,130 +1,40 @@ { "type": "File", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, "program": { "type": "Program", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExportNamedDeclaration", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, "specifiers": [], "source": null, "declaration": { "type": "ClassDeclaration", - "start": 7, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":7,"end":25,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":25}}, "decorators": [ { "type": "Decorator", - "start": 7, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":7,"end":11,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":11}}, "expression": { "type": "Identifier", - "start": 8, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "bar" - }, + "start":8,"end":11,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":11},"identifierName":"bar"}, "name": "bar" } } ], "id": { "type": "Identifier", - "start": 18, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 21 - }, - "identifierName": "Foo" - }, + "start":18,"end":21,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":21},"identifierName":"Foo"}, "name": "Foo" }, "superClass": null, "body": { "type": "ClassBody", - "start": 22, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":22,"end":25,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":25}}, "body": [] } } diff --git a/packages/babel-parser/test/fixtures/experimental/decorators-2/export-default-decorated-class/output.json b/packages/babel-parser/test/fixtures/experimental/decorators-2/export-default-decorated-class/output.json index c2bd0ff3a8bd..5e0b3cd9fc43 100644 --- a/packages/babel-parser/test/fixtures/experimental/decorators-2/export-default-decorated-class/output.json +++ b/packages/babel-parser/test/fixtures/experimental/decorators-2/export-default-decorated-class/output.json @@ -1,128 +1,38 @@ { "type": "File", - "start": 0, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 18 - } - }, + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":18}}, "program": { "type": "Program", - "start": 0, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 18 - } - }, + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":18}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExportDefaultDeclaration", - "start": 0, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 18 - } - }, + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":18}}, "declaration": { "type": "ClassDeclaration", - "start": 16, - "end": 34, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 18 - } - }, + "start":16,"end":34,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":18}}, "decorators": [ { "type": "Decorator", - "start": 16, - "end": 20, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 4 - } - }, + "start":16,"end":20,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":4}}, "expression": { "type": "Identifier", - "start": 17, - "end": 20, - "loc": { - "start": { - "line": 2, - "column": 1 - }, - "end": { - "line": 2, - "column": 4 - }, - "identifierName": "bar" - }, + "start":17,"end":20,"loc":{"start":{"line":2,"column":1},"end":{"line":2,"column":4},"identifierName":"bar"}, "name": "bar" } } ], "id": { "type": "Identifier", - "start": 27, - "end": 30, - "loc": { - "start": { - "line": 2, - "column": 11 - }, - "end": { - "line": 2, - "column": 14 - }, - "identifierName": "Foo" - }, + "start":27,"end":30,"loc":{"start":{"line":2,"column":11},"end":{"line":2,"column":14},"identifierName":"Foo"}, "name": "Foo" }, "superClass": null, "body": { "type": "ClassBody", - "start": 31, - "end": 34, - "loc": { - "start": { - "line": 2, - "column": 15 - }, - "end": { - "line": 2, - "column": 18 - } - }, + "start":31,"end":34,"loc":{"start":{"line":2,"column":15},"end":{"line":2,"column":18}}, "body": [] } } diff --git a/packages/babel-parser/test/fixtures/experimental/decorators-2/get-decorator/output.json b/packages/babel-parser/test/fixtures/experimental/decorators-2/get-decorator/output.json index a7eeacec5938..30fd19b64705 100644 --- a/packages/babel-parser/test/fixtures/experimental/decorators-2/get-decorator/output.json +++ b/packages/babel-parser/test/fixtures/experimental/decorators-2/get-decorator/output.json @@ -1,125 +1,35 @@ { "type": "File", - "start": 0, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "id": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "A" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, "name": "A" }, "superClass": null, "body": { "type": "ClassBody", - "start": 8, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":8,"end":33,"loc":{"start":{"line":1,"column":8},"end":{"line":3,"column":1}}, "body": [ { "type": "ClassMethod", - "start": 12, - "end": 31, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 21 - } - }, + "start":12,"end":31,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":21}}, "decorators": [ { "type": "Decorator", - "start": 12, - "end": 16, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 6 - } - }, + "start":12,"end":16,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":6}}, "expression": { "type": "Identifier", - "start": 13, - "end": 16, - "loc": { - "start": { - "line": 2, - "column": 3 - }, - "end": { - "line": 2, - "column": 6 - }, - "identifierName": "foo" - }, + "start":13,"end":16,"loc":{"start":{"line":2,"column":3},"end":{"line":2,"column":6},"identifierName":"foo"}, "name": "foo" } } @@ -127,19 +37,7 @@ "static": false, "key": { "type": "Identifier", - "start": 21, - "end": 27, - "loc": { - "start": { - "line": 2, - "column": 11 - }, - "end": { - "line": 2, - "column": 17 - }, - "identifierName": "getter" - }, + "start":21,"end":27,"loc":{"start":{"line":2,"column":11},"end":{"line":2,"column":17},"identifierName":"getter"}, "name": "getter" }, "computed": false, @@ -150,18 +48,7 @@ "params": [], "body": { "type": "BlockStatement", - "start": 29, - "end": 31, - "loc": { - "start": { - "line": 2, - "column": 19 - }, - "end": { - "line": 2, - "column": 21 - } - }, + "start":29,"end":31,"loc":{"start":{"line":2,"column":19},"end":{"line":2,"column":21}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/experimental/decorators-2/nested-class-decorator-parameters/output.json b/packages/babel-parser/test/fixtures/experimental/decorators-2/nested-class-decorator-parameters/output.json index 69484e07993e..c7d7224e9129 100644 --- a/packages/babel-parser/test/fixtures/experimental/decorators-2/nested-class-decorator-parameters/output.json +++ b/packages/babel-parser/test/fixtures/experimental/decorators-2/nested-class-decorator-parameters/output.json @@ -1,224 +1,66 @@ { "type": "File", - "start": 0, - "end": 57, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 6, - "column": 1 - } - }, + "start":0,"end":57,"loc":{"start":{"line":1,"column":0},"end":{"line":6,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 57, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 6, - "column": 1 - } - }, + "start":0,"end":57,"loc":{"start":{"line":1,"column":0},"end":{"line":6,"column":1}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 57, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 6, - "column": 1 - } - }, + "start":0,"end":57,"loc":{"start":{"line":1,"column":0},"end":{"line":6,"column":1}}, "decorators": [ { "type": "Decorator", - "start": 0, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 2 - } - }, + "start":0,"end":40,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":2}}, "expression": { "type": "CallExpression", - "start": 1, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 3, - "column": 2 - } - }, + "start":1,"end":40,"loc":{"start":{"line":1,"column":1},"end":{"line":3,"column":2}}, "callee": { "type": "Identifier", - "start": 1, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "outer" - }, + "start":1,"end":6,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":6},"identifierName":"outer"}, "name": "outer" }, "arguments": [ { "type": "ObjectExpression", - "start": 7, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":7,"end":39,"loc":{"start":{"line":1,"column":7},"end":{"line":3,"column":1}}, "properties": [ { "type": "ObjectProperty", - "start": 11, - "end": 37, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 28 - } - }, + "start":11,"end":37,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":28}}, "method": false, "key": { "type": "Identifier", - "start": 11, - "end": 16, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 7 - }, - "identifierName": "store" - }, + "start":11,"end":16,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":7},"identifierName":"store"}, "name": "store" }, "computed": false, "shorthand": false, "value": { "type": "ClassExpression", - "start": 18, - "end": 37, - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 28 - } - }, + "start":18,"end":37,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":28}}, "decorators": [ { "type": "Decorator", - "start": 18, - "end": 24, - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 15 - } - }, + "start":18,"end":24,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":15}}, "expression": { "type": "Identifier", - "start": 19, - "end": 24, - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 15 - }, - "identifierName": "inner" - }, + "start":19,"end":24,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":15},"identifierName":"inner"}, "name": "inner" } } ], "id": { "type": "Identifier", - "start": 31, - "end": 34, - "loc": { - "start": { - "line": 2, - "column": 22 - }, - "end": { - "line": 2, - "column": 25 - }, - "identifierName": "Foo" - }, + "start":31,"end":34,"loc":{"start":{"line":2,"column":22},"end":{"line":2,"column":25},"identifierName":"Foo"}, "name": "Foo" }, "superClass": null, "body": { "type": "ClassBody", - "start": 35, - "end": 37, - "loc": { - "start": { - "line": 2, - "column": 26 - }, - "end": { - "line": 2, - "column": 28 - } - }, + "start":35,"end":37,"loc":{"start":{"line":2,"column":26},"end":{"line":2,"column":28}}, "body": [] } } @@ -231,36 +73,13 @@ ], "id": { "type": "Identifier", - "start": 47, - "end": 50, - "loc": { - "start": { - "line": 4, - "column": 6 - }, - "end": { - "line": 4, - "column": 9 - }, - "identifierName": "Bar" - }, + "start":47,"end":50,"loc":{"start":{"line":4,"column":6},"end":{"line":4,"column":9},"identifierName":"Bar"}, "name": "Bar" }, "superClass": null, "body": { "type": "ClassBody", - "start": 51, - "end": 57, - "loc": { - "start": { - "line": 4, - "column": 10 - }, - "end": { - "line": 6, - "column": 1 - } - }, + "start":51,"end":57,"loc":{"start":{"line":4,"column":10},"end":{"line":6,"column":1}}, "body": [] } } diff --git a/packages/babel-parser/test/fixtures/experimental/decorators-2/nested-class-decorator/output.json b/packages/babel-parser/test/fixtures/experimental/decorators-2/nested-class-decorator/output.json index eefec5ddd7c9..2987e25cf7e8 100644 --- a/packages/babel-parser/test/fixtures/experimental/decorators-2/nested-class-decorator/output.json +++ b/packages/babel-parser/test/fixtures/experimental/decorators-2/nested-class-decorator/output.json @@ -1,192 +1,57 @@ { "type": "File", - "start": 0, - "end": 52, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 6, - "column": 1 - } - }, + "start":0,"end":52,"loc":{"start":{"line":1,"column":0},"end":{"line":6,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 52, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 6, - "column": 1 - } - }, + "start":0,"end":52,"loc":{"start":{"line":1,"column":0},"end":{"line":6,"column":1}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 52, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 6, - "column": 1 - } - }, + "start":0,"end":52,"loc":{"start":{"line":1,"column":0},"end":{"line":6,"column":1}}, "decorators": [ { "type": "Decorator", - "start": 0, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 2 - } - }, + "start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":2}}, "expression": { "type": "ObjectExpression", - "start": 2, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":2,"end":34,"loc":{"start":{"line":1,"column":2},"end":{"line":3,"column":1}}, "properties": [ { "type": "ObjectProperty", - "start": 6, - "end": 32, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 28 - } - }, + "start":6,"end":32,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":28}}, "method": false, "key": { "type": "Identifier", - "start": 6, - "end": 11, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 7 - }, - "identifierName": "store" - }, + "start":6,"end":11,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":7},"identifierName":"store"}, "name": "store" }, "computed": false, "shorthand": false, "value": { "type": "ClassExpression", - "start": 13, - "end": 32, - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 28 - } - }, + "start":13,"end":32,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":28}}, "decorators": [ { "type": "Decorator", - "start": 13, - "end": 19, - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 15 - } - }, + "start":13,"end":19,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":15}}, "expression": { "type": "Identifier", - "start": 14, - "end": 19, - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 15 - }, - "identifierName": "inner" - }, + "start":14,"end":19,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":15},"identifierName":"inner"}, "name": "inner" } } ], "id": { "type": "Identifier", - "start": 26, - "end": 29, - "loc": { - "start": { - "line": 2, - "column": 22 - }, - "end": { - "line": 2, - "column": 25 - }, - "identifierName": "Foo" - }, + "start":26,"end":29,"loc":{"start":{"line":2,"column":22},"end":{"line":2,"column":25},"identifierName":"Foo"}, "name": "Foo" }, "superClass": null, "body": { "type": "ClassBody", - "start": 30, - "end": 32, - "loc": { - "start": { - "line": 2, - "column": 26 - }, - "end": { - "line": 2, - "column": 28 - } - }, + "start":30,"end":32,"loc":{"start":{"line":2,"column":26},"end":{"line":2,"column":28}}, "body": [] } } @@ -197,36 +62,13 @@ ], "id": { "type": "Identifier", - "start": 42, - "end": 45, - "loc": { - "start": { - "line": 4, - "column": 6 - }, - "end": { - "line": 4, - "column": 9 - }, - "identifierName": "Bar" - }, + "start":42,"end":45,"loc":{"start":{"line":4,"column":6},"end":{"line":4,"column":9},"identifierName":"Bar"}, "name": "Bar" }, "superClass": null, "body": { "type": "ClassBody", - "start": 46, - "end": 52, - "loc": { - "start": { - "line": 4, - "column": 10 - }, - "end": { - "line": 6, - "column": 1 - } - }, + "start":46,"end":52,"loc":{"start":{"line":4,"column":10},"end":{"line":6,"column":1}}, "body": [] } } diff --git a/packages/babel-parser/test/fixtures/experimental/decorators-2/nested-method-decorator-parameters/output.json b/packages/babel-parser/test/fixtures/experimental/decorators-2/nested-method-decorator-parameters/output.json index 9c14f3d08b01..30f31ef3355d 100644 --- a/packages/babel-parser/test/fixtures/experimental/decorators-2/nested-method-decorator-parameters/output.json +++ b/packages/babel-parser/test/fixtures/experimental/decorators-2/nested-method-decorator-parameters/output.json @@ -1,186 +1,51 @@ { "type": "File", - "start": 0, - "end": 112, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 9, - "column": 1 - } - }, + "start":0,"end":112,"loc":{"start":{"line":1,"column":0},"end":{"line":9,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 112, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 9, - "column": 1 - } - }, + "start":0,"end":112,"loc":{"start":{"line":1,"column":0},"end":{"line":9,"column":1}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 112, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 9, - "column": 1 - } - }, + "start":0,"end":112,"loc":{"start":{"line":1,"column":0},"end":{"line":9,"column":1}}, "id": { "type": "Identifier", - "start": 6, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "Bar" - }, + "start":6,"end":9,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":9},"identifierName":"Bar"}, "name": "Bar" }, "superClass": null, "body": { "type": "ClassBody", - "start": 9, - "end": 112, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 9, - "column": 1 - } - }, + "start":9,"end":112,"loc":{"start":{"line":1,"column":9},"end":{"line":9,"column":1}}, "body": [ { "type": "ClassMethod", - "start": 13, - "end": 110, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 8, - "column": 18 - } - }, + "start":13,"end":110,"loc":{"start":{"line":2,"column":2},"end":{"line":8,"column":18}}, "decorators": [ { "type": "Decorator", - "start": 13, - "end": 91, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 7, - "column": 3 - } - }, + "start":13,"end":91,"loc":{"start":{"line":2,"column":2},"end":{"line":7,"column":3}}, "expression": { "type": "CallExpression", - "start": 14, - "end": 91, - "loc": { - "start": { - "line": 2, - "column": 3 - }, - "end": { - "line": 7, - "column": 3 - } - }, + "start":14,"end":91,"loc":{"start":{"line":2,"column":3},"end":{"line":7,"column":3}}, "callee": { "type": "Identifier", - "start": 14, - "end": 19, - "loc": { - "start": { - "line": 2, - "column": 3 - }, - "end": { - "line": 2, - "column": 8 - }, - "identifierName": "outer" - }, + "start":14,"end":19,"loc":{"start":{"line":2,"column":3},"end":{"line":2,"column":8},"identifierName":"outer"}, "name": "outer" }, "arguments": [ { "type": "ClassExpression", - "start": 25, - "end": 87, - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 6, - "column": 5 - } - }, + "start":25,"end":87,"loc":{"start":{"line":3,"column":4},"end":{"line":6,"column":5}}, "decorators": [ { "type": "Decorator", - "start": 25, - "end": 34, - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 13 - } - }, + "start":25,"end":34,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":13}}, "expression": { "type": "Identifier", - "start": 26, - "end": 34, - "loc": { - "start": { - "line": 3, - "column": 5 - }, - "end": { - "line": 3, - "column": 13 - }, - "identifierName": "classDec" - }, + "start":26,"end":34,"loc":{"start":{"line":3,"column":5},"end":{"line":3,"column":13},"identifierName":"classDec"}, "name": "classDec" } } @@ -189,63 +54,18 @@ "superClass": null, "body": { "type": "ClassBody", - "start": 41, - "end": 87, - "loc": { - "start": { - "line": 3, - "column": 20 - }, - "end": { - "line": 6, - "column": 5 - } - }, + "start":41,"end":87,"loc":{"start":{"line":3,"column":20},"end":{"line":6,"column":5}}, "body": [ { "type": "ClassMethod", - "start": 50, - "end": 80, - "loc": { - "start": { - "line": 4, - "column": 6 - }, - "end": { - "line": 5, - "column": 22 - } - }, + "start":50,"end":80,"loc":{"start":{"line":4,"column":6},"end":{"line":5,"column":22}}, "decorators": [ { "type": "Decorator", - "start": 50, - "end": 56, - "loc": { - "start": { - "line": 4, - "column": 6 - }, - "end": { - "line": 4, - "column": 12 - } - }, + "start":50,"end":56,"loc":{"start":{"line":4,"column":6},"end":{"line":4,"column":12}}, "expression": { "type": "Identifier", - "start": 51, - "end": 56, - "loc": { - "start": { - "line": 4, - "column": 7 - }, - "end": { - "line": 4, - "column": 12 - }, - "identifierName": "inner" - }, + "start":51,"end":56,"loc":{"start":{"line":4,"column":7},"end":{"line":4,"column":12},"identifierName":"inner"}, "name": "inner" } } @@ -253,19 +73,7 @@ "static": false, "key": { "type": "Identifier", - "start": 64, - "end": 75, - "loc": { - "start": { - "line": 5, - "column": 6 - }, - "end": { - "line": 5, - "column": 17 - }, - "identifierName": "innerMethod" - }, + "start":64,"end":75,"loc":{"start":{"line":5,"column":6},"end":{"line":5,"column":17},"identifierName":"innerMethod"}, "name": "innerMethod" }, "computed": false, @@ -276,18 +84,7 @@ "params": [], "body": { "type": "BlockStatement", - "start": 78, - "end": 80, - "loc": { - "start": { - "line": 5, - "column": 20 - }, - "end": { - "line": 5, - "column": 22 - } - }, + "start":78,"end":80,"loc":{"start":{"line":5,"column":20},"end":{"line":5,"column":22}}, "body": [], "directives": [] } @@ -302,19 +99,7 @@ "static": false, "key": { "type": "Identifier", - "start": 94, - "end": 105, - "loc": { - "start": { - "line": 8, - "column": 2 - }, - "end": { - "line": 8, - "column": 13 - }, - "identifierName": "outerMethod" - }, + "start":94,"end":105,"loc":{"start":{"line":8,"column":2},"end":{"line":8,"column":13},"identifierName":"outerMethod"}, "name": "outerMethod" }, "computed": false, @@ -325,18 +110,7 @@ "params": [], "body": { "type": "BlockStatement", - "start": 108, - "end": 110, - "loc": { - "start": { - "line": 8, - "column": 16 - }, - "end": { - "line": 8, - "column": 18 - } - }, + "start":108,"end":110,"loc":{"start":{"line":8,"column":16},"end":{"line":8,"column":18}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/experimental/decorators-2/nested-method-decorator/output.json b/packages/babel-parser/test/fixtures/experimental/decorators-2/nested-method-decorator/output.json index 1499a3ede531..893a938ea525 100644 --- a/packages/babel-parser/test/fixtures/experimental/decorators-2/nested-method-decorator/output.json +++ b/packages/babel-parser/test/fixtures/experimental/decorators-2/nested-method-decorator/output.json @@ -1,154 +1,42 @@ { "type": "File", - "start": 0, - "end": 107, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 9, - "column": 1 - } - }, + "start":0,"end":107,"loc":{"start":{"line":1,"column":0},"end":{"line":9,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 107, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 9, - "column": 1 - } - }, + "start":0,"end":107,"loc":{"start":{"line":1,"column":0},"end":{"line":9,"column":1}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 107, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 9, - "column": 1 - } - }, + "start":0,"end":107,"loc":{"start":{"line":1,"column":0},"end":{"line":9,"column":1}}, "id": { "type": "Identifier", - "start": 6, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "Bar" - }, + "start":6,"end":9,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":9},"identifierName":"Bar"}, "name": "Bar" }, "superClass": null, "body": { "type": "ClassBody", - "start": 9, - "end": 107, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 9, - "column": 1 - } - }, + "start":9,"end":107,"loc":{"start":{"line":1,"column":9},"end":{"line":9,"column":1}}, "body": [ { "type": "ClassMethod", - "start": 13, - "end": 105, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 8, - "column": 18 - } - }, + "start":13,"end":105,"loc":{"start":{"line":2,"column":2},"end":{"line":8,"column":18}}, "decorators": [ { "type": "Decorator", - "start": 13, - "end": 86, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 7, - "column": 3 - } - }, + "start":13,"end":86,"loc":{"start":{"line":2,"column":2},"end":{"line":7,"column":3}}, "expression": { "type": "ClassExpression", - "start": 20, - "end": 82, - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 6, - "column": 5 - } - }, + "start":20,"end":82,"loc":{"start":{"line":3,"column":4},"end":{"line":6,"column":5}}, "decorators": [ { "type": "Decorator", - "start": 20, - "end": 29, - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 13 - } - }, + "start":20,"end":29,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":13}}, "expression": { "type": "Identifier", - "start": 21, - "end": 29, - "loc": { - "start": { - "line": 3, - "column": 5 - }, - "end": { - "line": 3, - "column": 13 - }, - "identifierName": "classDec" - }, + "start":21,"end":29,"loc":{"start":{"line":3,"column":5},"end":{"line":3,"column":13},"identifierName":"classDec"}, "name": "classDec" } } @@ -157,63 +45,18 @@ "superClass": null, "body": { "type": "ClassBody", - "start": 36, - "end": 82, - "loc": { - "start": { - "line": 3, - "column": 20 - }, - "end": { - "line": 6, - "column": 5 - } - }, + "start":36,"end":82,"loc":{"start":{"line":3,"column":20},"end":{"line":6,"column":5}}, "body": [ { "type": "ClassMethod", - "start": 45, - "end": 75, - "loc": { - "start": { - "line": 4, - "column": 6 - }, - "end": { - "line": 5, - "column": 22 - } - }, + "start":45,"end":75,"loc":{"start":{"line":4,"column":6},"end":{"line":5,"column":22}}, "decorators": [ { "type": "Decorator", - "start": 45, - "end": 51, - "loc": { - "start": { - "line": 4, - "column": 6 - }, - "end": { - "line": 4, - "column": 12 - } - }, + "start":45,"end":51,"loc":{"start":{"line":4,"column":6},"end":{"line":4,"column":12}}, "expression": { "type": "Identifier", - "start": 46, - "end": 51, - "loc": { - "start": { - "line": 4, - "column": 7 - }, - "end": { - "line": 4, - "column": 12 - }, - "identifierName": "inner" - }, + "start":46,"end":51,"loc":{"start":{"line":4,"column":7},"end":{"line":4,"column":12},"identifierName":"inner"}, "name": "inner" } } @@ -221,19 +64,7 @@ "static": false, "key": { "type": "Identifier", - "start": 59, - "end": 70, - "loc": { - "start": { - "line": 5, - "column": 6 - }, - "end": { - "line": 5, - "column": 17 - }, - "identifierName": "innerMethod" - }, + "start":59,"end":70,"loc":{"start":{"line":5,"column":6},"end":{"line":5,"column":17},"identifierName":"innerMethod"}, "name": "innerMethod" }, "computed": false, @@ -244,18 +75,7 @@ "params": [], "body": { "type": "BlockStatement", - "start": 73, - "end": 75, - "loc": { - "start": { - "line": 5, - "column": 20 - }, - "end": { - "line": 5, - "column": 22 - } - }, + "start":73,"end":75,"loc":{"start":{"line":5,"column":20},"end":{"line":5,"column":22}}, "body": [], "directives": [] } @@ -268,19 +88,7 @@ "static": false, "key": { "type": "Identifier", - "start": 89, - "end": 100, - "loc": { - "start": { - "line": 8, - "column": 2 - }, - "end": { - "line": 8, - "column": 13 - }, - "identifierName": "outerMethod" - }, + "start":89,"end":100,"loc":{"start":{"line":8,"column":2},"end":{"line":8,"column":13},"identifierName":"outerMethod"}, "name": "outerMethod" }, "computed": false, @@ -291,18 +99,7 @@ "params": [], "body": { "type": "BlockStatement", - "start": 103, - "end": 105, - "loc": { - "start": { - "line": 8, - "column": 16 - }, - "end": { - "line": 8, - "column": 18 - } - }, + "start":103,"end":105,"loc":{"start":{"line":8,"column":16},"end":{"line":8,"column":18}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/experimental/decorators-2/no-class-method-parameter/options.json b/packages/babel-parser/test/fixtures/experimental/decorators-2/no-class-method-parameter/options.json deleted file mode 100644 index 7b4e6dc626ae..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/decorators-2/no-class-method-parameter/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Stage 2 decorators cannot be used to decorate parameters (2:14)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/decorators-2/no-class-method-parameter/output.json b/packages/babel-parser/test/fixtures/experimental/decorators-2/no-class-method-parameter/output.json new file mode 100644 index 000000000000..fd172b86c4d5 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/decorators-2/no-class-method-parameter/output.json @@ -0,0 +1,71 @@ +{ + "type": "File", + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "errors": [ + "SyntaxError: Decorators cannot be used to decorate parameters (2:14)" + ], + "program": { + "type": "Program", + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "id": { + "type": "Identifier", + "start":6,"end":9,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":9},"identifierName":"Foo"}, + "name": "Foo" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":10,"end":38,"loc":{"start":{"line":1,"column":10},"end":{"line":3,"column":1}}, + "body": [ + { + "type": "ClassMethod", + "start":14,"end":36,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":24}}, + "static": false, + "key": { + "type": "Identifier", + "start":14,"end":25,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":13},"identifierName":"constructor"}, + "name": "constructor" + }, + "computed": false, + "kind": "constructor", + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start":31,"end":32,"loc":{"start":{"line":2,"column":19},"end":{"line":2,"column":20},"identifierName":"x"}, + "name": "x", + "decorators": [ + { + "type": "Decorator", + "start":26,"end":30,"loc":{"start":{"line":2,"column":14},"end":{"line":2,"column":18}}, + "expression": { + "type": "Identifier", + "start":27,"end":30,"loc":{"start":{"line":2,"column":15},"end":{"line":2,"column":18},"identifierName":"foo"}, + "name": "foo" + } + } + ] + } + ], + "body": { + "type": "BlockStatement", + "start":34,"end":36,"loc":{"start":{"line":2,"column":22},"end":{"line":2,"column":24}}, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/decorators-2/no-constructor-decorators/options.json b/packages/babel-parser/test/fixtures/experimental/decorators-2/no-constructor-decorators/options.json deleted file mode 100644 index a26ed7cacb84..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/decorators-2/no-constructor-decorators/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "You can't attach decorators to a class constructor (2:2)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/decorators-2/no-constructor-decorators/output.json b/packages/babel-parser/test/fixtures/experimental/decorators-2/no-constructor-decorators/output.json new file mode 100644 index 000000000000..d1b72ec9914b --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/decorators-2/no-constructor-decorators/output.json @@ -0,0 +1,65 @@ +{ + "type": "File", + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "errors": [ + "SyntaxError: Decorators can't be used with a constructor. Did you mean '@dec class { ... }'? (2:2)" + ], + "program": { + "type": "Program", + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "id": { + "type": "Identifier", + "start":6,"end":9,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":9},"identifierName":"Foo"}, + "name": "Foo" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":10,"end":38,"loc":{"start":{"line":1,"column":10},"end":{"line":4,"column":1}}, + "body": [ + { + "type": "ClassMethod", + "start":14,"end":36,"loc":{"start":{"line":2,"column":2},"end":{"line":3,"column":17}}, + "decorators": [ + { + "type": "Decorator", + "start":14,"end":18,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":6}}, + "expression": { + "type": "Identifier", + "start":15,"end":18,"loc":{"start":{"line":2,"column":3},"end":{"line":2,"column":6},"identifierName":"abc"}, + "name": "abc" + } + } + ], + "static": false, + "key": { + "type": "Identifier", + "start":21,"end":32,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":13},"identifierName":"constructor"}, + "name": "constructor" + }, + "computed": false, + "kind": "constructor", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":34,"end":36,"loc":{"start":{"line":3,"column":15},"end":{"line":3,"column":17}}, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/decorators-2/no-export-decorators-on-class/options.json b/packages/babel-parser/test/fixtures/experimental/decorators-2/no-export-decorators-on-class/options.json index cb54fc794402..2104ca43283f 100644 --- a/packages/babel-parser/test/fixtures/experimental/decorators-2/no-export-decorators-on-class/options.json +++ b/packages/babel-parser/test/fixtures/experimental/decorators-2/no-export-decorators-on-class/options.json @@ -1,4 +1,3 @@ { - "sourceType": "module", - "throws": "Using the export keyword between a decorator and a class is not allowed. Please use `export @dec class` instead. (2:0)" + "sourceType": "module" } diff --git a/packages/babel-parser/test/fixtures/experimental/decorators-2/no-export-decorators-on-class/output.json b/packages/babel-parser/test/fixtures/experimental/decorators-2/no-export-decorators-on-class/output.json new file mode 100644 index 000000000000..5ede51a7199f --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/decorators-2/no-export-decorators-on-class/output.json @@ -0,0 +1,42 @@ +{ + "type": "File", + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":23}}, + "errors": [ + "SyntaxError: Using the export keyword between a decorator and a class is not allowed. Please use `export @dec class` instead. (2:0)" + ], + "program": { + "type": "Program", + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":23}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExportDefaultDeclaration", + "start":5,"end":28,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":23}}, + "declaration": { + "type": "ClassDeclaration", + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":23}}, + "decorators": [ + { + "type": "Decorator", + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, + "expression": { + "type": "Identifier", + "start":1,"end":4,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":4},"identifierName":"foo"}, + "name": "foo" + } + } + ], + "id": null, + "superClass": null, + "body": { + "type": "ClassBody", + "start":26,"end":28,"loc":{"start":{"line":2,"column":21},"end":{"line":2,"column":23}}, + "body": [] + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/decorators-2/no-function-parameters/options.json b/packages/babel-parser/test/fixtures/experimental/decorators-2/no-function-parameters/options.json deleted file mode 100644 index 6637fc7f8345..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/decorators-2/no-function-parameters/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Stage 2 decorators cannot be used to decorate parameters (1:14)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/decorators-2/no-function-parameters/output.json b/packages/babel-parser/test/fixtures/experimental/decorators-2/no-function-parameters/output.json new file mode 100644 index 000000000000..47d78bbffa84 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/decorators-2/no-function-parameters/output.json @@ -0,0 +1,51 @@ +{ + "type": "File", + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, + "errors": [ + "SyntaxError: Decorators cannot be used to decorate parameters (1:14)" + ], + "program": { + "type": "Program", + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, + "id": { + "type": "Identifier", + "start":9,"end":13,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":13},"identifierName":"func"}, + "name": "func" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start":19,"end":20,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":20},"identifierName":"x"}, + "name": "x", + "decorators": [ + { + "type": "Decorator", + "start":14,"end":18,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":18}}, + "expression": { + "type": "Identifier", + "start":15,"end":18,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":18},"identifierName":"foo"}, + "name": "foo" + } + } + ] + } + ], + "body": { + "type": "BlockStatement", + "start":22,"end":24,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":24}}, + "body": [], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/decorators-2/no-object-method-parameters/options.json b/packages/babel-parser/test/fixtures/experimental/decorators-2/no-object-method-parameters/options.json deleted file mode 100644 index b1730696933e..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/decorators-2/no-object-method-parameters/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Stage 2 decorators cannot be used to decorate parameters (2:9)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/decorators-2/no-object-method-parameters/output.json b/packages/babel-parser/test/fixtures/experimental/decorators-2/no-object-method-parameters/output.json new file mode 100644 index 000000000000..ab145b851060 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/decorators-2/no-object-method-parameters/output.json @@ -0,0 +1,77 @@ +{ + "type": "File", + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":2}}, + "errors": [ + "SyntaxError: Decorators cannot be used to decorate parameters (2:9)" + ], + "program": { + "type": "Program", + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":2}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":2}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":4,"end":33,"loc":{"start":{"line":1,"column":4},"end":{"line":3,"column":1}}, + "id": { + "type": "Identifier", + "start":4,"end":7,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":7},"identifierName":"obj"}, + "name": "obj" + }, + "init": { + "type": "ObjectExpression", + "start":10,"end":33,"loc":{"start":{"line":1,"column":10},"end":{"line":3,"column":1}}, + "properties": [ + { + "type": "ObjectMethod", + "start":14,"end":31,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":19}}, + "method": true, + "key": { + "type": "Identifier", + "start":14,"end":20,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":8},"identifierName":"method"}, + "name": "method" + }, + "computed": false, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start":26,"end":27,"loc":{"start":{"line":2,"column":14},"end":{"line":2,"column":15},"identifierName":"x"}, + "name": "x", + "decorators": [ + { + "type": "Decorator", + "start":21,"end":25,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":13}}, + "expression": { + "type": "Identifier", + "start":22,"end":25,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":13},"identifierName":"foo"}, + "name": "foo" + } + } + ] + } + ], + "body": { + "type": "BlockStatement", + "start":29,"end":31,"loc":{"start":{"line":2,"column":17},"end":{"line":2,"column":19}}, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "kind": "var" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/decorators-2/no-object-methods/options.json b/packages/babel-parser/test/fixtures/experimental/decorators-2/no-object-methods/options.json index 7dd4ed9e2837..cab2cc563643 100644 --- a/packages/babel-parser/test/fixtures/experimental/decorators-2/no-object-methods/options.json +++ b/packages/babel-parser/test/fixtures/experimental/decorators-2/no-object-methods/options.json @@ -1,3 +1,10 @@ { - "throws": "Stage 2 decorators disallow object literal property decorators (2:2)" + "plugins": [ + [ + "decorators", + { + "decoratorsBeforeExport": false + } + ] + ] } diff --git a/packages/babel-parser/test/fixtures/experimental/decorators-2/no-object-methods/output.json b/packages/babel-parser/test/fixtures/experimental/decorators-2/no-object-methods/output.json new file mode 100644 index 000000000000..1268657c20ea --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/decorators-2/no-object-methods/output.json @@ -0,0 +1,71 @@ +{ + "type": "File", + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, + "errors": [ + "SyntaxError: Decorators cannot be used to decorate object literal properties (2:2)" + ], + "program": { + "type": "Program", + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":4,"end":32,"loc":{"start":{"line":1,"column":4},"end":{"line":5,"column":1}}, + "id": { + "type": "Identifier", + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"o"}, + "name": "o" + }, + "init": { + "type": "ObjectExpression", + "start":8,"end":32,"loc":{"start":{"line":1,"column":8},"end":{"line":5,"column":1}}, + "properties": [ + { + "type": "ObjectMethod", + "start":19,"end":30,"loc":{"start":{"line":3,"column":2},"end":{"line":4,"column":3}}, + "decorators": [ + { + "type": "Decorator", + "start":12,"end":16,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":6}}, + "expression": { + "type": "Identifier", + "start":13,"end":16,"loc":{"start":{"line":2,"column":3},"end":{"line":2,"column":6},"identifierName":"baz"}, + "name": "baz" + } + } + ], + "method": true, + "key": { + "type": "Identifier", + "start":19,"end":22,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":5},"identifierName":"foo"}, + "name": "foo" + }, + "computed": false, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":25,"end":30,"loc":{"start":{"line":3,"column":8},"end":{"line":4,"column":3}}, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "kind": "var" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/decorators-2/on-computed-name-method/output.json b/packages/babel-parser/test/fixtures/experimental/decorators-2/on-computed-name-method/output.json index 2757a35b0190..cc7ff9f301b5 100644 --- a/packages/babel-parser/test/fixtures/experimental/decorators-2/on-computed-name-method/output.json +++ b/packages/babel-parser/test/fixtures/experimental/decorators-2/on-computed-name-method/output.json @@ -1,125 +1,35 @@ { "type": "File", - "start": 0, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, "id": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "A" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, "name": "A" }, "superClass": null, "body": { "type": "ClassBody", - "start": 8, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":8,"end":33,"loc":{"start":{"line":1,"column":8},"end":{"line":4,"column":1}}, "body": [ { "type": "ClassMethod", - "start": 12, - "end": 31, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 3, - "column": 14 - } - }, + "start":12,"end":31,"loc":{"start":{"line":2,"column":2},"end":{"line":3,"column":14}}, "decorators": [ { "type": "Decorator", - "start": 12, - "end": 16, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 6 - } - }, + "start":12,"end":16,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":6}}, "expression": { "type": "Identifier", - "start": 13, - "end": 16, - "loc": { - "start": { - "line": 2, - "column": 3 - }, - "end": { - "line": 2, - "column": 6 - }, - "identifierName": "dec" - }, + "start":13,"end":16,"loc":{"start":{"line":2,"column":3},"end":{"line":2,"column":6},"identifierName":"dec"}, "name": "dec" } } @@ -128,18 +38,7 @@ "computed": true, "key": { "type": "StringLiteral", - "start": 20, - "end": 26, - "loc": { - "start": { - "line": 3, - "column": 3 - }, - "end": { - "line": 3, - "column": 9 - } - }, + "start":20,"end":26,"loc":{"start":{"line":3,"column":3},"end":{"line":3,"column":9}}, "extra": { "rawValue": "name", "raw": "'name'" @@ -153,18 +52,7 @@ "params": [], "body": { "type": "BlockStatement", - "start": 29, - "end": 31, - "loc": { - "start": { - "line": 3, - "column": 12 - }, - "end": { - "line": 3, - "column": 14 - } - }, + "start":29,"end":31,"loc":{"start":{"line":3,"column":12},"end":{"line":3,"column":14}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/experimental/decorators-2/parenthesized/output.json b/packages/babel-parser/test/fixtures/experimental/decorators-2/parenthesized/output.json index fa5fdd6bf2ef..ba7832ad2767 100644 --- a/packages/babel-parser/test/fixtures/experimental/decorators-2/parenthesized/output.json +++ b/packages/babel-parser/test/fixtures/experimental/decorators-2/parenthesized/output.json @@ -1,125 +1,35 @@ { "type": "File", - "start": 0, - "end": 91, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 6, - "column": 1 - } - }, + "start":0,"end":91,"loc":{"start":{"line":1,"column":0},"end":{"line":6,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 91, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 6, - "column": 1 - } - }, + "start":0,"end":91,"loc":{"start":{"line":1,"column":0},"end":{"line":6,"column":1}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 91, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 6, - "column": 1 - } - }, + "start":0,"end":91,"loc":{"start":{"line":1,"column":0},"end":{"line":6,"column":1}}, "decorators": [ { "type": "Decorator", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, "expression": { "type": "MemberExpression", - "start": 2, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":2,"end":11,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":11}}, "object": { "type": "CallExpression", - "start": 2, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":2,"end":7,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":7}}, "callee": { "type": "Identifier", - "start": 2, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "foo" - }, + "start":2,"end":5,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":5},"identifierName":"foo"}, "name": "foo" }, "arguments": [] }, "property": { "type": "Identifier", - "start": 8, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "bar" - }, + "start":8,"end":11,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":11},"identifierName":"bar"}, "name": "bar" }, "computed": false @@ -128,112 +38,32 @@ ], "id": { "type": "Identifier", - "start": 19, - "end": 22, - "loc": { - "start": { - "line": 2, - "column": 6 - }, - "end": { - "line": 2, - "column": 9 - }, - "identifierName": "Foo" - }, + "start":19,"end":22,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":9},"identifierName":"Foo"}, "name": "Foo" }, "superClass": null, "body": { "type": "ClassBody", - "start": 23, - "end": 91, - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 6, - "column": 1 - } - }, + "start":23,"end":91,"loc":{"start":{"line":2,"column":10},"end":{"line":6,"column":1}}, "body": [ { "type": "ClassMethod", - "start": 27, - "end": 60, - "loc": { - "start": { - "line": 3, - "column": 2 - }, - "end": { - "line": 3, - "column": 35 - } - }, + "start":27,"end":60,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":35}}, "decorators": [ { "type": "Decorator", - "start": 27, - "end": 48, - "loc": { - "start": { - "line": 3, - "column": 2 - }, - "end": { - "line": 3, - "column": 23 - } - }, + "start":27,"end":48,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":23}}, "expression": { "type": "MemberExpression", - "start": 29, - "end": 47, - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 22 - } - }, + "start":29,"end":47,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":22}}, "object": { "type": "Identifier", - "start": 29, - "end": 35, - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 10 - }, - "identifierName": "member" - }, + "start":29,"end":35,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":10},"identifierName":"member"}, "name": "member" }, "property": { "type": "Identifier", - "start": 36, - "end": 46, - "loc": { - "start": { - "line": 3, - "column": 11 - }, - "end": { - "line": 3, - "column": 21 - }, - "identifierName": "expression" - }, + "start":36,"end":46,"loc":{"start":{"line":3,"column":11},"end":{"line":3,"column":21},"identifierName":"expression"}, "name": "expression" }, "computed": true @@ -243,19 +73,7 @@ "static": false, "key": { "type": "Identifier", - "start": 49, - "end": 55, - "loc": { - "start": { - "line": 3, - "column": 24 - }, - "end": { - "line": 3, - "column": 30 - }, - "identifierName": "method" - }, + "start":49,"end":55,"loc":{"start":{"line":3,"column":24},"end":{"line":3,"column":30},"identifierName":"method"}, "name": "method" }, "computed": false, @@ -266,98 +84,30 @@ "params": [], "body": { "type": "BlockStatement", - "start": 58, - "end": 60, - "loc": { - "start": { - "line": 3, - "column": 33 - }, - "end": { - "line": 3, - "column": 35 - } - }, + "start":58,"end":60,"loc":{"start":{"line":3,"column":33},"end":{"line":3,"column":35}}, "body": [], "directives": [] } }, { "type": "ClassMethod", - "start": 64, - "end": 89, - "loc": { - "start": { - "line": 5, - "column": 2 - }, - "end": { - "line": 5, - "column": 27 - } - }, + "start":64,"end":89,"loc":{"start":{"line":5,"column":2},"end":{"line":5,"column":27}}, "decorators": [ { "type": "Decorator", - "start": 64, - "end": 76, - "loc": { - "start": { - "line": 5, - "column": 2 - }, - "end": { - "line": 5, - "column": 14 - } - }, + "start":64,"end":76,"loc":{"start":{"line":5,"column":2},"end":{"line":5,"column":14}}, "expression": { "type": "BinaryExpression", - "start": 66, - "end": 75, - "loc": { - "start": { - "line": 5, - "column": 4 - }, - "end": { - "line": 5, - "column": 13 - } - }, + "start":66,"end":75,"loc":{"start":{"line":5,"column":4},"end":{"line":5,"column":13}}, "left": { "type": "Identifier", - "start": 66, - "end": 69, - "loc": { - "start": { - "line": 5, - "column": 4 - }, - "end": { - "line": 5, - "column": 7 - }, - "identifierName": "foo" - }, + "start":66,"end":69,"loc":{"start":{"line":5,"column":4},"end":{"line":5,"column":7},"identifierName":"foo"}, "name": "foo" }, "operator": "+", "right": { "type": "Identifier", - "start": 72, - "end": 75, - "loc": { - "start": { - "line": 5, - "column": 10 - }, - "end": { - "line": 5, - "column": 13 - }, - "identifierName": "bar" - }, + "start":72,"end":75,"loc":{"start":{"line":5,"column":10},"end":{"line":5,"column":13},"identifierName":"bar"}, "name": "bar" } } @@ -366,19 +116,7 @@ "static": false, "key": { "type": "Identifier", - "start": 77, - "end": 84, - "loc": { - "start": { - "line": 5, - "column": 15 - }, - "end": { - "line": 5, - "column": 22 - }, - "identifierName": "method2" - }, + "start":77,"end":84,"loc":{"start":{"line":5,"column":15},"end":{"line":5,"column":22},"identifierName":"method2"}, "name": "method2" }, "computed": false, @@ -389,18 +127,7 @@ "params": [], "body": { "type": "BlockStatement", - "start": 87, - "end": 89, - "loc": { - "start": { - "line": 5, - "column": 25 - }, - "end": { - "line": 5, - "column": 27 - } - }, + "start":87,"end":89,"loc":{"start":{"line":5,"column":25},"end":{"line":5,"column":27}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/experimental/decorators-2/private-property/output.json b/packages/babel-parser/test/fixtures/experimental/decorators-2/private-property/output.json index cc4e05e15037..5ffd41290834 100644 --- a/packages/babel-parser/test/fixtures/experimental/decorators-2/private-property/output.json +++ b/packages/babel-parser/test/fixtures/experimental/decorators-2/private-property/output.json @@ -1,125 +1,35 @@ { "type": "File", - "start": 0, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "id": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "A" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, "name": "A" }, "superClass": null, "body": { "type": "ClassBody", - "start": 8, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":8,"end":28,"loc":{"start":{"line":1,"column":8},"end":{"line":3,"column":1}}, "body": [ { "type": "ClassPrivateProperty", - "start": 12, - "end": 26, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 16 - } - }, + "start":12,"end":26,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":16}}, "decorators": [ { "type": "Decorator", - "start": 12, - "end": 16, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 6 - } - }, + "start":12,"end":16,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":6}}, "expression": { "type": "Identifier", - "start": 13, - "end": 16, - "loc": { - "start": { - "line": 2, - "column": 3 - }, - "end": { - "line": 2, - "column": 6 - }, - "identifierName": "dec" - }, + "start":13,"end":16,"loc":{"start":{"line":2,"column":3},"end":{"line":2,"column":6},"identifierName":"dec"}, "name": "dec" } } @@ -127,50 +37,16 @@ "static": false, "key": { "type": "PrivateName", - "start": 17, - "end": 22, - "loc": { - "start": { - "line": 2, - "column": 7 - }, - "end": { - "line": 2, - "column": 12 - } - }, + "start":17,"end":22,"loc":{"start":{"line":2,"column":7},"end":{"line":2,"column":12}}, "id": { "type": "Identifier", - "start": 18, - "end": 22, - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 12 - }, - "identifierName": "name" - }, + "start":18,"end":22,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":12},"identifierName":"name"}, "name": "name" } }, "value": { "type": "NumericLiteral", - "start": 25, - "end": 26, - "loc": { - "start": { - "line": 2, - "column": 15 - }, - "end": { - "line": 2, - "column": 16 - } - }, + "start":25,"end":26,"loc":{"start":{"line":2,"column":15},"end":{"line":2,"column":16}}, "extra": { "rawValue": 0, "raw": "0" diff --git a/packages/babel-parser/test/fixtures/experimental/decorators-2/set-decorator/output.json b/packages/babel-parser/test/fixtures/experimental/decorators-2/set-decorator/output.json index 573d999a9e4e..73939907caaa 100644 --- a/packages/babel-parser/test/fixtures/experimental/decorators-2/set-decorator/output.json +++ b/packages/babel-parser/test/fixtures/experimental/decorators-2/set-decorator/output.json @@ -1,125 +1,35 @@ { "type": "File", - "start": 0, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":37,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":37,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":37,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "id": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "A" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, "name": "A" }, "superClass": null, "body": { "type": "ClassBody", - "start": 8, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":8,"end":37,"loc":{"start":{"line":1,"column":8},"end":{"line":3,"column":1}}, "body": [ { "type": "ClassMethod", - "start": 12, - "end": 35, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 25 - } - }, + "start":12,"end":35,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":25}}, "decorators": [ { "type": "Decorator", - "start": 12, - "end": 16, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 6 - } - }, + "start":12,"end":16,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":6}}, "expression": { "type": "Identifier", - "start": 13, - "end": 16, - "loc": { - "start": { - "line": 2, - "column": 3 - }, - "end": { - "line": 2, - "column": 6 - }, - "identifierName": "foo" - }, + "start":13,"end":16,"loc":{"start":{"line":2,"column":3},"end":{"line":2,"column":6},"identifierName":"foo"}, "name": "foo" } } @@ -127,19 +37,7 @@ "static": false, "key": { "type": "Identifier", - "start": 21, - "end": 27, - "loc": { - "start": { - "line": 2, - "column": 11 - }, - "end": { - "line": 2, - "column": 17 - }, - "identifierName": "setter" - }, + "start":21,"end":27,"loc":{"start":{"line":2,"column":11},"end":{"line":2,"column":17},"identifierName":"setter"}, "name": "setter" }, "computed": false, @@ -150,36 +48,13 @@ "params": [ { "type": "Identifier", - "start": 28, - "end": 32, - "loc": { - "start": { - "line": 2, - "column": 18 - }, - "end": { - "line": 2, - "column": 22 - }, - "identifierName": "_val" - }, + "start":28,"end":32,"loc":{"start":{"line":2,"column":18},"end":{"line":2,"column":22},"identifierName":"_val"}, "name": "_val" } ], "body": { "type": "BlockStatement", - "start": 33, - "end": 35, - "loc": { - "start": { - "line": 2, - "column": 23 - }, - "end": { - "line": 2, - "column": 25 - } - }, + "start":33,"end":35,"loc":{"start":{"line":2,"column":23},"end":{"line":2,"column":25}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/experimental/decorators-2/static-method/output.json b/packages/babel-parser/test/fixtures/experimental/decorators-2/static-method/output.json index ecda9741a8ec..5d13b2af9ce7 100644 --- a/packages/babel-parser/test/fixtures/experimental/decorators-2/static-method/output.json +++ b/packages/babel-parser/test/fixtures/experimental/decorators-2/static-method/output.json @@ -1,125 +1,35 @@ { "type": "File", - "start": 0, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, "id": { "type": "Identifier", - "start": 6, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "Foo" - }, + "start":6,"end":9,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":9},"identifierName":"Foo"}, "name": "Foo" }, "superClass": null, "body": { "type": "ClassBody", - "start": 10, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":10,"end":38,"loc":{"start":{"line":1,"column":10},"end":{"line":4,"column":1}}, "body": [ { "type": "ClassMethod", - "start": 14, - "end": 36, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 3, - "column": 17 - } - }, + "start":14,"end":36,"loc":{"start":{"line":2,"column":2},"end":{"line":3,"column":17}}, "decorators": [ { "type": "Decorator", - "start": 14, - "end": 18, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 6 - } - }, + "start":14,"end":18,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":6}}, "expression": { "type": "Identifier", - "start": 15, - "end": 18, - "loc": { - "start": { - "line": 2, - "column": 3 - }, - "end": { - "line": 2, - "column": 6 - }, - "identifierName": "dec" - }, + "start":15,"end":18,"loc":{"start":{"line":2,"column":3},"end":{"line":2,"column":6},"identifierName":"dec"}, "name": "dec" } } @@ -127,19 +37,7 @@ "static": true, "key": { "type": "Identifier", - "start": 28, - "end": 31, - "loc": { - "start": { - "line": 3, - "column": 9 - }, - "end": { - "line": 3, - "column": 12 - }, - "identifierName": "bar" - }, + "start":28,"end":31,"loc":{"start":{"line":3,"column":9},"end":{"line":3,"column":12},"identifierName":"bar"}, "name": "bar" }, "computed": false, @@ -150,18 +48,7 @@ "params": [], "body": { "type": "BlockStatement", - "start": 34, - "end": 36, - "loc": { - "start": { - "line": 3, - "column": 15 - }, - "end": { - "line": 3, - "column": 17 - } - }, + "start":34,"end":36,"loc":{"start":{"line":3,"column":15},"end":{"line":3,"column":17}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/experimental/decorators-2/static-property/output.json b/packages/babel-parser/test/fixtures/experimental/decorators-2/static-property/output.json index bb0fc456e61c..eb62fec97a53 100644 --- a/packages/babel-parser/test/fixtures/experimental/decorators-2/static-property/output.json +++ b/packages/babel-parser/test/fixtures/experimental/decorators-2/static-property/output.json @@ -1,125 +1,35 @@ { "type": "File", - "start": 0, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "id": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "A" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, "name": "A" }, "superClass": null, "body": { "type": "ClassBody", - "start": 8, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":8,"end":34,"loc":{"start":{"line":1,"column":8},"end":{"line":3,"column":1}}, "body": [ { "type": "ClassProperty", - "start": 12, - "end": 32, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 22 - } - }, + "start":12,"end":32,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":22}}, "decorators": [ { "type": "Decorator", - "start": 12, - "end": 16, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 6 - } - }, + "start":12,"end":16,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":6}}, "expression": { "type": "Identifier", - "start": 13, - "end": 16, - "loc": { - "start": { - "line": 2, - "column": 3 - }, - "end": { - "line": 2, - "column": 6 - }, - "identifierName": "dec" - }, + "start":13,"end":16,"loc":{"start":{"line":2,"column":3},"end":{"line":2,"column":6},"identifierName":"dec"}, "name": "dec" } } @@ -127,36 +37,13 @@ "static": true, "key": { "type": "Identifier", - "start": 24, - "end": 28, - "loc": { - "start": { - "line": 2, - "column": 14 - }, - "end": { - "line": 2, - "column": 18 - }, - "identifierName": "name" - }, + "start":24,"end":28,"loc":{"start":{"line":2,"column":14},"end":{"line":2,"column":18},"identifierName":"name"}, "name": "name" }, "computed": false, "value": { "type": "NumericLiteral", - "start": 31, - "end": 32, - "loc": { - "start": { - "line": 2, - "column": 21 - }, - "end": { - "line": 2, - "column": 22 - } - }, + "start":31,"end":32,"loc":{"start":{"line":2,"column":21},"end":{"line":2,"column":22}}, "extra": { "rawValue": 0, "raw": "0" diff --git a/packages/babel-parser/test/fixtures/experimental/decorators/class-decorator-assignment/output.json b/packages/babel-parser/test/fixtures/experimental/decorators/class-decorator-assignment/output.json index 1da946b580da..aa7f5f5cb04f 100644 --- a/packages/babel-parser/test/fixtures/experimental/decorators/class-decorator-assignment/output.json +++ b/packages/babel-parser/test/fixtures/experimental/decorators/class-decorator-assignment/output.json @@ -1,160 +1,47 @@ { "type": "File", - "start": 0, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, "program": { "type": "Program", - "start": 0, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":4,"end":27,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":27}}, "id": { "type": "Identifier", - "start": 4, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "Foo" - }, + "start":4,"end":7,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":7},"identifierName":"Foo"}, "name": "Foo" }, "init": { "type": "ClassExpression", - "start": 10, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":10,"end":27,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":27}}, "decorators": [ { "type": "Decorator", - "start": 10, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":10,"end":14,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":14}}, "expression": { "type": "Identifier", - "start": 11, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 14 - }, - "identifierName": "foo" - }, + "start":11,"end":14,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":14},"identifierName":"foo"}, "name": "foo" } } ], "id": { "type": "Identifier", - "start": 21, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 24 - }, - "identifierName": "Foo" - }, + "start":21,"end":24,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":24},"identifierName":"Foo"}, "name": "Foo" }, "superClass": null, "body": { "type": "ClassBody", - "start": 25, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":25,"end":27,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":27}}, "body": [] } } diff --git a/packages/babel-parser/test/fixtures/experimental/decorators/class-decorator-call-expr/output.json b/packages/babel-parser/test/fixtures/experimental/decorators/class-decorator-call-expr/output.json index 73a9e36039c4..d1e510436a43 100644 --- a/packages/babel-parser/test/fixtures/experimental/decorators/class-decorator-call-expr/output.json +++ b/packages/babel-parser/test/fixtures/experimental/decorators/class-decorator-call-expr/output.json @@ -1,109 +1,31 @@ { "type": "File", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 12 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":12}}, "program": { "type": "Program", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 12 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":12}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 12 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":12}}, "decorators": [ { "type": "Decorator", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "expression": { "type": "CallExpression", - "start": 1, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":1,"end":11,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":11}}, "callee": { "type": "Identifier", - "start": 1, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 4 - }, - "identifierName": "foo" - }, + "start":1,"end":4,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":4},"identifierName":"foo"}, "name": "foo" }, "arguments": [ { "type": "StringLiteral", - "start": 5, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":5,"end":10,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":10}}, "extra": { "rawValue": "bar", "raw": "'bar'" @@ -116,36 +38,13 @@ ], "id": { "type": "Identifier", - "start": 18, - "end": 21, - "loc": { - "start": { - "line": 2, - "column": 6 - }, - "end": { - "line": 2, - "column": 9 - }, - "identifierName": "Foo" - }, + "start":18,"end":21,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":9},"identifierName":"Foo"}, "name": "Foo" }, "superClass": null, "body": { "type": "ClassBody", - "start": 22, - "end": 24, - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 12 - } - }, + "start":22,"end":24,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":12}}, "body": [] } } diff --git a/packages/babel-parser/test/fixtures/experimental/decorators/class-decorator-getter/output.json b/packages/babel-parser/test/fixtures/experimental/decorators/class-decorator-getter/output.json index 13de96b505a0..61665a28af00 100644 --- a/packages/babel-parser/test/fixtures/experimental/decorators/class-decorator-getter/output.json +++ b/packages/babel-parser/test/fixtures/experimental/decorators/class-decorator-getter/output.json @@ -1,125 +1,35 @@ { "type": "File", - "start": 0, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, "program": { "type": "Program", - "start": 0, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, "id": { "type": "Identifier", - "start": 6, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "Foo" - }, + "start":6,"end":9,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":9},"identifierName":"Foo"}, "name": "Foo" }, "superClass": null, "body": { "type": "ClassBody", - "start": 10, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":10,"end":31,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":31}}, "body": [ { "type": "ClassMethod", - "start": 12, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":12,"end":29,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":29}}, "decorators": [ { "type": "Decorator", - "start": 12, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":12,"end":16,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":16}}, "expression": { "type": "Identifier", - "start": 13, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 16 - }, - "identifierName": "foo" - }, + "start":13,"end":16,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":16},"identifierName":"foo"}, "name": "foo" } } @@ -127,19 +37,7 @@ "static": false, "key": { "type": "Identifier", - "start": 21, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 24 - }, - "identifierName": "bar" - }, + "start":21,"end":24,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":24},"identifierName":"bar"}, "name": "bar" }, "computed": false, @@ -150,18 +48,7 @@ "params": [], "body": { "type": "BlockStatement", - "start": 27, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":27,"end":29,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":29}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/experimental/decorators/class-decorator-same-line/output.json b/packages/babel-parser/test/fixtures/experimental/decorators/class-decorator-same-line/output.json index 1ad3eafe69c2..bb6ddaacfe24 100644 --- a/packages/babel-parser/test/fixtures/experimental/decorators/class-decorator-same-line/output.json +++ b/packages/babel-parser/test/fixtures/experimental/decorators/class-decorator-same-line/output.json @@ -1,114 +1,35 @@ { "type": "File", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "program": { "type": "Program", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "decorators": [ { "type": "Decorator", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - }, + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, "expression": { "type": "Identifier", - "start": 1, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 4 - }, - "identifierName": "foo" - }, + "start":1,"end":4,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":4},"identifierName":"foo"}, "name": "foo" } } ], "id": { "type": "Identifier", - "start": 11, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 14 - }, - "identifierName": "Foo" - }, + "start":11,"end":14,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":14},"identifierName":"Foo"}, "name": "Foo" }, "superClass": null, "body": { "type": "ClassBody", - "start": 15, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":15,"end":17,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":17}}, "body": [] } } diff --git a/packages/babel-parser/test/fixtures/experimental/decorators/class-decorator-setter/output.json b/packages/babel-parser/test/fixtures/experimental/decorators/class-decorator-setter/output.json index 03f0153ce87b..ed17f6e590c9 100644 --- a/packages/babel-parser/test/fixtures/experimental/decorators/class-decorator-setter/output.json +++ b/packages/babel-parser/test/fixtures/experimental/decorators/class-decorator-setter/output.json @@ -1,125 +1,35 @@ { "type": "File", - "start": 0, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, "program": { "type": "Program", - "start": 0, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, "id": { "type": "Identifier", - "start": 6, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "Foo" - }, + "start":6,"end":9,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":9},"identifierName":"Foo"}, "name": "Foo" }, "superClass": null, "body": { "type": "ClassBody", - "start": 10, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":10,"end":32,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":32}}, "body": [ { "type": "ClassMethod", - "start": 12, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":12,"end":30,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":30}}, "decorators": [ { "type": "Decorator", - "start": 12, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":12,"end":16,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":16}}, "expression": { "type": "Identifier", - "start": 13, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 16 - }, - "identifierName": "foo" - }, + "start":13,"end":16,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":16},"identifierName":"foo"}, "name": "foo" } } @@ -127,19 +37,7 @@ "static": false, "key": { "type": "Identifier", - "start": 21, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 24 - }, - "identifierName": "bar" - }, + "start":21,"end":24,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":24},"identifierName":"bar"}, "name": "bar" }, "computed": false, @@ -150,36 +48,13 @@ "params": [ { "type": "Identifier", - "start": 25, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 26 - }, - "identifierName": "f" - }, + "start":25,"end":26,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":26},"identifierName":"f"}, "name": "f" } ], "body": { "type": "BlockStatement", - "start": 28, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":28,"end":30,"loc":{"start":{"line":1,"column":28},"end":{"line":1,"column":30}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/experimental/decorators/class-decorator/output.json b/packages/babel-parser/test/fixtures/experimental/decorators/class-decorator/output.json index 2f219a49939a..1977b5cbd495 100644 --- a/packages/babel-parser/test/fixtures/experimental/decorators/class-decorator/output.json +++ b/packages/babel-parser/test/fixtures/experimental/decorators/class-decorator/output.json @@ -1,114 +1,35 @@ { "type": "File", - "start": 0, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, "decorators": [ { "type": "Decorator", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - }, + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, "expression": { "type": "Identifier", - "start": 1, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 4 - }, - "identifierName": "abc" - }, + "start":1,"end":4,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":4},"identifierName":"abc"}, "name": "abc" } } ], "id": { "type": "Identifier", - "start": 11, - "end": 14, - "loc": { - "start": { - "line": 2, - "column": 6 - }, - "end": { - "line": 2, - "column": 9 - }, - "identifierName": "Foo" - }, + "start":11,"end":14,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":9},"identifierName":"Foo"}, "name": "Foo" }, "superClass": null, "body": { "type": "ClassBody", - "start": 15, - "end": 19, - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":15,"end":19,"loc":{"start":{"line":2,"column":10},"end":{"line":4,"column":1}}, "body": [] } } diff --git a/packages/babel-parser/test/fixtures/experimental/decorators/class-decorators-multiple/output.json b/packages/babel-parser/test/fixtures/experimental/decorators/class-decorators-multiple/output.json index 8e9991ea817f..d2668cf74d85 100644 --- a/packages/babel-parser/test/fixtures/experimental/decorators/class-decorators-multiple/output.json +++ b/packages/babel-parser/test/fixtures/experimental/decorators/class-decorators-multiple/output.json @@ -1,157 +1,44 @@ { "type": "File", - "start": 0, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, "program": { "type": "Program", - "start": 0, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, "id": { "type": "Identifier", - "start": 6, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "Foo" - }, + "start":6,"end":9,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":9},"identifierName":"Foo"}, "name": "Foo" }, "superClass": null, "body": { "type": "ClassBody", - "start": 10, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":10,"end":32,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":32}}, "body": [ { "type": "ClassMethod", - "start": 12, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":12,"end":30,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":30}}, "decorators": [ { "type": "Decorator", - "start": 12, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":12,"end":16,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":16}}, "expression": { "type": "Identifier", - "start": 13, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 16 - }, - "identifierName": "foo" - }, + "start":13,"end":16,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":16},"identifierName":"foo"}, "name": "foo" } }, { "type": "Decorator", - "start": 17, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":17,"end":21,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":21}}, "expression": { "type": "Identifier", - "start": 18, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 21 - }, - "identifierName": "bar" - }, + "start":18,"end":21,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":21},"identifierName":"bar"}, "name": "bar" } } @@ -159,19 +46,7 @@ "static": false, "key": { "type": "Identifier", - "start": 22, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 25 - }, - "identifierName": "bar" - }, + "start":22,"end":25,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":25},"identifierName":"bar"}, "name": "bar" }, "computed": false, @@ -182,18 +57,7 @@ "params": [], "body": { "type": "BlockStatement", - "start": 28, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":28,"end":30,"loc":{"start":{"line":1,"column":28},"end":{"line":1,"column":30}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/experimental/decorators/class-method-parameter/output.json b/packages/babel-parser/test/fixtures/experimental/decorators/class-method-parameter/output.json index da595a9e8f28..05facf06c5eb 100644 --- a/packages/babel-parser/test/fixtures/experimental/decorators/class-method-parameter/output.json +++ b/packages/babel-parser/test/fixtures/experimental/decorators/class-method-parameter/output.json @@ -1,111 +1,32 @@ { "type": "File", - "start": 0, - "end": 67, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":67,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 67, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":67,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 67, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":67,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "id": { "type": "Identifier", - "start": 6, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "Foo" - }, + "start":6,"end":9,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":9},"identifierName":"Foo"}, "name": "Foo" }, "superClass": null, "body": { "type": "ClassBody", - "start": 10, - "end": 67, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":10,"end":67,"loc":{"start":{"line":1,"column":10},"end":{"line":3,"column":1}}, "body": [ { "type": "ClassMethod", - "start": 14, - "end": 65, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 53 - } - }, + "start":14,"end":65,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":53}}, "static": false, "key": { "type": "Identifier", - "start": 14, - "end": 25, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 13 - }, - "identifierName": "constructor" - }, + "start":14,"end":25,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":13},"identifierName":"constructor"}, "name": "constructor" }, "computed": false, @@ -116,64 +37,18 @@ "params": [ { "type": "Identifier", - "start": 33, - "end": 34, - "loc": { - "start": { - "line": 2, - "column": 21 - }, - "end": { - "line": 2, - "column": 22 - }, - "identifierName": "x" - }, + "start":33,"end":34,"loc":{"start":{"line":2,"column":21},"end":{"line":2,"column":22},"identifierName":"x"}, "name": "x", "decorators": [ { "type": "Decorator", - "start": 26, - "end": 32, - "loc": { - "start": { - "line": 2, - "column": 14 - }, - "end": { - "line": 2, - "column": 20 - } - }, + "start":26,"end":32,"loc":{"start":{"line":2,"column":14},"end":{"line":2,"column":20}}, "expression": { "type": "CallExpression", - "start": 27, - "end": 32, - "loc": { - "start": { - "line": 2, - "column": 15 - }, - "end": { - "line": 2, - "column": 20 - } - }, + "start":27,"end":32,"loc":{"start":{"line":2,"column":15},"end":{"line":2,"column":20}}, "callee": { "type": "Identifier", - "start": 27, - "end": 30, - "loc": { - "start": { - "line": 2, - "column": 15 - }, - "end": { - "line": 2, - "column": 18 - }, - "identifierName": "foo" - }, + "start":27,"end":30,"loc":{"start":{"line":2,"column":15},"end":{"line":2,"column":18},"identifierName":"foo"}, "name": "foo" }, "arguments": [] @@ -183,130 +58,39 @@ }, { "type": "Identifier", - "start": 60, - "end": 61, - "loc": { - "start": { - "line": 2, - "column": 48 - }, - "end": { - "line": 2, - "column": 49 - }, - "identifierName": "y" - }, + "start":60,"end":61,"loc":{"start":{"line":2,"column":48},"end":{"line":2,"column":49},"identifierName":"y"}, "name": "y", "decorators": [ { "type": "Decorator", - "start": 36, - "end": 52, - "loc": { - "start": { - "line": 2, - "column": 24 - }, - "end": { - "line": 2, - "column": 40 - } - }, + "start":36,"end":52,"loc":{"start":{"line":2,"column":24},"end":{"line":2,"column":40}}, "expression": { "type": "CallExpression", - "start": 37, - "end": 52, - "loc": { - "start": { - "line": 2, - "column": 25 - }, - "end": { - "line": 2, - "column": 40 - } - }, + "start":37,"end":52,"loc":{"start":{"line":2,"column":25},"end":{"line":2,"column":40}}, "callee": { "type": "Identifier", - "start": 37, - "end": 40, - "loc": { - "start": { - "line": 2, - "column": 25 - }, - "end": { - "line": 2, - "column": 28 - }, - "identifierName": "bar" - }, + "start":37,"end":40,"loc":{"start":{"line":2,"column":25},"end":{"line":2,"column":28},"identifierName":"bar"}, "name": "bar" }, "arguments": [ { "type": "ObjectExpression", - "start": 41, - "end": 51, - "loc": { - "start": { - "line": 2, - "column": 29 - }, - "end": { - "line": 2, - "column": 39 - } - }, + "start":41,"end":51,"loc":{"start":{"line":2,"column":29},"end":{"line":2,"column":39}}, "properties": [ { "type": "ObjectProperty", - "start": 43, - "end": 49, - "loc": { - "start": { - "line": 2, - "column": 31 - }, - "end": { - "line": 2, - "column": 37 - } - }, + "start":43,"end":49,"loc":{"start":{"line":2,"column":31},"end":{"line":2,"column":37}}, "method": false, "key": { "type": "Identifier", - "start": 43, - "end": 44, - "loc": { - "start": { - "line": 2, - "column": 31 - }, - "end": { - "line": 2, - "column": 32 - }, - "identifierName": "a" - }, + "start":43,"end":44,"loc":{"start":{"line":2,"column":31},"end":{"line":2,"column":32},"identifierName":"a"}, "name": "a" }, "computed": false, "shorthand": false, "value": { "type": "NumericLiteral", - "start": 46, - "end": 49, - "loc": { - "start": { - "line": 2, - "column": 34 - }, - "end": { - "line": 2, - "column": 37 - } - }, + "start":46,"end":49,"loc":{"start":{"line":2,"column":34},"end":{"line":2,"column":37}}, "extra": { "rawValue": 123, "raw": "123" @@ -321,47 +105,13 @@ }, { "type": "Decorator", - "start": 53, - "end": 59, - "loc": { - "start": { - "line": 2, - "column": 41 - }, - "end": { - "line": 2, - "column": 47 - } - }, + "start":53,"end":59,"loc":{"start":{"line":2,"column":41},"end":{"line":2,"column":47}}, "expression": { "type": "CallExpression", - "start": 54, - "end": 59, - "loc": { - "start": { - "line": 2, - "column": 42 - }, - "end": { - "line": 2, - "column": 47 - } - }, + "start":54,"end":59,"loc":{"start":{"line":2,"column":42},"end":{"line":2,"column":47}}, "callee": { "type": "Identifier", - "start": 54, - "end": 57, - "loc": { - "start": { - "line": 2, - "column": 42 - }, - "end": { - "line": 2, - "column": 45 - }, - "identifierName": "baz" - }, + "start":54,"end":57,"loc":{"start":{"line":2,"column":42},"end":{"line":2,"column":45},"identifierName":"baz"}, "name": "baz" }, "arguments": [] @@ -372,18 +122,7 @@ ], "body": { "type": "BlockStatement", - "start": 63, - "end": 65, - "loc": { - "start": { - "line": 2, - "column": 51 - }, - "end": { - "line": 2, - "column": 53 - } - }, + "start":63,"end":65,"loc":{"start":{"line":2,"column":51},"end":{"line":2,"column":53}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/experimental/decorators/computed-member-expr-on-prop/output.json b/packages/babel-parser/test/fixtures/experimental/decorators/computed-member-expr-on-prop/output.json index 5432f965ce09..153a2fef0aa5 100644 --- a/packages/babel-parser/test/fixtures/experimental/decorators/computed-member-expr-on-prop/output.json +++ b/packages/babel-parser/test/fixtures/experimental/decorators/computed-member-expr-on-prop/output.json @@ -1,156 +1,43 @@ { "type": "File", - "start": 0, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "id": { "type": "Identifier", - "start": 6, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "Foo" - }, + "start":6,"end":9,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":9},"identifierName":"Foo"}, "name": "Foo" }, "superClass": null, "body": { "type": "ClassBody", - "start": 10, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":10,"end":32,"loc":{"start":{"line":1,"column":10},"end":{"line":3,"column":1}}, "body": [ { "type": "ClassProperty", - "start": 14, - "end": 30, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 18 - } - }, + "start":14,"end":30,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":18}}, "decorators": [ { "type": "Decorator", - "start": 14, - "end": 23, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 11 - } - }, + "start":14,"end":23,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":11}}, "expression": { "type": "MemberExpression", - "start": 15, - "end": 23, - "loc": { - "start": { - "line": 2, - "column": 3 - }, - "end": { - "line": 2, - "column": 11 - } - }, + "start":15,"end":23,"loc":{"start":{"line":2,"column":3},"end":{"line":2,"column":11}}, "object": { "type": "Identifier", - "start": 15, - "end": 18, - "loc": { - "start": { - "line": 2, - "column": 3 - }, - "end": { - "line": 2, - "column": 6 - }, - "identifierName": "foo" - }, + "start":15,"end":18,"loc":{"start":{"line":2,"column":3},"end":{"line":2,"column":6},"identifierName":"foo"}, "name": "foo" }, "property": { "type": "Identifier", - "start": 19, - "end": 22, - "loc": { - "start": { - "line": 2, - "column": 7 - }, - "end": { - "line": 2, - "column": 10 - }, - "identifierName": "bar" - }, + "start":19,"end":22,"loc":{"start":{"line":2,"column":7},"end":{"line":2,"column":10},"identifierName":"bar"}, "name": "bar" }, "computed": true @@ -160,36 +47,13 @@ "static": false, "key": { "type": "Identifier", - "start": 24, - "end": 25, - "loc": { - "start": { - "line": 2, - "column": 12 - }, - "end": { - "line": 2, - "column": 13 - }, - "identifierName": "a" - }, + "start":24,"end":25,"loc":{"start":{"line":2,"column":12},"end":{"line":2,"column":13},"identifierName":"a"}, "name": "a" }, "computed": false, "value": { "type": "NumericLiteral", - "start": 28, - "end": 29, - "loc": { - "start": { - "line": 2, - "column": 16 - }, - "end": { - "line": 2, - "column": 17 - } - }, + "start":28,"end":29,"loc":{"start":{"line":2,"column":16},"end":{"line":2,"column":17}}, "extra": { "rawValue": 1, "raw": "1" diff --git a/packages/babel-parser/test/fixtures/experimental/decorators/computed-member-expression/output.json b/packages/babel-parser/test/fixtures/experimental/decorators/computed-member-expression/output.json index a9cbc8c8e73b..3d9bf0eb29e2 100644 --- a/packages/babel-parser/test/fixtures/experimental/decorators/computed-member-expression/output.json +++ b/packages/babel-parser/test/fixtures/experimental/decorators/computed-member-expression/output.json @@ -1,156 +1,43 @@ { "type": "File", - "start": 0, - "end": 41, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 6, - "column": 1 - } - }, + "start":0,"end":41,"loc":{"start":{"line":1,"column":0},"end":{"line":6,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 41, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 6, - "column": 1 - } - }, + "start":0,"end":41,"loc":{"start":{"line":1,"column":0},"end":{"line":6,"column":1}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 41, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 6, - "column": 1 - } - }, + "start":0,"end":41,"loc":{"start":{"line":1,"column":0},"end":{"line":6,"column":1}}, "id": { "type": "Identifier", - "start": 6, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "Foo" - }, + "start":6,"end":9,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":9},"identifierName":"Foo"}, "name": "Foo" }, "superClass": null, "body": { "type": "ClassBody", - "start": 10, - "end": 41, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 6, - "column": 1 - } - }, + "start":10,"end":41,"loc":{"start":{"line":1,"column":10},"end":{"line":6,"column":1}}, "body": [ { "type": "ClassMethod", - "start": 14, - "end": 39, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 5, - "column": 3 - } - }, + "start":14,"end":39,"loc":{"start":{"line":2,"column":2},"end":{"line":5,"column":3}}, "decorators": [ { "type": "Decorator", - "start": 14, - "end": 24, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 12 - } - }, + "start":14,"end":24,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":12}}, "expression": { "type": "MemberExpression", - "start": 15, - "end": 24, - "loc": { - "start": { - "line": 2, - "column": 3 - }, - "end": { - "line": 2, - "column": 12 - } - }, + "start":15,"end":24,"loc":{"start":{"line":2,"column":3},"end":{"line":2,"column":12}}, "object": { "type": "Identifier", - "start": 15, - "end": 18, - "loc": { - "start": { - "line": 2, - "column": 3 - }, - "end": { - "line": 2, - "column": 6 - }, - "identifierName": "bar" - }, + "start":15,"end":18,"loc":{"start":{"line":2,"column":3},"end":{"line":2,"column":6},"identifierName":"bar"}, "name": "bar" }, "property": { "type": "Identifier", - "start": 19, - "end": 23, - "loc": { - "start": { - "line": 2, - "column": 7 - }, - "end": { - "line": 2, - "column": 11 - }, - "identifierName": "bizz" - }, + "start":19,"end":23,"loc":{"start":{"line":2,"column":7},"end":{"line":2,"column":11},"identifierName":"bizz"}, "name": "bizz" }, "computed": true @@ -160,19 +47,7 @@ "static": false, "key": { "type": "Identifier", - "start": 27, - "end": 30, - "loc": { - "start": { - "line": 3, - "column": 2 - }, - "end": { - "line": 3, - "column": 5 - }, - "identifierName": "abc" - }, + "start":27,"end":30,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":5},"identifierName":"abc"}, "name": "abc" }, "computed": false, @@ -183,18 +58,7 @@ "params": [], "body": { "type": "BlockStatement", - "start": 33, - "end": 39, - "loc": { - "start": { - "line": 3, - "column": 8 - }, - "end": { - "line": 5, - "column": 3 - } - }, + "start":33,"end":39,"loc":{"start":{"line":3,"column":8},"end":{"line":5,"column":3}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/experimental/decorators/export-decorators-on-class/output.json b/packages/babel-parser/test/fixtures/experimental/decorators/export-decorators-on-class/output.json index 45bae118fd6e..ae2ee71fdf41 100644 --- a/packages/babel-parser/test/fixtures/experimental/decorators/export-decorators-on-class/output.json +++ b/packages/babel-parser/test/fixtures/experimental/decorators/export-decorators-on-class/output.json @@ -1,130 +1,40 @@ { "type": "File", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 17 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":17}}, "program": { "type": "Program", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 17 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":17}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExportNamedDeclaration", - "start": 5, - "end": 22, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 17 - } - }, + "start":5,"end":22,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":17}}, "specifiers": [], "source": null, "declaration": { "type": "ClassDeclaration", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 17 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":17}}, "decorators": [ { "type": "Decorator", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - }, + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, "expression": { "type": "Identifier", - "start": 1, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 4 - }, - "identifierName": "foo" - }, + "start":1,"end":4,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":4},"identifierName":"foo"}, "name": "foo" } } ], "id": { "type": "Identifier", - "start": 18, - "end": 19, - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 14 - }, - "identifierName": "A" - }, + "start":18,"end":19,"loc":{"start":{"line":2,"column":13},"end":{"line":2,"column":14},"identifierName":"A"}, "name": "A" }, "superClass": null, "body": { "type": "ClassBody", - "start": 20, - "end": 22, - "loc": { - "start": { - "line": 2, - "column": 15 - }, - "end": { - "line": 2, - "column": 17 - } - }, + "start":20,"end":22,"loc":{"start":{"line":2,"column":15},"end":{"line":2,"column":17}}, "body": [] } } diff --git a/packages/babel-parser/test/fixtures/experimental/decorators/export-default-declaration-function-declaration-parameter/output.json b/packages/babel-parser/test/fixtures/experimental/decorators/export-default-declaration-function-declaration-parameter/output.json index d0b7148af2ee..db5d3138150c 100644 --- a/packages/babel-parser/test/fixtures/experimental/decorators/export-default-declaration-function-declaration-parameter/output.json +++ b/packages/babel-parser/test/fixtures/experimental/decorators/export-default-declaration-function-declaration-parameter/output.json @@ -1,77 +1,21 @@ { "type": "File", - "start": 0, - "end": 68, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 68 - } - }, + "start":0,"end":68,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":68}}, "program": { "type": "Program", - "start": 0, - "end": 68, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 68 - } - }, + "start":0,"end":68,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":68}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExportDefaultDeclaration", - "start": 0, - "end": 68, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 68 - } - }, + "start":0,"end":68,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":68}}, "declaration": { "type": "FunctionDeclaration", - "start": 15, - "end": 68, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 68 - } - }, + "start":15,"end":68,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":68}}, "id": { "type": "Identifier", - "start": 24, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 28 - }, - "identifierName": "func" - }, + "start":24,"end":28,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":28},"identifierName":"func"}, "name": "func" }, "generator": false, @@ -79,64 +23,18 @@ "params": [ { "type": "Identifier", - "start": 36, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 36 - }, - "end": { - "line": 1, - "column": 37 - }, - "identifierName": "x" - }, + "start":36,"end":37,"loc":{"start":{"line":1,"column":36},"end":{"line":1,"column":37},"identifierName":"x"}, "name": "x", "decorators": [ { "type": "Decorator", - "start": 29, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":29,"end":35,"loc":{"start":{"line":1,"column":29},"end":{"line":1,"column":35}}, "expression": { "type": "CallExpression", - "start": 30, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":30,"end":35,"loc":{"start":{"line":1,"column":30},"end":{"line":1,"column":35}}, "callee": { "type": "Identifier", - "start": 30, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 1, - "column": 33 - }, - "identifierName": "foo" - }, + "start":30,"end":33,"loc":{"start":{"line":1,"column":30},"end":{"line":1,"column":33},"identifierName":"foo"}, "name": "foo" }, "arguments": [] @@ -146,130 +44,39 @@ }, { "type": "Identifier", - "start": 63, - "end": 64, - "loc": { - "start": { - "line": 1, - "column": 63 - }, - "end": { - "line": 1, - "column": 64 - }, - "identifierName": "y" - }, + "start":63,"end":64,"loc":{"start":{"line":1,"column":63},"end":{"line":1,"column":64},"identifierName":"y"}, "name": "y", "decorators": [ { "type": "Decorator", - "start": 39, - "end": 55, - "loc": { - "start": { - "line": 1, - "column": 39 - }, - "end": { - "line": 1, - "column": 55 - } - }, + "start":39,"end":55,"loc":{"start":{"line":1,"column":39},"end":{"line":1,"column":55}}, "expression": { "type": "CallExpression", - "start": 40, - "end": 55, - "loc": { - "start": { - "line": 1, - "column": 40 - }, - "end": { - "line": 1, - "column": 55 - } - }, + "start":40,"end":55,"loc":{"start":{"line":1,"column":40},"end":{"line":1,"column":55}}, "callee": { "type": "Identifier", - "start": 40, - "end": 43, - "loc": { - "start": { - "line": 1, - "column": 40 - }, - "end": { - "line": 1, - "column": 43 - }, - "identifierName": "bar" - }, + "start":40,"end":43,"loc":{"start":{"line":1,"column":40},"end":{"line":1,"column":43},"identifierName":"bar"}, "name": "bar" }, "arguments": [ { "type": "ObjectExpression", - "start": 44, - "end": 54, - "loc": { - "start": { - "line": 1, - "column": 44 - }, - "end": { - "line": 1, - "column": 54 - } - }, + "start":44,"end":54,"loc":{"start":{"line":1,"column":44},"end":{"line":1,"column":54}}, "properties": [ { "type": "ObjectProperty", - "start": 46, - "end": 52, - "loc": { - "start": { - "line": 1, - "column": 46 - }, - "end": { - "line": 1, - "column": 52 - } - }, + "start":46,"end":52,"loc":{"start":{"line":1,"column":46},"end":{"line":1,"column":52}}, "method": false, "key": { "type": "Identifier", - "start": 46, - "end": 47, - "loc": { - "start": { - "line": 1, - "column": 46 - }, - "end": { - "line": 1, - "column": 47 - }, - "identifierName": "a" - }, + "start":46,"end":47,"loc":{"start":{"line":1,"column":46},"end":{"line":1,"column":47},"identifierName":"a"}, "name": "a" }, "computed": false, "shorthand": false, "value": { "type": "NumericLiteral", - "start": 49, - "end": 52, - "loc": { - "start": { - "line": 1, - "column": 49 - }, - "end": { - "line": 1, - "column": 52 - } - }, + "start":49,"end":52,"loc":{"start":{"line":1,"column":49},"end":{"line":1,"column":52}}, "extra": { "rawValue": 123, "raw": "123" @@ -284,47 +91,13 @@ }, { "type": "Decorator", - "start": 56, - "end": 62, - "loc": { - "start": { - "line": 1, - "column": 56 - }, - "end": { - "line": 1, - "column": 62 - } - }, + "start":56,"end":62,"loc":{"start":{"line":1,"column":56},"end":{"line":1,"column":62}}, "expression": { "type": "CallExpression", - "start": 57, - "end": 62, - "loc": { - "start": { - "line": 1, - "column": 57 - }, - "end": { - "line": 1, - "column": 62 - } - }, + "start":57,"end":62,"loc":{"start":{"line":1,"column":57},"end":{"line":1,"column":62}}, "callee": { "type": "Identifier", - "start": 57, - "end": 60, - "loc": { - "start": { - "line": 1, - "column": 57 - }, - "end": { - "line": 1, - "column": 60 - }, - "identifierName": "baz" - }, + "start":57,"end":60,"loc":{"start":{"line":1,"column":57},"end":{"line":1,"column":60},"identifierName":"baz"}, "name": "baz" }, "arguments": [] @@ -335,18 +108,7 @@ ], "body": { "type": "BlockStatement", - "start": 66, - "end": 68, - "loc": { - "start": { - "line": 1, - "column": 66 - }, - "end": { - "line": 1, - "column": 68 - } - }, + "start":66,"end":68,"loc":{"start":{"line":1,"column":66},"end":{"line":1,"column":68}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/experimental/decorators/export-default-decorators-on-class/output.json b/packages/babel-parser/test/fixtures/experimental/decorators/export-default-decorators-on-class/output.json index 0cc967280f5e..258470686ade 100644 --- a/packages/babel-parser/test/fixtures/experimental/decorators/export-default-decorators-on-class/output.json +++ b/packages/babel-parser/test/fixtures/experimental/decorators/export-default-decorators-on-class/output.json @@ -1,92 +1,25 @@ { "type": "File", - "start": 0, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 23 - } - }, + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":23}}, "program": { "type": "Program", - "start": 0, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 23 - } - }, + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":23}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExportDefaultDeclaration", - "start": 5, - "end": 28, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 23 - } - }, + "start":5,"end":28,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":23}}, "declaration": { "type": "ClassDeclaration", - "start": 0, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 23 - } - }, + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":23}}, "decorators": [ { "type": "Decorator", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - }, + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, "expression": { "type": "Identifier", - "start": 1, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 4 - }, - "identifierName": "foo" - }, + "start":1,"end":4,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":4},"identifierName":"foo"}, "name": "foo" } } @@ -95,18 +28,7 @@ "superClass": null, "body": { "type": "ClassBody", - "start": 26, - "end": 28, - "loc": { - "start": { - "line": 2, - "column": 21 - }, - "end": { - "line": 2, - "column": 23 - } - }, + "start":26,"end":28,"loc":{"start":{"line":2,"column":21},"end":{"line":2,"column":23}}, "body": [] } } diff --git a/packages/babel-parser/test/fixtures/experimental/decorators/export-default-with-nested-class/output.json b/packages/babel-parser/test/fixtures/experimental/decorators/export-default-with-nested-class/output.json index a63b4c84a28d..ba2ceee1469f 100644 --- a/packages/babel-parser/test/fixtures/experimental/decorators/export-default-with-nested-class/output.json +++ b/packages/babel-parser/test/fixtures/experimental/decorators/export-default-with-nested-class/output.json @@ -1,159 +1,46 @@ { "type": "File", - "start": 0, - "end": 109, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 7, - "column": 1 - } - }, + "start":0,"end":109,"loc":{"start":{"line":1,"column":0},"end":{"line":7,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 109, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 7, - "column": 1 - } - }, + "start":0,"end":109,"loc":{"start":{"line":1,"column":0},"end":{"line":7,"column":1}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExportDefaultDeclaration", - "start": 17, - "end": 109, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 7, - "column": 1 - } - }, + "start":17,"end":109,"loc":{"start":{"line":2,"column":0},"end":{"line":7,"column":1}}, "declaration": { "type": "ClassDeclaration", - "start": 0, - "end": 109, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 7, - "column": 1 - } - }, + "start":0,"end":109,"loc":{"start":{"line":1,"column":0},"end":{"line":7,"column":1}}, "decorators": [ { "type": "Decorator", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "expression": { "type": "Identifier", - "start": 1, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 16 - }, - "identifierName": "ParentDecorator" - }, + "start":1,"end":16,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":16},"identifierName":"ParentDecorator"}, "name": "ParentDecorator" } } ], "id": { "type": "Identifier", - "start": 38, - "end": 49, - "loc": { - "start": { - "line": 2, - "column": 21 - }, - "end": { - "line": 2, - "column": 32 - }, - "identifierName": "ParentClass" - }, + "start":38,"end":49,"loc":{"start":{"line":2,"column":21},"end":{"line":2,"column":32},"identifierName":"ParentClass"}, "name": "ParentClass" }, "superClass": null, "body": { "type": "ClassBody", - "start": 50, - "end": 109, - "loc": { - "start": { - "line": 2, - "column": 33 - }, - "end": { - "line": 7, - "column": 1 - } - }, + "start":50,"end":109,"loc":{"start":{"line":2,"column":33},"end":{"line":7,"column":1}}, "body": [ { "type": "ClassMethod", - "start": 54, - "end": 107, - "loc": { - "start": { - "line": 3, - "column": 2 - }, - "end": { - "line": 6, - "column": 3 - } - }, + "start":54,"end":107,"loc":{"start":{"line":3,"column":2},"end":{"line":6,"column":3}}, "static": false, "key": { "type": "Identifier", - "start": 54, - "end": 69, - "loc": { - "start": { - "line": 3, - "column": 2 - }, - "end": { - "line": 3, - "column": 17 - }, - "identifierName": "makeNestedClass" - }, + "start":54,"end":69,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":17},"identifierName":"makeNestedClass"}, "name": "makeNestedClass" }, "computed": false, @@ -164,65 +51,20 @@ "params": [], "body": { "type": "BlockStatement", - "start": 72, - "end": 107, - "loc": { - "start": { - "line": 3, - "column": 20 - }, - "end": { - "line": 6, - "column": 3 - } - }, + "start":72,"end":107,"loc":{"start":{"line":3,"column":20},"end":{"line":6,"column":3}}, "body": [ { "type": "ClassDeclaration", - "start": 78, - "end": 103, - "loc": { - "start": { - "line": 4, - "column": 4 - }, - "end": { - "line": 5, - "column": 5 - } - }, + "start":78,"end":103,"loc":{"start":{"line":4,"column":4},"end":{"line":5,"column":5}}, "id": { "type": "Identifier", - "start": 84, - "end": 95, - "loc": { - "start": { - "line": 4, - "column": 10 - }, - "end": { - "line": 4, - "column": 21 - }, - "identifierName": "NestedClass" - }, + "start":84,"end":95,"loc":{"start":{"line":4,"column":10},"end":{"line":4,"column":21},"identifierName":"NestedClass"}, "name": "NestedClass" }, "superClass": null, "body": { "type": "ClassBody", - "start": 96, - "end": 103, - "loc": { - "start": { - "line": 4, - "column": 22 - }, - "end": { - "line": 5, - "column": 5 - } - }, + "start":96,"end":103,"loc":{"start":{"line":4,"column":22},"end":{"line":5,"column":5}}, "body": [] } } diff --git a/packages/babel-parser/test/fixtures/experimental/decorators/function-declaration-parameter/output.json b/packages/babel-parser/test/fixtures/experimental/decorators/function-declaration-parameter/output.json index b768e4ab0fb4..6f7de702a10b 100644 --- a/packages/babel-parser/test/fixtures/experimental/decorators/function-declaration-parameter/output.json +++ b/packages/babel-parser/test/fixtures/experimental/decorators/function-declaration-parameter/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 53, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 53 - } - }, + "start":0,"end":53,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":53}}, "program": { "type": "Program", - "start": 0, - "end": 53, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 53 - } - }, + "start":0,"end":53,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":53}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 53, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 53 - } - }, + "start":0,"end":53,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":53}}, "id": { "type": "Identifier", - "start": 9, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 13 - }, - "identifierName": "func" - }, + "start":9,"end":13,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":13},"identifierName":"func"}, "name": "func" }, "generator": false, @@ -65,64 +20,18 @@ "params": [ { "type": "Identifier", - "start": 21, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 22 - }, - "identifierName": "x" - }, + "start":21,"end":22,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":22},"identifierName":"x"}, "name": "x", "decorators": [ { "type": "Decorator", - "start": 14, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":14,"end":20,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":20}}, "expression": { "type": "CallExpression", - "start": 15, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":15,"end":20,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":20}}, "callee": { "type": "Identifier", - "start": 15, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 18 - }, - "identifierName": "foo" - }, + "start":15,"end":18,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":18},"identifierName":"foo"}, "name": "foo" }, "arguments": [] @@ -132,130 +41,39 @@ }, { "type": "Identifier", - "start": 48, - "end": 49, - "loc": { - "start": { - "line": 1, - "column": 48 - }, - "end": { - "line": 1, - "column": 49 - }, - "identifierName": "y" - }, + "start":48,"end":49,"loc":{"start":{"line":1,"column":48},"end":{"line":1,"column":49},"identifierName":"y"}, "name": "y", "decorators": [ { "type": "Decorator", - "start": 24, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 40 - } - }, + "start":24,"end":40,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":40}}, "expression": { "type": "CallExpression", - "start": 25, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 40 - } - }, + "start":25,"end":40,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":40}}, "callee": { "type": "Identifier", - "start": 25, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 28 - }, - "identifierName": "bar" - }, + "start":25,"end":28,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":28},"identifierName":"bar"}, "name": "bar" }, "arguments": [ { "type": "ObjectExpression", - "start": 29, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 1, - "column": 39 - } - }, + "start":29,"end":39,"loc":{"start":{"line":1,"column":29},"end":{"line":1,"column":39}}, "properties": [ { "type": "ObjectProperty", - "start": 31, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 31 - }, - "end": { - "line": 1, - "column": 37 - } - }, + "start":31,"end":37,"loc":{"start":{"line":1,"column":31},"end":{"line":1,"column":37}}, "method": false, "key": { "type": "Identifier", - "start": 31, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 31 - }, - "end": { - "line": 1, - "column": 32 - }, - "identifierName": "a" - }, + "start":31,"end":32,"loc":{"start":{"line":1,"column":31},"end":{"line":1,"column":32},"identifierName":"a"}, "name": "a" }, "computed": false, "shorthand": false, "value": { "type": "NumericLiteral", - "start": 34, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 34 - }, - "end": { - "line": 1, - "column": 37 - } - }, + "start":34,"end":37,"loc":{"start":{"line":1,"column":34},"end":{"line":1,"column":37}}, "extra": { "rawValue": 123, "raw": "123" @@ -270,47 +88,13 @@ }, { "type": "Decorator", - "start": 41, - "end": 47, - "loc": { - "start": { - "line": 1, - "column": 41 - }, - "end": { - "line": 1, - "column": 47 - } - }, + "start":41,"end":47,"loc":{"start":{"line":1,"column":41},"end":{"line":1,"column":47}}, "expression": { "type": "CallExpression", - "start": 42, - "end": 47, - "loc": { - "start": { - "line": 1, - "column": 42 - }, - "end": { - "line": 1, - "column": 47 - } - }, + "start":42,"end":47,"loc":{"start":{"line":1,"column":42},"end":{"line":1,"column":47}}, "callee": { "type": "Identifier", - "start": 42, - "end": 45, - "loc": { - "start": { - "line": 1, - "column": 42 - }, - "end": { - "line": 1, - "column": 45 - }, - "identifierName": "baz" - }, + "start":42,"end":45,"loc":{"start":{"line":1,"column":42},"end":{"line":1,"column":45},"identifierName":"baz"}, "name": "baz" }, "arguments": [] @@ -321,18 +105,7 @@ ], "body": { "type": "BlockStatement", - "start": 51, - "end": 53, - "loc": { - "start": { - "line": 1, - "column": 51 - }, - "end": { - "line": 1, - "column": 53 - } - }, + "start":51,"end":53,"loc":{"start":{"line":1,"column":51},"end":{"line":1,"column":53}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/experimental/decorators/function-expression-parameter/output.json b/packages/babel-parser/test/fixtures/experimental/decorators/function-expression-parameter/output.json index 8ad3ed205109..e2c8e1bf29c8 100644 --- a/packages/babel-parser/test/fixtures/experimental/decorators/function-expression-parameter/output.json +++ b/packages/babel-parser/test/fixtures/experimental/decorators/function-expression-parameter/output.json @@ -1,158 +1,45 @@ { "type": "File", - "start": 0, - "end": 63, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 63 - } - }, + "start":0,"end":63,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":63}}, "program": { "type": "Program", - "start": 0, - "end": 63, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 63 - } - }, + "start":0,"end":63,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":63}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 63, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 63 - } - }, + "start":0,"end":63,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":63}}, "declarations": [ { "type": "VariableDeclarator", - "start": 6, - "end": 62, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 62 - } - }, + "start":6,"end":62,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":62}}, "id": { "type": "Identifier", - "start": 6, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 10 - }, - "identifierName": "func" - }, + "start":6,"end":10,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":10},"identifierName":"func"}, "name": "func" }, "init": { "type": "FunctionExpression", - "start": 13, - "end": 62, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 62 - } - }, + "start":13,"end":62,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":62}}, "id": null, "generator": false, "async": false, "params": [ { "type": "Identifier", - "start": 30, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 1, - "column": 31 - }, - "identifierName": "x" - }, + "start":30,"end":31,"loc":{"start":{"line":1,"column":30},"end":{"line":1,"column":31},"identifierName":"x"}, "name": "x", "decorators": [ { "type": "Decorator", - "start": 23, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":23,"end":29,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":29}}, "expression": { "type": "CallExpression", - "start": 24, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":24,"end":29,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":29}}, "callee": { "type": "Identifier", - "start": 24, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 27 - }, - "identifierName": "foo" - }, + "start":24,"end":27,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":27},"identifierName":"foo"}, "name": "foo" }, "arguments": [] @@ -162,130 +49,39 @@ }, { "type": "Identifier", - "start": 57, - "end": 58, - "loc": { - "start": { - "line": 1, - "column": 57 - }, - "end": { - "line": 1, - "column": 58 - }, - "identifierName": "y" - }, + "start":57,"end":58,"loc":{"start":{"line":1,"column":57},"end":{"line":1,"column":58},"identifierName":"y"}, "name": "y", "decorators": [ { "type": "Decorator", - "start": 33, - "end": 49, - "loc": { - "start": { - "line": 1, - "column": 33 - }, - "end": { - "line": 1, - "column": 49 - } - }, + "start":33,"end":49,"loc":{"start":{"line":1,"column":33},"end":{"line":1,"column":49}}, "expression": { "type": "CallExpression", - "start": 34, - "end": 49, - "loc": { - "start": { - "line": 1, - "column": 34 - }, - "end": { - "line": 1, - "column": 49 - } - }, + "start":34,"end":49,"loc":{"start":{"line":1,"column":34},"end":{"line":1,"column":49}}, "callee": { "type": "Identifier", - "start": 34, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 34 - }, - "end": { - "line": 1, - "column": 37 - }, - "identifierName": "bar" - }, + "start":34,"end":37,"loc":{"start":{"line":1,"column":34},"end":{"line":1,"column":37},"identifierName":"bar"}, "name": "bar" }, "arguments": [ { "type": "ObjectExpression", - "start": 38, - "end": 48, - "loc": { - "start": { - "line": 1, - "column": 38 - }, - "end": { - "line": 1, - "column": 48 - } - }, + "start":38,"end":48,"loc":{"start":{"line":1,"column":38},"end":{"line":1,"column":48}}, "properties": [ { "type": "ObjectProperty", - "start": 40, - "end": 46, - "loc": { - "start": { - "line": 1, - "column": 40 - }, - "end": { - "line": 1, - "column": 46 - } - }, + "start":40,"end":46,"loc":{"start":{"line":1,"column":40},"end":{"line":1,"column":46}}, "method": false, "key": { "type": "Identifier", - "start": 40, - "end": 41, - "loc": { - "start": { - "line": 1, - "column": 40 - }, - "end": { - "line": 1, - "column": 41 - }, - "identifierName": "a" - }, + "start":40,"end":41,"loc":{"start":{"line":1,"column":40},"end":{"line":1,"column":41},"identifierName":"a"}, "name": "a" }, "computed": false, "shorthand": false, "value": { "type": "NumericLiteral", - "start": 43, - "end": 46, - "loc": { - "start": { - "line": 1, - "column": 43 - }, - "end": { - "line": 1, - "column": 46 - } - }, + "start":43,"end":46,"loc":{"start":{"line":1,"column":43},"end":{"line":1,"column":46}}, "extra": { "rawValue": 123, "raw": "123" @@ -300,47 +96,13 @@ }, { "type": "Decorator", - "start": 50, - "end": 56, - "loc": { - "start": { - "line": 1, - "column": 50 - }, - "end": { - "line": 1, - "column": 56 - } - }, + "start":50,"end":56,"loc":{"start":{"line":1,"column":50},"end":{"line":1,"column":56}}, "expression": { "type": "CallExpression", - "start": 51, - "end": 56, - "loc": { - "start": { - "line": 1, - "column": 51 - }, - "end": { - "line": 1, - "column": 56 - } - }, + "start":51,"end":56,"loc":{"start":{"line":1,"column":51},"end":{"line":1,"column":56}}, "callee": { "type": "Identifier", - "start": 51, - "end": 54, - "loc": { - "start": { - "line": 1, - "column": 51 - }, - "end": { - "line": 1, - "column": 54 - }, - "identifierName": "baz" - }, + "start":51,"end":54,"loc":{"start":{"line":1,"column":51},"end":{"line":1,"column":54},"identifierName":"baz"}, "name": "baz" }, "arguments": [] @@ -351,18 +113,7 @@ ], "body": { "type": "BlockStatement", - "start": 60, - "end": 62, - "loc": { - "start": { - "line": 1, - "column": 60 - }, - "end": { - "line": 1, - "column": 62 - } - }, + "start":60,"end":62,"loc":{"start":{"line":1,"column":60},"end":{"line":1,"column":62}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/experimental/decorators/method-decorator/output.json b/packages/babel-parser/test/fixtures/experimental/decorators/method-decorator/output.json index 3a8f32412f61..64a19f4a5472 100644 --- a/packages/babel-parser/test/fixtures/experimental/decorators/method-decorator/output.json +++ b/packages/babel-parser/test/fixtures/experimental/decorators/method-decorator/output.json @@ -1,125 +1,35 @@ { "type": "File", - "start": 0, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, "program": { "type": "Program", - "start": 0, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, "id": { "type": "Identifier", - "start": 6, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "Foo" - }, + "start":6,"end":9,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":9},"identifierName":"Foo"}, "name": "Foo" }, "superClass": null, "body": { "type": "ClassBody", - "start": 10, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":10,"end":27,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":27}}, "body": [ { "type": "ClassMethod", - "start": 12, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":12,"end":25,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":25}}, "decorators": [ { "type": "Decorator", - "start": 12, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":12,"end":16,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":16}}, "expression": { "type": "Identifier", - "start": 13, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 16 - }, - "identifierName": "foo" - }, + "start":13,"end":16,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":16},"identifierName":"foo"}, "name": "foo" } } @@ -127,19 +37,7 @@ "static": false, "key": { "type": "Identifier", - "start": 17, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 20 - }, - "identifierName": "bar" - }, + "start":17,"end":20,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":20},"identifierName":"bar"}, "name": "bar" }, "computed": false, @@ -150,18 +48,7 @@ "params": [], "body": { "type": "BlockStatement", - "start": 23, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":23,"end":25,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":25}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/experimental/decorators/method-generator-decorator/output.json b/packages/babel-parser/test/fixtures/experimental/decorators/method-generator-decorator/output.json index 8fb4c84a2e60..b20f69086b26 100644 --- a/packages/babel-parser/test/fixtures/experimental/decorators/method-generator-decorator/output.json +++ b/packages/babel-parser/test/fixtures/experimental/decorators/method-generator-decorator/output.json @@ -1,125 +1,35 @@ { "type": "File", - "start": 0, - "end": 45, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":0,"end":45,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 45, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":0,"end":45,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 45, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":0,"end":45,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, "id": { "type": "Identifier", - "start": 6, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "Foo" - }, + "start":6,"end":9,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":9},"identifierName":"Foo"}, "name": "Foo" }, "superClass": null, "body": { "type": "ClassBody", - "start": 10, - "end": 45, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":10,"end":45,"loc":{"start":{"line":1,"column":10},"end":{"line":4,"column":1}}, "body": [ { "type": "ClassMethod", - "start": 14, - "end": 43, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 3, - "column": 23 - } - }, + "start":14,"end":43,"loc":{"start":{"line":2,"column":2},"end":{"line":3,"column":23}}, "decorators": [ { "type": "Decorator", - "start": 14, - "end": 19, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 7 - } - }, + "start":14,"end":19,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":7}}, "expression": { "type": "Identifier", - "start": 15, - "end": 19, - "loc": { - "start": { - "line": 2, - "column": 3 - }, - "end": { - "line": 2, - "column": 7 - }, - "identifierName": "deco" - }, + "start":15,"end":19,"loc":{"start":{"line":2,"column":3},"end":{"line":2,"column":7},"identifierName":"deco"}, "name": "deco" } } @@ -128,19 +38,7 @@ "kind": "method", "key": { "type": "Identifier", - "start": 23, - "end": 38, - "loc": { - "start": { - "line": 3, - "column": 3 - }, - "end": { - "line": 3, - "column": 18 - }, - "identifierName": "generatorMethod" - }, + "start":23,"end":38,"loc":{"start":{"line":3,"column":3},"end":{"line":3,"column":18},"identifierName":"generatorMethod"}, "name": "generatorMethod" }, "computed": false, @@ -150,18 +48,7 @@ "params": [], "body": { "type": "BlockStatement", - "start": 41, - "end": 43, - "loc": { - "start": { - "line": 3, - "column": 21 - }, - "end": { - "line": 3, - "column": 23 - } - }, + "start":41,"end":43,"loc":{"start":{"line":3,"column":21},"end":{"line":3,"column":23}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/experimental/decorators/no-constructor-decorators/options.json b/packages/babel-parser/test/fixtures/experimental/decorators/no-constructor-decorators/options.json deleted file mode 100644 index a26ed7cacb84..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/decorators/no-constructor-decorators/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "You can't attach decorators to a class constructor (2:2)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/decorators/no-constructor-decorators/output.json b/packages/babel-parser/test/fixtures/experimental/decorators/no-constructor-decorators/output.json new file mode 100644 index 000000000000..d1b72ec9914b --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/decorators/no-constructor-decorators/output.json @@ -0,0 +1,65 @@ +{ + "type": "File", + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "errors": [ + "SyntaxError: Decorators can't be used with a constructor. Did you mean '@dec class { ... }'? (2:2)" + ], + "program": { + "type": "Program", + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "id": { + "type": "Identifier", + "start":6,"end":9,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":9},"identifierName":"Foo"}, + "name": "Foo" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":10,"end":38,"loc":{"start":{"line":1,"column":10},"end":{"line":4,"column":1}}, + "body": [ + { + "type": "ClassMethod", + "start":14,"end":36,"loc":{"start":{"line":2,"column":2},"end":{"line":3,"column":17}}, + "decorators": [ + { + "type": "Decorator", + "start":14,"end":18,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":6}}, + "expression": { + "type": "Identifier", + "start":15,"end":18,"loc":{"start":{"line":2,"column":3},"end":{"line":2,"column":6},"identifierName":"abc"}, + "name": "abc" + } + } + ], + "static": false, + "key": { + "type": "Identifier", + "start":21,"end":32,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":13},"identifierName":"constructor"}, + "name": "constructor" + }, + "computed": false, + "kind": "constructor", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":34,"end":36,"loc":{"start":{"line":3,"column":15},"end":{"line":3,"column":17}}, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/decorators/no-export-decorators-without-class/options.json b/packages/babel-parser/test/fixtures/experimental/decorators/no-export-decorators-without-class/options.json index 61c2c23daaae..b1e699b351b1 100644 --- a/packages/babel-parser/test/fixtures/experimental/decorators/no-export-decorators-without-class/options.json +++ b/packages/babel-parser/test/fixtures/experimental/decorators/no-export-decorators-without-class/options.json @@ -1,4 +1,7 @@ { - "throws": "You can only use decorators on an export when exporting a class (2:0)", + "plugins": [ + "decorators-legacy" + ], + "throws": "A decorated export must export a class declaration (2:0)", "sourceType": "module" -} +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/decorators/no-export-decorators/options.json b/packages/babel-parser/test/fixtures/experimental/decorators/no-export-decorators/options.json index 61c2c23daaae..b1e699b351b1 100644 --- a/packages/babel-parser/test/fixtures/experimental/decorators/no-export-decorators/options.json +++ b/packages/babel-parser/test/fixtures/experimental/decorators/no-export-decorators/options.json @@ -1,4 +1,7 @@ { - "throws": "You can only use decorators on an export when exporting a class (2:0)", + "plugins": [ + "decorators-legacy" + ], + "throws": "A decorated export must export a class declaration (2:0)", "sourceType": "module" -} +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/decorators/object-decorator/output.json b/packages/babel-parser/test/fixtures/experimental/decorators/object-decorator/output.json index 185dae7e4a7d..852e82ebfe3f 100644 --- a/packages/babel-parser/test/fixtures/experimental/decorators/object-decorator/output.json +++ b/packages/babel-parser/test/fixtures/experimental/decorators/object-decorator/output.json @@ -1,154 +1,42 @@ { "type": "File", - "start": 0, - "end": 43, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 43 - } - }, + "start":0,"end":43,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":43}}, "program": { "type": "Program", - "start": 0, - "end": 43, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 43 - } - }, + "start":0,"end":43,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":43}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 43, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 43 - } - }, + "start":0,"end":43,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":43}}, "decorators": [ { "type": "Decorator", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, "expression": { "type": "CallExpression", - "start": 1, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":1,"end":25,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":25}}, "callee": { "type": "Identifier", - "start": 1, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 4 - }, - "identifierName": "foo" - }, + "start":1,"end":4,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":4},"identifierName":"foo"}, "name": "foo" }, "arguments": [ { "type": "ObjectExpression", - "start": 5, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":5,"end":24,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":24}}, "properties": [ { "type": "ObjectProperty", - "start": 12, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":12,"end":22,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":22}}, "decorators": [ { "type": "Decorator", - "start": 7, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":7,"end":11,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":11}}, "expression": { "type": "Identifier", - "start": 8, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "bar" - }, + "start":8,"end":11,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":11},"identifierName":"bar"}, "name": "bar" } } @@ -156,37 +44,14 @@ "method": false, "key": { "type": "Identifier", - "start": 12, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 15 - }, - "identifierName": "foo" - }, + "start":12,"end":15,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":15},"identifierName":"foo"}, "name": "foo" }, "computed": false, "shorthand": false, "value": { "type": "StringLiteral", - "start": 17, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":17,"end":22,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":22}}, "extra": { "rawValue": "bar", "raw": "\"bar\"" @@ -201,69 +66,23 @@ }, { "type": "Decorator", - "start": 26, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":26,"end":30,"loc":{"start":{"line":1,"column":26},"end":{"line":1,"column":30}}, "expression": { "type": "Identifier", - "start": 27, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 30 - }, - "identifierName": "bar" - }, + "start":27,"end":30,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":30},"identifierName":"bar"}, "name": "bar" } } ], "id": { "type": "Identifier", - "start": 37, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 37 - }, - "end": { - "line": 1, - "column": 40 - }, - "identifierName": "Foo" - }, + "start":37,"end":40,"loc":{"start":{"line":1,"column":37},"end":{"line":1,"column":40},"identifierName":"Foo"}, "name": "Foo" }, "superClass": null, "body": { "type": "ClassBody", - "start": 41, - "end": 43, - "loc": { - "start": { - "line": 1, - "column": 41 - }, - "end": { - "line": 1, - "column": 43 - } - }, + "start":41,"end":43,"loc":{"start":{"line":1,"column":41},"end":{"line":1,"column":43}}, "body": [] } } diff --git a/packages/babel-parser/test/fixtures/experimental/decorators/object-method-parameter/output.json b/packages/babel-parser/test/fixtures/experimental/decorators/object-method-parameter/output.json index b50f70a27b37..5a29004a837e 100644 --- a/packages/babel-parser/test/fixtures/experimental/decorators/object-method-parameter/output.json +++ b/packages/babel-parser/test/fixtures/experimental/decorators/object-method-parameter/output.json @@ -1,125 +1,35 @@ { "type": "File", - "start": 0, - "end": 63, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 2 - } - }, + "start":0,"end":63,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":2}}, "program": { "type": "Program", - "start": 0, - "end": 63, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 2 - } - }, + "start":0,"end":63,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":2}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 63, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 2 - } - }, + "start":0,"end":63,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":2}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 62, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":4,"end":62,"loc":{"start":{"line":1,"column":4},"end":{"line":3,"column":1}}, "id": { "type": "Identifier", - "start": 4, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "obj" - }, + "start":4,"end":7,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":7},"identifierName":"obj"}, "name": "obj" }, "init": { "type": "ObjectExpression", - "start": 10, - "end": 62, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":10,"end":62,"loc":{"start":{"line":1,"column":10},"end":{"line":3,"column":1}}, "properties": [ { "type": "ObjectMethod", - "start": 14, - "end": 60, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 48 - } - }, + "start":14,"end":60,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":48}}, "method": true, "key": { "type": "Identifier", - "start": 14, - "end": 20, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 8 - }, - "identifierName": "method" - }, + "start":14,"end":20,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":8},"identifierName":"method"}, "name": "method" }, "computed": false, @@ -130,64 +40,18 @@ "params": [ { "type": "Identifier", - "start": 28, - "end": 29, - "loc": { - "start": { - "line": 2, - "column": 16 - }, - "end": { - "line": 2, - "column": 17 - }, - "identifierName": "x" - }, + "start":28,"end":29,"loc":{"start":{"line":2,"column":16},"end":{"line":2,"column":17},"identifierName":"x"}, "name": "x", "decorators": [ { "type": "Decorator", - "start": 21, - "end": 27, - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 15 - } - }, + "start":21,"end":27,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":15}}, "expression": { "type": "CallExpression", - "start": 22, - "end": 27, - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 15 - } - }, + "start":22,"end":27,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":15}}, "callee": { "type": "Identifier", - "start": 22, - "end": 25, - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 13 - }, - "identifierName": "foo" - }, + "start":22,"end":25,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":13},"identifierName":"foo"}, "name": "foo" }, "arguments": [] @@ -197,130 +61,39 @@ }, { "type": "Identifier", - "start": 55, - "end": 56, - "loc": { - "start": { - "line": 2, - "column": 43 - }, - "end": { - "line": 2, - "column": 44 - }, - "identifierName": "y" - }, + "start":55,"end":56,"loc":{"start":{"line":2,"column":43},"end":{"line":2,"column":44},"identifierName":"y"}, "name": "y", "decorators": [ { "type": "Decorator", - "start": 31, - "end": 47, - "loc": { - "start": { - "line": 2, - "column": 19 - }, - "end": { - "line": 2, - "column": 35 - } - }, + "start":31,"end":47,"loc":{"start":{"line":2,"column":19},"end":{"line":2,"column":35}}, "expression": { "type": "CallExpression", - "start": 32, - "end": 47, - "loc": { - "start": { - "line": 2, - "column": 20 - }, - "end": { - "line": 2, - "column": 35 - } - }, + "start":32,"end":47,"loc":{"start":{"line":2,"column":20},"end":{"line":2,"column":35}}, "callee": { "type": "Identifier", - "start": 32, - "end": 35, - "loc": { - "start": { - "line": 2, - "column": 20 - }, - "end": { - "line": 2, - "column": 23 - }, - "identifierName": "bar" - }, + "start":32,"end":35,"loc":{"start":{"line":2,"column":20},"end":{"line":2,"column":23},"identifierName":"bar"}, "name": "bar" }, "arguments": [ { "type": "ObjectExpression", - "start": 36, - "end": 46, - "loc": { - "start": { - "line": 2, - "column": 24 - }, - "end": { - "line": 2, - "column": 34 - } - }, + "start":36,"end":46,"loc":{"start":{"line":2,"column":24},"end":{"line":2,"column":34}}, "properties": [ { "type": "ObjectProperty", - "start": 38, - "end": 44, - "loc": { - "start": { - "line": 2, - "column": 26 - }, - "end": { - "line": 2, - "column": 32 - } - }, + "start":38,"end":44,"loc":{"start":{"line":2,"column":26},"end":{"line":2,"column":32}}, "method": false, "key": { "type": "Identifier", - "start": 38, - "end": 39, - "loc": { - "start": { - "line": 2, - "column": 26 - }, - "end": { - "line": 2, - "column": 27 - }, - "identifierName": "a" - }, + "start":38,"end":39,"loc":{"start":{"line":2,"column":26},"end":{"line":2,"column":27},"identifierName":"a"}, "name": "a" }, "computed": false, "shorthand": false, "value": { "type": "NumericLiteral", - "start": 41, - "end": 44, - "loc": { - "start": { - "line": 2, - "column": 29 - }, - "end": { - "line": 2, - "column": 32 - } - }, + "start":41,"end":44,"loc":{"start":{"line":2,"column":29},"end":{"line":2,"column":32}}, "extra": { "rawValue": 123, "raw": "123" @@ -335,47 +108,13 @@ }, { "type": "Decorator", - "start": 48, - "end": 54, - "loc": { - "start": { - "line": 2, - "column": 36 - }, - "end": { - "line": 2, - "column": 42 - } - }, + "start":48,"end":54,"loc":{"start":{"line":2,"column":36},"end":{"line":2,"column":42}}, "expression": { "type": "CallExpression", - "start": 49, - "end": 54, - "loc": { - "start": { - "line": 2, - "column": 37 - }, - "end": { - "line": 2, - "column": 42 - } - }, + "start":49,"end":54,"loc":{"start":{"line":2,"column":37},"end":{"line":2,"column":42}}, "callee": { "type": "Identifier", - "start": 49, - "end": 52, - "loc": { - "start": { - "line": 2, - "column": 37 - }, - "end": { - "line": 2, - "column": 40 - }, - "identifierName": "baz" - }, + "start":49,"end":52,"loc":{"start":{"line":2,"column":37},"end":{"line":2,"column":40},"identifierName":"baz"}, "name": "baz" }, "arguments": [] @@ -386,18 +125,7 @@ ], "body": { "type": "BlockStatement", - "start": 58, - "end": 60, - "loc": { - "start": { - "line": 2, - "column": 46 - }, - "end": { - "line": 2, - "column": 48 - } - }, + "start":58,"end":60,"loc":{"start":{"line":2,"column":46},"end":{"line":2,"column":48}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/experimental/do-expressions/conditional-statement/output.json b/packages/babel-parser/test/fixtures/experimental/do-expressions/conditional-statement/output.json index a21a24a89a8e..3f5de76a0efd 100644 --- a/packages/babel-parser/test/fixtures/experimental/do-expressions/conditional-statement/output.json +++ b/packages/babel-parser/test/fixtures/experimental/do-expressions/conditional-statement/output.json @@ -1,214 +1,57 @@ { "type": "File", - "start": 0, - "end": 77, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 2 - } - }, + "start":0,"end":77,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":2}}, "program": { "type": "Program", - "start": 0, - "end": 77, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 2 - } - }, + "start":0,"end":77,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":2}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 77, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 2 - } - }, + "start":0,"end":77,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":2}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 76, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 5, - "column": 1 - } - }, + "start":4,"end":76,"loc":{"start":{"line":1,"column":4},"end":{"line":5,"column":1}}, "id": { "type": "Identifier", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "x" - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"x"}, "name": "x" }, "init": { "type": "DoExpression", - "start": 8, - "end": 76, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 5, - "column": 1 - } - }, + "start":8,"end":76,"loc":{"start":{"line":1,"column":8},"end":{"line":5,"column":1}}, "body": { "type": "BlockStatement", - "start": 11, - "end": 76, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 5, - "column": 1 - } - }, + "start":11,"end":76,"loc":{"start":{"line":1,"column":11},"end":{"line":5,"column":1}}, "body": [ { "type": "IfStatement", - "start": 15, - "end": 74, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 4, - "column": 14 - } - }, + "start":15,"end":74,"loc":{"start":{"line":2,"column":2},"end":{"line":4,"column":14}}, "test": { "type": "CallExpression", - "start": 19, - "end": 24, - "loc": { - "start": { - "line": 2, - "column": 6 - }, - "end": { - "line": 2, - "column": 11 - } - }, + "start":19,"end":24,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":11}}, "callee": { "type": "Identifier", - "start": 19, - "end": 22, - "loc": { - "start": { - "line": 2, - "column": 6 - }, - "end": { - "line": 2, - "column": 9 - }, - "identifierName": "foo" - }, + "start":19,"end":22,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":9},"identifierName":"foo"}, "name": "foo" }, "arguments": [] }, "consequent": { "type": "BlockStatement", - "start": 26, - "end": 33, - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 20 - } - }, + "start":26,"end":33,"loc":{"start":{"line":2,"column":13},"end":{"line":2,"column":20}}, "body": [ { "type": "ExpressionStatement", - "start": 28, - "end": 31, - "loc": { - "start": { - "line": 2, - "column": 15 - }, - "end": { - "line": 2, - "column": 18 - } - }, + "start":28,"end":31,"loc":{"start":{"line":2,"column":15},"end":{"line":2,"column":18}}, "expression": { "type": "CallExpression", - "start": 28, - "end": 31, - "loc": { - "start": { - "line": 2, - "column": 15 - }, - "end": { - "line": 2, - "column": 18 - } - }, + "start":28,"end":31,"loc":{"start":{"line":2,"column":15},"end":{"line":2,"column":18}}, "callee": { "type": "Identifier", - "start": 28, - "end": 29, - "loc": { - "start": { - "line": 2, - "column": 15 - }, - "end": { - "line": 2, - "column": 16 - }, - "identifierName": "f" - }, + "start":28,"end":29,"loc":{"start":{"line":2,"column":15},"end":{"line":2,"column":16},"identifierName":"f"}, "name": "f" }, "arguments": [] @@ -219,109 +62,30 @@ }, "alternate": { "type": "IfStatement", - "start": 41, - "end": 74, - "loc": { - "start": { - "line": 3, - "column": 7 - }, - "end": { - "line": 4, - "column": 14 - } - }, + "start":41,"end":74,"loc":{"start":{"line":3,"column":7},"end":{"line":4,"column":14}}, "test": { "type": "CallExpression", - "start": 45, - "end": 50, - "loc": { - "start": { - "line": 3, - "column": 11 - }, - "end": { - "line": 3, - "column": 16 - } - }, + "start":45,"end":50,"loc":{"start":{"line":3,"column":11},"end":{"line":3,"column":16}}, "callee": { "type": "Identifier", - "start": 45, - "end": 48, - "loc": { - "start": { - "line": 3, - "column": 11 - }, - "end": { - "line": 3, - "column": 14 - }, - "identifierName": "bar" - }, + "start":45,"end":48,"loc":{"start":{"line":3,"column":11},"end":{"line":3,"column":14},"identifierName":"bar"}, "name": "bar" }, "arguments": [] }, "consequent": { "type": "BlockStatement", - "start": 52, - "end": 59, - "loc": { - "start": { - "line": 3, - "column": 18 - }, - "end": { - "line": 3, - "column": 25 - } - }, + "start":52,"end":59,"loc":{"start":{"line":3,"column":18},"end":{"line":3,"column":25}}, "body": [ { "type": "ExpressionStatement", - "start": 54, - "end": 57, - "loc": { - "start": { - "line": 3, - "column": 20 - }, - "end": { - "line": 3, - "column": 23 - } - }, + "start":54,"end":57,"loc":{"start":{"line":3,"column":20},"end":{"line":3,"column":23}}, "expression": { "type": "CallExpression", - "start": 54, - "end": 57, - "loc": { - "start": { - "line": 3, - "column": 20 - }, - "end": { - "line": 3, - "column": 23 - } - }, + "start":54,"end":57,"loc":{"start":{"line":3,"column":20},"end":{"line":3,"column":23}}, "callee": { "type": "Identifier", - "start": 54, - "end": 55, - "loc": { - "start": { - "line": 3, - "column": 20 - }, - "end": { - "line": 3, - "column": 21 - }, - "identifierName": "g" - }, + "start":54,"end":55,"loc":{"start":{"line":3,"column":20},"end":{"line":3,"column":21},"identifierName":"g"}, "name": "g" }, "arguments": [] @@ -332,62 +96,17 @@ }, "alternate": { "type": "BlockStatement", - "start": 67, - "end": 74, - "loc": { - "start": { - "line": 4, - "column": 7 - }, - "end": { - "line": 4, - "column": 14 - } - }, + "start":67,"end":74,"loc":{"start":{"line":4,"column":7},"end":{"line":4,"column":14}}, "body": [ { "type": "ExpressionStatement", - "start": 69, - "end": 72, - "loc": { - "start": { - "line": 4, - "column": 9 - }, - "end": { - "line": 4, - "column": 12 - } - }, + "start":69,"end":72,"loc":{"start":{"line":4,"column":9},"end":{"line":4,"column":12}}, "expression": { "type": "CallExpression", - "start": 69, - "end": 72, - "loc": { - "start": { - "line": 4, - "column": 9 - }, - "end": { - "line": 4, - "column": 12 - } - }, + "start":69,"end":72,"loc":{"start":{"line":4,"column":9},"end":{"line":4,"column":12}}, "callee": { "type": "Identifier", - "start": 69, - "end": 70, - "loc": { - "start": { - "line": 4, - "column": 9 - }, - "end": { - "line": 4, - "column": 10 - }, - "identifierName": "h" - }, + "start":69,"end":70,"loc":{"start":{"line":4,"column":9},"end":{"line":4,"column":10},"identifierName":"h"}, "name": "h" }, "arguments": [] diff --git a/packages/babel-parser/test/fixtures/experimental/do-expressions/scoping-variable/output.json b/packages/babel-parser/test/fixtures/experimental/do-expressions/scoping-variable/output.json index d3d35687409e..ea877745593d 100644 --- a/packages/babel-parser/test/fixtures/experimental/do-expressions/scoping-variable/output.json +++ b/packages/babel-parser/test/fixtures/experimental/do-expressions/scoping-variable/output.json @@ -1,184 +1,49 @@ { "type": "File", - "start": 0, - "end": 48, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 2 - } - }, + "start":0,"end":48,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":2}}, "program": { "type": "Program", - "start": 0, - "end": 48, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 2 - } - }, + "start":0,"end":48,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":2}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 48, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 2 - } - }, + "start":0,"end":48,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":2}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 47, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":4,"end":47,"loc":{"start":{"line":1,"column":4},"end":{"line":4,"column":1}}, "id": { "type": "Identifier", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "x" - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"x"}, "name": "x" }, "init": { "type": "DoExpression", - "start": 8, - "end": 47, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":8,"end":47,"loc":{"start":{"line":1,"column":8},"end":{"line":4,"column":1}}, "body": { "type": "BlockStatement", - "start": 11, - "end": 47, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":11,"end":47,"loc":{"start":{"line":1,"column":11},"end":{"line":4,"column":1}}, "body": [ { "type": "VariableDeclaration", - "start": 15, - "end": 29, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 16 - } - }, + "start":15,"end":29,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":16}}, "declarations": [ { "type": "VariableDeclarator", - "start": 19, - "end": 28, - "loc": { - "start": { - "line": 2, - "column": 6 - }, - "end": { - "line": 2, - "column": 15 - } - }, + "start":19,"end":28,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":15}}, "id": { "type": "Identifier", - "start": 19, - "end": 22, - "loc": { - "start": { - "line": 2, - "column": 6 - }, - "end": { - "line": 2, - "column": 9 - }, - "identifierName": "tmp" - }, + "start":19,"end":22,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":9},"identifierName":"tmp"}, "name": "tmp" }, "init": { "type": "CallExpression", - "start": 25, - "end": 28, - "loc": { - "start": { - "line": 2, - "column": 12 - }, - "end": { - "line": 2, - "column": 15 - } - }, + "start":25,"end":28,"loc":{"start":{"line":2,"column":12},"end":{"line":2,"column":15}}, "callee": { "type": "Identifier", - "start": 25, - "end": 26, - "loc": { - "start": { - "line": 2, - "column": 12 - }, - "end": { - "line": 2, - "column": 13 - }, - "identifierName": "f" - }, + "start":25,"end":26,"loc":{"start":{"line":2,"column":12},"end":{"line":2,"column":13},"identifierName":"f"}, "name": "f" }, "arguments": [] @@ -189,97 +54,29 @@ }, { "type": "ExpressionStatement", - "start": 32, - "end": 45, - "loc": { - "start": { - "line": 3, - "column": 2 - }, - "end": { - "line": 3, - "column": 15 - } - }, + "start":32,"end":45,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":15}}, "expression": { "type": "BinaryExpression", - "start": 32, - "end": 45, - "loc": { - "start": { - "line": 3, - "column": 2 - }, - "end": { - "line": 3, - "column": 15 - } - }, + "start":32,"end":45,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":15}}, "left": { "type": "BinaryExpression", - "start": 32, - "end": 41, - "loc": { - "start": { - "line": 3, - "column": 2 - }, - "end": { - "line": 3, - "column": 11 - } - }, + "start":32,"end":41,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":11}}, "left": { "type": "Identifier", - "start": 32, - "end": 35, - "loc": { - "start": { - "line": 3, - "column": 2 - }, - "end": { - "line": 3, - "column": 5 - }, - "identifierName": "tmp" - }, + "start":32,"end":35,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":5},"identifierName":"tmp"}, "name": "tmp" }, "operator": "*", "right": { "type": "Identifier", - "start": 38, - "end": 41, - "loc": { - "start": { - "line": 3, - "column": 8 - }, - "end": { - "line": 3, - "column": 11 - }, - "identifierName": "tmp" - }, + "start":38,"end":41,"loc":{"start":{"line":3,"column":8},"end":{"line":3,"column":11},"identifierName":"tmp"}, "name": "tmp" } }, "operator": "+", "right": { "type": "NumericLiteral", - "start": 44, - "end": 45, - "loc": { - "start": { - "line": 3, - "column": 14 - }, - "end": { - "line": 3, - "column": 15 - } - }, + "start":44,"end":45,"loc":{"start":{"line":3,"column":14},"end":{"line":3,"column":15}}, "extra": { "rawValue": 1, "raw": "1" diff --git a/packages/babel-parser/test/fixtures/experimental/do-expressions/with-jsx/output.json b/packages/babel-parser/test/fixtures/experimental/do-expressions/with-jsx/output.json index e6808c472edb..e3935122a552 100644 --- a/packages/babel-parser/test/fixtures/experimental/do-expressions/with-jsx/output.json +++ b/packages/babel-parser/test/fixtures/experimental/do-expressions/with-jsx/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 223, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 16, - "column": 1 - } - }, + "start":0,"end":223,"loc":{"start":{"line":1,"column":0},"end":{"line":16,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 223, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 16, - "column": 1 - } - }, + "start":0,"end":223,"loc":{"start":{"line":1,"column":0},"end":{"line":16,"column":1}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 223, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 16, - "column": 1 - } - }, + "start":0,"end":223,"loc":{"start":{"line":1,"column":0},"end":{"line":16,"column":1}}, "id": { "type": "Identifier", - "start": 9, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "foo" - }, + "start":9,"end":12,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":12},"identifierName":"foo"}, "name": "foo" }, "generator": false, @@ -65,126 +20,38 @@ "params": [], "body": { "type": "BlockStatement", - "start": 15, - "end": 223, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 16, - "column": 1 - } - }, + "start":15,"end":223,"loc":{"start":{"line":1,"column":15},"end":{"line":16,"column":1}}, "body": [ { "type": "ReturnStatement", - "start": 19, - "end": 221, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 15, - "column": 4 - } - }, + "start":19,"end":221,"loc":{"start":{"line":2,"column":2},"end":{"line":15,"column":4}}, "argument": { "type": "JSXElement", - "start": 32, - "end": 216, - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 14, - "column": 10 - } - }, + "start":32,"end":216,"loc":{"start":{"line":3,"column":4},"end":{"line":14,"column":10}}, "openingElement": { "type": "JSXOpeningElement", - "start": 32, - "end": 37, - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 9 - } - }, - "attributes": [], + "start":32,"end":37,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":9}}, "name": { "type": "JSXIdentifier", - "start": 33, - "end": 36, - "loc": { - "start": { - "line": 3, - "column": 5 - }, - "end": { - "line": 3, - "column": 8 - } - }, + "start":33,"end":36,"loc":{"start":{"line":3,"column":5},"end":{"line":3,"column":8}}, "name": "nav" }, + "attributes": [], "selfClosing": false }, "closingElement": { "type": "JSXClosingElement", - "start": 210, - "end": 216, - "loc": { - "start": { - "line": 14, - "column": 4 - }, - "end": { - "line": 14, - "column": 10 - } - }, + "start":210,"end":216,"loc":{"start":{"line":14,"column":4},"end":{"line":14,"column":10}}, "name": { "type": "JSXIdentifier", - "start": 212, - "end": 215, - "loc": { - "start": { - "line": 14, - "column": 6 - }, - "end": { - "line": 14, - "column": 9 - } - }, + "start":212,"end":215,"loc":{"start":{"line":14,"column":6},"end":{"line":14,"column":9}}, "name": "nav" } }, "children": [ { "type": "JSXText", - "start": 37, - "end": 44, - "loc": { - "start": { - "line": 3, - "column": 9 - }, - "end": { - "line": 4, - "column": 6 - } - }, + "start":37,"end":44,"loc":{"start":{"line":3,"column":9},"end":{"line":4,"column":6}}, "extra": { "rawValue": "\n ", "raw": "\n " @@ -193,49 +60,16 @@ }, { "type": "JSXElement", - "start": 44, - "end": 52, - "loc": { - "start": { - "line": 4, - "column": 6 - }, - "end": { - "line": 4, - "column": 14 - } - }, + "start":44,"end":52,"loc":{"start":{"line":4,"column":6},"end":{"line":4,"column":14}}, "openingElement": { "type": "JSXOpeningElement", - "start": 44, - "end": 52, - "loc": { - "start": { - "line": 4, - "column": 6 - }, - "end": { - "line": 4, - "column": 14 - } - }, - "attributes": [], + "start":44,"end":52,"loc":{"start":{"line":4,"column":6},"end":{"line":4,"column":14}}, "name": { "type": "JSXIdentifier", - "start": 45, - "end": 49, - "loc": { - "start": { - "line": 4, - "column": 7 - }, - "end": { - "line": 4, - "column": 11 - } - }, + "start":45,"end":49,"loc":{"start":{"line":4,"column":7},"end":{"line":4,"column":11}}, "name": "Home" }, + "attributes": [], "selfClosing": true }, "closingElement": null, @@ -243,18 +77,7 @@ }, { "type": "JSXText", - "start": 52, - "end": 59, - "loc": { - "start": { - "line": 4, - "column": 14 - }, - "end": { - "line": 5, - "column": 6 - } - }, + "start":52,"end":59,"loc":{"start":{"line":4,"column":14},"end":{"line":5,"column":6}}, "extra": { "rawValue": "\n ", "raw": "\n " @@ -263,152 +86,41 @@ }, { "type": "JSXExpressionContainer", - "start": 59, - "end": 205, - "loc": { - "start": { - "line": 5, - "column": 6 - }, - "end": { - "line": 13, - "column": 7 - } - }, + "start":59,"end":205,"loc":{"start":{"line":5,"column":6},"end":{"line":13,"column":7}}, "expression": { "type": "DoExpression", - "start": 69, - "end": 197, - "loc": { - "start": { - "line": 6, - "column": 8 - }, - "end": { - "line": 12, - "column": 9 - } - }, + "start":69,"end":197,"loc":{"start":{"line":6,"column":8},"end":{"line":12,"column":9}}, "body": { "type": "BlockStatement", - "start": 72, - "end": 197, - "loc": { - "start": { - "line": 6, - "column": 11 - }, - "end": { - "line": 12, - "column": 9 - } - }, + "start":72,"end":197,"loc":{"start":{"line":6,"column":11},"end":{"line":12,"column":9}}, "body": [ { "type": "IfStatement", - "start": 84, - "end": 187, - "loc": { - "start": { - "line": 7, - "column": 10 - }, - "end": { - "line": 11, - "column": 11 - } - }, + "start":84,"end":187,"loc":{"start":{"line":7,"column":10},"end":{"line":11,"column":11}}, "test": { "type": "Identifier", - "start": 88, - "end": 96, - "loc": { - "start": { - "line": 7, - "column": 14 - }, - "end": { - "line": 7, - "column": 22 - }, - "identifierName": "loggedIn" - }, + "start":88,"end":96,"loc":{"start":{"line":7,"column":14},"end":{"line":7,"column":22},"identifierName":"loggedIn"}, "name": "loggedIn" }, "consequent": { "type": "BlockStatement", - "start": 98, - "end": 140, - "loc": { - "start": { - "line": 7, - "column": 24 - }, - "end": { - "line": 9, - "column": 11 - } - }, + "start":98,"end":140,"loc":{"start":{"line":7,"column":24},"end":{"line":9,"column":11}}, "body": [ { "type": "ExpressionStatement", - "start": 112, - "end": 128, - "loc": { - "start": { - "line": 8, - "column": 12 - }, - "end": { - "line": 8, - "column": 28 - } - }, + "start":112,"end":128,"loc":{"start":{"line":8,"column":12},"end":{"line":8,"column":28}}, "expression": { "type": "JSXElement", - "start": 112, - "end": 128, - "loc": { - "start": { - "line": 8, - "column": 12 - }, - "end": { - "line": 8, - "column": 28 - } - }, + "start":112,"end":128,"loc":{"start":{"line":8,"column":12},"end":{"line":8,"column":28}}, "openingElement": { "type": "JSXOpeningElement", - "start": 112, - "end": 128, - "loc": { - "start": { - "line": 8, - "column": 12 - }, - "end": { - "line": 8, - "column": 28 - } - }, - "attributes": [], + "start":112,"end":128,"loc":{"start":{"line":8,"column":12},"end":{"line":8,"column":28}}, "name": { "type": "JSXIdentifier", - "start": 113, - "end": 125, - "loc": { - "start": { - "line": 8, - "column": 13 - }, - "end": { - "line": 8, - "column": 25 - } - }, + "start":113,"end":125,"loc":{"start":{"line":8,"column":13},"end":{"line":8,"column":25}}, "name": "LogoutButton" }, + "attributes": [], "selfClosing": true }, "closingElement": null, @@ -420,78 +132,23 @@ }, "alternate": { "type": "BlockStatement", - "start": 146, - "end": 187, - "loc": { - "start": { - "line": 9, - "column": 17 - }, - "end": { - "line": 11, - "column": 11 - } - }, + "start":146,"end":187,"loc":{"start":{"line":9,"column":17},"end":{"line":11,"column":11}}, "body": [ { "type": "ExpressionStatement", - "start": 160, - "end": 175, - "loc": { - "start": { - "line": 10, - "column": 12 - }, - "end": { - "line": 10, - "column": 27 - } - }, + "start":160,"end":175,"loc":{"start":{"line":10,"column":12},"end":{"line":10,"column":27}}, "expression": { "type": "JSXElement", - "start": 160, - "end": 175, - "loc": { - "start": { - "line": 10, - "column": 12 - }, - "end": { - "line": 10, - "column": 27 - } - }, + "start":160,"end":175,"loc":{"start":{"line":10,"column":12},"end":{"line":10,"column":27}}, "openingElement": { "type": "JSXOpeningElement", - "start": 160, - "end": 175, - "loc": { - "start": { - "line": 10, - "column": 12 - }, - "end": { - "line": 10, - "column": 27 - } - }, - "attributes": [], + "start":160,"end":175,"loc":{"start":{"line":10,"column":12},"end":{"line":10,"column":27}}, "name": { "type": "JSXIdentifier", - "start": 161, - "end": 172, - "loc": { - "start": { - "line": 10, - "column": 13 - }, - "end": { - "line": 10, - "column": 24 - } - }, + "start":161,"end":172,"loc":{"start":{"line":10,"column":13},"end":{"line":10,"column":24}}, "name": "LoginButton" }, + "attributes": [], "selfClosing": true }, "closingElement": null, @@ -509,18 +166,7 @@ }, { "type": "JSXText", - "start": 205, - "end": 210, - "loc": { - "start": { - "line": 13, - "column": 7 - }, - "end": { - "line": 14, - "column": 4 - } - }, + "start":205,"end":210,"loc":{"start":{"line":13,"column":7},"end":{"line":14,"column":4}}, "extra": { "rawValue": "\n ", "raw": "\n " diff --git a/packages/babel-parser/test/fixtures/experimental/dynamic-import/direct-calls-only/options.json b/packages/babel-parser/test/fixtures/experimental/dynamic-import/direct-calls-only/options.json deleted file mode 100644 index 599298db4614..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/dynamic-import/direct-calls-only/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Dynamic imports require a parameter: import('a.js') (2:9)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/dynamic-import/generator/output.json b/packages/babel-parser/test/fixtures/experimental/dynamic-import/generator/output.json deleted file mode 100644 index 25391badd214..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/dynamic-import/generator/output.json +++ /dev/null @@ -1,171 +0,0 @@ -{ - "type": "File", - "start": 0, - "end": 41, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, - "program": { - "type": "Program", - "start": 0, - "end": 41, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, - "sourceType": "script", - "interpreter": null, - "body": [ - { - "type": "FunctionDeclaration", - "start": 0, - "end": 41, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, - "id": { - "type": "Identifier", - "start": 10, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "a" - }, - "name": "a" - }, - "generator": true, - "async": false, - "params": [], - "body": { - "type": "BlockStatement", - "start": 14, - "end": 41, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 3, - "column": 1 - } - }, - "body": [ - { - "type": "ExpressionStatement", - "start": 18, - "end": 39, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 23 - } - }, - "expression": { - "type": "YieldExpression", - "start": 18, - "end": 38, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 22 - } - }, - "delegate": false, - "argument": { - "type": "CallExpression", - "start": 24, - "end": 38, - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 22 - } - }, - "callee": { - "type": "Import", - "start": 24, - "end": 30, - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 14 - } - } - }, - "arguments": [ - { - "type": "StringLiteral", - "start": 31, - "end": 37, - "loc": { - "start": { - "line": 2, - "column": 15 - }, - "end": { - "line": 2, - "column": 21 - } - }, - "extra": { - "rawValue": "http", - "raw": "'http'" - }, - "value": "http" - } - ] - } - } - } - ], - "directives": [] - } - } - ], - "directives": [] - } -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/dynamic-import/inside-function/output.json b/packages/babel-parser/test/fixtures/experimental/dynamic-import/inside-function/output.json deleted file mode 100644 index 6cbd42871d26..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/dynamic-import/inside-function/output.json +++ /dev/null @@ -1,229 +0,0 @@ -{ - "type": "File", - "start": 0, - "end": 65, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, - "program": { - "type": "Program", - "start": 0, - "end": 65, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, - "sourceType": "script", - "interpreter": null, - "body": [ - { - "type": "FunctionDeclaration", - "start": 0, - "end": 65, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, - "id": { - "type": "Identifier", - "start": 9, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 19 - }, - "identifierName": "loadImport" - }, - "name": "loadImport" - }, - "generator": false, - "async": false, - "params": [ - { - "type": "Identifier", - "start": 20, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 24 - }, - "identifierName": "file" - }, - "name": "file" - } - ], - "body": { - "type": "BlockStatement", - "start": 26, - "end": 65, - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 3, - "column": 1 - } - }, - "body": [ - { - "type": "ReturnStatement", - "start": 30, - "end": 63, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 35 - } - }, - "argument": { - "type": "CallExpression", - "start": 37, - "end": 62, - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 34 - } - }, - "callee": { - "type": "Import", - "start": 37, - "end": 43, - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 15 - } - } - }, - "arguments": [ - { - "type": "TemplateLiteral", - "start": 44, - "end": 61, - "loc": { - "start": { - "line": 2, - "column": 16 - }, - "end": { - "line": 2, - "column": 33 - } - }, - "expressions": [ - { - "type": "Identifier", - "start": 52, - "end": 56, - "loc": { - "start": { - "line": 2, - "column": 24 - }, - "end": { - "line": 2, - "column": 28 - }, - "identifierName": "file" - }, - "name": "file" - } - ], - "quasis": [ - { - "type": "TemplateElement", - "start": 45, - "end": 50, - "loc": { - "start": { - "line": 2, - "column": 17 - }, - "end": { - "line": 2, - "column": 22 - } - }, - "value": { - "raw": "test/", - "cooked": "test/" - }, - "tail": false - }, - { - "type": "TemplateElement", - "start": 57, - "end": 60, - "loc": { - "start": { - "line": 2, - "column": 29 - }, - "end": { - "line": 2, - "column": 32 - } - }, - "value": { - "raw": ".js", - "cooked": ".js" - }, - "tail": true - } - ] - } - ] - } - } - ], - "directives": [] - } - } - ], - "directives": [] - } -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/dynamic-import/invalid-arguments-spread/options.json b/packages/babel-parser/test/fixtures/experimental/dynamic-import/invalid-arguments-spread/options.json deleted file mode 100644 index c4e1e2ffeb50..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/dynamic-import/invalid-arguments-spread/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "... is not allowed in import() (1:7)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/dynamic-import/invalid-lone-import/input.js b/packages/babel-parser/test/fixtures/experimental/dynamic-import/invalid-lone-import/input.js new file mode 100644 index 000000000000..477eec265426 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/dynamic-import/invalid-lone-import/input.js @@ -0,0 +1 @@ +(import) diff --git a/packages/babel-parser/test/fixtures/experimental/dynamic-import/options.json b/packages/babel-parser/test/fixtures/experimental/dynamic-import/invalid-lone-import/options.json similarity index 100% rename from packages/babel-parser/test/fixtures/experimental/dynamic-import/options.json rename to packages/babel-parser/test/fixtures/experimental/dynamic-import/invalid-lone-import/options.json diff --git a/packages/babel-parser/test/fixtures/experimental/dynamic-import/invalid-lone-import/output.json b/packages/babel-parser/test/fixtures/experimental/dynamic-import/invalid-lone-import/output.json new file mode 100644 index 000000000000..37e56eeb13ba --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/dynamic-import/invalid-lone-import/output.json @@ -0,0 +1,28 @@ +{ + "type": "File", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "errors": [ + "SyntaxError: import can only be used in import() or import.meta (1:1)" + ], + "program": { + "type": "Program", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "expression": { + "type": "Import", + "start":1,"end":7,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":7}}, + "extra": { + "parenthesized": true, + "parenStart": 0 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/dynamic-import/invalid-new/options.json b/packages/babel-parser/test/fixtures/experimental/dynamic-import/invalid-new/options.json deleted file mode 100644 index 26e64ffc5d96..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/dynamic-import/invalid-new/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Cannot use new with import(...) (1:4)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/dynamic-import/invalid-trailing-comma/options.json b/packages/babel-parser/test/fixtures/experimental/dynamic-import/invalid-trailing-comma/options.json deleted file mode 100644 index 770750c7f91f..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/dynamic-import/invalid-trailing-comma/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Trailing comma is disallowed inside import(...) arguments (1:13)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/dynamic-import/multiple-args/options.json b/packages/babel-parser/test/fixtures/experimental/dynamic-import/multiple-args/options.json deleted file mode 100644 index 95a99c52ae49..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/dynamic-import/multiple-args/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "import() requires exactly one argument (1:0)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/dynamic-import/no-args/options.json b/packages/babel-parser/test/fixtures/experimental/dynamic-import/no-args/options.json deleted file mode 100644 index 95a99c52ae49..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/dynamic-import/no-args/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "import() requires exactly one argument (1:0)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/dynamic-import/no-plugin/options.json b/packages/babel-parser/test/fixtures/experimental/dynamic-import/no-plugin/options.json deleted file mode 100644 index 8036724beed2..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/dynamic-import/no-plugin/options.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "throws": "This experimental syntax requires enabling the parser plugin: 'dynamicImport' (1:0)", - "plugins": [] -} diff --git a/packages/babel-parser/test/fixtures/experimental/dynamic-import/parses-module/input.js b/packages/babel-parser/test/fixtures/experimental/dynamic-import/parses-module/input.js deleted file mode 100644 index b49ee994b11f..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/dynamic-import/parses-module/input.js +++ /dev/null @@ -1 +0,0 @@ -import('test.js'); diff --git a/packages/babel-parser/test/fixtures/experimental/dynamic-import/parses-module/output.json b/packages/babel-parser/test/fixtures/experimental/dynamic-import/parses-module/output.json deleted file mode 100644 index 2f8b72b91ff4..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/dynamic-import/parses-module/output.json +++ /dev/null @@ -1,102 +0,0 @@ -{ - "type": "File", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "program": { - "type": "Program", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "sourceType": "module", - "interpreter": null, - "body": [ - { - "type": "ExpressionStatement", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "expression": { - "type": "CallExpression", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, - "callee": { - "type": "Import", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - } - }, - "arguments": [ - { - "type": "StringLiteral", - "start": 7, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "extra": { - "rawValue": "test.js", - "raw": "'test.js'" - }, - "value": "test.js" - } - ] - } - } - ], - "directives": [] - } -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/dynamic-import/parses-strict/output.json b/packages/babel-parser/test/fixtures/experimental/dynamic-import/parses-strict/output.json deleted file mode 100644 index 0d81d0ce2f2b..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/dynamic-import/parses-strict/output.json +++ /dev/null @@ -1,138 +0,0 @@ -{ - "type": "File", - "start": 0, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 18 - } - }, - "program": { - "type": "Program", - "start": 0, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 18 - } - }, - "sourceType": "script", - "interpreter": null, - "body": [ - { - "type": "ExpressionStatement", - "start": 15, - "end": 33, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 18 - } - }, - "expression": { - "type": "CallExpression", - "start": 15, - "end": 32, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 17 - } - }, - "callee": { - "type": "Import", - "start": 15, - "end": 21, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 6 - } - } - }, - "arguments": [ - { - "type": "StringLiteral", - "start": 22, - "end": 31, - "loc": { - "start": { - "line": 3, - "column": 7 - }, - "end": { - "line": 3, - "column": 16 - } - }, - "extra": { - "rawValue": "test.js", - "raw": "'test.js'" - }, - "value": "test.js" - } - ] - } - } - ], - "directives": [ - { - "type": "Directive", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "value": { - "type": "DirectiveLiteral", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "value": "use strict", - "extra": { - "raw": "\"use strict\"", - "rawValue": "use strict" - } - } - } - ] - } -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/dynamic-import/return-value/output.json b/packages/babel-parser/test/fixtures/experimental/dynamic-import/return-value/output.json deleted file mode 100644 index 91a1706118a1..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/dynamic-import/return-value/output.json +++ /dev/null @@ -1,137 +0,0 @@ -{ - "type": "File", - "start": 0, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 39 - } - }, - "program": { - "type": "Program", - "start": 0, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 39 - } - }, - "sourceType": "script", - "interpreter": null, - "body": [ - { - "type": "VariableDeclaration", - "start": 0, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 39 - } - }, - "declarations": [ - { - "type": "VariableDeclarator", - "start": 6, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 38 - } - }, - "id": { - "type": "Identifier", - "start": 6, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 18 - }, - "identifierName": "importResult" - }, - "name": "importResult" - }, - "init": { - "type": "CallExpression", - "start": 21, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 38 - } - }, - "callee": { - "type": "Import", - "start": 21, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 27 - } - } - }, - "arguments": [ - { - "type": "StringLiteral", - "start": 28, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 37 - } - }, - "extra": { - "rawValue": "test.js", - "raw": "'test.js'" - }, - "value": "test.js" - } - ] - } - } - ], - "kind": "const" - } - ], - "directives": [] - } -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/dynamic-import/top-level/output.json b/packages/babel-parser/test/fixtures/experimental/dynamic-import/top-level/output.json deleted file mode 100644 index b28846ccce0f..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/dynamic-import/top-level/output.json +++ /dev/null @@ -1,448 +0,0 @@ -{ - "type": "File", - "start": 0, - "end": 112, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 6, - "column": 36 - } - }, - "program": { - "type": "Program", - "start": 0, - "end": 112, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 6, - "column": 36 - } - }, - "sourceType": "script", - "interpreter": null, - "body": [ - { - "type": "ExpressionStatement", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, - "expression": { - "type": "CallExpression", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, - "callee": { - "type": "Import", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - } - }, - "arguments": [ - { - "type": "StringLiteral", - "start": 7, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 19 - } - }, - "extra": { - "rawValue": "testing.js", - "raw": "'testing.js'" - }, - "value": "testing.js" - } - ] - } - }, - { - "type": "VariableDeclaration", - "start": 23, - "end": 44, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 21 - } - }, - "declarations": [ - { - "type": "VariableDeclarator", - "start": 29, - "end": 43, - "loc": { - "start": { - "line": 3, - "column": 6 - }, - "end": { - "line": 3, - "column": 20 - } - }, - "id": { - "type": "Identifier", - "start": 29, - "end": 33, - "loc": { - "start": { - "line": 3, - "column": 6 - }, - "end": { - "line": 3, - "column": 10 - }, - "identifierName": "test" - }, - "name": "test" - }, - "init": { - "type": "StringLiteral", - "start": 36, - "end": 43, - "loc": { - "start": { - "line": 3, - "column": 13 - }, - "end": { - "line": 3, - "column": 20 - } - }, - "extra": { - "rawValue": "hello", - "raw": "'hello'" - }, - "value": "hello" - } - } - ], - "kind": "const" - }, - { - "type": "ExpressionStatement", - "start": 45, - "end": 74, - "loc": { - "start": { - "line": 4, - "column": 0 - }, - "end": { - "line": 4, - "column": 29 - } - }, - "expression": { - "type": "CallExpression", - "start": 45, - "end": 73, - "loc": { - "start": { - "line": 4, - "column": 0 - }, - "end": { - "line": 4, - "column": 28 - } - }, - "callee": { - "type": "Import", - "start": 45, - "end": 51, - "loc": { - "start": { - "line": 4, - "column": 0 - }, - "end": { - "line": 4, - "column": 6 - } - } - }, - "arguments": [ - { - "type": "TemplateLiteral", - "start": 52, - "end": 72, - "loc": { - "start": { - "line": 4, - "column": 7 - }, - "end": { - "line": 4, - "column": 27 - } - }, - "expressions": [ - { - "type": "Identifier", - "start": 63, - "end": 67, - "loc": { - "start": { - "line": 4, - "column": 18 - }, - "end": { - "line": 4, - "column": 22 - }, - "identifierName": "test" - }, - "name": "test" - } - ], - "quasis": [ - { - "type": "TemplateElement", - "start": 53, - "end": 61, - "loc": { - "start": { - "line": 4, - "column": 8 - }, - "end": { - "line": 4, - "column": 16 - } - }, - "value": { - "raw": "testing/", - "cooked": "testing/" - }, - "tail": false - }, - { - "type": "TemplateElement", - "start": 68, - "end": 71, - "loc": { - "start": { - "line": 4, - "column": 23 - }, - "end": { - "line": 4, - "column": 26 - } - }, - "value": { - "raw": ".js", - "cooked": ".js" - }, - "tail": true - } - ] - } - ] - } - }, - { - "type": "ExpressionStatement", - "start": 76, - "end": 112, - "loc": { - "start": { - "line": 6, - "column": 0 - }, - "end": { - "line": 6, - "column": 36 - } - }, - "expression": { - "type": "CallExpression", - "start": 76, - "end": 111, - "loc": { - "start": { - "line": 6, - "column": 0 - }, - "end": { - "line": 6, - "column": 35 - } - }, - "callee": { - "type": "MemberExpression", - "start": 76, - "end": 101, - "loc": { - "start": { - "line": 6, - "column": 0 - }, - "end": { - "line": 6, - "column": 25 - } - }, - "object": { - "type": "CallExpression", - "start": 76, - "end": 96, - "loc": { - "start": { - "line": 6, - "column": 0 - }, - "end": { - "line": 6, - "column": 20 - } - }, - "callee": { - "type": "Import", - "start": 76, - "end": 82, - "loc": { - "start": { - "line": 6, - "column": 0 - }, - "end": { - "line": 6, - "column": 6 - } - } - }, - "arguments": [ - { - "type": "StringLiteral", - "start": 83, - "end": 95, - "loc": { - "start": { - "line": 6, - "column": 7 - }, - "end": { - "line": 6, - "column": 19 - } - }, - "extra": { - "rawValue": "testing.js", - "raw": "'testing.js'" - }, - "value": "testing.js" - } - ] - }, - "property": { - "type": "Identifier", - "start": 97, - "end": 101, - "loc": { - "start": { - "line": 6, - "column": 21 - }, - "end": { - "line": 6, - "column": 25 - }, - "identifierName": "then" - }, - "name": "then" - }, - "computed": false - }, - "arguments": [ - { - "type": "ArrowFunctionExpression", - "start": 102, - "end": 110, - "loc": { - "start": { - "line": 6, - "column": 26 - }, - "end": { - "line": 6, - "column": 34 - } - }, - "id": null, - "generator": false, - "async": false, - "params": [], - "body": { - "type": "BlockStatement", - "start": 108, - "end": 110, - "loc": { - "start": { - "line": 6, - "column": 32 - }, - "end": { - "line": 6, - "column": 34 - } - }, - "body": [], - "directives": [] - } - } - ] - } - } - ], - "directives": [] - } -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/dynamic-import/variable-arguments/output.json b/packages/babel-parser/test/fixtures/experimental/dynamic-import/variable-arguments/output.json deleted file mode 100644 index db84eef97456..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/dynamic-import/variable-arguments/output.json +++ /dev/null @@ -1,255 +0,0 @@ -{ - "type": "File", - "start": 0, - "end": 66, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 35 - } - }, - "program": { - "type": "Program", - "start": 0, - "end": 66, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 35 - } - }, - "sourceType": "script", - "interpreter": null, - "body": [ - { - "type": "VariableDeclaration", - "start": 0, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 30 - } - }, - "declarations": [ - { - "type": "VariableDeclarator", - "start": 6, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 29 - } - }, - "id": { - "type": "Identifier", - "start": 6, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 17 - }, - "identifierName": "testVarible" - }, - "name": "testVarible" - }, - "init": { - "type": "StringLiteral", - "start": 20, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 29 - } - }, - "extra": { - "rawValue": "test.js", - "raw": "'test.js'" - }, - "value": "test.js" - } - } - ], - "kind": "const" - }, - { - "type": "ExpressionStatement", - "start": 31, - "end": 66, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 35 - } - }, - "expression": { - "type": "CallExpression", - "start": 31, - "end": 65, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 34 - } - }, - "callee": { - "type": "MemberExpression", - "start": 31, - "end": 55, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 24 - } - }, - "object": { - "type": "CallExpression", - "start": 31, - "end": 50, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 19 - } - }, - "callee": { - "type": "Import", - "start": 31, - "end": 37, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 6 - } - } - }, - "arguments": [ - { - "type": "Identifier", - "start": 38, - "end": 49, - "loc": { - "start": { - "line": 2, - "column": 7 - }, - "end": { - "line": 2, - "column": 18 - }, - "identifierName": "testVarible" - }, - "name": "testVarible" - } - ] - }, - "property": { - "type": "Identifier", - "start": 51, - "end": 55, - "loc": { - "start": { - "line": 2, - "column": 20 - }, - "end": { - "line": 2, - "column": 24 - }, - "identifierName": "then" - }, - "name": "then" - }, - "computed": false - }, - "arguments": [ - { - "type": "ArrowFunctionExpression", - "start": 56, - "end": 64, - "loc": { - "start": { - "line": 2, - "column": 25 - }, - "end": { - "line": 2, - "column": 33 - } - }, - "id": null, - "generator": false, - "async": false, - "params": [], - "body": { - "type": "BlockStatement", - "start": 62, - "end": 64, - "loc": { - "start": { - "line": 2, - "column": 31 - }, - "end": { - "line": 2, - "column": 33 - } - }, - "body": [], - "directives": [] - } - } - ] - } - } - ], - "directives": [] - } -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/export-extensions/default-and-named/output.json b/packages/babel-parser/test/fixtures/experimental/export-extensions/default-and-named/output.json index e65a50b154b0..e0734ffc46f3 100644 --- a/packages/babel-parser/test/fixtures/experimental/export-extensions/default-and-named/output.json +++ b/packages/babel-parser/test/fixtures/experimental/export-extensions/default-and-named/output.json @@ -1,145 +1,43 @@ { "type": "File", - "start": 0, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, "program": { "type": "Program", - "start": 0, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExportNamedDeclaration", - "start": 0, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, "specifiers": [ { "type": "ExportDefaultSpecifier", - "start": 7, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":7,"end":10,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":10}}, "exported": { "type": "Identifier", - "start": 7, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 10 - }, - "identifierName": "foo" - }, + "start":7,"end":10,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":10},"identifierName":"foo"}, "name": "foo" } }, { "type": "ExportSpecifier", - "start": 14, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":14,"end":17,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":17}}, "local": { "type": "Identifier", - "start": 14, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 17 - }, - "identifierName": "bar" - }, + "start":14,"end":17,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":17},"identifierName":"bar"}, "name": "bar" }, "exported": { "type": "Identifier", - "start": 14, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 17 - }, - "identifierName": "bar" - }, + "start":14,"end":17,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":17},"identifierName":"bar"}, "name": "bar" } } ], "source": { "type": "StringLiteral", - "start": 25, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":25,"end":30,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":30}}, "extra": { "rawValue": "bar", "raw": "\"bar\"" diff --git a/packages/babel-parser/test/fixtures/experimental/export-extensions/default-and-ns/options.json b/packages/babel-parser/test/fixtures/experimental/export-extensions/default-and-ns/options.json index 3bb54891b474..fb17f33a28b5 100644 --- a/packages/babel-parser/test/fixtures/experimental/export-extensions/default-and-ns/options.json +++ b/packages/babel-parser/test/fixtures/experimental/export-extensions/default-and-ns/options.json @@ -1,4 +1,4 @@ { - "plugins": ["exportDefaultFrom", "exportNamespaceFrom"], + "plugins": ["exportDefaultFrom"], "sourceType": "module" } diff --git a/packages/babel-parser/test/fixtures/experimental/export-extensions/default-and-ns/output.json b/packages/babel-parser/test/fixtures/experimental/export-extensions/default-and-ns/output.json index d044c9635205..5b25b65ff136 100644 --- a/packages/babel-parser/test/fixtures/experimental/export-extensions/default-and-ns/output.json +++ b/packages/babel-parser/test/fixtures/experimental/export-extensions/default-and-ns/output.json @@ -1,128 +1,38 @@ { "type": "File", - "start": 0, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, "program": { "type": "Program", - "start": 0, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExportNamedDeclaration", - "start": 0, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, "specifiers": [ { "type": "ExportDefaultSpecifier", - "start": 7, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8}}, "exported": { "type": "Identifier", - "start": 7, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - }, - "identifierName": "B" - }, + "start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8},"identifierName":"B"}, "name": "B" } }, { "type": "ExportNamespaceSpecifier", - "start": 10, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":10,"end":16,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":16}}, "exported": { "type": "Identifier", - "start": 15, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - }, - "identifierName": "A" - }, + "start":15,"end":16,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":16},"identifierName":"A"}, "name": "A" } } ], "source": { "type": "StringLiteral", - "start": 22, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":22,"end":28,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":28}}, "extra": { "rawValue": "test", "raw": "'test'" diff --git a/packages/babel-parser/test/fixtures/experimental/export-extensions/default-default/output.json b/packages/babel-parser/test/fixtures/experimental/export-extensions/default-default/output.json index 2463d38b5b9c..7887a5bb379a 100644 --- a/packages/babel-parser/test/fixtures/experimental/export-extensions/default-default/output.json +++ b/packages/babel-parser/test/fixtures/experimental/export-extensions/default-default/output.json @@ -1,96 +1,29 @@ { "type": "File", - "start": 0, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, "program": { "type": "Program", - "start": 0, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExportNamedDeclaration", - "start": 0, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, "specifiers": [ { "type": "ExportDefaultSpecifier", - "start": 7, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":7,"end":14,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":14}}, "exported": { "type": "Identifier", - "start": 7, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 14 - }, - "identifierName": "default" - }, + "start":7,"end":14,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":14},"identifierName":"default"}, "name": "default" } } ], "source": { "type": "StringLiteral", - "start": 20, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":20,"end":25,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":25}}, "extra": { "rawValue": "bar", "raw": "\"bar\"" diff --git a/packages/babel-parser/test/fixtures/experimental/export-extensions/default-type-with-typescript/input.js b/packages/babel-parser/test/fixtures/experimental/export-extensions/default-type-with-typescript/input.js new file mode 100644 index 000000000000..2086d067fcdf --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/export-extensions/default-type-with-typescript/input.js @@ -0,0 +1 @@ +export type from 'test'; diff --git a/packages/babel-parser/test/fixtures/experimental/export-extensions/default-type-with-typescript/options.json b/packages/babel-parser/test/fixtures/experimental/export-extensions/default-type-with-typescript/options.json new file mode 100644 index 000000000000..fa7f17816e59 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/export-extensions/default-type-with-typescript/options.json @@ -0,0 +1,5 @@ +{ + "plugins": ["exportDefaultFrom", "typescript"], + "sourceType": "module", + "throws": "Unexpected token, expected \"=\" (1:17)" +} diff --git a/packages/babel-parser/test/fixtures/experimental/export-extensions/default-type-without-flow/output.json b/packages/babel-parser/test/fixtures/experimental/export-extensions/default-type-without-flow/output.json index 2fa10284f62d..8a7c1ce3f3a4 100644 --- a/packages/babel-parser/test/fixtures/experimental/export-extensions/default-type-without-flow/output.json +++ b/packages/babel-parser/test/fixtures/experimental/export-extensions/default-type-without-flow/output.json @@ -1,96 +1,29 @@ { "type": "File", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "program": { "type": "Program", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExportNamedDeclaration", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "specifiers": [ { "type": "ExportDefaultSpecifier", - "start": 7, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":7,"end":11,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":11}}, "exported": { "type": "Identifier", - "start": 7, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "type" - }, + "start":7,"end":11,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":11},"identifierName":"type"}, "name": "type" } } ], "source": { "type": "StringLiteral", - "start": 17, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":17,"end":23,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":23}}, "extra": { "rawValue": "test", "raw": "'test'" diff --git a/packages/babel-parser/test/fixtures/experimental/export-extensions/default/output.json b/packages/babel-parser/test/fixtures/experimental/export-extensions/default/output.json index d31b6fbf36ee..c89f5074f84a 100644 --- a/packages/babel-parser/test/fixtures/experimental/export-extensions/default/output.json +++ b/packages/babel-parser/test/fixtures/experimental/export-extensions/default/output.json @@ -1,96 +1,29 @@ { "type": "File", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, "program": { "type": "Program", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExportNamedDeclaration", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, "specifiers": [ { "type": "ExportDefaultSpecifier", - "start": 7, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8}}, "exported": { "type": "Identifier", - "start": 7, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - }, - "identifierName": "A" - }, + "start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8},"identifierName":"A"}, "name": "A" } } ], "source": { "type": "StringLiteral", - "start": 14, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":14,"end":20,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":20}}, "extra": { "rawValue": "test", "raw": "'test'" diff --git a/packages/babel-parser/test/fixtures/experimental/export-extensions/export-with-ts/output.json b/packages/babel-parser/test/fixtures/experimental/export-extensions/export-with-ts/output.json index 912eb1b41745..e83c25a738e2 100644 --- a/packages/babel-parser/test/fixtures/experimental/export-extensions/export-with-ts/output.json +++ b/packages/babel-parser/test/fixtures/experimental/export-extensions/export-with-ts/output.json @@ -1,162 +1,52 @@ { "type": "File", - "start": 0, - "end": 164, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 7, - "column": 27 - } - }, + "start":0,"end":164,"loc":{"start":{"line":1,"column":0},"end":{"line":7,"column":27}}, "program": { "type": "Program", - "start": 0, - "end": 164, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 7, - "column": 27 - } - }, + "start":0,"end":164,"loc":{"start":{"line":1,"column":0},"end":{"line":7,"column":27}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExportNamedDeclaration", - "start": 0, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, + "exportKind": "value", "specifiers": [], "source": null, "declaration": { "type": "ClassDeclaration", - "start": 7, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":7,"end":26,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":26}}, "abstract": true, "id": { "type": "Identifier", - "start": 22, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 23 - }, - "identifierName": "A" - }, + "start":22,"end":23,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":23},"identifierName":"A"}, "name": "A" }, "superClass": null, "body": { "type": "ClassBody", - "start": 24, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":24,"end":26,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":26}}, "body": [] } } }, { "type": "ExportNamedDeclaration", - "start": 27, - "end": 56, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 29 - } - }, + "start":27,"end":56,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":29}}, + "exportKind": "type", "specifiers": [], "source": null, "declaration": { "type": "TSInterfaceDeclaration", - "start": 34, - "end": 56, - "loc": { - "start": { - "line": 2, - "column": 7 - }, - "end": { - "line": 2, - "column": 29 - } - }, + "start":34,"end":56,"loc":{"start":{"line":2,"column":7},"end":{"line":2,"column":29}}, "id": { "type": "Identifier", - "start": 52, - "end": 53, - "loc": { - "start": { - "line": 2, - "column": 25 - }, - "end": { - "line": 2, - "column": 26 - }, - "identifierName": "B" - }, + "start":52,"end":53,"loc":{"start":{"line":2,"column":25},"end":{"line":2,"column":26},"identifierName":"B"}, "name": "B" }, "body": { "type": "TSInterfaceBody", - "start": 54, - "end": 56, - "loc": { - "start": { - "line": 2, - "column": 27 - }, - "end": { - "line": 2, - "column": 29 - } - }, + "start":54,"end":56,"loc":{"start":{"line":2,"column":27},"end":{"line":2,"column":29}}, "body": [] }, "declare": true @@ -164,49 +54,16 @@ }, { "type": "ExportNamedDeclaration", - "start": 57, - "end": 73, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 16 - } - }, + "start":57,"end":73,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":16}}, + "exportKind": "value", "specifiers": [], "source": null, "declaration": { "type": "TSEnumDeclaration", - "start": 64, - "end": 73, - "loc": { - "start": { - "line": 3, - "column": 7 - }, - "end": { - "line": 3, - "column": 16 - } - }, + "start":64,"end":73,"loc":{"start":{"line":3,"column":7},"end":{"line":3,"column":16}}, "id": { "type": "Identifier", - "start": 69, - "end": 70, - "loc": { - "start": { - "line": 3, - "column": 12 - }, - "end": { - "line": 3, - "column": 13 - }, - "identifierName": "C" - }, + "start":69,"end":70,"loc":{"start":{"line":3,"column":12},"end":{"line":3,"column":13},"identifierName":"C"}, "name": "C" }, "members": [] @@ -214,275 +71,87 @@ }, { "type": "ExportNamedDeclaration", - "start": 74, - "end": 95, - "loc": { - "start": { - "line": 4, - "column": 0 - }, - "end": { - "line": 4, - "column": 21 - } - }, + "start":74,"end":95,"loc":{"start":{"line":4,"column":0},"end":{"line":4,"column":21}}, + "exportKind": "type", "specifiers": [], "source": null, "declaration": { "type": "TSInterfaceDeclaration", - "start": 81, - "end": 95, - "loc": { - "start": { - "line": 4, - "column": 7 - }, - "end": { - "line": 4, - "column": 21 - } - }, + "start":81,"end":95,"loc":{"start":{"line":4,"column":7},"end":{"line":4,"column":21}}, "id": { "type": "Identifier", - "start": 91, - "end": 92, - "loc": { - "start": { - "line": 4, - "column": 17 - }, - "end": { - "line": 4, - "column": 18 - }, - "identifierName": "D" - }, + "start":91,"end":92,"loc":{"start":{"line":4,"column":17},"end":{"line":4,"column":18},"identifierName":"D"}, "name": "D" }, "body": { "type": "TSInterfaceBody", - "start": 93, - "end": 95, - "loc": { - "start": { - "line": 4, - "column": 19 - }, - "end": { - "line": 4, - "column": 21 - } - }, + "start":93,"end":95,"loc":{"start":{"line":4,"column":19},"end":{"line":4,"column":21}}, "body": [] } } }, { "type": "ExportNamedDeclaration", - "start": 96, - "end": 114, - "loc": { - "start": { - "line": 5, - "column": 0 - }, - "end": { - "line": 5, - "column": 18 - } - }, + "start":96,"end":114,"loc":{"start":{"line":5,"column":0},"end":{"line":5,"column":18}}, + "exportKind": "value", "specifiers": [], "source": null, "declaration": { "type": "TSModuleDeclaration", - "start": 103, - "end": 114, - "loc": { - "start": { - "line": 5, - "column": 7 - }, - "end": { - "line": 5, - "column": 18 - } - }, + "start":103,"end":114,"loc":{"start":{"line":5,"column":7},"end":{"line":5,"column":18}}, "id": { "type": "Identifier", - "start": 110, - "end": 111, - "loc": { - "start": { - "line": 5, - "column": 14 - }, - "end": { - "line": 5, - "column": 15 - }, - "identifierName": "E" - }, + "start":110,"end":111,"loc":{"start":{"line":5,"column":14},"end":{"line":5,"column":15},"identifierName":"E"}, "name": "E" }, "body": { "type": "TSModuleBlock", - "start": 112, - "end": 114, - "loc": { - "start": { - "line": 5, - "column": 16 - }, - "end": { - "line": 5, - "column": 18 - } - }, + "start":112,"end":114,"loc":{"start":{"line":5,"column":16},"end":{"line":5,"column":18}}, "body": [] } } }, { "type": "ExportNamedDeclaration", - "start": 115, - "end": 136, - "loc": { - "start": { - "line": 6, - "column": 0 - }, - "end": { - "line": 6, - "column": 21 - } - }, + "start":115,"end":136,"loc":{"start":{"line":6,"column":0},"end":{"line":6,"column":21}}, + "exportKind": "value", "specifiers": [], "source": null, "declaration": { "type": "TSModuleDeclaration", - "start": 122, - "end": 136, - "loc": { - "start": { - "line": 6, - "column": 7 - }, - "end": { - "line": 6, - "column": 21 - } - }, + "start":122,"end":136,"loc":{"start":{"line":6,"column":7},"end":{"line":6,"column":21}}, "id": { "type": "Identifier", - "start": 132, - "end": 133, - "loc": { - "start": { - "line": 6, - "column": 17 - }, - "end": { - "line": 6, - "column": 18 - }, - "identifierName": "F" - }, + "start":132,"end":133,"loc":{"start":{"line":6,"column":17},"end":{"line":6,"column":18},"identifierName":"F"}, "name": "F" }, "body": { "type": "TSModuleBlock", - "start": 134, - "end": 136, - "loc": { - "start": { - "line": 6, - "column": 19 - }, - "end": { - "line": 6, - "column": 21 - } - }, + "start":134,"end":136,"loc":{"start":{"line":6,"column":19},"end":{"line":6,"column":21}}, "body": [] } } }, { "type": "ExportNamedDeclaration", - "start": 137, - "end": 164, - "loc": { - "start": { - "line": 7, - "column": 0 - }, - "end": { - "line": 7, - "column": 27 - } - }, + "start":137,"end":164,"loc":{"start":{"line":7,"column":0},"end":{"line":7,"column":27}}, + "exportKind": "type", "specifiers": [], "source": null, "declaration": { "type": "TSTypeAliasDeclaration", - "start": 144, - "end": 164, - "loc": { - "start": { - "line": 7, - "column": 7 - }, - "end": { - "line": 7, - "column": 27 - } - }, + "start":144,"end":164,"loc":{"start":{"line":7,"column":7},"end":{"line":7,"column":27}}, "id": { "type": "Identifier", - "start": 149, - "end": 150, - "loc": { - "start": { - "line": 7, - "column": 12 - }, - "end": { - "line": 7, - "column": 13 - }, - "identifierName": "G" - }, + "start":149,"end":150,"loc":{"start":{"line":7,"column":12},"end":{"line":7,"column":13},"identifierName":"G"}, "name": "G" }, "typeAnnotation": { "type": "TSTypeQuery", - "start": 153, - "end": 163, - "loc": { - "start": { - "line": 7, - "column": 16 - }, - "end": { - "line": 7, - "column": 26 - } - }, + "start":153,"end":163,"loc":{"start":{"line":7,"column":16},"end":{"line":7,"column":26}}, "exprName": { "type": "Identifier", - "start": 160, - "end": 163, - "loc": { - "start": { - "line": 7, - "column": 23 - }, - "end": { - "line": 7, - "column": 26 - }, - "identifierName": "foo" - }, + "start":160,"end":163,"loc":{"start":{"line":7,"column":23},"end":{"line":7,"column":26},"identifierName":"foo"}, "name": "foo" } } diff --git a/packages/babel-parser/test/fixtures/experimental/export-extensions/ns-and-named/options.json b/packages/babel-parser/test/fixtures/experimental/export-extensions/ns-and-named/options.json deleted file mode 100644 index efa6c457adc3..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/export-extensions/ns-and-named/options.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "sourceType": "module", - "plugins": ["exportNamespaceFrom"] -} diff --git a/packages/babel-parser/test/fixtures/experimental/export-extensions/ns-and-named/output.json b/packages/babel-parser/test/fixtures/experimental/export-extensions/ns-and-named/output.json deleted file mode 100644 index 0c6d34007629..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/export-extensions/ns-and-named/output.json +++ /dev/null @@ -1,154 +0,0 @@ -{ - "type": "File", - "start": 0, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 36 - } - }, - "program": { - "type": "Program", - "start": 0, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 36 - } - }, - "sourceType": "module", - "interpreter": null, - "body": [ - { - "type": "ExportNamedDeclaration", - "start": 0, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 36 - } - }, - "specifiers": [ - { - "type": "ExportNamespaceSpecifier", - "start": 7, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "exported": { - "type": "Identifier", - "start": 12, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 15 - }, - "identifierName": "foo" - }, - "name": "foo" - } - }, - { - "type": "ExportSpecifier", - "start": 19, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 22 - } - }, - "local": { - "type": "Identifier", - "start": 19, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 22 - }, - "identifierName": "bar" - }, - "name": "bar" - }, - "exported": { - "type": "Identifier", - "start": 19, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 22 - }, - "identifierName": "bar" - }, - "name": "bar" - } - } - ], - "source": { - "type": "StringLiteral", - "start": 30, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 1, - "column": 35 - } - }, - "extra": { - "rawValue": "bar", - "raw": "\"bar\"" - }, - "value": "bar" - }, - "declaration": null - } - ], - "directives": [] - } -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/export-extensions/ns-default/options.json b/packages/babel-parser/test/fixtures/experimental/export-extensions/ns-default/options.json deleted file mode 100644 index e32f18023916..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/export-extensions/ns-default/options.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "plugins": ["exportNamespaceFrom"], - "sourceType": "module" -} diff --git a/packages/babel-parser/test/fixtures/experimental/export-extensions/ns-default/output.json b/packages/babel-parser/test/fixtures/experimental/export-extensions/ns-default/output.json deleted file mode 100644 index 3e9ebe6414f7..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/export-extensions/ns-default/output.json +++ /dev/null @@ -1,104 +0,0 @@ -{ - "type": "File", - "start": 0, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } - }, - "program": { - "type": "Program", - "start": 0, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } - }, - "sourceType": "module", - "interpreter": null, - "body": [ - { - "type": "ExportNamedDeclaration", - "start": 0, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } - }, - "specifiers": [ - { - "type": "ExportNamespaceSpecifier", - "start": 7, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 19 - } - }, - "exported": { - "type": "Identifier", - "start": 12, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 19 - }, - "identifierName": "default" - }, - "name": "default" - } - } - ], - "source": { - "type": "StringLiteral", - "start": 25, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 30 - } - }, - "extra": { - "rawValue": "foo", - "raw": "\"foo\"" - }, - "value": "foo" - } - } - ], - "directives": [] - } -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/export-extensions/ns/options.json b/packages/babel-parser/test/fixtures/experimental/export-extensions/ns/options.json deleted file mode 100644 index e32f18023916..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/export-extensions/ns/options.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "plugins": ["exportNamespaceFrom"], - "sourceType": "module" -} diff --git a/packages/babel-parser/test/fixtures/experimental/export-extensions/ns/output.json b/packages/babel-parser/test/fixtures/experimental/export-extensions/ns/output.json deleted file mode 100644 index 72403aff63d3..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/export-extensions/ns/output.json +++ /dev/null @@ -1,104 +0,0 @@ -{ - "type": "File", - "start": 0, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 26 - } - }, - "program": { - "type": "Program", - "start": 0, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 26 - } - }, - "sourceType": "module", - "interpreter": null, - "body": [ - { - "type": "ExportNamedDeclaration", - "start": 0, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 26 - } - }, - "specifiers": [ - { - "type": "ExportNamespaceSpecifier", - "start": 7, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "exported": { - "type": "Identifier", - "start": 12, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - }, - "identifierName": "A" - }, - "name": "A" - } - } - ], - "source": { - "type": "StringLiteral", - "start": 19, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 25 - } - }, - "extra": { - "rawValue": "test", - "raw": "'test'" - }, - "value": "test" - } - } - ], - "directives": [] - } -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/function-sent/enabled-asi-funciton-declaration/output.json b/packages/babel-parser/test/fixtures/experimental/function-sent/enabled-asi-funciton-declaration/output.json index 8f1dc7f1fd64..deae7f725130 100644 --- a/packages/babel-parser/test/fixtures/experimental/function-sent/enabled-asi-funciton-declaration/output.json +++ b/packages/babel-parser/test/fixtures/experimental/function-sent/enabled-asi-funciton-declaration/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 42, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":0,"end":42,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 42, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":0,"end":42,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 42, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":0,"end":42,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, "id": { "type": "Identifier", - "start": 10, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 13 - }, - "identifierName": "foo" - }, + "start":10,"end":13,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":13},"identifierName":"foo"}, "name": "foo" }, "generator": true, @@ -65,93 +20,25 @@ "params": [], "body": { "type": "BlockStatement", - "start": 16, - "end": 42, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":16,"end":42,"loc":{"start":{"line":1,"column":16},"end":{"line":4,"column":1}}, "body": [ { "type": "ExpressionStatement", - "start": 20, - "end": 35, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 17 - } - }, + "start":20,"end":35,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":17}}, "expression": { "type": "CallExpression", - "start": 20, - "end": 35, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 17 - } - }, + "start":20,"end":35,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":17}}, "callee": { "type": "MetaProperty", - "start": 20, - "end": 33, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 15 - } - }, + "start":20,"end":33,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":15}}, "meta": { "type": "Identifier", - "start": 20, - "end": 28, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 10 - }, - "identifierName": "function" - }, + "start":20,"end":28,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":10},"identifierName":"function"}, "name": "function" }, "property": { "type": "Identifier", - "start": 29, - "end": 33, - "loc": { - "start": { - "line": 2, - "column": 11 - }, - "end": { - "line": 2, - "column": 15 - }, - "identifierName": "sent" - }, + "start":29,"end":33,"loc":{"start":{"line":2,"column":11},"end":{"line":2,"column":15},"identifierName":"sent"}, "name": "sent" } }, @@ -160,18 +47,7 @@ }, { "type": "BlockStatement", - "start": 38, - "end": 40, - "loc": { - "start": { - "line": 3, - "column": 2 - }, - "end": { - "line": 3, - "column": 4 - } - }, + "start":38,"end":40,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":4}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/experimental/function-sent/enabled-call-statement/output.json b/packages/babel-parser/test/fixtures/experimental/function-sent/enabled-call-statement/output.json index 0f78ff94e38e..9aa076e2d6b8 100644 --- a/packages/babel-parser/test/fixtures/experimental/function-sent/enabled-call-statement/output.json +++ b/packages/babel-parser/test/fixtures/experimental/function-sent/enabled-call-statement/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "id": { "type": "Identifier", - "start": 10, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 13 - }, - "identifierName": "foo" - }, + "start":10,"end":13,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":13},"identifierName":"foo"}, "name": "foo" }, "generator": true, @@ -65,93 +20,25 @@ "params": [], "body": { "type": "BlockStatement", - "start": 16, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":16,"end":38,"loc":{"start":{"line":1,"column":16},"end":{"line":3,"column":1}}, "body": [ { "type": "ExpressionStatement", - "start": 20, - "end": 36, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 18 - } - }, + "start":20,"end":36,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":18}}, "expression": { "type": "CallExpression", - "start": 20, - "end": 35, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 17 - } - }, + "start":20,"end":35,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":17}}, "callee": { "type": "MetaProperty", - "start": 20, - "end": 33, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 15 - } - }, + "start":20,"end":33,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":15}}, "meta": { "type": "Identifier", - "start": 20, - "end": 28, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 10 - }, - "identifierName": "function" - }, + "start":20,"end":28,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":10},"identifierName":"function"}, "name": "function" }, "property": { "type": "Identifier", - "start": 29, - "end": 33, - "loc": { - "start": { - "line": 2, - "column": 11 - }, - "end": { - "line": 2, - "column": 15 - }, - "identifierName": "sent" - }, + "start":29,"end":33,"loc":{"start":{"line":2,"column":11},"end":{"line":2,"column":15},"identifierName":"sent"}, "name": "sent" } }, diff --git a/packages/babel-parser/test/fixtures/experimental/function-sent/enabled-call/output.json b/packages/babel-parser/test/fixtures/experimental/function-sent/enabled-call/output.json index 6ee6b54a10f1..b3275b4cd48e 100644 --- a/packages/babel-parser/test/fixtures/experimental/function-sent/enabled-call/output.json +++ b/packages/babel-parser/test/fixtures/experimental/function-sent/enabled-call/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":40,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":40,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":40,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "id": { "type": "Identifier", - "start": 10, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 13 - }, - "identifierName": "foo" - }, + "start":10,"end":13,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":13},"identifierName":"foo"}, "name": "foo" }, "generator": true, @@ -65,93 +20,25 @@ "params": [], "body": { "type": "BlockStatement", - "start": 16, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":16,"end":40,"loc":{"start":{"line":1,"column":16},"end":{"line":3,"column":1}}, "body": [ { "type": "ExpressionStatement", - "start": 20, - "end": 38, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 20 - } - }, + "start":20,"end":38,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":20}}, "expression": { "type": "CallExpression", - "start": 21, - "end": 36, - "loc": { - "start": { - "line": 2, - "column": 3 - }, - "end": { - "line": 2, - "column": 18 - } - }, + "start":21,"end":36,"loc":{"start":{"line":2,"column":3},"end":{"line":2,"column":18}}, "callee": { "type": "MetaProperty", - "start": 21, - "end": 34, - "loc": { - "start": { - "line": 2, - "column": 3 - }, - "end": { - "line": 2, - "column": 16 - } - }, + "start":21,"end":34,"loc":{"start":{"line":2,"column":3},"end":{"line":2,"column":16}}, "meta": { "type": "Identifier", - "start": 21, - "end": 29, - "loc": { - "start": { - "line": 2, - "column": 3 - }, - "end": { - "line": 2, - "column": 11 - }, - "identifierName": "function" - }, + "start":21,"end":29,"loc":{"start":{"line":2,"column":3},"end":{"line":2,"column":11},"identifierName":"function"}, "name": "function" }, "property": { "type": "Identifier", - "start": 30, - "end": 34, - "loc": { - "start": { - "line": 2, - "column": 12 - }, - "end": { - "line": 2, - "column": 16 - }, - "identifierName": "sent" - }, + "start":30,"end":34,"loc":{"start":{"line":2,"column":12},"end":{"line":2,"column":16},"identifierName":"sent"}, "name": "sent" } }, diff --git a/packages/babel-parser/test/fixtures/experimental/function-sent/enabled-if-statement/output.json b/packages/babel-parser/test/fixtures/experimental/function-sent/enabled-if-statement/output.json index 12271ff15479..3485397b4d62 100644 --- a/packages/babel-parser/test/fixtures/experimental/function-sent/enabled-if-statement/output.json +++ b/packages/babel-parser/test/fixtures/experimental/function-sent/enabled-if-statement/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 46, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":46,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 46, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":46,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 46, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":46,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "id": { "type": "Identifier", - "start": 10, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 13 - }, - "identifierName": "foo" - }, + "start":10,"end":13,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":13},"identifierName":"foo"}, "name": "foo" }, "generator": true, @@ -65,109 +20,30 @@ "params": [], "body": { "type": "BlockStatement", - "start": 16, - "end": 46, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":16,"end":46,"loc":{"start":{"line":1,"column":16},"end":{"line":3,"column":1}}, "body": [ { "type": "IfStatement", - "start": 20, - "end": 44, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 26 - } - }, + "start":20,"end":44,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":26}}, "test": { "type": "BooleanLiteral", - "start": 24, - "end": 28, - "loc": { - "start": { - "line": 2, - "column": 6 - }, - "end": { - "line": 2, - "column": 10 - } - }, + "start":24,"end":28,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":10}}, "value": true }, "consequent": { "type": "ExpressionStatement", - "start": 30, - "end": 44, - "loc": { - "start": { - "line": 2, - "column": 12 - }, - "end": { - "line": 2, - "column": 26 - } - }, + "start":30,"end":44,"loc":{"start":{"line":2,"column":12},"end":{"line":2,"column":26}}, "expression": { "type": "MetaProperty", - "start": 30, - "end": 43, - "loc": { - "start": { - "line": 2, - "column": 12 - }, - "end": { - "line": 2, - "column": 25 - } - }, + "start":30,"end":43,"loc":{"start":{"line":2,"column":12},"end":{"line":2,"column":25}}, "meta": { "type": "Identifier", - "start": 30, - "end": 38, - "loc": { - "start": { - "line": 2, - "column": 12 - }, - "end": { - "line": 2, - "column": 20 - }, - "identifierName": "function" - }, + "start":30,"end":38,"loc":{"start":{"line":2,"column":12},"end":{"line":2,"column":20},"identifierName":"function"}, "name": "function" }, "property": { "type": "Identifier", - "start": 39, - "end": 43, - "loc": { - "start": { - "line": 2, - "column": 21 - }, - "end": { - "line": 2, - "column": 25 - }, - "identifierName": "sent" - }, + "start":39,"end":43,"loc":{"start":{"line":2,"column":21},"end":{"line":2,"column":25},"identifierName":"sent"}, "name": "sent" } } diff --git a/packages/babel-parser/test/fixtures/experimental/function-sent/enabled-inside-generator/output.json b/packages/babel-parser/test/fixtures/experimental/function-sent/enabled-inside-generator/output.json index d8961a920cbd..a0fdd5c38174 100644 --- a/packages/babel-parser/test/fixtures/experimental/function-sent/enabled-inside-generator/output.json +++ b/packages/babel-parser/test/fixtures/experimental/function-sent/enabled-inside-generator/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 43, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":43,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 43, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":43,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 43, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":43,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "id": { "type": "Identifier", - "start": 10, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 13 - }, - "identifierName": "foo" - }, + "start":10,"end":13,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":13},"identifierName":"foo"}, "name": "foo" }, "generator": true, @@ -65,79 +20,22 @@ "params": [], "body": { "type": "BlockStatement", - "start": 16, - "end": 43, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":16,"end":43,"loc":{"start":{"line":1,"column":16},"end":{"line":3,"column":1}}, "body": [ { "type": "ReturnStatement", - "start": 20, - "end": 41, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 23 - } - }, + "start":20,"end":41,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":23}}, "argument": { "type": "MetaProperty", - "start": 27, - "end": 40, - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 22 - } - }, + "start":27,"end":40,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":22}}, "meta": { "type": "Identifier", - "start": 27, - "end": 35, - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 17 - }, - "identifierName": "function" - }, + "start":27,"end":35,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":17},"identifierName":"function"}, "name": "function" }, "property": { "type": "Identifier", - "start": 36, - "end": 40, - "loc": { - "start": { - "line": 2, - "column": 18 - }, - "end": { - "line": 2, - "column": 22 - }, - "identifierName": "sent" - }, + "start":36,"end":40,"loc":{"start":{"line":2,"column":18},"end":{"line":2,"column":22},"identifierName":"sent"}, "name": "sent" } } diff --git a/packages/babel-parser/test/fixtures/experimental/function-sent/enabled-statement/output.json b/packages/babel-parser/test/fixtures/experimental/function-sent/enabled-statement/output.json index 5bf2f923b846..64b15fcf30f1 100644 --- a/packages/babel-parser/test/fixtures/experimental/function-sent/enabled-statement/output.json +++ b/packages/babel-parser/test/fixtures/experimental/function-sent/enabled-statement/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "id": { "type": "Identifier", - "start": 10, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 13 - }, - "identifierName": "foo" - }, + "start":10,"end":13,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":13},"identifierName":"foo"}, "name": "foo" }, "generator": true, @@ -65,79 +20,22 @@ "params": [], "body": { "type": "BlockStatement", - "start": 16, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":16,"end":36,"loc":{"start":{"line":1,"column":16},"end":{"line":3,"column":1}}, "body": [ { "type": "ExpressionStatement", - "start": 20, - "end": 34, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 16 - } - }, + "start":20,"end":34,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":16}}, "expression": { "type": "MetaProperty", - "start": 20, - "end": 33, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 15 - } - }, + "start":20,"end":33,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":15}}, "meta": { "type": "Identifier", - "start": 20, - "end": 28, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 10 - }, - "identifierName": "function" - }, + "start":20,"end":28,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":10},"identifierName":"function"}, "name": "function" }, "property": { "type": "Identifier", - "start": 29, - "end": 33, - "loc": { - "start": { - "line": 2, - "column": 11 - }, - "end": { - "line": 2, - "column": 15 - }, - "identifierName": "sent" - }, + "start":29,"end":33,"loc":{"start":{"line":2,"column":11},"end":{"line":2,"column":15},"identifierName":"sent"}, "name": "sent" } } diff --git a/packages/babel-parser/test/fixtures/experimental/import-meta/error-in-script/options.json b/packages/babel-parser/test/fixtures/experimental/import-meta/error-in-script/options.json index eb1e545759e8..7442e09e1f56 100644 --- a/packages/babel-parser/test/fixtures/experimental/import-meta/error-in-script/options.json +++ b/packages/babel-parser/test/fixtures/experimental/import-meta/error-in-script/options.json @@ -1,5 +1,4 @@ { - "throws": "import.meta may appear only with 'sourceType: \"module\"' (1:10)", - "plugins": ["dynamicImport", "importMeta"], + "plugins": ["importMeta"], "sourceType": "script" } diff --git a/packages/babel-parser/test/fixtures/experimental/import-meta/error-in-script/output.json b/packages/babel-parser/test/fixtures/experimental/import-meta/error-in-script/output.json new file mode 100644 index 000000000000..003b67cda8cb --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/import-meta/error-in-script/output.json @@ -0,0 +1,46 @@ +{ + "type": "File", + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, + "errors": [ + "SyntaxError: import.meta may appear only with 'sourceType: \"module\"' (1:10)" + ], + "program": { + "type": "Program", + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":6,"end":21,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":21}}, + "id": { + "type": "Identifier", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"x"}, + "name": "x" + }, + "init": { + "type": "MetaProperty", + "start":10,"end":21,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":21}}, + "meta": { + "type": "Identifier", + "start":10,"end":16,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":16},"identifierName":"import"}, + "name": "import" + }, + "property": { + "type": "Identifier", + "start":17,"end":21,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":21},"identifierName":"meta"}, + "name": "meta" + } + } + } + ], + "kind": "const" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/import-meta/no-other-prop-names/options.json b/packages/babel-parser/test/fixtures/experimental/import-meta/no-other-prop-names/options.json index 97ba83ec465d..a6638b6528c1 100644 --- a/packages/babel-parser/test/fixtures/experimental/import-meta/no-other-prop-names/options.json +++ b/packages/babel-parser/test/fixtures/experimental/import-meta/no-other-prop-names/options.json @@ -1,5 +1,4 @@ { - "throws": "The only valid meta property for import is import.meta (1:7)", "sourceType": "module", - "plugins": ["dynamicImport", "importMeta"] + "plugins": ["importMeta"] } diff --git a/packages/babel-parser/test/fixtures/experimental/import-meta/no-other-prop-names/output.json b/packages/babel-parser/test/fixtures/experimental/import-meta/no-other-prop-names/output.json new file mode 100644 index 000000000000..c03b9e7046c7 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/import-meta/no-other-prop-names/output.json @@ -0,0 +1,34 @@ +{ + "type": "File", + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, + "errors": [ + "SyntaxError: The only valid meta property for import is import.meta (1:7)" + ], + "program": { + "type": "Program", + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, + "expression": { + "type": "MetaProperty", + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, + "meta": { + "type": "Identifier", + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6},"identifierName":"import"}, + "name": "import" + }, + "property": { + "type": "Identifier", + "start":7,"end":14,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":14},"identifierName":"notMeta"}, + "name": "notMeta" + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/import-meta/not-assignable/options.json b/packages/babel-parser/test/fixtures/experimental/import-meta/not-assignable/options.json index 647ad9f65dee..a6638b6528c1 100644 --- a/packages/babel-parser/test/fixtures/experimental/import-meta/not-assignable/options.json +++ b/packages/babel-parser/test/fixtures/experimental/import-meta/not-assignable/options.json @@ -1,5 +1,4 @@ { - "throws": "Invalid left-hand side in assignment expression (1:0)", "sourceType": "module", - "plugins": ["dynamicImport", "importMeta"] + "plugins": ["importMeta"] } diff --git a/packages/babel-parser/test/fixtures/experimental/import-meta/not-assignable/output.json b/packages/babel-parser/test/fixtures/experimental/import-meta/not-assignable/output.json new file mode 100644 index 000000000000..5e1510e58fe0 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/import-meta/not-assignable/output.json @@ -0,0 +1,44 @@ +{ + "type": "File", + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, + "errors": [ + "SyntaxError: Invalid left-hand side in assignment expression (1:0)" + ], + "program": { + "type": "Program", + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, + "expression": { + "type": "AssignmentExpression", + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, + "operator": "=", + "left": { + "type": "MetaProperty", + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "meta": { + "type": "Identifier", + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6},"identifierName":"import"}, + "name": "import" + }, + "property": { + "type": "Identifier", + "start":7,"end":11,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":11},"identifierName":"meta"}, + "name": "meta" + } + }, + "right": { + "type": "BooleanLiteral", + "start":14,"end":18,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":18}}, + "value": true + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/import-meta/valid-in-module/options.json b/packages/babel-parser/test/fixtures/experimental/import-meta/valid-in-module/options.json index be1070ffed9d..a6638b6528c1 100644 --- a/packages/babel-parser/test/fixtures/experimental/import-meta/valid-in-module/options.json +++ b/packages/babel-parser/test/fixtures/experimental/import-meta/valid-in-module/options.json @@ -1,4 +1,4 @@ { "sourceType": "module", - "plugins": ["dynamicImport", "importMeta"] + "plugins": ["importMeta"] } diff --git a/packages/babel-parser/test/fixtures/experimental/import-meta/valid-in-module/output.json b/packages/babel-parser/test/fixtures/experimental/import-meta/valid-in-module/output.json index 762e468f42f9..f7c0f728ad82 100644 --- a/packages/babel-parser/test/fixtures/experimental/import-meta/valid-in-module/output.json +++ b/packages/babel-parser/test/fixtures/experimental/import-meta/valid-in-module/output.json @@ -1,126 +1,35 @@ { "type": "File", - "start": 0, - "end": 116, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 34 - } - }, + "start":0,"end":116,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":34}}, "program": { "type": "Program", - "start": 0, - "end": 116, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 34 - } - }, + "start":0,"end":116,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":34}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "declarations": [ { "type": "VariableDeclarator", - "start": 6, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":6,"end":21,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":21}}, "id": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "x" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"x"}, "name": "x" }, "init": { "type": "MetaProperty", - "start": 10, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":10,"end":21,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":21}}, "meta": { "type": "Identifier", - "start": 10, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 16 - }, - "identifierName": "import" - }, + "start":10,"end":16,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":16},"identifierName":"import"}, "name": "import" }, "property": { "type": "Identifier", - "start": 17, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 21 - }, - "identifierName": "meta" - }, + "start":17,"end":21,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":21},"identifierName":"meta"}, "name": "meta" } } @@ -130,128 +39,36 @@ }, { "type": "VariableDeclaration", - "start": 23, - "end": 51, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 28 - } - }, + "start":23,"end":51,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":28}}, "declarations": [ { "type": "VariableDeclarator", - "start": 29, - "end": 50, - "loc": { - "start": { - "line": 2, - "column": 6 - }, - "end": { - "line": 2, - "column": 27 - } - }, + "start":29,"end":50,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":27}}, "id": { "type": "Identifier", - "start": 29, - "end": 32, - "loc": { - "start": { - "line": 2, - "column": 6 - }, - "end": { - "line": 2, - "column": 9 - }, - "identifierName": "url" - }, + "start":29,"end":32,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":9},"identifierName":"url"}, "name": "url" }, "init": { "type": "MemberExpression", - "start": 35, - "end": 50, - "loc": { - "start": { - "line": 2, - "column": 12 - }, - "end": { - "line": 2, - "column": 27 - } - }, + "start":35,"end":50,"loc":{"start":{"line":2,"column":12},"end":{"line":2,"column":27}}, "object": { "type": "MetaProperty", - "start": 35, - "end": 46, - "loc": { - "start": { - "line": 2, - "column": 12 - }, - "end": { - "line": 2, - "column": 23 - } - }, + "start":35,"end":46,"loc":{"start":{"line":2,"column":12},"end":{"line":2,"column":23}}, "meta": { "type": "Identifier", - "start": 35, - "end": 41, - "loc": { - "start": { - "line": 2, - "column": 12 - }, - "end": { - "line": 2, - "column": 18 - }, - "identifierName": "import" - }, + "start":35,"end":41,"loc":{"start":{"line":2,"column":12},"end":{"line":2,"column":18},"identifierName":"import"}, "name": "import" }, "property": { "type": "Identifier", - "start": 42, - "end": 46, - "loc": { - "start": { - "line": 2, - "column": 19 - }, - "end": { - "line": 2, - "column": 23 - }, - "identifierName": "meta" - }, + "start":42,"end":46,"loc":{"start":{"line":2,"column":19},"end":{"line":2,"column":23},"identifierName":"meta"}, "name": "meta" } }, "property": { "type": "Identifier", - "start": 47, - "end": 50, - "loc": { - "start": { - "line": 2, - "column": 24 - }, - "end": { - "line": 2, - "column": 27 - }, - "identifierName": "url" - }, + "start":47,"end":50,"loc":{"start":{"line":2,"column":24},"end":{"line":2,"column":27},"identifierName":"url"}, "name": "url" }, "computed": false @@ -262,160 +79,45 @@ }, { "type": "ExpressionStatement", - "start": 52, - "end": 64, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 12 - } - }, + "start":52,"end":64,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":12}}, "expression": { "type": "MetaProperty", - "start": 52, - "end": 63, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 11 - } - }, + "start":52,"end":63,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":11}}, "meta": { "type": "Identifier", - "start": 52, - "end": 58, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 6 - }, - "identifierName": "import" - }, + "start":52,"end":58,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":6},"identifierName":"import"}, "name": "import" }, "property": { "type": "Identifier", - "start": 59, - "end": 63, - "loc": { - "start": { - "line": 3, - "column": 7 - }, - "end": { - "line": 3, - "column": 11 - }, - "identifierName": "meta" - }, + "start":59,"end":63,"loc":{"start":{"line":3,"column":7},"end":{"line":3,"column":11},"identifierName":"meta"}, "name": "meta" } } }, { "type": "ExpressionStatement", - "start": 65, - "end": 81, - "loc": { - "start": { - "line": 4, - "column": 0 - }, - "end": { - "line": 4, - "column": 16 - } - }, + "start":65,"end":81,"loc":{"start":{"line":4,"column":0},"end":{"line":4,"column":16}}, "expression": { "type": "MemberExpression", - "start": 65, - "end": 80, - "loc": { - "start": { - "line": 4, - "column": 0 - }, - "end": { - "line": 4, - "column": 15 - } - }, + "start":65,"end":80,"loc":{"start":{"line":4,"column":0},"end":{"line":4,"column":15}}, "object": { "type": "MetaProperty", - "start": 65, - "end": 76, - "loc": { - "start": { - "line": 4, - "column": 0 - }, - "end": { - "line": 4, - "column": 11 - } - }, + "start":65,"end":76,"loc":{"start":{"line":4,"column":0},"end":{"line":4,"column":11}}, "meta": { "type": "Identifier", - "start": 65, - "end": 71, - "loc": { - "start": { - "line": 4, - "column": 0 - }, - "end": { - "line": 4, - "column": 6 - }, - "identifierName": "import" - }, + "start":65,"end":71,"loc":{"start":{"line":4,"column":0},"end":{"line":4,"column":6},"identifierName":"import"}, "name": "import" }, "property": { "type": "Identifier", - "start": 72, - "end": 76, - "loc": { - "start": { - "line": 4, - "column": 7 - }, - "end": { - "line": 4, - "column": 11 - }, - "identifierName": "meta" - }, + "start":72,"end":76,"loc":{"start":{"line":4,"column":7},"end":{"line":4,"column":11},"identifierName":"meta"}, "name": "meta" } }, "property": { "type": "Identifier", - "start": 77, - "end": 80, - "loc": { - "start": { - "line": 4, - "column": 12 - }, - "end": { - "line": 4, - "column": 15 - }, - "identifierName": "url" - }, + "start":77,"end":80,"loc":{"start":{"line":4,"column":12},"end":{"line":4,"column":15},"identifierName":"url"}, "name": "url" }, "computed": false @@ -423,129 +125,38 @@ }, { "type": "ExpressionStatement", - "start": 82, - "end": 116, - "loc": { - "start": { - "line": 5, - "column": 0 - }, - "end": { - "line": 5, - "column": 34 - } - }, + "start":82,"end":116,"loc":{"start":{"line":5,"column":0},"end":{"line":5,"column":34}}, "expression": { "type": "AssignmentExpression", - "start": 82, - "end": 115, - "loc": { - "start": { - "line": 5, - "column": 0 - }, - "end": { - "line": 5, - "column": 33 - } - }, + "start":82,"end":115,"loc":{"start":{"line":5,"column":0},"end":{"line":5,"column":33}}, "operator": "=", "left": { "type": "MemberExpression", - "start": 82, - "end": 108, - "loc": { - "start": { - "line": 5, - "column": 0 - }, - "end": { - "line": 5, - "column": 26 - } - }, + "start":82,"end":108,"loc":{"start":{"line":5,"column":0},"end":{"line":5,"column":26}}, "object": { "type": "MetaProperty", - "start": 82, - "end": 93, - "loc": { - "start": { - "line": 5, - "column": 0 - }, - "end": { - "line": 5, - "column": 11 - } - }, + "start":82,"end":93,"loc":{"start":{"line":5,"column":0},"end":{"line":5,"column":11}}, "meta": { "type": "Identifier", - "start": 82, - "end": 88, - "loc": { - "start": { - "line": 5, - "column": 0 - }, - "end": { - "line": 5, - "column": 6 - }, - "identifierName": "import" - }, + "start":82,"end":88,"loc":{"start":{"line":5,"column":0},"end":{"line":5,"column":6},"identifierName":"import"}, "name": "import" }, "property": { "type": "Identifier", - "start": 89, - "end": 93, - "loc": { - "start": { - "line": 5, - "column": 7 - }, - "end": { - "line": 5, - "column": 11 - }, - "identifierName": "meta" - }, + "start":89,"end":93,"loc":{"start":{"line":5,"column":7},"end":{"line":5,"column":11},"identifierName":"meta"}, "name": "meta" } }, "property": { "type": "Identifier", - "start": 94, - "end": 108, - "loc": { - "start": { - "line": 5, - "column": 12 - }, - "end": { - "line": 5, - "column": 26 - }, - "identifierName": "couldBeMutable" - }, + "start":94,"end":108,"loc":{"start":{"line":5,"column":12},"end":{"line":5,"column":26},"identifierName":"couldBeMutable"}, "name": "couldBeMutable" }, "computed": false }, "right": { "type": "BooleanLiteral", - "start": 111, - "end": 115, - "loc": { - "start": { - "line": 5, - "column": 29 - }, - "end": { - "line": 5, - "column": 33 - } - }, + "start":111,"end":115,"loc":{"start":{"line":5,"column":29},"end":{"line":5,"column":33}}, "value": true } } diff --git a/packages/babel-parser/test/fixtures/experimental/import-meta/without-dynamic-import/output.json b/packages/babel-parser/test/fixtures/experimental/import-meta/without-dynamic-import/output.json index 762e468f42f9..f7c0f728ad82 100644 --- a/packages/babel-parser/test/fixtures/experimental/import-meta/without-dynamic-import/output.json +++ b/packages/babel-parser/test/fixtures/experimental/import-meta/without-dynamic-import/output.json @@ -1,126 +1,35 @@ { "type": "File", - "start": 0, - "end": 116, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 34 - } - }, + "start":0,"end":116,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":34}}, "program": { "type": "Program", - "start": 0, - "end": 116, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 34 - } - }, + "start":0,"end":116,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":34}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "declarations": [ { "type": "VariableDeclarator", - "start": 6, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":6,"end":21,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":21}}, "id": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "x" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"x"}, "name": "x" }, "init": { "type": "MetaProperty", - "start": 10, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":10,"end":21,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":21}}, "meta": { "type": "Identifier", - "start": 10, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 16 - }, - "identifierName": "import" - }, + "start":10,"end":16,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":16},"identifierName":"import"}, "name": "import" }, "property": { "type": "Identifier", - "start": 17, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 21 - }, - "identifierName": "meta" - }, + "start":17,"end":21,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":21},"identifierName":"meta"}, "name": "meta" } } @@ -130,128 +39,36 @@ }, { "type": "VariableDeclaration", - "start": 23, - "end": 51, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 28 - } - }, + "start":23,"end":51,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":28}}, "declarations": [ { "type": "VariableDeclarator", - "start": 29, - "end": 50, - "loc": { - "start": { - "line": 2, - "column": 6 - }, - "end": { - "line": 2, - "column": 27 - } - }, + "start":29,"end":50,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":27}}, "id": { "type": "Identifier", - "start": 29, - "end": 32, - "loc": { - "start": { - "line": 2, - "column": 6 - }, - "end": { - "line": 2, - "column": 9 - }, - "identifierName": "url" - }, + "start":29,"end":32,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":9},"identifierName":"url"}, "name": "url" }, "init": { "type": "MemberExpression", - "start": 35, - "end": 50, - "loc": { - "start": { - "line": 2, - "column": 12 - }, - "end": { - "line": 2, - "column": 27 - } - }, + "start":35,"end":50,"loc":{"start":{"line":2,"column":12},"end":{"line":2,"column":27}}, "object": { "type": "MetaProperty", - "start": 35, - "end": 46, - "loc": { - "start": { - "line": 2, - "column": 12 - }, - "end": { - "line": 2, - "column": 23 - } - }, + "start":35,"end":46,"loc":{"start":{"line":2,"column":12},"end":{"line":2,"column":23}}, "meta": { "type": "Identifier", - "start": 35, - "end": 41, - "loc": { - "start": { - "line": 2, - "column": 12 - }, - "end": { - "line": 2, - "column": 18 - }, - "identifierName": "import" - }, + "start":35,"end":41,"loc":{"start":{"line":2,"column":12},"end":{"line":2,"column":18},"identifierName":"import"}, "name": "import" }, "property": { "type": "Identifier", - "start": 42, - "end": 46, - "loc": { - "start": { - "line": 2, - "column": 19 - }, - "end": { - "line": 2, - "column": 23 - }, - "identifierName": "meta" - }, + "start":42,"end":46,"loc":{"start":{"line":2,"column":19},"end":{"line":2,"column":23},"identifierName":"meta"}, "name": "meta" } }, "property": { "type": "Identifier", - "start": 47, - "end": 50, - "loc": { - "start": { - "line": 2, - "column": 24 - }, - "end": { - "line": 2, - "column": 27 - }, - "identifierName": "url" - }, + "start":47,"end":50,"loc":{"start":{"line":2,"column":24},"end":{"line":2,"column":27},"identifierName":"url"}, "name": "url" }, "computed": false @@ -262,160 +79,45 @@ }, { "type": "ExpressionStatement", - "start": 52, - "end": 64, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 12 - } - }, + "start":52,"end":64,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":12}}, "expression": { "type": "MetaProperty", - "start": 52, - "end": 63, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 11 - } - }, + "start":52,"end":63,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":11}}, "meta": { "type": "Identifier", - "start": 52, - "end": 58, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 6 - }, - "identifierName": "import" - }, + "start":52,"end":58,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":6},"identifierName":"import"}, "name": "import" }, "property": { "type": "Identifier", - "start": 59, - "end": 63, - "loc": { - "start": { - "line": 3, - "column": 7 - }, - "end": { - "line": 3, - "column": 11 - }, - "identifierName": "meta" - }, + "start":59,"end":63,"loc":{"start":{"line":3,"column":7},"end":{"line":3,"column":11},"identifierName":"meta"}, "name": "meta" } } }, { "type": "ExpressionStatement", - "start": 65, - "end": 81, - "loc": { - "start": { - "line": 4, - "column": 0 - }, - "end": { - "line": 4, - "column": 16 - } - }, + "start":65,"end":81,"loc":{"start":{"line":4,"column":0},"end":{"line":4,"column":16}}, "expression": { "type": "MemberExpression", - "start": 65, - "end": 80, - "loc": { - "start": { - "line": 4, - "column": 0 - }, - "end": { - "line": 4, - "column": 15 - } - }, + "start":65,"end":80,"loc":{"start":{"line":4,"column":0},"end":{"line":4,"column":15}}, "object": { "type": "MetaProperty", - "start": 65, - "end": 76, - "loc": { - "start": { - "line": 4, - "column": 0 - }, - "end": { - "line": 4, - "column": 11 - } - }, + "start":65,"end":76,"loc":{"start":{"line":4,"column":0},"end":{"line":4,"column":11}}, "meta": { "type": "Identifier", - "start": 65, - "end": 71, - "loc": { - "start": { - "line": 4, - "column": 0 - }, - "end": { - "line": 4, - "column": 6 - }, - "identifierName": "import" - }, + "start":65,"end":71,"loc":{"start":{"line":4,"column":0},"end":{"line":4,"column":6},"identifierName":"import"}, "name": "import" }, "property": { "type": "Identifier", - "start": 72, - "end": 76, - "loc": { - "start": { - "line": 4, - "column": 7 - }, - "end": { - "line": 4, - "column": 11 - }, - "identifierName": "meta" - }, + "start":72,"end":76,"loc":{"start":{"line":4,"column":7},"end":{"line":4,"column":11},"identifierName":"meta"}, "name": "meta" } }, "property": { "type": "Identifier", - "start": 77, - "end": 80, - "loc": { - "start": { - "line": 4, - "column": 12 - }, - "end": { - "line": 4, - "column": 15 - }, - "identifierName": "url" - }, + "start":77,"end":80,"loc":{"start":{"line":4,"column":12},"end":{"line":4,"column":15},"identifierName":"url"}, "name": "url" }, "computed": false @@ -423,129 +125,38 @@ }, { "type": "ExpressionStatement", - "start": 82, - "end": 116, - "loc": { - "start": { - "line": 5, - "column": 0 - }, - "end": { - "line": 5, - "column": 34 - } - }, + "start":82,"end":116,"loc":{"start":{"line":5,"column":0},"end":{"line":5,"column":34}}, "expression": { "type": "AssignmentExpression", - "start": 82, - "end": 115, - "loc": { - "start": { - "line": 5, - "column": 0 - }, - "end": { - "line": 5, - "column": 33 - } - }, + "start":82,"end":115,"loc":{"start":{"line":5,"column":0},"end":{"line":5,"column":33}}, "operator": "=", "left": { "type": "MemberExpression", - "start": 82, - "end": 108, - "loc": { - "start": { - "line": 5, - "column": 0 - }, - "end": { - "line": 5, - "column": 26 - } - }, + "start":82,"end":108,"loc":{"start":{"line":5,"column":0},"end":{"line":5,"column":26}}, "object": { "type": "MetaProperty", - "start": 82, - "end": 93, - "loc": { - "start": { - "line": 5, - "column": 0 - }, - "end": { - "line": 5, - "column": 11 - } - }, + "start":82,"end":93,"loc":{"start":{"line":5,"column":0},"end":{"line":5,"column":11}}, "meta": { "type": "Identifier", - "start": 82, - "end": 88, - "loc": { - "start": { - "line": 5, - "column": 0 - }, - "end": { - "line": 5, - "column": 6 - }, - "identifierName": "import" - }, + "start":82,"end":88,"loc":{"start":{"line":5,"column":0},"end":{"line":5,"column":6},"identifierName":"import"}, "name": "import" }, "property": { "type": "Identifier", - "start": 89, - "end": 93, - "loc": { - "start": { - "line": 5, - "column": 7 - }, - "end": { - "line": 5, - "column": 11 - }, - "identifierName": "meta" - }, + "start":89,"end":93,"loc":{"start":{"line":5,"column":7},"end":{"line":5,"column":11},"identifierName":"meta"}, "name": "meta" } }, "property": { "type": "Identifier", - "start": 94, - "end": 108, - "loc": { - "start": { - "line": 5, - "column": 12 - }, - "end": { - "line": 5, - "column": 26 - }, - "identifierName": "couldBeMutable" - }, + "start":94,"end":108,"loc":{"start":{"line":5,"column":12},"end":{"line":5,"column":26},"identifierName":"couldBeMutable"}, "name": "couldBeMutable" }, "computed": false }, "right": { "type": "BooleanLiteral", - "start": 111, - "end": 115, - "loc": { - "start": { - "line": 5, - "column": 29 - }, - "end": { - "line": 5, - "column": 33 - } - }, + "start":111,"end":115,"loc":{"start":{"line":5,"column":29},"end":{"line":5,"column":33}}, "value": true } } diff --git a/packages/babel-parser/test/fixtures/experimental/logical-assignment-operator/and-and-equals/output.json b/packages/babel-parser/test/fixtures/experimental/logical-assignment-operator/and-and-equals/output.json index ca7f05193422..f76347f82a4e 100644 --- a/packages/babel-parser/test/fixtures/experimental/logical-assignment-operator/and-and-equals/output.json +++ b/packages/babel-parser/test/fixtures/experimental/logical-assignment-operator/and-and-equals/output.json @@ -1,193 +1,56 @@ { "type": "File", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 12 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":12}}, "program": { "type": "Program", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 12 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":12}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, "expression": { "type": "AssignmentExpression", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "operator": "&&=", "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "a" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"a"}, "name": "a" }, "right": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "b" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"b"}, "name": "b" } } }, { "type": "ExpressionStatement", - "start": 9, - "end": 21, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 12 - } - }, + "start":9,"end":21,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":12}}, "expression": { "type": "AssignmentExpression", - "start": 9, - "end": 20, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 11 - } - }, + "start":9,"end":20,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":11}}, "operator": "&&=", "left": { "type": "MemberExpression", - "start": 9, - "end": 14, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 5 - } - }, + "start":9,"end":14,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":5}}, "object": { "type": "Identifier", - "start": 9, - "end": 12, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 3 - }, - "identifierName": "obj" - }, + "start":9,"end":12,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":3},"identifierName":"obj"}, "name": "obj" }, "property": { "type": "Identifier", - "start": 13, - "end": 14, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 5 - }, - "identifierName": "a" - }, + "start":13,"end":14,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":5},"identifierName":"a"}, "name": "a" }, "computed": false }, "right": { "type": "Identifier", - "start": 19, - "end": 20, - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 11 - }, - "identifierName": "b" - }, + "start":19,"end":20,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":11},"identifierName":"b"}, "name": "b" } } diff --git a/packages/babel-parser/test/fixtures/experimental/logical-assignment-operator/mallet/output.json b/packages/babel-parser/test/fixtures/experimental/logical-assignment-operator/mallet/output.json index 955795e96bc2..82f46579d4c6 100644 --- a/packages/babel-parser/test/fixtures/experimental/logical-assignment-operator/mallet/output.json +++ b/packages/babel-parser/test/fixtures/experimental/logical-assignment-operator/mallet/output.json @@ -1,193 +1,56 @@ { "type": "File", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 12 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":12}}, "program": { "type": "Program", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 12 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":12}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, "expression": { "type": "AssignmentExpression", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "operator": "||=", "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "a" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"a"}, "name": "a" }, "right": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "b" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"b"}, "name": "b" } } }, { "type": "ExpressionStatement", - "start": 9, - "end": 21, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 12 - } - }, + "start":9,"end":21,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":12}}, "expression": { "type": "AssignmentExpression", - "start": 9, - "end": 20, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 11 - } - }, + "start":9,"end":20,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":11}}, "operator": "||=", "left": { "type": "MemberExpression", - "start": 9, - "end": 14, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 5 - } - }, + "start":9,"end":14,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":5}}, "object": { "type": "Identifier", - "start": 9, - "end": 12, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 3 - }, - "identifierName": "obj" - }, + "start":9,"end":12,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":3},"identifierName":"obj"}, "name": "obj" }, "property": { "type": "Identifier", - "start": 13, - "end": 14, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 5 - }, - "identifierName": "a" - }, + "start":13,"end":14,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":5},"identifierName":"a"}, "name": "a" }, "computed": false }, "right": { "type": "Identifier", - "start": 19, - "end": 20, - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 11 - }, - "identifierName": "b" - }, + "start":19,"end":20,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":11},"identifierName":"b"}, "name": "b" } } diff --git a/packages/babel-parser/test/fixtures/experimental/logical-assignment-operator/qq-equals-no-null-coalesce-plugin/input.js b/packages/babel-parser/test/fixtures/experimental/logical-assignment-operator/qq-equals-no-null-coalesce-plugin/input.js deleted file mode 100644 index dcf876b17411..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/logical-assignment-operator/qq-equals-no-null-coalesce-plugin/input.js +++ /dev/null @@ -1,2 +0,0 @@ -a ??= b; -obj.a ??= b; diff --git a/packages/babel-parser/test/fixtures/experimental/logical-assignment-operator/qq-equals-no-null-coalesce-plugin/options.json b/packages/babel-parser/test/fixtures/experimental/logical-assignment-operator/qq-equals-no-null-coalesce-plugin/options.json deleted file mode 100644 index 3cb238ee4af0..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/logical-assignment-operator/qq-equals-no-null-coalesce-plugin/options.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "plugins": ["logicalAssignment"], - "throws": "This experimental syntax requires enabling the parser plugin: 'nullishCoalescingOperator' (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/logical-assignment-operator/qq-equals-no-plugin/options.json b/packages/babel-parser/test/fixtures/experimental/logical-assignment-operator/qq-equals-no-plugin/options.json index f5e977775daf..64389a45889e 100644 --- a/packages/babel-parser/test/fixtures/experimental/logical-assignment-operator/qq-equals-no-plugin/options.json +++ b/packages/babel-parser/test/fixtures/experimental/logical-assignment-operator/qq-equals-no-plugin/options.json @@ -1,4 +1,3 @@ { - "plugins": ["nullishCoalescingOperator"], "throws": "This experimental syntax requires enabling the parser plugin: 'logicalAssignment' (1:2)" } diff --git a/packages/babel-parser/test/fixtures/experimental/logical-assignment-operator/qq-equals/options.json b/packages/babel-parser/test/fixtures/experimental/logical-assignment-operator/qq-equals/options.json index 6b07062568e2..5041dbb19f81 100644 --- a/packages/babel-parser/test/fixtures/experimental/logical-assignment-operator/qq-equals/options.json +++ b/packages/babel-parser/test/fixtures/experimental/logical-assignment-operator/qq-equals/options.json @@ -1,3 +1,3 @@ { - "plugins": ["logicalAssignment", "nullishCoalescingOperator"] + "plugins": ["logicalAssignment"] } diff --git a/packages/babel-parser/test/fixtures/experimental/logical-assignment-operator/qq-equals/output.json b/packages/babel-parser/test/fixtures/experimental/logical-assignment-operator/qq-equals/output.json index ffa28bc26ba2..6e6d1bea815d 100644 --- a/packages/babel-parser/test/fixtures/experimental/logical-assignment-operator/qq-equals/output.json +++ b/packages/babel-parser/test/fixtures/experimental/logical-assignment-operator/qq-equals/output.json @@ -1,193 +1,56 @@ { "type": "File", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 12 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":12}}, "program": { "type": "Program", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 12 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":12}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, "expression": { "type": "AssignmentExpression", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "operator": "??=", "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "a" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"a"}, "name": "a" }, "right": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "b" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"b"}, "name": "b" } } }, { "type": "ExpressionStatement", - "start": 9, - "end": 21, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 12 - } - }, + "start":9,"end":21,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":12}}, "expression": { "type": "AssignmentExpression", - "start": 9, - "end": 20, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 11 - } - }, + "start":9,"end":20,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":11}}, "operator": "??=", "left": { "type": "MemberExpression", - "start": 9, - "end": 14, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 5 - } - }, + "start":9,"end":14,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":5}}, "object": { "type": "Identifier", - "start": 9, - "end": 12, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 3 - }, - "identifierName": "obj" - }, + "start":9,"end":12,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":3},"identifierName":"obj"}, "name": "obj" }, "property": { "type": "Identifier", - "start": 13, - "end": 14, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 5 - }, - "identifierName": "a" - }, + "start":13,"end":14,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":5},"identifierName":"a"}, "name": "a" }, "computed": false }, "right": { "type": "Identifier", - "start": 19, - "end": 20, - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 11 - }, - "identifierName": "b" - }, + "start":19,"end":20,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":11},"identifierName":"b"}, "name": "b" } } diff --git a/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/and-nullish/input.js b/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/and-nullish/input.js deleted file mode 100644 index 2b0c8c8ff80a..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/and-nullish/input.js +++ /dev/null @@ -1 +0,0 @@ -a && b ?? c; diff --git a/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/and-nullish/options.json b/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/and-nullish/options.json deleted file mode 100644 index 1bb4736991a4..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/and-nullish/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "plugins": ["nullishCoalescingOperator"] -} diff --git a/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/and-nullish/output.json b/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/and-nullish/output.json deleted file mode 100644 index 779d2ccfbcc8..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/and-nullish/output.json +++ /dev/null @@ -1,133 +0,0 @@ -{ - "type": "File", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "program": { - "type": "Program", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "sourceType": "script", - "interpreter": null, - "body": [ - { - "type": "ExpressionStatement", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "expression": { - "type": "LogicalExpression", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "left": { - "type": "LogicalExpression", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "left": { - "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "a" - }, - "name": "a" - }, - "operator": "&&", - "right": { - "type": "Identifier", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "b" - }, - "name": "b" - } - }, - "operator": "??", - "right": { - "type": "Identifier", - "start": 10, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "c" - }, - "name": "c" - } - } - } - ], - "directives": [] - } -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/associativity/options.json b/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/associativity/options.json deleted file mode 100644 index 1bb4736991a4..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/associativity/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "plugins": ["nullishCoalescingOperator"] -} diff --git a/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/associativity/output.json b/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/associativity/output.json deleted file mode 100644 index 6400590cf5e5..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/associativity/output.json +++ /dev/null @@ -1,133 +0,0 @@ -{ - "type": "File", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "program": { - "type": "Program", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "sourceType": "script", - "interpreter": null, - "body": [ - { - "type": "ExpressionStatement", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "expression": { - "type": "LogicalExpression", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "left": { - "type": "LogicalExpression", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "left": { - "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "a" - }, - "name": "a" - }, - "operator": "??", - "right": { - "type": "Identifier", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "b" - }, - "name": "b" - } - }, - "operator": "??", - "right": { - "type": "Identifier", - "start": 10, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "c" - }, - "name": "c" - } - } - } - ], - "directives": [] - } -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/expression/options.json b/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/expression/options.json deleted file mode 100644 index 1bb4736991a4..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/expression/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "plugins": ["nullishCoalescingOperator"] -} diff --git a/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/expression/output.json b/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/expression/output.json deleted file mode 100644 index a73a582cf290..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/expression/output.json +++ /dev/null @@ -1,103 +0,0 @@ -{ - "type": "File", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "program": { - "type": "Program", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "sourceType": "script", - "interpreter": null, - "body": [ - { - "type": "ExpressionStatement", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "expression": { - "type": "LogicalExpression", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "left": { - "type": "Identifier", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - }, - "identifierName": "foo" - }, - "name": "foo" - }, - "operator": "??", - "right": { - "type": "NumericLiteral", - "start": 7, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "extra": { - "rawValue": 1, - "raw": "1" - }, - "value": 1 - } - } - } - ], - "directives": [] - } -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/multiline/options.json b/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/multiline/options.json deleted file mode 100644 index 1bb4736991a4..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/multiline/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "plugins": ["nullishCoalescingOperator"] -} diff --git a/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/multiline/output.json b/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/multiline/output.json deleted file mode 100644 index c387800ff559..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/multiline/output.json +++ /dev/null @@ -1,133 +0,0 @@ -{ - "type": "File", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 7 - } - }, - "program": { - "type": "Program", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 7 - } - }, - "sourceType": "script", - "interpreter": null, - "body": [ - { - "type": "ExpressionStatement", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 7 - } - }, - "expression": { - "type": "LogicalExpression", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 6 - } - }, - "left": { - "type": "LogicalExpression", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 6 - } - }, - "left": { - "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "a" - }, - "name": "a" - }, - "operator": "??", - "right": { - "type": "Identifier", - "start": 8, - "end": 9, - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 6 - }, - "identifierName": "b" - }, - "name": "b" - } - }, - "operator": "??", - "right": { - "type": "Identifier", - "start": 15, - "end": 16, - "loc": { - "start": { - "line": 3, - "column": 5 - }, - "end": { - "line": 3, - "column": 6 - }, - "identifierName": "c" - }, - "name": "c" - } - } - } - ], - "directives": [] - } -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/no-plugin-error/input.js b/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/no-plugin-error/input.js deleted file mode 100644 index ea99cb192c79..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/no-plugin-error/input.js +++ /dev/null @@ -1 +0,0 @@ -foo ?? 1; diff --git a/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/no-plugin-error/options.json b/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/no-plugin-error/options.json deleted file mode 100644 index 9ae9a3d8a5d1..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/no-plugin-error/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "This experimental syntax requires enabling the parser plugin: 'nullishCoalescingOperator' (1:4)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/nullish-and/options.json b/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/nullish-and/options.json deleted file mode 100644 index 1bb4736991a4..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/nullish-and/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "plugins": ["nullishCoalescingOperator"] -} diff --git a/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/nullish-and/output.json b/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/nullish-and/output.json deleted file mode 100644 index 2e4c3bf5553f..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/nullish-and/output.json +++ /dev/null @@ -1,133 +0,0 @@ -{ - "type": "File", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "program": { - "type": "Program", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "sourceType": "script", - "interpreter": null, - "body": [ - { - "type": "ExpressionStatement", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "expression": { - "type": "LogicalExpression", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "left": { - "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "a" - }, - "name": "a" - }, - "operator": "??", - "right": { - "type": "LogicalExpression", - "start": 5, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "left": { - "type": "Identifier", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "b" - }, - "name": "b" - }, - "operator": "&&", - "right": { - "type": "Identifier", - "start": 10, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "c" - }, - "name": "c" - } - } - } - } - ], - "directives": [] - } -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/nullish-or/input.js b/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/nullish-or/input.js deleted file mode 100644 index 40ec9c39d17f..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/nullish-or/input.js +++ /dev/null @@ -1 +0,0 @@ -a ?? b || c; diff --git a/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/nullish-or/options.json b/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/nullish-or/options.json deleted file mode 100644 index 1bb4736991a4..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/nullish-or/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "plugins": ["nullishCoalescingOperator"] -} diff --git a/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/nullish-or/output.json b/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/nullish-or/output.json deleted file mode 100644 index 5ab0fcc1a530..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/nullish-or/output.json +++ /dev/null @@ -1,133 +0,0 @@ -{ - "type": "File", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "program": { - "type": "Program", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "sourceType": "script", - "interpreter": null, - "body": [ - { - "type": "ExpressionStatement", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "expression": { - "type": "LogicalExpression", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "left": { - "type": "LogicalExpression", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "left": { - "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "a" - }, - "name": "a" - }, - "operator": "??", - "right": { - "type": "Identifier", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "b" - }, - "name": "b" - } - }, - "operator": "||", - "right": { - "type": "Identifier", - "start": 10, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "c" - }, - "name": "c" - } - } - } - ], - "directives": [] - } -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/or-nullish/input.js b/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/or-nullish/input.js deleted file mode 100644 index b74eae4c99e2..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/or-nullish/input.js +++ /dev/null @@ -1 +0,0 @@ -a || b ?? c; diff --git a/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/or-nullish/options.json b/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/or-nullish/options.json deleted file mode 100644 index 1bb4736991a4..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/or-nullish/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "plugins": ["nullishCoalescingOperator"] -} diff --git a/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/or-nullish/output.json b/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/or-nullish/output.json deleted file mode 100644 index 0db4055d3a89..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/or-nullish/output.json +++ /dev/null @@ -1,133 +0,0 @@ -{ - "type": "File", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "program": { - "type": "Program", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "sourceType": "script", - "interpreter": null, - "body": [ - { - "type": "ExpressionStatement", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "expression": { - "type": "LogicalExpression", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "left": { - "type": "LogicalExpression", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "left": { - "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "a" - }, - "name": "a" - }, - "operator": "||", - "right": { - "type": "Identifier", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "b" - }, - "name": "b" - } - }, - "operator": "??", - "right": { - "type": "Identifier", - "start": 10, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "c" - }, - "name": "c" - } - } - } - ], - "directives": [] - } -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/with-pipeline/options.json b/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/with-pipeline/options.json deleted file mode 100644 index 790c3f234b5c..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/with-pipeline/options.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "plugins": [ - "nullishCoalescingOperator", - ["pipelineOperator", { "proposal": "minimal" }] - ] -} diff --git a/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/with-pipeline/output.json b/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/with-pipeline/output.json deleted file mode 100644 index e17ba18882fb..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/with-pipeline/output.json +++ /dev/null @@ -1,133 +0,0 @@ -{ - "type": "File", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "program": { - "type": "Program", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "sourceType": "script", - "interpreter": null, - "body": [ - { - "type": "ExpressionStatement", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "expression": { - "type": "BinaryExpression", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "left": { - "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "a" - }, - "name": "a" - }, - "operator": "|>", - "right": { - "type": "LogicalExpression", - "start": 5, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "left": { - "type": "Identifier", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "b" - }, - "name": "b" - }, - "operator": "??", - "right": { - "type": "Identifier", - "start": 10, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "c" - }, - "name": "c" - } - } - } - } - ], - "directives": [] - } -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/identifier-start-0/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/identifier-start-0/output.json index 8bb7a04b57e5..4e10fae280db 100644 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/identifier-start-0/output.json +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/identifier-start-0/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - }, + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, "program": { "type": "Program", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - }, + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - }, + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, "expression": { "type": "Identifier", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - }, - "identifierName": "_123" - }, + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4},"identifierName":"_123"}, "name": "_123" } } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-0/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-0/options.json deleted file mode 100644 index 27e4acfa8f65..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-0/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:1)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-0/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-0/output.json new file mode 100644 index 000000000000..f71e62cf63d4 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-0/output.json @@ -0,0 +1,29 @@ +{ + "type": "File", + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}}, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:1)" + ], + "program": { + "type": "Program", + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}}, + "expression": { + "type": "NumericLiteral", + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}}, + "extra": { + "rawValue": 1, + "raw": "1_" + }, + "value": 1 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-1/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-1/options.json deleted file mode 100644 index 477511a87822..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-1/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:3)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-1/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-1/output.json new file mode 100644 index 000000000000..a685b94be015 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-1/output.json @@ -0,0 +1,29 @@ +{ + "type": "File", + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:3)" + ], + "program": { + "type": "Program", + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, + "expression": { + "type": "NumericLiteral", + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, + "extra": { + "rawValue": 11, + "raw": "1_1_" + }, + "value": 11 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-10/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-10/options.json deleted file mode 100644 index a65e1ff322a7..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-10/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:5)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-10/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-10/output.json new file mode 100644 index 000000000000..c32319f375dd --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-10/output.json @@ -0,0 +1,29 @@ +{ + "type": "File", + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:5)" + ], + "program": { + "type": "Program", + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, + "expression": { + "type": "NumericLiteral", + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, + "extra": { + "rawValue": 17, + "raw": "0x1_1_" + }, + "value": 17 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-100/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-100/options.json deleted file mode 100644 index 8cb6bf4866a3..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-100/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:2)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-100/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-100/output.json new file mode 100644 index 000000000000..7ee60b71ca15 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-100/output.json @@ -0,0 +1,31 @@ +{ + "type": "File", + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:2)" + ], + "program": { + "type": "Program", + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, + "expression": { + "type": "NumericLiteral", + "start":1,"end":3,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":3}}, + "extra": { + "rawValue": 1, + "raw": "1_", + "parenthesized": true, + "parenStart": 0 + }, + "value": 1 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-101/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-101/options.json deleted file mode 100644 index 91c5decd9c42..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-101/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:4)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-101/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-101/output.json new file mode 100644 index 000000000000..242847410a0f --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-101/output.json @@ -0,0 +1,31 @@ +{ + "type": "File", + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:4)" + ], + "program": { + "type": "Program", + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, + "expression": { + "type": "NumericLiteral", + "start":1,"end":5,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":5}}, + "extra": { + "rawValue": 11, + "raw": "1_1_", + "parenthesized": true, + "parenStart": 0 + }, + "value": 11 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-102/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-102/options.json deleted file mode 100644 index 91c5decd9c42..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-102/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:4)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-102/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-102/output.json new file mode 100644 index 000000000000..aedcced6b5b5 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-102/output.json @@ -0,0 +1,32 @@ +{ + "type": "File", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:4)", + "SyntaxError: A numeric separator is only allowed between two digits (1:5)" + ], + "program": { + "type": "Program", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "expression": { + "type": "NumericLiteral", + "start":1,"end":6,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":6}}, + "extra": { + "rawValue": 11, + "raw": "1_1__", + "parenthesized": true, + "parenStart": 0 + }, + "value": 11 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-103/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-103/options.json deleted file mode 100644 index 8cb6bf4866a3..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-103/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:2)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-103/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-103/output.json new file mode 100644 index 000000000000..6fc9be0b380a --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-103/output.json @@ -0,0 +1,32 @@ +{ + "type": "File", + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:2)", + "SyntaxError: A numeric separator is only allowed between two digits (1:3)" + ], + "program": { + "type": "Program", + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, + "expression": { + "type": "NumericLiteral", + "start":1,"end":5,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":5}}, + "extra": { + "rawValue": 11, + "raw": "1__1", + "parenthesized": true, + "parenStart": 0 + }, + "value": 11 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-104/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-104/options.json deleted file mode 100644 index 91c5decd9c42..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-104/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:4)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-104/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-104/output.json new file mode 100644 index 000000000000..fa1525dea3eb --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-104/output.json @@ -0,0 +1,31 @@ +{ + "type": "File", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:4)" + ], + "program": { + "type": "Program", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "expression": { + "type": "NumericLiteral", + "start":1,"end":9,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":9}}, + "extra": { + "rawValue": 11.11, + "raw": "1_1_.1_1", + "parenthesized": true, + "parenStart": 0 + }, + "value": 11.11 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-105/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-105/options.json deleted file mode 100644 index a65e1ff322a7..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-105/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:5)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-105/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-105/output.json new file mode 100644 index 000000000000..8c94785d66b3 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-105/output.json @@ -0,0 +1,31 @@ +{ + "type": "File", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:5)" + ], + "program": { + "type": "Program", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "expression": { + "type": "NumericLiteral", + "start":1,"end":9,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":9}}, + "extra": { + "rawValue": 11.11, + "raw": "1_1._1_1", + "parenthesized": true, + "parenStart": 0 + }, + "value": 11.11 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-106/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-106/options.json deleted file mode 100644 index 9c49308645fd..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-106/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:6)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-106/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-106/output.json new file mode 100644 index 000000000000..83b95a090610 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-106/output.json @@ -0,0 +1,31 @@ +{ + "type": "File", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:6)" + ], + "program": { + "type": "Program", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "expression": { + "type": "NumericLiteral", + "start":1,"end":9,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":9}}, + "extra": { + "rawValue": 111, + "raw": "1_1.1_e1", + "parenthesized": true, + "parenStart": 0 + }, + "value": 111 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-107/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-107/options.json deleted file mode 100644 index 9c49308645fd..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-107/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:6)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-107/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-107/output.json new file mode 100644 index 000000000000..fcf5f8cc4e08 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-107/output.json @@ -0,0 +1,31 @@ +{ + "type": "File", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:6)" + ], + "program": { + "type": "Program", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "expression": { + "type": "NumericLiteral", + "start":1,"end":9,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":9}}, + "extra": { + "rawValue": 111, + "raw": "1_1.1_E1", + "parenthesized": true, + "parenStart": 0 + }, + "value": 111 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-108/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-108/options.json deleted file mode 100644 index badcb4c1b655..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-108/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:7)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-108/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-108/output.json new file mode 100644 index 000000000000..fac7984d5639 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-108/output.json @@ -0,0 +1,31 @@ +{ + "type": "File", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:7)" + ], + "program": { + "type": "Program", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "expression": { + "type": "NumericLiteral", + "start":1,"end":9,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":9}}, + "extra": { + "rawValue": 111, + "raw": "1_1.1e_1", + "parenthesized": true, + "parenStart": 0 + }, + "value": 111 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-109/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-109/options.json deleted file mode 100644 index badcb4c1b655..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-109/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:7)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-109/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-109/output.json new file mode 100644 index 000000000000..245a9416a843 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-109/output.json @@ -0,0 +1,31 @@ +{ + "type": "File", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:7)" + ], + "program": { + "type": "Program", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "expression": { + "type": "NumericLiteral", + "start":1,"end":9,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":9}}, + "extra": { + "rawValue": 111, + "raw": "1_1.1E_1", + "parenthesized": true, + "parenStart": 0 + }, + "value": 111 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-11/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-11/options.json deleted file mode 100644 index a65e1ff322a7..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-11/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:5)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-11/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-11/output.json new file mode 100644 index 000000000000..3ce69cd5a8b1 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-11/output.json @@ -0,0 +1,29 @@ +{ + "type": "File", + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:5)" + ], + "program": { + "type": "Program", + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, + "expression": { + "type": "NumericLiteral", + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, + "extra": { + "rawValue": 161, + "raw": "0xa_1_" + }, + "value": 161 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-110/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-110/options.json deleted file mode 100644 index 9c49308645fd..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-110/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:6)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-110/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-110/output.json new file mode 100644 index 000000000000..1694c85af975 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-110/output.json @@ -0,0 +1,31 @@ +{ + "type": "File", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:6)" + ], + "program": { + "type": "Program", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "expression": { + "type": "NumericLiteral", + "start":1,"end":7,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":7}}, + "extra": { + "rawValue": 17, + "raw": "0x1_1_", + "parenthesized": true, + "parenStart": 0 + }, + "value": 17 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-111/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-111/options.json deleted file mode 100644 index 9c49308645fd..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-111/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:6)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-111/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-111/output.json new file mode 100644 index 000000000000..e033ff3657a7 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-111/output.json @@ -0,0 +1,31 @@ +{ + "type": "File", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:6)" + ], + "program": { + "type": "Program", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "expression": { + "type": "NumericLiteral", + "start":1,"end":7,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":7}}, + "extra": { + "rawValue": 161, + "raw": "0xa_1_", + "parenthesized": true, + "parenStart": 0 + }, + "value": 161 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-112/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-112/options.json deleted file mode 100644 index 477511a87822..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-112/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:3)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-112/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-112/output.json new file mode 100644 index 000000000000..5aebc0f50b72 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-112/output.json @@ -0,0 +1,31 @@ +{ + "type": "File", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:3)" + ], + "program": { + "type": "Program", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "expression": { + "type": "NumericLiteral", + "start":1,"end":7,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":7}}, + "extra": { + "rawValue": 161, + "raw": "0x_a_1", + "parenthesized": true, + "parenStart": 0 + }, + "value": 161 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-113/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-113/options.json deleted file mode 100644 index 477511a87822..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-113/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:3)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-113/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-113/output.json new file mode 100644 index 000000000000..e8db639c568a --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-113/output.json @@ -0,0 +1,33 @@ +{ + "type": "File", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:3)", + "SyntaxError: A numeric separator is only allowed between two digits (1:4)", + "SyntaxError: A numeric separator is only allowed between two digits (1:8)" + ], + "program": { + "type": "Program", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "expression": { + "type": "NumericLiteral", + "start":1,"end":9,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":9}}, + "extra": { + "rawValue": 17, + "raw": "0x__1_1_", + "parenthesized": true, + "parenStart": 0 + }, + "value": 17 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-114/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-114/options.json deleted file mode 100644 index 477511a87822..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-114/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:3)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-114/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-114/output.json new file mode 100644 index 000000000000..9d692b713f67 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-114/output.json @@ -0,0 +1,33 @@ +{ + "type": "File", + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:3)", + "SyntaxError: A numeric separator is only allowed between two digits (1:5)", + "SyntaxError: A numeric separator is only allowed between two digits (1:6)" + ], + "program": { + "type": "Program", + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "expression": { + "type": "NumericLiteral", + "start":1,"end":8,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":8}}, + "extra": { + "rawValue": 17, + "raw": "0x_1__1", + "parenthesized": true, + "parenStart": 0 + }, + "value": 17 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-115/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-115/options.json deleted file mode 100644 index 477511a87822..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-115/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:3)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-115/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-115/output.json new file mode 100644 index 000000000000..0b12f49112ee --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-115/output.json @@ -0,0 +1,32 @@ +{ + "type": "File", + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:3)", + "SyntaxError: A numeric separator is only allowed between two digits (1:7)" + ], + "program": { + "type": "Program", + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "expression": { + "type": "NumericLiteral", + "start":1,"end":8,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":8}}, + "extra": { + "rawValue": 17, + "raw": "0x_1_1_", + "parenthesized": true, + "parenStart": 0 + }, + "value": 17 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-116/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-116/options.json deleted file mode 100644 index 477511a87822..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-116/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:3)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-116/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-116/output.json new file mode 100644 index 000000000000..2629abd0deed --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-116/output.json @@ -0,0 +1,31 @@ +{ + "type": "File", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:3)" + ], + "program": { + "type": "Program", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "expression": { + "type": "NumericLiteral", + "start":1,"end":7,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":7}}, + "extra": { + "rawValue": 9, + "raw": "0o_1_1", + "parenthesized": true, + "parenStart": 0 + }, + "value": 9 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-117/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-117/options.json deleted file mode 100644 index 477511a87822..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-117/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:3)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-117/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-117/output.json new file mode 100644 index 000000000000..f6817e0b226a --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-117/output.json @@ -0,0 +1,31 @@ +{ + "type": "File", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:3)" + ], + "program": { + "type": "Program", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "expression": { + "type": "NumericLiteral", + "start":1,"end":6,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":6}}, + "extra": { + "rawValue": 9, + "raw": "0o_11", + "parenthesized": true, + "parenStart": 0 + }, + "value": 9 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-118/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-118/options.json deleted file mode 100644 index 477511a87822..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-118/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:3)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-118/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-118/output.json new file mode 100644 index 000000000000..1a2378d0b09f --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-118/output.json @@ -0,0 +1,32 @@ +{ + "type": "File", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:3)", + "SyntaxError: A numeric separator is only allowed between two digits (1:8)" + ], + "program": { + "type": "Program", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "expression": { + "type": "NumericLiteral", + "start":1,"end":9,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":9}}, + "extra": { + "rawValue": 9, + "raw": "0o_01_1_", + "parenthesized": true, + "parenStart": 0 + }, + "value": 9 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-119/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-119/options.json deleted file mode 100644 index 477511a87822..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-119/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:3)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-119/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-119/output.json new file mode 100644 index 000000000000..fce3fc757812 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-119/output.json @@ -0,0 +1,31 @@ +{ + "type": "File", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:3)" + ], + "program": { + "type": "Program", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "expression": { + "type": "NumericLiteral", + "start":1,"end":9,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":9}}, + "extra": { + "rawValue": 3, + "raw": "0b_0_1_1", + "parenthesized": true, + "parenStart": 0 + }, + "value": 3 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-12/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-12/options.json deleted file mode 100644 index 8cb6bf4866a3..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-12/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:2)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-12/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-12/output.json new file mode 100644 index 000000000000..6900ec7205d8 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-12/output.json @@ -0,0 +1,29 @@ +{ + "type": "File", + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:2)" + ], + "program": { + "type": "Program", + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, + "expression": { + "type": "NumericLiteral", + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, + "extra": { + "rawValue": 161, + "raw": "0x_a_1" + }, + "value": 161 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-120/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-120/options.json deleted file mode 100644 index 477511a87822..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-120/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:3)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-120/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-120/output.json new file mode 100644 index 000000000000..987d9624eb59 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-120/output.json @@ -0,0 +1,32 @@ +{ + "type": "File", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:3)", + "SyntaxError: A numeric separator is only allowed between two digits (1:8)" + ], + "program": { + "type": "Program", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "expression": { + "type": "NumericLiteral", + "start":1,"end":9,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":9}}, + "extra": { + "rawValue": 3, + "raw": "0b_01_1_", + "parenthesized": true, + "parenStart": 0 + }, + "value": 3 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-121/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-121/options.json deleted file mode 100644 index badcb4c1b655..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-121/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:7)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-121/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-121/output.json new file mode 100644 index 000000000000..6fd12b2edcec --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-121/output.json @@ -0,0 +1,31 @@ +{ + "type": "File", + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:7)" + ], + "program": { + "type": "Program", + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "expression": { + "type": "NumericLiteral", + "start":1,"end":8,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":8}}, + "extra": { + "rawValue": 3, + "raw": "0b01_1_", + "parenthesized": true, + "parenStart": 0 + }, + "value": 3 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-122/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-122/options.json deleted file mode 100644 index 9c49308645fd..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-122/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:6)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-122/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-122/output.json new file mode 100644 index 000000000000..004e40f97bb0 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-122/output.json @@ -0,0 +1,31 @@ +{ + "type": "File", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:6)" + ], + "program": { + "type": "Program", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "expression": { + "type": "NumericLiteral", + "start":1,"end":7,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":7}}, + "extra": { + "rawValue": 9, + "raw": "0o1_1_", + "parenthesized": true, + "parenStart": 0 + }, + "value": 9 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-123/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-123/options.json deleted file mode 100644 index 477511a87822..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-123/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:3)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-123/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-123/output.json new file mode 100644 index 000000000000..2fcbd10c8038 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-123/output.json @@ -0,0 +1,32 @@ +{ + "type": "File", + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:3)", + "SyntaxError: A numeric separator is only allowed between two digits (1:7)" + ], + "program": { + "type": "Program", + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "expression": { + "type": "NumericLiteral", + "start":1,"end":8,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":8}}, + "extra": { + "rawValue": 9, + "raw": "0o_1_1_", + "parenthesized": true, + "parenStart": 0 + }, + "value": 9 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-124/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-124/options.json deleted file mode 100644 index 8cb6bf4866a3..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-124/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:2)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-124/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-124/output.json new file mode 100644 index 000000000000..cd4cd6ffeb61 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-124/output.json @@ -0,0 +1,36 @@ +{ + "type": "File", + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:2)" + ], + "program": { + "type": "Program", + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "BlockStatement", + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, + "body": [ + { + "type": "ExpressionStatement", + "start":1,"end":3,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":3}}, + "expression": { + "type": "NumericLiteral", + "start":1,"end":3,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":3}}, + "extra": { + "rawValue": 1, + "raw": "1_" + }, + "value": 1 + } + } + ], + "directives": [] + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-125/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-125/options.json deleted file mode 100644 index 91c5decd9c42..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-125/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:4)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-125/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-125/output.json new file mode 100644 index 000000000000..a6ea0dbbc145 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-125/output.json @@ -0,0 +1,36 @@ +{ + "type": "File", + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:4)" + ], + "program": { + "type": "Program", + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "BlockStatement", + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, + "body": [ + { + "type": "ExpressionStatement", + "start":1,"end":5,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":5}}, + "expression": { + "type": "NumericLiteral", + "start":1,"end":5,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":5}}, + "extra": { + "rawValue": 11, + "raw": "1_1_" + }, + "value": 11 + } + } + ], + "directives": [] + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-126/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-126/options.json deleted file mode 100644 index 91c5decd9c42..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-126/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:4)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-126/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-126/output.json new file mode 100644 index 000000000000..4e0a0023c3b5 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-126/output.json @@ -0,0 +1,37 @@ +{ + "type": "File", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:4)", + "SyntaxError: A numeric separator is only allowed between two digits (1:5)" + ], + "program": { + "type": "Program", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "BlockStatement", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "body": [ + { + "type": "ExpressionStatement", + "start":1,"end":6,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":6}}, + "expression": { + "type": "NumericLiteral", + "start":1,"end":6,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":6}}, + "extra": { + "rawValue": 11, + "raw": "1_1__" + }, + "value": 11 + } + } + ], + "directives": [] + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-127/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-127/options.json deleted file mode 100644 index 8cb6bf4866a3..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-127/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:2)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-127/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-127/output.json new file mode 100644 index 000000000000..01995ddd7541 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-127/output.json @@ -0,0 +1,37 @@ +{ + "type": "File", + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:2)", + "SyntaxError: A numeric separator is only allowed between two digits (1:3)" + ], + "program": { + "type": "Program", + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "BlockStatement", + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, + "body": [ + { + "type": "ExpressionStatement", + "start":1,"end":5,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":5}}, + "expression": { + "type": "NumericLiteral", + "start":1,"end":5,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":5}}, + "extra": { + "rawValue": 11, + "raw": "1__1" + }, + "value": 11 + } + } + ], + "directives": [] + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-128/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-128/options.json deleted file mode 100644 index 91c5decd9c42..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-128/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:4)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-128/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-128/output.json new file mode 100644 index 000000000000..58bb3e5decf4 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-128/output.json @@ -0,0 +1,36 @@ +{ + "type": "File", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:4)" + ], + "program": { + "type": "Program", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "BlockStatement", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "body": [ + { + "type": "ExpressionStatement", + "start":1,"end":9,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":9}}, + "expression": { + "type": "NumericLiteral", + "start":1,"end":9,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":9}}, + "extra": { + "rawValue": 11.11, + "raw": "1_1_.1_1" + }, + "value": 11.11 + } + } + ], + "directives": [] + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-129/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-129/options.json deleted file mode 100644 index a65e1ff322a7..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-129/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:5)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-129/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-129/output.json new file mode 100644 index 000000000000..54d3a1050e08 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-129/output.json @@ -0,0 +1,36 @@ +{ + "type": "File", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:5)" + ], + "program": { + "type": "Program", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "BlockStatement", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "body": [ + { + "type": "ExpressionStatement", + "start":1,"end":9,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":9}}, + "expression": { + "type": "NumericLiteral", + "start":1,"end":9,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":9}}, + "extra": { + "rawValue": 11.11, + "raw": "1_1._1_1" + }, + "value": 11.11 + } + } + ], + "directives": [] + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-13/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-13/options.json deleted file mode 100644 index 8cb6bf4866a3..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-13/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:2)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-13/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-13/output.json new file mode 100644 index 000000000000..ded88989d1ad --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-13/output.json @@ -0,0 +1,31 @@ +{ + "type": "File", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:2)", + "SyntaxError: A numeric separator is only allowed between two digits (1:3)", + "SyntaxError: A numeric separator is only allowed between two digits (1:7)" + ], + "program": { + "type": "Program", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "expression": { + "type": "NumericLiteral", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "extra": { + "rawValue": 17, + "raw": "0x__1_1_" + }, + "value": 17 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-130/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-130/options.json deleted file mode 100644 index 9c49308645fd..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-130/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:6)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-130/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-130/output.json new file mode 100644 index 000000000000..6eb72f741765 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-130/output.json @@ -0,0 +1,36 @@ +{ + "type": "File", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:6)" + ], + "program": { + "type": "Program", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "BlockStatement", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "body": [ + { + "type": "ExpressionStatement", + "start":1,"end":9,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":9}}, + "expression": { + "type": "NumericLiteral", + "start":1,"end":9,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":9}}, + "extra": { + "rawValue": 111, + "raw": "1_1.1_e1" + }, + "value": 111 + } + } + ], + "directives": [] + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-131/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-131/options.json deleted file mode 100644 index 9c49308645fd..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-131/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:6)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-131/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-131/output.json new file mode 100644 index 000000000000..f97788382071 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-131/output.json @@ -0,0 +1,36 @@ +{ + "type": "File", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:6)" + ], + "program": { + "type": "Program", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "BlockStatement", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "body": [ + { + "type": "ExpressionStatement", + "start":1,"end":9,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":9}}, + "expression": { + "type": "NumericLiteral", + "start":1,"end":9,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":9}}, + "extra": { + "rawValue": 111, + "raw": "1_1.1_E1" + }, + "value": 111 + } + } + ], + "directives": [] + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-132/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-132/options.json deleted file mode 100644 index badcb4c1b655..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-132/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:7)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-132/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-132/output.json new file mode 100644 index 000000000000..bf350c9fd06a --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-132/output.json @@ -0,0 +1,36 @@ +{ + "type": "File", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:7)" + ], + "program": { + "type": "Program", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "BlockStatement", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "body": [ + { + "type": "ExpressionStatement", + "start":1,"end":9,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":9}}, + "expression": { + "type": "NumericLiteral", + "start":1,"end":9,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":9}}, + "extra": { + "rawValue": 111, + "raw": "1_1.1e_1" + }, + "value": 111 + } + } + ], + "directives": [] + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-133/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-133/options.json deleted file mode 100644 index badcb4c1b655..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-133/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:7)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-133/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-133/output.json new file mode 100644 index 000000000000..e06df9501114 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-133/output.json @@ -0,0 +1,36 @@ +{ + "type": "File", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:7)" + ], + "program": { + "type": "Program", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "BlockStatement", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "body": [ + { + "type": "ExpressionStatement", + "start":1,"end":9,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":9}}, + "expression": { + "type": "NumericLiteral", + "start":1,"end":9,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":9}}, + "extra": { + "rawValue": 111, + "raw": "1_1.1E_1" + }, + "value": 111 + } + } + ], + "directives": [] + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-134/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-134/options.json deleted file mode 100644 index 9c49308645fd..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-134/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:6)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-134/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-134/output.json new file mode 100644 index 000000000000..bb0df5540a94 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-134/output.json @@ -0,0 +1,36 @@ +{ + "type": "File", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:6)" + ], + "program": { + "type": "Program", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "BlockStatement", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "body": [ + { + "type": "ExpressionStatement", + "start":1,"end":7,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":7}}, + "expression": { + "type": "NumericLiteral", + "start":1,"end":7,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":7}}, + "extra": { + "rawValue": 17, + "raw": "0x1_1_" + }, + "value": 17 + } + } + ], + "directives": [] + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-135/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-135/options.json deleted file mode 100644 index 9c49308645fd..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-135/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:6)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-135/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-135/output.json new file mode 100644 index 000000000000..4484f2592a62 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-135/output.json @@ -0,0 +1,36 @@ +{ + "type": "File", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:6)" + ], + "program": { + "type": "Program", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "BlockStatement", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "body": [ + { + "type": "ExpressionStatement", + "start":1,"end":7,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":7}}, + "expression": { + "type": "NumericLiteral", + "start":1,"end":7,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":7}}, + "extra": { + "rawValue": 161, + "raw": "0xa_1_" + }, + "value": 161 + } + } + ], + "directives": [] + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-136/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-136/options.json deleted file mode 100644 index 477511a87822..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-136/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:3)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-136/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-136/output.json new file mode 100644 index 000000000000..5b86c977671a --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-136/output.json @@ -0,0 +1,36 @@ +{ + "type": "File", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:3)" + ], + "program": { + "type": "Program", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "BlockStatement", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "body": [ + { + "type": "ExpressionStatement", + "start":1,"end":7,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":7}}, + "expression": { + "type": "NumericLiteral", + "start":1,"end":7,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":7}}, + "extra": { + "rawValue": 161, + "raw": "0x_a_1" + }, + "value": 161 + } + } + ], + "directives": [] + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-137/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-137/options.json deleted file mode 100644 index 477511a87822..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-137/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:3)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-137/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-137/output.json new file mode 100644 index 000000000000..0a7efd31a5f0 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-137/output.json @@ -0,0 +1,38 @@ +{ + "type": "File", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:3)", + "SyntaxError: A numeric separator is only allowed between two digits (1:4)", + "SyntaxError: A numeric separator is only allowed between two digits (1:8)" + ], + "program": { + "type": "Program", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "BlockStatement", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "body": [ + { + "type": "ExpressionStatement", + "start":1,"end":9,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":9}}, + "expression": { + "type": "NumericLiteral", + "start":1,"end":9,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":9}}, + "extra": { + "rawValue": 17, + "raw": "0x__1_1_" + }, + "value": 17 + } + } + ], + "directives": [] + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-138/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-138/options.json deleted file mode 100644 index 477511a87822..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-138/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:3)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-138/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-138/output.json new file mode 100644 index 000000000000..7e5e1b87de3d --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-138/output.json @@ -0,0 +1,38 @@ +{ + "type": "File", + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:3)", + "SyntaxError: A numeric separator is only allowed between two digits (1:5)", + "SyntaxError: A numeric separator is only allowed between two digits (1:6)" + ], + "program": { + "type": "Program", + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "BlockStatement", + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "body": [ + { + "type": "ExpressionStatement", + "start":1,"end":8,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":8}}, + "expression": { + "type": "NumericLiteral", + "start":1,"end":8,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":8}}, + "extra": { + "rawValue": 17, + "raw": "0x_1__1" + }, + "value": 17 + } + } + ], + "directives": [] + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-139/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-139/options.json deleted file mode 100644 index 477511a87822..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-139/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:3)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-139/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-139/output.json new file mode 100644 index 000000000000..a904876ecc6b --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-139/output.json @@ -0,0 +1,37 @@ +{ + "type": "File", + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:3)", + "SyntaxError: A numeric separator is only allowed between two digits (1:7)" + ], + "program": { + "type": "Program", + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "BlockStatement", + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "body": [ + { + "type": "ExpressionStatement", + "start":1,"end":8,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":8}}, + "expression": { + "type": "NumericLiteral", + "start":1,"end":8,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":8}}, + "extra": { + "rawValue": 17, + "raw": "0x_1_1_" + }, + "value": 17 + } + } + ], + "directives": [] + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-14/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-14/options.json deleted file mode 100644 index 8cb6bf4866a3..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-14/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:2)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-14/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-14/output.json new file mode 100644 index 000000000000..9b87ecd61c19 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-14/output.json @@ -0,0 +1,31 @@ +{ + "type": "File", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:2)", + "SyntaxError: A numeric separator is only allowed between two digits (1:4)", + "SyntaxError: A numeric separator is only allowed between two digits (1:5)" + ], + "program": { + "type": "Program", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "expression": { + "type": "NumericLiteral", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "extra": { + "rawValue": 17, + "raw": "0x_1__1" + }, + "value": 17 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-140/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-140/options.json deleted file mode 100644 index 477511a87822..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-140/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:3)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-140/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-140/output.json new file mode 100644 index 000000000000..09eda4f99df0 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-140/output.json @@ -0,0 +1,36 @@ +{ + "type": "File", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:3)" + ], + "program": { + "type": "Program", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "BlockStatement", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "body": [ + { + "type": "ExpressionStatement", + "start":1,"end":7,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":7}}, + "expression": { + "type": "NumericLiteral", + "start":1,"end":7,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":7}}, + "extra": { + "rawValue": 9, + "raw": "0o_1_1" + }, + "value": 9 + } + } + ], + "directives": [] + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-141/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-141/options.json deleted file mode 100644 index 477511a87822..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-141/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:3)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-141/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-141/output.json new file mode 100644 index 000000000000..1fa9b9b565c7 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-141/output.json @@ -0,0 +1,36 @@ +{ + "type": "File", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:3)" + ], + "program": { + "type": "Program", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "BlockStatement", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "body": [ + { + "type": "ExpressionStatement", + "start":1,"end":6,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":6}}, + "expression": { + "type": "NumericLiteral", + "start":1,"end":6,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":6}}, + "extra": { + "rawValue": 9, + "raw": "0o_11" + }, + "value": 9 + } + } + ], + "directives": [] + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-142/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-142/options.json deleted file mode 100644 index 477511a87822..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-142/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:3)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-142/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-142/output.json new file mode 100644 index 000000000000..ab2be9d065cc --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-142/output.json @@ -0,0 +1,37 @@ +{ + "type": "File", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:3)", + "SyntaxError: A numeric separator is only allowed between two digits (1:8)" + ], + "program": { + "type": "Program", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "BlockStatement", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "body": [ + { + "type": "ExpressionStatement", + "start":1,"end":9,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":9}}, + "expression": { + "type": "NumericLiteral", + "start":1,"end":9,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":9}}, + "extra": { + "rawValue": 9, + "raw": "0o_01_1_" + }, + "value": 9 + } + } + ], + "directives": [] + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-143/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-143/options.json deleted file mode 100644 index 477511a87822..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-143/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:3)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-143/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-143/output.json new file mode 100644 index 000000000000..2f01f1cdfce4 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-143/output.json @@ -0,0 +1,36 @@ +{ + "type": "File", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:3)" + ], + "program": { + "type": "Program", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "BlockStatement", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "body": [ + { + "type": "ExpressionStatement", + "start":1,"end":9,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":9}}, + "expression": { + "type": "NumericLiteral", + "start":1,"end":9,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":9}}, + "extra": { + "rawValue": 3, + "raw": "0b_0_1_1" + }, + "value": 3 + } + } + ], + "directives": [] + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-144/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-144/options.json deleted file mode 100644 index 477511a87822..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-144/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:3)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-144/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-144/output.json new file mode 100644 index 000000000000..19996c619dbd --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-144/output.json @@ -0,0 +1,37 @@ +{ + "type": "File", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:3)", + "SyntaxError: A numeric separator is only allowed between two digits (1:8)" + ], + "program": { + "type": "Program", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "BlockStatement", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "body": [ + { + "type": "ExpressionStatement", + "start":1,"end":9,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":9}}, + "expression": { + "type": "NumericLiteral", + "start":1,"end":9,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":9}}, + "extra": { + "rawValue": 3, + "raw": "0b_01_1_" + }, + "value": 3 + } + } + ], + "directives": [] + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-145/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-145/options.json deleted file mode 100644 index badcb4c1b655..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-145/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:7)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-145/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-145/output.json new file mode 100644 index 000000000000..73d0352df20d --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-145/output.json @@ -0,0 +1,36 @@ +{ + "type": "File", + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:7)" + ], + "program": { + "type": "Program", + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "BlockStatement", + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "body": [ + { + "type": "ExpressionStatement", + "start":1,"end":8,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":8}}, + "expression": { + "type": "NumericLiteral", + "start":1,"end":8,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":8}}, + "extra": { + "rawValue": 3, + "raw": "0b01_1_" + }, + "value": 3 + } + } + ], + "directives": [] + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-146/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-146/options.json deleted file mode 100644 index 9c49308645fd..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-146/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:6)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-146/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-146/output.json new file mode 100644 index 000000000000..26e13a153248 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-146/output.json @@ -0,0 +1,36 @@ +{ + "type": "File", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:6)" + ], + "program": { + "type": "Program", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "BlockStatement", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "body": [ + { + "type": "ExpressionStatement", + "start":1,"end":7,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":7}}, + "expression": { + "type": "NumericLiteral", + "start":1,"end":7,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":7}}, + "extra": { + "rawValue": 9, + "raw": "0o1_1_" + }, + "value": 9 + } + } + ], + "directives": [] + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-147/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-147/options.json deleted file mode 100644 index 477511a87822..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-147/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:3)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-147/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-147/output.json new file mode 100644 index 000000000000..21d200a0d6d5 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-147/output.json @@ -0,0 +1,37 @@ +{ + "type": "File", + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:3)", + "SyntaxError: A numeric separator is only allowed between two digits (1:7)" + ], + "program": { + "type": "Program", + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "BlockStatement", + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "body": [ + { + "type": "ExpressionStatement", + "start":1,"end":8,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":8}}, + "expression": { + "type": "NumericLiteral", + "start":1,"end":8,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":8}}, + "extra": { + "rawValue": 9, + "raw": "0o_1_1_" + }, + "value": 9 + } + } + ], + "directives": [] + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-15/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-15/options.json deleted file mode 100644 index 8cb6bf4866a3..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-15/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:2)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-15/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-15/output.json new file mode 100644 index 000000000000..c0679de758a8 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-15/output.json @@ -0,0 +1,30 @@ +{ + "type": "File", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:2)", + "SyntaxError: A numeric separator is only allowed between two digits (1:6)" + ], + "program": { + "type": "Program", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "expression": { + "type": "NumericLiteral", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "extra": { + "rawValue": 17, + "raw": "0x_1_1_" + }, + "value": 17 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-16/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-16/options.json deleted file mode 100644 index 8cb6bf4866a3..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-16/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:2)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-16/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-16/output.json new file mode 100644 index 000000000000..67f7f4463321 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-16/output.json @@ -0,0 +1,29 @@ +{ + "type": "File", + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:2)" + ], + "program": { + "type": "Program", + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, + "expression": { + "type": "NumericLiteral", + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, + "extra": { + "rawValue": 9, + "raw": "0o_1_1" + }, + "value": 9 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-17/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-17/options.json deleted file mode 100644 index 8cb6bf4866a3..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-17/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:2)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-17/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-17/output.json new file mode 100644 index 000000000000..e641715002d1 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-17/output.json @@ -0,0 +1,29 @@ +{ + "type": "File", + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:2)" + ], + "program": { + "type": "Program", + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, + "expression": { + "type": "NumericLiteral", + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, + "extra": { + "rawValue": 9, + "raw": "0o_11" + }, + "value": 9 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-18/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-18/options.json deleted file mode 100644 index 8cb6bf4866a3..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-18/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:2)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-18/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-18/output.json new file mode 100644 index 000000000000..c9862c7c7459 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-18/output.json @@ -0,0 +1,30 @@ +{ + "type": "File", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:2)", + "SyntaxError: A numeric separator is only allowed between two digits (1:7)" + ], + "program": { + "type": "Program", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "expression": { + "type": "NumericLiteral", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "extra": { + "rawValue": 9, + "raw": "0o_01_1_" + }, + "value": 9 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-19/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-19/options.json deleted file mode 100644 index 8cb6bf4866a3..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-19/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:2)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-19/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-19/output.json new file mode 100644 index 000000000000..59ef8dcfe7df --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-19/output.json @@ -0,0 +1,29 @@ +{ + "type": "File", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:2)" + ], + "program": { + "type": "Program", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "expression": { + "type": "NumericLiteral", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "extra": { + "rawValue": 3, + "raw": "0b_0_1_1" + }, + "value": 3 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-2/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-2/options.json deleted file mode 100644 index 477511a87822..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-2/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:3)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-2/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-2/output.json new file mode 100644 index 000000000000..259a3f3a14a0 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-2/output.json @@ -0,0 +1,30 @@ +{ + "type": "File", + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:3)", + "SyntaxError: A numeric separator is only allowed between two digits (1:4)" + ], + "program": { + "type": "Program", + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, + "expression": { + "type": "NumericLiteral", + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, + "extra": { + "rawValue": 11, + "raw": "1_1__" + }, + "value": 11 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-20/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-20/options.json deleted file mode 100644 index 8cb6bf4866a3..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-20/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:2)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-20/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-20/output.json new file mode 100644 index 000000000000..f83fa6ea3e6d --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-20/output.json @@ -0,0 +1,30 @@ +{ + "type": "File", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:2)", + "SyntaxError: A numeric separator is only allowed between two digits (1:7)" + ], + "program": { + "type": "Program", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "expression": { + "type": "NumericLiteral", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "extra": { + "rawValue": 3, + "raw": "0b_01_1_" + }, + "value": 3 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-21/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-21/options.json deleted file mode 100644 index 9c49308645fd..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-21/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:6)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-21/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-21/output.json new file mode 100644 index 000000000000..7390d0e73cb8 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-21/output.json @@ -0,0 +1,29 @@ +{ + "type": "File", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:6)" + ], + "program": { + "type": "Program", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "expression": { + "type": "NumericLiteral", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "extra": { + "rawValue": 3, + "raw": "0b01_1_" + }, + "value": 3 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-22/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-22/options.json deleted file mode 100644 index a65e1ff322a7..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-22/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:5)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-22/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-22/output.json new file mode 100644 index 000000000000..f3aadce6c706 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-22/output.json @@ -0,0 +1,29 @@ +{ + "type": "File", + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:5)" + ], + "program": { + "type": "Program", + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, + "expression": { + "type": "NumericLiteral", + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, + "extra": { + "rawValue": 9, + "raw": "0o1_1_" + }, + "value": 9 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-23/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-23/options.json deleted file mode 100644 index 8cb6bf4866a3..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-23/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:2)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-23/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-23/output.json new file mode 100644 index 000000000000..482160a3f26d --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-23/output.json @@ -0,0 +1,30 @@ +{ + "type": "File", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:2)", + "SyntaxError: A numeric separator is only allowed between two digits (1:6)" + ], + "program": { + "type": "Program", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "expression": { + "type": "NumericLiteral", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "extra": { + "rawValue": 9, + "raw": "0o_1_1_" + }, + "value": 9 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-25/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-25/options.json deleted file mode 100644 index 91c5decd9c42..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-25/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:4)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-25/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-25/output.json new file mode 100644 index 000000000000..ea8fc8c204fb --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-25/output.json @@ -0,0 +1,30 @@ +{ + "type": "File", + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:4)", + "SyntaxError: Expected number in radix 8 (1:5)" + ], + "program": { + "type": "Program", + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, + "expression": { + "type": "NumericLiteral", + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, + "extra": { + "rawValue": 8, + "raw": "0o01_8" + }, + "value": 8 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-26/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-26/options.json deleted file mode 100644 index 7f37dbb4686b..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-26/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Expected number in radix 2 (1:2)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-26/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-26/output.json new file mode 100644 index 000000000000..9a263fd785be --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-26/output.json @@ -0,0 +1,29 @@ +{ + "type": "File", + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, + "errors": [ + "SyntaxError: Expected number in radix 2 (1:2)" + ], + "program": { + "type": "Program", + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, + "expression": { + "type": "NumericLiteral", + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, + "extra": { + "rawValue": 1, + "raw": "0b2_1" + }, + "value": 1 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-27/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-27/options.json index fab06a453d2f..ee18527964e7 100644 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-27/options.json +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-27/options.json @@ -1 +1,3 @@ -{ "throws": "Expected number in radix 16 (1:2)" } +{ + "throws": "Identifier directly after number (1:2)" +} diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-28/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-28/options.json deleted file mode 100644 index 27e4acfa8f65..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-28/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:1)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-28/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-28/output.json new file mode 100644 index 000000000000..4fa0a1810fd5 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-28/output.json @@ -0,0 +1,29 @@ +{ + "type": "File", + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:1)" + ], + "program": { + "type": "Program", + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, + "expression": { + "type": "NumericLiteral", + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}}, + "extra": { + "rawValue": 1, + "raw": "1_" + }, + "value": 1 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-29/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-29/options.json deleted file mode 100644 index 477511a87822..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-29/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:3)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-29/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-29/output.json new file mode 100644 index 000000000000..0d67691d81ba --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-29/output.json @@ -0,0 +1,29 @@ +{ + "type": "File", + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:3)" + ], + "program": { + "type": "Program", + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, + "expression": { + "type": "NumericLiteral", + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, + "extra": { + "rawValue": 11, + "raw": "1_1_" + }, + "value": 11 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-3/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-3/options.json deleted file mode 100644 index 27e4acfa8f65..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-3/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:1)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-3/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-3/output.json new file mode 100644 index 000000000000..872895190ff4 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-3/output.json @@ -0,0 +1,30 @@ +{ + "type": "File", + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:1)", + "SyntaxError: A numeric separator is only allowed between two digits (1:2)" + ], + "program": { + "type": "Program", + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, + "expression": { + "type": "NumericLiteral", + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, + "extra": { + "rawValue": 11, + "raw": "1__1" + }, + "value": 11 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-30/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-30/options.json deleted file mode 100644 index 477511a87822..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-30/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:3)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-30/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-30/output.json new file mode 100644 index 000000000000..1743eab00fbd --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-30/output.json @@ -0,0 +1,30 @@ +{ + "type": "File", + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:3)", + "SyntaxError: A numeric separator is only allowed between two digits (1:4)" + ], + "program": { + "type": "Program", + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, + "expression": { + "type": "NumericLiteral", + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, + "extra": { + "rawValue": 11, + "raw": "1_1__" + }, + "value": 11 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-31/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-31/options.json deleted file mode 100644 index 27e4acfa8f65..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-31/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:1)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-31/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-31/output.json new file mode 100644 index 000000000000..836a76bd99c4 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-31/output.json @@ -0,0 +1,30 @@ +{ + "type": "File", + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:1)", + "SyntaxError: A numeric separator is only allowed between two digits (1:2)" + ], + "program": { + "type": "Program", + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, + "expression": { + "type": "NumericLiteral", + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, + "extra": { + "rawValue": 11, + "raw": "1__1" + }, + "value": 11 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-32/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-32/options.json deleted file mode 100644 index 477511a87822..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-32/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:3)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-32/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-32/output.json new file mode 100644 index 000000000000..e9cfbc456cb3 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-32/output.json @@ -0,0 +1,29 @@ +{ + "type": "File", + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:3)" + ], + "program": { + "type": "Program", + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "expression": { + "type": "NumericLiteral", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "extra": { + "rawValue": 11.11, + "raw": "1_1_.1_1" + }, + "value": 11.11 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-33/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-33/options.json deleted file mode 100644 index 91c5decd9c42..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-33/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:4)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-33/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-33/output.json new file mode 100644 index 000000000000..0e74e29feaae --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-33/output.json @@ -0,0 +1,29 @@ +{ + "type": "File", + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:4)" + ], + "program": { + "type": "Program", + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "expression": { + "type": "NumericLiteral", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "extra": { + "rawValue": 11.11, + "raw": "1_1._1_1" + }, + "value": 11.11 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-34/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-34/options.json deleted file mode 100644 index a65e1ff322a7..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-34/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:5)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-34/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-34/output.json new file mode 100644 index 000000000000..269b48e7fb28 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-34/output.json @@ -0,0 +1,29 @@ +{ + "type": "File", + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:5)" + ], + "program": { + "type": "Program", + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "expression": { + "type": "NumericLiteral", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "extra": { + "rawValue": 111, + "raw": "1_1.1_e1" + }, + "value": 111 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-35/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-35/options.json deleted file mode 100644 index a65e1ff322a7..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-35/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:5)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-35/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-35/output.json new file mode 100644 index 000000000000..d9086f100064 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-35/output.json @@ -0,0 +1,29 @@ +{ + "type": "File", + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:5)" + ], + "program": { + "type": "Program", + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "expression": { + "type": "NumericLiteral", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "extra": { + "rawValue": 111, + "raw": "1_1.1_E1" + }, + "value": 111 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-36/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-36/options.json deleted file mode 100644 index 9c49308645fd..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-36/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:6)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-36/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-36/output.json new file mode 100644 index 000000000000..12858208a0d3 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-36/output.json @@ -0,0 +1,29 @@ +{ + "type": "File", + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:6)" + ], + "program": { + "type": "Program", + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "expression": { + "type": "NumericLiteral", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "extra": { + "rawValue": 111, + "raw": "1_1.1e_1" + }, + "value": 111 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-37/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-37/options.json deleted file mode 100644 index 9c49308645fd..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-37/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:6)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-37/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-37/output.json new file mode 100644 index 000000000000..2128458509f4 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-37/output.json @@ -0,0 +1,29 @@ +{ + "type": "File", + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:6)" + ], + "program": { + "type": "Program", + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "expression": { + "type": "NumericLiteral", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "extra": { + "rawValue": 111, + "raw": "1_1.1E_1" + }, + "value": 111 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-38/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-38/options.json deleted file mode 100644 index a65e1ff322a7..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-38/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:5)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-38/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-38/output.json new file mode 100644 index 000000000000..195c69a6e0d1 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-38/output.json @@ -0,0 +1,29 @@ +{ + "type": "File", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:5)" + ], + "program": { + "type": "Program", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "expression": { + "type": "NumericLiteral", + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, + "extra": { + "rawValue": 17, + "raw": "0x1_1_" + }, + "value": 17 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-39/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-39/options.json deleted file mode 100644 index a65e1ff322a7..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-39/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:5)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-39/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-39/output.json new file mode 100644 index 000000000000..98b20b22a343 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-39/output.json @@ -0,0 +1,29 @@ +{ + "type": "File", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:5)" + ], + "program": { + "type": "Program", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "expression": { + "type": "NumericLiteral", + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, + "extra": { + "rawValue": 161, + "raw": "0xa_1_" + }, + "value": 161 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-4/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-4/options.json deleted file mode 100644 index 477511a87822..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-4/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:3)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-4/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-4/output.json new file mode 100644 index 000000000000..96e6972816cb --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-4/output.json @@ -0,0 +1,29 @@ +{ + "type": "File", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:3)" + ], + "program": { + "type": "Program", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "expression": { + "type": "NumericLiteral", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "extra": { + "rawValue": 11.11, + "raw": "1_1_.1_1" + }, + "value": 11.11 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-40/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-40/options.json deleted file mode 100644 index 8cb6bf4866a3..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-40/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:2)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-40/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-40/output.json new file mode 100644 index 000000000000..bae33528af8b --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-40/output.json @@ -0,0 +1,29 @@ +{ + "type": "File", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:2)" + ], + "program": { + "type": "Program", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "expression": { + "type": "NumericLiteral", + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, + "extra": { + "rawValue": 161, + "raw": "0x_a_1" + }, + "value": 161 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-41/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-41/options.json deleted file mode 100644 index 8cb6bf4866a3..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-41/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:2)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-41/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-41/output.json new file mode 100644 index 000000000000..e08b97681236 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-41/output.json @@ -0,0 +1,31 @@ +{ + "type": "File", + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:2)", + "SyntaxError: A numeric separator is only allowed between two digits (1:3)", + "SyntaxError: A numeric separator is only allowed between two digits (1:7)" + ], + "program": { + "type": "Program", + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "expression": { + "type": "NumericLiteral", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "extra": { + "rawValue": 17, + "raw": "0x__1_1_" + }, + "value": 17 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-42/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-42/options.json deleted file mode 100644 index 8cb6bf4866a3..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-42/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:2)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-42/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-42/output.json new file mode 100644 index 000000000000..17b25f9fb301 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-42/output.json @@ -0,0 +1,31 @@ +{ + "type": "File", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:2)", + "SyntaxError: A numeric separator is only allowed between two digits (1:4)", + "SyntaxError: A numeric separator is only allowed between two digits (1:5)" + ], + "program": { + "type": "Program", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "expression": { + "type": "NumericLiteral", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "extra": { + "rawValue": 17, + "raw": "0x_1__1" + }, + "value": 17 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-43/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-43/options.json deleted file mode 100644 index 8cb6bf4866a3..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-43/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:2)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-43/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-43/output.json new file mode 100644 index 000000000000..37fb1b9d9006 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-43/output.json @@ -0,0 +1,30 @@ +{ + "type": "File", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:2)", + "SyntaxError: A numeric separator is only allowed between two digits (1:6)" + ], + "program": { + "type": "Program", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "expression": { + "type": "NumericLiteral", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "extra": { + "rawValue": 17, + "raw": "0x_1_1_" + }, + "value": 17 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-44/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-44/options.json deleted file mode 100644 index 8cb6bf4866a3..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-44/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:2)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-44/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-44/output.json new file mode 100644 index 000000000000..0c576d51f4f7 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-44/output.json @@ -0,0 +1,29 @@ +{ + "type": "File", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:2)" + ], + "program": { + "type": "Program", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "expression": { + "type": "NumericLiteral", + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, + "extra": { + "rawValue": 9, + "raw": "0o_1_1" + }, + "value": 9 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-45/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-45/options.json deleted file mode 100644 index 8cb6bf4866a3..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-45/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:2)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-45/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-45/output.json new file mode 100644 index 000000000000..f26f8dd544e9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-45/output.json @@ -0,0 +1,29 @@ +{ + "type": "File", + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:2)" + ], + "program": { + "type": "Program", + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, + "expression": { + "type": "NumericLiteral", + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, + "extra": { + "rawValue": 9, + "raw": "0o_11" + }, + "value": 9 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-46/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-46/options.json deleted file mode 100644 index 8cb6bf4866a3..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-46/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:2)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-46/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-46/output.json new file mode 100644 index 000000000000..c721e170501c --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-46/output.json @@ -0,0 +1,30 @@ +{ + "type": "File", + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:2)", + "SyntaxError: A numeric separator is only allowed between two digits (1:7)" + ], + "program": { + "type": "Program", + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "expression": { + "type": "NumericLiteral", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "extra": { + "rawValue": 9, + "raw": "0o_01_1_" + }, + "value": 9 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-47/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-47/options.json deleted file mode 100644 index 8cb6bf4866a3..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-47/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:2)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-47/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-47/output.json new file mode 100644 index 000000000000..32b05f9776a4 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-47/output.json @@ -0,0 +1,29 @@ +{ + "type": "File", + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:2)" + ], + "program": { + "type": "Program", + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "expression": { + "type": "NumericLiteral", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "extra": { + "rawValue": 3, + "raw": "0b_0_1_1" + }, + "value": 3 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-48/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-48/options.json deleted file mode 100644 index 8cb6bf4866a3..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-48/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:2)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-48/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-48/output.json new file mode 100644 index 000000000000..370cad5f22d0 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-48/output.json @@ -0,0 +1,30 @@ +{ + "type": "File", + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:2)", + "SyntaxError: A numeric separator is only allowed between two digits (1:7)" + ], + "program": { + "type": "Program", + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "expression": { + "type": "NumericLiteral", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "extra": { + "rawValue": 3, + "raw": "0b_01_1_" + }, + "value": 3 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-49/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-49/options.json deleted file mode 100644 index 9c49308645fd..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-49/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:6)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-49/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-49/output.json new file mode 100644 index 000000000000..7302b58872fe --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-49/output.json @@ -0,0 +1,29 @@ +{ + "type": "File", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:6)" + ], + "program": { + "type": "Program", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "expression": { + "type": "NumericLiteral", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "extra": { + "rawValue": 3, + "raw": "0b01_1_" + }, + "value": 3 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-5/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-5/options.json deleted file mode 100644 index 91c5decd9c42..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-5/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:4)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-5/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-5/output.json new file mode 100644 index 000000000000..104bab8bfb71 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-5/output.json @@ -0,0 +1,29 @@ +{ + "type": "File", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:4)" + ], + "program": { + "type": "Program", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "expression": { + "type": "NumericLiteral", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "extra": { + "rawValue": 11.11, + "raw": "1_1._1_1" + }, + "value": 11.11 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-50/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-50/options.json deleted file mode 100644 index a65e1ff322a7..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-50/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:5)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-50/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-50/output.json new file mode 100644 index 000000000000..1696b7203671 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-50/output.json @@ -0,0 +1,29 @@ +{ + "type": "File", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:5)" + ], + "program": { + "type": "Program", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "expression": { + "type": "NumericLiteral", + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, + "extra": { + "rawValue": 9, + "raw": "0o1_1_" + }, + "value": 9 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-51/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-51/options.json deleted file mode 100644 index 8cb6bf4866a3..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-51/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:2)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-51/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-51/output.json new file mode 100644 index 000000000000..4a170306f9d8 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-51/output.json @@ -0,0 +1,30 @@ +{ + "type": "File", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:2)", + "SyntaxError: A numeric separator is only allowed between two digits (1:6)" + ], + "program": { + "type": "Program", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "expression": { + "type": "NumericLiteral", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "extra": { + "rawValue": 9, + "raw": "0o_1_1_" + }, + "value": 9 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-52/input.js b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-52/input.js index b6b4f448099d..475f52e0eb50 100644 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-52/input.js +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-52/input.js @@ -1 +1 @@ -1_, +1_, 0 diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-52/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-52/options.json deleted file mode 100644 index 27e4acfa8f65..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-52/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:1)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-52/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-52/output.json new file mode 100644 index 000000000000..ef36209f39e2 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-52/output.json @@ -0,0 +1,44 @@ +{ + "type": "File", + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:1)" + ], + "program": { + "type": "Program", + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, + "expression": { + "type": "SequenceExpression", + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, + "expressions": [ + { + "type": "NumericLiteral", + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}}, + "extra": { + "rawValue": 1, + "raw": "1_" + }, + "value": 1 + }, + { + "type": "NumericLiteral", + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5}}, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-53/input.js b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-53/input.js index 4b8047ea34a5..ce3480ab5810 100644 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-53/input.js +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-53/input.js @@ -1 +1 @@ -1_1_, +1_1_, 0 diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-53/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-53/options.json deleted file mode 100644 index 477511a87822..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-53/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:3)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-53/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-53/output.json new file mode 100644 index 000000000000..b59406105388 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-53/output.json @@ -0,0 +1,44 @@ +{ + "type": "File", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:3)" + ], + "program": { + "type": "Program", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "expression": { + "type": "SequenceExpression", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "expressions": [ + { + "type": "NumericLiteral", + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, + "extra": { + "rawValue": 11, + "raw": "1_1_" + }, + "value": 11 + }, + { + "type": "NumericLiteral", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7}}, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-54/input.js b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-54/input.js index cac8642d14e7..be4906c68d09 100644 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-54/input.js +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-54/input.js @@ -1 +1 @@ -1_1__, +1_1__, 0 diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-54/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-54/options.json deleted file mode 100644 index 477511a87822..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-54/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:3)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-54/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-54/output.json new file mode 100644 index 000000000000..a240786ccdd3 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-54/output.json @@ -0,0 +1,45 @@ +{ + "type": "File", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:3)", + "SyntaxError: A numeric separator is only allowed between two digits (1:4)" + ], + "program": { + "type": "Program", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "expression": { + "type": "SequenceExpression", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "expressions": [ + { + "type": "NumericLiteral", + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, + "extra": { + "rawValue": 11, + "raw": "1_1__" + }, + "value": 11 + }, + { + "type": "NumericLiteral", + "start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8}}, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-55/input.js b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-55/input.js index a9051bb2db71..10191f1bd355 100644 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-55/input.js +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-55/input.js @@ -1 +1 @@ -1__1, +1__1, 0 diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-55/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-55/options.json deleted file mode 100644 index 27e4acfa8f65..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-55/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:1)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-55/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-55/output.json new file mode 100644 index 000000000000..327ca0646199 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-55/output.json @@ -0,0 +1,45 @@ +{ + "type": "File", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:1)", + "SyntaxError: A numeric separator is only allowed between two digits (1:2)" + ], + "program": { + "type": "Program", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "expression": { + "type": "SequenceExpression", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "expressions": [ + { + "type": "NumericLiteral", + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, + "extra": { + "rawValue": 11, + "raw": "1__1" + }, + "value": 11 + }, + { + "type": "NumericLiteral", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7}}, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-56/input.js b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-56/input.js index 7213755d0f38..be9c6e14d226 100644 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-56/input.js +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-56/input.js @@ -1 +1 @@ -1_1_.1_1, +1_1_.1_1, 0 diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-56/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-56/options.json deleted file mode 100644 index 477511a87822..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-56/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:3)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-56/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-56/output.json new file mode 100644 index 000000000000..a1f3a2f79773 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-56/output.json @@ -0,0 +1,44 @@ +{ + "type": "File", + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:3)" + ], + "program": { + "type": "Program", + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "expression": { + "type": "SequenceExpression", + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "expressions": [ + { + "type": "NumericLiteral", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "extra": { + "rawValue": 11.11, + "raw": "1_1_.1_1" + }, + "value": 11.11 + }, + { + "type": "NumericLiteral", + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11}}, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-57/input.js b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-57/input.js index db8717756d2a..e2a13541725e 100644 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-57/input.js +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-57/input.js @@ -1 +1 @@ -1_1._1_1, +1_1._1_1, 0 diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-57/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-57/options.json deleted file mode 100644 index 91c5decd9c42..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-57/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:4)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-57/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-57/output.json new file mode 100644 index 000000000000..5be8427a63dc --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-57/output.json @@ -0,0 +1,44 @@ +{ + "type": "File", + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:4)" + ], + "program": { + "type": "Program", + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "expression": { + "type": "SequenceExpression", + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "expressions": [ + { + "type": "NumericLiteral", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "extra": { + "rawValue": 11.11, + "raw": "1_1._1_1" + }, + "value": 11.11 + }, + { + "type": "NumericLiteral", + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11}}, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-58/input.js b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-58/input.js index 5e5e356da976..49539d8e1686 100644 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-58/input.js +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-58/input.js @@ -1 +1 @@ -1_1.1_e1, +1_1.1_e1, 0 diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-58/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-58/options.json deleted file mode 100644 index a65e1ff322a7..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-58/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:5)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-58/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-58/output.json new file mode 100644 index 000000000000..be530847849d --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-58/output.json @@ -0,0 +1,44 @@ +{ + "type": "File", + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:5)" + ], + "program": { + "type": "Program", + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "expression": { + "type": "SequenceExpression", + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "expressions": [ + { + "type": "NumericLiteral", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "extra": { + "rawValue": 111, + "raw": "1_1.1_e1" + }, + "value": 111 + }, + { + "type": "NumericLiteral", + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11}}, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-59/input.js b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-59/input.js index b07556e6d95e..b06fd2edbbc4 100644 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-59/input.js +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-59/input.js @@ -1 +1 @@ -1_1.1_E1, +1_1.1_E1, 0 diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-59/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-59/options.json deleted file mode 100644 index a65e1ff322a7..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-59/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:5)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-59/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-59/output.json new file mode 100644 index 000000000000..8946a1d3dfa7 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-59/output.json @@ -0,0 +1,44 @@ +{ + "type": "File", + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:5)" + ], + "program": { + "type": "Program", + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "expression": { + "type": "SequenceExpression", + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "expressions": [ + { + "type": "NumericLiteral", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "extra": { + "rawValue": 111, + "raw": "1_1.1_E1" + }, + "value": 111 + }, + { + "type": "NumericLiteral", + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11}}, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-6/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-6/options.json deleted file mode 100644 index a65e1ff322a7..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-6/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:5)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-6/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-6/output.json new file mode 100644 index 000000000000..47194a33cc24 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-6/output.json @@ -0,0 +1,29 @@ +{ + "type": "File", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:5)" + ], + "program": { + "type": "Program", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "expression": { + "type": "NumericLiteral", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "extra": { + "rawValue": 111, + "raw": "1_1.1_e1" + }, + "value": 111 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-60/input.js b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-60/input.js index 0186dfaccb82..61f6290af574 100644 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-60/input.js +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-60/input.js @@ -1 +1 @@ -1_1.1e_1, +1_1.1e_1, 0 diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-60/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-60/options.json deleted file mode 100644 index 9c49308645fd..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-60/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:6)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-60/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-60/output.json new file mode 100644 index 000000000000..2fcf0f2e7170 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-60/output.json @@ -0,0 +1,44 @@ +{ + "type": "File", + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:6)" + ], + "program": { + "type": "Program", + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "expression": { + "type": "SequenceExpression", + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "expressions": [ + { + "type": "NumericLiteral", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "extra": { + "rawValue": 111, + "raw": "1_1.1e_1" + }, + "value": 111 + }, + { + "type": "NumericLiteral", + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11}}, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-61/input.js b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-61/input.js index 85594dea3099..026cf8e40d3a 100644 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-61/input.js +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-61/input.js @@ -1 +1 @@ -1_1.1E_1, +1_1.1E_1, 0 diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-61/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-61/options.json deleted file mode 100644 index 9c49308645fd..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-61/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:6)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-61/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-61/output.json new file mode 100644 index 000000000000..7b94176ac8a8 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-61/output.json @@ -0,0 +1,44 @@ +{ + "type": "File", + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:6)" + ], + "program": { + "type": "Program", + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "expression": { + "type": "SequenceExpression", + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "expressions": [ + { + "type": "NumericLiteral", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "extra": { + "rawValue": 111, + "raw": "1_1.1E_1" + }, + "value": 111 + }, + { + "type": "NumericLiteral", + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11}}, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-62/input.js b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-62/input.js index e0ed0c98f626..b34d9ea95a4d 100644 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-62/input.js +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-62/input.js @@ -1 +1 @@ -0x1_1_, +0x1_1_, 0 diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-62/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-62/options.json deleted file mode 100644 index a65e1ff322a7..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-62/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:5)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-62/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-62/output.json new file mode 100644 index 000000000000..9ccb458bc25c --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-62/output.json @@ -0,0 +1,44 @@ +{ + "type": "File", + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:5)" + ], + "program": { + "type": "Program", + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "expression": { + "type": "SequenceExpression", + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "expressions": [ + { + "type": "NumericLiteral", + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, + "extra": { + "rawValue": 17, + "raw": "0x1_1_" + }, + "value": 17 + }, + { + "type": "NumericLiteral", + "start":8,"end":9,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":9}}, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-63/input.js b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-63/input.js index d1b793f8dfed..28a917a7aca3 100644 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-63/input.js +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-63/input.js @@ -1 +1 @@ -0xa_1_, +0xa_1_, 0 diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-63/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-63/options.json deleted file mode 100644 index a65e1ff322a7..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-63/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:5)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-63/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-63/output.json new file mode 100644 index 000000000000..270a3c6f1257 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-63/output.json @@ -0,0 +1,44 @@ +{ + "type": "File", + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:5)" + ], + "program": { + "type": "Program", + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "expression": { + "type": "SequenceExpression", + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "expressions": [ + { + "type": "NumericLiteral", + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, + "extra": { + "rawValue": 161, + "raw": "0xa_1_" + }, + "value": 161 + }, + { + "type": "NumericLiteral", + "start":8,"end":9,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":9}}, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-64/input.js b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-64/input.js index e5543066d000..8e1c3c4399a1 100644 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-64/input.js +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-64/input.js @@ -1 +1 @@ -0x_a_1, +0x_a_1, 0 diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-64/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-64/options.json deleted file mode 100644 index 8cb6bf4866a3..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-64/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:2)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-64/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-64/output.json new file mode 100644 index 000000000000..f11b9f23a562 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-64/output.json @@ -0,0 +1,44 @@ +{ + "type": "File", + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:2)" + ], + "program": { + "type": "Program", + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "expression": { + "type": "SequenceExpression", + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "expressions": [ + { + "type": "NumericLiteral", + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, + "extra": { + "rawValue": 161, + "raw": "0x_a_1" + }, + "value": 161 + }, + { + "type": "NumericLiteral", + "start":8,"end":9,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":9}}, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-65/input.js b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-65/input.js index 68e6a0d63fea..d8039a473eb0 100644 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-65/input.js +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-65/input.js @@ -1 +1 @@ -0x__1_1_, +0x__1_1_, 0 diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-65/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-65/options.json deleted file mode 100644 index 8cb6bf4866a3..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-65/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:2)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-65/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-65/output.json new file mode 100644 index 000000000000..b115442a128e --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-65/output.json @@ -0,0 +1,46 @@ +{ + "type": "File", + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:2)", + "SyntaxError: A numeric separator is only allowed between two digits (1:3)", + "SyntaxError: A numeric separator is only allowed between two digits (1:7)" + ], + "program": { + "type": "Program", + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "expression": { + "type": "SequenceExpression", + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "expressions": [ + { + "type": "NumericLiteral", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "extra": { + "rawValue": 17, + "raw": "0x__1_1_" + }, + "value": 17 + }, + { + "type": "NumericLiteral", + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11}}, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-66/input.js b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-66/input.js index fd959c9609a9..3853dd5ba743 100644 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-66/input.js +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-66/input.js @@ -1 +1 @@ -0x_1__1, +0x_1__1, 0 diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-66/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-66/options.json deleted file mode 100644 index 8cb6bf4866a3..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-66/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:2)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-66/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-66/output.json new file mode 100644 index 000000000000..8460ef9ed922 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-66/output.json @@ -0,0 +1,46 @@ +{ + "type": "File", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:2)", + "SyntaxError: A numeric separator is only allowed between two digits (1:4)", + "SyntaxError: A numeric separator is only allowed between two digits (1:5)" + ], + "program": { + "type": "Program", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "expression": { + "type": "SequenceExpression", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "expressions": [ + { + "type": "NumericLiteral", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "extra": { + "rawValue": 17, + "raw": "0x_1__1" + }, + "value": 17 + }, + { + "type": "NumericLiteral", + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10}}, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-67/input.js b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-67/input.js index dc2301a00ea7..90213eb4c896 100644 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-67/input.js +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-67/input.js @@ -1 +1 @@ -0x_1_1_, +0x_1_1_, 0 diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-67/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-67/options.json deleted file mode 100644 index 8cb6bf4866a3..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-67/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:2)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-67/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-67/output.json new file mode 100644 index 000000000000..af0c11230973 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-67/output.json @@ -0,0 +1,45 @@ +{ + "type": "File", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:2)", + "SyntaxError: A numeric separator is only allowed between two digits (1:6)" + ], + "program": { + "type": "Program", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "expression": { + "type": "SequenceExpression", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "expressions": [ + { + "type": "NumericLiteral", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "extra": { + "rawValue": 17, + "raw": "0x_1_1_" + }, + "value": 17 + }, + { + "type": "NumericLiteral", + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10}}, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-68/input.js b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-68/input.js index 3a7f53b8dc81..56f62d261b65 100644 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-68/input.js +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-68/input.js @@ -1 +1 @@ -0o_1_1, +0o_1_1, 0 diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-68/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-68/options.json deleted file mode 100644 index 8cb6bf4866a3..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-68/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:2)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-68/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-68/output.json new file mode 100644 index 000000000000..b4baab71f704 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-68/output.json @@ -0,0 +1,44 @@ +{ + "type": "File", + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:2)" + ], + "program": { + "type": "Program", + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "expression": { + "type": "SequenceExpression", + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "expressions": [ + { + "type": "NumericLiteral", + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, + "extra": { + "rawValue": 9, + "raw": "0o_1_1" + }, + "value": 9 + }, + { + "type": "NumericLiteral", + "start":8,"end":9,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":9}}, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-69/input.js b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-69/input.js index ed870aa937cd..fe56d1a3c36d 100644 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-69/input.js +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-69/input.js @@ -1 +1 @@ -0o_11, +0o_11, 0 diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-69/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-69/options.json deleted file mode 100644 index 8cb6bf4866a3..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-69/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:2)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-69/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-69/output.json new file mode 100644 index 000000000000..67b40a81583e --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-69/output.json @@ -0,0 +1,44 @@ +{ + "type": "File", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:2)" + ], + "program": { + "type": "Program", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "expression": { + "type": "SequenceExpression", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "expressions": [ + { + "type": "NumericLiteral", + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, + "extra": { + "rawValue": 9, + "raw": "0o_11" + }, + "value": 9 + }, + { + "type": "NumericLiteral", + "start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8}}, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-7/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-7/options.json deleted file mode 100644 index a65e1ff322a7..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-7/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:5)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-7/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-7/output.json new file mode 100644 index 000000000000..d332a8378d0b --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-7/output.json @@ -0,0 +1,29 @@ +{ + "type": "File", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:5)" + ], + "program": { + "type": "Program", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "expression": { + "type": "NumericLiteral", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "extra": { + "rawValue": 111, + "raw": "1_1.1_E1" + }, + "value": 111 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-70/input.js b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-70/input.js index e9fcb15ff998..d395282140ef 100644 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-70/input.js +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-70/input.js @@ -1 +1 @@ -0o_01_1_, +0o_01_1_, 0 diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-70/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-70/options.json deleted file mode 100644 index 8cb6bf4866a3..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-70/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:2)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-70/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-70/output.json new file mode 100644 index 000000000000..7e2e98b195ab --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-70/output.json @@ -0,0 +1,45 @@ +{ + "type": "File", + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:2)", + "SyntaxError: A numeric separator is only allowed between two digits (1:7)" + ], + "program": { + "type": "Program", + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "expression": { + "type": "SequenceExpression", + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "expressions": [ + { + "type": "NumericLiteral", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "extra": { + "rawValue": 9, + "raw": "0o_01_1_" + }, + "value": 9 + }, + { + "type": "NumericLiteral", + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11}}, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-71/input.js b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-71/input.js index 86cc54d9ed2d..4f5cb5c1e06b 100644 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-71/input.js +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-71/input.js @@ -1 +1 @@ -0b_0_1_1, +0b_0_1_1, 0 diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-71/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-71/options.json deleted file mode 100644 index 8cb6bf4866a3..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-71/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:2)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-71/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-71/output.json new file mode 100644 index 000000000000..1e722211301b --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-71/output.json @@ -0,0 +1,44 @@ +{ + "type": "File", + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:2)" + ], + "program": { + "type": "Program", + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "expression": { + "type": "SequenceExpression", + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "expressions": [ + { + "type": "NumericLiteral", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "extra": { + "rawValue": 3, + "raw": "0b_0_1_1" + }, + "value": 3 + }, + { + "type": "NumericLiteral", + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11}}, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-72/input.js b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-72/input.js index 0c52a13346c0..1589fddd67c3 100644 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-72/input.js +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-72/input.js @@ -1 +1 @@ -0b_01_1_, +0b_01_1_, 0 diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-72/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-72/options.json deleted file mode 100644 index 8cb6bf4866a3..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-72/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:2)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-72/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-72/output.json new file mode 100644 index 000000000000..b6fc5e3e25ec --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-72/output.json @@ -0,0 +1,45 @@ +{ + "type": "File", + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:2)", + "SyntaxError: A numeric separator is only allowed between two digits (1:7)" + ], + "program": { + "type": "Program", + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "expression": { + "type": "SequenceExpression", + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "expressions": [ + { + "type": "NumericLiteral", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "extra": { + "rawValue": 3, + "raw": "0b_01_1_" + }, + "value": 3 + }, + { + "type": "NumericLiteral", + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11}}, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-73/input.js b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-73/input.js index 95c45fd025be..c730763e66fa 100644 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-73/input.js +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-73/input.js @@ -1 +1 @@ -0b01_1_, +0b01_1_, 0 diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-73/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-73/options.json deleted file mode 100644 index 9c49308645fd..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-73/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:6)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-73/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-73/output.json new file mode 100644 index 000000000000..87cbb9e74aaf --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-73/output.json @@ -0,0 +1,44 @@ +{ + "type": "File", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:6)" + ], + "program": { + "type": "Program", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "expression": { + "type": "SequenceExpression", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "expressions": [ + { + "type": "NumericLiteral", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "extra": { + "rawValue": 3, + "raw": "0b01_1_" + }, + "value": 3 + }, + { + "type": "NumericLiteral", + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10}}, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-74/input.js b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-74/input.js index 58ff35dd6c36..3a3aa0484726 100644 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-74/input.js +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-74/input.js @@ -1 +1 @@ -0o1_1_, +0o1_1_, 0 diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-74/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-74/options.json deleted file mode 100644 index a65e1ff322a7..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-74/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:5)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-74/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-74/output.json new file mode 100644 index 000000000000..e13589825cfd --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-74/output.json @@ -0,0 +1,44 @@ +{ + "type": "File", + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:5)" + ], + "program": { + "type": "Program", + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "expression": { + "type": "SequenceExpression", + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "expressions": [ + { + "type": "NumericLiteral", + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, + "extra": { + "rawValue": 9, + "raw": "0o1_1_" + }, + "value": 9 + }, + { + "type": "NumericLiteral", + "start":8,"end":9,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":9}}, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-75/input.js b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-75/input.js index bd44d425a6fa..a4d36757d478 100644 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-75/input.js +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-75/input.js @@ -1 +1 @@ -0o_1_1_, +0o_1_1_, 0 diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-75/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-75/options.json deleted file mode 100644 index 8cb6bf4866a3..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-75/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:2)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-75/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-75/output.json new file mode 100644 index 000000000000..99aaeee03660 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-75/output.json @@ -0,0 +1,45 @@ +{ + "type": "File", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:2)", + "SyntaxError: A numeric separator is only allowed between two digits (1:6)" + ], + "program": { + "type": "Program", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "expression": { + "type": "SequenceExpression", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "expressions": [ + { + "type": "NumericLiteral", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "extra": { + "rawValue": 9, + "raw": "0o_1_1_" + }, + "value": 9 + }, + { + "type": "NumericLiteral", + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10}}, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-76/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-76/options.json deleted file mode 100644 index 8cb6bf4866a3..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-76/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:2)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-76/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-76/output.json new file mode 100644 index 000000000000..6a5210632fdb --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-76/output.json @@ -0,0 +1,35 @@ +{ + "type": "File", + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:2)" + ], + "program": { + "type": "Program", + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, + "expression": { + "type": "ArrayExpression", + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, + "elements": [ + { + "type": "NumericLiteral", + "start":1,"end":3,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":3}}, + "extra": { + "rawValue": 1, + "raw": "1_" + }, + "value": 1 + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-77/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-77/options.json deleted file mode 100644 index 91c5decd9c42..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-77/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:4)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-77/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-77/output.json new file mode 100644 index 000000000000..3daf76e31921 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-77/output.json @@ -0,0 +1,35 @@ +{ + "type": "File", + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:4)" + ], + "program": { + "type": "Program", + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, + "expression": { + "type": "ArrayExpression", + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, + "elements": [ + { + "type": "NumericLiteral", + "start":1,"end":5,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":5}}, + "extra": { + "rawValue": 11, + "raw": "1_1_" + }, + "value": 11 + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-78/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-78/options.json deleted file mode 100644 index 91c5decd9c42..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-78/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:4)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-78/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-78/output.json new file mode 100644 index 000000000000..945775d56e14 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-78/output.json @@ -0,0 +1,36 @@ +{ + "type": "File", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:4)", + "SyntaxError: A numeric separator is only allowed between two digits (1:5)" + ], + "program": { + "type": "Program", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "expression": { + "type": "ArrayExpression", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "elements": [ + { + "type": "NumericLiteral", + "start":1,"end":6,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":6}}, + "extra": { + "rawValue": 11, + "raw": "1_1__" + }, + "value": 11 + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-79/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-79/options.json deleted file mode 100644 index 8cb6bf4866a3..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-79/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:2)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-79/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-79/output.json new file mode 100644 index 000000000000..961a9442c741 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-79/output.json @@ -0,0 +1,36 @@ +{ + "type": "File", + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:2)", + "SyntaxError: A numeric separator is only allowed between two digits (1:3)" + ], + "program": { + "type": "Program", + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, + "expression": { + "type": "ArrayExpression", + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, + "elements": [ + { + "type": "NumericLiteral", + "start":1,"end":5,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":5}}, + "extra": { + "rawValue": 11, + "raw": "1__1" + }, + "value": 11 + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-8/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-8/options.json deleted file mode 100644 index 9c49308645fd..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-8/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:6)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-8/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-8/output.json new file mode 100644 index 000000000000..ac19c3b8fef1 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-8/output.json @@ -0,0 +1,29 @@ +{ + "type": "File", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:6)" + ], + "program": { + "type": "Program", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "expression": { + "type": "NumericLiteral", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "extra": { + "rawValue": 111, + "raw": "1_1.1e_1" + }, + "value": 111 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-80/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-80/options.json deleted file mode 100644 index 91c5decd9c42..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-80/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:4)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-80/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-80/output.json new file mode 100644 index 000000000000..5ac02a810421 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-80/output.json @@ -0,0 +1,35 @@ +{ + "type": "File", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:4)" + ], + "program": { + "type": "Program", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "expression": { + "type": "ArrayExpression", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "elements": [ + { + "type": "NumericLiteral", + "start":1,"end":9,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":9}}, + "extra": { + "rawValue": 11.11, + "raw": "1_1_.1_1" + }, + "value": 11.11 + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-81/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-81/options.json deleted file mode 100644 index a65e1ff322a7..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-81/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:5)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-81/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-81/output.json new file mode 100644 index 000000000000..f85156325dbc --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-81/output.json @@ -0,0 +1,35 @@ +{ + "type": "File", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:5)" + ], + "program": { + "type": "Program", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "expression": { + "type": "ArrayExpression", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "elements": [ + { + "type": "NumericLiteral", + "start":1,"end":9,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":9}}, + "extra": { + "rawValue": 11.11, + "raw": "1_1._1_1" + }, + "value": 11.11 + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-82/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-82/options.json deleted file mode 100644 index 9c49308645fd..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-82/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:6)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-82/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-82/output.json new file mode 100644 index 000000000000..63db3421d887 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-82/output.json @@ -0,0 +1,35 @@ +{ + "type": "File", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:6)" + ], + "program": { + "type": "Program", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "expression": { + "type": "ArrayExpression", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "elements": [ + { + "type": "NumericLiteral", + "start":1,"end":9,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":9}}, + "extra": { + "rawValue": 111, + "raw": "1_1.1_e1" + }, + "value": 111 + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-83/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-83/options.json deleted file mode 100644 index 9c49308645fd..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-83/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:6)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-83/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-83/output.json new file mode 100644 index 000000000000..34de6f803594 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-83/output.json @@ -0,0 +1,35 @@ +{ + "type": "File", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:6)" + ], + "program": { + "type": "Program", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "expression": { + "type": "ArrayExpression", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "elements": [ + { + "type": "NumericLiteral", + "start":1,"end":9,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":9}}, + "extra": { + "rawValue": 111, + "raw": "1_1.1_E1" + }, + "value": 111 + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-84/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-84/options.json deleted file mode 100644 index badcb4c1b655..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-84/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:7)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-84/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-84/output.json new file mode 100644 index 000000000000..bd892f5bef65 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-84/output.json @@ -0,0 +1,35 @@ +{ + "type": "File", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:7)" + ], + "program": { + "type": "Program", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "expression": { + "type": "ArrayExpression", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "elements": [ + { + "type": "NumericLiteral", + "start":1,"end":9,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":9}}, + "extra": { + "rawValue": 111, + "raw": "1_1.1e_1" + }, + "value": 111 + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-85/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-85/options.json deleted file mode 100644 index badcb4c1b655..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-85/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:7)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-85/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-85/output.json new file mode 100644 index 000000000000..4ed7d8e9c017 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-85/output.json @@ -0,0 +1,35 @@ +{ + "type": "File", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:7)" + ], + "program": { + "type": "Program", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "expression": { + "type": "ArrayExpression", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "elements": [ + { + "type": "NumericLiteral", + "start":1,"end":9,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":9}}, + "extra": { + "rawValue": 111, + "raw": "1_1.1E_1" + }, + "value": 111 + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-86/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-86/options.json deleted file mode 100644 index 9c49308645fd..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-86/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:6)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-86/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-86/output.json new file mode 100644 index 000000000000..2038ff8d78f1 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-86/output.json @@ -0,0 +1,35 @@ +{ + "type": "File", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:6)" + ], + "program": { + "type": "Program", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "expression": { + "type": "ArrayExpression", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "elements": [ + { + "type": "NumericLiteral", + "start":1,"end":7,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":7}}, + "extra": { + "rawValue": 17, + "raw": "0x1_1_" + }, + "value": 17 + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-87/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-87/options.json deleted file mode 100644 index 9c49308645fd..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-87/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:6)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-87/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-87/output.json new file mode 100644 index 000000000000..593809dbd35d --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-87/output.json @@ -0,0 +1,35 @@ +{ + "type": "File", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:6)" + ], + "program": { + "type": "Program", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "expression": { + "type": "ArrayExpression", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "elements": [ + { + "type": "NumericLiteral", + "start":1,"end":7,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":7}}, + "extra": { + "rawValue": 161, + "raw": "0xa_1_" + }, + "value": 161 + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-88/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-88/options.json deleted file mode 100644 index 477511a87822..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-88/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:3)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-88/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-88/output.json new file mode 100644 index 000000000000..67a557a8d3eb --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-88/output.json @@ -0,0 +1,35 @@ +{ + "type": "File", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:3)" + ], + "program": { + "type": "Program", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "expression": { + "type": "ArrayExpression", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "elements": [ + { + "type": "NumericLiteral", + "start":1,"end":7,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":7}}, + "extra": { + "rawValue": 161, + "raw": "0x_a_1" + }, + "value": 161 + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-89/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-89/options.json deleted file mode 100644 index 477511a87822..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-89/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:3)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-89/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-89/output.json new file mode 100644 index 000000000000..8a9f3fe0cf90 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-89/output.json @@ -0,0 +1,37 @@ +{ + "type": "File", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:3)", + "SyntaxError: A numeric separator is only allowed between two digits (1:4)", + "SyntaxError: A numeric separator is only allowed between two digits (1:8)" + ], + "program": { + "type": "Program", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "expression": { + "type": "ArrayExpression", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "elements": [ + { + "type": "NumericLiteral", + "start":1,"end":9,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":9}}, + "extra": { + "rawValue": 17, + "raw": "0x__1_1_" + }, + "value": 17 + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-9/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-9/options.json deleted file mode 100644 index 9c49308645fd..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-9/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:6)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-9/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-9/output.json new file mode 100644 index 000000000000..28cdddee6c6e --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-9/output.json @@ -0,0 +1,29 @@ +{ + "type": "File", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:6)" + ], + "program": { + "type": "Program", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "expression": { + "type": "NumericLiteral", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "extra": { + "rawValue": 111, + "raw": "1_1.1E_1" + }, + "value": 111 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-90/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-90/options.json deleted file mode 100644 index 477511a87822..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-90/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:3)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-90/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-90/output.json new file mode 100644 index 000000000000..a46838420e3c --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-90/output.json @@ -0,0 +1,37 @@ +{ + "type": "File", + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:3)", + "SyntaxError: A numeric separator is only allowed between two digits (1:5)", + "SyntaxError: A numeric separator is only allowed between two digits (1:6)" + ], + "program": { + "type": "Program", + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "expression": { + "type": "ArrayExpression", + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "elements": [ + { + "type": "NumericLiteral", + "start":1,"end":8,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":8}}, + "extra": { + "rawValue": 17, + "raw": "0x_1__1" + }, + "value": 17 + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-91/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-91/options.json deleted file mode 100644 index 477511a87822..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-91/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:3)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-91/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-91/output.json new file mode 100644 index 000000000000..a4f7ce2d86b8 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-91/output.json @@ -0,0 +1,36 @@ +{ + "type": "File", + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:3)", + "SyntaxError: A numeric separator is only allowed between two digits (1:7)" + ], + "program": { + "type": "Program", + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "expression": { + "type": "ArrayExpression", + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "elements": [ + { + "type": "NumericLiteral", + "start":1,"end":8,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":8}}, + "extra": { + "rawValue": 17, + "raw": "0x_1_1_" + }, + "value": 17 + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-92/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-92/options.json deleted file mode 100644 index 477511a87822..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-92/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:3)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-92/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-92/output.json new file mode 100644 index 000000000000..238b8d7eb92f --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-92/output.json @@ -0,0 +1,35 @@ +{ + "type": "File", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:3)" + ], + "program": { + "type": "Program", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "expression": { + "type": "ArrayExpression", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "elements": [ + { + "type": "NumericLiteral", + "start":1,"end":7,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":7}}, + "extra": { + "rawValue": 9, + "raw": "0o_1_1" + }, + "value": 9 + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-93/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-93/options.json deleted file mode 100644 index 477511a87822..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-93/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:3)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-93/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-93/output.json new file mode 100644 index 000000000000..aca4cb9eaa84 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-93/output.json @@ -0,0 +1,35 @@ +{ + "type": "File", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:3)" + ], + "program": { + "type": "Program", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "expression": { + "type": "ArrayExpression", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "elements": [ + { + "type": "NumericLiteral", + "start":1,"end":6,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":6}}, + "extra": { + "rawValue": 9, + "raw": "0o_11" + }, + "value": 9 + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-94/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-94/options.json deleted file mode 100644 index 477511a87822..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-94/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:3)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-94/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-94/output.json new file mode 100644 index 000000000000..0f6ee969f91e --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-94/output.json @@ -0,0 +1,36 @@ +{ + "type": "File", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:3)", + "SyntaxError: A numeric separator is only allowed between two digits (1:8)" + ], + "program": { + "type": "Program", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "expression": { + "type": "ArrayExpression", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "elements": [ + { + "type": "NumericLiteral", + "start":1,"end":9,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":9}}, + "extra": { + "rawValue": 9, + "raw": "0o_01_1_" + }, + "value": 9 + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-95/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-95/options.json deleted file mode 100644 index 477511a87822..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-95/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:3)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-95/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-95/output.json new file mode 100644 index 000000000000..ebeef35878ea --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-95/output.json @@ -0,0 +1,35 @@ +{ + "type": "File", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:3)" + ], + "program": { + "type": "Program", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "expression": { + "type": "ArrayExpression", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "elements": [ + { + "type": "NumericLiteral", + "start":1,"end":9,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":9}}, + "extra": { + "rawValue": 3, + "raw": "0b_0_1_1" + }, + "value": 3 + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-96/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-96/options.json deleted file mode 100644 index 477511a87822..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-96/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:3)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-96/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-96/output.json new file mode 100644 index 000000000000..90ccb24c1270 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-96/output.json @@ -0,0 +1,36 @@ +{ + "type": "File", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:3)", + "SyntaxError: A numeric separator is only allowed between two digits (1:8)" + ], + "program": { + "type": "Program", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "expression": { + "type": "ArrayExpression", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "elements": [ + { + "type": "NumericLiteral", + "start":1,"end":9,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":9}}, + "extra": { + "rawValue": 3, + "raw": "0b_01_1_" + }, + "value": 3 + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-97/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-97/options.json deleted file mode 100644 index badcb4c1b655..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-97/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:7)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-97/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-97/output.json new file mode 100644 index 000000000000..d354fd52d7e1 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-97/output.json @@ -0,0 +1,35 @@ +{ + "type": "File", + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:7)" + ], + "program": { + "type": "Program", + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "expression": { + "type": "ArrayExpression", + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "elements": [ + { + "type": "NumericLiteral", + "start":1,"end":8,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":8}}, + "extra": { + "rawValue": 3, + "raw": "0b01_1_" + }, + "value": 3 + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-98/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-98/options.json deleted file mode 100644 index 9c49308645fd..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-98/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:6)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-98/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-98/output.json new file mode 100644 index 000000000000..fb6a3801249c --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-98/output.json @@ -0,0 +1,35 @@ +{ + "type": "File", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:6)" + ], + "program": { + "type": "Program", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "expression": { + "type": "ArrayExpression", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "elements": [ + { + "type": "NumericLiteral", + "start":1,"end":7,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":7}}, + "extra": { + "rawValue": 9, + "raw": "0o1_1_" + }, + "value": 9 + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-99/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-99/options.json deleted file mode 100644 index 477511a87822..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-99/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:3)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-99/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-99/output.json new file mode 100644 index 000000000000..a54bd3bbf50a --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-99/output.json @@ -0,0 +1,36 @@ +{ + "type": "File", + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:3)", + "SyntaxError: A numeric separator is only allowed between two digits (1:7)" + ], + "program": { + "type": "Program", + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "expression": { + "type": "ArrayExpression", + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "elements": [ + { + "type": "NumericLiteral", + "start":1,"end":8,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":8}}, + "extra": { + "rawValue": 9, + "raw": "0o_1_1_" + }, + "value": 9 + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-hex/input.js b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-hex/input.js new file mode 100644 index 000000000000..4027187fe79d --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-hex/input.js @@ -0,0 +1 @@ +"\x1_0"; diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-hex/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-hex/options.json new file mode 100644 index 000000000000..7832463eea97 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-hex/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["numericSeparator"] +} diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-hex/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-hex/output.json new file mode 100644 index 000000000000..e0ca2b4b003e --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-hex/output.json @@ -0,0 +1,29 @@ +{ + "type": "File", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "errors": [ + "SyntaxError: Numeric separators are not allowed inside unicode escape sequences or hex escape sequences (1:4)" + ], + "program": { + "type": "Program", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "sourceType": "script", + "interpreter": null, + "body": [], + "directives": [ + { + "type": "Directive", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "value": { + "type": "DirectiveLiteral", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "value": "\\x1_0", + "extra": { + "raw": "\"\\x1_0\"", + "rawValue": "\\x1_0" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-leading-zero/input.js b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-leading-zero/input.js new file mode 100644 index 000000000000..cf0bdcda2ea0 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-leading-zero/input.js @@ -0,0 +1 @@ +0_8 \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-leading-zero/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-leading-zero/options.json new file mode 100644 index 000000000000..7832463eea97 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-leading-zero/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["numericSeparator"] +} diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-leading-zero/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-leading-zero/output.json new file mode 100644 index 000000000000..1d2d8a1aa2ae --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-leading-zero/output.json @@ -0,0 +1,29 @@ +{ + "type": "File", + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, + "errors": [ + "SyntaxError: Numeric separator can not be used after leading 0 (1:1)" + ], + "program": { + "type": "Program", + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, + "expression": { + "type": "NumericLiteral", + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, + "extra": { + "rawValue": 8, + "raw": "0_8" + }, + "value": 8 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-legacy-octal-literal/input.js b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-legacy-octal-literal/input.js new file mode 100644 index 000000000000..909c1baacf29 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-legacy-octal-literal/input.js @@ -0,0 +1 @@ +00_0 \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-legacy-octal-literal/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-legacy-octal-literal/options.json new file mode 100644 index 000000000000..7832463eea97 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-legacy-octal-literal/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["numericSeparator"] +} diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-legacy-octal-literal/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-legacy-octal-literal/output.json new file mode 100644 index 000000000000..2571dfafd4f8 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-legacy-octal-literal/output.json @@ -0,0 +1,29 @@ +{ + "type": "File", + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, + "errors": [ + "SyntaxError: Numeric separator can not be used after leading 0 (1:2)" + ], + "program": { + "type": "Program", + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, + "expression": { + "type": "NumericLiteral", + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, + "extra": { + "rawValue": 0, + "raw": "00_0" + }, + "value": 0 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-non-octal-decimal-int/input.js b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-non-octal-decimal-int/input.js new file mode 100644 index 000000000000..50e4a5af8a70 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-non-octal-decimal-int/input.js @@ -0,0 +1 @@ +08_0n \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-non-octal-decimal-int/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-non-octal-decimal-int/options.json new file mode 100644 index 000000000000..7832463eea97 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-non-octal-decimal-int/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["numericSeparator"] +} diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-non-octal-decimal-int/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-non-octal-decimal-int/output.json new file mode 100644 index 000000000000..1c28d1ead346 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-non-octal-decimal-int/output.json @@ -0,0 +1,30 @@ +{ + "type": "File", + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, + "errors": [ + "SyntaxError: Numeric separator can not be used after leading 0 (1:2)", + "SyntaxError: Invalid BigIntLiteral (1:0)" + ], + "program": { + "type": "Program", + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, + "expression": { + "type": "BigIntLiteral", + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, + "extra": { + "rawValue": "080", + "raw": "08_0n" + }, + "value": "080" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-unicode-2/input.js b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-unicode-2/input.js new file mode 100644 index 000000000000..7d45889c6dec --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-unicode-2/input.js @@ -0,0 +1 @@ +"\u12_34" diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-unicode-2/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-unicode-2/options.json new file mode 100644 index 000000000000..7832463eea97 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-unicode-2/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["numericSeparator"] +} diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-unicode-2/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-unicode-2/output.json new file mode 100644 index 000000000000..8dbcd31afd33 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-unicode-2/output.json @@ -0,0 +1,29 @@ +{ + "type": "File", + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "errors": [ + "SyntaxError: Numeric separators are not allowed inside unicode escape sequences or hex escape sequences (1:5)" + ], + "program": { + "type": "Program", + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "sourceType": "script", + "interpreter": null, + "body": [], + "directives": [ + { + "type": "Directive", + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "value": { + "type": "DirectiveLiteral", + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "value": "\\u12_34", + "extra": { + "raw": "\"\\u12_34\"", + "rawValue": "\\u12_34" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-unicode/input.js b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-unicode/input.js new file mode 100644 index 000000000000..e670fc0c3264 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-unicode/input.js @@ -0,0 +1 @@ +"\u{1F_639}" diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-unicode/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-unicode/options.json new file mode 100644 index 000000000000..7832463eea97 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-unicode/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["numericSeparator"] +} diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-unicode/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-unicode/output.json new file mode 100644 index 000000000000..f7497689fd8d --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-unicode/output.json @@ -0,0 +1,29 @@ +{ + "type": "File", + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "errors": [ + "SyntaxError: Numeric separators are not allowed inside unicode escape sequences or hex escape sequences (1:6)" + ], + "program": { + "type": "Program", + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "sourceType": "script", + "interpreter": null, + "body": [], + "directives": [ + { + "type": "Directive", + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "value": { + "type": "DirectiveLiteral", + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "value": "\\u{1F_639}", + "extra": { + "raw": "\"\\u{1F_639}\"", + "rawValue": "\\u{1F_639}" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/valid-0/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/valid-0/output.json index f07811a91f63..06face3b6e24 100644 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/valid-0/output.json +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/valid-0/output.json @@ -1,62 +1,18 @@ { "type": "File", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, "program": { "type": "Program", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, "expression": { "type": "NumericLiteral", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, "extra": { "rawValue": 11, "raw": "1_1" diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/valid-1/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/valid-1/output.json index 8ef9043d9f1a..9c8faafda734 100644 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/valid-1/output.json +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/valid-1/output.json @@ -1,62 +1,18 @@ { "type": "File", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "program": { "type": "Program", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "expression": { "type": "NumericLiteral", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "extra": { "rawValue": 11.11, "raw": "1_1.1_1" diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/valid-10/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/valid-10/output.json index 3bfad936fc0d..2a1e30bb67b7 100644 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/valid-10/output.json +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/valid-10/output.json @@ -1,62 +1,18 @@ { "type": "File", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "program": { "type": "Program", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "expression": { "type": "NumericLiteral", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "extra": { "rawValue": 171, "raw": "0xA_b" diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/valid-11/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/valid-11/output.json index 27f38c578949..417231fb2118 100644 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/valid-11/output.json +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/valid-11/output.json @@ -1,62 +1,18 @@ { "type": "File", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "program": { "type": "Program", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "expression": { "type": "NumericLiteral", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "extra": { "rawValue": 448585456, "raw": "0x1_a_b_c_d_e_f_0" diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/valid-12/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/valid-12/output.json index f5d9d8f4e7d6..6ff730338e66 100644 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/valid-12/output.json +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/valid-12/output.json @@ -1,62 +1,18 @@ { "type": "File", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "program": { "type": "Program", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "expression": { "type": "NumericLiteral", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "extra": { "rawValue": 3, "raw": "0b01_1" diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/valid-13/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/valid-13/output.json index 1e6a1e5b7b87..216ca5341546 100644 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/valid-13/output.json +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/valid-13/output.json @@ -1,62 +1,18 @@ { "type": "File", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "program": { "type": "Program", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "expression": { "type": "NumericLiteral", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "extra": { "rawValue": 3, "raw": "0b0_1_1" diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/valid-14/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/valid-14/output.json index 0562a2e1b529..ae851071991e 100644 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/valid-14/output.json +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/valid-14/output.json @@ -1,62 +1,18 @@ { "type": "File", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "program": { "type": "Program", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "expression": { "type": "NumericLiteral", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "extra": { "rawValue": 9, "raw": "0o1_1" diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/valid-15/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/valid-15/output.json index 70fa1ecfe7b7..ca8a87f25dce 100644 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/valid-15/output.json +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/valid-15/output.json @@ -1,62 +1,18 @@ { "type": "File", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "program": { "type": "Program", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "expression": { "type": "NumericLiteral", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "extra": { "rawValue": 9, "raw": "0o0_11" diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/valid-2/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/valid-2/output.json index cb89d2e8671f..44c0e7ee2c34 100644 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/valid-2/output.json +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/valid-2/output.json @@ -1,62 +1,18 @@ { "type": "File", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "program": { "type": "Program", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "expression": { "type": "NumericLiteral", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "extra": { "rawValue": 11.01, "raw": "1.1_0_1e1" diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/valid-3/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/valid-3/output.json index 8e6356f7c10e..4e04af8dc422 100644 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/valid-3/output.json +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/valid-3/output.json @@ -1,62 +1,18 @@ { "type": "File", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "program": { "type": "Program", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "expression": { "type": "NumericLiteral", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "extra": { "rawValue": 11.01, "raw": "1.1_0_1E1" diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/valid-4/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/valid-4/output.json index 12a2e33585da..5e0c2d44d98b 100644 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/valid-4/output.json +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/valid-4/output.json @@ -1,62 +1,18 @@ { "type": "File", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - }, + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, "program": { "type": "Program", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - }, + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - }, + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, "expression": { "type": "NumericLiteral", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - }, + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, "extra": { "rawValue": 0.11, "raw": ".1_1" diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/valid-5/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/valid-5/output.json index 62e3ad2e4f23..81326d22f8b2 100644 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/valid-5/output.json +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/valid-5/output.json @@ -1,62 +1,18 @@ { "type": "File", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "program": { "type": "Program", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "expression": { "type": "NumericLiteral", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "extra": { "rawValue": 17, "raw": "0x1_1" diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/valid-6/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/valid-6/output.json index 5f3bb0f0c9f3..38a640ca3a6a 100644 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/valid-6/output.json +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/valid-6/output.json @@ -1,62 +1,18 @@ { "type": "File", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "program": { "type": "Program", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "expression": { "type": "NumericLiteral", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "extra": { "rawValue": 161, "raw": "0xa_1" diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/valid-7/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/valid-7/output.json index b9e808d49031..bf1fbf975e54 100644 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/valid-7/output.json +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/valid-7/output.json @@ -1,62 +1,18 @@ { "type": "File", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "program": { "type": "Program", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "expression": { "type": "NumericLiteral", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "extra": { "rawValue": 161, "raw": "0xA_1" diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/valid-8/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/valid-8/output.json index f060c82f7e0e..ae611586fb8d 100644 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/valid-8/output.json +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/valid-8/output.json @@ -1,62 +1,18 @@ { "type": "File", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "program": { "type": "Program", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "expression": { "type": "NumericLiteral", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "extra": { "rawValue": 417, "raw": "0x1_a_1" diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/valid-9/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/valid-9/output.json index c4a785b2ee85..a01b262a87a3 100644 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/valid-9/output.json +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/valid-9/output.json @@ -1,62 +1,18 @@ { "type": "File", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "program": { "type": "Program", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "expression": { "type": "NumericLiteral", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "extra": { "rawValue": 170, "raw": "0xA_a" diff --git a/packages/babel-parser/test/fixtures/experimental/optional-chaining/class-contructor-call/options.json b/packages/babel-parser/test/fixtures/experimental/optional-chaining/class-contructor-call/options.json deleted file mode 100644 index ed5e3c16bf68..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/optional-chaining/class-contructor-call/options.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "plugins": ["optionalChaining"], - "throws": "constructors in/after an Optional Chain are not allowed (1:10)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/optional-chaining/conditional-decimal/options.json b/packages/babel-parser/test/fixtures/experimental/optional-chaining/conditional-decimal/options.json deleted file mode 100644 index fd201c1bdb02..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/optional-chaining/conditional-decimal/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "plugins": ["optionalChaining"] -} diff --git a/packages/babel-parser/test/fixtures/experimental/optional-chaining/conditional-decimal/output.json b/packages/babel-parser/test/fixtures/experimental/optional-chaining/conditional-decimal/output.json deleted file mode 100644 index 537a8c44f703..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/optional-chaining/conditional-decimal/output.json +++ /dev/null @@ -1,207 +0,0 @@ -{ - "type": "File", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 13 - } - }, - "program": { - "type": "Program", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 13 - } - }, - "sourceType": "script", - "interpreter": null, - "body": [ - { - "type": "ExpressionStatement", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "expression": { - "type": "ConditionalExpression", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "test": { - "type": "BooleanLiteral", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - }, - "value": true - }, - "consequent": { - "type": "NumericLiteral", - "start": 5, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "extra": { - "rawValue": 0.3, - "raw": ".3" - }, - "value": 0.3 - }, - "alternate": { - "type": "NumericLiteral", - "start": 8, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "extra": { - "rawValue": 0, - "raw": "0" - }, - "value": 0 - } - } - }, - { - "type": "ExpressionStatement", - "start": 11, - "end": 24, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 13 - } - }, - "expression": { - "type": "ConditionalExpression", - "start": 11, - "end": 24, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 13 - } - }, - "test": { - "type": "BooleanLiteral", - "start": 11, - "end": 15, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 4 - } - }, - "value": true - }, - "consequent": { - "type": "NumericLiteral", - "start": 18, - "end": 20, - "loc": { - "start": { - "line": 3, - "column": 7 - }, - "end": { - "line": 3, - "column": 9 - } - }, - "extra": { - "rawValue": 0.3, - "raw": ".3" - }, - "value": 0.3 - }, - "alternate": { - "type": "NumericLiteral", - "start": 23, - "end": 24, - "loc": { - "start": { - "line": 3, - "column": 12 - }, - "end": { - "line": 3, - "column": 13 - } - }, - "extra": { - "rawValue": 0, - "raw": "0" - }, - "value": 0 - } - } - } - ], - "directives": [] - } -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/optional-chaining/function-call/options.json b/packages/babel-parser/test/fixtures/experimental/optional-chaining/function-call/options.json deleted file mode 100644 index fd201c1bdb02..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/optional-chaining/function-call/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "plugins": ["optionalChaining"] -} diff --git a/packages/babel-parser/test/fixtures/experimental/optional-chaining/function-call/output.json b/packages/babel-parser/test/fixtures/experimental/optional-chaining/function-call/output.json deleted file mode 100644 index 0d52f30d9af9..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/optional-chaining/function-call/output.json +++ /dev/null @@ -1,451 +0,0 @@ -{ - "type": "File", - "start": 0, - "end": 64, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 9, - "column": 10 - } - }, - "program": { - "type": "Program", - "start": 0, - "end": 64, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 9, - "column": 10 - } - }, - "sourceType": "script", - "interpreter": null, - "body": [ - { - "type": "ExpressionStatement", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "expression": { - "type": "OptionalCallExpression", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "callee": { - "type": "Identifier", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - }, - "identifierName": "func" - }, - "name": "func" - }, - "arguments": [], - "optional": true - } - }, - { - "type": "ExpressionStatement", - "start": 10, - "end": 22, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 12 - } - }, - "expression": { - "type": "OptionalCallExpression", - "start": 10, - "end": 22, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 12 - } - }, - "callee": { - "type": "Identifier", - "start": 10, - "end": 14, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 4 - }, - "identifierName": "func" - }, - "name": "func" - }, - "arguments": [ - { - "type": "Identifier", - "start": 17, - "end": 18, - "loc": { - "start": { - "line": 3, - "column": 7 - }, - "end": { - "line": 3, - "column": 8 - }, - "identifierName": "a" - }, - "name": "a" - }, - { - "type": "Identifier", - "start": 20, - "end": 21, - "loc": { - "start": { - "line": 3, - "column": 10 - }, - "end": { - "line": 3, - "column": 11 - }, - "identifierName": "b" - }, - "name": "b" - } - ], - "optional": true - } - }, - { - "type": "ExpressionStatement", - "start": 24, - "end": 35, - "loc": { - "start": { - "line": 5, - "column": 0 - }, - "end": { - "line": 5, - "column": 11 - } - }, - "expression": { - "type": "OptionalCallExpression", - "start": 24, - "end": 35, - "loc": { - "start": { - "line": 5, - "column": 0 - }, - "end": { - "line": 5, - "column": 11 - } - }, - "callee": { - "type": "OptionalMemberExpression", - "start": 24, - "end": 31, - "loc": { - "start": { - "line": 5, - "column": 0 - }, - "end": { - "line": 5, - "column": 7 - } - }, - "object": { - "type": "Identifier", - "start": 24, - "end": 25, - "loc": { - "start": { - "line": 5, - "column": 0 - }, - "end": { - "line": 5, - "column": 1 - }, - "identifierName": "a" - }, - "name": "a" - }, - "property": { - "type": "Identifier", - "start": 27, - "end": 31, - "loc": { - "start": { - "line": 5, - "column": 3 - }, - "end": { - "line": 5, - "column": 7 - }, - "identifierName": "func" - }, - "name": "func" - }, - "computed": false, - "optional": true - }, - "arguments": [], - "optional": true - } - }, - { - "type": "ExpressionStatement", - "start": 37, - "end": 52, - "loc": { - "start": { - "line": 7, - "column": 0 - }, - "end": { - "line": 7, - "column": 15 - } - }, - "expression": { - "type": "OptionalCallExpression", - "start": 37, - "end": 52, - "loc": { - "start": { - "line": 7, - "column": 0 - }, - "end": { - "line": 7, - "column": 15 - } - }, - "callee": { - "type": "OptionalMemberExpression", - "start": 37, - "end": 44, - "loc": { - "start": { - "line": 7, - "column": 0 - }, - "end": { - "line": 7, - "column": 7 - } - }, - "object": { - "type": "Identifier", - "start": 37, - "end": 38, - "loc": { - "start": { - "line": 7, - "column": 0 - }, - "end": { - "line": 7, - "column": 1 - }, - "identifierName": "a" - }, - "name": "a" - }, - "property": { - "type": "Identifier", - "start": 40, - "end": 44, - "loc": { - "start": { - "line": 7, - "column": 3 - }, - "end": { - "line": 7, - "column": 7 - }, - "identifierName": "func" - }, - "name": "func" - }, - "computed": false, - "optional": true - }, - "arguments": [ - { - "type": "Identifier", - "start": 47, - "end": 48, - "loc": { - "start": { - "line": 7, - "column": 10 - }, - "end": { - "line": 7, - "column": 11 - }, - "identifierName": "a" - }, - "name": "a" - }, - { - "type": "Identifier", - "start": 50, - "end": 51, - "loc": { - "start": { - "line": 7, - "column": 13 - }, - "end": { - "line": 7, - "column": 14 - }, - "identifierName": "b" - }, - "name": "b" - } - ], - "optional": true - } - }, - { - "type": "ExpressionStatement", - "start": 54, - "end": 64, - "loc": { - "start": { - "line": 9, - "column": 0 - }, - "end": { - "line": 9, - "column": 10 - } - }, - "expression": { - "type": "OptionalCallExpression", - "start": 54, - "end": 64, - "loc": { - "start": { - "line": 9, - "column": 0 - }, - "end": { - "line": 9, - "column": 10 - } - }, - "callee": { - "type": "MemberExpression", - "start": 54, - "end": 60, - "loc": { - "start": { - "line": 9, - "column": 0 - }, - "end": { - "line": 9, - "column": 6 - } - }, - "object": { - "type": "Identifier", - "start": 54, - "end": 55, - "loc": { - "start": { - "line": 9, - "column": 0 - }, - "end": { - "line": 9, - "column": 1 - }, - "identifierName": "a" - }, - "name": "a" - }, - "property": { - "type": "Identifier", - "start": 56, - "end": 60, - "loc": { - "start": { - "line": 9, - "column": 2 - }, - "end": { - "line": 9, - "column": 6 - }, - "identifierName": "func" - }, - "name": "func" - }, - "computed": false - }, - "arguments": [], - "optional": true - } - } - ], - "directives": [] - } -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/optional-chaining/member-access-bracket/options.json b/packages/babel-parser/test/fixtures/experimental/optional-chaining/member-access-bracket/options.json deleted file mode 100644 index fd201c1bdb02..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/optional-chaining/member-access-bracket/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "plugins": ["optionalChaining"] -} diff --git a/packages/babel-parser/test/fixtures/experimental/optional-chaining/member-access-bracket/output.json b/packages/babel-parser/test/fixtures/experimental/optional-chaining/member-access-bracket/output.json deleted file mode 100644 index b93dd4b235de..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/optional-chaining/member-access-bracket/output.json +++ /dev/null @@ -1,561 +0,0 @@ -{ - "type": "File", - "start": 0, - "end": 97, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 11, - "column": 13 - } - }, - "program": { - "type": "Program", - "start": 0, - "end": 97, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 11, - "column": 13 - } - }, - "sourceType": "script", - "interpreter": null, - "body": [ - { - "type": "ExpressionStatement", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "expression": { - "type": "OptionalMemberExpression", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "object": { - "type": "Identifier", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - }, - "identifierName": "obj" - }, - "name": "obj" - }, - "property": { - "type": "Identifier", - "start": 6, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 10 - }, - "identifierName": "expr" - }, - "name": "expr" - }, - "computed": true, - "optional": true - } - }, - { - "type": "ExpressionStatement", - "start": 13, - "end": 33, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 20 - } - }, - "expression": { - "type": "OptionalMemberExpression", - "start": 13, - "end": 33, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 20 - } - }, - "object": { - "type": "OptionalMemberExpression", - "start": 13, - "end": 24, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 11 - } - }, - "object": { - "type": "Identifier", - "start": 13, - "end": 16, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 3 - }, - "identifierName": "obj" - }, - "name": "obj" - }, - "property": { - "type": "Identifier", - "start": 19, - "end": 23, - "loc": { - "start": { - "line": 3, - "column": 6 - }, - "end": { - "line": 3, - "column": 10 - }, - "identifierName": "expr" - }, - "name": "expr" - }, - "computed": true, - "optional": true - }, - "property": { - "type": "Identifier", - "start": 27, - "end": 32, - "loc": { - "start": { - "line": 3, - "column": 14 - }, - "end": { - "line": 3, - "column": 19 - }, - "identifierName": "other" - }, - "name": "other" - }, - "computed": true, - "optional": true - } - }, - { - "type": "ExpressionStatement", - "start": 35, - "end": 46, - "loc": { - "start": { - "line": 5, - "column": 0 - }, - "end": { - "line": 5, - "column": 11 - } - }, - "expression": { - "type": "OptionalMemberExpression", - "start": 35, - "end": 46, - "loc": { - "start": { - "line": 5, - "column": 0 - }, - "end": { - "line": 5, - "column": 11 - } - }, - "object": { - "type": "Identifier", - "start": 35, - "end": 38, - "loc": { - "start": { - "line": 5, - "column": 0 - }, - "end": { - "line": 5, - "column": 3 - }, - "identifierName": "obj" - }, - "name": "obj" - }, - "property": { - "type": "BooleanLiteral", - "start": 41, - "end": 45, - "loc": { - "start": { - "line": 5, - "column": 6 - }, - "end": { - "line": 5, - "column": 10 - } - }, - "value": true - }, - "computed": true, - "optional": true - } - }, - { - "type": "ExpressionStatement", - "start": 48, - "end": 67, - "loc": { - "start": { - "line": 7, - "column": 0 - }, - "end": { - "line": 7, - "column": 19 - } - }, - "expression": { - "type": "OptionalMemberExpression", - "start": 48, - "end": 67, - "loc": { - "start": { - "line": 7, - "column": 0 - }, - "end": { - "line": 7, - "column": 19 - } - }, - "object": { - "type": "OptionalMemberExpression", - "start": 48, - "end": 59, - "loc": { - "start": { - "line": 7, - "column": 0 - }, - "end": { - "line": 7, - "column": 11 - } - }, - "object": { - "type": "Identifier", - "start": 48, - "end": 51, - "loc": { - "start": { - "line": 7, - "column": 0 - }, - "end": { - "line": 7, - "column": 3 - }, - "identifierName": "obj" - }, - "name": "obj" - }, - "property": { - "type": "BooleanLiteral", - "start": 54, - "end": 58, - "loc": { - "start": { - "line": 7, - "column": 6 - }, - "end": { - "line": 7, - "column": 10 - } - }, - "value": true - }, - "computed": true, - "optional": true - }, - "property": { - "type": "BooleanLiteral", - "start": 62, - "end": 66, - "loc": { - "start": { - "line": 7, - "column": 14 - }, - "end": { - "line": 7, - "column": 18 - } - }, - "value": true - }, - "computed": true, - "optional": true - } - }, - { - "type": "ExpressionStatement", - "start": 69, - "end": 82, - "loc": { - "start": { - "line": 9, - "column": 0 - }, - "end": { - "line": 9, - "column": 13 - } - }, - "expression": { - "type": "OptionalMemberExpression", - "start": 69, - "end": 82, - "loc": { - "start": { - "line": 9, - "column": 0 - }, - "end": { - "line": 9, - "column": 13 - } - }, - "object": { - "type": "MemberExpression", - "start": 69, - "end": 74, - "loc": { - "start": { - "line": 9, - "column": 0 - }, - "end": { - "line": 9, - "column": 5 - } - }, - "object": { - "type": "Identifier", - "start": 69, - "end": 72, - "loc": { - "start": { - "line": 9, - "column": 0 - }, - "end": { - "line": 9, - "column": 3 - }, - "identifierName": "obj" - }, - "name": "obj" - }, - "property": { - "type": "Identifier", - "start": 73, - "end": 74, - "loc": { - "start": { - "line": 9, - "column": 4 - }, - "end": { - "line": 9, - "column": 5 - }, - "identifierName": "a" - }, - "name": "a" - }, - "computed": false - }, - "property": { - "type": "Identifier", - "start": 77, - "end": 81, - "loc": { - "start": { - "line": 9, - "column": 8 - }, - "end": { - "line": 9, - "column": 12 - }, - "identifierName": "expr" - }, - "name": "expr" - }, - "computed": true, - "optional": true - } - }, - { - "type": "ExpressionStatement", - "start": 84, - "end": 97, - "loc": { - "start": { - "line": 11, - "column": 0 - }, - "end": { - "line": 11, - "column": 13 - } - }, - "expression": { - "type": "OptionalMemberExpression", - "start": 84, - "end": 97, - "loc": { - "start": { - "line": 11, - "column": 0 - }, - "end": { - "line": 11, - "column": 13 - } - }, - "object": { - "type": "MemberExpression", - "start": 84, - "end": 89, - "loc": { - "start": { - "line": 11, - "column": 0 - }, - "end": { - "line": 11, - "column": 5 - } - }, - "object": { - "type": "Identifier", - "start": 84, - "end": 87, - "loc": { - "start": { - "line": 11, - "column": 0 - }, - "end": { - "line": 11, - "column": 3 - }, - "identifierName": "obj" - }, - "name": "obj" - }, - "property": { - "type": "Identifier", - "start": 88, - "end": 89, - "loc": { - "start": { - "line": 11, - "column": 4 - }, - "end": { - "line": 11, - "column": 5 - }, - "identifierName": "a" - }, - "name": "a" - }, - "computed": false - }, - "property": { - "type": "BooleanLiteral", - "start": 92, - "end": 96, - "loc": { - "start": { - "line": 11, - "column": 8 - }, - "end": { - "line": 11, - "column": 12 - } - }, - "value": true - }, - "computed": true, - "optional": true - } - } - ], - "directives": [] - } -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/optional-chaining/member-access/options.json b/packages/babel-parser/test/fixtures/experimental/optional-chaining/member-access/options.json deleted file mode 100644 index fd201c1bdb02..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/optional-chaining/member-access/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "plugins": ["optionalChaining"] -} diff --git a/packages/babel-parser/test/fixtures/experimental/optional-chaining/member-access/output.json b/packages/babel-parser/test/fixtures/experimental/optional-chaining/member-access/output.json deleted file mode 100644 index 9232427dda06..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/optional-chaining/member-access/output.json +++ /dev/null @@ -1,300 +0,0 @@ -{ - "type": "File", - "start": 0, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 12 - } - }, - "program": { - "type": "Program", - "start": 0, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 12 - } - }, - "sourceType": "script", - "interpreter": null, - "body": [ - { - "type": "ExpressionStatement", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "expression": { - "type": "OptionalMemberExpression", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "object": { - "type": "Identifier", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - }, - "identifierName": "foo" - }, - "name": "foo" - }, - "property": { - "type": "Identifier", - "start": 5, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 8 - }, - "identifierName": "bar" - }, - "name": "bar" - }, - "computed": false, - "optional": true - } - }, - { - "type": "ExpressionStatement", - "start": 10, - "end": 23, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 13 - } - }, - "expression": { - "type": "OptionalMemberExpression", - "start": 10, - "end": 23, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 13 - } - }, - "object": { - "type": "OptionalMemberExpression", - "start": 10, - "end": 18, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 8 - } - }, - "object": { - "type": "Identifier", - "start": 10, - "end": 13, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 3 - }, - "identifierName": "foo" - }, - "name": "foo" - }, - "property": { - "type": "Identifier", - "start": 15, - "end": 18, - "loc": { - "start": { - "line": 3, - "column": 5 - }, - "end": { - "line": 3, - "column": 8 - }, - "identifierName": "bar" - }, - "name": "bar" - }, - "computed": false, - "optional": true - }, - "property": { - "type": "Identifier", - "start": 20, - "end": 23, - "loc": { - "start": { - "line": 3, - "column": 10 - }, - "end": { - "line": 3, - "column": 13 - }, - "identifierName": "baz" - }, - "name": "baz" - }, - "computed": false, - "optional": true - } - }, - { - "type": "ExpressionStatement", - "start": 25, - "end": 37, - "loc": { - "start": { - "line": 5, - "column": 0 - }, - "end": { - "line": 5, - "column": 12 - } - }, - "expression": { - "type": "OptionalMemberExpression", - "start": 25, - "end": 37, - "loc": { - "start": { - "line": 5, - "column": 0 - }, - "end": { - "line": 5, - "column": 12 - } - }, - "object": { - "type": "MemberExpression", - "start": 25, - "end": 32, - "loc": { - "start": { - "line": 5, - "column": 0 - }, - "end": { - "line": 5, - "column": 7 - } - }, - "object": { - "type": "Identifier", - "start": 25, - "end": 28, - "loc": { - "start": { - "line": 5, - "column": 0 - }, - "end": { - "line": 5, - "column": 3 - }, - "identifierName": "foo" - }, - "name": "foo" - }, - "property": { - "type": "Identifier", - "start": 29, - "end": 32, - "loc": { - "start": { - "line": 5, - "column": 4 - }, - "end": { - "line": 5, - "column": 7 - }, - "identifierName": "bar" - }, - "name": "bar" - }, - "computed": false - }, - "property": { - "type": "Identifier", - "start": 34, - "end": 37, - "loc": { - "start": { - "line": 5, - "column": 9 - }, - "end": { - "line": 5, - "column": 12 - }, - "identifierName": "baz" - }, - "name": "baz" - }, - "computed": false, - "optional": true - } - } - ], - "directives": [] - } -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/optional-chaining/optioanl-chain-expression/options.json b/packages/babel-parser/test/fixtures/experimental/optional-chaining/optioanl-chain-expression/options.json deleted file mode 100644 index fd201c1bdb02..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/optional-chaining/optioanl-chain-expression/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "plugins": ["optionalChaining"] -} diff --git a/packages/babel-parser/test/fixtures/experimental/optional-chaining/optioanl-chain-expression/output.json b/packages/babel-parser/test/fixtures/experimental/optional-chaining/optioanl-chain-expression/output.json deleted file mode 100644 index 15435af4c4fb..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/optional-chaining/optioanl-chain-expression/output.json +++ /dev/null @@ -1,150 +0,0 @@ -{ - "type": "File", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "program": { - "type": "Program", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "sourceType": "script", - "interpreter": null, - "body": [ - { - "type": "ExpressionStatement", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "expression": { - "type": "OptionalCallExpression", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "callee": { - "type": "OptionalMemberExpression", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "object": { - "type": "MemberExpression", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, - "object": { - "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "a" - }, - "name": "a" - }, - "property": { - "type": "Identifier", - "start": 2, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 3 - }, - "identifierName": "b" - }, - "name": "b" - }, - "computed": false - }, - "property": { - "type": "Identifier", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "c" - }, - "name": "c" - }, - "computed": false, - "optional": true - }, - "arguments": [] - } - } - ], - "directives": [] - } -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/optional-chaining/optional-constructor/options.json b/packages/babel-parser/test/fixtures/experimental/optional-chaining/optional-constructor/options.json deleted file mode 100644 index 10cef4d48073..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/optional-chaining/optional-constructor/options.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "plugins": ["optionalChaining"], - "throws": "constructors in/after an Optional Chain are not allowed (1:7)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/optional-chaining/optional-super-property-class/options.json b/packages/babel-parser/test/fixtures/experimental/optional-chaining/optional-super-property-class/options.json deleted file mode 100644 index 86849e8c464a..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/optional-chaining/optional-super-property-class/options.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "plugins": ["optionalChaining"], - "throws": "Unexpected token (3:20)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/optional-chaining/optional-super-property/options.json b/packages/babel-parser/test/fixtures/experimental/optional-chaining/optional-super-property/options.json deleted file mode 100644 index 86849e8c464a..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/optional-chaining/optional-super-property/options.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "plugins": ["optionalChaining"], - "throws": "Unexpected token (3:20)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/optional-chaining/optional-tagged-template-literals/options.json b/packages/babel-parser/test/fixtures/experimental/optional-chaining/optional-tagged-template-literals/options.json deleted file mode 100644 index 631741b044e0..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/optional-chaining/optional-tagged-template-literals/options.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "plugins": ["optionalChaining"], - "throws": "Tagged Template Literals are not allowed in optionalChain (1:0)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/optional-chaining/parenthised-chain/options.json b/packages/babel-parser/test/fixtures/experimental/optional-chaining/parenthised-chain/options.json deleted file mode 100644 index fd201c1bdb02..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/optional-chaining/parenthised-chain/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "plugins": ["optionalChaining"] -} diff --git a/packages/babel-parser/test/fixtures/experimental/optional-chaining/parenthised-chain/output.json b/packages/babel-parser/test/fixtures/experimental/optional-chaining/parenthised-chain/output.json deleted file mode 100644 index 3c50e58ebc19..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/optional-chaining/parenthised-chain/output.json +++ /dev/null @@ -1,429 +0,0 @@ -{ - "type": "File", - "start": 0, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 15 - } - }, - "program": { - "type": "Program", - "start": 0, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 15 - } - }, - "sourceType": "script", - "interpreter": null, - "body": [ - { - "type": "ExpressionStatement", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "expression": { - "type": "MemberExpression", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "object": { - "type": "OptionalMemberExpression", - "start": 1, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "object": { - "type": "Identifier", - "start": 1, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - }, - "identifierName": "a" - }, - "name": "a" - }, - "property": { - "type": "Identifier", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "b" - }, - "name": "b" - }, - "computed": false, - "optional": true, - "extra": { - "parenthesized": true, - "parenStart": 0 - } - }, - "property": { - "type": "Identifier", - "start": 7, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - }, - "identifierName": "c" - }, - "name": "c" - }, - "computed": false - } - }, - { - "type": "ExpressionStatement", - "start": 11, - "end": 22, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 11 - } - }, - "expression": { - "type": "CallExpression", - "start": 11, - "end": 21, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 10 - } - }, - "callee": { - "type": "MemberExpression", - "start": 11, - "end": 19, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 8 - } - }, - "object": { - "type": "OptionalMemberExpression", - "start": 12, - "end": 16, - "loc": { - "start": { - "line": 3, - "column": 1 - }, - "end": { - "line": 3, - "column": 5 - } - }, - "object": { - "type": "Identifier", - "start": 12, - "end": 13, - "loc": { - "start": { - "line": 3, - "column": 1 - }, - "end": { - "line": 3, - "column": 2 - }, - "identifierName": "a" - }, - "name": "a" - }, - "property": { - "type": "Identifier", - "start": 15, - "end": 16, - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 5 - }, - "identifierName": "b" - }, - "name": "b" - }, - "computed": false, - "optional": true, - "extra": { - "parenthesized": true, - "parenStart": 11 - } - }, - "property": { - "type": "Identifier", - "start": 18, - "end": 19, - "loc": { - "start": { - "line": 3, - "column": 7 - }, - "end": { - "line": 3, - "column": 8 - }, - "identifierName": "c" - }, - "name": "c" - }, - "computed": false - }, - "arguments": [] - } - }, - { - "type": "ExpressionStatement", - "start": 24, - "end": 39, - "loc": { - "start": { - "line": 5, - "column": 0 - }, - "end": { - "line": 5, - "column": 15 - } - }, - "expression": { - "type": "OptionalMemberExpression", - "start": 24, - "end": 38, - "loc": { - "start": { - "line": 5, - "column": 0 - }, - "end": { - "line": 5, - "column": 14 - } - }, - "object": { - "type": "OptionalMemberExpression", - "start": 24, - "end": 35, - "loc": { - "start": { - "line": 5, - "column": 0 - }, - "end": { - "line": 5, - "column": 11 - } - }, - "object": { - "type": "OptionalMemberExpression", - "start": 24, - "end": 33, - "loc": { - "start": { - "line": 5, - "column": 0 - }, - "end": { - "line": 5, - "column": 9 - } - }, - "object": { - "type": "OptionalMemberExpression", - "start": 25, - "end": 29, - "loc": { - "start": { - "line": 5, - "column": 1 - }, - "end": { - "line": 5, - "column": 5 - } - }, - "object": { - "type": "Identifier", - "start": 25, - "end": 26, - "loc": { - "start": { - "line": 5, - "column": 1 - }, - "end": { - "line": 5, - "column": 2 - }, - "identifierName": "a" - }, - "name": "a" - }, - "property": { - "type": "Identifier", - "start": 28, - "end": 29, - "loc": { - "start": { - "line": 5, - "column": 4 - }, - "end": { - "line": 5, - "column": 5 - }, - "identifierName": "b" - }, - "name": "b" - }, - "computed": false, - "optional": true, - "extra": { - "parenthesized": true, - "parenStart": 24 - } - }, - "property": { - "type": "Identifier", - "start": 32, - "end": 33, - "loc": { - "start": { - "line": 5, - "column": 8 - }, - "end": { - "line": 5, - "column": 9 - }, - "identifierName": "c" - }, - "name": "c" - }, - "computed": false, - "optional": true - }, - "property": { - "type": "Identifier", - "start": 34, - "end": 35, - "loc": { - "start": { - "line": 5, - "column": 10 - }, - "end": { - "line": 5, - "column": 11 - }, - "identifierName": "d" - }, - "name": "d" - }, - "computed": false, - "optional": false - }, - "property": { - "type": "Identifier", - "start": 37, - "end": 38, - "loc": { - "start": { - "line": 5, - "column": 13 - }, - "end": { - "line": 5, - "column": 14 - }, - "identifierName": "e" - }, - "name": "e" - }, - "computed": false, - "optional": true - } - } - ], - "directives": [] - } -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/optional-chaining/separated-chaining/options.json b/packages/babel-parser/test/fixtures/experimental/optional-chaining/separated-chaining/options.json deleted file mode 100644 index fd201c1bdb02..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/optional-chaining/separated-chaining/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "plugins": ["optionalChaining"] -} diff --git a/packages/babel-parser/test/fixtures/experimental/optional-chaining/separated-chaining/output.json b/packages/babel-parser/test/fixtures/experimental/optional-chaining/separated-chaining/output.json deleted file mode 100644 index b3c6c779d389..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/optional-chaining/separated-chaining/output.json +++ /dev/null @@ -1,437 +0,0 @@ -{ - "type": "File", - "start": 0, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 12 - } - }, - "program": { - "type": "Program", - "start": 0, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 12 - } - }, - "sourceType": "script", - "interpreter": null, - "body": [ - { - "type": "ExpressionStatement", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "expression": { - "type": "OptionalMemberExpression", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "object": { - "type": "OptionalMemberExpression", - "start": 0, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "object": { - "type": "OptionalMemberExpression", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "object": { - "type": "OptionalMemberExpression", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "object": { - "type": "OptionalMemberExpression", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - }, - "object": { - "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "a" - }, - "name": "a" - }, - "property": { - "type": "Identifier", - "start": 3, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 4 - }, - "identifierName": "b" - }, - "name": "b" - }, - "computed": false, - "optional": true - }, - "property": { - "type": "Identifier", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "c" - }, - "name": "c" - }, - "computed": false, - "optional": false - }, - "property": { - "type": "Identifier", - "start": 7, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - }, - "identifierName": "d" - }, - "name": "d" - }, - "computed": false, - "optional": false - }, - "property": { - "type": "Identifier", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - }, - "identifierName": "e" - }, - "name": "e" - }, - "computed": false, - "optional": false - }, - "property": { - "type": "Identifier", - "start": 12, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - }, - "identifierName": "f" - }, - "name": "f" - }, - "computed": false, - "optional": true - } - }, - { - "type": "ExpressionStatement", - "start": 15, - "end": 27, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 12 - } - }, - "expression": { - "type": "OptionalMemberExpression", - "start": 15, - "end": 27, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 12 - } - }, - "object": { - "type": "OptionalMemberExpression", - "start": 15, - "end": 25, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 10 - } - }, - "object": { - "type": "OptionalMemberExpression", - "start": 15, - "end": 23, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 8 - } - }, - "object": { - "type": "MemberExpression", - "start": 15, - "end": 20, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 5 - } - }, - "object": { - "type": "MemberExpression", - "start": 15, - "end": 18, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 3 - } - }, - "object": { - "type": "Identifier", - "start": 15, - "end": 16, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - }, - "identifierName": "a" - }, - "name": "a" - }, - "property": { - "type": "Identifier", - "start": 17, - "end": 18, - "loc": { - "start": { - "line": 3, - "column": 2 - }, - "end": { - "line": 3, - "column": 3 - }, - "identifierName": "b" - }, - "name": "b" - }, - "computed": false - }, - "property": { - "type": "Identifier", - "start": 19, - "end": 20, - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 5 - }, - "identifierName": "c" - }, - "name": "c" - }, - "computed": false - }, - "property": { - "type": "Identifier", - "start": 22, - "end": 23, - "loc": { - "start": { - "line": 3, - "column": 7 - }, - "end": { - "line": 3, - "column": 8 - }, - "identifierName": "d" - }, - "name": "d" - }, - "computed": false, - "optional": true - }, - "property": { - "type": "Identifier", - "start": 24, - "end": 25, - "loc": { - "start": { - "line": 3, - "column": 9 - }, - "end": { - "line": 3, - "column": 10 - }, - "identifierName": "e" - }, - "name": "e" - }, - "computed": false, - "optional": false - }, - "property": { - "type": "Identifier", - "start": 26, - "end": 27, - "loc": { - "start": { - "line": 3, - "column": 11 - }, - "end": { - "line": 3, - "column": 12 - }, - "identifierName": "f" - }, - "name": "f" - }, - "computed": false, - "optional": false - } - } - ], - "directives": [] - } -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/optional-chaining/super-method-class/options.json b/packages/babel-parser/test/fixtures/experimental/optional-chaining/super-method-class/options.json deleted file mode 100644 index fd201c1bdb02..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/optional-chaining/super-method-class/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "plugins": ["optionalChaining"] -} diff --git a/packages/babel-parser/test/fixtures/experimental/optional-chaining/super-method-class/output.json b/packages/babel-parser/test/fixtures/experimental/optional-chaining/super-method-class/output.json deleted file mode 100644 index 890c6f2248d6..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/optional-chaining/super-method-class/output.json +++ /dev/null @@ -1,238 +0,0 @@ -{ - "type": "File", - "start": 0, - "end": 66, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 1 - } - }, - "program": { - "type": "Program", - "start": 0, - "end": 66, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 1 - } - }, - "sourceType": "script", - "interpreter": null, - "body": [ - { - "type": "ClassDeclaration", - "start": 0, - "end": 66, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 1 - } - }, - "id": { - "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "A" - }, - "name": "A" - }, - "superClass": { - "type": "Identifier", - "start": 16, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - }, - "identifierName": "B" - }, - "name": "B" - }, - "body": { - "type": "ClassBody", - "start": 18, - "end": 66, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 5, - "column": 1 - } - }, - "body": [ - { - "type": "ClassMethod", - "start": 24, - "end": 64, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 4, - "column": 5 - } - }, - "static": false, - "key": { - "type": "Identifier", - "start": 24, - "end": 35, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 15 - }, - "identifierName": "constructor" - }, - "name": "constructor" - }, - "computed": false, - "kind": "constructor", - "id": null, - "generator": false, - "async": false, - "params": [], - "body": { - "type": "BlockStatement", - "start": 37, - "end": 64, - "loc": { - "start": { - "line": 2, - "column": 17 - }, - "end": { - "line": 4, - "column": 5 - } - }, - "body": [ - { - "type": "ExpressionStatement", - "start": 47, - "end": 58, - "loc": { - "start": { - "line": 3, - "column": 8 - }, - "end": { - "line": 3, - "column": 19 - } - }, - "expression": { - "type": "OptionalMemberExpression", - "start": 47, - "end": 57, - "loc": { - "start": { - "line": 3, - "column": 8 - }, - "end": { - "line": 3, - "column": 18 - } - }, - "object": { - "type": "CallExpression", - "start": 47, - "end": 54, - "loc": { - "start": { - "line": 3, - "column": 8 - }, - "end": { - "line": 3, - "column": 15 - } - }, - "callee": { - "type": "Super", - "start": 47, - "end": 52, - "loc": { - "start": { - "line": 3, - "column": 8 - }, - "end": { - "line": 3, - "column": 13 - } - } - }, - "arguments": [] - }, - "property": { - "type": "Identifier", - "start": 56, - "end": 57, - "loc": { - "start": { - "line": 3, - "column": 17 - }, - "end": { - "line": 3, - "column": 18 - }, - "identifierName": "b" - }, - "name": "b" - }, - "computed": false, - "optional": true - } - } - ], - "directives": [] - } - } - ] - } - } - ], - "directives": [] - } -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/partial-application/call-expr/output.json b/packages/babel-parser/test/fixtures/experimental/partial-application/call-expr/output.json index ac7ce3111be1..970d655f0a80 100644 --- a/packages/babel-parser/test/fixtures/experimental/partial-application/call-expr/output.json +++ b/packages/babel-parser/test/fixtures/experimental/partial-application/call-expr/output.json @@ -1,94 +1,27 @@ { "type": "File", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "program": { "type": "Program", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "expression": { "type": "CallExpression", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "callee": { "type": "Identifier", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - }, - "identifierName": "foo" - }, + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3},"identifierName":"foo"}, "name": "foo" }, "arguments": [ { "type": "ArgumentPlaceholder", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - } + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5}} } ] } @@ -96,4 +29,4 @@ ], "directives": [] } -} +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/partial-application/call-on-SuperProperty/output.json b/packages/babel-parser/test/fixtures/experimental/partial-application/call-on-SuperProperty/output.json index 39bdbf743956..b6196e69a2d1 100644 --- a/packages/babel-parser/test/fixtures/experimental/partial-application/call-on-SuperProperty/output.json +++ b/packages/babel-parser/test/fixtures/experimental/partial-application/call-on-SuperProperty/output.json @@ -1,111 +1,32 @@ { "type": "File", - "start": 0, - "end": 78, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 1 - } - }, + "start":0,"end":78,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 78, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 1 - } - }, + "start":0,"end":78,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 78, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 1 - } - }, + "start":0,"end":78,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, "id": { "type": "Identifier", - "start": 6, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "foo" - }, + "start":6,"end":9,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":9},"identifierName":"foo"}, "name": "foo" }, "superClass": null, "body": { "type": "ClassBody", - "start": 10, - "end": 78, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 5, - "column": 1 - } - }, + "start":10,"end":78,"loc":{"start":{"line":1,"column":10},"end":{"line":5,"column":1}}, "body": [ { "type": "ClassMethod", - "start": 16, - "end": 76, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 4, - "column": 5 - } - }, + "start":16,"end":76,"loc":{"start":{"line":2,"column":4},"end":{"line":4,"column":5}}, "static": false, "key": { "type": "Identifier", - "start": 16, - "end": 27, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 15 - }, - "identifierName": "constructor" - }, + "start":16,"end":27,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":15},"identifierName":"constructor"}, "name": "constructor" }, "computed": false, @@ -116,156 +37,44 @@ "params": [], "body": { "type": "BlockStatement", - "start": 30, - "end": 76, - "loc": { - "start": { - "line": 2, - "column": 18 - }, - "end": { - "line": 4, - "column": 5 - } - }, + "start":30,"end":76,"loc":{"start":{"line":2,"column":18},"end":{"line":4,"column":5}}, "body": [ { "type": "ExpressionStatement", - "start": 40, - "end": 70, - "loc": { - "start": { - "line": 3, - "column": 8 - }, - "end": { - "line": 3, - "column": 38 - } - }, + "start":40,"end":70,"loc":{"start":{"line":3,"column":8},"end":{"line":3,"column":38}}, "expression": { "type": "CallExpression", - "start": 40, - "end": 69, - "loc": { - "start": { - "line": 3, - "column": 8 - }, - "end": { - "line": 3, - "column": 37 - } - }, + "start":40,"end":69,"loc":{"start":{"line":3,"column":8},"end":{"line":3,"column":37}}, "callee": { "type": "Identifier", - "start": 40, - "end": 43, - "loc": { - "start": { - "line": 3, - "column": 8 - }, - "end": { - "line": 3, - "column": 11 - }, - "identifierName": "baz" - }, + "start":40,"end":43,"loc":{"start":{"line":3,"column":8},"end":{"line":3,"column":11},"identifierName":"baz"}, "name": "baz" }, "arguments": [ { "type": "ThisExpression", - "start": 44, - "end": 48, - "loc": { - "start": { - "line": 3, - "column": 12 - }, - "end": { - "line": 3, - "column": 16 - } - } + "start":44,"end":48,"loc":{"start":{"line":3,"column":12},"end":{"line":3,"column":16}} }, { "type": "ArrowFunctionExpression", - "start": 50, - "end": 68, - "loc": { - "start": { - "line": 3, - "column": 18 - }, - "end": { - "line": 3, - "column": 36 - } - }, + "start":50,"end":68,"loc":{"start":{"line":3,"column":18},"end":{"line":3,"column":36}}, "id": null, "generator": false, "async": false, "params": [], "body": { "type": "CallExpression", - "start": 56, - "end": 68, - "loc": { - "start": { - "line": 3, - "column": 24 - }, - "end": { - "line": 3, - "column": 36 - } - }, + "start":56,"end":68,"loc":{"start":{"line":3,"column":24},"end":{"line":3,"column":36}}, "callee": { "type": "MemberExpression", - "start": 56, - "end": 65, - "loc": { - "start": { - "line": 3, - "column": 24 - }, - "end": { - "line": 3, - "column": 33 - } - }, + "start":56,"end":65,"loc":{"start":{"line":3,"column":24},"end":{"line":3,"column":33}}, "object": { "type": "Super", - "start": 56, - "end": 61, - "loc": { - "start": { - "line": 3, - "column": 24 - }, - "end": { - "line": 3, - "column": 29 - } - } + "start":56,"end":61,"loc":{"start":{"line":3,"column":24},"end":{"line":3,"column":29}} }, "property": { "type": "Identifier", - "start": 62, - "end": 65, - "loc": { - "start": { - "line": 3, - "column": 30 - }, - "end": { - "line": 3, - "column": 33 - }, - "identifierName": "bar" - }, + "start":62,"end":65,"loc":{"start":{"line":3,"column":30},"end":{"line":3,"column":33},"identifierName":"bar"}, "name": "bar" }, "computed": false @@ -273,18 +82,7 @@ "arguments": [ { "type": "ArgumentPlaceholder", - "start": 66, - "end": 67, - "loc": { - "start": { - "line": 3, - "column": 34 - }, - "end": { - "line": 3, - "column": 35 - } - } + "start":66,"end":67,"loc":{"start":{"line":3,"column":34},"end":{"line":3,"column":35}} } ] } @@ -302,4 +100,4 @@ ], "directives": [] } -} +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/partial-application/for-any-arg/output.json b/packages/babel-parser/test/fixtures/experimental/partial-application/for-any-arg/output.json index 61338f165056..dd58d9538a40 100644 --- a/packages/babel-parser/test/fixtures/experimental/partial-application/for-any-arg/output.json +++ b/packages/babel-parser/test/fixtures/experimental/partial-application/for-any-arg/output.json @@ -1,204 +1,57 @@ { "type": "File", - "start": 0, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 16 - } - }, + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":16}}, "program": { "type": "Program", - "start": 0, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 16 - } - }, + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":16}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, "expression": { "type": "CallExpression", - "start": 0, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, "callee": { "type": "Identifier", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - }, - "identifierName": "foo" - }, + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3},"identifierName":"foo"}, "name": "foo" }, "arguments": [ { "type": "ArgumentPlaceholder", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - } + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5}} }, { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "x" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"x"}, "name": "x" }, { "type": "ArgumentPlaceholder", - "start": 8, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - } + "start":8,"end":9,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":9}} } ] } }, { "type": "ExpressionStatement", - "start": 12, - "end": 28, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 16 - } - }, + "start":12,"end":28,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":16}}, "expression": { "type": "CallExpression", - "start": 12, - "end": 28, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 16 - } - }, + "start":12,"end":28,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":16}}, "callee": { "type": "MemberExpression", - "start": 12, - "end": 19, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 7 - } - }, + "start":12,"end":19,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":7}}, "object": { "type": "Identifier", - "start": 12, - "end": 15, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 3 - }, - "identifierName": "bar" - }, + "start":12,"end":15,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":3},"identifierName":"bar"}, "name": "bar" }, "property": { "type": "Identifier", - "start": 16, - "end": 19, - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 7 - }, - "identifierName": "foo" - }, + "start":16,"end":19,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":7},"identifierName":"foo"}, "name": "foo" }, "computed": false @@ -206,50 +59,16 @@ "arguments": [ { "type": "ArgumentPlaceholder", - "start": 20, - "end": 21, - "loc": { - "start": { - "line": 3, - "column": 8 - }, - "end": { - "line": 3, - "column": 9 - } - } + "start":20,"end":21,"loc":{"start":{"line":3,"column":8},"end":{"line":3,"column":9}} }, { "type": "Identifier", - "start": 23, - "end": 24, - "loc": { - "start": { - "line": 3, - "column": 11 - }, - "end": { - "line": 3, - "column": 12 - }, - "identifierName": "x" - }, + "start":23,"end":24,"loc":{"start":{"line":3,"column":11},"end":{"line":3,"column":12},"identifierName":"x"}, "name": "x" }, { "type": "ArgumentPlaceholder", - "start": 26, - "end": 27, - "loc": { - "start": { - "line": 3, - "column": 14 - }, - "end": { - "line": 3, - "column": 15 - } - } + "start":26,"end":27,"loc":{"start":{"line":3,"column":14},"end":{"line":3,"column":15}} } ] } @@ -257,4 +76,4 @@ ], "directives": [] } -} +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/partial-application/from-left/output.json b/packages/babel-parser/test/fixtures/experimental/partial-application/from-left/output.json index 59529de050d1..50b9590533ae 100644 --- a/packages/babel-parser/test/fixtures/experimental/partial-application/from-left/output.json +++ b/packages/babel-parser/test/fixtures/experimental/partial-application/from-left/output.json @@ -1,189 +1,53 @@ { "type": "File", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 12 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":12}}, "program": { "type": "Program", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 12 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":12}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, "expression": { "type": "CallExpression", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, "callee": { "type": "Identifier", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - }, - "identifierName": "foo" - }, + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3},"identifierName":"foo"}, "name": "foo" }, "arguments": [ { "type": "Identifier", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "x" - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"x"}, "name": "x" }, { "type": "ArgumentPlaceholder", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - } + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7}} } ] } }, { "type": "ExpressionStatement", - "start": 10, - "end": 22, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 12 - } - }, + "start":10,"end":22,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":12}}, "expression": { "type": "CallExpression", - "start": 10, - "end": 22, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 12 - } - }, + "start":10,"end":22,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":12}}, "callee": { "type": "MemberExpression", - "start": 10, - "end": 17, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 7 - } - }, + "start":10,"end":17,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":7}}, "object": { "type": "Identifier", - "start": 10, - "end": 13, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 3 - }, - "identifierName": "bar" - }, + "start":10,"end":13,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":3},"identifierName":"bar"}, "name": "bar" }, "property": { "type": "Identifier", - "start": 14, - "end": 17, - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 7 - }, - "identifierName": "foo" - }, + "start":14,"end":17,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":7},"identifierName":"foo"}, "name": "foo" }, "computed": false @@ -191,35 +55,12 @@ "arguments": [ { "type": "Identifier", - "start": 18, - "end": 19, - "loc": { - "start": { - "line": 3, - "column": 8 - }, - "end": { - "line": 3, - "column": 9 - }, - "identifierName": "x" - }, + "start":18,"end":19,"loc":{"start":{"line":3,"column":8},"end":{"line":3,"column":9},"identifierName":"x"}, "name": "x" }, { "type": "ArgumentPlaceholder", - "start": 20, - "end": 21, - "loc": { - "start": { - "line": 3, - "column": 10 - }, - "end": { - "line": 3, - "column": 11 - } - } + "start":20,"end":21,"loc":{"start":{"line":3,"column":10},"end":{"line":3,"column":11}} } ] } @@ -227,4 +68,4 @@ ], "directives": [] } -} +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/partial-application/from-right/output.json b/packages/babel-parser/test/fixtures/experimental/partial-application/from-right/output.json index 3b558a170e5d..fec2b9a60604 100644 --- a/packages/babel-parser/test/fixtures/experimental/partial-application/from-right/output.json +++ b/packages/babel-parser/test/fixtures/experimental/partial-application/from-right/output.json @@ -1,110 +1,31 @@ { "type": "File", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 12 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":12}}, "program": { "type": "Program", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 12 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":12}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, "expression": { "type": "CallExpression", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, "callee": { "type": "Identifier", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - }, - "identifierName": "foo" - }, + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3},"identifierName":"foo"}, "name": "foo" }, "arguments": [ { "type": "ArgumentPlaceholder", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - } + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5}} }, { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "x" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"x"}, "name": "x" } ] @@ -112,78 +33,21 @@ }, { "type": "ExpressionStatement", - "start": 10, - "end": 22, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 12 - } - }, + "start":10,"end":22,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":12}}, "expression": { "type": "CallExpression", - "start": 10, - "end": 22, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 12 - } - }, + "start":10,"end":22,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":12}}, "callee": { "type": "MemberExpression", - "start": 10, - "end": 17, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 7 - } - }, + "start":10,"end":17,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":7}}, "object": { "type": "Identifier", - "start": 10, - "end": 13, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 3 - }, - "identifierName": "bar" - }, + "start":10,"end":13,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":3},"identifierName":"bar"}, "name": "bar" }, "property": { "type": "Identifier", - "start": 14, - "end": 17, - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 7 - }, - "identifierName": "foo" - }, + "start":14,"end":17,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":7},"identifierName":"foo"}, "name": "foo" }, "computed": false @@ -191,34 +55,11 @@ "arguments": [ { "type": "ArgumentPlaceholder", - "start": 18, - "end": 19, - "loc": { - "start": { - "line": 3, - "column": 8 - }, - "end": { - "line": 3, - "column": 9 - } - } + "start":18,"end":19,"loc":{"start":{"line":3,"column":8},"end":{"line":3,"column":9}} }, { "type": "Identifier", - "start": 20, - "end": 21, - "loc": { - "start": { - "line": 3, - "column": 10 - }, - "end": { - "line": 3, - "column": 11 - }, - "identifierName": "x" - }, + "start":20,"end":21,"loc":{"start":{"line":3,"column":10},"end":{"line":3,"column":11},"identifierName":"x"}, "name": "x" } ] @@ -227,4 +68,4 @@ ], "directives": [] } -} +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/partial-application/in-SuperCall/options.json b/packages/babel-parser/test/fixtures/experimental/partial-application/in-SuperCall/options.json index 58192a87fd99..87414aef43de 100644 --- a/packages/babel-parser/test/fixtures/experimental/partial-application/in-SuperCall/options.json +++ b/packages/babel-parser/test/fixtures/experimental/partial-application/in-SuperCall/options.json @@ -1,4 +1,3 @@ { - "plugins": ["partialApplication"], - "throws": "Unexpected argument placeholder (3:16)" + "plugins": ["partialApplication"] } diff --git a/packages/babel-parser/test/fixtures/experimental/partial-application/in-SuperCall/output.json b/packages/babel-parser/test/fixtures/experimental/partial-application/in-SuperCall/output.json new file mode 100644 index 000000000000..f92740eabc90 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/partial-application/in-SuperCall/output.json @@ -0,0 +1,130 @@ +{ + "type": "File", + "start":0,"end":86,"loc":{"start":{"line":1,"column":0},"end":{"line":6,"column":1}}, + "errors": [ + "SyntaxError: Unexpected argument placeholder (3:16)", + "SyntaxError: Unexpected argument placeholder (3:19)" + ], + "program": { + "type": "Program", + "start":0,"end":86,"loc":{"start":{"line":1,"column":0},"end":{"line":6,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start":0,"end":86,"loc":{"start":{"line":1,"column":0},"end":{"line":6,"column":1}}, + "id": { + "type": "Identifier", + "start":6,"end":9,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":9},"identifierName":"Foo"}, + "name": "Foo" + }, + "superClass": { + "type": "Identifier", + "start":18,"end":21,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":21},"identifierName":"Bar"}, + "name": "Bar" + }, + "body": { + "type": "ClassBody", + "start":22,"end":86,"loc":{"start":{"line":1,"column":22},"end":{"line":6,"column":1}}, + "body": [ + { + "type": "ClassMethod", + "start":26,"end":84,"loc":{"start":{"line":2,"column":2},"end":{"line":5,"column":3}}, + "static": false, + "key": { + "type": "Identifier", + "start":26,"end":37,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":13},"identifierName":"constructor"}, + "name": "constructor" + }, + "computed": false, + "kind": "constructor", + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start":38,"end":39,"loc":{"start":{"line":2,"column":14},"end":{"line":2,"column":15},"identifierName":"x"}, + "name": "x" + } + ], + "body": { + "type": "BlockStatement", + "start":40,"end":84,"loc":{"start":{"line":2,"column":16},"end":{"line":5,"column":3}}, + "body": [ + { + "type": "ExpressionStatement", + "start":46,"end":64,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":22}}, + "expression": { + "type": "CallExpression", + "start":46,"end":63,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":21}}, + "callee": { + "type": "Super", + "start":46,"end":51,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":9}} + }, + "arguments": [ + { + "type": "Identifier", + "start":52,"end":53,"loc":{"start":{"line":3,"column":10},"end":{"line":3,"column":11},"identifierName":"x"}, + "name": "x" + }, + { + "type": "NumericLiteral", + "start":55,"end":56,"loc":{"start":{"line":3,"column":13},"end":{"line":3,"column":14}}, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + }, + { + "type": "ArgumentPlaceholder", + "start":58,"end":59,"loc":{"start":{"line":3,"column":16},"end":{"line":3,"column":17}} + }, + { + "type": "ArgumentPlaceholder", + "start":61,"end":62,"loc":{"start":{"line":3,"column":19},"end":{"line":3,"column":20}} + } + ] + } + }, + { + "type": "ExpressionStatement", + "start":69,"end":80,"loc":{"start":{"line":4,"column":4},"end":{"line":4,"column":15}}, + "expression": { + "type": "AssignmentExpression", + "start":69,"end":79,"loc":{"start":{"line":4,"column":4},"end":{"line":4,"column":14}}, + "operator": "=", + "left": { + "type": "MemberExpression", + "start":69,"end":75,"loc":{"start":{"line":4,"column":4},"end":{"line":4,"column":10}}, + "object": { + "type": "ThisExpression", + "start":69,"end":73,"loc":{"start":{"line":4,"column":4},"end":{"line":4,"column":8}} + }, + "property": { + "type": "Identifier", + "start":74,"end":75,"loc":{"start":{"line":4,"column":9},"end":{"line":4,"column":10},"identifierName":"x"}, + "name": "x" + }, + "computed": false + }, + "right": { + "type": "Identifier", + "start":78,"end":79,"loc":{"start":{"line":4,"column":13},"end":{"line":4,"column":14},"identifierName":"x"}, + "name": "x" + } + } + } + ], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/partial-application/in-new/options.json b/packages/babel-parser/test/fixtures/experimental/partial-application/in-new/options.json index 3b09c84c03eb..87414aef43de 100644 --- a/packages/babel-parser/test/fixtures/experimental/partial-application/in-new/options.json +++ b/packages/babel-parser/test/fixtures/experimental/partial-application/in-new/options.json @@ -1,4 +1,3 @@ { - "plugins": ["partialApplication"], - "throws": "Unexpected argument placeholder (1:11)" + "plugins": ["partialApplication"] } diff --git a/packages/babel-parser/test/fixtures/experimental/partial-application/in-new/output.json b/packages/babel-parser/test/fixtures/experimental/partial-application/in-new/output.json new file mode 100644 index 000000000000..6b08f2e6eb24 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/partial-application/in-new/output.json @@ -0,0 +1,54 @@ +{ + "type": "File", + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, + "errors": [ + "SyntaxError: Unexpected argument placeholder (1:11)", + "SyntaxError: Unexpected argument placeholder (1:17)" + ], + "program": { + "type": "Program", + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, + "expression": { + "type": "NewExpression", + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, + "callee": { + "type": "Identifier", + "start":4,"end":7,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":7},"identifierName":"bar"}, + "name": "bar" + }, + "arguments": [ + { + "type": "Identifier", + "start":8,"end":9,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":9},"identifierName":"x"}, + "name": "x" + }, + { + "type": "ArgumentPlaceholder", + "start":11,"end":12,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":12}} + }, + { + "type": "NumericLiteral", + "start":14,"end":15,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":15}}, + "extra": { + "rawValue": 2, + "raw": "2" + }, + "value": 2 + }, + { + "type": "ArgumentPlaceholder", + "start":17,"end":18,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":18}} + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-fsharp-arrow-and-array-in-body-with-operator/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-fsharp-arrow-and-array-in-body-with-operator/output.json index 0ed567f15eea..f97121b4372e 100644 --- a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-fsharp-arrow-and-array-in-body-with-operator/output.json +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-fsharp-arrow-and-array-in-body-with-operator/output.json @@ -1,227 +1,69 @@ { "type": "File", - "start": 0, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, "program": { "type": "Program", - "start": 0, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, "expression": { "type": "ArrowFunctionExpression", - "start": 0, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, "id": null, "generator": false, "async": false, "params": [ { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" } ], "body": { "type": "BinaryExpression", - "start": 5, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":5,"end":36,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":36}}, "left": { "type": "Identifier", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "x" - }, + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"x"}, "name": "x" }, "operator": "|>", "right": { "type": "ArrayExpression", - "start": 10, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":10,"end":36,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":36}}, "elements": [ { "type": "ArrowFunctionExpression", - "start": 11, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":11,"end":35,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":35}}, "id": null, "generator": false, "async": false, "params": [ { "type": "Identifier", - "start": 11, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "y" - }, + "start":11,"end":12,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":12},"identifierName":"y"}, "name": "y" } ], "body": { "type": "BinaryExpression", - "start": 16, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":16,"end":35,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":35}}, "left": { "type": "BinaryExpression", - "start": 16, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":16,"end":21,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":21}}, "left": { "type": "Identifier", - "start": 16, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - }, - "identifierName": "y" - }, + "start":16,"end":17,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":17},"identifierName":"y"}, "name": "y" }, "operator": "+", "right": { "type": "NumericLiteral", - "start": 20, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":20,"end":21,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":21}}, "extra": { "rawValue": 1, "raw": "1" @@ -232,86 +74,29 @@ "operator": "|>", "right": { "type": "ArrowFunctionExpression", - "start": 25, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":25,"end":35,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":35}}, "id": null, "generator": false, "async": false, "params": [ { "type": "Identifier", - "start": 25, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 26 - }, - "identifierName": "z" - }, + "start":25,"end":26,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":26},"identifierName":"z"}, "name": "z" } ], "body": { "type": "BinaryExpression", - "start": 30, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":30,"end":35,"loc":{"start":{"line":1,"column":30},"end":{"line":1,"column":35}}, "left": { "type": "Identifier", - "start": 30, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 1, - "column": 31 - }, - "identifierName": "z" - }, + "start":30,"end":31,"loc":{"start":{"line":1,"column":30},"end":{"line":1,"column":31},"identifierName":"z"}, "name": "z" }, "operator": "*", "right": { "type": "NumericLiteral", - "start": 34, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 34 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":34,"end":35,"loc":{"start":{"line":1,"column":34},"end":{"line":1,"column":35}}, "extra": { "rawValue": 2, "raw": "2" diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-fsharp-arrow-and-array-in-body/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-fsharp-arrow-and-array-in-body/output.json index ef37548ee98f..1c9997501890 100644 --- a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-fsharp-arrow-and-array-in-body/output.json +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-fsharp-arrow-and-array-in-body/output.json @@ -1,227 +1,69 @@ { "type": "File", - "start": 0, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, "program": { "type": "Program", - "start": 0, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, "expression": { "type": "ArrowFunctionExpression", - "start": 0, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, "id": null, "generator": false, "async": false, "params": [ { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" } ], "body": { "type": "BinaryExpression", - "start": 5, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":5,"end":36,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":36}}, "left": { "type": "BinaryExpression", - "start": 5, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":5,"end":22,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":22}}, "left": { "type": "Identifier", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "x" - }, + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"x"}, "name": "x" }, "operator": "|>", "right": { "type": "ArrayExpression", - "start": 10, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":10,"end":22,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":22}}, "elements": [ { "type": "ArrowFunctionExpression", - "start": 11, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":11,"end":21,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":21}}, "id": null, "generator": false, "async": false, "params": [ { "type": "Identifier", - "start": 11, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "y" - }, + "start":11,"end":12,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":12},"identifierName":"y"}, "name": "y" } ], "body": { "type": "BinaryExpression", - "start": 16, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":16,"end":21,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":21}}, "left": { "type": "Identifier", - "start": 16, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - }, - "identifierName": "y" - }, + "start":16,"end":17,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":17},"identifierName":"y"}, "name": "y" }, "operator": "+", "right": { "type": "NumericLiteral", - "start": 20, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":20,"end":21,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":21}}, "extra": { "rawValue": 1, "raw": "1" @@ -236,86 +78,29 @@ "operator": "|>", "right": { "type": "ArrowFunctionExpression", - "start": 26, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":26,"end":36,"loc":{"start":{"line":1,"column":26},"end":{"line":1,"column":36}}, "id": null, "generator": false, "async": false, "params": [ { "type": "Identifier", - "start": 26, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 27 - }, - "identifierName": "z" - }, + "start":26,"end":27,"loc":{"start":{"line":1,"column":26},"end":{"line":1,"column":27},"identifierName":"z"}, "name": "z" } ], "body": { "type": "BinaryExpression", - "start": 31, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 31 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":31,"end":36,"loc":{"start":{"line":1,"column":31},"end":{"line":1,"column":36}}, "left": { "type": "Identifier", - "start": 31, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 31 - }, - "end": { - "line": 1, - "column": 32 - }, - "identifierName": "z" - }, + "start":31,"end":32,"loc":{"start":{"line":1,"column":31},"end":{"line":1,"column":32},"identifierName":"z"}, "name": "z" }, "operator": "*", "right": { "type": "NumericLiteral", - "start": 35, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 35 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":35,"end":36,"loc":{"start":{"line":1,"column":35},"end":{"line":1,"column":36}}, "extra": { "rawValue": 2, "raw": "2" diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-fsharp-arrow-and-assignment-in-body/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-fsharp-arrow-and-assignment-in-body/output.json index 5f2e34747dfa..6ad681373f22 100644 --- a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-fsharp-arrow-and-assignment-in-body/output.json +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-fsharp-arrow-and-assignment-in-body/output.json @@ -1,208 +1,61 @@ { "type": "File", - "start": 0, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, "program": { "type": "Program", - "start": 0, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, "expression": { "type": "ArrowFunctionExpression", - "start": 0, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, "id": null, "generator": false, "async": false, "params": [ { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" } ], "body": { "type": "BinaryExpression", - "start": 5, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":5,"end":27,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":27}}, "left": { "type": "Identifier", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "x" - }, + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"x"}, "name": "x" }, "operator": "|>", "right": { "type": "CallExpression", - "start": 10, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":10,"end":27,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":27}}, "callee": { "type": "Identifier", - "start": 10, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 13 - }, - "identifierName": "foo" - }, + "start":10,"end":13,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":13},"identifierName":"foo"}, "name": "foo" }, "arguments": [ { "type": "AssignmentExpression", - "start": 14, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":14,"end":26,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":26}}, "operator": "=", "left": { "type": "Identifier", - "start": 14, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - }, - "identifierName": "x" - }, + "start":14,"end":15,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":15},"identifierName":"x"}, "name": "x" }, "right": { "type": "BinaryExpression", - "start": 18, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":18,"end":26,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":26}}, "left": { "type": "NumericLiteral", - "start": 18, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":18,"end":19,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":19}}, "extra": { "rawValue": 1, "raw": "1" @@ -212,19 +65,7 @@ "operator": "|>", "right": { "type": "Identifier", - "start": 23, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 26 - }, - "identifierName": "foo" - }, + "start":23,"end":26,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":26},"identifierName":"foo"}, "name": "foo" } } diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-fsharp-arrow-and-object-in-body-with-operator/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-fsharp-arrow-and-object-in-body-with-operator/output.json index de8143714401..b2433fa8b012 100644 --- a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-fsharp-arrow-and-object-in-body-with-operator/output.json +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-fsharp-arrow-and-object-in-body-with-operator/output.json @@ -1,261 +1,80 @@ { "type": "File", - "start": 0, - "end": 46, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 46 - } - }, + "start":0,"end":46,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":46}}, "program": { "type": "Program", - "start": 0, - "end": 46, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 46 - } - }, + "start":0,"end":46,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":46}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 46, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 46 - } - }, + "start":0,"end":46,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":46}}, "expression": { "type": "ArrowFunctionExpression", - "start": 0, - "end": 46, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 46 - } - }, + "start":0,"end":46,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":46}}, "id": null, "generator": false, "async": false, "params": [ { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" } ], "body": { "type": "BinaryExpression", - "start": 5, - "end": 46, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 46 - } - }, + "start":5,"end":46,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":46}}, "left": { "type": "Identifier", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "x" - }, + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"x"}, "name": "x" }, "operator": "|>", "right": { "type": "ObjectExpression", - "start": 10, - "end": 46, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 46 - } - }, + "start":10,"end":46,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":46}}, "properties": [ { "type": "ObjectProperty", - "start": 12, - "end": 44, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 44 - } - }, + "start":12,"end":44,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":44}}, "method": false, "key": { "type": "Identifier", - "start": 12, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 18 - }, - "identifierName": "method" - }, + "start":12,"end":18,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":18},"identifierName":"method"}, "name": "method" }, "computed": false, "shorthand": false, "value": { "type": "ArrowFunctionExpression", - "start": 20, - "end": 44, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 44 - } - }, + "start":20,"end":44,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":44}}, "id": null, "generator": false, "async": false, "params": [ { "type": "Identifier", - "start": 20, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 21 - }, - "identifierName": "y" - }, + "start":20,"end":21,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":21},"identifierName":"y"}, "name": "y" } ], "body": { "type": "BinaryExpression", - "start": 25, - "end": 44, - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 44 - } - }, + "start":25,"end":44,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":44}}, "left": { "type": "BinaryExpression", - "start": 25, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":25,"end":30,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":30}}, "left": { "type": "Identifier", - "start": 25, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 26 - }, - "identifierName": "y" - }, + "start":25,"end":26,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":26},"identifierName":"y"}, "name": "y" }, "operator": "+", "right": { "type": "NumericLiteral", - "start": 29, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":29,"end":30,"loc":{"start":{"line":1,"column":29},"end":{"line":1,"column":30}}, "extra": { "rawValue": 1, "raw": "1" @@ -266,86 +85,29 @@ "operator": "|>", "right": { "type": "ArrowFunctionExpression", - "start": 34, - "end": 44, - "loc": { - "start": { - "line": 1, - "column": 34 - }, - "end": { - "line": 1, - "column": 44 - } - }, + "start":34,"end":44,"loc":{"start":{"line":1,"column":34},"end":{"line":1,"column":44}}, "id": null, "generator": false, "async": false, "params": [ { "type": "Identifier", - "start": 34, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 34 - }, - "end": { - "line": 1, - "column": 35 - }, - "identifierName": "z" - }, + "start":34,"end":35,"loc":{"start":{"line":1,"column":34},"end":{"line":1,"column":35},"identifierName":"z"}, "name": "z" } ], "body": { "type": "BinaryExpression", - "start": 39, - "end": 44, - "loc": { - "start": { - "line": 1, - "column": 39 - }, - "end": { - "line": 1, - "column": 44 - } - }, + "start":39,"end":44,"loc":{"start":{"line":1,"column":39},"end":{"line":1,"column":44}}, "left": { "type": "Identifier", - "start": 39, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 39 - }, - "end": { - "line": 1, - "column": 40 - }, - "identifierName": "z" - }, + "start":39,"end":40,"loc":{"start":{"line":1,"column":39},"end":{"line":1,"column":40},"identifierName":"z"}, "name": "z" }, "operator": "*", "right": { "type": "NumericLiteral", - "start": 43, - "end": 44, - "loc": { - "start": { - "line": 1, - "column": 43 - }, - "end": { - "line": 1, - "column": 44 - } - }, + "start":43,"end":44,"loc":{"start":{"line":1,"column":43},"end":{"line":1,"column":44}}, "extra": { "rawValue": 2, "raw": "2" diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-fsharp-arrow-and-object-in-body/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-fsharp-arrow-and-object-in-body/output.json index d1e39e6ccea4..a2e7f8045864 100644 --- a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-fsharp-arrow-and-object-in-body/output.json +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-fsharp-arrow-and-object-in-body/output.json @@ -1,261 +1,80 @@ { "type": "File", - "start": 0, - "end": 46, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 46 - } - }, + "start":0,"end":46,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":46}}, "program": { "type": "Program", - "start": 0, - "end": 46, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 46 - } - }, + "start":0,"end":46,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":46}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 46, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 46 - } - }, + "start":0,"end":46,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":46}}, "expression": { "type": "ArrowFunctionExpression", - "start": 0, - "end": 46, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 46 - } - }, + "start":0,"end":46,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":46}}, "id": null, "generator": false, "async": false, "params": [ { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" } ], "body": { "type": "BinaryExpression", - "start": 5, - "end": 46, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 46 - } - }, + "start":5,"end":46,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":46}}, "left": { "type": "BinaryExpression", - "start": 5, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":5,"end":32,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":32}}, "left": { "type": "Identifier", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "x" - }, + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"x"}, "name": "x" }, "operator": "|>", "right": { "type": "ObjectExpression", - "start": 10, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":10,"end":32,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":32}}, "properties": [ { "type": "ObjectProperty", - "start": 12, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":12,"end":30,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":30}}, "method": false, "key": { "type": "Identifier", - "start": 12, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 18 - }, - "identifierName": "method" - }, + "start":12,"end":18,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":18},"identifierName":"method"}, "name": "method" }, "computed": false, "shorthand": false, "value": { "type": "ArrowFunctionExpression", - "start": 20, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":20,"end":30,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":30}}, "id": null, "generator": false, "async": false, "params": [ { "type": "Identifier", - "start": 20, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 21 - }, - "identifierName": "y" - }, + "start":20,"end":21,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":21},"identifierName":"y"}, "name": "y" } ], "body": { "type": "BinaryExpression", - "start": 25, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":25,"end":30,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":30}}, "left": { "type": "Identifier", - "start": 25, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 26 - }, - "identifierName": "y" - }, + "start":25,"end":26,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":26},"identifierName":"y"}, "name": "y" }, "operator": "+", "right": { "type": "NumericLiteral", - "start": 29, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":29,"end":30,"loc":{"start":{"line":1,"column":29},"end":{"line":1,"column":30}}, "extra": { "rawValue": 1, "raw": "1" @@ -271,86 +90,29 @@ "operator": "|>", "right": { "type": "ArrowFunctionExpression", - "start": 36, - "end": 46, - "loc": { - "start": { - "line": 1, - "column": 36 - }, - "end": { - "line": 1, - "column": 46 - } - }, + "start":36,"end":46,"loc":{"start":{"line":1,"column":36},"end":{"line":1,"column":46}}, "id": null, "generator": false, "async": false, "params": [ { "type": "Identifier", - "start": 36, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 36 - }, - "end": { - "line": 1, - "column": 37 - }, - "identifierName": "z" - }, + "start":36,"end":37,"loc":{"start":{"line":1,"column":36},"end":{"line":1,"column":37},"identifierName":"z"}, "name": "z" } ], "body": { "type": "BinaryExpression", - "start": 41, - "end": 46, - "loc": { - "start": { - "line": 1, - "column": 41 - }, - "end": { - "line": 1, - "column": 46 - } - }, + "start":41,"end":46,"loc":{"start":{"line":1,"column":41},"end":{"line":1,"column":46}}, "left": { "type": "Identifier", - "start": 41, - "end": 42, - "loc": { - "start": { - "line": 1, - "column": 41 - }, - "end": { - "line": 1, - "column": 42 - }, - "identifierName": "z" - }, + "start":41,"end":42,"loc":{"start":{"line":1,"column":41},"end":{"line":1,"column":42},"identifierName":"z"}, "name": "z" }, "operator": "*", "right": { "type": "NumericLiteral", - "start": 45, - "end": 46, - "loc": { - "start": { - "line": 1, - "column": 45 - }, - "end": { - "line": 1, - "column": 46 - } - }, + "start":45,"end":46,"loc":{"start":{"line":1,"column":45},"end":{"line":1,"column":46}}, "extra": { "rawValue": 2, "raw": "2" diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-fsharp-arrow-at-head-indented/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-fsharp-arrow-at-head-indented/output.json index 4f7a815237e6..40519c9b3851 100644 --- a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-fsharp-arrow-at-head-indented/output.json +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-fsharp-arrow-at-head-indented/output.json @@ -1,164 +1,50 @@ { "type": "File", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "program": { "type": "Program", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "expression": { "type": "ArrowFunctionExpression", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "id": null, "generator": false, "async": false, "params": [ { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" } ], "body": { "type": "BinaryExpression", - "start": 5, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":5,"end":23,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":23}}, "left": { "type": "BinaryExpression", - "start": 5, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":5,"end":13,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":13}}, "left": { "type": "Identifier", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "x" - }, + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"x"}, "name": "x" }, "operator": "|>", "right": { "type": "Identifier", - "start": 10, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 13 - }, - "identifierName": "inc" - }, + "start":10,"end":13,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":13},"identifierName":"inc"}, "name": "inc" } }, "operator": "|>", "right": { "type": "Identifier", - "start": 17, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 23 - }, - "identifierName": "double" - }, + "start":17,"end":23,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":23},"identifierName":"double"}, "name": "double" } } diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-fsharp-arrow-at-head/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-fsharp-arrow-at-head/output.json index 4f7a815237e6..40519c9b3851 100644 --- a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-fsharp-arrow-at-head/output.json +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-fsharp-arrow-at-head/output.json @@ -1,164 +1,50 @@ { "type": "File", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "program": { "type": "Program", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "expression": { "type": "ArrowFunctionExpression", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "id": null, "generator": false, "async": false, "params": [ { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" } ], "body": { "type": "BinaryExpression", - "start": 5, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":5,"end":23,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":23}}, "left": { "type": "BinaryExpression", - "start": 5, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":5,"end":13,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":13}}, "left": { "type": "Identifier", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "x" - }, + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"x"}, "name": "x" }, "operator": "|>", "right": { "type": "Identifier", - "start": 10, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 13 - }, - "identifierName": "inc" - }, + "start":10,"end":13,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":13},"identifierName":"inc"}, "name": "inc" } }, "operator": "|>", "right": { "type": "Identifier", - "start": 17, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 23 - }, - "identifierName": "double" - }, + "start":17,"end":23,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":23},"identifierName":"double"}, "name": "double" } } diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-fsharp-arrow-in-body-alt-parens/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-fsharp-arrow-in-body-alt-parens/output.json index fee1e93abafb..a21637e0a1f6 100644 --- a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-fsharp-arrow-in-body-alt-parens/output.json +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-fsharp-arrow-in-body-alt-parens/output.json @@ -1,212 +1,65 @@ { "type": "File", - "start": 0, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":38}}, "program": { "type": "Program", - "start": 0, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":38}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":38}}, "expression": { "type": "ArrowFunctionExpression", - "start": 0, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":38}}, "id": null, "generator": false, "async": false, "params": [ { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" } ], "body": { "type": "BinaryExpression", - "start": 5, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":5,"end":38,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":38}}, "left": { "type": "Identifier", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "x" - }, + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"x"}, "name": "x" }, "operator": "|>", "right": { "type": "ArrowFunctionExpression", - "start": 11, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 37 - } - }, + "start":11,"end":37,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":37}}, "id": null, "generator": false, "async": false, "params": [ { "type": "Identifier", - "start": 11, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "y" - }, + "start":11,"end":12,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":12},"identifierName":"y"}, "name": "y" } ], "body": { "type": "BinaryExpression", - "start": 16, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 37 - } - }, + "start":16,"end":37,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":37}}, "left": { "type": "BinaryExpression", - "start": 16, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":16,"end":21,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":21}}, "left": { "type": "Identifier", - "start": 16, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - }, - "identifierName": "y" - }, + "start":16,"end":17,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":17},"identifierName":"y"}, "name": "y" }, "operator": "+", "right": { "type": "NumericLiteral", - "start": 20, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":20,"end":21,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":21}}, "extra": { "rawValue": 3, "raw": "3" @@ -217,87 +70,29 @@ "operator": "|>", "right": { "type": "ArrowFunctionExpression", - "start": 26, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":26,"end":36,"loc":{"start":{"line":1,"column":26},"end":{"line":1,"column":36}}, "id": null, "generator": false, "async": false, "params": [ { "type": "Identifier", - "start": 26, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 27 - }, - "identifierName": "b" - }, + "start":26,"end":27,"loc":{"start":{"line":1,"column":26},"end":{"line":1,"column":27},"identifierName":"b"}, "name": "b" } ], "body": { "type": "BinaryExpression", - "start": 31, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 31 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":31,"end":36,"loc":{"start":{"line":1,"column":31},"end":{"line":1,"column":36}}, "left": { "type": "Identifier", - "start": 31, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 31 - }, - "end": { - "line": 1, - "column": 32 - }, - "identifierName": "y" - }, + "start":31,"end":32,"loc":{"start":{"line":1,"column":31},"end":{"line":1,"column":32},"identifierName":"y"}, "name": "y" }, "operator": "+", "right": { "type": "Identifier", - "start": 35, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 35 - }, - "end": { - "line": 1, - "column": 36 - }, - "identifierName": "b" - }, + "start":35,"end":36,"loc":{"start":{"line":1,"column":35},"end":{"line":1,"column":36},"identifierName":"b"}, "name": "b" } }, diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-fsharp-arrow-in-body-no-parens-indented-with-arg-parens/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-fsharp-arrow-in-body-no-parens-indented-with-arg-parens/output.json index 313e3fa4b8cc..24c9f9af57a1 100644 --- a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-fsharp-arrow-in-body-no-parens-indented-with-arg-parens/output.json +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-fsharp-arrow-in-body-no-parens-indented-with-arg-parens/output.json @@ -1,212 +1,65 @@ { "type": "File", - "start": 0, - "end": 44, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 17 - } - }, + "start":0,"end":44,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":17}}, "program": { "type": "Program", - "start": 0, - "end": 44, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 17 - } - }, + "start":0,"end":44,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":17}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 44, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 17 - } - }, + "start":0,"end":44,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":17}}, "expression": { "type": "ArrowFunctionExpression", - "start": 0, - "end": 44, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 17 - } - }, + "start":0,"end":44,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":17}}, "id": null, "generator": false, "async": false, "params": [ { "type": "Identifier", - "start": 1, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - }, - "identifierName": "x" - }, + "start":1,"end":2,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":2},"identifierName":"x"}, "name": "x" } ], "body": { "type": "BinaryExpression", - "start": 7, - "end": 44, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 3, - "column": 17 - } - }, + "start":7,"end":44,"loc":{"start":{"line":1,"column":7},"end":{"line":3,"column":17}}, "left": { "type": "BinaryExpression", - "start": 7, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 2, - "column": 17 - } - }, + "start":7,"end":26,"loc":{"start":{"line":1,"column":7},"end":{"line":2,"column":17}}, "left": { "type": "Identifier", - "start": 7, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - }, - "identifierName": "x" - }, + "start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8},"identifierName":"x"}, "name": "x" }, "operator": "|>", "right": { "type": "ArrowFunctionExpression", - "start": 14, - "end": 26, - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 17 - } - }, + "start":14,"end":26,"loc":{"start":{"line":2,"column":5},"end":{"line":2,"column":17}}, "id": null, "generator": false, "async": false, "params": [ { "type": "Identifier", - "start": 15, - "end": 16, - "loc": { - "start": { - "line": 2, - "column": 6 - }, - "end": { - "line": 2, - "column": 7 - }, - "identifierName": "y" - }, + "start":15,"end":16,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":7},"identifierName":"y"}, "name": "y" } ], "body": { "type": "BinaryExpression", - "start": 21, - "end": 26, - "loc": { - "start": { - "line": 2, - "column": 12 - }, - "end": { - "line": 2, - "column": 17 - } - }, + "start":21,"end":26,"loc":{"start":{"line":2,"column":12},"end":{"line":2,"column":17}}, "left": { "type": "Identifier", - "start": 21, - "end": 22, - "loc": { - "start": { - "line": 2, - "column": 12 - }, - "end": { - "line": 2, - "column": 13 - }, - "identifierName": "y" - }, + "start":21,"end":22,"loc":{"start":{"line":2,"column":12},"end":{"line":2,"column":13},"identifierName":"y"}, "name": "y" }, "operator": "+", "right": { "type": "NumericLiteral", - "start": 25, - "end": 26, - "loc": { - "start": { - "line": 2, - "column": 16 - }, - "end": { - "line": 2, - "column": 17 - } - }, + "start":25,"end":26,"loc":{"start":{"line":2,"column":16},"end":{"line":2,"column":17}}, "extra": { "rawValue": 1, "raw": "1" @@ -219,86 +72,29 @@ "operator": "|>", "right": { "type": "ArrowFunctionExpression", - "start": 32, - "end": 44, - "loc": { - "start": { - "line": 3, - "column": 5 - }, - "end": { - "line": 3, - "column": 17 - } - }, + "start":32,"end":44,"loc":{"start":{"line":3,"column":5},"end":{"line":3,"column":17}}, "id": null, "generator": false, "async": false, "params": [ { "type": "Identifier", - "start": 33, - "end": 34, - "loc": { - "start": { - "line": 3, - "column": 6 - }, - "end": { - "line": 3, - "column": 7 - }, - "identifierName": "z" - }, + "start":33,"end":34,"loc":{"start":{"line":3,"column":6},"end":{"line":3,"column":7},"identifierName":"z"}, "name": "z" } ], "body": { "type": "BinaryExpression", - "start": 39, - "end": 44, - "loc": { - "start": { - "line": 3, - "column": 12 - }, - "end": { - "line": 3, - "column": 17 - } - }, + "start":39,"end":44,"loc":{"start":{"line":3,"column":12},"end":{"line":3,"column":17}}, "left": { "type": "Identifier", - "start": 39, - "end": 40, - "loc": { - "start": { - "line": 3, - "column": 12 - }, - "end": { - "line": 3, - "column": 13 - }, - "identifierName": "z" - }, + "start":39,"end":40,"loc":{"start":{"line":3,"column":12},"end":{"line":3,"column":13},"identifierName":"z"}, "name": "z" }, "operator": "*", "right": { "type": "NumericLiteral", - "start": 43, - "end": 44, - "loc": { - "start": { - "line": 3, - "column": 16 - }, - "end": { - "line": 3, - "column": 17 - } - }, + "start":43,"end":44,"loc":{"start":{"line":3,"column":16},"end":{"line":3,"column":17}}, "extra": { "rawValue": 2, "raw": "2" diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-fsharp-arrow-in-body-no-parens-indented/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-fsharp-arrow-in-body-no-parens-indented/output.json index cf3c546e748d..6bf47be1b325 100644 --- a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-fsharp-arrow-in-body-no-parens-indented/output.json +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-fsharp-arrow-in-body-no-parens-indented/output.json @@ -1,212 +1,65 @@ { "type": "File", - "start": 0, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 15 - } - }, + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":15}}, "program": { "type": "Program", - "start": 0, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 15 - } - }, + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":15}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 15 - } - }, + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":15}}, "expression": { "type": "ArrowFunctionExpression", - "start": 0, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 15 - } - }, + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":15}}, "id": null, "generator": false, "async": false, "params": [ { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" } ], "body": { "type": "BinaryExpression", - "start": 5, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 3, - "column": 15 - } - }, + "start":5,"end":38,"loc":{"start":{"line":1,"column":5},"end":{"line":3,"column":15}}, "left": { "type": "BinaryExpression", - "start": 5, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 2, - "column": 15 - } - }, + "start":5,"end":22,"loc":{"start":{"line":1,"column":5},"end":{"line":2,"column":15}}, "left": { "type": "Identifier", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "x" - }, + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"x"}, "name": "x" }, "operator": "|>", "right": { "type": "ArrowFunctionExpression", - "start": 12, - "end": 22, - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 15 - } - }, + "start":12,"end":22,"loc":{"start":{"line":2,"column":5},"end":{"line":2,"column":15}}, "id": null, "generator": false, "async": false, "params": [ { "type": "Identifier", - "start": 12, - "end": 13, - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 6 - }, - "identifierName": "y" - }, + "start":12,"end":13,"loc":{"start":{"line":2,"column":5},"end":{"line":2,"column":6},"identifierName":"y"}, "name": "y" } ], "body": { "type": "BinaryExpression", - "start": 17, - "end": 22, - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 15 - } - }, + "start":17,"end":22,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":15}}, "left": { "type": "Identifier", - "start": 17, - "end": 18, - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 11 - }, - "identifierName": "y" - }, + "start":17,"end":18,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":11},"identifierName":"y"}, "name": "y" }, "operator": "+", "right": { "type": "NumericLiteral", - "start": 21, - "end": 22, - "loc": { - "start": { - "line": 2, - "column": 14 - }, - "end": { - "line": 2, - "column": 15 - } - }, + "start":21,"end":22,"loc":{"start":{"line":2,"column":14},"end":{"line":2,"column":15}}, "extra": { "rawValue": 1, "raw": "1" @@ -219,86 +72,29 @@ "operator": "|>", "right": { "type": "ArrowFunctionExpression", - "start": 28, - "end": 38, - "loc": { - "start": { - "line": 3, - "column": 5 - }, - "end": { - "line": 3, - "column": 15 - } - }, + "start":28,"end":38,"loc":{"start":{"line":3,"column":5},"end":{"line":3,"column":15}}, "id": null, "generator": false, "async": false, "params": [ { "type": "Identifier", - "start": 28, - "end": 29, - "loc": { - "start": { - "line": 3, - "column": 5 - }, - "end": { - "line": 3, - "column": 6 - }, - "identifierName": "z" - }, + "start":28,"end":29,"loc":{"start":{"line":3,"column":5},"end":{"line":3,"column":6},"identifierName":"z"}, "name": "z" } ], "body": { "type": "BinaryExpression", - "start": 33, - "end": 38, - "loc": { - "start": { - "line": 3, - "column": 10 - }, - "end": { - "line": 3, - "column": 15 - } - }, + "start":33,"end":38,"loc":{"start":{"line":3,"column":10},"end":{"line":3,"column":15}}, "left": { "type": "Identifier", - "start": 33, - "end": 34, - "loc": { - "start": { - "line": 3, - "column": 10 - }, - "end": { - "line": 3, - "column": 11 - }, - "identifierName": "z" - }, + "start":33,"end":34,"loc":{"start":{"line":3,"column":10},"end":{"line":3,"column":11},"identifierName":"z"}, "name": "z" }, "operator": "*", "right": { "type": "NumericLiteral", - "start": 37, - "end": 38, - "loc": { - "start": { - "line": 3, - "column": 14 - }, - "end": { - "line": 3, - "column": 15 - } - }, + "start":37,"end":38,"loc":{"start":{"line":3,"column":14},"end":{"line":3,"column":15}}, "extra": { "rawValue": 2, "raw": "2" diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-fsharp-arrow-in-body-no-parens-with-arg-parens/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-fsharp-arrow-in-body-no-parens-with-arg-parens/output.json index 06ac009ecf09..27d164f4e2fd 100644 --- a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-fsharp-arrow-in-body-no-parens-with-arg-parens/output.json +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-fsharp-arrow-in-body-no-parens-with-arg-parens/output.json @@ -1,212 +1,65 @@ { "type": "File", - "start": 0, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 40 - } - }, + "start":0,"end":40,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":40}}, "program": { "type": "Program", - "start": 0, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 40 - } - }, + "start":0,"end":40,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":40}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 40 - } - }, + "start":0,"end":40,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":40}}, "expression": { "type": "ArrowFunctionExpression", - "start": 0, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 40 - } - }, + "start":0,"end":40,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":40}}, "id": null, "generator": false, "async": false, "params": [ { "type": "Identifier", - "start": 1, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - }, - "identifierName": "x" - }, + "start":1,"end":2,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":2},"identifierName":"x"}, "name": "x" } ], "body": { "type": "BinaryExpression", - "start": 7, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 40 - } - }, + "start":7,"end":40,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":40}}, "left": { "type": "BinaryExpression", - "start": 7, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":7,"end":24,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":24}}, "left": { "type": "Identifier", - "start": 7, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - }, - "identifierName": "x" - }, + "start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8},"identifierName":"x"}, "name": "x" }, "operator": "|>", "right": { "type": "ArrowFunctionExpression", - "start": 12, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":12,"end":24,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":24}}, "id": null, "generator": false, "async": false, "params": [ { "type": "Identifier", - "start": 13, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - }, - "identifierName": "y" - }, + "start":13,"end":14,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":14},"identifierName":"y"}, "name": "y" } ], "body": { "type": "BinaryExpression", - "start": 19, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":19,"end":24,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":24}}, "left": { "type": "Identifier", - "start": 19, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 20 - }, - "identifierName": "y" - }, + "start":19,"end":20,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":20},"identifierName":"y"}, "name": "y" }, "operator": "+", "right": { "type": "NumericLiteral", - "start": 23, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":23,"end":24,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":24}}, "extra": { "rawValue": 1, "raw": "1" @@ -219,86 +72,29 @@ "operator": "|>", "right": { "type": "ArrowFunctionExpression", - "start": 28, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 40 - } - }, + "start":28,"end":40,"loc":{"start":{"line":1,"column":28},"end":{"line":1,"column":40}}, "id": null, "generator": false, "async": false, "params": [ { "type": "Identifier", - "start": 29, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 1, - "column": 30 - }, - "identifierName": "z" - }, + "start":29,"end":30,"loc":{"start":{"line":1,"column":29},"end":{"line":1,"column":30},"identifierName":"z"}, "name": "z" } ], "body": { "type": "BinaryExpression", - "start": 35, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 35 - }, - "end": { - "line": 1, - "column": 40 - } - }, + "start":35,"end":40,"loc":{"start":{"line":1,"column":35},"end":{"line":1,"column":40}}, "left": { "type": "Identifier", - "start": 35, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 35 - }, - "end": { - "line": 1, - "column": 36 - }, - "identifierName": "z" - }, + "start":35,"end":36,"loc":{"start":{"line":1,"column":35},"end":{"line":1,"column":36},"identifierName":"z"}, "name": "z" }, "operator": "*", "right": { "type": "NumericLiteral", - "start": 39, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 39 - }, - "end": { - "line": 1, - "column": 40 - } - }, + "start":39,"end":40,"loc":{"start":{"line":1,"column":39},"end":{"line":1,"column":40}}, "extra": { "rawValue": 2, "raw": "2" diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-fsharp-arrow-in-body-no-parens/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-fsharp-arrow-in-body-no-parens/output.json index 31cd9f27dc38..258054048024 100644 --- a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-fsharp-arrow-in-body-no-parens/output.json +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-fsharp-arrow-in-body-no-parens/output.json @@ -1,212 +1,65 @@ { "type": "File", - "start": 0, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, "program": { "type": "Program", - "start": 0, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, "expression": { "type": "ArrowFunctionExpression", - "start": 0, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, "id": null, "generator": false, "async": false, "params": [ { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" } ], "body": { "type": "BinaryExpression", - "start": 5, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":5,"end":34,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":34}}, "left": { "type": "BinaryExpression", - "start": 5, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":5,"end":20,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":20}}, "left": { "type": "Identifier", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "x" - }, + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"x"}, "name": "x" }, "operator": "|>", "right": { "type": "ArrowFunctionExpression", - "start": 10, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":10,"end":20,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":20}}, "id": null, "generator": false, "async": false, "params": [ { "type": "Identifier", - "start": 10, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "y" - }, + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11},"identifierName":"y"}, "name": "y" } ], "body": { "type": "BinaryExpression", - "start": 15, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":15,"end":20,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":20}}, "left": { "type": "Identifier", - "start": 15, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - }, - "identifierName": "y" - }, + "start":15,"end":16,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":16},"identifierName":"y"}, "name": "y" }, "operator": "+", "right": { "type": "NumericLiteral", - "start": 19, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":19,"end":20,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":20}}, "extra": { "rawValue": 1, "raw": "1" @@ -219,86 +72,29 @@ "operator": "|>", "right": { "type": "ArrowFunctionExpression", - "start": 24, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":24,"end":34,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":34}}, "id": null, "generator": false, "async": false, "params": [ { "type": "Identifier", - "start": 24, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 25 - }, - "identifierName": "z" - }, + "start":24,"end":25,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":25},"identifierName":"z"}, "name": "z" } ], "body": { "type": "BinaryExpression", - "start": 29, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":29,"end":34,"loc":{"start":{"line":1,"column":29},"end":{"line":1,"column":34}}, "left": { "type": "Identifier", - "start": 29, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 1, - "column": 30 - }, - "identifierName": "z" - }, + "start":29,"end":30,"loc":{"start":{"line":1,"column":29},"end":{"line":1,"column":30},"identifierName":"z"}, "name": "z" }, "operator": "*", "right": { "type": "NumericLiteral", - "start": 33, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 33 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":33,"end":34,"loc":{"start":{"line":1,"column":33},"end":{"line":1,"column":34}}, "extra": { "rawValue": 2, "raw": "2" diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-fsharp-await-end/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-fsharp-await-end/output.json index 49c1e410dc02..c3dac63fa751 100644 --- a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-fsharp-await-end/output.json +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-fsharp-await-end/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 47, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":47,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 47, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":47,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 47, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":47,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "id": { "type": "Identifier", - "start": 15, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 19 - }, - "identifierName": "test" - }, + "start":15,"end":19,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":19},"identifierName":"test"}, "name": "test" }, "generator": false, @@ -65,79 +20,23 @@ "params": [], "body": { "type": "BlockStatement", - "start": 23, - "end": 47, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":23,"end":47,"loc":{"start":{"line":1,"column":23},"end":{"line":3,"column":1}}, "body": [ { "type": "ReturnStatement", - "start": 27, - "end": 45, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 20 - } - }, + "start":27,"end":45,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":20}}, "argument": { "type": "BinaryExpression", - "start": 34, - "end": 44, - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 19 - } - }, + "start":34,"end":44,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":19}}, "left": { "type": "Identifier", - "start": 34, - "end": 35, - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 10 - }, - "identifierName": "x" - }, + "start":34,"end":35,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":10},"identifierName":"x"}, "name": "x" }, "operator": "|>", "right": { "type": "AwaitExpression", - "start": 39, - "end": 44, - "loc": { - "start": { - "line": 2, - "column": 14 - }, - "end": { - "line": 2, - "column": 19 - } - } + "start":39,"end":44,"loc":{"start":{"line":2,"column":14},"end":{"line":2,"column":19}} } } } diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-fsharp-await/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-fsharp-await/output.json index fa743ed7e4ad..07d38e5e3864 100644 --- a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-fsharp-await/output.json +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-fsharp-await/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 52, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":52,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 52, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":52,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 52, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":52,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "id": { "type": "Identifier", - "start": 15, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 19 - }, - "identifierName": "test" - }, + "start":15,"end":19,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":19},"identifierName":"test"}, "name": "test" }, "generator": false, @@ -65,111 +20,32 @@ "params": [], "body": { "type": "BlockStatement", - "start": 23, - "end": 52, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":23,"end":52,"loc":{"start":{"line":1,"column":23},"end":{"line":3,"column":1}}, "body": [ { "type": "ReturnStatement", - "start": 27, - "end": 50, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 25 - } - }, + "start":27,"end":50,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":25}}, "argument": { "type": "BinaryExpression", - "start": 34, - "end": 49, - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 24 - } - }, + "start":34,"end":49,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":24}}, "left": { "type": "BinaryExpression", - "start": 34, - "end": 44, - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 19 - } - }, + "start":34,"end":44,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":19}}, "left": { "type": "Identifier", - "start": 34, - "end": 35, - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 10 - }, - "identifierName": "x" - }, + "start":34,"end":35,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":10},"identifierName":"x"}, "name": "x" }, "operator": "|>", "right": { "type": "AwaitExpression", - "start": 39, - "end": 44, - "loc": { - "start": { - "line": 2, - "column": 14 - }, - "end": { - "line": 2, - "column": 19 - } - } + "start":39,"end":44,"loc":{"start":{"line":2,"column":14},"end":{"line":2,"column":19}} } }, "operator": "|>", "right": { "type": "Identifier", - "start": 48, - "end": 49, - "loc": { - "start": { - "line": 2, - "column": 23 - }, - "end": { - "line": 2, - "column": 24 - }, - "identifierName": "f" - }, + "start":48,"end":49,"loc":{"start":{"line":2,"column":23},"end":{"line":2,"column":24},"identifierName":"f"}, "name": "f" } } diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-fsharp-base/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-fsharp-base/output.json index fbf187592a3e..3660fb6254a4 100644 --- a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-fsharp-base/output.json +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-fsharp-base/output.json @@ -1,95 +1,27 @@ { "type": "File", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "program": { "type": "Program", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "expression": { "type": "BinaryExpression", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "a" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"a"}, "name": "a" }, "operator": "|>", "right": { "type": "Identifier", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "b" - }, + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"b"}, "name": "b" } } diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-fsharp-chain/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-fsharp-chain/output.json index 797dec673387..7099351a2e6d 100644 --- a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-fsharp-chain/output.json +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-fsharp-chain/output.json @@ -1,128 +1,37 @@ { "type": "File", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, "program": { "type": "Program", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, "expression": { "type": "BinaryExpression", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, "left": { "type": "BinaryExpression", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "operator": "|>", "right": { "type": "Identifier", - "start": 5, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 8 - }, - "identifierName": "inc" - }, + "start":5,"end":8,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":8},"identifierName":"inc"}, "name": "inc" } }, "operator": "|>", "right": { "type": "Identifier", - "start": 12, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 18 - }, - "identifierName": "double" - }, + "start":12,"end":18,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":18},"identifierName":"double"}, "name": "double" } } diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-minimal-await-requires-parens/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-minimal-await-requires-parens/output.json index ca6d697c465c..c18b78dc08b4 100644 --- a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-minimal-await-requires-parens/output.json +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-minimal-await-requires-parens/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 54, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":54,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 54, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":54,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 54, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":54,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "id": { "type": "Identifier", - "start": 15, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 18 - }, - "identifierName": "foo" - }, + "start":15,"end":18,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":18},"identifierName":"foo"}, "name": "foo" }, "generator": false, @@ -65,108 +20,29 @@ "params": [], "body": { "type": "BlockStatement", - "start": 21, - "end": 54, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":21,"end":54,"loc":{"start":{"line":1,"column":21},"end":{"line":3,"column":1}}, "body": [ { "type": "ReturnStatement", - "start": 25, - "end": 52, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 29 - } - }, + "start":25,"end":52,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":29}}, "argument": { "type": "BinaryExpression", - "start": 32, - "end": 51, - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 28 - } - }, + "start":32,"end":51,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":28}}, "left": { "type": "BinaryExpression", - "start": 32, - "end": 46, - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 23 - } - }, + "start":32,"end":46,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":23}}, "left": { "type": "Identifier", - "start": 32, - "end": 33, - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 10 - }, - "identifierName": "a" - }, + "start":32,"end":33,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":10},"identifierName":"a"}, "name": "a" }, "operator": "|>", "right": { "type": "AwaitExpression", - "start": 38, - "end": 45, - "loc": { - "start": { - "line": 2, - "column": 15 - }, - "end": { - "line": 2, - "column": 22 - } - }, + "start":38,"end":45,"loc":{"start":{"line":2,"column":15},"end":{"line":2,"column":22}}, "argument": { "type": "Identifier", - "start": 44, - "end": 45, - "loc": { - "start": { - "line": 2, - "column": 21 - }, - "end": { - "line": 2, - "column": 22 - }, - "identifierName": "f" - }, + "start":44,"end":45,"loc":{"start":{"line":2,"column":21},"end":{"line":2,"column":22},"identifierName":"f"}, "name": "f" }, "extra": { @@ -178,19 +54,7 @@ "operator": "|>", "right": { "type": "Identifier", - "start": 50, - "end": 51, - "loc": { - "start": { - "line": 2, - "column": 27 - }, - "end": { - "line": 2, - "column": 28 - }, - "identifierName": "g" - }, + "start":50,"end":51,"loc":{"start":{"line":2,"column":27},"end":{"line":2,"column":28},"identifierName":"g"}, "name": "g" } } diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-minimal-base/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-minimal-base/output.json index fbf187592a3e..3660fb6254a4 100644 --- a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-minimal-base/output.json +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-minimal-base/output.json @@ -1,95 +1,27 @@ { "type": "File", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "program": { "type": "Program", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "expression": { "type": "BinaryExpression", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "a" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"a"}, "name": "a" }, "operator": "|>", "right": { "type": "Identifier", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "b" - }, + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"b"}, "name": "b" } } diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-minimal-chain/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-minimal-chain/output.json index 4f7a815237e6..40519c9b3851 100644 --- a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-minimal-chain/output.json +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-minimal-chain/output.json @@ -1,164 +1,50 @@ { "type": "File", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "program": { "type": "Program", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "expression": { "type": "ArrowFunctionExpression", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "id": null, "generator": false, "async": false, "params": [ { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" } ], "body": { "type": "BinaryExpression", - "start": 5, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":5,"end":23,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":23}}, "left": { "type": "BinaryExpression", - "start": 5, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":5,"end":13,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":13}}, "left": { "type": "Identifier", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "x" - }, + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"x"}, "name": "x" }, "operator": "|>", "right": { "type": "Identifier", - "start": 10, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 13 - }, - "identifierName": "inc" - }, + "start":10,"end":13,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":13},"identifierName":"inc"}, "name": "inc" } }, "operator": "|>", "right": { "type": "Identifier", - "start": 17, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 23 - }, - "identifierName": "double" - }, + "start":17,"end":23,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":23},"identifierName":"double"}, "name": "double" } } diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-minimal-multiline/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-minimal-multiline/output.json index 8e5b51735864..d4653c73e6a9 100644 --- a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-minimal-multiline/output.json +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-minimal-multiline/output.json @@ -1,136 +1,36 @@ { "type": "File", - "start": 0, - "end": 65, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 13 - } - }, + "start":0,"end":65,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":13}}, "program": { "type": "Program", - "start": 0, - "end": 65, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 13 - } - }, + "start":0,"end":65,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":13}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 65, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 13 - } - }, + "start":0,"end":65,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":13}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 64, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 4, - "column": 12 - } - }, + "start":4,"end":64,"loc":{"start":{"line":1,"column":4},"end":{"line":4,"column":12}}, "id": { "type": "Identifier", - "start": 4, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 10 - }, - "identifierName": "result" - }, + "start":4,"end":10,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":10},"identifierName":"result"}, "name": "result" }, "init": { "type": "BinaryExpression", - "start": 13, - "end": 64, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 4, - "column": 12 - } - }, + "start":13,"end":64,"loc":{"start":{"line":1,"column":13},"end":{"line":4,"column":12}}, "left": { "type": "BinaryExpression", - "start": 13, - "end": 51, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 3, - "column": 15 - } - }, + "start":13,"end":51,"loc":{"start":{"line":1,"column":13},"end":{"line":3,"column":15}}, "left": { "type": "BinaryExpression", - "start": 13, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 2, - "column": 14 - } - }, + "start":13,"end":35,"loc":{"start":{"line":1,"column":13},"end":{"line":2,"column":14}}, "left": { "type": "StringLiteral", - "start": 13, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":13,"end":20,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":20}}, "extra": { "rawValue": "hello", "raw": "\"hello\"" @@ -140,57 +40,21 @@ "operator": "|>", "right": { "type": "Identifier", - "start": 26, - "end": 35, - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 14 - }, - "identifierName": "doubleSay" - }, + "start":26,"end":35,"loc":{"start":{"line":2,"column":5},"end":{"line":2,"column":14},"identifierName":"doubleSay"}, "name": "doubleSay" } }, "operator": "|>", "right": { "type": "Identifier", - "start": 41, - "end": 51, - "loc": { - "start": { - "line": 3, - "column": 5 - }, - "end": { - "line": 3, - "column": 15 - }, - "identifierName": "capitalize" - }, + "start":41,"end":51,"loc":{"start":{"line":3,"column":5},"end":{"line":3,"column":15},"identifierName":"capitalize"}, "name": "capitalize" } }, "operator": "|>", "right": { "type": "Identifier", - "start": 57, - "end": 64, - "loc": { - "start": { - "line": 4, - "column": 5 - }, - "end": { - "line": 4, - "column": 12 - }, - "identifierName": "exclaim" - }, + "start":57,"end":64,"loc":{"start":{"line":4,"column":5},"end":{"line":4,"column":12},"identifierName":"exclaim"}, "name": "exclaim" } } diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-minimal-precedence/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-minimal-precedence/output.json index 9a18738b065e..62cfba2b163e 100644 --- a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-minimal-precedence/output.json +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-minimal-precedence/output.json @@ -1,90 +1,24 @@ { "type": "File", - "start": 0, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 19 - } - }, + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":19}}, "program": { "type": "Program", - "start": 0, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 19 - } - }, + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":19}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "expression": { "type": "BinaryExpression", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "left": { "type": "LogicalExpression", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "left": { "type": "NumericLiteral", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1}}, "extra": { "rawValue": 4, "raw": "4" @@ -94,18 +28,7 @@ "operator": "||", "right": { "type": "NumericLiteral", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, "extra": { "rawValue": 9, "raw": "9" @@ -116,79 +39,23 @@ "operator": "|>", "right": { "type": "Identifier", - "start": 10, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 13 - }, - "identifierName": "inc" - }, + "start":10,"end":13,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":13},"identifierName":"inc"}, "name": "inc" } } }, { "type": "ExpressionStatement", - "start": 15, - "end": 34, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 19 - } - }, + "start":15,"end":34,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":19}}, "expression": { "type": "BinaryExpression", - "start": 15, - "end": 34, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 19 - } - }, + "start":15,"end":34,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":19}}, "left": { "type": "BinaryExpression", - "start": 15, - "end": 27, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 12 - } - }, + "start":15,"end":27,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":12}}, "left": { "type": "NumericLiteral", - "start": 15, - "end": 17, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 2 - } - }, + "start":15,"end":17,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":2}}, "extra": { "rawValue": 10, "raw": "10" @@ -198,51 +65,16 @@ "operator": "|>", "right": { "type": "LogicalExpression", - "start": 21, - "end": 27, - "loc": { - "start": { - "line": 2, - "column": 6 - }, - "end": { - "line": 2, - "column": 12 - } - }, + "start":21,"end":27,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":12}}, "left": { "type": "Identifier", - "start": 21, - "end": 22, - "loc": { - "start": { - "line": 2, - "column": 6 - }, - "end": { - "line": 2, - "column": 7 - }, - "identifierName": "f" - }, + "start":21,"end":22,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":7},"identifierName":"f"}, "name": "f" }, "operator": "||", "right": { "type": "Identifier", - "start": 26, - "end": 27, - "loc": { - "start": { - "line": 2, - "column": 11 - }, - "end": { - "line": 2, - "column": 12 - }, - "identifierName": "h" - }, + "start":26,"end":27,"loc":{"start":{"line":2,"column":11},"end":{"line":2,"column":12},"identifierName":"h"}, "name": "h" } } @@ -250,19 +82,7 @@ "operator": "|>", "right": { "type": "Identifier", - "start": 31, - "end": 34, - "loc": { - "start": { - "line": 2, - "column": 16 - }, - "end": { - "line": 2, - "column": 19 - }, - "identifierName": "inc" - }, + "start":31,"end":34,"loc":{"start":{"line":2,"column":16},"end":{"line":2,"column":19},"identifierName":"inc"}, "name": "inc" } } diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-minimal-with-arrow-parend-params/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-minimal-with-arrow-parend-params/output.json index 620abadb05de..0c2f55089a1f 100644 --- a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-minimal-with-arrow-parend-params/output.json +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-minimal-with-arrow-parend-params/output.json @@ -1,76 +1,21 @@ { "type": "File", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, "program": { "type": "Program", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, "expression": { "type": "BinaryExpression", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, "left": { "type": "NumericLiteral", - "start": 0, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 2 - } - }, + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}}, "extra": { "rawValue": 10, "raw": "10" @@ -80,86 +25,29 @@ "operator": "|>", "right": { "type": "ArrowFunctionExpression", - "start": 7, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":7,"end":19,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":19}}, "id": null, "generator": false, "async": false, "params": [ { "type": "Identifier", - "start": 8, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "x" - }, + "start":8,"end":9,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":9},"identifierName":"x"}, "name": "x" } ], "body": { "type": "BinaryExpression", - "start": 14, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":14,"end":19,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":19}}, "left": { "type": "Identifier", - "start": 14, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - }, - "identifierName": "x" - }, + "start":14,"end":15,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":15},"identifierName":"x"}, "name": "x" }, "operator": "+", "right": { "type": "NumericLiteral", - "start": 18, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":18,"end":19,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":19}}, "extra": { "rawValue": 1, "raw": "1" diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-minimal-with-arrow/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-minimal-with-arrow/output.json index 57c57f0f6376..1ce20aa52e6e 100644 --- a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-minimal-with-arrow/output.json +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-minimal-with-arrow/output.json @@ -1,76 +1,21 @@ { "type": "File", - "start": 0, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, "program": { "type": "Program", - "start": 0, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, "expression": { "type": "BinaryExpression", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, "left": { "type": "NumericLiteral", - "start": 0, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 2 - } - }, + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}}, "extra": { "rawValue": 10, "raw": "10" @@ -80,86 +25,29 @@ "operator": "|>", "right": { "type": "ArrowFunctionExpression", - "start": 7, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":7,"end":17,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":17}}, "id": null, "generator": false, "async": false, "params": [ { "type": "Identifier", - "start": 7, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - }, - "identifierName": "x" - }, + "start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8},"identifierName":"x"}, "name": "x" } ], "body": { "type": "BinaryExpression", - "start": 12, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":12,"end":17,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":17}}, "left": { "type": "Identifier", - "start": 12, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - }, - "identifierName": "x" - }, + "start":12,"end":13,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":13},"identifierName":"x"}, "name": "x" }, "operator": "+", "right": { "type": "NumericLiteral", - "start": 16, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":16,"end":17,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":17}}, "extra": { "rawValue": 1, "raw": "1" diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-bare-style,-function-calls,-chained,-multiline/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-bare-style,-function-calls,-chained,-multiline/output.json index 889bb7a69b62..a5c71deacef5 100644 --- a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-bare-style,-function-calls,-chained,-multiline/output.json +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-bare-style,-function-calls,-chained,-multiline/output.json @@ -1,136 +1,36 @@ { "type": "File", - "start": 0, - "end": 68, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 15 - } - }, + "start":0,"end":68,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":15}}, "program": { "type": "Program", - "start": 0, - "end": 68, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 15 - } - }, + "start":0,"end":68,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":15}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 68, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 15 - } - }, + "start":0,"end":68,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":15}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 67, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 4, - "column": 14 - } - }, + "start":4,"end":67,"loc":{"start":{"line":1,"column":4},"end":{"line":4,"column":14}}, "id": { "type": "Identifier", - "start": 4, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 10 - }, - "identifierName": "result" - }, + "start":4,"end":10,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":10},"identifierName":"result"}, "name": "result" }, "init": { "type": "BinaryExpression", - "start": 13, - "end": 67, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 4, - "column": 14 - } - }, + "start":13,"end":67,"loc":{"start":{"line":1,"column":13},"end":{"line":4,"column":14}}, "left": { "type": "BinaryExpression", - "start": 13, - "end": 52, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 3, - "column": 18 - } - }, + "start":13,"end":52,"loc":{"start":{"line":1,"column":13},"end":{"line":3,"column":18}}, "left": { "type": "BinaryExpression", - "start": 13, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 2, - "column": 12 - } - }, + "start":13,"end":33,"loc":{"start":{"line":1,"column":13},"end":{"line":2,"column":12}}, "left": { "type": "StringLiteral", - "start": 13, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":13,"end":20,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":20}}, "extra": { "rawValue": "hello", "raw": "\"hello\"" @@ -140,33 +40,10 @@ "operator": "|>", "right": { "type": "PipelineBareFunction", - "start": 24, - "end": 33, - "loc": { - "start": { - "line": 2, - "column": 3 - }, - "end": { - "line": 2, - "column": 12 - } - }, + "start":24,"end":33,"loc":{"start":{"line":2,"column":3},"end":{"line":2,"column":12}}, "callee": { "type": "Identifier", - "start": 24, - "end": 33, - "loc": { - "start": { - "line": 2, - "column": 3 - }, - "end": { - "line": 2, - "column": 12 - }, - "identifierName": "doubleSay" - }, + "start":24,"end":33,"loc":{"start":{"line":2,"column":3},"end":{"line":2,"column":12},"identifierName":"doubleSay"}, "name": "doubleSay" } } @@ -174,64 +51,18 @@ "operator": "|>", "right": { "type": "PipelineBareFunction", - "start": 37, - "end": 52, - "loc": { - "start": { - "line": 3, - "column": 3 - }, - "end": { - "line": 3, - "column": 18 - } - }, + "start":37,"end":52,"loc":{"start":{"line":3,"column":3},"end":{"line":3,"column":18}}, "callee": { "type": "MemberExpression", - "start": 37, - "end": 52, - "loc": { - "start": { - "line": 3, - "column": 3 - }, - "end": { - "line": 3, - "column": 18 - } - }, + "start":37,"end":52,"loc":{"start":{"line":3,"column":3},"end":{"line":3,"column":18}}, "object": { "type": "Identifier", - "start": 37, - "end": 41, - "loc": { - "start": { - "line": 3, - "column": 3 - }, - "end": { - "line": 3, - "column": 7 - }, - "identifierName": "text" - }, + "start":37,"end":41,"loc":{"start":{"line":3,"column":3},"end":{"line":3,"column":7},"identifierName":"text"}, "name": "text" }, "property": { "type": "Identifier", - "start": 42, - "end": 52, - "loc": { - "start": { - "line": 3, - "column": 8 - }, - "end": { - "line": 3, - "column": 18 - }, - "identifierName": "capitalize" - }, + "start":42,"end":52,"loc":{"start":{"line":3,"column":8},"end":{"line":3,"column":18},"identifierName":"capitalize"}, "name": "capitalize" }, "computed": false @@ -241,97 +72,28 @@ "operator": "|>", "right": { "type": "PipelineBareFunction", - "start": 56, - "end": 67, - "loc": { - "start": { - "line": 4, - "column": 3 - }, - "end": { - "line": 4, - "column": 14 - } - }, + "start":56,"end":67,"loc":{"start":{"line":4,"column":3},"end":{"line":4,"column":14}}, "callee": { "type": "MemberExpression", - "start": 56, - "end": 67, - "loc": { - "start": { - "line": 4, - "column": 3 - }, - "end": { - "line": 4, - "column": 14 - } - }, + "start":56,"end":67,"loc":{"start":{"line":4,"column":3},"end":{"line":4,"column":14}}, "object": { "type": "MemberExpression", - "start": 56, - "end": 59, - "loc": { - "start": { - "line": 4, - "column": 3 - }, - "end": { - "line": 4, - "column": 6 - } - }, + "start":56,"end":59,"loc":{"start":{"line":4,"column":3},"end":{"line":4,"column":6}}, "object": { "type": "Identifier", - "start": 56, - "end": 57, - "loc": { - "start": { - "line": 4, - "column": 3 - }, - "end": { - "line": 4, - "column": 4 - }, - "identifierName": "a" - }, + "start":56,"end":57,"loc":{"start":{"line":4,"column":3},"end":{"line":4,"column":4},"identifierName":"a"}, "name": "a" }, "property": { "type": "Identifier", - "start": 58, - "end": 59, - "loc": { - "start": { - "line": 4, - "column": 5 - }, - "end": { - "line": 4, - "column": 6 - }, - "identifierName": "b" - }, + "start":58,"end":59,"loc":{"start":{"line":4,"column":5},"end":{"line":4,"column":6},"identifierName":"b"}, "name": "b" }, "computed": false }, "property": { "type": "Identifier", - "start": 60, - "end": 67, - "loc": { - "start": { - "line": 4, - "column": 7 - }, - "end": { - "line": 4, - "column": 14 - }, - "identifierName": "exclaim" - }, + "start":60,"end":67,"loc":{"start":{"line":4,"column":7},"end":{"line":4,"column":14},"identifierName":"exclaim"}, "name": "exclaim" }, "computed": false diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-bare-style,-function-calls,-chained,-single-line-arrow-function/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-bare-style,-function-calls,-chained,-single-line-arrow-function/output.json index 71953d9db9ce..0827c20fe911 100644 --- a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-bare-style,-function-calls,-chained,-single-line-arrow-function/output.json +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-bare-style,-function-calls,-chained,-single-line-arrow-function/output.json @@ -1,190 +1,54 @@ { "type": "File", - "start": 0, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, "program": { "type": "Program", - "start": 0, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, "expression": { "type": "ArrowFunctionExpression", - "start": 0, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, "id": null, "generator": false, "async": false, "params": [ { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" } ], "body": { "type": "BinaryExpression", - "start": 5, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":5,"end":30,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":30}}, "left": { "type": "BinaryExpression", - "start": 5, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":5,"end":20,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":20}}, "left": { "type": "Identifier", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "x" - }, + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"x"}, "name": "x" }, "operator": "|>", "right": { "type": "PipelineBareFunction", - "start": 10, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":10,"end":20,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":20}}, "callee": { "type": "MemberExpression", - "start": 10, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":10,"end":20,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":20}}, "object": { "type": "Identifier", - "start": 10, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 16 - }, - "identifierName": "number" - }, + "start":10,"end":16,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":16},"identifierName":"number"}, "name": "number" }, "property": { "type": "Identifier", - "start": 17, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 20 - }, - "identifierName": "inc" - }, + "start":17,"end":20,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":20},"identifierName":"inc"}, "name": "inc" }, "computed": false @@ -194,33 +58,10 @@ "operator": "|>", "right": { "type": "PipelineBareFunction", - "start": 24, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":24,"end":30,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":30}}, "callee": { "type": "Identifier", - "start": 24, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 30 - }, - "identifierName": "double" - }, + "start":24,"end":30,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":30},"identifierName":"double"}, "name": "double" } } diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-bare-style,-function-calls,-single,-identifier/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-bare-style,-function-calls,-single,-identifier/output.json index 0aef90100fb5..2468104c6898 100644 --- a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-bare-style,-function-calls,-single,-identifier/output.json +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-bare-style,-function-calls,-single,-identifier/output.json @@ -1,109 +1,30 @@ { "type": "File", - "start": 0, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, "program": { "type": "Program", - "start": 0, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, "expression": { "type": "BinaryExpression", - "start": 0, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, "left": { "type": "Identifier", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "value" - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5},"identifierName":"value"}, "name": "value" }, "operator": "|>", "right": { "type": "PipelineBareFunction", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10}}, "callee": { "type": "Identifier", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - }, - "identifierName": "f" - }, + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"f"}, "name": "f" } } diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-bare-style,-function-calls,-single,-property/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-bare-style,-function-calls,-single,-property/output.json index 0fbd40308b71..8ae28448c08d 100644 --- a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-bare-style,-function-calls,-single,-property/output.json +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-bare-style,-function-calls,-single,-property/output.json @@ -1,206 +1,58 @@ { "type": "File", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "program": { "type": "Program", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "expression": { "type": "BinaryExpression", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "left": { "type": "Identifier", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "value" - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5},"identifierName":"value"}, "name": "value" }, "operator": "|>", "right": { "type": "PipelineBareFunction", - "start": 9, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":9,"end":16,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":16}}, "callee": { "type": "MemberExpression", - "start": 9, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":9,"end":16,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":16}}, "object": { "type": "MemberExpression", - "start": 9, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":9,"end":14,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":14}}, "object": { "type": "MemberExpression", - "start": 9, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":9,"end":12,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":12}}, "object": { "type": "Identifier", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - }, - "identifierName": "a" - }, + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"a"}, "name": "a" }, "property": { "type": "Identifier", - "start": 11, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "b" - }, + "start":11,"end":12,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":12},"identifierName":"b"}, "name": "b" }, "computed": false }, "property": { "type": "Identifier", - "start": 13, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - }, - "identifierName": "c" - }, + "start":13,"end":14,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":14},"identifierName":"c"}, "name": "c" }, "computed": false }, "property": { "type": "Identifier", - "start": 15, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - }, - "identifierName": "f" - }, + "start":15,"end":16,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":16},"identifierName":"f"}, "name": "f" }, "computed": false diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-bare-style,-head-with-topic-reference-pair/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-bare-style,-head-with-topic-reference-pair/options.json index cc2c16a778e7..279df0af85ba 100644 --- a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-bare-style,-head-with-topic-reference-pair/options.json +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-bare-style,-head-with-topic-reference-pair/options.json @@ -1,4 +1,10 @@ { - "plugins": [["pipelineOperator", { "proposal": "smart" }]], - "throws": "Pipeline head should not be a comma-separated sequence expression (1:0)" + "plugins": [ + [ + "pipelineOperator", + { + "proposal": "smart" + } + ] + ] } diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-bare-style,-head-with-topic-reference-pair/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-bare-style,-head-with-topic-reference-pair/output.json new file mode 100644 index 000000000000..21cf0ef9779b --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-bare-style,-head-with-topic-reference-pair/output.json @@ -0,0 +1,62 @@ +{ + "type": "File", + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "errors": [ + "SyntaxError: Pipeline head should not be a comma-separated sequence expression (1:0)" + ], + "program": { + "type": "Program", + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "expression": { + "type": "BinaryExpression", + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "left": { + "type": "SequenceExpression", + "start":1,"end":5,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":5}}, + "expressions": [ + { + "type": "NumericLiteral", + "start":1,"end":2,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":2}}, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + }, + { + "type": "NumericLiteral", + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5}}, + "extra": { + "rawValue": 2, + "raw": "2" + }, + "value": 2 + } + ], + "extra": { + "parenthesized": true, + "parenStart": 0 + } + }, + "operator": "|>", + "right": { + "type": "PipelineBareFunction", + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11}}, + "callee": { + "type": "Identifier", + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11},"identifierName":"f"}, + "name": "f" + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-nested-pipelines,-topic-style-with-arrow-function-with-bare-style,-no-outer-topic-reference/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-nested-pipelines,-topic-style-with-arrow-function-with-bare-style,-no-outer-topic-reference/options.json index d2b32f77521a..17e4e327bbad 100644 --- a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-nested-pipelines,-topic-style-with-arrow-function-with-bare-style,-no-outer-topic-reference/options.json +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-nested-pipelines,-topic-style-with-arrow-function-with-bare-style,-no-outer-topic-reference/options.json @@ -1,4 +1,3 @@ { - "plugins": [["pipelineOperator", { "proposal": "smart" }]], - "throws": "Pipeline is in topic style but does not use topic reference (1:5)" + "plugins": [["pipelineOperator", { "proposal": "smart" }]] } diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-nested-pipelines,-topic-style-with-arrow-function-with-bare-style,-no-outer-topic-reference/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-nested-pipelines,-topic-style-with-arrow-function-with-bare-style,-no-outer-topic-reference/output.json new file mode 100644 index 000000000000..d7262f7ab729 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-nested-pipelines,-topic-style-with-arrow-function-with-bare-style,-no-outer-topic-reference/output.json @@ -0,0 +1,71 @@ +{ + "type": "File", + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, + "errors": [ + "SyntaxError: Pipeline is in topic style but does not use topic reference (1:5)" + ], + "program": { + "type": "Program", + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, + "expression": { + "type": "BinaryExpression", + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, + "left": { + "type": "Identifier", + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, + "name": "x" + }, + "operator": "|>", + "right": { + "type": "PipelineTopicExpression", + "start":5,"end":18,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":18}}, + "expression": { + "type": "ArrowFunctionExpression", + "start":6,"end":17,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":17}}, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"$"}, + "name": "$" + } + ], + "body": { + "type": "BinaryExpression", + "start":11,"end":17,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":17}}, + "left": { + "type": "Identifier", + "start":11,"end":12,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":12},"identifierName":"$"}, + "name": "$" + }, + "operator": "|>", + "right": { + "type": "PipelineBareFunction", + "start":16,"end":17,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":17}}, + "callee": { + "type": "Identifier", + "start":16,"end":17,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":17},"identifierName":"f"}, + "name": "f" + } + } + }, + "extra": { + "parenthesized": true, + "parenStart": 5 + } + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-nested-pipelines,-topic-style-with-arrow-function-with-topic-style,-no-inner-topic-reference/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-nested-pipelines,-topic-style-with-arrow-function-with-topic-style,-no-inner-topic-reference/options.json index e9eab6b46fe9..17e4e327bbad 100644 --- a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-nested-pipelines,-topic-style-with-arrow-function-with-topic-style,-no-inner-topic-reference/options.json +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-nested-pipelines,-topic-style-with-arrow-function-with-topic-style,-no-inner-topic-reference/options.json @@ -1,4 +1,3 @@ { - "plugins": [["pipelineOperator", { "proposal": "smart" }]], - "throws": "Pipeline is in topic style but does not use topic reference (1:16)" + "plugins": [["pipelineOperator", { "proposal": "smart" }]] } diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-nested-pipelines,-topic-style-with-arrow-function-with-topic-style,-no-inner-topic-reference/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-nested-pipelines,-topic-style-with-arrow-function-with-topic-style,-no-inner-topic-reference/output.json new file mode 100644 index 000000000000..e8ce055d0d81 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-nested-pipelines,-topic-style-with-arrow-function-with-topic-style,-no-inner-topic-reference/output.json @@ -0,0 +1,84 @@ +{ + "type": "File", + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, + "errors": [ + "SyntaxError: Pipeline is in topic style but does not use topic reference (1:16)" + ], + "program": { + "type": "Program", + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, + "expression": { + "type": "BinaryExpression", + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, + "left": { + "type": "Identifier", + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, + "name": "x" + }, + "operator": "|>", + "right": { + "type": "PipelineTopicExpression", + "start":5,"end":22,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":22}}, + "expression": { + "type": "ArrowFunctionExpression", + "start":6,"end":21,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":21}}, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"$"}, + "name": "$" + } + ], + "body": { + "type": "BinaryExpression", + "start":11,"end":21,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":21}}, + "left": { + "type": "PipelinePrimaryTopicReference", + "start":11,"end":12,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":12}} + }, + "operator": "|>", + "right": { + "type": "PipelineTopicExpression", + "start":16,"end":21,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":21}}, + "expression": { + "type": "BinaryExpression", + "start":16,"end":21,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":21}}, + "left": { + "type": "Identifier", + "start":16,"end":17,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":17},"identifierName":"$"}, + "name": "$" + }, + "operator": "+", + "right": { + "type": "NumericLiteral", + "start":20,"end":21,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":21}}, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + } + }, + "extra": { + "parenthesized": true, + "parenStart": 5 + } + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-nested-pipelines,-topic-style-with-arrow-function-with-topic-style,-no-outer-topic-reference/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-nested-pipelines,-topic-style-with-arrow-function-with-topic-style,-no-outer-topic-reference/options.json index d2b32f77521a..17e4e327bbad 100644 --- a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-nested-pipelines,-topic-style-with-arrow-function-with-topic-style,-no-outer-topic-reference/options.json +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-nested-pipelines,-topic-style-with-arrow-function-with-topic-style,-no-outer-topic-reference/options.json @@ -1,4 +1,3 @@ { - "plugins": [["pipelineOperator", { "proposal": "smart" }]], - "throws": "Pipeline is in topic style but does not use topic reference (1:5)" + "plugins": [["pipelineOperator", { "proposal": "smart" }]] } diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-nested-pipelines,-topic-style-with-arrow-function-with-topic-style,-no-outer-topic-reference/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-nested-pipelines,-topic-style-with-arrow-function-with-topic-style,-no-outer-topic-reference/output.json new file mode 100644 index 000000000000..1c55597d1ea8 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-nested-pipelines,-topic-style-with-arrow-function-with-topic-style,-no-outer-topic-reference/output.json @@ -0,0 +1,70 @@ +{ + "type": "File", + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, + "errors": [ + "SyntaxError: Pipeline is in topic style but does not use topic reference (1:5)" + ], + "program": { + "type": "Program", + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, + "expression": { + "type": "BinaryExpression", + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, + "left": { + "type": "Identifier", + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, + "name": "x" + }, + "operator": "|>", + "right": { + "type": "PipelineTopicExpression", + "start":5,"end":18,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":18}}, + "expression": { + "type": "ArrowFunctionExpression", + "start":6,"end":17,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":17}}, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"$"}, + "name": "$" + } + ], + "body": { + "type": "BinaryExpression", + "start":11,"end":17,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":17}}, + "left": { + "type": "Identifier", + "start":11,"end":12,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":12},"identifierName":"$"}, + "name": "$" + }, + "operator": "|>", + "right": { + "type": "PipelineTopicExpression", + "start":16,"end":17,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":17}}, + "expression": { + "type": "PipelinePrimaryTopicReference", + "start":16,"end":17,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":17}} + } + } + }, + "extra": { + "parenthesized": true, + "parenStart": 5 + } + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-nested-pipelines,-topic-style-with-inner-topic-style,-no-inner-topic-reference/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-nested-pipelines,-topic-style-with-inner-topic-style,-no-inner-topic-reference/options.json index bdf0547df8f9..17e4e327bbad 100644 --- a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-nested-pipelines,-topic-style-with-inner-topic-style,-no-inner-topic-reference/options.json +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-nested-pipelines,-topic-style-with-inner-topic-style,-no-inner-topic-reference/options.json @@ -1,4 +1,3 @@ { - "plugins": [["pipelineOperator", { "proposal": "smart" }]], - "throws": "Pipeline is in topic style but does not use topic reference (1:11)" + "plugins": [["pipelineOperator", { "proposal": "smart" }]] } diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-nested-pipelines,-topic-style-with-inner-topic-style,-no-inner-topic-reference/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-nested-pipelines,-topic-style-with-inner-topic-style,-no-inner-topic-reference/output.json new file mode 100644 index 000000000000..4e08420cc88a --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-nested-pipelines,-topic-style-with-inner-topic-style,-no-inner-topic-reference/output.json @@ -0,0 +1,61 @@ +{ + "type": "File", + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, + "errors": [ + "SyntaxError: Pipeline is in topic style but does not use topic reference (1:11)" + ], + "program": { + "type": "Program", + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, + "expression": { + "type": "BinaryExpression", + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, + "left": { + "type": "Identifier", + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, + "name": "x" + }, + "operator": "|>", + "right": { + "type": "PipelineTopicExpression", + "start":5,"end":15,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":15}}, + "expression": { + "type": "BinaryExpression", + "start":6,"end":14,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":14}}, + "left": { + "type": "PipelinePrimaryTopicReference", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7}} + }, + "operator": "|>", + "right": { + "type": "PipelineTopicExpression", + "start":11,"end":14,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":14}}, + "expression": { + "type": "CallExpression", + "start":11,"end":14,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":14}}, + "callee": { + "type": "Identifier", + "start":11,"end":12,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":12},"identifierName":"f"}, + "name": "f" + }, + "arguments": [] + } + }, + "extra": { + "parenthesized": true, + "parenStart": 5 + } + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-nested-pipelines,-topic-style-with-inner-topic-style,-no-outer-topic-reference/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-nested-pipelines,-topic-style-with-inner-topic-style,-no-outer-topic-reference/options.json index d2b32f77521a..17e4e327bbad 100644 --- a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-nested-pipelines,-topic-style-with-inner-topic-style,-no-outer-topic-reference/options.json +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-nested-pipelines,-topic-style-with-inner-topic-style,-no-outer-topic-reference/options.json @@ -1,4 +1,3 @@ { - "plugins": [["pipelineOperator", { "proposal": "smart" }]], - "throws": "Pipeline is in topic style but does not use topic reference (1:5)" + "plugins": [["pipelineOperator", { "proposal": "smart" }]] } diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-nested-pipelines,-topic-style-with-inner-topic-style,-no-outer-topic-reference/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-nested-pipelines,-topic-style-with-inner-topic-style,-no-outer-topic-reference/output.json new file mode 100644 index 000000000000..9c89df8ebff9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-nested-pipelines,-topic-style-with-inner-topic-style,-no-outer-topic-reference/output.json @@ -0,0 +1,57 @@ +{ + "type": "File", + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "errors": [ + "SyntaxError: Pipeline is in topic style but does not use topic reference (1:5)" + ], + "program": { + "type": "Program", + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "expression": { + "type": "BinaryExpression", + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "left": { + "type": "Identifier", + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, + "name": "x" + }, + "operator": "|>", + "right": { + "type": "PipelineTopicExpression", + "start":5,"end":13,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":13}}, + "expression": { + "type": "BinaryExpression", + "start":6,"end":12,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":12}}, + "left": { + "type": "Identifier", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"$"}, + "name": "$" + }, + "operator": "|>", + "right": { + "type": "PipelineBareFunction", + "start":11,"end":12,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":12}}, + "callee": { + "type": "Identifier", + "start":11,"end":12,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":12},"identifierName":"f"}, + "name": "f" + } + }, + "extra": { + "parenthesized": true, + "parenStart": 5 + } + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-sequence-style,-body-with-topic-reference-pair-followed-by-bare-style-pipeline-body/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-sequence-style,-body-with-topic-reference-pair-followed-by-bare-style-pipeline-body/options.json index fe3873ecc67f..279df0af85ba 100644 --- a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-sequence-style,-body-with-topic-reference-pair-followed-by-bare-style-pipeline-body/options.json +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-sequence-style,-body-with-topic-reference-pair-followed-by-bare-style-pipeline-body/options.json @@ -1,4 +1,10 @@ { - "plugins": [["pipelineOperator", { "proposal": "smart" }]], - "throws": "Pipeline body may not be a comma-separated sequence expression (1:6)" + "plugins": [ + [ + "pipelineOperator", + { + "proposal": "smart" + } + ] + ] } diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-sequence-style,-body-with-topic-reference-pair-followed-by-bare-style-pipeline-body/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-sequence-style,-body-with-topic-reference-pair-followed-by-bare-style-pipeline-body/output.json new file mode 100644 index 000000000000..f4a75092e3cf --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-sequence-style,-body-with-topic-reference-pair-followed-by-bare-style-pipeline-body/output.json @@ -0,0 +1,70 @@ +{ + "type": "File", + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, + "errors": [ + "SyntaxError: Pipeline body may not be a comma-separated sequence expression (1:6)" + ], + "program": { + "type": "Program", + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, + "expression": { + "type": "BinaryExpression", + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, + "left": { + "type": "BinaryExpression", + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "left": { + "type": "NumericLiteral", + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}}, + "extra": { + "rawValue": 10, + "raw": "10" + }, + "value": 10 + }, + "operator": "|>", + "right": { + "type": "PipelineTopicExpression", + "start":6,"end":12,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":12}}, + "expression": { + "type": "SequenceExpression", + "start":7,"end":11,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":11}}, + "expressions": [ + { + "type": "PipelinePrimaryTopicReference", + "start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8}} + }, + { + "type": "PipelinePrimaryTopicReference", + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11}} + } + ], + "extra": { + "parenthesized": true, + "parenStart": 6 + } + } + } + }, + "operator": "|>", + "right": { + "type": "PipelineBareFunction", + "start":16,"end":17,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":17}}, + "callee": { + "type": "Identifier", + "start":16,"end":17,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":17},"identifierName":"h"}, + "name": "h" + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-sequence-style,-body-with-topic-reference-pair-then-end/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-sequence-style,-body-with-topic-reference-pair-then-end/options.json index fe3873ecc67f..279df0af85ba 100644 --- a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-sequence-style,-body-with-topic-reference-pair-then-end/options.json +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-sequence-style,-body-with-topic-reference-pair-then-end/options.json @@ -1,4 +1,10 @@ { - "plugins": [["pipelineOperator", { "proposal": "smart" }]], - "throws": "Pipeline body may not be a comma-separated sequence expression (1:6)" + "plugins": [ + [ + "pipelineOperator", + { + "proposal": "smart" + } + ] + ] } diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-sequence-style,-body-with-topic-reference-pair-then-end/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-sequence-style,-body-with-topic-reference-pair-then-end/output.json new file mode 100644 index 000000000000..c774d9cb44f7 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-sequence-style,-body-with-topic-reference-pair-then-end/output.json @@ -0,0 +1,56 @@ +{ + "type": "File", + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "errors": [ + "SyntaxError: Pipeline body may not be a comma-separated sequence expression (1:6)" + ], + "program": { + "type": "Program", + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "expression": { + "type": "BinaryExpression", + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "left": { + "type": "NumericLiteral", + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}}, + "extra": { + "rawValue": 10, + "raw": "10" + }, + "value": 10 + }, + "operator": "|>", + "right": { + "type": "PipelineTopicExpression", + "start":6,"end":12,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":12}}, + "expression": { + "type": "SequenceExpression", + "start":7,"end":11,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":11}}, + "expressions": [ + { + "type": "PipelinePrimaryTopicReference", + "start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8}} + }, + { + "type": "PipelinePrimaryTopicReference", + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11}} + } + ], + "extra": { + "parenthesized": true, + "parenStart": 6 + } + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-computed,-no-topic-reference/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-computed,-no-topic-reference/options.json index 7a4451381c91..17e4e327bbad 100644 --- a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-computed,-no-topic-reference/options.json +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-computed,-no-topic-reference/options.json @@ -1,4 +1,3 @@ { - "plugins": [["pipelineOperator", { "proposal": "smart" }]], - "throws": "Pipeline is in topic style but does not use topic reference (1:9)" + "plugins": [["pipelineOperator", { "proposal": "smart" }]] } diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-computed,-no-topic-reference/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-computed,-no-topic-reference/output.json new file mode 100644 index 000000000000..556699d07afc --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-computed,-no-topic-reference/output.json @@ -0,0 +1,49 @@ +{ + "type": "File", + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "errors": [ + "SyntaxError: Pipeline is in topic style but does not use topic reference (1:9)" + ], + "program": { + "type": "Program", + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "expression": { + "type": "BinaryExpression", + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "left": { + "type": "Identifier", + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5},"identifierName":"value"}, + "name": "value" + }, + "operator": "|>", + "right": { + "type": "PipelineTopicExpression", + "start":9,"end":13,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":13}}, + "expression": { + "type": "MemberExpression", + "start":9,"end":13,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":13}}, + "object": { + "type": "Identifier", + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"a"}, + "name": "a" + }, + "property": { + "type": "Identifier", + "start":11,"end":12,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":12},"identifierName":"b"}, + "name": "b" + }, + "computed": true + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-no-topic-reference,-addition/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-no-topic-reference,-addition/options.json index 7a4451381c91..17e4e327bbad 100644 --- a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-no-topic-reference,-addition/options.json +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-no-topic-reference,-addition/options.json @@ -1,4 +1,3 @@ { - "plugins": [["pipelineOperator", { "proposal": "smart" }]], - "throws": "Pipeline is in topic style but does not use topic reference (1:9)" + "plugins": [["pipelineOperator", { "proposal": "smart" }]] } diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-no-topic-reference,-addition/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-no-topic-reference,-addition/output.json new file mode 100644 index 000000000000..6e09acd357ab --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-no-topic-reference,-addition/output.json @@ -0,0 +1,49 @@ +{ + "type": "File", + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, + "errors": [ + "SyntaxError: Pipeline is in topic style but does not use topic reference (1:9)" + ], + "program": { + "type": "Program", + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, + "expression": { + "type": "BinaryExpression", + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, + "left": { + "type": "Identifier", + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5},"identifierName":"value"}, + "name": "value" + }, + "operator": "|>", + "right": { + "type": "PipelineTopicExpression", + "start":9,"end":14,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":14}}, + "expression": { + "type": "BinaryExpression", + "start":9,"end":14,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":14}}, + "left": { + "type": "Identifier", + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"a"}, + "name": "a" + }, + "operator": "+", + "right": { + "type": "Identifier", + "start":13,"end":14,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":14},"identifierName":"b"}, + "name": "b" + } + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-no-topic-reference,-class-expression/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-no-topic-reference,-class-expression/options.json index 7a4451381c91..17e4e327bbad 100644 --- a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-no-topic-reference,-class-expression/options.json +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-no-topic-reference,-class-expression/options.json @@ -1,4 +1,3 @@ { - "plugins": [["pipelineOperator", { "proposal": "smart" }]], - "throws": "Pipeline is in topic style but does not use topic reference (1:9)" + "plugins": [["pipelineOperator", { "proposal": "smart" }]] } diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-no-topic-reference,-class-expression/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-no-topic-reference,-class-expression/output.json new file mode 100644 index 000000000000..4c0d88c5a719 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-no-topic-reference,-class-expression/output.json @@ -0,0 +1,45 @@ +{ + "type": "File", + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, + "errors": [ + "SyntaxError: Pipeline is in topic style but does not use topic reference (1:9)" + ], + "program": { + "type": "Program", + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, + "expression": { + "type": "BinaryExpression", + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, + "left": { + "type": "Identifier", + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5},"identifierName":"value"}, + "name": "value" + }, + "operator": "|>", + "right": { + "type": "PipelineTopicExpression", + "start":9,"end":18,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":18}}, + "expression": { + "type": "ClassExpression", + "start":9,"end":18,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":18}}, + "id": null, + "superClass": null, + "body": { + "type": "ClassBody", + "start":15,"end":18,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":18}}, + "body": [] + } + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-no-topic-reference,-function-expression/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-no-topic-reference,-function-expression/options.json index 7a4451381c91..17e4e327bbad 100644 --- a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-no-topic-reference,-function-expression/options.json +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-no-topic-reference,-function-expression/options.json @@ -1,4 +1,3 @@ { - "plugins": [["pipelineOperator", { "proposal": "smart" }]], - "throws": "Pipeline is in topic style but does not use topic reference (1:9)" + "plugins": [["pipelineOperator", { "proposal": "smart" }]] } diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-no-topic-reference,-function-expression/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-no-topic-reference,-function-expression/output.json new file mode 100644 index 000000000000..18fa5a9166ad --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-no-topic-reference,-function-expression/output.json @@ -0,0 +1,60 @@ +{ + "type": "File", + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, + "errors": [ + "SyntaxError: Pipeline is in topic style but does not use topic reference (1:9)" + ], + "program": { + "type": "Program", + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, + "expression": { + "type": "BinaryExpression", + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, + "left": { + "type": "Identifier", + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5},"identifierName":"value"}, + "name": "value" + }, + "operator": "|>", + "right": { + "type": "PipelineTopicExpression", + "start":9,"end":33,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":33}}, + "expression": { + "type": "FunctionExpression", + "start":9,"end":33,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":33}}, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start":19,"end":20,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":20},"identifierName":"x"}, + "name": "x" + } + ], + "body": { + "type": "BlockStatement", + "start":22,"end":33,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":33}}, + "body": [ + { + "type": "ReturnStatement", + "start":24,"end":31,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":31}}, + "argument": null + } + ], + "directives": [] + } + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-do-while-loop,-outer-topic-reference-in-loop-body/input.js b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-do-while-loop,-outer-topic-reference-in-loop-body/input.js index c1005576b7d5..8b34c84f521f 100644 --- a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-do-while-loop,-outer-topic-reference-in-loop-body/input.js +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-do-while-loop,-outer-topic-reference-in-loop-body/input.js @@ -1 +1 @@ -value |> do { do x += # while (x < 50); } +value |> do { do x += #; while (x < 50); } diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-do-while-loop,-outer-topic-reference-in-loop-body/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-do-while-loop,-outer-topic-reference-in-loop-body/options.json index 3b7a52d71cf7..edb7679c6a74 100644 --- a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-do-while-loop,-outer-topic-reference-in-loop-body/options.json +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-do-while-loop,-outer-topic-reference-in-loop-body/options.json @@ -1,4 +1,3 @@ { - "plugins": [["pipelineOperator", { "proposal": "smart" }], "doExpressions"], - "throws": "Topic reference was used in a lexical context without topic binding (1:22)" + "plugins": [["pipelineOperator", { "proposal": "smart" }], "doExpressions"] } diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-do-while-loop,-outer-topic-reference-in-loop-body/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-do-while-loop,-outer-topic-reference-in-loop-body/output.json new file mode 100644 index 000000000000..06a45df42fac --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-do-while-loop,-outer-topic-reference-in-loop-body/output.json @@ -0,0 +1,87 @@ +{ + "type": "File", + "start":0,"end":42,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":42}}, + "errors": [ + "SyntaxError: Topic reference was used in a lexical context without topic binding (1:22)", + "SyntaxError: Pipeline is in topic style but does not use topic reference (1:9)" + ], + "program": { + "type": "Program", + "start":0,"end":42,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":42}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":42,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":42}}, + "expression": { + "type": "BinaryExpression", + "start":0,"end":42,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":42}}, + "left": { + "type": "Identifier", + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5},"identifierName":"value"}, + "name": "value" + }, + "operator": "|>", + "right": { + "type": "PipelineTopicExpression", + "start":9,"end":42,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":42}}, + "expression": { + "type": "DoExpression", + "start":9,"end":42,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":42}}, + "body": { + "type": "BlockStatement", + "start":12,"end":42,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":42}}, + "body": [ + { + "type": "DoWhileStatement", + "start":14,"end":40,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":40}}, + "body": { + "type": "ExpressionStatement", + "start":17,"end":24,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":24}}, + "expression": { + "type": "AssignmentExpression", + "start":17,"end":23,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":23}}, + "operator": "+=", + "left": { + "type": "Identifier", + "start":17,"end":18,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":18},"identifierName":"x"}, + "name": "x" + }, + "right": { + "type": "PipelinePrimaryTopicReference", + "start":22,"end":23,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":23}} + } + } + }, + "test": { + "type": "BinaryExpression", + "start":32,"end":38,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":38}}, + "left": { + "type": "Identifier", + "start":32,"end":33,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":33},"identifierName":"x"}, + "name": "x" + }, + "operator": "<", + "right": { + "type": "NumericLiteral", + "start":36,"end":38,"loc":{"start":{"line":1,"column":36},"end":{"line":1,"column":38}}, + "extra": { + "rawValue": 50, + "raw": "50" + }, + "value": 50 + } + } + } + ], + "directives": [] + } + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-for-await-of-loop,-outer-topic-reference-in-loop-body/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-for-await-of-loop,-outer-topic-reference-in-loop-body/options.json index d117d235099d..680f780892b7 100644 --- a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-for-await-of-loop,-outer-topic-reference-in-loop-body/options.json +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-for-await-of-loop,-outer-topic-reference-in-loop-body/options.json @@ -3,6 +3,5 @@ ["pipelineOperator", { "proposal": "smart" }], "doExpressions", "asyncGenerators" - ], - "throws": "Topic reference was used in a lexical context without topic binding (2:48)" + ] } diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-for-await-of-loop,-outer-topic-reference-in-loop-body/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-for-await-of-loop,-outer-topic-reference-in-loop-body/output.json new file mode 100644 index 000000000000..e673a7df67c9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-for-await-of-loop,-outer-topic-reference-in-loop-body/output.json @@ -0,0 +1,100 @@ +{ + "type": "File", + "start":0,"end":77,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "errors": [ + "SyntaxError: Topic reference was used in a lexical context without topic binding (2:48)", + "SyntaxError: Pipeline is in topic style but does not use topic reference (2:11)" + ], + "program": { + "type": "Program", + "start":0,"end":77,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":77,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "id": { + "type": "Identifier", + "start":15,"end":17,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":17},"identifierName":"af"}, + "name": "af" + }, + "generator": false, + "async": true, + "params": [], + "body": { + "type": "BlockStatement", + "start":21,"end":77,"loc":{"start":{"line":1,"column":21},"end":{"line":3,"column":1}}, + "body": [ + { + "type": "ExpressionStatement", + "start":25,"end":75,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":52}}, + "expression": { + "type": "BinaryExpression", + "start":25,"end":75,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":52}}, + "left": { + "type": "Identifier", + "start":25,"end":30,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":7},"identifierName":"value"}, + "name": "value" + }, + "operator": "|>", + "right": { + "type": "PipelineTopicExpression", + "start":34,"end":75,"loc":{"start":{"line":2,"column":11},"end":{"line":2,"column":52}}, + "expression": { + "type": "DoExpression", + "start":34,"end":75,"loc":{"start":{"line":2,"column":11},"end":{"line":2,"column":52}}, + "body": { + "type": "BlockStatement", + "start":37,"end":75,"loc":{"start":{"line":2,"column":14},"end":{"line":2,"column":52}}, + "body": [ + { + "type": "ForOfStatement", + "start":39,"end":73,"loc":{"start":{"line":2,"column":16},"end":{"line":2,"column":50}}, + "await": true, + "left": { + "type": "VariableDeclaration", + "start":50,"end":57,"loc":{"start":{"line":2,"column":27},"end":{"line":2,"column":34}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":56,"end":57,"loc":{"start":{"line":2,"column":33},"end":{"line":2,"column":34}}, + "id": { + "type": "Identifier", + "start":56,"end":57,"loc":{"start":{"line":2,"column":33},"end":{"line":2,"column":34},"identifierName":"e"}, + "name": "e" + }, + "init": null + } + ], + "kind": "const" + }, + "right": { + "type": "Identifier", + "start":61,"end":69,"loc":{"start":{"line":2,"column":38},"end":{"line":2,"column":46},"identifierName":"sequence"}, + "name": "sequence" + }, + "body": { + "type": "ExpressionStatement", + "start":71,"end":73,"loc":{"start":{"line":2,"column":48},"end":{"line":2,"column":50}}, + "expression": { + "type": "PipelinePrimaryTopicReference", + "start":71,"end":72,"loc":{"start":{"line":2,"column":48},"end":{"line":2,"column":49}} + } + } + } + ], + "directives": [] + } + } + } + } + } + ], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-for-classic-loop,-outer-topic-reference-in-loop-body/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-for-classic-loop,-outer-topic-reference-in-loop-body/options.json index 35e8658a93da..edb7679c6a74 100644 --- a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-for-classic-loop,-outer-topic-reference-in-loop-body/options.json +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-for-classic-loop,-outer-topic-reference-in-loop-body/options.json @@ -1,4 +1,3 @@ { - "plugins": [["pipelineOperator", { "proposal": "smart" }], "doExpressions"], - "throws": "Topic reference was used in a lexical context without topic binding (1:45)" + "plugins": [["pipelineOperator", { "proposal": "smart" }], "doExpressions"] } diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-for-classic-loop,-outer-topic-reference-in-loop-body/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-for-classic-loop,-outer-topic-reference-in-loop-body/output.json new file mode 100644 index 000000000000..b413aeb837f3 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-for-classic-loop,-outer-topic-reference-in-loop-body/output.json @@ -0,0 +1,117 @@ +{ + "type": "File", + "start":0,"end":49,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":49}}, + "errors": [ + "SyntaxError: Topic reference was used in a lexical context without topic binding (1:45)", + "SyntaxError: Pipeline is in topic style but does not use topic reference (1:9)" + ], + "program": { + "type": "Program", + "start":0,"end":49,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":49}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":49,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":49}}, + "expression": { + "type": "BinaryExpression", + "start":0,"end":49,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":49}}, + "left": { + "type": "Identifier", + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5},"identifierName":"value"}, + "name": "value" + }, + "operator": "|>", + "right": { + "type": "PipelineTopicExpression", + "start":9,"end":49,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":49}}, + "expression": { + "type": "DoExpression", + "start":9,"end":49,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":49}}, + "body": { + "type": "BlockStatement", + "start":12,"end":49,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":49}}, + "body": [ + { + "type": "ForStatement", + "start":14,"end":47,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":47}}, + "init": { + "type": "VariableDeclaration", + "start":19,"end":28,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":28}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":23,"end":28,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":28}}, + "id": { + "type": "Identifier", + "start":23,"end":24,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":24},"identifierName":"i"}, + "name": "i" + }, + "init": { + "type": "NumericLiteral", + "start":27,"end":28,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":28}}, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + } + ], + "kind": "let" + }, + "test": { + "type": "BinaryExpression", + "start":30,"end":35,"loc":{"start":{"line":1,"column":30},"end":{"line":1,"column":35}}, + "left": { + "type": "Identifier", + "start":30,"end":31,"loc":{"start":{"line":1,"column":30},"end":{"line":1,"column":31},"identifierName":"i"}, + "name": "i" + }, + "operator": "<", + "right": { + "type": "Identifier", + "start":34,"end":35,"loc":{"start":{"line":1,"column":34},"end":{"line":1,"column":35},"identifierName":"n"}, + "name": "n" + } + }, + "update": { + "type": "AssignmentExpression", + "start":37,"end":43,"loc":{"start":{"line":1,"column":37},"end":{"line":1,"column":43}}, + "operator": "+=", + "left": { + "type": "Identifier", + "start":37,"end":38,"loc":{"start":{"line":1,"column":37},"end":{"line":1,"column":38},"identifierName":"i"}, + "name": "i" + }, + "right": { + "type": "NumericLiteral", + "start":42,"end":43,"loc":{"start":{"line":1,"column":42},"end":{"line":1,"column":43}}, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + }, + "body": { + "type": "ExpressionStatement", + "start":45,"end":47,"loc":{"start":{"line":1,"column":45},"end":{"line":1,"column":47}}, + "expression": { + "type": "PipelinePrimaryTopicReference", + "start":45,"end":46,"loc":{"start":{"line":1,"column":45},"end":{"line":1,"column":46}} + } + } + } + ], + "directives": [] + } + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-for-in-loop,-outer-topic-reference-in-loop-body/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-for-in-loop,-outer-topic-reference-in-loop-body/options.json index 6e8b4a6f0d95..edb7679c6a74 100644 --- a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-for-in-loop,-outer-topic-reference-in-loop-body/options.json +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-for-in-loop,-outer-topic-reference-in-loop-body/options.json @@ -1,4 +1,3 @@ { - "plugins": [["pipelineOperator", { "proposal": "smart" }], "doExpressions"], - "throws": "Topic reference was used in a lexical context without topic binding (1:32)" + "plugins": [["pipelineOperator", { "proposal": "smart" }], "doExpressions"] } diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-for-in-loop,-outer-topic-reference-in-loop-body/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-for-in-loop,-outer-topic-reference-in-loop-body/output.json new file mode 100644 index 000000000000..f907f6c39b60 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-for-in-loop,-outer-topic-reference-in-loop-body/output.json @@ -0,0 +1,68 @@ +{ + "type": "File", + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, + "errors": [ + "SyntaxError: Topic reference was used in a lexical context without topic binding (1:32)", + "SyntaxError: Pipeline is in topic style but does not use topic reference (1:9)" + ], + "program": { + "type": "Program", + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, + "expression": { + "type": "BinaryExpression", + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, + "left": { + "type": "Identifier", + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5},"identifierName":"value"}, + "name": "value" + }, + "operator": "|>", + "right": { + "type": "PipelineTopicExpression", + "start":9,"end":36,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":36}}, + "expression": { + "type": "DoExpression", + "start":9,"end":36,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":36}}, + "body": { + "type": "BlockStatement", + "start":12,"end":36,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":36}}, + "body": [ + { + "type": "ForInStatement", + "start":14,"end":34,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":34}}, + "left": { + "type": "Identifier", + "start":19,"end":20,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":20},"identifierName":"e"}, + "name": "e" + }, + "right": { + "type": "Identifier", + "start":24,"end":30,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":30},"identifierName":"object"}, + "name": "object" + }, + "body": { + "type": "ExpressionStatement", + "start":32,"end":34,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":34}}, + "expression": { + "type": "PipelinePrimaryTopicReference", + "start":32,"end":33,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":33}} + } + } + } + ], + "directives": [] + } + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-for-of-loop,-outer-topic-reference-in-loop-body/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-for-of-loop,-outer-topic-reference-in-loop-body/options.json index a3707cc91710..edb7679c6a74 100644 --- a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-for-of-loop,-outer-topic-reference-in-loop-body/options.json +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-for-of-loop,-outer-topic-reference-in-loop-body/options.json @@ -1,4 +1,3 @@ { - "plugins": [["pipelineOperator", { "proposal": "smart" }], "doExpressions"], - "throws": "Topic reference was used in a lexical context without topic binding (1:34)" + "plugins": [["pipelineOperator", { "proposal": "smart" }], "doExpressions"] } diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-for-of-loop,-outer-topic-reference-in-loop-body/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-for-of-loop,-outer-topic-reference-in-loop-body/output.json new file mode 100644 index 000000000000..b5610cbd5590 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-for-of-loop,-outer-topic-reference-in-loop-body/output.json @@ -0,0 +1,69 @@ +{ + "type": "File", + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":38}}, + "errors": [ + "SyntaxError: Topic reference was used in a lexical context without topic binding (1:34)", + "SyntaxError: Pipeline is in topic style but does not use topic reference (1:9)" + ], + "program": { + "type": "Program", + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":38}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":38}}, + "expression": { + "type": "BinaryExpression", + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":38}}, + "left": { + "type": "Identifier", + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5},"identifierName":"value"}, + "name": "value" + }, + "operator": "|>", + "right": { + "type": "PipelineTopicExpression", + "start":9,"end":38,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":38}}, + "expression": { + "type": "DoExpression", + "start":9,"end":38,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":38}}, + "body": { + "type": "BlockStatement", + "start":12,"end":38,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":38}}, + "body": [ + { + "type": "ForOfStatement", + "start":14,"end":36,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":36}}, + "await": false, + "left": { + "type": "Identifier", + "start":19,"end":20,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":20},"identifierName":"e"}, + "name": "e" + }, + "right": { + "type": "Identifier", + "start":24,"end":32,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":32},"identifierName":"sequence"}, + "name": "sequence" + }, + "body": { + "type": "ExpressionStatement", + "start":34,"end":36,"loc":{"start":{"line":1,"column":34},"end":{"line":1,"column":36}}, + "expression": { + "type": "PipelinePrimaryTopicReference", + "start":34,"end":35,"loc":{"start":{"line":1,"column":34},"end":{"line":1,"column":35}} + } + } + } + ], + "directives": [] + } + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-try-statement,-outer-topic-reference-in-catch-clause/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-try-statement,-outer-topic-reference-in-catch-clause/options.json index 0f40a90d2204..edb7679c6a74 100644 --- a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-try-statement,-outer-topic-reference-in-catch-clause/options.json +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-try-statement,-outer-topic-reference-in-catch-clause/options.json @@ -1,4 +1,3 @@ { - "plugins": [["pipelineOperator", { "proposal": "smart" }], "doExpressions"], - "throws": "Topic reference was used in a lexical context without topic binding (3:32)" + "plugins": [["pipelineOperator", { "proposal": "smart" }], "doExpressions"] } diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-try-statement,-outer-topic-reference-in-catch-clause/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-try-statement,-outer-topic-reference-in-catch-clause/output.json new file mode 100644 index 000000000000..cd596f541bf2 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-try-statement,-outer-topic-reference-in-catch-clause/output.json @@ -0,0 +1,131 @@ +{ + "type": "File", + "start":0,"end":78,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "errors": [ + "SyntaxError: Topic reference was used in a lexical context without topic binding (3:32)" + ], + "program": { + "type": "Program", + "start":0,"end":78,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":78,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "expression": { + "type": "BinaryExpression", + "start":0,"end":78,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "left": { + "type": "Identifier", + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5},"identifierName":"value"}, + "name": "value" + }, + "operator": "|>", + "right": { + "type": "PipelineTopicExpression", + "start":9,"end":78,"loc":{"start":{"line":1,"column":9},"end":{"line":4,"column":1}}, + "expression": { + "type": "DoExpression", + "start":9,"end":78,"loc":{"start":{"line":1,"column":9},"end":{"line":4,"column":1}}, + "body": { + "type": "BlockStatement", + "start":12,"end":78,"loc":{"start":{"line":1,"column":12},"end":{"line":4,"column":1}}, + "body": [ + { + "type": "TryStatement", + "start":16,"end":76,"loc":{"start":{"line":2,"column":2},"end":{"line":3,"column":37}}, + "block": { + "type": "BlockStatement", + "start":20,"end":38,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":24}}, + "body": [ + { + "type": "ExpressionStatement", + "start":22,"end":36,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":22}}, + "expression": { + "type": "CallExpression", + "start":22,"end":35,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":21}}, + "callee": { + "type": "MemberExpression", + "start":22,"end":32,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":18}}, + "object": { + "type": "Identifier", + "start":22,"end":26,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":12},"identifierName":"JSON"}, + "name": "JSON" + }, + "property": { + "type": "Identifier", + "start":27,"end":32,"loc":{"start":{"line":2,"column":13},"end":{"line":2,"column":18},"identifierName":"parse"}, + "name": "parse" + }, + "computed": false + }, + "arguments": [ + { + "type": "PipelinePrimaryTopicReference", + "start":33,"end":34,"loc":{"start":{"line":2,"column":19},"end":{"line":2,"column":20}} + } + ] + } + } + ], + "directives": [] + }, + "handler": { + "type": "CatchClause", + "start":41,"end":76,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":37}}, + "param": { + "type": "Identifier", + "start":48,"end":53,"loc":{"start":{"line":3,"column":9},"end":{"line":3,"column":14},"identifierName":"error"}, + "name": "error" + }, + "body": { + "type": "BlockStatement", + "start":55,"end":76,"loc":{"start":{"line":3,"column":16},"end":{"line":3,"column":37}}, + "body": [ + { + "type": "ExpressionStatement", + "start":57,"end":74,"loc":{"start":{"line":3,"column":18},"end":{"line":3,"column":35}}, + "expression": { + "type": "CallExpression", + "start":57,"end":73,"loc":{"start":{"line":3,"column":18},"end":{"line":3,"column":34}}, + "callee": { + "type": "MemberExpression", + "start":57,"end":70,"loc":{"start":{"line":3,"column":18},"end":{"line":3,"column":31}}, + "object": { + "type": "Identifier", + "start":57,"end":64,"loc":{"start":{"line":3,"column":18},"end":{"line":3,"column":25},"identifierName":"console"}, + "name": "console" + }, + "property": { + "type": "Identifier", + "start":65,"end":70,"loc":{"start":{"line":3,"column":26},"end":{"line":3,"column":31},"identifierName":"error"}, + "name": "error" + }, + "computed": false + }, + "arguments": [ + { + "type": "PipelinePrimaryTopicReference", + "start":71,"end":72,"loc":{"start":{"line":3,"column":32},"end":{"line":3,"column":33}} + } + ] + } + } + ], + "directives": [] + } + }, + "finalizer": null + } + ], + "directives": [] + } + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-while-loop,-outer-topic-reference-in-loop-body/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-while-loop,-outer-topic-reference-in-loop-body/options.json index a3707cc91710..edb7679c6a74 100644 --- a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-while-loop,-outer-topic-reference-in-loop-body/options.json +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-while-loop,-outer-topic-reference-in-loop-body/options.json @@ -1,4 +1,3 @@ { - "plugins": [["pipelineOperator", { "proposal": "smart" }], "doExpressions"], - "throws": "Topic reference was used in a lexical context without topic binding (1:34)" + "plugins": [["pipelineOperator", { "proposal": "smart" }], "doExpressions"] } diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-while-loop,-outer-topic-reference-in-loop-body/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-while-loop,-outer-topic-reference-in-loop-body/output.json new file mode 100644 index 000000000000..cde715cc8a70 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-while-loop,-outer-topic-reference-in-loop-body/output.json @@ -0,0 +1,87 @@ +{ + "type": "File", + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":38}}, + "errors": [ + "SyntaxError: Topic reference was used in a lexical context without topic binding (1:34)", + "SyntaxError: Pipeline is in topic style but does not use topic reference (1:9)" + ], + "program": { + "type": "Program", + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":38}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":38}}, + "expression": { + "type": "BinaryExpression", + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":38}}, + "left": { + "type": "Identifier", + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5},"identifierName":"value"}, + "name": "value" + }, + "operator": "|>", + "right": { + "type": "PipelineTopicExpression", + "start":9,"end":38,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":38}}, + "expression": { + "type": "DoExpression", + "start":9,"end":38,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":38}}, + "body": { + "type": "BlockStatement", + "start":12,"end":38,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":38}}, + "body": [ + { + "type": "WhileStatement", + "start":14,"end":36,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":36}}, + "test": { + "type": "BinaryExpression", + "start":21,"end":27,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":27}}, + "left": { + "type": "Identifier", + "start":21,"end":22,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":22},"identifierName":"x"}, + "name": "x" + }, + "operator": "<", + "right": { + "type": "NumericLiteral", + "start":25,"end":27,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":27}}, + "extra": { + "rawValue": 50, + "raw": "50" + }, + "value": 50 + } + }, + "body": { + "type": "ExpressionStatement", + "start":29,"end":36,"loc":{"start":{"line":1,"column":29},"end":{"line":1,"column":36}}, + "expression": { + "type": "AssignmentExpression", + "start":29,"end":35,"loc":{"start":{"line":1,"column":29},"end":{"line":1,"column":35}}, + "operator": "+=", + "left": { + "type": "Identifier", + "start":29,"end":30,"loc":{"start":{"line":1,"column":29},"end":{"line":1,"column":30},"identifierName":"x"}, + "name": "x" + }, + "right": { + "type": "PipelinePrimaryTopicReference", + "start":34,"end":35,"loc":{"start":{"line":1,"column":34},"end":{"line":1,"column":35}} + } + } + } + } + ], + "directives": [] + } + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-with-statement,-outer-topic-reference-in-with-body/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-with-statement,-outer-topic-reference-in-with-body/options.json index fee1ffebc044..edb7679c6a74 100644 --- a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-with-statement,-outer-topic-reference-in-with-body/options.json +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-with-statement,-outer-topic-reference-in-with-body/options.json @@ -1,4 +1,3 @@ { - "plugins": [["pipelineOperator", { "proposal": "smart" }], "doExpressions"], - "throws": "Topic reference was used in a lexical context without topic binding (1:24)" + "plugins": [["pipelineOperator", { "proposal": "smart" }], "doExpressions"] } diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-with-statement,-outer-topic-reference-in-with-body/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-with-statement,-outer-topic-reference-in-with-body/output.json new file mode 100644 index 000000000000..10719f0083a3 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-with-statement,-outer-topic-reference-in-with-body/output.json @@ -0,0 +1,63 @@ +{ + "type": "File", + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, + "errors": [ + "SyntaxError: Topic reference was used in a lexical context without topic binding (1:24)", + "SyntaxError: Pipeline is in topic style but does not use topic reference (1:9)" + ], + "program": { + "type": "Program", + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, + "expression": { + "type": "BinaryExpression", + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, + "left": { + "type": "Identifier", + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5},"identifierName":"value"}, + "name": "value" + }, + "operator": "|>", + "right": { + "type": "PipelineTopicExpression", + "start":9,"end":28,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":28}}, + "expression": { + "type": "DoExpression", + "start":9,"end":28,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":28}}, + "body": { + "type": "BlockStatement", + "start":12,"end":28,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":28}}, + "body": [ + { + "type": "WithStatement", + "start":14,"end":26,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":26}}, + "object": { + "type": "ObjectExpression", + "start":20,"end":22,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":22}}, + "properties": [] + }, + "body": { + "type": "ExpressionStatement", + "start":24,"end":26,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":26}}, + "expression": { + "type": "PipelinePrimaryTopicReference", + "start":24,"end":25,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":25}} + } + } + } + ], + "directives": [] + } + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-unbound-topic,-inner-class-in-pipeline-body/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-unbound-topic,-inner-class-in-pipeline-body/options.json index 6401af97db12..17e4e327bbad 100644 --- a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-unbound-topic,-inner-class-in-pipeline-body/options.json +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-unbound-topic,-inner-class-in-pipeline-body/options.json @@ -1,4 +1,3 @@ { - "plugins": [["pipelineOperator", { "proposal": "smart" }]], - "throws": "Topic reference was used in a lexical context without topic binding (1:39)" + "plugins": [["pipelineOperator", { "proposal": "smart" }]] } diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-unbound-topic,-inner-class-in-pipeline-body/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-unbound-topic,-inner-class-in-pipeline-body/output.json new file mode 100644 index 000000000000..499705448de1 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-unbound-topic,-inner-class-in-pipeline-body/output.json @@ -0,0 +1,97 @@ +{ + "type": "File", + "start":0,"end":45,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":45}}, + "errors": [ + "SyntaxError: Topic reference was used in a lexical context without topic binding (1:39)", + "SyntaxError: Pipeline is in topic style but does not use topic reference (1:5)" + ], + "program": { + "type": "Program", + "start":0,"end":45,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":45}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":45,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":45}}, + "expression": { + "type": "BinaryExpression", + "start":0,"end":45,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":45}}, + "left": { + "type": "Identifier", + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, + "name": "x" + }, + "operator": "|>", + "right": { + "type": "PipelineTopicExpression", + "start":5,"end":45,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":45}}, + "expression": { + "type": "ClassExpression", + "start":5,"end":45,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":45}}, + "id": null, + "superClass": null, + "body": { + "type": "ClassBody", + "start":11,"end":45,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":45}}, + "body": [ + { + "type": "ClassMethod", + "start":13,"end":43,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":43}}, + "static": false, + "key": { + "type": "Identifier", + "start":13,"end":24,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":24},"identifierName":"constructor"}, + "name": "constructor" + }, + "computed": false, + "kind": "constructor", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":28,"end":43,"loc":{"start":{"line":1,"column":28},"end":{"line":1,"column":43}}, + "body": [ + { + "type": "ExpressionStatement", + "start":30,"end":41,"loc":{"start":{"line":1,"column":30},"end":{"line":1,"column":41}}, + "expression": { + "type": "AssignmentExpression", + "start":30,"end":40,"loc":{"start":{"line":1,"column":30},"end":{"line":1,"column":40}}, + "operator": "=", + "left": { + "type": "MemberExpression", + "start":30,"end":36,"loc":{"start":{"line":1,"column":30},"end":{"line":1,"column":36}}, + "object": { + "type": "ThisExpression", + "start":30,"end":34,"loc":{"start":{"line":1,"column":30},"end":{"line":1,"column":34}} + }, + "property": { + "type": "Identifier", + "start":35,"end":36,"loc":{"start":{"line":1,"column":35},"end":{"line":1,"column":36},"identifierName":"x"}, + "name": "x" + }, + "computed": false + }, + "right": { + "type": "PipelinePrimaryTopicReference", + "start":39,"end":40,"loc":{"start":{"line":1,"column":39},"end":{"line":1,"column":40}} + } + } + } + ], + "directives": [] + } + } + ] + } + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-unbound-topic,-inner-function-in-pipeline-body/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-unbound-topic,-inner-function-in-pipeline-body/options.json index e6731253189f..17e4e327bbad 100644 --- a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-unbound-topic,-inner-function-in-pipeline-body/options.json +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-unbound-topic,-inner-function-in-pipeline-body/options.json @@ -1,4 +1,3 @@ { - "plugins": [["pipelineOperator", { "proposal": "smart" }]], - "throws": "Topic reference was used in a lexical context without topic binding (1:19)" + "plugins": [["pipelineOperator", { "proposal": "smart" }]] } diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-unbound-topic,-inner-function-in-pipeline-body/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-unbound-topic,-inner-function-in-pipeline-body/output.json new file mode 100644 index 000000000000..1aa91e74b179 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-unbound-topic,-inner-function-in-pipeline-body/output.json @@ -0,0 +1,58 @@ +{ + "type": "File", + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, + "errors": [ + "SyntaxError: Topic reference was used in a lexical context without topic binding (1:19)", + "SyntaxError: Pipeline is in topic style but does not use topic reference (1:5)" + ], + "program": { + "type": "Program", + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, + "expression": { + "type": "BinaryExpression", + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, + "left": { + "type": "Identifier", + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, + "name": "x" + }, + "operator": "|>", + "right": { + "type": "PipelineTopicExpression", + "start":5,"end":22,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":22}}, + "expression": { + "type": "FunctionExpression", + "start":5,"end":22,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":22}}, + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":17,"end":22,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":22}}, + "body": [ + { + "type": "ExpressionStatement", + "start":19,"end":20,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":20}}, + "expression": { + "type": "PipelinePrimaryTopicReference", + "start":19,"end":20,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":20}} + } + } + ], + "directives": [] + } + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-unbound-topic,-pipeline-head-in-inner-function-in-pipeline-body/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-unbound-topic,-pipeline-head-in-inner-function-in-pipeline-body/options.json index e6731253189f..17e4e327bbad 100644 --- a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-unbound-topic,-pipeline-head-in-inner-function-in-pipeline-body/options.json +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-unbound-topic,-pipeline-head-in-inner-function-in-pipeline-body/options.json @@ -1,4 +1,3 @@ { - "plugins": [["pipelineOperator", { "proposal": "smart" }]], - "throws": "Topic reference was used in a lexical context without topic binding (1:19)" + "plugins": [["pipelineOperator", { "proposal": "smart" }]] } diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-unbound-topic,-pipeline-head-in-inner-function-in-pipeline-body/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-unbound-topic,-pipeline-head-in-inner-function-in-pipeline-body/output.json new file mode 100644 index 000000000000..6c2b7a1acf34 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-unbound-topic,-pipeline-head-in-inner-function-in-pipeline-body/output.json @@ -0,0 +1,71 @@ +{ + "type": "File", + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, + "errors": [ + "SyntaxError: Topic reference was used in a lexical context without topic binding (1:19)", + "SyntaxError: Pipeline is in topic style but does not use topic reference (1:5)" + ], + "program": { + "type": "Program", + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, + "expression": { + "type": "BinaryExpression", + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, + "left": { + "type": "Identifier", + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, + "name": "x" + }, + "operator": "|>", + "right": { + "type": "PipelineTopicExpression", + "start":5,"end":27,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":27}}, + "expression": { + "type": "FunctionExpression", + "start":5,"end":27,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":27}}, + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":17,"end":27,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":27}}, + "body": [ + { + "type": "ExpressionStatement", + "start":19,"end":25,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":25}}, + "expression": { + "type": "BinaryExpression", + "start":19,"end":25,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":25}}, + "left": { + "type": "PipelinePrimaryTopicReference", + "start":19,"end":20,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":20}} + }, + "operator": "|>", + "right": { + "type": "PipelineTopicExpression", + "start":24,"end":25,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":25}}, + "expression": { + "type": "PipelinePrimaryTopicReference", + "start":24,"end":25,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":25}} + } + } + } + } + ], + "directives": [] + } + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-nested-pipelines,-topic-style-with-arrow-function-with-bare-style/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-nested-pipelines,-topic-style-with-arrow-function-with-bare-style/output.json index 20fef485fd61..2aeb5206b521 100644 --- a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-nested-pipelines,-topic-style-with-arrow-function-with-bare-style/output.json +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-nested-pipelines,-topic-style-with-arrow-function-with-bare-style/output.json @@ -1,171 +1,48 @@ { "type": "File", - "start": 0, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, "program": { "type": "Program", - "start": 0, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, "expression": { "type": "BinaryExpression", - "start": 0, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "operator": "|>", "right": { "type": "PipelineTopicExpression", - "start": 5, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":5,"end":19,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":19}}, "expression": { "type": "ArrowFunctionExpression", - "start": 6, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":6,"end":18,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":18}}, "id": null, "generator": false, "async": false, "params": [], "body": { "type": "BinaryExpression", - "start": 12, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":12,"end":18,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":18}}, "left": { "type": "PipelinePrimaryTopicReference", - "start": 12, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - } + "start":12,"end":13,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":13}} }, "operator": "|>", "right": { "type": "PipelineBareFunction", - "start": 17, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":17,"end":18,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":18}}, "callee": { "type": "Identifier", - "start": 17, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - }, - "identifierName": "f" - }, + "start":17,"end":18,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":18},"identifierName":"f"}, "name": "f" } } diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-nested-pipelines,-topic-style-with-arrow-function-with-topic-style/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-nested-pipelines,-topic-style-with-arrow-function-with-topic-style/output.json index ae7bef130c84..c110c8d1783f 100644 --- a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-nested-pipelines,-topic-style-with-arrow-function-with-topic-style/output.json +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-nested-pipelines,-topic-style-with-arrow-function-with-topic-style/output.json @@ -1,236 +1,67 @@ { "type": "File", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "program": { "type": "Program", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "expression": { "type": "BinaryExpression", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "operator": "|>", "right": { "type": "PipelineTopicExpression", - "start": 5, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":5,"end":24,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":24}}, "expression": { "type": "ArrowFunctionExpression", - "start": 6, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":6,"end":23,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":23}}, "id": null, "generator": false, "async": false, "params": [ { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "$" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"$"}, "name": "$" } ], "body": { "type": "BinaryExpression", - "start": 11, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":11,"end":23,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":23}}, "left": { "type": "PipelinePrimaryTopicReference", - "start": 11, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - } + "start":11,"end":12,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":12}} }, "operator": "|>", "right": { "type": "PipelineTopicExpression", - "start": 16, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":16,"end":23,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":23}}, "expression": { "type": "CallExpression", - "start": 16, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":16,"end":23,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":23}}, "callee": { "type": "Identifier", - "start": 16, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - }, - "identifierName": "f" - }, + "start":16,"end":17,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":17},"identifierName":"f"}, "name": "f" }, "arguments": [ { "type": "PipelinePrimaryTopicReference", - "start": 18, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - } - } + "start":18,"end":19,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":19}} }, { "type": "Identifier", - "start": 21, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 22 - }, - "identifierName": "$" - }, + "start":21,"end":22,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":22},"identifierName":"$"}, "name": "$" } ] diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-nested-pipelines,-topic-style-with-inner-bare-style/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-nested-pipelines,-topic-style-with-inner-bare-style/output.json index 51d79d3318da..4259a597ed79 100644 --- a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-nested-pipelines,-topic-style-with-inner-bare-style/output.json +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-nested-pipelines,-topic-style-with-inner-bare-style/output.json @@ -1,153 +1,41 @@ { "type": "File", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "program": { "type": "Program", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "expression": { "type": "BinaryExpression", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "operator": "|>", "right": { "type": "PipelineTopicExpression", - "start": 5, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":5,"end":13,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":13}}, "expression": { "type": "BinaryExpression", - "start": 6, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":6,"end":12,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":12}}, "left": { "type": "PipelinePrimaryTopicReference", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - } + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7}} }, "operator": "|>", "right": { "type": "PipelineBareFunction", - "start": 11, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":11,"end":12,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":12}}, "callee": { "type": "Identifier", - "start": 11, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "f" - }, + "start":11,"end":12,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":12},"identifierName":"f"}, "name": "f" } }, diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-nested-pipelines,-topic-style-with-inner-topic-style/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-nested-pipelines,-topic-style-with-inner-topic-style/output.json index 7b38baf9008c..a2fd989f47a3 100644 --- a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-nested-pipelines,-topic-style-with-inner-topic-style/output.json +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-nested-pipelines,-topic-style-with-inner-topic-style/output.json @@ -1,200 +1,54 @@ { "type": "File", - "start": 0, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, "program": { "type": "Program", - "start": 0, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, "expression": { "type": "BinaryExpression", - "start": 0, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "operator": "|>", "right": { "type": "PipelineTopicExpression", - "start": 5, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":5,"end":19,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":19}}, "expression": { "type": "BinaryExpression", - "start": 6, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":6,"end":18,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":18}}, "left": { "type": "PipelinePrimaryTopicReference", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - } + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7}} }, "operator": "|>", "right": { "type": "PipelineTopicExpression", - "start": 11, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":11,"end":18,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":18}}, "expression": { "type": "CallExpression", - "start": 11, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":11,"end":18,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":18}}, "callee": { "type": "Identifier", - "start": 11, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "f" - }, + "start":11,"end":12,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":12},"identifierName":"f"}, "name": "f" }, "arguments": [ { "type": "PipelinePrimaryTopicReference", - "start": 13, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - } - } + "start":13,"end":14,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":14}} }, { "type": "Identifier", - "start": 16, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - }, - "identifierName": "x" - }, + "start":16,"end":17,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":17},"identifierName":"x"}, "name": "x" } ] diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-topic-style,-addition,-single-line-arrow-function,-topic-reference-first/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-topic-style,-addition,-single-line-arrow-function,-topic-reference-first/output.json index 195e3bb795f5..06531b72d5ae 100644 --- a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-topic-style,-addition,-single-line-arrow-function,-topic-reference-first/output.json +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-topic-style,-addition,-single-line-arrow-function,-topic-reference-first/output.json @@ -1,138 +1,38 @@ { "type": "File", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "program": { "type": "Program", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "expression": { "type": "BinaryExpression", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "left": { "type": "Identifier", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "value" - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5},"identifierName":"value"}, "name": "value" }, "operator": "|>", "right": { "type": "PipelineTopicExpression", - "start": 9, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":9,"end":14,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":14}}, "expression": { "type": "BinaryExpression", - "start": 9, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":9,"end":14,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":14}}, "left": { "type": "PipelinePrimaryTopicReference", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - } + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10}} }, "operator": "+", "right": { "type": "NumericLiteral", - "start": 13, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":13,"end":14,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":14}}, "extra": { "rawValue": 1, "raw": "1" diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-topic-style,-addition,-single-line-arrow-function,-topic-reference-last/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-topic-style,-addition,-single-line-arrow-function,-topic-reference-last/output.json index 3a206964c2bd..524d6e4d87ee 100644 --- a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-topic-style,-addition,-single-line-arrow-function,-topic-reference-last/output.json +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-topic-style,-addition,-single-line-arrow-function,-topic-reference-last/output.json @@ -1,122 +1,33 @@ { "type": "File", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "program": { "type": "Program", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "expression": { "type": "BinaryExpression", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "left": { "type": "Identifier", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "value" - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5},"identifierName":"value"}, "name": "value" }, "operator": "|>", "right": { "type": "PipelineTopicExpression", - "start": 9, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":9,"end":14,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":14}}, "expression": { "type": "BinaryExpression", - "start": 9, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":9,"end":14,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":14}}, "left": { "type": "NumericLiteral", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10}}, "extra": { "rawValue": 1, "raw": "1" @@ -126,18 +37,7 @@ "operator": "+", "right": { "type": "PipelinePrimaryTopicReference", - "start": 13, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - } - } + "start":13,"end":14,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":14}} } } } diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-topic-style,-async-await/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-topic-style,-async-await/output.json index 9337eb29bf60..248522740c6f 100644 --- a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-topic-style,-async-await/output.json +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-topic-style,-async-await/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 46, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":46,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 46, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":46,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 46, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":46,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "id": { "type": "Identifier", - "start": 15, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - }, - "identifierName": "f" - }, + "start":15,"end":16,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":16},"identifierName":"f"}, "name": "f" }, "generator": false, @@ -65,107 +20,29 @@ "params": [], "body": { "type": "BlockStatement", - "start": 20, - "end": 46, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":20,"end":46,"loc":{"start":{"line":1,"column":20},"end":{"line":3,"column":1}}, "body": [ { "type": "ReturnStatement", - "start": 24, - "end": 44, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 22 - } - }, + "start":24,"end":44,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":22}}, "argument": { "type": "BinaryExpression", - "start": 31, - "end": 43, - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 21 - } - }, + "start":31,"end":43,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":21}}, "left": { "type": "Identifier", - "start": 31, - "end": 32, - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 10 - }, - "identifierName": "x" - }, + "start":31,"end":32,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":10},"identifierName":"x"}, "name": "x" }, "operator": "|>", "right": { "type": "PipelineTopicExpression", - "start": 36, - "end": 43, - "loc": { - "start": { - "line": 2, - "column": 14 - }, - "end": { - "line": 2, - "column": 21 - } - }, + "start":36,"end":43,"loc":{"start":{"line":2,"column":14},"end":{"line":2,"column":21}}, "expression": { "type": "AwaitExpression", - "start": 36, - "end": 43, - "loc": { - "start": { - "line": 2, - "column": 14 - }, - "end": { - "line": 2, - "column": 21 - } - }, + "start":36,"end":43,"loc":{"start":{"line":2,"column":14},"end":{"line":2,"column":21}}, "argument": { "type": "PipelinePrimaryTopicReference", - "start": 42, - "end": 43, - "loc": { - "start": { - "line": 2, - "column": 20 - }, - "end": { - "line": 2, - "column": 21 - } - } + "start":42,"end":43,"loc":{"start":{"line":2,"column":20},"end":{"line":2,"column":21}} } } } diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-topic-style,-do-expression,-do-while-loop,-outer-topic-reference-in-loop-head/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-topic-style,-do-expression,-do-while-loop,-outer-topic-reference-in-loop-head/output.json index 18b3068859d9..0321177a1072 100644 --- a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-topic-style,-do-expression,-do-while-loop,-outer-topic-reference-in-loop-head/output.json +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-topic-style,-do-expression,-do-while-loop,-outer-topic-reference-in-loop-head/output.json @@ -1,197 +1,52 @@ { "type": "File", - "start": 0, - "end": 41, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 41 - } - }, + "start":0,"end":41,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":41}}, "program": { "type": "Program", - "start": 0, - "end": 41, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 41 - } - }, + "start":0,"end":41,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":41}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 41, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 41 - } - }, + "start":0,"end":41,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":41}}, "expression": { "type": "BinaryExpression", - "start": 0, - "end": 41, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 41 - } - }, + "start":0,"end":41,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":41}}, "left": { "type": "Identifier", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "value" - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5},"identifierName":"value"}, "name": "value" }, "operator": "|>", "right": { "type": "PipelineTopicExpression", - "start": 9, - "end": 41, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 41 - } - }, + "start":9,"end":41,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":41}}, "expression": { "type": "DoExpression", - "start": 9, - "end": 41, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 41 - } - }, + "start":9,"end":41,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":41}}, "body": { "type": "BlockStatement", - "start": 12, - "end": 41, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 41 - } - }, + "start":12,"end":41,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":41}}, "body": [ { "type": "DoWhileStatement", - "start": 14, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 39 - } - }, + "start":14,"end":39,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":39}}, "body": { "type": "ExpressionStatement", - "start": 17, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":17,"end":24,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":24}}, "expression": { "type": "AssignmentExpression", - "start": 17, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":17,"end":23,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":23}}, "operator": "+=", "left": { "type": "Identifier", - "start": 17, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - }, - "identifierName": "x" - }, + "start":17,"end":18,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":18},"identifierName":"x"}, "name": "x" }, "right": { "type": "NumericLiteral", - "start": 22, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":22,"end":23,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":23}}, "extra": { "rawValue": 1, "raw": "1" @@ -202,50 +57,16 @@ }, "test": { "type": "BinaryExpression", - "start": 32, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 32 - }, - "end": { - "line": 1, - "column": 37 - } - }, + "start":32,"end":37,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":37}}, "left": { "type": "Identifier", - "start": 32, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 32 - }, - "end": { - "line": 1, - "column": 33 - }, - "identifierName": "x" - }, + "start":32,"end":33,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":33},"identifierName":"x"}, "name": "x" }, "operator": "<", "right": { "type": "PipelinePrimaryTopicReference", - "start": 36, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 36 - }, - "end": { - "line": 1, - "column": 37 - } - } + "start":36,"end":37,"loc":{"start":{"line":1,"column":36},"end":{"line":1,"column":37}} } } } diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-topic-style,-do-expression,-for-await-of-loop,-outer-topic-reference-in-loop-head/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-topic-style,-do-expression,-for-await-of-loop,-outer-topic-reference-in-loop-head/output.json index 15b7a61ce7ba..aebaee1b7d4e 100644 --- a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-topic-style,-do-expression,-for-await-of-loop,-outer-topic-reference-in-loop-head/output.json +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-topic-style,-do-expression,-for-await-of-loop,-outer-topic-reference-in-loop-head/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 70, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":70,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 70, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":70,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 70, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":70,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "id": { "type": "Identifier", - "start": 15, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 17 - }, - "identifierName": "af" - }, + "start":15,"end":17,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":17},"identifierName":"af"}, "name": "af" }, "generator": false, @@ -65,167 +20,44 @@ "params": [], "body": { "type": "BlockStatement", - "start": 21, - "end": 70, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":21,"end":70,"loc":{"start":{"line":1,"column":21},"end":{"line":3,"column":1}}, "body": [ { "type": "ExpressionStatement", - "start": 25, - "end": 68, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 45 - } - }, + "start":25,"end":68,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":45}}, "expression": { "type": "BinaryExpression", - "start": 25, - "end": 68, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 45 - } - }, + "start":25,"end":68,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":45}}, "left": { "type": "Identifier", - "start": 25, - "end": 30, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 7 - }, - "identifierName": "value" - }, + "start":25,"end":30,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":7},"identifierName":"value"}, "name": "value" }, "operator": "|>", "right": { "type": "PipelineTopicExpression", - "start": 34, - "end": 68, - "loc": { - "start": { - "line": 2, - "column": 11 - }, - "end": { - "line": 2, - "column": 45 - } - }, + "start":34,"end":68,"loc":{"start":{"line":2,"column":11},"end":{"line":2,"column":45}}, "expression": { "type": "DoExpression", - "start": 34, - "end": 68, - "loc": { - "start": { - "line": 2, - "column": 11 - }, - "end": { - "line": 2, - "column": 45 - } - }, + "start":34,"end":68,"loc":{"start":{"line":2,"column":11},"end":{"line":2,"column":45}}, "body": { "type": "BlockStatement", - "start": 37, - "end": 68, - "loc": { - "start": { - "line": 2, - "column": 14 - }, - "end": { - "line": 2, - "column": 45 - } - }, + "start":37,"end":68,"loc":{"start":{"line":2,"column":14},"end":{"line":2,"column":45}}, "body": [ { "type": "ForOfStatement", - "start": 39, - "end": 66, - "loc": { - "start": { - "line": 2, - "column": 16 - }, - "end": { - "line": 2, - "column": 43 - } - }, + "start":39,"end":66,"loc":{"start":{"line":2,"column":16},"end":{"line":2,"column":43}}, "await": true, "left": { "type": "VariableDeclaration", - "start": 50, - "end": 57, - "loc": { - "start": { - "line": 2, - "column": 27 - }, - "end": { - "line": 2, - "column": 34 - } - }, + "start":50,"end":57,"loc":{"start":{"line":2,"column":27},"end":{"line":2,"column":34}}, "declarations": [ { "type": "VariableDeclarator", - "start": 56, - "end": 57, - "loc": { - "start": { - "line": 2, - "column": 33 - }, - "end": { - "line": 2, - "column": 34 - } - }, + "start":56,"end":57,"loc":{"start":{"line":2,"column":33},"end":{"line":2,"column":34}}, "id": { "type": "Identifier", - "start": 56, - "end": 57, - "loc": { - "start": { - "line": 2, - "column": 33 - }, - "end": { - "line": 2, - "column": 34 - }, - "identifierName": "e" - }, + "start":56,"end":57,"loc":{"start":{"line":2,"column":33},"end":{"line":2,"column":34},"identifierName":"e"}, "name": "e" }, "init": null @@ -235,48 +67,14 @@ }, "right": { "type": "PipelinePrimaryTopicReference", - "start": 61, - "end": 62, - "loc": { - "start": { - "line": 2, - "column": 38 - }, - "end": { - "line": 2, - "column": 39 - } - } + "start":61,"end":62,"loc":{"start":{"line":2,"column":38},"end":{"line":2,"column":39}} }, "body": { "type": "ExpressionStatement", - "start": 64, - "end": 66, - "loc": { - "start": { - "line": 2, - "column": 41 - }, - "end": { - "line": 2, - "column": 43 - } - }, + "start":64,"end":66,"loc":{"start":{"line":2,"column":41},"end":{"line":2,"column":43}}, "expression": { "type": "Identifier", - "start": 64, - "end": 65, - "loc": { - "start": { - "line": 2, - "column": 41 - }, - "end": { - "line": 2, - "column": 42 - }, - "identifierName": "e" - }, + "start":64,"end":65,"loc":{"start":{"line":2,"column":41},"end":{"line":2,"column":42},"identifierName":"e"}, "name": "e" } } diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-topic-style,-do-expression,-for-classic-loop,-outer-topic-reference-in-loop-head/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-topic-style,-do-expression,-for-classic-loop,-outer-topic-reference-in-loop-head/output.json index 2fb6945eeb76..a6331818eb10 100644 --- a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-topic-style,-do-expression,-for-classic-loop,-outer-topic-reference-in-loop-head/output.json +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-topic-style,-do-expression,-for-classic-loop,-outer-topic-reference-in-loop-head/output.json @@ -1,197 +1,52 @@ { "type": "File", - "start": 0, - "end": 59, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 59 - } - }, + "start":0,"end":59,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":59}}, "program": { "type": "Program", - "start": 0, - "end": 59, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 59 - } - }, + "start":0,"end":59,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":59}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 59, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 59 - } - }, + "start":0,"end":59,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":59}}, "expression": { "type": "BinaryExpression", - "start": 0, - "end": 59, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 59 - } - }, + "start":0,"end":59,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":59}}, "left": { "type": "Identifier", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "value" - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5},"identifierName":"value"}, "name": "value" }, "operator": "|>", "right": { "type": "PipelineTopicExpression", - "start": 9, - "end": 59, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 59 - } - }, + "start":9,"end":59,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":59}}, "expression": { "type": "DoExpression", - "start": 9, - "end": 59, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 59 - } - }, + "start":9,"end":59,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":59}}, "body": { "type": "BlockStatement", - "start": 12, - "end": 59, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 59 - } - }, + "start":12,"end":59,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":59}}, "body": [ { "type": "ForStatement", - "start": 14, - "end": 57, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 57 - } - }, + "start":14,"end":57,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":57}}, "init": { "type": "VariableDeclaration", - "start": 19, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":19,"end":28,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":28}}, "declarations": [ { "type": "VariableDeclarator", - "start": 23, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":23,"end":28,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":28}}, "id": { "type": "Identifier", - "start": 23, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 24 - }, - "identifierName": "i" - }, + "start":23,"end":24,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":24},"identifierName":"i"}, "name": "i" }, "init": { "type": "PipelinePrimaryTopicReference", - "start": 27, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 28 - } - } + "start":27,"end":28,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":28}} } } ], @@ -199,147 +54,44 @@ }, "test": { "type": "CallExpression", - "start": 30, - "end": 45, - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 1, - "column": 45 - } - }, + "start":30,"end":45,"loc":{"start":{"line":1,"column":30},"end":{"line":1,"column":45}}, "callee": { "type": "Identifier", - "start": 30, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 1, - "column": 39 - }, - "identifierName": "predicate" - }, + "start":30,"end":39,"loc":{"start":{"line":1,"column":30},"end":{"line":1,"column":39},"identifierName":"predicate"}, "name": "predicate" }, "arguments": [ { "type": "Identifier", - "start": 40, - "end": 41, - "loc": { - "start": { - "line": 1, - "column": 40 - }, - "end": { - "line": 1, - "column": 41 - }, - "identifierName": "i" - }, + "start":40,"end":41,"loc":{"start":{"line":1,"column":40},"end":{"line":1,"column":41},"identifierName":"i"}, "name": "i" }, { "type": "PipelinePrimaryTopicReference", - "start": 43, - "end": 44, - "loc": { - "start": { - "line": 1, - "column": 43 - }, - "end": { - "line": 1, - "column": 44 - } - } + "start":43,"end":44,"loc":{"start":{"line":1,"column":43},"end":{"line":1,"column":44}} } ] }, "update": { "type": "AssignmentExpression", - "start": 47, - "end": 53, - "loc": { - "start": { - "line": 1, - "column": 47 - }, - "end": { - "line": 1, - "column": 53 - } - }, + "start":47,"end":53,"loc":{"start":{"line":1,"column":47},"end":{"line":1,"column":53}}, "operator": "+=", "left": { "type": "Identifier", - "start": 47, - "end": 48, - "loc": { - "start": { - "line": 1, - "column": 47 - }, - "end": { - "line": 1, - "column": 48 - }, - "identifierName": "i" - }, + "start":47,"end":48,"loc":{"start":{"line":1,"column":47},"end":{"line":1,"column":48},"identifierName":"i"}, "name": "i" }, "right": { "type": "PipelinePrimaryTopicReference", - "start": 52, - "end": 53, - "loc": { - "start": { - "line": 1, - "column": 52 - }, - "end": { - "line": 1, - "column": 53 - } - } + "start":52,"end":53,"loc":{"start":{"line":1,"column":52},"end":{"line":1,"column":53}} } }, "body": { "type": "ExpressionStatement", - "start": 55, - "end": 57, - "loc": { - "start": { - "line": 1, - "column": 55 - }, - "end": { - "line": 1, - "column": 57 - } - }, + "start":55,"end":57,"loc":{"start":{"line":1,"column":55},"end":{"line":1,"column":57}}, "expression": { "type": "Identifier", - "start": 55, - "end": 56, - "loc": { - "start": { - "line": 1, - "column": 55 - }, - "end": { - "line": 1, - "column": 56 - }, - "identifierName": "i" - }, + "start":55,"end":56,"loc":{"start":{"line":1,"column":55},"end":{"line":1,"column":56},"identifierName":"i"}, "name": "i" } } diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-topic-style,-do-expression,-for-in-loop,-outer-topic-reference-in-loop-head/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-topic-style,-do-expression,-for-in-loop,-outer-topic-reference-in-loop-head/output.json index 4571a8f3b91e..e3b406e4daa4 100644 --- a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-topic-style,-do-expression,-for-in-loop,-outer-topic-reference-in-loop-head/output.json +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-topic-style,-do-expression,-for-in-loop,-outer-topic-reference-in-loop-head/output.json @@ -1,198 +1,52 @@ { "type": "File", - "start": 0, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, "program": { "type": "Program", - "start": 0, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, "expression": { "type": "BinaryExpression", - "start": 0, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, "left": { "type": "Identifier", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "value" - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5},"identifierName":"value"}, "name": "value" }, "operator": "|>", "right": { "type": "PipelineTopicExpression", - "start": 9, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":9,"end":31,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":31}}, "expression": { "type": "DoExpression", - "start": 9, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":9,"end":31,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":31}}, "body": { "type": "BlockStatement", - "start": 12, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":12,"end":31,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":31}}, "body": [ { "type": "ForInStatement", - "start": 14, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":14,"end":29,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":29}}, "left": { "type": "Identifier", - "start": 19, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 20 - }, - "identifierName": "e" - }, + "start":19,"end":20,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":20},"identifierName":"e"}, "name": "e" }, "right": { "type": "PipelinePrimaryTopicReference", - "start": 24, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 25 - } - } + "start":24,"end":25,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":25}} }, "body": { "type": "ExpressionStatement", - "start": 27, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":27,"end":29,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":29}}, "expression": { "type": "Identifier", - "start": 27, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 28 - }, - "identifierName": "e" - }, + "start":27,"end":28,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":28},"identifierName":"e"}, "name": "e" } } diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-topic-style,-do-expression,-for-of-loop,-outer-topic-reference-in-loop-head/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-topic-style,-do-expression,-for-of-loop,-outer-topic-reference-in-loop-head/output.json index 25757328ebef..297a910a329c 100644 --- a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-topic-style,-do-expression,-for-of-loop,-outer-topic-reference-in-loop-head/output.json +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-topic-style,-do-expression,-for-of-loop,-outer-topic-reference-in-loop-head/output.json @@ -1,199 +1,53 @@ { "type": "File", - "start": 0, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, "program": { "type": "Program", - "start": 0, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, "expression": { "type": "BinaryExpression", - "start": 0, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, "left": { "type": "Identifier", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "value" - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5},"identifierName":"value"}, "name": "value" }, "operator": "|>", "right": { "type": "PipelineTopicExpression", - "start": 9, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":9,"end":31,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":31}}, "expression": { "type": "DoExpression", - "start": 9, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":9,"end":31,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":31}}, "body": { "type": "BlockStatement", - "start": 12, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":12,"end":31,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":31}}, "body": [ { "type": "ForOfStatement", - "start": 14, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":14,"end":29,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":29}}, "await": false, "left": { "type": "Identifier", - "start": 19, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 20 - }, - "identifierName": "e" - }, + "start":19,"end":20,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":20},"identifierName":"e"}, "name": "e" }, "right": { "type": "PipelinePrimaryTopicReference", - "start": 24, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 25 - } - } + "start":24,"end":25,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":25}} }, "body": { "type": "ExpressionStatement", - "start": 27, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":27,"end":29,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":29}}, "expression": { "type": "Identifier", - "start": 27, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 28 - }, - "identifierName": "e" - }, + "start":27,"end":28,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":28},"identifierName":"e"}, "name": "e" } } diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-topic-style,-do-expression,-identity/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-topic-style,-do-expression,-identity/output.json index d0c29a3cc724..d90e701dc4dd 100644 --- a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-topic-style,-do-expression,-identity/output.json +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-topic-style,-do-expression,-identity/output.json @@ -1,151 +1,40 @@ { "type": "File", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, "program": { "type": "Program", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, "expression": { "type": "BinaryExpression", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, "left": { "type": "Identifier", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "value" - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5},"identifierName":"value"}, "name": "value" }, "operator": "|>", "right": { "type": "PipelineTopicExpression", - "start": 9, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":9,"end":18,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":18}}, "expression": { "type": "DoExpression", - "start": 9, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":9,"end":18,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":18}}, "body": { "type": "BlockStatement", - "start": 12, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":12,"end":18,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":18}}, "body": [ { "type": "ExpressionStatement", - "start": 14, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":14,"end":16,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":16}}, "expression": { "type": "PipelinePrimaryTopicReference", - "start": 14, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - } - } + "start":14,"end":15,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":15}} } } ], diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-topic-style,-do-expression,-if-statement,-outer-topic-reference-in-else-body/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-topic-style,-do-expression,-if-statement,-outer-topic-reference-in-else-body/output.json index be74d493c27c..57f62fe4a6b1 100644 --- a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-topic-style,-do-expression,-if-statement,-outer-topic-reference-in-else-body/output.json +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-topic-style,-do-expression,-if-statement,-outer-topic-reference-in-else-body/output.json @@ -1,243 +1,64 @@ { "type": "File", - "start": 0, - "end": 46, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 46 - } - }, + "start":0,"end":46,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":46}}, "program": { "type": "Program", - "start": 0, - "end": 46, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 46 - } - }, + "start":0,"end":46,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":46}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 46, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 46 - } - }, + "start":0,"end":46,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":46}}, "expression": { "type": "BinaryExpression", - "start": 0, - "end": 46, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 46 - } - }, + "start":0,"end":46,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":46}}, "left": { "type": "Identifier", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "value" - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5},"identifierName":"value"}, "name": "value" }, "operator": "|>", "right": { "type": "PipelineTopicExpression", - "start": 9, - "end": 46, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 46 - } - }, + "start":9,"end":46,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":46}}, "expression": { "type": "DoExpression", - "start": 9, - "end": 46, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 46 - } - }, + "start":9,"end":46,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":46}}, "body": { "type": "BlockStatement", - "start": 12, - "end": 46, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 46 - } - }, + "start":12,"end":46,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":46}}, "body": [ { "type": "IfStatement", - "start": 14, - "end": 44, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 44 - } - }, + "start":14,"end":44,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":44}}, "test": { "type": "Identifier", - "start": 18, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 21 - }, - "identifierName": "yes" - }, + "start":18,"end":21,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":21},"identifierName":"yes"}, "name": "yes" }, "consequent": { "type": "ExpressionStatement", - "start": 23, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":23,"end":28,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":28}}, "expression": { "type": "NullLiteral", - "start": 23, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 27 - } - } + "start":23,"end":27,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":27}} } }, "alternate": { "type": "IfStatement", - "start": 34, - "end": 44, - "loc": { - "start": { - "line": 1, - "column": 34 - }, - "end": { - "line": 1, - "column": 44 - } - }, + "start":34,"end":44,"loc":{"start":{"line":1,"column":34},"end":{"line":1,"column":44}}, "test": { "type": "Identifier", - "start": 38, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 38 - }, - "end": { - "line": 1, - "column": 40 - }, - "identifierName": "no" - }, + "start":38,"end":40,"loc":{"start":{"line":1,"column":38},"end":{"line":1,"column":40},"identifierName":"no"}, "name": "no" }, "consequent": { "type": "ExpressionStatement", - "start": 42, - "end": 44, - "loc": { - "start": { - "line": 1, - "column": 42 - }, - "end": { - "line": 1, - "column": 44 - } - }, + "start":42,"end":44,"loc":{"start":{"line":1,"column":42},"end":{"line":1,"column":44}}, "expression": { "type": "PipelinePrimaryTopicReference", - "start": 42, - "end": 43, - "loc": { - "start": { - "line": 1, - "column": 42 - }, - "end": { - "line": 1, - "column": 43 - } - } + "start":42,"end":43,"loc":{"start":{"line":1,"column":42},"end":{"line":1,"column":43}} } }, "alternate": null diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-topic-style,-do-expression,-if-statement,-outer-topic-reference-in-else-if-body/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-topic-style,-do-expression,-if-statement,-outer-topic-reference-in-else-if-body/output.json index eb53ce59a775..2c33b45a64be 100644 --- a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-topic-style,-do-expression,-if-statement,-outer-topic-reference-in-else-if-body/output.json +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-topic-style,-do-expression,-if-statement,-outer-topic-reference-in-else-if-body/output.json @@ -1,212 +1,56 @@ { "type": "File", - "start": 0, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":38}}, "program": { "type": "Program", - "start": 0, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":38}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":38}}, "expression": { "type": "BinaryExpression", - "start": 0, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":38}}, "left": { "type": "Identifier", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "value" - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5},"identifierName":"value"}, "name": "value" }, "operator": "|>", "right": { "type": "PipelineTopicExpression", - "start": 9, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":9,"end":38,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":38}}, "expression": { "type": "DoExpression", - "start": 9, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":9,"end":38,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":38}}, "body": { "type": "BlockStatement", - "start": 12, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":12,"end":38,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":38}}, "body": [ { "type": "IfStatement", - "start": 14, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":14,"end":36,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":36}}, "test": { "type": "Identifier", - "start": 18, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 21 - }, - "identifierName": "yes" - }, + "start":18,"end":21,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":21},"identifierName":"yes"}, "name": "yes" }, "consequent": { "type": "ExpressionStatement", - "start": 23, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":23,"end":28,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":28}}, "expression": { "type": "NullLiteral", - "start": 23, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 27 - } - } + "start":23,"end":27,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":27}} } }, "alternate": { "type": "ExpressionStatement", - "start": 34, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 34 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":34,"end":36,"loc":{"start":{"line":1,"column":34},"end":{"line":1,"column":36}}, "expression": { "type": "PipelinePrimaryTopicReference", - "start": 34, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 34 - }, - "end": { - "line": 1, - "column": 35 - } - } + "start":34,"end":35,"loc":{"start":{"line":1,"column":34},"end":{"line":1,"column":35}} } } } diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-topic-style,-do-expression,-if-statement,-outer-topic-reference-in-if-body/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-topic-style,-do-expression,-if-statement,-outer-topic-reference-in-if-body/output.json index 501bbac6fa08..a2a0ef2bc6b6 100644 --- a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-topic-style,-do-expression,-if-statement,-outer-topic-reference-in-if-body/output.json +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-topic-style,-do-expression,-if-statement,-outer-topic-reference-in-if-body/output.json @@ -1,182 +1,48 @@ { "type": "File", - "start": 0, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, "program": { "type": "Program", - "start": 0, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, "expression": { "type": "BinaryExpression", - "start": 0, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, "left": { "type": "Identifier", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "value" - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5},"identifierName":"value"}, "name": "value" }, "operator": "|>", "right": { "type": "PipelineTopicExpression", - "start": 9, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":9,"end":27,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":27}}, "expression": { "type": "DoExpression", - "start": 9, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":9,"end":27,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":27}}, "body": { "type": "BlockStatement", - "start": 12, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":12,"end":27,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":27}}, "body": [ { "type": "IfStatement", - "start": 14, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":14,"end":25,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":25}}, "test": { "type": "Identifier", - "start": 18, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 21 - }, - "identifierName": "yes" - }, + "start":18,"end":21,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":21},"identifierName":"yes"}, "name": "yes" }, "consequent": { "type": "ExpressionStatement", - "start": 23, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":23,"end":25,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":25}}, "expression": { "type": "PipelinePrimaryTopicReference", - "start": 23, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 24 - } - } + "start":23,"end":24,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":24}} } }, "alternate": null diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-topic-style,-do-expression,-if-statement,-outer-topic-reference-in-if-head/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-topic-style,-do-expression,-if-statement,-outer-topic-reference-in-if-head/output.json index e2fb435ec82b..e966a43e47ea 100644 --- a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-topic-style,-do-expression,-if-statement,-outer-topic-reference-in-if-head/output.json +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-topic-style,-do-expression,-if-statement,-outer-topic-reference-in-if-head/output.json @@ -1,180 +1,47 @@ { "type": "File", - "start": 0, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, "program": { "type": "Program", - "start": 0, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, "expression": { "type": "BinaryExpression", - "start": 0, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, "left": { "type": "Identifier", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "value" - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5},"identifierName":"value"}, "name": "value" }, "operator": "|>", "right": { "type": "PipelineTopicExpression", - "start": 9, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":9,"end":33,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":33}}, "expression": { "type": "DoExpression", - "start": 9, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":9,"end":33,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":33}}, "body": { "type": "BlockStatement", - "start": 12, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":12,"end":33,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":33}}, "body": [ { "type": "IfStatement", - "start": 14, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":14,"end":31,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":31}}, "test": { "type": "PipelinePrimaryTopicReference", - "start": 18, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - } - } + "start":18,"end":19,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":19}} }, "consequent": { "type": "ExpressionStatement", - "start": 21, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":21,"end":23,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":23}}, "expression": { "type": "NumericLiteral", - "start": 21, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":21,"end":22,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":22}}, "extra": { "rawValue": 1, "raw": "1" @@ -184,32 +51,10 @@ }, "alternate": { "type": "ExpressionStatement", - "start": 29, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":29,"end":31,"loc":{"start":{"line":1,"column":29},"end":{"line":1,"column":31}}, "expression": { "type": "NumericLiteral", - "start": 29, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":29,"end":30,"loc":{"start":{"line":1,"column":29},"end":{"line":1,"column":30}}, "extra": { "rawValue": 0, "raw": "0" diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-topic-style,-do-expression,-switch-statement,-outer-topic-reference-in-switch-body/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-topic-style,-do-expression,-switch-statement,-outer-topic-reference-in-switch-body/output.json index 7ab18f8fbcfc..6ea4db4a6f24 100644 --- a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-topic-style,-do-expression,-switch-statement,-outer-topic-reference-in-switch-body/output.json +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-topic-style,-do-expression,-switch-statement,-outer-topic-reference-in-switch-body/output.json @@ -1,215 +1,59 @@ { "type": "File", - "start": 0, - "end": 94, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 7, - "column": 1 - } - }, + "start":0,"end":94,"loc":{"start":{"line":1,"column":0},"end":{"line":7,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 94, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 7, - "column": 1 - } - }, + "start":0,"end":94,"loc":{"start":{"line":1,"column":0},"end":{"line":7,"column":1}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 94, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 7, - "column": 1 - } - }, + "start":0,"end":94,"loc":{"start":{"line":1,"column":0},"end":{"line":7,"column":1}}, "expression": { "type": "BinaryExpression", - "start": 0, - "end": 94, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 7, - "column": 1 - } - }, + "start":0,"end":94,"loc":{"start":{"line":1,"column":0},"end":{"line":7,"column":1}}, "left": { "type": "Identifier", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "value" - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5},"identifierName":"value"}, "name": "value" }, "operator": "|>", "right": { "type": "PipelineTopicExpression", - "start": 9, - "end": 94, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 7, - "column": 1 - } - }, + "start":9,"end":94,"loc":{"start":{"line":1,"column":9},"end":{"line":7,"column":1}}, "expression": { "type": "DoExpression", - "start": 9, - "end": 94, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 7, - "column": 1 - } - }, + "start":9,"end":94,"loc":{"start":{"line":1,"column":9},"end":{"line":7,"column":1}}, "body": { "type": "BlockStatement", - "start": 12, - "end": 94, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 7, - "column": 1 - } - }, + "start":12,"end":94,"loc":{"start":{"line":1,"column":12},"end":{"line":7,"column":1}}, "body": [ { "type": "SwitchStatement", - "start": 16, - "end": 92, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 6, - "column": 3 - } - }, + "start":16,"end":92,"loc":{"start":{"line":2,"column":2},"end":{"line":6,"column":3}}, "discriminant": { "type": "Identifier", - "start": 24, - "end": 30, - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 16 - }, - "identifierName": "number" - }, + "start":24,"end":30,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":16},"identifierName":"number"}, "name": "number" }, "cases": [ { "type": "SwitchCase", - "start": 38, - "end": 48, - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 14 - } - }, + "start":38,"end":48,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":14}}, "consequent": [ { "type": "ExpressionStatement", - "start": 46, - "end": 48, - "loc": { - "start": { - "line": 3, - "column": 12 - }, - "end": { - "line": 3, - "column": 14 - } - }, + "start":46,"end":48,"loc":{"start":{"line":3,"column":12},"end":{"line":3,"column":14}}, "expression": { "type": "PipelinePrimaryTopicReference", - "start": 46, - "end": 47, - "loc": { - "start": { - "line": 3, - "column": 12 - }, - "end": { - "line": 3, - "column": 13 - } - } + "start":46,"end":47,"loc":{"start":{"line":3,"column":12},"end":{"line":3,"column":13}} } } ], "test": { "type": "NumericLiteral", - "start": 43, - "end": 44, - "loc": { - "start": { - "line": 3, - "column": 9 - }, - "end": { - "line": 3, - "column": 10 - } - }, + "start":43,"end":44,"loc":{"start":{"line":3,"column":9},"end":{"line":3,"column":10}}, "extra": { "rawValue": 0, "raw": "0" @@ -219,77 +63,22 @@ }, { "type": "SwitchCase", - "start": 53, - "end": 67, - "loc": { - "start": { - "line": 4, - "column": 4 - }, - "end": { - "line": 4, - "column": 18 - } - }, + "start":53,"end":67,"loc":{"start":{"line":4,"column":4},"end":{"line":4,"column":18}}, "consequent": [ { "type": "ExpressionStatement", - "start": 61, - "end": 67, - "loc": { - "start": { - "line": 4, - "column": 12 - }, - "end": { - "line": 4, - "column": 18 - } - }, + "start":61,"end":67,"loc":{"start":{"line":4,"column":12},"end":{"line":4,"column":18}}, "expression": { "type": "BinaryExpression", - "start": 61, - "end": 66, - "loc": { - "start": { - "line": 4, - "column": 12 - }, - "end": { - "line": 4, - "column": 17 - } - }, + "start":61,"end":66,"loc":{"start":{"line":4,"column":12},"end":{"line":4,"column":17}}, "left": { "type": "PipelinePrimaryTopicReference", - "start": 61, - "end": 62, - "loc": { - "start": { - "line": 4, - "column": 12 - }, - "end": { - "line": 4, - "column": 13 - } - } + "start":61,"end":62,"loc":{"start":{"line":4,"column":12},"end":{"line":4,"column":13}} }, "operator": "+", "right": { "type": "NumericLiteral", - "start": 65, - "end": 66, - "loc": { - "start": { - "line": 4, - "column": 16 - }, - "end": { - "line": 4, - "column": 17 - } - }, + "start":65,"end":66,"loc":{"start":{"line":4,"column":16},"end":{"line":4,"column":17}}, "extra": { "rawValue": 1, "raw": "1" @@ -301,18 +90,7 @@ ], "test": { "type": "NumericLiteral", - "start": 58, - "end": 59, - "loc": { - "start": { - "line": 4, - "column": 9 - }, - "end": { - "line": 4, - "column": 10 - } - }, + "start":58,"end":59,"loc":{"start":{"line":4,"column":9},"end":{"line":4,"column":10}}, "extra": { "rawValue": 1, "raw": "1" @@ -322,77 +100,22 @@ }, { "type": "SwitchCase", - "start": 72, - "end": 88, - "loc": { - "start": { - "line": 5, - "column": 4 - }, - "end": { - "line": 5, - "column": 20 - } - }, + "start":72,"end":88,"loc":{"start":{"line":5,"column":4},"end":{"line":5,"column":20}}, "consequent": [ { "type": "ExpressionStatement", - "start": 81, - "end": 88, - "loc": { - "start": { - "line": 5, - "column": 13 - }, - "end": { - "line": 5, - "column": 20 - } - }, + "start":81,"end":88,"loc":{"start":{"line":5,"column":13},"end":{"line":5,"column":20}}, "expression": { "type": "BinaryExpression", - "start": 81, - "end": 87, - "loc": { - "start": { - "line": 5, - "column": 13 - }, - "end": { - "line": 5, - "column": 19 - } - }, + "start":81,"end":87,"loc":{"start":{"line":5,"column":13},"end":{"line":5,"column":19}}, "left": { "type": "PipelinePrimaryTopicReference", - "start": 81, - "end": 82, - "loc": { - "start": { - "line": 5, - "column": 13 - }, - "end": { - "line": 5, - "column": 14 - } - } + "start":81,"end":82,"loc":{"start":{"line":5,"column":13},"end":{"line":5,"column":14}} }, "operator": "+", "right": { "type": "NumericLiteral", - "start": 85, - "end": 87, - "loc": { - "start": { - "line": 5, - "column": 17 - }, - "end": { - "line": 5, - "column": 19 - } - }, + "start":85,"end":87,"loc":{"start":{"line":5,"column":17},"end":{"line":5,"column":19}}, "extra": { "rawValue": 10, "raw": "10" diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-topic-style,-do-expression,-switch-statement,-outer-topic-reference-in-switch-head/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-topic-style,-do-expression,-switch-statement,-outer-topic-reference-in-switch-head/output.json index 75c247866713..215e0119e445 100644 --- a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-topic-style,-do-expression,-switch-statement,-outer-topic-reference-in-switch-head/output.json +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-topic-style,-do-expression,-switch-statement,-outer-topic-reference-in-switch-head/output.json @@ -1,196 +1,52 @@ { "type": "File", - "start": 0, - "end": 83, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 7, - "column": 1 - } - }, + "start":0,"end":83,"loc":{"start":{"line":1,"column":0},"end":{"line":7,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 83, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 7, - "column": 1 - } - }, + "start":0,"end":83,"loc":{"start":{"line":1,"column":0},"end":{"line":7,"column":1}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 83, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 7, - "column": 1 - } - }, + "start":0,"end":83,"loc":{"start":{"line":1,"column":0},"end":{"line":7,"column":1}}, "expression": { "type": "BinaryExpression", - "start": 0, - "end": 83, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 7, - "column": 1 - } - }, + "start":0,"end":83,"loc":{"start":{"line":1,"column":0},"end":{"line":7,"column":1}}, "left": { "type": "Identifier", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "value" - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5},"identifierName":"value"}, "name": "value" }, "operator": "|>", "right": { "type": "PipelineTopicExpression", - "start": 9, - "end": 83, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 7, - "column": 1 - } - }, + "start":9,"end":83,"loc":{"start":{"line":1,"column":9},"end":{"line":7,"column":1}}, "expression": { "type": "DoExpression", - "start": 9, - "end": 83, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 7, - "column": 1 - } - }, + "start":9,"end":83,"loc":{"start":{"line":1,"column":9},"end":{"line":7,"column":1}}, "body": { "type": "BlockStatement", - "start": 12, - "end": 83, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 7, - "column": 1 - } - }, + "start":12,"end":83,"loc":{"start":{"line":1,"column":12},"end":{"line":7,"column":1}}, "body": [ { "type": "SwitchStatement", - "start": 16, - "end": 81, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 6, - "column": 3 - } - }, + "start":16,"end":81,"loc":{"start":{"line":2,"column":2},"end":{"line":6,"column":3}}, "discriminant": { "type": "PipelinePrimaryTopicReference", - "start": 24, - "end": 25, - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 11 - } - } + "start":24,"end":25,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":11}} }, "cases": [ { "type": "SwitchCase", - "start": 33, - "end": 44, - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 15 - } - }, + "start":33,"end":44,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":15}}, "consequent": [ { "type": "ExpressionStatement", - "start": 41, - "end": 44, - "loc": { - "start": { - "line": 3, - "column": 12 - }, - "end": { - "line": 3, - "column": 15 - } - }, + "start":41,"end":44,"loc":{"start":{"line":3,"column":12},"end":{"line":3,"column":15}}, "expression": { "type": "NumericLiteral", - "start": 41, - "end": 43, - "loc": { - "start": { - "line": 3, - "column": 12 - }, - "end": { - "line": 3, - "column": 14 - } - }, + "start":41,"end":43,"loc":{"start":{"line":3,"column":12},"end":{"line":3,"column":14}}, "extra": { "rawValue": 50, "raw": "50" @@ -201,18 +57,7 @@ ], "test": { "type": "NumericLiteral", - "start": 38, - "end": 39, - "loc": { - "start": { - "line": 3, - "column": 9 - }, - "end": { - "line": 3, - "column": 10 - } - }, + "start":38,"end":39,"loc":{"start":{"line":3,"column":9},"end":{"line":3,"column":10}}, "extra": { "rawValue": 0, "raw": "0" @@ -222,47 +67,14 @@ }, { "type": "SwitchCase", - "start": 49, - "end": 60, - "loc": { - "start": { - "line": 4, - "column": 4 - }, - "end": { - "line": 4, - "column": 15 - } - }, + "start":49,"end":60,"loc":{"start":{"line":4,"column":4},"end":{"line":4,"column":15}}, "consequent": [ { "type": "ExpressionStatement", - "start": 57, - "end": 60, - "loc": { - "start": { - "line": 4, - "column": 12 - }, - "end": { - "line": 4, - "column": 15 - } - }, + "start":57,"end":60,"loc":{"start":{"line":4,"column":12},"end":{"line":4,"column":15}}, "expression": { "type": "NumericLiteral", - "start": 57, - "end": 59, - "loc": { - "start": { - "line": 4, - "column": 12 - }, - "end": { - "line": 4, - "column": 14 - } - }, + "start":57,"end":59,"loc":{"start":{"line":4,"column":12},"end":{"line":4,"column":14}}, "extra": { "rawValue": 60, "raw": "60" @@ -273,18 +85,7 @@ ], "test": { "type": "NumericLiteral", - "start": 54, - "end": 55, - "loc": { - "start": { - "line": 4, - "column": 9 - }, - "end": { - "line": 4, - "column": 10 - } - }, + "start":54,"end":55,"loc":{"start":{"line":4,"column":9},"end":{"line":4,"column":10}}, "extra": { "rawValue": 1, "raw": "1" @@ -294,47 +95,14 @@ }, { "type": "SwitchCase", - "start": 65, - "end": 77, - "loc": { - "start": { - "line": 5, - "column": 4 - }, - "end": { - "line": 5, - "column": 16 - } - }, + "start":65,"end":77,"loc":{"start":{"line":5,"column":4},"end":{"line":5,"column":16}}, "consequent": [ { "type": "ExpressionStatement", - "start": 74, - "end": 77, - "loc": { - "start": { - "line": 5, - "column": 13 - }, - "end": { - "line": 5, - "column": 16 - } - }, + "start":74,"end":77,"loc":{"start":{"line":5,"column":13},"end":{"line":5,"column":16}}, "expression": { "type": "NumericLiteral", - "start": 74, - "end": 76, - "loc": { - "start": { - "line": 5, - "column": 13 - }, - "end": { - "line": 5, - "column": 15 - } - }, + "start":74,"end":76,"loc":{"start":{"line":5,"column":13},"end":{"line":5,"column":15}}, "extra": { "rawValue": 70, "raw": "70" diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-topic-style,-do-expression,-try-statement,-outer-topic-reference-in-finally-clause-with-catch-and-finally/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-topic-style,-do-expression,-try-statement,-outer-topic-reference-in-finally-clause-with-catch-and-finally/output.json index a2feff08dcac..8493ab87355f 100644 --- a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-topic-style,-do-expression,-try-statement,-outer-topic-reference-in-finally-clause-with-catch-and-finally/output.json +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-topic-style,-do-expression,-try-statement,-outer-topic-reference-in-finally-clause-with-catch-and-finally/output.json @@ -1,226 +1,58 @@ { "type": "File", - "start": 0, - "end": 117, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 1 - } - }, + "start":0,"end":117,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 117, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 1 - } - }, + "start":0,"end":117,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 117, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 1 - } - }, + "start":0,"end":117,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, "expression": { "type": "BinaryExpression", - "start": 0, - "end": 117, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 1 - } - }, + "start":0,"end":117,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, "left": { "type": "Identifier", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "value" - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5},"identifierName":"value"}, "name": "value" }, "operator": "|>", "right": { "type": "PipelineTopicExpression", - "start": 9, - "end": 117, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 5, - "column": 1 - } - }, + "start":9,"end":117,"loc":{"start":{"line":1,"column":9},"end":{"line":5,"column":1}}, "expression": { "type": "DoExpression", - "start": 9, - "end": 117, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 5, - "column": 1 - } - }, + "start":9,"end":117,"loc":{"start":{"line":1,"column":9},"end":{"line":5,"column":1}}, "body": { "type": "BlockStatement", - "start": 12, - "end": 117, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 5, - "column": 1 - } - }, + "start":12,"end":117,"loc":{"start":{"line":1,"column":12},"end":{"line":5,"column":1}}, "body": [ { "type": "TryStatement", - "start": 16, - "end": 115, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 4, - "column": 27 - } - }, + "start":16,"end":115,"loc":{"start":{"line":2,"column":2},"end":{"line":4,"column":27}}, "block": { "type": "BlockStatement", - "start": 20, - "end": 45, - "loc": { - "start": { - "line": 2, - "column": 6 - }, - "end": { - "line": 2, - "column": 31 - } - }, + "start":20,"end":45,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":31}}, "body": [ { "type": "ExpressionStatement", - "start": 22, - "end": 43, - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 29 - } - }, + "start":22,"end":43,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":29}}, "expression": { "type": "CallExpression", - "start": 22, - "end": 42, - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 28 - } - }, + "start":22,"end":42,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":28}}, "callee": { "type": "MemberExpression", - "start": 22, - "end": 32, - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 18 - } - }, + "start":22,"end":32,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":18}}, "object": { "type": "Identifier", - "start": 22, - "end": 26, - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 12 - }, - "identifierName": "JSON" - }, + "start":22,"end":26,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":12},"identifierName":"JSON"}, "name": "JSON" }, "property": { "type": "Identifier", - "start": 27, - "end": 32, - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 18 - }, - "identifierName": "parse" - }, + "start":27,"end":32,"loc":{"start":{"line":2,"column":13},"end":{"line":2,"column":18},"identifierName":"parse"}, "name": "parse" }, "computed": false @@ -228,19 +60,7 @@ "arguments": [ { "type": "Identifier", - "start": 33, - "end": 41, - "loc": { - "start": { - "line": 2, - "column": 19 - }, - "end": { - "line": 2, - "column": 27 - }, - "identifierName": "whatever" - }, + "start":33,"end":41,"loc":{"start":{"line":2,"column":19},"end":{"line":2,"column":27},"identifierName":"whatever"}, "name": "whatever" } ] @@ -251,124 +71,33 @@ }, "handler": { "type": "CatchClause", - "start": 48, - "end": 87, - "loc": { - "start": { - "line": 3, - "column": 2 - }, - "end": { - "line": 3, - "column": 41 - } - }, + "start":48,"end":87,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":41}}, "param": { "type": "Identifier", - "start": 55, - "end": 60, - "loc": { - "start": { - "line": 3, - "column": 9 - }, - "end": { - "line": 3, - "column": 14 - }, - "identifierName": "error" - }, + "start":55,"end":60,"loc":{"start":{"line":3,"column":9},"end":{"line":3,"column":14},"identifierName":"error"}, "name": "error" }, "body": { "type": "BlockStatement", - "start": 62, - "end": 87, - "loc": { - "start": { - "line": 3, - "column": 16 - }, - "end": { - "line": 3, - "column": 41 - } - }, + "start":62,"end":87,"loc":{"start":{"line":3,"column":16},"end":{"line":3,"column":41}}, "body": [ { "type": "ExpressionStatement", - "start": 64, - "end": 85, - "loc": { - "start": { - "line": 3, - "column": 18 - }, - "end": { - "line": 3, - "column": 39 - } - }, + "start":64,"end":85,"loc":{"start":{"line":3,"column":18},"end":{"line":3,"column":39}}, "expression": { "type": "CallExpression", - "start": 64, - "end": 84, - "loc": { - "start": { - "line": 3, - "column": 18 - }, - "end": { - "line": 3, - "column": 38 - } - }, + "start":64,"end":84,"loc":{"start":{"line":3,"column":18},"end":{"line":3,"column":38}}, "callee": { "type": "MemberExpression", - "start": 64, - "end": 77, - "loc": { - "start": { - "line": 3, - "column": 18 - }, - "end": { - "line": 3, - "column": 31 - } - }, + "start":64,"end":77,"loc":{"start":{"line":3,"column":18},"end":{"line":3,"column":31}}, "object": { "type": "Identifier", - "start": 64, - "end": 71, - "loc": { - "start": { - "line": 3, - "column": 18 - }, - "end": { - "line": 3, - "column": 25 - }, - "identifierName": "console" - }, + "start":64,"end":71,"loc":{"start":{"line":3,"column":18},"end":{"line":3,"column":25},"identifierName":"console"}, "name": "console" }, "property": { "type": "Identifier", - "start": 72, - "end": 77, - "loc": { - "start": { - "line": 3, - "column": 26 - }, - "end": { - "line": 3, - "column": 31 - }, - "identifierName": "error" - }, + "start":72,"end":77,"loc":{"start":{"line":3,"column":26},"end":{"line":3,"column":31},"identifierName":"error"}, "name": "error" }, "computed": false @@ -376,19 +105,7 @@ "arguments": [ { "type": "Identifier", - "start": 78, - "end": 83, - "loc": { - "start": { - "line": 3, - "column": 32 - }, - "end": { - "line": 3, - "column": 37 - }, - "identifierName": "error" - }, + "start":78,"end":83,"loc":{"start":{"line":3,"column":32},"end":{"line":3,"column":37},"identifierName":"error"}, "name": "error" } ] @@ -400,79 +117,23 @@ }, "finalizer": { "type": "BlockStatement", - "start": 98, - "end": 115, - "loc": { - "start": { - "line": 4, - "column": 10 - }, - "end": { - "line": 4, - "column": 27 - } - }, + "start":98,"end":115,"loc":{"start":{"line":4,"column":10},"end":{"line":4,"column":27}}, "body": [ { "type": "ExpressionStatement", - "start": 100, - "end": 113, - "loc": { - "start": { - "line": 4, - "column": 12 - }, - "end": { - "line": 4, - "column": 25 - } - }, + "start":100,"end":113,"loc":{"start":{"line":4,"column":12},"end":{"line":4,"column":25}}, "expression": { "type": "CallExpression", - "start": 100, - "end": 112, - "loc": { - "start": { - "line": 4, - "column": 12 - }, - "end": { - "line": 4, - "column": 24 - } - }, + "start":100,"end":112,"loc":{"start":{"line":4,"column":12},"end":{"line":4,"column":24}}, "callee": { "type": "Identifier", - "start": 100, - "end": 109, - "loc": { - "start": { - "line": 4, - "column": 12 - }, - "end": { - "line": 4, - "column": 21 - }, - "identifierName": "something" - }, + "start":100,"end":109,"loc":{"start":{"line":4,"column":12},"end":{"line":4,"column":21},"identifierName":"something"}, "name": "something" }, "arguments": [ { "type": "PipelinePrimaryTopicReference", - "start": 110, - "end": 111, - "loc": { - "start": { - "line": 4, - "column": 22 - }, - "end": { - "line": 4, - "column": 23 - } - } + "start":110,"end":111,"loc":{"start":{"line":4,"column":22},"end":{"line":4,"column":23}} } ] } diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-topic-style,-do-expression,-try-statement,-outer-topic-reference-in-try-clause-with-catch-and-finally/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-topic-style,-do-expression,-try-statement,-outer-topic-reference-in-try-clause-with-catch-and-finally/output.json index 95c03c8c90e3..117b71e8c537 100644 --- a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-topic-style,-do-expression,-try-statement,-outer-topic-reference-in-try-clause-with-catch-and-finally/output.json +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-topic-style,-do-expression,-try-statement,-outer-topic-reference-in-try-clause-with-catch-and-finally/output.json @@ -1,226 +1,58 @@ { "type": "File", - "start": 0, - "end": 109, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 1 - } - }, + "start":0,"end":109,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 109, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 1 - } - }, + "start":0,"end":109,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 109, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 1 - } - }, + "start":0,"end":109,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, "expression": { "type": "BinaryExpression", - "start": 0, - "end": 109, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 1 - } - }, + "start":0,"end":109,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, "left": { "type": "Identifier", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "value" - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5},"identifierName":"value"}, "name": "value" }, "operator": "|>", "right": { "type": "PipelineTopicExpression", - "start": 9, - "end": 109, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 5, - "column": 1 - } - }, + "start":9,"end":109,"loc":{"start":{"line":1,"column":9},"end":{"line":5,"column":1}}, "expression": { "type": "DoExpression", - "start": 9, - "end": 109, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 5, - "column": 1 - } - }, + "start":9,"end":109,"loc":{"start":{"line":1,"column":9},"end":{"line":5,"column":1}}, "body": { "type": "BlockStatement", - "start": 12, - "end": 109, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 5, - "column": 1 - } - }, + "start":12,"end":109,"loc":{"start":{"line":1,"column":12},"end":{"line":5,"column":1}}, "body": [ { "type": "TryStatement", - "start": 16, - "end": 107, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 4, - "column": 26 - } - }, + "start":16,"end":107,"loc":{"start":{"line":2,"column":2},"end":{"line":4,"column":26}}, "block": { "type": "BlockStatement", - "start": 20, - "end": 38, - "loc": { - "start": { - "line": 2, - "column": 6 - }, - "end": { - "line": 2, - "column": 24 - } - }, + "start":20,"end":38,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":24}}, "body": [ { "type": "ExpressionStatement", - "start": 22, - "end": 36, - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 22 - } - }, + "start":22,"end":36,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":22}}, "expression": { "type": "CallExpression", - "start": 22, - "end": 35, - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 21 - } - }, + "start":22,"end":35,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":21}}, "callee": { "type": "MemberExpression", - "start": 22, - "end": 32, - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 18 - } - }, + "start":22,"end":32,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":18}}, "object": { "type": "Identifier", - "start": 22, - "end": 26, - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 12 - }, - "identifierName": "JSON" - }, + "start":22,"end":26,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":12},"identifierName":"JSON"}, "name": "JSON" }, "property": { "type": "Identifier", - "start": 27, - "end": 32, - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 18 - }, - "identifierName": "parse" - }, + "start":27,"end":32,"loc":{"start":{"line":2,"column":13},"end":{"line":2,"column":18},"identifierName":"parse"}, "name": "parse" }, "computed": false @@ -228,18 +60,7 @@ "arguments": [ { "type": "PipelinePrimaryTopicReference", - "start": 33, - "end": 34, - "loc": { - "start": { - "line": 2, - "column": 19 - }, - "end": { - "line": 2, - "column": 20 - } - } + "start":33,"end":34,"loc":{"start":{"line":2,"column":19},"end":{"line":2,"column":20}} } ] } @@ -249,124 +70,33 @@ }, "handler": { "type": "CatchClause", - "start": 41, - "end": 80, - "loc": { - "start": { - "line": 3, - "column": 2 - }, - "end": { - "line": 3, - "column": 41 - } - }, + "start":41,"end":80,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":41}}, "param": { "type": "Identifier", - "start": 48, - "end": 53, - "loc": { - "start": { - "line": 3, - "column": 9 - }, - "end": { - "line": 3, - "column": 14 - }, - "identifierName": "error" - }, + "start":48,"end":53,"loc":{"start":{"line":3,"column":9},"end":{"line":3,"column":14},"identifierName":"error"}, "name": "error" }, "body": { "type": "BlockStatement", - "start": 55, - "end": 80, - "loc": { - "start": { - "line": 3, - "column": 16 - }, - "end": { - "line": 3, - "column": 41 - } - }, + "start":55,"end":80,"loc":{"start":{"line":3,"column":16},"end":{"line":3,"column":41}}, "body": [ { "type": "ExpressionStatement", - "start": 57, - "end": 78, - "loc": { - "start": { - "line": 3, - "column": 18 - }, - "end": { - "line": 3, - "column": 39 - } - }, + "start":57,"end":78,"loc":{"start":{"line":3,"column":18},"end":{"line":3,"column":39}}, "expression": { "type": "CallExpression", - "start": 57, - "end": 77, - "loc": { - "start": { - "line": 3, - "column": 18 - }, - "end": { - "line": 3, - "column": 38 - } - }, + "start":57,"end":77,"loc":{"start":{"line":3,"column":18},"end":{"line":3,"column":38}}, "callee": { "type": "MemberExpression", - "start": 57, - "end": 70, - "loc": { - "start": { - "line": 3, - "column": 18 - }, - "end": { - "line": 3, - "column": 31 - } - }, + "start":57,"end":70,"loc":{"start":{"line":3,"column":18},"end":{"line":3,"column":31}}, "object": { "type": "Identifier", - "start": 57, - "end": 64, - "loc": { - "start": { - "line": 3, - "column": 18 - }, - "end": { - "line": 3, - "column": 25 - }, - "identifierName": "console" - }, + "start":57,"end":64,"loc":{"start":{"line":3,"column":18},"end":{"line":3,"column":25},"identifierName":"console"}, "name": "console" }, "property": { "type": "Identifier", - "start": 65, - "end": 70, - "loc": { - "start": { - "line": 3, - "column": 26 - }, - "end": { - "line": 3, - "column": 31 - }, - "identifierName": "error" - }, + "start":65,"end":70,"loc":{"start":{"line":3,"column":26},"end":{"line":3,"column":31},"identifierName":"error"}, "name": "error" }, "computed": false @@ -374,19 +104,7 @@ "arguments": [ { "type": "Identifier", - "start": 71, - "end": 76, - "loc": { - "start": { - "line": 3, - "column": 32 - }, - "end": { - "line": 3, - "column": 37 - }, - "identifierName": "error" - }, + "start":71,"end":76,"loc":{"start":{"line":3,"column":32},"end":{"line":3,"column":37},"identifierName":"error"}, "name": "error" } ] @@ -398,62 +116,17 @@ }, "finalizer": { "type": "BlockStatement", - "start": 91, - "end": 107, - "loc": { - "start": { - "line": 4, - "column": 10 - }, - "end": { - "line": 4, - "column": 26 - } - }, + "start":91,"end":107,"loc":{"start":{"line":4,"column":10},"end":{"line":4,"column":26}}, "body": [ { "type": "ExpressionStatement", - "start": 93, - "end": 105, - "loc": { - "start": { - "line": 4, - "column": 12 - }, - "end": { - "line": 4, - "column": 24 - } - }, + "start":93,"end":105,"loc":{"start":{"line":4,"column":12},"end":{"line":4,"column":24}}, "expression": { "type": "CallExpression", - "start": 93, - "end": 104, - "loc": { - "start": { - "line": 4, - "column": 12 - }, - "end": { - "line": 4, - "column": 23 - } - }, + "start":93,"end":104,"loc":{"start":{"line":4,"column":12},"end":{"line":4,"column":23}}, "callee": { "type": "Identifier", - "start": 93, - "end": 102, - "loc": { - "start": { - "line": 4, - "column": 12 - }, - "end": { - "line": 4, - "column": 21 - }, - "identifierName": "something" - }, + "start":93,"end":102,"loc":{"start":{"line":4,"column":12},"end":{"line":4,"column":21},"identifierName":"something"}, "name": "something" }, "arguments": [] diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-topic-style,-do-expression,-try-statement,-outer-topic-reference-in-try-clause-with-catch/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-topic-style,-do-expression,-try-statement,-outer-topic-reference-in-try-clause-with-catch/output.json index cf2f95415e23..74e0c37287ce 100644 --- a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-topic-style,-do-expression,-try-statement,-outer-topic-reference-in-try-clause-with-catch/output.json +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-topic-style,-do-expression,-try-statement,-outer-topic-reference-in-try-clause-with-catch/output.json @@ -1,226 +1,58 @@ { "type": "File", - "start": 0, - "end": 82, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":0,"end":82,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 82, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":0,"end":82,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 82, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":0,"end":82,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, "expression": { "type": "BinaryExpression", - "start": 0, - "end": 82, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":0,"end":82,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, "left": { "type": "Identifier", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "value" - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5},"identifierName":"value"}, "name": "value" }, "operator": "|>", "right": { "type": "PipelineTopicExpression", - "start": 9, - "end": 82, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":9,"end":82,"loc":{"start":{"line":1,"column":9},"end":{"line":4,"column":1}}, "expression": { "type": "DoExpression", - "start": 9, - "end": 82, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":9,"end":82,"loc":{"start":{"line":1,"column":9},"end":{"line":4,"column":1}}, "body": { "type": "BlockStatement", - "start": 12, - "end": 82, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":12,"end":82,"loc":{"start":{"line":1,"column":12},"end":{"line":4,"column":1}}, "body": [ { "type": "TryStatement", - "start": 16, - "end": 80, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 3, - "column": 41 - } - }, + "start":16,"end":80,"loc":{"start":{"line":2,"column":2},"end":{"line":3,"column":41}}, "block": { "type": "BlockStatement", - "start": 20, - "end": 38, - "loc": { - "start": { - "line": 2, - "column": 6 - }, - "end": { - "line": 2, - "column": 24 - } - }, + "start":20,"end":38,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":24}}, "body": [ { "type": "ExpressionStatement", - "start": 22, - "end": 36, - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 22 - } - }, + "start":22,"end":36,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":22}}, "expression": { "type": "CallExpression", - "start": 22, - "end": 35, - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 21 - } - }, + "start":22,"end":35,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":21}}, "callee": { "type": "MemberExpression", - "start": 22, - "end": 32, - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 18 - } - }, + "start":22,"end":32,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":18}}, "object": { "type": "Identifier", - "start": 22, - "end": 26, - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 12 - }, - "identifierName": "JSON" - }, + "start":22,"end":26,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":12},"identifierName":"JSON"}, "name": "JSON" }, "property": { "type": "Identifier", - "start": 27, - "end": 32, - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 18 - }, - "identifierName": "parse" - }, + "start":27,"end":32,"loc":{"start":{"line":2,"column":13},"end":{"line":2,"column":18},"identifierName":"parse"}, "name": "parse" }, "computed": false @@ -228,18 +60,7 @@ "arguments": [ { "type": "PipelinePrimaryTopicReference", - "start": 33, - "end": 34, - "loc": { - "start": { - "line": 2, - "column": 19 - }, - "end": { - "line": 2, - "column": 20 - } - } + "start":33,"end":34,"loc":{"start":{"line":2,"column":19},"end":{"line":2,"column":20}} } ] } @@ -249,124 +70,33 @@ }, "handler": { "type": "CatchClause", - "start": 41, - "end": 80, - "loc": { - "start": { - "line": 3, - "column": 2 - }, - "end": { - "line": 3, - "column": 41 - } - }, + "start":41,"end":80,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":41}}, "param": { "type": "Identifier", - "start": 48, - "end": 53, - "loc": { - "start": { - "line": 3, - "column": 9 - }, - "end": { - "line": 3, - "column": 14 - }, - "identifierName": "error" - }, + "start":48,"end":53,"loc":{"start":{"line":3,"column":9},"end":{"line":3,"column":14},"identifierName":"error"}, "name": "error" }, "body": { "type": "BlockStatement", - "start": 55, - "end": 80, - "loc": { - "start": { - "line": 3, - "column": 16 - }, - "end": { - "line": 3, - "column": 41 - } - }, + "start":55,"end":80,"loc":{"start":{"line":3,"column":16},"end":{"line":3,"column":41}}, "body": [ { "type": "ExpressionStatement", - "start": 57, - "end": 78, - "loc": { - "start": { - "line": 3, - "column": 18 - }, - "end": { - "line": 3, - "column": 39 - } - }, + "start":57,"end":78,"loc":{"start":{"line":3,"column":18},"end":{"line":3,"column":39}}, "expression": { "type": "CallExpression", - "start": 57, - "end": 77, - "loc": { - "start": { - "line": 3, - "column": 18 - }, - "end": { - "line": 3, - "column": 38 - } - }, + "start":57,"end":77,"loc":{"start":{"line":3,"column":18},"end":{"line":3,"column":38}}, "callee": { "type": "MemberExpression", - "start": 57, - "end": 70, - "loc": { - "start": { - "line": 3, - "column": 18 - }, - "end": { - "line": 3, - "column": 31 - } - }, + "start":57,"end":70,"loc":{"start":{"line":3,"column":18},"end":{"line":3,"column":31}}, "object": { "type": "Identifier", - "start": 57, - "end": 64, - "loc": { - "start": { - "line": 3, - "column": 18 - }, - "end": { - "line": 3, - "column": 25 - }, - "identifierName": "console" - }, + "start":57,"end":64,"loc":{"start":{"line":3,"column":18},"end":{"line":3,"column":25},"identifierName":"console"}, "name": "console" }, "property": { "type": "Identifier", - "start": 65, - "end": 70, - "loc": { - "start": { - "line": 3, - "column": 26 - }, - "end": { - "line": 3, - "column": 31 - }, - "identifierName": "error" - }, + "start":65,"end":70,"loc":{"start":{"line":3,"column":26},"end":{"line":3,"column":31},"identifierName":"error"}, "name": "error" }, "computed": false @@ -374,19 +104,7 @@ "arguments": [ { "type": "Identifier", - "start": 71, - "end": 76, - "loc": { - "start": { - "line": 3, - "column": 32 - }, - "end": { - "line": 3, - "column": 37 - }, - "identifierName": "error" - }, + "start":71,"end":76,"loc":{"start":{"line":3,"column":32},"end":{"line":3,"column":37},"identifierName":"error"}, "name": "error" } ] diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-topic-style,-do-expression,-while-loop,-outer-topic-reference-in-loop-head/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-topic-style,-do-expression,-while-loop,-outer-topic-reference-in-loop-head/output.json index e3714c89c3b5..0e266f4100f6 100644 --- a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-topic-style,-do-expression,-while-loop,-outer-topic-reference-in-loop-head/output.json +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-topic-style,-do-expression,-while-loop,-outer-topic-reference-in-loop-head/output.json @@ -1,245 +1,66 @@ { "type": "File", - "start": 0, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 37 - } - }, + "start":0,"end":37,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":37}}, "program": { "type": "Program", - "start": 0, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 37 - } - }, + "start":0,"end":37,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":37}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 37 - } - }, + "start":0,"end":37,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":37}}, "expression": { "type": "BinaryExpression", - "start": 0, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 37 - } - }, + "start":0,"end":37,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":37}}, "left": { "type": "Identifier", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "value" - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5},"identifierName":"value"}, "name": "value" }, "operator": "|>", "right": { "type": "PipelineTopicExpression", - "start": 9, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 37 - } - }, + "start":9,"end":37,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":37}}, "expression": { "type": "DoExpression", - "start": 9, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 37 - } - }, + "start":9,"end":37,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":37}}, "body": { "type": "BlockStatement", - "start": 12, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 37 - } - }, + "start":12,"end":37,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":37}}, "body": [ { "type": "WhileStatement", - "start": 14, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":14,"end":35,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":35}}, "test": { "type": "BinaryExpression", - "start": 21, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":21,"end":26,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":26}}, "left": { "type": "Identifier", - "start": 21, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 22 - }, - "identifierName": "x" - }, + "start":21,"end":22,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":22},"identifierName":"x"}, "name": "x" }, "operator": "<", "right": { "type": "PipelinePrimaryTopicReference", - "start": 25, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 26 - } - } + "start":25,"end":26,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":26}} } }, "body": { "type": "ExpressionStatement", - "start": 28, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":28,"end":35,"loc":{"start":{"line":1,"column":28},"end":{"line":1,"column":35}}, "expression": { "type": "AssignmentExpression", - "start": 28, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":28,"end":34,"loc":{"start":{"line":1,"column":28},"end":{"line":1,"column":34}}, "operator": "+=", "left": { "type": "Identifier", - "start": 28, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 29 - }, - "identifierName": "x" - }, + "start":28,"end":29,"loc":{"start":{"line":1,"column":28},"end":{"line":1,"column":29},"identifierName":"x"}, "name": "x" }, "right": { "type": "NumericLiteral", - "start": 33, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 33 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":33,"end":34,"loc":{"start":{"line":1,"column":33},"end":{"line":1,"column":34}}, "extra": { "rawValue": 1, "raw": "1" diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-topic-style,-function-call,-identifier-with-topic-reference/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-topic-style,-function-call,-identifier-with-topic-reference/output.json index 3ee59b9da5c3..db2ecd011344 100644 --- a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-topic-style,-function-call,-identifier-with-topic-reference/output.json +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-topic-style,-function-call,-identifier-with-topic-reference/output.json @@ -1,140 +1,39 @@ { "type": "File", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "program": { "type": "Program", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "expression": { "type": "BinaryExpression", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "left": { "type": "Identifier", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "value" - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5},"identifierName":"value"}, "name": "value" }, "operator": "|>", "right": { "type": "PipelineTopicExpression", - "start": 9, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":9,"end":13,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":13}}, "expression": { "type": "CallExpression", - "start": 9, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":9,"end":13,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":13}}, "callee": { "type": "Identifier", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - }, - "identifierName": "f" - }, + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"f"}, "name": "f" }, "arguments": [ { "type": "PipelinePrimaryTopicReference", - "start": 11, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - } + "start":11,"end":12,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":12}} } ] } diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-topic-style,-function-definition,-outer-topic-reference-in-default-parameter-expression/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-topic-style,-function-definition,-outer-topic-reference-in-default-parameter-expression/output.json index c5ba3fb13a9c..872350783544 100644 --- a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-topic-style,-function-definition,-outer-topic-reference-in-default-parameter-expression/output.json +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-topic-style,-function-definition,-outer-topic-reference-in-default-parameter-expression/output.json @@ -1,204 +1,58 @@ { "type": "File", - "start": 0, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 39 - } - }, + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":39}}, "program": { "type": "Program", - "start": 0, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 39 - } - }, + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":39}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 39 - } - }, + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":39}}, "expression": { "type": "BinaryExpression", - "start": 0, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 39 - } - }, + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":39}}, "left": { "type": "Identifier", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "value" - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5},"identifierName":"value"}, "name": "value" }, "operator": "|>", "right": { "type": "PipelineTopicExpression", - "start": 9, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 39 - } - }, + "start":9,"end":39,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":39}}, "expression": { "type": "FunctionExpression", - "start": 9, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 39 - } - }, + "start":9,"end":39,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":39}}, "id": null, "generator": false, "async": false, "params": [ { "type": "AssignmentPattern", - "start": 19, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":19,"end":24,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":24}}, "left": { "type": "Identifier", - "start": 19, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 20 - }, - "identifierName": "x" - }, + "start":19,"end":20,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":20},"identifierName":"x"}, "name": "x" }, "right": { "type": "PipelinePrimaryTopicReference", - "start": 23, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 24 - } - } + "start":23,"end":24,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":24}} } } ], "body": { "type": "BlockStatement", - "start": 26, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 39 - } - }, + "start":26,"end":39,"loc":{"start":{"line":1,"column":26},"end":{"line":1,"column":39}}, "body": [ { "type": "ReturnStatement", - "start": 28, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 37 - } - }, + "start":28,"end":37,"loc":{"start":{"line":1,"column":28},"end":{"line":1,"column":37}}, "argument": { "type": "Identifier", - "start": 35, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 35 - }, - "end": { - "line": 1, - "column": 36 - }, - "identifierName": "x" - }, + "start":35,"end":36,"loc":{"start":{"line":1,"column":35},"end":{"line":1,"column":36},"identifierName":"x"}, "name": "x" } } diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-topic-style,-generator-yield/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-topic-style,-generator-yield/output.json index ad59accc2de2..3df77e4676db 100644 --- a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-topic-style,-generator-yield/output.json +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-topic-style,-generator-yield/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 44, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":44,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 44, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":44,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 44, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":44,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "id": { "type": "Identifier", - "start": 11, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "f" - }, + "start":11,"end":12,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":12},"identifierName":"f"}, "name": "f" }, "generator": true, @@ -65,108 +20,30 @@ "params": [], "body": { "type": "BlockStatement", - "start": 16, - "end": 44, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":16,"end":44,"loc":{"start":{"line":1,"column":16},"end":{"line":3,"column":1}}, "body": [ { "type": "ReturnStatement", - "start": 20, - "end": 42, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 24 - } - }, + "start":20,"end":42,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":24}}, "argument": { "type": "BinaryExpression", - "start": 27, - "end": 41, - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 23 - } - }, + "start":27,"end":41,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":23}}, "left": { "type": "Identifier", - "start": 27, - "end": 28, - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 10 - }, - "identifierName": "x" - }, + "start":27,"end":28,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":10},"identifierName":"x"}, "name": "x" }, "operator": "|>", "right": { "type": "PipelineTopicExpression", - "start": 32, - "end": 41, - "loc": { - "start": { - "line": 2, - "column": 14 - }, - "end": { - "line": 2, - "column": 23 - } - }, + "start":32,"end":41,"loc":{"start":{"line":2,"column":14},"end":{"line":2,"column":23}}, "expression": { "type": "YieldExpression", - "start": 33, - "end": 40, - "loc": { - "start": { - "line": 2, - "column": 15 - }, - "end": { - "line": 2, - "column": 22 - } - }, + "start":33,"end":40,"loc":{"start":{"line":2,"column":15},"end":{"line":2,"column":22}}, "delegate": false, "argument": { "type": "PipelinePrimaryTopicReference", - "start": 39, - "end": 40, - "loc": { - "start": { - "line": 2, - "column": 21 - }, - "end": { - "line": 2, - "column": 22 - } - } + "start":39,"end":40,"loc":{"start":{"line":2,"column":21},"end":{"line":2,"column":22}} }, "extra": { "parenthesized": true, diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-topic-style,-identity,-parenthesized/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-topic-style,-identity,-parenthesized/output.json index 3d951c7dcb90..81102e182a6e 100644 --- a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-topic-style,-identity,-parenthesized/output.json +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-topic-style,-identity,-parenthesized/output.json @@ -1,108 +1,30 @@ { "type": "File", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, "program": { "type": "Program", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, "expression": { "type": "BinaryExpression", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, "left": { "type": "Identifier", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "value" - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5},"identifierName":"value"}, "name": "value" }, "operator": "|>", "right": { "type": "PipelineTopicExpression", - "start": 9, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":9,"end":12,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":12}}, "expression": { "type": "PipelinePrimaryTopicReference", - "start": 10, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11}}, "extra": { "parenthesized": true, "parenStart": 9 diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-topic-style,-identity,-unparenthesized/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-topic-style,-identity,-unparenthesized/output.json index 147e066345a3..cb533784bce8 100644 --- a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-topic-style,-identity,-unparenthesized/output.json +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-topic-style,-identity,-unparenthesized/output.json @@ -1,108 +1,30 @@ { "type": "File", - "start": 0, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, "program": { "type": "Program", - "start": 0, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, "expression": { "type": "BinaryExpression", - "start": 0, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, "left": { "type": "Identifier", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "value" - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5},"identifierName":"value"}, "name": "value" }, "operator": "|>", "right": { "type": "PipelineTopicExpression", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10}}, "expression": { "type": "PipelinePrimaryTopicReference", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - } + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10}} } } } diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-topic-style,-mixed-pipeline-plugins/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-topic-style,-mixed-pipeline-plugins/output.json index 147e066345a3..cb533784bce8 100644 --- a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-topic-style,-mixed-pipeline-plugins/output.json +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-topic-style,-mixed-pipeline-plugins/output.json @@ -1,108 +1,30 @@ { "type": "File", - "start": 0, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, "program": { "type": "Program", - "start": 0, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, "expression": { "type": "BinaryExpression", - "start": 0, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, "left": { "type": "Identifier", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "value" - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5},"identifierName":"value"}, "name": "value" }, "operator": "|>", "right": { "type": "PipelineTopicExpression", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10}}, "expression": { "type": "PipelinePrimaryTopicReference", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - } + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10}} } } } diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-topic-style,-parenthesized-single-line-arrow-function,-with-empty-parameter-list-and-bare-addition-body/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-topic-style,-parenthesized-single-line-arrow-function,-with-empty-parameter-list-and-bare-addition-body/output.json index 23ba6b6a9dd4..c6606b33e146 100644 --- a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-topic-style,-parenthesized-single-line-arrow-function,-with-empty-parameter-list-and-bare-addition-body/output.json +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-topic-style,-parenthesized-single-line-arrow-function,-with-empty-parameter-list-and-bare-addition-body/output.json @@ -1,156 +1,45 @@ { "type": "File", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "program": { "type": "Program", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "expression": { "type": "BinaryExpression", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "left": { "type": "Identifier", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "value" - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5},"identifierName":"value"}, "name": "value" }, "operator": "|>", "right": { "type": "PipelineTopicExpression", - "start": 9, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":9,"end":22,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":22}}, "expression": { "type": "ArrowFunctionExpression", - "start": 10, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":10,"end":21,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":21}}, "id": null, "generator": false, "async": false, "params": [], "body": { "type": "BinaryExpression", - "start": 16, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":16,"end":21,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":21}}, "left": { "type": "PipelinePrimaryTopicReference", - "start": 16, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - } + "start":16,"end":17,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":17}} }, "operator": "+", "right": { "type": "NumericLiteral", - "start": 20, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":20,"end":21,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":21}}, "extra": { "rawValue": 1, "raw": "1" diff --git a/packages/babel-parser/test/fixtures/experimental/record-and-tuple/bar-flow/input.js b/packages/babel-parser/test/fixtures/experimental/record-and-tuple/bar-flow/input.js new file mode 100644 index 000000000000..0562b27afb00 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/record-and-tuple/bar-flow/input.js @@ -0,0 +1 @@ +var a: {| x: number |} = {| x: 2 |} diff --git a/packages/babel-parser/test/fixtures/experimental/record-and-tuple/bar-flow/options.json b/packages/babel-parser/test/fixtures/experimental/record-and-tuple/bar-flow/options.json new file mode 100644 index 000000000000..001c7217b722 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/record-and-tuple/bar-flow/options.json @@ -0,0 +1,6 @@ +{ + "plugins": [ + ["recordAndTuple", { "syntaxType": "bar" }], + ["flow"] + ] +} diff --git a/packages/babel-parser/test/fixtures/experimental/record-and-tuple/bar-flow/output.json b/packages/babel-parser/test/fixtures/experimental/record-and-tuple/bar-flow/output.json new file mode 100644 index 000000000000..33b1ddf85eee --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/record-and-tuple/bar-flow/output.json @@ -0,0 +1,90 @@ +{ + "type": "File", + "start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":35}}, + "program": { + "type": "Program", + "start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":35}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":35}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":4,"end":35,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":35}}, + "id": { + "type": "Identifier", + "start":4,"end":22,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":22},"identifierName":"a"}, + "name": "a", + "typeAnnotation": { + "type": "TypeAnnotation", + "start":5,"end":22,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":22}}, + "typeAnnotation": { + "type": "ObjectTypeAnnotation", + "start":7,"end":22,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":22}}, + "callProperties": [], + "properties": [ + { + "type": "ObjectTypeProperty", + "start":10,"end":19,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":19}}, + "key": { + "type": "Identifier", + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11},"identifierName":"x"}, + "name": "x" + }, + "static": false, + "proto": false, + "kind": "init", + "method": false, + "value": { + "type": "NumberTypeAnnotation", + "start":13,"end":19,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":19}} + }, + "variance": null, + "optional": false + } + ], + "indexers": [], + "internalSlots": [], + "exact": true, + "inexact": false + } + } + }, + "init": { + "type": "RecordExpression", + "start":25,"end":35,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":35}}, + "properties": [ + { + "type": "ObjectProperty", + "start":28,"end":32,"loc":{"start":{"line":1,"column":28},"end":{"line":1,"column":32}}, + "method": false, + "key": { + "type": "Identifier", + "start":28,"end":29,"loc":{"start":{"line":1,"column":28},"end":{"line":1,"column":29},"identifierName":"x"}, + "name": "x" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "NumericLiteral", + "start":31,"end":32,"loc":{"start":{"line":1,"column":31},"end":{"line":1,"column":32}}, + "extra": { + "rawValue": 2, + "raw": "2" + }, + "value": 2 + } + } + ] + } + } + ], + "kind": "var" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/record-and-tuple/bar/input.js b/packages/babel-parser/test/fixtures/experimental/record-and-tuple/bar/input.js new file mode 100644 index 000000000000..685ddb9ec7f4 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/record-and-tuple/bar/input.js @@ -0,0 +1,16 @@ +{||}; + +{| a: 1, b: 2, c: 3 |}; + +{| + a: 1, + b: {| + c: 3, + |}, +|}; + +[||]; + +[|1, 2, 3|]; + +[|1, [|2, 3|], 4|]; diff --git a/packages/babel-parser/test/fixtures/experimental/record-and-tuple/bar/options.json b/packages/babel-parser/test/fixtures/experimental/record-and-tuple/bar/options.json new file mode 100644 index 000000000000..bf5a72aaff3c --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/record-and-tuple/bar/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["recordAndTuple", { "syntaxType": "bar" }]] +} diff --git a/packages/babel-parser/test/fixtures/experimental/record-and-tuple/bar/output.json b/packages/babel-parser/test/fixtures/experimental/record-and-tuple/bar/output.json new file mode 100644 index 000000000000..0efc35cc94e8 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/record-and-tuple/bar/output.json @@ -0,0 +1,269 @@ +{ + "type": "File", + "start":0,"end":112,"loc":{"start":{"line":1,"column":0},"end":{"line":16,"column":19}}, + "program": { + "type": "Program", + "start":0,"end":112,"loc":{"start":{"line":1,"column":0},"end":{"line":16,"column":19}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, + "expression": { + "type": "RecordExpression", + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, + "properties": [] + } + }, + { + "type": "ExpressionStatement", + "start":7,"end":30,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":23}}, + "expression": { + "type": "RecordExpression", + "start":7,"end":29,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":22}}, + "properties": [ + { + "type": "ObjectProperty", + "start":10,"end":14,"loc":{"start":{"line":3,"column":3},"end":{"line":3,"column":7}}, + "method": false, + "key": { + "type": "Identifier", + "start":10,"end":11,"loc":{"start":{"line":3,"column":3},"end":{"line":3,"column":4},"identifierName":"a"}, + "name": "a" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "NumericLiteral", + "start":13,"end":14,"loc":{"start":{"line":3,"column":6},"end":{"line":3,"column":7}}, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + }, + { + "type": "ObjectProperty", + "start":16,"end":20,"loc":{"start":{"line":3,"column":9},"end":{"line":3,"column":13}}, + "method": false, + "key": { + "type": "Identifier", + "start":16,"end":17,"loc":{"start":{"line":3,"column":9},"end":{"line":3,"column":10},"identifierName":"b"}, + "name": "b" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "NumericLiteral", + "start":19,"end":20,"loc":{"start":{"line":3,"column":12},"end":{"line":3,"column":13}}, + "extra": { + "rawValue": 2, + "raw": "2" + }, + "value": 2 + } + }, + { + "type": "ObjectProperty", + "start":22,"end":26,"loc":{"start":{"line":3,"column":15},"end":{"line":3,"column":19}}, + "method": false, + "key": { + "type": "Identifier", + "start":22,"end":23,"loc":{"start":{"line":3,"column":15},"end":{"line":3,"column":16},"identifierName":"c"}, + "name": "c" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "NumericLiteral", + "start":25,"end":26,"loc":{"start":{"line":3,"column":18},"end":{"line":3,"column":19}}, + "extra": { + "rawValue": 3, + "raw": "3" + }, + "value": 3 + } + } + ] + } + }, + { + "type": "ExpressionStatement", + "start":32,"end":70,"loc":{"start":{"line":5,"column":0},"end":{"line":10,"column":3}}, + "expression": { + "type": "RecordExpression", + "start":32,"end":69,"loc":{"start":{"line":5,"column":0},"end":{"line":10,"column":2}}, + "properties": [ + { + "type": "ObjectProperty", + "start":37,"end":41,"loc":{"start":{"line":6,"column":2},"end":{"line":6,"column":6}}, + "method": false, + "key": { + "type": "Identifier", + "start":37,"end":38,"loc":{"start":{"line":6,"column":2},"end":{"line":6,"column":3},"identifierName":"a"}, + "name": "a" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "NumericLiteral", + "start":40,"end":41,"loc":{"start":{"line":6,"column":5},"end":{"line":6,"column":6}}, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + }, + { + "type": "ObjectProperty", + "start":45,"end":65,"loc":{"start":{"line":7,"column":2},"end":{"line":9,"column":4}}, + "method": false, + "key": { + "type": "Identifier", + "start":45,"end":46,"loc":{"start":{"line":7,"column":2},"end":{"line":7,"column":3},"identifierName":"b"}, + "name": "b" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "RecordExpression", + "start":48,"end":65,"loc":{"start":{"line":7,"column":5},"end":{"line":9,"column":4}}, + "properties": [ + { + "type": "ObjectProperty", + "start":55,"end":59,"loc":{"start":{"line":8,"column":4},"end":{"line":8,"column":8}}, + "method": false, + "key": { + "type": "Identifier", + "start":55,"end":56,"loc":{"start":{"line":8,"column":4},"end":{"line":8,"column":5},"identifierName":"c"}, + "name": "c" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "NumericLiteral", + "start":58,"end":59,"loc":{"start":{"line":8,"column":7},"end":{"line":8,"column":8}}, + "extra": { + "rawValue": 3, + "raw": "3" + }, + "value": 3 + } + } + ], + "extra": { + "trailingComma": 59 + } + } + } + ], + "extra": { + "trailingComma": 65 + } + } + }, + { + "type": "ExpressionStatement", + "start":72,"end":77,"loc":{"start":{"line":12,"column":0},"end":{"line":12,"column":5}}, + "expression": { + "type": "TupleExpression", + "start":72,"end":76,"loc":{"start":{"line":12,"column":0},"end":{"line":12,"column":4}}, + "elements": [] + } + }, + { + "type": "ExpressionStatement", + "start":79,"end":91,"loc":{"start":{"line":14,"column":0},"end":{"line":14,"column":12}}, + "expression": { + "type": "TupleExpression", + "start":79,"end":90,"loc":{"start":{"line":14,"column":0},"end":{"line":14,"column":11}}, + "elements": [ + { + "type": "NumericLiteral", + "start":81,"end":82,"loc":{"start":{"line":14,"column":2},"end":{"line":14,"column":3}}, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + }, + { + "type": "NumericLiteral", + "start":84,"end":85,"loc":{"start":{"line":14,"column":5},"end":{"line":14,"column":6}}, + "extra": { + "rawValue": 2, + "raw": "2" + }, + "value": 2 + }, + { + "type": "NumericLiteral", + "start":87,"end":88,"loc":{"start":{"line":14,"column":8},"end":{"line":14,"column":9}}, + "extra": { + "rawValue": 3, + "raw": "3" + }, + "value": 3 + } + ] + } + }, + { + "type": "ExpressionStatement", + "start":93,"end":112,"loc":{"start":{"line":16,"column":0},"end":{"line":16,"column":19}}, + "expression": { + "type": "TupleExpression", + "start":93,"end":111,"loc":{"start":{"line":16,"column":0},"end":{"line":16,"column":18}}, + "elements": [ + { + "type": "NumericLiteral", + "start":95,"end":96,"loc":{"start":{"line":16,"column":2},"end":{"line":16,"column":3}}, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + }, + { + "type": "TupleExpression", + "start":98,"end":106,"loc":{"start":{"line":16,"column":5},"end":{"line":16,"column":13}}, + "elements": [ + { + "type": "NumericLiteral", + "start":100,"end":101,"loc":{"start":{"line":16,"column":7},"end":{"line":16,"column":8}}, + "extra": { + "rawValue": 2, + "raw": "2" + }, + "value": 2 + }, + { + "type": "NumericLiteral", + "start":103,"end":104,"loc":{"start":{"line":16,"column":10},"end":{"line":16,"column":11}}, + "extra": { + "rawValue": 3, + "raw": "3" + }, + "value": 3 + } + ] + }, + { + "type": "NumericLiteral", + "start":108,"end":109,"loc":{"start":{"line":16,"column":15},"end":{"line":16,"column":16}}, + "extra": { + "rawValue": 4, + "raw": "4" + }, + "value": 4 + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/record-and-tuple/hash/input.js b/packages/babel-parser/test/fixtures/experimental/record-and-tuple/hash/input.js new file mode 100644 index 000000000000..9217cfe71b03 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/record-and-tuple/hash/input.js @@ -0,0 +1,16 @@ +#{}; + +#{ a: 1, b: 2, c: 3 }; + +#{ + a: 1, + b: #{ + c: 3, + }, +}; + +#[]; + +#[1, 2, 3]; + +#[1, #[2, 3], 4]; diff --git a/packages/babel-parser/test/fixtures/experimental/record-and-tuple/hash/options.json b/packages/babel-parser/test/fixtures/experimental/record-and-tuple/hash/options.json new file mode 100644 index 000000000000..703c537be360 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/record-and-tuple/hash/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["recordAndTuple", { "syntaxType": "hash" }]] +} diff --git a/packages/babel-parser/test/fixtures/experimental/record-and-tuple/hash/output.json b/packages/babel-parser/test/fixtures/experimental/record-and-tuple/hash/output.json new file mode 100644 index 000000000000..6cba070ffeab --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/record-and-tuple/hash/output.json @@ -0,0 +1,269 @@ +{ + "type": "File", + "start":0,"end":104,"loc":{"start":{"line":1,"column":0},"end":{"line":16,"column":17}}, + "program": { + "type": "Program", + "start":0,"end":104,"loc":{"start":{"line":1,"column":0},"end":{"line":16,"column":17}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, + "expression": { + "type": "RecordExpression", + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, + "properties": [] + } + }, + { + "type": "ExpressionStatement", + "start":6,"end":28,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":22}}, + "expression": { + "type": "RecordExpression", + "start":6,"end":27,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":21}}, + "properties": [ + { + "type": "ObjectProperty", + "start":9,"end":13,"loc":{"start":{"line":3,"column":3},"end":{"line":3,"column":7}}, + "method": false, + "key": { + "type": "Identifier", + "start":9,"end":10,"loc":{"start":{"line":3,"column":3},"end":{"line":3,"column":4},"identifierName":"a"}, + "name": "a" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "NumericLiteral", + "start":12,"end":13,"loc":{"start":{"line":3,"column":6},"end":{"line":3,"column":7}}, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + }, + { + "type": "ObjectProperty", + "start":15,"end":19,"loc":{"start":{"line":3,"column":9},"end":{"line":3,"column":13}}, + "method": false, + "key": { + "type": "Identifier", + "start":15,"end":16,"loc":{"start":{"line":3,"column":9},"end":{"line":3,"column":10},"identifierName":"b"}, + "name": "b" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "NumericLiteral", + "start":18,"end":19,"loc":{"start":{"line":3,"column":12},"end":{"line":3,"column":13}}, + "extra": { + "rawValue": 2, + "raw": "2" + }, + "value": 2 + } + }, + { + "type": "ObjectProperty", + "start":21,"end":25,"loc":{"start":{"line":3,"column":15},"end":{"line":3,"column":19}}, + "method": false, + "key": { + "type": "Identifier", + "start":21,"end":22,"loc":{"start":{"line":3,"column":15},"end":{"line":3,"column":16},"identifierName":"c"}, + "name": "c" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "NumericLiteral", + "start":24,"end":25,"loc":{"start":{"line":3,"column":18},"end":{"line":3,"column":19}}, + "extra": { + "rawValue": 3, + "raw": "3" + }, + "value": 3 + } + } + ] + } + }, + { + "type": "ExpressionStatement", + "start":30,"end":66,"loc":{"start":{"line":5,"column":0},"end":{"line":10,"column":2}}, + "expression": { + "type": "RecordExpression", + "start":30,"end":65,"loc":{"start":{"line":5,"column":0},"end":{"line":10,"column":1}}, + "properties": [ + { + "type": "ObjectProperty", + "start":35,"end":39,"loc":{"start":{"line":6,"column":2},"end":{"line":6,"column":6}}, + "method": false, + "key": { + "type": "Identifier", + "start":35,"end":36,"loc":{"start":{"line":6,"column":2},"end":{"line":6,"column":3},"identifierName":"a"}, + "name": "a" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "NumericLiteral", + "start":38,"end":39,"loc":{"start":{"line":6,"column":5},"end":{"line":6,"column":6}}, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + }, + { + "type": "ObjectProperty", + "start":43,"end":62,"loc":{"start":{"line":7,"column":2},"end":{"line":9,"column":3}}, + "method": false, + "key": { + "type": "Identifier", + "start":43,"end":44,"loc":{"start":{"line":7,"column":2},"end":{"line":7,"column":3},"identifierName":"b"}, + "name": "b" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "RecordExpression", + "start":46,"end":62,"loc":{"start":{"line":7,"column":5},"end":{"line":9,"column":3}}, + "properties": [ + { + "type": "ObjectProperty", + "start":53,"end":57,"loc":{"start":{"line":8,"column":4},"end":{"line":8,"column":8}}, + "method": false, + "key": { + "type": "Identifier", + "start":53,"end":54,"loc":{"start":{"line":8,"column":4},"end":{"line":8,"column":5},"identifierName":"c"}, + "name": "c" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "NumericLiteral", + "start":56,"end":57,"loc":{"start":{"line":8,"column":7},"end":{"line":8,"column":8}}, + "extra": { + "rawValue": 3, + "raw": "3" + }, + "value": 3 + } + } + ], + "extra": { + "trailingComma": 57 + } + } + } + ], + "extra": { + "trailingComma": 62 + } + } + }, + { + "type": "ExpressionStatement", + "start":68,"end":72,"loc":{"start":{"line":12,"column":0},"end":{"line":12,"column":4}}, + "expression": { + "type": "TupleExpression", + "start":68,"end":71,"loc":{"start":{"line":12,"column":0},"end":{"line":12,"column":3}}, + "elements": [] + } + }, + { + "type": "ExpressionStatement", + "start":74,"end":85,"loc":{"start":{"line":14,"column":0},"end":{"line":14,"column":11}}, + "expression": { + "type": "TupleExpression", + "start":74,"end":84,"loc":{"start":{"line":14,"column":0},"end":{"line":14,"column":10}}, + "elements": [ + { + "type": "NumericLiteral", + "start":76,"end":77,"loc":{"start":{"line":14,"column":2},"end":{"line":14,"column":3}}, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + }, + { + "type": "NumericLiteral", + "start":79,"end":80,"loc":{"start":{"line":14,"column":5},"end":{"line":14,"column":6}}, + "extra": { + "rawValue": 2, + "raw": "2" + }, + "value": 2 + }, + { + "type": "NumericLiteral", + "start":82,"end":83,"loc":{"start":{"line":14,"column":8},"end":{"line":14,"column":9}}, + "extra": { + "rawValue": 3, + "raw": "3" + }, + "value": 3 + } + ] + } + }, + { + "type": "ExpressionStatement", + "start":87,"end":104,"loc":{"start":{"line":16,"column":0},"end":{"line":16,"column":17}}, + "expression": { + "type": "TupleExpression", + "start":87,"end":103,"loc":{"start":{"line":16,"column":0},"end":{"line":16,"column":16}}, + "elements": [ + { + "type": "NumericLiteral", + "start":89,"end":90,"loc":{"start":{"line":16,"column":2},"end":{"line":16,"column":3}}, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + }, + { + "type": "TupleExpression", + "start":92,"end":99,"loc":{"start":{"line":16,"column":5},"end":{"line":16,"column":12}}, + "elements": [ + { + "type": "NumericLiteral", + "start":94,"end":95,"loc":{"start":{"line":16,"column":7},"end":{"line":16,"column":8}}, + "extra": { + "rawValue": 2, + "raw": "2" + }, + "value": 2 + }, + { + "type": "NumericLiteral", + "start":97,"end":98,"loc":{"start":{"line":16,"column":10},"end":{"line":16,"column":11}}, + "extra": { + "rawValue": 3, + "raw": "3" + }, + "value": 3 + } + ] + }, + { + "type": "NumericLiteral", + "start":101,"end":102,"loc":{"start":{"line":16,"column":14},"end":{"line":16,"column":15}}, + "extra": { + "rawValue": 4, + "raw": "4" + }, + "value": 4 + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/record-and-tuple/incorrect-type-record-end-bar/input.js b/packages/babel-parser/test/fixtures/experimental/record-and-tuple/incorrect-type-record-end-bar/input.js new file mode 100644 index 000000000000..b1bef5c7e18b --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/record-and-tuple/incorrect-type-record-end-bar/input.js @@ -0,0 +1 @@ +|} diff --git a/packages/babel-parser/test/fixtures/experimental/record-and-tuple/incorrect-type-record-end-bar/options.json b/packages/babel-parser/test/fixtures/experimental/record-and-tuple/incorrect-type-record-end-bar/options.json new file mode 100644 index 000000000000..de1fad0a7393 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/record-and-tuple/incorrect-type-record-end-bar/options.json @@ -0,0 +1,4 @@ +{ + "plugins": [["recordAndTuple", { "syntaxType": "hash" }]], + "throws": "Record expressions ending with '|}' are only allowed when the 'syntaxType' option of the 'recordAndTuple' plugin is set to 'bar' (1:0)" +} diff --git a/packages/babel-parser/test/fixtures/experimental/record-and-tuple/incorrect-type-record-start-bar/input.js b/packages/babel-parser/test/fixtures/experimental/record-and-tuple/incorrect-type-record-start-bar/input.js new file mode 100644 index 000000000000..acc5a0adcbb3 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/record-and-tuple/incorrect-type-record-start-bar/input.js @@ -0,0 +1 @@ +{| diff --git a/packages/babel-parser/test/fixtures/experimental/record-and-tuple/incorrect-type-record-start-bar/options.json b/packages/babel-parser/test/fixtures/experimental/record-and-tuple/incorrect-type-record-start-bar/options.json new file mode 100644 index 000000000000..ad916de06150 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/record-and-tuple/incorrect-type-record-start-bar/options.json @@ -0,0 +1,4 @@ +{ + "plugins": [["recordAndTuple", { "syntaxType": "hash" }]], + "throws": "Record expressions starting with '{|' are only allowed when the 'syntaxType' option of the 'recordAndTuple' plugin is set to 'bar' (1:0)" +} diff --git a/packages/babel-parser/test/fixtures/experimental/record-and-tuple/incorrect-type-record-start-hash/input.js b/packages/babel-parser/test/fixtures/experimental/record-and-tuple/incorrect-type-record-start-hash/input.js new file mode 100644 index 000000000000..1dff7ae1c597 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/record-and-tuple/incorrect-type-record-start-hash/input.js @@ -0,0 +1 @@ +#{ diff --git a/packages/babel-parser/test/fixtures/experimental/record-and-tuple/incorrect-type-record-start-hash/options.json b/packages/babel-parser/test/fixtures/experimental/record-and-tuple/incorrect-type-record-start-hash/options.json new file mode 100644 index 000000000000..9d23281e46d6 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/record-and-tuple/incorrect-type-record-start-hash/options.json @@ -0,0 +1,4 @@ +{ + "plugins": [["recordAndTuple", { "syntaxType": "bar" }]], + "throws": "Record expressions starting with '#{' are only allowed when the 'syntaxType' option of the 'recordAndTuple' plugin is set to 'hash' (1:0)" +} diff --git a/packages/babel-parser/test/fixtures/experimental/record-and-tuple/incorrect-type-tuple-end-bar/input.js b/packages/babel-parser/test/fixtures/experimental/record-and-tuple/incorrect-type-tuple-end-bar/input.js new file mode 100644 index 000000000000..9adcc6ff49d6 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/record-and-tuple/incorrect-type-tuple-end-bar/input.js @@ -0,0 +1 @@ +|] diff --git a/packages/babel-parser/test/fixtures/experimental/record-and-tuple/incorrect-type-tuple-end-bar/options.json b/packages/babel-parser/test/fixtures/experimental/record-and-tuple/incorrect-type-tuple-end-bar/options.json new file mode 100644 index 000000000000..cacf8c4cadda --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/record-and-tuple/incorrect-type-tuple-end-bar/options.json @@ -0,0 +1,4 @@ +{ + "plugins": [["recordAndTuple", { "syntaxType": "hash" }]], + "throws": "Tuple expressions ending with '|]' are only allowed when the 'syntaxType' option of the 'recordAndTuple' plugin is set to 'bar' (1:0)" +} diff --git a/packages/babel-parser/test/fixtures/experimental/record-and-tuple/incorrect-type-tuple-start-bar/input.js b/packages/babel-parser/test/fixtures/experimental/record-and-tuple/incorrect-type-tuple-start-bar/input.js new file mode 100644 index 000000000000..6eb879a13b10 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/record-and-tuple/incorrect-type-tuple-start-bar/input.js @@ -0,0 +1 @@ +[| diff --git a/packages/babel-parser/test/fixtures/experimental/record-and-tuple/incorrect-type-tuple-start-bar/options.json b/packages/babel-parser/test/fixtures/experimental/record-and-tuple/incorrect-type-tuple-start-bar/options.json new file mode 100644 index 000000000000..c7b3f7a090ab --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/record-and-tuple/incorrect-type-tuple-start-bar/options.json @@ -0,0 +1,4 @@ +{ + "plugins": [["recordAndTuple", { "syntaxType": "hash" }]], + "throws": "Tuple expressions starting with '[|' are only allowed when the 'syntaxType' option of the 'recordAndTuple' plugin is set to 'bar' (1:0)" +} diff --git a/packages/babel-parser/test/fixtures/experimental/record-and-tuple/incorrect-type-tuple-start-hash/input.js b/packages/babel-parser/test/fixtures/experimental/record-and-tuple/incorrect-type-tuple-start-hash/input.js new file mode 100644 index 000000000000..47ffe9864933 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/record-and-tuple/incorrect-type-tuple-start-hash/input.js @@ -0,0 +1 @@ +#[ diff --git a/packages/babel-parser/test/fixtures/experimental/record-and-tuple/incorrect-type-tuple-start-hash/options.json b/packages/babel-parser/test/fixtures/experimental/record-and-tuple/incorrect-type-tuple-start-hash/options.json new file mode 100644 index 000000000000..4a28c837723d --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/record-and-tuple/incorrect-type-tuple-start-hash/options.json @@ -0,0 +1,4 @@ +{ + "plugins": [["recordAndTuple", { "syntaxType": "bar" }]], + "throws": "Tuple expressions starting with '#[' are only allowed when the 'syntaxType' option of the 'recordAndTuple' plugin is set to 'hash' (1:0)" +} diff --git a/packages/babel-parser/test/fixtures/experimental/record-and-tuple/invalid-type-bar-record/input.js b/packages/babel-parser/test/fixtures/experimental/record-and-tuple/invalid-type-bar-record/input.js new file mode 100644 index 000000000000..58bca25f7eaf --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/record-and-tuple/invalid-type-bar-record/input.js @@ -0,0 +1 @@ +{||} diff --git a/packages/babel-parser/test/fixtures/experimental/record-and-tuple/invalid-type-bar-record/options.json b/packages/babel-parser/test/fixtures/experimental/record-and-tuple/invalid-type-bar-record/options.json new file mode 100644 index 000000000000..f266a14d42eb --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/record-and-tuple/invalid-type-bar-record/options.json @@ -0,0 +1,4 @@ +{ + "plugins": [["recordAndTuple", { "syntaxType": "invalid" }]], + "throws": "'recordAndTuple' requires 'syntaxType' option whose value should be one of: 'hash', 'bar'" +} diff --git a/packages/babel-parser/test/fixtures/experimental/record-and-tuple/invalid-type-bar-tuple/input.js b/packages/babel-parser/test/fixtures/experimental/record-and-tuple/invalid-type-bar-tuple/input.js new file mode 100644 index 000000000000..38030aa27cca --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/record-and-tuple/invalid-type-bar-tuple/input.js @@ -0,0 +1 @@ +[||] diff --git a/packages/babel-parser/test/fixtures/experimental/record-and-tuple/invalid-type-bar-tuple/options.json b/packages/babel-parser/test/fixtures/experimental/record-and-tuple/invalid-type-bar-tuple/options.json new file mode 100644 index 000000000000..f266a14d42eb --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/record-and-tuple/invalid-type-bar-tuple/options.json @@ -0,0 +1,4 @@ +{ + "plugins": [["recordAndTuple", { "syntaxType": "invalid" }]], + "throws": "'recordAndTuple' requires 'syntaxType' option whose value should be one of: 'hash', 'bar'" +} diff --git a/packages/babel-parser/test/fixtures/experimental/record-and-tuple/invalid-type-hash-record/input.js b/packages/babel-parser/test/fixtures/experimental/record-and-tuple/invalid-type-hash-record/input.js new file mode 100644 index 000000000000..feca1c1b895f --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/record-and-tuple/invalid-type-hash-record/input.js @@ -0,0 +1 @@ +#{} diff --git a/packages/babel-parser/test/fixtures/experimental/record-and-tuple/invalid-type-hash-record/options.json b/packages/babel-parser/test/fixtures/experimental/record-and-tuple/invalid-type-hash-record/options.json new file mode 100644 index 000000000000..f266a14d42eb --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/record-and-tuple/invalid-type-hash-record/options.json @@ -0,0 +1,4 @@ +{ + "plugins": [["recordAndTuple", { "syntaxType": "invalid" }]], + "throws": "'recordAndTuple' requires 'syntaxType' option whose value should be one of: 'hash', 'bar'" +} diff --git a/packages/babel-parser/test/fixtures/experimental/record-and-tuple/invalid-type-hash-tuple/input.js b/packages/babel-parser/test/fixtures/experimental/record-and-tuple/invalid-type-hash-tuple/input.js new file mode 100644 index 000000000000..0fbee2942b3d --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/record-and-tuple/invalid-type-hash-tuple/input.js @@ -0,0 +1 @@ +#[] diff --git a/packages/babel-parser/test/fixtures/experimental/record-and-tuple/invalid-type-hash-tuple/options.json b/packages/babel-parser/test/fixtures/experimental/record-and-tuple/invalid-type-hash-tuple/options.json new file mode 100644 index 000000000000..f266a14d42eb --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/record-and-tuple/invalid-type-hash-tuple/options.json @@ -0,0 +1,4 @@ +{ + "plugins": [["recordAndTuple", { "syntaxType": "invalid" }]], + "throws": "'recordAndTuple' requires 'syntaxType' option whose value should be one of: 'hash', 'bar'" +} diff --git a/packages/babel-parser/test/fixtures/experimental/record-and-tuple/not-enabled-bar/input.js b/packages/babel-parser/test/fixtures/experimental/record-and-tuple/not-enabled-bar/input.js new file mode 100644 index 000000000000..58bca25f7eaf --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/record-and-tuple/not-enabled-bar/input.js @@ -0,0 +1 @@ +{||} diff --git a/packages/babel-parser/test/fixtures/experimental/record-and-tuple/not-enabled-bar/options.json b/packages/babel-parser/test/fixtures/experimental/record-and-tuple/not-enabled-bar/options.json new file mode 100644 index 000000000000..3500bb1aae77 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/record-and-tuple/not-enabled-bar/options.json @@ -0,0 +1,4 @@ +{ + "plugins": [], + "throws": "Unexpected token (1:1)" +} diff --git a/packages/babel-parser/test/fixtures/experimental/record-and-tuple/not-enabled-hash/input.js b/packages/babel-parser/test/fixtures/experimental/record-and-tuple/not-enabled-hash/input.js new file mode 100644 index 000000000000..95bd07c248ed --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/record-and-tuple/not-enabled-hash/input.js @@ -0,0 +1 @@ +#{}; diff --git a/packages/babel-parser/test/fixtures/experimental/record-and-tuple/not-enabled-hash/options.json b/packages/babel-parser/test/fixtures/experimental/record-and-tuple/not-enabled-hash/options.json new file mode 100644 index 000000000000..9565d05f7929 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/record-and-tuple/not-enabled-hash/options.json @@ -0,0 +1,3 @@ +{ + "throws": "This experimental syntax requires enabling the parser plugin: 'recordAndTuple' (1:0)" +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/1/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/1/output.json index b6d0cedb6d6d..dad87f1a67b4 100644 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/1/output.json +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/1/output.json @@ -1,109 +1,31 @@ { "type": "File", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "program": { "type": "Program", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "expression": { "type": "TaggedTemplateExpression", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "tag": { "type": "Identifier", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "sampleTag" - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9},"identifierName":"sampleTag"}, "name": "sampleTag" }, "quasi": { "type": "TemplateLiteral", - "start": 9, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":9,"end":14,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":14}}, "expressions": [], "quasis": [ { "type": "TemplateElement", - "start": 10, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":10,"end":13,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":13}}, "value": { "raw": "\\01", "cooked": null diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/10/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/10/output.json index c2e61b7dcc74..805b977e0219 100644 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/10/output.json +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/10/output.json @@ -1,108 +1,30 @@ { "type": "File", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "program": { "type": "Program", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "expression": { "type": "TaggedTemplateExpression", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "tag": { "type": "Identifier", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "sampleTag" - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9},"identifierName":"sampleTag"}, "name": "sampleTag" }, "quasi": { "type": "TemplateLiteral", - "start": 9, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":9,"end":23,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":23}}, "expressions": [ { "type": "NumericLiteral", - "start": 15, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":15,"end":16,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":16}}, "extra": { "rawValue": 0, "raw": "0" @@ -113,18 +35,7 @@ "quasis": [ { "type": "TemplateElement", - "start": 10, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":10,"end":13,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":13}}, "value": { "raw": "\\xg", "cooked": null @@ -133,18 +44,7 @@ }, { "type": "TemplateElement", - "start": 17, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":17,"end":22,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":22}}, "value": { "raw": "right", "cooked": "right" diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/11/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/11/output.json index 3ca94e61c69f..7d1057ebdf33 100644 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/11/output.json +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/11/output.json @@ -1,108 +1,30 @@ { "type": "File", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "program": { "type": "Program", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "expression": { "type": "TaggedTemplateExpression", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "tag": { "type": "Identifier", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "sampleTag" - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9},"identifierName":"sampleTag"}, "name": "sampleTag" }, "quasi": { "type": "TemplateLiteral", - "start": 9, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":9,"end":22,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":22}}, "expressions": [ { "type": "NumericLiteral", - "start": 16, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":16,"end":17,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":17}}, "extra": { "rawValue": 0, "raw": "0" @@ -113,18 +35,7 @@ "quasis": [ { "type": "TemplateElement", - "start": 10, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":10,"end":14,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":14}}, "value": { "raw": "left", "cooked": "left" @@ -133,18 +44,7 @@ }, { "type": "TemplateElement", - "start": 18, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":18,"end":21,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":21}}, "value": { "raw": "\\xg", "cooked": null diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/12/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/12/output.json index 635e109f119a..66db1d9667cb 100644 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/12/output.json +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/12/output.json @@ -1,108 +1,30 @@ { "type": "File", - "start": 0, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, "program": { "type": "Program", - "start": 0, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, "expression": { "type": "TaggedTemplateExpression", - "start": 0, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, "tag": { "type": "Identifier", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "sampleTag" - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9},"identifierName":"sampleTag"}, "name": "sampleTag" }, "quasi": { "type": "TemplateLiteral", - "start": 9, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":9,"end":31,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":31}}, "expressions": [ { "type": "NumericLiteral", - "start": 16, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":16,"end":17,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":17}}, "extra": { "rawValue": 0, "raw": "0" @@ -111,18 +33,7 @@ }, { "type": "NumericLiteral", - "start": 23, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":23,"end":24,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":24}}, "extra": { "rawValue": 1, "raw": "1" @@ -133,18 +44,7 @@ "quasis": [ { "type": "TemplateElement", - "start": 10, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":10,"end":14,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":14}}, "value": { "raw": "left", "cooked": "left" @@ -153,18 +53,7 @@ }, { "type": "TemplateElement", - "start": 18, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":18,"end":21,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":21}}, "value": { "raw": "\\xg", "cooked": null @@ -173,18 +62,7 @@ }, { "type": "TemplateElement", - "start": 25, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":25,"end":30,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":30}}, "value": { "raw": "right", "cooked": "right" diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/13/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/13/output.json index 7f0b58140ccc..7f23399bd729 100644 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/13/output.json +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/13/output.json @@ -1,109 +1,31 @@ { "type": "File", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "program": { "type": "Program", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "expression": { "type": "TaggedTemplateExpression", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "tag": { "type": "Identifier", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "sampleTag" - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9},"identifierName":"sampleTag"}, "name": "sampleTag" }, "quasi": { "type": "TemplateLiteral", - "start": 9, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":9,"end":15,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":15}}, "expressions": [], "quasis": [ { "type": "TemplateElement", - "start": 10, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":10,"end":14,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":14}}, "value": { "raw": "\\xAg", "cooked": null diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/14/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/14/output.json index 3b5099e2484e..3d6415843c43 100644 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/14/output.json +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/14/output.json @@ -1,108 +1,30 @@ { "type": "File", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "program": { "type": "Program", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "expression": { "type": "TaggedTemplateExpression", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "tag": { "type": "Identifier", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "sampleTag" - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9},"identifierName":"sampleTag"}, "name": "sampleTag" }, "quasi": { "type": "TemplateLiteral", - "start": 9, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":9,"end":24,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":24}}, "expressions": [ { "type": "NumericLiteral", - "start": 16, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":16,"end":17,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":17}}, "extra": { "rawValue": 0, "raw": "0" @@ -113,18 +35,7 @@ "quasis": [ { "type": "TemplateElement", - "start": 10, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":10,"end":14,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":14}}, "value": { "raw": "\\xAg", "cooked": null @@ -133,18 +44,7 @@ }, { "type": "TemplateElement", - "start": 18, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":18,"end":23,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":23}}, "value": { "raw": "right", "cooked": "right" diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/15/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/15/output.json index dad1acd88252..52964dd67ca9 100644 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/15/output.json +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/15/output.json @@ -1,108 +1,30 @@ { "type": "File", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "program": { "type": "Program", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "expression": { "type": "TaggedTemplateExpression", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "tag": { "type": "Identifier", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "sampleTag" - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9},"identifierName":"sampleTag"}, "name": "sampleTag" }, "quasi": { "type": "TemplateLiteral", - "start": 9, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":9,"end":23,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":23}}, "expressions": [ { "type": "NumericLiteral", - "start": 16, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":16,"end":17,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":17}}, "extra": { "rawValue": 0, "raw": "0" @@ -113,18 +35,7 @@ "quasis": [ { "type": "TemplateElement", - "start": 10, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":10,"end":14,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":14}}, "value": { "raw": "left", "cooked": "left" @@ -133,18 +44,7 @@ }, { "type": "TemplateElement", - "start": 18, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":18,"end":22,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":22}}, "value": { "raw": "\\xAg", "cooked": null diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/16/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/16/output.json index 980991e0983e..de4e948b6fcd 100644 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/16/output.json +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/16/output.json @@ -1,108 +1,30 @@ { "type": "File", - "start": 0, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, "program": { "type": "Program", - "start": 0, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, "expression": { "type": "TaggedTemplateExpression", - "start": 0, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, "tag": { "type": "Identifier", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "sampleTag" - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9},"identifierName":"sampleTag"}, "name": "sampleTag" }, "quasi": { "type": "TemplateLiteral", - "start": 9, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":9,"end":32,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":32}}, "expressions": [ { "type": "NumericLiteral", - "start": 16, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":16,"end":17,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":17}}, "extra": { "rawValue": 0, "raw": "0" @@ -111,18 +33,7 @@ }, { "type": "NumericLiteral", - "start": 24, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":24,"end":25,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":25}}, "extra": { "rawValue": 1, "raw": "1" @@ -133,18 +44,7 @@ "quasis": [ { "type": "TemplateElement", - "start": 10, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":10,"end":14,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":14}}, "value": { "raw": "left", "cooked": "left" @@ -153,18 +53,7 @@ }, { "type": "TemplateElement", - "start": 18, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":18,"end":22,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":22}}, "value": { "raw": "\\xAg", "cooked": null @@ -173,18 +62,7 @@ }, { "type": "TemplateElement", - "start": 26, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":26,"end":31,"loc":{"start":{"line":1,"column":26},"end":{"line":1,"column":31}}, "value": { "raw": "right", "cooked": "right" diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/17/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/17/output.json index 9aa91ba18083..4ea96f95f600 100644 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/17/output.json +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/17/output.json @@ -1,109 +1,31 @@ { "type": "File", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "program": { "type": "Program", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "expression": { "type": "TaggedTemplateExpression", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "tag": { "type": "Identifier", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "sampleTag" - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9},"identifierName":"sampleTag"}, "name": "sampleTag" }, "quasi": { "type": "TemplateLiteral", - "start": 9, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":9,"end":14,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":14}}, "expressions": [], "quasis": [ { "type": "TemplateElement", - "start": 10, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":10,"end":13,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":13}}, "value": { "raw": "\\u0", "cooked": null diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/18/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/18/output.json index 1f6e730f77a4..9c2fa5d831dc 100644 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/18/output.json +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/18/output.json @@ -1,108 +1,30 @@ { "type": "File", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "program": { "type": "Program", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "expression": { "type": "TaggedTemplateExpression", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "tag": { "type": "Identifier", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "sampleTag" - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9},"identifierName":"sampleTag"}, "name": "sampleTag" }, "quasi": { "type": "TemplateLiteral", - "start": 9, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":9,"end":23,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":23}}, "expressions": [ { "type": "NumericLiteral", - "start": 15, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":15,"end":16,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":16}}, "extra": { "rawValue": 0, "raw": "0" @@ -113,18 +35,7 @@ "quasis": [ { "type": "TemplateElement", - "start": 10, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":10,"end":13,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":13}}, "value": { "raw": "\\u0", "cooked": null @@ -133,18 +44,7 @@ }, { "type": "TemplateElement", - "start": 17, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":17,"end":22,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":22}}, "value": { "raw": "right", "cooked": "right" diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/19/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/19/output.json index 4d0a4a382399..0531e077259c 100644 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/19/output.json +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/19/output.json @@ -1,108 +1,30 @@ { "type": "File", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "program": { "type": "Program", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "expression": { "type": "TaggedTemplateExpression", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "tag": { "type": "Identifier", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "sampleTag" - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9},"identifierName":"sampleTag"}, "name": "sampleTag" }, "quasi": { "type": "TemplateLiteral", - "start": 9, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":9,"end":22,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":22}}, "expressions": [ { "type": "NumericLiteral", - "start": 16, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":16,"end":17,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":17}}, "extra": { "rawValue": 0, "raw": "0" @@ -113,18 +35,7 @@ "quasis": [ { "type": "TemplateElement", - "start": 10, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":10,"end":14,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":14}}, "value": { "raw": "left", "cooked": "left" @@ -133,18 +44,7 @@ }, { "type": "TemplateElement", - "start": 18, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":18,"end":21,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":21}}, "value": { "raw": "\\u0", "cooked": null diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/2/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/2/output.json index f644f6f77c2b..2b72eb9e943f 100644 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/2/output.json +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/2/output.json @@ -1,108 +1,30 @@ { "type": "File", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "program": { "type": "Program", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "expression": { "type": "TaggedTemplateExpression", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "tag": { "type": "Identifier", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "sampleTag" - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9},"identifierName":"sampleTag"}, "name": "sampleTag" }, "quasi": { "type": "TemplateLiteral", - "start": 9, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":9,"end":23,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":23}}, "expressions": [ { "type": "NumericLiteral", - "start": 15, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":15,"end":16,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":16}}, "extra": { "rawValue": 0, "raw": "0" @@ -113,18 +35,7 @@ "quasis": [ { "type": "TemplateElement", - "start": 10, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":10,"end":13,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":13}}, "value": { "raw": "\\01", "cooked": null @@ -133,18 +44,7 @@ }, { "type": "TemplateElement", - "start": 17, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":17,"end":22,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":22}}, "value": { "raw": "right", "cooked": "right" diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/20/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/20/output.json index 7012d6b344c0..602c59d44bda 100644 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/20/output.json +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/20/output.json @@ -1,108 +1,30 @@ { "type": "File", - "start": 0, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, "program": { "type": "Program", - "start": 0, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, "expression": { "type": "TaggedTemplateExpression", - "start": 0, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, "tag": { "type": "Identifier", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "sampleTag" - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9},"identifierName":"sampleTag"}, "name": "sampleTag" }, "quasi": { "type": "TemplateLiteral", - "start": 9, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":9,"end":31,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":31}}, "expressions": [ { "type": "NumericLiteral", - "start": 16, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":16,"end":17,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":17}}, "extra": { "rawValue": 0, "raw": "0" @@ -111,18 +33,7 @@ }, { "type": "NumericLiteral", - "start": 23, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":23,"end":24,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":24}}, "extra": { "rawValue": 1, "raw": "1" @@ -133,18 +44,7 @@ "quasis": [ { "type": "TemplateElement", - "start": 10, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":10,"end":14,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":14}}, "value": { "raw": "left", "cooked": "left" @@ -153,18 +53,7 @@ }, { "type": "TemplateElement", - "start": 18, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":18,"end":21,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":21}}, "value": { "raw": "\\u0", "cooked": null @@ -173,18 +62,7 @@ }, { "type": "TemplateElement", - "start": 25, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":25,"end":30,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":30}}, "value": { "raw": "right", "cooked": "right" diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/21/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/21/output.json index 80582542dc79..7a32c398fca3 100644 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/21/output.json +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/21/output.json @@ -1,109 +1,31 @@ { "type": "File", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "program": { "type": "Program", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "expression": { "type": "TaggedTemplateExpression", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "tag": { "type": "Identifier", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "sampleTag" - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9},"identifierName":"sampleTag"}, "name": "sampleTag" }, "quasi": { "type": "TemplateLiteral", - "start": 9, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":9,"end":15,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":15}}, "expressions": [], "quasis": [ { "type": "TemplateElement", - "start": 10, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":10,"end":14,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":14}}, "value": { "raw": "\\u0g", "cooked": null diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/22/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/22/output.json index c692f5634ed6..78208a0d1b53 100644 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/22/output.json +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/22/output.json @@ -1,108 +1,30 @@ { "type": "File", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "program": { "type": "Program", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "expression": { "type": "TaggedTemplateExpression", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "tag": { "type": "Identifier", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "sampleTag" - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9},"identifierName":"sampleTag"}, "name": "sampleTag" }, "quasi": { "type": "TemplateLiteral", - "start": 9, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":9,"end":24,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":24}}, "expressions": [ { "type": "NumericLiteral", - "start": 16, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":16,"end":17,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":17}}, "extra": { "rawValue": 0, "raw": "0" @@ -113,18 +35,7 @@ "quasis": [ { "type": "TemplateElement", - "start": 10, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":10,"end":14,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":14}}, "value": { "raw": "\\u0g", "cooked": null @@ -133,18 +44,7 @@ }, { "type": "TemplateElement", - "start": 18, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":18,"end":23,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":23}}, "value": { "raw": "right", "cooked": "right" diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/23/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/23/output.json index 57ba6b14baef..ce7c6247f6a8 100644 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/23/output.json +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/23/output.json @@ -1,108 +1,30 @@ { "type": "File", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "program": { "type": "Program", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "expression": { "type": "TaggedTemplateExpression", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "tag": { "type": "Identifier", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "sampleTag" - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9},"identifierName":"sampleTag"}, "name": "sampleTag" }, "quasi": { "type": "TemplateLiteral", - "start": 9, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":9,"end":23,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":23}}, "expressions": [ { "type": "NumericLiteral", - "start": 16, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":16,"end":17,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":17}}, "extra": { "rawValue": 0, "raw": "0" @@ -113,18 +35,7 @@ "quasis": [ { "type": "TemplateElement", - "start": 10, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":10,"end":14,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":14}}, "value": { "raw": "left", "cooked": "left" @@ -133,18 +44,7 @@ }, { "type": "TemplateElement", - "start": 18, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":18,"end":22,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":22}}, "value": { "raw": "\\u0g", "cooked": null diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/24/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/24/output.json index 1eb4c5477766..bf7992eebc45 100644 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/24/output.json +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/24/output.json @@ -1,108 +1,30 @@ { "type": "File", - "start": 0, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, "program": { "type": "Program", - "start": 0, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, "expression": { "type": "TaggedTemplateExpression", - "start": 0, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, "tag": { "type": "Identifier", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "sampleTag" - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9},"identifierName":"sampleTag"}, "name": "sampleTag" }, "quasi": { "type": "TemplateLiteral", - "start": 9, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":9,"end":32,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":32}}, "expressions": [ { "type": "NumericLiteral", - "start": 16, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":16,"end":17,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":17}}, "extra": { "rawValue": 0, "raw": "0" @@ -111,18 +33,7 @@ }, { "type": "NumericLiteral", - "start": 24, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":24,"end":25,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":25}}, "extra": { "rawValue": 1, "raw": "1" @@ -133,18 +44,7 @@ "quasis": [ { "type": "TemplateElement", - "start": 10, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":10,"end":14,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":14}}, "value": { "raw": "left", "cooked": "left" @@ -153,18 +53,7 @@ }, { "type": "TemplateElement", - "start": 18, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":18,"end":22,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":22}}, "value": { "raw": "\\u0g", "cooked": null @@ -173,18 +62,7 @@ }, { "type": "TemplateElement", - "start": 26, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":26,"end":31,"loc":{"start":{"line":1,"column":26},"end":{"line":1,"column":31}}, "value": { "raw": "right", "cooked": "right" diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/25/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/25/output.json index e2929b56882d..e1d3be39b30f 100644 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/25/output.json +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/25/output.json @@ -1,109 +1,31 @@ { "type": "File", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "program": { "type": "Program", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "expression": { "type": "TaggedTemplateExpression", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "tag": { "type": "Identifier", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "sampleTag" - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9},"identifierName":"sampleTag"}, "name": "sampleTag" }, "quasi": { "type": "TemplateLiteral", - "start": 9, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":9,"end":16,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":16}}, "expressions": [], "quasis": [ { "type": "TemplateElement", - "start": 10, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":10,"end":15,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":15}}, "value": { "raw": "\\u00g", "cooked": null diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/26/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/26/output.json index d765da348a8a..38eff5e05456 100644 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/26/output.json +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/26/output.json @@ -1,108 +1,30 @@ { "type": "File", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, "program": { "type": "Program", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, "expression": { "type": "TaggedTemplateExpression", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, "tag": { "type": "Identifier", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "sampleTag" - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9},"identifierName":"sampleTag"}, "name": "sampleTag" }, "quasi": { "type": "TemplateLiteral", - "start": 9, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":9,"end":25,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":25}}, "expressions": [ { "type": "NumericLiteral", - "start": 17, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":17,"end":18,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":18}}, "extra": { "rawValue": 0, "raw": "0" @@ -113,18 +35,7 @@ "quasis": [ { "type": "TemplateElement", - "start": 10, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":10,"end":15,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":15}}, "value": { "raw": "\\u00g", "cooked": null @@ -133,18 +44,7 @@ }, { "type": "TemplateElement", - "start": 19, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":19,"end":24,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":24}}, "value": { "raw": "right", "cooked": "right" diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/27/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/27/output.json index e9ce95b15400..b1b043ee40db 100644 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/27/output.json +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/27/output.json @@ -1,108 +1,30 @@ { "type": "File", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "program": { "type": "Program", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "expression": { "type": "TaggedTemplateExpression", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "tag": { "type": "Identifier", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "sampleTag" - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9},"identifierName":"sampleTag"}, "name": "sampleTag" }, "quasi": { "type": "TemplateLiteral", - "start": 9, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":9,"end":24,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":24}}, "expressions": [ { "type": "NumericLiteral", - "start": 16, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":16,"end":17,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":17}}, "extra": { "rawValue": 0, "raw": "0" @@ -113,18 +35,7 @@ "quasis": [ { "type": "TemplateElement", - "start": 10, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":10,"end":14,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":14}}, "value": { "raw": "left", "cooked": "left" @@ -133,18 +44,7 @@ }, { "type": "TemplateElement", - "start": 18, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":18,"end":23,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":23}}, "value": { "raw": "\\u00g", "cooked": null diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/28/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/28/output.json index 6ef630c21629..8d68a188cc91 100644 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/28/output.json +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/28/output.json @@ -1,108 +1,30 @@ { "type": "File", - "start": 0, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, "program": { "type": "Program", - "start": 0, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, "expression": { "type": "TaggedTemplateExpression", - "start": 0, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, "tag": { "type": "Identifier", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "sampleTag" - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9},"identifierName":"sampleTag"}, "name": "sampleTag" }, "quasi": { "type": "TemplateLiteral", - "start": 9, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":9,"end":33,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":33}}, "expressions": [ { "type": "NumericLiteral", - "start": 16, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":16,"end":17,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":17}}, "extra": { "rawValue": 0, "raw": "0" @@ -111,18 +33,7 @@ }, { "type": "NumericLiteral", - "start": 25, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":25,"end":26,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":26}}, "extra": { "rawValue": 1, "raw": "1" @@ -133,18 +44,7 @@ "quasis": [ { "type": "TemplateElement", - "start": 10, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":10,"end":14,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":14}}, "value": { "raw": "left", "cooked": "left" @@ -153,18 +53,7 @@ }, { "type": "TemplateElement", - "start": 18, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":18,"end":23,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":23}}, "value": { "raw": "\\u00g", "cooked": null @@ -173,18 +62,7 @@ }, { "type": "TemplateElement", - "start": 27, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":27,"end":32,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":32}}, "value": { "raw": "right", "cooked": "right" diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/29/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/29/output.json index 7d080201f87c..31f3f9f5a4fb 100644 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/29/output.json +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/29/output.json @@ -1,109 +1,31 @@ { "type": "File", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "program": { "type": "Program", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "expression": { "type": "TaggedTemplateExpression", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "tag": { "type": "Identifier", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "sampleTag" - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9},"identifierName":"sampleTag"}, "name": "sampleTag" }, "quasi": { "type": "TemplateLiteral", - "start": 9, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":9,"end":17,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":17}}, "expressions": [], "quasis": [ { "type": "TemplateElement", - "start": 10, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":10,"end":16,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":16}}, "value": { "raw": "\\u000g", "cooked": null diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/3/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/3/output.json index 35d36a435d45..1117fb9bfb6f 100644 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/3/output.json +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/3/output.json @@ -1,108 +1,30 @@ { "type": "File", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "program": { "type": "Program", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "expression": { "type": "TaggedTemplateExpression", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "tag": { "type": "Identifier", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "sampleTag" - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9},"identifierName":"sampleTag"}, "name": "sampleTag" }, "quasi": { "type": "TemplateLiteral", - "start": 9, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":9,"end":22,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":22}}, "expressions": [ { "type": "NumericLiteral", - "start": 16, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":16,"end":17,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":17}}, "extra": { "rawValue": 0, "raw": "0" @@ -113,18 +35,7 @@ "quasis": [ { "type": "TemplateElement", - "start": 10, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":10,"end":14,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":14}}, "value": { "raw": "left", "cooked": "left" @@ -133,18 +44,7 @@ }, { "type": "TemplateElement", - "start": 18, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":18,"end":21,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":21}}, "value": { "raw": "\\01", "cooked": null diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/30/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/30/output.json index 234638108d6c..d4adad3aab6c 100644 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/30/output.json +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/30/output.json @@ -1,108 +1,30 @@ { "type": "File", - "start": 0, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, "program": { "type": "Program", - "start": 0, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, "expression": { "type": "TaggedTemplateExpression", - "start": 0, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, "tag": { "type": "Identifier", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "sampleTag" - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9},"identifierName":"sampleTag"}, "name": "sampleTag" }, "quasi": { "type": "TemplateLiteral", - "start": 9, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":9,"end":26,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":26}}, "expressions": [ { "type": "NumericLiteral", - "start": 18, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":18,"end":19,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":19}}, "extra": { "rawValue": 0, "raw": "0" @@ -113,18 +35,7 @@ "quasis": [ { "type": "TemplateElement", - "start": 10, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":10,"end":16,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":16}}, "value": { "raw": "\\u000g", "cooked": null @@ -133,18 +44,7 @@ }, { "type": "TemplateElement", - "start": 20, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":20,"end":25,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":25}}, "value": { "raw": "right", "cooked": "right" diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/31/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/31/output.json index 01ba58dde043..400efe6d5f4f 100644 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/31/output.json +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/31/output.json @@ -1,108 +1,30 @@ { "type": "File", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, "program": { "type": "Program", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, "expression": { "type": "TaggedTemplateExpression", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, "tag": { "type": "Identifier", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "sampleTag" - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9},"identifierName":"sampleTag"}, "name": "sampleTag" }, "quasi": { "type": "TemplateLiteral", - "start": 9, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":9,"end":25,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":25}}, "expressions": [ { "type": "NumericLiteral", - "start": 16, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":16,"end":17,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":17}}, "extra": { "rawValue": 0, "raw": "0" @@ -113,18 +35,7 @@ "quasis": [ { "type": "TemplateElement", - "start": 10, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":10,"end":14,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":14}}, "value": { "raw": "left", "cooked": "left" @@ -133,18 +44,7 @@ }, { "type": "TemplateElement", - "start": 18, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":18,"end":24,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":24}}, "value": { "raw": "\\u000g", "cooked": null diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/32/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/32/output.json index d6c9de764ff1..3f3ca0d3d5d7 100644 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/32/output.json +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/32/output.json @@ -1,108 +1,30 @@ { "type": "File", - "start": 0, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, "program": { "type": "Program", - "start": 0, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, "expression": { "type": "TaggedTemplateExpression", - "start": 0, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, "tag": { "type": "Identifier", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "sampleTag" - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9},"identifierName":"sampleTag"}, "name": "sampleTag" }, "quasi": { "type": "TemplateLiteral", - "start": 9, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":9,"end":34,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":34}}, "expressions": [ { "type": "NumericLiteral", - "start": 16, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":16,"end":17,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":17}}, "extra": { "rawValue": 0, "raw": "0" @@ -111,18 +33,7 @@ }, { "type": "NumericLiteral", - "start": 26, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":26,"end":27,"loc":{"start":{"line":1,"column":26},"end":{"line":1,"column":27}}, "extra": { "rawValue": 1, "raw": "1" @@ -133,18 +44,7 @@ "quasis": [ { "type": "TemplateElement", - "start": 10, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":10,"end":14,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":14}}, "value": { "raw": "left", "cooked": "left" @@ -153,18 +53,7 @@ }, { "type": "TemplateElement", - "start": 18, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":18,"end":24,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":24}}, "value": { "raw": "\\u000g", "cooked": null @@ -173,18 +62,7 @@ }, { "type": "TemplateElement", - "start": 28, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":28,"end":33,"loc":{"start":{"line":1,"column":28},"end":{"line":1,"column":33}}, "value": { "raw": "right", "cooked": "right" diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/33/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/33/output.json index d4989ed391d7..85bfc592f8d6 100644 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/33/output.json +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/33/output.json @@ -1,109 +1,31 @@ { "type": "File", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "program": { "type": "Program", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "expression": { "type": "TaggedTemplateExpression", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "tag": { "type": "Identifier", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "sampleTag" - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9},"identifierName":"sampleTag"}, "name": "sampleTag" }, "quasi": { "type": "TemplateLiteral", - "start": 9, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":9,"end":15,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":15}}, "expressions": [], "quasis": [ { "type": "TemplateElement", - "start": 10, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":10,"end":14,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":14}}, "value": { "raw": "\\u{}", "cooked": null diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/34/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/34/output.json index f070f46d18f9..50214d1502e3 100644 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/34/output.json +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/34/output.json @@ -1,108 +1,30 @@ { "type": "File", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "program": { "type": "Program", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "expression": { "type": "TaggedTemplateExpression", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "tag": { "type": "Identifier", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "sampleTag" - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9},"identifierName":"sampleTag"}, "name": "sampleTag" }, "quasi": { "type": "TemplateLiteral", - "start": 9, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":9,"end":24,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":24}}, "expressions": [ { "type": "NumericLiteral", - "start": 16, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":16,"end":17,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":17}}, "extra": { "rawValue": 0, "raw": "0" @@ -113,18 +35,7 @@ "quasis": [ { "type": "TemplateElement", - "start": 10, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":10,"end":14,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":14}}, "value": { "raw": "\\u{}", "cooked": null @@ -133,18 +44,7 @@ }, { "type": "TemplateElement", - "start": 18, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":18,"end":23,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":23}}, "value": { "raw": "right", "cooked": "right" diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/35/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/35/output.json index 75c143347674..2d99aea456ef 100644 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/35/output.json +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/35/output.json @@ -1,108 +1,30 @@ { "type": "File", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "program": { "type": "Program", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "expression": { "type": "TaggedTemplateExpression", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "tag": { "type": "Identifier", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "sampleTag" - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9},"identifierName":"sampleTag"}, "name": "sampleTag" }, "quasi": { "type": "TemplateLiteral", - "start": 9, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":9,"end":23,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":23}}, "expressions": [ { "type": "NumericLiteral", - "start": 16, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":16,"end":17,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":17}}, "extra": { "rawValue": 0, "raw": "0" @@ -113,18 +35,7 @@ "quasis": [ { "type": "TemplateElement", - "start": 10, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":10,"end":14,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":14}}, "value": { "raw": "left", "cooked": "left" @@ -133,18 +44,7 @@ }, { "type": "TemplateElement", - "start": 18, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":18,"end":22,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":22}}, "value": { "raw": "\\u{}", "cooked": null diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/36/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/36/output.json index edbbef5c2939..423b95bfc9f1 100644 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/36/output.json +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/36/output.json @@ -1,108 +1,30 @@ { "type": "File", - "start": 0, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, "program": { "type": "Program", - "start": 0, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, "expression": { "type": "TaggedTemplateExpression", - "start": 0, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, "tag": { "type": "Identifier", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "sampleTag" - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9},"identifierName":"sampleTag"}, "name": "sampleTag" }, "quasi": { "type": "TemplateLiteral", - "start": 9, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":9,"end":32,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":32}}, "expressions": [ { "type": "NumericLiteral", - "start": 16, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":16,"end":17,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":17}}, "extra": { "rawValue": 0, "raw": "0" @@ -111,18 +33,7 @@ }, { "type": "NumericLiteral", - "start": 24, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":24,"end":25,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":25}}, "extra": { "rawValue": 1, "raw": "1" @@ -133,18 +44,7 @@ "quasis": [ { "type": "TemplateElement", - "start": 10, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":10,"end":14,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":14}}, "value": { "raw": "left", "cooked": "left" @@ -153,18 +53,7 @@ }, { "type": "TemplateElement", - "start": 18, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":18,"end":22,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":22}}, "value": { "raw": "\\u{}", "cooked": null @@ -173,18 +62,7 @@ }, { "type": "TemplateElement", - "start": 26, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":26,"end":31,"loc":{"start":{"line":1,"column":26},"end":{"line":1,"column":31}}, "value": { "raw": "right", "cooked": "right" diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/37/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/37/output.json index a8fa63668570..747bd08fd19a 100644 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/37/output.json +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/37/output.json @@ -1,109 +1,31 @@ { "type": "File", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "program": { "type": "Program", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "expression": { "type": "TaggedTemplateExpression", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "tag": { "type": "Identifier", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "sampleTag" - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9},"identifierName":"sampleTag"}, "name": "sampleTag" }, "quasi": { "type": "TemplateLiteral", - "start": 9, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":9,"end":17,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":17}}, "expressions": [], "quasis": [ { "type": "TemplateElement", - "start": 10, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":10,"end":16,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":16}}, "value": { "raw": "\\u{-0}", "cooked": null diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/38/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/38/output.json index 7dd1fb5e55c8..76dd4a67d87e 100644 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/38/output.json +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/38/output.json @@ -1,108 +1,30 @@ { "type": "File", - "start": 0, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, "program": { "type": "Program", - "start": 0, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, "expression": { "type": "TaggedTemplateExpression", - "start": 0, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, "tag": { "type": "Identifier", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "sampleTag" - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9},"identifierName":"sampleTag"}, "name": "sampleTag" }, "quasi": { "type": "TemplateLiteral", - "start": 9, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":9,"end":26,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":26}}, "expressions": [ { "type": "NumericLiteral", - "start": 18, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":18,"end":19,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":19}}, "extra": { "rawValue": 0, "raw": "0" @@ -113,18 +35,7 @@ "quasis": [ { "type": "TemplateElement", - "start": 10, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":10,"end":16,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":16}}, "value": { "raw": "\\u{-0}", "cooked": null @@ -133,18 +44,7 @@ }, { "type": "TemplateElement", - "start": 20, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":20,"end":25,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":25}}, "value": { "raw": "right", "cooked": "right" diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/39/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/39/output.json index 98c5fbe6f88a..6a5f61a44107 100644 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/39/output.json +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/39/output.json @@ -1,108 +1,30 @@ { "type": "File", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, "program": { "type": "Program", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, "expression": { "type": "TaggedTemplateExpression", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, "tag": { "type": "Identifier", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "sampleTag" - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9},"identifierName":"sampleTag"}, "name": "sampleTag" }, "quasi": { "type": "TemplateLiteral", - "start": 9, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":9,"end":25,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":25}}, "expressions": [ { "type": "NumericLiteral", - "start": 16, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":16,"end":17,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":17}}, "extra": { "rawValue": 0, "raw": "0" @@ -113,18 +35,7 @@ "quasis": [ { "type": "TemplateElement", - "start": 10, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":10,"end":14,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":14}}, "value": { "raw": "left", "cooked": "left" @@ -133,18 +44,7 @@ }, { "type": "TemplateElement", - "start": 18, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":18,"end":24,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":24}}, "value": { "raw": "\\u{-0}", "cooked": null diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/4/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/4/output.json index c7aa3ef7db9e..8d8096e542d1 100644 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/4/output.json +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/4/output.json @@ -1,108 +1,30 @@ { "type": "File", - "start": 0, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, "program": { "type": "Program", - "start": 0, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, "expression": { "type": "TaggedTemplateExpression", - "start": 0, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, "tag": { "type": "Identifier", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "sampleTag" - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9},"identifierName":"sampleTag"}, "name": "sampleTag" }, "quasi": { "type": "TemplateLiteral", - "start": 9, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":9,"end":31,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":31}}, "expressions": [ { "type": "NumericLiteral", - "start": 16, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":16,"end":17,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":17}}, "extra": { "rawValue": 0, "raw": "0" @@ -111,18 +33,7 @@ }, { "type": "NumericLiteral", - "start": 23, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":23,"end":24,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":24}}, "extra": { "rawValue": 1, "raw": "1" @@ -133,18 +44,7 @@ "quasis": [ { "type": "TemplateElement", - "start": 10, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":10,"end":14,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":14}}, "value": { "raw": "left", "cooked": "left" @@ -153,18 +53,7 @@ }, { "type": "TemplateElement", - "start": 18, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":18,"end":21,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":21}}, "value": { "raw": "\\01", "cooked": null @@ -173,18 +62,7 @@ }, { "type": "TemplateElement", - "start": 25, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":25,"end":30,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":30}}, "value": { "raw": "right", "cooked": "right" diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/40/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/40/output.json index c1153e8ef9ba..9faf5390f81e 100644 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/40/output.json +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/40/output.json @@ -1,108 +1,30 @@ { "type": "File", - "start": 0, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, "program": { "type": "Program", - "start": 0, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, "expression": { "type": "TaggedTemplateExpression", - "start": 0, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, "tag": { "type": "Identifier", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "sampleTag" - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9},"identifierName":"sampleTag"}, "name": "sampleTag" }, "quasi": { "type": "TemplateLiteral", - "start": 9, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":9,"end":34,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":34}}, "expressions": [ { "type": "NumericLiteral", - "start": 16, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":16,"end":17,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":17}}, "extra": { "rawValue": 0, "raw": "0" @@ -111,18 +33,7 @@ }, { "type": "NumericLiteral", - "start": 26, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":26,"end":27,"loc":{"start":{"line":1,"column":26},"end":{"line":1,"column":27}}, "extra": { "rawValue": 1, "raw": "1" @@ -133,18 +44,7 @@ "quasis": [ { "type": "TemplateElement", - "start": 10, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":10,"end":14,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":14}}, "value": { "raw": "left", "cooked": "left" @@ -153,18 +53,7 @@ }, { "type": "TemplateElement", - "start": 18, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":18,"end":24,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":24}}, "value": { "raw": "\\u{-0}", "cooked": null @@ -173,18 +62,7 @@ }, { "type": "TemplateElement", - "start": 28, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":28,"end":33,"loc":{"start":{"line":1,"column":28},"end":{"line":1,"column":33}}, "value": { "raw": "right", "cooked": "right" diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/41/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/41/output.json index 678537429214..7a70c20099d4 100644 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/41/output.json +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/41/output.json @@ -1,109 +1,31 @@ { "type": "File", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "program": { "type": "Program", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "expression": { "type": "TaggedTemplateExpression", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "tag": { "type": "Identifier", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "sampleTag" - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9},"identifierName":"sampleTag"}, "name": "sampleTag" }, "quasi": { "type": "TemplateLiteral", - "start": 9, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":9,"end":16,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":16}}, "expressions": [], "quasis": [ { "type": "TemplateElement", - "start": 10, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":10,"end":15,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":15}}, "value": { "raw": "\\u{g}", "cooked": null diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/42/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/42/output.json index 3e96fd7f6e42..df86a70b2a65 100644 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/42/output.json +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/42/output.json @@ -1,108 +1,30 @@ { "type": "File", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, "program": { "type": "Program", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, "expression": { "type": "TaggedTemplateExpression", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, "tag": { "type": "Identifier", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "sampleTag" - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9},"identifierName":"sampleTag"}, "name": "sampleTag" }, "quasi": { "type": "TemplateLiteral", - "start": 9, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":9,"end":25,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":25}}, "expressions": [ { "type": "NumericLiteral", - "start": 17, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":17,"end":18,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":18}}, "extra": { "rawValue": 0, "raw": "0" @@ -113,18 +35,7 @@ "quasis": [ { "type": "TemplateElement", - "start": 10, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":10,"end":15,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":15}}, "value": { "raw": "\\u{g}", "cooked": null @@ -133,18 +44,7 @@ }, { "type": "TemplateElement", - "start": 19, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":19,"end":24,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":24}}, "value": { "raw": "right", "cooked": "right" diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/43/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/43/output.json index 072db71bd3f6..9f0a0bfc1dbf 100644 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/43/output.json +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/43/output.json @@ -1,108 +1,30 @@ { "type": "File", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "program": { "type": "Program", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "expression": { "type": "TaggedTemplateExpression", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "tag": { "type": "Identifier", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "sampleTag" - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9},"identifierName":"sampleTag"}, "name": "sampleTag" }, "quasi": { "type": "TemplateLiteral", - "start": 9, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":9,"end":24,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":24}}, "expressions": [ { "type": "NumericLiteral", - "start": 16, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":16,"end":17,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":17}}, "extra": { "rawValue": 0, "raw": "0" @@ -113,18 +35,7 @@ "quasis": [ { "type": "TemplateElement", - "start": 10, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":10,"end":14,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":14}}, "value": { "raw": "left", "cooked": "left" @@ -133,18 +44,7 @@ }, { "type": "TemplateElement", - "start": 18, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":18,"end":23,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":23}}, "value": { "raw": "\\u{g}", "cooked": null diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/44/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/44/output.json index fdbd4372b103..d6bc57308fbb 100644 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/44/output.json +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/44/output.json @@ -1,108 +1,30 @@ { "type": "File", - "start": 0, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, "program": { "type": "Program", - "start": 0, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, "expression": { "type": "TaggedTemplateExpression", - "start": 0, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, "tag": { "type": "Identifier", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "sampleTag" - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9},"identifierName":"sampleTag"}, "name": "sampleTag" }, "quasi": { "type": "TemplateLiteral", - "start": 9, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":9,"end":33,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":33}}, "expressions": [ { "type": "NumericLiteral", - "start": 16, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":16,"end":17,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":17}}, "extra": { "rawValue": 0, "raw": "0" @@ -111,18 +33,7 @@ }, { "type": "NumericLiteral", - "start": 25, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":25,"end":26,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":26}}, "extra": { "rawValue": 1, "raw": "1" @@ -133,18 +44,7 @@ "quasis": [ { "type": "TemplateElement", - "start": 10, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":10,"end":14,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":14}}, "value": { "raw": "left", "cooked": "left" @@ -153,18 +53,7 @@ }, { "type": "TemplateElement", - "start": 18, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":18,"end":23,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":23}}, "value": { "raw": "\\u{g}", "cooked": null @@ -173,18 +62,7 @@ }, { "type": "TemplateElement", - "start": 27, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":27,"end":32,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":32}}, "value": { "raw": "right", "cooked": "right" diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/45/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/45/output.json index 8d89468bd969..e86e6a2871ab 100644 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/45/output.json +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/45/output.json @@ -1,109 +1,31 @@ { "type": "File", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "program": { "type": "Program", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "expression": { "type": "TaggedTemplateExpression", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "tag": { "type": "Identifier", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "sampleTag" - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9},"identifierName":"sampleTag"}, "name": "sampleTag" }, "quasi": { "type": "TemplateLiteral", - "start": 9, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":9,"end":14,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":14}}, "expressions": [], "quasis": [ { "type": "TemplateElement", - "start": 10, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":10,"end":13,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":13}}, "value": { "raw": "\\u{", "cooked": null diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/46/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/46/output.json index caff17537ea6..67a243bde984 100644 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/46/output.json +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/46/output.json @@ -1,108 +1,30 @@ { "type": "File", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "program": { "type": "Program", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "expression": { "type": "TaggedTemplateExpression", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "tag": { "type": "Identifier", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "sampleTag" - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9},"identifierName":"sampleTag"}, "name": "sampleTag" }, "quasi": { "type": "TemplateLiteral", - "start": 9, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":9,"end":23,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":23}}, "expressions": [ { "type": "NumericLiteral", - "start": 15, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":15,"end":16,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":16}}, "extra": { "rawValue": 0, "raw": "0" @@ -113,18 +35,7 @@ "quasis": [ { "type": "TemplateElement", - "start": 10, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":10,"end":13,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":13}}, "value": { "raw": "\\u{", "cooked": null @@ -133,18 +44,7 @@ }, { "type": "TemplateElement", - "start": 17, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":17,"end":22,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":22}}, "value": { "raw": "right", "cooked": "right" diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/47/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/47/output.json index c84eb9ef6cb8..cd424ff6725a 100644 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/47/output.json +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/47/output.json @@ -1,108 +1,30 @@ { "type": "File", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "program": { "type": "Program", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "expression": { "type": "TaggedTemplateExpression", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "tag": { "type": "Identifier", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "sampleTag" - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9},"identifierName":"sampleTag"}, "name": "sampleTag" }, "quasi": { "type": "TemplateLiteral", - "start": 9, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":9,"end":22,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":22}}, "expressions": [ { "type": "NumericLiteral", - "start": 16, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":16,"end":17,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":17}}, "extra": { "rawValue": 0, "raw": "0" @@ -113,18 +35,7 @@ "quasis": [ { "type": "TemplateElement", - "start": 10, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":10,"end":14,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":14}}, "value": { "raw": "left", "cooked": "left" @@ -133,18 +44,7 @@ }, { "type": "TemplateElement", - "start": 18, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":18,"end":21,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":21}}, "value": { "raw": "\\u{", "cooked": null diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/48/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/48/output.json index 41f694cea61c..65da3199ea25 100644 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/48/output.json +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/48/output.json @@ -1,108 +1,30 @@ { "type": "File", - "start": 0, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, "program": { "type": "Program", - "start": 0, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, "expression": { "type": "TaggedTemplateExpression", - "start": 0, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, "tag": { "type": "Identifier", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "sampleTag" - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9},"identifierName":"sampleTag"}, "name": "sampleTag" }, "quasi": { "type": "TemplateLiteral", - "start": 9, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":9,"end":31,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":31}}, "expressions": [ { "type": "NumericLiteral", - "start": 16, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":16,"end":17,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":17}}, "extra": { "rawValue": 0, "raw": "0" @@ -111,18 +33,7 @@ }, { "type": "NumericLiteral", - "start": 23, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":23,"end":24,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":24}}, "extra": { "rawValue": 1, "raw": "1" @@ -133,18 +44,7 @@ "quasis": [ { "type": "TemplateElement", - "start": 10, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":10,"end":14,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":14}}, "value": { "raw": "left", "cooked": "left" @@ -153,18 +53,7 @@ }, { "type": "TemplateElement", - "start": 18, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":18,"end":21,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":21}}, "value": { "raw": "\\u{", "cooked": null @@ -173,18 +62,7 @@ }, { "type": "TemplateElement", - "start": 25, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":25,"end":30,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":30}}, "value": { "raw": "right", "cooked": "right" diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/49/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/49/output.json index 0467351a38d4..5926ac8938cd 100644 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/49/output.json +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/49/output.json @@ -1,109 +1,31 @@ { "type": "File", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "program": { "type": "Program", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "expression": { "type": "TaggedTemplateExpression", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "tag": { "type": "Identifier", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "sampleTag" - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9},"identifierName":"sampleTag"}, "name": "sampleTag" }, "quasi": { "type": "TemplateLiteral", - "start": 9, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":9,"end":16,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":16}}, "expressions": [], "quasis": [ { "type": "TemplateElement", - "start": 10, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":10,"end":15,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":15}}, "value": { "raw": "\\u{\\\\", "cooked": null diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/5/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/5/output.json index a0b4ed887326..ad9dec9755d1 100644 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/5/output.json +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/5/output.json @@ -1,109 +1,31 @@ { "type": "File", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "program": { "type": "Program", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "expression": { "type": "TaggedTemplateExpression", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "tag": { "type": "Identifier", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "sampleTag" - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9},"identifierName":"sampleTag"}, "name": "sampleTag" }, "quasi": { "type": "TemplateLiteral", - "start": 9, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":9,"end":13,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":13}}, "expressions": [], "quasis": [ { "type": "TemplateElement", - "start": 10, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":10,"end":12,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":12}}, "value": { "raw": "\\1", "cooked": null diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/50/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/50/output.json index 783cfac7f3a5..6b7c37b415d6 100644 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/50/output.json +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/50/output.json @@ -1,108 +1,30 @@ { "type": "File", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, "program": { "type": "Program", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, "expression": { "type": "TaggedTemplateExpression", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, "tag": { "type": "Identifier", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "sampleTag" - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9},"identifierName":"sampleTag"}, "name": "sampleTag" }, "quasi": { "type": "TemplateLiteral", - "start": 9, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":9,"end":25,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":25}}, "expressions": [ { "type": "NumericLiteral", - "start": 17, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":17,"end":18,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":18}}, "extra": { "rawValue": 0, "raw": "0" @@ -113,18 +35,7 @@ "quasis": [ { "type": "TemplateElement", - "start": 10, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":10,"end":15,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":15}}, "value": { "raw": "\\u{\\\\", "cooked": null @@ -133,18 +44,7 @@ }, { "type": "TemplateElement", - "start": 19, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":19,"end":24,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":24}}, "value": { "raw": "right", "cooked": "right" diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/51/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/51/output.json index 8f770a0b520f..4e0de67a89a8 100644 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/51/output.json +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/51/output.json @@ -1,108 +1,30 @@ { "type": "File", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "program": { "type": "Program", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "expression": { "type": "TaggedTemplateExpression", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "tag": { "type": "Identifier", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "sampleTag" - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9},"identifierName":"sampleTag"}, "name": "sampleTag" }, "quasi": { "type": "TemplateLiteral", - "start": 9, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":9,"end":24,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":24}}, "expressions": [ { "type": "NumericLiteral", - "start": 16, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":16,"end":17,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":17}}, "extra": { "rawValue": 0, "raw": "0" @@ -113,18 +35,7 @@ "quasis": [ { "type": "TemplateElement", - "start": 10, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":10,"end":14,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":14}}, "value": { "raw": "left", "cooked": "left" @@ -133,18 +44,7 @@ }, { "type": "TemplateElement", - "start": 18, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":18,"end":23,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":23}}, "value": { "raw": "\\u{\\\\", "cooked": null diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/52/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/52/output.json index e9c9ec66f592..26b92f4ebb3b 100644 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/52/output.json +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/52/output.json @@ -1,108 +1,30 @@ { "type": "File", - "start": 0, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, "program": { "type": "Program", - "start": 0, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, "expression": { "type": "TaggedTemplateExpression", - "start": 0, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, "tag": { "type": "Identifier", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "sampleTag" - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9},"identifierName":"sampleTag"}, "name": "sampleTag" }, "quasi": { "type": "TemplateLiteral", - "start": 9, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":9,"end":33,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":33}}, "expressions": [ { "type": "NumericLiteral", - "start": 16, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":16,"end":17,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":17}}, "extra": { "rawValue": 0, "raw": "0" @@ -111,18 +33,7 @@ }, { "type": "NumericLiteral", - "start": 25, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":25,"end":26,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":26}}, "extra": { "rawValue": 1, "raw": "1" @@ -133,18 +44,7 @@ "quasis": [ { "type": "TemplateElement", - "start": 10, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":10,"end":14,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":14}}, "value": { "raw": "left", "cooked": "left" @@ -153,18 +53,7 @@ }, { "type": "TemplateElement", - "start": 18, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":18,"end":23,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":23}}, "value": { "raw": "\\u{\\\\", "cooked": null @@ -173,18 +62,7 @@ }, { "type": "TemplateElement", - "start": 27, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":27,"end":32,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":32}}, "value": { "raw": "right", "cooked": "right" diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/53/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/53/output.json index 140d1ca3a59d..c25d7475fd52 100644 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/53/output.json +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/53/output.json @@ -1,109 +1,31 @@ { "type": "File", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "program": { "type": "Program", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "expression": { "type": "TaggedTemplateExpression", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "tag": { "type": "Identifier", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "sampleTag" - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9},"identifierName":"sampleTag"}, "name": "sampleTag" }, "quasi": { "type": "TemplateLiteral", - "start": 9, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":9,"end":16,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":16}}, "expressions": [], "quasis": [ { "type": "TemplateElement", - "start": 10, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":10,"end":15,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":15}}, "value": { "raw": "\\u{\\`", "cooked": null diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/54/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/54/output.json index 1ba67b8a91ed..f63451acca9e 100644 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/54/output.json +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/54/output.json @@ -1,108 +1,30 @@ { "type": "File", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, "program": { "type": "Program", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, "expression": { "type": "TaggedTemplateExpression", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, "tag": { "type": "Identifier", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "sampleTag" - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9},"identifierName":"sampleTag"}, "name": "sampleTag" }, "quasi": { "type": "TemplateLiteral", - "start": 9, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":9,"end":25,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":25}}, "expressions": [ { "type": "NumericLiteral", - "start": 17, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":17,"end":18,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":18}}, "extra": { "rawValue": 0, "raw": "0" @@ -113,18 +35,7 @@ "quasis": [ { "type": "TemplateElement", - "start": 10, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":10,"end":15,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":15}}, "value": { "raw": "\\u{\\`", "cooked": null @@ -133,18 +44,7 @@ }, { "type": "TemplateElement", - "start": 19, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":19,"end":24,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":24}}, "value": { "raw": "right", "cooked": "right" diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/55/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/55/output.json index 0acda94d446f..72ae1ab47d25 100644 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/55/output.json +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/55/output.json @@ -1,108 +1,30 @@ { "type": "File", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "program": { "type": "Program", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "expression": { "type": "TaggedTemplateExpression", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "tag": { "type": "Identifier", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "sampleTag" - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9},"identifierName":"sampleTag"}, "name": "sampleTag" }, "quasi": { "type": "TemplateLiteral", - "start": 9, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":9,"end":24,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":24}}, "expressions": [ { "type": "NumericLiteral", - "start": 16, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":16,"end":17,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":17}}, "extra": { "rawValue": 0, "raw": "0" @@ -113,18 +35,7 @@ "quasis": [ { "type": "TemplateElement", - "start": 10, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":10,"end":14,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":14}}, "value": { "raw": "left", "cooked": "left" @@ -133,18 +44,7 @@ }, { "type": "TemplateElement", - "start": 18, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":18,"end":23,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":23}}, "value": { "raw": "\\u{\\`", "cooked": null diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/56/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/56/output.json index a486c2f93d61..57e112e27280 100644 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/56/output.json +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/56/output.json @@ -1,108 +1,30 @@ { "type": "File", - "start": 0, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, "program": { "type": "Program", - "start": 0, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, "expression": { "type": "TaggedTemplateExpression", - "start": 0, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, "tag": { "type": "Identifier", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "sampleTag" - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9},"identifierName":"sampleTag"}, "name": "sampleTag" }, "quasi": { "type": "TemplateLiteral", - "start": 9, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":9,"end":33,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":33}}, "expressions": [ { "type": "NumericLiteral", - "start": 16, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":16,"end":17,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":17}}, "extra": { "rawValue": 0, "raw": "0" @@ -111,18 +33,7 @@ }, { "type": "NumericLiteral", - "start": 25, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":25,"end":26,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":26}}, "extra": { "rawValue": 1, "raw": "1" @@ -133,18 +44,7 @@ "quasis": [ { "type": "TemplateElement", - "start": 10, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":10,"end":14,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":14}}, "value": { "raw": "left", "cooked": "left" @@ -153,18 +53,7 @@ }, { "type": "TemplateElement", - "start": 18, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":18,"end":23,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":23}}, "value": { "raw": "\\u{\\`", "cooked": null @@ -173,18 +62,7 @@ }, { "type": "TemplateElement", - "start": 27, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":27,"end":32,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":32}}, "value": { "raw": "right", "cooked": "right" diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/57/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/57/output.json index 787369211af9..fbd1e2201de1 100644 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/57/output.json +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/57/output.json @@ -1,109 +1,31 @@ { "type": "File", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "program": { "type": "Program", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "expression": { "type": "TaggedTemplateExpression", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "tag": { "type": "Identifier", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "sampleTag" - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9},"identifierName":"sampleTag"}, "name": "sampleTag" }, "quasi": { "type": "TemplateLiteral", - "start": 9, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":9,"end":15,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":15}}, "expressions": [], "quasis": [ { "type": "TemplateElement", - "start": 10, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":10,"end":14,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":14}}, "value": { "raw": "\\u{0", "cooked": null diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/58/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/58/output.json index ac1b66efbad6..9bc05a72f32a 100644 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/58/output.json +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/58/output.json @@ -1,108 +1,30 @@ { "type": "File", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "program": { "type": "Program", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "expression": { "type": "TaggedTemplateExpression", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "tag": { "type": "Identifier", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "sampleTag" - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9},"identifierName":"sampleTag"}, "name": "sampleTag" }, "quasi": { "type": "TemplateLiteral", - "start": 9, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":9,"end":24,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":24}}, "expressions": [ { "type": "NumericLiteral", - "start": 16, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":16,"end":17,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":17}}, "extra": { "rawValue": 0, "raw": "0" @@ -113,18 +35,7 @@ "quasis": [ { "type": "TemplateElement", - "start": 10, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":10,"end":14,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":14}}, "value": { "raw": "\\u{0", "cooked": null @@ -133,18 +44,7 @@ }, { "type": "TemplateElement", - "start": 18, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":18,"end":23,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":23}}, "value": { "raw": "right", "cooked": "right" diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/59/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/59/output.json index d996015a1b4e..c08c3328ed53 100644 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/59/output.json +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/59/output.json @@ -1,108 +1,30 @@ { "type": "File", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "program": { "type": "Program", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "expression": { "type": "TaggedTemplateExpression", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "tag": { "type": "Identifier", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "sampleTag" - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9},"identifierName":"sampleTag"}, "name": "sampleTag" }, "quasi": { "type": "TemplateLiteral", - "start": 9, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":9,"end":23,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":23}}, "expressions": [ { "type": "NumericLiteral", - "start": 16, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":16,"end":17,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":17}}, "extra": { "rawValue": 0, "raw": "0" @@ -113,18 +35,7 @@ "quasis": [ { "type": "TemplateElement", - "start": 10, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":10,"end":14,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":14}}, "value": { "raw": "left", "cooked": "left" @@ -133,18 +44,7 @@ }, { "type": "TemplateElement", - "start": 18, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":18,"end":22,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":22}}, "value": { "raw": "\\u{0", "cooked": null diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/6/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/6/output.json index 41ad167999f4..d6ac90f7e3a8 100644 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/6/output.json +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/6/output.json @@ -1,108 +1,30 @@ { "type": "File", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "program": { "type": "Program", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "expression": { "type": "TaggedTemplateExpression", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "tag": { "type": "Identifier", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "sampleTag" - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9},"identifierName":"sampleTag"}, "name": "sampleTag" }, "quasi": { "type": "TemplateLiteral", - "start": 9, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":9,"end":22,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":22}}, "expressions": [ { "type": "NumericLiteral", - "start": 14, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":14,"end":15,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":15}}, "extra": { "rawValue": 0, "raw": "0" @@ -113,18 +35,7 @@ "quasis": [ { "type": "TemplateElement", - "start": 10, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":10,"end":12,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":12}}, "value": { "raw": "\\1", "cooked": null @@ -133,18 +44,7 @@ }, { "type": "TemplateElement", - "start": 16, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":16,"end":21,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":21}}, "value": { "raw": "right", "cooked": "right" diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/60/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/60/output.json index eefdc6fa0840..ca481d3e2a31 100644 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/60/output.json +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/60/output.json @@ -1,108 +1,30 @@ { "type": "File", - "start": 0, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, "program": { "type": "Program", - "start": 0, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, "expression": { "type": "TaggedTemplateExpression", - "start": 0, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, "tag": { "type": "Identifier", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "sampleTag" - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9},"identifierName":"sampleTag"}, "name": "sampleTag" }, "quasi": { "type": "TemplateLiteral", - "start": 9, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":9,"end":32,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":32}}, "expressions": [ { "type": "NumericLiteral", - "start": 16, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":16,"end":17,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":17}}, "extra": { "rawValue": 0, "raw": "0" @@ -111,18 +33,7 @@ }, { "type": "NumericLiteral", - "start": 24, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":24,"end":25,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":25}}, "extra": { "rawValue": 1, "raw": "1" @@ -133,18 +44,7 @@ "quasis": [ { "type": "TemplateElement", - "start": 10, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":10,"end":14,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":14}}, "value": { "raw": "left", "cooked": "left" @@ -153,18 +53,7 @@ }, { "type": "TemplateElement", - "start": 18, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":18,"end":22,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":22}}, "value": { "raw": "\\u{0", "cooked": null @@ -173,18 +62,7 @@ }, { "type": "TemplateElement", - "start": 26, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":26,"end":31,"loc":{"start":{"line":1,"column":26},"end":{"line":1,"column":31}}, "value": { "raw": "right", "cooked": "right" diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/61/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/61/output.json index 533b224afe85..8ddeec634a00 100644 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/61/output.json +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/61/output.json @@ -1,109 +1,31 @@ { "type": "File", - "start": 0, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, "program": { "type": "Program", - "start": 0, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, "expression": { "type": "TaggedTemplateExpression", - "start": 0, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, "tag": { "type": "Identifier", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "sampleTag" - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9},"identifierName":"sampleTag"}, "name": "sampleTag" }, "quasi": { "type": "TemplateLiteral", - "start": 9, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":9,"end":19,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":19}}, "expressions": [], "quasis": [ { "type": "TemplateElement", - "start": 10, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":10,"end":18,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":18}}, "value": { "raw": "\\u{\\u{0}", "cooked": null diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/62/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/62/output.json index 0ac527181bd9..b494d245ac31 100644 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/62/output.json +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/62/output.json @@ -1,108 +1,30 @@ { "type": "File", - "start": 0, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, "program": { "type": "Program", - "start": 0, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, "expression": { "type": "TaggedTemplateExpression", - "start": 0, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, "tag": { "type": "Identifier", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "sampleTag" - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9},"identifierName":"sampleTag"}, "name": "sampleTag" }, "quasi": { "type": "TemplateLiteral", - "start": 9, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":9,"end":28,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":28}}, "expressions": [ { "type": "NumericLiteral", - "start": 20, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":20,"end":21,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":21}}, "extra": { "rawValue": 0, "raw": "0" @@ -113,18 +35,7 @@ "quasis": [ { "type": "TemplateElement", - "start": 10, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":10,"end":18,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":18}}, "value": { "raw": "\\u{\\u{0}", "cooked": null @@ -133,18 +44,7 @@ }, { "type": "TemplateElement", - "start": 22, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":22,"end":27,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":27}}, "value": { "raw": "right", "cooked": "right" diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/63/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/63/output.json index f54fd54c6595..54766534dd05 100644 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/63/output.json +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/63/output.json @@ -1,108 +1,30 @@ { "type": "File", - "start": 0, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, "program": { "type": "Program", - "start": 0, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, "expression": { "type": "TaggedTemplateExpression", - "start": 0, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, "tag": { "type": "Identifier", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "sampleTag" - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9},"identifierName":"sampleTag"}, "name": "sampleTag" }, "quasi": { "type": "TemplateLiteral", - "start": 9, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":9,"end":27,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":27}}, "expressions": [ { "type": "NumericLiteral", - "start": 16, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":16,"end":17,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":17}}, "extra": { "rawValue": 0, "raw": "0" @@ -113,18 +35,7 @@ "quasis": [ { "type": "TemplateElement", - "start": 10, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":10,"end":14,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":14}}, "value": { "raw": "left", "cooked": "left" @@ -133,18 +44,7 @@ }, { "type": "TemplateElement", - "start": 18, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":18,"end":26,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":26}}, "value": { "raw": "\\u{\\u{0}", "cooked": null diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/64/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/64/output.json index 341d69a0c9a5..28c0d4b1d063 100644 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/64/output.json +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/64/output.json @@ -1,108 +1,30 @@ { "type": "File", - "start": 0, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, "program": { "type": "Program", - "start": 0, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, "expression": { "type": "TaggedTemplateExpression", - "start": 0, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, "tag": { "type": "Identifier", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "sampleTag" - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9},"identifierName":"sampleTag"}, "name": "sampleTag" }, "quasi": { "type": "TemplateLiteral", - "start": 9, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":9,"end":36,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":36}}, "expressions": [ { "type": "NumericLiteral", - "start": 16, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":16,"end":17,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":17}}, "extra": { "rawValue": 0, "raw": "0" @@ -111,18 +33,7 @@ }, { "type": "NumericLiteral", - "start": 28, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":28,"end":29,"loc":{"start":{"line":1,"column":28},"end":{"line":1,"column":29}}, "extra": { "rawValue": 1, "raw": "1" @@ -133,18 +44,7 @@ "quasis": [ { "type": "TemplateElement", - "start": 10, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":10,"end":14,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":14}}, "value": { "raw": "left", "cooked": "left" @@ -153,18 +53,7 @@ }, { "type": "TemplateElement", - "start": 18, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":18,"end":26,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":26}}, "value": { "raw": "\\u{\\u{0}", "cooked": null @@ -173,18 +62,7 @@ }, { "type": "TemplateElement", - "start": 30, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":30,"end":35,"loc":{"start":{"line":1,"column":30},"end":{"line":1,"column":35}}, "value": { "raw": "right", "cooked": "right" diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/65/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/65/output.json index 0fee8b87f9a7..5f89215691ab 100644 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/65/output.json +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/65/output.json @@ -1,109 +1,31 @@ { "type": "File", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, "program": { "type": "Program", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, "expression": { "type": "TaggedTemplateExpression", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, "tag": { "type": "Identifier", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "sampleTag" - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9},"identifierName":"sampleTag"}, "name": "sampleTag" }, "quasi": { "type": "TemplateLiteral", - "start": 9, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":9,"end":21,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":21}}, "expressions": [], "quasis": [ { "type": "TemplateElement", - "start": 10, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":10,"end":20,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":20}}, "value": { "raw": "\\u{110000}", "cooked": null diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/66/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/66/output.json index c18f0204be2d..985490008afa 100644 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/66/output.json +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/66/output.json @@ -1,108 +1,30 @@ { "type": "File", - "start": 0, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, "program": { "type": "Program", - "start": 0, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, "expression": { "type": "TaggedTemplateExpression", - "start": 0, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, "tag": { "type": "Identifier", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "sampleTag" - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9},"identifierName":"sampleTag"}, "name": "sampleTag" }, "quasi": { "type": "TemplateLiteral", - "start": 9, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":9,"end":30,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":30}}, "expressions": [ { "type": "NumericLiteral", - "start": 22, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":22,"end":23,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":23}}, "extra": { "rawValue": 0, "raw": "0" @@ -113,18 +35,7 @@ "quasis": [ { "type": "TemplateElement", - "start": 10, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":10,"end":20,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":20}}, "value": { "raw": "\\u{110000}", "cooked": null @@ -133,18 +44,7 @@ }, { "type": "TemplateElement", - "start": 24, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":24,"end":29,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":29}}, "value": { "raw": "right", "cooked": "right" diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/67/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/67/output.json index bfc54baaba2f..ff4d68c93998 100644 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/67/output.json +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/67/output.json @@ -1,108 +1,30 @@ { "type": "File", - "start": 0, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, "program": { "type": "Program", - "start": 0, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, "expression": { "type": "TaggedTemplateExpression", - "start": 0, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, "tag": { "type": "Identifier", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "sampleTag" - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9},"identifierName":"sampleTag"}, "name": "sampleTag" }, "quasi": { "type": "TemplateLiteral", - "start": 9, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":9,"end":29,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":29}}, "expressions": [ { "type": "NumericLiteral", - "start": 16, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":16,"end":17,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":17}}, "extra": { "rawValue": 0, "raw": "0" @@ -113,18 +35,7 @@ "quasis": [ { "type": "TemplateElement", - "start": 10, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":10,"end":14,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":14}}, "value": { "raw": "left", "cooked": "left" @@ -133,18 +44,7 @@ }, { "type": "TemplateElement", - "start": 18, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":18,"end":28,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":28}}, "value": { "raw": "\\u{110000}", "cooked": null diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/68/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/68/output.json index 29e020e74f11..e84414a33e20 100644 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/68/output.json +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/68/output.json @@ -1,108 +1,30 @@ { "type": "File", - "start": 0, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":38}}, "program": { "type": "Program", - "start": 0, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":38}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":38}}, "expression": { "type": "TaggedTemplateExpression", - "start": 0, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":38}}, "tag": { "type": "Identifier", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "sampleTag" - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9},"identifierName":"sampleTag"}, "name": "sampleTag" }, "quasi": { "type": "TemplateLiteral", - "start": 9, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":9,"end":38,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":38}}, "expressions": [ { "type": "NumericLiteral", - "start": 16, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":16,"end":17,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":17}}, "extra": { "rawValue": 0, "raw": "0" @@ -111,18 +33,7 @@ }, { "type": "NumericLiteral", - "start": 30, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":30,"end":31,"loc":{"start":{"line":1,"column":30},"end":{"line":1,"column":31}}, "extra": { "rawValue": 1, "raw": "1" @@ -133,18 +44,7 @@ "quasis": [ { "type": "TemplateElement", - "start": 10, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":10,"end":14,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":14}}, "value": { "raw": "left", "cooked": "left" @@ -153,18 +53,7 @@ }, { "type": "TemplateElement", - "start": 18, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":18,"end":28,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":28}}, "value": { "raw": "\\u{110000}", "cooked": null @@ -173,18 +62,7 @@ }, { "type": "TemplateElement", - "start": 32, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 32 - }, - "end": { - "line": 1, - "column": 37 - } - }, + "start":32,"end":37,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":37}}, "value": { "raw": "right", "cooked": "right" diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/7/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/7/output.json index 8cb12ab25ae5..83c7892aee32 100644 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/7/output.json +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/7/output.json @@ -1,108 +1,30 @@ { "type": "File", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, "program": { "type": "Program", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, "expression": { "type": "TaggedTemplateExpression", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, "tag": { "type": "Identifier", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "sampleTag" - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9},"identifierName":"sampleTag"}, "name": "sampleTag" }, "quasi": { "type": "TemplateLiteral", - "start": 9, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":9,"end":21,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":21}}, "expressions": [ { "type": "NumericLiteral", - "start": 16, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":16,"end":17,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":17}}, "extra": { "rawValue": 0, "raw": "0" @@ -113,18 +35,7 @@ "quasis": [ { "type": "TemplateElement", - "start": 10, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":10,"end":14,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":14}}, "value": { "raw": "left", "cooked": "left" @@ -133,18 +44,7 @@ }, { "type": "TemplateElement", - "start": 18, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":18,"end":20,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":20}}, "value": { "raw": "\\1", "cooked": null diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/8/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/8/output.json index e5813f87f899..d9117d3b92af 100644 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/8/output.json +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/8/output.json @@ -1,108 +1,30 @@ { "type": "File", - "start": 0, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, "program": { "type": "Program", - "start": 0, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, "expression": { "type": "TaggedTemplateExpression", - "start": 0, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, "tag": { "type": "Identifier", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "sampleTag" - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9},"identifierName":"sampleTag"}, "name": "sampleTag" }, "quasi": { "type": "TemplateLiteral", - "start": 9, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":9,"end":30,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":30}}, "expressions": [ { "type": "NumericLiteral", - "start": 16, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":16,"end":17,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":17}}, "extra": { "rawValue": 0, "raw": "0" @@ -111,18 +33,7 @@ }, { "type": "NumericLiteral", - "start": 22, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":22,"end":23,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":23}}, "extra": { "rawValue": 1, "raw": "1" @@ -133,18 +44,7 @@ "quasis": [ { "type": "TemplateElement", - "start": 10, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":10,"end":14,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":14}}, "value": { "raw": "left", "cooked": "left" @@ -153,18 +53,7 @@ }, { "type": "TemplateElement", - "start": 18, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":18,"end":20,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":20}}, "value": { "raw": "\\1", "cooked": null @@ -173,18 +62,7 @@ }, { "type": "TemplateElement", - "start": 24, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":24,"end":29,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":29}}, "value": { "raw": "right", "cooked": "right" diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/9/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/9/output.json index f2d5e3c3ddb4..44fe37d1f06a 100644 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/9/output.json +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-tagged/9/output.json @@ -1,109 +1,31 @@ { "type": "File", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "program": { "type": "Program", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "expression": { "type": "TaggedTemplateExpression", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "tag": { "type": "Identifier", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "sampleTag" - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9},"identifierName":"sampleTag"}, "name": "sampleTag" }, "quasi": { "type": "TemplateLiteral", - "start": 9, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":9,"end":14,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":14}}, "expressions": [], "quasis": [ { "type": "TemplateElement", - "start": 10, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":10,"end":13,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":13}}, "value": { "raw": "\\xg", "cooked": null diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/1/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/1/options.json deleted file mode 100644 index fd4da953a419..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/1/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/1/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/1/output.json new file mode 100644 index 000000000000..609dda3bbf1b --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/1/output.json @@ -0,0 +1,36 @@ +{ + "type": "File", + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:2)" + ], + "program": { + "type": "Program", + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, + "expression": { + "type": "TemplateLiteral", + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, + "expressions": [], + "quasis": [ + { + "type": "TemplateElement", + "start":1,"end":4,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":4}}, + "value": { + "raw": "\\01", + "cooked": null + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/10/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/10/options.json deleted file mode 100644 index fd4da953a419..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/10/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/10/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/10/output.json new file mode 100644 index 000000000000..e3b8e5b00191 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/10/output.json @@ -0,0 +1,55 @@ +{ + "type": "File", + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:2)" + ], + "program": { + "type": "Program", + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, + "expression": { + "type": "TemplateLiteral", + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, + "expressions": [ + { + "type": "NumericLiteral", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7}}, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ], + "quasis": [ + { + "type": "TemplateElement", + "start":1,"end":4,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":4}}, + "value": { + "raw": "\\xg", + "cooked": null + }, + "tail": false + }, + { + "type": "TemplateElement", + "start":8,"end":13,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":13}}, + "value": { + "raw": "right", + "cooked": "right" + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/11/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/11/options.json deleted file mode 100644 index 27524e2b1f49..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/11/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:10)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/11/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/11/output.json new file mode 100644 index 000000000000..0179dbeaeaff --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/11/output.json @@ -0,0 +1,55 @@ +{ + "type": "File", + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:10)" + ], + "program": { + "type": "Program", + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "expression": { + "type": "TemplateLiteral", + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "expressions": [ + { + "type": "NumericLiteral", + "start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8}}, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ], + "quasis": [ + { + "type": "TemplateElement", + "start":1,"end":5,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":5}}, + "value": { + "raw": "left", + "cooked": "left" + }, + "tail": false + }, + { + "type": "TemplateElement", + "start":9,"end":12,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":12}}, + "value": { + "raw": "\\xg", + "cooked": null + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/12/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/12/options.json deleted file mode 100644 index 27524e2b1f49..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/12/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:10)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/12/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/12/output.json new file mode 100644 index 000000000000..3c29809b70f4 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/12/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:10)" + ], + "program": { + "type": "Program", + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, + "expression": { + "type": "TemplateLiteral", + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, + "expressions": [ + { + "type": "NumericLiteral", + "start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8}}, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + }, + { + "type": "NumericLiteral", + "start":14,"end":15,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":15}}, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + ], + "quasis": [ + { + "type": "TemplateElement", + "start":1,"end":5,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":5}}, + "value": { + "raw": "left", + "cooked": "left" + }, + "tail": false + }, + { + "type": "TemplateElement", + "start":9,"end":12,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":12}}, + "value": { + "raw": "\\xg", + "cooked": null + }, + "tail": false + }, + { + "type": "TemplateElement", + "start":16,"end":21,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":21}}, + "value": { + "raw": "right", + "cooked": "right" + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/13/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/13/options.json deleted file mode 100644 index fd4da953a419..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/13/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/13/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/13/output.json new file mode 100644 index 000000000000..a1809a9c8d81 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/13/output.json @@ -0,0 +1,36 @@ +{ + "type": "File", + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:2)" + ], + "program": { + "type": "Program", + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, + "expression": { + "type": "TemplateLiteral", + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, + "expressions": [], + "quasis": [ + { + "type": "TemplateElement", + "start":1,"end":5,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":5}}, + "value": { + "raw": "\\xAg", + "cooked": null + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/14/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/14/options.json deleted file mode 100644 index fd4da953a419..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/14/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/14/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/14/output.json new file mode 100644 index 000000000000..8e236a6eadc1 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/14/output.json @@ -0,0 +1,55 @@ +{ + "type": "File", + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:2)" + ], + "program": { + "type": "Program", + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, + "expression": { + "type": "TemplateLiteral", + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, + "expressions": [ + { + "type": "NumericLiteral", + "start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8}}, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ], + "quasis": [ + { + "type": "TemplateElement", + "start":1,"end":5,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":5}}, + "value": { + "raw": "\\xAg", + "cooked": null + }, + "tail": false + }, + { + "type": "TemplateElement", + "start":9,"end":14,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":14}}, + "value": { + "raw": "right", + "cooked": "right" + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/15/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/15/options.json deleted file mode 100644 index 27524e2b1f49..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/15/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:10)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/15/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/15/output.json new file mode 100644 index 000000000000..e7b147232828 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/15/output.json @@ -0,0 +1,55 @@ +{ + "type": "File", + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:10)" + ], + "program": { + "type": "Program", + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, + "expression": { + "type": "TemplateLiteral", + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, + "expressions": [ + { + "type": "NumericLiteral", + "start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8}}, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ], + "quasis": [ + { + "type": "TemplateElement", + "start":1,"end":5,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":5}}, + "value": { + "raw": "left", + "cooked": "left" + }, + "tail": false + }, + { + "type": "TemplateElement", + "start":9,"end":13,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":13}}, + "value": { + "raw": "\\xAg", + "cooked": null + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/16/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/16/options.json deleted file mode 100644 index 27524e2b1f49..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/16/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:10)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/16/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/16/output.json new file mode 100644 index 000000000000..4a43408b0fbc --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/16/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:10)" + ], + "program": { + "type": "Program", + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, + "expression": { + "type": "TemplateLiteral", + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, + "expressions": [ + { + "type": "NumericLiteral", + "start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8}}, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + }, + { + "type": "NumericLiteral", + "start":15,"end":16,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":16}}, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + ], + "quasis": [ + { + "type": "TemplateElement", + "start":1,"end":5,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":5}}, + "value": { + "raw": "left", + "cooked": "left" + }, + "tail": false + }, + { + "type": "TemplateElement", + "start":9,"end":13,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":13}}, + "value": { + "raw": "\\xAg", + "cooked": null + }, + "tail": false + }, + { + "type": "TemplateElement", + "start":17,"end":22,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":22}}, + "value": { + "raw": "right", + "cooked": "right" + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/17/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/17/options.json deleted file mode 100644 index fd4da953a419..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/17/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/17/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/17/output.json new file mode 100644 index 000000000000..44c794754aa4 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/17/output.json @@ -0,0 +1,36 @@ +{ + "type": "File", + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:2)" + ], + "program": { + "type": "Program", + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, + "expression": { + "type": "TemplateLiteral", + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, + "expressions": [], + "quasis": [ + { + "type": "TemplateElement", + "start":1,"end":4,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":4}}, + "value": { + "raw": "\\u0", + "cooked": null + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/18/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/18/options.json deleted file mode 100644 index fd4da953a419..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/18/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/18/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/18/output.json new file mode 100644 index 000000000000..455448a59aef --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/18/output.json @@ -0,0 +1,55 @@ +{ + "type": "File", + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:2)" + ], + "program": { + "type": "Program", + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, + "expression": { + "type": "TemplateLiteral", + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, + "expressions": [ + { + "type": "NumericLiteral", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7}}, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ], + "quasis": [ + { + "type": "TemplateElement", + "start":1,"end":4,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":4}}, + "value": { + "raw": "\\u0", + "cooked": null + }, + "tail": false + }, + { + "type": "TemplateElement", + "start":8,"end":13,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":13}}, + "value": { + "raw": "right", + "cooked": "right" + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/19/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/19/options.json deleted file mode 100644 index 27524e2b1f49..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/19/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:10)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/19/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/19/output.json new file mode 100644 index 000000000000..8168708424a4 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/19/output.json @@ -0,0 +1,55 @@ +{ + "type": "File", + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:10)" + ], + "program": { + "type": "Program", + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "expression": { + "type": "TemplateLiteral", + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "expressions": [ + { + "type": "NumericLiteral", + "start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8}}, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ], + "quasis": [ + { + "type": "TemplateElement", + "start":1,"end":5,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":5}}, + "value": { + "raw": "left", + "cooked": "left" + }, + "tail": false + }, + { + "type": "TemplateElement", + "start":9,"end":12,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":12}}, + "value": { + "raw": "\\u0", + "cooked": null + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/2/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/2/options.json deleted file mode 100644 index fd4da953a419..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/2/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/2/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/2/output.json new file mode 100644 index 000000000000..ce52b8a32780 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/2/output.json @@ -0,0 +1,55 @@ +{ + "type": "File", + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:2)" + ], + "program": { + "type": "Program", + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, + "expression": { + "type": "TemplateLiteral", + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, + "expressions": [ + { + "type": "NumericLiteral", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7}}, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ], + "quasis": [ + { + "type": "TemplateElement", + "start":1,"end":4,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":4}}, + "value": { + "raw": "\\01", + "cooked": null + }, + "tail": false + }, + { + "type": "TemplateElement", + "start":8,"end":13,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":13}}, + "value": { + "raw": "right", + "cooked": "right" + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/20/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/20/options.json deleted file mode 100644 index 27524e2b1f49..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/20/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:10)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/20/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/20/output.json new file mode 100644 index 000000000000..35f991fe7e66 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/20/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:10)" + ], + "program": { + "type": "Program", + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, + "expression": { + "type": "TemplateLiteral", + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, + "expressions": [ + { + "type": "NumericLiteral", + "start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8}}, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + }, + { + "type": "NumericLiteral", + "start":14,"end":15,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":15}}, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + ], + "quasis": [ + { + "type": "TemplateElement", + "start":1,"end":5,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":5}}, + "value": { + "raw": "left", + "cooked": "left" + }, + "tail": false + }, + { + "type": "TemplateElement", + "start":9,"end":12,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":12}}, + "value": { + "raw": "\\u0", + "cooked": null + }, + "tail": false + }, + { + "type": "TemplateElement", + "start":16,"end":21,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":21}}, + "value": { + "raw": "right", + "cooked": "right" + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/21/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/21/options.json deleted file mode 100644 index fd4da953a419..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/21/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/21/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/21/output.json new file mode 100644 index 000000000000..7cb40307353a --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/21/output.json @@ -0,0 +1,36 @@ +{ + "type": "File", + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:2)" + ], + "program": { + "type": "Program", + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, + "expression": { + "type": "TemplateLiteral", + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, + "expressions": [], + "quasis": [ + { + "type": "TemplateElement", + "start":1,"end":5,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":5}}, + "value": { + "raw": "\\u0g", + "cooked": null + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/22/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/22/options.json deleted file mode 100644 index fd4da953a419..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/22/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/22/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/22/output.json new file mode 100644 index 000000000000..eff90743fb54 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/22/output.json @@ -0,0 +1,55 @@ +{ + "type": "File", + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:2)" + ], + "program": { + "type": "Program", + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, + "expression": { + "type": "TemplateLiteral", + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, + "expressions": [ + { + "type": "NumericLiteral", + "start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8}}, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ], + "quasis": [ + { + "type": "TemplateElement", + "start":1,"end":5,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":5}}, + "value": { + "raw": "\\u0g", + "cooked": null + }, + "tail": false + }, + { + "type": "TemplateElement", + "start":9,"end":14,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":14}}, + "value": { + "raw": "right", + "cooked": "right" + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/23/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/23/options.json deleted file mode 100644 index 27524e2b1f49..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/23/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:10)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/23/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/23/output.json new file mode 100644 index 000000000000..1087c48d75b5 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/23/output.json @@ -0,0 +1,55 @@ +{ + "type": "File", + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:10)" + ], + "program": { + "type": "Program", + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, + "expression": { + "type": "TemplateLiteral", + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, + "expressions": [ + { + "type": "NumericLiteral", + "start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8}}, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ], + "quasis": [ + { + "type": "TemplateElement", + "start":1,"end":5,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":5}}, + "value": { + "raw": "left", + "cooked": "left" + }, + "tail": false + }, + { + "type": "TemplateElement", + "start":9,"end":13,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":13}}, + "value": { + "raw": "\\u0g", + "cooked": null + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/24/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/24/options.json deleted file mode 100644 index 27524e2b1f49..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/24/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:10)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/24/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/24/output.json new file mode 100644 index 000000000000..c5667acab8c3 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/24/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:10)" + ], + "program": { + "type": "Program", + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, + "expression": { + "type": "TemplateLiteral", + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, + "expressions": [ + { + "type": "NumericLiteral", + "start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8}}, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + }, + { + "type": "NumericLiteral", + "start":15,"end":16,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":16}}, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + ], + "quasis": [ + { + "type": "TemplateElement", + "start":1,"end":5,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":5}}, + "value": { + "raw": "left", + "cooked": "left" + }, + "tail": false + }, + { + "type": "TemplateElement", + "start":9,"end":13,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":13}}, + "value": { + "raw": "\\u0g", + "cooked": null + }, + "tail": false + }, + { + "type": "TemplateElement", + "start":17,"end":22,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":22}}, + "value": { + "raw": "right", + "cooked": "right" + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/25/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/25/options.json deleted file mode 100644 index fd4da953a419..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/25/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/25/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/25/output.json new file mode 100644 index 000000000000..79f7bd562e1e --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/25/output.json @@ -0,0 +1,36 @@ +{ + "type": "File", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:2)" + ], + "program": { + "type": "Program", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "expression": { + "type": "TemplateLiteral", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "expressions": [], + "quasis": [ + { + "type": "TemplateElement", + "start":1,"end":6,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":6}}, + "value": { + "raw": "\\u00g", + "cooked": null + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/26/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/26/options.json deleted file mode 100644 index fd4da953a419..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/26/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/26/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/26/output.json new file mode 100644 index 000000000000..4f81da2ce933 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/26/output.json @@ -0,0 +1,55 @@ +{ + "type": "File", + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:2)" + ], + "program": { + "type": "Program", + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, + "expression": { + "type": "TemplateLiteral", + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, + "expressions": [ + { + "type": "NumericLiteral", + "start":8,"end":9,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":9}}, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ], + "quasis": [ + { + "type": "TemplateElement", + "start":1,"end":6,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":6}}, + "value": { + "raw": "\\u00g", + "cooked": null + }, + "tail": false + }, + { + "type": "TemplateElement", + "start":10,"end":15,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":15}}, + "value": { + "raw": "right", + "cooked": "right" + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/27/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/27/options.json deleted file mode 100644 index 27524e2b1f49..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/27/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:10)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/27/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/27/output.json new file mode 100644 index 000000000000..723655879b5f --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/27/output.json @@ -0,0 +1,55 @@ +{ + "type": "File", + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:10)" + ], + "program": { + "type": "Program", + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, + "expression": { + "type": "TemplateLiteral", + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, + "expressions": [ + { + "type": "NumericLiteral", + "start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8}}, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ], + "quasis": [ + { + "type": "TemplateElement", + "start":1,"end":5,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":5}}, + "value": { + "raw": "left", + "cooked": "left" + }, + "tail": false + }, + { + "type": "TemplateElement", + "start":9,"end":14,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":14}}, + "value": { + "raw": "\\u00g", + "cooked": null + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/28/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/28/options.json deleted file mode 100644 index 27524e2b1f49..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/28/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:10)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/28/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/28/output.json new file mode 100644 index 000000000000..e4a9490764ce --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/28/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:10)" + ], + "program": { + "type": "Program", + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, + "expression": { + "type": "TemplateLiteral", + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, + "expressions": [ + { + "type": "NumericLiteral", + "start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8}}, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + }, + { + "type": "NumericLiteral", + "start":16,"end":17,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":17}}, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + ], + "quasis": [ + { + "type": "TemplateElement", + "start":1,"end":5,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":5}}, + "value": { + "raw": "left", + "cooked": "left" + }, + "tail": false + }, + { + "type": "TemplateElement", + "start":9,"end":14,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":14}}, + "value": { + "raw": "\\u00g", + "cooked": null + }, + "tail": false + }, + { + "type": "TemplateElement", + "start":18,"end":23,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":23}}, + "value": { + "raw": "right", + "cooked": "right" + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/29/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/29/options.json deleted file mode 100644 index fd4da953a419..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/29/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/29/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/29/output.json new file mode 100644 index 000000000000..da8fed17fc46 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/29/output.json @@ -0,0 +1,36 @@ +{ + "type": "File", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:2)" + ], + "program": { + "type": "Program", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "expression": { + "type": "TemplateLiteral", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "expressions": [], + "quasis": [ + { + "type": "TemplateElement", + "start":1,"end":7,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":7}}, + "value": { + "raw": "\\u000g", + "cooked": null + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/3/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/3/options.json deleted file mode 100644 index 27524e2b1f49..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/3/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:10)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/3/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/3/output.json new file mode 100644 index 000000000000..7ae0eef00647 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/3/output.json @@ -0,0 +1,55 @@ +{ + "type": "File", + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:10)" + ], + "program": { + "type": "Program", + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "expression": { + "type": "TemplateLiteral", + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "expressions": [ + { + "type": "NumericLiteral", + "start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8}}, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ], + "quasis": [ + { + "type": "TemplateElement", + "start":1,"end":5,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":5}}, + "value": { + "raw": "left", + "cooked": "left" + }, + "tail": false + }, + { + "type": "TemplateElement", + "start":9,"end":12,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":12}}, + "value": { + "raw": "\\01", + "cooked": null + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/30/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/30/options.json deleted file mode 100644 index fd4da953a419..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/30/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/30/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/30/output.json new file mode 100644 index 000000000000..c24fdfc69ccb --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/30/output.json @@ -0,0 +1,55 @@ +{ + "type": "File", + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:2)" + ], + "program": { + "type": "Program", + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, + "expression": { + "type": "TemplateLiteral", + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, + "expressions": [ + { + "type": "NumericLiteral", + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10}}, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ], + "quasis": [ + { + "type": "TemplateElement", + "start":1,"end":7,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":7}}, + "value": { + "raw": "\\u000g", + "cooked": null + }, + "tail": false + }, + { + "type": "TemplateElement", + "start":11,"end":16,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":16}}, + "value": { + "raw": "right", + "cooked": "right" + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/31/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/31/options.json deleted file mode 100644 index 27524e2b1f49..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/31/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:10)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/31/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/31/output.json new file mode 100644 index 000000000000..82c45a0863af --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/31/output.json @@ -0,0 +1,55 @@ +{ + "type": "File", + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:10)" + ], + "program": { + "type": "Program", + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, + "expression": { + "type": "TemplateLiteral", + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, + "expressions": [ + { + "type": "NumericLiteral", + "start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8}}, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ], + "quasis": [ + { + "type": "TemplateElement", + "start":1,"end":5,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":5}}, + "value": { + "raw": "left", + "cooked": "left" + }, + "tail": false + }, + { + "type": "TemplateElement", + "start":9,"end":15,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":15}}, + "value": { + "raw": "\\u000g", + "cooked": null + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/32/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/32/options.json deleted file mode 100644 index 27524e2b1f49..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/32/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:10)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/32/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/32/output.json new file mode 100644 index 000000000000..653f4d11577a --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/32/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:10)" + ], + "program": { + "type": "Program", + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, + "expression": { + "type": "TemplateLiteral", + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, + "expressions": [ + { + "type": "NumericLiteral", + "start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8}}, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + }, + { + "type": "NumericLiteral", + "start":17,"end":18,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":18}}, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + ], + "quasis": [ + { + "type": "TemplateElement", + "start":1,"end":5,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":5}}, + "value": { + "raw": "left", + "cooked": "left" + }, + "tail": false + }, + { + "type": "TemplateElement", + "start":9,"end":15,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":15}}, + "value": { + "raw": "\\u000g", + "cooked": null + }, + "tail": false + }, + { + "type": "TemplateElement", + "start":19,"end":24,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":24}}, + "value": { + "raw": "right", + "cooked": "right" + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/33/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/33/options.json deleted file mode 100644 index fd4da953a419..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/33/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/33/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/33/output.json new file mode 100644 index 000000000000..411c960f4bd9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/33/output.json @@ -0,0 +1,36 @@ +{ + "type": "File", + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:2)" + ], + "program": { + "type": "Program", + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, + "expression": { + "type": "TemplateLiteral", + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, + "expressions": [], + "quasis": [ + { + "type": "TemplateElement", + "start":1,"end":5,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":5}}, + "value": { + "raw": "\\u{}", + "cooked": null + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/34/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/34/options.json deleted file mode 100644 index fd4da953a419..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/34/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/34/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/34/output.json new file mode 100644 index 000000000000..58f335c032b2 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/34/output.json @@ -0,0 +1,55 @@ +{ + "type": "File", + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:2)" + ], + "program": { + "type": "Program", + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, + "expression": { + "type": "TemplateLiteral", + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, + "expressions": [ + { + "type": "NumericLiteral", + "start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8}}, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ], + "quasis": [ + { + "type": "TemplateElement", + "start":1,"end":5,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":5}}, + "value": { + "raw": "\\u{}", + "cooked": null + }, + "tail": false + }, + { + "type": "TemplateElement", + "start":9,"end":14,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":14}}, + "value": { + "raw": "right", + "cooked": "right" + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/35/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/35/options.json deleted file mode 100644 index 27524e2b1f49..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/35/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:10)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/35/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/35/output.json new file mode 100644 index 000000000000..1bb35ed64a9f --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/35/output.json @@ -0,0 +1,55 @@ +{ + "type": "File", + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:10)" + ], + "program": { + "type": "Program", + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, + "expression": { + "type": "TemplateLiteral", + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, + "expressions": [ + { + "type": "NumericLiteral", + "start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8}}, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ], + "quasis": [ + { + "type": "TemplateElement", + "start":1,"end":5,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":5}}, + "value": { + "raw": "left", + "cooked": "left" + }, + "tail": false + }, + { + "type": "TemplateElement", + "start":9,"end":13,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":13}}, + "value": { + "raw": "\\u{}", + "cooked": null + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/36/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/36/options.json deleted file mode 100644 index 27524e2b1f49..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/36/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:10)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/36/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/36/output.json new file mode 100644 index 000000000000..b713e29da119 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/36/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:10)" + ], + "program": { + "type": "Program", + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, + "expression": { + "type": "TemplateLiteral", + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, + "expressions": [ + { + "type": "NumericLiteral", + "start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8}}, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + }, + { + "type": "NumericLiteral", + "start":15,"end":16,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":16}}, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + ], + "quasis": [ + { + "type": "TemplateElement", + "start":1,"end":5,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":5}}, + "value": { + "raw": "left", + "cooked": "left" + }, + "tail": false + }, + { + "type": "TemplateElement", + "start":9,"end":13,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":13}}, + "value": { + "raw": "\\u{}", + "cooked": null + }, + "tail": false + }, + { + "type": "TemplateElement", + "start":17,"end":22,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":22}}, + "value": { + "raw": "right", + "cooked": "right" + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/37/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/37/options.json deleted file mode 100644 index fd4da953a419..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/37/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/37/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/37/output.json new file mode 100644 index 000000000000..f46c259f1f2b --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/37/output.json @@ -0,0 +1,36 @@ +{ + "type": "File", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:2)" + ], + "program": { + "type": "Program", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "expression": { + "type": "TemplateLiteral", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "expressions": [], + "quasis": [ + { + "type": "TemplateElement", + "start":1,"end":7,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":7}}, + "value": { + "raw": "\\u{-0}", + "cooked": null + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/38/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/38/options.json deleted file mode 100644 index fd4da953a419..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/38/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/38/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/38/output.json new file mode 100644 index 000000000000..0bc304bb7f24 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/38/output.json @@ -0,0 +1,55 @@ +{ + "type": "File", + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:2)" + ], + "program": { + "type": "Program", + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, + "expression": { + "type": "TemplateLiteral", + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, + "expressions": [ + { + "type": "NumericLiteral", + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10}}, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ], + "quasis": [ + { + "type": "TemplateElement", + "start":1,"end":7,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":7}}, + "value": { + "raw": "\\u{-0}", + "cooked": null + }, + "tail": false + }, + { + "type": "TemplateElement", + "start":11,"end":16,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":16}}, + "value": { + "raw": "right", + "cooked": "right" + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/39/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/39/options.json deleted file mode 100644 index 27524e2b1f49..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/39/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:10)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/39/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/39/output.json new file mode 100644 index 000000000000..d49ff0ece275 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/39/output.json @@ -0,0 +1,55 @@ +{ + "type": "File", + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:10)" + ], + "program": { + "type": "Program", + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, + "expression": { + "type": "TemplateLiteral", + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, + "expressions": [ + { + "type": "NumericLiteral", + "start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8}}, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ], + "quasis": [ + { + "type": "TemplateElement", + "start":1,"end":5,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":5}}, + "value": { + "raw": "left", + "cooked": "left" + }, + "tail": false + }, + { + "type": "TemplateElement", + "start":9,"end":15,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":15}}, + "value": { + "raw": "\\u{-0}", + "cooked": null + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/4/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/4/options.json deleted file mode 100644 index 27524e2b1f49..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/4/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:10)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/4/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/4/output.json new file mode 100644 index 000000000000..e5802b234722 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/4/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:10)" + ], + "program": { + "type": "Program", + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, + "expression": { + "type": "TemplateLiteral", + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, + "expressions": [ + { + "type": "NumericLiteral", + "start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8}}, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + }, + { + "type": "NumericLiteral", + "start":14,"end":15,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":15}}, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + ], + "quasis": [ + { + "type": "TemplateElement", + "start":1,"end":5,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":5}}, + "value": { + "raw": "left", + "cooked": "left" + }, + "tail": false + }, + { + "type": "TemplateElement", + "start":9,"end":12,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":12}}, + "value": { + "raw": "\\01", + "cooked": null + }, + "tail": false + }, + { + "type": "TemplateElement", + "start":16,"end":21,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":21}}, + "value": { + "raw": "right", + "cooked": "right" + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/40/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/40/options.json deleted file mode 100644 index 27524e2b1f49..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/40/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:10)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/40/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/40/output.json new file mode 100644 index 000000000000..fd45665f95f1 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/40/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:10)" + ], + "program": { + "type": "Program", + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, + "expression": { + "type": "TemplateLiteral", + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, + "expressions": [ + { + "type": "NumericLiteral", + "start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8}}, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + }, + { + "type": "NumericLiteral", + "start":17,"end":18,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":18}}, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + ], + "quasis": [ + { + "type": "TemplateElement", + "start":1,"end":5,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":5}}, + "value": { + "raw": "left", + "cooked": "left" + }, + "tail": false + }, + { + "type": "TemplateElement", + "start":9,"end":15,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":15}}, + "value": { + "raw": "\\u{-0}", + "cooked": null + }, + "tail": false + }, + { + "type": "TemplateElement", + "start":19,"end":24,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":24}}, + "value": { + "raw": "right", + "cooked": "right" + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/41/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/41/options.json deleted file mode 100644 index fd4da953a419..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/41/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/41/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/41/output.json new file mode 100644 index 000000000000..5778cecc9dc6 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/41/output.json @@ -0,0 +1,36 @@ +{ + "type": "File", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:2)" + ], + "program": { + "type": "Program", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "expression": { + "type": "TemplateLiteral", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "expressions": [], + "quasis": [ + { + "type": "TemplateElement", + "start":1,"end":6,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":6}}, + "value": { + "raw": "\\u{g}", + "cooked": null + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/42/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/42/options.json deleted file mode 100644 index fd4da953a419..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/42/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/42/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/42/output.json new file mode 100644 index 000000000000..fde0d72e80dd --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/42/output.json @@ -0,0 +1,55 @@ +{ + "type": "File", + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:2)" + ], + "program": { + "type": "Program", + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, + "expression": { + "type": "TemplateLiteral", + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, + "expressions": [ + { + "type": "NumericLiteral", + "start":8,"end":9,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":9}}, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ], + "quasis": [ + { + "type": "TemplateElement", + "start":1,"end":6,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":6}}, + "value": { + "raw": "\\u{g}", + "cooked": null + }, + "tail": false + }, + { + "type": "TemplateElement", + "start":10,"end":15,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":15}}, + "value": { + "raw": "right", + "cooked": "right" + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/43/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/43/options.json deleted file mode 100644 index 27524e2b1f49..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/43/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:10)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/43/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/43/output.json new file mode 100644 index 000000000000..ed08a002f952 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/43/output.json @@ -0,0 +1,55 @@ +{ + "type": "File", + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:10)" + ], + "program": { + "type": "Program", + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, + "expression": { + "type": "TemplateLiteral", + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, + "expressions": [ + { + "type": "NumericLiteral", + "start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8}}, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ], + "quasis": [ + { + "type": "TemplateElement", + "start":1,"end":5,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":5}}, + "value": { + "raw": "left", + "cooked": "left" + }, + "tail": false + }, + { + "type": "TemplateElement", + "start":9,"end":14,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":14}}, + "value": { + "raw": "\\u{g}", + "cooked": null + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/44/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/44/options.json deleted file mode 100644 index 27524e2b1f49..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/44/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:10)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/44/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/44/output.json new file mode 100644 index 000000000000..17bae3ae9977 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/44/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:10)" + ], + "program": { + "type": "Program", + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, + "expression": { + "type": "TemplateLiteral", + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, + "expressions": [ + { + "type": "NumericLiteral", + "start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8}}, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + }, + { + "type": "NumericLiteral", + "start":16,"end":17,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":17}}, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + ], + "quasis": [ + { + "type": "TemplateElement", + "start":1,"end":5,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":5}}, + "value": { + "raw": "left", + "cooked": "left" + }, + "tail": false + }, + { + "type": "TemplateElement", + "start":9,"end":14,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":14}}, + "value": { + "raw": "\\u{g}", + "cooked": null + }, + "tail": false + }, + { + "type": "TemplateElement", + "start":18,"end":23,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":23}}, + "value": { + "raw": "right", + "cooked": "right" + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/45/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/45/options.json deleted file mode 100644 index fd4da953a419..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/45/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/45/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/45/output.json new file mode 100644 index 000000000000..66c1f8c3f742 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/45/output.json @@ -0,0 +1,36 @@ +{ + "type": "File", + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:2)" + ], + "program": { + "type": "Program", + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, + "expression": { + "type": "TemplateLiteral", + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, + "expressions": [], + "quasis": [ + { + "type": "TemplateElement", + "start":1,"end":4,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":4}}, + "value": { + "raw": "\\u{", + "cooked": null + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/46/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/46/options.json deleted file mode 100644 index fd4da953a419..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/46/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/46/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/46/output.json new file mode 100644 index 000000000000..e0a9cd51c3a4 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/46/output.json @@ -0,0 +1,55 @@ +{ + "type": "File", + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:2)" + ], + "program": { + "type": "Program", + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, + "expression": { + "type": "TemplateLiteral", + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, + "expressions": [ + { + "type": "NumericLiteral", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7}}, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ], + "quasis": [ + { + "type": "TemplateElement", + "start":1,"end":4,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":4}}, + "value": { + "raw": "\\u{", + "cooked": null + }, + "tail": false + }, + { + "type": "TemplateElement", + "start":8,"end":13,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":13}}, + "value": { + "raw": "right", + "cooked": "right" + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/47/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/47/options.json deleted file mode 100644 index 27524e2b1f49..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/47/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:10)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/47/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/47/output.json new file mode 100644 index 000000000000..f6098844bbd8 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/47/output.json @@ -0,0 +1,55 @@ +{ + "type": "File", + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:10)" + ], + "program": { + "type": "Program", + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "expression": { + "type": "TemplateLiteral", + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "expressions": [ + { + "type": "NumericLiteral", + "start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8}}, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ], + "quasis": [ + { + "type": "TemplateElement", + "start":1,"end":5,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":5}}, + "value": { + "raw": "left", + "cooked": "left" + }, + "tail": false + }, + { + "type": "TemplateElement", + "start":9,"end":12,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":12}}, + "value": { + "raw": "\\u{", + "cooked": null + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/48/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/48/options.json deleted file mode 100644 index 27524e2b1f49..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/48/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:10)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/48/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/48/output.json new file mode 100644 index 000000000000..73f36b31b12f --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/48/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:10)" + ], + "program": { + "type": "Program", + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, + "expression": { + "type": "TemplateLiteral", + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, + "expressions": [ + { + "type": "NumericLiteral", + "start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8}}, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + }, + { + "type": "NumericLiteral", + "start":14,"end":15,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":15}}, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + ], + "quasis": [ + { + "type": "TemplateElement", + "start":1,"end":5,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":5}}, + "value": { + "raw": "left", + "cooked": "left" + }, + "tail": false + }, + { + "type": "TemplateElement", + "start":9,"end":12,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":12}}, + "value": { + "raw": "\\u{", + "cooked": null + }, + "tail": false + }, + { + "type": "TemplateElement", + "start":16,"end":21,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":21}}, + "value": { + "raw": "right", + "cooked": "right" + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/49/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/49/options.json deleted file mode 100644 index fd4da953a419..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/49/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/49/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/49/output.json new file mode 100644 index 000000000000..c20647b9ca75 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/49/output.json @@ -0,0 +1,36 @@ +{ + "type": "File", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:2)" + ], + "program": { + "type": "Program", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "expression": { + "type": "TemplateLiteral", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "expressions": [], + "quasis": [ + { + "type": "TemplateElement", + "start":1,"end":6,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":6}}, + "value": { + "raw": "\\u{\\\\", + "cooked": null + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/5/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/5/options.json deleted file mode 100644 index fd4da953a419..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/5/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/5/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/5/output.json new file mode 100644 index 000000000000..6d1d532d73cb --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/5/output.json @@ -0,0 +1,36 @@ +{ + "type": "File", + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:2)" + ], + "program": { + "type": "Program", + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, + "expression": { + "type": "TemplateLiteral", + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, + "expressions": [], + "quasis": [ + { + "type": "TemplateElement", + "start":1,"end":3,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":3}}, + "value": { + "raw": "\\1", + "cooked": null + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/50/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/50/options.json deleted file mode 100644 index fd4da953a419..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/50/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/50/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/50/output.json new file mode 100644 index 000000000000..14f94a2dfd62 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/50/output.json @@ -0,0 +1,55 @@ +{ + "type": "File", + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:2)" + ], + "program": { + "type": "Program", + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, + "expression": { + "type": "TemplateLiteral", + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, + "expressions": [ + { + "type": "NumericLiteral", + "start":8,"end":9,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":9}}, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ], + "quasis": [ + { + "type": "TemplateElement", + "start":1,"end":6,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":6}}, + "value": { + "raw": "\\u{\\\\", + "cooked": null + }, + "tail": false + }, + { + "type": "TemplateElement", + "start":10,"end":15,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":15}}, + "value": { + "raw": "right", + "cooked": "right" + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/51/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/51/options.json deleted file mode 100644 index 27524e2b1f49..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/51/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:10)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/51/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/51/output.json new file mode 100644 index 000000000000..9dc1704ccb9d --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/51/output.json @@ -0,0 +1,55 @@ +{ + "type": "File", + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:10)" + ], + "program": { + "type": "Program", + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, + "expression": { + "type": "TemplateLiteral", + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, + "expressions": [ + { + "type": "NumericLiteral", + "start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8}}, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ], + "quasis": [ + { + "type": "TemplateElement", + "start":1,"end":5,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":5}}, + "value": { + "raw": "left", + "cooked": "left" + }, + "tail": false + }, + { + "type": "TemplateElement", + "start":9,"end":14,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":14}}, + "value": { + "raw": "\\u{\\\\", + "cooked": null + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/52/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/52/options.json deleted file mode 100644 index 27524e2b1f49..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/52/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:10)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/52/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/52/output.json new file mode 100644 index 000000000000..bf1a1f2cd623 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/52/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:10)" + ], + "program": { + "type": "Program", + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, + "expression": { + "type": "TemplateLiteral", + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, + "expressions": [ + { + "type": "NumericLiteral", + "start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8}}, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + }, + { + "type": "NumericLiteral", + "start":16,"end":17,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":17}}, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + ], + "quasis": [ + { + "type": "TemplateElement", + "start":1,"end":5,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":5}}, + "value": { + "raw": "left", + "cooked": "left" + }, + "tail": false + }, + { + "type": "TemplateElement", + "start":9,"end":14,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":14}}, + "value": { + "raw": "\\u{\\\\", + "cooked": null + }, + "tail": false + }, + { + "type": "TemplateElement", + "start":18,"end":23,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":23}}, + "value": { + "raw": "right", + "cooked": "right" + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/53/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/53/options.json deleted file mode 100644 index fd4da953a419..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/53/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/53/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/53/output.json new file mode 100644 index 000000000000..a091d166a9cd --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/53/output.json @@ -0,0 +1,36 @@ +{ + "type": "File", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:2)" + ], + "program": { + "type": "Program", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "expression": { + "type": "TemplateLiteral", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "expressions": [], + "quasis": [ + { + "type": "TemplateElement", + "start":1,"end":6,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":6}}, + "value": { + "raw": "\\u{\\`", + "cooked": null + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/54/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/54/options.json deleted file mode 100644 index fd4da953a419..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/54/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/54/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/54/output.json new file mode 100644 index 000000000000..00c9046112e0 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/54/output.json @@ -0,0 +1,55 @@ +{ + "type": "File", + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:2)" + ], + "program": { + "type": "Program", + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, + "expression": { + "type": "TemplateLiteral", + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, + "expressions": [ + { + "type": "NumericLiteral", + "start":8,"end":9,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":9}}, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ], + "quasis": [ + { + "type": "TemplateElement", + "start":1,"end":6,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":6}}, + "value": { + "raw": "\\u{\\`", + "cooked": null + }, + "tail": false + }, + { + "type": "TemplateElement", + "start":10,"end":15,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":15}}, + "value": { + "raw": "right", + "cooked": "right" + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/55/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/55/options.json deleted file mode 100644 index 27524e2b1f49..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/55/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:10)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/55/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/55/output.json new file mode 100644 index 000000000000..1a31ef55aa0f --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/55/output.json @@ -0,0 +1,55 @@ +{ + "type": "File", + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:10)" + ], + "program": { + "type": "Program", + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, + "expression": { + "type": "TemplateLiteral", + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, + "expressions": [ + { + "type": "NumericLiteral", + "start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8}}, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ], + "quasis": [ + { + "type": "TemplateElement", + "start":1,"end":5,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":5}}, + "value": { + "raw": "left", + "cooked": "left" + }, + "tail": false + }, + { + "type": "TemplateElement", + "start":9,"end":14,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":14}}, + "value": { + "raw": "\\u{\\`", + "cooked": null + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/56/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/56/options.json deleted file mode 100644 index 27524e2b1f49..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/56/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:10)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/56/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/56/output.json new file mode 100644 index 000000000000..0743ba782383 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/56/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:10)" + ], + "program": { + "type": "Program", + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, + "expression": { + "type": "TemplateLiteral", + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, + "expressions": [ + { + "type": "NumericLiteral", + "start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8}}, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + }, + { + "type": "NumericLiteral", + "start":16,"end":17,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":17}}, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + ], + "quasis": [ + { + "type": "TemplateElement", + "start":1,"end":5,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":5}}, + "value": { + "raw": "left", + "cooked": "left" + }, + "tail": false + }, + { + "type": "TemplateElement", + "start":9,"end":14,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":14}}, + "value": { + "raw": "\\u{\\`", + "cooked": null + }, + "tail": false + }, + { + "type": "TemplateElement", + "start":18,"end":23,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":23}}, + "value": { + "raw": "right", + "cooked": "right" + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/57/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/57/options.json deleted file mode 100644 index fd4da953a419..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/57/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/57/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/57/output.json new file mode 100644 index 000000000000..3ca7f733f342 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/57/output.json @@ -0,0 +1,36 @@ +{ + "type": "File", + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:2)" + ], + "program": { + "type": "Program", + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, + "expression": { + "type": "TemplateLiteral", + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, + "expressions": [], + "quasis": [ + { + "type": "TemplateElement", + "start":1,"end":5,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":5}}, + "value": { + "raw": "\\u{0", + "cooked": null + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/58/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/58/options.json deleted file mode 100644 index fd4da953a419..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/58/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/58/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/58/output.json new file mode 100644 index 000000000000..dd14b4489249 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/58/output.json @@ -0,0 +1,55 @@ +{ + "type": "File", + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:2)" + ], + "program": { + "type": "Program", + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, + "expression": { + "type": "TemplateLiteral", + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, + "expressions": [ + { + "type": "NumericLiteral", + "start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8}}, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ], + "quasis": [ + { + "type": "TemplateElement", + "start":1,"end":5,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":5}}, + "value": { + "raw": "\\u{0", + "cooked": null + }, + "tail": false + }, + { + "type": "TemplateElement", + "start":9,"end":14,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":14}}, + "value": { + "raw": "right", + "cooked": "right" + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/59/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/59/options.json deleted file mode 100644 index 27524e2b1f49..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/59/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:10)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/59/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/59/output.json new file mode 100644 index 000000000000..46e5846787ca --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/59/output.json @@ -0,0 +1,55 @@ +{ + "type": "File", + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:10)" + ], + "program": { + "type": "Program", + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, + "expression": { + "type": "TemplateLiteral", + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, + "expressions": [ + { + "type": "NumericLiteral", + "start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8}}, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ], + "quasis": [ + { + "type": "TemplateElement", + "start":1,"end":5,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":5}}, + "value": { + "raw": "left", + "cooked": "left" + }, + "tail": false + }, + { + "type": "TemplateElement", + "start":9,"end":13,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":13}}, + "value": { + "raw": "\\u{0", + "cooked": null + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/6/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/6/options.json deleted file mode 100644 index fd4da953a419..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/6/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/6/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/6/output.json new file mode 100644 index 000000000000..d765a4698e87 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/6/output.json @@ -0,0 +1,55 @@ +{ + "type": "File", + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:2)" + ], + "program": { + "type": "Program", + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "expression": { + "type": "TemplateLiteral", + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "expressions": [ + { + "type": "NumericLiteral", + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ], + "quasis": [ + { + "type": "TemplateElement", + "start":1,"end":3,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":3}}, + "value": { + "raw": "\\1", + "cooked": null + }, + "tail": false + }, + { + "type": "TemplateElement", + "start":7,"end":12,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":12}}, + "value": { + "raw": "right", + "cooked": "right" + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/60/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/60/options.json deleted file mode 100644 index 27524e2b1f49..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/60/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:10)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/60/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/60/output.json new file mode 100644 index 000000000000..85fc081b8e3c --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/60/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:10)" + ], + "program": { + "type": "Program", + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, + "expression": { + "type": "TemplateLiteral", + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, + "expressions": [ + { + "type": "NumericLiteral", + "start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8}}, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + }, + { + "type": "NumericLiteral", + "start":15,"end":16,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":16}}, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + ], + "quasis": [ + { + "type": "TemplateElement", + "start":1,"end":5,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":5}}, + "value": { + "raw": "left", + "cooked": "left" + }, + "tail": false + }, + { + "type": "TemplateElement", + "start":9,"end":13,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":13}}, + "value": { + "raw": "\\u{0", + "cooked": null + }, + "tail": false + }, + { + "type": "TemplateElement", + "start":17,"end":22,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":22}}, + "value": { + "raw": "right", + "cooked": "right" + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/61/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/61/options.json deleted file mode 100644 index fd4da953a419..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/61/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/61/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/61/output.json new file mode 100644 index 000000000000..2b9b23d37689 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/61/output.json @@ -0,0 +1,36 @@ +{ + "type": "File", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:2)" + ], + "program": { + "type": "Program", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "expression": { + "type": "TemplateLiteral", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "expressions": [], + "quasis": [ + { + "type": "TemplateElement", + "start":1,"end":9,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":9}}, + "value": { + "raw": "\\u{\\u{0}", + "cooked": null + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/62/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/62/options.json deleted file mode 100644 index fd4da953a419..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/62/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/62/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/62/output.json new file mode 100644 index 000000000000..05837f4a9777 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/62/output.json @@ -0,0 +1,55 @@ +{ + "type": "File", + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:2)" + ], + "program": { + "type": "Program", + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, + "expression": { + "type": "TemplateLiteral", + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, + "expressions": [ + { + "type": "NumericLiteral", + "start":11,"end":12,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":12}}, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ], + "quasis": [ + { + "type": "TemplateElement", + "start":1,"end":9,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":9}}, + "value": { + "raw": "\\u{\\u{0}", + "cooked": null + }, + "tail": false + }, + { + "type": "TemplateElement", + "start":13,"end":18,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":18}}, + "value": { + "raw": "right", + "cooked": "right" + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/63/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/63/options.json deleted file mode 100644 index 27524e2b1f49..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/63/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:10)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/63/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/63/output.json new file mode 100644 index 000000000000..aad86fddc422 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/63/output.json @@ -0,0 +1,55 @@ +{ + "type": "File", + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:10)" + ], + "program": { + "type": "Program", + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, + "expression": { + "type": "TemplateLiteral", + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, + "expressions": [ + { + "type": "NumericLiteral", + "start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8}}, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ], + "quasis": [ + { + "type": "TemplateElement", + "start":1,"end":5,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":5}}, + "value": { + "raw": "left", + "cooked": "left" + }, + "tail": false + }, + { + "type": "TemplateElement", + "start":9,"end":17,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":17}}, + "value": { + "raw": "\\u{\\u{0}", + "cooked": null + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/64/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/64/options.json deleted file mode 100644 index 27524e2b1f49..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/64/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:10)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/64/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/64/output.json new file mode 100644 index 000000000000..1710ddd99dd0 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/64/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:10)" + ], + "program": { + "type": "Program", + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, + "expression": { + "type": "TemplateLiteral", + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, + "expressions": [ + { + "type": "NumericLiteral", + "start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8}}, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + }, + { + "type": "NumericLiteral", + "start":19,"end":20,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":20}}, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + ], + "quasis": [ + { + "type": "TemplateElement", + "start":1,"end":5,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":5}}, + "value": { + "raw": "left", + "cooked": "left" + }, + "tail": false + }, + { + "type": "TemplateElement", + "start":9,"end":17,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":17}}, + "value": { + "raw": "\\u{\\u{0}", + "cooked": null + }, + "tail": false + }, + { + "type": "TemplateElement", + "start":21,"end":26,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":26}}, + "value": { + "raw": "right", + "cooked": "right" + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/65/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/65/options.json deleted file mode 100644 index fd4da953a419..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/65/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/65/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/65/output.json new file mode 100644 index 000000000000..aee11de08c59 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/65/output.json @@ -0,0 +1,36 @@ +{ + "type": "File", + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:2)" + ], + "program": { + "type": "Program", + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "expression": { + "type": "TemplateLiteral", + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "expressions": [], + "quasis": [ + { + "type": "TemplateElement", + "start":1,"end":11,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":11}}, + "value": { + "raw": "\\u{110000}", + "cooked": null + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/66/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/66/options.json deleted file mode 100644 index fd4da953a419..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/66/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/66/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/66/output.json new file mode 100644 index 000000000000..0e1c9101ebcb --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/66/output.json @@ -0,0 +1,55 @@ +{ + "type": "File", + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:2)" + ], + "program": { + "type": "Program", + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, + "expression": { + "type": "TemplateLiteral", + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, + "expressions": [ + { + "type": "NumericLiteral", + "start":13,"end":14,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":14}}, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ], + "quasis": [ + { + "type": "TemplateElement", + "start":1,"end":11,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":11}}, + "value": { + "raw": "\\u{110000}", + "cooked": null + }, + "tail": false + }, + { + "type": "TemplateElement", + "start":15,"end":20,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":20}}, + "value": { + "raw": "right", + "cooked": "right" + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/67/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/67/options.json deleted file mode 100644 index 27524e2b1f49..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/67/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:10)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/67/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/67/output.json new file mode 100644 index 000000000000..c705268ab87a --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/67/output.json @@ -0,0 +1,55 @@ +{ + "type": "File", + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:10)" + ], + "program": { + "type": "Program", + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, + "expression": { + "type": "TemplateLiteral", + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, + "expressions": [ + { + "type": "NumericLiteral", + "start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8}}, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ], + "quasis": [ + { + "type": "TemplateElement", + "start":1,"end":5,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":5}}, + "value": { + "raw": "left", + "cooked": "left" + }, + "tail": false + }, + { + "type": "TemplateElement", + "start":9,"end":19,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":19}}, + "value": { + "raw": "\\u{110000}", + "cooked": null + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/68/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/68/options.json deleted file mode 100644 index 27524e2b1f49..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/68/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:10)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/68/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/68/output.json new file mode 100644 index 000000000000..e7434d46f7a1 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/68/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:10)" + ], + "program": { + "type": "Program", + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, + "expression": { + "type": "TemplateLiteral", + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, + "expressions": [ + { + "type": "NumericLiteral", + "start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8}}, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + }, + { + "type": "NumericLiteral", + "start":21,"end":22,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":22}}, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + ], + "quasis": [ + { + "type": "TemplateElement", + "start":1,"end":5,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":5}}, + "value": { + "raw": "left", + "cooked": "left" + }, + "tail": false + }, + { + "type": "TemplateElement", + "start":9,"end":19,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":19}}, + "value": { + "raw": "\\u{110000}", + "cooked": null + }, + "tail": false + }, + { + "type": "TemplateElement", + "start":23,"end":28,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":28}}, + "value": { + "raw": "right", + "cooked": "right" + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/7/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/7/options.json deleted file mode 100644 index 27524e2b1f49..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/7/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:10)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/7/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/7/output.json new file mode 100644 index 000000000000..5a00ed65e725 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/7/output.json @@ -0,0 +1,55 @@ +{ + "type": "File", + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:10)" + ], + "program": { + "type": "Program", + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "expression": { + "type": "TemplateLiteral", + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "expressions": [ + { + "type": "NumericLiteral", + "start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8}}, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ], + "quasis": [ + { + "type": "TemplateElement", + "start":1,"end":5,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":5}}, + "value": { + "raw": "left", + "cooked": "left" + }, + "tail": false + }, + { + "type": "TemplateElement", + "start":9,"end":11,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":11}}, + "value": { + "raw": "\\1", + "cooked": null + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/8/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/8/options.json deleted file mode 100644 index 27524e2b1f49..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/8/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:10)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/8/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/8/output.json new file mode 100644 index 000000000000..4d6328f56dd1 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/8/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:10)" + ], + "program": { + "type": "Program", + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, + "expression": { + "type": "TemplateLiteral", + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, + "expressions": [ + { + "type": "NumericLiteral", + "start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8}}, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + }, + { + "type": "NumericLiteral", + "start":13,"end":14,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":14}}, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + ], + "quasis": [ + { + "type": "TemplateElement", + "start":1,"end":5,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":5}}, + "value": { + "raw": "left", + "cooked": "left" + }, + "tail": false + }, + { + "type": "TemplateElement", + "start":9,"end":11,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":11}}, + "value": { + "raw": "\\1", + "cooked": null + }, + "tail": false + }, + { + "type": "TemplateElement", + "start":15,"end":20,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":20}}, + "value": { + "raw": "right", + "cooked": "right" + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/9/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/9/options.json deleted file mode 100644 index fd4da953a419..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/9/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/9/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/9/output.json new file mode 100644 index 000000000000..e2385a402468 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/9/output.json @@ -0,0 +1,36 @@ +{ + "type": "File", + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:2)" + ], + "program": { + "type": "Program", + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, + "expression": { + "type": "TemplateLiteral", + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, + "expressions": [], + "quasis": [ + { + "type": "TemplateElement", + "start":1,"end":4,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":4}}, + "value": { + "raw": "\\xg", + "cooked": null + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/throw-expression/comma/output.json b/packages/babel-parser/test/fixtures/experimental/throw-expression/comma/output.json index 57d230a74e40..a435e5387f75 100644 --- a/packages/babel-parser/test/fixtures/experimental/throw-expression/comma/output.json +++ b/packages/babel-parser/test/fixtures/experimental/throw-expression/comma/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "id": { "type": "Identifier", - "start": 9, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 13 - }, - "identifierName": "test" - }, + "start":9,"end":13,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":13},"identifierName":"test"}, "name": "test" }, "generator": false, @@ -65,78 +20,23 @@ "params": [], "body": { "type": "BlockStatement", - "start": 16, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":16,"end":35,"loc":{"start":{"line":1,"column":16},"end":{"line":3,"column":1}}, "body": [ { "type": "ExpressionStatement", - "start": 20, - "end": 33, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 15 - } - }, + "start":20,"end":33,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":15}}, "expression": { "type": "SequenceExpression", - "start": 21, - "end": 31, - "loc": { - "start": { - "line": 2, - "column": 3 - }, - "end": { - "line": 2, - "column": 13 - } - }, + "start":21,"end":31,"loc":{"start":{"line":2,"column":3},"end":{"line":2,"column":13}}, "expressions": [ { "type": "UnaryExpression", - "start": 21, - "end": 28, - "loc": { - "start": { - "line": 2, - "column": 3 - }, - "end": { - "line": 2, - "column": 10 - } - }, + "start":21,"end":28,"loc":{"start":{"line":2,"column":3},"end":{"line":2,"column":10}}, "operator": "throw", "prefix": true, "argument": { "type": "NumericLiteral", - "start": 27, - "end": 28, - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 10 - } - }, + "start":27,"end":28,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":10}}, "extra": { "rawValue": 1, "raw": "1" @@ -146,18 +46,7 @@ }, { "type": "NumericLiteral", - "start": 30, - "end": 31, - "loc": { - "start": { - "line": 2, - "column": 12 - }, - "end": { - "line": 2, - "column": 13 - } - }, + "start":30,"end":31,"loc":{"start":{"line":2,"column":12},"end":{"line":2,"column":13}}, "extra": { "rawValue": 2, "raw": "2" diff --git a/packages/babel-parser/test/fixtures/experimental/throw-expression/expression/output.json b/packages/babel-parser/test/fixtures/experimental/throw-expression/expression/output.json index 91c2e1441d4c..624332e91abe 100644 --- a/packages/babel-parser/test/fixtures/experimental/throw-expression/expression/output.json +++ b/packages/babel-parser/test/fixtures/experimental/throw-expression/expression/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "id": { "type": "Identifier", - "start": 9, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 13 - }, - "identifierName": "test" - }, + "start":9,"end":13,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":13},"identifierName":"test"}, "name": "test" }, "generator": false, @@ -65,63 +20,19 @@ "params": [], "body": { "type": "BlockStatement", - "start": 16, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":16,"end":32,"loc":{"start":{"line":1,"column":16},"end":{"line":3,"column":1}}, "body": [ { "type": "ExpressionStatement", - "start": 20, - "end": 30, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 12 - } - }, + "start":20,"end":30,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":12}}, "expression": { "type": "UnaryExpression", - "start": 21, - "end": 28, - "loc": { - "start": { - "line": 2, - "column": 3 - }, - "end": { - "line": 2, - "column": 10 - } - }, + "start":21,"end":28,"loc":{"start":{"line":2,"column":3},"end":{"line":2,"column":10}}, "operator": "throw", "prefix": true, "argument": { "type": "NumericLiteral", - "start": 27, - "end": 28, - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 10 - } - }, + "start":27,"end":28,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":10}}, "extra": { "rawValue": 1, "raw": "1" diff --git a/packages/babel-parser/test/fixtures/experimental/throw-expression/logical/output.json b/packages/babel-parser/test/fixtures/experimental/throw-expression/logical/output.json index ed02f24ca983..510edbfca9f4 100644 --- a/packages/babel-parser/test/fixtures/experimental/throw-expression/logical/output.json +++ b/packages/babel-parser/test/fixtures/experimental/throw-expression/logical/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "id": { "type": "Identifier", - "start": 9, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 13 - }, - "identifierName": "test" - }, + "start":9,"end":13,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":13},"identifierName":"test"}, "name": "test" }, "generator": false, @@ -65,94 +20,28 @@ "params": [], "body": { "type": "BlockStatement", - "start": 16, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":16,"end":38,"loc":{"start":{"line":1,"column":16},"end":{"line":3,"column":1}}, "body": [ { "type": "ExpressionStatement", - "start": 20, - "end": 36, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 18 - } - }, + "start":20,"end":36,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":18}}, "expression": { "type": "LogicalExpression", - "start": 20, - "end": 35, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 17 - } - }, + "start":20,"end":35,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":17}}, "left": { "type": "BooleanLiteral", - "start": 20, - "end": 24, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 6 - } - }, + "start":20,"end":24,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":6}}, "value": true }, "operator": "&&", "right": { "type": "UnaryExpression", - "start": 28, - "end": 35, - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 17 - } - }, + "start":28,"end":35,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":17}}, "operator": "throw", "prefix": true, "argument": { "type": "NumericLiteral", - "start": 34, - "end": 35, - "loc": { - "start": { - "line": 2, - "column": 16 - }, - "end": { - "line": 2, - "column": 17 - } - }, + "start":34,"end":35,"loc":{"start":{"line":2,"column":16},"end":{"line":2,"column":17}}, "extra": { "rawValue": 1, "raw": "1" diff --git a/packages/babel-parser/test/fixtures/experimental/throw-expression/statement/output.json b/packages/babel-parser/test/fixtures/experimental/throw-expression/statement/output.json index 21a73cbfdc9f..b639cf4ee02c 100644 --- a/packages/babel-parser/test/fixtures/experimental/throw-expression/statement/output.json +++ b/packages/babel-parser/test/fixtures/experimental/throw-expression/statement/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "id": { "type": "Identifier", - "start": 9, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 13 - }, - "identifierName": "test" - }, + "start":9,"end":13,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":13},"identifierName":"test"}, "name": "test" }, "generator": false, @@ -65,47 +20,14 @@ "params": [], "body": { "type": "BlockStatement", - "start": 16, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":16,"end":30,"loc":{"start":{"line":1,"column":16},"end":{"line":3,"column":1}}, "body": [ { "type": "ThrowStatement", - "start": 20, - "end": 28, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 10 - } - }, + "start":20,"end":28,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":10}}, "argument": { "type": "NumericLiteral", - "start": 26, - "end": 27, - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 9 - } - }, + "start":26,"end":27,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":9}}, "extra": { "rawValue": 1, "raw": "1" diff --git a/packages/babel-parser/test/fixtures/experimental/top-level-await/export-default/input.js b/packages/babel-parser/test/fixtures/experimental/top-level-await/export-default/input.js new file mode 100644 index 000000000000..fd1dbe08b03f --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/top-level-await/export-default/input.js @@ -0,0 +1 @@ +export default await 0; \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/top-level-await/export-default/options.json b/packages/babel-parser/test/fixtures/experimental/top-level-await/export-default/options.json new file mode 100644 index 000000000000..aadc3411ae9b --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/top-level-await/export-default/options.json @@ -0,0 +1,4 @@ +{ + "plugins": ["topLevelAwait"], + "sourceType": "module" +} diff --git a/packages/babel-parser/test/fixtures/experimental/top-level-await/export-default/output.json b/packages/babel-parser/test/fixtures/experimental/top-level-await/export-default/output.json new file mode 100644 index 000000000000..9a2bfcf9f312 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/top-level-await/export-default/output.json @@ -0,0 +1,30 @@ +{ + "type": "File", + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, + "program": { + "type": "Program", + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExportDefaultDeclaration", + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, + "declaration": { + "type": "AwaitExpression", + "start":15,"end":22,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":22}}, + "argument": { + "type": "NumericLiteral", + "start":21,"end":22,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":22}}, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/top-level-await/for-await-module/input.js b/packages/babel-parser/test/fixtures/experimental/top-level-await/for-await-module/input.js new file mode 100644 index 000000000000..ac76014a6f83 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/top-level-await/for-await-module/input.js @@ -0,0 +1 @@ +for await (const a of b); \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/top-level-await/for-await-module/options.json b/packages/babel-parser/test/fixtures/experimental/top-level-await/for-await-module/options.json new file mode 100644 index 000000000000..aadc3411ae9b --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/top-level-await/for-await-module/options.json @@ -0,0 +1,4 @@ +{ + "plugins": ["topLevelAwait"], + "sourceType": "module" +} diff --git a/packages/babel-parser/test/fixtures/experimental/top-level-await/for-await-module/output.json b/packages/babel-parser/test/fixtures/experimental/top-level-await/for-await-module/output.json new file mode 100644 index 000000000000..4e5b3ec14483 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/top-level-await/for-await-module/output.json @@ -0,0 +1,44 @@ +{ + "type": "File", + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, + "program": { + "type": "Program", + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ForOfStatement", + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, + "await": true, + "left": { + "type": "VariableDeclaration", + "start":11,"end":18,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":18}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":17,"end":18,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":18}}, + "id": { + "type": "Identifier", + "start":17,"end":18,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":18},"identifierName":"a"}, + "name": "a" + }, + "init": null + } + ], + "kind": "const" + }, + "right": { + "type": "Identifier", + "start":22,"end":23,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":23},"identifierName":"b"}, + "name": "b" + }, + "body": { + "type": "EmptyStatement", + "start":24,"end":25,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":25}} + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/top-level-await/for-await-script/input.js b/packages/babel-parser/test/fixtures/experimental/top-level-await/for-await-script/input.js new file mode 100644 index 000000000000..ac76014a6f83 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/top-level-await/for-await-script/input.js @@ -0,0 +1 @@ +for await (const a of b); \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/top-level-await/for-await-script/options.json b/packages/babel-parser/test/fixtures/experimental/top-level-await/for-await-script/options.json new file mode 100644 index 000000000000..ad8783d13faa --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/top-level-await/for-await-script/options.json @@ -0,0 +1,5 @@ +{ + "plugins": ["topLevelAwait"], + "sourceType": "script", + "throws": "Unexpected token, expected \"(\" (1:4)" +} diff --git a/packages/babel-parser/test/fixtures/experimental/top-level-await/inside-arrow/input.js b/packages/babel-parser/test/fixtures/experimental/top-level-await/inside-arrow/input.js new file mode 100644 index 000000000000..bde15d37c8ca --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/top-level-await/inside-arrow/input.js @@ -0,0 +1 @@ +() => await 0; diff --git a/packages/babel-parser/test/fixtures/experimental/top-level-await/inside-arrow/options.json b/packages/babel-parser/test/fixtures/experimental/top-level-await/inside-arrow/options.json new file mode 100644 index 000000000000..64cfc06e5014 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/top-level-await/inside-arrow/options.json @@ -0,0 +1,6 @@ +{ + "plugins": ["topLevelAwait"], + "sourceType": "module", + "errorRecovery": false, + "throws": "Can not use keyword 'await' outside an async function (1:6)" +} diff --git a/packages/babel-parser/test/fixtures/experimental/top-level-await/inside-block/input.js b/packages/babel-parser/test/fixtures/experimental/top-level-await/inside-block/input.js new file mode 100644 index 000000000000..f264b0344b3b --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/top-level-await/inside-block/input.js @@ -0,0 +1,3 @@ +if (true) { + await 0; +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/top-level-await/inside-block/options.json b/packages/babel-parser/test/fixtures/experimental/top-level-await/inside-block/options.json new file mode 100644 index 000000000000..aadc3411ae9b --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/top-level-await/inside-block/options.json @@ -0,0 +1,4 @@ +{ + "plugins": ["topLevelAwait"], + "sourceType": "module" +} diff --git a/packages/babel-parser/test/fixtures/experimental/top-level-await/inside-block/output.json b/packages/babel-parser/test/fixtures/experimental/top-level-await/inside-block/output.json new file mode 100644 index 000000000000..120d7e5ff2f7 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/top-level-await/inside-block/output.json @@ -0,0 +1,47 @@ +{ + "type": "File", + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "program": { + "type": "Program", + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "IfStatement", + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "test": { + "type": "BooleanLiteral", + "start":4,"end":8,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":8}}, + "value": true + }, + "consequent": { + "type": "BlockStatement", + "start":10,"end":24,"loc":{"start":{"line":1,"column":10},"end":{"line":3,"column":1}}, + "body": [ + { + "type": "ExpressionStatement", + "start":14,"end":22,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":10}}, + "expression": { + "type": "AwaitExpression", + "start":14,"end":21,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":9}}, + "argument": { + "type": "NumericLiteral", + "start":20,"end":21,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":9}}, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + } + } + ], + "directives": [] + }, + "alternate": null + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/top-level-await/inside-class-property/input.js b/packages/babel-parser/test/fixtures/experimental/top-level-await/inside-class-property/input.js new file mode 100644 index 000000000000..d17e57ee1081 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/top-level-await/inside-class-property/input.js @@ -0,0 +1,3 @@ +export class C { + p = await 0; +} diff --git a/packages/babel-parser/test/fixtures/experimental/top-level-await/inside-class-property/options.json b/packages/babel-parser/test/fixtures/experimental/top-level-await/inside-class-property/options.json new file mode 100644 index 000000000000..0688c012b357 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/top-level-await/inside-class-property/options.json @@ -0,0 +1,8 @@ +{ + "plugins": [ + "topLevelAwait", + "classProperties" + ], + "sourceType": "module", + "throws": "Unexpected token, expected \";\" (2:12)" +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/top-level-await/inside-function/input.js b/packages/babel-parser/test/fixtures/experimental/top-level-await/inside-function/input.js new file mode 100644 index 000000000000..ced447b77235 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/top-level-await/inside-function/input.js @@ -0,0 +1,3 @@ +function fn() { + await 0; +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/top-level-await/inside-function/options.json b/packages/babel-parser/test/fixtures/experimental/top-level-await/inside-function/options.json new file mode 100644 index 000000000000..8eade50d15b5 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/top-level-await/inside-function/options.json @@ -0,0 +1,6 @@ +{ + "plugins": ["topLevelAwait"], + "sourceType": "module", + "errorRecovery": false, + "throws": "Can not use keyword 'await' outside an async function (2:2)" +} diff --git a/packages/babel-parser/test/fixtures/experimental/top-level-await/top-level-module/input.js b/packages/babel-parser/test/fixtures/experimental/top-level-await/top-level-module/input.js new file mode 100644 index 000000000000..d8ddd6c0ad0b --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/top-level-await/top-level-module/input.js @@ -0,0 +1 @@ +await 0; \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/top-level-await/top-level-module/options.json b/packages/babel-parser/test/fixtures/experimental/top-level-await/top-level-module/options.json new file mode 100644 index 000000000000..aadc3411ae9b --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/top-level-await/top-level-module/options.json @@ -0,0 +1,4 @@ +{ + "plugins": ["topLevelAwait"], + "sourceType": "module" +} diff --git a/packages/babel-parser/test/fixtures/experimental/top-level-await/top-level-module/output.json b/packages/babel-parser/test/fixtures/experimental/top-level-await/top-level-module/output.json new file mode 100644 index 000000000000..b528894be6db --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/top-level-await/top-level-module/output.json @@ -0,0 +1,30 @@ +{ + "type": "File", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "program": { + "type": "Program", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "expression": { + "type": "AwaitExpression", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "argument": { + "type": "NumericLiteral", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7}}, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/top-level-await/top-level-script/input.js b/packages/babel-parser/test/fixtures/experimental/top-level-await/top-level-script/input.js new file mode 100644 index 000000000000..d8ddd6c0ad0b --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/top-level-await/top-level-script/input.js @@ -0,0 +1 @@ +await 0; \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/top-level-await/top-level-script/options.json b/packages/babel-parser/test/fixtures/experimental/top-level-await/top-level-script/options.json new file mode 100644 index 000000000000..c9dc6113fea3 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/top-level-await/top-level-script/options.json @@ -0,0 +1,5 @@ +{ + "plugins": ["topLevelAwait"], + "sourceType": "script", + "throws": "Unexpected token, expected \";\" (1:6)" +} diff --git a/packages/babel-parser/test/fixtures/experimental/top-level-await/unambiguous-ambiguous-allowAwaitOutsideFunction/input.js b/packages/babel-parser/test/fixtures/experimental/top-level-await/unambiguous-ambiguous-allowAwaitOutsideFunction/input.js new file mode 100644 index 000000000000..1fa05e429c67 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/top-level-await/unambiguous-ambiguous-allowAwaitOutsideFunction/input.js @@ -0,0 +1,7 @@ +await 0 + +await + 0 +await - 0 +await ( 0 ) +await [ 0 ] +await / 0 /u diff --git a/packages/babel-parser/test/fixtures/experimental/top-level-await/unambiguous-ambiguous-allowAwaitOutsideFunction/options.json b/packages/babel-parser/test/fixtures/experimental/top-level-await/unambiguous-ambiguous-allowAwaitOutsideFunction/options.json new file mode 100644 index 000000000000..aceca10c3d74 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/top-level-await/unambiguous-ambiguous-allowAwaitOutsideFunction/options.json @@ -0,0 +1,5 @@ +{ + "plugins": ["topLevelAwait"], + "sourceType": "unambiguous", + "allowAwaitOutsideFunction": true +} diff --git a/packages/babel-parser/test/fixtures/experimental/top-level-await/unambiguous-ambiguous-allowAwaitOutsideFunction/output.json b/packages/babel-parser/test/fixtures/experimental/top-level-await/unambiguous-ambiguous-allowAwaitOutsideFunction/output.json new file mode 100644 index 000000000000..73871157f8a9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/top-level-await/unambiguous-ambiguous-allowAwaitOutsideFunction/output.json @@ -0,0 +1,135 @@ +{ + "type": "File", + "start":0,"end":65,"loc":{"start":{"line":1,"column":0},"end":{"line":7,"column":12}}, + "program": { + "type": "Program", + "start":0,"end":65,"loc":{"start":{"line":1,"column":0},"end":{"line":7,"column":12}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "expression": { + "type": "AwaitExpression", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "argument": { + "type": "NumericLiteral", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7}}, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + } + }, + { + "type": "ExpressionStatement", + "start":9,"end":18,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":9}}, + "expression": { + "type": "AwaitExpression", + "start":9,"end":18,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":9}}, + "argument": { + "type": "UnaryExpression", + "start":15,"end":18,"loc":{"start":{"line":3,"column":6},"end":{"line":3,"column":9}}, + "operator": "+", + "prefix": true, + "argument": { + "type": "NumericLiteral", + "start":17,"end":18,"loc":{"start":{"line":3,"column":8},"end":{"line":3,"column":9}}, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + } + } + }, + { + "type": "ExpressionStatement", + "start":19,"end":28,"loc":{"start":{"line":4,"column":0},"end":{"line":4,"column":9}}, + "expression": { + "type": "AwaitExpression", + "start":19,"end":28,"loc":{"start":{"line":4,"column":0},"end":{"line":4,"column":9}}, + "argument": { + "type": "UnaryExpression", + "start":25,"end":28,"loc":{"start":{"line":4,"column":6},"end":{"line":4,"column":9}}, + "operator": "-", + "prefix": true, + "argument": { + "type": "NumericLiteral", + "start":27,"end":28,"loc":{"start":{"line":4,"column":8},"end":{"line":4,"column":9}}, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + } + } + }, + { + "type": "ExpressionStatement", + "start":29,"end":40,"loc":{"start":{"line":5,"column":0},"end":{"line":5,"column":11}}, + "expression": { + "type": "AwaitExpression", + "start":29,"end":40,"loc":{"start":{"line":5,"column":0},"end":{"line":5,"column":11}}, + "argument": { + "type": "NumericLiteral", + "start":37,"end":38,"loc":{"start":{"line":5,"column":8},"end":{"line":5,"column":9}}, + "extra": { + "rawValue": 0, + "raw": "0", + "parenthesized": true, + "parenStart": 35 + }, + "value": 0 + } + } + }, + { + "type": "ExpressionStatement", + "start":41,"end":52,"loc":{"start":{"line":6,"column":0},"end":{"line":6,"column":11}}, + "expression": { + "type": "AwaitExpression", + "start":41,"end":52,"loc":{"start":{"line":6,"column":0},"end":{"line":6,"column":11}}, + "argument": { + "type": "ArrayExpression", + "start":47,"end":52,"loc":{"start":{"line":6,"column":6},"end":{"line":6,"column":11}}, + "elements": [ + { + "type": "NumericLiteral", + "start":49,"end":50,"loc":{"start":{"line":6,"column":8},"end":{"line":6,"column":9}}, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ] + } + } + }, + { + "type": "ExpressionStatement", + "start":53,"end":65,"loc":{"start":{"line":7,"column":0},"end":{"line":7,"column":12}}, + "expression": { + "type": "AwaitExpression", + "start":53,"end":65,"loc":{"start":{"line":7,"column":0},"end":{"line":7,"column":12}}, + "argument": { + "type": "RegExpLiteral", + "start":59,"end":65,"loc":{"start":{"line":7,"column":6},"end":{"line":7,"column":12}}, + "extra": { + "raw": "/ 0 /u" + }, + "pattern": " 0 ", + "flags": "u" + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/top-level-await/unambiguous-ambiguous-modulo/input.js b/packages/babel-parser/test/fixtures/experimental/top-level-await/unambiguous-ambiguous-modulo/input.js new file mode 100644 index 000000000000..735a0162b362 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/top-level-await/unambiguous-ambiguous-modulo/input.js @@ -0,0 +1 @@ +await %x(0) \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/top-level-await/unambiguous-ambiguous-modulo/options.json b/packages/babel-parser/test/fixtures/experimental/top-level-await/unambiguous-ambiguous-modulo/options.json new file mode 100644 index 000000000000..2503b82adf74 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/top-level-await/unambiguous-ambiguous-modulo/options.json @@ -0,0 +1,4 @@ +{ + "plugins": ["topLevelAwait"], + "sourceType": "unambiguous" +} diff --git a/packages/babel-parser/test/fixtures/experimental/top-level-await/unambiguous-ambiguous-modulo/output.json b/packages/babel-parser/test/fixtures/experimental/top-level-await/unambiguous-ambiguous-modulo/output.json new file mode 100644 index 000000000000..65c37bcdecac --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/top-level-await/unambiguous-ambiguous-modulo/output.json @@ -0,0 +1,47 @@ +{ + "type": "File", + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "program": { + "type": "Program", + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "expression": { + "type": "BinaryExpression", + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "left": { + "type": "Identifier", + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5},"identifierName":"await"}, + "name": "await" + }, + "operator": "%", + "right": { + "type": "CallExpression", + "start":7,"end":11,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":11}}, + "callee": { + "type": "Identifier", + "start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8},"identifierName":"x"}, + "name": "x" + }, + "arguments": [ + { + "type": "NumericLiteral", + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10}}, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ] + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/top-level-await/unambiguous-ambiguous-script/input.js b/packages/babel-parser/test/fixtures/experimental/top-level-await/unambiguous-ambiguous-script/input.js new file mode 100644 index 000000000000..9fac4af0f0aa --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/top-level-await/unambiguous-ambiguous-script/input.js @@ -0,0 +1,8 @@ +await +0 + +await + 0 +await - 0 +await ( 0 ) +await [ 0 ] +await / 0 /u diff --git a/packages/babel-parser/test/fixtures/experimental/top-level-await/unambiguous-ambiguous-script/options.json b/packages/babel-parser/test/fixtures/experimental/top-level-await/unambiguous-ambiguous-script/options.json new file mode 100644 index 000000000000..2503b82adf74 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/top-level-await/unambiguous-ambiguous-script/options.json @@ -0,0 +1,4 @@ +{ + "plugins": ["topLevelAwait"], + "sourceType": "unambiguous" +} diff --git a/packages/babel-parser/test/fixtures/experimental/top-level-await/unambiguous-ambiguous-script/output.json b/packages/babel-parser/test/fixtures/experimental/top-level-await/unambiguous-ambiguous-script/output.json new file mode 100644 index 000000000000..0ade27b47bbe --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/top-level-await/unambiguous-ambiguous-script/output.json @@ -0,0 +1,161 @@ +{ + "type": "File", + "start":0,"end":65,"loc":{"start":{"line":1,"column":0},"end":{"line":8,"column":12}}, + "program": { + "type": "Program", + "start":0,"end":65,"loc":{"start":{"line":1,"column":0},"end":{"line":8,"column":12}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, + "expression": { + "type": "Identifier", + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5},"identifierName":"await"}, + "name": "await" + } + }, + { + "type": "ExpressionStatement", + "start":6,"end":7,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":1}}, + "expression": { + "type": "NumericLiteral", + "start":6,"end":7,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":1}}, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + }, + { + "type": "ExpressionStatement", + "start":9,"end":18,"loc":{"start":{"line":4,"column":0},"end":{"line":4,"column":9}}, + "expression": { + "type": "BinaryExpression", + "start":9,"end":18,"loc":{"start":{"line":4,"column":0},"end":{"line":4,"column":9}}, + "left": { + "type": "Identifier", + "start":9,"end":14,"loc":{"start":{"line":4,"column":0},"end":{"line":4,"column":5},"identifierName":"await"}, + "name": "await" + }, + "operator": "+", + "right": { + "type": "NumericLiteral", + "start":17,"end":18,"loc":{"start":{"line":4,"column":8},"end":{"line":4,"column":9}}, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + } + }, + { + "type": "ExpressionStatement", + "start":19,"end":28,"loc":{"start":{"line":5,"column":0},"end":{"line":5,"column":9}}, + "expression": { + "type": "BinaryExpression", + "start":19,"end":28,"loc":{"start":{"line":5,"column":0},"end":{"line":5,"column":9}}, + "left": { + "type": "Identifier", + "start":19,"end":24,"loc":{"start":{"line":5,"column":0},"end":{"line":5,"column":5},"identifierName":"await"}, + "name": "await" + }, + "operator": "-", + "right": { + "type": "NumericLiteral", + "start":27,"end":28,"loc":{"start":{"line":5,"column":8},"end":{"line":5,"column":9}}, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + } + }, + { + "type": "ExpressionStatement", + "start":29,"end":40,"loc":{"start":{"line":6,"column":0},"end":{"line":6,"column":11}}, + "expression": { + "type": "CallExpression", + "start":29,"end":40,"loc":{"start":{"line":6,"column":0},"end":{"line":6,"column":11}}, + "callee": { + "type": "Identifier", + "start":29,"end":34,"loc":{"start":{"line":6,"column":0},"end":{"line":6,"column":5},"identifierName":"await"}, + "name": "await" + }, + "arguments": [ + { + "type": "NumericLiteral", + "start":37,"end":38,"loc":{"start":{"line":6,"column":8},"end":{"line":6,"column":9}}, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ] + } + }, + { + "type": "ExpressionStatement", + "start":41,"end":52,"loc":{"start":{"line":7,"column":0},"end":{"line":7,"column":11}}, + "expression": { + "type": "MemberExpression", + "start":41,"end":52,"loc":{"start":{"line":7,"column":0},"end":{"line":7,"column":11}}, + "object": { + "type": "Identifier", + "start":41,"end":46,"loc":{"start":{"line":7,"column":0},"end":{"line":7,"column":5},"identifierName":"await"}, + "name": "await" + }, + "property": { + "type": "NumericLiteral", + "start":49,"end":50,"loc":{"start":{"line":7,"column":8},"end":{"line":7,"column":9}}, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + }, + "computed": true + } + }, + { + "type": "ExpressionStatement", + "start":53,"end":65,"loc":{"start":{"line":8,"column":0},"end":{"line":8,"column":12}}, + "expression": { + "type": "BinaryExpression", + "start":53,"end":65,"loc":{"start":{"line":8,"column":0},"end":{"line":8,"column":12}}, + "left": { + "type": "BinaryExpression", + "start":53,"end":62,"loc":{"start":{"line":8,"column":0},"end":{"line":8,"column":9}}, + "left": { + "type": "Identifier", + "start":53,"end":58,"loc":{"start":{"line":8,"column":0},"end":{"line":8,"column":5},"identifierName":"await"}, + "name": "await" + }, + "operator": "/", + "right": { + "type": "NumericLiteral", + "start":61,"end":62,"loc":{"start":{"line":8,"column":8},"end":{"line":8,"column":9}}, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + }, + "operator": "/", + "right": { + "type": "Identifier", + "start":64,"end":65,"loc":{"start":{"line":8,"column":11},"end":{"line":8,"column":12},"identifierName":"u"}, + "name": "u" + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/top-level-await/unambiguous-ambiguous-v8intrinsinc/input.js b/packages/babel-parser/test/fixtures/experimental/top-level-await/unambiguous-ambiguous-v8intrinsinc/input.js new file mode 100644 index 000000000000..735a0162b362 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/top-level-await/unambiguous-ambiguous-v8intrinsinc/input.js @@ -0,0 +1 @@ +await %x(0) \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/top-level-await/unambiguous-ambiguous-v8intrinsinc/options.json b/packages/babel-parser/test/fixtures/experimental/top-level-await/unambiguous-ambiguous-v8intrinsinc/options.json new file mode 100644 index 000000000000..6732f5f2f093 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/top-level-await/unambiguous-ambiguous-v8intrinsinc/options.json @@ -0,0 +1,4 @@ +{ + "plugins": ["topLevelAwait", "v8intrinsic"], + "sourceType": "unambiguous" +} diff --git a/packages/babel-parser/test/fixtures/experimental/top-level-await/unambiguous-ambiguous-v8intrinsinc/output.json b/packages/babel-parser/test/fixtures/experimental/top-level-await/unambiguous-ambiguous-v8intrinsinc/output.json new file mode 100644 index 000000000000..65c37bcdecac --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/top-level-await/unambiguous-ambiguous-v8intrinsinc/output.json @@ -0,0 +1,47 @@ +{ + "type": "File", + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "program": { + "type": "Program", + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "expression": { + "type": "BinaryExpression", + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "left": { + "type": "Identifier", + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5},"identifierName":"await"}, + "name": "await" + }, + "operator": "%", + "right": { + "type": "CallExpression", + "start":7,"end":11,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":11}}, + "callee": { + "type": "Identifier", + "start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8},"identifierName":"x"}, + "name": "x" + }, + "arguments": [ + { + "type": "NumericLiteral", + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10}}, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ] + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/top-level-await/unambiguous-module/input.js b/packages/babel-parser/test/fixtures/experimental/top-level-await/unambiguous-module/input.js new file mode 100644 index 000000000000..1fa05e429c67 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/top-level-await/unambiguous-module/input.js @@ -0,0 +1,7 @@ +await 0 + +await + 0 +await - 0 +await ( 0 ) +await [ 0 ] +await / 0 /u diff --git a/packages/babel-parser/test/fixtures/experimental/top-level-await/unambiguous-module/options.json b/packages/babel-parser/test/fixtures/experimental/top-level-await/unambiguous-module/options.json new file mode 100644 index 000000000000..2503b82adf74 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/top-level-await/unambiguous-module/options.json @@ -0,0 +1,4 @@ +{ + "plugins": ["topLevelAwait"], + "sourceType": "unambiguous" +} diff --git a/packages/babel-parser/test/fixtures/experimental/top-level-await/unambiguous-module/output.json b/packages/babel-parser/test/fixtures/experimental/top-level-await/unambiguous-module/output.json new file mode 100644 index 000000000000..b1327978a1ea --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/top-level-await/unambiguous-module/output.json @@ -0,0 +1,135 @@ +{ + "type": "File", + "start":0,"end":65,"loc":{"start":{"line":1,"column":0},"end":{"line":7,"column":12}}, + "program": { + "type": "Program", + "start":0,"end":65,"loc":{"start":{"line":1,"column":0},"end":{"line":7,"column":12}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "expression": { + "type": "AwaitExpression", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "argument": { + "type": "NumericLiteral", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7}}, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + } + }, + { + "type": "ExpressionStatement", + "start":9,"end":18,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":9}}, + "expression": { + "type": "AwaitExpression", + "start":9,"end":18,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":9}}, + "argument": { + "type": "UnaryExpression", + "start":15,"end":18,"loc":{"start":{"line":3,"column":6},"end":{"line":3,"column":9}}, + "operator": "+", + "prefix": true, + "argument": { + "type": "NumericLiteral", + "start":17,"end":18,"loc":{"start":{"line":3,"column":8},"end":{"line":3,"column":9}}, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + } + } + }, + { + "type": "ExpressionStatement", + "start":19,"end":28,"loc":{"start":{"line":4,"column":0},"end":{"line":4,"column":9}}, + "expression": { + "type": "AwaitExpression", + "start":19,"end":28,"loc":{"start":{"line":4,"column":0},"end":{"line":4,"column":9}}, + "argument": { + "type": "UnaryExpression", + "start":25,"end":28,"loc":{"start":{"line":4,"column":6},"end":{"line":4,"column":9}}, + "operator": "-", + "prefix": true, + "argument": { + "type": "NumericLiteral", + "start":27,"end":28,"loc":{"start":{"line":4,"column":8},"end":{"line":4,"column":9}}, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + } + } + }, + { + "type": "ExpressionStatement", + "start":29,"end":40,"loc":{"start":{"line":5,"column":0},"end":{"line":5,"column":11}}, + "expression": { + "type": "AwaitExpression", + "start":29,"end":40,"loc":{"start":{"line":5,"column":0},"end":{"line":5,"column":11}}, + "argument": { + "type": "NumericLiteral", + "start":37,"end":38,"loc":{"start":{"line":5,"column":8},"end":{"line":5,"column":9}}, + "extra": { + "rawValue": 0, + "raw": "0", + "parenthesized": true, + "parenStart": 35 + }, + "value": 0 + } + } + }, + { + "type": "ExpressionStatement", + "start":41,"end":52,"loc":{"start":{"line":6,"column":0},"end":{"line":6,"column":11}}, + "expression": { + "type": "AwaitExpression", + "start":41,"end":52,"loc":{"start":{"line":6,"column":0},"end":{"line":6,"column":11}}, + "argument": { + "type": "ArrayExpression", + "start":47,"end":52,"loc":{"start":{"line":6,"column":6},"end":{"line":6,"column":11}}, + "elements": [ + { + "type": "NumericLiteral", + "start":49,"end":50,"loc":{"start":{"line":6,"column":8},"end":{"line":6,"column":9}}, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ] + } + } + }, + { + "type": "ExpressionStatement", + "start":53,"end":65,"loc":{"start":{"line":7,"column":0},"end":{"line":7,"column":12}}, + "expression": { + "type": "AwaitExpression", + "start":53,"end":65,"loc":{"start":{"line":7,"column":0},"end":{"line":7,"column":12}}, + "argument": { + "type": "RegExpLiteral", + "start":59,"end":65,"loc":{"start":{"line":7,"column":6},"end":{"line":7,"column":12}}, + "extra": { + "raw": "/ 0 /u" + }, + "pattern": " 0 ", + "flags": "u" + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/uncategorised/40/output.json b/packages/babel-parser/test/fixtures/experimental/uncategorised/40/output.json index 5ac37407684c..447e720d0d28 100644 --- a/packages/babel-parser/test/fixtures/experimental/uncategorised/40/output.json +++ b/packages/babel-parser/test/fixtures/experimental/uncategorised/40/output.json @@ -1,196 +1,60 @@ { "type": "File", - "start": 0, - "end": 43, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 43 - } - }, + "start":0,"end":43,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":43}}, "program": { "type": "Program", - "start": 0, - "end": 43, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 43 - } - }, + "start":0,"end":43,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":43}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 43, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 43 - } - }, + "start":0,"end":43,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":43}}, "decorators": [ { "type": "Decorator", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - }, + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, "expression": { "type": "Identifier", - "start": 1, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 4 - }, - "identifierName": "bar" - }, + "start":1,"end":4,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":4},"identifierName":"bar"}, "name": "bar" } } ], "id": { "type": "Identifier", - "start": 11, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 14 - }, - "identifierName": "Foo" - }, + "start":11,"end":14,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":14},"identifierName":"Foo"}, "name": "Foo" }, "superClass": { "type": "ClassExpression", - "start": 23, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 40 - } - }, + "start":23,"end":40,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":40}}, "decorators": [ { "type": "Decorator", - "start": 23, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":23,"end":27,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":27}}, "expression": { "type": "Identifier", - "start": 24, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 27 - }, - "identifierName": "foo" - }, + "start":24,"end":27,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":27},"identifierName":"foo"}, "name": "foo" } } ], "id": { "type": "Identifier", - "start": 34, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 34 - }, - "end": { - "line": 1, - "column": 37 - }, - "identifierName": "Bar" - }, + "start":34,"end":37,"loc":{"start":{"line":1,"column":34},"end":{"line":1,"column":37},"identifierName":"Bar"}, "name": "Bar" }, "superClass": null, "body": { "type": "ClassBody", - "start": 38, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 38 - }, - "end": { - "line": 1, - "column": 40 - } - }, + "start":38,"end":40,"loc":{"start":{"line":1,"column":38},"end":{"line":1,"column":40}}, "body": [] } }, "body": { "type": "ClassBody", - "start": 41, - "end": 43, - "loc": { - "start": { - "line": 1, - "column": 41 - }, - "end": { - "line": 1, - "column": 43 - } - }, + "start":41,"end":43,"loc":{"start":{"line":1,"column":41},"end":{"line":1,"column":43}}, "body": [] } } diff --git a/packages/babel-parser/test/fixtures/experimental/uncategorised/42/options.json b/packages/babel-parser/test/fixtures/experimental/uncategorised/42/options.json index 05a435eb995d..7f6646ea0dfc 100644 --- a/packages/babel-parser/test/fixtures/experimental/uncategorised/42/options.json +++ b/packages/babel-parser/test/fixtures/experimental/uncategorised/42/options.json @@ -1,4 +1,6 @@ { - "plugins": ["decorators-legacy"], - "throws": "You have trailing decorators with no method (1:18)" -} + "plugins": [ + "decorators-legacy" + ], + "throws": "Decorators must be attached to a class element (1:18)" +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/uncategorised/43/output.json b/packages/babel-parser/test/fixtures/experimental/uncategorised/43/output.json index 0832c75e1b67..85cdb8bc35c3 100644 --- a/packages/babel-parser/test/fixtures/experimental/uncategorised/43/output.json +++ b/packages/babel-parser/test/fixtures/experimental/uncategorised/43/output.json @@ -1,128 +1,38 @@ { "type": "File", - "start": 0, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, "program": { "type": "Program", - "start": 0, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, "id": { "type": "Identifier", - "start": 6, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "Foo" - }, + "start":6,"end":9,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":9},"identifierName":"Foo"}, "name": "Foo" }, "superClass": null, "body": { "type": "ClassBody", - "start": 10, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":10,"end":26,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":26}}, "body": [ { "type": "ClassProperty", - "start": 12, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":12,"end":24,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":24}}, "static": false, "key": { "type": "Identifier", - "start": 12, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 15 - }, - "identifierName": "foo" - }, + "start":12,"end":15,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":15},"identifierName":"foo"}, "name": "foo" }, "computed": false, "value": { "type": "StringLiteral", - "start": 18, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":18,"end":23,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":23}}, "extra": { "rawValue": "bar", "raw": "\"bar\"" diff --git a/packages/babel-parser/test/fixtures/experimental/uncategorised/44/output.json b/packages/babel-parser/test/fixtures/experimental/uncategorised/44/output.json index cf4693d78010..52faf1f98373 100644 --- a/packages/babel-parser/test/fixtures/experimental/uncategorised/44/output.json +++ b/packages/babel-parser/test/fixtures/experimental/uncategorised/44/output.json @@ -1,111 +1,32 @@ { "type": "File", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, "program": { "type": "Program", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, "id": { "type": "Identifier", - "start": 6, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "Foo" - }, + "start":6,"end":9,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":9},"identifierName":"Foo"}, "name": "Foo" }, "superClass": null, "body": { "type": "ClassBody", - "start": 10, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":10,"end":18,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":18}}, "body": [ { "type": "ClassProperty", - "start": 12, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":12,"end":16,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":16}}, "static": false, "key": { "type": "Identifier", - "start": 12, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 15 - }, - "identifierName": "foo" - }, + "start":12,"end":15,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":15},"identifierName":"foo"}, "name": "foo" }, "computed": false, diff --git a/packages/babel-parser/test/fixtures/experimental/uncategorised/45/output.json b/packages/babel-parser/test/fixtures/experimental/uncategorised/45/output.json index 151fa64ab228..9c1064e402f4 100644 --- a/packages/babel-parser/test/fixtures/experimental/uncategorised/45/output.json +++ b/packages/babel-parser/test/fixtures/experimental/uncategorised/45/output.json @@ -1,111 +1,32 @@ { "type": "File", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, "program": { "type": "Program", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, "id": { "type": "Identifier", - "start": 6, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "Foo" - }, + "start":6,"end":9,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":9},"identifierName":"Foo"}, "name": "Foo" }, "superClass": null, "body": { "type": "ClassBody", - "start": 10, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":10,"end":25,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":25}}, "body": [ { "type": "ClassProperty", - "start": 12, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":12,"end":23,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":23}}, "static": true, "key": { "type": "Identifier", - "start": 19, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 22 - }, - "identifierName": "foo" - }, + "start":19,"end":22,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":22},"identifierName":"foo"}, "name": "foo" }, "computed": false, diff --git a/packages/babel-parser/test/fixtures/experimental/uncategorised/46/output.json b/packages/babel-parser/test/fixtures/experimental/uncategorised/46/output.json index 9aba248217fb..0c47e0453e3a 100644 --- a/packages/babel-parser/test/fixtures/experimental/uncategorised/46/output.json +++ b/packages/babel-parser/test/fixtures/experimental/uncategorised/46/output.json @@ -1,128 +1,38 @@ { "type": "File", - "start": 0, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, "program": { "type": "Program", - "start": 0, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, "id": { "type": "Identifier", - "start": 6, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "Foo" - }, + "start":6,"end":9,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":9},"identifierName":"Foo"}, "name": "Foo" }, "superClass": null, "body": { "type": "ClassBody", - "start": 10, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":10,"end":33,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":33}}, "body": [ { "type": "ClassProperty", - "start": 12, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":12,"end":31,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":31}}, "static": true, "key": { "type": "Identifier", - "start": 19, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 22 - }, - "identifierName": "foo" - }, + "start":19,"end":22,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":22},"identifierName":"foo"}, "name": "foo" }, "computed": false, "value": { "type": "StringLiteral", - "start": 25, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":25,"end":30,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":30}}, "extra": { "rawValue": "bar", "raw": "\"bar\"" diff --git a/packages/babel-parser/test/fixtures/experimental/uncategorised/47/output.json b/packages/babel-parser/test/fixtures/experimental/uncategorised/47/output.json index 6f706f4594db..0157ee146fc6 100644 --- a/packages/babel-parser/test/fixtures/experimental/uncategorised/47/output.json +++ b/packages/babel-parser/test/fixtures/experimental/uncategorised/47/output.json @@ -1,125 +1,35 @@ { "type": "File", - "start": 0, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, "program": { "type": "Program", - "start": 0, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, "id": { "type": "Identifier", - "start": 6, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "Foo" - }, + "start":6,"end":9,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":9},"identifierName":"Foo"}, "name": "Foo" }, "superClass": null, "body": { "type": "ClassBody", - "start": 10, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":10,"end":31,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":31}}, "body": [ { "type": "ClassProperty", - "start": 12, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":12,"end":29,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":29}}, "decorators": [ { "type": "Decorator", - "start": 12, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":12,"end":16,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":16}}, "expression": { "type": "Identifier", - "start": 13, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 16 - }, - "identifierName": "bar" - }, + "start":13,"end":16,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":16},"identifierName":"bar"}, "name": "bar" } } @@ -127,36 +37,13 @@ "static": false, "key": { "type": "Identifier", - "start": 17, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 20 - }, - "identifierName": "foo" - }, + "start":17,"end":20,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":20},"identifierName":"foo"}, "name": "foo" }, "computed": false, "value": { "type": "StringLiteral", - "start": 23, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":23,"end":28,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":28}}, "extra": { "rawValue": "bar", "raw": "\"bar\"" diff --git a/packages/babel-parser/test/fixtures/experimental/uncategorised/48/output.json b/packages/babel-parser/test/fixtures/experimental/uncategorised/48/output.json index 44a2796b640a..aa726dbfc5fd 100644 --- a/packages/babel-parser/test/fixtures/experimental/uncategorised/48/output.json +++ b/packages/babel-parser/test/fixtures/experimental/uncategorised/48/output.json @@ -1,125 +1,35 @@ { "type": "File", - "start": 0, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":38}}, "program": { "type": "Program", - "start": 0, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":38}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":38}}, "id": { "type": "Identifier", - "start": 6, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "Foo" - }, + "start":6,"end":9,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":9},"identifierName":"Foo"}, "name": "Foo" }, "superClass": null, "body": { "type": "ClassBody", - "start": 10, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":10,"end":38,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":38}}, "body": [ { "type": "ClassProperty", - "start": 12, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":12,"end":36,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":36}}, "decorators": [ { "type": "Decorator", - "start": 12, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":12,"end":16,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":16}}, "expression": { "type": "Identifier", - "start": 13, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 16 - }, - "identifierName": "bar" - }, + "start":13,"end":16,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":16},"identifierName":"bar"}, "name": "bar" } } @@ -127,36 +37,13 @@ "static": true, "key": { "type": "Identifier", - "start": 24, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 27 - }, - "identifierName": "foo" - }, + "start":24,"end":27,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":27},"identifierName":"foo"}, "name": "foo" }, "computed": false, "value": { "type": "StringLiteral", - "start": 30, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":30,"end":35,"loc":{"start":{"line":1,"column":30},"end":{"line":1,"column":35}}, "extra": { "rawValue": "bar", "raw": "\"bar\"" diff --git a/packages/babel-parser/test/fixtures/experimental/uncategorised/49/output.json b/packages/babel-parser/test/fixtures/experimental/uncategorised/49/output.json index c1a06bff1006..0aff824b08e1 100644 --- a/packages/babel-parser/test/fixtures/experimental/uncategorised/49/output.json +++ b/packages/babel-parser/test/fixtures/experimental/uncategorised/49/output.json @@ -1,139 +1,38 @@ { "type": "File", - "start": 0, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, "program": { "type": "Program", - "start": 0, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":4,"end":29,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":29}}, "id": { "type": "Identifier", - "start": 4, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "obj" - }, + "start":4,"end":7,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":7},"identifierName":"obj"}, "name": "obj" }, "init": { "type": "ObjectExpression", - "start": 10, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":10,"end":29,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":29}}, "properties": [ { "type": "ObjectProperty", - "start": 17, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":17,"end":27,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":27}}, "decorators": [ { "type": "Decorator", - "start": 12, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":12,"end":16,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":16}}, "expression": { "type": "Identifier", - "start": 13, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 16 - }, - "identifierName": "foo" - }, + "start":13,"end":16,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":16},"identifierName":"foo"}, "name": "foo" } } @@ -141,37 +40,14 @@ "method": false, "key": { "type": "Identifier", - "start": 17, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 20 - }, - "identifierName": "bar" - }, + "start":17,"end":20,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":20},"identifierName":"bar"}, "name": "bar" }, "computed": false, "shorthand": false, "value": { "type": "StringLiteral", - "start": 22, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":22,"end":27,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":27}}, "extra": { "rawValue": "wow", "raw": "'wow'" diff --git a/packages/babel-parser/test/fixtures/experimental/uncategorised/62/output.json b/packages/babel-parser/test/fixtures/experimental/uncategorised/62/output.json index 08ee75175b9a..485ab02b5920 100644 --- a/packages/babel-parser/test/fixtures/experimental/uncategorised/62/output.json +++ b/packages/babel-parser/test/fixtures/experimental/uncategorised/62/output.json @@ -1,145 +1,44 @@ { "type": "File", - "start": 0, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":37,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":37,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":37,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "decorators": [ { "type": "Decorator", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "expression": { "type": "CallExpression", - "start": 1, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":1,"end":24,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":24}}, "callee": { "type": "Identifier", - "start": 1, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "decorate" - }, + "start":1,"end":9,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":9},"identifierName":"decorate"}, "name": "decorate" }, "arguments": [ { "type": "ArrowFunctionExpression", - "start": 10, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":10,"end":23,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":23}}, "id": null, "generator": false, "async": false, "params": [ { "type": "Identifier", - "start": 11, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 14 - }, - "identifierName": "arg" - }, + "start":11,"end":14,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":14},"identifierName":"arg"}, "name": "arg" } ], "body": { "type": "NullLiteral", - "start": 19, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 23 - } - } + "start":19,"end":23,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":23}} } } ] @@ -148,36 +47,13 @@ ], "id": { "type": "Identifier", - "start": 31, - "end": 33, - "loc": { - "start": { - "line": 2, - "column": 6 - }, - "end": { - "line": 2, - "column": 8 - }, - "identifierName": "Ex" - }, + "start":31,"end":33,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":8},"identifierName":"Ex"}, "name": "Ex" }, "superClass": null, "body": { "type": "ClassBody", - "start": 34, - "end": 37, - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":34,"end":37,"loc":{"start":{"line":2,"column":9},"end":{"line":3,"column":1}}, "body": [] } } diff --git a/packages/babel-parser/test/fixtures/flow/anonymous-function-no-parens-types/good_01/output.json b/packages/babel-parser/test/fixtures/flow/anonymous-function-no-parens-types/good_01/output.json index 6bf303dba12b..1eff0862e73d 100644 --- a/packages/babel-parser/test/fixtures/flow/anonymous-function-no-parens-types/good_01/output.json +++ b/packages/babel-parser/test/fixtures/flow/anonymous-function-no-parens-types/good_01/output.json @@ -1,129 +1,40 @@ { "type": "File", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "program": { "type": "Program", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "TypeAlias", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "id": { "type": "Identifier", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "A" - }, + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"A"}, "name": "A" }, "typeParameters": null, "right": { "type": "FunctionTypeAnnotation", - "start": 9, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":9,"end":23,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":23}}, "params": [ { "type": "FunctionTypeParam", - "start": 9, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":9,"end":18,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":18}}, "name": null, "optional": false, "typeAnnotation": { "type": "StringTypeAnnotation", - "start": 9, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 15 - } - } + "start":9,"end":15,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":15}} } } ], "rest": null, "returnType": { "type": "VoidTypeAnnotation", - "start": 19, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 23 - } - } + "start":19,"end":23,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":23}} }, "typeParameters": null } diff --git a/packages/babel-parser/test/fixtures/flow/anonymous-function-no-parens-types/good_02/output.json b/packages/babel-parser/test/fixtures/flow/anonymous-function-no-parens-types/good_02/output.json index baa5c0d9edeb..2cd1eb6e0bee 100644 --- a/packages/babel-parser/test/fixtures/flow/anonymous-function-no-parens-types/good_02/output.json +++ b/packages/babel-parser/test/fixtures/flow/anonymous-function-no-parens-types/good_02/output.json @@ -1,158 +1,46 @@ { "type": "File", - "start": 0, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, "program": { "type": "Program", - "start": 0, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "TypeAlias", - "start": 0, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, "id": { "type": "Identifier", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "A" - }, + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"A"}, "name": "A" }, "typeParameters": null, "right": { "type": "FunctionTypeAnnotation", - "start": 9, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":9,"end":30,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":30}}, "params": [ { "type": "FunctionTypeParam", - "start": 9, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":9,"end":25,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":25}}, "name": null, "optional": false, "typeAnnotation": { "type": "GenericTypeAnnotation", - "start": 9, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":9,"end":22,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":22}}, "typeParameters": { "type": "TypeParameterInstantiation", - "start": 14, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":14,"end":22,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":22}}, "params": [ { "type": "StringTypeAnnotation", - "start": 15, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 21 - } - } + "start":15,"end":21,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":21}} } ] }, "id": { "type": "Identifier", - "start": 9, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 14 - }, - "identifierName": "Array" - }, + "start":9,"end":14,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":14},"identifierName":"Array"}, "name": "Array" } } @@ -161,18 +49,7 @@ "rest": null, "returnType": { "type": "VoidTypeAnnotation", - "start": 26, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 30 - } - } + "start":26,"end":30,"loc":{"start":{"line":1,"column":26},"end":{"line":1,"column":30}} }, "typeParameters": null } diff --git a/packages/babel-parser/test/fixtures/flow/anonymous-function-no-parens-types/good_03/output.json b/packages/babel-parser/test/fixtures/flow/anonymous-function-no-parens-types/good_03/output.json index 6a9c52404e56..161049d5089b 100644 --- a/packages/babel-parser/test/fixtures/flow/anonymous-function-no-parens-types/good_03/output.json +++ b/packages/babel-parser/test/fixtures/flow/anonymous-function-no-parens-types/good_03/output.json @@ -1,123 +1,34 @@ { "type": "File", - "start": 0, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, "program": { "type": "Program", - "start": 0, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":4,"end":25,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":25}}, "id": { "type": "Identifier", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "f" - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"f"}, "name": "f" }, "init": { "type": "ArrowFunctionExpression", - "start": 8, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":8,"end":25,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":25}}, "predicate": null, "returnType": { "type": "TypeAnnotation", - "start": 10, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":10,"end":18,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":18}}, "typeAnnotation": { "type": "NumberTypeAnnotation", - "start": 12, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 18 - } - } + "start":12,"end":18,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":18}} } }, "id": null, @@ -126,18 +37,7 @@ "params": [], "body": { "type": "NumericLiteral", - "start": 22, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":22,"end":25,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":25}}, "extra": { "rawValue": 123, "raw": "123" diff --git a/packages/babel-parser/test/fixtures/flow/anonymous-function-no-parens-types/good_04/output.json b/packages/babel-parser/test/fixtures/flow/anonymous-function-no-parens-types/good_04/output.json index 85d58b0afdd4..7f3d3aa197c7 100644 --- a/packages/babel-parser/test/fixtures/flow/anonymous-function-no-parens-types/good_04/output.json +++ b/packages/babel-parser/test/fixtures/flow/anonymous-function-no-parens-types/good_04/output.json @@ -1,153 +1,42 @@ { "type": "File", - "start": 0, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":35}}, "program": { "type": "Program", - "start": 0, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":35}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":35}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":4,"end":34,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":34}}, "id": { "type": "Identifier", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "f" - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"f"}, "name": "f" }, "init": { "type": "ArrowFunctionExpression", - "start": 8, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":8,"end":34,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":34}}, "predicate": null, "returnType": { "type": "TypeAnnotation", - "start": 10, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":10,"end":27,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":27}}, "typeAnnotation": { "type": "UnionTypeAnnotation", - "start": 12, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":12,"end":27,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":27}}, "types": [ { "type": "StringTypeAnnotation", - "start": 12, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 18 - } - } + "start":12,"end":18,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":18}} }, { "type": "NumberTypeAnnotation", - "start": 21, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 27 - } - } + "start":21,"end":27,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":27}} } ] } @@ -158,18 +47,7 @@ "params": [], "body": { "type": "NumericLiteral", - "start": 31, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 31 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":31,"end":34,"loc":{"start":{"line":1,"column":31},"end":{"line":1,"column":34}}, "extra": { "rawValue": 123, "raw": "123" diff --git a/packages/babel-parser/test/fixtures/flow/anonymous-function-no-parens-types/good_05/output.json b/packages/babel-parser/test/fixtures/flow/anonymous-function-no-parens-types/good_05/output.json index 94cfa8948a17..537fb2972f3f 100644 --- a/packages/babel-parser/test/fixtures/flow/anonymous-function-no-parens-types/good_05/output.json +++ b/packages/babel-parser/test/fixtures/flow/anonymous-function-no-parens-types/good_05/output.json @@ -1,172 +1,50 @@ { "type": "File", - "start": 0, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, "program": { "type": "Program", - "start": 0, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":4,"end":35,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":35}}, "id": { "type": "Identifier", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "f" - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"f"}, "name": "f" }, "init": { "type": "ArrowFunctionExpression", - "start": 8, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":8,"end":35,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":35}}, "predicate": null, "returnType": { "type": "TypeAnnotation", - "start": 11, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":11,"end":28,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":28}}, "typeAnnotation": { "type": "FunctionTypeAnnotation", - "start": 14, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":14,"end":27,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":27}}, "params": [ { "type": "FunctionTypeParam", - "start": 14, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":14,"end":23,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":23}}, "name": null, "optional": false, "typeAnnotation": { "type": "NumberTypeAnnotation", - "start": 14, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 20 - } - } + "start":14,"end":20,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":20}} } } ], "rest": null, "returnType": { "type": "NumberLiteralTypeAnnotation", - "start": 24, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":24,"end":27,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":27}}, "extra": { "rawValue": 123, "raw": "123" @@ -182,36 +60,13 @@ "params": [ { "type": "Identifier", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - }, - "identifierName": "x" - }, + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"x"}, "name": "x" } ], "body": { "type": "NumericLiteral", - "start": 32, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 32 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":32,"end":35,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":35}}, "extra": { "rawValue": 123, "raw": "123" diff --git a/packages/babel-parser/test/fixtures/flow/anonymous-function-no-parens-types/good_06/output.json b/packages/babel-parser/test/fixtures/flow/anonymous-function-no-parens-types/good_06/output.json index 1fd25ad194c1..d2ca76ff8ba8 100644 --- a/packages/babel-parser/test/fixtures/flow/anonymous-function-no-parens-types/good_06/output.json +++ b/packages/babel-parser/test/fixtures/flow/anonymous-function-no-parens-types/good_06/output.json @@ -1,159 +1,48 @@ { "type": "File", - "start": 0, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, "program": { "type": "Program", - "start": 0, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "TypeAlias", - "start": 0, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, "id": { "type": "Identifier", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "A" - }, + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"A"}, "name": "A" }, "typeParameters": null, "right": { "type": "UnionTypeAnnotation", - "start": 9, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":9,"end":35,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":35}}, "types": [ { "type": "StringTypeAnnotation", - "start": 9, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 15 - } - } + "start":9,"end":15,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":15}} }, { "type": "FunctionTypeAnnotation", - "start": 18, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":18,"end":35,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":35}}, "params": [ { "type": "FunctionTypeParam", - "start": 18, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":18,"end":27,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":27}}, "name": null, "optional": false, "typeAnnotation": { "type": "NumberTypeAnnotation", - "start": 18, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 24 - } - } + "start":18,"end":24,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":24}} } } ], "rest": null, "returnType": { "type": "BooleanTypeAnnotation", - "start": 28, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 35 - } - } + "start":28,"end":35,"loc":{"start":{"line":1,"column":28},"end":{"line":1,"column":35}} }, "typeParameters": null } diff --git a/packages/babel-parser/test/fixtures/flow/anonymous-function-no-parens-types/good_07/output.json b/packages/babel-parser/test/fixtures/flow/anonymous-function-no-parens-types/good_07/output.json index 75b5e9b5753f..c8c0ae2b71bb 100644 --- a/packages/babel-parser/test/fixtures/flow/anonymous-function-no-parens-types/good_07/output.json +++ b/packages/babel-parser/test/fixtures/flow/anonymous-function-no-parens-types/good_07/output.json @@ -1,159 +1,48 @@ { "type": "File", - "start": 0, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, "program": { "type": "Program", - "start": 0, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "TypeAlias", - "start": 0, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, "id": { "type": "Identifier", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "A" - }, + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"A"}, "name": "A" }, "typeParameters": null, "right": { "type": "IntersectionTypeAnnotation", - "start": 9, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":9,"end":35,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":35}}, "types": [ { "type": "StringTypeAnnotation", - "start": 9, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 15 - } - } + "start":9,"end":15,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":15}} }, { "type": "FunctionTypeAnnotation", - "start": 18, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":18,"end":35,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":35}}, "params": [ { "type": "FunctionTypeParam", - "start": 18, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":18,"end":27,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":27}}, "name": null, "optional": false, "typeAnnotation": { "type": "NumberTypeAnnotation", - "start": 18, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 24 - } - } + "start":18,"end":24,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":24}} } } ], "rest": null, "returnType": { "type": "BooleanTypeAnnotation", - "start": 28, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 35 - } - } + "start":28,"end":35,"loc":{"start":{"line":1,"column":28},"end":{"line":1,"column":35}} }, "typeParameters": null } diff --git a/packages/babel-parser/test/fixtures/flow/anonymous-function-no-parens-types/good_08/output.json b/packages/babel-parser/test/fixtures/flow/anonymous-function-no-parens-types/good_08/output.json index 02531eeb8dfc..e4f2e048e2f6 100644 --- a/packages/babel-parser/test/fixtures/flow/anonymous-function-no-parens-types/good_08/output.json +++ b/packages/babel-parser/test/fixtures/flow/anonymous-function-no-parens-types/good_08/output.json @@ -1,125 +1,36 @@ { "type": "File", - "start": 0, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, "program": { "type": "Program", - "start": 0, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "TypeAlias", - "start": 0, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, "id": { "type": "Identifier", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "A" - }, + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"A"}, "name": "A" }, "typeParameters": null, "right": { "type": "FunctionTypeAnnotation", - "start": 9, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":9,"end":27,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":27}}, "params": [ { "type": "FunctionTypeParam", - "start": 9, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":9,"end":19,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":19}}, "name": null, "optional": false, "typeAnnotation": { "type": "NullableTypeAnnotation", - "start": 9, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":9,"end":16,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":16}}, "typeAnnotation": { "type": "NumberTypeAnnotation", - "start": 10, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 16 - } - } + "start":10,"end":16,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":16}} } } } @@ -127,18 +38,7 @@ "rest": null, "returnType": { "type": "BooleanTypeAnnotation", - "start": 20, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 27 - } - } + "start":20,"end":27,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":27}} }, "typeParameters": null } diff --git a/packages/babel-parser/test/fixtures/flow/anonymous-function-no-parens-types/good_09/output.json b/packages/babel-parser/test/fixtures/flow/anonymous-function-no-parens-types/good_09/output.json index ad16baa6080b..14bf5968d970 100644 --- a/packages/babel-parser/test/fixtures/flow/anonymous-function-no-parens-types/good_09/output.json +++ b/packages/babel-parser/test/fixtures/flow/anonymous-function-no-parens-types/good_09/output.json @@ -1,125 +1,36 @@ { "type": "File", - "start": 0, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, "program": { "type": "Program", - "start": 0, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "TypeAlias", - "start": 0, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, "id": { "type": "Identifier", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "A" - }, + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"A"}, "name": "A" }, "typeParameters": null, "right": { "type": "FunctionTypeAnnotation", - "start": 9, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":9,"end":28,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":28}}, "params": [ { "type": "FunctionTypeParam", - "start": 9, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":9,"end":20,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":20}}, "name": null, "optional": false, "typeAnnotation": { "type": "ArrayTypeAnnotation", - "start": 9, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":9,"end":17,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":17}}, "elementType": { "type": "NumberTypeAnnotation", - "start": 9, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 15 - } - } + "start":9,"end":15,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":15}} } } } @@ -127,18 +38,7 @@ "rest": null, "returnType": { "type": "BooleanTypeAnnotation", - "start": 21, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 28 - } - } + "start":21,"end":28,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":28}} }, "typeParameters": null } diff --git a/packages/babel-parser/test/fixtures/flow/anonymous-function-no-parens-types/good_10/output.json b/packages/babel-parser/test/fixtures/flow/anonymous-function-no-parens-types/good_10/output.json index f2854db5d736..33e95403e790 100644 --- a/packages/babel-parser/test/fixtures/flow/anonymous-function-no-parens-types/good_10/output.json +++ b/packages/babel-parser/test/fixtures/flow/anonymous-function-no-parens-types/good_10/output.json @@ -1,160 +1,49 @@ { "type": "File", - "start": 0, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":38}}, "program": { "type": "Program", - "start": 0, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":38}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "TypeAlias", - "start": 0, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":38}}, "id": { "type": "Identifier", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "A" - }, + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"A"}, "name": "A" }, "typeParameters": null, "right": { "type": "FunctionTypeAnnotation", - "start": 9, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":9,"end":38,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":38}}, "params": [ { "type": "FunctionTypeParam", - "start": 10, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":10,"end":27,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":27}}, "name": null, "optional": false, "typeAnnotation": { "type": "FunctionTypeAnnotation", - "start": 10, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":10,"end":27,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":27}}, "params": [ { "type": "FunctionTypeParam", - "start": 10, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":10,"end":19,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":19}}, "name": null, "optional": false, "typeAnnotation": { "type": "StringTypeAnnotation", - "start": 10, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 16 - } - } + "start":10,"end":16,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":16}} } } ], "rest": null, "returnType": { "type": "BooleanTypeAnnotation", - "start": 20, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 27 - } - } + "start":20,"end":27,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":27}} }, "typeParameters": null } @@ -163,18 +52,7 @@ "rest": null, "returnType": { "type": "NumberTypeAnnotation", - "start": 32, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 32 - }, - "end": { - "line": 1, - "column": 38 - } - } + "start":32,"end":38,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":38}} }, "typeParameters": null } diff --git a/packages/babel-parser/test/fixtures/flow/anonymous-function-no-parens-types/good_11/output.json b/packages/babel-parser/test/fixtures/flow/anonymous-function-no-parens-types/good_11/output.json index 6a10b7375123..67851e8ae8bf 100644 --- a/packages/babel-parser/test/fixtures/flow/anonymous-function-no-parens-types/good_11/output.json +++ b/packages/babel-parser/test/fixtures/flow/anonymous-function-no-parens-types/good_11/output.json @@ -1,159 +1,48 @@ { "type": "File", - "start": 0, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, "program": { "type": "Program", - "start": 0, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "TypeAlias", - "start": 0, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, "id": { "type": "Identifier", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "A" - }, + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"A"}, "name": "A" }, "typeParameters": null, "right": { "type": "FunctionTypeAnnotation", - "start": 9, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":9,"end":35,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":35}}, "params": [ { "type": "FunctionTypeParam", - "start": 9, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":9,"end":18,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":18}}, "name": null, "optional": false, "typeAnnotation": { "type": "StringTypeAnnotation", - "start": 9, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 15 - } - } + "start":9,"end":15,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":15}} } } ], "rest": null, "returnType": { "type": "UnionTypeAnnotation", - "start": 19, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":19,"end":35,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":35}}, "types": [ { "type": "BooleanTypeAnnotation", - "start": 19, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 26 - } - } + "start":19,"end":26,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":26}} }, { "type": "NumberTypeAnnotation", - "start": 29, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 1, - "column": 35 - } - } + "start":29,"end":35,"loc":{"start":{"line":1,"column":29},"end":{"line":1,"column":35}} } ] }, diff --git a/packages/babel-parser/test/fixtures/flow/anonymous-function-no-parens-types/good_12/output.json b/packages/babel-parser/test/fixtures/flow/anonymous-function-no-parens-types/good_12/output.json index ac37720b4657..c65fd54ac5d7 100644 --- a/packages/babel-parser/test/fixtures/flow/anonymous-function-no-parens-types/good_12/output.json +++ b/packages/babel-parser/test/fixtures/flow/anonymous-function-no-parens-types/good_12/output.json @@ -1,178 +1,56 @@ { "type": "File", - "start": 0, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 37 - } - }, + "start":0,"end":37,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":37}}, "program": { "type": "Program", - "start": 0, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 37 - } - }, + "start":0,"end":37,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":37}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "TypeAlias", - "start": 0, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 37 - } - }, + "start":0,"end":37,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":37}}, "id": { "type": "Identifier", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "A" - }, + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"A"}, "name": "A" }, "typeParameters": null, "right": { "type": "FunctionTypeAnnotation", - "start": 9, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":9,"end":36,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":36}}, "params": [ { "type": "FunctionTypeParam", - "start": 9, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":9,"end":18,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":18}}, "name": null, "optional": false, "typeAnnotation": { "type": "StringTypeAnnotation", - "start": 9, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 15 - } - } + "start":9,"end":15,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":15}} } } ], "rest": null, "returnType": { "type": "FunctionTypeAnnotation", - "start": 19, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":19,"end":36,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":36}}, "params": [ { "type": "FunctionTypeParam", - "start": 19, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":19,"end":29,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":29}}, "name": null, "optional": false, "typeAnnotation": { "type": "BooleanTypeAnnotation", - "start": 19, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 26 - } - } + "start":19,"end":26,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":26}} } } ], "rest": null, "returnType": { "type": "NumberTypeAnnotation", - "start": 30, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 1, - "column": 36 - } - } + "start":30,"end":36,"loc":{"start":{"line":1,"column":30},"end":{"line":1,"column":36}} }, "typeParameters": null }, diff --git a/packages/babel-parser/test/fixtures/flow/anonymous-function-no-parens-types/good_13/output.json b/packages/babel-parser/test/fixtures/flow/anonymous-function-no-parens-types/good_13/output.json index ffad33b3ba48..3208d4b4bd66 100644 --- a/packages/babel-parser/test/fixtures/flow/anonymous-function-no-parens-types/good_13/output.json +++ b/packages/babel-parser/test/fixtures/flow/anonymous-function-no-parens-types/good_13/output.json @@ -1,123 +1,34 @@ { "type": "File", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, "program": { "type": "Program", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, "declarations": [ { "type": "VariableDeclarator", - "start": 6, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":6,"end":18,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":18}}, "id": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "x" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"x"}, "name": "x" }, "init": { "type": "ArrowFunctionExpression", - "start": 10, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":10,"end":18,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":18}}, "predicate": null, "returnType": { "type": "TypeAnnotation", - "start": 12, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":12,"end":14,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":14}}, "typeAnnotation": { "type": "ExistsTypeAnnotation", - "start": 13, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - } - } + "start":13,"end":14,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":14}} } }, "id": null, @@ -126,18 +37,7 @@ "params": [], "body": { "type": "BlockStatement", - "start": 16, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":16,"end":18,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":18}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/flow/anonymous-function-no-parens-types/good_14/output.json b/packages/babel-parser/test/fixtures/flow/anonymous-function-no-parens-types/good_14/output.json index 3b566aaa7fc0..eadc2d985387 100644 --- a/packages/babel-parser/test/fixtures/flow/anonymous-function-no-parens-types/good_14/output.json +++ b/packages/babel-parser/test/fixtures/flow/anonymous-function-no-parens-types/good_14/output.json @@ -1,158 +1,47 @@ { "type": "File", - "start": 0, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, "program": { "type": "Program", - "start": 0, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "TypeAlias", - "start": 0, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, "id": { "type": "Identifier", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "T" - }, + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"T"}, "name": "T" }, "typeParameters": null, "right": { "type": "GenericTypeAnnotation", - "start": 9, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":9,"end":34,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":34}}, "typeParameters": { "type": "TypeParameterInstantiation", - "start": 14, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":14,"end":34,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":34}}, "params": [ { "type": "FunctionTypeAnnotation", - "start": 15, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":15,"end":33,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":33}}, "params": [ { "type": "FunctionTypeParam", - "start": 16, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":16,"end":22,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":22}}, "name": null, "optional": false, "typeAnnotation": { "type": "StringTypeAnnotation", - "start": 16, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 22 - } - } + "start":16,"end":22,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":22}} } } ], "rest": null, "returnType": { "type": "NumberTypeAnnotation", - "start": 27, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 33 - } - } + "start":27,"end":33,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":33}} }, "typeParameters": null } @@ -160,19 +49,7 @@ }, "id": { "type": "Identifier", - "start": 9, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 14 - }, - "identifierName": "Array" - }, + "start":9,"end":14,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":14},"identifierName":"Array"}, "name": "Array" } } diff --git a/packages/babel-parser/test/fixtures/flow/anonymous-function-no-parens-types/good_15/output.json b/packages/babel-parser/test/fixtures/flow/anonymous-function-no-parens-types/good_15/output.json index fb3eb337bc92..64a149197c0c 100644 --- a/packages/babel-parser/test/fixtures/flow/anonymous-function-no-parens-types/good_15/output.json +++ b/packages/babel-parser/test/fixtures/flow/anonymous-function-no-parens-types/good_15/output.json @@ -1,201 +1,57 @@ { "type": "File", - "start": 0, - "end": 43, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 43 - } - }, + "start":0,"end":43,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":43}}, "program": { "type": "Program", - "start": 0, - "end": 43, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 43 - } - }, + "start":0,"end":43,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":43}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 43, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 43 - } - }, + "start":0,"end":43,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":43}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 43, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 43 - } - }, + "start":4,"end":43,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":43}}, "id": { "type": "Identifier", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "x" - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"x"}, "name": "x" }, "init": { "type": "ArrowFunctionExpression", - "start": 8, - "end": 43, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 43 - } - }, + "start":8,"end":43,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":43}}, "predicate": null, "returnType": { "type": "TypeAnnotation", - "start": 10, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 37 - } - }, + "start":10,"end":37,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":37}}, "typeAnnotation": { "type": "GenericTypeAnnotation", - "start": 12, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 37 - } - }, + "start":12,"end":37,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":37}}, "typeParameters": { "type": "TypeParameterInstantiation", - "start": 17, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 37 - } - }, + "start":17,"end":37,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":37}}, "params": [ { "type": "FunctionTypeAnnotation", - "start": 18, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":18,"end":36,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":36}}, "params": [ { "type": "FunctionTypeParam", - "start": 19, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":19,"end":25,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":25}}, "name": null, "optional": false, "typeAnnotation": { "type": "StringTypeAnnotation", - "start": 19, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 25 - } - } + "start":19,"end":25,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":25}} } } ], "rest": null, "returnType": { "type": "NumberTypeAnnotation", - "start": 30, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 1, - "column": 36 - } - } + "start":30,"end":36,"loc":{"start":{"line":1,"column":30},"end":{"line":1,"column":36}} }, "typeParameters": null } @@ -203,19 +59,7 @@ }, "id": { "type": "Identifier", - "start": 12, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 17 - }, - "identifierName": "Array" - }, + "start":12,"end":17,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":17},"identifierName":"Array"}, "name": "Array" } } @@ -226,18 +70,7 @@ "params": [], "body": { "type": "ArrayExpression", - "start": 41, - "end": 43, - "loc": { - "start": { - "line": 1, - "column": 41 - }, - "end": { - "line": 1, - "column": 43 - } - }, + "start":41,"end":43,"loc":{"start":{"line":1,"column":41},"end":{"line":1,"column":43}}, "elements": [] } } diff --git a/packages/babel-parser/test/fixtures/flow/anonymous-function-types/good_01/output.json b/packages/babel-parser/test/fixtures/flow/anonymous-function-types/good_01/output.json index ec0bc381be4e..00814ac01665 100644 --- a/packages/babel-parser/test/fixtures/flow/anonymous-function-types/good_01/output.json +++ b/packages/babel-parser/test/fixtures/flow/anonymous-function-types/good_01/output.json @@ -1,190 +1,56 @@ { "type": "File", - "start": 0, - "end": 46, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 46 - } - }, + "start":0,"end":46,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":46}}, "program": { "type": "Program", - "start": 0, - "end": 46, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 46 - } - }, + "start":0,"end":46,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":46}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "DeclareFunction", - "start": 0, - "end": 46, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 46 - } - }, + "start":0,"end":46,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":46}}, "id": { "type": "Identifier", - "start": 17, - "end": 45, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 45 - }, - "identifierName": "foo" - }, + "start":17,"end":45,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":45},"identifierName":"foo"}, "name": "foo", "typeAnnotation": { "type": "TypeAnnotation", - "start": 20, - "end": 45, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 45 - } - }, + "start":20,"end":45,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":45}}, "typeAnnotation": { "type": "FunctionTypeAnnotation", - "start": 20, - "end": 45, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 45 - } - }, + "start":20,"end":45,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":45}}, "typeParameters": null, "params": [ { "type": "FunctionTypeParam", - "start": 21, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":21,"end":30,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":30}}, "name": { "type": "Identifier", - "start": 21, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 22 - }, - "identifierName": "x" - }, + "start":21,"end":22,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":22},"identifierName":"x"}, "name": "x" }, "optional": false, "typeAnnotation": { "type": "NumberTypeAnnotation", - "start": 24, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 30 - } - } + "start":24,"end":30,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":30}} } }, { "type": "FunctionTypeParam", - "start": 32, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 32 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":32,"end":38,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":38}}, "name": null, "optional": false, "typeAnnotation": { "type": "StringTypeAnnotation", - "start": 32, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 32 - }, - "end": { - "line": 1, - "column": 38 - } - } + "start":32,"end":38,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":38}} } } ], "rest": null, "returnType": { "type": "VoidTypeAnnotation", - "start": 41, - "end": 45, - "loc": { - "start": { - "line": 1, - "column": 41 - }, - "end": { - "line": 1, - "column": 45 - } - } + "start":41,"end":45,"loc":{"start":{"line":1,"column":41},"end":{"line":1,"column":45}} } } } diff --git a/packages/babel-parser/test/fixtures/flow/anonymous-function-types/good_02/output.json b/packages/babel-parser/test/fixtures/flow/anonymous-function-types/good_02/output.json index d5ffb4336861..73deb674b780 100644 --- a/packages/babel-parser/test/fixtures/flow/anonymous-function-types/good_02/output.json +++ b/packages/babel-parser/test/fixtures/flow/anonymous-function-types/good_02/output.json @@ -1,31 +1,9 @@ { "type": "File", - "start": 0, - "end": 87, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 56 - } - }, + "start":0,"end":87,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":56}}, "program": { "type": "Program", - "start": 0, - "end": 87, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 56 - } - }, + "start":0,"end":87,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":56}}, "sourceType": "module", "interpreter": null, "body": [], @@ -34,34 +12,12 @@ { "type": "CommentLine", "value": " TODO: declare export syntax", - "start": 0, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 30 - } - } + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}} }, { "type": "CommentLine", "value": " declare export function foo(x: number, string): void;", - "start": 31, - "end": 87, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 56 - } - } + "start":31,"end":87,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":56}} } ] }, @@ -69,34 +25,12 @@ { "type": "CommentLine", "value": " TODO: declare export syntax", - "start": 0, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 30 - } - } + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}} }, { "type": "CommentLine", "value": " declare export function foo(x: number, string): void;", - "start": 31, - "end": 87, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 56 - } - } + "start":31,"end":87,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":56}} } ] } \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/anonymous-function-types/good_03/output.json b/packages/babel-parser/test/fixtures/flow/anonymous-function-types/good_03/output.json index bbd6090ffe06..8dcd1b0be60d 100644 --- a/packages/babel-parser/test/fixtures/flow/anonymous-function-types/good_03/output.json +++ b/packages/babel-parser/test/fixtures/flow/anonymous-function-types/good_03/output.json @@ -1,129 +1,40 @@ { "type": "File", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, "program": { "type": "Program", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "TypeAlias", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, "id": { "type": "Identifier", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "A" - }, + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"A"}, "name": "A" }, "typeParameters": null, "right": { "type": "FunctionTypeAnnotation", - "start": 9, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":9,"end":25,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":25}}, "params": [ { "type": "FunctionTypeParam", - "start": 10, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":10,"end":16,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":16}}, "name": null, "optional": false, "typeAnnotation": { "type": "StringTypeAnnotation", - "start": 10, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 16 - } - } + "start":10,"end":16,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":16}} } } ], "rest": null, "returnType": { "type": "VoidTypeAnnotation", - "start": 21, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 25 - } - } + "start":21,"end":25,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":25}} }, "typeParameters": null } diff --git a/packages/babel-parser/test/fixtures/flow/anonymous-function-types/good_04/output.json b/packages/babel-parser/test/fixtures/flow/anonymous-function-types/good_04/output.json index 733388df4240..5dc10956fa1f 100644 --- a/packages/babel-parser/test/fixtures/flow/anonymous-function-types/good_04/output.json +++ b/packages/babel-parser/test/fixtures/flow/anonymous-function-types/good_04/output.json @@ -1,129 +1,40 @@ { "type": "File", - "start": 0, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, "program": { "type": "Program", - "start": 0, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "TypeAlias", - "start": 0, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, "id": { "type": "Identifier", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "A" - }, + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"A"}, "name": "A" }, "typeParameters": null, "right": { "type": "FunctionTypeAnnotation", - "start": 9, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":9,"end":26,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":26}}, "params": [ { "type": "FunctionTypeParam", - "start": 10, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":10,"end":17,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":17}}, "name": null, "optional": false, "typeAnnotation": { "type": "StringTypeAnnotation", - "start": 10, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 16 - } - } + "start":10,"end":16,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":16}} } } ], "rest": null, "returnType": { "type": "VoidTypeAnnotation", - "start": 22, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 26 - } - } + "start":22,"end":26,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":26}} }, "typeParameters": null } diff --git a/packages/babel-parser/test/fixtures/flow/anonymous-function-types/good_05/output.json b/packages/babel-parser/test/fixtures/flow/anonymous-function-types/good_05/output.json index 7c4cd7881b85..0125e6307fa9 100644 --- a/packages/babel-parser/test/fixtures/flow/anonymous-function-types/good_05/output.json +++ b/packages/babel-parser/test/fixtures/flow/anonymous-function-types/good_05/output.json @@ -1,158 +1,46 @@ { "type": "File", - "start": 0, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, "program": { "type": "Program", - "start": 0, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "TypeAlias", - "start": 0, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, "id": { "type": "Identifier", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "A" - }, + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"A"}, "name": "A" }, "typeParameters": null, "right": { "type": "FunctionTypeAnnotation", - "start": 9, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":9,"end":32,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":32}}, "params": [ { "type": "FunctionTypeParam", - "start": 10, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":10,"end":23,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":23}}, "name": null, "optional": false, "typeAnnotation": { "type": "GenericTypeAnnotation", - "start": 10, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":10,"end":23,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":23}}, "typeParameters": { "type": "TypeParameterInstantiation", - "start": 15, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":15,"end":23,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":23}}, "params": [ { "type": "StringTypeAnnotation", - "start": 16, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 22 - } - } + "start":16,"end":22,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":22}} } ] }, "id": { "type": "Identifier", - "start": 10, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 15 - }, - "identifierName": "Array" - }, + "start":10,"end":15,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":15},"identifierName":"Array"}, "name": "Array" } } @@ -161,18 +49,7 @@ "rest": null, "returnType": { "type": "VoidTypeAnnotation", - "start": 28, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 32 - } - } + "start":28,"end":32,"loc":{"start":{"line":1,"column":28},"end":{"line":1,"column":32}} }, "typeParameters": null } diff --git a/packages/babel-parser/test/fixtures/flow/anonymous-function-types/good_06/output.json b/packages/babel-parser/test/fixtures/flow/anonymous-function-types/good_06/output.json index dbf419ea9cc0..c8e969c81806 100644 --- a/packages/babel-parser/test/fixtures/flow/anonymous-function-types/good_06/output.json +++ b/packages/babel-parser/test/fixtures/flow/anonymous-function-types/good_06/output.json @@ -1,158 +1,46 @@ { "type": "File", - "start": 0, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, "program": { "type": "Program", - "start": 0, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "TypeAlias", - "start": 0, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, "id": { "type": "Identifier", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "A" - }, + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"A"}, "name": "A" }, "typeParameters": null, "right": { "type": "FunctionTypeAnnotation", - "start": 9, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":9,"end":33,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":33}}, "params": [ { "type": "FunctionTypeParam", - "start": 10, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":10,"end":24,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":24}}, "name": null, "optional": false, "typeAnnotation": { "type": "GenericTypeAnnotation", - "start": 10, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":10,"end":23,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":23}}, "typeParameters": { "type": "TypeParameterInstantiation", - "start": 15, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":15,"end":23,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":23}}, "params": [ { "type": "StringTypeAnnotation", - "start": 16, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 22 - } - } + "start":16,"end":22,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":22}} } ] }, "id": { "type": "Identifier", - "start": 10, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 15 - }, - "identifierName": "Array" - }, + "start":10,"end":15,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":15},"identifierName":"Array"}, "name": "Array" } } @@ -161,18 +49,7 @@ "rest": null, "returnType": { "type": "VoidTypeAnnotation", - "start": 29, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 1, - "column": 33 - } - } + "start":29,"end":33,"loc":{"start":{"line":1,"column":29},"end":{"line":1,"column":33}} }, "typeParameters": null } diff --git a/packages/babel-parser/test/fixtures/flow/anonymous-function-types/good_07/output.json b/packages/babel-parser/test/fixtures/flow/anonymous-function-types/good_07/output.json index 1402c8ad8eb2..9441e11a5d82 100644 --- a/packages/babel-parser/test/fixtures/flow/anonymous-function-types/good_07/output.json +++ b/packages/babel-parser/test/fixtures/flow/anonymous-function-types/good_07/output.json @@ -1,177 +1,54 @@ { "type": "File", - "start": 0, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, "program": { "type": "Program", - "start": 0, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "TypeAlias", - "start": 0, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, "id": { "type": "Identifier", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "A" - }, + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"A"}, "name": "A" }, "typeParameters": null, "right": { "type": "FunctionTypeAnnotation", - "start": 9, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":9,"end":36,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":36}}, "params": [ { "type": "FunctionTypeParam", - "start": 10, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":10,"end":19,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":19}}, "name": { "type": "Identifier", - "start": 10, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "x" - }, + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11},"identifierName":"x"}, "name": "x" }, "optional": false, "typeAnnotation": { "type": "StringTypeAnnotation", - "start": 13, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 19 - } - } + "start":13,"end":19,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":19}} } }, { "type": "FunctionTypeParam", - "start": 21, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":21,"end":27,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":27}}, "name": null, "optional": false, "typeAnnotation": { "type": "NumberTypeAnnotation", - "start": 21, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 27 - } - } + "start":21,"end":27,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":27}} } } ], "rest": null, "returnType": { "type": "VoidTypeAnnotation", - "start": 32, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 32 - }, - "end": { - "line": 1, - "column": 36 - } - } + "start":32,"end":36,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":36}} }, "typeParameters": null } diff --git a/packages/babel-parser/test/fixtures/flow/anonymous-function-types/good_08/output.json b/packages/babel-parser/test/fixtures/flow/anonymous-function-types/good_08/output.json index 16e7731de88f..c39333b8861f 100644 --- a/packages/babel-parser/test/fixtures/flow/anonymous-function-types/good_08/output.json +++ b/packages/babel-parser/test/fixtures/flow/anonymous-function-types/good_08/output.json @@ -1,176 +1,53 @@ { "type": "File", - "start": 0, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":35}}, "program": { "type": "Program", - "start": 0, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":35}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "TypeAlias", - "start": 0, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":35}}, "id": { "type": "Identifier", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "A" - }, + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"A"}, "name": "A" }, "typeParameters": null, "right": { "type": "FunctionTypeAnnotation", - "start": 9, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":9,"end":35,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":35}}, "params": [], "rest": { "type": "FunctionTypeParam", - "start": 13, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":13,"end":26,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":26}}, "name": null, "optional": false, "typeAnnotation": { "type": "GenericTypeAnnotation", - "start": 13, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":13,"end":26,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":26}}, "typeParameters": { "type": "TypeParameterInstantiation", - "start": 18, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":18,"end":26,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":26}}, "params": [ { "type": "StringTypeAnnotation", - "start": 19, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 25 - } - } + "start":19,"end":25,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":25}} } ] }, "id": { "type": "Identifier", - "start": 13, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 18 - }, - "identifierName": "Array" - }, + "start":13,"end":18,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":18},"identifierName":"Array"}, "name": "Array" } } }, "returnType": { "type": "VoidTypeAnnotation", - "start": 31, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 31 - }, - "end": { - "line": 1, - "column": 35 - } - } + "start":31,"end":35,"loc":{"start":{"line":1,"column":31},"end":{"line":1,"column":35}} }, "typeParameters": null } diff --git a/packages/babel-parser/test/fixtures/flow/anonymous-function-types/good_09/output.json b/packages/babel-parser/test/fixtures/flow/anonymous-function-types/good_09/output.json index 6dd7211157e3..7e3230844ebd 100644 --- a/packages/babel-parser/test/fixtures/flow/anonymous-function-types/good_09/output.json +++ b/packages/babel-parser/test/fixtures/flow/anonymous-function-types/good_09/output.json @@ -1,158 +1,46 @@ { "type": "File", - "start": 0, - "end": 50, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 50 - } - }, + "start":0,"end":50,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":50}}, "program": { "type": "Program", - "start": 0, - "end": 50, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 50 - } - }, + "start":0,"end":50,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":50}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "TypeAlias", - "start": 0, - "end": 50, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 50 - } - }, + "start":0,"end":50,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":50}}, "id": { "type": "Identifier", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "A" - }, + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"A"}, "name": "A" }, "typeParameters": null, "right": { "type": "FunctionTypeAnnotation", - "start": 9, - "end": 50, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 50 - } - }, + "start":9,"end":50,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":50}}, "params": [ { "type": "FunctionTypeParam", - "start": 10, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":10,"end":24,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":24}}, "name": null, "optional": false, "typeAnnotation": { "type": "GenericTypeAnnotation", - "start": 10, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":10,"end":23,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":23}}, "typeParameters": { "type": "TypeParameterInstantiation", - "start": 15, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":15,"end":23,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":23}}, "params": [ { "type": "StringTypeAnnotation", - "start": 16, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 22 - } - } + "start":16,"end":22,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":22}} } ] }, "id": { "type": "Identifier", - "start": 10, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 15 - }, - "identifierName": "Array" - }, + "start":10,"end":15,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":15},"identifierName":"Array"}, "name": "Array" } } @@ -160,99 +48,32 @@ ], "rest": { "type": "FunctionTypeParam", - "start": 28, - "end": 41, - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 41 - } - }, + "start":28,"end":41,"loc":{"start":{"line":1,"column":28},"end":{"line":1,"column":41}}, "name": null, "optional": false, "typeAnnotation": { "type": "GenericTypeAnnotation", - "start": 28, - "end": 41, - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 41 - } - }, + "start":28,"end":41,"loc":{"start":{"line":1,"column":28},"end":{"line":1,"column":41}}, "typeParameters": { "type": "TypeParameterInstantiation", - "start": 33, - "end": 41, - "loc": { - "start": { - "line": 1, - "column": 33 - }, - "end": { - "line": 1, - "column": 41 - } - }, + "start":33,"end":41,"loc":{"start":{"line":1,"column":33},"end":{"line":1,"column":41}}, "params": [ { "type": "StringTypeAnnotation", - "start": 34, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 34 - }, - "end": { - "line": 1, - "column": 40 - } - } + "start":34,"end":40,"loc":{"start":{"line":1,"column":34},"end":{"line":1,"column":40}} } ] }, "id": { "type": "Identifier", - "start": 28, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 33 - }, - "identifierName": "Array" - }, + "start":28,"end":33,"loc":{"start":{"line":1,"column":28},"end":{"line":1,"column":33},"identifierName":"Array"}, "name": "Array" } } }, "returnType": { "type": "VoidTypeAnnotation", - "start": 46, - "end": 50, - "loc": { - "start": { - "line": 1, - "column": 46 - }, - "end": { - "line": 1, - "column": 50 - } - } + "start":46,"end":50,"loc":{"start":{"line":1,"column":46},"end":{"line":1,"column":50}} }, "typeParameters": null } diff --git a/packages/babel-parser/test/fixtures/flow/anonymous-function-types/good_10/output.json b/packages/babel-parser/test/fixtures/flow/anonymous-function-types/good_10/output.json index 794fdff46258..316359169e24 100644 --- a/packages/babel-parser/test/fixtures/flow/anonymous-function-types/good_10/output.json +++ b/packages/babel-parser/test/fixtures/flow/anonymous-function-types/good_10/output.json @@ -1,188 +1,54 @@ { "type": "File", - "start": 0, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 39 - } - }, + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":39}}, "program": { "type": "Program", - "start": 0, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 39 - } - }, + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":39}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 39 - } - }, + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":39}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":4,"end":38,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":38}}, "id": { "type": "Identifier", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "f" - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"f"}, "name": "f" }, "init": { "type": "ArrowFunctionExpression", - "start": 8, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":8,"end":38,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":38}}, "predicate": null, "returnType": { "type": "TypeAnnotation", - "start": 11, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":11,"end":31,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":31}}, "typeAnnotation": { "type": "FunctionTypeAnnotation", - "start": 13, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":13,"end":31,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":31}}, "params": [ { "type": "FunctionTypeParam", - "start": 14, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":14,"end":23,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":23}}, "name": { "type": "Identifier", - "start": 14, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - }, - "identifierName": "x" - }, + "start":14,"end":15,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":15},"identifierName":"x"}, "name": "x" }, "optional": false, "typeAnnotation": { "type": "NumberTypeAnnotation", - "start": 17, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 23 - } - } + "start":17,"end":23,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":23}} } } ], "rest": null, "returnType": { "type": "NumberLiteralTypeAnnotation", - "start": 28, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":28,"end":31,"loc":{"start":{"line":1,"column":28},"end":{"line":1,"column":31}}, "extra": { "rawValue": 123, "raw": "123" @@ -198,36 +64,13 @@ "params": [ { "type": "Identifier", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - }, - "identifierName": "x" - }, + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"x"}, "name": "x" } ], "body": { "type": "NumericLiteral", - "start": 35, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 35 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":35,"end":38,"loc":{"start":{"line":1,"column":35},"end":{"line":1,"column":38}}, "extra": { "rawValue": 123, "raw": "123" diff --git a/packages/babel-parser/test/fixtures/flow/anonymous-function-types/good_11/output.json b/packages/babel-parser/test/fixtures/flow/anonymous-function-types/good_11/output.json index 015d69cae1b4..f437182808fc 100644 --- a/packages/babel-parser/test/fixtures/flow/anonymous-function-types/good_11/output.json +++ b/packages/babel-parser/test/fixtures/flow/anonymous-function-types/good_11/output.json @@ -1,123 +1,34 @@ { "type": "File", - "start": 0, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, "program": { "type": "Program", - "start": 0, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":4,"end":27,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":27}}, "id": { "type": "Identifier", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "f" - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"f"}, "name": "f" }, "init": { "type": "ArrowFunctionExpression", - "start": 8, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":8,"end":27,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":27}}, "predicate": null, "returnType": { "type": "TypeAnnotation", - "start": 10, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":10,"end":20,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":20}}, "typeAnnotation": { "type": "NumberTypeAnnotation", - "start": 13, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 19 - } - } + "start":13,"end":19,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":19}} } }, "id": null, @@ -126,18 +37,7 @@ "params": [], "body": { "type": "NumericLiteral", - "start": 24, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":24,"end":27,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":27}}, "extra": { "rawValue": 123, "raw": "123" diff --git a/packages/babel-parser/test/fixtures/flow/anonymous-function-types/good_12/output.json b/packages/babel-parser/test/fixtures/flow/anonymous-function-types/good_12/output.json index 9047e8e46c66..59525a928deb 100644 --- a/packages/babel-parser/test/fixtures/flow/anonymous-function-types/good_12/output.json +++ b/packages/babel-parser/test/fixtures/flow/anonymous-function-types/good_12/output.json @@ -1,153 +1,42 @@ { "type": "File", - "start": 0, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 37 - } - }, + "start":0,"end":37,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":37}}, "program": { "type": "Program", - "start": 0, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 37 - } - }, + "start":0,"end":37,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":37}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 37 - } - }, + "start":0,"end":37,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":37}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":4,"end":36,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":36}}, "id": { "type": "Identifier", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "f" - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"f"}, "name": "f" }, "init": { "type": "ArrowFunctionExpression", - "start": 8, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":8,"end":36,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":36}}, "predicate": null, "returnType": { "type": "TypeAnnotation", - "start": 10, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":10,"end":29,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":29}}, "typeAnnotation": { "type": "UnionTypeAnnotation", - "start": 12, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":12,"end":29,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":29}}, "types": [ { "type": "StringTypeAnnotation", - "start": 12, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 18 - } - } + "start":12,"end":18,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":18}} }, { "type": "NumberTypeAnnotation", - "start": 22, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 28 - } - } + "start":22,"end":28,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":28}} } ] } @@ -158,18 +47,7 @@ "params": [], "body": { "type": "NumericLiteral", - "start": 33, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 33 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":33,"end":36,"loc":{"start":{"line":1,"column":33},"end":{"line":1,"column":36}}, "extra": { "rawValue": 123, "raw": "123" diff --git a/packages/babel-parser/test/fixtures/flow/anonymous-function-types/good_13/output.json b/packages/babel-parser/test/fixtures/flow/anonymous-function-types/good_13/output.json index aea51b1a9d13..0aba1cc06f66 100644 --- a/packages/babel-parser/test/fixtures/flow/anonymous-function-types/good_13/output.json +++ b/packages/babel-parser/test/fixtures/flow/anonymous-function-types/good_13/output.json @@ -1,172 +1,50 @@ { "type": "File", - "start": 0, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":38}}, "program": { "type": "Program", - "start": 0, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":38}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":38}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 37 - } - }, + "start":4,"end":37,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":37}}, "id": { "type": "Identifier", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "f" - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"f"}, "name": "f" }, "init": { "type": "ArrowFunctionExpression", - "start": 8, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 37 - } - }, + "start":8,"end":37,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":37}}, "predicate": null, "returnType": { "type": "TypeAnnotation", - "start": 11, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":11,"end":30,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":30}}, "typeAnnotation": { "type": "FunctionTypeAnnotation", - "start": 14, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":14,"end":29,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":29}}, "params": [ { "type": "FunctionTypeParam", - "start": 15, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":15,"end":21,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":21}}, "name": null, "optional": false, "typeAnnotation": { "type": "NumberTypeAnnotation", - "start": 15, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 21 - } - } + "start":15,"end":21,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":21}} } } ], "rest": null, "returnType": { "type": "NumberLiteralTypeAnnotation", - "start": 26, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":26,"end":29,"loc":{"start":{"line":1,"column":26},"end":{"line":1,"column":29}}, "extra": { "rawValue": 123, "raw": "123" @@ -182,36 +60,13 @@ "params": [ { "type": "Identifier", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - }, - "identifierName": "x" - }, + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"x"}, "name": "x" } ], "body": { "type": "NumericLiteral", - "start": 34, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 34 - }, - "end": { - "line": 1, - "column": 37 - } - }, + "start":34,"end":37,"loc":{"start":{"line":1,"column":34},"end":{"line":1,"column":37}}, "extra": { "rawValue": 123, "raw": "123" diff --git a/packages/babel-parser/test/fixtures/flow/anonymous-function-types/good_14/output.json b/packages/babel-parser/test/fixtures/flow/anonymous-function-types/good_14/output.json index 422a84f34ffe..3a3857adfcc0 100644 --- a/packages/babel-parser/test/fixtures/flow/anonymous-function-types/good_14/output.json +++ b/packages/babel-parser/test/fixtures/flow/anonymous-function-types/good_14/output.json @@ -1,138 +1,38 @@ { "type": "File", - "start": 0, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, "program": { "type": "Program", - "start": 0, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":4,"end":25,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":25}}, "id": { "type": "Identifier", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "f" - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"f"}, "name": "f" }, "init": { "type": "ArrowFunctionExpression", - "start": 8, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":8,"end":25,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":25}}, "predicate": null, "returnType": { "type": "TypeAnnotation", - "start": 11, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":11,"end":20,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":20}}, "typeAnnotation": { "type": "UnionTypeAnnotation", - "start": 13, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":13,"end":20,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":20}}, "types": [ { "type": "NumberLiteralTypeAnnotation", - "start": 15, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":15,"end":16,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":16}}, "extra": { "rawValue": 1, "raw": "1" @@ -141,18 +41,7 @@ }, { "type": "NumberLiteralTypeAnnotation", - "start": 19, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":19,"end":20,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":20}}, "extra": { "rawValue": 2, "raw": "2" @@ -168,36 +57,13 @@ "params": [ { "type": "Identifier", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - }, - "identifierName": "x" - }, + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"x"}, "name": "x" } ], "body": { "type": "NumericLiteral", - "start": 24, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":24,"end":25,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":25}}, "extra": { "rawValue": 1, "raw": "1" diff --git a/packages/babel-parser/test/fixtures/flow/array-types/1/output.json b/packages/babel-parser/test/fixtures/flow/array-types/1/output.json index 06d26c8e36dd..fd6dd628c922 100644 --- a/packages/babel-parser/test/fixtures/flow/array-types/1/output.json +++ b/packages/babel-parser/test/fixtures/flow/array-types/1/output.json @@ -1,121 +1,32 @@ { "type": "File", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "program": { "type": "Program", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":4,"end":15,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":15}}, "id": { "type": "Identifier", - "start": 4, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 15 - }, - "identifierName": "a" - }, + "start":4,"end":15,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":15},"identifierName":"a"}, "name": "a", "typeAnnotation": { "type": "TypeAnnotation", - "start": 5, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":5,"end":15,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":15}}, "typeAnnotation": { "type": "ArrayTypeAnnotation", - "start": 7, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":7,"end":15,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":15}}, "elementType": { "type": "NumberTypeAnnotation", - "start": 7, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 13 - } - } + "start":7,"end":13,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":13}} } } } diff --git a/packages/babel-parser/test/fixtures/flow/array-types/2/output.json b/packages/babel-parser/test/fixtures/flow/array-types/2/output.json index 9f50cb461adc..9a4964e45f3c 100644 --- a/packages/babel-parser/test/fixtures/flow/array-types/2/output.json +++ b/packages/babel-parser/test/fixtures/flow/array-types/2/output.json @@ -1,135 +1,35 @@ { "type": "File", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "program": { "type": "Program", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":4,"end":16,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":16}}, "id": { "type": "Identifier", - "start": 4, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 16 - }, - "identifierName": "a" - }, + "start":4,"end":16,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":16},"identifierName":"a"}, "name": "a", "typeAnnotation": { "type": "TypeAnnotation", - "start": 5, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":5,"end":16,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":16}}, "typeAnnotation": { "type": "NullableTypeAnnotation", - "start": 7, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":7,"end":16,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":16}}, "typeAnnotation": { "type": "ArrayTypeAnnotation", - "start": 8, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":8,"end":16,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":16}}, "elementType": { "type": "NumberTypeAnnotation", - "start": 8, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 14 - } - } + "start":8,"end":14,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":14}} } } } diff --git a/packages/babel-parser/test/fixtures/flow/array-types/3/output.json b/packages/babel-parser/test/fixtures/flow/array-types/3/output.json index 949dfb412346..ea167df54f56 100644 --- a/packages/babel-parser/test/fixtures/flow/array-types/3/output.json +++ b/packages/babel-parser/test/fixtures/flow/array-types/3/output.json @@ -1,135 +1,35 @@ { "type": "File", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, "program": { "type": "Program", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":4,"end":18,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":18}}, "id": { "type": "Identifier", - "start": 4, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 18 - }, - "identifierName": "a" - }, + "start":4,"end":18,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":18},"identifierName":"a"}, "name": "a", "typeAnnotation": { "type": "TypeAnnotation", - "start": 5, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":5,"end":18,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":18}}, "typeAnnotation": { "type": "ArrayTypeAnnotation", - "start": 7, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":7,"end":18,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":18}}, "elementType": { "type": "NullableTypeAnnotation", - "start": 8, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":8,"end":15,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":15}}, "typeAnnotation": { "type": "NumberTypeAnnotation", - "start": 9, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 15 - } - } + "start":9,"end":15,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":15}} } } } diff --git a/packages/babel-parser/test/fixtures/flow/array-types/4/output.json b/packages/babel-parser/test/fixtures/flow/array-types/4/output.json index 51a834b8819b..7d395e92050c 100644 --- a/packages/babel-parser/test/fixtures/flow/array-types/4/output.json +++ b/packages/babel-parser/test/fixtures/flow/array-types/4/output.json @@ -1,137 +1,37 @@ { "type": "File", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, "program": { "type": "Program", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":4,"end":21,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":21}}, "id": { "type": "Identifier", - "start": 4, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 21 - }, - "identifierName": "a" - }, + "start":4,"end":21,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":21},"identifierName":"a"}, "name": "a", "typeAnnotation": { "type": "TypeAnnotation", - "start": 5, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":5,"end":21,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":21}}, "typeAnnotation": { "type": "FunctionTypeAnnotation", - "start": 7, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":7,"end":21,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":21}}, "params": [], "rest": null, "returnType": { "type": "ArrayTypeAnnotation", - "start": 13, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":13,"end":21,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":21}}, "elementType": { "type": "NumberTypeAnnotation", - "start": 13, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 19 - } - } + "start":13,"end":19,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":19}} } }, "typeParameters": null diff --git a/packages/babel-parser/test/fixtures/flow/array-types/5/output.json b/packages/babel-parser/test/fixtures/flow/array-types/5/output.json index 896ad6754174..f6fbb173576b 100644 --- a/packages/babel-parser/test/fixtures/flow/array-types/5/output.json +++ b/packages/babel-parser/test/fixtures/flow/array-types/5/output.json @@ -1,137 +1,37 @@ { "type": "File", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "program": { "type": "Program", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":4,"end":23,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":23}}, "id": { "type": "Identifier", - "start": 4, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 23 - }, - "identifierName": "a" - }, + "start":4,"end":23,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":23},"identifierName":"a"}, "name": "a", "typeAnnotation": { "type": "TypeAnnotation", - "start": 5, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":5,"end":23,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":23}}, "typeAnnotation": { "type": "ArrayTypeAnnotation", - "start": 7, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":7,"end":23,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":23}}, "elementType": { "type": "FunctionTypeAnnotation", - "start": 8, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":8,"end":20,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":20}}, "params": [], "rest": null, "returnType": { "type": "NumberTypeAnnotation", - "start": 14, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 20 - } - } + "start":14,"end":20,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":20}} }, "typeParameters": null } diff --git a/packages/babel-parser/test/fixtures/flow/array-types/6/output.json b/packages/babel-parser/test/fixtures/flow/array-types/6/output.json index 67579952d9a7..30a87379e97b 100644 --- a/packages/babel-parser/test/fixtures/flow/array-types/6/output.json +++ b/packages/babel-parser/test/fixtures/flow/array-types/6/output.json @@ -1,151 +1,39 @@ { "type": "File", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "program": { "type": "Program", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":4,"end":17,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":17}}, "id": { "type": "Identifier", - "start": 4, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 17 - }, - "identifierName": "a" - }, + "start":4,"end":17,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":17},"identifierName":"a"}, "name": "a", "typeAnnotation": { "type": "TypeAnnotation", - "start": 5, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":5,"end":17,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":17}}, "typeAnnotation": { "type": "ArrayTypeAnnotation", - "start": 7, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":7,"end":17,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":17}}, "elementType": { "type": "TypeofTypeAnnotation", - "start": 7, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":7,"end":15,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":15}}, "argument": { "type": "GenericTypeAnnotation", - "start": 14, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":14,"end":15,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":15}}, "typeParameters": null, "id": { "type": "Identifier", - "start": 14, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - }, - "identifierName": "A" - }, + "start":14,"end":15,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":15},"identifierName":"A"}, "name": "A" } } diff --git a/packages/babel-parser/test/fixtures/flow/array-types/7/output.json b/packages/babel-parser/test/fixtures/flow/array-types/7/output.json index 7f4c72ed5990..98aec3b80b45 100644 --- a/packages/babel-parser/test/fixtures/flow/array-types/7/output.json +++ b/packages/babel-parser/test/fixtures/flow/array-types/7/output.json @@ -1,135 +1,35 @@ { "type": "File", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "program": { "type": "Program", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":4,"end":17,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":17}}, "id": { "type": "Identifier", - "start": 4, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 17 - }, - "identifierName": "a" - }, + "start":4,"end":17,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":17},"identifierName":"a"}, "name": "a", "typeAnnotation": { "type": "TypeAnnotation", - "start": 5, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":5,"end":17,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":17}}, "typeAnnotation": { "type": "ArrayTypeAnnotation", - "start": 7, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":7,"end":17,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":17}}, "elementType": { "type": "ArrayTypeAnnotation", - "start": 7, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":7,"end":15,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":15}}, "elementType": { "type": "NumberTypeAnnotation", - "start": 7, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 13 - } - } + "start":7,"end":13,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":13}} } } } diff --git a/packages/babel-parser/test/fixtures/flow/array-types/8/output.json b/packages/babel-parser/test/fixtures/flow/array-types/8/output.json index a826331cb1d1..754d867e033d 100644 --- a/packages/babel-parser/test/fixtures/flow/array-types/8/output.json +++ b/packages/babel-parser/test/fixtures/flow/array-types/8/output.json @@ -1,149 +1,38 @@ { "type": "File", - "start": 0, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, "program": { "type": "Program", - "start": 0, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":4,"end":19,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":19}}, "id": { "type": "Identifier", - "start": 4, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 19 - }, - "identifierName": "a" - }, + "start":4,"end":19,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":19},"identifierName":"a"}, "name": "a", "typeAnnotation": { "type": "TypeAnnotation", - "start": 5, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":5,"end":19,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":19}}, "typeAnnotation": { "type": "ArrayTypeAnnotation", - "start": 7, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":7,"end":19,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":19}}, "elementType": { "type": "ArrayTypeAnnotation", - "start": 7, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":7,"end":17,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":17}}, "elementType": { "type": "ArrayTypeAnnotation", - "start": 7, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":7,"end":15,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":15}}, "elementType": { "type": "NumberTypeAnnotation", - "start": 7, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 13 - } - } + "start":7,"end":13,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":13}} } } } diff --git a/packages/babel-parser/test/fixtures/flow/array-types/9/output.json b/packages/babel-parser/test/fixtures/flow/array-types/9/output.json index 3a8abb5ee6d3..f08c03454ce4 100644 --- a/packages/babel-parser/test/fixtures/flow/array-types/9/output.json +++ b/packages/babel-parser/test/fixtures/flow/array-types/9/output.json @@ -1,107 +1,29 @@ { "type": "File", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 2 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":2}}, "program": { "type": "Program", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 2 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":2}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":4,"end":13,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":13}}, "id": { "type": "Identifier", - "start": 4, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 13 - }, - "identifierName": "a" - }, + "start":4,"end":13,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":13},"identifierName":"a"}, "name": "a", "typeAnnotation": { "type": "TypeAnnotation", - "start": 5, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":5,"end":13,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":13}}, "typeAnnotation": { "type": "NumberTypeAnnotation", - "start": 7, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 13 - } - } + "start":7,"end":13,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":13}} } } }, @@ -112,32 +34,10 @@ }, { "type": "ExpressionStatement", - "start": 14, - "end": 16, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 2 - } - }, + "start":14,"end":16,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":2}}, "expression": { "type": "ArrayExpression", - "start": 14, - "end": 16, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 2 - } - }, + "start":14,"end":16,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":2}}, "elements": [] } } diff --git a/packages/babel-parser/test/fixtures/flow/bounded-polymorphism/1/output.json b/packages/babel-parser/test/fixtures/flow/bounded-polymorphism/1/output.json index f1ad465d3356..844c33565789 100644 --- a/packages/babel-parser/test/fixtures/flow/bounded-polymorphism/1/output.json +++ b/packages/babel-parser/test/fixtures/flow/bounded-polymorphism/1/output.json @@ -1,140 +1,39 @@ { "type": "File", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, "program": { "type": "Program", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, "id": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "A" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, "name": "A" }, "typeParameters": { "type": "TypeParameterDeclaration", - "start": 7, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":7,"end":15,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":15}}, "params": [ { "type": "TypeParameter", - "start": 8, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":8,"end":14,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":14}}, "name": "T", "variance": null, "bound": { "type": "TypeAnnotation", - "start": 9, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":9,"end":14,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":14}}, "typeAnnotation": { "type": "GenericTypeAnnotation", - "start": 11, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":11,"end":14,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":14}}, "typeParameters": null, "id": { "type": "Identifier", - "start": 11, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 14 - }, - "identifierName": "Foo" - }, + "start":11,"end":14,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":14},"identifierName":"Foo"}, "name": "Foo" } } @@ -145,18 +44,7 @@ "superClass": null, "body": { "type": "ClassBody", - "start": 16, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":16,"end":18,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":18}}, "body": [] } } diff --git a/packages/babel-parser/test/fixtures/flow/bounded-polymorphism/2/output.json b/packages/babel-parser/test/fixtures/flow/bounded-polymorphism/2/output.json index 94b3782bdfca..e2d9cc365e37 100644 --- a/packages/babel-parser/test/fixtures/flow/bounded-polymorphism/2/output.json +++ b/packages/babel-parser/test/fixtures/flow/bounded-polymorphism/2/output.json @@ -1,140 +1,40 @@ { "type": "File", - "start": 0, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, "program": { "type": "Program", - "start": 0, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, "id": { "type": "Identifier", - "start": 9, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "bar" - }, + "start":9,"end":12,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":12},"identifierName":"bar"}, "name": "bar" }, "generator": false, "async": false, "typeParameters": { "type": "TypeParameterDeclaration", - "start": 12, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":12,"end":24,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":24}}, "params": [ { "type": "TypeParameter", - "start": 13, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":13,"end":23,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":23}}, "name": "T", "variance": null, "bound": { "type": "TypeAnnotation", - "start": 14, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":14,"end":23,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":23}}, "typeAnnotation": { "type": "NullableTypeAnnotation", - "start": 16, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":16,"end":23,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":23}}, "typeAnnotation": { "type": "NumberTypeAnnotation", - "start": 17, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 23 - } - } + "start":17,"end":23,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":23}} } } } @@ -144,18 +44,7 @@ "params": [], "body": { "type": "BlockStatement", - "start": 27, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":27,"end":29,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":29}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/flow/call-properties/1/output.json b/packages/babel-parser/test/fixtures/flow/call-properties/1/output.json index 41dbc2be1068..225c82bca9dc 100644 --- a/packages/babel-parser/test/fixtures/flow/call-properties/1/output.json +++ b/packages/babel-parser/test/fixtures/flow/call-properties/1/output.json @@ -1,154 +1,43 @@ { "type": "File", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "program": { "type": "Program", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":4,"end":22,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":22}}, "id": { "type": "Identifier", - "start": 4, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 22 - }, - "identifierName": "a" - }, + "start":4,"end":22,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":22},"identifierName":"a"}, "name": "a", "typeAnnotation": { "type": "TypeAnnotation", - "start": 6, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":6,"end":22,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":22}}, "typeAnnotation": { "type": "ObjectTypeAnnotation", - "start": 8, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":8,"end":22,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":22}}, "callProperties": [ { "type": "ObjectTypeCallProperty", - "start": 10, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":10,"end":20,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":20}}, "static": false, "value": { "type": "FunctionTypeAnnotation", - "start": 10, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":10,"end":20,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":20}}, "params": [], "rest": null, "typeParameters": null, "returnType": { "type": "NumberTypeAnnotation", - "start": 14, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 20 - } - } + "start":14,"end":20,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":20}} } } } diff --git a/packages/babel-parser/test/fixtures/flow/call-properties/2/output.json b/packages/babel-parser/test/fixtures/flow/call-properties/2/output.json index 9b2e1c34ab13..7c3d10f344ce 100644 --- a/packages/babel-parser/test/fixtures/flow/call-properties/2/output.json +++ b/packages/babel-parser/test/fixtures/flow/call-properties/2/output.json @@ -1,154 +1,43 @@ { "type": "File", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "program": { "type": "Program", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":4,"end":23,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":23}}, "id": { "type": "Identifier", - "start": 4, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 23 - }, - "identifierName": "a" - }, + "start":4,"end":23,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":23},"identifierName":"a"}, "name": "a", "typeAnnotation": { "type": "TypeAnnotation", - "start": 6, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":6,"end":23,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":23}}, "typeAnnotation": { "type": "ObjectTypeAnnotation", - "start": 8, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":8,"end":23,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":23}}, "callProperties": [ { "type": "ObjectTypeCallProperty", - "start": 10, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":10,"end":20,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":20}}, "static": false, "value": { "type": "FunctionTypeAnnotation", - "start": 10, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":10,"end":20,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":20}}, "params": [], "rest": null, "typeParameters": null, "returnType": { "type": "NumberTypeAnnotation", - "start": 14, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 20 - } - } + "start":14,"end":20,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":20}} } } } diff --git a/packages/babel-parser/test/fixtures/flow/call-properties/3/output.json b/packages/babel-parser/test/fixtures/flow/call-properties/3/output.json index edb622d15e0c..84334ba4a90d 100644 --- a/packages/babel-parser/test/fixtures/flow/call-properties/3/output.json +++ b/packages/babel-parser/test/fixtures/flow/call-properties/3/output.json @@ -1,233 +1,66 @@ { "type": "File", - "start": 0, - "end": 54, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 54 - } - }, + "start":0,"end":54,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":54}}, "program": { "type": "Program", - "start": 0, - "end": 54, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 54 - } - }, + "start":0,"end":54,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":54}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 54, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 54 - } - }, + "start":0,"end":54,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":54}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 54, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 54 - } - }, + "start":4,"end":54,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":54}}, "id": { "type": "Identifier", - "start": 4, - "end": 54, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 54 - }, - "identifierName": "a" - }, + "start":4,"end":54,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":54},"identifierName":"a"}, "name": "a", "typeAnnotation": { "type": "TypeAnnotation", - "start": 6, - "end": 54, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 54 - } - }, + "start":6,"end":54,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":54}}, "typeAnnotation": { "type": "ObjectTypeAnnotation", - "start": 8, - "end": 54, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 54 - } - }, + "start":8,"end":54,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":54}}, "callProperties": [ { "type": "ObjectTypeCallProperty", - "start": 10, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":10,"end":20,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":20}}, "static": false, "value": { "type": "FunctionTypeAnnotation", - "start": 10, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":10,"end":20,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":20}}, "params": [], "rest": null, "typeParameters": null, "returnType": { "type": "NumberTypeAnnotation", - "start": 14, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 20 - } - } + "start":14,"end":20,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":20}} } } }, { "type": "ObjectTypeCallProperty", - "start": 33, - "end": 52, - "loc": { - "start": { - "line": 1, - "column": 33 - }, - "end": { - "line": 1, - "column": 52 - } - }, + "start":33,"end":52,"loc":{"start":{"line":1,"column":33},"end":{"line":1,"column":52}}, "static": false, "value": { "type": "FunctionTypeAnnotation", - "start": 33, - "end": 52, - "loc": { - "start": { - "line": 1, - "column": 33 - }, - "end": { - "line": 1, - "column": 52 - } - }, + "start":33,"end":52,"loc":{"start":{"line":1,"column":33},"end":{"line":1,"column":52}}, "params": [ { "type": "FunctionTypeParam", - "start": 34, - "end": 43, - "loc": { - "start": { - "line": 1, - "column": 34 - }, - "end": { - "line": 1, - "column": 43 - } - }, + "start":34,"end":43,"loc":{"start":{"line":1,"column":34},"end":{"line":1,"column":43}}, "name": { "type": "Identifier", - "start": 34, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 34 - }, - "end": { - "line": 1, - "column": 35 - }, - "identifierName": "x" - }, + "start":34,"end":35,"loc":{"start":{"line":1,"column":34},"end":{"line":1,"column":35},"identifierName":"x"}, "name": "x" }, "optional": false, "typeAnnotation": { "type": "StringTypeAnnotation", - "start": 37, - "end": 43, - "loc": { - "start": { - "line": 1, - "column": 37 - }, - "end": { - "line": 1, - "column": 43 - } - } + "start":37,"end":43,"loc":{"start":{"line":1,"column":37},"end":{"line":1,"column":43}} } } ], @@ -235,18 +68,7 @@ "typeParameters": null, "returnType": { "type": "StringTypeAnnotation", - "start": 46, - "end": 52, - "loc": { - "start": { - "line": 1, - "column": 46 - }, - "end": { - "line": 1, - "column": 52 - } - } + "start":46,"end":52,"loc":{"start":{"line":1,"column":46},"end":{"line":1,"column":52}} } } } @@ -254,33 +76,10 @@ "properties": [ { "type": "ObjectTypeProperty", - "start": 22, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":22,"end":31,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":31}}, "key": { "type": "Identifier", - "start": 22, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 23 - }, - "identifierName": "y" - }, + "start":22,"end":23,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":23},"identifierName":"y"}, "name": "y" }, "static": false, @@ -289,18 +88,7 @@ "method": false, "value": { "type": "StringTypeAnnotation", - "start": 25, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 31 - } - } + "start":25,"end":31,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":31}} }, "variance": null, "optional": false diff --git a/packages/babel-parser/test/fixtures/flow/call-properties/4/output.json b/packages/babel-parser/test/fixtures/flow/call-properties/4/output.json index 718dab31950f..3f664920aa97 100644 --- a/packages/babel-parser/test/fixtures/flow/call-properties/4/output.json +++ b/packages/babel-parser/test/fixtures/flow/call-properties/4/output.json @@ -1,200 +1,54 @@ { "type": "File", - "start": 0, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, "program": { "type": "Program", - "start": 0, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":4,"end":30,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":30}}, "id": { "type": "Identifier", - "start": 4, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 30 - }, - "identifierName": "a" - }, + "start":4,"end":30,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":30},"identifierName":"a"}, "name": "a", "typeAnnotation": { "type": "TypeAnnotation", - "start": 6, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":6,"end":30,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":30}}, "typeAnnotation": { "type": "ObjectTypeAnnotation", - "start": 8, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":8,"end":30,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":30}}, "callProperties": [ { "type": "ObjectTypeCallProperty", - "start": 10, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":10,"end":27,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":27}}, "static": false, "value": { "type": "FunctionTypeAnnotation", - "start": 10, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":10,"end":27,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":27}}, "params": [ { "type": "FunctionTypeParam", - "start": 14, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":14,"end":18,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":18}}, "name": { "type": "Identifier", - "start": 14, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - }, - "identifierName": "x" - }, + "start":14,"end":15,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":15},"identifierName":"x"}, "name": "x" }, "optional": false, "typeAnnotation": { "type": "GenericTypeAnnotation", - "start": 17, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":17,"end":18,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":18}}, "typeParameters": null, "id": { "type": "Identifier", - "start": 17, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - }, - "identifierName": "T" - }, + "start":17,"end":18,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":18},"identifierName":"T"}, "name": "T" } } @@ -203,33 +57,11 @@ "rest": null, "typeParameters": { "type": "TypeParameterDeclaration", - "start": 10, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":10,"end":13,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":13}}, "params": [ { "type": "TypeParameter", - "start": 11, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":11,"end":12,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":12}}, "name": "T", "variance": null } @@ -237,18 +69,7 @@ }, "returnType": { "type": "NumberTypeAnnotation", - "start": 21, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 27 - } - } + "start":21,"end":27,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":27}} } } } diff --git a/packages/babel-parser/test/fixtures/flow/call-properties/5/output.json b/packages/babel-parser/test/fixtures/flow/call-properties/5/output.json index db839f06c23f..891892e2f708 100644 --- a/packages/babel-parser/test/fixtures/flow/call-properties/5/output.json +++ b/packages/babel-parser/test/fixtures/flow/call-properties/5/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, "program": { "type": "Program", - "start": 0, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "InterfaceDeclaration", - "start": 0, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, "id": { "type": "Identifier", - "start": 10, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "A" - }, + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11},"identifierName":"A"}, "name": "A" }, "typeParameters": null, @@ -66,65 +21,21 @@ "mixins": [], "body": { "type": "ObjectTypeAnnotation", - "start": 12, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":12,"end":27,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":27}}, "callProperties": [ { "type": "ObjectTypeCallProperty", - "start": 14, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":14,"end":24,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":24}}, "static": false, "value": { "type": "FunctionTypeAnnotation", - "start": 14, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":14,"end":24,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":24}}, "params": [], "rest": null, "typeParameters": null, "returnType": { "type": "NumberTypeAnnotation", - "start": 18, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 24 - } - } + "start":18,"end":24,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":24}} } } } diff --git a/packages/babel-parser/test/fixtures/flow/class-private-property/1/output.json b/packages/babel-parser/test/fixtures/flow/class-private-property/1/output.json index a00beeae9dc5..7ec235864e56 100644 --- a/packages/babel-parser/test/fixtures/flow/class-private-property/1/output.json +++ b/packages/babel-parser/test/fixtures/flow/class-private-property/1/output.json @@ -1,254 +1,74 @@ { "type": "File", - "start": 0, - "end": 55, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":0,"end":55,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 55, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":0,"end":55,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 55, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":0,"end":55,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, "id": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "A" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, "name": "A" }, "superClass": null, "body": { "type": "ClassBody", - "start": 8, - "end": 55, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":8,"end":55,"loc":{"start":{"line":1,"column":8},"end":{"line":4,"column":1}}, "body": [ { "type": "ClassPrivateProperty", - "start": 12, - "end": 27, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 17 - } - }, + "start":12,"end":27,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":17}}, "static": false, "key": { "type": "PrivateName", - "start": 12, - "end": 18, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 8 - } - }, + "start":12,"end":18,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":8}}, "id": { "type": "Identifier", - "start": 13, - "end": 18, - "loc": { - "start": { - "line": 2, - "column": 3 - }, - "end": { - "line": 2, - "column": 8 - }, - "identifierName": "prop1" - }, + "start":13,"end":18,"loc":{"start":{"line":2,"column":3},"end":{"line":2,"column":8},"identifierName":"prop1"}, "name": "prop1" } }, "variance": null, "typeAnnotation": { "type": "TypeAnnotation", - "start": 18, - "end": 26, - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 16 - } - }, + "start":18,"end":26,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":16}}, "typeAnnotation": { "type": "StringTypeAnnotation", - "start": 20, - "end": 26, - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 16 - } - } + "start":20,"end":26,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":16}} } }, "value": null }, { "type": "ClassPrivateProperty", - "start": 30, - "end": 53, - "loc": { - "start": { - "line": 3, - "column": 2 - }, - "end": { - "line": 3, - "column": 25 - } - }, + "start":30,"end":53,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":25}}, "static": false, "key": { "type": "PrivateName", - "start": 30, - "end": 36, - "loc": { - "start": { - "line": 3, - "column": 2 - }, - "end": { - "line": 3, - "column": 8 - } - }, + "start":30,"end":36,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":8}}, "id": { "type": "Identifier", - "start": 31, - "end": 36, - "loc": { - "start": { - "line": 3, - "column": 3 - }, - "end": { - "line": 3, - "column": 8 - }, - "identifierName": "prop2" - }, + "start":31,"end":36,"loc":{"start":{"line":3,"column":3},"end":{"line":3,"column":8},"identifierName":"prop2"}, "name": "prop2" } }, "variance": null, "typeAnnotation": { "type": "TypeAnnotation", - "start": 36, - "end": 44, - "loc": { - "start": { - "line": 3, - "column": 8 - }, - "end": { - "line": 3, - "column": 16 - } - }, + "start":36,"end":44,"loc":{"start":{"line":3,"column":8},"end":{"line":3,"column":16}}, "typeAnnotation": { "type": "NumberTypeAnnotation", - "start": 38, - "end": 44, - "loc": { - "start": { - "line": 3, - "column": 10 - }, - "end": { - "line": 3, - "column": 16 - } - } + "start":38,"end":44,"loc":{"start":{"line":3,"column":10},"end":{"line":3,"column":16}} } }, "value": { "type": "Identifier", - "start": 47, - "end": 52, - "loc": { - "start": { - "line": 3, - "column": 19 - }, - "end": { - "line": 3, - "column": 24 - }, - "identifierName": "value" - }, + "start":47,"end":52,"loc":{"start":{"line":3,"column":19},"end":{"line":3,"column":24},"identifierName":"value"}, "name": "value" } } diff --git a/packages/babel-parser/test/fixtures/flow/class-private-property/2/output.json b/packages/babel-parser/test/fixtures/flow/class-private-property/2/output.json index ab488ef2168d..6d1a17645506 100644 --- a/packages/babel-parser/test/fixtures/flow/class-private-property/2/output.json +++ b/packages/babel-parser/test/fixtures/flow/class-private-property/2/output.json @@ -1,237 +1,69 @@ { "type": "File", - "start": 0, - "end": 47, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":0,"end":47,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 47, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":0,"end":47,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 47, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":0,"end":47,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, "id": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "A" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, "name": "A" }, "superClass": null, "body": { "type": "ClassBody", - "start": 8, - "end": 47, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":8,"end":47,"loc":{"start":{"line":1,"column":8},"end":{"line":4,"column":1}}, "body": [ { "type": "ClassPrivateProperty", - "start": 12, - "end": 27, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 17 - } - }, + "start":12,"end":27,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":17}}, "static": false, "key": { "type": "PrivateName", - "start": 12, - "end": 18, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 8 - } - }, + "start":12,"end":18,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":8}}, "id": { "type": "Identifier", - "start": 13, - "end": 18, - "loc": { - "start": { - "line": 2, - "column": 3 - }, - "end": { - "line": 2, - "column": 8 - }, - "identifierName": "prop1" - }, + "start":13,"end":18,"loc":{"start":{"line":2,"column":3},"end":{"line":2,"column":8},"identifierName":"prop1"}, "name": "prop1" } }, "variance": null, "typeAnnotation": { "type": "TypeAnnotation", - "start": 18, - "end": 26, - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 16 - } - }, + "start":18,"end":26,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":16}}, "typeAnnotation": { "type": "StringTypeAnnotation", - "start": 20, - "end": 26, - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 16 - } - } + "start":20,"end":26,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":16}} } }, "value": null }, { "type": "ClassPrivateProperty", - "start": 30, - "end": 45, - "loc": { - "start": { - "line": 3, - "column": 2 - }, - "end": { - "line": 3, - "column": 17 - } - }, + "start":30,"end":45,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":17}}, "static": false, "key": { "type": "PrivateName", - "start": 30, - "end": 36, - "loc": { - "start": { - "line": 3, - "column": 2 - }, - "end": { - "line": 3, - "column": 8 - } - }, + "start":30,"end":36,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":8}}, "id": { "type": "Identifier", - "start": 31, - "end": 36, - "loc": { - "start": { - "line": 3, - "column": 3 - }, - "end": { - "line": 3, - "column": 8 - }, - "identifierName": "prop2" - }, + "start":31,"end":36,"loc":{"start":{"line":3,"column":3},"end":{"line":3,"column":8},"identifierName":"prop2"}, "name": "prop2" } }, "variance": null, "typeAnnotation": { "type": "TypeAnnotation", - "start": 36, - "end": 44, - "loc": { - "start": { - "line": 3, - "column": 8 - }, - "end": { - "line": 3, - "column": 16 - } - }, + "start":36,"end":44,"loc":{"start":{"line":3,"column":8},"end":{"line":3,"column":16}}, "typeAnnotation": { "type": "NumberTypeAnnotation", - "start": 38, - "end": 44, - "loc": { - "start": { - "line": 3, - "column": 10 - }, - "end": { - "line": 3, - "column": 16 - } - } + "start":38,"end":44,"loc":{"start":{"line":3,"column":10},"end":{"line":3,"column":16}} } }, "value": null diff --git a/packages/babel-parser/test/fixtures/flow/class-private-property/declare-field-initializer/input.js b/packages/babel-parser/test/fixtures/flow/class-private-property/declare-field-initializer/input.js new file mode 100644 index 000000000000..7f38766c9f7a --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/class-private-property/declare-field-initializer/input.js @@ -0,0 +1,3 @@ +class A { + declare #foo = 2 +} diff --git a/packages/babel-parser/test/fixtures/flow/class-private-property/declare-field-initializer/output.json b/packages/babel-parser/test/fixtures/flow/class-private-property/declare-field-initializer/output.json new file mode 100644 index 000000000000..7b64fc114305 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/class-private-property/declare-field-initializer/output.json @@ -0,0 +1,57 @@ +{ + "type": "File", + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "errors": [ + "SyntaxError: Initializers are not allowed in fields with the `declare` modifier. (2:17)" + ], + "program": { + "type": "Program", + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "id": { + "type": "Identifier", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":8,"end":30,"loc":{"start":{"line":1,"column":8},"end":{"line":3,"column":1}}, + "body": [ + { + "type": "ClassPrivateProperty", + "start":12,"end":28,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":18}}, + "declare": true, + "static": false, + "key": { + "type": "PrivateName", + "start":20,"end":24,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":14}}, + "id": { + "type": "Identifier", + "start":21,"end":24,"loc":{"start":{"line":2,"column":11},"end":{"line":2,"column":14},"identifierName":"foo"}, + "name": "foo" + } + }, + "variance": null, + "value": { + "type": "NumericLiteral", + "start":27,"end":28,"loc":{"start":{"line":2,"column":17},"end":{"line":2,"column":18}}, + "extra": { + "rawValue": 2, + "raw": "2" + }, + "value": 2 + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/class-private-property/declare-field/input.js b/packages/babel-parser/test/fixtures/flow/class-private-property/declare-field/input.js new file mode 100644 index 000000000000..bc3b7c37d368 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/class-private-property/declare-field/input.js @@ -0,0 +1,3 @@ +class A { + declare #foo +} diff --git a/packages/babel-parser/test/fixtures/flow/class-private-property/declare-field/output.json b/packages/babel-parser/test/fixtures/flow/class-private-property/declare-field/output.json new file mode 100644 index 000000000000..0bbd5e95ce0e --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/class-private-property/declare-field/output.json @@ -0,0 +1,46 @@ +{ + "type": "File", + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "program": { + "type": "Program", + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "id": { + "type": "Identifier", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":8,"end":26,"loc":{"start":{"line":1,"column":8},"end":{"line":3,"column":1}}, + "body": [ + { + "type": "ClassPrivateProperty", + "start":12,"end":24,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":14}}, + "declare": true, + "static": false, + "key": { + "type": "PrivateName", + "start":20,"end":24,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":14}}, + "id": { + "type": "Identifier", + "start":21,"end":24,"loc":{"start":{"line":2,"column":11},"end":{"line":2,"column":14},"identifierName":"foo"}, + "name": "foo" + } + }, + "variance": null, + "value": null + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/class-private-property/declare-method/input.js b/packages/babel-parser/test/fixtures/flow/class-private-property/declare-method/input.js new file mode 100644 index 000000000000..edfd99fe602f --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/class-private-property/declare-method/input.js @@ -0,0 +1,3 @@ +class A { + declare #foo() {} +} diff --git a/packages/babel-parser/test/fixtures/flow/class-private-property/declare-method/options.json b/packages/babel-parser/test/fixtures/flow/class-private-property/declare-method/options.json new file mode 100644 index 000000000000..3bec5045a369 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/class-private-property/declare-method/options.json @@ -0,0 +1,8 @@ +{ + "sourceType": "module", + "plugins": [ + "flow", + "classPrivateProperties", + "classPrivateMethods" + ] +} diff --git a/packages/babel-parser/test/fixtures/flow/class-private-property/declare-method/output.json b/packages/babel-parser/test/fixtures/flow/class-private-property/declare-method/output.json new file mode 100644 index 000000000000..ae0f5d34baeb --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/class-private-property/declare-method/output.json @@ -0,0 +1,58 @@ +{ + "type": "File", + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "errors": [ + "SyntaxError: The `declare` modifier can only appear on class fields. (2:2)" + ], + "program": { + "type": "Program", + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "id": { + "type": "Identifier", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":8,"end":31,"loc":{"start":{"line":1,"column":8},"end":{"line":3,"column":1}}, + "body": [ + { + "type": "ClassPrivateMethod", + "start":12,"end":29,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":19}}, + "declare": true, + "static": false, + "key": { + "type": "PrivateName", + "start":20,"end":24,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":14}}, + "id": { + "type": "Identifier", + "start":21,"end":24,"loc":{"start":{"line":2,"column":11},"end":{"line":2,"column":14},"identifierName":"foo"}, + "name": "foo" + } + }, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":27,"end":29,"loc":{"start":{"line":2,"column":17},"end":{"line":2,"column":19}}, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/class-properties/declare-after-decorators/input.js b/packages/babel-parser/test/fixtures/flow/class-properties/declare-after-decorators/input.js new file mode 100644 index 000000000000..6075fd0137bc --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/class-properties/declare-after-decorators/input.js @@ -0,0 +1,3 @@ +class A { + @dec declare foo +} diff --git a/packages/babel-parser/test/fixtures/flow/class-properties/declare-after-decorators/options.json b/packages/babel-parser/test/fixtures/flow/class-properties/declare-after-decorators/options.json new file mode 100644 index 000000000000..71e345f90808 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/class-properties/declare-after-decorators/options.json @@ -0,0 +1,8 @@ +{ + "sourceType": "module", + "plugins": [ + "flow", + "classProperties", + ["decorators", { "decoratorsBeforeExport": false }] + ] +} diff --git a/packages/babel-parser/test/fixtures/flow/class-properties/declare-after-decorators/output.json b/packages/babel-parser/test/fixtures/flow/class-properties/declare-after-decorators/output.json new file mode 100644 index 000000000000..db8d95413d43 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/class-properties/declare-after-decorators/output.json @@ -0,0 +1,54 @@ +{ + "type": "File", + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "program": { + "type": "Program", + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "id": { + "type": "Identifier", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":8,"end":30,"loc":{"start":{"line":1,"column":8},"end":{"line":3,"column":1}}, + "body": [ + { + "type": "ClassProperty", + "start":12,"end":28,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":18}}, + "decorators": [ + { + "type": "Decorator", + "start":12,"end":16,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":6}}, + "expression": { + "type": "Identifier", + "start":13,"end":16,"loc":{"start":{"line":2,"column":3},"end":{"line":2,"column":6},"identifierName":"dec"}, + "name": "dec" + } + } + ], + "declare": true, + "static": false, + "key": { + "type": "Identifier", + "start":25,"end":28,"loc":{"start":{"line":2,"column":15},"end":{"line":2,"column":18},"identifierName":"foo"}, + "name": "foo" + }, + "computed": false, + "variance": null, + "value": null + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/class-properties/declare-before-decorators/input.js b/packages/babel-parser/test/fixtures/flow/class-properties/declare-before-decorators/input.js new file mode 100644 index 000000000000..069fd4fb3334 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/class-properties/declare-before-decorators/input.js @@ -0,0 +1,3 @@ +class A { + declare @dec foo +} diff --git a/packages/babel-parser/test/fixtures/flow/class-properties/declare-before-decorators/options.json b/packages/babel-parser/test/fixtures/flow/class-properties/declare-before-decorators/options.json new file mode 100644 index 000000000000..43ca4a74f89e --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/class-properties/declare-before-decorators/options.json @@ -0,0 +1,9 @@ +{ + "sourceType": "module", + "plugins": [ + "flow", + "classProperties", + ["decorators", { "decoratorsBeforeExport": false }] + ], + "throws": "Unexpected token (2:10)" +} diff --git a/packages/babel-parser/test/fixtures/flow/class-properties/declare-constructor/input.js b/packages/babel-parser/test/fixtures/flow/class-properties/declare-constructor/input.js new file mode 100644 index 000000000000..ad173f3e1ad3 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/class-properties/declare-constructor/input.js @@ -0,0 +1,3 @@ +class A { + declare constructor() {} +} diff --git a/packages/babel-parser/test/fixtures/flow/class-properties/declare-constructor/output.json b/packages/babel-parser/test/fixtures/flow/class-properties/declare-constructor/output.json new file mode 100644 index 000000000000..4e384e15aee0 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/class-properties/declare-constructor/output.json @@ -0,0 +1,55 @@ +{ + "type": "File", + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "errors": [ + "SyntaxError: The `declare` modifier can only appear on class fields. (2:2)" + ], + "program": { + "type": "Program", + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "id": { + "type": "Identifier", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":8,"end":38,"loc":{"start":{"line":1,"column":8},"end":{"line":3,"column":1}}, + "body": [ + { + "type": "ClassMethod", + "start":12,"end":36,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":26}}, + "declare": true, + "static": false, + "key": { + "type": "Identifier", + "start":20,"end":31,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":21},"identifierName":"constructor"}, + "name": "constructor" + }, + "computed": false, + "kind": "constructor", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":34,"end":36,"loc":{"start":{"line":2,"column":24},"end":{"line":2,"column":26}}, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/class-properties/declare-field-computed/input.js b/packages/babel-parser/test/fixtures/flow/class-properties/declare-field-computed/input.js new file mode 100644 index 000000000000..14a772747157 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/class-properties/declare-field-computed/input.js @@ -0,0 +1,3 @@ +class A { + declare [foo] +} diff --git a/packages/babel-parser/test/fixtures/flow/class-properties/declare-field-computed/output.json b/packages/babel-parser/test/fixtures/flow/class-properties/declare-field-computed/output.json new file mode 100644 index 000000000000..206e08e2cbe0 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/class-properties/declare-field-computed/output.json @@ -0,0 +1,43 @@ +{ + "type": "File", + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "program": { + "type": "Program", + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "id": { + "type": "Identifier", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":8,"end":27,"loc":{"start":{"line":1,"column":8},"end":{"line":3,"column":1}}, + "body": [ + { + "type": "ClassProperty", + "start":12,"end":25,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":15}}, + "declare": true, + "static": false, + "computed": true, + "key": { + "type": "Identifier", + "start":21,"end":24,"loc":{"start":{"line":2,"column":11},"end":{"line":2,"column":14},"identifierName":"foo"}, + "name": "foo" + }, + "variance": null, + "value": null + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/class-properties/declare-field-initializer/input.js b/packages/babel-parser/test/fixtures/flow/class-properties/declare-field-initializer/input.js new file mode 100644 index 000000000000..7d9387f5474e --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/class-properties/declare-field-initializer/input.js @@ -0,0 +1,3 @@ +class A { + declare foo = 2 +} diff --git a/packages/babel-parser/test/fixtures/flow/class-properties/declare-field-initializer/output.json b/packages/babel-parser/test/fixtures/flow/class-properties/declare-field-initializer/output.json new file mode 100644 index 000000000000..8786c334ee5a --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/class-properties/declare-field-initializer/output.json @@ -0,0 +1,54 @@ +{ + "type": "File", + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "errors": [ + "SyntaxError: Initializers are not allowed in fields with the `declare` modifier. (2:16)" + ], + "program": { + "type": "Program", + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "id": { + "type": "Identifier", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":8,"end":29,"loc":{"start":{"line":1,"column":8},"end":{"line":3,"column":1}}, + "body": [ + { + "type": "ClassProperty", + "start":12,"end":27,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":17}}, + "declare": true, + "static": false, + "key": { + "type": "Identifier", + "start":20,"end":23,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":13},"identifierName":"foo"}, + "name": "foo" + }, + "computed": false, + "variance": null, + "value": { + "type": "NumericLiteral", + "start":26,"end":27,"loc":{"start":{"line":2,"column":16},"end":{"line":2,"column":17}}, + "extra": { + "rawValue": 2, + "raw": "2" + }, + "value": 2 + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/class-properties/declare-field-named-static/input.js b/packages/babel-parser/test/fixtures/flow/class-properties/declare-field-named-static/input.js new file mode 100644 index 000000000000..c746a01c7638 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/class-properties/declare-field-named-static/input.js @@ -0,0 +1,3 @@ +class A { + declare static +} diff --git a/packages/babel-parser/test/fixtures/flow/class-properties/declare-field-named-static/output.json b/packages/babel-parser/test/fixtures/flow/class-properties/declare-field-named-static/output.json new file mode 100644 index 000000000000..6b674fc50fc6 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/class-properties/declare-field-named-static/output.json @@ -0,0 +1,42 @@ +{ + "type": "File", + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "program": { + "type": "Program", + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "id": { + "type": "Identifier", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":8,"end":28,"loc":{"start":{"line":1,"column":8},"end":{"line":3,"column":1}}, + "body": [ + { + "type": "ClassProperty", + "start":12,"end":26,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":16}}, + "declare": true, + "computed": false, + "key": { + "type": "Identifier", + "start":20,"end":26,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":16},"identifierName":"static"}, + "name": "static" + }, + "static": false, + "value": null + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/class-properties/declare-field-with-type/input.js b/packages/babel-parser/test/fixtures/flow/class-properties/declare-field-with-type/input.js new file mode 100644 index 000000000000..80b1bbb04e64 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/class-properties/declare-field-with-type/input.js @@ -0,0 +1,3 @@ +class A { + declare foo: string +} diff --git a/packages/babel-parser/test/fixtures/flow/class-properties/declare-field-with-type/output.json b/packages/babel-parser/test/fixtures/flow/class-properties/declare-field-with-type/output.json new file mode 100644 index 000000000000..596dd7518653 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/class-properties/declare-field-with-type/output.json @@ -0,0 +1,51 @@ +{ + "type": "File", + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "program": { + "type": "Program", + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "id": { + "type": "Identifier", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":8,"end":33,"loc":{"start":{"line":1,"column":8},"end":{"line":3,"column":1}}, + "body": [ + { + "type": "ClassProperty", + "start":12,"end":31,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":21}}, + "declare": true, + "static": false, + "key": { + "type": "Identifier", + "start":20,"end":23,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":13},"identifierName":"foo"}, + "name": "foo" + }, + "computed": false, + "variance": null, + "typeAnnotation": { + "type": "TypeAnnotation", + "start":23,"end":31,"loc":{"start":{"line":2,"column":13},"end":{"line":2,"column":21}}, + "typeAnnotation": { + "type": "StringTypeAnnotation", + "start":25,"end":31,"loc":{"start":{"line":2,"column":15},"end":{"line":2,"column":21}} + } + }, + "value": null + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/class-properties/declare-field/input.js b/packages/babel-parser/test/fixtures/flow/class-properties/declare-field/input.js new file mode 100644 index 000000000000..9e7ac1ffb0c9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/class-properties/declare-field/input.js @@ -0,0 +1,3 @@ +class A { + declare foo +} diff --git a/packages/babel-parser/test/fixtures/flow/class-properties/declare-field/output.json b/packages/babel-parser/test/fixtures/flow/class-properties/declare-field/output.json new file mode 100644 index 000000000000..3e9472582d84 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/class-properties/declare-field/output.json @@ -0,0 +1,43 @@ +{ + "type": "File", + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "program": { + "type": "Program", + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "id": { + "type": "Identifier", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":8,"end":25,"loc":{"start":{"line":1,"column":8},"end":{"line":3,"column":1}}, + "body": [ + { + "type": "ClassProperty", + "start":12,"end":23,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":13}}, + "declare": true, + "static": false, + "key": { + "type": "Identifier", + "start":20,"end":23,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":13},"identifierName":"foo"}, + "name": "foo" + }, + "computed": false, + "variance": null, + "value": null + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/class-properties/declare-method/input.js b/packages/babel-parser/test/fixtures/flow/class-properties/declare-method/input.js new file mode 100644 index 000000000000..0e539a84a2a5 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/class-properties/declare-method/input.js @@ -0,0 +1,3 @@ +class A { + declare foo() {} +} diff --git a/packages/babel-parser/test/fixtures/flow/class-properties/declare-method/output.json b/packages/babel-parser/test/fixtures/flow/class-properties/declare-method/output.json new file mode 100644 index 000000000000..d8ea7350b595 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/class-properties/declare-method/output.json @@ -0,0 +1,55 @@ +{ + "type": "File", + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "errors": [ + "SyntaxError: The `declare` modifier can only appear on class fields. (2:2)" + ], + "program": { + "type": "Program", + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "id": { + "type": "Identifier", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":8,"end":30,"loc":{"start":{"line":1,"column":8},"end":{"line":3,"column":1}}, + "body": [ + { + "type": "ClassMethod", + "start":12,"end":28,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":18}}, + "declare": true, + "static": false, + "key": { + "type": "Identifier", + "start":20,"end":23,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":13},"identifierName":"foo"}, + "name": "foo" + }, + "computed": false, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":26,"end":28,"loc":{"start":{"line":2,"column":16},"end":{"line":2,"column":18}}, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/class-properties/declare-static-field/input.js b/packages/babel-parser/test/fixtures/flow/class-properties/declare-static-field/input.js new file mode 100644 index 000000000000..00d59b89a1ff --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/class-properties/declare-static-field/input.js @@ -0,0 +1,3 @@ +class A { + declare static foo +} diff --git a/packages/babel-parser/test/fixtures/flow/class-properties/declare-static-field/output.json b/packages/babel-parser/test/fixtures/flow/class-properties/declare-static-field/output.json new file mode 100644 index 000000000000..4df0de125108 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/class-properties/declare-static-field/output.json @@ -0,0 +1,43 @@ +{ + "type": "File", + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "program": { + "type": "Program", + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "id": { + "type": "Identifier", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":8,"end":32,"loc":{"start":{"line":1,"column":8},"end":{"line":3,"column":1}}, + "body": [ + { + "type": "ClassProperty", + "start":12,"end":30,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":20}}, + "declare": true, + "static": true, + "key": { + "type": "Identifier", + "start":27,"end":30,"loc":{"start":{"line":2,"column":17},"end":{"line":2,"column":20},"identifierName":"foo"}, + "name": "foo" + }, + "computed": false, + "variance": null, + "value": null + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/class-properties/field-named-declare-with-type/input.js b/packages/babel-parser/test/fixtures/flow/class-properties/field-named-declare-with-type/input.js new file mode 100644 index 000000000000..596b91c31163 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/class-properties/field-named-declare-with-type/input.js @@ -0,0 +1,3 @@ +class A { + declare: string +} diff --git a/packages/babel-parser/test/fixtures/flow/class-properties/field-named-declare-with-type/output.json b/packages/babel-parser/test/fixtures/flow/class-properties/field-named-declare-with-type/output.json new file mode 100644 index 000000000000..60aed8369054 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/class-properties/field-named-declare-with-type/output.json @@ -0,0 +1,49 @@ +{ + "type": "File", + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "program": { + "type": "Program", + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "id": { + "type": "Identifier", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":8,"end":29,"loc":{"start":{"line":1,"column":8},"end":{"line":3,"column":1}}, + "body": [ + { + "type": "ClassProperty", + "start":12,"end":27,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":17}}, + "computed": false, + "key": { + "type": "Identifier", + "start":12,"end":19,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":9},"identifierName":"declare"}, + "name": "declare" + }, + "static": false, + "typeAnnotation": { + "type": "TypeAnnotation", + "start":19,"end":27,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":17}}, + "typeAnnotation": { + "type": "StringTypeAnnotation", + "start":21,"end":27,"loc":{"start":{"line":2,"column":11},"end":{"line":2,"column":17}} + } + }, + "value": null + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/class-properties/field-named-declare/input.js b/packages/babel-parser/test/fixtures/flow/class-properties/field-named-declare/input.js new file mode 100644 index 000000000000..4d078b4c0c20 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/class-properties/field-named-declare/input.js @@ -0,0 +1,3 @@ +class A { + declare +} diff --git a/packages/babel-parser/test/fixtures/flow/class-properties/field-named-declare/output.json b/packages/babel-parser/test/fixtures/flow/class-properties/field-named-declare/output.json new file mode 100644 index 000000000000..70b00851f80f --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/class-properties/field-named-declare/output.json @@ -0,0 +1,41 @@ +{ + "type": "File", + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "program": { + "type": "Program", + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "id": { + "type": "Identifier", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":8,"end":21,"loc":{"start":{"line":1,"column":8},"end":{"line":3,"column":1}}, + "body": [ + { + "type": "ClassProperty", + "start":12,"end":19,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":9}}, + "computed": false, + "key": { + "type": "Identifier", + "start":12,"end":19,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":9},"identifierName":"declare"}, + "name": "declare" + }, + "static": false, + "value": null + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/class-properties/getter-setter/output.json b/packages/babel-parser/test/fixtures/flow/class-properties/getter-setter/output.json index 78d487b01aad..f35d695d38ca 100644 --- a/packages/babel-parser/test/fixtures/flow/class-properties/getter-setter/output.json +++ b/packages/babel-parser/test/fixtures/flow/class-properties/getter-setter/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 158, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 8, - "column": 1 - } - }, + "start":0,"end":158,"loc":{"start":{"line":1,"column":0},"end":{"line":8,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 158, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 8, - "column": 1 - } - }, + "start":0,"end":158,"loc":{"start":{"line":1,"column":0},"end":{"line":8,"column":1}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "DeclareClass", - "start": 0, - "end": 158, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 8, - "column": 1 - } - }, + "start":0,"end":158,"loc":{"start":{"line":1,"column":0},"end":{"line":8,"column":1}}, "id": { "type": "Identifier", - "start": 14, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - }, - "identifierName": "B" - }, + "start":14,"end":15,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":15},"identifierName":"B"}, "name": "B" }, "typeParameters": null, @@ -66,49 +21,15 @@ "mixins": [], "body": { "type": "ObjectTypeAnnotation", - "start": 16, - "end": 158, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 8, - "column": 1 - } - }, + "start":16,"end":158,"loc":{"start":{"line":1,"column":16},"end":{"line":8,"column":1}}, "callProperties": [], "properties": [ { "type": "ObjectTypeProperty", - "start": 20, - "end": 35, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 17 - } - }, + "start":20,"end":35,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":17}}, "key": { "type": "Identifier", - "start": 24, - "end": 25, - "loc": { - "start": { - "line": 2, - "column": 6 - }, - "end": { - "line": 2, - "column": 7 - }, - "identifierName": "a" - }, + "start":24,"end":25,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":7},"identifierName":"a"}, "name": "a" }, "static": false, @@ -117,68 +38,23 @@ "method": true, "value": { "type": "FunctionTypeAnnotation", - "start": 20, - "end": 35, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 17 - } - }, + "start":20,"end":35,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":17}}, "params": [], "rest": null, "typeParameters": null, "returnType": { "type": "NumberTypeAnnotation", - "start": 29, - "end": 35, - "loc": { - "start": { - "line": 2, - "column": 11 - }, - "end": { - "line": 2, - "column": 17 - } - } + "start":29,"end":35,"loc":{"start":{"line":2,"column":11},"end":{"line":2,"column":17}} } }, "optional": false }, { "type": "ObjectTypeProperty", - "start": 39, - "end": 61, - "loc": { - "start": { - "line": 3, - "column": 2 - }, - "end": { - "line": 3, - "column": 24 - } - }, + "start":39,"end":61,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":24}}, "key": { "type": "Identifier", - "start": 43, - "end": 44, - "loc": { - "start": { - "line": 3, - "column": 6 - }, - "end": { - "line": 3, - "column": 7 - }, - "identifierName": "b" - }, + "start":43,"end":44,"loc":{"start":{"line":3,"column":6},"end":{"line":3,"column":7},"identifierName":"b"}, "name": "b" }, "static": false, @@ -187,65 +63,20 @@ "method": true, "value": { "type": "FunctionTypeAnnotation", - "start": 39, - "end": 61, - "loc": { - "start": { - "line": 3, - "column": 2 - }, - "end": { - "line": 3, - "column": 24 - } - }, + "start":39,"end":61,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":24}}, "params": [ { "type": "FunctionTypeParam", - "start": 45, - "end": 54, - "loc": { - "start": { - "line": 3, - "column": 8 - }, - "end": { - "line": 3, - "column": 17 - } - }, + "start":45,"end":54,"loc":{"start":{"line":3,"column":8},"end":{"line":3,"column":17}}, "name": { "type": "Identifier", - "start": 45, - "end": 46, - "loc": { - "start": { - "line": 3, - "column": 8 - }, - "end": { - "line": 3, - "column": 9 - }, - "identifierName": "a" - }, + "start":45,"end":46,"loc":{"start":{"line":3,"column":8},"end":{"line":3,"column":9},"identifierName":"a"}, "name": "a" }, "optional": false, "typeAnnotation": { "type": "NumberTypeAnnotation", - "start": 48, - "end": 54, - "loc": { - "start": { - "line": 3, - "column": 11 - }, - "end": { - "line": 3, - "column": 17 - } - } + "start":48,"end":54,"loc":{"start":{"line":3,"column":11},"end":{"line":3,"column":17}} } } ], @@ -253,50 +84,17 @@ "typeParameters": null, "returnType": { "type": "VoidTypeAnnotation", - "start": 57, - "end": 61, - "loc": { - "start": { - "line": 3, - "column": 20 - }, - "end": { - "line": 3, - "column": 24 - } - } + "start":57,"end":61,"loc":{"start":{"line":3,"column":20},"end":{"line":3,"column":24}} } }, "optional": false }, { "type": "ObjectTypeProperty", - "start": 65, - "end": 82, - "loc": { - "start": { - "line": 4, - "column": 2 - }, - "end": { - "line": 4, - "column": 19 - } - }, + "start":65,"end":82,"loc":{"start":{"line":4,"column":2},"end":{"line":4,"column":19}}, "key": { "type": "StringLiteral", - "start": 69, - "end": 72, - "loc": { - "start": { - "line": 4, - "column": 6 - }, - "end": { - "line": 4, - "column": 9 - } - }, + "start":69,"end":72,"loc":{"start":{"line":4,"column":6},"end":{"line":4,"column":9}}, "extra": { "rawValue": "c", "raw": "\"c\"" @@ -309,67 +107,23 @@ "method": true, "value": { "type": "FunctionTypeAnnotation", - "start": 65, - "end": 82, - "loc": { - "start": { - "line": 4, - "column": 2 - }, - "end": { - "line": 4, - "column": 19 - } - }, + "start":65,"end":82,"loc":{"start":{"line":4,"column":2},"end":{"line":4,"column":19}}, "params": [], "rest": null, "typeParameters": null, "returnType": { "type": "NumberTypeAnnotation", - "start": 76, - "end": 82, - "loc": { - "start": { - "line": 4, - "column": 13 - }, - "end": { - "line": 4, - "column": 19 - } - } + "start":76,"end":82,"loc":{"start":{"line":4,"column":13},"end":{"line":4,"column":19}} } }, "optional": false }, { "type": "ObjectTypeProperty", - "start": 86, - "end": 110, - "loc": { - "start": { - "line": 5, - "column": 2 - }, - "end": { - "line": 5, - "column": 26 - } - }, + "start":86,"end":110,"loc":{"start":{"line":5,"column":2},"end":{"line":5,"column":26}}, "key": { "type": "StringLiteral", - "start": 90, - "end": 93, - "loc": { - "start": { - "line": 5, - "column": 6 - }, - "end": { - "line": 5, - "column": 9 - } - }, + "start":90,"end":93,"loc":{"start":{"line":5,"column":6},"end":{"line":5,"column":9}}, "extra": { "rawValue": "d", "raw": "\"d\"" @@ -382,65 +136,20 @@ "method": true, "value": { "type": "FunctionTypeAnnotation", - "start": 86, - "end": 110, - "loc": { - "start": { - "line": 5, - "column": 2 - }, - "end": { - "line": 5, - "column": 26 - } - }, + "start":86,"end":110,"loc":{"start":{"line":5,"column":2},"end":{"line":5,"column":26}}, "params": [ { "type": "FunctionTypeParam", - "start": 94, - "end": 103, - "loc": { - "start": { - "line": 5, - "column": 10 - }, - "end": { - "line": 5, - "column": 19 - } - }, + "start":94,"end":103,"loc":{"start":{"line":5,"column":10},"end":{"line":5,"column":19}}, "name": { "type": "Identifier", - "start": 94, - "end": 95, - "loc": { - "start": { - "line": 5, - "column": 10 - }, - "end": { - "line": 5, - "column": 11 - }, - "identifierName": "a" - }, + "start":94,"end":95,"loc":{"start":{"line":5,"column":10},"end":{"line":5,"column":11},"identifierName":"a"}, "name": "a" }, "optional": false, "typeAnnotation": { "type": "NumberTypeAnnotation", - "start": 97, - "end": 103, - "loc": { - "start": { - "line": 5, - "column": 13 - }, - "end": { - "line": 5, - "column": 19 - } - } + "start":97,"end":103,"loc":{"start":{"line":5,"column":13},"end":{"line":5,"column":19}} } } ], @@ -448,50 +157,17 @@ "typeParameters": null, "returnType": { "type": "VoidTypeAnnotation", - "start": 106, - "end": 110, - "loc": { - "start": { - "line": 5, - "column": 22 - }, - "end": { - "line": 5, - "column": 26 - } - } + "start":106,"end":110,"loc":{"start":{"line":5,"column":22},"end":{"line":5,"column":26}} } }, "optional": false }, { "type": "ObjectTypeProperty", - "start": 114, - "end": 129, - "loc": { - "start": { - "line": 6, - "column": 2 - }, - "end": { - "line": 6, - "column": 17 - } - }, + "start":114,"end":129,"loc":{"start":{"line":6,"column":2},"end":{"line":6,"column":17}}, "key": { "type": "NumericLiteral", - "start": 118, - "end": 119, - "loc": { - "start": { - "line": 6, - "column": 6 - }, - "end": { - "line": 6, - "column": 7 - } - }, + "start":118,"end":119,"loc":{"start":{"line":6,"column":6},"end":{"line":6,"column":7}}, "extra": { "rawValue": 1, "raw": "1" @@ -504,67 +180,23 @@ "method": true, "value": { "type": "FunctionTypeAnnotation", - "start": 114, - "end": 129, - "loc": { - "start": { - "line": 6, - "column": 2 - }, - "end": { - "line": 6, - "column": 17 - } - }, + "start":114,"end":129,"loc":{"start":{"line":6,"column":2},"end":{"line":6,"column":17}}, "params": [], "rest": null, "typeParameters": null, "returnType": { "type": "NumberTypeAnnotation", - "start": 123, - "end": 129, - "loc": { - "start": { - "line": 6, - "column": 11 - }, - "end": { - "line": 6, - "column": 17 - } - } + "start":123,"end":129,"loc":{"start":{"line":6,"column":11},"end":{"line":6,"column":17}} } }, "optional": false }, { "type": "ObjectTypeProperty", - "start": 133, - "end": 155, - "loc": { - "start": { - "line": 7, - "column": 2 - }, - "end": { - "line": 7, - "column": 24 - } - }, + "start":133,"end":155,"loc":{"start":{"line":7,"column":2},"end":{"line":7,"column":24}}, "key": { "type": "NumericLiteral", - "start": 137, - "end": 138, - "loc": { - "start": { - "line": 7, - "column": 6 - }, - "end": { - "line": 7, - "column": 7 - } - }, + "start":137,"end":138,"loc":{"start":{"line":7,"column":6},"end":{"line":7,"column":7}}, "extra": { "rawValue": 2, "raw": "2" @@ -577,65 +209,20 @@ "method": true, "value": { "type": "FunctionTypeAnnotation", - "start": 133, - "end": 155, - "loc": { - "start": { - "line": 7, - "column": 2 - }, - "end": { - "line": 7, - "column": 24 - } - }, + "start":133,"end":155,"loc":{"start":{"line":7,"column":2},"end":{"line":7,"column":24}}, "params": [ { "type": "FunctionTypeParam", - "start": 139, - "end": 148, - "loc": { - "start": { - "line": 7, - "column": 8 - }, - "end": { - "line": 7, - "column": 17 - } - }, + "start":139,"end":148,"loc":{"start":{"line":7,"column":8},"end":{"line":7,"column":17}}, "name": { "type": "Identifier", - "start": 139, - "end": 140, - "loc": { - "start": { - "line": 7, - "column": 8 - }, - "end": { - "line": 7, - "column": 9 - }, - "identifierName": "a" - }, + "start":139,"end":140,"loc":{"start":{"line":7,"column":8},"end":{"line":7,"column":9},"identifierName":"a"}, "name": "a" }, "optional": false, "typeAnnotation": { "type": "NumberTypeAnnotation", - "start": 142, - "end": 148, - "loc": { - "start": { - "line": 7, - "column": 11 - }, - "end": { - "line": 7, - "column": 17 - } - } + "start":142,"end":148,"loc":{"start":{"line":7,"column":11},"end":{"line":7,"column":17}} } } ], @@ -643,18 +230,7 @@ "typeParameters": null, "returnType": { "type": "VoidTypeAnnotation", - "start": 151, - "end": 155, - "loc": { - "start": { - "line": 7, - "column": 20 - }, - "end": { - "line": 7, - "column": 24 - } - } + "start":151,"end":155,"loc":{"start":{"line":7,"column":20},"end":{"line":7,"column":24}} } }, "optional": false diff --git a/packages/babel-parser/test/fixtures/flow/class-properties/method-named-declare/input.js b/packages/babel-parser/test/fixtures/flow/class-properties/method-named-declare/input.js new file mode 100644 index 000000000000..a1c623ac12a8 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/class-properties/method-named-declare/input.js @@ -0,0 +1,3 @@ +class A { + declare() {} +} diff --git a/packages/babel-parser/test/fixtures/flow/class-properties/method-named-declare/output.json b/packages/babel-parser/test/fixtures/flow/class-properties/method-named-declare/output.json new file mode 100644 index 000000000000..3c3ef7f9c9b4 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/class-properties/method-named-declare/output.json @@ -0,0 +1,51 @@ +{ + "type": "File", + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "program": { + "type": "Program", + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "id": { + "type": "Identifier", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":8,"end":26,"loc":{"start":{"line":1,"column":8},"end":{"line":3,"column":1}}, + "body": [ + { + "type": "ClassMethod", + "start":12,"end":24,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":14}}, + "kind": "method", + "computed": false, + "key": { + "type": "Identifier", + "start":12,"end":19,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":9},"identifierName":"declare"}, + "name": "declare" + }, + "static": false, + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":22,"end":24,"loc":{"start":{"line":2,"column":12},"end":{"line":2,"column":14}}, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/class-properties/named-static/output.json b/packages/babel-parser/test/fixtures/flow/class-properties/named-static/output.json index 81db15781250..bef3b94e5487 100644 --- a/packages/babel-parser/test/fixtures/flow/class-properties/named-static/output.json +++ b/packages/babel-parser/test/fixtures/flow/class-properties/named-static/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "DeclareClass", - "start": 0, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "id": { "type": "Identifier", - "start": 14, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - }, - "identifierName": "A" - }, + "start":14,"end":15,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":15},"identifierName":"A"}, "name": "A" }, "typeParameters": null, @@ -66,49 +21,15 @@ "mixins": [], "body": { "type": "ObjectTypeAnnotation", - "start": 16, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":16,"end":32,"loc":{"start":{"line":1,"column":16},"end":{"line":3,"column":1}}, "callProperties": [], "properties": [ { "type": "ObjectTypeProperty", - "start": 20, - "end": 29, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 11 - } - }, + "start":20,"end":29,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":11}}, "key": { "type": "Identifier", - "start": 20, - "end": 26, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 8 - }, - "identifierName": "static" - }, + "start":20,"end":26,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":8},"identifierName":"static"}, "name": "static" }, "static": false, @@ -117,34 +38,11 @@ "method": false, "value": { "type": "GenericTypeAnnotation", - "start": 28, - "end": 29, - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 11 - } - }, + "start":28,"end":29,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":11}}, "typeParameters": null, "id": { "type": "Identifier", - "start": 28, - "end": 29, - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 11 - }, - "identifierName": "T" - }, + "start":28,"end":29,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":11},"identifierName":"T"}, "name": "T" } }, diff --git a/packages/babel-parser/test/fixtures/flow/class-properties/options.json b/packages/babel-parser/test/fixtures/flow/class-properties/options.json new file mode 100644 index 000000000000..f7dcfe201b63 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/class-properties/options.json @@ -0,0 +1,4 @@ +{ + "sourceType": "module", + "plugins": ["flow", "classProperties"] +} diff --git a/packages/babel-parser/test/fixtures/flow/class-properties/static-declare-field/input.js b/packages/babel-parser/test/fixtures/flow/class-properties/static-declare-field/input.js new file mode 100644 index 000000000000..e7eae9b78e5a --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/class-properties/static-declare-field/input.js @@ -0,0 +1,3 @@ +class A { + static declare foo +} diff --git a/packages/babel-parser/test/fixtures/flow/class-properties/static-declare-field/options.json b/packages/babel-parser/test/fixtures/flow/class-properties/static-declare-field/options.json new file mode 100644 index 000000000000..43a82ec8a185 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/class-properties/static-declare-field/options.json @@ -0,0 +1,3 @@ +{ + "throws": "Unexpected token (2:17)" +} diff --git a/packages/babel-parser/test/fixtures/flow/class-properties/static-field-named-declare/input.js b/packages/babel-parser/test/fixtures/flow/class-properties/static-field-named-declare/input.js new file mode 100644 index 000000000000..79644eb64f74 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/class-properties/static-field-named-declare/input.js @@ -0,0 +1,3 @@ +class A { + static declare +} diff --git a/packages/babel-parser/test/fixtures/flow/class-properties/static-field-named-declare/output.json b/packages/babel-parser/test/fixtures/flow/class-properties/static-field-named-declare/output.json new file mode 100644 index 000000000000..9b452767270d --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/class-properties/static-field-named-declare/output.json @@ -0,0 +1,42 @@ +{ + "type": "File", + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "program": { + "type": "Program", + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "id": { + "type": "Identifier", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":8,"end":28,"loc":{"start":{"line":1,"column":8},"end":{"line":3,"column":1}}, + "body": [ + { + "type": "ClassProperty", + "start":12,"end":26,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":16}}, + "static": true, + "key": { + "type": "Identifier", + "start":19,"end":26,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":16},"identifierName":"declare"}, + "name": "declare" + }, + "computed": false, + "variance": null, + "value": null + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/classes/constructor-override-with-class-prop-plugin/options.json b/packages/babel-parser/test/fixtures/flow/classes/constructor-override-with-class-prop-plugin/options.json index 3c8f72c90062..192d7042e2c8 100644 --- a/packages/babel-parser/test/fixtures/flow/classes/constructor-override-with-class-prop-plugin/options.json +++ b/packages/babel-parser/test/fixtures/flow/classes/constructor-override-with-class-prop-plugin/options.json @@ -1,3 +1,4 @@ { + "sourceType": "module", "plugins": ["jsx", "flow", "classProperties"] } diff --git a/packages/babel-parser/test/fixtures/flow/classes/constructor-override-with-class-prop-plugin/output.json b/packages/babel-parser/test/fixtures/flow/classes/constructor-override-with-class-prop-plugin/output.json index 38c7d603748f..e7dba971db17 100644 --- a/packages/babel-parser/test/fixtures/flow/classes/constructor-override-with-class-prop-plugin/output.json +++ b/packages/babel-parser/test/fixtures/flow/classes/constructor-override-with-class-prop-plugin/output.json @@ -1,159 +1,50 @@ { "type": "File", - "start": 0, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":40,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "errors": [ + "SyntaxError: Classes may not have a field named 'constructor' (2:2)" + ], "program": { "type": "Program", - "start": 0, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":40,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":40,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "id": { "type": "Identifier", - "start": 6, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "Foo" - }, + "start":6,"end":9,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":9},"identifierName":"Foo"}, "name": "Foo" }, "superClass": null, "body": { "type": "ClassBody", - "start": 10, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":10,"end":40,"loc":{"start":{"line":1,"column":10},"end":{"line":3,"column":1}}, "body": [ { "type": "ClassProperty", - "start": 14, - "end": 38, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 26 - } - }, + "start":14,"end":38,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":26}}, "static": false, "key": { "type": "Identifier", - "start": 14, - "end": 25, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 13 - }, - "identifierName": "constructor" - }, + "start":14,"end":25,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":13},"identifierName":"constructor"}, "name": "constructor" }, "computed": false, "variance": null, "typeAnnotation": { "type": "TypeAnnotation", - "start": 25, - "end": 37, - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 25 - } - }, + "start":25,"end":37,"loc":{"start":{"line":2,"column":13},"end":{"line":2,"column":25}}, "typeAnnotation": { "type": "FunctionTypeAnnotation", - "start": 27, - "end": 37, - "loc": { - "start": { - "line": 2, - "column": 15 - }, - "end": { - "line": 2, - "column": 25 - } - }, + "start":27,"end":37,"loc":{"start":{"line":2,"column":15},"end":{"line":2,"column":25}}, "params": [], "rest": null, "returnType": { "type": "ThisTypeAnnotation", - "start": 33, - "end": 37, - "loc": { - "start": { - "line": 2, - "column": 21 - }, - "end": { - "line": 2, - "column": 25 - } - } + "start":33,"end":37,"loc":{"start":{"line":2,"column":21},"end":{"line":2,"column":25}} }, "typeParameters": null } diff --git a/packages/babel-parser/test/fixtures/flow/classes/constructor-with-class-prop-plugin/output.json b/packages/babel-parser/test/fixtures/flow/classes/constructor-with-class-prop-plugin/output.json index d3b588235d88..145a6c321d8f 100644 --- a/packages/babel-parser/test/fixtures/flow/classes/constructor-with-class-prop-plugin/output.json +++ b/packages/babel-parser/test/fixtures/flow/classes/constructor-with-class-prop-plugin/output.json @@ -1,111 +1,32 @@ { "type": "File", - "start": 0, - "end": 56, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 1 - } - }, + "start":0,"end":56,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 56, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 1 - } - }, + "start":0,"end":56,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 56, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 1 - } - }, + "start":0,"end":56,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, "id": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "A" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, "name": "A" }, "superClass": null, "body": { "type": "ClassBody", - "start": 8, - "end": 56, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 5, - "column": 1 - } - }, + "start":8,"end":56,"loc":{"start":{"line":1,"column":8},"end":{"line":5,"column":1}}, "body": [ { "type": "ClassMethod", - "start": 12, - "end": 54, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 4, - "column": 3 - } - }, + "start":12,"end":54,"loc":{"start":{"line":2,"column":2},"end":{"line":4,"column":3}}, "static": false, "key": { "type": "Identifier", - "start": 12, - "end": 23, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 13 - }, - "identifierName": "constructor" - }, + "start":12,"end":23,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":13},"identifierName":"constructor"}, "name": "constructor" }, "computed": false, @@ -117,95 +38,28 @@ "predicate": null, "returnType": { "type": "TypeAnnotation", - "start": 25, - "end": 33, - "loc": { - "start": { - "line": 2, - "column": 15 - }, - "end": { - "line": 2, - "column": 23 - } - }, + "start":25,"end":33,"loc":{"start":{"line":2,"column":15},"end":{"line":2,"column":23}}, "typeAnnotation": { "type": "GenericTypeAnnotation", - "start": 27, - "end": 33, - "loc": { - "start": { - "line": 2, - "column": 17 - }, - "end": { - "line": 2, - "column": 23 - } - }, + "start":27,"end":33,"loc":{"start":{"line":2,"column":17},"end":{"line":2,"column":23}}, "typeParameters": null, "id": { "type": "Identifier", - "start": 27, - "end": 33, - "loc": { - "start": { - "line": 2, - "column": 17 - }, - "end": { - "line": 2, - "column": 23 - }, - "identifierName": "Object" - }, + "start":27,"end":33,"loc":{"start":{"line":2,"column":17},"end":{"line":2,"column":23},"identifierName":"Object"}, "name": "Object" } } }, "body": { "type": "BlockStatement", - "start": 34, - "end": 54, - "loc": { - "start": { - "line": 2, - "column": 24 - }, - "end": { - "line": 4, - "column": 3 - } - }, + "start":34,"end":54,"loc":{"start":{"line":2,"column":24},"end":{"line":4,"column":3}}, "body": [ { "type": "ReturnStatement", - "start": 40, - "end": 50, - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 14 - } - }, + "start":40,"end":50,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":14}}, "argument": { "type": "ObjectExpression", - "start": 47, - "end": 49, - "loc": { - "start": { - "line": 3, - "column": 11 - }, - "end": { - "line": 3, - "column": 13 - } - }, + "start":47,"end":49,"loc":{"start":{"line":3,"column":11},"end":{"line":3,"column":13}}, "properties": [] } } diff --git a/packages/babel-parser/test/fixtures/flow/classes/good_01/output.json b/packages/babel-parser/test/fixtures/flow/classes/good_01/output.json index 17b274597f95..6a86583fe75d 100644 --- a/packages/babel-parser/test/fixtures/flow/classes/good_01/output.json +++ b/packages/babel-parser/test/fixtures/flow/classes/good_01/output.json @@ -1,159 +1,47 @@ { "type": "File", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "program": { "type": "Program", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "id": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "C" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"C"}, "name": "C" }, "superClass": null, "body": { "type": "ClassBody", - "start": 8, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":8,"end":24,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":24}}, "body": [ { "type": "ClassProperty", - "start": 10, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":10,"end":22,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":22}}, "static": false, "key": { "type": "Identifier", - "start": 10, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 15 - }, - "identifierName": "field" - }, + "start":10,"end":15,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":15},"identifierName":"field"}, "name": "field" }, "computed": false, "variance": null, "typeAnnotation": { "type": "TypeAnnotation", - "start": 15, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":15,"end":17,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":17}}, "typeAnnotation": { "type": "ExistsTypeAnnotation", - "start": 16, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - } + "start":16,"end":17,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":17}} } }, "value": { "type": "NullLiteral", - "start": 18, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 22 - } - } + "start":18,"end":22,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":22}} } } ] diff --git a/packages/babel-parser/test/fixtures/flow/classes/implements-multiple/output.json b/packages/babel-parser/test/fixtures/flow/classes/implements-multiple/output.json index 850b27d807b8..a899ee01d131 100644 --- a/packages/babel-parser/test/fixtures/flow/classes/implements-multiple/output.json +++ b/packages/babel-parser/test/fixtures/flow/classes/implements-multiple/output.json @@ -1,129 +1,38 @@ { "type": "File", - "start": 0, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, "program": { "type": "Program", - "start": 0, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, "id": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "A" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, "name": "A" }, "superClass": null, "implements": [ { "type": "ClassImplements", - "start": 19, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":19,"end":20,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":20}}, "id": { "type": "Identifier", - "start": 19, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 20 - }, - "identifierName": "B" - }, + "start":19,"end":20,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":20},"identifierName":"B"}, "name": "B" }, "typeParameters": null }, { "type": "ClassImplements", - "start": 22, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":22,"end":23,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":23}}, "id": { "type": "Identifier", - "start": 22, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 23 - }, - "identifierName": "C" - }, + "start":22,"end":23,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":23},"identifierName":"C"}, "name": "C" }, "typeParameters": null @@ -131,18 +40,7 @@ ], "body": { "type": "ClassBody", - "start": 24, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":24,"end":26,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":26}}, "body": [] } } diff --git a/packages/babel-parser/test/fixtures/flow/classes/implements/output.json b/packages/babel-parser/test/fixtures/flow/classes/implements/output.json index 421fef65d7df..9c4db1791064 100644 --- a/packages/babel-parser/test/fixtures/flow/classes/implements/output.json +++ b/packages/babel-parser/test/fixtures/flow/classes/implements/output.json @@ -1,96 +1,28 @@ { "type": "File", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "program": { "type": "Program", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "id": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "A" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, "name": "A" }, "superClass": null, "implements": [ { "type": "ClassImplements", - "start": 19, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":19,"end":20,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":20}}, "id": { "type": "Identifier", - "start": 19, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 20 - }, - "identifierName": "B" - }, + "start":19,"end":20,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":20},"identifierName":"B"}, "name": "B" }, "typeParameters": null @@ -98,18 +30,7 @@ ], "body": { "type": "ClassBody", - "start": 21, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":21,"end":23,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":23}}, "body": [] } } diff --git a/packages/babel-parser/test/fixtures/flow/comment-disabled/01-type-include/output.json b/packages/babel-parser/test/fixtures/flow/comment-disabled/01-type-include/output.json index 42033b969ac4..89c1664778b4 100644 --- a/packages/babel-parser/test/fixtures/flow/comment-disabled/01-type-include/output.json +++ b/packages/babel-parser/test/fixtures/flow/comment-disabled/01-type-include/output.json @@ -1,113 +1,35 @@ { "type": "File", - "start": 0, - "end": 68, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":0,"end":68,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 68, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":0,"end":68,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 68, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":0,"end":68,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, "id": { "type": "Identifier", - "start": 6, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 13 - }, - "identifierName": "MyClass" - }, + "start":6,"end":13,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":13},"identifierName":"MyClass"}, "name": "MyClass" }, "superClass": null, "body": { "type": "ClassBody", - "start": 14, - "end": 68, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":14,"end":68,"loc":{"start":{"line":1,"column":14},"end":{"line":4,"column":1}}, "body": [], "innerComments": [ { "type": "CommentBlock", "value": ":: prop: string; ", - "start": 18, - "end": 39, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 23 - } - } + "start":18,"end":39,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":23}} }, { "type": "CommentBlock", "value": " :: foo: number; ", - "start": 42, - "end": 66, - "loc": { - "start": { - "line": 3, - "column": 2 - }, - "end": { - "line": 3, - "column": 26 - } - } + "start":42,"end":66,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":26}} } ] } @@ -119,34 +41,12 @@ { "type": "CommentBlock", "value": ":: prop: string; ", - "start": 18, - "end": 39, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 23 - } - } + "start":18,"end":39,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":23}} }, { "type": "CommentBlock", "value": " :: foo: number; ", - "start": 42, - "end": 66, - "loc": { - "start": { - "line": 3, - "column": 2 - }, - "end": { - "line": 3, - "column": 26 - } - } + "start":42,"end":66,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":26}} } ] } \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/comment-disabled/02-type-include/output.json b/packages/babel-parser/test/fixtures/flow/comment-disabled/02-type-include/output.json index 36a3d22a48c0..42b8a0c60df1 100644 --- a/packages/babel-parser/test/fixtures/flow/comment-disabled/02-type-include/output.json +++ b/packages/babel-parser/test/fixtures/flow/comment-disabled/02-type-include/output.json @@ -1,31 +1,9 @@ { "type": "File", - "start": 0, - "end": 68, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 7, - "column": 2 - } - }, + "start":0,"end":68,"loc":{"start":{"line":1,"column":0},"end":{"line":7,"column":2}}, "program": { "type": "Program", - "start": 0, - "end": 68, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 7, - "column": 2 - } - }, + "start":0,"end":68,"loc":{"start":{"line":1,"column":0},"end":{"line":7,"column":2}}, "sourceType": "module", "interpreter": null, "body": [], @@ -34,18 +12,7 @@ { "type": "CommentBlock", "value": "::\ntype Foo = {\n foo: number,\n bar: boolean,\n baz: string\n};\n", - "start": 0, - "end": 68, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 7, - "column": 2 - } - } + "start":0,"end":68,"loc":{"start":{"line":1,"column":0},"end":{"line":7,"column":2}} } ] }, @@ -53,18 +20,7 @@ { "type": "CommentBlock", "value": "::\ntype Foo = {\n foo: number,\n bar: boolean,\n baz: string\n};\n", - "start": 0, - "end": 68, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 7, - "column": 2 - } - } + "start":0,"end":68,"loc":{"start":{"line":1,"column":0},"end":{"line":7,"column":2}} } ] } \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/comment-disabled/03-type-flow-include/output.json b/packages/babel-parser/test/fixtures/flow/comment-disabled/03-type-flow-include/output.json index 39c844aa9f01..dbead3f16c13 100644 --- a/packages/babel-parser/test/fixtures/flow/comment-disabled/03-type-flow-include/output.json +++ b/packages/babel-parser/test/fixtures/flow/comment-disabled/03-type-flow-include/output.json @@ -1,31 +1,9 @@ { "type": "File", - "start": 0, - "end": 79, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 7, - "column": 2 - } - }, + "start":0,"end":79,"loc":{"start":{"line":1,"column":0},"end":{"line":7,"column":2}}, "program": { "type": "Program", - "start": 0, - "end": 79, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 7, - "column": 2 - } - }, + "start":0,"end":79,"loc":{"start":{"line":1,"column":0},"end":{"line":7,"column":2}}, "sourceType": "module", "interpreter": null, "body": [], @@ -34,18 +12,7 @@ { "type": "CommentBlock", "value": " flow-include\ntype Foo = {\n foo: number,\n bar: boolean,\n baz: string\n};\n", - "start": 0, - "end": 79, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 7, - "column": 2 - } - } + "start":0,"end":79,"loc":{"start":{"line":1,"column":0},"end":{"line":7,"column":2}} } ] }, @@ -53,18 +20,7 @@ { "type": "CommentBlock", "value": " flow-include\ntype Foo = {\n foo: number,\n bar: boolean,\n baz: string\n};\n", - "start": 0, - "end": 79, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 7, - "column": 2 - } - } + "start":0,"end":79,"loc":{"start":{"line":1,"column":0},"end":{"line":7,"column":2}} } ] } \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/comment-disabled/04-type-flow-include/output.json b/packages/babel-parser/test/fixtures/flow/comment-disabled/04-type-flow-include/output.json index 8c2727c7eb82..b32b9fd88dfc 100644 --- a/packages/babel-parser/test/fixtures/flow/comment-disabled/04-type-flow-include/output.json +++ b/packages/babel-parser/test/fixtures/flow/comment-disabled/04-type-flow-include/output.json @@ -1,113 +1,35 @@ { "type": "File", - "start": 0, - "end": 90, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":0,"end":90,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 90, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":0,"end":90,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 90, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":0,"end":90,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, "id": { "type": "Identifier", - "start": 6, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 13 - }, - "identifierName": "MyClass" - }, + "start":6,"end":13,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":13},"identifierName":"MyClass"}, "name": "MyClass" }, "superClass": null, "body": { "type": "ClassBody", - "start": 14, - "end": 90, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":14,"end":90,"loc":{"start":{"line":1,"column":14},"end":{"line":4,"column":1}}, "body": [], "innerComments": [ { "type": "CommentBlock", "value": "flow-include prop: string; ", - "start": 18, - "end": 49, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 33 - } - } + "start":18,"end":49,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":33}} }, { "type": "CommentBlock", "value": " flow-include foo: number; ", - "start": 52, - "end": 88, - "loc": { - "start": { - "line": 3, - "column": 2 - }, - "end": { - "line": 3, - "column": 38 - } - } + "start":52,"end":88,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":38}} } ] } @@ -119,34 +41,12 @@ { "type": "CommentBlock", "value": "flow-include prop: string; ", - "start": 18, - "end": 49, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 33 - } - } + "start":18,"end":49,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":33}} }, { "type": "CommentBlock", "value": " flow-include foo: number; ", - "start": 52, - "end": 88, - "loc": { - "start": { - "line": 3, - "column": 2 - }, - "end": { - "line": 3, - "column": 38 - } - } + "start":52,"end":88,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":38}} } ] } \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/comment-disabled/05-type-annotation/output.json b/packages/babel-parser/test/fixtures/flow/comment-disabled/05-type-annotation/output.json index c78f286ee314..1735a998c005 100644 --- a/packages/babel-parser/test/fixtures/flow/comment-disabled/05-type-annotation/output.json +++ b/packages/babel-parser/test/fixtures/flow/comment-disabled/05-type-annotation/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 54, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 1 - } - }, + "start":0,"end":54,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 54, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 1 - } - }, + "start":0,"end":54,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":1}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 54, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 1 - } - }, + "start":0,"end":54,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":1}}, "id": { "type": "Identifier", - "start": 9, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 15 - }, - "identifierName": "method" - }, + "start":9,"end":15,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":15},"identifierName":"method"}, "name": "method" }, "generator": false, @@ -65,88 +20,32 @@ "params": [ { "type": "Identifier", - "start": 16, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 21 - }, - "identifierName": "param" - }, + "start":16,"end":21,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":21},"identifierName":"param"}, "name": "param", "trailingComments": [ { "type": "CommentBlock", "value": ": string ", - "start": 22, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 35 - } - } + "start":22,"end":35,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":35}} } ] } ], "body": { "type": "BlockStatement", - "start": 51, - "end": 54, - "loc": { - "start": { - "line": 1, - "column": 51 - }, - "end": { - "line": 2, - "column": 1 - } - }, + "start":51,"end":54,"loc":{"start":{"line":1,"column":51},"end":{"line":2,"column":1}}, "body": [], "directives": [], "leadingComments": [ { "type": "CommentBlock", "value": ": string ", - "start": 22, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 35 - } - } + "start":22,"end":35,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":35}} }, { "type": "CommentBlock", "value": ": number ", - "start": 37, - "end": 50, - "loc": { - "start": { - "line": 1, - "column": 37 - }, - "end": { - "line": 1, - "column": 50 - } - } + "start":37,"end":50,"loc":{"start":{"line":1,"column":37},"end":{"line":1,"column":50}} } ] } @@ -158,34 +57,12 @@ { "type": "CommentBlock", "value": ": string ", - "start": 22, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 35 - } - } + "start":22,"end":35,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":35}} }, { "type": "CommentBlock", "value": ": number ", - "start": 37, - "end": 50, - "loc": { - "start": { - "line": 1, - "column": 37 - }, - "end": { - "line": 1, - "column": 50 - } - } + "start":37,"end":50,"loc":{"start":{"line":1,"column":37},"end":{"line":1,"column":50}} } ] } \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/comment/01-type-include/output.json b/packages/babel-parser/test/fixtures/flow/comment/01-type-include/output.json index b31ea80c63cf..825d11b9844e 100644 --- a/packages/babel-parser/test/fixtures/flow/comment/01-type-include/output.json +++ b/packages/babel-parser/test/fixtures/flow/comment/01-type-include/output.json @@ -1,209 +1,63 @@ { "type": "File", - "start": 0, - "end": 74, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":0,"end":74,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 74, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":0,"end":74,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 74, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":0,"end":74,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, "id": { "type": "Identifier", - "start": 6, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 13 - }, - "identifierName": "MyClass" - }, + "start":6,"end":13,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":13},"identifierName":"MyClass"}, "name": "MyClass" }, "superClass": null, "body": { "type": "ClassBody", - "start": 14, - "end": 74, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":14,"end":74,"loc":{"start":{"line":1,"column":14},"end":{"line":4,"column":1}}, "body": [ { "type": "ClassProperty", - "start": 26, - "end": 39, - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 23 - } - }, + "start":26,"end":39,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":23}}, "static": false, "key": { "type": "Identifier", - "start": 26, - "end": 30, - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 14 - }, - "identifierName": "prop" - }, + "start":26,"end":30,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":14},"identifierName":"prop"}, "name": "prop" }, "computed": false, "variance": null, "typeAnnotation": { "type": "TypeAnnotation", - "start": 30, - "end": 38, - "loc": { - "start": { - "line": 2, - "column": 14 - }, - "end": { - "line": 2, - "column": 22 - } - }, + "start":30,"end":38,"loc":{"start":{"line":2,"column":14},"end":{"line":2,"column":22}}, "typeAnnotation": { "type": "StringTypeAnnotation", - "start": 32, - "end": 38, - "loc": { - "start": { - "line": 2, - "column": 16 - }, - "end": { - "line": 2, - "column": 22 - } - } + "start":32,"end":38,"loc":{"start":{"line":2,"column":16},"end":{"line":2,"column":22}} } }, "value": null }, { "type": "ClassProperty", - "start": 55, - "end": 69, - "loc": { - "start": { - "line": 3, - "column": 12 - }, - "end": { - "line": 3, - "column": 26 - } - }, + "start":55,"end":69,"loc":{"start":{"line":3,"column":12},"end":{"line":3,"column":26}}, "static": false, "key": { "type": "Identifier", - "start": 55, - "end": 60, - "loc": { - "start": { - "line": 3, - "column": 12 - }, - "end": { - "line": 3, - "column": 17 - }, - "identifierName": "prop2" - }, + "start":55,"end":60,"loc":{"start":{"line":3,"column":12},"end":{"line":3,"column":17},"identifierName":"prop2"}, "name": "prop2" }, "computed": false, "variance": null, "typeAnnotation": { "type": "TypeAnnotation", - "start": 60, - "end": 68, - "loc": { - "start": { - "line": 3, - "column": 17 - }, - "end": { - "line": 3, - "column": 25 - } - }, + "start":60,"end":68,"loc":{"start":{"line":3,"column":17},"end":{"line":3,"column":25}}, "typeAnnotation": { "type": "NumberTypeAnnotation", - "start": 62, - "end": 68, - "loc": { - "start": { - "line": 3, - "column": 19 - }, - "end": { - "line": 3, - "column": 25 - } - } + "start":62,"end":68,"loc":{"start":{"line":3,"column":19},"end":{"line":3,"column":25}} } }, "value": null diff --git a/packages/babel-parser/test/fixtures/flow/comment/02-type-include/output.json b/packages/babel-parser/test/fixtures/flow/comment/02-type-include/output.json index 0eb104082d54..b7c150fbef21 100644 --- a/packages/babel-parser/test/fixtures/flow/comment/02-type-include/output.json +++ b/packages/babel-parser/test/fixtures/flow/comment/02-type-include/output.json @@ -1,111 +1,32 @@ { "type": "File", - "start": 0, - "end": 68, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 7, - "column": 2 - } - }, + "start":0,"end":68,"loc":{"start":{"line":1,"column":0},"end":{"line":7,"column":2}}, "program": { "type": "Program", - "start": 0, - "end": 68, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 7, - "column": 2 - } - }, + "start":0,"end":68,"loc":{"start":{"line":1,"column":0},"end":{"line":7,"column":2}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "TypeAlias", - "start": 5, - "end": 65, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 6, - "column": 2 - } - }, + "start":5,"end":65,"loc":{"start":{"line":2,"column":0},"end":{"line":6,"column":2}}, "id": { "type": "Identifier", - "start": 10, - "end": 13, - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 8 - }, - "identifierName": "Foo" - }, + "start":10,"end":13,"loc":{"start":{"line":2,"column":5},"end":{"line":2,"column":8},"identifierName":"Foo"}, "name": "Foo" }, "typeParameters": null, "right": { "type": "ObjectTypeAnnotation", - "start": 16, - "end": 64, - "loc": { - "start": { - "line": 2, - "column": 11 - }, - "end": { - "line": 6, - "column": 1 - } - }, + "start":16,"end":64,"loc":{"start":{"line":2,"column":11},"end":{"line":6,"column":1}}, "callProperties": [], "properties": [ { "type": "ObjectTypeProperty", - "start": 20, - "end": 31, - "loc": { - "start": { - "line": 3, - "column": 2 - }, - "end": { - "line": 3, - "column": 13 - } - }, + "start":20,"end":31,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":13}}, "key": { "type": "Identifier", - "start": 20, - "end": 23, - "loc": { - "start": { - "line": 3, - "column": 2 - }, - "end": { - "line": 3, - "column": 5 - }, - "identifierName": "foo" - }, + "start":20,"end":23,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":5},"identifierName":"foo"}, "name": "foo" }, "static": false, @@ -114,51 +35,17 @@ "method": false, "value": { "type": "NumberTypeAnnotation", - "start": 25, - "end": 31, - "loc": { - "start": { - "line": 3, - "column": 7 - }, - "end": { - "line": 3, - "column": 13 - } - } + "start":25,"end":31,"loc":{"start":{"line":3,"column":7},"end":{"line":3,"column":13}} }, "variance": null, "optional": false }, { "type": "ObjectTypeProperty", - "start": 35, - "end": 47, - "loc": { - "start": { - "line": 4, - "column": 2 - }, - "end": { - "line": 4, - "column": 14 - } - }, + "start":35,"end":47,"loc":{"start":{"line":4,"column":2},"end":{"line":4,"column":14}}, "key": { "type": "Identifier", - "start": 35, - "end": 38, - "loc": { - "start": { - "line": 4, - "column": 2 - }, - "end": { - "line": 4, - "column": 5 - }, - "identifierName": "bar" - }, + "start":35,"end":38,"loc":{"start":{"line":4,"column":2},"end":{"line":4,"column":5},"identifierName":"bar"}, "name": "bar" }, "static": false, @@ -167,51 +54,17 @@ "method": false, "value": { "type": "BooleanTypeAnnotation", - "start": 40, - "end": 47, - "loc": { - "start": { - "line": 4, - "column": 7 - }, - "end": { - "line": 4, - "column": 14 - } - } + "start":40,"end":47,"loc":{"start":{"line":4,"column":7},"end":{"line":4,"column":14}} }, "variance": null, "optional": false }, { "type": "ObjectTypeProperty", - "start": 51, - "end": 62, - "loc": { - "start": { - "line": 5, - "column": 2 - }, - "end": { - "line": 5, - "column": 13 - } - }, + "start":51,"end":62,"loc":{"start":{"line":5,"column":2},"end":{"line":5,"column":13}}, "key": { "type": "Identifier", - "start": 51, - "end": 54, - "loc": { - "start": { - "line": 5, - "column": 2 - }, - "end": { - "line": 5, - "column": 5 - }, - "identifierName": "baz" - }, + "start":51,"end":54,"loc":{"start":{"line":5,"column":2},"end":{"line":5,"column":5},"identifierName":"baz"}, "name": "baz" }, "static": false, @@ -220,18 +73,7 @@ "method": false, "value": { "type": "StringTypeAnnotation", - "start": 56, - "end": 62, - "loc": { - "start": { - "line": 5, - "column": 7 - }, - "end": { - "line": 5, - "column": 13 - } - } + "start":56,"end":62,"loc":{"start":{"line":5,"column":7},"end":{"line":5,"column":13}} }, "variance": null, "optional": false diff --git a/packages/babel-parser/test/fixtures/flow/comment/03-type-flow-include/output.json b/packages/babel-parser/test/fixtures/flow/comment/03-type-flow-include/output.json index 567f48a615b3..0c7b19f03542 100644 --- a/packages/babel-parser/test/fixtures/flow/comment/03-type-flow-include/output.json +++ b/packages/babel-parser/test/fixtures/flow/comment/03-type-flow-include/output.json @@ -1,111 +1,32 @@ { "type": "File", - "start": 0, - "end": 79, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 7, - "column": 2 - } - }, + "start":0,"end":79,"loc":{"start":{"line":1,"column":0},"end":{"line":7,"column":2}}, "program": { "type": "Program", - "start": 0, - "end": 79, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 7, - "column": 2 - } - }, + "start":0,"end":79,"loc":{"start":{"line":1,"column":0},"end":{"line":7,"column":2}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "TypeAlias", - "start": 16, - "end": 76, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 6, - "column": 2 - } - }, + "start":16,"end":76,"loc":{"start":{"line":2,"column":0},"end":{"line":6,"column":2}}, "id": { "type": "Identifier", - "start": 21, - "end": 24, - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 8 - }, - "identifierName": "Foo" - }, + "start":21,"end":24,"loc":{"start":{"line":2,"column":5},"end":{"line":2,"column":8},"identifierName":"Foo"}, "name": "Foo" }, "typeParameters": null, "right": { "type": "ObjectTypeAnnotation", - "start": 27, - "end": 75, - "loc": { - "start": { - "line": 2, - "column": 11 - }, - "end": { - "line": 6, - "column": 1 - } - }, + "start":27,"end":75,"loc":{"start":{"line":2,"column":11},"end":{"line":6,"column":1}}, "callProperties": [], "properties": [ { "type": "ObjectTypeProperty", - "start": 31, - "end": 42, - "loc": { - "start": { - "line": 3, - "column": 2 - }, - "end": { - "line": 3, - "column": 13 - } - }, + "start":31,"end":42,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":13}}, "key": { "type": "Identifier", - "start": 31, - "end": 34, - "loc": { - "start": { - "line": 3, - "column": 2 - }, - "end": { - "line": 3, - "column": 5 - }, - "identifierName": "foo" - }, + "start":31,"end":34,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":5},"identifierName":"foo"}, "name": "foo" }, "static": false, @@ -114,51 +35,17 @@ "method": false, "value": { "type": "NumberTypeAnnotation", - "start": 36, - "end": 42, - "loc": { - "start": { - "line": 3, - "column": 7 - }, - "end": { - "line": 3, - "column": 13 - } - } + "start":36,"end":42,"loc":{"start":{"line":3,"column":7},"end":{"line":3,"column":13}} }, "variance": null, "optional": false }, { "type": "ObjectTypeProperty", - "start": 46, - "end": 58, - "loc": { - "start": { - "line": 4, - "column": 2 - }, - "end": { - "line": 4, - "column": 14 - } - }, + "start":46,"end":58,"loc":{"start":{"line":4,"column":2},"end":{"line":4,"column":14}}, "key": { "type": "Identifier", - "start": 46, - "end": 49, - "loc": { - "start": { - "line": 4, - "column": 2 - }, - "end": { - "line": 4, - "column": 5 - }, - "identifierName": "bar" - }, + "start":46,"end":49,"loc":{"start":{"line":4,"column":2},"end":{"line":4,"column":5},"identifierName":"bar"}, "name": "bar" }, "static": false, @@ -167,51 +54,17 @@ "method": false, "value": { "type": "BooleanTypeAnnotation", - "start": 51, - "end": 58, - "loc": { - "start": { - "line": 4, - "column": 7 - }, - "end": { - "line": 4, - "column": 14 - } - } + "start":51,"end":58,"loc":{"start":{"line":4,"column":7},"end":{"line":4,"column":14}} }, "variance": null, "optional": false }, { "type": "ObjectTypeProperty", - "start": 62, - "end": 73, - "loc": { - "start": { - "line": 5, - "column": 2 - }, - "end": { - "line": 5, - "column": 13 - } - }, + "start":62,"end":73,"loc":{"start":{"line":5,"column":2},"end":{"line":5,"column":13}}, "key": { "type": "Identifier", - "start": 62, - "end": 65, - "loc": { - "start": { - "line": 5, - "column": 2 - }, - "end": { - "line": 5, - "column": 5 - }, - "identifierName": "baz" - }, + "start":62,"end":65,"loc":{"start":{"line":5,"column":2},"end":{"line":5,"column":5},"identifierName":"baz"}, "name": "baz" }, "static": false, @@ -220,18 +73,7 @@ "method": false, "value": { "type": "StringTypeAnnotation", - "start": 67, - "end": 73, - "loc": { - "start": { - "line": 5, - "column": 7 - }, - "end": { - "line": 5, - "column": 13 - } - } + "start":67,"end":73,"loc":{"start":{"line":5,"column":7},"end":{"line":5,"column":13}} }, "variance": null, "optional": false diff --git a/packages/babel-parser/test/fixtures/flow/comment/04-type-flow-include/output.json b/packages/babel-parser/test/fixtures/flow/comment/04-type-flow-include/output.json index 908bfa823b79..27ae356bb388 100644 --- a/packages/babel-parser/test/fixtures/flow/comment/04-type-flow-include/output.json +++ b/packages/babel-parser/test/fixtures/flow/comment/04-type-flow-include/output.json @@ -1,209 +1,63 @@ { "type": "File", - "start": 0, - "end": 99, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":0,"end":99,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 99, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":0,"end":99,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 99, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":0,"end":99,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, "id": { "type": "Identifier", - "start": 6, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 13 - }, - "identifierName": "MyClass" - }, + "start":6,"end":13,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":13},"identifierName":"MyClass"}, "name": "MyClass" }, "superClass": null, "body": { "type": "ClassBody", - "start": 14, - "end": 99, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":14,"end":99,"loc":{"start":{"line":1,"column":14},"end":{"line":4,"column":1}}, "body": [ { "type": "ClassProperty", - "start": 39, - "end": 52, - "loc": { - "start": { - "line": 2, - "column": 23 - }, - "end": { - "line": 2, - "column": 36 - } - }, + "start":39,"end":52,"loc":{"start":{"line":2,"column":23},"end":{"line":2,"column":36}}, "static": false, "key": { "type": "Identifier", - "start": 39, - "end": 43, - "loc": { - "start": { - "line": 2, - "column": 23 - }, - "end": { - "line": 2, - "column": 27 - }, - "identifierName": "prop" - }, + "start":39,"end":43,"loc":{"start":{"line":2,"column":23},"end":{"line":2,"column":27},"identifierName":"prop"}, "name": "prop" }, "computed": false, "variance": null, "typeAnnotation": { "type": "TypeAnnotation", - "start": 43, - "end": 51, - "loc": { - "start": { - "line": 2, - "column": 27 - }, - "end": { - "line": 2, - "column": 35 - } - }, + "start":43,"end":51,"loc":{"start":{"line":2,"column":27},"end":{"line":2,"column":35}}, "typeAnnotation": { "type": "StringTypeAnnotation", - "start": 45, - "end": 51, - "loc": { - "start": { - "line": 2, - "column": 29 - }, - "end": { - "line": 2, - "column": 35 - } - } + "start":45,"end":51,"loc":{"start":{"line":2,"column":29},"end":{"line":2,"column":35}} } }, "value": null }, { "type": "ClassProperty", - "start": 80, - "end": 94, - "loc": { - "start": { - "line": 3, - "column": 24 - }, - "end": { - "line": 3, - "column": 38 - } - }, + "start":80,"end":94,"loc":{"start":{"line":3,"column":24},"end":{"line":3,"column":38}}, "static": false, "key": { "type": "Identifier", - "start": 80, - "end": 85, - "loc": { - "start": { - "line": 3, - "column": 24 - }, - "end": { - "line": 3, - "column": 29 - }, - "identifierName": "prop2" - }, + "start":80,"end":85,"loc":{"start":{"line":3,"column":24},"end":{"line":3,"column":29},"identifierName":"prop2"}, "name": "prop2" }, "computed": false, "variance": null, "typeAnnotation": { "type": "TypeAnnotation", - "start": 85, - "end": 93, - "loc": { - "start": { - "line": 3, - "column": 29 - }, - "end": { - "line": 3, - "column": 37 - } - }, + "start":85,"end":93,"loc":{"start":{"line":3,"column":29},"end":{"line":3,"column":37}}, "typeAnnotation": { "type": "NumberTypeAnnotation", - "start": 87, - "end": 93, - "loc": { - "start": { - "line": 3, - "column": 31 - }, - "end": { - "line": 3, - "column": 37 - } - } + "start":87,"end":93,"loc":{"start":{"line":3,"column":31},"end":{"line":3,"column":37}} } }, "value": null diff --git a/packages/babel-parser/test/fixtures/flow/comment/05-type-annotation/output.json b/packages/babel-parser/test/fixtures/flow/comment/05-type-annotation/output.json index e48859a099e9..e72e0dc362e3 100644 --- a/packages/babel-parser/test/fixtures/flow/comment/05-type-annotation/output.json +++ b/packages/babel-parser/test/fixtures/flow/comment/05-type-annotation/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 54, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 1 - } - }, + "start":0,"end":54,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 54, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 1 - } - }, + "start":0,"end":54,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":1}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 54, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 1 - } - }, + "start":0,"end":54,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":1}}, "id": { "type": "Identifier", - "start": 9, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 15 - }, - "identifierName": "method" - }, + "start":9,"end":15,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":15},"identifierName":"method"}, "name": "method" }, "generator": false, @@ -65,48 +20,14 @@ "params": [ { "type": "Identifier", - "start": 16, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 32 - }, - "identifierName": "param" - }, + "start":16,"end":32,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":32},"identifierName":"param"}, "name": "param", "typeAnnotation": { "type": "TypeAnnotation", - "start": 24, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":24,"end":32,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":32}}, "typeAnnotation": { "type": "StringTypeAnnotation", - "start": 26, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 32 - } - } + "start":26,"end":32,"loc":{"start":{"line":1,"column":26},"end":{"line":1,"column":32}} } } } @@ -114,48 +35,15 @@ "predicate": null, "returnType": { "type": "TypeAnnotation", - "start": 39, - "end": 47, - "loc": { - "start": { - "line": 1, - "column": 39 - }, - "end": { - "line": 1, - "column": 47 - } - }, + "start":39,"end":47,"loc":{"start":{"line":1,"column":39},"end":{"line":1,"column":47}}, "typeAnnotation": { "type": "NumberTypeAnnotation", - "start": 41, - "end": 47, - "loc": { - "start": { - "line": 1, - "column": 41 - }, - "end": { - "line": 1, - "column": 47 - } - } + "start":41,"end":47,"loc":{"start":{"line":1,"column":41},"end":{"line":1,"column":47}} } }, "body": { "type": "BlockStatement", - "start": 51, - "end": 54, - "loc": { - "start": { - "line": 1, - "column": 51 - }, - "end": { - "line": 2, - "column": 1 - } - }, + "start":51,"end":54,"loc":{"start":{"line":1,"column":51},"end":{"line":2,"column":1}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/flow/comment/12-line-comment-nested-invalid/options.json b/packages/babel-parser/test/fixtures/flow/comment/12-line-comment-nested-invalid/options.json deleted file mode 100644 index 9a7e0e3402af..000000000000 --- a/packages/babel-parser/test/fixtures/flow/comment/12-line-comment-nested-invalid/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unterminated flow-comment (1:13)" -} diff --git a/packages/babel-parser/test/fixtures/flow/comment/12-line-comment-nested-invalid/output.json b/packages/babel-parser/test/fixtures/flow/comment/12-line-comment-nested-invalid/output.json new file mode 100644 index 000000000000..6f4643e82a44 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/comment/12-line-comment-nested-invalid/output.json @@ -0,0 +1,29 @@ +{ + "type": "File", + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "errors": [ + "SyntaxError: Unterminated flow-comment (1:13)" + ], + "program": { + "type": "Program", + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "sourceType": "module", + "interpreter": null, + "body": [], + "directives": [], + "innerComments": [ + { + "type": "CommentLine", + "value": "asd */", + "start":5,"end":13,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":13}} + } + ] + }, + "comments": [ + { + "type": "CommentLine", + "value": "asd */", + "start":5,"end":13,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":13}} + } + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/comment/spread/output.json b/packages/babel-parser/test/fixtures/flow/comment/spread/output.json index 1c226515e08c..fb23d0c70944 100644 --- a/packages/babel-parser/test/fixtures/flow/comment/spread/output.json +++ b/packages/babel-parser/test/fixtures/flow/comment/spread/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 84, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":0,"end":84,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 84, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":0,"end":84,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 9, - "end": 84, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":9,"end":84,"loc":{"start":{"line":2,"column":0},"end":{"line":4,"column":1}}, "id": { "type": "Identifier", - "start": 18, - "end": 46, - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 37 - }, - "identifierName": "commentsAttachedToIdentifier" - }, + "start":18,"end":46,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":37},"identifierName":"commentsAttachedToIdentifier"}, "name": "commentsAttachedToIdentifier" }, "generator": false, @@ -65,160 +20,48 @@ "params": [], "body": { "type": "BlockStatement", - "start": 49, - "end": 84, - "loc": { - "start": { - "line": 2, - "column": 40 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":49,"end":84,"loc":{"start":{"line":2,"column":40},"end":{"line":4,"column":1}}, "body": [ { "type": "VariableDeclaration", - "start": 53, - "end": 82, - "loc": { - "start": { - "line": 3, - "column": 2 - }, - "end": { - "line": 3, - "column": 31 - } - }, + "start":53,"end":82,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":31}}, "declarations": [ { "type": "VariableDeclarator", - "start": 57, - "end": 81, - "loc": { - "start": { - "line": 3, - "column": 6 - }, - "end": { - "line": 3, - "column": 30 - } - }, + "start":57,"end":81,"loc":{"start":{"line":3,"column":6},"end":{"line":3,"column":30}}, "id": { "type": "Identifier", - "start": 57, - "end": 58, - "loc": { - "start": { - "line": 3, - "column": 6 - }, - "end": { - "line": 3, - "column": 7 - }, - "identifierName": "x" - }, + "start":57,"end":58,"loc":{"start":{"line":3,"column":6},"end":{"line":3,"column":7},"identifierName":"x"}, "name": "x" }, "init": { "type": "ArrowFunctionExpression", - "start": 61, - "end": 81, - "loc": { - "start": { - "line": 3, - "column": 10 - }, - "end": { - "line": 3, - "column": 30 - } - }, + "start":61,"end":81,"loc":{"start":{"line":3,"column":10},"end":{"line":3,"column":30}}, "id": null, "generator": false, "async": false, "params": [ { "type": "RestElement", - "start": 62, - "end": 74, - "loc": { - "start": { - "line": 3, - "column": 11 - }, - "end": { - "line": 3, - "column": 23 - } - }, + "start":62,"end":74,"loc":{"start":{"line":3,"column":11},"end":{"line":3,"column":23}}, "argument": { "type": "Identifier", - "start": 65, - "end": 69, - "loc": { - "start": { - "line": 3, - "column": 14 - }, - "end": { - "line": 3, - "column": 18 - }, - "identifierName": "args" - }, + "start":65,"end":69,"loc":{"start":{"line":3,"column":14},"end":{"line":3,"column":18},"identifierName":"args"}, "name": "args" }, "typeAnnotation": { "type": "TypeAnnotation", - "start": 69, - "end": 74, - "loc": { - "start": { - "line": 3, - "column": 18 - }, - "end": { - "line": 3, - "column": 23 - } - }, + "start":69,"end":74,"loc":{"start":{"line":3,"column":18},"end":{"line":3,"column":23}}, "typeAnnotation": { "type": "AnyTypeAnnotation", - "start": 71, - "end": 74, - "loc": { - "start": { - "line": 3, - "column": 20 - }, - "end": { - "line": 3, - "column": 23 - } - } + "start":71,"end":74,"loc":{"start":{"line":3,"column":20},"end":{"line":3,"column":23}} } } } ], "body": { "type": "BlockStatement", - "start": 79, - "end": 81, - "loc": { - "start": { - "line": 3, - "column": 28 - }, - "end": { - "line": 3, - "column": 30 - } - }, + "start":79,"end":81,"loc":{"start":{"line":3,"column":28},"end":{"line":3,"column":30}}, "body": [], "directives": [] } @@ -234,18 +77,7 @@ { "type": "CommentBlock", "value": " hi ", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - } + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}} } ] } @@ -256,18 +88,7 @@ { "type": "CommentBlock", "value": " hi ", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - } + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}} } ] } \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/declare-class/implements-multiple/output.json b/packages/babel-parser/test/fixtures/flow/declare-class/implements-multiple/output.json index 24f5486a6cca..79c281f985f6 100644 --- a/packages/babel-parser/test/fixtures/flow/declare-class/implements-multiple/output.json +++ b/packages/babel-parser/test/fixtures/flow/declare-class/implements-multiple/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, "program": { "type": "Program", - "start": 0, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "DeclareClass", - "start": 0, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, "id": { "type": "Identifier", - "start": 14, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - }, - "identifierName": "A" - }, + "start":14,"end":15,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":15},"identifierName":"A"}, "name": "A" }, "typeParameters": null, @@ -65,66 +20,20 @@ "implements": [ { "type": "InterfaceExtends", - "start": 27, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":27,"end":28,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":28}}, "id": { "type": "Identifier", - "start": 27, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 28 - }, - "identifierName": "B" - }, + "start":27,"end":28,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":28},"identifierName":"B"}, "name": "B" }, "typeParameters": null }, { "type": "InterfaceExtends", - "start": 30, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":30,"end":31,"loc":{"start":{"line":1,"column":30},"end":{"line":1,"column":31}}, "id": { "type": "Identifier", - "start": 30, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 1, - "column": 31 - }, - "identifierName": "C" - }, + "start":30,"end":31,"loc":{"start":{"line":1,"column":30},"end":{"line":1,"column":31},"identifierName":"C"}, "name": "C" }, "typeParameters": null @@ -133,18 +42,7 @@ "mixins": [], "body": { "type": "ObjectTypeAnnotation", - "start": 32, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 32 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":32,"end":34,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":34}}, "callProperties": [], "properties": [], "indexers": [], diff --git a/packages/babel-parser/test/fixtures/flow/declare-class/implements-with-mixin/output.json b/packages/babel-parser/test/fixtures/flow/declare-class/implements-with-mixin/output.json index d89a06c3aea6..80baf6d8b1b3 100644 --- a/packages/babel-parser/test/fixtures/flow/declare-class/implements-with-mixin/output.json +++ b/packages/babel-parser/test/fixtures/flow/declare-class/implements-with-mixin/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 40 - } - }, + "start":0,"end":40,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":40}}, "program": { "type": "Program", - "start": 0, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 40 - } - }, + "start":0,"end":40,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":40}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "DeclareClass", - "start": 0, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 40 - } - }, + "start":0,"end":40,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":40}}, "id": { "type": "Identifier", - "start": 14, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - }, - "identifierName": "A" - }, + "start":14,"end":15,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":15},"identifierName":"A"}, "name": "A" }, "typeParameters": null, @@ -65,33 +20,10 @@ "implements": [ { "type": "InterfaceExtends", - "start": 36, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 36 - }, - "end": { - "line": 1, - "column": 37 - } - }, + "start":36,"end":37,"loc":{"start":{"line":1,"column":36},"end":{"line":1,"column":37}}, "id": { "type": "Identifier", - "start": 36, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 36 - }, - "end": { - "line": 1, - "column": 37 - }, - "identifierName": "C" - }, + "start":36,"end":37,"loc":{"start":{"line":1,"column":36},"end":{"line":1,"column":37},"identifierName":"C"}, "name": "C" }, "typeParameters": null @@ -100,33 +32,10 @@ "mixins": [ { "type": "InterfaceExtends", - "start": 23, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":23,"end":24,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":24}}, "id": { "type": "Identifier", - "start": 23, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 24 - }, - "identifierName": "B" - }, + "start":23,"end":24,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":24},"identifierName":"B"}, "name": "B" }, "typeParameters": null @@ -134,18 +43,7 @@ ], "body": { "type": "ObjectTypeAnnotation", - "start": 38, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 38 - }, - "end": { - "line": 1, - "column": 40 - } - }, + "start":38,"end":40,"loc":{"start":{"line":1,"column":38},"end":{"line":1,"column":40}}, "callProperties": [], "properties": [], "indexers": [], diff --git a/packages/babel-parser/test/fixtures/flow/declare-class/implements/output.json b/packages/babel-parser/test/fixtures/flow/declare-class/implements/output.json index 1588d322386b..83755258dc41 100644 --- a/packages/babel-parser/test/fixtures/flow/declare-class/implements/output.json +++ b/packages/babel-parser/test/fixtures/flow/declare-class/implements/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, "program": { "type": "Program", - "start": 0, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "DeclareClass", - "start": 0, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, "id": { "type": "Identifier", - "start": 14, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - }, - "identifierName": "A" - }, + "start":14,"end":15,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":15},"identifierName":"A"}, "name": "A" }, "typeParameters": null, @@ -65,33 +20,10 @@ "implements": [ { "type": "InterfaceExtends", - "start": 27, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":27,"end":28,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":28}}, "id": { "type": "Identifier", - "start": 27, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 28 - }, - "identifierName": "B" - }, + "start":27,"end":28,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":28},"identifierName":"B"}, "name": "B" }, "typeParameters": null @@ -100,18 +32,7 @@ "mixins": [], "body": { "type": "ObjectTypeAnnotation", - "start": 29, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":29,"end":31,"loc":{"start":{"line":1,"column":29},"end":{"line":1,"column":31}}, "callProperties": [], "properties": [], "indexers": [], diff --git a/packages/babel-parser/test/fixtures/flow/declare-class/mixins-multiple/output.json b/packages/babel-parser/test/fixtures/flow/declare-class/mixins-multiple/output.json index 8cc1f0efa17a..917726c4bd56 100644 --- a/packages/babel-parser/test/fixtures/flow/declare-class/mixins-multiple/output.json +++ b/packages/babel-parser/test/fixtures/flow/declare-class/mixins-multiple/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, "program": { "type": "Program", - "start": 0, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "DeclareClass", - "start": 0, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, "id": { "type": "Identifier", - "start": 14, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - }, - "identifierName": "A" - }, + "start":14,"end":15,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":15},"identifierName":"A"}, "name": "A" }, "typeParameters": null, @@ -66,66 +21,20 @@ "mixins": [ { "type": "InterfaceExtends", - "start": 23, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":23,"end":24,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":24}}, "id": { "type": "Identifier", - "start": 23, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 24 - }, - "identifierName": "B" - }, + "start":23,"end":24,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":24},"identifierName":"B"}, "name": "B" }, "typeParameters": null }, { "type": "InterfaceExtends", - "start": 26, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":26,"end":27,"loc":{"start":{"line":1,"column":26},"end":{"line":1,"column":27}}, "id": { "type": "Identifier", - "start": 26, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 27 - }, - "identifierName": "C" - }, + "start":26,"end":27,"loc":{"start":{"line":1,"column":26},"end":{"line":1,"column":27},"identifierName":"C"}, "name": "C" }, "typeParameters": null @@ -133,18 +42,7 @@ ], "body": { "type": "ObjectTypeAnnotation", - "start": 28, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":28,"end":30,"loc":{"start":{"line":1,"column":28},"end":{"line":1,"column":30}}, "callProperties": [], "properties": [], "indexers": [], diff --git a/packages/babel-parser/test/fixtures/flow/declare-class/mixins/output.json b/packages/babel-parser/test/fixtures/flow/declare-class/mixins/output.json index 6e866c706cef..70d3ca7fafe8 100644 --- a/packages/babel-parser/test/fixtures/flow/declare-class/mixins/output.json +++ b/packages/babel-parser/test/fixtures/flow/declare-class/mixins/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, "program": { "type": "Program", - "start": 0, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "DeclareClass", - "start": 0, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, "id": { "type": "Identifier", - "start": 14, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - }, - "identifierName": "A" - }, + "start":14,"end":15,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":15},"identifierName":"A"}, "name": "A" }, "typeParameters": null, @@ -66,33 +21,10 @@ "mixins": [ { "type": "InterfaceExtends", - "start": 23, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":23,"end":24,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":24}}, "id": { "type": "Identifier", - "start": 23, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 24 - }, - "identifierName": "B" - }, + "start":23,"end":24,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":24},"identifierName":"B"}, "name": "B" }, "typeParameters": null @@ -100,18 +32,7 @@ ], "body": { "type": "ObjectTypeAnnotation", - "start": 25, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":25,"end":27,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":27}}, "callProperties": [], "properties": [], "indexers": [], diff --git a/packages/babel-parser/test/fixtures/flow/declare-export/export-class/output.json b/packages/babel-parser/test/fixtures/flow/declare-export/export-class/output.json index 3f8a99853e1c..7e96f7035a5f 100644 --- a/packages/babel-parser/test/fixtures/flow/declare-export/export-class/output.json +++ b/packages/babel-parser/test/fixtures/flow/declare-export/export-class/output.json @@ -1,62 +1,18 @@ { "type": "File", - "start": 0, - "end": 77, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 77 - } - }, + "start":0,"end":77,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":77}}, "program": { "type": "Program", - "start": 0, - "end": 77, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 77 - } - }, + "start":0,"end":77,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":77}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "DeclareModule", - "start": 0, - "end": 77, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 77 - } - }, + "start":0,"end":77,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":77}}, "id": { "type": "StringLiteral", - "start": 15, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":15,"end":20,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":20}}, "extra": { "rawValue": "foo", "raw": "\"foo\"" @@ -65,62 +21,17 @@ }, "body": { "type": "BlockStatement", - "start": 21, - "end": 77, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 77 - } - }, + "start":21,"end":77,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":77}}, "body": [ { "type": "DeclareExportDeclaration", - "start": 23, - "end": 75, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 75 - } - }, + "start":23,"end":75,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":75}}, "declaration": { "type": "DeclareClass", - "start": 38, - "end": 75, - "loc": { - "start": { - "line": 1, - "column": 38 - }, - "end": { - "line": 1, - "column": 75 - } - }, + "start":38,"end":75,"loc":{"start":{"line":1,"column":38},"end":{"line":1,"column":75}}, "id": { "type": "Identifier", - "start": 44, - "end": 47, - "loc": { - "start": { - "line": 1, - "column": 44 - }, - "end": { - "line": 1, - "column": 47 - }, - "identifierName": "Foo" - }, + "start":44,"end":47,"loc":{"start":{"line":1,"column":44},"end":{"line":1,"column":47},"identifierName":"Foo"}, "name": "Foo" }, "typeParameters": null, @@ -129,49 +40,15 @@ "mixins": [], "body": { "type": "ObjectTypeAnnotation", - "start": 48, - "end": 75, - "loc": { - "start": { - "line": 1, - "column": 48 - }, - "end": { - "line": 1, - "column": 75 - } - }, + "start":48,"end":75,"loc":{"start":{"line":1,"column":48},"end":{"line":1,"column":75}}, "callProperties": [], "properties": [ { "type": "ObjectTypeProperty", - "start": 50, - "end": 72, - "loc": { - "start": { - "line": 1, - "column": 50 - }, - "end": { - "line": 1, - "column": 72 - } - }, + "start":50,"end":72,"loc":{"start":{"line":1,"column":50},"end":{"line":1,"column":72}}, "key": { "type": "Identifier", - "start": 50, - "end": 54, - "loc": { - "start": { - "line": 1, - "column": 50 - }, - "end": { - "line": 1, - "column": 54 - }, - "identifierName": "meth" - }, + "start":50,"end":54,"loc":{"start":{"line":1,"column":50},"end":{"line":1,"column":54},"identifierName":"meth"}, "name": "meth" }, "static": false, @@ -180,65 +57,20 @@ "method": true, "value": { "type": "FunctionTypeAnnotation", - "start": 50, - "end": 72, - "loc": { - "start": { - "line": 1, - "column": 50 - }, - "end": { - "line": 1, - "column": 72 - } - }, + "start":50,"end":72,"loc":{"start":{"line":1,"column":50},"end":{"line":1,"column":72}}, "params": [ { "type": "FunctionTypeParam", - "start": 55, - "end": 65, - "loc": { - "start": { - "line": 1, - "column": 55 - }, - "end": { - "line": 1, - "column": 65 - } - }, + "start":55,"end":65,"loc":{"start":{"line":1,"column":55},"end":{"line":1,"column":65}}, "name": { "type": "Identifier", - "start": 55, - "end": 57, - "loc": { - "start": { - "line": 1, - "column": 55 - }, - "end": { - "line": 1, - "column": 57 - }, - "identifierName": "p1" - }, + "start":55,"end":57,"loc":{"start":{"line":1,"column":55},"end":{"line":1,"column":57},"identifierName":"p1"}, "name": "p1" }, "optional": false, "typeAnnotation": { "type": "NumberTypeAnnotation", - "start": 59, - "end": 65, - "loc": { - "start": { - "line": 1, - "column": 59 - }, - "end": { - "line": 1, - "column": 65 - } - } + "start":59,"end":65,"loc":{"start":{"line":1,"column":59},"end":{"line":1,"column":65}} } } ], @@ -246,18 +78,7 @@ "typeParameters": null, "returnType": { "type": "VoidTypeAnnotation", - "start": 68, - "end": 72, - "loc": { - "start": { - "line": 1, - "column": 68 - }, - "end": { - "line": 1, - "column": 72 - } - } + "start":68,"end":72,"loc":{"start":{"line":1,"column":68},"end":{"line":1,"column":72}} } }, "optional": false diff --git a/packages/babel-parser/test/fixtures/flow/declare-export/export-default-arrow/output.json b/packages/babel-parser/test/fixtures/flow/declare-export/export-default-arrow/output.json index ed758e8db455..f479dcf7f189 100644 --- a/packages/babel-parser/test/fixtures/flow/declare-export/export-default-arrow/output.json +++ b/packages/babel-parser/test/fixtures/flow/declare-export/export-default-arrow/output.json @@ -1,127 +1,38 @@ { "type": "File", - "start": 0, - "end": 43, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 43 - } - }, + "start":0,"end":43,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":43}}, "program": { "type": "Program", - "start": 0, - "end": 43, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 43 - } - }, + "start":0,"end":43,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":43}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "DeclareExportDeclaration", - "start": 0, - "end": 43, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 43 - } - }, + "start":0,"end":43,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":43}}, "declaration": { "type": "FunctionTypeAnnotation", - "start": 23, - "end": 43, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 43 - } - }, + "start":23,"end":43,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":43}}, "params": [ { "type": "FunctionTypeParam", - "start": 24, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":24,"end":32,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":32}}, "name": { "type": "Identifier", - "start": 24, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 25 - }, - "identifierName": "a" - }, + "start":24,"end":25,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":25},"identifierName":"a"}, "name": "a" }, "optional": false, "typeAnnotation": { "type": "NumberTypeAnnotation", - "start": 26, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 32 - } - } + "start":26,"end":32,"loc":{"start":{"line":1,"column":26},"end":{"line":1,"column":32}} } } ], "rest": null, "returnType": { "type": "NumberTypeAnnotation", - "start": 37, - "end": 43, - "loc": { - "start": { - "line": 1, - "column": 37 - }, - "end": { - "line": 1, - "column": 43 - } - } + "start":37,"end":43,"loc":{"start":{"line":1,"column":37},"end":{"line":1,"column":43}} }, "typeParameters": null }, diff --git a/packages/babel-parser/test/fixtures/flow/declare-export/export-default-class/output.json b/packages/babel-parser/test/fixtures/flow/declare-export/export-default-class/output.json index f6b7a9e9951a..add3d62cdb35 100644 --- a/packages/babel-parser/test/fixtures/flow/declare-export/export-default-class/output.json +++ b/packages/babel-parser/test/fixtures/flow/declare-export/export-default-class/output.json @@ -1,77 +1,21 @@ { "type": "File", - "start": 0, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, "program": { "type": "Program", - "start": 0, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "DeclareExportDeclaration", - "start": 0, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, "declaration": { "type": "DeclareClass", - "start": 23, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":23,"end":33,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":33}}, "id": { "type": "Identifier", - "start": 29, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 1, - "column": 30 - }, - "identifierName": "A" - }, + "start":29,"end":30,"loc":{"start":{"line":1,"column":29},"end":{"line":1,"column":30},"identifierName":"A"}, "name": "A" }, "typeParameters": null, @@ -80,18 +24,7 @@ "mixins": [], "body": { "type": "ObjectTypeAnnotation", - "start": 31, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 31 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":31,"end":33,"loc":{"start":{"line":1,"column":31},"end":{"line":1,"column":33}}, "callProperties": [], "properties": [], "indexers": [], @@ -103,18 +36,7 @@ }, { "type": "EmptyStatement", - "start": 33, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 33 - }, - "end": { - "line": 1, - "column": 34 - } - } + "start":33,"end":34,"loc":{"start":{"line":1,"column":33},"end":{"line":1,"column":34}} } ], "directives": [] diff --git a/packages/babel-parser/test/fixtures/flow/declare-export/export-default-function/output.json b/packages/babel-parser/test/fixtures/flow/declare-export/export-default-function/output.json index 77bff1a2d7be..670fd3f48b4f 100644 --- a/packages/babel-parser/test/fixtures/flow/declare-export/export-default-function/output.json +++ b/packages/babel-parser/test/fixtures/flow/declare-export/export-default-function/output.json @@ -1,172 +1,49 @@ { "type": "File", - "start": 0, - "end": 56, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 56 - } - }, + "start":0,"end":56,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":56}}, "program": { "type": "Program", - "start": 0, - "end": 56, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 56 - } - }, + "start":0,"end":56,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":56}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "DeclareExportDeclaration", - "start": 0, - "end": 56, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 56 - } - }, + "start":0,"end":56,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":56}}, "declaration": { "type": "DeclareFunction", - "start": 23, - "end": 56, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 56 - } - }, + "start":23,"end":56,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":56}}, "id": { "type": "Identifier", - "start": 32, - "end": 55, - "loc": { - "start": { - "line": 1, - "column": 32 - }, - "end": { - "line": 1, - "column": 55 - }, - "identifierName": "bar" - }, + "start":32,"end":55,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":55},"identifierName":"bar"}, "name": "bar", "typeAnnotation": { "type": "TypeAnnotation", - "start": 35, - "end": 55, - "loc": { - "start": { - "line": 1, - "column": 35 - }, - "end": { - "line": 1, - "column": 55 - } - }, + "start":35,"end":55,"loc":{"start":{"line":1,"column":35},"end":{"line":1,"column":55}}, "typeAnnotation": { "type": "FunctionTypeAnnotation", - "start": 35, - "end": 55, - "loc": { - "start": { - "line": 1, - "column": 35 - }, - "end": { - "line": 1, - "column": 55 - } - }, + "start":35,"end":55,"loc":{"start":{"line":1,"column":35},"end":{"line":1,"column":55}}, "typeParameters": null, "params": [ { "type": "FunctionTypeParam", - "start": 36, - "end": 46, - "loc": { - "start": { - "line": 1, - "column": 36 - }, - "end": { - "line": 1, - "column": 46 - } - }, + "start":36,"end":46,"loc":{"start":{"line":1,"column":36},"end":{"line":1,"column":46}}, "name": { "type": "Identifier", - "start": 36, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 36 - }, - "end": { - "line": 1, - "column": 38 - }, - "identifierName": "p1" - }, + "start":36,"end":38,"loc":{"start":{"line":1,"column":36},"end":{"line":1,"column":38},"identifierName":"p1"}, "name": "p1" }, "optional": false, "typeAnnotation": { "type": "NumberTypeAnnotation", - "start": 40, - "end": 46, - "loc": { - "start": { - "line": 1, - "column": 40 - }, - "end": { - "line": 1, - "column": 46 - } - } + "start":40,"end":46,"loc":{"start":{"line":1,"column":40},"end":{"line":1,"column":46}} } } ], "rest": null, "returnType": { "type": "StringTypeAnnotation", - "start": 49, - "end": 55, - "loc": { - "start": { - "line": 1, - "column": 49 - }, - "end": { - "line": 1, - "column": 55 - } - } + "start":49,"end":55,"loc":{"start":{"line":1,"column":49},"end":{"line":1,"column":55}} } } } diff --git a/packages/babel-parser/test/fixtures/flow/declare-export/export-default-union/output.json b/packages/babel-parser/test/fixtures/flow/declare-export/export-default-union/output.json index 6380a6ac4c97..fae958e6a266 100644 --- a/packages/babel-parser/test/fixtures/flow/declare-export/export-default-union/output.json +++ b/packages/babel-parser/test/fixtures/flow/declare-export/export-default-union/output.json @@ -1,62 +1,18 @@ { "type": "File", - "start": 0, - "end": 62, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 62 - } - }, + "start":0,"end":62,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":62}}, "program": { "type": "Program", - "start": 0, - "end": 62, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 62 - } - }, + "start":0,"end":62,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":62}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "DeclareModule", - "start": 0, - "end": 62, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 62 - } - }, + "start":0,"end":62,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":62}}, "id": { "type": "StringLiteral", - "start": 15, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":15,"end":20,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":20}}, "extra": { "rawValue": "foo", "raw": "\"foo\"" @@ -65,77 +21,22 @@ }, "body": { "type": "BlockStatement", - "start": 21, - "end": 62, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 62 - } - }, + "start":21,"end":62,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":62}}, "body": [ { "type": "DeclareExportDeclaration", - "start": 23, - "end": 60, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 60 - } - }, + "start":23,"end":60,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":60}}, "declaration": { "type": "UnionTypeAnnotation", - "start": 46, - "end": 59, - "loc": { - "start": { - "line": 1, - "column": 46 - }, - "end": { - "line": 1, - "column": 59 - } - }, + "start":46,"end":59,"loc":{"start":{"line":1,"column":46},"end":{"line":1,"column":59}}, "types": [ { "type": "NumberTypeAnnotation", - "start": 46, - "end": 52, - "loc": { - "start": { - "line": 1, - "column": 46 - }, - "end": { - "line": 1, - "column": 52 - } - } + "start":46,"end":52,"loc":{"start":{"line":1,"column":46},"end":{"line":1,"column":52}} }, { "type": "StringTypeAnnotation", - "start": 53, - "end": 59, - "loc": { - "start": { - "line": 1, - "column": 53 - }, - "end": { - "line": 1, - "column": 59 - } - } + "start":53,"end":59,"loc":{"start":{"line":1,"column":53},"end":{"line":1,"column":59}} } ] }, diff --git a/packages/babel-parser/test/fixtures/flow/declare-export/export-from/output.json b/packages/babel-parser/test/fixtures/flow/declare-export/export-from/output.json index a5a293536703..cf7aed016f9b 100644 --- a/packages/babel-parser/test/fixtures/flow/declare-export/export-from/output.json +++ b/packages/babel-parser/test/fixtures/flow/declare-export/export-from/output.json @@ -1,62 +1,18 @@ { "type": "File", - "start": 0, - "end": 56, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 56 - } - }, + "start":0,"end":56,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":56}}, "program": { "type": "Program", - "start": 0, - "end": 56, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 56 - } - }, + "start":0,"end":56,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":56}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "DeclareModule", - "start": 0, - "end": 56, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 56 - } - }, + "start":0,"end":56,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":56}}, "id": { "type": "StringLiteral", - "start": 15, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":15,"end":20,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":20}}, "extra": { "rawValue": "foo", "raw": "\"foo\"" @@ -65,105 +21,37 @@ }, "body": { "type": "BlockStatement", - "start": 21, - "end": 56, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 56 - } - }, + "start":21,"end":56,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":56}}, "body": [ { "type": "DeclareExportDeclaration", - "start": 23, - "end": 54, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 54 - } - }, - "declaration": null, + "start":23,"end":54,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":54}}, "specifiers": [ { "type": "ExportSpecifier", - "start": 39, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 39 - }, - "end": { - "line": 1, - "column": 40 - } - }, + "start":39,"end":40,"loc":{"start":{"line":1,"column":39},"end":{"line":1,"column":40}}, "local": { "type": "Identifier", - "start": 39, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 39 - }, - "end": { - "line": 1, - "column": 40 - }, - "identifierName": "a" - }, + "start":39,"end":40,"loc":{"start":{"line":1,"column":39},"end":{"line":1,"column":40},"identifierName":"a"}, "name": "a" }, "exported": { "type": "Identifier", - "start": 39, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 39 - }, - "end": { - "line": 1, - "column": 40 - }, - "identifierName": "a" - }, + "start":39,"end":40,"loc":{"start":{"line":1,"column":39},"end":{"line":1,"column":40},"identifierName":"a"}, "name": "a" } } ], "source": { "type": "StringLiteral", - "start": 48, - "end": 53, - "loc": { - "start": { - "line": 1, - "column": 48 - }, - "end": { - "line": 1, - "column": 53 - } - }, + "start":48,"end":53,"loc":{"start":{"line":1,"column":48},"end":{"line":1,"column":53}}, "extra": { "rawValue": "bar", "raw": "\"bar\"" }, "value": "bar" }, + "declaration": null, "default": false } ] diff --git a/packages/babel-parser/test/fixtures/flow/declare-export/export-function/output.json b/packages/babel-parser/test/fixtures/flow/declare-export/export-function/output.json index 05c38224f024..db29c7c10d2b 100644 --- a/packages/babel-parser/test/fixtures/flow/declare-export/export-function/output.json +++ b/packages/babel-parser/test/fixtures/flow/declare-export/export-function/output.json @@ -1,62 +1,18 @@ { "type": "File", - "start": 0, - "end": 73, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 73 - } - }, + "start":0,"end":73,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":73}}, "program": { "type": "Program", - "start": 0, - "end": 73, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 73 - } - }, + "start":0,"end":73,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":73}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "DeclareModule", - "start": 0, - "end": 73, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 73 - } - }, + "start":0,"end":73,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":73}}, "id": { "type": "StringLiteral", - "start": 15, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":15,"end":20,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":20}}, "extra": { "rawValue": "foo", "raw": "\"foo\"" @@ -65,157 +21,45 @@ }, "body": { "type": "BlockStatement", - "start": 21, - "end": 73, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 73 - } - }, + "start":21,"end":73,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":73}}, "body": [ { "type": "DeclareExportDeclaration", - "start": 23, - "end": 71, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 71 - } - }, + "start":23,"end":71,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":71}}, "declaration": { "type": "DeclareFunction", - "start": 38, - "end": 71, - "loc": { - "start": { - "line": 1, - "column": 38 - }, - "end": { - "line": 1, - "column": 71 - } - }, + "start":38,"end":71,"loc":{"start":{"line":1,"column":38},"end":{"line":1,"column":71}}, "id": { "type": "Identifier", - "start": 47, - "end": 70, - "loc": { - "start": { - "line": 1, - "column": 47 - }, - "end": { - "line": 1, - "column": 70 - }, - "identifierName": "bar" - }, + "start":47,"end":70,"loc":{"start":{"line":1,"column":47},"end":{"line":1,"column":70},"identifierName":"bar"}, "name": "bar", "typeAnnotation": { "type": "TypeAnnotation", - "start": 50, - "end": 70, - "loc": { - "start": { - "line": 1, - "column": 50 - }, - "end": { - "line": 1, - "column": 70 - } - }, + "start":50,"end":70,"loc":{"start":{"line":1,"column":50},"end":{"line":1,"column":70}}, "typeAnnotation": { "type": "FunctionTypeAnnotation", - "start": 50, - "end": 70, - "loc": { - "start": { - "line": 1, - "column": 50 - }, - "end": { - "line": 1, - "column": 70 - } - }, + "start":50,"end":70,"loc":{"start":{"line":1,"column":50},"end":{"line":1,"column":70}}, "typeParameters": null, "params": [ { "type": "FunctionTypeParam", - "start": 51, - "end": 61, - "loc": { - "start": { - "line": 1, - "column": 51 - }, - "end": { - "line": 1, - "column": 61 - } - }, + "start":51,"end":61,"loc":{"start":{"line":1,"column":51},"end":{"line":1,"column":61}}, "name": { "type": "Identifier", - "start": 51, - "end": 53, - "loc": { - "start": { - "line": 1, - "column": 51 - }, - "end": { - "line": 1, - "column": 53 - }, - "identifierName": "p1" - }, + "start":51,"end":53,"loc":{"start":{"line":1,"column":51},"end":{"line":1,"column":53},"identifierName":"p1"}, "name": "p1" }, "optional": false, "typeAnnotation": { "type": "NumberTypeAnnotation", - "start": 55, - "end": 61, - "loc": { - "start": { - "line": 1, - "column": 55 - }, - "end": { - "line": 1, - "column": 61 - } - } + "start":55,"end":61,"loc":{"start":{"line":1,"column":55},"end":{"line":1,"column":61}} } } ], "rest": null, "returnType": { "type": "StringTypeAnnotation", - "start": 64, - "end": 70, - "loc": { - "start": { - "line": 1, - "column": 64 - }, - "end": { - "line": 1, - "column": 70 - } - } + "start":64,"end":70,"loc":{"start":{"line":1,"column":64},"end":{"line":1,"column":70}} } } } diff --git a/packages/babel-parser/test/fixtures/flow/declare-export/export-interface-and-var/output.json b/packages/babel-parser/test/fixtures/flow/declare-export/export-interface-and-var/output.json index 740f88c56bc3..760524238b76 100644 --- a/packages/babel-parser/test/fixtures/flow/declare-export/export-interface-and-var/output.json +++ b/packages/babel-parser/test/fixtures/flow/declare-export/export-interface-and-var/output.json @@ -1,62 +1,18 @@ { "type": "File", - "start": 0, - "end": 88, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 88 - } - }, + "start":0,"end":88,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":88}}, "program": { "type": "Program", - "start": 0, - "end": 88, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 88 - } - }, + "start":0,"end":88,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":88}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "DeclareModule", - "start": 0, - "end": 88, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 88 - } - }, + "start":0,"end":88,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":88}}, "id": { "type": "StringLiteral", - "start": 15, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":15,"end":20,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":20}}, "extra": { "rawValue": "foo", "raw": "\"foo\"" @@ -65,64 +21,19 @@ }, "body": { "type": "BlockStatement", - "start": 21, - "end": 88, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 88 - } - }, + "start":21,"end":88,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":88}}, "body": [ { "type": "DeclareExportDeclaration", - "start": 23, - "end": 54, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 54 - } - }, + "start":23,"end":54,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":54}}, "specifiers": [], "source": null, "declaration": { "type": "InterfaceDeclaration", - "start": 38, - "end": 54, - "loc": { - "start": { - "line": 1, - "column": 38 - }, - "end": { - "line": 1, - "column": 54 - } - }, + "start":38,"end":54,"loc":{"start":{"line":1,"column":38},"end":{"line":1,"column":54}}, "id": { "type": "Identifier", - "start": 48, - "end": 51, - "loc": { - "start": { - "line": 1, - "column": 48 - }, - "end": { - "line": 1, - "column": 51 - }, - "identifierName": "bar" - }, + "start":48,"end":51,"loc":{"start":{"line":1,"column":48},"end":{"line":1,"column":51},"identifierName":"bar"}, "name": "bar" }, "typeParameters": null, @@ -131,18 +42,7 @@ "mixins": [], "body": { "type": "ObjectTypeAnnotation", - "start": 52, - "end": 54, - "loc": { - "start": { - "line": 1, - "column": 52 - }, - "end": { - "line": 1, - "column": 54 - } - }, + "start":52,"end":54,"loc":{"start":{"line":1,"column":52},"end":{"line":1,"column":54}}, "callProperties": [], "properties": [], "indexers": [], @@ -154,76 +54,20 @@ }, { "type": "DeclareExportDeclaration", - "start": 55, - "end": 86, - "loc": { - "start": { - "line": 1, - "column": 55 - }, - "end": { - "line": 1, - "column": 86 - } - }, + "start":55,"end":86,"loc":{"start":{"line":1,"column":55},"end":{"line":1,"column":86}}, "declaration": { "type": "DeclareVariable", - "start": 70, - "end": 86, - "loc": { - "start": { - "line": 1, - "column": 70 - }, - "end": { - "line": 1, - "column": 86 - } - }, + "start":70,"end":86,"loc":{"start":{"line":1,"column":70},"end":{"line":1,"column":86}}, "id": { "type": "Identifier", - "start": 74, - "end": 85, - "loc": { - "start": { - "line": 1, - "column": 74 - }, - "end": { - "line": 1, - "column": 85 - }, - "identifierName": "baz" - }, + "start":74,"end":85,"loc":{"start":{"line":1,"column":74},"end":{"line":1,"column":85},"identifierName":"baz"}, "name": "baz", "typeAnnotation": { "type": "TypeAnnotation", - "start": 77, - "end": 85, - "loc": { - "start": { - "line": 1, - "column": 77 - }, - "end": { - "line": 1, - "column": 85 - } - }, + "start":77,"end":85,"loc":{"start":{"line":1,"column":77},"end":{"line":1,"column":85}}, "typeAnnotation": { "type": "NumberTypeAnnotation", - "start": 79, - "end": 85, - "loc": { - "start": { - "line": 1, - "column": 79 - }, - "end": { - "line": 1, - "column": 85 - } - } + "start":79,"end":85,"loc":{"start":{"line":1,"column":79},"end":{"line":1,"column":85}} } } } diff --git a/packages/babel-parser/test/fixtures/flow/declare-export/export-interface-commonjs/output.json b/packages/babel-parser/test/fixtures/flow/declare-export/export-interface-commonjs/output.json index 2fb99dda68c1..d9726e70ef3d 100644 --- a/packages/babel-parser/test/fixtures/flow/declare-export/export-interface-commonjs/output.json +++ b/packages/babel-parser/test/fixtures/flow/declare-export/export-interface-commonjs/output.json @@ -1,62 +1,18 @@ { "type": "File", - "start": 0, - "end": 88, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 88 - } - }, + "start":0,"end":88,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":88}}, "program": { "type": "Program", - "start": 0, - "end": 88, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 88 - } - }, + "start":0,"end":88,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":88}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "DeclareModule", - "start": 0, - "end": 88, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 88 - } - }, + "start":0,"end":88,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":88}}, "id": { "type": "StringLiteral", - "start": 15, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":15,"end":20,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":20}}, "extra": { "rawValue": "foo", "raw": "\"foo\"" @@ -65,64 +21,19 @@ }, "body": { "type": "BlockStatement", - "start": 21, - "end": 88, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 88 - } - }, + "start":21,"end":88,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":88}}, "body": [ { "type": "DeclareExportDeclaration", - "start": 23, - "end": 54, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 54 - } - }, + "start":23,"end":54,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":54}}, "specifiers": [], "source": null, "declaration": { "type": "InterfaceDeclaration", - "start": 38, - "end": 54, - "loc": { - "start": { - "line": 1, - "column": 38 - }, - "end": { - "line": 1, - "column": 54 - } - }, + "start":38,"end":54,"loc":{"start":{"line":1,"column":38},"end":{"line":1,"column":54}}, "id": { "type": "Identifier", - "start": 48, - "end": 51, - "loc": { - "start": { - "line": 1, - "column": 48 - }, - "end": { - "line": 1, - "column": 51 - }, - "identifierName": "bar" - }, + "start":48,"end":51,"loc":{"start":{"line":1,"column":48},"end":{"line":1,"column":51},"identifierName":"bar"}, "name": "bar" }, "typeParameters": null, @@ -131,18 +42,7 @@ "mixins": [], "body": { "type": "ObjectTypeAnnotation", - "start": 52, - "end": 54, - "loc": { - "start": { - "line": 1, - "column": 52 - }, - "end": { - "line": 1, - "column": 54 - } - }, + "start":52,"end":54,"loc":{"start":{"line":1,"column":52},"end":{"line":1,"column":54}}, "callProperties": [], "properties": [], "indexers": [], @@ -154,46 +54,13 @@ }, { "type": "DeclareModuleExports", - "start": 55, - "end": 86, - "loc": { - "start": { - "line": 1, - "column": 55 - }, - "end": { - "line": 1, - "column": 86 - } - }, + "start":55,"end":86,"loc":{"start":{"line":1,"column":55},"end":{"line":1,"column":86}}, "typeAnnotation": { "type": "TypeAnnotation", - "start": 77, - "end": 85, - "loc": { - "start": { - "line": 1, - "column": 77 - }, - "end": { - "line": 1, - "column": 85 - } - }, + "start":77,"end":85,"loc":{"start":{"line":1,"column":77},"end":{"line":1,"column":85}}, "typeAnnotation": { "type": "NumberTypeAnnotation", - "start": 79, - "end": 85, - "loc": { - "start": { - "line": 1, - "column": 79 - }, - "end": { - "line": 1, - "column": 85 - } - } + "start":79,"end":85,"loc":{"start":{"line":1,"column":79},"end":{"line":1,"column":85}} } } } diff --git a/packages/babel-parser/test/fixtures/flow/declare-export/export-interface/output.json b/packages/babel-parser/test/fixtures/flow/declare-export/export-interface/output.json index a494879bac0d..7a59420775b2 100644 --- a/packages/babel-parser/test/fixtures/flow/declare-export/export-interface/output.json +++ b/packages/babel-parser/test/fixtures/flow/declare-export/export-interface/output.json @@ -1,62 +1,18 @@ { "type": "File", - "start": 0, - "end": 56, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 56 - } - }, + "start":0,"end":56,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":56}}, "program": { "type": "Program", - "start": 0, - "end": 56, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 56 - } - }, + "start":0,"end":56,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":56}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "DeclareModule", - "start": 0, - "end": 56, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 56 - } - }, + "start":0,"end":56,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":56}}, "id": { "type": "StringLiteral", - "start": 15, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":15,"end":20,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":20}}, "extra": { "rawValue": "foo", "raw": "\"foo\"" @@ -65,64 +21,19 @@ }, "body": { "type": "BlockStatement", - "start": 21, - "end": 56, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 56 - } - }, + "start":21,"end":56,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":56}}, "body": [ { "type": "DeclareExportDeclaration", - "start": 23, - "end": 54, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 54 - } - }, + "start":23,"end":54,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":54}}, "specifiers": [], "source": null, "declaration": { "type": "InterfaceDeclaration", - "start": 38, - "end": 54, - "loc": { - "start": { - "line": 1, - "column": 38 - }, - "end": { - "line": 1, - "column": 54 - } - }, + "start":38,"end":54,"loc":{"start":{"line":1,"column":38},"end":{"line":1,"column":54}}, "id": { "type": "Identifier", - "start": 48, - "end": 51, - "loc": { - "start": { - "line": 1, - "column": 48 - }, - "end": { - "line": 1, - "column": 51 - }, - "identifierName": "bar" - }, + "start":48,"end":51,"loc":{"start":{"line":1,"column":48},"end":{"line":1,"column":51},"identifierName":"bar"}, "name": "bar" }, "typeParameters": null, @@ -131,18 +42,7 @@ "mixins": [], "body": { "type": "ObjectTypeAnnotation", - "start": 52, - "end": 54, - "loc": { - "start": { - "line": 1, - "column": 52 - }, - "end": { - "line": 1, - "column": 54 - } - }, + "start":52,"end":54,"loc":{"start":{"line":1,"column":52},"end":{"line":1,"column":54}}, "callProperties": [], "properties": [], "indexers": [], diff --git a/packages/babel-parser/test/fixtures/flow/declare-export/export-named-pattern/output.json b/packages/babel-parser/test/fixtures/flow/declare-export/export-named-pattern/output.json index c3b63e8c2365..83207c37dbde 100644 --- a/packages/babel-parser/test/fixtures/flow/declare-export/export-named-pattern/output.json +++ b/packages/babel-parser/test/fixtures/flow/declare-export/export-named-pattern/output.json @@ -1,62 +1,18 @@ { "type": "File", - "start": 0, - "end": 52, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 6 - } - }, + "start":0,"end":52,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":6}}, "program": { "type": "Program", - "start": 0, - "end": 52, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 6 - } - }, + "start":0,"end":52,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":6}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "DeclareModule", - "start": 0, - "end": 45, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 45 - } - }, + "start":0,"end":45,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":45}}, "id": { "type": "StringLiteral", - "start": 15, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":15,"end":20,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":20}}, "extra": { "rawValue": "foo", "raw": "\"foo\"" @@ -65,80 +21,23 @@ }, "body": { "type": "BlockStatement", - "start": 21, - "end": 45, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 45 - } - }, + "start":21,"end":45,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":45}}, "body": [ { "type": "DeclareExportDeclaration", - "start": 23, - "end": 43, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 43 - } - }, + "start":23,"end":43,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":43}}, "specifiers": [ { "type": "ExportSpecifier", - "start": 39, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 39 - }, - "end": { - "line": 1, - "column": 40 - } - }, + "start":39,"end":40,"loc":{"start":{"line":1,"column":39},"end":{"line":1,"column":40}}, "local": { "type": "Identifier", - "start": 39, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 39 - }, - "end": { - "line": 1, - "column": 40 - }, - "identifierName": "a" - }, + "start":39,"end":40,"loc":{"start":{"line":1,"column":39},"end":{"line":1,"column":40},"identifierName":"a"}, "name": "a" }, "exported": { "type": "Identifier", - "start": 39, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 39 - }, - "end": { - "line": 1, - "column": 40 - }, - "identifierName": "a" - }, + "start":39,"end":40,"loc":{"start":{"line":1,"column":39},"end":{"line":1,"column":40},"identifierName":"a"}, "name": "a" } } @@ -153,48 +52,14 @@ }, { "type": "VariableDeclaration", - "start": 46, - "end": 52, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 6 - } - }, + "start":46,"end":52,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":6}}, "declarations": [ { "type": "VariableDeclarator", - "start": 50, - "end": 51, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 5 - } - }, + "start":50,"end":51,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":5}}, "id": { "type": "Identifier", - "start": 50, - "end": 51, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 5 - }, - "identifierName": "a" - }, + "start":50,"end":51,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":5},"identifierName":"a"}, "name": "a" }, "init": null diff --git a/packages/babel-parser/test/fixtures/flow/declare-export/export-star-as/options.json b/packages/babel-parser/test/fixtures/flow/declare-export/export-star-as/options.json index acd5b34be46d..698e7668500f 100644 --- a/packages/babel-parser/test/fixtures/flow/declare-export/export-star-as/options.json +++ b/packages/babel-parser/test/fixtures/flow/declare-export/export-star-as/options.json @@ -1,3 +1,3 @@ { - "plugins": ["jsx", "flow", "exportNamespaceFrom"] + "plugins": ["jsx", "flow"] } diff --git a/packages/babel-parser/test/fixtures/flow/declare-export/export-star-as/output.json b/packages/babel-parser/test/fixtures/flow/declare-export/export-star-as/output.json index 8363587b4d70..fbec921c6413 100644 --- a/packages/babel-parser/test/fixtures/flow/declare-export/export-star-as/output.json +++ b/packages/babel-parser/test/fixtures/flow/declare-export/export-star-as/output.json @@ -1,96 +1,29 @@ { "type": "File", - "start": 0, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, "program": { "type": "Program", - "start": 0, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "DeclareExportDeclaration", - "start": 0, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, "specifiers": [ { "type": "ExportNamespaceSpecifier", - "start": 15, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":15,"end":24,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":24}}, "exported": { "type": "Identifier", - "start": 20, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 24 - }, - "identifierName": "test" - }, + "start":20,"end":24,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":24},"identifierName":"test"}, "name": "test" } } ], "source": { "type": "StringLiteral", - "start": 30, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":30,"end":32,"loc":{"start":{"line":1,"column":30},"end":{"line":1,"column":32}}, "extra": { "rawValue": "", "raw": "''" diff --git a/packages/babel-parser/test/fixtures/flow/declare-export/export-star/output.json b/packages/babel-parser/test/fixtures/flow/declare-export/export-star/output.json index 74efda6cff09..367eb9f2033a 100644 --- a/packages/babel-parser/test/fixtures/flow/declare-export/export-star/output.json +++ b/packages/babel-parser/test/fixtures/flow/declare-export/export-star/output.json @@ -1,62 +1,18 @@ { "type": "File", - "start": 0, - "end": 53, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 53 - } - }, + "start":0,"end":53,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":53}}, "program": { "type": "Program", - "start": 0, - "end": 53, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 53 - } - }, + "start":0,"end":53,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":53}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "DeclareModule", - "start": 0, - "end": 53, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 53 - } - }, + "start":0,"end":53,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":53}}, "id": { "type": "StringLiteral", - "start": 15, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":15,"end":20,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":20}}, "extra": { "rawValue": "foo", "raw": "\"foo\"" @@ -65,47 +21,14 @@ }, "body": { "type": "BlockStatement", - "start": 21, - "end": 53, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 53 - } - }, + "start":21,"end":53,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":53}}, "body": [ { "type": "DeclareExportAllDeclaration", - "start": 23, - "end": 51, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 51 - } - }, + "start":23,"end":51,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":51}}, "source": { "type": "StringLiteral", - "start": 45, - "end": 50, - "loc": { - "start": { - "line": 1, - "column": 45 - }, - "end": { - "line": 1, - "column": 50 - } - }, + "start":45,"end":50,"loc":{"start":{"line":1,"column":45},"end":{"line":1,"column":50}}, "extra": { "rawValue": "bar", "raw": "\"bar\"" diff --git a/packages/babel-parser/test/fixtures/flow/declare-export/export-type-and-var/output.json b/packages/babel-parser/test/fixtures/flow/declare-export/export-type-and-var/output.json index df7282a5b0b1..3d09e16a996e 100644 --- a/packages/babel-parser/test/fixtures/flow/declare-export/export-type-and-var/output.json +++ b/packages/babel-parser/test/fixtures/flow/declare-export/export-type-and-var/output.json @@ -1,62 +1,18 @@ { "type": "File", - "start": 0, - "end": 90, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 90 - } - }, + "start":0,"end":90,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":90}}, "program": { "type": "Program", - "start": 0, - "end": 90, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 90 - } - }, + "start":0,"end":90,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":90}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "DeclareModule", - "start": 0, - "end": 90, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 90 - } - }, + "start":0,"end":90,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":90}}, "id": { "type": "StringLiteral", - "start": 15, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":15,"end":20,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":20}}, "extra": { "rawValue": "foo", "raw": "\"foo\"" @@ -65,157 +21,45 @@ }, "body": { "type": "BlockStatement", - "start": 21, - "end": 90, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 90 - } - }, + "start":21,"end":90,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":90}}, "body": [ { "type": "DeclareExportDeclaration", - "start": 23, - "end": 56, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 56 - } - }, + "start":23,"end":56,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":56}}, "specifiers": [], "source": null, "declaration": { "type": "TypeAlias", - "start": 38, - "end": 56, - "loc": { - "start": { - "line": 1, - "column": 38 - }, - "end": { - "line": 1, - "column": 56 - } - }, + "start":38,"end":56,"loc":{"start":{"line":1,"column":38},"end":{"line":1,"column":56}}, "id": { "type": "Identifier", - "start": 43, - "end": 46, - "loc": { - "start": { - "line": 1, - "column": 43 - }, - "end": { - "line": 1, - "column": 46 - }, - "identifierName": "bar" - }, + "start":43,"end":46,"loc":{"start":{"line":1,"column":43},"end":{"line":1,"column":46},"identifierName":"bar"}, "name": "bar" }, "typeParameters": null, "right": { "type": "NumberTypeAnnotation", - "start": 49, - "end": 55, - "loc": { - "start": { - "line": 1, - "column": 49 - }, - "end": { - "line": 1, - "column": 55 - } - } + "start":49,"end":55,"loc":{"start":{"line":1,"column":49},"end":{"line":1,"column":55}} } }, "default": false }, { "type": "DeclareExportDeclaration", - "start": 57, - "end": 88, - "loc": { - "start": { - "line": 1, - "column": 57 - }, - "end": { - "line": 1, - "column": 88 - } - }, + "start":57,"end":88,"loc":{"start":{"line":1,"column":57},"end":{"line":1,"column":88}}, "declaration": { "type": "DeclareVariable", - "start": 72, - "end": 88, - "loc": { - "start": { - "line": 1, - "column": 72 - }, - "end": { - "line": 1, - "column": 88 - } - }, + "start":72,"end":88,"loc":{"start":{"line":1,"column":72},"end":{"line":1,"column":88}}, "id": { "type": "Identifier", - "start": 76, - "end": 87, - "loc": { - "start": { - "line": 1, - "column": 76 - }, - "end": { - "line": 1, - "column": 87 - }, - "identifierName": "baz" - }, + "start":76,"end":87,"loc":{"start":{"line":1,"column":76},"end":{"line":1,"column":87},"identifierName":"baz"}, "name": "baz", "typeAnnotation": { "type": "TypeAnnotation", - "start": 79, - "end": 87, - "loc": { - "start": { - "line": 1, - "column": 79 - }, - "end": { - "line": 1, - "column": 87 - } - }, + "start":79,"end":87,"loc":{"start":{"line":1,"column":79},"end":{"line":1,"column":87}}, "typeAnnotation": { "type": "NumberTypeAnnotation", - "start": 81, - "end": 87, - "loc": { - "start": { - "line": 1, - "column": 81 - }, - "end": { - "line": 1, - "column": 87 - } - } + "start":81,"end":87,"loc":{"start":{"line":1,"column":81},"end":{"line":1,"column":87}} } } } diff --git a/packages/babel-parser/test/fixtures/flow/declare-export/export-type-commonjs/output.json b/packages/babel-parser/test/fixtures/flow/declare-export/export-type-commonjs/output.json index eb8a0af73833..6c04210e9a16 100644 --- a/packages/babel-parser/test/fixtures/flow/declare-export/export-type-commonjs/output.json +++ b/packages/babel-parser/test/fixtures/flow/declare-export/export-type-commonjs/output.json @@ -1,62 +1,18 @@ { "type": "File", - "start": 0, - "end": 90, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 90 - } - }, + "start":0,"end":90,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":90}}, "program": { "type": "Program", - "start": 0, - "end": 90, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 90 - } - }, + "start":0,"end":90,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":90}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "DeclareModule", - "start": 0, - "end": 90, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 90 - } - }, + "start":0,"end":90,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":90}}, "id": { "type": "StringLiteral", - "start": 15, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":15,"end":20,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":20}}, "extra": { "rawValue": "foo", "raw": "\"foo\"" @@ -65,127 +21,38 @@ }, "body": { "type": "BlockStatement", - "start": 21, - "end": 90, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 90 - } - }, + "start":21,"end":90,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":90}}, "body": [ { "type": "DeclareExportDeclaration", - "start": 23, - "end": 56, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 56 - } - }, + "start":23,"end":56,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":56}}, "specifiers": [], "source": null, "declaration": { "type": "TypeAlias", - "start": 38, - "end": 56, - "loc": { - "start": { - "line": 1, - "column": 38 - }, - "end": { - "line": 1, - "column": 56 - } - }, + "start":38,"end":56,"loc":{"start":{"line":1,"column":38},"end":{"line":1,"column":56}}, "id": { "type": "Identifier", - "start": 43, - "end": 46, - "loc": { - "start": { - "line": 1, - "column": 43 - }, - "end": { - "line": 1, - "column": 46 - }, - "identifierName": "bar" - }, + "start":43,"end":46,"loc":{"start":{"line":1,"column":43},"end":{"line":1,"column":46},"identifierName":"bar"}, "name": "bar" }, "typeParameters": null, "right": { "type": "NumberTypeAnnotation", - "start": 49, - "end": 55, - "loc": { - "start": { - "line": 1, - "column": 49 - }, - "end": { - "line": 1, - "column": 55 - } - } + "start":49,"end":55,"loc":{"start":{"line":1,"column":49},"end":{"line":1,"column":55}} } }, "default": false }, { "type": "DeclareModuleExports", - "start": 57, - "end": 88, - "loc": { - "start": { - "line": 1, - "column": 57 - }, - "end": { - "line": 1, - "column": 88 - } - }, + "start":57,"end":88,"loc":{"start":{"line":1,"column":57},"end":{"line":1,"column":88}}, "typeAnnotation": { "type": "TypeAnnotation", - "start": 79, - "end": 87, - "loc": { - "start": { - "line": 1, - "column": 79 - }, - "end": { - "line": 1, - "column": 87 - } - }, + "start":79,"end":87,"loc":{"start":{"line":1,"column":79},"end":{"line":1,"column":87}}, "typeAnnotation": { "type": "NumberTypeAnnotation", - "start": 81, - "end": 87, - "loc": { - "start": { - "line": 1, - "column": 81 - }, - "end": { - "line": 1, - "column": 87 - } - } + "start":81,"end":87,"loc":{"start":{"line":1,"column":81},"end":{"line":1,"column":87}} } } } diff --git a/packages/babel-parser/test/fixtures/flow/declare-export/export-type-star-from/output.json b/packages/babel-parser/test/fixtures/flow/declare-export/export-type-star-from/output.json index fb3c7035c60c..ea3b0a8201e9 100644 --- a/packages/babel-parser/test/fixtures/flow/declare-export/export-type-star-from/output.json +++ b/packages/babel-parser/test/fixtures/flow/declare-export/export-type-star-from/output.json @@ -1,62 +1,18 @@ { "type": "File", - "start": 0, - "end": 58, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 58 - } - }, + "start":0,"end":58,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":58}}, "program": { "type": "Program", - "start": 0, - "end": 58, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 58 - } - }, + "start":0,"end":58,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":58}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "DeclareModule", - "start": 0, - "end": 58, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 58 - } - }, + "start":0,"end":58,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":58}}, "id": { "type": "StringLiteral", - "start": 15, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":15,"end":20,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":20}}, "extra": { "rawValue": "foo", "raw": "\"foo\"" @@ -65,48 +21,15 @@ }, "body": { "type": "BlockStatement", - "start": 21, - "end": 58, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 58 - } - }, + "start":21,"end":58,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":58}}, "body": [ { "type": "DeclareExportAllDeclaration", - "start": 23, - "end": 56, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 56 - } - }, + "start":23,"end":56,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":56}}, "exportKind": "type", "source": { "type": "StringLiteral", - "start": 50, - "end": 55, - "loc": { - "start": { - "line": 1, - "column": 50 - }, - "end": { - "line": 1, - "column": 55 - } - }, + "start":50,"end":55,"loc":{"start":{"line":1,"column":50},"end":{"line":1,"column":55}}, "extra": { "rawValue": "bar", "raw": "\"bar\"" diff --git a/packages/babel-parser/test/fixtures/flow/declare-export/export-type/output.json b/packages/babel-parser/test/fixtures/flow/declare-export/export-type/output.json index f6916e197579..563b5a9fba2d 100644 --- a/packages/babel-parser/test/fixtures/flow/declare-export/export-type/output.json +++ b/packages/babel-parser/test/fixtures/flow/declare-export/export-type/output.json @@ -1,62 +1,18 @@ { "type": "File", - "start": 0, - "end": 58, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 58 - } - }, + "start":0,"end":58,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":58}}, "program": { "type": "Program", - "start": 0, - "end": 58, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 58 - } - }, + "start":0,"end":58,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":58}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "DeclareModule", - "start": 0, - "end": 58, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 58 - } - }, + "start":0,"end":58,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":58}}, "id": { "type": "StringLiteral", - "start": 15, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":15,"end":20,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":20}}, "extra": { "rawValue": "foo", "raw": "\"foo\"" @@ -65,81 +21,25 @@ }, "body": { "type": "BlockStatement", - "start": 21, - "end": 58, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 58 - } - }, + "start":21,"end":58,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":58}}, "body": [ { "type": "DeclareExportDeclaration", - "start": 23, - "end": 56, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 56 - } - }, + "start":23,"end":56,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":56}}, "specifiers": [], "source": null, "declaration": { "type": "TypeAlias", - "start": 38, - "end": 56, - "loc": { - "start": { - "line": 1, - "column": 38 - }, - "end": { - "line": 1, - "column": 56 - } - }, + "start":38,"end":56,"loc":{"start":{"line":1,"column":38},"end":{"line":1,"column":56}}, "id": { "type": "Identifier", - "start": 43, - "end": 46, - "loc": { - "start": { - "line": 1, - "column": 43 - }, - "end": { - "line": 1, - "column": 46 - }, - "identifierName": "bar" - }, + "start":43,"end":46,"loc":{"start":{"line":1,"column":43},"end":{"line":1,"column":46},"identifierName":"bar"}, "name": "bar" }, "typeParameters": null, "right": { "type": "NumberTypeAnnotation", - "start": 49, - "end": 55, - "loc": { - "start": { - "line": 1, - "column": 49 - }, - "end": { - "line": 1, - "column": 55 - } - } + "start":49,"end":55,"loc":{"start":{"line":1,"column":49},"end":{"line":1,"column":55}} } }, "default": false diff --git a/packages/babel-parser/test/fixtures/flow/declare-export/export-var/output.json b/packages/babel-parser/test/fixtures/flow/declare-export/export-var/output.json index ed757b4339c0..256231c0f437 100644 --- a/packages/babel-parser/test/fixtures/flow/declare-export/export-var/output.json +++ b/packages/babel-parser/test/fixtures/flow/declare-export/export-var/output.json @@ -1,62 +1,18 @@ { "type": "File", - "start": 0, - "end": 54, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 54 - } - }, + "start":0,"end":54,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":54}}, "program": { "type": "Program", - "start": 0, - "end": 54, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 54 - } - }, + "start":0,"end":54,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":54}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "DeclareModule", - "start": 0, - "end": 54, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 54 - } - }, + "start":0,"end":54,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":54}}, "id": { "type": "StringLiteral", - "start": 15, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":15,"end":20,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":20}}, "extra": { "rawValue": "foo", "raw": "\"foo\"" @@ -65,91 +21,24 @@ }, "body": { "type": "BlockStatement", - "start": 21, - "end": 54, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 54 - } - }, + "start":21,"end":54,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":54}}, "body": [ { "type": "DeclareExportDeclaration", - "start": 23, - "end": 52, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 52 - } - }, + "start":23,"end":52,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":52}}, "declaration": { "type": "DeclareVariable", - "start": 38, - "end": 52, - "loc": { - "start": { - "line": 1, - "column": 38 - }, - "end": { - "line": 1, - "column": 52 - } - }, + "start":38,"end":52,"loc":{"start":{"line":1,"column":38},"end":{"line":1,"column":52}}, "id": { "type": "Identifier", - "start": 42, - "end": 51, - "loc": { - "start": { - "line": 1, - "column": 42 - }, - "end": { - "line": 1, - "column": 51 - }, - "identifierName": "a" - }, + "start":42,"end":51,"loc":{"start":{"line":1,"column":42},"end":{"line":1,"column":51},"identifierName":"a"}, "name": "a", "typeAnnotation": { "type": "TypeAnnotation", - "start": 43, - "end": 51, - "loc": { - "start": { - "line": 1, - "column": 43 - }, - "end": { - "line": 1, - "column": 51 - } - }, + "start":43,"end":51,"loc":{"start":{"line":1,"column":43},"end":{"line":1,"column":51}}, "typeAnnotation": { "type": "NumberTypeAnnotation", - "start": 45, - "end": 51, - "loc": { - "start": { - "line": 1, - "column": 45 - }, - "end": { - "line": 1, - "column": 51 - } - } + "start":45,"end":51,"loc":{"start":{"line":1,"column":45},"end":{"line":1,"column":51}} } } } diff --git a/packages/babel-parser/test/fixtures/flow/declare-module/1/output.json b/packages/babel-parser/test/fixtures/flow/declare-module/1/output.json index f4f7fc14c04e..a2a16a81e020 100644 --- a/packages/babel-parser/test/fixtures/flow/declare-module/1/output.json +++ b/packages/babel-parser/test/fixtures/flow/declare-module/1/output.json @@ -1,79 +1,23 @@ { "type": "File", - "start": 0, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, "program": { "type": "Program", - "start": 0, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "DeclareModule", - "start": 0, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, "id": { "type": "Identifier", - "start": 15, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - }, - "identifierName": "A" - }, + "start":15,"end":16,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":16},"identifierName":"A"}, "name": "A" }, "body": { "type": "BlockStatement", - "start": 17, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":17,"end":19,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":19}}, "body": [] }, "kind": "CommonJS" diff --git a/packages/babel-parser/test/fixtures/flow/declare-module/10/output.json b/packages/babel-parser/test/fixtures/flow/declare-module/10/output.json index 84347d7d5618..ffea09887f0f 100644 --- a/packages/babel-parser/test/fixtures/flow/declare-module/10/output.json +++ b/packages/babel-parser/test/fixtures/flow/declare-module/10/output.json @@ -1,107 +1,29 @@ { "type": "File", - "start": 0, - "end": 42, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 42 - } - }, + "start":0,"end":42,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":42}}, "program": { "type": "Program", - "start": 0, - "end": 42, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 42 - } - }, + "start":0,"end":42,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":42}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "DeclareModuleExports", - "start": 0, - "end": 42, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 42 - } - }, + "start":0,"end":42,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":42}}, "typeAnnotation": { "type": "TypeAnnotation", - "start": 22, - "end": 42, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 42 - } - }, + "start":22,"end":42,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":42}}, "typeAnnotation": { "type": "ObjectTypeAnnotation", - "start": 24, - "end": 42, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 42 - } - }, + "start":24,"end":42,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":42}}, "callProperties": [], "properties": [ { "type": "ObjectTypeProperty", - "start": 26, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 39 - } - }, + "start":26,"end":39,"loc":{"start":{"line":1,"column":26},"end":{"line":1,"column":39}}, "key": { "type": "Identifier", - "start": 26, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 29 - }, - "identifierName": "foo" - }, + "start":26,"end":29,"loc":{"start":{"line":1,"column":26},"end":{"line":1,"column":29},"identifierName":"foo"}, "name": "foo" }, "static": false, @@ -110,35 +32,13 @@ "method": true, "value": { "type": "FunctionTypeAnnotation", - "start": 26, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 39 - } - }, + "start":26,"end":39,"loc":{"start":{"line":1,"column":26},"end":{"line":1,"column":39}}, "params": [], "rest": null, "typeParameters": null, "returnType": { "type": "NumberTypeAnnotation", - "start": 33, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 33 - }, - "end": { - "line": 1, - "column": 39 - } - } + "start":33,"end":39,"loc":{"start":{"line":1,"column":33},"end":{"line":1,"column":39}} } }, "optional": false diff --git a/packages/babel-parser/test/fixtures/flow/declare-module/2/output.json b/packages/babel-parser/test/fixtures/flow/declare-module/2/output.json index d232518f395f..530e73f24c70 100644 --- a/packages/babel-parser/test/fixtures/flow/declare-module/2/output.json +++ b/packages/babel-parser/test/fixtures/flow/declare-module/2/output.json @@ -1,62 +1,18 @@ { "type": "File", - "start": 0, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, "program": { "type": "Program", - "start": 0, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "DeclareModule", - "start": 0, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, "id": { "type": "StringLiteral", - "start": 15, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":15,"end":25,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":25}}, "extra": { "rawValue": "./a/b.js", "raw": "\"./a/b.js\"" @@ -65,18 +21,7 @@ }, "body": { "type": "BlockStatement", - "start": 26, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":26,"end":28,"loc":{"start":{"line":1,"column":26},"end":{"line":1,"column":28}}, "body": [] }, "kind": "CommonJS" diff --git a/packages/babel-parser/test/fixtures/flow/declare-module/3/output.json b/packages/babel-parser/test/fixtures/flow/declare-module/3/output.json index 3f8901ca6bd9..19be820441b1 100644 --- a/packages/babel-parser/test/fixtures/flow/declare-module/3/output.json +++ b/packages/babel-parser/test/fixtures/flow/declare-module/3/output.json @@ -1,138 +1,37 @@ { "type": "File", - "start": 0, - "end": 43, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 43 - } - }, + "start":0,"end":43,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":43}}, "program": { "type": "Program", - "start": 0, - "end": 43, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 43 - } - }, + "start":0,"end":43,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":43}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "DeclareModule", - "start": 0, - "end": 43, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 43 - } - }, + "start":0,"end":43,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":43}}, "id": { "type": "Identifier", - "start": 15, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - }, - "identifierName": "A" - }, + "start":15,"end":16,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":16},"identifierName":"A"}, "name": "A" }, "body": { "type": "BlockStatement", - "start": 17, - "end": 43, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 43 - } - }, + "start":17,"end":43,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":43}}, "body": [ { "type": "DeclareVariable", - "start": 19, - "end": 41, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 41 - } - }, + "start":19,"end":41,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":41}}, "id": { "type": "Identifier", - "start": 31, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 31 - }, - "end": { - "line": 1, - "column": 40 - }, - "identifierName": "x" - }, + "start":31,"end":40,"loc":{"start":{"line":1,"column":31},"end":{"line":1,"column":40},"identifierName":"x"}, "name": "x", "typeAnnotation": { "type": "TypeAnnotation", - "start": 32, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 32 - }, - "end": { - "line": 1, - "column": 40 - } - }, + "start":32,"end":40,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":40}}, "typeAnnotation": { "type": "NumberTypeAnnotation", - "start": 34, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 34 - }, - "end": { - "line": 1, - "column": 40 - } - } + "start":34,"end":40,"loc":{"start":{"line":1,"column":34},"end":{"line":1,"column":40}} } } } diff --git a/packages/babel-parser/test/fixtures/flow/declare-module/4/output.json b/packages/babel-parser/test/fixtures/flow/declare-module/4/output.json index b720bcb8bb89..4815b5f5dc06 100644 --- a/packages/babel-parser/test/fixtures/flow/declare-module/4/output.json +++ b/packages/babel-parser/test/fixtures/flow/declare-module/4/output.json @@ -1,155 +1,43 @@ { "type": "File", - "start": 0, - "end": 52, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 52 - } - }, + "start":0,"end":52,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":52}}, "program": { "type": "Program", - "start": 0, - "end": 52, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 52 - } - }, + "start":0,"end":52,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":52}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "DeclareModule", - "start": 0, - "end": 52, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 52 - } - }, + "start":0,"end":52,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":52}}, "id": { "type": "Identifier", - "start": 15, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - }, - "identifierName": "A" - }, + "start":15,"end":16,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":16},"identifierName":"A"}, "name": "A" }, "body": { "type": "BlockStatement", - "start": 17, - "end": 52, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 52 - } - }, + "start":17,"end":52,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":52}}, "body": [ { "type": "DeclareFunction", - "start": 19, - "end": 50, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 50 - } - }, + "start":19,"end":50,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":50}}, "id": { "type": "Identifier", - "start": 36, - "end": 49, - "loc": { - "start": { - "line": 1, - "column": 36 - }, - "end": { - "line": 1, - "column": 49 - }, - "identifierName": "foo" - }, + "start":36,"end":49,"loc":{"start":{"line":1,"column":36},"end":{"line":1,"column":49},"identifierName":"foo"}, "name": "foo", "typeAnnotation": { "type": "TypeAnnotation", - "start": 39, - "end": 49, - "loc": { - "start": { - "line": 1, - "column": 39 - }, - "end": { - "line": 1, - "column": 49 - } - }, + "start":39,"end":49,"loc":{"start":{"line":1,"column":39},"end":{"line":1,"column":49}}, "typeAnnotation": { "type": "FunctionTypeAnnotation", - "start": 39, - "end": 49, - "loc": { - "start": { - "line": 1, - "column": 39 - }, - "end": { - "line": 1, - "column": 49 - } - }, + "start":39,"end":49,"loc":{"start":{"line":1,"column":39},"end":{"line":1,"column":49}}, "typeParameters": null, "params": [], "rest": null, "returnType": { "type": "NumberTypeAnnotation", - "start": 43, - "end": 49, - "loc": { - "start": { - "line": 1, - "column": 43 - }, - "end": { - "line": 1, - "column": 49 - } - } + "start":43,"end":49,"loc":{"start":{"line":1,"column":43},"end":{"line":1,"column":49}} } } } diff --git a/packages/babel-parser/test/fixtures/flow/declare-module/5/output.json b/packages/babel-parser/test/fixtures/flow/declare-module/5/output.json index 4135f43e1dbb..20e04284533f 100644 --- a/packages/babel-parser/test/fixtures/flow/declare-module/5/output.json +++ b/packages/babel-parser/test/fixtures/flow/declare-module/5/output.json @@ -1,109 +1,30 @@ { "type": "File", - "start": 0, - "end": 55, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 55 - } - }, + "start":0,"end":55,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":55}}, "program": { "type": "Program", - "start": 0, - "end": 55, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 55 - } - }, + "start":0,"end":55,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":55}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "DeclareModule", - "start": 0, - "end": 55, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 55 - } - }, + "start":0,"end":55,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":55}}, "id": { "type": "Identifier", - "start": 15, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - }, - "identifierName": "A" - }, + "start":15,"end":16,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":16},"identifierName":"A"}, "name": "A" }, "body": { "type": "BlockStatement", - "start": 17, - "end": 55, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 55 - } - }, + "start":17,"end":55,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":55}}, "body": [ { "type": "DeclareClass", - "start": 19, - "end": 53, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 53 - } - }, + "start":19,"end":53,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":53}}, "id": { "type": "Identifier", - "start": 33, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 33 - }, - "end": { - "line": 1, - "column": 34 - }, - "identifierName": "B" - }, + "start":33,"end":34,"loc":{"start":{"line":1,"column":33},"end":{"line":1,"column":34},"identifierName":"B"}, "name": "B" }, "typeParameters": null, @@ -112,49 +33,15 @@ "mixins": [], "body": { "type": "ObjectTypeAnnotation", - "start": 35, - "end": 53, - "loc": { - "start": { - "line": 1, - "column": 35 - }, - "end": { - "line": 1, - "column": 53 - } - }, + "start":35,"end":53,"loc":{"start":{"line":1,"column":35},"end":{"line":1,"column":53}}, "callProperties": [], "properties": [ { "type": "ObjectTypeProperty", - "start": 37, - "end": 50, - "loc": { - "start": { - "line": 1, - "column": 37 - }, - "end": { - "line": 1, - "column": 50 - } - }, + "start":37,"end":50,"loc":{"start":{"line":1,"column":37},"end":{"line":1,"column":50}}, "key": { "type": "Identifier", - "start": 37, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 37 - }, - "end": { - "line": 1, - "column": 40 - }, - "identifierName": "foo" - }, + "start":37,"end":40,"loc":{"start":{"line":1,"column":37},"end":{"line":1,"column":40},"identifierName":"foo"}, "name": "foo" }, "static": false, @@ -163,35 +50,13 @@ "method": true, "value": { "type": "FunctionTypeAnnotation", - "start": 37, - "end": 50, - "loc": { - "start": { - "line": 1, - "column": 37 - }, - "end": { - "line": 1, - "column": 50 - } - }, + "start":37,"end":50,"loc":{"start":{"line":1,"column":37},"end":{"line":1,"column":50}}, "params": [], "rest": null, "typeParameters": null, "returnType": { "type": "NumberTypeAnnotation", - "start": 44, - "end": 50, - "loc": { - "start": { - "line": 1, - "column": 44 - }, - "end": { - "line": 1, - "column": 50 - } - } + "start":44,"end":50,"loc":{"start":{"line":1,"column":44},"end":{"line":1,"column":50}} } }, "optional": false diff --git a/packages/babel-parser/test/fixtures/flow/declare-module/6/output.json b/packages/babel-parser/test/fixtures/flow/declare-module/6/output.json index e2a2f288cbb5..dcc3dbe0267f 100644 --- a/packages/babel-parser/test/fixtures/flow/declare-module/6/output.json +++ b/packages/babel-parser/test/fixtures/flow/declare-module/6/output.json @@ -1,153 +1,41 @@ { "type": "File", - "start": 0, - "end": 63, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 63 - } - }, + "start":0,"end":63,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":63}}, "program": { "type": "Program", - "start": 0, - "end": 63, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 63 - } - }, + "start":0,"end":63,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":63}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "DeclareModule", - "start": 0, - "end": 63, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 63 - } - }, + "start":0,"end":63,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":63}}, "id": { "type": "Identifier", - "start": 15, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - }, - "identifierName": "A" - }, + "start":15,"end":16,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":16},"identifierName":"A"}, "name": "A" }, "body": { "type": "BlockStatement", - "start": 17, - "end": 63, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 63 - } - }, + "start":17,"end":63,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":63}}, "body": [ { "type": "DeclareModuleExports", - "start": 19, - "end": 61, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 61 - } - }, + "start":19,"end":61,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":61}}, "typeAnnotation": { "type": "TypeAnnotation", - "start": 41, - "end": 61, - "loc": { - "start": { - "line": 1, - "column": 41 - }, - "end": { - "line": 1, - "column": 61 - } - }, + "start":41,"end":61,"loc":{"start":{"line":1,"column":41},"end":{"line":1,"column":61}}, "typeAnnotation": { "type": "ObjectTypeAnnotation", - "start": 43, - "end": 61, - "loc": { - "start": { - "line": 1, - "column": 43 - }, - "end": { - "line": 1, - "column": 61 - } - }, + "start":43,"end":61,"loc":{"start":{"line":1,"column":43},"end":{"line":1,"column":61}}, "callProperties": [], "properties": [ { "type": "ObjectTypeProperty", - "start": 45, - "end": 58, - "loc": { - "start": { - "line": 1, - "column": 45 - }, - "end": { - "line": 1, - "column": 58 - } - }, + "start":45,"end":58,"loc":{"start":{"line":1,"column":45},"end":{"line":1,"column":58}}, "key": { "type": "Identifier", - "start": 45, - "end": 48, - "loc": { - "start": { - "line": 1, - "column": 45 - }, - "end": { - "line": 1, - "column": 48 - }, - "identifierName": "foo" - }, + "start":45,"end":48,"loc":{"start":{"line":1,"column":45},"end":{"line":1,"column":48},"identifierName":"foo"}, "name": "foo" }, "static": false, @@ -156,35 +44,13 @@ "method": true, "value": { "type": "FunctionTypeAnnotation", - "start": 45, - "end": 58, - "loc": { - "start": { - "line": 1, - "column": 45 - }, - "end": { - "line": 1, - "column": 58 - } - }, + "start":45,"end":58,"loc":{"start":{"line":1,"column":45},"end":{"line":1,"column":58}}, "params": [], "rest": null, "typeParameters": null, "returnType": { "type": "NumberTypeAnnotation", - "start": 52, - "end": 58, - "loc": { - "start": { - "line": 1, - "column": 52 - }, - "end": { - "line": 1, - "column": 58 - } - } + "start":52,"end":58,"loc":{"start":{"line":1,"column":52},"end":{"line":1,"column":58}} } }, "optional": false diff --git a/packages/babel-parser/test/fixtures/flow/declare-module/9/output.json b/packages/babel-parser/test/fixtures/flow/declare-module/9/output.json index a732ac8a65d4..fcaeaf699b2c 100644 --- a/packages/babel-parser/test/fixtures/flow/declare-module/9/output.json +++ b/packages/babel-parser/test/fixtures/flow/declare-module/9/output.json @@ -1,122 +1,33 @@ { "type": "File", - "start": 0, - "end": 52, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 52 - } - }, + "start":0,"end":52,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":52}}, "program": { "type": "Program", - "start": 0, - "end": 52, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 52 - } - }, + "start":0,"end":52,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":52}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "DeclareModule", - "start": 0, - "end": 52, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 52 - } - }, + "start":0,"end":52,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":52}}, "id": { "type": "Identifier", - "start": 15, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - }, - "identifierName": "A" - }, + "start":15,"end":16,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":16},"identifierName":"A"}, "name": "A" }, "body": { "type": "BlockStatement", - "start": 17, - "end": 52, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 52 - } - }, + "start":17,"end":52,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":52}}, "body": [ { "type": "DeclareModuleExports", - "start": 19, - "end": 50, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 50 - } - }, + "start":19,"end":50,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":50}}, "typeAnnotation": { "type": "TypeAnnotation", - "start": 41, - "end": 49, - "loc": { - "start": { - "line": 1, - "column": 41 - }, - "end": { - "line": 1, - "column": 49 - } - }, + "start":41,"end":49,"loc":{"start":{"line":1,"column":41},"end":{"line":1,"column":49}}, "typeAnnotation": { "type": "NumberTypeAnnotation", - "start": 43, - "end": 49, - "loc": { - "start": { - "line": 1, - "column": 43 - }, - "end": { - "line": 1, - "column": 49 - } - } + "start":43,"end":49,"loc":{"start":{"line":1,"column":43},"end":{"line":1,"column":49}} } } } diff --git a/packages/babel-parser/test/fixtures/flow/declare-module/import/output.json b/packages/babel-parser/test/fixtures/flow/declare-module/import/output.json index f7bb57172e32..f559a7704e8c 100644 --- a/packages/babel-parser/test/fixtures/flow/declare-module/import/output.json +++ b/packages/babel-parser/test/fixtures/flow/declare-module/import/output.json @@ -1,62 +1,18 @@ { "type": "File", - "start": 0, - "end": 78, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":0,"end":78,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 78, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":0,"end":78,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "DeclareModule", - "start": 0, - "end": 78, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":0,"end":78,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, "id": { "type": "StringLiteral", - "start": 15, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":15,"end":18,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":18}}, "extra": { "rawValue": "M", "raw": "\"M\"" @@ -65,63 +21,18 @@ }, "body": { "type": "BlockStatement", - "start": 19, - "end": 78, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":19,"end":78,"loc":{"start":{"line":1,"column":19},"end":{"line":4,"column":1}}, "body": [ { "type": "ImportDeclaration", - "start": 23, - "end": 47, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 26 - } - }, + "start":23,"end":47,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":26}}, "specifiers": [ { "type": "ImportDefaultSpecifier", - "start": 35, - "end": 36, - "loc": { - "start": { - "line": 2, - "column": 14 - }, - "end": { - "line": 2, - "column": 15 - } - }, + "start":35,"end":36,"loc":{"start":{"line":2,"column":14},"end":{"line":2,"column":15}}, "local": { "type": "Identifier", - "start": 35, - "end": 36, - "loc": { - "start": { - "line": 2, - "column": 14 - }, - "end": { - "line": 2, - "column": 15 - }, - "identifierName": "T" - }, + "start":35,"end":36,"loc":{"start":{"line":2,"column":14},"end":{"line":2,"column":15},"identifierName":"T"}, "name": "T" } } @@ -129,18 +40,7 @@ "importKind": "type", "source": { "type": "StringLiteral", - "start": 42, - "end": 46, - "loc": { - "start": { - "line": 2, - "column": 21 - }, - "end": { - "line": 2, - "column": 25 - } - }, + "start":42,"end":46,"loc":{"start":{"line":2,"column":21},"end":{"line":2,"column":25}}, "extra": { "rawValue": "TM", "raw": "\"TM\"" @@ -150,48 +50,14 @@ }, { "type": "ImportDeclaration", - "start": 50, - "end": 76, - "loc": { - "start": { - "line": 3, - "column": 2 - }, - "end": { - "line": 3, - "column": 28 - } - }, + "start":50,"end":76,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":28}}, "specifiers": [ { "type": "ImportDefaultSpecifier", - "start": 64, - "end": 65, - "loc": { - "start": { - "line": 3, - "column": 16 - }, - "end": { - "line": 3, - "column": 17 - } - }, + "start":64,"end":65,"loc":{"start":{"line":3,"column":16},"end":{"line":3,"column":17}}, "local": { "type": "Identifier", - "start": 64, - "end": 65, - "loc": { - "start": { - "line": 3, - "column": 16 - }, - "end": { - "line": 3, - "column": 17 - }, - "identifierName": "U" - }, + "start":64,"end":65,"loc":{"start":{"line":3,"column":16},"end":{"line":3,"column":17},"identifierName":"U"}, "name": "U" } } @@ -199,18 +65,7 @@ "importKind": "typeof", "source": { "type": "StringLiteral", - "start": 71, - "end": 75, - "loc": { - "start": { - "line": 3, - "column": 23 - }, - "end": { - "line": 3, - "column": 27 - } - }, + "start":71,"end":75,"loc":{"start":{"line":3,"column":23},"end":{"line":3,"column":27}}, "extra": { "rawValue": "UM", "raw": "\"UM\"" diff --git a/packages/babel-parser/test/fixtures/flow/declare-module/invalid-commonjs-module/options.json b/packages/babel-parser/test/fixtures/flow/declare-module/invalid-commonjs-module/options.json deleted file mode 100644 index adfde3236356..000000000000 --- a/packages/babel-parser/test/fixtures/flow/declare-module/invalid-commonjs-module/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Found both `declare module.exports` and `declare export` in the same module. Modules can only have 1 since they are either an ES module or they are a CommonJS module (1:55)" -} diff --git a/packages/babel-parser/test/fixtures/flow/declare-module/invalid-commonjs-module/output.json b/packages/babel-parser/test/fixtures/flow/declare-module/invalid-commonjs-module/output.json new file mode 100644 index 000000000000..6b671f1ed633 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/declare-module/invalid-commonjs-module/output.json @@ -0,0 +1,70 @@ +{ + "type": "File", + "start":0,"end":87,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":87}}, + "errors": [ + "SyntaxError: Found both `declare module.exports` and `declare export` in the same module. Modules can only have 1 since they are either an ES module or they are a CommonJS module (1:55)" + ], + "program": { + "type": "Program", + "start":0,"end":87,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":87}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "DeclareModule", + "start":0,"end":87,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":87}}, + "id": { + "type": "StringLiteral", + "start":15,"end":20,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":20}}, + "extra": { + "rawValue": "foo", + "raw": "\"foo\"" + }, + "value": "foo" + }, + "body": { + "type": "BlockStatement", + "start":21,"end":87,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":87}}, + "body": [ + { + "type": "DeclareModuleExports", + "start":23,"end":54,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":54}}, + "typeAnnotation": { + "type": "TypeAnnotation", + "start":45,"end":53,"loc":{"start":{"line":1,"column":45},"end":{"line":1,"column":53}}, + "typeAnnotation": { + "type": "NumberTypeAnnotation", + "start":47,"end":53,"loc":{"start":{"line":1,"column":47},"end":{"line":1,"column":53}} + } + } + }, + { + "type": "DeclareExportDeclaration", + "start":55,"end":84,"loc":{"start":{"line":1,"column":55},"end":{"line":1,"column":84}}, + "declaration": { + "type": "DeclareVariable", + "start":70,"end":84,"loc":{"start":{"line":1,"column":70},"end":{"line":1,"column":84}}, + "id": { + "type": "Identifier", + "start":74,"end":83,"loc":{"start":{"line":1,"column":74},"end":{"line":1,"column":83},"identifierName":"a"}, + "name": "a", + "typeAnnotation": { + "type": "TypeAnnotation", + "start":75,"end":83,"loc":{"start":{"line":1,"column":75},"end":{"line":1,"column":83}}, + "typeAnnotation": { + "type": "NumberTypeAnnotation", + "start":77,"end":83,"loc":{"start":{"line":1,"column":77},"end":{"line":1,"column":83}} + } + } + } + }, + "default": false + } + ] + }, + "kind": "ES" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/declare-module/invalid-es-module/options.json b/packages/babel-parser/test/fixtures/flow/declare-module/invalid-es-module/options.json deleted file mode 100644 index b40239a5609c..000000000000 --- a/packages/babel-parser/test/fixtures/flow/declare-module/invalid-es-module/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Found both `declare module.exports` and `declare export` in the same module. Modules can only have 1 since they are either an ES module or they are a CommonJS module (1:53)" -} diff --git a/packages/babel-parser/test/fixtures/flow/declare-module/invalid-es-module/output.json b/packages/babel-parser/test/fixtures/flow/declare-module/invalid-es-module/output.json new file mode 100644 index 000000000000..a1bf5fae4b25 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/declare-module/invalid-es-module/output.json @@ -0,0 +1,70 @@ +{ + "type": "File", + "start":0,"end":86,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":86}}, + "errors": [ + "SyntaxError: Found both `declare module.exports` and `declare export` in the same module. Modules can only have 1 since they are either an ES module or they are a CommonJS module (1:53)" + ], + "program": { + "type": "Program", + "start":0,"end":86,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":86}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "DeclareModule", + "start":0,"end":86,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":86}}, + "id": { + "type": "StringLiteral", + "start":15,"end":20,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":20}}, + "extra": { + "rawValue": "foo", + "raw": "\"foo\"" + }, + "value": "foo" + }, + "body": { + "type": "BlockStatement", + "start":21,"end":86,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":86}}, + "body": [ + { + "type": "DeclareExportDeclaration", + "start":23,"end":52,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":52}}, + "declaration": { + "type": "DeclareVariable", + "start":38,"end":52,"loc":{"start":{"line":1,"column":38},"end":{"line":1,"column":52}}, + "id": { + "type": "Identifier", + "start":42,"end":51,"loc":{"start":{"line":1,"column":42},"end":{"line":1,"column":51},"identifierName":"a"}, + "name": "a", + "typeAnnotation": { + "type": "TypeAnnotation", + "start":43,"end":51,"loc":{"start":{"line":1,"column":43},"end":{"line":1,"column":51}}, + "typeAnnotation": { + "type": "NumberTypeAnnotation", + "start":45,"end":51,"loc":{"start":{"line":1,"column":45},"end":{"line":1,"column":51}} + } + } + } + }, + "default": false + }, + { + "type": "DeclareModuleExports", + "start":53,"end":84,"loc":{"start":{"line":1,"column":53},"end":{"line":1,"column":84}}, + "typeAnnotation": { + "type": "TypeAnnotation", + "start":75,"end":83,"loc":{"start":{"line":1,"column":75},"end":{"line":1,"column":83}}, + "typeAnnotation": { + "type": "NumberTypeAnnotation", + "start":77,"end":83,"loc":{"start":{"line":1,"column":77},"end":{"line":1,"column":83}} + } + } + } + ] + }, + "kind": "CommonJS" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/declare-module/invalid-import/options.json b/packages/babel-parser/test/fixtures/flow/declare-module/invalid-import/options.json deleted file mode 100644 index c237bb99a73b..000000000000 --- a/packages/babel-parser/test/fixtures/flow/declare-module/invalid-import/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Imports within a `declare module` body must always be `import type` or `import typeof` (1:21)" -} diff --git a/packages/babel-parser/test/fixtures/flow/declare-module/invalid-import/output.json b/packages/babel-parser/test/fixtures/flow/declare-module/invalid-import/output.json new file mode 100644 index 000000000000..6155f8eda4f7 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/declare-module/invalid-import/output.json @@ -0,0 +1,61 @@ +{ + "type": "File", + "start":0,"end":42,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":42}}, + "errors": [ + "SyntaxError: Imports within a `declare module` body must always be `import type` or `import typeof` (1:21)" + ], + "program": { + "type": "Program", + "start":0,"end":42,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":42}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "DeclareModule", + "start":0,"end":42,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":42}}, + "id": { + "type": "StringLiteral", + "start":15,"end":18,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":18}}, + "extra": { + "rawValue": "M", + "raw": "\"M\"" + }, + "value": "M" + }, + "body": { + "type": "BlockStatement", + "start":19,"end":42,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":42}}, + "body": [ + { + "type": "ImportDeclaration", + "start":21,"end":40,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":40}}, + "specifiers": [ + { + "type": "ImportDefaultSpecifier", + "start":28,"end":29,"loc":{"start":{"line":1,"column":28},"end":{"line":1,"column":29}}, + "local": { + "type": "Identifier", + "start":28,"end":29,"loc":{"start":{"line":1,"column":28},"end":{"line":1,"column":29},"identifierName":"T"}, + "name": "T" + } + } + ], + "importKind": "value", + "source": { + "type": "StringLiteral", + "start":35,"end":39,"loc":{"start":{"line":1,"column":35},"end":{"line":1,"column":39}}, + "extra": { + "rawValue": "TM", + "raw": "\"TM\"" + }, + "value": "TM" + } + } + ] + }, + "kind": "CommonJS" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/declare-module/invalid-module-in-module/options.json b/packages/babel-parser/test/fixtures/flow/declare-module/invalid-module-in-module/options.json deleted file mode 100644 index cd823bd7c4e0..000000000000 --- a/packages/babel-parser/test/fixtures/flow/declare-module/invalid-module-in-module/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "`declare module` cannot be used inside another `declare module` (1:27)" -} diff --git a/packages/babel-parser/test/fixtures/flow/declare-module/invalid-module-in-module/output.json b/packages/babel-parser/test/fixtures/flow/declare-module/invalid-module-in-module/output.json new file mode 100644 index 000000000000..bd3851fd4f37 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/declare-module/invalid-module-in-module/output.json @@ -0,0 +1,47 @@ +{ + "type": "File", + "start":0,"end":40,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":40}}, + "errors": [ + "SyntaxError: `declare module` cannot be used inside another `declare module` (1:27)" + ], + "program": { + "type": "Program", + "start":0,"end":40,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":40}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "DeclareModule", + "start":0,"end":40,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":40}}, + "id": { + "type": "Identifier", + "start":15,"end":16,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":16},"identifierName":"A"}, + "name": "A" + }, + "body": { + "type": "BlockStatement", + "start":17,"end":40,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":40}}, + "body": [ + { + "type": "DeclareModule", + "start":19,"end":38,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":38}}, + "id": { + "type": "Identifier", + "start":34,"end":35,"loc":{"start":{"line":1,"column":34},"end":{"line":1,"column":35},"identifierName":"B"}, + "name": "B" + }, + "body": { + "type": "BlockStatement", + "start":36,"end":38,"loc":{"start":{"line":1,"column":36},"end":{"line":1,"column":38}}, + "body": [] + }, + "kind": "CommonJS" + } + ] + }, + "kind": "CommonJS" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/declare-module/invalid-multiple-commonjs/options.json b/packages/babel-parser/test/fixtures/flow/declare-module/invalid-multiple-commonjs/options.json deleted file mode 100644 index 1520d766b062..000000000000 --- a/packages/babel-parser/test/fixtures/flow/declare-module/invalid-multiple-commonjs/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Duplicate `declare module.exports` statement (1:55)" -} diff --git a/packages/babel-parser/test/fixtures/flow/declare-module/invalid-multiple-commonjs/output.json b/packages/babel-parser/test/fixtures/flow/declare-module/invalid-multiple-commonjs/output.json new file mode 100644 index 000000000000..b16aeb7c7e86 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/declare-module/invalid-multiple-commonjs/output.json @@ -0,0 +1,60 @@ +{ + "type": "File", + "start":0,"end":88,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":88}}, + "errors": [ + "SyntaxError: Duplicate `declare module.exports` statement (1:55)" + ], + "program": { + "type": "Program", + "start":0,"end":88,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":88}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "DeclareModule", + "start":0,"end":88,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":88}}, + "id": { + "type": "StringLiteral", + "start":15,"end":20,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":20}}, + "extra": { + "rawValue": "foo", + "raw": "\"foo\"" + }, + "value": "foo" + }, + "body": { + "type": "BlockStatement", + "start":21,"end":88,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":88}}, + "body": [ + { + "type": "DeclareModuleExports", + "start":23,"end":54,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":54}}, + "typeAnnotation": { + "type": "TypeAnnotation", + "start":45,"end":53,"loc":{"start":{"line":1,"column":45},"end":{"line":1,"column":53}}, + "typeAnnotation": { + "type": "StringTypeAnnotation", + "start":47,"end":53,"loc":{"start":{"line":1,"column":47},"end":{"line":1,"column":53}} + } + } + }, + { + "type": "DeclareModuleExports", + "start":55,"end":86,"loc":{"start":{"line":1,"column":55},"end":{"line":1,"column":86}}, + "typeAnnotation": { + "type": "TypeAnnotation", + "start":77,"end":85,"loc":{"start":{"line":1,"column":77},"end":{"line":1,"column":85}}, + "typeAnnotation": { + "type": "NumberTypeAnnotation", + "start":79,"end":85,"loc":{"start":{"line":1,"column":79},"end":{"line":1,"column":85}} + } + } + } + ] + }, + "kind": "CommonJS" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/declare-statements/1/output.json b/packages/babel-parser/test/fixtures/flow/declare-statements/1/output.json index 24275a8a0541..4897431c8252 100644 --- a/packages/babel-parser/test/fixtures/flow/declare-statements/1/output.json +++ b/packages/babel-parser/test/fixtures/flow/declare-statements/1/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "program": { "type": "Program", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "DeclareVariable", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "id": { "type": "Identifier", - "start": 12, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 15 - }, - "identifierName": "foo" - }, + "start":12,"end":15,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":15},"identifierName":"foo"}, "name": "foo" } } diff --git a/packages/babel-parser/test/fixtures/flow/declare-statements/10/output.json b/packages/babel-parser/test/fixtures/flow/declare-statements/10/output.json index cf4fbe9e784e..06a5d571ff09 100644 --- a/packages/babel-parser/test/fixtures/flow/declare-statements/10/output.json +++ b/packages/babel-parser/test/fixtures/flow/declare-statements/10/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 59, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 59 - } - }, + "start":0,"end":59,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":59}}, "program": { "type": "Program", - "start": 0, - "end": 59, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 59 - } - }, + "start":0,"end":59,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":59}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "DeclareClass", - "start": 0, - "end": 59, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 59 - } - }, + "start":0,"end":59,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":59}}, "id": { "type": "Identifier", - "start": 14, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - }, - "identifierName": "A" - }, + "start":14,"end":15,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":15},"identifierName":"A"}, "name": "A" }, "typeParameters": null, @@ -66,49 +21,15 @@ "mixins": [], "body": { "type": "ObjectTypeAnnotation", - "start": 16, - "end": 59, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 59 - } - }, + "start":16,"end":59,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":59}}, "callProperties": [], "properties": [ { "type": "ObjectTypeProperty", - "start": 18, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":18,"end":38,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":38}}, "key": { "type": "Identifier", - "start": 25, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 28 - }, - "identifierName": "foo" - }, + "start":25,"end":28,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":28},"identifierName":"foo"}, "name": "foo" }, "static": true, @@ -117,68 +38,23 @@ "method": true, "value": { "type": "FunctionTypeAnnotation", - "start": 18, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":18,"end":38,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":38}}, "params": [], "rest": null, "typeParameters": null, "returnType": { "type": "NumberTypeAnnotation", - "start": 32, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 32 - }, - "end": { - "line": 1, - "column": 38 - } - } + "start":32,"end":38,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":38}} } }, "optional": false }, { "type": "ObjectTypeProperty", - "start": 40, - "end": 57, - "loc": { - "start": { - "line": 1, - "column": 40 - }, - "end": { - "line": 1, - "column": 57 - } - }, + "start":40,"end":57,"loc":{"start":{"line":1,"column":40},"end":{"line":1,"column":57}}, "key": { "type": "Identifier", - "start": 47, - "end": 48, - "loc": { - "start": { - "line": 1, - "column": 47 - }, - "end": { - "line": 1, - "column": 48 - }, - "identifierName": "x" - }, + "start":47,"end":48,"loc":{"start":{"line":1,"column":47},"end":{"line":1,"column":48},"identifierName":"x"}, "name": "x" }, "static": true, @@ -187,18 +63,7 @@ "method": false, "value": { "type": "StringTypeAnnotation", - "start": 51, - "end": 57, - "loc": { - "start": { - "line": 1, - "column": 51 - }, - "end": { - "line": 1, - "column": 57 - } - } + "start":51,"end":57,"loc":{"start":{"line":1,"column":51},"end":{"line":1,"column":57}} }, "variance": null, "optional": false diff --git a/packages/babel-parser/test/fixtures/flow/declare-statements/11/output.json b/packages/babel-parser/test/fixtures/flow/declare-statements/11/output.json index 4bcd18e2275f..bb35e5604623 100644 --- a/packages/babel-parser/test/fixtures/flow/declare-statements/11/output.json +++ b/packages/babel-parser/test/fixtures/flow/declare-statements/11/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 53, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 53 - } - }, + "start":0,"end":53,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":53}}, "program": { "type": "Program", - "start": 0, - "end": 53, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 53 - } - }, + "start":0,"end":53,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":53}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "DeclareClass", - "start": 0, - "end": 53, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 53 - } - }, + "start":0,"end":53,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":53}}, "id": { "type": "Identifier", - "start": 14, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - }, - "identifierName": "A" - }, + "start":14,"end":15,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":15},"identifierName":"A"}, "name": "A" }, "typeParameters": null, @@ -66,82 +21,26 @@ "mixins": [], "body": { "type": "ObjectTypeAnnotation", - "start": 16, - "end": 53, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 53 - } - }, + "start":16,"end":53,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":53}}, "callProperties": [], "properties": [], "indexers": [ { "type": "ObjectTypeIndexer", - "start": 18, - "end": 51, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 51 - } - }, + "start":18,"end":51,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":51}}, "static": true, "id": { "type": "Identifier", - "start": 27, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 34 - }, - "identifierName": "indexer" - }, + "start":27,"end":34,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":34},"identifierName":"indexer"}, "name": "indexer" }, "key": { "type": "NumberTypeAnnotation", - "start": 36, - "end": 42, - "loc": { - "start": { - "line": 1, - "column": 36 - }, - "end": { - "line": 1, - "column": 42 - } - } + "start":36,"end":42,"loc":{"start":{"line":1,"column":36},"end":{"line":1,"column":42}} }, "value": { "type": "StringTypeAnnotation", - "start": 45, - "end": 51, - "loc": { - "start": { - "line": 1, - "column": 45 - }, - "end": { - "line": 1, - "column": 51 - } - } + "start":45,"end":51,"loc":{"start":{"line":1,"column":45},"end":{"line":1,"column":51}} }, "variance": null } diff --git a/packages/babel-parser/test/fixtures/flow/declare-statements/12/output.json b/packages/babel-parser/test/fixtures/flow/declare-statements/12/output.json index eadc63d41e2e..63f60d28b1b1 100644 --- a/packages/babel-parser/test/fixtures/flow/declare-statements/12/output.json +++ b/packages/babel-parser/test/fixtures/flow/declare-statements/12/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":38}}, "program": { "type": "Program", - "start": 0, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":38}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "DeclareClass", - "start": 0, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":38}}, "id": { "type": "Identifier", - "start": 14, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - }, - "identifierName": "A" - }, + "start":14,"end":15,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":15},"identifierName":"A"}, "name": "A" }, "typeParameters": null, @@ -66,65 +21,21 @@ "mixins": [], "body": { "type": "ObjectTypeAnnotation", - "start": 16, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":16,"end":38,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":38}}, "callProperties": [ { "type": "ObjectTypeCallProperty", - "start": 18, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":18,"end":36,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":36}}, "static": true, "value": { "type": "FunctionTypeAnnotation", - "start": 25, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":25,"end":36,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":36}}, "params": [], "rest": null, "typeParameters": null, "returnType": { "type": "NumberTypeAnnotation", - "start": 30, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 1, - "column": 36 - } - } + "start":30,"end":36,"loc":{"start":{"line":1,"column":30},"end":{"line":1,"column":36}} } } } diff --git a/packages/babel-parser/test/fixtures/flow/declare-statements/13/output.json b/packages/babel-parser/test/fixtures/flow/declare-statements/13/output.json index 873631284ec6..bb7c3a0dce75 100644 --- a/packages/babel-parser/test/fixtures/flow/declare-statements/13/output.json +++ b/packages/babel-parser/test/fixtures/flow/declare-statements/13/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, "program": { "type": "Program", - "start": 0, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "DeclareClass", - "start": 0, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, "id": { "type": "Identifier", - "start": 14, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - }, - "identifierName": "A" - }, + "start":14,"end":15,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":15},"identifierName":"A"}, "name": "A" }, "typeParameters": null, @@ -66,80 +21,23 @@ "mixins": [ { "type": "InterfaceExtends", - "start": 23, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":23,"end":27,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":27}}, "id": { "type": "Identifier", - "start": 23, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 24 - }, - "identifierName": "B" - }, + "start":23,"end":24,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":24},"identifierName":"B"}, "name": "B" }, "typeParameters": { "type": "TypeParameterInstantiation", - "start": 24, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":24,"end":27,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":27}}, "params": [ { "type": "GenericTypeAnnotation", - "start": 25, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":25,"end":26,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":26}}, "typeParameters": null, "id": { "type": "Identifier", - "start": 25, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 26 - }, - "identifierName": "T" - }, + "start":25,"end":26,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":26},"identifierName":"T"}, "name": "T" } } @@ -148,33 +46,10 @@ }, { "type": "InterfaceExtends", - "start": 29, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":29,"end":30,"loc":{"start":{"line":1,"column":29},"end":{"line":1,"column":30}}, "id": { "type": "Identifier", - "start": 29, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 1, - "column": 30 - }, - "identifierName": "C" - }, + "start":29,"end":30,"loc":{"start":{"line":1,"column":29},"end":{"line":1,"column":30},"identifierName":"C"}, "name": "C" }, "typeParameters": null @@ -182,18 +57,7 @@ ], "body": { "type": "ObjectTypeAnnotation", - "start": 31, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 31 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":31,"end":33,"loc":{"start":{"line":1,"column":31},"end":{"line":1,"column":33}}, "callProperties": [], "properties": [], "indexers": [], diff --git a/packages/babel-parser/test/fixtures/flow/declare-statements/14/output.json b/packages/babel-parser/test/fixtures/flow/declare-statements/14/output.json index a7b76763db42..4d6e56841a8f 100644 --- a/packages/babel-parser/test/fixtures/flow/declare-statements/14/output.json +++ b/packages/babel-parser/test/fixtures/flow/declare-statements/14/output.json @@ -1,142 +1,41 @@ { "type": "File", - "start": 0, - "end": 63, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 38 - } - }, + "start":0,"end":63,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":38}}, "program": { "type": "Program", - "start": 0, - "end": 63, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 38 - } - }, + "start":0,"end":63,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":38}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "DeclareTypeAlias", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "id": { "type": "Identifier", - "start": 13, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - }, - "identifierName": "A" - }, + "start":13,"end":14,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":14},"identifierName":"A"}, "name": "A" }, "typeParameters": null, "right": { "type": "StringTypeAnnotation", - "start": 17, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 23 - } - } + "start":17,"end":23,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":23}} } }, { "type": "DeclareTypeAlias", - "start": 25, - "end": 63, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 38 - } - }, + "start":25,"end":63,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":38}}, "id": { "type": "Identifier", - "start": 38, - "end": 39, - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 14 - }, - "identifierName": "T" - }, + "start":38,"end":39,"loc":{"start":{"line":2,"column":13},"end":{"line":2,"column":14},"identifierName":"T"}, "name": "T" }, "typeParameters": { "type": "TypeParameterDeclaration", - "start": 39, - "end": 42, - "loc": { - "start": { - "line": 2, - "column": 14 - }, - "end": { - "line": 2, - "column": 17 - } - }, + "start":39,"end":42,"loc":{"start":{"line":2,"column":14},"end":{"line":2,"column":17}}, "params": [ { "type": "TypeParameter", - "start": 40, - "end": 41, - "loc": { - "start": { - "line": 2, - "column": 15 - }, - "end": { - "line": 2, - "column": 16 - } - }, + "start":40,"end":41,"loc":{"start":{"line":2,"column":15},"end":{"line":2,"column":16}}, "name": "U", "variance": null } @@ -144,98 +43,30 @@ }, "right": { "type": "ObjectTypeAnnotation", - "start": 45, - "end": 62, - "loc": { - "start": { - "line": 2, - "column": 20 - }, - "end": { - "line": 2, - "column": 37 - } - }, + "start":45,"end":62,"loc":{"start":{"line":2,"column":20},"end":{"line":2,"column":37}}, "callProperties": [], "properties": [], "indexers": [ { "type": "ObjectTypeIndexer", - "start": 47, - "end": 60, - "loc": { - "start": { - "line": 2, - "column": 22 - }, - "end": { - "line": 2, - "column": 35 - } - }, + "start":47,"end":60,"loc":{"start":{"line":2,"column":22},"end":{"line":2,"column":35}}, "static": false, "id": { "type": "Identifier", - "start": 48, - "end": 49, - "loc": { - "start": { - "line": 2, - "column": 23 - }, - "end": { - "line": 2, - "column": 24 - }, - "identifierName": "k" - }, + "start":48,"end":49,"loc":{"start":{"line":2,"column":23},"end":{"line":2,"column":24},"identifierName":"k"}, "name": "k" }, "key": { "type": "StringTypeAnnotation", - "start": 50, - "end": 56, - "loc": { - "start": { - "line": 2, - "column": 25 - }, - "end": { - "line": 2, - "column": 31 - } - } + "start":50,"end":56,"loc":{"start":{"line":2,"column":25},"end":{"line":2,"column":31}} }, "value": { "type": "GenericTypeAnnotation", - "start": 59, - "end": 60, - "loc": { - "start": { - "line": 2, - "column": 34 - }, - "end": { - "line": 2, - "column": 35 - } - }, + "start":59,"end":60,"loc":{"start":{"line":2,"column":34},"end":{"line":2,"column":35}}, "typeParameters": null, "id": { "type": "Identifier", - "start": 59, - "end": 60, - "loc": { - "start": { - "line": 2, - "column": 34 - }, - "end": { - "line": 2, - "column": 35 - }, - "identifierName": "U" - }, + "start":59,"end":60,"loc":{"start":{"line":2,"column":34},"end":{"line":2,"column":35},"identifierName":"U"}, "name": "U" } }, diff --git a/packages/babel-parser/test/fixtures/flow/declare-statements/15/output.json b/packages/babel-parser/test/fixtures/flow/declare-statements/15/output.json index 619a44a76feb..ed22d30c4c17 100644 --- a/packages/babel-parser/test/fixtures/flow/declare-statements/15/output.json +++ b/packages/babel-parser/test/fixtures/flow/declare-statements/15/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 70, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 34 - } - }, + "start":0,"end":70,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":34}}, "program": { "type": "Program", - "start": 0, - "end": 70, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 34 - } - }, + "start":0,"end":70,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":34}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "DeclareInterface", - "start": 0, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":35}}, "id": { "type": "Identifier", - "start": 18, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - }, - "identifierName": "I" - }, + "start":18,"end":19,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":19},"identifierName":"I"}, "name": "I" }, "typeParameters": null, @@ -66,49 +21,15 @@ "mixins": [], "body": { "type": "ObjectTypeAnnotation", - "start": 20, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":20,"end":35,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":35}}, "callProperties": [], "properties": [ { "type": "ObjectTypeProperty", - "start": 22, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":22,"end":33,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":33}}, "key": { "type": "Identifier", - "start": 22, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 25 - }, - "identifierName": "foo" - }, + "start":22,"end":25,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":25},"identifierName":"foo"}, "name": "foo" }, "static": false, @@ -117,18 +38,7 @@ "method": false, "value": { "type": "StringTypeAnnotation", - "start": 27, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 33 - } - } + "start":27,"end":33,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":33}} }, "variance": null, "optional": false @@ -141,64 +51,19 @@ }, { "type": "DeclareInterface", - "start": 36, - "end": 70, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 34 - } - }, + "start":36,"end":70,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":34}}, "id": { "type": "Identifier", - "start": 54, - "end": 56, - "loc": { - "start": { - "line": 2, - "column": 18 - }, - "end": { - "line": 2, - "column": 20 - }, - "identifierName": "I2" - }, + "start":54,"end":56,"loc":{"start":{"line":2,"column":18},"end":{"line":2,"column":20},"identifierName":"I2"}, "name": "I2" }, "typeParameters": { "type": "TypeParameterDeclaration", - "start": 56, - "end": 59, - "loc": { - "start": { - "line": 2, - "column": 20 - }, - "end": { - "line": 2, - "column": 23 - } - }, + "start":56,"end":59,"loc":{"start":{"line":2,"column":20},"end":{"line":2,"column":23}}, "params": [ { "type": "TypeParameter", - "start": 57, - "end": 58, - "loc": { - "start": { - "line": 2, - "column": 21 - }, - "end": { - "line": 2, - "column": 22 - } - }, + "start":57,"end":58,"loc":{"start":{"line":2,"column":21},"end":{"line":2,"column":22}}, "name": "T", "variance": null } @@ -209,49 +74,15 @@ "mixins": [], "body": { "type": "ObjectTypeAnnotation", - "start": 60, - "end": 70, - "loc": { - "start": { - "line": 2, - "column": 24 - }, - "end": { - "line": 2, - "column": 34 - } - }, + "start":60,"end":70,"loc":{"start":{"line":2,"column":24},"end":{"line":2,"column":34}}, "callProperties": [], "properties": [ { "type": "ObjectTypeProperty", - "start": 62, - "end": 68, - "loc": { - "start": { - "line": 2, - "column": 26 - }, - "end": { - "line": 2, - "column": 32 - } - }, + "start":62,"end":68,"loc":{"start":{"line":2,"column":26},"end":{"line":2,"column":32}}, "key": { "type": "Identifier", - "start": 62, - "end": 65, - "loc": { - "start": { - "line": 2, - "column": 26 - }, - "end": { - "line": 2, - "column": 29 - }, - "identifierName": "foo" - }, + "start":62,"end":65,"loc":{"start":{"line":2,"column":26},"end":{"line":2,"column":29},"identifierName":"foo"}, "name": "foo" }, "static": false, @@ -260,34 +91,11 @@ "method": false, "value": { "type": "GenericTypeAnnotation", - "start": 67, - "end": 68, - "loc": { - "start": { - "line": 2, - "column": 31 - }, - "end": { - "line": 2, - "column": 32 - } - }, + "start":67,"end":68,"loc":{"start":{"line":2,"column":31},"end":{"line":2,"column":32}}, "typeParameters": null, "id": { "type": "Identifier", - "start": 67, - "end": 68, - "loc": { - "start": { - "line": 2, - "column": 31 - }, - "end": { - "line": 2, - "column": 32 - }, - "identifierName": "T" - }, + "start":67,"end":68,"loc":{"start":{"line":2,"column":31},"end":{"line":2,"column":32},"identifierName":"T"}, "name": "T" } }, diff --git a/packages/babel-parser/test/fixtures/flow/declare-statements/16/output.json b/packages/babel-parser/test/fixtures/flow/declare-statements/16/output.json index 211d7604e375..ce672f2280b5 100644 --- a/packages/babel-parser/test/fixtures/flow/declare-statements/16/output.json +++ b/packages/babel-parser/test/fixtures/flow/declare-statements/16/output.json @@ -1,159 +1,45 @@ { "type": "File", - "start": 0, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, "program": { "type": "Program", - "start": 0, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "DeclareClass", - "start": 0, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, "id": { "type": "Identifier", - "start": 14, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - }, - "identifierName": "A" - }, + "start":14,"end":15,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":15},"identifierName":"A"}, "name": "A" }, "typeParameters": null, "extends": [ { "type": "InterfaceExtends", - "start": 24, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":24,"end":29,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":29}}, "id": { "type": "QualifiedTypeIdentifier", - "start": 24, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":24,"end":29,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":29}}, "qualification": { "type": "QualifiedTypeIdentifier", - "start": 24, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":24,"end":27,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":27}}, "qualification": { "type": "Identifier", - "start": 24, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 25 - }, - "identifierName": "C" - }, + "start":24,"end":25,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":25},"identifierName":"C"}, "name": "C" }, "id": { "type": "Identifier", - "start": 26, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 27 - }, - "identifierName": "B" - }, + "start":26,"end":27,"loc":{"start":{"line":1,"column":26},"end":{"line":1,"column":27},"identifierName":"B"}, "name": "B" } }, "id": { "type": "Identifier", - "start": 28, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 29 - }, - "identifierName": "D" - }, + "start":28,"end":29,"loc":{"start":{"line":1,"column":28},"end":{"line":1,"column":29},"identifierName":"D"}, "name": "D" } }, @@ -164,18 +50,7 @@ "mixins": [], "body": { "type": "ObjectTypeAnnotation", - "start": 30, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":30,"end":33,"loc":{"start":{"line":1,"column":30},"end":{"line":1,"column":33}}, "callProperties": [], "properties": [], "indexers": [], diff --git a/packages/babel-parser/test/fixtures/flow/declare-statements/17/output.json b/packages/babel-parser/test/fixtures/flow/declare-statements/17/output.json index 26cebcf0a0ef..d881d6276bc1 100644 --- a/packages/babel-parser/test/fixtures/flow/declare-statements/17/output.json +++ b/packages/babel-parser/test/fixtures/flow/declare-statements/17/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 62, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 1 - } - }, + "start":0,"end":62,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 62, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 1 - } - }, + "start":0,"end":62,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "DeclareClass", - "start": 0, - "end": 62, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 1 - } - }, + "start":0,"end":62,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, "id": { "type": "Identifier", - "start": 14, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - }, - "identifierName": "X" - }, + "start":14,"end":15,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":15},"identifierName":"X"}, "name": "X" }, "typeParameters": null, @@ -66,49 +21,15 @@ "mixins": [], "body": { "type": "ObjectTypeAnnotation", - "start": 16, - "end": 62, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 5, - "column": 1 - } - }, + "start":16,"end":62,"loc":{"start":{"line":1,"column":16},"end":{"line":5,"column":1}}, "callProperties": [], "properties": [ { "type": "ObjectTypeProperty", - "start": 19, - "end": 28, - "loc": { - "start": { - "line": 2, - "column": 1 - }, - "end": { - "line": 2, - "column": 10 - } - }, + "start":19,"end":28,"loc":{"start":{"line":2,"column":1},"end":{"line":2,"column":10}}, "key": { "type": "Identifier", - "start": 19, - "end": 20, - "loc": { - "start": { - "line": 2, - "column": 1 - }, - "end": { - "line": 2, - "column": 2 - }, - "identifierName": "a" - }, + "start":19,"end":20,"loc":{"start":{"line":2,"column":1},"end":{"line":2,"column":2},"identifierName":"a"}, "name": "a" }, "static": false, @@ -117,51 +38,17 @@ "method": false, "value": { "type": "NumberTypeAnnotation", - "start": 22, - "end": 28, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 10 - } - } + "start":22,"end":28,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":10}} }, "variance": null, "optional": false }, { "type": "ObjectTypeProperty", - "start": 31, - "end": 47, - "loc": { - "start": { - "line": 3, - "column": 1 - }, - "end": { - "line": 3, - "column": 17 - } - }, + "start":31,"end":47,"loc":{"start":{"line":3,"column":1},"end":{"line":3,"column":17}}, "key": { "type": "Identifier", - "start": 38, - "end": 39, - "loc": { - "start": { - "line": 3, - "column": 8 - }, - "end": { - "line": 3, - "column": 9 - }, - "identifierName": "b" - }, + "start":38,"end":39,"loc":{"start":{"line":3,"column":8},"end":{"line":3,"column":9},"identifierName":"b"}, "name": "b" }, "static": true, @@ -170,51 +57,17 @@ "method": false, "value": { "type": "NumberTypeAnnotation", - "start": 41, - "end": 47, - "loc": { - "start": { - "line": 3, - "column": 11 - }, - "end": { - "line": 3, - "column": 17 - } - } + "start":41,"end":47,"loc":{"start":{"line":3,"column":11},"end":{"line":3,"column":17}} }, "variance": null, "optional": false }, { "type": "ObjectTypeProperty", - "start": 50, - "end": 59, - "loc": { - "start": { - "line": 4, - "column": 1 - }, - "end": { - "line": 4, - "column": 10 - } - }, + "start":50,"end":59,"loc":{"start":{"line":4,"column":1},"end":{"line":4,"column":10}}, "key": { "type": "Identifier", - "start": 50, - "end": 51, - "loc": { - "start": { - "line": 4, - "column": 1 - }, - "end": { - "line": 4, - "column": 2 - }, - "identifierName": "c" - }, + "start":50,"end":51,"loc":{"start":{"line":4,"column":1},"end":{"line":4,"column":2},"identifierName":"c"}, "name": "c" }, "static": false, @@ -223,18 +76,7 @@ "method": false, "value": { "type": "NumberTypeAnnotation", - "start": 53, - "end": 59, - "loc": { - "start": { - "line": 4, - "column": 4 - }, - "end": { - "line": 4, - "column": 10 - } - } + "start":53,"end":59,"loc":{"start":{"line":4,"column":4},"end":{"line":4,"column":10}} }, "variance": null, "optional": false diff --git a/packages/babel-parser/test/fixtures/flow/declare-statements/18/output.json b/packages/babel-parser/test/fixtures/flow/declare-statements/18/output.json index ff402b5db4b6..faab69fb629c 100644 --- a/packages/babel-parser/test/fixtures/flow/declare-statements/18/output.json +++ b/packages/babel-parser/test/fixtures/flow/declare-statements/18/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 70, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 31 - } - }, + "start":0,"end":70,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":31}}, "program": { "type": "Program", - "start": 0, - "end": 70, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 31 - } - }, + "start":0,"end":70,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":31}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "DeclareClass", - "start": 0, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":38}}, "id": { "type": "Identifier", - "start": 14, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - }, - "identifierName": "A" - }, + "start":14,"end":15,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":15},"identifierName":"A"}, "name": "A" }, "typeParameters": null, @@ -66,65 +21,21 @@ "mixins": [], "body": { "type": "ObjectTypeAnnotation", - "start": 16, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":16,"end":38,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":38}}, "callProperties": [ { "type": "ObjectTypeCallProperty", - "start": 18, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":18,"end":36,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":36}}, "static": true, "value": { "type": "FunctionTypeAnnotation", - "start": 25, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":25,"end":36,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":36}}, "params": [], "rest": null, "typeParameters": null, "returnType": { "type": "NumberTypeAnnotation", - "start": 30, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 1, - "column": 36 - } - } + "start":30,"end":36,"loc":{"start":{"line":1,"column":30},"end":{"line":1,"column":36}} } } } @@ -137,33 +48,10 @@ }, { "type": "DeclareClass", - "start": 39, - "end": 70, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 31 - } - }, + "start":39,"end":70,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":31}}, "id": { "type": "Identifier", - "start": 53, - "end": 54, - "loc": { - "start": { - "line": 2, - "column": 14 - }, - "end": { - "line": 2, - "column": 15 - }, - "identifierName": "B" - }, + "start":53,"end":54,"loc":{"start":{"line":2,"column":14},"end":{"line":2,"column":15},"identifierName":"B"}, "name": "B" }, "typeParameters": null, @@ -172,65 +60,21 @@ "mixins": [], "body": { "type": "ObjectTypeAnnotation", - "start": 55, - "end": 70, - "loc": { - "start": { - "line": 2, - "column": 16 - }, - "end": { - "line": 2, - "column": 31 - } - }, + "start":55,"end":70,"loc":{"start":{"line":2,"column":16},"end":{"line":2,"column":31}}, "callProperties": [ { "type": "ObjectTypeCallProperty", - "start": 57, - "end": 68, - "loc": { - "start": { - "line": 2, - "column": 18 - }, - "end": { - "line": 2, - "column": 29 - } - }, + "start":57,"end":68,"loc":{"start":{"line":2,"column":18},"end":{"line":2,"column":29}}, "static": false, "value": { "type": "FunctionTypeAnnotation", - "start": 57, - "end": 68, - "loc": { - "start": { - "line": 2, - "column": 18 - }, - "end": { - "line": 2, - "column": 29 - } - }, + "start":57,"end":68,"loc":{"start":{"line":2,"column":18},"end":{"line":2,"column":29}}, "params": [], "rest": null, "typeParameters": null, "returnType": { "type": "NumberTypeAnnotation", - "start": 62, - "end": 68, - "loc": { - "start": { - "line": 2, - "column": 23 - }, - "end": { - "line": 2, - "column": 29 - } - } + "start":62,"end":68,"loc":{"start":{"line":2,"column":23},"end":{"line":2,"column":29}} } } } diff --git a/packages/babel-parser/test/fixtures/flow/declare-statements/19/output.json b/packages/babel-parser/test/fixtures/flow/declare-statements/19/output.json index 1fa1e6b11b8e..d6c3eb01f2d2 100644 --- a/packages/babel-parser/test/fixtures/flow/declare-statements/19/output.json +++ b/packages/babel-parser/test/fixtures/flow/declare-statements/19/output.json @@ -1,92 +1,25 @@ { "type": "File", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "program": { "type": "Program", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "DeclareVariable", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "id": { "type": "Identifier", - "start": 12, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 23 - }, - "identifierName": "string" - }, + "start":12,"end":23,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":23},"identifierName":"string"}, "name": "string", "typeAnnotation": { "type": "TypeAnnotation", - "start": 18, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":18,"end":23,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":23}}, "typeAnnotation": { "type": "AnyTypeAnnotation", - "start": 20, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 23 - } - } + "start":20,"end":23,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":23}} } } } diff --git a/packages/babel-parser/test/fixtures/flow/declare-statements/2/output.json b/packages/babel-parser/test/fixtures/flow/declare-statements/2/output.json index 16b1f7cb34a6..184ed4f2ab90 100644 --- a/packages/babel-parser/test/fixtures/flow/declare-statements/2/output.json +++ b/packages/babel-parser/test/fixtures/flow/declare-statements/2/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "program": { "type": "Program", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "DeclareVariable", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "id": { "type": "Identifier", - "start": 12, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 15 - }, - "identifierName": "foo" - }, + "start":12,"end":15,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":15},"identifierName":"foo"}, "name": "foo" } } diff --git a/packages/babel-parser/test/fixtures/flow/declare-statements/3/output.json b/packages/babel-parser/test/fixtures/flow/declare-statements/3/output.json index 83415ca915c5..64089206d0c7 100644 --- a/packages/babel-parser/test/fixtures/flow/declare-statements/3/output.json +++ b/packages/babel-parser/test/fixtures/flow/declare-statements/3/output.json @@ -1,109 +1,31 @@ { "type": "File", - "start": 0, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, "program": { "type": "Program", - "start": 0, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "DeclareFunction", - "start": 0, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, "id": { "type": "Identifier", - "start": 17, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 28 - }, - "identifierName": "foo" - }, + "start":17,"end":28,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":28},"identifierName":"foo"}, "name": "foo", "typeAnnotation": { "type": "TypeAnnotation", - "start": 20, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":20,"end":28,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":28}}, "typeAnnotation": { "type": "FunctionTypeAnnotation", - "start": 20, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":20,"end":28,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":28}}, "typeParameters": null, "params": [], "rest": null, "returnType": { "type": "VoidTypeAnnotation", - "start": 24, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 28 - } - } + "start":24,"end":28,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":28}} } } } diff --git a/packages/babel-parser/test/fixtures/flow/declare-statements/4/output.json b/packages/babel-parser/test/fixtures/flow/declare-statements/4/output.json index 5770e311a044..f377b44c81af 100644 --- a/packages/babel-parser/test/fixtures/flow/declare-statements/4/output.json +++ b/packages/babel-parser/test/fixtures/flow/declare-statements/4/output.json @@ -1,109 +1,31 @@ { "type": "File", - "start": 0, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, "program": { "type": "Program", - "start": 0, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "DeclareFunction", - "start": 0, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, "id": { "type": "Identifier", - "start": 17, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 28 - }, - "identifierName": "foo" - }, + "start":17,"end":28,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":28},"identifierName":"foo"}, "name": "foo", "typeAnnotation": { "type": "TypeAnnotation", - "start": 20, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":20,"end":28,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":28}}, "typeAnnotation": { "type": "FunctionTypeAnnotation", - "start": 20, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":20,"end":28,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":28}}, "typeParameters": null, "params": [], "rest": null, "returnType": { "type": "VoidTypeAnnotation", - "start": 24, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 28 - } - } + "start":24,"end":28,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":28}} } } } diff --git a/packages/babel-parser/test/fixtures/flow/declare-statements/5/output.json b/packages/babel-parser/test/fixtures/flow/declare-statements/5/output.json index 812bc218354a..033bfd0bfc02 100644 --- a/packages/babel-parser/test/fixtures/flow/declare-statements/5/output.json +++ b/packages/babel-parser/test/fixtures/flow/declare-statements/5/output.json @@ -1,121 +1,32 @@ { "type": "File", - "start": 0, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, "program": { "type": "Program", - "start": 0, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "DeclareFunction", - "start": 0, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, "id": { "type": "Identifier", - "start": 17, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 31 - }, - "identifierName": "foo" - }, + "start":17,"end":31,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":31},"identifierName":"foo"}, "name": "foo", "typeAnnotation": { "type": "TypeAnnotation", - "start": 20, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":20,"end":31,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":31}}, "typeAnnotation": { "type": "FunctionTypeAnnotation", - "start": 20, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":20,"end":31,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":31}}, "typeParameters": { "type": "TypeParameterDeclaration", - "start": 20, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":20,"end":23,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":23}}, "params": [ { "type": "TypeParameter", - "start": 21, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":21,"end":22,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":22}}, "name": "T", "variance": null } @@ -125,18 +36,7 @@ "rest": null, "returnType": { "type": "VoidTypeAnnotation", - "start": 27, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 31 - } - } + "start":27,"end":31,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":31}} } } } diff --git a/packages/babel-parser/test/fixtures/flow/declare-statements/6/output.json b/packages/babel-parser/test/fixtures/flow/declare-statements/6/output.json index b0f9b7b49412..7a8d40112005 100644 --- a/packages/babel-parser/test/fixtures/flow/declare-statements/6/output.json +++ b/packages/babel-parser/test/fixtures/flow/declare-statements/6/output.json @@ -1,206 +1,60 @@ { "type": "File", - "start": 0, - "end": 49, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 49 - } - }, + "start":0,"end":49,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":49}}, "program": { "type": "Program", - "start": 0, - "end": 49, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 49 - } - }, + "start":0,"end":49,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":49}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "DeclareFunction", - "start": 0, - "end": 49, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 49 - } - }, + "start":0,"end":49,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":49}}, "id": { "type": "Identifier", - "start": 17, - "end": 48, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 48 - }, - "identifierName": "foo" - }, + "start":17,"end":48,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":48},"identifierName":"foo"}, "name": "foo", "typeAnnotation": { "type": "TypeAnnotation", - "start": 20, - "end": 48, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 48 - } - }, + "start":20,"end":48,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":48}}, "typeAnnotation": { "type": "FunctionTypeAnnotation", - "start": 20, - "end": 48, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 48 - } - }, + "start":20,"end":48,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":48}}, "typeParameters": null, "params": [ { "type": "FunctionTypeParam", - "start": 21, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":21,"end":30,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":30}}, "name": { "type": "Identifier", - "start": 21, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 22 - }, - "identifierName": "x" - }, + "start":21,"end":22,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":22},"identifierName":"x"}, "name": "x" }, "optional": false, "typeAnnotation": { "type": "NumberTypeAnnotation", - "start": 24, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 30 - } - } + "start":24,"end":30,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":30}} } }, { "type": "FunctionTypeParam", - "start": 32, - "end": 41, - "loc": { - "start": { - "line": 1, - "column": 32 - }, - "end": { - "line": 1, - "column": 41 - } - }, + "start":32,"end":41,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":41}}, "name": { "type": "Identifier", - "start": 32, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 32 - }, - "end": { - "line": 1, - "column": 33 - }, - "identifierName": "y" - }, + "start":32,"end":33,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":33},"identifierName":"y"}, "name": "y" }, "optional": false, "typeAnnotation": { "type": "StringTypeAnnotation", - "start": 35, - "end": 41, - "loc": { - "start": { - "line": 1, - "column": 35 - }, - "end": { - "line": 1, - "column": 41 - } - } + "start":35,"end":41,"loc":{"start":{"line":1,"column":35},"end":{"line":1,"column":41}} } } ], "rest": null, "returnType": { "type": "VoidTypeAnnotation", - "start": 44, - "end": 48, - "loc": { - "start": { - "line": 1, - "column": 44 - }, - "end": { - "line": 1, - "column": 48 - } - } + "start":44,"end":48,"loc":{"start":{"line":1,"column":44},"end":{"line":1,"column":48}} } } } diff --git a/packages/babel-parser/test/fixtures/flow/declare-statements/7/output.json b/packages/babel-parser/test/fixtures/flow/declare-statements/7/output.json index 6ad6e0049358..e5ae7dd2d318 100644 --- a/packages/babel-parser/test/fixtures/flow/declare-statements/7/output.json +++ b/packages/babel-parser/test/fixtures/flow/declare-statements/7/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 74, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 74 - } - }, + "start":0,"end":74,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":74}}, "program": { "type": "Program", - "start": 0, - "end": 74, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 74 - } - }, + "start":0,"end":74,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":74}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "DeclareClass", - "start": 0, - "end": 74, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 74 - } - }, + "start":0,"end":74,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":74}}, "id": { "type": "Identifier", - "start": 14, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 26 - }, - "identifierName": "IViewFactory" - }, + "start":14,"end":26,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":26},"identifierName":"IViewFactory"}, "name": "IViewFactory" }, "typeParameters": null, @@ -66,49 +21,15 @@ "mixins": [], "body": { "type": "ObjectTypeAnnotation", - "start": 27, - "end": 74, - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 74 - } - }, + "start":27,"end":74,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":74}}, "callProperties": [], "properties": [ { "type": "ObjectTypeProperty", - "start": 29, - "end": 71, - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 1, - "column": 71 - } - }, + "start":29,"end":71,"loc":{"start":{"line":1,"column":29},"end":{"line":1,"column":71}}, "key": { "type": "Identifier", - "start": 29, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 1, - "column": 39 - }, - "identifierName": "didAnimate" - }, + "start":29,"end":39,"loc":{"start":{"line":1,"column":29},"end":{"line":1,"column":39},"identifierName":"didAnimate"}, "name": "didAnimate" }, "static": false, @@ -117,131 +38,40 @@ "method": true, "value": { "type": "FunctionTypeAnnotation", - "start": 29, - "end": 71, - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 1, - "column": 71 - } - }, + "start":29,"end":71,"loc":{"start":{"line":1,"column":29},"end":{"line":1,"column":71}}, "params": [ { "type": "FunctionTypeParam", - "start": 40, - "end": 51, - "loc": { - "start": { - "line": 1, - "column": 40 - }, - "end": { - "line": 1, - "column": 51 - } - }, + "start":40,"end":51,"loc":{"start":{"line":1,"column":40},"end":{"line":1,"column":51}}, "name": { "type": "Identifier", - "start": 40, - "end": 44, - "loc": { - "start": { - "line": 1, - "column": 40 - }, - "end": { - "line": 1, - "column": 44 - }, - "identifierName": "view" - }, + "start":40,"end":44,"loc":{"start":{"line":1,"column":40},"end":{"line":1,"column":44},"identifierName":"view"}, "name": "view" }, "optional": false, "typeAnnotation": { "type": "GenericTypeAnnotation", - "start": 45, - "end": 51, - "loc": { - "start": { - "line": 1, - "column": 45 - }, - "end": { - "line": 1, - "column": 51 - } - }, + "start":45,"end":51,"loc":{"start":{"line":1,"column":45},"end":{"line":1,"column":51}}, "typeParameters": null, "id": { "type": "Identifier", - "start": 45, - "end": 51, - "loc": { - "start": { - "line": 1, - "column": 45 - }, - "end": { - "line": 1, - "column": 51 - }, - "identifierName": "Object" - }, + "start":45,"end":51,"loc":{"start":{"line":1,"column":45},"end":{"line":1,"column":51},"identifierName":"Object"}, "name": "Object" } } }, { "type": "FunctionTypeParam", - "start": 53, - "end": 64, - "loc": { - "start": { - "line": 1, - "column": 53 - }, - "end": { - "line": 1, - "column": 64 - } - }, + "start":53,"end":64,"loc":{"start":{"line":1,"column":53},"end":{"line":1,"column":64}}, "name": { "type": "Identifier", - "start": 53, - "end": 57, - "loc": { - "start": { - "line": 1, - "column": 53 - }, - "end": { - "line": 1, - "column": 57 - }, - "identifierName": "prop" - }, + "start":53,"end":57,"loc":{"start":{"line":1,"column":53},"end":{"line":1,"column":57},"identifierName":"prop"}, "name": "prop" }, "optional": false, "typeAnnotation": { "type": "StringTypeAnnotation", - "start": 58, - "end": 64, - "loc": { - "start": { - "line": 1, - "column": 58 - }, - "end": { - "line": 1, - "column": 64 - } - } + "start":58,"end":64,"loc":{"start":{"line":1,"column":58},"end":{"line":1,"column":64}} } } ], @@ -249,18 +79,7 @@ "typeParameters": null, "returnType": { "type": "VoidTypeAnnotation", - "start": 67, - "end": 71, - "loc": { - "start": { - "line": 1, - "column": 67 - }, - "end": { - "line": 1, - "column": 71 - } - } + "start":67,"end":71,"loc":{"start":{"line":1,"column":67},"end":{"line":1,"column":71}} } }, "optional": false diff --git a/packages/babel-parser/test/fixtures/flow/declare-statements/8/output.json b/packages/babel-parser/test/fixtures/flow/declare-statements/8/output.json index 2c952054dac9..0f97774031e5 100644 --- a/packages/babel-parser/test/fixtures/flow/declare-statements/8/output.json +++ b/packages/babel-parser/test/fixtures/flow/declare-statements/8/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, "program": { "type": "Program", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "DeclareClass", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, "id": { "type": "Identifier", - "start": 14, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - }, - "identifierName": "A" - }, + "start":14,"end":15,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":15},"identifierName":"A"}, "name": "A" }, "typeParameters": null, @@ -66,18 +21,7 @@ "mixins": [], "body": { "type": "ObjectTypeAnnotation", - "start": 16, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":16,"end":18,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":18}}, "callProperties": [], "properties": [], "indexers": [], diff --git a/packages/babel-parser/test/fixtures/flow/declare-statements/9/output.json b/packages/babel-parser/test/fixtures/flow/declare-statements/9/output.json index 0191d716d9ff..450867f07ed2 100644 --- a/packages/babel-parser/test/fixtures/flow/declare-statements/9/output.json +++ b/packages/babel-parser/test/fixtures/flow/declare-statements/9/output.json @@ -1,94 +1,27 @@ { "type": "File", - "start": 0, - "end": 45, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 45 - } - }, + "start":0,"end":45,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":45}}, "program": { "type": "Program", - "start": 0, - "end": 45, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 45 - } - }, + "start":0,"end":45,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":45}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "DeclareClass", - "start": 0, - "end": 45, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 45 - } - }, + "start":0,"end":45,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":45}}, "id": { "type": "Identifier", - "start": 14, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - }, - "identifierName": "A" - }, + "start":14,"end":15,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":15},"identifierName":"A"}, "name": "A" }, "typeParameters": { "type": "TypeParameterDeclaration", - "start": 15, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":15,"end":18,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":18}}, "params": [ { "type": "TypeParameter", - "start": 16, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":16,"end":17,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":17}}, "name": "T", "variance": null } @@ -97,80 +30,23 @@ "extends": [ { "type": "InterfaceExtends", - "start": 27, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":27,"end":31,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":31}}, "id": { "type": "Identifier", - "start": 27, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 28 - }, - "identifierName": "B" - }, + "start":27,"end":28,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":28},"identifierName":"B"}, "name": "B" }, "typeParameters": { "type": "TypeParameterInstantiation", - "start": 28, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":28,"end":31,"loc":{"start":{"line":1,"column":28},"end":{"line":1,"column":31}}, "params": [ { "type": "GenericTypeAnnotation", - "start": 29, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":29,"end":30,"loc":{"start":{"line":1,"column":29},"end":{"line":1,"column":30}}, "typeParameters": null, "id": { "type": "Identifier", - "start": 29, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 1, - "column": 30 - }, - "identifierName": "T" - }, + "start":29,"end":30,"loc":{"start":{"line":1,"column":29},"end":{"line":1,"column":30},"identifierName":"T"}, "name": "T" } } @@ -182,49 +58,15 @@ "mixins": [], "body": { "type": "ObjectTypeAnnotation", - "start": 32, - "end": 45, - "loc": { - "start": { - "line": 1, - "column": 32 - }, - "end": { - "line": 1, - "column": 45 - } - }, + "start":32,"end":45,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":45}}, "callProperties": [], "properties": [ { "type": "ObjectTypeProperty", - "start": 34, - "end": 43, - "loc": { - "start": { - "line": 1, - "column": 34 - }, - "end": { - "line": 1, - "column": 43 - } - }, + "start":34,"end":43,"loc":{"start":{"line":1,"column":34},"end":{"line":1,"column":43}}, "key": { "type": "Identifier", - "start": 34, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 34 - }, - "end": { - "line": 1, - "column": 35 - }, - "identifierName": "x" - }, + "start":34,"end":35,"loc":{"start":{"line":1,"column":34},"end":{"line":1,"column":35},"identifierName":"x"}, "name": "x" }, "static": false, @@ -233,18 +75,7 @@ "method": false, "value": { "type": "NumberTypeAnnotation", - "start": 37, - "end": 43, - "loc": { - "start": { - "line": 1, - "column": 37 - }, - "end": { - "line": 1, - "column": 43 - } - } + "start":37,"end":43,"loc":{"start":{"line":1,"column":37},"end":{"line":1,"column":43}} }, "variance": null, "optional": false diff --git a/packages/babel-parser/test/fixtures/flow/declare-statements/symbol/input.js b/packages/babel-parser/test/fixtures/flow/declare-statements/symbol/input.js new file mode 100644 index 000000000000..d91b81ba9d76 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/declare-statements/symbol/input.js @@ -0,0 +1 @@ +declare var x: symbol; diff --git a/packages/babel-parser/test/fixtures/flow/declare-statements/symbol/output.json b/packages/babel-parser/test/fixtures/flow/declare-statements/symbol/output.json new file mode 100644 index 000000000000..7ce565e0d08e --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/declare-statements/symbol/output.json @@ -0,0 +1,30 @@ +{ + "type": "File", + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, + "program": { + "type": "Program", + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "DeclareVariable", + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, + "id": { + "type": "Identifier", + "start":12,"end":21,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":21},"identifierName":"x"}, + "name": "x", + "typeAnnotation": { + "type": "TypeAnnotation", + "start":13,"end":21,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":21}}, + "typeAnnotation": { + "type": "SymbolTypeAnnotation", + "start":15,"end":21,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":21}} + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/def-site-variance/1/output.json b/packages/babel-parser/test/fixtures/flow/def-site-variance/1/output.json index 938196ebcdb6..54c76604b56e 100644 --- a/packages/babel-parser/test/fixtures/flow/def-site-variance/1/output.json +++ b/packages/babel-parser/test/fixtures/flow/def-site-variance/1/output.json @@ -1,141 +1,41 @@ { "type": "File", - "start": 0, - "end": 59, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 18 - } - }, + "start":0,"end":59,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":18}}, "program": { "type": "Program", - "start": 0, - "end": 59, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 18 - } - }, + "start":0,"end":59,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":18}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "id": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "C" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"C"}, "name": "C" }, "typeParameters": { "type": "TypeParameterDeclaration", - "start": 7, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":7,"end":14,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":14}}, "params": [ { "type": "TypeParameter", - "start": 8, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":8,"end":10,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":10}}, "name": "T", "variance": { "type": "Variance", - "start": 8, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":8,"end":9,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":9}}, "kind": "plus" } }, { "type": "TypeParameter", - "start": 11, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":11,"end":13,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":13}}, "name": "U", "variance": { "type": "Variance", - "start": 11, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":11,"end":12,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":12}}, "kind": "minus" } } @@ -144,130 +44,41 @@ "superClass": null, "body": { "type": "ClassBody", - "start": 15, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":15,"end":17,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":17}}, "body": [] } }, { "type": "FunctionDeclaration", - "start": 18, - "end": 40, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 22 - } - }, + "start":18,"end":40,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":22}}, "id": { "type": "Identifier", - "start": 27, - "end": 28, - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 10 - }, - "identifierName": "f" - }, + "start":27,"end":28,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":10},"identifierName":"f"}, "name": "f" }, "generator": false, "async": false, "typeParameters": { "type": "TypeParameterDeclaration", - "start": 28, - "end": 35, - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 17 - } - }, + "start":28,"end":35,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":17}}, "params": [ { "type": "TypeParameter", - "start": 29, - "end": 31, - "loc": { - "start": { - "line": 2, - "column": 11 - }, - "end": { - "line": 2, - "column": 13 - } - }, + "start":29,"end":31,"loc":{"start":{"line":2,"column":11},"end":{"line":2,"column":13}}, "name": "T", "variance": { "type": "Variance", - "start": 29, - "end": 30, - "loc": { - "start": { - "line": 2, - "column": 11 - }, - "end": { - "line": 2, - "column": 12 - } - }, + "start":29,"end":30,"loc":{"start":{"line":2,"column":11},"end":{"line":2,"column":12}}, "kind": "plus" } }, { "type": "TypeParameter", - "start": 32, - "end": 34, - "loc": { - "start": { - "line": 2, - "column": 14 - }, - "end": { - "line": 2, - "column": 16 - } - }, + "start":32,"end":34,"loc":{"start":{"line":2,"column":14},"end":{"line":2,"column":16}}, "name": "U", "variance": { "type": "Variance", - "start": 32, - "end": 33, - "loc": { - "start": { - "line": 2, - "column": 14 - }, - "end": { - "line": 2, - "column": 15 - } - }, + "start":32,"end":33,"loc":{"start":{"line":2,"column":14},"end":{"line":2,"column":15}}, "kind": "minus" } } @@ -276,129 +87,40 @@ "params": [], "body": { "type": "BlockStatement", - "start": 38, - "end": 40, - "loc": { - "start": { - "line": 2, - "column": 20 - }, - "end": { - "line": 2, - "column": 22 - } - }, + "start":38,"end":40,"loc":{"start":{"line":2,"column":20},"end":{"line":2,"column":22}}, "body": [], "directives": [] } }, { "type": "TypeAlias", - "start": 41, - "end": 59, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 18 - } - }, + "start":41,"end":59,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":18}}, "id": { "type": "Identifier", - "start": 46, - "end": 47, - "loc": { - "start": { - "line": 3, - "column": 5 - }, - "end": { - "line": 3, - "column": 6 - }, - "identifierName": "T" - }, + "start":46,"end":47,"loc":{"start":{"line":3,"column":5},"end":{"line":3,"column":6},"identifierName":"T"}, "name": "T" }, "typeParameters": { "type": "TypeParameterDeclaration", - "start": 47, - "end": 54, - "loc": { - "start": { - "line": 3, - "column": 6 - }, - "end": { - "line": 3, - "column": 13 - } - }, + "start":47,"end":54,"loc":{"start":{"line":3,"column":6},"end":{"line":3,"column":13}}, "params": [ { "type": "TypeParameter", - "start": 48, - "end": 50, - "loc": { - "start": { - "line": 3, - "column": 7 - }, - "end": { - "line": 3, - "column": 9 - } - }, + "start":48,"end":50,"loc":{"start":{"line":3,"column":7},"end":{"line":3,"column":9}}, "name": "T", "variance": { "type": "Variance", - "start": 48, - "end": 49, - "loc": { - "start": { - "line": 3, - "column": 7 - }, - "end": { - "line": 3, - "column": 8 - } - }, + "start":48,"end":49,"loc":{"start":{"line":3,"column":7},"end":{"line":3,"column":8}}, "kind": "plus" } }, { "type": "TypeParameter", - "start": 51, - "end": 53, - "loc": { - "start": { - "line": 3, - "column": 10 - }, - "end": { - "line": 3, - "column": 12 - } - }, + "start":51,"end":53,"loc":{"start":{"line":3,"column":10},"end":{"line":3,"column":12}}, "name": "U", "variance": { "type": "Variance", - "start": 51, - "end": 52, - "loc": { - "start": { - "line": 3, - "column": 10 - }, - "end": { - "line": 3, - "column": 11 - } - }, + "start":51,"end":52,"loc":{"start":{"line":3,"column":10},"end":{"line":3,"column":11}}, "kind": "minus" } } @@ -406,18 +128,7 @@ }, "right": { "type": "ObjectTypeAnnotation", - "start": 57, - "end": 59, - "loc": { - "start": { - "line": 3, - "column": 16 - }, - "end": { - "line": 3, - "column": 18 - } - }, + "start":57,"end":59,"loc":{"start":{"line":3,"column":16},"end":{"line":3,"column":18}}, "callProperties": [], "properties": [], "indexers": [], diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/boolean-explicit/input.js b/packages/babel-parser/test/fixtures/flow/enum-declaration/boolean-explicit/input.js new file mode 100644 index 000000000000..7b63f4eb2962 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/boolean-explicit/input.js @@ -0,0 +1,4 @@ +enum E of boolean { + A = true, + B = false, +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/boolean-explicit/output.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/boolean-explicit/output.json new file mode 100644 index 000000000000..02b996288588 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/boolean-explicit/output.json @@ -0,0 +1,57 @@ +{ + "type": "File", + "start":0,"end":46,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "program": { + "type": "Program", + "start":0,"end":46,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "EnumDeclaration", + "start":0,"end":46,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "id": { + "type": "Identifier", + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"E"}, + "name": "E" + }, + "body": { + "type": "EnumBooleanBody", + "start":7,"end":46,"loc":{"start":{"line":1,"column":7},"end":{"line":4,"column":1}}, + "explicitType": true, + "members": [ + { + "type": "EnumBooleanMember", + "start":22,"end":30,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":10}}, + "id": { + "type": "Identifier", + "start":22,"end":23,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":3},"identifierName":"A"}, + "name": "A" + }, + "init": { + "type": "BooleanLiteral", + "start":26,"end":30,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":10}}, + "value": true + } + }, + { + "type": "EnumBooleanMember", + "start":34,"end":43,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":11}}, + "id": { + "type": "Identifier", + "start":34,"end":35,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":3},"identifierName":"B"}, + "name": "B" + }, + "init": { + "type": "BooleanLiteral", + "start":38,"end":43,"loc":{"start":{"line":3,"column":6},"end":{"line":3,"column":11}}, + "value": false + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/boolean-implicit/input.js b/packages/babel-parser/test/fixtures/flow/enum-declaration/boolean-implicit/input.js new file mode 100644 index 000000000000..6ab49ea7b2b8 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/boolean-implicit/input.js @@ -0,0 +1,4 @@ +enum E { + A = true, + B = false, +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/boolean-implicit/output.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/boolean-implicit/output.json new file mode 100644 index 000000000000..1cde4241aa48 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/boolean-implicit/output.json @@ -0,0 +1,57 @@ +{ + "type": "File", + "start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "program": { + "type": "Program", + "start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "EnumDeclaration", + "start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "id": { + "type": "Identifier", + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"E"}, + "name": "E" + }, + "body": { + "type": "EnumBooleanBody", + "start":7,"end":35,"loc":{"start":{"line":1,"column":7},"end":{"line":4,"column":1}}, + "explicitType": false, + "members": [ + { + "type": "EnumBooleanMember", + "start":11,"end":19,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":10}}, + "id": { + "type": "Identifier", + "start":11,"end":12,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":3},"identifierName":"A"}, + "name": "A" + }, + "init": { + "type": "BooleanLiteral", + "start":15,"end":19,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":10}}, + "value": true + } + }, + { + "type": "EnumBooleanMember", + "start":23,"end":32,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":11}}, + "id": { + "type": "Identifier", + "start":23,"end":24,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":3},"identifierName":"B"}, + "name": "B" + }, + "init": { + "type": "BooleanLiteral", + "start":27,"end":32,"loc":{"start":{"line":3,"column":6},"end":{"line":3,"column":11}}, + "value": false + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/boolean-member-not-initialized-explicit/input.js b/packages/babel-parser/test/fixtures/flow/enum-declaration/boolean-member-not-initialized-explicit/input.js new file mode 100644 index 000000000000..4fecb537fb2e --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/boolean-member-not-initialized-explicit/input.js @@ -0,0 +1,3 @@ +enum E of boolean { + A, +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/boolean-member-not-initialized-explicit/options.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/boolean-member-not-initialized-explicit/options.json new file mode 100644 index 000000000000..53fd48c051cb --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/boolean-member-not-initialized-explicit/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["flow", { "enums": true }]] +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/boolean-member-not-initialized-explicit/output.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/boolean-member-not-initialized-explicit/output.json new file mode 100644 index 000000000000..9cd2d5701c55 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/boolean-member-not-initialized-explicit/output.json @@ -0,0 +1,31 @@ +{ + "type": "File", + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "errors": [ + "SyntaxError: Boolean enum members need to be initialized. Use either `A = true,` or `A = false,` in enum `E`. (2:2)" + ], + "program": { + "type": "Program", + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "EnumDeclaration", + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "id": { + "type": "Identifier", + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"E"}, + "name": "E" + }, + "body": { + "type": "EnumBooleanBody", + "start":7,"end":26,"loc":{"start":{"line":1,"column":7},"end":{"line":3,"column":1}}, + "explicitType": true, + "members": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/boolean-member-not-initialized-implicit/input.js b/packages/babel-parser/test/fixtures/flow/enum-declaration/boolean-member-not-initialized-implicit/input.js new file mode 100644 index 000000000000..73704345dc4b --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/boolean-member-not-initialized-implicit/input.js @@ -0,0 +1,4 @@ +enum E { + A, + B = true, +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/boolean-member-not-initialized-implicit/options.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/boolean-member-not-initialized-implicit/options.json new file mode 100644 index 000000000000..53fd48c051cb --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/boolean-member-not-initialized-implicit/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["flow", { "enums": true }]] +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/boolean-member-not-initialized-implicit/output.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/boolean-member-not-initialized-implicit/output.json new file mode 100644 index 000000000000..ef24cd6ca0fd --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/boolean-member-not-initialized-implicit/output.json @@ -0,0 +1,46 @@ +{ + "type": "File", + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "errors": [ + "SyntaxError: Boolean enum members need to be initialized. Use either `A = true,` or `A = false,` in enum `E`. (2:2)" + ], + "program": { + "type": "Program", + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "EnumDeclaration", + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "id": { + "type": "Identifier", + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"E"}, + "name": "E" + }, + "body": { + "type": "EnumBooleanBody", + "start":7,"end":27,"loc":{"start":{"line":1,"column":7},"end":{"line":4,"column":1}}, + "explicitType": false, + "members": [ + { + "type": "EnumBooleanMember", + "start":16,"end":24,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":10}}, + "id": { + "type": "Identifier", + "start":16,"end":17,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":3},"identifierName":"B"}, + "name": "B" + }, + "init": { + "type": "BooleanLiteral", + "start":20,"end":24,"loc":{"start":{"line":3,"column":6},"end":{"line":3,"column":10}}, + "value": true + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/duplicate-member-name/input.js b/packages/babel-parser/test/fixtures/flow/enum-declaration/duplicate-member-name/input.js new file mode 100644 index 000000000000..c9fde50253ac --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/duplicate-member-name/input.js @@ -0,0 +1,4 @@ +enum E { + A, + A, +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/duplicate-member-name/options.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/duplicate-member-name/options.json new file mode 100644 index 000000000000..53fd48c051cb --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/duplicate-member-name/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["flow", { "enums": true }]] +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/duplicate-member-name/output.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/duplicate-member-name/output.json new file mode 100644 index 000000000000..5ebbed1e950a --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/duplicate-member-name/output.json @@ -0,0 +1,50 @@ +{ + "type": "File", + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "errors": [ + "SyntaxError: Enum member names need to be unique, but the name `A` has already been used before in enum `E`. (3:2)" + ], + "program": { + "type": "Program", + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "EnumDeclaration", + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "id": { + "type": "Identifier", + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"E"}, + "name": "E" + }, + "body": { + "type": "EnumStringBody", + "start":7,"end":20,"loc":{"start":{"line":1,"column":7},"end":{"line":4,"column":1}}, + "explicitType": false, + "members": [ + { + "type": "EnumDefaultedMember", + "start":11,"end":12,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":3}}, + "id": { + "type": "Identifier", + "start":11,"end":12,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":3},"identifierName":"A"}, + "name": "A" + } + }, + { + "type": "EnumDefaultedMember", + "start":16,"end":17,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":3}}, + "id": { + "type": "Identifier", + "start":16,"end":17,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":3},"identifierName":"A"}, + "name": "A" + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/empty/input.js b/packages/babel-parser/test/fixtures/flow/enum-declaration/empty/input.js new file mode 100644 index 000000000000..714f607bf333 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/empty/input.js @@ -0,0 +1 @@ +enum E { } diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/empty/output.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/empty/output.json new file mode 100644 index 000000000000..df6b983d915f --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/empty/output.json @@ -0,0 +1,28 @@ +{ + "type": "File", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "program": { + "type": "Program", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "EnumDeclaration", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "id": { + "type": "Identifier", + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"E"}, + "name": "E" + }, + "body": { + "type": "EnumStringBody", + "start":7,"end":10,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":10}}, + "explicitType": false, + "members": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/end-of-file/input.js b/packages/babel-parser/test/fixtures/flow/enum-declaration/end-of-file/input.js new file mode 100644 index 000000000000..e3caefb45c49 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/end-of-file/input.js @@ -0,0 +1 @@ +enum diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/end-of-file/options.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/end-of-file/options.json new file mode 100644 index 000000000000..030f339842d5 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/end-of-file/options.json @@ -0,0 +1,4 @@ +{ + "plugins": [["flow", { "enums": true }]], + "throws": "Unexpected token (1:4)" +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/enum-name/input.js b/packages/babel-parser/test/fixtures/flow/enum-declaration/enum-name/input.js new file mode 100644 index 000000000000..8d057902fa7e --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/enum-name/input.js @@ -0,0 +1,2 @@ +enum type { +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/enum-name/output.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/enum-name/output.json new file mode 100644 index 000000000000..758f952645c5 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/enum-name/output.json @@ -0,0 +1,28 @@ +{ + "type": "File", + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":1}}, + "program": { + "type": "Program", + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "EnumDeclaration", + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":1}}, + "id": { + "type": "Identifier", + "start":5,"end":9,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":9},"identifierName":"type"}, + "name": "type" + }, + "body": { + "type": "EnumStringBody", + "start":10,"end":13,"loc":{"start":{"line":1,"column":10},"end":{"line":2,"column":1}}, + "explicitType": false, + "members": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/export/input.js b/packages/babel-parser/test/fixtures/flow/enum-declaration/export/input.js new file mode 100644 index 000000000000..ebdc5a4a8bb8 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/export/input.js @@ -0,0 +1,3 @@ +export enum A {} + +export default enum B {} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/export/options.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/export/options.json new file mode 100644 index 000000000000..9d3b4fdaaa37 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/export/options.json @@ -0,0 +1,4 @@ +{ + "plugins": [["flow", { "enums": true }]], + "sourceType": "module" +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/export/output.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/export/output.json new file mode 100644 index 000000000000..f5ddd9661e42 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/export/output.json @@ -0,0 +1,54 @@ +{ + "type": "File", + "start":0,"end":42,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":24}}, + "program": { + "type": "Program", + "start":0,"end":42,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":24}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExportNamedDeclaration", + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, + "specifiers": [], + "source": null, + "exportKind": "value", + "declaration": { + "type": "EnumDeclaration", + "start":7,"end":16,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":16}}, + "id": { + "type": "Identifier", + "start":12,"end":13,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":13},"identifierName":"A"}, + "name": "A" + }, + "body": { + "type": "EnumStringBody", + "start":14,"end":16,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":16}}, + "explicitType": false, + "members": [] + } + } + }, + { + "type": "ExportDefaultDeclaration", + "start":18,"end":42,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":24}}, + "declaration": { + "type": "EnumDeclaration", + "start":33,"end":42,"loc":{"start":{"line":3,"column":15},"end":{"line":3,"column":24}}, + "id": { + "type": "Identifier", + "start":38,"end":39,"loc":{"start":{"line":3,"column":20},"end":{"line":3,"column":21},"identifierName":"B"}, + "name": "B" + }, + "body": { + "type": "EnumStringBody", + "start":40,"end":42,"loc":{"start":{"line":3,"column":22},"end":{"line":3,"column":24}}, + "explicitType": false, + "members": [] + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/inconsistent-member-values-majority-defaulted/input.js b/packages/babel-parser/test/fixtures/flow/enum-declaration/inconsistent-member-values-majority-defaulted/input.js new file mode 100644 index 000000000000..5a639f107119 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/inconsistent-member-values-majority-defaulted/input.js @@ -0,0 +1,5 @@ +enum E { + A, + B, + C = 3, +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/inconsistent-member-values-majority-defaulted/options.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/inconsistent-member-values-majority-defaulted/options.json new file mode 100644 index 000000000000..53fd48c051cb --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/inconsistent-member-values-majority-defaulted/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["flow", { "enums": true }]] +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/inconsistent-member-values-majority-defaulted/output.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/inconsistent-member-values-majority-defaulted/output.json new file mode 100644 index 000000000000..e63c726b3b70 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/inconsistent-member-values-majority-defaulted/output.json @@ -0,0 +1,31 @@ +{ + "type": "File", + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, + "errors": [ + "SyntaxError: Enum `E` has inconsistent member initializers. Either use no initializers, or consistently use literals (either booleans, numbers, or strings) for all member initializers. (1:5)" + ], + "program": { + "type": "Program", + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "EnumDeclaration", + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, + "id": { + "type": "Identifier", + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"E"}, + "name": "E" + }, + "body": { + "type": "EnumStringBody", + "start":7,"end":29,"loc":{"start":{"line":1,"column":7},"end":{"line":5,"column":1}}, + "explicitType": false, + "members": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/inconsistent-member-values-mixed-initializers/input.js b/packages/babel-parser/test/fixtures/flow/enum-declaration/inconsistent-member-values-mixed-initializers/input.js new file mode 100644 index 000000000000..b0b10ec4d43a --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/inconsistent-member-values-mixed-initializers/input.js @@ -0,0 +1,4 @@ +enum E { + A = 1, + B = true, +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/inconsistent-member-values-mixed-initializers/options.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/inconsistent-member-values-mixed-initializers/options.json new file mode 100644 index 000000000000..53fd48c051cb --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/inconsistent-member-values-mixed-initializers/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["flow", { "enums": true }]] +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/inconsistent-member-values-mixed-initializers/output.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/inconsistent-member-values-mixed-initializers/output.json new file mode 100644 index 000000000000..8f536f701906 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/inconsistent-member-values-mixed-initializers/output.json @@ -0,0 +1,31 @@ +{ + "type": "File", + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "errors": [ + "SyntaxError: Enum `E` has inconsistent member initializers. Either use no initializers, or consistently use literals (either booleans, numbers, or strings) for all member initializers. (1:5)" + ], + "program": { + "type": "Program", + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "EnumDeclaration", + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "id": { + "type": "Identifier", + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"E"}, + "name": "E" + }, + "body": { + "type": "EnumStringBody", + "start":7,"end":31,"loc":{"start":{"line":1,"column":7},"end":{"line":4,"column":1}}, + "explicitType": false, + "members": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-explicit-type-expression/input.js b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-explicit-type-expression/input.js new file mode 100644 index 000000000000..e3353ef78879 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-explicit-type-expression/input.js @@ -0,0 +1,2 @@ +enum E of [] { +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-explicit-type-expression/options.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-explicit-type-expression/options.json new file mode 100644 index 000000000000..9916e88639b9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-explicit-type-expression/options.json @@ -0,0 +1,4 @@ +{ + "plugins": [["flow", { "enums": true }]], + "throws": "Supplied enum type is not valid. Use one of `boolean`, `number`, `string`, or `symbol` in enum `E`. (1:10)" +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-explicit-type-identifier/input.js b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-explicit-type-identifier/input.js new file mode 100644 index 000000000000..25bbeb7024e8 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-explicit-type-identifier/input.js @@ -0,0 +1,2 @@ +enum E of xxx { +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-explicit-type-identifier/options.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-explicit-type-identifier/options.json new file mode 100644 index 000000000000..53fd48c051cb --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-explicit-type-identifier/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["flow", { "enums": true }]] +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-explicit-type-identifier/output.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-explicit-type-identifier/output.json new file mode 100644 index 000000000000..bdd2f9ac8fb1 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-explicit-type-identifier/output.json @@ -0,0 +1,31 @@ +{ + "type": "File", + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":1}}, + "errors": [ + "SyntaxError: Enum type `xxx` is not valid. Use one of `boolean`, `number`, `string`, or `symbol` in enum `E`. (1:14)" + ], + "program": { + "type": "Program", + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "EnumDeclaration", + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":1}}, + "id": { + "type": "Identifier", + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"E"}, + "name": "E" + }, + "body": { + "type": "EnumStringBody", + "start":7,"end":17,"loc":{"start":{"line":1,"column":7},"end":{"line":2,"column":1}}, + "explicitType": false, + "members": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-boolean-explicit-string/input.js b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-boolean-explicit-string/input.js new file mode 100644 index 000000000000..31e79ef9f119 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-boolean-explicit-string/input.js @@ -0,0 +1,3 @@ +enum E of string { + A = true, +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-boolean-explicit-string/options.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-boolean-explicit-string/options.json new file mode 100644 index 000000000000..53fd48c051cb --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-boolean-explicit-string/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["flow", { "enums": true }]] +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-boolean-explicit-string/output.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-boolean-explicit-string/output.json new file mode 100644 index 000000000000..0c9f36244f81 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-boolean-explicit-string/output.json @@ -0,0 +1,31 @@ +{ + "type": "File", + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "errors": [ + "SyntaxError: Enum `E` has type `string`, so the initializer of `A` needs to be a string literal. (2:6)" + ], + "program": { + "type": "Program", + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "EnumDeclaration", + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "id": { + "type": "Identifier", + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"E"}, + "name": "E" + }, + "body": { + "type": "EnumStringBody", + "start":7,"end":32,"loc":{"start":{"line":1,"column":7},"end":{"line":3,"column":1}}, + "explicitType": true, + "members": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-expression-explicit-boolean/input.js b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-expression-explicit-boolean/input.js new file mode 100644 index 000000000000..d4f1afa92f09 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-expression-explicit-boolean/input.js @@ -0,0 +1,3 @@ +enum E of boolean { + A = 1 + 2, +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-expression-explicit-boolean/options.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-expression-explicit-boolean/options.json new file mode 100644 index 000000000000..14ed173defa0 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-expression-explicit-boolean/options.json @@ -0,0 +1,4 @@ +{ + "plugins": [["flow", { "enums": true }]], + "throws": "Enum `E` has type `boolean`, so the initializer of `A` needs to be a boolean literal. (2:6)" +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-expression-explicit-number/input.js b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-expression-explicit-number/input.js new file mode 100644 index 000000000000..a6f7ed2152c2 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-expression-explicit-number/input.js @@ -0,0 +1,3 @@ +enum E of number { + A = 1 + 2, +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-expression-explicit-number/options.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-expression-explicit-number/options.json new file mode 100644 index 000000000000..7a8a81f75442 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-expression-explicit-number/options.json @@ -0,0 +1,4 @@ +{ + "plugins": [["flow", { "enums": true }]], + "throws": "Enum `E` has type `number`, so the initializer of `A` needs to be a number literal. (2:6)" +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-expression-explicit-string/input.js b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-expression-explicit-string/input.js new file mode 100644 index 000000000000..704efcf615b5 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-expression-explicit-string/input.js @@ -0,0 +1,3 @@ +enum E of string { + A = 1 + 2, +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-expression-explicit-string/options.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-expression-explicit-string/options.json new file mode 100644 index 000000000000..1587909dd62e --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-expression-explicit-string/options.json @@ -0,0 +1,4 @@ +{ + "plugins": [["flow", { "enums": true }]], + "throws": "Enum `E` has type `string`, so the initializer of `A` needs to be a string literal. (2:6)" +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-expression-explicit-symbol/input.js b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-expression-explicit-symbol/input.js new file mode 100644 index 000000000000..d4acb6dfd235 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-expression-explicit-symbol/input.js @@ -0,0 +1,3 @@ +enum E of symbol { + A = 1 + 2, +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-expression-explicit-symbol/options.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-expression-explicit-symbol/options.json new file mode 100644 index 000000000000..e9b2692f126a --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-expression-explicit-symbol/options.json @@ -0,0 +1,4 @@ +{ + "plugins": [["flow", { "enums": true }]], + "throws": "Symbol enum members cannot be initialized. Use `A,` in enum `E`. (2:6)" +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-expression-implicit/input.js b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-expression-implicit/input.js new file mode 100644 index 000000000000..bed31f7fdc1c --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-expression-implicit/input.js @@ -0,0 +1,3 @@ +enum E { + A = 1 + 2, +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-expression-implicit/options.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-expression-implicit/options.json new file mode 100644 index 000000000000..282f44e03ab4 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-expression-implicit/options.json @@ -0,0 +1,4 @@ +{ + "plugins": [["flow", { "enums": true }]], + "throws": "The enum member initializer for `A` needs to be a literal (either a boolean, number, or string) in enum `E`. (2:6)" +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-literal-explicit-symbol/input.js b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-literal-explicit-symbol/input.js new file mode 100644 index 000000000000..dc8429b75342 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-literal-explicit-symbol/input.js @@ -0,0 +1,3 @@ +enum E of symbol { + A = 1, +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-literal-explicit-symbol/options.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-literal-explicit-symbol/options.json new file mode 100644 index 000000000000..53fd48c051cb --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-literal-explicit-symbol/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["flow", { "enums": true }]] +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-literal-explicit-symbol/output.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-literal-explicit-symbol/output.json new file mode 100644 index 000000000000..cc53bdf91782 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-literal-explicit-symbol/output.json @@ -0,0 +1,30 @@ +{ + "type": "File", + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "errors": [ + "SyntaxError: Symbol enum members cannot be initialized. Use `A,` in enum `E`. (2:6)" + ], + "program": { + "type": "Program", + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "EnumDeclaration", + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "id": { + "type": "Identifier", + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"E"}, + "name": "E" + }, + "body": { + "type": "EnumSymbolBody", + "start":7,"end":29,"loc":{"start":{"line":1,"column":7},"end":{"line":3,"column":1}}, + "members": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-number-explicit-boolean/input.js b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-number-explicit-boolean/input.js new file mode 100644 index 000000000000..81e1097efdd9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-number-explicit-boolean/input.js @@ -0,0 +1,3 @@ +enum E of boolean { + A = 1, +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-number-explicit-boolean/options.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-number-explicit-boolean/options.json new file mode 100644 index 000000000000..53fd48c051cb --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-number-explicit-boolean/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["flow", { "enums": true }]] +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-number-explicit-boolean/output.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-number-explicit-boolean/output.json new file mode 100644 index 000000000000..2e86e933c0d5 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-number-explicit-boolean/output.json @@ -0,0 +1,31 @@ +{ + "type": "File", + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "errors": [ + "SyntaxError: Enum `E` has type `boolean`, so the initializer of `A` needs to be a boolean literal. (2:6)" + ], + "program": { + "type": "Program", + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "EnumDeclaration", + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "id": { + "type": "Identifier", + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"E"}, + "name": "E" + }, + "body": { + "type": "EnumBooleanBody", + "start":7,"end":30,"loc":{"start":{"line":1,"column":7},"end":{"line":3,"column":1}}, + "explicitType": true, + "members": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-number-explicit-string/input.js b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-number-explicit-string/input.js new file mode 100644 index 000000000000..708914906e1d --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-number-explicit-string/input.js @@ -0,0 +1,3 @@ +enum E of string { + A = 1, +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-number-explicit-string/options.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-number-explicit-string/options.json new file mode 100644 index 000000000000..53fd48c051cb --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-number-explicit-string/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["flow", { "enums": true }]] +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-number-explicit-string/output.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-number-explicit-string/output.json new file mode 100644 index 000000000000..2d654faa00d2 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-number-explicit-string/output.json @@ -0,0 +1,31 @@ +{ + "type": "File", + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "errors": [ + "SyntaxError: Enum `E` has type `string`, so the initializer of `A` needs to be a string literal. (2:6)" + ], + "program": { + "type": "Program", + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "EnumDeclaration", + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "id": { + "type": "Identifier", + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"E"}, + "name": "E" + }, + "body": { + "type": "EnumStringBody", + "start":7,"end":29,"loc":{"start":{"line":1,"column":7},"end":{"line":3,"column":1}}, + "explicitType": true, + "members": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-parenthesized/input.js b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-parenthesized/input.js new file mode 100644 index 000000000000..92cc2012d905 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-parenthesized/input.js @@ -0,0 +1,3 @@ +enum E { + A = (1), +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-parenthesized/options.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-parenthesized/options.json new file mode 100644 index 000000000000..282f44e03ab4 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-parenthesized/options.json @@ -0,0 +1,4 @@ +{ + "plugins": [["flow", { "enums": true }]], + "throws": "The enum member initializer for `A` needs to be a literal (either a boolean, number, or string) in enum `E`. (2:6)" +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-string-explicit-boolean/input.js b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-string-explicit-boolean/input.js new file mode 100644 index 000000000000..86674e7f2053 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-string-explicit-boolean/input.js @@ -0,0 +1,3 @@ +enum E of boolean { + A = "hi", +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-string-explicit-boolean/options.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-string-explicit-boolean/options.json new file mode 100644 index 000000000000..53fd48c051cb --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-string-explicit-boolean/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["flow", { "enums": true }]] +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-string-explicit-boolean/output.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-string-explicit-boolean/output.json new file mode 100644 index 000000000000..0d7f98f68eb8 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-string-explicit-boolean/output.json @@ -0,0 +1,31 @@ +{ + "type": "File", + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "errors": [ + "SyntaxError: Enum `E` has type `boolean`, so the initializer of `A` needs to be a boolean literal. (2:6)" + ], + "program": { + "type": "Program", + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "EnumDeclaration", + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "id": { + "type": "Identifier", + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"E"}, + "name": "E" + }, + "body": { + "type": "EnumBooleanBody", + "start":7,"end":33,"loc":{"start":{"line":1,"column":7},"end":{"line":3,"column":1}}, + "explicitType": true, + "members": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-string-explicit-number/input.js b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-string-explicit-number/input.js new file mode 100644 index 000000000000..5b0a7937af0a --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-string-explicit-number/input.js @@ -0,0 +1,3 @@ +enum E of number { + A = "hi", +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-string-explicit-number/options.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-string-explicit-number/options.json new file mode 100644 index 000000000000..53fd48c051cb --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-string-explicit-number/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["flow", { "enums": true }]] +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-string-explicit-number/output.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-string-explicit-number/output.json new file mode 100644 index 000000000000..b55c6b5b9d41 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-string-explicit-number/output.json @@ -0,0 +1,31 @@ +{ + "type": "File", + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "errors": [ + "SyntaxError: Enum `E` has type `number`, so the initializer of `A` needs to be a number literal. (2:6)" + ], + "program": { + "type": "Program", + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "EnumDeclaration", + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "id": { + "type": "Identifier", + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"E"}, + "name": "E" + }, + "body": { + "type": "EnumNumberBody", + "start":7,"end":32,"loc":{"start":{"line":1,"column":7},"end":{"line":3,"column":1}}, + "explicitType": true, + "members": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-name/input.js b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-name/input.js new file mode 100644 index 000000000000..3604a85bb2d4 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-name/input.js @@ -0,0 +1,4 @@ +enum E { + foo, + bar, +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-name/options.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-name/options.json new file mode 100644 index 000000000000..53fd48c051cb --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-name/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["flow", { "enums": true }]] +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-name/output.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-name/output.json new file mode 100644 index 000000000000..9fe35c22085d --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-name/output.json @@ -0,0 +1,51 @@ +{ + "type": "File", + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "errors": [ + "SyntaxError: Enum member names cannot start with lowercase 'a' through 'z'. Instead of using `foo`, consider using `Foo`, in enum `E`. (2:2)", + "SyntaxError: Enum member names cannot start with lowercase 'a' through 'z'. Instead of using `bar`, consider using `Bar`, in enum `E`. (3:2)" + ], + "program": { + "type": "Program", + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "EnumDeclaration", + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "id": { + "type": "Identifier", + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"E"}, + "name": "E" + }, + "body": { + "type": "EnumStringBody", + "start":7,"end":24,"loc":{"start":{"line":1,"column":7},"end":{"line":4,"column":1}}, + "explicitType": false, + "members": [ + { + "type": "EnumDefaultedMember", + "start":11,"end":14,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":5}}, + "id": { + "type": "Identifier", + "start":11,"end":14,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":5},"identifierName":"foo"}, + "name": "foo" + } + }, + { + "type": "EnumDefaultedMember", + "start":18,"end":21,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":5}}, + "id": { + "type": "Identifier", + "start":18,"end":21,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":5},"identifierName":"bar"}, + "name": "bar" + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/no-trailing-comma/input.js b/packages/babel-parser/test/fixtures/flow/enum-declaration/no-trailing-comma/input.js new file mode 100644 index 000000000000..228a928299de --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/no-trailing-comma/input.js @@ -0,0 +1,3 @@ +enum E { + A +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/no-trailing-comma/output.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/no-trailing-comma/output.json new file mode 100644 index 000000000000..2d409165d994 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/no-trailing-comma/output.json @@ -0,0 +1,38 @@ +{ + "type": "File", + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "program": { + "type": "Program", + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "EnumDeclaration", + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "id": { + "type": "Identifier", + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"E"}, + "name": "E" + }, + "body": { + "type": "EnumStringBody", + "start":7,"end":14,"loc":{"start":{"line":1,"column":7},"end":{"line":3,"column":1}}, + "explicitType": false, + "members": [ + { + "type": "EnumDefaultedMember", + "start":11,"end":12,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":3}}, + "id": { + "type": "Identifier", + "start":11,"end":12,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":3},"identifierName":"A"}, + "name": "A" + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/number-explicit/input.js b/packages/babel-parser/test/fixtures/flow/enum-declaration/number-explicit/input.js new file mode 100644 index 000000000000..f597c5898aa0 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/number-explicit/input.js @@ -0,0 +1,4 @@ +enum E of number { + A = 1, + B = 2, +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/number-explicit/output.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/number-explicit/output.json new file mode 100644 index 000000000000..7422817d7443 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/number-explicit/output.json @@ -0,0 +1,65 @@ +{ + "type": "File", + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "program": { + "type": "Program", + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "EnumDeclaration", + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "id": { + "type": "Identifier", + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"E"}, + "name": "E" + }, + "body": { + "type": "EnumNumberBody", + "start":7,"end":38,"loc":{"start":{"line":1,"column":7},"end":{"line":4,"column":1}}, + "explicitType": true, + "members": [ + { + "type": "EnumNumberMember", + "start":21,"end":26,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":7}}, + "id": { + "type": "Identifier", + "start":21,"end":22,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":3},"identifierName":"A"}, + "name": "A" + }, + "init": { + "type": "NumericLiteral", + "start":25,"end":26,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":7}}, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + }, + { + "type": "EnumNumberMember", + "start":30,"end":35,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":7}}, + "id": { + "type": "Identifier", + "start":30,"end":31,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":3},"identifierName":"B"}, + "name": "B" + }, + "init": { + "type": "NumericLiteral", + "start":34,"end":35,"loc":{"start":{"line":3,"column":6},"end":{"line":3,"column":7}}, + "extra": { + "rawValue": 2, + "raw": "2" + }, + "value": 2 + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/number-implicit/input.js b/packages/babel-parser/test/fixtures/flow/enum-declaration/number-implicit/input.js new file mode 100644 index 000000000000..1b99bb7ff34a --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/number-implicit/input.js @@ -0,0 +1,4 @@ +enum E { + A = 1, + B = 2, +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/number-implicit/output.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/number-implicit/output.json new file mode 100644 index 000000000000..56cc5c9ace8a --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/number-implicit/output.json @@ -0,0 +1,65 @@ +{ + "type": "File", + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "program": { + "type": "Program", + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "EnumDeclaration", + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "id": { + "type": "Identifier", + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"E"}, + "name": "E" + }, + "body": { + "type": "EnumNumberBody", + "start":7,"end":28,"loc":{"start":{"line":1,"column":7},"end":{"line":4,"column":1}}, + "explicitType": false, + "members": [ + { + "type": "EnumNumberMember", + "start":11,"end":16,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":7}}, + "id": { + "type": "Identifier", + "start":11,"end":12,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":3},"identifierName":"A"}, + "name": "A" + }, + "init": { + "type": "NumericLiteral", + "start":15,"end":16,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":7}}, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + }, + { + "type": "EnumNumberMember", + "start":20,"end":25,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":7}}, + "id": { + "type": "Identifier", + "start":20,"end":21,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":3},"identifierName":"B"}, + "name": "B" + }, + "init": { + "type": "NumericLiteral", + "start":24,"end":25,"loc":{"start":{"line":3,"column":6},"end":{"line":3,"column":7}}, + "extra": { + "rawValue": 2, + "raw": "2" + }, + "value": 2 + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/number-member-not-initialized-explicit/input.js b/packages/babel-parser/test/fixtures/flow/enum-declaration/number-member-not-initialized-explicit/input.js new file mode 100644 index 000000000000..7f4f9cb05bbf --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/number-member-not-initialized-explicit/input.js @@ -0,0 +1,3 @@ +enum E of number { + A, +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/number-member-not-initialized-explicit/options.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/number-member-not-initialized-explicit/options.json new file mode 100644 index 000000000000..53fd48c051cb --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/number-member-not-initialized-explicit/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["flow", { "enums": true }]] +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/number-member-not-initialized-explicit/output.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/number-member-not-initialized-explicit/output.json new file mode 100644 index 000000000000..da174b55f384 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/number-member-not-initialized-explicit/output.json @@ -0,0 +1,31 @@ +{ + "type": "File", + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "errors": [ + "SyntaxError: Number enum members need to be initialized, e.g. `A = 1` in enum `E`. (2:2)" + ], + "program": { + "type": "Program", + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "EnumDeclaration", + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "id": { + "type": "Identifier", + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"E"}, + "name": "E" + }, + "body": { + "type": "EnumNumberBody", + "start":7,"end":25,"loc":{"start":{"line":1,"column":7},"end":{"line":3,"column":1}}, + "explicitType": true, + "members": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/number-member-not-initialized-implicit/input.js b/packages/babel-parser/test/fixtures/flow/enum-declaration/number-member-not-initialized-implicit/input.js new file mode 100644 index 000000000000..a435e44e3da9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/number-member-not-initialized-implicit/input.js @@ -0,0 +1,4 @@ +enum E { + A, + B = 1, +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/number-member-not-initialized-implicit/options.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/number-member-not-initialized-implicit/options.json new file mode 100644 index 000000000000..53fd48c051cb --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/number-member-not-initialized-implicit/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["flow", { "enums": true }]] +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/number-member-not-initialized-implicit/output.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/number-member-not-initialized-implicit/output.json new file mode 100644 index 000000000000..baf3a7cb99ec --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/number-member-not-initialized-implicit/output.json @@ -0,0 +1,50 @@ +{ + "type": "File", + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "errors": [ + "SyntaxError: Number enum members need to be initialized, e.g. `A = 1` in enum `E`. (2:2)" + ], + "program": { + "type": "Program", + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "EnumDeclaration", + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "id": { + "type": "Identifier", + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"E"}, + "name": "E" + }, + "body": { + "type": "EnumNumberBody", + "start":7,"end":24,"loc":{"start":{"line":1,"column":7},"end":{"line":4,"column":1}}, + "explicitType": false, + "members": [ + { + "type": "EnumNumberMember", + "start":16,"end":21,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":7}}, + "id": { + "type": "Identifier", + "start":16,"end":17,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":3},"identifierName":"B"}, + "name": "B" + }, + "init": { + "type": "NumericLiteral", + "start":20,"end":21,"loc":{"start":{"line":3,"column":6},"end":{"line":3,"column":7}}, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/options.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/options.json new file mode 100644 index 000000000000..53fd48c051cb --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["flow", { "enums": true }]] +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/reserved-word-enum-name/input.js b/packages/babel-parser/test/fixtures/flow/enum-declaration/reserved-word-enum-name/input.js new file mode 100644 index 000000000000..95350dba2f86 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/reserved-word-enum-name/input.js @@ -0,0 +1,2 @@ +enum class { +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/reserved-word-enum-name/options.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/reserved-word-enum-name/options.json new file mode 100644 index 000000000000..53fd48c051cb --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/reserved-word-enum-name/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["flow", { "enums": true }]] +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/reserved-word-enum-name/output.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/reserved-word-enum-name/output.json new file mode 100644 index 000000000000..2eb913529f69 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/reserved-word-enum-name/output.json @@ -0,0 +1,31 @@ +{ + "type": "File", + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":1}}, + "errors": [ + "SyntaxError: Unexpected keyword 'class' (1:5)" + ], + "program": { + "type": "Program", + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "EnumDeclaration", + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":1}}, + "id": { + "type": "Identifier", + "start":5,"end":10,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":10},"identifierName":"class"}, + "name": "class" + }, + "body": { + "type": "EnumStringBody", + "start":11,"end":14,"loc":{"start":{"line":1,"column":11},"end":{"line":2,"column":1}}, + "explicitType": false, + "members": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/string-explicit-defaulted/input.js b/packages/babel-parser/test/fixtures/flow/enum-declaration/string-explicit-defaulted/input.js new file mode 100644 index 000000000000..0d3f7fed8378 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/string-explicit-defaulted/input.js @@ -0,0 +1,4 @@ +enum E of string { + A, + B, +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/string-explicit-defaulted/output.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/string-explicit-defaulted/output.json new file mode 100644 index 000000000000..00c64b6bad97 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/string-explicit-defaulted/output.json @@ -0,0 +1,47 @@ +{ + "type": "File", + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "program": { + "type": "Program", + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "EnumDeclaration", + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "id": { + "type": "Identifier", + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"E"}, + "name": "E" + }, + "body": { + "type": "EnumStringBody", + "start":7,"end":30,"loc":{"start":{"line":1,"column":7},"end":{"line":4,"column":1}}, + "explicitType": true, + "members": [ + { + "type": "EnumDefaultedMember", + "start":21,"end":22,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":3}}, + "id": { + "type": "Identifier", + "start":21,"end":22,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":3},"identifierName":"A"}, + "name": "A" + } + }, + { + "type": "EnumDefaultedMember", + "start":26,"end":27,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":3}}, + "id": { + "type": "Identifier", + "start":26,"end":27,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":3},"identifierName":"B"}, + "name": "B" + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/string-explicit-initialized/input.js b/packages/babel-parser/test/fixtures/flow/enum-declaration/string-explicit-initialized/input.js new file mode 100644 index 000000000000..4d27120ac56a --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/string-explicit-initialized/input.js @@ -0,0 +1,4 @@ +enum E of string { + A = "a", + B = "b", +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/string-explicit-initialized/output.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/string-explicit-initialized/output.json new file mode 100644 index 000000000000..b2d881c84b94 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/string-explicit-initialized/output.json @@ -0,0 +1,65 @@ +{ + "type": "File", + "start":0,"end":42,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "program": { + "type": "Program", + "start":0,"end":42,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "EnumDeclaration", + "start":0,"end":42,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "id": { + "type": "Identifier", + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"E"}, + "name": "E" + }, + "body": { + "type": "EnumStringBody", + "start":7,"end":42,"loc":{"start":{"line":1,"column":7},"end":{"line":4,"column":1}}, + "explicitType": true, + "members": [ + { + "type": "EnumStringMember", + "start":21,"end":28,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":9}}, + "id": { + "type": "Identifier", + "start":21,"end":22,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":3},"identifierName":"A"}, + "name": "A" + }, + "init": { + "type": "StringLiteral", + "start":25,"end":28,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":9}}, + "extra": { + "rawValue": "a", + "raw": "\"a\"" + }, + "value": "a" + } + }, + { + "type": "EnumStringMember", + "start":32,"end":39,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":9}}, + "id": { + "type": "Identifier", + "start":32,"end":33,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":3},"identifierName":"B"}, + "name": "B" + }, + "init": { + "type": "StringLiteral", + "start":36,"end":39,"loc":{"start":{"line":3,"column":6},"end":{"line":3,"column":9}}, + "extra": { + "rawValue": "b", + "raw": "\"b\"" + }, + "value": "b" + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/string-implicit-defaulted/input.js b/packages/babel-parser/test/fixtures/flow/enum-declaration/string-implicit-defaulted/input.js new file mode 100644 index 000000000000..b74648fd612c --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/string-implicit-defaulted/input.js @@ -0,0 +1,4 @@ +enum E { + A, + B, +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/string-implicit-defaulted/output.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/string-implicit-defaulted/output.json new file mode 100644 index 000000000000..ca27f1e722d6 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/string-implicit-defaulted/output.json @@ -0,0 +1,47 @@ +{ + "type": "File", + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "program": { + "type": "Program", + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "EnumDeclaration", + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "id": { + "type": "Identifier", + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"E"}, + "name": "E" + }, + "body": { + "type": "EnumStringBody", + "start":7,"end":20,"loc":{"start":{"line":1,"column":7},"end":{"line":4,"column":1}}, + "explicitType": false, + "members": [ + { + "type": "EnumDefaultedMember", + "start":11,"end":12,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":3}}, + "id": { + "type": "Identifier", + "start":11,"end":12,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":3},"identifierName":"A"}, + "name": "A" + } + }, + { + "type": "EnumDefaultedMember", + "start":16,"end":17,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":3}}, + "id": { + "type": "Identifier", + "start":16,"end":17,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":3},"identifierName":"B"}, + "name": "B" + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/string-implicit-initialized/input.js b/packages/babel-parser/test/fixtures/flow/enum-declaration/string-implicit-initialized/input.js new file mode 100644 index 000000000000..d1b1c29fc8a8 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/string-implicit-initialized/input.js @@ -0,0 +1,4 @@ +enum E { + A = "a", + B = "b", +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/string-implicit-initialized/output.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/string-implicit-initialized/output.json new file mode 100644 index 000000000000..d6f642c684e7 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/string-implicit-initialized/output.json @@ -0,0 +1,65 @@ +{ + "type": "File", + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "program": { + "type": "Program", + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "EnumDeclaration", + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "id": { + "type": "Identifier", + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"E"}, + "name": "E" + }, + "body": { + "type": "EnumStringBody", + "start":7,"end":32,"loc":{"start":{"line":1,"column":7},"end":{"line":4,"column":1}}, + "explicitType": false, + "members": [ + { + "type": "EnumStringMember", + "start":11,"end":18,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":9}}, + "id": { + "type": "Identifier", + "start":11,"end":12,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":3},"identifierName":"A"}, + "name": "A" + }, + "init": { + "type": "StringLiteral", + "start":15,"end":18,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":9}}, + "extra": { + "rawValue": "a", + "raw": "\"a\"" + }, + "value": "a" + } + }, + { + "type": "EnumStringMember", + "start":22,"end":29,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":9}}, + "id": { + "type": "Identifier", + "start":22,"end":23,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":3},"identifierName":"B"}, + "name": "B" + }, + "init": { + "type": "StringLiteral", + "start":26,"end":29,"loc":{"start":{"line":3,"column":6},"end":{"line":3,"column":9}}, + "extra": { + "rawValue": "b", + "raw": "\"b\"" + }, + "value": "b" + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/string-member-inconsistently-initialized-majority-defaulted/input.js b/packages/babel-parser/test/fixtures/flow/enum-declaration/string-member-inconsistently-initialized-majority-defaulted/input.js new file mode 100644 index 000000000000..279605f466c4 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/string-member-inconsistently-initialized-majority-defaulted/input.js @@ -0,0 +1,5 @@ +enum E of string { + A = "a", + B, + C, +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/string-member-inconsistently-initialized-majority-defaulted/options.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/string-member-inconsistently-initialized-majority-defaulted/options.json new file mode 100644 index 000000000000..53fd48c051cb --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/string-member-inconsistently-initialized-majority-defaulted/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["flow", { "enums": true }]] +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/string-member-inconsistently-initialized-majority-defaulted/output.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/string-member-inconsistently-initialized-majority-defaulted/output.json new file mode 100644 index 000000000000..b2f08dfac888 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/string-member-inconsistently-initialized-majority-defaulted/output.json @@ -0,0 +1,50 @@ +{ + "type": "File", + "start":0,"end":41,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, + "errors": [ + "SyntaxError: String enum members need to consistently either all use initializers, or use no initializers, in enum `E`. (2:2)" + ], + "program": { + "type": "Program", + "start":0,"end":41,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "EnumDeclaration", + "start":0,"end":41,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, + "id": { + "type": "Identifier", + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"E"}, + "name": "E" + }, + "body": { + "type": "EnumStringBody", + "start":7,"end":41,"loc":{"start":{"line":1,"column":7},"end":{"line":5,"column":1}}, + "explicitType": true, + "members": [ + { + "type": "EnumDefaultedMember", + "start":32,"end":33,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":3}}, + "id": { + "type": "Identifier", + "start":32,"end":33,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":3},"identifierName":"B"}, + "name": "B" + } + }, + { + "type": "EnumDefaultedMember", + "start":37,"end":38,"loc":{"start":{"line":4,"column":2},"end":{"line":4,"column":3}}, + "id": { + "type": "Identifier", + "start":37,"end":38,"loc":{"start":{"line":4,"column":2},"end":{"line":4,"column":3},"identifierName":"C"}, + "name": "C" + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/string-member-inconsistently-initialized-majority-initialized/input.js b/packages/babel-parser/test/fixtures/flow/enum-declaration/string-member-inconsistently-initialized-majority-initialized/input.js new file mode 100644 index 000000000000..e8db50effe4d --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/string-member-inconsistently-initialized-majority-initialized/input.js @@ -0,0 +1,5 @@ +enum E of string { + A, + B = "b", + C = "c", +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/string-member-inconsistently-initialized-majority-initialized/options.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/string-member-inconsistently-initialized-majority-initialized/options.json new file mode 100644 index 000000000000..53fd48c051cb --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/string-member-inconsistently-initialized-majority-initialized/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["flow", { "enums": true }]] +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/string-member-inconsistently-initialized-majority-initialized/output.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/string-member-inconsistently-initialized-majority-initialized/output.json new file mode 100644 index 000000000000..01371ce1c56f --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/string-member-inconsistently-initialized-majority-initialized/output.json @@ -0,0 +1,68 @@ +{ + "type": "File", + "start":0,"end":47,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, + "errors": [ + "SyntaxError: String enum members need to consistently either all use initializers, or use no initializers, in enum `E`. (2:2)" + ], + "program": { + "type": "Program", + "start":0,"end":47,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "EnumDeclaration", + "start":0,"end":47,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, + "id": { + "type": "Identifier", + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"E"}, + "name": "E" + }, + "body": { + "type": "EnumStringBody", + "start":7,"end":47,"loc":{"start":{"line":1,"column":7},"end":{"line":5,"column":1}}, + "explicitType": true, + "members": [ + { + "type": "EnumStringMember", + "start":26,"end":33,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":9}}, + "id": { + "type": "Identifier", + "start":26,"end":27,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":3},"identifierName":"B"}, + "name": "B" + }, + "init": { + "type": "StringLiteral", + "start":30,"end":33,"loc":{"start":{"line":3,"column":6},"end":{"line":3,"column":9}}, + "extra": { + "rawValue": "b", + "raw": "\"b\"" + }, + "value": "b" + } + }, + { + "type": "EnumStringMember", + "start":37,"end":44,"loc":{"start":{"line":4,"column":2},"end":{"line":4,"column":9}}, + "id": { + "type": "Identifier", + "start":37,"end":38,"loc":{"start":{"line":4,"column":2},"end":{"line":4,"column":3},"identifierName":"C"}, + "name": "C" + }, + "init": { + "type": "StringLiteral", + "start":41,"end":44,"loc":{"start":{"line":4,"column":6},"end":{"line":4,"column":9}}, + "extra": { + "rawValue": "c", + "raw": "\"c\"" + }, + "value": "c" + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/symbol/input.js b/packages/babel-parser/test/fixtures/flow/enum-declaration/symbol/input.js new file mode 100644 index 000000000000..26e5377f5e71 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/symbol/input.js @@ -0,0 +1,4 @@ +enum E of symbol { + A, + B, +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/symbol/output.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/symbol/output.json new file mode 100644 index 000000000000..4497d3a6d362 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/symbol/output.json @@ -0,0 +1,46 @@ +{ + "type": "File", + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "program": { + "type": "Program", + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "EnumDeclaration", + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "id": { + "type": "Identifier", + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"E"}, + "name": "E" + }, + "body": { + "type": "EnumSymbolBody", + "start":7,"end":30,"loc":{"start":{"line":1,"column":7},"end":{"line":4,"column":1}}, + "members": [ + { + "type": "EnumDefaultedMember", + "start":21,"end":22,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":3}}, + "id": { + "type": "Identifier", + "start":21,"end":22,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":3},"identifierName":"A"}, + "name": "A" + } + }, + { + "type": "EnumDefaultedMember", + "start":26,"end":27,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":3}}, + "id": { + "type": "Identifier", + "start":26,"end":27,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":3},"identifierName":"B"}, + "name": "B" + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/expect-plugin/export-interface/input.js b/packages/babel-parser/test/fixtures/flow/expect-plugin/export-interface/input.js new file mode 100644 index 000000000000..39df3b83f7e9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/expect-plugin/export-interface/input.js @@ -0,0 +1 @@ +export interface Foo {} diff --git a/packages/babel-parser/test/fixtures/flow/expect-plugin/export-interface/options.json b/packages/babel-parser/test/fixtures/flow/expect-plugin/export-interface/options.json new file mode 100644 index 000000000000..3f1eb56acdfa --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/expect-plugin/export-interface/options.json @@ -0,0 +1,7 @@ +{ + "sourceType": "module", + "plugins": [ + "jsx" + ], + "throws": "This experimental syntax requires enabling one of the following parser plugin(s): 'flow, typescript' (1:7)" +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/expect-plugin/export-type-named/input.js b/packages/babel-parser/test/fixtures/flow/expect-plugin/export-type-named/input.js new file mode 100644 index 000000000000..2bece0a4af63 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/expect-plugin/export-type-named/input.js @@ -0,0 +1,2 @@ +var Foo; +export type { Foo }; diff --git a/packages/babel-parser/test/fixtures/flow/expect-plugin/export-type-named/options.json b/packages/babel-parser/test/fixtures/flow/expect-plugin/export-type-named/options.json new file mode 100644 index 000000000000..80ced9a61c4f --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/expect-plugin/export-type-named/options.json @@ -0,0 +1,7 @@ +{ + "sourceType": "module", + "plugins": [ + "jsx" + ], + "throws": "This experimental syntax requires enabling one of the following parser plugin(s): 'flow, typescript' (2:7)" +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/expect-plugin/export-type/input.js b/packages/babel-parser/test/fixtures/flow/expect-plugin/export-type/input.js new file mode 100644 index 000000000000..191a99ee3073 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/expect-plugin/export-type/input.js @@ -0,0 +1 @@ +export type Foo = number; diff --git a/packages/babel-parser/test/fixtures/flow/expect-plugin/export-type/options.json b/packages/babel-parser/test/fixtures/flow/expect-plugin/export-type/options.json new file mode 100644 index 000000000000..3f1eb56acdfa --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/expect-plugin/export-type/options.json @@ -0,0 +1,7 @@ +{ + "sourceType": "module", + "plugins": [ + "jsx" + ], + "throws": "This experimental syntax requires enabling one of the following parser plugin(s): 'flow, typescript' (1:7)" +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/expect-plugin/options.json b/packages/babel-parser/test/fixtures/flow/expect-plugin/options.json new file mode 100644 index 000000000000..21c10b585e47 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/expect-plugin/options.json @@ -0,0 +1,4 @@ +{ + "sourceType": "module", + "plugins": ["jsx"] +} diff --git a/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_disallowed_in_non_objects1/options.json b/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_disallowed_in_non_objects1/options.json index c9188366d4e8..2104ca43283f 100644 --- a/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_disallowed_in_non_objects1/options.json +++ b/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_disallowed_in_non_objects1/options.json @@ -1,5 +1,3 @@ { - "sourceType": "module", - "plugins": ["jsx", "flow"], - "throws": "Spread operator cannot appear in class or interface definitions (3:2)" + "sourceType": "module" } diff --git a/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_disallowed_in_non_objects1/output.json b/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_disallowed_in_non_objects1/output.json new file mode 100644 index 000000000000..79791869df20 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_disallowed_in_non_objects1/output.json @@ -0,0 +1,52 @@ +{ + "type": "File", + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "errors": [ + "SyntaxError: Explicit inexact syntax cannot appear in class or interface definitions (3:2)" + ], + "program": { + "type": "Program", + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "DeclareClass", + "start":8,"end":34,"loc":{"start":{"line":2,"column":0},"end":{"line":4,"column":1}}, + "id": { + "type": "Identifier", + "start":22,"end":23,"loc":{"start":{"line":2,"column":14},"end":{"line":2,"column":15},"identifierName":"A"}, + "name": "A" + }, + "typeParameters": null, + "extends": [], + "implements": [], + "mixins": [], + "body": { + "type": "ObjectTypeAnnotation", + "start":24,"end":34,"loc":{"start":{"line":2,"column":16},"end":{"line":4,"column":1}}, + "callProperties": [], + "properties": [], + "indexers": [], + "internalSlots": [], + "exact": false + }, + "leadingComments": [ + { + "type": "CommentLine", + "value": "@flow", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}} + } + ] + } + ], + "directives": [] + }, + "comments": [ + { + "type": "CommentLine", + "value": "@flow", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}} + } + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_disallowed_in_non_objects2/options.json b/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_disallowed_in_non_objects2/options.json index 658f8c434773..2104ca43283f 100644 --- a/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_disallowed_in_non_objects2/options.json +++ b/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_disallowed_in_non_objects2/options.json @@ -1,5 +1,3 @@ { - "sourceType": "module", - "plugins": ["jsx", "flow"], - "throws": "Spread operator cannot appear in class or interface definitions (4:2)" + "sourceType": "module" } diff --git a/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_disallowed_in_non_objects2/output.json b/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_disallowed_in_non_objects2/output.json new file mode 100644 index 000000000000..5f245815fbf6 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_disallowed_in_non_objects2/output.json @@ -0,0 +1,72 @@ +{ + "type": "File", + "start":0,"end":49,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, + "errors": [ + "SyntaxError: Explicit inexact syntax cannot appear in class or interface definitions (4:2)" + ], + "program": { + "type": "Program", + "start":0,"end":49,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "DeclareClass", + "start":8,"end":49,"loc":{"start":{"line":2,"column":0},"end":{"line":5,"column":1}}, + "id": { + "type": "Identifier", + "start":22,"end":23,"loc":{"start":{"line":2,"column":14},"end":{"line":2,"column":15},"identifierName":"B"}, + "name": "B" + }, + "typeParameters": null, + "extends": [], + "implements": [], + "mixins": [], + "body": { + "type": "ObjectTypeAnnotation", + "start":24,"end":49,"loc":{"start":{"line":2,"column":16},"end":{"line":5,"column":1}}, + "callProperties": [], + "properties": [ + { + "type": "ObjectTypeProperty", + "start":28,"end":39,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":13}}, + "key": { + "type": "Identifier", + "start":28,"end":31,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":5},"identifierName":"foo"}, + "name": "foo" + }, + "static": false, + "proto": false, + "kind": "init", + "method": false, + "value": { + "type": "NumberTypeAnnotation", + "start":33,"end":39,"loc":{"start":{"line":3,"column":7},"end":{"line":3,"column":13}} + }, + "variance": null, + "optional": false + } + ], + "indexers": [], + "internalSlots": [], + "exact": false + }, + "leadingComments": [ + { + "type": "CommentLine", + "value": "@flow", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}} + } + ] + } + ], + "directives": [] + }, + "comments": [ + { + "type": "CommentLine", + "value": "@flow", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}} + } + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_disallowed_in_non_objects3/options.json b/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_disallowed_in_non_objects3/options.json index c9188366d4e8..d822c40fbba2 100644 --- a/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_disallowed_in_non_objects3/options.json +++ b/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_disallowed_in_non_objects3/options.json @@ -1,5 +1,4 @@ { "sourceType": "module", - "plugins": ["jsx", "flow"], - "throws": "Spread operator cannot appear in class or interface definitions (3:2)" + "plugins": ["jsx", "flow"] } diff --git a/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_disallowed_in_non_objects3/output.json b/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_disallowed_in_non_objects3/output.json new file mode 100644 index 000000000000..6933be95528f --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_disallowed_in_non_objects3/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start":0,"end":49,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, + "errors": [ + "SyntaxError: Explicit inexact syntax cannot appear in class or interface definitions (3:2)", + "SyntaxError: Explicit inexact syntax must appear at the end of an inexact object (3:2)" + ], + "program": { + "type": "Program", + "start":0,"end":49,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "DeclareClass", + "start":8,"end":49,"loc":{"start":{"line":2,"column":0},"end":{"line":5,"column":1}}, + "id": { + "type": "Identifier", + "start":22,"end":23,"loc":{"start":{"line":2,"column":14},"end":{"line":2,"column":15},"identifierName":"C"}, + "name": "C" + }, + "typeParameters": null, + "extends": [], + "implements": [], + "mixins": [], + "body": { + "type": "ObjectTypeAnnotation", + "start":24,"end":49,"loc":{"start":{"line":2,"column":16},"end":{"line":5,"column":1}}, + "callProperties": [], + "properties": [ + { + "type": "ObjectTypeProperty", + "start":35,"end":46,"loc":{"start":{"line":4,"column":2},"end":{"line":4,"column":13}}, + "key": { + "type": "Identifier", + "start":35,"end":38,"loc":{"start":{"line":4,"column":2},"end":{"line":4,"column":5},"identifierName":"foo"}, + "name": "foo" + }, + "static": false, + "proto": false, + "kind": "init", + "method": false, + "value": { + "type": "NumberTypeAnnotation", + "start":40,"end":46,"loc":{"start":{"line":4,"column":7},"end":{"line":4,"column":13}} + }, + "variance": null, + "optional": false + } + ], + "indexers": [], + "internalSlots": [], + "exact": false + }, + "leadingComments": [ + { + "type": "CommentLine", + "value": "@flow", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}} + } + ] + } + ], + "directives": [] + }, + "comments": [ + { + "type": "CommentLine", + "value": "@flow", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}} + } + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_disallowed_in_non_objects4/options.json b/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_disallowed_in_non_objects4/options.json index 658f8c434773..d822c40fbba2 100644 --- a/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_disallowed_in_non_objects4/options.json +++ b/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_disallowed_in_non_objects4/options.json @@ -1,5 +1,4 @@ { "sourceType": "module", - "plugins": ["jsx", "flow"], - "throws": "Spread operator cannot appear in class or interface definitions (4:2)" + "plugins": ["jsx", "flow"] } diff --git a/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_disallowed_in_non_objects4/output.json b/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_disallowed_in_non_objects4/output.json new file mode 100644 index 000000000000..6c4b0246e420 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_disallowed_in_non_objects4/output.json @@ -0,0 +1,92 @@ +{ + "type": "File", + "start":0,"end":64,"loc":{"start":{"line":1,"column":0},"end":{"line":6,"column":1}}, + "errors": [ + "SyntaxError: Explicit inexact syntax cannot appear in class or interface definitions (4:2)", + "SyntaxError: Explicit inexact syntax must appear at the end of an inexact object (4:2)" + ], + "program": { + "type": "Program", + "start":0,"end":64,"loc":{"start":{"line":1,"column":0},"end":{"line":6,"column":1}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "DeclareClass", + "start":8,"end":64,"loc":{"start":{"line":2,"column":0},"end":{"line":6,"column":1}}, + "id": { + "type": "Identifier", + "start":22,"end":23,"loc":{"start":{"line":2,"column":14},"end":{"line":2,"column":15},"identifierName":"D"}, + "name": "D" + }, + "typeParameters": null, + "extends": [], + "implements": [], + "mixins": [], + "body": { + "type": "ObjectTypeAnnotation", + "start":24,"end":64,"loc":{"start":{"line":2,"column":16},"end":{"line":6,"column":1}}, + "callProperties": [], + "properties": [ + { + "type": "ObjectTypeProperty", + "start":28,"end":39,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":13}}, + "key": { + "type": "Identifier", + "start":28,"end":31,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":5},"identifierName":"foo"}, + "name": "foo" + }, + "static": false, + "proto": false, + "kind": "init", + "method": false, + "value": { + "type": "NumberTypeAnnotation", + "start":33,"end":39,"loc":{"start":{"line":3,"column":7},"end":{"line":3,"column":13}} + }, + "variance": null, + "optional": false + }, + { + "type": "ObjectTypeProperty", + "start":50,"end":61,"loc":{"start":{"line":5,"column":2},"end":{"line":5,"column":13}}, + "key": { + "type": "Identifier", + "start":50,"end":53,"loc":{"start":{"line":5,"column":2},"end":{"line":5,"column":5},"identifierName":"bar"}, + "name": "bar" + }, + "static": false, + "proto": false, + "kind": "init", + "method": false, + "value": { + "type": "NumberTypeAnnotation", + "start":55,"end":61,"loc":{"start":{"line":5,"column":7},"end":{"line":5,"column":13}} + }, + "variance": null, + "optional": false + } + ], + "indexers": [], + "internalSlots": [], + "exact": false + }, + "leadingComments": [ + { + "type": "CommentLine", + "value": "@flow", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}} + } + ] + } + ], + "directives": [] + }, + "comments": [ + { + "type": "CommentLine", + "value": "@flow", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}} + } + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_disallowed_in_non_objects5/options.json b/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_disallowed_in_non_objects5/options.json deleted file mode 100644 index 658f8c434773..000000000000 --- a/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_disallowed_in_non_objects5/options.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "sourceType": "module", - "plugins": ["jsx", "flow"], - "throws": "Spread operator cannot appear in class or interface definitions (4:2)" -} diff --git a/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_disallowed_in_non_objects5/output.json b/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_disallowed_in_non_objects5/output.json new file mode 100644 index 000000000000..6cbdf063a824 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_disallowed_in_non_objects5/output.json @@ -0,0 +1,72 @@ +{ + "type": "File", + "start":0,"end":45,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, + "errors": [ + "SyntaxError: Explicit inexact syntax cannot appear in class or interface definitions (4:2)" + ], + "program": { + "type": "Program", + "start":0,"end":45,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "InterfaceDeclaration", + "start":8,"end":45,"loc":{"start":{"line":2,"column":0},"end":{"line":5,"column":1}}, + "id": { + "type": "Identifier", + "start":18,"end":19,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":11},"identifierName":"F"}, + "name": "F" + }, + "typeParameters": null, + "extends": [], + "implements": [], + "mixins": [], + "body": { + "type": "ObjectTypeAnnotation", + "start":20,"end":45,"loc":{"start":{"line":2,"column":12},"end":{"line":5,"column":1}}, + "callProperties": [], + "properties": [ + { + "type": "ObjectTypeProperty", + "start":24,"end":35,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":13}}, + "key": { + "type": "Identifier", + "start":24,"end":27,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":5},"identifierName":"foo"}, + "name": "foo" + }, + "static": false, + "proto": false, + "kind": "init", + "method": false, + "value": { + "type": "NumberTypeAnnotation", + "start":29,"end":35,"loc":{"start":{"line":3,"column":7},"end":{"line":3,"column":13}} + }, + "variance": null, + "optional": false + } + ], + "indexers": [], + "internalSlots": [], + "exact": false + }, + "leadingComments": [ + { + "type": "CommentLine", + "value": "@flow", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}} + } + ] + } + ], + "directives": [] + }, + "comments": [ + { + "type": "CommentLine", + "value": "@flow", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}} + } + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_disallowed_in_non_objects6/options.json b/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_disallowed_in_non_objects6/options.json index c9188366d4e8..d822c40fbba2 100644 --- a/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_disallowed_in_non_objects6/options.json +++ b/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_disallowed_in_non_objects6/options.json @@ -1,5 +1,4 @@ { "sourceType": "module", - "plugins": ["jsx", "flow"], - "throws": "Spread operator cannot appear in class or interface definitions (3:2)" + "plugins": ["jsx", "flow"] } diff --git a/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_disallowed_in_non_objects6/output.json b/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_disallowed_in_non_objects6/output.json new file mode 100644 index 000000000000..ef17a8522e31 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_disallowed_in_non_objects6/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start":0,"end":45,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, + "errors": [ + "SyntaxError: Explicit inexact syntax cannot appear in class or interface definitions (3:2)", + "SyntaxError: Explicit inexact syntax must appear at the end of an inexact object (3:2)" + ], + "program": { + "type": "Program", + "start":0,"end":45,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "InterfaceDeclaration", + "start":8,"end":45,"loc":{"start":{"line":2,"column":0},"end":{"line":5,"column":1}}, + "id": { + "type": "Identifier", + "start":18,"end":19,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":11},"identifierName":"G"}, + "name": "G" + }, + "typeParameters": null, + "extends": [], + "implements": [], + "mixins": [], + "body": { + "type": "ObjectTypeAnnotation", + "start":20,"end":45,"loc":{"start":{"line":2,"column":12},"end":{"line":5,"column":1}}, + "callProperties": [], + "properties": [ + { + "type": "ObjectTypeProperty", + "start":31,"end":42,"loc":{"start":{"line":4,"column":2},"end":{"line":4,"column":13}}, + "key": { + "type": "Identifier", + "start":31,"end":34,"loc":{"start":{"line":4,"column":2},"end":{"line":4,"column":5},"identifierName":"foo"}, + "name": "foo" + }, + "static": false, + "proto": false, + "kind": "init", + "method": false, + "value": { + "type": "NumberTypeAnnotation", + "start":36,"end":42,"loc":{"start":{"line":4,"column":7},"end":{"line":4,"column":13}} + }, + "variance": null, + "optional": false + } + ], + "indexers": [], + "internalSlots": [], + "exact": false + }, + "leadingComments": [ + { + "type": "CommentLine", + "value": "@flow", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}} + } + ] + } + ], + "directives": [] + }, + "comments": [ + { + "type": "CommentLine", + "value": "@flow", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}} + } + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_disallowed_in_non_objects7/options.json b/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_disallowed_in_non_objects7/options.json index 658f8c434773..d822c40fbba2 100644 --- a/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_disallowed_in_non_objects7/options.json +++ b/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_disallowed_in_non_objects7/options.json @@ -1,5 +1,4 @@ { "sourceType": "module", - "plugins": ["jsx", "flow"], - "throws": "Spread operator cannot appear in class or interface definitions (4:2)" + "plugins": ["jsx", "flow"] } diff --git a/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_disallowed_in_non_objects7/output.json b/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_disallowed_in_non_objects7/output.json new file mode 100644 index 000000000000..c8b023403203 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_disallowed_in_non_objects7/output.json @@ -0,0 +1,92 @@ +{ + "type": "File", + "start":0,"end":60,"loc":{"start":{"line":1,"column":0},"end":{"line":6,"column":1}}, + "errors": [ + "SyntaxError: Explicit inexact syntax cannot appear in class or interface definitions (4:2)", + "SyntaxError: Explicit inexact syntax must appear at the end of an inexact object (4:2)" + ], + "program": { + "type": "Program", + "start":0,"end":60,"loc":{"start":{"line":1,"column":0},"end":{"line":6,"column":1}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "InterfaceDeclaration", + "start":8,"end":60,"loc":{"start":{"line":2,"column":0},"end":{"line":6,"column":1}}, + "id": { + "type": "Identifier", + "start":18,"end":19,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":11},"identifierName":"H"}, + "name": "H" + }, + "typeParameters": null, + "extends": [], + "implements": [], + "mixins": [], + "body": { + "type": "ObjectTypeAnnotation", + "start":20,"end":60,"loc":{"start":{"line":2,"column":12},"end":{"line":6,"column":1}}, + "callProperties": [], + "properties": [ + { + "type": "ObjectTypeProperty", + "start":24,"end":35,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":13}}, + "key": { + "type": "Identifier", + "start":24,"end":27,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":5},"identifierName":"foo"}, + "name": "foo" + }, + "static": false, + "proto": false, + "kind": "init", + "method": false, + "value": { + "type": "NumberTypeAnnotation", + "start":29,"end":35,"loc":{"start":{"line":3,"column":7},"end":{"line":3,"column":13}} + }, + "variance": null, + "optional": false + }, + { + "type": "ObjectTypeProperty", + "start":46,"end":57,"loc":{"start":{"line":5,"column":2},"end":{"line":5,"column":13}}, + "key": { + "type": "Identifier", + "start":46,"end":49,"loc":{"start":{"line":5,"column":2},"end":{"line":5,"column":5},"identifierName":"bar"}, + "name": "bar" + }, + "static": false, + "proto": false, + "kind": "init", + "method": false, + "value": { + "type": "NumberTypeAnnotation", + "start":51,"end":57,"loc":{"start":{"line":5,"column":7},"end":{"line":5,"column":13}} + }, + "variance": null, + "optional": false + } + ], + "indexers": [], + "internalSlots": [], + "exact": false + }, + "leadingComments": [ + { + "type": "CommentLine", + "value": "@flow", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}} + } + ] + } + ], + "directives": [] + }, + "comments": [ + { + "type": "CommentLine", + "value": "@flow", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}} + } + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_forbidden_in_exact/options.json b/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_forbidden_in_exact/options.json index 49936ac94990..d822c40fbba2 100644 --- a/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_forbidden_in_exact/options.json +++ b/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_forbidden_in_exact/options.json @@ -1,5 +1,4 @@ { "sourceType": "module", - "plugins": ["jsx", "flow"], - "throws": "Explicit inexact syntax cannot appear inside an explicit exact object type (2:29)" + "plugins": ["jsx", "flow"] } diff --git a/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_forbidden_in_exact/output.json b/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_forbidden_in_exact/output.json new file mode 100644 index 000000000000..94a068947058 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_forbidden_in_exact/output.json @@ -0,0 +1,70 @@ +{ + "type": "File", + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":31}}, + "errors": [ + "SyntaxError: Explicit inexact syntax cannot appear inside an explicit exact object type (2:25)" + ], + "program": { + "type": "Program", + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":31}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "TypeAlias", + "start":8,"end":39,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":31}}, + "id": { + "type": "Identifier", + "start":13,"end":14,"loc":{"start":{"line":2,"column":5},"end":{"line":2,"column":6},"identifierName":"T"}, + "name": "T" + }, + "typeParameters": null, + "right": { + "type": "ObjectTypeAnnotation", + "start":17,"end":39,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":31}}, + "callProperties": [], + "properties": [ + { + "type": "ObjectTypeProperty", + "start":20,"end":31,"loc":{"start":{"line":2,"column":12},"end":{"line":2,"column":23}}, + "key": { + "type": "Identifier", + "start":20,"end":23,"loc":{"start":{"line":2,"column":12},"end":{"line":2,"column":15},"identifierName":"foo"}, + "name": "foo" + }, + "static": false, + "proto": false, + "kind": "init", + "method": false, + "value": { + "type": "NumberTypeAnnotation", + "start":25,"end":31,"loc":{"start":{"line":2,"column":17},"end":{"line":2,"column":23}} + }, + "variance": null, + "optional": false + } + ], + "indexers": [], + "internalSlots": [], + "exact": true, + "inexact": true + }, + "leadingComments": [ + { + "type": "CommentLine", + "value": "@flow", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}} + } + ] + } + ], + "directives": [] + }, + "comments": [ + { + "type": "CommentLine", + "value": "@flow", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}} + } + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_must_appear_last/options.json b/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_must_appear_last/options.json index ebb74417a527..d822c40fbba2 100644 --- a/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_must_appear_last/options.json +++ b/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_must_appear_last/options.json @@ -1,5 +1,4 @@ { "sourceType": "module", - "plugins": ["jsx", "flow"], - "throws": "Explicit inexact syntax must appear at the end of an inexact object (2:15)" + "plugins": ["jsx", "flow"] } diff --git a/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_must_appear_last/output.json b/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_must_appear_last/output.json new file mode 100644 index 000000000000..36abf35d4535 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_must_appear_last/output.json @@ -0,0 +1,70 @@ +{ + "type": "File", + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":28}}, + "errors": [ + "SyntaxError: Explicit inexact syntax must appear at the end of an inexact object (2:10)" + ], + "program": { + "type": "Program", + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":28}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "TypeAlias", + "start":8,"end":36,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":28}}, + "id": { + "type": "Identifier", + "start":13,"end":14,"loc":{"start":{"line":2,"column":5},"end":{"line":2,"column":6},"identifierName":"T"}, + "name": "T" + }, + "typeParameters": null, + "right": { + "type": "ObjectTypeAnnotation", + "start":17,"end":35,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":27}}, + "callProperties": [], + "properties": [ + { + "type": "ObjectTypeProperty", + "start":23,"end":34,"loc":{"start":{"line":2,"column":15},"end":{"line":2,"column":26}}, + "key": { + "type": "Identifier", + "start":23,"end":26,"loc":{"start":{"line":2,"column":15},"end":{"line":2,"column":18},"identifierName":"foo"}, + "name": "foo" + }, + "static": false, + "proto": false, + "kind": "init", + "method": false, + "value": { + "type": "NumberTypeAnnotation", + "start":28,"end":34,"loc":{"start":{"line":2,"column":20},"end":{"line":2,"column":26}} + }, + "variance": null, + "optional": false + } + ], + "indexers": [], + "internalSlots": [], + "exact": false, + "inexact": true + }, + "leadingComments": [ + { + "type": "CommentLine", + "value": "@flow", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}} + } + ] + } + ], + "directives": [] + }, + "comments": [ + { + "type": "CommentLine", + "value": "@flow", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}} + } + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_object/output.json b/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_object/output.json index 7e32ace8159d..79a5402f0a2b 100644 --- a/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_object/output.json +++ b/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_object/output.json @@ -1,80 +1,24 @@ { "type": "File", - "start": 0, - "end": 84, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 33 - } - }, + "start":0,"end":84,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":33}}, "program": { "type": "Program", - "start": 0, - "end": 84, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 33 - } - }, + "start":0,"end":84,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":33}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "TypeAlias", - "start": 8, - "end": 23, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 15 - } - }, + "start":8,"end":23,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":15}}, "id": { "type": "Identifier", - "start": 13, - "end": 14, - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 6 - }, - "identifierName": "T" - }, + "start":13,"end":14,"loc":{"start":{"line":2,"column":5},"end":{"line":2,"column":6},"identifierName":"T"}, "name": "T" }, "typeParameters": null, "right": { "type": "ObjectTypeAnnotation", - "start": 17, - "end": 22, - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 14 - } - }, + "start":17,"end":22,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":14}}, "callProperties": [], "properties": [], "indexers": [], @@ -86,98 +30,30 @@ { "type": "CommentLine", "value": "@flow", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - } + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}} } ] }, { "type": "TypeAlias", - "start": 24, - "end": 50, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 26 - } - }, + "start":24,"end":50,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":26}}, "id": { "type": "Identifier", - "start": 29, - "end": 30, - "loc": { - "start": { - "line": 3, - "column": 5 - }, - "end": { - "line": 3, - "column": 6 - }, - "identifierName": "U" - }, + "start":29,"end":30,"loc":{"start":{"line":3,"column":5},"end":{"line":3,"column":6},"identifierName":"U"}, "name": "U" }, "typeParameters": null, "right": { "type": "ObjectTypeAnnotation", - "start": 33, - "end": 49, - "loc": { - "start": { - "line": 3, - "column": 9 - }, - "end": { - "line": 3, - "column": 25 - } - }, + "start":33,"end":49,"loc":{"start":{"line":3,"column":9},"end":{"line":3,"column":25}}, "callProperties": [], "properties": [ { "type": "ObjectTypeProperty", - "start": 34, - "end": 43, - "loc": { - "start": { - "line": 3, - "column": 10 - }, - "end": { - "line": 3, - "column": 19 - } - }, + "start":34,"end":43,"loc":{"start":{"line":3,"column":10},"end":{"line":3,"column":19}}, "key": { "type": "Identifier", - "start": 34, - "end": 35, - "loc": { - "start": { - "line": 3, - "column": 10 - }, - "end": { - "line": 3, - "column": 11 - }, - "identifierName": "x" - }, + "start":34,"end":35,"loc":{"start":{"line":3,"column":10},"end":{"line":3,"column":11},"identifierName":"x"}, "name": "x" }, "static": false, @@ -186,18 +62,7 @@ "method": false, "value": { "type": "NumberTypeAnnotation", - "start": 37, - "end": 43, - "loc": { - "start": { - "line": 3, - "column": 13 - }, - "end": { - "line": 3, - "column": 19 - } - } + "start":37,"end":43,"loc":{"start":{"line":3,"column":13},"end":{"line":3,"column":19}} }, "variance": null, "optional": false @@ -211,81 +76,24 @@ }, { "type": "TypeAlias", - "start": 51, - "end": 84, - "loc": { - "start": { - "line": 4, - "column": 0 - }, - "end": { - "line": 4, - "column": 33 - } - }, + "start":51,"end":84,"loc":{"start":{"line":4,"column":0},"end":{"line":4,"column":33}}, "id": { "type": "Identifier", - "start": 56, - "end": 57, - "loc": { - "start": { - "line": 4, - "column": 5 - }, - "end": { - "line": 4, - "column": 6 - }, - "identifierName": "V" - }, + "start":56,"end":57,"loc":{"start":{"line":4,"column":5},"end":{"line":4,"column":6},"identifierName":"V"}, "name": "V" }, "typeParameters": null, "right": { "type": "ObjectTypeAnnotation", - "start": 60, - "end": 83, - "loc": { - "start": { - "line": 4, - "column": 9 - }, - "end": { - "line": 4, - "column": 32 - } - }, + "start":60,"end":83,"loc":{"start":{"line":4,"column":9},"end":{"line":4,"column":32}}, "callProperties": [], "properties": [ { "type": "ObjectTypeProperty", - "start": 61, - "end": 70, - "loc": { - "start": { - "line": 4, - "column": 10 - }, - "end": { - "line": 4, - "column": 19 - } - }, + "start":61,"end":70,"loc":{"start":{"line":4,"column":10},"end":{"line":4,"column":19}}, "key": { "type": "Identifier", - "start": 61, - "end": 62, - "loc": { - "start": { - "line": 4, - "column": 10 - }, - "end": { - "line": 4, - "column": 11 - }, - "identifierName": "x" - }, + "start":61,"end":62,"loc":{"start":{"line":4,"column":10},"end":{"line":4,"column":11},"identifierName":"x"}, "name": "x" }, "static": false, @@ -294,114 +102,35 @@ "method": false, "value": { "type": "NumberTypeAnnotation", - "start": 64, - "end": 70, - "loc": { - "start": { - "line": 4, - "column": 13 - }, - "end": { - "line": 4, - "column": 19 - } - } + "start":64,"end":70,"loc":{"start":{"line":4,"column":13},"end":{"line":4,"column":19}} }, "variance": null, "optional": false }, { "type": "ObjectTypeSpreadProperty", - "start": 72, - "end": 76, - "loc": { - "start": { - "line": 4, - "column": 21 - }, - "end": { - "line": 4, - "column": 25 - } - }, + "start":72,"end":76,"loc":{"start":{"line":4,"column":21},"end":{"line":4,"column":25}}, "argument": { "type": "GenericTypeAnnotation", - "start": 75, - "end": 76, - "loc": { - "start": { - "line": 4, - "column": 24 - }, - "end": { - "line": 4, - "column": 25 - } - }, + "start":75,"end":76,"loc":{"start":{"line":4,"column":24},"end":{"line":4,"column":25}}, "typeParameters": null, "id": { "type": "Identifier", - "start": 75, - "end": 76, - "loc": { - "start": { - "line": 4, - "column": 24 - }, - "end": { - "line": 4, - "column": 25 - }, - "identifierName": "V" - }, + "start":75,"end":76,"loc":{"start":{"line":4,"column":24},"end":{"line":4,"column":25},"identifierName":"V"}, "name": "V" } } }, { "type": "ObjectTypeSpreadProperty", - "start": 78, - "end": 82, - "loc": { - "start": { - "line": 4, - "column": 27 - }, - "end": { - "line": 4, - "column": 31 - } - }, + "start":78,"end":82,"loc":{"start":{"line":4,"column":27},"end":{"line":4,"column":31}}, "argument": { "type": "GenericTypeAnnotation", - "start": 81, - "end": 82, - "loc": { - "start": { - "line": 4, - "column": 30 - }, - "end": { - "line": 4, - "column": 31 - } - }, + "start":81,"end":82,"loc":{"start":{"line":4,"column":30},"end":{"line":4,"column":31}}, "typeParameters": null, "id": { "type": "Identifier", - "start": 81, - "end": 82, - "loc": { - "start": { - "line": 4, - "column": 30 - }, - "end": { - "line": 4, - "column": 31 - }, - "identifierName": "U" - }, + "start":81,"end":82,"loc":{"start":{"line":4,"column":30},"end":{"line":4,"column":31},"identifierName":"U"}, "name": "U" } } @@ -420,18 +149,7 @@ { "type": "CommentLine", "value": "@flow", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - } + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}} } ] } \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_object_invalid1/options.json b/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_object_invalid1/options.json index 6d703769bf61..d822c40fbba2 100644 --- a/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_object_invalid1/options.json +++ b/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_object_invalid1/options.json @@ -1,5 +1,4 @@ { "sourceType": "module", - "plugins": ["jsx", "flow"], - "throws": "Explicit inexact syntax must appear at the end of an inexact object (2:26)" + "plugins": ["jsx", "flow"] } diff --git a/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_object_invalid1/output.json b/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_object_invalid1/output.json new file mode 100644 index 000000000000..16a8edbd4bcb --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_object_invalid1/output.json @@ -0,0 +1,89 @@ +{ + "type": "File", + "start":0,"end":45,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":37}}, + "errors": [ + "SyntaxError: Explicit inexact syntax must appear at the end of an inexact object (2:21)" + ], + "program": { + "type": "Program", + "start":0,"end":45,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":37}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "TypeAlias", + "start":8,"end":45,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":37}}, + "id": { + "type": "Identifier", + "start":13,"end":14,"loc":{"start":{"line":2,"column":5},"end":{"line":2,"column":6},"identifierName":"T"}, + "name": "T" + }, + "typeParameters": null, + "right": { + "type": "ObjectTypeAnnotation", + "start":17,"end":44,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":36}}, + "callProperties": [], + "properties": [ + { + "type": "ObjectTypeProperty", + "start":18,"end":27,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":19}}, + "key": { + "type": "Identifier", + "start":18,"end":19,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":11},"identifierName":"x"}, + "name": "x" + }, + "static": false, + "proto": false, + "kind": "init", + "method": false, + "value": { + "type": "NumberTypeAnnotation", + "start":21,"end":27,"loc":{"start":{"line":2,"column":13},"end":{"line":2,"column":19}} + }, + "variance": null, + "optional": false + }, + { + "type": "ObjectTypeProperty", + "start":34,"end":43,"loc":{"start":{"line":2,"column":26},"end":{"line":2,"column":35}}, + "key": { + "type": "Identifier", + "start":34,"end":35,"loc":{"start":{"line":2,"column":26},"end":{"line":2,"column":27},"identifierName":"y"}, + "name": "y" + }, + "static": false, + "proto": false, + "kind": "init", + "method": false, + "value": { + "type": "NumberTypeAnnotation", + "start":37,"end":43,"loc":{"start":{"line":2,"column":29},"end":{"line":2,"column":35}} + }, + "variance": null, + "optional": false + } + ], + "indexers": [], + "internalSlots": [], + "exact": false, + "inexact": true + }, + "leadingComments": [ + { + "type": "CommentLine", + "value": "@flow", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}} + } + ] + } + ], + "directives": [] + }, + "comments": [ + { + "type": "CommentLine", + "value": "@flow", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}} + } + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_object_invalid2/options.json b/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_object_invalid2/options.json index 6d703769bf61..d822c40fbba2 100644 --- a/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_object_invalid2/options.json +++ b/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_object_invalid2/options.json @@ -1,5 +1,4 @@ { "sourceType": "module", - "plugins": ["jsx", "flow"], - "throws": "Explicit inexact syntax must appear at the end of an inexact object (2:26)" + "plugins": ["jsx", "flow"] } diff --git a/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_object_invalid2/output.json b/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_object_invalid2/output.json new file mode 100644 index 000000000000..ff2e24bc5d28 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_object_invalid2/output.json @@ -0,0 +1,70 @@ +{ + "type": "File", + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":31}}, + "errors": [ + "SyntaxError: Explicit inexact syntax must appear at the end of an inexact object (2:21)" + ], + "program": { + "type": "Program", + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":31}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "TypeAlias", + "start":8,"end":39,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":31}}, + "id": { + "type": "Identifier", + "start":13,"end":14,"loc":{"start":{"line":2,"column":5},"end":{"line":2,"column":6},"identifierName":"U"}, + "name": "U" + }, + "typeParameters": null, + "right": { + "type": "ObjectTypeAnnotation", + "start":17,"end":38,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":30}}, + "callProperties": [], + "properties": [ + { + "type": "ObjectTypeProperty", + "start":18,"end":27,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":19}}, + "key": { + "type": "Identifier", + "start":18,"end":19,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":11},"identifierName":"x"}, + "name": "x" + }, + "static": false, + "proto": false, + "kind": "init", + "method": false, + "value": { + "type": "NumberTypeAnnotation", + "start":21,"end":27,"loc":{"start":{"line":2,"column":13},"end":{"line":2,"column":19}} + }, + "variance": null, + "optional": false + } + ], + "indexers": [], + "internalSlots": [], + "exact": false, + "inexact": true + }, + "leadingComments": [ + { + "type": "CommentLine", + "value": "@flow", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}} + } + ] + } + ], + "directives": [] + }, + "comments": [ + { + "type": "CommentLine", + "value": "@flow", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}} + } + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_object_invalid3/options.json b/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_object_invalid3/options.json index 6d703769bf61..d822c40fbba2 100644 --- a/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_object_invalid3/options.json +++ b/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_object_invalid3/options.json @@ -1,5 +1,4 @@ { "sourceType": "module", - "plugins": ["jsx", "flow"], - "throws": "Explicit inexact syntax must appear at the end of an inexact object (2:26)" + "plugins": ["jsx", "flow"] } diff --git a/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_object_invalid3/output.json b/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_object_invalid3/output.json new file mode 100644 index 000000000000..40f82000ed09 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_object_invalid3/output.json @@ -0,0 +1,84 @@ +{ + "type": "File", + "start":0,"end":40,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":32}}, + "errors": [ + "SyntaxError: Explicit inexact syntax must appear at the end of an inexact object (2:21)" + ], + "program": { + "type": "Program", + "start":0,"end":40,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":32}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "TypeAlias", + "start":8,"end":40,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":32}}, + "id": { + "type": "Identifier", + "start":13,"end":14,"loc":{"start":{"line":2,"column":5},"end":{"line":2,"column":6},"identifierName":"V"}, + "name": "V" + }, + "typeParameters": null, + "right": { + "type": "ObjectTypeAnnotation", + "start":17,"end":39,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":31}}, + "callProperties": [], + "properties": [ + { + "type": "ObjectTypeProperty", + "start":18,"end":27,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":19}}, + "key": { + "type": "Identifier", + "start":18,"end":19,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":11},"identifierName":"x"}, + "name": "x" + }, + "static": false, + "proto": false, + "kind": "init", + "method": false, + "value": { + "type": "NumberTypeAnnotation", + "start":21,"end":27,"loc":{"start":{"line":2,"column":13},"end":{"line":2,"column":19}} + }, + "variance": null, + "optional": false + }, + { + "type": "ObjectTypeSpreadProperty", + "start":34,"end":38,"loc":{"start":{"line":2,"column":26},"end":{"line":2,"column":30}}, + "argument": { + "type": "GenericTypeAnnotation", + "start":37,"end":38,"loc":{"start":{"line":2,"column":29},"end":{"line":2,"column":30}}, + "typeParameters": null, + "id": { + "type": "Identifier", + "start":37,"end":38,"loc":{"start":{"line":2,"column":29},"end":{"line":2,"column":30},"identifierName":"X"}, + "name": "X" + } + } + } + ], + "indexers": [], + "internalSlots": [], + "exact": false, + "inexact": true + }, + "leadingComments": [ + { + "type": "CommentLine", + "value": "@flow", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}} + } + ] + } + ], + "directives": [] + }, + "comments": [ + { + "type": "CommentLine", + "value": "@flow", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}} + } + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_trailing_comma/output.json b/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_trailing_comma/output.json index 3c39bdc107f5..8e6299b6397b 100644 --- a/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_trailing_comma/output.json +++ b/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_trailing_comma/output.json @@ -1,80 +1,24 @@ { "type": "File", - "start": 0, - "end": 113, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 11, - "column": 2 - } - }, + "start":0,"end":113,"loc":{"start":{"line":1,"column":0},"end":{"line":11,"column":2}}, "program": { "type": "Program", - "start": 0, - "end": 113, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 11, - "column": 2 - } - }, + "start":0,"end":113,"loc":{"start":{"line":1,"column":0},"end":{"line":11,"column":2}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "TypeAlias", - "start": 8, - "end": 26, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 18 - } - }, + "start":8,"end":26,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":18}}, "id": { "type": "Identifier", - "start": 13, - "end": 14, - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 6 - }, - "identifierName": "T" - }, + "start":13,"end":14,"loc":{"start":{"line":2,"column":5},"end":{"line":2,"column":6},"identifierName":"T"}, "name": "T" }, "typeParameters": null, "right": { "type": "ObjectTypeAnnotation", - "start": 17, - "end": 25, - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 17 - } - }, + "start":17,"end":25,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":17}}, "callProperties": [], "properties": [], "indexers": [], @@ -86,67 +30,22 @@ { "type": "CommentLine", "value": "@flow", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - } + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}} } ] }, { "type": "TypeAlias", - "start": 27, - "end": 45, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 18 - } - }, + "start":27,"end":45,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":18}}, "id": { "type": "Identifier", - "start": 32, - "end": 33, - "loc": { - "start": { - "line": 3, - "column": 5 - }, - "end": { - "line": 3, - "column": 6 - }, - "identifierName": "U" - }, + "start":32,"end":33,"loc":{"start":{"line":3,"column":5},"end":{"line":3,"column":6},"identifierName":"U"}, "name": "U" }, "typeParameters": null, "right": { "type": "ObjectTypeAnnotation", - "start": 36, - "end": 44, - "loc": { - "start": { - "line": 3, - "column": 9 - }, - "end": { - "line": 3, - "column": 17 - } - }, + "start":36,"end":44,"loc":{"start":{"line":3,"column":9},"end":{"line":3,"column":17}}, "callProperties": [], "properties": [], "indexers": [], @@ -157,81 +56,24 @@ }, { "type": "TypeAlias", - "start": 46, - "end": 79, - "loc": { - "start": { - "line": 4, - "column": 0 - }, - "end": { - "line": 7, - "column": 2 - } - }, + "start":46,"end":79,"loc":{"start":{"line":4,"column":0},"end":{"line":7,"column":2}}, "id": { "type": "Identifier", - "start": 51, - "end": 52, - "loc": { - "start": { - "line": 4, - "column": 5 - }, - "end": { - "line": 4, - "column": 6 - }, - "identifierName": "V" - }, + "start":51,"end":52,"loc":{"start":{"line":4,"column":5},"end":{"line":4,"column":6},"identifierName":"V"}, "name": "V" }, "typeParameters": null, "right": { "type": "ObjectTypeAnnotation", - "start": 55, - "end": 78, - "loc": { - "start": { - "line": 4, - "column": 9 - }, - "end": { - "line": 7, - "column": 1 - } - }, + "start":55,"end":78,"loc":{"start":{"line":4,"column":9},"end":{"line":7,"column":1}}, "callProperties": [], "properties": [ { "type": "ObjectTypeProperty", - "start": 59, - "end": 68, - "loc": { - "start": { - "line": 5, - "column": 2 - }, - "end": { - "line": 5, - "column": 11 - } - }, + "start":59,"end":68,"loc":{"start":{"line":5,"column":2},"end":{"line":5,"column":11}}, "key": { "type": "Identifier", - "start": 59, - "end": 60, - "loc": { - "start": { - "line": 5, - "column": 2 - }, - "end": { - "line": 5, - "column": 3 - }, - "identifierName": "x" - }, + "start":59,"end":60,"loc":{"start":{"line":5,"column":2},"end":{"line":5,"column":3},"identifierName":"x"}, "name": "x" }, "static": false, @@ -240,18 +82,7 @@ "method": false, "value": { "type": "NumberTypeAnnotation", - "start": 62, - "end": 68, - "loc": { - "start": { - "line": 5, - "column": 5 - }, - "end": { - "line": 5, - "column": 11 - } - } + "start":62,"end":68,"loc":{"start":{"line":5,"column":5},"end":{"line":5,"column":11}} }, "variance": null, "optional": false @@ -265,81 +96,24 @@ }, { "type": "TypeAlias", - "start": 80, - "end": 113, - "loc": { - "start": { - "line": 8, - "column": 0 - }, - "end": { - "line": 11, - "column": 2 - } - }, + "start":80,"end":113,"loc":{"start":{"line":8,"column":0},"end":{"line":11,"column":2}}, "id": { "type": "Identifier", - "start": 85, - "end": 86, - "loc": { - "start": { - "line": 8, - "column": 5 - }, - "end": { - "line": 8, - "column": 6 - }, - "identifierName": "W" - }, + "start":85,"end":86,"loc":{"start":{"line":8,"column":5},"end":{"line":8,"column":6},"identifierName":"W"}, "name": "W" }, "typeParameters": null, "right": { "type": "ObjectTypeAnnotation", - "start": 89, - "end": 112, - "loc": { - "start": { - "line": 8, - "column": 9 - }, - "end": { - "line": 11, - "column": 1 - } - }, + "start":89,"end":112,"loc":{"start":{"line":8,"column":9},"end":{"line":11,"column":1}}, "callProperties": [], "properties": [ { "type": "ObjectTypeProperty", - "start": 93, - "end": 102, - "loc": { - "start": { - "line": 9, - "column": 2 - }, - "end": { - "line": 9, - "column": 11 - } - }, + "start":93,"end":102,"loc":{"start":{"line":9,"column":2},"end":{"line":9,"column":11}}, "key": { "type": "Identifier", - "start": 93, - "end": 94, - "loc": { - "start": { - "line": 9, - "column": 2 - }, - "end": { - "line": 9, - "column": 3 - }, - "identifierName": "x" - }, + "start":93,"end":94,"loc":{"start":{"line":9,"column":2},"end":{"line":9,"column":3},"identifierName":"x"}, "name": "x" }, "static": false, @@ -348,18 +122,7 @@ "method": false, "value": { "type": "NumberTypeAnnotation", - "start": 96, - "end": 102, - "loc": { - "start": { - "line": 9, - "column": 5 - }, - "end": { - "line": 9, - "column": 11 - } - } + "start":96,"end":102,"loc":{"start":{"line":9,"column":5},"end":{"line":9,"column":11}} }, "variance": null, "optional": false @@ -378,18 +141,7 @@ { "type": "CommentLine", "value": "@flow", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - } + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}} } ] } \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/interface-types/basic/output.json b/packages/babel-parser/test/fixtures/flow/interface-types/basic/output.json index 9e75058274f7..2d4ff81db46b 100644 --- a/packages/babel-parser/test/fixtures/flow/interface-types/basic/output.json +++ b/packages/babel-parser/test/fixtures/flow/interface-types/basic/output.json @@ -1,126 +1,36 @@ { "type": "File", - "start": 0, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, "program": { "type": "Program", - "start": 0, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "TypeAlias", - "start": 0, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, "id": { "type": "Identifier", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "T" - }, + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"T"}, "name": "T" }, "typeParameters": null, "right": { "type": "InterfaceTypeAnnotation", - "start": 9, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":9,"end":32,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":32}}, "extends": [], "body": { "type": "ObjectTypeAnnotation", - "start": 19, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":19,"end":32,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":32}}, "callProperties": [], "properties": [ { "type": "ObjectTypeProperty", - "start": 21, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":21,"end":30,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":30}}, "key": { "type": "Identifier", - "start": 21, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 22 - }, - "identifierName": "p" - }, + "start":21,"end":22,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":22},"identifierName":"p"}, "name": "p" }, "static": false, @@ -129,18 +39,7 @@ "method": false, "value": { "type": "StringTypeAnnotation", - "start": 24, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 30 - } - } + "start":24,"end":30,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":30}} }, "variance": null, "optional": false diff --git a/packages/babel-parser/test/fixtures/flow/interface-types/extends-multiple-reserved-invalid-1/input.js b/packages/babel-parser/test/fixtures/flow/interface-types/extends-multiple-reserved-invalid-1/input.js new file mode 100644 index 000000000000..d37bc775f75f --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/interface-types/extends-multiple-reserved-invalid-1/input.js @@ -0,0 +1,2 @@ +// @flow +interface I extends X, bool {} diff --git a/packages/babel-parser/test/fixtures/flow/interface-types/extends-multiple-reserved-invalid-1/output.json b/packages/babel-parser/test/fixtures/flow/interface-types/extends-multiple-reserved-invalid-1/output.json new file mode 100644 index 000000000000..ab97f0f061ed --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/interface-types/extends-multiple-reserved-invalid-1/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":30}}, + "errors": [ + "SyntaxError: Unexpected reserved type bool (2:23)" + ], + "program": { + "type": "Program", + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":30}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "InterfaceDeclaration", + "start":9,"end":39,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":30}}, + "id": { + "type": "Identifier", + "start":19,"end":20,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":11},"identifierName":"I"}, + "name": "I" + }, + "typeParameters": null, + "extends": [ + { + "type": "InterfaceExtends", + "start":29,"end":30,"loc":{"start":{"line":2,"column":20},"end":{"line":2,"column":21}}, + "id": { + "type": "Identifier", + "start":29,"end":30,"loc":{"start":{"line":2,"column":20},"end":{"line":2,"column":21},"identifierName":"X"}, + "name": "X" + }, + "typeParameters": null + }, + { + "type": "InterfaceExtends", + "start":32,"end":36,"loc":{"start":{"line":2,"column":23},"end":{"line":2,"column":27}}, + "id": { + "type": "Identifier", + "start":32,"end":36,"loc":{"start":{"line":2,"column":23},"end":{"line":2,"column":27},"identifierName":"bool"}, + "name": "bool" + }, + "typeParameters": null + } + ], + "implements": [], + "mixins": [], + "body": { + "type": "ObjectTypeAnnotation", + "start":37,"end":39,"loc":{"start":{"line":2,"column":28},"end":{"line":2,"column":30}}, + "callProperties": [], + "properties": [], + "indexers": [], + "internalSlots": [], + "exact": false + }, + "leadingComments": [ + { + "type": "CommentLine", + "value": " @flow", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}} + } + ] + } + ], + "directives": [] + }, + "comments": [ + { + "type": "CommentLine", + "value": " @flow", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}} + } + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/interface-types/extends-multiple-reserved-invalid-2/input.js b/packages/babel-parser/test/fixtures/flow/interface-types/extends-multiple-reserved-invalid-2/input.js new file mode 100644 index 000000000000..9aaf187a6099 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/interface-types/extends-multiple-reserved-invalid-2/input.js @@ -0,0 +1,2 @@ +// @flow +interface I extends X, bool.m {} diff --git a/packages/babel-parser/test/fixtures/flow/interface-types/extends-multiple-reserved-invalid-2/output.json b/packages/babel-parser/test/fixtures/flow/interface-types/extends-multiple-reserved-invalid-2/output.json new file mode 100644 index 000000000000..53fdc1eadb82 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/interface-types/extends-multiple-reserved-invalid-2/output.json @@ -0,0 +1,82 @@ +{ + "type": "File", + "start":0,"end":41,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":32}}, + "errors": [ + "SyntaxError: Unexpected reserved type bool (2:23)" + ], + "program": { + "type": "Program", + "start":0,"end":41,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":32}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "InterfaceDeclaration", + "start":9,"end":41,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":32}}, + "id": { + "type": "Identifier", + "start":19,"end":20,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":11},"identifierName":"I"}, + "name": "I" + }, + "typeParameters": null, + "extends": [ + { + "type": "InterfaceExtends", + "start":29,"end":30,"loc":{"start":{"line":2,"column":20},"end":{"line":2,"column":21}}, + "id": { + "type": "Identifier", + "start":29,"end":30,"loc":{"start":{"line":2,"column":20},"end":{"line":2,"column":21},"identifierName":"X"}, + "name": "X" + }, + "typeParameters": null + }, + { + "type": "InterfaceExtends", + "start":32,"end":38,"loc":{"start":{"line":2,"column":23},"end":{"line":2,"column":29}}, + "id": { + "type": "QualifiedTypeIdentifier", + "start":32,"end":38,"loc":{"start":{"line":2,"column":23},"end":{"line":2,"column":29}}, + "qualification": { + "type": "Identifier", + "start":32,"end":36,"loc":{"start":{"line":2,"column":23},"end":{"line":2,"column":27},"identifierName":"bool"}, + "name": "bool" + }, + "id": { + "type": "Identifier", + "start":37,"end":38,"loc":{"start":{"line":2,"column":28},"end":{"line":2,"column":29},"identifierName":"m"}, + "name": "m" + } + }, + "typeParameters": null + } + ], + "implements": [], + "mixins": [], + "body": { + "type": "ObjectTypeAnnotation", + "start":39,"end":41,"loc":{"start":{"line":2,"column":30},"end":{"line":2,"column":32}}, + "callProperties": [], + "properties": [], + "indexers": [], + "internalSlots": [], + "exact": false + }, + "leadingComments": [ + { + "type": "CommentLine", + "value": " @flow", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}} + } + ] + } + ], + "directives": [] + }, + "comments": [ + { + "type": "CommentLine", + "value": " @flow", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}} + } + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/interface-types/extends-multiple/output.json b/packages/babel-parser/test/fixtures/flow/interface-types/extends-multiple/output.json index 8ca1c30e33fd..9202873a9e4a 100644 --- a/packages/babel-parser/test/fixtures/flow/interface-types/extends-multiple/output.json +++ b/packages/babel-parser/test/fixtures/flow/interface-types/extends-multiple/output.json @@ -1,143 +1,41 @@ { "type": "File", - "start": 0, - "end": 45, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 45 - } - }, + "start":0,"end":45,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":45}}, "program": { "type": "Program", - "start": 0, - "end": 45, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 45 - } - }, + "start":0,"end":45,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":45}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "TypeAlias", - "start": 0, - "end": 45, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 45 - } - }, + "start":0,"end":45,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":45}}, "id": { "type": "Identifier", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "T" - }, + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"T"}, "name": "T" }, "typeParameters": null, "right": { "type": "InterfaceTypeAnnotation", - "start": 9, - "end": 45, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 45 - } - }, + "start":9,"end":45,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":45}}, "extends": [ { "type": "InterfaceExtends", - "start": 27, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":27,"end":28,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":28}}, "id": { "type": "Identifier", - "start": 27, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 28 - }, - "identifierName": "X" - }, + "start":27,"end":28,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":28},"identifierName":"X"}, "name": "X" }, "typeParameters": null }, { "type": "InterfaceExtends", - "start": 30, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":30,"end":31,"loc":{"start":{"line":1,"column":30},"end":{"line":1,"column":31}}, "id": { "type": "Identifier", - "start": 30, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 1, - "column": 31 - }, - "identifierName": "Y" - }, + "start":30,"end":31,"loc":{"start":{"line":1,"column":30},"end":{"line":1,"column":31},"identifierName":"Y"}, "name": "Y" }, "typeParameters": null @@ -145,49 +43,15 @@ ], "body": { "type": "ObjectTypeAnnotation", - "start": 32, - "end": 45, - "loc": { - "start": { - "line": 1, - "column": 32 - }, - "end": { - "line": 1, - "column": 45 - } - }, + "start":32,"end":45,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":45}}, "callProperties": [], "properties": [ { "type": "ObjectTypeProperty", - "start": 34, - "end": 43, - "loc": { - "start": { - "line": 1, - "column": 34 - }, - "end": { - "line": 1, - "column": 43 - } - }, + "start":34,"end":43,"loc":{"start":{"line":1,"column":34},"end":{"line":1,"column":43}}, "key": { "type": "Identifier", - "start": 34, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 34 - }, - "end": { - "line": 1, - "column": 35 - }, - "identifierName": "p" - }, + "start":34,"end":35,"loc":{"start":{"line":1,"column":34},"end":{"line":1,"column":35},"identifierName":"p"}, "name": "p" }, "static": false, @@ -196,18 +60,7 @@ "method": false, "value": { "type": "StringTypeAnnotation", - "start": 37, - "end": 43, - "loc": { - "start": { - "line": 1, - "column": 37 - }, - "end": { - "line": 1, - "column": 43 - } - } + "start":37,"end":43,"loc":{"start":{"line":1,"column":37},"end":{"line":1,"column":43}} }, "variance": null, "optional": false diff --git a/packages/babel-parser/test/fixtures/flow/interface-types/extends-reserved-invalid-1/input.js b/packages/babel-parser/test/fixtures/flow/interface-types/extends-reserved-invalid-1/input.js new file mode 100644 index 000000000000..63a11d3bd272 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/interface-types/extends-reserved-invalid-1/input.js @@ -0,0 +1,2 @@ +// @flow +interface I extends bool {} diff --git a/packages/babel-parser/test/fixtures/flow/interface-types/extends-reserved-invalid-1/output.json b/packages/babel-parser/test/fixtures/flow/interface-types/extends-reserved-invalid-1/output.json new file mode 100644 index 000000000000..a9b966d7dba8 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/interface-types/extends-reserved-invalid-1/output.json @@ -0,0 +1,63 @@ +{ + "type": "File", + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":27}}, + "errors": [ + "SyntaxError: Unexpected reserved type bool (2:20)" + ], + "program": { + "type": "Program", + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":27}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "InterfaceDeclaration", + "start":9,"end":36,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":27}}, + "id": { + "type": "Identifier", + "start":19,"end":20,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":11},"identifierName":"I"}, + "name": "I" + }, + "typeParameters": null, + "extends": [ + { + "type": "InterfaceExtends", + "start":29,"end":33,"loc":{"start":{"line":2,"column":20},"end":{"line":2,"column":24}}, + "id": { + "type": "Identifier", + "start":29,"end":33,"loc":{"start":{"line":2,"column":20},"end":{"line":2,"column":24},"identifierName":"bool"}, + "name": "bool" + }, + "typeParameters": null + } + ], + "implements": [], + "mixins": [], + "body": { + "type": "ObjectTypeAnnotation", + "start":34,"end":36,"loc":{"start":{"line":2,"column":25},"end":{"line":2,"column":27}}, + "callProperties": [], + "properties": [], + "indexers": [], + "internalSlots": [], + "exact": false + }, + "leadingComments": [ + { + "type": "CommentLine", + "value": " @flow", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}} + } + ] + } + ], + "directives": [] + }, + "comments": [ + { + "type": "CommentLine", + "value": " @flow", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}} + } + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/interface-types/extends-reserved-invalid-2/input.js b/packages/babel-parser/test/fixtures/flow/interface-types/extends-reserved-invalid-2/input.js new file mode 100644 index 000000000000..594e6b7b78b6 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/interface-types/extends-reserved-invalid-2/input.js @@ -0,0 +1,2 @@ +// @flow +interface I extends bool.m {} diff --git a/packages/babel-parser/test/fixtures/flow/interface-types/extends-reserved-invalid-2/output.json b/packages/babel-parser/test/fixtures/flow/interface-types/extends-reserved-invalid-2/output.json new file mode 100644 index 000000000000..9c8eea94c707 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/interface-types/extends-reserved-invalid-2/output.json @@ -0,0 +1,72 @@ +{ + "type": "File", + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":29}}, + "errors": [ + "SyntaxError: Unexpected reserved type bool (2:20)" + ], + "program": { + "type": "Program", + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":29}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "InterfaceDeclaration", + "start":9,"end":38,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":29}}, + "id": { + "type": "Identifier", + "start":19,"end":20,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":11},"identifierName":"I"}, + "name": "I" + }, + "typeParameters": null, + "extends": [ + { + "type": "InterfaceExtends", + "start":29,"end":35,"loc":{"start":{"line":2,"column":20},"end":{"line":2,"column":26}}, + "id": { + "type": "QualifiedTypeIdentifier", + "start":29,"end":35,"loc":{"start":{"line":2,"column":20},"end":{"line":2,"column":26}}, + "qualification": { + "type": "Identifier", + "start":29,"end":33,"loc":{"start":{"line":2,"column":20},"end":{"line":2,"column":24},"identifierName":"bool"}, + "name": "bool" + }, + "id": { + "type": "Identifier", + "start":34,"end":35,"loc":{"start":{"line":2,"column":25},"end":{"line":2,"column":26},"identifierName":"m"}, + "name": "m" + } + }, + "typeParameters": null + } + ], + "implements": [], + "mixins": [], + "body": { + "type": "ObjectTypeAnnotation", + "start":36,"end":38,"loc":{"start":{"line":2,"column":27},"end":{"line":2,"column":29}}, + "callProperties": [], + "properties": [], + "indexers": [], + "internalSlots": [], + "exact": false + }, + "leadingComments": [ + { + "type": "CommentLine", + "value": " @flow", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}} + } + ] + } + ], + "directives": [] + }, + "comments": [ + { + "type": "CommentLine", + "value": " @flow", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}} + } + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/interface-types/extends/output.json b/packages/babel-parser/test/fixtures/flow/interface-types/extends/output.json index 2d6da1e73385..9447b243539b 100644 --- a/packages/babel-parser/test/fixtures/flow/interface-types/extends/output.json +++ b/packages/babel-parser/test/fixtures/flow/interface-types/extends/output.json @@ -1,110 +1,31 @@ { "type": "File", - "start": 0, - "end": 42, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 42 - } - }, + "start":0,"end":42,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":42}}, "program": { "type": "Program", - "start": 0, - "end": 42, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 42 - } - }, + "start":0,"end":42,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":42}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "TypeAlias", - "start": 0, - "end": 42, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 42 - } - }, + "start":0,"end":42,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":42}}, "id": { "type": "Identifier", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "T" - }, + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"T"}, "name": "T" }, "typeParameters": null, "right": { "type": "InterfaceTypeAnnotation", - "start": 9, - "end": 42, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 42 - } - }, + "start":9,"end":42,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":42}}, "extends": [ { "type": "InterfaceExtends", - "start": 27, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":27,"end":28,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":28}}, "id": { "type": "Identifier", - "start": 27, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 28 - }, - "identifierName": "X" - }, + "start":27,"end":28,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":28},"identifierName":"X"}, "name": "X" }, "typeParameters": null @@ -112,49 +33,15 @@ ], "body": { "type": "ObjectTypeAnnotation", - "start": 29, - "end": 42, - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 1, - "column": 42 - } - }, + "start":29,"end":42,"loc":{"start":{"line":1,"column":29},"end":{"line":1,"column":42}}, "callProperties": [], "properties": [ { "type": "ObjectTypeProperty", - "start": 31, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 31 - }, - "end": { - "line": 1, - "column": 40 - } - }, + "start":31,"end":40,"loc":{"start":{"line":1,"column":31},"end":{"line":1,"column":40}}, "key": { "type": "Identifier", - "start": 31, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 31 - }, - "end": { - "line": 1, - "column": 32 - }, - "identifierName": "p" - }, + "start":31,"end":32,"loc":{"start":{"line":1,"column":31},"end":{"line":1,"column":32},"identifierName":"p"}, "name": "p" }, "static": false, @@ -163,18 +50,7 @@ "method": false, "value": { "type": "StringTypeAnnotation", - "start": 34, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 34 - }, - "end": { - "line": 1, - "column": 40 - } - } + "start":34,"end":40,"loc":{"start":{"line":1,"column":34},"end":{"line":1,"column":40}} }, "variance": null, "optional": false diff --git a/packages/babel-parser/test/fixtures/flow/interface-types/identifier-named-static-method/output.json b/packages/babel-parser/test/fixtures/flow/interface-types/identifier-named-static-method/output.json index 73f418d338aa..db1accdec445 100644 --- a/packages/babel-parser/test/fixtures/flow/interface-types/identifier-named-static-method/output.json +++ b/packages/babel-parser/test/fixtures/flow/interface-types/identifier-named-static-method/output.json @@ -1,126 +1,36 @@ { "type": "File", - "start": 0, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 39 - } - }, + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":39}}, "program": { "type": "Program", - "start": 0, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 39 - } - }, + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":39}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "TypeAlias", - "start": 0, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 39 - } - }, + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":39}}, "id": { "type": "Identifier", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "T" - }, + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"T"}, "name": "T" }, "typeParameters": null, "right": { "type": "InterfaceTypeAnnotation", - "start": 9, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 39 - } - }, + "start":9,"end":39,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":39}}, "extends": [], "body": { "type": "ObjectTypeAnnotation", - "start": 19, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 39 - } - }, + "start":19,"end":39,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":39}}, "callProperties": [], "properties": [ { "type": "ObjectTypeProperty", - "start": 21, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 37 - } - }, + "start":21,"end":37,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":37}}, "key": { "type": "Identifier", - "start": 21, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 27 - }, - "identifierName": "static" - }, + "start":21,"end":27,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":27},"identifierName":"static"}, "name": "static" }, "static": false, @@ -129,35 +39,13 @@ "method": true, "value": { "type": "FunctionTypeAnnotation", - "start": 21, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 37 - } - }, + "start":21,"end":37,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":37}}, "params": [], "rest": null, "typeParameters": null, "returnType": { "type": "NumberTypeAnnotation", - "start": 31, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 31 - }, - "end": { - "line": 1, - "column": 37 - } - } + "start":31,"end":37,"loc":{"start":{"line":1,"column":31},"end":{"line":1,"column":37}} } }, "optional": false diff --git a/packages/babel-parser/test/fixtures/flow/interfaces-module-and-script/1/output.json b/packages/babel-parser/test/fixtures/flow/interfaces-module-and-script/1/output.json index cbfe467e6798..7244ddd95fe8 100644 --- a/packages/babel-parser/test/fixtures/flow/interfaces-module-and-script/1/output.json +++ b/packages/babel-parser/test/fixtures/flow/interfaces-module-and-script/1/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "program": { "type": "Program", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "InterfaceDeclaration", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "id": { "type": "Identifier", - "start": 10, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "A" - }, + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11},"identifierName":"A"}, "name": "A" }, "typeParameters": null, @@ -66,18 +21,7 @@ "mixins": [], "body": { "type": "ObjectTypeAnnotation", - "start": 12, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":12,"end":14,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":14}}, "callProperties": [], "properties": [], "indexers": [], diff --git a/packages/babel-parser/test/fixtures/flow/interfaces-module-and-script/10/output.json b/packages/babel-parser/test/fixtures/flow/interfaces-module-and-script/10/output.json index 32bec330e537..08a97862a7d3 100644 --- a/packages/babel-parser/test/fixtures/flow/interfaces-module-and-script/10/output.json +++ b/packages/babel-parser/test/fixtures/flow/interfaces-module-and-script/10/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 51, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":0,"end":51,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 51, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":0,"end":51,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "InterfaceDeclaration", - "start": 0, - "end": 51, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":0,"end":51,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, "id": { "type": "Identifier", - "start": 10, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 14 - }, - "identifierName": "IFoo" - }, + "start":10,"end":14,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":14},"identifierName":"IFoo"}, "name": "IFoo" }, "typeParameters": null, @@ -66,49 +21,15 @@ "mixins": [], "body": { "type": "ObjectTypeAnnotation", - "start": 15, - "end": 51, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":15,"end":51,"loc":{"start":{"line":1,"column":15},"end":{"line":4,"column":1}}, "callProperties": [], "properties": [ { "type": "ObjectTypeProperty", - "start": 19, - "end": 29, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 12 - } - }, + "start":19,"end":29,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":12}}, "key": { "type": "Identifier", - "start": 19, - "end": 20, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 3 - }, - "identifierName": "x" - }, + "start":19,"end":20,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":3},"identifierName":"x"}, "name": "x" }, "static": false, @@ -117,51 +38,17 @@ "method": false, "value": { "type": "BooleanTypeAnnotation", - "start": 22, - "end": 29, - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 12 - } - } + "start":22,"end":29,"loc":{"start":{"line":2,"column":5},"end":{"line":2,"column":12}} }, "variance": null, "optional": false }, { "type": "ObjectTypeProperty", - "start": 33, - "end": 48, - "loc": { - "start": { - "line": 3, - "column": 2 - }, - "end": { - "line": 3, - "column": 17 - } - }, + "start":33,"end":48,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":17}}, "key": { "type": "Identifier", - "start": 33, - "end": 39, - "loc": { - "start": { - "line": 3, - "column": 2 - }, - "end": { - "line": 3, - "column": 8 - }, - "identifierName": "static" - }, + "start":33,"end":39,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":8},"identifierName":"static"}, "name": "static" }, "static": false, @@ -170,35 +57,13 @@ "method": true, "value": { "type": "FunctionTypeAnnotation", - "start": 33, - "end": 48, - "loc": { - "start": { - "line": 3, - "column": 2 - }, - "end": { - "line": 3, - "column": 17 - } - }, + "start":33,"end":48,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":17}}, "params": [], "rest": null, "typeParameters": null, "returnType": { "type": "VoidTypeAnnotation", - "start": 44, - "end": 48, - "loc": { - "start": { - "line": 3, - "column": 13 - }, - "end": { - "line": 3, - "column": 17 - } - } + "start":44,"end":48,"loc":{"start":{"line":3,"column":13},"end":{"line":3,"column":17}} } }, "optional": false diff --git a/packages/babel-parser/test/fixtures/flow/interfaces-module-and-script/2/output.json b/packages/babel-parser/test/fixtures/flow/interfaces-module-and-script/2/output.json index 5911bf1d90da..ddf8f7342c60 100644 --- a/packages/babel-parser/test/fixtures/flow/interfaces-module-and-script/2/output.json +++ b/packages/babel-parser/test/fixtures/flow/interfaces-module-and-script/2/output.json @@ -1,96 +1,28 @@ { "type": "File", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "program": { "type": "Program", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "InterfaceDeclaration", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "id": { "type": "Identifier", - "start": 10, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "A" - }, + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11},"identifierName":"A"}, "name": "A" }, "typeParameters": null, "extends": [ { "type": "InterfaceExtends", - "start": 20, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":20,"end":21,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":21}}, "id": { "type": "Identifier", - "start": 20, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 21 - }, - "identifierName": "B" - }, + "start":20,"end":21,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":21},"identifierName":"B"}, "name": "B" }, "typeParameters": null @@ -100,18 +32,7 @@ "mixins": [], "body": { "type": "ObjectTypeAnnotation", - "start": 22, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":22,"end":24,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":24}}, "callProperties": [], "properties": [], "indexers": [], diff --git a/packages/babel-parser/test/fixtures/flow/interfaces-module-and-script/3/output.json b/packages/babel-parser/test/fixtures/flow/interfaces-module-and-script/3/output.json index d10815eca761..99659e265ccf 100644 --- a/packages/babel-parser/test/fixtures/flow/interfaces-module-and-script/3/output.json +++ b/packages/babel-parser/test/fixtures/flow/interfaces-module-and-script/3/output.json @@ -1,94 +1,27 @@ { "type": "File", - "start": 0, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, "program": { "type": "Program", - "start": 0, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "InterfaceDeclaration", - "start": 0, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, "id": { "type": "Identifier", - "start": 10, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "A" - }, + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11},"identifierName":"A"}, "name": "A" }, "typeParameters": { "type": "TypeParameterDeclaration", - "start": 11, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":11,"end":14,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":14}}, "params": [ { "type": "TypeParameter", - "start": 12, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":12,"end":13,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":13}}, "name": "T", "variance": null } @@ -97,80 +30,23 @@ "extends": [ { "type": "InterfaceExtends", - "start": 23, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":23,"end":27,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":27}}, "id": { "type": "Identifier", - "start": 23, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 24 - }, - "identifierName": "B" - }, + "start":23,"end":24,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":24},"identifierName":"B"}, "name": "B" }, "typeParameters": { "type": "TypeParameterInstantiation", - "start": 24, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":24,"end":27,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":27}}, "params": [ { "type": "GenericTypeAnnotation", - "start": 25, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":25,"end":26,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":26}}, "typeParameters": null, "id": { "type": "Identifier", - "start": 25, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 26 - }, - "identifierName": "T" - }, + "start":25,"end":26,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":26},"identifierName":"T"}, "name": "T" } } @@ -179,80 +55,23 @@ }, { "type": "InterfaceExtends", - "start": 29, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":29,"end":33,"loc":{"start":{"line":1,"column":29},"end":{"line":1,"column":33}}, "id": { "type": "Identifier", - "start": 29, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 1, - "column": 30 - }, - "identifierName": "C" - }, + "start":29,"end":30,"loc":{"start":{"line":1,"column":29},"end":{"line":1,"column":30},"identifierName":"C"}, "name": "C" }, "typeParameters": { "type": "TypeParameterInstantiation", - "start": 30, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":30,"end":33,"loc":{"start":{"line":1,"column":30},"end":{"line":1,"column":33}}, "params": [ { "type": "GenericTypeAnnotation", - "start": 31, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 31 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":31,"end":32,"loc":{"start":{"line":1,"column":31},"end":{"line":1,"column":32}}, "typeParameters": null, "id": { "type": "Identifier", - "start": 31, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 31 - }, - "end": { - "line": 1, - "column": 32 - }, - "identifierName": "T" - }, + "start":31,"end":32,"loc":{"start":{"line":1,"column":31},"end":{"line":1,"column":32},"identifierName":"T"}, "name": "T" } } @@ -264,18 +83,7 @@ "mixins": [], "body": { "type": "ObjectTypeAnnotation", - "start": 34, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 34 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":34,"end":36,"loc":{"start":{"line":1,"column":34},"end":{"line":1,"column":36}}, "callProperties": [], "properties": [], "indexers": [], diff --git a/packages/babel-parser/test/fixtures/flow/interfaces-module-and-script/4/output.json b/packages/babel-parser/test/fixtures/flow/interfaces-module-and-script/4/output.json index 88174f7dee8e..a4261a11c12a 100644 --- a/packages/babel-parser/test/fixtures/flow/interfaces-module-and-script/4/output.json +++ b/packages/babel-parser/test/fixtures/flow/interfaces-module-and-script/4/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, "program": { "type": "Program", - "start": 0, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "InterfaceDeclaration", - "start": 0, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, "id": { "type": "Identifier", - "start": 10, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "A" - }, + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11},"identifierName":"A"}, "name": "A" }, "typeParameters": null, @@ -66,49 +21,15 @@ "mixins": [], "body": { "type": "ObjectTypeAnnotation", - "start": 12, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":12,"end":34,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":34}}, "callProperties": [], "properties": [ { "type": "ObjectTypeProperty", - "start": 14, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":14,"end":31,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":31}}, "key": { "type": "Identifier", - "start": 14, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 17 - }, - "identifierName": "foo" - }, + "start":14,"end":17,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":17},"identifierName":"foo"}, "name": "foo" }, "static": false, @@ -117,34 +38,12 @@ "method": false, "value": { "type": "FunctionTypeAnnotation", - "start": 19, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":19,"end":31,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":31}}, "params": [], "rest": null, "returnType": { "type": "NumberTypeAnnotation", - "start": 25, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 31 - } - } + "start":25,"end":31,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":31}} }, "typeParameters": null }, diff --git a/packages/babel-parser/test/fixtures/flow/interfaces-module-and-script/5/output.json b/packages/babel-parser/test/fixtures/flow/interfaces-module-and-script/5/output.json index 4235a52169b2..18afb96e0ca1 100644 --- a/packages/babel-parser/test/fixtures/flow/interfaces-module-and-script/5/output.json +++ b/packages/babel-parser/test/fixtures/flow/interfaces-module-and-script/5/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 65, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 65 - } - }, + "start":0,"end":65,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":65}}, "program": { "type": "Program", - "start": 0, - "end": 65, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 65 - } - }, + "start":0,"end":65,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":65}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "InterfaceDeclaration", - "start": 0, - "end": 65, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 65 - } - }, + "start":0,"end":65,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":65}}, "id": { "type": "Identifier", - "start": 10, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 20 - }, - "identifierName": "Dictionary" - }, + "start":10,"end":20,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":20},"identifierName":"Dictionary"}, "name": "Dictionary" }, "typeParameters": null, @@ -66,49 +21,15 @@ "mixins": [], "body": { "type": "ObjectTypeAnnotation", - "start": 21, - "end": 65, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 65 - } - }, + "start":21,"end":65,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":65}}, "callProperties": [], "properties": [ { "type": "ObjectTypeProperty", - "start": 48, - "end": 62, - "loc": { - "start": { - "line": 1, - "column": 48 - }, - "end": { - "line": 1, - "column": 62 - } - }, + "start":48,"end":62,"loc":{"start":{"line":1,"column":48},"end":{"line":1,"column":62}}, "key": { "type": "Identifier", - "start": 48, - "end": 54, - "loc": { - "start": { - "line": 1, - "column": 48 - }, - "end": { - "line": 1, - "column": 54 - }, - "identifierName": "length" - }, + "start":48,"end":54,"loc":{"start":{"line":1,"column":48},"end":{"line":1,"column":54},"identifierName":"length"}, "name": "length" }, "static": false, @@ -117,18 +38,7 @@ "method": false, "value": { "type": "NumberTypeAnnotation", - "start": 56, - "end": 62, - "loc": { - "start": { - "line": 1, - "column": 56 - }, - "end": { - "line": 1, - "column": 62 - } - } + "start":56,"end":62,"loc":{"start":{"line":1,"column":56},"end":{"line":1,"column":62}} }, "variance": null, "optional": false @@ -137,65 +47,20 @@ "indexers": [ { "type": "ObjectTypeIndexer", - "start": 23, - "end": 46, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 46 - } - }, + "start":23,"end":46,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":46}}, "static": false, "id": { "type": "Identifier", - "start": 24, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 29 - }, - "identifierName": "index" - }, + "start":24,"end":29,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":29},"identifierName":"index"}, "name": "index" }, "key": { "type": "StringTypeAnnotation", - "start": 31, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 31 - }, - "end": { - "line": 1, - "column": 37 - } - } + "start":31,"end":37,"loc":{"start":{"line":1,"column":31},"end":{"line":1,"column":37}} }, "value": { "type": "StringTypeAnnotation", - "start": 40, - "end": 46, - "loc": { - "start": { - "line": 1, - "column": 40 - }, - "end": { - "line": 1, - "column": 46 - } - } + "start":40,"end":46,"loc":{"start":{"line":1,"column":40},"end":{"line":1,"column":46}} }, "variance": null } diff --git a/packages/babel-parser/test/fixtures/flow/interfaces-module-and-script/6/output.json b/packages/babel-parser/test/fixtures/flow/interfaces-module-and-script/6/output.json index 26a8ee78e4f1..82bcfd3310e6 100644 --- a/packages/babel-parser/test/fixtures/flow/interfaces-module-and-script/6/output.json +++ b/packages/babel-parser/test/fixtures/flow/interfaces-module-and-script/6/output.json @@ -1,96 +1,28 @@ { "type": "File", - "start": 0, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, "program": { "type": "Program", - "start": 0, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, "id": { "type": "Identifier", - "start": 6, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "Foo" - }, + "start":6,"end":9,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":9},"identifierName":"Foo"}, "name": "Foo" }, "superClass": null, "implements": [ { "type": "ClassImplements", - "start": 21, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":21,"end":24,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":24}}, "id": { "type": "Identifier", - "start": 21, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 24 - }, - "identifierName": "Bar" - }, + "start":21,"end":24,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":24},"identifierName":"Bar"}, "name": "Bar" }, "typeParameters": null @@ -98,18 +30,7 @@ ], "body": { "type": "ClassBody", - "start": 25, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":25,"end":27,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":27}}, "body": [] } } diff --git a/packages/babel-parser/test/fixtures/flow/interfaces-module-and-script/7/output.json b/packages/babel-parser/test/fixtures/flow/interfaces-module-and-script/7/output.json index 4b1d879b8e8e..87bc4f8cdca3 100644 --- a/packages/babel-parser/test/fixtures/flow/interfaces-module-and-script/7/output.json +++ b/packages/babel-parser/test/fixtures/flow/interfaces-module-and-script/7/output.json @@ -1,176 +1,51 @@ { "type": "File", - "start": 0, - "end": 52, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 52 - } - }, + "start":0,"end":52,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":52}}, "program": { "type": "Program", - "start": 0, - "end": 52, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 52 - } - }, + "start":0,"end":52,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":52}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 52, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 52 - } - }, + "start":0,"end":52,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":52}}, "id": { "type": "Identifier", - "start": 6, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "Foo" - }, + "start":6,"end":9,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":9},"identifierName":"Foo"}, "name": "Foo" }, "superClass": { "type": "Identifier", - "start": 18, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 21 - }, - "identifierName": "Bar" - }, + "start":18,"end":21,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":21},"identifierName":"Bar"}, "name": "Bar" }, "implements": [ { "type": "ClassImplements", - "start": 33, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 33 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":33,"end":36,"loc":{"start":{"line":1,"column":33},"end":{"line":1,"column":36}}, "id": { "type": "Identifier", - "start": 33, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 33 - }, - "end": { - "line": 1, - "column": 36 - }, - "identifierName": "Bat" - }, + "start":33,"end":36,"loc":{"start":{"line":1,"column":33},"end":{"line":1,"column":36},"identifierName":"Bat"}, "name": "Bat" }, "typeParameters": null }, { "type": "ClassImplements", - "start": 38, - "end": 49, - "loc": { - "start": { - "line": 1, - "column": 38 - }, - "end": { - "line": 1, - "column": 49 - } - }, + "start":38,"end":49,"loc":{"start":{"line":1,"column":38},"end":{"line":1,"column":49}}, "id": { "type": "Identifier", - "start": 38, - "end": 41, - "loc": { - "start": { - "line": 1, - "column": 38 - }, - "end": { - "line": 1, - "column": 41 - }, - "identifierName": "Man" - }, + "start":38,"end":41,"loc":{"start":{"line":1,"column":38},"end":{"line":1,"column":41},"identifierName":"Man"}, "name": "Man" }, "typeParameters": { "type": "TypeParameterInstantiation", - "start": 41, - "end": 49, - "loc": { - "start": { - "line": 1, - "column": 41 - }, - "end": { - "line": 1, - "column": 49 - } - }, + "start":41,"end":49,"loc":{"start":{"line":1,"column":41},"end":{"line":1,"column":49}}, "params": [ { "type": "NumberTypeAnnotation", - "start": 42, - "end": 48, - "loc": { - "start": { - "line": 1, - "column": 42 - }, - "end": { - "line": 1, - "column": 48 - } - } + "start":42,"end":48,"loc":{"start":{"line":1,"column":42},"end":{"line":1,"column":48}} } ] } @@ -178,18 +53,7 @@ ], "body": { "type": "ClassBody", - "start": 50, - "end": 52, - "loc": { - "start": { - "line": 1, - "column": 50 - }, - "end": { - "line": 1, - "column": 52 - } - }, + "start":50,"end":52,"loc":{"start":{"line":1,"column":50},"end":{"line":1,"column":52}}, "body": [] } } diff --git a/packages/babel-parser/test/fixtures/flow/interfaces-module-and-script/8/output.json b/packages/babel-parser/test/fixtures/flow/interfaces-module-and-script/8/output.json index 5d31c9ca0f07..8d8283101c0c 100644 --- a/packages/babel-parser/test/fixtures/flow/interfaces-module-and-script/8/output.json +++ b/packages/babel-parser/test/fixtures/flow/interfaces-module-and-script/8/output.json @@ -1,127 +1,36 @@ { "type": "File", - "start": 0, - "end": 48, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 48 - } - }, + "start":0,"end":48,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":48}}, "program": { "type": "Program", - "start": 0, - "end": 48, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 48 - } - }, + "start":0,"end":48,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":48}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 48, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 48 - } - }, + "start":0,"end":48,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":48}}, "id": { "type": "Identifier", - "start": 6, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "Foo" - }, + "start":6,"end":9,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":9},"identifierName":"Foo"}, "name": "Foo" }, "superClass": { "type": "ClassExpression", - "start": 18, - "end": 45, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 45 - } - }, + "start":18,"end":45,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":45}}, "id": { "type": "Identifier", - "start": 24, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 27 - }, - "identifierName": "Bar" - }, + "start":24,"end":27,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":27},"identifierName":"Bar"}, "name": "Bar" }, "superClass": null, "implements": [ { "type": "ClassImplements", - "start": 39, - "end": 42, - "loc": { - "start": { - "line": 1, - "column": 39 - }, - "end": { - "line": 1, - "column": 42 - } - }, + "start":39,"end":42,"loc":{"start":{"line":1,"column":39},"end":{"line":1,"column":42}}, "id": { "type": "Identifier", - "start": 39, - "end": 42, - "loc": { - "start": { - "line": 1, - "column": 39 - }, - "end": { - "line": 1, - "column": 42 - }, - "identifierName": "Bat" - }, + "start":39,"end":42,"loc":{"start":{"line":1,"column":39},"end":{"line":1,"column":42},"identifierName":"Bat"}, "name": "Bat" }, "typeParameters": null @@ -129,35 +38,13 @@ ], "body": { "type": "ClassBody", - "start": 43, - "end": 45, - "loc": { - "start": { - "line": 1, - "column": 43 - }, - "end": { - "line": 1, - "column": 45 - } - }, + "start":43,"end":45,"loc":{"start":{"line":1,"column":43},"end":{"line":1,"column":45}}, "body": [] } }, "body": { "type": "ClassBody", - "start": 46, - "end": 48, - "loc": { - "start": { - "line": 1, - "column": 46 - }, - "end": { - "line": 1, - "column": 48 - } - }, + "start":46,"end":48,"loc":{"start":{"line":1,"column":46},"end":{"line":1,"column":48}}, "body": [] } } diff --git a/packages/babel-parser/test/fixtures/flow/interfaces-module-and-script/9/output.json b/packages/babel-parser/test/fixtures/flow/interfaces-module-and-script/9/output.json index 12bb8f6bf30f..38872f0d8ddc 100644 --- a/packages/babel-parser/test/fixtures/flow/interfaces-module-and-script/9/output.json +++ b/packages/babel-parser/test/fixtures/flow/interfaces-module-and-script/9/output.json @@ -1,127 +1,36 @@ { "type": "File", - "start": 0, - "end": 63, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 63 - } - }, + "start":0,"end":63,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":63}}, "program": { "type": "Program", - "start": 0, - "end": 63, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 63 - } - }, + "start":0,"end":63,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":63}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 63, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 63 - } - }, + "start":0,"end":63,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":63}}, "id": { "type": "Identifier", - "start": 6, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "Foo" - }, + "start":6,"end":9,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":9},"identifierName":"Foo"}, "name": "Foo" }, "superClass": { "type": "ClassExpression", - "start": 18, - "end": 45, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 45 - } - }, + "start":18,"end":45,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":45}}, "id": { "type": "Identifier", - "start": 24, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 27 - }, - "identifierName": "Bar" - }, + "start":24,"end":27,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":27},"identifierName":"Bar"}, "name": "Bar" }, "superClass": null, "implements": [ { "type": "ClassImplements", - "start": 39, - "end": 42, - "loc": { - "start": { - "line": 1, - "column": 39 - }, - "end": { - "line": 1, - "column": 42 - } - }, + "start":39,"end":42,"loc":{"start":{"line":1,"column":39},"end":{"line":1,"column":42}}, "id": { "type": "Identifier", - "start": 39, - "end": 42, - "loc": { - "start": { - "line": 1, - "column": 39 - }, - "end": { - "line": 1, - "column": 42 - }, - "identifierName": "Bat" - }, + "start":39,"end":42,"loc":{"start":{"line":1,"column":39},"end":{"line":1,"column":42},"identifierName":"Bat"}, "name": "Bat" }, "typeParameters": null @@ -129,51 +38,17 @@ ], "body": { "type": "ClassBody", - "start": 43, - "end": 45, - "loc": { - "start": { - "line": 1, - "column": 43 - }, - "end": { - "line": 1, - "column": 45 - } - }, + "start":43,"end":45,"loc":{"start":{"line":1,"column":43},"end":{"line":1,"column":45}}, "body": [] } }, "implements": [ { "type": "ClassImplements", - "start": 57, - "end": 60, - "loc": { - "start": { - "line": 1, - "column": 57 - }, - "end": { - "line": 1, - "column": 60 - } - }, + "start":57,"end":60,"loc":{"start":{"line":1,"column":57},"end":{"line":1,"column":60}}, "id": { "type": "Identifier", - "start": 57, - "end": 60, - "loc": { - "start": { - "line": 1, - "column": 57 - }, - "end": { - "line": 1, - "column": 60 - }, - "identifierName": "Man" - }, + "start":57,"end":60,"loc":{"start":{"line":1,"column":57},"end":{"line":1,"column":60},"identifierName":"Man"}, "name": "Man" }, "typeParameters": null @@ -181,18 +56,7 @@ ], "body": { "type": "ClassBody", - "start": 61, - "end": 63, - "loc": { - "start": { - "line": 1, - "column": 61 - }, - "end": { - "line": 1, - "column": 63 - } - }, + "start":61,"end":63,"loc":{"start":{"line":1,"column":61},"end":{"line":1,"column":63}}, "body": [] } } diff --git a/packages/babel-parser/test/fixtures/flow/interfaces-module-and-script/id-reserved-type-invalid/options.json b/packages/babel-parser/test/fixtures/flow/interfaces-module-and-script/id-reserved-type-invalid/options.json deleted file mode 100644 index b945b9a0a123..000000000000 --- a/packages/babel-parser/test/fixtures/flow/interfaces-module-and-script/id-reserved-type-invalid/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Cannot overwrite reserved type string (1:10)" -} diff --git a/packages/babel-parser/test/fixtures/flow/interfaces-module-and-script/id-reserved-type-invalid/output.json b/packages/babel-parser/test/fixtures/flow/interfaces-module-and-script/id-reserved-type-invalid/output.json new file mode 100644 index 000000000000..0cb78e7903e0 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/interfaces-module-and-script/id-reserved-type-invalid/output.json @@ -0,0 +1,38 @@ +{ + "type": "File", + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, + "errors": [ + "SyntaxError: Cannot overwrite reserved type string (1:10)" + ], + "program": { + "type": "Program", + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "InterfaceDeclaration", + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, + "id": { + "type": "Identifier", + "start":10,"end":16,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":16},"identifierName":"string"}, + "name": "string" + }, + "typeParameters": null, + "extends": [], + "implements": [], + "mixins": [], + "body": { + "type": "ObjectTypeAnnotation", + "start":17,"end":19,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":19}}, + "callProperties": [], + "properties": [], + "indexers": [], + "internalSlots": [], + "exact": false + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/interfaces-module-and-script/id-reserved-value/output.json b/packages/babel-parser/test/fixtures/flow/interfaces-module-and-script/id-reserved-value/output.json index af9714b904bd..a0dc37180e19 100644 --- a/packages/babel-parser/test/fixtures/flow/interfaces-module-and-script/id-reserved-value/output.json +++ b/packages/babel-parser/test/fixtures/flow/interfaces-module-and-script/id-reserved-value/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, "program": { "type": "Program", - "start": 0, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "InterfaceDeclaration", - "start": 0, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, "id": { "type": "Identifier", - "start": 10, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 16 - }, - "identifierName": "switch" - }, + "start":10,"end":16,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":16},"identifierName":"switch"}, "name": "switch" }, "typeParameters": null, @@ -66,18 +21,7 @@ "mixins": [], "body": { "type": "ObjectTypeAnnotation", - "start": 17, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":17,"end":19,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":19}}, "callProperties": [], "properties": [], "indexers": [], diff --git a/packages/babel-parser/test/fixtures/flow/interfaces-module-and-script/identifier-named-static-method/output.json b/packages/babel-parser/test/fixtures/flow/interfaces-module-and-script/identifier-named-static-method/output.json index 3ec979ff2b1d..b0834548218e 100644 --- a/packages/babel-parser/test/fixtures/flow/interfaces-module-and-script/identifier-named-static-method/output.json +++ b/packages/babel-parser/test/fixtures/flow/interfaces-module-and-script/identifier-named-static-method/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, "program": { "type": "Program", - "start": 0, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "InterfaceDeclaration", - "start": 0, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, "id": { "type": "Identifier", - "start": 10, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "A" - }, + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11},"identifierName":"A"}, "name": "A" }, "typeParameters": null, @@ -66,49 +21,15 @@ "mixins": [], "body": { "type": "ObjectTypeAnnotation", - "start": 12, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":12,"end":32,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":32}}, "callProperties": [], "properties": [ { "type": "ObjectTypeProperty", - "start": 14, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":14,"end":30,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":30}}, "key": { "type": "Identifier", - "start": 14, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 20 - }, - "identifierName": "static" - }, + "start":14,"end":20,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":20},"identifierName":"static"}, "name": "static" }, "static": false, @@ -117,35 +38,13 @@ "method": true, "value": { "type": "FunctionTypeAnnotation", - "start": 14, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":14,"end":30,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":30}}, "params": [], "rest": null, "typeParameters": null, "returnType": { "type": "NumberTypeAnnotation", - "start": 24, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 30 - } - } + "start":24,"end":30,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":30}} } }, "optional": false diff --git a/packages/babel-parser/test/fixtures/flow/interfaces-module-and-script/identifier-named-static-optional/output.json b/packages/babel-parser/test/fixtures/flow/interfaces-module-and-script/identifier-named-static-optional/output.json index f51323cb526d..34520e775075 100644 --- a/packages/babel-parser/test/fixtures/flow/interfaces-module-and-script/identifier-named-static-optional/output.json +++ b/packages/babel-parser/test/fixtures/flow/interfaces-module-and-script/identifier-named-static-optional/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, "program": { "type": "Program", - "start": 0, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "InterfaceDeclaration", - "start": 0, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, "id": { "type": "Identifier", - "start": 10, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "B" - }, + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11},"identifierName":"B"}, "name": "B" }, "typeParameters": null, @@ -66,49 +21,15 @@ "mixins": [], "body": { "type": "ObjectTypeAnnotation", - "start": 12, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":12,"end":31,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":31}}, "callProperties": [], "properties": [ { "type": "ObjectTypeProperty", - "start": 14, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":14,"end":29,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":29}}, "key": { "type": "Identifier", - "start": 14, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 20 - }, - "identifierName": "static" - }, + "start":14,"end":20,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":20},"identifierName":"static"}, "name": "static" }, "static": false, @@ -117,18 +38,7 @@ "method": false, "value": { "type": "NumberTypeAnnotation", - "start": 23, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 29 - } - } + "start":23,"end":29,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":29}} }, "variance": null, "optional": true diff --git a/packages/babel-parser/test/fixtures/flow/interfaces-module-and-script/implements-exports/input.js b/packages/babel-parser/test/fixtures/flow/interfaces-module-and-script/implements-exports/input.js new file mode 100644 index 000000000000..6e0495a39c96 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/interfaces-module-and-script/implements-exports/input.js @@ -0,0 +1,3 @@ +interface Foo {} + +export type { Foo } \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/interfaces-module-and-script/implements-exports/output.json b/packages/babel-parser/test/fixtures/flow/interfaces-module-and-script/implements-exports/output.json new file mode 100644 index 000000000000..51705ae6b884 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/interfaces-module-and-script/implements-exports/output.json @@ -0,0 +1,58 @@ +{ + "type": "File", + "start":0,"end":37,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":19}}, + "program": { + "type": "Program", + "start":0,"end":37,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":19}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "InterfaceDeclaration", + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, + "id": { + "type": "Identifier", + "start":10,"end":13,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":13},"identifierName":"Foo"}, + "name": "Foo" + }, + "typeParameters": null, + "extends": [], + "implements": [], + "mixins": [], + "body": { + "type": "ObjectTypeAnnotation", + "start":14,"end":16,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":16}}, + "callProperties": [], + "properties": [], + "indexers": [], + "internalSlots": [], + "exact": false + } + }, + { + "type": "ExportNamedDeclaration", + "start":18,"end":37,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":19}}, + "specifiers": [ + { + "type": "ExportSpecifier", + "start":32,"end":35,"loc":{"start":{"line":3,"column":14},"end":{"line":3,"column":17}}, + "local": { + "type": "Identifier", + "start":32,"end":35,"loc":{"start":{"line":3,"column":14},"end":{"line":3,"column":17},"identifierName":"Foo"}, + "name": "Foo" + }, + "exported": { + "type": "Identifier", + "start":32,"end":35,"loc":{"start":{"line":3,"column":14},"end":{"line":3,"column":17},"identifierName":"Foo"}, + "name": "Foo" + } + } + ], + "source": null, + "exportKind": "type", + "declaration": null + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/interfaces-module-and-script/implements-reserved-type-invalid-2/input.js b/packages/babel-parser/test/fixtures/flow/interfaces-module-and-script/implements-reserved-type-invalid-2/input.js new file mode 100644 index 000000000000..9feacceb06ec --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/interfaces-module-and-script/implements-reserved-type-invalid-2/input.js @@ -0,0 +1 @@ +class Foo implements Bar, string {} diff --git a/packages/babel-parser/test/fixtures/flow/interfaces-module-and-script/implements-reserved-type-invalid-2/output.json b/packages/babel-parser/test/fixtures/flow/interfaces-module-and-script/implements-reserved-type-invalid-2/output.json new file mode 100644 index 000000000000..ae3f5125cf1c --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/interfaces-module-and-script/implements-reserved-type-invalid-2/output.json @@ -0,0 +1,53 @@ +{ + "type": "File", + "start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":35}}, + "errors": [ + "SyntaxError: Unexpected reserved type string (1:26)" + ], + "program": { + "type": "Program", + "start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":35}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":35}}, + "id": { + "type": "Identifier", + "start":6,"end":9,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":9},"identifierName":"Foo"}, + "name": "Foo" + }, + "superClass": null, + "implements": [ + { + "type": "ClassImplements", + "start":21,"end":24,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":24}}, + "id": { + "type": "Identifier", + "start":21,"end":24,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":24},"identifierName":"Bar"}, + "name": "Bar" + }, + "typeParameters": null + }, + { + "type": "ClassImplements", + "start":26,"end":32,"loc":{"start":{"line":1,"column":26},"end":{"line":1,"column":32}}, + "id": { + "type": "Identifier", + "start":26,"end":32,"loc":{"start":{"line":1,"column":26},"end":{"line":1,"column":32},"identifierName":"string"}, + "name": "string" + }, + "typeParameters": null + } + ], + "body": { + "type": "ClassBody", + "start":33,"end":35,"loc":{"start":{"line":1,"column":33},"end":{"line":1,"column":35}}, + "body": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/interfaces-module-and-script/implements-reserved-type-invalid/options.json b/packages/babel-parser/test/fixtures/flow/interfaces-module-and-script/implements-reserved-type-invalid/options.json deleted file mode 100644 index 7aecee1ff0ae..000000000000 --- a/packages/babel-parser/test/fixtures/flow/interfaces-module-and-script/implements-reserved-type-invalid/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Cannot overwrite reserved type string (1:21)" -} diff --git a/packages/babel-parser/test/fixtures/flow/interfaces-module-and-script/implements-reserved-type-invalid/output.json b/packages/babel-parser/test/fixtures/flow/interfaces-module-and-script/implements-reserved-type-invalid/output.json new file mode 100644 index 000000000000..663e4c8f9dc4 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/interfaces-module-and-script/implements-reserved-type-invalid/output.json @@ -0,0 +1,43 @@ +{ + "type": "File", + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, + "errors": [ + "SyntaxError: Unexpected reserved type string (1:21)" + ], + "program": { + "type": "Program", + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, + "id": { + "type": "Identifier", + "start":6,"end":9,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":9},"identifierName":"Foo"}, + "name": "Foo" + }, + "superClass": null, + "implements": [ + { + "type": "ClassImplements", + "start":21,"end":27,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":27}}, + "id": { + "type": "Identifier", + "start":21,"end":27,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":27},"identifierName":"string"}, + "name": "string" + }, + "typeParameters": null + } + ], + "body": { + "type": "ClassBody", + "start":28,"end":30,"loc":{"start":{"line":1,"column":28},"end":{"line":1,"column":30}}, + "body": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/interfaces-module-and-script/implements-reserved-value/output.json b/packages/babel-parser/test/fixtures/flow/interfaces-module-and-script/implements-reserved-value/output.json index 6bd4005485e1..3e01b65c9766 100644 --- a/packages/babel-parser/test/fixtures/flow/interfaces-module-and-script/implements-reserved-value/output.json +++ b/packages/babel-parser/test/fixtures/flow/interfaces-module-and-script/implements-reserved-value/output.json @@ -1,96 +1,28 @@ { "type": "File", - "start": 0, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, "program": { "type": "Program", - "start": 0, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, "id": { "type": "Identifier", - "start": 6, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "Foo" - }, + "start":6,"end":9,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":9},"identifierName":"Foo"}, "name": "Foo" }, "superClass": null, "implements": [ { "type": "ClassImplements", - "start": 21, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":21,"end":27,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":27}}, "id": { "type": "Identifier", - "start": 21, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 27 - }, - "identifierName": "switch" - }, + "start":21,"end":27,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":27},"identifierName":"switch"}, "name": "switch" }, "typeParameters": null @@ -98,18 +30,7 @@ ], "body": { "type": "ClassBody", - "start": 28, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":28,"end":30,"loc":{"start":{"line":1,"column":28},"end":{"line":1,"column":30}}, "body": [] } } diff --git a/packages/babel-parser/test/fixtures/flow/internal-slot/declare-class-static/output.json b/packages/babel-parser/test/fixtures/flow/internal-slot/declare-class-static/output.json index 386e43577912..f6fc2b7c24fd 100644 --- a/packages/babel-parser/test/fixtures/flow/internal-slot/declare-class-static/output.json +++ b/packages/babel-parser/test/fixtures/flow/internal-slot/declare-class-static/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 37 - } - }, + "start":0,"end":37,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":37}}, "program": { "type": "Program", - "start": 0, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 37 - } - }, + "start":0,"end":37,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":37}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "DeclareClass", - "start": 0, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 37 - } - }, + "start":0,"end":37,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":37}}, "id": { "type": "Identifier", - "start": 14, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - }, - "identifierName": "C" - }, + "start":14,"end":15,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":15},"identifierName":"C"}, "name": "C" }, "typeParameters": null, @@ -66,85 +21,28 @@ "mixins": [], "body": { "type": "ObjectTypeAnnotation", - "start": 16, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 37 - } - }, + "start":16,"end":37,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":37}}, "callProperties": [], "properties": [], "indexers": [], "internalSlots": [ { "type": "ObjectTypeInternalSlot", - "start": 18, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":18,"end":35,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":35}}, "static": true, "id": { "type": "Identifier", - "start": 27, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 30 - }, - "identifierName": "foo" - }, + "start":27,"end":30,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":30},"identifierName":"foo"}, "name": "foo" }, "method": false, "value": { "type": "GenericTypeAnnotation", - "start": 34, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 34 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":34,"end":35,"loc":{"start":{"line":1,"column":34},"end":{"line":1,"column":35}}, "typeParameters": null, "id": { "type": "Identifier", - "start": 34, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 34 - }, - "end": { - "line": 1, - "column": 35 - }, - "identifierName": "T" - }, + "start":34,"end":35,"loc":{"start":{"line":1,"column":34},"end":{"line":1,"column":35},"identifierName":"T"}, "name": "T" } } diff --git a/packages/babel-parser/test/fixtures/flow/internal-slot/declare-class/output.json b/packages/babel-parser/test/fixtures/flow/internal-slot/declare-class/output.json index 40d36101bb17..074c06515cc0 100644 --- a/packages/babel-parser/test/fixtures/flow/internal-slot/declare-class/output.json +++ b/packages/babel-parser/test/fixtures/flow/internal-slot/declare-class/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, "program": { "type": "Program", - "start": 0, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "DeclareClass", - "start": 0, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, "id": { "type": "Identifier", - "start": 14, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - }, - "identifierName": "C" - }, + "start":14,"end":15,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":15},"identifierName":"C"}, "name": "C" }, "typeParameters": null, @@ -66,85 +21,28 @@ "mixins": [], "body": { "type": "ObjectTypeAnnotation", - "start": 16, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":16,"end":30,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":30}}, "callProperties": [], "properties": [], "indexers": [], "internalSlots": [ { "type": "ObjectTypeInternalSlot", - "start": 18, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":18,"end":28,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":28}}, "static": false, "id": { "type": "Identifier", - "start": 20, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 23 - }, - "identifierName": "foo" - }, + "start":20,"end":23,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":23},"identifierName":"foo"}, "name": "foo" }, "method": false, "value": { "type": "GenericTypeAnnotation", - "start": 27, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":27,"end":28,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":28}}, "typeParameters": null, "id": { "type": "Identifier", - "start": 27, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 28 - }, - "identifierName": "T" - }, + "start":27,"end":28,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":28},"identifierName":"T"}, "name": "T" } } diff --git a/packages/babel-parser/test/fixtures/flow/internal-slot/interface-method/output.json b/packages/babel-parser/test/fixtures/flow/internal-slot/interface-method/output.json index 1c91e47a4221..285585f5d6ac 100644 --- a/packages/babel-parser/test/fixtures/flow/internal-slot/interface-method/output.json +++ b/packages/babel-parser/test/fixtures/flow/internal-slot/interface-method/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, "program": { "type": "Program", - "start": 0, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "InterfaceDeclaration", - "start": 0, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, "id": { "type": "Identifier", - "start": 10, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "T" - }, + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11},"identifierName":"T"}, "name": "T" }, "typeParameters": null, @@ -66,103 +21,35 @@ "mixins": [], "body": { "type": "ObjectTypeAnnotation", - "start": 12, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":12,"end":28,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":28}}, "callProperties": [], "properties": [], "indexers": [], "internalSlots": [ { "type": "ObjectTypeInternalSlot", - "start": 14, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":14,"end":26,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":26}}, "static": false, "id": { "type": "Identifier", - "start": 16, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 19 - }, - "identifierName": "foo" - }, + "start":16,"end":19,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":19},"identifierName":"foo"}, "name": "foo" }, "method": true, "optional": false, "value": { "type": "FunctionTypeAnnotation", - "start": 14, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":14,"end":26,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":26}}, "params": [], "rest": null, "typeParameters": null, "returnType": { "type": "GenericTypeAnnotation", - "start": 25, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":25,"end":26,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":26}}, "typeParameters": null, "id": { "type": "Identifier", - "start": 25, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 26 - }, - "identifierName": "X" - }, + "start":25,"end":26,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":26},"identifierName":"X"}, "name": "X" } } diff --git a/packages/babel-parser/test/fixtures/flow/internal-slot/interface/output.json b/packages/babel-parser/test/fixtures/flow/internal-slot/interface/output.json index b2e2b31165a1..9419f28566e8 100644 --- a/packages/babel-parser/test/fixtures/flow/internal-slot/interface/output.json +++ b/packages/babel-parser/test/fixtures/flow/internal-slot/interface/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, "program": { "type": "Program", - "start": 0, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "InterfaceDeclaration", - "start": 0, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, "id": { "type": "Identifier", - "start": 10, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "T" - }, + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11},"identifierName":"T"}, "name": "T" }, "typeParameters": null, @@ -66,85 +21,28 @@ "mixins": [], "body": { "type": "ObjectTypeAnnotation", - "start": 12, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":12,"end":26,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":26}}, "callProperties": [], "properties": [], "indexers": [], "internalSlots": [ { "type": "ObjectTypeInternalSlot", - "start": 14, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":14,"end":24,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":24}}, "static": false, "id": { "type": "Identifier", - "start": 16, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 19 - }, - "identifierName": "foo" - }, + "start":16,"end":19,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":19},"identifierName":"foo"}, "name": "foo" }, "method": false, "value": { "type": "GenericTypeAnnotation", - "start": 23, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":23,"end":24,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":24}}, "typeParameters": null, "id": { "type": "Identifier", - "start": 23, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 24 - }, - "identifierName": "X" - }, + "start":23,"end":24,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":24},"identifierName":"X"}, "name": "X" } } diff --git a/packages/babel-parser/test/fixtures/flow/internal-slot/object-method/output.json b/packages/babel-parser/test/fixtures/flow/internal-slot/object-method/output.json index b42f9eacce91..16491604be46 100644 --- a/packages/babel-parser/test/fixtures/flow/internal-slot/object-method/output.json +++ b/packages/babel-parser/test/fixtures/flow/internal-slot/object-method/output.json @@ -1,165 +1,52 @@ { "type": "File", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, "program": { "type": "Program", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "TypeAlias", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, "id": { "type": "Identifier", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "T" - }, + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"T"}, "name": "T" }, "typeParameters": null, "right": { "type": "ObjectTypeAnnotation", - "start": 9, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":9,"end":25,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":25}}, "callProperties": [], "properties": [], "indexers": [], "internalSlots": [ { "type": "ObjectTypeInternalSlot", - "start": 11, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":11,"end":23,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":23}}, "static": false, "id": { "type": "Identifier", - "start": 13, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 16 - }, - "identifierName": "foo" - }, + "start":13,"end":16,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":16},"identifierName":"foo"}, "name": "foo" }, "method": true, "optional": false, "value": { "type": "FunctionTypeAnnotation", - "start": 11, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":11,"end":23,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":23}}, "params": [], "rest": null, "typeParameters": null, "returnType": { "type": "GenericTypeAnnotation", - "start": 22, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":22,"end":23,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":23}}, "typeParameters": null, "id": { "type": "Identifier", - "start": 22, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 23 - }, - "identifierName": "X" - }, + "start":22,"end":23,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":23},"identifierName":"X"}, "name": "X" } } diff --git a/packages/babel-parser/test/fixtures/flow/internal-slot/object-optional/output.json b/packages/babel-parser/test/fixtures/flow/internal-slot/object-optional/output.json index 605db54c850a..5e81c4e1102c 100644 --- a/packages/babel-parser/test/fixtures/flow/internal-slot/object-optional/output.json +++ b/packages/babel-parser/test/fixtures/flow/internal-slot/object-optional/output.json @@ -1,148 +1,46 @@ { "type": "File", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "program": { "type": "Program", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "TypeAlias", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "id": { "type": "Identifier", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "T" - }, + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"T"}, "name": "T" }, "typeParameters": null, "right": { "type": "ObjectTypeAnnotation", - "start": 9, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":9,"end":24,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":24}}, "callProperties": [], "properties": [], "indexers": [], "internalSlots": [ { "type": "ObjectTypeInternalSlot", - "start": 11, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":11,"end":22,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":22}}, "static": false, "id": { "type": "Identifier", - "start": 13, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 16 - }, - "identifierName": "foo" - }, + "start":13,"end":16,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":16},"identifierName":"foo"}, "name": "foo" }, "method": false, "optional": true, "value": { "type": "GenericTypeAnnotation", - "start": 21, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":21,"end":22,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":22}}, "typeParameters": null, "id": { "type": "Identifier", - "start": 21, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 22 - }, - "identifierName": "X" - }, + "start":21,"end":22,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":22},"identifierName":"X"}, "name": "X" } } diff --git a/packages/babel-parser/test/fixtures/flow/internal-slot/object/output.json b/packages/babel-parser/test/fixtures/flow/internal-slot/object/output.json index 6ff31113bc57..24c9d1877db6 100644 --- a/packages/babel-parser/test/fixtures/flow/internal-slot/object/output.json +++ b/packages/babel-parser/test/fixtures/flow/internal-slot/object/output.json @@ -1,147 +1,45 @@ { "type": "File", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "program": { "type": "Program", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "TypeAlias", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "id": { "type": "Identifier", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "T" - }, + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"T"}, "name": "T" }, "typeParameters": null, "right": { "type": "ObjectTypeAnnotation", - "start": 9, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":9,"end":23,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":23}}, "callProperties": [], "properties": [], "indexers": [], "internalSlots": [ { "type": "ObjectTypeInternalSlot", - "start": 11, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":11,"end":21,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":21}}, "static": false, "id": { "type": "Identifier", - "start": 13, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 16 - }, - "identifierName": "foo" - }, + "start":13,"end":16,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":16},"identifierName":"foo"}, "name": "foo" }, "method": false, "value": { "type": "GenericTypeAnnotation", - "start": 20, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":20,"end":21,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":21}}, "typeParameters": null, "id": { "type": "Identifier", - "start": 20, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 21 - }, - "identifierName": "X" - }, + "start":20,"end":21,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":21},"identifierName":"X"}, "name": "X" } } diff --git a/packages/babel-parser/test/fixtures/flow/iterator/01/output.json b/packages/babel-parser/test/fixtures/flow/iterator/01/output.json index 60270d94f89f..9cf79269df16 100644 --- a/packages/babel-parser/test/fixtures/flow/iterator/01/output.json +++ b/packages/babel-parser/test/fixtures/flow/iterator/01/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 51, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":51,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 51, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":51,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "DeclareClass", - "start": 0, - "end": 51, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":51,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "id": { "type": "Identifier", - "start": 14, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - }, - "identifierName": "A" - }, + "start":14,"end":15,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":15},"identifierName":"A"}, "name": "A" }, "typeParameters": null, @@ -66,49 +21,15 @@ "mixins": [], "body": { "type": "ObjectTypeAnnotation", - "start": 16, - "end": 51, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":16,"end":51,"loc":{"start":{"line":1,"column":16},"end":{"line":3,"column":1}}, "callProperties": [], "properties": [ { "type": "ObjectTypeProperty", - "start": 20, - "end": 48, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 30 - } - }, + "start":20,"end":48,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":30}}, "key": { "type": "Identifier", - "start": 20, - "end": 30, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 12 - }, - "identifierName": "@@iterator" - }, + "start":20,"end":30,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":12},"identifierName":"@@iterator"}, "name": "@@iterator" }, "static": false, @@ -117,80 +38,24 @@ "method": true, "value": { "type": "FunctionTypeAnnotation", - "start": 20, - "end": 48, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 30 - } - }, + "start":20,"end":48,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":30}}, "params": [], "rest": null, "typeParameters": null, "returnType": { "type": "GenericTypeAnnotation", - "start": 34, - "end": 48, - "loc": { - "start": { - "line": 2, - "column": 16 - }, - "end": { - "line": 2, - "column": 30 - } - }, + "start":34,"end":48,"loc":{"start":{"line":2,"column":16},"end":{"line":2,"column":30}}, "typeParameters": { "type": "TypeParameterInstantiation", - "start": 42, - "end": 48, - "loc": { - "start": { - "line": 2, - "column": 24 - }, - "end": { - "line": 2, - "column": 30 - } - }, + "start":42,"end":48,"loc":{"start":{"line":2,"column":24},"end":{"line":2,"column":30}}, "params": [ { "type": "GenericTypeAnnotation", - "start": 43, - "end": 47, - "loc": { - "start": { - "line": 2, - "column": 25 - }, - "end": { - "line": 2, - "column": 29 - } - }, + "start":43,"end":47,"loc":{"start":{"line":2,"column":25},"end":{"line":2,"column":29}}, "typeParameters": null, "id": { "type": "Identifier", - "start": 43, - "end": 47, - "loc": { - "start": { - "line": 2, - "column": 25 - }, - "end": { - "line": 2, - "column": 29 - }, - "identifierName": "File" - }, + "start":43,"end":47,"loc":{"start":{"line":2,"column":25},"end":{"line":2,"column":29},"identifierName":"File"}, "name": "File" } } @@ -198,19 +63,7 @@ }, "id": { "type": "Identifier", - "start": 34, - "end": 42, - "loc": { - "start": { - "line": 2, - "column": 16 - }, - "end": { - "line": 2, - "column": 24 - }, - "identifierName": "Iterator" - }, + "start":34,"end":42,"loc":{"start":{"line":2,"column":16},"end":{"line":2,"column":24},"identifierName":"Iterator"}, "name": "Iterator" } } diff --git a/packages/babel-parser/test/fixtures/flow/iterator/02/output.json b/packages/babel-parser/test/fixtures/flow/iterator/02/output.json index b2c7bca4a7c4..91a02b2c7369 100644 --- a/packages/babel-parser/test/fixtures/flow/iterator/02/output.json +++ b/packages/babel-parser/test/fixtures/flow/iterator/02/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 56, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":56,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 56, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":56,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "DeclareClass", - "start": 0, - "end": 56, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":56,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "id": { "type": "Identifier", - "start": 14, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - }, - "identifierName": "A" - }, + "start":14,"end":15,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":15},"identifierName":"A"}, "name": "A" }, "typeParameters": null, @@ -66,49 +21,15 @@ "mixins": [], "body": { "type": "ObjectTypeAnnotation", - "start": 16, - "end": 56, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":16,"end":56,"loc":{"start":{"line":1,"column":16},"end":{"line":3,"column":1}}, "callProperties": [], "properties": [ { "type": "ObjectTypeProperty", - "start": 20, - "end": 53, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 35 - } - }, + "start":20,"end":53,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":35}}, "key": { "type": "Identifier", - "start": 20, - "end": 35, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 17 - }, - "identifierName": "@@asyncIterator" - }, + "start":20,"end":35,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":17},"identifierName":"@@asyncIterator"}, "name": "@@asyncIterator" }, "static": false, @@ -117,80 +38,24 @@ "method": true, "value": { "type": "FunctionTypeAnnotation", - "start": 20, - "end": 53, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 35 - } - }, + "start":20,"end":53,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":35}}, "params": [], "rest": null, "typeParameters": null, "returnType": { "type": "GenericTypeAnnotation", - "start": 39, - "end": 53, - "loc": { - "start": { - "line": 2, - "column": 21 - }, - "end": { - "line": 2, - "column": 35 - } - }, + "start":39,"end":53,"loc":{"start":{"line":2,"column":21},"end":{"line":2,"column":35}}, "typeParameters": { "type": "TypeParameterInstantiation", - "start": 47, - "end": 53, - "loc": { - "start": { - "line": 2, - "column": 29 - }, - "end": { - "line": 2, - "column": 35 - } - }, + "start":47,"end":53,"loc":{"start":{"line":2,"column":29},"end":{"line":2,"column":35}}, "params": [ { "type": "GenericTypeAnnotation", - "start": 48, - "end": 52, - "loc": { - "start": { - "line": 2, - "column": 30 - }, - "end": { - "line": 2, - "column": 34 - } - }, + "start":48,"end":52,"loc":{"start":{"line":2,"column":30},"end":{"line":2,"column":34}}, "typeParameters": null, "id": { "type": "Identifier", - "start": 48, - "end": 52, - "loc": { - "start": { - "line": 2, - "column": 30 - }, - "end": { - "line": 2, - "column": 34 - }, - "identifierName": "File" - }, + "start":48,"end":52,"loc":{"start":{"line":2,"column":30},"end":{"line":2,"column":34},"identifierName":"File"}, "name": "File" } } @@ -198,19 +63,7 @@ }, "id": { "type": "Identifier", - "start": 39, - "end": 47, - "loc": { - "start": { - "line": 2, - "column": 21 - }, - "end": { - "line": 2, - "column": 29 - }, - "identifierName": "Iterator" - }, + "start":39,"end":47,"loc":{"start":{"line":2,"column":21},"end":{"line":2,"column":29},"identifierName":"Iterator"}, "name": "Iterator" } } diff --git a/packages/babel-parser/test/fixtures/flow/iterator/03/options.json b/packages/babel-parser/test/fixtures/flow/iterator/03/options.json deleted file mode 100644 index 7bad2fe143ae..000000000000 --- a/packages/babel-parser/test/fixtures/flow/iterator/03/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid identifier @@asyncIterator (1:19)" -} diff --git a/packages/babel-parser/test/fixtures/flow/iterator/03/output.json b/packages/babel-parser/test/fixtures/flow/iterator/03/output.json new file mode 100644 index 000000000000..e056c32eb0a4 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/iterator/03/output.json @@ -0,0 +1,33 @@ +{ + "type": "File", + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, + "errors": [ + "SyntaxError: Invalid identifier @@asyncIterator (1:19)" + ], + "program": { + "type": "Program", + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":4,"end":19,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":19}}, + "id": { + "type": "Identifier", + "start":4,"end":19,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":19},"identifierName":"@@asyncIterator"}, + "name": "@@asyncIterator" + }, + "init": null + } + ], + "kind": "var" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/iterator/04/options.json b/packages/babel-parser/test/fixtures/flow/iterator/04/options.json deleted file mode 100644 index ae3871cf99a0..000000000000 --- a/packages/babel-parser/test/fixtures/flow/iterator/04/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid identifier @@iterator (1:14)" -} diff --git a/packages/babel-parser/test/fixtures/flow/iterator/04/output.json b/packages/babel-parser/test/fixtures/flow/iterator/04/output.json new file mode 100644 index 000000000000..106b8002e3e1 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/iterator/04/output.json @@ -0,0 +1,33 @@ +{ + "type": "File", + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, + "errors": [ + "SyntaxError: Invalid identifier @@iterator (1:14)" + ], + "program": { + "type": "Program", + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":4,"end":14,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":14}}, + "id": { + "type": "Identifier", + "start":4,"end":14,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":14},"identifierName":"@@iterator"}, + "name": "@@iterator" + }, + "init": null + } + ], + "kind": "var" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/iterator/05/options.json b/packages/babel-parser/test/fixtures/flow/iterator/05/options.json deleted file mode 100644 index 9d235ec74a06..000000000000 --- a/packages/babel-parser/test/fixtures/flow/iterator/05/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid identifier @@asyncIterator (2:17)" -} diff --git a/packages/babel-parser/test/fixtures/flow/iterator/05/output.json b/packages/babel-parser/test/fixtures/flow/iterator/05/output.json new file mode 100644 index 000000000000..ca6b8b096ca9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/iterator/05/output.json @@ -0,0 +1,54 @@ +{ + "type": "File", + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "errors": [ + "SyntaxError: Invalid identifier @@asyncIterator (2:17)" + ], + "program": { + "type": "Program", + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "id": { + "type": "Identifier", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"T"}, + "name": "T" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":8,"end":33,"loc":{"start":{"line":1,"column":8},"end":{"line":3,"column":1}}, + "body": [ + { + "type": "ClassMethod", + "start":12,"end":31,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":21}}, + "static": false, + "key": { + "type": "Identifier", + "start":12,"end":27,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":17},"identifierName":"@@asyncIterator"}, + "name": "@@asyncIterator" + }, + "computed": false, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":29,"end":31,"loc":{"start":{"line":2,"column":19},"end":{"line":2,"column":21}}, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/iterator/06/options.json b/packages/babel-parser/test/fixtures/flow/iterator/06/options.json deleted file mode 100644 index 515a2cba19f8..000000000000 --- a/packages/babel-parser/test/fixtures/flow/iterator/06/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid identifier @@iterator (2:12)" -} diff --git a/packages/babel-parser/test/fixtures/flow/iterator/06/output.json b/packages/babel-parser/test/fixtures/flow/iterator/06/output.json new file mode 100644 index 000000000000..fad3d4597882 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/iterator/06/output.json @@ -0,0 +1,54 @@ +{ + "type": "File", + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "errors": [ + "SyntaxError: Invalid identifier @@iterator (2:12)" + ], + "program": { + "type": "Program", + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "id": { + "type": "Identifier", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"T"}, + "name": "T" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":8,"end":28,"loc":{"start":{"line":1,"column":8},"end":{"line":3,"column":1}}, + "body": [ + { + "type": "ClassMethod", + "start":12,"end":26,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":16}}, + "static": false, + "key": { + "type": "Identifier", + "start":12,"end":22,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":12},"identifierName":"@@iterator"}, + "name": "@@iterator" + }, + "computed": false, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":24,"end":26,"loc":{"start":{"line":2,"column":14},"end":{"line":2,"column":16}}, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/iterator/07/options.json b/packages/babel-parser/test/fixtures/flow/iterator/07/options.json deleted file mode 100644 index 4c1f323d1622..000000000000 --- a/packages/babel-parser/test/fixtures/flow/iterator/07/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid identifier @@iterator (1:15)" -} diff --git a/packages/babel-parser/test/fixtures/flow/iterator/07/output.json b/packages/babel-parser/test/fixtures/flow/iterator/07/output.json new file mode 100644 index 000000000000..265adf68c112 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/iterator/07/output.json @@ -0,0 +1,30 @@ +{ + "type": "File", + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, + "errors": [ + "SyntaxError: Invalid identifier @@iterator (1:15)" + ], + "program": { + "type": "Program", + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "TypeAlias", + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, + "id": { + "type": "Identifier", + "start":5,"end":15,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":15},"identifierName":"@@iterator"}, + "name": "@@iterator" + }, + "typeParameters": null, + "right": { + "type": "NumberTypeAnnotation", + "start":18,"end":24,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":24}} + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/iterator/08/options.json b/packages/babel-parser/test/fixtures/flow/iterator/08/options.json deleted file mode 100644 index 3efa2ffcd0a1..000000000000 --- a/packages/babel-parser/test/fixtures/flow/iterator/08/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid identifier @@asyncIterator (1:20)" -} diff --git a/packages/babel-parser/test/fixtures/flow/iterator/08/output.json b/packages/babel-parser/test/fixtures/flow/iterator/08/output.json new file mode 100644 index 000000000000..278c95feaf01 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/iterator/08/output.json @@ -0,0 +1,30 @@ +{ + "type": "File", + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, + "errors": [ + "SyntaxError: Invalid identifier @@asyncIterator (1:20)" + ], + "program": { + "type": "Program", + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "TypeAlias", + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, + "id": { + "type": "Identifier", + "start":5,"end":20,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":20},"identifierName":"@@asyncIterator"}, + "name": "@@asyncIterator" + }, + "typeParameters": null, + "right": { + "type": "NumberTypeAnnotation", + "start":23,"end":29,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":29}} + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/iterator/09/options.json b/packages/babel-parser/test/fixtures/flow/iterator/09/options.json deleted file mode 100644 index 515a2cba19f8..000000000000 --- a/packages/babel-parser/test/fixtures/flow/iterator/09/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid identifier @@iterator (2:12)" -} diff --git a/packages/babel-parser/test/fixtures/flow/iterator/09/output.json b/packages/babel-parser/test/fixtures/flow/iterator/09/output.json new file mode 100644 index 000000000000..07177225478a --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/iterator/09/output.json @@ -0,0 +1,60 @@ +{ + "type": "File", + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "errors": [ + "SyntaxError: Invalid identifier @@iterator (2:12)" + ], + "program": { + "type": "Program", + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":4,"end":29,"loc":{"start":{"line":1,"column":4},"end":{"line":3,"column":1}}, + "id": { + "type": "Identifier", + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"x"}, + "name": "x" + }, + "init": { + "type": "ObjectExpression", + "start":8,"end":29,"loc":{"start":{"line":1,"column":8},"end":{"line":3,"column":1}}, + "properties": [ + { + "type": "ObjectMethod", + "start":12,"end":27,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":17}}, + "method": true, + "key": { + "type": "Identifier", + "start":12,"end":22,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":12},"identifierName":"@@iterator"}, + "name": "@@iterator" + }, + "computed": false, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":25,"end":27,"loc":{"start":{"line":2,"column":15},"end":{"line":2,"column":17}}, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "kind": "let" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/iterator/10/options.json b/packages/babel-parser/test/fixtures/flow/iterator/10/options.json deleted file mode 100644 index 9d235ec74a06..000000000000 --- a/packages/babel-parser/test/fixtures/flow/iterator/10/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid identifier @@asyncIterator (2:17)" -} diff --git a/packages/babel-parser/test/fixtures/flow/iterator/10/output.json b/packages/babel-parser/test/fixtures/flow/iterator/10/output.json new file mode 100644 index 000000000000..836c3af1af2b --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/iterator/10/output.json @@ -0,0 +1,60 @@ +{ + "type": "File", + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "errors": [ + "SyntaxError: Invalid identifier @@asyncIterator (2:17)" + ], + "program": { + "type": "Program", + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":4,"end":34,"loc":{"start":{"line":1,"column":4},"end":{"line":3,"column":1}}, + "id": { + "type": "Identifier", + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"x"}, + "name": "x" + }, + "init": { + "type": "ObjectExpression", + "start":8,"end":34,"loc":{"start":{"line":1,"column":8},"end":{"line":3,"column":1}}, + "properties": [ + { + "type": "ObjectMethod", + "start":12,"end":32,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":22}}, + "method": true, + "key": { + "type": "Identifier", + "start":12,"end":27,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":17},"identifierName":"@@asyncIterator"}, + "name": "@@asyncIterator" + }, + "computed": false, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":30,"end":32,"loc":{"start":{"line":2,"column":20},"end":{"line":2,"column":22}}, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "kind": "let" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/iterator/11/options.json b/packages/babel-parser/test/fixtures/flow/iterator/11/options.json deleted file mode 100644 index 248b8a4d9d0a..000000000000 --- a/packages/babel-parser/test/fixtures/flow/iterator/11/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid identifier @@random (2:10)" -} diff --git a/packages/babel-parser/test/fixtures/flow/iterator/11/output.json b/packages/babel-parser/test/fixtures/flow/iterator/11/output.json new file mode 100644 index 000000000000..a97fb3437b0c --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/iterator/11/output.json @@ -0,0 +1,60 @@ +{ + "type": "File", + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "errors": [ + "SyntaxError: Invalid identifier @@random (2:10)" + ], + "program": { + "type": "Program", + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":4,"end":27,"loc":{"start":{"line":1,"column":4},"end":{"line":3,"column":1}}, + "id": { + "type": "Identifier", + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"x"}, + "name": "x" + }, + "init": { + "type": "ObjectExpression", + "start":8,"end":27,"loc":{"start":{"line":1,"column":8},"end":{"line":3,"column":1}}, + "properties": [ + { + "type": "ObjectMethod", + "start":12,"end":25,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":15}}, + "method": true, + "key": { + "type": "Identifier", + "start":12,"end":20,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":10},"identifierName":"@@random"}, + "name": "@@random" + }, + "computed": false, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":23,"end":25,"loc":{"start":{"line":2,"column":13},"end":{"line":2,"column":15}}, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "kind": "let" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/iterator/12/output.json b/packages/babel-parser/test/fixtures/flow/iterator/12/output.json index 865bb503288f..c8866d697474 100644 --- a/packages/babel-parser/test/fixtures/flow/iterator/12/output.json +++ b/packages/babel-parser/test/fixtures/flow/iterator/12/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 67, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":67,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 67, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":67,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 67, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":67,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "id": { "type": "Identifier", - "start": 9, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "foo" - }, + "start":9,"end":12,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":12},"identifierName":"foo"}, "name": "foo" }, "generator": false, @@ -66,63 +21,18 @@ "predicate": null, "returnType": { "type": "TypeAnnotation", - "start": 14, - "end": 44, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 44 - } - }, + "start":14,"end":44,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":44}}, "typeAnnotation": { "type": "ObjectTypeAnnotation", - "start": 16, - "end": 44, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 44 - } - }, + "start":16,"end":44,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":44}}, "callProperties": [], "properties": [ { "type": "ObjectTypeProperty", - "start": 18, - "end": 42, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 42 - } - }, + "start":18,"end":42,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":42}}, "key": { "type": "Identifier", - "start": 18, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 28 - }, - "identifierName": "@@iterator" - }, + "start":18,"end":28,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":28},"identifierName":"@@iterator"}, "name": "@@iterator" }, "static": false, @@ -131,34 +41,12 @@ "method": false, "value": { "type": "FunctionTypeAnnotation", - "start": 30, - "end": 42, - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 1, - "column": 42 - } - }, + "start":30,"end":42,"loc":{"start":{"line":1,"column":30},"end":{"line":1,"column":42}}, "params": [], "rest": null, "returnType": { "type": "StringTypeAnnotation", - "start": 36, - "end": 42, - "loc": { - "start": { - "line": 1, - "column": 36 - }, - "end": { - "line": 1, - "column": 42 - } - } + "start":36,"end":42,"loc":{"start":{"line":1,"column":36},"end":{"line":1,"column":42}} }, "typeParameters": null }, @@ -174,61 +62,17 @@ }, "body": { "type": "BlockStatement", - "start": 45, - "end": 67, - "loc": { - "start": { - "line": 1, - "column": 45 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":45,"end":67,"loc":{"start":{"line":1,"column":45},"end":{"line":3,"column":1}}, "body": [ { "type": "ReturnStatement", - "start": 49, - "end": 65, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 18 - } - }, + "start":49,"end":65,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":18}}, "argument": { "type": "TypeCastExpression", - "start": 57, - "end": 63, - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 16 - } - }, + "start":57,"end":63,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":16}}, "expression": { "type": "NumericLiteral", - "start": 57, - "end": 58, - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 11 - } - }, + "start":57,"end":58,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":11}}, "extra": { "rawValue": 0, "raw": "0" @@ -237,32 +81,10 @@ }, "typeAnnotation": { "type": "TypeAnnotation", - "start": 58, - "end": 63, - "loc": { - "start": { - "line": 2, - "column": 11 - }, - "end": { - "line": 2, - "column": 16 - } - }, + "start":58,"end":63,"loc":{"start":{"line":2,"column":11},"end":{"line":2,"column":16}}, "typeAnnotation": { "type": "AnyTypeAnnotation", - "start": 60, - "end": 63, - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 16 - } - } + "start":60,"end":63,"loc":{"start":{"line":2,"column":13},"end":{"line":2,"column":16}} } }, "extra": { diff --git a/packages/babel-parser/test/fixtures/flow/iterator/13/output.json b/packages/babel-parser/test/fixtures/flow/iterator/13/output.json index a21fcad31e10..3d995d3398b7 100644 --- a/packages/babel-parser/test/fixtures/flow/iterator/13/output.json +++ b/packages/babel-parser/test/fixtures/flow/iterator/13/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 72, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":72,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 72, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":72,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 72, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":72,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "id": { "type": "Identifier", - "start": 9, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "foo" - }, + "start":9,"end":12,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":12},"identifierName":"foo"}, "name": "foo" }, "generator": false, @@ -66,63 +21,18 @@ "predicate": null, "returnType": { "type": "TypeAnnotation", - "start": 14, - "end": 49, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 49 - } - }, + "start":14,"end":49,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":49}}, "typeAnnotation": { "type": "ObjectTypeAnnotation", - "start": 16, - "end": 49, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 49 - } - }, + "start":16,"end":49,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":49}}, "callProperties": [], "properties": [ { "type": "ObjectTypeProperty", - "start": 18, - "end": 47, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 47 - } - }, + "start":18,"end":47,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":47}}, "key": { "type": "Identifier", - "start": 18, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 33 - }, - "identifierName": "@@asyncIterator" - }, + "start":18,"end":33,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":33},"identifierName":"@@asyncIterator"}, "name": "@@asyncIterator" }, "static": false, @@ -131,34 +41,12 @@ "method": false, "value": { "type": "FunctionTypeAnnotation", - "start": 35, - "end": 47, - "loc": { - "start": { - "line": 1, - "column": 35 - }, - "end": { - "line": 1, - "column": 47 - } - }, + "start":35,"end":47,"loc":{"start":{"line":1,"column":35},"end":{"line":1,"column":47}}, "params": [], "rest": null, "returnType": { "type": "StringTypeAnnotation", - "start": 41, - "end": 47, - "loc": { - "start": { - "line": 1, - "column": 41 - }, - "end": { - "line": 1, - "column": 47 - } - } + "start":41,"end":47,"loc":{"start":{"line":1,"column":41},"end":{"line":1,"column":47}} }, "typeParameters": null }, @@ -174,61 +62,17 @@ }, "body": { "type": "BlockStatement", - "start": 50, - "end": 72, - "loc": { - "start": { - "line": 1, - "column": 50 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":50,"end":72,"loc":{"start":{"line":1,"column":50},"end":{"line":3,"column":1}}, "body": [ { "type": "ReturnStatement", - "start": 54, - "end": 70, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 18 - } - }, + "start":54,"end":70,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":18}}, "argument": { "type": "TypeCastExpression", - "start": 62, - "end": 68, - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 16 - } - }, + "start":62,"end":68,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":16}}, "expression": { "type": "NumericLiteral", - "start": 62, - "end": 63, - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 11 - } - }, + "start":62,"end":63,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":11}}, "extra": { "rawValue": 0, "raw": "0" @@ -237,32 +81,10 @@ }, "typeAnnotation": { "type": "TypeAnnotation", - "start": 63, - "end": 68, - "loc": { - "start": { - "line": 2, - "column": 11 - }, - "end": { - "line": 2, - "column": 16 - } - }, + "start":63,"end":68,"loc":{"start":{"line":2,"column":11},"end":{"line":2,"column":16}}, "typeAnnotation": { "type": "AnyTypeAnnotation", - "start": 65, - "end": 68, - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 16 - } - } + "start":65,"end":68,"loc":{"start":{"line":2,"column":13},"end":{"line":2,"column":16}} } }, "extra": { diff --git a/packages/babel-parser/test/fixtures/flow/iterator/14/output.json b/packages/babel-parser/test/fixtures/flow/iterator/14/output.json index 399c914de976..3e8644cc75b6 100644 --- a/packages/babel-parser/test/fixtures/flow/iterator/14/output.json +++ b/packages/babel-parser/test/fixtures/flow/iterator/14/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 47, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":47,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 47, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":47,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "InterfaceDeclaration", - "start": 0, - "end": 47, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":47,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "id": { "type": "Identifier", - "start": 10, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "A" - }, + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11},"identifierName":"A"}, "name": "A" }, "typeParameters": null, @@ -66,49 +21,15 @@ "mixins": [], "body": { "type": "ObjectTypeAnnotation", - "start": 12, - "end": 47, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":12,"end":47,"loc":{"start":{"line":1,"column":12},"end":{"line":3,"column":1}}, "callProperties": [], "properties": [ { "type": "ObjectTypeProperty", - "start": 16, - "end": 44, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 30 - } - }, + "start":16,"end":44,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":30}}, "key": { "type": "Identifier", - "start": 16, - "end": 26, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 12 - }, - "identifierName": "@@iterator" - }, + "start":16,"end":26,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":12},"identifierName":"@@iterator"}, "name": "@@iterator" }, "static": false, @@ -117,80 +38,24 @@ "method": true, "value": { "type": "FunctionTypeAnnotation", - "start": 16, - "end": 44, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 30 - } - }, + "start":16,"end":44,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":30}}, "params": [], "rest": null, "typeParameters": null, "returnType": { "type": "GenericTypeAnnotation", - "start": 30, - "end": 44, - "loc": { - "start": { - "line": 2, - "column": 16 - }, - "end": { - "line": 2, - "column": 30 - } - }, + "start":30,"end":44,"loc":{"start":{"line":2,"column":16},"end":{"line":2,"column":30}}, "typeParameters": { "type": "TypeParameterInstantiation", - "start": 38, - "end": 44, - "loc": { - "start": { - "line": 2, - "column": 24 - }, - "end": { - "line": 2, - "column": 30 - } - }, + "start":38,"end":44,"loc":{"start":{"line":2,"column":24},"end":{"line":2,"column":30}}, "params": [ { "type": "GenericTypeAnnotation", - "start": 39, - "end": 43, - "loc": { - "start": { - "line": 2, - "column": 25 - }, - "end": { - "line": 2, - "column": 29 - } - }, + "start":39,"end":43,"loc":{"start":{"line":2,"column":25},"end":{"line":2,"column":29}}, "typeParameters": null, "id": { "type": "Identifier", - "start": 39, - "end": 43, - "loc": { - "start": { - "line": 2, - "column": 25 - }, - "end": { - "line": 2, - "column": 29 - }, - "identifierName": "File" - }, + "start":39,"end":43,"loc":{"start":{"line":2,"column":25},"end":{"line":2,"column":29},"identifierName":"File"}, "name": "File" } } @@ -198,19 +63,7 @@ }, "id": { "type": "Identifier", - "start": 30, - "end": 38, - "loc": { - "start": { - "line": 2, - "column": 16 - }, - "end": { - "line": 2, - "column": 24 - }, - "identifierName": "Iterator" - }, + "start":30,"end":38,"loc":{"start":{"line":2,"column":16},"end":{"line":2,"column":24},"identifierName":"Iterator"}, "name": "Iterator" } } diff --git a/packages/babel-parser/test/fixtures/flow/iterator/15/output.json b/packages/babel-parser/test/fixtures/flow/iterator/15/output.json index 8c08078cbf02..d88ede13e992 100644 --- a/packages/babel-parser/test/fixtures/flow/iterator/15/output.json +++ b/packages/babel-parser/test/fixtures/flow/iterator/15/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 52, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":52,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 52, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":52,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "InterfaceDeclaration", - "start": 0, - "end": 52, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":52,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "id": { "type": "Identifier", - "start": 10, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "A" - }, + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11},"identifierName":"A"}, "name": "A" }, "typeParameters": null, @@ -66,49 +21,15 @@ "mixins": [], "body": { "type": "ObjectTypeAnnotation", - "start": 12, - "end": 52, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":12,"end":52,"loc":{"start":{"line":1,"column":12},"end":{"line":3,"column":1}}, "callProperties": [], "properties": [ { "type": "ObjectTypeProperty", - "start": 16, - "end": 49, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 35 - } - }, + "start":16,"end":49,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":35}}, "key": { "type": "Identifier", - "start": 16, - "end": 31, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 17 - }, - "identifierName": "@@asyncIterator" - }, + "start":16,"end":31,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":17},"identifierName":"@@asyncIterator"}, "name": "@@asyncIterator" }, "static": false, @@ -117,80 +38,24 @@ "method": true, "value": { "type": "FunctionTypeAnnotation", - "start": 16, - "end": 49, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 35 - } - }, + "start":16,"end":49,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":35}}, "params": [], "rest": null, "typeParameters": null, "returnType": { "type": "GenericTypeAnnotation", - "start": 35, - "end": 49, - "loc": { - "start": { - "line": 2, - "column": 21 - }, - "end": { - "line": 2, - "column": 35 - } - }, + "start":35,"end":49,"loc":{"start":{"line":2,"column":21},"end":{"line":2,"column":35}}, "typeParameters": { "type": "TypeParameterInstantiation", - "start": 43, - "end": 49, - "loc": { - "start": { - "line": 2, - "column": 29 - }, - "end": { - "line": 2, - "column": 35 - } - }, + "start":43,"end":49,"loc":{"start":{"line":2,"column":29},"end":{"line":2,"column":35}}, "params": [ { "type": "GenericTypeAnnotation", - "start": 44, - "end": 48, - "loc": { - "start": { - "line": 2, - "column": 30 - }, - "end": { - "line": 2, - "column": 34 - } - }, + "start":44,"end":48,"loc":{"start":{"line":2,"column":30},"end":{"line":2,"column":34}}, "typeParameters": null, "id": { "type": "Identifier", - "start": 44, - "end": 48, - "loc": { - "start": { - "line": 2, - "column": 30 - }, - "end": { - "line": 2, - "column": 34 - }, - "identifierName": "File" - }, + "start":44,"end":48,"loc":{"start":{"line":2,"column":30},"end":{"line":2,"column":34},"identifierName":"File"}, "name": "File" } } @@ -198,19 +63,7 @@ }, "id": { "type": "Identifier", - "start": 35, - "end": 43, - "loc": { - "start": { - "line": 2, - "column": 21 - }, - "end": { - "line": 2, - "column": 29 - }, - "identifierName": "Iterator" - }, + "start":35,"end":43,"loc":{"start":{"line":2,"column":21},"end":{"line":2,"column":29},"identifierName":"Iterator"}, "name": "Iterator" } } diff --git a/packages/babel-parser/test/fixtures/flow/literal-types/boolean-false/output.json b/packages/babel-parser/test/fixtures/flow/literal-types/boolean-false/output.json index 9972b5f4e9a3..8fc6841593ad 100644 --- a/packages/babel-parser/test/fixtures/flow/literal-types/boolean-false/output.json +++ b/packages/babel-parser/test/fixtures/flow/literal-types/boolean-false/output.json @@ -1,107 +1,29 @@ { "type": "File", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "program": { "type": "Program", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":4,"end":13,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":13}}, "id": { "type": "Identifier", - "start": 4, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 13 - }, - "identifierName": "foo" - }, + "start":4,"end":13,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":13},"identifierName":"foo"}, "name": "foo", "typeAnnotation": { "type": "TypeAnnotation", - "start": 7, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":7,"end":13,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":13}}, "typeAnnotation": { "type": "BooleanLiteralTypeAnnotation", - "start": 9, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":9,"end":13,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":13}}, "value": true } } diff --git a/packages/babel-parser/test/fixtures/flow/literal-types/boolean-true/output.json b/packages/babel-parser/test/fixtures/flow/literal-types/boolean-true/output.json index c3b9f6ab6530..d3dd80a28b66 100644 --- a/packages/babel-parser/test/fixtures/flow/literal-types/boolean-true/output.json +++ b/packages/babel-parser/test/fixtures/flow/literal-types/boolean-true/output.json @@ -1,107 +1,29 @@ { "type": "File", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "program": { "type": "Program", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":4,"end":14,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":14}}, "id": { "type": "Identifier", - "start": 4, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 14 - }, - "identifierName": "foo" - }, + "start":4,"end":14,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":14},"identifierName":"foo"}, "name": "foo", "typeAnnotation": { "type": "TypeAnnotation", - "start": 7, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":7,"end":14,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":14}}, "typeAnnotation": { "type": "BooleanLiteralTypeAnnotation", - "start": 9, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":9,"end":14,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":14}}, "value": false } } diff --git a/packages/babel-parser/test/fixtures/flow/literal-types/null/output.json b/packages/babel-parser/test/fixtures/flow/literal-types/null/output.json index 18c3177d98e4..7b1f26870f4f 100644 --- a/packages/babel-parser/test/fixtures/flow/literal-types/null/output.json +++ b/packages/babel-parser/test/fixtures/flow/literal-types/null/output.json @@ -1,107 +1,29 @@ { "type": "File", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "program": { "type": "Program", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":4,"end":13,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":13}}, "id": { "type": "Identifier", - "start": 4, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 13 - }, - "identifierName": "foo" - }, + "start":4,"end":13,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":13},"identifierName":"foo"}, "name": "foo", "typeAnnotation": { "type": "TypeAnnotation", - "start": 7, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":7,"end":13,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":13}}, "typeAnnotation": { "type": "NullLiteralTypeAnnotation", - "start": 9, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 13 - } - } + "start":9,"end":13,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":13}} } } }, diff --git a/packages/babel-parser/test/fixtures/flow/literal-types/number-binary/output.json b/packages/babel-parser/test/fixtures/flow/literal-types/number-binary/output.json index 54d5951f2c2f..0952751d261b 100644 --- a/packages/babel-parser/test/fixtures/flow/literal-types/number-binary/output.json +++ b/packages/babel-parser/test/fixtures/flow/literal-types/number-binary/output.json @@ -1,107 +1,29 @@ { "type": "File", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "program": { "type": "Program", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":4,"end":16,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":16}}, "id": { "type": "Identifier", - "start": 4, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 16 - }, - "identifierName": "a" - }, + "start":4,"end":16,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":16},"identifierName":"a"}, "name": "a", "typeAnnotation": { "type": "TypeAnnotation", - "start": 5, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":5,"end":16,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":16}}, "typeAnnotation": { "type": "NumberLiteralTypeAnnotation", - "start": 7, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":7,"end":16,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":16}}, "extra": { "rawValue": 123, "raw": "0b1111011" diff --git a/packages/babel-parser/test/fixtures/flow/literal-types/number-float/output.json b/packages/babel-parser/test/fixtures/flow/literal-types/number-float/output.json index 90d8c8d415b9..fcca496a2edd 100644 --- a/packages/babel-parser/test/fixtures/flow/literal-types/number-float/output.json +++ b/packages/babel-parser/test/fixtures/flow/literal-types/number-float/output.json @@ -1,107 +1,29 @@ { "type": "File", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, "program": { "type": "Program", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":4,"end":12,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":12}}, "id": { "type": "Identifier", - "start": 4, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "a" - }, + "start":4,"end":12,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":12},"identifierName":"a"}, "name": "a", "typeAnnotation": { "type": "TypeAnnotation", - "start": 5, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":5,"end":12,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":12}}, "typeAnnotation": { "type": "NumberLiteralTypeAnnotation", - "start": 7, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":7,"end":12,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":12}}, "extra": { "rawValue": 123, "raw": "123.0" diff --git a/packages/babel-parser/test/fixtures/flow/literal-types/number-integer/output.json b/packages/babel-parser/test/fixtures/flow/literal-types/number-integer/output.json index bec74d7a65dd..61a2ae35c0a4 100644 --- a/packages/babel-parser/test/fixtures/flow/literal-types/number-integer/output.json +++ b/packages/babel-parser/test/fixtures/flow/literal-types/number-integer/output.json @@ -1,107 +1,29 @@ { "type": "File", - "start": 0, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, "program": { "type": "Program", - "start": 0, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":4,"end":10,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":10}}, "id": { "type": "Identifier", - "start": 4, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 10 - }, - "identifierName": "a" - }, + "start":4,"end":10,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":10},"identifierName":"a"}, "name": "a", "typeAnnotation": { "type": "TypeAnnotation", - "start": 5, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":5,"end":10,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":10}}, "typeAnnotation": { "type": "NumberLiteralTypeAnnotation", - "start": 7, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":7,"end":10,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":10}}, "extra": { "rawValue": 123, "raw": "123" diff --git a/packages/babel-parser/test/fixtures/flow/literal-types/number-negative-binary/output.json b/packages/babel-parser/test/fixtures/flow/literal-types/number-negative-binary/output.json index dd2d8e797ec3..13e89cebca99 100644 --- a/packages/babel-parser/test/fixtures/flow/literal-types/number-negative-binary/output.json +++ b/packages/babel-parser/test/fixtures/flow/literal-types/number-negative-binary/output.json @@ -1,107 +1,29 @@ { "type": "File", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "program": { "type": "Program", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":4,"end":17,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":17}}, "id": { "type": "Identifier", - "start": 4, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 17 - }, - "identifierName": "a" - }, + "start":4,"end":17,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":17},"identifierName":"a"}, "name": "a", "typeAnnotation": { "type": "TypeAnnotation", - "start": 5, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":5,"end":17,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":17}}, "typeAnnotation": { "type": "NumberLiteralTypeAnnotation", - "start": 7, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":7,"end":17,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":17}}, "extra": { "rawValue": -123, "raw": "-0b1111011" diff --git a/packages/babel-parser/test/fixtures/flow/literal-types/number-negative-float/output.json b/packages/babel-parser/test/fixtures/flow/literal-types/number-negative-float/output.json index c1a0d31863c3..4f9187fff6b0 100644 --- a/packages/babel-parser/test/fixtures/flow/literal-types/number-negative-float/output.json +++ b/packages/babel-parser/test/fixtures/flow/literal-types/number-negative-float/output.json @@ -1,107 +1,29 @@ { "type": "File", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "program": { "type": "Program", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":4,"end":13,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":13}}, "id": { "type": "Identifier", - "start": 4, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 13 - }, - "identifierName": "a" - }, + "start":4,"end":13,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":13},"identifierName":"a"}, "name": "a", "typeAnnotation": { "type": "TypeAnnotation", - "start": 5, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":5,"end":13,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":13}}, "typeAnnotation": { "type": "NumberLiteralTypeAnnotation", - "start": 7, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":7,"end":13,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":13}}, "extra": { "rawValue": -123, "raw": "-123.0" diff --git a/packages/babel-parser/test/fixtures/flow/literal-types/number-negative-octal-2/output.json b/packages/babel-parser/test/fixtures/flow/literal-types/number-negative-octal-2/output.json index 03caa38abef8..407e4d9d5c5b 100644 --- a/packages/babel-parser/test/fixtures/flow/literal-types/number-negative-octal-2/output.json +++ b/packages/babel-parser/test/fixtures/flow/literal-types/number-negative-octal-2/output.json @@ -1,107 +1,29 @@ { "type": "File", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "program": { "type": "Program", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":4,"end":13,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":13}}, "id": { "type": "Identifier", - "start": 4, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 13 - }, - "identifierName": "a" - }, + "start":4,"end":13,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":13},"identifierName":"a"}, "name": "a", "typeAnnotation": { "type": "TypeAnnotation", - "start": 5, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":5,"end":13,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":13}}, "typeAnnotation": { "type": "NumberLiteralTypeAnnotation", - "start": 7, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":7,"end":13,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":13}}, "extra": { "rawValue": -123, "raw": "-0o173" diff --git a/packages/babel-parser/test/fixtures/flow/literal-types/number-negative-octal/output.json b/packages/babel-parser/test/fixtures/flow/literal-types/number-negative-octal/output.json index c6fe67bfcc37..5e08c9a72d7c 100644 --- a/packages/babel-parser/test/fixtures/flow/literal-types/number-negative-octal/output.json +++ b/packages/babel-parser/test/fixtures/flow/literal-types/number-negative-octal/output.json @@ -1,107 +1,29 @@ { "type": "File", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, "program": { "type": "Program", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":4,"end":12,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":12}}, "id": { "type": "Identifier", - "start": 4, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "a" - }, + "start":4,"end":12,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":12},"identifierName":"a"}, "name": "a", "typeAnnotation": { "type": "TypeAnnotation", - "start": 5, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":5,"end":12,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":12}}, "typeAnnotation": { "type": "NumberLiteralTypeAnnotation", - "start": 7, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":7,"end":12,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":12}}, "extra": { "rawValue": -123, "raw": "-0x7B" diff --git a/packages/babel-parser/test/fixtures/flow/literal-types/number-octal-2/output.json b/packages/babel-parser/test/fixtures/flow/literal-types/number-octal-2/output.json index faf2c0521617..9d855b1d14c3 100644 --- a/packages/babel-parser/test/fixtures/flow/literal-types/number-octal-2/output.json +++ b/packages/babel-parser/test/fixtures/flow/literal-types/number-octal-2/output.json @@ -1,107 +1,29 @@ { "type": "File", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, "program": { "type": "Program", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":4,"end":12,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":12}}, "id": { "type": "Identifier", - "start": 4, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "a" - }, + "start":4,"end":12,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":12},"identifierName":"a"}, "name": "a", "typeAnnotation": { "type": "TypeAnnotation", - "start": 5, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":5,"end":12,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":12}}, "typeAnnotation": { "type": "NumberLiteralTypeAnnotation", - "start": 7, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":7,"end":12,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":12}}, "extra": { "rawValue": 123, "raw": "0o173" diff --git a/packages/babel-parser/test/fixtures/flow/literal-types/number-octal/output.json b/packages/babel-parser/test/fixtures/flow/literal-types/number-octal/output.json index 38de36ddd6cd..d9d0b11bc004 100644 --- a/packages/babel-parser/test/fixtures/flow/literal-types/number-octal/output.json +++ b/packages/babel-parser/test/fixtures/flow/literal-types/number-octal/output.json @@ -1,107 +1,29 @@ { "type": "File", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "program": { "type": "Program", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":4,"end":11,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":11}}, "id": { "type": "Identifier", - "start": 4, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "a" - }, + "start":4,"end":11,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":11},"identifierName":"a"}, "name": "a", "typeAnnotation": { "type": "TypeAnnotation", - "start": 5, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":5,"end":11,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":11}}, "typeAnnotation": { "type": "NumberLiteralTypeAnnotation", - "start": 7, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":7,"end":11,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":11}}, "extra": { "rawValue": 123, "raw": "0x7B" diff --git a/packages/babel-parser/test/fixtures/flow/literal-types/string-double/output.json b/packages/babel-parser/test/fixtures/flow/literal-types/string-double/output.json index 645105d39e85..facfb1a52ddd 100644 --- a/packages/babel-parser/test/fixtures/flow/literal-types/string-double/output.json +++ b/packages/babel-parser/test/fixtures/flow/literal-types/string-double/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 57, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 57 - } - }, + "start":0,"end":57,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":57}}, "program": { "type": "Program", - "start": 0, - "end": 57, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 57 - } - }, + "start":0,"end":57,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":57}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 57, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 57 - } - }, + "start":0,"end":57,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":57}}, "id": { "type": "Identifier", - "start": 9, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 22 - }, - "identifierName": "createElement" - }, + "start":9,"end":22,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":22},"identifierName":"createElement"}, "name": "createElement" }, "generator": false, @@ -65,48 +20,14 @@ "params": [ { "type": "Identifier", - "start": 23, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 37 - }, - "identifierName": "tagName" - }, + "start":23,"end":37,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":37},"identifierName":"tagName"}, "name": "tagName", "typeAnnotation": { "type": "TypeAnnotation", - "start": 30, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 1, - "column": 37 - } - }, + "start":30,"end":37,"loc":{"start":{"line":1,"column":30},"end":{"line":1,"column":37}}, "typeAnnotation": { "type": "StringLiteralTypeAnnotation", - "start": 32, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 32 - }, - "end": { - "line": 1, - "column": 37 - } - }, + "start":32,"end":37,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":37}}, "extra": { "rawValue": "div", "raw": "\"div\"" @@ -119,66 +40,21 @@ "predicate": null, "returnType": { "type": "TypeAnnotation", - "start": 38, - "end": 54, - "loc": { - "start": { - "line": 1, - "column": 38 - }, - "end": { - "line": 1, - "column": 54 - } - }, + "start":38,"end":54,"loc":{"start":{"line":1,"column":38},"end":{"line":1,"column":54}}, "typeAnnotation": { "type": "GenericTypeAnnotation", - "start": 40, - "end": 54, - "loc": { - "start": { - "line": 1, - "column": 40 - }, - "end": { - "line": 1, - "column": 54 - } - }, + "start":40,"end":54,"loc":{"start":{"line":1,"column":40},"end":{"line":1,"column":54}}, "typeParameters": null, "id": { "type": "Identifier", - "start": 40, - "end": 54, - "loc": { - "start": { - "line": 1, - "column": 40 - }, - "end": { - "line": 1, - "column": 54 - }, - "identifierName": "HTMLDivElement" - }, + "start":40,"end":54,"loc":{"start":{"line":1,"column":40},"end":{"line":1,"column":54},"identifierName":"HTMLDivElement"}, "name": "HTMLDivElement" } } }, "body": { "type": "BlockStatement", - "start": 55, - "end": 57, - "loc": { - "start": { - "line": 1, - "column": 55 - }, - "end": { - "line": 1, - "column": 57 - } - }, + "start":55,"end":57,"loc":{"start":{"line":1,"column":55},"end":{"line":1,"column":57}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/flow/literal-types/string-single/output.json b/packages/babel-parser/test/fixtures/flow/literal-types/string-single/output.json index ef8262a78a5d..870564be73bd 100644 --- a/packages/babel-parser/test/fixtures/flow/literal-types/string-single/output.json +++ b/packages/babel-parser/test/fixtures/flow/literal-types/string-single/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 57, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 57 - } - }, + "start":0,"end":57,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":57}}, "program": { "type": "Program", - "start": 0, - "end": 57, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 57 - } - }, + "start":0,"end":57,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":57}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 57, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 57 - } - }, + "start":0,"end":57,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":57}}, "id": { "type": "Identifier", - "start": 9, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 22 - }, - "identifierName": "createElement" - }, + "start":9,"end":22,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":22},"identifierName":"createElement"}, "name": "createElement" }, "generator": false, @@ -65,48 +20,14 @@ "params": [ { "type": "Identifier", - "start": 23, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 37 - }, - "identifierName": "tagName" - }, + "start":23,"end":37,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":37},"identifierName":"tagName"}, "name": "tagName", "typeAnnotation": { "type": "TypeAnnotation", - "start": 30, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 1, - "column": 37 - } - }, + "start":30,"end":37,"loc":{"start":{"line":1,"column":30},"end":{"line":1,"column":37}}, "typeAnnotation": { "type": "StringLiteralTypeAnnotation", - "start": 32, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 32 - }, - "end": { - "line": 1, - "column": 37 - } - }, + "start":32,"end":37,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":37}}, "extra": { "rawValue": "div", "raw": "'div'" @@ -119,66 +40,21 @@ "predicate": null, "returnType": { "type": "TypeAnnotation", - "start": 38, - "end": 54, - "loc": { - "start": { - "line": 1, - "column": 38 - }, - "end": { - "line": 1, - "column": 54 - } - }, + "start":38,"end":54,"loc":{"start":{"line":1,"column":38},"end":{"line":1,"column":54}}, "typeAnnotation": { "type": "GenericTypeAnnotation", - "start": 40, - "end": 54, - "loc": { - "start": { - "line": 1, - "column": 40 - }, - "end": { - "line": 1, - "column": 54 - } - }, + "start":40,"end":54,"loc":{"start":{"line":1,"column":40},"end":{"line":1,"column":54}}, "typeParameters": null, "id": { "type": "Identifier", - "start": 40, - "end": 54, - "loc": { - "start": { - "line": 1, - "column": 40 - }, - "end": { - "line": 1, - "column": 54 - }, - "identifierName": "HTMLDivElement" - }, + "start":40,"end":54,"loc":{"start":{"line":1,"column":40},"end":{"line":1,"column":54},"identifierName":"HTMLDivElement"}, "name": "HTMLDivElement" } } }, "body": { "type": "BlockStatement", - "start": 55, - "end": 57, - "loc": { - "start": { - "line": 1, - "column": 55 - }, - "end": { - "line": 1, - "column": 57 - } - }, + "start":55,"end":57,"loc":{"start":{"line":1,"column":55},"end":{"line":1,"column":57}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/flow/multiple-declarations/class/input.js b/packages/babel-parser/test/fixtures/flow/multiple-declarations/class/input.js new file mode 100644 index 000000000000..fa5ff14cb9be --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/multiple-declarations/class/input.js @@ -0,0 +1,2 @@ +declare class C1 {} +class C1 {} diff --git a/packages/babel-parser/test/fixtures/flow/multiple-declarations/class/options.json b/packages/babel-parser/test/fixtures/flow/multiple-declarations/class/options.json new file mode 100644 index 000000000000..d822c40fbba2 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/multiple-declarations/class/options.json @@ -0,0 +1,4 @@ +{ + "sourceType": "module", + "plugins": ["jsx", "flow"] +} diff --git a/packages/babel-parser/test/fixtures/flow/multiple-declarations/class/output.json b/packages/babel-parser/test/fixtures/flow/multiple-declarations/class/output.json new file mode 100644 index 000000000000..246523ff7330 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/multiple-declarations/class/output.json @@ -0,0 +1,53 @@ +{ + "type": "File", + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":11}}, + "errors": [ + "SyntaxError: Identifier 'C1' has already been declared (2:6)" + ], + "program": { + "type": "Program", + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":11}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "DeclareClass", + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, + "id": { + "type": "Identifier", + "start":14,"end":16,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":16},"identifierName":"C1"}, + "name": "C1" + }, + "typeParameters": null, + "extends": [], + "implements": [], + "mixins": [], + "body": { + "type": "ObjectTypeAnnotation", + "start":17,"end":19,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":19}}, + "callProperties": [], + "properties": [], + "indexers": [], + "internalSlots": [], + "exact": false + } + }, + { + "type": "ClassDeclaration", + "start":20,"end":31,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":11}}, + "id": { + "type": "Identifier", + "start":26,"end":28,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":8},"identifierName":"C1"}, + "name": "C1" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":29,"end":31,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":11}}, + "body": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/multiple-declarations/declare-class/input.js b/packages/babel-parser/test/fixtures/flow/multiple-declarations/declare-class/input.js new file mode 100644 index 000000000000..d9470b0fd596 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/multiple-declarations/declare-class/input.js @@ -0,0 +1,6 @@ +declare class C1{} +declare class C1{} + +declare module M1 { + declare class C1 {} +} diff --git a/packages/babel-parser/test/fixtures/flow/multiple-declarations/declare-class/output.json b/packages/babel-parser/test/fixtures/flow/multiple-declarations/declare-class/output.json new file mode 100644 index 000000000000..d7d037237391 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/multiple-declarations/declare-class/output.json @@ -0,0 +1,95 @@ +{ + "type": "File", + "start":0,"end":82,"loc":{"start":{"line":1,"column":0},"end":{"line":6,"column":1}}, + "program": { + "type": "Program", + "start":0,"end":82,"loc":{"start":{"line":1,"column":0},"end":{"line":6,"column":1}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "DeclareClass", + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, + "id": { + "type": "Identifier", + "start":14,"end":16,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":16},"identifierName":"C1"}, + "name": "C1" + }, + "typeParameters": null, + "extends": [], + "implements": [], + "mixins": [], + "body": { + "type": "ObjectTypeAnnotation", + "start":16,"end":18,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":18}}, + "callProperties": [], + "properties": [], + "indexers": [], + "internalSlots": [], + "exact": false + } + }, + { + "type": "DeclareClass", + "start":19,"end":37,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":18}}, + "id": { + "type": "Identifier", + "start":33,"end":35,"loc":{"start":{"line":2,"column":14},"end":{"line":2,"column":16},"identifierName":"C1"}, + "name": "C1" + }, + "typeParameters": null, + "extends": [], + "implements": [], + "mixins": [], + "body": { + "type": "ObjectTypeAnnotation", + "start":35,"end":37,"loc":{"start":{"line":2,"column":16},"end":{"line":2,"column":18}}, + "callProperties": [], + "properties": [], + "indexers": [], + "internalSlots": [], + "exact": false + } + }, + { + "type": "DeclareModule", + "start":39,"end":82,"loc":{"start":{"line":4,"column":0},"end":{"line":6,"column":1}}, + "id": { + "type": "Identifier", + "start":54,"end":56,"loc":{"start":{"line":4,"column":15},"end":{"line":4,"column":17},"identifierName":"M1"}, + "name": "M1" + }, + "body": { + "type": "BlockStatement", + "start":57,"end":82,"loc":{"start":{"line":4,"column":18},"end":{"line":6,"column":1}}, + "body": [ + { + "type": "DeclareClass", + "start":61,"end":80,"loc":{"start":{"line":5,"column":2},"end":{"line":5,"column":21}}, + "id": { + "type": "Identifier", + "start":75,"end":77,"loc":{"start":{"line":5,"column":16},"end":{"line":5,"column":18},"identifierName":"C1"}, + "name": "C1" + }, + "typeParameters": null, + "extends": [], + "implements": [], + "mixins": [], + "body": { + "type": "ObjectTypeAnnotation", + "start":78,"end":80,"loc":{"start":{"line":5,"column":19},"end":{"line":5,"column":21}}, + "callProperties": [], + "properties": [], + "indexers": [], + "internalSlots": [], + "exact": false + } + } + ] + }, + "kind": "CommonJS" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/multiple-declarations/declare-function/input.js b/packages/babel-parser/test/fixtures/flow/multiple-declarations/declare-function/input.js new file mode 100644 index 000000000000..fb98eb970189 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/multiple-declarations/declare-function/input.js @@ -0,0 +1,3 @@ +declare function F1(): void +declare function F1(): void +function F1() {} diff --git a/packages/babel-parser/test/fixtures/flow/multiple-declarations/declare-function/output.json b/packages/babel-parser/test/fixtures/flow/multiple-declarations/declare-function/output.json new file mode 100644 index 000000000000..f9915cba13fe --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/multiple-declarations/declare-function/output.json @@ -0,0 +1,81 @@ +{ + "type": "File", + "start":0,"end":72,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":16}}, + "program": { + "type": "Program", + "start":0,"end":72,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":16}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "DeclareFunction", + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, + "id": { + "type": "Identifier", + "start":17,"end":27,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":27},"identifierName":"F1"}, + "name": "F1", + "typeAnnotation": { + "type": "TypeAnnotation", + "start":19,"end":27,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":27}}, + "typeAnnotation": { + "type": "FunctionTypeAnnotation", + "start":19,"end":27,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":27}}, + "typeParameters": null, + "params": [], + "rest": null, + "returnType": { + "type": "VoidTypeAnnotation", + "start":23,"end":27,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":27}} + } + } + } + }, + "predicate": null + }, + { + "type": "DeclareFunction", + "start":28,"end":55,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":27}}, + "id": { + "type": "Identifier", + "start":45,"end":55,"loc":{"start":{"line":2,"column":17},"end":{"line":2,"column":27},"identifierName":"F1"}, + "name": "F1", + "typeAnnotation": { + "type": "TypeAnnotation", + "start":47,"end":55,"loc":{"start":{"line":2,"column":19},"end":{"line":2,"column":27}}, + "typeAnnotation": { + "type": "FunctionTypeAnnotation", + "start":47,"end":55,"loc":{"start":{"line":2,"column":19},"end":{"line":2,"column":27}}, + "typeParameters": null, + "params": [], + "rest": null, + "returnType": { + "type": "VoidTypeAnnotation", + "start":51,"end":55,"loc":{"start":{"line":2,"column":23},"end":{"line":2,"column":27}} + } + } + } + }, + "predicate": null + }, + { + "type": "FunctionDeclaration", + "start":56,"end":72,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":16}}, + "id": { + "type": "Identifier", + "start":65,"end":67,"loc":{"start":{"line":3,"column":9},"end":{"line":3,"column":11},"identifierName":"F1"}, + "name": "F1" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":70,"end":72,"loc":{"start":{"line":3,"column":14},"end":{"line":3,"column":16}}, + "body": [], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/multiple-declarations/declare-var/input.js b/packages/babel-parser/test/fixtures/flow/multiple-declarations/declare-var/input.js new file mode 100644 index 000000000000..21b4f11b204c --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/multiple-declarations/declare-var/input.js @@ -0,0 +1,3 @@ +declare var V1; +declare var V1; +var V1; diff --git a/packages/babel-parser/test/fixtures/flow/multiple-declarations/declare-var/output.json b/packages/babel-parser/test/fixtures/flow/multiple-declarations/declare-var/output.json new file mode 100644 index 000000000000..9909154d6b0f --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/multiple-declarations/declare-var/output.json @@ -0,0 +1,48 @@ +{ + "type": "File", + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":7}}, + "program": { + "type": "Program", + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":7}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "DeclareVariable", + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, + "id": { + "type": "Identifier", + "start":12,"end":14,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":14},"identifierName":"V1"}, + "name": "V1" + } + }, + { + "type": "DeclareVariable", + "start":16,"end":31,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":15}}, + "id": { + "type": "Identifier", + "start":28,"end":30,"loc":{"start":{"line":2,"column":12},"end":{"line":2,"column":14},"identifierName":"V1"}, + "name": "V1" + } + }, + { + "type": "VariableDeclaration", + "start":32,"end":39,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":7}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":36,"end":38,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":6}}, + "id": { + "type": "Identifier", + "start":36,"end":38,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":6},"identifierName":"V1"}, + "name": "V1" + }, + "init": null + } + ], + "kind": "var" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/multiple-declarations/interface/input.js b/packages/babel-parser/test/fixtures/flow/multiple-declarations/interface/input.js new file mode 100644 index 000000000000..bca93948ce50 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/multiple-declarations/interface/input.js @@ -0,0 +1,2 @@ +interface I {}; +interface I {}; diff --git a/packages/babel-parser/test/fixtures/flow/multiple-declarations/interface/options.json b/packages/babel-parser/test/fixtures/flow/multiple-declarations/interface/options.json new file mode 100644 index 000000000000..d822c40fbba2 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/multiple-declarations/interface/options.json @@ -0,0 +1,4 @@ +{ + "sourceType": "module", + "plugins": ["jsx", "flow"] +} diff --git a/packages/babel-parser/test/fixtures/flow/multiple-declarations/interface/output.json b/packages/babel-parser/test/fixtures/flow/multiple-declarations/interface/output.json new file mode 100644 index 000000000000..edb012f084b6 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/multiple-declarations/interface/output.json @@ -0,0 +1,68 @@ +{ + "type": "File", + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":15}}, + "errors": [ + "SyntaxError: Identifier 'I' has already been declared (2:10)" + ], + "program": { + "type": "Program", + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":15}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "InterfaceDeclaration", + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, + "id": { + "type": "Identifier", + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11},"identifierName":"I"}, + "name": "I" + }, + "typeParameters": null, + "extends": [], + "implements": [], + "mixins": [], + "body": { + "type": "ObjectTypeAnnotation", + "start":12,"end":14,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":14}}, + "callProperties": [], + "properties": [], + "indexers": [], + "internalSlots": [], + "exact": false + } + }, + { + "type": "EmptyStatement", + "start":14,"end":15,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":15}} + }, + { + "type": "InterfaceDeclaration", + "start":16,"end":30,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":14}}, + "id": { + "type": "Identifier", + "start":26,"end":27,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":11},"identifierName":"I"}, + "name": "I" + }, + "typeParameters": null, + "extends": [], + "implements": [], + "mixins": [], + "body": { + "type": "ObjectTypeAnnotation", + "start":28,"end":30,"loc":{"start":{"line":2,"column":12},"end":{"line":2,"column":14}}, + "callProperties": [], + "properties": [], + "indexers": [], + "internalSlots": [], + "exact": false + } + }, + { + "type": "EmptyStatement", + "start":30,"end":31,"loc":{"start":{"line":2,"column":14},"end":{"line":2,"column":15}} + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/multiple-declarations/type/input.js b/packages/babel-parser/test/fixtures/flow/multiple-declarations/type/input.js new file mode 100644 index 000000000000..273aa1c7176c --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/multiple-declarations/type/input.js @@ -0,0 +1,2 @@ +type T1 = string; +type T1 = number; diff --git a/packages/babel-parser/test/fixtures/flow/multiple-declarations/type/options.json b/packages/babel-parser/test/fixtures/flow/multiple-declarations/type/options.json new file mode 100644 index 000000000000..d822c40fbba2 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/multiple-declarations/type/options.json @@ -0,0 +1,4 @@ +{ + "sourceType": "module", + "plugins": ["jsx", "flow"] +} diff --git a/packages/babel-parser/test/fixtures/flow/multiple-declarations/type/output.json b/packages/babel-parser/test/fixtures/flow/multiple-declarations/type/output.json new file mode 100644 index 000000000000..a17be34d1705 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/multiple-declarations/type/output.json @@ -0,0 +1,44 @@ +{ + "type": "File", + "start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":17}}, + "errors": [ + "SyntaxError: Identifier 'T1' has already been declared (2:5)" + ], + "program": { + "type": "Program", + "start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":17}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "TypeAlias", + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, + "id": { + "type": "Identifier", + "start":5,"end":7,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":7},"identifierName":"T1"}, + "name": "T1" + }, + "typeParameters": null, + "right": { + "type": "StringTypeAnnotation", + "start":10,"end":16,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":16}} + } + }, + { + "type": "TypeAlias", + "start":18,"end":35,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":17}}, + "id": { + "type": "Identifier", + "start":23,"end":25,"loc":{"start":{"line":2,"column":5},"end":{"line":2,"column":7},"identifierName":"T1"}, + "name": "T1" + }, + "typeParameters": null, + "right": { + "type": "NumberTypeAnnotation", + "start":28,"end":34,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":16}} + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/object-types/complex-param-types/output.json b/packages/babel-parser/test/fixtures/flow/object-types/complex-param-types/output.json index c6357989dc29..948d1edb1a7a 100644 --- a/packages/babel-parser/test/fixtures/flow/object-types/complex-param-types/output.json +++ b/packages/babel-parser/test/fixtures/flow/object-types/complex-param-types/output.json @@ -1,111 +1,32 @@ { "type": "File", - "start": 0, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, "program": { "type": "Program", - "start": 0, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "TypeAlias", - "start": 0, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, "id": { "type": "Identifier", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "o" - }, + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"o"}, "name": "o" }, "typeParameters": null, "right": { "type": "ObjectTypeAnnotation", - "start": 9, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":9,"end":31,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":31}}, "callProperties": [], "properties": [ { "type": "ObjectTypeProperty", - "start": 11, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":11,"end":29,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":29}}, "key": { "type": "Identifier", - "start": 11, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "m" - }, + "start":11,"end":12,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":12},"identifierName":"m"}, "name": "m" }, "static": false, @@ -114,97 +35,30 @@ "method": true, "value": { "type": "FunctionTypeAnnotation", - "start": 11, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":11,"end":29,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":29}}, "params": [ { "type": "FunctionTypeParam", - "start": 13, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":13,"end":22,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":22}}, "name": null, "optional": false, "typeAnnotation": { "type": "UnionTypeAnnotation", - "start": 13, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":13,"end":22,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":22}}, "types": [ { "type": "GenericTypeAnnotation", - "start": 14, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":14,"end":17,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":17}}, "typeParameters": null, "id": { "type": "Identifier", - "start": 14, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 17 - }, - "identifierName": "int" - }, + "start":14,"end":17,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":17},"identifierName":"int"}, "name": "int" } }, { "type": "BooleanTypeAnnotation", - "start": 18, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 22 - } - } + "start":18,"end":22,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":22}} } ] } @@ -214,18 +68,7 @@ "typeParameters": null, "returnType": { "type": "VoidTypeAnnotation", - "start": 25, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 29 - } - } + "start":25,"end":29,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":29}} } }, "optional": false diff --git a/packages/babel-parser/test/fixtures/flow/object-types/invalid-getter-param-count-rest/options.json b/packages/babel-parser/test/fixtures/flow/object-types/invalid-getter-param-count-rest/options.json deleted file mode 100644 index 65bc24a66fcd..000000000000 --- a/packages/babel-parser/test/fixtures/flow/object-types/invalid-getter-param-count-rest/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "getter must not have any formal parameters (2:2)" -} diff --git a/packages/babel-parser/test/fixtures/flow/object-types/invalid-getter-param-count-rest/output.json b/packages/babel-parser/test/fixtures/flow/object-types/invalid-getter-param-count-rest/output.json new file mode 100644 index 000000000000..e100d1aafcfe --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/object-types/invalid-getter-param-count-rest/output.json @@ -0,0 +1,77 @@ +{ + "type": "File", + "start":0,"end":37,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "errors": [ + "SyntaxError: getter must not have any formal parameters (2:2)" + ], + "program": { + "type": "Program", + "start":0,"end":37,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "TypeAlias", + "start":0,"end":37,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "id": { + "type": "Identifier", + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"B"}, + "name": "B" + }, + "typeParameters": null, + "right": { + "type": "ObjectTypeAnnotation", + "start":9,"end":37,"loc":{"start":{"line":1,"column":9},"end":{"line":3,"column":1}}, + "callProperties": [], + "properties": [ + { + "type": "ObjectTypeProperty", + "start":13,"end":34,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":23}}, + "key": { + "type": "Identifier", + "start":17,"end":18,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":7},"identifierName":"a"}, + "name": "a" + }, + "static": false, + "proto": false, + "kind": "get", + "method": true, + "value": { + "type": "FunctionTypeAnnotation", + "start":13,"end":34,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":23}}, + "params": [], + "rest": { + "type": "FunctionTypeParam", + "start":22,"end":25,"loc":{"start":{"line":2,"column":11},"end":{"line":2,"column":14}}, + "name": null, + "optional": false, + "typeAnnotation": { + "type": "GenericTypeAnnotation", + "start":22,"end":25,"loc":{"start":{"line":2,"column":11},"end":{"line":2,"column":14}}, + "typeParameters": null, + "id": { + "type": "Identifier", + "start":22,"end":25,"loc":{"start":{"line":2,"column":11},"end":{"line":2,"column":14},"identifierName":"foo"}, + "name": "foo" + } + } + }, + "typeParameters": null, + "returnType": { + "type": "NumberTypeAnnotation", + "start":28,"end":34,"loc":{"start":{"line":2,"column":17},"end":{"line":2,"column":23}} + } + }, + "optional": false + } + ], + "indexers": [], + "internalSlots": [], + "exact": false, + "inexact": false + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/object-types/invalid-getter-param-count/options.json b/packages/babel-parser/test/fixtures/flow/object-types/invalid-getter-param-count/options.json deleted file mode 100644 index 65bc24a66fcd..000000000000 --- a/packages/babel-parser/test/fixtures/flow/object-types/invalid-getter-param-count/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "getter must not have any formal parameters (2:2)" -} diff --git a/packages/babel-parser/test/fixtures/flow/object-types/invalid-getter-param-count/output.json b/packages/babel-parser/test/fixtures/flow/object-types/invalid-getter-param-count/output.json new file mode 100644 index 000000000000..0c62673bf17e --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/object-types/invalid-getter-param-count/output.json @@ -0,0 +1,77 @@ +{ + "type": "File", + "start":0,"end":41,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "errors": [ + "SyntaxError: getter must not have any formal parameters (2:2)" + ], + "program": { + "type": "Program", + "start":0,"end":41,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "TypeAlias", + "start":0,"end":41,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "id": { + "type": "Identifier", + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"B"}, + "name": "B" + }, + "typeParameters": null, + "right": { + "type": "ObjectTypeAnnotation", + "start":9,"end":41,"loc":{"start":{"line":1,"column":9},"end":{"line":3,"column":1}}, + "callProperties": [], + "properties": [ + { + "type": "ObjectTypeProperty", + "start":13,"end":38,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":27}}, + "key": { + "type": "Identifier", + "start":17,"end":18,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":7},"identifierName":"a"}, + "name": "a" + }, + "static": false, + "proto": false, + "kind": "get", + "method": true, + "value": { + "type": "FunctionTypeAnnotation", + "start":13,"end":38,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":27}}, + "params": [ + { + "type": "FunctionTypeParam", + "start":19,"end":29,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":18}}, + "name": { + "type": "Identifier", + "start":19,"end":22,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":11},"identifierName":"foo"}, + "name": "foo" + }, + "optional": false, + "typeAnnotation": { + "type": "NumberTypeAnnotation", + "start":23,"end":29,"loc":{"start":{"line":2,"column":12},"end":{"line":2,"column":18}} + } + } + ], + "rest": null, + "typeParameters": null, + "returnType": { + "type": "NumberTypeAnnotation", + "start":32,"end":38,"loc":{"start":{"line":2,"column":21},"end":{"line":2,"column":27}} + } + }, + "optional": false + } + ], + "indexers": [], + "internalSlots": [], + "exact": false, + "inexact": false + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/object-types/invalid-setter-param-count/options.json b/packages/babel-parser/test/fixtures/flow/object-types/invalid-setter-param-count/options.json deleted file mode 100644 index 6a1567782202..000000000000 --- a/packages/babel-parser/test/fixtures/flow/object-types/invalid-setter-param-count/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "setter must have exactly one formal parameter (2:2)" -} diff --git a/packages/babel-parser/test/fixtures/flow/object-types/invalid-setter-param-count/output.json b/packages/babel-parser/test/fixtures/flow/object-types/invalid-setter-param-count/output.json new file mode 100644 index 000000000000..345f3c0c34f3 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/object-types/invalid-setter-param-count/output.json @@ -0,0 +1,62 @@ +{ + "type": "File", + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "errors": [ + "SyntaxError: setter must have exactly one formal parameter (2:2)" + ], + "program": { + "type": "Program", + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "TypeAlias", + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "id": { + "type": "Identifier", + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"B"}, + "name": "B" + }, + "typeParameters": null, + "right": { + "type": "ObjectTypeAnnotation", + "start":9,"end":29,"loc":{"start":{"line":1,"column":9},"end":{"line":3,"column":1}}, + "callProperties": [], + "properties": [ + { + "type": "ObjectTypeProperty", + "start":13,"end":26,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":15}}, + "key": { + "type": "Identifier", + "start":17,"end":18,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":7},"identifierName":"a"}, + "name": "a" + }, + "static": false, + "proto": false, + "kind": "set", + "method": true, + "value": { + "type": "FunctionTypeAnnotation", + "start":13,"end":26,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":15}}, + "params": [], + "rest": null, + "typeParameters": null, + "returnType": { + "type": "VoidTypeAnnotation", + "start":22,"end":26,"loc":{"start":{"line":2,"column":11},"end":{"line":2,"column":15}} + } + }, + "optional": false + } + ], + "indexers": [], + "internalSlots": [], + "exact": false, + "inexact": false + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/object-types/invalid-setter-param-type/options.json b/packages/babel-parser/test/fixtures/flow/object-types/invalid-setter-param-type/options.json deleted file mode 100644 index 15ce6a4c5a51..000000000000 --- a/packages/babel-parser/test/fixtures/flow/object-types/invalid-setter-param-type/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "setter function argument must not be a rest parameter (2:2)" -} diff --git a/packages/babel-parser/test/fixtures/flow/object-types/invalid-setter-param-type/output.json b/packages/babel-parser/test/fixtures/flow/object-types/invalid-setter-param-type/output.json new file mode 100644 index 000000000000..07259bb3363e --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/object-types/invalid-setter-param-type/output.json @@ -0,0 +1,77 @@ +{ + "type": "File", + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "errors": [ + "SyntaxError: setter function argument must not be a rest parameter (2:2)" + ], + "program": { + "type": "Program", + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "TypeAlias", + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "id": { + "type": "Identifier", + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"B"}, + "name": "B" + }, + "typeParameters": null, + "right": { + "type": "ObjectTypeAnnotation", + "start":9,"end":33,"loc":{"start":{"line":1,"column":9},"end":{"line":3,"column":1}}, + "callProperties": [], + "properties": [ + { + "type": "ObjectTypeProperty", + "start":13,"end":30,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":19}}, + "key": { + "type": "Identifier", + "start":17,"end":18,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":7},"identifierName":"a"}, + "name": "a" + }, + "static": false, + "proto": false, + "kind": "set", + "method": true, + "value": { + "type": "FunctionTypeAnnotation", + "start":13,"end":30,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":19}}, + "params": [], + "rest": { + "type": "FunctionTypeParam", + "start":22,"end":23,"loc":{"start":{"line":2,"column":11},"end":{"line":2,"column":12}}, + "name": null, + "optional": false, + "typeAnnotation": { + "type": "GenericTypeAnnotation", + "start":22,"end":23,"loc":{"start":{"line":2,"column":11},"end":{"line":2,"column":12}}, + "typeParameters": null, + "id": { + "type": "Identifier", + "start":22,"end":23,"loc":{"start":{"line":2,"column":11},"end":{"line":2,"column":12},"identifierName":"w"}, + "name": "w" + } + } + }, + "typeParameters": null, + "returnType": { + "type": "VoidTypeAnnotation", + "start":26,"end":30,"loc":{"start":{"line":2,"column":15},"end":{"line":2,"column":19}} + } + }, + "optional": false + } + ], + "indexers": [], + "internalSlots": [], + "exact": false, + "inexact": false + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/opaque-type-alias/opaque_collision/output.json b/packages/babel-parser/test/fixtures/flow/opaque-type-alias/opaque_collision/output.json index aed10df3add5..c13650cb21ed 100644 --- a/packages/babel-parser/test/fixtures/flow/opaque-type-alias/opaque_collision/output.json +++ b/packages/babel-parser/test/fixtures/flow/opaque-type-alias/opaque_collision/output.json @@ -1,146 +1,44 @@ { "type": "File", - "start": 0, - "end": 66, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 37 - } - }, + "start":0,"end":66,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":37}}, "program": { "type": "Program", - "start": 0, - "end": 66, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 37 - } - }, + "start":0,"end":66,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":37}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "OpaqueType", - "start": 0, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, "id": { "type": "Identifier", - "start": 12, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 18 - }, - "identifierName": "opaque" - }, + "start":12,"end":18,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":18},"identifierName":"opaque"}, "name": "opaque" }, "typeParameters": null, "supertype": null, "impltype": { "type": "NumberTypeAnnotation", - "start": 21, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 27 - } - } + "start":21,"end":27,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":27}} } }, { "type": "OpaqueType", - "start": 29, - "end": 66, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 37 - } - }, + "start":29,"end":66,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":37}}, "id": { "type": "Identifier", - "start": 41, - "end": 56, - "loc": { - "start": { - "line": 2, - "column": 12 - }, - "end": { - "line": 2, - "column": 27 - }, - "identifierName": "not_transparent" - }, + "start":41,"end":56,"loc":{"start":{"line":2,"column":12},"end":{"line":2,"column":27},"identifierName":"not_transparent"}, "name": "not_transparent" }, "typeParameters": null, "supertype": null, "impltype": { "type": "GenericTypeAnnotation", - "start": 59, - "end": 65, - "loc": { - "start": { - "line": 2, - "column": 30 - }, - "end": { - "line": 2, - "column": 36 - } - }, + "start":59,"end":65,"loc":{"start":{"line":2,"column":30},"end":{"line":2,"column":36}}, "typeParameters": null, "id": { "type": "Identifier", - "start": 59, - "end": 65, - "loc": { - "start": { - "line": 2, - "column": 30 - }, - "end": { - "line": 2, - "column": 36 - }, - "identifierName": "opaque" - }, + "start":59,"end":65,"loc":{"start":{"line":2,"column":30},"end":{"line":2,"column":36},"identifierName":"opaque"}, "name": "opaque" } } diff --git a/packages/babel-parser/test/fixtures/flow/opaque-type-alias/opaque_declare_export_neither/output.json b/packages/babel-parser/test/fixtures/flow/opaque-type-alias/opaque_declare_export_neither/output.json index dada3aedd52f..d835a33ba94c 100644 --- a/packages/babel-parser/test/fixtures/flow/opaque-type-alias/opaque_declare_export_neither/output.json +++ b/packages/babel-parser/test/fixtures/flow/opaque-type-alias/opaque_declare_export_neither/output.json @@ -1,77 +1,21 @@ { "type": "File", - "start": 0, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, "program": { "type": "Program", - "start": 0, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "DeclareExportDeclaration", - "start": 0, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, "declaration": { "type": "DeclareOpaqueType", - "start": 15, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":15,"end":30,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":30}}, "id": { "type": "Identifier", - "start": 27, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 30 - }, - "identifierName": "Foo" - }, + "start":27,"end":30,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":30},"identifierName":"Foo"}, "name": "Foo" }, "typeParameters": null, diff --git a/packages/babel-parser/test/fixtures/flow/opaque-type-alias/opaque_declare_export_st_no_t/output.json b/packages/babel-parser/test/fixtures/flow/opaque-type-alias/opaque_declare_export_st_no_t/output.json index 13bbbb3a705c..b70605d402e3 100644 --- a/packages/babel-parser/test/fixtures/flow/opaque-type-alias/opaque_declare_export_st_no_t/output.json +++ b/packages/babel-parser/test/fixtures/flow/opaque-type-alias/opaque_declare_export_st_no_t/output.json @@ -1,110 +1,31 @@ { "type": "File", - "start": 0, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":35}}, "program": { "type": "Program", - "start": 0, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":35}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "DeclareExportDeclaration", - "start": 0, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":35}}, "declaration": { "type": "DeclareOpaqueType", - "start": 15, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":15,"end":35,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":35}}, "id": { "type": "Identifier", - "start": 27, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 30 - }, - "identifierName": "Foo" - }, + "start":27,"end":30,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":30},"identifierName":"Foo"}, "name": "Foo" }, "typeParameters": null, "supertype": { "type": "GenericTypeAnnotation", - "start": 32, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 32 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":32,"end":35,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":35}}, "typeParameters": null, "id": { "type": "Identifier", - "start": 32, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 32 - }, - "end": { - "line": 1, - "column": 35 - }, - "identifierName": "Bar" - }, + "start":32,"end":35,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":35},"identifierName":"Bar"}, "name": "Bar" } }, diff --git a/packages/babel-parser/test/fixtures/flow/opaque-type-alias/opaque_declare_neither/output.json b/packages/babel-parser/test/fixtures/flow/opaque-type-alias/opaque_declare_neither/output.json index 06b17c32b85b..feb7eb5112ef 100644 --- a/packages/babel-parser/test/fixtures/flow/opaque-type-alias/opaque_declare_neither/output.json +++ b/packages/babel-parser/test/fixtures/flow/opaque-type-alias/opaque_declare_neither/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "program": { "type": "Program", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "DeclareOpaqueType", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "id": { "type": "Identifier", - "start": 20, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 23 - }, - "identifierName": "Foo" - }, + "start":20,"end":23,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":23},"identifierName":"Foo"}, "name": "Foo" }, "typeParameters": null, diff --git a/packages/babel-parser/test/fixtures/flow/opaque-type-alias/opaque_declare_st_no_t/output.json b/packages/babel-parser/test/fixtures/flow/opaque-type-alias/opaque_declare_st_no_t/output.json index a0ebd094b3ae..d872213e1135 100644 --- a/packages/babel-parser/test/fixtures/flow/opaque-type-alias/opaque_declare_st_no_t/output.json +++ b/packages/babel-parser/test/fixtures/flow/opaque-type-alias/opaque_declare_st_no_t/output.json @@ -1,96 +1,28 @@ { "type": "File", - "start": 0, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, "program": { "type": "Program", - "start": 0, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "DeclareOpaqueType", - "start": 0, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, "id": { "type": "Identifier", - "start": 20, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 24 - }, - "identifierName": "Test" - }, + "start":20,"end":24,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":24},"identifierName":"Test"}, "name": "Test" }, "typeParameters": null, "supertype": { "type": "GenericTypeAnnotation", - "start": 26, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":26,"end":29,"loc":{"start":{"line":1,"column":26},"end":{"line":1,"column":29}}, "typeParameters": null, "id": { "type": "Identifier", - "start": 26, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 29 - }, - "identifierName": "Foo" - }, + "start":26,"end":29,"loc":{"start":{"line":1,"column":26},"end":{"line":1,"column":29},"identifierName":"Foo"}, "name": "Foo" } }, diff --git a/packages/babel-parser/test/fixtures/flow/opaque-type-alias/opaque_in_exp/output.json b/packages/babel-parser/test/fixtures/flow/opaque-type-alias/opaque_in_exp/output.json index 33d944843155..1ab4044f4f77 100644 --- a/packages/babel-parser/test/fixtures/flow/opaque-type-alias/opaque_in_exp/output.json +++ b/packages/babel-parser/test/fixtures/flow/opaque-type-alias/opaque_in_exp/output.json @@ -1,94 +1,27 @@ { "type": "File", - "start": 0, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 12 - } - }, + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":12}}, "program": { "type": "Program", - "start": 0, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 12 - } - }, + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":12}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":4,"end":14,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":14}}, "id": { "type": "Identifier", - "start": 4, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 10 - }, - "identifierName": "opaque" - }, + "start":4,"end":10,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":10},"identifierName":"opaque"}, "name": "opaque" }, "init": { "type": "NumericLiteral", - "start": 13, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":13,"end":14,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":14}}, "extra": { "rawValue": 0, "raw": "0" @@ -101,64 +34,19 @@ }, { "type": "ExpressionStatement", - "start": 16, - "end": 28, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 12 - } - }, + "start":16,"end":28,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":12}}, "expression": { "type": "AssignmentExpression", - "start": 16, - "end": 27, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 11 - } - }, + "start":16,"end":27,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":11}}, "operator": "+=", "left": { "type": "Identifier", - "start": 16, - "end": 22, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 6 - }, - "identifierName": "opaque" - }, + "start":16,"end":22,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":6},"identifierName":"opaque"}, "name": "opaque" }, "right": { "type": "NumericLiteral", - "start": 26, - "end": 27, - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 11 - } - }, + "start":26,"end":27,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":11}}, "extra": { "rawValue": 4, "raw": "4" diff --git a/packages/babel-parser/test/fixtures/flow/opaque-type-alias/opaque_in_func/output.json b/packages/babel-parser/test/fixtures/flow/opaque-type-alias/opaque_in_func/output.json index d85d635754fa..c7317240ce64 100644 --- a/packages/babel-parser/test/fixtures/flow/opaque-type-alias/opaque_in_func/output.json +++ b/packages/babel-parser/test/fixtures/flow/opaque-type-alias/opaque_in_func/output.json @@ -1,94 +1,27 @@ { "type": "File", - "start": 0, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, "program": { "type": "Program", - "start": 0, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, "expression": { "type": "CallExpression", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "callee": { "type": "Identifier", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "opaque" - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6},"identifierName":"opaque"}, "name": "opaque" }, "arguments": [ { "type": "NumericLiteral", - "start": 7, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8}}, "extra": { "rawValue": 0, "raw": "0" diff --git a/packages/babel-parser/test/fixtures/flow/opaque-type-alias/opaque_subtype/output.json b/packages/babel-parser/test/fixtures/flow/opaque-type-alias/opaque_subtype/output.json index 5809df40e897..6dd552b578ca 100644 --- a/packages/babel-parser/test/fixtures/flow/opaque-type-alias/opaque_subtype/output.json +++ b/packages/babel-parser/test/fixtures/flow/opaque-type-alias/opaque_subtype/output.json @@ -1,125 +1,35 @@ { "type": "File", - "start": 0, - "end": 43, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 43 - } - }, + "start":0,"end":43,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":43}}, "program": { "type": "Program", - "start": 0, - "end": 43, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 43 - } - }, + "start":0,"end":43,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":43}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "OpaqueType", - "start": 0, - "end": 43, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 43 - } - }, + "start":0,"end":43,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":43}}, "id": { "type": "Identifier", - "start": 12, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 19 - }, - "identifierName": "Counter" - }, + "start":12,"end":19,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":19},"identifierName":"Counter"}, "name": "Counter" }, "typeParameters": null, "supertype": { "type": "GenericTypeAnnotation", - "start": 21, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":21,"end":27,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":27}}, "typeParameters": { "type": "TypeParameterInstantiation", - "start": 24, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":24,"end":27,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":27}}, "params": [ { "type": "GenericTypeAnnotation", - "start": 25, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":25,"end":26,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":26}}, "typeParameters": null, "id": { "type": "Identifier", - "start": 25, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 26 - }, - "identifierName": "T" - }, + "start":25,"end":26,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":26},"identifierName":"T"}, "name": "T" } } @@ -127,81 +37,24 @@ }, "id": { "type": "Identifier", - "start": 21, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 24 - }, - "identifierName": "Box" - }, + "start":21,"end":24,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":24},"identifierName":"Box"}, "name": "Box" } }, "impltype": { "type": "GenericTypeAnnotation", - "start": 30, - "end": 42, - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 1, - "column": 42 - } - }, + "start":30,"end":42,"loc":{"start":{"line":1,"column":30},"end":{"line":1,"column":42}}, "typeParameters": { "type": "TypeParameterInstantiation", - "start": 39, - "end": 42, - "loc": { - "start": { - "line": 1, - "column": 39 - }, - "end": { - "line": 1, - "column": 42 - } - }, + "start":39,"end":42,"loc":{"start":{"line":1,"column":39},"end":{"line":1,"column":42}}, "params": [ { "type": "GenericTypeAnnotation", - "start": 40, - "end": 41, - "loc": { - "start": { - "line": 1, - "column": 40 - }, - "end": { - "line": 1, - "column": 41 - } - }, + "start":40,"end":41,"loc":{"start":{"line":1,"column":40},"end":{"line":1,"column":41}}, "typeParameters": null, "id": { "type": "Identifier", - "start": 40, - "end": 41, - "loc": { - "start": { - "line": 1, - "column": 40 - }, - "end": { - "line": 1, - "column": 41 - }, - "identifierName": "T" - }, + "start":40,"end":41,"loc":{"start":{"line":1,"column":40},"end":{"line":1,"column":41},"identifierName":"T"}, "name": "T" } } @@ -209,19 +62,7 @@ }, "id": { "type": "Identifier", - "start": 30, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 1, - "column": 39 - }, - "identifierName": "Container" - }, + "start":30,"end":39,"loc":{"start":{"line":1,"column":30},"end":{"line":1,"column":39},"identifierName":"Container"}, "name": "Container" } } diff --git a/packages/babel-parser/test/fixtures/flow/opaque-type-alias/opaque_subtype_export/output.json b/packages/babel-parser/test/fixtures/flow/opaque-type-alias/opaque_subtype_export/output.json index 7acf8d1b53ef..0a7faddccd26 100644 --- a/packages/babel-parser/test/fixtures/flow/opaque-type-alias/opaque_subtype_export/output.json +++ b/packages/babel-parser/test/fixtures/flow/opaque-type-alias/opaque_subtype_export/output.json @@ -1,142 +1,41 @@ { "type": "File", - "start": 0, - "end": 50, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 50 - } - }, + "start":0,"end":50,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":50}}, "program": { "type": "Program", - "start": 0, - "end": 50, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 50 - } - }, + "start":0,"end":50,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":50}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExportNamedDeclaration", - "start": 0, - "end": 50, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 50 - } - }, + "start":0,"end":50,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":50}}, "specifiers": [], "source": null, "exportKind": "type", "declaration": { "type": "OpaqueType", - "start": 7, - "end": 50, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 50 - } - }, + "start":7,"end":50,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":50}}, "id": { "type": "Identifier", - "start": 19, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 26 - }, - "identifierName": "Counter" - }, + "start":19,"end":26,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":26},"identifierName":"Counter"}, "name": "Counter" }, "typeParameters": null, "supertype": { "type": "GenericTypeAnnotation", - "start": 28, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":28,"end":34,"loc":{"start":{"line":1,"column":28},"end":{"line":1,"column":34}}, "typeParameters": { "type": "TypeParameterInstantiation", - "start": 31, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 31 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":31,"end":34,"loc":{"start":{"line":1,"column":31},"end":{"line":1,"column":34}}, "params": [ { "type": "GenericTypeAnnotation", - "start": 32, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 32 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":32,"end":33,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":33}}, "typeParameters": null, "id": { "type": "Identifier", - "start": 32, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 32 - }, - "end": { - "line": 1, - "column": 33 - }, - "identifierName": "T" - }, + "start":32,"end":33,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":33},"identifierName":"T"}, "name": "T" } } @@ -144,81 +43,24 @@ }, "id": { "type": "Identifier", - "start": 28, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 31 - }, - "identifierName": "Box" - }, + "start":28,"end":31,"loc":{"start":{"line":1,"column":28},"end":{"line":1,"column":31},"identifierName":"Box"}, "name": "Box" } }, "impltype": { "type": "GenericTypeAnnotation", - "start": 37, - "end": 49, - "loc": { - "start": { - "line": 1, - "column": 37 - }, - "end": { - "line": 1, - "column": 49 - } - }, + "start":37,"end":49,"loc":{"start":{"line":1,"column":37},"end":{"line":1,"column":49}}, "typeParameters": { "type": "TypeParameterInstantiation", - "start": 46, - "end": 49, - "loc": { - "start": { - "line": 1, - "column": 46 - }, - "end": { - "line": 1, - "column": 49 - } - }, + "start":46,"end":49,"loc":{"start":{"line":1,"column":46},"end":{"line":1,"column":49}}, "params": [ { "type": "GenericTypeAnnotation", - "start": 47, - "end": 48, - "loc": { - "start": { - "line": 1, - "column": 47 - }, - "end": { - "line": 1, - "column": 48 - } - }, + "start":47,"end":48,"loc":{"start":{"line":1,"column":47},"end":{"line":1,"column":48}}, "typeParameters": null, "id": { "type": "Identifier", - "start": 47, - "end": 48, - "loc": { - "start": { - "line": 1, - "column": 47 - }, - "end": { - "line": 1, - "column": 48 - }, - "identifierName": "S" - }, + "start":47,"end":48,"loc":{"start":{"line":1,"column":47},"end":{"line":1,"column":48},"identifierName":"S"}, "name": "S" } } @@ -226,19 +68,7 @@ }, "id": { "type": "Identifier", - "start": 37, - "end": 46, - "loc": { - "start": { - "line": 1, - "column": 37 - }, - "end": { - "line": 1, - "column": 46 - }, - "identifierName": "Container" - }, + "start":37,"end":46,"loc":{"start":{"line":1,"column":37},"end":{"line":1,"column":46},"identifierName":"Container"}, "name": "Container" } } diff --git a/packages/babel-parser/test/fixtures/flow/opaque-type-alias/opaque_type/output.json b/packages/babel-parser/test/fixtures/flow/opaque-type-alias/opaque_type/output.json index 0d65316821a8..bbd8adb7db1d 100644 --- a/packages/babel-parser/test/fixtures/flow/opaque-type-alias/opaque_type/output.json +++ b/packages/babel-parser/test/fixtures/flow/opaque-type-alias/opaque_type/output.json @@ -1,81 +1,25 @@ { "type": "File", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "program": { "type": "Program", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "OpaqueType", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "id": { "type": "Identifier", - "start": 12, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 14 - }, - "identifierName": "ID" - }, + "start":12,"end":14,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":14},"identifierName":"ID"}, "name": "ID" }, "typeParameters": null, "supertype": null, "impltype": { "type": "NumberTypeAnnotation", - "start": 17, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 23 - } - } + "start":17,"end":23,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":23}} } } ], diff --git a/packages/babel-parser/test/fixtures/flow/opaque-type-alias/opaque_type_export/output.json b/packages/babel-parser/test/fixtures/flow/opaque-type-alias/opaque_type_export/output.json index 76989f9491d0..f8c51c247f9c 100644 --- a/packages/babel-parser/test/fixtures/flow/opaque-type-alias/opaque_type_export/output.json +++ b/packages/babel-parser/test/fixtures/flow/opaque-type-alias/opaque_type_export/output.json @@ -1,98 +1,31 @@ { "type": "File", - "start": 0, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, "program": { "type": "Program", - "start": 0, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExportNamedDeclaration", - "start": 0, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, "specifiers": [], "source": null, "exportKind": "type", "declaration": { "type": "OpaqueType", - "start": 7, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":7,"end":31,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":31}}, "id": { "type": "Identifier", - "start": 19, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 21 - }, - "identifierName": "ID" - }, + "start":19,"end":21,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":21},"identifierName":"ID"}, "name": "ID" }, "typeParameters": null, "supertype": null, "impltype": { "type": "NumberTypeAnnotation", - "start": 24, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 30 - } - } + "start":24,"end":30,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":30}} } } } diff --git a/packages/babel-parser/test/fixtures/flow/opaque-type-alias/reserved-type-invalid/options.json b/packages/babel-parser/test/fixtures/flow/opaque-type-alias/reserved-type-invalid/options.json deleted file mode 100644 index 0c2cdd4d777c..000000000000 --- a/packages/babel-parser/test/fixtures/flow/opaque-type-alias/reserved-type-invalid/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Cannot overwrite reserved type string (1:12)" -} diff --git a/packages/babel-parser/test/fixtures/flow/opaque-type-alias/reserved-type-invalid/output.json b/packages/babel-parser/test/fixtures/flow/opaque-type-alias/reserved-type-invalid/output.json new file mode 100644 index 000000000000..200ac258b04e --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/opaque-type-alias/reserved-type-invalid/output.json @@ -0,0 +1,31 @@ +{ + "type": "File", + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, + "errors": [ + "SyntaxError: Cannot overwrite reserved type string (1:12)" + ], + "program": { + "type": "Program", + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "OpaqueType", + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, + "id": { + "type": "Identifier", + "start":12,"end":18,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":18},"identifierName":"string"}, + "name": "string" + }, + "typeParameters": null, + "supertype": null, + "impltype": { + "type": "NumberTypeAnnotation", + "start":21,"end":27,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":27}} + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/opaque-type-alias/reserved-value/output.json b/packages/babel-parser/test/fixtures/flow/opaque-type-alias/reserved-value/output.json index f3bbc0ec7aa2..b9a5bb32a00c 100644 --- a/packages/babel-parser/test/fixtures/flow/opaque-type-alias/reserved-value/output.json +++ b/packages/babel-parser/test/fixtures/flow/opaque-type-alias/reserved-value/output.json @@ -1,81 +1,25 @@ { "type": "File", - "start": 0, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, "program": { "type": "Program", - "start": 0, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "OpaqueType", - "start": 0, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, "id": { "type": "Identifier", - "start": 12, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 18 - }, - "identifierName": "switch" - }, + "start":12,"end":18,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":18},"identifierName":"switch"}, "name": "switch" }, "typeParameters": null, "supertype": null, "impltype": { "type": "NumberTypeAnnotation", - "start": 21, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 27 - } - } + "start":21,"end":27,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":27}} } } ], diff --git a/packages/babel-parser/test/fixtures/flow/optional-type/1/output.json b/packages/babel-parser/test/fixtures/flow/optional-type/1/output.json index 75f31bbbe6bd..29b561209bee 100644 --- a/packages/babel-parser/test/fixtures/flow/optional-type/1/output.json +++ b/packages/babel-parser/test/fixtures/flow/optional-type/1/output.json @@ -1,131 +1,41 @@ { "type": "File", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, "program": { "type": "Program", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, "declarations": [ { "type": "VariableDeclarator", - "start": 6, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":6,"end":20,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":20}}, "id": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "f" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"f"}, "name": "f" }, "init": { "type": "ArrowFunctionExpression", - "start": 10, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":10,"end":20,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":20}}, "id": null, "generator": false, "async": false, "params": [ { "type": "Identifier", - "start": 11, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 13 - }, - "identifierName": "x" - }, + "start":11,"end":13,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":13},"identifierName":"x"}, "name": "x", "optional": true } ], "body": { "type": "BlockStatement", - "start": 18, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":18,"end":20,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":20}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/flow/optional-type/3/output.json b/packages/babel-parser/test/fixtures/flow/optional-type/3/output.json index 38e2cb2fb8cd..c3e3ff8064ec 100644 --- a/packages/babel-parser/test/fixtures/flow/optional-type/3/output.json +++ b/packages/babel-parser/test/fixtures/flow/optional-type/3/output.json @@ -1,191 +1,55 @@ { "type": "File", - "start": 0, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, "program": { "type": "Program", - "start": 0, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, "declarations": [ { "type": "VariableDeclarator", - "start": 6, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":6,"end":36,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":36}}, "id": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "f" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"f"}, "name": "f" }, "init": { "type": "ArrowFunctionExpression", - "start": 10, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":10,"end":36,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":36}}, "id": null, "generator": false, "async": false, "params": [ { "type": "Identifier", - "start": 11, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 13 - }, - "identifierName": "x" - }, + "start":11,"end":13,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":13},"identifierName":"x"}, "name": "x", "optional": true }, { "type": "AssignmentPattern", - "start": 15, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":15,"end":29,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":29}}, "left": { "type": "Identifier", - "start": 15, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 24 - }, - "identifierName": "y" - }, + "start":15,"end":24,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":24},"identifierName":"y"}, "name": "y", "optional": true, "typeAnnotation": { "type": "TypeAnnotation", - "start": 17, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":17,"end":24,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":24}}, "typeAnnotation": { "type": "GenericTypeAnnotation", - "start": 18, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":18,"end":24,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":24}}, "typeParameters": null, "id": { "type": "Identifier", - "start": 18, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 24 - }, - "identifierName": "Object" - }, + "start":18,"end":24,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":24},"identifierName":"Object"}, "name": "Object" } } @@ -193,36 +57,14 @@ }, "right": { "type": "ObjectExpression", - "start": 27, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":27,"end":29,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":29}}, "properties": [] } } ], "body": { "type": "BlockStatement", - "start": 34, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 34 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":34,"end":36,"loc":{"start":{"line":1,"column":34},"end":{"line":1,"column":36}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/flow/optional-type/4/output.json b/packages/babel-parser/test/fixtures/flow/optional-type/4/output.json index 61dd29778966..4884848edf01 100644 --- a/packages/babel-parser/test/fixtures/flow/optional-type/4/output.json +++ b/packages/babel-parser/test/fixtures/flow/optional-type/4/output.json @@ -1,127 +1,37 @@ { "type": "File", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "program": { "type": "Program", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "declarations": [ { "type": "VariableDeclarator", - "start": 6, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":6,"end":23,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":23}}, "id": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "f" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"f"}, "name": "f" }, "init": { "type": "ArrowFunctionExpression", - "start": 10, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":10,"end":23,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":23}}, "id": null, "generator": false, "async": false, "params": [ { "type": "RestElement", - "start": 11, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":11,"end":16,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":16}}, "argument": { "type": "Identifier", - "start": 14, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - }, - "identifierName": "x" - }, + "start":14,"end":15,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":15},"identifierName":"x"}, "name": "x" }, "optional": true @@ -129,18 +39,7 @@ ], "body": { "type": "BlockStatement", - "start": 21, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":21,"end":23,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":23}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/flow/optional-type/6/options.json b/packages/babel-parser/test/fixtures/flow/optional-type/6/options.json deleted file mode 100644 index fb2831d6188b..000000000000 --- a/packages/babel-parser/test/fixtures/flow/optional-type/6/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "A binding pattern parameter cannot be optional in an implementation signature. (1:11)" -} diff --git a/packages/babel-parser/test/fixtures/flow/optional-type/6/output.json b/packages/babel-parser/test/fixtures/flow/optional-type/6/output.json new file mode 100644 index 000000000000..8472638da812 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/optional-type/6/output.json @@ -0,0 +1,46 @@ +{ + "type": "File", + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, + "errors": [ + "SyntaxError: A binding pattern parameter cannot be optional in an implementation signature. (1:11)" + ], + "program": { + "type": "Program", + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, + "id": { + "type": "Identifier", + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"f"}, + "name": "f" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "ArrayPattern", + "start":11,"end":14,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":14}}, + "elements": [], + "optional": true + }, + { + "type": "ObjectPattern", + "start":16,"end":18,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":18}}, + "properties": [] + } + ], + "body": { + "type": "BlockStatement", + "start":20,"end":22,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":22}}, + "body": [], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/pragma/1/output.json b/packages/babel-parser/test/fixtures/flow/pragma/1/output.json index f74bc34124e4..a362179a8d41 100644 --- a/packages/babel-parser/test/fixtures/flow/pragma/1/output.json +++ b/packages/babel-parser/test/fixtures/flow/pragma/1/output.json @@ -1,128 +1,37 @@ { "type": "File", - "start": 0, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 10 - } - }, + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":10}}, "program": { "type": "Program", - "start": 0, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 10 - } - }, + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":10}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, "expression": { "type": "BinaryExpression", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "left": { "type": "BinaryExpression", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "left": { "type": "Identifier", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - }, - "identifierName": "foo" - }, + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3},"identifierName":"foo"}, "name": "foo" }, "operator": "<", "right": { "type": "Identifier", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "x" - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"x"}, "name": "x" } }, "operator": ">", "right": { "type": "Identifier", - "start": 7, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - }, - "identifierName": "y" - }, + "start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8},"identifierName":"y"}, "name": "y", "extra": { "parenthesized": true, @@ -134,115 +43,35 @@ { "type": "CommentLine", "value": " @flow", - "start": 11, - "end": 19, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 8 - } - } + "start":11,"end":19,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":8}} } ] }, { "type": "ExpressionStatement", - "start": 20, - "end": 30, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 10 - } - }, + "start":20,"end":30,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":10}}, "expression": { "type": "BinaryExpression", - "start": 20, - "end": 29, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 9 - } - }, + "start":20,"end":29,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":9}}, "left": { "type": "BinaryExpression", - "start": 20, - "end": 25, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 5 - } - }, + "start":20,"end":25,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":5}}, "left": { "type": "Identifier", - "start": 20, - "end": 23, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 3 - }, - "identifierName": "foo" - }, + "start":20,"end":23,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":3},"identifierName":"foo"}, "name": "foo" }, "operator": "<", "right": { "type": "Identifier", - "start": 24, - "end": 25, - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 5 - }, - "identifierName": "x" - }, + "start":24,"end":25,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":5},"identifierName":"x"}, "name": "x" } }, "operator": ">", "right": { "type": "Identifier", - "start": 27, - "end": 28, - "loc": { - "start": { - "line": 3, - "column": 7 - }, - "end": { - "line": 3, - "column": 8 - }, - "identifierName": "y" - }, + "start":27,"end":28,"loc":{"start":{"line":3,"column":7},"end":{"line":3,"column":8},"identifierName":"y"}, "name": "y", "extra": { "parenthesized": true, @@ -254,18 +83,7 @@ { "type": "CommentLine", "value": " @flow", - "start": 11, - "end": 19, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 8 - } - } + "start":11,"end":19,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":8}} } ] } @@ -276,18 +94,7 @@ { "type": "CommentLine", "value": " @flow", - "start": 11, - "end": 19, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 8 - } - } + "start":11,"end":19,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":8}} } ] } \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/pragma/2/output.json b/packages/babel-parser/test/fixtures/flow/pragma/2/output.json index d97623a0a101..657920883e63 100644 --- a/packages/babel-parser/test/fixtures/flow/pragma/2/output.json +++ b/packages/babel-parser/test/fixtures/flow/pragma/2/output.json @@ -1,124 +1,34 @@ { "type": "File", - "start": 0, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 10 - } - }, + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":10}}, "program": { "type": "Program", - "start": 0, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 10 - } - }, + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":10}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 23, - "end": 33, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 10 - } - }, + "start":23,"end":33,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":10}}, "expression": { "type": "CallExpression", - "start": 23, - "end": 32, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 9 - } - }, + "start":23,"end":32,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":9}}, "callee": { "type": "Identifier", - "start": 23, - "end": 26, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 3 - }, - "identifierName": "foo" - }, + "start":23,"end":26,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":3},"identifierName":"foo"}, "name": "foo" }, "typeArguments": { "type": "TypeParameterInstantiation", - "start": 26, - "end": 29, - "loc": { - "start": { - "line": 3, - "column": 3 - }, - "end": { - "line": 3, - "column": 6 - } - }, + "start":26,"end":29,"loc":{"start":{"line":3,"column":3},"end":{"line":3,"column":6}}, "params": [ { "type": "GenericTypeAnnotation", - "start": 27, - "end": 28, - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 5 - } - }, + "start":27,"end":28,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":5}}, "typeParameters": null, "id": { "type": "Identifier", - "start": 27, - "end": 28, - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 5 - }, - "identifierName": "x" - }, + "start":27,"end":28,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":5},"identifierName":"x"}, "name": "x" } } @@ -127,19 +37,7 @@ "arguments": [ { "type": "Identifier", - "start": 30, - "end": 31, - "loc": { - "start": { - "line": 3, - "column": 7 - }, - "end": { - "line": 3, - "column": 8 - }, - "identifierName": "y" - }, + "start":30,"end":31,"loc":{"start":{"line":3,"column":7},"end":{"line":3,"column":8},"identifierName":"y"}, "name": "y" } ] @@ -148,18 +46,7 @@ { "type": "CommentLine", "value": " @flow", - "start": 14, - "end": 22, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 8 - } - } + "start":14,"end":22,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":8}} } ] } @@ -167,32 +54,10 @@ "directives": [ { "type": "Directive", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "value": { "type": "DirectiveLiteral", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, "value": "use strict", "extra": { "raw": "'use strict'", @@ -203,18 +68,7 @@ { "type": "CommentLine", "value": " @flow", - "start": 14, - "end": 22, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 8 - } - } + "start":14,"end":22,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":8}} } ] } @@ -224,18 +78,7 @@ { "type": "CommentLine", "value": " @flow", - "start": 14, - "end": 22, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 8 - } - } + "start":14,"end":22,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":8}} } ] } \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/pragma/3/output.json b/packages/babel-parser/test/fixtures/flow/pragma/3/output.json index 5baf19ddf253..0e1467763efa 100644 --- a/packages/babel-parser/test/fixtures/flow/pragma/3/output.json +++ b/packages/babel-parser/test/fixtures/flow/pragma/3/output.json @@ -1,124 +1,34 @@ { "type": "File", - "start": 0, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 10 - } - }, + "start":0,"end":40,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":10}}, "program": { "type": "Program", - "start": 0, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 10 - } - }, + "start":0,"end":40,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":10}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 30, - "end": 40, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 10 - } - }, + "start":30,"end":40,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":10}}, "expression": { "type": "CallExpression", - "start": 30, - "end": 39, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 9 - } - }, + "start":30,"end":39,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":9}}, "callee": { "type": "Identifier", - "start": 30, - "end": 33, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 3 - }, - "identifierName": "foo" - }, + "start":30,"end":33,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":3},"identifierName":"foo"}, "name": "foo" }, "typeArguments": { "type": "TypeParameterInstantiation", - "start": 33, - "end": 36, - "loc": { - "start": { - "line": 3, - "column": 3 - }, - "end": { - "line": 3, - "column": 6 - } - }, + "start":33,"end":36,"loc":{"start":{"line":3,"column":3},"end":{"line":3,"column":6}}, "params": [ { "type": "GenericTypeAnnotation", - "start": 34, - "end": 35, - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 5 - } - }, + "start":34,"end":35,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":5}}, "typeParameters": null, "id": { "type": "Identifier", - "start": 34, - "end": 35, - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 5 - }, - "identifierName": "x" - }, + "start":34,"end":35,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":5},"identifierName":"x"}, "name": "x" } } @@ -127,19 +37,7 @@ "arguments": [ { "type": "Identifier", - "start": 37, - "end": 38, - "loc": { - "start": { - "line": 3, - "column": 7 - }, - "end": { - "line": 3, - "column": 8 - }, - "identifierName": "y" - }, + "start":37,"end":38,"loc":{"start":{"line":3,"column":7},"end":{"line":3,"column":8},"identifierName":"y"}, "name": "y" } ] @@ -148,34 +46,12 @@ { "type": "CommentLine", "value": " arbitrary comment", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - } + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}} }, { "type": "CommentLine", "value": " @flow", - "start": 21, - "end": 29, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 8 - } - } + "start":21,"end":29,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":8}} } ] } @@ -186,34 +62,12 @@ { "type": "CommentLine", "value": " arbitrary comment", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - } + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}} }, { "type": "CommentLine", "value": " @flow", - "start": 21, - "end": 29, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 8 - } - } + "start":21,"end":29,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":8}} } ] } \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/pragma/4/output.json b/packages/babel-parser/test/fixtures/flow/pragma/4/output.json index 46325d1919a8..e391f94cd973 100644 --- a/packages/babel-parser/test/fixtures/flow/pragma/4/output.json +++ b/packages/babel-parser/test/fixtures/flow/pragma/4/output.json @@ -1,124 +1,34 @@ { "type": "File", - "start": 0, - "end": 54, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 10 - } - }, + "start":0,"end":54,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":10}}, "program": { "type": "Program", - "start": 0, - "end": 54, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 10 - } - }, + "start":0,"end":54,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":10}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 44, - "end": 54, - "loc": { - "start": { - "line": 4, - "column": 0 - }, - "end": { - "line": 4, - "column": 10 - } - }, + "start":44,"end":54,"loc":{"start":{"line":4,"column":0},"end":{"line":4,"column":10}}, "expression": { "type": "CallExpression", - "start": 44, - "end": 53, - "loc": { - "start": { - "line": 4, - "column": 0 - }, - "end": { - "line": 4, - "column": 9 - } - }, + "start":44,"end":53,"loc":{"start":{"line":4,"column":0},"end":{"line":4,"column":9}}, "callee": { "type": "Identifier", - "start": 44, - "end": 47, - "loc": { - "start": { - "line": 4, - "column": 0 - }, - "end": { - "line": 4, - "column": 3 - }, - "identifierName": "foo" - }, + "start":44,"end":47,"loc":{"start":{"line":4,"column":0},"end":{"line":4,"column":3},"identifierName":"foo"}, "name": "foo" }, "typeArguments": { "type": "TypeParameterInstantiation", - "start": 47, - "end": 50, - "loc": { - "start": { - "line": 4, - "column": 3 - }, - "end": { - "line": 4, - "column": 6 - } - }, + "start":47,"end":50,"loc":{"start":{"line":4,"column":3},"end":{"line":4,"column":6}}, "params": [ { "type": "GenericTypeAnnotation", - "start": 48, - "end": 49, - "loc": { - "start": { - "line": 4, - "column": 4 - }, - "end": { - "line": 4, - "column": 5 - } - }, + "start":48,"end":49,"loc":{"start":{"line":4,"column":4},"end":{"line":4,"column":5}}, "typeParameters": null, "id": { "type": "Identifier", - "start": 48, - "end": 49, - "loc": { - "start": { - "line": 4, - "column": 4 - }, - "end": { - "line": 4, - "column": 5 - }, - "identifierName": "x" - }, + "start":48,"end":49,"loc":{"start":{"line":4,"column":4},"end":{"line":4,"column":5},"identifierName":"x"}, "name": "x" } } @@ -127,19 +37,7 @@ "arguments": [ { "type": "Identifier", - "start": 51, - "end": 52, - "loc": { - "start": { - "line": 4, - "column": 7 - }, - "end": { - "line": 4, - "column": 8 - }, - "identifierName": "y" - }, + "start":51,"end":52,"loc":{"start":{"line":4,"column":7},"end":{"line":4,"column":8},"identifierName":"y"}, "name": "y" } ] @@ -148,34 +46,12 @@ { "type": "CommentLine", "value": " arbitrary comment", - "start": 14, - "end": 34, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 20 - } - } + "start":14,"end":34,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":20}} }, { "type": "CommentLine", "value": " @flow", - "start": 35, - "end": 43, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 8 - } - } + "start":35,"end":43,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":8}} } ] } @@ -183,32 +59,10 @@ "directives": [ { "type": "Directive", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "value": { "type": "DirectiveLiteral", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, "value": "use strict", "extra": { "raw": "'use strict'", @@ -219,34 +73,12 @@ { "type": "CommentLine", "value": " arbitrary comment", - "start": 14, - "end": 34, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 20 - } - } + "start":14,"end":34,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":20}} }, { "type": "CommentLine", "value": " @flow", - "start": 35, - "end": 43, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 8 - } - } + "start":35,"end":43,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":8}} } ] } @@ -256,34 +88,12 @@ { "type": "CommentLine", "value": " arbitrary comment", - "start": 14, - "end": 34, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 20 - } - } + "start":14,"end":34,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":20}} }, { "type": "CommentLine", "value": " @flow", - "start": 35, - "end": 43, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 8 - } - } + "start":35,"end":43,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":8}} } ] } \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/pragma/5/output.json b/packages/babel-parser/test/fixtures/flow/pragma/5/output.json index c59fb12c869d..9bbad04360d3 100644 --- a/packages/babel-parser/test/fixtures/flow/pragma/5/output.json +++ b/packages/babel-parser/test/fixtures/flow/pragma/5/output.json @@ -1,139 +1,38 @@ { "type": "File", - "start": 0, - "end": 74, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 10 - } - }, + "start":0,"end":74,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":10}}, "program": { "type": "Program", - "start": 0, - "end": 74, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 10 - } - }, + "start":0,"end":74,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":10}}, "sourceType": "module", "interpreter": { "type": "InterpreterDirective", - "start": 0, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, "value": "/usr/bin/env node" }, "body": [ { "type": "ExpressionStatement", - "start": 64, - "end": 74, - "loc": { - "start": { - "line": 5, - "column": 0 - }, - "end": { - "line": 5, - "column": 10 - } - }, + "start":64,"end":74,"loc":{"start":{"line":5,"column":0},"end":{"line":5,"column":10}}, "expression": { "type": "CallExpression", - "start": 64, - "end": 73, - "loc": { - "start": { - "line": 5, - "column": 0 - }, - "end": { - "line": 5, - "column": 9 - } - }, + "start":64,"end":73,"loc":{"start":{"line":5,"column":0},"end":{"line":5,"column":9}}, "callee": { "type": "Identifier", - "start": 64, - "end": 67, - "loc": { - "start": { - "line": 5, - "column": 0 - }, - "end": { - "line": 5, - "column": 3 - }, - "identifierName": "foo" - }, + "start":64,"end":67,"loc":{"start":{"line":5,"column":0},"end":{"line":5,"column":3},"identifierName":"foo"}, "name": "foo" }, "typeArguments": { "type": "TypeParameterInstantiation", - "start": 67, - "end": 70, - "loc": { - "start": { - "line": 5, - "column": 3 - }, - "end": { - "line": 5, - "column": 6 - } - }, + "start":67,"end":70,"loc":{"start":{"line":5,"column":3},"end":{"line":5,"column":6}}, "params": [ { "type": "GenericTypeAnnotation", - "start": 68, - "end": 69, - "loc": { - "start": { - "line": 5, - "column": 4 - }, - "end": { - "line": 5, - "column": 5 - } - }, + "start":68,"end":69,"loc":{"start":{"line":5,"column":4},"end":{"line":5,"column":5}}, "typeParameters": null, "id": { "type": "Identifier", - "start": 68, - "end": 69, - "loc": { - "start": { - "line": 5, - "column": 4 - }, - "end": { - "line": 5, - "column": 5 - }, - "identifierName": "x" - }, + "start":68,"end":69,"loc":{"start":{"line":5,"column":4},"end":{"line":5,"column":5},"identifierName":"x"}, "name": "x" } } @@ -142,19 +41,7 @@ "arguments": [ { "type": "Identifier", - "start": 71, - "end": 72, - "loc": { - "start": { - "line": 5, - "column": 7 - }, - "end": { - "line": 5, - "column": 8 - }, - "identifierName": "y" - }, + "start":71,"end":72,"loc":{"start":{"line":5,"column":7},"end":{"line":5,"column":8},"identifierName":"y"}, "name": "y" } ] @@ -163,34 +50,12 @@ { "type": "CommentLine", "value": " arbitrary comment", - "start": 34, - "end": 54, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 20 - } - } + "start":34,"end":54,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":20}} }, { "type": "CommentLine", "value": " @flow", - "start": 55, - "end": 63, - "loc": { - "start": { - "line": 4, - "column": 0 - }, - "end": { - "line": 4, - "column": 8 - } - } + "start":55,"end":63,"loc":{"start":{"line":4,"column":0},"end":{"line":4,"column":8}} } ] } @@ -198,32 +63,10 @@ "directives": [ { "type": "Directive", - "start": 20, - "end": 33, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 13 - } - }, + "start":20,"end":33,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":13}}, "value": { "type": "DirectiveLiteral", - "start": 20, - "end": 32, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 12 - } - }, + "start":20,"end":32,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":12}}, "value": "use strict", "extra": { "raw": "'use strict'", @@ -234,34 +77,12 @@ { "type": "CommentLine", "value": " arbitrary comment", - "start": 34, - "end": 54, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 20 - } - } + "start":34,"end":54,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":20}} }, { "type": "CommentLine", "value": " @flow", - "start": 55, - "end": 63, - "loc": { - "start": { - "line": 4, - "column": 0 - }, - "end": { - "line": 4, - "column": 8 - } - } + "start":55,"end":63,"loc":{"start":{"line":4,"column":0},"end":{"line":4,"column":8}} } ] } @@ -271,34 +92,12 @@ { "type": "CommentLine", "value": " arbitrary comment", - "start": 34, - "end": 54, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 20 - } - } + "start":34,"end":54,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":20}} }, { "type": "CommentLine", "value": " @flow", - "start": 55, - "end": 63, - "loc": { - "start": { - "line": 4, - "column": 0 - }, - "end": { - "line": 4, - "column": 8 - } - } + "start":55,"end":63,"loc":{"start":{"line":4,"column":0},"end":{"line":4,"column":8}} } ] } \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/predicates/1/output.json b/packages/babel-parser/test/fixtures/flow/predicates/1/output.json index 64f82d5d024b..bd9ce6276726 100644 --- a/packages/babel-parser/test/fixtures/flow/predicates/1/output.json +++ b/packages/babel-parser/test/fixtures/flow/predicates/1/output.json @@ -1,222 +1,65 @@ { "type": "File", - "start": 0, - "end": 60, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 60 - } - }, + "start":0,"end":60,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":60}}, "program": { "type": "Program", - "start": 0, - "end": 60, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 60 - } - }, + "start":0,"end":60,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":60}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "DeclareFunction", - "start": 0, - "end": 60, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 60 - } - }, + "start":0,"end":60,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":60}}, "id": { "type": "Identifier", - "start": 17, - "end": 59, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 59 - }, - "identifierName": "foo" - }, + "start":17,"end":59,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":59},"identifierName":"foo"}, "name": "foo", "typeAnnotation": { "type": "TypeAnnotation", - "start": 20, - "end": 59, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 59 - } - }, + "start":20,"end":59,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":59}}, "typeAnnotation": { "type": "FunctionTypeAnnotation", - "start": 20, - "end": 59, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 59 - } - }, + "start":20,"end":59,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":59}}, "typeParameters": null, "params": [ { "type": "FunctionTypeParam", - "start": 21, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":21,"end":29,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":29}}, "name": { "type": "Identifier", - "start": 21, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 22 - }, - "identifierName": "x" - }, + "start":21,"end":22,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":22},"identifierName":"x"}, "name": "x" }, "optional": false, "typeAnnotation": { "type": "MixedTypeAnnotation", - "start": 24, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 29 - } - } + "start":24,"end":29,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":29}} } } ], "rest": null, "returnType": { "type": "BooleanTypeAnnotation", - "start": 32, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 32 - }, - "end": { - "line": 1, - "column": 39 - } - } + "start":32,"end":39,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":39}} } } } }, "predicate": { "type": "DeclaredPredicate", - "start": 40, - "end": 59, - "loc": { - "start": { - "line": 1, - "column": 40 - }, - "end": { - "line": 1, - "column": 59 - } - }, + "start":40,"end":59,"loc":{"start":{"line":1,"column":40},"end":{"line":1,"column":59}}, "value": { "type": "BinaryExpression", - "start": 48, - "end": 58, - "loc": { - "start": { - "line": 1, - "column": 48 - }, - "end": { - "line": 1, - "column": 58 - } - }, + "start":48,"end":58,"loc":{"start":{"line":1,"column":48},"end":{"line":1,"column":58}}, "left": { "type": "Identifier", - "start": 48, - "end": 49, - "loc": { - "start": { - "line": 1, - "column": 48 - }, - "end": { - "line": 1, - "column": 49 - }, - "identifierName": "x" - }, + "start":48,"end":49,"loc":{"start":{"line":1,"column":48},"end":{"line":1,"column":49},"identifierName":"x"}, "name": "x" }, "operator": "!==", "right": { "type": "NullLiteral", - "start": 54, - "end": 58, - "loc": { - "start": { - "line": 1, - "column": 54 - }, - "end": { - "line": 1, - "column": 58 - } - } + "start":54,"end":58,"loc":{"start":{"line":1,"column":54},"end":{"line":1,"column":58}} } } } diff --git a/packages/babel-parser/test/fixtures/flow/predicates/2/output.json b/packages/babel-parser/test/fixtures/flow/predicates/2/output.json index 7e19b6bc6f0f..de15b429989f 100644 --- a/packages/babel-parser/test/fixtures/flow/predicates/2/output.json +++ b/packages/babel-parser/test/fixtures/flow/predicates/2/output.json @@ -1,108 +1,30 @@ { "type": "File", - "start": 0, - "end": 53, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 53 - } - }, + "start":0,"end":53,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":53}}, "program": { "type": "Program", - "start": 0, - "end": 53, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 53 - } - }, + "start":0,"end":53,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":53}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 53, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 53 - } - }, + "start":0,"end":53,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":53}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 52, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 52 - } - }, + "start":4,"end":52,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":52}}, "id": { "type": "Identifier", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "f" - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"f"}, "name": "f" }, "init": { "type": "ArrowFunctionExpression", - "start": 8, - "end": 52, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 52 - } - }, + "start":8,"end":52,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":52}}, "predicate": { "type": "InferredPredicate", - "start": 20, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 27 - } - } + "start":20,"end":27,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":27}} }, "returnType": null, "id": null, @@ -111,115 +33,36 @@ "params": [ { "type": "Identifier", - "start": 9, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 17 - }, - "identifierName": "x" - }, + "start":9,"end":17,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":17},"identifierName":"x"}, "name": "x", "typeAnnotation": { "type": "TypeAnnotation", - "start": 10, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":10,"end":17,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":17}}, "typeAnnotation": { "type": "MixedTypeAnnotation", - "start": 12, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 17 - } - } + "start":12,"end":17,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":17}} } } } ], "body": { "type": "BinaryExpression", - "start": 31, - "end": 52, - "loc": { - "start": { - "line": 1, - "column": 31 - }, - "end": { - "line": 1, - "column": 52 - } - }, + "start":31,"end":52,"loc":{"start":{"line":1,"column":31},"end":{"line":1,"column":52}}, "left": { "type": "UnaryExpression", - "start": 31, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 31 - }, - "end": { - "line": 1, - "column": 39 - } - }, + "start":31,"end":39,"loc":{"start":{"line":1,"column":31},"end":{"line":1,"column":39}}, "operator": "typeof", "prefix": true, "argument": { "type": "Identifier", - "start": 38, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 38 - }, - "end": { - "line": 1, - "column": 39 - }, - "identifierName": "x" - }, + "start":38,"end":39,"loc":{"start":{"line":1,"column":38},"end":{"line":1,"column":39},"identifierName":"x"}, "name": "x" } }, "operator": "===", "right": { "type": "StringLiteral", - "start": 44, - "end": 52, - "loc": { - "start": { - "line": 1, - "column": 44 - }, - "end": { - "line": 1, - "column": 52 - } - }, + "start":44,"end":52,"loc":{"start":{"line":1,"column":44},"end":{"line":1,"column":52}}, "extra": { "rawValue": "string", "raw": "\"string\"" diff --git a/packages/babel-parser/test/fixtures/flow/predicates/3/output.json b/packages/babel-parser/test/fixtures/flow/predicates/3/output.json index e8ead5713f0c..4f88107d4f57 100644 --- a/packages/babel-parser/test/fixtures/flow/predicates/3/output.json +++ b/packages/babel-parser/test/fixtures/flow/predicates/3/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 66, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 66 - } - }, + "start":0,"end":66,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":66}}, "program": { "type": "Program", - "start": 0, - "end": 66, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 66 - } - }, + "start":0,"end":66,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":66}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 65, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 65 - } - }, + "start":0,"end":65,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":65}}, "id": { "type": "Identifier", - "start": 9, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "foo" - }, + "start":9,"end":12,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":12},"identifierName":"foo"}, "name": "foo" }, "generator": false, @@ -65,160 +20,48 @@ "params": [ { "type": "Identifier", - "start": 13, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 21 - }, - "identifierName": "x" - }, + "start":13,"end":21,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":21},"identifierName":"x"}, "name": "x", "typeAnnotation": { "type": "TypeAnnotation", - "start": 14, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":14,"end":21,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":21}}, "typeAnnotation": { "type": "MixedTypeAnnotation", - "start": 16, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 21 - } - } + "start":16,"end":21,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":21}} } } } ], "predicate": { "type": "InferredPredicate", - "start": 24, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 31 - } - } + "start":24,"end":31,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":31}} }, "returnType": null, "body": { "type": "BlockStatement", - "start": 32, - "end": 65, - "loc": { - "start": { - "line": 1, - "column": 32 - }, - "end": { - "line": 1, - "column": 65 - } - }, + "start":32,"end":65,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":65}}, "body": [ { "type": "ReturnStatement", - "start": 34, - "end": 63, - "loc": { - "start": { - "line": 1, - "column": 34 - }, - "end": { - "line": 1, - "column": 63 - } - }, + "start":34,"end":63,"loc":{"start":{"line":1,"column":34},"end":{"line":1,"column":63}}, "argument": { "type": "BinaryExpression", - "start": 41, - "end": 62, - "loc": { - "start": { - "line": 1, - "column": 41 - }, - "end": { - "line": 1, - "column": 62 - } - }, + "start":41,"end":62,"loc":{"start":{"line":1,"column":41},"end":{"line":1,"column":62}}, "left": { "type": "UnaryExpression", - "start": 41, - "end": 49, - "loc": { - "start": { - "line": 1, - "column": 41 - }, - "end": { - "line": 1, - "column": 49 - } - }, + "start":41,"end":49,"loc":{"start":{"line":1,"column":41},"end":{"line":1,"column":49}}, "operator": "typeof", "prefix": true, "argument": { "type": "Identifier", - "start": 48, - "end": 49, - "loc": { - "start": { - "line": 1, - "column": 48 - }, - "end": { - "line": 1, - "column": 49 - }, - "identifierName": "x" - }, + "start":48,"end":49,"loc":{"start":{"line":1,"column":48},"end":{"line":1,"column":49},"identifierName":"x"}, "name": "x" } }, "operator": "===", "right": { "type": "StringLiteral", - "start": 54, - "end": 62, - "loc": { - "start": { - "line": 1, - "column": 54 - }, - "end": { - "line": 1, - "column": 62 - } - }, + "start":54,"end":62,"loc":{"start":{"line":1,"column":54},"end":{"line":1,"column":62}}, "extra": { "rawValue": "string", "raw": "\"string\"" @@ -233,18 +76,7 @@ }, { "type": "EmptyStatement", - "start": 65, - "end": 66, - "loc": { - "start": { - "line": 1, - "column": 65 - }, - "end": { - "line": 1, - "column": 66 - } - } + "start":65,"end":66,"loc":{"start":{"line":1,"column":65},"end":{"line":1,"column":66}} } ], "directives": [] diff --git a/packages/babel-parser/test/fixtures/flow/predicates/4/options.json b/packages/babel-parser/test/fixtures/flow/predicates/4/options.json deleted file mode 100644 index cec83fa54fba..000000000000 --- a/packages/babel-parser/test/fixtures/flow/predicates/4/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected token, expected \";\" (1:18)" -} diff --git a/packages/babel-parser/test/fixtures/flow/predicates/4/output.json b/packages/babel-parser/test/fixtures/flow/predicates/4/output.json new file mode 100644 index 000000000000..8c9ecb9c8b7d --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/predicates/4/output.json @@ -0,0 +1,84 @@ +{ + "type": "File", + "start":0,"end":54,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":54}}, + "errors": [ + "SyntaxError: Spaces between `%` and `checks` are not allowed here. (1:20)" + ], + "program": { + "type": "Program", + "start":0,"end":54,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":54}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start":0,"end":54,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":54}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":4,"end":53,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":53}}, + "id": { + "type": "Identifier", + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"f"}, + "name": "f" + }, + "init": { + "type": "ArrowFunctionExpression", + "start":8,"end":53,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":53}}, + "predicate": { + "type": "InferredPredicate", + "start":20,"end":28,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":28}} + }, + "returnType": null, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start":9,"end":17,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":17},"identifierName":"x"}, + "name": "x", + "typeAnnotation": { + "type": "TypeAnnotation", + "start":10,"end":17,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":17}}, + "typeAnnotation": { + "type": "MixedTypeAnnotation", + "start":12,"end":17,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":17}} + } + } + } + ], + "body": { + "type": "BinaryExpression", + "start":32,"end":53,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":53}}, + "left": { + "type": "UnaryExpression", + "start":32,"end":40,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":40}}, + "operator": "typeof", + "prefix": true, + "argument": { + "type": "Identifier", + "start":39,"end":40,"loc":{"start":{"line":1,"column":39},"end":{"line":1,"column":40},"identifierName":"x"}, + "name": "x" + } + }, + "operator": "===", + "right": { + "type": "StringLiteral", + "start":45,"end":53,"loc":{"start":{"line":1,"column":45},"end":{"line":1,"column":53}}, + "extra": { + "rawValue": "string", + "raw": "\"string\"" + }, + "value": "string" + } + } + } + } + ], + "kind": "var" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/predicates/5/options.json b/packages/babel-parser/test/fixtures/flow/predicates/5/options.json deleted file mode 100644 index dbdc7697ac5b..000000000000 --- a/packages/babel-parser/test/fixtures/flow/predicates/5/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Spaces between ´%´ and ´checks´ are not allowed here. (1:17)" -} diff --git a/packages/babel-parser/test/fixtures/flow/predicates/5/output.json b/packages/babel-parser/test/fixtures/flow/predicates/5/output.json new file mode 100644 index 000000000000..484e2d071713 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/predicates/5/output.json @@ -0,0 +1,75 @@ +{ + "type": "File", + "start":0,"end":61,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "errors": [ + "SyntaxError: Spaces between `%` and `checks` are not allowed here. (1:17)" + ], + "program": { + "type": "Program", + "start":0,"end":61,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":61,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "id": { + "type": "Identifier", + "start":9,"end":12,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":12},"identifierName":"foo"}, + "name": "foo" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start":13,"end":14,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":14},"identifierName":"x"}, + "name": "x" + } + ], + "predicate": { + "type": "InferredPredicate", + "start":17,"end":25,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":25}} + }, + "returnType": null, + "body": { + "type": "BlockStatement", + "start":26,"end":61,"loc":{"start":{"line":1,"column":26},"end":{"line":3,"column":1}}, + "body": [ + { + "type": "ReturnStatement", + "start":30,"end":59,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":31}}, + "argument": { + "type": "BinaryExpression", + "start":37,"end":58,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":30}}, + "left": { + "type": "UnaryExpression", + "start":37,"end":45,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":17}}, + "operator": "typeof", + "prefix": true, + "argument": { + "type": "Identifier", + "start":44,"end":45,"loc":{"start":{"line":2,"column":16},"end":{"line":2,"column":17},"identifierName":"x"}, + "name": "x" + } + }, + "operator": "===", + "right": { + "type": "StringLiteral", + "start":50,"end":58,"loc":{"start":{"line":2,"column":22},"end":{"line":2,"column":30}}, + "extra": { + "rawValue": "string", + "raw": "\"string\"" + }, + "value": "string" + } + } + } + ], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/predicates/6/output.json b/packages/babel-parser/test/fixtures/flow/predicates/6/output.json index 945e2bedf026..e3602f7e23c7 100644 --- a/packages/babel-parser/test/fixtures/flow/predicates/6/output.json +++ b/packages/babel-parser/test/fixtures/flow/predicates/6/output.json @@ -1,197 +1,53 @@ { "type": "File", - "start": 0, - "end": 86, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 86 - } - }, + "start":0,"end":86,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":86}}, "program": { "type": "Program", - "start": 0, - "end": 86, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 86 - } - }, + "start":0,"end":86,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":86}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "DeclareFunction", - "start": 0, - "end": 86, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 86 - } - }, + "start":0,"end":86,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":86}}, "id": { "type": "Identifier", - "start": 17, - "end": 85, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 85 - }, - "identifierName": "my_filter" - }, + "start":17,"end":85,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":85},"identifierName":"my_filter"}, "name": "my_filter", "typeAnnotation": { "type": "TypeAnnotation", - "start": 26, - "end": 85, - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 85 - } - }, + "start":26,"end":85,"loc":{"start":{"line":1,"column":26},"end":{"line":1,"column":85}}, "typeAnnotation": { "type": "FunctionTypeAnnotation", - "start": 26, - "end": 85, - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 85 - } - }, + "start":26,"end":85,"loc":{"start":{"line":1,"column":26},"end":{"line":1,"column":85}}, "typeParameters": { "type": "TypeParameterDeclaration", - "start": 26, - "end": 42, - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 42 - } - }, + "start":26,"end":42,"loc":{"start":{"line":1,"column":26},"end":{"line":1,"column":42}}, "params": [ { "type": "TypeParameter", - "start": 27, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":27,"end":28,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":28}}, "name": "T", "variance": null }, { "type": "TypeParameter", - "start": 30, - "end": 41, - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 1, - "column": 41 - } - }, + "start":30,"end":41,"loc":{"start":{"line":1,"column":30},"end":{"line":1,"column":41}}, "name": "P", "variance": null, "bound": { "type": "TypeAnnotation", - "start": 31, - "end": 41, - "loc": { - "start": { - "line": 1, - "column": 31 - }, - "end": { - "line": 1, - "column": 41 - } - }, + "start":31,"end":41,"loc":{"start":{"line":1,"column":31},"end":{"line":1,"column":41}}, "typeAnnotation": { "type": "GenericTypeAnnotation", - "start": 33, - "end": 41, - "loc": { - "start": { - "line": 1, - "column": 33 - }, - "end": { - "line": 1, - "column": 41 - } - }, + "start":33,"end":41,"loc":{"start":{"line":1,"column":33},"end":{"line":1,"column":41}}, "typeParameters": { "type": "TypeParameterInstantiation", - "start": 38, - "end": 41, - "loc": { - "start": { - "line": 1, - "column": 38 - }, - "end": { - "line": 1, - "column": 41 - } - }, + "start":38,"end":41,"loc":{"start":{"line":1,"column":38},"end":{"line":1,"column":41}}, "params": [ { "type": "NumberLiteralTypeAnnotation", - "start": 39, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 39 - }, - "end": { - "line": 1, - "column": 40 - } - }, + "start":39,"end":40,"loc":{"start":{"line":1,"column":39},"end":{"line":1,"column":40}}, "extra": { "rawValue": 1, "raw": "1" @@ -202,19 +58,7 @@ }, "id": { "type": "Identifier", - "start": 33, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 33 - }, - "end": { - "line": 1, - "column": 38 - }, - "identifierName": "$Pred" - }, + "start":33,"end":38,"loc":{"start":{"line":1,"column":33},"end":{"line":1,"column":38},"identifierName":"$Pred"}, "name": "$Pred" } } @@ -225,95 +69,27 @@ "params": [ { "type": "FunctionTypeParam", - "start": 43, - "end": 54, - "loc": { - "start": { - "line": 1, - "column": 43 - }, - "end": { - "line": 1, - "column": 54 - } - }, + "start":43,"end":54,"loc":{"start":{"line":1,"column":43},"end":{"line":1,"column":54}}, "name": { "type": "Identifier", - "start": 43, - "end": 44, - "loc": { - "start": { - "line": 1, - "column": 43 - }, - "end": { - "line": 1, - "column": 44 - }, - "identifierName": "v" - }, + "start":43,"end":44,"loc":{"start":{"line":1,"column":43},"end":{"line":1,"column":44},"identifierName":"v"}, "name": "v" }, "optional": false, "typeAnnotation": { "type": "GenericTypeAnnotation", - "start": 46, - "end": 54, - "loc": { - "start": { - "line": 1, - "column": 46 - }, - "end": { - "line": 1, - "column": 54 - } - }, + "start":46,"end":54,"loc":{"start":{"line":1,"column":46},"end":{"line":1,"column":54}}, "typeParameters": { "type": "TypeParameterInstantiation", - "start": 51, - "end": 54, - "loc": { - "start": { - "line": 1, - "column": 51 - }, - "end": { - "line": 1, - "column": 54 - } - }, + "start":51,"end":54,"loc":{"start":{"line":1,"column":51},"end":{"line":1,"column":54}}, "params": [ { "type": "GenericTypeAnnotation", - "start": 52, - "end": 53, - "loc": { - "start": { - "line": 1, - "column": 52 - }, - "end": { - "line": 1, - "column": 53 - } - }, + "start":52,"end":53,"loc":{"start":{"line":1,"column":52},"end":{"line":1,"column":53}}, "typeParameters": null, "id": { "type": "Identifier", - "start": 52, - "end": 53, - "loc": { - "start": { - "line": 1, - "column": 52 - }, - "end": { - "line": 1, - "column": 53 - }, - "identifierName": "T" - }, + "start":52,"end":53,"loc":{"start":{"line":1,"column":52},"end":{"line":1,"column":53},"identifierName":"T"}, "name": "T" } } @@ -321,85 +97,27 @@ }, "id": { "type": "Identifier", - "start": 46, - "end": 51, - "loc": { - "start": { - "line": 1, - "column": 46 - }, - "end": { - "line": 1, - "column": 51 - }, - "identifierName": "Array" - }, + "start":46,"end":51,"loc":{"start":{"line":1,"column":46},"end":{"line":1,"column":51},"identifierName":"Array"}, "name": "Array" } } }, { "type": "FunctionTypeParam", - "start": 56, - "end": 61, - "loc": { - "start": { - "line": 1, - "column": 56 - }, - "end": { - "line": 1, - "column": 61 - } - }, + "start":56,"end":61,"loc":{"start":{"line":1,"column":56},"end":{"line":1,"column":61}}, "name": { "type": "Identifier", - "start": 56, - "end": 58, - "loc": { - "start": { - "line": 1, - "column": 56 - }, - "end": { - "line": 1, - "column": 58 - }, - "identifierName": "cb" - }, + "start":56,"end":58,"loc":{"start":{"line":1,"column":56},"end":{"line":1,"column":58},"identifierName":"cb"}, "name": "cb" }, "optional": false, "typeAnnotation": { "type": "GenericTypeAnnotation", - "start": 60, - "end": 61, - "loc": { - "start": { - "line": 1, - "column": 60 - }, - "end": { - "line": 1, - "column": 61 - } - }, + "start":60,"end":61,"loc":{"start":{"line":1,"column":60},"end":{"line":1,"column":61}}, "typeParameters": null, "id": { "type": "Identifier", - "start": 60, - "end": 61, - "loc": { - "start": { - "line": 1, - "column": 60 - }, - "end": { - "line": 1, - "column": 61 - }, - "identifierName": "P" - }, + "start":60,"end":61,"loc":{"start":{"line":1,"column":60},"end":{"line":1,"column":61},"identifierName":"P"}, "name": "P" } } @@ -408,142 +126,41 @@ "rest": null, "returnType": { "type": "GenericTypeAnnotation", - "start": 64, - "end": 85, - "loc": { - "start": { - "line": 1, - "column": 64 - }, - "end": { - "line": 1, - "column": 85 - } - }, + "start":64,"end":85,"loc":{"start":{"line":1,"column":64},"end":{"line":1,"column":85}}, "typeParameters": { "type": "TypeParameterInstantiation", - "start": 69, - "end": 85, - "loc": { - "start": { - "line": 1, - "column": 69 - }, - "end": { - "line": 1, - "column": 85 - } - }, + "start":69,"end":85,"loc":{"start":{"line":1,"column":69},"end":{"line":1,"column":85}}, "params": [ { "type": "GenericTypeAnnotation", - "start": 70, - "end": 84, - "loc": { - "start": { - "line": 1, - "column": 70 - }, - "end": { - "line": 1, - "column": 84 - } - }, + "start":70,"end":84,"loc":{"start":{"line":1,"column":70},"end":{"line":1,"column":84}}, "typeParameters": { "type": "TypeParameterInstantiation", - "start": 77, - "end": 84, - "loc": { - "start": { - "line": 1, - "column": 77 - }, - "end": { - "line": 1, - "column": 84 - } - }, + "start":77,"end":84,"loc":{"start":{"line":1,"column":77},"end":{"line":1,"column":84}}, "params": [ { "type": "GenericTypeAnnotation", - "start": 78, - "end": 79, - "loc": { - "start": { - "line": 1, - "column": 78 - }, - "end": { - "line": 1, - "column": 79 - } - }, + "start":78,"end":79,"loc":{"start":{"line":1,"column":78},"end":{"line":1,"column":79}}, "typeParameters": null, "id": { "type": "Identifier", - "start": 78, - "end": 79, - "loc": { - "start": { - "line": 1, - "column": 78 - }, - "end": { - "line": 1, - "column": 79 - }, - "identifierName": "T" - }, + "start":78,"end":79,"loc":{"start":{"line":1,"column":78},"end":{"line":1,"column":79},"identifierName":"T"}, "name": "T" } }, { "type": "GenericTypeAnnotation", - "start": 80, - "end": 81, - "loc": { - "start": { - "line": 1, - "column": 80 - }, - "end": { - "line": 1, - "column": 81 - } - }, + "start":80,"end":81,"loc":{"start":{"line":1,"column":80},"end":{"line":1,"column":81}}, "typeParameters": null, "id": { "type": "Identifier", - "start": 80, - "end": 81, - "loc": { - "start": { - "line": 1, - "column": 80 - }, - "end": { - "line": 1, - "column": 81 - }, - "identifierName": "P" - }, + "start":80,"end":81,"loc":{"start":{"line":1,"column":80},"end":{"line":1,"column":81},"identifierName":"P"}, "name": "P" } }, { "type": "NumberLiteralTypeAnnotation", - "start": 82, - "end": 83, - "loc": { - "start": { - "line": 1, - "column": 82 - }, - "end": { - "line": 1, - "column": 83 - } - }, + "start":82,"end":83,"loc":{"start":{"line":1,"column":82},"end":{"line":1,"column":83}}, "extra": { "rawValue": 1, "raw": "1" @@ -554,19 +171,7 @@ }, "id": { "type": "Identifier", - "start": 70, - "end": 77, - "loc": { - "start": { - "line": 1, - "column": 70 - }, - "end": { - "line": 1, - "column": 77 - }, - "identifierName": "$Refine" - }, + "start":70,"end":77,"loc":{"start":{"line":1,"column":70},"end":{"line":1,"column":77},"identifierName":"$Refine"}, "name": "$Refine" } } @@ -574,19 +179,7 @@ }, "id": { "type": "Identifier", - "start": 64, - "end": 69, - "loc": { - "start": { - "line": 1, - "column": 64 - }, - "end": { - "line": 1, - "column": 69 - }, - "identifierName": "Array" - }, + "start":64,"end":69,"loc":{"start":{"line":1,"column":64},"end":{"line":1,"column":69},"identifierName":"Array"}, "name": "Array" } } diff --git a/packages/babel-parser/test/fixtures/flow/proto-props/declare-class/output.json b/packages/babel-parser/test/fixtures/flow/proto-props/declare-class/output.json index c4c890bf2247..3eb6751e1602 100644 --- a/packages/babel-parser/test/fixtures/flow/proto-props/declare-class/output.json +++ b/packages/babel-parser/test/fixtures/flow/proto-props/declare-class/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 102, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 11, - "column": 1 - } - }, + "start":0,"end":102,"loc":{"start":{"line":1,"column":0},"end":{"line":11,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 102, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 11, - "column": 1 - } - }, + "start":0,"end":102,"loc":{"start":{"line":1,"column":0},"end":{"line":11,"column":1}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "DeclareClass", - "start": 0, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "id": { "type": "Identifier", - "start": 14, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - }, - "identifierName": "A" - }, + "start":14,"end":15,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":15},"identifierName":"A"}, "name": "A" }, "typeParameters": null, @@ -66,49 +21,15 @@ "mixins": [], "body": { "type": "ObjectTypeAnnotation", - "start": 16, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":16,"end":31,"loc":{"start":{"line":1,"column":16},"end":{"line":3,"column":1}}, "callProperties": [], "properties": [ { "type": "ObjectTypeProperty", - "start": 20, - "end": 28, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 10 - } - }, + "start":20,"end":28,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":10}}, "key": { "type": "Identifier", - "start": 20, - "end": 25, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 7 - }, - "identifierName": "proto" - }, + "start":20,"end":25,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":7},"identifierName":"proto"}, "name": "proto" }, "static": false, @@ -117,34 +38,11 @@ "method": false, "value": { "type": "GenericTypeAnnotation", - "start": 27, - "end": 28, - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 10 - } - }, + "start":27,"end":28,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":10}}, "typeParameters": null, "id": { "type": "Identifier", - "start": 27, - "end": 28, - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 10 - }, - "identifierName": "T" - }, + "start":27,"end":28,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":10},"identifierName":"T"}, "name": "T" } }, @@ -159,33 +57,10 @@ }, { "type": "DeclareClass", - "start": 33, - "end": 66, - "loc": { - "start": { - "line": 5, - "column": 0 - }, - "end": { - "line": 7, - "column": 1 - } - }, + "start":33,"end":66,"loc":{"start":{"line":5,"column":0},"end":{"line":7,"column":1}}, "id": { "type": "Identifier", - "start": 47, - "end": 48, - "loc": { - "start": { - "line": 5, - "column": 14 - }, - "end": { - "line": 5, - "column": 15 - }, - "identifierName": "B" - }, + "start":47,"end":48,"loc":{"start":{"line":5,"column":14},"end":{"line":5,"column":15},"identifierName":"B"}, "name": "B" }, "typeParameters": null, @@ -194,49 +69,15 @@ "mixins": [], "body": { "type": "ObjectTypeAnnotation", - "start": 49, - "end": 66, - "loc": { - "start": { - "line": 5, - "column": 16 - }, - "end": { - "line": 7, - "column": 1 - } - }, + "start":49,"end":66,"loc":{"start":{"line":5,"column":16},"end":{"line":7,"column":1}}, "callProperties": [], "properties": [ { "type": "ObjectTypeProperty", - "start": 53, - "end": 63, - "loc": { - "start": { - "line": 6, - "column": 2 - }, - "end": { - "line": 6, - "column": 12 - } - }, + "start":53,"end":63,"loc":{"start":{"line":6,"column":2},"end":{"line":6,"column":12}}, "key": { "type": "Identifier", - "start": 59, - "end": 60, - "loc": { - "start": { - "line": 6, - "column": 8 - }, - "end": { - "line": 6, - "column": 9 - }, - "identifierName": "x" - }, + "start":59,"end":60,"loc":{"start":{"line":6,"column":8},"end":{"line":6,"column":9},"identifierName":"x"}, "name": "x" }, "static": false, @@ -245,34 +86,11 @@ "method": false, "value": { "type": "GenericTypeAnnotation", - "start": 62, - "end": 63, - "loc": { - "start": { - "line": 6, - "column": 11 - }, - "end": { - "line": 6, - "column": 12 - } - }, + "start":62,"end":63,"loc":{"start":{"line":6,"column":11},"end":{"line":6,"column":12}}, "typeParameters": null, "id": { "type": "Identifier", - "start": 62, - "end": 63, - "loc": { - "start": { - "line": 6, - "column": 11 - }, - "end": { - "line": 6, - "column": 12 - }, - "identifierName": "T" - }, + "start":62,"end":63,"loc":{"start":{"line":6,"column":11},"end":{"line":6,"column":12},"identifierName":"T"}, "name": "T" } }, @@ -287,33 +105,10 @@ }, { "type": "DeclareClass", - "start": 68, - "end": 102, - "loc": { - "start": { - "line": 9, - "column": 0 - }, - "end": { - "line": 11, - "column": 1 - } - }, + "start":68,"end":102,"loc":{"start":{"line":9,"column":0},"end":{"line":11,"column":1}}, "id": { "type": "Identifier", - "start": 82, - "end": 83, - "loc": { - "start": { - "line": 9, - "column": 14 - }, - "end": { - "line": 9, - "column": 15 - }, - "identifierName": "C" - }, + "start":82,"end":83,"loc":{"start":{"line":9,"column":14},"end":{"line":9,"column":15},"identifierName":"C"}, "name": "C" }, "typeParameters": null, @@ -322,49 +117,15 @@ "mixins": [], "body": { "type": "ObjectTypeAnnotation", - "start": 84, - "end": 102, - "loc": { - "start": { - "line": 9, - "column": 16 - }, - "end": { - "line": 11, - "column": 1 - } - }, + "start":84,"end":102,"loc":{"start":{"line":9,"column":16},"end":{"line":11,"column":1}}, "callProperties": [], "properties": [ { "type": "ObjectTypeProperty", - "start": 88, - "end": 99, - "loc": { - "start": { - "line": 10, - "column": 2 - }, - "end": { - "line": 10, - "column": 13 - } - }, + "start":88,"end":99,"loc":{"start":{"line":10,"column":2},"end":{"line":10,"column":13}}, "key": { "type": "Identifier", - "start": 95, - "end": 96, - "loc": { - "start": { - "line": 10, - "column": 9 - }, - "end": { - "line": 10, - "column": 10 - }, - "identifierName": "x" - }, + "start":95,"end":96,"loc":{"start":{"line":10,"column":9},"end":{"line":10,"column":10},"identifierName":"x"}, "name": "x" }, "static": false, @@ -373,51 +134,17 @@ "method": false, "value": { "type": "GenericTypeAnnotation", - "start": 98, - "end": 99, - "loc": { - "start": { - "line": 10, - "column": 12 - }, - "end": { - "line": 10, - "column": 13 - } - }, + "start":98,"end":99,"loc":{"start":{"line":10,"column":12},"end":{"line":10,"column":13}}, "typeParameters": null, "id": { "type": "Identifier", - "start": 98, - "end": 99, - "loc": { - "start": { - "line": 10, - "column": 12 - }, - "end": { - "line": 10, - "column": 13 - }, - "identifierName": "T" - }, + "start":98,"end":99,"loc":{"start":{"line":10,"column":12},"end":{"line":10,"column":13},"identifierName":"T"}, "name": "T" } }, "variance": { "type": "Variance", - "start": 94, - "end": 95, - "loc": { - "start": { - "line": 10, - "column": 8 - }, - "end": { - "line": 10, - "column": 9 - } - }, + "start":94,"end":95,"loc":{"start":{"line":10,"column":8},"end":{"line":10,"column":9}}, "kind": "plus" }, "optional": false diff --git a/packages/babel-parser/test/fixtures/flow/qualified-generic-type/1/output.json b/packages/babel-parser/test/fixtures/flow/qualified-generic-type/1/output.json index ceb8577ee6fb..27f21b74328c 100644 --- a/packages/babel-parser/test/fixtures/flow/qualified-generic-type/1/output.json +++ b/packages/babel-parser/test/fixtures/flow/qualified-generic-type/1/output.json @@ -1,154 +1,41 @@ { "type": "File", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "program": { "type": "Program", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":4,"end":11,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":11}}, "id": { "type": "Identifier", - "start": 4, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "a" - }, + "start":4,"end":11,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":11},"identifierName":"a"}, "name": "a", "typeAnnotation": { "type": "TypeAnnotation", - "start": 6, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":6,"end":11,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":11}}, "typeAnnotation": { "type": "GenericTypeAnnotation", - "start": 8, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":8,"end":11,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":11}}, "typeParameters": null, "id": { "type": "QualifiedTypeIdentifier", - "start": 8, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":8,"end":11,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":11}}, "qualification": { "type": "Identifier", - "start": 8, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "A" - }, + "start":8,"end":9,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":9},"identifierName":"A"}, "name": "A" }, "id": { "type": "Identifier", - "start": 10, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "B" - }, + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11},"identifierName":"B"}, "name": "B" } } diff --git a/packages/babel-parser/test/fixtures/flow/qualified-generic-type/2/output.json b/packages/babel-parser/test/fixtures/flow/qualified-generic-type/2/output.json index b0b946f1c269..fb91bcb296dc 100644 --- a/packages/babel-parser/test/fixtures/flow/qualified-generic-type/2/output.json +++ b/packages/babel-parser/test/fixtures/flow/qualified-generic-type/2/output.json @@ -1,186 +1,50 @@ { "type": "File", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "program": { "type": "Program", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":4,"end":13,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":13}}, "id": { "type": "Identifier", - "start": 4, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 13 - }, - "identifierName": "a" - }, + "start":4,"end":13,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":13},"identifierName":"a"}, "name": "a", "typeAnnotation": { "type": "TypeAnnotation", - "start": 6, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":6,"end":13,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":13}}, "typeAnnotation": { "type": "GenericTypeAnnotation", - "start": 8, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":8,"end":13,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":13}}, "typeParameters": null, "id": { "type": "QualifiedTypeIdentifier", - "start": 8, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":8,"end":13,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":13}}, "qualification": { "type": "QualifiedTypeIdentifier", - "start": 8, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":8,"end":11,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":11}}, "qualification": { "type": "Identifier", - "start": 8, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "A" - }, + "start":8,"end":9,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":9},"identifierName":"A"}, "name": "A" }, "id": { "type": "Identifier", - "start": 10, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "B" - }, + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11},"identifierName":"B"}, "name": "B" } }, "id": { "type": "Identifier", - "start": 12, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - }, - "identifierName": "C" - }, + "start":12,"end":13,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":13},"identifierName":"C"}, "name": "C" } } diff --git a/packages/babel-parser/test/fixtures/flow/qualified-generic-type/3/output.json b/packages/babel-parser/test/fixtures/flow/qualified-generic-type/3/output.json index 8ce86cb8f9c9..348a23ff9fb6 100644 --- a/packages/babel-parser/test/fixtures/flow/qualified-generic-type/3/output.json +++ b/packages/babel-parser/test/fixtures/flow/qualified-generic-type/3/output.json @@ -1,152 +1,40 @@ { "type": "File", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "program": { "type": "Program", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":4,"end":14,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":14}}, "id": { "type": "Identifier", - "start": 4, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 14 - }, - "identifierName": "a" - }, + "start":4,"end":14,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":14},"identifierName":"a"}, "name": "a", "typeAnnotation": { "type": "TypeAnnotation", - "start": 6, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":6,"end":14,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":14}}, "typeAnnotation": { "type": "GenericTypeAnnotation", - "start": 8, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":8,"end":14,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":14}}, "typeParameters": { "type": "TypeParameterInstantiation", - "start": 11, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":11,"end":14,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":14}}, "params": [ { "type": "GenericTypeAnnotation", - "start": 12, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":12,"end":13,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":13}}, "typeParameters": null, "id": { "type": "Identifier", - "start": 12, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - }, - "identifierName": "T" - }, + "start":12,"end":13,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":13},"identifierName":"T"}, "name": "T" } } @@ -154,50 +42,15 @@ }, "id": { "type": "QualifiedTypeIdentifier", - "start": 8, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":8,"end":11,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":11}}, "qualification": { "type": "Identifier", - "start": 8, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "A" - }, + "start":8,"end":9,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":9},"identifierName":"A"}, "name": "A" }, "id": { "type": "Identifier", - "start": 10, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "B" - }, + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11},"identifierName":"B"}, "name": "B" } } diff --git a/packages/babel-parser/test/fixtures/flow/qualified-generic-type/4/output.json b/packages/babel-parser/test/fixtures/flow/qualified-generic-type/4/output.json index 7838f04a0adb..b79a2c17e310 100644 --- a/packages/babel-parser/test/fixtures/flow/qualified-generic-type/4/output.json +++ b/packages/babel-parser/test/fixtures/flow/qualified-generic-type/4/output.json @@ -1,166 +1,43 @@ { "type": "File", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, "program": { "type": "Program", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":4,"end":21,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":21}}, "id": { "type": "Identifier", - "start": 4, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 21 - }, - "identifierName": "a" - }, + "start":4,"end":21,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":21},"identifierName":"a"}, "name": "a", "typeAnnotation": { "type": "TypeAnnotation", - "start": 6, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":6,"end":21,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":21}}, "typeAnnotation": { "type": "TypeofTypeAnnotation", - "start": 8, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":8,"end":21,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":21}}, "argument": { "type": "GenericTypeAnnotation", - "start": 15, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":15,"end":21,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":21}}, "typeParameters": { "type": "TypeParameterInstantiation", - "start": 18, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":18,"end":21,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":21}}, "params": [ { "type": "GenericTypeAnnotation", - "start": 19, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":19,"end":20,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":20}}, "typeParameters": null, "id": { "type": "Identifier", - "start": 19, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 20 - }, - "identifierName": "T" - }, + "start":19,"end":20,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":20},"identifierName":"T"}, "name": "T" } } @@ -168,50 +45,15 @@ }, "id": { "type": "QualifiedTypeIdentifier", - "start": 15, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":15,"end":18,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":18}}, "qualification": { "type": "Identifier", - "start": 15, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - }, - "identifierName": "A" - }, + "start":15,"end":16,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":16},"identifierName":"A"}, "name": "A" }, "id": { "type": "Identifier", - "start": 17, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - }, - "identifierName": "B" - }, + "start":17,"end":18,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":18},"identifierName":"B"}, "name": "B" } } diff --git a/packages/babel-parser/test/fixtures/flow/regression/arrow-function-with-newline/output.json b/packages/babel-parser/test/fixtures/flow/regression/arrow-function-with-newline/output.json index acc286d064ad..7722bab4ad0e 100644 --- a/packages/babel-parser/test/fixtures/flow/regression/arrow-function-with-newline/output.json +++ b/packages/babel-parser/test/fixtures/flow/regression/arrow-function-with-newline/output.json @@ -1,106 +1,28 @@ { "type": "File", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 10 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":10}}, "program": { "type": "Program", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 10 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":10}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 10 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":10}}, "expression": { "type": "ArrowFunctionExpression", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 10 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":10}}, "returnType": { "type": "TypeAnnotation", - "start": 10, - "end": 13, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 3 - } - }, + "start":10,"end":13,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":3}}, "typeAnnotation": { "type": "GenericTypeAnnotation", - "start": 12, - "end": 13, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 3 - } - }, + "start":12,"end":13,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":3}}, "typeParameters": null, "id": { "type": "Identifier", - "start": 12, - "end": 13, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 3 - }, - "identifierName": "t" - }, + "start":12,"end":13,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":3},"identifierName":"t"}, "name": "t" } } @@ -111,36 +33,13 @@ "params": [ { "type": "Identifier", - "start": 7, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - }, - "identifierName": "f" - }, + "start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8},"identifierName":"f"}, "name": "f" } ], "body": { "type": "BlockStatement", - "start": 17, - "end": 20, - "loc": { - "start": { - "line": 2, - "column": 7 - }, - "end": { - "line": 2, - "column": 10 - } - }, + "start":17,"end":20,"loc":{"start":{"line":2,"column":7},"end":{"line":2,"column":10}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/flow/regression/arrow-in-ternary-with-param-type-and-return-type-like/input.js b/packages/babel-parser/test/fixtures/flow/regression/arrow-in-ternary-with-param-type-and-return-type-like/input.js new file mode 100644 index 000000000000..1f0c3e33482c --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/regression/arrow-in-ternary-with-param-type-and-return-type-like/input.js @@ -0,0 +1,2 @@ +test + ? (x: T): U => y diff --git a/packages/babel-parser/test/fixtures/flow/regression/arrow-in-ternary-with-param-type-and-return-type-like/output.json b/packages/babel-parser/test/fixtures/flow/regression/arrow-in-ternary-with-param-type-and-return-type-like/output.json new file mode 100644 index 000000000000..d1defb7ec148 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/regression/arrow-in-ternary-with-param-type-and-return-type-like/output.json @@ -0,0 +1,72 @@ +{ + "type": "File", + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":18}}, + "program": { + "type": "Program", + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":18}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":18}}, + "expression": { + "type": "ConditionalExpression", + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":18}}, + "test": { + "type": "Identifier", + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4},"identifierName":"test"}, + "name": "test" + }, + "consequent": { + "type": "TypeCastExpression", + "start":10,"end":14,"loc":{"start":{"line":2,"column":5},"end":{"line":2,"column":9}}, + "expression": { + "type": "Identifier", + "start":10,"end":11,"loc":{"start":{"line":2,"column":5},"end":{"line":2,"column":6},"identifierName":"x"}, + "name": "x" + }, + "typeAnnotation": { + "type": "TypeAnnotation", + "start":11,"end":14,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":9}}, + "typeAnnotation": { + "type": "GenericTypeAnnotation", + "start":13,"end":14,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":9}}, + "typeParameters": null, + "id": { + "type": "Identifier", + "start":13,"end":14,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":9},"identifierName":"T"}, + "name": "T" + } + } + }, + "extra": { + "parenthesized": true, + "parenStart": 9 + } + }, + "alternate": { + "type": "ArrowFunctionExpression", + "start":17,"end":23,"loc":{"start":{"line":2,"column":12},"end":{"line":2,"column":18}}, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start":17,"end":18,"loc":{"start":{"line":2,"column":12},"end":{"line":2,"column":13},"identifierName":"U"}, + "name": "U" + } + ], + "body": { + "type": "Identifier", + "start":22,"end":23,"loc":{"start":{"line":2,"column":17},"end":{"line":2,"column":18},"identifierName":"y"}, + "name": "y" + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/regression/arrow-in-ternary-with-param-type-and-return-type/input.js b/packages/babel-parser/test/fixtures/flow/regression/arrow-in-ternary-with-param-type-and-return-type/input.js new file mode 100644 index 000000000000..a36f5ca0c5d8 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/regression/arrow-in-ternary-with-param-type-and-return-type/input.js @@ -0,0 +1,3 @@ +test + ? (x: T): U => y + : z \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/regression/arrow-in-ternary-with-param-type-and-return-type/output.json b/packages/babel-parser/test/fixtures/flow/regression/arrow-in-ternary-with-param-type-and-return-type/output.json new file mode 100644 index 000000000000..405840d57dbd --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/regression/arrow-in-ternary-with-param-type-and-return-type/output.json @@ -0,0 +1,79 @@ +{ + "type": "File", + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":5}}, + "program": { + "type": "Program", + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":5}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":5}}, + "expression": { + "type": "ConditionalExpression", + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":5}}, + "test": { + "type": "Identifier", + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4},"identifierName":"test"}, + "name": "test" + }, + "consequent": { + "type": "ArrowFunctionExpression", + "start":9,"end":23,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":18}}, + "predicate": null, + "returnType": { + "type": "TypeAnnotation", + "start":15,"end":18,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":13}}, + "typeAnnotation": { + "type": "GenericTypeAnnotation", + "start":17,"end":18,"loc":{"start":{"line":2,"column":12},"end":{"line":2,"column":13}}, + "typeParameters": null, + "id": { + "type": "Identifier", + "start":17,"end":18,"loc":{"start":{"line":2,"column":12},"end":{"line":2,"column":13},"identifierName":"U"}, + "name": "U" + } + } + }, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start":10,"end":14,"loc":{"start":{"line":2,"column":5},"end":{"line":2,"column":9},"identifierName":"x"}, + "name": "x", + "typeAnnotation": { + "type": "TypeAnnotation", + "start":11,"end":14,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":9}}, + "typeAnnotation": { + "type": "GenericTypeAnnotation", + "start":13,"end":14,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":9}}, + "typeParameters": null, + "id": { + "type": "Identifier", + "start":13,"end":14,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":9},"identifierName":"T"}, + "name": "T" + } + } + } + } + ], + "body": { + "type": "Identifier", + "start":22,"end":23,"loc":{"start":{"line":2,"column":17},"end":{"line":2,"column":18},"identifierName":"y"}, + "name": "y" + } + }, + "alternate": { + "type": "Identifier", + "start":28,"end":29,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":5},"identifierName":"z"}, + "name": "z" + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/regression/issue-10044/input.js b/packages/babel-parser/test/fixtures/flow/regression/issue-10044/input.js new file mode 100644 index 000000000000..4d3e8c48a837 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/regression/issue-10044/input.js @@ -0,0 +1,8 @@ +declare class C1 {} +declare interface I1 {} +declare type T1 = number; + +interface I2 {} +type T2 = number; + +export type { C1, I1, I2, T1, T2 } diff --git a/packages/babel-parser/test/fixtures/flow/regression/issue-10044/output.json b/packages/babel-parser/test/fixtures/flow/regression/issue-10044/output.json new file mode 100644 index 000000000000..538c7957485b --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/regression/issue-10044/output.json @@ -0,0 +1,186 @@ +{ + "type": "File", + "start":0,"end":140,"loc":{"start":{"line":1,"column":0},"end":{"line":8,"column":34}}, + "program": { + "type": "Program", + "start":0,"end":140,"loc":{"start":{"line":1,"column":0},"end":{"line":8,"column":34}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "DeclareClass", + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, + "id": { + "type": "Identifier", + "start":14,"end":16,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":16},"identifierName":"C1"}, + "name": "C1" + }, + "typeParameters": null, + "extends": [], + "implements": [], + "mixins": [], + "body": { + "type": "ObjectTypeAnnotation", + "start":17,"end":19,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":19}}, + "callProperties": [], + "properties": [], + "indexers": [], + "internalSlots": [], + "exact": false + } + }, + { + "type": "DeclareInterface", + "start":20,"end":43,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":23}}, + "id": { + "type": "Identifier", + "start":38,"end":40,"loc":{"start":{"line":2,"column":18},"end":{"line":2,"column":20},"identifierName":"I1"}, + "name": "I1" + }, + "typeParameters": null, + "extends": [], + "implements": [], + "mixins": [], + "body": { + "type": "ObjectTypeAnnotation", + "start":41,"end":43,"loc":{"start":{"line":2,"column":21},"end":{"line":2,"column":23}}, + "callProperties": [], + "properties": [], + "indexers": [], + "internalSlots": [], + "exact": false + } + }, + { + "type": "DeclareTypeAlias", + "start":44,"end":69,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":25}}, + "id": { + "type": "Identifier", + "start":57,"end":59,"loc":{"start":{"line":3,"column":13},"end":{"line":3,"column":15},"identifierName":"T1"}, + "name": "T1" + }, + "typeParameters": null, + "right": { + "type": "NumberTypeAnnotation", + "start":62,"end":68,"loc":{"start":{"line":3,"column":18},"end":{"line":3,"column":24}} + } + }, + { + "type": "InterfaceDeclaration", + "start":71,"end":86,"loc":{"start":{"line":5,"column":0},"end":{"line":5,"column":15}}, + "id": { + "type": "Identifier", + "start":81,"end":83,"loc":{"start":{"line":5,"column":10},"end":{"line":5,"column":12},"identifierName":"I2"}, + "name": "I2" + }, + "typeParameters": null, + "extends": [], + "implements": [], + "mixins": [], + "body": { + "type": "ObjectTypeAnnotation", + "start":84,"end":86,"loc":{"start":{"line":5,"column":13},"end":{"line":5,"column":15}}, + "callProperties": [], + "properties": [], + "indexers": [], + "internalSlots": [], + "exact": false + } + }, + { + "type": "TypeAlias", + "start":87,"end":104,"loc":{"start":{"line":6,"column":0},"end":{"line":6,"column":17}}, + "id": { + "type": "Identifier", + "start":92,"end":94,"loc":{"start":{"line":6,"column":5},"end":{"line":6,"column":7},"identifierName":"T2"}, + "name": "T2" + }, + "typeParameters": null, + "right": { + "type": "NumberTypeAnnotation", + "start":97,"end":103,"loc":{"start":{"line":6,"column":10},"end":{"line":6,"column":16}} + } + }, + { + "type": "ExportNamedDeclaration", + "start":106,"end":140,"loc":{"start":{"line":8,"column":0},"end":{"line":8,"column":34}}, + "specifiers": [ + { + "type": "ExportSpecifier", + "start":120,"end":122,"loc":{"start":{"line":8,"column":14},"end":{"line":8,"column":16}}, + "local": { + "type": "Identifier", + "start":120,"end":122,"loc":{"start":{"line":8,"column":14},"end":{"line":8,"column":16},"identifierName":"C1"}, + "name": "C1" + }, + "exported": { + "type": "Identifier", + "start":120,"end":122,"loc":{"start":{"line":8,"column":14},"end":{"line":8,"column":16},"identifierName":"C1"}, + "name": "C1" + } + }, + { + "type": "ExportSpecifier", + "start":124,"end":126,"loc":{"start":{"line":8,"column":18},"end":{"line":8,"column":20}}, + "local": { + "type": "Identifier", + "start":124,"end":126,"loc":{"start":{"line":8,"column":18},"end":{"line":8,"column":20},"identifierName":"I1"}, + "name": "I1" + }, + "exported": { + "type": "Identifier", + "start":124,"end":126,"loc":{"start":{"line":8,"column":18},"end":{"line":8,"column":20},"identifierName":"I1"}, + "name": "I1" + } + }, + { + "type": "ExportSpecifier", + "start":128,"end":130,"loc":{"start":{"line":8,"column":22},"end":{"line":8,"column":24}}, + "local": { + "type": "Identifier", + "start":128,"end":130,"loc":{"start":{"line":8,"column":22},"end":{"line":8,"column":24},"identifierName":"I2"}, + "name": "I2" + }, + "exported": { + "type": "Identifier", + "start":128,"end":130,"loc":{"start":{"line":8,"column":22},"end":{"line":8,"column":24},"identifierName":"I2"}, + "name": "I2" + } + }, + { + "type": "ExportSpecifier", + "start":132,"end":134,"loc":{"start":{"line":8,"column":26},"end":{"line":8,"column":28}}, + "local": { + "type": "Identifier", + "start":132,"end":134,"loc":{"start":{"line":8,"column":26},"end":{"line":8,"column":28},"identifierName":"T1"}, + "name": "T1" + }, + "exported": { + "type": "Identifier", + "start":132,"end":134,"loc":{"start":{"line":8,"column":26},"end":{"line":8,"column":28},"identifierName":"T1"}, + "name": "T1" + } + }, + { + "type": "ExportSpecifier", + "start":136,"end":138,"loc":{"start":{"line":8,"column":30},"end":{"line":8,"column":32}}, + "local": { + "type": "Identifier", + "start":136,"end":138,"loc":{"start":{"line":8,"column":30},"end":{"line":8,"column":32},"identifierName":"T2"}, + "name": "T2" + }, + "exported": { + "type": "Identifier", + "start":136,"end":138,"loc":{"start":{"line":8,"column":30},"end":{"line":8,"column":32},"identifierName":"T2"}, + "name": "T2" + } + } + ], + "source": null, + "exportKind": "type", + "declaration": null + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/regression/issue-10314/input.js b/packages/babel-parser/test/fixtures/flow/regression/issue-10314/input.js new file mode 100644 index 000000000000..3c830a898f38 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/regression/issue-10314/input.js @@ -0,0 +1,3 @@ +// @flow + +true ? async.waterfall() : null; diff --git a/packages/babel-parser/test/fixtures/flow/regression/issue-10314/output.json b/packages/babel-parser/test/fixtures/flow/regression/issue-10314/output.json new file mode 100644 index 000000000000..8bb74d389ae3 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/regression/issue-10314/output.json @@ -0,0 +1,64 @@ +{ + "type": "File", + "start":0,"end":42,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":32}}, + "program": { + "type": "Program", + "start":0,"end":42,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":32}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":10,"end":42,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":32}}, + "expression": { + "type": "ConditionalExpression", + "start":10,"end":41,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":31}}, + "test": { + "type": "BooleanLiteral", + "start":10,"end":14,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":4}}, + "value": true + }, + "consequent": { + "type": "CallExpression", + "start":17,"end":34,"loc":{"start":{"line":3,"column":7},"end":{"line":3,"column":24}}, + "callee": { + "type": "MemberExpression", + "start":17,"end":32,"loc":{"start":{"line":3,"column":7},"end":{"line":3,"column":22}}, + "object": { + "type": "Identifier", + "start":17,"end":22,"loc":{"start":{"line":3,"column":7},"end":{"line":3,"column":12},"identifierName":"async"}, + "name": "async" + }, + "property": { + "type": "Identifier", + "start":23,"end":32,"loc":{"start":{"line":3,"column":13},"end":{"line":3,"column":22},"identifierName":"waterfall"}, + "name": "waterfall" + }, + "computed": false + }, + "arguments": [] + }, + "alternate": { + "type": "NullLiteral", + "start":37,"end":41,"loc":{"start":{"line":3,"column":27},"end":{"line":3,"column":31}} + } + }, + "leadingComments": [ + { + "type": "CommentLine", + "value": " @flow", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}} + } + ] + } + ], + "directives": [] + }, + "comments": [ + { + "type": "CommentLine", + "value": " @flow", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}} + } + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/regression/issue-10675-class/input.js b/packages/babel-parser/test/fixtures/flow/regression/issue-10675-class/input.js new file mode 100644 index 000000000000..ba0916b8e4f9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/regression/issue-10675-class/input.js @@ -0,0 +1,2 @@ +class of {} + diff --git a/packages/babel-parser/test/fixtures/flow/regression/issue-10675-class/options.json b/packages/babel-parser/test/fixtures/flow/regression/issue-10675-class/options.json new file mode 100644 index 000000000000..7c91792f0e9c --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/regression/issue-10675-class/options.json @@ -0,0 +1,7 @@ +{ + "sourceType": "module", + "plugins": [ + "jsx", + "flow" + ] +} diff --git a/packages/babel-parser/test/fixtures/flow/regression/issue-10675-class/output.json b/packages/babel-parser/test/fixtures/flow/regression/issue-10675-class/output.json new file mode 100644 index 000000000000..d3709929d73e --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/regression/issue-10675-class/output.json @@ -0,0 +1,40 @@ +{ + "type": "File", + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, + "program": { + "type": "Program", + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, + "id": { + "type": "Identifier", + "start":6,"end":8,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":8},"identifierName":"of"}, + "name": "of" + }, + "typeParameters": { + "type": "TypeParameterDeclaration", + "start":8,"end":11,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":11}}, + "params": [ + { + "type": "TypeParameter", + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10}}, + "name": "T", + "variance": null + } + ] + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":12,"end":14,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":14}}, + "body": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/regression/issue-10675-function/input.js b/packages/babel-parser/test/fixtures/flow/regression/issue-10675-function/input.js new file mode 100644 index 000000000000..1f364d918343 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/regression/issue-10675-function/input.js @@ -0,0 +1,2 @@ +function of() {} + diff --git a/packages/babel-parser/test/fixtures/flow/regression/issue-10675-function/options.json b/packages/babel-parser/test/fixtures/flow/regression/issue-10675-function/options.json new file mode 100644 index 000000000000..7c91792f0e9c --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/regression/issue-10675-function/options.json @@ -0,0 +1,7 @@ +{ + "sourceType": "module", + "plugins": [ + "jsx", + "flow" + ] +} diff --git a/packages/babel-parser/test/fixtures/flow/regression/issue-10675-function/output.json b/packages/babel-parser/test/fixtures/flow/regression/issue-10675-function/output.json new file mode 100644 index 000000000000..d5037bec0d39 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/regression/issue-10675-function/output.json @@ -0,0 +1,43 @@ +{ + "type": "File", + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, + "program": { + "type": "Program", + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, + "id": { + "type": "Identifier", + "start":9,"end":11,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":11},"identifierName":"of"}, + "name": "of" + }, + "generator": false, + "async": false, + "typeParameters": { + "type": "TypeParameterDeclaration", + "start":11,"end":14,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":14}}, + "params": [ + { + "type": "TypeParameter", + "start":12,"end":13,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":13}}, + "name": "T", + "variance": null + } + ] + }, + "params": [], + "body": { + "type": "BlockStatement", + "start":17,"end":19,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":19}}, + "body": [], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/regression/issue-10675-interface/input.js b/packages/babel-parser/test/fixtures/flow/regression/issue-10675-interface/input.js new file mode 100644 index 000000000000..a8ffa68c54cb --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/regression/issue-10675-interface/input.js @@ -0,0 +1,2 @@ +interface of {} + diff --git a/packages/babel-parser/test/fixtures/flow/regression/issue-10675-interface/options.json b/packages/babel-parser/test/fixtures/flow/regression/issue-10675-interface/options.json new file mode 100644 index 000000000000..7c91792f0e9c --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/regression/issue-10675-interface/options.json @@ -0,0 +1,7 @@ +{ + "sourceType": "module", + "plugins": [ + "jsx", + "flow" + ] +} diff --git a/packages/babel-parser/test/fixtures/flow/regression/issue-10675-interface/output.json b/packages/babel-parser/test/fixtures/flow/regression/issue-10675-interface/output.json new file mode 100644 index 000000000000..4c32af6e95ec --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/regression/issue-10675-interface/output.json @@ -0,0 +1,46 @@ +{ + "type": "File", + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, + "program": { + "type": "Program", + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "InterfaceDeclaration", + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, + "id": { + "type": "Identifier", + "start":10,"end":12,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":12},"identifierName":"of"}, + "name": "of" + }, + "typeParameters": { + "type": "TypeParameterDeclaration", + "start":12,"end":15,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":15}}, + "params": [ + { + "type": "TypeParameter", + "start":13,"end":14,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":14}}, + "name": "T", + "variance": null + } + ] + }, + "extends": [], + "implements": [], + "mixins": [], + "body": { + "type": "ObjectTypeAnnotation", + "start":16,"end":18,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":18}}, + "callProperties": [], + "properties": [], + "indexers": [], + "internalSlots": [], + "exact": false + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/regression/issue-166/output.json b/packages/babel-parser/test/fixtures/flow/regression/issue-166/output.json index efd8f22618dc..1c9495485e34 100644 --- a/packages/babel-parser/test/fixtures/flow/regression/issue-166/output.json +++ b/packages/babel-parser/test/fixtures/flow/regression/issue-166/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 66, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":0,"end":66,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 66, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":0,"end":66,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 66, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":0,"end":66,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, "id": { "type": "Identifier", - "start": 10, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 13 - }, - "identifierName": "foo" - }, + "start":10,"end":13,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":13},"identifierName":"foo"}, "name": "foo" }, "generator": true, @@ -65,108 +20,30 @@ "params": [], "body": { "type": "BlockStatement", - "start": 16, - "end": 66, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":16,"end":66,"loc":{"start":{"line":1,"column":16},"end":{"line":4,"column":1}}, "body": [ { "type": "VariableDeclaration", - "start": 20, - "end": 45, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 27 - } - }, + "start":20,"end":45,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":27}}, "declarations": [ { "type": "VariableDeclarator", - "start": 26, - "end": 44, - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 26 - } - }, + "start":26,"end":44,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":26}}, "id": { "type": "Identifier", - "start": 26, - "end": 27, - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 9 - }, - "identifierName": "x" - }, + "start":26,"end":27,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":9},"identifierName":"x"}, "name": "x" }, "init": { "type": "TypeCastExpression", - "start": 31, - "end": 43, - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 25 - } - }, + "start":31,"end":43,"loc":{"start":{"line":2,"column":13},"end":{"line":2,"column":25}}, "expression": { "type": "YieldExpression", - "start": 31, - "end": 38, - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 20 - } - }, + "start":31,"end":38,"loc":{"start":{"line":2,"column":13},"end":{"line":2,"column":20}}, "delegate": false, "argument": { "type": "NumericLiteral", - "start": 37, - "end": 38, - "loc": { - "start": { - "line": 2, - "column": 19 - }, - "end": { - "line": 2, - "column": 20 - } - }, + "start":37,"end":38,"loc":{"start":{"line":2,"column":19},"end":{"line":2,"column":20}}, "extra": { "rawValue": 5, "raw": "5" @@ -176,32 +53,10 @@ }, "typeAnnotation": { "type": "TypeAnnotation", - "start": 38, - "end": 43, - "loc": { - "start": { - "line": 2, - "column": 20 - }, - "end": { - "line": 2, - "column": 25 - } - }, + "start":38,"end":43,"loc":{"start":{"line":2,"column":20},"end":{"line":2,"column":25}}, "typeAnnotation": { "type": "AnyTypeAnnotation", - "start": 40, - "end": 43, - "loc": { - "start": { - "line": 2, - "column": 22 - }, - "end": { - "line": 2, - "column": 25 - } - } + "start":40,"end":43,"loc":{"start":{"line":2,"column":22},"end":{"line":2,"column":25}} } }, "extra": { @@ -215,78 +70,22 @@ }, { "type": "ExpressionStatement", - "start": 48, - "end": 64, - "loc": { - "start": { - "line": 3, - "column": 2 - }, - "end": { - "line": 3, - "column": 18 - } - }, + "start":48,"end":64,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":18}}, "expression": { "type": "ConditionalExpression", - "start": 48, - "end": 63, - "loc": { - "start": { - "line": 3, - "column": 2 - }, - "end": { - "line": 3, - "column": 17 - } - }, + "start":48,"end":63,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":17}}, "test": { "type": "Identifier", - "start": 48, - "end": 49, - "loc": { - "start": { - "line": 3, - "column": 2 - }, - "end": { - "line": 3, - "column": 3 - }, - "identifierName": "x" - }, + "start":48,"end":49,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":3},"identifierName":"x"}, "name": "x" }, "consequent": { "type": "YieldExpression", - "start": 52, - "end": 59, - "loc": { - "start": { - "line": 3, - "column": 6 - }, - "end": { - "line": 3, - "column": 13 - } - }, + "start":52,"end":59,"loc":{"start":{"line":3,"column":6},"end":{"line":3,"column":13}}, "delegate": false, "argument": { "type": "NumericLiteral", - "start": 58, - "end": 59, - "loc": { - "start": { - "line": 3, - "column": 12 - }, - "end": { - "line": 3, - "column": 13 - } - }, + "start":58,"end":59,"loc":{"start":{"line":3,"column":12},"end":{"line":3,"column":13}}, "extra": { "rawValue": 1, "raw": "1" @@ -296,19 +95,7 @@ }, "alternate": { "type": "Identifier", - "start": 62, - "end": 63, - "loc": { - "start": { - "line": 3, - "column": 16 - }, - "end": { - "line": 3, - "column": 17 - }, - "identifierName": "x" - }, + "start":62,"end":63,"loc":{"start":{"line":3,"column":16},"end":{"line":3,"column":17},"identifierName":"x"}, "name": "x" } } diff --git a/packages/babel-parser/test/fixtures/flow/regression/issue-2083/output.json b/packages/babel-parser/test/fixtures/flow/regression/issue-2083/output.json index 69b72ebc290c..42b9161b372c 100644 --- a/packages/babel-parser/test/fixtures/flow/regression/issue-2083/output.json +++ b/packages/babel-parser/test/fixtures/flow/regression/issue-2083/output.json @@ -1,111 +1,32 @@ { "type": "File", - "start": 0, - "end": 164, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 11, - "column": 1 - } - }, + "start":0,"end":164,"loc":{"start":{"line":1,"column":0},"end":{"line":11,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 164, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 11, - "column": 1 - } - }, + "start":0,"end":164,"loc":{"start":{"line":1,"column":0},"end":{"line":11,"column":1}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 164, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 11, - "column": 1 - } - }, + "start":0,"end":164,"loc":{"start":{"line":1,"column":0},"end":{"line":11,"column":1}}, "id": { "type": "Identifier", - "start": 6, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "Foo" - }, + "start":6,"end":9,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":9},"identifierName":"Foo"}, "name": "Foo" }, "superClass": null, "body": { "type": "ClassBody", - "start": 10, - "end": 164, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 11, - "column": 1 - } - }, + "start":10,"end":164,"loc":{"start":{"line":1,"column":10},"end":{"line":11,"column":1}}, "body": [ { "type": "ClassMethod", - "start": 14, - "end": 110, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 6, - "column": 3 - } - }, + "start":14,"end":110,"loc":{"start":{"line":2,"column":2},"end":{"line":6,"column":3}}, "static": false, "key": { "type": "Identifier", - "start": 14, - "end": 17, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 5 - }, - "identifierName": "foo" - }, + "start":14,"end":17,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":5},"identifierName":"foo"}, "name": "foo" }, "computed": false, @@ -116,47 +37,14 @@ "params": [], "body": { "type": "BlockStatement", - "start": 20, - "end": 110, - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 6, - "column": 3 - } - }, + "start":20,"end":110,"loc":{"start":{"line":2,"column":8},"end":{"line":6,"column":3}}, "body": [ { "type": "SwitchStatement", - "start": 26, - "end": 106, - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 5, - "column": 5 - } - }, + "start":26,"end":106,"loc":{"start":{"line":3,"column":4},"end":{"line":5,"column":5}}, "discriminant": { "type": "NumericLiteral", - "start": 34, - "end": 35, - "loc": { - "start": { - "line": 3, - "column": 12 - }, - "end": { - "line": 3, - "column": 13 - } - }, + "start":34,"end":35,"loc":{"start":{"line":3,"column":12},"end":{"line":3,"column":13}}, "extra": { "rawValue": 1, "raw": "1" @@ -166,79 +54,22 @@ "cases": [ { "type": "SwitchCase", - "start": 45, - "end": 100, - "loc": { - "start": { - "line": 4, - "column": 6 - }, - "end": { - "line": 4, - "column": 61 - } - }, + "start":45,"end":100,"loc":{"start":{"line":4,"column":6},"end":{"line":4,"column":61}}, "consequent": [], "test": { "type": "BinaryExpression", - "start": 51, - "end": 98, - "loc": { - "start": { - "line": 4, - "column": 12 - }, - "end": { - "line": 4, - "column": 59 - } - }, + "start":51,"end":98,"loc":{"start":{"line":4,"column":12},"end":{"line":4,"column":59}}, "left": { "type": "MemberExpression", - "start": 51, - "end": 71, - "loc": { - "start": { - "line": 4, - "column": 12 - }, - "end": { - "line": 4, - "column": 32 - } - }, + "start":51,"end":71,"loc":{"start":{"line":4,"column":12},"end":{"line":4,"column":32}}, "object": { "type": "Identifier", - "start": 51, - "end": 61, - "loc": { - "start": { - "line": 4, - "column": 12 - }, - "end": { - "line": 4, - "column": 22 - }, - "identifierName": "MatrixType" - }, + "start":51,"end":61,"loc":{"start":{"line":4,"column":12},"end":{"line":4,"column":22},"identifierName":"MatrixType"}, "name": "MatrixType" }, "property": { "type": "Identifier", - "start": 62, - "end": 71, - "loc": { - "start": { - "line": 4, - "column": 23 - }, - "end": { - "line": 4, - "column": 32 - }, - "identifierName": "IsScaling" - }, + "start":62,"end":71,"loc":{"start":{"line":4,"column":23},"end":{"line":4,"column":32},"identifierName":"IsScaling"}, "name": "IsScaling" }, "computed": false @@ -246,50 +77,15 @@ "operator": "|", "right": { "type": "MemberExpression", - "start": 74, - "end": 98, - "loc": { - "start": { - "line": 4, - "column": 35 - }, - "end": { - "line": 4, - "column": 59 - } - }, + "start":74,"end":98,"loc":{"start":{"line":4,"column":35},"end":{"line":4,"column":59}}, "object": { "type": "Identifier", - "start": 74, - "end": 84, - "loc": { - "start": { - "line": 4, - "column": 35 - }, - "end": { - "line": 4, - "column": 45 - }, - "identifierName": "MatrixType" - }, + "start":74,"end":84,"loc":{"start":{"line":4,"column":35},"end":{"line":4,"column":45},"identifierName":"MatrixType"}, "name": "MatrixType" }, "property": { "type": "Identifier", - "start": 85, - "end": 98, - "loc": { - "start": { - "line": 4, - "column": 46 - }, - "end": { - "line": 4, - "column": 59 - }, - "identifierName": "IsTranslation" - }, + "start":85,"end":98,"loc":{"start":{"line":4,"column":46},"end":{"line":4,"column":59},"identifierName":"IsTranslation"}, "name": "IsTranslation" }, "computed": false @@ -308,34 +104,11 @@ }, { "type": "ClassMethod", - "start": 114, - "end": 162, - "loc": { - "start": { - "line": 8, - "column": 2 - }, - "end": { - "line": 10, - "column": 3 - } - }, + "start":114,"end":162,"loc":{"start":{"line":8,"column":2},"end":{"line":10,"column":3}}, "static": false, "key": { "type": "Identifier", - "start": 114, - "end": 117, - "loc": { - "start": { - "line": 8, - "column": 2 - }, - "end": { - "line": 8, - "column": 5 - }, - "identifierName": "bar" - }, + "start":114,"end":117,"loc":{"start":{"line":8,"column":2},"end":{"line":8,"column":5},"identifierName":"bar"}, "name": "bar" }, "computed": false, @@ -346,93 +119,26 @@ "params": [], "body": { "type": "BlockStatement", - "start": 120, - "end": 162, - "loc": { - "start": { - "line": 8, - "column": 8 - }, - "end": { - "line": 10, - "column": 3 - } - }, + "start":120,"end":162,"loc":{"start":{"line":8,"column":8},"end":{"line":10,"column":3}}, "body": [ { "type": "SwitchStatement", - "start": 126, - "end": 158, - "loc": { - "start": { - "line": 9, - "column": 4 - }, - "end": { - "line": 9, - "column": 36 - } - }, + "start":126,"end":158,"loc":{"start":{"line":9,"column":4},"end":{"line":9,"column":36}}, "discriminant": { "type": "BinaryExpression", - "start": 134, - "end": 154, - "loc": { - "start": { - "line": 9, - "column": 12 - }, - "end": { - "line": 9, - "column": 32 - } - }, + "start":134,"end":154,"loc":{"start":{"line":9,"column":12},"end":{"line":9,"column":32}}, "left": { "type": "BinaryExpression", - "start": 135, - "end": 145, - "loc": { - "start": { - "line": 9, - "column": 13 - }, - "end": { - "line": 9, - "column": 23 - } - }, + "start":135,"end":145,"loc":{"start":{"line":9,"column":13},"end":{"line":9,"column":23}}, "left": { "type": "Identifier", - "start": 135, - "end": 140, - "loc": { - "start": { - "line": 9, - "column": 13 - }, - "end": { - "line": 9, - "column": 18 - }, - "identifierName": "typeA" - }, + "start":135,"end":140,"loc":{"start":{"line":9,"column":13},"end":{"line":9,"column":18},"identifierName":"typeA"}, "name": "typeA" }, "operator": "<<", "right": { "type": "NumericLiteral", - "start": 144, - "end": 145, - "loc": { - "start": { - "line": 9, - "column": 22 - }, - "end": { - "line": 9, - "column": 23 - } - }, + "start":144,"end":145,"loc":{"start":{"line":9,"column":22},"end":{"line":9,"column":23}}, "extra": { "rawValue": 4, "raw": "4" @@ -447,19 +153,7 @@ "operator": "|", "right": { "type": "Identifier", - "start": 149, - "end": 154, - "loc": { - "start": { - "line": 9, - "column": 27 - }, - "end": { - "line": 9, - "column": 32 - }, - "identifierName": "typeB" - }, + "start":149,"end":154,"loc":{"start":{"line":9,"column":27},"end":{"line":9,"column":32},"identifierName":"typeB"}, "name": "typeB" } }, diff --git a/packages/babel-parser/test/fixtures/flow/regression/issue-2493/output.json b/packages/babel-parser/test/fixtures/flow/regression/issue-2493/output.json index adcc7ca5933b..4f09012ac78f 100644 --- a/packages/babel-parser/test/fixtures/flow/regression/issue-2493/output.json +++ b/packages/babel-parser/test/fixtures/flow/regression/issue-2493/output.json @@ -1,123 +1,34 @@ { "type": "File", - "start": 0, - "end": 102, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 8 - } - }, + "start":0,"end":102,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":8}}, "program": { "type": "Program", - "start": 0, - "end": 102, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 8 - } - }, + "start":0,"end":102,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":8}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 92, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 2 - } - }, + "start":0,"end":92,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":2}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 91, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":4,"end":91,"loc":{"start":{"line":1,"column":4},"end":{"line":3,"column":1}}, "id": { "type": "Identifier", - "start": 4, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "hello" - }, + "start":4,"end":9,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":9},"identifierName":"hello"}, "name": "hello" }, "init": { "type": "ArrowFunctionExpression", - "start": 12, - "end": 91, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":12,"end":91,"loc":{"start":{"line":1,"column":12},"end":{"line":3,"column":1}}, "predicate": null, "returnType": { "type": "TypeAnnotation", - "start": 41, - "end": 49, - "loc": { - "start": { - "line": 1, - "column": 41 - }, - "end": { - "line": 1, - "column": 49 - } - }, + "start":41,"end":49,"loc":{"start":{"line":1,"column":41},"end":{"line":1,"column":49}}, "typeAnnotation": { "type": "StringTypeAnnotation", - "start": 43, - "end": 49, - "loc": { - "start": { - "line": 1, - "column": 43 - }, - "end": { - "line": 1, - "column": 49 - } - } + "start":43,"end":49,"loc":{"start":{"line":1,"column":43},"end":{"line":1,"column":49}} } }, "id": null, @@ -126,79 +37,23 @@ "params": [ { "type": "AssignmentPattern", - "start": 13, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 39 - } - }, + "start":13,"end":39,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":39}}, "left": { "type": "Identifier", - "start": 13, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 28 - }, - "identifierName": "greeting" - }, + "start":13,"end":28,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":28},"identifierName":"greeting"}, "name": "greeting", "typeAnnotation": { "type": "TypeAnnotation", - "start": 21, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":21,"end":28,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":28}}, "typeAnnotation": { "type": "StringTypeAnnotation", - "start": 22, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 28 - } - } + "start":22,"end":28,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":28}} } } }, "right": { "type": "StringLiteral", - "start": 31, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 31 - }, - "end": { - "line": 1, - "column": 39 - } - }, + "start":31,"end":39,"loc":{"start":{"line":1,"column":31},"end":{"line":1,"column":39}}, "extra": { "rawValue": " world", "raw": "' world'" @@ -209,93 +64,25 @@ ], "body": { "type": "BlockStatement", - "start": 53, - "end": 91, - "loc": { - "start": { - "line": 1, - "column": 53 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":53,"end":91,"loc":{"start":{"line":1,"column":53},"end":{"line":3,"column":1}}, "body": [ { "type": "ExpressionStatement", - "start": 57, - "end": 89, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 34 - } - }, + "start":57,"end":89,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":34}}, "expression": { "type": "CallExpression", - "start": 57, - "end": 88, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 33 - } - }, + "start":57,"end":88,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":33}}, "callee": { "type": "MemberExpression", - "start": 57, - "end": 68, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 13 - } - }, + "start":57,"end":68,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":13}}, "object": { "type": "Identifier", - "start": 57, - "end": 64, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 9 - }, - "identifierName": "console" - }, + "start":57,"end":64,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":9},"identifierName":"console"}, "name": "console" }, "property": { "type": "Identifier", - "start": 65, - "end": 68, - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 13 - }, - "identifierName": "log" - }, + "start":65,"end":68,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":13},"identifierName":"log"}, "name": "log" }, "computed": false @@ -303,32 +90,10 @@ "arguments": [ { "type": "BinaryExpression", - "start": 69, - "end": 87, - "loc": { - "start": { - "line": 2, - "column": 14 - }, - "end": { - "line": 2, - "column": 32 - } - }, + "start":69,"end":87,"loc":{"start":{"line":2,"column":14},"end":{"line":2,"column":32}}, "left": { "type": "StringLiteral", - "start": 69, - "end": 76, - "loc": { - "start": { - "line": 2, - "column": 14 - }, - "end": { - "line": 2, - "column": 21 - } - }, + "start":69,"end":76,"loc":{"start":{"line":2,"column":14},"end":{"line":2,"column":21}}, "extra": { "rawValue": "hello", "raw": "'hello'" @@ -338,19 +103,7 @@ "operator": "+", "right": { "type": "Identifier", - "start": 79, - "end": 87, - "loc": { - "start": { - "line": 2, - "column": 24 - }, - "end": { - "line": 2, - "column": 32 - }, - "identifierName": "greeting" - }, + "start":79,"end":87,"loc":{"start":{"line":2,"column":24},"end":{"line":2,"column":32},"identifierName":"greeting"}, "name": "greeting" } } @@ -367,47 +120,13 @@ }, { "type": "ExpressionStatement", - "start": 94, - "end": 102, - "loc": { - "start": { - "line": 5, - "column": 0 - }, - "end": { - "line": 5, - "column": 8 - } - }, + "start":94,"end":102,"loc":{"start":{"line":5,"column":0},"end":{"line":5,"column":8}}, "expression": { "type": "CallExpression", - "start": 94, - "end": 101, - "loc": { - "start": { - "line": 5, - "column": 0 - }, - "end": { - "line": 5, - "column": 7 - } - }, + "start":94,"end":101,"loc":{"start":{"line":5,"column":0},"end":{"line":5,"column":7}}, "callee": { "type": "Identifier", - "start": 94, - "end": 99, - "loc": { - "start": { - "line": 5, - "column": 0 - }, - "end": { - "line": 5, - "column": 5 - }, - "identifierName": "hello" - }, + "start":94,"end":99,"loc":{"start":{"line":5,"column":0},"end":{"line":5,"column":5},"identifierName":"hello"}, "name": "hello" }, "arguments": [] diff --git a/packages/babel-parser/test/fixtures/flow/regression/issue-264/output.json b/packages/babel-parser/test/fixtures/flow/regression/issue-264/output.json index a6292dca529a..b5cac75b3292 100644 --- a/packages/babel-parser/test/fixtures/flow/regression/issue-264/output.json +++ b/packages/babel-parser/test/fixtures/flow/regression/issue-264/output.json @@ -1,157 +1,45 @@ { "type": "File", - "start": 0, - "end": 44, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 2 - } - }, + "start":0,"end":44,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":2}}, "program": { "type": "Program", - "start": 0, - "end": 44, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 2 - } - }, + "start":0,"end":44,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":2}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 44, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 2 - } - }, + "start":0,"end":44,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":2}}, "declarations": [ { "type": "VariableDeclarator", - "start": 6, - "end": 43, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":6,"end":43,"loc":{"start":{"line":1,"column":6},"end":{"line":3,"column":1}}, "id": { "type": "Identifier", - "start": 6, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "map" - }, + "start":6,"end":9,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":9},"identifierName":"map"}, "name": "map" }, "init": { "type": "ObjectExpression", - "start": 12, - "end": 43, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":12,"end":43,"loc":{"start":{"line":1,"column":12},"end":{"line":3,"column":1}}, "properties": [ { "type": "ObjectProperty", - "start": 16, - "end": 41, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 27 - } - }, + "start":16,"end":41,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":27}}, "method": false, "computed": true, "key": { "type": "BinaryExpression", - "start": 17, - "end": 26, - "loc": { - "start": { - "line": 2, - "column": 3 - }, - "end": { - "line": 2, - "column": 12 - } - }, + "start":17,"end":26,"loc":{"start":{"line":2,"column":3},"end":{"line":2,"column":12}}, "left": { "type": "Identifier", - "start": 17, - "end": 20, - "loc": { - "start": { - "line": 2, - "column": 3 - }, - "end": { - "line": 2, - "column": 6 - }, - "identifierName": "age" - }, + "start":17,"end":20,"loc":{"start":{"line":2,"column":3},"end":{"line":2,"column":6},"identifierName":"age"}, "name": "age" }, "operator": "<=", "right": { "type": "NumericLiteral", - "start": 24, - "end": 26, - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 12 - } - }, + "start":24,"end":26,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":12}}, "extra": { "rawValue": 17, "raw": "17" @@ -162,18 +50,7 @@ "shorthand": false, "value": { "type": "StringLiteral", - "start": 30, - "end": 41, - "loc": { - "start": { - "line": 2, - "column": 16 - }, - "end": { - "line": 2, - "column": 27 - } - }, + "start":30,"end":41,"loc":{"start":{"line":2,"column":16},"end":{"line":2,"column":27}}, "extra": { "rawValue": "Too young", "raw": "'Too young'" diff --git a/packages/babel-parser/test/fixtures/flow/regression/issue-321/output.json b/packages/babel-parser/test/fixtures/flow/regression/issue-321/output.json index 1af4cfcdc000..0c22b938a43e 100644 --- a/packages/babel-parser/test/fixtures/flow/regression/issue-321/output.json +++ b/packages/babel-parser/test/fixtures/flow/regression/issue-321/output.json @@ -1,218 +1,61 @@ { "type": "File", - "start": 0, - "end": 118, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 60 - } - }, + "start":0,"end":118,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":60}}, "program": { "type": "Program", - "start": 0, - "end": 118, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 60 - } - }, + "start":0,"end":118,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":60}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 57, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 57 - } - }, + "start":0,"end":57,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":57}}, "declarations": [ { "type": "VariableDeclarator", - "start": 6, - "end": 56, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 56 - } - }, + "start":6,"end":56,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":56}}, "id": { "type": "Identifier", - "start": 6, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 37 - }, - "identifierName": "fn" - }, + "start":6,"end":37,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":37},"identifierName":"fn"}, "name": "fn", "typeAnnotation": { "type": "TypeAnnotation", - "start": 8, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 37 - } - }, + "start":8,"end":37,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":37}}, "typeAnnotation": { "type": "FunctionTypeAnnotation", - "start": 10, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 37 - } - }, + "start":10,"end":37,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":37}}, "params": [ { "type": "FunctionTypeParam", - "start": 12, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":12,"end":19,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":19}}, "name": null, "optional": false, "typeAnnotation": { "type": "GenericTypeAnnotation", - "start": 12, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":12,"end":18,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":18}}, "typeParameters": null, "id": { "type": "Identifier", - "start": 12, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 18 - }, - "identifierName": "Object" - }, + "start":12,"end":18,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":18},"identifierName":"Object"}, "name": "Object" } } }, { "type": "FunctionTypeParam", - "start": 20, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":20,"end":27,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":27}}, "name": null, "optional": false, "typeAnnotation": { "type": "NullableTypeAnnotation", - "start": 20, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":20,"end":27,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":27}}, "typeAnnotation": { "type": "GenericTypeAnnotation", - "start": 21, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":21,"end":27,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":27}}, "typeParameters": null, "id": { "type": "Identifier", - "start": 21, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 27 - }, - "identifierName": "Object" - }, + "start":21,"end":27,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":27},"identifierName":"Object"}, "name": "Object" } } @@ -222,18 +65,7 @@ "rest": null, "returnType": { "type": "VoidTypeAnnotation", - "start": 33, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 33 - }, - "end": { - "line": 1, - "column": 37 - } - } + "start":33,"end":37,"loc":{"start":{"line":1,"column":33},"end":{"line":1,"column":37}} }, "typeParameters": null } @@ -241,72 +73,25 @@ }, "init": { "type": "ArrowFunctionExpression", - "start": 40, - "end": 56, - "loc": { - "start": { - "line": 1, - "column": 40 - }, - "end": { - "line": 1, - "column": 56 - } - }, + "start":40,"end":56,"loc":{"start":{"line":1,"column":40},"end":{"line":1,"column":56}}, "id": null, "generator": false, "async": false, "params": [ { "type": "Identifier", - "start": 42, - "end": 44, - "loc": { - "start": { - "line": 1, - "column": 42 - }, - "end": { - "line": 1, - "column": 44 - }, - "identifierName": "o1" - }, + "start":42,"end":44,"loc":{"start":{"line":1,"column":42},"end":{"line":1,"column":44},"identifierName":"o1"}, "name": "o1" }, { "type": "Identifier", - "start": 46, - "end": 48, - "loc": { - "start": { - "line": 1, - "column": 46 - }, - "end": { - "line": 1, - "column": 48 - }, - "identifierName": "o2" - }, + "start":46,"end":48,"loc":{"start":{"line":1,"column":46},"end":{"line":1,"column":48},"identifierName":"o2"}, "name": "o2" } ], "body": { "type": "Identifier", - "start": 54, - "end": 56, - "loc": { - "start": { - "line": 1, - "column": 54 - }, - "end": { - "line": 1, - "column": 56 - }, - "identifierName": "o1" - }, + "start":54,"end":56,"loc":{"start":{"line":1,"column":54},"end":{"line":1,"column":56},"identifierName":"o1"}, "name": "o1" } } @@ -316,188 +101,53 @@ }, { "type": "VariableDeclaration", - "start": 58, - "end": 118, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 60 - } - }, + "start":58,"end":118,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":60}}, "declarations": [ { "type": "VariableDeclarator", - "start": 64, - "end": 117, - "loc": { - "start": { - "line": 2, - "column": 6 - }, - "end": { - "line": 2, - "column": 59 - } - }, + "start":64,"end":117,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":59}}, "id": { "type": "Identifier", - "start": 64, - "end": 97, - "loc": { - "start": { - "line": 2, - "column": 6 - }, - "end": { - "line": 2, - "column": 39 - }, - "identifierName": "fn2" - }, + "start":64,"end":97,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":39},"identifierName":"fn2"}, "name": "fn2", "typeAnnotation": { "type": "TypeAnnotation", - "start": 67, - "end": 97, - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 39 - } - }, + "start":67,"end":97,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":39}}, "typeAnnotation": { "type": "FunctionTypeAnnotation", - "start": 69, - "end": 97, - "loc": { - "start": { - "line": 2, - "column": 11 - }, - "end": { - "line": 2, - "column": 39 - } - }, + "start":69,"end":97,"loc":{"start":{"line":2,"column":11},"end":{"line":2,"column":39}}, "params": [ { "type": "FunctionTypeParam", - "start": 71, - "end": 78, - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 20 - } - }, + "start":71,"end":78,"loc":{"start":{"line":2,"column":13},"end":{"line":2,"column":20}}, "name": null, "optional": false, "typeAnnotation": { "type": "GenericTypeAnnotation", - "start": 71, - "end": 77, - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 19 - } - }, + "start":71,"end":77,"loc":{"start":{"line":2,"column":13},"end":{"line":2,"column":19}}, "typeParameters": null, "id": { "type": "Identifier", - "start": 71, - "end": 77, - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 19 - }, - "identifierName": "Object" - }, + "start":71,"end":77,"loc":{"start":{"line":2,"column":13},"end":{"line":2,"column":19},"identifierName":"Object"}, "name": "Object" } } }, { "type": "FunctionTypeParam", - "start": 79, - "end": 86, - "loc": { - "start": { - "line": 2, - "column": 21 - }, - "end": { - "line": 2, - "column": 28 - } - }, + "start":79,"end":86,"loc":{"start":{"line":2,"column":21},"end":{"line":2,"column":28}}, "name": null, "optional": false, "typeAnnotation": { "type": "NullableTypeAnnotation", - "start": 79, - "end": 86, - "loc": { - "start": { - "line": 2, - "column": 21 - }, - "end": { - "line": 2, - "column": 28 - } - }, + "start":79,"end":86,"loc":{"start":{"line":2,"column":21},"end":{"line":2,"column":28}}, "typeAnnotation": { "type": "GenericTypeAnnotation", - "start": 80, - "end": 86, - "loc": { - "start": { - "line": 2, - "column": 22 - }, - "end": { - "line": 2, - "column": 28 - } - }, + "start":80,"end":86,"loc":{"start":{"line":2,"column":22},"end":{"line":2,"column":28}}, "typeParameters": null, "id": { "type": "Identifier", - "start": 80, - "end": 86, - "loc": { - "start": { - "line": 2, - "column": 22 - }, - "end": { - "line": 2, - "column": 28 - }, - "identifierName": "Object" - }, + "start":80,"end":86,"loc":{"start":{"line":2,"column":22},"end":{"line":2,"column":28},"identifierName":"Object"}, "name": "Object" } } @@ -507,18 +157,7 @@ "rest": null, "returnType": { "type": "VoidTypeAnnotation", - "start": 93, - "end": 97, - "loc": { - "start": { - "line": 2, - "column": 35 - }, - "end": { - "line": 2, - "column": 39 - } - } + "start":93,"end":97,"loc":{"start":{"line":2,"column":35},"end":{"line":2,"column":39}} }, "typeParameters": null } @@ -526,72 +165,25 @@ }, "init": { "type": "ArrowFunctionExpression", - "start": 100, - "end": 117, - "loc": { - "start": { - "line": 2, - "column": 42 - }, - "end": { - "line": 2, - "column": 59 - } - }, + "start":100,"end":117,"loc":{"start":{"line":2,"column":42},"end":{"line":2,"column":59}}, "id": null, "generator": false, "async": false, "params": [ { "type": "Identifier", - "start": 102, - "end": 104, - "loc": { - "start": { - "line": 2, - "column": 44 - }, - "end": { - "line": 2, - "column": 46 - }, - "identifierName": "o1" - }, + "start":102,"end":104,"loc":{"start":{"line":2,"column":44},"end":{"line":2,"column":46},"identifierName":"o1"}, "name": "o1" }, { "type": "Identifier", - "start": 106, - "end": 108, - "loc": { - "start": { - "line": 2, - "column": 48 - }, - "end": { - "line": 2, - "column": 50 - }, - "identifierName": "o2" - }, + "start":106,"end":108,"loc":{"start":{"line":2,"column":48},"end":{"line":2,"column":50},"identifierName":"o2"}, "name": "o2" } ], "body": { "type": "Identifier", - "start": 115, - "end": 117, - "loc": { - "start": { - "line": 2, - "column": 57 - }, - "end": { - "line": 2, - "column": 59 - }, - "identifierName": "o1" - }, + "start":115,"end":117,"loc":{"start":{"line":2,"column":57},"end":{"line":2,"column":59},"identifierName":"o1"}, "name": "o1" } } diff --git a/packages/babel-parser/test/fixtures/flow/regression/issue-336/output.json b/packages/babel-parser/test/fixtures/flow/regression/issue-336/output.json index 241024d9b602..465217227f91 100644 --- a/packages/babel-parser/test/fixtures/flow/regression/issue-336/output.json +++ b/packages/babel-parser/test/fixtures/flow/regression/issue-336/output.json @@ -1,169 +1,46 @@ { "type": "File", - "start": 0, - "end": 48, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 48 - } - }, + "start":0,"end":48,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":48}}, "program": { "type": "Program", - "start": 0, - "end": 48, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 48 - } - }, + "start":0,"end":48,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":48}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 48, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 48 - } - }, + "start":0,"end":48,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":48}}, "declarations": [ { "type": "VariableDeclarator", - "start": 6, - "end": 47, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 47 - } - }, + "start":6,"end":47,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":47}}, "id": { "type": "Identifier", - "start": 6, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 8 - }, - "identifierName": "fn" - }, + "start":6,"end":8,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":8},"identifierName":"fn"}, "name": "fn" }, "init": { "type": "ArrowFunctionExpression", - "start": 11, - "end": 47, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 47 - } - }, + "start":11,"end":47,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":47}}, "returnType": { "type": "TypeAnnotation", - "start": 26, - "end": 41, - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 41 - } - }, + "start":26,"end":41,"loc":{"start":{"line":1,"column":26},"end":{"line":1,"column":41}}, "typeAnnotation": { "type": "GenericTypeAnnotation", - "start": 28, - "end": 41, - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 41 - } - }, + "start":28,"end":41,"loc":{"start":{"line":1,"column":28},"end":{"line":1,"column":41}}, "typeParameters": { "type": "TypeParameterInstantiation", - "start": 35, - "end": 41, - "loc": { - "start": { - "line": 1, - "column": 35 - }, - "end": { - "line": 1, - "column": 41 - } - }, + "start":35,"end":41,"loc":{"start":{"line":1,"column":35},"end":{"line":1,"column":41}}, "params": [ { "type": "VoidTypeAnnotation", - "start": 36, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 36 - }, - "end": { - "line": 1, - "column": 40 - } - } + "start":36,"end":40,"loc":{"start":{"line":1,"column":36},"end":{"line":1,"column":40}} } ] }, "id": { "type": "Identifier", - "start": 28, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 35 - }, - "identifierName": "Promise" - }, + "start":28,"end":35,"loc":{"start":{"line":1,"column":28},"end":{"line":1,"column":35},"identifierName":"Promise"}, "name": "Promise" } } @@ -174,67 +51,22 @@ "params": [ { "type": "Identifier", - "start": 18, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 25 - }, - "identifierName": "a" - }, + "start":18,"end":25,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":25},"identifierName":"a"}, "name": "a", "optional": true, "typeAnnotation": { "type": "TypeAnnotation", - "start": 20, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":20,"end":25,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":25}}, "typeAnnotation": { "type": "AnyTypeAnnotation", - "start": 22, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 25 - } - } + "start":22,"end":25,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":25}} } } } ], "body": { "type": "BlockStatement", - "start": 45, - "end": 47, - "loc": { - "start": { - "line": 1, - "column": 45 - }, - "end": { - "line": 1, - "column": 47 - } - }, + "start":45,"end":47,"loc":{"start":{"line":1,"column":45},"end":{"line":1,"column":47}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/flow/regression/issue-58-ambiguous/options.json b/packages/babel-parser/test/fixtures/flow/regression/issue-58-ambiguous/options.json index 49dc6c3d5a6a..abfcf6f44eba 100644 --- a/packages/babel-parser/test/fixtures/flow/regression/issue-58-ambiguous/options.json +++ b/packages/babel-parser/test/fixtures/flow/regression/issue-58-ambiguous/options.json @@ -1,3 +1,3 @@ { - "throws": "Ambiguous expression: wrap the arrow functions in parentheses to disambiguate. (4:4)" + "throws": "Unexpected token, expected \":\" (4:27)" } diff --git a/packages/babel-parser/test/fixtures/flow/regression/issue-58-failing-1/options.json b/packages/babel-parser/test/fixtures/flow/regression/issue-58-failing-1/options.json deleted file mode 100644 index 215199590424..000000000000 --- a/packages/babel-parser/test/fixtures/flow/regression/issue-58-failing-1/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid left-hand side in arrow function parameters (2:11)" -} diff --git a/packages/babel-parser/test/fixtures/flow/regression/issue-58-failing-1/output.json b/packages/babel-parser/test/fixtures/flow/regression/issue-58-failing-1/output.json new file mode 100644 index 000000000000..92d62672928e --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/regression/issue-58-failing-1/output.json @@ -0,0 +1,85 @@ +{ + "type": "File", + "start":0,"end":67,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":24}}, + "errors": [ + "SyntaxError: Binding invalid left-hand side in function parameter list (2:11)" + ], + "program": { + "type": "Program", + "start":0,"end":67,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":24}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":43,"end":67,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":24}}, + "expression": { + "type": "ConditionalExpression", + "start":43,"end":66,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":23}}, + "test": { + "type": "Identifier", + "start":43,"end":44,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":1},"identifierName":"a"}, + "name": "a" + }, + "consequent": { + "type": "Identifier", + "start":48,"end":49,"loc":{"start":{"line":2,"column":5},"end":{"line":2,"column":6},"identifierName":"b"}, + "name": "b", + "extra": { + "parenthesized": true, + "parenStart": 47 + } + }, + "alternate": { + "type": "ArrowFunctionExpression", + "start":53,"end":66,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":23}}, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "ArrowFunctionExpression", + "start":54,"end":60,"loc":{"start":{"line":2,"column":11},"end":{"line":2,"column":17}}, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start":54,"end":55,"loc":{"start":{"line":2,"column":11},"end":{"line":2,"column":12},"identifierName":"c"}, + "name": "c" + } + ], + "body": { + "type": "Identifier", + "start":59,"end":60,"loc":{"start":{"line":2,"column":16},"end":{"line":2,"column":17},"identifierName":"d"}, + "name": "d" + } + } + ], + "body": { + "type": "Identifier", + "start":65,"end":66,"loc":{"start":{"line":2,"column":22},"end":{"line":2,"column":23},"identifierName":"e"}, + "name": "e" + } + } + }, + "leadingComments": [ + { + "type": "CommentLine", + "value": " Function which looks like a return type", + "start":0,"end":42,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":42}} + } + ] + } + ], + "directives": [] + }, + "comments": [ + { + "type": "CommentLine", + "value": " Function which looks like a return type", + "start":0,"end":42,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":42}} + } + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/regression/issue-58-failing-2/options.json b/packages/babel-parser/test/fixtures/flow/regression/issue-58-failing-2/options.json deleted file mode 100644 index 36a678e0e538..000000000000 --- a/packages/babel-parser/test/fixtures/flow/regression/issue-58-failing-2/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid left-hand side in arrow function parameters (2:8)" -} diff --git a/packages/babel-parser/test/fixtures/flow/regression/issue-58-failing-2/output.json b/packages/babel-parser/test/fixtures/flow/regression/issue-58-failing-2/output.json new file mode 100644 index 000000000000..f6bdf3a0ad89 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/regression/issue-58-failing-2/output.json @@ -0,0 +1,126 @@ +{ + "type": "File", + "start":0,"end":83,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":36}}, + "errors": [ + "SyntaxError: Binding invalid left-hand side in function parameter list (2:8)" + ], + "program": { + "type": "Program", + "start":0,"end":83,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":36}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":47,"end":83,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":36}}, + "expression": { + "type": "ConditionalExpression", + "start":47,"end":82,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":35}}, + "test": { + "type": "Identifier", + "start":47,"end":48,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":1},"identifierName":"a"}, + "name": "a" + }, + "consequent": { + "type": "ArrowFunctionExpression", + "start":51,"end":73,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":26}}, + "predicate": null, + "returnType": { + "type": "TypeAnnotation", + "start":63,"end":66,"loc":{"start":{"line":2,"column":16},"end":{"line":2,"column":19}}, + "typeAnnotation": { + "type": "GenericTypeAnnotation", + "start":65,"end":66,"loc":{"start":{"line":2,"column":18},"end":{"line":2,"column":19}}, + "typeParameters": null, + "id": { + "type": "Identifier", + "start":65,"end":66,"loc":{"start":{"line":2,"column":18},"end":{"line":2,"column":19},"identifierName":"d"}, + "name": "d" + } + } + }, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "ArrowFunctionExpression", + "start":55,"end":61,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":14}}, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start":55,"end":56,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":9},"identifierName":"b"}, + "name": "b" + } + ], + "body": { + "type": "Identifier", + "start":60,"end":61,"loc":{"start":{"line":2,"column":13},"end":{"line":2,"column":14},"identifierName":"c"}, + "name": "c" + } + } + ], + "body": { + "type": "Identifier", + "start":71,"end":72,"loc":{"start":{"line":2,"column":24},"end":{"line":2,"column":25},"identifierName":"e"}, + "name": "e", + "extra": { + "parenthesized": true, + "parenStart": 70 + } + }, + "typeParameters": { + "type": "TypeParameterDeclaration", + "start":51,"end":54,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":7}}, + "params": [ + { + "type": "TypeParameter", + "start":52,"end":53,"loc":{"start":{"line":2,"column":5},"end":{"line":2,"column":6}}, + "name": "T", + "variance": null + } + ] + } + }, + "alternate": { + "type": "ArrowFunctionExpression", + "start":76,"end":82,"loc":{"start":{"line":2,"column":29},"end":{"line":2,"column":35}}, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start":76,"end":77,"loc":{"start":{"line":2,"column":29},"end":{"line":2,"column":30},"identifierName":"f"}, + "name": "f" + } + ], + "body": { + "type": "Identifier", + "start":81,"end":82,"loc":{"start":{"line":2,"column":34},"end":{"line":2,"column":35},"identifierName":"g"}, + "name": "g" + } + } + }, + "leadingComments": [ + { + "type": "CommentLine", + "value": " Invalid LHS parameter after type parameters", + "start":0,"end":46,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":46}} + } + ] + } + ], + "directives": [] + }, + "comments": [ + { + "type": "CommentLine", + "value": " Invalid LHS parameter after type parameters", + "start":0,"end":46,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":46}} + } + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/regression/issue-58-failing-3/options.json b/packages/babel-parser/test/fixtures/flow/regression/issue-58-failing-3/options.json deleted file mode 100644 index 2fc0696df35a..000000000000 --- a/packages/babel-parser/test/fixtures/flow/regression/issue-58-failing-3/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid left-hand side in arrow function parameters (2:5)" -} diff --git a/packages/babel-parser/test/fixtures/flow/regression/issue-58-failing-3/output.json b/packages/babel-parser/test/fixtures/flow/regression/issue-58-failing-3/output.json new file mode 100644 index 000000000000..d527059cda90 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/regression/issue-58-failing-3/output.json @@ -0,0 +1,99 @@ +{ + "type": "File", + "start":0,"end":76,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":29}}, + "errors": [ + "SyntaxError: Binding invalid left-hand side in function parameter list (2:5)" + ], + "program": { + "type": "Program", + "start":0,"end":76,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":29}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":47,"end":76,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":29}}, + "expression": { + "type": "ConditionalExpression", + "start":47,"end":75,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":28}}, + "test": { + "type": "Identifier", + "start":47,"end":48,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":1},"identifierName":"a"}, + "name": "a" + }, + "consequent": { + "type": "ArrowFunctionExpression", + "start":51,"end":66,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":19}}, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "ArrowFunctionExpression", + "start":52,"end":58,"loc":{"start":{"line":2,"column":5},"end":{"line":2,"column":11}}, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start":52,"end":53,"loc":{"start":{"line":2,"column":5},"end":{"line":2,"column":6},"identifierName":"b"}, + "name": "b" + } + ], + "body": { + "type": "Identifier", + "start":57,"end":58,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":11},"identifierName":"c"}, + "name": "c" + } + } + ], + "body": { + "type": "Identifier", + "start":64,"end":65,"loc":{"start":{"line":2,"column":17},"end":{"line":2,"column":18},"identifierName":"e"}, + "name": "e", + "extra": { + "parenthesized": true, + "parenStart": 63 + } + } + }, + "alternate": { + "type": "ArrowFunctionExpression", + "start":69,"end":75,"loc":{"start":{"line":2,"column":22},"end":{"line":2,"column":28}}, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start":69,"end":70,"loc":{"start":{"line":2,"column":22},"end":{"line":2,"column":23},"identifierName":"f"}, + "name": "f" + } + ], + "body": { + "type": "Identifier", + "start":74,"end":75,"loc":{"start":{"line":2,"column":27},"end":{"line":2,"column":28},"identifierName":"g"}, + "name": "g" + } + } + }, + "leadingComments": [ + { + "type": "CommentLine", + "value": " Invalid LHS parameter after type parameters", + "start":0,"end":46,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":46}} + } + ] + } + ], + "directives": [] + }, + "comments": [ + { + "type": "CommentLine", + "value": " Invalid LHS parameter after type parameters", + "start":0,"end":46,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":46}} + } + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/regression/issue-58-failing-4/options.json b/packages/babel-parser/test/fixtures/flow/regression/issue-58-failing-4/options.json deleted file mode 100644 index 215199590424..000000000000 --- a/packages/babel-parser/test/fixtures/flow/regression/issue-58-failing-4/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid left-hand side in arrow function parameters (2:11)" -} diff --git a/packages/babel-parser/test/fixtures/flow/regression/issue-58-failing-4/output.json b/packages/babel-parser/test/fixtures/flow/regression/issue-58-failing-4/output.json new file mode 100644 index 000000000000..72ec0ee8727d --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/regression/issue-58-failing-4/output.json @@ -0,0 +1,99 @@ +{ + "type": "File", + "start":0,"end":60,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":35}}, + "errors": [ + "SyntaxError: Binding invalid left-hand side in function parameter list (2:11)" + ], + "program": { + "type": "Program", + "start":0,"end":60,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":35}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":25,"end":60,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":35}}, + "expression": { + "type": "ConditionalExpression", + "start":25,"end":59,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":34}}, + "test": { + "type": "Identifier", + "start":25,"end":26,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":1},"identifierName":"a"}, + "name": "a" + }, + "consequent": { + "type": "ArrowFunctionExpression", + "start":29,"end":50,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":25}}, + "id": null, + "generator": false, + "async": true, + "params": [ + { + "type": "ArrowFunctionExpression", + "start":36,"end":42,"loc":{"start":{"line":2,"column":11},"end":{"line":2,"column":17}}, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start":36,"end":37,"loc":{"start":{"line":2,"column":11},"end":{"line":2,"column":12},"identifierName":"b"}, + "name": "b" + } + ], + "body": { + "type": "Identifier", + "start":41,"end":42,"loc":{"start":{"line":2,"column":16},"end":{"line":2,"column":17},"identifierName":"c"}, + "name": "c" + } + } + ], + "body": { + "type": "Identifier", + "start":48,"end":49,"loc":{"start":{"line":2,"column":23},"end":{"line":2,"column":24},"identifierName":"d"}, + "name": "d", + "extra": { + "parenthesized": true, + "parenStart": 47 + } + } + }, + "alternate": { + "type": "ArrowFunctionExpression", + "start":53,"end":59,"loc":{"start":{"line":2,"column":28},"end":{"line":2,"column":34}}, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start":53,"end":54,"loc":{"start":{"line":2,"column":28},"end":{"line":2,"column":29},"identifierName":"f"}, + "name": "f" + } + ], + "body": { + "type": "Identifier", + "start":58,"end":59,"loc":{"start":{"line":2,"column":33},"end":{"line":2,"column":34},"identifierName":"g"}, + "name": "g" + } + } + }, + "leadingComments": [ + { + "type": "CommentLine", + "value": " Invalid LHS parameter", + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}} + } + ] + } + ], + "directives": [] + }, + "comments": [ + { + "type": "CommentLine", + "value": " Invalid LHS parameter", + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}} + } + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/regression/issue-58/output.json b/packages/babel-parser/test/fixtures/flow/regression/issue-58/output.json index b976e5fd9eab..c7611859247c 100644 --- a/packages/babel-parser/test/fixtures/flow/regression/issue-58/output.json +++ b/packages/babel-parser/test/fixtures/flow/regression/issue-58/output.json @@ -1,94 +1,26 @@ { "type": "File", - "start": 0, - "end": 1930, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 44, - "column": 36 - } - }, + "start":0,"end":1930,"loc":{"start":{"line":1,"column":0},"end":{"line":44,"column":36}}, "program": { "type": "Program", - "start": 0, - "end": 1930, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 44, - "column": 36 - } - }, + "start":0,"end":1930,"loc":{"start":{"line":1,"column":0},"end":{"line":44,"column":36}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 38, - "end": 55, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 17 - } - }, + "start":38,"end":55,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":17}}, "expression": { "type": "ConditionalExpression", - "start": 38, - "end": 54, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 16 - } - }, + "start":38,"end":54,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":16}}, "test": { "type": "Identifier", - "start": 38, - "end": 39, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 1 - }, - "identifierName": "a" - }, + "start":38,"end":39,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":1},"identifierName":"a"}, "name": "a" }, "consequent": { "type": "Identifier", - "start": 43, - "end": 44, - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 6 - }, - "identifierName": "b" - }, + "start":43,"end":44,"loc":{"start":{"line":2,"column":5},"end":{"line":2,"column":6},"identifierName":"b"}, "name": "b", "extra": { "parenthesized": true, @@ -97,55 +29,20 @@ }, "alternate": { "type": "ArrowFunctionExpression", - "start": 48, - "end": 54, - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 16 - } - }, + "start":48,"end":54,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":16}}, "id": null, "generator": false, "async": false, "params": [ { "type": "Identifier", - "start": 48, - "end": 49, - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 11 - }, - "identifierName": "c" - }, + "start":48,"end":49,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":11},"identifierName":"c"}, "name": "c" } ], "body": { "type": "Identifier", - "start": 53, - "end": 54, - "loc": { - "start": { - "line": 2, - "column": 15 - }, - "end": { - "line": 2, - "column": 16 - }, - "identifierName": "d" - }, + "start":53,"end":54,"loc":{"start":{"line":2,"column":15},"end":{"line":2,"column":16},"identifierName":"d"}, "name": "d" } } @@ -154,143 +51,42 @@ { "type": "CommentLine", "value": " Valid lhs value inside parentheses", - "start": 0, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 37 - } - } + "start":0,"end":37,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":37}} } ], "trailingComments": [ { "type": "CommentLine", "value": " a ? b : (c => d)", - "start": 56, - "end": 75, - "loc": { - "start": { - "line": 2, - "column": 18 - }, - "end": { - "line": 2, - "column": 37 - } - } + "start":56,"end":75,"loc":{"start":{"line":2,"column":18},"end":{"line":2,"column":37}} } ] }, { "type": "ExpressionStatement", - "start": 76, - "end": 97, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 21 - } - }, + "start":76,"end":97,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":21}}, "expression": { "type": "ConditionalExpression", - "start": 76, - "end": 96, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 20 - } - }, + "start":76,"end":96,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":20}}, "test": { "type": "Identifier", - "start": 76, - "end": 77, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - }, - "identifierName": "a" - }, + "start":76,"end":77,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":1},"identifierName":"a"}, "name": "a" }, "consequent": { "type": "ArrowFunctionExpression", - "start": 80, - "end": 92, - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 16 - } - }, + "start":80,"end":92,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":16}}, "predicate": null, "returnType": { "type": "TypeAnnotation", - "start": 84, - "end": 87, - "loc": { - "start": { - "line": 3, - "column": 8 - }, - "end": { - "line": 3, - "column": 11 - } - }, + "start":84,"end":87,"loc":{"start":{"line":3,"column":8},"end":{"line":3,"column":11}}, "typeAnnotation": { "type": "GenericTypeAnnotation", - "start": 86, - "end": 87, - "loc": { - "start": { - "line": 3, - "column": 10 - }, - "end": { - "line": 3, - "column": 11 - } - }, + "start":86,"end":87,"loc":{"start":{"line":3,"column":10},"end":{"line":3,"column":11}}, "typeParameters": null, "id": { "type": "Identifier", - "start": 86, - "end": 87, - "loc": { - "start": { - "line": 3, - "column": 10 - }, - "end": { - "line": 3, - "column": 11 - }, - "identifierName": "c" - }, + "start":86,"end":87,"loc":{"start":{"line":3,"column":10},"end":{"line":3,"column":11},"identifierName":"c"}, "name": "c" } } @@ -301,55 +97,19 @@ "params": [ { "type": "Identifier", - "start": 81, - "end": 82, - "loc": { - "start": { - "line": 3, - "column": 5 - }, - "end": { - "line": 3, - "column": 6 - }, - "identifierName": "b" - }, + "start":81,"end":82,"loc":{"start":{"line":3,"column":5},"end":{"line":3,"column":6},"identifierName":"b"}, "name": "b" } ], "body": { "type": "Identifier", - "start": 91, - "end": 92, - "loc": { - "start": { - "line": 3, - "column": 15 - }, - "end": { - "line": 3, - "column": 16 - }, - "identifierName": "d" - }, + "start":91,"end":92,"loc":{"start":{"line":3,"column":15},"end":{"line":3,"column":16},"identifierName":"d"}, "name": "d" } }, "alternate": { "type": "Identifier", - "start": 95, - "end": 96, - "loc": { - "start": { - "line": 3, - "column": 19 - }, - "end": { - "line": 3, - "column": 20 - }, - "identifierName": "e" - }, + "start":95,"end":96,"loc":{"start":{"line":3,"column":19},"end":{"line":3,"column":20},"identifierName":"e"}, "name": "e" } }, @@ -357,99 +117,31 @@ { "type": "CommentLine", "value": " a ? b : (c => d)", - "start": 56, - "end": 75, - "loc": { - "start": { - "line": 2, - "column": 18 - }, - "end": { - "line": 2, - "column": 37 - } - } + "start":56,"end":75,"loc":{"start":{"line":2,"column":18},"end":{"line":2,"column":37}} } ], "trailingComments": [ { "type": "CommentLine", "value": " a ? ((b): c => d) : e", - "start": 98, - "end": 122, - "loc": { - "start": { - "line": 3, - "column": 22 - }, - "end": { - "line": 3, - "column": 46 - } - } + "start":98,"end":122,"loc":{"start":{"line":3,"column":22},"end":{"line":3,"column":46}} } ] }, { "type": "ExpressionStatement", - "start": 123, - "end": 146, - "loc": { - "start": { - "line": 4, - "column": 0 - }, - "end": { - "line": 4, - "column": 23 - } - }, + "start":123,"end":146,"loc":{"start":{"line":4,"column":0},"end":{"line":4,"column":23}}, "expression": { "type": "ConditionalExpression", - "start": 123, - "end": 145, - "loc": { - "start": { - "line": 4, - "column": 0 - }, - "end": { - "line": 4, - "column": 22 - } - }, + "start":123,"end":145,"loc":{"start":{"line":4,"column":0},"end":{"line":4,"column":22}}, "test": { "type": "Identifier", - "start": 123, - "end": 124, - "loc": { - "start": { - "line": 4, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - }, - "identifierName": "a" - }, + "start":123,"end":124,"loc":{"start":{"line":4,"column":0},"end":{"line":4,"column":1},"identifierName":"a"}, "name": "a" }, "consequent": { "type": "Identifier", - "start": 128, - "end": 129, - "loc": { - "start": { - "line": 4, - "column": 5 - }, - "end": { - "line": 4, - "column": 6 - }, - "identifierName": "b" - }, + "start":128,"end":129,"loc":{"start":{"line":4,"column":5},"end":{"line":4,"column":6},"identifierName":"b"}, "name": "b", "extra": { "parenthesized": true, @@ -458,63 +150,18 @@ }, "alternate": { "type": "ArrowFunctionExpression", - "start": 133, - "end": 145, - "loc": { - "start": { - "line": 4, - "column": 10 - }, - "end": { - "line": 4, - "column": 22 - } - }, + "start":133,"end":145,"loc":{"start":{"line":4,"column":10},"end":{"line":4,"column":22}}, "predicate": null, "returnType": { "type": "TypeAnnotation", - "start": 137, - "end": 140, - "loc": { - "start": { - "line": 4, - "column": 14 - }, - "end": { - "line": 4, - "column": 17 - } - }, + "start":137,"end":140,"loc":{"start":{"line":4,"column":14},"end":{"line":4,"column":17}}, "typeAnnotation": { "type": "GenericTypeAnnotation", - "start": 139, - "end": 140, - "loc": { - "start": { - "line": 4, - "column": 16 - }, - "end": { - "line": 4, - "column": 17 - } - }, + "start":139,"end":140,"loc":{"start":{"line":4,"column":16},"end":{"line":4,"column":17}}, "typeParameters": null, "id": { "type": "Identifier", - "start": 139, - "end": 140, - "loc": { - "start": { - "line": 4, - "column": 16 - }, - "end": { - "line": 4, - "column": 17 - }, - "identifierName": "d" - }, + "start":139,"end":140,"loc":{"start":{"line":4,"column":16},"end":{"line":4,"column":17},"identifierName":"d"}, "name": "d" } } @@ -525,37 +172,13 @@ "params": [ { "type": "Identifier", - "start": 134, - "end": 135, - "loc": { - "start": { - "line": 4, - "column": 11 - }, - "end": { - "line": 4, - "column": 12 - }, - "identifierName": "c" - }, + "start":134,"end":135,"loc":{"start":{"line":4,"column":11},"end":{"line":4,"column":12},"identifierName":"c"}, "name": "c" } ], "body": { "type": "Identifier", - "start": 144, - "end": 145, - "loc": { - "start": { - "line": 4, - "column": 21 - }, - "end": { - "line": 4, - "column": 22 - }, - "identifierName": "e" - }, + "start":144,"end":145,"loc":{"start":{"line":4,"column":21},"end":{"line":4,"column":22},"identifierName":"e"}, "name": "e" } } @@ -564,183 +187,58 @@ { "type": "CommentLine", "value": " a ? ((b): c => d) : e", - "start": 98, - "end": 122, - "loc": { - "start": { - "line": 3, - "column": 22 - }, - "end": { - "line": 3, - "column": 46 - } - } + "start":98,"end":122,"loc":{"start":{"line":3,"column":22},"end":{"line":3,"column":46}} } ], "trailingComments": [ { "type": "CommentLine", "value": " a ? b : ((c): d => e)", - "start": 147, - "end": 171, - "loc": { - "start": { - "line": 4, - "column": 24 - }, - "end": { - "line": 4, - "column": 48 - } - } + "start":147,"end":171,"loc":{"start":{"line":4,"column":24},"end":{"line":4,"column":48}} }, { "type": "CommentLine", "value": " Nested arrow function inside parentheses", - "start": 173, - "end": 216, - "loc": { - "start": { - "line": 6, - "column": 0 - }, - "end": { - "line": 6, - "column": 43 - } - } + "start":173,"end":216,"loc":{"start":{"line":6,"column":0},"end":{"line":6,"column":43}} } ] }, { "type": "ExpressionStatement", - "start": 217, - "end": 245, - "loc": { - "start": { - "line": 7, - "column": 0 - }, - "end": { - "line": 7, - "column": 28 - } - }, + "start":217,"end":245,"loc":{"start":{"line":7,"column":0},"end":{"line":7,"column":28}}, "expression": { "type": "ConditionalExpression", - "start": 217, - "end": 244, - "loc": { - "start": { - "line": 7, - "column": 0 - }, - "end": { - "line": 7, - "column": 27 - } - }, + "start":217,"end":244,"loc":{"start":{"line":7,"column":0},"end":{"line":7,"column":27}}, "test": { "type": "Identifier", - "start": 217, - "end": 218, - "loc": { - "start": { - "line": 7, - "column": 0 - }, - "end": { - "line": 7, - "column": 1 - }, - "identifierName": "a" - }, + "start":217,"end":218,"loc":{"start":{"line":7,"column":0},"end":{"line":7,"column":1},"identifierName":"a"}, "name": "a" }, "consequent": { "type": "AssignmentExpression", - "start": 222, - "end": 234, - "loc": { - "start": { - "line": 7, - "column": 5 - }, - "end": { - "line": 7, - "column": 17 - } - }, + "start":222,"end":234,"loc":{"start":{"line":7,"column":5},"end":{"line":7,"column":17}}, "operator": "=", "left": { "type": "Identifier", - "start": 222, - "end": 223, - "loc": { - "start": { - "line": 7, - "column": 5 - }, - "end": { - "line": 7, - "column": 6 - }, - "identifierName": "b" - }, + "start":222,"end":223,"loc":{"start":{"line":7,"column":5},"end":{"line":7,"column":6},"identifierName":"b"}, "name": "b" }, "right": { "type": "ArrowFunctionExpression", - "start": 226, - "end": 234, - "loc": { - "start": { - "line": 7, - "column": 9 - }, - "end": { - "line": 7, - "column": 17 - } - }, + "start":226,"end":234,"loc":{"start":{"line":7,"column":9},"end":{"line":7,"column":17}}, "id": null, "generator": false, "async": false, "params": [ { "type": "Identifier", - "start": 227, - "end": 228, - "loc": { - "start": { - "line": 7, - "column": 10 - }, - "end": { - "line": 7, - "column": 11 - }, - "identifierName": "c" - }, + "start":227,"end":228,"loc":{"start":{"line":7,"column":10},"end":{"line":7,"column":11},"identifierName":"c"}, "name": "c" } ], "body": { "type": "Identifier", - "start": 233, - "end": 234, - "loc": { - "start": { - "line": 7, - "column": 16 - }, - "end": { - "line": 7, - "column": 17 - }, - "identifierName": "d" - }, + "start":233,"end":234,"loc":{"start":{"line":7,"column":16},"end":{"line":7,"column":17},"identifierName":"d"}, "name": "d" } }, @@ -751,55 +249,20 @@ }, "alternate": { "type": "ArrowFunctionExpression", - "start": 238, - "end": 244, - "loc": { - "start": { - "line": 7, - "column": 21 - }, - "end": { - "line": 7, - "column": 27 - } - }, + "start":238,"end":244,"loc":{"start":{"line":7,"column":21},"end":{"line":7,"column":27}}, "id": null, "generator": false, "async": false, "params": [ { "type": "Identifier", - "start": 238, - "end": 239, - "loc": { - "start": { - "line": 7, - "column": 21 - }, - "end": { - "line": 7, - "column": 22 - }, - "identifierName": "e" - }, + "start":238,"end":239,"loc":{"start":{"line":7,"column":21},"end":{"line":7,"column":22},"identifierName":"e"}, "name": "e" } ], "body": { "type": "Identifier", - "start": 243, - "end": 244, - "loc": { - "start": { - "line": 7, - "column": 26 - }, - "end": { - "line": 7, - "column": 27 - }, - "identifierName": "f" - }, + "start":243,"end":244,"loc":{"start":{"line":7,"column":26},"end":{"line":7,"column":27},"identifierName":"f"}, "name": "f" } } @@ -808,159 +271,47 @@ { "type": "CommentLine", "value": " a ? b : ((c): d => e)", - "start": 147, - "end": 171, - "loc": { - "start": { - "line": 4, - "column": 24 - }, - "end": { - "line": 4, - "column": 48 - } - } + "start":147,"end":171,"loc":{"start":{"line":4,"column":24},"end":{"line":4,"column":48}} }, { "type": "CommentLine", "value": " Nested arrow function inside parentheses", - "start": 173, - "end": 216, - "loc": { - "start": { - "line": 6, - "column": 0 - }, - "end": { - "line": 6, - "column": 43 - } - } + "start":173,"end":216,"loc":{"start":{"line":6,"column":0},"end":{"line":6,"column":43}} } ], "trailingComments": [ { "type": "CommentLine", "value": " a ? (b = (c) => d) : (e => f)", - "start": 246, - "end": 278, - "loc": { - "start": { - "line": 7, - "column": 29 - }, - "end": { - "line": 7, - "column": 61 - } - } + "start":246,"end":278,"loc":{"start":{"line":7,"column":29},"end":{"line":7,"column":61}} } ] }, { "type": "ExpressionStatement", - "start": 279, - "end": 311, - "loc": { - "start": { - "line": 8, - "column": 0 - }, - "end": { - "line": 8, - "column": 32 - } - }, + "start":279,"end":311,"loc":{"start":{"line":8,"column":0},"end":{"line":8,"column":32}}, "expression": { "type": "ConditionalExpression", - "start": 279, - "end": 310, - "loc": { - "start": { - "line": 8, - "column": 0 - }, - "end": { - "line": 8, - "column": 31 - } - }, + "start":279,"end":310,"loc":{"start":{"line":8,"column":0},"end":{"line":8,"column":31}}, "test": { "type": "Identifier", - "start": 279, - "end": 280, - "loc": { - "start": { - "line": 8, - "column": 0 - }, - "end": { - "line": 8, - "column": 1 - }, - "identifierName": "a" - }, + "start":279,"end":280,"loc":{"start":{"line":8,"column":0},"end":{"line":8,"column":1},"identifierName":"a"}, "name": "a" }, "consequent": { "type": "ArrowFunctionExpression", - "start": 283, - "end": 306, - "loc": { - "start": { - "line": 8, - "column": 4 - }, - "end": { - "line": 8, - "column": 27 - } - }, + "start":283,"end":306,"loc":{"start":{"line":8,"column":4},"end":{"line":8,"column":27}}, "predicate": null, "returnType": { "type": "TypeAnnotation", - "start": 298, - "end": 301, - "loc": { - "start": { - "line": 8, - "column": 19 - }, - "end": { - "line": 8, - "column": 22 - } - }, + "start":298,"end":301,"loc":{"start":{"line":8,"column":19},"end":{"line":8,"column":22}}, "typeAnnotation": { "type": "GenericTypeAnnotation", - "start": 300, - "end": 301, - "loc": { - "start": { - "line": 8, - "column": 21 - }, - "end": { - "line": 8, - "column": 22 - } - }, + "start":300,"end":301,"loc":{"start":{"line":8,"column":21},"end":{"line":8,"column":22}}, "typeParameters": null, "id": { "type": "Identifier", - "start": 300, - "end": 301, - "loc": { - "start": { - "line": 8, - "column": 21 - }, - "end": { - "line": 8, - "column": 22 - }, - "identifierName": "e" - }, + "start":300,"end":301,"loc":{"start":{"line":8,"column":21},"end":{"line":8,"column":22},"identifierName":"e"}, "name": "e" } } @@ -971,86 +322,28 @@ "params": [ { "type": "AssignmentPattern", - "start": 284, - "end": 296, - "loc": { - "start": { - "line": 8, - "column": 5 - }, - "end": { - "line": 8, - "column": 17 - } - }, + "start":284,"end":296,"loc":{"start":{"line":8,"column":5},"end":{"line":8,"column":17}}, "left": { "type": "Identifier", - "start": 284, - "end": 285, - "loc": { - "start": { - "line": 8, - "column": 5 - }, - "end": { - "line": 8, - "column": 6 - }, - "identifierName": "b" - }, + "start":284,"end":285,"loc":{"start":{"line":8,"column":5},"end":{"line":8,"column":6},"identifierName":"b"}, "name": "b" }, "right": { "type": "ArrowFunctionExpression", - "start": 288, - "end": 296, - "loc": { - "start": { - "line": 8, - "column": 9 - }, - "end": { - "line": 8, - "column": 17 - } - }, + "start":288,"end":296,"loc":{"start":{"line":8,"column":9},"end":{"line":8,"column":17}}, "id": null, "generator": false, "async": false, "params": [ { "type": "Identifier", - "start": 289, - "end": 290, - "loc": { - "start": { - "line": 8, - "column": 10 - }, - "end": { - "line": 8, - "column": 11 - }, - "identifierName": "c" - }, + "start":289,"end":290,"loc":{"start":{"line":8,"column":10},"end":{"line":8,"column":11},"identifierName":"c"}, "name": "c" } ], "body": { "type": "Identifier", - "start": 295, - "end": 296, - "loc": { - "start": { - "line": 8, - "column": 16 - }, - "end": { - "line": 8, - "column": 17 - }, - "identifierName": "d" - }, + "start":295,"end":296,"loc":{"start":{"line":8,"column":16},"end":{"line":8,"column":17},"identifierName":"d"}, "name": "d" } } @@ -1058,37 +351,13 @@ ], "body": { "type": "Identifier", - "start": 305, - "end": 306, - "loc": { - "start": { - "line": 8, - "column": 26 - }, - "end": { - "line": 8, - "column": 27 - }, - "identifierName": "f" - }, + "start":305,"end":306,"loc":{"start":{"line":8,"column":26},"end":{"line":8,"column":27},"identifierName":"f"}, "name": "f" } }, "alternate": { "type": "Identifier", - "start": 309, - "end": 310, - "loc": { - "start": { - "line": 8, - "column": 30 - }, - "end": { - "line": 8, - "column": 31 - }, - "identifierName": "g" - }, + "start":309,"end":310,"loc":{"start":{"line":8,"column":30},"end":{"line":8,"column":31},"identifierName":"g"}, "name": "g" } }, @@ -1096,190 +365,55 @@ { "type": "CommentLine", "value": " a ? (b = (c) => d) : (e => f)", - "start": 246, - "end": 278, - "loc": { - "start": { - "line": 7, - "column": 29 - }, - "end": { - "line": 7, - "column": 61 - } - } + "start":246,"end":278,"loc":{"start":{"line":7,"column":29},"end":{"line":7,"column":61}} } ], "trailingComments": [ { "type": "CommentLine", "value": " a ? ((b = (c) => d): e => f) : g", - "start": 312, - "end": 347, - "loc": { - "start": { - "line": 8, - "column": 33 - }, - "end": { - "line": 8, - "column": 68 - } - } + "start":312,"end":347,"loc":{"start":{"line":8,"column":33},"end":{"line":8,"column":68}} }, { "type": "CommentLine", "value": " Nested conditional expressions", - "start": 349, - "end": 382, - "loc": { - "start": { - "line": 10, - "column": 0 - }, - "end": { - "line": 10, - "column": 33 - } - } + "start":349,"end":382,"loc":{"start":{"line":10,"column":0},"end":{"line":10,"column":33}} } ] }, { "type": "ExpressionStatement", - "start": 387, - "end": 418, - "loc": { - "start": { - "line": 11, - "column": 4 - }, - "end": { - "line": 11, - "column": 35 - } - }, + "start":387,"end":418,"loc":{"start":{"line":11,"column":4},"end":{"line":11,"column":35}}, "expression": { "type": "ConditionalExpression", - "start": 387, - "end": 417, - "loc": { - "start": { - "line": 11, - "column": 4 - }, - "end": { - "line": 11, - "column": 34 - } - }, + "start":387,"end":417,"loc":{"start":{"line":11,"column":4},"end":{"line":11,"column":34}}, "test": { "type": "Identifier", - "start": 387, - "end": 388, - "loc": { - "start": { - "line": 11, - "column": 4 - }, - "end": { - "line": 11, - "column": 5 - }, - "identifierName": "b" - }, + "start":387,"end":388,"loc":{"start":{"line":11,"column":4},"end":{"line":11,"column":5},"identifierName":"b"}, "name": "b" }, "consequent": { "type": "ConditionalExpression", - "start": 391, - "end": 413, - "loc": { - "start": { - "line": 11, - "column": 8 - }, - "end": { - "line": 11, - "column": 30 - } - }, + "start":391,"end":413,"loc":{"start":{"line":11,"column":8},"end":{"line":11,"column":30}}, "test": { "type": "Identifier", - "start": 391, - "end": 392, - "loc": { - "start": { - "line": 11, - "column": 8 - }, - "end": { - "line": 11, - "column": 9 - }, - "identifierName": "c" - }, + "start":391,"end":392,"loc":{"start":{"line":11,"column":8},"end":{"line":11,"column":9},"identifierName":"c"}, "name": "c" }, "consequent": { "type": "ArrowFunctionExpression", - "start": 395, - "end": 409, - "loc": { - "start": { - "line": 11, - "column": 12 - }, - "end": { - "line": 11, - "column": 26 - } - }, + "start":395,"end":409,"loc":{"start":{"line":11,"column":12},"end":{"line":11,"column":26}}, "predicate": null, "returnType": { "type": "TypeAnnotation", - "start": 399, - "end": 402, - "loc": { - "start": { - "line": 11, - "column": 16 - }, - "end": { - "line": 11, - "column": 19 - } - }, + "start":399,"end":402,"loc":{"start":{"line":11,"column":16},"end":{"line":11,"column":19}}, "typeAnnotation": { "type": "GenericTypeAnnotation", - "start": 401, - "end": 402, - "loc": { - "start": { - "line": 11, - "column": 18 - }, - "end": { - "line": 11, - "column": 19 - } - }, + "start":401,"end":402,"loc":{"start":{"line":11,"column":18},"end":{"line":11,"column":19}}, "typeParameters": null, "id": { "type": "Identifier", - "start": 401, - "end": 402, - "loc": { - "start": { - "line": 11, - "column": 18 - }, - "end": { - "line": 11, - "column": 19 - }, - "identifierName": "e" - }, + "start":401,"end":402,"loc":{"start":{"line":11,"column":18},"end":{"line":11,"column":19},"identifierName":"e"}, "name": "e" } } @@ -1290,37 +424,13 @@ "params": [ { "type": "Identifier", - "start": 396, - "end": 397, - "loc": { - "start": { - "line": 11, - "column": 13 - }, - "end": { - "line": 11, - "column": 14 - }, - "identifierName": "d" - }, + "start":396,"end":397,"loc":{"start":{"line":11,"column":13},"end":{"line":11,"column":14},"identifierName":"d"}, "name": "d" } ], "body": { "type": "Identifier", - "start": 407, - "end": 408, - "loc": { - "start": { - "line": 11, - "column": 24 - }, - "end": { - "line": 11, - "column": 25 - }, - "identifierName": "f" - }, + "start":407,"end":408,"loc":{"start":{"line":11,"column":24},"end":{"line":11,"column":25},"identifierName":"f"}, "name": "f", "extra": { "parenthesized": true, @@ -1330,37 +440,13 @@ }, "alternate": { "type": "Identifier", - "start": 412, - "end": 413, - "loc": { - "start": { - "line": 11, - "column": 29 - }, - "end": { - "line": 11, - "column": 30 - }, - "identifierName": "g" - }, + "start":412,"end":413,"loc":{"start":{"line":11,"column":29},"end":{"line":11,"column":30},"identifierName":"g"}, "name": "g" } }, "alternate": { "type": "Identifier", - "start": 416, - "end": 417, - "loc": { - "start": { - "line": 11, - "column": 33 - }, - "end": { - "line": 11, - "column": 34 - }, - "identifierName": "h" - }, + "start":416,"end":417,"loc":{"start":{"line":11,"column":33},"end":{"line":11,"column":34},"identifierName":"h"}, "name": "h" } }, @@ -1368,177 +454,52 @@ { "type": "CommentLine", "value": " a ? ((b = (c) => d): e => f) : g", - "start": 312, - "end": 347, - "loc": { - "start": { - "line": 8, - "column": 33 - }, - "end": { - "line": 8, - "column": 68 - } - } + "start":312,"end":347,"loc":{"start":{"line":8,"column":33},"end":{"line":8,"column":68}} }, { "type": "CommentLine", "value": " Nested conditional expressions", - "start": 349, - "end": 382, - "loc": { - "start": { - "line": 10, - "column": 0 - }, - "end": { - "line": 10, - "column": 33 - } - } + "start":349,"end":382,"loc":{"start":{"line":10,"column":0},"end":{"line":10,"column":33}} } ], "trailingComments": [ { "type": "CommentLine", "value": " b ? (c ? ((d): e => f) : g) : h", - "start": 419, - "end": 453, - "loc": { - "start": { - "line": 11, - "column": 36 - }, - "end": { - "line": 11, - "column": 70 - } - } + "start":419,"end":453,"loc":{"start":{"line":11,"column":36},"end":{"line":11,"column":70}} } ] }, { "type": "ExpressionStatement", - "start": 454, - "end": 489, - "loc": { - "start": { - "line": 12, - "column": 0 - }, - "end": { - "line": 12, - "column": 35 - } - }, + "start":454,"end":489,"loc":{"start":{"line":12,"column":0},"end":{"line":12,"column":35}}, "expression": { "type": "ConditionalExpression", - "start": 454, - "end": 488, - "loc": { - "start": { - "line": 12, - "column": 0 - }, - "end": { - "line": 12, - "column": 34 - } - }, + "start":454,"end":488,"loc":{"start":{"line":12,"column":0},"end":{"line":12,"column":34}}, "test": { "type": "Identifier", - "start": 454, - "end": 455, - "loc": { - "start": { - "line": 12, - "column": 0 - }, - "end": { - "line": 12, - "column": 1 - }, - "identifierName": "a" - }, + "start":454,"end":455,"loc":{"start":{"line":12,"column":0},"end":{"line":12,"column":1},"identifierName":"a"}, "name": "a" }, "consequent": { "type": "ConditionalExpression", - "start": 458, - "end": 484, - "loc": { - "start": { - "line": 12, - "column": 4 - }, - "end": { - "line": 12, - "column": 30 - } - }, + "start":458,"end":484,"loc":{"start":{"line":12,"column":4},"end":{"line":12,"column":30}}, "test": { "type": "Identifier", - "start": 458, - "end": 459, - "loc": { - "start": { - "line": 12, - "column": 4 - }, - "end": { - "line": 12, - "column": 5 - }, - "identifierName": "b" - }, + "start":458,"end":459,"loc":{"start":{"line":12,"column":4},"end":{"line":12,"column":5},"identifierName":"b"}, "name": "b" }, "consequent": { "type": "ConditionalExpression", - "start": 462, - "end": 480, - "loc": { - "start": { - "line": 12, - "column": 8 - }, - "end": { - "line": 12, - "column": 26 - } - }, + "start":462,"end":480,"loc":{"start":{"line":12,"column":8},"end":{"line":12,"column":26}}, "test": { "type": "Identifier", - "start": 462, - "end": 463, - "loc": { - "start": { - "line": 12, - "column": 8 - }, - "end": { - "line": 12, - "column": 9 - }, - "identifierName": "c" - }, + "start":462,"end":463,"loc":{"start":{"line":12,"column":8},"end":{"line":12,"column":9},"identifierName":"c"}, "name": "c" }, "consequent": { "type": "Identifier", - "start": 467, - "end": 468, - "loc": { - "start": { - "line": 12, - "column": 13 - }, - "end": { - "line": 12, - "column": 14 - }, - "identifierName": "d" - }, + "start":467,"end":468,"loc":{"start":{"line":12,"column":13},"end":{"line":12,"column":14},"identifierName":"d"}, "name": "d", "extra": { "parenthesized": true, @@ -1547,55 +508,20 @@ }, "alternate": { "type": "ArrowFunctionExpression", - "start": 472, - "end": 480, - "loc": { - "start": { - "line": 12, - "column": 18 - }, - "end": { - "line": 12, - "column": 26 - } - }, + "start":472,"end":480,"loc":{"start":{"line":12,"column":18},"end":{"line":12,"column":26}}, "id": null, "generator": false, "async": false, "params": [ { "type": "Identifier", - "start": 472, - "end": 473, - "loc": { - "start": { - "line": 12, - "column": 18 - }, - "end": { - "line": 12, - "column": 19 - }, - "identifierName": "e" - }, + "start":472,"end":473,"loc":{"start":{"line":12,"column":18},"end":{"line":12,"column":19},"identifierName":"e"}, "name": "e" } ], "body": { "type": "Identifier", - "start": 478, - "end": 479, - "loc": { - "start": { - "line": 12, - "column": 24 - }, - "end": { - "line": 12, - "column": 25 - }, - "identifierName": "f" - }, + "start":478,"end":479,"loc":{"start":{"line":12,"column":24},"end":{"line":12,"column":25},"identifierName":"f"}, "name": "f", "extra": { "parenthesized": true, @@ -1606,37 +532,13 @@ }, "alternate": { "type": "Identifier", - "start": 483, - "end": 484, - "loc": { - "start": { - "line": 12, - "column": 29 - }, - "end": { - "line": 12, - "column": 30 - }, - "identifierName": "g" - }, + "start":483,"end":484,"loc":{"start":{"line":12,"column":29},"end":{"line":12,"column":30},"identifierName":"g"}, "name": "g" } }, "alternate": { "type": "Identifier", - "start": 487, - "end": 488, - "loc": { - "start": { - "line": 12, - "column": 33 - }, - "end": { - "line": 12, - "column": 34 - }, - "identifierName": "h" - }, + "start":487,"end":488,"loc":{"start":{"line":12,"column":33},"end":{"line":12,"column":34},"identifierName":"h"}, "name": "h" } }, @@ -1644,130 +546,39 @@ { "type": "CommentLine", "value": " b ? (c ? ((d): e => f) : g) : h", - "start": 419, - "end": 453, - "loc": { - "start": { - "line": 11, - "column": 36 - }, - "end": { - "line": 11, - "column": 70 - } - } + "start":419,"end":453,"loc":{"start":{"line":11,"column":36},"end":{"line":11,"column":70}} } ], "trailingComments": [ { "type": "CommentLine", "value": " a ? (b ? (c ? d : (e => f)) : g) : h", - "start": 490, - "end": 529, - "loc": { - "start": { - "line": 12, - "column": 36 - }, - "end": { - "line": 12, - "column": 75 - } - } + "start":490,"end":529,"loc":{"start":{"line":12,"column":36},"end":{"line":12,"column":75}} } ] }, { "type": "ExpressionStatement", - "start": 531, - "end": 564, - "loc": { - "start": { - "line": 14, - "column": 0 - }, - "end": { - "line": 14, - "column": 33 - } - }, + "start":531,"end":564,"loc":{"start":{"line":14,"column":0},"end":{"line":14,"column":33}}, "expression": { "type": "ConditionalExpression", - "start": 531, - "end": 563, - "loc": { - "start": { - "line": 14, - "column": 0 - }, - "end": { - "line": 14, - "column": 32 - } - }, + "start":531,"end":563,"loc":{"start":{"line":14,"column":0},"end":{"line":14,"column":32}}, "test": { "type": "Identifier", - "start": 531, - "end": 532, - "loc": { - "start": { - "line": 14, - "column": 0 - }, - "end": { - "line": 14, - "column": 1 - }, - "identifierName": "a" - }, + "start":531,"end":532,"loc":{"start":{"line":14,"column":0},"end":{"line":14,"column":1},"identifierName":"a"}, "name": "a" }, "consequent": { "type": "ConditionalExpression", - "start": 535, - "end": 559, - "loc": { - "start": { - "line": 14, - "column": 4 - }, - "end": { - "line": 14, - "column": 28 - } - }, + "start":535,"end":559,"loc":{"start":{"line":14,"column":4},"end":{"line":14,"column":28}}, "test": { "type": "Identifier", - "start": 535, - "end": 536, - "loc": { - "start": { - "line": 14, - "column": 4 - }, - "end": { - "line": 14, - "column": 5 - }, - "identifierName": "b" - }, + "start":535,"end":536,"loc":{"start":{"line":14,"column":4},"end":{"line":14,"column":5},"identifierName":"b"}, "name": "b" }, "consequent": { "type": "Identifier", - "start": 540, - "end": 541, - "loc": { - "start": { - "line": 14, - "column": 9 - }, - "end": { - "line": 14, - "column": 10 - }, - "identifierName": "c" - }, + "start":540,"end":541,"loc":{"start":{"line":14,"column":9},"end":{"line":14,"column":10},"identifierName":"c"}, "name": "c", "extra": { "parenthesized": true, @@ -1775,64 +586,19 @@ } }, "alternate": { - "type": "ArrowFunctionExpression", - "start": 545, - "end": 559, - "loc": { - "start": { - "line": 14, - "column": 14 - }, - "end": { - "line": 14, - "column": 28 - } - }, + "type": "ArrowFunctionExpression", + "start":545,"end":559,"loc":{"start":{"line":14,"column":14},"end":{"line":14,"column":28}}, "predicate": null, "returnType": { "type": "TypeAnnotation", - "start": 549, - "end": 554, - "loc": { - "start": { - "line": 14, - "column": 18 - }, - "end": { - "line": 14, - "column": 23 - } - }, + "start":549,"end":554,"loc":{"start":{"line":14,"column":18},"end":{"line":14,"column":23}}, "typeAnnotation": { "type": "GenericTypeAnnotation", - "start": 552, - "end": 553, - "loc": { - "start": { - "line": 14, - "column": 21 - }, - "end": { - "line": 14, - "column": 22 - } - }, + "start":552,"end":553,"loc":{"start":{"line":14,"column":21},"end":{"line":14,"column":22}}, "typeParameters": null, "id": { "type": "Identifier", - "start": 552, - "end": 553, - "loc": { - "start": { - "line": 14, - "column": 21 - }, - "end": { - "line": 14, - "column": 22 - }, - "identifierName": "e" - }, + "start":552,"end":553,"loc":{"start":{"line":14,"column":21},"end":{"line":14,"column":22},"identifierName":"e"}, "name": "e" } } @@ -1843,56 +609,20 @@ "params": [ { "type": "Identifier", - "start": 546, - "end": 547, - "loc": { - "start": { - "line": 14, - "column": 15 - }, - "end": { - "line": 14, - "column": 16 - }, - "identifierName": "d" - }, + "start":546,"end":547,"loc":{"start":{"line":14,"column":15},"end":{"line":14,"column":16},"identifierName":"d"}, "name": "d" } ], "body": { "type": "Identifier", - "start": 558, - "end": 559, - "loc": { - "start": { - "line": 14, - "column": 27 - }, - "end": { - "line": 14, - "column": 28 - }, - "identifierName": "f" - }, + "start":558,"end":559,"loc":{"start":{"line":14,"column":27},"end":{"line":14,"column":28},"identifierName":"f"}, "name": "f" } } }, "alternate": { "type": "Identifier", - "start": 562, - "end": 563, - "loc": { - "start": { - "line": 14, - "column": 31 - }, - "end": { - "line": 14, - "column": 32 - }, - "identifierName": "g" - }, + "start":562,"end":563,"loc":{"start":{"line":14,"column":31},"end":{"line":14,"column":32},"identifierName":"g"}, "name": "g" } }, @@ -1900,159 +630,47 @@ { "type": "CommentLine", "value": " a ? (b ? (c ? d : (e => f)) : g) : h", - "start": 490, - "end": 529, - "loc": { - "start": { - "line": 12, - "column": 36 - }, - "end": { - "line": 12, - "column": 75 - } - } + "start":490,"end":529,"loc":{"start":{"line":12,"column":36},"end":{"line":12,"column":75}} } ], "trailingComments": [ { "type": "CommentLine", "value": " a ? (b ? c : ((d): e => f)) : g", - "start": 565, - "end": 599, - "loc": { - "start": { - "line": 14, - "column": 34 - }, - "end": { - "line": 14, - "column": 68 - } - } + "start":565,"end":599,"loc":{"start":{"line":14,"column":34},"end":{"line":14,"column":68}} }, { "type": "CommentLine", "value": " Multiple arrow functions", - "start": 601, - "end": 628, - "loc": { - "start": { - "line": 16, - "column": 0 - }, - "end": { - "line": 16, - "column": 27 - } - } + "start":601,"end":628,"loc":{"start":{"line":16,"column":0},"end":{"line":16,"column":27}} } ] }, { "type": "ExpressionStatement", - "start": 629, - "end": 661, - "loc": { - "start": { - "line": 17, - "column": 0 - }, - "end": { - "line": 17, - "column": 32 - } - }, + "start":629,"end":661,"loc":{"start":{"line":17,"column":0},"end":{"line":17,"column":32}}, "expression": { "type": "ConditionalExpression", - "start": 629, - "end": 660, - "loc": { - "start": { - "line": 17, - "column": 0 - }, - "end": { - "line": 17, - "column": 31 - } - }, + "start":629,"end":660,"loc":{"start":{"line":17,"column":0},"end":{"line":17,"column":31}}, "test": { "type": "Identifier", - "start": 629, - "end": 630, - "loc": { - "start": { - "line": 17, - "column": 0 - }, - "end": { - "line": 17, - "column": 1 - }, - "identifierName": "a" - }, + "start":629,"end":630,"loc":{"start":{"line":17,"column":0},"end":{"line":17,"column":1},"identifierName":"a"}, "name": "a" }, "consequent": { "type": "ArrowFunctionExpression", - "start": 633, - "end": 645, - "loc": { - "start": { - "line": 17, - "column": 4 - }, - "end": { - "line": 17, - "column": 16 - } - }, + "start":633,"end":645,"loc":{"start":{"line":17,"column":4},"end":{"line":17,"column":16}}, "predicate": null, "returnType": { "type": "TypeAnnotation", - "start": 637, - "end": 640, - "loc": { - "start": { - "line": 17, - "column": 8 - }, - "end": { - "line": 17, - "column": 11 - } - }, + "start":637,"end":640,"loc":{"start":{"line":17,"column":8},"end":{"line":17,"column":11}}, "typeAnnotation": { "type": "GenericTypeAnnotation", - "start": 639, - "end": 640, - "loc": { - "start": { - "line": 17, - "column": 10 - }, - "end": { - "line": 17, - "column": 11 - } - }, + "start":639,"end":640,"loc":{"start":{"line":17,"column":10},"end":{"line":17,"column":11}}, "typeParameters": null, "id": { "type": "Identifier", - "start": 639, - "end": 640, - "loc": { - "start": { - "line": 17, - "column": 10 - }, - "end": { - "line": 17, - "column": 11 - }, - "identifierName": "c" - }, + "start":639,"end":640,"loc":{"start":{"line":17,"column":10},"end":{"line":17,"column":11},"identifierName":"c"}, "name": "c" } } @@ -2063,99 +681,30 @@ "params": [ { "type": "Identifier", - "start": 634, - "end": 635, - "loc": { - "start": { - "line": 17, - "column": 5 - }, - "end": { - "line": 17, - "column": 6 - }, - "identifierName": "b" - }, + "start":634,"end":635,"loc":{"start":{"line":17,"column":5},"end":{"line":17,"column":6},"identifierName":"b"}, "name": "b" } ], "body": { "type": "Identifier", - "start": 644, - "end": 645, - "loc": { - "start": { - "line": 17, - "column": 15 - }, - "end": { - "line": 17, - "column": 16 - }, - "identifierName": "d" - }, + "start":644,"end":645,"loc":{"start":{"line":17,"column":15},"end":{"line":17,"column":16},"identifierName":"d"}, "name": "d" } }, "alternate": { "type": "ArrowFunctionExpression", - "start": 648, - "end": 660, - "loc": { - "start": { - "line": 17, - "column": 19 - }, - "end": { - "line": 17, - "column": 31 - } - }, + "start":648,"end":660,"loc":{"start":{"line":17,"column":19},"end":{"line":17,"column":31}}, "predicate": null, "returnType": { "type": "TypeAnnotation", - "start": 652, - "end": 655, - "loc": { - "start": { - "line": 17, - "column": 23 - }, - "end": { - "line": 17, - "column": 26 - } - }, + "start":652,"end":655,"loc":{"start":{"line":17,"column":23},"end":{"line":17,"column":26}}, "typeAnnotation": { "type": "GenericTypeAnnotation", - "start": 654, - "end": 655, - "loc": { - "start": { - "line": 17, - "column": 25 - }, - "end": { - "line": 17, - "column": 26 - } - }, + "start":654,"end":655,"loc":{"start":{"line":17,"column":25},"end":{"line":17,"column":26}}, "typeParameters": null, "id": { "type": "Identifier", - "start": 654, - "end": 655, - "loc": { - "start": { - "line": 17, - "column": 25 - }, - "end": { - "line": 17, - "column": 26 - }, - "identifierName": "f" - }, + "start":654,"end":655,"loc":{"start":{"line":17,"column":25},"end":{"line":17,"column":26},"identifierName":"f"}, "name": "f" } } @@ -2166,37 +715,13 @@ "params": [ { "type": "Identifier", - "start": 649, - "end": 650, - "loc": { - "start": { - "line": 17, - "column": 20 - }, - "end": { - "line": 17, - "column": 21 - }, - "identifierName": "e" - }, + "start":649,"end":650,"loc":{"start":{"line":17,"column":20},"end":{"line":17,"column":21},"identifierName":"e"}, "name": "e" } ], "body": { "type": "Identifier", - "start": 659, - "end": 660, - "loc": { - "start": { - "line": 17, - "column": 30 - }, - "end": { - "line": 17, - "column": 31 - }, - "identifierName": "g" - }, + "start":659,"end":660,"loc":{"start":{"line":17,"column":30},"end":{"line":17,"column":31},"identifierName":"g"}, "name": "g" } } @@ -2205,175 +730,52 @@ { "type": "CommentLine", "value": " a ? (b ? c : ((d): e => f)) : g", - "start": 565, - "end": 599, - "loc": { - "start": { - "line": 14, - "column": 34 - }, - "end": { - "line": 14, - "column": 68 - } - } + "start":565,"end":599,"loc":{"start":{"line":14,"column":34},"end":{"line":14,"column":68}} }, { "type": "CommentLine", "value": " Multiple arrow functions", - "start": 601, - "end": 628, - "loc": { - "start": { - "line": 16, - "column": 0 - }, - "end": { - "line": 16, - "column": 27 - } - } + "start":601,"end":628,"loc":{"start":{"line":16,"column":0},"end":{"line":16,"column":27}} } ], "trailingComments": [ { "type": "CommentLine", "value": " a ? ((b): c => d) : ((e): f => g)", - "start": 662, - "end": 698, - "loc": { - "start": { - "line": 17, - "column": 33 - }, - "end": { - "line": 17, - "column": 69 - } - } + "start":662,"end":698,"loc":{"start":{"line":17,"column":33},"end":{"line":17,"column":69}} }, { "type": "CommentLine", "value": " Multiple nested arrow functions ( is needed to avoid ambiguities)", - "start": 700, - "end": 771, - "loc": { - "start": { - "line": 19, - "column": 0 - }, - "end": { - "line": 19, - "column": 71 - } - } + "start":700,"end":771,"loc":{"start":{"line":19,"column":0},"end":{"line":19,"column":71}} } ] }, { "type": "ExpressionStatement", - "start": 772, - "end": 804, - "loc": { - "start": { - "line": 20, - "column": 0 - }, - "end": { - "line": 20, - "column": 32 - } - }, + "start":772,"end":804,"loc":{"start":{"line":20,"column":0},"end":{"line":20,"column":32}}, "expression": { "type": "ConditionalExpression", - "start": 772, - "end": 803, - "loc": { - "start": { - "line": 20, - "column": 0 - }, - "end": { - "line": 20, - "column": 31 - } - }, + "start":772,"end":803,"loc":{"start":{"line":20,"column":0},"end":{"line":20,"column":31}}, "test": { "type": "Identifier", - "start": 772, - "end": 773, - "loc": { - "start": { - "line": 20, - "column": 0 - }, - "end": { - "line": 20, - "column": 1 - }, - "identifierName": "a" - }, + "start":772,"end":773,"loc":{"start":{"line":20,"column":0},"end":{"line":20,"column":1},"identifierName":"a"}, "name": "a" }, "consequent": { "type": "ArrowFunctionExpression", - "start": 776, - "end": 799, - "loc": { - "start": { - "line": 20, - "column": 4 - }, - "end": { - "line": 20, - "column": 27 - } - }, + "start":776,"end":799,"loc":{"start":{"line":20,"column":4},"end":{"line":20,"column":27}}, "predicate": null, "returnType": { "type": "TypeAnnotation", - "start": 780, - "end": 783, - "loc": { - "start": { - "line": 20, - "column": 8 - }, - "end": { - "line": 20, - "column": 11 - } - }, + "start":780,"end":783,"loc":{"start":{"line":20,"column":8},"end":{"line":20,"column":11}}, "typeAnnotation": { "type": "GenericTypeAnnotation", - "start": 782, - "end": 783, - "loc": { - "start": { - "line": 20, - "column": 10 - }, - "end": { - "line": 20, - "column": 11 - } - }, + "start":782,"end":783,"loc":{"start":{"line":20,"column":10},"end":{"line":20,"column":11}}, "typeParameters": null, "id": { "type": "Identifier", - "start": 782, - "end": 783, - "loc": { - "start": { - "line": 20, - "column": 10 - }, - "end": { - "line": 20, - "column": 11 - }, - "identifierName": "c" - }, + "start":782,"end":783,"loc":{"start":{"line":20,"column":10},"end":{"line":20,"column":11},"identifierName":"c"}, "name": "c" } } @@ -2384,81 +786,24 @@ "params": [ { "type": "Identifier", - "start": 777, - "end": 778, - "loc": { - "start": { - "line": 20, - "column": 5 - }, - "end": { - "line": 20, - "column": 6 - }, - "identifierName": "b" - }, + "start":777,"end":778,"loc":{"start":{"line":20,"column":5},"end":{"line":20,"column":6},"identifierName":"b"}, "name": "b" } ], "body": { "type": "ArrowFunctionExpression", - "start": 787, - "end": 799, - "loc": { - "start": { - "line": 20, - "column": 15 - }, - "end": { - "line": 20, - "column": 27 - } - }, + "start":787,"end":799,"loc":{"start":{"line":20,"column":15},"end":{"line":20,"column":27}}, "predicate": null, "returnType": { "type": "TypeAnnotation", - "start": 791, - "end": 794, - "loc": { - "start": { - "line": 20, - "column": 19 - }, - "end": { - "line": 20, - "column": 22 - } - }, + "start":791,"end":794,"loc":{"start":{"line":20,"column":19},"end":{"line":20,"column":22}}, "typeAnnotation": { "type": "GenericTypeAnnotation", - "start": 793, - "end": 794, - "loc": { - "start": { - "line": 20, - "column": 21 - }, - "end": { - "line": 20, - "column": 22 - } - }, + "start":793,"end":794,"loc":{"start":{"line":20,"column":21},"end":{"line":20,"column":22}}, "typeParameters": null, "id": { "type": "Identifier", - "start": 793, - "end": 794, - "loc": { - "start": { - "line": 20, - "column": 21 - }, - "end": { - "line": 20, - "column": 22 - }, - "identifierName": "e" - }, + "start":793,"end":794,"loc":{"start":{"line":20,"column":21},"end":{"line":20,"column":22},"identifierName":"e"}, "name": "e" } } @@ -2469,56 +814,20 @@ "params": [ { "type": "Identifier", - "start": 788, - "end": 789, - "loc": { - "start": { - "line": 20, - "column": 16 - }, - "end": { - "line": 20, - "column": 17 - }, - "identifierName": "d" - }, + "start":788,"end":789,"loc":{"start":{"line":20,"column":16},"end":{"line":20,"column":17},"identifierName":"d"}, "name": "d" } ], "body": { "type": "Identifier", - "start": 798, - "end": 799, - "loc": { - "start": { - "line": 20, - "column": 26 - }, - "end": { - "line": 20, - "column": 27 - }, - "identifierName": "f" - }, + "start":798,"end":799,"loc":{"start":{"line":20,"column":26},"end":{"line":20,"column":27},"identifierName":"f"}, "name": "f" } } }, "alternate": { "type": "Identifier", - "start": 802, - "end": 803, - "loc": { - "start": { - "line": 20, - "column": 30 - }, - "end": { - "line": 20, - "column": 31 - }, - "identifierName": "g" - }, + "start":802,"end":803,"loc":{"start":{"line":20,"column":30},"end":{"line":20,"column":31},"identifierName":"g"}, "name": "g" } }, @@ -2526,115 +835,36 @@ { "type": "CommentLine", "value": " a ? ((b): c => d) : ((e): f => g)", - "start": 662, - "end": 698, - "loc": { - "start": { - "line": 17, - "column": 33 - }, - "end": { - "line": 17, - "column": 69 - } - } + "start":662,"end":698,"loc":{"start":{"line":17,"column":33},"end":{"line":17,"column":69}} }, { "type": "CommentLine", "value": " Multiple nested arrow functions ( is needed to avoid ambiguities)", - "start": 700, - "end": 771, - "loc": { - "start": { - "line": 19, - "column": 0 - }, - "end": { - "line": 19, - "column": 71 - } - } + "start":700,"end":771,"loc":{"start":{"line":19,"column":0},"end":{"line":19,"column":71}} } ], "trailingComments": [ { "type": "CommentLine", "value": " a ? ((b): c => ((d): e => f)) : g", - "start": 805, - "end": 841, - "loc": { - "start": { - "line": 20, - "column": 33 - }, - "end": { - "line": 20, - "column": 69 - } - } + "start":805,"end":841,"loc":{"start":{"line":20,"column":33},"end":{"line":20,"column":69}} } ] }, { "type": "ExpressionStatement", - "start": 842, - "end": 873, - "loc": { - "start": { - "line": 21, - "column": 0 - }, - "end": { - "line": 21, - "column": 31 - } - }, + "start":842,"end":873,"loc":{"start":{"line":21,"column":0},"end":{"line":21,"column":31}}, "expression": { "type": "ConditionalExpression", - "start": 842, - "end": 872, - "loc": { - "start": { - "line": 21, - "column": 0 - }, - "end": { - "line": 21, - "column": 30 - } - }, + "start":842,"end":872,"loc":{"start":{"line":21,"column":0},"end":{"line":21,"column":30}}, "test": { "type": "Identifier", - "start": 842, - "end": 843, - "loc": { - "start": { - "line": 21, - "column": 0 - }, - "end": { - "line": 21, - "column": 1 - }, - "identifierName": "a" - }, + "start":842,"end":843,"loc":{"start":{"line":21,"column":0},"end":{"line":21,"column":1},"identifierName":"a"}, "name": "a" }, "consequent": { "type": "Identifier", - "start": 847, - "end": 848, - "loc": { - "start": { - "line": 21, - "column": 5 - }, - "end": { - "line": 21, - "column": 6 - }, - "identifierName": "b" - }, + "start":847,"end":848,"loc":{"start":{"line":21,"column":5},"end":{"line":21,"column":6},"identifierName":"b"}, "name": "b", "extra": { "parenthesized": true, @@ -2643,99 +873,31 @@ }, "alternate": { "type": "ArrowFunctionExpression", - "start": 852, - "end": 872, - "loc": { - "start": { - "line": 21, - "column": 10 - }, - "end": { - "line": 21, - "column": 30 - } - }, + "start":852,"end":872,"loc":{"start":{"line":21,"column":10},"end":{"line":21,"column":30}}, "id": null, "generator": false, "async": false, "params": [ { "type": "Identifier", - "start": 852, - "end": 853, - "loc": { - "start": { - "line": 21, - "column": 10 - }, - "end": { - "line": 21, - "column": 11 - }, - "identifierName": "c" - }, + "start":852,"end":853,"loc":{"start":{"line":21,"column":10},"end":{"line":21,"column":11},"identifierName":"c"}, "name": "c" } ], "body": { "type": "ArrowFunctionExpression", - "start": 857, - "end": 872, - "loc": { - "start": { - "line": 21, - "column": 15 - }, - "end": { - "line": 21, - "column": 30 - } - }, + "start":857,"end":872,"loc":{"start":{"line":21,"column":15},"end":{"line":21,"column":30}}, "predicate": null, "returnType": { "type": "TypeAnnotation", - "start": 864, - "end": 867, - "loc": { - "start": { - "line": 21, - "column": 22 - }, - "end": { - "line": 21, - "column": 25 - } - }, + "start":864,"end":867,"loc":{"start":{"line":21,"column":22},"end":{"line":21,"column":25}}, "typeAnnotation": { "type": "GenericTypeAnnotation", - "start": 866, - "end": 867, - "loc": { - "start": { - "line": 21, - "column": 24 - }, - "end": { - "line": 21, - "column": 25 - } - }, + "start":866,"end":867,"loc":{"start":{"line":21,"column":24},"end":{"line":21,"column":25}}, "typeParameters": null, "id": { "type": "Identifier", - "start": 866, - "end": 867, - "loc": { - "start": { - "line": 21, - "column": 24 - }, - "end": { - "line": 21, - "column": 25 - }, - "identifierName": "e" - }, + "start":866,"end":867,"loc":{"start":{"line":21,"column":24},"end":{"line":21,"column":25},"identifierName":"e"}, "name": "e" } } @@ -2746,68 +908,22 @@ "params": [ { "type": "Identifier", - "start": 861, - "end": 862, - "loc": { - "start": { - "line": 21, - "column": 19 - }, - "end": { - "line": 21, - "column": 20 - }, - "identifierName": "d" - }, + "start":861,"end":862,"loc":{"start":{"line":21,"column":19},"end":{"line":21,"column":20},"identifierName":"d"}, "name": "d" } ], "body": { "type": "Identifier", - "start": 871, - "end": 872, - "loc": { - "start": { - "line": 21, - "column": 29 - }, - "end": { - "line": 21, - "column": 30 - }, - "identifierName": "f" - }, + "start":871,"end":872,"loc":{"start":{"line":21,"column":29},"end":{"line":21,"column":30},"identifierName":"f"}, "name": "f" }, "typeParameters": { "type": "TypeParameterDeclaration", - "start": 857, - "end": 860, - "loc": { - "start": { - "line": 21, - "column": 15 - }, - "end": { - "line": 21, - "column": 18 - } - }, + "start":857,"end":860,"loc":{"start":{"line":21,"column":15},"end":{"line":21,"column":18}}, "params": [ { "type": "TypeParameter", - "start": 858, - "end": 859, - "loc": { - "start": { - "line": 21, - "column": 16 - }, - "end": { - "line": 21, - "column": 17 - } - }, + "start":858,"end":859,"loc":{"start":{"line":21,"column":16},"end":{"line":21,"column":17}}, "name": "T", "variance": null } @@ -2820,143 +936,42 @@ { "type": "CommentLine", "value": " a ? ((b): c => ((d): e => f)) : g", - "start": 805, - "end": 841, - "loc": { - "start": { - "line": 20, - "column": 33 - }, - "end": { - "line": 20, - "column": 69 - } - } + "start":805,"end":841,"loc":{"start":{"line":20,"column":33},"end":{"line":20,"column":69}} } ], "trailingComments": [ { "type": "CommentLine", "value": " a ? b : (c => ((d): e => f))", - "start": 874, - "end": 908, - "loc": { - "start": { - "line": 21, - "column": 32 - }, - "end": { - "line": 21, - "column": 66 - } - } + "start":874,"end":908,"loc":{"start":{"line":21,"column":32},"end":{"line":21,"column":66}} } ] }, { "type": "ExpressionStatement", - "start": 909, - "end": 940, - "loc": { - "start": { - "line": 22, - "column": 0 - }, - "end": { - "line": 22, - "column": 31 - } - }, + "start":909,"end":940,"loc":{"start":{"line":22,"column":0},"end":{"line":22,"column":31}}, "expression": { "type": "ConditionalExpression", - "start": 909, - "end": 939, - "loc": { - "start": { - "line": 22, - "column": 0 - }, - "end": { - "line": 22, - "column": 30 - } - }, + "start":909,"end":939,"loc":{"start":{"line":22,"column":0},"end":{"line":22,"column":30}}, "test": { "type": "Identifier", - "start": 909, - "end": 910, - "loc": { - "start": { - "line": 22, - "column": 0 - }, - "end": { - "line": 22, - "column": 1 - }, - "identifierName": "a" - }, + "start":909,"end":910,"loc":{"start":{"line":22,"column":0},"end":{"line":22,"column":1},"identifierName":"a"}, "name": "a" }, "consequent": { "type": "ArrowFunctionExpression", - "start": 913, - "end": 930, - "loc": { - "start": { - "line": 22, - "column": 4 - }, - "end": { - "line": 22, - "column": 21 - } - }, + "start":913,"end":930,"loc":{"start":{"line":22,"column":4},"end":{"line":22,"column":21}}, "predicate": null, "returnType": { "type": "TypeAnnotation", - "start": 920, - "end": 923, - "loc": { - "start": { - "line": 22, - "column": 11 - }, - "end": { - "line": 22, - "column": 14 - } - }, + "start":920,"end":923,"loc":{"start":{"line":22,"column":11},"end":{"line":22,"column":14}}, "typeAnnotation": { "type": "GenericTypeAnnotation", - "start": 922, - "end": 923, - "loc": { - "start": { - "line": 22, - "column": 13 - }, - "end": { - "line": 22, - "column": 14 - } - }, + "start":922,"end":923,"loc":{"start":{"line":22,"column":13},"end":{"line":22,"column":14}}, "typeParameters": null, "id": { "type": "Identifier", - "start": 922, - "end": 923, - "loc": { - "start": { - "line": 22, - "column": 13 - }, - "end": { - "line": 22, - "column": 14 - }, - "identifierName": "c" - }, + "start":922,"end":923,"loc":{"start":{"line":22,"column":13},"end":{"line":22,"column":14},"identifierName":"c"}, "name": "c" } } @@ -2967,37 +982,13 @@ "params": [ { "type": "Identifier", - "start": 917, - "end": 918, - "loc": { - "start": { - "line": 22, - "column": 8 - }, - "end": { - "line": 22, - "column": 9 - }, - "identifierName": "b" - }, + "start":917,"end":918,"loc":{"start":{"line":22,"column":8},"end":{"line":22,"column":9},"identifierName":"b"}, "name": "b" } ], "body": { "type": "Identifier", - "start": 928, - "end": 929, - "loc": { - "start": { - "line": 22, - "column": 19 - }, - "end": { - "line": 22, - "column": 20 - }, - "identifierName": "d" - }, + "start":928,"end":929,"loc":{"start":{"line":22,"column":19},"end":{"line":22,"column":20},"identifierName":"d"}, "name": "d", "extra": { "parenthesized": true, @@ -3006,33 +997,11 @@ }, "typeParameters": { "type": "TypeParameterDeclaration", - "start": 913, - "end": 916, - "loc": { - "start": { - "line": 22, - "column": 4 - }, - "end": { - "line": 22, - "column": 7 - } - }, + "start":913,"end":916,"loc":{"start":{"line":22,"column":4},"end":{"line":22,"column":7}}, "params": [ { "type": "TypeParameter", - "start": 914, - "end": 915, - "loc": { - "start": { - "line": 22, - "column": 5 - }, - "end": { - "line": 22, - "column": 6 - } - }, + "start":914,"end":915,"loc":{"start":{"line":22,"column":5},"end":{"line":22,"column":6}}, "name": "T", "variance": null } @@ -3041,55 +1010,20 @@ }, "alternate": { "type": "ArrowFunctionExpression", - "start": 933, - "end": 939, - "loc": { - "start": { - "line": 22, - "column": 24 - }, - "end": { - "line": 22, - "column": 30 - } - }, + "start":933,"end":939,"loc":{"start":{"line":22,"column":24},"end":{"line":22,"column":30}}, "id": null, "generator": false, "async": false, "params": [ { "type": "Identifier", - "start": 933, - "end": 934, - "loc": { - "start": { - "line": 22, - "column": 24 - }, - "end": { - "line": 22, - "column": 25 - }, - "identifierName": "e" - }, + "start":933,"end":934,"loc":{"start":{"line":22,"column":24},"end":{"line":22,"column":25},"identifierName":"e"}, "name": "e" } ], "body": { "type": "Identifier", - "start": 938, - "end": 939, - "loc": { - "start": { - "line": 22, - "column": 29 - }, - "end": { - "line": 22, - "column": 30 - }, - "identifierName": "f" - }, + "start":938,"end":939,"loc":{"start":{"line":22,"column":29},"end":{"line":22,"column":30},"identifierName":"f"}, "name": "f" } } @@ -3098,151 +1032,49 @@ { "type": "CommentLine", "value": " a ? b : (c => ((d): e => f))", - "start": 874, - "end": 908, - "loc": { - "start": { - "line": 21, - "column": 32 - }, - "end": { - "line": 21, - "column": 66 - } - } + "start":874,"end":908,"loc":{"start":{"line":21,"column":32},"end":{"line":21,"column":66}} } ], "trailingComments": [ { "type": "CommentLine", "value": " a ? ((b): c => d) : (e => f)", - "start": 941, - "end": 975, - "loc": { - "start": { - "line": 22, - "column": 32 - }, - "end": { - "line": 22, - "column": 66 - } - } + "start":941,"end":975,"loc":{"start":{"line":22,"column":32},"end":{"line":22,"column":66}} }, { "type": "CommentLine", "value": " Invalid lhs value inside parentheses", - "start": 977, - "end": 1016, - "loc": { - "start": { - "line": 24, - "column": 0 - }, - "end": { - "line": 24, - "column": 39 - } - } + "start":977,"end":1016,"loc":{"start":{"line":24,"column":0},"end":{"line":24,"column":39}} } ] }, { "type": "ExpressionStatement", - "start": 1017, - "end": 1039, - "loc": { - "start": { - "line": 25, - "column": 0 - }, - "end": { - "line": 25, - "column": 22 - } - }, + "start":1017,"end":1039,"loc":{"start":{"line":25,"column":0},"end":{"line":25,"column":22}}, "expression": { "type": "ConditionalExpression", - "start": 1017, - "end": 1038, - "loc": { - "start": { - "line": 25, - "column": 0 - }, - "end": { - "line": 25, - "column": 21 - } - }, + "start":1017,"end":1038,"loc":{"start":{"line":25,"column":0},"end":{"line":25,"column":21}}, "test": { "type": "Identifier", - "start": 1017, - "end": 1018, - "loc": { - "start": { - "line": 25, - "column": 0 - }, - "end": { - "line": 25, - "column": 1 - }, - "identifierName": "a" - }, + "start":1017,"end":1018,"loc":{"start":{"line":25,"column":0},"end":{"line":25,"column":1},"identifierName":"a"}, "name": "a" }, "consequent": { "type": "ArrowFunctionExpression", - "start": 1022, - "end": 1028, - "loc": { - "start": { - "line": 25, - "column": 5 - }, - "end": { - "line": 25, - "column": 11 - } - }, + "start":1022,"end":1028,"loc":{"start":{"line":25,"column":5},"end":{"line":25,"column":11}}, "id": null, "generator": false, "async": false, "params": [ { "type": "Identifier", - "start": 1022, - "end": 1023, - "loc": { - "start": { - "line": 25, - "column": 5 - }, - "end": { - "line": 25, - "column": 6 - }, - "identifierName": "b" - }, + "start":1022,"end":1023,"loc":{"start":{"line":25,"column":5},"end":{"line":25,"column":6},"identifierName":"b"}, "name": "b" } ], "body": { "type": "Identifier", - "start": 1027, - "end": 1028, - "loc": { - "start": { - "line": 25, - "column": 10 - }, - "end": { - "line": 25, - "column": 11 - }, - "identifierName": "c" - }, + "start":1027,"end":1028,"loc":{"start":{"line":25,"column":10},"end":{"line":25,"column":11},"identifierName":"c"}, "name": "c" }, "extra": { @@ -3252,55 +1084,20 @@ }, "alternate": { "type": "ArrowFunctionExpression", - "start": 1032, - "end": 1038, - "loc": { - "start": { - "line": 25, - "column": 15 - }, - "end": { - "line": 25, - "column": 21 - } - }, + "start":1032,"end":1038,"loc":{"start":{"line":25,"column":15},"end":{"line":25,"column":21}}, "id": null, "generator": false, "async": false, "params": [ { "type": "Identifier", - "start": 1032, - "end": 1033, - "loc": { - "start": { - "line": 25, - "column": 15 - }, - "end": { - "line": 25, - "column": 16 - }, - "identifierName": "d" - }, + "start":1032,"end":1033,"loc":{"start":{"line":25,"column":15},"end":{"line":25,"column":16},"identifierName":"d"}, "name": "d" } ], "body": { "type": "Identifier", - "start": 1037, - "end": 1038, - "loc": { - "start": { - "line": 25, - "column": 20 - }, - "end": { - "line": 25, - "column": 21 - }, - "identifierName": "e" - }, + "start":1037,"end":1038,"loc":{"start":{"line":25,"column":20},"end":{"line":25,"column":21},"identifierName":"e"}, "name": "e" } } @@ -3309,182 +1106,57 @@ { "type": "CommentLine", "value": " a ? ((b): c => d) : (e => f)", - "start": 941, - "end": 975, - "loc": { - "start": { - "line": 22, - "column": 32 - }, - "end": { - "line": 22, - "column": 66 - } - } + "start":941,"end":975,"loc":{"start":{"line":22,"column":32},"end":{"line":22,"column":66}} }, { "type": "CommentLine", "value": " Invalid lhs value inside parentheses", - "start": 977, - "end": 1016, - "loc": { - "start": { - "line": 24, - "column": 0 - }, - "end": { - "line": 24, - "column": 39 - } - } + "start":977,"end":1016,"loc":{"start":{"line":24,"column":0},"end":{"line":24,"column":39}} } ], "trailingComments": [ { "type": "CommentLine", "value": " a ? (b => c) : (d => e)", - "start": 1040, - "end": 1066, - "loc": { - "start": { - "line": 25, - "column": 23 - }, - "end": { - "line": 25, - "column": 49 - } - } + "start":1040,"end":1066,"loc":{"start":{"line":25,"column":23},"end":{"line":25,"column":49}} } ] }, { "type": "ExpressionStatement", - "start": 1067, - "end": 1097, - "loc": { - "start": { - "line": 26, - "column": 0 - }, - "end": { - "line": 26, - "column": 30 - } - }, + "start":1067,"end":1097,"loc":{"start":{"line":26,"column":0},"end":{"line":26,"column":30}}, "expression": { "type": "ConditionalExpression", - "start": 1067, - "end": 1096, - "loc": { - "start": { - "line": 26, - "column": 0 - }, - "end": { - "line": 26, - "column": 29 - } - }, + "start":1067,"end":1096,"loc":{"start":{"line":26,"column":0},"end":{"line":26,"column":29}}, "test": { "type": "Identifier", - "start": 1067, - "end": 1068, - "loc": { - "start": { - "line": 26, - "column": 0 - }, - "end": { - "line": 26, - "column": 1 - }, - "identifierName": "a" - }, + "start":1067,"end":1068,"loc":{"start":{"line":26,"column":0},"end":{"line":26,"column":1},"identifierName":"a"}, "name": "a" }, "consequent": { "type": "ConditionalExpression", - "start": 1071, - "end": 1092, - "loc": { - "start": { - "line": 26, - "column": 4 - }, - "end": { - "line": 26, - "column": 25 - } - }, + "start":1071,"end":1092,"loc":{"start":{"line":26,"column":4},"end":{"line":26,"column":25}}, "test": { "type": "Identifier", - "start": 1071, - "end": 1072, - "loc": { - "start": { - "line": 26, - "column": 4 - }, - "end": { - "line": 26, - "column": 5 - }, - "identifierName": "b" - }, + "start":1071,"end":1072,"loc":{"start":{"line":26,"column":4},"end":{"line":26,"column":5},"identifierName":"b"}, "name": "b" }, "consequent": { "type": "ArrowFunctionExpression", - "start": 1076, - "end": 1082, - "loc": { - "start": { - "line": 26, - "column": 9 - }, - "end": { - "line": 26, - "column": 15 - } - }, + "start":1076,"end":1082,"loc":{"start":{"line":26,"column":9},"end":{"line":26,"column":15}}, "id": null, "generator": false, "async": false, "params": [ { "type": "Identifier", - "start": 1076, - "end": 1077, - "loc": { - "start": { - "line": 26, - "column": 9 - }, - "end": { - "line": 26, - "column": 10 - }, - "identifierName": "c" - }, + "start":1076,"end":1077,"loc":{"start":{"line":26,"column":9},"end":{"line":26,"column":10},"identifierName":"c"}, "name": "c" } ], "body": { "type": "Identifier", - "start": 1081, - "end": 1082, - "loc": { - "start": { - "line": 26, - "column": 14 - }, - "end": { - "line": 26, - "column": 15 - }, - "identifierName": "d" - }, + "start":1081,"end":1082,"loc":{"start":{"line":26,"column":14},"end":{"line":26,"column":15},"identifierName":"d"}, "name": "d" }, "extra": { @@ -3494,74 +1166,27 @@ }, "alternate": { "type": "ArrowFunctionExpression", - "start": 1086, - "end": 1092, - "loc": { - "start": { - "line": 26, - "column": 19 - }, - "end": { - "line": 26, - "column": 25 - } - }, + "start":1086,"end":1092,"loc":{"start":{"line":26,"column":19},"end":{"line":26,"column":25}}, "id": null, "generator": false, "async": false, "params": [ { "type": "Identifier", - "start": 1086, - "end": 1087, - "loc": { - "start": { - "line": 26, - "column": 19 - }, - "end": { - "line": 26, - "column": 20 - }, - "identifierName": "e" - }, + "start":1086,"end":1087,"loc":{"start":{"line":26,"column":19},"end":{"line":26,"column":20},"identifierName":"e"}, "name": "e" } ], "body": { "type": "Identifier", - "start": 1091, - "end": 1092, - "loc": { - "start": { - "line": 26, - "column": 24 - }, - "end": { - "line": 26, - "column": 25 - }, - "identifierName": "f" - }, + "start":1091,"end":1092,"loc":{"start":{"line":26,"column":24},"end":{"line":26,"column":25},"identifierName":"f"}, "name": "f" } } }, "alternate": { "type": "Identifier", - "start": 1095, - "end": 1096, - "loc": { - "start": { - "line": 26, - "column": 28 - }, - "end": { - "line": 26, - "column": 29 - }, - "identifierName": "g" - }, + "start":1095,"end":1096,"loc":{"start":{"line":26,"column":28},"end":{"line":26,"column":29},"identifierName":"g"}, "name": "g" } }, @@ -3569,159 +1194,47 @@ { "type": "CommentLine", "value": " a ? (b => c) : (d => e)", - "start": 1040, - "end": 1066, - "loc": { - "start": { - "line": 25, - "column": 23 - }, - "end": { - "line": 25, - "column": 49 - } - } + "start":1040,"end":1066,"loc":{"start":{"line":25,"column":23},"end":{"line":25,"column":49}} } ], "trailingComments": [ { "type": "CommentLine", "value": " a ? (b ? (c => d) : (e => f)) : g", - "start": 1098, - "end": 1134, - "loc": { - "start": { - "line": 26, - "column": 31 - }, - "end": { - "line": 26, - "column": 67 - } - } + "start":1098,"end":1134,"loc":{"start":{"line":26,"column":31},"end":{"line":26,"column":67}} }, { "type": "CommentLine", "value": " Invalid lhs value inside parentheses inside arrow function", - "start": 1136, - "end": 1197, - "loc": { - "start": { - "line": 28, - "column": 0 - }, - "end": { - "line": 28, - "column": 61 - } - } + "start":1136,"end":1197,"loc":{"start":{"line":28,"column":0},"end":{"line":28,"column":61}} } ] }, { "type": "ExpressionStatement", - "start": 1198, - "end": 1231, - "loc": { - "start": { - "line": 29, - "column": 0 - }, - "end": { - "line": 29, - "column": 33 - } - }, + "start":1198,"end":1231,"loc":{"start":{"line":29,"column":0},"end":{"line":29,"column":33}}, "expression": { "type": "ConditionalExpression", - "start": 1198, - "end": 1230, - "loc": { - "start": { - "line": 29, - "column": 0 - }, - "end": { - "line": 29, - "column": 32 - } - }, + "start":1198,"end":1230,"loc":{"start":{"line":29,"column":0},"end":{"line":29,"column":32}}, "test": { "type": "Identifier", - "start": 1198, - "end": 1199, - "loc": { - "start": { - "line": 29, - "column": 0 - }, - "end": { - "line": 29, - "column": 1 - }, - "identifierName": "a" - }, + "start":1198,"end":1199,"loc":{"start":{"line":29,"column":0},"end":{"line":29,"column":1},"identifierName":"a"}, "name": "a" }, "consequent": { "type": "ArrowFunctionExpression", - "start": 1202, - "end": 1221, - "loc": { - "start": { - "line": 29, - "column": 4 - }, - "end": { - "line": 29, - "column": 23 - } - }, + "start":1202,"end":1221,"loc":{"start":{"line":29,"column":4},"end":{"line":29,"column":23}}, "predicate": null, "returnType": { "type": "TypeAnnotation", - "start": 1206, - "end": 1209, - "loc": { - "start": { - "line": 29, - "column": 8 - }, - "end": { - "line": 29, - "column": 11 - } - }, + "start":1206,"end":1209,"loc":{"start":{"line":29,"column":8},"end":{"line":29,"column":11}}, "typeAnnotation": { "type": "GenericTypeAnnotation", - "start": 1208, - "end": 1209, - "loc": { - "start": { - "line": 29, - "column": 10 - }, - "end": { - "line": 29, - "column": 11 - } - }, + "start":1208,"end":1209,"loc":{"start":{"line":29,"column":10},"end":{"line":29,"column":11}}, "typeParameters": null, "id": { "type": "Identifier", - "start": 1208, - "end": 1209, - "loc": { - "start": { - "line": 29, - "column": 10 - }, - "end": { - "line": 29, - "column": 11 - }, - "identifierName": "c" - }, + "start":1208,"end":1209,"loc":{"start":{"line":29,"column":10},"end":{"line":29,"column":11},"identifierName":"c"}, "name": "c" } } @@ -3732,73 +1245,26 @@ "params": [ { "type": "Identifier", - "start": 1203, - "end": 1204, - "loc": { - "start": { - "line": 29, - "column": 5 - }, - "end": { - "line": 29, - "column": 6 - }, - "identifierName": "b" - }, + "start":1203,"end":1204,"loc":{"start":{"line":29,"column":5},"end":{"line":29,"column":6},"identifierName":"b"}, "name": "b" } ], "body": { "type": "ArrowFunctionExpression", - "start": 1214, - "end": 1220, - "loc": { - "start": { - "line": 29, - "column": 16 - }, - "end": { - "line": 29, - "column": 22 - } - }, + "start":1214,"end":1220,"loc":{"start":{"line":29,"column":16},"end":{"line":29,"column":22}}, "id": null, "generator": false, "async": false, "params": [ { "type": "Identifier", - "start": 1214, - "end": 1215, - "loc": { - "start": { - "line": 29, - "column": 16 - }, - "end": { - "line": 29, - "column": 17 - }, - "identifierName": "d" - }, + "start":1214,"end":1215,"loc":{"start":{"line":29,"column":16},"end":{"line":29,"column":17},"identifierName":"d"}, "name": "d" } ], "body": { "type": "Identifier", - "start": 1219, - "end": 1220, - "loc": { - "start": { - "line": 29, - "column": 21 - }, - "end": { - "line": 29, - "column": 22 - }, - "identifierName": "e" - }, + "start":1219,"end":1220,"loc":{"start":{"line":29,"column":21},"end":{"line":29,"column":22},"identifierName":"e"}, "name": "e" }, "extra": { @@ -3809,55 +1275,20 @@ }, "alternate": { "type": "ArrowFunctionExpression", - "start": 1224, - "end": 1230, - "loc": { - "start": { - "line": 29, - "column": 26 - }, - "end": { - "line": 29, - "column": 32 - } - }, + "start":1224,"end":1230,"loc":{"start":{"line":29,"column":26},"end":{"line":29,"column":32}}, "id": null, "generator": false, "async": false, "params": [ { "type": "Identifier", - "start": 1224, - "end": 1225, - "loc": { - "start": { - "line": 29, - "column": 26 - }, - "end": { - "line": 29, - "column": 27 - }, - "identifierName": "f" - }, + "start":1224,"end":1225,"loc":{"start":{"line":29,"column":26},"end":{"line":29,"column":27},"identifierName":"f"}, "name": "f" } ], "body": { "type": "Identifier", - "start": 1229, - "end": 1230, - "loc": { - "start": { - "line": 29, - "column": 31 - }, - "end": { - "line": 29, - "column": 32 - }, - "identifierName": "g" - }, + "start":1229,"end":1230,"loc":{"start":{"line":29,"column":31},"end":{"line":29,"column":32},"identifierName":"g"}, "name": "g" } } @@ -3866,182 +1297,57 @@ { "type": "CommentLine", "value": " a ? (b ? (c => d) : (e => f)) : g", - "start": 1098, - "end": 1134, - "loc": { - "start": { - "line": 26, - "column": 31 - }, - "end": { - "line": 26, - "column": 67 - } - } + "start":1098,"end":1134,"loc":{"start":{"line":26,"column":31},"end":{"line":26,"column":67}} }, { "type": "CommentLine", "value": " Invalid lhs value inside parentheses inside arrow function", - "start": 1136, - "end": 1197, - "loc": { - "start": { - "line": 28, - "column": 0 - }, - "end": { - "line": 28, - "column": 61 - } - } + "start":1136,"end":1197,"loc":{"start":{"line":28,"column":0},"end":{"line":28,"column":61}} } ], "trailingComments": [ { "type": "CommentLine", "value": " a ? ((b): c => (d => e)) : (f => g)", - "start": 1232, - "end": 1270, - "loc": { - "start": { - "line": 29, - "column": 34 - }, - "end": { - "line": 29, - "column": 72 - } - } + "start":1232,"end":1270,"loc":{"start":{"line":29,"column":34},"end":{"line":29,"column":72}} } ] }, { "type": "ExpressionStatement", - "start": 1271, - "end": 1313, - "loc": { - "start": { - "line": 30, - "column": 0 - }, - "end": { - "line": 30, - "column": 42 - } - }, + "start":1271,"end":1313,"loc":{"start":{"line":30,"column":0},"end":{"line":30,"column":42}}, "expression": { "type": "ConditionalExpression", - "start": 1271, - "end": 1312, - "loc": { - "start": { - "line": 30, - "column": 0 - }, - "end": { - "line": 30, - "column": 41 - } - }, + "start":1271,"end":1312,"loc":{"start":{"line":30,"column":0},"end":{"line":30,"column":41}}, "test": { "type": "Identifier", - "start": 1271, - "end": 1272, - "loc": { - "start": { - "line": 30, - "column": 0 - }, - "end": { - "line": 30, - "column": 1 - }, - "identifierName": "a" - }, + "start":1271,"end":1272,"loc":{"start":{"line":30,"column":0},"end":{"line":30,"column":1},"identifierName":"a"}, "name": "a" }, "consequent": { "type": "ConditionalExpression", - "start": 1275, - "end": 1303, - "loc": { - "start": { - "line": 30, - "column": 4 - }, - "end": { - "line": 30, - "column": 32 - } - }, + "start":1275,"end":1303,"loc":{"start":{"line":30,"column":4},"end":{"line":30,"column":32}}, "test": { "type": "Identifier", - "start": 1275, - "end": 1276, - "loc": { - "start": { - "line": 30, - "column": 4 - }, - "end": { - "line": 30, - "column": 5 - }, - "identifierName": "b" - }, + "start":1275,"end":1276,"loc":{"start":{"line":30,"column":4},"end":{"line":30,"column":5},"identifierName":"b"}, "name": "b" }, "consequent": { "type": "ArrowFunctionExpression", - "start": 1280, - "end": 1286, - "loc": { - "start": { - "line": 30, - "column": 9 - }, - "end": { - "line": 30, - "column": 15 - } - }, + "start":1280,"end":1286,"loc":{"start":{"line":30,"column":9},"end":{"line":30,"column":15}}, "id": null, "generator": false, "async": false, "params": [ { "type": "Identifier", - "start": 1280, - "end": 1281, - "loc": { - "start": { - "line": 30, - "column": 9 - }, - "end": { - "line": 30, - "column": 10 - }, - "identifierName": "c" - }, + "start":1280,"end":1281,"loc":{"start":{"line":30,"column":9},"end":{"line":30,"column":10},"identifierName":"c"}, "name": "c" } ], "body": { "type": "Identifier", - "start": 1285, - "end": 1286, - "loc": { - "start": { - "line": 30, - "column": 14 - }, - "end": { - "line": 30, - "column": 15 - }, - "identifierName": "d" - }, + "start":1285,"end":1286,"loc":{"start":{"line":30,"column":14},"end":{"line":30,"column":15},"identifierName":"d"}, "name": "d" }, "extra": { @@ -4051,91 +1357,33 @@ }, "alternate": { "type": "ArrowFunctionExpression", - "start": 1290, - "end": 1303, - "loc": { - "start": { - "line": 30, - "column": 19 - }, - "end": { - "line": 30, - "column": 32 - } - }, + "start":1290,"end":1303,"loc":{"start":{"line":30,"column":19},"end":{"line":30,"column":32}}, "id": null, "generator": false, "async": false, "params": [ { "type": "Identifier", - "start": 1290, - "end": 1291, - "loc": { - "start": { - "line": 30, - "column": 19 - }, - "end": { - "line": 30, - "column": 20 - }, - "identifierName": "e" - }, + "start":1290,"end":1291,"loc":{"start":{"line":30,"column":19},"end":{"line":30,"column":20},"identifierName":"e"}, "name": "e" } ], "body": { "type": "ArrowFunctionExpression", - "start": 1296, - "end": 1302, - "loc": { - "start": { - "line": 30, - "column": 25 - }, - "end": { - "line": 30, - "column": 31 - } - }, + "start":1296,"end":1302,"loc":{"start":{"line":30,"column":25},"end":{"line":30,"column":31}}, "id": null, "generator": false, "async": false, "params": [ { "type": "Identifier", - "start": 1296, - "end": 1297, - "loc": { - "start": { - "line": 30, - "column": 25 - }, - "end": { - "line": 30, - "column": 26 - }, - "identifierName": "f" - }, + "start":1296,"end":1297,"loc":{"start":{"line":30,"column":25},"end":{"line":30,"column":26},"identifierName":"f"}, "name": "f" } ], "body": { "type": "Identifier", - "start": 1301, - "end": 1302, - "loc": { - "start": { - "line": 30, - "column": 30 - }, - "end": { - "line": 30, - "column": 31 - }, - "identifierName": "g" - }, + "start":1301,"end":1302,"loc":{"start":{"line":30,"column":30},"end":{"line":30,"column":31},"identifierName":"g"}, "name": "g" }, "extra": { @@ -4147,55 +1395,20 @@ }, "alternate": { "type": "ArrowFunctionExpression", - "start": 1306, - "end": 1312, - "loc": { - "start": { - "line": 30, - "column": 35 - }, - "end": { - "line": 30, - "column": 41 - } - }, + "start":1306,"end":1312,"loc":{"start":{"line":30,"column":35},"end":{"line":30,"column":41}}, "id": null, "generator": false, "async": false, "params": [ { "type": "Identifier", - "start": 1306, - "end": 1307, - "loc": { - "start": { - "line": 30, - "column": 35 - }, - "end": { - "line": 30, - "column": 36 - }, - "identifierName": "h" - }, + "start":1306,"end":1307,"loc":{"start":{"line":30,"column":35},"end":{"line":30,"column":36},"identifierName":"h"}, "name": "h" } ], "body": { "type": "Identifier", - "start": 1311, - "end": 1312, - "loc": { - "start": { - "line": 30, - "column": 40 - }, - "end": { - "line": 30, - "column": 41 - }, - "identifierName": "i" - }, + "start":1311,"end":1312,"loc":{"start":{"line":30,"column":40},"end":{"line":30,"column":41},"identifierName":"i"}, "name": "i" } } @@ -4204,190 +1417,56 @@ { "type": "CommentLine", "value": " a ? ((b): c => (d => e)) : (f => g)", - "start": 1232, - "end": 1270, - "loc": { - "start": { - "line": 29, - "column": 34 - }, - "end": { - "line": 29, - "column": 72 - } - } + "start":1232,"end":1270,"loc":{"start":{"line":29,"column":34},"end":{"line":29,"column":72}} } ], "trailingComments": [ { "type": "CommentLine", "value": " a ? (b ? (c => d) : (e => (f => g))) : (h => i)", - "start": 1314, - "end": 1364, - "loc": { - "start": { - "line": 30, - "column": 43 - }, - "end": { - "line": 30, - "column": 93 - } - } + "start":1314,"end":1364,"loc":{"start":{"line":30,"column":43},"end":{"line":30,"column":93}} }, { "type": "CommentLine", "value": " Function as type annotation", - "start": 1366, - "end": 1396, - "loc": { - "start": { - "line": 32, - "column": 0 - }, - "end": { - "line": 32, - "column": 30 - } - } + "start":1366,"end":1396,"loc":{"start":{"line":32,"column":0},"end":{"line":32,"column":30}} } ] }, { "type": "ExpressionStatement", - "start": 1397, - "end": 1425, - "loc": { - "start": { - "line": 33, - "column": 0 - }, - "end": { - "line": 33, - "column": 28 - } - }, + "start":1397,"end":1425,"loc":{"start":{"line":33,"column":0},"end":{"line":33,"column":28}}, "expression": { "type": "ConditionalExpression", - "start": 1397, - "end": 1424, - "loc": { - "start": { - "line": 33, - "column": 0 - }, - "end": { - "line": 33, - "column": 27 - } - }, + "start":1397,"end":1424,"loc":{"start":{"line":33,"column":0},"end":{"line":33,"column":27}}, "test": { "type": "Identifier", - "start": 1397, - "end": 1398, - "loc": { - "start": { - "line": 33, - "column": 0 - }, - "end": { - "line": 33, - "column": 1 - }, - "identifierName": "a" - }, + "start":1397,"end":1398,"loc":{"start":{"line":33,"column":0},"end":{"line":33,"column":1},"identifierName":"a"}, "name": "a" }, "consequent": { "type": "ArrowFunctionExpression", - "start": 1401, - "end": 1420, - "loc": { - "start": { - "line": 33, - "column": 4 - }, - "end": { - "line": 33, - "column": 23 - } - }, + "start":1401,"end":1420,"loc":{"start":{"line":33,"column":4},"end":{"line":33,"column":23}}, "predicate": null, "returnType": { "type": "TypeAnnotation", - "start": 1405, - "end": 1415, - "loc": { - "start": { - "line": 33, - "column": 8 - }, - "end": { - "line": 33, - "column": 18 - } - }, + "start":1405,"end":1415,"loc":{"start":{"line":33,"column":8},"end":{"line":33,"column":18}}, "typeAnnotation": { "type": "FunctionTypeAnnotation", - "start": 1408, - "end": 1414, - "loc": { - "start": { - "line": 33, - "column": 11 - }, - "end": { - "line": 33, - "column": 17 - } - }, + "start":1408,"end":1414,"loc":{"start":{"line":33,"column":11},"end":{"line":33,"column":17}}, "params": [ { "type": "FunctionTypeParam", - "start": 1408, - "end": 1412, - "loc": { - "start": { - "line": 33, - "column": 11 - }, - "end": { - "line": 33, - "column": 15 - } - }, + "start":1408,"end":1412,"loc":{"start":{"line":33,"column":11},"end":{"line":33,"column":15}}, "name": null, "optional": false, "typeAnnotation": { "type": "GenericTypeAnnotation", - "start": 1408, - "end": 1409, - "loc": { - "start": { - "line": 33, - "column": 11 - }, - "end": { - "line": 33, - "column": 12 - } - }, + "start":1408,"end":1409,"loc":{"start":{"line":33,"column":11},"end":{"line":33,"column":12}}, "typeParameters": null, "id": { "type": "Identifier", - "start": 1408, - "end": 1409, - "loc": { - "start": { - "line": 33, - "column": 11 - }, - "end": { - "line": 33, - "column": 12 - }, - "identifierName": "c" - }, + "start":1408,"end":1409,"loc":{"start":{"line":33,"column":11},"end":{"line":33,"column":12},"identifierName":"c"}, "name": "c" } } @@ -4396,34 +1475,11 @@ "rest": null, "returnType": { "type": "GenericTypeAnnotation", - "start": 1413, - "end": 1414, - "loc": { - "start": { - "line": 33, - "column": 16 - }, - "end": { - "line": 33, - "column": 17 - } - }, + "start":1413,"end":1414,"loc":{"start":{"line":33,"column":16},"end":{"line":33,"column":17}}, "typeParameters": null, "id": { "type": "Identifier", - "start": 1413, - "end": 1414, - "loc": { - "start": { - "line": 33, - "column": 16 - }, - "end": { - "line": 33, - "column": 17 - }, - "identifierName": "d" - }, + "start":1413,"end":1414,"loc":{"start":{"line":33,"column":16},"end":{"line":33,"column":17},"identifierName":"d"}, "name": "d" } }, @@ -4436,55 +1492,19 @@ "params": [ { "type": "Identifier", - "start": 1402, - "end": 1403, - "loc": { - "start": { - "line": 33, - "column": 5 - }, - "end": { - "line": 33, - "column": 6 - }, - "identifierName": "b" - }, + "start":1402,"end":1403,"loc":{"start":{"line":33,"column":5},"end":{"line":33,"column":6},"identifierName":"b"}, "name": "b" } ], "body": { "type": "Identifier", - "start": 1419, - "end": 1420, - "loc": { - "start": { - "line": 33, - "column": 22 - }, - "end": { - "line": 33, - "column": 23 - }, - "identifierName": "e" - }, + "start":1419,"end":1420,"loc":{"start":{"line":33,"column":22},"end":{"line":33,"column":23},"identifierName":"e"}, "name": "e" } }, "alternate": { "type": "Identifier", - "start": 1423, - "end": 1424, - "loc": { - "start": { - "line": 33, - "column": 26 - }, - "end": { - "line": 33, - "column": 27 - }, - "identifierName": "f" - }, + "start":1423,"end":1424,"loc":{"start":{"line":33,"column":26},"end":{"line":33,"column":27},"identifierName":"f"}, "name": "f" } }, @@ -4492,218 +1512,70 @@ { "type": "CommentLine", "value": " a ? (b ? (c => d) : (e => (f => g))) : (h => i)", - "start": 1314, - "end": 1364, - "loc": { - "start": { - "line": 30, - "column": 43 - }, - "end": { - "line": 30, - "column": 93 - } - } + "start":1314,"end":1364,"loc":{"start":{"line":30,"column":43},"end":{"line":30,"column":93}} }, { "type": "CommentLine", "value": " Function as type annotation", - "start": 1366, - "end": 1396, - "loc": { - "start": { - "line": 32, - "column": 0 - }, - "end": { - "line": 32, - "column": 30 - } - } + "start":1366,"end":1396,"loc":{"start":{"line":32,"column":0},"end":{"line":32,"column":30}} } ], "trailingComments": [ { "type": "CommentLine", "value": " a ? ((b): (c => d) => e) : f", - "start": 1426, - "end": 1457, - "loc": { - "start": { - "line": 33, - "column": 29 - }, - "end": { - "line": 33, - "column": 60 - } - } + "start":1426,"end":1457,"loc":{"start":{"line":33,"column":29},"end":{"line":33,"column":60}} }, { "type": "CommentLine", "value": " Async functions or calls", - "start": 1459, - "end": 1486, - "loc": { - "start": { - "line": 35, - "column": 0 - }, - "end": { - "line": 35, - "column": 27 - } - } + "start":1459,"end":1486,"loc":{"start":{"line":35,"column":0},"end":{"line":35,"column":27}} } ] }, { "type": "ExpressionStatement", - "start": 1487, - "end": 1510, - "loc": { - "start": { - "line": 36, - "column": 0 - }, - "end": { - "line": 36, - "column": 23 - } - }, + "start":1487,"end":1510,"loc":{"start":{"line":36,"column":0},"end":{"line":36,"column":23}}, "expression": { "type": "ConditionalExpression", - "start": 1487, - "end": 1509, - "loc": { - "start": { - "line": 36, - "column": 0 - }, - "end": { - "line": 36, - "column": 22 - } - }, + "start":1487,"end":1509,"loc":{"start":{"line":36,"column":0},"end":{"line":36,"column":22}}, "test": { "type": "Identifier", - "start": 1487, - "end": 1488, - "loc": { - "start": { - "line": 36, - "column": 0 - }, - "end": { - "line": 36, - "column": 1 - }, - "identifierName": "a" - }, + "start":1487,"end":1488,"loc":{"start":{"line":36,"column":0},"end":{"line":36,"column":1},"identifierName":"a"}, "name": "a" }, "consequent": { "type": "CallExpression", - "start": 1491, - "end": 1500, - "loc": { - "start": { - "line": 36, - "column": 4 - }, - "end": { - "line": 36, - "column": 13 - } - }, + "start":1491,"end":1500,"loc":{"start":{"line":36,"column":4},"end":{"line":36,"column":13}}, "callee": { "type": "Identifier", - "start": 1491, - "end": 1496, - "loc": { - "start": { - "line": 36, - "column": 4 - }, - "end": { - "line": 36, - "column": 9 - }, - "identifierName": "async" - }, + "start":1491,"end":1496,"loc":{"start":{"line":36,"column":4},"end":{"line":36,"column":9},"identifierName":"async"}, "name": "async" }, "arguments": [ { "type": "Identifier", - "start": 1498, - "end": 1499, - "loc": { - "start": { - "line": 36, - "column": 11 - }, - "end": { - "line": 36, - "column": 12 - }, - "identifierName": "b" - }, + "start":1498,"end":1499,"loc":{"start":{"line":36,"column":11},"end":{"line":36,"column":12},"identifierName":"b"}, "name": "b" } ] }, "alternate": { "type": "ArrowFunctionExpression", - "start": 1503, - "end": 1509, - "loc": { - "start": { - "line": 36, - "column": 16 - }, - "end": { - "line": 36, - "column": 22 - } - }, + "start":1503,"end":1509,"loc":{"start":{"line":36,"column":16},"end":{"line":36,"column":22}}, "id": null, "generator": false, "async": false, "params": [ { "type": "Identifier", - "start": 1503, - "end": 1504, - "loc": { - "start": { - "line": 36, - "column": 16 - }, - "end": { - "line": 36, - "column": 17 - }, - "identifierName": "c" - }, + "start":1503,"end":1504,"loc":{"start":{"line":36,"column":16},"end":{"line":36,"column":17},"identifierName":"c"}, "name": "c" } ], "body": { "type": "Identifier", - "start": 1508, - "end": 1509, - "loc": { - "start": { - "line": 36, - "column": 21 - }, - "end": { - "line": 36, - "column": 22 - }, - "identifierName": "d" - }, + "start":1508,"end":1509,"loc":{"start":{"line":36,"column":21},"end":{"line":36,"column":22},"identifierName":"d"}, "name": "d" } } @@ -4712,158 +1584,46 @@ { "type": "CommentLine", "value": " a ? ((b): (c => d) => e) : f", - "start": 1426, - "end": 1457, - "loc": { - "start": { - "line": 33, - "column": 29 - }, - "end": { - "line": 33, - "column": 60 - } - } + "start":1426,"end":1457,"loc":{"start":{"line":33,"column":29},"end":{"line":33,"column":60}} }, { "type": "CommentLine", - "value": " Async functions or calls", - "start": 1459, - "end": 1486, - "loc": { - "start": { - "line": 35, - "column": 0 - }, - "end": { - "line": 35, - "column": 27 - } - } + "value": " Async functions or calls", + "start":1459,"end":1486,"loc":{"start":{"line":35,"column":0},"end":{"line":35,"column":27}} } ], "trailingComments": [ { "type": "CommentLine", "value": " a ? (async(b)) : (c => d)", - "start": 1511, - "end": 1539, - "loc": { - "start": { - "line": 36, - "column": 24 - }, - "end": { - "line": 36, - "column": 52 - } - } + "start":1511,"end":1539,"loc":{"start":{"line":36,"column":24},"end":{"line":36,"column":52}} } ] }, { "type": "ExpressionStatement", - "start": 1540, - "end": 1567, - "loc": { - "start": { - "line": 37, - "column": 0 - }, - "end": { - "line": 37, - "column": 27 - } - }, + "start":1540,"end":1567,"loc":{"start":{"line":37,"column":0},"end":{"line":37,"column":27}}, "expression": { "type": "ConditionalExpression", - "start": 1540, - "end": 1566, - "loc": { - "start": { - "line": 37, - "column": 0 - }, - "end": { - "line": 37, - "column": 26 - } - }, + "start":1540,"end":1566,"loc":{"start":{"line":37,"column":0},"end":{"line":37,"column":26}}, "test": { "type": "Identifier", - "start": 1540, - "end": 1541, - "loc": { - "start": { - "line": 37, - "column": 0 - }, - "end": { - "line": 37, - "column": 1 - }, - "identifierName": "a" - }, + "start":1540,"end":1541,"loc":{"start":{"line":37,"column":0},"end":{"line":37,"column":1},"identifierName":"a"}, "name": "a" }, "consequent": { "type": "ArrowFunctionExpression", - "start": 1544, - "end": 1562, - "loc": { - "start": { - "line": 37, - "column": 4 - }, - "end": { - "line": 37, - "column": 22 - } - }, + "start":1544,"end":1562,"loc":{"start":{"line":37,"column":4},"end":{"line":37,"column":22}}, "returnType": { "type": "TypeAnnotation", - "start": 1554, - "end": 1557, - "loc": { - "start": { - "line": 37, - "column": 14 - }, - "end": { - "line": 37, - "column": 17 - } - }, + "start":1554,"end":1557,"loc":{"start":{"line":37,"column":14},"end":{"line":37,"column":17}}, "typeAnnotation": { "type": "GenericTypeAnnotation", - "start": 1556, - "end": 1557, - "loc": { - "start": { - "line": 37, - "column": 16 - }, - "end": { - "line": 37, - "column": 17 - } - }, + "start":1556,"end":1557,"loc":{"start":{"line":37,"column":16},"end":{"line":37,"column":17}}, "typeParameters": null, "id": { "type": "Identifier", - "start": 1556, - "end": 1557, - "loc": { - "start": { - "line": 37, - "column": 16 - }, - "end": { - "line": 37, - "column": 17 - }, - "identifierName": "c" - }, + "start":1556,"end":1557,"loc":{"start":{"line":37,"column":16},"end":{"line":37,"column":17},"identifierName":"c"}, "name": "c" } } @@ -4874,55 +1634,19 @@ "params": [ { "type": "Identifier", - "start": 1551, - "end": 1552, - "loc": { - "start": { - "line": 37, - "column": 11 - }, - "end": { - "line": 37, - "column": 12 - }, - "identifierName": "b" - }, + "start":1551,"end":1552,"loc":{"start":{"line":37,"column":11},"end":{"line":37,"column":12},"identifierName":"b"}, "name": "b" } ], "body": { "type": "Identifier", - "start": 1561, - "end": 1562, - "loc": { - "start": { - "line": 37, - "column": 21 - }, - "end": { - "line": 37, - "column": 22 - }, - "identifierName": "d" - }, + "start":1561,"end":1562,"loc":{"start":{"line":37,"column":21},"end":{"line":37,"column":22},"identifierName":"d"}, "name": "d" } }, "alternate": { "type": "Identifier", - "start": 1565, - "end": 1566, - "loc": { - "start": { - "line": 37, - "column": 25 - }, - "end": { - "line": 37, - "column": 26 - }, - "identifierName": "e" - }, + "start":1565,"end":1566,"loc":{"start":{"line":37,"column":25},"end":{"line":37,"column":26},"identifierName":"e"}, "name": "e" } }, @@ -4930,167 +1654,53 @@ { "type": "CommentLine", "value": " a ? (async(b)) : (c => d)", - "start": 1511, - "end": 1539, - "loc": { - "start": { - "line": 36, - "column": 24 - }, - "end": { - "line": 36, - "column": 52 - } - } + "start":1511,"end":1539,"loc":{"start":{"line":36,"column":24},"end":{"line":36,"column":52}} } ], "trailingComments": [ { "type": "CommentLine", "value": " a ? (async (b): c => d) : e", - "start": 1568, - "end": 1598, - "loc": { - "start": { - "line": 37, - "column": 28 - }, - "end": { - "line": 37, - "column": 58 - } - } + "start":1568,"end":1598,"loc":{"start":{"line":37,"column":28},"end":{"line":37,"column":58}} } ] }, { "type": "ExpressionStatement", - "start": 1599, - "end": 1627, - "loc": { - "start": { - "line": 38, - "column": 0 - }, - "end": { - "line": 38, - "column": 28 - } - }, + "start":1599,"end":1627,"loc":{"start":{"line":38,"column":0},"end":{"line":38,"column":28}}, "expression": { "type": "ConditionalExpression", - "start": 1599, - "end": 1626, - "loc": { - "start": { - "line": 38, - "column": 0 - }, - "end": { - "line": 38, - "column": 27 - } - }, + "start":1599,"end":1626,"loc":{"start":{"line":38,"column":0},"end":{"line":38,"column":27}}, "test": { "type": "Identifier", - "start": 1599, - "end": 1600, - "loc": { - "start": { - "line": 38, - "column": 0 - }, - "end": { - "line": 38, - "column": 1 - }, - "identifierName": "a" - }, + "start":1599,"end":1600,"loc":{"start":{"line":38,"column":0},"end":{"line":38,"column":1},"identifierName":"a"}, "name": "a" }, "consequent": { "type": "CallExpression", - "start": 1603, - "end": 1617, - "loc": { - "start": { - "line": 38, - "column": 4 - }, - "end": { - "line": 38, - "column": 18 - } - }, + "start":1603,"end":1617,"loc":{"start":{"line":38,"column":4},"end":{"line":38,"column":18}}, "callee": { "type": "Identifier", - "start": 1603, - "end": 1608, - "loc": { - "start": { - "line": 38, - "column": 4 - }, - "end": { - "line": 38, - "column": 9 - }, - "identifierName": "async" - }, + "start":1603,"end":1608,"loc":{"start":{"line":38,"column":4},"end":{"line":38,"column":9},"identifierName":"async"}, "name": "async" }, "arguments": [ { "type": "ArrowFunctionExpression", - "start": 1610, - "end": 1616, - "loc": { - "start": { - "line": 38, - "column": 11 - }, - "end": { - "line": 38, - "column": 17 - } - }, + "start":1610,"end":1616,"loc":{"start":{"line":38,"column":11},"end":{"line":38,"column":17}}, "id": null, "generator": false, "async": false, "params": [ { "type": "Identifier", - "start": 1610, - "end": 1611, - "loc": { - "start": { - "line": 38, - "column": 11 - }, - "end": { - "line": 38, - "column": 12 - }, - "identifierName": "b" - }, + "start":1610,"end":1611,"loc":{"start":{"line":38,"column":11},"end":{"line":38,"column":12},"identifierName":"b"}, "name": "b" } ], "body": { "type": "Identifier", - "start": 1615, - "end": 1616, - "loc": { - "start": { - "line": 38, - "column": 16 - }, - "end": { - "line": 38, - "column": 17 - }, - "identifierName": "c" - }, + "start":1615,"end":1616,"loc":{"start":{"line":38,"column":16},"end":{"line":38,"column":17},"identifierName":"c"}, "name": "c" } } @@ -5098,55 +1708,20 @@ }, "alternate": { "type": "ArrowFunctionExpression", - "start": 1620, - "end": 1626, - "loc": { - "start": { - "line": 38, - "column": 21 - }, - "end": { - "line": 38, - "column": 27 - } - }, + "start":1620,"end":1626,"loc":{"start":{"line":38,"column":21},"end":{"line":38,"column":27}}, "id": null, "generator": false, "async": false, "params": [ { "type": "Identifier", - "start": 1620, - "end": 1621, - "loc": { - "start": { - "line": 38, - "column": 21 - }, - "end": { - "line": 38, - "column": 22 - }, - "identifierName": "d" - }, + "start":1620,"end":1621,"loc":{"start":{"line":38,"column":21},"end":{"line":38,"column":22},"identifierName":"d"}, "name": "d" } ], "body": { "type": "Identifier", - "start": 1625, - "end": 1626, - "loc": { - "start": { - "line": 38, - "column": 26 - }, - "end": { - "line": 38, - "column": 27 - }, - "identifierName": "e" - }, + "start":1625,"end":1626,"loc":{"start":{"line":38,"column":26},"end":{"line":38,"column":27},"identifierName":"e"}, "name": "e" } } @@ -5155,171 +1730,57 @@ { "type": "CommentLine", "value": " a ? (async (b): c => d) : e", - "start": 1568, - "end": 1598, - "loc": { - "start": { - "line": 37, - "column": 28 - }, - "end": { - "line": 37, - "column": 58 - } - } + "start":1568,"end":1598,"loc":{"start":{"line":37,"column":28},"end":{"line":37,"column":58}} } ], "trailingComments": [ { "type": "CommentLine", "value": " a ? (async(b => c)) : (d => e)", - "start": 1628, - "end": 1661, - "loc": { - "start": { - "line": 38, - "column": 29 - }, - "end": { - "line": 38, - "column": 62 - } - } + "start":1628,"end":1661,"loc":{"start":{"line":38,"column":29},"end":{"line":38,"column":62}} } ] }, { "type": "ExpressionStatement", - "start": 1662, - "end": 1697, - "loc": { - "start": { - "line": 39, - "column": 0 - }, - "end": { - "line": 39, - "column": 35 - } - }, + "start":1662,"end":1697,"loc":{"start":{"line":39,"column":0},"end":{"line":39,"column":35}}, "expression": { "type": "ConditionalExpression", - "start": 1662, - "end": 1696, - "loc": { - "start": { - "line": 39, - "column": 0 - }, - "end": { - "line": 39, - "column": 34 - } - }, + "start":1662,"end":1696,"loc":{"start":{"line":39,"column":0},"end":{"line":39,"column":34}}, "test": { "type": "Identifier", - "start": 1662, - "end": 1663, - "loc": { - "start": { - "line": 39, - "column": 0 - }, - "end": { - "line": 39, - "column": 1 - }, - "identifierName": "a" - }, + "start":1662,"end":1663,"loc":{"start":{"line":39,"column":0},"end":{"line":39,"column":1},"identifierName":"a"}, "name": "a" }, "consequent": { "type": "ArrowFunctionExpression", - "start": 1666, - "end": 1687, - "loc": { - "start": { - "line": 39, - "column": 4 - }, - "end": { - "line": 39, - "column": 25 - } - }, + "start":1666,"end":1687,"loc":{"start":{"line":39,"column":4},"end":{"line":39,"column":25}}, "id": null, "generator": false, "async": true, "params": [ { "type": "Identifier", - "start": 1673, - "end": 1674, - "loc": { - "start": { - "line": 39, - "column": 11 - }, - "end": { - "line": 39, - "column": 12 - }, - "identifierName": "b" - }, + "start":1673,"end":1674,"loc":{"start":{"line":39,"column":11},"end":{"line":39,"column":12},"identifierName":"b"}, "name": "b" } ], "body": { "type": "ArrowFunctionExpression", - "start": 1680, - "end": 1686, - "loc": { - "start": { - "line": 39, - "column": 18 - }, - "end": { - "line": 39, - "column": 24 - } - }, + "start":1680,"end":1686,"loc":{"start":{"line":39,"column":18},"end":{"line":39,"column":24}}, "id": null, "generator": false, "async": false, "params": [ { "type": "Identifier", - "start": 1680, - "end": 1681, - "loc": { - "start": { - "line": 39, - "column": 18 - }, - "end": { - "line": 39, - "column": 19 - }, - "identifierName": "c" - }, + "start":1680,"end":1681,"loc":{"start":{"line":39,"column":18},"end":{"line":39,"column":19},"identifierName":"c"}, "name": "c" } ], "body": { "type": "Identifier", - "start": 1685, - "end": 1686, - "loc": { - "start": { - "line": 39, - "column": 23 - }, - "end": { - "line": 39, - "column": 24 - }, - "identifierName": "d" - }, + "start":1685,"end":1686,"loc":{"start":{"line":39,"column":23},"end":{"line":39,"column":24},"identifierName":"d"}, "name": "d" }, "extra": { @@ -5330,55 +1791,20 @@ }, "alternate": { "type": "ArrowFunctionExpression", - "start": 1690, - "end": 1696, - "loc": { - "start": { - "line": 39, - "column": 28 - }, - "end": { - "line": 39, - "column": 34 - } - }, + "start":1690,"end":1696,"loc":{"start":{"line":39,"column":28},"end":{"line":39,"column":34}}, "id": null, "generator": false, "async": false, "params": [ { "type": "Identifier", - "start": 1690, - "end": 1691, - "loc": { - "start": { - "line": 39, - "column": 28 - }, - "end": { - "line": 39, - "column": 29 - }, - "identifierName": "e" - }, + "start":1690,"end":1691,"loc":{"start":{"line":39,"column":28},"end":{"line":39,"column":29},"identifierName":"e"}, "name": "e" } ], "body": { "type": "Identifier", - "start": 1695, - "end": 1696, - "loc": { - "start": { - "line": 39, - "column": 33 - }, - "end": { - "line": 39, - "column": 34 - }, - "identifierName": "f" - }, + "start":1695,"end":1696,"loc":{"start":{"line":39,"column":33},"end":{"line":39,"column":34},"identifierName":"f"}, "name": "f" } } @@ -5387,161 +1813,49 @@ { "type": "CommentLine", "value": " a ? (async(b => c)) : (d => e)", - "start": 1628, - "end": 1661, - "loc": { - "start": { - "line": 38, - "column": 29 - }, - "end": { - "line": 38, - "column": 62 - } - } + "start":1628,"end":1661,"loc":{"start":{"line":38,"column":29},"end":{"line":38,"column":62}} } ], "trailingComments": [ { "type": "CommentLine", "value": " a ? (async (b) => c => d) : (e => f)", - "start": 1698, - "end": 1737, - "loc": { - "start": { - "line": 39, - "column": 36 - }, - "end": { - "line": 39, - "column": 75 - } - } + "start":1698,"end":1737,"loc":{"start":{"line":39,"column":36},"end":{"line":39,"column":75}} }, { "type": "CommentLine", "value": " https://github.com/prettier/prettier/issues/2194", - "start": 1739, - "end": 1790, - "loc": { - "start": { - "line": 41, - "column": 0 - }, - "end": { - "line": 41, - "column": 51 - } - } + "start":1739,"end":1790,"loc":{"start":{"line":41,"column":0},"end":{"line":41,"column":51}} } ] }, { "type": "VariableDeclaration", - "start": 1791, - "end": 1930, - "loc": { - "start": { - "line": 42, - "column": 0 - }, - "end": { - "line": 44, - "column": 36 - } - }, + "start":1791,"end":1930,"loc":{"start":{"line":42,"column":0},"end":{"line":44,"column":36}}, "declarations": [ { "type": "VariableDeclarator", - "start": 1795, - "end": 1929, - "loc": { - "start": { - "line": 42, - "column": 4 - }, - "end": { - "line": 44, - "column": 35 - } - }, + "start":1795,"end":1929,"loc":{"start":{"line":42,"column":4},"end":{"line":44,"column":35}}, "id": { "type": "Identifier", - "start": 1795, - "end": 1803, - "loc": { - "start": { - "line": 42, - "column": 4 - }, - "end": { - "line": 42, - "column": 12 - }, - "identifierName": "icecream" - }, + "start":1795,"end":1803,"loc":{"start":{"line":42,"column":4},"end":{"line":42,"column":12},"identifierName":"icecream"}, "name": "icecream" }, "init": { "type": "ConditionalExpression", - "start": 1806, - "end": 1929, - "loc": { - "start": { - "line": 42, - "column": 15 - }, - "end": { - "line": 44, - "column": 35 - } - }, + "start":1806,"end":1929,"loc":{"start":{"line":42,"column":15},"end":{"line":44,"column":35}}, "test": { "type": "BinaryExpression", - "start": 1806, - "end": 1820, - "loc": { - "start": { - "line": 42, - "column": 15 - }, - "end": { - "line": 42, - "column": 29 - } - }, + "start":1806,"end":1820,"loc":{"start":{"line":42,"column":15},"end":{"line":42,"column":29}}, "left": { "type": "Identifier", - "start": 1806, - "end": 1810, - "loc": { - "start": { - "line": 42, - "column": 15 - }, - "end": { - "line": 42, - "column": 19 - }, - "identifierName": "what" - }, + "start":1806,"end":1810,"loc":{"start":{"line":42,"column":15},"end":{"line":42,"column":19},"identifierName":"what"}, "name": "what" }, "operator": "==", "right": { "type": "StringLiteral", - "start": 1814, - "end": 1820, - "loc": { - "start": { - "line": 42, - "column": 23 - }, - "end": { - "line": 42, - "column": 29 - } - }, + "start":1814,"end":1820,"loc":{"start":{"line":42,"column":23},"end":{"line":42,"column":29}}, "extra": { "rawValue": "cone", "raw": "\"cone\"" @@ -5551,153 +1865,51 @@ }, "consequent": { "type": "ArrowFunctionExpression", - "start": 1825, - "end": 1893, - "loc": { - "start": { - "line": 43, - "column": 4 - }, - "end": { - "line": 43, - "column": 72 - } - }, + "start":1825,"end":1893,"loc":{"start":{"line":43,"column":4},"end":{"line":43,"column":72}}, "id": null, "generator": false, "async": false, "params": [ { "type": "Identifier", - "start": 1825, - "end": 1826, - "loc": { - "start": { - "line": 43, - "column": 4 - }, - "end": { - "line": 43, - "column": 5 - }, - "identifierName": "p" - }, + "start":1825,"end":1826,"loc":{"start":{"line":43,"column":4},"end":{"line":43,"column":5},"identifierName":"p"}, "name": "p" } ], "body": { "type": "ConditionalExpression", - "start": 1831, - "end": 1892, - "loc": { - "start": { - "line": 43, - "column": 10 - }, - "end": { - "line": 43, - "column": 71 - } - }, + "start":1831,"end":1892,"loc":{"start":{"line":43,"column":10},"end":{"line":43,"column":71}}, "test": { "type": "UnaryExpression", - "start": 1831, - "end": 1834, - "loc": { - "start": { - "line": 43, - "column": 10 - }, - "end": { - "line": 43, - "column": 13 - } - }, + "start":1831,"end":1834,"loc":{"start":{"line":43,"column":10},"end":{"line":43,"column":13}}, "operator": "!", "prefix": true, "argument": { "type": "UnaryExpression", - "start": 1832, - "end": 1834, - "loc": { - "start": { - "line": 43, - "column": 11 - }, - "end": { - "line": 43, - "column": 13 - } - }, + "start":1832,"end":1834,"loc":{"start":{"line":43,"column":11},"end":{"line":43,"column":13}}, "operator": "!", "prefix": true, "argument": { "type": "Identifier", - "start": 1833, - "end": 1834, - "loc": { - "start": { - "line": 43, - "column": 12 - }, - "end": { - "line": 43, - "column": 13 - }, - "identifierName": "p" - }, + "start":1833,"end":1834,"loc":{"start":{"line":43,"column":12},"end":{"line":43,"column":13},"identifierName":"p"}, "name": "p" } } }, "consequent": { "type": "TemplateLiteral", - "start": 1837, - "end": 1860, - "loc": { - "start": { - "line": 43, - "column": 16 - }, - "end": { - "line": 43, - "column": 39 - } - }, + "start":1837,"end":1860,"loc":{"start":{"line":43,"column":16},"end":{"line":43,"column":39}}, "expressions": [ { "type": "Identifier", - "start": 1852, - "end": 1853, - "loc": { - "start": { - "line": 43, - "column": 31 - }, - "end": { - "line": 43, - "column": 32 - }, - "identifierName": "p" - }, + "start":1852,"end":1853,"loc":{"start":{"line":43,"column":31},"end":{"line":43,"column":32},"identifierName":"p"}, "name": "p" } ], "quasis": [ { "type": "TemplateElement", - "start": 1838, - "end": 1850, - "loc": { - "start": { - "line": 43, - "column": 17 - }, - "end": { - "line": 43, - "column": 29 - } - }, + "start":1838,"end":1850,"loc":{"start":{"line":43,"column":17},"end":{"line":43,"column":29}}, "value": { "raw": "here's your ", "cooked": "here's your " @@ -5706,18 +1918,7 @@ }, { "type": "TemplateElement", - "start": 1854, - "end": 1859, - "loc": { - "start": { - "line": 43, - "column": 33 - }, - "end": { - "line": 43, - "column": 38 - } - }, + "start":1854,"end":1859,"loc":{"start":{"line":43,"column":33},"end":{"line":43,"column":38}}, "value": { "raw": " cone", "cooked": " cone" @@ -5728,34 +1929,12 @@ }, "alternate": { "type": "TemplateLiteral", - "start": 1863, - "end": 1892, - "loc": { - "start": { - "line": 43, - "column": 42 - }, - "end": { - "line": 43, - "column": 71 - } - }, + "start":1863,"end":1892,"loc":{"start":{"line":43,"column":42},"end":{"line":43,"column":71}}, "expressions": [], "quasis": [ { "type": "TemplateElement", - "start": 1864, - "end": 1891, - "loc": { - "start": { - "line": 43, - "column": 43 - }, - "end": { - "line": 43, - "column": 70 - } - }, + "start":1864,"end":1891,"loc":{"start":{"line":43,"column":43},"end":{"line":43,"column":70}}, "value": { "raw": "just the empty cone for you", "cooked": "just the empty cone for you" @@ -5772,105 +1951,36 @@ }, "alternate": { "type": "ArrowFunctionExpression", - "start": 1898, - "end": 1929, - "loc": { - "start": { - "line": 44, - "column": 4 - }, - "end": { - "line": 44, - "column": 35 - } - }, + "start":1898,"end":1929,"loc":{"start":{"line":44,"column":4},"end":{"line":44,"column":35}}, "id": null, "generator": false, "async": false, "params": [ { "type": "Identifier", - "start": 1898, - "end": 1899, - "loc": { - "start": { - "line": 44, - "column": 4 - }, - "end": { - "line": 44, - "column": 5 - }, - "identifierName": "p" - }, + "start":1898,"end":1899,"loc":{"start":{"line":44,"column":4},"end":{"line":44,"column":5},"identifierName":"p"}, "name": "p" } ], "body": { "type": "TemplateLiteral", - "start": 1903, - "end": 1929, - "loc": { - "start": { - "line": 44, - "column": 9 - }, - "end": { - "line": 44, - "column": 35 - } - }, + "start":1903,"end":1929,"loc":{"start":{"line":44,"column":9},"end":{"line":44,"column":35}}, "expressions": [ { "type": "Identifier", - "start": 1918, - "end": 1919, - "loc": { - "start": { - "line": 44, - "column": 24 - }, - "end": { - "line": 44, - "column": 25 - }, - "identifierName": "p" - }, + "start":1918,"end":1919,"loc":{"start":{"line":44,"column":24},"end":{"line":44,"column":25},"identifierName":"p"}, "name": "p" }, { "type": "Identifier", - "start": 1923, - "end": 1927, - "loc": { - "start": { - "line": 44, - "column": 29 - }, - "end": { - "line": 44, - "column": 33 - }, - "identifierName": "what" - }, + "start":1923,"end":1927,"loc":{"start":{"line":44,"column":29},"end":{"line":44,"column":33},"identifierName":"what"}, "name": "what" } ], "quasis": [ { "type": "TemplateElement", - "start": 1904, - "end": 1916, - "loc": { - "start": { - "line": 44, - "column": 10 - }, - "end": { - "line": 44, - "column": 22 - } - }, + "start":1904,"end":1916,"loc":{"start":{"line":44,"column":10},"end":{"line":44,"column":22}}, "value": { "raw": "here's your ", "cooked": "here's your " @@ -5879,18 +1989,7 @@ }, { "type": "TemplateElement", - "start": 1920, - "end": 1921, - "loc": { - "start": { - "line": 44, - "column": 26 - }, - "end": { - "line": 44, - "column": 27 - } - }, + "start":1920,"end":1921,"loc":{"start":{"line":44,"column":26},"end":{"line":44,"column":27}}, "value": { "raw": " ", "cooked": " " @@ -5899,18 +1998,7 @@ }, { "type": "TemplateElement", - "start": 1928, - "end": 1928, - "loc": { - "start": { - "line": 44, - "column": 34 - }, - "end": { - "line": 44, - "column": 34 - } - }, + "start":1928,"end":1928,"loc":{"start":{"line":44,"column":34},"end":{"line":44,"column":34}}, "value": { "raw": "", "cooked": "" @@ -5928,34 +2016,12 @@ { "type": "CommentLine", "value": " a ? (async (b) => c => d) : (e => f)", - "start": 1698, - "end": 1737, - "loc": { - "start": { - "line": 39, - "column": 36 - }, - "end": { - "line": 39, - "column": 75 - } - } + "start":1698,"end":1737,"loc":{"start":{"line":39,"column":36},"end":{"line":39,"column":75}} }, { "type": "CommentLine", "value": " https://github.com/prettier/prettier/issues/2194", - "start": 1739, - "end": 1790, - "loc": { - "start": { - "line": 41, - "column": 0 - }, - "end": { - "line": 41, - "column": 51 - } - } + "start":1739,"end":1790,"loc":{"start":{"line":41,"column":0},"end":{"line":41,"column":51}} } ] } @@ -5966,498 +2032,157 @@ { "type": "CommentLine", "value": " Valid lhs value inside parentheses", - "start": 0, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 37 - } - } + "start":0,"end":37,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":37}} }, { "type": "CommentLine", "value": " a ? b : (c => d)", - "start": 56, - "end": 75, - "loc": { - "start": { - "line": 2, - "column": 18 - }, - "end": { - "line": 2, - "column": 37 - } - } + "start":56,"end":75,"loc":{"start":{"line":2,"column":18},"end":{"line":2,"column":37}} }, { "type": "CommentLine", "value": " a ? ((b): c => d) : e", - "start": 98, - "end": 122, - "loc": { - "start": { - "line": 3, - "column": 22 - }, - "end": { - "line": 3, - "column": 46 - } - } + "start":98,"end":122,"loc":{"start":{"line":3,"column":22},"end":{"line":3,"column":46}} }, { "type": "CommentLine", "value": " a ? b : ((c): d => e)", - "start": 147, - "end": 171, - "loc": { - "start": { - "line": 4, - "column": 24 - }, - "end": { - "line": 4, - "column": 48 - } - } + "start":147,"end":171,"loc":{"start":{"line":4,"column":24},"end":{"line":4,"column":48}} }, { "type": "CommentLine", "value": " Nested arrow function inside parentheses", - "start": 173, - "end": 216, - "loc": { - "start": { - "line": 6, - "column": 0 - }, - "end": { - "line": 6, - "column": 43 - } - } + "start":173,"end":216,"loc":{"start":{"line":6,"column":0},"end":{"line":6,"column":43}} }, { "type": "CommentLine", "value": " a ? (b = (c) => d) : (e => f)", - "start": 246, - "end": 278, - "loc": { - "start": { - "line": 7, - "column": 29 - }, - "end": { - "line": 7, - "column": 61 - } - } + "start":246,"end":278,"loc":{"start":{"line":7,"column":29},"end":{"line":7,"column":61}} }, { "type": "CommentLine", "value": " a ? ((b = (c) => d): e => f) : g", - "start": 312, - "end": 347, - "loc": { - "start": { - "line": 8, - "column": 33 - }, - "end": { - "line": 8, - "column": 68 - } - } + "start":312,"end":347,"loc":{"start":{"line":8,"column":33},"end":{"line":8,"column":68}} }, { "type": "CommentLine", "value": " Nested conditional expressions", - "start": 349, - "end": 382, - "loc": { - "start": { - "line": 10, - "column": 0 - }, - "end": { - "line": 10, - "column": 33 - } - } + "start":349,"end":382,"loc":{"start":{"line":10,"column":0},"end":{"line":10,"column":33}} }, { "type": "CommentLine", "value": " b ? (c ? ((d): e => f) : g) : h", - "start": 419, - "end": 453, - "loc": { - "start": { - "line": 11, - "column": 36 - }, - "end": { - "line": 11, - "column": 70 - } - } + "start":419,"end":453,"loc":{"start":{"line":11,"column":36},"end":{"line":11,"column":70}} }, { "type": "CommentLine", "value": " a ? (b ? (c ? d : (e => f)) : g) : h", - "start": 490, - "end": 529, - "loc": { - "start": { - "line": 12, - "column": 36 - }, - "end": { - "line": 12, - "column": 75 - } - } + "start":490,"end":529,"loc":{"start":{"line":12,"column":36},"end":{"line":12,"column":75}} }, { "type": "CommentLine", "value": " a ? (b ? c : ((d): e => f)) : g", - "start": 565, - "end": 599, - "loc": { - "start": { - "line": 14, - "column": 34 - }, - "end": { - "line": 14, - "column": 68 - } - } + "start":565,"end":599,"loc":{"start":{"line":14,"column":34},"end":{"line":14,"column":68}} }, { "type": "CommentLine", "value": " Multiple arrow functions", - "start": 601, - "end": 628, - "loc": { - "start": { - "line": 16, - "column": 0 - }, - "end": { - "line": 16, - "column": 27 - } - } + "start":601,"end":628,"loc":{"start":{"line":16,"column":0},"end":{"line":16,"column":27}} }, { "type": "CommentLine", "value": " a ? ((b): c => d) : ((e): f => g)", - "start": 662, - "end": 698, - "loc": { - "start": { - "line": 17, - "column": 33 - }, - "end": { - "line": 17, - "column": 69 - } - } + "start":662,"end":698,"loc":{"start":{"line":17,"column":33},"end":{"line":17,"column":69}} }, { "type": "CommentLine", "value": " Multiple nested arrow functions ( is needed to avoid ambiguities)", - "start": 700, - "end": 771, - "loc": { - "start": { - "line": 19, - "column": 0 - }, - "end": { - "line": 19, - "column": 71 - } - } + "start":700,"end":771,"loc":{"start":{"line":19,"column":0},"end":{"line":19,"column":71}} }, { "type": "CommentLine", "value": " a ? ((b): c => ((d): e => f)) : g", - "start": 805, - "end": 841, - "loc": { - "start": { - "line": 20, - "column": 33 - }, - "end": { - "line": 20, - "column": 69 - } - } + "start":805,"end":841,"loc":{"start":{"line":20,"column":33},"end":{"line":20,"column":69}} }, { "type": "CommentLine", "value": " a ? b : (c => ((d): e => f))", - "start": 874, - "end": 908, - "loc": { - "start": { - "line": 21, - "column": 32 - }, - "end": { - "line": 21, - "column": 66 - } - } + "start":874,"end":908,"loc":{"start":{"line":21,"column":32},"end":{"line":21,"column":66}} }, { "type": "CommentLine", "value": " a ? ((b): c => d) : (e => f)", - "start": 941, - "end": 975, - "loc": { - "start": { - "line": 22, - "column": 32 - }, - "end": { - "line": 22, - "column": 66 - } - } + "start":941,"end":975,"loc":{"start":{"line":22,"column":32},"end":{"line":22,"column":66}} }, { "type": "CommentLine", "value": " Invalid lhs value inside parentheses", - "start": 977, - "end": 1016, - "loc": { - "start": { - "line": 24, - "column": 0 - }, - "end": { - "line": 24, - "column": 39 - } - } + "start":977,"end":1016,"loc":{"start":{"line":24,"column":0},"end":{"line":24,"column":39}} }, { "type": "CommentLine", "value": " a ? (b => c) : (d => e)", - "start": 1040, - "end": 1066, - "loc": { - "start": { - "line": 25, - "column": 23 - }, - "end": { - "line": 25, - "column": 49 - } - } + "start":1040,"end":1066,"loc":{"start":{"line":25,"column":23},"end":{"line":25,"column":49}} }, { "type": "CommentLine", "value": " a ? (b ? (c => d) : (e => f)) : g", - "start": 1098, - "end": 1134, - "loc": { - "start": { - "line": 26, - "column": 31 - }, - "end": { - "line": 26, - "column": 67 - } - } + "start":1098,"end":1134,"loc":{"start":{"line":26,"column":31},"end":{"line":26,"column":67}} }, { "type": "CommentLine", "value": " Invalid lhs value inside parentheses inside arrow function", - "start": 1136, - "end": 1197, - "loc": { - "start": { - "line": 28, - "column": 0 - }, - "end": { - "line": 28, - "column": 61 - } - } + "start":1136,"end":1197,"loc":{"start":{"line":28,"column":0},"end":{"line":28,"column":61}} }, { "type": "CommentLine", "value": " a ? ((b): c => (d => e)) : (f => g)", - "start": 1232, - "end": 1270, - "loc": { - "start": { - "line": 29, - "column": 34 - }, - "end": { - "line": 29, - "column": 72 - } - } + "start":1232,"end":1270,"loc":{"start":{"line":29,"column":34},"end":{"line":29,"column":72}} }, { "type": "CommentLine", "value": " a ? (b ? (c => d) : (e => (f => g))) : (h => i)", - "start": 1314, - "end": 1364, - "loc": { - "start": { - "line": 30, - "column": 43 - }, - "end": { - "line": 30, - "column": 93 - } - } + "start":1314,"end":1364,"loc":{"start":{"line":30,"column":43},"end":{"line":30,"column":93}} }, { "type": "CommentLine", "value": " Function as type annotation", - "start": 1366, - "end": 1396, - "loc": { - "start": { - "line": 32, - "column": 0 - }, - "end": { - "line": 32, - "column": 30 - } - } + "start":1366,"end":1396,"loc":{"start":{"line":32,"column":0},"end":{"line":32,"column":30}} }, { "type": "CommentLine", "value": " a ? ((b): (c => d) => e) : f", - "start": 1426, - "end": 1457, - "loc": { - "start": { - "line": 33, - "column": 29 - }, - "end": { - "line": 33, - "column": 60 - } - } + "start":1426,"end":1457,"loc":{"start":{"line":33,"column":29},"end":{"line":33,"column":60}} }, { "type": "CommentLine", "value": " Async functions or calls", - "start": 1459, - "end": 1486, - "loc": { - "start": { - "line": 35, - "column": 0 - }, - "end": { - "line": 35, - "column": 27 - } - } + "start":1459,"end":1486,"loc":{"start":{"line":35,"column":0},"end":{"line":35,"column":27}} }, { "type": "CommentLine", "value": " a ? (async(b)) : (c => d)", - "start": 1511, - "end": 1539, - "loc": { - "start": { - "line": 36, - "column": 24 - }, - "end": { - "line": 36, - "column": 52 - } - } + "start":1511,"end":1539,"loc":{"start":{"line":36,"column":24},"end":{"line":36,"column":52}} }, { "type": "CommentLine", "value": " a ? (async (b): c => d) : e", - "start": 1568, - "end": 1598, - "loc": { - "start": { - "line": 37, - "column": 28 - }, - "end": { - "line": 37, - "column": 58 - } - } + "start":1568,"end":1598,"loc":{"start":{"line":37,"column":28},"end":{"line":37,"column":58}} }, { "type": "CommentLine", "value": " a ? (async(b => c)) : (d => e)", - "start": 1628, - "end": 1661, - "loc": { - "start": { - "line": 38, - "column": 29 - }, - "end": { - "line": 38, - "column": 62 - } - } + "start":1628,"end":1661,"loc":{"start":{"line":38,"column":29},"end":{"line":38,"column":62}} }, { "type": "CommentLine", "value": " a ? (async (b) => c => d) : (e => f)", - "start": 1698, - "end": 1737, - "loc": { - "start": { - "line": 39, - "column": 36 - }, - "end": { - "line": 39, - "column": 75 - } - } + "start":1698,"end":1737,"loc":{"start":{"line":39,"column":36},"end":{"line":39,"column":75}} }, { "type": "CommentLine", "value": " https://github.com/prettier/prettier/issues/2194", - "start": 1739, - "end": 1790, - "loc": { - "start": { - "line": 41, - "column": 0 - }, - "end": { - "line": 41, - "column": 51 - } - } + "start":1739,"end":1790,"loc":{"start":{"line":41,"column":0},"end":{"line":41,"column":51}} } ] } \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/regression/issue-593/output.json b/packages/babel-parser/test/fixtures/flow/regression/issue-593/output.json index db7856dd3f1e..e7bc4792483d 100644 --- a/packages/babel-parser/test/fixtures/flow/regression/issue-593/output.json +++ b/packages/babel-parser/test/fixtures/flow/regression/issue-593/output.json @@ -1,139 +1,38 @@ { "type": "File", - "start": 0, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, "program": { "type": "Program", - "start": 0, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, "declarations": [ { "type": "VariableDeclarator", - "start": 6, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":6,"end":27,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":27}}, "id": { "type": "Identifier", - "start": 6, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 10 - }, - "identifierName": "fail" - }, + "start":6,"end":10,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":10},"identifierName":"fail"}, "name": "fail" }, "init": { "type": "ArrowFunctionExpression", - "start": 13, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":13,"end":27,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":27}}, "predicate": null, "returnType": { "type": "TypeAnnotation", - "start": 15, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":15,"end":18,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":18}}, "typeAnnotation": { "type": "GenericTypeAnnotation", - "start": 17, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":17,"end":18,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":18}}, "typeParameters": null, "id": { "type": "Identifier", - "start": 17, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - }, - "identifierName": "X" - }, + "start":17,"end":18,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":18},"identifierName":"X"}, "name": "X" } } @@ -144,49 +43,16 @@ "params": [], "body": { "type": "JSXElement", - "start": 22, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":22,"end":27,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":27}}, "openingElement": { "type": "JSXOpeningElement", - "start": 22, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 27 - } - }, - "attributes": [], + "start":22,"end":27,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":27}}, "name": { "type": "JSXIdentifier", - "start": 23, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":23,"end":24,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":24}}, "name": "x" }, + "attributes": [], "selfClosing": true }, "closingElement": null, diff --git a/packages/babel-parser/test/fixtures/flow/regression/issue-92/output.json b/packages/babel-parser/test/fixtures/flow/regression/issue-92/output.json index 6088c826820d..8eb08301879a 100644 --- a/packages/babel-parser/test/fixtures/flow/regression/issue-92/output.json +++ b/packages/babel-parser/test/fixtures/flow/regression/issue-92/output.json @@ -1,173 +1,50 @@ { "type": "File", - "start": 0, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 40 - } - }, + "start":0,"end":40,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":40}}, "program": { "type": "Program", - "start": 0, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 40 - } - }, + "start":0,"end":40,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":40}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 40 - } - }, + "start":0,"end":40,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":40}}, "declarations": [ { "type": "VariableDeclarator", - "start": 6, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 40 - } - }, + "start":6,"end":40,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":40}}, "id": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "a" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"a"}, "name": "a" }, "init": { "type": "ArrowFunctionExpression", - "start": 10, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 40 - } - }, + "start":10,"end":40,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":40}}, "id": null, "generator": false, "async": true, "params": [ { "type": "AssignmentPattern", - "start": 17, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":17,"end":33,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":33}}, "left": { "type": "Identifier", - "start": 17, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 28 - }, - "identifierName": "foo" - }, + "start":17,"end":28,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":28},"identifierName":"foo"}, "name": "foo", "typeAnnotation": { "type": "TypeAnnotation", - "start": 20, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":20,"end":28,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":28}}, "typeAnnotation": { "type": "StringTypeAnnotation", - "start": 22, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 28 - } - } + "start":22,"end":28,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":28}} } } }, "right": { "type": "StringLiteral", - "start": 31, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 31 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":31,"end":33,"loc":{"start":{"line":1,"column":31},"end":{"line":1,"column":33}}, "extra": { "rawValue": "", "raw": "\"\"" @@ -178,18 +55,7 @@ ], "body": { "type": "BlockStatement", - "start": 38, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 38 - }, - "end": { - "line": 1, - "column": 40 - } - }, + "start":38,"end":40,"loc":{"start":{"line":1,"column":38},"end":{"line":1,"column":40}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-const-declare-class/options.json b/packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-const-declare-class/options.json deleted file mode 100644 index 4a1b4e5c5cd4..000000000000 --- a/packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-const-declare-class/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'A' has already been declared (2:14)" -} diff --git a/packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-const-declare-interface/options.json b/packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-const-declare-interface/options.json deleted file mode 100644 index 187fea591b95..000000000000 --- a/packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-const-declare-interface/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'A' has already been declared (2:18)" -} diff --git a/packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-const-interface/options.json b/packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-const-interface/options.json deleted file mode 100644 index 04242bd1565b..000000000000 --- a/packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-const-interface/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'A' has already been declared (2:10)" -} diff --git a/packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-declare-class-declare-interface/options.json b/packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-declare-class-declare-interface/options.json deleted file mode 100644 index 187fea591b95..000000000000 --- a/packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-declare-class-declare-interface/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'A' has already been declared (2:18)" -} diff --git a/packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-declare-func-declare-func/output.json b/packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-declare-func-declare-func/output.json deleted file mode 100644 index c4c86f1991cd..000000000000 --- a/packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-declare-func-declare-func/output.json +++ /dev/null @@ -1,197 +0,0 @@ -{ - "type": "File", - "start": 0, - "end": 55, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 27 - } - }, - "program": { - "type": "Program", - "start": 0, - "end": 55, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 27 - } - }, - "sourceType": "module", - "interpreter": null, - "body": [ - { - "type": "DeclareFunction", - "start": 0, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 27 - } - }, - "id": { - "type": "Identifier", - "start": 17, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 26 - }, - "identifierName": "A" - }, - "name": "A", - "typeAnnotation": { - "type": "TypeAnnotation", - "start": 18, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 26 - } - }, - "typeAnnotation": { - "type": "FunctionTypeAnnotation", - "start": 18, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 26 - } - }, - "typeParameters": null, - "params": [], - "rest": null, - "returnType": { - "type": "VoidTypeAnnotation", - "start": 22, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 26 - } - } - } - } - } - }, - "predicate": null - }, - { - "type": "DeclareFunction", - "start": 28, - "end": 55, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 27 - } - }, - "id": { - "type": "Identifier", - "start": 45, - "end": 54, - "loc": { - "start": { - "line": 2, - "column": 17 - }, - "end": { - "line": 2, - "column": 26 - }, - "identifierName": "A" - }, - "name": "A", - "typeAnnotation": { - "type": "TypeAnnotation", - "start": 46, - "end": 54, - "loc": { - "start": { - "line": 2, - "column": 18 - }, - "end": { - "line": 2, - "column": 26 - } - }, - "typeAnnotation": { - "type": "FunctionTypeAnnotation", - "start": 46, - "end": 54, - "loc": { - "start": { - "line": 2, - "column": 18 - }, - "end": { - "line": 2, - "column": 26 - } - }, - "typeParameters": null, - "params": [], - "rest": null, - "returnType": { - "type": "VoidTypeAnnotation", - "start": 50, - "end": 54, - "loc": { - "start": { - "line": 2, - "column": 22 - }, - "end": { - "line": 2, - "column": 26 - } - } - } - } - } - }, - "predicate": null - } - ], - "directives": [] - } -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-declare-func-declare-var/options.json b/packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-declare-func-declare-var/options.json deleted file mode 100644 index 81dc2c90799f..000000000000 --- a/packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-declare-func-declare-var/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'A' has already been declared (2:12)" -} diff --git a/packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-declare-func-func/options.json b/packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-declare-func-func/options.json deleted file mode 100644 index 5f6027f8dd3b..000000000000 --- a/packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-declare-func-func/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'A' has already been declared (2:9)" -} diff --git a/packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-declare-func-let/options.json b/packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-declare-func-let/options.json deleted file mode 100644 index b6ff3a4b0987..000000000000 --- a/packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-declare-func-let/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'A' has already been declared (2:4)" -} diff --git a/packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-declare-interface-declare-class/options.json b/packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-declare-interface-declare-class/options.json deleted file mode 100644 index 4a1b4e5c5cd4..000000000000 --- a/packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-declare-interface-declare-class/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'A' has already been declared (2:14)" -} diff --git a/packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-declare-var-declare-var/output.json b/packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-declare-var-declare-var/output.json deleted file mode 100644 index 532ca8848c0b..000000000000 --- a/packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-declare-var-declare-var/output.json +++ /dev/null @@ -1,159 +0,0 @@ -{ - "type": "File", - "start": 0, - "end": 45, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 22 - } - }, - "program": { - "type": "Program", - "start": 0, - "end": 45, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 22 - } - }, - "sourceType": "module", - "interpreter": null, - "body": [ - { - "type": "DeclareVariable", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, - "id": { - "type": "Identifier", - "start": 12, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 21 - }, - "identifierName": "A" - }, - "name": "A", - "typeAnnotation": { - "type": "TypeAnnotation", - "start": 13, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 21 - } - }, - "typeAnnotation": { - "type": "NumberTypeAnnotation", - "start": 15, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 21 - } - } - } - } - } - }, - { - "type": "DeclareVariable", - "start": 23, - "end": 45, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 22 - } - }, - "id": { - "type": "Identifier", - "start": 35, - "end": 44, - "loc": { - "start": { - "line": 2, - "column": 12 - }, - "end": { - "line": 2, - "column": 21 - }, - "identifierName": "A" - }, - "name": "A", - "typeAnnotation": { - "type": "TypeAnnotation", - "start": 36, - "end": 44, - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 21 - } - }, - "typeAnnotation": { - "type": "NumberTypeAnnotation", - "start": 38, - "end": 44, - "loc": { - "start": { - "line": 2, - "column": 15 - }, - "end": { - "line": 2, - "column": 21 - } - } - } - } - } - } - ], - "directives": [] - } -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-declare-var-let/options.json b/packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-declare-var-let/options.json deleted file mode 100644 index b6ff3a4b0987..000000000000 --- a/packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-declare-var-let/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'A' has already been declared (2:4)" -} diff --git a/packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-interface-interface/options.json b/packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-interface-interface/options.json deleted file mode 100644 index 04242bd1565b..000000000000 --- a/packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-interface-interface/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'A' has already been declared (2:10)" -} diff --git a/packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-let-declare-class/options.json b/packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-let-declare-class/options.json deleted file mode 100644 index 4a1b4e5c5cd4..000000000000 --- a/packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-let-declare-class/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'A' has already been declared (2:14)" -} diff --git a/packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-let-declare-interface/options.json b/packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-let-declare-interface/options.json deleted file mode 100644 index 187fea591b95..000000000000 --- a/packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-let-declare-interface/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'A' has already been declared (2:18)" -} diff --git a/packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-let-interface/options.json b/packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-let-interface/options.json deleted file mode 100644 index 04242bd1565b..000000000000 --- a/packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-let-interface/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'A' has already been declared (2:10)" -} diff --git a/packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-type-interface/options.json b/packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-type-interface/options.json deleted file mode 100644 index 04242bd1565b..000000000000 --- a/packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-type-interface/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'A' has already been declared (2:10)" -} diff --git a/packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-var-declare-class/options.json b/packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-var-declare-class/options.json deleted file mode 100644 index 4a1b4e5c5cd4..000000000000 --- a/packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-var-declare-class/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'A' has already been declared (2:14)" -} diff --git a/packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-var-declare-interface/options.json b/packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-var-declare-interface/options.json deleted file mode 100644 index 187fea591b95..000000000000 --- a/packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-var-declare-interface/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'A' has already been declared (2:18)" -} diff --git a/packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-var-interface/options.json b/packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-var-interface/options.json deleted file mode 100644 index 04242bd1565b..000000000000 --- a/packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-var-interface/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'A' has already been declared (2:10)" -} diff --git a/packages/babel-parser/test/fixtures/flow/scope/abcdef/output.json b/packages/babel-parser/test/fixtures/flow/scope/abcdef/output.json index e743dd0477a6..a30af7f2bbfe 100644 --- a/packages/babel-parser/test/fixtures/flow/scope/abcdef/output.json +++ b/packages/babel-parser/test/fixtures/flow/scope/abcdef/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 73, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 1 - } - }, + "start":0,"end":73,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 73, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 1 - } - }, + "start":0,"end":73,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 73, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 1 - } - }, + "start":0,"end":73,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, "id": { "type": "Identifier", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - }, - "identifierName": "f" - }, + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"f"}, "name": "f" }, "generator": false, @@ -65,163 +20,51 @@ "params": [], "body": { "type": "BlockStatement", - "start": 13, - "end": 73, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 5, - "column": 1 - } - }, + "start":13,"end":73,"loc":{"start":{"line":1,"column":13},"end":{"line":5,"column":1}}, "body": [ { "type": "VariableDeclaration", - "start": 17, - "end": 50, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 35 - } - }, + "start":17,"end":50,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":35}}, "declarations": [ { "type": "VariableDeclarator", - "start": 23, - "end": 49, - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 34 - } - }, + "start":23,"end":49,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":34}}, "id": { "type": "Identifier", - "start": 23, - "end": 24, - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 9 - }, - "identifierName": "g" - }, + "start":23,"end":24,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":9},"identifierName":"g"}, "name": "g" }, "init": { "type": "ConditionalExpression", - "start": 27, - "end": 49, - "loc": { - "start": { - "line": 2, - "column": 12 - }, - "end": { - "line": 2, - "column": 34 - } - }, + "start":27,"end":49,"loc":{"start":{"line":2,"column":12},"end":{"line":2,"column":34}}, "test": { "type": "BooleanLiteral", - "start": 27, - "end": 31, - "loc": { - "start": { - "line": 2, - "column": 12 - }, - "end": { - "line": 2, - "column": 16 - } - }, + "start":27,"end":31,"loc":{"start":{"line":2,"column":12},"end":{"line":2,"column":16}}, "value": true }, "consequent": { "type": "ArrowFunctionExpression", - "start": 34, - "end": 43, - "loc": { - "start": { - "line": 2, - "column": 19 - }, - "end": { - "line": 2, - "column": 28 - } - }, + "start":34,"end":43,"loc":{"start":{"line":2,"column":19},"end":{"line":2,"column":28}}, "id": null, "generator": false, "async": false, "params": [ { "type": "Identifier", - "start": 34, - "end": 37, - "loc": { - "start": { - "line": 2, - "column": 19 - }, - "end": { - "line": 2, - "column": 22 - }, - "identifierName": "foo" - }, + "start":34,"end":37,"loc":{"start":{"line":2,"column":19},"end":{"line":2,"column":22},"identifierName":"foo"}, "name": "foo" } ], "body": { "type": "BlockStatement", - "start": 41, - "end": 43, - "loc": { - "start": { - "line": 2, - "column": 26 - }, - "end": { - "line": 2, - "column": 28 - } - }, + "start":41,"end":43,"loc":{"start":{"line":2,"column":26},"end":{"line":2,"column":28}}, "body": [], "directives": [] } }, "alternate": { "type": "NullLiteral", - "start": 45, - "end": 49, - "loc": { - "start": { - "line": 2, - "column": 30 - }, - "end": { - "line": 2, - "column": 34 - } - } + "start":45,"end":49,"loc":{"start":{"line":2,"column":30},"end":{"line":2,"column":34}} } } } @@ -230,64 +73,19 @@ }, { "type": "VariableDeclaration", - "start": 54, - "end": 71, - "loc": { - "start": { - "line": 4, - "column": 2 - }, - "end": { - "line": 4, - "column": 19 - } - }, + "start":54,"end":71,"loc":{"start":{"line":4,"column":2},"end":{"line":4,"column":19}}, "declarations": [ { "type": "VariableDeclarator", - "start": 60, - "end": 71, - "loc": { - "start": { - "line": 4, - "column": 8 - }, - "end": { - "line": 4, - "column": 19 - } - }, + "start":60,"end":71,"loc":{"start":{"line":4,"column":8},"end":{"line":4,"column":19}}, "id": { "type": "Identifier", - "start": 60, - "end": 63, - "loc": { - "start": { - "line": 4, - "column": 8 - }, - "end": { - "line": 4, - "column": 11 - }, - "identifierName": "foo" - }, + "start":60,"end":63,"loc":{"start":{"line":4,"column":8},"end":{"line":4,"column":11},"identifierName":"foo"}, "name": "foo" }, "init": { "type": "StringLiteral", - "start": 66, - "end": 71, - "loc": { - "start": { - "line": 4, - "column": 14 - }, - "end": { - "line": 4, - "column": 19 - } - }, + "start":66,"end":71,"loc":{"start":{"line":4,"column":14},"end":{"line":4,"column":19}}, "extra": { "rawValue": "foo", "raw": "'foo'" diff --git a/packages/babel-parser/test/fixtures/flow/scope/declare-module/output.json b/packages/babel-parser/test/fixtures/flow/scope/declare-module/output.json index 672f98d0ad8c..3315087c3d4e 100644 --- a/packages/babel-parser/test/fixtures/flow/scope/declare-module/output.json +++ b/packages/babel-parser/test/fixtures/flow/scope/declare-module/output.json @@ -1,109 +1,30 @@ { "type": "File", - "start": 0, - "end": 53, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 10 - } - }, + "start":0,"end":53,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":10}}, "program": { "type": "Program", - "start": 0, - "end": 53, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 10 - } - }, + "start":0,"end":53,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":10}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "DeclareModule", - "start": 0, - "end": 41, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":41,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "id": { "type": "Identifier", - "start": 15, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - }, - "identifierName": "A" - }, + "start":15,"end":16,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":16},"identifierName":"A"}, "name": "A" }, "body": { "type": "BlockStatement", - "start": 17, - "end": 41, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":17,"end":41,"loc":{"start":{"line":1,"column":17},"end":{"line":3,"column":1}}, "body": [ { "type": "DeclareClass", - "start": 21, - "end": 39, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 20 - } - }, + "start":21,"end":39,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":20}}, "id": { "type": "Identifier", - "start": 35, - "end": 36, - "loc": { - "start": { - "line": 2, - "column": 16 - }, - "end": { - "line": 2, - "column": 17 - }, - "identifierName": "X" - }, + "start":35,"end":36,"loc":{"start":{"line":2,"column":16},"end":{"line":2,"column":17},"identifierName":"X"}, "name": "X" }, "typeParameters": null, @@ -112,18 +33,7 @@ "mixins": [], "body": { "type": "ObjectTypeAnnotation", - "start": 37, - "end": 39, - "loc": { - "start": { - "line": 2, - "column": 18 - }, - "end": { - "line": 2, - "column": 20 - } - }, + "start":37,"end":39,"loc":{"start":{"line":2,"column":18},"end":{"line":2,"column":20}}, "callProperties": [], "properties": [], "indexers": [], @@ -137,50 +47,16 @@ }, { "type": "ClassDeclaration", - "start": 43, - "end": 53, - "loc": { - "start": { - "line": 5, - "column": 0 - }, - "end": { - "line": 5, - "column": 10 - } - }, + "start":43,"end":53,"loc":{"start":{"line":5,"column":0},"end":{"line":5,"column":10}}, "id": { "type": "Identifier", - "start": 49, - "end": 50, - "loc": { - "start": { - "line": 5, - "column": 6 - }, - "end": { - "line": 5, - "column": 7 - }, - "identifierName": "X" - }, + "start":49,"end":50,"loc":{"start":{"line":5,"column":6},"end":{"line":5,"column":7},"identifierName":"X"}, "name": "X" }, "superClass": null, "body": { "type": "ClassBody", - "start": 51, - "end": 53, - "loc": { - "start": { - "line": 5, - "column": 8 - }, - "end": { - "line": 5, - "column": 10 - } - }, + "start":51,"end":53,"loc":{"start":{"line":5,"column":8},"end":{"line":5,"column":10}}, "body": [] } } diff --git a/packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-const-declare-class/input.js b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-const-declare-class/input.js similarity index 100% rename from packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-const-declare-class/input.js rename to packages/babel-parser/test/fixtures/flow/scope/dupl-decl-const-declare-class/input.js diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-const-declare-class/options.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-const-declare-class/options.json new file mode 100644 index 000000000000..d822c40fbba2 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-const-declare-class/options.json @@ -0,0 +1,4 @@ +{ + "sourceType": "module", + "plugins": ["jsx", "flow"] +} diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-const-declare-class/output.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-const-declare-class/output.json new file mode 100644 index 000000000000..c3c7f880bf51 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-const-declare-class/output.json @@ -0,0 +1,63 @@ +{ + "type": "File", + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":18}}, + "errors": [ + "SyntaxError: Identifier 'A' has already been declared (2:14)" + ], + "program": { + "type": "Program", + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":18}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":6,"end":11,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":11}}, + "id": { + "type": "Identifier", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, + "name": "A" + }, + "init": { + "type": "NumericLiteral", + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11}}, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + ], + "kind": "const" + }, + { + "type": "DeclareClass", + "start":13,"end":31,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":18}}, + "id": { + "type": "Identifier", + "start":27,"end":28,"loc":{"start":{"line":2,"column":14},"end":{"line":2,"column":15},"identifierName":"A"}, + "name": "A" + }, + "typeParameters": null, + "extends": [], + "implements": [], + "mixins": [], + "body": { + "type": "ObjectTypeAnnotation", + "start":29,"end":31,"loc":{"start":{"line":2,"column":16},"end":{"line":2,"column":18}}, + "callProperties": [], + "properties": [], + "indexers": [], + "internalSlots": [], + "exact": false + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-const-declare-interface/input.js b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-const-declare-interface/input.js similarity index 100% rename from packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-const-declare-interface/input.js rename to packages/babel-parser/test/fixtures/flow/scope/dupl-decl-const-declare-interface/input.js diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-const-declare-interface/options.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-const-declare-interface/options.json new file mode 100644 index 000000000000..d822c40fbba2 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-const-declare-interface/options.json @@ -0,0 +1,4 @@ +{ + "sourceType": "module", + "plugins": ["jsx", "flow"] +} diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-const-declare-interface/output.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-const-declare-interface/output.json new file mode 100644 index 000000000000..24563be730dc --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-const-declare-interface/output.json @@ -0,0 +1,63 @@ +{ + "type": "File", + "start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":22}}, + "errors": [ + "SyntaxError: Identifier 'A' has already been declared (2:18)" + ], + "program": { + "type": "Program", + "start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":22}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":6,"end":11,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":11}}, + "id": { + "type": "Identifier", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, + "name": "A" + }, + "init": { + "type": "NumericLiteral", + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11}}, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + ], + "kind": "const" + }, + { + "type": "DeclareInterface", + "start":13,"end":35,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":22}}, + "id": { + "type": "Identifier", + "start":31,"end":32,"loc":{"start":{"line":2,"column":18},"end":{"line":2,"column":19},"identifierName":"A"}, + "name": "A" + }, + "typeParameters": null, + "extends": [], + "implements": [], + "mixins": [], + "body": { + "type": "ObjectTypeAnnotation", + "start":33,"end":35,"loc":{"start":{"line":2,"column":20},"end":{"line":2,"column":22}}, + "callProperties": [], + "properties": [], + "indexers": [], + "internalSlots": [], + "exact": false + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-const-interface/input.js b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-const-interface/input.js similarity index 100% rename from packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-const-interface/input.js rename to packages/babel-parser/test/fixtures/flow/scope/dupl-decl-const-interface/input.js diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-const-interface/options.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-const-interface/options.json new file mode 100644 index 000000000000..d822c40fbba2 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-const-interface/options.json @@ -0,0 +1,4 @@ +{ + "sourceType": "module", + "plugins": ["jsx", "flow"] +} diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-const-interface/output.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-const-interface/output.json new file mode 100644 index 000000000000..b687d1711180 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-const-interface/output.json @@ -0,0 +1,63 @@ +{ + "type": "File", + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":14}}, + "errors": [ + "SyntaxError: Identifier 'A' has already been declared (2:10)" + ], + "program": { + "type": "Program", + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":14}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":6,"end":11,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":11}}, + "id": { + "type": "Identifier", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, + "name": "A" + }, + "init": { + "type": "NumericLiteral", + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11}}, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + ], + "kind": "const" + }, + { + "type": "InterfaceDeclaration", + "start":13,"end":27,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":14}}, + "id": { + "type": "Identifier", + "start":23,"end":24,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":11},"identifierName":"A"}, + "name": "A" + }, + "typeParameters": null, + "extends": [], + "implements": [], + "mixins": [], + "body": { + "type": "ObjectTypeAnnotation", + "start":25,"end":27,"loc":{"start":{"line":2,"column":12},"end":{"line":2,"column":14}}, + "callProperties": [], + "properties": [], + "indexers": [], + "internalSlots": [], + "exact": false + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-const-opaque-type/options.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-const-opaque-type/options.json deleted file mode 100644 index 81dc2c90799f..000000000000 --- a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-const-opaque-type/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'A' has already been declared (2:12)" -} diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-const-opaque-type/output.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-const-opaque-type/output.json new file mode 100644 index 000000000000..baeda3cb81d9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-const-opaque-type/output.json @@ -0,0 +1,62 @@ +{ + "type": "File", + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":19}}, + "errors": [ + "SyntaxError: Identifier 'A' has already been declared (2:12)" + ], + "program": { + "type": "Program", + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":19}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":6,"end":11,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":11}}, + "id": { + "type": "Identifier", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, + "name": "A" + }, + "init": { + "type": "NumericLiteral", + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11}}, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + ], + "kind": "const" + }, + { + "type": "OpaqueType", + "start":13,"end":32,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":19}}, + "id": { + "type": "Identifier", + "start":25,"end":26,"loc":{"start":{"line":2,"column":12},"end":{"line":2,"column":13},"identifierName":"A"}, + "name": "A" + }, + "typeParameters": null, + "supertype": null, + "impltype": { + "type": "ObjectTypeAnnotation", + "start":29,"end":31,"loc":{"start":{"line":2,"column":16},"end":{"line":2,"column":18}}, + "callProperties": [], + "properties": [], + "indexers": [], + "internalSlots": [], + "exact": false, + "inexact": false + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-const-type/options.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-const-type/options.json deleted file mode 100644 index 1eed93f49a0e..000000000000 --- a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-const-type/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'A' has already been declared (2:5)" -} diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-const-type/output.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-const-type/output.json new file mode 100644 index 000000000000..efef58004674 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-const-type/output.json @@ -0,0 +1,61 @@ +{ + "type": "File", + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":12}}, + "errors": [ + "SyntaxError: Identifier 'A' has already been declared (2:5)" + ], + "program": { + "type": "Program", + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":12}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":6,"end":11,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":11}}, + "id": { + "type": "Identifier", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, + "name": "A" + }, + "init": { + "type": "NumericLiteral", + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11}}, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + ], + "kind": "const" + }, + { + "type": "TypeAlias", + "start":13,"end":25,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":12}}, + "id": { + "type": "Identifier", + "start":18,"end":19,"loc":{"start":{"line":2,"column":5},"end":{"line":2,"column":6},"identifierName":"A"}, + "name": "A" + }, + "typeParameters": null, + "right": { + "type": "ObjectTypeAnnotation", + "start":22,"end":24,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":11}}, + "callProperties": [], + "properties": [], + "indexers": [], + "internalSlots": [], + "exact": false, + "inexact": false + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-declare-class-declare-class/input.js b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-declare-class-declare-class/input.js similarity index 100% rename from packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-declare-class-declare-class/input.js rename to packages/babel-parser/test/fixtures/flow/scope/dupl-decl-declare-class-declare-class/input.js diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-declare-class-declare-class/output.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-declare-class-declare-class/output.json new file mode 100644 index 000000000000..01a9ab853863 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-declare-class-declare-class/output.json @@ -0,0 +1,57 @@ +{ + "type": "File", + "start":0,"end":37,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":18}}, + "program": { + "type": "Program", + "start":0,"end":37,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":18}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "DeclareClass", + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, + "id": { + "type": "Identifier", + "start":14,"end":15,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":15},"identifierName":"A"}, + "name": "A" + }, + "typeParameters": null, + "extends": [], + "implements": [], + "mixins": [], + "body": { + "type": "ObjectTypeAnnotation", + "start":16,"end":18,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":18}}, + "callProperties": [], + "properties": [], + "indexers": [], + "internalSlots": [], + "exact": false + } + }, + { + "type": "DeclareClass", + "start":19,"end":37,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":18}}, + "id": { + "type": "Identifier", + "start":33,"end":34,"loc":{"start":{"line":2,"column":14},"end":{"line":2,"column":15},"identifierName":"A"}, + "name": "A" + }, + "typeParameters": null, + "extends": [], + "implements": [], + "mixins": [], + "body": { + "type": "ObjectTypeAnnotation", + "start":35,"end":37,"loc":{"start":{"line":2,"column":16},"end":{"line":2,"column":18}}, + "callProperties": [], + "properties": [], + "indexers": [], + "internalSlots": [], + "exact": false + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-declare-class-declare-interface/input.js b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-declare-class-declare-interface/input.js similarity index 100% rename from packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-declare-class-declare-interface/input.js rename to packages/babel-parser/test/fixtures/flow/scope/dupl-decl-declare-class-declare-interface/input.js diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-declare-class-declare-interface/options.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-declare-class-declare-interface/options.json new file mode 100644 index 000000000000..d822c40fbba2 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-declare-class-declare-interface/options.json @@ -0,0 +1,4 @@ +{ + "sourceType": "module", + "plugins": ["jsx", "flow"] +} diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-declare-class-declare-interface/output.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-declare-class-declare-interface/output.json new file mode 100644 index 000000000000..33e3c985215c --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-declare-class-declare-interface/output.json @@ -0,0 +1,60 @@ +{ + "type": "File", + "start":0,"end":41,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":22}}, + "errors": [ + "SyntaxError: Identifier 'A' has already been declared (2:18)" + ], + "program": { + "type": "Program", + "start":0,"end":41,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":22}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "DeclareClass", + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, + "id": { + "type": "Identifier", + "start":14,"end":15,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":15},"identifierName":"A"}, + "name": "A" + }, + "typeParameters": null, + "extends": [], + "implements": [], + "mixins": [], + "body": { + "type": "ObjectTypeAnnotation", + "start":16,"end":18,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":18}}, + "callProperties": [], + "properties": [], + "indexers": [], + "internalSlots": [], + "exact": false + } + }, + { + "type": "DeclareInterface", + "start":19,"end":41,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":22}}, + "id": { + "type": "Identifier", + "start":37,"end":38,"loc":{"start":{"line":2,"column":18},"end":{"line":2,"column":19},"identifierName":"A"}, + "name": "A" + }, + "typeParameters": null, + "extends": [], + "implements": [], + "mixins": [], + "body": { + "type": "ObjectTypeAnnotation", + "start":39,"end":41,"loc":{"start":{"line":2,"column":20},"end":{"line":2,"column":22}}, + "callProperties": [], + "properties": [], + "indexers": [], + "internalSlots": [], + "exact": false + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-declare-func-declare-func/input.js b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-declare-func-declare-func/input.js similarity index 100% rename from packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-declare-func-declare-func/input.js rename to packages/babel-parser/test/fixtures/flow/scope/dupl-decl-declare-func-declare-func/input.js diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-declare-func-declare-func/output.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-declare-func-declare-func/output.json new file mode 100644 index 000000000000..de9cd47bb358 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-declare-func-declare-func/output.json @@ -0,0 +1,63 @@ +{ + "type": "File", + "start":0,"end":55,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":27}}, + "program": { + "type": "Program", + "start":0,"end":55,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":27}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "DeclareFunction", + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, + "id": { + "type": "Identifier", + "start":17,"end":26,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":26},"identifierName":"A"}, + "name": "A", + "typeAnnotation": { + "type": "TypeAnnotation", + "start":18,"end":26,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":26}}, + "typeAnnotation": { + "type": "FunctionTypeAnnotation", + "start":18,"end":26,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":26}}, + "typeParameters": null, + "params": [], + "rest": null, + "returnType": { + "type": "VoidTypeAnnotation", + "start":22,"end":26,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":26}} + } + } + } + }, + "predicate": null + }, + { + "type": "DeclareFunction", + "start":28,"end":55,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":27}}, + "id": { + "type": "Identifier", + "start":45,"end":54,"loc":{"start":{"line":2,"column":17},"end":{"line":2,"column":26},"identifierName":"A"}, + "name": "A", + "typeAnnotation": { + "type": "TypeAnnotation", + "start":46,"end":54,"loc":{"start":{"line":2,"column":18},"end":{"line":2,"column":26}}, + "typeAnnotation": { + "type": "FunctionTypeAnnotation", + "start":46,"end":54,"loc":{"start":{"line":2,"column":18},"end":{"line":2,"column":26}}, + "typeParameters": null, + "params": [], + "rest": null, + "returnType": { + "type": "VoidTypeAnnotation", + "start":50,"end":54,"loc":{"start":{"line":2,"column":22},"end":{"line":2,"column":26}} + } + } + } + }, + "predicate": null + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-declare-func-declare-var/input.js b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-declare-func-declare-var/input.js similarity index 100% rename from packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-declare-func-declare-var/input.js rename to packages/babel-parser/test/fixtures/flow/scope/dupl-decl-declare-func-declare-var/input.js diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-declare-func-declare-var/output.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-declare-func-declare-var/output.json new file mode 100644 index 000000000000..27ab9b95ad66 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-declare-func-declare-var/output.json @@ -0,0 +1,55 @@ +{ + "type": "File", + "start":0,"end":50,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":22}}, + "program": { + "type": "Program", + "start":0,"end":50,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":22}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "DeclareFunction", + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, + "id": { + "type": "Identifier", + "start":17,"end":26,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":26},"identifierName":"A"}, + "name": "A", + "typeAnnotation": { + "type": "TypeAnnotation", + "start":18,"end":26,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":26}}, + "typeAnnotation": { + "type": "FunctionTypeAnnotation", + "start":18,"end":26,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":26}}, + "typeParameters": null, + "params": [], + "rest": null, + "returnType": { + "type": "VoidTypeAnnotation", + "start":22,"end":26,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":26}} + } + } + } + }, + "predicate": null + }, + { + "type": "DeclareVariable", + "start":28,"end":50,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":22}}, + "id": { + "type": "Identifier", + "start":40,"end":49,"loc":{"start":{"line":2,"column":12},"end":{"line":2,"column":21},"identifierName":"A"}, + "name": "A", + "typeAnnotation": { + "type": "TypeAnnotation", + "start":41,"end":49,"loc":{"start":{"line":2,"column":13},"end":{"line":2,"column":21}}, + "typeAnnotation": { + "type": "NumberTypeAnnotation", + "start":43,"end":49,"loc":{"start":{"line":2,"column":15},"end":{"line":2,"column":21}} + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-declare-func-func/input.js b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-declare-func-func/input.js similarity index 100% rename from packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-declare-func-func/input.js rename to packages/babel-parser/test/fixtures/flow/scope/dupl-decl-declare-func-func/input.js diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-declare-func-func/options.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-declare-func-func/options.json new file mode 100644 index 000000000000..d822c40fbba2 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-declare-func-func/options.json @@ -0,0 +1,4 @@ +{ + "sourceType": "module", + "plugins": ["jsx", "flow"] +} diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-declare-func-func/output.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-declare-func-func/output.json new file mode 100644 index 000000000000..6895d0b4ef67 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-declare-func-func/output.json @@ -0,0 +1,56 @@ +{ + "type": "File", + "start":0,"end":43,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":15}}, + "program": { + "type": "Program", + "start":0,"end":43,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":15}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "DeclareFunction", + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, + "id": { + "type": "Identifier", + "start":17,"end":26,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":26},"identifierName":"A"}, + "name": "A", + "typeAnnotation": { + "type": "TypeAnnotation", + "start":18,"end":26,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":26}}, + "typeAnnotation": { + "type": "FunctionTypeAnnotation", + "start":18,"end":26,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":26}}, + "typeParameters": null, + "params": [], + "rest": null, + "returnType": { + "type": "VoidTypeAnnotation", + "start":22,"end":26,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":26}} + } + } + } + }, + "predicate": null + }, + { + "type": "FunctionDeclaration", + "start":28,"end":43,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":15}}, + "id": { + "type": "Identifier", + "start":37,"end":38,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":10},"identifierName":"A"}, + "name": "A" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":41,"end":43,"loc":{"start":{"line":2,"column":13},"end":{"line":2,"column":15}}, + "body": [], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-declare-interface-declare-class/input.js b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-declare-interface-declare-class/input.js similarity index 100% rename from packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-declare-interface-declare-class/input.js rename to packages/babel-parser/test/fixtures/flow/scope/dupl-decl-declare-interface-declare-class/input.js diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-declare-interface-declare-class/options.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-declare-interface-declare-class/options.json new file mode 100644 index 000000000000..d822c40fbba2 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-declare-interface-declare-class/options.json @@ -0,0 +1,4 @@ +{ + "sourceType": "module", + "plugins": ["jsx", "flow"] +} diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-declare-interface-declare-class/output.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-declare-interface-declare-class/output.json new file mode 100644 index 000000000000..555f58649c80 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-declare-interface-declare-class/output.json @@ -0,0 +1,60 @@ +{ + "type": "File", + "start":0,"end":41,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":18}}, + "errors": [ + "SyntaxError: Identifier 'A' has already been declared (2:14)" + ], + "program": { + "type": "Program", + "start":0,"end":41,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":18}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "DeclareInterface", + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, + "id": { + "type": "Identifier", + "start":18,"end":19,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":19},"identifierName":"A"}, + "name": "A" + }, + "typeParameters": null, + "extends": [], + "implements": [], + "mixins": [], + "body": { + "type": "ObjectTypeAnnotation", + "start":20,"end":22,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":22}}, + "callProperties": [], + "properties": [], + "indexers": [], + "internalSlots": [], + "exact": false + } + }, + { + "type": "DeclareClass", + "start":23,"end":41,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":18}}, + "id": { + "type": "Identifier", + "start":37,"end":38,"loc":{"start":{"line":2,"column":14},"end":{"line":2,"column":15},"identifierName":"A"}, + "name": "A" + }, + "typeParameters": null, + "extends": [], + "implements": [], + "mixins": [], + "body": { + "type": "ObjectTypeAnnotation", + "start":39,"end":41,"loc":{"start":{"line":2,"column":16},"end":{"line":2,"column":18}}, + "callProperties": [], + "properties": [], + "indexers": [], + "internalSlots": [], + "exact": false + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-declare-var-declare-var/input.js b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-declare-var-declare-var/input.js similarity index 100% rename from packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-declare-var-declare-var/input.js rename to packages/babel-parser/test/fixtures/flow/scope/dupl-decl-declare-var-declare-var/input.js diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-declare-var-declare-var/output.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-declare-var-declare-var/output.json new file mode 100644 index 000000000000..d034848f859e --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-declare-var-declare-var/output.json @@ -0,0 +1,47 @@ +{ + "type": "File", + "start":0,"end":45,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":22}}, + "program": { + "type": "Program", + "start":0,"end":45,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":22}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "DeclareVariable", + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, + "id": { + "type": "Identifier", + "start":12,"end":21,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":21},"identifierName":"A"}, + "name": "A", + "typeAnnotation": { + "type": "TypeAnnotation", + "start":13,"end":21,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":21}}, + "typeAnnotation": { + "type": "NumberTypeAnnotation", + "start":15,"end":21,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":21}} + } + } + } + }, + { + "type": "DeclareVariable", + "start":23,"end":45,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":22}}, + "id": { + "type": "Identifier", + "start":35,"end":44,"loc":{"start":{"line":2,"column":12},"end":{"line":2,"column":21},"identifierName":"A"}, + "name": "A", + "typeAnnotation": { + "type": "TypeAnnotation", + "start":36,"end":44,"loc":{"start":{"line":2,"column":13},"end":{"line":2,"column":21}}, + "typeAnnotation": { + "type": "NumberTypeAnnotation", + "start":38,"end":44,"loc":{"start":{"line":2,"column":15},"end":{"line":2,"column":21}} + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-declare-var-let/input.js b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-declare-var-let/input.js similarity index 100% rename from packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-declare-var-let/input.js rename to packages/babel-parser/test/fixtures/flow/scope/dupl-decl-declare-var-let/input.js diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-declare-var-let/options.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-declare-var-let/options.json new file mode 100644 index 000000000000..d822c40fbba2 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-declare-var-let/options.json @@ -0,0 +1,4 @@ +{ + "sourceType": "module", + "plugins": ["jsx", "flow"] +} diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-declare-var-let/output.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-declare-var-let/output.json new file mode 100644 index 000000000000..dd8f7d4acb27 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-declare-var-let/output.json @@ -0,0 +1,50 @@ +{ + "type": "File", + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":6}}, + "errors": [ + "SyntaxError: Identifier 'A' has already been declared (2:4)" + ], + "program": { + "type": "Program", + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":6}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "DeclareVariable", + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, + "id": { + "type": "Identifier", + "start":12,"end":21,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":21},"identifierName":"A"}, + "name": "A", + "typeAnnotation": { + "type": "TypeAnnotation", + "start":13,"end":21,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":21}}, + "typeAnnotation": { + "type": "NumberTypeAnnotation", + "start":15,"end":21,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":21}} + } + } + } + }, + { + "type": "VariableDeclaration", + "start":23,"end":29,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":6}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":27,"end":28,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":5}}, + "id": { + "type": "Identifier", + "start":27,"end":28,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":5},"identifierName":"A"}, + "name": "A" + }, + "init": null + } + ], + "kind": "let" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-interface-interface/input.js b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-interface-interface/input.js similarity index 100% rename from packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-interface-interface/input.js rename to packages/babel-parser/test/fixtures/flow/scope/dupl-decl-interface-interface/input.js diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-interface-interface/options.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-interface-interface/options.json new file mode 100644 index 000000000000..d822c40fbba2 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-interface-interface/options.json @@ -0,0 +1,4 @@ +{ + "sourceType": "module", + "plugins": ["jsx", "flow"] +} diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-interface-interface/output.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-interface-interface/output.json new file mode 100644 index 000000000000..4f2b265c8859 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-interface-interface/output.json @@ -0,0 +1,60 @@ +{ + "type": "File", + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":14}}, + "errors": [ + "SyntaxError: Identifier 'A' has already been declared (2:10)" + ], + "program": { + "type": "Program", + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":14}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "InterfaceDeclaration", + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, + "id": { + "type": "Identifier", + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11},"identifierName":"A"}, + "name": "A" + }, + "typeParameters": null, + "extends": [], + "implements": [], + "mixins": [], + "body": { + "type": "ObjectTypeAnnotation", + "start":12,"end":14,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":14}}, + "callProperties": [], + "properties": [], + "indexers": [], + "internalSlots": [], + "exact": false + } + }, + { + "type": "InterfaceDeclaration", + "start":15,"end":29,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":14}}, + "id": { + "type": "Identifier", + "start":25,"end":26,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":11},"identifierName":"A"}, + "name": "A" + }, + "typeParameters": null, + "extends": [], + "implements": [], + "mixins": [], + "body": { + "type": "ObjectTypeAnnotation", + "start":27,"end":29,"loc":{"start":{"line":2,"column":12},"end":{"line":2,"column":14}}, + "callProperties": [], + "properties": [], + "indexers": [], + "internalSlots": [], + "exact": false + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-let-declare-class/input.js b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-let-declare-class/input.js similarity index 100% rename from packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-let-declare-class/input.js rename to packages/babel-parser/test/fixtures/flow/scope/dupl-decl-let-declare-class/input.js diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-let-declare-class/options.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-let-declare-class/options.json new file mode 100644 index 000000000000..d822c40fbba2 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-let-declare-class/options.json @@ -0,0 +1,4 @@ +{ + "sourceType": "module", + "plugins": ["jsx", "flow"] +} diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-let-declare-class/output.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-let-declare-class/output.json new file mode 100644 index 000000000000..d1e848e45942 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-let-declare-class/output.json @@ -0,0 +1,63 @@ +{ + "type": "File", + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":18}}, + "errors": [ + "SyntaxError: Identifier 'A' has already been declared (2:14)" + ], + "program": { + "type": "Program", + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":18}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":4,"end":9,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":9}}, + "id": { + "type": "Identifier", + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"A"}, + "name": "A" + }, + "init": { + "type": "NumericLiteral", + "start":8,"end":9,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":9}}, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + ], + "kind": "let" + }, + { + "type": "DeclareClass", + "start":11,"end":29,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":18}}, + "id": { + "type": "Identifier", + "start":25,"end":26,"loc":{"start":{"line":2,"column":14},"end":{"line":2,"column":15},"identifierName":"A"}, + "name": "A" + }, + "typeParameters": null, + "extends": [], + "implements": [], + "mixins": [], + "body": { + "type": "ObjectTypeAnnotation", + "start":27,"end":29,"loc":{"start":{"line":2,"column":16},"end":{"line":2,"column":18}}, + "callProperties": [], + "properties": [], + "indexers": [], + "internalSlots": [], + "exact": false + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-let-declare-interface/input.js b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-let-declare-interface/input.js similarity index 100% rename from packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-let-declare-interface/input.js rename to packages/babel-parser/test/fixtures/flow/scope/dupl-decl-let-declare-interface/input.js diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-let-declare-interface/options.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-let-declare-interface/options.json new file mode 100644 index 000000000000..d822c40fbba2 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-let-declare-interface/options.json @@ -0,0 +1,4 @@ +{ + "sourceType": "module", + "plugins": ["jsx", "flow"] +} diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-let-declare-interface/output.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-let-declare-interface/output.json new file mode 100644 index 000000000000..6a4433ea75d3 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-let-declare-interface/output.json @@ -0,0 +1,63 @@ +{ + "type": "File", + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":22}}, + "errors": [ + "SyntaxError: Identifier 'A' has already been declared (2:18)" + ], + "program": { + "type": "Program", + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":22}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":4,"end":9,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":9}}, + "id": { + "type": "Identifier", + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"A"}, + "name": "A" + }, + "init": { + "type": "NumericLiteral", + "start":8,"end":9,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":9}}, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + ], + "kind": "let" + }, + { + "type": "DeclareInterface", + "start":11,"end":33,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":22}}, + "id": { + "type": "Identifier", + "start":29,"end":30,"loc":{"start":{"line":2,"column":18},"end":{"line":2,"column":19},"identifierName":"A"}, + "name": "A" + }, + "typeParameters": null, + "extends": [], + "implements": [], + "mixins": [], + "body": { + "type": "ObjectTypeAnnotation", + "start":31,"end":33,"loc":{"start":{"line":2,"column":20},"end":{"line":2,"column":22}}, + "callProperties": [], + "properties": [], + "indexers": [], + "internalSlots": [], + "exact": false + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-let-interface/input.js b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-let-interface/input.js similarity index 100% rename from packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-let-interface/input.js rename to packages/babel-parser/test/fixtures/flow/scope/dupl-decl-let-interface/input.js diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-let-interface/options.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-let-interface/options.json new file mode 100644 index 000000000000..d822c40fbba2 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-let-interface/options.json @@ -0,0 +1,4 @@ +{ + "sourceType": "module", + "plugins": ["jsx", "flow"] +} diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-let-interface/output.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-let-interface/output.json new file mode 100644 index 000000000000..d102313ba870 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-let-interface/output.json @@ -0,0 +1,63 @@ +{ + "type": "File", + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":14}}, + "errors": [ + "SyntaxError: Identifier 'A' has already been declared (2:10)" + ], + "program": { + "type": "Program", + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":14}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":4,"end":9,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":9}}, + "id": { + "type": "Identifier", + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"A"}, + "name": "A" + }, + "init": { + "type": "NumericLiteral", + "start":8,"end":9,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":9}}, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + ], + "kind": "let" + }, + { + "type": "InterfaceDeclaration", + "start":11,"end":25,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":14}}, + "id": { + "type": "Identifier", + "start":21,"end":22,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":11},"identifierName":"A"}, + "name": "A" + }, + "typeParameters": null, + "extends": [], + "implements": [], + "mixins": [], + "body": { + "type": "ObjectTypeAnnotation", + "start":23,"end":25,"loc":{"start":{"line":2,"column":12},"end":{"line":2,"column":14}}, + "callProperties": [], + "properties": [], + "indexers": [], + "internalSlots": [], + "exact": false + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-let-opaque-type/options.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-let-opaque-type/options.json deleted file mode 100644 index 81dc2c90799f..000000000000 --- a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-let-opaque-type/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'A' has already been declared (2:12)" -} diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-let-opaque-type/output.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-let-opaque-type/output.json new file mode 100644 index 000000000000..085f418b8da3 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-let-opaque-type/output.json @@ -0,0 +1,62 @@ +{ + "type": "File", + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":19}}, + "errors": [ + "SyntaxError: Identifier 'A' has already been declared (2:12)" + ], + "program": { + "type": "Program", + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":19}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":4,"end":9,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":9}}, + "id": { + "type": "Identifier", + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"A"}, + "name": "A" + }, + "init": { + "type": "NumericLiteral", + "start":8,"end":9,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":9}}, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + ], + "kind": "let" + }, + { + "type": "OpaqueType", + "start":11,"end":30,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":19}}, + "id": { + "type": "Identifier", + "start":23,"end":24,"loc":{"start":{"line":2,"column":12},"end":{"line":2,"column":13},"identifierName":"A"}, + "name": "A" + }, + "typeParameters": null, + "supertype": null, + "impltype": { + "type": "ObjectTypeAnnotation", + "start":27,"end":29,"loc":{"start":{"line":2,"column":16},"end":{"line":2,"column":18}}, + "callProperties": [], + "properties": [], + "indexers": [], + "internalSlots": [], + "exact": false, + "inexact": false + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-let-type/options.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-let-type/options.json deleted file mode 100644 index 1eed93f49a0e..000000000000 --- a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-let-type/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'A' has already been declared (2:5)" -} diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-let-type/output.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-let-type/output.json new file mode 100644 index 000000000000..4f7bdf0cd238 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-let-type/output.json @@ -0,0 +1,61 @@ +{ + "type": "File", + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":12}}, + "errors": [ + "SyntaxError: Identifier 'A' has already been declared (2:5)" + ], + "program": { + "type": "Program", + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":12}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":4,"end":9,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":9}}, + "id": { + "type": "Identifier", + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"A"}, + "name": "A" + }, + "init": { + "type": "NumericLiteral", + "start":8,"end":9,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":9}}, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + ], + "kind": "let" + }, + { + "type": "TypeAlias", + "start":11,"end":23,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":12}}, + "id": { + "type": "Identifier", + "start":16,"end":17,"loc":{"start":{"line":2,"column":5},"end":{"line":2,"column":6},"identifierName":"A"}, + "name": "A" + }, + "typeParameters": null, + "right": { + "type": "ObjectTypeAnnotation", + "start":20,"end":22,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":11}}, + "callProperties": [], + "properties": [], + "indexers": [], + "internalSlots": [], + "exact": false, + "inexact": false + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-opaque-type-const/options.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-opaque-type-const/options.json deleted file mode 100644 index 336686170eb0..000000000000 --- a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-opaque-type-const/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'A' has already been declared (2:6)" -} diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-opaque-type-const/output.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-opaque-type-const/output.json new file mode 100644 index 000000000000..b68fa592840b --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-opaque-type-const/output.json @@ -0,0 +1,62 @@ +{ + "type": "File", + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":12}}, + "errors": [ + "SyntaxError: Identifier 'A' has already been declared (2:6)" + ], + "program": { + "type": "Program", + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":12}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "OpaqueType", + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, + "id": { + "type": "Identifier", + "start":12,"end":13,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":13},"identifierName":"A"}, + "name": "A" + }, + "typeParameters": null, + "supertype": null, + "impltype": { + "type": "ObjectTypeAnnotation", + "start":16,"end":18,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":18}}, + "callProperties": [], + "properties": [], + "indexers": [], + "internalSlots": [], + "exact": false, + "inexact": false + } + }, + { + "type": "VariableDeclaration", + "start":20,"end":32,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":12}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":26,"end":31,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":11}}, + "id": { + "type": "Identifier", + "start":26,"end":27,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":7},"identifierName":"A"}, + "name": "A" + }, + "init": { + "type": "NumericLiteral", + "start":30,"end":31,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":11}}, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + ], + "kind": "const" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-opaque-type-let/options.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-opaque-type-let/options.json deleted file mode 100644 index b6ff3a4b0987..000000000000 --- a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-opaque-type-let/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'A' has already been declared (2:4)" -} diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-opaque-type-let/output.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-opaque-type-let/output.json new file mode 100644 index 000000000000..00382a7d0f82 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-opaque-type-let/output.json @@ -0,0 +1,62 @@ +{ + "type": "File", + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":10}}, + "errors": [ + "SyntaxError: Identifier 'A' has already been declared (2:4)" + ], + "program": { + "type": "Program", + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":10}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "OpaqueType", + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, + "id": { + "type": "Identifier", + "start":12,"end":13,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":13},"identifierName":"A"}, + "name": "A" + }, + "typeParameters": null, + "supertype": null, + "impltype": { + "type": "ObjectTypeAnnotation", + "start":16,"end":18,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":18}}, + "callProperties": [], + "properties": [], + "indexers": [], + "internalSlots": [], + "exact": false, + "inexact": false + } + }, + { + "type": "VariableDeclaration", + "start":20,"end":30,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":10}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":24,"end":29,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":9}}, + "id": { + "type": "Identifier", + "start":24,"end":25,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":5},"identifierName":"A"}, + "name": "A" + }, + "init": { + "type": "NumericLiteral", + "start":28,"end":29,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":9}}, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + ], + "kind": "let" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-opaque-type-opaque-type/options.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-opaque-type-opaque-type/options.json deleted file mode 100644 index 81dc2c90799f..000000000000 --- a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-opaque-type-opaque-type/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'A' has already been declared (2:12)" -} diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-opaque-type-opaque-type/output.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-opaque-type-opaque-type/output.json new file mode 100644 index 000000000000..bbcc52e79f84 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-opaque-type-opaque-type/output.json @@ -0,0 +1,58 @@ +{ + "type": "File", + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":19}}, + "errors": [ + "SyntaxError: Identifier 'A' has already been declared (2:12)" + ], + "program": { + "type": "Program", + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":19}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "OpaqueType", + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, + "id": { + "type": "Identifier", + "start":12,"end":13,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":13},"identifierName":"A"}, + "name": "A" + }, + "typeParameters": null, + "supertype": null, + "impltype": { + "type": "ObjectTypeAnnotation", + "start":16,"end":18,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":18}}, + "callProperties": [], + "properties": [], + "indexers": [], + "internalSlots": [], + "exact": false, + "inexact": false + } + }, + { + "type": "OpaqueType", + "start":20,"end":39,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":19}}, + "id": { + "type": "Identifier", + "start":32,"end":33,"loc":{"start":{"line":2,"column":12},"end":{"line":2,"column":13},"identifierName":"A"}, + "name": "A" + }, + "typeParameters": null, + "supertype": null, + "impltype": { + "type": "ObjectTypeAnnotation", + "start":36,"end":38,"loc":{"start":{"line":2,"column":16},"end":{"line":2,"column":18}}, + "callProperties": [], + "properties": [], + "indexers": [], + "internalSlots": [], + "exact": false, + "inexact": false + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-opaque-type-type/options.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-opaque-type-type/options.json deleted file mode 100644 index 1eed93f49a0e..000000000000 --- a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-opaque-type-type/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'A' has already been declared (2:5)" -} diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-opaque-type-type/output.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-opaque-type-type/output.json new file mode 100644 index 000000000000..ae77d22a5326 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-opaque-type-type/output.json @@ -0,0 +1,57 @@ +{ + "type": "File", + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":12}}, + "errors": [ + "SyntaxError: Identifier 'A' has already been declared (2:5)" + ], + "program": { + "type": "Program", + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":12}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "OpaqueType", + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, + "id": { + "type": "Identifier", + "start":12,"end":13,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":13},"identifierName":"A"}, + "name": "A" + }, + "typeParameters": null, + "supertype": null, + "impltype": { + "type": "ObjectTypeAnnotation", + "start":16,"end":18,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":18}}, + "callProperties": [], + "properties": [], + "indexers": [], + "internalSlots": [], + "exact": false, + "inexact": false + } + }, + { + "type": "TypeAlias", + "start":20,"end":32,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":12}}, + "id": { + "type": "Identifier", + "start":25,"end":26,"loc":{"start":{"line":2,"column":5},"end":{"line":2,"column":6},"identifierName":"A"}, + "name": "A" + }, + "typeParameters": null, + "right": { + "type": "ObjectTypeAnnotation", + "start":29,"end":31,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":11}}, + "callProperties": [], + "properties": [], + "indexers": [], + "internalSlots": [], + "exact": false, + "inexact": false + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-opaque-type-var/options.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-opaque-type-var/options.json deleted file mode 100644 index b6ff3a4b0987..000000000000 --- a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-opaque-type-var/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'A' has already been declared (2:4)" -} diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-opaque-type-var/output.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-opaque-type-var/output.json new file mode 100644 index 000000000000..fcfa4d85054d --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-opaque-type-var/output.json @@ -0,0 +1,62 @@ +{ + "type": "File", + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":10}}, + "errors": [ + "SyntaxError: Identifier 'A' has already been declared (2:4)" + ], + "program": { + "type": "Program", + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":10}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "OpaqueType", + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, + "id": { + "type": "Identifier", + "start":12,"end":13,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":13},"identifierName":"A"}, + "name": "A" + }, + "typeParameters": null, + "supertype": null, + "impltype": { + "type": "ObjectTypeAnnotation", + "start":16,"end":18,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":18}}, + "callProperties": [], + "properties": [], + "indexers": [], + "internalSlots": [], + "exact": false, + "inexact": false + } + }, + { + "type": "VariableDeclaration", + "start":20,"end":30,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":10}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":24,"end":29,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":9}}, + "id": { + "type": "Identifier", + "start":24,"end":25,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":5},"identifierName":"A"}, + "name": "A" + }, + "init": { + "type": "NumericLiteral", + "start":28,"end":29,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":9}}, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + ], + "kind": "var" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-type-const/options.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-type-const/options.json deleted file mode 100644 index 336686170eb0..000000000000 --- a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-type-const/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'A' has already been declared (2:6)" -} diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-type-const/output.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-type-const/output.json new file mode 100644 index 000000000000..6170eb332b03 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-type-const/output.json @@ -0,0 +1,61 @@ +{ + "type": "File", + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":12}}, + "errors": [ + "SyntaxError: Identifier 'A' has already been declared (2:6)" + ], + "program": { + "type": "Program", + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":12}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "TypeAlias", + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "id": { + "type": "Identifier", + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"A"}, + "name": "A" + }, + "typeParameters": null, + "right": { + "type": "ObjectTypeAnnotation", + "start":9,"end":11,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":11}}, + "callProperties": [], + "properties": [], + "indexers": [], + "internalSlots": [], + "exact": false, + "inexact": false + } + }, + { + "type": "VariableDeclaration", + "start":13,"end":25,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":12}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":19,"end":24,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":11}}, + "id": { + "type": "Identifier", + "start":19,"end":20,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":7},"identifierName":"A"}, + "name": "A" + }, + "init": { + "type": "NumericLiteral", + "start":23,"end":24,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":11}}, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + ], + "kind": "const" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-type-interface/input.js b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-type-interface/input.js similarity index 100% rename from packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-type-interface/input.js rename to packages/babel-parser/test/fixtures/flow/scope/dupl-decl-type-interface/input.js diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-type-interface/options.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-type-interface/options.json new file mode 100644 index 000000000000..d822c40fbba2 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-type-interface/options.json @@ -0,0 +1,4 @@ +{ + "sourceType": "module", + "plugins": ["jsx", "flow"] +} diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-type-interface/output.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-type-interface/output.json new file mode 100644 index 000000000000..017c30dec6cd --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-type-interface/output.json @@ -0,0 +1,52 @@ +{ + "type": "File", + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":14}}, + "errors": [ + "SyntaxError: Identifier 'A' has already been declared (2:10)" + ], + "program": { + "type": "Program", + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":14}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "TypeAlias", + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, + "id": { + "type": "Identifier", + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"A"}, + "name": "A" + }, + "typeParameters": null, + "right": { + "type": "NumberTypeAnnotation", + "start":9,"end":15,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":15}} + } + }, + { + "type": "InterfaceDeclaration", + "start":17,"end":31,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":14}}, + "id": { + "type": "Identifier", + "start":27,"end":28,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":11},"identifierName":"A"}, + "name": "A" + }, + "typeParameters": null, + "extends": [], + "implements": [], + "mixins": [], + "body": { + "type": "ObjectTypeAnnotation", + "start":29,"end":31,"loc":{"start":{"line":2,"column":12},"end":{"line":2,"column":14}}, + "callProperties": [], + "properties": [], + "indexers": [], + "internalSlots": [], + "exact": false + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-type-let/options.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-type-let/options.json deleted file mode 100644 index b6ff3a4b0987..000000000000 --- a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-type-let/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'A' has already been declared (2:4)" -} diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-type-let/output.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-type-let/output.json new file mode 100644 index 000000000000..33397a54dd82 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-type-let/output.json @@ -0,0 +1,61 @@ +{ + "type": "File", + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":10}}, + "errors": [ + "SyntaxError: Identifier 'A' has already been declared (2:4)" + ], + "program": { + "type": "Program", + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":10}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "TypeAlias", + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "id": { + "type": "Identifier", + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"A"}, + "name": "A" + }, + "typeParameters": null, + "right": { + "type": "ObjectTypeAnnotation", + "start":9,"end":11,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":11}}, + "callProperties": [], + "properties": [], + "indexers": [], + "internalSlots": [], + "exact": false, + "inexact": false + } + }, + { + "type": "VariableDeclaration", + "start":13,"end":23,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":10}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":17,"end":22,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":9}}, + "id": { + "type": "Identifier", + "start":17,"end":18,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":5},"identifierName":"A"}, + "name": "A" + }, + "init": { + "type": "NumericLiteral", + "start":21,"end":22,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":9}}, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + ], + "kind": "let" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-type-opaque-type/options.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-type-opaque-type/options.json deleted file mode 100644 index 81dc2c90799f..000000000000 --- a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-type-opaque-type/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'A' has already been declared (2:12)" -} diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-type-opaque-type/output.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-type-opaque-type/output.json new file mode 100644 index 000000000000..13e009e688b1 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-type-opaque-type/output.json @@ -0,0 +1,57 @@ +{ + "type": "File", + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":19}}, + "errors": [ + "SyntaxError: Identifier 'A' has already been declared (2:12)" + ], + "program": { + "type": "Program", + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":19}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "TypeAlias", + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "id": { + "type": "Identifier", + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"A"}, + "name": "A" + }, + "typeParameters": null, + "right": { + "type": "ObjectTypeAnnotation", + "start":9,"end":11,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":11}}, + "callProperties": [], + "properties": [], + "indexers": [], + "internalSlots": [], + "exact": false, + "inexact": false + } + }, + { + "type": "OpaqueType", + "start":13,"end":32,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":19}}, + "id": { + "type": "Identifier", + "start":25,"end":26,"loc":{"start":{"line":2,"column":12},"end":{"line":2,"column":13},"identifierName":"A"}, + "name": "A" + }, + "typeParameters": null, + "supertype": null, + "impltype": { + "type": "ObjectTypeAnnotation", + "start":29,"end":31,"loc":{"start":{"line":2,"column":16},"end":{"line":2,"column":18}}, + "callProperties": [], + "properties": [], + "indexers": [], + "internalSlots": [], + "exact": false, + "inexact": false + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-type-type/options.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-type-type/options.json deleted file mode 100644 index 1eed93f49a0e..000000000000 --- a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-type-type/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'A' has already been declared (2:5)" -} diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-type-type/output.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-type-type/output.json new file mode 100644 index 000000000000..b6c3a2ed34c1 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-type-type/output.json @@ -0,0 +1,56 @@ +{ + "type": "File", + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":12}}, + "errors": [ + "SyntaxError: Identifier 'A' has already been declared (2:5)" + ], + "program": { + "type": "Program", + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":12}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "TypeAlias", + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "id": { + "type": "Identifier", + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"A"}, + "name": "A" + }, + "typeParameters": null, + "right": { + "type": "ObjectTypeAnnotation", + "start":9,"end":11,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":11}}, + "callProperties": [], + "properties": [], + "indexers": [], + "internalSlots": [], + "exact": false, + "inexact": false + } + }, + { + "type": "TypeAlias", + "start":13,"end":25,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":12}}, + "id": { + "type": "Identifier", + "start":18,"end":19,"loc":{"start":{"line":2,"column":5},"end":{"line":2,"column":6},"identifierName":"A"}, + "name": "A" + }, + "typeParameters": null, + "right": { + "type": "ObjectTypeAnnotation", + "start":22,"end":24,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":11}}, + "callProperties": [], + "properties": [], + "indexers": [], + "internalSlots": [], + "exact": false, + "inexact": false + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-type-var/options.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-type-var/options.json deleted file mode 100644 index b6ff3a4b0987..000000000000 --- a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-type-var/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'A' has already been declared (2:4)" -} diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-type-var/output.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-type-var/output.json new file mode 100644 index 000000000000..31719046a5b5 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-type-var/output.json @@ -0,0 +1,61 @@ +{ + "type": "File", + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":10}}, + "errors": [ + "SyntaxError: Identifier 'A' has already been declared (2:4)" + ], + "program": { + "type": "Program", + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":10}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "TypeAlias", + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "id": { + "type": "Identifier", + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"A"}, + "name": "A" + }, + "typeParameters": null, + "right": { + "type": "ObjectTypeAnnotation", + "start":9,"end":11,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":11}}, + "callProperties": [], + "properties": [], + "indexers": [], + "internalSlots": [], + "exact": false, + "inexact": false + } + }, + { + "type": "VariableDeclaration", + "start":13,"end":23,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":10}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":17,"end":22,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":9}}, + "id": { + "type": "Identifier", + "start":17,"end":18,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":5},"identifierName":"A"}, + "name": "A" + }, + "init": { + "type": "NumericLiteral", + "start":21,"end":22,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":9}}, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + ], + "kind": "var" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-var-declare-interface/input.js b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-var-declare-interface/input.js similarity index 100% rename from packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-var-declare-interface/input.js rename to packages/babel-parser/test/fixtures/flow/scope/dupl-decl-var-declare-interface/input.js diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-var-declare-interface/options.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-var-declare-interface/options.json new file mode 100644 index 000000000000..d822c40fbba2 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-var-declare-interface/options.json @@ -0,0 +1,4 @@ +{ + "sourceType": "module", + "plugins": ["jsx", "flow"] +} diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-var-declare-interface/output.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-var-declare-interface/output.json new file mode 100644 index 000000000000..0dbab3e68b36 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-var-declare-interface/output.json @@ -0,0 +1,63 @@ +{ + "type": "File", + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":22}}, + "errors": [ + "SyntaxError: Identifier 'A' has already been declared (2:18)" + ], + "program": { + "type": "Program", + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":22}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":4,"end":9,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":9}}, + "id": { + "type": "Identifier", + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"A"}, + "name": "A" + }, + "init": { + "type": "NumericLiteral", + "start":8,"end":9,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":9}}, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + ], + "kind": "var" + }, + { + "type": "DeclareInterface", + "start":11,"end":33,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":22}}, + "id": { + "type": "Identifier", + "start":29,"end":30,"loc":{"start":{"line":2,"column":18},"end":{"line":2,"column":19},"identifierName":"A"}, + "name": "A" + }, + "typeParameters": null, + "extends": [], + "implements": [], + "mixins": [], + "body": { + "type": "ObjectTypeAnnotation", + "start":31,"end":33,"loc":{"start":{"line":2,"column":20},"end":{"line":2,"column":22}}, + "callProperties": [], + "properties": [], + "indexers": [], + "internalSlots": [], + "exact": false + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-var-interface/input.js b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-var-interface/input.js similarity index 100% rename from packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-var-interface/input.js rename to packages/babel-parser/test/fixtures/flow/scope/dupl-decl-var-interface/input.js diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-var-interface/options.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-var-interface/options.json new file mode 100644 index 000000000000..d822c40fbba2 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-var-interface/options.json @@ -0,0 +1,4 @@ +{ + "sourceType": "module", + "plugins": ["jsx", "flow"] +} diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-var-interface/output.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-var-interface/output.json new file mode 100644 index 000000000000..80e7ca6b69f3 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-var-interface/output.json @@ -0,0 +1,63 @@ +{ + "type": "File", + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":14}}, + "errors": [ + "SyntaxError: Identifier 'A' has already been declared (2:10)" + ], + "program": { + "type": "Program", + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":14}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":4,"end":9,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":9}}, + "id": { + "type": "Identifier", + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"A"}, + "name": "A" + }, + "init": { + "type": "NumericLiteral", + "start":8,"end":9,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":9}}, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + ], + "kind": "var" + }, + { + "type": "InterfaceDeclaration", + "start":11,"end":25,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":14}}, + "id": { + "type": "Identifier", + "start":21,"end":22,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":11},"identifierName":"A"}, + "name": "A" + }, + "typeParameters": null, + "extends": [], + "implements": [], + "mixins": [], + "body": { + "type": "ObjectTypeAnnotation", + "start":23,"end":25,"loc":{"start":{"line":2,"column":12},"end":{"line":2,"column":14}}, + "callProperties": [], + "properties": [], + "indexers": [], + "internalSlots": [], + "exact": false + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-var-opaque-type/options.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-var-opaque-type/options.json deleted file mode 100644 index 81dc2c90799f..000000000000 --- a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-var-opaque-type/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'A' has already been declared (2:12)" -} diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-var-opaque-type/output.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-var-opaque-type/output.json new file mode 100644 index 000000000000..22d33f342732 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-var-opaque-type/output.json @@ -0,0 +1,62 @@ +{ + "type": "File", + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":19}}, + "errors": [ + "SyntaxError: Identifier 'A' has already been declared (2:12)" + ], + "program": { + "type": "Program", + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":19}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":4,"end":9,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":9}}, + "id": { + "type": "Identifier", + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"A"}, + "name": "A" + }, + "init": { + "type": "NumericLiteral", + "start":8,"end":9,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":9}}, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + ], + "kind": "var" + }, + { + "type": "OpaqueType", + "start":11,"end":30,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":19}}, + "id": { + "type": "Identifier", + "start":23,"end":24,"loc":{"start":{"line":2,"column":12},"end":{"line":2,"column":13},"identifierName":"A"}, + "name": "A" + }, + "typeParameters": null, + "supertype": null, + "impltype": { + "type": "ObjectTypeAnnotation", + "start":27,"end":29,"loc":{"start":{"line":2,"column":16},"end":{"line":2,"column":18}}, + "callProperties": [], + "properties": [], + "indexers": [], + "internalSlots": [], + "exact": false, + "inexact": false + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-var-type/options.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-var-type/options.json deleted file mode 100644 index 1eed93f49a0e..000000000000 --- a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-var-type/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'A' has already been declared (2:5)" -} diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-var-type/output.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-var-type/output.json new file mode 100644 index 000000000000..749d355f7d5f --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-var-type/output.json @@ -0,0 +1,61 @@ +{ + "type": "File", + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":12}}, + "errors": [ + "SyntaxError: Identifier 'A' has already been declared (2:5)" + ], + "program": { + "type": "Program", + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":12}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":4,"end":9,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":9}}, + "id": { + "type": "Identifier", + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"A"}, + "name": "A" + }, + "init": { + "type": "NumericLiteral", + "start":8,"end":9,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":9}}, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + ], + "kind": "var" + }, + { + "type": "TypeAlias", + "start":11,"end":23,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":12}}, + "id": { + "type": "Identifier", + "start":16,"end":17,"loc":{"start":{"line":2,"column":5},"end":{"line":2,"column":6},"identifierName":"A"}, + "name": "A" + }, + "typeParameters": null, + "right": { + "type": "ObjectTypeAnnotation", + "start":20,"end":22,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":11}}, + "callProperties": [], + "properties": [], + "indexers": [], + "internalSlots": [], + "exact": false, + "inexact": false + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/sourcetype-script/export-named/output.json b/packages/babel-parser/test/fixtures/flow/sourcetype-script/export-named/output.json index 70d30bbe8a92..3a91cdcabb5a 100644 --- a/packages/babel-parser/test/fixtures/flow/sourcetype-script/export-named/output.json +++ b/packages/babel-parser/test/fixtures/flow/sourcetype-script/export-named/output.json @@ -1,164 +1,52 @@ { "type": "File", - "start": 0, - "end": 59, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 33 - } - }, + "start":0,"end":59,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":33}}, "program": { "type": "Program", - "start": 0, - "end": 59, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 33 - } - }, + "start":0,"end":59,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":33}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExportNamedDeclaration", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, "specifiers": [], "source": null, "exportKind": "type", "declaration": { "type": "TypeAlias", - "start": 7, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":7,"end":25,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":25}}, "id": { "type": "Identifier", - "start": 12, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 15 - }, - "identifierName": "Foo" - }, + "start":12,"end":15,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":15},"identifierName":"Foo"}, "name": "Foo" }, "typeParameters": null, "right": { "type": "NumberTypeAnnotation", - "start": 18, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 24 - } - } + "start":18,"end":24,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":24}} } } }, { "type": "ExportNamedDeclaration", - "start": 26, - "end": 59, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 33 - } - }, + "start":26,"end":59,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":33}}, "specifiers": [], "source": null, "exportKind": "type", "declaration": { "type": "OpaqueType", - "start": 33, - "end": 59, - "loc": { - "start": { - "line": 2, - "column": 7 - }, - "end": { - "line": 2, - "column": 33 - } - }, + "start":33,"end":59,"loc":{"start":{"line":2,"column":7},"end":{"line":2,"column":33}}, "id": { "type": "Identifier", - "start": 45, - "end": 49, - "loc": { - "start": { - "line": 2, - "column": 19 - }, - "end": { - "line": 2, - "column": 23 - }, - "identifierName": "Foo2" - }, + "start":45,"end":49,"loc":{"start":{"line":2,"column":19},"end":{"line":2,"column":23},"identifierName":"Foo2"}, "name": "Foo2" }, "typeParameters": null, "supertype": null, "impltype": { "type": "NumberTypeAnnotation", - "start": 52, - "end": 58, - "loc": { - "start": { - "line": 2, - "column": 26 - }, - "end": { - "line": 2, - "column": 32 - } - } + "start":52,"end":58,"loc":{"start":{"line":2,"column":26},"end":{"line":2,"column":32}} } } } diff --git a/packages/babel-parser/test/fixtures/flow/sourcetype-script/export-star/output.json b/packages/babel-parser/test/fixtures/flow/sourcetype-script/export-star/output.json index 13fe2cfaec40..9f02c833e573 100644 --- a/packages/babel-parser/test/fixtures/flow/sourcetype-script/export-star/output.json +++ b/packages/babel-parser/test/fixtures/flow/sourcetype-script/export-star/output.json @@ -1,63 +1,19 @@ { "type": "File", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, "program": { "type": "Program", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExportAllDeclaration", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, "exportKind": "type", "source": { "type": "StringLiteral", - "start": 19, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":19,"end":24,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":24}}, "extra": { "rawValue": "foo", "raw": "\"foo\"" diff --git a/packages/babel-parser/test/fixtures/flow/sourcetype-script/import/output.json b/packages/babel-parser/test/fixtures/flow/sourcetype-script/import/output.json index d49e3470fffd..54d736943f7f 100644 --- a/packages/babel-parser/test/fixtures/flow/sourcetype-script/import/output.json +++ b/packages/babel-parser/test/fixtures/flow/sourcetype-script/import/output.json @@ -1,96 +1,28 @@ { "type": "File", - "start": 0, - "end": 56, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 27 - } - }, + "start":0,"end":56,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":27}}, "program": { "type": "Program", - "start": 0, - "end": 56, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 27 - } - }, + "start":0,"end":56,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":27}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ImportDeclaration", - "start": 0, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, "specifiers": [ { "type": "ImportSpecifier", - "start": 14, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":14,"end":17,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":17}}, "imported": { "type": "Identifier", - "start": 14, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 17 - }, - "identifierName": "Foo" - }, + "start":14,"end":17,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":17},"identifierName":"Foo"}, "name": "Foo" }, "importKind": null, "local": { "type": "Identifier", - "start": 14, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 17 - }, - "identifierName": "Foo" - }, + "start":14,"end":17,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":17},"identifierName":"Foo"}, "name": "Foo" } } @@ -98,18 +30,7 @@ "importKind": "type", "source": { "type": "StringLiteral", - "start": 25, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":25,"end":27,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":27}}, "extra": { "rawValue": "", "raw": "\"\"" @@ -119,48 +40,14 @@ }, { "type": "ImportDeclaration", - "start": 29, - "end": 56, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 27 - } - }, + "start":29,"end":56,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":27}}, "specifiers": [ { "type": "ImportDefaultSpecifier", - "start": 43, - "end": 47, - "loc": { - "start": { - "line": 2, - "column": 14 - }, - "end": { - "line": 2, - "column": 18 - } - }, + "start":43,"end":47,"loc":{"start":{"line":2,"column":14},"end":{"line":2,"column":18}}, "local": { "type": "Identifier", - "start": 43, - "end": 47, - "loc": { - "start": { - "line": 2, - "column": 14 - }, - "end": { - "line": 2, - "column": 18 - }, - "identifierName": "Foo2" - }, + "start":43,"end":47,"loc":{"start":{"line":2,"column":14},"end":{"line":2,"column":18},"identifierName":"Foo2"}, "name": "Foo2" } } @@ -168,18 +55,7 @@ "importKind": "typeof", "source": { "type": "StringLiteral", - "start": 53, - "end": 55, - "loc": { - "start": { - "line": 2, - "column": 24 - }, - "end": { - "line": 2, - "column": 26 - } - }, + "start":53,"end":55,"loc":{"start":{"line":2,"column":24},"end":{"line":2,"column":26}}, "extra": { "rawValue": "", "raw": "\"\"" diff --git a/packages/babel-parser/test/fixtures/flow/trailing-function-commas-type/1/output.json b/packages/babel-parser/test/fixtures/flow/trailing-function-commas-type/1/output.json index 02498cad1b22..2ab57d3cafb9 100644 --- a/packages/babel-parser/test/fixtures/flow/trailing-function-commas-type/1/output.json +++ b/packages/babel-parser/test/fixtures/flow/trailing-function-commas-type/1/output.json @@ -1,107 +1,29 @@ { "type": "File", - "start": 0, - "end": 43, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 43 - } - }, + "start":0,"end":43,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":43}}, "program": { "type": "Program", - "start": 0, - "end": 43, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 43 - } - }, + "start":0,"end":43,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":43}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 43, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 43 - } - }, + "start":0,"end":43,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":43}}, "expression": { "type": "ArrowFunctionExpression", - "start": 0, - "end": 42, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 42 - } - }, + "start":0,"end":42,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":42}}, "predicate": null, "returnType": { "type": "TypeAnnotation", - "start": 21, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":21,"end":33,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":33}}, "typeAnnotation": { "type": "GenericTypeAnnotation", - "start": 23, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":23,"end":33,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":33}}, "typeParameters": null, "id": { "type": "Identifier", - "start": 23, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 33 - }, - "identifierName": "ReturnType" - }, + "start":23,"end":33,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":33},"identifierName":"ReturnType"}, "name": "ReturnType" } } @@ -112,64 +34,18 @@ "params": [ { "type": "Identifier", - "start": 2, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 17 - }, - "identifierName": "props" - }, + "start":2,"end":17,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":17},"identifierName":"props"}, "name": "props", "typeAnnotation": { "type": "TypeAnnotation", - "start": 7, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":7,"end":17,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":17}}, "typeAnnotation": { "type": "GenericTypeAnnotation", - "start": 9, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":9,"end":17,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":17}}, "typeParameters": null, "id": { "type": "Identifier", - "start": 9, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 17 - }, - "identifierName": "SomeType" - }, + "start":9,"end":17,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":17},"identifierName":"SomeType"}, "name": "SomeType" } } @@ -178,18 +54,7 @@ ], "body": { "type": "NumericLiteral", - "start": 39, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 39 - }, - "end": { - "line": 1, - "column": 40 - } - }, + "start":39,"end":40,"loc":{"start":{"line":1,"column":39},"end":{"line":1,"column":40}}, "extra": { "rawValue": 3, "raw": "3", diff --git a/packages/babel-parser/test/fixtures/flow/tuples/1/output.json b/packages/babel-parser/test/fixtures/flow/tuples/1/output.json index 29c44707cd51..b5884b344691 100644 --- a/packages/babel-parser/test/fixtures/flow/tuples/1/output.json +++ b/packages/babel-parser/test/fixtures/flow/tuples/1/output.json @@ -1,125 +1,36 @@ { "type": "File", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "program": { "type": "Program", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":4,"end":15,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":15}}, "id": { "type": "Identifier", - "start": 4, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 10 - }, - "identifierName": "a" - }, + "start":4,"end":10,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":10},"identifierName":"a"}, "name": "a", "typeAnnotation": { "type": "TypeAnnotation", - "start": 6, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":6,"end":10,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":10}}, "typeAnnotation": { "type": "TupleTypeAnnotation", - "start": 8, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":8,"end":10,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":10}}, "types": [] } } }, "init": { "type": "ArrayExpression", - "start": 13, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":13,"end":15,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":15}}, "elements": [] } } diff --git a/packages/babel-parser/test/fixtures/flow/tuples/2/output.json b/packages/babel-parser/test/fixtures/flow/tuples/2/output.json index 599c27a96449..6b85017fd2bd 100644 --- a/packages/babel-parser/test/fixtures/flow/tuples/2/output.json +++ b/packages/babel-parser/test/fixtures/flow/tuples/2/output.json @@ -1,167 +1,44 @@ { "type": "File", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, "program": { "type": "Program", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":4,"end":24,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":24}}, "id": { "type": "Identifier", - "start": 4, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 16 - }, - "identifierName": "a" - }, + "start":4,"end":16,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":16},"identifierName":"a"}, "name": "a", "typeAnnotation": { "type": "TypeAnnotation", - "start": 6, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":6,"end":16,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":16}}, "typeAnnotation": { "type": "TupleTypeAnnotation", - "start": 8, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":8,"end":16,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":16}}, "types": [ { "type": "GenericTypeAnnotation", - "start": 9, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":9,"end":15,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":15}}, "typeParameters": { "type": "TypeParameterInstantiation", - "start": 12, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":12,"end":15,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":15}}, "params": [ { "type": "GenericTypeAnnotation", - "start": 13, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":13,"end":14,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":14}}, "typeParameters": null, "id": { "type": "Identifier", - "start": 13, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - }, - "identifierName": "T" - }, + "start":13,"end":14,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":14},"identifierName":"T"}, "name": "T" } } @@ -169,19 +46,7 @@ }, "id": { "type": "Identifier", - "start": 9, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "Foo" - }, + "start":9,"end":12,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":12},"identifierName":"Foo"}, "name": "Foo" } } @@ -191,34 +56,11 @@ }, "init": { "type": "ArrayExpression", - "start": 19, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":19,"end":24,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":24}}, "elements": [ { "type": "Identifier", - "start": 20, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 23 - }, - "identifierName": "foo" - }, + "start":20,"end":23,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":23},"identifierName":"foo"}, "name": "foo" } ] diff --git a/packages/babel-parser/test/fixtures/flow/tuples/3/output.json b/packages/babel-parser/test/fixtures/flow/tuples/3/output.json index 2c61f6b164a0..b7690d15c28c 100644 --- a/packages/babel-parser/test/fixtures/flow/tuples/3/output.json +++ b/packages/babel-parser/test/fixtures/flow/tuples/3/output.json @@ -1,122 +1,33 @@ { "type": "File", - "start": 0, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, "program": { "type": "Program", - "start": 0, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":4,"end":26,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":26}}, "id": { "type": "Identifier", - "start": 4, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 17 - }, - "identifierName": "a" - }, + "start":4,"end":17,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":17},"identifierName":"a"}, "name": "a", "typeAnnotation": { "type": "TypeAnnotation", - "start": 6, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":6,"end":17,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":17}}, "typeAnnotation": { "type": "TupleTypeAnnotation", - "start": 8, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":8,"end":17,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":17}}, "types": [ { "type": "NumberTypeAnnotation", - "start": 9, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 15 - } - } + "start":9,"end":15,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":15}} } ] } @@ -124,33 +35,14 @@ }, "init": { "type": "ArrayExpression", - "start": 20, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 26 - } + "start":20,"end":26,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":26}}, + "extra": { + "trailingComma": 24 }, "elements": [ { "type": "NumericLiteral", - "start": 21, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":21,"end":24,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":24}}, "extra": { "rawValue": 123, "raw": "123" diff --git a/packages/babel-parser/test/fixtures/flow/tuples/4/output.json b/packages/babel-parser/test/fixtures/flow/tuples/4/output.json index fd42e0453f20..63abf8d6cf84 100644 --- a/packages/babel-parser/test/fixtures/flow/tuples/4/output.json +++ b/packages/babel-parser/test/fixtures/flow/tuples/4/output.json @@ -1,137 +1,37 @@ { "type": "File", - "start": 0, - "end": 41, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 41 - } - }, + "start":0,"end":41,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":41}}, "program": { "type": "Program", - "start": 0, - "end": 41, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 41 - } - }, + "start":0,"end":41,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":41}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 41, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 41 - } - }, + "start":0,"end":41,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":41}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 40 - } - }, + "start":4,"end":40,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":40}}, "id": { "type": "Identifier", - "start": 4, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 24 - }, - "identifierName": "a" - }, + "start":4,"end":24,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":24},"identifierName":"a"}, "name": "a", "typeAnnotation": { "type": "TypeAnnotation", - "start": 6, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":6,"end":24,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":24}}, "typeAnnotation": { "type": "TupleTypeAnnotation", - "start": 8, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":8,"end":24,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":24}}, "types": [ { "type": "NumberTypeAnnotation", - "start": 9, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 15 - } - } + "start":9,"end":15,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":15}} }, { "type": "StringTypeAnnotation", - "start": 17, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 23 - } - } + "start":17,"end":23,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":23}} } ] } @@ -139,33 +39,11 @@ }, "init": { "type": "ArrayExpression", - "start": 27, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 40 - } - }, + "start":27,"end":40,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":40}}, "elements": [ { "type": "NumericLiteral", - "start": 28, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":28,"end":31,"loc":{"start":{"line":1,"column":28},"end":{"line":1,"column":31}}, "extra": { "rawValue": 123, "raw": "123" @@ -174,18 +52,7 @@ }, { "type": "StringLiteral", - "start": 33, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 33 - }, - "end": { - "line": 1, - "column": 39 - } - }, + "start":33,"end":39,"loc":{"start":{"line":1,"column":33},"end":{"line":1,"column":39}}, "extra": { "rawValue": "duck", "raw": "\"duck\"" diff --git a/packages/babel-parser/test/fixtures/flow/type-alias/1/output.json b/packages/babel-parser/test/fixtures/flow/type-alias/1/output.json index e7e01aff7792..f12a90e7d046 100644 --- a/packages/babel-parser/test/fixtures/flow/type-alias/1/output.json +++ b/packages/babel-parser/test/fixtures/flow/type-alias/1/output.json @@ -1,80 +1,24 @@ { "type": "File", - "start": 0, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, "program": { "type": "Program", - "start": 0, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "TypeAlias", - "start": 0, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, "id": { "type": "Identifier", - "start": 5, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "FBID" - }, + "start":5,"end":9,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":9},"identifierName":"FBID"}, "name": "FBID" }, "typeParameters": null, "right": { "type": "NumberTypeAnnotation", - "start": 12, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 18 - } - } + "start":12,"end":18,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":18}} } } ], diff --git a/packages/babel-parser/test/fixtures/flow/type-alias/2/output.json b/packages/babel-parser/test/fixtures/flow/type-alias/2/output.json index b7b8d201d021..6877b15e5f01 100644 --- a/packages/babel-parser/test/fixtures/flow/type-alias/2/output.json +++ b/packages/babel-parser/test/fixtures/flow/type-alias/2/output.json @@ -1,94 +1,27 @@ { "type": "File", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, "program": { "type": "Program", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "TypeAlias", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, "id": { "type": "Identifier", - "start": 5, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 8 - }, - "identifierName": "Foo" - }, + "start":5,"end":8,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":8},"identifierName":"Foo"}, "name": "Foo" }, "typeParameters": { "type": "TypeParameterDeclaration", - "start": 8, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":8,"end":11,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":11}}, "params": [ { "type": "TypeParameter", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10}}, "name": "T", "variance": null } @@ -96,63 +29,18 @@ }, "right": { "type": "GenericTypeAnnotation", - "start": 14, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":14,"end":20,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":20}}, "typeParameters": { "type": "TypeParameterInstantiation", - "start": 17, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":17,"end":20,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":20}}, "params": [ { "type": "GenericTypeAnnotation", - "start": 18, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":18,"end":19,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":19}}, "typeParameters": null, "id": { "type": "Identifier", - "start": 18, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - }, - "identifierName": "T" - }, + "start":18,"end":19,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":19},"identifierName":"T"}, "name": "T" } } @@ -160,19 +48,7 @@ }, "id": { "type": "Identifier", - "start": 14, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 17 - }, - "identifierName": "Bar" - }, + "start":14,"end":17,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":17},"identifierName":"Bar"}, "name": "Bar" } } diff --git a/packages/babel-parser/test/fixtures/flow/type-alias/3/output.json b/packages/babel-parser/test/fixtures/flow/type-alias/3/output.json index 1c1fe95023aa..869c689c865a 100644 --- a/packages/babel-parser/test/fixtures/flow/type-alias/3/output.json +++ b/packages/babel-parser/test/fixtures/flow/type-alias/3/output.json @@ -1,97 +1,30 @@ { "type": "File", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, "program": { "type": "Program", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExportNamedDeclaration", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, "specifiers": [], "source": null, "exportKind": "type", "declaration": { "type": "TypeAlias", - "start": 7, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":7,"end":25,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":25}}, "id": { "type": "Identifier", - "start": 12, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 15 - }, - "identifierName": "Foo" - }, + "start":12,"end":15,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":15},"identifierName":"Foo"}, "name": "Foo" }, "typeParameters": null, "right": { "type": "NumberTypeAnnotation", - "start": 18, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 24 - } - } + "start":18,"end":24,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":24}} } } } diff --git a/packages/babel-parser/test/fixtures/flow/type-alias/4/output.json b/packages/babel-parser/test/fixtures/flow/type-alias/4/output.json index a1ff7e2786c1..8592d1737fed 100644 --- a/packages/babel-parser/test/fixtures/flow/type-alias/4/output.json +++ b/packages/babel-parser/test/fixtures/flow/type-alias/4/output.json @@ -1,126 +1,36 @@ { "type": "File", - "start": 0, - "end": 246, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 21, - "column": 2 - } - }, + "start":0,"end":246,"loc":{"start":{"line":1,"column":0},"end":{"line":21,"column":2}}, "program": { "type": "Program", - "start": 0, - "end": 246, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 21, - "column": 2 - } - }, + "start":0,"end":246,"loc":{"start":{"line":1,"column":0},"end":{"line":21,"column":2}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "TypeAlias", - "start": 0, - "end": 44, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":0,"end":44,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, "id": { "type": "Identifier", - "start": 5, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 10 - }, - "identifierName": "union" - }, + "start":5,"end":10,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":10},"identifierName":"union"}, "name": "union" }, "typeParameters": null, "right": { "type": "UnionTypeAnnotation", - "start": 14, - "end": 42, - "loc": { - "start": { - "line": 2, - "column": 1 - }, - "end": { - "line": 3, - "column": 14 - } - }, + "start":14,"end":42,"loc":{"start":{"line":2,"column":1},"end":{"line":3,"column":14}}, "types": [ { "type": "ObjectTypeAnnotation", - "start": 16, - "end": 27, - "loc": { - "start": { - "line": 2, - "column": 3 - }, - "end": { - "line": 2, - "column": 14 - } - }, + "start":16,"end":27,"loc":{"start":{"line":2,"column":3},"end":{"line":2,"column":14}}, "callProperties": [], "properties": [ { "type": "ObjectTypeProperty", - "start": 17, - "end": 26, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 13 - } - }, + "start":17,"end":26,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":13}}, "key": { "type": "Identifier", - "start": 17, - "end": 21, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 8 - }, - "identifierName": "type" - }, + "start":17,"end":21,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":8},"identifierName":"type"}, "name": "type" }, "static": false, @@ -129,18 +39,7 @@ "method": false, "value": { "type": "StringLiteralTypeAnnotation", - "start": 23, - "end": 26, - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 13 - } - }, + "start":23,"end":26,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":13}}, "extra": { "rawValue": "A", "raw": "\"A\"" @@ -158,49 +57,15 @@ }, { "type": "ObjectTypeAnnotation", - "start": 31, - "end": 42, - "loc": { - "start": { - "line": 3, - "column": 3 - }, - "end": { - "line": 3, - "column": 14 - } - }, + "start":31,"end":42,"loc":{"start":{"line":3,"column":3},"end":{"line":3,"column":14}}, "callProperties": [], "properties": [ { "type": "ObjectTypeProperty", - "start": 32, - "end": 41, - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 13 - } - }, + "start":32,"end":41,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":13}}, "key": { "type": "Identifier", - "start": 32, - "end": 36, - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 8 - }, - "identifierName": "type" - }, + "start":32,"end":36,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":8},"identifierName":"type"}, "name": "type" }, "static": false, @@ -209,18 +74,7 @@ "method": false, "value": { "type": "StringLiteralTypeAnnotation", - "start": 38, - "end": 41, - "loc": { - "start": { - "line": 3, - "column": 10 - }, - "end": { - "line": 3, - "column": 13 - } - }, + "start":38,"end":41,"loc":{"start":{"line":3,"column":10},"end":{"line":3,"column":13}}, "extra": { "rawValue": "B", "raw": "\"B\"" @@ -241,212 +95,66 @@ }, { "type": "TypeAlias", - "start": 46, - "end": 120, - "loc": { - "start": { - "line": 6, - "column": 0 - }, - "end": { - "line": 9, - "column": 1 - } - }, + "start":46,"end":120,"loc":{"start":{"line":6,"column":0},"end":{"line":9,"column":1}}, "id": { "type": "Identifier", - "start": 51, - "end": 60, - "loc": { - "start": { - "line": 6, - "column": 5 - }, - "end": { - "line": 6, - "column": 14 - }, - "identifierName": "overloads" - }, + "start":51,"end":60,"loc":{"start":{"line":6,"column":5},"end":{"line":6,"column":14},"identifierName":"overloads"}, "name": "overloads" }, "typeParameters": null, "right": { "type": "IntersectionTypeAnnotation", - "start": 65, - "end": 118, - "loc": { - "start": { - "line": 7, - "column": 2 - }, - "end": { - "line": 8, - "column": 27 - } - }, + "start":65,"end":118,"loc":{"start":{"line":7,"column":2},"end":{"line":8,"column":27}}, "types": [ { "type": "FunctionTypeAnnotation", - "start": 68, - "end": 89, - "loc": { - "start": { - "line": 7, - "column": 5 - }, - "end": { - "line": 7, - "column": 26 - } - }, + "start":68,"end":89,"loc":{"start":{"line":7,"column":5},"end":{"line":7,"column":26}}, "params": [ { "type": "FunctionTypeParam", - "start": 69, - "end": 78, - "loc": { - "start": { - "line": 7, - "column": 6 - }, - "end": { - "line": 7, - "column": 15 - } - }, + "start":69,"end":78,"loc":{"start":{"line":7,"column":6},"end":{"line":7,"column":15}}, "name": { "type": "Identifier", - "start": 69, - "end": 70, - "loc": { - "start": { - "line": 7, - "column": 6 - }, - "end": { - "line": 7, - "column": 7 - }, - "identifierName": "x" - }, + "start":69,"end":70,"loc":{"start":{"line":7,"column":6},"end":{"line":7,"column":7},"identifierName":"x"}, "name": "x" }, "optional": false, "typeAnnotation": { "type": "StringTypeAnnotation", - "start": 72, - "end": 78, - "loc": { - "start": { - "line": 7, - "column": 9 - }, - "end": { - "line": 7, - "column": 15 - } - } + "start":72,"end":78,"loc":{"start":{"line":7,"column":9},"end":{"line":7,"column":15}} } } ], "rest": null, "returnType": { "type": "NumberTypeAnnotation", - "start": 83, - "end": 89, - "loc": { - "start": { - "line": 7, - "column": 20 - }, - "end": { - "line": 7, - "column": 26 - } - } + "start":83,"end":89,"loc":{"start":{"line":7,"column":20},"end":{"line":7,"column":26}} }, "typeParameters": null }, { "type": "FunctionTypeAnnotation", - "start": 96, - "end": 117, - "loc": { - "start": { - "line": 8, - "column": 5 - }, - "end": { - "line": 8, - "column": 26 - } - }, + "start":96,"end":117,"loc":{"start":{"line":8,"column":5},"end":{"line":8,"column":26}}, "params": [ { "type": "FunctionTypeParam", - "start": 97, - "end": 106, - "loc": { - "start": { - "line": 8, - "column": 6 - }, - "end": { - "line": 8, - "column": 15 - } - }, + "start":97,"end":106,"loc":{"start":{"line":8,"column":6},"end":{"line":8,"column":15}}, "name": { "type": "Identifier", - "start": 97, - "end": 98, - "loc": { - "start": { - "line": 8, - "column": 6 - }, - "end": { - "line": 8, - "column": 7 - }, - "identifierName": "x" - }, + "start":97,"end":98,"loc":{"start":{"line":8,"column":6},"end":{"line":8,"column":7},"identifierName":"x"}, "name": "x" }, "optional": false, "typeAnnotation": { "type": "NumberTypeAnnotation", - "start": 100, - "end": 106, - "loc": { - "start": { - "line": 8, - "column": 9 - }, - "end": { - "line": 8, - "column": 15 - } - } + "start":100,"end":106,"loc":{"start":{"line":8,"column":9},"end":{"line":8,"column":15}} } } ], "rest": null, "returnType": { "type": "StringTypeAnnotation", - "start": 111, - "end": 117, - "loc": { - "start": { - "line": 8, - "column": 20 - }, - "end": { - "line": 8, - "column": 26 - } - } + "start":111,"end":117,"loc":{"start":{"line":8,"column":20},"end":{"line":8,"column":26}} }, "typeParameters": null } @@ -455,81 +163,24 @@ }, { "type": "TypeAlias", - "start": 122, - "end": 181, - "loc": { - "start": { - "line": 11, - "column": 0 - }, - "end": { - "line": 15, - "column": 2 - } - }, + "start":122,"end":181,"loc":{"start":{"line":11,"column":0},"end":{"line":15,"column":2}}, "id": { "type": "Identifier", - "start": 127, - "end": 133, - "loc": { - "start": { - "line": 11, - "column": 5 - }, - "end": { - "line": 11, - "column": 11 - }, - "identifierName": "union2" - }, + "start":127,"end":133,"loc":{"start":{"line":11,"column":5},"end":{"line":11,"column":11},"identifierName":"union2"}, "name": "union2" }, "typeParameters": null, "right": { "type": "ObjectTypeAnnotation", - "start": 136, - "end": 180, - "loc": { - "start": { - "line": 11, - "column": 14 - }, - "end": { - "line": 15, - "column": 1 - } - }, + "start":136,"end":180,"loc":{"start":{"line":11,"column":14},"end":{"line":15,"column":1}}, "callProperties": [], "properties": [ { "type": "ObjectTypeProperty", - "start": 140, - "end": 178, - "loc": { - "start": { - "line": 12, - "column": 2 - }, - "end": { - "line": 14, - "column": 17 - } - }, + "start":140,"end":178,"loc":{"start":{"line":12,"column":2},"end":{"line":14,"column":17}}, "key": { "type": "Identifier", - "start": 140, - "end": 141, - "loc": { - "start": { - "line": 12, - "column": 2 - }, - "end": { - "line": 12, - "column": 3 - }, - "identifierName": "x" - }, + "start":140,"end":141,"loc":{"start":{"line":12,"column":2},"end":{"line":12,"column":3},"identifierName":"x"}, "name": "x" }, "static": false, @@ -538,64 +189,19 @@ "method": false, "value": { "type": "UnionTypeAnnotation", - "start": 147, - "end": 178, - "loc": { - "start": { - "line": 13, - "column": 4 - }, - "end": { - "line": 14, - "column": 17 - } - }, + "start":147,"end":178,"loc":{"start":{"line":13,"column":4},"end":{"line":14,"column":17}}, "types": [ { "type": "ObjectTypeAnnotation", - "start": 149, - "end": 160, - "loc": { - "start": { - "line": 13, - "column": 6 - }, - "end": { - "line": 13, - "column": 17 - } - }, + "start":149,"end":160,"loc":{"start":{"line":13,"column":6},"end":{"line":13,"column":17}}, "callProperties": [], "properties": [ { "type": "ObjectTypeProperty", - "start": 150, - "end": 159, - "loc": { - "start": { - "line": 13, - "column": 7 - }, - "end": { - "line": 13, - "column": 16 - } - }, + "start":150,"end":159,"loc":{"start":{"line":13,"column":7},"end":{"line":13,"column":16}}, "key": { "type": "Identifier", - "start": 150, - "end": 154, - "loc": { - "start": { - "line": 13, - "column": 7 - }, - "end": { - "line": 13, - "column": 11 - }, - "identifierName": "type" - }, + "start":150,"end":154,"loc":{"start":{"line":13,"column":7},"end":{"line":13,"column":11},"identifierName":"type"}, "name": "type" }, "static": false, @@ -604,18 +210,7 @@ "method": false, "value": { "type": "StringLiteralTypeAnnotation", - "start": 156, - "end": 159, - "loc": { - "start": { - "line": 13, - "column": 13 - }, - "end": { - "line": 13, - "column": 16 - } - }, + "start":156,"end":159,"loc":{"start":{"line":13,"column":13},"end":{"line":13,"column":16}}, "extra": { "rawValue": "A", "raw": "\"A\"" @@ -633,49 +228,15 @@ }, { "type": "ObjectTypeAnnotation", - "start": 167, - "end": 178, - "loc": { - "start": { - "line": 14, - "column": 6 - }, - "end": { - "line": 14, - "column": 17 - } - }, + "start":167,"end":178,"loc":{"start":{"line":14,"column":6},"end":{"line":14,"column":17}}, "callProperties": [], "properties": [ { "type": "ObjectTypeProperty", - "start": 168, - "end": 177, - "loc": { - "start": { - "line": 14, - "column": 7 - }, - "end": { - "line": 14, - "column": 16 - } - }, + "start":168,"end":177,"loc":{"start":{"line":14,"column":7},"end":{"line":14,"column":16}}, "key": { "type": "Identifier", - "start": 168, - "end": 172, - "loc": { - "start": { - "line": 14, - "column": 7 - }, - "end": { - "line": 14, - "column": 11 - }, - "identifierName": "type" - }, + "start":168,"end":172,"loc":{"start":{"line":14,"column":7},"end":{"line":14,"column":11},"identifierName":"type"}, "name": "type" }, "static": false, @@ -684,18 +245,7 @@ "method": false, "value": { "type": "StringLiteralTypeAnnotation", - "start": 174, - "end": 177, - "loc": { - "start": { - "line": 14, - "column": 13 - }, - "end": { - "line": 14, - "column": 16 - } - }, + "start":174,"end":177,"loc":{"start":{"line":14,"column":13},"end":{"line":14,"column":16}}, "extra": { "rawValue": "B", "raw": "\"B\"" @@ -725,81 +275,24 @@ }, { "type": "TypeAlias", - "start": 183, - "end": 246, - "loc": { - "start": { - "line": 17, - "column": 0 - }, - "end": { - "line": 21, - "column": 2 - } - }, + "start":183,"end":246,"loc":{"start":{"line":17,"column":0},"end":{"line":21,"column":2}}, "id": { "type": "Identifier", - "start": 188, - "end": 198, - "loc": { - "start": { - "line": 17, - "column": 5 - }, - "end": { - "line": 17, - "column": 15 - }, - "identifierName": "overloads2" - }, + "start":188,"end":198,"loc":{"start":{"line":17,"column":5},"end":{"line":17,"column":15},"identifierName":"overloads2"}, "name": "overloads2" }, "typeParameters": null, "right": { "type": "ObjectTypeAnnotation", - "start": 201, - "end": 245, - "loc": { - "start": { - "line": 17, - "column": 18 - }, - "end": { - "line": 21, - "column": 1 - } - }, + "start":201,"end":245,"loc":{"start":{"line":17,"column":18},"end":{"line":21,"column":1}}, "callProperties": [], "properties": [ { "type": "ObjectTypeProperty", - "start": 205, - "end": 243, - "loc": { - "start": { - "line": 18, - "column": 2 - }, - "end": { - "line": 20, - "column": 17 - } - }, + "start":205,"end":243,"loc":{"start":{"line":18,"column":2},"end":{"line":20,"column":17}}, "key": { "type": "Identifier", - "start": 205, - "end": 206, - "loc": { - "start": { - "line": 18, - "column": 2 - }, - "end": { - "line": 18, - "column": 3 - }, - "identifierName": "x" - }, + "start":205,"end":206,"loc":{"start":{"line":18,"column":2},"end":{"line":18,"column":3},"identifierName":"x"}, "name": "x" }, "static": false, @@ -808,64 +301,19 @@ "method": false, "value": { "type": "IntersectionTypeAnnotation", - "start": 212, - "end": 243, - "loc": { - "start": { - "line": 19, - "column": 4 - }, - "end": { - "line": 20, - "column": 17 - } - }, + "start":212,"end":243,"loc":{"start":{"line":19,"column":4},"end":{"line":20,"column":17}}, "types": [ { "type": "ObjectTypeAnnotation", - "start": 214, - "end": 225, - "loc": { - "start": { - "line": 19, - "column": 6 - }, - "end": { - "line": 19, - "column": 17 - } - }, + "start":214,"end":225,"loc":{"start":{"line":19,"column":6},"end":{"line":19,"column":17}}, "callProperties": [], "properties": [ { "type": "ObjectTypeProperty", - "start": 215, - "end": 224, - "loc": { - "start": { - "line": 19, - "column": 7 - }, - "end": { - "line": 19, - "column": 16 - } - }, + "start":215,"end":224,"loc":{"start":{"line":19,"column":7},"end":{"line":19,"column":16}}, "key": { "type": "Identifier", - "start": 215, - "end": 219, - "loc": { - "start": { - "line": 19, - "column": 7 - }, - "end": { - "line": 19, - "column": 11 - }, - "identifierName": "type" - }, + "start":215,"end":219,"loc":{"start":{"line":19,"column":7},"end":{"line":19,"column":11},"identifierName":"type"}, "name": "type" }, "static": false, @@ -874,18 +322,7 @@ "method": false, "value": { "type": "StringLiteralTypeAnnotation", - "start": 221, - "end": 224, - "loc": { - "start": { - "line": 19, - "column": 13 - }, - "end": { - "line": 19, - "column": 16 - } - }, + "start":221,"end":224,"loc":{"start":{"line":19,"column":13},"end":{"line":19,"column":16}}, "extra": { "rawValue": "A", "raw": "\"A\"" @@ -903,49 +340,15 @@ }, { "type": "ObjectTypeAnnotation", - "start": 232, - "end": 243, - "loc": { - "start": { - "line": 20, - "column": 6 - }, - "end": { - "line": 20, - "column": 17 - } - }, + "start":232,"end":243,"loc":{"start":{"line":20,"column":6},"end":{"line":20,"column":17}}, "callProperties": [], "properties": [ { "type": "ObjectTypeProperty", - "start": 233, - "end": 242, - "loc": { - "start": { - "line": 20, - "column": 7 - }, - "end": { - "line": 20, - "column": 16 - } - }, + "start":233,"end":242,"loc":{"start":{"line":20,"column":7},"end":{"line":20,"column":16}}, "key": { "type": "Identifier", - "start": 233, - "end": 237, - "loc": { - "start": { - "line": 20, - "column": 7 - }, - "end": { - "line": 20, - "column": 11 - }, - "identifierName": "type" - }, + "start":233,"end":237,"loc":{"start":{"line":20,"column":7},"end":{"line":20,"column":11},"identifierName":"type"}, "name": "type" }, "static": false, @@ -954,18 +357,7 @@ "method": false, "value": { "type": "StringLiteralTypeAnnotation", - "start": 239, - "end": 242, - "loc": { - "start": { - "line": 20, - "column": 13 - }, - "end": { - "line": 20, - "column": 16 - } - }, + "start":239,"end":242,"loc":{"start":{"line":20,"column":13},"end":{"line":20,"column":16}}, "extra": { "rawValue": "B", "raw": "\"B\"" diff --git a/packages/babel-parser/test/fixtures/flow/type-alias/5/output.json b/packages/babel-parser/test/fixtures/flow/type-alias/5/output.json index 75a8bc8b79e1..e78f03a85792 100644 --- a/packages/babel-parser/test/fixtures/flow/type-alias/5/output.json +++ b/packages/babel-parser/test/fixtures/flow/type-alias/5/output.json @@ -1,155 +1,43 @@ { "type": "File", - "start": 0, - "end": 98, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 9, - "column": 2 - } - }, + "start":0,"end":98,"loc":{"start":{"line":1,"column":0},"end":{"line":9,"column":2}}, "program": { "type": "Program", - "start": 0, - "end": 98, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 9, - "column": 2 - } - }, + "start":0,"end":98,"loc":{"start":{"line":1,"column":0},"end":{"line":9,"column":2}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "TypeAlias", - "start": 0, - "end": 48, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 2 - } - }, + "start":0,"end":48,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":2}}, "id": { "type": "Identifier", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "A" - }, + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"A"}, "name": "A" }, "typeParameters": null, "right": { "type": "GenericTypeAnnotation", - "start": 9, - "end": 47, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":9,"end":47,"loc":{"start":{"line":1,"column":9},"end":{"line":4,"column":1}}, "typeParameters": { "type": "TypeParameterInstantiation", - "start": 12, - "end": 47, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":12,"end":47,"loc":{"start":{"line":1,"column":12},"end":{"line":4,"column":1}}, "params": [ { "type": "UnionTypeAnnotation", - "start": 16, - "end": 45, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 3, - "column": 15 - } - }, + "start":16,"end":45,"loc":{"start":{"line":2,"column":2},"end":{"line":3,"column":15}}, "types": [ { "type": "ObjectTypeAnnotation", - "start": 18, - "end": 29, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 15 - } - }, + "start":18,"end":29,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":15}}, "callProperties": [], "properties": [ { "type": "ObjectTypeProperty", - "start": 19, - "end": 28, - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 14 - } - }, + "start":19,"end":28,"loc":{"start":{"line":2,"column":5},"end":{"line":2,"column":14}}, "key": { "type": "Identifier", - "start": 19, - "end": 23, - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 9 - }, - "identifierName": "type" - }, + "start":19,"end":23,"loc":{"start":{"line":2,"column":5},"end":{"line":2,"column":9},"identifierName":"type"}, "name": "type" }, "static": false, @@ -158,18 +46,7 @@ "method": false, "value": { "type": "StringLiteralTypeAnnotation", - "start": 25, - "end": 28, - "loc": { - "start": { - "line": 2, - "column": 11 - }, - "end": { - "line": 2, - "column": 14 - } - }, + "start":25,"end":28,"loc":{"start":{"line":2,"column":11},"end":{"line":2,"column":14}}, "extra": { "rawValue": "A", "raw": "\"A\"" @@ -187,49 +64,15 @@ }, { "type": "ObjectTypeAnnotation", - "start": 34, - "end": 45, - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 15 - } - }, + "start":34,"end":45,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":15}}, "callProperties": [], "properties": [ { "type": "ObjectTypeProperty", - "start": 35, - "end": 44, - "loc": { - "start": { - "line": 3, - "column": 5 - }, - "end": { - "line": 3, - "column": 14 - } - }, + "start":35,"end":44,"loc":{"start":{"line":3,"column":5},"end":{"line":3,"column":14}}, "key": { "type": "Identifier", - "start": 35, - "end": 39, - "loc": { - "start": { - "line": 3, - "column": 5 - }, - "end": { - "line": 3, - "column": 9 - }, - "identifierName": "type" - }, + "start":35,"end":39,"loc":{"start":{"line":3,"column":5},"end":{"line":3,"column":9},"identifierName":"type"}, "name": "type" }, "static": false, @@ -238,18 +81,7 @@ "method": false, "value": { "type": "StringLiteralTypeAnnotation", - "start": 41, - "end": 44, - "loc": { - "start": { - "line": 3, - "column": 11 - }, - "end": { - "line": 3, - "column": 14 - } - }, + "start":41,"end":44,"loc":{"start":{"line":3,"column":11},"end":{"line":3,"column":14}}, "extra": { "rawValue": "B", "raw": "\"B\"" @@ -271,144 +103,42 @@ }, "id": { "type": "Identifier", - "start": 9, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "Foo" - }, + "start":9,"end":12,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":12},"identifierName":"Foo"}, "name": "Foo" } } }, { "type": "TypeAlias", - "start": 50, - "end": 98, - "loc": { - "start": { - "line": 6, - "column": 0 - }, - "end": { - "line": 9, - "column": 2 - } - }, + "start":50,"end":98,"loc":{"start":{"line":6,"column":0},"end":{"line":9,"column":2}}, "id": { "type": "Identifier", - "start": 55, - "end": 56, - "loc": { - "start": { - "line": 6, - "column": 5 - }, - "end": { - "line": 6, - "column": 6 - }, - "identifierName": "B" - }, + "start":55,"end":56,"loc":{"start":{"line":6,"column":5},"end":{"line":6,"column":6},"identifierName":"B"}, "name": "B" }, "typeParameters": null, "right": { "type": "GenericTypeAnnotation", - "start": 59, - "end": 97, - "loc": { - "start": { - "line": 6, - "column": 9 - }, - "end": { - "line": 9, - "column": 1 - } - }, + "start":59,"end":97,"loc":{"start":{"line":6,"column":9},"end":{"line":9,"column":1}}, "typeParameters": { "type": "TypeParameterInstantiation", - "start": 62, - "end": 97, - "loc": { - "start": { - "line": 6, - "column": 12 - }, - "end": { - "line": 9, - "column": 1 - } - }, + "start":62,"end":97,"loc":{"start":{"line":6,"column":12},"end":{"line":9,"column":1}}, "params": [ { "type": "IntersectionTypeAnnotation", - "start": 66, - "end": 95, - "loc": { - "start": { - "line": 7, - "column": 2 - }, - "end": { - "line": 8, - "column": 15 - } - }, + "start":66,"end":95,"loc":{"start":{"line":7,"column":2},"end":{"line":8,"column":15}}, "types": [ { "type": "ObjectTypeAnnotation", - "start": 68, - "end": 79, - "loc": { - "start": { - "line": 7, - "column": 4 - }, - "end": { - "line": 7, - "column": 15 - } - }, + "start":68,"end":79,"loc":{"start":{"line":7,"column":4},"end":{"line":7,"column":15}}, "callProperties": [], "properties": [ { "type": "ObjectTypeProperty", - "start": 69, - "end": 78, - "loc": { - "start": { - "line": 7, - "column": 5 - }, - "end": { - "line": 7, - "column": 14 - } - }, + "start":69,"end":78,"loc":{"start":{"line":7,"column":5},"end":{"line":7,"column":14}}, "key": { "type": "Identifier", - "start": 69, - "end": 73, - "loc": { - "start": { - "line": 7, - "column": 5 - }, - "end": { - "line": 7, - "column": 9 - }, - "identifierName": "type" - }, + "start":69,"end":73,"loc":{"start":{"line":7,"column":5},"end":{"line":7,"column":9},"identifierName":"type"}, "name": "type" }, "static": false, @@ -417,18 +147,7 @@ "method": false, "value": { "type": "StringLiteralTypeAnnotation", - "start": 75, - "end": 78, - "loc": { - "start": { - "line": 7, - "column": 11 - }, - "end": { - "line": 7, - "column": 14 - } - }, + "start":75,"end":78,"loc":{"start":{"line":7,"column":11},"end":{"line":7,"column":14}}, "extra": { "rawValue": "A", "raw": "\"A\"" @@ -446,49 +165,15 @@ }, { "type": "ObjectTypeAnnotation", - "start": 84, - "end": 95, - "loc": { - "start": { - "line": 8, - "column": 4 - }, - "end": { - "line": 8, - "column": 15 - } - }, + "start":84,"end":95,"loc":{"start":{"line":8,"column":4},"end":{"line":8,"column":15}}, "callProperties": [], "properties": [ { "type": "ObjectTypeProperty", - "start": 85, - "end": 94, - "loc": { - "start": { - "line": 8, - "column": 5 - }, - "end": { - "line": 8, - "column": 14 - } - }, + "start":85,"end":94,"loc":{"start":{"line":8,"column":5},"end":{"line":8,"column":14}}, "key": { "type": "Identifier", - "start": 85, - "end": 89, - "loc": { - "start": { - "line": 8, - "column": 5 - }, - "end": { - "line": 8, - "column": 9 - }, - "identifierName": "type" - }, + "start":85,"end":89,"loc":{"start":{"line":8,"column":5},"end":{"line":8,"column":9},"identifierName":"type"}, "name": "type" }, "static": false, @@ -497,18 +182,7 @@ "method": false, "value": { "type": "StringLiteralTypeAnnotation", - "start": 91, - "end": 94, - "loc": { - "start": { - "line": 8, - "column": 11 - }, - "end": { - "line": 8, - "column": 14 - } - }, + "start":91,"end":94,"loc":{"start":{"line":8,"column":11},"end":{"line":8,"column":14}}, "extra": { "rawValue": "B", "raw": "\"B\"" @@ -530,19 +204,7 @@ }, "id": { "type": "Identifier", - "start": 59, - "end": 62, - "loc": { - "start": { - "line": 6, - "column": 9 - }, - "end": { - "line": 6, - "column": 12 - }, - "identifierName": "Foo" - }, + "start":59,"end":62,"loc":{"start":{"line":6,"column":9},"end":{"line":6,"column":12},"identifierName":"Foo"}, "name": "Foo" } } diff --git a/packages/babel-parser/test/fixtures/flow/type-alias/6/output.json b/packages/babel-parser/test/fixtures/flow/type-alias/6/output.json index 526e348eaba7..8bab56eca723 100644 --- a/packages/babel-parser/test/fixtures/flow/type-alias/6/output.json +++ b/packages/babel-parser/test/fixtures/flow/type-alias/6/output.json @@ -1,108 +1,30 @@ { "type": "File", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, "program": { "type": "Program", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "TypeAlias", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, "id": { "type": "Identifier", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "a" - }, + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"a"}, "name": "a" }, "typeParameters": null, "right": { "type": "NullableTypeAnnotation", - "start": 9, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":9,"end":17,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":17}}, "typeAnnotation": { "type": "NullableTypeAnnotation", - "start": 10, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":10,"end":17,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":17}}, "typeAnnotation": { "type": "StringTypeAnnotation", - "start": 11, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 17 - } - } + "start":11,"end":17,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":17}} } } } diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/1/output.json b/packages/babel-parser/test/fixtures/flow/type-annotations/1/output.json index 85e99c874f9e..629880bbf293 100644 --- a/packages/babel-parser/test/fixtures/flow/type-annotations/1/output.json +++ b/packages/babel-parser/test/fixtures/flow/type-annotations/1/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 44, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 44 - } - }, + "start":0,"end":44,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":44}}, "program": { "type": "Program", - "start": 0, - "end": 44, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 44 - } - }, + "start":0,"end":44,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":44}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 44, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 44 - } - }, + "start":0,"end":44,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":44}}, "id": { "type": "Identifier", - "start": 9, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "foo" - }, + "start":9,"end":12,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":12},"identifierName":"foo"}, "name": "foo" }, "generator": false, @@ -65,113 +20,34 @@ "params": [ { "type": "Identifier", - "start": 13, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 24 - }, - "identifierName": "numVal" - }, + "start":13,"end":24,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":24},"identifierName":"numVal"}, "name": "numVal", "typeAnnotation": { "type": "TypeAnnotation", - "start": 19, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":19,"end":24,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":24}}, "typeAnnotation": { "type": "AnyTypeAnnotation", - "start": 21, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 24 - } - } + "start":21,"end":24,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":24}} } } }, { "type": "Identifier", - "start": 26, - "end": 41, - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 41 - }, - "identifierName": "otherVal" - }, + "start":26,"end":41,"loc":{"start":{"line":1,"column":26},"end":{"line":1,"column":41},"identifierName":"otherVal"}, "name": "otherVal", "typeAnnotation": { "type": "TypeAnnotation", - "start": 34, - "end": 41, - "loc": { - "start": { - "line": 1, - "column": 34 - }, - "end": { - "line": 1, - "column": 41 - } - }, + "start":34,"end":41,"loc":{"start":{"line":1,"column":34},"end":{"line":1,"column":41}}, "typeAnnotation": { "type": "MixedTypeAnnotation", - "start": 36, - "end": 41, - "loc": { - "start": { - "line": 1, - "column": 36 - }, - "end": { - "line": 1, - "column": 41 - } - } + "start":36,"end":41,"loc":{"start":{"line":1,"column":36},"end":{"line":1,"column":41}} } } } ], "body": { "type": "BlockStatement", - "start": 42, - "end": 44, - "loc": { - "start": { - "line": 1, - "column": 42 - }, - "end": { - "line": 1, - "column": 44 - } - }, + "start":42,"end":44,"loc":{"start":{"line":1,"column":42},"end":{"line":1,"column":44}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/10/output.json b/packages/babel-parser/test/fixtures/flow/type-annotations/10/output.json index 133149d81a31..7a545d1e6536 100644 --- a/packages/babel-parser/test/fixtures/flow/type-annotations/10/output.json +++ b/packages/babel-parser/test/fixtures/flow/type-annotations/10/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 56, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 56 - } - }, + "start":0,"end":56,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":56}}, "program": { "type": "Program", - "start": 0, - "end": 56, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 56 - } - }, + "start":0,"end":56,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":56}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 56, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 56 - } - }, + "start":0,"end":56,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":56}}, "id": { "type": "Identifier", - "start": 9, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "foo" - }, + "start":9,"end":12,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":12},"identifierName":"foo"}, "name": "foo" }, "generator": false, @@ -65,161 +20,48 @@ "params": [ { "type": "Identifier", - "start": 13, - "end": 53, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 53 - }, - "identifierName": "callback" - }, + "start":13,"end":53,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":53},"identifierName":"callback"}, "name": "callback", "typeAnnotation": { "type": "TypeAnnotation", - "start": 21, - "end": 53, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 53 - } - }, + "start":21,"end":53,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":53}}, "typeAnnotation": { "type": "FunctionTypeAnnotation", - "start": 23, - "end": 53, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 53 - } - }, + "start":23,"end":53,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":53}}, "params": [ { "type": "FunctionTypeParam", - "start": 24, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":24,"end":31,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":31}}, "name": { "type": "Identifier", - "start": 24, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 26 - }, - "identifierName": "_1" - }, + "start":24,"end":26,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":26},"identifierName":"_1"}, "name": "_1" }, "optional": false, "typeAnnotation": { "type": "BooleanTypeAnnotation", - "start": 27, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 31 - } - } + "start":27,"end":31,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":31}} } }, { "type": "FunctionTypeParam", - "start": 33, - "end": 42, - "loc": { - "start": { - "line": 1, - "column": 33 - }, - "end": { - "line": 1, - "column": 42 - } - }, + "start":33,"end":42,"loc":{"start":{"line":1,"column":33},"end":{"line":1,"column":42}}, "name": { "type": "Identifier", - "start": 33, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 33 - }, - "end": { - "line": 1, - "column": 35 - }, - "identifierName": "_2" - }, + "start":33,"end":35,"loc":{"start":{"line":1,"column":33},"end":{"line":1,"column":35},"identifierName":"_2"}, "name": "_2" }, "optional": false, "typeAnnotation": { "type": "StringTypeAnnotation", - "start": 36, - "end": 42, - "loc": { - "start": { - "line": 1, - "column": 36 - }, - "end": { - "line": 1, - "column": 42 - } - } + "start":36,"end":42,"loc":{"start":{"line":1,"column":36},"end":{"line":1,"column":42}} } } ], "rest": null, "returnType": { "type": "NumberTypeAnnotation", - "start": 47, - "end": 53, - "loc": { - "start": { - "line": 1, - "column": 47 - }, - "end": { - "line": 1, - "column": 53 - } - } + "start":47,"end":53,"loc":{"start":{"line":1,"column":47},"end":{"line":1,"column":53}} }, "typeParameters": null } @@ -228,18 +70,7 @@ ], "body": { "type": "BlockStatement", - "start": 54, - "end": 56, - "loc": { - "start": { - "line": 1, - "column": 54 - }, - "end": { - "line": 1, - "column": 56 - } - }, + "start":54,"end":56,"loc":{"start":{"line":1,"column":54},"end":{"line":1,"column":56}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/100/output.json b/packages/babel-parser/test/fixtures/flow/type-annotations/100/output.json index 07264734b52f..654e969541db 100644 --- a/packages/babel-parser/test/fixtures/flow/type-annotations/100/output.json +++ b/packages/babel-parser/test/fixtures/flow/type-annotations/100/output.json @@ -1,111 +1,32 @@ { "type": "File", - "start": 0, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 40 - } - }, + "start":0,"end":40,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":40}}, "program": { "type": "Program", - "start": 0, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 40 - } - }, + "start":0,"end":40,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":40}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 40 - } - }, + "start":0,"end":40,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":40}}, "id": { "type": "Identifier", - "start": 6, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "Foo" - }, + "start":6,"end":9,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":9},"identifierName":"Foo"}, "name": "Foo" }, "superClass": null, "body": { "type": "ClassBody", - "start": 10, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 40 - } - }, + "start":10,"end":40,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":40}}, "body": [ { "type": "ClassMethod", - "start": 12, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 39 - } - }, + "start":12,"end":39,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":39}}, "static": false, "key": { "type": "Identifier", - "start": 12, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 15 - }, - "identifierName": "bar" - }, + "start":12,"end":15,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":15},"identifierName":"bar"}, "name": "bar" }, "computed": false, @@ -117,77 +38,22 @@ "predicate": null, "returnType": { "type": "TypeAnnotation", - "start": 17, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":17,"end":22,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":22}}, "typeAnnotation": { "type": "ThisTypeAnnotation", - "start": 18, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 22 - } - } + "start":18,"end":22,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":22}} } }, "body": { "type": "BlockStatement", - "start": 23, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 39 - } - }, + "start":23,"end":39,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":39}}, "body": [ { "type": "ReturnStatement", - "start": 25, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 37 - } - }, + "start":25,"end":37,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":37}}, "argument": { "type": "ThisExpression", - "start": 32, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 32 - }, - "end": { - "line": 1, - "column": 36 - } - } + "start":32,"end":36,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":36}} } } ], diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/101/output.json b/packages/babel-parser/test/fixtures/flow/type-annotations/101/output.json index e8d609bee62a..f085ab9a2d0a 100644 --- a/packages/babel-parser/test/fixtures/flow/type-annotations/101/output.json +++ b/packages/babel-parser/test/fixtures/flow/type-annotations/101/output.json @@ -1,121 +1,32 @@ { "type": "File", - "start": 0, - "end": 46, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 46 - } - }, + "start":0,"end":46,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":46}}, "program": { "type": "Program", - "start": 0, - "end": 46, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 46 - } - }, + "start":0,"end":46,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":46}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 46, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 46 - } - }, + "start":0,"end":46,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":46}}, "expression": { "type": "ArrowFunctionExpression", - "start": 0, - "end": 45, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 45 - } - }, + "start":0,"end":45,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":45}}, "predicate": null, "returnType": { "type": "TypeAnnotation", - "start": 23, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":23,"end":36,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":36}}, "typeAnnotation": { "type": "NullableTypeAnnotation", - "start": 25, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":25,"end":36,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":36}}, "typeAnnotation": { "type": "GenericTypeAnnotation", - "start": 26, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":26,"end":36,"loc":{"start":{"line":1,"column":26},"end":{"line":1,"column":36}}, "typeParameters": null, "id": { "type": "Identifier", - "start": 26, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 36 - }, - "identifierName": "ReturnType" - }, + "start":26,"end":36,"loc":{"start":{"line":1,"column":26},"end":{"line":1,"column":36},"identifierName":"ReturnType"}, "name": "ReturnType" } } @@ -127,79 +38,22 @@ "params": [ { "type": "RestElement", - "start": 2, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":2,"end":20,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":20}}, "argument": { "type": "Identifier", - "start": 5, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 10 - }, - "identifierName": "props" - }, + "start":5,"end":10,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":10},"identifierName":"props"}, "name": "props" }, "typeAnnotation": { "type": "TypeAnnotation", - "start": 10, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":10,"end":20,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":20}}, "typeAnnotation": { "type": "GenericTypeAnnotation", - "start": 12, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":12,"end":20,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":20}}, "typeParameters": null, "id": { "type": "Identifier", - "start": 12, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 20 - }, - "identifierName": "SomeType" - }, + "start":12,"end":20,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":20},"identifierName":"SomeType"}, "name": "SomeType" } } @@ -208,18 +62,7 @@ ], "body": { "type": "NumericLiteral", - "start": 42, - "end": 43, - "loc": { - "start": { - "line": 1, - "column": 42 - }, - "end": { - "line": 1, - "column": 43 - } - }, + "start":42,"end":43,"loc":{"start":{"line":1,"column":42},"end":{"line":1,"column":43}}, "extra": { "rawValue": 3, "raw": "3", diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/102/output.json b/packages/babel-parser/test/fixtures/flow/type-annotations/102/output.json index 0212f566b651..7e58c33f5885 100644 --- a/packages/babel-parser/test/fixtures/flow/type-annotations/102/output.json +++ b/packages/babel-parser/test/fixtures/flow/type-annotations/102/output.json @@ -1,138 +1,38 @@ { "type": "File", - "start": 0, - "end": 51, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 51 - } - }, + "start":0,"end":51,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":51}}, "program": { "type": "Program", - "start": 0, - "end": 51, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 51 - } - }, + "start":0,"end":51,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":51}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExportDefaultDeclaration", - "start": 0, - "end": 51, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 51 - } - }, + "start":0,"end":51,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":51}}, "declaration": { "type": "ArrowFunctionExpression", - "start": 15, - "end": 50, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 50 - } - }, + "start":15,"end":50,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":50}}, "predicate": null, "returnType": { "type": "TypeAnnotation", - "start": 29, - "end": 44, - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 1, - "column": 44 - } - }, + "start":29,"end":44,"loc":{"start":{"line":1,"column":29},"end":{"line":1,"column":44}}, "typeAnnotation": { "type": "GenericTypeAnnotation", - "start": 31, - "end": 44, - "loc": { - "start": { - "line": 1, - "column": 31 - }, - "end": { - "line": 1, - "column": 44 - } - }, + "start":31,"end":44,"loc":{"start":{"line":1,"column":31},"end":{"line":1,"column":44}}, "typeParameters": { "type": "TypeParameterInstantiation", - "start": 36, - "end": 44, - "loc": { - "start": { - "line": 1, - "column": 36 - }, - "end": { - "line": 1, - "column": 44 - } - }, + "start":36,"end":44,"loc":{"start":{"line":1,"column":36},"end":{"line":1,"column":44}}, "params": [ { "type": "StringTypeAnnotation", - "start": 37, - "end": 43, - "loc": { - "start": { - "line": 1, - "column": 37 - }, - "end": { - "line": 1, - "column": 43 - } - } + "start":37,"end":43,"loc":{"start":{"line":1,"column":37},"end":{"line":1,"column":43}} } ] }, "id": { "type": "Identifier", - "start": 31, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 31 - }, - "end": { - "line": 1, - "column": 36 - }, - "identifierName": "Array" - }, + "start":31,"end":36,"loc":{"start":{"line":1,"column":31},"end":{"line":1,"column":36},"identifierName":"Array"}, "name": "Array" } } @@ -143,51 +43,17 @@ "params": [ { "type": "RestElement", - "start": 16, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":16,"end":28,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":28}}, "argument": { "type": "Identifier", - "start": 19, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 28 - }, - "identifierName": "modifiers" - }, + "start":19,"end":28,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":28},"identifierName":"modifiers"}, "name": "modifiers" } } ], "body": { "type": "BlockStatement", - "start": 48, - "end": 50, - "loc": { - "start": { - "line": 1, - "column": 48 - }, - "end": { - "line": 1, - "column": 50 - } - }, + "start":48,"end":50,"loc":{"start":{"line":1,"column":48},"end":{"line":1,"column":50}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/103/output.json b/packages/babel-parser/test/fixtures/flow/type-annotations/103/output.json index 3bd5d138aed8..d971c67a7547 100644 --- a/packages/babel-parser/test/fixtures/flow/type-annotations/103/output.json +++ b/packages/babel-parser/test/fixtures/flow/type-annotations/103/output.json @@ -1,139 +1,38 @@ { "type": "File", - "start": 0, - "end": 73, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 73 - } - }, + "start":0,"end":73,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":73}}, "program": { "type": "Program", - "start": 0, - "end": 73, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 73 - } - }, + "start":0,"end":73,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":73}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 73, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 73 - } - }, + "start":0,"end":73,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":73}}, "declarations": [ { "type": "VariableDeclarator", - "start": 6, - "end": 73, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 73 - } - }, + "start":6,"end":73,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":73}}, "id": { "type": "Identifier", - "start": 6, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "parser" - }, + "start":6,"end":12,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":12},"identifierName":"parser"}, "name": "parser" }, "init": { "type": "ArrowFunctionExpression", - "start": 15, - "end": 73, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 73 - } - }, + "start":15,"end":73,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":73}}, "predicate": null, "returnType": { "type": "TypeAnnotation", - "start": 65, - "end": 67, - "loc": { - "start": { - "line": 1, - "column": 65 - }, - "end": { - "line": 1, - "column": 67 - } - }, + "start":65,"end":67,"loc":{"start":{"line":1,"column":65},"end":{"line":1,"column":67}}, "typeAnnotation": { "type": "GenericTypeAnnotation", - "start": 66, - "end": 67, - "loc": { - "start": { - "line": 1, - "column": 66 - }, - "end": { - "line": 1, - "column": 67 - } - }, + "start":66,"end":67,"loc":{"start":{"line":1,"column":66},"end":{"line":1,"column":67}}, "typeParameters": null, "id": { "type": "Identifier", - "start": 66, - "end": 67, - "loc": { - "start": { - "line": 1, - "column": 66 - }, - "end": { - "line": 1, - "column": 67 - }, - "identifierName": "a" - }, + "start":66,"end":67,"loc":{"start":{"line":1,"column":66},"end":{"line":1,"column":67},"identifierName":"a"}, "name": "a" } } @@ -144,157 +43,44 @@ "params": [ { "type": "Identifier", - "start": 16, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 32 - }, - "identifierName": "rootPath" - }, + "start":16,"end":32,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":32},"identifierName":"rootPath"}, "name": "rootPath", "typeAnnotation": { "type": "TypeAnnotation", - "start": 24, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":24,"end":32,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":32}}, "typeAnnotation": { "type": "StringTypeAnnotation", - "start": 26, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 32 - } - } + "start":26,"end":32,"loc":{"start":{"line":1,"column":26},"end":{"line":1,"column":32}} } } }, { "type": "RestElement", - "start": 34, - "end": 64, - "loc": { - "start": { - "line": 1, - "column": 34 - }, - "end": { - "line": 1, - "column": 64 - } - }, + "start":34,"end":64,"loc":{"start":{"line":1,"column":34},"end":{"line":1,"column":64}}, "argument": { "type": "Identifier", - "start": 37, - "end": 49, - "loc": { - "start": { - "line": 1, - "column": 37 - }, - "end": { - "line": 1, - "column": 49 - }, - "identifierName": "filesToParse" - }, + "start":37,"end":49,"loc":{"start":{"line":1,"column":37},"end":{"line":1,"column":49},"identifierName":"filesToParse"}, "name": "filesToParse" }, "typeAnnotation": { "type": "TypeAnnotation", - "start": 49, - "end": 64, - "loc": { - "start": { - "line": 1, - "column": 49 - }, - "end": { - "line": 1, - "column": 64 - } - }, + "start":49,"end":64,"loc":{"start":{"line":1,"column":49},"end":{"line":1,"column":64}}, "typeAnnotation": { "type": "GenericTypeAnnotation", - "start": 51, - "end": 64, - "loc": { - "start": { - "line": 1, - "column": 51 - }, - "end": { - "line": 1, - "column": 64 - } - }, + "start":51,"end":64,"loc":{"start":{"line":1,"column":51},"end":{"line":1,"column":64}}, "typeParameters": { "type": "TypeParameterInstantiation", - "start": 56, - "end": 64, - "loc": { - "start": { - "line": 1, - "column": 56 - }, - "end": { - "line": 1, - "column": 64 - } - }, + "start":56,"end":64,"loc":{"start":{"line":1,"column":56},"end":{"line":1,"column":64}}, "params": [ { "type": "StringTypeAnnotation", - "start": 57, - "end": 63, - "loc": { - "start": { - "line": 1, - "column": 57 - }, - "end": { - "line": 1, - "column": 63 - } - } + "start":57,"end":63,"loc":{"start":{"line":1,"column":57},"end":{"line":1,"column":63}} } ] }, "id": { "type": "Identifier", - "start": 51, - "end": 56, - "loc": { - "start": { - "line": 1, - "column": 51 - }, - "end": { - "line": 1, - "column": 56 - }, - "identifierName": "Array" - }, + "start":51,"end":56,"loc":{"start":{"line":1,"column":51},"end":{"line":1,"column":56},"identifierName":"Array"}, "name": "Array" } } @@ -303,18 +89,7 @@ ], "body": { "type": "BlockStatement", - "start": 71, - "end": 73, - "loc": { - "start": { - "line": 1, - "column": 71 - }, - "end": { - "line": 1, - "column": 73 - } - }, + "start":71,"end":73,"loc":{"start":{"line":1,"column":71},"end":{"line":1,"column":73}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/104/output.json b/packages/babel-parser/test/fixtures/flow/type-annotations/104/output.json index 99987bee8e19..9449309b7a07 100644 --- a/packages/babel-parser/test/fixtures/flow/type-annotations/104/output.json +++ b/packages/babel-parser/test/fixtures/flow/type-annotations/104/output.json @@ -1,144 +1,43 @@ { "type": "File", - "start": 0, - "end": 56, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 7, - "column": 1 - } - }, + "start":0,"end":56,"loc":{"start":{"line":1,"column":0},"end":{"line":7,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 56, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 7, - "column": 1 - } - }, + "start":0,"end":56,"loc":{"start":{"line":1,"column":0},"end":{"line":7,"column":1}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "id": { "type": "Identifier", - "start": 6, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "Foo" - }, + "start":6,"end":9,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":9},"identifierName":"Foo"}, "name": "Foo" }, "superClass": null, "body": { "type": "ClassBody", - "start": 10, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":10,"end":27,"loc":{"start":{"line":1,"column":10},"end":{"line":3,"column":1}}, "body": [ { "type": "ClassMethod", - "start": 14, - "end": 25, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 13 - } - }, + "start":14,"end":25,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":13}}, "static": false, "key": { "type": "Identifier", - "start": 14, - "end": 17, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 5 - }, - "identifierName": "get" - }, + "start":14,"end":17,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":5},"identifierName":"get"}, "name": "get" }, "computed": false, "kind": "method", "typeParameters": { "type": "TypeParameterDeclaration", - "start": 17, - "end": 20, - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 8 - } - }, + "start":17,"end":20,"loc":{"start":{"line":2,"column":5},"end":{"line":2,"column":8}}, "params": [ { "type": "TypeParameter", - "start": 18, - "end": 19, - "loc": { - "start": { - "line": 2, - "column": 6 - }, - "end": { - "line": 2, - "column": 7 - } - }, + "start":18,"end":19,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":7}}, "name": "T", "variance": null } @@ -150,18 +49,7 @@ "params": [], "body": { "type": "BlockStatement", - "start": 23, - "end": 25, - "loc": { - "start": { - "line": 2, - "column": 11 - }, - "end": { - "line": 2, - "column": 13 - } - }, + "start":23,"end":25,"loc":{"start":{"line":2,"column":11},"end":{"line":2,"column":13}}, "body": [], "directives": [] } @@ -171,114 +59,35 @@ }, { "type": "ClassDeclaration", - "start": 29, - "end": 56, - "loc": { - "start": { - "line": 5, - "column": 0 - }, - "end": { - "line": 7, - "column": 1 - } - }, + "start":29,"end":56,"loc":{"start":{"line":5,"column":0},"end":{"line":7,"column":1}}, "id": { "type": "Identifier", - "start": 35, - "end": 38, - "loc": { - "start": { - "line": 5, - "column": 6 - }, - "end": { - "line": 5, - "column": 9 - }, - "identifierName": "Bar" - }, + "start":35,"end":38,"loc":{"start":{"line":5,"column":6},"end":{"line":5,"column":9},"identifierName":"Bar"}, "name": "Bar" }, "superClass": null, "body": { "type": "ClassBody", - "start": 39, - "end": 56, - "loc": { - "start": { - "line": 5, - "column": 10 - }, - "end": { - "line": 7, - "column": 1 - } - }, + "start":39,"end":56,"loc":{"start":{"line":5,"column":10},"end":{"line":7,"column":1}}, "body": [ { "type": "ClassMethod", - "start": 43, - "end": 54, - "loc": { - "start": { - "line": 6, - "column": 2 - }, - "end": { - "line": 6, - "column": 13 - } - }, + "start":43,"end":54,"loc":{"start":{"line":6,"column":2},"end":{"line":6,"column":13}}, "static": false, "key": { "type": "Identifier", - "start": 43, - "end": 46, - "loc": { - "start": { - "line": 6, - "column": 2 - }, - "end": { - "line": 6, - "column": 5 - }, - "identifierName": "set" - }, + "start":43,"end":46,"loc":{"start":{"line":6,"column":2},"end":{"line":6,"column":5},"identifierName":"set"}, "name": "set" }, "computed": false, "kind": "method", "typeParameters": { "type": "TypeParameterDeclaration", - "start": 46, - "end": 49, - "loc": { - "start": { - "line": 6, - "column": 5 - }, - "end": { - "line": 6, - "column": 8 - } - }, + "start":46,"end":49,"loc":{"start":{"line":6,"column":5},"end":{"line":6,"column":8}}, "params": [ { "type": "TypeParameter", - "start": 47, - "end": 48, - "loc": { - "start": { - "line": 6, - "column": 6 - }, - "end": { - "line": 6, - "column": 7 - } - }, + "start":47,"end":48,"loc":{"start":{"line":6,"column":6},"end":{"line":6,"column":7}}, "name": "T", "variance": null } @@ -290,18 +99,7 @@ "params": [], "body": { "type": "BlockStatement", - "start": 52, - "end": 54, - "loc": { - "start": { - "line": 6, - "column": 11 - }, - "end": { - "line": 6, - "column": 13 - } - }, + "start":52,"end":54,"loc":{"start":{"line":6,"column":11},"end":{"line":6,"column":13}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/105/output.json b/packages/babel-parser/test/fixtures/flow/type-annotations/105/output.json index 06cbe65fd5ae..73530e6d3bf6 100644 --- a/packages/babel-parser/test/fixtures/flow/type-annotations/105/output.json +++ b/packages/babel-parser/test/fixtures/flow/type-annotations/105/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 37 - } - }, + "start":0,"end":37,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":37}}, "program": { "type": "Program", - "start": 0, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 37 - } - }, + "start":0,"end":37,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":37}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 37 - } - }, + "start":0,"end":37,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":37}}, "id": { "type": "Identifier", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - }, - "identifierName": "g" - }, + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"g"}, "name": "g" }, "generator": false, @@ -65,79 +20,23 @@ "params": [ { "type": "AssignmentPattern", - "start": 11, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":11,"end":21,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":21}}, "left": { "type": "Identifier", - "start": 11, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 19 - }, - "identifierName": "a" - }, + "start":11,"end":19,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":19},"identifierName":"a"}, "name": "a", "typeAnnotation": { "type": "TypeAnnotation", - "start": 12, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":12,"end":19,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":19}}, "typeAnnotation": { "type": "NumberTypeAnnotation", - "start": 13, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 19 - } - } + "start":13,"end":19,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":19}} } } }, "right": { "type": "NumericLiteral", - "start": 20, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":20,"end":21,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":21}}, "extra": { "rawValue": 1, "raw": "1" @@ -147,79 +46,23 @@ }, { "type": "AssignmentPattern", - "start": 23, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":23,"end":33,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":33}}, "left": { "type": "Identifier", - "start": 23, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 31 - }, - "identifierName": "e" - }, + "start":23,"end":31,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":31},"identifierName":"e"}, "name": "e", "typeAnnotation": { "type": "TypeAnnotation", - "start": 24, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":24,"end":31,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":31}}, "typeAnnotation": { "type": "NumberTypeAnnotation", - "start": 25, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 31 - } - } + "start":25,"end":31,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":31}} } } }, "right": { "type": "NumericLiteral", - "start": 32, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 32 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":32,"end":33,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":33}}, "extra": { "rawValue": 1, "raw": "1" @@ -230,18 +73,7 @@ ], "body": { "type": "BlockStatement", - "start": 35, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 35 - }, - "end": { - "line": 1, - "column": 37 - } - }, + "start":35,"end":37,"loc":{"start":{"line":1,"column":35},"end":{"line":1,"column":37}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/107/output.json b/packages/babel-parser/test/fixtures/flow/type-annotations/107/output.json index c5506a0fe98a..8623c7e1dbae 100644 --- a/packages/babel-parser/test/fixtures/flow/type-annotations/107/output.json +++ b/packages/babel-parser/test/fixtures/flow/type-annotations/107/output.json @@ -1,176 +1,52 @@ { "type": "File", - "start": 0, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":35}}, "program": { "type": "Program", - "start": 0, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":35}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":35}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":4,"end":35,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":35}}, "id": { "type": "Identifier", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "x" - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"x"}, "name": "x" }, "init": { "type": "ArrowFunctionExpression", - "start": 8, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":8,"end":35,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":35}}, "id": null, "generator": false, "async": false, "params": [ { "type": "AssignmentPattern", - "start": 9, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":9,"end":28,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":28}}, "left": { "type": "ObjectPattern", - "start": 9, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":9,"end":20,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":20}}, "properties": [ { "type": "ObjectProperty", - "start": 11, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":11,"end":12,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":12}}, "method": false, "key": { "type": "Identifier", - "start": 11, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "a" - }, + "start":11,"end":12,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":12},"identifierName":"a"}, "name": "a" }, "computed": false, "shorthand": true, "value": { "type": "Identifier", - "start": 11, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "a" - }, + "start":11,"end":12,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":12},"identifierName":"a"}, "name": "a" }, "extra": { @@ -180,49 +56,16 @@ ], "typeAnnotation": { "type": "TypeAnnotation", - "start": 15, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":15,"end":20,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":20}}, "typeAnnotation": { "type": "AnyTypeAnnotation", - "start": 17, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 20 - } - } + "start":17,"end":20,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":20}} } } }, "right": { "type": "StringLiteral", - "start": 23, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":23,"end":28,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":28}}, "extra": { "rawValue": "foo", "raw": "'foo'" @@ -233,18 +76,7 @@ ], "body": { "type": "BlockStatement", - "start": 33, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 33 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":33,"end":35,"loc":{"start":{"line":1,"column":33},"end":{"line":1,"column":35}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/108/output.json b/packages/babel-parser/test/fixtures/flow/type-annotations/108/output.json index a3e8ba642bf2..ea9d3a211918 100644 --- a/packages/babel-parser/test/fixtures/flow/type-annotations/108/output.json +++ b/packages/babel-parser/test/fixtures/flow/type-annotations/108/output.json @@ -1,138 +1,37 @@ { "type": "File", - "start": 0, - "end": 320, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 92 - } - }, + "start":0,"end":320,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":92}}, "program": { "type": "Program", - "start": 0, - "end": 320, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 92 - } - }, + "start":0,"end":320,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":92}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 56, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 56 - } - }, + "start":0,"end":56,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":56}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 55, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 55 - } - }, + "start":4,"end":55,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":55}}, "id": { "type": "Identifier", - "start": 4, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 34 - }, - "identifierName": "a" - }, + "start":4,"end":34,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":34},"identifierName":"a"}, "name": "a", "typeAnnotation": { "type": "TypeAnnotation", - "start": 6, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":6,"end":34,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":34}}, "typeAnnotation": { "type": "ObjectTypeAnnotation", - "start": 8, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":8,"end":34,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":34}}, "callProperties": [], "properties": [ { "type": "ObjectTypeProperty", - "start": 11, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":11,"end":20,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":20}}, "key": { "type": "Identifier", - "start": 11, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "x" - }, + "start":11,"end":12,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":12},"identifierName":"x"}, "name": "x" }, "static": false, @@ -141,51 +40,17 @@ "method": false, "value": { "type": "NumberTypeAnnotation", - "start": 14, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 20 - } - } + "start":14,"end":20,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":20}} }, "variance": null, "optional": false }, { "type": "ObjectTypeProperty", - "start": 22, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":22,"end":31,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":31}}, "key": { "type": "Identifier", - "start": 22, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 23 - }, - "identifierName": "y" - }, + "start":22,"end":23,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":23},"identifierName":"y"}, "name": "y" }, "static": false, @@ -194,18 +59,7 @@ "method": false, "value": { "type": "StringTypeAnnotation", - "start": 25, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 31 - } - } + "start":25,"end":31,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":31}} }, "variance": null, "optional": false @@ -220,67 +74,22 @@ }, "init": { "type": "ObjectExpression", - "start": 37, - "end": 55, - "loc": { - "start": { - "line": 1, - "column": 37 - }, - "end": { - "line": 1, - "column": 55 - } - }, + "start":37,"end":55,"loc":{"start":{"line":1,"column":37},"end":{"line":1,"column":55}}, "properties": [ { "type": "ObjectProperty", - "start": 39, - "end": 43, - "loc": { - "start": { - "line": 1, - "column": 39 - }, - "end": { - "line": 1, - "column": 43 - } - }, + "start":39,"end":43,"loc":{"start":{"line":1,"column":39},"end":{"line":1,"column":43}}, "method": false, "key": { "type": "Identifier", - "start": 39, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 39 - }, - "end": { - "line": 1, - "column": 40 - }, - "identifierName": "x" - }, + "start":39,"end":40,"loc":{"start":{"line":1,"column":39},"end":{"line":1,"column":40},"identifierName":"x"}, "name": "x" }, "computed": false, "shorthand": false, "value": { "type": "NumericLiteral", - "start": 42, - "end": 43, - "loc": { - "start": { - "line": 1, - "column": 42 - }, - "end": { - "line": 1, - "column": 43 - } - }, + "start":42,"end":43,"loc":{"start":{"line":1,"column":42},"end":{"line":1,"column":43}}, "extra": { "rawValue": 0, "raw": "0" @@ -290,52 +99,18 @@ }, { "type": "ObjectProperty", - "start": 45, - "end": 53, - "loc": { - "start": { - "line": 1, - "column": 45 - }, - "end": { - "line": 1, - "column": 53 - } - }, + "start":45,"end":53,"loc":{"start":{"line":1,"column":45},"end":{"line":1,"column":53}}, "method": false, "key": { "type": "Identifier", - "start": 45, - "end": 46, - "loc": { - "start": { - "line": 1, - "column": 45 - }, - "end": { - "line": 1, - "column": 46 - }, - "identifierName": "y" - }, + "start":45,"end":46,"loc":{"start":{"line":1,"column":45},"end":{"line":1,"column":46},"identifierName":"y"}, "name": "y" }, "computed": false, "shorthand": false, "value": { "type": "StringLiteral", - "start": 48, - "end": 53, - "loc": { - "start": { - "line": 1, - "column": 48 - }, - "end": { - "line": 1, - "column": 53 - } - }, + "start":48,"end":53,"loc":{"start":{"line":1,"column":48},"end":{"line":1,"column":53}}, "extra": { "rawValue": "foo", "raw": "'foo'" @@ -351,108 +126,29 @@ }, { "type": "VariableDeclaration", - "start": 57, - "end": 114, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 57 - } - }, + "start":57,"end":114,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":57}}, "declarations": [ { "type": "VariableDeclarator", - "start": 61, - "end": 113, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 56 - } - }, + "start":61,"end":113,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":56}}, "id": { "type": "Identifier", - "start": 61, - "end": 92, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 35 - }, - "identifierName": "b" - }, + "start":61,"end":92,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":35},"identifierName":"b"}, "name": "b", "typeAnnotation": { "type": "TypeAnnotation", - "start": 63, - "end": 92, - "loc": { - "start": { - "line": 2, - "column": 6 - }, - "end": { - "line": 2, - "column": 35 - } - }, + "start":63,"end":92,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":35}}, "typeAnnotation": { "type": "ObjectTypeAnnotation", - "start": 65, - "end": 92, - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 35 - } - }, + "start":65,"end":92,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":35}}, "callProperties": [], "properties": [ { "type": "ObjectTypeProperty", - "start": 68, - "end": 77, - "loc": { - "start": { - "line": 2, - "column": 11 - }, - "end": { - "line": 2, - "column": 20 - } - }, + "start":68,"end":77,"loc":{"start":{"line":2,"column":11},"end":{"line":2,"column":20}}, "key": { "type": "Identifier", - "start": 68, - "end": 69, - "loc": { - "start": { - "line": 2, - "column": 11 - }, - "end": { - "line": 2, - "column": 12 - }, - "identifierName": "x" - }, + "start":68,"end":69,"loc":{"start":{"line":2,"column":11},"end":{"line":2,"column":12},"identifierName":"x"}, "name": "x" }, "static": false, @@ -461,51 +157,17 @@ "method": false, "value": { "type": "NumberTypeAnnotation", - "start": 71, - "end": 77, - "loc": { - "start": { - "line": 2, - "column": 14 - }, - "end": { - "line": 2, - "column": 20 - } - } + "start":71,"end":77,"loc":{"start":{"line":2,"column":14},"end":{"line":2,"column":20}} }, "variance": null, "optional": false }, { "type": "ObjectTypeProperty", - "start": 79, - "end": 88, - "loc": { - "start": { - "line": 2, - "column": 22 - }, - "end": { - "line": 2, - "column": 31 - } - }, + "start":79,"end":88,"loc":{"start":{"line":2,"column":22},"end":{"line":2,"column":31}}, "key": { "type": "Identifier", - "start": 79, - "end": 80, - "loc": { - "start": { - "line": 2, - "column": 22 - }, - "end": { - "line": 2, - "column": 23 - }, - "identifierName": "y" - }, + "start":79,"end":80,"loc":{"start":{"line":2,"column":22},"end":{"line":2,"column":23},"identifierName":"y"}, "name": "y" }, "static": false, @@ -514,18 +176,7 @@ "method": false, "value": { "type": "StringTypeAnnotation", - "start": 82, - "end": 88, - "loc": { - "start": { - "line": 2, - "column": 25 - }, - "end": { - "line": 2, - "column": 31 - } - } + "start":82,"end":88,"loc":{"start":{"line":2,"column":25},"end":{"line":2,"column":31}} }, "variance": null, "optional": false @@ -540,67 +191,22 @@ }, "init": { "type": "ObjectExpression", - "start": 95, - "end": 113, - "loc": { - "start": { - "line": 2, - "column": 38 - }, - "end": { - "line": 2, - "column": 56 - } - }, + "start":95,"end":113,"loc":{"start":{"line":2,"column":38},"end":{"line":2,"column":56}}, "properties": [ { "type": "ObjectProperty", - "start": 97, - "end": 101, - "loc": { - "start": { - "line": 2, - "column": 40 - }, - "end": { - "line": 2, - "column": 44 - } - }, + "start":97,"end":101,"loc":{"start":{"line":2,"column":40},"end":{"line":2,"column":44}}, "method": false, "key": { "type": "Identifier", - "start": 97, - "end": 98, - "loc": { - "start": { - "line": 2, - "column": 40 - }, - "end": { - "line": 2, - "column": 41 - }, - "identifierName": "x" - }, + "start":97,"end":98,"loc":{"start":{"line":2,"column":40},"end":{"line":2,"column":41},"identifierName":"x"}, "name": "x" }, "computed": false, "shorthand": false, "value": { "type": "NumericLiteral", - "start": 100, - "end": 101, - "loc": { - "start": { - "line": 2, - "column": 43 - }, - "end": { - "line": 2, - "column": 44 - } - }, + "start":100,"end":101,"loc":{"start":{"line":2,"column":43},"end":{"line":2,"column":44}}, "extra": { "rawValue": 0, "raw": "0" @@ -610,52 +216,18 @@ }, { "type": "ObjectProperty", - "start": 103, - "end": 111, - "loc": { - "start": { - "line": 2, - "column": 46 - }, - "end": { - "line": 2, - "column": 54 - } - }, + "start":103,"end":111,"loc":{"start":{"line":2,"column":46},"end":{"line":2,"column":54}}, "method": false, "key": { "type": "Identifier", - "start": 103, - "end": 104, - "loc": { - "start": { - "line": 2, - "column": 46 - }, - "end": { - "line": 2, - "column": 47 - }, - "identifierName": "y" - }, + "start":103,"end":104,"loc":{"start":{"line":2,"column":46},"end":{"line":2,"column":47},"identifierName":"y"}, "name": "y" }, "computed": false, "shorthand": false, "value": { "type": "StringLiteral", - "start": 106, - "end": 111, - "loc": { - "start": { - "line": 2, - "column": 49 - }, - "end": { - "line": 2, - "column": 54 - } - }, + "start":106,"end":111,"loc":{"start":{"line":2,"column":49},"end":{"line":2,"column":54}}, "extra": { "rawValue": "foo", "raw": "'foo'" @@ -671,77 +243,21 @@ }, { "type": "VariableDeclaration", - "start": 115, - "end": 134, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 19 - } - }, + "start":115,"end":134,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":19}}, "declarations": [ { "type": "VariableDeclarator", - "start": 119, - "end": 133, - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 18 - } - }, + "start":119,"end":133,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":18}}, "id": { "type": "Identifier", - "start": 119, - "end": 128, - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 13 - }, - "identifierName": "c" - }, + "start":119,"end":128,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":13},"identifierName":"c"}, "name": "c", "typeAnnotation": { "type": "TypeAnnotation", - "start": 121, - "end": 128, - "loc": { - "start": { - "line": 3, - "column": 6 - }, - "end": { - "line": 3, - "column": 13 - } - }, + "start":121,"end":128,"loc":{"start":{"line":3,"column":6},"end":{"line":3,"column":13}}, "typeAnnotation": { "type": "ObjectTypeAnnotation", - "start": 123, - "end": 128, - "loc": { - "start": { - "line": 3, - "column": 8 - }, - "end": { - "line": 3, - "column": 13 - } - }, + "start":123,"end":128,"loc":{"start":{"line":3,"column":8},"end":{"line":3,"column":13}}, "callProperties": [], "properties": [], "indexers": [], @@ -753,18 +269,7 @@ }, "init": { "type": "ObjectExpression", - "start": 131, - "end": 133, - "loc": { - "start": { - "line": 3, - "column": 16 - }, - "end": { - "line": 3, - "column": 18 - } - }, + "start":131,"end":133,"loc":{"start":{"line":3,"column":16},"end":{"line":3,"column":18}}, "properties": [] } } @@ -773,108 +278,29 @@ }, { "type": "VariableDeclaration", - "start": 135, - "end": 227, - "loc": { - "start": { - "line": 4, - "column": 0 - }, - "end": { - "line": 4, - "column": 92 - } - }, + "start":135,"end":227,"loc":{"start":{"line":4,"column":0},"end":{"line":4,"column":92}}, "declarations": [ { "type": "VariableDeclarator", - "start": 139, - "end": 226, - "loc": { - "start": { - "line": 4, - "column": 4 - }, - "end": { - "line": 4, - "column": 91 - } - }, + "start":139,"end":226,"loc":{"start":{"line":4,"column":4},"end":{"line":4,"column":91}}, "id": { "type": "Identifier", - "start": 139, - "end": 188, - "loc": { - "start": { - "line": 4, - "column": 4 - }, - "end": { - "line": 4, - "column": 53 - }, - "identifierName": "d" - }, + "start":139,"end":188,"loc":{"start":{"line":4,"column":4},"end":{"line":4,"column":53},"identifierName":"d"}, "name": "d", "typeAnnotation": { "type": "TypeAnnotation", - "start": 141, - "end": 188, - "loc": { - "start": { - "line": 4, - "column": 6 - }, - "end": { - "line": 4, - "column": 53 - } - }, + "start":141,"end":188,"loc":{"start":{"line":4,"column":6},"end":{"line":4,"column":53}}, "typeAnnotation": { "type": "ObjectTypeAnnotation", - "start": 143, - "end": 188, - "loc": { - "start": { - "line": 4, - "column": 8 - }, - "end": { - "line": 4, - "column": 53 - } - }, + "start":143,"end":188,"loc":{"start":{"line":4,"column":8},"end":{"line":4,"column":53}}, "callProperties": [], "properties": [ { "type": "ObjectTypeProperty", - "start": 145, - "end": 174, - "loc": { - "start": { - "line": 4, - "column": 10 - }, - "end": { - "line": 4, - "column": 39 - } - }, + "start":145,"end":174,"loc":{"start":{"line":4,"column":10},"end":{"line":4,"column":39}}, "key": { "type": "Identifier", - "start": 145, - "end": 146, - "loc": { - "start": { - "line": 4, - "column": 10 - }, - "end": { - "line": 4, - "column": 11 - }, - "identifierName": "a" - }, + "start":145,"end":146,"loc":{"start":{"line":4,"column":10},"end":{"line":4,"column":11},"identifierName":"a"}, "name": "a" }, "static": false, @@ -883,49 +309,15 @@ "method": false, "value": { "type": "ObjectTypeAnnotation", - "start": 148, - "end": 174, - "loc": { - "start": { - "line": 4, - "column": 13 - }, - "end": { - "line": 4, - "column": 39 - } - }, + "start":148,"end":174,"loc":{"start":{"line":4,"column":13},"end":{"line":4,"column":39}}, "callProperties": [], "properties": [ { "type": "ObjectTypeProperty", - "start": 151, - "end": 160, - "loc": { - "start": { - "line": 4, - "column": 16 - }, - "end": { - "line": 4, - "column": 25 - } - }, + "start":151,"end":160,"loc":{"start":{"line":4,"column":16},"end":{"line":4,"column":25}}, "key": { "type": "Identifier", - "start": 151, - "end": 152, - "loc": { - "start": { - "line": 4, - "column": 16 - }, - "end": { - "line": 4, - "column": 17 - }, - "identifierName": "x" - }, + "start":151,"end":152,"loc":{"start":{"line":4,"column":16},"end":{"line":4,"column":17},"identifierName":"x"}, "name": "x" }, "static": false, @@ -934,51 +326,17 @@ "method": false, "value": { "type": "NumberTypeAnnotation", - "start": 154, - "end": 160, - "loc": { - "start": { - "line": 4, - "column": 19 - }, - "end": { - "line": 4, - "column": 25 - } - } + "start":154,"end":160,"loc":{"start":{"line":4,"column":19},"end":{"line":4,"column":25}} }, "variance": null, "optional": false }, { "type": "ObjectTypeProperty", - "start": 162, - "end": 171, - "loc": { - "start": { - "line": 4, - "column": 27 - }, - "end": { - "line": 4, - "column": 36 - } - }, + "start":162,"end":171,"loc":{"start":{"line":4,"column":27},"end":{"line":4,"column":36}}, "key": { "type": "Identifier", - "start": 162, - "end": 163, - "loc": { - "start": { - "line": 4, - "column": 27 - }, - "end": { - "line": 4, - "column": 28 - }, - "identifierName": "y" - }, + "start":162,"end":163,"loc":{"start":{"line":4,"column":27},"end":{"line":4,"column":28},"identifierName":"y"}, "name": "y" }, "static": false, @@ -987,18 +345,7 @@ "method": false, "value": { "type": "StringTypeAnnotation", - "start": 165, - "end": 171, - "loc": { - "start": { - "line": 4, - "column": 30 - }, - "end": { - "line": 4, - "column": 36 - } - } + "start":165,"end":171,"loc":{"start":{"line":4,"column":30},"end":{"line":4,"column":36}} }, "variance": null, "optional": false @@ -1014,33 +361,10 @@ }, { "type": "ObjectTypeProperty", - "start": 176, - "end": 186, - "loc": { - "start": { - "line": 4, - "column": 41 - }, - "end": { - "line": 4, - "column": 51 - } - }, + "start":176,"end":186,"loc":{"start":{"line":4,"column":41},"end":{"line":4,"column":51}}, "key": { "type": "Identifier", - "start": 176, - "end": 177, - "loc": { - "start": { - "line": 4, - "column": 41 - }, - "end": { - "line": 4, - "column": 42 - }, - "identifierName": "b" - }, + "start":176,"end":177,"loc":{"start":{"line":4,"column":41},"end":{"line":4,"column":42},"identifierName":"b"}, "name": "b" }, "static": false, @@ -1049,18 +373,7 @@ "method": false, "value": { "type": "BooleanTypeAnnotation", - "start": 179, - "end": 186, - "loc": { - "start": { - "line": 4, - "column": 44 - }, - "end": { - "line": 4, - "column": 51 - } - } + "start":179,"end":186,"loc":{"start":{"line":4,"column":44},"end":{"line":4,"column":51}} }, "variance": null, "optional": false @@ -1075,116 +388,37 @@ }, "init": { "type": "ObjectExpression", - "start": 191, - "end": 226, - "loc": { - "start": { - "line": 4, - "column": 56 - }, - "end": { - "line": 4, - "column": 91 - } - }, + "start":191,"end":226,"loc":{"start":{"line":4,"column":56},"end":{"line":4,"column":91}}, "properties": [ { "type": "ObjectProperty", - "start": 193, - "end": 214, - "loc": { - "start": { - "line": 4, - "column": 58 - }, - "end": { - "line": 4, - "column": 79 - } - }, + "start":193,"end":214,"loc":{"start":{"line":4,"column":58},"end":{"line":4,"column":79}}, "method": false, "key": { "type": "Identifier", - "start": 193, - "end": 194, - "loc": { - "start": { - "line": 4, - "column": 58 - }, - "end": { - "line": 4, - "column": 59 - }, - "identifierName": "a" - }, + "start":193,"end":194,"loc":{"start":{"line":4,"column":58},"end":{"line":4,"column":59},"identifierName":"a"}, "name": "a" }, "computed": false, "shorthand": false, "value": { "type": "ObjectExpression", - "start": 196, - "end": 214, - "loc": { - "start": { - "line": 4, - "column": 61 - }, - "end": { - "line": 4, - "column": 79 - } - }, + "start":196,"end":214,"loc":{"start":{"line":4,"column":61},"end":{"line":4,"column":79}}, "properties": [ { "type": "ObjectProperty", - "start": 198, - "end": 202, - "loc": { - "start": { - "line": 4, - "column": 63 - }, - "end": { - "line": 4, - "column": 67 - } - }, + "start":198,"end":202,"loc":{"start":{"line":4,"column":63},"end":{"line":4,"column":67}}, "method": false, "key": { "type": "Identifier", - "start": 198, - "end": 199, - "loc": { - "start": { - "line": 4, - "column": 63 - }, - "end": { - "line": 4, - "column": 64 - }, - "identifierName": "x" - }, + "start":198,"end":199,"loc":{"start":{"line":4,"column":63},"end":{"line":4,"column":64},"identifierName":"x"}, "name": "x" }, "computed": false, "shorthand": false, "value": { "type": "NumericLiteral", - "start": 201, - "end": 202, - "loc": { - "start": { - "line": 4, - "column": 66 - }, - "end": { - "line": 4, - "column": 67 - } - }, + "start":201,"end":202,"loc":{"start":{"line":4,"column":66},"end":{"line":4,"column":67}}, "extra": { "rawValue": 0, "raw": "0" @@ -1194,52 +428,18 @@ }, { "type": "ObjectProperty", - "start": 204, - "end": 212, - "loc": { - "start": { - "line": 4, - "column": 69 - }, - "end": { - "line": 4, - "column": 77 - } - }, + "start":204,"end":212,"loc":{"start":{"line":4,"column":69},"end":{"line":4,"column":77}}, "method": false, "key": { "type": "Identifier", - "start": 204, - "end": 205, - "loc": { - "start": { - "line": 4, - "column": 69 - }, - "end": { - "line": 4, - "column": 70 - }, - "identifierName": "y" - }, + "start":204,"end":205,"loc":{"start":{"line":4,"column":69},"end":{"line":4,"column":70},"identifierName":"y"}, "name": "y" }, "computed": false, "shorthand": false, "value": { "type": "StringLiteral", - "start": 207, - "end": 212, - "loc": { - "start": { - "line": 4, - "column": 72 - }, - "end": { - "line": 4, - "column": 77 - } - }, + "start":207,"end":212,"loc":{"start":{"line":4,"column":72},"end":{"line":4,"column":77}}, "extra": { "rawValue": "foo", "raw": "'foo'" @@ -1252,52 +452,18 @@ }, { "type": "ObjectProperty", - "start": 216, - "end": 224, - "loc": { - "start": { - "line": 4, - "column": 81 - }, - "end": { - "line": 4, - "column": 89 - } - }, + "start":216,"end":224,"loc":{"start":{"line":4,"column":81},"end":{"line":4,"column":89}}, "method": false, "key": { "type": "Identifier", - "start": 216, - "end": 217, - "loc": { - "start": { - "line": 4, - "column": 81 - }, - "end": { - "line": 4, - "column": 82 - }, - "identifierName": "b" - }, + "start":216,"end":217,"loc":{"start":{"line":4,"column":81},"end":{"line":4,"column":82},"identifierName":"b"}, "name": "b" }, "computed": false, "shorthand": false, "value": { "type": "BooleanLiteral", - "start": 219, - "end": 224, - "loc": { - "start": { - "line": 4, - "column": 84 - }, - "end": { - "line": 4, - "column": 89 - } - }, + "start":219,"end":224,"loc":{"start":{"line":4,"column":84},"end":{"line":4,"column":89}}, "value": false } } @@ -1309,108 +475,29 @@ }, { "type": "VariableDeclaration", - "start": 228, - "end": 320, - "loc": { - "start": { - "line": 5, - "column": 0 - }, - "end": { - "line": 5, - "column": 92 - } - }, + "start":228,"end":320,"loc":{"start":{"line":5,"column":0},"end":{"line":5,"column":92}}, "declarations": [ { "type": "VariableDeclarator", - "start": 232, - "end": 319, - "loc": { - "start": { - "line": 5, - "column": 4 - }, - "end": { - "line": 5, - "column": 91 - } - }, + "start":232,"end":319,"loc":{"start":{"line":5,"column":4},"end":{"line":5,"column":91}}, "id": { "type": "Identifier", - "start": 232, - "end": 281, - "loc": { - "start": { - "line": 5, - "column": 4 - }, - "end": { - "line": 5, - "column": 53 - }, - "identifierName": "e" - }, + "start":232,"end":281,"loc":{"start":{"line":5,"column":4},"end":{"line":5,"column":53},"identifierName":"e"}, "name": "e", "typeAnnotation": { "type": "TypeAnnotation", - "start": 234, - "end": 281, - "loc": { - "start": { - "line": 5, - "column": 6 - }, - "end": { - "line": 5, - "column": 53 - } - }, + "start":234,"end":281,"loc":{"start":{"line":5,"column":6},"end":{"line":5,"column":53}}, "typeAnnotation": { "type": "ObjectTypeAnnotation", - "start": 236, - "end": 281, - "loc": { - "start": { - "line": 5, - "column": 8 - }, - "end": { - "line": 5, - "column": 53 - } - }, + "start":236,"end":281,"loc":{"start":{"line":5,"column":8},"end":{"line":5,"column":53}}, "callProperties": [], "properties": [ { "type": "ObjectTypeProperty", - "start": 239, - "end": 266, - "loc": { - "start": { - "line": 5, - "column": 11 - }, - "end": { - "line": 5, - "column": 38 - } - }, + "start":239,"end":266,"loc":{"start":{"line":5,"column":11},"end":{"line":5,"column":38}}, "key": { "type": "Identifier", - "start": 239, - "end": 240, - "loc": { - "start": { - "line": 5, - "column": 11 - }, - "end": { - "line": 5, - "column": 12 - }, - "identifierName": "a" - }, + "start":239,"end":240,"loc":{"start":{"line":5,"column":11},"end":{"line":5,"column":12},"identifierName":"a"}, "name": "a" }, "static": false, @@ -1419,49 +506,15 @@ "method": false, "value": { "type": "ObjectTypeAnnotation", - "start": 242, - "end": 266, - "loc": { - "start": { - "line": 5, - "column": 14 - }, - "end": { - "line": 5, - "column": 38 - } - }, + "start":242,"end":266,"loc":{"start":{"line":5,"column":14},"end":{"line":5,"column":38}}, "callProperties": [], "properties": [ { "type": "ObjectTypeProperty", - "start": 244, - "end": 253, - "loc": { - "start": { - "line": 5, - "column": 16 - }, - "end": { - "line": 5, - "column": 25 - } - }, + "start":244,"end":253,"loc":{"start":{"line":5,"column":16},"end":{"line":5,"column":25}}, "key": { "type": "Identifier", - "start": 244, - "end": 245, - "loc": { - "start": { - "line": 5, - "column": 16 - }, - "end": { - "line": 5, - "column": 17 - }, - "identifierName": "x" - }, + "start":244,"end":245,"loc":{"start":{"line":5,"column":16},"end":{"line":5,"column":17},"identifierName":"x"}, "name": "x" }, "static": false, @@ -1470,51 +523,17 @@ "method": false, "value": { "type": "NumberTypeAnnotation", - "start": 247, - "end": 253, - "loc": { - "start": { - "line": 5, - "column": 19 - }, - "end": { - "line": 5, - "column": 25 - } - } + "start":247,"end":253,"loc":{"start":{"line":5,"column":19},"end":{"line":5,"column":25}} }, "variance": null, "optional": false }, { "type": "ObjectTypeProperty", - "start": 255, - "end": 264, - "loc": { - "start": { - "line": 5, - "column": 27 - }, - "end": { - "line": 5, - "column": 36 - } - }, + "start":255,"end":264,"loc":{"start":{"line":5,"column":27},"end":{"line":5,"column":36}}, "key": { "type": "Identifier", - "start": 255, - "end": 256, - "loc": { - "start": { - "line": 5, - "column": 27 - }, - "end": { - "line": 5, - "column": 28 - }, - "identifierName": "y" - }, + "start":255,"end":256,"loc":{"start":{"line":5,"column":27},"end":{"line":5,"column":28},"identifierName":"y"}, "name": "y" }, "static": false, @@ -1523,18 +542,7 @@ "method": false, "value": { "type": "StringTypeAnnotation", - "start": 258, - "end": 264, - "loc": { - "start": { - "line": 5, - "column": 30 - }, - "end": { - "line": 5, - "column": 36 - } - } + "start":258,"end":264,"loc":{"start":{"line":5,"column":30},"end":{"line":5,"column":36}} }, "variance": null, "optional": false @@ -1550,33 +558,10 @@ }, { "type": "ObjectTypeProperty", - "start": 268, - "end": 278, - "loc": { - "start": { - "line": 5, - "column": 40 - }, - "end": { - "line": 5, - "column": 50 - } - }, + "start":268,"end":278,"loc":{"start":{"line":5,"column":40},"end":{"line":5,"column":50}}, "key": { "type": "Identifier", - "start": 268, - "end": 269, - "loc": { - "start": { - "line": 5, - "column": 40 - }, - "end": { - "line": 5, - "column": 41 - }, - "identifierName": "b" - }, + "start":268,"end":269,"loc":{"start":{"line":5,"column":40},"end":{"line":5,"column":41},"identifierName":"b"}, "name": "b" }, "static": false, @@ -1585,18 +570,7 @@ "method": false, "value": { "type": "BooleanTypeAnnotation", - "start": 271, - "end": 278, - "loc": { - "start": { - "line": 5, - "column": 43 - }, - "end": { - "line": 5, - "column": 50 - } - } + "start":271,"end":278,"loc":{"start":{"line":5,"column":43},"end":{"line":5,"column":50}} }, "variance": null, "optional": false @@ -1611,116 +585,37 @@ }, "init": { "type": "ObjectExpression", - "start": 284, - "end": 319, - "loc": { - "start": { - "line": 5, - "column": 56 - }, - "end": { - "line": 5, - "column": 91 - } - }, + "start":284,"end":319,"loc":{"start":{"line":5,"column":56},"end":{"line":5,"column":91}}, "properties": [ { "type": "ObjectProperty", - "start": 286, - "end": 307, - "loc": { - "start": { - "line": 5, - "column": 58 - }, - "end": { - "line": 5, - "column": 79 - } - }, + "start":286,"end":307,"loc":{"start":{"line":5,"column":58},"end":{"line":5,"column":79}}, "method": false, "key": { "type": "Identifier", - "start": 286, - "end": 287, - "loc": { - "start": { - "line": 5, - "column": 58 - }, - "end": { - "line": 5, - "column": 59 - }, - "identifierName": "a" - }, + "start":286,"end":287,"loc":{"start":{"line":5,"column":58},"end":{"line":5,"column":59},"identifierName":"a"}, "name": "a" }, "computed": false, "shorthand": false, "value": { "type": "ObjectExpression", - "start": 289, - "end": 307, - "loc": { - "start": { - "line": 5, - "column": 61 - }, - "end": { - "line": 5, - "column": 79 - } - }, + "start":289,"end":307,"loc":{"start":{"line":5,"column":61},"end":{"line":5,"column":79}}, "properties": [ { "type": "ObjectProperty", - "start": 291, - "end": 295, - "loc": { - "start": { - "line": 5, - "column": 63 - }, - "end": { - "line": 5, - "column": 67 - } - }, + "start":291,"end":295,"loc":{"start":{"line":5,"column":63},"end":{"line":5,"column":67}}, "method": false, "key": { "type": "Identifier", - "start": 291, - "end": 292, - "loc": { - "start": { - "line": 5, - "column": 63 - }, - "end": { - "line": 5, - "column": 64 - }, - "identifierName": "x" - }, + "start":291,"end":292,"loc":{"start":{"line":5,"column":63},"end":{"line":5,"column":64},"identifierName":"x"}, "name": "x" }, "computed": false, "shorthand": false, "value": { "type": "NumericLiteral", - "start": 294, - "end": 295, - "loc": { - "start": { - "line": 5, - "column": 66 - }, - "end": { - "line": 5, - "column": 67 - } - }, + "start":294,"end":295,"loc":{"start":{"line":5,"column":66},"end":{"line":5,"column":67}}, "extra": { "rawValue": 0, "raw": "0" @@ -1730,52 +625,18 @@ }, { "type": "ObjectProperty", - "start": 297, - "end": 305, - "loc": { - "start": { - "line": 5, - "column": 69 - }, - "end": { - "line": 5, - "column": 77 - } - }, + "start":297,"end":305,"loc":{"start":{"line":5,"column":69},"end":{"line":5,"column":77}}, "method": false, "key": { "type": "Identifier", - "start": 297, - "end": 298, - "loc": { - "start": { - "line": 5, - "column": 69 - }, - "end": { - "line": 5, - "column": 70 - }, - "identifierName": "y" - }, + "start":297,"end":298,"loc":{"start":{"line":5,"column":69},"end":{"line":5,"column":70},"identifierName":"y"}, "name": "y" }, "computed": false, "shorthand": false, "value": { "type": "StringLiteral", - "start": 300, - "end": 305, - "loc": { - "start": { - "line": 5, - "column": 72 - }, - "end": { - "line": 5, - "column": 77 - } - }, + "start":300,"end":305,"loc":{"start":{"line":5,"column":72},"end":{"line":5,"column":77}}, "extra": { "rawValue": "foo", "raw": "'foo'" @@ -1788,52 +649,18 @@ }, { "type": "ObjectProperty", - "start": 309, - "end": 317, - "loc": { - "start": { - "line": 5, - "column": 81 - }, - "end": { - "line": 5, - "column": 89 - } - }, + "start":309,"end":317,"loc":{"start":{"line":5,"column":81},"end":{"line":5,"column":89}}, "method": false, "key": { "type": "Identifier", - "start": 309, - "end": 310, - "loc": { - "start": { - "line": 5, - "column": 81 - }, - "end": { - "line": 5, - "column": 82 - }, - "identifierName": "b" - }, + "start":309,"end":310,"loc":{"start":{"line":5,"column":81},"end":{"line":5,"column":82},"identifierName":"b"}, "name": "b" }, "computed": false, "shorthand": false, "value": { "type": "BooleanLiteral", - "start": 312, - "end": 317, - "loc": { - "start": { - "line": 5, - "column": 84 - }, - "end": { - "line": 5, - "column": 89 - } - }, + "start":312,"end":317,"loc":{"start":{"line":5,"column":84},"end":{"line":5,"column":89}}, "value": false } } diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/11/output.json b/packages/babel-parser/test/fixtures/flow/type-annotations/11/output.json index 9ae1b33f3694..eff1cf78a25e 100644 --- a/packages/babel-parser/test/fixtures/flow/type-annotations/11/output.json +++ b/packages/babel-parser/test/fixtures/flow/type-annotations/11/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 67, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 67 - } - }, + "start":0,"end":67,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":67}}, "program": { "type": "Program", - "start": 0, - "end": 67, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 67 - } - }, + "start":0,"end":67,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":67}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 67, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 67 - } - }, + "start":0,"end":67,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":67}}, "id": { "type": "Identifier", - "start": 9, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "foo" - }, + "start":9,"end":12,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":12},"identifierName":"foo"}, "name": "foo" }, "generator": false, @@ -65,209 +20,62 @@ "params": [ { "type": "Identifier", - "start": 13, - "end": 64, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 64 - }, - "identifierName": "callback" - }, + "start":13,"end":64,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":64},"identifierName":"callback"}, "name": "callback", "typeAnnotation": { "type": "TypeAnnotation", - "start": 21, - "end": 64, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 64 - } - }, + "start":21,"end":64,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":64}}, "typeAnnotation": { "type": "FunctionTypeAnnotation", - "start": 23, - "end": 64, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 64 - } - }, + "start":23,"end":64,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":64}}, "params": [ { "type": "FunctionTypeParam", - "start": 24, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":24,"end":31,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":31}}, "name": { "type": "Identifier", - "start": 24, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 26 - }, - "identifierName": "_1" - }, + "start":24,"end":26,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":26},"identifierName":"_1"}, "name": "_1" }, "optional": false, "typeAnnotation": { "type": "BooleanTypeAnnotation", - "start": 27, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 31 - } - } + "start":27,"end":31,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":31}} } } ], "rest": { "type": "FunctionTypeParam", - "start": 36, - "end": 53, - "loc": { - "start": { - "line": 1, - "column": 36 - }, - "end": { - "line": 1, - "column": 53 - } - }, + "start":36,"end":53,"loc":{"start":{"line":1,"column":36},"end":{"line":1,"column":53}}, "name": { "type": "Identifier", - "start": 36, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 36 - }, - "end": { - "line": 1, - "column": 39 - }, - "identifierName": "foo" - }, + "start":36,"end":39,"loc":{"start":{"line":1,"column":36},"end":{"line":1,"column":39},"identifierName":"foo"}, "name": "foo" }, "optional": false, "typeAnnotation": { "type": "GenericTypeAnnotation", - "start": 40, - "end": 53, - "loc": { - "start": { - "line": 1, - "column": 40 - }, - "end": { - "line": 1, - "column": 53 - } - }, + "start":40,"end":53,"loc":{"start":{"line":1,"column":40},"end":{"line":1,"column":53}}, "typeParameters": { "type": "TypeParameterInstantiation", - "start": 45, - "end": 53, - "loc": { - "start": { - "line": 1, - "column": 45 - }, - "end": { - "line": 1, - "column": 53 - } - }, + "start":45,"end":53,"loc":{"start":{"line":1,"column":45},"end":{"line":1,"column":53}}, "params": [ { "type": "NumberTypeAnnotation", - "start": 46, - "end": 52, - "loc": { - "start": { - "line": 1, - "column": 46 - }, - "end": { - "line": 1, - "column": 52 - } - } + "start":46,"end":52,"loc":{"start":{"line":1,"column":46},"end":{"line":1,"column":52}} } ] }, "id": { "type": "Identifier", - "start": 40, - "end": 45, - "loc": { - "start": { - "line": 1, - "column": 40 - }, - "end": { - "line": 1, - "column": 45 - }, - "identifierName": "Array" - }, + "start":40,"end":45,"loc":{"start":{"line":1,"column":40},"end":{"line":1,"column":45},"identifierName":"Array"}, "name": "Array" } } }, "returnType": { "type": "NumberTypeAnnotation", - "start": 58, - "end": 64, - "loc": { - "start": { - "line": 1, - "column": 58 - }, - "end": { - "line": 1, - "column": 64 - } - } + "start":58,"end":64,"loc":{"start":{"line":1,"column":58},"end":{"line":1,"column":64}} }, "typeParameters": null } @@ -276,18 +84,7 @@ ], "body": { "type": "BlockStatement", - "start": 65, - "end": 67, - "loc": { - "start": { - "line": 1, - "column": 65 - }, - "end": { - "line": 1, - "column": 67 - } - }, + "start":65,"end":67,"loc":{"start":{"line":1,"column":65},"end":{"line":1,"column":67}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/110/output.json b/packages/babel-parser/test/fixtures/flow/type-annotations/110/output.json index 4b3587d4c8a8..ea777b7cf185 100644 --- a/packages/babel-parser/test/fixtures/flow/type-annotations/110/output.json +++ b/packages/babel-parser/test/fixtures/flow/type-annotations/110/output.json @@ -1,111 +1,32 @@ { "type": "File", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "program": { "type": "Program", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "TypeAlias", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "id": { "type": "Identifier", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "X" - }, + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"X"}, "name": "X" }, "typeParameters": null, "right": { "type": "ObjectTypeAnnotation", - "start": 9, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":9,"end":15,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":15}}, "callProperties": [], "properties": [ { "type": "ObjectTypeProperty", - "start": 10, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":10,"end":14,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":14}}, "key": { "type": "Identifier", - "start": 11, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "p" - }, + "start":11,"end":12,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":12},"identifierName":"p"}, "name": "p" }, "static": false, @@ -114,51 +35,17 @@ "method": false, "value": { "type": "GenericTypeAnnotation", - "start": 13, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":13,"end":14,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":14}}, "typeParameters": null, "id": { "type": "Identifier", - "start": 13, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - }, - "identifierName": "T" - }, + "start":13,"end":14,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":14},"identifierName":"T"}, "name": "T" } }, "variance": { "type": "Variance", - "start": 10, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11}}, "kind": "plus" }, "optional": false diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/111/output.json b/packages/babel-parser/test/fixtures/flow/type-annotations/111/output.json index ec02ec57394d..0f8f2401a39a 100644 --- a/packages/babel-parser/test/fixtures/flow/type-annotations/111/output.json +++ b/packages/babel-parser/test/fixtures/flow/type-annotations/111/output.json @@ -1,111 +1,32 @@ { "type": "File", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "program": { "type": "Program", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "TypeAlias", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "id": { "type": "Identifier", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "X" - }, + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"X"}, "name": "X" }, "typeParameters": null, "right": { "type": "ObjectTypeAnnotation", - "start": 9, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":9,"end":15,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":15}}, "callProperties": [], "properties": [ { "type": "ObjectTypeProperty", - "start": 10, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":10,"end":14,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":14}}, "key": { "type": "Identifier", - "start": 11, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "p" - }, + "start":11,"end":12,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":12},"identifierName":"p"}, "name": "p" }, "static": false, @@ -114,51 +35,17 @@ "method": false, "value": { "type": "GenericTypeAnnotation", - "start": 13, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":13,"end":14,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":14}}, "typeParameters": null, "id": { "type": "Identifier", - "start": 13, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - }, - "identifierName": "T" - }, + "start":13,"end":14,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":14},"identifierName":"T"}, "name": "T" } }, "variance": { "type": "Variance", - "start": 10, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11}}, "kind": "minus" }, "optional": false diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/114/output.json b/packages/babel-parser/test/fixtures/flow/type-annotations/114/output.json index ed6301370237..6014c379ad88 100644 --- a/packages/babel-parser/test/fixtures/flow/type-annotations/114/output.json +++ b/packages/babel-parser/test/fixtures/flow/type-annotations/114/output.json @@ -1,195 +1,59 @@ { "type": "File", - "start": 0, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, "program": { "type": "Program", - "start": 0, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "TypeAlias", - "start": 0, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, "id": { "type": "Identifier", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "X" - }, + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"X"}, "name": "X" }, "typeParameters": null, "right": { "type": "ObjectTypeAnnotation", - "start": 9, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":9,"end":19,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":19}}, "callProperties": [], "properties": [], "indexers": [ { "type": "ObjectTypeIndexer", - "start": 10, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":10,"end":18,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":18}}, "static": false, "id": { "type": "Identifier", - "start": 12, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - }, - "identifierName": "k" - }, + "start":12,"end":13,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":13},"identifierName":"k"}, "name": "k" }, "key": { "type": "GenericTypeAnnotation", - "start": 14, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":14,"end":15,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":15}}, "typeParameters": null, "id": { "type": "Identifier", - "start": 14, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - }, - "identifierName": "K" - }, + "start":14,"end":15,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":15},"identifierName":"K"}, "name": "K" } }, "value": { "type": "GenericTypeAnnotation", - "start": 17, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":17,"end":18,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":18}}, "typeParameters": null, "id": { "type": "Identifier", - "start": 17, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - }, - "identifierName": "V" - }, + "start":17,"end":18,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":18},"identifierName":"V"}, "name": "V" } }, "variance": { "type": "Variance", - "start": 10, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11}}, "kind": "plus" } } diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/115/output.json b/packages/babel-parser/test/fixtures/flow/type-annotations/115/output.json index df1f40c30646..d2b53a640285 100644 --- a/packages/babel-parser/test/fixtures/flow/type-annotations/115/output.json +++ b/packages/babel-parser/test/fixtures/flow/type-annotations/115/output.json @@ -1,195 +1,59 @@ { "type": "File", - "start": 0, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, "program": { "type": "Program", - "start": 0, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "TypeAlias", - "start": 0, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, "id": { "type": "Identifier", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "X" - }, + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"X"}, "name": "X" }, "typeParameters": null, "right": { "type": "ObjectTypeAnnotation", - "start": 9, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":9,"end":19,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":19}}, "callProperties": [], "properties": [], "indexers": [ { "type": "ObjectTypeIndexer", - "start": 10, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":10,"end":18,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":18}}, "static": false, "id": { "type": "Identifier", - "start": 12, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - }, - "identifierName": "k" - }, + "start":12,"end":13,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":13},"identifierName":"k"}, "name": "k" }, "key": { "type": "GenericTypeAnnotation", - "start": 14, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":14,"end":15,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":15}}, "typeParameters": null, "id": { "type": "Identifier", - "start": 14, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - }, - "identifierName": "K" - }, + "start":14,"end":15,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":15},"identifierName":"K"}, "name": "K" } }, "value": { "type": "GenericTypeAnnotation", - "start": 17, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":17,"end":18,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":18}}, "typeParameters": null, "id": { "type": "Identifier", - "start": 17, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - }, - "identifierName": "V" - }, + "start":17,"end":18,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":18},"identifierName":"V"}, "name": "V" } }, "variance": { "type": "Variance", - "start": 10, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11}}, "kind": "minus" } } diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/118/output.json b/packages/babel-parser/test/fixtures/flow/type-annotations/118/output.json index d5d9f7533f09..19cd5a6c089d 100644 --- a/packages/babel-parser/test/fixtures/flow/type-annotations/118/output.json +++ b/packages/babel-parser/test/fixtures/flow/type-annotations/118/output.json @@ -1,174 +1,50 @@ { "type": "File", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "program": { "type": "Program", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "id": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "A" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, "name": "A" }, "superClass": null, "body": { "type": "ClassBody", - "start": 8, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":8,"end":14,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":14}}, "body": [ { "type": "ClassProperty", - "start": 9, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":9,"end":13,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":13}}, "static": false, "key": { "type": "Identifier", - "start": 10, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "p" - }, + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11},"identifierName":"p"}, "name": "p" }, "computed": false, "variance": { "type": "Variance", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10}}, "kind": "plus" }, "typeAnnotation": { "type": "TypeAnnotation", - "start": 11, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":11,"end":13,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":13}}, "typeAnnotation": { "type": "GenericTypeAnnotation", - "start": 12, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":12,"end":13,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":13}}, "typeParameters": null, "id": { "type": "Identifier", - "start": 12, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - }, - "identifierName": "T" - }, + "start":12,"end":13,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":13},"identifierName":"T"}, "name": "T" } } diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/119/output.json b/packages/babel-parser/test/fixtures/flow/type-annotations/119/output.json index 8db7e41bee49..8b942e9bdc1a 100644 --- a/packages/babel-parser/test/fixtures/flow/type-annotations/119/output.json +++ b/packages/babel-parser/test/fixtures/flow/type-annotations/119/output.json @@ -1,174 +1,50 @@ { "type": "File", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "program": { "type": "Program", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "id": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "A" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, "name": "A" }, "superClass": null, "body": { "type": "ClassBody", - "start": 8, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":8,"end":14,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":14}}, "body": [ { "type": "ClassProperty", - "start": 9, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":9,"end":13,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":13}}, "static": false, "key": { "type": "Identifier", - "start": 10, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "p" - }, + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11},"identifierName":"p"}, "name": "p" }, "computed": false, "variance": { "type": "Variance", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10}}, "kind": "minus" }, "typeAnnotation": { "type": "TypeAnnotation", - "start": 11, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":11,"end":13,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":13}}, "typeAnnotation": { "type": "GenericTypeAnnotation", - "start": 12, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":12,"end":13,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":13}}, "typeParameters": null, "id": { "type": "Identifier", - "start": 12, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - }, - "identifierName": "T" - }, + "start":12,"end":13,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":13},"identifierName":"T"}, "name": "T" } } diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/12/output.json b/packages/babel-parser/test/fixtures/flow/type-annotations/12/output.json index 65c1d505734b..57e141cfd792 100644 --- a/packages/babel-parser/test/fixtures/flow/type-annotations/12/output.json +++ b/packages/babel-parser/test/fixtures/flow/type-annotations/12/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "program": { "type": "Program", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "id": { "type": "Identifier", - "start": 9, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "foo" - }, + "start":9,"end":12,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":12},"identifierName":"foo"}, "name": "foo" }, "generator": false, @@ -66,48 +21,15 @@ "predicate": null, "returnType": { "type": "TypeAnnotation", - "start": 14, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":14,"end":21,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":21}}, "typeAnnotation": { "type": "NumberTypeAnnotation", - "start": 15, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 21 - } - } + "start":15,"end":21,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":21}} } }, "body": { "type": "BlockStatement", - "start": 21, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":21,"end":23,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":23}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/127/output.json b/packages/babel-parser/test/fixtures/flow/type-annotations/127/output.json index 165aac2e4caa..a68703eb4f6a 100644 --- a/packages/babel-parser/test/fixtures/flow/type-annotations/127/output.json +++ b/packages/babel-parser/test/fixtures/flow/type-annotations/127/output.json @@ -1,128 +1,39 @@ { "type": "File", - "start": 0, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, "program": { "type": "Program", - "start": 0, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "TypeAlias", - "start": 0, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, "id": { "type": "Identifier", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "A" - }, + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"A"}, "name": "A" }, "typeParameters": null, "right": { "type": "ObjectTypeAnnotation", - "start": 9, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":9,"end":29,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":29}}, "callProperties": [], "properties": [], "indexers": [ { "type": "ObjectTypeIndexer", - "start": 11, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":11,"end":27,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":27}}, "static": false, "id": null, "key": { "type": "StringTypeAnnotation", - "start": 12, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 18 - } - } + "start":12,"end":18,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":18}} }, "value": { "type": "NumberTypeAnnotation", - "start": 21, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 27 - } - } + "start":21,"end":27,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":27}} }, "variance": null } diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/128/output.json b/packages/babel-parser/test/fixtures/flow/type-annotations/128/output.json index 345675c7e135..696aa6b4a2f2 100644 --- a/packages/babel-parser/test/fixtures/flow/type-annotations/128/output.json +++ b/packages/babel-parser/test/fixtures/flow/type-annotations/128/output.json @@ -1,160 +1,49 @@ { "type": "File", - "start": 0, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 40 - } - }, + "start":0,"end":40,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":40}}, "program": { "type": "Program", - "start": 0, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 40 - } - }, + "start":0,"end":40,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":40}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "TypeAlias", - "start": 0, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 40 - } - }, + "start":0,"end":40,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":40}}, "id": { "type": "Identifier", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "A" - }, + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"A"}, "name": "A" }, "typeParameters": null, "right": { "type": "ObjectTypeAnnotation", - "start": 9, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 39 - } - }, + "start":9,"end":39,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":39}}, "callProperties": [], "properties": [], "indexers": [ { "type": "ObjectTypeIndexer", - "start": 11, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 37 - } - }, + "start":11,"end":37,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":37}}, "static": false, "id": null, "key": { "type": "UnionTypeAnnotation", - "start": 12, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":12,"end":28,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":28}}, "types": [ { "type": "StringTypeAnnotation", - "start": 12, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 18 - } - } + "start":12,"end":18,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":18}} }, { "type": "BooleanTypeAnnotation", - "start": 21, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 28 - } - } + "start":21,"end":28,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":28}} } ] }, "value": { "type": "NumberTypeAnnotation", - "start": 31, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 31 - }, - "end": { - "line": 1, - "column": 37 - } - } + "start":31,"end":37,"loc":{"start":{"line":1,"column":31},"end":{"line":1,"column":37}} }, "variance": null } diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/129/output.json b/packages/babel-parser/test/fixtures/flow/type-annotations/129/output.json index 572fa8af86fc..5388de3eda76 100644 --- a/packages/babel-parser/test/fixtures/flow/type-annotations/129/output.json +++ b/packages/babel-parser/test/fixtures/flow/type-annotations/129/output.json @@ -1,122 +1,33 @@ { "type": "File", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 4 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":4}}, "program": { "type": "Program", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 4 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":4}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 4 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":4}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 4, - "column": 3 - } - }, + "start":4,"end":20,"loc":{"start":{"line":1,"column":4},"end":{"line":4,"column":3}}, "id": { "type": "Identifier", - "start": 4, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 3, - "column": 4 - }, - "identifierName": "x" - }, + "start":4,"end":16,"loc":{"start":{"line":1,"column":4},"end":{"line":3,"column":4},"identifierName":"x"}, "name": "x", "typeAnnotation": { "type": "TypeAnnotation", - "start": 5, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 3, - "column": 4 - } - }, + "start":5,"end":16,"loc":{"start":{"line":1,"column":5},"end":{"line":3,"column":4}}, "typeAnnotation": { "type": "UnionTypeAnnotation", - "start": 8, - "end": 16, - "loc": { - "start": { - "line": 2, - "column": 1 - }, - "end": { - "line": 3, - "column": 4 - } - }, + "start":8,"end":16,"loc":{"start":{"line":2,"column":1},"end":{"line":3,"column":4}}, "types": [ { "type": "NumberLiteralTypeAnnotation", - "start": 10, - "end": 11, - "loc": { - "start": { - "line": 2, - "column": 3 - }, - "end": { - "line": 2, - "column": 4 - } - }, + "start":10,"end":11,"loc":{"start":{"line":2,"column":3},"end":{"line":2,"column":4}}, "extra": { "rawValue": 1, "raw": "1" @@ -125,18 +36,7 @@ }, { "type": "NumberLiteralTypeAnnotation", - "start": 15, - "end": 16, - "loc": { - "start": { - "line": 3, - "column": 3 - }, - "end": { - "line": 3, - "column": 4 - } - }, + "start":15,"end":16,"loc":{"start":{"line":3,"column":3},"end":{"line":3,"column":4}}, "extra": { "rawValue": 2, "raw": "2" @@ -149,18 +49,7 @@ }, "init": { "type": "NumericLiteral", - "start": 19, - "end": 20, - "loc": { - "start": { - "line": 4, - "column": 2 - }, - "end": { - "line": 4, - "column": 3 - } - }, + "start":19,"end":20,"loc":{"start":{"line":4,"column":2},"end":{"line":4,"column":3}}, "extra": { "rawValue": 2, "raw": "2" diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/13/output.json b/packages/babel-parser/test/fixtures/flow/type-annotations/13/output.json index e6f9bcabf39d..fe45c3c0e5dc 100644 --- a/packages/babel-parser/test/fixtures/flow/type-annotations/13/output.json +++ b/packages/babel-parser/test/fixtures/flow/type-annotations/13/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, "program": { "type": "Program", - "start": 0, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, "id": { "type": "Identifier", - "start": 9, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "foo" - }, + "start":9,"end":12,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":12},"identifierName":"foo"}, "name": "foo" }, "generator": false, @@ -66,66 +21,22 @@ "predicate": null, "returnType": { "type": "TypeAnnotation", - "start": 14, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":14,"end":25,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":25}}, "typeAnnotation": { "type": "FunctionTypeAnnotation", - "start": 15, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":15,"end":25,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":25}}, "params": [], "rest": null, "returnType": { "type": "VoidTypeAnnotation", - "start": 21, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 25 - } - } + "start":21,"end":25,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":25}} }, "typeParameters": null } }, "body": { "type": "BlockStatement", - "start": 25, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":25,"end":27,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":27}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/130/output.json b/packages/babel-parser/test/fixtures/flow/type-annotations/130/output.json index 1b1c02e6758b..a9fe749cb323 100644 --- a/packages/babel-parser/test/fixtures/flow/type-annotations/130/output.json +++ b/packages/babel-parser/test/fixtures/flow/type-annotations/130/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 45, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 45 - } - }, + "start":0,"end":45,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":45}}, "program": { "type": "Program", - "start": 0, - "end": 45, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 45 - } - }, + "start":0,"end":45,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":45}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 45, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 45 - } - }, + "start":0,"end":45,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":45}}, "id": { "type": "Identifier", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - }, - "identifierName": "x" - }, + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"x"}, "name": "x" }, "generator": false, @@ -65,63 +20,18 @@ "params": [ { "type": "Identifier", - "start": 11, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 21 - }, - "identifierName": "a" - }, + "start":11,"end":21,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":21},"identifierName":"a"}, "name": "a", "typeAnnotation": { "type": "TypeAnnotation", - "start": 12, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":12,"end":21,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":21}}, "typeAnnotation": { "type": "UnionTypeAnnotation", - "start": 14, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":14,"end":21,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":21}}, "types": [ { "type": "NumberLiteralTypeAnnotation", - "start": 16, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":16,"end":17,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":17}}, "extra": { "rawValue": 1, "raw": "1" @@ -130,18 +40,7 @@ }, { "type": "NumberLiteralTypeAnnotation", - "start": 20, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":20,"end":21,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":21}}, "extra": { "rawValue": 2, "raw": "2" @@ -154,63 +53,18 @@ }, { "type": "Identifier", - "start": 23, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 33 - }, - "identifierName": "b" - }, + "start":23,"end":33,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":33},"identifierName":"b"}, "name": "b", "typeAnnotation": { "type": "TypeAnnotation", - "start": 24, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":24,"end":33,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":33}}, "typeAnnotation": { "type": "IntersectionTypeAnnotation", - "start": 26, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":26,"end":33,"loc":{"start":{"line":1,"column":26},"end":{"line":1,"column":33}}, "types": [ { "type": "NumberLiteralTypeAnnotation", - "start": 28, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":28,"end":29,"loc":{"start":{"line":1,"column":28},"end":{"line":1,"column":29}}, "extra": { "rawValue": 3, "raw": "3" @@ -219,18 +73,7 @@ }, { "type": "NumberLiteralTypeAnnotation", - "start": 32, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 32 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":32,"end":33,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":33}}, "extra": { "rawValue": 4, "raw": "4" @@ -245,48 +88,15 @@ "predicate": null, "returnType": { "type": "TypeAnnotation", - "start": 34, - "end": 42, - "loc": { - "start": { - "line": 1, - "column": 34 - }, - "end": { - "line": 1, - "column": 42 - } - }, + "start":34,"end":42,"loc":{"start":{"line":1,"column":34},"end":{"line":1,"column":42}}, "typeAnnotation": { "type": "NumberTypeAnnotation", - "start": 36, - "end": 42, - "loc": { - "start": { - "line": 1, - "column": 36 - }, - "end": { - "line": 1, - "column": 42 - } - } + "start":36,"end":42,"loc":{"start":{"line":1,"column":36},"end":{"line":1,"column":42}} } }, "body": { "type": "BlockStatement", - "start": 43, - "end": 45, - "loc": { - "start": { - "line": 1, - "column": 43 - }, - "end": { - "line": 1, - "column": 45 - } - }, + "start":43,"end":45,"loc":{"start":{"line":1,"column":43},"end":{"line":1,"column":45}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/131/options.json b/packages/babel-parser/test/fixtures/flow/type-annotations/131/options.json deleted file mode 100644 index 50bea8a5db27..000000000000 --- a/packages/babel-parser/test/fixtures/flow/type-annotations/131/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Cannot overwrite reserved type number (1:5)" -} diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/131/output.json b/packages/babel-parser/test/fixtures/flow/type-annotations/131/output.json new file mode 100644 index 000000000000..bd280f5d148b --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/type-annotations/131/output.json @@ -0,0 +1,30 @@ +{ + "type": "File", + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, + "errors": [ + "SyntaxError: Cannot overwrite reserved type number (1:5)" + ], + "program": { + "type": "Program", + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "TypeAlias", + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, + "id": { + "type": "Identifier", + "start":5,"end":11,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":11},"identifierName":"number"}, + "name": "number" + }, + "typeParameters": null, + "right": { + "type": "StringTypeAnnotation", + "start":14,"end":20,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":20}} + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/132/options.json b/packages/babel-parser/test/fixtures/flow/type-annotations/132/options.json deleted file mode 100644 index 257d651b33e2..000000000000 --- a/packages/babel-parser/test/fixtures/flow/type-annotations/132/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Cannot overwrite reserved type number (1:9)" -} diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/132/output.json b/packages/babel-parser/test/fixtures/flow/type-annotations/132/output.json new file mode 100644 index 000000000000..a9ad9925ad29 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/type-annotations/132/output.json @@ -0,0 +1,41 @@ +{ + "type": "File", + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, + "errors": [ + "SyntaxError: Unexpected reserved type number (1:9)" + ], + "program": { + "type": "Program", + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "TypeAlias", + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, + "id": { + "type": "Identifier", + "start":5,"end":8,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":8},"identifierName":"foo"}, + "name": "foo" + }, + "typeParameters": { + "type": "TypeParameterDeclaration", + "start":8,"end":16,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":16}}, + "params": [ + { + "type": "TypeParameter", + "start":9,"end":15,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":15}}, + "name": "number", + "variance": null + } + ] + }, + "right": { + "type": "StringTypeAnnotation", + "start":19,"end":25,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":25}} + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/133/options.json b/packages/babel-parser/test/fixtures/flow/type-annotations/133/options.json deleted file mode 100644 index 2c7a5836d8bc..000000000000 --- a/packages/babel-parser/test/fixtures/flow/type-annotations/133/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Cannot overwrite reserved type string (1:11)" -} diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/133/output.json b/packages/babel-parser/test/fixtures/flow/type-annotations/133/output.json new file mode 100644 index 000000000000..4ffc8971610e --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/type-annotations/133/output.json @@ -0,0 +1,79 @@ +{ + "type": "File", + "start":0,"end":53,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "errors": [ + "SyntaxError: Unexpected reserved type string (1:11)" + ], + "program": { + "type": "Program", + "start":0,"end":53,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":53,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "id": { + "type": "Identifier", + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"a"}, + "name": "a" + }, + "generator": false, + "async": false, + "typeParameters": { + "type": "TypeParameterDeclaration", + "start":10,"end":18,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":18}}, + "params": [ + { + "type": "TypeParameter", + "start":11,"end":17,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":17}}, + "name": "string", + "variance": null + } + ] + }, + "params": [ + { + "type": "Identifier", + "start":19,"end":28,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":28},"identifierName":"x"}, + "name": "x", + "typeAnnotation": { + "type": "TypeAnnotation", + "start":20,"end":28,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":28}}, + "typeAnnotation": { + "type": "StringTypeAnnotation", + "start":22,"end":28,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":28}} + } + } + } + ], + "predicate": null, + "returnType": { + "type": "TypeAnnotation", + "start":29,"end":37,"loc":{"start":{"line":1,"column":29},"end":{"line":1,"column":37}}, + "typeAnnotation": { + "type": "StringTypeAnnotation", + "start":31,"end":37,"loc":{"start":{"line":1,"column":31},"end":{"line":1,"column":37}} + } + }, + "body": { + "type": "BlockStatement", + "start":38,"end":53,"loc":{"start":{"line":1,"column":38},"end":{"line":3,"column":1}}, + "body": [ + { + "type": "ReturnStatement", + "start":42,"end":51,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":11}}, + "argument": { + "type": "Identifier", + "start":49,"end":50,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":10},"identifierName":"x"}, + "name": "x" + } + } + ], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/134/options.json b/packages/babel-parser/test/fixtures/flow/type-annotations/134/options.json deleted file mode 100644 index 396a14ca22d4..000000000000 --- a/packages/babel-parser/test/fixtures/flow/type-annotations/134/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Cannot overwrite reserved type bool (1:13)" -} diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/134/output.json b/packages/babel-parser/test/fixtures/flow/type-annotations/134/output.json new file mode 100644 index 000000000000..6f5bb81982ce --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/type-annotations/134/output.json @@ -0,0 +1,30 @@ +{ + "type": "File", + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, + "errors": [ + "SyntaxError: Cannot overwrite reserved type bool (1:13)" + ], + "program": { + "type": "Program", + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "DeclareTypeAlias", + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, + "id": { + "type": "Identifier", + "start":13,"end":17,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":17},"identifierName":"bool"}, + "name": "bool" + }, + "typeParameters": null, + "right": { + "type": "AnyTypeAnnotation", + "start":20,"end":23,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":23}} + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/135/output.json b/packages/babel-parser/test/fixtures/flow/type-annotations/135/output.json index ce7e04fe7836..977bff7113b7 100644 --- a/packages/babel-parser/test/fixtures/flow/type-annotations/135/output.json +++ b/packages/babel-parser/test/fixtures/flow/type-annotations/135/output.json @@ -1,110 +1,32 @@ { "type": "File", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 2 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":2}}, "program": { "type": "Program", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 2 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":2}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "TypeAlias", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 2 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":2}}, "id": { "type": "Identifier", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "A" - }, + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"A"}, "name": "A" }, "typeParameters": null, "right": { "type": "ObjectTypeAnnotation", - "start": 9, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":9,"end":21,"loc":{"start":{"line":1,"column":9},"end":{"line":3,"column":1}}, "callProperties": [], "properties": [ { "type": "ObjectTypeSpreadProperty", - "start": 12, - "end": 18, - "loc": { - "start": { - "line": 2, - "column": 1 - }, - "end": { - "line": 2, - "column": 7 - } - }, + "start":12,"end":18,"loc":{"start":{"line":2,"column":1},"end":{"line":2,"column":7}}, "argument": { "type": "AnyTypeAnnotation", - "start": 15, - "end": 18, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 7 - } - } + "start":15,"end":18,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":7}} } } ], diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/136/output.json b/packages/babel-parser/test/fixtures/flow/type-annotations/136/output.json index bdd81eaa2c09..fcd59e9c91eb 100644 --- a/packages/babel-parser/test/fixtures/flow/type-annotations/136/output.json +++ b/packages/babel-parser/test/fixtures/flow/type-annotations/136/output.json @@ -1,111 +1,32 @@ { "type": "File", - "start": 0, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 2 - } - }, + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":2}}, "program": { "type": "Program", - "start": 0, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 2 - } - }, + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":2}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "TypeAlias", - "start": 0, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 2 - } - }, + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":2}}, "id": { "type": "Identifier", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "A" - }, + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"A"}, "name": "A" }, "typeParameters": null, "right": { "type": "ObjectTypeAnnotation", - "start": 9, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":9,"end":28,"loc":{"start":{"line":1,"column":9},"end":{"line":4,"column":1}}, "callProperties": [], "properties": [ { "type": "ObjectTypeProperty", - "start": 12, - "end": 17, - "loc": { - "start": { - "line": 2, - "column": 1 - }, - "end": { - "line": 2, - "column": 6 - } - }, + "start":12,"end":17,"loc":{"start":{"line":2,"column":1},"end":{"line":2,"column":6}}, "key": { "type": "Identifier", - "start": 12, - "end": 13, - "loc": { - "start": { - "line": 2, - "column": 1 - }, - "end": { - "line": 2, - "column": 2 - }, - "identifierName": "p" - }, + "start":12,"end":13,"loc":{"start":{"line":2,"column":1},"end":{"line":2,"column":2},"identifierName":"p"}, "name": "p" }, "static": false, @@ -114,18 +35,7 @@ "method": false, "value": { "type": "ObjectTypeAnnotation", - "start": 15, - "end": 17, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 6 - } - }, + "start":15,"end":17,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":6}}, "callProperties": [], "properties": [], "indexers": [], @@ -138,32 +48,10 @@ }, { "type": "ObjectTypeSpreadProperty", - "start": 20, - "end": 25, - "loc": { - "start": { - "line": 3, - "column": 1 - }, - "end": { - "line": 3, - "column": 6 - } - }, + "start":20,"end":25,"loc":{"start":{"line":3,"column":1},"end":{"line":3,"column":6}}, "argument": { "type": "ObjectTypeAnnotation", - "start": 23, - "end": 25, - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 6 - } - }, + "start":23,"end":25,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":6}}, "callProperties": [], "properties": [], "indexers": [], diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/137/options.json b/packages/babel-parser/test/fixtures/flow/type-annotations/137/options.json deleted file mode 100644 index 786acad32af0..000000000000 --- a/packages/babel-parser/test/fixtures/flow/type-annotations/137/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Spread operator cannot appear in class or interface definitions (2:1)" -} diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/137/output.json b/packages/babel-parser/test/fixtures/flow/type-annotations/137/output.json new file mode 100644 index 000000000000..1c70bbf4c422 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/type-annotations/137/output.json @@ -0,0 +1,51 @@ +{ + "type": "File", + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":2}}, + "errors": [ + "SyntaxError: Spread operator cannot appear in class or interface definitions (2:1)" + ], + "program": { + "type": "Program", + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":2}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "InterfaceDeclaration", + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "id": { + "type": "Identifier", + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11},"identifierName":"A"}, + "name": "A" + }, + "typeParameters": null, + "extends": [], + "implements": [], + "mixins": [], + "body": { + "type": "ObjectTypeAnnotation", + "start":12,"end":24,"loc":{"start":{"line":1,"column":12},"end":{"line":3,"column":1}}, + "callProperties": [], + "properties": [ + { + "type": "ObjectTypeSpreadProperty", + "start":15,"end":21,"loc":{"start":{"line":2,"column":1},"end":{"line":2,"column":7}}, + "argument": { + "type": "AnyTypeAnnotation", + "start":18,"end":21,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":7}} + } + } + ], + "indexers": [], + "internalSlots": [], + "exact": false + } + }, + { + "type": "EmptyStatement", + "start":24,"end":25,"loc":{"start":{"line":3,"column":1},"end":{"line":3,"column":2}} + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/138/output.json b/packages/babel-parser/test/fixtures/flow/type-annotations/138/output.json index 6e48beeb05dc..85b02bb6fd2b 100644 --- a/packages/babel-parser/test/fixtures/flow/type-annotations/138/output.json +++ b/packages/babel-parser/test/fixtures/flow/type-annotations/138/output.json @@ -1,272 +1,80 @@ { "type": "File", - "start": 0, - "end": 43, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 2 - } - }, + "start":0,"end":43,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":2}}, "program": { "type": "Program", - "start": 0, - "end": 43, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 2 - } - }, + "start":0,"end":43,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":2}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, "id": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "A" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, "name": "A" }, "superClass": null, "body": { "type": "ClassBody", - "start": 8, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":8,"end":10,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":10}}, "body": [] } }, { "type": "ClassDeclaration", - "start": 11, - "end": 21, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 10 - } - }, + "start":11,"end":21,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":10}}, "id": { "type": "Identifier", - "start": 17, - "end": 18, - "loc": { - "start": { - "line": 2, - "column": 6 - }, - "end": { - "line": 2, - "column": 7 - }, - "identifierName": "B" - }, + "start":17,"end":18,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":7},"identifierName":"B"}, "name": "B" }, "superClass": null, "body": { "type": "ClassBody", - "start": 19, - "end": 21, - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 10 - } - }, + "start":19,"end":21,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":10}}, "body": [] } }, { "type": "TypeAlias", - "start": 22, - "end": 43, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 5, - "column": 2 - } - }, + "start":22,"end":43,"loc":{"start":{"line":3,"column":0},"end":{"line":5,"column":2}}, "id": { "type": "Identifier", - "start": 27, - "end": 28, - "loc": { - "start": { - "line": 3, - "column": 5 - }, - "end": { - "line": 3, - "column": 6 - }, - "identifierName": "C" - }, + "start":27,"end":28,"loc":{"start":{"line":3,"column":5},"end":{"line":3,"column":6},"identifierName":"C"}, "name": "C" }, "typeParameters": null, "right": { "type": "ObjectTypeAnnotation", - "start": 31, - "end": 42, - "loc": { - "start": { - "line": 3, - "column": 9 - }, - "end": { - "line": 5, - "column": 1 - } - }, + "start":31,"end":42,"loc":{"start":{"line":3,"column":9},"end":{"line":5,"column":1}}, "callProperties": [], "properties": [ { "type": "ObjectTypeSpreadProperty", - "start": 34, - "end": 40, - "loc": { - "start": { - "line": 4, - "column": 1 - }, - "end": { - "line": 4, - "column": 7 - } - }, + "start":34,"end":40,"loc":{"start":{"line":4,"column":1},"end":{"line":4,"column":7}}, "argument": { "type": "IntersectionTypeAnnotation", - "start": 37, - "end": 40, - "loc": { - "start": { - "line": 4, - "column": 4 - }, - "end": { - "line": 4, - "column": 7 - } - }, + "start":37,"end":40,"loc":{"start":{"line":4,"column":4},"end":{"line":4,"column":7}}, "types": [ { "type": "GenericTypeAnnotation", - "start": 37, - "end": 38, - "loc": { - "start": { - "line": 4, - "column": 4 - }, - "end": { - "line": 4, - "column": 5 - } - }, + "start":37,"end":38,"loc":{"start":{"line":4,"column":4},"end":{"line":4,"column":5}}, "typeParameters": null, "id": { "type": "Identifier", - "start": 37, - "end": 38, - "loc": { - "start": { - "line": 4, - "column": 4 - }, - "end": { - "line": 4, - "column": 5 - }, - "identifierName": "A" - }, + "start":37,"end":38,"loc":{"start":{"line":4,"column":4},"end":{"line":4,"column":5},"identifierName":"A"}, "name": "A" } }, { "type": "GenericTypeAnnotation", - "start": 39, - "end": 40, - "loc": { - "start": { - "line": 4, - "column": 6 - }, - "end": { - "line": 4, - "column": 7 - } - }, + "start":39,"end":40,"loc":{"start":{"line":4,"column":6},"end":{"line":4,"column":7}}, "typeParameters": null, "id": { "type": "Identifier", - "start": 39, - "end": 40, - "loc": { - "start": { - "line": 4, - "column": 6 - }, - "end": { - "line": 4, - "column": 7 - }, - "identifierName": "B" - }, + "start":39,"end":40,"loc":{"start":{"line":4,"column":6},"end":{"line":4,"column":7},"identifierName":"B"}, "name": "B" } } diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/139/options.json b/packages/babel-parser/test/fixtures/flow/type-annotations/139/options.json deleted file mode 100644 index 2b0782bcbc3e..000000000000 --- a/packages/babel-parser/test/fixtures/flow/type-annotations/139/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Spread properties cannot have variance (3:1)" -} diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/139/output.json b/packages/babel-parser/test/fixtures/flow/type-annotations/139/output.json new file mode 100644 index 000000000000..f3000dfc4440 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/type-annotations/139/output.json @@ -0,0 +1,66 @@ +{ + "type": "File", + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":2}}, + "errors": [ + "SyntaxError: Spread properties cannot have variance (3:1)" + ], + "program": { + "type": "Program", + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":2}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "id": { + "type": "Identifier", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":8,"end":10,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":10}}, + "body": [] + } + }, + { + "type": "TypeAlias", + "start":11,"end":31,"loc":{"start":{"line":2,"column":0},"end":{"line":4,"column":2}}, + "id": { + "type": "Identifier", + "start":16,"end":17,"loc":{"start":{"line":2,"column":5},"end":{"line":2,"column":6},"identifierName":"C"}, + "name": "C" + }, + "typeParameters": null, + "right": { + "type": "ObjectTypeAnnotation", + "start":20,"end":30,"loc":{"start":{"line":2,"column":9},"end":{"line":4,"column":1}}, + "callProperties": [], + "properties": [ + { + "type": "ObjectTypeSpreadProperty", + "start":23,"end":28,"loc":{"start":{"line":3,"column":1},"end":{"line":3,"column":6}}, + "argument": { + "type": "GenericTypeAnnotation", + "start":27,"end":28,"loc":{"start":{"line":3,"column":5},"end":{"line":3,"column":6}}, + "typeParameters": null, + "id": { + "type": "Identifier", + "start":27,"end":28,"loc":{"start":{"line":3,"column":5},"end":{"line":3,"column":6},"identifierName":"A"}, + "name": "A" + } + } + } + ], + "indexers": [], + "internalSlots": [], + "exact": false, + "inexact": false + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/14/output.json b/packages/babel-parser/test/fixtures/flow/type-annotations/14/output.json index f3c78da12ed4..9360adf64e81 100644 --- a/packages/babel-parser/test/fixtures/flow/type-annotations/14/output.json +++ b/packages/babel-parser/test/fixtures/flow/type-annotations/14/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":35}}, "program": { "type": "Program", - "start": 0, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":35}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":35}}, "id": { "type": "Identifier", - "start": 9, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "foo" - }, + "start":9,"end":12,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":12},"identifierName":"foo"}, "name": "foo" }, "generator": false, @@ -66,115 +21,37 @@ "predicate": null, "returnType": { "type": "TypeAnnotation", - "start": 14, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":14,"end":33,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":33}}, "typeAnnotation": { "type": "FunctionTypeAnnotation", - "start": 15, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":15,"end":33,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":33}}, "params": [ { "type": "FunctionTypeParam", - "start": 16, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":16,"end":22,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":22}}, "name": { "type": "Identifier", - "start": 16, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - }, - "identifierName": "_" - }, + "start":16,"end":17,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":17},"identifierName":"_"}, "name": "_" }, "optional": false, "typeAnnotation": { "type": "BooleanTypeAnnotation", - "start": 18, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 22 - } - } + "start":18,"end":22,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":22}} } } ], "rest": null, "returnType": { "type": "NumberTypeAnnotation", - "start": 27, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 33 - } - } + "start":27,"end":33,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":33}} }, "typeParameters": null } }, "body": { "type": "BlockStatement", - "start": 33, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 33 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":33,"end":35,"loc":{"start":{"line":1,"column":33},"end":{"line":1,"column":35}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/15/output.json b/packages/babel-parser/test/fixtures/flow/type-annotations/15/output.json index 6631ac13ba36..f74434914038 100644 --- a/packages/babel-parser/test/fixtures/flow/type-annotations/15/output.json +++ b/packages/babel-parser/test/fixtures/flow/type-annotations/15/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, "program": { "type": "Program", - "start": 0, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, "id": { "type": "Identifier", - "start": 9, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "foo" - }, + "start":9,"end":12,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":12},"identifierName":"foo"}, "name": "foo" }, "generator": false, @@ -66,115 +21,37 @@ "predicate": null, "returnType": { "type": "TypeAnnotation", - "start": 14, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":14,"end":34,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":34}}, "typeAnnotation": { "type": "FunctionTypeAnnotation", - "start": 15, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":15,"end":34,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":34}}, "params": [ { "type": "FunctionTypeParam", - "start": 16, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":16,"end":23,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":23}}, "name": { "type": "Identifier", - "start": 16, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - }, - "identifierName": "_" - }, + "start":16,"end":17,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":17},"identifierName":"_"}, "name": "_" }, "optional": true, "typeAnnotation": { "type": "BooleanTypeAnnotation", - "start": 19, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 23 - } - } + "start":19,"end":23,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":23}} } } ], "rest": null, "returnType": { "type": "NumberTypeAnnotation", - "start": 28, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 34 - } - } + "start":28,"end":34,"loc":{"start":{"line":1,"column":28},"end":{"line":1,"column":34}} }, "typeParameters": null } }, "body": { "type": "BlockStatement", - "start": 34, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 34 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":34,"end":36,"loc":{"start":{"line":1,"column":34},"end":{"line":1,"column":36}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/16/output.json b/packages/babel-parser/test/fixtures/flow/type-annotations/16/output.json index 59fe3a8d364e..26c61b4ee1b0 100644 --- a/packages/babel-parser/test/fixtures/flow/type-annotations/16/output.json +++ b/packages/babel-parser/test/fixtures/flow/type-annotations/16/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, "program": { "type": "Program", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, "id": { "type": "Identifier", - "start": 9, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "foo" - }, + "start":9,"end":12,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":12},"identifierName":"foo"}, "name": "foo" }, "generator": false, @@ -66,32 +21,10 @@ "predicate": null, "returnType": { "type": "TypeAnnotation", - "start": 14, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":14,"end":18,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":18}}, "typeAnnotation": { "type": "ObjectTypeAnnotation", - "start": 16, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":16,"end":18,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":18}}, "callProperties": [], "properties": [], "indexers": [], @@ -102,18 +35,7 @@ }, "body": { "type": "BlockStatement", - "start": 19, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":19,"end":21,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":21}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/17/output.json b/packages/babel-parser/test/fixtures/flow/type-annotations/17/output.json index 9996d286ce75..eb1235cabc11 100644 --- a/packages/babel-parser/test/fixtures/flow/type-annotations/17/output.json +++ b/packages/babel-parser/test/fixtures/flow/type-annotations/17/output.json @@ -1,96 +1,29 @@ { "type": "File", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, "program": { "type": "Program", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, "id": { "type": "Identifier", - "start": 9, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "foo" - }, + "start":9,"end":12,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":12},"identifierName":"foo"}, "name": "foo" }, "generator": false, "async": false, "typeParameters": { "type": "TypeParameterDeclaration", - "start": 12, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":12,"end":15,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":15}}, "params": [ { "type": "TypeParameter", - "start": 13, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":13,"end":14,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":14}}, "name": "T", "variance": null } @@ -99,18 +32,7 @@ "params": [], "body": { "type": "BlockStatement", - "start": 18, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":18,"end":20,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":20}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/18/output.json b/packages/babel-parser/test/fixtures/flow/type-annotations/18/output.json index 3b6ab163afd8..b897ae74356c 100644 --- a/packages/babel-parser/test/fixtures/flow/type-annotations/18/output.json +++ b/packages/babel-parser/test/fixtures/flow/type-annotations/18/output.json @@ -1,113 +1,35 @@ { "type": "File", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "program": { "type": "Program", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "id": { "type": "Identifier", - "start": 9, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "foo" - }, + "start":9,"end":12,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":12},"identifierName":"foo"}, "name": "foo" }, "generator": false, "async": false, "typeParameters": { "type": "TypeParameterDeclaration", - "start": 12, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":12,"end":17,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":17}}, "params": [ { "type": "TypeParameter", - "start": 13, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":13,"end":14,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":14}}, "name": "T", "variance": null }, { "type": "TypeParameter", - "start": 15, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":15,"end":16,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":16}}, "name": "S", "variance": null } @@ -116,18 +38,7 @@ "params": [], "body": { "type": "BlockStatement", - "start": 20, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":20,"end":22,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":22}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/19/output.json b/packages/babel-parser/test/fixtures/flow/type-annotations/19/output.json index e78a8bfedd6d..79e4e33dcdd0 100644 --- a/packages/babel-parser/test/fixtures/flow/type-annotations/19/output.json +++ b/packages/babel-parser/test/fixtures/flow/type-annotations/19/output.json @@ -1,143 +1,43 @@ { "type": "File", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, "program": { "type": "Program", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, "expression": { "type": "AssignmentExpression", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, "operator": "=", "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "a" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"a"}, "name": "a" }, "right": { "type": "FunctionExpression", - "start": 2, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":2,"end":20,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":20}}, "id": null, "generator": false, "async": false, "typeParameters": { "type": "TypeParameterDeclaration", - "start": 10, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":10,"end":15,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":15}}, "params": [ { "type": "TypeParameter", - "start": 11, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":11,"end":12,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":12}}, "name": "T", "variance": null }, { "type": "TypeParameter", - "start": 13, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":13,"end":14,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":14}}, "name": "S", "variance": null } @@ -146,18 +46,7 @@ "params": [], "body": { "type": "BlockStatement", - "start": 18, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":18,"end":20,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":20}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/2/output.json b/packages/babel-parser/test/fixtures/flow/type-annotations/2/output.json index 4dfea64edadc..35af6cc8d2ab 100644 --- a/packages/babel-parser/test/fixtures/flow/type-annotations/2/output.json +++ b/packages/babel-parser/test/fixtures/flow/type-annotations/2/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, "program": { "type": "Program", - "start": 0, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, "id": { "type": "Identifier", - "start": 9, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "foo" - }, + "start":9,"end":12,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":12},"identifierName":"foo"}, "name": "foo" }, "generator": false, @@ -65,66 +20,21 @@ "params": [ { "type": "Identifier", - "start": 13, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 27 - }, - "identifierName": "numVal" - }, + "start":13,"end":27,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":27},"identifierName":"numVal"}, "name": "numVal", "typeAnnotation": { "type": "TypeAnnotation", - "start": 19, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":19,"end":27,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":27}}, "typeAnnotation": { "type": "NumberTypeAnnotation", - "start": 21, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 27 - } - } + "start":21,"end":27,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":27}} } } } ], "body": { "type": "BlockStatement", - "start": 28, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":28,"end":30,"loc":{"start":{"line":1,"column":28},"end":{"line":1,"column":30}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/20/output.json b/packages/babel-parser/test/fixtures/flow/type-annotations/20/output.json index 040ff5318a87..82b7ad2a9684 100644 --- a/packages/babel-parser/test/fixtures/flow/type-annotations/20/output.json +++ b/packages/babel-parser/test/fixtures/flow/type-annotations/20/output.json @@ -1,125 +1,35 @@ { "type": "File", - "start": 0, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, "program": { "type": "Program", - "start": 0, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, "expression": { "type": "AssignmentExpression", - "start": 0, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, "operator": "=", "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "a" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"a"}, "name": "a" }, "right": { "type": "ObjectExpression", - "start": 2, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":2,"end":31,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":31}}, "properties": [ { "type": "ObjectMethod", - "start": 3, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":3,"end":30,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":30}}, "method": false, "key": { "type": "Identifier", - "start": 7, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 14 - }, - "identifierName": "fooProp" - }, + "start":7,"end":14,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":14},"identifierName":"fooProp"}, "name": "fooProp" }, "computed": false, @@ -131,66 +41,21 @@ "params": [ { "type": "Identifier", - "start": 15, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 27 - }, - "identifierName": "value" - }, + "start":15,"end":27,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":27},"identifierName":"value"}, "name": "value", "typeAnnotation": { "type": "TypeAnnotation", - "start": 20, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":20,"end":27,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":27}}, "typeAnnotation": { "type": "NumberTypeAnnotation", - "start": 21, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 27 - } - } + "start":21,"end":27,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":27}} } } } ], "body": { "type": "BlockStatement", - "start": 28, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":28,"end":30,"loc":{"start":{"line":1,"column":28},"end":{"line":1,"column":30}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/21/output.json b/packages/babel-parser/test/fixtures/flow/type-annotations/21/output.json index 3e1eebe5e66a..1ac23f768bd3 100644 --- a/packages/babel-parser/test/fixtures/flow/type-annotations/21/output.json +++ b/packages/babel-parser/test/fixtures/flow/type-annotations/21/output.json @@ -1,125 +1,35 @@ { "type": "File", - "start": 0, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, "program": { "type": "Program", - "start": 0, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, "expression": { "type": "AssignmentExpression", - "start": 0, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, "operator": "=", "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "a" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"a"}, "name": "a" }, "right": { "type": "ObjectExpression", - "start": 2, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":2,"end":36,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":36}}, "properties": [ { "type": "ObjectMethod", - "start": 3, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":3,"end":35,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":35}}, "method": false, "key": { "type": "Identifier", - "start": 7, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 14 - }, - "identifierName": "fooProp" - }, + "start":7,"end":14,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":14},"identifierName":"fooProp"}, "name": "fooProp" }, "computed": false, @@ -131,48 +41,14 @@ "params": [ { "type": "Identifier", - "start": 15, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 27 - }, - "identifierName": "value" - }, + "start":15,"end":27,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":27},"identifierName":"value"}, "name": "value", "typeAnnotation": { "type": "TypeAnnotation", - "start": 20, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":20,"end":27,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":27}}, "typeAnnotation": { "type": "NumberTypeAnnotation", - "start": 21, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 27 - } - } + "start":21,"end":27,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":27}} } } } @@ -180,48 +56,15 @@ "predicate": null, "returnType": { "type": "TypeAnnotation", - "start": 28, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":28,"end":33,"loc":{"start":{"line":1,"column":28},"end":{"line":1,"column":33}}, "typeAnnotation": { "type": "VoidTypeAnnotation", - "start": 29, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 1, - "column": 33 - } - } + "start":29,"end":33,"loc":{"start":{"line":1,"column":29},"end":{"line":1,"column":33}} } }, "body": { "type": "BlockStatement", - "start": 33, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 33 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":33,"end":35,"loc":{"start":{"line":1,"column":33},"end":{"line":1,"column":35}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/22/output.json b/packages/babel-parser/test/fixtures/flow/type-annotations/22/output.json index c6dd81472c76..d9e9cf02431f 100644 --- a/packages/babel-parser/test/fixtures/flow/type-annotations/22/output.json +++ b/packages/babel-parser/test/fixtures/flow/type-annotations/22/output.json @@ -1,125 +1,35 @@ { "type": "File", - "start": 0, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, "program": { "type": "Program", - "start": 0, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, "expression": { "type": "AssignmentExpression", - "start": 0, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, "operator": "=", "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "a" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"a"}, "name": "a" }, "right": { "type": "ObjectExpression", - "start": 2, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":2,"end":26,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":26}}, "properties": [ { "type": "ObjectMethod", - "start": 3, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":3,"end":25,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":25}}, "method": false, "key": { "type": "Identifier", - "start": 7, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 14 - }, - "identifierName": "fooProp" - }, + "start":7,"end":14,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":14},"identifierName":"fooProp"}, "name": "fooProp" }, "computed": false, @@ -132,48 +42,15 @@ "predicate": null, "returnType": { "type": "TypeAnnotation", - "start": 16, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":16,"end":23,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":23}}, "typeAnnotation": { "type": "NumberTypeAnnotation", - "start": 17, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 23 - } - } + "start":17,"end":23,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":23}} } }, "body": { "type": "BlockStatement", - "start": 23, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":23,"end":25,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":25}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/23/output.json b/packages/babel-parser/test/fixtures/flow/type-annotations/23/output.json index fdb2eedcb099..802ad5904c55 100644 --- a/packages/babel-parser/test/fixtures/flow/type-annotations/23/output.json +++ b/packages/babel-parser/test/fixtures/flow/type-annotations/23/output.json @@ -1,125 +1,35 @@ { "type": "File", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, "program": { "type": "Program", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, "expression": { "type": "AssignmentExpression", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, "operator": "=", "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "a" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"a"}, "name": "a" }, "right": { "type": "ObjectExpression", - "start": 2, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":2,"end":21,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":21}}, "properties": [ { "type": "ObjectMethod", - "start": 3, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":3,"end":20,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":20}}, "method": true, "key": { "type": "Identifier", - "start": 3, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "id" - }, + "start":3,"end":5,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":5},"identifierName":"id"}, "name": "id" }, "computed": false, @@ -130,64 +40,18 @@ "params": [ { "type": "Identifier", - "start": 9, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 13 - }, - "identifierName": "x" - }, + "start":9,"end":13,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":13},"identifierName":"x"}, "name": "x", "typeAnnotation": { "type": "TypeAnnotation", - "start": 10, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":10,"end":13,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":13}}, "typeAnnotation": { "type": "GenericTypeAnnotation", - "start": 12, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":12,"end":13,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":13}}, "typeParameters": null, "id": { "type": "Identifier", - "start": 12, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - }, - "identifierName": "T" - }, + "start":12,"end":13,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":13},"identifierName":"T"}, "name": "T" } } @@ -197,98 +61,31 @@ "predicate": null, "returnType": { "type": "TypeAnnotation", - "start": 14, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":14,"end":17,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":17}}, "typeAnnotation": { "type": "GenericTypeAnnotation", - "start": 16, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":16,"end":17,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":17}}, "typeParameters": null, "id": { "type": "Identifier", - "start": 16, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - }, - "identifierName": "T" - }, + "start":16,"end":17,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":17},"identifierName":"T"}, "name": "T" } } }, "body": { "type": "BlockStatement", - "start": 18, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":18,"end":20,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":20}}, "body": [], "directives": [] }, "typeParameters": { "type": "TypeParameterDeclaration", - "start": 5, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":5,"end":8,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":8}}, "params": [ { "type": "TypeParameter", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7}}, "name": "T", "variance": null } diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/24/output.json b/packages/babel-parser/test/fixtures/flow/type-annotations/24/output.json index 243a1e66ff3d..af9300c4a2e0 100644 --- a/packages/babel-parser/test/fixtures/flow/type-annotations/24/output.json +++ b/packages/babel-parser/test/fixtures/flow/type-annotations/24/output.json @@ -1,125 +1,35 @@ { "type": "File", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "program": { "type": "Program", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "expression": { "type": "AssignmentExpression", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "operator": "=", "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "a" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"a"}, "name": "a" }, "right": { "type": "ObjectExpression", - "start": 2, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":2,"end":22,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":22}}, "properties": [ { "type": "ObjectMethod", - "start": 3, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":3,"end":21,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":21}}, "method": true, "key": { "type": "Identifier", - "start": 4, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "id" - }, + "start":4,"end":6,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":6},"identifierName":"id"}, "name": "id" }, "computed": false, @@ -130,64 +40,18 @@ "params": [ { "type": "Identifier", - "start": 10, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 14 - }, - "identifierName": "x" - }, + "start":10,"end":14,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":14},"identifierName":"x"}, "name": "x", "typeAnnotation": { "type": "TypeAnnotation", - "start": 11, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":11,"end":14,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":14}}, "typeAnnotation": { "type": "GenericTypeAnnotation", - "start": 13, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":13,"end":14,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":14}}, "typeParameters": null, "id": { "type": "Identifier", - "start": 13, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - }, - "identifierName": "T" - }, + "start":13,"end":14,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":14},"identifierName":"T"}, "name": "T" } } @@ -197,98 +61,31 @@ "predicate": null, "returnType": { "type": "TypeAnnotation", - "start": 15, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":15,"end":18,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":18}}, "typeAnnotation": { "type": "GenericTypeAnnotation", - "start": 17, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":17,"end":18,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":18}}, "typeParameters": null, "id": { "type": "Identifier", - "start": 17, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - }, - "identifierName": "T" - }, + "start":17,"end":18,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":18},"identifierName":"T"}, "name": "T" } } }, "body": { "type": "BlockStatement", - "start": 19, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":19,"end":21,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":21}}, "body": [], "directives": [] }, "typeParameters": { "type": "TypeParameterDeclaration", - "start": 6, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":6,"end":9,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":9}}, "params": [ { "type": "TypeParameter", - "start": 7, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8}}, "name": "T", "variance": null } diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/25/output.json b/packages/babel-parser/test/fixtures/flow/type-annotations/25/output.json index 1a1c2f0c3a39..960cfe4635d0 100644 --- a/packages/babel-parser/test/fixtures/flow/type-annotations/25/output.json +++ b/packages/babel-parser/test/fixtures/flow/type-annotations/25/output.json @@ -1,125 +1,35 @@ { "type": "File", - "start": 0, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, "program": { "type": "Program", - "start": 0, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, "expression": { "type": "AssignmentExpression", - "start": 0, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, "operator": "=", "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "a" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"a"}, "name": "a" }, "right": { "type": "ObjectExpression", - "start": 2, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":2,"end":27,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":27}}, "properties": [ { "type": "ObjectMethod", - "start": 3, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":3,"end":26,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":26}}, "method": true, "key": { "type": "Identifier", - "start": 9, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "id" - }, + "start":9,"end":11,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":11},"identifierName":"id"}, "name": "id" }, "computed": false, @@ -130,64 +40,18 @@ "params": [ { "type": "Identifier", - "start": 15, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 19 - }, - "identifierName": "x" - }, + "start":15,"end":19,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":19},"identifierName":"x"}, "name": "x", "typeAnnotation": { "type": "TypeAnnotation", - "start": 16, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":16,"end":19,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":19}}, "typeAnnotation": { "type": "GenericTypeAnnotation", - "start": 18, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":18,"end":19,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":19}}, "typeParameters": null, "id": { "type": "Identifier", - "start": 18, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - }, - "identifierName": "T" - }, + "start":18,"end":19,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":19},"identifierName":"T"}, "name": "T" } } @@ -197,98 +61,31 @@ "predicate": null, "returnType": { "type": "TypeAnnotation", - "start": 20, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":20,"end":23,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":23}}, "typeAnnotation": { "type": "GenericTypeAnnotation", - "start": 22, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":22,"end":23,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":23}}, "typeParameters": null, "id": { "type": "Identifier", - "start": 22, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 23 - }, - "identifierName": "T" - }, + "start":22,"end":23,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":23},"identifierName":"T"}, "name": "T" } } }, "body": { "type": "BlockStatement", - "start": 24, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":24,"end":26,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":26}}, "body": [], "directives": [] }, "typeParameters": { "type": "TypeParameterDeclaration", - "start": 11, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":11,"end":14,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":14}}, "params": [ { "type": "TypeParameter", - "start": 12, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":12,"end":13,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":13}}, "name": "T", "variance": null } diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/26/output.json b/packages/babel-parser/test/fixtures/flow/type-annotations/26/output.json index b71853c1e1c4..910ef40401ae 100644 --- a/packages/babel-parser/test/fixtures/flow/type-annotations/26/output.json +++ b/packages/babel-parser/test/fixtures/flow/type-annotations/26/output.json @@ -1,124 +1,35 @@ { "type": "File", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "program": { "type": "Program", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "expression": { "type": "AssignmentExpression", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "operator": "=", "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "a" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"a"}, "name": "a" }, "right": { "type": "ObjectExpression", - "start": 2, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":2,"end":22,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":22}}, "properties": [ { "type": "ObjectMethod", - "start": 3, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":3,"end":21,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":21}}, "method": true, "key": { "type": "NumericLiteral", - "start": 3, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":3,"end":6,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":6}}, "extra": { "rawValue": 123, "raw": "123" @@ -133,64 +44,18 @@ "params": [ { "type": "Identifier", - "start": 10, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 14 - }, - "identifierName": "x" - }, + "start":10,"end":14,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":14},"identifierName":"x"}, "name": "x", "typeAnnotation": { "type": "TypeAnnotation", - "start": 11, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":11,"end":14,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":14}}, "typeAnnotation": { "type": "GenericTypeAnnotation", - "start": 13, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":13,"end":14,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":14}}, "typeParameters": null, "id": { "type": "Identifier", - "start": 13, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - }, - "identifierName": "T" - }, + "start":13,"end":14,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":14},"identifierName":"T"}, "name": "T" } } @@ -200,98 +65,31 @@ "predicate": null, "returnType": { "type": "TypeAnnotation", - "start": 15, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":15,"end":18,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":18}}, "typeAnnotation": { "type": "GenericTypeAnnotation", - "start": 17, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":17,"end":18,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":18}}, "typeParameters": null, "id": { "type": "Identifier", - "start": 17, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - }, - "identifierName": "T" - }, + "start":17,"end":18,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":18},"identifierName":"T"}, "name": "T" } } }, "body": { "type": "BlockStatement", - "start": 19, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":19,"end":21,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":21}}, "body": [], "directives": [] }, "typeParameters": { "type": "TypeParameterDeclaration", - "start": 6, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":6,"end":9,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":9}}, "params": [ { "type": "TypeParameter", - "start": 7, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8}}, "name": "T", "variance": null } diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/27/output.json b/packages/babel-parser/test/fixtures/flow/type-annotations/27/output.json index d69487e11e27..a4834c4fa0d9 100644 --- a/packages/babel-parser/test/fixtures/flow/type-annotations/27/output.json +++ b/packages/babel-parser/test/fixtures/flow/type-annotations/27/output.json @@ -1,111 +1,32 @@ { "type": "File", - "start": 0, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 39 - } - }, + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":39}}, "program": { "type": "Program", - "start": 0, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 39 - } - }, + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":39}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 39 - } - }, + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":39}}, "id": { "type": "Identifier", - "start": 6, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "Foo" - }, + "start":6,"end":9,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":9},"identifierName":"Foo"}, "name": "Foo" }, "superClass": null, "body": { "type": "ClassBody", - "start": 10, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 39 - } - }, + "start":10,"end":39,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":39}}, "body": [ { "type": "ClassMethod", - "start": 11, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":11,"end":38,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":38}}, "static": false, "key": { "type": "Identifier", - "start": 15, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 22 - }, - "identifierName": "fooProp" - }, + "start":15,"end":22,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":22},"identifierName":"fooProp"}, "name": "fooProp" }, "computed": false, @@ -116,66 +37,21 @@ "params": [ { "type": "Identifier", - "start": 23, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 35 - }, - "identifierName": "value" - }, + "start":23,"end":35,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":35},"identifierName":"value"}, "name": "value", "typeAnnotation": { "type": "TypeAnnotation", - "start": 28, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":28,"end":35,"loc":{"start":{"line":1,"column":28},"end":{"line":1,"column":35}}, "typeAnnotation": { "type": "NumberTypeAnnotation", - "start": 29, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 1, - "column": 35 - } - } + "start":29,"end":35,"loc":{"start":{"line":1,"column":29},"end":{"line":1,"column":35}} } } } ], "body": { "type": "BlockStatement", - "start": 36, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 36 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":36,"end":38,"loc":{"start":{"line":1,"column":36},"end":{"line":1,"column":38}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/28/output.json b/packages/babel-parser/test/fixtures/flow/type-annotations/28/output.json index 6ba209d0a64a..4d69f5949667 100644 --- a/packages/babel-parser/test/fixtures/flow/type-annotations/28/output.json +++ b/packages/babel-parser/test/fixtures/flow/type-annotations/28/output.json @@ -1,111 +1,32 @@ { "type": "File", - "start": 0, - "end": 44, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 44 - } - }, + "start":0,"end":44,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":44}}, "program": { "type": "Program", - "start": 0, - "end": 44, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 44 - } - }, + "start":0,"end":44,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":44}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 44, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 44 - } - }, + "start":0,"end":44,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":44}}, "id": { "type": "Identifier", - "start": 6, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "Foo" - }, + "start":6,"end":9,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":9},"identifierName":"Foo"}, "name": "Foo" }, "superClass": null, "body": { "type": "ClassBody", - "start": 10, - "end": 44, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 44 - } - }, + "start":10,"end":44,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":44}}, "body": [ { "type": "ClassMethod", - "start": 11, - "end": 43, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 43 - } - }, + "start":11,"end":43,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":43}}, "static": false, "key": { "type": "Identifier", - "start": 15, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 22 - }, - "identifierName": "fooProp" - }, + "start":15,"end":22,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":22},"identifierName":"fooProp"}, "name": "fooProp" }, "computed": false, @@ -116,48 +37,14 @@ "params": [ { "type": "Identifier", - "start": 23, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 35 - }, - "identifierName": "value" - }, + "start":23,"end":35,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":35},"identifierName":"value"}, "name": "value", "typeAnnotation": { "type": "TypeAnnotation", - "start": 28, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":28,"end":35,"loc":{"start":{"line":1,"column":28},"end":{"line":1,"column":35}}, "typeAnnotation": { "type": "NumberTypeAnnotation", - "start": 29, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 1, - "column": 35 - } - } + "start":29,"end":35,"loc":{"start":{"line":1,"column":29},"end":{"line":1,"column":35}} } } } @@ -165,48 +52,15 @@ "predicate": null, "returnType": { "type": "TypeAnnotation", - "start": 36, - "end": 41, - "loc": { - "start": { - "line": 1, - "column": 36 - }, - "end": { - "line": 1, - "column": 41 - } - }, + "start":36,"end":41,"loc":{"start":{"line":1,"column":36},"end":{"line":1,"column":41}}, "typeAnnotation": { "type": "VoidTypeAnnotation", - "start": 37, - "end": 41, - "loc": { - "start": { - "line": 1, - "column": 37 - }, - "end": { - "line": 1, - "column": 41 - } - } + "start":37,"end":41,"loc":{"start":{"line":1,"column":37},"end":{"line":1,"column":41}} } }, "body": { "type": "BlockStatement", - "start": 41, - "end": 43, - "loc": { - "start": { - "line": 1, - "column": 41 - }, - "end": { - "line": 1, - "column": 43 - } - }, + "start":41,"end":43,"loc":{"start":{"line":1,"column":41},"end":{"line":1,"column":43}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/29/output.json b/packages/babel-parser/test/fixtures/flow/type-annotations/29/output.json index f57534e0225a..c1a395b6a556 100644 --- a/packages/babel-parser/test/fixtures/flow/type-annotations/29/output.json +++ b/packages/babel-parser/test/fixtures/flow/type-annotations/29/output.json @@ -1,111 +1,32 @@ { "type": "File", - "start": 0, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, "program": { "type": "Program", - "start": 0, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, "id": { "type": "Identifier", - "start": 6, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "Foo" - }, + "start":6,"end":9,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":9},"identifierName":"Foo"}, "name": "Foo" }, "superClass": null, "body": { "type": "ClassBody", - "start": 10, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":10,"end":34,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":34}}, "body": [ { "type": "ClassMethod", - "start": 11, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":11,"end":33,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":33}}, "static": false, "key": { "type": "Identifier", - "start": 15, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 22 - }, - "identifierName": "fooProp" - }, + "start":15,"end":22,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":22},"identifierName":"fooProp"}, "name": "fooProp" }, "computed": false, @@ -117,48 +38,15 @@ "predicate": null, "returnType": { "type": "TypeAnnotation", - "start": 24, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":24,"end":31,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":31}}, "typeAnnotation": { "type": "NumberTypeAnnotation", - "start": 25, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 31 - } - } + "start":25,"end":31,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":31}} } }, "body": { "type": "BlockStatement", - "start": 31, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 31 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":31,"end":33,"loc":{"start":{"line":1,"column":31},"end":{"line":1,"column":33}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/3/output.json b/packages/babel-parser/test/fixtures/flow/type-annotations/3/output.json index d38270441cb6..8eb0e2fe683d 100644 --- a/packages/babel-parser/test/fixtures/flow/type-annotations/3/output.json +++ b/packages/babel-parser/test/fixtures/flow/type-annotations/3/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 46, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 46 - } - }, + "start":0,"end":46,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":46}}, "program": { "type": "Program", - "start": 0, - "end": 46, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 46 - } - }, + "start":0,"end":46,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":46}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 46, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 46 - } - }, + "start":0,"end":46,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":46}}, "id": { "type": "Identifier", - "start": 9, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "foo" - }, + "start":9,"end":12,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":12},"identifierName":"foo"}, "name": "foo" }, "generator": false, @@ -65,113 +20,34 @@ "params": [ { "type": "Identifier", - "start": 13, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 27 - }, - "identifierName": "numVal" - }, + "start":13,"end":27,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":27},"identifierName":"numVal"}, "name": "numVal", "typeAnnotation": { "type": "TypeAnnotation", - "start": 19, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":19,"end":27,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":27}}, "typeAnnotation": { "type": "NumberTypeAnnotation", - "start": 21, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 27 - } - } + "start":21,"end":27,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":27}} } } }, { "type": "Identifier", - "start": 29, - "end": 43, - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 1, - "column": 43 - }, - "identifierName": "strVal" - }, + "start":29,"end":43,"loc":{"start":{"line":1,"column":29},"end":{"line":1,"column":43},"identifierName":"strVal"}, "name": "strVal", "typeAnnotation": { "type": "TypeAnnotation", - "start": 35, - "end": 43, - "loc": { - "start": { - "line": 1, - "column": 35 - }, - "end": { - "line": 1, - "column": 43 - } - }, + "start":35,"end":43,"loc":{"start":{"line":1,"column":35},"end":{"line":1,"column":43}}, "typeAnnotation": { "type": "StringTypeAnnotation", - "start": 37, - "end": 43, - "loc": { - "start": { - "line": 1, - "column": 37 - }, - "end": { - "line": 1, - "column": 43 - } - } + "start":37,"end":43,"loc":{"start":{"line":1,"column":37},"end":{"line":1,"column":43}} } } } ], "body": { "type": "BlockStatement", - "start": 44, - "end": 46, - "loc": { - "start": { - "line": 1, - "column": 44 - }, - "end": { - "line": 1, - "column": 46 - } - }, + "start":44,"end":46,"loc":{"start":{"line":1,"column":44},"end":{"line":1,"column":46}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/30/output.json b/packages/babel-parser/test/fixtures/flow/type-annotations/30/output.json index 3a14103ed5d2..d4c417b0e46f 100644 --- a/packages/babel-parser/test/fixtures/flow/type-annotations/30/output.json +++ b/packages/babel-parser/test/fixtures/flow/type-annotations/30/output.json @@ -1,107 +1,29 @@ { "type": "File", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, "program": { "type": "Program", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":4,"end":17,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":17}}, "id": { "type": "Identifier", - "start": 4, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 17 - }, - "identifierName": "numVal" - }, + "start":4,"end":17,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":17},"identifierName":"numVal"}, "name": "numVal", "typeAnnotation": { "type": "TypeAnnotation", - "start": 10, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":10,"end":17,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":17}}, "typeAnnotation": { "type": "NumberTypeAnnotation", - "start": 11, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 17 - } - } + "start":11,"end":17,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":17}} } } }, diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/31/output.json b/packages/babel-parser/test/fixtures/flow/type-annotations/31/output.json index 17fdd74e265e..60092a40b6ea 100644 --- a/packages/babel-parser/test/fixtures/flow/type-annotations/31/output.json +++ b/packages/babel-parser/test/fixtures/flow/type-annotations/31/output.json @@ -1,125 +1,35 @@ { "type": "File", - "start": 0, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, "program": { "type": "Program", - "start": 0, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":4,"end":31,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":31}}, "id": { "type": "Identifier", - "start": 4, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 17 - }, - "identifierName": "numVal" - }, + "start":4,"end":17,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":17},"identifierName":"numVal"}, "name": "numVal", "typeAnnotation": { "type": "TypeAnnotation", - "start": 10, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":10,"end":17,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":17}}, "typeAnnotation": { "type": "NumberTypeAnnotation", - "start": 11, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 17 - } - } + "start":11,"end":17,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":17}} } } }, "init": { "type": "Identifier", - "start": 20, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 31 - }, - "identifierName": "otherNumVal" - }, + "start":20,"end":31,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":31},"identifierName":"otherNumVal"}, "name": "otherNumVal" } } diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/32/output.json b/packages/babel-parser/test/fixtures/flow/type-annotations/32/output.json index 70cbbd4fef08..928d31152fae 100644 --- a/packages/babel-parser/test/fixtures/flow/type-annotations/32/output.json +++ b/packages/babel-parser/test/fixtures/flow/type-annotations/32/output.json @@ -1,138 +1,37 @@ { "type": "File", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "program": { "type": "Program", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":4,"end":23,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":23}}, "id": { "type": "Identifier", - "start": 4, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 23 - }, - "identifierName": "a" - }, + "start":4,"end":23,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":23},"identifierName":"a"}, "name": "a", "typeAnnotation": { "type": "TypeAnnotation", - "start": 5, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":5,"end":23,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":23}}, "typeAnnotation": { "type": "ObjectTypeAnnotation", - "start": 7, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":7,"end":23,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":23}}, "callProperties": [], "properties": [ { "type": "ObjectTypeProperty", - "start": 8, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":8,"end":22,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":22}}, "key": { "type": "Identifier", - "start": 8, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 14 - }, - "identifierName": "numVal" - }, + "start":8,"end":14,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":14},"identifierName":"numVal"}, "name": "numVal" }, "static": false, @@ -141,18 +40,7 @@ "method": false, "value": { "type": "NumberTypeAnnotation", - "start": 16, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 22 - } - } + "start":16,"end":22,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":22}} }, "variance": null, "optional": false diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/33/output.json b/packages/babel-parser/test/fixtures/flow/type-annotations/33/output.json index 1ef29b3b8bb6..c60afd7b1e41 100644 --- a/packages/babel-parser/test/fixtures/flow/type-annotations/33/output.json +++ b/packages/babel-parser/test/fixtures/flow/type-annotations/33/output.json @@ -1,138 +1,37 @@ { "type": "File", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, "program": { "type": "Program", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":4,"end":24,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":24}}, "id": { "type": "Identifier", - "start": 4, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 24 - }, - "identifierName": "a" - }, + "start":4,"end":24,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":24},"identifierName":"a"}, "name": "a", "typeAnnotation": { "type": "TypeAnnotation", - "start": 5, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":5,"end":24,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":24}}, "typeAnnotation": { "type": "ObjectTypeAnnotation", - "start": 7, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":7,"end":24,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":24}}, "callProperties": [], "properties": [ { "type": "ObjectTypeProperty", - "start": 8, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":8,"end":22,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":22}}, "key": { "type": "Identifier", - "start": 8, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 14 - }, - "identifierName": "numVal" - }, + "start":8,"end":14,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":14},"identifierName":"numVal"}, "name": "numVal" }, "static": false, @@ -141,18 +40,7 @@ "method": false, "value": { "type": "NumberTypeAnnotation", - "start": 16, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 22 - } - } + "start":16,"end":22,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":22}} }, "variance": null, "optional": false diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/34/output.json b/packages/babel-parser/test/fixtures/flow/type-annotations/34/output.json index b389c49201ad..d77d9d033739 100644 --- a/packages/babel-parser/test/fixtures/flow/type-annotations/34/output.json +++ b/packages/babel-parser/test/fixtures/flow/type-annotations/34/output.json @@ -1,138 +1,37 @@ { "type": "File", - "start": 0, - "end": 51, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 51 - } - }, + "start":0,"end":51,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":51}}, "program": { "type": "Program", - "start": 0, - "end": 51, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 51 - } - }, + "start":0,"end":51,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":51}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 51, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 51 - } - }, + "start":0,"end":51,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":51}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 50, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 50 - } - }, + "start":4,"end":50,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":50}}, "id": { "type": "Identifier", - "start": 4, - "end": 50, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 50 - }, - "identifierName": "a" - }, + "start":4,"end":50,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":50},"identifierName":"a"}, "name": "a", "typeAnnotation": { "type": "TypeAnnotation", - "start": 5, - "end": 50, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 50 - } - }, + "start":5,"end":50,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":50}}, "typeAnnotation": { "type": "ObjectTypeAnnotation", - "start": 7, - "end": 50, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 50 - } - }, + "start":7,"end":50,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":50}}, "callProperties": [], "properties": [ { "type": "ObjectTypeProperty", - "start": 8, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":8,"end":22,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":22}}, "key": { "type": "Identifier", - "start": 8, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 14 - }, - "identifierName": "numVal" - }, + "start":8,"end":14,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":14},"identifierName":"numVal"}, "name": "numVal" }, "static": false, @@ -141,18 +40,7 @@ "method": false, "value": { "type": "NumberTypeAnnotation", - "start": 16, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 22 - } - } + "start":16,"end":22,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":22}} }, "variance": null, "optional": false @@ -161,65 +49,20 @@ "indexers": [ { "type": "ObjectTypeIndexer", - "start": 24, - "end": 49, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 49 - } - }, + "start":24,"end":49,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":49}}, "static": false, "id": { "type": "Identifier", - "start": 25, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 32 - }, - "identifierName": "indexer" - }, + "start":25,"end":32,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":32},"identifierName":"indexer"}, "name": "indexer" }, "key": { "type": "StringTypeAnnotation", - "start": 34, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 34 - }, - "end": { - "line": 1, - "column": 40 - } - } + "start":34,"end":40,"loc":{"start":{"line":1,"column":34},"end":{"line":1,"column":40}} }, "value": { "type": "NumberTypeAnnotation", - "start": 43, - "end": 49, - "loc": { - "start": { - "line": 1, - "column": 43 - }, - "end": { - "line": 1, - "column": 49 - } - } + "start":43,"end":49,"loc":{"start":{"line":1,"column":43},"end":{"line":1,"column":49}} }, "variance": null } diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/35/output.json b/packages/babel-parser/test/fixtures/flow/type-annotations/35/output.json index cc227490d30a..841e2e0c04b1 100644 --- a/packages/babel-parser/test/fixtures/flow/type-annotations/35/output.json +++ b/packages/babel-parser/test/fixtures/flow/type-annotations/35/output.json @@ -1,152 +1,40 @@ { "type": "File", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, "program": { "type": "Program", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":4,"end":24,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":24}}, "id": { "type": "Identifier", - "start": 4, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 24 - }, - "identifierName": "a" - }, + "start":4,"end":24,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":24},"identifierName":"a"}, "name": "a", "typeAnnotation": { "type": "TypeAnnotation", - "start": 5, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":5,"end":24,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":24}}, "typeAnnotation": { "type": "NullableTypeAnnotation", - "start": 7, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":7,"end":24,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":24}}, "typeAnnotation": { "type": "ObjectTypeAnnotation", - "start": 8, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":8,"end":24,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":24}}, "callProperties": [], "properties": [ { "type": "ObjectTypeProperty", - "start": 9, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":9,"end":23,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":23}}, "key": { "type": "Identifier", - "start": 9, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 15 - }, - "identifierName": "numVal" - }, + "start":9,"end":15,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":15},"identifierName":"numVal"}, "name": "numVal" }, "static": false, @@ -155,18 +43,7 @@ "method": false, "value": { "type": "NumberTypeAnnotation", - "start": 17, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 23 - } - } + "start":17,"end":23,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":23}} }, "variance": null, "optional": false diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/36/output.json b/packages/babel-parser/test/fixtures/flow/type-annotations/36/output.json index 431aa501bc4d..7420828cc842 100644 --- a/packages/babel-parser/test/fixtures/flow/type-annotations/36/output.json +++ b/packages/babel-parser/test/fixtures/flow/type-annotations/36/output.json @@ -1,138 +1,37 @@ { "type": "File", - "start": 0, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 39 - } - }, + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":39}}, "program": { "type": "Program", - "start": 0, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 39 - } - }, + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":39}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 39 - } - }, + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":39}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 39 - } - }, + "start":4,"end":39,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":39}}, "id": { "type": "Identifier", - "start": 4, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 39 - }, - "identifierName": "a" - }, + "start":4,"end":39,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":39},"identifierName":"a"}, "name": "a", "typeAnnotation": { "type": "TypeAnnotation", - "start": 5, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 39 - } - }, + "start":5,"end":39,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":39}}, "typeAnnotation": { "type": "ObjectTypeAnnotation", - "start": 7, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 39 - } - }, + "start":7,"end":39,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":39}}, "callProperties": [], "properties": [ { "type": "ObjectTypeProperty", - "start": 8, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":8,"end":22,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":22}}, "key": { "type": "Identifier", - "start": 8, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 14 - }, - "identifierName": "numVal" - }, + "start":8,"end":14,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":14},"identifierName":"numVal"}, "name": "numVal" }, "static": false, @@ -141,51 +40,17 @@ "method": false, "value": { "type": "NumberTypeAnnotation", - "start": 16, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 22 - } - } + "start":16,"end":22,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":22}} }, "variance": null, "optional": false }, { "type": "ObjectTypeProperty", - "start": 24, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":24,"end":38,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":38}}, "key": { "type": "Identifier", - "start": 24, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 30 - }, - "identifierName": "strVal" - }, + "start":24,"end":30,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":30},"identifierName":"strVal"}, "name": "strVal" }, "static": false, @@ -194,18 +59,7 @@ "method": false, "value": { "type": "StringTypeAnnotation", - "start": 32, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 32 - }, - "end": { - "line": 1, - "column": 38 - } - } + "start":32,"end":38,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":38}} }, "variance": null, "optional": false diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/37/output.json b/packages/babel-parser/test/fixtures/flow/type-annotations/37/output.json index 428bb08cb9aa..3b3472e5d1ff 100644 --- a/packages/babel-parser/test/fixtures/flow/type-annotations/37/output.json +++ b/packages/babel-parser/test/fixtures/flow/type-annotations/37/output.json @@ -1,138 +1,37 @@ { "type": "File", - "start": 0, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, "program": { "type": "Program", - "start": 0, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":4,"end":33,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":33}}, "id": { "type": "Identifier", - "start": 4, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 33 - }, - "identifierName": "a" - }, + "start":4,"end":33,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":33},"identifierName":"a"}, "name": "a", "typeAnnotation": { "type": "TypeAnnotation", - "start": 5, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":5,"end":33,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":33}}, "typeAnnotation": { "type": "ObjectTypeAnnotation", - "start": 7, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":7,"end":33,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":33}}, "callProperties": [], "properties": [ { "type": "ObjectTypeProperty", - "start": 8, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":8,"end":32,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":32}}, "key": { "type": "Identifier", - "start": 8, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 14 - }, - "identifierName": "subObj" - }, + "start":8,"end":14,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":14},"identifierName":"subObj"}, "name": "subObj" }, "static": false, @@ -141,49 +40,15 @@ "method": false, "value": { "type": "ObjectTypeAnnotation", - "start": 16, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":16,"end":32,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":32}}, "callProperties": [], "properties": [ { "type": "ObjectTypeProperty", - "start": 17, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":17,"end":31,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":31}}, "key": { "type": "Identifier", - "start": 17, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 23 - }, - "identifierName": "strVal" - }, + "start":17,"end":23,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":23},"identifierName":"strVal"}, "name": "strVal" }, "static": false, @@ -192,18 +57,7 @@ "method": false, "value": { "type": "StringTypeAnnotation", - "start": 25, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 31 - } - } + "start":25,"end":31,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":31}} }, "variance": null, "optional": false diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/38/output.json b/packages/babel-parser/test/fixtures/flow/type-annotations/38/output.json index 0e133ba1cfbc..cd5d4d6e481a 100644 --- a/packages/babel-parser/test/fixtures/flow/type-annotations/38/output.json +++ b/packages/babel-parser/test/fixtures/flow/type-annotations/38/output.json @@ -1,138 +1,37 @@ { "type": "File", - "start": 0, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, "program": { "type": "Program", - "start": 0, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":4,"end":34,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":34}}, "id": { "type": "Identifier", - "start": 4, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 34 - }, - "identifierName": "a" - }, + "start":4,"end":34,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":34},"identifierName":"a"}, "name": "a", "typeAnnotation": { "type": "TypeAnnotation", - "start": 5, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":5,"end":34,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":34}}, "typeAnnotation": { "type": "ObjectTypeAnnotation", - "start": 7, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":7,"end":34,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":34}}, "callProperties": [], "properties": [ { "type": "ObjectTypeProperty", - "start": 8, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":8,"end":33,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":33}}, "key": { "type": "Identifier", - "start": 8, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 14 - }, - "identifierName": "subObj" - }, + "start":8,"end":14,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":14},"identifierName":"subObj"}, "name": "subObj" }, "static": false, @@ -141,63 +40,18 @@ "method": false, "value": { "type": "NullableTypeAnnotation", - "start": 16, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":16,"end":33,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":33}}, "typeAnnotation": { "type": "ObjectTypeAnnotation", - "start": 17, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":17,"end":33,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":33}}, "callProperties": [], "properties": [ { "type": "ObjectTypeProperty", - "start": 18, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":18,"end":32,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":32}}, "key": { "type": "Identifier", - "start": 18, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 24 - }, - "identifierName": "strVal" - }, + "start":18,"end":24,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":24},"identifierName":"strVal"}, "name": "strVal" }, "static": false, @@ -206,18 +60,7 @@ "method": false, "value": { "type": "StringTypeAnnotation", - "start": 26, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 32 - } - } + "start":26,"end":32,"loc":{"start":{"line":1,"column":26},"end":{"line":1,"column":32}} }, "variance": null, "optional": false diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/39/output.json b/packages/babel-parser/test/fixtures/flow/type-annotations/39/output.json index 03cc703ab871..5d8ef8f03bf3 100644 --- a/packages/babel-parser/test/fixtures/flow/type-annotations/39/output.json +++ b/packages/babel-parser/test/fixtures/flow/type-annotations/39/output.json @@ -1,138 +1,37 @@ { "type": "File", - "start": 0, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 39 - } - }, + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":39}}, "program": { "type": "Program", - "start": 0, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 39 - } - }, + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":39}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 39 - } - }, + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":39}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 39 - } - }, + "start":4,"end":39,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":39}}, "id": { "type": "Identifier", - "start": 4, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 39 - }, - "identifierName": "a" - }, + "start":4,"end":39,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":39},"identifierName":"a"}, "name": "a", "typeAnnotation": { "type": "TypeAnnotation", - "start": 5, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 39 - } - }, + "start":5,"end":39,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":39}}, "typeAnnotation": { "type": "ObjectTypeAnnotation", - "start": 7, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 39 - } - }, + "start":7,"end":39,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":39}}, "callProperties": [], "properties": [ { "type": "ObjectTypeProperty", - "start": 8, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":8,"end":22,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":22}}, "key": { "type": "Identifier", - "start": 8, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 14 - }, - "identifierName": "param1" - }, + "start":8,"end":14,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":14},"identifierName":"param1"}, "name": "param1" }, "static": false, @@ -141,51 +40,17 @@ "method": false, "value": { "type": "NumberTypeAnnotation", - "start": 16, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 22 - } - } + "start":16,"end":22,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":22}} }, "variance": null, "optional": false }, { "type": "ObjectTypeProperty", - "start": 24, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":24,"end":38,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":38}}, "key": { "type": "Identifier", - "start": 24, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 30 - }, - "identifierName": "param2" - }, + "start":24,"end":30,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":30},"identifierName":"param2"}, "name": "param2" }, "static": false, @@ -194,18 +59,7 @@ "method": false, "value": { "type": "StringTypeAnnotation", - "start": 32, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 32 - }, - "end": { - "line": 1, - "column": 38 - } - } + "start":32,"end":38,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":38}} }, "variance": null, "optional": false diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/4/output.json b/packages/babel-parser/test/fixtures/flow/type-annotations/4/output.json index 961fcf35dcb4..3b1f45e1a9b3 100644 --- a/packages/babel-parser/test/fixtures/flow/type-annotations/4/output.json +++ b/packages/babel-parser/test/fixtures/flow/type-annotations/4/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 42, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 42 - } - }, + "start":0,"end":42,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":42}}, "program": { "type": "Program", - "start": 0, - "end": 42, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 42 - } - }, + "start":0,"end":42,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":42}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 42, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 42 - } - }, + "start":0,"end":42,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":42}}, "id": { "type": "Identifier", - "start": 9, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "foo" - }, + "start":9,"end":12,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":12},"identifierName":"foo"}, "name": "foo" }, "generator": false, @@ -65,83 +20,26 @@ "params": [ { "type": "Identifier", - "start": 13, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 27 - }, - "identifierName": "numVal" - }, + "start":13,"end":27,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":27},"identifierName":"numVal"}, "name": "numVal", "typeAnnotation": { "type": "TypeAnnotation", - "start": 19, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":19,"end":27,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":27}}, "typeAnnotation": { "type": "NumberTypeAnnotation", - "start": 21, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 27 - } - } + "start":21,"end":27,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":27}} } } }, { "type": "Identifier", - "start": 29, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 1, - "column": 39 - }, - "identifierName": "untypedVal" - }, + "start":29,"end":39,"loc":{"start":{"line":1,"column":29},"end":{"line":1,"column":39},"identifierName":"untypedVal"}, "name": "untypedVal" } ], "body": { "type": "BlockStatement", - "start": 40, - "end": 42, - "loc": { - "start": { - "line": 1, - "column": 40 - }, - "end": { - "line": 1, - "column": 42 - } - }, + "start":40,"end":42,"loc":{"start":{"line":1,"column":40},"end":{"line":1,"column":42}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/40/output.json b/packages/babel-parser/test/fixtures/flow/type-annotations/40/output.json index 2cfc8de95973..817f27b39989 100644 --- a/packages/babel-parser/test/fixtures/flow/type-annotations/40/output.json +++ b/packages/babel-parser/test/fixtures/flow/type-annotations/40/output.json @@ -1,138 +1,37 @@ { "type": "File", - "start": 0, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 40 - } - }, + "start":0,"end":40,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":40}}, "program": { "type": "Program", - "start": 0, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 40 - } - }, + "start":0,"end":40,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":40}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 40 - } - }, + "start":0,"end":40,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":40}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 40 - } - }, + "start":4,"end":40,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":40}}, "id": { "type": "Identifier", - "start": 4, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 40 - }, - "identifierName": "a" - }, + "start":4,"end":40,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":40},"identifierName":"a"}, "name": "a", "typeAnnotation": { "type": "TypeAnnotation", - "start": 5, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 40 - } - }, + "start":5,"end":40,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":40}}, "typeAnnotation": { "type": "ObjectTypeAnnotation", - "start": 7, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 40 - } - }, + "start":7,"end":40,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":40}}, "callProperties": [], "properties": [ { "type": "ObjectTypeProperty", - "start": 8, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":8,"end":22,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":22}}, "key": { "type": "Identifier", - "start": 8, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 14 - }, - "identifierName": "param1" - }, + "start":8,"end":14,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":14},"identifierName":"param1"}, "name": "param1" }, "static": false, @@ -141,51 +40,17 @@ "method": false, "value": { "type": "NumberTypeAnnotation", - "start": 16, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 22 - } - } + "start":16,"end":22,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":22}} }, "variance": null, "optional": false }, { "type": "ObjectTypeProperty", - "start": 24, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 39 - } - }, + "start":24,"end":39,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":39}}, "key": { "type": "Identifier", - "start": 24, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 30 - }, - "identifierName": "param2" - }, + "start":24,"end":30,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":30},"identifierName":"param2"}, "name": "param2" }, "static": false, @@ -194,18 +59,7 @@ "method": false, "value": { "type": "StringTypeAnnotation", - "start": 33, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 33 - }, - "end": { - "line": 1, - "column": 39 - } - } + "start":33,"end":39,"loc":{"start":{"line":1,"column":33},"end":{"line":1,"column":39}} }, "variance": null, "optional": true diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/41/output.json b/packages/babel-parser/test/fixtures/flow/type-annotations/41/output.json index 2f073e822eff..7bdf8b219080 100644 --- a/packages/babel-parser/test/fixtures/flow/type-annotations/41/output.json +++ b/packages/babel-parser/test/fixtures/flow/type-annotations/41/output.json @@ -1,235 +1,67 @@ { "type": "File", - "start": 0, - "end": 53, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 53 - } - }, + "start":0,"end":53,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":53}}, "program": { "type": "Program", - "start": 0, - "end": 53, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 53 - } - }, + "start":0,"end":53,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":53}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 53, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 53 - } - }, + "start":0,"end":53,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":53}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 52, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 52 - } - }, + "start":4,"end":52,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":52}}, "id": { "type": "Identifier", - "start": 4, - "end": 52, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 52 - }, - "identifierName": "a" - }, + "start":4,"end":52,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":52},"identifierName":"a"}, "name": "a", "typeAnnotation": { "type": "TypeAnnotation", - "start": 5, - "end": 52, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 52 - } - }, + "start":5,"end":52,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":52}}, "typeAnnotation": { "type": "ObjectTypeAnnotation", - "start": 7, - "end": 52, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 52 - } - }, + "start":7,"end":52,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":52}}, "callProperties": [], "properties": [], "indexers": [ { "type": "ObjectTypeIndexer", - "start": 9, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":9,"end":28,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":28}}, "static": false, "id": { "type": "Identifier", - "start": 10, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "a" - }, + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11},"identifierName":"a"}, "name": "a" }, "key": { "type": "NumberTypeAnnotation", - "start": 13, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 19 - } - } + "start":13,"end":19,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":19}} }, "value": { "type": "StringTypeAnnotation", - "start": 22, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 28 - } - } + "start":22,"end":28,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":28}} }, "variance": null }, { "type": "ObjectTypeIndexer", - "start": 30, - "end": 49, - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 1, - "column": 49 - } - }, + "start":30,"end":49,"loc":{"start":{"line":1,"column":30},"end":{"line":1,"column":49}}, "static": false, "id": { "type": "Identifier", - "start": 31, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 31 - }, - "end": { - "line": 1, - "column": 32 - }, - "identifierName": "b" - }, + "start":31,"end":32,"loc":{"start":{"line":1,"column":31},"end":{"line":1,"column":32},"identifierName":"b"}, "name": "b" }, "key": { "type": "NumberTypeAnnotation", - "start": 34, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 34 - }, - "end": { - "line": 1, - "column": 40 - } - } + "start":34,"end":40,"loc":{"start":{"line":1,"column":34},"end":{"line":1,"column":40}} }, "value": { "type": "StringTypeAnnotation", - "start": 43, - "end": 49, - "loc": { - "start": { - "line": 1, - "column": 43 - }, - "end": { - "line": 1, - "column": 49 - } - } + "start":43,"end":49,"loc":{"start":{"line":1,"column":43},"end":{"line":1,"column":49}} }, "variance": null } diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/42/output.json b/packages/babel-parser/test/fixtures/flow/type-annotations/42/output.json index b918a1e51b0a..3e4e5b09000f 100644 --- a/packages/babel-parser/test/fixtures/flow/type-annotations/42/output.json +++ b/packages/babel-parser/test/fixtures/flow/type-annotations/42/output.json @@ -1,138 +1,37 @@ { "type": "File", - "start": 0, - "end": 48, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 48 - } - }, + "start":0,"end":48,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":48}}, "program": { "type": "Program", - "start": 0, - "end": 48, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 48 - } - }, + "start":0,"end":48,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":48}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 48, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 48 - } - }, + "start":0,"end":48,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":48}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 48, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 48 - } - }, + "start":4,"end":48,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":48}}, "id": { "type": "Identifier", - "start": 4, - "end": 48, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 48 - }, - "identifierName": "a" - }, + "start":4,"end":48,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":48},"identifierName":"a"}, "name": "a", "typeAnnotation": { "type": "TypeAnnotation", - "start": 5, - "end": 48, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 48 - } - }, + "start":5,"end":48,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":48}}, "typeAnnotation": { "type": "ObjectTypeAnnotation", - "start": 7, - "end": 48, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 48 - } - }, + "start":7,"end":48,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":48}}, "callProperties": [], "properties": [ { "type": "ObjectTypeProperty", - "start": 8, - "end": 47, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 47 - } - }, + "start":8,"end":47,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":47}}, "key": { "type": "Identifier", - "start": 8, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "add" - }, + "start":8,"end":11,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":11},"identifierName":"add"}, "name": "add" }, "static": false, @@ -141,161 +40,48 @@ "method": true, "value": { "type": "FunctionTypeAnnotation", - "start": 8, - "end": 47, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 47 - } - }, + "start":8,"end":47,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":47}}, "params": [ { "type": "FunctionTypeParam", - "start": 12, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":12,"end":20,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":20}}, "name": { "type": "Identifier", - "start": 12, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - }, - "identifierName": "x" - }, + "start":12,"end":13,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":13},"identifierName":"x"}, "name": "x" }, "optional": false, "typeAnnotation": { "type": "NumberTypeAnnotation", - "start": 14, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 20 - } - } + "start":14,"end":20,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":20}} } } ], "rest": { "type": "FunctionTypeParam", - "start": 25, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 40 - } - }, + "start":25,"end":40,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":40}}, "name": { "type": "Identifier", - "start": 25, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 26 - }, - "identifierName": "y" - }, + "start":25,"end":26,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":26},"identifierName":"y"}, "name": "y" }, "optional": false, "typeAnnotation": { "type": "GenericTypeAnnotation", - "start": 27, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 40 - } - }, + "start":27,"end":40,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":40}}, "typeParameters": { "type": "TypeParameterInstantiation", - "start": 32, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 32 - }, - "end": { - "line": 1, - "column": 40 - } - }, + "start":32,"end":40,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":40}}, "params": [ { "type": "StringTypeAnnotation", - "start": 33, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 33 - }, - "end": { - "line": 1, - "column": 39 - } - } + "start":33,"end":39,"loc":{"start":{"line":1,"column":33},"end":{"line":1,"column":39}} } ] }, "id": { "type": "Identifier", - "start": 27, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 32 - }, - "identifierName": "Array" - }, + "start":27,"end":32,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":32},"identifierName":"Array"}, "name": "Array" } } @@ -303,18 +89,7 @@ "typeParameters": null, "returnType": { "type": "VoidTypeAnnotation", - "start": 43, - "end": 47, - "loc": { - "start": { - "line": 1, - "column": 43 - }, - "end": { - "line": 1, - "column": 47 - } - } + "start":43,"end":47,"loc":{"start":{"line":1,"column":43},"end":{"line":1,"column":47}} } }, "optional": false diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/43/output.json b/packages/babel-parser/test/fixtures/flow/type-annotations/43/output.json index 05ff2466b98b..049308dd2a06 100644 --- a/packages/babel-parser/test/fixtures/flow/type-annotations/43/output.json +++ b/packages/babel-parser/test/fixtures/flow/type-annotations/43/output.json @@ -1,138 +1,37 @@ { "type": "File", - "start": 0, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, "program": { "type": "Program", - "start": 0, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":4,"end":26,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":26}}, "id": { "type": "Identifier", - "start": 4, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 26 - }, - "identifierName": "a" - }, + "start":4,"end":26,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":26},"identifierName":"a"}, "name": "a", "typeAnnotation": { "type": "TypeAnnotation", - "start": 5, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":5,"end":26,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":26}}, "typeAnnotation": { "type": "ObjectTypeAnnotation", - "start": 7, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":7,"end":26,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":26}}, "callProperties": [], "properties": [ { "type": "ObjectTypeProperty", - "start": 9, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":9,"end":23,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":23}}, "key": { "type": "Identifier", - "start": 9, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "id" - }, + "start":9,"end":11,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":11},"identifierName":"id"}, "name": "id" }, "static": false, @@ -141,81 +40,24 @@ "method": true, "value": { "type": "FunctionTypeAnnotation", - "start": 9, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":9,"end":23,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":23}}, "params": [ { "type": "FunctionTypeParam", - "start": 15, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":15,"end":19,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":19}}, "name": { "type": "Identifier", - "start": 15, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - }, - "identifierName": "x" - }, + "start":15,"end":16,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":16},"identifierName":"x"}, "name": "x" }, "optional": false, "typeAnnotation": { "type": "GenericTypeAnnotation", - "start": 18, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":18,"end":19,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":19}}, "typeParameters": null, "id": { "type": "Identifier", - "start": 18, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - }, - "identifierName": "T" - }, + "start":18,"end":19,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":19},"identifierName":"T"}, "name": "T" } } @@ -224,33 +66,11 @@ "rest": null, "typeParameters": { "type": "TypeParameterDeclaration", - "start": 11, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":11,"end":14,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":14}}, "params": [ { "type": "TypeParameter", - "start": 12, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":12,"end":13,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":13}}, "name": "T", "variance": null } @@ -258,34 +78,11 @@ }, "returnType": { "type": "GenericTypeAnnotation", - "start": 22, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":22,"end":23,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":23}}, "typeParameters": null, "id": { "type": "Identifier", - "start": 22, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 23 - }, - "identifierName": "T" - }, + "start":22,"end":23,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":23},"identifierName":"T"}, "name": "T" } } diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/44/output.json b/packages/babel-parser/test/fixtures/flow/type-annotations/44/output.json index 90d30599238c..1e24e550104f 100644 --- a/packages/babel-parser/test/fixtures/flow/type-annotations/44/output.json +++ b/packages/babel-parser/test/fixtures/flow/type-annotations/44/output.json @@ -1,154 +1,42 @@ { "type": "File", - "start": 0, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, "program": { "type": "Program", - "start": 0, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":4,"end":31,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":31}}, "id": { "type": "Identifier", - "start": 4, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 19 - }, - "identifierName": "a" - }, + "start":4,"end":19,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":19},"identifierName":"a"}, "name": "a", "typeAnnotation": { "type": "TypeAnnotation", - "start": 5, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":5,"end":19,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":19}}, "typeAnnotation": { "type": "GenericTypeAnnotation", - "start": 6, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":6,"end":19,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":19}}, "typeParameters": { "type": "TypeParameterInstantiation", - "start": 11, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":11,"end":19,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":19}}, "params": [ { "type": "NumberTypeAnnotation", - "start": 12, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 18 - } - } + "start":12,"end":18,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":18}} } ] }, "id": { "type": "Identifier", - "start": 6, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "Array" - }, + "start":6,"end":11,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":11},"identifierName":"Array"}, "name": "Array" } } @@ -156,33 +44,11 @@ }, "init": { "type": "ArrayExpression", - "start": 22, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":22,"end":31,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":31}}, "elements": [ { "type": "NumericLiteral", - "start": 23, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":23,"end":24,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":24}}, "extra": { "rawValue": 1, "raw": "1" @@ -191,18 +57,7 @@ }, { "type": "NumericLiteral", - "start": 26, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":26,"end":27,"loc":{"start":{"line":1,"column":26},"end":{"line":1,"column":27}}, "extra": { "rawValue": 2, "raw": "2" @@ -211,18 +66,7 @@ }, { "type": "NumericLiteral", - "start": 29, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":29,"end":30,"loc":{"start":{"line":1,"column":29},"end":{"line":1,"column":30}}, "extra": { "rawValue": 3, "raw": "3" diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/45/output.json b/packages/babel-parser/test/fixtures/flow/type-annotations/45/output.json index 37ca8f2e16a5..5eafd0af6f8d 100644 --- a/packages/babel-parser/test/fixtures/flow/type-annotations/45/output.json +++ b/packages/babel-parser/test/fixtures/flow/type-annotations/45/output.json @@ -1,140 +1,39 @@ { "type": "File", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, "program": { "type": "Program", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, "expression": { "type": "AssignmentExpression", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, "operator": "=", "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "a" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"a"}, "name": "a" }, "right": { "type": "ClassExpression", - "start": 4, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":4,"end":20,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":20}}, "id": { "type": "Identifier", - "start": 10, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 13 - }, - "identifierName": "Foo" - }, + "start":10,"end":13,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":13},"identifierName":"Foo"}, "name": "Foo" }, "typeParameters": { "type": "TypeParameterDeclaration", - "start": 13, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":13,"end":16,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":16}}, "params": [ { "type": "TypeParameter", - "start": 14, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":14,"end":15,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":15}}, "name": "T", "variance": null } @@ -143,18 +42,7 @@ "superClass": null, "body": { "type": "ClassBody", - "start": 17, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":17,"end":20,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":20}}, "body": [] } } diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/46/output.json b/packages/babel-parser/test/fixtures/flow/type-annotations/46/output.json index 90645ea05110..0c2248fd3c60 100644 --- a/packages/babel-parser/test/fixtures/flow/type-annotations/46/output.json +++ b/packages/babel-parser/test/fixtures/flow/type-annotations/46/output.json @@ -1,140 +1,39 @@ { "type": "File", - "start": 0, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":35}}, "program": { "type": "Program", - "start": 0, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":35}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":35}}, "expression": { "type": "AssignmentExpression", - "start": 0, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":35}}, "operator": "=", "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "a" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"a"}, "name": "a" }, "right": { "type": "ClassExpression", - "start": 4, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":4,"end":35,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":35}}, "id": { "type": "Identifier", - "start": 10, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 13 - }, - "identifierName": "Foo" - }, + "start":10,"end":13,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":13},"identifierName":"Foo"}, "name": "Foo" }, "typeParameters": { "type": "TypeParameterDeclaration", - "start": 13, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":13,"end":16,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":16}}, "params": [ { "type": "TypeParameter", - "start": 14, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":14,"end":15,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":15}}, "name": "T", "variance": null } @@ -142,66 +41,20 @@ }, "superClass": { "type": "Identifier", - "start": 25, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 28 - }, - "identifierName": "Bar" - }, + "start":25,"end":28,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":28},"identifierName":"Bar"}, "name": "Bar" }, "superTypeParameters": { "type": "TypeParameterInstantiation", - "start": 28, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":28,"end":31,"loc":{"start":{"line":1,"column":28},"end":{"line":1,"column":31}}, "params": [ { "type": "GenericTypeAnnotation", - "start": 29, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":29,"end":30,"loc":{"start":{"line":1,"column":29},"end":{"line":1,"column":30}}, "typeParameters": null, "id": { "type": "Identifier", - "start": 29, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 1, - "column": 30 - }, - "identifierName": "T" - }, + "start":29,"end":30,"loc":{"start":{"line":1,"column":29},"end":{"line":1,"column":30},"identifierName":"T"}, "name": "T" } } @@ -209,18 +62,7 @@ }, "body": { "type": "ClassBody", - "start": 32, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 32 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":32,"end":35,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":35}}, "body": [] } } diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/47/output.json b/packages/babel-parser/test/fixtures/flow/type-annotations/47/output.json index 25f26298f07a..0a761b0f745f 100644 --- a/packages/babel-parser/test/fixtures/flow/type-annotations/47/output.json +++ b/packages/babel-parser/test/fixtures/flow/type-annotations/47/output.json @@ -1,94 +1,27 @@ { "type": "File", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "program": { "type": "Program", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "id": { "type": "Identifier", - "start": 6, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "Foo" - }, + "start":6,"end":9,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":9},"identifierName":"Foo"}, "name": "Foo" }, "typeParameters": { "type": "TypeParameterDeclaration", - "start": 9, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":9,"end":12,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":12}}, "params": [ { "type": "TypeParameter", - "start": 10, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11}}, "name": "T", "variance": null } @@ -97,18 +30,7 @@ "superClass": null, "body": { "type": "ClassBody", - "start": 13, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":13,"end":15,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":15}}, "body": [] } } diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/48/output.json b/packages/babel-parser/test/fixtures/flow/type-annotations/48/output.json index 70f45659a6ab..6609f33d453f 100644 --- a/packages/babel-parser/test/fixtures/flow/type-annotations/48/output.json +++ b/packages/babel-parser/test/fixtures/flow/type-annotations/48/output.json @@ -1,94 +1,27 @@ { "type": "File", - "start": 0, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, "program": { "type": "Program", - "start": 0, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, "id": { "type": "Identifier", - "start": 6, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "Foo" - }, + "start":6,"end":9,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":9},"identifierName":"Foo"}, "name": "Foo" }, "typeParameters": { "type": "TypeParameterDeclaration", - "start": 9, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":9,"end":12,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":12}}, "params": [ { "type": "TypeParameter", - "start": 10, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11}}, "name": "T", "variance": null } @@ -96,66 +29,20 @@ }, "superClass": { "type": "Identifier", - "start": 21, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 24 - }, - "identifierName": "Bar" - }, + "start":21,"end":24,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":24},"identifierName":"Bar"}, "name": "Bar" }, "superTypeParameters": { "type": "TypeParameterInstantiation", - "start": 24, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":24,"end":27,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":27}}, "params": [ { "type": "GenericTypeAnnotation", - "start": 25, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":25,"end":26,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":26}}, "typeParameters": null, "id": { "type": "Identifier", - "start": 25, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 26 - }, - "identifierName": "T" - }, + "start":25,"end":26,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":26},"identifierName":"T"}, "name": "T" } } @@ -163,18 +50,7 @@ }, "body": { "type": "ClassBody", - "start": 28, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":28,"end":31,"loc":{"start":{"line":1,"column":28},"end":{"line":1,"column":31}}, "body": [] } } diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/49/output.json b/packages/babel-parser/test/fixtures/flow/type-annotations/49/output.json index 269670602203..a0425a4573c9 100644 --- a/packages/babel-parser/test/fixtures/flow/type-annotations/49/output.json +++ b/packages/babel-parser/test/fixtures/flow/type-annotations/49/output.json @@ -1,94 +1,27 @@ { "type": "File", - "start": 0, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":35}}, "program": { "type": "Program", - "start": 0, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":35}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":35}}, "id": { "type": "Identifier", - "start": 6, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "Foo" - }, + "start":6,"end":9,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":9},"identifierName":"Foo"}, "name": "Foo" }, "typeParameters": { "type": "TypeParameterDeclaration", - "start": 9, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":9,"end":12,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":12}}, "params": [ { "type": "TypeParameter", - "start": 10, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11}}, "name": "T", "variance": null } @@ -96,69 +29,23 @@ }, "superClass": { "type": "CallExpression", - "start": 21, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":21,"end":31,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":31}}, "callee": { "type": "Identifier", - "start": 21, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 26 - }, - "identifierName": "mixin" - }, + "start":21,"end":26,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":26},"identifierName":"mixin"}, "name": "mixin" }, "arguments": [ { "type": "Identifier", - "start": 27, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 30 - }, - "identifierName": "Bar" - }, + "start":27,"end":30,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":30},"identifierName":"Bar"}, "name": "Bar" } ] }, "body": { "type": "ClassBody", - "start": 32, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 32 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":32,"end":35,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":35}}, "body": [] } } diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/5/output.json b/packages/babel-parser/test/fixtures/flow/type-annotations/5/output.json index 775ca31fcbc5..08ad1d80a743 100644 --- a/packages/babel-parser/test/fixtures/flow/type-annotations/5/output.json +++ b/packages/babel-parser/test/fixtures/flow/type-annotations/5/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 42, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 42 - } - }, + "start":0,"end":42,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":42}}, "program": { "type": "Program", - "start": 0, - "end": 42, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 42 - } - }, + "start":0,"end":42,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":42}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 42, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 42 - } - }, + "start":0,"end":42,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":42}}, "id": { "type": "Identifier", - "start": 9, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "foo" - }, + "start":9,"end":12,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":12},"identifierName":"foo"}, "name": "foo" }, "generator": false, @@ -65,83 +20,26 @@ "params": [ { "type": "Identifier", - "start": 13, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 23 - }, - "identifierName": "untypedVal" - }, + "start":13,"end":23,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":23},"identifierName":"untypedVal"}, "name": "untypedVal" }, { "type": "Identifier", - "start": 25, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 39 - }, - "identifierName": "numVal" - }, + "start":25,"end":39,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":39},"identifierName":"numVal"}, "name": "numVal", "typeAnnotation": { "type": "TypeAnnotation", - "start": 31, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 31 - }, - "end": { - "line": 1, - "column": 39 - } - }, + "start":31,"end":39,"loc":{"start":{"line":1,"column":31},"end":{"line":1,"column":39}}, "typeAnnotation": { "type": "NumberTypeAnnotation", - "start": 33, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 33 - }, - "end": { - "line": 1, - "column": 39 - } - } + "start":33,"end":39,"loc":{"start":{"line":1,"column":33},"end":{"line":1,"column":39}} } } } ], "body": { "type": "BlockStatement", - "start": 40, - "end": 42, - "loc": { - "start": { - "line": 1, - "column": 40 - }, - "end": { - "line": 1, - "column": 42 - } - }, + "start":40,"end":42,"loc":{"start":{"line":1,"column":40},"end":{"line":1,"column":42}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/50/output.json b/packages/babel-parser/test/fixtures/flow/type-annotations/50/output.json index 27ee33be5ecd..5d7bbfd9f096 100644 --- a/packages/babel-parser/test/fixtures/flow/type-annotations/50/output.json +++ b/packages/babel-parser/test/fixtures/flow/type-annotations/50/output.json @@ -1,94 +1,27 @@ { "type": "File", - "start": 0, - "end": 46, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 46 - } - }, + "start":0,"end":46,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":46}}, "program": { "type": "Program", - "start": 0, - "end": 46, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 46 - } - }, + "start":0,"end":46,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":46}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 46, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 46 - } - }, + "start":0,"end":46,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":46}}, "id": { "type": "Identifier", - "start": 6, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "Foo" - }, + "start":6,"end":9,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":9},"identifierName":"Foo"}, "name": "Foo" }, "typeParameters": { "type": "TypeParameterDeclaration", - "start": 9, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":9,"end":12,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":12}}, "params": [ { "type": "TypeParameter", - "start": 10, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11}}, "name": "T", "variance": null } @@ -97,82 +30,26 @@ "superClass": null, "body": { "type": "ClassBody", - "start": 13, - "end": 46, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 46 - } - }, + "start":13,"end":46,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":46}}, "body": [ { "type": "ClassMethod", - "start": 15, - "end": 45, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 45 - } - }, + "start":15,"end":45,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":45}}, "static": false, "key": { "type": "Identifier", - "start": 15, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 18 - }, - "identifierName": "bar" - }, + "start":15,"end":18,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":18},"identifierName":"bar"}, "name": "bar" }, "computed": false, "kind": "method", "typeParameters": { "type": "TypeParameterDeclaration", - "start": 18, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":18,"end":21,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":21}}, "params": [ { "type": "TypeParameter", - "start": 19, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":19,"end":20,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":20}}, "name": "U", "variance": null } @@ -185,77 +62,22 @@ "predicate": null, "returnType": { "type": "TypeAnnotation", - "start": 23, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":23,"end":30,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":30}}, "typeAnnotation": { "type": "NumberTypeAnnotation", - "start": 24, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 30 - } - } + "start":24,"end":30,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":30}} } }, "body": { "type": "BlockStatement", - "start": 31, - "end": 45, - "loc": { - "start": { - "line": 1, - "column": 31 - }, - "end": { - "line": 1, - "column": 45 - } - }, + "start":31,"end":45,"loc":{"start":{"line":1,"column":31},"end":{"line":1,"column":45}}, "body": [ { "type": "ReturnStatement", - "start": 33, - "end": 43, - "loc": { - "start": { - "line": 1, - "column": 33 - }, - "end": { - "line": 1, - "column": 43 - } - }, + "start":33,"end":43,"loc":{"start":{"line":1,"column":33},"end":{"line":1,"column":43}}, "argument": { "type": "NumericLiteral", - "start": 40, - "end": 42, - "loc": { - "start": { - "line": 1, - "column": 40 - }, - "end": { - "line": 1, - "column": 42 - } - }, + "start":40,"end":42,"loc":{"start":{"line":1,"column":40},"end":{"line":1,"column":42}}, "extra": { "rawValue": 42, "raw": "42" diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/51/output.json b/packages/babel-parser/test/fixtures/flow/type-annotations/51/output.json index 30bfca7bc1eb..49eecab002e1 100644 --- a/packages/babel-parser/test/fixtures/flow/type-annotations/51/output.json +++ b/packages/babel-parser/test/fixtures/flow/type-annotations/51/output.json @@ -1,110 +1,32 @@ { "type": "File", - "start": 0, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, "program": { "type": "Program", - "start": 0, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, "id": { "type": "Identifier", - "start": 6, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "Foo" - }, + "start":6,"end":9,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":9},"identifierName":"Foo"}, "name": "Foo" }, "superClass": null, "body": { "type": "ClassBody", - "start": 10, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":10,"end":28,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":28}}, "body": [ { "type": "ClassMethod", - "start": 12, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":12,"end":26,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":26}}, "static": false, "key": { "type": "StringLiteral", - "start": 12, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":12,"end":17,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":17}}, "extra": { "rawValue": "bar", "raw": "\"bar\"" @@ -115,33 +37,11 @@ "kind": "method", "typeParameters": { "type": "TypeParameterDeclaration", - "start": 17, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":17,"end":20,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":20}}, "params": [ { "type": "TypeParameter", - "start": 18, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":18,"end":19,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":19}}, "name": "T", "variance": null } @@ -153,18 +53,7 @@ "params": [], "body": { "type": "BlockStatement", - "start": 23, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":23,"end":26,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":26}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/52/output.json b/packages/babel-parser/test/fixtures/flow/type-annotations/52/output.json index 8bab5ed80220..34692af6852c 100644 --- a/packages/babel-parser/test/fixtures/flow/type-annotations/52/output.json +++ b/packages/babel-parser/test/fixtures/flow/type-annotations/52/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 41, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 41 - } - }, + "start":0,"end":41,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":41}}, "program": { "type": "Program", - "start": 0, - "end": 41, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 41 - } - }, + "start":0,"end":41,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":41}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 41, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 41 - } - }, + "start":0,"end":41,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":41}}, "id": { "type": "Identifier", - "start": 9, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "foo" - }, + "start":9,"end":12,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":12},"identifierName":"foo"}, "name": "foo" }, "generator": false, @@ -65,54 +20,19 @@ "params": [ { "type": "Identifier", - "start": 13, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 26 - }, - "identifierName": "requiredParam" - }, + "start":13,"end":26,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":26},"identifierName":"requiredParam"}, "name": "requiredParam" }, { "type": "Identifier", - "start": 28, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 37 - }, - "identifierName": "optParam" - }, + "start":28,"end":37,"loc":{"start":{"line":1,"column":28},"end":{"line":1,"column":37},"identifierName":"optParam"}, "name": "optParam", "optional": true } ], "body": { "type": "BlockStatement", - "start": 39, - "end": 41, - "loc": { - "start": { - "line": 1, - "column": 39 - }, - "end": { - "line": 1, - "column": 41 - } - }, + "start":39,"end":41,"loc":{"start":{"line":1,"column":39},"end":{"line":1,"column":41}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/53/output.json b/packages/babel-parser/test/fixtures/flow/type-annotations/53/output.json index 97967a24ad0a..5115a9a3f165 100644 --- a/packages/babel-parser/test/fixtures/flow/type-annotations/53/output.json +++ b/packages/babel-parser/test/fixtures/flow/type-annotations/53/output.json @@ -1,209 +1,63 @@ { "type": "File", - "start": 0, - "end": 41, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 41 - } - }, + "start":0,"end":41,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":41}}, "program": { "type": "Program", - "start": 0, - "end": 41, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 41 - } - }, + "start":0,"end":41,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":41}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 41, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 41 - } - }, + "start":0,"end":41,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":41}}, "id": { "type": "Identifier", - "start": 6, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "Foo" - }, + "start":6,"end":9,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":9},"identifierName":"Foo"}, "name": "Foo" }, "superClass": null, "body": { "type": "ClassBody", - "start": 10, - "end": 41, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 41 - } - }, + "start":10,"end":41,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":41}}, "body": [ { "type": "ClassProperty", - "start": 12, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":12,"end":25,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":25}}, "static": false, "key": { "type": "Identifier", - "start": 12, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 17 - }, - "identifierName": "prop1" - }, + "start":12,"end":17,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":17},"identifierName":"prop1"}, "name": "prop1" }, "computed": false, "variance": null, "typeAnnotation": { "type": "TypeAnnotation", - "start": 17, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":17,"end":24,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":24}}, "typeAnnotation": { "type": "StringTypeAnnotation", - "start": 18, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 24 - } - } + "start":18,"end":24,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":24}} } }, "value": null }, { "type": "ClassProperty", - "start": 26, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 39 - } - }, + "start":26,"end":39,"loc":{"start":{"line":1,"column":26},"end":{"line":1,"column":39}}, "static": false, "key": { "type": "Identifier", - "start": 26, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 31 - }, - "identifierName": "prop2" - }, + "start":26,"end":31,"loc":{"start":{"line":1,"column":26},"end":{"line":1,"column":31},"identifierName":"prop2"}, "name": "prop2" }, "computed": false, "variance": null, "typeAnnotation": { "type": "TypeAnnotation", - "start": 31, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 31 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":31,"end":38,"loc":{"start":{"line":1,"column":31},"end":{"line":1,"column":38}}, "typeAnnotation": { "type": "NumberTypeAnnotation", - "start": 32, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 32 - }, - "end": { - "line": 1, - "column": 38 - } - } + "start":32,"end":38,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":38}} } }, "value": null diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/54/output.json b/packages/babel-parser/test/fixtures/flow/type-annotations/54/output.json index 9d7ab3c84ac5..7ce1b31f8b2c 100644 --- a/packages/babel-parser/test/fixtures/flow/type-annotations/54/output.json +++ b/packages/babel-parser/test/fixtures/flow/type-annotations/54/output.json @@ -1,209 +1,63 @@ { "type": "File", - "start": 0, - "end": 48, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 48 - } - }, + "start":0,"end":48,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":48}}, "program": { "type": "Program", - "start": 0, - "end": 48, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 48 - } - }, + "start":0,"end":48,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":48}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 48, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 48 - } - }, + "start":0,"end":48,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":48}}, "id": { "type": "Identifier", - "start": 6, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "Foo" - }, + "start":6,"end":9,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":9},"identifierName":"Foo"}, "name": "Foo" }, "superClass": null, "body": { "type": "ClassBody", - "start": 10, - "end": 48, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 48 - } - }, + "start":10,"end":48,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":48}}, "body": [ { "type": "ClassProperty", - "start": 12, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":12,"end":32,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":32}}, "static": true, "key": { "type": "Identifier", - "start": 19, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 24 - }, - "identifierName": "prop1" - }, + "start":19,"end":24,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":24},"identifierName":"prop1"}, "name": "prop1" }, "computed": false, "variance": null, "typeAnnotation": { "type": "TypeAnnotation", - "start": 24, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":24,"end":31,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":31}}, "typeAnnotation": { "type": "StringTypeAnnotation", - "start": 25, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 31 - } - } + "start":25,"end":31,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":31}} } }, "value": null }, { "type": "ClassProperty", - "start": 33, - "end": 46, - "loc": { - "start": { - "line": 1, - "column": 33 - }, - "end": { - "line": 1, - "column": 46 - } - }, + "start":33,"end":46,"loc":{"start":{"line":1,"column":33},"end":{"line":1,"column":46}}, "static": false, "key": { "type": "Identifier", - "start": 33, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 33 - }, - "end": { - "line": 1, - "column": 38 - }, - "identifierName": "prop2" - }, + "start":33,"end":38,"loc":{"start":{"line":1,"column":33},"end":{"line":1,"column":38},"identifierName":"prop2"}, "name": "prop2" }, "computed": false, "variance": null, "typeAnnotation": { "type": "TypeAnnotation", - "start": 38, - "end": 45, - "loc": { - "start": { - "line": 1, - "column": 38 - }, - "end": { - "line": 1, - "column": 45 - } - }, + "start":38,"end":45,"loc":{"start":{"line":1,"column":38},"end":{"line":1,"column":45}}, "typeAnnotation": { "type": "NumberTypeAnnotation", - "start": 39, - "end": 45, - "loc": { - "start": { - "line": 1, - "column": 39 - }, - "end": { - "line": 1, - "column": 45 - } - } + "start":39,"end":45,"loc":{"start":{"line":1,"column":39},"end":{"line":1,"column":45}} } }, "value": null diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/55/output.json b/packages/babel-parser/test/fixtures/flow/type-annotations/55/output.json index 723428d1e003..eff3ad308aaf 100644 --- a/packages/babel-parser/test/fixtures/flow/type-annotations/55/output.json +++ b/packages/babel-parser/test/fixtures/flow/type-annotations/55/output.json @@ -1,137 +1,37 @@ { "type": "File", - "start": 0, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, "program": { "type": "Program", - "start": 0, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":4,"end":27,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":27}}, "id": { "type": "Identifier", - "start": 4, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 23 - }, - "identifierName": "x" - }, + "start":4,"end":23,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":23},"identifierName":"x"}, "name": "x", "typeAnnotation": { "type": "TypeAnnotation", - "start": 6, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":6,"end":23,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":23}}, "typeAnnotation": { "type": "UnionTypeAnnotation", - "start": 8, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":8,"end":23,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":23}}, "types": [ { "type": "NumberTypeAnnotation", - "start": 8, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 14 - } - } + "start":8,"end":14,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":14}} }, { "type": "StringTypeAnnotation", - "start": 17, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 23 - } - } + "start":17,"end":23,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":23}} } ] } @@ -139,18 +39,7 @@ }, "init": { "type": "NumericLiteral", - "start": 26, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":26,"end":27,"loc":{"start":{"line":1,"column":26},"end":{"line":1,"column":27}}, "extra": { "rawValue": 4, "raw": "4" diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/56/output.json b/packages/babel-parser/test/fixtures/flow/type-annotations/56/output.json index 0008b902d085..60b7295b821b 100644 --- a/packages/babel-parser/test/fixtures/flow/type-annotations/56/output.json +++ b/packages/babel-parser/test/fixtures/flow/type-annotations/56/output.json @@ -1,111 +1,32 @@ { "type": "File", - "start": 0, - "end": 49, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 49 - } - }, + "start":0,"end":49,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":49}}, "program": { "type": "Program", - "start": 0, - "end": 49, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 49 - } - }, + "start":0,"end":49,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":49}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 49, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 49 - } - }, + "start":0,"end":49,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":49}}, "id": { "type": "Identifier", - "start": 6, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "Array" - }, + "start":6,"end":11,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":11},"identifierName":"Array"}, "name": "Array" }, "superClass": null, "body": { "type": "ClassBody", - "start": 12, - "end": 49, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 49 - } - }, + "start":12,"end":49,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":49}}, "body": [ { "type": "ClassMethod", - "start": 14, - "end": 46, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 46 - } - }, + "start":14,"end":46,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":46}}, "static": false, "key": { "type": "Identifier", - "start": 14, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 20 - }, - "identifierName": "concat" - }, + "start":14,"end":20,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":20},"identifierName":"concat"}, "name": "concat" }, "computed": false, @@ -116,78 +37,22 @@ "params": [ { "type": "Identifier", - "start": 21, - "end": 42, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 42 - }, - "identifierName": "items" - }, + "start":21,"end":42,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":42},"identifierName":"items"}, "name": "items", "typeAnnotation": { "type": "TypeAnnotation", - "start": 26, - "end": 42, - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 42 - } - }, + "start":26,"end":42,"loc":{"start":{"line":1,"column":26},"end":{"line":1,"column":42}}, "typeAnnotation": { "type": "UnionTypeAnnotation", - "start": 27, - "end": 42, - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 42 - } - }, + "start":27,"end":42,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":42}}, "types": [ { "type": "NumberTypeAnnotation", - "start": 27, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 33 - } - } + "start":27,"end":33,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":33}} }, { "type": "StringTypeAnnotation", - "start": 36, - "end": 42, - "loc": { - "start": { - "line": 1, - "column": 36 - }, - "end": { - "line": 1, - "column": 42 - } - } + "start":36,"end":42,"loc":{"start":{"line":1,"column":36},"end":{"line":1,"column":42}} } ] } @@ -196,18 +61,7 @@ ], "body": { "type": "BlockStatement", - "start": 44, - "end": 46, - "loc": { - "start": { - "line": 1, - "column": 44 - }, - "end": { - "line": 1, - "column": 46 - } - }, + "start":44,"end":46,"loc":{"start":{"line":1,"column":44},"end":{"line":1,"column":46}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/57/output.json b/packages/babel-parser/test/fixtures/flow/type-annotations/57/output.json index 6ae0568ada05..b19b04b9728f 100644 --- a/packages/babel-parser/test/fixtures/flow/type-annotations/57/output.json +++ b/packages/babel-parser/test/fixtures/flow/type-annotations/57/output.json @@ -1,169 +1,47 @@ { "type": "File", - "start": 0, - "end": 41, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 41 - } - }, + "start":0,"end":41,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":41}}, "program": { "type": "Program", - "start": 0, - "end": 41, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 41 - } - }, + "start":0,"end":41,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":41}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 41, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 41 - } - }, + "start":0,"end":41,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":41}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 40 - } - }, + "start":4,"end":40,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":40}}, "id": { "type": "Identifier", - "start": 4, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 35 - }, - "identifierName": "x" - }, + "start":4,"end":35,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":35},"identifierName":"x"}, "name": "x", "typeAnnotation": { "type": "TypeAnnotation", - "start": 6, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":6,"end":35,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":35}}, "typeAnnotation": { "type": "FunctionTypeAnnotation", - "start": 8, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":8,"end":35,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":35}}, "params": [], "rest": null, "returnType": { "type": "UnionTypeAnnotation", - "start": 14, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":14,"end":35,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":35}}, "types": [ { "type": "NumberTypeAnnotation", - "start": 14, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 20 - } - } + "start":14,"end":20,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":20}} }, { "type": "FunctionTypeAnnotation", - "start": 23, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":23,"end":35,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":35}}, "params": [], "rest": null, "returnType": { "type": "StringTypeAnnotation", - "start": 29, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 1, - "column": 35 - } - } + "start":29,"end":35,"loc":{"start":{"line":1,"column":29},"end":{"line":1,"column":35}} }, "typeParameters": null } @@ -175,19 +53,7 @@ }, "init": { "type": "Identifier", - "start": 38, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 38 - }, - "end": { - "line": 1, - "column": 40 - }, - "identifierName": "fn" - }, + "start":38,"end":40,"loc":{"start":{"line":1,"column":38},"end":{"line":1,"column":40},"identifierName":"fn"}, "name": "fn" } } diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/58/output.json b/packages/babel-parser/test/fixtures/flow/type-annotations/58/output.json index 01df1e9622df..a675fbe30505 100644 --- a/packages/babel-parser/test/fixtures/flow/type-annotations/58/output.json +++ b/packages/babel-parser/test/fixtures/flow/type-annotations/58/output.json @@ -1,137 +1,36 @@ { "type": "File", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, "program": { "type": "Program", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":4,"end":19,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":19}}, "id": { "type": "Identifier", - "start": 4, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 15 - }, - "identifierName": "x" - }, + "start":4,"end":15,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":15},"identifierName":"x"}, "name": "x", "typeAnnotation": { "type": "TypeAnnotation", - "start": 5, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":5,"end":15,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":15}}, "typeAnnotation": { "type": "TypeofTypeAnnotation", - "start": 7, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":7,"end":15,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":15}}, "argument": { "type": "GenericTypeAnnotation", - "start": 14, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":14,"end":15,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":15}}, "typeParameters": null, "id": { "type": "Identifier", - "start": 14, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - }, - "identifierName": "Y" - }, + "start":14,"end":15,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":15},"identifierName":"Y"}, "name": "Y" } } @@ -140,19 +39,7 @@ }, "init": { "type": "Identifier", - "start": 18, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - }, - "identifierName": "Y" - }, + "start":18,"end":19,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":19},"identifierName":"Y"}, "name": "Y" } } diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/59/output.json b/packages/babel-parser/test/fixtures/flow/type-annotations/59/output.json index 946010a4c0c5..50bf337b3895 100644 --- a/packages/babel-parser/test/fixtures/flow/type-annotations/59/output.json +++ b/packages/babel-parser/test/fixtures/flow/type-annotations/59/output.json @@ -1,170 +1,47 @@ { "type": "File", - "start": 0, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, "program": { "type": "Program", - "start": 0, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":4,"end":28,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":28}}, "id": { "type": "Identifier", - "start": 4, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 24 - }, - "identifierName": "x" - }, + "start":4,"end":24,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":24},"identifierName":"x"}, "name": "x", "typeAnnotation": { "type": "TypeAnnotation", - "start": 5, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":5,"end":24,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":24}}, "typeAnnotation": { "type": "UnionTypeAnnotation", - "start": 7, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":7,"end":24,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":24}}, "types": [ { "type": "TypeofTypeAnnotation", - "start": 7, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":7,"end":15,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":15}}, "argument": { "type": "GenericTypeAnnotation", - "start": 14, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":14,"end":15,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":15}}, "typeParameters": null, "id": { "type": "Identifier", - "start": 14, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - }, - "identifierName": "Y" - }, + "start":14,"end":15,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":15},"identifierName":"Y"}, "name": "Y" } } }, { "type": "NumberTypeAnnotation", - "start": 18, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 24 - } - } + "start":18,"end":24,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":24}} } ] } @@ -172,19 +49,7 @@ }, "init": { "type": "Identifier", - "start": 27, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 28 - }, - "identifierName": "Y" - }, + "start":27,"end":28,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":28},"identifierName":"Y"}, "name": "Y" } } diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/6/output.json b/packages/babel-parser/test/fixtures/flow/type-annotations/6/output.json index 13e6d6b9d299..998d6746f558 100644 --- a/packages/babel-parser/test/fixtures/flow/type-annotations/6/output.json +++ b/packages/babel-parser/test/fixtures/flow/type-annotations/6/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, "program": { "type": "Program", - "start": 0, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, "id": { "type": "Identifier", - "start": 9, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "foo" - }, + "start":9,"end":12,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":12},"identifierName":"foo"}, "name": "foo" }, "generator": false, @@ -65,62 +20,17 @@ "params": [ { "type": "Identifier", - "start": 13, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 33 - }, - "identifierName": "nullableNum" - }, + "start":13,"end":33,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":33},"identifierName":"nullableNum"}, "name": "nullableNum", "typeAnnotation": { "type": "TypeAnnotation", - "start": 24, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":24,"end":33,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":33}}, "typeAnnotation": { "type": "NullableTypeAnnotation", - "start": 26, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":26,"end":33,"loc":{"start":{"line":1,"column":26},"end":{"line":1,"column":33}}, "typeAnnotation": { "type": "NumberTypeAnnotation", - "start": 27, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 33 - } - } + "start":27,"end":33,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":33}} } } } @@ -128,18 +38,7 @@ ], "body": { "type": "BlockStatement", - "start": 34, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 34 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":34,"end":36,"loc":{"start":{"line":1,"column":34},"end":{"line":1,"column":36}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/60/output.json b/packages/babel-parser/test/fixtures/flow/type-annotations/60/output.json index cfa5f6db54cc..cd0f73c910d1 100644 --- a/packages/babel-parser/test/fixtures/flow/type-annotations/60/output.json +++ b/packages/babel-parser/test/fixtures/flow/type-annotations/60/output.json @@ -1,127 +1,37 @@ { "type": "File", - "start": 0, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 40 - } - }, + "start":0,"end":40,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":40}}, "program": { "type": "Program", - "start": 0, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 40 - } - }, + "start":0,"end":40,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":40}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 40 - } - }, + "start":0,"end":40,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":40}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 39 - } - }, + "start":4,"end":39,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":39}}, "id": { "type": "ObjectPattern", - "start": 4, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":4,"end":22,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":22}}, "properties": [ { "type": "ObjectProperty", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, "method": false, "key": { "type": "Identifier", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "x" - }, + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"x"}, "name": "x" }, "computed": false, "shorthand": true, "value": { "type": "Identifier", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "x" - }, + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"x"}, "name": "x" }, "extra": { @@ -131,63 +41,18 @@ ], "typeAnnotation": { "type": "TypeAnnotation", - "start": 7, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":7,"end":22,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":22}}, "typeAnnotation": { "type": "ObjectTypeAnnotation", - "start": 9, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":9,"end":22,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":22}}, "callProperties": [], "properties": [ { "type": "ObjectTypeProperty", - "start": 10, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":10,"end":19,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":19}}, "key": { "type": "Identifier", - "start": 10, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "x" - }, + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11},"identifierName":"x"}, "name": "x" }, "static": false, @@ -196,18 +61,7 @@ "method": false, "value": { "type": "StringTypeAnnotation", - "start": 13, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 19 - } - } + "start":13,"end":19,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":19}} }, "variance": null, "optional": false @@ -222,67 +76,22 @@ }, "init": { "type": "ObjectExpression", - "start": 25, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 39 - } - }, + "start":25,"end":39,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":39}}, "properties": [ { "type": "ObjectProperty", - "start": 27, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 37 - } - }, + "start":27,"end":37,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":37}}, "method": false, "key": { "type": "Identifier", - "start": 27, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 28 - }, - "identifierName": "x" - }, + "start":27,"end":28,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":28},"identifierName":"x"}, "name": "x" }, "computed": false, "shorthand": false, "value": { "type": "StringLiteral", - "start": 30, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 1, - "column": 37 - } - }, + "start":30,"end":37,"loc":{"start":{"line":1,"column":30},"end":{"line":1,"column":37}}, "extra": { "rawValue": "hello", "raw": "\"hello\"" diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/61/output.json b/packages/babel-parser/test/fixtures/flow/type-annotations/61/output.json index 25d46071b872..1d30c0987907 100644 --- a/packages/babel-parser/test/fixtures/flow/type-annotations/61/output.json +++ b/packages/babel-parser/test/fixtures/flow/type-annotations/61/output.json @@ -1,127 +1,37 @@ { "type": "File", - "start": 0, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 39 - } - }, + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":39}}, "program": { "type": "Program", - "start": 0, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 39 - } - }, + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":39}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 39 - } - }, + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":39}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":4,"end":38,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":38}}, "id": { "type": "ObjectPattern", - "start": 4, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":4,"end":21,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":21}}, "properties": [ { "type": "ObjectProperty", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, "method": false, "key": { "type": "Identifier", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "x" - }, + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"x"}, "name": "x" }, "computed": false, "shorthand": true, "value": { "type": "Identifier", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "x" - }, + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"x"}, "name": "x" }, "extra": { @@ -131,63 +41,18 @@ ], "typeAnnotation": { "type": "TypeAnnotation", - "start": 7, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":7,"end":21,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":21}}, "typeAnnotation": { "type": "ObjectTypeAnnotation", - "start": 9, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":9,"end":21,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":21}}, "callProperties": [], "properties": [ { "type": "ObjectTypeProperty", - "start": 10, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":10,"end":19,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":19}}, "key": { "type": "Identifier", - "start": 10, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "x" - }, + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11},"identifierName":"x"}, "name": "x" }, "static": false, @@ -196,18 +61,7 @@ "method": false, "value": { "type": "StringTypeAnnotation", - "start": 13, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 19 - } - } + "start":13,"end":19,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":19}} }, "variance": null, "optional": false @@ -222,67 +76,22 @@ }, "init": { "type": "ObjectExpression", - "start": 24, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":24,"end":38,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":38}}, "properties": [ { "type": "ObjectProperty", - "start": 26, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":26,"end":36,"loc":{"start":{"line":1,"column":26},"end":{"line":1,"column":36}}, "method": false, "key": { "type": "Identifier", - "start": 26, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 27 - }, - "identifierName": "x" - }, + "start":26,"end":27,"loc":{"start":{"line":1,"column":26},"end":{"line":1,"column":27},"identifierName":"x"}, "name": "x" }, "computed": false, "shorthand": false, "value": { "type": "StringLiteral", - "start": 29, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":29,"end":36,"loc":{"start":{"line":1,"column":29},"end":{"line":1,"column":36}}, "extra": { "rawValue": "hello", "raw": "\"hello\"" diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/62/output.json b/packages/babel-parser/test/fixtures/flow/type-annotations/62/output.json index ab167c1f8165..f53f6967816a 100644 --- a/packages/babel-parser/test/fixtures/flow/type-annotations/62/output.json +++ b/packages/babel-parser/test/fixtures/flow/type-annotations/62/output.json @@ -1,171 +1,48 @@ { "type": "File", - "start": 0, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 37 - } - }, + "start":0,"end":37,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":37}}, "program": { "type": "Program", - "start": 0, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 37 - } - }, + "start":0,"end":37,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":37}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 37 - } - }, + "start":0,"end":37,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":37}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":4,"end":36,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":36}}, "id": { "type": "ArrayPattern", - "start": 4, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":4,"end":22,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":22}}, "elements": [ { "type": "Identifier", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "x" - }, + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"x"}, "name": "x" } ], "typeAnnotation": { "type": "TypeAnnotation", - "start": 7, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":7,"end":22,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":22}}, "typeAnnotation": { "type": "GenericTypeAnnotation", - "start": 9, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":9,"end":22,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":22}}, "typeParameters": { "type": "TypeParameterInstantiation", - "start": 14, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":14,"end":22,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":22}}, "params": [ { "type": "StringTypeAnnotation", - "start": 15, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 21 - } - } + "start":15,"end":21,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":21}} } ] }, "id": { "type": "Identifier", - "start": 9, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 14 - }, - "identifierName": "Array" - }, + "start":9,"end":14,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":14},"identifierName":"Array"}, "name": "Array" } } @@ -173,33 +50,11 @@ }, "init": { "type": "ArrayExpression", - "start": 25, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":25,"end":36,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":36}}, "elements": [ { "type": "StringLiteral", - "start": 27, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":27,"end":34,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":34}}, "extra": { "rawValue": "hello", "raw": "\"hello\"" diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/63/output.json b/packages/babel-parser/test/fixtures/flow/type-annotations/63/output.json index e9fb827b5b7d..2c7c6e328281 100644 --- a/packages/babel-parser/test/fixtures/flow/type-annotations/63/output.json +++ b/packages/babel-parser/test/fixtures/flow/type-annotations/63/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, "program": { "type": "Program", - "start": 0, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, "id": { "type": "Identifier", - "start": 9, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "foo" - }, + "start":9,"end":12,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":12},"identifierName":"foo"}, "name": "foo" }, "generator": false, @@ -65,68 +20,22 @@ "params": [ { "type": "ObjectPattern", - "start": 13, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":13,"end":32,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":32}}, "properties": [ { "type": "ObjectProperty", - "start": 14, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":14,"end":15,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":15}}, "method": false, "key": { "type": "Identifier", - "start": 14, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - }, - "identifierName": "x" - }, + "start":14,"end":15,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":15},"identifierName":"x"}, "name": "x" }, "computed": false, "shorthand": true, "value": { "type": "Identifier", - "start": 14, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - }, - "identifierName": "x" - }, + "start":14,"end":15,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":15},"identifierName":"x"}, "name": "x" }, "extra": { @@ -136,63 +45,18 @@ ], "typeAnnotation": { "type": "TypeAnnotation", - "start": 16, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":16,"end":32,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":32}}, "typeAnnotation": { "type": "ObjectTypeAnnotation", - "start": 18, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":18,"end":32,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":32}}, "callProperties": [], "properties": [ { "type": "ObjectTypeProperty", - "start": 20, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":20,"end":29,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":29}}, "key": { "type": "Identifier", - "start": 20, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 21 - }, - "identifierName": "x" - }, + "start":20,"end":21,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":21},"identifierName":"x"}, "name": "x" }, "static": false, @@ -201,18 +65,7 @@ "method": false, "value": { "type": "StringTypeAnnotation", - "start": 23, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 29 - } - } + "start":23,"end":29,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":29}} }, "variance": null, "optional": false @@ -228,18 +81,7 @@ ], "body": { "type": "BlockStatement", - "start": 34, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 34 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":34,"end":36,"loc":{"start":{"line":1,"column":34},"end":{"line":1,"column":36}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/64/output.json b/packages/babel-parser/test/fixtures/flow/type-annotations/64/output.json index 0a9b33366ff3..d03e6ea7e4bd 100644 --- a/packages/babel-parser/test/fixtures/flow/type-annotations/64/output.json +++ b/packages/babel-parser/test/fixtures/flow/type-annotations/64/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":35}}, "program": { "type": "Program", - "start": 0, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":35}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":35}}, "id": { "type": "Identifier", - "start": 9, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "foo" - }, + "start":9,"end":12,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":12},"identifierName":"foo"}, "name": "foo" }, "generator": false, @@ -65,112 +20,33 @@ "params": [ { "type": "ArrayPattern", - "start": 13, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":13,"end":31,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":31}}, "elements": [ { "type": "Identifier", - "start": 14, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - }, - "identifierName": "x" - }, + "start":14,"end":15,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":15},"identifierName":"x"}, "name": "x" } ], "typeAnnotation": { "type": "TypeAnnotation", - "start": 16, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":16,"end":31,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":31}}, "typeAnnotation": { "type": "GenericTypeAnnotation", - "start": 18, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":18,"end":31,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":31}}, "typeParameters": { "type": "TypeParameterInstantiation", - "start": 23, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":23,"end":31,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":31}}, "params": [ { "type": "StringTypeAnnotation", - "start": 24, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 30 - } - } + "start":24,"end":30,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":30}} } ] }, "id": { "type": "Identifier", - "start": 18, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 23 - }, - "identifierName": "Array" - }, + "start":18,"end":23,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":23},"identifierName":"Array"}, "name": "Array" } } @@ -179,18 +55,7 @@ ], "body": { "type": "BlockStatement", - "start": 33, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 33 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":33,"end":35,"loc":{"start":{"line":1,"column":33},"end":{"line":1,"column":35}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/65/output.json b/packages/babel-parser/test/fixtures/flow/type-annotations/65/output.json index ffa3d314947a..4b9e6ec20f37 100644 --- a/packages/babel-parser/test/fixtures/flow/type-annotations/65/output.json +++ b/packages/babel-parser/test/fixtures/flow/type-annotations/65/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 39 - } - }, + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":39}}, "program": { "type": "Program", - "start": 0, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 39 - } - }, + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":39}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 39 - } - }, + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":39}}, "id": { "type": "Identifier", - "start": 9, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "foo" - }, + "start":9,"end":12,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":12},"identifierName":"foo"}, "name": "foo" }, "generator": false, @@ -65,110 +20,31 @@ "params": [ { "type": "RestElement", - "start": 13, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":13,"end":35,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":35}}, "argument": { "type": "Identifier", - "start": 16, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 20 - }, - "identifierName": "rest" - }, + "start":16,"end":20,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":20},"identifierName":"rest"}, "name": "rest" }, "typeAnnotation": { "type": "TypeAnnotation", - "start": 20, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":20,"end":35,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":35}}, "typeAnnotation": { "type": "GenericTypeAnnotation", - "start": 22, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":22,"end":35,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":35}}, "typeParameters": { "type": "TypeParameterInstantiation", - "start": 27, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":27,"end":35,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":35}}, "params": [ { "type": "NumberTypeAnnotation", - "start": 28, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 34 - } - } + "start":28,"end":34,"loc":{"start":{"line":1,"column":28},"end":{"line":1,"column":34}} } ] }, "id": { "type": "Identifier", - "start": 22, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 27 - }, - "identifierName": "Array" - }, + "start":22,"end":27,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":27},"identifierName":"Array"}, "name": "Array" } } @@ -177,18 +53,7 @@ ], "body": { "type": "BlockStatement", - "start": 37, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 37 - }, - "end": { - "line": 1, - "column": 39 - } - }, + "start":37,"end":39,"loc":{"start":{"line":1,"column":37},"end":{"line":1,"column":39}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/66/output.json b/packages/babel-parser/test/fixtures/flow/type-annotations/66/output.json index 5585c51d80f7..d8f6311f0396 100644 --- a/packages/babel-parser/test/fixtures/flow/type-annotations/66/output.json +++ b/packages/babel-parser/test/fixtures/flow/type-annotations/66/output.json @@ -1,172 +1,49 @@ { "type": "File", - "start": 0, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":38}}, "program": { "type": "Program", - "start": 0, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":38}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":38}}, "expression": { "type": "FunctionExpression", - "start": 1, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 37 - } - }, + "start":1,"end":37,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":37}}, "id": null, "generator": false, "async": false, "params": [ { "type": "RestElement", - "start": 11, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":11,"end":33,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":33}}, "argument": { "type": "Identifier", - "start": 14, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 18 - }, - "identifierName": "rest" - }, + "start":14,"end":18,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":18},"identifierName":"rest"}, "name": "rest" }, "typeAnnotation": { "type": "TypeAnnotation", - "start": 18, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":18,"end":33,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":33}}, "typeAnnotation": { "type": "GenericTypeAnnotation", - "start": 20, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":20,"end":33,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":33}}, "typeParameters": { "type": "TypeParameterInstantiation", - "start": 25, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":25,"end":33,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":33}}, "params": [ { "type": "NumberTypeAnnotation", - "start": 26, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 32 - } - } + "start":26,"end":32,"loc":{"start":{"line":1,"column":26},"end":{"line":1,"column":32}} } ] }, "id": { "type": "Identifier", - "start": 20, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 25 - }, - "identifierName": "Array" - }, + "start":20,"end":25,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":25},"identifierName":"Array"}, "name": "Array" } } @@ -175,18 +52,7 @@ ], "body": { "type": "BlockStatement", - "start": 35, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 35 - }, - "end": { - "line": 1, - "column": 37 - } - }, + "start":35,"end":37,"loc":{"start":{"line":1,"column":35},"end":{"line":1,"column":37}}, "body": [], "directives": [] }, diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/67/output.json b/packages/babel-parser/test/fixtures/flow/type-annotations/67/output.json index 867c7ca3769e..ebd6fd0fe18c 100644 --- a/packages/babel-parser/test/fixtures/flow/type-annotations/67/output.json +++ b/packages/babel-parser/test/fixtures/flow/type-annotations/67/output.json @@ -1,123 +1,34 @@ { "type": "File", - "start": 0, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, "program": { "type": "Program", - "start": 0, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":4,"end":27,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":27}}, "id": { "type": "Identifier", - "start": 4, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "foo" - }, + "start":4,"end":7,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":7},"identifierName":"foo"}, "name": "foo" }, "init": { "type": "ArrowFunctionExpression", - "start": 10, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":10,"end":27,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":27}}, "predicate": null, "returnType": { "type": "TypeAnnotation", - "start": 12, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":12,"end":20,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":20}}, "typeAnnotation": { "type": "NumberTypeAnnotation", - "start": 14, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 20 - } - } + "start":14,"end":20,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":20}} } }, "id": null, @@ -126,19 +37,7 @@ "params": [], "body": { "type": "Identifier", - "start": 24, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 27 - }, - "identifierName": "bar" - }, + "start":24,"end":27,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":27},"identifierName":"bar"}, "name": "bar" } } diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/68/output.json b/packages/babel-parser/test/fixtures/flow/type-annotations/68/output.json index e0b6a7e06356..23c2533a8af3 100644 --- a/packages/babel-parser/test/fixtures/flow/type-annotations/68/output.json +++ b/packages/babel-parser/test/fixtures/flow/type-annotations/68/output.json @@ -1,123 +1,34 @@ { "type": "File", - "start": 0, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, "program": { "type": "Program", - "start": 0, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":4,"end":30,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":30}}, "id": { "type": "Identifier", - "start": 4, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "foo" - }, + "start":4,"end":7,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":7},"identifierName":"foo"}, "name": "foo" }, "init": { "type": "ArrowFunctionExpression", - "start": 10, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":10,"end":30,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":30}}, "predicate": null, "returnType": { "type": "TypeAnnotation", - "start": 15, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":15,"end":23,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":23}}, "typeAnnotation": { "type": "NumberTypeAnnotation", - "start": 17, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 23 - } - } + "start":17,"end":23,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":23}} } }, "id": null, @@ -126,37 +37,13 @@ "params": [ { "type": "Identifier", - "start": 11, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 14 - }, - "identifierName": "bar" - }, + "start":11,"end":14,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":14},"identifierName":"bar"}, "name": "bar" } ], "body": { "type": "Identifier", - "start": 27, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 30 - }, - "identifierName": "bar" - }, + "start":27,"end":30,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":30},"identifierName":"bar"}, "name": "bar" } } diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/69/output.json b/packages/babel-parser/test/fixtures/flow/type-annotations/69/output.json index 9d9ac56c78cb..faebb38ba0aa 100644 --- a/packages/babel-parser/test/fixtures/flow/type-annotations/69/output.json +++ b/packages/babel-parser/test/fixtures/flow/type-annotations/69/output.json @@ -1,158 +1,45 @@ { "type": "File", - "start": 0, - "end": 42, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 42 - } - }, + "start":0,"end":42,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":42}}, "program": { "type": "Program", - "start": 0, - "end": 42, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 42 - } - }, + "start":0,"end":42,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":42}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 42, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 42 - } - }, + "start":0,"end":42,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":42}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 42, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 42 - } - }, + "start":4,"end":42,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":42}}, "id": { "type": "Identifier", - "start": 4, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "foo" - }, + "start":4,"end":7,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":7},"identifierName":"foo"}, "name": "foo" }, "init": { "type": "ArrowFunctionExpression", - "start": 10, - "end": 42, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 42 - } - }, + "start":10,"end":42,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":42}}, "id": null, "generator": false, "async": true, "params": [ { "type": "Identifier", - "start": 17, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 25 - }, - "identifierName": "foo" - }, + "start":17,"end":25,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":25},"identifierName":"foo"}, "name": "foo", "typeAnnotation": { "type": "TypeAnnotation", - "start": 20, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":20,"end":25,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":25}}, "typeAnnotation": { "type": "GenericTypeAnnotation", - "start": 22, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":22,"end":25,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":25}}, "typeParameters": null, "id": { "type": "Identifier", - "start": 22, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 25 - }, - "identifierName": "bar" - }, + "start":22,"end":25,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":25},"identifierName":"bar"}, "name": "bar" } } @@ -160,64 +47,18 @@ }, { "type": "Identifier", - "start": 27, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 35 - }, - "identifierName": "bar" - }, + "start":27,"end":35,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":35},"identifierName":"bar"}, "name": "bar", "typeAnnotation": { "type": "TypeAnnotation", - "start": 30, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":30,"end":35,"loc":{"start":{"line":1,"column":30},"end":{"line":1,"column":35}}, "typeAnnotation": { "type": "GenericTypeAnnotation", - "start": 32, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 32 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":32,"end":35,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":35}}, "typeParameters": null, "id": { "type": "Identifier", - "start": 32, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 32 - }, - "end": { - "line": 1, - "column": 35 - }, - "identifierName": "foo" - }, + "start":32,"end":35,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":35},"identifierName":"foo"}, "name": "foo" } } @@ -226,18 +67,7 @@ ], "body": { "type": "BlockStatement", - "start": 40, - "end": 42, - "loc": { - "start": { - "line": 1, - "column": 40 - }, - "end": { - "line": 1, - "column": 42 - } - }, + "start":40,"end":42,"loc":{"start":{"line":1,"column":40},"end":{"line":1,"column":42}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/7/output.json b/packages/babel-parser/test/fixtures/flow/type-annotations/7/output.json index 04a418e70d89..b49204c7f0b3 100644 --- a/packages/babel-parser/test/fixtures/flow/type-annotations/7/output.json +++ b/packages/babel-parser/test/fixtures/flow/type-annotations/7/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, "program": { "type": "Program", - "start": 0, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, "id": { "type": "Identifier", - "start": 9, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "foo" - }, + "start":9,"end":12,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":12},"identifierName":"foo"}, "name": "foo" }, "generator": false, @@ -65,64 +20,19 @@ "params": [ { "type": "Identifier", - "start": 13, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 33 - }, - "identifierName": "callback" - }, + "start":13,"end":33,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":33},"identifierName":"callback"}, "name": "callback", "typeAnnotation": { "type": "TypeAnnotation", - "start": 21, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":21,"end":33,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":33}}, "typeAnnotation": { "type": "FunctionTypeAnnotation", - "start": 23, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":23,"end":33,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":33}}, "params": [], "rest": null, "returnType": { "type": "VoidTypeAnnotation", - "start": 29, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 1, - "column": 33 - } - } + "start":29,"end":33,"loc":{"start":{"line":1,"column":29},"end":{"line":1,"column":33}} }, "typeParameters": null } @@ -131,18 +41,7 @@ ], "body": { "type": "BlockStatement", - "start": 34, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 34 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":34,"end":36,"loc":{"start":{"line":1,"column":34},"end":{"line":1,"column":36}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/70/output.json b/packages/babel-parser/test/fixtures/flow/type-annotations/70/output.json index 92c2e5e1665d..791438f7b79c 100644 --- a/packages/babel-parser/test/fixtures/flow/type-annotations/70/output.json +++ b/packages/babel-parser/test/fixtures/flow/type-annotations/70/output.json @@ -1,122 +1,33 @@ { "type": "File", - "start": 0, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, "program": { "type": "Program", - "start": 0, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":4,"end":33,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":33}}, "id": { "type": "Identifier", - "start": 4, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "foo" - }, + "start":4,"end":7,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":7},"identifierName":"foo"}, "name": "foo" }, "init": { "type": "ArrowFunctionExpression", - "start": 10, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":10,"end":33,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":33}}, "returnType": { "type": "TypeAnnotation", - "start": 18, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":18,"end":26,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":26}}, "typeAnnotation": { "type": "NumberTypeAnnotation", - "start": 20, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 26 - } - } + "start":20,"end":26,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":26}} } }, "id": null, @@ -125,19 +36,7 @@ "params": [], "body": { "type": "Identifier", - "start": 30, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 1, - "column": 33 - }, - "identifierName": "bar" - }, + "start":30,"end":33,"loc":{"start":{"line":1,"column":30},"end":{"line":1,"column":33},"identifierName":"bar"}, "name": "bar" } } diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/71/output.json b/packages/babel-parser/test/fixtures/flow/type-annotations/71/output.json index e7baf1080ce3..0f66616e39e7 100644 --- a/packages/babel-parser/test/fixtures/flow/type-annotations/71/output.json +++ b/packages/babel-parser/test/fixtures/flow/type-annotations/71/output.json @@ -1,122 +1,33 @@ { "type": "File", - "start": 0, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 37 - } - }, + "start":0,"end":37,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":37}}, "program": { "type": "Program", - "start": 0, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 37 - } - }, + "start":0,"end":37,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":37}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 37 - } - }, + "start":0,"end":37,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":37}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":4,"end":36,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":36}}, "id": { "type": "Identifier", - "start": 4, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "foo" - }, + "start":4,"end":7,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":7},"identifierName":"foo"}, "name": "foo" }, "init": { "type": "ArrowFunctionExpression", - "start": 10, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":10,"end":36,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":36}}, "returnType": { "type": "TypeAnnotation", - "start": 21, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":21,"end":29,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":29}}, "typeAnnotation": { "type": "NumberTypeAnnotation", - "start": 23, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 29 - } - } + "start":23,"end":29,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":29}} } }, "id": null, @@ -125,37 +36,13 @@ "params": [ { "type": "Identifier", - "start": 17, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 20 - }, - "identifierName": "bar" - }, + "start":17,"end":20,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":20},"identifierName":"bar"}, "name": "bar" } ], "body": { "type": "Identifier", - "start": 33, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 33 - }, - "end": { - "line": 1, - "column": 36 - }, - "identifierName": "bar" - }, + "start":33,"end":36,"loc":{"start":{"line":1,"column":33},"end":{"line":1,"column":36},"identifierName":"bar"}, "name": "bar" } } diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/72/output.json b/packages/babel-parser/test/fixtures/flow/type-annotations/72/output.json index 605f52438707..36bd9e345659 100644 --- a/packages/babel-parser/test/fixtures/flow/type-annotations/72/output.json +++ b/packages/babel-parser/test/fixtures/flow/type-annotations/72/output.json @@ -1,123 +1,34 @@ { "type": "File", - "start": 0, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, "program": { "type": "Program", - "start": 0, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":4,"end":29,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":29}}, "id": { "type": "Identifier", - "start": 4, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "foo" - }, + "start":4,"end":7,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":7},"identifierName":"foo"}, "name": "foo" }, "init": { "type": "ArrowFunctionExpression", - "start": 11, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":11,"end":28,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":28}}, "predicate": null, "returnType": { "type": "TypeAnnotation", - "start": 13, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":13,"end":21,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":21}}, "typeAnnotation": { "type": "NumberTypeAnnotation", - "start": 15, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 21 - } - } + "start":15,"end":21,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":21}} } }, "id": null, @@ -126,19 +37,7 @@ "params": [], "body": { "type": "Identifier", - "start": 25, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 28 - }, - "identifierName": "bar" - }, + "start":25,"end":28,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":28},"identifierName":"bar"}, "name": "bar" }, "extra": { diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/73/output.json b/packages/babel-parser/test/fixtures/flow/type-annotations/73/output.json index 566e2fa3f54a..910d7c4938bd 100644 --- a/packages/babel-parser/test/fixtures/flow/type-annotations/73/output.json +++ b/packages/babel-parser/test/fixtures/flow/type-annotations/73/output.json @@ -1,123 +1,34 @@ { "type": "File", - "start": 0, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, "program": { "type": "Program", - "start": 0, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":4,"end":32,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":32}}, "id": { "type": "Identifier", - "start": 4, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "foo" - }, + "start":4,"end":7,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":7},"identifierName":"foo"}, "name": "foo" }, "init": { "type": "ArrowFunctionExpression", - "start": 11, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":11,"end":31,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":31}}, "predicate": null, "returnType": { "type": "TypeAnnotation", - "start": 16, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":16,"end":24,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":24}}, "typeAnnotation": { "type": "NumberTypeAnnotation", - "start": 18, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 24 - } - } + "start":18,"end":24,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":24}} } }, "id": null, @@ -126,37 +37,13 @@ "params": [ { "type": "Identifier", - "start": 12, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 15 - }, - "identifierName": "bar" - }, + "start":12,"end":15,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":15},"identifierName":"bar"}, "name": "bar" } ], "body": { "type": "Identifier", - "start": 28, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 31 - }, - "identifierName": "bar" - }, + "start":28,"end":31,"loc":{"start":{"line":1,"column":28},"end":{"line":1,"column":31},"identifierName":"bar"}, "name": "bar" }, "extra": { diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/74/output.json b/packages/babel-parser/test/fixtures/flow/type-annotations/74/output.json index 419b2b79b70f..cb52b23baff7 100644 --- a/packages/babel-parser/test/fixtures/flow/type-annotations/74/output.json +++ b/packages/babel-parser/test/fixtures/flow/type-annotations/74/output.json @@ -1,137 +1,37 @@ { "type": "File", - "start": 0, - "end": 43, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 43 - } - }, + "start":0,"end":43,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":43}}, "program": { "type": "Program", - "start": 0, - "end": 43, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 43 - } - }, + "start":0,"end":43,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":43}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 43, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 43 - } - }, + "start":0,"end":43,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":43}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 42, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 42 - } - }, + "start":4,"end":42,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":42}}, "id": { "type": "Identifier", - "start": 4, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "foo" - }, + "start":4,"end":7,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":7},"identifierName":"foo"}, "name": "foo" }, "init": { "type": "TypeCastExpression", - "start": 11, - "end": 41, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 41 - } - }, + "start":11,"end":41,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":41}}, "expression": { "type": "ArrowFunctionExpression", - "start": 12, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":12,"end":32,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":32}}, "predicate": null, "returnType": { "type": "TypeAnnotation", - "start": 17, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":17,"end":25,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":25}}, "typeAnnotation": { "type": "NumberTypeAnnotation", - "start": 19, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 25 - } - } + "start":19,"end":25,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":25}} } }, "id": null, @@ -140,37 +40,13 @@ "params": [ { "type": "Identifier", - "start": 13, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 16 - }, - "identifierName": "bar" - }, + "start":13,"end":16,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":16},"identifierName":"bar"}, "name": "bar" } ], "body": { "type": "Identifier", - "start": 29, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 1, - "column": 32 - }, - "identifierName": "bar" - }, + "start":29,"end":32,"loc":{"start":{"line":1,"column":29},"end":{"line":1,"column":32},"identifierName":"bar"}, "name": "bar" }, "extra": { @@ -180,32 +56,10 @@ }, "typeAnnotation": { "type": "TypeAnnotation", - "start": 33, - "end": 41, - "loc": { - "start": { - "line": 1, - "column": 33 - }, - "end": { - "line": 1, - "column": 41 - } - }, + "start":33,"end":41,"loc":{"start":{"line":1,"column":33},"end":{"line":1,"column":41}}, "typeAnnotation": { "type": "NumberTypeAnnotation", - "start": 35, - "end": 41, - "loc": { - "start": { - "line": 1, - "column": 35 - }, - "end": { - "line": 1, - "column": 41 - } - } + "start":35,"end":41,"loc":{"start":{"line":1,"column":35},"end":{"line":1,"column":41}} } }, "extra": { diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/75/output.json b/packages/babel-parser/test/fixtures/flow/type-annotations/75/output.json index 664595806087..82bd2b624fd0 100644 --- a/packages/babel-parser/test/fixtures/flow/type-annotations/75/output.json +++ b/packages/babel-parser/test/fixtures/flow/type-annotations/75/output.json @@ -1,122 +1,33 @@ { "type": "File", - "start": 0, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, "program": { "type": "Program", - "start": 0, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":4,"end":35,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":35}}, "id": { "type": "Identifier", - "start": 4, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "foo" - }, + "start":4,"end":7,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":7},"identifierName":"foo"}, "name": "foo" }, "init": { "type": "ArrowFunctionExpression", - "start": 11, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":11,"end":34,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":34}}, "returnType": { "type": "TypeAnnotation", - "start": 19, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":19,"end":27,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":27}}, "typeAnnotation": { "type": "NumberTypeAnnotation", - "start": 21, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 27 - } - } + "start":21,"end":27,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":27}} } }, "id": null, @@ -125,19 +36,7 @@ "params": [], "body": { "type": "Identifier", - "start": 31, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 31 - }, - "end": { - "line": 1, - "column": 34 - }, - "identifierName": "bar" - }, + "start":31,"end":34,"loc":{"start":{"line":1,"column":31},"end":{"line":1,"column":34},"identifierName":"bar"}, "name": "bar" }, "extra": { diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/76/output.json b/packages/babel-parser/test/fixtures/flow/type-annotations/76/output.json index 584b5db6d36f..fd87323be264 100644 --- a/packages/babel-parser/test/fixtures/flow/type-annotations/76/output.json +++ b/packages/babel-parser/test/fixtures/flow/type-annotations/76/output.json @@ -1,122 +1,33 @@ { "type": "File", - "start": 0, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 39 - } - }, + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":39}}, "program": { "type": "Program", - "start": 0, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 39 - } - }, + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":39}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 39 - } - }, + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":39}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":4,"end":38,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":38}}, "id": { "type": "Identifier", - "start": 4, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "foo" - }, + "start":4,"end":7,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":7},"identifierName":"foo"}, "name": "foo" }, "init": { "type": "ArrowFunctionExpression", - "start": 11, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 37 - } - }, + "start":11,"end":37,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":37}}, "returnType": { "type": "TypeAnnotation", - "start": 22, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":22,"end":30,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":30}}, "typeAnnotation": { "type": "NumberTypeAnnotation", - "start": 24, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 30 - } - } + "start":24,"end":30,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":30}} } }, "id": null, @@ -125,37 +36,13 @@ "params": [ { "type": "Identifier", - "start": 18, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 21 - }, - "identifierName": "bar" - }, + "start":18,"end":21,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":21},"identifierName":"bar"}, "name": "bar" } ], "body": { "type": "Identifier", - "start": 34, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 34 - }, - "end": { - "line": 1, - "column": 37 - }, - "identifierName": "bar" - }, + "start":34,"end":37,"loc":{"start":{"line":1,"column":34},"end":{"line":1,"column":37},"identifierName":"bar"}, "name": "bar" }, "extra": { diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/77/output.json b/packages/babel-parser/test/fixtures/flow/type-annotations/77/output.json index 7437eddc1eea..34302acdb383 100644 --- a/packages/babel-parser/test/fixtures/flow/type-annotations/77/output.json +++ b/packages/babel-parser/test/fixtures/flow/type-annotations/77/output.json @@ -1,136 +1,36 @@ { "type": "File", - "start": 0, - "end": 49, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 49 - } - }, + "start":0,"end":49,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":49}}, "program": { "type": "Program", - "start": 0, - "end": 49, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 49 - } - }, + "start":0,"end":49,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":49}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 49, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 49 - } - }, + "start":0,"end":49,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":49}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 48, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 48 - } - }, + "start":4,"end":48,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":48}}, "id": { "type": "Identifier", - "start": 4, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "foo" - }, + "start":4,"end":7,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":7},"identifierName":"foo"}, "name": "foo" }, "init": { "type": "TypeCastExpression", - "start": 11, - "end": 47, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 47 - } - }, + "start":11,"end":47,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":47}}, "expression": { "type": "ArrowFunctionExpression", - "start": 12, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":12,"end":38,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":38}}, "returnType": { "type": "TypeAnnotation", - "start": 23, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":23,"end":31,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":31}}, "typeAnnotation": { "type": "NumberTypeAnnotation", - "start": 25, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 31 - } - } + "start":25,"end":31,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":31}} } }, "id": null, @@ -139,37 +39,13 @@ "params": [ { "type": "Identifier", - "start": 19, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 22 - }, - "identifierName": "bar" - }, + "start":19,"end":22,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":22},"identifierName":"bar"}, "name": "bar" } ], "body": { "type": "Identifier", - "start": 35, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 35 - }, - "end": { - "line": 1, - "column": 38 - }, - "identifierName": "bar" - }, + "start":35,"end":38,"loc":{"start":{"line":1,"column":35},"end":{"line":1,"column":38},"identifierName":"bar"}, "name": "bar" }, "extra": { @@ -179,32 +55,10 @@ }, "typeAnnotation": { "type": "TypeAnnotation", - "start": 39, - "end": 47, - "loc": { - "start": { - "line": 1, - "column": 39 - }, - "end": { - "line": 1, - "column": 47 - } - }, + "start":39,"end":47,"loc":{"start":{"line":1,"column":39},"end":{"line":1,"column":47}}, "typeAnnotation": { "type": "NumberTypeAnnotation", - "start": 41, - "end": 47, - "loc": { - "start": { - "line": 1, - "column": 41 - }, - "end": { - "line": 1, - "column": 47 - } - } + "start":41,"end":47,"loc":{"start":{"line":1,"column":41},"end":{"line":1,"column":47}} } }, "extra": { diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/78/output.json b/packages/babel-parser/test/fixtures/flow/type-annotations/78/output.json index b2e8a95b4eab..75b43c1f700d 100644 --- a/packages/babel-parser/test/fixtures/flow/type-annotations/78/output.json +++ b/packages/babel-parser/test/fixtures/flow/type-annotations/78/output.json @@ -1,126 +1,35 @@ { "type": "File", - "start": 0, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, "program": { "type": "Program", - "start": 0, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":4,"end":30,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":30}}, "id": { "type": "Identifier", - "start": 4, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "foo" - }, + "start":4,"end":7,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":7},"identifierName":"foo"}, "name": "foo" }, "init": { "type": "ConditionalExpression", - "start": 10, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":10,"end":30,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":30}}, "test": { "type": "Identifier", - "start": 10, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 13 - }, - "identifierName": "bar" - }, + "start":10,"end":13,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":13},"identifierName":"bar"}, "name": "bar" }, "consequent": { "type": "Identifier", - "start": 17, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 20 - }, - "identifierName": "foo" - }, + "start":17,"end":20,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":20},"identifierName":"foo"}, "name": "foo", "extra": { "parenthesized": true, @@ -129,19 +38,7 @@ }, "alternate": { "type": "Identifier", - "start": 24, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 30 - }, - "identifierName": "number" - }, + "start":24,"end":30,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":30},"identifierName":"number"}, "name": "number" } } diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/79/output.json b/packages/babel-parser/test/fixtures/flow/type-annotations/79/output.json index 1fc77461384d..b416d00df481 100644 --- a/packages/babel-parser/test/fixtures/flow/type-annotations/79/output.json +++ b/packages/babel-parser/test/fixtures/flow/type-annotations/79/output.json @@ -1,154 +1,42 @@ { "type": "File", - "start": 0, - "end": 43, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 43 - } - }, + "start":0,"end":43,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":43}}, "program": { "type": "Program", - "start": 0, - "end": 43, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 43 - } - }, + "start":0,"end":43,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":43}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 43, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 43 - } - }, + "start":0,"end":43,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":43}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 42, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 42 - } - }, + "start":4,"end":42,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":42}}, "id": { "type": "Identifier", - "start": 4, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "foo" - }, + "start":4,"end":7,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":7},"identifierName":"foo"}, "name": "foo" }, "init": { "type": "ConditionalExpression", - "start": 10, - "end": 42, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 42 - } - }, + "start":10,"end":42,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":42}}, "test": { "type": "Identifier", - "start": 10, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 13 - }, - "identifierName": "bar" - }, + "start":10,"end":13,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":13},"identifierName":"bar"}, "name": "bar" }, "consequent": { "type": "ArrowFunctionExpression", - "start": 16, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":16,"end":36,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":36}}, "predicate": null, "returnType": { "type": "TypeAnnotation", - "start": 22, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":22,"end":30,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":30}}, "typeAnnotation": { "type": "NumberTypeAnnotation", - "start": 24, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 30 - } - } + "start":24,"end":30,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":30}} } }, "id": null, @@ -157,55 +45,20 @@ "params": [ { "type": "Identifier", - "start": 17, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 20 - }, - "identifierName": "foo" - }, + "start":17,"end":20,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":20},"identifierName":"foo"}, "name": "foo" } ], "body": { "type": "BlockStatement", - "start": 34, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 34 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":34,"end":36,"loc":{"start":{"line":1,"column":34},"end":{"line":1,"column":36}}, "body": [], "directives": [] } }, "alternate": { "type": "Identifier", - "start": 39, - "end": 42, - "loc": { - "start": { - "line": 1, - "column": 39 - }, - "end": { - "line": 1, - "column": 42 - }, - "identifierName": "baz" - }, + "start":39,"end":42,"loc":{"start":{"line":1,"column":39},"end":{"line":1,"column":42},"identifierName":"baz"}, "name": "baz" } } diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/8/output.json b/packages/babel-parser/test/fixtures/flow/type-annotations/8/output.json index fe6af7116866..cbfbdd516663 100644 --- a/packages/babel-parser/test/fixtures/flow/type-annotations/8/output.json +++ b/packages/babel-parser/test/fixtures/flow/type-annotations/8/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":38}}, "program": { "type": "Program", - "start": 0, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":38}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":38}}, "id": { "type": "Identifier", - "start": 9, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "foo" - }, + "start":9,"end":12,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":12},"identifierName":"foo"}, "name": "foo" }, "generator": false, @@ -65,64 +20,19 @@ "params": [ { "type": "Identifier", - "start": 13, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 35 - }, - "identifierName": "callback" - }, + "start":13,"end":35,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":35},"identifierName":"callback"}, "name": "callback", "typeAnnotation": { "type": "TypeAnnotation", - "start": 21, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":21,"end":35,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":35}}, "typeAnnotation": { "type": "FunctionTypeAnnotation", - "start": 23, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":23,"end":35,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":35}}, "params": [], "rest": null, "returnType": { "type": "NumberTypeAnnotation", - "start": 29, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 1, - "column": 35 - } - } + "start":29,"end":35,"loc":{"start":{"line":1,"column":29},"end":{"line":1,"column":35}} }, "typeParameters": null } @@ -131,18 +41,7 @@ ], "body": { "type": "BlockStatement", - "start": 36, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 36 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":36,"end":38,"loc":{"start":{"line":1,"column":36},"end":{"line":1,"column":38}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/80/output.json b/packages/babel-parser/test/fixtures/flow/type-annotations/80/output.json index c093290d0c0c..8750bcb37950 100644 --- a/packages/babel-parser/test/fixtures/flow/type-annotations/80/output.json +++ b/packages/babel-parser/test/fixtures/flow/type-annotations/80/output.json @@ -1,172 +1,49 @@ { "type": "File", - "start": 0, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, "program": { "type": "Program", - "start": 0, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, "expression": { "type": "ArrowFunctionExpression", - "start": 1, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":1,"end":33,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":33}}, "id": null, "generator": false, "async": false, "params": [ { "type": "RestElement", - "start": 2, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":2,"end":24,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":24}}, "argument": { "type": "Identifier", - "start": 5, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "rest" - }, + "start":5,"end":9,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":9},"identifierName":"rest"}, "name": "rest" }, "typeAnnotation": { "type": "TypeAnnotation", - "start": 9, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":9,"end":24,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":24}}, "typeAnnotation": { "type": "GenericTypeAnnotation", - "start": 11, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":11,"end":24,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":24}}, "typeParameters": { "type": "TypeParameterInstantiation", - "start": 16, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":16,"end":24,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":24}}, "params": [ { "type": "NumberTypeAnnotation", - "start": 17, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 23 - } - } + "start":17,"end":23,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":23}} } ] }, "id": { "type": "Identifier", - "start": 11, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 16 - }, - "identifierName": "Array" - }, + "start":11,"end":16,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":16},"identifierName":"Array"}, "name": "Array" } } @@ -175,19 +52,7 @@ ], "body": { "type": "Identifier", - "start": 29, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 1, - "column": 33 - }, - "identifierName": "rest" - }, + "start":29,"end":33,"loc":{"start":{"line":1,"column":29},"end":{"line":1,"column":33},"identifierName":"rest"}, "name": "rest" }, "extra": { diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/81/output.json b/packages/babel-parser/test/fixtures/flow/type-annotations/81/output.json index f9f9e396dab3..ec686f840182 100644 --- a/packages/babel-parser/test/fixtures/flow/type-annotations/81/output.json +++ b/packages/babel-parser/test/fixtures/flow/type-annotations/81/output.json @@ -1,198 +1,53 @@ { "type": "File", - "start": 0, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, "program": { "type": "Program", - "start": 0, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":4,"end":34,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":34}}, "id": { "type": "Identifier", - "start": 4, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 34 - }, - "identifierName": "a" - }, + "start":4,"end":34,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":34},"identifierName":"a"}, "name": "a", "typeAnnotation": { "type": "TypeAnnotation", - "start": 5, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":5,"end":34,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":34}}, "typeAnnotation": { "type": "GenericTypeAnnotation", - "start": 7, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":7,"end":34,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":34}}, "typeParameters": { "type": "TypeParameterInstantiation", - "start": 10, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":10,"end":34,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":34}}, "params": [ { "type": "StringTypeAnnotation", - "start": 11, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 17 - } - } + "start":11,"end":17,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":17}} }, { "type": "GenericTypeAnnotation", - "start": 19, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":19,"end":32,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":32}}, "typeParameters": { "type": "TypeParameterInstantiation", - "start": 24, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":24,"end":32,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":32}}, "params": [ { "type": "StringTypeAnnotation", - "start": 25, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 31 - } - } + "start":25,"end":31,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":31}} } ] }, "id": { "type": "Identifier", - "start": 19, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 24 - }, - "identifierName": "Array" - }, + "start":19,"end":24,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":24},"identifierName":"Array"}, "name": "Array" } } @@ -200,19 +55,7 @@ }, "id": { "type": "Identifier", - "start": 7, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 10 - }, - "identifierName": "Map" - }, + "start":7,"end":10,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":10},"identifierName":"Map"}, "name": "Map" } } diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/82/output.json b/packages/babel-parser/test/fixtures/flow/type-annotations/82/output.json index 910e0c6bfa07..bd719a79fb2f 100644 --- a/packages/babel-parser/test/fixtures/flow/type-annotations/82/output.json +++ b/packages/babel-parser/test/fixtures/flow/type-annotations/82/output.json @@ -1,198 +1,53 @@ { "type": "File", - "start": 0, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, "program": { "type": "Program", - "start": 0, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":4,"end":33,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":33}}, "id": { "type": "Identifier", - "start": 4, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 33 - }, - "identifierName": "a" - }, + "start":4,"end":33,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":33},"identifierName":"a"}, "name": "a", "typeAnnotation": { "type": "TypeAnnotation", - "start": 5, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":5,"end":33,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":33}}, "typeAnnotation": { "type": "GenericTypeAnnotation", - "start": 7, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":7,"end":33,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":33}}, "typeParameters": { "type": "TypeParameterInstantiation", - "start": 10, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":10,"end":33,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":33}}, "params": [ { "type": "StringTypeAnnotation", - "start": 11, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 17 - } - } + "start":11,"end":17,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":17}} }, { "type": "GenericTypeAnnotation", - "start": 19, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":19,"end":32,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":32}}, "typeParameters": { "type": "TypeParameterInstantiation", - "start": 24, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":24,"end":32,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":32}}, "params": [ { "type": "StringTypeAnnotation", - "start": 25, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 31 - } - } + "start":25,"end":31,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":31}} } ] }, "id": { "type": "Identifier", - "start": 19, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 24 - }, - "identifierName": "Array" - }, + "start":19,"end":24,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":24},"identifierName":"Array"}, "name": "Array" } } @@ -200,19 +55,7 @@ }, "id": { "type": "Identifier", - "start": 7, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 10 - }, - "identifierName": "Map" - }, + "start":7,"end":10,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":10},"identifierName":"Map"}, "name": "Map" } } diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/83/output.json b/packages/babel-parser/test/fixtures/flow/type-annotations/83/output.json index 06d26c8e36dd..fd6dd628c922 100644 --- a/packages/babel-parser/test/fixtures/flow/type-annotations/83/output.json +++ b/packages/babel-parser/test/fixtures/flow/type-annotations/83/output.json @@ -1,121 +1,32 @@ { "type": "File", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "program": { "type": "Program", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":4,"end":15,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":15}}, "id": { "type": "Identifier", - "start": 4, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 15 - }, - "identifierName": "a" - }, + "start":4,"end":15,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":15},"identifierName":"a"}, "name": "a", "typeAnnotation": { "type": "TypeAnnotation", - "start": 5, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":5,"end":15,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":15}}, "typeAnnotation": { "type": "ArrayTypeAnnotation", - "start": 7, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":7,"end":15,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":15}}, "elementType": { "type": "NumberTypeAnnotation", - "start": 7, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 13 - } - } + "start":7,"end":13,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":13}} } } } diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/84/output.json b/packages/babel-parser/test/fixtures/flow/type-annotations/84/output.json index 3a08e3a09901..ec4c62081263 100644 --- a/packages/babel-parser/test/fixtures/flow/type-annotations/84/output.json +++ b/packages/babel-parser/test/fixtures/flow/type-annotations/84/output.json @@ -1,135 +1,35 @@ { "type": "File", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "program": { "type": "Program", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":4,"end":16,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":16}}, "id": { "type": "Identifier", - "start": 4, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 16 - }, - "identifierName": "a" - }, + "start":4,"end":16,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":16},"identifierName":"a"}, "name": "a", "typeAnnotation": { "type": "TypeAnnotation", - "start": 5, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":5,"end":16,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":16}}, "typeAnnotation": { "type": "NullableTypeAnnotation", - "start": 7, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":7,"end":16,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":16}}, "typeAnnotation": { "type": "ArrayTypeAnnotation", - "start": 8, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":8,"end":16,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":16}}, "elementType": { "type": "StringTypeAnnotation", - "start": 8, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 14 - } - } + "start":8,"end":14,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":14}} } } } diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/85/output.json b/packages/babel-parser/test/fixtures/flow/type-annotations/85/output.json index e973dbacf6dc..8a1a9a3dd0a0 100644 --- a/packages/babel-parser/test/fixtures/flow/type-annotations/85/output.json +++ b/packages/babel-parser/test/fixtures/flow/type-annotations/85/output.json @@ -1,168 +1,45 @@ { "type": "File", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "program": { "type": "Program", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":4,"end":22,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":22}}, "id": { "type": "Identifier", - "start": 4, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 22 - }, - "identifierName": "a" - }, + "start":4,"end":22,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":22},"identifierName":"a"}, "name": "a", "typeAnnotation": { "type": "TypeAnnotation", - "start": 5, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":5,"end":22,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":22}}, "typeAnnotation": { "type": "ArrayTypeAnnotation", - "start": 7, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":7,"end":22,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":22}}, "elementType": { "type": "GenericTypeAnnotation", - "start": 7, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":7,"end":20,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":20}}, "typeParameters": { "type": "TypeParameterInstantiation", - "start": 14, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":14,"end":20,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":20}}, "params": [ { "type": "BooleanTypeAnnotation", - "start": 15, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 19 - } - } + "start":15,"end":19,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":19}} } ] }, "id": { "type": "Identifier", - "start": 7, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 14 - }, - "identifierName": "Promise" - }, + "start":7,"end":14,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":14},"identifierName":"Promise"}, "name": "Promise" } } diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/86/output.json b/packages/babel-parser/test/fixtures/flow/type-annotations/86/output.json index 508ef355a397..3f525d36038f 100644 --- a/packages/babel-parser/test/fixtures/flow/type-annotations/86/output.json +++ b/packages/babel-parser/test/fixtures/flow/type-annotations/86/output.json @@ -1,219 +1,62 @@ { "type": "File", - "start": 0, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 39 - } - }, + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":39}}, "program": { "type": "Program", - "start": 0, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 39 - } - }, + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":39}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 39 - } - }, + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":39}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 39 - } - }, + "start":4,"end":39,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":39}}, "id": { "type": "Identifier", - "start": 4, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 39 - }, - "identifierName": "a" - }, + "start":4,"end":39,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":39},"identifierName":"a"}, "name": "a", "typeAnnotation": { "type": "TypeAnnotation", - "start": 5, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 39 - } - }, + "start":5,"end":39,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":39}}, "typeAnnotation": { "type": "FunctionTypeAnnotation", - "start": 6, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 39 - } - }, + "start":6,"end":39,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":39}}, "params": [], "rest": { "type": "FunctionTypeParam", - "start": 10, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":10,"end":28,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":28}}, "name": { "type": "Identifier", - "start": 10, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 14 - }, - "identifierName": "rest" - }, + "start":10,"end":14,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":14},"identifierName":"rest"}, "name": "rest" }, "optional": false, "typeAnnotation": { "type": "GenericTypeAnnotation", - "start": 15, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":15,"end":28,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":28}}, "typeParameters": { "type": "TypeParameterInstantiation", - "start": 20, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":20,"end":28,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":28}}, "params": [ { "type": "NumberTypeAnnotation", - "start": 21, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 27 - } - } + "start":21,"end":27,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":27}} } ] }, "id": { "type": "Identifier", - "start": 15, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 20 - }, - "identifierName": "Array" - }, + "start":15,"end":20,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":20},"identifierName":"Array"}, "name": "Array" } } }, "returnType": { "type": "NumberTypeAnnotation", - "start": 33, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 33 - }, - "end": { - "line": 1, - "column": 39 - } - } + "start":33,"end":39,"loc":{"start":{"line":1,"column":33},"end":{"line":1,"column":39}} }, "typeParameters": null } diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/87/output.json b/packages/babel-parser/test/fixtures/flow/type-annotations/87/output.json index d5d5e221c1cb..30d0d42c5f39 100644 --- a/packages/babel-parser/test/fixtures/flow/type-annotations/87/output.json +++ b/packages/babel-parser/test/fixtures/flow/type-annotations/87/output.json @@ -1,136 +1,36 @@ { "type": "File", - "start": 0, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, "program": { "type": "Program", - "start": 0, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":4,"end":28,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":28}}, "id": { "type": "Identifier", - "start": 4, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 28 - }, - "identifierName": "identity" - }, + "start":4,"end":28,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":28},"identifierName":"identity"}, "name": "identity", "typeAnnotation": { "type": "TypeAnnotation", - "start": 12, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":12,"end":28,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":28}}, "typeAnnotation": { "type": "FunctionTypeAnnotation", - "start": 14, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":14,"end":28,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":28}}, "typeParameters": { "type": "TypeParameterDeclaration", - "start": 14, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":14,"end":17,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":17}}, "params": [ { "type": "TypeParameter", - "start": 15, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":15,"end":16,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":16}}, "name": "T", "variance": null } @@ -139,66 +39,20 @@ "params": [ { "type": "FunctionTypeParam", - "start": 18, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":18,"end":22,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":22}}, "name": { "type": "Identifier", - "start": 18, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - }, - "identifierName": "x" - }, + "start":18,"end":19,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":19},"identifierName":"x"}, "name": "x" }, "optional": false, "typeAnnotation": { "type": "GenericTypeAnnotation", - "start": 21, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":21,"end":22,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":22}}, "typeParameters": null, "id": { "type": "Identifier", - "start": 21, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 22 - }, - "identifierName": "T" - }, + "start":21,"end":22,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":22},"identifierName":"T"}, "name": "T" } } @@ -207,34 +61,11 @@ "rest": null, "returnType": { "type": "GenericTypeAnnotation", - "start": 27, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":27,"end":28,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":28}}, "typeParameters": null, "id": { "type": "Identifier", - "start": 27, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 28 - }, - "identifierName": "T" - }, + "start":27,"end":28,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":28},"identifierName":"T"}, "name": "T" } } diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/88/output.json b/packages/babel-parser/test/fixtures/flow/type-annotations/88/output.json index 669b435ac2df..1b22c73f7400 100644 --- a/packages/babel-parser/test/fixtures/flow/type-annotations/88/output.json +++ b/packages/babel-parser/test/fixtures/flow/type-annotations/88/output.json @@ -1,136 +1,36 @@ { "type": "File", - "start": 0, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":38}}, "program": { "type": "Program", - "start": 0, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":38}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":38}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":4,"end":38,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":38}}, "id": { "type": "Identifier", - "start": 4, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 38 - }, - "identifierName": "identity" - }, + "start":4,"end":38,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":38},"identifierName":"identity"}, "name": "identity", "typeAnnotation": { "type": "TypeAnnotation", - "start": 12, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":12,"end":38,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":38}}, "typeAnnotation": { "type": "FunctionTypeAnnotation", - "start": 14, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":14,"end":38,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":38}}, "typeParameters": { "type": "TypeParameterDeclaration", - "start": 14, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":14,"end":17,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":17}}, "params": [ { "type": "TypeParameter", - "start": 15, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":15,"end":16,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":16}}, "name": "T", "variance": null } @@ -139,66 +39,20 @@ "params": [ { "type": "FunctionTypeParam", - "start": 18, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":18,"end":22,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":22}}, "name": { "type": "Identifier", - "start": 18, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - }, - "identifierName": "x" - }, + "start":18,"end":19,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":19},"identifierName":"x"}, "name": "x" }, "optional": false, "typeAnnotation": { "type": "GenericTypeAnnotation", - "start": 21, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":21,"end":22,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":22}}, "typeParameters": null, "id": { "type": "Identifier", - "start": 21, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 22 - }, - "identifierName": "T" - }, + "start":21,"end":22,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":22},"identifierName":"T"}, "name": "T" } } @@ -206,80 +60,23 @@ ], "rest": { "type": "FunctionTypeParam", - "start": 27, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":27,"end":32,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":32}}, "name": { "type": "Identifier", - "start": 27, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 28 - }, - "identifierName": "y" - }, + "start":27,"end":28,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":28},"identifierName":"y"}, "name": "y" }, "optional": false, "typeAnnotation": { "type": "ArrayTypeAnnotation", - "start": 29, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":29,"end":32,"loc":{"start":{"line":1,"column":29},"end":{"line":1,"column":32}}, "elementType": { "type": "GenericTypeAnnotation", - "start": 29, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":29,"end":30,"loc":{"start":{"line":1,"column":29},"end":{"line":1,"column":30}}, "typeParameters": null, "id": { "type": "Identifier", - "start": 29, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 1, - "column": 30 - }, - "identifierName": "T" - }, + "start":29,"end":30,"loc":{"start":{"line":1,"column":29},"end":{"line":1,"column":30},"identifierName":"T"}, "name": "T" } } @@ -287,34 +84,11 @@ }, "returnType": { "type": "GenericTypeAnnotation", - "start": 37, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 37 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":37,"end":38,"loc":{"start":{"line":1,"column":37},"end":{"line":1,"column":38}}, "typeParameters": null, "id": { "type": "Identifier", - "start": 37, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 37 - }, - "end": { - "line": 1, - "column": 38 - }, - "identifierName": "T" - }, + "start":37,"end":38,"loc":{"start":{"line":1,"column":37},"end":{"line":1,"column":38},"identifierName":"T"}, "name": "T" } } diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/9/output.json b/packages/babel-parser/test/fixtures/flow/type-annotations/9/output.json index ec5e4b479bec..7cb400a2d942 100644 --- a/packages/babel-parser/test/fixtures/flow/type-annotations/9/output.json +++ b/packages/babel-parser/test/fixtures/flow/type-annotations/9/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 44, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 44 - } - }, + "start":0,"end":44,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":44}}, "program": { "type": "Program", - "start": 0, - "end": 44, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 44 - } - }, + "start":0,"end":44,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":44}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 44, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 44 - } - }, + "start":0,"end":44,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":44}}, "id": { "type": "Identifier", - "start": 9, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "foo" - }, + "start":9,"end":12,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":12},"identifierName":"foo"}, "name": "foo" }, "generator": false, @@ -65,113 +20,34 @@ "params": [ { "type": "Identifier", - "start": 13, - "end": 41, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 41 - }, - "identifierName": "callback" - }, + "start":13,"end":41,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":41},"identifierName":"callback"}, "name": "callback", "typeAnnotation": { "type": "TypeAnnotation", - "start": 21, - "end": 41, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 41 - } - }, + "start":21,"end":41,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":41}}, "typeAnnotation": { "type": "FunctionTypeAnnotation", - "start": 23, - "end": 41, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 41 - } - }, + "start":23,"end":41,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":41}}, "params": [ { "type": "FunctionTypeParam", - "start": 24, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":24,"end":30,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":30}}, "name": { "type": "Identifier", - "start": 24, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 25 - }, - "identifierName": "_" - }, + "start":24,"end":25,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":25},"identifierName":"_"}, "name": "_" }, "optional": false, "typeAnnotation": { "type": "BooleanTypeAnnotation", - "start": 26, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 30 - } - } + "start":26,"end":30,"loc":{"start":{"line":1,"column":26},"end":{"line":1,"column":30}} } } ], "rest": null, "returnType": { "type": "NumberTypeAnnotation", - "start": 35, - "end": 41, - "loc": { - "start": { - "line": 1, - "column": 35 - }, - "end": { - "line": 1, - "column": 41 - } - } + "start":35,"end":41,"loc":{"start":{"line":1,"column":35},"end":{"line":1,"column":41}} }, "typeParameters": null } @@ -180,18 +56,7 @@ ], "body": { "type": "BlockStatement", - "start": 42, - "end": 44, - "loc": { - "start": { - "line": 1, - "column": 42 - }, - "end": { - "line": 1, - "column": 44 - } - }, + "start":42,"end":44,"loc":{"start":{"line":1,"column":42},"end":{"line":1,"column":44}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/97/output.json b/packages/babel-parser/test/fixtures/flow/type-annotations/97/output.json index 3bbbf6d80d84..a3f6ad7100a2 100644 --- a/packages/babel-parser/test/fixtures/flow/type-annotations/97/output.json +++ b/packages/babel-parser/test/fixtures/flow/type-annotations/97/output.json @@ -1,143 +1,43 @@ { "type": "File", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "program": { "type": "Program", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "expression": { "type": "ObjectExpression", - "start": 1, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":1,"end":23,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":23}}, "properties": [ { "type": "ObjectProperty", - "start": 2, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":2,"end":22,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":22}}, "method": false, "key": { "type": "Identifier", - "start": 2, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 3 - }, - "identifierName": "f" - }, + "start":2,"end":3,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":3},"identifierName":"f"}, "name": "f" }, "computed": false, "shorthand": false, "value": { "type": "FunctionExpression", - "start": 5, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":5,"end":22,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":22}}, "id": null, "generator": false, "async": false, "typeParameters": { "type": "TypeParameterDeclaration", - "start": 14, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":14,"end":17,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":17}}, "params": [ { "type": "TypeParameter", - "start": 15, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":15,"end":16,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":16}}, "name": "T", "variance": null } @@ -146,18 +46,7 @@ "params": [], "body": { "type": "BlockStatement", - "start": 20, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":20,"end":22,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":22}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/98/output.json b/packages/babel-parser/test/fixtures/flow/type-annotations/98/output.json index 6a24cf2f1e35..051aff7dcdeb 100644 --- a/packages/babel-parser/test/fixtures/flow/type-annotations/98/output.json +++ b/packages/babel-parser/test/fixtures/flow/type-annotations/98/output.json @@ -1,138 +1,37 @@ { "type": "File", - "start": 0, - "end": 57, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 57 - } - }, + "start":0,"end":57,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":57}}, "program": { "type": "Program", - "start": 0, - "end": 57, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 57 - } - }, + "start":0,"end":57,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":57}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 57, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 57 - } - }, + "start":0,"end":57,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":57}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 57, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 57 - } - }, + "start":4,"end":57,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":57}}, "id": { "type": "Identifier", - "start": 4, - "end": 57, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 57 - }, - "identifierName": "a" - }, + "start":4,"end":57,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":57},"identifierName":"a"}, "name": "a", "typeAnnotation": { "type": "TypeAnnotation", - "start": 5, - "end": 57, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 57 - } - }, + "start":5,"end":57,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":57}}, "typeAnnotation": { "type": "ObjectTypeAnnotation", - "start": 7, - "end": 57, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 57 - } - }, + "start":7,"end":57,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":57}}, "callProperties": [], "properties": [ { "type": "ObjectTypeProperty", - "start": 8, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":8,"end":23,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":23}}, "key": { "type": "Identifier", - "start": 8, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 14 - }, - "identifierName": "param1" - }, + "start":8,"end":14,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":14},"identifierName":"param1"}, "name": "param1" }, "static": false, @@ -141,51 +40,17 @@ "method": false, "value": { "type": "NumberTypeAnnotation", - "start": 17, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 23 - } - } + "start":17,"end":23,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":23}} }, "variance": null, "optional": true }, { "type": "ObjectTypeProperty", - "start": 25, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 39 - } - }, + "start":25,"end":39,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":39}}, "key": { "type": "Identifier", - "start": 25, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 31 - }, - "identifierName": "param2" - }, + "start":25,"end":31,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":31},"identifierName":"param2"}, "name": "param2" }, "static": false, @@ -194,51 +59,17 @@ "method": false, "value": { "type": "StringTypeAnnotation", - "start": 33, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 33 - }, - "end": { - "line": 1, - "column": 39 - } - } + "start":33,"end":39,"loc":{"start":{"line":1,"column":33},"end":{"line":1,"column":39}} }, "variance": null, "optional": false }, { "type": "ObjectTypeProperty", - "start": 41, - "end": 55, - "loc": { - "start": { - "line": 1, - "column": 41 - }, - "end": { - "line": 1, - "column": 55 - } - }, + "start":41,"end":55,"loc":{"start":{"line":1,"column":41},"end":{"line":1,"column":55}}, "key": { "type": "Identifier", - "start": 41, - "end": 47, - "loc": { - "start": { - "line": 1, - "column": 41 - }, - "end": { - "line": 1, - "column": 47 - }, - "identifierName": "param3" - }, + "start":41,"end":47,"loc":{"start":{"line":1,"column":41},"end":{"line":1,"column":47},"identifierName":"param3"}, "name": "param3" }, "static": false, @@ -247,18 +78,7 @@ "method": false, "value": { "type": "StringTypeAnnotation", - "start": 49, - "end": 55, - "loc": { - "start": { - "line": 1, - "column": 49 - }, - "end": { - "line": 1, - "column": 55 - } - } + "start":49,"end":55,"loc":{"start":{"line":1,"column":49},"end":{"line":1,"column":55}} }, "variance": null, "optional": false diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/99/output.json b/packages/babel-parser/test/fixtures/flow/type-annotations/99/output.json index b728bb8e6f02..92a30707f505 100644 --- a/packages/babel-parser/test/fixtures/flow/type-annotations/99/output.json +++ b/packages/babel-parser/test/fixtures/flow/type-annotations/99/output.json @@ -1,107 +1,29 @@ { "type": "File", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, "program": { "type": "Program", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, "expression": { "type": "ArrowFunctionExpression", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, "predicate": null, "returnType": { "type": "TypeAnnotation", - "start": 10, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":10,"end":13,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":13}}, "typeAnnotation": { "type": "GenericTypeAnnotation", - "start": 12, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":12,"end":13,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":13}}, "typeParameters": null, "id": { "type": "Identifier", - "start": 12, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - }, - "identifierName": "z" - }, + "start":12,"end":13,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":13},"identifierName":"z"}, "name": "z" } } @@ -112,53 +34,18 @@ "params": [ { "type": "Identifier", - "start": 1, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 4 - }, - "identifierName": "foo" - }, + "start":1,"end":4,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":4},"identifierName":"foo"}, "name": "foo" }, { "type": "Identifier", - "start": 6, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "bar" - }, + "start":6,"end":9,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":9},"identifierName":"bar"}, "name": "bar" } ], "body": { "type": "NullLiteral", - "start": 17, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 21 - } - } + "start":17,"end":21,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":21}} } } } diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/arrow-func-return-newline/output.json b/packages/babel-parser/test/fixtures/flow/type-annotations/arrow-func-return-newline/output.json index 39903f16b10a..a727d87002c0 100644 --- a/packages/babel-parser/test/fixtures/flow/type-annotations/arrow-func-return-newline/output.json +++ b/packages/babel-parser/test/fixtures/flow/type-annotations/arrow-func-return-newline/output.json @@ -1,123 +1,34 @@ { "type": "File", - "start": 0, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 14 - } - }, + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":14}}, "program": { "type": "Program", - "start": 0, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 14 - } - }, + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":14}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 14 - } - }, + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":14}}, "declarations": [ { "type": "VariableDeclarator", - "start": 6, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 2, - "column": 14 - } - }, + "start":6,"end":38,"loc":{"start":{"line":1,"column":6},"end":{"line":2,"column":14}}, "id": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "x" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"x"}, "name": "x" }, "init": { "type": "ArrowFunctionExpression", - "start": 10, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 2, - "column": 14 - } - }, + "start":10,"end":38,"loc":{"start":{"line":1,"column":10},"end":{"line":2,"column":14}}, "predicate": null, "returnType": { "type": "TypeAnnotation", - "start": 24, - "end": 32, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 8 - } - }, + "start":24,"end":32,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":8}}, "typeAnnotation": { "type": "NumberTypeAnnotation", - "start": 26, - "end": 32, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 8 - } - } + "start":26,"end":32,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":8}} } }, "id": null, @@ -126,66 +37,21 @@ "params": [ { "type": "Identifier", - "start": 11, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 22 - }, - "identifierName": "foo" - }, + "start":11,"end":22,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":22},"identifierName":"foo"}, "name": "foo", "typeAnnotation": { "type": "TypeAnnotation", - "start": 14, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":14,"end":22,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":22}}, "typeAnnotation": { "type": "StringTypeAnnotation", - "start": 16, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 22 - } - } + "start":16,"end":22,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":22}} } } } ], "body": { "type": "BlockStatement", - "start": 36, - "end": 38, - "loc": { - "start": { - "line": 2, - "column": 12 - }, - "end": { - "line": 2, - "column": 14 - } - }, + "start":36,"end":38,"loc":{"start":{"line":2,"column":12},"end":{"line":2,"column":14}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/builtin/output.json b/packages/babel-parser/test/fixtures/flow/type-annotations/builtin/output.json index 9b3179172293..af55784168e2 100644 --- a/packages/babel-parser/test/fixtures/flow/type-annotations/builtin/output.json +++ b/packages/babel-parser/test/fixtures/flow/type-annotations/builtin/output.json @@ -1,602 +1,185 @@ { "type": "File", - "start": 0, - "end": 265, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 16, - "column": 17 - } - }, + "start":0,"end":265,"loc":{"start":{"line":1,"column":0},"end":{"line":16,"column":17}}, "program": { "type": "Program", - "start": 0, - "end": 265, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 16, - "column": 17 - } - }, + "start":0,"end":265,"loc":{"start":{"line":1,"column":0},"end":{"line":16,"column":17}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "TypeAlias", - "start": 10, - "end": 24, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 14 - } - }, + "start":10,"end":24,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":14}}, "id": { "type": "Identifier", - "start": 15, - "end": 17, - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 7 - }, - "identifierName": "T1" - }, + "start":15,"end":17,"loc":{"start":{"line":2,"column":5},"end":{"line":2,"column":7},"identifierName":"T1"}, "name": "T1" }, "typeParameters": null, "right": { "type": "AnyTypeAnnotation", - "start": 20, - "end": 23, - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 13 - } - } + "start":20,"end":23,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":13}} }, "leadingComments": [ { "type": "CommentLine", "value": " bounds", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - } + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}} } ] }, { "type": "TypeAlias", - "start": 25, - "end": 41, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 16 - } - }, + "start":25,"end":41,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":16}}, "id": { "type": "Identifier", - "start": 30, - "end": 32, - "loc": { - "start": { - "line": 3, - "column": 5 - }, - "end": { - "line": 3, - "column": 7 - }, - "identifierName": "T2" - }, + "start":30,"end":32,"loc":{"start":{"line":3,"column":5},"end":{"line":3,"column":7},"identifierName":"T2"}, "name": "T2" }, "typeParameters": null, "right": { "type": "MixedTypeAnnotation", - "start": 35, - "end": 40, - "loc": { - "start": { - "line": 3, - "column": 10 - }, - "end": { - "line": 3, - "column": 15 - } - } + "start":35,"end":40,"loc":{"start":{"line":3,"column":10},"end":{"line":3,"column":15}} } }, { "type": "TypeAlias", - "start": 42, - "end": 58, - "loc": { - "start": { - "line": 4, - "column": 0 - }, - "end": { - "line": 4, - "column": 16 - } - }, + "start":42,"end":58,"loc":{"start":{"line":4,"column":0},"end":{"line":4,"column":16}}, "id": { "type": "Identifier", - "start": 47, - "end": 49, - "loc": { - "start": { - "line": 4, - "column": 5 - }, - "end": { - "line": 4, - "column": 7 - }, - "identifierName": "T3" - }, + "start":47,"end":49,"loc":{"start":{"line":4,"column":5},"end":{"line":4,"column":7},"identifierName":"T3"}, "name": "T3" }, "typeParameters": null, "right": { "type": "EmptyTypeAnnotation", - "start": 52, - "end": 57, - "loc": { - "start": { - "line": 4, - "column": 10 - }, - "end": { - "line": 4, - "column": 15 - } - } + "start":52,"end":57,"loc":{"start":{"line":4,"column":10},"end":{"line":4,"column":15}} }, "trailingComments": [ { "type": "CommentLine", "value": " builtins", - "start": 59, - "end": 70, - "loc": { - "start": { - "line": 5, - "column": 0 - }, - "end": { - "line": 5, - "column": 11 - } - } + "start":59,"end":70,"loc":{"start":{"line":5,"column":0},"end":{"line":5,"column":11}} } ] }, { "type": "TypeAlias", - "start": 71, - "end": 86, - "loc": { - "start": { - "line": 6, - "column": 0 - }, - "end": { - "line": 6, - "column": 15 - } - }, + "start":71,"end":86,"loc":{"start":{"line":6,"column":0},"end":{"line":6,"column":15}}, "id": { "type": "Identifier", - "start": 76, - "end": 78, - "loc": { - "start": { - "line": 6, - "column": 5 - }, - "end": { - "line": 6, - "column": 7 - }, - "identifierName": "T4" - }, + "start":76,"end":78,"loc":{"start":{"line":6,"column":5},"end":{"line":6,"column":7},"identifierName":"T4"}, "name": "T4" }, "typeParameters": null, "right": { "type": "VoidTypeAnnotation", - "start": 81, - "end": 85, - "loc": { - "start": { - "line": 6, - "column": 10 - }, - "end": { - "line": 6, - "column": 14 - } - } + "start":81,"end":85,"loc":{"start":{"line":6,"column":10},"end":{"line":6,"column":14}} }, "leadingComments": [ { "type": "CommentLine", "value": " builtins", - "start": 59, - "end": 70, - "loc": { - "start": { - "line": 5, - "column": 0 - }, - "end": { - "line": 5, - "column": 11 - } - } + "start":59,"end":70,"loc":{"start":{"line":5,"column":0},"end":{"line":5,"column":11}} } ] }, { "type": "TypeAlias", - "start": 87, - "end": 104, - "loc": { - "start": { - "line": 7, - "column": 0 - }, - "end": { - "line": 7, - "column": 17 - } - }, + "start":87,"end":104,"loc":{"start":{"line":7,"column":0},"end":{"line":7,"column":17}}, "id": { "type": "Identifier", - "start": 92, - "end": 94, - "loc": { - "start": { - "line": 7, - "column": 5 - }, - "end": { - "line": 7, - "column": 7 - }, - "identifierName": "T5" - }, + "start":92,"end":94,"loc":{"start":{"line":7,"column":5},"end":{"line":7,"column":7},"identifierName":"T5"}, "name": "T5" }, "typeParameters": null, "right": { "type": "NumberTypeAnnotation", - "start": 97, - "end": 103, - "loc": { - "start": { - "line": 7, - "column": 10 - }, - "end": { - "line": 7, - "column": 16 - } - } + "start":97,"end":103,"loc":{"start":{"line":7,"column":10},"end":{"line":7,"column":16}} } }, { "type": "TypeAlias", - "start": 105, - "end": 122, - "loc": { - "start": { - "line": 8, - "column": 0 - }, - "end": { - "line": 8, - "column": 17 - } - }, + "start":105,"end":122,"loc":{"start":{"line":8,"column":0},"end":{"line":8,"column":17}}, "id": { "type": "Identifier", - "start": 110, - "end": 112, - "loc": { - "start": { - "line": 8, - "column": 5 - }, - "end": { - "line": 8, - "column": 7 - }, - "identifierName": "T6" - }, + "start":110,"end":112,"loc":{"start":{"line":8,"column":5},"end":{"line":8,"column":7},"identifierName":"T6"}, "name": "T6" }, "typeParameters": null, "right": { "type": "StringTypeAnnotation", - "start": 115, - "end": 121, - "loc": { - "start": { - "line": 8, - "column": 10 - }, - "end": { - "line": 8, - "column": 16 - } - } + "start":115,"end":121,"loc":{"start":{"line":8,"column":10},"end":{"line":8,"column":16}} } }, { "type": "TypeAlias", - "start": 123, - "end": 138, - "loc": { - "start": { - "line": 9, - "column": 0 - }, - "end": { - "line": 9, - "column": 15 - } - }, + "start":123,"end":138,"loc":{"start":{"line":9,"column":0},"end":{"line":9,"column":15}}, "id": { "type": "Identifier", - "start": 128, - "end": 130, - "loc": { - "start": { - "line": 9, - "column": 5 - }, - "end": { - "line": 9, - "column": 7 - }, - "identifierName": "T7" - }, + "start":128,"end":130,"loc":{"start":{"line":9,"column":5},"end":{"line":9,"column":7},"identifierName":"T7"}, "name": "T7" }, "typeParameters": null, "right": { "type": "BooleanTypeAnnotation", - "start": 133, - "end": 137, - "loc": { - "start": { - "line": 9, - "column": 10 - }, - "end": { - "line": 9, - "column": 14 - } - } + "start":133,"end":137,"loc":{"start":{"line":9,"column":10},"end":{"line":9,"column":14}} } }, { "type": "TypeAlias", - "start": 139, - "end": 157, - "loc": { - "start": { - "line": 10, - "column": 0 - }, - "end": { - "line": 10, - "column": 18 - } - }, + "start":139,"end":157,"loc":{"start":{"line":10,"column":0},"end":{"line":10,"column":18}}, "id": { "type": "Identifier", - "start": 144, - "end": 146, - "loc": { - "start": { - "line": 10, - "column": 5 - }, - "end": { - "line": 10, - "column": 7 - }, - "identifierName": "T8" - }, + "start":144,"end":146,"loc":{"start":{"line":10,"column":5},"end":{"line":10,"column":7},"identifierName":"T8"}, "name": "T8" }, "typeParameters": null, "right": { "type": "BooleanTypeAnnotation", - "start": 149, - "end": 156, - "loc": { - "start": { - "line": 10, - "column": 10 - }, - "end": { - "line": 10, - "column": 17 - } - } + "start":149,"end":156,"loc":{"start":{"line":10,"column":10},"end":{"line":10,"column":17}} }, "trailingComments": [ { "type": "CommentLine", "value": " literal type annotations", - "start": 158, - "end": 185, - "loc": { - "start": { - "line": 11, - "column": 0 - }, - "end": { - "line": 11, - "column": 27 - } - } + "start":158,"end":185,"loc":{"start":{"line":11,"column":0},"end":{"line":11,"column":27}} } ] }, { "type": "TypeAlias", - "start": 186, - "end": 201, - "loc": { - "start": { - "line": 12, - "column": 0 - }, - "end": { - "line": 12, - "column": 15 - } - }, + "start":186,"end":201,"loc":{"start":{"line":12,"column":0},"end":{"line":12,"column":15}}, "id": { "type": "Identifier", - "start": 191, - "end": 193, - "loc": { - "start": { - "line": 12, - "column": 5 - }, - "end": { - "line": 12, - "column": 7 - }, - "identifierName": "T9" - }, + "start":191,"end":193,"loc":{"start":{"line":12,"column":5},"end":{"line":12,"column":7},"identifierName":"T9"}, "name": "T9" }, "typeParameters": null, "right": { "type": "NullLiteralTypeAnnotation", - "start": 196, - "end": 200, - "loc": { - "start": { - "line": 12, - "column": 10 - }, - "end": { - "line": 12, - "column": 14 - } - } + "start":196,"end":200,"loc":{"start":{"line":12,"column":10},"end":{"line":12,"column":14}} }, "leadingComments": [ { "type": "CommentLine", "value": " literal type annotations", - "start": 158, - "end": 185, - "loc": { - "start": { - "line": 11, - "column": 0 - }, - "end": { - "line": 11, - "column": 27 - } - } + "start":158,"end":185,"loc":{"start":{"line":11,"column":0},"end":{"line":11,"column":27}} } ] }, { "type": "TypeAlias", - "start": 202, - "end": 216, - "loc": { - "start": { - "line": 13, - "column": 0 - }, - "end": { - "line": 13, - "column": 14 - } - }, + "start":202,"end":216,"loc":{"start":{"line":13,"column":0},"end":{"line":13,"column":14}}, "id": { "type": "Identifier", - "start": 207, - "end": 210, - "loc": { - "start": { - "line": 13, - "column": 5 - }, - "end": { - "line": 13, - "column": 8 - }, - "identifierName": "T10" - }, + "start":207,"end":210,"loc":{"start":{"line":13,"column":5},"end":{"line":13,"column":8},"identifierName":"T10"}, "name": "T10" }, "typeParameters": null, "right": { "type": "StringLiteralTypeAnnotation", - "start": 213, - "end": 215, - "loc": { - "start": { - "line": 13, - "column": 11 - }, - "end": { - "line": 13, - "column": 13 - } - }, + "start":213,"end":215,"loc":{"start":{"line":13,"column":11},"end":{"line":13,"column":13}}, "extra": { "rawValue": "", "raw": "\"\"" @@ -606,50 +189,16 @@ }, { "type": "TypeAlias", - "start": 217, - "end": 230, - "loc": { - "start": { - "line": 14, - "column": 0 - }, - "end": { - "line": 14, - "column": 13 - } - }, + "start":217,"end":230,"loc":{"start":{"line":14,"column":0},"end":{"line":14,"column":13}}, "id": { "type": "Identifier", - "start": 222, - "end": 225, - "loc": { - "start": { - "line": 14, - "column": 5 - }, - "end": { - "line": 14, - "column": 8 - }, - "identifierName": "T11" - }, + "start":222,"end":225,"loc":{"start":{"line":14,"column":5},"end":{"line":14,"column":8},"identifierName":"T11"}, "name": "T11" }, "typeParameters": null, "right": { "type": "NumberLiteralTypeAnnotation", - "start": 228, - "end": 229, - "loc": { - "start": { - "line": 14, - "column": 11 - }, - "end": { - "line": 14, - "column": 12 - } - }, + "start":228,"end":229,"loc":{"start":{"line":14,"column":11},"end":{"line":14,"column":12}}, "extra": { "rawValue": 0, "raw": "0" @@ -659,99 +208,31 @@ }, { "type": "TypeAlias", - "start": 231, - "end": 247, - "loc": { - "start": { - "line": 15, - "column": 0 - }, - "end": { - "line": 15, - "column": 16 - } - }, + "start":231,"end":247,"loc":{"start":{"line":15,"column":0},"end":{"line":15,"column":16}}, "id": { "type": "Identifier", - "start": 236, - "end": 239, - "loc": { - "start": { - "line": 15, - "column": 5 - }, - "end": { - "line": 15, - "column": 8 - }, - "identifierName": "T12" - }, + "start":236,"end":239,"loc":{"start":{"line":15,"column":5},"end":{"line":15,"column":8},"identifierName":"T12"}, "name": "T12" }, "typeParameters": null, "right": { "type": "BooleanLiteralTypeAnnotation", - "start": 242, - "end": 246, - "loc": { - "start": { - "line": 15, - "column": 11 - }, - "end": { - "line": 15, - "column": 15 - } - }, + "start":242,"end":246,"loc":{"start":{"line":15,"column":11},"end":{"line":15,"column":15}}, "value": true } }, { "type": "TypeAlias", - "start": 248, - "end": 265, - "loc": { - "start": { - "line": 16, - "column": 0 - }, - "end": { - "line": 16, - "column": 17 - } - }, + "start":248,"end":265,"loc":{"start":{"line":16,"column":0},"end":{"line":16,"column":17}}, "id": { "type": "Identifier", - "start": 253, - "end": 256, - "loc": { - "start": { - "line": 16, - "column": 5 - }, - "end": { - "line": 16, - "column": 8 - }, - "identifierName": "T13" - }, + "start":253,"end":256,"loc":{"start":{"line":16,"column":5},"end":{"line":16,"column":8},"identifierName":"T13"}, "name": "T13" }, "typeParameters": null, "right": { "type": "BooleanLiteralTypeAnnotation", - "start": 259, - "end": 264, - "loc": { - "start": { - "line": 16, - "column": 11 - }, - "end": { - "line": 16, - "column": 16 - } - }, + "start":259,"end":264,"loc":{"start":{"line":16,"column":11},"end":{"line":16,"column":16}}, "value": false } } @@ -762,50 +243,17 @@ { "type": "CommentLine", "value": " bounds", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - } + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}} }, { "type": "CommentLine", "value": " builtins", - "start": 59, - "end": 70, - "loc": { - "start": { - "line": 5, - "column": 0 - }, - "end": { - "line": 5, - "column": 11 - } - } + "start":59,"end":70,"loc":{"start":{"line":5,"column":0},"end":{"line":5,"column":11}} }, { "type": "CommentLine", "value": " literal type annotations", - "start": 158, - "end": 185, - "loc": { - "start": { - "line": 11, - "column": 0 - }, - "end": { - "line": 11, - "column": 27 - } - } + "start":158,"end":185,"loc":{"start":{"line":11,"column":0},"end":{"line":11,"column":27}} } ] } \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/existential-type-param-2/output.json b/packages/babel-parser/test/fixtures/flow/type-annotations/existential-type-param-2/output.json index c6ffbdecd47f..54e622f199e0 100644 --- a/packages/babel-parser/test/fixtures/flow/type-annotations/existential-type-param-2/output.json +++ b/packages/babel-parser/test/fixtures/flow/type-annotations/existential-type-param-2/output.json @@ -1,153 +1,42 @@ { "type": "File", - "start": 0, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":38}}, "program": { "type": "Program", - "start": 0, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":38}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":38}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":4,"end":38,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":38}}, "id": { "type": "Identifier", - "start": 4, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "f" - }, + "start":4,"end":9,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":9},"identifierName":"f"}, "name": "f", "typeAnnotation": { "type": "TypeAnnotation", - "start": 6, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":6,"end":9,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":9}}, "typeAnnotation": { "type": "ExistsTypeAnnotation", - "start": 8, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - } + "start":8,"end":9,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":9}} } } }, "init": { "type": "ArrowFunctionExpression", - "start": 12, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":12,"end":38,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":38}}, "predicate": null, "returnType": { "type": "TypeAnnotation", - "start": 27, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":27,"end":32,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":32}}, "typeAnnotation": { "type": "ExistsTypeAnnotation", - "start": 30, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 1, - "column": 31 - } - } + "start":30,"end":31,"loc":{"start":{"line":1,"column":30},"end":{"line":1,"column":31}} } }, "id": null, @@ -156,78 +45,22 @@ "params": [ { "type": "Identifier", - "start": 13, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 25 - }, - "identifierName": "x" - }, + "start":13,"end":25,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":25},"identifierName":"x"}, "name": "x", "typeAnnotation": { "type": "TypeAnnotation", - "start": 15, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":15,"end":25,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":25}}, "typeAnnotation": { "type": "UnionTypeAnnotation", - "start": 17, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":17,"end":25,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":25}}, "types": [ { "type": "NullLiteralTypeAnnotation", - "start": 17, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 21 - } - } + "start":17,"end":21,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":21}} }, { "type": "ExistsTypeAnnotation", - "start": 24, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 25 - } - } + "start":24,"end":25,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":25}} } ] } @@ -236,18 +69,7 @@ ], "body": { "type": "BlockStatement", - "start": 36, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 36 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":36,"end":38,"loc":{"start":{"line":1,"column":36},"end":{"line":1,"column":38}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/existential-type-param/output.json b/packages/babel-parser/test/fixtures/flow/type-annotations/existential-type-param/output.json index 10d818ccb53b..bd76acce912f 100644 --- a/packages/babel-parser/test/fixtures/flow/type-annotations/existential-type-param/output.json +++ b/packages/babel-parser/test/fixtures/flow/type-annotations/existential-type-param/output.json @@ -1,94 +1,27 @@ { "type": "File", - "start": 0, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, "program": { "type": "Program", - "start": 0, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "TypeAlias", - "start": 0, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, "id": { "type": "Identifier", - "start": 5, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 10 - }, - "identifierName": "Maybe" - }, + "start":5,"end":10,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":10},"identifierName":"Maybe"}, "name": "Maybe" }, "typeParameters": { "type": "TypeParameterDeclaration", - "start": 10, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":10,"end":13,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":13}}, "params": [ { "type": "TypeParameter", - "start": 11, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":11,"end":12,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":12}}, "name": "T", "variance": null } @@ -96,98 +29,30 @@ }, "right": { "type": "GenericTypeAnnotation", - "start": 16, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":16,"end":28,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":28}}, "typeParameters": { "type": "TypeParameterInstantiation", - "start": 22, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":22,"end":28,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":28}}, "params": [ { "type": "GenericTypeAnnotation", - "start": 23, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":23,"end":24,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":24}}, "typeParameters": null, "id": { "type": "Identifier", - "start": 23, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 24 - }, - "identifierName": "T" - }, + "start":23,"end":24,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":24},"identifierName":"T"}, "name": "T" } }, { "type": "ExistsTypeAnnotation", - "start": 26, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 27 - } - } + "start":26,"end":27,"loc":{"start":{"line":1,"column":26},"end":{"line":1,"column":27}} } ] }, "id": { "type": "Identifier", - "start": 16, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 22 - }, - "identifierName": "_Maybe" - }, + "start":16,"end":22,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":22},"identifierName":"_Maybe"}, "name": "_Maybe" } } diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/function-expression-inside-jsx-attr/output.json b/packages/babel-parser/test/fixtures/flow/type-annotations/function-expression-inside-jsx-attr/output.json index 6f52323d1678..d53d3303ef77 100644 --- a/packages/babel-parser/test/fixtures/flow/type-annotations/function-expression-inside-jsx-attr/output.json +++ b/packages/babel-parser/test/fixtures/flow/type-annotations/function-expression-inside-jsx-attr/output.json @@ -1,251 +1,78 @@ { "type": "File", - "start": 0, - "end": 42, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 42 - } - }, + "start":0,"end":42,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":42}}, "program": { "type": "Program", - "start": 0, - "end": 42, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 42 - } - }, + "start":0,"end":42,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":42}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 42, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 42 - } - }, + "start":0,"end":42,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":42}}, "expression": { "type": "JSXElement", - "start": 0, - "end": 42, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 42 - } - }, + "start":0,"end":42,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":42}}, "openingElement": { "type": "JSXOpeningElement", - "start": 0, - "end": 42, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 42 - } + "start":0,"end":42,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":42}}, + "name": { + "type": "JSXIdentifier", + "start":1,"end":4,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":4}}, + "name": "bar" }, "attributes": [ { "type": "JSXAttribute", - "start": 5, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 39 - } - }, + "start":5,"end":39,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":39}}, "name": { "type": "JSXIdentifier", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, "name": "x" }, "value": { "type": "JSXExpressionContainer", - "start": 7, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 39 - } - }, + "start":7,"end":39,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":39}}, "expression": { "type": "FunctionExpression", - "start": 8, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":8,"end":38,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":38}}, "id": null, "generator": false, "async": false, "params": [ { "type": "Identifier", - "start": 18, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - }, - "identifierName": "x" - }, + "start":18,"end":19,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":19},"identifierName":"x"}, "name": "x" } ], "predicate": null, "returnType": { "type": "TypeAnnotation", - "start": 20, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":20,"end":35,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":35}}, "typeAnnotation": { "type": "GenericTypeAnnotation", - "start": 22, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":22,"end":35,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":35}}, "typeParameters": { "type": "TypeParameterInstantiation", - "start": 27, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":27,"end":35,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":35}}, "params": [ { "type": "StringTypeAnnotation", - "start": 28, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 34 - } - } + "start":28,"end":34,"loc":{"start":{"line":1,"column":28},"end":{"line":1,"column":34}} } ] }, "id": { "type": "Identifier", - "start": 22, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 27 - }, - "identifierName": "Array" - }, + "start":22,"end":27,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":27},"identifierName":"Array"}, "name": "Array" } } }, "body": { "type": "BlockStatement", - "start": 36, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 36 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":36,"end":38,"loc":{"start":{"line":1,"column":36},"end":{"line":1,"column":38}}, "body": [], "directives": [] } @@ -253,22 +80,6 @@ } } ], - "name": { - "type": "JSXIdentifier", - "start": 1, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 4 - } - }, - "name": "bar" - }, "selfClosing": true }, "closingElement": null, diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/function-is-valid-type/output.json b/packages/babel-parser/test/fixtures/flow/type-annotations/function-is-valid-type/output.json index 056dc7de7b00..43c601b76553 100644 --- a/packages/babel-parser/test/fixtures/flow/type-annotations/function-is-valid-type/output.json +++ b/packages/babel-parser/test/fixtures/flow/type-annotations/function-is-valid-type/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, "program": { "type": "Program", - "start": 0, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, "id": { "type": "Identifier", - "start": 9, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "foo" - }, + "start":9,"end":12,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":12},"identifierName":"foo"}, "name": "foo" }, "generator": false, @@ -65,49 +20,14 @@ "params": [ { "type": "Identifier", - "start": 13, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 23 - }, - "identifierName": "a" - }, + "start":13,"end":23,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":23},"identifierName":"a"}, "name": "a", "typeAnnotation": { "type": "TypeAnnotation", - "start": 14, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":14,"end":23,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":23}}, "typeAnnotation": { "type": "Identifier", - "start": 15, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 23 - }, - "identifierName": "function" - }, + "start":15,"end":23,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":23},"identifierName":"function"}, "name": "function" } } @@ -115,18 +35,7 @@ ], "body": { "type": "BlockStatement", - "start": 25, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":25,"end":27,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":27}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/negative-number-literal/output.json b/packages/babel-parser/test/fixtures/flow/type-annotations/negative-number-literal/output.json index 78be0c8ba059..37c944d36f74 100644 --- a/packages/babel-parser/test/fixtures/flow/type-annotations/negative-number-literal/output.json +++ b/packages/babel-parser/test/fixtures/flow/type-annotations/negative-number-literal/output.json @@ -1,95 +1,28 @@ { "type": "File", - "start": 0, - "end": 110, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 12, - "column": 19 - } - }, + "start":0,"end":110,"loc":{"start":{"line":1,"column":0},"end":{"line":12,"column":19}}, "program": { "type": "Program", - "start": 0, - "end": 110, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 12, - "column": 19 - } - }, + "start":0,"end":110,"loc":{"start":{"line":1,"column":0},"end":{"line":12,"column":19}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "TypeAlias", - "start": 18, - "end": 60, - "loc": { - "start": { - "line": 5, - "column": 0 - }, - "end": { - "line": 8, - "column": 6 - } - }, + "start":18,"end":60,"loc":{"start":{"line":5,"column":0},"end":{"line":8,"column":6}}, "id": { "type": "Identifier", - "start": 23, - "end": 38, - "loc": { - "start": { - "line": 5, - "column": 5 - }, - "end": { - "line": 5, - "column": 20 - }, - "identifierName": "DirectionVector" - }, + "start":23,"end":38,"loc":{"start":{"line":5,"column":5},"end":{"line":5,"column":20},"identifierName":"DirectionVector"}, "name": "DirectionVector" }, "typeParameters": null, "right": { "type": "UnionTypeAnnotation", - "start": 43, - "end": 59, - "loc": { - "start": { - "line": 6, - "column": 2 - }, - "end": { - "line": 8, - "column": 5 - } - }, + "start":43,"end":59,"loc":{"start":{"line":6,"column":2},"end":{"line":8,"column":5}}, "types": [ { "type": "NumberLiteralTypeAnnotation", - "start": 45, - "end": 47, - "loc": { - "start": { - "line": 6, - "column": 4 - }, - "end": { - "line": 6, - "column": 6 - } - }, + "start":45,"end":47,"loc":{"start":{"line":6,"column":4},"end":{"line":6,"column":6}}, "extra": { "rawValue": -1, "raw": "-1" @@ -98,18 +31,7 @@ }, { "type": "NumberLiteralTypeAnnotation", - "start": 52, - "end": 53, - "loc": { - "start": { - "line": 7, - "column": 4 - }, - "end": { - "line": 7, - "column": 5 - } - }, + "start":52,"end":53,"loc":{"start":{"line":7,"column":4},"end":{"line":7,"column":5}}, "extra": { "rawValue": 0, "raw": "0" @@ -118,18 +40,7 @@ }, { "type": "NumberLiteralTypeAnnotation", - "start": 58, - "end": 59, - "loc": { - "start": { - "line": 8, - "column": 4 - }, - "end": { - "line": 8, - "column": 5 - } - }, + "start":58,"end":59,"loc":{"start":{"line":8,"column":4},"end":{"line":8,"column":5}}, "extra": { "rawValue": 1, "raw": "1" @@ -142,110 +53,31 @@ { "type": "CommentBlock", "value": "*\n * @flow\n ", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 3 - } - } + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":3}} } ] }, { "type": "VariableDeclaration", - "start": 63, - "end": 90, - "loc": { - "start": { - "line": 11, - "column": 0 - }, - "end": { - "line": 11, - "column": 27 - } - }, + "start":63,"end":90,"loc":{"start":{"line":11,"column":0},"end":{"line":11,"column":27}}, "declarations": [ { "type": "VariableDeclarator", - "start": 67, - "end": 89, - "loc": { - "start": { - "line": 11, - "column": 4 - }, - "end": { - "line": 11, - "column": 26 - } - }, + "start":67,"end":89,"loc":{"start":{"line":11,"column":4},"end":{"line":11,"column":26}}, "id": { "type": "Identifier", - "start": 67, - "end": 84, - "loc": { - "start": { - "line": 11, - "column": 4 - }, - "end": { - "line": 11, - "column": 21 - }, - "identifierName": "x" - }, + "start":67,"end":84,"loc":{"start":{"line":11,"column":4},"end":{"line":11,"column":21},"identifierName":"x"}, "name": "x", "typeAnnotation": { "type": "TypeAnnotation", - "start": 68, - "end": 84, - "loc": { - "start": { - "line": 11, - "column": 5 - }, - "end": { - "line": 11, - "column": 21 - } - }, + "start":68,"end":84,"loc":{"start":{"line":11,"column":5},"end":{"line":11,"column":21}}, "typeAnnotation": { "type": "GenericTypeAnnotation", - "start": 69, - "end": 84, - "loc": { - "start": { - "line": 11, - "column": 6 - }, - "end": { - "line": 11, - "column": 21 - } - }, + "start":69,"end":84,"loc":{"start":{"line":11,"column":6},"end":{"line":11,"column":21}}, "typeParameters": null, "id": { "type": "Identifier", - "start": 69, - "end": 84, - "loc": { - "start": { - "line": 11, - "column": 6 - }, - "end": { - "line": 11, - "column": 21 - }, - "identifierName": "DirectionVector" - }, + "start":69,"end":84,"loc":{"start":{"line":11,"column":6},"end":{"line":11,"column":21},"identifierName":"DirectionVector"}, "name": "DirectionVector" } } @@ -253,34 +85,12 @@ }, "init": { "type": "UnaryExpression", - "start": 87, - "end": 89, - "loc": { - "start": { - "line": 11, - "column": 24 - }, - "end": { - "line": 11, - "column": 26 - } - }, + "start":87,"end":89,"loc":{"start":{"line":11,"column":24},"end":{"line":11,"column":26}}, "operator": "-", "prefix": true, "argument": { "type": "NumericLiteral", - "start": 88, - "end": 89, - "loc": { - "start": { - "line": 11, - "column": 25 - }, - "end": { - "line": 11, - "column": 26 - } - }, + "start":88,"end":89,"loc":{"start":{"line":11,"column":25},"end":{"line":11,"column":26}}, "extra": { "rawValue": 1, "raw": "1" @@ -294,78 +104,21 @@ }, { "type": "ExpressionStatement", - "start": 91, - "end": 110, - "loc": { - "start": { - "line": 12, - "column": 0 - }, - "end": { - "line": 12, - "column": 19 - } - }, + "start":91,"end":110,"loc":{"start":{"line":12,"column":0},"end":{"line":12,"column":19}}, "expression": { "type": "CallExpression", - "start": 91, - "end": 109, - "loc": { - "start": { - "line": 12, - "column": 0 - }, - "end": { - "line": 12, - "column": 18 - } - }, + "start":91,"end":109,"loc":{"start":{"line":12,"column":0},"end":{"line":12,"column":18}}, "callee": { "type": "MemberExpression", - "start": 91, - "end": 102, - "loc": { - "start": { - "line": 12, - "column": 0 - }, - "end": { - "line": 12, - "column": 11 - } - }, + "start":91,"end":102,"loc":{"start":{"line":12,"column":0},"end":{"line":12,"column":11}}, "object": { "type": "Identifier", - "start": 91, - "end": 98, - "loc": { - "start": { - "line": 12, - "column": 0 - }, - "end": { - "line": 12, - "column": 7 - }, - "identifierName": "console" - }, + "start":91,"end":98,"loc":{"start":{"line":12,"column":0},"end":{"line":12,"column":7},"identifierName":"console"}, "name": "console" }, "property": { "type": "Identifier", - "start": 99, - "end": 102, - "loc": { - "start": { - "line": 12, - "column": 8 - }, - "end": { - "line": 12, - "column": 11 - }, - "identifierName": "log" - }, + "start":99,"end":102,"loc":{"start":{"line":12,"column":8},"end":{"line":12,"column":11},"identifierName":"log"}, "name": "log" }, "computed": false @@ -373,18 +126,7 @@ "arguments": [ { "type": "StringLiteral", - "start": 103, - "end": 108, - "loc": { - "start": { - "line": 12, - "column": 12 - }, - "end": { - "line": 12, - "column": 17 - } - }, + "start":103,"end":108,"loc":{"start":{"line":12,"column":12},"end":{"line":12,"column":17}}, "extra": { "rawValue": "foo", "raw": "'foo'" @@ -401,18 +143,7 @@ { "type": "CommentBlock", "value": "*\n * @flow\n ", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 3 - } - } + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":3}} } ] } \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/object-type-method/output.json b/packages/babel-parser/test/fixtures/flow/type-annotations/object-type-method/output.json index 49fb1b3a7b0d..b8e1ad4ce035 100644 --- a/packages/babel-parser/test/fixtures/flow/type-annotations/object-type-method/output.json +++ b/packages/babel-parser/test/fixtures/flow/type-annotations/object-type-method/output.json @@ -1,111 +1,32 @@ { "type": "File", - "start": 0, - "end": 323, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 12, - "column": 38 - } - }, + "start":0,"end":323,"loc":{"start":{"line":1,"column":0},"end":{"line":12,"column":38}}, "program": { "type": "Program", - "start": 0, - "end": 323, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 12, - "column": 38 - } - }, + "start":0,"end":323,"loc":{"start":{"line":1,"column":0},"end":{"line":12,"column":38}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "TypeAlias", - "start": 0, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, "id": { "type": "Identifier", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "T" - }, + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"T"}, "name": "T" }, "typeParameters": null, "right": { "type": "ObjectTypeAnnotation", - "start": 9, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":9,"end":26,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":26}}, "callProperties": [], "properties": [ { "type": "ObjectTypeProperty", - "start": 11, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":11,"end":24,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":24}}, "key": { "type": "Identifier", - "start": 11, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "a" - }, + "start":11,"end":12,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":12},"identifierName":"a"}, "name": "a" }, "static": false, @@ -114,34 +35,12 @@ "method": false, "value": { "type": "FunctionTypeAnnotation", - "start": 14, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":14,"end":24,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":24}}, "params": [], "rest": null, "returnType": { "type": "VoidTypeAnnotation", - "start": 20, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 24 - } - } + "start":20,"end":24,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":24}} }, "typeParameters": null }, @@ -157,81 +56,24 @@ }, { "type": "TypeAlias", - "start": 28, - "end": 59, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 31 - } - }, + "start":28,"end":59,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":31}}, "id": { "type": "Identifier", - "start": 33, - "end": 35, - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 7 - }, - "identifierName": "T1" - }, + "start":33,"end":35,"loc":{"start":{"line":2,"column":5},"end":{"line":2,"column":7},"identifierName":"T1"}, "name": "T1" }, "typeParameters": null, "right": { "type": "ObjectTypeAnnotation", - "start": 38, - "end": 58, - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 30 - } - }, + "start":38,"end":58,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":30}}, "callProperties": [], "properties": [ { "type": "ObjectTypeProperty", - "start": 40, - "end": 56, - "loc": { - "start": { - "line": 2, - "column": 12 - }, - "end": { - "line": 2, - "column": 28 - } - }, + "start":40,"end":56,"loc":{"start":{"line":2,"column":12},"end":{"line":2,"column":28}}, "key": { "type": "Identifier", - "start": 40, - "end": 41, - "loc": { - "start": { - "line": 2, - "column": 12 - }, - "end": { - "line": 2, - "column": 13 - }, - "identifierName": "a" - }, + "start":40,"end":41,"loc":{"start":{"line":2,"column":12},"end":{"line":2,"column":13},"identifierName":"a"}, "name": "a" }, "static": false, @@ -240,47 +82,14 @@ "method": false, "value": { "type": "FunctionTypeAnnotation", - "start": 43, - "end": 56, - "loc": { - "start": { - "line": 2, - "column": 15 - }, - "end": { - "line": 2, - "column": 28 - } - }, + "start":43,"end":56,"loc":{"start":{"line":2,"column":15},"end":{"line":2,"column":28}}, "typeParameters": { "type": "TypeParameterDeclaration", - "start": 43, - "end": 46, - "loc": { - "start": { - "line": 2, - "column": 15 - }, - "end": { - "line": 2, - "column": 18 - } - }, + "start":43,"end":46,"loc":{"start":{"line":2,"column":15},"end":{"line":2,"column":18}}, "params": [ { "type": "TypeParameter", - "start": 44, - "end": 45, - "loc": { - "start": { - "line": 2, - "column": 16 - }, - "end": { - "line": 2, - "column": 17 - } - }, + "start":44,"end":45,"loc":{"start":{"line":2,"column":16},"end":{"line":2,"column":17}}, "name": "T", "variance": null } @@ -290,18 +99,7 @@ "rest": null, "returnType": { "type": "VoidTypeAnnotation", - "start": 52, - "end": 56, - "loc": { - "start": { - "line": 2, - "column": 24 - }, - "end": { - "line": 2, - "column": 28 - } - } + "start":52,"end":56,"loc":{"start":{"line":2,"column":24},"end":{"line":2,"column":28}} } }, "variance": null, @@ -316,81 +114,24 @@ }, { "type": "TypeAlias", - "start": 60, - "end": 84, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 24 - } - }, + "start":60,"end":84,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":24}}, "id": { "type": "Identifier", - "start": 65, - "end": 67, - "loc": { - "start": { - "line": 3, - "column": 5 - }, - "end": { - "line": 3, - "column": 7 - }, - "identifierName": "T2" - }, + "start":65,"end":67,"loc":{"start":{"line":3,"column":5},"end":{"line":3,"column":7},"identifierName":"T2"}, "name": "T2" }, "typeParameters": null, "right": { "type": "ObjectTypeAnnotation", - "start": 70, - "end": 83, - "loc": { - "start": { - "line": 3, - "column": 10 - }, - "end": { - "line": 3, - "column": 23 - } - }, + "start":70,"end":83,"loc":{"start":{"line":3,"column":10},"end":{"line":3,"column":23}}, "callProperties": [], "properties": [ { "type": "ObjectTypeProperty", - "start": 72, - "end": 81, - "loc": { - "start": { - "line": 3, - "column": 12 - }, - "end": { - "line": 3, - "column": 21 - } - }, + "start":72,"end":81,"loc":{"start":{"line":3,"column":12},"end":{"line":3,"column":21}}, "key": { "type": "Identifier", - "start": 72, - "end": 73, - "loc": { - "start": { - "line": 3, - "column": 12 - }, - "end": { - "line": 3, - "column": 13 - }, - "identifierName": "a" - }, + "start":72,"end":73,"loc":{"start":{"line":3,"column":12},"end":{"line":3,"column":13},"identifierName":"a"}, "name": "a" }, "static": false, @@ -399,35 +140,13 @@ "method": true, "value": { "type": "FunctionTypeAnnotation", - "start": 72, - "end": 81, - "loc": { - "start": { - "line": 3, - "column": 12 - }, - "end": { - "line": 3, - "column": 21 - } - }, + "start":72,"end":81,"loc":{"start":{"line":3,"column":12},"end":{"line":3,"column":21}}, "params": [], "rest": null, "typeParameters": null, "returnType": { "type": "VoidTypeAnnotation", - "start": 77, - "end": 81, - "loc": { - "start": { - "line": 3, - "column": 17 - }, - "end": { - "line": 3, - "column": 21 - } - } + "start":77,"end":81,"loc":{"start":{"line":3,"column":17},"end":{"line":3,"column":21}} } }, "optional": false @@ -441,81 +160,24 @@ }, { "type": "TypeAlias", - "start": 85, - "end": 112, - "loc": { - "start": { - "line": 4, - "column": 0 - }, - "end": { - "line": 4, - "column": 27 - } - }, + "start":85,"end":112,"loc":{"start":{"line":4,"column":0},"end":{"line":4,"column":27}}, "id": { "type": "Identifier", - "start": 90, - "end": 92, - "loc": { - "start": { - "line": 4, - "column": 5 - }, - "end": { - "line": 4, - "column": 7 - }, - "identifierName": "T3" - }, + "start":90,"end":92,"loc":{"start":{"line":4,"column":5},"end":{"line":4,"column":7},"identifierName":"T3"}, "name": "T3" }, "typeParameters": null, "right": { "type": "ObjectTypeAnnotation", - "start": 95, - "end": 111, - "loc": { - "start": { - "line": 4, - "column": 10 - }, - "end": { - "line": 4, - "column": 26 - } - }, + "start":95,"end":111,"loc":{"start":{"line":4,"column":10},"end":{"line":4,"column":26}}, "callProperties": [], "properties": [ { "type": "ObjectTypeProperty", - "start": 97, - "end": 109, - "loc": { - "start": { - "line": 4, - "column": 12 - }, - "end": { - "line": 4, - "column": 24 - } - }, + "start":97,"end":109,"loc":{"start":{"line":4,"column":12},"end":{"line":4,"column":24}}, "key": { "type": "Identifier", - "start": 97, - "end": 98, - "loc": { - "start": { - "line": 4, - "column": 12 - }, - "end": { - "line": 4, - "column": 13 - }, - "identifierName": "a" - }, + "start":97,"end":98,"loc":{"start":{"line":4,"column":12},"end":{"line":4,"column":13},"identifierName":"a"}, "name": "a" }, "static": false, @@ -524,49 +186,16 @@ "method": true, "value": { "type": "FunctionTypeAnnotation", - "start": 97, - "end": 109, - "loc": { - "start": { - "line": 4, - "column": 12 - }, - "end": { - "line": 4, - "column": 24 - } - }, + "start":97,"end":109,"loc":{"start":{"line":4,"column":12},"end":{"line":4,"column":24}}, "params": [], "rest": null, "typeParameters": { "type": "TypeParameterDeclaration", - "start": 98, - "end": 101, - "loc": { - "start": { - "line": 4, - "column": 13 - }, - "end": { - "line": 4, - "column": 16 - } - }, + "start":98,"end":101,"loc":{"start":{"line":4,"column":13},"end":{"line":4,"column":16}}, "params": [ { "type": "TypeParameter", - "start": 99, - "end": 100, - "loc": { - "start": { - "line": 4, - "column": 14 - }, - "end": { - "line": 4, - "column": 15 - } - }, + "start":99,"end":100,"loc":{"start":{"line":4,"column":14},"end":{"line":4,"column":15}}, "name": "T", "variance": null } @@ -574,18 +203,7 @@ }, "returnType": { "type": "VoidTypeAnnotation", - "start": 105, - "end": 109, - "loc": { - "start": { - "line": 4, - "column": 20 - }, - "end": { - "line": 4, - "column": 24 - } - } + "start":105,"end":109,"loc":{"start":{"line":4,"column":20},"end":{"line":4,"column":24}} } }, "optional": false @@ -599,97 +217,30 @@ }, { "type": "TypeAlias", - "start": 114, - "end": 139, - "loc": { - "start": { - "line": 6, - "column": 0 - }, - "end": { - "line": 6, - "column": 25 - } - }, + "start":114,"end":139,"loc":{"start":{"line":6,"column":0},"end":{"line":6,"column":25}}, "id": { "type": "Identifier", - "start": 119, - "end": 121, - "loc": { - "start": { - "line": 6, - "column": 5 - }, - "end": { - "line": 6, - "column": 7 - }, - "identifierName": "T4" - }, + "start":119,"end":121,"loc":{"start":{"line":6,"column":5},"end":{"line":6,"column":7},"identifierName":"T4"}, "name": "T4" }, "typeParameters": null, "right": { "type": "ObjectTypeAnnotation", - "start": 124, - "end": 138, - "loc": { - "start": { - "line": 6, - "column": 10 - }, - "end": { - "line": 6, - "column": 24 - } - }, + "start":124,"end":138,"loc":{"start":{"line":6,"column":10},"end":{"line":6,"column":24}}, "callProperties": [ { "type": "ObjectTypeCallProperty", - "start": 126, - "end": 136, - "loc": { - "start": { - "line": 6, - "column": 12 - }, - "end": { - "line": 6, - "column": 22 - } - }, + "start":126,"end":136,"loc":{"start":{"line":6,"column":12},"end":{"line":6,"column":22}}, "static": false, "value": { "type": "FunctionTypeAnnotation", - "start": 126, - "end": 136, - "loc": { - "start": { - "line": 6, - "column": 12 - }, - "end": { - "line": 6, - "column": 22 - } - }, + "start":126,"end":136,"loc":{"start":{"line":6,"column":12},"end":{"line":6,"column":22}}, "params": [], "rest": null, "typeParameters": null, "returnType": { "type": "NumberTypeAnnotation", - "start": 130, - "end": 136, - "loc": { - "start": { - "line": 6, - "column": 16 - }, - "end": { - "line": 6, - "column": 22 - } - } + "start":130,"end":136,"loc":{"start":{"line":6,"column":16},"end":{"line":6,"column":22}} } } } @@ -703,143 +254,41 @@ }, { "type": "TypeAlias", - "start": 140, - "end": 172, - "loc": { - "start": { - "line": 7, - "column": 0 - }, - "end": { - "line": 7, - "column": 32 - } - }, + "start":140,"end":172,"loc":{"start":{"line":7,"column":0},"end":{"line":7,"column":32}}, "id": { "type": "Identifier", - "start": 145, - "end": 147, - "loc": { - "start": { - "line": 7, - "column": 5 - }, - "end": { - "line": 7, - "column": 7 - }, - "identifierName": "T5" - }, + "start":145,"end":147,"loc":{"start":{"line":7,"column":5},"end":{"line":7,"column":7},"identifierName":"T5"}, "name": "T5" }, "typeParameters": null, "right": { "type": "ObjectTypeAnnotation", - "start": 150, - "end": 172, - "loc": { - "start": { - "line": 7, - "column": 10 - }, - "end": { - "line": 7, - "column": 32 - } - }, + "start":150,"end":172,"loc":{"start":{"line":7,"column":10},"end":{"line":7,"column":32}}, "callProperties": [ { "type": "ObjectTypeCallProperty", - "start": 152, - "end": 169, - "loc": { - "start": { - "line": 7, - "column": 12 - }, - "end": { - "line": 7, - "column": 29 - } - }, + "start":152,"end":169,"loc":{"start":{"line":7,"column":12},"end":{"line":7,"column":29}}, "static": false, "value": { "type": "FunctionTypeAnnotation", - "start": 152, - "end": 169, - "loc": { - "start": { - "line": 7, - "column": 12 - }, - "end": { - "line": 7, - "column": 29 - } - }, + "start":152,"end":169,"loc":{"start":{"line":7,"column":12},"end":{"line":7,"column":29}}, "params": [ { "type": "FunctionTypeParam", - "start": 156, - "end": 160, - "loc": { - "start": { - "line": 7, - "column": 16 - }, - "end": { - "line": 7, - "column": 20 - } - }, + "start":156,"end":160,"loc":{"start":{"line":7,"column":16},"end":{"line":7,"column":20}}, "name": { "type": "Identifier", - "start": 156, - "end": 157, - "loc": { - "start": { - "line": 7, - "column": 16 - }, - "end": { - "line": 7, - "column": 17 - }, - "identifierName": "x" - }, + "start":156,"end":157,"loc":{"start":{"line":7,"column":16},"end":{"line":7,"column":17},"identifierName":"x"}, "name": "x" }, "optional": false, "typeAnnotation": { "type": "GenericTypeAnnotation", - "start": 159, - "end": 160, - "loc": { - "start": { - "line": 7, - "column": 19 - }, - "end": { - "line": 7, - "column": 20 - } - }, + "start":159,"end":160,"loc":{"start":{"line":7,"column":19},"end":{"line":7,"column":20}}, "typeParameters": null, "id": { "type": "Identifier", - "start": 159, - "end": 160, - "loc": { - "start": { - "line": 7, - "column": 19 - }, - "end": { - "line": 7, - "column": 20 - }, - "identifierName": "T" - }, + "start":159,"end":160,"loc":{"start":{"line":7,"column":19},"end":{"line":7,"column":20},"identifierName":"T"}, "name": "T" } } @@ -848,33 +297,11 @@ "rest": null, "typeParameters": { "type": "TypeParameterDeclaration", - "start": 152, - "end": 155, - "loc": { - "start": { - "line": 7, - "column": 12 - }, - "end": { - "line": 7, - "column": 15 - } - }, + "start":152,"end":155,"loc":{"start":{"line":7,"column":12},"end":{"line":7,"column":15}}, "params": [ { "type": "TypeParameter", - "start": 153, - "end": 154, - "loc": { - "start": { - "line": 7, - "column": 13 - }, - "end": { - "line": 7, - "column": 14 - } - }, + "start":153,"end":154,"loc":{"start":{"line":7,"column":13},"end":{"line":7,"column":14}}, "name": "T", "variance": null } @@ -882,18 +309,7 @@ }, "returnType": { "type": "NumberTypeAnnotation", - "start": 163, - "end": 169, - "loc": { - "start": { - "line": 7, - "column": 23 - }, - "end": { - "line": 7, - "column": 29 - } - } + "start":163,"end":169,"loc":{"start":{"line":7,"column":23},"end":{"line":7,"column":29}} } } } @@ -907,33 +323,10 @@ }, { "type": "DeclareClass", - "start": 174, - "end": 209, - "loc": { - "start": { - "line": 9, - "column": 0 - }, - "end": { - "line": 9, - "column": 35 - } - }, + "start":174,"end":209,"loc":{"start":{"line":9,"column":0},"end":{"line":9,"column":35}}, "id": { "type": "Identifier", - "start": 188, - "end": 190, - "loc": { - "start": { - "line": 9, - "column": 14 - }, - "end": { - "line": 9, - "column": 16 - }, - "identifierName": "T6" - }, + "start":188,"end":190,"loc":{"start":{"line":9,"column":14},"end":{"line":9,"column":16},"identifierName":"T6"}, "name": "T6" }, "typeParameters": null, @@ -942,49 +335,15 @@ "mixins": [], "body": { "type": "ObjectTypeAnnotation", - "start": 191, - "end": 209, - "loc": { - "start": { - "line": 9, - "column": 17 - }, - "end": { - "line": 9, - "column": 35 - } - }, + "start":191,"end":209,"loc":{"start":{"line":9,"column":17},"end":{"line":9,"column":35}}, "callProperties": [], "properties": [ { "type": "ObjectTypeProperty", - "start": 193, - "end": 206, - "loc": { - "start": { - "line": 9, - "column": 19 - }, - "end": { - "line": 9, - "column": 32 - } - }, + "start":193,"end":206,"loc":{"start":{"line":9,"column":19},"end":{"line":9,"column":32}}, "key": { "type": "Identifier", - "start": 193, - "end": 196, - "loc": { - "start": { - "line": 9, - "column": 19 - }, - "end": { - "line": 9, - "column": 22 - }, - "identifierName": "foo" - }, + "start":193,"end":196,"loc":{"start":{"line":9,"column":19},"end":{"line":9,"column":22},"identifierName":"foo"}, "name": "foo" }, "static": false, @@ -993,35 +352,13 @@ "method": true, "value": { "type": "FunctionTypeAnnotation", - "start": 193, - "end": 206, - "loc": { - "start": { - "line": 9, - "column": 19 - }, - "end": { - "line": 9, - "column": 32 - } - }, + "start":193,"end":206,"loc":{"start":{"line":9,"column":19},"end":{"line":9,"column":32}}, "params": [], "rest": null, "typeParameters": null, "returnType": { "type": "NumberTypeAnnotation", - "start": 200, - "end": 206, - "loc": { - "start": { - "line": 9, - "column": 26 - }, - "end": { - "line": 9, - "column": 32 - } - } + "start":200,"end":206,"loc":{"start":{"line":9,"column":26},"end":{"line":9,"column":32}} } }, "optional": false @@ -1034,33 +371,10 @@ }, { "type": "DeclareClass", - "start": 210, - "end": 252, - "loc": { - "start": { - "line": 10, - "column": 0 - }, - "end": { - "line": 10, - "column": 42 - } - }, + "start":210,"end":252,"loc":{"start":{"line":10,"column":0},"end":{"line":10,"column":42}}, "id": { "type": "Identifier", - "start": 224, - "end": 226, - "loc": { - "start": { - "line": 10, - "column": 14 - }, - "end": { - "line": 10, - "column": 16 - }, - "identifierName": "T7" - }, + "start":224,"end":226,"loc":{"start":{"line":10,"column":14},"end":{"line":10,"column":16},"identifierName":"T7"}, "name": "T7" }, "typeParameters": null, @@ -1069,49 +383,15 @@ "mixins": [], "body": { "type": "ObjectTypeAnnotation", - "start": 227, - "end": 252, - "loc": { - "start": { - "line": 10, - "column": 17 - }, - "end": { - "line": 10, - "column": 42 - } - }, + "start":227,"end":252,"loc":{"start":{"line":10,"column":17},"end":{"line":10,"column":42}}, "callProperties": [], "properties": [ { "type": "ObjectTypeProperty", - "start": 229, - "end": 249, - "loc": { - "start": { - "line": 10, - "column": 19 - }, - "end": { - "line": 10, - "column": 39 - } - }, + "start":229,"end":249,"loc":{"start":{"line":10,"column":19},"end":{"line":10,"column":39}}, "key": { "type": "Identifier", - "start": 236, - "end": 239, - "loc": { - "start": { - "line": 10, - "column": 26 - }, - "end": { - "line": 10, - "column": 29 - }, - "identifierName": "foo" - }, + "start":236,"end":239,"loc":{"start":{"line":10,"column":26},"end":{"line":10,"column":29},"identifierName":"foo"}, "name": "foo" }, "static": true, @@ -1120,35 +400,13 @@ "method": true, "value": { "type": "FunctionTypeAnnotation", - "start": 229, - "end": 249, - "loc": { - "start": { - "line": 10, - "column": 19 - }, - "end": { - "line": 10, - "column": 39 - } - }, + "start":229,"end":249,"loc":{"start":{"line":10,"column":19},"end":{"line":10,"column":39}}, "params": [], "rest": null, "typeParameters": null, "returnType": { "type": "NumberTypeAnnotation", - "start": 243, - "end": 249, - "loc": { - "start": { - "line": 10, - "column": 33 - }, - "end": { - "line": 10, - "column": 39 - } - } + "start":243,"end":249,"loc":{"start":{"line":10,"column":33},"end":{"line":10,"column":39}} } }, "optional": false @@ -1161,33 +419,10 @@ }, { "type": "DeclareClass", - "start": 253, - "end": 284, - "loc": { - "start": { - "line": 11, - "column": 0 - }, - "end": { - "line": 11, - "column": 31 - } - }, + "start":253,"end":284,"loc":{"start":{"line":11,"column":0},"end":{"line":11,"column":31}}, "id": { "type": "Identifier", - "start": 267, - "end": 269, - "loc": { - "start": { - "line": 11, - "column": 14 - }, - "end": { - "line": 11, - "column": 16 - }, - "identifierName": "T8" - }, + "start":267,"end":269,"loc":{"start":{"line":11,"column":14},"end":{"line":11,"column":16},"identifierName":"T8"}, "name": "T8" }, "typeParameters": null, @@ -1196,65 +431,21 @@ "mixins": [], "body": { "type": "ObjectTypeAnnotation", - "start": 270, - "end": 284, - "loc": { - "start": { - "line": 11, - "column": 17 - }, - "end": { - "line": 11, - "column": 31 - } - }, + "start":270,"end":284,"loc":{"start":{"line":11,"column":17},"end":{"line":11,"column":31}}, "callProperties": [ { "type": "ObjectTypeCallProperty", - "start": 272, - "end": 282, - "loc": { - "start": { - "line": 11, - "column": 19 - }, - "end": { - "line": 11, - "column": 29 - } - }, + "start":272,"end":282,"loc":{"start":{"line":11,"column":19},"end":{"line":11,"column":29}}, "static": false, "value": { "type": "FunctionTypeAnnotation", - "start": 272, - "end": 282, - "loc": { - "start": { - "line": 11, - "column": 19 - }, - "end": { - "line": 11, - "column": 29 - } - }, + "start":272,"end":282,"loc":{"start":{"line":11,"column":19},"end":{"line":11,"column":29}}, "params": [], "rest": null, "typeParameters": null, "returnType": { "type": "NumberTypeAnnotation", - "start": 276, - "end": 282, - "loc": { - "start": { - "line": 11, - "column": 23 - }, - "end": { - "line": 11, - "column": 29 - } - } + "start":276,"end":282,"loc":{"start":{"line":11,"column":23},"end":{"line":11,"column":29}} } } } @@ -1267,33 +458,10 @@ }, { "type": "DeclareClass", - "start": 285, - "end": 323, - "loc": { - "start": { - "line": 12, - "column": 0 - }, - "end": { - "line": 12, - "column": 38 - } - }, + "start":285,"end":323,"loc":{"start":{"line":12,"column":0},"end":{"line":12,"column":38}}, "id": { "type": "Identifier", - "start": 299, - "end": 301, - "loc": { - "start": { - "line": 12, - "column": 14 - }, - "end": { - "line": 12, - "column": 16 - }, - "identifierName": "T9" - }, + "start":299,"end":301,"loc":{"start":{"line":12,"column":14},"end":{"line":12,"column":16},"identifierName":"T9"}, "name": "T9" }, "typeParameters": null, @@ -1302,65 +470,21 @@ "mixins": [], "body": { "type": "ObjectTypeAnnotation", - "start": 302, - "end": 323, - "loc": { - "start": { - "line": 12, - "column": 17 - }, - "end": { - "line": 12, - "column": 38 - } - }, + "start":302,"end":323,"loc":{"start":{"line":12,"column":17},"end":{"line":12,"column":38}}, "callProperties": [ { "type": "ObjectTypeCallProperty", - "start": 304, - "end": 321, - "loc": { - "start": { - "line": 12, - "column": 19 - }, - "end": { - "line": 12, - "column": 36 - } - }, + "start":304,"end":321,"loc":{"start":{"line":12,"column":19},"end":{"line":12,"column":36}}, "static": true, "value": { "type": "FunctionTypeAnnotation", - "start": 311, - "end": 321, - "loc": { - "start": { - "line": 12, - "column": 26 - }, - "end": { - "line": 12, - "column": 36 - } - }, + "start":311,"end":321,"loc":{"start":{"line":12,"column":26},"end":{"line":12,"column":36}}, "params": [], "rest": null, "typeParameters": null, "returnType": { "type": "NumberTypeAnnotation", - "start": 315, - "end": 321, - "loc": { - "start": { - "line": 12, - "column": 30 - }, - "end": { - "line": 12, - "column": 36 - } - } + "start":315,"end":321,"loc":{"start":{"line":12,"column":30},"end":{"line":12,"column":36}} } } } diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/symbol/input.js b/packages/babel-parser/test/fixtures/flow/type-annotations/symbol/input.js new file mode 100644 index 000000000000..90e1dd31feb3 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/type-annotations/symbol/input.js @@ -0,0 +1 @@ +const x: symbol = Symbol(); diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/symbol/output.json b/packages/babel-parser/test/fixtures/flow/type-annotations/symbol/output.json new file mode 100644 index 000000000000..08f7373de7d6 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/type-annotations/symbol/output.json @@ -0,0 +1,47 @@ +{ + "type": "File", + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, + "program": { + "type": "Program", + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":6,"end":26,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":26}}, + "id": { + "type": "Identifier", + "start":6,"end":15,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":15},"identifierName":"x"}, + "name": "x", + "typeAnnotation": { + "type": "TypeAnnotation", + "start":7,"end":15,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":15}}, + "typeAnnotation": { + "type": "SymbolTypeAnnotation", + "start":9,"end":15,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":15}} + } + } + }, + "init": { + "type": "CallExpression", + "start":18,"end":26,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":26}}, + "callee": { + "type": "Identifier", + "start":18,"end":24,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":24},"identifierName":"Symbol"}, + "name": "Symbol" + }, + "arguments": [] + } + } + ], + "kind": "const" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/typeof-reserved-invalid-1/input.js b/packages/babel-parser/test/fixtures/flow/type-annotations/typeof-reserved-invalid-1/input.js new file mode 100644 index 000000000000..57a78fa5a789 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/type-annotations/typeof-reserved-invalid-1/input.js @@ -0,0 +1,2 @@ +// @flow +const x: typeof interface = "hi"; diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/typeof-reserved-invalid-1/options.json b/packages/babel-parser/test/fixtures/flow/type-annotations/typeof-reserved-invalid-1/options.json new file mode 100644 index 000000000000..077518333db1 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/type-annotations/typeof-reserved-invalid-1/options.json @@ -0,0 +1,5 @@ +{ + "sourceType": "module", + "plugins": ["jsx", "flow"], + "throws": "Unexpected token, expected \"{\" (2:26)" +} diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/typeof-reserved-invalid-2/input.js b/packages/babel-parser/test/fixtures/flow/type-annotations/typeof-reserved-invalid-2/input.js new file mode 100644 index 000000000000..292205253049 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/type-annotations/typeof-reserved-invalid-2/input.js @@ -0,0 +1,2 @@ +// @flow +const x: typeof type.interface = "hi"; diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/typeof-reserved-invalid-2/output.json b/packages/babel-parser/test/fixtures/flow/type-annotations/typeof-reserved-invalid-2/output.json new file mode 100644 index 000000000000..9822fae01d58 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/type-annotations/typeof-reserved-invalid-2/output.json @@ -0,0 +1,82 @@ +{ + "type": "File", + "start":0,"end":47,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":38}}, + "errors": [ + "SyntaxError: Unexpected reserved type interface (2:21)" + ], + "program": { + "type": "Program", + "start":0,"end":47,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":38}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start":9,"end":47,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":38}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":15,"end":46,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":37}}, + "id": { + "type": "Identifier", + "start":15,"end":39,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":30},"identifierName":"x"}, + "name": "x", + "typeAnnotation": { + "type": "TypeAnnotation", + "start":16,"end":39,"loc":{"start":{"line":2,"column":7},"end":{"line":2,"column":30}}, + "typeAnnotation": { + "type": "TypeofTypeAnnotation", + "start":18,"end":39,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":30}}, + "argument": { + "type": "GenericTypeAnnotation", + "start":25,"end":39,"loc":{"start":{"line":2,"column":16},"end":{"line":2,"column":30}}, + "typeParameters": null, + "id": { + "type": "QualifiedTypeIdentifier", + "start":25,"end":39,"loc":{"start":{"line":2,"column":16},"end":{"line":2,"column":30}}, + "qualification": { + "type": "Identifier", + "start":25,"end":29,"loc":{"start":{"line":2,"column":16},"end":{"line":2,"column":20},"identifierName":"type"}, + "name": "type" + }, + "id": { + "type": "Identifier", + "start":30,"end":39,"loc":{"start":{"line":2,"column":21},"end":{"line":2,"column":30},"identifierName":"interface"}, + "name": "interface" + } + } + } + } + } + }, + "init": { + "type": "StringLiteral", + "start":42,"end":46,"loc":{"start":{"line":2,"column":33},"end":{"line":2,"column":37}}, + "extra": { + "rawValue": "hi", + "raw": "\"hi\"" + }, + "value": "hi" + } + } + ], + "kind": "const", + "leadingComments": [ + { + "type": "CommentLine", + "value": " @flow", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}} + } + ] + } + ], + "directives": [] + }, + "comments": [ + { + "type": "CommentLine", + "value": " @flow", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}} + } + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/typeof-reserved-invalid-3/input.js b/packages/babel-parser/test/fixtures/flow/type-annotations/typeof-reserved-invalid-3/input.js new file mode 100644 index 000000000000..018cfae79c6b --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/type-annotations/typeof-reserved-invalid-3/input.js @@ -0,0 +1,2 @@ +// @flow +const x: typeof stuff.number = "hi"; diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/typeof-reserved-invalid-3/output.json b/packages/babel-parser/test/fixtures/flow/type-annotations/typeof-reserved-invalid-3/output.json new file mode 100644 index 000000000000..f719b76ee8a7 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/type-annotations/typeof-reserved-invalid-3/output.json @@ -0,0 +1,82 @@ +{ + "type": "File", + "start":0,"end":45,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":36}}, + "errors": [ + "SyntaxError: Unexpected reserved type number (2:22)" + ], + "program": { + "type": "Program", + "start":0,"end":45,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":36}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start":9,"end":45,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":36}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":15,"end":44,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":35}}, + "id": { + "type": "Identifier", + "start":15,"end":37,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":28},"identifierName":"x"}, + "name": "x", + "typeAnnotation": { + "type": "TypeAnnotation", + "start":16,"end":37,"loc":{"start":{"line":2,"column":7},"end":{"line":2,"column":28}}, + "typeAnnotation": { + "type": "TypeofTypeAnnotation", + "start":18,"end":37,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":28}}, + "argument": { + "type": "GenericTypeAnnotation", + "start":25,"end":37,"loc":{"start":{"line":2,"column":16},"end":{"line":2,"column":28}}, + "typeParameters": null, + "id": { + "type": "QualifiedTypeIdentifier", + "start":25,"end":37,"loc":{"start":{"line":2,"column":16},"end":{"line":2,"column":28}}, + "qualification": { + "type": "Identifier", + "start":25,"end":30,"loc":{"start":{"line":2,"column":16},"end":{"line":2,"column":21},"identifierName":"stuff"}, + "name": "stuff" + }, + "id": { + "type": "Identifier", + "start":31,"end":37,"loc":{"start":{"line":2,"column":22},"end":{"line":2,"column":28},"identifierName":"number"}, + "name": "number" + } + } + } + } + } + }, + "init": { + "type": "StringLiteral", + "start":40,"end":44,"loc":{"start":{"line":2,"column":31},"end":{"line":2,"column":35}}, + "extra": { + "rawValue": "hi", + "raw": "\"hi\"" + }, + "value": "hi" + } + } + ], + "kind": "const", + "leadingComments": [ + { + "type": "CommentLine", + "value": " @flow", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}} + } + ] + } + ], + "directives": [] + }, + "comments": [ + { + "type": "CommentLine", + "value": " @flow", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}} + } + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/typeof-reserved-invalid-4/input.js b/packages/babel-parser/test/fixtures/flow/type-annotations/typeof-reserved-invalid-4/input.js new file mode 100644 index 000000000000..01212f07ac93 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/type-annotations/typeof-reserved-invalid-4/input.js @@ -0,0 +1,2 @@ +// @flow +const x: typeof static = "hi"; diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/typeof-reserved-invalid-4/output.json b/packages/babel-parser/test/fixtures/flow/type-annotations/typeof-reserved-invalid-4/output.json new file mode 100644 index 000000000000..0335f33501c6 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/type-annotations/typeof-reserved-invalid-4/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":30}}, + "errors": [ + "SyntaxError: Unexpected reserved word 'static' (2:16)" + ], + "program": { + "type": "Program", + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":30}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start":9,"end":39,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":30}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":15,"end":38,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":29}}, + "id": { + "type": "Identifier", + "start":15,"end":31,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":22},"identifierName":"x"}, + "name": "x", + "typeAnnotation": { + "type": "TypeAnnotation", + "start":16,"end":31,"loc":{"start":{"line":2,"column":7},"end":{"line":2,"column":22}}, + "typeAnnotation": { + "type": "TypeofTypeAnnotation", + "start":18,"end":31,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":22}}, + "argument": { + "type": "GenericTypeAnnotation", + "start":25,"end":31,"loc":{"start":{"line":2,"column":16},"end":{"line":2,"column":22}}, + "typeParameters": null, + "id": { + "type": "Identifier", + "start":25,"end":31,"loc":{"start":{"line":2,"column":16},"end":{"line":2,"column":22},"identifierName":"static"}, + "name": "static" + } + } + } + } + }, + "init": { + "type": "StringLiteral", + "start":34,"end":38,"loc":{"start":{"line":2,"column":25},"end":{"line":2,"column":29}}, + "extra": { + "rawValue": "hi", + "raw": "\"hi\"" + }, + "value": "hi" + } + } + ], + "kind": "const", + "leadingComments": [ + { + "type": "CommentLine", + "value": " @flow", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}} + } + ] + } + ], + "directives": [] + }, + "comments": [ + { + "type": "CommentLine", + "value": " @flow", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}} + } + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/typeof-reserved-invalid-5/input.js b/packages/babel-parser/test/fixtures/flow/type-annotations/typeof-reserved-invalid-5/input.js new file mode 100644 index 000000000000..8c14711e1d8e --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/type-annotations/typeof-reserved-invalid-5/input.js @@ -0,0 +1,2 @@ +// @flow +const x: typeof typeof = "hi"; diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/typeof-reserved-invalid-5/options.json b/packages/babel-parser/test/fixtures/flow/type-annotations/typeof-reserved-invalid-5/options.json new file mode 100644 index 000000000000..a06d10b640b8 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/type-annotations/typeof-reserved-invalid-5/options.json @@ -0,0 +1,5 @@ +{ + "sourceType": "module", + "plugins": ["jsx", "flow"], + "throws": "Unexpected token (2:23)" +} diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/typeof-reserved-invalid-6/input.js b/packages/babel-parser/test/fixtures/flow/type-annotations/typeof-reserved-invalid-6/input.js new file mode 100644 index 000000000000..1c47c611a6d7 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/type-annotations/typeof-reserved-invalid-6/input.js @@ -0,0 +1,2 @@ +// @flow +const x: typeof d.i\u{6e}terface = "hi"; diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/typeof-reserved-invalid-6/output.json b/packages/babel-parser/test/fixtures/flow/type-annotations/typeof-reserved-invalid-6/output.json new file mode 100644 index 000000000000..6a21871a8258 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/type-annotations/typeof-reserved-invalid-6/output.json @@ -0,0 +1,82 @@ +{ + "type": "File", + "start":0,"end":49,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":40}}, + "errors": [ + "SyntaxError: Unexpected reserved type interface (2:18)" + ], + "program": { + "type": "Program", + "start":0,"end":49,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":40}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start":9,"end":49,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":40}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":15,"end":48,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":39}}, + "id": { + "type": "Identifier", + "start":15,"end":41,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":32},"identifierName":"x"}, + "name": "x", + "typeAnnotation": { + "type": "TypeAnnotation", + "start":16,"end":41,"loc":{"start":{"line":2,"column":7},"end":{"line":2,"column":32}}, + "typeAnnotation": { + "type": "TypeofTypeAnnotation", + "start":18,"end":41,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":32}}, + "argument": { + "type": "GenericTypeAnnotation", + "start":25,"end":41,"loc":{"start":{"line":2,"column":16},"end":{"line":2,"column":32}}, + "typeParameters": null, + "id": { + "type": "QualifiedTypeIdentifier", + "start":25,"end":41,"loc":{"start":{"line":2,"column":16},"end":{"line":2,"column":32}}, + "qualification": { + "type": "Identifier", + "start":25,"end":26,"loc":{"start":{"line":2,"column":16},"end":{"line":2,"column":17},"identifierName":"d"}, + "name": "d" + }, + "id": { + "type": "Identifier", + "start":27,"end":41,"loc":{"start":{"line":2,"column":18},"end":{"line":2,"column":32},"identifierName":"interface"}, + "name": "interface" + } + } + } + } + } + }, + "init": { + "type": "StringLiteral", + "start":44,"end":48,"loc":{"start":{"line":2,"column":35},"end":{"line":2,"column":39}}, + "extra": { + "rawValue": "hi", + "raw": "\"hi\"" + }, + "value": "hi" + } + } + ], + "kind": "const", + "leadingComments": [ + { + "type": "CommentLine", + "value": " @flow", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}} + } + ] + } + ], + "directives": [] + }, + "comments": [ + { + "type": "CommentLine", + "value": " @flow", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}} + } + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/typeof-reserved-valid/input.js b/packages/babel-parser/test/fixtures/flow/type-annotations/typeof-reserved-valid/input.js new file mode 100644 index 000000000000..f96ff8f65234 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/type-annotations/typeof-reserved-valid/input.js @@ -0,0 +1,15 @@ +// @flow +const a: typeof default = "hi"; +const b: typeof stuff.default = "hi"; + +const c: typeof any = "hi"; +const d: typeof bool = "hi"; +const e: typeof boolean = "hi"; +const f: typeof empty = "hi"; +const g: typeof false = "hi"; +const h: typeof mixed = "hi"; +const i: typeof null = "hi"; +const j: typeof number = "hi"; +const k: typeof string = "hi"; +const l: typeof true = "hi"; +const m: typeof void = "hi"; diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/typeof-reserved-valid/output.json b/packages/babel-parser/test/fixtures/flow/type-annotations/typeof-reserved-valid/output.json new file mode 100644 index 000000000000..fe16d11775ae --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/type-annotations/typeof-reserved-valid/output.json @@ -0,0 +1,526 @@ +{ + "type": "File", + "start":0,"end":407,"loc":{"start":{"line":1,"column":0},"end":{"line":15,"column":28}}, + "program": { + "type": "Program", + "start":0,"end":407,"loc":{"start":{"line":1,"column":0},"end":{"line":15,"column":28}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start":9,"end":40,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":31}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":15,"end":39,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":30}}, + "id": { + "type": "Identifier", + "start":15,"end":32,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":23},"identifierName":"a"}, + "name": "a", + "typeAnnotation": { + "type": "TypeAnnotation", + "start":16,"end":32,"loc":{"start":{"line":2,"column":7},"end":{"line":2,"column":23}}, + "typeAnnotation": { + "type": "TypeofTypeAnnotation", + "start":18,"end":32,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":23}}, + "argument": { + "type": "Identifier", + "start":25,"end":32,"loc":{"start":{"line":2,"column":16},"end":{"line":2,"column":23},"identifierName":"default"}, + "name": "default" + } + } + } + }, + "init": { + "type": "StringLiteral", + "start":35,"end":39,"loc":{"start":{"line":2,"column":26},"end":{"line":2,"column":30}}, + "extra": { + "rawValue": "hi", + "raw": "\"hi\"" + }, + "value": "hi" + } + } + ], + "kind": "const", + "leadingComments": [ + { + "type": "CommentLine", + "value": " @flow", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}} + } + ] + }, + { + "type": "VariableDeclaration", + "start":41,"end":78,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":37}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":47,"end":77,"loc":{"start":{"line":3,"column":6},"end":{"line":3,"column":36}}, + "id": { + "type": "Identifier", + "start":47,"end":70,"loc":{"start":{"line":3,"column":6},"end":{"line":3,"column":29},"identifierName":"b"}, + "name": "b", + "typeAnnotation": { + "type": "TypeAnnotation", + "start":48,"end":70,"loc":{"start":{"line":3,"column":7},"end":{"line":3,"column":29}}, + "typeAnnotation": { + "type": "TypeofTypeAnnotation", + "start":50,"end":70,"loc":{"start":{"line":3,"column":9},"end":{"line":3,"column":29}}, + "argument": { + "type": "GenericTypeAnnotation", + "start":57,"end":70,"loc":{"start":{"line":3,"column":16},"end":{"line":3,"column":29}}, + "typeParameters": null, + "id": { + "type": "QualifiedTypeIdentifier", + "start":57,"end":70,"loc":{"start":{"line":3,"column":16},"end":{"line":3,"column":29}}, + "qualification": { + "type": "Identifier", + "start":57,"end":62,"loc":{"start":{"line":3,"column":16},"end":{"line":3,"column":21},"identifierName":"stuff"}, + "name": "stuff" + }, + "id": { + "type": "Identifier", + "start":63,"end":70,"loc":{"start":{"line":3,"column":22},"end":{"line":3,"column":29},"identifierName":"default"}, + "name": "default" + } + } + } + } + } + }, + "init": { + "type": "StringLiteral", + "start":73,"end":77,"loc":{"start":{"line":3,"column":32},"end":{"line":3,"column":36}}, + "extra": { + "rawValue": "hi", + "raw": "\"hi\"" + }, + "value": "hi" + } + } + ], + "kind": "const" + }, + { + "type": "VariableDeclaration", + "start":80,"end":107,"loc":{"start":{"line":5,"column":0},"end":{"line":5,"column":27}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":86,"end":106,"loc":{"start":{"line":5,"column":6},"end":{"line":5,"column":26}}, + "id": { + "type": "Identifier", + "start":86,"end":99,"loc":{"start":{"line":5,"column":6},"end":{"line":5,"column":19},"identifierName":"c"}, + "name": "c", + "typeAnnotation": { + "type": "TypeAnnotation", + "start":87,"end":99,"loc":{"start":{"line":5,"column":7},"end":{"line":5,"column":19}}, + "typeAnnotation": { + "type": "TypeofTypeAnnotation", + "start":89,"end":99,"loc":{"start":{"line":5,"column":9},"end":{"line":5,"column":19}}, + "argument": { + "type": "AnyTypeAnnotation", + "start":96,"end":99,"loc":{"start":{"line":5,"column":16},"end":{"line":5,"column":19}} + } + } + } + }, + "init": { + "type": "StringLiteral", + "start":102,"end":106,"loc":{"start":{"line":5,"column":22},"end":{"line":5,"column":26}}, + "extra": { + "rawValue": "hi", + "raw": "\"hi\"" + }, + "value": "hi" + } + } + ], + "kind": "const" + }, + { + "type": "VariableDeclaration", + "start":108,"end":136,"loc":{"start":{"line":6,"column":0},"end":{"line":6,"column":28}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":114,"end":135,"loc":{"start":{"line":6,"column":6},"end":{"line":6,"column":27}}, + "id": { + "type": "Identifier", + "start":114,"end":128,"loc":{"start":{"line":6,"column":6},"end":{"line":6,"column":20},"identifierName":"d"}, + "name": "d", + "typeAnnotation": { + "type": "TypeAnnotation", + "start":115,"end":128,"loc":{"start":{"line":6,"column":7},"end":{"line":6,"column":20}}, + "typeAnnotation": { + "type": "TypeofTypeAnnotation", + "start":117,"end":128,"loc":{"start":{"line":6,"column":9},"end":{"line":6,"column":20}}, + "argument": { + "type": "BooleanTypeAnnotation", + "start":124,"end":128,"loc":{"start":{"line":6,"column":16},"end":{"line":6,"column":20}} + } + } + } + }, + "init": { + "type": "StringLiteral", + "start":131,"end":135,"loc":{"start":{"line":6,"column":23},"end":{"line":6,"column":27}}, + "extra": { + "rawValue": "hi", + "raw": "\"hi\"" + }, + "value": "hi" + } + } + ], + "kind": "const" + }, + { + "type": "VariableDeclaration", + "start":137,"end":168,"loc":{"start":{"line":7,"column":0},"end":{"line":7,"column":31}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":143,"end":167,"loc":{"start":{"line":7,"column":6},"end":{"line":7,"column":30}}, + "id": { + "type": "Identifier", + "start":143,"end":160,"loc":{"start":{"line":7,"column":6},"end":{"line":7,"column":23},"identifierName":"e"}, + "name": "e", + "typeAnnotation": { + "type": "TypeAnnotation", + "start":144,"end":160,"loc":{"start":{"line":7,"column":7},"end":{"line":7,"column":23}}, + "typeAnnotation": { + "type": "TypeofTypeAnnotation", + "start":146,"end":160,"loc":{"start":{"line":7,"column":9},"end":{"line":7,"column":23}}, + "argument": { + "type": "BooleanTypeAnnotation", + "start":153,"end":160,"loc":{"start":{"line":7,"column":16},"end":{"line":7,"column":23}} + } + } + } + }, + "init": { + "type": "StringLiteral", + "start":163,"end":167,"loc":{"start":{"line":7,"column":26},"end":{"line":7,"column":30}}, + "extra": { + "rawValue": "hi", + "raw": "\"hi\"" + }, + "value": "hi" + } + } + ], + "kind": "const" + }, + { + "type": "VariableDeclaration", + "start":169,"end":198,"loc":{"start":{"line":8,"column":0},"end":{"line":8,"column":29}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":175,"end":197,"loc":{"start":{"line":8,"column":6},"end":{"line":8,"column":28}}, + "id": { + "type": "Identifier", + "start":175,"end":190,"loc":{"start":{"line":8,"column":6},"end":{"line":8,"column":21},"identifierName":"f"}, + "name": "f", + "typeAnnotation": { + "type": "TypeAnnotation", + "start":176,"end":190,"loc":{"start":{"line":8,"column":7},"end":{"line":8,"column":21}}, + "typeAnnotation": { + "type": "TypeofTypeAnnotation", + "start":178,"end":190,"loc":{"start":{"line":8,"column":9},"end":{"line":8,"column":21}}, + "argument": { + "type": "EmptyTypeAnnotation", + "start":185,"end":190,"loc":{"start":{"line":8,"column":16},"end":{"line":8,"column":21}} + } + } + } + }, + "init": { + "type": "StringLiteral", + "start":193,"end":197,"loc":{"start":{"line":8,"column":24},"end":{"line":8,"column":28}}, + "extra": { + "rawValue": "hi", + "raw": "\"hi\"" + }, + "value": "hi" + } + } + ], + "kind": "const" + }, + { + "type": "VariableDeclaration", + "start":199,"end":228,"loc":{"start":{"line":9,"column":0},"end":{"line":9,"column":29}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":205,"end":227,"loc":{"start":{"line":9,"column":6},"end":{"line":9,"column":28}}, + "id": { + "type": "Identifier", + "start":205,"end":220,"loc":{"start":{"line":9,"column":6},"end":{"line":9,"column":21},"identifierName":"g"}, + "name": "g", + "typeAnnotation": { + "type": "TypeAnnotation", + "start":206,"end":220,"loc":{"start":{"line":9,"column":7},"end":{"line":9,"column":21}}, + "typeAnnotation": { + "type": "TypeofTypeAnnotation", + "start":208,"end":220,"loc":{"start":{"line":9,"column":9},"end":{"line":9,"column":21}}, + "argument": { + "type": "BooleanLiteralTypeAnnotation", + "start":215,"end":220,"loc":{"start":{"line":9,"column":16},"end":{"line":9,"column":21}}, + "value": false + } + } + } + }, + "init": { + "type": "StringLiteral", + "start":223,"end":227,"loc":{"start":{"line":9,"column":24},"end":{"line":9,"column":28}}, + "extra": { + "rawValue": "hi", + "raw": "\"hi\"" + }, + "value": "hi" + } + } + ], + "kind": "const" + }, + { + "type": "VariableDeclaration", + "start":229,"end":258,"loc":{"start":{"line":10,"column":0},"end":{"line":10,"column":29}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":235,"end":257,"loc":{"start":{"line":10,"column":6},"end":{"line":10,"column":28}}, + "id": { + "type": "Identifier", + "start":235,"end":250,"loc":{"start":{"line":10,"column":6},"end":{"line":10,"column":21},"identifierName":"h"}, + "name": "h", + "typeAnnotation": { + "type": "TypeAnnotation", + "start":236,"end":250,"loc":{"start":{"line":10,"column":7},"end":{"line":10,"column":21}}, + "typeAnnotation": { + "type": "TypeofTypeAnnotation", + "start":238,"end":250,"loc":{"start":{"line":10,"column":9},"end":{"line":10,"column":21}}, + "argument": { + "type": "MixedTypeAnnotation", + "start":245,"end":250,"loc":{"start":{"line":10,"column":16},"end":{"line":10,"column":21}} + } + } + } + }, + "init": { + "type": "StringLiteral", + "start":253,"end":257,"loc":{"start":{"line":10,"column":24},"end":{"line":10,"column":28}}, + "extra": { + "rawValue": "hi", + "raw": "\"hi\"" + }, + "value": "hi" + } + } + ], + "kind": "const" + }, + { + "type": "VariableDeclaration", + "start":259,"end":287,"loc":{"start":{"line":11,"column":0},"end":{"line":11,"column":28}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":265,"end":286,"loc":{"start":{"line":11,"column":6},"end":{"line":11,"column":27}}, + "id": { + "type": "Identifier", + "start":265,"end":279,"loc":{"start":{"line":11,"column":6},"end":{"line":11,"column":20},"identifierName":"i"}, + "name": "i", + "typeAnnotation": { + "type": "TypeAnnotation", + "start":266,"end":279,"loc":{"start":{"line":11,"column":7},"end":{"line":11,"column":20}}, + "typeAnnotation": { + "type": "TypeofTypeAnnotation", + "start":268,"end":279,"loc":{"start":{"line":11,"column":9},"end":{"line":11,"column":20}}, + "argument": { + "type": "NullLiteralTypeAnnotation", + "start":275,"end":279,"loc":{"start":{"line":11,"column":16},"end":{"line":11,"column":20}} + } + } + } + }, + "init": { + "type": "StringLiteral", + "start":282,"end":286,"loc":{"start":{"line":11,"column":23},"end":{"line":11,"column":27}}, + "extra": { + "rawValue": "hi", + "raw": "\"hi\"" + }, + "value": "hi" + } + } + ], + "kind": "const" + }, + { + "type": "VariableDeclaration", + "start":288,"end":318,"loc":{"start":{"line":12,"column":0},"end":{"line":12,"column":30}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":294,"end":317,"loc":{"start":{"line":12,"column":6},"end":{"line":12,"column":29}}, + "id": { + "type": "Identifier", + "start":294,"end":310,"loc":{"start":{"line":12,"column":6},"end":{"line":12,"column":22},"identifierName":"j"}, + "name": "j", + "typeAnnotation": { + "type": "TypeAnnotation", + "start":295,"end":310,"loc":{"start":{"line":12,"column":7},"end":{"line":12,"column":22}}, + "typeAnnotation": { + "type": "TypeofTypeAnnotation", + "start":297,"end":310,"loc":{"start":{"line":12,"column":9},"end":{"line":12,"column":22}}, + "argument": { + "type": "NumberTypeAnnotation", + "start":304,"end":310,"loc":{"start":{"line":12,"column":16},"end":{"line":12,"column":22}} + } + } + } + }, + "init": { + "type": "StringLiteral", + "start":313,"end":317,"loc":{"start":{"line":12,"column":25},"end":{"line":12,"column":29}}, + "extra": { + "rawValue": "hi", + "raw": "\"hi\"" + }, + "value": "hi" + } + } + ], + "kind": "const" + }, + { + "type": "VariableDeclaration", + "start":319,"end":349,"loc":{"start":{"line":13,"column":0},"end":{"line":13,"column":30}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":325,"end":348,"loc":{"start":{"line":13,"column":6},"end":{"line":13,"column":29}}, + "id": { + "type": "Identifier", + "start":325,"end":341,"loc":{"start":{"line":13,"column":6},"end":{"line":13,"column":22},"identifierName":"k"}, + "name": "k", + "typeAnnotation": { + "type": "TypeAnnotation", + "start":326,"end":341,"loc":{"start":{"line":13,"column":7},"end":{"line":13,"column":22}}, + "typeAnnotation": { + "type": "TypeofTypeAnnotation", + "start":328,"end":341,"loc":{"start":{"line":13,"column":9},"end":{"line":13,"column":22}}, + "argument": { + "type": "StringTypeAnnotation", + "start":335,"end":341,"loc":{"start":{"line":13,"column":16},"end":{"line":13,"column":22}} + } + } + } + }, + "init": { + "type": "StringLiteral", + "start":344,"end":348,"loc":{"start":{"line":13,"column":25},"end":{"line":13,"column":29}}, + "extra": { + "rawValue": "hi", + "raw": "\"hi\"" + }, + "value": "hi" + } + } + ], + "kind": "const" + }, + { + "type": "VariableDeclaration", + "start":350,"end":378,"loc":{"start":{"line":14,"column":0},"end":{"line":14,"column":28}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":356,"end":377,"loc":{"start":{"line":14,"column":6},"end":{"line":14,"column":27}}, + "id": { + "type": "Identifier", + "start":356,"end":370,"loc":{"start":{"line":14,"column":6},"end":{"line":14,"column":20},"identifierName":"l"}, + "name": "l", + "typeAnnotation": { + "type": "TypeAnnotation", + "start":357,"end":370,"loc":{"start":{"line":14,"column":7},"end":{"line":14,"column":20}}, + "typeAnnotation": { + "type": "TypeofTypeAnnotation", + "start":359,"end":370,"loc":{"start":{"line":14,"column":9},"end":{"line":14,"column":20}}, + "argument": { + "type": "BooleanLiteralTypeAnnotation", + "start":366,"end":370,"loc":{"start":{"line":14,"column":16},"end":{"line":14,"column":20}}, + "value": true + } + } + } + }, + "init": { + "type": "StringLiteral", + "start":373,"end":377,"loc":{"start":{"line":14,"column":23},"end":{"line":14,"column":27}}, + "extra": { + "rawValue": "hi", + "raw": "\"hi\"" + }, + "value": "hi" + } + } + ], + "kind": "const" + }, + { + "type": "VariableDeclaration", + "start":379,"end":407,"loc":{"start":{"line":15,"column":0},"end":{"line":15,"column":28}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":385,"end":406,"loc":{"start":{"line":15,"column":6},"end":{"line":15,"column":27}}, + "id": { + "type": "Identifier", + "start":385,"end":399,"loc":{"start":{"line":15,"column":6},"end":{"line":15,"column":20},"identifierName":"m"}, + "name": "m", + "typeAnnotation": { + "type": "TypeAnnotation", + "start":386,"end":399,"loc":{"start":{"line":15,"column":7},"end":{"line":15,"column":20}}, + "typeAnnotation": { + "type": "TypeofTypeAnnotation", + "start":388,"end":399,"loc":{"start":{"line":15,"column":9},"end":{"line":15,"column":20}}, + "argument": { + "type": "VoidTypeAnnotation", + "start":395,"end":399,"loc":{"start":{"line":15,"column":16},"end":{"line":15,"column":20}} + } + } + } + }, + "init": { + "type": "StringLiteral", + "start":402,"end":406,"loc":{"start":{"line":15,"column":23},"end":{"line":15,"column":27}}, + "extra": { + "rawValue": "hi", + "raw": "\"hi\"" + }, + "value": "hi" + } + } + ], + "kind": "const" + } + ], + "directives": [] + }, + "comments": [ + { + "type": "CommentLine", + "value": " @flow", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}} + } + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/with-default-invalid/options.json b/packages/babel-parser/test/fixtures/flow/type-annotations/with-default-invalid/options.json deleted file mode 100644 index 24792311b3e9..000000000000 --- a/packages/babel-parser/test/fixtures/flow/type-annotations/with-default-invalid/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Type annotations must come before default assignments, e.g. instead of `age = 25: number` use `age: number = 25` (1:20)" -} diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/with-default-invalid/output.json b/packages/babel-parser/test/fixtures/flow/type-annotations/with-default-invalid/output.json new file mode 100644 index 000000000000..8b2be7f584af --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/type-annotations/with-default-invalid/output.json @@ -0,0 +1,61 @@ +{ + "type": "File", + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, + "errors": [ + "SyntaxError: Type annotations must come before default assignments, e.g. instead of `age = 25: number` use `age: number = 25` (1:20)" + ], + "program": { + "type": "Program", + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, + "id": { + "type": "Identifier", + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"x"}, + "name": "x" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "AssignmentPattern", + "start":11,"end":28,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":28}}, + "left": { + "type": "Identifier", + "start":11,"end":14,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":14},"identifierName":"foo"}, + "name": "foo" + }, + "right": { + "type": "StringLiteral", + "start":17,"end":20,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":20}}, + "extra": { + "rawValue": "1", + "raw": "\"1\"" + }, + "value": "1" + }, + "typeAnnotation": { + "type": "TypeAnnotation", + "start":20,"end":28,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":28}}, + "typeAnnotation": { + "type": "StringTypeAnnotation", + "start":22,"end":28,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":28}} + } + } + } + ], + "body": { + "type": "BlockStatement", + "start":30,"end":32,"loc":{"start":{"line":1,"column":30},"end":{"line":1,"column":32}}, + "body": [], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/with-default-valid/output.json b/packages/babel-parser/test/fixtures/flow/type-annotations/with-default-valid/output.json index b6326ce6a2b1..a779d3c652bb 100644 --- a/packages/babel-parser/test/fixtures/flow/type-annotations/with-default-valid/output.json +++ b/packages/babel-parser/test/fixtures/flow/type-annotations/with-default-valid/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, "program": { "type": "Program", - "start": 0, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, "id": { "type": "Identifier", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - }, - "identifierName": "x" - }, + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"x"}, "name": "x" }, "generator": false, @@ -65,79 +20,23 @@ "params": [ { "type": "AssignmentPattern", - "start": 11, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":11,"end":28,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":28}}, "left": { "type": "Identifier", - "start": 11, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 22 - }, - "identifierName": "foo" - }, + "start":11,"end":22,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":22},"identifierName":"foo"}, "name": "foo", "typeAnnotation": { "type": "TypeAnnotation", - "start": 14, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":14,"end":22,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":22}}, "typeAnnotation": { "type": "StringTypeAnnotation", - "start": 16, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 22 - } - } + "start":16,"end":22,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":22}} } } }, "right": { "type": "StringLiteral", - "start": 25, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":25,"end":28,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":28}}, "extra": { "rawValue": "1", "raw": "\"1\"" @@ -148,18 +47,7 @@ ], "body": { "type": "BlockStatement", - "start": 30, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":30,"end":32,"loc":{"start":{"line":1,"column":30},"end":{"line":1,"column":32}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/flow/type-exports/alias/output.json b/packages/babel-parser/test/fixtures/flow/type-exports/alias/output.json index 8d791a081562..69bcdc69f58c 100644 --- a/packages/babel-parser/test/fixtures/flow/type-exports/alias/output.json +++ b/packages/babel-parser/test/fixtures/flow/type-exports/alias/output.json @@ -1,97 +1,30 @@ { "type": "File", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "program": { "type": "Program", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExportNamedDeclaration", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "specifiers": [], "source": null, "exportKind": "type", "declaration": { "type": "TypeAlias", - "start": 7, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":7,"end":23,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":23}}, "id": { "type": "Identifier", - "start": 12, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - }, - "identifierName": "a" - }, + "start":12,"end":13,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":13},"identifierName":"a"}, "name": "a" }, "typeParameters": null, "right": { "type": "NumberTypeAnnotation", - "start": 16, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 22 - } - } + "start":16,"end":22,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":22}} } } } diff --git a/packages/babel-parser/test/fixtures/flow/type-exports/interface/output.json b/packages/babel-parser/test/fixtures/flow/type-exports/interface/output.json index 01516efbba03..61c9e46c174f 100644 --- a/packages/babel-parser/test/fixtures/flow/type-exports/interface/output.json +++ b/packages/babel-parser/test/fixtures/flow/type-exports/interface/output.json @@ -1,80 +1,24 @@ { "type": "File", - "start": 0, - "end": 69, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 33 - } - }, + "start":0,"end":69,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":33}}, "program": { "type": "Program", - "start": 0, - "end": 69, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 33 - } - }, + "start":0,"end":69,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":33}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExportNamedDeclaration", - "start": 0, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, "specifiers": [], "source": null, "exportKind": "type", "declaration": { "type": "InterfaceDeclaration", - "start": 7, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":7,"end":34,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":34}}, "id": { "type": "Identifier", - "start": 17, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 20 - }, - "identifierName": "foo" - }, + "start":17,"end":20,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":20},"identifierName":"foo"}, "name": "foo" }, "typeParameters": null, @@ -83,49 +27,15 @@ "mixins": [], "body": { "type": "ObjectTypeAnnotation", - "start": 21, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":21,"end":34,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":34}}, "callProperties": [], "properties": [ { "type": "ObjectTypeProperty", - "start": 23, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":23,"end":32,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":32}}, "key": { "type": "Identifier", - "start": 23, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 24 - }, - "identifierName": "p" - }, + "start":23,"end":24,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":24},"identifierName":"p"}, "name": "p" }, "static": false, @@ -134,18 +44,7 @@ "method": false, "value": { "type": "NumberTypeAnnotation", - "start": 26, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 32 - } - } + "start":26,"end":32,"loc":{"start":{"line":1,"column":26},"end":{"line":1,"column":32}} }, "variance": null, "optional": false @@ -159,96 +58,29 @@ }, { "type": "EmptyStatement", - "start": 34, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 34 - }, - "end": { - "line": 1, - "column": 35 - } - } + "start":34,"end":35,"loc":{"start":{"line":1,"column":34},"end":{"line":1,"column":35}} }, { "type": "ExportNamedDeclaration", - "start": 36, - "end": 68, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 32 - } - }, + "start":36,"end":68,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":32}}, "specifiers": [], "source": null, "exportKind": "type", "declaration": { "type": "InterfaceDeclaration", - "start": 43, - "end": 68, - "loc": { - "start": { - "line": 2, - "column": 7 - }, - "end": { - "line": 2, - "column": 32 - } - }, + "start":43,"end":68,"loc":{"start":{"line":2,"column":7},"end":{"line":2,"column":32}}, "id": { "type": "Identifier", - "start": 53, - "end": 56, - "loc": { - "start": { - "line": 2, - "column": 17 - }, - "end": { - "line": 2, - "column": 20 - }, - "identifierName": "bar" - }, + "start":53,"end":56,"loc":{"start":{"line":2,"column":17},"end":{"line":2,"column":20},"identifierName":"bar"}, "name": "bar" }, "typeParameters": { "type": "TypeParameterDeclaration", - "start": 56, - "end": 59, - "loc": { - "start": { - "line": 2, - "column": 20 - }, - "end": { - "line": 2, - "column": 23 - } - }, + "start":56,"end":59,"loc":{"start":{"line":2,"column":20},"end":{"line":2,"column":23}}, "params": [ { "type": "TypeParameter", - "start": 57, - "end": 58, - "loc": { - "start": { - "line": 2, - "column": 21 - }, - "end": { - "line": 2, - "column": 22 - } - }, + "start":57,"end":58,"loc":{"start":{"line":2,"column":21},"end":{"line":2,"column":22}}, "name": "T", "variance": null } @@ -259,49 +91,15 @@ "mixins": [], "body": { "type": "ObjectTypeAnnotation", - "start": 60, - "end": 68, - "loc": { - "start": { - "line": 2, - "column": 24 - }, - "end": { - "line": 2, - "column": 32 - } - }, + "start":60,"end":68,"loc":{"start":{"line":2,"column":24},"end":{"line":2,"column":32}}, "callProperties": [], "properties": [ { "type": "ObjectTypeProperty", - "start": 62, - "end": 66, - "loc": { - "start": { - "line": 2, - "column": 26 - }, - "end": { - "line": 2, - "column": 30 - } - }, + "start":62,"end":66,"loc":{"start":{"line":2,"column":26},"end":{"line":2,"column":30}}, "key": { "type": "Identifier", - "start": 62, - "end": 63, - "loc": { - "start": { - "line": 2, - "column": 26 - }, - "end": { - "line": 2, - "column": 27 - }, - "identifierName": "p" - }, + "start":62,"end":63,"loc":{"start":{"line":2,"column":26},"end":{"line":2,"column":27},"identifierName":"p"}, "name": "p" }, "static": false, @@ -310,34 +108,11 @@ "method": false, "value": { "type": "GenericTypeAnnotation", - "start": 65, - "end": 66, - "loc": { - "start": { - "line": 2, - "column": 29 - }, - "end": { - "line": 2, - "column": 30 - } - }, + "start":65,"end":66,"loc":{"start":{"line":2,"column":29},"end":{"line":2,"column":30}}, "typeParameters": null, "id": { "type": "Identifier", - "start": 65, - "end": 66, - "loc": { - "start": { - "line": 2, - "column": 29 - }, - "end": { - "line": 2, - "column": 30 - }, - "identifierName": "T" - }, + "start":65,"end":66,"loc":{"start":{"line":2,"column":29},"end":{"line":2,"column":30},"identifierName":"T"}, "name": "T" } }, @@ -353,18 +128,7 @@ }, { "type": "EmptyStatement", - "start": 68, - "end": 69, - "loc": { - "start": { - "line": 2, - "column": 32 - }, - "end": { - "line": 2, - "column": 33 - } - } + "start":68,"end":69,"loc":{"start":{"line":2,"column":32},"end":{"line":2,"column":33}} } ], "directives": [] diff --git a/packages/babel-parser/test/fixtures/flow/type-exports/specifier-from/output.json b/packages/babel-parser/test/fixtures/flow/type-exports/specifier-from/output.json index 74d1c761b02f..aed14419e665 100644 --- a/packages/babel-parser/test/fixtures/flow/type-exports/specifier-from/output.json +++ b/packages/babel-parser/test/fixtures/flow/type-exports/specifier-from/output.json @@ -1,113 +1,34 @@ { "type": "File", - "start": 0, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, "program": { "type": "Program", - "start": 0, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExportNamedDeclaration", - "start": 0, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, "specifiers": [ { "type": "ExportSpecifier", - "start": 14, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":14,"end":17,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":17}}, "local": { "type": "Identifier", - "start": 14, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 17 - }, - "identifierName": "foo" - }, + "start":14,"end":17,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":17},"identifierName":"foo"}, "name": "foo" }, "exported": { "type": "Identifier", - "start": 14, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 17 - }, - "identifierName": "foo" - }, + "start":14,"end":17,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":17},"identifierName":"foo"}, "name": "foo" } } ], "source": { "type": "StringLiteral", - "start": 25, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":25,"end":33,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":33}}, "extra": { "rawValue": "foobar", "raw": "\"foobar\"" diff --git a/packages/babel-parser/test/fixtures/flow/type-exports/specifier/output.json b/packages/babel-parser/test/fixtures/flow/type-exports/specifier/output.json index f4d18be8251b..b562088728cc 100644 --- a/packages/babel-parser/test/fixtures/flow/type-exports/specifier/output.json +++ b/packages/babel-parser/test/fixtures/flow/type-exports/specifier/output.json @@ -1,78 +1,22 @@ { "type": "File", - "start": 0, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 20 - } - }, + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":20}}, "program": { "type": "Program", - "start": 0, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 20 - } - }, + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":20}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":4,"end":7,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":7}}, "id": { "type": "Identifier", - "start": 4, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "foo" - }, + "start":4,"end":7,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":7},"identifierName":"foo"}, "name": "foo" }, "init": null @@ -82,65 +26,19 @@ }, { "type": "ExportNamedDeclaration", - "start": 9, - "end": 29, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 20 - } - }, + "start":9,"end":29,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":20}}, "specifiers": [ { "type": "ExportSpecifier", - "start": 23, - "end": 26, - "loc": { - "start": { - "line": 2, - "column": 14 - }, - "end": { - "line": 2, - "column": 17 - } - }, + "start":23,"end":26,"loc":{"start":{"line":2,"column":14},"end":{"line":2,"column":17}}, "local": { "type": "Identifier", - "start": 23, - "end": 26, - "loc": { - "start": { - "line": 2, - "column": 14 - }, - "end": { - "line": 2, - "column": 17 - }, - "identifierName": "foo" - }, + "start":23,"end":26,"loc":{"start":{"line":2,"column":14},"end":{"line":2,"column":17},"identifierName":"foo"}, "name": "foo" }, "exported": { "type": "Identifier", - "start": 23, - "end": 26, - "loc": { - "start": { - "line": 2, - "column": 14 - }, - "end": { - "line": 2, - "column": 17 - }, - "identifierName": "foo" - }, + "start":23,"end":26,"loc":{"start":{"line":2,"column":14},"end":{"line":2,"column":17},"identifierName":"foo"}, "name": "foo" } } diff --git a/packages/babel-parser/test/fixtures/flow/type-exports/star-as-from/options.json b/packages/babel-parser/test/fixtures/flow/type-exports/star-as-from/options.json index d482b18c6cff..6a0cd1358ef1 100644 --- a/packages/babel-parser/test/fixtures/flow/type-exports/star-as-from/options.json +++ b/packages/babel-parser/test/fixtures/flow/type-exports/star-as-from/options.json @@ -1,5 +1,5 @@ { "sourceType": "module", - "plugins": ["flow", "exportNamespaceFrom"], + "plugins": ["flow"], "throws": "Unexpected token (1:14)" } diff --git a/packages/babel-parser/test/fixtures/flow/type-exports/star-from/output.json b/packages/babel-parser/test/fixtures/flow/type-exports/star-from/output.json index 64a6f20b34b6..0a08fa97c4bc 100644 --- a/packages/babel-parser/test/fixtures/flow/type-exports/star-from/output.json +++ b/packages/babel-parser/test/fixtures/flow/type-exports/star-from/output.json @@ -1,63 +1,19 @@ { "type": "File", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, "program": { "type": "Program", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExportAllDeclaration", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, "exportKind": "type", "source": { "type": "StringLiteral", - "start": 19, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":19,"end":24,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":24}}, "extra": { "rawValue": "foo", "raw": "\"foo\"" diff --git a/packages/babel-parser/test/fixtures/flow/type-generics/1/output.json b/packages/babel-parser/test/fixtures/flow/type-generics/1/output.json index a93a2ad01ca6..13f0e7bd7a68 100644 --- a/packages/babel-parser/test/fixtures/flow/type-generics/1/output.json +++ b/packages/babel-parser/test/fixtures/flow/type-generics/1/output.json @@ -1,206 +1,60 @@ { "type": "File", - "start": 0, - "end": 84, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 84 - } - }, + "start":0,"end":84,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":84}}, "program": { "type": "Program", - "start": 0, - "end": 84, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 84 - } - }, + "start":0,"end":84,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":84}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 84, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 84 - } - }, + "start":0,"end":84,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":84}}, "declarations": [ { "type": "VariableDeclarator", - "start": 6, - "end": 83, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 83 - } - }, + "start":6,"end":83,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":83}}, "id": { "type": "Identifier", - "start": 6, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 39 - }, - "identifierName": "functionReturningIdentityAsAField" - }, + "start":6,"end":39,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":39},"identifierName":"functionReturningIdentityAsAField"}, "name": "functionReturningIdentityAsAField" }, "init": { "type": "ArrowFunctionExpression", - "start": 42, - "end": 83, - "loc": { - "start": { - "line": 1, - "column": 42 - }, - "end": { - "line": 1, - "column": 83 - } - }, + "start":42,"end":83,"loc":{"start":{"line":1,"column":42},"end":{"line":1,"column":83}}, "id": null, "generator": false, "async": false, "params": [], "body": { "type": "ObjectExpression", - "start": 49, - "end": 82, - "loc": { - "start": { - "line": 1, - "column": 49 - }, - "end": { - "line": 1, - "column": 82 - } - }, + "start":49,"end":82,"loc":{"start":{"line":1,"column":49},"end":{"line":1,"column":82}}, "properties": [ { "type": "ObjectProperty", - "start": 51, - "end": 80, - "loc": { - "start": { - "line": 1, - "column": 51 - }, - "end": { - "line": 1, - "column": 80 - } - }, + "start":51,"end":80,"loc":{"start":{"line":1,"column":51},"end":{"line":1,"column":80}}, "method": false, "key": { "type": "Identifier", - "start": 51, - "end": 53, - "loc": { - "start": { - "line": 1, - "column": 51 - }, - "end": { - "line": 1, - "column": 53 - }, - "identifierName": "id" - }, + "start":51,"end":53,"loc":{"start":{"line":1,"column":51},"end":{"line":1,"column":53},"identifierName":"id"}, "name": "id" }, "computed": false, "shorthand": false, "value": { "type": "ArrowFunctionExpression", - "start": 55, - "end": 80, - "loc": { - "start": { - "line": 1, - "column": 55 - }, - "end": { - "line": 1, - "column": 80 - } - }, + "start":55,"end":80,"loc":{"start":{"line":1,"column":55},"end":{"line":1,"column":80}}, "predicate": null, "returnType": { "type": "TypeAnnotation", - "start": 68, - "end": 71, - "loc": { - "start": { - "line": 1, - "column": 68 - }, - "end": { - "line": 1, - "column": 71 - } - }, + "start":68,"end":71,"loc":{"start":{"line":1,"column":68},"end":{"line":1,"column":71}}, "typeAnnotation": { "type": "GenericTypeAnnotation", - "start": 70, - "end": 71, - "loc": { - "start": { - "line": 1, - "column": 70 - }, - "end": { - "line": 1, - "column": 71 - } - }, + "start":70,"end":71,"loc":{"start":{"line":1,"column":70},"end":{"line":1,"column":71}}, "typeParameters": null, "id": { "type": "Identifier", - "start": 70, - "end": 71, - "loc": { - "start": { - "line": 1, - "column": 70 - }, - "end": { - "line": 1, - "column": 71 - }, - "identifierName": "T" - }, + "start":70,"end":71,"loc":{"start":{"line":1,"column":70},"end":{"line":1,"column":71},"identifierName":"T"}, "name": "T" } } @@ -211,64 +65,18 @@ "params": [ { "type": "Identifier", - "start": 59, - "end": 67, - "loc": { - "start": { - "line": 1, - "column": 59 - }, - "end": { - "line": 1, - "column": 67 - }, - "identifierName": "value" - }, + "start":59,"end":67,"loc":{"start":{"line":1,"column":59},"end":{"line":1,"column":67},"identifierName":"value"}, "name": "value", "typeAnnotation": { "type": "TypeAnnotation", - "start": 64, - "end": 67, - "loc": { - "start": { - "line": 1, - "column": 64 - }, - "end": { - "line": 1, - "column": 67 - } - }, + "start":64,"end":67,"loc":{"start":{"line":1,"column":64},"end":{"line":1,"column":67}}, "typeAnnotation": { "type": "GenericTypeAnnotation", - "start": 66, - "end": 67, - "loc": { - "start": { - "line": 1, - "column": 66 - }, - "end": { - "line": 1, - "column": 67 - } - }, + "start":66,"end":67,"loc":{"start":{"line":1,"column":66},"end":{"line":1,"column":67}}, "typeParameters": null, "id": { "type": "Identifier", - "start": 66, - "end": 67, - "loc": { - "start": { - "line": 1, - "column": 66 - }, - "end": { - "line": 1, - "column": 67 - }, - "identifierName": "T" - }, + "start":66,"end":67,"loc":{"start":{"line":1,"column":66},"end":{"line":1,"column":67},"identifierName":"T"}, "name": "T" } } @@ -277,50 +85,16 @@ ], "body": { "type": "Identifier", - "start": 75, - "end": 80, - "loc": { - "start": { - "line": 1, - "column": 75 - }, - "end": { - "line": 1, - "column": 80 - }, - "identifierName": "value" - }, + "start":75,"end":80,"loc":{"start":{"line":1,"column":75},"end":{"line":1,"column":80},"identifierName":"value"}, "name": "value" }, "typeParameters": { "type": "TypeParameterDeclaration", - "start": 55, - "end": 58, - "loc": { - "start": { - "line": 1, - "column": 55 - }, - "end": { - "line": 1, - "column": 58 - } - }, + "start":55,"end":58,"loc":{"start":{"line":1,"column":55},"end":{"line":1,"column":58}}, "params": [ { "type": "TypeParameter", - "start": 56, - "end": 57, - "loc": { - "start": { - "line": 1, - "column": 56 - }, - "end": { - "line": 1, - "column": 57 - } - }, + "start":56,"end":57,"loc":{"start":{"line":1,"column":56},"end":{"line":1,"column":57}}, "name": "T", "variance": null } diff --git a/packages/babel-parser/test/fixtures/flow/type-generics/2/output.json b/packages/babel-parser/test/fixtures/flow/type-generics/2/output.json index 2fd6fbcbc268..60caa7c8594b 100644 --- a/packages/babel-parser/test/fixtures/flow/type-generics/2/output.json +++ b/packages/babel-parser/test/fixtures/flow/type-generics/2/output.json @@ -1,139 +1,38 @@ { "type": "File", - "start": 0, - "end": 48, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 12 - } - }, + "start":0,"end":48,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":12}}, "program": { "type": "Program", - "start": 0, - "end": 48, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 12 - } - }, + "start":0,"end":48,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":12}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":35}}, "declarations": [ { "type": "VariableDeclarator", - "start": 6, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":6,"end":34,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":34}}, "id": { "type": "Identifier", - "start": 6, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 14 - }, - "identifierName": "identity" - }, + "start":6,"end":14,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":14},"identifierName":"identity"}, "name": "identity" }, "init": { "type": "ArrowFunctionExpression", - "start": 17, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":17,"end":34,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":34}}, "predicate": null, "returnType": { "type": "TypeAnnotation", - "start": 26, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":26,"end":29,"loc":{"start":{"line":1,"column":26},"end":{"line":1,"column":29}}, "typeAnnotation": { "type": "GenericTypeAnnotation", - "start": 28, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":28,"end":29,"loc":{"start":{"line":1,"column":28},"end":{"line":1,"column":29}}, "typeParameters": null, "id": { "type": "Identifier", - "start": 28, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 29 - }, - "identifierName": "T" - }, + "start":28,"end":29,"loc":{"start":{"line":1,"column":28},"end":{"line":1,"column":29},"identifierName":"T"}, "name": "T" } } @@ -144,64 +43,18 @@ "params": [ { "type": "Identifier", - "start": 21, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 25 - }, - "identifierName": "t" - }, + "start":21,"end":25,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":25},"identifierName":"t"}, "name": "t", "typeAnnotation": { "type": "TypeAnnotation", - "start": 22, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":22,"end":25,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":25}}, "typeAnnotation": { "type": "GenericTypeAnnotation", - "start": 24, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":24,"end":25,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":25}}, "typeParameters": null, "id": { "type": "Identifier", - "start": 24, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 25 - }, - "identifierName": "T" - }, + "start":24,"end":25,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":25},"identifierName":"T"}, "name": "T" } } @@ -210,50 +63,16 @@ ], "body": { "type": "Identifier", - "start": 33, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 33 - }, - "end": { - "line": 1, - "column": 34 - }, - "identifierName": "t" - }, + "start":33,"end":34,"loc":{"start":{"line":1,"column":33},"end":{"line":1,"column":34},"identifierName":"t"}, "name": "t" }, "typeParameters": { "type": "TypeParameterDeclaration", - "start": 17, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":17,"end":20,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":20}}, "params": [ { "type": "TypeParameter", - "start": 18, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":18,"end":19,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":19}}, "name": "T", "variance": null } @@ -266,64 +85,19 @@ }, { "type": "VariableDeclaration", - "start": 36, - "end": 48, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 12 - } - }, + "start":36,"end":48,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":12}}, "declarations": [ { "type": "VariableDeclarator", - "start": 42, - "end": 47, - "loc": { - "start": { - "line": 2, - "column": 6 - }, - "end": { - "line": 2, - "column": 11 - } - }, + "start":42,"end":47,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":11}}, "id": { "type": "Identifier", - "start": 42, - "end": 43, - "loc": { - "start": { - "line": 2, - "column": 6 - }, - "end": { - "line": 2, - "column": 7 - }, - "identifierName": "a" - }, + "start":42,"end":43,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":7},"identifierName":"a"}, "name": "a" }, "init": { "type": "NumericLiteral", - "start": 46, - "end": 47, - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 11 - } - }, + "start":46,"end":47,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":11}}, "extra": { "rawValue": 1, "raw": "1" diff --git a/packages/babel-parser/test/fixtures/flow/type-generics/anonymous-function-generator-invalid/input.ts b/packages/babel-parser/test/fixtures/flow/type-generics/anonymous-function-generator-invalid/input.ts new file mode 100644 index 000000000000..109fe67a21e0 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/type-generics/anonymous-function-generator-invalid/input.ts @@ -0,0 +1,3 @@ +const fn = function* <,>(input: T): Generator { + yield 2; +} diff --git a/packages/babel-parser/test/fixtures/flow/type-generics/anonymous-function-generator-invalid/options.json b/packages/babel-parser/test/fixtures/flow/type-generics/anonymous-function-generator-invalid/options.json new file mode 100644 index 000000000000..a12f51bf6fe4 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/type-generics/anonymous-function-generator-invalid/options.json @@ -0,0 +1,5 @@ +{ + "sourceType": "module", + "plugins": ["jsx", "flow"], + "throws": "Unexpected token (1:22)" +} diff --git a/packages/babel-parser/test/fixtures/flow/type-generics/anonymous-function-generator/input.ts b/packages/babel-parser/test/fixtures/flow/type-generics/anonymous-function-generator/input.ts new file mode 100644 index 000000000000..33ce49c1f4a6 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/type-generics/anonymous-function-generator/input.ts @@ -0,0 +1,3 @@ +const fn = function* (input: T): Generator { + yield 2; +} diff --git a/packages/babel-parser/test/fixtures/flow/type-generics/anonymous-function-generator/output.json b/packages/babel-parser/test/fixtures/flow/type-generics/anonymous-function-generator/output.json new file mode 100644 index 000000000000..064d5577f360 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/type-generics/anonymous-function-generator/output.json @@ -0,0 +1,118 @@ +{ + "type": "File", + "start":0,"end":68,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "program": { + "type": "Program", + "start":0,"end":68,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start":0,"end":68,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":6,"end":68,"loc":{"start":{"line":1,"column":6},"end":{"line":3,"column":1}}, + "id": { + "type": "Identifier", + "start":6,"end":8,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":8},"identifierName":"fn"}, + "name": "fn" + }, + "init": { + "type": "FunctionExpression", + "start":11,"end":68,"loc":{"start":{"line":1,"column":11},"end":{"line":3,"column":1}}, + "id": null, + "generator": true, + "async": false, + "typeParameters": { + "type": "TypeParameterDeclaration", + "start":21,"end":24,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":24}}, + "params": [ + { + "type": "TypeParameter", + "start":22,"end":23,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":23}}, + "name": "T", + "variance": null + } + ] + }, + "params": [ + { + "type": "Identifier", + "start":25,"end":33,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":33},"identifierName":"input"}, + "name": "input", + "typeAnnotation": { + "type": "TypeAnnotation", + "start":30,"end":33,"loc":{"start":{"line":1,"column":30},"end":{"line":1,"column":33}}, + "typeAnnotation": { + "type": "GenericTypeAnnotation", + "start":32,"end":33,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":33}}, + "typeParameters": null, + "id": { + "type": "Identifier", + "start":32,"end":33,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":33},"identifierName":"T"}, + "name": "T" + } + } + } + } + ], + "predicate": null, + "returnType": { + "type": "TypeAnnotation", + "start":34,"end":53,"loc":{"start":{"line":1,"column":34},"end":{"line":1,"column":53}}, + "typeAnnotation": { + "type": "GenericTypeAnnotation", + "start":36,"end":53,"loc":{"start":{"line":1,"column":36},"end":{"line":1,"column":53}}, + "typeParameters": { + "type": "TypeParameterInstantiation", + "start":45,"end":53,"loc":{"start":{"line":1,"column":45},"end":{"line":1,"column":53}}, + "params": [ + { + "type": "NumberTypeAnnotation", + "start":46,"end":52,"loc":{"start":{"line":1,"column":46},"end":{"line":1,"column":52}} + } + ] + }, + "id": { + "type": "Identifier", + "start":36,"end":45,"loc":{"start":{"line":1,"column":36},"end":{"line":1,"column":45},"identifierName":"Generator"}, + "name": "Generator" + } + } + }, + "body": { + "type": "BlockStatement", + "start":54,"end":68,"loc":{"start":{"line":1,"column":54},"end":{"line":3,"column":1}}, + "body": [ + { + "type": "ExpressionStatement", + "start":58,"end":66,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":10}}, + "expression": { + "type": "YieldExpression", + "start":58,"end":65,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":9}}, + "delegate": false, + "argument": { + "type": "NumericLiteral", + "start":64,"end":65,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":9}}, + "extra": { + "rawValue": 2, + "raw": "2" + }, + "value": 2 + } + } + } + ], + "directives": [] + } + } + } + ], + "kind": "const" + } + ], + "directives": [] + } +} diff --git a/packages/babel-parser/test/fixtures/flow/type-generics/async-arrow-like/output.json b/packages/babel-parser/test/fixtures/flow/type-generics/async-arrow-like/output.json index cfa41720d824..fa4b9aa787dd 100644 --- a/packages/babel-parser/test/fixtures/flow/type-generics/async-arrow-like/output.json +++ b/packages/babel-parser/test/fixtures/flow/type-generics/async-arrow-like/output.json @@ -1,204 +1,57 @@ { "type": "File", - "start": 0, - "end": 167, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 32 - } - }, + "start":0,"end":167,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":32}}, "program": { "type": "Program", - "start": 0, - "end": 167, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 32 - } - }, + "start":0,"end":167,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":32}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "expression": { "type": "BinaryExpression", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "left": { "type": "BinaryExpression", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, "left": { "type": "Identifier", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "async" - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5},"identifierName":"async"}, "name": "async" }, "operator": "<", "right": { "type": "Identifier", - "start": 7, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - }, - "identifierName": "T" - }, + "start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8},"identifierName":"T"}, "name": "T" } }, "operator": ">", "right": { "type": "TypeCastExpression", - "start": 10, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":10,"end":21,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":21}}, "expression": { "type": "Identifier", - "start": 10, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "fn" - }, + "start":10,"end":12,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":12},"identifierName":"fn"}, "name": "fn" }, "typeAnnotation": { "type": "TypeAnnotation", - "start": 12, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":12,"end":21,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":21}}, "typeAnnotation": { "type": "FunctionTypeAnnotation", - "start": 14, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":14,"end":21,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":21}}, "params": [], "rest": null, "returnType": { "type": "GenericTypeAnnotation", - "start": 20, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":20,"end":21,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":21}}, "typeParameters": null, "id": { "type": "Identifier", - "start": 20, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 21 - }, - "identifierName": "T" - }, + "start":20,"end":21,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":21},"identifierName":"T"}, "name": "T" } }, @@ -215,158 +68,45 @@ { "type": "CommentLine", "value": " This looks A LOT like an async arrow function, but it isn't because", - "start": 25, - "end": 95, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 70 - } - } + "start":25,"end":95,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":70}} }, { "type": "CommentLine", "value": " T + U isn't a valid type parameter.", - "start": 96, - "end": 134, - "loc": { - "start": { - "line": 4, - "column": 0 - }, - "end": { - "line": 4, - "column": 38 - } - } + "start":96,"end":134,"loc":{"start":{"line":4,"column":0},"end":{"line":4,"column":38}} } ] }, { "type": "ExpressionStatement", - "start": 135, - "end": 167, - "loc": { - "start": { - "line": 5, - "column": 0 - }, - "end": { - "line": 5, - "column": 32 - } - }, + "start":135,"end":167,"loc":{"start":{"line":5,"column":0},"end":{"line":5,"column":32}}, "expression": { "type": "TypeCastExpression", - "start": 136, - "end": 165, - "loc": { - "start": { - "line": 5, - "column": 1 - }, - "end": { - "line": 5, - "column": 30 - } - }, + "start":136,"end":165,"loc":{"start":{"line":5,"column":1},"end":{"line":5,"column":30}}, "expression": { "type": "BinaryExpression", - "start": 136, - "end": 156, - "loc": { - "start": { - "line": 5, - "column": 1 - }, - "end": { - "line": 5, - "column": 21 - } - }, + "start":136,"end":156,"loc":{"start":{"line":5,"column":1},"end":{"line":5,"column":21}}, "left": { "type": "BinaryExpression", - "start": 136, - "end": 148, - "loc": { - "start": { - "line": 5, - "column": 1 - }, - "end": { - "line": 5, - "column": 13 - } - }, + "start":136,"end":148,"loc":{"start":{"line":5,"column":1},"end":{"line":5,"column":13}}, "left": { "type": "Identifier", - "start": 136, - "end": 141, - "loc": { - "start": { - "line": 5, - "column": 1 - }, - "end": { - "line": 5, - "column": 6 - }, - "identifierName": "async" - }, + "start":136,"end":141,"loc":{"start":{"line":5,"column":1},"end":{"line":5,"column":6},"identifierName":"async"}, "name": "async" }, "operator": "<", "right": { "type": "BinaryExpression", - "start": 143, - "end": 148, - "loc": { - "start": { - "line": 5, - "column": 8 - }, - "end": { - "line": 5, - "column": 13 - } - }, + "start":143,"end":148,"loc":{"start":{"line":5,"column":8},"end":{"line":5,"column":13}}, "left": { "type": "Identifier", - "start": 143, - "end": 144, - "loc": { - "start": { - "line": 5, - "column": 8 - }, - "end": { - "line": 5, - "column": 9 - }, - "identifierName": "T" - }, + "start":143,"end":144,"loc":{"start":{"line":5,"column":8},"end":{"line":5,"column":9},"identifierName":"T"}, "name": "T" }, "operator": "+", "right": { "type": "Identifier", - "start": 147, - "end": 148, - "loc": { - "start": { - "line": 5, - "column": 12 - }, - "end": { - "line": 5, - "column": 13 - }, - "identifierName": "U" - }, + "start":147,"end":148,"loc":{"start":{"line":5,"column":12},"end":{"line":5,"column":13},"identifierName":"U"}, "name": "U" } } @@ -374,79 +114,22 @@ "operator": ">", "right": { "type": "TypeCastExpression", - "start": 150, - "end": 155, - "loc": { - "start": { - "line": 5, - "column": 15 - }, - "end": { - "line": 5, - "column": 20 - } - }, + "start":150,"end":155,"loc":{"start":{"line":5,"column":15},"end":{"line":5,"column":20}}, "expression": { "type": "Identifier", - "start": 150, - "end": 152, - "loc": { - "start": { - "line": 5, - "column": 15 - }, - "end": { - "line": 5, - "column": 17 - }, - "identifierName": "fn" - }, + "start":150,"end":152,"loc":{"start":{"line":5,"column":15},"end":{"line":5,"column":17},"identifierName":"fn"}, "name": "fn" }, "typeAnnotation": { "type": "TypeAnnotation", - "start": 152, - "end": 155, - "loc": { - "start": { - "line": 5, - "column": 17 - }, - "end": { - "line": 5, - "column": 20 - } - }, + "start":152,"end":155,"loc":{"start":{"line":5,"column":17},"end":{"line":5,"column":20}}, "typeAnnotation": { "type": "GenericTypeAnnotation", - "start": 154, - "end": 155, - "loc": { - "start": { - "line": 5, - "column": 19 - }, - "end": { - "line": 5, - "column": 20 - } - }, + "start":154,"end":155,"loc":{"start":{"line":5,"column":19},"end":{"line":5,"column":20}}, "typeParameters": null, "id": { "type": "Identifier", - "start": 154, - "end": 155, - "loc": { - "start": { - "line": 5, - "column": 19 - }, - "end": { - "line": 5, - "column": 20 - }, - "identifierName": "T" - }, + "start":154,"end":155,"loc":{"start":{"line":5,"column":19},"end":{"line":5,"column":20},"identifierName":"T"}, "name": "T" } } @@ -459,79 +142,23 @@ }, "typeAnnotation": { "type": "TypeAnnotation", - "start": 156, - "end": 165, - "loc": { - "start": { - "line": 5, - "column": 21 - }, - "end": { - "line": 5, - "column": 30 - } - }, + "start":156,"end":165,"loc":{"start":{"line":5,"column":21},"end":{"line":5,"column":30}}, "typeAnnotation": { "type": "FunctionTypeAnnotation", - "start": 158, - "end": 165, - "loc": { - "start": { - "line": 5, - "column": 23 - }, - "end": { - "line": 5, - "column": 30 - } - }, + "start":158,"end":165,"loc":{"start":{"line":5,"column":23},"end":{"line":5,"column":30}}, "params": [ { "type": "FunctionTypeParam", - "start": 158, - "end": 162, - "loc": { - "start": { - "line": 5, - "column": 23 - }, - "end": { - "line": 5, - "column": 27 - } - }, + "start":158,"end":162,"loc":{"start":{"line":5,"column":23},"end":{"line":5,"column":27}}, "name": null, "optional": false, "typeAnnotation": { "type": "GenericTypeAnnotation", - "start": 158, - "end": 159, - "loc": { - "start": { - "line": 5, - "column": 23 - }, - "end": { - "line": 5, - "column": 24 - } - }, + "start":158,"end":159,"loc":{"start":{"line":5,"column":23},"end":{"line":5,"column":24}}, "typeParameters": null, "id": { "type": "Identifier", - "start": 158, - "end": 159, - "loc": { - "start": { - "line": 5, - "column": 23 - }, - "end": { - "line": 5, - "column": 24 - }, - "identifierName": "T" - }, + "start":158,"end":159,"loc":{"start":{"line":5,"column":23},"end":{"line":5,"column":24},"identifierName":"T"}, "name": "T" } } @@ -540,34 +167,11 @@ "rest": null, "returnType": { "type": "GenericTypeAnnotation", - "start": 163, - "end": 165, - "loc": { - "start": { - "line": 5, - "column": 28 - }, - "end": { - "line": 5, - "column": 30 - } - }, + "start":163,"end":165,"loc":{"start":{"line":5,"column":28},"end":{"line":5,"column":30}}, "typeParameters": null, "id": { "type": "Identifier", - "start": 163, - "end": 165, - "loc": { - "start": { - "line": 5, - "column": 28 - }, - "end": { - "line": 5, - "column": 30 - }, - "identifierName": "fn" - }, + "start":163,"end":165,"loc":{"start":{"line":5,"column":28},"end":{"line":5,"column":30},"identifierName":"fn"}, "name": "fn" } }, @@ -583,34 +187,12 @@ { "type": "CommentLine", "value": " This looks A LOT like an async arrow function, but it isn't because", - "start": 25, - "end": 95, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 70 - } - } + "start":25,"end":95,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":70}} }, { "type": "CommentLine", "value": " T + U isn't a valid type parameter.", - "start": 96, - "end": 134, - "loc": { - "start": { - "line": 4, - "column": 0 - }, - "end": { - "line": 4, - "column": 38 - } - } + "start":96,"end":134,"loc":{"start":{"line":4,"column":0},"end":{"line":4,"column":38}} } ] } @@ -621,34 +203,12 @@ { "type": "CommentLine", "value": " This looks A LOT like an async arrow function, but it isn't because", - "start": 25, - "end": 95, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 70 - } - } + "start":25,"end":95,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":70}} }, { "type": "CommentLine", "value": " T + U isn't a valid type parameter.", - "start": 96, - "end": 134, - "loc": { - "start": { - "line": 4, - "column": 0 - }, - "end": { - "line": 4, - "column": 38 - } - } + "start":96,"end":134,"loc":{"start":{"line":4,"column":0},"end":{"line":4,"column":38}} } ] } \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/type-generics/async-arrow-rest-optional-parameters/output.json b/packages/babel-parser/test/fixtures/flow/type-generics/async-arrow-rest-optional-parameters/output.json index f7a9d83482d7..afd2b79b2220 100644 --- a/packages/babel-parser/test/fixtures/flow/type-generics/async-arrow-rest-optional-parameters/output.json +++ b/packages/babel-parser/test/fixtures/flow/type-generics/async-arrow-rest-optional-parameters/output.json @@ -1,144 +1,44 @@ { "type": "File", - "start": 0, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, "program": { "type": "Program", - "start": 0, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, "expression": { "type": "ArrowFunctionExpression", - "start": 0, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, "id": null, "generator": false, "async": true, "params": [ { "type": "RestElement", - "start": 7, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":7,"end":20,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":20}}, "argument": { "type": "Identifier", - "start": 10, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 14 - }, - "identifierName": "args" - }, + "start":10,"end":14,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":14},"identifierName":"args"}, "name": "args" }, "optional": true, "typeAnnotation": { "type": "TypeAnnotation", - "start": 15, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":15,"end":20,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":20}}, "typeAnnotation": { "type": "AnyTypeAnnotation", - "start": 17, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 20 - } - } + "start":17,"end":20,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":20}} } } } ], "body": { "type": "BlockStatement", - "start": 25, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":25,"end":27,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":27}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/flow/type-generics/async-arrow-rest/output.json b/packages/babel-parser/test/fixtures/flow/type-generics/async-arrow-rest/output.json index 52961a4c6105..aa6840c310d3 100644 --- a/packages/babel-parser/test/fixtures/flow/type-generics/async-arrow-rest/output.json +++ b/packages/babel-parser/test/fixtures/flow/type-generics/async-arrow-rest/output.json @@ -1,143 +1,43 @@ { "type": "File", - "start": 0, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, "program": { "type": "Program", - "start": 0, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, "expression": { "type": "ArrowFunctionExpression", - "start": 0, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, "id": null, "generator": false, "async": true, "params": [ { "type": "RestElement", - "start": 7, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":7,"end":19,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":19}}, "argument": { "type": "Identifier", - "start": 10, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 14 - }, - "identifierName": "args" - }, + "start":10,"end":14,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":14},"identifierName":"args"}, "name": "args" }, "typeAnnotation": { "type": "TypeAnnotation", - "start": 14, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":14,"end":19,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":19}}, "typeAnnotation": { "type": "AnyTypeAnnotation", - "start": 16, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 19 - } - } + "start":16,"end":19,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":19}} } } } ], "body": { "type": "BlockStatement", - "start": 24, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":24,"end":26,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":26}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/flow/type-generics/async-arrow/output.json b/packages/babel-parser/test/fixtures/flow/type-generics/async-arrow/output.json index e423abed1ed5..3a4d934f13ec 100644 --- a/packages/babel-parser/test/fixtures/flow/type-generics/async-arrow/output.json +++ b/packages/babel-parser/test/fixtures/flow/type-generics/async-arrow/output.json @@ -1,91 +1,25 @@ { "type": "File", - "start": 0, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, "program": { "type": "Program", - "start": 0, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, "expression": { "type": "ArrowFunctionExpression", - "start": 0, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, "typeParameters": { "type": "TypeParameterDeclaration", - "start": 6, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":6,"end":9,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":9}}, "params": [ { "type": "TypeParameter", - "start": 7, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8}}, "name": "T", "variance": null } @@ -94,80 +28,23 @@ "params": [ { "type": "Identifier", - "start": 10, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 21 - }, - "identifierName": "fn" - }, + "start":10,"end":21,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":21},"identifierName":"fn"}, "name": "fn", "typeAnnotation": { "type": "TypeAnnotation", - "start": 12, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":12,"end":21,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":21}}, "typeAnnotation": { "type": "FunctionTypeAnnotation", - "start": 14, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":14,"end":21,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":21}}, "params": [], "rest": null, "returnType": { "type": "GenericTypeAnnotation", - "start": 20, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":20,"end":21,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":21}}, "typeParameters": null, "id": { "type": "Identifier", - "start": 20, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 21 - }, - "identifierName": "T" - }, + "start":20,"end":21,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":21},"identifierName":"T"}, "name": "T" } }, @@ -181,19 +58,7 @@ "async": true, "body": { "type": "Identifier", - "start": 26, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 28 - }, - "identifierName": "fn" - }, + "start":26,"end":28,"loc":{"start":{"line":1,"column":26},"end":{"line":1,"column":28},"identifierName":"fn"}, "name": "fn" } } diff --git a/packages/babel-parser/test/fixtures/flow/type-generics/with-jsx/output.json b/packages/babel-parser/test/fixtures/flow/type-generics/with-jsx/output.json index b859028ce948..a06d19da59be 100644 --- a/packages/babel-parser/test/fixtures/flow/type-generics/with-jsx/output.json +++ b/packages/babel-parser/test/fixtures/flow/type-generics/with-jsx/output.json @@ -1,154 +1,42 @@ { "type": "File", - "start": 0, - "end": 54, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 54 - } - }, + "start":0,"end":54,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":54}}, "program": { "type": "Program", - "start": 0, - "end": 54, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 54 - } - }, + "start":0,"end":54,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":54}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 54, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 54 - } - }, + "start":0,"end":54,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":54}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 53, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 53 - } - }, + "start":4,"end":53,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":53}}, "id": { "type": "Identifier", - "start": 4, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 23 - }, - "identifierName": "child" - }, + "start":4,"end":23,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":23},"identifierName":"child"}, "name": "child", "typeAnnotation": { "type": "TypeAnnotation", - "start": 9, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":9,"end":23,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":23}}, "typeAnnotation": { "type": "GenericTypeAnnotation", - "start": 11, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":11,"end":23,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":23}}, "typeParameters": { "type": "TypeParameterInstantiation", - "start": 18, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":18,"end":23,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":23}}, "params": [ { "type": "AnyTypeAnnotation", - "start": 19, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 22 - } - } + "start":19,"end":22,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":22}} } ] }, "id": { "type": "Identifier", - "start": 11, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 18 - }, - "identifierName": "Element" - }, + "start":11,"end":18,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":18},"identifierName":"Element"}, "name": "Element" } } @@ -156,140 +44,45 @@ }, "init": { "type": "JSXElement", - "start": 26, - "end": 53, - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 53 - } - }, + "start":26,"end":53,"loc":{"start":{"line":1,"column":26},"end":{"line":1,"column":53}}, "openingElement": { "type": "JSXOpeningElement", - "start": 26, - "end": 53, - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 53 - } + "start":26,"end":53,"loc":{"start":{"line":1,"column":26},"end":{"line":1,"column":53}}, + "name": { + "type": "JSXIdentifier", + "start":27,"end":30,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":30}}, + "name": "img" }, "attributes": [ { "type": "JSXAttribute", - "start": 31, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 31 - }, - "end": { - "line": 1, - "column": 40 - } - }, + "start":31,"end":40,"loc":{"start":{"line":1,"column":31},"end":{"line":1,"column":40}}, "name": { "type": "JSXIdentifier", - "start": 31, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 31 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":31,"end":34,"loc":{"start":{"line":1,"column":31},"end":{"line":1,"column":34}}, "name": "src" }, "value": { "type": "JSXExpressionContainer", - "start": 35, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 35 - }, - "end": { - "line": 1, - "column": 40 - } - }, + "start":35,"end":40,"loc":{"start":{"line":1,"column":35},"end":{"line":1,"column":40}}, "expression": { "type": "Identifier", - "start": 36, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 36 - }, - "end": { - "line": 1, - "column": 39 - }, - "identifierName": "url" - }, + "start":36,"end":39,"loc":{"start":{"line":1,"column":36},"end":{"line":1,"column":39},"identifierName":"url"}, "name": "url" } } }, { "type": "JSXAttribute", - "start": 41, - "end": 50, - "loc": { - "start": { - "line": 1, - "column": 41 - }, - "end": { - "line": 1, - "column": 50 - } - }, + "start":41,"end":50,"loc":{"start":{"line":1,"column":41},"end":{"line":1,"column":50}}, "name": { "type": "JSXIdentifier", - "start": 41, - "end": 44, - "loc": { - "start": { - "line": 1, - "column": 41 - }, - "end": { - "line": 1, - "column": 44 - } - }, + "start":41,"end":44,"loc":{"start":{"line":1,"column":41},"end":{"line":1,"column":44}}, "name": "key" }, "value": { "type": "StringLiteral", - "start": 45, - "end": 50, - "loc": { - "start": { - "line": 1, - "column": 45 - }, - "end": { - "line": 1, - "column": 50 - } - }, + "start":45,"end":50,"loc":{"start":{"line":1,"column":45},"end":{"line":1,"column":50}}, "extra": { "rawValue": "img", "raw": "\"img\"" @@ -298,22 +91,6 @@ } } ], - "name": { - "type": "JSXIdentifier", - "start": 27, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 30 - } - }, - "name": "img" - }, "selfClosing": true }, "closingElement": null, diff --git a/packages/babel-parser/test/fixtures/flow/type-grouping/1/output.json b/packages/babel-parser/test/fixtures/flow/type-grouping/1/output.json index 8597e224eea2..efea0dcec91d 100644 --- a/packages/babel-parser/test/fixtures/flow/type-grouping/1/output.json +++ b/packages/babel-parser/test/fixtures/flow/type-grouping/1/output.json @@ -1,107 +1,29 @@ { "type": "File", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "program": { "type": "Program", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":4,"end":15,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":15}}, "id": { "type": "Identifier", - "start": 4, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 15 - }, - "identifierName": "a" - }, + "start":4,"end":15,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":15},"identifierName":"a"}, "name": "a", "typeAnnotation": { "type": "TypeAnnotation", - "start": 5, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":5,"end":15,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":15}}, "typeAnnotation": { "type": "NumberTypeAnnotation", - "start": 8, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 14 - } - } + "start":8,"end":14,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":14}} } } }, diff --git a/packages/babel-parser/test/fixtures/flow/type-grouping/2/output.json b/packages/babel-parser/test/fixtures/flow/type-grouping/2/output.json index d9d33e1521c5..f2ee74dd938a 100644 --- a/packages/babel-parser/test/fixtures/flow/type-grouping/2/output.json +++ b/packages/babel-parser/test/fixtures/flow/type-grouping/2/output.json @@ -1,171 +1,49 @@ { "type": "File", - "start": 0, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, "program": { "type": "Program", - "start": 0, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":4,"end":36,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":36}}, "id": { "type": "Identifier", - "start": 4, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 36 - }, - "identifierName": "a" - }, + "start":4,"end":36,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":36},"identifierName":"a"}, "name": "a", "typeAnnotation": { "type": "TypeAnnotation", - "start": 5, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":5,"end":36,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":36}}, "typeAnnotation": { "type": "UnionTypeAnnotation", - "start": 7, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":7,"end":36,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":36}}, "types": [ { "type": "FunctionTypeAnnotation", - "start": 8, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":8,"end":20,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":20}}, "params": [], "rest": null, "returnType": { "type": "NumberTypeAnnotation", - "start": 14, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 20 - } - } + "start":14,"end":20,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":20}} }, "typeParameters": null }, { "type": "FunctionTypeAnnotation", - "start": 24, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":24,"end":36,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":36}}, "params": [], "rest": null, "returnType": { "type": "StringTypeAnnotation", - "start": 30, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 1, - "column": 36 - } - } + "start":30,"end":36,"loc":{"start":{"line":1,"column":30},"end":{"line":1,"column":36}} }, "typeParameters": null } diff --git a/packages/babel-parser/test/fixtures/flow/type-grouping/3/output.json b/packages/babel-parser/test/fixtures/flow/type-grouping/3/output.json index afe9eb91a15d..8d3f055fab19 100644 --- a/packages/babel-parser/test/fixtures/flow/type-grouping/3/output.json +++ b/packages/babel-parser/test/fixtures/flow/type-grouping/3/output.json @@ -1,167 +1,45 @@ { "type": "File", - "start": 0, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, "program": { "type": "Program", - "start": 0, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":4,"end":31,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":31}}, "id": { "type": "Identifier", - "start": 4, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 31 - }, - "identifierName": "a" - }, + "start":4,"end":31,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":31},"identifierName":"a"}, "name": "a", "typeAnnotation": { "type": "TypeAnnotation", - "start": 5, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":5,"end":31,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":31}}, "typeAnnotation": { "type": "IntersectionTypeAnnotation", - "start": 7, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":7,"end":31,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":31}}, "types": [ { "type": "NumberTypeAnnotation", - "start": 7, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 13 - } - } + "start":7,"end":13,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":13}} }, { "type": "UnionTypeAnnotation", - "start": 17, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":17,"end":30,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":30}}, "types": [ { "type": "StringTypeAnnotation", - "start": 17, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 23 - } - } + "start":17,"end":23,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":23}} }, { "type": "BooleanTypeAnnotation", - "start": 26, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 30 - } - } + "start":26,"end":30,"loc":{"start":{"line":1,"column":26},"end":{"line":1,"column":30}} } ] } diff --git a/packages/babel-parser/test/fixtures/flow/type-grouping/4/output.json b/packages/babel-parser/test/fixtures/flow/type-grouping/4/output.json index 212024410120..c286ce7a9b01 100644 --- a/packages/babel-parser/test/fixtures/flow/type-grouping/4/output.json +++ b/packages/babel-parser/test/fixtures/flow/type-grouping/4/output.json @@ -1,137 +1,36 @@ { "type": "File", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "program": { "type": "Program", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":4,"end":17,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":17}}, "id": { "type": "Identifier", - "start": 4, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 17 - }, - "identifierName": "a" - }, + "start":4,"end":17,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":17},"identifierName":"a"}, "name": "a", "typeAnnotation": { "type": "TypeAnnotation", - "start": 5, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":5,"end":17,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":17}}, "typeAnnotation": { "type": "TypeofTypeAnnotation", - "start": 8, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":8,"end":16,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":16}}, "argument": { "type": "GenericTypeAnnotation", - "start": 15, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":15,"end":16,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":16}}, "typeParameters": null, "id": { "type": "Identifier", - "start": 15, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - }, - "identifierName": "A" - }, + "start":15,"end":16,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":16},"identifierName":"A"}, "name": "A" } } diff --git a/packages/babel-parser/test/fixtures/flow/type-imports/import-type-2/output.json b/packages/babel-parser/test/fixtures/flow/type-imports/import-type-2/output.json index f5fc078a42ce..2406bba2f4f2 100644 --- a/packages/babel-parser/test/fixtures/flow/type-imports/import-type-2/output.json +++ b/packages/babel-parser/test/fixtures/flow/type-imports/import-type-2/output.json @@ -1,128 +1,37 @@ { "type": "File", - "start": 0, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, "program": { "type": "Program", - "start": 0, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ImportDeclaration", - "start": 0, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, "specifiers": [ { "type": "ImportDefaultSpecifier", - "start": 7, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":7,"end":11,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":11}}, "local": { "type": "Identifier", - "start": 7, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "type" - }, + "start":7,"end":11,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":11},"identifierName":"type"}, "name": "type" } }, { "type": "ImportSpecifier", - "start": 15, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":15,"end":18,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":18}}, "imported": { "type": "Identifier", - "start": 15, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 18 - }, - "identifierName": "foo" - }, + "start":15,"end":18,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":18},"identifierName":"foo"}, "name": "foo" }, "importKind": null, "local": { "type": "Identifier", - "start": 15, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 18 - }, - "identifierName": "foo" - }, + "start":15,"end":18,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":18},"identifierName":"foo"}, "name": "foo" } } @@ -130,18 +39,7 @@ "importKind": "value", "source": { "type": "StringLiteral", - "start": 26, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":26,"end":31,"loc":{"start":{"line":1,"column":26},"end":{"line":1,"column":31}}, "extra": { "rawValue": "bar", "raw": "\"bar\"" diff --git a/packages/babel-parser/test/fixtures/flow/type-imports/import-type-shorthand/output.json b/packages/babel-parser/test/fixtures/flow/type-imports/import-type-shorthand/output.json index aeb7eded0711..437eac470802 100644 --- a/packages/babel-parser/test/fixtures/flow/type-imports/import-type-shorthand/output.json +++ b/packages/babel-parser/test/fixtures/flow/type-imports/import-type-shorthand/output.json @@ -1,96 +1,28 @@ { "type": "File", - "start": 0, - "end": 320, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 11, - "column": 35 - } - }, + "start":0,"end":320,"loc":{"start":{"line":1,"column":0},"end":{"line":11,"column":35}}, "program": { "type": "Program", - "start": 0, - "end": 320, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 11, - "column": 35 - } - }, + "start":0,"end":320,"loc":{"start":{"line":1,"column":0},"end":{"line":11,"column":35}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ImportDeclaration", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, "specifiers": [ { "type": "ImportSpecifier", - "start": 8, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":8,"end":12,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":12}}, "imported": { "type": "Identifier", - "start": 8, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "type" - }, + "start":8,"end":12,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":12},"identifierName":"type"}, "name": "type" }, "importKind": null, "local": { "type": "Identifier", - "start": 8, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "type" - }, + "start":8,"end":12,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":12},"identifierName":"type"}, "name": "type" } } @@ -98,18 +30,7 @@ "importKind": "value", "source": { "type": "StringLiteral", - "start": 19, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":19,"end":24,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":24}}, "extra": { "rawValue": "foo", "raw": "\"foo\"" @@ -119,66 +40,20 @@ }, { "type": "ImportDeclaration", - "start": 26, - "end": 53, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 27 - } - }, + "start":26,"end":53,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":27}}, "specifiers": [ { "type": "ImportSpecifier", - "start": 34, - "end": 40, - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 14 - } - }, + "start":34,"end":40,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":14}}, "imported": { "type": "Identifier", - "start": 39, - "end": 40, - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 14 - }, - "identifierName": "t" - }, + "start":39,"end":40,"loc":{"start":{"line":2,"column":13},"end":{"line":2,"column":14},"identifierName":"t"}, "name": "t" }, "importKind": "type", "local": { "type": "Identifier", - "start": 39, - "end": 40, - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 14 - }, - "identifierName": "t" - }, + "start":39,"end":40,"loc":{"start":{"line":2,"column":13},"end":{"line":2,"column":14},"identifierName":"t"}, "name": "t" } } @@ -186,18 +61,7 @@ "importKind": "value", "source": { "type": "StringLiteral", - "start": 47, - "end": 52, - "loc": { - "start": { - "line": 2, - "column": 21 - }, - "end": { - "line": 2, - "column": 26 - } - }, + "start":47,"end":52,"loc":{"start":{"line":2,"column":21},"end":{"line":2,"column":26}}, "extra": { "rawValue": "foo", "raw": "\"foo\"" @@ -207,66 +71,20 @@ }, { "type": "ImportDeclaration", - "start": 54, - "end": 82, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 28 - } - }, + "start":54,"end":82,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":28}}, "specifiers": [ { "type": "ImportSpecifier", - "start": 62, - "end": 69, - "loc": { - "start": { - "line": 3, - "column": 8 - }, - "end": { - "line": 3, - "column": 15 - } - }, + "start":62,"end":69,"loc":{"start":{"line":3,"column":8},"end":{"line":3,"column":15}}, "imported": { "type": "Identifier", - "start": 67, - "end": 69, - "loc": { - "start": { - "line": 3, - "column": 13 - }, - "end": { - "line": 3, - "column": 15 - }, - "identifierName": "as" - }, + "start":67,"end":69,"loc":{"start":{"line":3,"column":13},"end":{"line":3,"column":15},"identifierName":"as"}, "name": "as" }, "importKind": "type", "local": { "type": "Identifier", - "start": 67, - "end": 69, - "loc": { - "start": { - "line": 3, - "column": 13 - }, - "end": { - "line": 3, - "column": 15 - }, - "identifierName": "as" - }, + "start":67,"end":69,"loc":{"start":{"line":3,"column":13},"end":{"line":3,"column":15},"identifierName":"as"}, "name": "as" } } @@ -274,18 +92,7 @@ "importKind": "value", "source": { "type": "StringLiteral", - "start": 76, - "end": 81, - "loc": { - "start": { - "line": 3, - "column": 22 - }, - "end": { - "line": 3, - "column": 27 - } - }, + "start":76,"end":81,"loc":{"start":{"line":3,"column":22},"end":{"line":3,"column":27}}, "extra": { "rawValue": "foo", "raw": "\"foo\"" @@ -295,66 +102,20 @@ }, { "type": "ImportDeclaration", - "start": 83, - "end": 118, - "loc": { - "start": { - "line": 4, - "column": 0 - }, - "end": { - "line": 4, - "column": 35 - } - }, + "start":83,"end":118,"loc":{"start":{"line":4,"column":0},"end":{"line":4,"column":35}}, "specifiers": [ { "type": "ImportSpecifier", - "start": 91, - "end": 105, - "loc": { - "start": { - "line": 4, - "column": 8 - }, - "end": { - "line": 4, - "column": 22 - } - }, + "start":91,"end":105,"loc":{"start":{"line":4,"column":8},"end":{"line":4,"column":22}}, "imported": { "type": "Identifier", - "start": 96, - "end": 98, - "loc": { - "start": { - "line": 4, - "column": 13 - }, - "end": { - "line": 4, - "column": 15 - }, - "identifierName": "as" - }, + "start":96,"end":98,"loc":{"start":{"line":4,"column":13},"end":{"line":4,"column":15},"identifierName":"as"}, "name": "as" }, "importKind": "type", "local": { "type": "Identifier", - "start": 102, - "end": 105, - "loc": { - "start": { - "line": 4, - "column": 19 - }, - "end": { - "line": 4, - "column": 22 - }, - "identifierName": "foo" - }, + "start":102,"end":105,"loc":{"start":{"line":4,"column":19},"end":{"line":4,"column":22},"identifierName":"foo"}, "name": "foo" } } @@ -362,18 +123,7 @@ "importKind": "value", "source": { "type": "StringLiteral", - "start": 112, - "end": 117, - "loc": { - "start": { - "line": 4, - "column": 29 - }, - "end": { - "line": 4, - "column": 34 - } - }, + "start":112,"end":117,"loc":{"start":{"line":4,"column":29},"end":{"line":4,"column":34}}, "extra": { "rawValue": "foo", "raw": "\"foo\"" @@ -383,66 +133,20 @@ }, { "type": "ImportDeclaration", - "start": 119, - "end": 151, - "loc": { - "start": { - "line": 5, - "column": 0 - }, - "end": { - "line": 5, - "column": 32 - } - }, + "start":119,"end":151,"loc":{"start":{"line":5,"column":0},"end":{"line":5,"column":32}}, "specifiers": [ { "type": "ImportSpecifier", - "start": 127, - "end": 138, - "loc": { - "start": { - "line": 5, - "column": 8 - }, - "end": { - "line": 5, - "column": 19 - } - }, + "start":127,"end":138,"loc":{"start":{"line":5,"column":8},"end":{"line":5,"column":19}}, "imported": { "type": "Identifier", - "start": 132, - "end": 133, - "loc": { - "start": { - "line": 5, - "column": 13 - }, - "end": { - "line": 5, - "column": 14 - }, - "identifierName": "t" - }, + "start":132,"end":133,"loc":{"start":{"line":5,"column":13},"end":{"line":5,"column":14},"identifierName":"t"}, "name": "t" }, "importKind": "type", "local": { "type": "Identifier", - "start": 137, - "end": 138, - "loc": { - "start": { - "line": 5, - "column": 18 - }, - "end": { - "line": 5, - "column": 19 - }, - "identifierName": "u" - }, + "start":137,"end":138,"loc":{"start":{"line":5,"column":18},"end":{"line":5,"column":19},"identifierName":"u"}, "name": "u" } } @@ -450,18 +154,7 @@ "importKind": "value", "source": { "type": "StringLiteral", - "start": 145, - "end": 150, - "loc": { - "start": { - "line": 5, - "column": 26 - }, - "end": { - "line": 5, - "column": 31 - } - }, + "start":145,"end":150,"loc":{"start":{"line":5,"column":26},"end":{"line":5,"column":31}}, "extra": { "rawValue": "foo", "raw": "\"foo\"" @@ -471,66 +164,20 @@ }, { "type": "ImportDeclaration", - "start": 152, - "end": 184, - "loc": { - "start": { - "line": 6, - "column": 0 - }, - "end": { - "line": 6, - "column": 32 - } - }, + "start":152,"end":184,"loc":{"start":{"line":6,"column":0},"end":{"line":6,"column":32}}, "specifiers": [ { "type": "ImportSpecifier", - "start": 160, - "end": 171, - "loc": { - "start": { - "line": 6, - "column": 8 - }, - "end": { - "line": 6, - "column": 19 - } - }, + "start":160,"end":171,"loc":{"start":{"line":6,"column":8},"end":{"line":6,"column":19}}, "imported": { "type": "Identifier", - "start": 165, - "end": 171, - "loc": { - "start": { - "line": 6, - "column": 13 - }, - "end": { - "line": 6, - "column": 19 - }, - "identifierName": "switch" - }, + "start":165,"end":171,"loc":{"start":{"line":6,"column":13},"end":{"line":6,"column":19},"identifierName":"switch"}, "name": "switch" }, "importKind": "type", "local": { "type": "Identifier", - "start": 165, - "end": 171, - "loc": { - "start": { - "line": 6, - "column": 13 - }, - "end": { - "line": 6, - "column": 19 - }, - "identifierName": "switch" - }, + "start":165,"end":171,"loc":{"start":{"line":6,"column":13},"end":{"line":6,"column":19},"identifierName":"switch"}, "name": "switch" } } @@ -538,18 +185,7 @@ "importKind": "value", "source": { "type": "StringLiteral", - "start": 178, - "end": 183, - "loc": { - "start": { - "line": 6, - "column": 26 - }, - "end": { - "line": 6, - "column": 31 - } - }, + "start":178,"end":183,"loc":{"start":{"line":6,"column":26},"end":{"line":6,"column":31}}, "extra": { "rawValue": "foo", "raw": "\"foo\"" @@ -559,66 +195,20 @@ }, { "type": "ImportDeclaration", - "start": 186, - "end": 216, - "loc": { - "start": { - "line": 8, - "column": 0 - }, - "end": { - "line": 8, - "column": 30 - } - }, + "start":186,"end":216,"loc":{"start":{"line":8,"column":0},"end":{"line":8,"column":30}}, "specifiers": [ { "type": "ImportSpecifier", - "start": 194, - "end": 203, - "loc": { - "start": { - "line": 8, - "column": 8 - }, - "end": { - "line": 8, - "column": 17 - } - }, + "start":194,"end":203,"loc":{"start":{"line":8,"column":8},"end":{"line":8,"column":17}}, "imported": { "type": "Identifier", - "start": 201, - "end": 203, - "loc": { - "start": { - "line": 8, - "column": 15 - }, - "end": { - "line": 8, - "column": 17 - }, - "identifierName": "t2" - }, + "start":201,"end":203,"loc":{"start":{"line":8,"column":15},"end":{"line":8,"column":17},"identifierName":"t2"}, "name": "t2" }, "importKind": "typeof", "local": { "type": "Identifier", - "start": 201, - "end": 203, - "loc": { - "start": { - "line": 8, - "column": 15 - }, - "end": { - "line": 8, - "column": 17 - }, - "identifierName": "t2" - }, + "start":201,"end":203,"loc":{"start":{"line":8,"column":15},"end":{"line":8,"column":17},"identifierName":"t2"}, "name": "t2" } } @@ -626,18 +216,7 @@ "importKind": "value", "source": { "type": "StringLiteral", - "start": 210, - "end": 215, - "loc": { - "start": { - "line": 8, - "column": 24 - }, - "end": { - "line": 8, - "column": 29 - } - }, + "start":210,"end":215,"loc":{"start":{"line":8,"column":24},"end":{"line":8,"column":29}}, "extra": { "rawValue": "foo", "raw": "\"foo\"" @@ -647,66 +226,20 @@ }, { "type": "ImportDeclaration", - "start": 217, - "end": 248, - "loc": { - "start": { - "line": 9, - "column": 0 - }, - "end": { - "line": 9, - "column": 31 - } - }, + "start":217,"end":248,"loc":{"start":{"line":9,"column":0},"end":{"line":9,"column":31}}, "specifiers": [ { "type": "ImportSpecifier", - "start": 225, - "end": 235, - "loc": { - "start": { - "line": 9, - "column": 8 - }, - "end": { - "line": 9, - "column": 18 - } - }, + "start":225,"end":235,"loc":{"start":{"line":9,"column":8},"end":{"line":9,"column":18}}, "imported": { "type": "Identifier", - "start": 232, - "end": 235, - "loc": { - "start": { - "line": 9, - "column": 15 - }, - "end": { - "line": 9, - "column": 18 - }, - "identifierName": "as2" - }, + "start":232,"end":235,"loc":{"start":{"line":9,"column":15},"end":{"line":9,"column":18},"identifierName":"as2"}, "name": "as2" }, "importKind": "typeof", "local": { "type": "Identifier", - "start": 232, - "end": 235, - "loc": { - "start": { - "line": 9, - "column": 15 - }, - "end": { - "line": 9, - "column": 18 - }, - "identifierName": "as2" - }, + "start":232,"end":235,"loc":{"start":{"line":9,"column":15},"end":{"line":9,"column":18},"identifierName":"as2"}, "name": "as2" } } @@ -714,18 +247,7 @@ "importKind": "value", "source": { "type": "StringLiteral", - "start": 242, - "end": 247, - "loc": { - "start": { - "line": 9, - "column": 25 - }, - "end": { - "line": 9, - "column": 30 - } - }, + "start":242,"end":247,"loc":{"start":{"line":9,"column":25},"end":{"line":9,"column":30}}, "extra": { "rawValue": "foo", "raw": "\"foo\"" @@ -735,66 +257,20 @@ }, { "type": "ImportDeclaration", - "start": 249, - "end": 284, - "loc": { - "start": { - "line": 10, - "column": 0 - }, - "end": { - "line": 10, - "column": 35 - } - }, + "start":249,"end":284,"loc":{"start":{"line":10,"column":0},"end":{"line":10,"column":35}}, "specifiers": [ { "type": "ImportSpecifier", - "start": 257, - "end": 271, - "loc": { - "start": { - "line": 10, - "column": 8 - }, - "end": { - "line": 10, - "column": 22 - } - }, + "start":257,"end":271,"loc":{"start":{"line":10,"column":8},"end":{"line":10,"column":22}}, "imported": { "type": "Identifier", - "start": 264, - "end": 265, - "loc": { - "start": { - "line": 10, - "column": 15 - }, - "end": { - "line": 10, - "column": 16 - }, - "identifierName": "t" - }, + "start":264,"end":265,"loc":{"start":{"line":10,"column":15},"end":{"line":10,"column":16},"identifierName":"t"}, "name": "t" }, "importKind": "typeof", "local": { "type": "Identifier", - "start": 269, - "end": 271, - "loc": { - "start": { - "line": 10, - "column": 20 - }, - "end": { - "line": 10, - "column": 22 - }, - "identifierName": "u2" - }, + "start":269,"end":271,"loc":{"start":{"line":10,"column":20},"end":{"line":10,"column":22},"identifierName":"u2"}, "name": "u2" } } @@ -802,18 +278,7 @@ "importKind": "value", "source": { "type": "StringLiteral", - "start": 278, - "end": 283, - "loc": { - "start": { - "line": 10, - "column": 29 - }, - "end": { - "line": 10, - "column": 34 - } - }, + "start":278,"end":283,"loc":{"start":{"line":10,"column":29},"end":{"line":10,"column":34}}, "extra": { "rawValue": "foo", "raw": "\"foo\"" @@ -823,66 +288,20 @@ }, { "type": "ImportDeclaration", - "start": 285, - "end": 320, - "loc": { - "start": { - "line": 11, - "column": 0 - }, - "end": { - "line": 11, - "column": 35 - } - }, + "start":285,"end":320,"loc":{"start":{"line":11,"column":0},"end":{"line":11,"column":35}}, "specifiers": [ { "type": "ImportSpecifier", - "start": 293, - "end": 307, - "loc": { - "start": { - "line": 11, - "column": 8 - }, - "end": { - "line": 11, - "column": 22 - } - }, + "start":293,"end":307,"loc":{"start":{"line":11,"column":8},"end":{"line":11,"column":22}}, "imported": { "type": "Identifier", - "start": 300, - "end": 307, - "loc": { - "start": { - "line": 11, - "column": 15 - }, - "end": { - "line": 11, - "column": 22 - }, - "identifierName": "switch2" - }, + "start":300,"end":307,"loc":{"start":{"line":11,"column":15},"end":{"line":11,"column":22},"identifierName":"switch2"}, "name": "switch2" }, "importKind": "typeof", "local": { "type": "Identifier", - "start": 300, - "end": 307, - "loc": { - "start": { - "line": 11, - "column": 15 - }, - "end": { - "line": 11, - "column": 22 - }, - "identifierName": "switch2" - }, + "start":300,"end":307,"loc":{"start":{"line":11,"column":15},"end":{"line":11,"column":22},"identifierName":"switch2"}, "name": "switch2" } } @@ -890,18 +309,7 @@ "importKind": "value", "source": { "type": "StringLiteral", - "start": 314, - "end": 319, - "loc": { - "start": { - "line": 11, - "column": 29 - }, - "end": { - "line": 11, - "column": 34 - } - }, + "start":314,"end":319,"loc":{"start":{"line":11,"column":29},"end":{"line":11,"column":34}}, "extra": { "rawValue": "foo", "raw": "\"foo\"" diff --git a/packages/babel-parser/test/fixtures/flow/type-imports/import-type/output.json b/packages/babel-parser/test/fixtures/flow/type-imports/import-type/output.json index 8e626c8ad0a5..fcc0c31ed6dd 100644 --- a/packages/babel-parser/test/fixtures/flow/type-imports/import-type/output.json +++ b/packages/babel-parser/test/fixtures/flow/type-imports/import-type/output.json @@ -1,78 +1,22 @@ { "type": "File", - "start": 0, - "end": 450, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 13, - "column": 38 - } - }, + "start":0,"end":450,"loc":{"start":{"line":1,"column":0},"end":{"line":13,"column":38}}, "program": { "type": "Program", - "start": 0, - "end": 450, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 13, - "column": 38 - } - }, + "start":0,"end":450,"loc":{"start":{"line":1,"column":0},"end":{"line":13,"column":38}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ImportDeclaration", - "start": 0, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, "specifiers": [ { "type": "ImportDefaultSpecifier", - "start": 12, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":12,"end":16,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":16}}, "local": { "type": "Identifier", - "start": 12, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 16 - }, - "identifierName": "Def1" - }, + "start":12,"end":16,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":16},"identifierName":"Def1"}, "name": "Def1" } } @@ -80,18 +24,7 @@ "importKind": "type", "source": { "type": "StringLiteral", - "start": 22, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":22,"end":27,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":27}}, "extra": { "rawValue": "foo", "raw": "\"foo\"" @@ -101,66 +34,20 @@ }, { "type": "ImportDeclaration", - "start": 29, - "end": 61, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 32 - } - }, + "start":29,"end":61,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":32}}, "specifiers": [ { "type": "ImportSpecifier", - "start": 42, - "end": 48, - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 19 - } - }, + "start":42,"end":48,"loc":{"start":{"line":2,"column":13},"end":{"line":2,"column":19}}, "imported": { "type": "Identifier", - "start": 42, - "end": 48, - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 19 - }, - "identifierName": "named1" - }, + "start":42,"end":48,"loc":{"start":{"line":2,"column":13},"end":{"line":2,"column":19},"identifierName":"named1"}, "name": "named1" }, "importKind": null, "local": { "type": "Identifier", - "start": 42, - "end": 48, - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 19 - }, - "identifierName": "named1" - }, + "start":42,"end":48,"loc":{"start":{"line":2,"column":13},"end":{"line":2,"column":19},"identifierName":"named1"}, "name": "named1" } } @@ -168,18 +55,7 @@ "importKind": "type", "source": { "type": "StringLiteral", - "start": 55, - "end": 60, - "loc": { - "start": { - "line": 2, - "column": 26 - }, - "end": { - "line": 2, - "column": 31 - } - }, + "start":55,"end":60,"loc":{"start":{"line":2,"column":26},"end":{"line":2,"column":31}}, "extra": { "rawValue": "foo", "raw": "\"foo\"" @@ -189,98 +65,29 @@ }, { "type": "ImportDeclaration", - "start": 62, - "end": 100, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 38 - } - }, + "start":62,"end":100,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":38}}, "specifiers": [ { "type": "ImportDefaultSpecifier", - "start": 74, - "end": 78, - "loc": { - "start": { - "line": 3, - "column": 12 - }, - "end": { - "line": 3, - "column": 16 - } - }, + "start":74,"end":78,"loc":{"start":{"line":3,"column":12},"end":{"line":3,"column":16}}, "local": { "type": "Identifier", - "start": 74, - "end": 78, - "loc": { - "start": { - "line": 3, - "column": 12 - }, - "end": { - "line": 3, - "column": 16 - }, - "identifierName": "Def2" - }, + "start":74,"end":78,"loc":{"start":{"line":3,"column":12},"end":{"line":3,"column":16},"identifierName":"Def2"}, "name": "Def2" } }, { "type": "ImportSpecifier", - "start": 81, - "end": 87, - "loc": { - "start": { - "line": 3, - "column": 19 - }, - "end": { - "line": 3, - "column": 25 - } - }, + "start":81,"end":87,"loc":{"start":{"line":3,"column":19},"end":{"line":3,"column":25}}, "imported": { "type": "Identifier", - "start": 81, - "end": 87, - "loc": { - "start": { - "line": 3, - "column": 19 - }, - "end": { - "line": 3, - "column": 25 - }, - "identifierName": "named2" - }, + "start":81,"end":87,"loc":{"start":{"line":3,"column":19},"end":{"line":3,"column":25},"identifierName":"named2"}, "name": "named2" }, "importKind": null, "local": { "type": "Identifier", - "start": 81, - "end": 87, - "loc": { - "start": { - "line": 3, - "column": 19 - }, - "end": { - "line": 3, - "column": 25 - }, - "identifierName": "named2" - }, + "start":81,"end":87,"loc":{"start":{"line":3,"column":19},"end":{"line":3,"column":25},"identifierName":"named2"}, "name": "named2" } } @@ -288,18 +95,7 @@ "importKind": "type", "source": { "type": "StringLiteral", - "start": 94, - "end": 99, - "loc": { - "start": { - "line": 3, - "column": 32 - }, - "end": { - "line": 3, - "column": 37 - } - }, + "start":94,"end":99,"loc":{"start":{"line":3,"column":32},"end":{"line":3,"column":37}}, "extra": { "rawValue": "foo", "raw": "\"foo\"" @@ -309,48 +105,14 @@ }, { "type": "ImportDeclaration", - "start": 101, - "end": 132, - "loc": { - "start": { - "line": 4, - "column": 0 - }, - "end": { - "line": 4, - "column": 31 - } - }, + "start":101,"end":132,"loc":{"start":{"line":4,"column":0},"end":{"line":4,"column":31}}, "specifiers": [ { "type": "ImportDefaultSpecifier", - "start": 113, - "end": 120, - "loc": { - "start": { - "line": 4, - "column": 12 - }, - "end": { - "line": 4, - "column": 19 - } - }, + "start":113,"end":120,"loc":{"start":{"line":4,"column":12},"end":{"line":4,"column":19}}, "local": { "type": "Identifier", - "start": 113, - "end": 120, - "loc": { - "start": { - "line": 4, - "column": 12 - }, - "end": { - "line": 4, - "column": 19 - }, - "identifierName": "switch1" - }, + "start":113,"end":120,"loc":{"start":{"line":4,"column":12},"end":{"line":4,"column":19},"identifierName":"switch1"}, "name": "switch1" } } @@ -358,18 +120,7 @@ "importKind": "type", "source": { "type": "StringLiteral", - "start": 126, - "end": 131, - "loc": { - "start": { - "line": 4, - "column": 25 - }, - "end": { - "line": 4, - "column": 30 - } - }, + "start":126,"end":131,"loc":{"start":{"line":4,"column":25},"end":{"line":4,"column":30}}, "extra": { "rawValue": "foo", "raw": "\"foo\"" @@ -379,66 +130,20 @@ }, { "type": "ImportDeclaration", - "start": 133, - "end": 168, - "loc": { - "start": { - "line": 5, - "column": 0 - }, - "end": { - "line": 5, - "column": 35 - } - }, + "start":133,"end":168,"loc":{"start":{"line":5,"column":0},"end":{"line":5,"column":35}}, "specifiers": [ { "type": "ImportSpecifier", - "start": 147, - "end": 154, - "loc": { - "start": { - "line": 5, - "column": 14 - }, - "end": { - "line": 5, - "column": 21 - } - }, + "start":147,"end":154,"loc":{"start":{"line":5,"column":14},"end":{"line":5,"column":21}}, "imported": { "type": "Identifier", - "start": 147, - "end": 154, - "loc": { - "start": { - "line": 5, - "column": 14 - }, - "end": { - "line": 5, - "column": 21 - }, - "identifierName": "switch2" - }, + "start":147,"end":154,"loc":{"start":{"line":5,"column":14},"end":{"line":5,"column":21},"identifierName":"switch2"}, "name": "switch2" }, "importKind": null, "local": { "type": "Identifier", - "start": 147, - "end": 154, - "loc": { - "start": { - "line": 5, - "column": 14 - }, - "end": { - "line": 5, - "column": 21 - }, - "identifierName": "switch2" - }, + "start":147,"end":154,"loc":{"start":{"line":5,"column":14},"end":{"line":5,"column":21},"identifierName":"switch2"}, "name": "switch2" } } @@ -446,18 +151,7 @@ "importKind": "type", "source": { "type": "StringLiteral", - "start": 162, - "end": 167, - "loc": { - "start": { - "line": 5, - "column": 29 - }, - "end": { - "line": 5, - "column": 34 - } - }, + "start":162,"end":167,"loc":{"start":{"line":5,"column":29},"end":{"line":5,"column":34}}, "extra": { "rawValue": "foo", "raw": "\"foo\"" @@ -467,116 +161,35 @@ }, { "type": "ImportDeclaration", - "start": 169, - "end": 207, - "loc": { - "start": { - "line": 6, - "column": 0 - }, - "end": { - "line": 6, - "column": 38 - } - }, + "start":169,"end":207,"loc":{"start":{"line":6,"column":0},"end":{"line":6,"column":38}}, "specifiers": [ { "type": "ImportSpecifier", - "start": 183, - "end": 187, - "loc": { - "start": { - "line": 6, - "column": 14 - }, - "end": { - "line": 6, - "column": 18 - } - }, + "start":183,"end":187,"loc":{"start":{"line":6,"column":14},"end":{"line":6,"column":18}}, "imported": { "type": "Identifier", - "start": 183, - "end": 187, - "loc": { - "start": { - "line": 6, - "column": 14 - }, - "end": { - "line": 6, - "column": 18 - }, - "identifierName": "foo1" - }, + "start":183,"end":187,"loc":{"start":{"line":6,"column":14},"end":{"line":6,"column":18},"identifierName":"foo1"}, "name": "foo1" }, "importKind": null, "local": { "type": "Identifier", - "start": 183, - "end": 187, - "loc": { - "start": { - "line": 6, - "column": 14 - }, - "end": { - "line": 6, - "column": 18 - }, - "identifierName": "foo1" - }, + "start":183,"end":187,"loc":{"start":{"line":6,"column":14},"end":{"line":6,"column":18},"identifierName":"foo1"}, "name": "foo1" } }, { "type": "ImportSpecifier", - "start": 189, - "end": 193, - "loc": { - "start": { - "line": 6, - "column": 20 - }, - "end": { - "line": 6, - "column": 24 - } - }, + "start":189,"end":193,"loc":{"start":{"line":6,"column":20},"end":{"line":6,"column":24}}, "imported": { "type": "Identifier", - "start": 189, - "end": 193, - "loc": { - "start": { - "line": 6, - "column": 20 - }, - "end": { - "line": 6, - "column": 24 - }, - "identifierName": "bar1" - }, + "start":189,"end":193,"loc":{"start":{"line":6,"column":20},"end":{"line":6,"column":24},"identifierName":"bar1"}, "name": "bar1" }, "importKind": null, "local": { "type": "Identifier", - "start": 189, - "end": 193, - "loc": { - "start": { - "line": 6, - "column": 20 - }, - "end": { - "line": 6, - "column": 24 - }, - "identifierName": "bar1" - }, + "start":189,"end":193,"loc":{"start":{"line":6,"column":20},"end":{"line":6,"column":24},"identifierName":"bar1"}, "name": "bar1" } } @@ -584,18 +197,7 @@ "importKind": "type", "source": { "type": "StringLiteral", - "start": 201, - "end": 206, - "loc": { - "start": { - "line": 6, - "column": 32 - }, - "end": { - "line": 6, - "column": 37 - } - }, + "start":201,"end":206,"loc":{"start":{"line":6,"column":32},"end":{"line":6,"column":37}}, "extra": { "rawValue": "baz", "raw": "\"baz\"" @@ -605,48 +207,14 @@ }, { "type": "ImportDeclaration", - "start": 208, - "end": 231, - "loc": { - "start": { - "line": 7, - "column": 0 - }, - "end": { - "line": 7, - "column": 23 - } - }, + "start":208,"end":231,"loc":{"start":{"line":7,"column":0},"end":{"line":7,"column":23}}, "specifiers": [ { "type": "ImportDefaultSpecifier", - "start": 215, - "end": 219, - "loc": { - "start": { - "line": 7, - "column": 7 - }, - "end": { - "line": 7, - "column": 11 - } - }, + "start":215,"end":219,"loc":{"start":{"line":7,"column":7},"end":{"line":7,"column":11}}, "local": { "type": "Identifier", - "start": 215, - "end": 219, - "loc": { - "start": { - "line": 7, - "column": 7 - }, - "end": { - "line": 7, - "column": 11 - }, - "identifierName": "type" - }, + "start":215,"end":219,"loc":{"start":{"line":7,"column":7},"end":{"line":7,"column":11},"identifierName":"type"}, "name": "type" } } @@ -654,18 +222,7 @@ "importKind": "value", "source": { "type": "StringLiteral", - "start": 225, - "end": 230, - "loc": { - "start": { - "line": 7, - "column": 17 - }, - "end": { - "line": 7, - "column": 22 - } - }, + "start":225,"end":230,"loc":{"start":{"line":7,"column":17},"end":{"line":7,"column":22}}, "extra": { "rawValue": "foo", "raw": "\"foo\"" @@ -675,48 +232,14 @@ }, { "type": "ImportDeclaration", - "start": 232, - "end": 262, - "loc": { - "start": { - "line": 8, - "column": 0 - }, - "end": { - "line": 8, - "column": 30 - } - }, + "start":232,"end":262,"loc":{"start":{"line":8,"column":0},"end":{"line":8,"column":30}}, "specifiers": [ { "type": "ImportDefaultSpecifier", - "start": 246, - "end": 250, - "loc": { - "start": { - "line": 8, - "column": 14 - }, - "end": { - "line": 8, - "column": 18 - } - }, + "start":246,"end":250,"loc":{"start":{"line":8,"column":14},"end":{"line":8,"column":18}}, "local": { "type": "Identifier", - "start": 246, - "end": 250, - "loc": { - "start": { - "line": 8, - "column": 14 - }, - "end": { - "line": 8, - "column": 18 - }, - "identifierName": "foo3" - }, + "start":246,"end":250,"loc":{"start":{"line":8,"column":14},"end":{"line":8,"column":18},"identifierName":"foo3"}, "name": "foo3" } } @@ -724,18 +247,7 @@ "importKind": "typeof", "source": { "type": "StringLiteral", - "start": 256, - "end": 261, - "loc": { - "start": { - "line": 8, - "column": 24 - }, - "end": { - "line": 8, - "column": 29 - } - }, + "start":256,"end":261,"loc":{"start":{"line":8,"column":24},"end":{"line":8,"column":29}}, "extra": { "rawValue": "bar", "raw": "\"bar\"" @@ -745,48 +257,14 @@ }, { "type": "ImportDeclaration", - "start": 263, - "end": 296, - "loc": { - "start": { - "line": 9, - "column": 0 - }, - "end": { - "line": 9, - "column": 33 - } - }, + "start":263,"end":296,"loc":{"start":{"line":9,"column":0},"end":{"line":9,"column":33}}, "specifiers": [ { "type": "ImportDefaultSpecifier", - "start": 277, - "end": 284, - "loc": { - "start": { - "line": 9, - "column": 14 - }, - "end": { - "line": 9, - "column": 21 - } - }, + "start":277,"end":284,"loc":{"start":{"line":9,"column":14},"end":{"line":9,"column":21}}, "local": { "type": "Identifier", - "start": 277, - "end": 284, - "loc": { - "start": { - "line": 9, - "column": 14 - }, - "end": { - "line": 9, - "column": 21 - }, - "identifierName": "switch4" - }, + "start":277,"end":284,"loc":{"start":{"line":9,"column":14},"end":{"line":9,"column":21},"identifierName":"switch4"}, "name": "switch4" } } @@ -794,18 +272,7 @@ "importKind": "typeof", "source": { "type": "StringLiteral", - "start": 290, - "end": 295, - "loc": { - "start": { - "line": 9, - "column": 27 - }, - "end": { - "line": 9, - "column": 32 - } - }, + "start":290,"end":295,"loc":{"start":{"line":9,"column":27},"end":{"line":9,"column":32}}, "extra": { "rawValue": "foo", "raw": "\"foo\"" @@ -815,66 +282,20 @@ }, { "type": "ImportDeclaration", - "start": 297, - "end": 334, - "loc": { - "start": { - "line": 10, - "column": 0 - }, - "end": { - "line": 10, - "column": 37 - } - }, + "start":297,"end":334,"loc":{"start":{"line":10,"column":0},"end":{"line":10,"column":37}}, "specifiers": [ { "type": "ImportSpecifier", - "start": 313, - "end": 320, - "loc": { - "start": { - "line": 10, - "column": 16 - }, - "end": { - "line": 10, - "column": 23 - } - }, + "start":313,"end":320,"loc":{"start":{"line":10,"column":16},"end":{"line":10,"column":23}}, "imported": { "type": "Identifier", - "start": 313, - "end": 320, - "loc": { - "start": { - "line": 10, - "column": 16 - }, - "end": { - "line": 10, - "column": 23 - }, - "identifierName": "switch5" - }, + "start":313,"end":320,"loc":{"start":{"line":10,"column":16},"end":{"line":10,"column":23},"identifierName":"switch5"}, "name": "switch5" }, "importKind": null, "local": { "type": "Identifier", - "start": 313, - "end": 320, - "loc": { - "start": { - "line": 10, - "column": 16 - }, - "end": { - "line": 10, - "column": 23 - }, - "identifierName": "switch5" - }, + "start":313,"end":320,"loc":{"start":{"line":10,"column":16},"end":{"line":10,"column":23},"identifierName":"switch5"}, "name": "switch5" } } @@ -882,18 +303,7 @@ "importKind": "typeof", "source": { "type": "StringLiteral", - "start": 328, - "end": 333, - "loc": { - "start": { - "line": 10, - "column": 31 - }, - "end": { - "line": 10, - "column": 36 - } - }, + "start":328,"end":333,"loc":{"start":{"line":10,"column":31},"end":{"line":10,"column":36}}, "extra": { "rawValue": "foo", "raw": "\"foo\"" @@ -903,66 +313,20 @@ }, { "type": "ImportDeclaration", - "start": 335, - "end": 376, - "loc": { - "start": { - "line": 11, - "column": 0 - }, - "end": { - "line": 11, - "column": 41 - } - }, + "start":335,"end":376,"loc":{"start":{"line":11,"column":0},"end":{"line":11,"column":41}}, "specifiers": [ { "type": "ImportSpecifier", - "start": 351, - "end": 362, - "loc": { - "start": { - "line": 11, - "column": 16 - }, - "end": { - "line": 11, - "column": 27 - } - }, + "start":351,"end":362,"loc":{"start":{"line":11,"column":16},"end":{"line":11,"column":27}}, "imported": { "type": "Identifier", - "start": 351, - "end": 354, - "loc": { - "start": { - "line": 11, - "column": 16 - }, - "end": { - "line": 11, - "column": 19 - }, - "identifierName": "foo" - }, + "start":351,"end":354,"loc":{"start":{"line":11,"column":16},"end":{"line":11,"column":19},"identifierName":"foo"}, "name": "foo" }, "importKind": null, "local": { "type": "Identifier", - "start": 358, - "end": 362, - "loc": { - "start": { - "line": 11, - "column": 23 - }, - "end": { - "line": 11, - "column": 27 - }, - "identifierName": "bar6" - }, + "start":358,"end":362,"loc":{"start":{"line":11,"column":23},"end":{"line":11,"column":27},"identifierName":"bar6"}, "name": "bar6" } } @@ -970,18 +334,7 @@ "importKind": "typeof", "source": { "type": "StringLiteral", - "start": 370, - "end": 375, - "loc": { - "start": { - "line": 11, - "column": 35 - }, - "end": { - "line": 11, - "column": 40 - } - }, + "start":370,"end":375,"loc":{"start":{"line":11,"column":35},"end":{"line":11,"column":40}}, "extra": { "rawValue": "baz", "raw": "\"baz\"" @@ -991,48 +344,14 @@ }, { "type": "ImportDeclaration", - "start": 377, - "end": 411, - "loc": { - "start": { - "line": 12, - "column": 0 - }, - "end": { - "line": 12, - "column": 34 - } - }, + "start":377,"end":411,"loc":{"start":{"line":12,"column":0},"end":{"line":12,"column":34}}, "specifiers": [ { "type": "ImportNamespaceSpecifier", - "start": 391, - "end": 399, - "loc": { - "start": { - "line": 12, - "column": 14 - }, - "end": { - "line": 12, - "column": 22 - } - }, + "start":391,"end":399,"loc":{"start":{"line":12,"column":14},"end":{"line":12,"column":22}}, "local": { "type": "Identifier", - "start": 396, - "end": 399, - "loc": { - "start": { - "line": 12, - "column": 19 - }, - "end": { - "line": 12, - "column": 22 - }, - "identifierName": "ns7" - }, + "start":396,"end":399,"loc":{"start":{"line":12,"column":19},"end":{"line":12,"column":22},"identifierName":"ns7"}, "name": "ns7" } } @@ -1040,18 +359,7 @@ "importKind": "typeof", "source": { "type": "StringLiteral", - "start": 405, - "end": 410, - "loc": { - "start": { - "line": 12, - "column": 28 - }, - "end": { - "line": 12, - "column": 33 - } - }, + "start":405,"end":410,"loc":{"start":{"line":12,"column":28},"end":{"line":12,"column":33}}, "extra": { "rawValue": "foo", "raw": "\"foo\"" @@ -1061,48 +369,14 @@ }, { "type": "ImportDeclaration", - "start": 412, - "end": 450, - "loc": { - "start": { - "line": 13, - "column": 0 - }, - "end": { - "line": 13, - "column": 38 - } - }, + "start":412,"end":450,"loc":{"start":{"line":13,"column":0},"end":{"line":13,"column":38}}, "specifiers": [ { "type": "ImportNamespaceSpecifier", - "start": 426, - "end": 438, - "loc": { - "start": { - "line": 13, - "column": 14 - }, - "end": { - "line": 13, - "column": 26 - } - }, + "start":426,"end":438,"loc":{"start":{"line":13,"column":14},"end":{"line":13,"column":26}}, "local": { "type": "Identifier", - "start": 431, - "end": 438, - "loc": { - "start": { - "line": 13, - "column": 19 - }, - "end": { - "line": 13, - "column": 26 - }, - "identifierName": "switch8" - }, + "start":431,"end":438,"loc":{"start":{"line":13,"column":19},"end":{"line":13,"column":26},"identifierName":"switch8"}, "name": "switch8" } } @@ -1110,18 +384,7 @@ "importKind": "typeof", "source": { "type": "StringLiteral", - "start": 444, - "end": 449, - "loc": { - "start": { - "line": 13, - "column": 32 - }, - "end": { - "line": 13, - "column": 37 - } - }, + "start":444,"end":449,"loc":{"start":{"line":13,"column":32},"end":{"line":13,"column":37}}, "extra": { "rawValue": "foo", "raw": "\"foo\"" diff --git a/packages/babel-parser/test/fixtures/flow/type-imports/invalid-import-type-2/options.json b/packages/babel-parser/test/fixtures/flow/type-imports/invalid-import-type-2/options.json deleted file mode 100644 index 7624c4d3b99a..000000000000 --- a/packages/babel-parser/test/fixtures/flow/type-imports/invalid-import-type-2/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Cannot overwrite reserved type string (1:14)" -} diff --git a/packages/babel-parser/test/fixtures/flow/type-imports/invalid-import-type-2/output.json b/packages/babel-parser/test/fixtures/flow/type-imports/invalid-import-type-2/output.json new file mode 100644 index 000000000000..cbd99a19951e --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/type-imports/invalid-import-type-2/output.json @@ -0,0 +1,47 @@ +{ + "type": "File", + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, + "errors": [ + "SyntaxError: Cannot overwrite reserved type string (1:14)" + ], + "program": { + "type": "Program", + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ImportDeclaration", + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, + "specifiers": [ + { + "type": "ImportSpecifier", + "start":14,"end":20,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":20}}, + "imported": { + "type": "Identifier", + "start":14,"end":20,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":20},"identifierName":"string"}, + "name": "string" + }, + "importKind": null, + "local": { + "type": "Identifier", + "start":14,"end":20,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":20},"identifierName":"string"}, + "name": "string" + } + } + ], + "importKind": "type", + "source": { + "type": "StringLiteral", + "start":28,"end":33,"loc":{"start":{"line":1,"column":28},"end":{"line":1,"column":33}}, + "extra": { + "rawValue": "foo", + "raw": "\"foo\"" + }, + "value": "foo" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/type-imports/invalid-import-type-3/options.json b/packages/babel-parser/test/fixtures/flow/type-imports/invalid-import-type-3/options.json deleted file mode 100644 index 7624c4d3b99a..000000000000 --- a/packages/babel-parser/test/fixtures/flow/type-imports/invalid-import-type-3/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Cannot overwrite reserved type string (1:14)" -} diff --git a/packages/babel-parser/test/fixtures/flow/type-imports/invalid-import-type-3/output.json b/packages/babel-parser/test/fixtures/flow/type-imports/invalid-import-type-3/output.json new file mode 100644 index 000000000000..1e241ce54643 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/type-imports/invalid-import-type-3/output.json @@ -0,0 +1,41 @@ +{ + "type": "File", + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, + "errors": [ + "SyntaxError: Cannot overwrite reserved type string (1:14)" + ], + "program": { + "type": "Program", + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ImportDeclaration", + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, + "specifiers": [ + { + "type": "ImportDefaultSpecifier", + "start":14,"end":20,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":20}}, + "local": { + "type": "Identifier", + "start":14,"end":20,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":20},"identifierName":"string"}, + "name": "string" + } + } + ], + "importKind": "typeof", + "source": { + "type": "StringLiteral", + "start":26,"end":31,"loc":{"start":{"line":1,"column":26},"end":{"line":1,"column":31}}, + "extra": { + "rawValue": "foo", + "raw": "\"foo\"" + }, + "value": "foo" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/type-imports/invalid-import-type-4/options.json b/packages/babel-parser/test/fixtures/flow/type-imports/invalid-import-type-4/options.json deleted file mode 100644 index d64a5d353bf8..000000000000 --- a/packages/babel-parser/test/fixtures/flow/type-imports/invalid-import-type-4/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Cannot overwrite reserved type string (1:19)" -} diff --git a/packages/babel-parser/test/fixtures/flow/type-imports/invalid-import-type-4/output.json b/packages/babel-parser/test/fixtures/flow/type-imports/invalid-import-type-4/output.json new file mode 100644 index 000000000000..4598f3355fcf --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/type-imports/invalid-import-type-4/output.json @@ -0,0 +1,41 @@ +{ + "type": "File", + "start":0,"end":37,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":37}}, + "errors": [ + "SyntaxError: Cannot overwrite reserved type string (1:19)" + ], + "program": { + "type": "Program", + "start":0,"end":37,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":37}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ImportDeclaration", + "start":0,"end":37,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":37}}, + "specifiers": [ + { + "type": "ImportNamespaceSpecifier", + "start":14,"end":25,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":25}}, + "local": { + "type": "Identifier", + "start":19,"end":25,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":25},"identifierName":"string"}, + "name": "string" + } + } + ], + "importKind": "typeof", + "source": { + "type": "StringLiteral", + "start":31,"end":36,"loc":{"start":{"line":1,"column":31},"end":{"line":1,"column":36}}, + "extra": { + "rawValue": "foo", + "raw": "\"foo\"" + }, + "value": "foo" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/type-imports/invalid-import-type-as/options.json b/packages/babel-parser/test/fixtures/flow/type-imports/invalid-import-type-as/options.json index 5133797973d2..d822c40fbba2 100644 --- a/packages/babel-parser/test/fixtures/flow/type-imports/invalid-import-type-as/options.json +++ b/packages/babel-parser/test/fixtures/flow/type-imports/invalid-import-type-as/options.json @@ -1,3 +1,4 @@ { - "throws": "Unexpected keyword 'debugger' (1:17)" + "sourceType": "module", + "plugins": ["jsx", "flow"] } diff --git a/packages/babel-parser/test/fixtures/flow/type-imports/invalid-import-type-as/output.json b/packages/babel-parser/test/fixtures/flow/type-imports/invalid-import-type-as/output.json new file mode 100644 index 000000000000..20c6c607313f --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/type-imports/invalid-import-type-as/output.json @@ -0,0 +1,47 @@ +{ + "type": "File", + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":39}}, + "errors": [ + "SyntaxError: Unexpected keyword 'debugger' (1:17)" + ], + "program": { + "type": "Program", + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":39}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ImportDeclaration", + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":39}}, + "specifiers": [ + { + "type": "ImportSpecifier", + "start":9,"end":25,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":25}}, + "imported": { + "type": "Identifier", + "start":9,"end":13,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":13},"identifierName":"type"}, + "name": "type" + }, + "importKind": null, + "local": { + "type": "Identifier", + "start":17,"end":25,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":25},"identifierName":"debugger"}, + "name": "debugger" + } + } + ], + "importKind": "value", + "source": { + "type": "StringLiteral", + "start":33,"end":38,"loc":{"start":{"line":1,"column":33},"end":{"line":1,"column":38}}, + "extra": { + "rawValue": "foo", + "raw": "\"foo\"" + }, + "value": "foo" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/type-imports/invalid-import-type-shorthand-2/options.json b/packages/babel-parser/test/fixtures/flow/type-imports/invalid-import-type-shorthand-2/options.json deleted file mode 100644 index 036229c5b95a..000000000000 --- a/packages/babel-parser/test/fixtures/flow/type-imports/invalid-import-type-shorthand-2/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "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 (1:13)" -} diff --git a/packages/babel-parser/test/fixtures/flow/type-imports/invalid-import-type-shorthand-2/output.json b/packages/babel-parser/test/fixtures/flow/type-imports/invalid-import-type-shorthand-2/output.json new file mode 100644 index 000000000000..37af63c0996a --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/type-imports/invalid-import-type-shorthand-2/output.json @@ -0,0 +1,47 @@ +{ + "type": "File", + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, + "errors": [ + "SyntaxError: 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 (1:13)" + ], + "program": { + "type": "Program", + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ImportDeclaration", + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, + "specifiers": [ + { + "type": "ImportSpecifier", + "start":13,"end":19,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":19}}, + "imported": { + "type": "Identifier", + "start":18,"end":19,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":19},"identifierName":"t"}, + "name": "t" + }, + "importKind": "type", + "local": { + "type": "Identifier", + "start":18,"end":19,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":19},"identifierName":"t"}, + "name": "t" + } + } + ], + "importKind": "type", + "source": { + "type": "StringLiteral", + "start":26,"end":31,"loc":{"start":{"line":1,"column":26},"end":{"line":1,"column":31}}, + "extra": { + "rawValue": "foo", + "raw": "\"foo\"" + }, + "value": "foo" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/type-imports/invalid-import-type-shorthand-3/options.json b/packages/babel-parser/test/fixtures/flow/type-imports/invalid-import-type-shorthand-3/options.json deleted file mode 100644 index e425b795f180..000000000000 --- a/packages/babel-parser/test/fixtures/flow/type-imports/invalid-import-type-shorthand-3/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Cannot overwrite reserved type string (1:16)" -} diff --git a/packages/babel-parser/test/fixtures/flow/type-imports/invalid-import-type-shorthand-3/output.json b/packages/babel-parser/test/fixtures/flow/type-imports/invalid-import-type-shorthand-3/output.json new file mode 100644 index 000000000000..56fba75c81f5 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/type-imports/invalid-import-type-shorthand-3/output.json @@ -0,0 +1,47 @@ +{ + "type": "File", + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, + "errors": [ + "SyntaxError: Cannot overwrite reserved type string (1:16)" + ], + "program": { + "type": "Program", + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ImportDeclaration", + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, + "specifiers": [ + { + "type": "ImportSpecifier", + "start":9,"end":22,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":22}}, + "imported": { + "type": "Identifier", + "start":16,"end":22,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":22},"identifierName":"string"}, + "name": "string" + }, + "importKind": "typeof", + "local": { + "type": "Identifier", + "start":16,"end":22,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":22},"identifierName":"string"}, + "name": "string" + } + } + ], + "importKind": "value", + "source": { + "type": "StringLiteral", + "start":30,"end":35,"loc":{"start":{"line":1,"column":30},"end":{"line":1,"column":35}}, + "extra": { + "rawValue": "foo", + "raw": "\"foo\"" + }, + "value": "foo" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/type-imports/invalid-import-type-shorthand-4/options.json b/packages/babel-parser/test/fixtures/flow/type-imports/invalid-import-type-shorthand-4/options.json deleted file mode 100644 index 7624c4d3b99a..000000000000 --- a/packages/babel-parser/test/fixtures/flow/type-imports/invalid-import-type-shorthand-4/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Cannot overwrite reserved type string (1:14)" -} diff --git a/packages/babel-parser/test/fixtures/flow/type-imports/invalid-import-type-shorthand-4/output.json b/packages/babel-parser/test/fixtures/flow/type-imports/invalid-import-type-shorthand-4/output.json new file mode 100644 index 000000000000..ff46538a95f6 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/type-imports/invalid-import-type-shorthand-4/output.json @@ -0,0 +1,47 @@ +{ + "type": "File", + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, + "errors": [ + "SyntaxError: Cannot overwrite reserved type string (1:14)" + ], + "program": { + "type": "Program", + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ImportDeclaration", + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, + "specifiers": [ + { + "type": "ImportSpecifier", + "start":9,"end":20,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":20}}, + "imported": { + "type": "Identifier", + "start":14,"end":20,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":20},"identifierName":"string"}, + "name": "string" + }, + "importKind": "type", + "local": { + "type": "Identifier", + "start":14,"end":20,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":20},"identifierName":"string"}, + "name": "string" + } + } + ], + "importKind": "value", + "source": { + "type": "StringLiteral", + "start":28,"end":33,"loc":{"start":{"line":1,"column":28},"end":{"line":1,"column":33}}, + "extra": { + "rawValue": "foo", + "raw": "\"foo\"" + }, + "value": "foo" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/type-imports/invalid-import-type-shorthand/options.json b/packages/babel-parser/test/fixtures/flow/type-imports/invalid-import-type-shorthand/options.json deleted file mode 100644 index 7aa4274c7160..000000000000 --- a/packages/babel-parser/test/fixtures/flow/type-imports/invalid-import-type-shorthand/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "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 (1:15)" -} diff --git a/packages/babel-parser/test/fixtures/flow/type-imports/invalid-import-type-shorthand/output.json b/packages/babel-parser/test/fixtures/flow/type-imports/invalid-import-type-shorthand/output.json new file mode 100644 index 000000000000..8d2dd58fa474 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/type-imports/invalid-import-type-shorthand/output.json @@ -0,0 +1,47 @@ +{ + "type": "File", + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, + "errors": [ + "SyntaxError: 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 (1:15)" + ], + "program": { + "type": "Program", + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ImportDeclaration", + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, + "specifiers": [ + { + "type": "ImportSpecifier", + "start":15,"end":23,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":23}}, + "imported": { + "type": "Identifier", + "start":22,"end":23,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":23},"identifierName":"t"}, + "name": "t" + }, + "importKind": "typeof", + "local": { + "type": "Identifier", + "start":22,"end":23,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":23},"identifierName":"t"}, + "name": "t" + } + } + ], + "importKind": "typeof", + "source": { + "type": "StringLiteral", + "start":30,"end":35,"loc":{"start":{"line":1,"column":30},"end":{"line":1,"column":35}}, + "extra": { + "rawValue": "foo", + "raw": "\"foo\"" + }, + "value": "foo" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/type-imports/invalid-import-type/options.json b/packages/babel-parser/test/fixtures/flow/type-imports/invalid-import-type/options.json deleted file mode 100644 index 0c2cdd4d777c..000000000000 --- a/packages/babel-parser/test/fixtures/flow/type-imports/invalid-import-type/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Cannot overwrite reserved type string (1:12)" -} diff --git a/packages/babel-parser/test/fixtures/flow/type-imports/invalid-import-type/output.json b/packages/babel-parser/test/fixtures/flow/type-imports/invalid-import-type/output.json new file mode 100644 index 000000000000..78cb69bb8dea --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/type-imports/invalid-import-type/output.json @@ -0,0 +1,41 @@ +{ + "type": "File", + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, + "errors": [ + "SyntaxError: Cannot overwrite reserved type string (1:12)" + ], + "program": { + "type": "Program", + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ImportDeclaration", + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, + "specifiers": [ + { + "type": "ImportDefaultSpecifier", + "start":12,"end":18,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":18}}, + "local": { + "type": "Identifier", + "start":12,"end":18,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":18},"identifierName":"string"}, + "name": "string" + } + } + ], + "importKind": "type", + "source": { + "type": "StringLiteral", + "start":24,"end":29,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":29}}, + "extra": { + "rawValue": "foo", + "raw": "\"foo\"" + }, + "value": "foo" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/type-parameter-declaration/arrow_with_jsx/output.json b/packages/babel-parser/test/fixtures/flow/type-parameter-declaration/arrow_with_jsx/output.json index c4508202637c..5d46fe17f39c 100644 --- a/packages/babel-parser/test/fixtures/flow/type-parameter-declaration/arrow_with_jsx/output.json +++ b/packages/babel-parser/test/fixtures/flow/type-parameter-declaration/arrow_with_jsx/output.json @@ -1,80 +1,25 @@ { "type": "File", - "start": 0, - "end": 78, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 26 - } - }, + "start":0,"end":78,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":26}}, "program": { "type": "Program", - "start": 0, - "end": 78, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 26 - } - }, + "start":0,"end":78,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":26}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "expression": { "type": "ArrowFunctionExpression", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, "id": null, "generator": false, "async": false, "params": [], "body": { "type": "NumericLiteral", - "start": 9, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":9,"end":12,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":12}}, "extra": { "rawValue": 123, "raw": "123" @@ -83,33 +28,11 @@ }, "typeParameters": { "type": "TypeParameterDeclaration", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, "params": [ { "type": "TypeParameter", - "start": 1, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - } - }, + "start":1,"end":2,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":2}}, "name": "T", "variance": null } @@ -119,68 +42,23 @@ }, { "type": "ExpressionStatement", - "start": 14, - "end": 28, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 14 - } - }, + "start":14,"end":28,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":14}}, "expression": { "type": "ArrowFunctionExpression", - "start": 14, - "end": 27, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 13 - } - }, + "start":14,"end":27,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":13}}, "id": null, "generator": false, "async": false, "params": [ { "type": "Identifier", - "start": 18, - "end": 19, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 5 - }, - "identifierName": "x" - }, + "start":18,"end":19,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":5},"identifierName":"x"}, "name": "x" } ], "body": { "type": "NumericLiteral", - "start": 24, - "end": 27, - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 13 - } - }, + "start":24,"end":27,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":13}}, "extra": { "rawValue": 123, "raw": "123" @@ -189,33 +67,11 @@ }, "typeParameters": { "type": "TypeParameterDeclaration", - "start": 14, - "end": 17, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 3 - } - }, + "start":14,"end":17,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":3}}, "params": [ { "type": "TypeParameter", - "start": 15, - "end": 16, - "loc": { - "start": { - "line": 2, - "column": 1 - }, - "end": { - "line": 2, - "column": 2 - } - }, + "start":15,"end":16,"loc":{"start":{"line":2,"column":1},"end":{"line":2,"column":2}}, "name": "T", "variance": null } @@ -225,98 +81,31 @@ }, { "type": "ExpressionStatement", - "start": 29, - "end": 51, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 22 - } - }, + "start":29,"end":51,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":22}}, "expression": { "type": "ArrowFunctionExpression", - "start": 29, - "end": 50, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 21 - } - }, + "start":29,"end":50,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":21}}, "id": null, "generator": false, "async": false, "params": [ { "type": "Identifier", - "start": 33, - "end": 42, - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 13 - }, - "identifierName": "x" - }, + "start":33,"end":42,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":13},"identifierName":"x"}, "name": "x", "typeAnnotation": { "type": "TypeAnnotation", - "start": 34, - "end": 42, - "loc": { - "start": { - "line": 3, - "column": 5 - }, - "end": { - "line": 3, - "column": 13 - } - }, + "start":34,"end":42,"loc":{"start":{"line":3,"column":5},"end":{"line":3,"column":13}}, "typeAnnotation": { "type": "NumberTypeAnnotation", - "start": 36, - "end": 42, - "loc": { - "start": { - "line": 3, - "column": 7 - }, - "end": { - "line": 3, - "column": 13 - } - } + "start":36,"end":42,"loc":{"start":{"line":3,"column":7},"end":{"line":3,"column":13}} } } } ], "body": { "type": "NumericLiteral", - "start": 47, - "end": 50, - "loc": { - "start": { - "line": 3, - "column": 18 - }, - "end": { - "line": 3, - "column": 21 - } - }, + "start":47,"end":50,"loc":{"start":{"line":3,"column":18},"end":{"line":3,"column":21}}, "extra": { "rawValue": 123, "raw": "123" @@ -325,33 +114,11 @@ }, "typeParameters": { "type": "TypeParameterDeclaration", - "start": 29, - "end": 32, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 3 - } - }, + "start":29,"end":32,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":3}}, "params": [ { "type": "TypeParameter", - "start": 30, - "end": 31, - "loc": { - "start": { - "line": 3, - "column": 1 - }, - "end": { - "line": 3, - "column": 2 - } - }, + "start":30,"end":31,"loc":{"start":{"line":3,"column":1},"end":{"line":3,"column":2}}, "name": "T", "variance": null } @@ -361,127 +128,38 @@ }, { "type": "ExpressionStatement", - "start": 52, - "end": 78, - "loc": { - "start": { - "line": 4, - "column": 0 - }, - "end": { - "line": 4, - "column": 26 - } - }, + "start":52,"end":78,"loc":{"start":{"line":4,"column":0},"end":{"line":4,"column":26}}, "expression": { "type": "ArrowFunctionExpression", - "start": 52, - "end": 77, - "loc": { - "start": { - "line": 4, - "column": 0 - }, - "end": { - "line": 4, - "column": 25 - } - }, + "start":52,"end":77,"loc":{"start":{"line":4,"column":0},"end":{"line":4,"column":25}}, "id": null, "generator": false, "async": false, "params": [ { "type": "Identifier", - "start": 56, - "end": 65, - "loc": { - "start": { - "line": 4, - "column": 4 - }, - "end": { - "line": 4, - "column": 13 - }, - "identifierName": "x" - }, + "start":56,"end":65,"loc":{"start":{"line":4,"column":4},"end":{"line":4,"column":13},"identifierName":"x"}, "name": "x", "typeAnnotation": { "type": "TypeAnnotation", - "start": 57, - "end": 65, - "loc": { - "start": { - "line": 4, - "column": 5 - }, - "end": { - "line": 4, - "column": 13 - } - }, + "start":57,"end":65,"loc":{"start":{"line":4,"column":5},"end":{"line":4,"column":13}}, "typeAnnotation": { "type": "NumberTypeAnnotation", - "start": 59, - "end": 65, - "loc": { - "start": { - "line": 4, - "column": 7 - }, - "end": { - "line": 4, - "column": 13 - } - } + "start":59,"end":65,"loc":{"start":{"line":4,"column":7},"end":{"line":4,"column":13}} } } } ], "body": { "type": "BlockStatement", - "start": 70, - "end": 77, - "loc": { - "start": { - "line": 4, - "column": 18 - }, - "end": { - "line": 4, - "column": 25 - } - }, + "start":70,"end":77,"loc":{"start":{"line":4,"column":18},"end":{"line":4,"column":25}}, "body": [ { "type": "ExpressionStatement", - "start": 72, - "end": 75, - "loc": { - "start": { - "line": 4, - "column": 20 - }, - "end": { - "line": 4, - "column": 23 - } - }, + "start":72,"end":75,"loc":{"start":{"line":4,"column":20},"end":{"line":4,"column":23}}, "expression": { "type": "NumericLiteral", - "start": 72, - "end": 75, - "loc": { - "start": { - "line": 4, - "column": 20 - }, - "end": { - "line": 4, - "column": 23 - } - }, + "start":72,"end":75,"loc":{"start":{"line":4,"column":20},"end":{"line":4,"column":23}}, "extra": { "rawValue": 123, "raw": "123" @@ -494,33 +172,11 @@ }, "typeParameters": { "type": "TypeParameterDeclaration", - "start": 52, - "end": 55, - "loc": { - "start": { - "line": 4, - "column": 0 - }, - "end": { - "line": 4, - "column": 3 - } - }, + "start":52,"end":55,"loc":{"start":{"line":4,"column":0},"end":{"line":4,"column":3}}, "params": [ { "type": "TypeParameter", - "start": 53, - "end": 54, - "loc": { - "start": { - "line": 4, - "column": 1 - }, - "end": { - "line": 4, - "column": 2 - } - }, + "start":53,"end":54,"loc":{"start":{"line":4,"column":1},"end":{"line":4,"column":2}}, "name": "T", "variance": null } diff --git a/packages/babel-parser/test/fixtures/flow/type-parameter-declaration/arrow_without_jsx/output.json b/packages/babel-parser/test/fixtures/flow/type-parameter-declaration/arrow_without_jsx/output.json index c4508202637c..5d46fe17f39c 100644 --- a/packages/babel-parser/test/fixtures/flow/type-parameter-declaration/arrow_without_jsx/output.json +++ b/packages/babel-parser/test/fixtures/flow/type-parameter-declaration/arrow_without_jsx/output.json @@ -1,80 +1,25 @@ { "type": "File", - "start": 0, - "end": 78, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 26 - } - }, + "start":0,"end":78,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":26}}, "program": { "type": "Program", - "start": 0, - "end": 78, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 26 - } - }, + "start":0,"end":78,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":26}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "expression": { "type": "ArrowFunctionExpression", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, "id": null, "generator": false, "async": false, "params": [], "body": { "type": "NumericLiteral", - "start": 9, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":9,"end":12,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":12}}, "extra": { "rawValue": 123, "raw": "123" @@ -83,33 +28,11 @@ }, "typeParameters": { "type": "TypeParameterDeclaration", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, "params": [ { "type": "TypeParameter", - "start": 1, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - } - }, + "start":1,"end":2,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":2}}, "name": "T", "variance": null } @@ -119,68 +42,23 @@ }, { "type": "ExpressionStatement", - "start": 14, - "end": 28, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 14 - } - }, + "start":14,"end":28,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":14}}, "expression": { "type": "ArrowFunctionExpression", - "start": 14, - "end": 27, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 13 - } - }, + "start":14,"end":27,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":13}}, "id": null, "generator": false, "async": false, "params": [ { "type": "Identifier", - "start": 18, - "end": 19, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 5 - }, - "identifierName": "x" - }, + "start":18,"end":19,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":5},"identifierName":"x"}, "name": "x" } ], "body": { "type": "NumericLiteral", - "start": 24, - "end": 27, - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 13 - } - }, + "start":24,"end":27,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":13}}, "extra": { "rawValue": 123, "raw": "123" @@ -189,33 +67,11 @@ }, "typeParameters": { "type": "TypeParameterDeclaration", - "start": 14, - "end": 17, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 3 - } - }, + "start":14,"end":17,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":3}}, "params": [ { "type": "TypeParameter", - "start": 15, - "end": 16, - "loc": { - "start": { - "line": 2, - "column": 1 - }, - "end": { - "line": 2, - "column": 2 - } - }, + "start":15,"end":16,"loc":{"start":{"line":2,"column":1},"end":{"line":2,"column":2}}, "name": "T", "variance": null } @@ -225,98 +81,31 @@ }, { "type": "ExpressionStatement", - "start": 29, - "end": 51, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 22 - } - }, + "start":29,"end":51,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":22}}, "expression": { "type": "ArrowFunctionExpression", - "start": 29, - "end": 50, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 21 - } - }, + "start":29,"end":50,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":21}}, "id": null, "generator": false, "async": false, "params": [ { "type": "Identifier", - "start": 33, - "end": 42, - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 13 - }, - "identifierName": "x" - }, + "start":33,"end":42,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":13},"identifierName":"x"}, "name": "x", "typeAnnotation": { "type": "TypeAnnotation", - "start": 34, - "end": 42, - "loc": { - "start": { - "line": 3, - "column": 5 - }, - "end": { - "line": 3, - "column": 13 - } - }, + "start":34,"end":42,"loc":{"start":{"line":3,"column":5},"end":{"line":3,"column":13}}, "typeAnnotation": { "type": "NumberTypeAnnotation", - "start": 36, - "end": 42, - "loc": { - "start": { - "line": 3, - "column": 7 - }, - "end": { - "line": 3, - "column": 13 - } - } + "start":36,"end":42,"loc":{"start":{"line":3,"column":7},"end":{"line":3,"column":13}} } } } ], "body": { "type": "NumericLiteral", - "start": 47, - "end": 50, - "loc": { - "start": { - "line": 3, - "column": 18 - }, - "end": { - "line": 3, - "column": 21 - } - }, + "start":47,"end":50,"loc":{"start":{"line":3,"column":18},"end":{"line":3,"column":21}}, "extra": { "rawValue": 123, "raw": "123" @@ -325,33 +114,11 @@ }, "typeParameters": { "type": "TypeParameterDeclaration", - "start": 29, - "end": 32, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 3 - } - }, + "start":29,"end":32,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":3}}, "params": [ { "type": "TypeParameter", - "start": 30, - "end": 31, - "loc": { - "start": { - "line": 3, - "column": 1 - }, - "end": { - "line": 3, - "column": 2 - } - }, + "start":30,"end":31,"loc":{"start":{"line":3,"column":1},"end":{"line":3,"column":2}}, "name": "T", "variance": null } @@ -361,127 +128,38 @@ }, { "type": "ExpressionStatement", - "start": 52, - "end": 78, - "loc": { - "start": { - "line": 4, - "column": 0 - }, - "end": { - "line": 4, - "column": 26 - } - }, + "start":52,"end":78,"loc":{"start":{"line":4,"column":0},"end":{"line":4,"column":26}}, "expression": { "type": "ArrowFunctionExpression", - "start": 52, - "end": 77, - "loc": { - "start": { - "line": 4, - "column": 0 - }, - "end": { - "line": 4, - "column": 25 - } - }, + "start":52,"end":77,"loc":{"start":{"line":4,"column":0},"end":{"line":4,"column":25}}, "id": null, "generator": false, "async": false, "params": [ { "type": "Identifier", - "start": 56, - "end": 65, - "loc": { - "start": { - "line": 4, - "column": 4 - }, - "end": { - "line": 4, - "column": 13 - }, - "identifierName": "x" - }, + "start":56,"end":65,"loc":{"start":{"line":4,"column":4},"end":{"line":4,"column":13},"identifierName":"x"}, "name": "x", "typeAnnotation": { "type": "TypeAnnotation", - "start": 57, - "end": 65, - "loc": { - "start": { - "line": 4, - "column": 5 - }, - "end": { - "line": 4, - "column": 13 - } - }, + "start":57,"end":65,"loc":{"start":{"line":4,"column":5},"end":{"line":4,"column":13}}, "typeAnnotation": { "type": "NumberTypeAnnotation", - "start": 59, - "end": 65, - "loc": { - "start": { - "line": 4, - "column": 7 - }, - "end": { - "line": 4, - "column": 13 - } - } + "start":59,"end":65,"loc":{"start":{"line":4,"column":7},"end":{"line":4,"column":13}} } } } ], "body": { "type": "BlockStatement", - "start": 70, - "end": 77, - "loc": { - "start": { - "line": 4, - "column": 18 - }, - "end": { - "line": 4, - "column": 25 - } - }, + "start":70,"end":77,"loc":{"start":{"line":4,"column":18},"end":{"line":4,"column":25}}, "body": [ { "type": "ExpressionStatement", - "start": 72, - "end": 75, - "loc": { - "start": { - "line": 4, - "column": 20 - }, - "end": { - "line": 4, - "column": 23 - } - }, + "start":72,"end":75,"loc":{"start":{"line":4,"column":20},"end":{"line":4,"column":23}}, "expression": { "type": "NumericLiteral", - "start": 72, - "end": 75, - "loc": { - "start": { - "line": 4, - "column": 20 - }, - "end": { - "line": 4, - "column": 23 - } - }, + "start":72,"end":75,"loc":{"start":{"line":4,"column":20},"end":{"line":4,"column":23}}, "extra": { "rawValue": 123, "raw": "123" @@ -494,33 +172,11 @@ }, "typeParameters": { "type": "TypeParameterDeclaration", - "start": 52, - "end": 55, - "loc": { - "start": { - "line": 4, - "column": 0 - }, - "end": { - "line": 4, - "column": 3 - } - }, + "start":52,"end":55,"loc":{"start":{"line":4,"column":0},"end":{"line":4,"column":3}}, "params": [ { "type": "TypeParameter", - "start": 53, - "end": 54, - "loc": { - "start": { - "line": 4, - "column": 1 - }, - "end": { - "line": 4, - "column": 2 - } - }, + "start":53,"end":54,"loc":{"start":{"line":4,"column":1},"end":{"line":4,"column":2}}, "name": "T", "variance": null } diff --git a/packages/babel-parser/test/fixtures/flow/type-parameter-declaration/class-method-reserved-word/output.json b/packages/babel-parser/test/fixtures/flow/type-parameter-declaration/class-method-reserved-word/output.json index a2837f7dd58d..bc961ea83520 100644 --- a/packages/babel-parser/test/fixtures/flow/type-parameter-declaration/class-method-reserved-word/output.json +++ b/packages/babel-parser/test/fixtures/flow/type-parameter-declaration/class-method-reserved-word/output.json @@ -1,144 +1,43 @@ { "type": "File", - "start": 0, - "end": 166, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 10, - "column": 2 - } - }, + "start":0,"end":166,"loc":{"start":{"line":1,"column":0},"end":{"line":10,"column":2}}, "program": { "type": "Program", - "start": 0, - "end": 166, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 10, - "column": 2 - } - }, + "start":0,"end":166,"loc":{"start":{"line":1,"column":0},"end":{"line":10,"column":2}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 165, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 10, - "column": 1 - } - }, + "start":0,"end":165,"loc":{"start":{"line":1,"column":0},"end":{"line":10,"column":1}}, "id": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "X" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"X"}, "name": "X" }, "superClass": null, "body": { "type": "ClassBody", - "start": 8, - "end": 165, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 10, - "column": 1 - } - }, + "start":8,"end":165,"loc":{"start":{"line":1,"column":8},"end":{"line":10,"column":1}}, "body": [ { "type": "ClassMethod", - "start": 12, - "end": 26, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 16 - } - }, + "start":12,"end":26,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":16}}, "static": false, "key": { "type": "Identifier", - "start": 12, - "end": 18, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 8 - }, - "identifierName": "foobar" - }, + "start":12,"end":18,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":8},"identifierName":"foobar"}, "name": "foobar" }, "computed": false, "kind": "method", "typeParameters": { "type": "TypeParameterDeclaration", - "start": 18, - "end": 21, - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 11 - } - }, + "start":18,"end":21,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":11}}, "params": [ { "type": "TypeParameter", - "start": 19, - "end": 20, - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 10 - } - }, + "start":19,"end":20,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":10}}, "name": "T", "variance": null } @@ -150,85 +49,29 @@ "params": [], "body": { "type": "BlockStatement", - "start": 24, - "end": 26, - "loc": { - "start": { - "line": 2, - "column": 14 - }, - "end": { - "line": 2, - "column": 16 - } - }, + "start":24,"end":26,"loc":{"start":{"line":2,"column":14},"end":{"line":2,"column":16}}, "body": [], "directives": [] } }, { "type": "ClassMethod", - "start": 29, - "end": 43, - "loc": { - "start": { - "line": 3, - "column": 2 - }, - "end": { - "line": 3, - "column": 16 - } - }, + "start":29,"end":43,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":16}}, "static": false, "key": { "type": "Identifier", - "start": 29, - "end": 35, - "loc": { - "start": { - "line": 3, - "column": 2 - }, - "end": { - "line": 3, - "column": 8 - }, - "identifierName": "delete" - }, + "start":29,"end":35,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":8},"identifierName":"delete"}, "name": "delete" }, "computed": false, "kind": "method", "typeParameters": { "type": "TypeParameterDeclaration", - "start": 35, - "end": 38, - "loc": { - "start": { - "line": 3, - "column": 8 - }, - "end": { - "line": 3, - "column": 11 - } - }, + "start":35,"end":38,"loc":{"start":{"line":3,"column":8},"end":{"line":3,"column":11}}, "params": [ { "type": "TypeParameter", - "start": 36, - "end": 37, - "loc": { - "start": { - "line": 3, - "column": 9 - }, - "end": { - "line": 3, - "column": 10 - } - }, + "start":36,"end":37,"loc":{"start":{"line":3,"column":9},"end":{"line":3,"column":10}}, "name": "T", "variance": null } @@ -240,85 +83,29 @@ "params": [], "body": { "type": "BlockStatement", - "start": 41, - "end": 43, - "loc": { - "start": { - "line": 3, - "column": 14 - }, - "end": { - "line": 3, - "column": 16 - } - }, + "start":41,"end":43,"loc":{"start":{"line":3,"column":14},"end":{"line":3,"column":16}}, "body": [], "directives": [] } }, { "type": "ClassMethod", - "start": 46, - "end": 59, - "loc": { - "start": { - "line": 4, - "column": 2 - }, - "end": { - "line": 4, - "column": 15 - } - }, + "start":46,"end":59,"loc":{"start":{"line":4,"column":2},"end":{"line":4,"column":15}}, "static": false, "key": { "type": "Identifier", - "start": 46, - "end": 51, - "loc": { - "start": { - "line": 4, - "column": 2 - }, - "end": { - "line": 4, - "column": 7 - }, - "identifierName": "yield" - }, + "start":46,"end":51,"loc":{"start":{"line":4,"column":2},"end":{"line":4,"column":7},"identifierName":"yield"}, "name": "yield" }, "computed": false, "kind": "method", "typeParameters": { "type": "TypeParameterDeclaration", - "start": 51, - "end": 54, - "loc": { - "start": { - "line": 4, - "column": 7 - }, - "end": { - "line": 4, - "column": 10 - } - }, + "start":51,"end":54,"loc":{"start":{"line":4,"column":7},"end":{"line":4,"column":10}}, "params": [ { "type": "TypeParameter", - "start": 52, - "end": 53, - "loc": { - "start": { - "line": 4, - "column": 8 - }, - "end": { - "line": 4, - "column": 9 - } - }, + "start":52,"end":53,"loc":{"start":{"line":4,"column":8},"end":{"line":4,"column":9}}, "name": "T", "variance": null } @@ -330,85 +117,29 @@ "params": [], "body": { "type": "BlockStatement", - "start": 57, - "end": 59, - "loc": { - "start": { - "line": 4, - "column": 13 - }, - "end": { - "line": 4, - "column": 15 - } - }, + "start":57,"end":59,"loc":{"start":{"line":4,"column":13},"end":{"line":4,"column":15}}, "body": [], "directives": [] } }, { "type": "ClassMethod", - "start": 62, - "end": 72, - "loc": { - "start": { - "line": 5, - "column": 2 - }, - "end": { - "line": 5, - "column": 12 - } - }, + "start":62,"end":72,"loc":{"start":{"line":5,"column":2},"end":{"line":5,"column":12}}, "static": false, "key": { "type": "Identifier", - "start": 62, - "end": 64, - "loc": { - "start": { - "line": 5, - "column": 2 - }, - "end": { - "line": 5, - "column": 4 - }, - "identifierName": "do" - }, + "start":62,"end":64,"loc":{"start":{"line":5,"column":2},"end":{"line":5,"column":4},"identifierName":"do"}, "name": "do" }, "computed": false, "kind": "method", "typeParameters": { "type": "TypeParameterDeclaration", - "start": 64, - "end": 67, - "loc": { - "start": { - "line": 5, - "column": 4 - }, - "end": { - "line": 5, - "column": 7 - } - }, + "start":64,"end":67,"loc":{"start":{"line":5,"column":4},"end":{"line":5,"column":7}}, "params": [ { "type": "TypeParameter", - "start": 65, - "end": 66, - "loc": { - "start": { - "line": 5, - "column": 5 - }, - "end": { - "line": 5, - "column": 6 - } - }, + "start":65,"end":66,"loc":{"start":{"line":5,"column":5},"end":{"line":5,"column":6}}, "name": "T", "variance": null } @@ -420,85 +151,29 @@ "params": [], "body": { "type": "BlockStatement", - "start": 70, - "end": 72, - "loc": { - "start": { - "line": 5, - "column": 10 - }, - "end": { - "line": 5, - "column": 12 - } - }, + "start":70,"end":72,"loc":{"start":{"line":5,"column":10},"end":{"line":5,"column":12}}, "body": [], "directives": [] } }, { "type": "ClassMethod", - "start": 75, - "end": 96, - "loc": { - "start": { - "line": 6, - "column": 2 - }, - "end": { - "line": 6, - "column": 23 - } - }, + "start":75,"end":96,"loc":{"start":{"line":6,"column":2},"end":{"line":6,"column":23}}, "static": true, "key": { "type": "Identifier", - "start": 82, - "end": 88, - "loc": { - "start": { - "line": 6, - "column": 9 - }, - "end": { - "line": 6, - "column": 15 - }, - "identifierName": "foobar" - }, + "start":82,"end":88,"loc":{"start":{"line":6,"column":9},"end":{"line":6,"column":15},"identifierName":"foobar"}, "name": "foobar" }, "computed": false, "kind": "method", "typeParameters": { "type": "TypeParameterDeclaration", - "start": 88, - "end": 91, - "loc": { - "start": { - "line": 6, - "column": 15 - }, - "end": { - "line": 6, - "column": 18 - } - }, + "start":88,"end":91,"loc":{"start":{"line":6,"column":15},"end":{"line":6,"column":18}}, "params": [ { "type": "TypeParameter", - "start": 89, - "end": 90, - "loc": { - "start": { - "line": 6, - "column": 16 - }, - "end": { - "line": 6, - "column": 17 - } - }, + "start":89,"end":90,"loc":{"start":{"line":6,"column":16},"end":{"line":6,"column":17}}, "name": "T", "variance": null } @@ -510,85 +185,29 @@ "params": [], "body": { "type": "BlockStatement", - "start": 94, - "end": 96, - "loc": { - "start": { - "line": 6, - "column": 21 - }, - "end": { - "line": 6, - "column": 23 - } - }, + "start":94,"end":96,"loc":{"start":{"line":6,"column":21},"end":{"line":6,"column":23}}, "body": [], "directives": [] } }, { "type": "ClassMethod", - "start": 99, - "end": 120, - "loc": { - "start": { - "line": 7, - "column": 2 - }, - "end": { - "line": 7, - "column": 23 - } - }, + "start":99,"end":120,"loc":{"start":{"line":7,"column":2},"end":{"line":7,"column":23}}, "static": true, "key": { "type": "Identifier", - "start": 106, - "end": 112, - "loc": { - "start": { - "line": 7, - "column": 9 - }, - "end": { - "line": 7, - "column": 15 - }, - "identifierName": "delete" - }, + "start":106,"end":112,"loc":{"start":{"line":7,"column":9},"end":{"line":7,"column":15},"identifierName":"delete"}, "name": "delete" }, "computed": false, "kind": "method", "typeParameters": { "type": "TypeParameterDeclaration", - "start": 112, - "end": 115, - "loc": { - "start": { - "line": 7, - "column": 15 - }, - "end": { - "line": 7, - "column": 18 - } - }, + "start":112,"end":115,"loc":{"start":{"line":7,"column":15},"end":{"line":7,"column":18}}, "params": [ { "type": "TypeParameter", - "start": 113, - "end": 114, - "loc": { - "start": { - "line": 7, - "column": 16 - }, - "end": { - "line": 7, - "column": 17 - } - }, + "start":113,"end":114,"loc":{"start":{"line":7,"column":16},"end":{"line":7,"column":17}}, "name": "T", "variance": null } @@ -600,85 +219,29 @@ "params": [], "body": { "type": "BlockStatement", - "start": 118, - "end": 120, - "loc": { - "start": { - "line": 7, - "column": 21 - }, - "end": { - "line": 7, - "column": 23 - } - }, + "start":118,"end":120,"loc":{"start":{"line":7,"column":21},"end":{"line":7,"column":23}}, "body": [], "directives": [] } }, { "type": "ClassMethod", - "start": 123, - "end": 143, - "loc": { - "start": { - "line": 8, - "column": 2 - }, - "end": { - "line": 8, - "column": 22 - } - }, + "start":123,"end":143,"loc":{"start":{"line":8,"column":2},"end":{"line":8,"column":22}}, "static": true, "key": { "type": "Identifier", - "start": 130, - "end": 135, - "loc": { - "start": { - "line": 8, - "column": 9 - }, - "end": { - "line": 8, - "column": 14 - }, - "identifierName": "yield" - }, + "start":130,"end":135,"loc":{"start":{"line":8,"column":9},"end":{"line":8,"column":14},"identifierName":"yield"}, "name": "yield" }, "computed": false, "kind": "method", "typeParameters": { "type": "TypeParameterDeclaration", - "start": 135, - "end": 138, - "loc": { - "start": { - "line": 8, - "column": 14 - }, - "end": { - "line": 8, - "column": 17 - } - }, + "start":135,"end":138,"loc":{"start":{"line":8,"column":14},"end":{"line":8,"column":17}}, "params": [ { "type": "TypeParameter", - "start": 136, - "end": 137, - "loc": { - "start": { - "line": 8, - "column": 15 - }, - "end": { - "line": 8, - "column": 16 - } - }, + "start":136,"end":137,"loc":{"start":{"line":8,"column":15},"end":{"line":8,"column":16}}, "name": "T", "variance": null } @@ -690,85 +253,29 @@ "params": [], "body": { "type": "BlockStatement", - "start": 141, - "end": 143, - "loc": { - "start": { - "line": 8, - "column": 20 - }, - "end": { - "line": 8, - "column": 22 - } - }, + "start":141,"end":143,"loc":{"start":{"line":8,"column":20},"end":{"line":8,"column":22}}, "body": [], "directives": [] } }, { "type": "ClassMethod", - "start": 146, - "end": 163, - "loc": { - "start": { - "line": 9, - "column": 2 - }, - "end": { - "line": 9, - "column": 19 - } - }, + "start":146,"end":163,"loc":{"start":{"line":9,"column":2},"end":{"line":9,"column":19}}, "static": true, "key": { "type": "Identifier", - "start": 153, - "end": 155, - "loc": { - "start": { - "line": 9, - "column": 9 - }, - "end": { - "line": 9, - "column": 11 - }, - "identifierName": "do" - }, + "start":153,"end":155,"loc":{"start":{"line":9,"column":9},"end":{"line":9,"column":11},"identifierName":"do"}, "name": "do" }, "computed": false, "kind": "method", "typeParameters": { "type": "TypeParameterDeclaration", - "start": 155, - "end": 158, - "loc": { - "start": { - "line": 9, - "column": 11 - }, - "end": { - "line": 9, - "column": 14 - } - }, + "start":155,"end":158,"loc":{"start":{"line":9,"column":11},"end":{"line":9,"column":14}}, "params": [ { "type": "TypeParameter", - "start": 156, - "end": 157, - "loc": { - "start": { - "line": 9, - "column": 12 - }, - "end": { - "line": 9, - "column": 13 - } - }, + "start":156,"end":157,"loc":{"start":{"line":9,"column":12},"end":{"line":9,"column":13}}, "name": "T", "variance": null } @@ -780,18 +287,7 @@ "params": [], "body": { "type": "BlockStatement", - "start": 161, - "end": 163, - "loc": { - "start": { - "line": 9, - "column": 17 - }, - "end": { - "line": 9, - "column": 19 - } - }, + "start":161,"end":163,"loc":{"start":{"line":9,"column":17},"end":{"line":9,"column":19}}, "body": [], "directives": [] } @@ -801,18 +297,7 @@ }, { "type": "EmptyStatement", - "start": 165, - "end": 166, - "loc": { - "start": { - "line": 10, - "column": 1 - }, - "end": { - "line": 10, - "column": 2 - } - } + "start":165,"end":166,"loc":{"start":{"line":10,"column":1},"end":{"line":10,"column":2}} } ], "directives": [] diff --git a/packages/babel-parser/test/fixtures/flow/type-parameter-declaration/declare-class-method-reserved-word/output.json b/packages/babel-parser/test/fixtures/flow/type-parameter-declaration/declare-class-method-reserved-word/output.json index 64b7c306de3b..1fcb8935c9e1 100644 --- a/packages/babel-parser/test/fixtures/flow/type-parameter-declaration/declare-class-method-reserved-word/output.json +++ b/packages/babel-parser/test/fixtures/flow/type-parameter-declaration/declare-class-method-reserved-word/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 206, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 10, - "column": 2 - } - }, + "start":0,"end":206,"loc":{"start":{"line":1,"column":0},"end":{"line":10,"column":2}}, "program": { "type": "Program", - "start": 0, - "end": 206, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 10, - "column": 2 - } - }, + "start":0,"end":206,"loc":{"start":{"line":1,"column":0},"end":{"line":10,"column":2}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "DeclareClass", - "start": 0, - "end": 205, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 10, - "column": 1 - } - }, + "start":0,"end":205,"loc":{"start":{"line":1,"column":0},"end":{"line":10,"column":1}}, "id": { "type": "Identifier", - "start": 14, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - }, - "identifierName": "X" - }, + "start":14,"end":15,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":15},"identifierName":"X"}, "name": "X" }, "typeParameters": null, @@ -66,49 +21,15 @@ "mixins": [], "body": { "type": "ObjectTypeAnnotation", - "start": 16, - "end": 205, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 10, - "column": 1 - } - }, + "start":16,"end":205,"loc":{"start":{"line":1,"column":16},"end":{"line":10,"column":1}}, "callProperties": [], "properties": [ { "type": "ObjectTypeProperty", - "start": 20, - "end": 37, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 19 - } - }, + "start":20,"end":37,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":19}}, "key": { "type": "Identifier", - "start": 20, - "end": 26, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 8 - }, - "identifierName": "foobar" - }, + "start":20,"end":26,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":8},"identifierName":"foobar"}, "name": "foobar" }, "static": false, @@ -117,49 +38,16 @@ "method": true, "value": { "type": "FunctionTypeAnnotation", - "start": 20, - "end": 37, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 19 - } - }, + "start":20,"end":37,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":19}}, "params": [], "rest": null, "typeParameters": { "type": "TypeParameterDeclaration", - "start": 26, - "end": 29, - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 11 - } - }, + "start":26,"end":29,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":11}}, "params": [ { "type": "TypeParameter", - "start": 27, - "end": 28, - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 10 - } - }, + "start":27,"end":28,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":10}}, "name": "T", "variance": null } @@ -167,51 +55,17 @@ }, "returnType": { "type": "VoidTypeAnnotation", - "start": 33, - "end": 37, - "loc": { - "start": { - "line": 2, - "column": 15 - }, - "end": { - "line": 2, - "column": 19 - } - } + "start":33,"end":37,"loc":{"start":{"line":2,"column":15},"end":{"line":2,"column":19}} } }, "optional": false }, { "type": "ObjectTypeProperty", - "start": 41, - "end": 58, - "loc": { - "start": { - "line": 3, - "column": 2 - }, - "end": { - "line": 3, - "column": 19 - } - }, + "start":41,"end":58,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":19}}, "key": { "type": "Identifier", - "start": 41, - "end": 47, - "loc": { - "start": { - "line": 3, - "column": 2 - }, - "end": { - "line": 3, - "column": 8 - }, - "identifierName": "delete" - }, + "start":41,"end":47,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":8},"identifierName":"delete"}, "name": "delete" }, "static": false, @@ -220,49 +74,16 @@ "method": true, "value": { "type": "FunctionTypeAnnotation", - "start": 41, - "end": 58, - "loc": { - "start": { - "line": 3, - "column": 2 - }, - "end": { - "line": 3, - "column": 19 - } - }, + "start":41,"end":58,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":19}}, "params": [], "rest": null, "typeParameters": { "type": "TypeParameterDeclaration", - "start": 47, - "end": 50, - "loc": { - "start": { - "line": 3, - "column": 8 - }, - "end": { - "line": 3, - "column": 11 - } - }, + "start":47,"end":50,"loc":{"start":{"line":3,"column":8},"end":{"line":3,"column":11}}, "params": [ { "type": "TypeParameter", - "start": 48, - "end": 49, - "loc": { - "start": { - "line": 3, - "column": 9 - }, - "end": { - "line": 3, - "column": 10 - } - }, + "start":48,"end":49,"loc":{"start":{"line":3,"column":9},"end":{"line":3,"column":10}}, "name": "T", "variance": null } @@ -270,51 +91,17 @@ }, "returnType": { "type": "VoidTypeAnnotation", - "start": 54, - "end": 58, - "loc": { - "start": { - "line": 3, - "column": 15 - }, - "end": { - "line": 3, - "column": 19 - } - } + "start":54,"end":58,"loc":{"start":{"line":3,"column":15},"end":{"line":3,"column":19}} } }, "optional": false }, { "type": "ObjectTypeProperty", - "start": 62, - "end": 78, - "loc": { - "start": { - "line": 4, - "column": 2 - }, - "end": { - "line": 4, - "column": 18 - } - }, + "start":62,"end":78,"loc":{"start":{"line":4,"column":2},"end":{"line":4,"column":18}}, "key": { "type": "Identifier", - "start": 62, - "end": 67, - "loc": { - "start": { - "line": 4, - "column": 2 - }, - "end": { - "line": 4, - "column": 7 - }, - "identifierName": "yield" - }, + "start":62,"end":67,"loc":{"start":{"line":4,"column":2},"end":{"line":4,"column":7},"identifierName":"yield"}, "name": "yield" }, "static": false, @@ -323,49 +110,16 @@ "method": true, "value": { "type": "FunctionTypeAnnotation", - "start": 62, - "end": 78, - "loc": { - "start": { - "line": 4, - "column": 2 - }, - "end": { - "line": 4, - "column": 18 - } - }, + "start":62,"end":78,"loc":{"start":{"line":4,"column":2},"end":{"line":4,"column":18}}, "params": [], "rest": null, "typeParameters": { "type": "TypeParameterDeclaration", - "start": 67, - "end": 70, - "loc": { - "start": { - "line": 4, - "column": 7 - }, - "end": { - "line": 4, - "column": 10 - } - }, + "start":67,"end":70,"loc":{"start":{"line":4,"column":7},"end":{"line":4,"column":10}}, "params": [ { "type": "TypeParameter", - "start": 68, - "end": 69, - "loc": { - "start": { - "line": 4, - "column": 8 - }, - "end": { - "line": 4, - "column": 9 - } - }, + "start":68,"end":69,"loc":{"start":{"line":4,"column":8},"end":{"line":4,"column":9}}, "name": "T", "variance": null } @@ -373,51 +127,17 @@ }, "returnType": { "type": "VoidTypeAnnotation", - "start": 74, - "end": 78, - "loc": { - "start": { - "line": 4, - "column": 14 - }, - "end": { - "line": 4, - "column": 18 - } - } + "start":74,"end":78,"loc":{"start":{"line":4,"column":14},"end":{"line":4,"column":18}} } }, "optional": false }, { "type": "ObjectTypeProperty", - "start": 82, - "end": 95, - "loc": { - "start": { - "line": 5, - "column": 2 - }, - "end": { - "line": 5, - "column": 15 - } - }, + "start":82,"end":95,"loc":{"start":{"line":5,"column":2},"end":{"line":5,"column":15}}, "key": { "type": "Identifier", - "start": 82, - "end": 84, - "loc": { - "start": { - "line": 5, - "column": 2 - }, - "end": { - "line": 5, - "column": 4 - }, - "identifierName": "do" - }, + "start":82,"end":84,"loc":{"start":{"line":5,"column":2},"end":{"line":5,"column":4},"identifierName":"do"}, "name": "do" }, "static": false, @@ -426,49 +146,16 @@ "method": true, "value": { "type": "FunctionTypeAnnotation", - "start": 82, - "end": 95, - "loc": { - "start": { - "line": 5, - "column": 2 - }, - "end": { - "line": 5, - "column": 15 - } - }, + "start":82,"end":95,"loc":{"start":{"line":5,"column":2},"end":{"line":5,"column":15}}, "params": [], "rest": null, "typeParameters": { "type": "TypeParameterDeclaration", - "start": 84, - "end": 87, - "loc": { - "start": { - "line": 5, - "column": 4 - }, - "end": { - "line": 5, - "column": 7 - } - }, + "start":84,"end":87,"loc":{"start":{"line":5,"column":4},"end":{"line":5,"column":7}}, "params": [ { "type": "TypeParameter", - "start": 85, - "end": 86, - "loc": { - "start": { - "line": 5, - "column": 5 - }, - "end": { - "line": 5, - "column": 6 - } - }, + "start":85,"end":86,"loc":{"start":{"line":5,"column":5},"end":{"line":5,"column":6}}, "name": "T", "variance": null } @@ -476,51 +163,17 @@ }, "returnType": { "type": "VoidTypeAnnotation", - "start": 91, - "end": 95, - "loc": { - "start": { - "line": 5, - "column": 11 - }, - "end": { - "line": 5, - "column": 15 - } - } + "start":91,"end":95,"loc":{"start":{"line":5,"column":11},"end":{"line":5,"column":15}} } }, "optional": false }, { "type": "ObjectTypeProperty", - "start": 99, - "end": 123, - "loc": { - "start": { - "line": 6, - "column": 2 - }, - "end": { - "line": 6, - "column": 26 - } - }, + "start":99,"end":123,"loc":{"start":{"line":6,"column":2},"end":{"line":6,"column":26}}, "key": { "type": "Identifier", - "start": 106, - "end": 112, - "loc": { - "start": { - "line": 6, - "column": 9 - }, - "end": { - "line": 6, - "column": 15 - }, - "identifierName": "foobar" - }, + "start":106,"end":112,"loc":{"start":{"line":6,"column":9},"end":{"line":6,"column":15},"identifierName":"foobar"}, "name": "foobar" }, "static": true, @@ -529,49 +182,16 @@ "method": true, "value": { "type": "FunctionTypeAnnotation", - "start": 99, - "end": 123, - "loc": { - "start": { - "line": 6, - "column": 2 - }, - "end": { - "line": 6, - "column": 26 - } - }, + "start":99,"end":123,"loc":{"start":{"line":6,"column":2},"end":{"line":6,"column":26}}, "params": [], "rest": null, "typeParameters": { "type": "TypeParameterDeclaration", - "start": 112, - "end": 115, - "loc": { - "start": { - "line": 6, - "column": 15 - }, - "end": { - "line": 6, - "column": 18 - } - }, + "start":112,"end":115,"loc":{"start":{"line":6,"column":15},"end":{"line":6,"column":18}}, "params": [ { "type": "TypeParameter", - "start": 113, - "end": 114, - "loc": { - "start": { - "line": 6, - "column": 16 - }, - "end": { - "line": 6, - "column": 17 - } - }, + "start":113,"end":114,"loc":{"start":{"line":6,"column":16},"end":{"line":6,"column":17}}, "name": "T", "variance": null } @@ -579,51 +199,17 @@ }, "returnType": { "type": "VoidTypeAnnotation", - "start": 119, - "end": 123, - "loc": { - "start": { - "line": 6, - "column": 22 - }, - "end": { - "line": 6, - "column": 26 - } - } + "start":119,"end":123,"loc":{"start":{"line":6,"column":22},"end":{"line":6,"column":26}} } }, "optional": false }, { "type": "ObjectTypeProperty", - "start": 127, - "end": 151, - "loc": { - "start": { - "line": 7, - "column": 2 - }, - "end": { - "line": 7, - "column": 26 - } - }, + "start":127,"end":151,"loc":{"start":{"line":7,"column":2},"end":{"line":7,"column":26}}, "key": { "type": "Identifier", - "start": 134, - "end": 140, - "loc": { - "start": { - "line": 7, - "column": 9 - }, - "end": { - "line": 7, - "column": 15 - }, - "identifierName": "delete" - }, + "start":134,"end":140,"loc":{"start":{"line":7,"column":9},"end":{"line":7,"column":15},"identifierName":"delete"}, "name": "delete" }, "static": true, @@ -632,49 +218,16 @@ "method": true, "value": { "type": "FunctionTypeAnnotation", - "start": 127, - "end": 151, - "loc": { - "start": { - "line": 7, - "column": 2 - }, - "end": { - "line": 7, - "column": 26 - } - }, + "start":127,"end":151,"loc":{"start":{"line":7,"column":2},"end":{"line":7,"column":26}}, "params": [], "rest": null, "typeParameters": { "type": "TypeParameterDeclaration", - "start": 140, - "end": 143, - "loc": { - "start": { - "line": 7, - "column": 15 - }, - "end": { - "line": 7, - "column": 18 - } - }, + "start":140,"end":143,"loc":{"start":{"line":7,"column":15},"end":{"line":7,"column":18}}, "params": [ { "type": "TypeParameter", - "start": 141, - "end": 142, - "loc": { - "start": { - "line": 7, - "column": 16 - }, - "end": { - "line": 7, - "column": 17 - } - }, + "start":141,"end":142,"loc":{"start":{"line":7,"column":16},"end":{"line":7,"column":17}}, "name": "T", "variance": null } @@ -682,51 +235,17 @@ }, "returnType": { "type": "VoidTypeAnnotation", - "start": 147, - "end": 151, - "loc": { - "start": { - "line": 7, - "column": 22 - }, - "end": { - "line": 7, - "column": 26 - } - } + "start":147,"end":151,"loc":{"start":{"line":7,"column":22},"end":{"line":7,"column":26}} } }, "optional": false }, { "type": "ObjectTypeProperty", - "start": 155, - "end": 178, - "loc": { - "start": { - "line": 8, - "column": 2 - }, - "end": { - "line": 8, - "column": 25 - } - }, + "start":155,"end":178,"loc":{"start":{"line":8,"column":2},"end":{"line":8,"column":25}}, "key": { "type": "Identifier", - "start": 162, - "end": 167, - "loc": { - "start": { - "line": 8, - "column": 9 - }, - "end": { - "line": 8, - "column": 14 - }, - "identifierName": "yield" - }, + "start":162,"end":167,"loc":{"start":{"line":8,"column":9},"end":{"line":8,"column":14},"identifierName":"yield"}, "name": "yield" }, "static": true, @@ -735,49 +254,16 @@ "method": true, "value": { "type": "FunctionTypeAnnotation", - "start": 155, - "end": 178, - "loc": { - "start": { - "line": 8, - "column": 2 - }, - "end": { - "line": 8, - "column": 25 - } - }, + "start":155,"end":178,"loc":{"start":{"line":8,"column":2},"end":{"line":8,"column":25}}, "params": [], "rest": null, "typeParameters": { "type": "TypeParameterDeclaration", - "start": 167, - "end": 170, - "loc": { - "start": { - "line": 8, - "column": 14 - }, - "end": { - "line": 8, - "column": 17 - } - }, + "start":167,"end":170,"loc":{"start":{"line":8,"column":14},"end":{"line":8,"column":17}}, "params": [ { "type": "TypeParameter", - "start": 168, - "end": 169, - "loc": { - "start": { - "line": 8, - "column": 15 - }, - "end": { - "line": 8, - "column": 16 - } - }, + "start":168,"end":169,"loc":{"start":{"line":8,"column":15},"end":{"line":8,"column":16}}, "name": "T", "variance": null } @@ -785,51 +271,17 @@ }, "returnType": { "type": "VoidTypeAnnotation", - "start": 174, - "end": 178, - "loc": { - "start": { - "line": 8, - "column": 21 - }, - "end": { - "line": 8, - "column": 25 - } - } + "start":174,"end":178,"loc":{"start":{"line":8,"column":21},"end":{"line":8,"column":25}} } }, "optional": false }, { "type": "ObjectTypeProperty", - "start": 182, - "end": 202, - "loc": { - "start": { - "line": 9, - "column": 2 - }, - "end": { - "line": 9, - "column": 22 - } - }, + "start":182,"end":202,"loc":{"start":{"line":9,"column":2},"end":{"line":9,"column":22}}, "key": { "type": "Identifier", - "start": 189, - "end": 191, - "loc": { - "start": { - "line": 9, - "column": 9 - }, - "end": { - "line": 9, - "column": 11 - }, - "identifierName": "do" - }, + "start":189,"end":191,"loc":{"start":{"line":9,"column":9},"end":{"line":9,"column":11},"identifierName":"do"}, "name": "do" }, "static": true, @@ -838,49 +290,16 @@ "method": true, "value": { "type": "FunctionTypeAnnotation", - "start": 182, - "end": 202, - "loc": { - "start": { - "line": 9, - "column": 2 - }, - "end": { - "line": 9, - "column": 22 - } - }, + "start":182,"end":202,"loc":{"start":{"line":9,"column":2},"end":{"line":9,"column":22}}, "params": [], "rest": null, "typeParameters": { "type": "TypeParameterDeclaration", - "start": 191, - "end": 194, - "loc": { - "start": { - "line": 9, - "column": 11 - }, - "end": { - "line": 9, - "column": 14 - } - }, + "start":191,"end":194,"loc":{"start":{"line":9,"column":11},"end":{"line":9,"column":14}}, "params": [ { "type": "TypeParameter", - "start": 192, - "end": 193, - "loc": { - "start": { - "line": 9, - "column": 12 - }, - "end": { - "line": 9, - "column": 13 - } - }, + "start":192,"end":193,"loc":{"start":{"line":9,"column":12},"end":{"line":9,"column":13}}, "name": "T", "variance": null } @@ -888,18 +307,7 @@ }, "returnType": { "type": "VoidTypeAnnotation", - "start": 198, - "end": 202, - "loc": { - "start": { - "line": 9, - "column": 18 - }, - "end": { - "line": 9, - "column": 22 - } - } + "start":198,"end":202,"loc":{"start":{"line":9,"column":18},"end":{"line":9,"column":22}} } }, "optional": false @@ -912,18 +320,7 @@ }, { "type": "EmptyStatement", - "start": 205, - "end": 206, - "loc": { - "start": { - "line": 10, - "column": 1 - }, - "end": { - "line": 10, - "column": 2 - } - } + "start":205,"end":206,"loc":{"start":{"line":10,"column":1},"end":{"line":10,"column":2}} } ], "directives": [] diff --git a/packages/babel-parser/test/fixtures/flow/type-parameter-declaration/declare-interface-method-reserved-word/output.json b/packages/babel-parser/test/fixtures/flow/type-parameter-declaration/declare-interface-method-reserved-word/output.json index cffd72d465f7..b1a4c4bd1ddc 100644 --- a/packages/babel-parser/test/fixtures/flow/type-parameter-declaration/declare-interface-method-reserved-word/output.json +++ b/packages/babel-parser/test/fixtures/flow/type-parameter-declaration/declare-interface-method-reserved-word/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 103, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 6, - "column": 2 - } - }, + "start":0,"end":103,"loc":{"start":{"line":1,"column":0},"end":{"line":6,"column":2}}, "program": { "type": "Program", - "start": 0, - "end": 103, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 6, - "column": 2 - } - }, + "start":0,"end":103,"loc":{"start":{"line":1,"column":0},"end":{"line":6,"column":2}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "DeclareInterface", - "start": 0, - "end": 102, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 6, - "column": 1 - } - }, + "start":0,"end":102,"loc":{"start":{"line":1,"column":0},"end":{"line":6,"column":1}}, "id": { "type": "Identifier", - "start": 18, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - }, - "identifierName": "X" - }, + "start":18,"end":19,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":19},"identifierName":"X"}, "name": "X" }, "typeParameters": null, @@ -66,49 +21,15 @@ "mixins": [], "body": { "type": "ObjectTypeAnnotation", - "start": 20, - "end": 102, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 6, - "column": 1 - } - }, + "start":20,"end":102,"loc":{"start":{"line":1,"column":20},"end":{"line":6,"column":1}}, "callProperties": [], "properties": [ { "type": "ObjectTypeProperty", - "start": 24, - "end": 41, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 19 - } - }, + "start":24,"end":41,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":19}}, "key": { "type": "Identifier", - "start": 24, - "end": 30, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 8 - }, - "identifierName": "foobar" - }, + "start":24,"end":30,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":8},"identifierName":"foobar"}, "name": "foobar" }, "static": false, @@ -117,49 +38,16 @@ "method": true, "value": { "type": "FunctionTypeAnnotation", - "start": 24, - "end": 41, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 19 - } - }, + "start":24,"end":41,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":19}}, "params": [], "rest": null, "typeParameters": { "type": "TypeParameterDeclaration", - "start": 30, - "end": 33, - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 11 - } - }, + "start":30,"end":33,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":11}}, "params": [ { "type": "TypeParameter", - "start": 31, - "end": 32, - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 10 - } - }, + "start":31,"end":32,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":10}}, "name": "T", "variance": null } @@ -167,51 +55,17 @@ }, "returnType": { "type": "VoidTypeAnnotation", - "start": 37, - "end": 41, - "loc": { - "start": { - "line": 2, - "column": 15 - }, - "end": { - "line": 2, - "column": 19 - } - } + "start":37,"end":41,"loc":{"start":{"line":2,"column":15},"end":{"line":2,"column":19}} } }, "optional": false }, { "type": "ObjectTypeProperty", - "start": 45, - "end": 62, - "loc": { - "start": { - "line": 3, - "column": 2 - }, - "end": { - "line": 3, - "column": 19 - } - }, + "start":45,"end":62,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":19}}, "key": { "type": "Identifier", - "start": 45, - "end": 51, - "loc": { - "start": { - "line": 3, - "column": 2 - }, - "end": { - "line": 3, - "column": 8 - }, - "identifierName": "delete" - }, + "start":45,"end":51,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":8},"identifierName":"delete"}, "name": "delete" }, "static": false, @@ -220,49 +74,16 @@ "method": true, "value": { "type": "FunctionTypeAnnotation", - "start": 45, - "end": 62, - "loc": { - "start": { - "line": 3, - "column": 2 - }, - "end": { - "line": 3, - "column": 19 - } - }, + "start":45,"end":62,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":19}}, "params": [], "rest": null, "typeParameters": { "type": "TypeParameterDeclaration", - "start": 51, - "end": 54, - "loc": { - "start": { - "line": 3, - "column": 8 - }, - "end": { - "line": 3, - "column": 11 - } - }, + "start":51,"end":54,"loc":{"start":{"line":3,"column":8},"end":{"line":3,"column":11}}, "params": [ { "type": "TypeParameter", - "start": 52, - "end": 53, - "loc": { - "start": { - "line": 3, - "column": 9 - }, - "end": { - "line": 3, - "column": 10 - } - }, + "start":52,"end":53,"loc":{"start":{"line":3,"column":9},"end":{"line":3,"column":10}}, "name": "T", "variance": null } @@ -270,51 +91,17 @@ }, "returnType": { "type": "VoidTypeAnnotation", - "start": 58, - "end": 62, - "loc": { - "start": { - "line": 3, - "column": 15 - }, - "end": { - "line": 3, - "column": 19 - } - } + "start":58,"end":62,"loc":{"start":{"line":3,"column":15},"end":{"line":3,"column":19}} } }, "optional": false }, { "type": "ObjectTypeProperty", - "start": 66, - "end": 82, - "loc": { - "start": { - "line": 4, - "column": 2 - }, - "end": { - "line": 4, - "column": 18 - } - }, + "start":66,"end":82,"loc":{"start":{"line":4,"column":2},"end":{"line":4,"column":18}}, "key": { "type": "Identifier", - "start": 66, - "end": 71, - "loc": { - "start": { - "line": 4, - "column": 2 - }, - "end": { - "line": 4, - "column": 7 - }, - "identifierName": "yield" - }, + "start":66,"end":71,"loc":{"start":{"line":4,"column":2},"end":{"line":4,"column":7},"identifierName":"yield"}, "name": "yield" }, "static": false, @@ -323,49 +110,16 @@ "method": true, "value": { "type": "FunctionTypeAnnotation", - "start": 66, - "end": 82, - "loc": { - "start": { - "line": 4, - "column": 2 - }, - "end": { - "line": 4, - "column": 18 - } - }, + "start":66,"end":82,"loc":{"start":{"line":4,"column":2},"end":{"line":4,"column":18}}, "params": [], "rest": null, "typeParameters": { "type": "TypeParameterDeclaration", - "start": 71, - "end": 74, - "loc": { - "start": { - "line": 4, - "column": 7 - }, - "end": { - "line": 4, - "column": 10 - } - }, + "start":71,"end":74,"loc":{"start":{"line":4,"column":7},"end":{"line":4,"column":10}}, "params": [ { "type": "TypeParameter", - "start": 72, - "end": 73, - "loc": { - "start": { - "line": 4, - "column": 8 - }, - "end": { - "line": 4, - "column": 9 - } - }, + "start":72,"end":73,"loc":{"start":{"line":4,"column":8},"end":{"line":4,"column":9}}, "name": "T", "variance": null } @@ -373,51 +127,17 @@ }, "returnType": { "type": "VoidTypeAnnotation", - "start": 78, - "end": 82, - "loc": { - "start": { - "line": 4, - "column": 14 - }, - "end": { - "line": 4, - "column": 18 - } - } + "start":78,"end":82,"loc":{"start":{"line":4,"column":14},"end":{"line":4,"column":18}} } }, "optional": false }, { "type": "ObjectTypeProperty", - "start": 86, - "end": 99, - "loc": { - "start": { - "line": 5, - "column": 2 - }, - "end": { - "line": 5, - "column": 15 - } - }, + "start":86,"end":99,"loc":{"start":{"line":5,"column":2},"end":{"line":5,"column":15}}, "key": { "type": "Identifier", - "start": 86, - "end": 88, - "loc": { - "start": { - "line": 5, - "column": 2 - }, - "end": { - "line": 5, - "column": 4 - }, - "identifierName": "do" - }, + "start":86,"end":88,"loc":{"start":{"line":5,"column":2},"end":{"line":5,"column":4},"identifierName":"do"}, "name": "do" }, "static": false, @@ -426,49 +146,16 @@ "method": true, "value": { "type": "FunctionTypeAnnotation", - "start": 86, - "end": 99, - "loc": { - "start": { - "line": 5, - "column": 2 - }, - "end": { - "line": 5, - "column": 15 - } - }, + "start":86,"end":99,"loc":{"start":{"line":5,"column":2},"end":{"line":5,"column":15}}, "params": [], "rest": null, "typeParameters": { "type": "TypeParameterDeclaration", - "start": 88, - "end": 91, - "loc": { - "start": { - "line": 5, - "column": 4 - }, - "end": { - "line": 5, - "column": 7 - } - }, + "start":88,"end":91,"loc":{"start":{"line":5,"column":4},"end":{"line":5,"column":7}}, "params": [ { "type": "TypeParameter", - "start": 89, - "end": 90, - "loc": { - "start": { - "line": 5, - "column": 5 - }, - "end": { - "line": 5, - "column": 6 - } - }, + "start":89,"end":90,"loc":{"start":{"line":5,"column":5},"end":{"line":5,"column":6}}, "name": "T", "variance": null } @@ -476,18 +163,7 @@ }, "returnType": { "type": "VoidTypeAnnotation", - "start": 95, - "end": 99, - "loc": { - "start": { - "line": 5, - "column": 11 - }, - "end": { - "line": 5, - "column": 15 - } - } + "start":95,"end":99,"loc":{"start":{"line":5,"column":11},"end":{"line":5,"column":15}} } }, "optional": false @@ -500,18 +176,7 @@ }, { "type": "EmptyStatement", - "start": 102, - "end": 103, - "loc": { - "start": { - "line": 6, - "column": 1 - }, - "end": { - "line": 6, - "column": 2 - } - } + "start":102,"end":103,"loc":{"start":{"line":6,"column":1},"end":{"line":6,"column":2}} } ], "directives": [] diff --git a/packages/babel-parser/test/fixtures/flow/type-parameter-declaration/default-invalid-class-extends/options.json b/packages/babel-parser/test/fixtures/flow/type-parameter-declaration/default-invalid-class-extends/options.json index 6f017e5a5919..81e7a97e3f7e 100644 --- a/packages/babel-parser/test/fixtures/flow/type-parameter-declaration/default-invalid-class-extends/options.json +++ b/packages/babel-parser/test/fixtures/flow/type-parameter-declaration/default-invalid-class-extends/options.json @@ -1,3 +1,3 @@ { "throws": "Unexpected token, expected \",\" (1:20)" -} \ No newline at end of file +} diff --git a/packages/babel-parser/test/fixtures/flow/type-parameter-declaration/default-invalid-declare-func/options.json b/packages/babel-parser/test/fixtures/flow/type-parameter-declaration/default-invalid-declare-func/options.json index 161afd296dc4..4d9531c1b174 100644 --- a/packages/babel-parser/test/fixtures/flow/type-parameter-declaration/default-invalid-declare-func/options.json +++ b/packages/babel-parser/test/fixtures/flow/type-parameter-declaration/default-invalid-declare-func/options.json @@ -1,3 +1,3 @@ { "throws": "Unexpected token, expected \":\" (1:35)" -} \ No newline at end of file +} diff --git a/packages/babel-parser/test/fixtures/flow/type-parameter-declaration/default-invalid-var-type/options.json b/packages/babel-parser/test/fixtures/flow/type-parameter-declaration/default-invalid-var-type/options.json index fbfad415eebf..e3427614a192 100644 --- a/packages/babel-parser/test/fixtures/flow/type-parameter-declaration/default-invalid-var-type/options.json +++ b/packages/babel-parser/test/fixtures/flow/type-parameter-declaration/default-invalid-var-type/options.json @@ -1,3 +1,3 @@ { "throws": "Unexpected token, expected \",\" (1:15)" -} \ No newline at end of file +} diff --git a/packages/babel-parser/test/fixtures/flow/type-parameter-declaration/default-missing/options.json b/packages/babel-parser/test/fixtures/flow/type-parameter-declaration/default-missing/options.json deleted file mode 100644 index 022607b81797..000000000000 --- a/packages/babel-parser/test/fixtures/flow/type-parameter-declaration/default-missing/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Type parameter declaration needs a default, since a preceding type parameter declaration has a default. (1:28)" -} diff --git a/packages/babel-parser/test/fixtures/flow/type-parameter-declaration/default-missing/output.json b/packages/babel-parser/test/fixtures/flow/type-parameter-declaration/default-missing/output.json new file mode 100644 index 000000000000..127bd9282556 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/type-parameter-declaration/default-missing/output.json @@ -0,0 +1,57 @@ +{ + "type": "File", + "start":0,"end":43,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":43}}, + "errors": [ + "SyntaxError: Type parameter declaration needs a default, since a preceding type parameter declaration has a default. (1:28)" + ], + "program": { + "type": "Program", + "start":0,"end":43,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":43}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "TypeAlias", + "start":0,"end":43,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":43}}, + "id": { + "type": "Identifier", + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"A"}, + "name": "A" + }, + "typeParameters": { + "type": "TypeParameterDeclaration", + "start":6,"end":38,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":38}}, + "params": [ + { + "type": "TypeParameter", + "start":7,"end":26,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":26}}, + "name": "HasDefault", + "variance": null, + "default": { + "type": "StringTypeAnnotation", + "start":20,"end":26,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":26}} + } + }, + { + "type": "TypeParameter", + "start":28,"end":37,"loc":{"start":{"line":1,"column":28},"end":{"line":1,"column":37}}, + "name": "NoDefault", + "variance": null + } + ] + }, + "right": { + "type": "GenericTypeAnnotation", + "start":41,"end":42,"loc":{"start":{"line":1,"column":41},"end":{"line":1,"column":42}}, + "typeParameters": null, + "id": { + "type": "Identifier", + "start":41,"end":42,"loc":{"start":{"line":1,"column":41},"end":{"line":1,"column":42},"identifierName":"T"}, + "name": "T" + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/type-parameter-declaration/default/output.json b/packages/babel-parser/test/fixtures/flow/type-parameter-declaration/default/output.json index 8b2db5858c66..767a8b87545a 100644 --- a/packages/babel-parser/test/fixtures/flow/type-parameter-declaration/default/output.json +++ b/packages/babel-parser/test/fixtures/flow/type-parameter-declaration/default/output.json @@ -1,864 +1,259 @@ { "type": "File", - "start": 0, - "end": 1009, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 32, - "column": 22 - } - }, + "start":0,"end":1009,"loc":{"start":{"line":1,"column":0},"end":{"line":32,"column":22}}, "program": { "type": "Program", - "start": 0, - "end": 1009, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 32, - "column": 22 - } - }, + "start":0,"end":1009,"loc":{"start":{"line":1,"column":0},"end":{"line":32,"column":22}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "TypeAlias", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "id": { "type": "Identifier", - "start": 5, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "A1" - }, + "start":5,"end":7,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":7},"identifierName":"A1"}, "name": "A1" }, "typeParameters": { "type": "TypeParameterDeclaration", - "start": 7, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":7,"end":19,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":19}}, "params": [ { "type": "TypeParameter", - "start": 8, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":8,"end":18,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":18}}, "name": "T", "variance": null, "default": { "type": "StringTypeAnnotation", - "start": 12, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 18 - } - } + "start":12,"end":18,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":18}} } } ] }, "right": { "type": "GenericTypeAnnotation", - "start": 22, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":22,"end":23,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":23}}, "typeParameters": null, "id": { "type": "Identifier", - "start": 22, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 23 - }, - "identifierName": "T" - }, + "start":22,"end":23,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":23},"identifierName":"T"}, "name": "T" } } }, { "type": "TypeAlias", - "start": 24, - "end": 42, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 18 - } - }, + "start":24,"end":42,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":18}}, "id": { "type": "Identifier", - "start": 29, - "end": 31, - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 7 - }, - "identifierName": "A2" - }, + "start":29,"end":31,"loc":{"start":{"line":2,"column":5},"end":{"line":2,"column":7},"identifierName":"A2"}, "name": "A2" }, "typeParameters": { "type": "TypeParameterDeclaration", - "start": 31, - "end": 38, - "loc": { - "start": { - "line": 2, - "column": 7 - }, - "end": { - "line": 2, - "column": 14 - } - }, + "start":31,"end":38,"loc":{"start":{"line":2,"column":7},"end":{"line":2,"column":14}}, "params": [ { "type": "TypeParameter", - "start": 32, - "end": 37, - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 13 - } - }, + "start":32,"end":37,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":13}}, "name": "T", "variance": null, "default": { "type": "ExistsTypeAnnotation", - "start": 36, - "end": 37, - "loc": { - "start": { - "line": 2, - "column": 12 - }, - "end": { - "line": 2, - "column": 13 - } - } + "start":36,"end":37,"loc":{"start":{"line":2,"column":12},"end":{"line":2,"column":13}} } } ] }, "right": { "type": "GenericTypeAnnotation", - "start": 41, - "end": 42, - "loc": { - "start": { - "line": 2, - "column": 17 - }, - "end": { - "line": 2, - "column": 18 - } - }, + "start":41,"end":42,"loc":{"start":{"line":2,"column":17},"end":{"line":2,"column":18}}, "typeParameters": null, "id": { "type": "Identifier", - "start": 41, - "end": 42, - "loc": { - "start": { - "line": 2, - "column": 17 - }, - "end": { - "line": 2, - "column": 18 - }, - "identifierName": "T" - }, + "start":41,"end":42,"loc":{"start":{"line":2,"column":17},"end":{"line":2,"column":18},"identifierName":"T"}, "name": "T" } } }, { "type": "TypeAlias", - "start": 43, - "end": 75, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 32 - } - }, + "start":43,"end":75,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":32}}, "id": { "type": "Identifier", - "start": 48, - "end": 50, - "loc": { - "start": { - "line": 3, - "column": 5 - }, - "end": { - "line": 3, - "column": 7 - }, - "identifierName": "A3" - }, + "start":48,"end":50,"loc":{"start":{"line":3,"column":5},"end":{"line":3,"column":7},"identifierName":"A3"}, "name": "A3" }, "typeParameters": { "type": "TypeParameterDeclaration", - "start": 50, - "end": 71, - "loc": { - "start": { - "line": 3, - "column": 7 - }, - "end": { - "line": 3, - "column": 28 - } - }, + "start":50,"end":71,"loc":{"start":{"line":3,"column":7},"end":{"line":3,"column":28}}, "params": [ { "type": "TypeParameter", - "start": 51, - "end": 70, - "loc": { - "start": { - "line": 3, - "column": 8 - }, - "end": { - "line": 3, - "column": 27 - } - }, + "start":51,"end":70,"loc":{"start":{"line":3,"column":8},"end":{"line":3,"column":27}}, "name": "T", "variance": null, "bound": { "type": "TypeAnnotation", - "start": 52, - "end": 61, - "loc": { - "start": { - "line": 3, - "column": 9 - }, - "end": { - "line": 3, - "column": 18 - } - }, + "start":52,"end":61,"loc":{"start":{"line":3,"column":9},"end":{"line":3,"column":18}}, "typeAnnotation": { "type": "NullableTypeAnnotation", - "start": 54, - "end": 61, - "loc": { - "start": { - "line": 3, - "column": 11 - }, - "end": { - "line": 3, - "column": 18 - } - }, + "start":54,"end":61,"loc":{"start":{"line":3,"column":11},"end":{"line":3,"column":18}}, "typeAnnotation": { "type": "StringTypeAnnotation", - "start": 55, - "end": 61, - "loc": { - "start": { - "line": 3, - "column": 12 - }, - "end": { - "line": 3, - "column": 18 - } - } + "start":55,"end":61,"loc":{"start":{"line":3,"column":12},"end":{"line":3,"column":18}} } } }, "default": { "type": "StringTypeAnnotation", - "start": 64, - "end": 70, - "loc": { - "start": { - "line": 3, - "column": 21 - }, - "end": { - "line": 3, - "column": 27 - } - } + "start":64,"end":70,"loc":{"start":{"line":3,"column":21},"end":{"line":3,"column":27}} } } ] }, "right": { "type": "GenericTypeAnnotation", - "start": 74, - "end": 75, - "loc": { - "start": { - "line": 3, - "column": 31 - }, - "end": { - "line": 3, - "column": 32 - } - }, + "start":74,"end":75,"loc":{"start":{"line":3,"column":31},"end":{"line":3,"column":32}}, "typeParameters": null, "id": { "type": "Identifier", - "start": 74, - "end": 75, - "loc": { - "start": { - "line": 3, - "column": 31 - }, - "end": { - "line": 3, - "column": 32 - }, - "identifierName": "T" - }, + "start":74,"end":75,"loc":{"start":{"line":3,"column":31},"end":{"line":3,"column":32},"identifierName":"T"}, "name": "T" } } }, { "type": "TypeAlias", - "start": 76, - "end": 111, - "loc": { - "start": { - "line": 4, - "column": 0 - }, - "end": { - "line": 4, - "column": 35 - } - }, + "start":76,"end":111,"loc":{"start":{"line":4,"column":0},"end":{"line":4,"column":35}}, "id": { "type": "Identifier", - "start": 81, - "end": 83, - "loc": { - "start": { - "line": 4, - "column": 5 - }, - "end": { - "line": 4, - "column": 7 - }, - "identifierName": "A4" - }, + "start":81,"end":83,"loc":{"start":{"line":4,"column":5},"end":{"line":4,"column":7},"identifierName":"A4"}, "name": "A4" }, "typeParameters": { "type": "TypeParameterDeclaration", - "start": 83, - "end": 107, - "loc": { - "start": { - "line": 4, - "column": 7 - }, - "end": { - "line": 4, - "column": 31 - } - }, + "start":83,"end":107,"loc":{"start":{"line":4,"column":7},"end":{"line":4,"column":31}}, "params": [ { "type": "TypeParameter", - "start": 84, - "end": 85, - "loc": { - "start": { - "line": 4, - "column": 8 - }, - "end": { - "line": 4, - "column": 9 - } - }, + "start":84,"end":85,"loc":{"start":{"line":4,"column":8},"end":{"line":4,"column":9}}, "name": "S", "variance": null }, { "type": "TypeParameter", - "start": 87, - "end": 106, - "loc": { - "start": { - "line": 4, - "column": 11 - }, - "end": { - "line": 4, - "column": 30 - } - }, + "start":87,"end":106,"loc":{"start":{"line":4,"column":11},"end":{"line":4,"column":30}}, "name": "T", "variance": null, "bound": { "type": "TypeAnnotation", - "start": 88, - "end": 97, - "loc": { - "start": { - "line": 4, - "column": 12 - }, - "end": { - "line": 4, - "column": 21 - } - }, + "start":88,"end":97,"loc":{"start":{"line":4,"column":12},"end":{"line":4,"column":21}}, "typeAnnotation": { "type": "NullableTypeAnnotation", - "start": 90, - "end": 97, - "loc": { - "start": { - "line": 4, - "column": 14 - }, - "end": { - "line": 4, - "column": 21 - } - }, + "start":90,"end":97,"loc":{"start":{"line":4,"column":14},"end":{"line":4,"column":21}}, "typeAnnotation": { "type": "StringTypeAnnotation", - "start": 91, - "end": 97, - "loc": { - "start": { - "line": 4, - "column": 15 - }, - "end": { - "line": 4, - "column": 21 - } - } + "start":91,"end":97,"loc":{"start":{"line":4,"column":15},"end":{"line":4,"column":21}} } } }, "default": { "type": "StringTypeAnnotation", - "start": 100, - "end": 106, - "loc": { - "start": { - "line": 4, - "column": 24 - }, - "end": { - "line": 4, - "column": 30 - } - } + "start":100,"end":106,"loc":{"start":{"line":4,"column":24},"end":{"line":4,"column":30}} } } ] }, "right": { "type": "GenericTypeAnnotation", - "start": 110, - "end": 111, - "loc": { - "start": { - "line": 4, - "column": 34 - }, - "end": { - "line": 4, - "column": 35 - } - }, + "start":110,"end":111,"loc":{"start":{"line":4,"column":34},"end":{"line":4,"column":35}}, "typeParameters": null, "id": { "type": "Identifier", - "start": 110, - "end": 111, - "loc": { - "start": { - "line": 4, - "column": 34 - }, - "end": { - "line": 4, - "column": 35 - }, - "identifierName": "T" - }, + "start":110,"end":111,"loc":{"start":{"line":4,"column":34},"end":{"line":4,"column":35},"identifierName":"T"}, "name": "T" } } }, { "type": "TypeAlias", - "start": 112, - "end": 156, - "loc": { - "start": { - "line": 5, - "column": 0 - }, - "end": { - "line": 5, - "column": 44 - } - }, + "start":112,"end":156,"loc":{"start":{"line":5,"column":0},"end":{"line":5,"column":44}}, "id": { "type": "Identifier", - "start": 117, - "end": 119, - "loc": { - "start": { - "line": 5, - "column": 5 - }, - "end": { - "line": 5, - "column": 7 - }, - "identifierName": "A5" - }, + "start":117,"end":119,"loc":{"start":{"line":5,"column":5},"end":{"line":5,"column":7},"identifierName":"A5"}, "name": "A5" }, "typeParameters": { "type": "TypeParameterDeclaration", - "start": 119, - "end": 152, - "loc": { - "start": { - "line": 5, - "column": 7 - }, - "end": { - "line": 5, - "column": 40 - } - }, + "start":119,"end":152,"loc":{"start":{"line":5,"column":7},"end":{"line":5,"column":40}}, "params": [ { "type": "TypeParameter", - "start": 120, - "end": 130, - "loc": { - "start": { - "line": 5, - "column": 8 - }, - "end": { - "line": 5, - "column": 18 - } - }, + "start":120,"end":130,"loc":{"start":{"line":5,"column":8},"end":{"line":5,"column":18}}, "name": "S", "variance": null, "default": { "type": "NumberTypeAnnotation", - "start": 124, - "end": 130, - "loc": { - "start": { - "line": 5, - "column": 12 - }, - "end": { - "line": 5, - "column": 18 - } - } + "start":124,"end":130,"loc":{"start":{"line":5,"column":12},"end":{"line":5,"column":18}} } }, { "type": "TypeParameter", - "start": 132, - "end": 151, - "loc": { - "start": { - "line": 5, - "column": 20 - }, - "end": { - "line": 5, - "column": 39 - } - }, + "start":132,"end":151,"loc":{"start":{"line":5,"column":20},"end":{"line":5,"column":39}}, "name": "T", "variance": null, "bound": { "type": "TypeAnnotation", - "start": 133, - "end": 142, - "loc": { - "start": { - "line": 5, - "column": 21 - }, - "end": { - "line": 5, - "column": 30 - } - }, + "start":133,"end":142,"loc":{"start":{"line":5,"column":21},"end":{"line":5,"column":30}}, "typeAnnotation": { "type": "NullableTypeAnnotation", - "start": 135, - "end": 142, - "loc": { - "start": { - "line": 5, - "column": 23 - }, - "end": { - "line": 5, - "column": 30 - } - }, + "start":135,"end":142,"loc":{"start":{"line":5,"column":23},"end":{"line":5,"column":30}}, "typeAnnotation": { "type": "StringTypeAnnotation", - "start": 136, - "end": 142, - "loc": { - "start": { - "line": 5, - "column": 24 - }, - "end": { - "line": 5, - "column": 30 - } - } + "start":136,"end":142,"loc":{"start":{"line":5,"column":24},"end":{"line":5,"column":30}} } } }, "default": { "type": "StringTypeAnnotation", - "start": 145, - "end": 151, - "loc": { - "start": { - "line": 5, - "column": 33 - }, - "end": { - "line": 5, - "column": 39 - } - } + "start":145,"end":151,"loc":{"start":{"line":5,"column":33},"end":{"line":5,"column":39}} } } ] }, "right": { "type": "GenericTypeAnnotation", - "start": 155, - "end": 156, - "loc": { - "start": { - "line": 5, - "column": 43 - }, - "end": { - "line": 5, - "column": 44 - } - }, + "start":155,"end":156,"loc":{"start":{"line":5,"column":43},"end":{"line":5,"column":44}}, "typeParameters": null, "id": { "type": "Identifier", - "start": 155, - "end": 156, - "loc": { - "start": { - "line": 5, - "column": 43 - }, - "end": { - "line": 5, - "column": 44 - }, - "identifierName": "T" - }, + "start":155,"end":156,"loc":{"start":{"line":5,"column":43},"end":{"line":5,"column":44},"identifierName":"T"}, "name": "T" } } }, { "type": "ClassDeclaration", - "start": 157, - "end": 180, - "loc": { - "start": { - "line": 6, - "column": 0 - }, - "end": { - "line": 6, - "column": 23 - } - }, + "start":157,"end":180,"loc":{"start":{"line":6,"column":0},"end":{"line":6,"column":23}}, "id": { "type": "Identifier", - "start": 163, - "end": 165, - "loc": { - "start": { - "line": 6, - "column": 6 - }, - "end": { - "line": 6, - "column": 8 - }, - "identifierName": "A6" - }, + "start":163,"end":165,"loc":{"start":{"line":6,"column":6},"end":{"line":6,"column":8},"identifierName":"A6"}, "name": "A6" }, "typeParameters": { "type": "TypeParameterDeclaration", - "start": 165, - "end": 177, - "loc": { - "start": { - "line": 6, - "column": 8 - }, - "end": { - "line": 6, - "column": 20 - } - }, + "start":165,"end":177,"loc":{"start":{"line":6,"column":8},"end":{"line":6,"column":20}}, "params": [ { "type": "TypeParameter", - "start": 166, - "end": 176, - "loc": { - "start": { - "line": 6, - "column": 9 - }, - "end": { - "line": 6, - "column": 19 - } - }, + "start":166,"end":176,"loc":{"start":{"line":6,"column":9},"end":{"line":6,"column":19}}, "name": "T", "variance": null, "default": { "type": "StringTypeAnnotation", - "start": 170, - "end": 176, - "loc": { - "start": { - "line": 6, - "column": 13 - }, - "end": { - "line": 6, - "column": 19 - } - } + "start":170,"end":176,"loc":{"start":{"line":6,"column":13},"end":{"line":6,"column":19}} } } ] @@ -866,142 +261,42 @@ "superClass": null, "body": { "type": "ClassBody", - "start": 178, - "end": 180, - "loc": { - "start": { - "line": 6, - "column": 21 - }, - "end": { - "line": 6, - "column": 23 - } - }, + "start":178,"end":180,"loc":{"start":{"line":6,"column":21},"end":{"line":6,"column":23}}, "body": [] } }, { "type": "ClassDeclaration", - "start": 181, - "end": 213, - "loc": { - "start": { - "line": 7, - "column": 0 - }, - "end": { - "line": 7, - "column": 32 - } - }, + "start":181,"end":213,"loc":{"start":{"line":7,"column":0},"end":{"line":7,"column":32}}, "id": { "type": "Identifier", - "start": 187, - "end": 189, - "loc": { - "start": { - "line": 7, - "column": 6 - }, - "end": { - "line": 7, - "column": 8 - }, - "identifierName": "A7" - }, + "start":187,"end":189,"loc":{"start":{"line":7,"column":6},"end":{"line":7,"column":8},"identifierName":"A7"}, "name": "A7" }, "typeParameters": { "type": "TypeParameterDeclaration", - "start": 189, - "end": 210, - "loc": { - "start": { - "line": 7, - "column": 8 - }, - "end": { - "line": 7, - "column": 29 - } - }, + "start":189,"end":210,"loc":{"start":{"line":7,"column":8},"end":{"line":7,"column":29}}, "params": [ { "type": "TypeParameter", - "start": 190, - "end": 209, - "loc": { - "start": { - "line": 7, - "column": 9 - }, - "end": { - "line": 7, - "column": 28 - } - }, + "start":190,"end":209,"loc":{"start":{"line":7,"column":9},"end":{"line":7,"column":28}}, "name": "T", "variance": null, "bound": { "type": "TypeAnnotation", - "start": 191, - "end": 200, - "loc": { - "start": { - "line": 7, - "column": 10 - }, - "end": { - "line": 7, - "column": 19 - } - }, + "start":191,"end":200,"loc":{"start":{"line":7,"column":10},"end":{"line":7,"column":19}}, "typeAnnotation": { "type": "NullableTypeAnnotation", - "start": 193, - "end": 200, - "loc": { - "start": { - "line": 7, - "column": 12 - }, - "end": { - "line": 7, - "column": 19 - } - }, + "start":193,"end":200,"loc":{"start":{"line":7,"column":12},"end":{"line":7,"column":19}}, "typeAnnotation": { "type": "StringTypeAnnotation", - "start": 194, - "end": 200, - "loc": { - "start": { - "line": 7, - "column": 13 - }, - "end": { - "line": 7, - "column": 19 - } - } + "start":194,"end":200,"loc":{"start":{"line":7,"column":13},"end":{"line":7,"column":19}} } } }, "default": { "type": "StringTypeAnnotation", - "start": 203, - "end": 209, - "loc": { - "start": { - "line": 7, - "column": 22 - }, - "end": { - "line": 7, - "column": 28 - } - } + "start":203,"end":209,"loc":{"start":{"line":7,"column":22},"end":{"line":7,"column":28}} } } ] @@ -1009,159 +304,48 @@ "superClass": null, "body": { "type": "ClassBody", - "start": 211, - "end": 213, - "loc": { - "start": { - "line": 7, - "column": 30 - }, - "end": { - "line": 7, - "column": 32 - } - }, + "start":211,"end":213,"loc":{"start":{"line":7,"column":30},"end":{"line":7,"column":32}}, "body": [] } }, { "type": "ClassDeclaration", - "start": 214, - "end": 249, - "loc": { - "start": { - "line": 8, - "column": 0 - }, - "end": { - "line": 8, - "column": 35 - } - }, + "start":214,"end":249,"loc":{"start":{"line":8,"column":0},"end":{"line":8,"column":35}}, "id": { "type": "Identifier", - "start": 220, - "end": 222, - "loc": { - "start": { - "line": 8, - "column": 6 - }, - "end": { - "line": 8, - "column": 8 - }, - "identifierName": "A8" - }, + "start":220,"end":222,"loc":{"start":{"line":8,"column":6},"end":{"line":8,"column":8},"identifierName":"A8"}, "name": "A8" }, "typeParameters": { "type": "TypeParameterDeclaration", - "start": 222, - "end": 246, - "loc": { - "start": { - "line": 8, - "column": 8 - }, - "end": { - "line": 8, - "column": 32 - } - }, + "start":222,"end":246,"loc":{"start":{"line":8,"column":8},"end":{"line":8,"column":32}}, "params": [ { "type": "TypeParameter", - "start": 223, - "end": 224, - "loc": { - "start": { - "line": 8, - "column": 9 - }, - "end": { - "line": 8, - "column": 10 - } - }, + "start":223,"end":224,"loc":{"start":{"line":8,"column":9},"end":{"line":8,"column":10}}, "name": "S", "variance": null }, { "type": "TypeParameter", - "start": 226, - "end": 245, - "loc": { - "start": { - "line": 8, - "column": 12 - }, - "end": { - "line": 8, - "column": 31 - } - }, + "start":226,"end":245,"loc":{"start":{"line":8,"column":12},"end":{"line":8,"column":31}}, "name": "T", "variance": null, "bound": { "type": "TypeAnnotation", - "start": 227, - "end": 236, - "loc": { - "start": { - "line": 8, - "column": 13 - }, - "end": { - "line": 8, - "column": 22 - } - }, + "start":227,"end":236,"loc":{"start":{"line":8,"column":13},"end":{"line":8,"column":22}}, "typeAnnotation": { "type": "NullableTypeAnnotation", - "start": 229, - "end": 236, - "loc": { - "start": { - "line": 8, - "column": 15 - }, - "end": { - "line": 8, - "column": 22 - } - }, + "start":229,"end":236,"loc":{"start":{"line":8,"column":15},"end":{"line":8,"column":22}}, "typeAnnotation": { "type": "StringTypeAnnotation", - "start": 230, - "end": 236, - "loc": { - "start": { - "line": 8, - "column": 16 - }, - "end": { - "line": 8, - "column": 22 - } - } + "start":230,"end":236,"loc":{"start":{"line":8,"column":16},"end":{"line":8,"column":22}} } } }, "default": { "type": "StringTypeAnnotation", - "start": 239, - "end": 245, - "loc": { - "start": { - "line": 8, - "column": 25 - }, - "end": { - "line": 8, - "column": 31 - } - } + "start":239,"end":245,"loc":{"start":{"line":8,"column":25},"end":{"line":8,"column":31}} } } ] @@ -1169,174 +353,52 @@ "superClass": null, "body": { "type": "ClassBody", - "start": 247, - "end": 249, - "loc": { - "start": { - "line": 8, - "column": 33 - }, - "end": { - "line": 8, - "column": 35 - } - }, + "start":247,"end":249,"loc":{"start":{"line":8,"column":33},"end":{"line":8,"column":35}}, "body": [] } }, { "type": "ClassDeclaration", - "start": 250, - "end": 294, - "loc": { - "start": { - "line": 9, - "column": 0 - }, - "end": { - "line": 9, - "column": 44 - } - }, + "start":250,"end":294,"loc":{"start":{"line":9,"column":0},"end":{"line":9,"column":44}}, "id": { "type": "Identifier", - "start": 256, - "end": 258, - "loc": { - "start": { - "line": 9, - "column": 6 - }, - "end": { - "line": 9, - "column": 8 - }, - "identifierName": "A9" - }, + "start":256,"end":258,"loc":{"start":{"line":9,"column":6},"end":{"line":9,"column":8},"identifierName":"A9"}, "name": "A9" }, "typeParameters": { "type": "TypeParameterDeclaration", - "start": 258, - "end": 291, - "loc": { - "start": { - "line": 9, - "column": 8 - }, - "end": { - "line": 9, - "column": 41 - } - }, + "start":258,"end":291,"loc":{"start":{"line":9,"column":8},"end":{"line":9,"column":41}}, "params": [ { "type": "TypeParameter", - "start": 259, - "end": 269, - "loc": { - "start": { - "line": 9, - "column": 9 - }, - "end": { - "line": 9, - "column": 19 - } - }, + "start":259,"end":269,"loc":{"start":{"line":9,"column":9},"end":{"line":9,"column":19}}, "name": "S", "variance": null, "default": { "type": "NumberTypeAnnotation", - "start": 263, - "end": 269, - "loc": { - "start": { - "line": 9, - "column": 13 - }, - "end": { - "line": 9, - "column": 19 - } - } + "start":263,"end":269,"loc":{"start":{"line":9,"column":13},"end":{"line":9,"column":19}} } }, { "type": "TypeParameter", - "start": 271, - "end": 290, - "loc": { - "start": { - "line": 9, - "column": 21 - }, - "end": { - "line": 9, - "column": 40 - } - }, + "start":271,"end":290,"loc":{"start":{"line":9,"column":21},"end":{"line":9,"column":40}}, "name": "T", "variance": null, "bound": { "type": "TypeAnnotation", - "start": 272, - "end": 281, - "loc": { - "start": { - "line": 9, - "column": 22 - }, - "end": { - "line": 9, - "column": 31 - } - }, + "start":272,"end":281,"loc":{"start":{"line":9,"column":22},"end":{"line":9,"column":31}}, "typeAnnotation": { "type": "NullableTypeAnnotation", - "start": 274, - "end": 281, - "loc": { - "start": { - "line": 9, - "column": 24 - }, - "end": { - "line": 9, - "column": 31 - } - }, + "start":274,"end":281,"loc":{"start":{"line":9,"column":24},"end":{"line":9,"column":31}}, "typeAnnotation": { "type": "StringTypeAnnotation", - "start": 275, - "end": 281, - "loc": { - "start": { - "line": 9, - "column": 25 - }, - "end": { - "line": 9, - "column": 31 - } - } + "start":275,"end":281,"loc":{"start":{"line":9,"column":25},"end":{"line":9,"column":31}} } } }, "default": { "type": "StringTypeAnnotation", - "start": 284, - "end": 290, - "loc": { - "start": { - "line": 9, - "column": 34 - }, - "end": { - "line": 9, - "column": 40 - } - } + "start":284,"end":290,"loc":{"start":{"line":9,"column":34},"end":{"line":9,"column":40}} } } ] @@ -1344,126 +406,37 @@ "superClass": null, "body": { "type": "ClassBody", - "start": 292, - "end": 294, - "loc": { - "start": { - "line": 9, - "column": 42 - }, - "end": { - "line": 9, - "column": 44 - } - }, + "start":292,"end":294,"loc":{"start":{"line":9,"column":42},"end":{"line":9,"column":44}}, "body": [] } }, { "type": "EmptyStatement", - "start": 295, - "end": 296, - "loc": { - "start": { - "line": 10, - "column": 0 - }, - "end": { - "line": 10, - "column": 1 - } - } + "start":295,"end":296,"loc":{"start":{"line":10,"column":0},"end":{"line":10,"column":1}} }, { "type": "ExpressionStatement", - "start": 296, - "end": 324, - "loc": { - "start": { - "line": 10, - "column": 1 - }, - "end": { - "line": 11, - "column": 1 - } - }, + "start":296,"end":324,"loc":{"start":{"line":10,"column":1},"end":{"line":11,"column":1}}, "expression": { "type": "ClassExpression", - "start": 297, - "end": 321, - "loc": { - "start": { - "line": 10, - "column": 2 - }, - "end": { - "line": 10, - "column": 26 - } - }, + "start":297,"end":321,"loc":{"start":{"line":10,"column":2},"end":{"line":10,"column":26}}, "id": { "type": "Identifier", - "start": 303, - "end": 306, - "loc": { - "start": { - "line": 10, - "column": 8 - }, - "end": { - "line": 10, - "column": 11 - }, - "identifierName": "A10" - }, + "start":303,"end":306,"loc":{"start":{"line":10,"column":8},"end":{"line":10,"column":11},"identifierName":"A10"}, "name": "A10" }, "typeParameters": { "type": "TypeParameterDeclaration", - "start": 306, - "end": 318, - "loc": { - "start": { - "line": 10, - "column": 11 - }, - "end": { - "line": 10, - "column": 23 - } - }, + "start":306,"end":318,"loc":{"start":{"line":10,"column":11},"end":{"line":10,"column":23}}, "params": [ { "type": "TypeParameter", - "start": 307, - "end": 317, - "loc": { - "start": { - "line": 10, - "column": 12 - }, - "end": { - "line": 10, - "column": 22 - } - }, + "start":307,"end":317,"loc":{"start":{"line":10,"column":12},"end":{"line":10,"column":22}}, "name": "T", "variance": null, "default": { "type": "StringTypeAnnotation", - "start": 311, - "end": 317, - "loc": { - "start": { - "line": 10, - "column": 16 - }, - "end": { - "line": 10, - "column": 22 - } - } + "start":311,"end":317,"loc":{"start":{"line":10,"column":16},"end":{"line":10,"column":22}} } } ] @@ -1471,18 +444,7 @@ "superClass": null, "body": { "type": "ClassBody", - "start": 319, - "end": 321, - "loc": { - "start": { - "line": 10, - "column": 24 - }, - "end": { - "line": 10, - "column": 26 - } - }, + "start":319,"end":321,"loc":{"start":{"line":10,"column":24},"end":{"line":10,"column":26}}, "body": [] }, "extra": { @@ -1493,139 +455,39 @@ }, { "type": "ExpressionStatement", - "start": 324, - "end": 361, - "loc": { - "start": { - "line": 11, - "column": 1 - }, - "end": { - "line": 12, - "column": 1 - } - }, + "start":324,"end":361,"loc":{"start":{"line":11,"column":1},"end":{"line":12,"column":1}}, "expression": { "type": "ClassExpression", - "start": 325, - "end": 358, - "loc": { - "start": { - "line": 11, - "column": 2 - }, - "end": { - "line": 11, - "column": 35 - } - }, + "start":325,"end":358,"loc":{"start":{"line":11,"column":2},"end":{"line":11,"column":35}}, "id": { "type": "Identifier", - "start": 331, - "end": 334, - "loc": { - "start": { - "line": 11, - "column": 8 - }, - "end": { - "line": 11, - "column": 11 - }, - "identifierName": "A11" - }, + "start":331,"end":334,"loc":{"start":{"line":11,"column":8},"end":{"line":11,"column":11},"identifierName":"A11"}, "name": "A11" }, "typeParameters": { "type": "TypeParameterDeclaration", - "start": 334, - "end": 355, - "loc": { - "start": { - "line": 11, - "column": 11 - }, - "end": { - "line": 11, - "column": 32 - } - }, + "start":334,"end":355,"loc":{"start":{"line":11,"column":11},"end":{"line":11,"column":32}}, "params": [ { "type": "TypeParameter", - "start": 335, - "end": 354, - "loc": { - "start": { - "line": 11, - "column": 12 - }, - "end": { - "line": 11, - "column": 31 - } - }, + "start":335,"end":354,"loc":{"start":{"line":11,"column":12},"end":{"line":11,"column":31}}, "name": "T", "variance": null, "bound": { "type": "TypeAnnotation", - "start": 336, - "end": 345, - "loc": { - "start": { - "line": 11, - "column": 13 - }, - "end": { - "line": 11, - "column": 22 - } - }, + "start":336,"end":345,"loc":{"start":{"line":11,"column":13},"end":{"line":11,"column":22}}, "typeAnnotation": { "type": "NullableTypeAnnotation", - "start": 338, - "end": 345, - "loc": { - "start": { - "line": 11, - "column": 15 - }, - "end": { - "line": 11, - "column": 22 - } - }, + "start":338,"end":345,"loc":{"start":{"line":11,"column":15},"end":{"line":11,"column":22}}, "typeAnnotation": { "type": "StringTypeAnnotation", - "start": 339, - "end": 345, - "loc": { - "start": { - "line": 11, - "column": 16 - }, - "end": { - "line": 11, - "column": 22 - } - } + "start":339,"end":345,"loc":{"start":{"line":11,"column":16},"end":{"line":11,"column":22}} } } }, "default": { "type": "StringTypeAnnotation", - "start": 348, - "end": 354, - "loc": { - "start": { - "line": 11, - "column": 25 - }, - "end": { - "line": 11, - "column": 31 - } - } + "start":348,"end":354,"loc":{"start":{"line":11,"column":25},"end":{"line":11,"column":31}} } } ] @@ -1633,18 +495,7 @@ "superClass": null, "body": { "type": "ClassBody", - "start": 356, - "end": 358, - "loc": { - "start": { - "line": 11, - "column": 33 - }, - "end": { - "line": 11, - "column": 35 - } - }, + "start":356,"end":358,"loc":{"start":{"line":11,"column":33},"end":{"line":11,"column":35}}, "body": [] }, "extra": { @@ -1655,156 +506,45 @@ }, { "type": "ExpressionStatement", - "start": 361, - "end": 401, - "loc": { - "start": { - "line": 12, - "column": 1 - }, - "end": { - "line": 13, - "column": 1 - } - }, + "start":361,"end":401,"loc":{"start":{"line":12,"column":1},"end":{"line":13,"column":1}}, "expression": { "type": "ClassExpression", - "start": 362, - "end": 398, - "loc": { - "start": { - "line": 12, - "column": 2 - }, - "end": { - "line": 12, - "column": 38 - } - }, + "start":362,"end":398,"loc":{"start":{"line":12,"column":2},"end":{"line":12,"column":38}}, "id": { "type": "Identifier", - "start": 368, - "end": 371, - "loc": { - "start": { - "line": 12, - "column": 8 - }, - "end": { - "line": 12, - "column": 11 - }, - "identifierName": "A12" - }, + "start":368,"end":371,"loc":{"start":{"line":12,"column":8},"end":{"line":12,"column":11},"identifierName":"A12"}, "name": "A12" }, "typeParameters": { "type": "TypeParameterDeclaration", - "start": 371, - "end": 395, - "loc": { - "start": { - "line": 12, - "column": 11 - }, - "end": { - "line": 12, - "column": 35 - } - }, + "start":371,"end":395,"loc":{"start":{"line":12,"column":11},"end":{"line":12,"column":35}}, "params": [ { "type": "TypeParameter", - "start": 372, - "end": 373, - "loc": { - "start": { - "line": 12, - "column": 12 - }, - "end": { - "line": 12, - "column": 13 - } - }, + "start":372,"end":373,"loc":{"start":{"line":12,"column":12},"end":{"line":12,"column":13}}, "name": "S", "variance": null }, { "type": "TypeParameter", - "start": 375, - "end": 394, - "loc": { - "start": { - "line": 12, - "column": 15 - }, - "end": { - "line": 12, - "column": 34 - } - }, + "start":375,"end":394,"loc":{"start":{"line":12,"column":15},"end":{"line":12,"column":34}}, "name": "T", "variance": null, "bound": { "type": "TypeAnnotation", - "start": 376, - "end": 385, - "loc": { - "start": { - "line": 12, - "column": 16 - }, - "end": { - "line": 12, - "column": 25 - } - }, + "start":376,"end":385,"loc":{"start":{"line":12,"column":16},"end":{"line":12,"column":25}}, "typeAnnotation": { "type": "NullableTypeAnnotation", - "start": 378, - "end": 385, - "loc": { - "start": { - "line": 12, - "column": 18 - }, - "end": { - "line": 12, - "column": 25 - } - }, + "start":378,"end":385,"loc":{"start":{"line":12,"column":18},"end":{"line":12,"column":25}}, "typeAnnotation": { "type": "StringTypeAnnotation", - "start": 379, - "end": 385, - "loc": { - "start": { - "line": 12, - "column": 19 - }, - "end": { - "line": 12, - "column": 25 - } - } + "start":379,"end":385,"loc":{"start":{"line":12,"column":19},"end":{"line":12,"column":25}} } } }, "default": { "type": "StringTypeAnnotation", - "start": 388, - "end": 394, - "loc": { - "start": { - "line": 12, - "column": 28 - }, - "end": { - "line": 12, - "column": 34 - } - } + "start":388,"end":394,"loc":{"start":{"line":12,"column":28},"end":{"line":12,"column":34}} } } ] @@ -1812,18 +552,7 @@ "superClass": null, "body": { "type": "ClassBody", - "start": 396, - "end": 398, - "loc": { - "start": { - "line": 12, - "column": 36 - }, - "end": { - "line": 12, - "column": 38 - } - }, + "start":396,"end":398,"loc":{"start":{"line":12,"column":36},"end":{"line":12,"column":38}}, "body": [] }, "extra": { @@ -1834,171 +563,49 @@ }, { "type": "ExpressionStatement", - "start": 401, - "end": 448, - "loc": { - "start": { - "line": 13, - "column": 1 - }, - "end": { - "line": 13, - "column": 48 - } - }, + "start":401,"end":448,"loc":{"start":{"line":13,"column":1},"end":{"line":13,"column":48}}, "expression": { "type": "ClassExpression", - "start": 402, - "end": 447, - "loc": { - "start": { - "line": 13, - "column": 2 - }, - "end": { - "line": 13, - "column": 47 - } - }, + "start":402,"end":447,"loc":{"start":{"line":13,"column":2},"end":{"line":13,"column":47}}, "id": { "type": "Identifier", - "start": 408, - "end": 411, - "loc": { - "start": { - "line": 13, - "column": 8 - }, - "end": { - "line": 13, - "column": 11 - }, - "identifierName": "A13" - }, + "start":408,"end":411,"loc":{"start":{"line":13,"column":8},"end":{"line":13,"column":11},"identifierName":"A13"}, "name": "A13" }, "typeParameters": { "type": "TypeParameterDeclaration", - "start": 411, - "end": 444, - "loc": { - "start": { - "line": 13, - "column": 11 - }, - "end": { - "line": 13, - "column": 44 - } - }, + "start":411,"end":444,"loc":{"start":{"line":13,"column":11},"end":{"line":13,"column":44}}, "params": [ { "type": "TypeParameter", - "start": 412, - "end": 422, - "loc": { - "start": { - "line": 13, - "column": 12 - }, - "end": { - "line": 13, - "column": 22 - } - }, + "start":412,"end":422,"loc":{"start":{"line":13,"column":12},"end":{"line":13,"column":22}}, "name": "S", "variance": null, "default": { "type": "NumberTypeAnnotation", - "start": 416, - "end": 422, - "loc": { - "start": { - "line": 13, - "column": 16 - }, - "end": { - "line": 13, - "column": 22 - } - } + "start":416,"end":422,"loc":{"start":{"line":13,"column":16},"end":{"line":13,"column":22}} } }, { "type": "TypeParameter", - "start": 424, - "end": 443, - "loc": { - "start": { - "line": 13, - "column": 24 - }, - "end": { - "line": 13, - "column": 43 - } - }, + "start":424,"end":443,"loc":{"start":{"line":13,"column":24},"end":{"line":13,"column":43}}, "name": "T", "variance": null, "bound": { "type": "TypeAnnotation", - "start": 425, - "end": 434, - "loc": { - "start": { - "line": 13, - "column": 25 - }, - "end": { - "line": 13, - "column": 34 - } - }, + "start":425,"end":434,"loc":{"start":{"line":13,"column":25},"end":{"line":13,"column":34}}, "typeAnnotation": { "type": "NullableTypeAnnotation", - "start": 427, - "end": 434, - "loc": { - "start": { - "line": 13, - "column": 27 - }, - "end": { - "line": 13, - "column": 34 - } - }, + "start":427,"end":434,"loc":{"start":{"line":13,"column":27},"end":{"line":13,"column":34}}, "typeAnnotation": { "type": "StringTypeAnnotation", - "start": 428, - "end": 434, - "loc": { - "start": { - "line": 13, - "column": 28 - }, - "end": { - "line": 13, - "column": 34 - } - } + "start":428,"end":434,"loc":{"start":{"line":13,"column":28},"end":{"line":13,"column":34}} } } }, "default": { "type": "StringTypeAnnotation", - "start": 437, - "end": 443, - "loc": { - "start": { - "line": 13, - "column": 37 - }, - "end": { - "line": 13, - "column": 43 - } - } + "start":437,"end":443,"loc":{"start":{"line":13,"column":37},"end":{"line":13,"column":43}} } } ] @@ -2006,18 +613,7 @@ "superClass": null, "body": { "type": "ClassBody", - "start": 445, - "end": 447, - "loc": { - "start": { - "line": 13, - "column": 45 - }, - "end": { - "line": 13, - "column": 47 - } - }, + "start":445,"end":447,"loc":{"start":{"line":13,"column":45},"end":{"line":13,"column":47}}, "body": [] }, "extra": { @@ -2028,80 +624,24 @@ }, { "type": "DeclareClass", - "start": 449, - "end": 481, - "loc": { - "start": { - "line": 14, - "column": 0 - }, - "end": { - "line": 14, - "column": 32 - } - }, + "start":449,"end":481,"loc":{"start":{"line":14,"column":0},"end":{"line":14,"column":32}}, "id": { "type": "Identifier", - "start": 463, - "end": 466, - "loc": { - "start": { - "line": 14, - "column": 14 - }, - "end": { - "line": 14, - "column": 17 - }, - "identifierName": "A14" - }, + "start":463,"end":466,"loc":{"start":{"line":14,"column":14},"end":{"line":14,"column":17},"identifierName":"A14"}, "name": "A14" }, "typeParameters": { "type": "TypeParameterDeclaration", - "start": 466, - "end": 478, - "loc": { - "start": { - "line": 14, - "column": 17 - }, - "end": { - "line": 14, - "column": 29 - } - }, + "start":466,"end":478,"loc":{"start":{"line":14,"column":17},"end":{"line":14,"column":29}}, "params": [ { "type": "TypeParameter", - "start": 467, - "end": 477, - "loc": { - "start": { - "line": 14, - "column": 18 - }, - "end": { - "line": 14, - "column": 28 - } - }, + "start":467,"end":477,"loc":{"start":{"line":14,"column":18},"end":{"line":14,"column":28}}, "name": "T", "variance": null, "default": { "type": "StringTypeAnnotation", - "start": 471, - "end": 477, - "loc": { - "start": { - "line": 14, - "column": 22 - }, - "end": { - "line": 14, - "column": 28 - } - } + "start":471,"end":477,"loc":{"start":{"line":14,"column":22},"end":{"line":14,"column":28}} } } ] @@ -2111,18 +651,7 @@ "mixins": [], "body": { "type": "ObjectTypeAnnotation", - "start": 479, - "end": 481, - "loc": { - "start": { - "line": 14, - "column": 30 - }, - "end": { - "line": 14, - "column": 32 - } - }, + "start":479,"end":481,"loc":{"start":{"line":14,"column":30},"end":{"line":14,"column":32}}, "callProperties": [], "properties": [], "indexers": [], @@ -2132,125 +661,36 @@ }, { "type": "DeclareClass", - "start": 482, - "end": 523, - "loc": { - "start": { - "line": 15, - "column": 0 - }, - "end": { - "line": 15, - "column": 41 - } - }, + "start":482,"end":523,"loc":{"start":{"line":15,"column":0},"end":{"line":15,"column":41}}, "id": { "type": "Identifier", - "start": 496, - "end": 499, - "loc": { - "start": { - "line": 15, - "column": 14 - }, - "end": { - "line": 15, - "column": 17 - }, - "identifierName": "A15" - }, + "start":496,"end":499,"loc":{"start":{"line":15,"column":14},"end":{"line":15,"column":17},"identifierName":"A15"}, "name": "A15" }, "typeParameters": { "type": "TypeParameterDeclaration", - "start": 499, - "end": 520, - "loc": { - "start": { - "line": 15, - "column": 17 - }, - "end": { - "line": 15, - "column": 38 - } - }, + "start":499,"end":520,"loc":{"start":{"line":15,"column":17},"end":{"line":15,"column":38}}, "params": [ { "type": "TypeParameter", - "start": 500, - "end": 519, - "loc": { - "start": { - "line": 15, - "column": 18 - }, - "end": { - "line": 15, - "column": 37 - } - }, + "start":500,"end":519,"loc":{"start":{"line":15,"column":18},"end":{"line":15,"column":37}}, "name": "T", "variance": null, "bound": { "type": "TypeAnnotation", - "start": 501, - "end": 510, - "loc": { - "start": { - "line": 15, - "column": 19 - }, - "end": { - "line": 15, - "column": 28 - } - }, + "start":501,"end":510,"loc":{"start":{"line":15,"column":19},"end":{"line":15,"column":28}}, "typeAnnotation": { "type": "NullableTypeAnnotation", - "start": 503, - "end": 510, - "loc": { - "start": { - "line": 15, - "column": 21 - }, - "end": { - "line": 15, - "column": 28 - } - }, + "start":503,"end":510,"loc":{"start":{"line":15,"column":21},"end":{"line":15,"column":28}}, "typeAnnotation": { "type": "StringTypeAnnotation", - "start": 504, - "end": 510, - "loc": { - "start": { - "line": 15, - "column": 22 - }, - "end": { - "line": 15, - "column": 28 - } - } + "start":504,"end":510,"loc":{"start":{"line":15,"column":22},"end":{"line":15,"column":28}} } } }, "default": { "type": "StringTypeAnnotation", - "start": 513, - "end": 519, - "loc": { - "start": { - "line": 15, - "column": 31 - }, - "end": { - "line": 15, - "column": 37 - } - } + "start":513,"end":519,"loc":{"start":{"line":15,"column":31},"end":{"line":15,"column":37}} } } ] @@ -2260,18 +700,7 @@ "mixins": [], "body": { "type": "ObjectTypeAnnotation", - "start": 521, - "end": 523, - "loc": { - "start": { - "line": 15, - "column": 39 - }, - "end": { - "line": 15, - "column": 41 - } - }, + "start":521,"end":523,"loc":{"start":{"line":15,"column":39},"end":{"line":15,"column":41}}, "callProperties": [], "properties": [], "indexers": [], @@ -2281,142 +710,42 @@ }, { "type": "DeclareClass", - "start": 524, - "end": 568, - "loc": { - "start": { - "line": 16, - "column": 0 - }, - "end": { - "line": 16, - "column": 44 - } - }, + "start":524,"end":568,"loc":{"start":{"line":16,"column":0},"end":{"line":16,"column":44}}, "id": { "type": "Identifier", - "start": 538, - "end": 541, - "loc": { - "start": { - "line": 16, - "column": 14 - }, - "end": { - "line": 16, - "column": 17 - }, - "identifierName": "A16" - }, + "start":538,"end":541,"loc":{"start":{"line":16,"column":14},"end":{"line":16,"column":17},"identifierName":"A16"}, "name": "A16" }, "typeParameters": { "type": "TypeParameterDeclaration", - "start": 541, - "end": 565, - "loc": { - "start": { - "line": 16, - "column": 17 - }, - "end": { - "line": 16, - "column": 41 - } - }, + "start":541,"end":565,"loc":{"start":{"line":16,"column":17},"end":{"line":16,"column":41}}, "params": [ { "type": "TypeParameter", - "start": 542, - "end": 543, - "loc": { - "start": { - "line": 16, - "column": 18 - }, - "end": { - "line": 16, - "column": 19 - } - }, + "start":542,"end":543,"loc":{"start":{"line":16,"column":18},"end":{"line":16,"column":19}}, "name": "S", "variance": null }, { "type": "TypeParameter", - "start": 545, - "end": 564, - "loc": { - "start": { - "line": 16, - "column": 21 - }, - "end": { - "line": 16, - "column": 40 - } - }, + "start":545,"end":564,"loc":{"start":{"line":16,"column":21},"end":{"line":16,"column":40}}, "name": "T", "variance": null, "bound": { "type": "TypeAnnotation", - "start": 546, - "end": 555, - "loc": { - "start": { - "line": 16, - "column": 22 - }, - "end": { - "line": 16, - "column": 31 - } - }, + "start":546,"end":555,"loc":{"start":{"line":16,"column":22},"end":{"line":16,"column":31}}, "typeAnnotation": { "type": "NullableTypeAnnotation", - "start": 548, - "end": 555, - "loc": { - "start": { - "line": 16, - "column": 24 - }, - "end": { - "line": 16, - "column": 31 - } - }, + "start":548,"end":555,"loc":{"start":{"line":16,"column":24},"end":{"line":16,"column":31}}, "typeAnnotation": { "type": "StringTypeAnnotation", - "start": 549, - "end": 555, - "loc": { - "start": { - "line": 16, - "column": 25 - }, - "end": { - "line": 16, - "column": 31 - } - } + "start":549,"end":555,"loc":{"start":{"line":16,"column":25},"end":{"line":16,"column":31}} } } }, "default": { "type": "StringTypeAnnotation", - "start": 558, - "end": 564, - "loc": { - "start": { - "line": 16, - "column": 34 - }, - "end": { - "line": 16, - "column": 40 - } - } + "start":558,"end":564,"loc":{"start":{"line":16,"column":34},"end":{"line":16,"column":40}} } } ] @@ -2426,18 +755,7 @@ "mixins": [], "body": { "type": "ObjectTypeAnnotation", - "start": 566, - "end": 568, - "loc": { - "start": { - "line": 16, - "column": 42 - }, - "end": { - "line": 16, - "column": 44 - } - }, + "start":566,"end":568,"loc":{"start":{"line":16,"column":42},"end":{"line":16,"column":44}}, "callProperties": [], "properties": [], "indexers": [], @@ -2447,157 +765,46 @@ }, { "type": "DeclareClass", - "start": 569, - "end": 622, - "loc": { - "start": { - "line": 17, - "column": 0 - }, - "end": { - "line": 17, - "column": 53 - } - }, + "start":569,"end":622,"loc":{"start":{"line":17,"column":0},"end":{"line":17,"column":53}}, "id": { "type": "Identifier", - "start": 583, - "end": 586, - "loc": { - "start": { - "line": 17, - "column": 14 - }, - "end": { - "line": 17, - "column": 17 - }, - "identifierName": "A17" - }, + "start":583,"end":586,"loc":{"start":{"line":17,"column":14},"end":{"line":17,"column":17},"identifierName":"A17"}, "name": "A17" }, "typeParameters": { "type": "TypeParameterDeclaration", - "start": 586, - "end": 619, - "loc": { - "start": { - "line": 17, - "column": 17 - }, - "end": { - "line": 17, - "column": 50 - } - }, + "start":586,"end":619,"loc":{"start":{"line":17,"column":17},"end":{"line":17,"column":50}}, "params": [ { "type": "TypeParameter", - "start": 587, - "end": 597, - "loc": { - "start": { - "line": 17, - "column": 18 - }, - "end": { - "line": 17, - "column": 28 - } - }, + "start":587,"end":597,"loc":{"start":{"line":17,"column":18},"end":{"line":17,"column":28}}, "name": "S", "variance": null, "default": { "type": "NumberTypeAnnotation", - "start": 591, - "end": 597, - "loc": { - "start": { - "line": 17, - "column": 22 - }, - "end": { - "line": 17, - "column": 28 - } - } + "start":591,"end":597,"loc":{"start":{"line":17,"column":22},"end":{"line":17,"column":28}} } }, { "type": "TypeParameter", - "start": 599, - "end": 618, - "loc": { - "start": { - "line": 17, - "column": 30 - }, - "end": { - "line": 17, - "column": 49 - } - }, + "start":599,"end":618,"loc":{"start":{"line":17,"column":30},"end":{"line":17,"column":49}}, "name": "T", "variance": null, "bound": { "type": "TypeAnnotation", - "start": 600, - "end": 609, - "loc": { - "start": { - "line": 17, - "column": 31 - }, - "end": { - "line": 17, - "column": 40 - } - }, + "start":600,"end":609,"loc":{"start":{"line":17,"column":31},"end":{"line":17,"column":40}}, "typeAnnotation": { "type": "NullableTypeAnnotation", - "start": 602, - "end": 609, - "loc": { - "start": { - "line": 17, - "column": 33 - }, - "end": { - "line": 17, - "column": 40 - } - }, + "start":602,"end":609,"loc":{"start":{"line":17,"column":33},"end":{"line":17,"column":40}}, "typeAnnotation": { "type": "StringTypeAnnotation", - "start": 603, - "end": 609, - "loc": { - "start": { - "line": 17, - "column": 34 - }, - "end": { - "line": 17, - "column": 40 - } - } + "start":603,"end":609,"loc":{"start":{"line":17,"column":34},"end":{"line":17,"column":40}} } } }, "default": { "type": "StringTypeAnnotation", - "start": 612, - "end": 618, - "loc": { - "start": { - "line": 17, - "column": 43 - }, - "end": { - "line": 17, - "column": 49 - } - } + "start":612,"end":618,"loc":{"start":{"line":17,"column":43},"end":{"line":17,"column":49}} } } ] @@ -2607,18 +814,7 @@ "mixins": [], "body": { "type": "ObjectTypeAnnotation", - "start": 620, - "end": 622, - "loc": { - "start": { - "line": 17, - "column": 51 - }, - "end": { - "line": 17, - "column": 53 - } - }, + "start":620,"end":622,"loc":{"start":{"line":17,"column":51},"end":{"line":17,"column":53}}, "callProperties": [], "properties": [], "indexers": [], @@ -2628,80 +824,24 @@ }, { "type": "InterfaceDeclaration", - "start": 623, - "end": 651, - "loc": { - "start": { - "line": 18, - "column": 0 - }, - "end": { - "line": 18, - "column": 28 - } - }, + "start":623,"end":651,"loc":{"start":{"line":18,"column":0},"end":{"line":18,"column":28}}, "id": { "type": "Identifier", - "start": 633, - "end": 636, - "loc": { - "start": { - "line": 18, - "column": 10 - }, - "end": { - "line": 18, - "column": 13 - }, - "identifierName": "A18" - }, + "start":633,"end":636,"loc":{"start":{"line":18,"column":10},"end":{"line":18,"column":13},"identifierName":"A18"}, "name": "A18" }, "typeParameters": { "type": "TypeParameterDeclaration", - "start": 636, - "end": 648, - "loc": { - "start": { - "line": 18, - "column": 13 - }, - "end": { - "line": 18, - "column": 25 - } - }, + "start":636,"end":648,"loc":{"start":{"line":18,"column":13},"end":{"line":18,"column":25}}, "params": [ { "type": "TypeParameter", - "start": 637, - "end": 647, - "loc": { - "start": { - "line": 18, - "column": 14 - }, - "end": { - "line": 18, - "column": 24 - } - }, + "start":637,"end":647,"loc":{"start":{"line":18,"column":14},"end":{"line":18,"column":24}}, "name": "T", "variance": null, "default": { "type": "StringTypeAnnotation", - "start": 641, - "end": 647, - "loc": { - "start": { - "line": 18, - "column": 18 - }, - "end": { - "line": 18, - "column": 24 - } - } + "start":641,"end":647,"loc":{"start":{"line":18,"column":18},"end":{"line":18,"column":24}} } } ] @@ -2711,18 +851,7 @@ "mixins": [], "body": { "type": "ObjectTypeAnnotation", - "start": 649, - "end": 651, - "loc": { - "start": { - "line": 18, - "column": 26 - }, - "end": { - "line": 18, - "column": 28 - } - }, + "start":649,"end":651,"loc":{"start":{"line":18,"column":26},"end":{"line":18,"column":28}}, "callProperties": [], "properties": [], "indexers": [], @@ -2732,125 +861,36 @@ }, { "type": "InterfaceDeclaration", - "start": 652, - "end": 689, - "loc": { - "start": { - "line": 19, - "column": 0 - }, - "end": { - "line": 19, - "column": 37 - } - }, + "start":652,"end":689,"loc":{"start":{"line":19,"column":0},"end":{"line":19,"column":37}}, "id": { "type": "Identifier", - "start": 662, - "end": 665, - "loc": { - "start": { - "line": 19, - "column": 10 - }, - "end": { - "line": 19, - "column": 13 - }, - "identifierName": "A19" - }, + "start":662,"end":665,"loc":{"start":{"line":19,"column":10},"end":{"line":19,"column":13},"identifierName":"A19"}, "name": "A19" }, "typeParameters": { "type": "TypeParameterDeclaration", - "start": 665, - "end": 686, - "loc": { - "start": { - "line": 19, - "column": 13 - }, - "end": { - "line": 19, - "column": 34 - } - }, + "start":665,"end":686,"loc":{"start":{"line":19,"column":13},"end":{"line":19,"column":34}}, "params": [ { "type": "TypeParameter", - "start": 666, - "end": 685, - "loc": { - "start": { - "line": 19, - "column": 14 - }, - "end": { - "line": 19, - "column": 33 - } - }, + "start":666,"end":685,"loc":{"start":{"line":19,"column":14},"end":{"line":19,"column":33}}, "name": "T", "variance": null, "bound": { "type": "TypeAnnotation", - "start": 667, - "end": 676, - "loc": { - "start": { - "line": 19, - "column": 15 - }, - "end": { - "line": 19, - "column": 24 - } - }, + "start":667,"end":676,"loc":{"start":{"line":19,"column":15},"end":{"line":19,"column":24}}, "typeAnnotation": { "type": "NullableTypeAnnotation", - "start": 669, - "end": 676, - "loc": { - "start": { - "line": 19, - "column": 17 - }, - "end": { - "line": 19, - "column": 24 - } - }, + "start":669,"end":676,"loc":{"start":{"line":19,"column":17},"end":{"line":19,"column":24}}, "typeAnnotation": { "type": "StringTypeAnnotation", - "start": 670, - "end": 676, - "loc": { - "start": { - "line": 19, - "column": 18 - }, - "end": { - "line": 19, - "column": 24 - } - } + "start":670,"end":676,"loc":{"start":{"line":19,"column":18},"end":{"line":19,"column":24}} } } }, "default": { "type": "StringTypeAnnotation", - "start": 679, - "end": 685, - "loc": { - "start": { - "line": 19, - "column": 27 - }, - "end": { - "line": 19, - "column": 33 - } - } + "start":679,"end":685,"loc":{"start":{"line":19,"column":27},"end":{"line":19,"column":33}} } } ] @@ -2860,18 +900,7 @@ "mixins": [], "body": { "type": "ObjectTypeAnnotation", - "start": 687, - "end": 689, - "loc": { - "start": { - "line": 19, - "column": 35 - }, - "end": { - "line": 19, - "column": 37 - } - }, + "start":687,"end":689,"loc":{"start":{"line":19,"column":35},"end":{"line":19,"column":37}}, "callProperties": [], "properties": [], "indexers": [], @@ -2881,142 +910,42 @@ }, { "type": "InterfaceDeclaration", - "start": 690, - "end": 730, - "loc": { - "start": { - "line": 20, - "column": 0 - }, - "end": { - "line": 20, - "column": 40 - } - }, + "start":690,"end":730,"loc":{"start":{"line":20,"column":0},"end":{"line":20,"column":40}}, "id": { "type": "Identifier", - "start": 700, - "end": 703, - "loc": { - "start": { - "line": 20, - "column": 10 - }, - "end": { - "line": 20, - "column": 13 - }, - "identifierName": "A20" - }, + "start":700,"end":703,"loc":{"start":{"line":20,"column":10},"end":{"line":20,"column":13},"identifierName":"A20"}, "name": "A20" }, "typeParameters": { "type": "TypeParameterDeclaration", - "start": 703, - "end": 727, - "loc": { - "start": { - "line": 20, - "column": 13 - }, - "end": { - "line": 20, - "column": 37 - } - }, + "start":703,"end":727,"loc":{"start":{"line":20,"column":13},"end":{"line":20,"column":37}}, "params": [ { "type": "TypeParameter", - "start": 704, - "end": 705, - "loc": { - "start": { - "line": 20, - "column": 14 - }, - "end": { - "line": 20, - "column": 15 - } - }, + "start":704,"end":705,"loc":{"start":{"line":20,"column":14},"end":{"line":20,"column":15}}, "name": "S", "variance": null }, { "type": "TypeParameter", - "start": 707, - "end": 726, - "loc": { - "start": { - "line": 20, - "column": 17 - }, - "end": { - "line": 20, - "column": 36 - } - }, + "start":707,"end":726,"loc":{"start":{"line":20,"column":17},"end":{"line":20,"column":36}}, "name": "T", "variance": null, "bound": { "type": "TypeAnnotation", - "start": 708, - "end": 717, - "loc": { - "start": { - "line": 20, - "column": 18 - }, - "end": { - "line": 20, - "column": 27 - } - }, + "start":708,"end":717,"loc":{"start":{"line":20,"column":18},"end":{"line":20,"column":27}}, "typeAnnotation": { "type": "NullableTypeAnnotation", - "start": 710, - "end": 717, - "loc": { - "start": { - "line": 20, - "column": 20 - }, - "end": { - "line": 20, - "column": 27 - } - }, + "start":710,"end":717,"loc":{"start":{"line":20,"column":20},"end":{"line":20,"column":27}}, "typeAnnotation": { "type": "StringTypeAnnotation", - "start": 711, - "end": 717, - "loc": { - "start": { - "line": 20, - "column": 21 - }, - "end": { - "line": 20, - "column": 27 - } - } + "start":711,"end":717,"loc":{"start":{"line":20,"column":21},"end":{"line":20,"column":27}} } } }, "default": { "type": "StringTypeAnnotation", - "start": 720, - "end": 726, - "loc": { - "start": { - "line": 20, - "column": 30 - }, - "end": { - "line": 20, - "column": 36 - } - } + "start":720,"end":726,"loc":{"start":{"line":20,"column":30},"end":{"line":20,"column":36}} } } ] @@ -3026,18 +955,7 @@ "mixins": [], "body": { "type": "ObjectTypeAnnotation", - "start": 728, - "end": 730, - "loc": { - "start": { - "line": 20, - "column": 38 - }, - "end": { - "line": 20, - "column": 40 - } - }, + "start":728,"end":730,"loc":{"start":{"line":20,"column":38},"end":{"line":20,"column":40}}, "callProperties": [], "properties": [], "indexers": [], @@ -3047,157 +965,46 @@ }, { "type": "InterfaceDeclaration", - "start": 731, - "end": 780, - "loc": { - "start": { - "line": 21, - "column": 0 - }, - "end": { - "line": 21, - "column": 49 - } - }, + "start":731,"end":780,"loc":{"start":{"line":21,"column":0},"end":{"line":21,"column":49}}, "id": { "type": "Identifier", - "start": 741, - "end": 744, - "loc": { - "start": { - "line": 21, - "column": 10 - }, - "end": { - "line": 21, - "column": 13 - }, - "identifierName": "A21" - }, + "start":741,"end":744,"loc":{"start":{"line":21,"column":10},"end":{"line":21,"column":13},"identifierName":"A21"}, "name": "A21" }, "typeParameters": { "type": "TypeParameterDeclaration", - "start": 744, - "end": 777, - "loc": { - "start": { - "line": 21, - "column": 13 - }, - "end": { - "line": 21, - "column": 46 - } - }, + "start":744,"end":777,"loc":{"start":{"line":21,"column":13},"end":{"line":21,"column":46}}, "params": [ { "type": "TypeParameter", - "start": 745, - "end": 755, - "loc": { - "start": { - "line": 21, - "column": 14 - }, - "end": { - "line": 21, - "column": 24 - } - }, + "start":745,"end":755,"loc":{"start":{"line":21,"column":14},"end":{"line":21,"column":24}}, "name": "S", "variance": null, "default": { "type": "NumberTypeAnnotation", - "start": 749, - "end": 755, - "loc": { - "start": { - "line": 21, - "column": 18 - }, - "end": { - "line": 21, - "column": 24 - } - } + "start":749,"end":755,"loc":{"start":{"line":21,"column":18},"end":{"line":21,"column":24}} } }, { "type": "TypeParameter", - "start": 757, - "end": 776, - "loc": { - "start": { - "line": 21, - "column": 26 - }, - "end": { - "line": 21, - "column": 45 - } - }, + "start":757,"end":776,"loc":{"start":{"line":21,"column":26},"end":{"line":21,"column":45}}, "name": "T", "variance": null, "bound": { "type": "TypeAnnotation", - "start": 758, - "end": 767, - "loc": { - "start": { - "line": 21, - "column": 27 - }, - "end": { - "line": 21, - "column": 36 - } - }, + "start":758,"end":767,"loc":{"start":{"line":21,"column":27},"end":{"line":21,"column":36}}, "typeAnnotation": { "type": "NullableTypeAnnotation", - "start": 760, - "end": 767, - "loc": { - "start": { - "line": 21, - "column": 29 - }, - "end": { - "line": 21, - "column": 36 - } - }, + "start":760,"end":767,"loc":{"start":{"line":21,"column":29},"end":{"line":21,"column":36}}, "typeAnnotation": { "type": "StringTypeAnnotation", - "start": 761, - "end": 767, - "loc": { - "start": { - "line": 21, - "column": 30 - }, - "end": { - "line": 21, - "column": 36 - } - } + "start":761,"end":767,"loc":{"start":{"line":21,"column":30},"end":{"line":21,"column":36}} } } }, "default": { "type": "StringTypeAnnotation", - "start": 770, - "end": 776, - "loc": { - "start": { - "line": 21, - "column": 39 - }, - "end": { - "line": 21, - "column": 45 - } - } + "start":770,"end":776,"loc":{"start":{"line":21,"column":39},"end":{"line":21,"column":45}} } } ] @@ -3207,18 +1014,7 @@ "mixins": [], "body": { "type": "ObjectTypeAnnotation", - "start": 778, - "end": 780, - "loc": { - "start": { - "line": 21, - "column": 47 - }, - "end": { - "line": 21, - "column": 49 - } - }, + "start":778,"end":780,"loc":{"start":{"line":21,"column":47},"end":{"line":21,"column":49}}, "callProperties": [], "properties": [], "indexers": [], @@ -3228,196 +1024,61 @@ }, { "type": "TypeAlias", - "start": 781, - "end": 803, - "loc": { - "start": { - "line": 22, - "column": 0 - }, - "end": { - "line": 22, - "column": 22 - } - }, + "start":781,"end":803,"loc":{"start":{"line":22,"column":0},"end":{"line":22,"column":22}}, "id": { "type": "Identifier", - "start": 786, - "end": 789, - "loc": { - "start": { - "line": 22, - "column": 5 - }, - "end": { - "line": 22, - "column": 8 - }, - "identifierName": "A22" - }, + "start":786,"end":789,"loc":{"start":{"line":22,"column":5},"end":{"line":22,"column":8},"identifierName":"A22"}, "name": "A22" }, "typeParameters": { "type": "TypeParameterDeclaration", - "start": 789, - "end": 799, - "loc": { - "start": { - "line": 22, - "column": 8 - }, - "end": { - "line": 22, - "column": 18 - } - }, + "start":789,"end":799,"loc":{"start":{"line":22,"column":8},"end":{"line":22,"column":18}}, "params": [ { "type": "TypeParameter", - "start": 790, - "end": 798, - "loc": { - "start": { - "line": 22, - "column": 9 - }, - "end": { - "line": 22, - "column": 17 - } - }, + "start":790,"end":798,"loc":{"start":{"line":22,"column":9},"end":{"line":22,"column":17}}, "name": "T", "variance": null, "default": { "type": "VoidTypeAnnotation", - "start": 794, - "end": 798, - "loc": { - "start": { - "line": 22, - "column": 13 - }, - "end": { - "line": 22, - "column": 17 - } - } + "start":794,"end":798,"loc":{"start":{"line":22,"column":13},"end":{"line":22,"column":17}} } } ] }, "right": { "type": "GenericTypeAnnotation", - "start": 802, - "end": 803, - "loc": { - "start": { - "line": 22, - "column": 21 - }, - "end": { - "line": 22, - "column": 22 - } - }, + "start":802,"end":803,"loc":{"start":{"line":22,"column":21},"end":{"line":22,"column":22}}, "typeParameters": null, "id": { "type": "Identifier", - "start": 802, - "end": 803, - "loc": { - "start": { - "line": 22, - "column": 21 - }, - "end": { - "line": 22, - "column": 22 - }, - "identifierName": "T" - }, + "start":802,"end":803,"loc":{"start":{"line":22,"column":21},"end":{"line":22,"column":22},"identifierName":"T"}, "name": "T" } } }, { "type": "FunctionDeclaration", - "start": 804, - "end": 833, - "loc": { - "start": { - "line": 23, - "column": 0 - }, - "end": { - "line": 23, - "column": 29 - } - }, + "start":804,"end":833,"loc":{"start":{"line":23,"column":0},"end":{"line":23,"column":29}}, "id": { "type": "Identifier", - "start": 813, - "end": 816, - "loc": { - "start": { - "line": 23, - "column": 9 - }, - "end": { - "line": 23, - "column": 12 - }, - "identifierName": "A26" - }, + "start":813,"end":816,"loc":{"start":{"line":23,"column":9},"end":{"line":23,"column":12},"identifierName":"A26"}, "name": "A26" }, "generator": false, "async": false, "typeParameters": { "type": "TypeParameterDeclaration", - "start": 816, - "end": 828, - "loc": { - "start": { - "line": 23, - "column": 12 - }, - "end": { - "line": 23, - "column": 24 - } - }, + "start":816,"end":828,"loc":{"start":{"line":23,"column":12},"end":{"line":23,"column":24}}, "params": [ { "type": "TypeParameter", - "start": 817, - "end": 827, - "loc": { - "start": { - "line": 23, - "column": 13 - }, - "end": { - "line": 23, - "column": 23 - } - }, + "start":817,"end":827,"loc":{"start":{"line":23,"column":13},"end":{"line":23,"column":23}}, "name": "T", "variance": null, "default": { "type": "StringTypeAnnotation", - "start": 821, - "end": 827, - "loc": { - "start": { - "line": 23, - "column": 17 - }, - "end": { - "line": 23, - "column": 23 - } - } + "start":821,"end":827,"loc":{"start":{"line":23,"column":17},"end":{"line":23,"column":23}} } } ] @@ -3425,96 +1086,29 @@ "params": [], "body": { "type": "BlockStatement", - "start": 831, - "end": 833, - "loc": { - "start": { - "line": 23, - "column": 27 - }, - "end": { - "line": 23, - "column": 29 - } - }, + "start":831,"end":833,"loc":{"start":{"line":23,"column":27},"end":{"line":23,"column":29}}, "body": [], "directives": [] } }, { "type": "EmptyStatement", - "start": 834, - "end": 835, - "loc": { - "start": { - "line": 24, - "column": 0 - }, - "end": { - "line": 24, - "column": 1 - } - } + "start":834,"end":835,"loc":{"start":{"line":24,"column":0},"end":{"line":24,"column":1}} }, { "type": "ExpressionStatement", - "start": 835, - "end": 862, - "loc": { - "start": { - "line": 24, - "column": 1 - }, - "end": { - "line": 24, - "column": 28 - } - }, + "start":835,"end":862,"loc":{"start":{"line":24,"column":1},"end":{"line":24,"column":28}}, "expression": { "type": "ObjectExpression", - "start": 836, - "end": 860, - "loc": { - "start": { - "line": 24, - "column": 2 - }, - "end": { - "line": 24, - "column": 26 - } - }, + "start":836,"end":860,"loc":{"start":{"line":24,"column":2},"end":{"line":24,"column":26}}, "properties": [ { "type": "ObjectMethod", - "start": 838, - "end": 858, - "loc": { - "start": { - "line": 24, - "column": 4 - }, - "end": { - "line": 24, - "column": 24 - } - }, + "start":838,"end":858,"loc":{"start":{"line":24,"column":4},"end":{"line":24,"column":24}}, "method": true, "key": { "type": "Identifier", - "start": 838, - "end": 841, - "loc": { - "start": { - "line": 24, - "column": 4 - }, - "end": { - "line": 24, - "column": 7 - }, - "identifierName": "A28" - }, + "start":838,"end":841,"loc":{"start":{"line":24,"column":4},"end":{"line":24,"column":7},"identifierName":"A28"}, "name": "A28" }, "computed": false, @@ -3525,66 +1119,22 @@ "params": [], "body": { "type": "BlockStatement", - "start": 856, - "end": 858, - "loc": { - "start": { - "line": 24, - "column": 22 - }, - "end": { - "line": 24, - "column": 24 - } - }, + "start":856,"end":858,"loc":{"start":{"line":24,"column":22},"end":{"line":24,"column":24}}, "body": [], "directives": [] }, "typeParameters": { "type": "TypeParameterDeclaration", - "start": 841, - "end": 853, - "loc": { - "start": { - "line": 24, - "column": 7 - }, - "end": { - "line": 24, - "column": 19 - } - }, + "start":841,"end":853,"loc":{"start":{"line":24,"column":7},"end":{"line":24,"column":19}}, "params": [ { "type": "TypeParameter", - "start": 842, - "end": 852, - "loc": { - "start": { - "line": 24, - "column": 8 - }, - "end": { - "line": 24, - "column": 18 - } - }, + "start":842,"end":852,"loc":{"start":{"line":24,"column":8},"end":{"line":24,"column":18}}, "name": "T", "variance": null, "default": { "type": "StringTypeAnnotation", - "start": 846, - "end": 852, - "loc": { - "start": { - "line": 24, - "column": 12 - }, - "end": { - "line": 24, - "column": 18 - } - } + "start":846,"end":852,"loc":{"start":{"line":24,"column":12},"end":{"line":24,"column":18}} } } ] @@ -3599,130 +1149,40 @@ }, { "type": "ClassDeclaration", - "start": 863, - "end": 899, - "loc": { - "start": { - "line": 25, - "column": 0 - }, - "end": { - "line": 27, - "column": 1 - } - }, + "start":863,"end":899,"loc":{"start":{"line":25,"column":0},"end":{"line":27,"column":1}}, "id": { "type": "Identifier", - "start": 869, - "end": 872, - "loc": { - "start": { - "line": 25, - "column": 6 - }, - "end": { - "line": 25, - "column": 9 - }, - "identifierName": "A29" - }, + "start":869,"end":872,"loc":{"start":{"line":25,"column":6},"end":{"line":25,"column":9},"identifierName":"A29"}, "name": "A29" }, "superClass": null, "body": { "type": "ClassBody", - "start": 873, - "end": 899, - "loc": { - "start": { - "line": 25, - "column": 10 - }, - "end": { - "line": 27, - "column": 1 - } - }, + "start":873,"end":899,"loc":{"start":{"line":25,"column":10},"end":{"line":27,"column":1}}, "body": [ { "type": "ClassMethod", - "start": 877, - "end": 897, - "loc": { - "start": { - "line": 26, - "column": 2 - }, - "end": { - "line": 26, - "column": 22 - } - }, + "start":877,"end":897,"loc":{"start":{"line":26,"column":2},"end":{"line":26,"column":22}}, "static": false, "key": { "type": "Identifier", - "start": 877, - "end": 880, - "loc": { - "start": { - "line": 26, - "column": 2 - }, - "end": { - "line": 26, - "column": 5 - }, - "identifierName": "foo" - }, + "start":877,"end":880,"loc":{"start":{"line":26,"column":2},"end":{"line":26,"column":5},"identifierName":"foo"}, "name": "foo" }, "computed": false, "kind": "method", "typeParameters": { "type": "TypeParameterDeclaration", - "start": 880, - "end": 892, - "loc": { - "start": { - "line": 26, - "column": 5 - }, - "end": { - "line": 26, - "column": 17 - } - }, + "start":880,"end":892,"loc":{"start":{"line":26,"column":5},"end":{"line":26,"column":17}}, "params": [ { "type": "TypeParameter", - "start": 881, - "end": 891, - "loc": { - "start": { - "line": 26, - "column": 6 - }, - "end": { - "line": 26, - "column": 16 - } - }, + "start":881,"end":891,"loc":{"start":{"line":26,"column":6},"end":{"line":26,"column":16}}, "name": "T", "variance": null, "default": { "type": "StringTypeAnnotation", - "start": 885, - "end": 891, - "loc": { - "start": { - "line": 26, - "column": 10 - }, - "end": { - "line": 26, - "column": 16 - } - } + "start":885,"end":891,"loc":{"start":{"line":26,"column":10},"end":{"line":26,"column":16}} } } ] @@ -3733,18 +1193,7 @@ "params": [], "body": { "type": "BlockStatement", - "start": 895, - "end": 897, - "loc": { - "start": { - "line": 26, - "column": 20 - }, - "end": { - "line": 26, - "column": 22 - } - }, + "start":895,"end":897,"loc":{"start":{"line":26,"column":20},"end":{"line":26,"column":22}}, "body": [], "directives": [] } @@ -3754,159 +1203,47 @@ }, { "type": "EmptyStatement", - "start": 900, - "end": 901, - "loc": { - "start": { - "line": 28, - "column": 0 - }, - "end": { - "line": 28, - "column": 1 - } - } + "start":900,"end":901,"loc":{"start":{"line":28,"column":0},"end":{"line":28,"column":1}} }, { "type": "ExpressionStatement", - "start": 901, - "end": 940, - "loc": { - "start": { - "line": 28, - "column": 1 - }, - "end": { - "line": 30, - "column": 3 - } - }, + "start":901,"end":940,"loc":{"start":{"line":28,"column":1},"end":{"line":30,"column":3}}, "expression": { "type": "ClassExpression", - "start": 902, - "end": 938, - "loc": { - "start": { - "line": 28, - "column": 2 - }, - "end": { - "line": 30, - "column": 1 - } - }, + "start":902,"end":938,"loc":{"start":{"line":28,"column":2},"end":{"line":30,"column":1}}, "id": { "type": "Identifier", - "start": 908, - "end": 911, - "loc": { - "start": { - "line": 28, - "column": 8 - }, - "end": { - "line": 28, - "column": 11 - }, - "identifierName": "A30" - }, + "start":908,"end":911,"loc":{"start":{"line":28,"column":8},"end":{"line":28,"column":11},"identifierName":"A30"}, "name": "A30" }, "superClass": null, "body": { "type": "ClassBody", - "start": 912, - "end": 938, - "loc": { - "start": { - "line": 28, - "column": 12 - }, - "end": { - "line": 30, - "column": 1 - } - }, + "start":912,"end":938,"loc":{"start":{"line":28,"column":12},"end":{"line":30,"column":1}}, "body": [ { "type": "ClassMethod", - "start": 916, - "end": 936, - "loc": { - "start": { - "line": 29, - "column": 2 - }, - "end": { - "line": 29, - "column": 22 - } - }, + "start":916,"end":936,"loc":{"start":{"line":29,"column":2},"end":{"line":29,"column":22}}, "static": false, "key": { "type": "Identifier", - "start": 916, - "end": 919, - "loc": { - "start": { - "line": 29, - "column": 2 - }, - "end": { - "line": 29, - "column": 5 - }, - "identifierName": "foo" - }, + "start":916,"end":919,"loc":{"start":{"line":29,"column":2},"end":{"line":29,"column":5},"identifierName":"foo"}, "name": "foo" }, "computed": false, "kind": "method", "typeParameters": { "type": "TypeParameterDeclaration", - "start": 919, - "end": 931, - "loc": { - "start": { - "line": 29, - "column": 5 - }, - "end": { - "line": 29, - "column": 17 - } - }, + "start":919,"end":931,"loc":{"start":{"line":29,"column":5},"end":{"line":29,"column":17}}, "params": [ { "type": "TypeParameter", - "start": 920, - "end": 930, - "loc": { - "start": { - "line": 29, - "column": 6 - }, - "end": { - "line": 29, - "column": 16 - } - }, + "start":920,"end":930,"loc":{"start":{"line":29,"column":6},"end":{"line":29,"column":16}}, "name": "T", "variance": null, "default": { "type": "StringTypeAnnotation", - "start": 924, - "end": 930, - "loc": { - "start": { - "line": 29, - "column": 10 - }, - "end": { - "line": 29, - "column": 16 - } - } + "start":924,"end":930,"loc":{"start":{"line":29,"column":10},"end":{"line":29,"column":16}} } } ] @@ -3917,18 +1254,7 @@ "params": [], "body": { "type": "BlockStatement", - "start": 934, - "end": 936, - "loc": { - "start": { - "line": 29, - "column": 20 - }, - "end": { - "line": 29, - "column": 22 - } - }, + "start":934,"end":936,"loc":{"start":{"line":29,"column":20},"end":{"line":29,"column":22}}, "body": [], "directives": [] } @@ -3943,33 +1269,10 @@ }, { "type": "DeclareClass", - "start": 941, - "end": 986, - "loc": { - "start": { - "line": 31, - "column": 0 - }, - "end": { - "line": 31, - "column": 45 - } - }, + "start":941,"end":986,"loc":{"start":{"line":31,"column":0},"end":{"line":31,"column":45}}, "id": { "type": "Identifier", - "start": 955, - "end": 958, - "loc": { - "start": { - "line": 31, - "column": 14 - }, - "end": { - "line": 31, - "column": 17 - }, - "identifierName": "A31" - }, + "start":955,"end":958,"loc":{"start":{"line":31,"column":14},"end":{"line":31,"column":17},"identifierName":"A31"}, "name": "A31" }, "typeParameters": null, @@ -3978,49 +1281,15 @@ "mixins": [], "body": { "type": "ObjectTypeAnnotation", - "start": 959, - "end": 986, - "loc": { - "start": { - "line": 31, - "column": 18 - }, - "end": { - "line": 31, - "column": 45 - } - }, + "start":959,"end":986,"loc":{"start":{"line":31,"column":18},"end":{"line":31,"column":45}}, "callProperties": [], "properties": [ { "type": "ObjectTypeProperty", - "start": 961, - "end": 984, - "loc": { - "start": { - "line": 31, - "column": 20 - }, - "end": { - "line": 31, - "column": 43 - } - }, + "start":961,"end":984,"loc":{"start":{"line":31,"column":20},"end":{"line":31,"column":43}}, "key": { "type": "Identifier", - "start": 961, - "end": 964, - "loc": { - "start": { - "line": 31, - "column": 20 - }, - "end": { - "line": 31, - "column": 23 - }, - "identifierName": "foo" - }, + "start":961,"end":964,"loc":{"start":{"line":31,"column":20},"end":{"line":31,"column":23},"identifierName":"foo"}, "name": "foo" }, "static": false, @@ -4029,83 +1298,28 @@ "method": true, "value": { "type": "FunctionTypeAnnotation", - "start": 961, - "end": 984, - "loc": { - "start": { - "line": 31, - "column": 20 - }, - "end": { - "line": 31, - "column": 43 - } - }, + "start":961,"end":984,"loc":{"start":{"line":31,"column":20},"end":{"line":31,"column":43}}, "params": [], "rest": null, "typeParameters": { "type": "TypeParameterDeclaration", - "start": 964, - "end": 976, - "loc": { - "start": { - "line": 31, - "column": 23 - }, - "end": { - "line": 31, - "column": 35 - } - }, + "start":964,"end":976,"loc":{"start":{"line":31,"column":23},"end":{"line":31,"column":35}}, "params": [ { "type": "TypeParameter", - "start": 965, - "end": 975, - "loc": { - "start": { - "line": 31, - "column": 24 - }, - "end": { - "line": 31, - "column": 34 - } - }, + "start":965,"end":975,"loc":{"start":{"line":31,"column":24},"end":{"line":31,"column":34}}, "name": "T", "variance": null, "default": { "type": "StringTypeAnnotation", - "start": 969, - "end": 975, - "loc": { - "start": { - "line": 31, - "column": 28 - }, - "end": { - "line": 31, - "column": 34 - } - } + "start":969,"end":975,"loc":{"start":{"line":31,"column":28},"end":{"line":31,"column":34}} } } ] }, "returnType": { "type": "VoidTypeAnnotation", - "start": 980, - "end": 984, - "loc": { - "start": { - "line": 31, - "column": 39 - }, - "end": { - "line": 31, - "column": 43 - } - } + "start":980,"end":984,"loc":{"start":{"line":31,"column":39},"end":{"line":31,"column":43}} } }, "optional": false @@ -4118,50 +1332,17 @@ }, { "type": "ExpressionStatement", - "start": 987, - "end": 1009, - "loc": { - "start": { - "line": 32, - "column": 0 - }, - "end": { - "line": 32, - "column": 22 - } - }, + "start":987,"end":1009,"loc":{"start":{"line":32,"column":0},"end":{"line":32,"column":22}}, "expression": { "type": "ArrowFunctionExpression", - "start": 987, - "end": 1008, - "loc": { - "start": { - "line": 32, - "column": 0 - }, - "end": { - "line": 32, - "column": 21 - } - }, + "start":987,"end":1008,"loc":{"start":{"line":32,"column":0},"end":{"line":32,"column":21}}, "id": null, "generator": false, "async": false, "params": [], "body": { "type": "NumericLiteral", - "start": 1005, - "end": 1008, - "loc": { - "start": { - "line": 32, - "column": 18 - }, - "end": { - "line": 32, - "column": 21 - } - }, + "start":1005,"end":1008,"loc":{"start":{"line":32,"column":18},"end":{"line":32,"column":21}}, "extra": { "rawValue": 123, "raw": "123" @@ -4170,49 +1351,16 @@ }, "typeParameters": { "type": "TypeParameterDeclaration", - "start": 987, - "end": 999, - "loc": { - "start": { - "line": 32, - "column": 0 - }, - "end": { - "line": 32, - "column": 12 - } - }, + "start":987,"end":999,"loc":{"start":{"line":32,"column":0},"end":{"line":32,"column":12}}, "params": [ { "type": "TypeParameter", - "start": 988, - "end": 998, - "loc": { - "start": { - "line": 32, - "column": 1 - }, - "end": { - "line": 32, - "column": 11 - } - }, + "start":988,"end":998,"loc":{"start":{"line":32,"column":1},"end":{"line":32,"column":11}}, "name": "T", "variance": null, "default": { "type": "StringTypeAnnotation", - "start": 992, - "end": 998, - "loc": { - "start": { - "line": 32, - "column": 5 - }, - "end": { - "line": 32, - "column": 11 - } - } + "start":992,"end":998,"loc":{"start":{"line":32,"column":5},"end":{"line":32,"column":11}} } } ] diff --git a/packages/babel-parser/test/fixtures/flow/type-parameter-declaration/interface-reserved-word/output.json b/packages/babel-parser/test/fixtures/flow/type-parameter-declaration/interface-reserved-word/output.json index 773dc48b8cc1..fc8e1f196b8f 100644 --- a/packages/babel-parser/test/fixtures/flow/type-parameter-declaration/interface-reserved-word/output.json +++ b/packages/babel-parser/test/fixtures/flow/type-parameter-declaration/interface-reserved-word/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 95, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 6, - "column": 2 - } - }, + "start":0,"end":95,"loc":{"start":{"line":1,"column":0},"end":{"line":6,"column":2}}, "program": { "type": "Program", - "start": 0, - "end": 95, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 6, - "column": 2 - } - }, + "start":0,"end":95,"loc":{"start":{"line":1,"column":0},"end":{"line":6,"column":2}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "InterfaceDeclaration", - "start": 0, - "end": 94, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 6, - "column": 1 - } - }, + "start":0,"end":94,"loc":{"start":{"line":1,"column":0},"end":{"line":6,"column":1}}, "id": { "type": "Identifier", - "start": 10, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "X" - }, + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11},"identifierName":"X"}, "name": "X" }, "typeParameters": null, @@ -66,49 +21,15 @@ "mixins": [], "body": { "type": "ObjectTypeAnnotation", - "start": 12, - "end": 94, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 6, - "column": 1 - } - }, + "start":12,"end":94,"loc":{"start":{"line":1,"column":12},"end":{"line":6,"column":1}}, "callProperties": [], "properties": [ { "type": "ObjectTypeProperty", - "start": 16, - "end": 33, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 19 - } - }, + "start":16,"end":33,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":19}}, "key": { "type": "Identifier", - "start": 16, - "end": 22, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 8 - }, - "identifierName": "foobar" - }, + "start":16,"end":22,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":8},"identifierName":"foobar"}, "name": "foobar" }, "static": false, @@ -117,49 +38,16 @@ "method": true, "value": { "type": "FunctionTypeAnnotation", - "start": 16, - "end": 33, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 19 - } - }, + "start":16,"end":33,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":19}}, "params": [], "rest": null, "typeParameters": { "type": "TypeParameterDeclaration", - "start": 22, - "end": 25, - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 11 - } - }, + "start":22,"end":25,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":11}}, "params": [ { "type": "TypeParameter", - "start": 23, - "end": 24, - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 10 - } - }, + "start":23,"end":24,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":10}}, "name": "T", "variance": null } @@ -167,51 +55,17 @@ }, "returnType": { "type": "VoidTypeAnnotation", - "start": 29, - "end": 33, - "loc": { - "start": { - "line": 2, - "column": 15 - }, - "end": { - "line": 2, - "column": 19 - } - } + "start":29,"end":33,"loc":{"start":{"line":2,"column":15},"end":{"line":2,"column":19}} } }, "optional": false }, { "type": "ObjectTypeProperty", - "start": 37, - "end": 54, - "loc": { - "start": { - "line": 3, - "column": 2 - }, - "end": { - "line": 3, - "column": 19 - } - }, + "start":37,"end":54,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":19}}, "key": { "type": "Identifier", - "start": 37, - "end": 43, - "loc": { - "start": { - "line": 3, - "column": 2 - }, - "end": { - "line": 3, - "column": 8 - }, - "identifierName": "delete" - }, + "start":37,"end":43,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":8},"identifierName":"delete"}, "name": "delete" }, "static": false, @@ -220,49 +74,16 @@ "method": true, "value": { "type": "FunctionTypeAnnotation", - "start": 37, - "end": 54, - "loc": { - "start": { - "line": 3, - "column": 2 - }, - "end": { - "line": 3, - "column": 19 - } - }, + "start":37,"end":54,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":19}}, "params": [], "rest": null, "typeParameters": { "type": "TypeParameterDeclaration", - "start": 43, - "end": 46, - "loc": { - "start": { - "line": 3, - "column": 8 - }, - "end": { - "line": 3, - "column": 11 - } - }, + "start":43,"end":46,"loc":{"start":{"line":3,"column":8},"end":{"line":3,"column":11}}, "params": [ { "type": "TypeParameter", - "start": 44, - "end": 45, - "loc": { - "start": { - "line": 3, - "column": 9 - }, - "end": { - "line": 3, - "column": 10 - } - }, + "start":44,"end":45,"loc":{"start":{"line":3,"column":9},"end":{"line":3,"column":10}}, "name": "T", "variance": null } @@ -270,51 +91,17 @@ }, "returnType": { "type": "VoidTypeAnnotation", - "start": 50, - "end": 54, - "loc": { - "start": { - "line": 3, - "column": 15 - }, - "end": { - "line": 3, - "column": 19 - } - } + "start":50,"end":54,"loc":{"start":{"line":3,"column":15},"end":{"line":3,"column":19}} } }, "optional": false }, { "type": "ObjectTypeProperty", - "start": 58, - "end": 74, - "loc": { - "start": { - "line": 4, - "column": 2 - }, - "end": { - "line": 4, - "column": 18 - } - }, + "start":58,"end":74,"loc":{"start":{"line":4,"column":2},"end":{"line":4,"column":18}}, "key": { "type": "Identifier", - "start": 58, - "end": 63, - "loc": { - "start": { - "line": 4, - "column": 2 - }, - "end": { - "line": 4, - "column": 7 - }, - "identifierName": "yield" - }, + "start":58,"end":63,"loc":{"start":{"line":4,"column":2},"end":{"line":4,"column":7},"identifierName":"yield"}, "name": "yield" }, "static": false, @@ -323,49 +110,16 @@ "method": true, "value": { "type": "FunctionTypeAnnotation", - "start": 58, - "end": 74, - "loc": { - "start": { - "line": 4, - "column": 2 - }, - "end": { - "line": 4, - "column": 18 - } - }, + "start":58,"end":74,"loc":{"start":{"line":4,"column":2},"end":{"line":4,"column":18}}, "params": [], "rest": null, "typeParameters": { "type": "TypeParameterDeclaration", - "start": 63, - "end": 66, - "loc": { - "start": { - "line": 4, - "column": 7 - }, - "end": { - "line": 4, - "column": 10 - } - }, + "start":63,"end":66,"loc":{"start":{"line":4,"column":7},"end":{"line":4,"column":10}}, "params": [ { "type": "TypeParameter", - "start": 64, - "end": 65, - "loc": { - "start": { - "line": 4, - "column": 8 - }, - "end": { - "line": 4, - "column": 9 - } - }, + "start":64,"end":65,"loc":{"start":{"line":4,"column":8},"end":{"line":4,"column":9}}, "name": "T", "variance": null } @@ -373,51 +127,17 @@ }, "returnType": { "type": "VoidTypeAnnotation", - "start": 70, - "end": 74, - "loc": { - "start": { - "line": 4, - "column": 14 - }, - "end": { - "line": 4, - "column": 18 - } - } + "start":70,"end":74,"loc":{"start":{"line":4,"column":14},"end":{"line":4,"column":18}} } }, "optional": false }, { "type": "ObjectTypeProperty", - "start": 78, - "end": 91, - "loc": { - "start": { - "line": 5, - "column": 2 - }, - "end": { - "line": 5, - "column": 15 - } - }, + "start":78,"end":91,"loc":{"start":{"line":5,"column":2},"end":{"line":5,"column":15}}, "key": { "type": "Identifier", - "start": 78, - "end": 80, - "loc": { - "start": { - "line": 5, - "column": 2 - }, - "end": { - "line": 5, - "column": 4 - }, - "identifierName": "do" - }, + "start":78,"end":80,"loc":{"start":{"line":5,"column":2},"end":{"line":5,"column":4},"identifierName":"do"}, "name": "do" }, "static": false, @@ -426,49 +146,16 @@ "method": true, "value": { "type": "FunctionTypeAnnotation", - "start": 78, - "end": 91, - "loc": { - "start": { - "line": 5, - "column": 2 - }, - "end": { - "line": 5, - "column": 15 - } - }, + "start":78,"end":91,"loc":{"start":{"line":5,"column":2},"end":{"line":5,"column":15}}, "params": [], "rest": null, "typeParameters": { "type": "TypeParameterDeclaration", - "start": 80, - "end": 83, - "loc": { - "start": { - "line": 5, - "column": 4 - }, - "end": { - "line": 5, - "column": 7 - } - }, + "start":80,"end":83,"loc":{"start":{"line":5,"column":4},"end":{"line":5,"column":7}}, "params": [ { "type": "TypeParameter", - "start": 81, - "end": 82, - "loc": { - "start": { - "line": 5, - "column": 5 - }, - "end": { - "line": 5, - "column": 6 - } - }, + "start":81,"end":82,"loc":{"start":{"line":5,"column":5},"end":{"line":5,"column":6}}, "name": "T", "variance": null } @@ -476,18 +163,7 @@ }, "returnType": { "type": "VoidTypeAnnotation", - "start": 87, - "end": 91, - "loc": { - "start": { - "line": 5, - "column": 11 - }, - "end": { - "line": 5, - "column": 15 - } - } + "start":87,"end":91,"loc":{"start":{"line":5,"column":11},"end":{"line":5,"column":15}} } }, "optional": false @@ -500,18 +176,7 @@ }, { "type": "EmptyStatement", - "start": 94, - "end": 95, - "loc": { - "start": { - "line": 6, - "column": 1 - }, - "end": { - "line": 6, - "column": 2 - } - } + "start":94,"end":95,"loc":{"start":{"line":6,"column":1},"end":{"line":6,"column":2}} } ], "directives": [] diff --git a/packages/babel-parser/test/fixtures/flow/type-parameter-declaration/object-method-type-param-jsx/output.json b/packages/babel-parser/test/fixtures/flow/type-parameter-declaration/object-method-type-param-jsx/output.json index 9cbc275b184b..a284774820eb 100644 --- a/packages/babel-parser/test/fixtures/flow/type-parameter-declaration/object-method-type-param-jsx/output.json +++ b/packages/babel-parser/test/fixtures/flow/type-parameter-declaration/object-method-type-param-jsx/output.json @@ -1,125 +1,35 @@ { "type": "File", - "start": 0, - "end": 42, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":42,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 42, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":42,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 42, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":42,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "declarations": [ { "type": "VariableDeclarator", - "start": 6, - "end": 42, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":6,"end":42,"loc":{"start":{"line":1,"column":6},"end":{"line":3,"column":1}}, "id": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "s" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"s"}, "name": "s" }, "init": { "type": "ObjectExpression", - "start": 10, - "end": 42, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":10,"end":42,"loc":{"start":{"line":1,"column":10},"end":{"line":3,"column":1}}, "properties": [ { "type": "ObjectMethod", - "start": 14, - "end": 39, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 27 - } - }, + "start":14,"end":39,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":27}}, "method": true, "key": { "type": "Identifier", - "start": 14, - "end": 20, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 8 - }, - "identifierName": "delete" - }, + "start":14,"end":20,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":8},"identifierName":"delete"}, "name": "delete" }, "computed": false, @@ -130,80 +40,24 @@ "params": [ { "type": "AssignmentPattern", - "start": 24, - "end": 35, - "loc": { - "start": { - "line": 2, - "column": 12 - }, - "end": { - "line": 2, - "column": 23 - } - }, + "start":24,"end":35,"loc":{"start":{"line":2,"column":12},"end":{"line":2,"column":23}}, "left": { "type": "Identifier", - "start": 24, - "end": 25, - "loc": { - "start": { - "line": 2, - "column": 12 - }, - "end": { - "line": 2, - "column": 13 - }, - "identifierName": "d" - }, + "start":24,"end":25,"loc":{"start":{"line":2,"column":12},"end":{"line":2,"column":13},"identifierName":"d"}, "name": "d" }, "right": { "type": "JSXElement", - "start": 28, - "end": 35, - "loc": { - "start": { - "line": 2, - "column": 16 - }, - "end": { - "line": 2, - "column": 23 - } - }, + "start":28,"end":35,"loc":{"start":{"line":2,"column":16},"end":{"line":2,"column":23}}, "openingElement": { "type": "JSXOpeningElement", - "start": 28, - "end": 35, - "loc": { - "start": { - "line": 2, - "column": 16 - }, - "end": { - "line": 2, - "column": 23 - } - }, - "attributes": [], + "start":28,"end":35,"loc":{"start":{"line":2,"column":16},"end":{"line":2,"column":23}}, "name": { "type": "JSXIdentifier", - "start": 29, - "end": 32, - "loc": { - "start": { - "line": 2, - "column": 17 - }, - "end": { - "line": 2, - "column": 20 - } - }, + "start":29,"end":32,"loc":{"start":{"line":2,"column":17},"end":{"line":2,"column":20}}, "name": "Foo" }, + "attributes": [], "selfClosing": true }, "closingElement": null, @@ -213,57 +67,27 @@ ], "body": { "type": "BlockStatement", - "start": 37, - "end": 39, - "loc": { - "start": { - "line": 2, - "column": 25 - }, - "end": { - "line": 2, - "column": 27 - } - }, + "start":37,"end":39,"loc":{"start":{"line":2,"column":25},"end":{"line":2,"column":27}}, "body": [], "directives": [] }, "typeParameters": { "type": "TypeParameterDeclaration", - "start": 20, - "end": 23, - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 11 - } - }, + "start":20,"end":23,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":11}}, "params": [ { "type": "TypeParameter", - "start": 21, - "end": 22, - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 10 - } - }, + "start":21,"end":22,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":10}}, "name": "T", "variance": null } ] } } - ] + ], + "extra": { + "trailingComma": 39 + } } } ], diff --git a/packages/babel-parser/test/fixtures/flow/type-parameter-declaration/object-reserved-word/output.json b/packages/babel-parser/test/fixtures/flow/type-parameter-declaration/object-reserved-word/output.json index 5a8cfcc689b0..f0b6c308604e 100644 --- a/packages/babel-parser/test/fixtures/flow/type-parameter-declaration/object-reserved-word/output.json +++ b/packages/babel-parser/test/fixtures/flow/type-parameter-declaration/object-reserved-word/output.json @@ -1,125 +1,35 @@ { "type": "File", - "start": 0, - "end": 81, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 6, - "column": 2 - } - }, + "start":0,"end":81,"loc":{"start":{"line":1,"column":0},"end":{"line":6,"column":2}}, "program": { "type": "Program", - "start": 0, - "end": 81, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 6, - "column": 2 - } - }, + "start":0,"end":81,"loc":{"start":{"line":1,"column":0},"end":{"line":6,"column":2}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 81, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 6, - "column": 2 - } - }, + "start":0,"end":81,"loc":{"start":{"line":1,"column":0},"end":{"line":6,"column":2}}, "declarations": [ { "type": "VariableDeclarator", - "start": 6, - "end": 80, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 6, - "column": 1 - } - }, + "start":6,"end":80,"loc":{"start":{"line":1,"column":6},"end":{"line":6,"column":1}}, "id": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "x" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"x"}, "name": "x" }, "init": { "type": "ObjectExpression", - "start": 10, - "end": 80, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 6, - "column": 1 - } - }, + "start":10,"end":80,"loc":{"start":{"line":1,"column":10},"end":{"line":6,"column":1}}, "properties": [ { "type": "ObjectMethod", - "start": 14, - "end": 28, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 16 - } - }, + "start":14,"end":28,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":16}}, "method": true, "key": { "type": "Identifier", - "start": 14, - "end": 20, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 8 - }, - "identifierName": "foobar" - }, + "start":14,"end":20,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":8},"identifierName":"foobar"}, "name": "foobar" }, "computed": false, @@ -130,50 +40,17 @@ "params": [], "body": { "type": "BlockStatement", - "start": 26, - "end": 28, - "loc": { - "start": { - "line": 2, - "column": 14 - }, - "end": { - "line": 2, - "column": 16 - } - }, + "start":26,"end":28,"loc":{"start":{"line":2,"column":14},"end":{"line":2,"column":16}}, "body": [], "directives": [] }, "typeParameters": { "type": "TypeParameterDeclaration", - "start": 20, - "end": 23, - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 11 - } - }, + "start":20,"end":23,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":11}}, "params": [ { "type": "TypeParameter", - "start": 21, - "end": 22, - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 10 - } - }, + "start":21,"end":22,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":10}}, "name": "T", "variance": null } @@ -182,34 +59,11 @@ }, { "type": "ObjectMethod", - "start": 32, - "end": 46, - "loc": { - "start": { - "line": 3, - "column": 2 - }, - "end": { - "line": 3, - "column": 16 - } - }, + "start":32,"end":46,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":16}}, "method": true, "key": { "type": "Identifier", - "start": 32, - "end": 38, - "loc": { - "start": { - "line": 3, - "column": 2 - }, - "end": { - "line": 3, - "column": 8 - }, - "identifierName": "delete" - }, + "start":32,"end":38,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":8},"identifierName":"delete"}, "name": "delete" }, "computed": false, @@ -220,50 +74,17 @@ "params": [], "body": { "type": "BlockStatement", - "start": 44, - "end": 46, - "loc": { - "start": { - "line": 3, - "column": 14 - }, - "end": { - "line": 3, - "column": 16 - } - }, + "start":44,"end":46,"loc":{"start":{"line":3,"column":14},"end":{"line":3,"column":16}}, "body": [], "directives": [] }, "typeParameters": { "type": "TypeParameterDeclaration", - "start": 38, - "end": 41, - "loc": { - "start": { - "line": 3, - "column": 8 - }, - "end": { - "line": 3, - "column": 11 - } - }, + "start":38,"end":41,"loc":{"start":{"line":3,"column":8},"end":{"line":3,"column":11}}, "params": [ { "type": "TypeParameter", - "start": 39, - "end": 40, - "loc": { - "start": { - "line": 3, - "column": 9 - }, - "end": { - "line": 3, - "column": 10 - } - }, + "start":39,"end":40,"loc":{"start":{"line":3,"column":9},"end":{"line":3,"column":10}}, "name": "T", "variance": null } @@ -272,34 +93,11 @@ }, { "type": "ObjectMethod", - "start": 50, - "end": 63, - "loc": { - "start": { - "line": 4, - "column": 2 - }, - "end": { - "line": 4, - "column": 15 - } - }, + "start":50,"end":63,"loc":{"start":{"line":4,"column":2},"end":{"line":4,"column":15}}, "method": true, "key": { "type": "Identifier", - "start": 50, - "end": 55, - "loc": { - "start": { - "line": 4, - "column": 2 - }, - "end": { - "line": 4, - "column": 7 - }, - "identifierName": "yield" - }, + "start":50,"end":55,"loc":{"start":{"line":4,"column":2},"end":{"line":4,"column":7},"identifierName":"yield"}, "name": "yield" }, "computed": false, @@ -310,50 +108,17 @@ "params": [], "body": { "type": "BlockStatement", - "start": 61, - "end": 63, - "loc": { - "start": { - "line": 4, - "column": 13 - }, - "end": { - "line": 4, - "column": 15 - } - }, + "start":61,"end":63,"loc":{"start":{"line":4,"column":13},"end":{"line":4,"column":15}}, "body": [], "directives": [] }, "typeParameters": { "type": "TypeParameterDeclaration", - "start": 55, - "end": 58, - "loc": { - "start": { - "line": 4, - "column": 7 - }, - "end": { - "line": 4, - "column": 10 - } - }, + "start":55,"end":58,"loc":{"start":{"line":4,"column":7},"end":{"line":4,"column":10}}, "params": [ { "type": "TypeParameter", - "start": 56, - "end": 57, - "loc": { - "start": { - "line": 4, - "column": 8 - }, - "end": { - "line": 4, - "column": 9 - } - }, + "start":56,"end":57,"loc":{"start":{"line":4,"column":8},"end":{"line":4,"column":9}}, "name": "T", "variance": null } @@ -362,34 +127,11 @@ }, { "type": "ObjectMethod", - "start": 67, - "end": 77, - "loc": { - "start": { - "line": 5, - "column": 2 - }, - "end": { - "line": 5, - "column": 12 - } - }, + "start":67,"end":77,"loc":{"start":{"line":5,"column":2},"end":{"line":5,"column":12}}, "method": true, "key": { "type": "Identifier", - "start": 67, - "end": 69, - "loc": { - "start": { - "line": 5, - "column": 2 - }, - "end": { - "line": 5, - "column": 4 - }, - "identifierName": "do" - }, + "start":67,"end":69,"loc":{"start":{"line":5,"column":2},"end":{"line":5,"column":4},"identifierName":"do"}, "name": "do" }, "computed": false, @@ -400,57 +142,27 @@ "params": [], "body": { "type": "BlockStatement", - "start": 75, - "end": 77, - "loc": { - "start": { - "line": 5, - "column": 10 - }, - "end": { - "line": 5, - "column": 12 - } - }, + "start":75,"end":77,"loc":{"start":{"line":5,"column":10},"end":{"line":5,"column":12}}, "body": [], "directives": [] }, "typeParameters": { "type": "TypeParameterDeclaration", - "start": 69, - "end": 72, - "loc": { - "start": { - "line": 5, - "column": 4 - }, - "end": { - "line": 5, - "column": 7 - } - }, + "start":69,"end":72,"loc":{"start":{"line":5,"column":4},"end":{"line":5,"column":7}}, "params": [ { "type": "TypeParameter", - "start": 70, - "end": 71, - "loc": { - "start": { - "line": 5, - "column": 5 - }, - "end": { - "line": 5, - "column": 6 - } - }, + "start":70,"end":71,"loc":{"start":{"line":5,"column":5},"end":{"line":5,"column":6}}, "name": "T", "variance": null } ] } } - ] + ], + "extra": { + "trailingComma": 77 + } } } ], diff --git a/packages/babel-parser/test/fixtures/flow/type-parameter-declaration/reserved-word-class-name-failure/options.json b/packages/babel-parser/test/fixtures/flow/type-parameter-declaration/reserved-word-class-name-failure/options.json index f45196d78df9..24ca50ff8791 100644 --- a/packages/babel-parser/test/fixtures/flow/type-parameter-declaration/reserved-word-class-name-failure/options.json +++ b/packages/babel-parser/test/fixtures/flow/type-parameter-declaration/reserved-word-class-name-failure/options.json @@ -1,4 +1,4 @@ { - "throws": "Unexpected keyword 'delete' (1:14)", + "sourceType": "module", "plugins": ["flow", "jsx"] } diff --git a/packages/babel-parser/test/fixtures/flow/type-parameter-declaration/reserved-word-class-name-failure/output.json b/packages/babel-parser/test/fixtures/flow/type-parameter-declaration/reserved-word-class-name-failure/output.json new file mode 100644 index 000000000000..3c1f8ac956fb --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/type-parameter-declaration/reserved-word-class-name-failure/output.json @@ -0,0 +1,38 @@ +{ + "type": "File", + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, + "errors": [ + "SyntaxError: Unexpected keyword 'delete' (1:14)" + ], + "program": { + "type": "Program", + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "DeclareClass", + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, + "id": { + "type": "Identifier", + "start":14,"end":20,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":20},"identifierName":"delete"}, + "name": "delete" + }, + "typeParameters": null, + "extends": [], + "implements": [], + "mixins": [], + "body": { + "type": "ObjectTypeAnnotation", + "start":21,"end":23,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":23}}, + "callProperties": [], + "properties": [], + "indexers": [], + "internalSlots": [], + "exact": false + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/type-parameter-declaration/type-object-reserved-word/output.json b/packages/babel-parser/test/fixtures/flow/type-parameter-declaration/type-object-reserved-word/output.json index d817f6ed4713..86e2ee528e18 100644 --- a/packages/babel-parser/test/fixtures/flow/type-parameter-declaration/type-object-reserved-word/output.json +++ b/packages/babel-parser/test/fixtures/flow/type-parameter-declaration/type-object-reserved-word/output.json @@ -1,111 +1,32 @@ { "type": "File", - "start": 0, - "end": 92, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 6, - "column": 2 - } - }, + "start":0,"end":92,"loc":{"start":{"line":1,"column":0},"end":{"line":6,"column":2}}, "program": { "type": "Program", - "start": 0, - "end": 92, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 6, - "column": 2 - } - }, + "start":0,"end":92,"loc":{"start":{"line":1,"column":0},"end":{"line":6,"column":2}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "TypeAlias", - "start": 0, - "end": 92, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 6, - "column": 2 - } - }, + "start":0,"end":92,"loc":{"start":{"line":1,"column":0},"end":{"line":6,"column":2}}, "id": { "type": "Identifier", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "X" - }, + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"X"}, "name": "X" }, "typeParameters": null, "right": { "type": "ObjectTypeAnnotation", - "start": 9, - "end": 91, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 6, - "column": 1 - } - }, + "start":9,"end":91,"loc":{"start":{"line":1,"column":9},"end":{"line":6,"column":1}}, "callProperties": [], "properties": [ { "type": "ObjectTypeProperty", - "start": 13, - "end": 30, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 19 - } - }, + "start":13,"end":30,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":19}}, "key": { "type": "Identifier", - "start": 13, - "end": 19, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 8 - }, - "identifierName": "foobar" - }, + "start":13,"end":19,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":8},"identifierName":"foobar"}, "name": "foobar" }, "static": false, @@ -114,49 +35,16 @@ "method": true, "value": { "type": "FunctionTypeAnnotation", - "start": 13, - "end": 30, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 19 - } - }, + "start":13,"end":30,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":19}}, "params": [], "rest": null, "typeParameters": { "type": "TypeParameterDeclaration", - "start": 19, - "end": 22, - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 11 - } - }, + "start":19,"end":22,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":11}}, "params": [ { "type": "TypeParameter", - "start": 20, - "end": 21, - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 10 - } - }, + "start":20,"end":21,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":10}}, "name": "T", "variance": null } @@ -164,51 +52,17 @@ }, "returnType": { "type": "VoidTypeAnnotation", - "start": 26, - "end": 30, - "loc": { - "start": { - "line": 2, - "column": 15 - }, - "end": { - "line": 2, - "column": 19 - } - } + "start":26,"end":30,"loc":{"start":{"line":2,"column":15},"end":{"line":2,"column":19}} } }, "optional": false }, { "type": "ObjectTypeProperty", - "start": 34, - "end": 51, - "loc": { - "start": { - "line": 3, - "column": 2 - }, - "end": { - "line": 3, - "column": 19 - } - }, + "start":34,"end":51,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":19}}, "key": { "type": "Identifier", - "start": 34, - "end": 40, - "loc": { - "start": { - "line": 3, - "column": 2 - }, - "end": { - "line": 3, - "column": 8 - }, - "identifierName": "delete" - }, + "start":34,"end":40,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":8},"identifierName":"delete"}, "name": "delete" }, "static": false, @@ -217,49 +71,16 @@ "method": true, "value": { "type": "FunctionTypeAnnotation", - "start": 34, - "end": 51, - "loc": { - "start": { - "line": 3, - "column": 2 - }, - "end": { - "line": 3, - "column": 19 - } - }, + "start":34,"end":51,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":19}}, "params": [], "rest": null, "typeParameters": { "type": "TypeParameterDeclaration", - "start": 40, - "end": 43, - "loc": { - "start": { - "line": 3, - "column": 8 - }, - "end": { - "line": 3, - "column": 11 - } - }, + "start":40,"end":43,"loc":{"start":{"line":3,"column":8},"end":{"line":3,"column":11}}, "params": [ { "type": "TypeParameter", - "start": 41, - "end": 42, - "loc": { - "start": { - "line": 3, - "column": 9 - }, - "end": { - "line": 3, - "column": 10 - } - }, + "start":41,"end":42,"loc":{"start":{"line":3,"column":9},"end":{"line":3,"column":10}}, "name": "T", "variance": null } @@ -267,51 +88,17 @@ }, "returnType": { "type": "VoidTypeAnnotation", - "start": 47, - "end": 51, - "loc": { - "start": { - "line": 3, - "column": 15 - }, - "end": { - "line": 3, - "column": 19 - } - } + "start":47,"end":51,"loc":{"start":{"line":3,"column":15},"end":{"line":3,"column":19}} } }, "optional": false }, { "type": "ObjectTypeProperty", - "start": 55, - "end": 71, - "loc": { - "start": { - "line": 4, - "column": 2 - }, - "end": { - "line": 4, - "column": 18 - } - }, + "start":55,"end":71,"loc":{"start":{"line":4,"column":2},"end":{"line":4,"column":18}}, "key": { "type": "Identifier", - "start": 55, - "end": 60, - "loc": { - "start": { - "line": 4, - "column": 2 - }, - "end": { - "line": 4, - "column": 7 - }, - "identifierName": "yield" - }, + "start":55,"end":60,"loc":{"start":{"line":4,"column":2},"end":{"line":4,"column":7},"identifierName":"yield"}, "name": "yield" }, "static": false, @@ -320,49 +107,16 @@ "method": true, "value": { "type": "FunctionTypeAnnotation", - "start": 55, - "end": 71, - "loc": { - "start": { - "line": 4, - "column": 2 - }, - "end": { - "line": 4, - "column": 18 - } - }, + "start":55,"end":71,"loc":{"start":{"line":4,"column":2},"end":{"line":4,"column":18}}, "params": [], "rest": null, "typeParameters": { "type": "TypeParameterDeclaration", - "start": 60, - "end": 63, - "loc": { - "start": { - "line": 4, - "column": 7 - }, - "end": { - "line": 4, - "column": 10 - } - }, + "start":60,"end":63,"loc":{"start":{"line":4,"column":7},"end":{"line":4,"column":10}}, "params": [ { "type": "TypeParameter", - "start": 61, - "end": 62, - "loc": { - "start": { - "line": 4, - "column": 8 - }, - "end": { - "line": 4, - "column": 9 - } - }, + "start":61,"end":62,"loc":{"start":{"line":4,"column":8},"end":{"line":4,"column":9}}, "name": "T", "variance": null } @@ -370,51 +124,17 @@ }, "returnType": { "type": "VoidTypeAnnotation", - "start": 67, - "end": 71, - "loc": { - "start": { - "line": 4, - "column": 14 - }, - "end": { - "line": 4, - "column": 18 - } - } + "start":67,"end":71,"loc":{"start":{"line":4,"column":14},"end":{"line":4,"column":18}} } }, "optional": false }, { "type": "ObjectTypeProperty", - "start": 75, - "end": 88, - "loc": { - "start": { - "line": 5, - "column": 2 - }, - "end": { - "line": 5, - "column": 15 - } - }, + "start":75,"end":88,"loc":{"start":{"line":5,"column":2},"end":{"line":5,"column":15}}, "key": { "type": "Identifier", - "start": 75, - "end": 77, - "loc": { - "start": { - "line": 5, - "column": 2 - }, - "end": { - "line": 5, - "column": 4 - }, - "identifierName": "do" - }, + "start":75,"end":77,"loc":{"start":{"line":5,"column":2},"end":{"line":5,"column":4},"identifierName":"do"}, "name": "do" }, "static": false, @@ -423,49 +143,16 @@ "method": true, "value": { "type": "FunctionTypeAnnotation", - "start": 75, - "end": 88, - "loc": { - "start": { - "line": 5, - "column": 2 - }, - "end": { - "line": 5, - "column": 15 - } - }, + "start":75,"end":88,"loc":{"start":{"line":5,"column":2},"end":{"line":5,"column":15}}, "params": [], "rest": null, "typeParameters": { "type": "TypeParameterDeclaration", - "start": 77, - "end": 80, - "loc": { - "start": { - "line": 5, - "column": 4 - }, - "end": { - "line": 5, - "column": 7 - } - }, + "start":77,"end":80,"loc":{"start":{"line":5,"column":4},"end":{"line":5,"column":7}}, "params": [ { "type": "TypeParameter", - "start": 78, - "end": 79, - "loc": { - "start": { - "line": 5, - "column": 5 - }, - "end": { - "line": 5, - "column": 6 - } - }, + "start":78,"end":79,"loc":{"start":{"line":5,"column":5},"end":{"line":5,"column":6}}, "name": "T", "variance": null } @@ -473,18 +160,7 @@ }, "returnType": { "type": "VoidTypeAnnotation", - "start": 84, - "end": 88, - "loc": { - "start": { - "line": 5, - "column": 11 - }, - "end": { - "line": 5, - "column": 15 - } - } + "start":84,"end":88,"loc":{"start":{"line":5,"column":11},"end":{"line":5,"column":15}} } }, "optional": false diff --git a/packages/babel-parser/test/fixtures/flow/typeapp-call/async-call/output.json b/packages/babel-parser/test/fixtures/flow/typeapp-call/async-call/output.json index 7df2d61ae2d7..c73062c2bf89 100644 --- a/packages/babel-parser/test/fixtures/flow/typeapp-call/async-call/output.json +++ b/packages/babel-parser/test/fixtures/flow/typeapp-call/async-call/output.json @@ -1,124 +1,34 @@ { "type": "File", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 11 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":11}}, "program": { "type": "Program", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 11 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":11}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 9, - "end": 20, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 11 - } - }, + "start":9,"end":20,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":11}}, "expression": { "type": "CallExpression", - "start": 9, - "end": 19, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 10 - } - }, + "start":9,"end":19,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":10}}, "callee": { "type": "Identifier", - "start": 9, - "end": 14, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 5 - }, - "identifierName": "async" - }, + "start":9,"end":14,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":5},"identifierName":"async"}, "name": "async" }, "typeArguments": { "type": "TypeParameterInstantiation", - "start": 14, - "end": 17, - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 8 - } - }, + "start":14,"end":17,"loc":{"start":{"line":2,"column":5},"end":{"line":2,"column":8}}, "params": [ { "type": "GenericTypeAnnotation", - "start": 15, - "end": 16, - "loc": { - "start": { - "line": 2, - "column": 6 - }, - "end": { - "line": 2, - "column": 7 - } - }, + "start":15,"end":16,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":7}}, "typeParameters": null, "id": { "type": "Identifier", - "start": 15, - "end": 16, - "loc": { - "start": { - "line": 2, - "column": 6 - }, - "end": { - "line": 2, - "column": 7 - }, - "identifierName": "T" - }, + "start":15,"end":16,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":7},"identifierName":"T"}, "name": "T" } } @@ -130,18 +40,7 @@ { "type": "CommentLine", "value": " @flow", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - } + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}} } ] } @@ -152,18 +51,7 @@ { "type": "CommentLine", "value": " @flow", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - } + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}} } ] } \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/typeapp-call/async-generic-arrow/output.json b/packages/babel-parser/test/fixtures/flow/typeapp-call/async-generic-arrow/output.json index e70ff3c2755e..339773cf697e 100644 --- a/packages/babel-parser/test/fixtures/flow/typeapp-call/async-generic-arrow/output.json +++ b/packages/babel-parser/test/fixtures/flow/typeapp-call/async-generic-arrow/output.json @@ -1,91 +1,25 @@ { "type": "File", - "start": 0, - "end": 48, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 20 - } - }, + "start":0,"end":48,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":20}}, "program": { "type": "Program", - "start": 0, - "end": 48, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 20 - } - }, + "start":0,"end":48,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":20}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 9, - "end": 27, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 18 - } - }, + "start":9,"end":27,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":18}}, "expression": { "type": "ArrowFunctionExpression", - "start": 9, - "end": 26, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 17 - } - }, + "start":9,"end":26,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":17}}, "typeParameters": { "type": "TypeParameterDeclaration", - "start": 15, - "end": 18, - "loc": { - "start": { - "line": 2, - "column": 6 - }, - "end": { - "line": 2, - "column": 9 - } - }, + "start":15,"end":18,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":9}}, "params": [ { "type": "TypeParameter", - "start": 16, - "end": 17, - "loc": { - "start": { - "line": 2, - "column": 7 - }, - "end": { - "line": 2, - "column": 8 - } - }, + "start":16,"end":17,"loc":{"start":{"line":2,"column":7},"end":{"line":2,"column":8}}, "name": "T", "variance": null } @@ -97,18 +31,7 @@ "async": true, "body": { "type": "BlockStatement", - "start": 24, - "end": 26, - "loc": { - "start": { - "line": 2, - "column": 15 - }, - "end": { - "line": 2, - "column": 17 - } - }, + "start":24,"end":26,"loc":{"start":{"line":2,"column":15},"end":{"line":2,"column":17}}, "body": [], "directives": [] } @@ -117,78 +40,23 @@ { "type": "CommentLine", "value": " @flow", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - } + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}} } ] }, { "type": "ExpressionStatement", - "start": 28, - "end": 48, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 20 - } - }, + "start":28,"end":48,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":20}}, "expression": { "type": "ArrowFunctionExpression", - "start": 28, - "end": 48, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 20 - } - }, + "start":28,"end":48,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":20}}, "typeParameters": { "type": "TypeParameterDeclaration", - "start": 34, - "end": 37, - "loc": { - "start": { - "line": 3, - "column": 6 - }, - "end": { - "line": 3, - "column": 9 - } - }, + "start":34,"end":37,"loc":{"start":{"line":3,"column":6},"end":{"line":3,"column":9}}, "params": [ { "type": "TypeParameter", - "start": 35, - "end": 36, - "loc": { - "start": { - "line": 3, - "column": 7 - }, - "end": { - "line": 3, - "column": 8 - } - }, + "start":35,"end":36,"loc":{"start":{"line":3,"column":7},"end":{"line":3,"column":8}}, "name": "T", "variance": null } @@ -198,48 +66,14 @@ "predicate": null, "returnType": { "type": "TypeAnnotation", - "start": 39, - "end": 42, - "loc": { - "start": { - "line": 3, - "column": 11 - }, - "end": { - "line": 3, - "column": 14 - } - }, + "start":39,"end":42,"loc":{"start":{"line":3,"column":11},"end":{"line":3,"column":14}}, "typeAnnotation": { "type": "GenericTypeAnnotation", - "start": 41, - "end": 42, - "loc": { - "start": { - "line": 3, - "column": 13 - }, - "end": { - "line": 3, - "column": 14 - } - }, + "start":41,"end":42,"loc":{"start":{"line":3,"column":13},"end":{"line":3,"column":14}}, "typeParameters": null, "id": { "type": "Identifier", - "start": 41, - "end": 42, - "loc": { - "start": { - "line": 3, - "column": 13 - }, - "end": { - "line": 3, - "column": 14 - }, - "identifierName": "T" - }, + "start":41,"end":42,"loc":{"start":{"line":3,"column":13},"end":{"line":3,"column":14},"identifierName":"T"}, "name": "T" } } @@ -249,18 +83,7 @@ "async": true, "body": { "type": "BlockStatement", - "start": 46, - "end": 48, - "loc": { - "start": { - "line": 3, - "column": 18 - }, - "end": { - "line": 3, - "column": 20 - } - }, + "start":46,"end":48,"loc":{"start":{"line":3,"column":18},"end":{"line":3,"column":20}}, "body": [], "directives": [] } @@ -273,18 +96,7 @@ { "type": "CommentLine", "value": " @flow", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - } + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}} } ] } \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/typeapp-call/disabled-ambiguous-call/output.json b/packages/babel-parser/test/fixtures/flow/typeapp-call/disabled-ambiguous-call/output.json index fc7f1bc6ce23..c83517dcff09 100644 --- a/packages/babel-parser/test/fixtures/flow/typeapp-call/disabled-ambiguous-call/output.json +++ b/packages/babel-parser/test/fixtures/flow/typeapp-call/disabled-ambiguous-call/output.json @@ -1,128 +1,37 @@ { "type": "File", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, "program": { "type": "Program", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, "expression": { "type": "BinaryExpression", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "left": { "type": "BinaryExpression", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, "left": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "f" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"f"}, "name": "f" }, "operator": "<", "right": { "type": "Identifier", - "start": 2, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 3 - }, - "identifierName": "T" - }, + "start":2,"end":3,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":3},"identifierName":"T"}, "name": "T" } }, "operator": ">", "right": { "type": "Identifier", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "e" - }, + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"e"}, "name": "e", "extra": { "parenthesized": true, diff --git a/packages/babel-parser/test/fixtures/flow/typeapp-call/disabled-ambiguous-new/output.json b/packages/babel-parser/test/fixtures/flow/typeapp-call/disabled-ambiguous-new/output.json index 260f1c730965..b7e5a930e256 100644 --- a/packages/babel-parser/test/fixtures/flow/typeapp-call/disabled-ambiguous-new/output.json +++ b/packages/babel-parser/test/fixtures/flow/typeapp-call/disabled-ambiguous-new/output.json @@ -1,105 +1,27 @@ { "type": "File", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, "program": { "type": "Program", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, "expression": { "type": "BinaryExpression", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "left": { "type": "BinaryExpression", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "left": { "type": "NewExpression", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "callee": { "type": "Identifier", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "C" - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"C"}, "name": "C" }, "typeArguments": null, @@ -108,38 +30,14 @@ "operator": "<", "right": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "T" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"T"}, "name": "T" } }, "operator": ">", "right": { "type": "Identifier", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - }, - "identifierName": "e" - }, + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"e"}, "name": "e", "extra": { "parenthesized": true, diff --git a/packages/babel-parser/test/fixtures/flow/typeapp-call/function-call-chain/output.json b/packages/babel-parser/test/fixtures/flow/typeapp-call/function-call-chain/output.json index a75a9589d316..f09c475b6126 100644 --- a/packages/babel-parser/test/fixtures/flow/typeapp-call/function-call-chain/output.json +++ b/packages/babel-parser/test/fixtures/flow/typeapp-call/function-call-chain/output.json @@ -1,138 +1,37 @@ { "type": "File", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 14 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":14}}, "program": { "type": "Program", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 14 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":14}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 9, - "end": 23, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 14 - } - }, + "start":9,"end":23,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":14}}, "expression": { "type": "CallExpression", - "start": 9, - "end": 22, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 13 - } - }, + "start":9,"end":22,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":13}}, "callee": { "type": "CallExpression", - "start": 9, - "end": 16, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 7 - } - }, + "start":9,"end":16,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":7}}, "callee": { "type": "Identifier", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 1 - }, - "identifierName": "f" - }, + "start":9,"end":10,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":1},"identifierName":"f"}, "name": "f" }, "typeArguments": { "type": "TypeParameterInstantiation", - "start": 10, - "end": 13, - "loc": { - "start": { - "line": 2, - "column": 1 - }, - "end": { - "line": 2, - "column": 4 - } - }, + "start":10,"end":13,"loc":{"start":{"line":2,"column":1},"end":{"line":2,"column":4}}, "params": [ { "type": "GenericTypeAnnotation", - "start": 11, - "end": 12, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 3 - } - }, + "start":11,"end":12,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":3}}, "typeParameters": null, "id": { "type": "Identifier", - "start": 11, - "end": 12, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 3 - }, - "identifierName": "T" - }, + "start":11,"end":12,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":3},"identifierName":"T"}, "name": "T" } } @@ -141,68 +40,22 @@ "arguments": [ { "type": "Identifier", - "start": 14, - "end": 15, - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 6 - }, - "identifierName": "x" - }, + "start":14,"end":15,"loc":{"start":{"line":2,"column":5},"end":{"line":2,"column":6},"identifierName":"x"}, "name": "x" } ] }, "typeArguments": { "type": "TypeParameterInstantiation", - "start": 16, - "end": 19, - "loc": { - "start": { - "line": 2, - "column": 7 - }, - "end": { - "line": 2, - "column": 10 - } - }, + "start":16,"end":19,"loc":{"start":{"line":2,"column":7},"end":{"line":2,"column":10}}, "params": [ { "type": "GenericTypeAnnotation", - "start": 17, - "end": 18, - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 9 - } - }, + "start":17,"end":18,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":9}}, "typeParameters": null, "id": { "type": "Identifier", - "start": 17, - "end": 18, - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 9 - }, - "identifierName": "U" - }, + "start":17,"end":18,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":9},"identifierName":"U"}, "name": "U" } } @@ -211,19 +64,7 @@ "arguments": [ { "type": "Identifier", - "start": 20, - "end": 21, - "loc": { - "start": { - "line": 2, - "column": 11 - }, - "end": { - "line": 2, - "column": 12 - }, - "identifierName": "y" - }, + "start":20,"end":21,"loc":{"start":{"line":2,"column":11},"end":{"line":2,"column":12},"identifierName":"y"}, "name": "y" } ] @@ -232,18 +73,7 @@ { "type": "CommentLine", "value": " @flow", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - } + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}} } ] } @@ -254,18 +84,7 @@ { "type": "CommentLine", "value": " @flow", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - } + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}} } ] } \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/typeapp-call/function-call-optional/options.json b/packages/babel-parser/test/fixtures/flow/typeapp-call/function-call-optional/options.json index 05e42d81055f..698e7668500f 100644 --- a/packages/babel-parser/test/fixtures/flow/typeapp-call/function-call-optional/options.json +++ b/packages/babel-parser/test/fixtures/flow/typeapp-call/function-call-optional/options.json @@ -1,3 +1,3 @@ { - "plugins": ["jsx", "flow", "optionalChaining"] + "plugins": ["jsx", "flow"] } diff --git a/packages/babel-parser/test/fixtures/flow/typeapp-call/function-call-optional/output.json b/packages/babel-parser/test/fixtures/flow/typeapp-call/function-call-optional/output.json index 1b67e740c14e..14d0d4bfbaa0 100644 --- a/packages/babel-parser/test/fixtures/flow/typeapp-call/function-call-optional/output.json +++ b/packages/babel-parser/test/fixtures/flow/typeapp-call/function-call-optional/output.json @@ -1,124 +1,34 @@ { "type": "File", - "start": 0, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 10 - } - }, + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":10}}, "program": { "type": "Program", - "start": 0, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 10 - } - }, + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":10}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 9, - "end": 19, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 10 - } - }, + "start":9,"end":19,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":10}}, "expression": { "type": "OptionalCallExpression", - "start": 9, - "end": 18, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 9 - } - }, + "start":9,"end":18,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":9}}, "callee": { "type": "Identifier", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 1 - }, - "identifierName": "f" - }, + "start":9,"end":10,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":1},"identifierName":"f"}, "name": "f" }, "typeArguments": { "type": "TypeParameterInstantiation", - "start": 12, - "end": 15, - "loc": { - "start": { - "line": 2, - "column": 3 - }, - "end": { - "line": 2, - "column": 6 - } - }, + "start":12,"end":15,"loc":{"start":{"line":2,"column":3},"end":{"line":2,"column":6}}, "params": [ { "type": "GenericTypeAnnotation", - "start": 13, - "end": 14, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 5 - } - }, + "start":13,"end":14,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":5}}, "typeParameters": null, "id": { "type": "Identifier", - "start": 13, - "end": 14, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 5 - }, - "identifierName": "T" - }, + "start":13,"end":14,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":5},"identifierName":"T"}, "name": "T" } } @@ -127,19 +37,7 @@ "arguments": [ { "type": "Identifier", - "start": 16, - "end": 17, - "loc": { - "start": { - "line": 2, - "column": 7 - }, - "end": { - "line": 2, - "column": 8 - }, - "identifierName": "e" - }, + "start":16,"end":17,"loc":{"start":{"line":2,"column":7},"end":{"line":2,"column":8},"identifierName":"e"}, "name": "e" } ], @@ -149,18 +47,7 @@ { "type": "CommentLine", "value": " @flow", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - } + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}} } ] } @@ -171,18 +58,7 @@ { "type": "CommentLine", "value": " @flow", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - } + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}} } ] } \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/typeapp-call/function-call/output.json b/packages/babel-parser/test/fixtures/flow/typeapp-call/function-call/output.json index d5ac0faff366..3118e7c29ccb 100644 --- a/packages/babel-parser/test/fixtures/flow/typeapp-call/function-call/output.json +++ b/packages/babel-parser/test/fixtures/flow/typeapp-call/function-call/output.json @@ -1,124 +1,34 @@ { "type": "File", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 7 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":7}}, "program": { "type": "Program", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 7 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":7}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 9, - "end": 16, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 7 - } - }, + "start":9,"end":16,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":7}}, "expression": { "type": "CallExpression", - "start": 9, - "end": 15, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 6 - } - }, + "start":9,"end":15,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":6}}, "callee": { "type": "Identifier", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 1 - }, - "identifierName": "f" - }, + "start":9,"end":10,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":1},"identifierName":"f"}, "name": "f" }, "typeArguments": { "type": "TypeParameterInstantiation", - "start": 10, - "end": 13, - "loc": { - "start": { - "line": 2, - "column": 1 - }, - "end": { - "line": 2, - "column": 4 - } - }, + "start":10,"end":13,"loc":{"start":{"line":2,"column":1},"end":{"line":2,"column":4}}, "params": [ { "type": "GenericTypeAnnotation", - "start": 11, - "end": 12, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 3 - } - }, + "start":11,"end":12,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":3}}, "typeParameters": null, "id": { "type": "Identifier", - "start": 11, - "end": 12, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 3 - }, - "identifierName": "T" - }, + "start":11,"end":12,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":3},"identifierName":"T"}, "name": "T" } } @@ -130,18 +40,7 @@ { "type": "CommentLine", "value": " @flow", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - } + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}} } ] } @@ -152,18 +51,7 @@ { "type": "CommentLine", "value": " @flow", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - } + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}} } ] } \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/typeapp-call/method-call-computed/output.json b/packages/babel-parser/test/fixtures/flow/typeapp-call/method-call-computed/output.json index d2fb70504640..acef855dde41 100644 --- a/packages/babel-parser/test/fixtures/flow/typeapp-call/method-call-computed/output.json +++ b/packages/babel-parser/test/fixtures/flow/typeapp-call/method-call-computed/output.json @@ -1,157 +1,44 @@ { "type": "File", - "start": 0, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 10 - } - }, + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":10}}, "program": { "type": "Program", - "start": 0, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 10 - } - }, + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":10}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 9, - "end": 19, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 10 - } - }, + "start":9,"end":19,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":10}}, "expression": { "type": "CallExpression", - "start": 9, - "end": 18, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 9 - } - }, + "start":9,"end":18,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":9}}, "callee": { "type": "MemberExpression", - "start": 9, - "end": 13, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 4 - } - }, + "start":9,"end":13,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":4}}, "object": { "type": "Identifier", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 1 - }, - "identifierName": "o" - }, + "start":9,"end":10,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":1},"identifierName":"o"}, "name": "o" }, "property": { "type": "Identifier", - "start": 11, - "end": 12, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 3 - }, - "identifierName": "e" - }, + "start":11,"end":12,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":3},"identifierName":"e"}, "name": "e" }, "computed": true }, "typeArguments": { "type": "TypeParameterInstantiation", - "start": 13, - "end": 16, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 7 - } - }, + "start":13,"end":16,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":7}}, "params": [ { "type": "GenericTypeAnnotation", - "start": 14, - "end": 15, - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 6 - } - }, + "start":14,"end":15,"loc":{"start":{"line":2,"column":5},"end":{"line":2,"column":6}}, "typeParameters": null, "id": { "type": "Identifier", - "start": 14, - "end": 15, - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 6 - }, - "identifierName": "T" - }, + "start":14,"end":15,"loc":{"start":{"line":2,"column":5},"end":{"line":2,"column":6},"identifierName":"T"}, "name": "T" } } @@ -163,18 +50,7 @@ { "type": "CommentLine", "value": " @flow", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - } + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}} } ] } @@ -185,18 +61,7 @@ { "type": "CommentLine", "value": " @flow", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - } + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}} } ] } \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/typeapp-call/method-call-optional/options.json b/packages/babel-parser/test/fixtures/flow/typeapp-call/method-call-optional/options.json index 05e42d81055f..698e7668500f 100644 --- a/packages/babel-parser/test/fixtures/flow/typeapp-call/method-call-optional/options.json +++ b/packages/babel-parser/test/fixtures/flow/typeapp-call/method-call-optional/options.json @@ -1,3 +1,3 @@ { - "plugins": ["jsx", "flow", "optionalChaining"] + "plugins": ["jsx", "flow"] } diff --git a/packages/babel-parser/test/fixtures/flow/typeapp-call/method-call-optional/output.json b/packages/babel-parser/test/fixtures/flow/typeapp-call/method-call-optional/output.json index d8b08d1da8b3..9a2538975c98 100644 --- a/packages/babel-parser/test/fixtures/flow/typeapp-call/method-call-optional/output.json +++ b/packages/babel-parser/test/fixtures/flow/typeapp-call/method-call-optional/output.json @@ -1,108 +1,29 @@ { "type": "File", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 11 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":11}}, "program": { "type": "Program", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 11 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":11}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 9, - "end": 20, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 11 - } - }, + "start":9,"end":20,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":11}}, "expression": { "type": "OptionalCallExpression", - "start": 9, - "end": 19, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 10 - } - }, + "start":9,"end":19,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":10}}, "callee": { "type": "OptionalMemberExpression", - "start": 9, - "end": 13, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 4 - } - }, + "start":9,"end":13,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":4}}, "object": { "type": "Identifier", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 1 - }, - "identifierName": "o" - }, + "start":9,"end":10,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":1},"identifierName":"o"}, "name": "o" }, "property": { "type": "Identifier", - "start": 12, - "end": 13, - "loc": { - "start": { - "line": 2, - "column": 3 - }, - "end": { - "line": 2, - "column": 4 - }, - "identifierName": "m" - }, + "start":12,"end":13,"loc":{"start":{"line":2,"column":3},"end":{"line":2,"column":4},"identifierName":"m"}, "name": "m" }, "computed": false, @@ -110,49 +31,15 @@ }, "typeArguments": { "type": "TypeParameterInstantiation", - "start": 13, - "end": 16, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 7 - } - }, + "start":13,"end":16,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":7}}, "params": [ { "type": "GenericTypeAnnotation", - "start": 14, - "end": 15, - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 6 - } - }, + "start":14,"end":15,"loc":{"start":{"line":2,"column":5},"end":{"line":2,"column":6}}, "typeParameters": null, "id": { "type": "Identifier", - "start": 14, - "end": 15, - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 6 - }, - "identifierName": "T" - }, + "start":14,"end":15,"loc":{"start":{"line":2,"column":5},"end":{"line":2,"column":6},"identifierName":"T"}, "name": "T" } } @@ -161,19 +48,7 @@ "arguments": [ { "type": "Identifier", - "start": 17, - "end": 18, - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 9 - }, - "identifierName": "e" - }, + "start":17,"end":18,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":9},"identifierName":"e"}, "name": "e" } ], @@ -183,18 +58,7 @@ { "type": "CommentLine", "value": " @flow", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - } + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}} } ] } @@ -205,18 +69,7 @@ { "type": "CommentLine", "value": " @flow", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - } + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}} } ] } \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/typeapp-call/method-call-optional2/options.json b/packages/babel-parser/test/fixtures/flow/typeapp-call/method-call-optional2/options.json index 05e42d81055f..698e7668500f 100644 --- a/packages/babel-parser/test/fixtures/flow/typeapp-call/method-call-optional2/options.json +++ b/packages/babel-parser/test/fixtures/flow/typeapp-call/method-call-optional2/options.json @@ -1,3 +1,3 @@ { - "plugins": ["jsx", "flow", "optionalChaining"] + "plugins": ["jsx", "flow"] } diff --git a/packages/babel-parser/test/fixtures/flow/typeapp-call/method-call-optional2/output.json b/packages/babel-parser/test/fixtures/flow/typeapp-call/method-call-optional2/output.json index 0dc5c6af71e8..152e3df13b06 100644 --- a/packages/babel-parser/test/fixtures/flow/typeapp-call/method-call-optional2/output.json +++ b/packages/babel-parser/test/fixtures/flow/typeapp-call/method-call-optional2/output.json @@ -1,157 +1,44 @@ { "type": "File", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 12 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":12}}, "program": { "type": "Program", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 12 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":12}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 9, - "end": 21, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 12 - } - }, + "start":9,"end":21,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":12}}, "expression": { "type": "OptionalCallExpression", - "start": 9, - "end": 20, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 11 - } - }, + "start":9,"end":20,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":11}}, "callee": { "type": "MemberExpression", - "start": 9, - "end": 12, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 3 - } - }, + "start":9,"end":12,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":3}}, "object": { "type": "Identifier", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 1 - }, - "identifierName": "o" - }, + "start":9,"end":10,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":1},"identifierName":"o"}, "name": "o" }, "property": { "type": "Identifier", - "start": 11, - "end": 12, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 3 - }, - "identifierName": "m" - }, + "start":11,"end":12,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":3},"identifierName":"m"}, "name": "m" }, "computed": false }, "typeArguments": { "type": "TypeParameterInstantiation", - "start": 14, - "end": 17, - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 8 - } - }, + "start":14,"end":17,"loc":{"start":{"line":2,"column":5},"end":{"line":2,"column":8}}, "params": [ { "type": "GenericTypeAnnotation", - "start": 15, - "end": 16, - "loc": { - "start": { - "line": 2, - "column": 6 - }, - "end": { - "line": 2, - "column": 7 - } - }, + "start":15,"end":16,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":7}}, "typeParameters": null, "id": { "type": "Identifier", - "start": 15, - "end": 16, - "loc": { - "start": { - "line": 2, - "column": 6 - }, - "end": { - "line": 2, - "column": 7 - }, - "identifierName": "T" - }, + "start":15,"end":16,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":7},"identifierName":"T"}, "name": "T" } } @@ -160,19 +47,7 @@ "arguments": [ { "type": "Identifier", - "start": 18, - "end": 19, - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 10 - }, - "identifierName": "e" - }, + "start":18,"end":19,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":10},"identifierName":"e"}, "name": "e" } ], @@ -182,18 +57,7 @@ { "type": "CommentLine", "value": " @flow", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - } + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}} } ] } @@ -204,18 +68,7 @@ { "type": "CommentLine", "value": " @flow", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - } + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}} } ] } \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/typeapp-call/method-call/output.json b/packages/babel-parser/test/fixtures/flow/typeapp-call/method-call/output.json index 9be1647ab244..b4ee22f6fcd4 100644 --- a/packages/babel-parser/test/fixtures/flow/typeapp-call/method-call/output.json +++ b/packages/babel-parser/test/fixtures/flow/typeapp-call/method-call/output.json @@ -1,157 +1,44 @@ { "type": "File", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 9 - } - }, + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":9}}, "program": { "type": "Program", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 9 - } - }, + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":9}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 9, - "end": 18, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 9 - } - }, + "start":9,"end":18,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":9}}, "expression": { "type": "CallExpression", - "start": 9, - "end": 17, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 8 - } - }, + "start":9,"end":17,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":8}}, "callee": { "type": "MemberExpression", - "start": 9, - "end": 12, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 3 - } - }, + "start":9,"end":12,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":3}}, "object": { "type": "Identifier", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 1 - }, - "identifierName": "o" - }, + "start":9,"end":10,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":1},"identifierName":"o"}, "name": "o" }, "property": { "type": "Identifier", - "start": 11, - "end": 12, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 3 - }, - "identifierName": "m" - }, + "start":11,"end":12,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":3},"identifierName":"m"}, "name": "m" }, "computed": false }, "typeArguments": { "type": "TypeParameterInstantiation", - "start": 12, - "end": 15, - "loc": { - "start": { - "line": 2, - "column": 3 - }, - "end": { - "line": 2, - "column": 6 - } - }, + "start":12,"end":15,"loc":{"start":{"line":2,"column":3},"end":{"line":2,"column":6}}, "params": [ { "type": "GenericTypeAnnotation", - "start": 13, - "end": 14, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 5 - } - }, + "start":13,"end":14,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":5}}, "typeParameters": null, "id": { "type": "Identifier", - "start": 13, - "end": 14, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 5 - }, - "identifierName": "T" - }, + "start":13,"end":14,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":5},"identifierName":"T"}, "name": "T" } } @@ -163,18 +50,7 @@ { "type": "CommentLine", "value": " @flow", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - } + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}} } ] } @@ -185,18 +61,7 @@ { "type": "CommentLine", "value": " @flow", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - } + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}} } ] } \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/typeapp-call/new-noparens/output.json b/packages/babel-parser/test/fixtures/flow/typeapp-call/new-noparens/output.json index 78b8589e63d1..6eefbdf4a3ba 100644 --- a/packages/babel-parser/test/fixtures/flow/typeapp-call/new-noparens/output.json +++ b/packages/babel-parser/test/fixtures/flow/typeapp-call/new-noparens/output.json @@ -1,124 +1,34 @@ { "type": "File", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 9 - } - }, + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":9}}, "program": { "type": "Program", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 9 - } - }, + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":9}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 9, - "end": 18, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 9 - } - }, + "start":9,"end":18,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":9}}, "expression": { "type": "NewExpression", - "start": 9, - "end": 17, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 8 - } - }, + "start":9,"end":17,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":8}}, "callee": { "type": "Identifier", - "start": 13, - "end": 14, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 5 - }, - "identifierName": "C" - }, + "start":13,"end":14,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":5},"identifierName":"C"}, "name": "C" }, "typeArguments": { "type": "TypeParameterInstantiation", - "start": 14, - "end": 17, - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 8 - } - }, + "start":14,"end":17,"loc":{"start":{"line":2,"column":5},"end":{"line":2,"column":8}}, "params": [ { "type": "GenericTypeAnnotation", - "start": 15, - "end": 16, - "loc": { - "start": { - "line": 2, - "column": 6 - }, - "end": { - "line": 2, - "column": 7 - } - }, + "start":15,"end":16,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":7}}, "typeParameters": null, "id": { "type": "Identifier", - "start": 15, - "end": 16, - "loc": { - "start": { - "line": 2, - "column": 6 - }, - "end": { - "line": 2, - "column": 7 - }, - "identifierName": "T" - }, + "start":15,"end":16,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":7},"identifierName":"T"}, "name": "T" } } @@ -130,18 +40,7 @@ { "type": "CommentLine", "value": " @flow", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - } + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}} } ] } @@ -152,18 +51,7 @@ { "type": "CommentLine", "value": " @flow", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - } + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}} } ] } \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/typeapp-call/new/output.json b/packages/babel-parser/test/fixtures/flow/typeapp-call/new/output.json index f98a88da1fec..80f780346aca 100644 --- a/packages/babel-parser/test/fixtures/flow/typeapp-call/new/output.json +++ b/packages/babel-parser/test/fixtures/flow/typeapp-call/new/output.json @@ -1,124 +1,34 @@ { "type": "File", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 11 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":11}}, "program": { "type": "Program", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 11 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":11}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 9, - "end": 20, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 11 - } - }, + "start":9,"end":20,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":11}}, "expression": { "type": "NewExpression", - "start": 9, - "end": 19, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 10 - } - }, + "start":9,"end":19,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":10}}, "callee": { "type": "Identifier", - "start": 13, - "end": 14, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 5 - }, - "identifierName": "C" - }, + "start":13,"end":14,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":5},"identifierName":"C"}, "name": "C" }, "typeArguments": { "type": "TypeParameterInstantiation", - "start": 14, - "end": 17, - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 8 - } - }, + "start":14,"end":17,"loc":{"start":{"line":2,"column":5},"end":{"line":2,"column":8}}, "params": [ { "type": "GenericTypeAnnotation", - "start": 15, - "end": 16, - "loc": { - "start": { - "line": 2, - "column": 6 - }, - "end": { - "line": 2, - "column": 7 - } - }, + "start":15,"end":16,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":7}}, "typeParameters": null, "id": { "type": "Identifier", - "start": 15, - "end": 16, - "loc": { - "start": { - "line": 2, - "column": 6 - }, - "end": { - "line": 2, - "column": 7 - }, - "identifierName": "T" - }, + "start":15,"end":16,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":7},"identifierName":"T"}, "name": "T" } } @@ -130,18 +40,7 @@ { "type": "CommentLine", "value": " @flow", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - } + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}} } ] } @@ -152,18 +51,7 @@ { "type": "CommentLine", "value": " @flow", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - } + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}} } ] } \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/typeapp-call/rollback-computed/output.json b/packages/babel-parser/test/fixtures/flow/typeapp-call/rollback-computed/output.json index 131125e884db..53499a9b3342 100644 --- a/packages/babel-parser/test/fixtures/flow/typeapp-call/rollback-computed/output.json +++ b/packages/babel-parser/test/fixtures/flow/typeapp-call/rollback-computed/output.json @@ -1,143 +1,41 @@ { "type": "File", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 8 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":8}}, "program": { "type": "Program", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 8 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":8}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 9, - "end": 17, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 8 - } - }, + "start":9,"end":17,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":8}}, "expression": { "type": "BinaryExpression", - "start": 9, - "end": 16, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 7 - } - }, + "start":9,"end":16,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":7}}, "left": { "type": "BinaryExpression", - "start": 9, - "end": 12, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 3 - } - }, + "start":9,"end":12,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":3}}, "left": { "type": "Identifier", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 1 - }, - "identifierName": "f" - }, + "start":9,"end":10,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":1},"identifierName":"f"}, "name": "f" }, "operator": "<", "right": { "type": "Identifier", - "start": 11, - "end": 12, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 3 - }, - "identifierName": "T" - }, + "start":11,"end":12,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":3},"identifierName":"T"}, "name": "T" } }, "operator": ">", "right": { "type": "ArrayExpression", - "start": 13, - "end": 16, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 7 - } - }, + "start":13,"end":16,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":7}}, "elements": [ { "type": "Identifier", - "start": 14, - "end": 15, - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 6 - }, - "identifierName": "e" - }, + "start":14,"end":15,"loc":{"start":{"line":2,"column":5},"end":{"line":2,"column":6},"identifierName":"e"}, "name": "e" } ] @@ -147,18 +45,7 @@ { "type": "CommentLine", "value": " @flow", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - } + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}} } ] } @@ -169,18 +56,7 @@ { "type": "CommentLine", "value": " @flow", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - } + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}} } ] } \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/typeapp-call/rollback-dot/output.json b/packages/babel-parser/test/fixtures/flow/typeapp-call/rollback-dot/output.json index 5f129dfbd4af..b451a6886291 100644 --- a/packages/babel-parser/test/fixtures/flow/typeapp-call/rollback-dot/output.json +++ b/packages/babel-parser/test/fixtures/flow/typeapp-call/rollback-dot/output.json @@ -1,127 +1,37 @@ { "type": "File", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 7 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":7}}, "program": { "type": "Program", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 7 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":7}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 9, - "end": 16, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 7 - } - }, + "start":9,"end":16,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":7}}, "expression": { "type": "BinaryExpression", - "start": 9, - "end": 15, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 6 - } - }, + "start":9,"end":15,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":6}}, "left": { "type": "BinaryExpression", - "start": 9, - "end": 12, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 3 - } - }, + "start":9,"end":12,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":3}}, "left": { "type": "Identifier", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 1 - }, - "identifierName": "f" - }, + "start":9,"end":10,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":1},"identifierName":"f"}, "name": "f" }, "operator": "<", "right": { "type": "Identifier", - "start": 11, - "end": 12, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 3 - }, - "identifierName": "T" - }, + "start":11,"end":12,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":3},"identifierName":"T"}, "name": "T" } }, "operator": ">", "right": { "type": "NumericLiteral", - "start": 13, - "end": 15, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 6 - } - }, + "start":13,"end":15,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":6}}, "extra": { "rawValue": 0, "raw": ".0" @@ -133,18 +43,7 @@ { "type": "CommentLine", "value": " @flow", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - } + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}} } ] } @@ -155,18 +54,7 @@ { "type": "CommentLine", "value": " @flow", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - } + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}} } ] } \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/typeapp-call/rollback-jsx/output.json b/packages/babel-parser/test/fixtures/flow/typeapp-call/rollback-jsx/output.json index 463e2ffcb24c..dad8a1a859ba 100644 --- a/packages/babel-parser/test/fixtures/flow/typeapp-call/rollback-jsx/output.json +++ b/packages/babel-parser/test/fixtures/flow/typeapp-call/rollback-jsx/output.json @@ -1,188 +1,54 @@ { "type": "File", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 12 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":12}}, "program": { "type": "Program", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 12 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":12}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 9, - "end": 21, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 12 - } - }, + "start":9,"end":21,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":12}}, "expression": { "type": "BinaryExpression", - "start": 9, - "end": 20, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 11 - } - }, + "start":9,"end":20,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":11}}, "left": { "type": "BinaryExpression", - "start": 9, - "end": 12, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 3 - } - }, + "start":9,"end":12,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":3}}, "left": { "type": "Identifier", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 1 - }, - "identifierName": "f" - }, + "start":9,"end":10,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":1},"identifierName":"f"}, "name": "f" }, "operator": "<", "right": { "type": "Identifier", - "start": 11, - "end": 12, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 3 - }, - "identifierName": "T" - }, + "start":11,"end":12,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":3},"identifierName":"T"}, "name": "T" } }, "operator": ">", "right": { "type": "JSXElement", - "start": 13, - "end": 20, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 11 - } - }, + "start":13,"end":20,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":11}}, "openingElement": { "type": "JSXOpeningElement", - "start": 13, - "end": 16, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 7 - } - }, - "attributes": [], + "start":13,"end":16,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":7}}, "name": { "type": "JSXIdentifier", - "start": 14, - "end": 15, - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 6 - } - }, + "start":14,"end":15,"loc":{"start":{"line":2,"column":5},"end":{"line":2,"column":6}}, "name": "U" }, + "attributes": [], "selfClosing": false }, "closingElement": { "type": "JSXClosingElement", - "start": 16, - "end": 20, - "loc": { - "start": { - "line": 2, - "column": 7 - }, - "end": { - "line": 2, - "column": 11 - } - }, + "start":16,"end":20,"loc":{"start":{"line":2,"column":7},"end":{"line":2,"column":11}}, "name": { "type": "JSXIdentifier", - "start": 18, - "end": 19, - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 10 - } - }, + "start":18,"end":19,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":10}}, "name": "U" } }, @@ -193,18 +59,7 @@ { "type": "CommentLine", "value": " @flow", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - } + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}} } ] } @@ -215,18 +70,7 @@ { "type": "CommentLine", "value": " @flow", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - } + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}} } ] } \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/typeapp-call/underscore_is_allowed_trailing_commas/output.json b/packages/babel-parser/test/fixtures/flow/typeapp-call/underscore_is_allowed_trailing_commas/output.json index e30f8a938f73..05dc9ee1c893 100644 --- a/packages/babel-parser/test/fixtures/flow/typeapp-call/underscore_is_allowed_trailing_commas/output.json +++ b/packages/babel-parser/test/fixtures/flow/typeapp-call/underscore_is_allowed_trailing_commas/output.json @@ -1,238 +1,68 @@ { "type": "File", - "start": 0, - "end": 48, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 8, - "column": 4 - } - }, + "start":0,"end":48,"loc":{"start":{"line":1,"column":0},"end":{"line":8,"column":4}}, "program": { "type": "Program", - "start": 0, - "end": 48, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 8, - "column": 4 - } - }, + "start":0,"end":48,"loc":{"start":{"line":1,"column":0},"end":{"line":8,"column":4}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 8, - "end": 48, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 8, - "column": 4 - } - }, + "start":8,"end":48,"loc":{"start":{"line":2,"column":0},"end":{"line":8,"column":4}}, "expression": { "type": "CallExpression", - "start": 8, - "end": 47, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 8, - "column": 3 - } - }, + "start":8,"end":47,"loc":{"start":{"line":2,"column":0},"end":{"line":8,"column":3}}, "callee": { "type": "Identifier", - "start": 8, - "end": 12, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 4 - }, - "identifierName": "test" - }, + "start":8,"end":12,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":4},"identifierName":"test"}, "name": "test" }, "typeArguments": { "type": "TypeParameterInstantiation", - "start": 12, - "end": 45, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 8, - "column": 1 - } - }, + "start":12,"end":45,"loc":{"start":{"line":2,"column":4},"end":{"line":8,"column":1}}, "params": [ { "type": "GenericTypeAnnotation", - "start": 16, - "end": 17, - "loc": { - "start": { - "line": 3, - "column": 2 - }, - "end": { - "line": 3, - "column": 3 - } - }, + "start":16,"end":17,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":3}}, "typeParameters": null, "id": { "type": "Identifier", - "start": 16, - "end": 17, - "loc": { - "start": { - "line": 3, - "column": 2 - }, - "end": { - "line": 3, - "column": 3 - }, - "identifierName": "_" - }, + "start":16,"end":17,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":3},"identifierName":"_"}, "name": "_" } }, { "type": "GenericTypeAnnotation", - "start": 21, - "end": 22, - "loc": { - "start": { - "line": 4, - "column": 2 - }, - "end": { - "line": 4, - "column": 3 - } - }, + "start":21,"end":22,"loc":{"start":{"line":4,"column":2},"end":{"line":4,"column":3}}, "typeParameters": null, "id": { "type": "Identifier", - "start": 21, - "end": 22, - "loc": { - "start": { - "line": 4, - "column": 2 - }, - "end": { - "line": 4, - "column": 3 - }, - "identifierName": "_" - }, + "start":21,"end":22,"loc":{"start":{"line":4,"column":2},"end":{"line":4,"column":3},"identifierName":"_"}, "name": "_" } }, { "type": "NumberTypeAnnotation", - "start": 26, - "end": 32, - "loc": { - "start": { - "line": 5, - "column": 2 - }, - "end": { - "line": 5, - "column": 8 - } - } + "start":26,"end":32,"loc":{"start":{"line":5,"column":2},"end":{"line":5,"column":8}} }, { "type": "GenericTypeAnnotation", - "start": 36, - "end": 37, - "loc": { - "start": { - "line": 6, - "column": 2 - }, - "end": { - "line": 6, - "column": 3 - } - }, + "start":36,"end":37,"loc":{"start":{"line":6,"column":2},"end":{"line":6,"column":3}}, "typeParameters": null, "id": { "type": "Identifier", - "start": 36, - "end": 37, - "loc": { - "start": { - "line": 6, - "column": 2 - }, - "end": { - "line": 6, - "column": 3 - }, - "identifierName": "_" - }, + "start":36,"end":37,"loc":{"start":{"line":6,"column":2},"end":{"line":6,"column":3},"identifierName":"_"}, "name": "_" } }, { "type": "GenericTypeAnnotation", - "start": 41, - "end": 42, - "loc": { - "start": { - "line": 7, - "column": 2 - }, - "end": { - "line": 7, - "column": 3 - } - }, + "start":41,"end":42,"loc":{"start":{"line":7,"column":2},"end":{"line":7,"column":3}}, "typeParameters": null, "id": { "type": "Identifier", - "start": 41, - "end": 42, - "loc": { - "start": { - "line": 7, - "column": 2 - }, - "end": { - "line": 7, - "column": 3 - }, - "identifierName": "_" - }, + "start":41,"end":42,"loc":{"start":{"line":7,"column":2},"end":{"line":7,"column":3},"identifierName":"_"}, "name": "_" } } @@ -244,18 +74,7 @@ { "type": "CommentLine", "value": "@flow", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - } + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}} } ] } @@ -266,18 +85,7 @@ { "type": "CommentLine", "value": "@flow", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - } + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}} } ] } \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/typeapp-call/underscore_is_illegal_param_instantiation_otherwise/options.json b/packages/babel-parser/test/fixtures/flow/typeapp-call/underscore_is_illegal_param_instantiation_otherwise/options.json deleted file mode 100644 index 101e77f3861c..000000000000 --- a/packages/babel-parser/test/fixtures/flow/typeapp-call/underscore_is_illegal_param_instantiation_otherwise/options.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "sourceType": "module", - "plugins": ["jsx", "flow"], - "throws": "`_` is only allowed as a type argument to call or new (2:16)" -} diff --git a/packages/babel-parser/test/fixtures/flow/typeapp-call/underscore_is_illegal_param_instantiation_otherwise/output.json b/packages/babel-parser/test/fixtures/flow/typeapp-call/underscore_is_illegal_param_instantiation_otherwise/output.json new file mode 100644 index 000000000000..ebd1f2cd376b --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/typeapp-call/underscore_is_illegal_param_instantiation_otherwise/output.json @@ -0,0 +1,84 @@ +{ + "type": "File", + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":22}}, + "errors": [ + "SyntaxError: `_` is only allowed as a type argument to call or new (2:16)" + ], + "program": { + "type": "Program", + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":22}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start":8,"end":30,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":22}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":12,"end":29,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":21}}, + "id": { + "type": "Identifier", + "start":12,"end":25,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":17},"identifierName":"x"}, + "name": "x", + "typeAnnotation": { + "type": "TypeAnnotation", + "start":13,"end":25,"loc":{"start":{"line":2,"column":5},"end":{"line":2,"column":17}}, + "typeAnnotation": { + "type": "GenericTypeAnnotation", + "start":15,"end":25,"loc":{"start":{"line":2,"column":7},"end":{"line":2,"column":17}}, + "typeParameters": { + "type": "TypeParameterInstantiation", + "start":22,"end":25,"loc":{"start":{"line":2,"column":14},"end":{"line":2,"column":17}}, + "params": [ + { + "type": "GenericTypeAnnotation", + "start":23,"end":24,"loc":{"start":{"line":2,"column":15},"end":{"line":2,"column":16}}, + "typeParameters": null, + "id": { + "type": "Identifier", + "start":23,"end":24,"loc":{"start":{"line":2,"column":15},"end":{"line":2,"column":16},"identifierName":"_"}, + "name": "_" + } + } + ] + }, + "id": { + "type": "Identifier", + "start":15,"end":22,"loc":{"start":{"line":2,"column":7},"end":{"line":2,"column":14},"identifierName":"Generic"}, + "name": "Generic" + } + } + } + }, + "init": { + "type": "NumericLiteral", + "start":28,"end":29,"loc":{"start":{"line":2,"column":20},"end":{"line":2,"column":21}}, + "extra": { + "rawValue": 3, + "raw": "3" + }, + "value": 3 + } + } + ], + "kind": "var", + "leadingComments": [ + { + "type": "CommentLine", + "value": "@flow", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}} + } + ] + } + ], + "directives": [] + }, + "comments": [ + { + "type": "CommentLine", + "value": "@flow", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}} + } + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/typeapp-call/underscore_is_illegal_type_name/options.json b/packages/babel-parser/test/fixtures/flow/typeapp-call/underscore_is_illegal_type_name/options.json deleted file mode 100644 index 85a0456eceff..000000000000 --- a/packages/babel-parser/test/fixtures/flow/typeapp-call/underscore_is_illegal_type_name/options.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "sourceType": "module", - "plugins": ["jsx", "flow"], - "throws": "Cannot overwrite reserved type _ (2:5)" -} diff --git a/packages/babel-parser/test/fixtures/flow/typeapp-call/underscore_is_illegal_type_name/output.json b/packages/babel-parser/test/fixtures/flow/typeapp-call/underscore_is_illegal_type_name/output.json new file mode 100644 index 000000000000..ab4466e15218 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/typeapp-call/underscore_is_illegal_type_name/output.json @@ -0,0 +1,44 @@ +{ + "type": "File", + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":16}}, + "errors": [ + "SyntaxError: Cannot overwrite reserved type _ (2:5)" + ], + "program": { + "type": "Program", + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":16}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "TypeAlias", + "start":8,"end":24,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":16}}, + "id": { + "type": "Identifier", + "start":13,"end":14,"loc":{"start":{"line":2,"column":5},"end":{"line":2,"column":6},"identifierName":"_"}, + "name": "_" + }, + "typeParameters": null, + "right": { + "type": "NumberTypeAnnotation", + "start":17,"end":23,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":15}} + }, + "leadingComments": [ + { + "type": "CommentLine", + "value": "@flow", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}} + } + ] + } + ], + "directives": [] + }, + "comments": [ + { + "type": "CommentLine", + "value": "@flow", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}} + } + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/typeapp-call/underscore_is_illegal_type_param_name/options.json b/packages/babel-parser/test/fixtures/flow/typeapp-call/underscore_is_illegal_type_param_name/options.json deleted file mode 100644 index 872ad2f73408..000000000000 --- a/packages/babel-parser/test/fixtures/flow/typeapp-call/underscore_is_illegal_type_param_name/options.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "sourceType": "module", - "plugins": ["jsx", "flow"], - "throws": "Cannot overwrite reserved type _ (2:13)" -} diff --git a/packages/babel-parser/test/fixtures/flow/typeapp-call/underscore_is_illegal_type_param_name/output.json b/packages/babel-parser/test/fixtures/flow/typeapp-call/underscore_is_illegal_type_param_name/output.json new file mode 100644 index 000000000000..a0f7c08fcadc --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/typeapp-call/underscore_is_illegal_type_param_name/output.json @@ -0,0 +1,62 @@ +{ + "type": "File", + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":20}}, + "errors": [ + "SyntaxError: Unexpected reserved type _ (2:13)", + "SyntaxError: `_` is only allowed as a type argument to call or new (2:19)" + ], + "program": { + "type": "Program", + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":20}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "TypeAlias", + "start":8,"end":28,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":20}}, + "id": { + "type": "Identifier", + "start":13,"end":20,"loc":{"start":{"line":2,"column":5},"end":{"line":2,"column":12},"identifierName":"Generic"}, + "name": "Generic" + }, + "typeParameters": { + "type": "TypeParameterDeclaration", + "start":20,"end":23,"loc":{"start":{"line":2,"column":12},"end":{"line":2,"column":15}}, + "params": [ + { + "type": "TypeParameter", + "start":21,"end":22,"loc":{"start":{"line":2,"column":13},"end":{"line":2,"column":14}}, + "name": "_", + "variance": null + } + ] + }, + "right": { + "type": "GenericTypeAnnotation", + "start":26,"end":27,"loc":{"start":{"line":2,"column":18},"end":{"line":2,"column":19}}, + "typeParameters": null, + "id": { + "type": "Identifier", + "start":26,"end":27,"loc":{"start":{"line":2,"column":18},"end":{"line":2,"column":19},"identifierName":"_"}, + "name": "_" + } + }, + "leadingComments": [ + { + "type": "CommentLine", + "value": "@flow", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}} + } + ] + } + ], + "directives": [] + }, + "comments": [ + { + "type": "CommentLine", + "value": "@flow", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}} + } + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/typeapp-call/underscore_is_implicit_anywhere_in_list/output.json b/packages/babel-parser/test/fixtures/flow/typeapp-call/underscore_is_implicit_anywhere_in_list/output.json index 7b90b530ad65..5881b270042c 100644 --- a/packages/babel-parser/test/fixtures/flow/typeapp-call/underscore_is_implicit_anywhere_in_list/output.json +++ b/packages/babel-parser/test/fixtures/flow/typeapp-call/underscore_is_implicit_anywhere_in_list/output.json @@ -1,352 +1,102 @@ { "type": "File", - "start": 0, - "end": 58, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 50 - } - }, + "start":0,"end":58,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":50}}, "program": { "type": "Program", - "start": 0, - "end": 58, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 50 - } - }, + "start":0,"end":58,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":50}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 8, - "end": 58, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 50 - } - }, + "start":8,"end":58,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":50}}, "expression": { "type": "CallExpression", - "start": 8, - "end": 57, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 49 - } - }, + "start":8,"end":57,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":49}}, "callee": { "type": "Identifier", - "start": 8, - "end": 12, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 4 - }, - "identifierName": "test" - }, + "start":8,"end":12,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":4},"identifierName":"test"}, "name": "test" }, "typeArguments": { "type": "TypeParameterInstantiation", - "start": 12, - "end": 55, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 47 - } - }, + "start":12,"end":55,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":47}}, "params": [ { "type": "NumberTypeAnnotation", - "start": 13, - "end": 19, - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 11 - } - } + "start":13,"end":19,"loc":{"start":{"line":2,"column":5},"end":{"line":2,"column":11}} }, { "type": "GenericTypeAnnotation", - "start": 21, - "end": 22, - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 14 - } - }, + "start":21,"end":22,"loc":{"start":{"line":2,"column":13},"end":{"line":2,"column":14}}, "typeParameters": null, "id": { "type": "Identifier", - "start": 21, - "end": 22, - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 14 - }, - "identifierName": "_" - }, + "start":21,"end":22,"loc":{"start":{"line":2,"column":13},"end":{"line":2,"column":14},"identifierName":"_"}, "name": "_" } }, { "type": "StringTypeAnnotation", - "start": 24, - "end": 30, - "loc": { - "start": { - "line": 2, - "column": 16 - }, - "end": { - "line": 2, - "column": 22 - } - } + "start":24,"end":30,"loc":{"start":{"line":2,"column":16},"end":{"line":2,"column":22}} }, { "type": "GenericTypeAnnotation", - "start": 32, - "end": 33, - "loc": { - "start": { - "line": 2, - "column": 24 - }, - "end": { - "line": 2, - "column": 25 - } - }, + "start":32,"end":33,"loc":{"start":{"line":2,"column":24},"end":{"line":2,"column":25}}, "typeParameters": null, "id": { "type": "Identifier", - "start": 32, - "end": 33, - "loc": { - "start": { - "line": 2, - "column": 24 - }, - "end": { - "line": 2, - "column": 25 - }, - "identifierName": "_" - }, + "start":32,"end":33,"loc":{"start":{"line":2,"column":24},"end":{"line":2,"column":25},"identifierName":"_"}, "name": "_" } }, { "type": "GenericTypeAnnotation", - "start": 35, - "end": 36, - "loc": { - "start": { - "line": 2, - "column": 27 - }, - "end": { - "line": 2, - "column": 28 - } - }, + "start":35,"end":36,"loc":{"start":{"line":2,"column":27},"end":{"line":2,"column":28}}, "typeParameters": null, "id": { "type": "Identifier", - "start": 35, - "end": 36, - "loc": { - "start": { - "line": 2, - "column": 27 - }, - "end": { - "line": 2, - "column": 28 - }, - "identifierName": "_" - }, + "start":35,"end":36,"loc":{"start":{"line":2,"column":27},"end":{"line":2,"column":28},"identifierName":"_"}, "name": "_" } }, { "type": "GenericTypeAnnotation", - "start": 38, - "end": 39, - "loc": { - "start": { - "line": 2, - "column": 30 - }, - "end": { - "line": 2, - "column": 31 - } - }, + "start":38,"end":39,"loc":{"start":{"line":2,"column":30},"end":{"line":2,"column":31}}, "typeParameters": null, "id": { "type": "Identifier", - "start": 38, - "end": 39, - "loc": { - "start": { - "line": 2, - "column": 30 - }, - "end": { - "line": 2, - "column": 31 - }, - "identifierName": "_" - }, + "start":38,"end":39,"loc":{"start":{"line":2,"column":30},"end":{"line":2,"column":31},"identifierName":"_"}, "name": "_" } }, { "type": "GenericTypeAnnotation", - "start": 41, - "end": 44, - "loc": { - "start": { - "line": 2, - "column": 33 - }, - "end": { - "line": 2, - "column": 36 - } - }, + "start":41,"end":44,"loc":{"start":{"line":2,"column":33},"end":{"line":2,"column":36}}, "typeParameters": null, "id": { "type": "Identifier", - "start": 41, - "end": 44, - "loc": { - "start": { - "line": 2, - "column": 33 - }, - "end": { - "line": 2, - "column": 36 - }, - "identifierName": "Foo" - }, + "start":41,"end":44,"loc":{"start":{"line":2,"column":33},"end":{"line":2,"column":36},"identifierName":"Foo"}, "name": "Foo" } }, { "type": "GenericTypeAnnotation", - "start": 46, - "end": 49, - "loc": { - "start": { - "line": 2, - "column": 38 - }, - "end": { - "line": 2, - "column": 41 - } - }, + "start":46,"end":49,"loc":{"start":{"line":2,"column":38},"end":{"line":2,"column":41}}, "typeParameters": null, "id": { "type": "Identifier", - "start": 46, - "end": 49, - "loc": { - "start": { - "line": 2, - "column": 38 - }, - "end": { - "line": 2, - "column": 41 - }, - "identifierName": "Bar" - }, + "start":46,"end":49,"loc":{"start":{"line":2,"column":38},"end":{"line":2,"column":41},"identifierName":"Bar"}, "name": "Bar" } }, { "type": "GenericTypeAnnotation", - "start": 51, - "end": 54, - "loc": { - "start": { - "line": 2, - "column": 43 - }, - "end": { - "line": 2, - "column": 46 - } - }, + "start":51,"end":54,"loc":{"start":{"line":2,"column":43},"end":{"line":2,"column":46}}, "typeParameters": null, "id": { "type": "Identifier", - "start": 51, - "end": 54, - "loc": { - "start": { - "line": 2, - "column": 43 - }, - "end": { - "line": 2, - "column": 46 - }, - "identifierName": "Baz" - }, + "start":51,"end":54,"loc":{"start":{"line":2,"column":43},"end":{"line":2,"column":46},"identifierName":"Baz"}, "name": "Baz" } } @@ -358,18 +108,7 @@ { "type": "CommentLine", "value": "@flow", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - } + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}} } ] } @@ -380,18 +119,7 @@ { "type": "CommentLine", "value": "@flow", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - } + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}} } ] } \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/typeapp-call/underscore_is_implicit_in_calls/output.json b/packages/babel-parser/test/fixtures/flow/typeapp-call/underscore_is_implicit_in_calls/output.json index 6d1aceded869..e35839347f26 100644 --- a/packages/babel-parser/test/fixtures/flow/typeapp-call/underscore_is_implicit_in_calls/output.json +++ b/packages/babel-parser/test/fixtures/flow/typeapp-call/underscore_is_implicit_in_calls/output.json @@ -1,124 +1,34 @@ { "type": "File", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 10 - } - }, + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":10}}, "program": { "type": "Program", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 10 - } - }, + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":10}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 8, - "end": 18, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 10 - } - }, + "start":8,"end":18,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":10}}, "expression": { "type": "CallExpression", - "start": 8, - "end": 17, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 9 - } - }, + "start":8,"end":17,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":9}}, "callee": { "type": "Identifier", - "start": 8, - "end": 12, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 4 - }, - "identifierName": "test" - }, + "start":8,"end":12,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":4},"identifierName":"test"}, "name": "test" }, "typeArguments": { "type": "TypeParameterInstantiation", - "start": 12, - "end": 15, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 7 - } - }, + "start":12,"end":15,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":7}}, "params": [ { "type": "GenericTypeAnnotation", - "start": 13, - "end": 14, - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 6 - } - }, + "start":13,"end":14,"loc":{"start":{"line":2,"column":5},"end":{"line":2,"column":6}}, "typeParameters": null, "id": { "type": "Identifier", - "start": 13, - "end": 14, - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 6 - }, - "identifierName": "_" - }, + "start":13,"end":14,"loc":{"start":{"line":2,"column":5},"end":{"line":2,"column":6},"identifierName":"_"}, "name": "_" } } @@ -130,18 +40,7 @@ { "type": "CommentLine", "value": "@flow", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - } + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}} } ] } @@ -152,18 +51,7 @@ { "type": "CommentLine", "value": "@flow", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - } + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}} } ] } \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/typeapp-call/underscore_is_implicit_in_methods/output.json b/packages/babel-parser/test/fixtures/flow/typeapp-call/underscore_is_implicit_in_methods/output.json index 26c9a3ee4039..5903b120858e 100644 --- a/packages/babel-parser/test/fixtures/flow/typeapp-call/underscore_is_implicit_in_methods/output.json +++ b/packages/babel-parser/test/fixtures/flow/typeapp-call/underscore_is_implicit_in_methods/output.json @@ -1,122 +1,32 @@ { "type": "File", - "start": 0, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 23 - } - }, + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":23}}, "program": { "type": "Program", - "start": 0, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 23 - } - }, + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":23}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 8, - "end": 31, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 23 - } - }, + "start":8,"end":31,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":23}}, "expression": { "type": "CallExpression", - "start": 8, - "end": 30, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 22 - } - }, + "start":8,"end":30,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":22}}, "callee": { "type": "CallExpression", - "start": 8, - "end": 25, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 17 - } - }, + "start":8,"end":25,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":17}}, "callee": { "type": "MemberExpression", - "start": 8, - "end": 23, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 15 - } - }, + "start":8,"end":23,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":15}}, "object": { "type": "Identifier", - "start": 8, - "end": 16, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 8 - }, - "identifierName": "instance" - }, + "start":8,"end":16,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":8},"identifierName":"instance"}, "name": "instance" }, "property": { "type": "Identifier", - "start": 17, - "end": 23, - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 15 - }, - "identifierName": "method" - }, + "start":17,"end":23,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":15},"identifierName":"method"}, "name": "method" }, "computed": false @@ -125,49 +35,15 @@ }, "typeArguments": { "type": "TypeParameterInstantiation", - "start": 25, - "end": 28, - "loc": { - "start": { - "line": 2, - "column": 17 - }, - "end": { - "line": 2, - "column": 20 - } - }, + "start":25,"end":28,"loc":{"start":{"line":2,"column":17},"end":{"line":2,"column":20}}, "params": [ { "type": "GenericTypeAnnotation", - "start": 26, - "end": 27, - "loc": { - "start": { - "line": 2, - "column": 18 - }, - "end": { - "line": 2, - "column": 19 - } - }, + "start":26,"end":27,"loc":{"start":{"line":2,"column":18},"end":{"line":2,"column":19}}, "typeParameters": null, "id": { "type": "Identifier", - "start": 26, - "end": 27, - "loc": { - "start": { - "line": 2, - "column": 18 - }, - "end": { - "line": 2, - "column": 19 - }, - "identifierName": "_" - }, + "start":26,"end":27,"loc":{"start":{"line":2,"column":18},"end":{"line":2,"column":19},"identifierName":"_"}, "name": "_" } } @@ -179,18 +55,7 @@ { "type": "CommentLine", "value": "@flow", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - } + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}} } ] } @@ -201,18 +66,7 @@ { "type": "CommentLine", "value": "@flow", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - } + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}} } ] } \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/typeapp-call/underscore_is_implicit_in_new/output.json b/packages/babel-parser/test/fixtures/flow/typeapp-call/underscore_is_implicit_in_new/output.json index 6c48948afe6a..a1f8a7725956 100644 --- a/packages/babel-parser/test/fixtures/flow/typeapp-call/underscore_is_implicit_in_new/output.json +++ b/packages/babel-parser/test/fixtures/flow/typeapp-call/underscore_is_implicit_in_new/output.json @@ -1,124 +1,34 @@ { "type": "File", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 14 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":14}}, "program": { "type": "Program", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 14 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":14}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 8, - "end": 22, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 14 - } - }, + "start":8,"end":22,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":14}}, "expression": { "type": "NewExpression", - "start": 8, - "end": 21, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 13 - } - }, + "start":8,"end":21,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":13}}, "callee": { "type": "Identifier", - "start": 12, - "end": 16, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 8 - }, - "identifierName": "test" - }, + "start":12,"end":16,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":8},"identifierName":"test"}, "name": "test" }, "typeArguments": { "type": "TypeParameterInstantiation", - "start": 16, - "end": 19, - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 11 - } - }, + "start":16,"end":19,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":11}}, "params": [ { "type": "GenericTypeAnnotation", - "start": 17, - "end": 18, - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 10 - } - }, + "start":17,"end":18,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":10}}, "typeParameters": null, "id": { "type": "Identifier", - "start": 17, - "end": 18, - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 10 - }, - "identifierName": "_" - }, + "start":17,"end":18,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":10},"identifierName":"_"}, "name": "_" } } @@ -130,18 +40,7 @@ { "type": "CommentLine", "value": "@flow", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - } + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}} } ] } @@ -152,18 +51,7 @@ { "type": "CommentLine", "value": "@flow", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - } + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}} } ] } \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/typecasts/1/output.json b/packages/babel-parser/test/fixtures/flow/typecasts/1/output.json index 95c6966cb5e3..041443eb98e6 100644 --- a/packages/babel-parser/test/fixtures/flow/typecasts/1/output.json +++ b/packages/babel-parser/test/fixtures/flow/typecasts/1/output.json @@ -1,107 +1,29 @@ { "type": "File", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "program": { "type": "Program", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "expression": { "type": "TypeCastExpression", - "start": 1, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":1,"end":12,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":12}}, "expression": { "type": "Identifier", - "start": 1, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 4 - }, - "identifierName": "xxx" - }, + "start":1,"end":4,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":4},"identifierName":"xxx"}, "name": "xxx" }, "typeAnnotation": { "type": "TypeAnnotation", - "start": 4, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":4,"end":12,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":12}}, "typeAnnotation": { "type": "NumberTypeAnnotation", - "start": 6, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 12 - } - } + "start":6,"end":12,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":12}} } }, "extra": { diff --git a/packages/babel-parser/test/fixtures/flow/typecasts/2/output.json b/packages/babel-parser/test/fixtures/flow/typecasts/2/output.json index 4d9f9da74bf5..c8f7a5641e1e 100644 --- a/packages/babel-parser/test/fixtures/flow/typecasts/2/output.json +++ b/packages/babel-parser/test/fixtures/flow/typecasts/2/output.json @@ -1,125 +1,36 @@ { "type": "File", - "start": 0, - "end": 50, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 50 - } - }, + "start":0,"end":50,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":50}}, "program": { "type": "Program", - "start": 0, - "end": 50, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 50 - } - }, + "start":0,"end":50,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":50}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 50, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 50 - } - }, + "start":0,"end":50,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":50}}, "expression": { "type": "TypeCastExpression", - "start": 1, - "end": 49, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 49 - } - }, + "start":1,"end":49,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":49}}, "expression": { "type": "ObjectExpression", - "start": 1, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":1,"end":21,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":21}}, "properties": [ { "type": "ObjectProperty", - "start": 2, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":2,"end":8,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":8}}, "method": false, "key": { "type": "Identifier", - "start": 2, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "xxx" - }, + "start":2,"end":5,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":5},"identifierName":"xxx"}, "name": "xxx" }, "computed": false, "shorthand": false, "value": { "type": "NumericLiteral", - "start": 7, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8}}, "extra": { "rawValue": 0, "raw": "0" @@ -129,52 +40,18 @@ }, { "type": "ObjectProperty", - "start": 10, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":10,"end":20,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":20}}, "method": false, "key": { "type": "Identifier", - "start": 10, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 13 - }, - "identifierName": "yyy" - }, + "start":10,"end":13,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":13},"identifierName":"yyy"}, "name": "yyy" }, "computed": false, "shorthand": false, "value": { "type": "StringLiteral", - "start": 15, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":15,"end":20,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":20}}, "extra": { "rawValue": "hey", "raw": "\"hey\"" @@ -186,63 +63,18 @@ }, "typeAnnotation": { "type": "TypeAnnotation", - "start": 21, - "end": 49, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 49 - } - }, + "start":21,"end":49,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":49}}, "typeAnnotation": { "type": "ObjectTypeAnnotation", - "start": 23, - "end": 49, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 49 - } - }, + "start":23,"end":49,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":49}}, "callProperties": [], "properties": [ { "type": "ObjectTypeProperty", - "start": 24, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":24,"end":35,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":35}}, "key": { "type": "Identifier", - "start": 24, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 27 - }, - "identifierName": "xxx" - }, + "start":24,"end":27,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":27},"identifierName":"xxx"}, "name": "xxx" }, "static": false, @@ -251,51 +83,17 @@ "method": false, "value": { "type": "NumberTypeAnnotation", - "start": 29, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 1, - "column": 35 - } - } + "start":29,"end":35,"loc":{"start":{"line":1,"column":29},"end":{"line":1,"column":35}} }, "variance": null, "optional": false }, { "type": "ObjectTypeProperty", - "start": 37, - "end": 48, - "loc": { - "start": { - "line": 1, - "column": 37 - }, - "end": { - "line": 1, - "column": 48 - } - }, + "start":37,"end":48,"loc":{"start":{"line":1,"column":37},"end":{"line":1,"column":48}}, "key": { "type": "Identifier", - "start": 37, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 37 - }, - "end": { - "line": 1, - "column": 40 - }, - "identifierName": "yyy" - }, + "start":37,"end":40,"loc":{"start":{"line":1,"column":37},"end":{"line":1,"column":40},"identifierName":"yyy"}, "name": "yyy" }, "static": false, @@ -304,18 +102,7 @@ "method": false, "value": { "type": "StringTypeAnnotation", - "start": 42, - "end": 48, - "loc": { - "start": { - "line": 1, - "column": 42 - }, - "end": { - "line": 1, - "column": 48 - } - } + "start":42,"end":48,"loc":{"start":{"line":1,"column":42},"end":{"line":1,"column":48}} }, "variance": null, "optional": false diff --git a/packages/babel-parser/test/fixtures/flow/typecasts/3/output.json b/packages/babel-parser/test/fixtures/flow/typecasts/3/output.json index fafc87e64442..0e3ddeef5439 100644 --- a/packages/babel-parser/test/fixtures/flow/typecasts/3/output.json +++ b/packages/babel-parser/test/fixtures/flow/typecasts/3/output.json @@ -1,144 +1,43 @@ { "type": "File", - "start": 0, - "end": 43, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 43 - } - }, + "start":0,"end":43,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":43}}, "program": { "type": "Program", - "start": 0, - "end": 43, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 43 - } - }, + "start":0,"end":43,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":43}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 43, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 43 - } - }, + "start":0,"end":43,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":43}}, "expression": { "type": "TypeCastExpression", - "start": 1, - "end": 42, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 42 - } - }, + "start":1,"end":42,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":42}}, "expression": { "type": "ArrowFunctionExpression", - "start": 1, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":1,"end":17,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":17}}, "id": null, "generator": false, "async": false, "params": [ { "type": "Identifier", - "start": 2, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "xxx" - }, + "start":2,"end":5,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":5},"identifierName":"xxx"}, "name": "xxx" } ], "body": { "type": "BinaryExpression", - "start": 10, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":10,"end":17,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":17}}, "left": { "type": "Identifier", - "start": 10, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 13 - }, - "identifierName": "xxx" - }, + "start":10,"end":13,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":13},"identifierName":"xxx"}, "name": "xxx" }, "operator": "+", "right": { "type": "NumericLiteral", - "start": 16, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":16,"end":17,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":17}}, "extra": { "rawValue": 1, "raw": "1" @@ -149,97 +48,30 @@ }, "typeAnnotation": { "type": "TypeAnnotation", - "start": 17, - "end": 42, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 42 - } - }, + "start":17,"end":42,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":42}}, "typeAnnotation": { "type": "FunctionTypeAnnotation", - "start": 19, - "end": 42, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 42 - } - }, + "start":19,"end":42,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":42}}, "params": [ { "type": "FunctionTypeParam", - "start": 20, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":20,"end":31,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":31}}, "name": { "type": "Identifier", - "start": 20, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 23 - }, - "identifierName": "xxx" - }, + "start":20,"end":23,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":23},"identifierName":"xxx"}, "name": "xxx" }, "optional": false, "typeAnnotation": { "type": "NumberTypeAnnotation", - "start": 25, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 31 - } - } + "start":25,"end":31,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":31}} } } ], "rest": null, "returnType": { "type": "NumberTypeAnnotation", - "start": 36, - "end": 42, - "loc": { - "start": { - "line": 1, - "column": 36 - }, - "end": { - "line": 1, - "column": 42 - } - } + "start":36,"end":42,"loc":{"start":{"line":1,"column":36},"end":{"line":1,"column":42}} }, "typeParameters": null } diff --git a/packages/babel-parser/test/fixtures/flow/typecasts/4/output.json b/packages/babel-parser/test/fixtures/flow/typecasts/4/output.json index 99c2b77acb85..09dd6a55f57f 100644 --- a/packages/babel-parser/test/fixtures/flow/typecasts/4/output.json +++ b/packages/babel-parser/test/fixtures/flow/typecasts/4/output.json @@ -1,122 +1,33 @@ { "type": "File", - "start": 0, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, "program": { "type": "Program", - "start": 0, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, "expression": { "type": "SequenceExpression", - "start": 1, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":1,"end":29,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":29}}, "expressions": [ { "type": "TypeCastExpression", - "start": 2, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":2,"end":13,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":13}}, "expression": { "type": "Identifier", - "start": 2, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "xxx" - }, + "start":2,"end":5,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":5},"identifierName":"xxx"}, "name": "xxx" }, "typeAnnotation": { "type": "TypeAnnotation", - "start": 5, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":5,"end":13,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":13}}, "typeAnnotation": { "type": "NumberTypeAnnotation", - "start": 7, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 13 - } - } + "start":7,"end":13,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":13}} } }, "extra": { @@ -126,63 +37,18 @@ }, { "type": "TypeCastExpression", - "start": 17, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":17,"end":28,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":28}}, "expression": { "type": "Identifier", - "start": 17, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 20 - }, - "identifierName": "yyy" - }, + "start":17,"end":20,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":20},"identifierName":"yyy"}, "name": "yyy" }, "typeAnnotation": { "type": "TypeAnnotation", - "start": 20, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":20,"end":28,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":28}}, "typeAnnotation": { "type": "StringTypeAnnotation", - "start": 22, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 28 - } - } + "start":22,"end":28,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":28}} } }, "extra": { diff --git a/packages/babel-parser/test/fixtures/flow/typecasts/fail-in-async-optional-calls/input.js b/packages/babel-parser/test/fixtures/flow/typecasts/fail-in-async-optional-calls/input.js new file mode 100644 index 000000000000..961846976c7a --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/typecasts/fail-in-async-optional-calls/input.js @@ -0,0 +1 @@ +async?.(bar: string) => {} diff --git a/packages/babel-parser/test/fixtures/flow/typecasts/fail-in-async-optional-calls/options.json b/packages/babel-parser/test/fixtures/flow/typecasts/fail-in-async-optional-calls/options.json new file mode 100644 index 000000000000..3c7c9c589b44 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/typecasts/fail-in-async-optional-calls/options.json @@ -0,0 +1,8 @@ +{ + "sourceType": "module", + "plugins": [ + "flow", + "optionalChaining" + ], + "throws": "Unexpected token, expected \";\" (1:21)" +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/typecasts/fail-in-calls-with-one-arg/options.json b/packages/babel-parser/test/fixtures/flow/typecasts/fail-in-calls-with-one-arg/options.json deleted file mode 100644 index e4012a53ad5d..000000000000 --- a/packages/babel-parser/test/fixtures/flow/typecasts/fail-in-calls-with-one-arg/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "The type cast expression is expected to be wrapped with parenthesis (1:10)" -} diff --git a/packages/babel-parser/test/fixtures/flow/typecasts/fail-in-calls-with-one-arg/output.json b/packages/babel-parser/test/fixtures/flow/typecasts/fail-in-calls-with-one-arg/output.json new file mode 100644 index 000000000000..84a61889a5fc --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/typecasts/fail-in-calls-with-one-arg/output.json @@ -0,0 +1,48 @@ +{ + "type": "File", + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, + "errors": [ + "SyntaxError: The type cast expression is expected to be wrapped with parenthesis (1:10)" + ], + "program": { + "type": "Program", + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, + "expression": { + "type": "CallExpression", + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, + "callee": { + "type": "Identifier", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8},"identifierName":"funccall"}, + "name": "funccall" + }, + "arguments": [ + { + "type": "TypeCastExpression", + "start":9,"end":18,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":18}}, + "expression": { + "type": "Identifier", + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"b"}, + "name": "b" + }, + "typeAnnotation": { + "type": "TypeAnnotation", + "start":10,"end":18,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":18}}, + "typeAnnotation": { + "type": "StringTypeAnnotation", + "start":12,"end":18,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":18}} + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/typecasts/fail-in-calls/options.json b/packages/babel-parser/test/fixtures/flow/typecasts/fail-in-calls/options.json deleted file mode 100644 index 3f861de320eb..000000000000 --- a/packages/babel-parser/test/fixtures/flow/typecasts/fail-in-calls/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "The type cast expression is expected to be wrapped with parenthesis (1:13)" -} diff --git a/packages/babel-parser/test/fixtures/flow/typecasts/fail-in-calls/output.json b/packages/babel-parser/test/fixtures/flow/typecasts/fail-in-calls/output.json new file mode 100644 index 000000000000..c56ca182c299 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/typecasts/fail-in-calls/output.json @@ -0,0 +1,53 @@ +{ + "type": "File", + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, + "errors": [ + "SyntaxError: The type cast expression is expected to be wrapped with parenthesis (1:13)" + ], + "program": { + "type": "Program", + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, + "expression": { + "type": "CallExpression", + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, + "callee": { + "type": "Identifier", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8},"identifierName":"funccall"}, + "name": "funccall" + }, + "arguments": [ + { + "type": "Identifier", + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"a"}, + "name": "a" + }, + { + "type": "TypeCastExpression", + "start":12,"end":21,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":21}}, + "expression": { + "type": "Identifier", + "start":12,"end":13,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":13},"identifierName":"b"}, + "name": "b" + }, + "typeAnnotation": { + "type": "TypeAnnotation", + "start":13,"end":21,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":21}}, + "typeAnnotation": { + "type": "StringTypeAnnotation", + "start":15,"end":21,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":21}} + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/typecasts/fail-in-optional-calls/input.js b/packages/babel-parser/test/fixtures/flow/typecasts/fail-in-optional-calls/input.js new file mode 100644 index 000000000000..14df4e2b16c7 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/typecasts/fail-in-optional-calls/input.js @@ -0,0 +1 @@ +funccall?.(a, b: string); diff --git a/packages/babel-parser/test/fixtures/flow/typecasts/fail-in-optional-calls/options.json b/packages/babel-parser/test/fixtures/flow/typecasts/fail-in-optional-calls/options.json new file mode 100644 index 000000000000..0e7765c73ae7 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/typecasts/fail-in-optional-calls/options.json @@ -0,0 +1,7 @@ +{ + "sourceType": "module", + "plugins": [ + "flow", + "optionalChaining" + ] +} diff --git a/packages/babel-parser/test/fixtures/flow/typecasts/fail-in-optional-calls/output.json b/packages/babel-parser/test/fixtures/flow/typecasts/fail-in-optional-calls/output.json new file mode 100644 index 000000000000..5eb20e808dfa --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/typecasts/fail-in-optional-calls/output.json @@ -0,0 +1,54 @@ +{ + "type": "File", + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, + "errors": [ + "SyntaxError: The type cast expression is expected to be wrapped with parenthesis (1:15)" + ], + "program": { + "type": "Program", + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, + "expression": { + "type": "OptionalCallExpression", + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, + "callee": { + "type": "Identifier", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8},"identifierName":"funccall"}, + "name": "funccall" + }, + "optional": true, + "arguments": [ + { + "type": "Identifier", + "start":11,"end":12,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":12},"identifierName":"a"}, + "name": "a" + }, + { + "type": "TypeCastExpression", + "start":14,"end":23,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":23}}, + "expression": { + "type": "Identifier", + "start":14,"end":15,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":15},"identifierName":"b"}, + "name": "b" + }, + "typeAnnotation": { + "type": "TypeAnnotation", + "start":15,"end":23,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":23}}, + "typeAnnotation": { + "type": "StringTypeAnnotation", + "start":17,"end":23,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":23}} + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/typecasts/fail-without-parens/options.json b/packages/babel-parser/test/fixtures/flow/typecasts/fail-without-parens/options.json deleted file mode 100644 index 847e987ef0af..000000000000 --- a/packages/babel-parser/test/fixtures/flow/typecasts/fail-without-parens/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "The type cast expression is expected to be wrapped with parenthesis (1:5)" -} diff --git a/packages/babel-parser/test/fixtures/flow/typecasts/fail-without-parens/output.json b/packages/babel-parser/test/fixtures/flow/typecasts/fail-without-parens/output.json new file mode 100644 index 000000000000..60c8b992e95f --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/typecasts/fail-without-parens/output.json @@ -0,0 +1,58 @@ +{ + "type": "File", + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "errors": [ + "SyntaxError: The type cast expression is expected to be wrapped with parenthesis (1:5)" + ], + "program": { + "type": "Program", + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "expression": { + "type": "SequenceExpression", + "start":1,"end":8,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":8}}, + "expressions": [ + { + "type": "Identifier", + "start":1,"end":2,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":2},"identifierName":"A"}, + "name": "A" + }, + { + "type": "TypeCastExpression", + "start":4,"end":8,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":8}}, + "expression": { + "type": "Identifier", + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"B"}, + "name": "B" + }, + "typeAnnotation": { + "type": "TypeAnnotation", + "start":5,"end":8,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":8}}, + "typeAnnotation": { + "type": "GenericTypeAnnotation", + "start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8}}, + "typeParameters": null, + "id": { + "type": "Identifier", + "start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8},"identifierName":"T"}, + "name": "T" + } + } + } + } + ], + "extra": { + "parenthesized": true, + "parenStart": 0 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/typecasts/fails-in-array-expression-1/options.json b/packages/babel-parser/test/fixtures/flow/typecasts/fails-in-array-expression-1/options.json deleted file mode 100644 index 18cdf0d35e40..000000000000 --- a/packages/babel-parser/test/fixtures/flow/typecasts/fails-in-array-expression-1/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "The type cast expression is expected to be wrapped with parenthesis (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/flow/typecasts/fails-in-array-expression-1/output.json b/packages/babel-parser/test/fixtures/flow/typecasts/fails-in-array-expression-1/output.json new file mode 100644 index 000000000000..6fef5e583406 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/typecasts/fails-in-array-expression-1/output.json @@ -0,0 +1,43 @@ +{ + "type": "File", + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "errors": [ + "SyntaxError: The type cast expression is expected to be wrapped with parenthesis (1:2)" + ], + "program": { + "type": "Program", + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "expression": { + "type": "ArrayExpression", + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "elements": [ + { + "type": "TypeCastExpression", + "start":1,"end":10,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":10}}, + "expression": { + "type": "Identifier", + "start":1,"end":2,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":2},"identifierName":"a"}, + "name": "a" + }, + "typeAnnotation": { + "type": "TypeAnnotation", + "start":2,"end":10,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":10}}, + "typeAnnotation": { + "type": "StringTypeAnnotation", + "start":4,"end":10,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":10}} + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/typecasts/fails-in-array-expression-2/options.json b/packages/babel-parser/test/fixtures/flow/typecasts/fails-in-array-expression-2/options.json deleted file mode 100644 index 624681c0d415..000000000000 --- a/packages/babel-parser/test/fixtures/flow/typecasts/fails-in-array-expression-2/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "The type cast expression is expected to be wrapped with parenthesis (1:3)" -} diff --git a/packages/babel-parser/test/fixtures/flow/typecasts/fails-in-array-expression-2/output.json b/packages/babel-parser/test/fixtures/flow/typecasts/fails-in-array-expression-2/output.json new file mode 100644 index 000000000000..2dfd651b7a6b --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/typecasts/fails-in-array-expression-2/output.json @@ -0,0 +1,47 @@ +{ + "type": "File", + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, + "errors": [ + "SyntaxError: The type cast expression is expected to be wrapped with parenthesis (1:3)" + ], + "program": { + "type": "Program", + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, + "expression": { + "type": "ArrayExpression", + "start":1,"end":12,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":12}}, + "elements": [ + { + "type": "TypeCastExpression", + "start":2,"end":11,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":11}}, + "expression": { + "type": "Identifier", + "start":2,"end":3,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":3},"identifierName":"a"}, + "name": "a" + }, + "typeAnnotation": { + "type": "TypeAnnotation", + "start":3,"end":11,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":11}}, + "typeAnnotation": { + "type": "StringTypeAnnotation", + "start":5,"end":11,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":11}} + } + } + } + ], + "extra": { + "parenthesized": true, + "parenStart": 0 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/typecasts/fails-in-array-expression-3/options.json b/packages/babel-parser/test/fixtures/flow/typecasts/fails-in-array-expression-3/options.json deleted file mode 100644 index 7f8da08031af..000000000000 --- a/packages/babel-parser/test/fixtures/flow/typecasts/fails-in-array-expression-3/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "The type cast expression is expected to be wrapped with parenthesis (1:7)" -} diff --git a/packages/babel-parser/test/fixtures/flow/typecasts/fails-in-array-expression-3/output.json b/packages/babel-parser/test/fixtures/flow/typecasts/fails-in-array-expression-3/output.json new file mode 100644 index 000000000000..98c3f55f974e --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/typecasts/fails-in-array-expression-3/output.json @@ -0,0 +1,58 @@ +{ + "type": "File", + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, + "errors": [ + "SyntaxError: The type cast expression is expected to be wrapped with parenthesis (1:7)" + ], + "program": { + "type": "Program", + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, + "expression": { + "type": "ArrayExpression", + "start":1,"end":17,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":17}}, + "elements": [ + { + "type": "Identifier", + "start":2,"end":3,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":3},"identifierName":"a"}, + "name": "a" + }, + { + "type": "ArrayExpression", + "start":5,"end":16,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":16}}, + "elements": [ + { + "type": "TypeCastExpression", + "start":6,"end":15,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":15}}, + "expression": { + "type": "Identifier", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"b"}, + "name": "b" + }, + "typeAnnotation": { + "type": "TypeAnnotation", + "start":7,"end":15,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":15}}, + "typeAnnotation": { + "type": "StringTypeAnnotation", + "start":9,"end":15,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":15}} + } + } + } + ] + } + ], + "extra": { + "parenthesized": true, + "parenStart": 0 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/typecasts/fails-in-array-expression-4/options.json b/packages/babel-parser/test/fixtures/flow/typecasts/fails-in-array-expression-4/options.json deleted file mode 100644 index 23c75013dad4..000000000000 --- a/packages/babel-parser/test/fixtures/flow/typecasts/fails-in-array-expression-4/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "The type cast expression is expected to be wrapped with parenthesis (1:9)" -} diff --git a/packages/babel-parser/test/fixtures/flow/typecasts/fails-in-array-expression-4/output.json b/packages/babel-parser/test/fixtures/flow/typecasts/fails-in-array-expression-4/output.json new file mode 100644 index 000000000000..06d2a6430d16 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/typecasts/fails-in-array-expression-4/output.json @@ -0,0 +1,54 @@ +{ + "type": "File", + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, + "errors": [ + "SyntaxError: The type cast expression is expected to be wrapped with parenthesis (1:9)" + ], + "program": { + "type": "Program", + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, + "expression": { + "type": "CallExpression", + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, + "callee": { + "type": "Identifier", + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5},"identifierName":"async"}, + "name": "async" + }, + "arguments": [ + { + "type": "ArrayExpression", + "start":7,"end":18,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":18}}, + "elements": [ + { + "type": "TypeCastExpression", + "start":8,"end":17,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":17}}, + "expression": { + "type": "Identifier", + "start":8,"end":9,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":9},"identifierName":"a"}, + "name": "a" + }, + "typeAnnotation": { + "type": "TypeAnnotation", + "start":9,"end":17,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":17}}, + "typeAnnotation": { + "type": "StringTypeAnnotation", + "start":11,"end":17,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":17}} + } + } + } + ] + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/typecasts/fails-in-array-expression-5/options.json b/packages/babel-parser/test/fixtures/flow/typecasts/fails-in-array-expression-5/options.json deleted file mode 100644 index 3f861de320eb..000000000000 --- a/packages/babel-parser/test/fixtures/flow/typecasts/fails-in-array-expression-5/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "The type cast expression is expected to be wrapped with parenthesis (1:13)" -} diff --git a/packages/babel-parser/test/fixtures/flow/typecasts/fails-in-array-expression-5/output.json b/packages/babel-parser/test/fixtures/flow/typecasts/fails-in-array-expression-5/output.json new file mode 100644 index 000000000000..9633347434f8 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/typecasts/fails-in-array-expression-5/output.json @@ -0,0 +1,65 @@ +{ + "type": "File", + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, + "errors": [ + "SyntaxError: The type cast expression is expected to be wrapped with parenthesis (1:13)" + ], + "program": { + "type": "Program", + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, + "expression": { + "type": "CallExpression", + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, + "callee": { + "type": "Identifier", + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5},"identifierName":"async"}, + "name": "async" + }, + "arguments": [ + { + "type": "ArrayExpression", + "start":7,"end":23,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":23}}, + "elements": [ + { + "type": "Identifier", + "start":8,"end":9,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":9},"identifierName":"a"}, + "name": "a" + }, + { + "type": "ArrayExpression", + "start":11,"end":22,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":22}}, + "elements": [ + { + "type": "TypeCastExpression", + "start":12,"end":21,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":21}}, + "expression": { + "type": "Identifier", + "start":12,"end":13,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":13},"identifierName":"b"}, + "name": "b" + }, + "typeAnnotation": { + "type": "TypeAnnotation", + "start":13,"end":21,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":21}}, + "typeAnnotation": { + "type": "StringTypeAnnotation", + "start":15,"end":21,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":21}} + } + } + } + ] + } + ] + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/typecasts/works-in-array-pattern/output.json b/packages/babel-parser/test/fixtures/flow/typecasts/works-in-array-pattern/output.json index 0dc34605bead..e01de114e596 100644 --- a/packages/babel-parser/test/fixtures/flow/typecasts/works-in-array-pattern/output.json +++ b/packages/babel-parser/test/fixtures/flow/typecasts/works-in-array-pattern/output.json @@ -1,125 +1,36 @@ { "type": "File", - "start": 0, - "end": 327, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 14, - "column": 28 - } - }, + "start":0,"end":327,"loc":{"start":{"line":1,"column":0},"end":{"line":14,"column":28}}, "program": { "type": "Program", - "start": 0, - "end": 327, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 14, - "column": 28 - } - }, + "start":0,"end":327,"loc":{"start":{"line":1,"column":0},"end":{"line":14,"column":28}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, "expression": { "type": "ArrowFunctionExpression", - "start": 0, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, "id": null, "generator": false, "async": false, "params": [ { "type": "ArrayPattern", - "start": 1, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":1,"end":12,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":12}}, "elements": [ { "type": "Identifier", - "start": 2, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "a" - }, + "start":2,"end":11,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":11},"identifierName":"a"}, "name": "a", "typeAnnotation": { "type": "TypeAnnotation", - "start": 3, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":3,"end":11,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":11}}, "typeAnnotation": { "type": "StringTypeAnnotation", - "start": 5, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 11 - } - } + "start":5,"end":11,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":11}} } } } @@ -128,18 +39,7 @@ ], "body": { "type": "BlockStatement", - "start": 17, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":17,"end":19,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":19}}, "body": [], "directives": [] } @@ -147,127 +47,37 @@ }, { "type": "ExpressionStatement", - "start": 21, - "end": 46, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 25 - } - }, + "start":21,"end":46,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":25}}, "expression": { "type": "ArrowFunctionExpression", - "start": 21, - "end": 45, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 24 - } - }, + "start":21,"end":45,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":24}}, "id": null, "generator": false, "async": false, "params": [ { "type": "ArrayPattern", - "start": 22, - "end": 38, - "loc": { - "start": { - "line": 2, - "column": 1 - }, - "end": { - "line": 2, - "column": 17 - } - }, + "start":22,"end":38,"loc":{"start":{"line":2,"column":1},"end":{"line":2,"column":17}}, "elements": [ { "type": "Identifier", - "start": 23, - "end": 24, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 3 - }, - "identifierName": "a" - }, + "start":23,"end":24,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":3},"identifierName":"a"}, "name": "a" }, { "type": "ArrayPattern", - "start": 26, - "end": 37, - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 16 - } - }, + "start":26,"end":37,"loc":{"start":{"line":2,"column":5},"end":{"line":2,"column":16}}, "elements": [ { "type": "Identifier", - "start": 27, - "end": 36, - "loc": { - "start": { - "line": 2, - "column": 6 - }, - "end": { - "line": 2, - "column": 15 - }, - "identifierName": "b" - }, + "start":27,"end":36,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":15},"identifierName":"b"}, "name": "b", "typeAnnotation": { "type": "TypeAnnotation", - "start": 28, - "end": 36, - "loc": { - "start": { - "line": 2, - "column": 7 - }, - "end": { - "line": 2, - "column": 15 - } - }, + "start":28,"end":36,"loc":{"start":{"line":2,"column":7},"end":{"line":2,"column":15}}, "typeAnnotation": { "type": "StringTypeAnnotation", - "start": 30, - "end": 36, - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 15 - } - } + "start":30,"end":36,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":15}} } } } @@ -278,18 +88,7 @@ ], "body": { "type": "BlockStatement", - "start": 43, - "end": 45, - "loc": { - "start": { - "line": 2, - "column": 22 - }, - "end": { - "line": 2, - "column": 24 - } - }, + "start":43,"end":45,"loc":{"start":{"line":2,"column":22},"end":{"line":2,"column":24}}, "body": [], "directives": [] } @@ -297,109 +96,31 @@ }, { "type": "ExpressionStatement", - "start": 47, - "end": 72, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 25 - } - }, + "start":47,"end":72,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":25}}, "expression": { "type": "ArrowFunctionExpression", - "start": 47, - "end": 71, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 24 - } - }, + "start":47,"end":71,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":24}}, "id": null, "generator": false, "async": false, "params": [ { "type": "AssignmentPattern", - "start": 48, - "end": 64, - "loc": { - "start": { - "line": 3, - "column": 1 - }, - "end": { - "line": 3, - "column": 17 - } - }, + "start":48,"end":64,"loc":{"start":{"line":3,"column":1},"end":{"line":3,"column":17}}, "left": { "type": "ArrayPattern", - "start": 48, - "end": 59, - "loc": { - "start": { - "line": 3, - "column": 1 - }, - "end": { - "line": 3, - "column": 12 - } - }, + "start":48,"end":59,"loc":{"start":{"line":3,"column":1},"end":{"line":3,"column":12}}, "elements": [ { "type": "Identifier", - "start": 49, - "end": 58, - "loc": { - "start": { - "line": 3, - "column": 2 - }, - "end": { - "line": 3, - "column": 11 - }, - "identifierName": "a" - }, + "start":49,"end":58,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":11},"identifierName":"a"}, "name": "a", "typeAnnotation": { "type": "TypeAnnotation", - "start": 50, - "end": 58, - "loc": { - "start": { - "line": 3, - "column": 3 - }, - "end": { - "line": 3, - "column": 11 - } - }, + "start":50,"end":58,"loc":{"start":{"line":3,"column":3},"end":{"line":3,"column":11}}, "typeAnnotation": { "type": "StringTypeAnnotation", - "start": 52, - "end": 58, - "loc": { - "start": { - "line": 3, - "column": 5 - }, - "end": { - "line": 3, - "column": 11 - } - } + "start":52,"end":58,"loc":{"start":{"line":3,"column":5},"end":{"line":3,"column":11}} } } } @@ -407,36 +128,14 @@ }, "right": { "type": "ArrayExpression", - "start": 62, - "end": 64, - "loc": { - "start": { - "line": 3, - "column": 15 - }, - "end": { - "line": 3, - "column": 17 - } - }, + "start":62,"end":64,"loc":{"start":{"line":3,"column":15},"end":{"line":3,"column":17}}, "elements": [] } } ], "body": { "type": "BlockStatement", - "start": 69, - "end": 71, - "loc": { - "start": { - "line": 3, - "column": 22 - }, - "end": { - "line": 3, - "column": 24 - } - }, + "start":69,"end":71,"loc":{"start":{"line":3,"column":22},"end":{"line":3,"column":24}}, "body": [], "directives": [] } @@ -444,144 +143,43 @@ }, { "type": "ExpressionStatement", - "start": 73, - "end": 100, - "loc": { - "start": { - "line": 4, - "column": 0 - }, - "end": { - "line": 4, - "column": 27 - } - }, + "start":73,"end":100,"loc":{"start":{"line":4,"column":0},"end":{"line":4,"column":27}}, "expression": { "type": "ArrowFunctionExpression", - "start": 73, - "end": 99, - "loc": { - "start": { - "line": 4, - "column": 0 - }, - "end": { - "line": 4, - "column": 26 - } - }, + "start":73,"end":99,"loc":{"start":{"line":4,"column":0},"end":{"line":4,"column":26}}, "id": null, "generator": false, "async": false, "params": [ { "type": "ObjectPattern", - "start": 74, - "end": 92, - "loc": { - "start": { - "line": 4, - "column": 1 - }, - "end": { - "line": 4, - "column": 19 - } - }, + "start":74,"end":92,"loc":{"start":{"line":4,"column":1},"end":{"line":4,"column":19}}, "properties": [ { "type": "ObjectProperty", - "start": 76, - "end": 90, - "loc": { - "start": { - "line": 4, - "column": 3 - }, - "end": { - "line": 4, - "column": 17 - } - }, + "start":76,"end":90,"loc":{"start":{"line":4,"column":3},"end":{"line":4,"column":17}}, "method": false, "key": { "type": "Identifier", - "start": 76, - "end": 77, - "loc": { - "start": { - "line": 4, - "column": 3 - }, - "end": { - "line": 4, - "column": 4 - }, - "identifierName": "x" - }, + "start":76,"end":77,"loc":{"start":{"line":4,"column":3},"end":{"line":4,"column":4},"identifierName":"x"}, "name": "x" }, "computed": false, "shorthand": false, "value": { "type": "ArrayPattern", - "start": 79, - "end": 90, - "loc": { - "start": { - "line": 4, - "column": 6 - }, - "end": { - "line": 4, - "column": 17 - } - }, + "start":79,"end":90,"loc":{"start":{"line":4,"column":6},"end":{"line":4,"column":17}}, "elements": [ { "type": "Identifier", - "start": 80, - "end": 89, - "loc": { - "start": { - "line": 4, - "column": 7 - }, - "end": { - "line": 4, - "column": 16 - }, - "identifierName": "a" - }, + "start":80,"end":89,"loc":{"start":{"line":4,"column":7},"end":{"line":4,"column":16},"identifierName":"a"}, "name": "a", "typeAnnotation": { "type": "TypeAnnotation", - "start": 81, - "end": 89, - "loc": { - "start": { - "line": 4, - "column": 8 - }, - "end": { - "line": 4, - "column": 16 - } - }, + "start":81,"end":89,"loc":{"start":{"line":4,"column":8},"end":{"line":4,"column":16}}, "typeAnnotation": { "type": "StringTypeAnnotation", - "start": 83, - "end": 89, - "loc": { - "start": { - "line": 4, - "column": 10 - }, - "end": { - "line": 4, - "column": 16 - } - } + "start":83,"end":89,"loc":{"start":{"line":4,"column":10},"end":{"line":4,"column":16}} } } } @@ -593,18 +191,7 @@ ], "body": { "type": "BlockStatement", - "start": 97, - "end": 99, - "loc": { - "start": { - "line": 4, - "column": 24 - }, - "end": { - "line": 4, - "column": 26 - } - }, + "start":97,"end":99,"loc":{"start":{"line":4,"column":24},"end":{"line":4,"column":26}}, "body": [], "directives": [] } @@ -612,95 +199,28 @@ }, { "type": "ExpressionStatement", - "start": 102, - "end": 128, - "loc": { - "start": { - "line": 6, - "column": 0 - }, - "end": { - "line": 6, - "column": 26 - } - }, + "start":102,"end":128,"loc":{"start":{"line":6,"column":0},"end":{"line":6,"column":26}}, "expression": { "type": "ArrowFunctionExpression", - "start": 102, - "end": 127, - "loc": { - "start": { - "line": 6, - "column": 0 - }, - "end": { - "line": 6, - "column": 25 - } - }, + "start":102,"end":127,"loc":{"start":{"line":6,"column":0},"end":{"line":6,"column":25}}, "id": null, "generator": false, "async": true, "params": [ { "type": "ArrayPattern", - "start": 109, - "end": 120, - "loc": { - "start": { - "line": 6, - "column": 7 - }, - "end": { - "line": 6, - "column": 18 - } - }, + "start":109,"end":120,"loc":{"start":{"line":6,"column":7},"end":{"line":6,"column":18}}, "elements": [ { "type": "Identifier", - "start": 110, - "end": 119, - "loc": { - "start": { - "line": 6, - "column": 8 - }, - "end": { - "line": 6, - "column": 17 - }, - "identifierName": "a" - }, + "start":110,"end":119,"loc":{"start":{"line":6,"column":8},"end":{"line":6,"column":17},"identifierName":"a"}, "name": "a", "typeAnnotation": { "type": "TypeAnnotation", - "start": 111, - "end": 119, - "loc": { - "start": { - "line": 6, - "column": 9 - }, - "end": { - "line": 6, - "column": 17 - } - }, + "start":111,"end":119,"loc":{"start":{"line":6,"column":9},"end":{"line":6,"column":17}}, "typeAnnotation": { "type": "StringTypeAnnotation", - "start": 113, - "end": 119, - "loc": { - "start": { - "line": 6, - "column": 11 - }, - "end": { - "line": 6, - "column": 17 - } - } + "start":113,"end":119,"loc":{"start":{"line":6,"column":11},"end":{"line":6,"column":17}} } } } @@ -709,18 +229,7 @@ ], "body": { "type": "BlockStatement", - "start": 125, - "end": 127, - "loc": { - "start": { - "line": 6, - "column": 23 - }, - "end": { - "line": 6, - "column": 25 - } - }, + "start":125,"end":127,"loc":{"start":{"line":6,"column":23},"end":{"line":6,"column":25}}, "body": [], "directives": [] } @@ -728,127 +237,37 @@ }, { "type": "ExpressionStatement", - "start": 129, - "end": 160, - "loc": { - "start": { - "line": 7, - "column": 0 - }, - "end": { - "line": 7, - "column": 31 - } - }, + "start":129,"end":160,"loc":{"start":{"line":7,"column":0},"end":{"line":7,"column":31}}, "expression": { "type": "ArrowFunctionExpression", - "start": 129, - "end": 159, - "loc": { - "start": { - "line": 7, - "column": 0 - }, - "end": { - "line": 7, - "column": 30 - } - }, + "start":129,"end":159,"loc":{"start":{"line":7,"column":0},"end":{"line":7,"column":30}}, "id": null, "generator": false, "async": true, "params": [ { "type": "ArrayPattern", - "start": 136, - "end": 152, - "loc": { - "start": { - "line": 7, - "column": 7 - }, - "end": { - "line": 7, - "column": 23 - } - }, + "start":136,"end":152,"loc":{"start":{"line":7,"column":7},"end":{"line":7,"column":23}}, "elements": [ { "type": "Identifier", - "start": 137, - "end": 138, - "loc": { - "start": { - "line": 7, - "column": 8 - }, - "end": { - "line": 7, - "column": 9 - }, - "identifierName": "a" - }, + "start":137,"end":138,"loc":{"start":{"line":7,"column":8},"end":{"line":7,"column":9},"identifierName":"a"}, "name": "a" }, { "type": "ArrayPattern", - "start": 140, - "end": 151, - "loc": { - "start": { - "line": 7, - "column": 11 - }, - "end": { - "line": 7, - "column": 22 - } - }, + "start":140,"end":151,"loc":{"start":{"line":7,"column":11},"end":{"line":7,"column":22}}, "elements": [ { "type": "Identifier", - "start": 141, - "end": 150, - "loc": { - "start": { - "line": 7, - "column": 12 - }, - "end": { - "line": 7, - "column": 21 - }, - "identifierName": "b" - }, + "start":141,"end":150,"loc":{"start":{"line":7,"column":12},"end":{"line":7,"column":21},"identifierName":"b"}, "name": "b", "typeAnnotation": { "type": "TypeAnnotation", - "start": 142, - "end": 150, - "loc": { - "start": { - "line": 7, - "column": 13 - }, - "end": { - "line": 7, - "column": 21 - } - }, + "start":142,"end":150,"loc":{"start":{"line":7,"column":13},"end":{"line":7,"column":21}}, "typeAnnotation": { "type": "StringTypeAnnotation", - "start": 144, - "end": 150, - "loc": { - "start": { - "line": 7, - "column": 15 - }, - "end": { - "line": 7, - "column": 21 - } - } + "start":144,"end":150,"loc":{"start":{"line":7,"column":15},"end":{"line":7,"column":21}} } } } @@ -859,18 +278,7 @@ ], "body": { "type": "BlockStatement", - "start": 157, - "end": 159, - "loc": { - "start": { - "line": 7, - "column": 28 - }, - "end": { - "line": 7, - "column": 30 - } - }, + "start":157,"end":159,"loc":{"start":{"line":7,"column":28},"end":{"line":7,"column":30}}, "body": [], "directives": [] } @@ -878,109 +286,31 @@ }, { "type": "ExpressionStatement", - "start": 161, - "end": 192, - "loc": { - "start": { - "line": 8, - "column": 0 - }, - "end": { - "line": 8, - "column": 31 - } - }, + "start":161,"end":192,"loc":{"start":{"line":8,"column":0},"end":{"line":8,"column":31}}, "expression": { "type": "ArrowFunctionExpression", - "start": 161, - "end": 191, - "loc": { - "start": { - "line": 8, - "column": 0 - }, - "end": { - "line": 8, - "column": 30 - } - }, + "start":161,"end":191,"loc":{"start":{"line":8,"column":0},"end":{"line":8,"column":30}}, "id": null, "generator": false, "async": true, "params": [ { "type": "AssignmentPattern", - "start": 168, - "end": 184, - "loc": { - "start": { - "line": 8, - "column": 7 - }, - "end": { - "line": 8, - "column": 23 - } - }, + "start":168,"end":184,"loc":{"start":{"line":8,"column":7},"end":{"line":8,"column":23}}, "left": { "type": "ArrayPattern", - "start": 168, - "end": 179, - "loc": { - "start": { - "line": 8, - "column": 7 - }, - "end": { - "line": 8, - "column": 18 - } - }, + "start":168,"end":179,"loc":{"start":{"line":8,"column":7},"end":{"line":8,"column":18}}, "elements": [ { "type": "Identifier", - "start": 169, - "end": 178, - "loc": { - "start": { - "line": 8, - "column": 8 - }, - "end": { - "line": 8, - "column": 17 - }, - "identifierName": "a" - }, + "start":169,"end":178,"loc":{"start":{"line":8,"column":8},"end":{"line":8,"column":17},"identifierName":"a"}, "name": "a", "typeAnnotation": { "type": "TypeAnnotation", - "start": 170, - "end": 178, - "loc": { - "start": { - "line": 8, - "column": 9 - }, - "end": { - "line": 8, - "column": 17 - } - }, + "start":170,"end":178,"loc":{"start":{"line":8,"column":9},"end":{"line":8,"column":17}}, "typeAnnotation": { "type": "StringTypeAnnotation", - "start": 172, - "end": 178, - "loc": { - "start": { - "line": 8, - "column": 11 - }, - "end": { - "line": 8, - "column": 17 - } - } + "start":172,"end":178,"loc":{"start":{"line":8,"column":11},"end":{"line":8,"column":17}} } } } @@ -988,36 +318,14 @@ }, "right": { "type": "ArrayExpression", - "start": 182, - "end": 184, - "loc": { - "start": { - "line": 8, - "column": 21 - }, - "end": { - "line": 8, - "column": 23 - } - }, + "start":182,"end":184,"loc":{"start":{"line":8,"column":21},"end":{"line":8,"column":23}}, "elements": [] } } ], "body": { "type": "BlockStatement", - "start": 189, - "end": 191, - "loc": { - "start": { - "line": 8, - "column": 28 - }, - "end": { - "line": 8, - "column": 30 - } - }, + "start":189,"end":191,"loc":{"start":{"line":8,"column":28},"end":{"line":8,"column":30}}, "body": [], "directives": [] } @@ -1025,144 +333,43 @@ }, { "type": "ExpressionStatement", - "start": 193, - "end": 226, - "loc": { - "start": { - "line": 9, - "column": 0 - }, - "end": { - "line": 9, - "column": 33 - } - }, + "start":193,"end":226,"loc":{"start":{"line":9,"column":0},"end":{"line":9,"column":33}}, "expression": { "type": "ArrowFunctionExpression", - "start": 193, - "end": 225, - "loc": { - "start": { - "line": 9, - "column": 0 - }, - "end": { - "line": 9, - "column": 32 - } - }, + "start":193,"end":225,"loc":{"start":{"line":9,"column":0},"end":{"line":9,"column":32}}, "id": null, "generator": false, "async": true, "params": [ { "type": "ObjectPattern", - "start": 200, - "end": 218, - "loc": { - "start": { - "line": 9, - "column": 7 - }, - "end": { - "line": 9, - "column": 25 - } - }, + "start":200,"end":218,"loc":{"start":{"line":9,"column":7},"end":{"line":9,"column":25}}, "properties": [ { "type": "ObjectProperty", - "start": 202, - "end": 216, - "loc": { - "start": { - "line": 9, - "column": 9 - }, - "end": { - "line": 9, - "column": 23 - } - }, + "start":202,"end":216,"loc":{"start":{"line":9,"column":9},"end":{"line":9,"column":23}}, "method": false, "key": { "type": "Identifier", - "start": 202, - "end": 203, - "loc": { - "start": { - "line": 9, - "column": 9 - }, - "end": { - "line": 9, - "column": 10 - }, - "identifierName": "x" - }, + "start":202,"end":203,"loc":{"start":{"line":9,"column":9},"end":{"line":9,"column":10},"identifierName":"x"}, "name": "x" }, "computed": false, "shorthand": false, "value": { "type": "ArrayPattern", - "start": 205, - "end": 216, - "loc": { - "start": { - "line": 9, - "column": 12 - }, - "end": { - "line": 9, - "column": 23 - } - }, + "start":205,"end":216,"loc":{"start":{"line":9,"column":12},"end":{"line":9,"column":23}}, "elements": [ { "type": "Identifier", - "start": 206, - "end": 215, - "loc": { - "start": { - "line": 9, - "column": 13 - }, - "end": { - "line": 9, - "column": 22 - }, - "identifierName": "a" - }, + "start":206,"end":215,"loc":{"start":{"line":9,"column":13},"end":{"line":9,"column":22},"identifierName":"a"}, "name": "a", "typeAnnotation": { "type": "TypeAnnotation", - "start": 207, - "end": 215, - "loc": { - "start": { - "line": 9, - "column": 14 - }, - "end": { - "line": 9, - "column": 22 - } - }, + "start":207,"end":215,"loc":{"start":{"line":9,"column":14},"end":{"line":9,"column":22}}, "typeAnnotation": { "type": "StringTypeAnnotation", - "start": 209, - "end": 215, - "loc": { - "start": { - "line": 9, - "column": 16 - }, - "end": { - "line": 9, - "column": 22 - } - } + "start":209,"end":215,"loc":{"start":{"line":9,"column":16},"end":{"line":9,"column":22}} } } } @@ -1174,18 +381,7 @@ ], "body": { "type": "BlockStatement", - "start": 223, - "end": 225, - "loc": { - "start": { - "line": 9, - "column": 30 - }, - "end": { - "line": 9, - "column": 32 - } - }, + "start":223,"end":225,"loc":{"start":{"line":9,"column":30},"end":{"line":9,"column":32}}, "body": [], "directives": [] } @@ -1193,92 +389,25 @@ }, { "type": "VariableDeclaration", - "start": 228, - "end": 249, - "loc": { - "start": { - "line": 11, - "column": 0 - }, - "end": { - "line": 11, - "column": 21 - } - }, + "start":228,"end":249,"loc":{"start":{"line":11,"column":0},"end":{"line":11,"column":21}}, "declarations": [ { "type": "VariableDeclarator", - "start": 232, - "end": 248, - "loc": { - "start": { - "line": 11, - "column": 4 - }, - "end": { - "line": 11, - "column": 20 - } - }, + "start":232,"end":248,"loc":{"start":{"line":11,"column":4},"end":{"line":11,"column":20}}, "id": { "type": "ArrayPattern", - "start": 232, - "end": 244, - "loc": { - "start": { - "line": 11, - "column": 4 - }, - "end": { - "line": 11, - "column": 16 - } - }, + "start":232,"end":244,"loc":{"start":{"line":11,"column":4},"end":{"line":11,"column":16}}, "elements": [ { "type": "Identifier", - "start": 233, - "end": 243, - "loc": { - "start": { - "line": 11, - "column": 5 - }, - "end": { - "line": 11, - "column": 15 - }, - "identifierName": "a1" - }, + "start":233,"end":243,"loc":{"start":{"line":11,"column":5},"end":{"line":11,"column":15},"identifierName":"a1"}, "name": "a1", "typeAnnotation": { "type": "TypeAnnotation", - "start": 235, - "end": 243, - "loc": { - "start": { - "line": 11, - "column": 7 - }, - "end": { - "line": 11, - "column": 15 - } - }, + "start":235,"end":243,"loc":{"start":{"line":11,"column":7},"end":{"line":11,"column":15}}, "typeAnnotation": { "type": "StringTypeAnnotation", - "start": 237, - "end": 243, - "loc": { - "start": { - "line": 11, - "column": 9 - }, - "end": { - "line": 11, - "column": 15 - } - } + "start":237,"end":243,"loc":{"start":{"line":11,"column":9},"end":{"line":11,"column":15}} } } } @@ -1286,19 +415,7 @@ }, "init": { "type": "Identifier", - "start": 247, - "end": 248, - "loc": { - "start": { - "line": 11, - "column": 19 - }, - "end": { - "line": 11, - "column": 20 - }, - "identifierName": "c" - }, + "start":247,"end":248,"loc":{"start":{"line":11,"column":19},"end":{"line":11,"column":20},"identifierName":"c"}, "name": "c" } } @@ -1307,124 +424,34 @@ }, { "type": "VariableDeclaration", - "start": 250, - "end": 276, - "loc": { - "start": { - "line": 12, - "column": 0 - }, - "end": { - "line": 12, - "column": 26 - } - }, + "start":250,"end":276,"loc":{"start":{"line":12,"column":0},"end":{"line":12,"column":26}}, "declarations": [ { "type": "VariableDeclarator", - "start": 254, - "end": 275, - "loc": { - "start": { - "line": 12, - "column": 4 - }, - "end": { - "line": 12, - "column": 25 - } - }, + "start":254,"end":275,"loc":{"start":{"line":12,"column":4},"end":{"line":12,"column":25}}, "id": { "type": "ArrayPattern", - "start": 254, - "end": 271, - "loc": { - "start": { - "line": 12, - "column": 4 - }, - "end": { - "line": 12, - "column": 21 - } - }, + "start":254,"end":271,"loc":{"start":{"line":12,"column":4},"end":{"line":12,"column":21}}, "elements": [ { "type": "Identifier", - "start": 255, - "end": 257, - "loc": { - "start": { - "line": 12, - "column": 5 - }, - "end": { - "line": 12, - "column": 7 - }, - "identifierName": "a2" - }, + "start":255,"end":257,"loc":{"start":{"line":12,"column":5},"end":{"line":12,"column":7},"identifierName":"a2"}, "name": "a2" }, { "type": "ArrayPattern", - "start": 259, - "end": 270, - "loc": { - "start": { - "line": 12, - "column": 9 - }, - "end": { - "line": 12, - "column": 20 - } - }, + "start":259,"end":270,"loc":{"start":{"line":12,"column":9},"end":{"line":12,"column":20}}, "elements": [ { "type": "Identifier", - "start": 260, - "end": 269, - "loc": { - "start": { - "line": 12, - "column": 10 - }, - "end": { - "line": 12, - "column": 19 - }, - "identifierName": "b" - }, + "start":260,"end":269,"loc":{"start":{"line":12,"column":10},"end":{"line":12,"column":19},"identifierName":"b"}, "name": "b", "typeAnnotation": { "type": "TypeAnnotation", - "start": 261, - "end": 269, - "loc": { - "start": { - "line": 12, - "column": 11 - }, - "end": { - "line": 12, - "column": 19 - } - }, + "start":261,"end":269,"loc":{"start":{"line":12,"column":11},"end":{"line":12,"column":19}}, "typeAnnotation": { "type": "StringTypeAnnotation", - "start": 263, - "end": 269, - "loc": { - "start": { - "line": 12, - "column": 13 - }, - "end": { - "line": 12, - "column": 19 - } - } + "start":263,"end":269,"loc":{"start":{"line":12,"column":13},"end":{"line":12,"column":19}} } } } @@ -1434,19 +461,7 @@ }, "init": { "type": "Identifier", - "start": 274, - "end": 275, - "loc": { - "start": { - "line": 12, - "column": 24 - }, - "end": { - "line": 12, - "column": 25 - }, - "identifierName": "c" - }, + "start":274,"end":275,"loc":{"start":{"line":12,"column":24},"end":{"line":12,"column":25},"identifierName":"c"}, "name": "c" } } @@ -1455,92 +470,25 @@ }, { "type": "VariableDeclaration", - "start": 277, - "end": 298, - "loc": { - "start": { - "line": 13, - "column": 0 - }, - "end": { - "line": 13, - "column": 21 - } - }, + "start":277,"end":298,"loc":{"start":{"line":13,"column":0},"end":{"line":13,"column":21}}, "declarations": [ { "type": "VariableDeclarator", - "start": 281, - "end": 297, - "loc": { - "start": { - "line": 13, - "column": 4 - }, - "end": { - "line": 13, - "column": 20 - } - }, + "start":281,"end":297,"loc":{"start":{"line":13,"column":4},"end":{"line":13,"column":20}}, "id": { "type": "ArrayPattern", - "start": 281, - "end": 293, - "loc": { - "start": { - "line": 13, - "column": 4 - }, - "end": { - "line": 13, - "column": 16 - } - }, + "start":281,"end":293,"loc":{"start":{"line":13,"column":4},"end":{"line":13,"column":16}}, "elements": [ { "type": "Identifier", - "start": 282, - "end": 292, - "loc": { - "start": { - "line": 13, - "column": 5 - }, - "end": { - "line": 13, - "column": 15 - }, - "identifierName": "a3" - }, + "start":282,"end":292,"loc":{"start":{"line":13,"column":5},"end":{"line":13,"column":15},"identifierName":"a3"}, "name": "a3", "typeAnnotation": { "type": "TypeAnnotation", - "start": 284, - "end": 292, - "loc": { - "start": { - "line": 13, - "column": 7 - }, - "end": { - "line": 13, - "column": 15 - } - }, + "start":284,"end":292,"loc":{"start":{"line":13,"column":7},"end":{"line":13,"column":15}}, "typeAnnotation": { "type": "StringTypeAnnotation", - "start": 286, - "end": 292, - "loc": { - "start": { - "line": 13, - "column": 9 - }, - "end": { - "line": 13, - "column": 15 - } - } + "start":286,"end":292,"loc":{"start":{"line":13,"column":9},"end":{"line":13,"column":15}} } } } @@ -1548,19 +496,7 @@ }, "init": { "type": "Identifier", - "start": 296, - "end": 297, - "loc": { - "start": { - "line": 13, - "column": 19 - }, - "end": { - "line": 13, - "column": 20 - }, - "identifierName": "c" - }, + "start":296,"end":297,"loc":{"start":{"line":13,"column":19},"end":{"line":13,"column":20},"identifierName":"c"}, "name": "c" } } @@ -1569,141 +505,40 @@ }, { "type": "VariableDeclaration", - "start": 299, - "end": 327, - "loc": { - "start": { - "line": 14, - "column": 0 - }, - "end": { - "line": 14, - "column": 28 - } - }, + "start":299,"end":327,"loc":{"start":{"line":14,"column":0},"end":{"line":14,"column":28}}, "declarations": [ { "type": "VariableDeclarator", - "start": 303, - "end": 326, - "loc": { - "start": { - "line": 14, - "column": 4 - }, - "end": { - "line": 14, - "column": 27 - } - }, + "start":303,"end":326,"loc":{"start":{"line":14,"column":4},"end":{"line":14,"column":27}}, "id": { "type": "ObjectPattern", - "start": 303, - "end": 322, - "loc": { - "start": { - "line": 14, - "column": 4 - }, - "end": { - "line": 14, - "column": 23 - } - }, + "start":303,"end":322,"loc":{"start":{"line":14,"column":4},"end":{"line":14,"column":23}}, "properties": [ { "type": "ObjectProperty", - "start": 305, - "end": 320, - "loc": { - "start": { - "line": 14, - "column": 6 - }, - "end": { - "line": 14, - "column": 21 - } - }, + "start":305,"end":320,"loc":{"start":{"line":14,"column":6},"end":{"line":14,"column":21}}, "method": false, "key": { "type": "Identifier", - "start": 305, - "end": 306, - "loc": { - "start": { - "line": 14, - "column": 6 - }, - "end": { - "line": 14, - "column": 7 - }, - "identifierName": "x" - }, + "start":305,"end":306,"loc":{"start":{"line":14,"column":6},"end":{"line":14,"column":7},"identifierName":"x"}, "name": "x" }, "computed": false, "shorthand": false, "value": { "type": "ArrayPattern", - "start": 308, - "end": 320, - "loc": { - "start": { - "line": 14, - "column": 9 - }, - "end": { - "line": 14, - "column": 21 - } - }, + "start":308,"end":320,"loc":{"start":{"line":14,"column":9},"end":{"line":14,"column":21}}, "elements": [ { "type": "Identifier", - "start": 309, - "end": 319, - "loc": { - "start": { - "line": 14, - "column": 10 - }, - "end": { - "line": 14, - "column": 20 - }, - "identifierName": "a4" - }, + "start":309,"end":319,"loc":{"start":{"line":14,"column":10},"end":{"line":14,"column":20},"identifierName":"a4"}, "name": "a4", "typeAnnotation": { "type": "TypeAnnotation", - "start": 311, - "end": 319, - "loc": { - "start": { - "line": 14, - "column": 12 - }, - "end": { - "line": 14, - "column": 20 - } - }, + "start":311,"end":319,"loc":{"start":{"line":14,"column":12},"end":{"line":14,"column":20}}, "typeAnnotation": { "type": "StringTypeAnnotation", - "start": 313, - "end": 319, - "loc": { - "start": { - "line": 14, - "column": 14 - }, - "end": { - "line": 14, - "column": 20 - } - } + "start":313,"end":319,"loc":{"start":{"line":14,"column":14},"end":{"line":14,"column":20}} } } } @@ -1714,19 +549,7 @@ }, "init": { "type": "Identifier", - "start": 325, - "end": 326, - "loc": { - "start": { - "line": 14, - "column": 26 - }, - "end": { - "line": 14, - "column": 27 - }, - "identifierName": "c" - }, + "start":325,"end":326,"loc":{"start":{"line":14,"column":26},"end":{"line":14,"column":27},"identifierName":"c"}, "name": "c" } } diff --git a/packages/babel-parser/test/fixtures/flow/typecasts/yield-extra-parentheses/output.json b/packages/babel-parser/test/fixtures/flow/typecasts/yield-extra-parentheses/output.json index c8d784f85fd3..b9f585103dd8 100644 --- a/packages/babel-parser/test/fixtures/flow/typecasts/yield-extra-parentheses/output.json +++ b/packages/babel-parser/test/fixtures/flow/typecasts/yield-extra-parentheses/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 49, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":49,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 49, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":49,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 49, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":49,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "id": { "type": "Identifier", - "start": 10, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 13 - }, - "identifierName": "foo" - }, + "start":10,"end":13,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":13},"identifierName":"foo"}, "name": "foo" }, "generator": true, @@ -65,126 +20,36 @@ "params": [ { "type": "Identifier", - "start": 14, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - }, - "identifierName": "z" - }, + "start":14,"end":15,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":15},"identifierName":"z"}, "name": "z" } ], "body": { "type": "BlockStatement", - "start": 17, - "end": 49, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":17,"end":49,"loc":{"start":{"line":1,"column":17},"end":{"line":3,"column":1}}, "body": [ { "type": "VariableDeclaration", - "start": 21, - "end": 47, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 28 - } - }, + "start":21,"end":47,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":28}}, "declarations": [ { "type": "VariableDeclarator", - "start": 27, - "end": 47, - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 28 - } - }, + "start":27,"end":47,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":28}}, "id": { "type": "Identifier", - "start": 27, - "end": 28, - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 9 - }, - "identifierName": "x" - }, + "start":27,"end":28,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":9},"identifierName":"x"}, "name": "x" }, "init": { "type": "TypeCastExpression", - "start": 32, - "end": 46, - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 27 - } - }, + "start":32,"end":46,"loc":{"start":{"line":2,"column":13},"end":{"line":2,"column":27}}, "expression": { "type": "YieldExpression", - "start": 33, - "end": 40, - "loc": { - "start": { - "line": 2, - "column": 14 - }, - "end": { - "line": 2, - "column": 21 - } - }, + "start":33,"end":40,"loc":{"start":{"line":2,"column":14},"end":{"line":2,"column":21}}, "delegate": false, "argument": { "type": "NumericLiteral", - "start": 39, - "end": 40, - "loc": { - "start": { - "line": 2, - "column": 20 - }, - "end": { - "line": 2, - "column": 21 - } - }, + "start":39,"end":40,"loc":{"start":{"line":2,"column":20},"end":{"line":2,"column":21}}, "extra": { "rawValue": 3, "raw": "3" @@ -198,32 +63,10 @@ }, "typeAnnotation": { "type": "TypeAnnotation", - "start": 41, - "end": 46, - "loc": { - "start": { - "line": 2, - "column": 22 - }, - "end": { - "line": 2, - "column": 27 - } - }, + "start":41,"end":46,"loc":{"start":{"line":2,"column":22},"end":{"line":2,"column":27}}, "typeAnnotation": { "type": "AnyTypeAnnotation", - "start": 43, - "end": 46, - "loc": { - "start": { - "line": 2, - "column": 24 - }, - "end": { - "line": 2, - "column": 27 - } - } + "start":43,"end":46,"loc":{"start":{"line":2,"column":24},"end":{"line":2,"column":27}} } }, "extra": { diff --git a/packages/babel-parser/test/fixtures/flow/typecasts/yield/output.json b/packages/babel-parser/test/fixtures/flow/typecasts/yield/output.json index 70c311fbfbe8..61afa7d3aff6 100644 --- a/packages/babel-parser/test/fixtures/flow/typecasts/yield/output.json +++ b/packages/babel-parser/test/fixtures/flow/typecasts/yield/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 47, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":47,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 47, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":47,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 47, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":47,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "id": { "type": "Identifier", - "start": 10, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 13 - }, - "identifierName": "foo" - }, + "start":10,"end":13,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":13},"identifierName":"foo"}, "name": "foo" }, "generator": true, @@ -65,126 +20,36 @@ "params": [ { "type": "Identifier", - "start": 14, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - }, - "identifierName": "z" - }, + "start":14,"end":15,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":15},"identifierName":"z"}, "name": "z" } ], "body": { "type": "BlockStatement", - "start": 17, - "end": 47, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":17,"end":47,"loc":{"start":{"line":1,"column":17},"end":{"line":3,"column":1}}, "body": [ { "type": "VariableDeclaration", - "start": 21, - "end": 45, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 26 - } - }, + "start":21,"end":45,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":26}}, "declarations": [ { "type": "VariableDeclarator", - "start": 27, - "end": 45, - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 26 - } - }, + "start":27,"end":45,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":26}}, "id": { "type": "Identifier", - "start": 27, - "end": 28, - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 9 - }, - "identifierName": "x" - }, + "start":27,"end":28,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":9},"identifierName":"x"}, "name": "x" }, "init": { "type": "TypeCastExpression", - "start": 32, - "end": 44, - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 25 - } - }, + "start":32,"end":44,"loc":{"start":{"line":2,"column":13},"end":{"line":2,"column":25}}, "expression": { "type": "YieldExpression", - "start": 32, - "end": 39, - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 20 - } - }, + "start":32,"end":39,"loc":{"start":{"line":2,"column":13},"end":{"line":2,"column":20}}, "delegate": false, "argument": { "type": "NumericLiteral", - "start": 38, - "end": 39, - "loc": { - "start": { - "line": 2, - "column": 19 - }, - "end": { - "line": 2, - "column": 20 - } - }, + "start":38,"end":39,"loc":{"start":{"line":2,"column":19},"end":{"line":2,"column":20}}, "extra": { "rawValue": 3, "raw": "3" @@ -194,32 +59,10 @@ }, "typeAnnotation": { "type": "TypeAnnotation", - "start": 39, - "end": 44, - "loc": { - "start": { - "line": 2, - "column": 20 - }, - "end": { - "line": 2, - "column": 25 - } - }, + "start":39,"end":44,"loc":{"start":{"line":2,"column":20},"end":{"line":2,"column":25}}, "typeAnnotation": { "type": "AnyTypeAnnotation", - "start": 41, - "end": 44, - "loc": { - "start": { - "line": 2, - "column": 22 - }, - "end": { - "line": 2, - "column": 25 - } - } + "start":41,"end":44,"loc":{"start":{"line":2,"column":22},"end":{"line":2,"column":25}} } }, "extra": { diff --git a/packages/babel-parser/test/fixtures/jsx/basic/1/output.json b/packages/babel-parser/test/fixtures/jsx/basic/1/output.json index ee713f49d1d8..43465f251328 100644 --- a/packages/babel-parser/test/fixtures/jsx/basic/1/output.json +++ b/packages/babel-parser/test/fixtures/jsx/basic/1/output.json @@ -1,93 +1,27 @@ { "type": "File", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "program": { "type": "Program", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "expression": { "type": "JSXElement", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "openingElement": { "type": "JSXOpeningElement", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "attributes": [], + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "name": { "type": "JSXIdentifier", - "start": 1, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - } - }, + "start":1,"end":2,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":2}}, "name": "a" }, + "attributes": [], "selfClosing": true }, "closingElement": null, diff --git a/packages/babel-parser/test/fixtures/jsx/basic/10/output.json b/packages/babel-parser/test/fixtures/jsx/basic/10/output.json index 7c95fc951c3f..0f575bce2909 100644 --- a/packages/babel-parser/test/fixtures/jsx/basic/10/output.json +++ b/packages/babel-parser/test/fixtures/jsx/basic/10/output.json @@ -1,171 +1,50 @@ { "type": "File", - "start": 0, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, "program": { "type": "Program", - "start": 0, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, "expression": { "type": "JSXElement", - "start": 0, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, "openingElement": { "type": "JSXOpeningElement", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, - "attributes": [], + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, "name": { "type": "JSXIdentifier", - "start": 1, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - } - }, + "start":1,"end":2,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":2}}, "name": "a" }, + "attributes": [], "selfClosing": false }, "closingElement": { "type": "JSXClosingElement", - "start": 28, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":28,"end":32,"loc":{"start":{"line":1,"column":28},"end":{"line":1,"column":32}}, "name": { "type": "JSXIdentifier", - "start": 30, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":30,"end":31,"loc":{"start":{"line":1,"column":30},"end":{"line":1,"column":31}}, "name": "a" } }, "children": [ { "type": "JSXExpressionContainer", - "start": 3, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":3,"end":28,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":28}}, "expression": { "type": "JSXEmptyExpression", - "start": 4, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":4,"end":27,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":27}}, "innerComments": [ { "type": "CommentBlock", "value": " this is a comment ", - "start": 4, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 27 - } - } + "start":4,"end":27,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":27}} } ] } @@ -180,18 +59,7 @@ { "type": "CommentBlock", "value": " this is a comment ", - "start": 4, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 27 - } - } + "start":4,"end":27,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":27}} } ] } \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/jsx/basic/11/output.json b/packages/babel-parser/test/fixtures/jsx/basic/11/output.json index acaecedbd162..28166db395bf 100644 --- a/packages/babel-parser/test/fixtures/jsx/basic/11/output.json +++ b/packages/babel-parser/test/fixtures/jsx/basic/11/output.json @@ -1,141 +1,42 @@ { "type": "File", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "program": { "type": "Program", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "expression": { "type": "JSXElement", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "openingElement": { "type": "JSXOpeningElement", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "attributes": [], + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "name": { "type": "JSXIdentifier", - "start": 1, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 4 - } - }, + "start":1,"end":4,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":4}}, "name": "div" }, + "attributes": [], "selfClosing": false }, "closingElement": { "type": "JSXClosingElement", - "start": 18, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":18,"end":24,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":24}}, "name": { "type": "JSXIdentifier", - "start": 20, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":20,"end":23,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":23}}, "name": "div" } }, "children": [ { "type": "JSXText", - "start": 5, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":5,"end":18,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":18}}, "extra": { "rawValue": "@test content", "raw": "@test content" diff --git a/packages/babel-parser/test/fixtures/jsx/basic/12/output.json b/packages/babel-parser/test/fixtures/jsx/basic/12/output.json index 5a1709007f43..d7438ce991f0 100644 --- a/packages/babel-parser/test/fixtures/jsx/basic/12/output.json +++ b/packages/babel-parser/test/fixtures/jsx/basic/12/output.json @@ -1,172 +1,51 @@ { "type": "File", - "start": 0, - "end": 41, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 41 - } - }, + "start":0,"end":41,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":41}}, "program": { "type": "Program", - "start": 0, - "end": 41, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 41 - } - }, + "start":0,"end":41,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":41}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 41, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 41 - } - }, + "start":0,"end":41,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":41}}, "expression": { "type": "JSXElement", - "start": 0, - "end": 41, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 41 - } - }, + "start":0,"end":41,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":41}}, "openingElement": { "type": "JSXOpeningElement", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "attributes": [], + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "name": { "type": "JSXIdentifier", - "start": 1, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 4 - } - }, + "start":1,"end":4,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":4}}, "name": "div" }, + "attributes": [], "selfClosing": false }, "closingElement": { "type": "JSXClosingElement", - "start": 35, - "end": 41, - "loc": { - "start": { - "line": 1, - "column": 35 - }, - "end": { - "line": 1, - "column": 41 - } - }, + "start":35,"end":41,"loc":{"start":{"line":1,"column":35},"end":{"line":1,"column":41}}, "name": { "type": "JSXIdentifier", - "start": 37, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 37 - }, - "end": { - "line": 1, - "column": 40 - } - }, + "start":37,"end":40,"loc":{"start":{"line":1,"column":37},"end":{"line":1,"column":40}}, "name": "div" } }, "children": [ { "type": "JSXElement", - "start": 5, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":5,"end":11,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":11}}, "openingElement": { "type": "JSXOpeningElement", - "start": 5, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "attributes": [], + "start":5,"end":11,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":11}}, "name": { "type": "JSXIdentifier", - "start": 6, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":6,"end":8,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":8}}, "name": "br" }, + "attributes": [], "selfClosing": true }, "closingElement": null, @@ -174,18 +53,7 @@ }, { "type": "JSXText", - "start": 11, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":11,"end":35,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":35}}, "extra": { "rawValue": "7x invalid-js-identifier", "raw": "7x invalid-js-identifier" diff --git a/packages/babel-parser/test/fixtures/jsx/basic/13/output.json b/packages/babel-parser/test/fixtures/jsx/basic/13/output.json index 7655bc7e042f..0f199c3576f8 100644 --- a/packages/babel-parser/test/fixtures/jsx/basic/13/output.json +++ b/packages/babel-parser/test/fixtures/jsx/basic/13/output.json @@ -1,152 +1,47 @@ { "type": "File", - "start": 0, - "end": 57, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 57 - } - }, + "start":0,"end":57,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":57}}, "program": { "type": "Program", - "start": 0, - "end": 57, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 57 - } - }, + "start":0,"end":57,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":57}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 57, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 57 - } - }, + "start":0,"end":57,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":57}}, "expression": { "type": "JSXElement", - "start": 0, - "end": 57, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 57 - } - }, + "start":0,"end":57,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":57}}, "openingElement": { "type": "JSXOpeningElement", - "start": 0, - "end": 57, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 57 - } + "start":0,"end":57,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":57}}, + "name": { + "type": "JSXIdentifier", + "start":1,"end":10,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":10}}, + "name": "LeftRight" }, "attributes": [ { "type": "JSXAttribute", - "start": 11, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":11,"end":21,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":21}}, "name": { "type": "JSXIdentifier", - "start": 11, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":11,"end":15,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":15}}, "name": "left" }, "value": { "type": "JSXElement", - "start": 16, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":16,"end":21,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":21}}, "openingElement": { "type": "JSXOpeningElement", - "start": 16, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 21 - } - }, - "attributes": [], + "start":16,"end":21,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":21}}, "name": { "type": "JSXIdentifier", - "start": 17, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":17,"end":18,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":18}}, "name": "a" }, + "attributes": [], "selfClosing": true }, "closingElement": null, @@ -155,127 +50,39 @@ }, { "type": "JSXAttribute", - "start": 22, - "end": 54, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 54 - } - }, + "start":22,"end":54,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":54}}, "name": { "type": "JSXIdentifier", - "start": 22, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":22,"end":27,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":27}}, "name": "right" }, "value": { "type": "JSXElement", - "start": 28, - "end": 54, - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 54 - } - }, + "start":28,"end":54,"loc":{"start":{"line":1,"column":28},"end":{"line":1,"column":54}}, "openingElement": { "type": "JSXOpeningElement", - "start": 28, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 31 - } - }, - "attributes": [], + "start":28,"end":31,"loc":{"start":{"line":1,"column":28},"end":{"line":1,"column":31}}, "name": { "type": "JSXIdentifier", - "start": 29, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":29,"end":30,"loc":{"start":{"line":1,"column":29},"end":{"line":1,"column":30}}, "name": "b" }, + "attributes": [], "selfClosing": false }, "closingElement": { "type": "JSXClosingElement", - "start": 50, - "end": 54, - "loc": { - "start": { - "line": 1, - "column": 50 - }, - "end": { - "line": 1, - "column": 54 - } - }, + "start":50,"end":54,"loc":{"start":{"line":1,"column":50},"end":{"line":1,"column":54}}, "name": { "type": "JSXIdentifier", - "start": 52, - "end": 53, - "loc": { - "start": { - "line": 1, - "column": 52 - }, - "end": { - "line": 1, - "column": 53 - } - }, + "start":52,"end":53,"loc":{"start":{"line":1,"column":52},"end":{"line":1,"column":53}}, "name": "b" } }, "children": [ { "type": "JSXText", - "start": 31, - "end": 50, - "loc": { - "start": { - "line": 1, - "column": 31 - }, - "end": { - "line": 1, - "column": 50 - } - }, + "start":31,"end":50,"loc":{"start":{"line":1,"column":31},"end":{"line":1,"column":50}}, "extra": { "rawValue": "monkeys /> gorillas", "raw": "monkeys /> gorillas" @@ -286,22 +93,6 @@ } } ], - "name": { - "type": "JSXIdentifier", - "start": 1, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "name": "LeftRight" - }, "selfClosing": true }, "closingElement": null, diff --git a/packages/babel-parser/test/fixtures/jsx/basic/14/output.json b/packages/babel-parser/test/fixtures/jsx/basic/14/output.json index 24262087534c..2e2704398093 100644 --- a/packages/babel-parser/test/fixtures/jsx/basic/14/output.json +++ b/packages/babel-parser/test/fixtures/jsx/basic/14/output.json @@ -1,184 +1,52 @@ { "type": "File", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "program": { "type": "Program", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "expression": { "type": "JSXElement", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "openingElement": { "type": "JSXOpeningElement", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "attributes": [], + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "name": { "type": "JSXMemberExpression", - "start": 1, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 4 - } - }, + "start":1,"end":4,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":4}}, "object": { "type": "JSXIdentifier", - "start": 1, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - } - }, + "start":1,"end":2,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":2}}, "name": "a" }, "property": { "type": "JSXIdentifier", - "start": 3, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 4 - } - }, + "start":3,"end":4,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":4}}, "name": "b" } }, + "attributes": [], "selfClosing": false }, "closingElement": { "type": "JSXClosingElement", - "start": 5, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":5,"end":11,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":11}}, "name": { "type": "JSXMemberExpression", - "start": 7, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":7,"end":10,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":10}}, "object": { "type": "JSXIdentifier", - "start": 7, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8}}, "name": "a" }, "property": { "type": "JSXIdentifier", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10}}, "name": "b" } } diff --git a/packages/babel-parser/test/fixtures/jsx/basic/15/output.json b/packages/babel-parser/test/fixtures/jsx/basic/15/output.json index 3ee9c36533f3..a4bd5cb8573b 100644 --- a/packages/babel-parser/test/fixtures/jsx/basic/15/output.json +++ b/packages/babel-parser/test/fixtures/jsx/basic/15/output.json @@ -1,246 +1,70 @@ { "type": "File", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "program": { "type": "Program", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "expression": { "type": "JSXElement", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "openingElement": { "type": "JSXOpeningElement", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "attributes": [], + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "name": { "type": "JSXMemberExpression", - "start": 1, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":1,"end":6,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":6}}, "object": { "type": "JSXMemberExpression", - "start": 1, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 4 - } - }, + "start":1,"end":4,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":4}}, "object": { "type": "JSXIdentifier", - "start": 1, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - } - }, + "start":1,"end":2,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":2}}, "name": "a" }, "property": { "type": "JSXIdentifier", - "start": 3, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 4 - } - }, + "start":3,"end":4,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":4}}, "name": "b" } }, "property": { "type": "JSXIdentifier", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, "name": "c" } }, + "attributes": [], "selfClosing": false }, "closingElement": { "type": "JSXClosingElement", - "start": 7, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":7,"end":15,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":15}}, "name": { "type": "JSXMemberExpression", - "start": 9, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":9,"end":14,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":14}}, "object": { "type": "JSXMemberExpression", - "start": 9, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":9,"end":12,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":12}}, "object": { "type": "JSXIdentifier", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10}}, "name": "a" }, "property": { "type": "JSXIdentifier", - "start": 11, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":11,"end":12,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":12}}, "name": "b" } }, "property": { "type": "JSXIdentifier", - "start": 13, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":13,"end":14,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":14}}, "name": "c" } } diff --git a/packages/babel-parser/test/fixtures/jsx/basic/16/output.json b/packages/babel-parser/test/fixtures/jsx/basic/16/output.json index 8ecae0406bd5..57c6e3c2b47e 100644 --- a/packages/babel-parser/test/fixtures/jsx/basic/16/output.json +++ b/packages/babel-parser/test/fixtures/jsx/basic/16/output.json @@ -1,107 +1,30 @@ { "type": "File", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "program": { "type": "Program", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "expression": { "type": "BinaryExpression", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "left": { "type": "JSXElement", - "start": 1, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":1,"end":8,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":8}}, "openingElement": { "type": "JSXOpeningElement", - "start": 1, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "attributes": [], + "start":1,"end":8,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":8}}, "name": { "type": "JSXIdentifier", - "start": 2, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":2,"end":5,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":5}}, "name": "div" }, + "attributes": [], "selfClosing": true }, "closingElement": null, @@ -114,19 +37,7 @@ "operator": "<", "right": { "type": "Identifier", - "start": 12, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - }, - "identifierName": "x" - }, + "start":12,"end":13,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":13},"identifierName":"x"}, "name": "x" } } diff --git a/packages/babel-parser/test/fixtures/jsx/basic/17/output.json b/packages/babel-parser/test/fixtures/jsx/basic/17/output.json index e48fcd57530e..b7ce5fff4a8d 100644 --- a/packages/babel-parser/test/fixtures/jsx/basic/17/output.json +++ b/packages/babel-parser/test/fixtures/jsx/basic/17/output.json @@ -1,126 +1,37 @@ { "type": "File", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, "program": { "type": "Program", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, "expression": { "type": "JSXElement", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, "openingElement": { "type": "JSXOpeningElement", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, + "name": { + "type": "JSXIdentifier", + "start":1,"end":4,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":4}}, + "name": "div" }, "attributes": [ { "type": "JSXSpreadAttribute", - "start": 5, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":5,"end":15,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":15}}, "argument": { "type": "Identifier", - "start": 9, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 14 - }, - "identifierName": "props" - }, + "start":9,"end":14,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":14},"identifierName":"props"}, "name": "props" } } ], - "name": { - "type": "JSXIdentifier", - "start": 1, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 4 - } - }, - "name": "div" - }, "selfClosing": true }, "closingElement": null, diff --git a/packages/babel-parser/test/fixtures/jsx/basic/18/output.json b/packages/babel-parser/test/fixtures/jsx/basic/18/output.json index ebcfbfdc73ff..05753aae0aa1 100644 --- a/packages/babel-parser/test/fixtures/jsx/basic/18/output.json +++ b/packages/babel-parser/test/fixtures/jsx/basic/18/output.json @@ -1,153 +1,47 @@ { "type": "File", - "start": 0, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":35}}, "program": { "type": "Program", - "start": 0, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":35}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":35}}, "expression": { "type": "JSXElement", - "start": 0, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":35}}, "openingElement": { "type": "JSXOpeningElement", - "start": 0, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 35 - } + "start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":35}}, + "name": { + "type": "JSXIdentifier", + "start":1,"end":4,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":4}}, + "name": "div" }, "attributes": [ { "type": "JSXSpreadAttribute", - "start": 5, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":5,"end":15,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":15}}, "argument": { "type": "Identifier", - "start": 9, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 14 - }, - "identifierName": "props" - }, + "start":9,"end":14,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":14},"identifierName":"props"}, "name": "props" } }, { "type": "JSXAttribute", - "start": 16, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":16,"end":32,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":32}}, "name": { "type": "JSXIdentifier", - "start": 16, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":16,"end":20,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":20}}, "name": "post" }, "value": { "type": "StringLiteral", - "start": 21, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":21,"end":32,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":32}}, "extra": { "rawValue": "attribute", "raw": "\"attribute\"" @@ -156,22 +50,6 @@ } } ], - "name": { - "type": "JSXIdentifier", - "start": 1, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 4 - } - }, - "name": "div" - }, "selfClosing": true }, "closingElement": null, diff --git a/packages/babel-parser/test/fixtures/jsx/basic/19/output.json b/packages/babel-parser/test/fixtures/jsx/basic/19/output.json index 1af0c7849bd5..969618c86895 100644 --- a/packages/babel-parser/test/fixtures/jsx/basic/19/output.json +++ b/packages/babel-parser/test/fixtures/jsx/basic/19/output.json @@ -1,121 +1,38 @@ { "type": "File", - "start": 0, - "end": 53, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 53 - } - }, + "start":0,"end":53,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":53}}, "program": { "type": "Program", - "start": 0, - "end": 53, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 53 - } - }, + "start":0,"end":53,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":53}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 53, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 53 - } - }, + "start":0,"end":53,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":53}}, "expression": { "type": "JSXElement", - "start": 0, - "end": 53, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 53 - } - }, + "start":0,"end":53,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":53}}, "openingElement": { "type": "JSXOpeningElement", - "start": 0, - "end": 47, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 47 - } + "start":0,"end":47,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":47}}, + "name": { + "type": "JSXIdentifier", + "start":1,"end":4,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":4}}, + "name": "div" }, "attributes": [ { "type": "JSXAttribute", - "start": 5, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":5,"end":18,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":18}}, "name": { "type": "JSXIdentifier", - "start": 5, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":5,"end":8,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":8}}, "name": "pre" }, "value": { "type": "StringLiteral", - "start": 9, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":9,"end":18,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":18}}, "extra": { "rawValue": "leading", "raw": "\"leading\"" @@ -125,48 +42,15 @@ }, { "type": "JSXAttribute", - "start": 19, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":19,"end":35,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":35}}, "name": { "type": "JSXIdentifier", - "start": 19, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":19,"end":23,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":23}}, "name": "pre2" }, "value": { "type": "StringLiteral", - "start": 24, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":24,"end":35,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":35}}, "extra": { "rawValue": "attribute", "raw": "\"attribute\"" @@ -176,83 +60,22 @@ }, { "type": "JSXSpreadAttribute", - "start": 36, - "end": 46, - "loc": { - "start": { - "line": 1, - "column": 36 - }, - "end": { - "line": 1, - "column": 46 - } - }, + "start":36,"end":46,"loc":{"start":{"line":1,"column":36},"end":{"line":1,"column":46}}, "argument": { "type": "Identifier", - "start": 40, - "end": 45, - "loc": { - "start": { - "line": 1, - "column": 40 - }, - "end": { - "line": 1, - "column": 45 - }, - "identifierName": "props" - }, + "start":40,"end":45,"loc":{"start":{"line":1,"column":40},"end":{"line":1,"column":45},"identifierName":"props"}, "name": "props" } } ], - "name": { - "type": "JSXIdentifier", - "start": 1, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 4 - } - }, - "name": "div" - }, "selfClosing": false }, "closingElement": { "type": "JSXClosingElement", - "start": 47, - "end": 53, - "loc": { - "start": { - "line": 1, - "column": 47 - }, - "end": { - "line": 1, - "column": 53 - } - }, + "start":47,"end":53,"loc":{"start":{"line":1,"column":47},"end":{"line":1,"column":53}}, "name": { "type": "JSXIdentifier", - "start": 49, - "end": 52, - "loc": { - "start": { - "line": 1, - "column": 49 - }, - "end": { - "line": 1, - "column": 52 - } - }, + "start":49,"end":52,"loc":{"start":{"line":1,"column":49},"end":{"line":1,"column":52}}, "name": "div" } }, diff --git a/packages/babel-parser/test/fixtures/jsx/basic/2/output.json b/packages/babel-parser/test/fixtures/jsx/basic/2/output.json index b07a503ba508..6f5c8aa7b96a 100644 --- a/packages/babel-parser/test/fixtures/jsx/basic/2/output.json +++ b/packages/babel-parser/test/fixtures/jsx/basic/2/output.json @@ -1,188 +1,56 @@ { "type": "File", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "program": { "type": "Program", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "expression": { "type": "JSXElement", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "openingElement": { "type": "JSXOpeningElement", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "name": { + "type": "JSXNamespacedName", + "start":1,"end":4,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":4}}, + "namespace": { + "type": "JSXIdentifier", + "start":1,"end":2,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":2}}, + "name": "n" }, - "end": { - "line": 1, - "column": 11 + "name": { + "type": "JSXIdentifier", + "start":3,"end":4,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":4}}, + "name": "a" } }, "attributes": [ { "type": "JSXAttribute", - "start": 5, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":5,"end":8,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":8}}, "name": { "type": "JSXNamespacedName", - "start": 5, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":5,"end":8,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":8}}, "namespace": { "type": "JSXIdentifier", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, "name": "n" }, "name": { "type": "JSXIdentifier", - "start": 7, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8}}, "name": "v" } }, "value": null } ], - "name": { - "type": "JSXNamespacedName", - "start": 1, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 4 - } - }, - "namespace": { - "type": "JSXIdentifier", - "start": 1, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - } - }, - "name": "n" - }, - "name": { - "type": "JSXIdentifier", - "start": 3, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 4 - } - }, - "name": "a" - } - }, "selfClosing": true }, "closingElement": null, diff --git a/packages/babel-parser/test/fixtures/jsx/basic/20/output.json b/packages/babel-parser/test/fixtures/jsx/basic/20/output.json index a781728b23c0..c1de95224e5d 100644 --- a/packages/babel-parser/test/fixtures/jsx/basic/20/output.json +++ b/packages/babel-parser/test/fixtures/jsx/basic/20/output.json @@ -1,200 +1,59 @@ { "type": "File", - "start": 0, - "end": 52, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 52 - } - }, + "start":0,"end":52,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":52}}, "program": { "type": "Program", - "start": 0, - "end": 52, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 52 - } - }, + "start":0,"end":52,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":52}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 52, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 52 - } - }, + "start":0,"end":52,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":52}}, "expression": { "type": "JSXElement", - "start": 0, - "end": 52, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 52 - } - }, + "start":0,"end":52,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":52}}, "openingElement": { "type": "JSXOpeningElement", - "start": 0, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, + "name": { + "type": "JSXIdentifier", + "start":1,"end":2,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":2}}, + "name": "A" }, "attributes": [ { "type": "JSXAttribute", - "start": 3, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":3,"end":16,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":16}}, "name": { "type": "JSXIdentifier", - "start": 3, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":3,"end":5,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":5}}, "name": "aa" }, "value": { "type": "JSXExpressionContainer", - "start": 6, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":6,"end":16,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":16}}, "expression": { "type": "MemberExpression", - "start": 7, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":7,"end":15,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":15}}, "object": { "type": "MemberExpression", - "start": 7, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":7,"end":12,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":12}}, "object": { "type": "Identifier", - "start": 7, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "aa" - }, + "start":7,"end":9,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":9},"identifierName":"aa"}, "name": "aa" }, "property": { "type": "Identifier", - "start": 10, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "bb" - }, + "start":10,"end":12,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":12},"identifierName":"bb"}, "name": "bb" }, "computed": false }, "property": { "type": "Identifier", - "start": 13, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 15 - }, - "identifierName": "cc" - }, + "start":13,"end":15,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":15},"identifierName":"cc"}, "name": "cc" }, "computed": false @@ -203,127 +62,36 @@ }, { "type": "JSXAttribute", - "start": 17, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":17,"end":30,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":30}}, "name": { "type": "JSXIdentifier", - "start": 17, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":17,"end":19,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":19}}, "name": "bb" }, "value": { "type": "JSXExpressionContainer", - "start": 20, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":20,"end":30,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":30}}, "expression": { "type": "MemberExpression", - "start": 21, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":21,"end":29,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":29}}, "object": { "type": "MemberExpression", - "start": 21, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":21,"end":26,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":26}}, "object": { "type": "Identifier", - "start": 21, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 23 - }, - "identifierName": "bb" - }, + "start":21,"end":23,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":23},"identifierName":"bb"}, "name": "bb" }, "property": { "type": "Identifier", - "start": 24, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 26 - }, - "identifierName": "cc" - }, + "start":24,"end":26,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":26},"identifierName":"cc"}, "name": "cc" }, "computed": false }, "property": { "type": "Identifier", - "start": 27, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 29 - }, - "identifierName": "dd" - }, + "start":27,"end":29,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":29},"identifierName":"dd"}, "name": "dd" }, "computed": false @@ -331,195 +99,56 @@ } } ], - "name": { - "type": "JSXIdentifier", - "start": 1, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - } - }, - "name": "A" - }, "selfClosing": false }, "closingElement": { "type": "JSXClosingElement", - "start": 48, - "end": 52, - "loc": { - "start": { - "line": 1, - "column": 48 - }, - "end": { - "line": 1, - "column": 52 - } - }, + "start":48,"end":52,"loc":{"start":{"line":1,"column":48},"end":{"line":1,"column":52}}, "name": { "type": "JSXIdentifier", - "start": 50, - "end": 51, - "loc": { - "start": { - "line": 1, - "column": 50 - }, - "end": { - "line": 1, - "column": 51 - } - }, + "start":50,"end":51,"loc":{"start":{"line":1,"column":50},"end":{"line":1,"column":51}}, "name": "A" } }, "children": [ { "type": "JSXElement", - "start": 31, - "end": 48, - "loc": { - "start": { - "line": 1, - "column": 31 - }, - "end": { - "line": 1, - "column": 48 - } - }, + "start":31,"end":48,"loc":{"start":{"line":1,"column":31},"end":{"line":1,"column":48}}, "openingElement": { "type": "JSXOpeningElement", - "start": 31, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 31 - }, - "end": { - "line": 1, - "column": 36 - } - }, - "attributes": [], + "start":31,"end":36,"loc":{"start":{"line":1,"column":31},"end":{"line":1,"column":36}}, "name": { "type": "JSXIdentifier", - "start": 32, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 32 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":32,"end":35,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":35}}, "name": "div" }, + "attributes": [], "selfClosing": false }, "closingElement": { "type": "JSXClosingElement", - "start": 42, - "end": 48, - "loc": { - "start": { - "line": 1, - "column": 42 - }, - "end": { - "line": 1, - "column": 48 - } - }, + "start":42,"end":48,"loc":{"start":{"line":1,"column":42},"end":{"line":1,"column":48}}, "name": { "type": "JSXIdentifier", - "start": 44, - "end": 47, - "loc": { - "start": { - "line": 1, - "column": 44 - }, - "end": { - "line": 1, - "column": 47 - } - }, + "start":44,"end":47,"loc":{"start":{"line":1,"column":44},"end":{"line":1,"column":47}}, "name": "div" } }, "children": [ { "type": "JSXExpressionContainer", - "start": 36, - "end": 42, - "loc": { - "start": { - "line": 1, - "column": 36 - }, - "end": { - "line": 1, - "column": 42 - } - }, + "start":36,"end":42,"loc":{"start":{"line":1,"column":36},"end":{"line":1,"column":42}}, "expression": { "type": "MemberExpression", - "start": 37, - "end": 41, - "loc": { - "start": { - "line": 1, - "column": 37 - }, - "end": { - "line": 1, - "column": 41 - } - }, + "start":37,"end":41,"loc":{"start":{"line":1,"column":37},"end":{"line":1,"column":41}}, "object": { "type": "Identifier", - "start": 37, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 37 - }, - "end": { - "line": 1, - "column": 39 - }, - "identifierName": "aa" - }, + "start":37,"end":39,"loc":{"start":{"line":1,"column":37},"end":{"line":1,"column":39},"identifierName":"aa"}, "name": "aa" }, "property": { "type": "Identifier", - "start": 40, - "end": 41, - "loc": { - "start": { - "line": 1, - "column": 40 - }, - "end": { - "line": 1, - "column": 41 - }, - "identifierName": "b" - }, + "start":40,"end":41,"loc":{"start":{"line":1,"column":40},"end":{"line":1,"column":41},"identifierName":"b"}, "name": "b" }, "computed": false diff --git a/packages/babel-parser/test/fixtures/jsx/basic/21/output.json b/packages/babel-parser/test/fixtures/jsx/basic/21/output.json index c32f7d50f55e..e50d64b1f5d9 100644 --- a/packages/babel-parser/test/fixtures/jsx/basic/21/output.json +++ b/packages/babel-parser/test/fixtures/jsx/basic/21/output.json @@ -1,174 +1,52 @@ { "type": "File", - "start": 0, - "end": 41, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 41 - } - }, + "start":0,"end":41,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":41}}, "program": { "type": "Program", - "start": 0, - "end": 41, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 41 - } - }, + "start":0,"end":41,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":41}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 41, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 41 - } - }, + "start":0,"end":41,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":41}}, "expression": { "type": "JSXElement", - "start": 0, - "end": 41, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 41 - } - }, + "start":0,"end":41,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":41}}, "openingElement": { "type": "JSXOpeningElement", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "name": { + "type": "JSXIdentifier", + "start":1,"end":4,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":4}}, + "name": "div" }, "attributes": [ { "type": "JSXSpreadAttribute", - "start": 5, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":5,"end":11,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":11}}, "argument": { "type": "Identifier", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - }, - "identifierName": "c" - }, + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"c"}, "name": "c" } } ], - "name": { - "type": "JSXIdentifier", - "start": 1, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 4 - } - }, - "name": "div" - }, "selfClosing": false }, "closingElement": { "type": "JSXClosingElement", - "start": 35, - "end": 41, - "loc": { - "start": { - "line": 1, - "column": 35 - }, - "end": { - "line": 1, - "column": 41 - } - }, + "start":35,"end":41,"loc":{"start":{"line":1,"column":35},"end":{"line":1,"column":41}}, "name": { "type": "JSXIdentifier", - "start": 37, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 37 - }, - "end": { - "line": 1, - "column": 40 - } - }, + "start":37,"end":40,"loc":{"start":{"line":1,"column":37},"end":{"line":1,"column":40}}, "name": "div" } }, "children": [ { "type": "JSXText", - "start": 12, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":12,"end":13,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":13}}, "extra": { "rawValue": " ", "raw": " " @@ -177,97 +55,28 @@ }, { "type": "JSXSpreadChild", - "start": 13, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":13,"end":26,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":26}}, "expression": { "type": "Identifier", - "start": 17, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 25 - }, - "identifierName": "children" - }, + "start":17,"end":25,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":25},"identifierName":"children"}, "name": "children" } }, { "type": "JSXExpressionContainer", - "start": 26, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":26,"end":29,"loc":{"start":{"line":1,"column":26},"end":{"line":1,"column":29}}, "expression": { "type": "Identifier", - "start": 27, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 28 - }, - "identifierName": "a" - }, + "start":27,"end":28,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":28},"identifierName":"a"}, "name": "a" } }, { "type": "JSXSpreadChild", - "start": 29, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":29,"end":35,"loc":{"start":{"line":1,"column":29},"end":{"line":1,"column":35}}, "expression": { "type": "Identifier", - "start": 33, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 33 - }, - "end": { - "line": 1, - "column": 34 - }, - "identifierName": "b" - }, + "start":33,"end":34,"loc":{"start":{"line":1,"column":33},"end":{"line":1,"column":34},"identifierName":"b"}, "name": "b" } } diff --git a/packages/babel-parser/test/fixtures/jsx/basic/3/output.json b/packages/babel-parser/test/fixtures/jsx/basic/3/output.json index cd5d3b3888fe..306715c7ea80 100644 --- a/packages/babel-parser/test/fixtures/jsx/basic/3/output.json +++ b/packages/babel-parser/test/fixtures/jsx/basic/3/output.json @@ -1,152 +1,47 @@ { "type": "File", - "start": 0, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 40 - } - }, + "start":0,"end":40,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":40}}, "program": { "type": "Program", - "start": 0, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 40 - } - }, + "start":0,"end":40,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":40}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 40 - } - }, + "start":0,"end":40,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":40}}, "expression": { "type": "JSXElement", - "start": 0, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 40 - } - }, + "start":0,"end":40,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":40}}, "openingElement": { "type": "JSXOpeningElement", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, + "name": { + "type": "JSXIdentifier", + "start":1,"end":2,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":2}}, + "name": "a" }, "attributes": [ { "type": "JSXAttribute", - "start": 3, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":3,"end":14,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":14}}, "name": { "type": "JSXNamespacedName", - "start": 3, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":3,"end":8,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":8}}, "namespace": { "type": "JSXIdentifier", - "start": 3, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 4 - } - }, + "start":3,"end":4,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":4}}, "name": "n" }, "name": { "type": "JSXIdentifier", - "start": 5, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":5,"end":8,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":8}}, "name": "foo" } }, "value": { "type": "StringLiteral", - "start": 9, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":9,"end":14,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":14}}, "extra": { "rawValue": "bar", "raw": "\"bar\"" @@ -155,70 +50,21 @@ } } ], - "name": { - "type": "JSXIdentifier", - "start": 1, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - } - }, - "name": "a" - }, "selfClosing": false }, "closingElement": { "type": "JSXClosingElement", - "start": 36, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 36 - }, - "end": { - "line": 1, - "column": 40 - } - }, + "start":36,"end":40,"loc":{"start":{"line":1,"column":36},"end":{"line":1,"column":40}}, "name": { "type": "JSXIdentifier", - "start": 38, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 38 - }, - "end": { - "line": 1, - "column": 39 - } - }, + "start":38,"end":39,"loc":{"start":{"line":1,"column":38},"end":{"line":1,"column":39}}, "name": "a" } }, "children": [ { "type": "JSXText", - "start": 15, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":15,"end":16,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":16}}, "extra": { "rawValue": " ", "raw": " " @@ -227,50 +73,16 @@ }, { "type": "JSXExpressionContainer", - "start": 16, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":16,"end":23,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":23}}, "expression": { "type": "Identifier", - "start": 17, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 22 - }, - "identifierName": "value" - }, + "start":17,"end":22,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":22},"identifierName":"value"}, "name": "value" } }, { "type": "JSXText", - "start": 23, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":23,"end":24,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":24}}, "extra": { "rawValue": " ", "raw": " " @@ -279,128 +91,40 @@ }, { "type": "JSXElement", - "start": 24, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":24,"end":36,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":36}}, "openingElement": { "type": "JSXOpeningElement", - "start": 24, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 27 - } - }, - "attributes": [], + "start":24,"end":27,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":27}}, "name": { "type": "JSXIdentifier", - "start": 25, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":25,"end":26,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":26}}, "name": "b" }, + "attributes": [], "selfClosing": false }, "closingElement": { "type": "JSXClosingElement", - "start": 32, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 32 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":32,"end":36,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":36}}, "name": { "type": "JSXIdentifier", - "start": 34, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 34 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":34,"end":35,"loc":{"start":{"line":1,"column":34},"end":{"line":1,"column":35}}, "name": "b" } }, "children": [ { "type": "JSXElement", - "start": 27, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":27,"end":32,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":32}}, "openingElement": { "type": "JSXOpeningElement", - "start": 27, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 32 - } - }, - "attributes": [], + "start":27,"end":32,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":32}}, "name": { "type": "JSXIdentifier", - "start": 28, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":28,"end":29,"loc":{"start":{"line":1,"column":28},"end":{"line":1,"column":29}}, "name": "c" }, + "attributes": [], "selfClosing": true }, "closingElement": null, diff --git a/packages/babel-parser/test/fixtures/jsx/basic/4/output.json b/packages/babel-parser/test/fixtures/jsx/basic/4/output.json index 417106c4996e..b6a7ec4bf145 100644 --- a/packages/babel-parser/test/fixtures/jsx/basic/4/output.json +++ b/packages/babel-parser/test/fixtures/jsx/basic/4/output.json @@ -1,135 +1,41 @@ { "type": "File", - "start": 0, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 40 - } - }, + "start":0,"end":40,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":40}}, "program": { "type": "Program", - "start": 0, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 40 - } - }, + "start":0,"end":40,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":40}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 40 - } - }, + "start":0,"end":40,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":40}}, "expression": { "type": "JSXElement", - "start": 0, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 40 - } - }, + "start":0,"end":40,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":40}}, "openingElement": { "type": "JSXOpeningElement", - "start": 0, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 40 - } + "start":0,"end":40,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":40}}, + "name": { + "type": "JSXIdentifier", + "start":1,"end":2,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":2}}, + "name": "a" }, "attributes": [ { "type": "JSXAttribute", - "start": 3, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":3,"end":10,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":10}}, "name": { "type": "JSXIdentifier", - "start": 3, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 4 - } - }, + "start":3,"end":4,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":4}}, "name": "b" }, "value": { "type": "JSXExpressionContainer", - "start": 5, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":5,"end":10,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":10}}, "expression": { "type": "StringLiteral", - "start": 6, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":6,"end":9,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":9}}, "extra": { "rawValue": " ", "raw": "\" \"" @@ -140,48 +46,15 @@ }, { "type": "JSXAttribute", - "start": 11, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":11,"end":16,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":16}}, "name": { "type": "JSXIdentifier", - "start": 11, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":11,"end":12,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":12}}, "name": "c" }, "value": { "type": "StringLiteral", - "start": 13, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":13,"end":16,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":16}}, "extra": { "rawValue": " ", "raw": "\" \"" @@ -191,48 +64,15 @@ }, { "type": "JSXAttribute", - "start": 17, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":17,"end":26,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":26}}, "name": { "type": "JSXIdentifier", - "start": 17, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":17,"end":18,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":18}}, "name": "d" }, "value": { "type": "StringLiteral", - "start": 19, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":19,"end":26,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":26}}, "extra": { "rawValue": "&", "raw": "\"&\"" @@ -242,48 +82,15 @@ }, { "type": "JSXAttribute", - "start": 27, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 37 - } - }, + "start":27,"end":37,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":37}}, "name": { "type": "JSXIdentifier", - "start": 27, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":27,"end":28,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":28}}, "name": "e" }, "value": { "type": "StringLiteral", - "start": 29, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 1, - "column": 37 - } - }, + "start":29,"end":37,"loc":{"start":{"line":1,"column":29},"end":{"line":1,"column":37}}, "extra": { "rawValue": "&r;", "raw": "\"&r;\"" @@ -292,22 +99,6 @@ } } ], - "name": { - "type": "JSXIdentifier", - "start": 1, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - } - }, - "name": "a" - }, "selfClosing": true }, "closingElement": null, diff --git a/packages/babel-parser/test/fixtures/jsx/basic/5/output.json b/packages/babel-parser/test/fixtures/jsx/basic/5/output.json index 5fa0e0d0fc57..5cf9215fecc9 100644 --- a/packages/babel-parser/test/fixtures/jsx/basic/5/output.json +++ b/packages/babel-parser/test/fixtures/jsx/basic/5/output.json @@ -1,93 +1,27 @@ { "type": "File", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 2 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":2}}, "program": { "type": "Program", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 2 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":2}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 2 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":2}}, "expression": { "type": "JSXElement", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 2 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":2}}, "openingElement": { "type": "JSXOpeningElement", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 2 - } - }, - "attributes": [], + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":2}}, "name": { "type": "JSXIdentifier", - "start": 1, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - } - }, + "start":1,"end":2,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":2}}, "name": "a" }, + "attributes": [], "selfClosing": true }, "closingElement": null, diff --git a/packages/babel-parser/test/fixtures/jsx/basic/6/output.json b/packages/babel-parser/test/fixtures/jsx/basic/6/output.json index d67b18f89955..86f8bc59e3e9 100644 --- a/packages/babel-parser/test/fixtures/jsx/basic/6/output.json +++ b/packages/babel-parser/test/fixtures/jsx/basic/6/output.json @@ -1,123 +1,35 @@ { "type": "File", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "program": { "type": "Program", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "expression": { "type": "JSXElement", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "openingElement": { "type": "JSXOpeningElement", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "attributes": [], + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "name": { "type": "JSXIdentifier", - "start": 1, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 4 - } - }, + "start":1,"end":4,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":4}}, "name": "日本語" }, + "attributes": [], "selfClosing": false }, "closingElement": { "type": "JSXClosingElement", - "start": 5, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":5,"end":11,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":11}}, "name": { "type": "JSXIdentifier", - "start": 7, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":7,"end":10,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":10}}, "name": "日本語" } }, diff --git a/packages/babel-parser/test/fixtures/jsx/basic/7/output.json b/packages/babel-parser/test/fixtures/jsx/basic/7/output.json index 152cea1d6c6e..075fd8fbaa45 100644 --- a/packages/babel-parser/test/fixtures/jsx/basic/7/output.json +++ b/packages/babel-parser/test/fixtures/jsx/basic/7/output.json @@ -1,121 +1,38 @@ { "type": "File", - "start": 0, - "end": 51, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 10 - } - }, + "start":0,"end":51,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":10}}, "program": { "type": "Program", - "start": 0, - "end": 51, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 10 - } - }, + "start":0,"end":51,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":10}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 51, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 10 - } - }, + "start":0,"end":51,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":10}}, "expression": { "type": "JSXElement", - "start": 0, - "end": 51, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 10 - } - }, + "start":0,"end":51,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":10}}, "openingElement": { "type": "JSXOpeningElement", - "start": 0, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 23 - } + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":23}}, + "name": { + "type": "JSXIdentifier", + "start":1,"end":8,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":8}}, + "name": "AbC-def" }, "attributes": [ { "type": "JSXAttribute", - "start": 11, - "end": 31, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 22 - } - }, + "start":11,"end":31,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":22}}, "name": { "type": "JSXIdentifier", - "start": 11, - "end": 15, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 6 - } - }, + "start":11,"end":15,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":6}}, "name": "test" }, "value": { "type": "StringLiteral", - "start": 16, - "end": 31, - "loc": { - "start": { - "line": 2, - "column": 7 - }, - "end": { - "line": 2, - "column": 22 - } - }, + "start":16,"end":31,"loc":{"start":{"line":2,"column":7},"end":{"line":2,"column":22}}, "extra": { "rawValue": "&&", "raw": "\"&&\"" @@ -124,70 +41,21 @@ } } ], - "name": { - "type": "JSXIdentifier", - "start": 1, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "name": "AbC-def" - }, "selfClosing": false }, "closingElement": { "type": "JSXClosingElement", - "start": 41, - "end": 51, - "loc": { - "start": { - "line": 5, - "column": 0 - }, - "end": { - "line": 5, - "column": 10 - } - }, + "start":41,"end":51,"loc":{"start":{"line":5,"column":0},"end":{"line":5,"column":10}}, "name": { "type": "JSXIdentifier", - "start": 43, - "end": 50, - "loc": { - "start": { - "line": 5, - "column": 2 - }, - "end": { - "line": 5, - "column": 9 - } - }, + "start":43,"end":50,"loc":{"start":{"line":5,"column":2},"end":{"line":5,"column":9}}, "name": "AbC-def" } }, "children": [ { "type": "JSXText", - "start": 32, - "end": 41, - "loc": { - "start": { - "line": 2, - "column": 23 - }, - "end": { - "line": 5, - "column": 0 - } - }, + "start":32,"end":41,"loc":{"start":{"line":2,"column":23},"end":{"line":5,"column":0}}, "extra": { "rawValue": "\nbar\nbaz\n", "raw": "\nbar\nbaz\n" diff --git a/packages/babel-parser/test/fixtures/jsx/basic/8/output.json b/packages/babel-parser/test/fixtures/jsx/basic/8/output.json index 2306ee643e7b..4a0689eac53a 100644 --- a/packages/babel-parser/test/fixtures/jsx/basic/8/output.json +++ b/packages/babel-parser/test/fixtures/jsx/basic/8/output.json @@ -1,197 +1,58 @@ { "type": "File", - "start": 0, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, "program": { "type": "Program", - "start": 0, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, "expression": { "type": "JSXElement", - "start": 0, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, "openingElement": { "type": "JSXOpeningElement", - "start": 0, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 27 - } + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, + "name": { + "type": "JSXIdentifier", + "start":1,"end":2,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":2}}, + "name": "a" }, "attributes": [ { "type": "JSXAttribute", - "start": 3, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":3,"end":24,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":24}}, "name": { "type": "JSXIdentifier", - "start": 3, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 4 - } - }, + "start":3,"end":4,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":4}}, "name": "b" }, "value": { "type": "JSXExpressionContainer", - "start": 5, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":5,"end":24,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":24}}, "expression": { "type": "ConditionalExpression", - "start": 6, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":6,"end":23,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":23}}, "test": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "x" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"x"}, "name": "x" }, "consequent": { "type": "JSXElement", - "start": 10, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":10,"end":15,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":15}}, "openingElement": { "type": "JSXOpeningElement", - "start": 10, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "attributes": [], + "start":10,"end":15,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":15}}, "name": { "type": "JSXIdentifier", - "start": 11, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":11,"end":12,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":12}}, "name": "c" }, + "attributes": [], "selfClosing": true }, "closingElement": null, @@ -199,49 +60,16 @@ }, "alternate": { "type": "JSXElement", - "start": 18, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":18,"end":23,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":23}}, "openingElement": { "type": "JSXOpeningElement", - "start": 18, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 23 - } - }, - "attributes": [], + "start":18,"end":23,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":23}}, "name": { "type": "JSXIdentifier", - "start": 19, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":19,"end":20,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":20}}, "name": "d" }, + "attributes": [], "selfClosing": true }, "closingElement": null, @@ -251,22 +79,6 @@ } } ], - "name": { - "type": "JSXIdentifier", - "start": 1, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - } - }, - "name": "a" - }, "selfClosing": true }, "closingElement": null, diff --git a/packages/babel-parser/test/fixtures/jsx/basic/asi/output.json b/packages/babel-parser/test/fixtures/jsx/basic/asi/output.json index b7046c70fc3d..3546f044c8b3 100644 --- a/packages/babel-parser/test/fixtures/jsx/basic/asi/output.json +++ b/packages/babel-parser/test/fixtures/jsx/basic/asi/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, "id": { "type": "Identifier", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - }, - "identifierName": "x" - }, + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"x"}, "name": "x" }, "generator": false, @@ -65,63 +20,18 @@ "params": [], "body": { "type": "BlockStatement", - "start": 13, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":13,"end":34,"loc":{"start":{"line":1,"column":13},"end":{"line":4,"column":1}}, "body": [ { "type": "VariableDeclaration", - "start": 17, - "end": 22, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 7 - } - }, + "start":17,"end":22,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":7}}, "declarations": [ { "type": "VariableDeclarator", - "start": 21, - "end": 22, - "loc": { - "start": { - "line": 2, - "column": 6 - }, - "end": { - "line": 2, - "column": 7 - } - }, + "start":21,"end":22,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":7}}, "id": { "type": "Identifier", - "start": 21, - "end": 22, - "loc": { - "start": { - "line": 2, - "column": 6 - }, - "end": { - "line": 2, - "column": 7 - }, - "identifierName": "x" - }, + "start":21,"end":22,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":7},"identifierName":"x"}, "name": "x" }, "init": null @@ -131,63 +41,19 @@ }, { "type": "ExpressionStatement", - "start": 25, - "end": 32, - "loc": { - "start": { - "line": 3, - "column": 2 - }, - "end": { - "line": 3, - "column": 9 - } - }, + "start":25,"end":32,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":9}}, "expression": { "type": "JSXElement", - "start": 25, - "end": 32, - "loc": { - "start": { - "line": 3, - "column": 2 - }, - "end": { - "line": 3, - "column": 9 - } - }, + "start":25,"end":32,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":9}}, "openingElement": { "type": "JSXOpeningElement", - "start": 25, - "end": 32, - "loc": { - "start": { - "line": 3, - "column": 2 - }, - "end": { - "line": 3, - "column": 9 - } - }, - "attributes": [], + "start":25,"end":32,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":9}}, "name": { "type": "JSXIdentifier", - "start": 26, - "end": 29, - "loc": { - "start": { - "line": 3, - "column": 3 - }, - "end": { - "line": 3, - "column": 6 - } - }, + "start":26,"end":29,"loc":{"start":{"line":3,"column":3},"end":{"line":3,"column":6}}, "name": "div" }, + "attributes": [], "selfClosing": true }, "closingElement": null, diff --git a/packages/babel-parser/test/fixtures/jsx/basic/empty-expression-container/output.json b/packages/babel-parser/test/fixtures/jsx/basic/empty-expression-container/output.json index da7d2b16d94d..29e49e74efa0 100644 --- a/packages/babel-parser/test/fixtures/jsx/basic/empty-expression-container/output.json +++ b/packages/babel-parser/test/fixtures/jsx/basic/empty-expression-container/output.json @@ -1,155 +1,45 @@ { "type": "File", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "program": { "type": "Program", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "expression": { "type": "JSXElement", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "openingElement": { "type": "JSXOpeningElement", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, - "attributes": [], + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, "name": { "type": "JSXIdentifier", - "start": 1, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - } - }, + "start":1,"end":2,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":2}}, "name": "a" }, + "attributes": [], "selfClosing": false }, "closingElement": { "type": "JSXClosingElement", - "start": 5, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":5,"end":9,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":9}}, "name": { "type": "JSXIdentifier", - "start": 7, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8}}, "name": "a" } }, "children": [ { "type": "JSXExpressionContainer", - "start": 3, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":3,"end":5,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":5}}, "expression": { "type": "JSXEmptyExpression", - "start": 4, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 4 - } - } + "start":4,"end":4,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":4}} } } ] diff --git a/packages/babel-parser/test/fixtures/jsx/basic/entity/output.json b/packages/babel-parser/test/fixtures/jsx/basic/entity/output.json index e02761042799..02bcd5df3486 100644 --- a/packages/babel-parser/test/fixtures/jsx/basic/entity/output.json +++ b/packages/babel-parser/test/fixtures/jsx/basic/entity/output.json @@ -1,141 +1,42 @@ { "type": "File", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "program": { "type": "Program", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "expression": { "type": "JSXElement", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "openingElement": { "type": "JSXOpeningElement", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, - "attributes": [], + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, "name": { "type": "JSXIdentifier", - "start": 1, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - } - }, + "start":1,"end":2,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":2}}, "name": "A" }, + "attributes": [], "selfClosing": false }, "closingElement": { "type": "JSXClosingElement", - "start": 12, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":12,"end":16,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":16}}, "name": { "type": "JSXIdentifier", - "start": 14, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":14,"end":15,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":15}}, "name": "A" } }, "children": [ { "type": "JSXText", - "start": 3, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":3,"end":12,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":12}}, "extra": { "rawValue": "💩", "raw": "💩" diff --git a/packages/babel-parser/test/fixtures/jsx/basic/fragment-1/output.json b/packages/babel-parser/test/fixtures/jsx/basic/fragment-1/output.json index fe57b763fa73..7a6af6561102 100644 --- a/packages/babel-parser/test/fixtures/jsx/basic/fragment-1/output.json +++ b/packages/babel-parser/test/fixtures/jsx/basic/fragment-1/output.json @@ -1,91 +1,25 @@ { "type": "File", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "program": { "type": "Program", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "expression": { "type": "JSXFragment", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "openingFragment": { "type": "JSXOpeningFragment", - "start": 0, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 2 - } - } + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}} }, "closingFragment": { "type": "JSXClosingFragment", - "start": 2, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 5 - } - } + "start":2,"end":5,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":5}} }, "children": [] } diff --git a/packages/babel-parser/test/fixtures/jsx/basic/fragment-2/output.json b/packages/babel-parser/test/fixtures/jsx/basic/fragment-2/output.json index d3a333659795..b018b26610dc 100644 --- a/packages/babel-parser/test/fixtures/jsx/basic/fragment-2/output.json +++ b/packages/babel-parser/test/fixtures/jsx/basic/fragment-2/output.json @@ -1,107 +1,30 @@ { "type": "File", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "program": { "type": "Program", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "expression": { "type": "JSXFragment", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "openingFragment": { "type": "JSXOpeningFragment", - "start": 0, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 2 - } - } + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}} }, "closingFragment": { "type": "JSXClosingFragment", - "start": 19, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 22 - } - } + "start":19,"end":22,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":22}} }, "children": [ { "type": "JSXText", - "start": 2, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":2,"end":19,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":19}}, "extra": { "rawValue": "Hi, I'm a string!", "raw": "Hi, I'm a string!" diff --git a/packages/babel-parser/test/fixtures/jsx/basic/fragment-3/output.json b/packages/babel-parser/test/fixtures/jsx/basic/fragment-3/output.json index a6202bce9c8f..217844f82939 100644 --- a/packages/babel-parser/test/fixtures/jsx/basic/fragment-3/output.json +++ b/packages/babel-parser/test/fixtures/jsx/basic/fragment-3/output.json @@ -1,107 +1,30 @@ { "type": "File", - "start": 0, - "end": 50, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 6, - "column": 3 - } - }, + "start":0,"end":50,"loc":{"start":{"line":1,"column":0},"end":{"line":6,"column":3}}, "program": { "type": "Program", - "start": 0, - "end": 50, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 6, - "column": 3 - } - }, + "start":0,"end":50,"loc":{"start":{"line":1,"column":0},"end":{"line":6,"column":3}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 50, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 6, - "column": 3 - } - }, + "start":0,"end":50,"loc":{"start":{"line":1,"column":0},"end":{"line":6,"column":3}}, "expression": { "type": "JSXFragment", - "start": 0, - "end": 50, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 6, - "column": 3 - } - }, + "start":0,"end":50,"loc":{"start":{"line":1,"column":0},"end":{"line":6,"column":3}}, "openingFragment": { "type": "JSXOpeningFragment", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - } + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}} }, "closingFragment": { "type": "JSXClosingFragment", - "start": 47, - "end": 50, - "loc": { - "start": { - "line": 6, - "column": 0 - }, - "end": { - "line": 6, - "column": 3 - } - } + "start":47,"end":50,"loc":{"start":{"line":6,"column":0},"end":{"line":6,"column":3}} }, "children": [ { "type": "JSXText", - "start": 3, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 2, - "column": 2 - } - }, + "start":3,"end":6,"loc":{"start":{"line":1,"column":3},"end":{"line":2,"column":2}}, "extra": { "rawValue": "\n ", "raw": "\n " @@ -110,97 +33,31 @@ }, { "type": "JSXElement", - "start": 6, - "end": 29, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 4, - "column": 9 - } - }, + "start":6,"end":29,"loc":{"start":{"line":2,"column":2},"end":{"line":4,"column":9}}, "openingElement": { "type": "JSXOpeningElement", - "start": 6, - "end": 12, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 8 - } - }, - "attributes": [], + "start":6,"end":12,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":8}}, "name": { "type": "JSXIdentifier", - "start": 7, - "end": 11, - "loc": { - "start": { - "line": 2, - "column": 3 - }, - "end": { - "line": 2, - "column": 7 - } - }, + "start":7,"end":11,"loc":{"start":{"line":2,"column":3},"end":{"line":2,"column":7}}, "name": "span" }, + "attributes": [], "selfClosing": false }, "closingElement": { "type": "JSXClosingElement", - "start": 22, - "end": 29, - "loc": { - "start": { - "line": 4, - "column": 2 - }, - "end": { - "line": 4, - "column": 9 - } - }, + "start":22,"end":29,"loc":{"start":{"line":4,"column":2},"end":{"line":4,"column":9}}, "name": { "type": "JSXIdentifier", - "start": 24, - "end": 28, - "loc": { - "start": { - "line": 4, - "column": 4 - }, - "end": { - "line": 4, - "column": 8 - } - }, + "start":24,"end":28,"loc":{"start":{"line":4,"column":4},"end":{"line":4,"column":8}}, "name": "span" } }, "children": [ { "type": "JSXText", - "start": 12, - "end": 22, - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 4, - "column": 2 - } - }, + "start":12,"end":22,"loc":{"start":{"line":2,"column":8},"end":{"line":4,"column":2}}, "extra": { "rawValue": "\n hi\n ", "raw": "\n hi\n " @@ -211,18 +68,7 @@ }, { "type": "JSXText", - "start": 29, - "end": 32, - "loc": { - "start": { - "line": 4, - "column": 9 - }, - "end": { - "line": 5, - "column": 2 - } - }, + "start":29,"end":32,"loc":{"start":{"line":4,"column":9},"end":{"line":5,"column":2}}, "extra": { "rawValue": "\n ", "raw": "\n " @@ -231,97 +77,31 @@ }, { "type": "JSXElement", - "start": 32, - "end": 46, - "loc": { - "start": { - "line": 5, - "column": 2 - }, - "end": { - "line": 5, - "column": 16 - } - }, + "start":32,"end":46,"loc":{"start":{"line":5,"column":2},"end":{"line":5,"column":16}}, "openingElement": { "type": "JSXOpeningElement", - "start": 32, - "end": 37, - "loc": { - "start": { - "line": 5, - "column": 2 - }, - "end": { - "line": 5, - "column": 7 - } - }, - "attributes": [], + "start":32,"end":37,"loc":{"start":{"line":5,"column":2},"end":{"line":5,"column":7}}, "name": { "type": "JSXIdentifier", - "start": 33, - "end": 36, - "loc": { - "start": { - "line": 5, - "column": 3 - }, - "end": { - "line": 5, - "column": 6 - } - }, + "start":33,"end":36,"loc":{"start":{"line":5,"column":3},"end":{"line":5,"column":6}}, "name": "div" }, + "attributes": [], "selfClosing": false }, "closingElement": { "type": "JSXClosingElement", - "start": 40, - "end": 46, - "loc": { - "start": { - "line": 5, - "column": 10 - }, - "end": { - "line": 5, - "column": 16 - } - }, + "start":40,"end":46,"loc":{"start":{"line":5,"column":10},"end":{"line":5,"column":16}}, "name": { "type": "JSXIdentifier", - "start": 42, - "end": 45, - "loc": { - "start": { - "line": 5, - "column": 12 - }, - "end": { - "line": 5, - "column": 15 - } - }, + "start":42,"end":45,"loc":{"start":{"line":5,"column":12},"end":{"line":5,"column":15}}, "name": "div" } }, "children": [ { "type": "JSXText", - "start": 37, - "end": 40, - "loc": { - "start": { - "line": 5, - "column": 7 - }, - "end": { - "line": 5, - "column": 10 - } - }, + "start":37,"end":40,"loc":{"start":{"line":5,"column":7},"end":{"line":5,"column":10}}, "extra": { "rawValue": "bye", "raw": "bye" @@ -332,18 +112,7 @@ }, { "type": "JSXText", - "start": 46, - "end": 47, - "loc": { - "start": { - "line": 5, - "column": 16 - }, - "end": { - "line": 6, - "column": 0 - } - }, + "start":46,"end":47,"loc":{"start":{"line":5,"column":16},"end":{"line":6,"column":0}}, "extra": { "rawValue": "\n", "raw": "\n" diff --git a/packages/babel-parser/test/fixtures/jsx/basic/fragment-4/output.json b/packages/babel-parser/test/fixtures/jsx/basic/fragment-4/output.json index f590db411348..1b8ec9dd3632 100644 --- a/packages/babel-parser/test/fixtures/jsx/basic/fragment-4/output.json +++ b/packages/babel-parser/test/fixtures/jsx/basic/fragment-4/output.json @@ -1,107 +1,30 @@ { "type": "File", - "start": 0, - "end": 49, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 7, - "column": 3 - } - }, + "start":0,"end":49,"loc":{"start":{"line":1,"column":0},"end":{"line":7,"column":3}}, "program": { "type": "Program", - "start": 0, - "end": 49, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 7, - "column": 3 - } - }, + "start":0,"end":49,"loc":{"start":{"line":1,"column":0},"end":{"line":7,"column":3}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 49, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 7, - "column": 3 - } - }, + "start":0,"end":49,"loc":{"start":{"line":1,"column":0},"end":{"line":7,"column":3}}, "expression": { "type": "JSXFragment", - "start": 0, - "end": 49, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 7, - "column": 3 - } - }, + "start":0,"end":49,"loc":{"start":{"line":1,"column":0},"end":{"line":7,"column":3}}, "openingFragment": { "type": "JSXOpeningFragment", - "start": 0, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 2 - } - } + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}} }, "closingFragment": { "type": "JSXClosingFragment", - "start": 46, - "end": 49, - "loc": { - "start": { - "line": 7, - "column": 0 - }, - "end": { - "line": 7, - "column": 3 - } - } + "start":46,"end":49,"loc":{"start":{"line":7,"column":0},"end":{"line":7,"column":3}} }, "children": [ { "type": "JSXText", - "start": 2, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 2, - "column": 2 - } - }, + "start":2,"end":5,"loc":{"start":{"line":1,"column":2},"end":{"line":2,"column":2}}, "extra": { "rawValue": "\n ", "raw": "\n " @@ -110,63 +33,19 @@ }, { "type": "JSXFragment", - "start": 5, - "end": 45, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 6, - "column": 5 - } - }, + "start":5,"end":45,"loc":{"start":{"line":2,"column":2},"end":{"line":6,"column":5}}, "openingFragment": { "type": "JSXOpeningFragment", - "start": 5, - "end": 7, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 4 - } - } + "start":5,"end":7,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":4}} }, "closingFragment": { "type": "JSXClosingFragment", - "start": 42, - "end": 45, - "loc": { - "start": { - "line": 6, - "column": 2 - }, - "end": { - "line": 6, - "column": 5 - } - } + "start":42,"end":45,"loc":{"start":{"line":6,"column":2},"end":{"line":6,"column":5}} }, "children": [ { "type": "JSXText", - "start": 7, - "end": 12, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 3, - "column": 4 - } - }, + "start":7,"end":12,"loc":{"start":{"line":2,"column":4},"end":{"line":3,"column":4}}, "extra": { "rawValue": "\n ", "raw": "\n " @@ -175,63 +54,19 @@ }, { "type": "JSXFragment", - "start": 12, - "end": 39, - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 5, - "column": 7 - } - }, + "start":12,"end":39,"loc":{"start":{"line":3,"column":4},"end":{"line":5,"column":7}}, "openingFragment": { "type": "JSXOpeningFragment", - "start": 12, - "end": 14, - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 6 - } - } + "start":12,"end":14,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":6}} }, "closingFragment": { "type": "JSXClosingFragment", - "start": 36, - "end": 39, - "loc": { - "start": { - "line": 5, - "column": 4 - }, - "end": { - "line": 5, - "column": 7 - } - } + "start":36,"end":39,"loc":{"start":{"line":5,"column":4},"end":{"line":5,"column":7}} }, "children": [ { "type": "JSXText", - "start": 14, - "end": 36, - "loc": { - "start": { - "line": 3, - "column": 6 - }, - "end": { - "line": 5, - "column": 4 - } - }, + "start":14,"end":36,"loc":{"start":{"line":3,"column":6},"end":{"line":5,"column":4}}, "extra": { "rawValue": "\n super deep\n ", "raw": "\n super deep\n " @@ -242,18 +77,7 @@ }, { "type": "JSXText", - "start": 39, - "end": 42, - "loc": { - "start": { - "line": 5, - "column": 7 - }, - "end": { - "line": 6, - "column": 2 - } - }, + "start":39,"end":42,"loc":{"start":{"line":5,"column":7},"end":{"line":6,"column":2}}, "extra": { "rawValue": "\n ", "raw": "\n " @@ -264,18 +88,7 @@ }, { "type": "JSXText", - "start": 45, - "end": 46, - "loc": { - "start": { - "line": 6, - "column": 5 - }, - "end": { - "line": 7, - "column": 0 - } - }, + "start":45,"end":46,"loc":{"start":{"line":6,"column":5},"end":{"line":7,"column":0}}, "extra": { "rawValue": "\n", "raw": "\n" diff --git a/packages/babel-parser/test/fixtures/jsx/basic/fragment-5/output.json b/packages/babel-parser/test/fixtures/jsx/basic/fragment-5/output.json index c1d60cb1be69..161d3dcb81b3 100644 --- a/packages/babel-parser/test/fixtures/jsx/basic/fragment-5/output.json +++ b/packages/babel-parser/test/fixtures/jsx/basic/fragment-5/output.json @@ -1,141 +1,42 @@ { "type": "File", - "start": 0, - "end": 62, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 7, - "column": 3 - } - }, + "start":0,"end":62,"loc":{"start":{"line":1,"column":0},"end":{"line":7,"column":3}}, "program": { "type": "Program", - "start": 0, - "end": 62, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 7, - "column": 3 - } - }, + "start":0,"end":62,"loc":{"start":{"line":1,"column":0},"end":{"line":7,"column":3}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 62, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 7, - "column": 3 - } - }, + "start":0,"end":62,"loc":{"start":{"line":1,"column":0},"end":{"line":7,"column":3}}, "expression": { "type": "JSXFragment", - "start": 0, - "end": 62, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 7, - "column": 3 - } - }, + "start":0,"end":62,"loc":{"start":{"line":1,"column":0},"end":{"line":7,"column":3}}, "openingFragment": { "type": "JSXOpeningFragment", - "start": 0, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, "innerComments": [ { "type": "CommentLine", "value": " comment1", - "start": 2, - "end": 13, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 11 - } - } + "start":2,"end":13,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":11}} }, { "type": "CommentBlock", "value": " comment2 ", - "start": 14, - "end": 28, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 14 - } - } + "start":14,"end":28,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":14}} } ] }, "closingFragment": { "type": "JSXClosingFragment", - "start": 59, - "end": 62, - "loc": { - "start": { - "line": 7, - "column": 0 - }, - "end": { - "line": 7, - "column": 3 - } - } + "start":59,"end":62,"loc":{"start":{"line":7,"column":0},"end":{"line":7,"column":3}} }, "children": [ { "type": "JSXText", - "start": 30, - "end": 33, - "loc": { - "start": { - "line": 4, - "column": 1 - }, - "end": { - "line": 5, - "column": 2 - } - }, + "start":30,"end":33,"loc":{"start":{"line":4,"column":1},"end":{"line":5,"column":2}}, "extra": { "rawValue": "\n ", "raw": "\n " @@ -144,79 +45,24 @@ }, { "type": "JSXElement", - "start": 33, - "end": 44, - "loc": { - "start": { - "line": 5, - "column": 2 - }, - "end": { - "line": 5, - "column": 13 - } - }, + "start":33,"end":44,"loc":{"start":{"line":5,"column":2},"end":{"line":5,"column":13}}, "openingElement": { "type": "JSXOpeningElement", - "start": 33, - "end": 38, - "loc": { - "start": { - "line": 5, - "column": 2 - }, - "end": { - "line": 5, - "column": 7 - } - }, - "attributes": [], + "start":33,"end":38,"loc":{"start":{"line":5,"column":2},"end":{"line":5,"column":7}}, "name": { "type": "JSXIdentifier", - "start": 34, - "end": 37, - "loc": { - "start": { - "line": 5, - "column": 3 - }, - "end": { - "line": 5, - "column": 6 - } - }, + "start":34,"end":37,"loc":{"start":{"line":5,"column":3},"end":{"line":5,"column":6}}, "name": "div" }, + "attributes": [], "selfClosing": false }, "closingElement": { "type": "JSXClosingElement", - "start": 38, - "end": 44, - "loc": { - "start": { - "line": 5, - "column": 7 - }, - "end": { - "line": 5, - "column": 13 - } - }, + "start":38,"end":44,"loc":{"start":{"line":5,"column":7},"end":{"line":5,"column":13}}, "name": { "type": "JSXIdentifier", - "start": 40, - "end": 43, - "loc": { - "start": { - "line": 5, - "column": 9 - }, - "end": { - "line": 5, - "column": 12 - } - }, + "start":40,"end":43,"loc":{"start":{"line":5,"column":9},"end":{"line":5,"column":12}}, "name": "div" } }, @@ -224,18 +70,7 @@ }, { "type": "JSXText", - "start": 44, - "end": 47, - "loc": { - "start": { - "line": 5, - "column": 13 - }, - "end": { - "line": 6, - "column": 2 - } - }, + "start":44,"end":47,"loc":{"start":{"line":5,"column":13},"end":{"line":6,"column":2}}, "extra": { "rawValue": "\n ", "raw": "\n " @@ -244,79 +79,24 @@ }, { "type": "JSXElement", - "start": 47, - "end": 58, - "loc": { - "start": { - "line": 6, - "column": 2 - }, - "end": { - "line": 6, - "column": 13 - } - }, + "start":47,"end":58,"loc":{"start":{"line":6,"column":2},"end":{"line":6,"column":13}}, "openingElement": { "type": "JSXOpeningElement", - "start": 47, - "end": 52, - "loc": { - "start": { - "line": 6, - "column": 2 - }, - "end": { - "line": 6, - "column": 7 - } - }, - "attributes": [], + "start":47,"end":52,"loc":{"start":{"line":6,"column":2},"end":{"line":6,"column":7}}, "name": { "type": "JSXIdentifier", - "start": 48, - "end": 51, - "loc": { - "start": { - "line": 6, - "column": 3 - }, - "end": { - "line": 6, - "column": 6 - } - }, + "start":48,"end":51,"loc":{"start":{"line":6,"column":3},"end":{"line":6,"column":6}}, "name": "div" }, + "attributes": [], "selfClosing": false }, "closingElement": { "type": "JSXClosingElement", - "start": 52, - "end": 58, - "loc": { - "start": { - "line": 6, - "column": 7 - }, - "end": { - "line": 6, - "column": 13 - } - }, + "start":52,"end":58,"loc":{"start":{"line":6,"column":7},"end":{"line":6,"column":13}}, "name": { "type": "JSXIdentifier", - "start": 54, - "end": 57, - "loc": { - "start": { - "line": 6, - "column": 9 - }, - "end": { - "line": 6, - "column": 12 - } - }, + "start":54,"end":57,"loc":{"start":{"line":6,"column":9},"end":{"line":6,"column":12}}, "name": "div" } }, @@ -324,18 +104,7 @@ }, { "type": "JSXText", - "start": 58, - "end": 59, - "loc": { - "start": { - "line": 6, - "column": 13 - }, - "end": { - "line": 7, - "column": 0 - } - }, + "start":58,"end":59,"loc":{"start":{"line":6,"column":13},"end":{"line":7,"column":0}}, "extra": { "rawValue": "\n", "raw": "\n" @@ -352,34 +121,12 @@ { "type": "CommentLine", "value": " comment1", - "start": 2, - "end": 13, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 11 - } - } + "start":2,"end":13,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":11}} }, { "type": "CommentBlock", "value": " comment2 ", - "start": 14, - "end": 28, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 14 - } - } + "start":14,"end":28,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":14}} } ] } \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/jsx/basic/fragment-6/output.json b/packages/babel-parser/test/fixtures/jsx/basic/fragment-6/output.json index c5a33e2bb680..00c80d5af722 100644 --- a/packages/babel-parser/test/fixtures/jsx/basic/fragment-6/output.json +++ b/packages/babel-parser/test/fixtures/jsx/basic/fragment-6/output.json @@ -1,186 +1,54 @@ { "type": "File", - "start": 0, - "end": 59, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 59 - } - }, + "start":0,"end":59,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":59}}, "program": { "type": "Program", - "start": 0, - "end": 59, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 59 - } - }, + "start":0,"end":59,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":59}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 59, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 59 - } - }, + "start":0,"end":59,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":59}}, "expression": { "type": "JSXFragment", - "start": 0, - "end": 59, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 59 - } - }, + "start":0,"end":59,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":59}}, "openingFragment": { "type": "JSXOpeningFragment", - "start": 0, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 2 - } - } + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}} }, "closingFragment": { "type": "JSXClosingFragment", - "start": 56, - "end": 59, - "loc": { - "start": { - "line": 1, - "column": 56 - }, - "end": { - "line": 1, - "column": 59 - } - } + "start":56,"end":59,"loc":{"start":{"line":1,"column":56},"end":{"line":1,"column":59}} }, "children": [ { "type": "JSXElement", - "start": 2, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":2,"end":23,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":23}}, "openingElement": { "type": "JSXOpeningElement", - "start": 2, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "attributes": [], + "start":2,"end":7,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":7}}, "name": { "type": "JSXIdentifier", - "start": 3, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":3,"end":6,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":6}}, "name": "div" }, + "attributes": [], "selfClosing": false }, "closingElement": { "type": "JSXClosingElement", - "start": 17, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":17,"end":23,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":23}}, "name": { "type": "JSXIdentifier", - "start": 19, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":19,"end":22,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":22}}, "name": "div" } }, "children": [ { "type": "JSXText", - "start": 7, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":7,"end":17,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":17}}, "extra": { "rawValue": "JSXElement", "raw": "JSXElement" @@ -191,18 +59,7 @@ }, { "type": "JSXText", - "start": 23, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":23,"end":30,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":30}}, "extra": { "rawValue": "JSXText", "raw": "JSXText" @@ -211,32 +68,10 @@ }, { "type": "JSXExpressionContainer", - "start": 30, - "end": 56, - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 1, - "column": 56 - } - }, + "start":30,"end":56,"loc":{"start":{"line":1,"column":30},"end":{"line":1,"column":56}}, "expression": { "type": "StringLiteral", - "start": 31, - "end": 55, - "loc": { - "start": { - "line": 1, - "column": 31 - }, - "end": { - "line": 1, - "column": 55 - } - }, + "start":31,"end":55,"loc":{"start":{"line":1,"column":31},"end":{"line":1,"column":55}}, "extra": { "rawValue": "JSXExpressionContainer", "raw": "'JSXExpressionContainer'" diff --git a/packages/babel-parser/test/fixtures/jsx/basic/keyword-tag/output.json b/packages/babel-parser/test/fixtures/jsx/basic/keyword-tag/output.json index b5eae7fc0655..e8b60debcc63 100644 --- a/packages/babel-parser/test/fixtures/jsx/basic/keyword-tag/output.json +++ b/packages/babel-parser/test/fixtures/jsx/basic/keyword-tag/output.json @@ -1,123 +1,35 @@ { "type": "File", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, "program": { "type": "Program", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, "expression": { "type": "JSXElement", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "openingElement": { "type": "JSXOpeningElement", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "attributes": [], + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "name": { "type": "JSXIdentifier", - "start": 1, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 4 - } - }, + "start":1,"end":4,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":4}}, "name": "var" }, + "attributes": [], "selfClosing": false }, "closingElement": { "type": "JSXClosingElement", - "start": 5, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":5,"end":11,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":11}}, "name": { "type": "JSXIdentifier", - "start": 7, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":7,"end":10,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":10}}, "name": "var" } }, diff --git a/packages/babel-parser/test/fixtures/jsx/basic/namespace-tag/output.json b/packages/babel-parser/test/fixtures/jsx/basic/namespace-tag/output.json index be21c68891bb..4ab9e3b82d16 100644 --- a/packages/babel-parser/test/fixtures/jsx/basic/namespace-tag/output.json +++ b/packages/babel-parser/test/fixtures/jsx/basic/namespace-tag/output.json @@ -1,124 +1,36 @@ { "type": "File", - "start": 0, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 19 - } - }, + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":19}}, "program": { "type": "Program", - "start": 0, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 19 - } - }, + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":19}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, "expression": { "type": "JSXElement", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "openingElement": { "type": "JSXOpeningElement", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "attributes": [], + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "name": { "type": "JSXNamespacedName", - "start": 1, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":1,"end":8,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":8}}, "namespace": { "type": "JSXIdentifier", - "start": 1, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 4 - } - }, + "start":1,"end":4,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":4}}, "name": "Foo" }, "name": { "type": "JSXIdentifier", - "start": 5, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":5,"end":8,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":8}}, "name": "Bar" } }, + "attributes": [], "selfClosing": true }, "closingElement": null, @@ -127,154 +39,44 @@ }, { "type": "ExpressionStatement", - "start": 13, - "end": 32, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 19 - } - }, + "start":13,"end":32,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":19}}, "expression": { "type": "JSXElement", - "start": 13, - "end": 32, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 19 - } - }, + "start":13,"end":32,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":19}}, "openingElement": { "type": "JSXOpeningElement", - "start": 13, - "end": 22, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 9 - } - }, - "attributes": [], + "start":13,"end":22,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":9}}, "name": { "type": "JSXNamespacedName", - "start": 14, - "end": 21, - "loc": { - "start": { - "line": 2, - "column": 1 - }, - "end": { - "line": 2, - "column": 8 - } - }, + "start":14,"end":21,"loc":{"start":{"line":2,"column":1},"end":{"line":2,"column":8}}, "namespace": { "type": "JSXIdentifier", - "start": 14, - "end": 17, - "loc": { - "start": { - "line": 2, - "column": 1 - }, - "end": { - "line": 2, - "column": 4 - } - }, + "start":14,"end":17,"loc":{"start":{"line":2,"column":1},"end":{"line":2,"column":4}}, "name": "Foo" }, "name": { "type": "JSXIdentifier", - "start": 18, - "end": 21, - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 8 - } - }, + "start":18,"end":21,"loc":{"start":{"line":2,"column":5},"end":{"line":2,"column":8}}, "name": "Bar" } }, + "attributes": [], "selfClosing": false }, "closingElement": { "type": "JSXClosingElement", - "start": 22, - "end": 32, - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 19 - } - }, + "start":22,"end":32,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":19}}, "name": { "type": "JSXNamespacedName", - "start": 24, - "end": 31, - "loc": { - "start": { - "line": 2, - "column": 11 - }, - "end": { - "line": 2, - "column": 18 - } - }, + "start":24,"end":31,"loc":{"start":{"line":2,"column":11},"end":{"line":2,"column":18}}, "namespace": { "type": "JSXIdentifier", - "start": 24, - "end": 27, - "loc": { - "start": { - "line": 2, - "column": 11 - }, - "end": { - "line": 2, - "column": 14 - } - }, + "start":24,"end":27,"loc":{"start":{"line":2,"column":11},"end":{"line":2,"column":14}}, "name": "Foo" }, "name": { "type": "JSXIdentifier", - "start": 28, - "end": 31, - "loc": { - "start": { - "line": 2, - "column": 15 - }, - "end": { - "line": 2, - "column": 18 - } - }, + "start":28,"end":31,"loc":{"start":{"line":2,"column":15},"end":{"line":2,"column":18}}, "name": "Bar" } } diff --git a/packages/babel-parser/test/fixtures/jsx/basic/nonentity-decimal/output.json b/packages/babel-parser/test/fixtures/jsx/basic/nonentity-decimal/output.json index b759f48d2692..677636892573 100644 --- a/packages/babel-parser/test/fixtures/jsx/basic/nonentity-decimal/output.json +++ b/packages/babel-parser/test/fixtures/jsx/basic/nonentity-decimal/output.json @@ -1,141 +1,42 @@ { "type": "File", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "program": { "type": "Program", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "expression": { "type": "JSXElement", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "openingElement": { "type": "JSXOpeningElement", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, - "attributes": [], + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, "name": { "type": "JSXIdentifier", - "start": 1, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - } - }, + "start":1,"end":2,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":2}}, "name": "A" }, + "attributes": [], "selfClosing": false }, "closingElement": { "type": "JSXClosingElement", - "start": 11, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":11,"end":15,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":15}}, "name": { "type": "JSXIdentifier", - "start": 13, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":13,"end":14,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":14}}, "name": "A" } }, "children": [ { "type": "JSXText", - "start": 3, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":3,"end":11,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":11}}, "extra": { "rawValue": "f4a9;", "raw": "f4a9;" diff --git a/packages/babel-parser/test/fixtures/jsx/basic/nonentity/output.json b/packages/babel-parser/test/fixtures/jsx/basic/nonentity/output.json index fc694e099dd8..bf5d832829f6 100644 --- a/packages/babel-parser/test/fixtures/jsx/basic/nonentity/output.json +++ b/packages/babel-parser/test/fixtures/jsx/basic/nonentity/output.json @@ -1,141 +1,42 @@ { "type": "File", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "program": { "type": "Program", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "expression": { "type": "JSXElement", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "openingElement": { "type": "JSXOpeningElement", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, - "attributes": [], + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, "name": { "type": "JSXIdentifier", - "start": 1, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - } - }, + "start":1,"end":2,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":2}}, "name": "A" }, + "attributes": [], "selfClosing": false }, "closingElement": { "type": "JSXClosingElement", - "start": 12, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":12,"end":16,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":16}}, "name": { "type": "JSXIdentifier", - "start": 14, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":14,"end":15,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":15}}, "name": "A" } }, "children": [ { "type": "JSXText", - "start": 3, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":3,"end":12,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":12}}, "extra": { "rawValue": "g4q9;", "raw": "g4q9;" diff --git a/packages/babel-parser/test/fixtures/jsx/basic/yield-tag/output.json b/packages/babel-parser/test/fixtures/jsx/basic/yield-tag/output.json index 4b7a168fcbe7..02bc04d35af4 100644 --- a/packages/babel-parser/test/fixtures/jsx/basic/yield-tag/output.json +++ b/packages/babel-parser/test/fixtures/jsx/basic/yield-tag/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "id": { "type": "Identifier", - "start": 9, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "it" - }, + "start":9,"end":11,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":11},"identifierName":"it"}, "name": "it" }, "generator": true, @@ -65,123 +20,35 @@ "params": [], "body": { "type": "BlockStatement", - "start": 13, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":13,"end":35,"loc":{"start":{"line":1,"column":13},"end":{"line":3,"column":1}}, "body": [ { "type": "ExpressionStatement", - "start": 19, - "end": 33, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 18 - } - }, + "start":19,"end":33,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":18}}, "expression": { "type": "YieldExpression", - "start": 19, - "end": 32, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 17 - } - }, + "start":19,"end":32,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":17}}, "delegate": false, "argument": { "type": "JSXElement", - "start": 25, - "end": 32, - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 17 - } - }, + "start":25,"end":32,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":17}}, "openingElement": { "type": "JSXOpeningElement", - "start": 25, - "end": 28, - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 13 - } - }, - "attributes": [], + "start":25,"end":28,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":13}}, "name": { "type": "JSXIdentifier", - "start": 26, - "end": 27, - "loc": { - "start": { - "line": 2, - "column": 11 - }, - "end": { - "line": 2, - "column": 12 - } - }, + "start":26,"end":27,"loc":{"start":{"line":2,"column":11},"end":{"line":2,"column":12}}, "name": "a" }, + "attributes": [], "selfClosing": false }, "closingElement": { "type": "JSXClosingElement", - "start": 28, - "end": 32, - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 17 - } - }, + "start":28,"end":32,"loc":{"start":{"line":2,"column":13},"end":{"line":2,"column":17}}, "name": { "type": "JSXIdentifier", - "start": 30, - "end": 31, - "loc": { - "start": { - "line": 2, - "column": 15 - }, - "end": { - "line": 2, - "column": 16 - } - }, + "start":30,"end":31,"loc":{"start":{"line":2,"column":15},"end":{"line":2,"column":16}}, "name": "a" } }, diff --git a/packages/babel-parser/test/fixtures/jsx/errors/attribute-empty-expression/options.json b/packages/babel-parser/test/fixtures/jsx/errors/attribute-empty-expression/options.json deleted file mode 100644 index d5960e11a308..000000000000 --- a/packages/babel-parser/test/fixtures/jsx/errors/attribute-empty-expression/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "JSX attributes must only be assigned a non-empty expression (1:9)" -} diff --git a/packages/babel-parser/test/fixtures/jsx/errors/attribute-empty-expression/output.json b/packages/babel-parser/test/fixtures/jsx/errors/attribute-empty-expression/output.json new file mode 100644 index 000000000000..404503d8655f --- /dev/null +++ b/packages/babel-parser/test/fixtures/jsx/errors/attribute-empty-expression/output.json @@ -0,0 +1,55 @@ +{ + "type": "File", + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, + "errors": [ + "SyntaxError: JSX attributes must only be assigned a non-empty expression (1:9)" + ], + "program": { + "type": "Program", + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, + "expression": { + "type": "JSXElement", + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, + "openingElement": { + "type": "JSXOpeningElement", + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, + "name": { + "type": "JSXIdentifier", + "start":1,"end":4,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":4}}, + "name": "foo" + }, + "attributes": [ + { + "type": "JSXAttribute", + "start":5,"end":11,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":11}}, + "name": { + "type": "JSXIdentifier", + "start":5,"end":8,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":8}}, + "name": "bar" + }, + "value": { + "type": "JSXExpressionContainer", + "start":9,"end":11,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":11}}, + "expression": { + "type": "JSXEmptyExpression", + "start":10,"end":10,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":10}} + } + } + } + ], + "selfClosing": true + }, + "closingElement": null, + "children": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/jsx/errors/html-comment/output.json b/packages/babel-parser/test/fixtures/jsx/errors/html-comment/output.json index cf95c18b54b5..a47ee63bb988 100644 --- a/packages/babel-parser/test/fixtures/jsx/errors/html-comment/output.json +++ b/packages/babel-parser/test/fixtures/jsx/errors/html-comment/output.json @@ -1,31 +1,9 @@ { "type": "File", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "program": { "type": "Program", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "sourceType": "script", "interpreter": null, "body": [], @@ -34,18 +12,7 @@ { "type": "CommentLine", "value": "a", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - } + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}} } ] }, @@ -53,18 +20,7 @@ { "type": "CommentLine", "value": "a", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - } + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}} } ] } \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/jsx/errors/member-in-namespace-1/input.js b/packages/babel-parser/test/fixtures/jsx/errors/member-in-namespace-1/input.js new file mode 100644 index 000000000000..abb989b65a36 --- /dev/null +++ b/packages/babel-parser/test/fixtures/jsx/errors/member-in-namespace-1/input.js @@ -0,0 +1 @@ + diff --git a/packages/babel-parser/test/fixtures/jsx/errors/member-in-namespace-1/options.json b/packages/babel-parser/test/fixtures/jsx/errors/member-in-namespace-1/options.json new file mode 100644 index 000000000000..27a7b64d71d4 --- /dev/null +++ b/packages/babel-parser/test/fixtures/jsx/errors/member-in-namespace-1/options.json @@ -0,0 +1,3 @@ +{ + "throws": "Unexpected token (1:4)" +} diff --git a/packages/babel-parser/test/fixtures/jsx/errors/member-in-namespace-2/input.js b/packages/babel-parser/test/fixtures/jsx/errors/member-in-namespace-2/input.js new file mode 100644 index 000000000000..fc13a07cc754 --- /dev/null +++ b/packages/babel-parser/test/fixtures/jsx/errors/member-in-namespace-2/input.js @@ -0,0 +1 @@ + diff --git a/packages/babel-parser/test/fixtures/jsx/errors/member-in-namespace-2/options.json b/packages/babel-parser/test/fixtures/jsx/errors/member-in-namespace-2/options.json new file mode 100644 index 000000000000..27a7b64d71d4 --- /dev/null +++ b/packages/babel-parser/test/fixtures/jsx/errors/member-in-namespace-2/options.json @@ -0,0 +1,3 @@ +{ + "throws": "Unexpected token (1:4)" +} diff --git a/packages/babel-parser/test/fixtures/jsx/errors/wrong-closing-tag-fragment/options.json b/packages/babel-parser/test/fixtures/jsx/errors/wrong-closing-tag-fragment/options.json deleted file mode 100644 index 4ca478c5b41f..000000000000 --- a/packages/babel-parser/test/fixtures/jsx/errors/wrong-closing-tag-fragment/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Expected corresponding JSX closing tag for <> (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/jsx/errors/wrong-closing-tag-fragment/output.json b/packages/babel-parser/test/fixtures/jsx/errors/wrong-closing-tag-fragment/output.json new file mode 100644 index 000000000000..d70e7d0fc17c --- /dev/null +++ b/packages/babel-parser/test/fixtures/jsx/errors/wrong-closing-tag-fragment/output.json @@ -0,0 +1,38 @@ +{ + "type": "File", + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, + "errors": [ + "SyntaxError: Expected corresponding JSX closing tag for <> (1:2)" + ], + "program": { + "type": "Program", + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, + "expression": { + "type": "JSXFragment", + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, + "openingFragment": { + "type": "JSXOpeningFragment", + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}} + }, + "closingFragment": { + "type": "JSXClosingElement", + "start":2,"end":14,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":14}}, + "name": { + "type": "JSXIdentifier", + "start":4,"end":13,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":13}}, + "name": "something" + } + }, + "children": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/jsx/errors/wrong-closing-tag/options.json b/packages/babel-parser/test/fixtures/jsx/errors/wrong-closing-tag/options.json deleted file mode 100644 index f3afda9ee91d..000000000000 --- a/packages/babel-parser/test/fixtures/jsx/errors/wrong-closing-tag/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Expected corresponding JSX closing tag for (1:5)" -} diff --git a/packages/babel-parser/test/fixtures/jsx/errors/wrong-closing-tag/output.json b/packages/babel-parser/test/fixtures/jsx/errors/wrong-closing-tag/output.json new file mode 100644 index 000000000000..54ddb9bae05b --- /dev/null +++ b/packages/babel-parser/test/fixtures/jsx/errors/wrong-closing-tag/output.json @@ -0,0 +1,45 @@ +{ + "type": "File", + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "errors": [ + "SyntaxError: Expected corresponding JSX closing tag for (1:5)" + ], + "program": { + "type": "Program", + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "expression": { + "type": "JSXElement", + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "openingElement": { + "type": "JSXOpeningElement", + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, + "name": { + "type": "JSXIdentifier", + "start":1,"end":4,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":4}}, + "name": "Foo" + }, + "attributes": [], + "selfClosing": false + }, + "closingElement": { + "type": "JSXClosingElement", + "start":5,"end":11,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":11}}, + "name": { + "type": "JSXIdentifier", + "start":7,"end":10,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":10}}, + "name": "Bar" + } + }, + "children": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/jsx/errors/wrong-opening-tag-fragment/options.json b/packages/babel-parser/test/fixtures/jsx/errors/wrong-opening-tag-fragment/options.json deleted file mode 100644 index 25d9465b06be..000000000000 --- a/packages/babel-parser/test/fixtures/jsx/errors/wrong-opening-tag-fragment/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Expected corresponding JSX closing tag for (1:11)" -} diff --git a/packages/babel-parser/test/fixtures/jsx/errors/wrong-opening-tag-fragment/output.json b/packages/babel-parser/test/fixtures/jsx/errors/wrong-opening-tag-fragment/output.json new file mode 100644 index 000000000000..a5d5ef8d53f4 --- /dev/null +++ b/packages/babel-parser/test/fixtures/jsx/errors/wrong-opening-tag-fragment/output.json @@ -0,0 +1,40 @@ +{ + "type": "File", + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, + "errors": [ + "SyntaxError: Expected corresponding JSX closing tag for (1:11)" + ], + "program": { + "type": "Program", + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, + "expression": { + "type": "JSXElement", + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, + "openingElement": { + "type": "JSXOpeningElement", + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "name": { + "type": "JSXIdentifier", + "start":1,"end":10,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":10}}, + "name": "something" + }, + "attributes": [], + "selfClosing": false + }, + "closingElement": { + "type": "JSXClosingFragment", + "start":11,"end":14,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":14}} + }, + "children": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/jsx/regression/1/output.json b/packages/babel-parser/test/fixtures/jsx/regression/1/output.json index bc8730300dda..bdb2bc10538c 100644 --- a/packages/babel-parser/test/fixtures/jsx/regression/1/output.json +++ b/packages/babel-parser/test/fixtures/jsx/regression/1/output.json @@ -1,141 +1,42 @@ { "type": "File", - "start": 0, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 40 - } - }, + "start":0,"end":40,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":40}}, "program": { "type": "Program", - "start": 0, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 40 - } - }, + "start":0,"end":40,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":40}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 40 - } - }, + "start":0,"end":40,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":40}}, "expression": { "type": "JSXElement", - "start": 0, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":38}}, "openingElement": { "type": "JSXOpeningElement", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, - "attributes": [], + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, "name": { "type": "JSXIdentifier", - "start": 1, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - } - }, + "start":1,"end":2,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":2}}, "name": "p" }, + "attributes": [], "selfClosing": false }, "closingElement": { "type": "JSXClosingElement", - "start": 34, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 34 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":34,"end":38,"loc":{"start":{"line":1,"column":34},"end":{"line":1,"column":38}}, "name": { "type": "JSXIdentifier", - "start": 36, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 36 - }, - "end": { - "line": 1, - "column": 37 - } - }, + "start":36,"end":37,"loc":{"start":{"line":1,"column":36},"end":{"line":1,"column":37}}, "name": "p" } }, "children": [ { "type": "JSXText", - "start": 3, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":3,"end":7,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":7}}, "extra": { "rawValue": "foo ", "raw": "foo " @@ -144,77 +45,27 @@ }, { "type": "JSXElement", - "start": 7, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":7,"end":30,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":30}}, "openingElement": { "type": "JSXOpeningElement", - "start": 7, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 22 - } + "start":7,"end":22,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":22}}, + "name": { + "type": "JSXIdentifier", + "start":8,"end":9,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":9}}, + "name": "a" }, "attributes": [ { "type": "JSXAttribute", - "start": 10, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":10,"end":21,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":21}}, "name": { "type": "JSXIdentifier", - "start": 10, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":10,"end":14,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":14}}, "name": "href" }, "value": { "type": "StringLiteral", - "start": 15, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":15,"end":21,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":21}}, "extra": { "rawValue": "test", "raw": "\"test\"" @@ -223,70 +74,21 @@ } } ], - "name": { - "type": "JSXIdentifier", - "start": 8, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "name": "a" - }, "selfClosing": false }, "closingElement": { "type": "JSXClosingElement", - "start": 26, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":26,"end":30,"loc":{"start":{"line":1,"column":26},"end":{"line":1,"column":30}}, "name": { "type": "JSXIdentifier", - "start": 28, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":28,"end":29,"loc":{"start":{"line":1,"column":28},"end":{"line":1,"column":29}}, "name": "a" } }, "children": [ { "type": "JSXText", - "start": 22, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":22,"end":26,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":26}}, "extra": { "rawValue": " bar", "raw": " bar" @@ -297,18 +99,7 @@ }, { "type": "JSXText", - "start": 30, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":30,"end":34,"loc":{"start":{"line":1,"column":30},"end":{"line":1,"column":34}}, "extra": { "rawValue": " baz", "raw": " baz" diff --git a/packages/babel-parser/test/fixtures/jsx/regression/2/output.json b/packages/babel-parser/test/fixtures/jsx/regression/2/output.json index 9445bee4ea00..d32da25e6786 100644 --- a/packages/babel-parser/test/fixtures/jsx/regression/2/output.json +++ b/packages/babel-parser/test/fixtures/jsx/regression/2/output.json @@ -1,219 +1,64 @@ { "type": "File", - "start": 0, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, "program": { "type": "Program", - "start": 0, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, "expression": { "type": "JSXElement", - "start": 0, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, "openingElement": { "type": "JSXOpeningElement", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "attributes": [], + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "name": { "type": "JSXIdentifier", - "start": 1, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 4 - } - }, + "start":1,"end":4,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":4}}, "name": "div" }, + "attributes": [], "selfClosing": false }, "closingElement": { "type": "JSXClosingElement", - "start": 24, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":24,"end":30,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":30}}, "name": { "type": "JSXIdentifier", - "start": 26, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":26,"end":29,"loc":{"start":{"line":1,"column":26},"end":{"line":1,"column":29}}, "name": "div" } }, "children": [ { "type": "JSXExpressionContainer", - "start": 5, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":5,"end":24,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":24}}, "expression": { "type": "JSXElement", - "start": 6, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":6,"end":23,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":23}}, "openingElement": { "type": "JSXOpeningElement", - "start": 6, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 23 - } + "start":6,"end":23,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":23}}, + "name": { + "type": "JSXIdentifier", + "start":7,"end":10,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":10}}, + "name": "div" }, "attributes": [ { "type": "JSXSpreadAttribute", - "start": 11, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":11,"end":20,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":20}}, "argument": { "type": "Identifier", - "start": 15, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 19 - }, - "identifierName": "test" - }, + "start":15,"end":19,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":19},"identifierName":"test"}, "name": "test" } } ], - "name": { - "type": "JSXIdentifier", - "start": 7, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "name": "div" - }, "selfClosing": true }, "closingElement": null, diff --git a/packages/babel-parser/test/fixtures/jsx/regression/3/output.json b/packages/babel-parser/test/fixtures/jsx/regression/3/output.json index 80bc377df5ee..74552206a932 100644 --- a/packages/babel-parser/test/fixtures/jsx/regression/3/output.json +++ b/packages/babel-parser/test/fixtures/jsx/regression/3/output.json @@ -1,205 +1,60 @@ { "type": "File", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, "program": { "type": "Program", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, "expression": { "type": "JSXElement", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, "openingElement": { "type": "JSXOpeningElement", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "attributes": [], + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "name": { "type": "JSXIdentifier", - "start": 1, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 4 - } - }, + "start":1,"end":4,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":4}}, "name": "div" }, + "attributes": [], "selfClosing": false }, "closingElement": { "type": "JSXClosingElement", - "start": 12, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":12,"end":18,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":18}}, "name": { "type": "JSXIdentifier", - "start": 14, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":14,"end":17,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":17}}, "name": "div" } }, "children": [ { "type": "JSXExpressionContainer", - "start": 5, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":5,"end":12,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":12}}, "expression": { "type": "ObjectExpression", - "start": 7, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":7,"end":10,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":10}}, "properties": [ { "type": "ObjectProperty", - "start": 8, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":8,"end":9,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":9}}, "method": false, "key": { "type": "Identifier", - "start": 8, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "a" - }, + "start":8,"end":9,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":9},"identifierName":"a"}, "name": "a" }, "computed": false, "shorthand": true, "value": { "type": "Identifier", - "start": 8, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "a" - }, + "start":8,"end":9,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":9},"identifierName":"a"}, "name": "a" }, "extra": { diff --git a/packages/babel-parser/test/fixtures/jsx/regression/4/output.json b/packages/babel-parser/test/fixtures/jsx/regression/4/output.json index 15e5a1a862d1..de8ce5791dc2 100644 --- a/packages/babel-parser/test/fixtures/jsx/regression/4/output.json +++ b/packages/babel-parser/test/fixtures/jsx/regression/4/output.json @@ -1,141 +1,42 @@ { "type": "File", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "program": { "type": "Program", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "expression": { "type": "JSXElement", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "openingElement": { "type": "JSXOpeningElement", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "attributes": [], + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "name": { "type": "JSXIdentifier", - "start": 1, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 4 - } - }, + "start":1,"end":4,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":4}}, "name": "div" }, + "attributes": [], "selfClosing": false }, "closingElement": { "type": "JSXClosingElement", - "start": 10, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":10,"end":16,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":16}}, "name": { "type": "JSXIdentifier", - "start": 12, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":12,"end":15,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":15}}, "name": "div" } }, "children": [ { "type": "JSXText", - "start": 5, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":5,"end":10,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":10}}, "extra": { "rawValue": "/text", "raw": "/text" diff --git a/packages/babel-parser/test/fixtures/jsx/regression/5/output.json b/packages/babel-parser/test/fixtures/jsx/regression/5/output.json index 54bfbadc9d57..07b4719ab585 100644 --- a/packages/babel-parser/test/fixtures/jsx/regression/5/output.json +++ b/packages/babel-parser/test/fixtures/jsx/regression/5/output.json @@ -1,188 +1,54 @@ { "type": "File", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "program": { "type": "Program", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "expression": { "type": "JSXElement", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "openingElement": { "type": "JSXOpeningElement", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "attributes": [], + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "name": { "type": "JSXIdentifier", - "start": 1, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 4 - } - }, + "start":1,"end":4,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":4}}, "name": "div" }, + "attributes": [], "selfClosing": false }, "closingElement": { "type": "JSXClosingElement", - "start": 11, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":11,"end":17,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":17}}, "name": { "type": "JSXIdentifier", - "start": 13, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":13,"end":16,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":16}}, "name": "div" } }, "children": [ { "type": "JSXExpressionContainer", - "start": 5, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":5,"end":8,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":8}}, "expression": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "a" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"a"}, "name": "a" } }, { "type": "JSXExpressionContainer", - "start": 8, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":8,"end":11,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":11}}, "expression": { "type": "Identifier", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - }, - "identifierName": "b" - }, + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"b"}, "name": "b" } } diff --git a/packages/babel-parser/test/fixtures/jsx/regression/6/output.json b/packages/babel-parser/test/fixtures/jsx/regression/6/output.json index bfae92192f57..bbf531aefe2b 100644 --- a/packages/babel-parser/test/fixtures/jsx/regression/6/output.json +++ b/packages/babel-parser/test/fixtures/jsx/regression/6/output.json @@ -1,121 +1,38 @@ { "type": "File", - "start": 0, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, "program": { "type": "Program", - "start": 0, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, "expression": { "type": "JSXElement", - "start": 0, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, "openingElement": { "type": "JSXOpeningElement", - "start": 0, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 32 - } + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, + "name": { + "type": "JSXIdentifier", + "start":1,"end":4,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":4}}, + "name": "div" }, "attributes": [ { "type": "JSXAttribute", - "start": 5, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":5,"end":18,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":18}}, "name": { "type": "JSXIdentifier", - "start": 5, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":5,"end":8,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":8}}, "name": "pre" }, "value": { "type": "StringLiteral", - "start": 9, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":9,"end":18,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":18}}, "extra": { "rawValue": "leading", "raw": "\"leading\"" @@ -125,53 +42,14 @@ }, { "type": "JSXSpreadAttribute", - "start": 19, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":19,"end":29,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":29}}, "argument": { "type": "Identifier", - "start": 23, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 28 - }, - "identifierName": "props" - }, + "start":23,"end":28,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":28},"identifierName":"props"}, "name": "props" } } ], - "name": { - "type": "JSXIdentifier", - "start": 1, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 4 - } - }, - "name": "div" - }, "selfClosing": true }, "closingElement": null, diff --git a/packages/babel-parser/test/fixtures/jsx/regression/7/output.json b/packages/babel-parser/test/fixtures/jsx/regression/7/output.json index 8017ec8fa0f8..50b7af00aadd 100644 --- a/packages/babel-parser/test/fixtures/jsx/regression/7/output.json +++ b/packages/babel-parser/test/fixtures/jsx/regression/7/output.json @@ -1,121 +1,38 @@ { "type": "File", - "start": 0, - "end": 62, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 17 - } - }, + "start":0,"end":62,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":17}}, "program": { "type": "Program", - "start": 0, - "end": 62, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 17 - } - }, + "start":0,"end":62,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":17}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 62, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 17 - } - }, + "start":0,"end":62,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":17}}, "expression": { "type": "JSXElement", - "start": 0, - "end": 62, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 17 - } - }, + "start":0,"end":62,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":17}}, "openingElement": { "type": "JSXOpeningElement", - "start": 0, - "end": 62, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 17 - } + "start":0,"end":62,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":17}}, + "name": { + "type": "JSXIdentifier", + "start":1,"end":5,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":5}}, + "name": "path" }, "attributes": [ { "type": "JSXAttribute", - "start": 6, - "end": 60, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 3, - "column": 15 - } - }, + "start":6,"end":60,"loc":{"start":{"line":1,"column":6},"end":{"line":3,"column":15}}, "name": { "type": "JSXIdentifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7}}, "name": "d" }, "value": { "type": "StringLiteral", - "start": 8, - "end": 60, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 3, - "column": 15 - } - }, + "start":8,"end":60,"loc":{"start":{"line":1,"column":8},"end":{"line":3,"column":15}}, "extra": { "rawValue": "M230 80\n\t\tA 45 45, 0, 1, 0, 275 125\n L 275 80 Z", "raw": "\"M230 80\n\t\tA 45 45, 0, 1, 0, 275 125\n L 275 80 Z\"" @@ -124,22 +41,6 @@ } } ], - "name": { - "type": "JSXIdentifier", - "start": 1, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "name": "path" - }, "selfClosing": true }, "closingElement": null, diff --git a/packages/babel-parser/test/fixtures/jsx/regression/issue-11387/input.js b/packages/babel-parser/test/fixtures/jsx/regression/issue-11387/input.js new file mode 100644 index 000000000000..34425fe24a91 --- /dev/null +++ b/packages/babel-parser/test/fixtures/jsx/regression/issue-11387/input.js @@ -0,0 +1 @@ +
{(this?.class, this.class, this?.function, this.function)}
diff --git a/packages/babel-parser/test/fixtures/jsx/regression/issue-11387/options.json b/packages/babel-parser/test/fixtures/jsx/regression/issue-11387/options.json new file mode 100644 index 000000000000..698e7668500f --- /dev/null +++ b/packages/babel-parser/test/fixtures/jsx/regression/issue-11387/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["jsx", "flow"] +} diff --git a/packages/babel-parser/test/fixtures/jsx/regression/issue-11387/output.json b/packages/babel-parser/test/fixtures/jsx/regression/issue-11387/output.json new file mode 100644 index 000000000000..6627c48a90fa --- /dev/null +++ b/packages/babel-parser/test/fixtures/jsx/regression/issue-11387/output.json @@ -0,0 +1,115 @@ +{ + "type": "File", + "start":0,"end":69,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":69}}, + "program": { + "type": "Program", + "start":0,"end":69,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":69}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":69,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":69}}, + "expression": { + "type": "JSXElement", + "start":0,"end":69,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":69}}, + "openingElement": { + "type": "JSXOpeningElement", + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, + "name": { + "type": "JSXIdentifier", + "start":1,"end":4,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":4}}, + "name": "div" + }, + "attributes": [], + "selfClosing": false + }, + "closingElement": { + "type": "JSXClosingElement", + "start":63,"end":69,"loc":{"start":{"line":1,"column":63},"end":{"line":1,"column":69}}, + "name": { + "type": "JSXIdentifier", + "start":65,"end":68,"loc":{"start":{"line":1,"column":65},"end":{"line":1,"column":68}}, + "name": "div" + } + }, + "children": [ + { + "type": "JSXExpressionContainer", + "start":5,"end":63,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":63}}, + "expression": { + "type": "SequenceExpression", + "start":7,"end":61,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":61}}, + "expressions": [ + { + "type": "OptionalMemberExpression", + "start":7,"end":18,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":18}}, + "object": { + "type": "ThisExpression", + "start":7,"end":11,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":11}} + }, + "property": { + "type": "Identifier", + "start":13,"end":18,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":18},"identifierName":"class"}, + "name": "class" + }, + "computed": false, + "optional": true + }, + { + "type": "MemberExpression", + "start":20,"end":30,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":30}}, + "object": { + "type": "ThisExpression", + "start":20,"end":24,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":24}} + }, + "property": { + "type": "Identifier", + "start":25,"end":30,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":30},"identifierName":"class"}, + "name": "class" + }, + "computed": false + }, + { + "type": "OptionalMemberExpression", + "start":32,"end":46,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":46}}, + "object": { + "type": "ThisExpression", + "start":32,"end":36,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":36}} + }, + "property": { + "type": "Identifier", + "start":38,"end":46,"loc":{"start":{"line":1,"column":38},"end":{"line":1,"column":46},"identifierName":"function"}, + "name": "function" + }, + "computed": false, + "optional": true + }, + { + "type": "MemberExpression", + "start":48,"end":61,"loc":{"start":{"line":1,"column":48},"end":{"line":1,"column":61}}, + "object": { + "type": "ThisExpression", + "start":48,"end":52,"loc":{"start":{"line":1,"column":48},"end":{"line":1,"column":52}} + }, + "property": { + "type": "Identifier", + "start":53,"end":61,"loc":{"start":{"line":1,"column":53},"end":{"line":1,"column":61},"identifierName":"function"}, + "name": "function" + }, + "computed": false + } + ], + "extra": { + "parenthesized": true, + "parenStart": 6 + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/jsx/regression/issue-2083/output.json b/packages/babel-parser/test/fixtures/jsx/regression/issue-2083/output.json index d695f1c4eae1..7d804c8ddee3 100644 --- a/packages/babel-parser/test/fixtures/jsx/regression/issue-2083/output.json +++ b/packages/babel-parser/test/fixtures/jsx/regression/issue-2083/output.json @@ -1,123 +1,35 @@ { "type": "File", - "start": 0, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, "program": { "type": "Program", - "start": 0, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, "expression": { "type": "ConditionalExpression", - "start": 0, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, "test": { "type": "BooleanLiteral", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - }, + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, "value": true }, "consequent": { "type": "JSXElement", - "start": 8, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":8,"end":15,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":15}}, "openingElement": { "type": "JSXOpeningElement", - "start": 8, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "attributes": [], + "start":8,"end":15,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":15}}, "name": { "type": "JSXIdentifier", - "start": 9, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":9,"end":12,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":12}}, "name": "div" }, + "attributes": [], "selfClosing": true }, "closingElement": null, @@ -129,49 +41,16 @@ }, "alternate": { "type": "JSXElement", - "start": 19, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":19,"end":26,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":26}}, "openingElement": { "type": "JSXOpeningElement", - "start": 19, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 26 - } - }, - "attributes": [], + "start":19,"end":26,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":26}}, "name": { "type": "JSXIdentifier", - "start": 20, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":20,"end":23,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":23}}, "name": "div" }, + "attributes": [], "selfClosing": true }, "closingElement": null, diff --git a/packages/babel-parser/test/fixtures/jsx/regression/issue-2114/output.json b/packages/babel-parser/test/fixtures/jsx/regression/issue-2114/output.json index 8bb402e4312d..c87ad6b98ba7 100644 --- a/packages/babel-parser/test/fixtures/jsx/regression/issue-2114/output.json +++ b/packages/babel-parser/test/fixtures/jsx/regression/issue-2114/output.json @@ -1,121 +1,38 @@ { "type": "File", - "start": 0, - "end": 51, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 51 - } - }, + "start":0,"end":51,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":51}}, "program": { "type": "Program", - "start": 0, - "end": 51, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 51 - } - }, + "start":0,"end":51,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":51}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 51, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 51 - } - }, + "start":0,"end":51,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":51}}, "expression": { "type": "JSXElement", - "start": 0, - "end": 50, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 50 - } - }, + "start":0,"end":50,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":50}}, "openingElement": { "type": "JSXOpeningElement", - "start": 0, - "end": 44, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 44 - } + "start":0,"end":44,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":44}}, + "name": { + "type": "JSXIdentifier", + "start":1,"end":4,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":4}}, + "name": "div" }, "attributes": [ { "type": "JSXAttribute", - "start": 5, - "end": 43, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 43 - } - }, + "start":5,"end":43,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":43}}, "name": { "type": "JSXIdentifier", - "start": 5, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":5,"end":12,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":12}}, "name": "pattern" }, "value": { "type": "StringLiteral", - "start": 13, - "end": 43, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 43 - } - }, + "start":13,"end":43,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":43}}, "extra": { "rawValue": "^([\\w\\.\\-]+\\s)*[\\w\\.\\-]+\\s?$", "raw": "\"^([\\w\\.\\-]+\\s)*[\\w\\.\\-]+\\s?$\"" @@ -124,52 +41,14 @@ } } ], - "name": { - "type": "JSXIdentifier", - "start": 1, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 4 - } - }, - "name": "div" - }, "selfClosing": false }, "closingElement": { "type": "JSXClosingElement", - "start": 44, - "end": 50, - "loc": { - "start": { - "line": 1, - "column": 44 - }, - "end": { - "line": 1, - "column": 50 - } - }, + "start":44,"end":50,"loc":{"start":{"line":1,"column":44},"end":{"line":1,"column":50}}, "name": { "type": "JSXIdentifier", - "start": 46, - "end": 49, - "loc": { - "start": { - "line": 1, - "column": 46 - }, - "end": { - "line": 1, - "column": 49 - } - }, + "start":46,"end":49,"loc":{"start":{"line":1,"column":46},"end":{"line":1,"column":49}}, "name": "div" } }, diff --git a/packages/babel-parser/test/fixtures/jsx/regression/issue-8891/output.json b/packages/babel-parser/test/fixtures/jsx/regression/issue-8891/output.json index abafdf5c8759..29cc38511677 100644 --- a/packages/babel-parser/test/fixtures/jsx/regression/issue-8891/output.json +++ b/packages/babel-parser/test/fixtures/jsx/regression/issue-8891/output.json @@ -1,107 +1,30 @@ { "type": "File", - "start": 0, - "end": 153, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 6, - "column": 3 - } - }, + "start":0,"end":153,"loc":{"start":{"line":1,"column":0},"end":{"line":6,"column":3}}, "program": { "type": "Program", - "start": 0, - "end": 153, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 6, - "column": 3 - } - }, + "start":0,"end":153,"loc":{"start":{"line":1,"column":0},"end":{"line":6,"column":3}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 153, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 6, - "column": 3 - } - }, + "start":0,"end":153,"loc":{"start":{"line":1,"column":0},"end":{"line":6,"column":3}}, "expression": { "type": "JSXFragment", - "start": 0, - "end": 153, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 6, - "column": 3 - } - }, + "start":0,"end":153,"loc":{"start":{"line":1,"column":0},"end":{"line":6,"column":3}}, "openingFragment": { "type": "JSXOpeningFragment", - "start": 0, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 2 - } - } + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}} }, "closingFragment": { "type": "JSXClosingFragment", - "start": 150, - "end": 153, - "loc": { - "start": { - "line": 6, - "column": 0 - }, - "end": { - "line": 6, - "column": 3 - } - } + "start":150,"end":153,"loc":{"start":{"line":6,"column":0},"end":{"line":6,"column":3}} }, "children": [ { "type": "JSXText", - "start": 2, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 2, - "column": 0 - } - }, + "start":2,"end":3,"loc":{"start":{"line":1,"column":2},"end":{"line":2,"column":0}}, "extra": { "rawValue": "\n", "raw": "\n" @@ -110,156 +33,45 @@ }, { "type": "JSXElement", - "start": 3, - "end": 41, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 38 - } - }, + "start":3,"end":41,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":38}}, "openingElement": { "type": "JSXOpeningElement", - "start": 3, - "end": 41, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 38 - } - }, + "start":3,"end":41,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":38}}, "name": { "type": "JSXIdentifier", - "start": 4, - "end": 10, - "loc": { - "start": { - "line": 2, - "column": 1 - }, - "end": { - "line": 2, - "column": 7 - } - }, + "start":4,"end":10,"loc":{"start":{"line":2,"column":1},"end":{"line":2,"column":7}}, "name": "Select" }, "attributes": [ { "type": "JSXAttribute", - "start": 11, - "end": 38, - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 35 - } - }, + "start":11,"end":38,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":35}}, "name": { "type": "JSXIdentifier", - "start": 11, - "end": 15, - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 12 - } - }, + "start":11,"end":15,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":12}}, "name": "prop" }, "value": { "type": "JSXExpressionContainer", - "start": 16, - "end": 38, - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 35 - } - }, + "start":16,"end":38,"loc":{"start":{"line":2,"column":13},"end":{"line":2,"column":35}}, "expression": { "type": "ObjectExpression", - "start": 17, - "end": 37, - "loc": { - "start": { - "line": 2, - "column": 14 - }, - "end": { - "line": 2, - "column": 34 - } - }, + "start":17,"end":37,"loc":{"start":{"line":2,"column":14},"end":{"line":2,"column":34}}, "properties": [ { "type": "ObjectProperty", - "start": 19, - "end": 35, - "loc": { - "start": { - "line": 2, - "column": 16 - }, - "end": { - "line": 2, - "column": 32 - } - }, + "start":19,"end":35,"loc":{"start":{"line":2,"column":16},"end":{"line":2,"column":32}}, "method": false, "key": { "type": "Identifier", - "start": 19, - "end": 27, - "loc": { - "start": { - "line": 2, - "column": 16 - }, - "end": { - "line": 2, - "column": 24 - }, - "identifierName": "function" - }, + "start":19,"end":27,"loc":{"start":{"line":2,"column":16},"end":{"line":2,"column":24},"identifierName":"function"}, "name": "function" }, "computed": false, "shorthand": false, "value": { "type": "StringLiteral", - "start": 29, - "end": 35, - "loc": { - "start": { - "line": 2, - "column": 26 - }, - "end": { - "line": 2, - "column": 32 - } - }, + "start":29,"end":35,"loc":{"start":{"line":2,"column":26},"end":{"line":2,"column":32}}, "extra": { "rawValue": "test", "raw": "'test'" @@ -279,18 +91,7 @@ }, { "type": "JSXText", - "start": 41, - "end": 42, - "loc": { - "start": { - "line": 2, - "column": 38 - }, - "end": { - "line": 3, - "column": 0 - } - }, + "start":41,"end":42,"loc":{"start":{"line":2,"column":38},"end":{"line":3,"column":0}}, "extra": { "rawValue": "\n", "raw": "\n" @@ -299,156 +100,45 @@ }, { "type": "JSXElement", - "start": 42, - "end": 77, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 35 - } - }, + "start":42,"end":77,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":35}}, "openingElement": { "type": "JSXOpeningElement", - "start": 42, - "end": 77, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 35 - } - }, + "start":42,"end":77,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":35}}, "name": { "type": "JSXIdentifier", - "start": 43, - "end": 49, - "loc": { - "start": { - "line": 3, - "column": 1 - }, - "end": { - "line": 3, - "column": 7 - } - }, + "start":43,"end":49,"loc":{"start":{"line":3,"column":1},"end":{"line":3,"column":7}}, "name": "Select" }, "attributes": [ { "type": "JSXAttribute", - "start": 50, - "end": 74, - "loc": { - "start": { - "line": 3, - "column": 8 - }, - "end": { - "line": 3, - "column": 32 - } - }, + "start":50,"end":74,"loc":{"start":{"line":3,"column":8},"end":{"line":3,"column":32}}, "name": { "type": "JSXIdentifier", - "start": 50, - "end": 54, - "loc": { - "start": { - "line": 3, - "column": 8 - }, - "end": { - "line": 3, - "column": 12 - } - }, + "start":50,"end":54,"loc":{"start":{"line":3,"column":8},"end":{"line":3,"column":12}}, "name": "prop" }, "value": { "type": "JSXExpressionContainer", - "start": 55, - "end": 74, - "loc": { - "start": { - "line": 3, - "column": 13 - }, - "end": { - "line": 3, - "column": 32 - } - }, + "start":55,"end":74,"loc":{"start":{"line":3,"column":13},"end":{"line":3,"column":32}}, "expression": { "type": "ObjectExpression", - "start": 56, - "end": 73, - "loc": { - "start": { - "line": 3, - "column": 14 - }, - "end": { - "line": 3, - "column": 31 - } - }, + "start":56,"end":73,"loc":{"start":{"line":3,"column":14},"end":{"line":3,"column":31}}, "properties": [ { "type": "ObjectProperty", - "start": 58, - "end": 71, - "loc": { - "start": { - "line": 3, - "column": 16 - }, - "end": { - "line": 3, - "column": 29 - } - }, + "start":58,"end":71,"loc":{"start":{"line":3,"column":16},"end":{"line":3,"column":29}}, "method": false, "key": { "type": "Identifier", - "start": 58, - "end": 63, - "loc": { - "start": { - "line": 3, - "column": 16 - }, - "end": { - "line": 3, - "column": 21 - }, - "identifierName": "class" - }, + "start":58,"end":63,"loc":{"start":{"line":3,"column":16},"end":{"line":3,"column":21},"identifierName":"class"}, "name": "class" }, "computed": false, "shorthand": false, "value": { "type": "StringLiteral", - "start": 65, - "end": 71, - "loc": { - "start": { - "line": 3, - "column": 23 - }, - "end": { - "line": 3, - "column": 29 - } - }, + "start":65,"end":71,"loc":{"start":{"line":3,"column":23},"end":{"line":3,"column":29}}, "extra": { "rawValue": "test", "raw": "'test'" @@ -468,18 +158,7 @@ }, { "type": "JSXText", - "start": 77, - "end": 78, - "loc": { - "start": { - "line": 3, - "column": 35 - }, - "end": { - "line": 4, - "column": 0 - } - }, + "start":77,"end":78,"loc":{"start":{"line":3,"column":35},"end":{"line":4,"column":0}}, "extra": { "rawValue": "\n", "raw": "\n" @@ -488,156 +167,45 @@ }, { "type": "JSXElement", - "start": 78, - "end": 114, - "loc": { - "start": { - "line": 4, - "column": 0 - }, - "end": { - "line": 4, - "column": 36 - } - }, + "start":78,"end":114,"loc":{"start":{"line":4,"column":0},"end":{"line":4,"column":36}}, "openingElement": { "type": "JSXOpeningElement", - "start": 78, - "end": 114, - "loc": { - "start": { - "line": 4, - "column": 0 - }, - "end": { - "line": 4, - "column": 36 - } - }, + "start":78,"end":114,"loc":{"start":{"line":4,"column":0},"end":{"line":4,"column":36}}, "name": { "type": "JSXIdentifier", - "start": 79, - "end": 85, - "loc": { - "start": { - "line": 4, - "column": 1 - }, - "end": { - "line": 4, - "column": 7 - } - }, + "start":79,"end":85,"loc":{"start":{"line":4,"column":1},"end":{"line":4,"column":7}}, "name": "Select" }, "attributes": [ { "type": "JSXAttribute", - "start": 86, - "end": 111, - "loc": { - "start": { - "line": 4, - "column": 8 - }, - "end": { - "line": 4, - "column": 33 - } - }, + "start":86,"end":111,"loc":{"start":{"line":4,"column":8},"end":{"line":4,"column":33}}, "name": { "type": "JSXIdentifier", - "start": 86, - "end": 90, - "loc": { - "start": { - "line": 4, - "column": 8 - }, - "end": { - "line": 4, - "column": 12 - } - }, + "start":86,"end":90,"loc":{"start":{"line":4,"column":8},"end":{"line":4,"column":12}}, "name": "prop" }, "value": { "type": "JSXExpressionContainer", - "start": 91, - "end": 111, - "loc": { - "start": { - "line": 4, - "column": 13 - }, - "end": { - "line": 4, - "column": 33 - } - }, + "start":91,"end":111,"loc":{"start":{"line":4,"column":13},"end":{"line":4,"column":33}}, "expression": { "type": "ObjectExpression", - "start": 92, - "end": 110, - "loc": { - "start": { - "line": 4, - "column": 14 - }, - "end": { - "line": 4, - "column": 32 - } - }, + "start":92,"end":110,"loc":{"start":{"line":4,"column":14},"end":{"line":4,"column":32}}, "properties": [ { "type": "ObjectProperty", - "start": 94, - "end": 108, - "loc": { - "start": { - "line": 4, - "column": 16 - }, - "end": { - "line": 4, - "column": 30 - } - }, + "start":94,"end":108,"loc":{"start":{"line":4,"column":16},"end":{"line":4,"column":30}}, "method": false, "key": { "type": "Identifier", - "start": 94, - "end": 100, - "loc": { - "start": { - "line": 4, - "column": 16 - }, - "end": { - "line": 4, - "column": 22 - }, - "identifierName": "delete" - }, + "start":94,"end":100,"loc":{"start":{"line":4,"column":16},"end":{"line":4,"column":22},"identifierName":"delete"}, "name": "delete" }, "computed": false, "shorthand": false, "value": { "type": "StringLiteral", - "start": 102, - "end": 108, - "loc": { - "start": { - "line": 4, - "column": 24 - }, - "end": { - "line": 4, - "column": 30 - } - }, + "start":102,"end":108,"loc":{"start":{"line":4,"column":24},"end":{"line":4,"column":30}}, "extra": { "rawValue": "test", "raw": "'test'" @@ -657,18 +225,7 @@ }, { "type": "JSXText", - "start": 114, - "end": 115, - "loc": { - "start": { - "line": 4, - "column": 36 - }, - "end": { - "line": 5, - "column": 0 - } - }, + "start":114,"end":115,"loc":{"start":{"line":4,"column":36},"end":{"line":5,"column":0}}, "extra": { "rawValue": "\n", "raw": "\n" @@ -677,156 +234,45 @@ }, { "type": "JSXElement", - "start": 115, - "end": 149, - "loc": { - "start": { - "line": 5, - "column": 0 - }, - "end": { - "line": 5, - "column": 34 - } - }, + "start":115,"end":149,"loc":{"start":{"line":5,"column":0},"end":{"line":5,"column":34}}, "openingElement": { "type": "JSXOpeningElement", - "start": 115, - "end": 149, - "loc": { - "start": { - "line": 5, - "column": 0 - }, - "end": { - "line": 5, - "column": 34 - } - }, + "start":115,"end":149,"loc":{"start":{"line":5,"column":0},"end":{"line":5,"column":34}}, "name": { "type": "JSXIdentifier", - "start": 116, - "end": 122, - "loc": { - "start": { - "line": 5, - "column": 1 - }, - "end": { - "line": 5, - "column": 7 - } - }, + "start":116,"end":122,"loc":{"start":{"line":5,"column":1},"end":{"line":5,"column":7}}, "name": "Select" }, "attributes": [ { "type": "JSXAttribute", - "start": 123, - "end": 146, - "loc": { - "start": { - "line": 5, - "column": 8 - }, - "end": { - "line": 5, - "column": 31 - } - }, + "start":123,"end":146,"loc":{"start":{"line":5,"column":8},"end":{"line":5,"column":31}}, "name": { "type": "JSXIdentifier", - "start": 123, - "end": 127, - "loc": { - "start": { - "line": 5, - "column": 8 - }, - "end": { - "line": 5, - "column": 12 - } - }, + "start":123,"end":127,"loc":{"start":{"line":5,"column":8},"end":{"line":5,"column":12}}, "name": "prop" }, "value": { "type": "JSXExpressionContainer", - "start": 128, - "end": 146, - "loc": { - "start": { - "line": 5, - "column": 13 - }, - "end": { - "line": 5, - "column": 31 - } - }, + "start":128,"end":146,"loc":{"start":{"line":5,"column":13},"end":{"line":5,"column":31}}, "expression": { "type": "ObjectExpression", - "start": 129, - "end": 145, - "loc": { - "start": { - "line": 5, - "column": 14 - }, - "end": { - "line": 5, - "column": 30 - } - }, + "start":129,"end":145,"loc":{"start":{"line":5,"column":14},"end":{"line":5,"column":30}}, "properties": [ { "type": "ObjectProperty", - "start": 131, - "end": 143, - "loc": { - "start": { - "line": 5, - "column": 16 - }, - "end": { - "line": 5, - "column": 28 - } - }, + "start":131,"end":143,"loc":{"start":{"line":5,"column":16},"end":{"line":5,"column":28}}, "method": false, "key": { "type": "Identifier", - "start": 131, - "end": 135, - "loc": { - "start": { - "line": 5, - "column": 16 - }, - "end": { - "line": 5, - "column": 20 - }, - "identifierName": "enum" - }, + "start":131,"end":135,"loc":{"start":{"line":5,"column":16},"end":{"line":5,"column":20},"identifierName":"enum"}, "name": "enum" }, "computed": false, "shorthand": false, "value": { "type": "StringLiteral", - "start": 137, - "end": 143, - "loc": { - "start": { - "line": 5, - "column": 22 - }, - "end": { - "line": 5, - "column": 28 - } - }, + "start":137,"end":143,"loc":{"start":{"line":5,"column":22},"end":{"line":5,"column":28}}, "extra": { "rawValue": "test", "raw": "'test'" @@ -846,18 +292,7 @@ }, { "type": "JSXText", - "start": 149, - "end": 150, - "loc": { - "start": { - "line": 5, - "column": 34 - }, - "end": { - "line": 6, - "column": 0 - } - }, + "start":149,"end":150,"loc":{"start":{"line":5,"column":34},"end":{"line":6,"column":0}}, "extra": { "rawValue": "\n", "raw": "\n" diff --git a/packages/babel-parser/test/fixtures/jsx/regression/nbsp/output.json b/packages/babel-parser/test/fixtures/jsx/regression/nbsp/output.json index c4315832f005..c06d0a72281e 100644 --- a/packages/babel-parser/test/fixtures/jsx/regression/nbsp/output.json +++ b/packages/babel-parser/test/fixtures/jsx/regression/nbsp/output.json @@ -1,141 +1,42 @@ { "type": "File", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "program": { "type": "Program", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "expression": { "type": "JSXElement", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "openingElement": { "type": "JSXOpeningElement", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "attributes": [], + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "name": { "type": "JSXIdentifier", - "start": 1, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 4 - } - }, + "start":1,"end":4,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":4}}, "name": "div" }, + "attributes": [], "selfClosing": false }, "closingElement": { "type": "JSXClosingElement", - "start": 11, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":11,"end":17,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":17}}, "name": { "type": "JSXIdentifier", - "start": 13, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":13,"end":16,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":16}}, "name": "div" } }, "children": [ { "type": "JSXText", - "start": 5, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":5,"end":11,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":11}}, "extra": { "rawValue": " ", "raw": " " diff --git a/packages/babel-parser/test/fixtures/placeholders/_errors/space-after/options.json b/packages/babel-parser/test/fixtures/placeholders/_errors/space-after/options.json index a307a35df63e..92404e501295 100644 --- a/packages/babel-parser/test/fixtures/placeholders/_errors/space-after/options.json +++ b/packages/babel-parser/test/fixtures/placeholders/_errors/space-after/options.json @@ -1,4 +1,3 @@ { - "plugins": ["placeholders"], - "throws": "Unexpected space in placeholder. (1:5)" + "plugins": ["placeholders"] } diff --git a/packages/babel-parser/test/fixtures/placeholders/_errors/space-after/output.json b/packages/babel-parser/test/fixtures/placeholders/_errors/space-after/output.json new file mode 100644 index 000000000000..dc0f88188df6 --- /dev/null +++ b/packages/babel-parser/test/fixtures/placeholders/_errors/space-after/output.json @@ -0,0 +1,26 @@ +{ + "type": "File", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "errors": [ + "SyntaxError: Unexpected space in placeholder. (1:5)" + ], + "program": { + "type": "Program", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "Placeholder", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "name": { + "type": "Identifier", + "start":2,"end":5,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":5},"identifierName":"FOO"}, + "name": "FOO" + }, + "expectedNode": "Statement" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/placeholders/_errors/space-before/options.json b/packages/babel-parser/test/fixtures/placeholders/_errors/space-before/options.json index 2d76cfab7e2f..92404e501295 100644 --- a/packages/babel-parser/test/fixtures/placeholders/_errors/space-before/options.json +++ b/packages/babel-parser/test/fixtures/placeholders/_errors/space-before/options.json @@ -1,4 +1,3 @@ { - "plugins": ["placeholders"], - "throws": "Unexpected space in placeholder. (1:2)" + "plugins": ["placeholders"] } diff --git a/packages/babel-parser/test/fixtures/placeholders/_errors/space-before/output.json b/packages/babel-parser/test/fixtures/placeholders/_errors/space-before/output.json new file mode 100644 index 000000000000..1855819ef9ca --- /dev/null +++ b/packages/babel-parser/test/fixtures/placeholders/_errors/space-before/output.json @@ -0,0 +1,26 @@ +{ + "type": "File", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "errors": [ + "SyntaxError: Unexpected space in placeholder. (1:2)" + ], + "program": { + "type": "Program", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "Placeholder", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "name": { + "type": "Identifier", + "start":3,"end":6,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":6},"identifierName":"FOO"}, + "name": "FOO" + }, + "expectedNode": "Statement" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/placeholders/arrow/async/output.json b/packages/babel-parser/test/fixtures/placeholders/arrow/async/output.json index 4896328afde6..b0e63aa6ac58 100644 --- a/packages/babel-parser/test/fixtures/placeholders/arrow/async/output.json +++ b/packages/babel-parser/test/fixtures/placeholders/arrow/async/output.json @@ -1,95 +1,28 @@ { "type": "File", - "start": 0, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, "program": { "type": "Program", - "start": 0, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, "expression": { "type": "ArrowFunctionExpression", - "start": 0, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, "id": null, "generator": false, "async": true, "params": [ { "type": "Placeholder", - "start": 7, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":7,"end":16,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":16}}, "name": { "type": "Identifier", - "start": 9, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 14 - }, - "identifierName": "PARAM" - }, + "start":9,"end":14,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":14},"identifierName":"PARAM"}, "name": "PARAM" }, "expectedNode": "Pattern" @@ -97,33 +30,10 @@ ], "body": { "type": "Placeholder", - "start": 21, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":21,"end":29,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":29}}, "name": { "type": "Identifier", - "start": 23, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 27 - }, - "identifierName": "BODY" - }, + "start":23,"end":27,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":27},"identifierName":"BODY"}, "name": "BODY" }, "expectedNode": "Expression" diff --git a/packages/babel-parser/test/fixtures/placeholders/arrow/sync/output.json b/packages/babel-parser/test/fixtures/placeholders/arrow/sync/output.json index 6b0b16b70fc7..89b39b42d700 100644 --- a/packages/babel-parser/test/fixtures/placeholders/arrow/sync/output.json +++ b/packages/babel-parser/test/fixtures/placeholders/arrow/sync/output.json @@ -1,95 +1,28 @@ { "type": "File", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "program": { "type": "Program", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "expression": { "type": "ArrowFunctionExpression", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "id": null, "generator": false, "async": false, "params": [ { "type": "Placeholder", - "start": 1, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":1,"end":10,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":10}}, "name": { "type": "Identifier", - "start": 3, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 8 - }, - "identifierName": "PARAM" - }, + "start":3,"end":8,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":8},"identifierName":"PARAM"}, "name": "PARAM" }, "expectedNode": "Pattern" @@ -97,33 +30,10 @@ ], "body": { "type": "Placeholder", - "start": 15, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":15,"end":23,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":23}}, "name": { "type": "Identifier", - "start": 17, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 21 - }, - "identifierName": "BODY" - }, + "start":17,"end":21,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":21},"identifierName":"BODY"}, "name": "BODY" }, "expectedNode": "Expression" diff --git a/packages/babel-parser/test/fixtures/placeholders/class/body_expression/output.json b/packages/babel-parser/test/fixtures/placeholders/class/body_expression/output.json index 61966406846e..d8d6d4bb5966 100644 --- a/packages/babel-parser/test/fixtures/placeholders/class/body_expression/output.json +++ b/packages/babel-parser/test/fixtures/placeholders/class/body_expression/output.json @@ -1,108 +1,30 @@ { "type": "File", - "start": 0, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, "program": { "type": "Program", - "start": 0, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, "expression": { "type": "UnaryExpression", - "start": 0, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, "operator": "void", "prefix": true, "argument": { "type": "ClassExpression", - "start": 5, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":5,"end":19,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":19}}, "id": null, "body": { "type": "Placeholder", - "start": 11, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":11,"end":19,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":19}}, "name": { "type": "Identifier", - "start": 13, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 17 - }, - "identifierName": "BODY" - }, + "start":13,"end":17,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":17},"identifierName":"BODY"}, "name": "BODY" }, "expectedNode": "ClassBody" diff --git a/packages/babel-parser/test/fixtures/placeholders/class/body_statement/output.json b/packages/babel-parser/test/fixtures/placeholders/class/body_statement/output.json index 70f4a636520e..649a06dcc065 100644 --- a/packages/babel-parser/test/fixtures/placeholders/class/body_statement/output.json +++ b/packages/babel-parser/test/fixtures/placeholders/class/body_statement/output.json @@ -1,95 +1,27 @@ { "type": "File", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "program": { "type": "Program", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "id": { "type": "Identifier", - "start": 6, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 8 - }, - "identifierName": "Cl" - }, + "start":6,"end":8,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":8},"identifierName":"Cl"}, "name": "Cl" }, "superClass": null, "body": { "type": "Placeholder", - "start": 9, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":9,"end":17,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":17}}, "name": { "type": "Identifier", - "start": 11, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 15 - }, - "identifierName": "BODY" - }, + "start":11,"end":15,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":15},"identifierName":"BODY"}, "name": "BODY" }, "expectedNode": "ClassBody" diff --git a/packages/babel-parser/test/fixtures/placeholders/class/decorators/output.json b/packages/babel-parser/test/fixtures/placeholders/class/decorators/output.json index 459dacb35f2c..693f74878aae 100644 --- a/packages/babel-parser/test/fixtures/placeholders/class/decorators/output.json +++ b/packages/babel-parser/test/fixtures/placeholders/class/decorators/output.json @@ -1,92 +1,25 @@ { "type": "File", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 10 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":10}}, "program": { "type": "Program", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 10 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":10}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 10 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":10}}, "decorators": [ { "type": "Decorator", - "start": 0, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, "expression": { "type": "Placeholder", - "start": 2, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":2,"end":9,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":9}}, "name": { "type": "Identifier", - "start": 4, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "FOO" - }, + "start":4,"end":7,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":7},"identifierName":"FOO"}, "name": "FOO" }, "expectedNode": "Expression" @@ -95,36 +28,13 @@ ], "id": { "type": "Identifier", - "start": 17, - "end": 18, - "loc": { - "start": { - "line": 2, - "column": 6 - }, - "end": { - "line": 2, - "column": 7 - }, - "identifierName": "A" - }, + "start":17,"end":18,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":7},"identifierName":"A"}, "name": "A" }, "superClass": null, "body": { "type": "ClassBody", - "start": 19, - "end": 21, - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 10 - } - }, + "start":19,"end":21,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":10}}, "body": [] } } diff --git a/packages/babel-parser/test/fixtures/placeholders/class/id-body/output.json b/packages/babel-parser/test/fixtures/placeholders/class/id-body/output.json index 0fe8c71d4786..0d6cc4d1864b 100644 --- a/packages/babel-parser/test/fixtures/placeholders/class/id-body/output.json +++ b/packages/babel-parser/test/fixtures/placeholders/class/id-body/output.json @@ -1,77 +1,21 @@ { "type": "File", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, "program": { "type": "Program", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, "id": { "type": "Placeholder", - "start": 6, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":6,"end":12,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":12}}, "name": { "type": "Identifier", - "start": 8, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 10 - }, - "identifierName": "ID" - }, + "start":8,"end":10,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":10},"identifierName":"ID"}, "name": "ID" }, "expectedNode": "Identifier" @@ -79,33 +23,10 @@ "superClass": null, "body": { "type": "Placeholder", - "start": 13, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":13,"end":21,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":21}}, "name": { "type": "Identifier", - "start": 15, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 19 - }, - "identifierName": "BODY" - }, + "start":15,"end":19,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":19},"identifierName":"BODY"}, "name": "BODY" }, "expectedNode": "ClassBody" diff --git a/packages/babel-parser/test/fixtures/placeholders/class/id-super-body/output.json b/packages/babel-parser/test/fixtures/placeholders/class/id-super-body/output.json index b891fe7c30d9..e193ed51d809 100644 --- a/packages/babel-parser/test/fixtures/placeholders/class/id-super-body/output.json +++ b/packages/babel-parser/test/fixtures/placeholders/class/id-super-body/output.json @@ -1,143 +1,41 @@ { "type": "File", - "start": 0, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 39 - } - }, + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":39}}, "program": { "type": "Program", - "start": 0, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 39 - } - }, + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":39}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 39 - } - }, + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":39}}, "id": { "type": "Placeholder", - "start": 6, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":6,"end":12,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":12}}, "name": { "type": "Identifier", - "start": 8, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 10 - }, - "identifierName": "ID" - }, + "start":8,"end":10,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":10},"identifierName":"ID"}, "name": "ID" }, "expectedNode": "Identifier" }, "superClass": { "type": "Placeholder", - "start": 21, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":21,"end":30,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":30}}, "name": { "type": "Identifier", - "start": 23, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 28 - }, - "identifierName": "SUPER" - }, + "start":23,"end":28,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":28},"identifierName":"SUPER"}, "name": "SUPER" }, "expectedNode": "Expression" }, "body": { "type": "Placeholder", - "start": 31, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 31 - }, - "end": { - "line": 1, - "column": 39 - } - }, + "start":31,"end":39,"loc":{"start":{"line":1,"column":31},"end":{"line":1,"column":39}}, "name": { "type": "Identifier", - "start": 33, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 33 - }, - "end": { - "line": 1, - "column": 37 - }, - "identifierName": "BODY" - }, + "start":33,"end":37,"loc":{"start":{"line":1,"column":33},"end":{"line":1,"column":37},"identifierName":"BODY"}, "name": "BODY" }, "expectedNode": "ClassBody" diff --git a/packages/babel-parser/test/fixtures/placeholders/class/id-super/output.json b/packages/babel-parser/test/fixtures/placeholders/class/id-super/output.json index cde4f271b7de..8a3a9f64573e 100644 --- a/packages/babel-parser/test/fixtures/placeholders/class/id-super/output.json +++ b/packages/babel-parser/test/fixtures/placeholders/class/id-super/output.json @@ -1,128 +1,38 @@ { "type": "File", - "start": 0, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, "program": { "type": "Program", - "start": 0, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, "id": { "type": "Placeholder", - "start": 6, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":6,"end":12,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":12}}, "name": { "type": "Identifier", - "start": 8, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 10 - }, - "identifierName": "ID" - }, + "start":8,"end":10,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":10},"identifierName":"ID"}, "name": "ID" }, "expectedNode": "Identifier" }, "superClass": { "type": "Placeholder", - "start": 21, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":21,"end":30,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":30}}, "name": { "type": "Identifier", - "start": 23, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 28 - }, - "identifierName": "SUPER" - }, + "start":23,"end":28,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":28},"identifierName":"SUPER"}, "name": "SUPER" }, "expectedNode": "Expression" }, "body": { "type": "ClassBody", - "start": 31, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 31 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":31,"end":33,"loc":{"start":{"line":1,"column":31},"end":{"line":1,"column":33}}, "body": [] } } diff --git a/packages/babel-parser/test/fixtures/placeholders/class/id_expression/output.json b/packages/babel-parser/test/fixtures/placeholders/class/id_expression/output.json index 8ec0bdeaeb64..d52bbba58828 100644 --- a/packages/babel-parser/test/fixtures/placeholders/class/id_expression/output.json +++ b/packages/babel-parser/test/fixtures/placeholders/class/id_expression/output.json @@ -1,107 +1,29 @@ { "type": "File", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, "program": { "type": "Program", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, "expression": { "type": "UnaryExpression", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, "operator": "void", "prefix": true, "argument": { "type": "ClassExpression", - "start": 5, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":5,"end":20,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":20}}, "id": { "type": "Placeholder", - "start": 11, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":11,"end":17,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":17}}, "name": { "type": "Identifier", - "start": 13, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 15 - }, - "identifierName": "ID" - }, + "start":13,"end":15,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":15},"identifierName":"ID"}, "name": "ID" }, "expectedNode": "Identifier" @@ -109,18 +31,7 @@ "superClass": null, "body": { "type": "ClassBody", - "start": 18, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":18,"end":20,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":20}}, "body": [] } } diff --git a/packages/babel-parser/test/fixtures/placeholders/class/id_statement/output.json b/packages/babel-parser/test/fixtures/placeholders/class/id_statement/output.json index 61ecc899ae22..f435f0a37072 100644 --- a/packages/babel-parser/test/fixtures/placeholders/class/id_statement/output.json +++ b/packages/babel-parser/test/fixtures/placeholders/class/id_statement/output.json @@ -1,77 +1,21 @@ { "type": "File", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "program": { "type": "Program", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "id": { "type": "Placeholder", - "start": 6, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":6,"end":12,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":12}}, "name": { "type": "Identifier", - "start": 8, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 10 - }, - "identifierName": "ID" - }, + "start":8,"end":10,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":10},"identifierName":"ID"}, "name": "ID" }, "expectedNode": "Identifier" @@ -79,18 +23,7 @@ "superClass": null, "body": { "type": "ClassBody", - "start": 13, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":13,"end":15,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":15}}, "body": [] } } diff --git a/packages/babel-parser/test/fixtures/placeholders/class/super/output.json b/packages/babel-parser/test/fixtures/placeholders/class/super/output.json index 966639d5d351..b28056e898c0 100644 --- a/packages/babel-parser/test/fixtures/placeholders/class/super/output.json +++ b/packages/babel-parser/test/fixtures/placeholders/class/super/output.json @@ -1,112 +1,33 @@ { "type": "File", - "start": 0, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, "program": { "type": "Program", - "start": 0, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, "id": { "type": "Identifier", - "start": 6, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 8 - }, - "identifierName": "Cl" - }, + "start":6,"end":8,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":8},"identifierName":"Cl"}, "name": "Cl" }, "superClass": { "type": "Placeholder", - "start": 17, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":17,"end":26,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":26}}, "name": { "type": "Identifier", - "start": 19, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 24 - }, - "identifierName": "SUPER" - }, + "start":19,"end":24,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":24},"identifierName":"SUPER"}, "name": "SUPER" }, "expectedNode": "Expression" }, "body": { "type": "ClassBody", - "start": 27, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":27,"end":29,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":29}}, "body": [] } } diff --git a/packages/babel-parser/test/fixtures/placeholders/export/declaration/output.json b/packages/babel-parser/test/fixtures/placeholders/export/declaration/output.json index a0cc4fb21147..4887a8756c34 100644 --- a/packages/babel-parser/test/fixtures/placeholders/export/declaration/output.json +++ b/packages/babel-parser/test/fixtures/placeholders/export/declaration/output.json @@ -1,79 +1,23 @@ { "type": "File", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "program": { "type": "Program", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExportNamedDeclaration", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "specifiers": [], "source": null, "declaration": { "type": "Placeholder", - "start": 7, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":7,"end":15,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":15}}, "name": { "type": "Identifier", - "start": 9, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 13 - }, - "identifierName": "DECL" - }, + "start":9,"end":13,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":13},"identifierName":"DECL"}, "name": "DECL" }, "expectedNode": "Declaration" @@ -81,18 +25,7 @@ }, { "type": "EmptyStatement", - "start": 15, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - } - } + "start":15,"end":16,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":16}} } ], "directives": [] diff --git a/packages/babel-parser/test/fixtures/placeholders/export/default-default-from/options.json b/packages/babel-parser/test/fixtures/placeholders/export/default-default-from/options.json index b3f883263b7b..c2396306e4fa 100644 --- a/packages/babel-parser/test/fixtures/placeholders/export/default-default-from/options.json +++ b/packages/babel-parser/test/fixtures/placeholders/export/default-default-from/options.json @@ -1,7 +1,5 @@ { - "plugins": [ - "placeholders" - ], + "plugins": ["placeholders"], "sourceType": "module", "throws": "This experimental syntax requires enabling the parser plugin: 'exportDefaultFrom' (1:7)" -} \ No newline at end of file +} diff --git a/packages/babel-parser/test/fixtures/placeholders/export/default-named-from-2/options.json b/packages/babel-parser/test/fixtures/placeholders/export/default-named-from-2/options.json index 404b94bc6cbe..9bc164c502b0 100644 --- a/packages/babel-parser/test/fixtures/placeholders/export/default-named-from-2/options.json +++ b/packages/babel-parser/test/fixtures/placeholders/export/default-named-from-2/options.json @@ -1,7 +1,5 @@ { - "plugins": [ - "placeholders" - ], + "plugins": ["placeholders"], "sourceType": "module", "throws": "This experimental syntax requires enabling the parser plugin: 'exportDefaultFrom' (1:16)" -} \ No newline at end of file +} diff --git a/packages/babel-parser/test/fixtures/placeholders/export/default-named-from-3/options.json b/packages/babel-parser/test/fixtures/placeholders/export/default-named-from-3/options.json index 404b94bc6cbe..9bc164c502b0 100644 --- a/packages/babel-parser/test/fixtures/placeholders/export/default-named-from-3/options.json +++ b/packages/babel-parser/test/fixtures/placeholders/export/default-named-from-3/options.json @@ -1,7 +1,5 @@ { - "plugins": [ - "placeholders" - ], + "plugins": ["placeholders"], "sourceType": "module", "throws": "This experimental syntax requires enabling the parser plugin: 'exportDefaultFrom' (1:16)" -} \ No newline at end of file +} diff --git a/packages/babel-parser/test/fixtures/placeholders/export/default-named-from/options.json b/packages/babel-parser/test/fixtures/placeholders/export/default-named-from/options.json index b3f883263b7b..c2396306e4fa 100644 --- a/packages/babel-parser/test/fixtures/placeholders/export/default-named-from/options.json +++ b/packages/babel-parser/test/fixtures/placeholders/export/default-named-from/options.json @@ -1,7 +1,5 @@ { - "plugins": [ - "placeholders" - ], + "plugins": ["placeholders"], "sourceType": "module", "throws": "This experimental syntax requires enabling the parser plugin: 'exportDefaultFrom' (1:7)" -} \ No newline at end of file +} diff --git a/packages/babel-parser/test/fixtures/placeholders/export/named-alias-2/output.json b/packages/babel-parser/test/fixtures/placeholders/export/named-alias-2/output.json index 3da7a5b3b526..272f92504b24 100644 --- a/packages/babel-parser/test/fixtures/placeholders/export/named-alias-2/output.json +++ b/packages/babel-parser/test/fixtures/placeholders/export/named-alias-2/output.json @@ -1,109 +1,30 @@ { "type": "File", - "start": 0, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, "program": { "type": "Program", - "start": 0, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExportNamedDeclaration", - "start": 0, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, "specifiers": [ { "type": "ExportSpecifier", - "start": 9, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":9,"end":26,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":26}}, "local": { "type": "Identifier", - "start": 9, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 13 - }, - "identifierName": "name" - }, + "start":9,"end":13,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":13},"identifierName":"name"}, "name": "name" }, "exported": { "type": "Placeholder", - "start": 17, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":17,"end":26,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":26}}, "name": { "type": "Identifier", - "start": 19, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 24 - }, - "identifierName": "ALIAS" - }, + "start":19,"end":24,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":24},"identifierName":"ALIAS"}, "name": "ALIAS" }, "expectedNode": "Identifier" diff --git a/packages/babel-parser/test/fixtures/placeholders/export/named-alias-3/output.json b/packages/babel-parser/test/fixtures/placeholders/export/named-alias-3/output.json index 79bf65de1189..6b4908e154a6 100644 --- a/packages/babel-parser/test/fixtures/placeholders/export/named-alias-3/output.json +++ b/packages/babel-parser/test/fixtures/placeholders/export/named-alias-3/output.json @@ -1,125 +1,35 @@ { "type": "File", - "start": 0, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, "program": { "type": "Program", - "start": 0, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExportNamedDeclaration", - "start": 0, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, "specifiers": [ { "type": "ExportSpecifier", - "start": 9, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":9,"end":30,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":30}}, "local": { "type": "Placeholder", - "start": 9, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":9,"end":17,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":17}}, "name": { "type": "Identifier", - "start": 11, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 15 - }, - "identifierName": "NAME" - }, + "start":11,"end":15,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":15},"identifierName":"NAME"}, "name": "NAME" }, "expectedNode": "Identifier" }, "exported": { "type": "Placeholder", - "start": 21, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":21,"end":30,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":30}}, "name": { "type": "Identifier", - "start": 23, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 28 - }, - "identifierName": "ALIAS" - }, + "start":23,"end":28,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":28},"identifierName":"ALIAS"}, "name": "ALIAS" }, "expectedNode": "Identifier" diff --git a/packages/babel-parser/test/fixtures/placeholders/export/named-alias/output.json b/packages/babel-parser/test/fixtures/placeholders/export/named-alias/output.json index ddabad2b64c7..254503184ba8 100644 --- a/packages/babel-parser/test/fixtures/placeholders/export/named-alias/output.json +++ b/packages/babel-parser/test/fixtures/placeholders/export/named-alias/output.json @@ -1,111 +1,32 @@ { "type": "File", - "start": 0, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, "program": { "type": "Program", - "start": 0, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExportNamedDeclaration", - "start": 0, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, "specifiers": [ { "type": "ExportSpecifier", - "start": 9, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":9,"end":26,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":26}}, "local": { "type": "Placeholder", - "start": 9, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":9,"end":17,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":17}}, "name": { "type": "Identifier", - "start": 11, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 15 - }, - "identifierName": "NAME" - }, + "start":11,"end":15,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":15},"identifierName":"NAME"}, "name": "NAME" }, "expectedNode": "Identifier" }, "exported": { "type": "Identifier", - "start": 21, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 26 - }, - "identifierName": "alias" - }, + "start":21,"end":26,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":26},"identifierName":"alias"}, "name": "alias" } } diff --git a/packages/babel-parser/test/fixtures/placeholders/export/named-from-2/output.json b/packages/babel-parser/test/fixtures/placeholders/export/named-from-2/output.json index 5d7db268eb97..55842e9c465c 100644 --- a/packages/babel-parser/test/fixtures/placeholders/export/named-from-2/output.json +++ b/packages/babel-parser/test/fixtures/placeholders/export/named-from-2/output.json @@ -1,128 +1,37 @@ { "type": "File", - "start": 0, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, "program": { "type": "Program", - "start": 0, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExportNamedDeclaration", - "start": 0, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, "specifiers": [ { "type": "ExportSpecifier", - "start": 9, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":9,"end":13,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":13}}, "local": { "type": "Identifier", - "start": 9, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 13 - }, - "identifierName": "name" - }, + "start":9,"end":13,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":13},"identifierName":"name"}, "name": "name" }, "exported": { "type": "Identifier", - "start": 9, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 13 - }, - "identifierName": "name" - }, + "start":9,"end":13,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":13},"identifierName":"name"}, "name": "name" } } ], "source": { "type": "Placeholder", - "start": 21, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":21,"end":29,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":29}}, "name": { "type": "Identifier", - "start": 23, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 27 - }, - "identifierName": "FILE" - }, + "start":23,"end":27,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":27},"identifierName":"FILE"}, "name": "FILE" }, "expectedNode": "StringLiteral" diff --git a/packages/babel-parser/test/fixtures/placeholders/export/named-from-3/output.json b/packages/babel-parser/test/fixtures/placeholders/export/named-from-3/output.json index f89643fc0a7b..69e81274c952 100644 --- a/packages/babel-parser/test/fixtures/placeholders/export/named-from-3/output.json +++ b/packages/babel-parser/test/fixtures/placeholders/export/named-from-3/output.json @@ -1,125 +1,35 @@ { "type": "File", - "start": 0, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, "program": { "type": "Program", - "start": 0, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExportNamedDeclaration", - "start": 0, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, "specifiers": [ { "type": "ExportSpecifier", - "start": 9, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":9,"end":17,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":17}}, "local": { "type": "Placeholder", - "start": 9, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":9,"end":17,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":17}}, "name": { "type": "Identifier", - "start": 11, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 15 - }, - "identifierName": "NAME" - }, + "start":11,"end":15,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":15},"identifierName":"NAME"}, "name": "NAME" }, "expectedNode": "Identifier" }, "exported": { "type": "Placeholder", - "start": 9, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":9,"end":17,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":17}}, "name": { "type": "Identifier", - "start": 11, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 15 - }, - "identifierName": "NAME" - }, + "start":11,"end":15,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":15},"identifierName":"NAME"}, "name": "NAME" }, "expectedNode": "Identifier" @@ -128,33 +38,10 @@ ], "source": { "type": "Placeholder", - "start": 25, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":25,"end":33,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":33}}, "name": { "type": "Identifier", - "start": 27, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 31 - }, - "identifierName": "FILE" - }, + "start":27,"end":31,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":31},"identifierName":"FILE"}, "name": "FILE" }, "expectedNode": "StringLiteral" diff --git a/packages/babel-parser/test/fixtures/placeholders/export/named-from-alias-2/output.json b/packages/babel-parser/test/fixtures/placeholders/export/named-from-alias-2/output.json index 637b5256b845..cb1bc9f9c9fa 100644 --- a/packages/babel-parser/test/fixtures/placeholders/export/named-from-alias-2/output.json +++ b/packages/babel-parser/test/fixtures/placeholders/export/named-from-alias-2/output.json @@ -1,109 +1,30 @@ { "type": "File", - "start": 0, - "end": 41, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 41 - } - }, + "start":0,"end":41,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":41}}, "program": { "type": "Program", - "start": 0, - "end": 41, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 41 - } - }, + "start":0,"end":41,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":41}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExportNamedDeclaration", - "start": 0, - "end": 41, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 41 - } - }, + "start":0,"end":41,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":41}}, "specifiers": [ { "type": "ExportSpecifier", - "start": 9, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":9,"end":26,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":26}}, "local": { "type": "Identifier", - "start": 9, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 13 - }, - "identifierName": "name" - }, + "start":9,"end":13,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":13},"identifierName":"name"}, "name": "name" }, "exported": { "type": "Placeholder", - "start": 17, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":17,"end":26,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":26}}, "name": { "type": "Identifier", - "start": 19, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 24 - }, - "identifierName": "ALIAS" - }, + "start":19,"end":24,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":24},"identifierName":"ALIAS"}, "name": "ALIAS" }, "expectedNode": "Identifier" @@ -112,18 +33,7 @@ ], "source": { "type": "StringLiteral", - "start": 34, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 34 - }, - "end": { - "line": 1, - "column": 40 - } - }, + "start":34,"end":40,"loc":{"start":{"line":1,"column":34},"end":{"line":1,"column":40}}, "extra": { "rawValue": "file", "raw": "\"file\"" diff --git a/packages/babel-parser/test/fixtures/placeholders/export/named-from-alias-3/output.json b/packages/babel-parser/test/fixtures/placeholders/export/named-from-alias-3/output.json index 2fd4cc6f3a99..7960edf4baab 100644 --- a/packages/babel-parser/test/fixtures/placeholders/export/named-from-alias-3/output.json +++ b/packages/babel-parser/test/fixtures/placeholders/export/named-from-alias-3/output.json @@ -1,125 +1,35 @@ { "type": "File", - "start": 0, - "end": 45, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 45 - } - }, + "start":0,"end":45,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":45}}, "program": { "type": "Program", - "start": 0, - "end": 45, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 45 - } - }, + "start":0,"end":45,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":45}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExportNamedDeclaration", - "start": 0, - "end": 45, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 45 - } - }, + "start":0,"end":45,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":45}}, "specifiers": [ { "type": "ExportSpecifier", - "start": 9, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":9,"end":30,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":30}}, "local": { "type": "Placeholder", - "start": 9, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":9,"end":17,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":17}}, "name": { "type": "Identifier", - "start": 11, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 15 - }, - "identifierName": "NAME" - }, + "start":11,"end":15,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":15},"identifierName":"NAME"}, "name": "NAME" }, "expectedNode": "Identifier" }, "exported": { "type": "Placeholder", - "start": 21, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":21,"end":30,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":30}}, "name": { "type": "Identifier", - "start": 23, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 28 - }, - "identifierName": "ALIAS" - }, + "start":23,"end":28,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":28},"identifierName":"ALIAS"}, "name": "ALIAS" }, "expectedNode": "Identifier" @@ -128,18 +38,7 @@ ], "source": { "type": "StringLiteral", - "start": 38, - "end": 44, - "loc": { - "start": { - "line": 1, - "column": 38 - }, - "end": { - "line": 1, - "column": 44 - } - }, + "start":38,"end":44,"loc":{"start":{"line":1,"column":38},"end":{"line":1,"column":44}}, "extra": { "rawValue": "file", "raw": "\"file\"" diff --git a/packages/babel-parser/test/fixtures/placeholders/export/named-from-alias/output.json b/packages/babel-parser/test/fixtures/placeholders/export/named-from-alias/output.json index 34e8dd6e3a04..17aec6b58595 100644 --- a/packages/babel-parser/test/fixtures/placeholders/export/named-from-alias/output.json +++ b/packages/babel-parser/test/fixtures/placeholders/export/named-from-alias/output.json @@ -1,129 +1,39 @@ { "type": "File", - "start": 0, - "end": 41, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 41 - } - }, + "start":0,"end":41,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":41}}, "program": { "type": "Program", - "start": 0, - "end": 41, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 41 - } - }, + "start":0,"end":41,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":41}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExportNamedDeclaration", - "start": 0, - "end": 41, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 41 - } - }, + "start":0,"end":41,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":41}}, "specifiers": [ { "type": "ExportSpecifier", - "start": 9, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":9,"end":26,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":26}}, "local": { "type": "Placeholder", - "start": 9, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":9,"end":17,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":17}}, "name": { "type": "Identifier", - "start": 11, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 15 - }, - "identifierName": "NAME" - }, + "start":11,"end":15,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":15},"identifierName":"NAME"}, "name": "NAME" }, "expectedNode": "Identifier" }, "exported": { "type": "Identifier", - "start": 21, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 26 - }, - "identifierName": "alias" - }, + "start":21,"end":26,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":26},"identifierName":"alias"}, "name": "alias" } } ], "source": { "type": "StringLiteral", - "start": 34, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 34 - }, - "end": { - "line": 1, - "column": 40 - } - }, + "start":34,"end":40,"loc":{"start":{"line":1,"column":34},"end":{"line":1,"column":40}}, "extra": { "rawValue": "file", "raw": "\"file\"" diff --git a/packages/babel-parser/test/fixtures/placeholders/export/named-from/output.json b/packages/babel-parser/test/fixtures/placeholders/export/named-from/output.json index 5c9ae8516dd4..a33db15edbc5 100644 --- a/packages/babel-parser/test/fixtures/placeholders/export/named-from/output.json +++ b/packages/babel-parser/test/fixtures/placeholders/export/named-from/output.json @@ -1,125 +1,35 @@ { "type": "File", - "start": 0, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, "program": { "type": "Program", - "start": 0, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExportNamedDeclaration", - "start": 0, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, "specifiers": [ { "type": "ExportSpecifier", - "start": 9, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":9,"end":17,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":17}}, "local": { "type": "Placeholder", - "start": 9, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":9,"end":17,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":17}}, "name": { "type": "Identifier", - "start": 11, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 15 - }, - "identifierName": "NAME" - }, + "start":11,"end":15,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":15},"identifierName":"NAME"}, "name": "NAME" }, "expectedNode": "Identifier" }, "exported": { "type": "Placeholder", - "start": 9, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":9,"end":17,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":17}}, "name": { "type": "Identifier", - "start": 11, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 15 - }, - "identifierName": "NAME" - }, + "start":11,"end":15,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":15},"identifierName":"NAME"}, "name": "NAME" }, "expectedNode": "Identifier" @@ -128,18 +38,7 @@ ], "source": { "type": "StringLiteral", - "start": 25, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":25,"end":31,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":31}}, "extra": { "rawValue": "file", "raw": "\"file\"" diff --git a/packages/babel-parser/test/fixtures/placeholders/export/named/output.json b/packages/babel-parser/test/fixtures/placeholders/export/named/output.json index 67b0f0429f79..251f78d866c6 100644 --- a/packages/babel-parser/test/fixtures/placeholders/export/named/output.json +++ b/packages/babel-parser/test/fixtures/placeholders/export/named/output.json @@ -1,125 +1,35 @@ { "type": "File", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, "program": { "type": "Program", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExportNamedDeclaration", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, "specifiers": [ { "type": "ExportSpecifier", - "start": 9, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":9,"end":17,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":17}}, "local": { "type": "Placeholder", - "start": 9, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":9,"end":17,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":17}}, "name": { "type": "Identifier", - "start": 11, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 15 - }, - "identifierName": "NAME" - }, + "start":11,"end":15,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":15},"identifierName":"NAME"}, "name": "NAME" }, "expectedNode": "Identifier" }, "exported": { "type": "Placeholder", - "start": 9, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":9,"end":17,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":17}}, "name": { "type": "Identifier", - "start": 11, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 15 - }, - "identifierName": "NAME" - }, + "start":11,"end":15,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":15},"identifierName":"NAME"}, "name": "NAME" }, "expectedNode": "Identifier" diff --git a/packages/babel-parser/test/fixtures/placeholders/export/options.json b/packages/babel-parser/test/fixtures/placeholders/export/options.json index e7ff26ae7014..14a812b67661 100644 --- a/packages/babel-parser/test/fixtures/placeholders/export/options.json +++ b/packages/babel-parser/test/fixtures/placeholders/export/options.json @@ -1,4 +1,4 @@ { - "plugins": ["placeholders", "exportDefaultFrom", "exportNamespaceFrom"], + "plugins": ["placeholders", "exportDefaultFrom"], "sourceType": "module" } diff --git a/packages/babel-parser/test/fixtures/placeholders/export/star-from-2/options.json b/packages/babel-parser/test/fixtures/placeholders/export/star-from-2/options.json index 8c48e4fc0f20..986e9cefa93e 100644 --- a/packages/babel-parser/test/fixtures/placeholders/export/star-from-2/options.json +++ b/packages/babel-parser/test/fixtures/placeholders/export/star-from-2/options.json @@ -1,7 +1,4 @@ { - "plugins": [ - "placeholders" - ], - "sourceType": "module", - "throws": "This experimental syntax requires enabling the parser plugin: 'exportNamespaceFrom' (1:9)" -} \ No newline at end of file + "plugins": ["placeholders"], + "sourceType": "module" +} diff --git a/packages/babel-parser/test/fixtures/placeholders/export/star-from-2/output.json b/packages/babel-parser/test/fixtures/placeholders/export/star-from-2/output.json new file mode 100644 index 000000000000..1e90f81ce456 --- /dev/null +++ b/packages/babel-parser/test/fixtures/placeholders/export/star-from-2/output.json @@ -0,0 +1,42 @@ +{ + "type": "File", + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, + "program": { + "type": "Program", + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExportNamedDeclaration", + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, + "specifiers": [ + { + "type": "ExportNamespaceSpecifier", + "start":7,"end":20,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":20}}, + "exported": { + "type": "Placeholder", + "start":12,"end":20,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":20}}, + "name": { + "type": "Identifier", + "start":14,"end":18,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":18},"identifierName":"STAR"}, + "name": "STAR" + }, + "expectedNode": "Identifier" + } + } + ], + "source": { + "type": "StringLiteral", + "start":26,"end":32,"loc":{"start":{"line":1,"column":26},"end":{"line":1,"column":32}}, + "extra": { + "rawValue": "file", + "raw": "\"file\"" + }, + "value": "file" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/placeholders/export/star-from-3/options.json b/packages/babel-parser/test/fixtures/placeholders/export/star-from-3/options.json index 8c48e4fc0f20..986e9cefa93e 100644 --- a/packages/babel-parser/test/fixtures/placeholders/export/star-from-3/options.json +++ b/packages/babel-parser/test/fixtures/placeholders/export/star-from-3/options.json @@ -1,7 +1,4 @@ { - "plugins": [ - "placeholders" - ], - "sourceType": "module", - "throws": "This experimental syntax requires enabling the parser plugin: 'exportNamespaceFrom' (1:9)" -} \ No newline at end of file + "plugins": ["placeholders"], + "sourceType": "module" +} diff --git a/packages/babel-parser/test/fixtures/placeholders/export/star-from-3/output.json b/packages/babel-parser/test/fixtures/placeholders/export/star-from-3/output.json new file mode 100644 index 000000000000..4ea4409c0637 --- /dev/null +++ b/packages/babel-parser/test/fixtures/placeholders/export/star-from-3/output.json @@ -0,0 +1,43 @@ +{ + "type": "File", + "start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":35}}, + "program": { + "type": "Program", + "start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":35}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExportNamedDeclaration", + "start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":35}}, + "specifiers": [ + { + "type": "ExportNamespaceSpecifier", + "start":7,"end":20,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":20}}, + "exported": { + "type": "Placeholder", + "start":12,"end":20,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":20}}, + "name": { + "type": "Identifier", + "start":14,"end":18,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":18},"identifierName":"STAR"}, + "name": "STAR" + }, + "expectedNode": "Identifier" + } + } + ], + "source": { + "type": "Placeholder", + "start":26,"end":34,"loc":{"start":{"line":1,"column":26},"end":{"line":1,"column":34}}, + "name": { + "type": "Identifier", + "start":28,"end":32,"loc":{"start":{"line":1,"column":28},"end":{"line":1,"column":32},"identifierName":"FILE"}, + "name": "FILE" + }, + "expectedNode": "StringLiteral" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/placeholders/export/star-from/output.json b/packages/babel-parser/test/fixtures/placeholders/export/star-from/output.json index 87a301212145..68d516b0d9f0 100644 --- a/packages/babel-parser/test/fixtures/placeholders/export/star-from/output.json +++ b/packages/babel-parser/test/fixtures/placeholders/export/star-from/output.json @@ -1,77 +1,21 @@ { "type": "File", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "program": { "type": "Program", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExportAllDeclaration", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "source": { "type": "Placeholder", - "start": 14, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":14,"end":22,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":22}}, "name": { "type": "Identifier", - "start": 16, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 20 - }, - "identifierName": "FILE" - }, + "start":16,"end":20,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":20},"identifierName":"FILE"}, "name": "FILE" }, "expectedNode": "StringLiteral" diff --git a/packages/babel-parser/test/fixtures/placeholders/expression/01/output.json b/packages/babel-parser/test/fixtures/placeholders/expression/01/output.json index 9de9b6f77eda..186d0eead51e 100644 --- a/packages/babel-parser/test/fixtures/placeholders/expression/01/output.json +++ b/packages/babel-parser/test/fixtures/placeholders/expression/01/output.json @@ -1,91 +1,24 @@ { "type": "File", - "start": 0, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, "program": { "type": "Program", - "start": 0, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, "expression": { "type": "BinaryExpression", - "start": 0, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, "left": { "type": "Placeholder", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "name": { "type": "Identifier", - "start": 2, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "FOO" - }, + "start":2,"end":5,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":5},"identifierName":"FOO"}, "name": "FOO" }, "expectedNode": "Expression" @@ -93,47 +26,13 @@ "operator": "+", "right": { "type": "CallExpression", - "start": 10, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":10,"end":26,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":26}}, "callee": { "type": "Placeholder", - "start": 10, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":10,"end":17,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":17}}, "name": { "type": "Identifier", - "start": 12, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 15 - }, - "identifierName": "BAR" - }, + "start":12,"end":15,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":15},"identifierName":"BAR"}, "name": "BAR" }, "expectedNode": "Expression" @@ -141,33 +40,10 @@ "arguments": [ { "type": "Placeholder", - "start": 18, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":18,"end":25,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":25}}, "name": { "type": "Identifier", - "start": 20, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 23 - }, - "identifierName": "BAZ" - }, + "start":20,"end":23,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":23},"identifierName":"BAZ"}, "name": "BAZ" }, "expectedNode": "Expression" diff --git a/packages/babel-parser/test/fixtures/placeholders/function/body/output.json b/packages/babel-parser/test/fixtures/placeholders/function/body/output.json index 3139e3132180..a7122229e1d8 100644 --- a/packages/babel-parser/test/fixtures/placeholders/function/body/output.json +++ b/packages/babel-parser/test/fixtures/placeholders/function/body/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, "program": { "type": "Program", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, "id": { "type": "Identifier", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - }, - "identifierName": "f" - }, + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"f"}, "name": "f" }, "generator": false, @@ -65,33 +20,10 @@ "params": [], "body": { "type": "Placeholder", - "start": 13, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":13,"end":21,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":21}}, "name": { "type": "Identifier", - "start": 15, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 19 - }, - "identifierName": "BODY" - }, + "start":15,"end":19,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":19},"identifierName":"BODY"}, "name": "BODY" }, "expectedNode": "BlockStatement" diff --git a/packages/babel-parser/test/fixtures/placeholders/function/id-params-body/output.json b/packages/babel-parser/test/fixtures/placeholders/function/id-params-body/output.json index fd6205f7ab8e..d8b659b17848 100644 --- a/packages/babel-parser/test/fixtures/placeholders/function/id-params-body/output.json +++ b/packages/babel-parser/test/fixtures/placeholders/function/id-params-body/output.json @@ -1,77 +1,21 @@ { "type": "File", - "start": 0, - "end": 46, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 46 - } - }, + "start":0,"end":46,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":46}}, "program": { "type": "Program", - "start": 0, - "end": 46, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 46 - } - }, + "start":0,"end":46,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":46}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 46, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 46 - } - }, + "start":0,"end":46,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":46}}, "id": { "type": "Placeholder", - "start": 9, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":9,"end":15,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":15}}, "name": { "type": "Identifier", - "start": 11, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 13 - }, - "identifierName": "ID" - }, + "start":11,"end":13,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":13},"identifierName":"ID"}, "name": "ID" }, "expectedNode": "Identifier" @@ -81,66 +25,20 @@ "params": [ { "type": "Placeholder", - "start": 16, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":16,"end":25,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":25}}, "name": { "type": "Identifier", - "start": 18, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 23 - }, - "identifierName": "PARAM" - }, + "start":18,"end":23,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":23},"identifierName":"PARAM"}, "name": "PARAM" }, "expectedNode": "Pattern" }, { "type": "Placeholder", - "start": 27, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":27,"end":36,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":36}}, "name": { "type": "Identifier", - "start": 29, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 1, - "column": 34 - }, - "identifierName": "PARAM" - }, + "start":29,"end":34,"loc":{"start":{"line":1,"column":29},"end":{"line":1,"column":34},"identifierName":"PARAM"}, "name": "PARAM" }, "expectedNode": "Pattern" @@ -148,33 +46,10 @@ ], "body": { "type": "Placeholder", - "start": 38, - "end": 46, - "loc": { - "start": { - "line": 1, - "column": 38 - }, - "end": { - "line": 1, - "column": 46 - } - }, + "start":38,"end":46,"loc":{"start":{"line":1,"column":38},"end":{"line":1,"column":46}}, "name": { "type": "Identifier", - "start": 40, - "end": 44, - "loc": { - "start": { - "line": 1, - "column": 40 - }, - "end": { - "line": 1, - "column": 44 - }, - "identifierName": "BODY" - }, + "start":40,"end":44,"loc":{"start":{"line":1,"column":40},"end":{"line":1,"column":44},"identifierName":"BODY"}, "name": "BODY" }, "expectedNode": "BlockStatement" diff --git a/packages/babel-parser/test/fixtures/placeholders/function/id_declaration/output.json b/packages/babel-parser/test/fixtures/placeholders/function/id_declaration/output.json index a07531190e7d..e0b4961dfe3a 100644 --- a/packages/babel-parser/test/fixtures/placeholders/function/id_declaration/output.json +++ b/packages/babel-parser/test/fixtures/placeholders/function/id_declaration/output.json @@ -1,77 +1,21 @@ { "type": "File", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, "program": { "type": "Program", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, "id": { "type": "Placeholder", - "start": 9, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":9,"end":15,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":15}}, "name": { "type": "Identifier", - "start": 11, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 13 - }, - "identifierName": "ID" - }, + "start":11,"end":13,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":13},"identifierName":"ID"}, "name": "ID" }, "expectedNode": "Identifier" @@ -81,18 +25,7 @@ "params": [], "body": { "type": "BlockStatement", - "start": 18, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":18,"end":20,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":20}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/placeholders/function/id_expression/output.json b/packages/babel-parser/test/fixtures/placeholders/function/id_expression/output.json index 1bc90cefa7fc..673783c39ee3 100644 --- a/packages/babel-parser/test/fixtures/placeholders/function/id_expression/output.json +++ b/packages/babel-parser/test/fixtures/placeholders/function/id_expression/output.json @@ -1,107 +1,29 @@ { "type": "File", - "start": 0, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, "program": { "type": "Program", - "start": 0, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, "expression": { "type": "UnaryExpression", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, "operator": "void", "prefix": true, "argument": { "type": "FunctionExpression", - "start": 5, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":5,"end":25,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":25}}, "id": { "type": "Placeholder", - "start": 14, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":14,"end":20,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":20}}, "name": { "type": "Identifier", - "start": 16, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 18 - }, - "identifierName": "ID" - }, + "start":16,"end":18,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":18},"identifierName":"ID"}, "name": "ID" }, "expectedNode": "Identifier" @@ -111,18 +33,7 @@ "params": [], "body": { "type": "BlockStatement", - "start": 23, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":23,"end":25,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":25}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/placeholders/function/param/output.json b/packages/babel-parser/test/fixtures/placeholders/function/param/output.json index 9026f46c40db..0bf00557e708 100644 --- a/packages/babel-parser/test/fixtures/placeholders/function/param/output.json +++ b/packages/babel-parser/test/fixtures/placeholders/function/param/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "program": { "type": "Program", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "id": { "type": "Identifier", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - }, - "identifierName": "f" - }, + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"f"}, "name": "f" }, "generator": false, @@ -65,33 +20,10 @@ "params": [ { "type": "Placeholder", - "start": 11, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":11,"end":20,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":20}}, "name": { "type": "Identifier", - "start": 13, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 18 - }, - "identifierName": "PARAM" - }, + "start":13,"end":18,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":18},"identifierName":"PARAM"}, "name": "PARAM" }, "expectedNode": "Pattern" @@ -99,18 +31,7 @@ ], "body": { "type": "BlockStatement", - "start": 22, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":22,"end":24,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":24}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/placeholders/import/default-file/output.json b/packages/babel-parser/test/fixtures/placeholders/import/default-file/output.json index b4fdc7e984fa..75a10d9171c2 100644 --- a/packages/babel-parser/test/fixtures/placeholders/import/default-file/output.json +++ b/packages/babel-parser/test/fixtures/placeholders/import/default-file/output.json @@ -1,92 +1,25 @@ { "type": "File", - "start": 0, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, "program": { "type": "Program", - "start": 0, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ImportDeclaration", - "start": 0, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, "specifiers": [ { "type": "ImportDefaultSpecifier", - "start": 7, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":7,"end":18,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":18}}, "local": { "type": "Placeholder", - "start": 7, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":7,"end":18,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":18}}, "name": { "type": "Identifier", - "start": 9, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 16 - }, - "identifierName": "DEFAULT" - }, + "start":9,"end":16,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":16},"identifierName":"DEFAULT"}, "name": "DEFAULT" }, "expectedNode": "Identifier" @@ -95,33 +28,10 @@ ], "source": { "type": "Placeholder", - "start": 24, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":24,"end":32,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":32}}, "name": { "type": "Identifier", - "start": 26, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 30 - }, - "identifierName": "FILE" - }, + "start":26,"end":30,"loc":{"start":{"line":1,"column":26},"end":{"line":1,"column":30},"identifierName":"FILE"}, "name": "FILE" }, "expectedNode": "StringLiteral" diff --git a/packages/babel-parser/test/fixtures/placeholders/import/default-named-2/output.json b/packages/babel-parser/test/fixtures/placeholders/import/default-named-2/output.json index 3ec417645be0..807b8ef9e4fe 100644 --- a/packages/babel-parser/test/fixtures/placeholders/import/default-named-2/output.json +++ b/packages/babel-parser/test/fixtures/placeholders/import/default-named-2/output.json @@ -1,92 +1,25 @@ { "type": "File", - "start": 0, - "end": 42, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 42 - } - }, + "start":0,"end":42,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":42}}, "program": { "type": "Program", - "start": 0, - "end": 42, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 42 - } - }, + "start":0,"end":42,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":42}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ImportDeclaration", - "start": 0, - "end": 42, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 42 - } - }, + "start":0,"end":42,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":42}}, "specifiers": [ { "type": "ImportDefaultSpecifier", - "start": 7, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":7,"end":18,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":18}}, "local": { "type": "Placeholder", - "start": 7, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":7,"end":18,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":18}}, "name": { "type": "Identifier", - "start": 9, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 16 - }, - "identifierName": "DEFAULT" - }, + "start":9,"end":16,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":16},"identifierName":"DEFAULT"}, "name": "DEFAULT" }, "expectedNode": "Identifier" @@ -94,68 +27,22 @@ }, { "type": "ImportSpecifier", - "start": 22, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":22,"end":27,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":27}}, "imported": { "type": "Identifier", - "start": 22, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 27 - }, - "identifierName": "named" - }, + "start":22,"end":27,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":27},"identifierName":"named"}, "name": "named" }, "local": { "type": "Identifier", - "start": 22, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 27 - }, - "identifierName": "named" - }, + "start":22,"end":27,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":27},"identifierName":"named"}, "name": "named" } } ], "source": { "type": "StringLiteral", - "start": 35, - "end": 41, - "loc": { - "start": { - "line": 1, - "column": 35 - }, - "end": { - "line": 1, - "column": 41 - } - }, + "start":35,"end":41,"loc":{"start":{"line":1,"column":35},"end":{"line":1,"column":41}}, "extra": { "rawValue": "file", "raw": "\"file\"" diff --git a/packages/babel-parser/test/fixtures/placeholders/import/default-named-3/output.json b/packages/babel-parser/test/fixtures/placeholders/import/default-named-3/output.json index e681ffb18417..fe0e247d127a 100644 --- a/packages/babel-parser/test/fixtures/placeholders/import/default-named-3/output.json +++ b/packages/babel-parser/test/fixtures/placeholders/import/default-named-3/output.json @@ -1,92 +1,25 @@ { "type": "File", - "start": 0, - "end": 46, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 46 - } - }, + "start":0,"end":46,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":46}}, "program": { "type": "Program", - "start": 0, - "end": 46, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 46 - } - }, + "start":0,"end":46,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":46}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ImportDeclaration", - "start": 0, - "end": 46, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 46 - } - }, + "start":0,"end":46,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":46}}, "specifiers": [ { "type": "ImportDefaultSpecifier", - "start": 7, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":7,"end":18,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":18}}, "local": { "type": "Placeholder", - "start": 7, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":7,"end":18,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":18}}, "name": { "type": "Identifier", - "start": 9, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 16 - }, - "identifierName": "DEFAULT" - }, + "start":9,"end":16,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":16},"identifierName":"DEFAULT"}, "name": "DEFAULT" }, "expectedNode": "Identifier" @@ -94,80 +27,23 @@ }, { "type": "ImportSpecifier", - "start": 22, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":22,"end":31,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":31}}, "imported": { "type": "Placeholder", - "start": 22, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":22,"end":31,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":31}}, "name": { "type": "Identifier", - "start": 24, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 29 - }, - "identifierName": "NAMED" - }, + "start":24,"end":29,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":29},"identifierName":"NAMED"}, "name": "NAMED" }, "expectedNode": "Identifier" }, "local": { "type": "Placeholder", - "start": 22, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":22,"end":31,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":31}}, "name": { "type": "Identifier", - "start": 24, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 29 - }, - "identifierName": "NAMED" - }, + "start":24,"end":29,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":29},"identifierName":"NAMED"}, "name": "NAMED" }, "expectedNode": "Identifier" @@ -176,18 +52,7 @@ ], "source": { "type": "StringLiteral", - "start": 39, - "end": 45, - "loc": { - "start": { - "line": 1, - "column": 39 - }, - "end": { - "line": 1, - "column": 45 - } - }, + "start":39,"end":45,"loc":{"start":{"line":1,"column":39},"end":{"line":1,"column":45}}, "extra": { "rawValue": "file", "raw": "\"file\"" diff --git a/packages/babel-parser/test/fixtures/placeholders/import/default-named/output.json b/packages/babel-parser/test/fixtures/placeholders/import/default-named/output.json index 62d764263d3d..d46d85c82643 100644 --- a/packages/babel-parser/test/fixtures/placeholders/import/default-named/output.json +++ b/packages/babel-parser/test/fixtures/placeholders/import/default-named/output.json @@ -1,157 +1,44 @@ { "type": "File", - "start": 0, - "end": 43, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 43 - } - }, + "start":0,"end":43,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":43}}, "program": { "type": "Program", - "start": 0, - "end": 43, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 43 - } - }, + "start":0,"end":43,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":43}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ImportDeclaration", - "start": 0, - "end": 43, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 43 - } - }, + "start":0,"end":43,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":43}}, "specifiers": [ { "type": "ImportDefaultSpecifier", - "start": 7, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":7,"end":15,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":15}}, "local": { "type": "Identifier", - "start": 7, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 15 - }, - "identifierName": "_default" - }, + "start":7,"end":15,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":15},"identifierName":"_default"}, "name": "_default" } }, { "type": "ImportSpecifier", - "start": 19, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":19,"end":28,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":28}}, "imported": { "type": "Placeholder", - "start": 19, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":19,"end":28,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":28}}, "name": { "type": "Identifier", - "start": 21, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 26 - }, - "identifierName": "NAMED" - }, + "start":21,"end":26,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":26},"identifierName":"NAMED"}, "name": "NAMED" }, "expectedNode": "Identifier" }, "local": { "type": "Placeholder", - "start": 19, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":19,"end":28,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":28}}, "name": { "type": "Identifier", - "start": 21, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 26 - }, - "identifierName": "NAMED" - }, + "start":21,"end":26,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":26},"identifierName":"NAMED"}, "name": "NAMED" }, "expectedNode": "Identifier" @@ -160,18 +47,7 @@ ], "source": { "type": "StringLiteral", - "start": 36, - "end": 42, - "loc": { - "start": { - "line": 1, - "column": 36 - }, - "end": { - "line": 1, - "column": 42 - } - }, + "start":36,"end":42,"loc":{"start":{"line":1,"column":36},"end":{"line":1,"column":42}}, "extra": { "rawValue": "file", "raw": "\"file\"" diff --git a/packages/babel-parser/test/fixtures/placeholders/import/default-star-2/output.json b/packages/babel-parser/test/fixtures/placeholders/import/default-star-2/output.json index 6fd8a2dbed1f..1fb751ada336 100644 --- a/packages/babel-parser/test/fixtures/placeholders/import/default-star-2/output.json +++ b/packages/babel-parser/test/fixtures/placeholders/import/default-star-2/output.json @@ -1,124 +1,34 @@ { "type": "File", - "start": 0, - "end": 43, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 43 - } - }, + "start":0,"end":43,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":43}}, "program": { "type": "Program", - "start": 0, - "end": 43, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 43 - } - }, + "start":0,"end":43,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":43}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ImportDeclaration", - "start": 0, - "end": 43, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 43 - } - }, + "start":0,"end":43,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":43}}, "specifiers": [ { "type": "ImportDefaultSpecifier", - "start": 7, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":7,"end":15,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":15}}, "local": { "type": "Identifier", - "start": 7, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 15 - }, - "identifierName": "_default" - }, + "start":7,"end":15,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":15},"identifierName":"_default"}, "name": "_default" } }, { "type": "ImportNamespaceSpecifier", - "start": 17, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":17,"end":30,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":30}}, "local": { "type": "Placeholder", - "start": 22, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":22,"end":30,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":30}}, "name": { "type": "Identifier", - "start": 24, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 28 - }, - "identifierName": "STAR" - }, + "start":24,"end":28,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":28},"identifierName":"STAR"}, "name": "STAR" }, "expectedNode": "Identifier" @@ -127,18 +37,7 @@ ], "source": { "type": "StringLiteral", - "start": 36, - "end": 42, - "loc": { - "start": { - "line": 1, - "column": 36 - }, - "end": { - "line": 1, - "column": 42 - } - }, + "start":36,"end":42,"loc":{"start":{"line":1,"column":36},"end":{"line":1,"column":42}}, "extra": { "rawValue": "file", "raw": "\"file\"" diff --git a/packages/babel-parser/test/fixtures/placeholders/import/default-star-3/output.json b/packages/babel-parser/test/fixtures/placeholders/import/default-star-3/output.json index a92281d0746a..c77899f26242 100644 --- a/packages/babel-parser/test/fixtures/placeholders/import/default-star-3/output.json +++ b/packages/babel-parser/test/fixtures/placeholders/import/default-star-3/output.json @@ -1,92 +1,25 @@ { "type": "File", - "start": 0, - "end": 46, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 46 - } - }, + "start":0,"end":46,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":46}}, "program": { "type": "Program", - "start": 0, - "end": 46, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 46 - } - }, + "start":0,"end":46,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":46}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ImportDeclaration", - "start": 0, - "end": 46, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 46 - } - }, + "start":0,"end":46,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":46}}, "specifiers": [ { "type": "ImportDefaultSpecifier", - "start": 7, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":7,"end":18,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":18}}, "local": { "type": "Placeholder", - "start": 7, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":7,"end":18,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":18}}, "name": { "type": "Identifier", - "start": 9, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 16 - }, - "identifierName": "DEFAULT" - }, + "start":9,"end":16,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":16},"identifierName":"DEFAULT"}, "name": "DEFAULT" }, "expectedNode": "Identifier" @@ -94,47 +27,13 @@ }, { "type": "ImportNamespaceSpecifier", - "start": 20, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":20,"end":33,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":33}}, "local": { "type": "Placeholder", - "start": 25, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":25,"end":33,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":33}}, "name": { "type": "Identifier", - "start": 27, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 31 - }, - "identifierName": "STAR" - }, + "start":27,"end":31,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":31},"identifierName":"STAR"}, "name": "STAR" }, "expectedNode": "Identifier" @@ -143,18 +42,7 @@ ], "source": { "type": "StringLiteral", - "start": 39, - "end": 45, - "loc": { - "start": { - "line": 1, - "column": 39 - }, - "end": { - "line": 1, - "column": 45 - } - }, + "start":39,"end":45,"loc":{"start":{"line":1,"column":39},"end":{"line":1,"column":45}}, "extra": { "rawValue": "file", "raw": "\"file\"" diff --git a/packages/babel-parser/test/fixtures/placeholders/import/default-star/output.json b/packages/babel-parser/test/fixtures/placeholders/import/default-star/output.json index 3976944a46bc..7426dbf77409 100644 --- a/packages/babel-parser/test/fixtures/placeholders/import/default-star/output.json +++ b/packages/babel-parser/test/fixtures/placeholders/import/default-star/output.json @@ -1,92 +1,25 @@ { "type": "File", - "start": 0, - "end": 42, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 42 - } - }, + "start":0,"end":42,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":42}}, "program": { "type": "Program", - "start": 0, - "end": 42, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 42 - } - }, + "start":0,"end":42,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":42}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ImportDeclaration", - "start": 0, - "end": 42, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 42 - } - }, + "start":0,"end":42,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":42}}, "specifiers": [ { "type": "ImportDefaultSpecifier", - "start": 7, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":7,"end":18,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":18}}, "local": { "type": "Placeholder", - "start": 7, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":7,"end":18,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":18}}, "name": { "type": "Identifier", - "start": 9, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 16 - }, - "identifierName": "DEFAULT" - }, + "start":9,"end":16,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":16},"identifierName":"DEFAULT"}, "name": "DEFAULT" }, "expectedNode": "Identifier" @@ -94,51 +27,17 @@ }, { "type": "ImportNamespaceSpecifier", - "start": 20, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":20,"end":29,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":29}}, "local": { "type": "Identifier", - "start": 25, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 29 - }, - "identifierName": "star" - }, + "start":25,"end":29,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":29},"identifierName":"star"}, "name": "star" } } ], "source": { "type": "StringLiteral", - "start": 35, - "end": 41, - "loc": { - "start": { - "line": 1, - "column": 35 - }, - "end": { - "line": 1, - "column": 41 - } - }, + "start":35,"end":41,"loc":{"start":{"line":1,"column":35},"end":{"line":1,"column":41}}, "extra": { "rawValue": "file", "raw": "\"file\"" diff --git a/packages/babel-parser/test/fixtures/placeholders/import/default/output.json b/packages/babel-parser/test/fixtures/placeholders/import/default/output.json index 4ff06895645b..81e351c1d325 100644 --- a/packages/babel-parser/test/fixtures/placeholders/import/default/output.json +++ b/packages/babel-parser/test/fixtures/placeholders/import/default/output.json @@ -1,92 +1,25 @@ { "type": "File", - "start": 0, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, "program": { "type": "Program", - "start": 0, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ImportDeclaration", - "start": 0, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, "specifiers": [ { "type": "ImportDefaultSpecifier", - "start": 7, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":7,"end":18,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":18}}, "local": { "type": "Placeholder", - "start": 7, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":7,"end":18,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":18}}, "name": { "type": "Identifier", - "start": 9, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 16 - }, - "identifierName": "DEFAULT" - }, + "start":9,"end":16,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":16},"identifierName":"DEFAULT"}, "name": "DEFAULT" }, "expectedNode": "Identifier" @@ -95,18 +28,7 @@ ], "source": { "type": "StringLiteral", - "start": 24, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":24,"end":30,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":30}}, "extra": { "rawValue": "file", "raw": "\"file\"" diff --git a/packages/babel-parser/test/fixtures/placeholders/import/file-empty/output.json b/packages/babel-parser/test/fixtures/placeholders/import/file-empty/output.json index 5690ee81f00f..2b7e6735068e 100644 --- a/packages/babel-parser/test/fixtures/placeholders/import/file-empty/output.json +++ b/packages/babel-parser/test/fixtures/placeholders/import/file-empty/output.json @@ -1,78 +1,22 @@ { "type": "File", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "program": { "type": "Program", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ImportDeclaration", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "specifiers": [], "source": { "type": "Placeholder", - "start": 15, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":15,"end":23,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":23}}, "name": { "type": "Identifier", - "start": 17, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 21 - }, - "identifierName": "FILE" - }, + "start":17,"end":21,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":21},"identifierName":"FILE"}, "name": "FILE" }, "expectedNode": "StringLiteral" diff --git a/packages/babel-parser/test/fixtures/placeholders/import/file/output.json b/packages/babel-parser/test/fixtures/placeholders/import/file/output.json index e33e48771a60..d4af9626aa24 100644 --- a/packages/babel-parser/test/fixtures/placeholders/import/file/output.json +++ b/packages/babel-parser/test/fixtures/placeholders/import/file/output.json @@ -1,78 +1,22 @@ { "type": "File", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "program": { "type": "Program", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ImportDeclaration", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "specifiers": [], "source": { "type": "Placeholder", - "start": 7, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":7,"end":15,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":15}}, "name": { "type": "Identifier", - "start": 9, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 13 - }, - "identifierName": "FILE" - }, + "start":9,"end":13,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":13},"identifierName":"FILE"}, "name": "FILE" }, "expectedNode": "StringLiteral" diff --git a/packages/babel-parser/test/fixtures/placeholders/import/named-alias-2/output.json b/packages/babel-parser/test/fixtures/placeholders/import/named-alias-2/output.json index c7d936e96c64..b52ba4d5dd43 100644 --- a/packages/babel-parser/test/fixtures/placeholders/import/named-alias-2/output.json +++ b/packages/babel-parser/test/fixtures/placeholders/import/named-alias-2/output.json @@ -1,129 +1,39 @@ { "type": "File", - "start": 0, - "end": 42, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 42 - } - }, + "start":0,"end":42,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":42}}, "program": { "type": "Program", - "start": 0, - "end": 42, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 42 - } - }, + "start":0,"end":42,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":42}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ImportDeclaration", - "start": 0, - "end": 42, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 42 - } - }, + "start":0,"end":42,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":42}}, "specifiers": [ { "type": "ImportSpecifier", - "start": 9, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":9,"end":27,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":27}}, "imported": { "type": "Placeholder", - "start": 9, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":9,"end":18,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":18}}, "name": { "type": "Identifier", - "start": 11, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 16 - }, - "identifierName": "NAMED" - }, + "start":11,"end":16,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":16},"identifierName":"NAMED"}, "name": "NAMED" }, "expectedNode": "Identifier" }, "local": { "type": "Identifier", - "start": 22, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 27 - }, - "identifierName": "alias" - }, + "start":22,"end":27,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":27},"identifierName":"alias"}, "name": "alias" } } ], "source": { "type": "StringLiteral", - "start": 35, - "end": 41, - "loc": { - "start": { - "line": 1, - "column": 35 - }, - "end": { - "line": 1, - "column": 41 - } - }, + "start":35,"end":41,"loc":{"start":{"line":1,"column":35},"end":{"line":1,"column":41}}, "extra": { "rawValue": "file", "raw": "\"file\"" diff --git a/packages/babel-parser/test/fixtures/placeholders/import/named-alias-3/output.json b/packages/babel-parser/test/fixtures/placeholders/import/named-alias-3/output.json index bfae4a044410..fe0f44bed277 100644 --- a/packages/babel-parser/test/fixtures/placeholders/import/named-alias-3/output.json +++ b/packages/babel-parser/test/fixtures/placeholders/import/named-alias-3/output.json @@ -1,125 +1,35 @@ { "type": "File", - "start": 0, - "end": 46, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 46 - } - }, + "start":0,"end":46,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":46}}, "program": { "type": "Program", - "start": 0, - "end": 46, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 46 - } - }, + "start":0,"end":46,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":46}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ImportDeclaration", - "start": 0, - "end": 46, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 46 - } - }, + "start":0,"end":46,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":46}}, "specifiers": [ { "type": "ImportSpecifier", - "start": 9, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":9,"end":31,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":31}}, "imported": { "type": "Placeholder", - "start": 9, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":9,"end":18,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":18}}, "name": { "type": "Identifier", - "start": 11, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 16 - }, - "identifierName": "NAMED" - }, + "start":11,"end":16,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":16},"identifierName":"NAMED"}, "name": "NAMED" }, "expectedNode": "Identifier" }, "local": { "type": "Placeholder", - "start": 22, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":22,"end":31,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":31}}, "name": { "type": "Identifier", - "start": 24, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 29 - }, - "identifierName": "ALIAS" - }, + "start":24,"end":29,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":29},"identifierName":"ALIAS"}, "name": "ALIAS" }, "expectedNode": "Identifier" @@ -128,18 +38,7 @@ ], "source": { "type": "StringLiteral", - "start": 39, - "end": 45, - "loc": { - "start": { - "line": 1, - "column": 39 - }, - "end": { - "line": 1, - "column": 45 - } - }, + "start":39,"end":45,"loc":{"start":{"line":1,"column":39},"end":{"line":1,"column":45}}, "extra": { "rawValue": "file", "raw": "\"file\"" diff --git a/packages/babel-parser/test/fixtures/placeholders/import/named-alias/output.json b/packages/babel-parser/test/fixtures/placeholders/import/named-alias/output.json index 5477bef4ca9e..aa6ab6e293a6 100644 --- a/packages/babel-parser/test/fixtures/placeholders/import/named-alias/output.json +++ b/packages/babel-parser/test/fixtures/placeholders/import/named-alias/output.json @@ -1,109 +1,30 @@ { "type": "File", - "start": 0, - "end": 42, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 42 - } - }, + "start":0,"end":42,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":42}}, "program": { "type": "Program", - "start": 0, - "end": 42, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 42 - } - }, + "start":0,"end":42,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":42}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ImportDeclaration", - "start": 0, - "end": 42, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 42 - } - }, + "start":0,"end":42,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":42}}, "specifiers": [ { "type": "ImportSpecifier", - "start": 9, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":9,"end":27,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":27}}, "imported": { "type": "Identifier", - "start": 9, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 14 - }, - "identifierName": "named" - }, + "start":9,"end":14,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":14},"identifierName":"named"}, "name": "named" }, "local": { "type": "Placeholder", - "start": 18, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":18,"end":27,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":27}}, "name": { "type": "Identifier", - "start": 20, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 25 - }, - "identifierName": "ALIAS" - }, + "start":20,"end":25,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":25},"identifierName":"ALIAS"}, "name": "ALIAS" }, "expectedNode": "Identifier" @@ -112,18 +33,7 @@ ], "source": { "type": "StringLiteral", - "start": 35, - "end": 41, - "loc": { - "start": { - "line": 1, - "column": 35 - }, - "end": { - "line": 1, - "column": 41 - } - }, + "start":35,"end":41,"loc":{"start":{"line":1,"column":35},"end":{"line":1,"column":41}}, "extra": { "rawValue": "file", "raw": "\"file\"" diff --git a/packages/babel-parser/test/fixtures/placeholders/import/named/output.json b/packages/babel-parser/test/fixtures/placeholders/import/named/output.json index 9b3f08486a88..1508f63de6f9 100644 --- a/packages/babel-parser/test/fixtures/placeholders/import/named/output.json +++ b/packages/babel-parser/test/fixtures/placeholders/import/named/output.json @@ -1,125 +1,35 @@ { "type": "File", - "start": 0, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, "program": { "type": "Program", - "start": 0, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ImportDeclaration", - "start": 0, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, "specifiers": [ { "type": "ImportSpecifier", - "start": 9, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":9,"end":18,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":18}}, "imported": { "type": "Placeholder", - "start": 9, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":9,"end":18,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":18}}, "name": { "type": "Identifier", - "start": 11, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 16 - }, - "identifierName": "NAMED" - }, + "start":11,"end":16,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":16},"identifierName":"NAMED"}, "name": "NAMED" }, "expectedNode": "Identifier" }, "local": { "type": "Placeholder", - "start": 9, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":9,"end":18,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":18}}, "name": { "type": "Identifier", - "start": 11, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 16 - }, - "identifierName": "NAMED" - }, + "start":11,"end":16,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":16},"identifierName":"NAMED"}, "name": "NAMED" }, "expectedNode": "Identifier" @@ -128,18 +38,7 @@ ], "source": { "type": "StringLiteral", - "start": 26, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":26,"end":32,"loc":{"start":{"line":1,"column":26},"end":{"line":1,"column":32}}, "extra": { "rawValue": "file", "raw": "\"file\"" diff --git a/packages/babel-parser/test/fixtures/placeholders/import/star/output.json b/packages/babel-parser/test/fixtures/placeholders/import/star/output.json index 7ff6bfd05846..2d8f5acbca2c 100644 --- a/packages/babel-parser/test/fixtures/placeholders/import/star/output.json +++ b/packages/babel-parser/test/fixtures/placeholders/import/star/output.json @@ -1,92 +1,25 @@ { "type": "File", - "start": 0, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, "program": { "type": "Program", - "start": 0, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ImportDeclaration", - "start": 0, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, "specifiers": [ { "type": "ImportNamespaceSpecifier", - "start": 7, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":7,"end":20,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":20}}, "local": { "type": "Placeholder", - "start": 12, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":12,"end":20,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":20}}, "name": { "type": "Identifier", - "start": 14, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 18 - }, - "identifierName": "STAR" - }, + "start":14,"end":18,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":18},"identifierName":"STAR"}, "name": "STAR" }, "expectedNode": "Identifier" @@ -95,18 +28,7 @@ ], "source": { "type": "StringLiteral", - "start": 26, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":26,"end":32,"loc":{"start":{"line":1,"column":26},"end":{"line":1,"column":32}}, "extra": { "rawValue": "file", "raw": "\"file\"" diff --git a/packages/babel-parser/test/fixtures/placeholders/labels/asi/output.json b/packages/babel-parser/test/fixtures/placeholders/labels/asi/output.json index f1e2f1614781..c95cb6187a72 100644 --- a/packages/babel-parser/test/fixtures/placeholders/labels/asi/output.json +++ b/packages/babel-parser/test/fixtures/placeholders/labels/asi/output.json @@ -1,76 +1,21 @@ { "type": "File", - "start": 0, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":0,"end":40,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":0,"end":40,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "LabeledStatement", - "start": 0, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":0,"end":40,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, "body": { "type": "WhileStatement", - "start": 6, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":6,"end":40,"loc":{"start":{"line":1,"column":6},"end":{"line":4,"column":1}}, "test": { "type": "NumericLiteral", - "start": 13, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":13,"end":14,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":14}}, "extra": { "rawValue": 0, "raw": "0" @@ -79,64 +24,19 @@ }, "body": { "type": "BlockStatement", - "start": 16, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":16,"end":40,"loc":{"start":{"line":1,"column":16},"end":{"line":4,"column":1}}, "body": [ { "type": "BreakStatement", - "start": 20, - "end": 25, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 7 - } - }, + "start":20,"end":25,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":7}}, "label": null }, { "type": "Placeholder", - "start": 28, - "end": 38, - "loc": { - "start": { - "line": 3, - "column": 2 - }, - "end": { - "line": 3, - "column": 12 - } - }, + "start":28,"end":38,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":12}}, "name": { "type": "Identifier", - "start": 30, - "end": 35, - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 9 - }, - "identifierName": "LABEL" - }, + "start":30,"end":35,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":9},"identifierName":"LABEL"}, "name": "LABEL" }, "expectedNode": "Statement" @@ -147,19 +47,7 @@ }, "label": { "type": "Identifier", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - }, - "identifierName": "loop" - }, + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4},"identifierName":"loop"}, "name": "loop" } } diff --git a/packages/babel-parser/test/fixtures/placeholders/labels/break/output.json b/packages/babel-parser/test/fixtures/placeholders/labels/break/output.json index ab4488d5a04c..d6e17d6f2a60 100644 --- a/packages/babel-parser/test/fixtures/placeholders/labels/break/output.json +++ b/packages/babel-parser/test/fixtures/placeholders/labels/break/output.json @@ -1,106 +1,28 @@ { "type": "File", - "start": 0, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "LabeledStatement", - "start": 0, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "body": { "type": "BlockStatement", - "start": 7, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":7,"end":29,"loc":{"start":{"line":1,"column":7},"end":{"line":3,"column":1}}, "body": [ { "type": "BreakStatement", - "start": 11, - "end": 27, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 18 - } - }, + "start":11,"end":27,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":18}}, "label": { "type": "Placeholder", - "start": 17, - "end": 26, - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 17 - } - }, + "start":17,"end":26,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":17}}, "name": { "type": "Identifier", - "start": 19, - "end": 24, - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 15 - }, - "identifierName": "LABEL" - }, + "start":19,"end":24,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":15},"identifierName":"LABEL"}, "name": "LABEL" }, "expectedNode": "Identifier" @@ -111,19 +33,7 @@ }, "label": { "type": "Identifier", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "block" - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5},"identifierName":"block"}, "name": "block" } } diff --git a/packages/babel-parser/test/fixtures/placeholders/labels/continue/output.json b/packages/babel-parser/test/fixtures/placeholders/labels/continue/output.json index b6876979197b..6410a2a4d371 100644 --- a/packages/babel-parser/test/fixtures/placeholders/labels/continue/output.json +++ b/packages/babel-parser/test/fixtures/placeholders/labels/continue/output.json @@ -1,76 +1,21 @@ { "type": "File", - "start": 0, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":40,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":40,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "LabeledStatement", - "start": 0, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":40,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "body": { "type": "WhileStatement", - "start": 6, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":6,"end":40,"loc":{"start":{"line":1,"column":6},"end":{"line":3,"column":1}}, "test": { "type": "NumericLiteral", - "start": 13, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":13,"end":14,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":14}}, "extra": { "rawValue": 0, "raw": "0" @@ -79,62 +24,17 @@ }, "body": { "type": "BlockStatement", - "start": 16, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":16,"end":40,"loc":{"start":{"line":1,"column":16},"end":{"line":3,"column":1}}, "body": [ { "type": "ContinueStatement", - "start": 20, - "end": 38, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 20 - } - }, + "start":20,"end":38,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":20}}, "label": { "type": "Placeholder", - "start": 29, - "end": 37, - "loc": { - "start": { - "line": 2, - "column": 11 - }, - "end": { - "line": 2, - "column": 19 - } - }, + "start":29,"end":37,"loc":{"start":{"line":2,"column":11},"end":{"line":2,"column":19}}, "name": { "type": "Identifier", - "start": 31, - "end": 35, - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 17 - }, - "identifierName": "LOOP" - }, + "start":31,"end":35,"loc":{"start":{"line":2,"column":13},"end":{"line":2,"column":17},"identifierName":"LOOP"}, "name": "LOOP" }, "expectedNode": "Identifier" @@ -146,19 +46,7 @@ }, "label": { "type": "Identifier", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - }, - "identifierName": "loop" - }, + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4},"identifierName":"loop"}, "name": "loop" } } diff --git a/packages/babel-parser/test/fixtures/placeholders/labels/labeled-statement/output.json b/packages/babel-parser/test/fixtures/placeholders/labels/labeled-statement/output.json index 597468988557..43a860dc7806 100644 --- a/packages/babel-parser/test/fixtures/placeholders/labels/labeled-statement/output.json +++ b/packages/babel-parser/test/fixtures/placeholders/labels/labeled-statement/output.json @@ -1,109 +1,31 @@ { "type": "File", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "program": { "type": "Program", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "LabeledStatement", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "label": { "type": "Placeholder", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "name": { "type": "Identifier", - "start": 2, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "FOO" - }, + "start":2,"end":5,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":5},"identifierName":"FOO"}, "name": "FOO" }, "expectedNode": "Identifier" }, "body": { "type": "ExpressionStatement", - "start": 9, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":9,"end":11,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":11}}, "expression": { "type": "NumericLiteral", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10}}, "extra": { "rawValue": 0, "raw": "0" diff --git a/packages/babel-parser/test/fixtures/placeholders/statement/asi/output.json b/packages/babel-parser/test/fixtures/placeholders/statement/asi/output.json index 9980b76f599a..d3858004d2e0 100644 --- a/packages/babel-parser/test/fixtures/placeholders/statement/asi/output.json +++ b/packages/babel-parser/test/fixtures/placeholders/statement/asi/output.json @@ -1,96 +1,28 @@ { "type": "File", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 7 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":7}}, "program": { "type": "Program", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 7 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":7}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "Placeholder", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "name": { "type": "Identifier", - "start": 2, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "FOO" - }, + "start":2,"end":5,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":5},"identifierName":"FOO"}, "name": "FOO" }, "expectedNode": "Statement" }, { "type": "Placeholder", - "start": 8, - "end": 15, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 7 - } - }, + "start":8,"end":15,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":7}}, "name": { "type": "Identifier", - "start": 10, - "end": 13, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 5 - }, - "identifierName": "BAR" - }, + "start":10,"end":13,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":5},"identifierName":"BAR"}, "name": "BAR" }, "expectedNode": "Statement" diff --git a/packages/babel-parser/test/fixtures/placeholders/statement/nested/output.json b/packages/babel-parser/test/fixtures/placeholders/statement/nested/output.json index 1f071964bf16..7a9984f2071c 100644 --- a/packages/babel-parser/test/fixtures/placeholders/statement/nested/output.json +++ b/packages/babel-parser/test/fixtures/placeholders/statement/nested/output.json @@ -1,62 +1,18 @@ { "type": "File", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "program": { "type": "Program", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "IfStatement", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "test": { "type": "NumericLiteral", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5}}, "extra": { "rawValue": 0, "raw": "0" @@ -65,33 +21,10 @@ }, "consequent": { "type": "Placeholder", - "start": 7, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":7,"end":15,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":15}}, "name": { "type": "Identifier", - "start": 9, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "FOO" - }, + "start":9,"end":12,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":12},"identifierName":"FOO"}, "name": "FOO" }, "expectedNode": "Statement" diff --git a/packages/babel-parser/test/fixtures/placeholders/statement/top-level/output.json b/packages/babel-parser/test/fixtures/placeholders/statement/top-level/output.json index d5f19f4035d0..9e6544a78062 100644 --- a/packages/babel-parser/test/fixtures/placeholders/statement/top-level/output.json +++ b/packages/babel-parser/test/fixtures/placeholders/statement/top-level/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, "program": { "type": "Program", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "Placeholder", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, "name": { "type": "Identifier", - "start": 2, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "FOO" - }, + "start":2,"end":5,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":5},"identifierName":"FOO"}, "name": "FOO" }, "expectedNode": "Statement" diff --git a/packages/babel-parser/test/fixtures/placeholders/try/try-catch-finally/output.json b/packages/babel-parser/test/fixtures/placeholders/try/try-catch-finally/output.json index 133cd26c2bbb..8a3deaca0bb8 100644 --- a/packages/babel-parser/test/fixtures/placeholders/try/try-catch-finally/output.json +++ b/packages/babel-parser/test/fixtures/placeholders/try/try-catch-finally/output.json @@ -1,125 +1,35 @@ { "type": "File", - "start": 0, - "end": 47, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 47 - } - }, + "start":0,"end":47,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":47}}, "program": { "type": "Program", - "start": 0, - "end": 47, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 47 - } - }, + "start":0,"end":47,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":47}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "TryStatement", - "start": 0, - "end": 47, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 47 - } - }, + "start":0,"end":47,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":47}}, "block": { "type": "Placeholder", - "start": 4, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":4,"end":11,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":11}}, "name": { "type": "Identifier", - "start": 6, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "TRY" - }, + "start":6,"end":9,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":9},"identifierName":"TRY"}, "name": "TRY" }, "expectedNode": "BlockStatement" }, "handler": { "type": "CatchClause", - "start": 12, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":12,"end":27,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":27}}, "param": null, "body": { "type": "Placeholder", - "start": 18, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":18,"end":27,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":27}}, "name": { "type": "Identifier", - "start": 20, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 25 - }, - "identifierName": "CATCH" - }, + "start":20,"end":25,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":25},"identifierName":"CATCH"}, "name": "CATCH" }, "expectedNode": "BlockStatement" @@ -127,33 +37,10 @@ }, "finalizer": { "type": "Placeholder", - "start": 36, - "end": 47, - "loc": { - "start": { - "line": 1, - "column": 36 - }, - "end": { - "line": 1, - "column": 47 - } - }, + "start":36,"end":47,"loc":{"start":{"line":1,"column":36},"end":{"line":1,"column":47}}, "name": { "type": "Identifier", - "start": 38, - "end": 45, - "loc": { - "start": { - "line": 1, - "column": 38 - }, - "end": { - "line": 1, - "column": 45 - }, - "identifierName": "FINALLY" - }, + "start":38,"end":45,"loc":{"start":{"line":1,"column":38},"end":{"line":1,"column":45},"identifierName":"FINALLY"}, "name": "FINALLY" }, "expectedNode": "BlockStatement" diff --git a/packages/babel-parser/test/fixtures/placeholders/try/with-catch-param/output.json b/packages/babel-parser/test/fixtures/placeholders/try/with-catch-param/output.json index 8c1574395e8d..85e58ce03ba4 100644 --- a/packages/babel-parser/test/fixtures/placeholders/try/with-catch-param/output.json +++ b/packages/babel-parser/test/fixtures/placeholders/try/with-catch-param/output.json @@ -1,141 +1,40 @@ { "type": "File", - "start": 0, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, "program": { "type": "Program", - "start": 0, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "TryStatement", - "start": 0, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, "block": { "type": "BlockStatement", - "start": 4, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":4,"end":6,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":6}}, "body": [], "directives": [] }, "handler": { "type": "CatchClause", - "start": 7, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":7,"end":34,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":34}}, "param": { "type": "Placeholder", - "start": 14, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":14,"end":23,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":23}}, "name": { "type": "Identifier", - "start": 16, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 21 - }, - "identifierName": "PARAM" - }, + "start":16,"end":21,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":21},"identifierName":"PARAM"}, "name": "PARAM" }, "expectedNode": "Pattern" }, "body": { "type": "Placeholder", - "start": 25, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":25,"end":34,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":34}}, "name": { "type": "Identifier", - "start": 27, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 32 - }, - "identifierName": "CATCH" - }, + "start":27,"end":32,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":32},"identifierName":"CATCH"}, "name": "CATCH" }, "expectedNode": "BlockStatement" diff --git a/packages/babel-parser/test/fixtures/test262/rest-parameter/array-pattern-empty-with-array/output.json b/packages/babel-parser/test/fixtures/test262/rest-parameter/array-pattern-empty-with-array/output.json index a2ca569516cc..a13e68e19c46 100644 --- a/packages/babel-parser/test/fixtures/test262/rest-parameter/array-pattern-empty-with-array/output.json +++ b/packages/babel-parser/test/fixtures/test262/rest-parameter/array-pattern-empty-with-array/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":35}}, "program": { "type": "Program", - "start": 0, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":35}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":35}}, "id": { "type": "Identifier", - "start": 9, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 23 - }, - "identifierName": "emptyWithArray" - }, + "start":9,"end":23,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":23},"identifierName":"emptyWithArray"}, "name": "emptyWithArray" }, "generator": false, @@ -65,47 +20,14 @@ "params": [ { "type": "RestElement", - "start": 24, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":24,"end":31,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":31}}, "argument": { "type": "ArrayPattern", - "start": 27, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":27,"end":31,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":31}}, "elements": [ { "type": "ArrayPattern", - "start": 28, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":28,"end":30,"loc":{"start":{"line":1,"column":28},"end":{"line":1,"column":30}}, "elements": [] } ] @@ -114,18 +36,7 @@ ], "body": { "type": "BlockStatement", - "start": 33, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 33 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":33,"end":35,"loc":{"start":{"line":1,"column":33},"end":{"line":1,"column":35}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/test262/rest-parameter/array-pattern-empty-with-leading/output.json b/packages/babel-parser/test/fixtures/test262/rest-parameter/array-pattern-empty-with-leading/output.json index e7a3e3992115..9569219454fc 100644 --- a/packages/babel-parser/test/fixtures/test262/rest-parameter/array-pattern-empty-with-leading/output.json +++ b/packages/babel-parser/test/fixtures/test262/rest-parameter/array-pattern-empty-with-leading/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":38}}, "program": { "type": "Program", - "start": 0, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":38}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":38}}, "id": { "type": "Identifier", - "start": 9, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 25 - }, - "identifierName": "emptyWithLeading" - }, + "start":9,"end":25,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":25},"identifierName":"emptyWithLeading"}, "name": "emptyWithLeading" }, "generator": false, @@ -65,67 +20,22 @@ "params": [ { "type": "Identifier", - "start": 26, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 27 - }, - "identifierName": "x" - }, + "start":26,"end":27,"loc":{"start":{"line":1,"column":26},"end":{"line":1,"column":27},"identifierName":"x"}, "name": "x" }, { "type": "RestElement", - "start": 29, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":29,"end":34,"loc":{"start":{"line":1,"column":29},"end":{"line":1,"column":34}}, "argument": { "type": "ArrayPattern", - "start": 32, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 32 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":32,"end":34,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":34}}, "elements": [] } } ], "body": { "type": "BlockStatement", - "start": 36, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 36 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":36,"end":38,"loc":{"start":{"line":1,"column":36},"end":{"line":1,"column":38}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/test262/rest-parameter/array-pattern-empty-with-object/output.json b/packages/babel-parser/test/fixtures/test262/rest-parameter/array-pattern-empty-with-object/output.json index d021e73d9a8c..0a1042e0b619 100644 --- a/packages/babel-parser/test/fixtures/test262/rest-parameter/array-pattern-empty-with-object/output.json +++ b/packages/babel-parser/test/fixtures/test262/rest-parameter/array-pattern-empty-with-object/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, "program": { "type": "Program", - "start": 0, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, "id": { "type": "Identifier", - "start": 9, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 24 - }, - "identifierName": "emptyWithObject" - }, + "start":9,"end":24,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":24},"identifierName":"emptyWithObject"}, "name": "emptyWithObject" }, "generator": false, @@ -65,47 +20,14 @@ "params": [ { "type": "RestElement", - "start": 25, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":25,"end":32,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":32}}, "argument": { "type": "ArrayPattern", - "start": 28, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":28,"end":32,"loc":{"start":{"line":1,"column":28},"end":{"line":1,"column":32}}, "elements": [ { "type": "ObjectPattern", - "start": 29, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":29,"end":31,"loc":{"start":{"line":1,"column":29},"end":{"line":1,"column":31}}, "properties": [] } ] @@ -114,18 +36,7 @@ ], "body": { "type": "BlockStatement", - "start": 34, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 34 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":34,"end":36,"loc":{"start":{"line":1,"column":34},"end":{"line":1,"column":36}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/test262/rest-parameter/array-pattern-empty-with-rest/output.json b/packages/babel-parser/test/fixtures/test262/rest-parameter/array-pattern-empty-with-rest/output.json index ff9112b64a47..c97e162198e3 100644 --- a/packages/babel-parser/test/fixtures/test262/rest-parameter/array-pattern-empty-with-rest/output.json +++ b/packages/babel-parser/test/fixtures/test262/rest-parameter/array-pattern-empty-with-rest/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 37 - } - }, + "start":0,"end":37,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":37}}, "program": { "type": "Program", - "start": 0, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 37 - } - }, + "start":0,"end":37,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":37}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 37 - } - }, + "start":0,"end":37,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":37}}, "id": { "type": "Identifier", - "start": 9, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 22 - }, - "identifierName": "emptyWithRest" - }, + "start":9,"end":22,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":22},"identifierName":"emptyWithRest"}, "name": "emptyWithRest" }, "generator": false, @@ -65,61 +20,17 @@ "params": [ { "type": "RestElement", - "start": 23, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":23,"end":33,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":33}}, "argument": { "type": "ArrayPattern", - "start": 26, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":26,"end":33,"loc":{"start":{"line":1,"column":26},"end":{"line":1,"column":33}}, "elements": [ { "type": "RestElement", - "start": 27, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":27,"end":32,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":32}}, "argument": { "type": "ArrayPattern", - "start": 30, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":30,"end":32,"loc":{"start":{"line":1,"column":30},"end":{"line":1,"column":32}}, "elements": [] } } @@ -129,18 +40,7 @@ ], "body": { "type": "BlockStatement", - "start": 35, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 35 - }, - "end": { - "line": 1, - "column": 37 - } - }, + "start":35,"end":37,"loc":{"start":{"line":1,"column":35},"end":{"line":1,"column":37}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/test262/rest-parameter/array-pattern-empty/output.json b/packages/babel-parser/test/fixtures/test262/rest-parameter/array-pattern-empty/output.json index 10ad99945bef..9ec467375c4d 100644 --- a/packages/babel-parser/test/fixtures/test262/rest-parameter/array-pattern-empty/output.json +++ b/packages/babel-parser/test/fixtures/test262/rest-parameter/array-pattern-empty/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "program": { "type": "Program", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "id": { "type": "Identifier", - "start": 9, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 14 - }, - "identifierName": "empty" - }, + "start":9,"end":14,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":14},"identifierName":"empty"}, "name": "empty" }, "generator": false, @@ -65,50 +20,17 @@ "params": [ { "type": "RestElement", - "start": 15, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":15,"end":20,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":20}}, "argument": { "type": "ArrayPattern", - "start": 18, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":18,"end":20,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":20}}, "elements": [] } } ], "body": { "type": "BlockStatement", - "start": 22, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":22,"end":24,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":24}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/test262/rest-parameter/array-pattern-multi-element-with-array/output.json b/packages/babel-parser/test/fixtures/test262/rest-parameter/array-pattern-multi-element-with-array/output.json index 2ab16fb38940..eaeda9701773 100644 --- a/packages/babel-parser/test/fixtures/test262/rest-parameter/array-pattern-multi-element-with-array/output.json +++ b/packages/babel-parser/test/fixtures/test262/rest-parameter/array-pattern-multi-element-with-array/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 51, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 51 - } - }, + "start":0,"end":51,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":51}}, "program": { "type": "Program", - "start": 0, - "end": 51, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 51 - } - }, + "start":0,"end":51,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":51}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 51, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 51 - } - }, + "start":0,"end":51,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":51}}, "id": { "type": "Identifier", - "start": 9, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 30 - }, - "identifierName": "multiElementWithArray" - }, + "start":9,"end":30,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":30},"identifierName":"multiElementWithArray"}, "name": "multiElementWithArray" }, "generator": false, @@ -65,114 +20,34 @@ "params": [ { "type": "RestElement", - "start": 31, - "end": 47, - "loc": { - "start": { - "line": 1, - "column": 31 - }, - "end": { - "line": 1, - "column": 47 - } - }, + "start":31,"end":47,"loc":{"start":{"line":1,"column":31},"end":{"line":1,"column":47}}, "argument": { "type": "ArrayPattern", - "start": 34, - "end": 47, - "loc": { - "start": { - "line": 1, - "column": 34 - }, - "end": { - "line": 1, - "column": 47 - } - }, + "start":34,"end":47,"loc":{"start":{"line":1,"column":34},"end":{"line":1,"column":47}}, "elements": [ { "type": "ArrayPattern", - "start": 35, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 35 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":35,"end":38,"loc":{"start":{"line":1,"column":35},"end":{"line":1,"column":38}}, "elements": [ { "type": "Identifier", - "start": 36, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 36 - }, - "end": { - "line": 1, - "column": 37 - }, - "identifierName": "a" - }, + "start":36,"end":37,"loc":{"start":{"line":1,"column":36},"end":{"line":1,"column":37},"identifierName":"a"}, "name": "a" } ] }, { "type": "Identifier", - "start": 40, - "end": 41, - "loc": { - "start": { - "line": 1, - "column": 40 - }, - "end": { - "line": 1, - "column": 41 - }, - "identifierName": "b" - }, + "start":40,"end":41,"loc":{"start":{"line":1,"column":40},"end":{"line":1,"column":41},"identifierName":"b"}, "name": "b" }, { "type": "ArrayPattern", - "start": 43, - "end": 46, - "loc": { - "start": { - "line": 1, - "column": 43 - }, - "end": { - "line": 1, - "column": 46 - } - }, + "start":43,"end":46,"loc":{"start":{"line":1,"column":43},"end":{"line":1,"column":46}}, "elements": [ { "type": "Identifier", - "start": 44, - "end": 45, - "loc": { - "start": { - "line": 1, - "column": 44 - }, - "end": { - "line": 1, - "column": 45 - }, - "identifierName": "c" - }, + "start":44,"end":45,"loc":{"start":{"line":1,"column":44},"end":{"line":1,"column":45},"identifierName":"c"}, "name": "c" } ] @@ -183,18 +58,7 @@ ], "body": { "type": "BlockStatement", - "start": 49, - "end": 51, - "loc": { - "start": { - "line": 1, - "column": 49 - }, - "end": { - "line": 1, - "column": 51 - } - }, + "start":49,"end":51,"loc":{"start":{"line":1,"column":49},"end":{"line":1,"column":51}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/test262/rest-parameter/array-pattern-multi-element-with-initializer/output.json b/packages/babel-parser/test/fixtures/test262/rest-parameter/array-pattern-multi-element-with-initializer/output.json index 857c56d8be58..a7010d53bdab 100644 --- a/packages/babel-parser/test/fixtures/test262/rest-parameter/array-pattern-multi-element-with-initializer/output.json +++ b/packages/babel-parser/test/fixtures/test262/rest-parameter/array-pattern-multi-element-with-initializer/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 61, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 61 - } - }, + "start":0,"end":61,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":61}}, "program": { "type": "Program", - "start": 0, - "end": 61, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 61 - } - }, + "start":0,"end":61,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":61}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 61, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 61 - } - }, + "start":0,"end":61,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":61}}, "id": { "type": "Identifier", - "start": 9, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 36 - }, - "identifierName": "multiElementWithInitializer" - }, + "start":9,"end":36,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":36},"identifierName":"multiElementWithInitializer"}, "name": "multiElementWithInitializer" }, "generator": false, @@ -65,78 +20,22 @@ "params": [ { "type": "RestElement", - "start": 37, - "end": 57, - "loc": { - "start": { - "line": 1, - "column": 37 - }, - "end": { - "line": 1, - "column": 57 - } - }, + "start":37,"end":57,"loc":{"start":{"line":1,"column":37},"end":{"line":1,"column":57}}, "argument": { "type": "ArrayPattern", - "start": 40, - "end": 57, - "loc": { - "start": { - "line": 1, - "column": 40 - }, - "end": { - "line": 1, - "column": 57 - } - }, + "start":40,"end":57,"loc":{"start":{"line":1,"column":40},"end":{"line":1,"column":57}}, "elements": [ { "type": "AssignmentPattern", - "start": 41, - "end": 46, - "loc": { - "start": { - "line": 1, - "column": 41 - }, - "end": { - "line": 1, - "column": 46 - } - }, + "start":41,"end":46,"loc":{"start":{"line":1,"column":41},"end":{"line":1,"column":46}}, "left": { "type": "Identifier", - "start": 41, - "end": 42, - "loc": { - "start": { - "line": 1, - "column": 41 - }, - "end": { - "line": 1, - "column": 42 - }, - "identifierName": "a" - }, + "start":41,"end":42,"loc":{"start":{"line":1,"column":41},"end":{"line":1,"column":42},"identifierName":"a"}, "name": "a" }, "right": { "type": "NumericLiteral", - "start": 45, - "end": 46, - "loc": { - "start": { - "line": 1, - "column": 45 - }, - "end": { - "line": 1, - "column": 46 - } - }, + "start":45,"end":46,"loc":{"start":{"line":1,"column":45},"end":{"line":1,"column":46}}, "extra": { "rawValue": 0, "raw": "0" @@ -146,66 +45,20 @@ }, { "type": "Identifier", - "start": 48, - "end": 49, - "loc": { - "start": { - "line": 1, - "column": 48 - }, - "end": { - "line": 1, - "column": 49 - }, - "identifierName": "b" - }, + "start":48,"end":49,"loc":{"start":{"line":1,"column":48},"end":{"line":1,"column":49},"identifierName":"b"}, "name": "b" }, { "type": "AssignmentPattern", - "start": 51, - "end": 56, - "loc": { - "start": { - "line": 1, - "column": 51 - }, - "end": { - "line": 1, - "column": 56 - } - }, + "start":51,"end":56,"loc":{"start":{"line":1,"column":51},"end":{"line":1,"column":56}}, "left": { "type": "Identifier", - "start": 51, - "end": 52, - "loc": { - "start": { - "line": 1, - "column": 51 - }, - "end": { - "line": 1, - "column": 52 - }, - "identifierName": "c" - }, + "start":51,"end":52,"loc":{"start":{"line":1,"column":51},"end":{"line":1,"column":52},"identifierName":"c"}, "name": "c" }, "right": { "type": "NumericLiteral", - "start": 55, - "end": 56, - "loc": { - "start": { - "line": 1, - "column": 55 - }, - "end": { - "line": 1, - "column": 56 - } - }, + "start":55,"end":56,"loc":{"start":{"line":1,"column":55},"end":{"line":1,"column":56}}, "extra": { "rawValue": 1, "raw": "1" @@ -219,18 +72,7 @@ ], "body": { "type": "BlockStatement", - "start": 59, - "end": 61, - "loc": { - "start": { - "line": 1, - "column": 59 - }, - "end": { - "line": 1, - "column": 61 - } - }, + "start":59,"end":61,"loc":{"start":{"line":1,"column":59},"end":{"line":1,"column":61}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/test262/rest-parameter/array-pattern-multi-element-with-leading/output.json b/packages/babel-parser/test/fixtures/test262/rest-parameter/array-pattern-multi-element-with-leading/output.json index aca1e4618179..4a4fb0ec742f 100644 --- a/packages/babel-parser/test/fixtures/test262/rest-parameter/array-pattern-multi-element-with-leading/output.json +++ b/packages/babel-parser/test/fixtures/test262/rest-parameter/array-pattern-multi-element-with-leading/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 55, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 55 - } - }, + "start":0,"end":55,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":55}}, "program": { "type": "Program", - "start": 0, - "end": 55, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 55 - } - }, + "start":0,"end":55,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":55}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 55, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 55 - } - }, + "start":0,"end":55,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":55}}, "id": { "type": "Identifier", - "start": 9, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 32 - }, - "identifierName": "multiElementWithLeading" - }, + "start":9,"end":32,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":32},"identifierName":"multiElementWithLeading"}, "name": "multiElementWithLeading" }, "generator": false, @@ -65,116 +20,34 @@ "params": [ { "type": "Identifier", - "start": 33, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 33 - }, - "end": { - "line": 1, - "column": 34 - }, - "identifierName": "x" - }, + "start":33,"end":34,"loc":{"start":{"line":1,"column":33},"end":{"line":1,"column":34},"identifierName":"x"}, "name": "x" }, { "type": "Identifier", - "start": 36, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 36 - }, - "end": { - "line": 1, - "column": 37 - }, - "identifierName": "y" - }, + "start":36,"end":37,"loc":{"start":{"line":1,"column":36},"end":{"line":1,"column":37},"identifierName":"y"}, "name": "y" }, { "type": "RestElement", - "start": 39, - "end": 51, - "loc": { - "start": { - "line": 1, - "column": 39 - }, - "end": { - "line": 1, - "column": 51 - } - }, + "start":39,"end":51,"loc":{"start":{"line":1,"column":39},"end":{"line":1,"column":51}}, "argument": { "type": "ArrayPattern", - "start": 42, - "end": 51, - "loc": { - "start": { - "line": 1, - "column": 42 - }, - "end": { - "line": 1, - "column": 51 - } - }, + "start":42,"end":51,"loc":{"start":{"line":1,"column":42},"end":{"line":1,"column":51}}, "elements": [ { "type": "Identifier", - "start": 43, - "end": 44, - "loc": { - "start": { - "line": 1, - "column": 43 - }, - "end": { - "line": 1, - "column": 44 - }, - "identifierName": "a" - }, + "start":43,"end":44,"loc":{"start":{"line":1,"column":43},"end":{"line":1,"column":44},"identifierName":"a"}, "name": "a" }, { "type": "Identifier", - "start": 46, - "end": 47, - "loc": { - "start": { - "line": 1, - "column": 46 - }, - "end": { - "line": 1, - "column": 47 - }, - "identifierName": "b" - }, + "start":46,"end":47,"loc":{"start":{"line":1,"column":46},"end":{"line":1,"column":47},"identifierName":"b"}, "name": "b" }, { "type": "Identifier", - "start": 49, - "end": 50, - "loc": { - "start": { - "line": 1, - "column": 49 - }, - "end": { - "line": 1, - "column": 50 - }, - "identifierName": "c" - }, + "start":49,"end":50,"loc":{"start":{"line":1,"column":49},"end":{"line":1,"column":50},"identifierName":"c"}, "name": "c" } ] @@ -183,18 +56,7 @@ ], "body": { "type": "BlockStatement", - "start": 53, - "end": 55, - "loc": { - "start": { - "line": 1, - "column": 53 - }, - "end": { - "line": 1, - "column": 55 - } - }, + "start":53,"end":55,"loc":{"start":{"line":1,"column":53},"end":{"line":1,"column":55}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/test262/rest-parameter/array-pattern-multi-element-with-object/output.json b/packages/babel-parser/test/fixtures/test262/rest-parameter/array-pattern-multi-element-with-object/output.json index e13c89c6e10e..61041ac80763 100644 --- a/packages/babel-parser/test/fixtures/test262/rest-parameter/array-pattern-multi-element-with-object/output.json +++ b/packages/babel-parser/test/fixtures/test262/rest-parameter/array-pattern-multi-element-with-object/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 61, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 61 - } - }, + "start":0,"end":61,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":61}}, "program": { "type": "Program", - "start": 0, - "end": 61, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 61 - } - }, + "start":0,"end":61,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":61}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 61, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 61 - } - }, + "start":0,"end":61,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":61}}, "id": { "type": "Identifier", - "start": 9, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 31 - }, - "identifierName": "multiElementWithObject" - }, + "start":9,"end":31,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":31},"identifierName":"multiElementWithObject"}, "name": "multiElementWithObject" }, "generator": false, @@ -65,97 +20,29 @@ "params": [ { "type": "RestElement", - "start": 32, - "end": 57, - "loc": { - "start": { - "line": 1, - "column": 32 - }, - "end": { - "line": 1, - "column": 57 - } - }, + "start":32,"end":57,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":57}}, "argument": { "type": "ArrayPattern", - "start": 35, - "end": 57, - "loc": { - "start": { - "line": 1, - "column": 35 - }, - "end": { - "line": 1, - "column": 57 - } - }, + "start":35,"end":57,"loc":{"start":{"line":1,"column":35},"end":{"line":1,"column":57}}, "elements": [ { "type": "ObjectPattern", - "start": 36, - "end": 42, - "loc": { - "start": { - "line": 1, - "column": 36 - }, - "end": { - "line": 1, - "column": 42 - } - }, + "start":36,"end":42,"loc":{"start":{"line":1,"column":36},"end":{"line":1,"column":42}}, "properties": [ { "type": "ObjectProperty", - "start": 37, - "end": 41, - "loc": { - "start": { - "line": 1, - "column": 37 - }, - "end": { - "line": 1, - "column": 41 - } - }, + "start":37,"end":41,"loc":{"start":{"line":1,"column":37},"end":{"line":1,"column":41}}, "method": false, "key": { "type": "Identifier", - "start": 37, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 37 - }, - "end": { - "line": 1, - "column": 38 - }, - "identifierName": "p" - }, + "start":37,"end":38,"loc":{"start":{"line":1,"column":37},"end":{"line":1,"column":38},"identifierName":"p"}, "name": "p" }, "computed": false, "shorthand": false, "value": { "type": "Identifier", - "start": 40, - "end": 41, - "loc": { - "start": { - "line": 1, - "column": 40 - }, - "end": { - "line": 1, - "column": 41 - }, - "identifierName": "q" - }, + "start":40,"end":41,"loc":{"start":{"line":1,"column":40},"end":{"line":1,"column":41},"identifierName":"q"}, "name": "q" } } @@ -163,68 +50,22 @@ }, { "type": "ObjectPattern", - "start": 44, - "end": 47, - "loc": { - "start": { - "line": 1, - "column": 44 - }, - "end": { - "line": 1, - "column": 47 - } - }, + "start":44,"end":47,"loc":{"start":{"line":1,"column":44},"end":{"line":1,"column":47}}, "properties": [ { "type": "ObjectProperty", - "start": 45, - "end": 46, - "loc": { - "start": { - "line": 1, - "column": 45 - }, - "end": { - "line": 1, - "column": 46 - } - }, + "start":45,"end":46,"loc":{"start":{"line":1,"column":45},"end":{"line":1,"column":46}}, "method": false, "key": { "type": "Identifier", - "start": 45, - "end": 46, - "loc": { - "start": { - "line": 1, - "column": 45 - }, - "end": { - "line": 1, - "column": 46 - }, - "identifierName": "r" - }, + "start":45,"end":46,"loc":{"start":{"line":1,"column":45},"end":{"line":1,"column":46},"identifierName":"r"}, "name": "r" }, "computed": false, "shorthand": true, "value": { "type": "Identifier", - "start": 45, - "end": 46, - "loc": { - "start": { - "line": 1, - "column": 45 - }, - "end": { - "line": 1, - "column": 46 - }, - "identifierName": "r" - }, + "start":45,"end":46,"loc":{"start":{"line":1,"column":45},"end":{"line":1,"column":46},"identifierName":"r"}, "name": "r" }, "extra": { @@ -235,98 +76,30 @@ }, { "type": "ObjectPattern", - "start": 49, - "end": 56, - "loc": { - "start": { - "line": 1, - "column": 49 - }, - "end": { - "line": 1, - "column": 56 - } - }, + "start":49,"end":56,"loc":{"start":{"line":1,"column":49},"end":{"line":1,"column":56}}, "properties": [ { "type": "ObjectProperty", - "start": 50, - "end": 55, - "loc": { - "start": { - "line": 1, - "column": 50 - }, - "end": { - "line": 1, - "column": 55 - } - }, + "start":50,"end":55,"loc":{"start":{"line":1,"column":50},"end":{"line":1,"column":55}}, "method": false, "key": { "type": "Identifier", - "start": 50, - "end": 51, - "loc": { - "start": { - "line": 1, - "column": 50 - }, - "end": { - "line": 1, - "column": 51 - }, - "identifierName": "s" - }, + "start":50,"end":51,"loc":{"start":{"line":1,"column":50},"end":{"line":1,"column":51},"identifierName":"s"}, "name": "s" }, "computed": false, "shorthand": true, "value": { "type": "AssignmentPattern", - "start": 50, - "end": 55, - "loc": { - "start": { - "line": 1, - "column": 50 - }, - "end": { - "line": 1, - "column": 55 - } - }, + "start":50,"end":55,"loc":{"start":{"line":1,"column":50},"end":{"line":1,"column":55}}, "left": { "type": "Identifier", - "start": 50, - "end": 51, - "loc": { - "start": { - "line": 1, - "column": 50 - }, - "end": { - "line": 1, - "column": 51 - }, - "identifierName": "s" - }, + "start":50,"end":51,"loc":{"start":{"line":1,"column":50},"end":{"line":1,"column":51},"identifierName":"s"}, "name": "s" }, "right": { "type": "NumericLiteral", - "start": 54, - "end": 55, - "loc": { - "start": { - "line": 1, - "column": 54 - }, - "end": { - "line": 1, - "column": 55 - } - }, + "start":54,"end":55,"loc":{"start":{"line":1,"column":54},"end":{"line":1,"column":55}}, "extra": { "rawValue": 0, "raw": "0" @@ -346,18 +119,7 @@ ], "body": { "type": "BlockStatement", - "start": 59, - "end": 61, - "loc": { - "start": { - "line": 1, - "column": 59 - }, - "end": { - "line": 1, - "column": 61 - } - }, + "start":59,"end":61,"loc":{"start":{"line":1,"column":59},"end":{"line":1,"column":61}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/test262/rest-parameter/array-pattern-multi-element-with-rest/output.json b/packages/babel-parser/test/fixtures/test262/rest-parameter/array-pattern-multi-element-with-rest/output.json index cedea33cfd00..6adfc564586f 100644 --- a/packages/babel-parser/test/fixtures/test262/rest-parameter/array-pattern-multi-element-with-rest/output.json +++ b/packages/babel-parser/test/fixtures/test262/rest-parameter/array-pattern-multi-element-with-rest/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 49, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 49 - } - }, + "start":0,"end":49,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":49}}, "program": { "type": "Program", - "start": 0, - "end": 49, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 49 - } - }, + "start":0,"end":49,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":49}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 49, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 49 - } - }, + "start":0,"end":49,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":49}}, "id": { "type": "Identifier", - "start": 9, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 29 - }, - "identifierName": "multiElementWithRest" - }, + "start":9,"end":29,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":29},"identifierName":"multiElementWithRest"}, "name": "multiElementWithRest" }, "generator": false, @@ -65,96 +20,27 @@ "params": [ { "type": "RestElement", - "start": 30, - "end": 45, - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 1, - "column": 45 - } - }, + "start":30,"end":45,"loc":{"start":{"line":1,"column":30},"end":{"line":1,"column":45}}, "argument": { "type": "ArrayPattern", - "start": 33, - "end": 45, - "loc": { - "start": { - "line": 1, - "column": 33 - }, - "end": { - "line": 1, - "column": 45 - } - }, + "start":33,"end":45,"loc":{"start":{"line":1,"column":33},"end":{"line":1,"column":45}}, "elements": [ { "type": "Identifier", - "start": 34, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 34 - }, - "end": { - "line": 1, - "column": 35 - }, - "identifierName": "a" - }, + "start":34,"end":35,"loc":{"start":{"line":1,"column":34},"end":{"line":1,"column":35},"identifierName":"a"}, "name": "a" }, { "type": "Identifier", - "start": 37, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 37 - }, - "end": { - "line": 1, - "column": 38 - }, - "identifierName": "b" - }, + "start":37,"end":38,"loc":{"start":{"line":1,"column":37},"end":{"line":1,"column":38},"identifierName":"b"}, "name": "b" }, { "type": "RestElement", - "start": 40, - "end": 44, - "loc": { - "start": { - "line": 1, - "column": 40 - }, - "end": { - "line": 1, - "column": 44 - } - }, + "start":40,"end":44,"loc":{"start":{"line":1,"column":40},"end":{"line":1,"column":44}}, "argument": { "type": "Identifier", - "start": 43, - "end": 44, - "loc": { - "start": { - "line": 1, - "column": 43 - }, - "end": { - "line": 1, - "column": 44 - }, - "identifierName": "c" - }, + "start":43,"end":44,"loc":{"start":{"line":1,"column":43},"end":{"line":1,"column":44},"identifierName":"c"}, "name": "c" } } @@ -164,18 +50,7 @@ ], "body": { "type": "BlockStatement", - "start": 47, - "end": 49, - "loc": { - "start": { - "line": 1, - "column": 47 - }, - "end": { - "line": 1, - "column": 49 - } - }, + "start":47,"end":49,"loc":{"start":{"line":1,"column":47},"end":{"line":1,"column":49}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/test262/rest-parameter/array-pattern-multi-element/output.json b/packages/babel-parser/test/fixtures/test262/rest-parameter/array-pattern-multi-element/output.json index b526e3c8f49b..02920dcb390e 100644 --- a/packages/babel-parser/test/fixtures/test262/rest-parameter/array-pattern-multi-element/output.json +++ b/packages/babel-parser/test/fixtures/test262/rest-parameter/array-pattern-multi-element/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":38}}, "program": { "type": "Program", - "start": 0, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":38}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":38}}, "id": { "type": "Identifier", - "start": 9, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 21 - }, - "identifierName": "multiElement" - }, + "start":9,"end":21,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":21},"identifierName":"multiElement"}, "name": "multiElement" }, "generator": false, @@ -65,82 +20,24 @@ "params": [ { "type": "RestElement", - "start": 22, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":22,"end":34,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":34}}, "argument": { "type": "ArrayPattern", - "start": 25, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":25,"end":34,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":34}}, "elements": [ { "type": "Identifier", - "start": 26, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 27 - }, - "identifierName": "a" - }, + "start":26,"end":27,"loc":{"start":{"line":1,"column":26},"end":{"line":1,"column":27},"identifierName":"a"}, "name": "a" }, { "type": "Identifier", - "start": 29, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 1, - "column": 30 - }, - "identifierName": "b" - }, + "start":29,"end":30,"loc":{"start":{"line":1,"column":29},"end":{"line":1,"column":30},"identifierName":"b"}, "name": "b" }, { "type": "Identifier", - "start": 32, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 32 - }, - "end": { - "line": 1, - "column": 33 - }, - "identifierName": "c" - }, + "start":32,"end":33,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":33},"identifierName":"c"}, "name": "c" } ] @@ -149,18 +46,7 @@ ], "body": { "type": "BlockStatement", - "start": 36, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 36 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":36,"end":38,"loc":{"start":{"line":1,"column":36},"end":{"line":1,"column":38}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/test262/rest-parameter/array-pattern-single-element-with-array/output.json b/packages/babel-parser/test/fixtures/test262/rest-parameter/array-pattern-single-element-with-array/output.json index 81b1f6404209..03f5f764159d 100644 --- a/packages/babel-parser/test/fixtures/test262/rest-parameter/array-pattern-single-element-with-array/output.json +++ b/packages/babel-parser/test/fixtures/test262/rest-parameter/array-pattern-single-element-with-array/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 44, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 44 - } - }, + "start":0,"end":44,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":44}}, "program": { "type": "Program", - "start": 0, - "end": 44, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 44 - } - }, + "start":0,"end":44,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":44}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 44, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 44 - } - }, + "start":0,"end":44,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":44}}, "id": { "type": "Identifier", - "start": 9, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 31 - }, - "identifierName": "singleElementWithArray" - }, + "start":9,"end":31,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":31},"identifierName":"singleElementWithArray"}, "name": "singleElementWithArray" }, "generator": false, @@ -65,63 +20,18 @@ "params": [ { "type": "RestElement", - "start": 32, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 32 - }, - "end": { - "line": 1, - "column": 40 - } - }, + "start":32,"end":40,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":40}}, "argument": { "type": "ArrayPattern", - "start": 35, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 35 - }, - "end": { - "line": 1, - "column": 40 - } - }, + "start":35,"end":40,"loc":{"start":{"line":1,"column":35},"end":{"line":1,"column":40}}, "elements": [ { "type": "ArrayPattern", - "start": 36, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 36 - }, - "end": { - "line": 1, - "column": 39 - } - }, + "start":36,"end":39,"loc":{"start":{"line":1,"column":36},"end":{"line":1,"column":39}}, "elements": [ { "type": "Identifier", - "start": 37, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 37 - }, - "end": { - "line": 1, - "column": 38 - }, - "identifierName": "a" - }, + "start":37,"end":38,"loc":{"start":{"line":1,"column":37},"end":{"line":1,"column":38},"identifierName":"a"}, "name": "a" } ] @@ -132,18 +42,7 @@ ], "body": { "type": "BlockStatement", - "start": 42, - "end": 44, - "loc": { - "start": { - "line": 1, - "column": 42 - }, - "end": { - "line": 1, - "column": 44 - } - }, + "start":42,"end":44,"loc":{"start":{"line":1,"column":42},"end":{"line":1,"column":44}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/test262/rest-parameter/array-pattern-single-element-with-initializer/output.json b/packages/babel-parser/test/fixtures/test262/rest-parameter/array-pattern-single-element-with-initializer/output.json index 0812973f7961..9e6cd8f6b18d 100644 --- a/packages/babel-parser/test/fixtures/test262/rest-parameter/array-pattern-single-element-with-initializer/output.json +++ b/packages/babel-parser/test/fixtures/test262/rest-parameter/array-pattern-single-element-with-initializer/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 52, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 52 - } - }, + "start":0,"end":52,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":52}}, "program": { "type": "Program", - "start": 0, - "end": 52, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 52 - } - }, + "start":0,"end":52,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":52}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 52, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 52 - } - }, + "start":0,"end":52,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":52}}, "id": { "type": "Identifier", - "start": 9, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 37 - }, - "identifierName": "singleElementWithInitializer" - }, + "start":9,"end":37,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":37},"identifierName":"singleElementWithInitializer"}, "name": "singleElementWithInitializer" }, "generator": false, @@ -65,78 +20,22 @@ "params": [ { "type": "RestElement", - "start": 38, - "end": 48, - "loc": { - "start": { - "line": 1, - "column": 38 - }, - "end": { - "line": 1, - "column": 48 - } - }, + "start":38,"end":48,"loc":{"start":{"line":1,"column":38},"end":{"line":1,"column":48}}, "argument": { "type": "ArrayPattern", - "start": 41, - "end": 48, - "loc": { - "start": { - "line": 1, - "column": 41 - }, - "end": { - "line": 1, - "column": 48 - } - }, + "start":41,"end":48,"loc":{"start":{"line":1,"column":41},"end":{"line":1,"column":48}}, "elements": [ { "type": "AssignmentPattern", - "start": 42, - "end": 47, - "loc": { - "start": { - "line": 1, - "column": 42 - }, - "end": { - "line": 1, - "column": 47 - } - }, + "start":42,"end":47,"loc":{"start":{"line":1,"column":42},"end":{"line":1,"column":47}}, "left": { "type": "Identifier", - "start": 42, - "end": 43, - "loc": { - "start": { - "line": 1, - "column": 42 - }, - "end": { - "line": 1, - "column": 43 - }, - "identifierName": "a" - }, + "start":42,"end":43,"loc":{"start":{"line":1,"column":42},"end":{"line":1,"column":43},"identifierName":"a"}, "name": "a" }, "right": { "type": "NumericLiteral", - "start": 46, - "end": 47, - "loc": { - "start": { - "line": 1, - "column": 46 - }, - "end": { - "line": 1, - "column": 47 - } - }, + "start":46,"end":47,"loc":{"start":{"line":1,"column":46},"end":{"line":1,"column":47}}, "extra": { "rawValue": 0, "raw": "0" @@ -150,18 +49,7 @@ ], "body": { "type": "BlockStatement", - "start": 50, - "end": 52, - "loc": { - "start": { - "line": 1, - "column": 50 - }, - "end": { - "line": 1, - "column": 52 - } - }, + "start":50,"end":52,"loc":{"start":{"line":1,"column":50},"end":{"line":1,"column":52}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/test262/rest-parameter/array-pattern-single-element-with-leading/output.json b/packages/babel-parser/test/fixtures/test262/rest-parameter/array-pattern-single-element-with-leading/output.json index 90dd3a262529..3f57651c4ade 100644 --- a/packages/babel-parser/test/fixtures/test262/rest-parameter/array-pattern-single-element-with-leading/output.json +++ b/packages/babel-parser/test/fixtures/test262/rest-parameter/array-pattern-single-element-with-leading/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 47, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 47 - } - }, + "start":0,"end":47,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":47}}, "program": { "type": "Program", - "start": 0, - "end": 47, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 47 - } - }, + "start":0,"end":47,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":47}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 47, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 47 - } - }, + "start":0,"end":47,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":47}}, "id": { "type": "Identifier", - "start": 9, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 33 - }, - "identifierName": "singleElementWithLeading" - }, + "start":9,"end":33,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":33},"identifierName":"singleElementWithLeading"}, "name": "singleElementWithLeading" }, "generator": false, @@ -65,65 +20,19 @@ "params": [ { "type": "Identifier", - "start": 34, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 34 - }, - "end": { - "line": 1, - "column": 35 - }, - "identifierName": "x" - }, + "start":34,"end":35,"loc":{"start":{"line":1,"column":34},"end":{"line":1,"column":35},"identifierName":"x"}, "name": "x" }, { "type": "RestElement", - "start": 37, - "end": 43, - "loc": { - "start": { - "line": 1, - "column": 37 - }, - "end": { - "line": 1, - "column": 43 - } - }, + "start":37,"end":43,"loc":{"start":{"line":1,"column":37},"end":{"line":1,"column":43}}, "argument": { "type": "ArrayPattern", - "start": 40, - "end": 43, - "loc": { - "start": { - "line": 1, - "column": 40 - }, - "end": { - "line": 1, - "column": 43 - } - }, + "start":40,"end":43,"loc":{"start":{"line":1,"column":40},"end":{"line":1,"column":43}}, "elements": [ { "type": "Identifier", - "start": 41, - "end": 42, - "loc": { - "start": { - "line": 1, - "column": 41 - }, - "end": { - "line": 1, - "column": 42 - }, - "identifierName": "a" - }, + "start":41,"end":42,"loc":{"start":{"line":1,"column":41},"end":{"line":1,"column":42},"identifierName":"a"}, "name": "a" } ] @@ -132,18 +41,7 @@ ], "body": { "type": "BlockStatement", - "start": 45, - "end": 47, - "loc": { - "start": { - "line": 1, - "column": 45 - }, - "end": { - "line": 1, - "column": 47 - } - }, + "start":45,"end":47,"loc":{"start":{"line":1,"column":45},"end":{"line":1,"column":47}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/test262/rest-parameter/array-pattern-single-element-with-object/output.json b/packages/babel-parser/test/fixtures/test262/rest-parameter/array-pattern-single-element-with-object/output.json index a2863b81f32f..231ffe48c21d 100644 --- a/packages/babel-parser/test/fixtures/test262/rest-parameter/array-pattern-single-element-with-object/output.json +++ b/packages/babel-parser/test/fixtures/test262/rest-parameter/array-pattern-single-element-with-object/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 48, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 48 - } - }, + "start":0,"end":48,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":48}}, "program": { "type": "Program", - "start": 0, - "end": 48, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 48 - } - }, + "start":0,"end":48,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":48}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 48, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 48 - } - }, + "start":0,"end":48,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":48}}, "id": { "type": "Identifier", - "start": 9, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 32 - }, - "identifierName": "singleElementWithObject" - }, + "start":9,"end":32,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":32},"identifierName":"singleElementWithObject"}, "name": "singleElementWithObject" }, "generator": false, @@ -65,97 +20,29 @@ "params": [ { "type": "RestElement", - "start": 33, - "end": 44, - "loc": { - "start": { - "line": 1, - "column": 33 - }, - "end": { - "line": 1, - "column": 44 - } - }, + "start":33,"end":44,"loc":{"start":{"line":1,"column":33},"end":{"line":1,"column":44}}, "argument": { "type": "ArrayPattern", - "start": 36, - "end": 44, - "loc": { - "start": { - "line": 1, - "column": 36 - }, - "end": { - "line": 1, - "column": 44 - } - }, + "start":36,"end":44,"loc":{"start":{"line":1,"column":36},"end":{"line":1,"column":44}}, "elements": [ { "type": "ObjectPattern", - "start": 37, - "end": 43, - "loc": { - "start": { - "line": 1, - "column": 37 - }, - "end": { - "line": 1, - "column": 43 - } - }, + "start":37,"end":43,"loc":{"start":{"line":1,"column":37},"end":{"line":1,"column":43}}, "properties": [ { "type": "ObjectProperty", - "start": 38, - "end": 42, - "loc": { - "start": { - "line": 1, - "column": 38 - }, - "end": { - "line": 1, - "column": 42 - } - }, + "start":38,"end":42,"loc":{"start":{"line":1,"column":38},"end":{"line":1,"column":42}}, "method": false, "key": { "type": "Identifier", - "start": 38, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 38 - }, - "end": { - "line": 1, - "column": 39 - }, - "identifierName": "p" - }, + "start":38,"end":39,"loc":{"start":{"line":1,"column":38},"end":{"line":1,"column":39},"identifierName":"p"}, "name": "p" }, "computed": false, "shorthand": false, "value": { "type": "Identifier", - "start": 41, - "end": 42, - "loc": { - "start": { - "line": 1, - "column": 41 - }, - "end": { - "line": 1, - "column": 42 - }, - "identifierName": "q" - }, + "start":41,"end":42,"loc":{"start":{"line":1,"column":41},"end":{"line":1,"column":42},"identifierName":"q"}, "name": "q" } } @@ -167,18 +54,7 @@ ], "body": { "type": "BlockStatement", - "start": 46, - "end": 48, - "loc": { - "start": { - "line": 1, - "column": 46 - }, - "end": { - "line": 1, - "column": 48 - } - }, + "start":46,"end":48,"loc":{"start":{"line":1,"column":46},"end":{"line":1,"column":48}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/test262/rest-parameter/array-pattern-single-element-with-rest/output.json b/packages/babel-parser/test/fixtures/test262/rest-parameter/array-pattern-single-element-with-rest/output.json index 30f7f466384c..a2993761b6e3 100644 --- a/packages/babel-parser/test/fixtures/test262/rest-parameter/array-pattern-single-element-with-rest/output.json +++ b/packages/babel-parser/test/fixtures/test262/rest-parameter/array-pattern-single-element-with-rest/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 44, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 44 - } - }, + "start":0,"end":44,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":44}}, "program": { "type": "Program", - "start": 0, - "end": 44, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 44 - } - }, + "start":0,"end":44,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":44}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 44, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 44 - } - }, + "start":0,"end":44,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":44}}, "id": { "type": "Identifier", - "start": 9, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 30 - }, - "identifierName": "singleElementWithRest" - }, + "start":9,"end":30,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":30},"identifierName":"singleElementWithRest"}, "name": "singleElementWithRest" }, "generator": false, @@ -65,62 +20,17 @@ "params": [ { "type": "RestElement", - "start": 31, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 31 - }, - "end": { - "line": 1, - "column": 40 - } - }, + "start":31,"end":40,"loc":{"start":{"line":1,"column":31},"end":{"line":1,"column":40}}, "argument": { "type": "ArrayPattern", - "start": 34, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 34 - }, - "end": { - "line": 1, - "column": 40 - } - }, + "start":34,"end":40,"loc":{"start":{"line":1,"column":34},"end":{"line":1,"column":40}}, "elements": [ { "type": "RestElement", - "start": 35, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 35 - }, - "end": { - "line": 1, - "column": 39 - } - }, + "start":35,"end":39,"loc":{"start":{"line":1,"column":35},"end":{"line":1,"column":39}}, "argument": { "type": "Identifier", - "start": 38, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 38 - }, - "end": { - "line": 1, - "column": 39 - }, - "identifierName": "a" - }, + "start":38,"end":39,"loc":{"start":{"line":1,"column":38},"end":{"line":1,"column":39},"identifierName":"a"}, "name": "a" } } @@ -130,18 +40,7 @@ ], "body": { "type": "BlockStatement", - "start": 42, - "end": 44, - "loc": { - "start": { - "line": 1, - "column": 42 - }, - "end": { - "line": 1, - "column": 44 - } - }, + "start":42,"end":44,"loc":{"start":{"line":1,"column":42},"end":{"line":1,"column":44}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/test262/rest-parameter/array-pattern-single-element/output.json b/packages/babel-parser/test/fixtures/test262/rest-parameter/array-pattern-single-element/output.json index 1e1d390dd11d..6ecc2a7294b8 100644 --- a/packages/babel-parser/test/fixtures/test262/rest-parameter/array-pattern-single-element/output.json +++ b/packages/babel-parser/test/fixtures/test262/rest-parameter/array-pattern-single-element/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, "program": { "type": "Program", - "start": 0, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, "id": { "type": "Identifier", - "start": 9, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 22 - }, - "identifierName": "singleElement" - }, + "start":9,"end":22,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":22},"identifierName":"singleElement"}, "name": "singleElement" }, "generator": false, @@ -65,48 +20,14 @@ "params": [ { "type": "RestElement", - "start": 23, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":23,"end":29,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":29}}, "argument": { "type": "ArrayPattern", - "start": 26, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":26,"end":29,"loc":{"start":{"line":1,"column":26},"end":{"line":1,"column":29}}, "elements": [ { "type": "Identifier", - "start": 27, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 28 - }, - "identifierName": "a" - }, + "start":27,"end":28,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":28},"identifierName":"a"}, "name": "a" } ] @@ -115,18 +36,7 @@ ], "body": { "type": "BlockStatement", - "start": 31, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 31 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":31,"end":33,"loc":{"start":{"line":1,"column":31},"end":{"line":1,"column":33}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/test262/rest-parameter/object-pattern-empty-with-array/output.json b/packages/babel-parser/test/fixtures/test262/rest-parameter/object-pattern-empty-with-array/output.json index 9b97deac6b2e..6d666e5a46b4 100644 --- a/packages/babel-parser/test/fixtures/test262/rest-parameter/object-pattern-empty-with-array/output.json +++ b/packages/babel-parser/test/fixtures/test262/rest-parameter/object-pattern-empty-with-array/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":38}}, "program": { "type": "Program", - "start": 0, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":38}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":38}}, "id": { "type": "Identifier", - "start": 9, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 23 - }, - "identifierName": "emptyWithArray" - }, + "start":9,"end":23,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":23},"identifierName":"emptyWithArray"}, "name": "emptyWithArray" }, "generator": false, @@ -65,81 +20,25 @@ "params": [ { "type": "RestElement", - "start": 24, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":24,"end":34,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":34}}, "argument": { "type": "ObjectPattern", - "start": 27, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":27,"end":34,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":34}}, "properties": [ { "type": "ObjectProperty", - "start": 28, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":28,"end":33,"loc":{"start":{"line":1,"column":28},"end":{"line":1,"column":33}}, "method": false, "key": { "type": "Identifier", - "start": 28, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 29 - }, - "identifierName": "p" - }, + "start":28,"end":29,"loc":{"start":{"line":1,"column":28},"end":{"line":1,"column":29},"identifierName":"p"}, "name": "p" }, "computed": false, "shorthand": false, "value": { "type": "ArrayPattern", - "start": 31, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 31 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":31,"end":33,"loc":{"start":{"line":1,"column":31},"end":{"line":1,"column":33}}, "elements": [] } } @@ -149,18 +48,7 @@ ], "body": { "type": "BlockStatement", - "start": 36, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 36 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":36,"end":38,"loc":{"start":{"line":1,"column":36},"end":{"line":1,"column":38}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/test262/rest-parameter/object-pattern-empty-with-leading/output.json b/packages/babel-parser/test/fixtures/test262/rest-parameter/object-pattern-empty-with-leading/output.json index 1dec0f7ede36..ef2261c2c2f1 100644 --- a/packages/babel-parser/test/fixtures/test262/rest-parameter/object-pattern-empty-with-leading/output.json +++ b/packages/babel-parser/test/fixtures/test262/rest-parameter/object-pattern-empty-with-leading/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":38}}, "program": { "type": "Program", - "start": 0, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":38}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":38}}, "id": { "type": "Identifier", - "start": 9, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 25 - }, - "identifierName": "emptyWithLeading" - }, + "start":9,"end":25,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":25},"identifierName":"emptyWithLeading"}, "name": "emptyWithLeading" }, "generator": false, @@ -65,67 +20,22 @@ "params": [ { "type": "Identifier", - "start": 26, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 27 - }, - "identifierName": "x" - }, + "start":26,"end":27,"loc":{"start":{"line":1,"column":26},"end":{"line":1,"column":27},"identifierName":"x"}, "name": "x" }, { "type": "RestElement", - "start": 29, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":29,"end":34,"loc":{"start":{"line":1,"column":29},"end":{"line":1,"column":34}}, "argument": { "type": "ObjectPattern", - "start": 32, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 32 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":32,"end":34,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":34}}, "properties": [] } } ], "body": { "type": "BlockStatement", - "start": 36, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 36 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":36,"end":38,"loc":{"start":{"line":1,"column":36},"end":{"line":1,"column":38}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/test262/rest-parameter/object-pattern-empty-with-object/output.json b/packages/babel-parser/test/fixtures/test262/rest-parameter/object-pattern-empty-with-object/output.json index 34756c1b315f..02d071d32324 100644 --- a/packages/babel-parser/test/fixtures/test262/rest-parameter/object-pattern-empty-with-object/output.json +++ b/packages/babel-parser/test/fixtures/test262/rest-parameter/object-pattern-empty-with-object/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 39 - } - }, + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":39}}, "program": { "type": "Program", - "start": 0, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 39 - } - }, + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":39}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 39 - } - }, + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":39}}, "id": { "type": "Identifier", - "start": 9, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 24 - }, - "identifierName": "emptyWithObject" - }, + "start":9,"end":24,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":24},"identifierName":"emptyWithObject"}, "name": "emptyWithObject" }, "generator": false, @@ -65,81 +20,25 @@ "params": [ { "type": "RestElement", - "start": 25, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":25,"end":35,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":35}}, "argument": { "type": "ObjectPattern", - "start": 28, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":28,"end":35,"loc":{"start":{"line":1,"column":28},"end":{"line":1,"column":35}}, "properties": [ { "type": "ObjectProperty", - "start": 29, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":29,"end":34,"loc":{"start":{"line":1,"column":29},"end":{"line":1,"column":34}}, "method": false, "key": { "type": "Identifier", - "start": 29, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 1, - "column": 30 - }, - "identifierName": "p" - }, + "start":29,"end":30,"loc":{"start":{"line":1,"column":29},"end":{"line":1,"column":30},"identifierName":"p"}, "name": "p" }, "computed": false, "shorthand": false, "value": { "type": "ObjectPattern", - "start": 32, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 32 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":32,"end":34,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":34}}, "properties": [] } } @@ -149,18 +48,7 @@ ], "body": { "type": "BlockStatement", - "start": 37, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 37 - }, - "end": { - "line": 1, - "column": 39 - } - }, + "start":37,"end":39,"loc":{"start":{"line":1,"column":37},"end":{"line":1,"column":39}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/test262/rest-parameter/object-pattern-empty/output.json b/packages/babel-parser/test/fixtures/test262/rest-parameter/object-pattern-empty/output.json index a8589a5f2dbf..cd7e8ac5f178 100644 --- a/packages/babel-parser/test/fixtures/test262/rest-parameter/object-pattern-empty/output.json +++ b/packages/babel-parser/test/fixtures/test262/rest-parameter/object-pattern-empty/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "program": { "type": "Program", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "id": { "type": "Identifier", - "start": 9, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 14 - }, - "identifierName": "empty" - }, + "start":9,"end":14,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":14},"identifierName":"empty"}, "name": "empty" }, "generator": false, @@ -65,50 +20,17 @@ "params": [ { "type": "RestElement", - "start": 15, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":15,"end":20,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":20}}, "argument": { "type": "ObjectPattern", - "start": 18, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":18,"end":20,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":20}}, "properties": [] } } ], "body": { "type": "BlockStatement", - "start": 22, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":22,"end":24,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":24}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/test262/rest-parameter/object-pattern-multi-element-with-array/output.json b/packages/babel-parser/test/fixtures/test262/rest-parameter/object-pattern-multi-element-with-array/output.json index ee619e14ad22..a9038fabb2dc 100644 --- a/packages/babel-parser/test/fixtures/test262/rest-parameter/object-pattern-multi-element-with-array/output.json +++ b/packages/babel-parser/test/fixtures/test262/rest-parameter/object-pattern-multi-element-with-array/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 57, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 57 - } - }, + "start":0,"end":57,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":57}}, "program": { "type": "Program", - "start": 0, - "end": 57, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 57 - } - }, + "start":0,"end":57,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":57}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 57, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 57 - } - }, + "start":0,"end":57,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":57}}, "id": { "type": "Identifier", - "start": 9, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 30 - }, - "identifierName": "multiElementWithArray" - }, + "start":9,"end":30,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":30},"identifierName":"multiElementWithArray"}, "name": "multiElementWithArray" }, "generator": false, @@ -65,97 +20,29 @@ "params": [ { "type": "RestElement", - "start": 31, - "end": 53, - "loc": { - "start": { - "line": 1, - "column": 31 - }, - "end": { - "line": 1, - "column": 53 - } - }, + "start":31,"end":53,"loc":{"start":{"line":1,"column":31},"end":{"line":1,"column":53}}, "argument": { "type": "ObjectPattern", - "start": 34, - "end": 53, - "loc": { - "start": { - "line": 1, - "column": 34 - }, - "end": { - "line": 1, - "column": 53 - } - }, + "start":34,"end":53,"loc":{"start":{"line":1,"column":34},"end":{"line":1,"column":53}}, "properties": [ { "type": "ObjectProperty", - "start": 35, - "end": 41, - "loc": { - "start": { - "line": 1, - "column": 35 - }, - "end": { - "line": 1, - "column": 41 - } - }, + "start":35,"end":41,"loc":{"start":{"line":1,"column":35},"end":{"line":1,"column":41}}, "method": false, "key": { "type": "Identifier", - "start": 35, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 35 - }, - "end": { - "line": 1, - "column": 36 - }, - "identifierName": "p" - }, + "start":35,"end":36,"loc":{"start":{"line":1,"column":35},"end":{"line":1,"column":36},"identifierName":"p"}, "name": "p" }, "computed": false, "shorthand": false, "value": { "type": "ArrayPattern", - "start": 38, - "end": 41, - "loc": { - "start": { - "line": 1, - "column": 38 - }, - "end": { - "line": 1, - "column": 41 - } - }, + "start":38,"end":41,"loc":{"start":{"line":1,"column":38},"end":{"line":1,"column":41}}, "elements": [ { "type": "Identifier", - "start": 39, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 39 - }, - "end": { - "line": 1, - "column": 40 - }, - "identifierName": "a" - }, + "start":39,"end":40,"loc":{"start":{"line":1,"column":39},"end":{"line":1,"column":40},"identifierName":"a"}, "name": "a" } ] @@ -163,53 +50,18 @@ }, { "type": "ObjectProperty", - "start": 43, - "end": 44, - "loc": { - "start": { - "line": 1, - "column": 43 - }, - "end": { - "line": 1, - "column": 44 - } - }, + "start":43,"end":44,"loc":{"start":{"line":1,"column":43},"end":{"line":1,"column":44}}, "method": false, "key": { "type": "Identifier", - "start": 43, - "end": 44, - "loc": { - "start": { - "line": 1, - "column": 43 - }, - "end": { - "line": 1, - "column": 44 - }, - "identifierName": "b" - }, + "start":43,"end":44,"loc":{"start":{"line":1,"column":43},"end":{"line":1,"column":44},"identifierName":"b"}, "name": "b" }, "computed": false, "shorthand": true, "value": { "type": "Identifier", - "start": 43, - "end": 44, - "loc": { - "start": { - "line": 1, - "column": 43 - }, - "end": { - "line": 1, - "column": 44 - }, - "identifierName": "b" - }, + "start":43,"end":44,"loc":{"start":{"line":1,"column":43},"end":{"line":1,"column":44},"identifierName":"b"}, "name": "b" }, "extra": { @@ -218,68 +70,22 @@ }, { "type": "ObjectProperty", - "start": 46, - "end": 52, - "loc": { - "start": { - "line": 1, - "column": 46 - }, - "end": { - "line": 1, - "column": 52 - } - }, + "start":46,"end":52,"loc":{"start":{"line":1,"column":46},"end":{"line":1,"column":52}}, "method": false, "key": { "type": "Identifier", - "start": 46, - "end": 47, - "loc": { - "start": { - "line": 1, - "column": 46 - }, - "end": { - "line": 1, - "column": 47 - }, - "identifierName": "q" - }, + "start":46,"end":47,"loc":{"start":{"line":1,"column":46},"end":{"line":1,"column":47},"identifierName":"q"}, "name": "q" }, "computed": false, "shorthand": false, "value": { "type": "ArrayPattern", - "start": 49, - "end": 52, - "loc": { - "start": { - "line": 1, - "column": 49 - }, - "end": { - "line": 1, - "column": 52 - } - }, + "start":49,"end":52,"loc":{"start":{"line":1,"column":49},"end":{"line":1,"column":52}}, "elements": [ { "type": "Identifier", - "start": 50, - "end": 51, - "loc": { - "start": { - "line": 1, - "column": 50 - }, - "end": { - "line": 1, - "column": 51 - }, - "identifierName": "c" - }, + "start":50,"end":51,"loc":{"start":{"line":1,"column":50},"end":{"line":1,"column":51},"identifierName":"c"}, "name": "c" } ] @@ -291,18 +97,7 @@ ], "body": { "type": "BlockStatement", - "start": 55, - "end": 57, - "loc": { - "start": { - "line": 1, - "column": 55 - }, - "end": { - "line": 1, - "column": 57 - } - }, + "start":55,"end":57,"loc":{"start":{"line":1,"column":55},"end":{"line":1,"column":57}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/test262/rest-parameter/object-pattern-multi-element-with-initializer/output.json b/packages/babel-parser/test/fixtures/test262/rest-parameter/object-pattern-multi-element-with-initializer/output.json index 585a0f4a8ae3..9dbaf187ba7a 100644 --- a/packages/babel-parser/test/fixtures/test262/rest-parameter/object-pattern-multi-element-with-initializer/output.json +++ b/packages/babel-parser/test/fixtures/test262/rest-parameter/object-pattern-multi-element-with-initializer/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 70, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 70 - } - }, + "start":0,"end":70,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":70}}, "program": { "type": "Program", - "start": 0, - "end": 70, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 70 - } - }, + "start":0,"end":70,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":70}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 70, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 70 - } - }, + "start":0,"end":70,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":70}}, "id": { "type": "Identifier", - "start": 9, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 36 - }, - "identifierName": "multiElementWithInitializer" - }, + "start":9,"end":36,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":36},"identifierName":"multiElementWithInitializer"}, "name": "multiElementWithInitializer" }, "generator": false, @@ -65,112 +20,33 @@ "params": [ { "type": "RestElement", - "start": 37, - "end": 66, - "loc": { - "start": { - "line": 1, - "column": 37 - }, - "end": { - "line": 1, - "column": 66 - } - }, + "start":37,"end":66,"loc":{"start":{"line":1,"column":37},"end":{"line":1,"column":66}}, "argument": { "type": "ObjectPattern", - "start": 40, - "end": 66, - "loc": { - "start": { - "line": 1, - "column": 40 - }, - "end": { - "line": 1, - "column": 66 - } - }, + "start":40,"end":66,"loc":{"start":{"line":1,"column":40},"end":{"line":1,"column":66}}, "properties": [ { "type": "ObjectProperty", - "start": 41, - "end": 49, - "loc": { - "start": { - "line": 1, - "column": 41 - }, - "end": { - "line": 1, - "column": 49 - } - }, + "start":41,"end":49,"loc":{"start":{"line":1,"column":41},"end":{"line":1,"column":49}}, "method": false, "key": { "type": "Identifier", - "start": 41, - "end": 42, - "loc": { - "start": { - "line": 1, - "column": 41 - }, - "end": { - "line": 1, - "column": 42 - }, - "identifierName": "a" - }, + "start":41,"end":42,"loc":{"start":{"line":1,"column":41},"end":{"line":1,"column":42},"identifierName":"a"}, "name": "a" }, "computed": false, "shorthand": false, "value": { "type": "AssignmentPattern", - "start": 44, - "end": 49, - "loc": { - "start": { - "line": 1, - "column": 44 - }, - "end": { - "line": 1, - "column": 49 - } - }, + "start":44,"end":49,"loc":{"start":{"line":1,"column":44},"end":{"line":1,"column":49}}, "left": { "type": "Identifier", - "start": 44, - "end": 45, - "loc": { - "start": { - "line": 1, - "column": 44 - }, - "end": { - "line": 1, - "column": 45 - }, - "identifierName": "r" - }, + "start":44,"end":45,"loc":{"start":{"line":1,"column":44},"end":{"line":1,"column":45},"identifierName":"r"}, "name": "r" }, "right": { "type": "NumericLiteral", - "start": 48, - "end": 49, - "loc": { - "start": { - "line": 1, - "column": 48 - }, - "end": { - "line": 1, - "column": 49 - } - }, + "start":48,"end":49,"loc":{"start":{"line":1,"column":48},"end":{"line":1,"column":49}}, "extra": { "rawValue": 0, "raw": "0" @@ -181,135 +57,43 @@ }, { "type": "ObjectProperty", - "start": 51, - "end": 55, - "loc": { - "start": { - "line": 1, - "column": 51 - }, - "end": { - "line": 1, - "column": 55 - } - }, + "start":51,"end":55,"loc":{"start":{"line":1,"column":51},"end":{"line":1,"column":55}}, "method": false, "key": { "type": "Identifier", - "start": 51, - "end": 52, - "loc": { - "start": { - "line": 1, - "column": 51 - }, - "end": { - "line": 1, - "column": 52 - }, - "identifierName": "b" - }, + "start":51,"end":52,"loc":{"start":{"line":1,"column":51},"end":{"line":1,"column":52},"identifierName":"b"}, "name": "b" }, "computed": false, "shorthand": false, "value": { "type": "Identifier", - "start": 54, - "end": 55, - "loc": { - "start": { - "line": 1, - "column": 54 - }, - "end": { - "line": 1, - "column": 55 - }, - "identifierName": "s" - }, + "start":54,"end":55,"loc":{"start":{"line":1,"column":54},"end":{"line":1,"column":55},"identifierName":"s"}, "name": "s" } }, { "type": "ObjectProperty", - "start": 57, - "end": 65, - "loc": { - "start": { - "line": 1, - "column": 57 - }, - "end": { - "line": 1, - "column": 65 - } - }, + "start":57,"end":65,"loc":{"start":{"line":1,"column":57},"end":{"line":1,"column":65}}, "method": false, "key": { "type": "Identifier", - "start": 57, - "end": 58, - "loc": { - "start": { - "line": 1, - "column": 57 - }, - "end": { - "line": 1, - "column": 58 - }, - "identifierName": "c" - }, + "start":57,"end":58,"loc":{"start":{"line":1,"column":57},"end":{"line":1,"column":58},"identifierName":"c"}, "name": "c" }, "computed": false, "shorthand": false, "value": { "type": "AssignmentPattern", - "start": 60, - "end": 65, - "loc": { - "start": { - "line": 1, - "column": 60 - }, - "end": { - "line": 1, - "column": 65 - } - }, + "start":60,"end":65,"loc":{"start":{"line":1,"column":60},"end":{"line":1,"column":65}}, "left": { "type": "Identifier", - "start": 60, - "end": 61, - "loc": { - "start": { - "line": 1, - "column": 60 - }, - "end": { - "line": 1, - "column": 61 - }, - "identifierName": "t" - }, + "start":60,"end":61,"loc":{"start":{"line":1,"column":60},"end":{"line":1,"column":61},"identifierName":"t"}, "name": "t" }, "right": { "type": "NumericLiteral", - "start": 64, - "end": 65, - "loc": { - "start": { - "line": 1, - "column": 64 - }, - "end": { - "line": 1, - "column": 65 - } - }, + "start":64,"end":65,"loc":{"start":{"line":1,"column":64},"end":{"line":1,"column":65}}, "extra": { "rawValue": 1, "raw": "1" @@ -324,18 +108,7 @@ ], "body": { "type": "BlockStatement", - "start": 68, - "end": 70, - "loc": { - "start": { - "line": 1, - "column": 68 - }, - "end": { - "line": 1, - "column": 70 - } - }, + "start":68,"end":70,"loc":{"start":{"line":1,"column":68},"end":{"line":1,"column":70}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/test262/rest-parameter/object-pattern-multi-element-with-leading/output.json b/packages/babel-parser/test/fixtures/test262/rest-parameter/object-pattern-multi-element-with-leading/output.json index 0d6e9f64b8cb..a59cc05c31f4 100644 --- a/packages/babel-parser/test/fixtures/test262/rest-parameter/object-pattern-multi-element-with-leading/output.json +++ b/packages/babel-parser/test/fixtures/test262/rest-parameter/object-pattern-multi-element-with-leading/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 64, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 64 - } - }, + "start":0,"end":64,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":64}}, "program": { "type": "Program", - "start": 0, - "end": 64, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 64 - } - }, + "start":0,"end":64,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":64}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 64, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 64 - } - }, + "start":0,"end":64,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":64}}, "id": { "type": "Identifier", - "start": 9, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 32 - }, - "identifierName": "multiElementWithLeading" - }, + "start":9,"end":32,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":32},"identifierName":"multiElementWithLeading"}, "name": "multiElementWithLeading" }, "generator": false, @@ -65,220 +20,69 @@ "params": [ { "type": "Identifier", - "start": 33, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 33 - }, - "end": { - "line": 1, - "column": 34 - }, - "identifierName": "x" - }, + "start":33,"end":34,"loc":{"start":{"line":1,"column":33},"end":{"line":1,"column":34},"identifierName":"x"}, "name": "x" }, { "type": "Identifier", - "start": 36, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 36 - }, - "end": { - "line": 1, - "column": 37 - }, - "identifierName": "y" - }, + "start":36,"end":37,"loc":{"start":{"line":1,"column":36},"end":{"line":1,"column":37},"identifierName":"y"}, "name": "y" }, { "type": "RestElement", - "start": 39, - "end": 60, - "loc": { - "start": { - "line": 1, - "column": 39 - }, - "end": { - "line": 1, - "column": 60 - } - }, + "start":39,"end":60,"loc":{"start":{"line":1,"column":39},"end":{"line":1,"column":60}}, "argument": { "type": "ObjectPattern", - "start": 42, - "end": 60, - "loc": { - "start": { - "line": 1, - "column": 42 - }, - "end": { - "line": 1, - "column": 60 - } - }, + "start":42,"end":60,"loc":{"start":{"line":1,"column":42},"end":{"line":1,"column":60}}, "properties": [ { "type": "ObjectProperty", - "start": 43, - "end": 47, - "loc": { - "start": { - "line": 1, - "column": 43 - }, - "end": { - "line": 1, - "column": 47 - } - }, + "start":43,"end":47,"loc":{"start":{"line":1,"column":43},"end":{"line":1,"column":47}}, "method": false, "key": { "type": "Identifier", - "start": 43, - "end": 44, - "loc": { - "start": { - "line": 1, - "column": 43 - }, - "end": { - "line": 1, - "column": 44 - }, - "identifierName": "a" - }, + "start":43,"end":44,"loc":{"start":{"line":1,"column":43},"end":{"line":1,"column":44},"identifierName":"a"}, "name": "a" }, "computed": false, "shorthand": false, "value": { "type": "Identifier", - "start": 46, - "end": 47, - "loc": { - "start": { - "line": 1, - "column": 46 - }, - "end": { - "line": 1, - "column": 47 - }, - "identifierName": "r" - }, + "start":46,"end":47,"loc":{"start":{"line":1,"column":46},"end":{"line":1,"column":47},"identifierName":"r"}, "name": "r" } }, { "type": "ObjectProperty", - "start": 49, - "end": 53, - "loc": { - "start": { - "line": 1, - "column": 49 - }, - "end": { - "line": 1, - "column": 53 - } - }, + "start":49,"end":53,"loc":{"start":{"line":1,"column":49},"end":{"line":1,"column":53}}, "method": false, "key": { "type": "Identifier", - "start": 49, - "end": 50, - "loc": { - "start": { - "line": 1, - "column": 49 - }, - "end": { - "line": 1, - "column": 50 - }, - "identifierName": "b" - }, + "start":49,"end":50,"loc":{"start":{"line":1,"column":49},"end":{"line":1,"column":50},"identifierName":"b"}, "name": "b" }, "computed": false, "shorthand": false, "value": { "type": "Identifier", - "start": 52, - "end": 53, - "loc": { - "start": { - "line": 1, - "column": 52 - }, - "end": { - "line": 1, - "column": 53 - }, - "identifierName": "s" - }, + "start":52,"end":53,"loc":{"start":{"line":1,"column":52},"end":{"line":1,"column":53},"identifierName":"s"}, "name": "s" } }, { "type": "ObjectProperty", - "start": 55, - "end": 59, - "loc": { - "start": { - "line": 1, - "column": 55 - }, - "end": { - "line": 1, - "column": 59 - } - }, + "start":55,"end":59,"loc":{"start":{"line":1,"column":55},"end":{"line":1,"column":59}}, "method": false, "key": { "type": "Identifier", - "start": 55, - "end": 56, - "loc": { - "start": { - "line": 1, - "column": 55 - }, - "end": { - "line": 1, - "column": 56 - }, - "identifierName": "c" - }, + "start":55,"end":56,"loc":{"start":{"line":1,"column":55},"end":{"line":1,"column":56},"identifierName":"c"}, "name": "c" }, "computed": false, "shorthand": false, "value": { "type": "Identifier", - "start": 58, - "end": 59, - "loc": { - "start": { - "line": 1, - "column": 58 - }, - "end": { - "line": 1, - "column": 59 - }, - "identifierName": "t" - }, + "start":58,"end":59,"loc":{"start":{"line":1,"column":58},"end":{"line":1,"column":59},"identifierName":"t"}, "name": "t" } } @@ -288,18 +92,7 @@ ], "body": { "type": "BlockStatement", - "start": 62, - "end": 64, - "loc": { - "start": { - "line": 1, - "column": 62 - }, - "end": { - "line": 1, - "column": 64 - } - }, + "start":62,"end":64,"loc":{"start":{"line":1,"column":62},"end":{"line":1,"column":64}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/test262/rest-parameter/object-pattern-multi-element-with-object/output.json b/packages/babel-parser/test/fixtures/test262/rest-parameter/object-pattern-multi-element-with-object/output.json index 4bca07d43f55..c42f82ea125a 100644 --- a/packages/babel-parser/test/fixtures/test262/rest-parameter/object-pattern-multi-element-with-object/output.json +++ b/packages/babel-parser/test/fixtures/test262/rest-parameter/object-pattern-multi-element-with-object/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 70, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 70 - } - }, + "start":0,"end":70,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":70}}, "program": { "type": "Program", - "start": 0, - "end": 70, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 70 - } - }, + "start":0,"end":70,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":70}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 70, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 70 - } - }, + "start":0,"end":70,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":70}}, "id": { "type": "Identifier", - "start": 9, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 31 - }, - "identifierName": "multiElementWithObject" - }, + "start":9,"end":31,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":31},"identifierName":"multiElementWithObject"}, "name": "multiElementWithObject" }, "generator": false, @@ -65,131 +20,40 @@ "params": [ { "type": "RestElement", - "start": 32, - "end": 66, - "loc": { - "start": { - "line": 1, - "column": 32 - }, - "end": { - "line": 1, - "column": 66 - } - }, + "start":32,"end":66,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":66}}, "argument": { "type": "ObjectPattern", - "start": 35, - "end": 66, - "loc": { - "start": { - "line": 1, - "column": 35 - }, - "end": { - "line": 1, - "column": 66 - } - }, + "start":35,"end":66,"loc":{"start":{"line":1,"column":35},"end":{"line":1,"column":66}}, "properties": [ { "type": "ObjectProperty", - "start": 36, - "end": 45, - "loc": { - "start": { - "line": 1, - "column": 36 - }, - "end": { - "line": 1, - "column": 45 - } - }, + "start":36,"end":45,"loc":{"start":{"line":1,"column":36},"end":{"line":1,"column":45}}, "method": false, "key": { "type": "Identifier", - "start": 36, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 36 - }, - "end": { - "line": 1, - "column": 37 - }, - "identifierName": "a" - }, + "start":36,"end":37,"loc":{"start":{"line":1,"column":36},"end":{"line":1,"column":37},"identifierName":"a"}, "name": "a" }, "computed": false, "shorthand": false, "value": { "type": "ObjectPattern", - "start": 39, - "end": 45, - "loc": { - "start": { - "line": 1, - "column": 39 - }, - "end": { - "line": 1, - "column": 45 - } - }, + "start":39,"end":45,"loc":{"start":{"line":1,"column":39},"end":{"line":1,"column":45}}, "properties": [ { "type": "ObjectProperty", - "start": 40, - "end": 44, - "loc": { - "start": { - "line": 1, - "column": 40 - }, - "end": { - "line": 1, - "column": 44 - } - }, + "start":40,"end":44,"loc":{"start":{"line":1,"column":40},"end":{"line":1,"column":44}}, "method": false, "key": { "type": "Identifier", - "start": 40, - "end": 41, - "loc": { - "start": { - "line": 1, - "column": 40 - }, - "end": { - "line": 1, - "column": 41 - }, - "identifierName": "p" - }, + "start":40,"end":41,"loc":{"start":{"line":1,"column":40},"end":{"line":1,"column":41},"identifierName":"p"}, "name": "p" }, "computed": false, "shorthand": false, "value": { "type": "Identifier", - "start": 43, - "end": 44, - "loc": { - "start": { - "line": 1, - "column": 43 - }, - "end": { - "line": 1, - "column": 44 - }, - "identifierName": "q" - }, + "start":43,"end":44,"loc":{"start":{"line":1,"column":43},"end":{"line":1,"column":44},"identifierName":"q"}, "name": "q" } } @@ -198,102 +62,33 @@ }, { "type": "ObjectProperty", - "start": 47, - "end": 53, - "loc": { - "start": { - "line": 1, - "column": 47 - }, - "end": { - "line": 1, - "column": 53 - } - }, + "start":47,"end":53,"loc":{"start":{"line":1,"column":47},"end":{"line":1,"column":53}}, "method": false, "key": { "type": "Identifier", - "start": 47, - "end": 48, - "loc": { - "start": { - "line": 1, - "column": 47 - }, - "end": { - "line": 1, - "column": 48 - }, - "identifierName": "b" - }, + "start":47,"end":48,"loc":{"start":{"line":1,"column":47},"end":{"line":1,"column":48},"identifierName":"b"}, "name": "b" }, "computed": false, "shorthand": false, "value": { "type": "ObjectPattern", - "start": 50, - "end": 53, - "loc": { - "start": { - "line": 1, - "column": 50 - }, - "end": { - "line": 1, - "column": 53 - } - }, + "start":50,"end":53,"loc":{"start":{"line":1,"column":50},"end":{"line":1,"column":53}}, "properties": [ { "type": "ObjectProperty", - "start": 51, - "end": 52, - "loc": { - "start": { - "line": 1, - "column": 51 - }, - "end": { - "line": 1, - "column": 52 - } - }, + "start":51,"end":52,"loc":{"start":{"line":1,"column":51},"end":{"line":1,"column":52}}, "method": false, "key": { "type": "Identifier", - "start": 51, - "end": 52, - "loc": { - "start": { - "line": 1, - "column": 51 - }, - "end": { - "line": 1, - "column": 52 - }, - "identifierName": "r" - }, + "start":51,"end":52,"loc":{"start":{"line":1,"column":51},"end":{"line":1,"column":52},"identifierName":"r"}, "name": "r" }, "computed": false, "shorthand": true, "value": { "type": "Identifier", - "start": 51, - "end": 52, - "loc": { - "start": { - "line": 1, - "column": 51 - }, - "end": { - "line": 1, - "column": 52 - }, - "identifierName": "r" - }, + "start":51,"end":52,"loc":{"start":{"line":1,"column":51},"end":{"line":1,"column":52},"identifierName":"r"}, "name": "r" }, "extra": { @@ -305,132 +100,41 @@ }, { "type": "ObjectProperty", - "start": 55, - "end": 65, - "loc": { - "start": { - "line": 1, - "column": 55 - }, - "end": { - "line": 1, - "column": 65 - } - }, + "start":55,"end":65,"loc":{"start":{"line":1,"column":55},"end":{"line":1,"column":65}}, "method": false, "key": { "type": "Identifier", - "start": 55, - "end": 56, - "loc": { - "start": { - "line": 1, - "column": 55 - }, - "end": { - "line": 1, - "column": 56 - }, - "identifierName": "c" - }, + "start":55,"end":56,"loc":{"start":{"line":1,"column":55},"end":{"line":1,"column":56},"identifierName":"c"}, "name": "c" }, "computed": false, "shorthand": false, "value": { "type": "ObjectPattern", - "start": 58, - "end": 65, - "loc": { - "start": { - "line": 1, - "column": 58 - }, - "end": { - "line": 1, - "column": 65 - } - }, + "start":58,"end":65,"loc":{"start":{"line":1,"column":58},"end":{"line":1,"column":65}}, "properties": [ { "type": "ObjectProperty", - "start": 59, - "end": 64, - "loc": { - "start": { - "line": 1, - "column": 59 - }, - "end": { - "line": 1, - "column": 64 - } - }, + "start":59,"end":64,"loc":{"start":{"line":1,"column":59},"end":{"line":1,"column":64}}, "method": false, "key": { "type": "Identifier", - "start": 59, - "end": 60, - "loc": { - "start": { - "line": 1, - "column": 59 - }, - "end": { - "line": 1, - "column": 60 - }, - "identifierName": "s" - }, + "start":59,"end":60,"loc":{"start":{"line":1,"column":59},"end":{"line":1,"column":60},"identifierName":"s"}, "name": "s" }, "computed": false, "shorthand": true, "value": { "type": "AssignmentPattern", - "start": 59, - "end": 64, - "loc": { - "start": { - "line": 1, - "column": 59 - }, - "end": { - "line": 1, - "column": 64 - } - }, + "start":59,"end":64,"loc":{"start":{"line":1,"column":59},"end":{"line":1,"column":64}}, "left": { "type": "Identifier", - "start": 59, - "end": 60, - "loc": { - "start": { - "line": 1, - "column": 59 - }, - "end": { - "line": 1, - "column": 60 - }, - "identifierName": "s" - }, + "start":59,"end":60,"loc":{"start":{"line":1,"column":59},"end":{"line":1,"column":60},"identifierName":"s"}, "name": "s" }, "right": { "type": "NumericLiteral", - "start": 63, - "end": 64, - "loc": { - "start": { - "line": 1, - "column": 63 - }, - "end": { - "line": 1, - "column": 64 - } - }, + "start":63,"end":64,"loc":{"start":{"line":1,"column":63},"end":{"line":1,"column":64}}, "extra": { "rawValue": 0, "raw": "0" @@ -451,18 +155,7 @@ ], "body": { "type": "BlockStatement", - "start": 68, - "end": 70, - "loc": { - "start": { - "line": 1, - "column": 68 - }, - "end": { - "line": 1, - "column": 70 - } - }, + "start":68,"end":70,"loc":{"start":{"line":1,"column":68},"end":{"line":1,"column":70}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/test262/rest-parameter/object-pattern-multi-element/output.json b/packages/babel-parser/test/fixtures/test262/rest-parameter/object-pattern-multi-element/output.json index 2df38bfb4c2a..b3302e7b3a13 100644 --- a/packages/babel-parser/test/fixtures/test262/rest-parameter/object-pattern-multi-element/output.json +++ b/packages/babel-parser/test/fixtures/test262/rest-parameter/object-pattern-multi-element/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 47, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 47 - } - }, + "start":0,"end":47,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":47}}, "program": { "type": "Program", - "start": 0, - "end": 47, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 47 - } - }, + "start":0,"end":47,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":47}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 47, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 47 - } - }, + "start":0,"end":47,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":47}}, "id": { "type": "Identifier", - "start": 9, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 21 - }, - "identifierName": "multiElement" - }, + "start":9,"end":21,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":21},"identifierName":"multiElement"}, "name": "multiElement" }, "generator": false, @@ -65,186 +20,59 @@ "params": [ { "type": "RestElement", - "start": 22, - "end": 43, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 43 - } - }, + "start":22,"end":43,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":43}}, "argument": { "type": "ObjectPattern", - "start": 25, - "end": 43, - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 43 - } - }, + "start":25,"end":43,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":43}}, "properties": [ { "type": "ObjectProperty", - "start": 26, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":26,"end":30,"loc":{"start":{"line":1,"column":26},"end":{"line":1,"column":30}}, "method": false, "key": { "type": "Identifier", - "start": 26, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 27 - }, - "identifierName": "a" - }, + "start":26,"end":27,"loc":{"start":{"line":1,"column":26},"end":{"line":1,"column":27},"identifierName":"a"}, "name": "a" }, "computed": false, "shorthand": false, "value": { "type": "Identifier", - "start": 29, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 1, - "column": 30 - }, - "identifierName": "r" - }, + "start":29,"end":30,"loc":{"start":{"line":1,"column":29},"end":{"line":1,"column":30},"identifierName":"r"}, "name": "r" } }, { "type": "ObjectProperty", - "start": 32, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 32 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":32,"end":36,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":36}}, "method": false, "key": { "type": "Identifier", - "start": 32, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 32 - }, - "end": { - "line": 1, - "column": 33 - }, - "identifierName": "b" - }, + "start":32,"end":33,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":33},"identifierName":"b"}, "name": "b" }, "computed": false, "shorthand": false, "value": { "type": "Identifier", - "start": 35, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 35 - }, - "end": { - "line": 1, - "column": 36 - }, - "identifierName": "s" - }, + "start":35,"end":36,"loc":{"start":{"line":1,"column":35},"end":{"line":1,"column":36},"identifierName":"s"}, "name": "s" } }, { "type": "ObjectProperty", - "start": 38, - "end": 42, - "loc": { - "start": { - "line": 1, - "column": 38 - }, - "end": { - "line": 1, - "column": 42 - } - }, + "start":38,"end":42,"loc":{"start":{"line":1,"column":38},"end":{"line":1,"column":42}}, "method": false, "key": { "type": "Identifier", - "start": 38, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 38 - }, - "end": { - "line": 1, - "column": 39 - }, - "identifierName": "c" - }, + "start":38,"end":39,"loc":{"start":{"line":1,"column":38},"end":{"line":1,"column":39},"identifierName":"c"}, "name": "c" }, "computed": false, "shorthand": false, "value": { "type": "Identifier", - "start": 41, - "end": 42, - "loc": { - "start": { - "line": 1, - "column": 41 - }, - "end": { - "line": 1, - "column": 42 - }, - "identifierName": "t" - }, + "start":41,"end":42,"loc":{"start":{"line":1,"column":41},"end":{"line":1,"column":42},"identifierName":"t"}, "name": "t" } } @@ -254,18 +82,7 @@ ], "body": { "type": "BlockStatement", - "start": 45, - "end": 47, - "loc": { - "start": { - "line": 1, - "column": 45 - }, - "end": { - "line": 1, - "column": 47 - } - }, + "start":45,"end":47,"loc":{"start":{"line":1,"column":45},"end":{"line":1,"column":47}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/test262/rest-parameter/object-pattern-single-element-with-array/output.json b/packages/babel-parser/test/fixtures/test262/rest-parameter/object-pattern-single-element-with-array/output.json index 394be5e8a868..0311fd5cab5e 100644 --- a/packages/babel-parser/test/fixtures/test262/rest-parameter/object-pattern-single-element-with-array/output.json +++ b/packages/babel-parser/test/fixtures/test262/rest-parameter/object-pattern-single-element-with-array/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 47, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 47 - } - }, + "start":0,"end":47,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":47}}, "program": { "type": "Program", - "start": 0, - "end": 47, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 47 - } - }, + "start":0,"end":47,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":47}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 47, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 47 - } - }, + "start":0,"end":47,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":47}}, "id": { "type": "Identifier", - "start": 9, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 31 - }, - "identifierName": "singleElementWithArray" - }, + "start":9,"end":31,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":31},"identifierName":"singleElementWithArray"}, "name": "singleElementWithArray" }, "generator": false, @@ -65,97 +20,29 @@ "params": [ { "type": "RestElement", - "start": 32, - "end": 43, - "loc": { - "start": { - "line": 1, - "column": 32 - }, - "end": { - "line": 1, - "column": 43 - } - }, + "start":32,"end":43,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":43}}, "argument": { "type": "ObjectPattern", - "start": 35, - "end": 43, - "loc": { - "start": { - "line": 1, - "column": 35 - }, - "end": { - "line": 1, - "column": 43 - } - }, + "start":35,"end":43,"loc":{"start":{"line":1,"column":35},"end":{"line":1,"column":43}}, "properties": [ { "type": "ObjectProperty", - "start": 36, - "end": 42, - "loc": { - "start": { - "line": 1, - "column": 36 - }, - "end": { - "line": 1, - "column": 42 - } - }, + "start":36,"end":42,"loc":{"start":{"line":1,"column":36},"end":{"line":1,"column":42}}, "method": false, "key": { "type": "Identifier", - "start": 36, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 36 - }, - "end": { - "line": 1, - "column": 37 - }, - "identifierName": "p" - }, + "start":36,"end":37,"loc":{"start":{"line":1,"column":36},"end":{"line":1,"column":37},"identifierName":"p"}, "name": "p" }, "computed": false, "shorthand": false, "value": { "type": "ArrayPattern", - "start": 39, - "end": 42, - "loc": { - "start": { - "line": 1, - "column": 39 - }, - "end": { - "line": 1, - "column": 42 - } - }, + "start":39,"end":42,"loc":{"start":{"line":1,"column":39},"end":{"line":1,"column":42}}, "elements": [ { "type": "Identifier", - "start": 40, - "end": 41, - "loc": { - "start": { - "line": 1, - "column": 40 - }, - "end": { - "line": 1, - "column": 41 - }, - "identifierName": "a" - }, + "start":40,"end":41,"loc":{"start":{"line":1,"column":40},"end":{"line":1,"column":41},"identifierName":"a"}, "name": "a" } ] @@ -167,18 +54,7 @@ ], "body": { "type": "BlockStatement", - "start": 45, - "end": 47, - "loc": { - "start": { - "line": 1, - "column": 45 - }, - "end": { - "line": 1, - "column": 47 - } - }, + "start":45,"end":47,"loc":{"start":{"line":1,"column":45},"end":{"line":1,"column":47}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/test262/rest-parameter/object-pattern-single-element-with-initializer/output.json b/packages/babel-parser/test/fixtures/test262/rest-parameter/object-pattern-single-element-with-initializer/output.json index 20ac2d6fcb59..23f152c7a96d 100644 --- a/packages/babel-parser/test/fixtures/test262/rest-parameter/object-pattern-single-element-with-initializer/output.json +++ b/packages/babel-parser/test/fixtures/test262/rest-parameter/object-pattern-single-element-with-initializer/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 55, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 55 - } - }, + "start":0,"end":55,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":55}}, "program": { "type": "Program", - "start": 0, - "end": 55, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 55 - } - }, + "start":0,"end":55,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":55}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 55, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 55 - } - }, + "start":0,"end":55,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":55}}, "id": { "type": "Identifier", - "start": 9, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 37 - }, - "identifierName": "singleElementWithInitializer" - }, + "start":9,"end":37,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":37},"identifierName":"singleElementWithInitializer"}, "name": "singleElementWithInitializer" }, "generator": false, @@ -65,112 +20,33 @@ "params": [ { "type": "RestElement", - "start": 38, - "end": 51, - "loc": { - "start": { - "line": 1, - "column": 38 - }, - "end": { - "line": 1, - "column": 51 - } - }, + "start":38,"end":51,"loc":{"start":{"line":1,"column":38},"end":{"line":1,"column":51}}, "argument": { "type": "ObjectPattern", - "start": 41, - "end": 51, - "loc": { - "start": { - "line": 1, - "column": 41 - }, - "end": { - "line": 1, - "column": 51 - } - }, + "start":41,"end":51,"loc":{"start":{"line":1,"column":41},"end":{"line":1,"column":51}}, "properties": [ { "type": "ObjectProperty", - "start": 42, - "end": 50, - "loc": { - "start": { - "line": 1, - "column": 42 - }, - "end": { - "line": 1, - "column": 50 - } - }, + "start":42,"end":50,"loc":{"start":{"line":1,"column":42},"end":{"line":1,"column":50}}, "method": false, "key": { "type": "Identifier", - "start": 42, - "end": 43, - "loc": { - "start": { - "line": 1, - "column": 42 - }, - "end": { - "line": 1, - "column": 43 - }, - "identifierName": "a" - }, + "start":42,"end":43,"loc":{"start":{"line":1,"column":42},"end":{"line":1,"column":43},"identifierName":"a"}, "name": "a" }, "computed": false, "shorthand": false, "value": { "type": "AssignmentPattern", - "start": 45, - "end": 50, - "loc": { - "start": { - "line": 1, - "column": 45 - }, - "end": { - "line": 1, - "column": 50 - } - }, + "start":45,"end":50,"loc":{"start":{"line":1,"column":45},"end":{"line":1,"column":50}}, "left": { "type": "Identifier", - "start": 45, - "end": 46, - "loc": { - "start": { - "line": 1, - "column": 45 - }, - "end": { - "line": 1, - "column": 46 - }, - "identifierName": "b" - }, + "start":45,"end":46,"loc":{"start":{"line":1,"column":45},"end":{"line":1,"column":46},"identifierName":"b"}, "name": "b" }, "right": { "type": "NumericLiteral", - "start": 49, - "end": 50, - "loc": { - "start": { - "line": 1, - "column": 49 - }, - "end": { - "line": 1, - "column": 50 - } - }, + "start":49,"end":50,"loc":{"start":{"line":1,"column":49},"end":{"line":1,"column":50}}, "extra": { "rawValue": 0, "raw": "0" @@ -185,18 +61,7 @@ ], "body": { "type": "BlockStatement", - "start": 53, - "end": 55, - "loc": { - "start": { - "line": 1, - "column": 53 - }, - "end": { - "line": 1, - "column": 55 - } - }, + "start":53,"end":55,"loc":{"start":{"line":1,"column":53},"end":{"line":1,"column":55}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/test262/rest-parameter/object-pattern-single-element-with-leading/output.json b/packages/babel-parser/test/fixtures/test262/rest-parameter/object-pattern-single-element-with-leading/output.json index 6a8dc5942eff..ca789048f361 100644 --- a/packages/babel-parser/test/fixtures/test262/rest-parameter/object-pattern-single-element-with-leading/output.json +++ b/packages/babel-parser/test/fixtures/test262/rest-parameter/object-pattern-single-element-with-leading/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 50, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 50 - } - }, + "start":0,"end":50,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":50}}, "program": { "type": "Program", - "start": 0, - "end": 50, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 50 - } - }, + "start":0,"end":50,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":50}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 50, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 50 - } - }, + "start":0,"end":50,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":50}}, "id": { "type": "Identifier", - "start": 9, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 33 - }, - "identifierName": "singleElementWithLeading" - }, + "start":9,"end":33,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":33},"identifierName":"singleElementWithLeading"}, "name": "singleElementWithLeading" }, "generator": false, @@ -65,99 +20,30 @@ "params": [ { "type": "Identifier", - "start": 34, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 34 - }, - "end": { - "line": 1, - "column": 35 - }, - "identifierName": "x" - }, + "start":34,"end":35,"loc":{"start":{"line":1,"column":34},"end":{"line":1,"column":35},"identifierName":"x"}, "name": "x" }, { "type": "RestElement", - "start": 37, - "end": 46, - "loc": { - "start": { - "line": 1, - "column": 37 - }, - "end": { - "line": 1, - "column": 46 - } - }, + "start":37,"end":46,"loc":{"start":{"line":1,"column":37},"end":{"line":1,"column":46}}, "argument": { "type": "ObjectPattern", - "start": 40, - "end": 46, - "loc": { - "start": { - "line": 1, - "column": 40 - }, - "end": { - "line": 1, - "column": 46 - } - }, + "start":40,"end":46,"loc":{"start":{"line":1,"column":40},"end":{"line":1,"column":46}}, "properties": [ { "type": "ObjectProperty", - "start": 41, - "end": 45, - "loc": { - "start": { - "line": 1, - "column": 41 - }, - "end": { - "line": 1, - "column": 45 - } - }, + "start":41,"end":45,"loc":{"start":{"line":1,"column":41},"end":{"line":1,"column":45}}, "method": false, "key": { "type": "Identifier", - "start": 41, - "end": 42, - "loc": { - "start": { - "line": 1, - "column": 41 - }, - "end": { - "line": 1, - "column": 42 - }, - "identifierName": "a" - }, + "start":41,"end":42,"loc":{"start":{"line":1,"column":41},"end":{"line":1,"column":42},"identifierName":"a"}, "name": "a" }, "computed": false, "shorthand": false, "value": { "type": "Identifier", - "start": 44, - "end": 45, - "loc": { - "start": { - "line": 1, - "column": 44 - }, - "end": { - "line": 1, - "column": 45 - }, - "identifierName": "b" - }, + "start":44,"end":45,"loc":{"start":{"line":1,"column":44},"end":{"line":1,"column":45},"identifierName":"b"}, "name": "b" } } @@ -167,18 +53,7 @@ ], "body": { "type": "BlockStatement", - "start": 48, - "end": 50, - "loc": { - "start": { - "line": 1, - "column": 48 - }, - "end": { - "line": 1, - "column": 50 - } - }, + "start":48,"end":50,"loc":{"start":{"line":1,"column":48},"end":{"line":1,"column":50}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/test262/rest-parameter/object-pattern-single-element-with-object/output.json b/packages/babel-parser/test/fixtures/test262/rest-parameter/object-pattern-single-element-with-object/output.json index aed5cd10d422..8612e11a8ca3 100644 --- a/packages/babel-parser/test/fixtures/test262/rest-parameter/object-pattern-single-element-with-object/output.json +++ b/packages/babel-parser/test/fixtures/test262/rest-parameter/object-pattern-single-element-with-object/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 51, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 51 - } - }, + "start":0,"end":51,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":51}}, "program": { "type": "Program", - "start": 0, - "end": 51, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 51 - } - }, + "start":0,"end":51,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":51}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 51, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 51 - } - }, + "start":0,"end":51,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":51}}, "id": { "type": "Identifier", - "start": 9, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 32 - }, - "identifierName": "singleElementWithObject" - }, + "start":9,"end":32,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":32},"identifierName":"singleElementWithObject"}, "name": "singleElementWithObject" }, "generator": false, @@ -65,131 +20,40 @@ "params": [ { "type": "RestElement", - "start": 33, - "end": 47, - "loc": { - "start": { - "line": 1, - "column": 33 - }, - "end": { - "line": 1, - "column": 47 - } - }, + "start":33,"end":47,"loc":{"start":{"line":1,"column":33},"end":{"line":1,"column":47}}, "argument": { "type": "ObjectPattern", - "start": 36, - "end": 47, - "loc": { - "start": { - "line": 1, - "column": 36 - }, - "end": { - "line": 1, - "column": 47 - } - }, + "start":36,"end":47,"loc":{"start":{"line":1,"column":36},"end":{"line":1,"column":47}}, "properties": [ { "type": "ObjectProperty", - "start": 37, - "end": 46, - "loc": { - "start": { - "line": 1, - "column": 37 - }, - "end": { - "line": 1, - "column": 46 - } - }, + "start":37,"end":46,"loc":{"start":{"line":1,"column":37},"end":{"line":1,"column":46}}, "method": false, "key": { "type": "Identifier", - "start": 37, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 37 - }, - "end": { - "line": 1, - "column": 38 - }, - "identifierName": "p" - }, + "start":37,"end":38,"loc":{"start":{"line":1,"column":37},"end":{"line":1,"column":38},"identifierName":"p"}, "name": "p" }, "computed": false, "shorthand": false, "value": { "type": "ObjectPattern", - "start": 40, - "end": 46, - "loc": { - "start": { - "line": 1, - "column": 40 - }, - "end": { - "line": 1, - "column": 46 - } - }, + "start":40,"end":46,"loc":{"start":{"line":1,"column":40},"end":{"line":1,"column":46}}, "properties": [ { "type": "ObjectProperty", - "start": 41, - "end": 45, - "loc": { - "start": { - "line": 1, - "column": 41 - }, - "end": { - "line": 1, - "column": 45 - } - }, + "start":41,"end":45,"loc":{"start":{"line":1,"column":41},"end":{"line":1,"column":45}}, "method": false, "key": { "type": "Identifier", - "start": 41, - "end": 42, - "loc": { - "start": { - "line": 1, - "column": 41 - }, - "end": { - "line": 1, - "column": 42 - }, - "identifierName": "a" - }, + "start":41,"end":42,"loc":{"start":{"line":1,"column":41},"end":{"line":1,"column":42},"identifierName":"a"}, "name": "a" }, "computed": false, "shorthand": false, "value": { "type": "Identifier", - "start": 44, - "end": 45, - "loc": { - "start": { - "line": 1, - "column": 44 - }, - "end": { - "line": 1, - "column": 45 - }, - "identifierName": "b" - }, + "start":44,"end":45,"loc":{"start":{"line":1,"column":44},"end":{"line":1,"column":45},"identifierName":"b"}, "name": "b" } } @@ -202,18 +66,7 @@ ], "body": { "type": "BlockStatement", - "start": 49, - "end": 51, - "loc": { - "start": { - "line": 1, - "column": 49 - }, - "end": { - "line": 1, - "column": 51 - } - }, + "start":49,"end":51,"loc":{"start":{"line":1,"column":49},"end":{"line":1,"column":51}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/test262/rest-parameter/object-pattern-single-element/output.json b/packages/babel-parser/test/fixtures/test262/rest-parameter/object-pattern-single-element/output.json index bc637103ee6c..f211a830b4bb 100644 --- a/packages/babel-parser/test/fixtures/test262/rest-parameter/object-pattern-single-element/output.json +++ b/packages/babel-parser/test/fixtures/test262/rest-parameter/object-pattern-single-element/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, "program": { "type": "Program", - "start": 0, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, "id": { "type": "Identifier", - "start": 9, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 22 - }, - "identifierName": "singleElement" - }, + "start":9,"end":22,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":22},"identifierName":"singleElement"}, "name": "singleElement" }, "generator": false, @@ -65,82 +20,25 @@ "params": [ { "type": "RestElement", - "start": 23, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":23,"end":32,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":32}}, "argument": { "type": "ObjectPattern", - "start": 26, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":26,"end":32,"loc":{"start":{"line":1,"column":26},"end":{"line":1,"column":32}}, "properties": [ { "type": "ObjectProperty", - "start": 27, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":27,"end":31,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":31}}, "method": false, "key": { "type": "Identifier", - "start": 27, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 28 - }, - "identifierName": "a" - }, + "start":27,"end":28,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":28},"identifierName":"a"}, "name": "a" }, "computed": false, "shorthand": false, "value": { "type": "Identifier", - "start": 30, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 1, - "column": 31 - }, - "identifierName": "b" - }, + "start":30,"end":31,"loc":{"start":{"line":1,"column":30},"end":{"line":1,"column":31},"identifierName":"b"}, "name": "b" } } @@ -150,18 +48,7 @@ ], "body": { "type": "BlockStatement", - "start": 34, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 34 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":34,"end":36,"loc":{"start":{"line":1,"column":34},"end":{"line":1,"column":36}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/typescript/arrow-function/annotated/output.json b/packages/babel-parser/test/fixtures/typescript/arrow-function/annotated/output.json index 10d41548ffa1..21c9d62bc364 100644 --- a/packages/babel-parser/test/fixtures/typescript/arrow-function/annotated/output.json +++ b/packages/babel-parser/test/fixtures/typescript/arrow-function/annotated/output.json @@ -1,90 +1,24 @@ { "type": "File", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, "program": { "type": "Program", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, "expression": { "type": "ArrowFunctionExpression", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "returnType": { "type": "TSTypeAnnotation", - "start": 11, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":11,"end":19,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":19}}, "typeAnnotation": { "type": "TSNumberKeyword", - "start": 13, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 19 - } - } + "start":13,"end":19,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":19}} } }, "id": null, @@ -93,67 +27,21 @@ "params": [ { "type": "Identifier", - "start": 1, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 10 - }, - "identifierName": "x" - }, + "start":1,"end":10,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":10},"identifierName":"x"}, "name": "x", "typeAnnotation": { "type": "TSTypeAnnotation", - "start": 2, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":2,"end":10,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":10}}, "typeAnnotation": { "type": "TSNumberKeyword", - "start": 4, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 10 - } - } + "start":4,"end":10,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":10}} } } } ], "body": { "type": "Identifier", - "start": 23, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 24 - }, - "identifierName": "x" - }, + "start":23,"end":24,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":24},"identifierName":"x"}, "name": "x" } } diff --git a/packages/babel-parser/test/fixtures/typescript/arrow-function/arrow-function-with-newline/output.json b/packages/babel-parser/test/fixtures/typescript/arrow-function/arrow-function-with-newline/output.json index 01a056dd1898..a8a69e55bf82 100644 --- a/packages/babel-parser/test/fixtures/typescript/arrow-function/arrow-function-with-newline/output.json +++ b/packages/babel-parser/test/fixtures/typescript/arrow-function/arrow-function-with-newline/output.json @@ -1,105 +1,27 @@ { "type": "File", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 10 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":10}}, "program": { "type": "Program", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 10 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":10}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 10 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":10}}, "expression": { "type": "ArrowFunctionExpression", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 10 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":10}}, "returnType": { "type": "TSTypeAnnotation", - "start": 10, - "end": 13, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 3 - } - }, + "start":10,"end":13,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":3}}, "typeAnnotation": { "type": "TSTypeReference", - "start": 12, - "end": 13, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 3 - } - }, + "start":12,"end":13,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":3}}, "typeName": { "type": "Identifier", - "start": 12, - "end": 13, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 3 - }, - "identifierName": "t" - }, + "start":12,"end":13,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":3},"identifierName":"t"}, "name": "t" } } @@ -110,36 +32,13 @@ "params": [ { "type": "Identifier", - "start": 7, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - }, - "identifierName": "f" - }, + "start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8},"identifierName":"f"}, "name": "f" } ], "body": { "type": "BlockStatement", - "start": 17, - "end": 20, - "loc": { - "start": { - "line": 2, - "column": 7 - }, - "end": { - "line": 2, - "column": 10 - } - }, + "start":17,"end":20,"loc":{"start":{"line":2,"column":7},"end":{"line":2,"column":10}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/typescript/arrow-function/async-arrow-function-after-binary-operator/input.ts b/packages/babel-parser/test/fixtures/typescript/arrow-function/async-arrow-function-after-binary-operator/input.ts new file mode 100644 index 000000000000..cace33f2df7d --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/arrow-function/async-arrow-function-after-binary-operator/input.ts @@ -0,0 +1 @@ +4 + async() => 2 diff --git a/packages/babel-parser/test/fixtures/typescript/arrow-function/async-arrow-function-after-binary-operator/options.json b/packages/babel-parser/test/fixtures/typescript/arrow-function/async-arrow-function-after-binary-operator/options.json new file mode 100644 index 000000000000..90cd707a267b --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/arrow-function/async-arrow-function-after-binary-operator/options.json @@ -0,0 +1,5 @@ +{ + "sourceType": "module", + "plugins": ["typescript"], + "throws": "Unexpected token, expected \";\" (1:20)" +} diff --git a/packages/babel-parser/test/fixtures/typescript/arrow-function/async-await-null/output.json b/packages/babel-parser/test/fixtures/typescript/arrow-function/async-await-null/output.json index 8af1eae03c46..980a142db169 100644 --- a/packages/babel-parser/test/fixtures/typescript/arrow-function/async-await-null/output.json +++ b/packages/babel-parser/test/fixtures/typescript/arrow-function/async-await-null/output.json @@ -1,91 +1,25 @@ { "type": "File", - "start": 0, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, "program": { "type": "Program", - "start": 0, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, "expression": { "type": "ArrowFunctionExpression", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, "typeParameters": { "type": "TSTypeParameterDeclaration", - "start": 6, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":6,"end":9,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":9}}, "params": [ { "type": "TSTypeParameter", - "start": 7, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8}}, "name": "T" } ] @@ -96,32 +30,10 @@ "async": true, "body": { "type": "AwaitExpression", - "start": 15, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":15,"end":25,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":25}}, "argument": { "type": "NullLiteral", - "start": 21, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 25 - } - } + "start":21,"end":25,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":25}} } } } diff --git a/packages/babel-parser/test/fixtures/typescript/arrow-function/async-generic-after-await/input.ts b/packages/babel-parser/test/fixtures/typescript/arrow-function/async-generic-after-await/input.ts new file mode 100644 index 000000000000..cf80533f9bca --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/arrow-function/async-generic-after-await/input.ts @@ -0,0 +1,4 @@ +async () => { + await null; + async () => null; +}; diff --git a/packages/babel-parser/test/fixtures/typescript/arrow-function/async-generic-after-await/output.json b/packages/babel-parser/test/fixtures/typescript/arrow-function/async-generic-after-await/output.json new file mode 100644 index 000000000000..f038e122ec39 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/arrow-function/async-generic-after-await/output.json @@ -0,0 +1,71 @@ +{ + "type": "File", + "start":0,"end":53,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":2}}, + "program": { + "type": "Program", + "start":0,"end":53,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":2}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":53,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":2}}, + "expression": { + "type": "ArrowFunctionExpression", + "start":0,"end":52,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "id": null, + "generator": false, + "async": true, + "params": [], + "body": { + "type": "BlockStatement", + "start":12,"end":52,"loc":{"start":{"line":1,"column":12},"end":{"line":4,"column":1}}, + "body": [ + { + "type": "ExpressionStatement", + "start":16,"end":27,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":13}}, + "expression": { + "type": "AwaitExpression", + "start":16,"end":26,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":12}}, + "argument": { + "type": "NullLiteral", + "start":22,"end":26,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":12}} + } + } + }, + { + "type": "ExpressionStatement", + "start":30,"end":50,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":22}}, + "expression": { + "type": "ArrowFunctionExpression", + "start":30,"end":49,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":21}}, + "typeParameters": { + "type": "TSTypeParameterDeclaration", + "start":36,"end":39,"loc":{"start":{"line":3,"column":8},"end":{"line":3,"column":11}}, + "params": [ + { + "type": "TSTypeParameter", + "start":37,"end":38,"loc":{"start":{"line":3,"column":9},"end":{"line":3,"column":10}}, + "name": "T" + } + ] + }, + "params": [], + "id": null, + "generator": false, + "async": true, + "body": { + "type": "NullLiteral", + "start":45,"end":49,"loc":{"start":{"line":3,"column":17},"end":{"line":3,"column":21}} + } + } + } + ], + "directives": [] + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/arrow-function/async-generic-false-positive/output.json b/packages/babel-parser/test/fixtures/typescript/arrow-function/async-generic-false-positive/output.json index b28655fb55ff..90c2313f7b3c 100644 --- a/packages/babel-parser/test/fixtures/typescript/arrow-function/async-generic-false-positive/output.json +++ b/packages/babel-parser/test/fixtures/typescript/arrow-function/async-generic-false-positive/output.json @@ -1,94 +1,27 @@ { "type": "File", - "start": 0, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 16 - } - }, + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":16}}, "program": { "type": "Program", - "start": 0, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 16 - } - }, + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":16}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, "expression": { "type": "BinaryExpression", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "left": { "type": "Identifier", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "async" - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5},"identifierName":"async"}, "name": "async" }, "operator": "<", "right": { "type": "NumericLiteral", - "start": 8, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":8,"end":9,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":9}}, "extra": { "rawValue": 1, "raw": "1" @@ -99,108 +32,29 @@ }, { "type": "ExpressionStatement", - "start": 11, - "end": 27, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 16 - } - }, + "start":11,"end":27,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":16}}, "expression": { "type": "BinaryExpression", - "start": 11, - "end": 26, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 15 - } - }, + "start":11,"end":26,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":15}}, "left": { "type": "CallExpression", - "start": 11, - "end": 21, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 10 - } - }, + "start":11,"end":21,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":10}}, "callee": { "type": "Identifier", - "start": 11, - "end": 16, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 5 - }, - "identifierName": "async" - }, + "start":11,"end":16,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":5},"identifierName":"async"}, "name": "async" }, "arguments": [], "typeParameters": { "type": "TSTypeParameterInstantiation", - "start": 16, - "end": 19, - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 8 - } - }, + "start":16,"end":19,"loc":{"start":{"line":2,"column":5},"end":{"line":2,"column":8}}, "params": [ { "type": "TSTypeReference", - "start": 17, - "end": 18, - "loc": { - "start": { - "line": 2, - "column": 6 - }, - "end": { - "line": 2, - "column": 7 - } - }, + "start":17,"end":18,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":7}}, "typeName": { "type": "Identifier", - "start": 17, - "end": 18, - "loc": { - "start": { - "line": 2, - "column": 6 - }, - "end": { - "line": 2, - "column": 7 - }, - "identifierName": "T" - }, + "start":17,"end":18,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":7},"identifierName":"T"}, "name": "T" } } @@ -210,18 +64,7 @@ "operator": "==", "right": { "type": "NumericLiteral", - "start": 25, - "end": 26, - "loc": { - "start": { - "line": 2, - "column": 14 - }, - "end": { - "line": 2, - "column": 15 - } - }, + "start":25,"end":26,"loc":{"start":{"line":2,"column":14},"end":{"line":2,"column":15}}, "extra": { "rawValue": 0, "raw": "0" diff --git a/packages/babel-parser/test/fixtures/typescript/arrow-function/async-generic/input.ts b/packages/babel-parser/test/fixtures/typescript/arrow-function/async-generic-tokens-true/input.ts similarity index 100% rename from packages/babel-parser/test/fixtures/typescript/arrow-function/async-generic/input.ts rename to packages/babel-parser/test/fixtures/typescript/arrow-function/async-generic-tokens-true/input.ts diff --git a/packages/babel-parser/test/fixtures/typescript/arrow-function/async-generic-tokens-true/options.json b/packages/babel-parser/test/fixtures/typescript/arrow-function/async-generic-tokens-true/options.json new file mode 100644 index 000000000000..359dbf5e9514 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/arrow-function/async-generic-tokens-true/options.json @@ -0,0 +1,5 @@ +{ + "sourceType": "module", + "plugins": ["typescript"], + "tokens": true +} diff --git a/packages/babel-parser/test/fixtures/typescript/arrow-function/async-generic-tokens-true/output.json b/packages/babel-parser/test/fixtures/typescript/arrow-function/async-generic-tokens-true/output.json new file mode 100644 index 000000000000..13a2d4749870 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/arrow-function/async-generic-tokens-true/output.json @@ -0,0 +1,300 @@ +{ + "type": "File", + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, + "program": { + "type": "Program", + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, + "expression": { + "type": "ArrowFunctionExpression", + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, + "typeParameters": { + "type": "TSTypeParameterDeclaration", + "start":6,"end":9,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":9}}, + "params": [ + { + "type": "TSTypeParameter", + "start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8}}, + "name": "T" + } + ] + }, + "params": [ + { + "type": "Identifier", + "start":10,"end":14,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":14},"identifierName":"a"}, + "name": "a", + "typeAnnotation": { + "type": "TSTypeAnnotation", + "start":11,"end":14,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":14}}, + "typeAnnotation": { + "type": "TSTypeReference", + "start":13,"end":14,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":14}}, + "typeName": { + "type": "Identifier", + "start":13,"end":14,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":14},"identifierName":"T"}, + "name": "T" + } + } + } + } + ], + "returnType": { + "type": "TSTypeAnnotation", + "start":15,"end":18,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":18}}, + "typeAnnotation": { + "type": "TSTypeReference", + "start":17,"end":18,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":18}}, + "typeName": { + "type": "Identifier", + "start":17,"end":18,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":18},"identifierName":"T"}, + "name": "T" + } + } + }, + "id": null, + "generator": false, + "async": true, + "body": { + "type": "Identifier", + "start":22,"end":23,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":23},"identifierName":"a"}, + "name": "a" + } + } + } + ], + "directives": [] + }, + "tokens": [ + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "async", + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}} + }, + { + "type": { + "label": "/<=/>=", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": 7, + "updateContext": null + }, + "value": "<", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7}} + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "T", + "start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8}} + }, + { + "type": { + "label": "/<=/>=", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": 7, + "updateContext": null + }, + "value": ">", + "start":8,"end":9,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":9}} + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10}} + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "a", + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11}} + }, + { + "type": { + "label": ":", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start":11,"end":12,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":12}} + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "T", + "start":13,"end":14,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":14}} + }, + { + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start":14,"end":15,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":15}} + }, + { + "type": { + "label": ":", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start":15,"end":16,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":16}} + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "T", + "start":17,"end":18,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":18}} + }, + { + "type": { + "label": "=>", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start":19,"end":21,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":21}} + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "a", + "start":22,"end":23,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":23}} + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start":23,"end":24,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":24}} + }, + { + "type": { + "label": "eof", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start":24,"end":24,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":24}} + } + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/arrow-function/async-generic/output.json b/packages/babel-parser/test/fixtures/typescript/arrow-function/async-generic/output.json deleted file mode 100644 index 89af25ded2c0..000000000000 --- a/packages/babel-parser/test/fixtures/typescript/arrow-function/async-generic/output.json +++ /dev/null @@ -1,231 +0,0 @@ -{ - "type": "File", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, - "program": { - "type": "Program", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, - "sourceType": "module", - "interpreter": null, - "body": [ - { - "type": "ExpressionStatement", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, - "expression": { - "type": "ArrowFunctionExpression", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, - "typeParameters": { - "type": "TSTypeParameterDeclaration", - "start": 6, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "params": [ - { - "type": "TSTypeParameter", - "start": 7, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "name": "T" - } - ] - }, - "params": [ - { - "type": "Identifier", - "start": 10, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 14 - }, - "identifierName": "a" - }, - "name": "a", - "typeAnnotation": { - "type": "TSTypeAnnotation", - "start": 11, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "typeAnnotation": { - "type": "TSTypeReference", - "start": 13, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "typeName": { - "type": "Identifier", - "start": 13, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - }, - "identifierName": "T" - }, - "name": "T" - } - } - } - } - ], - "returnType": { - "type": "TSTypeAnnotation", - "start": 15, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "typeAnnotation": { - "type": "TSTypeReference", - "start": 17, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "typeName": { - "type": "Identifier", - "start": 17, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - }, - "identifierName": "T" - }, - "name": "T" - } - } - }, - "id": null, - "generator": false, - "async": true, - "body": { - "type": "Identifier", - "start": 22, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 23 - }, - "identifierName": "a" - }, - "name": "a" - } - } - } - ], - "directives": [] - } -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/arrow-function/async-rest-optional-parameter/output.json b/packages/babel-parser/test/fixtures/typescript/arrow-function/async-rest-optional-parameter/output.json index 816c9ca28084..248e37e2e430 100644 --- a/packages/babel-parser/test/fixtures/typescript/arrow-function/async-rest-optional-parameter/output.json +++ b/packages/babel-parser/test/fixtures/typescript/arrow-function/async-rest-optional-parameter/output.json @@ -1,90 +1,24 @@ { "type": "File", - "start": 0, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, "program": { "type": "Program", - "start": 0, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, "expression": { "type": "ArrowFunctionExpression", - "start": 0, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, "returnType": { "type": "TSTypeAnnotation", - "start": 23, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":23,"end":28,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":28}}, "typeAnnotation": { "type": "TSAnyKeyword", - "start": 25, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 28 - } - } + "start":25,"end":28,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":28}} } }, "id": null, @@ -93,78 +27,22 @@ "params": [ { "type": "RestElement", - "start": 6, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":6,"end":21,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":21}}, "argument": { "type": "Identifier", - "start": 9, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 13 - }, - "identifierName": "args" - }, + "start":9,"end":13,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":13},"identifierName":"args"}, "name": "args" }, "optional": true, "typeAnnotation": { "type": "TSTypeAnnotation", - "start": 14, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":14,"end":21,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":21}}, "typeAnnotation": { "type": "TSArrayType", - "start": 16, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":16,"end":21,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":21}}, "elementType": { "type": "TSAnyKeyword", - "start": 16, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 19 - } - } + "start":16,"end":19,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":19}} } } } @@ -172,18 +50,7 @@ ], "body": { "type": "BlockStatement", - "start": 32, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 32 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":32,"end":34,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":34}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/typescript/arrow-function/async-rest/output.json b/packages/babel-parser/test/fixtures/typescript/arrow-function/async-rest/output.json index eca1eab06f3a..9d9669f8ab97 100644 --- a/packages/babel-parser/test/fixtures/typescript/arrow-function/async-rest/output.json +++ b/packages/babel-parser/test/fixtures/typescript/arrow-function/async-rest/output.json @@ -1,90 +1,24 @@ { "type": "File", - "start": 0, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, "program": { "type": "Program", - "start": 0, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, "expression": { "type": "ArrowFunctionExpression", - "start": 0, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, "returnType": { "type": "TSTypeAnnotation", - "start": 23, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":23,"end":28,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":28}}, "typeAnnotation": { "type": "TSAnyKeyword", - "start": 25, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 28 - } - } + "start":25,"end":28,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":28}} } }, "id": null, @@ -93,77 +27,21 @@ "params": [ { "type": "RestElement", - "start": 7, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":7,"end":21,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":21}}, "argument": { "type": "Identifier", - "start": 10, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 14 - }, - "identifierName": "args" - }, + "start":10,"end":14,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":14},"identifierName":"args"}, "name": "args" }, "typeAnnotation": { "type": "TSTypeAnnotation", - "start": 14, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":14,"end":21,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":21}}, "typeAnnotation": { "type": "TSArrayType", - "start": 16, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":16,"end":21,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":21}}, "elementType": { "type": "TSAnyKeyword", - "start": 16, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 19 - } - } + "start":16,"end":19,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":19}} } } } @@ -171,18 +49,7 @@ ], "body": { "type": "BlockStatement", - "start": 32, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 32 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":32,"end":34,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":34}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/typescript/arrow-function/async/output.json b/packages/babel-parser/test/fixtures/typescript/arrow-function/async/output.json index f4c66f0f4bf1..24454f584a7c 100644 --- a/packages/babel-parser/test/fixtures/typescript/arrow-function/async/output.json +++ b/packages/babel-parser/test/fixtures/typescript/arrow-function/async/output.json @@ -1,90 +1,24 @@ { "type": "File", - "start": 0, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, "program": { "type": "Program", - "start": 0, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, "expression": { "type": "ArrowFunctionExpression", - "start": 0, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, "returnType": { "type": "TSTypeAnnotation", - "start": 18, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":18,"end":23,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":23}}, "typeAnnotation": { "type": "TSAnyKeyword", - "start": 20, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 23 - } - } + "start":20,"end":23,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":23}} } }, "id": null, @@ -93,68 +27,22 @@ "params": [ { "type": "Identifier", - "start": 7, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 17 - }, - "identifierName": "x" - }, + "start":7,"end":17,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":17},"identifierName":"x"}, "name": "x", "optional": true, "typeAnnotation": { "type": "TSTypeAnnotation", - "start": 9, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":9,"end":17,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":17}}, "typeAnnotation": { "type": "TSNumberKeyword", - "start": 11, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 17 - } - } + "start":11,"end":17,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":17}} } } } ], "body": { "type": "Identifier", - "start": 27, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 28 - }, - "identifierName": "x" - }, + "start":27,"end":28,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":28},"identifierName":"x"}, "name": "x" } } diff --git a/packages/babel-parser/test/fixtures/typescript/arrow-function/default-parameter-values/output.json b/packages/babel-parser/test/fixtures/typescript/arrow-function/default-parameter-values/output.json index e8a5f05eb61c..1fc04d4b7d95 100644 --- a/packages/babel-parser/test/fixtures/typescript/arrow-function/default-parameter-values/output.json +++ b/packages/babel-parser/test/fixtures/typescript/arrow-function/default-parameter-values/output.json @@ -1,141 +1,41 @@ { "type": "File", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, "program": { "type": "Program", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, "expression": { "type": "ArrowFunctionExpression", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, "id": null, "generator": false, "async": false, "params": [ { "type": "AssignmentPattern", - "start": 1, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":1,"end":14,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":14}}, "left": { "type": "Identifier", - "start": 1, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 10 - }, - "identifierName": "x" - }, + "start":1,"end":10,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":10},"identifierName":"x"}, "name": "x", "typeAnnotation": { "type": "TSTypeAnnotation", - "start": 2, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":2,"end":10,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":10}}, "typeAnnotation": { "type": "TSNumberKeyword", - "start": 4, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 10 - } - } + "start":4,"end":10,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":10}} } } }, "right": { "type": "NumericLiteral", - "start": 13, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":13,"end":14,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":14}}, "extra": { "rawValue": 0, "raw": "0" @@ -146,18 +46,7 @@ ], "body": { "type": "NumericLiteral", - "start": 19, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":19,"end":20,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":20}}, "extra": { "rawValue": 0, "raw": "0" diff --git a/packages/babel-parser/test/fixtures/typescript/arrow-function/destructuring/output.json b/packages/babel-parser/test/fixtures/typescript/arrow-function/destructuring/output.json index 9d4940d16247..6cfc4d9f208e 100644 --- a/packages/babel-parser/test/fixtures/typescript/arrow-function/destructuring/output.json +++ b/packages/babel-parser/test/fixtures/typescript/arrow-function/destructuring/output.json @@ -1,160 +1,48 @@ { "type": "File", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "program": { "type": "Program", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "expression": { "type": "ArrowFunctionExpression", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "id": null, "generator": false, "async": false, "params": [ { "type": "ObjectPattern", - "start": 1, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":1,"end":10,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":10}}, "properties": [ { "type": "ObjectProperty", - "start": 3, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":3,"end":8,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":8}}, "method": false, "key": { "type": "Identifier", - "start": 3, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 4 - }, - "identifierName": "a" - }, + "start":3,"end":4,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":4},"identifierName":"a"}, "name": "a" }, "computed": false, "shorthand": true, "value": { "type": "AssignmentPattern", - "start": 3, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":3,"end":8,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":8}}, "left": { "type": "Identifier", - "start": 3, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 4 - }, - "identifierName": "a" - }, + "start":3,"end":4,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":4},"identifierName":"a"}, "name": "a" }, "right": { "type": "NumericLiteral", - "start": 7, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8}}, "extra": { "rawValue": 0, "raw": "0" @@ -171,18 +59,7 @@ ], "body": { "type": "NumericLiteral", - "start": 15, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":15,"end":16,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":16}}, "extra": { "rawValue": 0, "raw": "0" diff --git a/packages/babel-parser/test/fixtures/typescript/arrow-function/generic-tsx/output.json b/packages/babel-parser/test/fixtures/typescript/arrow-function/generic-tsx/output.json index 58c3d9672124..2d19c9f092ce 100644 --- a/packages/babel-parser/test/fixtures/typescript/arrow-function/generic-tsx/output.json +++ b/packages/babel-parser/test/fixtures/typescript/arrow-function/generic-tsx/output.json @@ -1,105 +1,27 @@ { "type": "File", - "start": 0, - "end": 79, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 18 - } - }, + "start":0,"end":79,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":18}}, "program": { "type": "Program", - "start": 0, - "end": 79, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 18 - } - }, + "start":0,"end":79,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":18}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 61, - "end": 79, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 18 - } - }, + "start":61,"end":79,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":18}}, "expression": { "type": "ArrowFunctionExpression", - "start": 61, - "end": 78, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 17 - } - }, + "start":61,"end":78,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":17}}, "returnType": { "type": "TSTypeAnnotation", - "start": 70, - "end": 73, - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 12 - } - }, + "start":70,"end":73,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":12}}, "typeAnnotation": { "type": "TSTypeReference", - "start": 72, - "end": 73, - "loc": { - "start": { - "line": 2, - "column": 11 - }, - "end": { - "line": 2, - "column": 12 - } - }, + "start":72,"end":73,"loc":{"start":{"line":2,"column":11},"end":{"line":2,"column":12}}, "typeName": { "type": "Identifier", - "start": 72, - "end": 73, - "loc": { - "start": { - "line": 2, - "column": 11 - }, - "end": { - "line": 2, - "column": 12 - }, - "identifierName": "T" - }, + "start":72,"end":73,"loc":{"start":{"line":2,"column":11},"end":{"line":2,"column":12},"identifierName":"T"}, "name": "T" } } @@ -110,63 +32,17 @@ "params": [ { "type": "Identifier", - "start": 65, - "end": 69, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 8 - }, - "identifierName": "a" - }, + "start":65,"end":69,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":8},"identifierName":"a"}, "name": "a", "typeAnnotation": { "type": "TSTypeAnnotation", - "start": 66, - "end": 69, - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 8 - } - }, + "start":66,"end":69,"loc":{"start":{"line":2,"column":5},"end":{"line":2,"column":8}}, "typeAnnotation": { "type": "TSTypeReference", - "start": 68, - "end": 69, - "loc": { - "start": { - "line": 2, - "column": 7 - }, - "end": { - "line": 2, - "column": 8 - } - }, + "start":68,"end":69,"loc":{"start":{"line":2,"column":7},"end":{"line":2,"column":8}}, "typeName": { "type": "Identifier", - "start": 68, - "end": 69, - "loc": { - "start": { - "line": 2, - "column": 7 - }, - "end": { - "line": 2, - "column": 8 - }, - "identifierName": "T" - }, + "start":68,"end":69,"loc":{"start":{"line":2,"column":7},"end":{"line":2,"column":8},"identifierName":"T"}, "name": "T" } } @@ -175,50 +51,16 @@ ], "body": { "type": "Identifier", - "start": 77, - "end": 78, - "loc": { - "start": { - "line": 2, - "column": 16 - }, - "end": { - "line": 2, - "column": 17 - }, - "identifierName": "a" - }, + "start":77,"end":78,"loc":{"start":{"line":2,"column":16},"end":{"line":2,"column":17},"identifierName":"a"}, "name": "a" }, "typeParameters": { "type": "TSTypeParameterDeclaration", - "start": 61, - "end": 64, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 3 - } - }, + "start":61,"end":64,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":3}}, "params": [ { "type": "TSTypeParameter", - "start": 62, - "end": 63, - "loc": { - "start": { - "line": 2, - "column": 1 - }, - "end": { - "line": 2, - "column": 2 - } - }, + "start":62,"end":63,"loc":{"start":{"line":2,"column":1},"end":{"line":2,"column":2}}, "name": "T" } ] @@ -228,18 +70,7 @@ { "type": "CommentLine", "value": " Same as `generic`. Verify that JSX doesn't change things.", - "start": 0, - "end": 60, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 60 - } - } + "start":0,"end":60,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":60}} } ] } @@ -250,18 +81,7 @@ { "type": "CommentLine", "value": " Same as `generic`. Verify that JSX doesn't change things.", - "start": 0, - "end": 60, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 60 - } - } + "start":0,"end":60,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":60}} } ] -} +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/arrow-function/generic/output.json b/packages/babel-parser/test/fixtures/typescript/arrow-function/generic/output.json index 1f99918b7ad3..53c4a1b036b0 100644 --- a/packages/babel-parser/test/fixtures/typescript/arrow-function/generic/output.json +++ b/packages/babel-parser/test/fixtures/typescript/arrow-function/generic/output.json @@ -1,105 +1,27 @@ { "type": "File", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, "program": { "type": "Program", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, "expression": { "type": "ArrowFunctionExpression", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "returnType": { "type": "TSTypeAnnotation", - "start": 9, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":9,"end":12,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":12}}, "typeAnnotation": { "type": "TSTypeReference", - "start": 11, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":11,"end":12,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":12}}, "typeName": { "type": "Identifier", - "start": 11, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "T" - }, + "start":11,"end":12,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":12},"identifierName":"T"}, "name": "T" } } @@ -110,63 +32,17 @@ "params": [ { "type": "Identifier", - "start": 4, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 8 - }, - "identifierName": "a" - }, + "start":4,"end":8,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":8},"identifierName":"a"}, "name": "a", "typeAnnotation": { "type": "TSTypeAnnotation", - "start": 5, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":5,"end":8,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":8}}, "typeAnnotation": { "type": "TSTypeReference", - "start": 7, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8}}, "typeName": { "type": "Identifier", - "start": 7, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - }, - "identifierName": "T" - }, + "start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8},"identifierName":"T"}, "name": "T" } } @@ -175,50 +51,16 @@ ], "body": { "type": "Identifier", - "start": 16, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - }, - "identifierName": "a" - }, + "start":16,"end":17,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":17},"identifierName":"a"}, "name": "a" }, "typeParameters": { "type": "TSTypeParameterDeclaration", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, "params": [ { "type": "TSTypeParameter", - "start": 1, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - } - }, + "start":1,"end":2,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":2}}, "name": "T" } ] @@ -228,4 +70,4 @@ ], "directives": [] } -} +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/arrow-function/optional-parameter/output.json b/packages/babel-parser/test/fixtures/typescript/arrow-function/optional-parameter/output.json index 3a08e42c865c..61083fd0e738 100644 --- a/packages/babel-parser/test/fixtures/typescript/arrow-function/optional-parameter/output.json +++ b/packages/babel-parser/test/fixtures/typescript/arrow-function/optional-parameter/output.json @@ -1,90 +1,24 @@ { "type": "File", - "start": 0, - "end": 42, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 18 - } - }, + "start":0,"end":42,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":18}}, "program": { "type": "Program", - "start": 0, - "end": 42, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 18 - } - }, + "start":0,"end":42,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":18}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "expression": { "type": "ArrowFunctionExpression", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "returnType": { "type": "TSTypeAnnotation", - "start": 12, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":12,"end":17,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":17}}, "typeAnnotation": { "type": "TSAnyKeyword", - "start": 14, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 17 - } - } + "start":14,"end":17,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":17}} } }, "id": null, @@ -93,183 +27,58 @@ "params": [ { "type": "Identifier", - "start": 1, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "x" - }, + "start":1,"end":11,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":11},"identifierName":"x"}, "name": "x", "optional": true, "typeAnnotation": { "type": "TSTypeAnnotation", - "start": 3, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":3,"end":11,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":11}}, "typeAnnotation": { "type": "TSNumberKeyword", - "start": 5, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 11 - } - } + "start":5,"end":11,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":11}} } } } ], "body": { "type": "Identifier", - "start": 21, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 22 - }, - "identifierName": "x" - }, + "start":21,"end":22,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":22},"identifierName":"x"}, "name": "x" } } }, { "type": "ExpressionStatement", - "start": 24, - "end": 42, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 18 - } - }, + "start":24,"end":42,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":18}}, "expression": { "type": "CallExpression", - "start": 24, - "end": 41, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 17 - } - }, + "start":24,"end":41,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":17}}, "callee": { "type": "ArrowFunctionExpression", - "start": 25, - "end": 38, - "loc": { - "start": { - "line": 2, - "column": 1 - }, - "end": { - "line": 2, - "column": 14 - } - }, + "start":25,"end":38,"loc":{"start":{"line":2,"column":1},"end":{"line":2,"column":14}}, "id": null, "generator": false, "async": false, "params": [ { "type": "Identifier", - "start": 26, - "end": 28, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 4 - }, - "identifierName": "k" - }, + "start":26,"end":28,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":4},"identifierName":"k"}, "name": "k", "optional": true } ], "body": { "type": "BinaryExpression", - "start": 33, - "end": 38, - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 14 - } - }, + "start":33,"end":38,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":14}}, "left": { "type": "Identifier", - "start": 33, - "end": 34, - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 10 - }, - "identifierName": "k" - }, + "start":33,"end":34,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":10},"identifierName":"k"}, "name": "k" }, "operator": "+", "right": { "type": "NumericLiteral", - "start": 37, - "end": 38, - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 14 - } - }, + "start":37,"end":38,"loc":{"start":{"line":2,"column":13},"end":{"line":2,"column":14}}, "extra": { "rawValue": 1, "raw": "1" diff --git a/packages/babel-parser/test/fixtures/typescript/arrow-function/predicate-types/output.json b/packages/babel-parser/test/fixtures/typescript/arrow-function/predicate-types/output.json index e1f9142855b1..4cc69d94f780 100644 --- a/packages/babel-parser/test/fixtures/typescript/arrow-function/predicate-types/output.json +++ b/packages/babel-parser/test/fixtures/typescript/arrow-function/predicate-types/output.json @@ -1,135 +1,35 @@ { "type": "File", - "start": 0, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, "program": { "type": "Program", - "start": 0, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, "expression": { "type": "ArrowFunctionExpression", - "start": 0, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, "returnType": { "type": "TSTypeAnnotation", - "start": 8, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":8,"end":21,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":21}}, "typeAnnotation": { "type": "TSTypePredicate", - "start": 10, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":8,"end":21,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":21}}, "parameterName": { "type": "Identifier", - "start": 10, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "x" - }, + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11},"identifierName":"x"}, "name": "x" }, "typeAnnotation": { "type": "TSTypeAnnotation", - "start": 15, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":15,"end":21,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":21}}, "typeAnnotation": { "type": "TSStringKeyword", - "start": 15, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 21 - } - } + "start":15,"end":21,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":21}} } } } @@ -140,66 +40,21 @@ "params": [ { "type": "Identifier", - "start": 1, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "x" - }, + "start":1,"end":7,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":7},"identifierName":"x"}, "name": "x", "typeAnnotation": { "type": "TSTypeAnnotation", - "start": 2, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":2,"end":7,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":7}}, "typeAnnotation": { "type": "TSAnyKeyword", - "start": 4, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 7 - } - } + "start":4,"end":7,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":7}} } } } ], "body": { "type": "BooleanLiteral", - "start": 25, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":25,"end":29,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":29}}, "value": true } } diff --git a/packages/babel-parser/test/fixtures/typescript/assert-predicate/arrow-function/input.ts b/packages/babel-parser/test/fixtures/typescript/assert-predicate/arrow-function/input.ts new file mode 100644 index 000000000000..5989d8d4f2b4 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/assert-predicate/arrow-function/input.ts @@ -0,0 +1,3 @@ +const assert1 = (value: unknown): asserts value is string => {} +const assert2 = (value: unknown): asserts value => {} +const assert3 = (value: unknown): asserts => {} diff --git a/packages/babel-parser/test/fixtures/typescript/assert-predicate/arrow-function/output.json b/packages/babel-parser/test/fixtures/typescript/assert-predicate/arrow-function/output.json new file mode 100644 index 000000000000..5c2fb6c0f625 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/assert-predicate/arrow-function/output.json @@ -0,0 +1,194 @@ +{ + "type": "File", + "start":0,"end":165,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":47}}, + "program": { + "type": "Program", + "start":0,"end":165,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":47}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start":0,"end":63,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":63}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":6,"end":63,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":63}}, + "id": { + "type": "Identifier", + "start":6,"end":13,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":13},"identifierName":"assert1"}, + "name": "assert1" + }, + "init": { + "type": "ArrowFunctionExpression", + "start":16,"end":63,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":63}}, + "returnType": { + "type": "TSTypeAnnotation", + "start":32,"end":57,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":57}}, + "typeAnnotation": { + "type": "TSTypePredicate", + "start":32,"end":57,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":57}}, + "parameterName": { + "type": "Identifier", + "start":42,"end":47,"loc":{"start":{"line":1,"column":42},"end":{"line":1,"column":47},"identifierName":"value"}, + "name": "value" + }, + "typeAnnotation": { + "type": "TSTypeAnnotation", + "start":51,"end":57,"loc":{"start":{"line":1,"column":51},"end":{"line":1,"column":57}}, + "typeAnnotation": { + "type": "TSStringKeyword", + "start":51,"end":57,"loc":{"start":{"line":1,"column":51},"end":{"line":1,"column":57}} + } + }, + "asserts": true + } + }, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start":17,"end":31,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":31},"identifierName":"value"}, + "name": "value", + "typeAnnotation": { + "type": "TSTypeAnnotation", + "start":22,"end":31,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":31}}, + "typeAnnotation": { + "type": "TSUnknownKeyword", + "start":24,"end":31,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":31}} + } + } + } + ], + "body": { + "type": "BlockStatement", + "start":61,"end":63,"loc":{"start":{"line":1,"column":61},"end":{"line":1,"column":63}}, + "body": [], + "directives": [] + } + } + } + ], + "kind": "const" + }, + { + "type": "VariableDeclaration", + "start":64,"end":117,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":53}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":70,"end":117,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":53}}, + "id": { + "type": "Identifier", + "start":70,"end":77,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":13},"identifierName":"assert2"}, + "name": "assert2" + }, + "init": { + "type": "ArrowFunctionExpression", + "start":80,"end":117,"loc":{"start":{"line":2,"column":16},"end":{"line":2,"column":53}}, + "returnType": { + "type": "TSTypeAnnotation", + "start":96,"end":111,"loc":{"start":{"line":2,"column":32},"end":{"line":2,"column":47}}, + "typeAnnotation": { + "type": "TSTypePredicate", + "start":96,"end":111,"loc":{"start":{"line":2,"column":32},"end":{"line":2,"column":47}}, + "parameterName": { + "type": "Identifier", + "start":106,"end":111,"loc":{"start":{"line":2,"column":42},"end":{"line":2,"column":47},"identifierName":"value"}, + "name": "value" + }, + "asserts": true + } + }, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start":81,"end":95,"loc":{"start":{"line":2,"column":17},"end":{"line":2,"column":31},"identifierName":"value"}, + "name": "value", + "typeAnnotation": { + "type": "TSTypeAnnotation", + "start":86,"end":95,"loc":{"start":{"line":2,"column":22},"end":{"line":2,"column":31}}, + "typeAnnotation": { + "type": "TSUnknownKeyword", + "start":88,"end":95,"loc":{"start":{"line":2,"column":24},"end":{"line":2,"column":31}} + } + } + } + ], + "body": { + "type": "BlockStatement", + "start":115,"end":117,"loc":{"start":{"line":2,"column":51},"end":{"line":2,"column":53}}, + "body": [], + "directives": [] + } + } + } + ], + "kind": "const" + }, + { + "type": "VariableDeclaration", + "start":118,"end":165,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":47}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":124,"end":165,"loc":{"start":{"line":3,"column":6},"end":{"line":3,"column":47}}, + "id": { + "type": "Identifier", + "start":124,"end":131,"loc":{"start":{"line":3,"column":6},"end":{"line":3,"column":13},"identifierName":"assert3"}, + "name": "assert3" + }, + "init": { + "type": "ArrowFunctionExpression", + "start":134,"end":165,"loc":{"start":{"line":3,"column":16},"end":{"line":3,"column":47}}, + "returnType": { + "type": "TSTypeAnnotation", + "start":150,"end":159,"loc":{"start":{"line":3,"column":32},"end":{"line":3,"column":41}}, + "typeAnnotation": { + "type": "TSTypeReference", + "start":152,"end":159,"loc":{"start":{"line":3,"column":34},"end":{"line":3,"column":41}}, + "typeName": { + "type": "Identifier", + "start":152,"end":159,"loc":{"start":{"line":3,"column":34},"end":{"line":3,"column":41},"identifierName":"asserts"}, + "name": "asserts" + } + } + }, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start":135,"end":149,"loc":{"start":{"line":3,"column":17},"end":{"line":3,"column":31},"identifierName":"value"}, + "name": "value", + "typeAnnotation": { + "type": "TSTypeAnnotation", + "start":140,"end":149,"loc":{"start":{"line":3,"column":22},"end":{"line":3,"column":31}}, + "typeAnnotation": { + "type": "TSUnknownKeyword", + "start":142,"end":149,"loc":{"start":{"line":3,"column":24},"end":{"line":3,"column":31}} + } + } + } + ], + "body": { + "type": "BlockStatement", + "start":163,"end":165,"loc":{"start":{"line":3,"column":45},"end":{"line":3,"column":47}}, + "body": [], + "directives": [] + } + } + } + ], + "kind": "const" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/assert-predicate/asserts-as-identifier/input.ts b/packages/babel-parser/test/fixtures/typescript/assert-predicate/asserts-as-identifier/input.ts new file mode 100644 index 000000000000..d5ee9a42ce01 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/assert-predicate/asserts-as-identifier/input.ts @@ -0,0 +1 @@ +declare function assertIsString(value: unknown): asserts; diff --git a/packages/babel-parser/test/fixtures/typescript/assert-predicate/asserts-as-identifier/output.json b/packages/babel-parser/test/fixtures/typescript/assert-predicate/asserts-as-identifier/output.json new file mode 100644 index 000000000000..6fe5b0873597 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/assert-predicate/asserts-as-identifier/output.json @@ -0,0 +1,53 @@ +{ + "type": "File", + "start":0,"end":57,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":57}}, + "program": { + "type": "Program", + "start":0,"end":57,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":57}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "TSDeclareFunction", + "start":0,"end":57,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":57}}, + "id": { + "type": "Identifier", + "start":17,"end":31,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":31},"identifierName":"assertIsString"}, + "name": "assertIsString" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start":32,"end":46,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":46},"identifierName":"value"}, + "name": "value", + "typeAnnotation": { + "type": "TSTypeAnnotation", + "start":37,"end":46,"loc":{"start":{"line":1,"column":37},"end":{"line":1,"column":46}}, + "typeAnnotation": { + "type": "TSUnknownKeyword", + "start":39,"end":46,"loc":{"start":{"line":1,"column":39},"end":{"line":1,"column":46}} + } + } + } + ], + "returnType": { + "type": "TSTypeAnnotation", + "start":47,"end":56,"loc":{"start":{"line":1,"column":47},"end":{"line":1,"column":56}}, + "typeAnnotation": { + "type": "TSTypeReference", + "start":49,"end":56,"loc":{"start":{"line":1,"column":49},"end":{"line":1,"column":56}}, + "typeName": { + "type": "Identifier", + "start":49,"end":56,"loc":{"start":{"line":1,"column":49},"end":{"line":1,"column":56},"identifierName":"asserts"}, + "name": "asserts" + } + } + }, + "declare": true + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/assert-predicate/asserts-this-with-predicate/input.ts b/packages/babel-parser/test/fixtures/typescript/assert-predicate/asserts-this-with-predicate/input.ts new file mode 100644 index 000000000000..cc1a550f07bb --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/assert-predicate/asserts-this-with-predicate/input.ts @@ -0,0 +1,4 @@ +class Foo { + isBar(): asserts this is Foo {} + isBaz = (): asserts this is Foo => {} +} diff --git a/packages/babel-parser/test/fixtures/typescript/assert-predicate/asserts-this-with-predicate/options.json b/packages/babel-parser/test/fixtures/typescript/assert-predicate/asserts-this-with-predicate/options.json new file mode 100644 index 000000000000..fb92dc3bde16 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/assert-predicate/asserts-this-with-predicate/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["typescript", "classProperties"] +} diff --git a/packages/babel-parser/test/fixtures/typescript/assert-predicate/asserts-this-with-predicate/output.json b/packages/babel-parser/test/fixtures/typescript/assert-predicate/asserts-this-with-predicate/output.json new file mode 100644 index 000000000000..a98a1eefa26a --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/assert-predicate/asserts-this-with-predicate/output.json @@ -0,0 +1,128 @@ +{ + "type": "File", + "start":0,"end":87,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "program": { + "type": "Program", + "start":0,"end":87,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start":0,"end":87,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "id": { + "type": "Identifier", + "start":6,"end":9,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":9},"identifierName":"Foo"}, + "name": "Foo" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":10,"end":87,"loc":{"start":{"line":1,"column":10},"end":{"line":4,"column":1}}, + "body": [ + { + "type": "ClassMethod", + "start":14,"end":45,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":33}}, + "static": false, + "key": { + "type": "Identifier", + "start":14,"end":19,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":7},"identifierName":"isBar"}, + "name": "isBar" + }, + "computed": false, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [], + "returnType": { + "type": "TSTypeAnnotation", + "start":21,"end":42,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":30}}, + "typeAnnotation": { + "type": "TSTypePredicate", + "start":31,"end":42,"loc":{"start":{"line":2,"column":19},"end":{"line":2,"column":30}}, + "parameterName": { + "type": "TSThisType", + "start":31,"end":35,"loc":{"start":{"line":2,"column":19},"end":{"line":2,"column":23}} + }, + "typeAnnotation": { + "type": "TSTypeAnnotation", + "start":39,"end":42,"loc":{"start":{"line":2,"column":27},"end":{"line":2,"column":30}}, + "typeAnnotation": { + "type": "TSTypeReference", + "start":39,"end":42,"loc":{"start":{"line":2,"column":27},"end":{"line":2,"column":30}}, + "typeName": { + "type": "Identifier", + "start":39,"end":42,"loc":{"start":{"line":2,"column":27},"end":{"line":2,"column":30},"identifierName":"Foo"}, + "name": "Foo" + } + } + }, + "asserts": true + } + }, + "body": { + "type": "BlockStatement", + "start":43,"end":45,"loc":{"start":{"line":2,"column":31},"end":{"line":2,"column":33}}, + "body": [], + "directives": [] + } + }, + { + "type": "ClassProperty", + "start":48,"end":85,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":39}}, + "static": false, + "key": { + "type": "Identifier", + "start":48,"end":53,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":7},"identifierName":"isBaz"}, + "name": "isBaz" + }, + "computed": false, + "value": { + "type": "ArrowFunctionExpression", + "start":56,"end":85,"loc":{"start":{"line":3,"column":10},"end":{"line":3,"column":39}}, + "returnType": { + "type": "TSTypeAnnotation", + "start":58,"end":79,"loc":{"start":{"line":3,"column":12},"end":{"line":3,"column":33}}, + "typeAnnotation": { + "type": "TSTypePredicate", + "start":68,"end":79,"loc":{"start":{"line":3,"column":22},"end":{"line":3,"column":33}}, + "parameterName": { + "type": "TSThisType", + "start":68,"end":72,"loc":{"start":{"line":3,"column":22},"end":{"line":3,"column":26}} + }, + "typeAnnotation": { + "type": "TSTypeAnnotation", + "start":76,"end":79,"loc":{"start":{"line":3,"column":30},"end":{"line":3,"column":33}}, + "typeAnnotation": { + "type": "TSTypeReference", + "start":76,"end":79,"loc":{"start":{"line":3,"column":30},"end":{"line":3,"column":33}}, + "typeName": { + "type": "Identifier", + "start":76,"end":79,"loc":{"start":{"line":3,"column":30},"end":{"line":3,"column":33},"identifierName":"Foo"}, + "name": "Foo" + } + } + }, + "asserts": true + } + }, + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":83,"end":85,"loc":{"start":{"line":3,"column":37},"end":{"line":3,"column":39}}, + "body": [], + "directives": [] + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/assert-predicate/asserts-this/input.ts b/packages/babel-parser/test/fixtures/typescript/assert-predicate/asserts-this/input.ts new file mode 100644 index 000000000000..839483541d5b --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/assert-predicate/asserts-this/input.ts @@ -0,0 +1,3 @@ +class C { + m(): asserts this {}; +} diff --git a/packages/babel-parser/test/fixtures/typescript/assert-predicate/asserts-this/output.json b/packages/babel-parser/test/fixtures/typescript/assert-predicate/asserts-this/output.json new file mode 100644 index 000000000000..46971ca25ce9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/assert-predicate/asserts-this/output.json @@ -0,0 +1,64 @@ +{ + "type": "File", + "start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "program": { + "type": "Program", + "start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "id": { + "type": "Identifier", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"C"}, + "name": "C" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":8,"end":35,"loc":{"start":{"line":1,"column":8},"end":{"line":3,"column":1}}, + "body": [ + { + "type": "ClassMethod", + "start":12,"end":32,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":22}}, + "static": false, + "key": { + "type": "Identifier", + "start":12,"end":13,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":3},"identifierName":"m"}, + "name": "m" + }, + "computed": false, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [], + "returnType": { + "type": "TSTypeAnnotation", + "start":15,"end":29,"loc":{"start":{"line":2,"column":5},"end":{"line":2,"column":19}}, + "typeAnnotation": { + "type": "TSTypePredicate", + "start":15,"end":29,"loc":{"start":{"line":2,"column":5},"end":{"line":2,"column":19}}, + "parameterName": { + "type": "TSThisType", + "start":25,"end":29,"loc":{"start":{"line":2,"column":15},"end":{"line":2,"column":19}} + }, + "asserts": true + } + }, + "body": { + "type": "BlockStatement", + "start":30,"end":32,"loc":{"start":{"line":2,"column":20},"end":{"line":2,"column":22}}, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/assert-predicate/asserts-var-with-predicate/input.ts b/packages/babel-parser/test/fixtures/typescript/assert-predicate/asserts-var-with-predicate/input.ts new file mode 100644 index 000000000000..2b580e64e906 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/assert-predicate/asserts-var-with-predicate/input.ts @@ -0,0 +1,3 @@ +class C { + assertIsString(value: unknown): asserts value is string {} +} diff --git a/packages/babel-parser/test/fixtures/typescript/assert-predicate/asserts-var-with-predicate/output.json b/packages/babel-parser/test/fixtures/typescript/assert-predicate/asserts-var-with-predicate/output.json new file mode 100644 index 000000000000..b356931f8a16 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/assert-predicate/asserts-var-with-predicate/output.json @@ -0,0 +1,87 @@ +{ + "type": "File", + "start":0,"end":72,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "program": { + "type": "Program", + "start":0,"end":72,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start":0,"end":72,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "id": { + "type": "Identifier", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"C"}, + "name": "C" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":8,"end":72,"loc":{"start":{"line":1,"column":8},"end":{"line":3,"column":1}}, + "body": [ + { + "type": "ClassMethod", + "start":12,"end":70,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":60}}, + "static": false, + "key": { + "type": "Identifier", + "start":12,"end":26,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":16},"identifierName":"assertIsString"}, + "name": "assertIsString" + }, + "computed": false, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start":27,"end":41,"loc":{"start":{"line":2,"column":17},"end":{"line":2,"column":31},"identifierName":"value"}, + "name": "value", + "typeAnnotation": { + "type": "TSTypeAnnotation", + "start":32,"end":41,"loc":{"start":{"line":2,"column":22},"end":{"line":2,"column":31}}, + "typeAnnotation": { + "type": "TSUnknownKeyword", + "start":34,"end":41,"loc":{"start":{"line":2,"column":24},"end":{"line":2,"column":31}} + } + } + } + ], + "returnType": { + "type": "TSTypeAnnotation", + "start":42,"end":67,"loc":{"start":{"line":2,"column":32},"end":{"line":2,"column":57}}, + "typeAnnotation": { + "type": "TSTypePredicate", + "start":42,"end":67,"loc":{"start":{"line":2,"column":32},"end":{"line":2,"column":57}}, + "parameterName": { + "type": "Identifier", + "start":52,"end":57,"loc":{"start":{"line":2,"column":42},"end":{"line":2,"column":47},"identifierName":"value"}, + "name": "value" + }, + "typeAnnotation": { + "type": "TSTypeAnnotation", + "start":61,"end":67,"loc":{"start":{"line":2,"column":51},"end":{"line":2,"column":57}}, + "typeAnnotation": { + "type": "TSStringKeyword", + "start":61,"end":67,"loc":{"start":{"line":2,"column":51},"end":{"line":2,"column":57}} + } + }, + "asserts": true + } + }, + "body": { + "type": "BlockStatement", + "start":68,"end":70,"loc":{"start":{"line":2,"column":58},"end":{"line":2,"column":60}}, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/assert-predicate/asserts-var/input.ts b/packages/babel-parser/test/fixtures/typescript/assert-predicate/asserts-var/input.ts new file mode 100644 index 000000000000..63613906e9fd --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/assert-predicate/asserts-var/input.ts @@ -0,0 +1 @@ +declare function assertIsString(value: unknown): asserts value; diff --git a/packages/babel-parser/test/fixtures/typescript/assert-predicate/asserts-var/output.json b/packages/babel-parser/test/fixtures/typescript/assert-predicate/asserts-var/output.json new file mode 100644 index 000000000000..438bfea02bc2 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/assert-predicate/asserts-var/output.json @@ -0,0 +1,54 @@ +{ + "type": "File", + "start":0,"end":63,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":63}}, + "program": { + "type": "Program", + "start":0,"end":63,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":63}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "TSDeclareFunction", + "start":0,"end":63,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":63}}, + "id": { + "type": "Identifier", + "start":17,"end":31,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":31},"identifierName":"assertIsString"}, + "name": "assertIsString" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start":32,"end":46,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":46},"identifierName":"value"}, + "name": "value", + "typeAnnotation": { + "type": "TSTypeAnnotation", + "start":37,"end":46,"loc":{"start":{"line":1,"column":37},"end":{"line":1,"column":46}}, + "typeAnnotation": { + "type": "TSUnknownKeyword", + "start":39,"end":46,"loc":{"start":{"line":1,"column":39},"end":{"line":1,"column":46}} + } + } + } + ], + "returnType": { + "type": "TSTypeAnnotation", + "start":47,"end":62,"loc":{"start":{"line":1,"column":47},"end":{"line":1,"column":62}}, + "typeAnnotation": { + "type": "TSTypePredicate", + "start":47,"end":62,"loc":{"start":{"line":1,"column":47},"end":{"line":1,"column":62}}, + "parameterName": { + "type": "Identifier", + "start":57,"end":62,"loc":{"start":{"line":1,"column":57},"end":{"line":1,"column":62},"identifierName":"value"}, + "name": "value" + }, + "asserts": true + } + }, + "declare": true + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/assert-predicate/declare-asserts-var-with-predicate/input.ts b/packages/babel-parser/test/fixtures/typescript/assert-predicate/declare-asserts-var-with-predicate/input.ts new file mode 100644 index 000000000000..9456a5cb2e50 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/assert-predicate/declare-asserts-var-with-predicate/input.ts @@ -0,0 +1 @@ +declare function assertIsString(value: unknown): asserts value is string; diff --git a/packages/babel-parser/test/fixtures/typescript/assert-predicate/declare-asserts-var-with-predicate/output.json b/packages/babel-parser/test/fixtures/typescript/assert-predicate/declare-asserts-var-with-predicate/output.json new file mode 100644 index 000000000000..6cfc63021f38 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/assert-predicate/declare-asserts-var-with-predicate/output.json @@ -0,0 +1,62 @@ +{ + "type": "File", + "start":0,"end":73,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":73}}, + "program": { + "type": "Program", + "start":0,"end":73,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":73}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "TSDeclareFunction", + "start":0,"end":73,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":73}}, + "id": { + "type": "Identifier", + "start":17,"end":31,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":31},"identifierName":"assertIsString"}, + "name": "assertIsString" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start":32,"end":46,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":46},"identifierName":"value"}, + "name": "value", + "typeAnnotation": { + "type": "TSTypeAnnotation", + "start":37,"end":46,"loc":{"start":{"line":1,"column":37},"end":{"line":1,"column":46}}, + "typeAnnotation": { + "type": "TSUnknownKeyword", + "start":39,"end":46,"loc":{"start":{"line":1,"column":39},"end":{"line":1,"column":46}} + } + } + } + ], + "returnType": { + "type": "TSTypeAnnotation", + "start":47,"end":72,"loc":{"start":{"line":1,"column":47},"end":{"line":1,"column":72}}, + "typeAnnotation": { + "type": "TSTypePredicate", + "start":47,"end":72,"loc":{"start":{"line":1,"column":47},"end":{"line":1,"column":72}}, + "parameterName": { + "type": "Identifier", + "start":57,"end":62,"loc":{"start":{"line":1,"column":57},"end":{"line":1,"column":62},"identifierName":"value"}, + "name": "value" + }, + "typeAnnotation": { + "type": "TSTypeAnnotation", + "start":66,"end":72,"loc":{"start":{"line":1,"column":66},"end":{"line":1,"column":72}}, + "typeAnnotation": { + "type": "TSStringKeyword", + "start":66,"end":72,"loc":{"start":{"line":1,"column":66},"end":{"line":1,"column":72}} + } + }, + "asserts": true + } + }, + "declare": true + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/assert-predicate/function-declaration/input.ts b/packages/babel-parser/test/fixtures/typescript/assert-predicate/function-declaration/input.ts new file mode 100644 index 000000000000..b04da8349ca2 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/assert-predicate/function-declaration/input.ts @@ -0,0 +1,3 @@ +function asserts1 (value: unknown): asserts value is string {} +function asserts2 (value: unknown): asserts value {} +function asserts3 (value: unknown): asserts {} diff --git a/packages/babel-parser/test/fixtures/typescript/assert-predicate/function-declaration/output.json b/packages/babel-parser/test/fixtures/typescript/assert-predicate/function-declaration/output.json new file mode 100644 index 000000000000..9e6d3541554c --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/assert-predicate/function-declaration/output.json @@ -0,0 +1,158 @@ +{ + "type": "File", + "start":0,"end":163,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":46}}, + "program": { + "type": "Program", + "start":0,"end":163,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":46}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":62,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":62}}, + "id": { + "type": "Identifier", + "start":9,"end":17,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":17},"identifierName":"asserts1"}, + "name": "asserts1" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start":19,"end":33,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":33},"identifierName":"value"}, + "name": "value", + "typeAnnotation": { + "type": "TSTypeAnnotation", + "start":24,"end":33,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":33}}, + "typeAnnotation": { + "type": "TSUnknownKeyword", + "start":26,"end":33,"loc":{"start":{"line":1,"column":26},"end":{"line":1,"column":33}} + } + } + } + ], + "returnType": { + "type": "TSTypeAnnotation", + "start":34,"end":59,"loc":{"start":{"line":1,"column":34},"end":{"line":1,"column":59}}, + "typeAnnotation": { + "type": "TSTypePredicate", + "start":34,"end":59,"loc":{"start":{"line":1,"column":34},"end":{"line":1,"column":59}}, + "parameterName": { + "type": "Identifier", + "start":44,"end":49,"loc":{"start":{"line":1,"column":44},"end":{"line":1,"column":49},"identifierName":"value"}, + "name": "value" + }, + "typeAnnotation": { + "type": "TSTypeAnnotation", + "start":53,"end":59,"loc":{"start":{"line":1,"column":53},"end":{"line":1,"column":59}}, + "typeAnnotation": { + "type": "TSStringKeyword", + "start":53,"end":59,"loc":{"start":{"line":1,"column":53},"end":{"line":1,"column":59}} + } + }, + "asserts": true + } + }, + "body": { + "type": "BlockStatement", + "start":60,"end":62,"loc":{"start":{"line":1,"column":60},"end":{"line":1,"column":62}}, + "body": [], + "directives": [] + } + }, + { + "type": "FunctionDeclaration", + "start":64,"end":116,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":52}}, + "id": { + "type": "Identifier", + "start":73,"end":81,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":17},"identifierName":"asserts2"}, + "name": "asserts2" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start":83,"end":97,"loc":{"start":{"line":2,"column":19},"end":{"line":2,"column":33},"identifierName":"value"}, + "name": "value", + "typeAnnotation": { + "type": "TSTypeAnnotation", + "start":88,"end":97,"loc":{"start":{"line":2,"column":24},"end":{"line":2,"column":33}}, + "typeAnnotation": { + "type": "TSUnknownKeyword", + "start":90,"end":97,"loc":{"start":{"line":2,"column":26},"end":{"line":2,"column":33}} + } + } + } + ], + "returnType": { + "type": "TSTypeAnnotation", + "start":98,"end":113,"loc":{"start":{"line":2,"column":34},"end":{"line":2,"column":49}}, + "typeAnnotation": { + "type": "TSTypePredicate", + "start":98,"end":113,"loc":{"start":{"line":2,"column":34},"end":{"line":2,"column":49}}, + "parameterName": { + "type": "Identifier", + "start":108,"end":113,"loc":{"start":{"line":2,"column":44},"end":{"line":2,"column":49},"identifierName":"value"}, + "name": "value" + }, + "asserts": true + } + }, + "body": { + "type": "BlockStatement", + "start":114,"end":116,"loc":{"start":{"line":2,"column":50},"end":{"line":2,"column":52}}, + "body": [], + "directives": [] + } + }, + { + "type": "FunctionDeclaration", + "start":117,"end":163,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":46}}, + "id": { + "type": "Identifier", + "start":126,"end":134,"loc":{"start":{"line":3,"column":9},"end":{"line":3,"column":17},"identifierName":"asserts3"}, + "name": "asserts3" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start":136,"end":150,"loc":{"start":{"line":3,"column":19},"end":{"line":3,"column":33},"identifierName":"value"}, + "name": "value", + "typeAnnotation": { + "type": "TSTypeAnnotation", + "start":141,"end":150,"loc":{"start":{"line":3,"column":24},"end":{"line":3,"column":33}}, + "typeAnnotation": { + "type": "TSUnknownKeyword", + "start":143,"end":150,"loc":{"start":{"line":3,"column":26},"end":{"line":3,"column":33}} + } + } + } + ], + "returnType": { + "type": "TSTypeAnnotation", + "start":151,"end":160,"loc":{"start":{"line":3,"column":34},"end":{"line":3,"column":43}}, + "typeAnnotation": { + "type": "TSTypeReference", + "start":153,"end":160,"loc":{"start":{"line":3,"column":36},"end":{"line":3,"column":43}}, + "typeName": { + "type": "Identifier", + "start":153,"end":160,"loc":{"start":{"line":3,"column":36},"end":{"line":3,"column":43},"identifierName":"asserts"}, + "name": "asserts" + } + } + }, + "body": { + "type": "BlockStatement", + "start":161,"end":163,"loc":{"start":{"line":3,"column":44},"end":{"line":3,"column":46}}, + "body": [], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/assert-predicate/invalid-escaped-asserts-keyword/input.ts b/packages/babel-parser/test/fixtures/typescript/assert-predicate/invalid-escaped-asserts-keyword/input.ts new file mode 100644 index 000000000000..a89b5ad6c9fa --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/assert-predicate/invalid-escaped-asserts-keyword/input.ts @@ -0,0 +1 @@ +declare function assertIsString(value: unknown): \u{61}sserts value; diff --git a/packages/babel-parser/test/fixtures/typescript/assert-predicate/invalid-escaped-asserts-keyword/output.json b/packages/babel-parser/test/fixtures/typescript/assert-predicate/invalid-escaped-asserts-keyword/output.json new file mode 100644 index 000000000000..8caf5c9c34a9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/assert-predicate/invalid-escaped-asserts-keyword/output.json @@ -0,0 +1,57 @@ +{ + "type": "File", + "start":0,"end":68,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":68}}, + "errors": [ + "SyntaxError: Escape sequence in keyword asserts (1:49)" + ], + "program": { + "type": "Program", + "start":0,"end":68,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":68}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "TSDeclareFunction", + "start":0,"end":68,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":68}}, + "id": { + "type": "Identifier", + "start":17,"end":31,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":31},"identifierName":"assertIsString"}, + "name": "assertIsString" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start":32,"end":46,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":46},"identifierName":"value"}, + "name": "value", + "typeAnnotation": { + "type": "TSTypeAnnotation", + "start":37,"end":46,"loc":{"start":{"line":1,"column":37},"end":{"line":1,"column":46}}, + "typeAnnotation": { + "type": "TSUnknownKeyword", + "start":39,"end":46,"loc":{"start":{"line":1,"column":39},"end":{"line":1,"column":46}} + } + } + } + ], + "returnType": { + "type": "TSTypeAnnotation", + "start":47,"end":67,"loc":{"start":{"line":1,"column":47},"end":{"line":1,"column":67}}, + "typeAnnotation": { + "type": "TSTypePredicate", + "start":47,"end":67,"loc":{"start":{"line":1,"column":47},"end":{"line":1,"column":67}}, + "parameterName": { + "type": "Identifier", + "start":62,"end":67,"loc":{"start":{"line":1,"column":62},"end":{"line":1,"column":67},"identifierName":"value"}, + "name": "value" + }, + "asserts": true + } + }, + "declare": true + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/cast/arrow-async-parameter-as/options.json b/packages/babel-parser/test/fixtures/typescript/cast/arrow-async-parameter-as/options.json deleted file mode 100644 index 69d91502496d..000000000000 --- a/packages/babel-parser/test/fixtures/typescript/cast/arrow-async-parameter-as/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected type cast in parameter position. (1:7)" -} diff --git a/packages/babel-parser/test/fixtures/typescript/cast/arrow-async-parameter-as/output.json b/packages/babel-parser/test/fixtures/typescript/cast/arrow-async-parameter-as/output.json new file mode 100644 index 000000000000..e2c60e35e2ad --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/cast/arrow-async-parameter-as/output.json @@ -0,0 +1,53 @@ +{ + "type": "File", + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, + "errors": [ + "SyntaxError: Unexpected type cast in parameter position. (1:7)" + ], + "program": { + "type": "Program", + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, + "expression": { + "type": "ArrowFunctionExpression", + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, + "id": null, + "generator": false, + "async": true, + "params": [ + { + "type": "TSAsExpression", + "start":7,"end":13,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":13}}, + "expression": { + "type": "Identifier", + "start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8},"identifierName":"a"}, + "name": "a" + }, + "typeAnnotation": { + "type": "TSTypeReference", + "start":12,"end":13,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":13}}, + "typeName": { + "type": "Identifier", + "start":12,"end":13,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":13},"identifierName":"T"}, + "name": "T" + } + } + } + ], + "body": { + "type": "BlockStatement", + "start":18,"end":20,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":20}}, + "body": [], + "directives": [] + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/cast/arrow-async-parameter-assertion/options.json b/packages/babel-parser/test/fixtures/typescript/cast/arrow-async-parameter-assertion/options.json deleted file mode 100644 index 69d91502496d..000000000000 --- a/packages/babel-parser/test/fixtures/typescript/cast/arrow-async-parameter-assertion/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected type cast in parameter position. (1:7)" -} diff --git a/packages/babel-parser/test/fixtures/typescript/cast/arrow-async-parameter-assertion/output.json b/packages/babel-parser/test/fixtures/typescript/cast/arrow-async-parameter-assertion/output.json new file mode 100644 index 000000000000..399b0fb6572f --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/cast/arrow-async-parameter-assertion/output.json @@ -0,0 +1,53 @@ +{ + "type": "File", + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, + "errors": [ + "SyntaxError: Unexpected type cast in parameter position. (1:7)" + ], + "program": { + "type": "Program", + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, + "expression": { + "type": "ArrowFunctionExpression", + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, + "id": null, + "generator": false, + "async": true, + "params": [ + { + "type": "TSTypeAssertion", + "start":7,"end":12,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":12}}, + "typeAnnotation": { + "type": "TSTypeReference", + "start":8,"end":9,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":9}}, + "typeName": { + "type": "Identifier", + "start":8,"end":9,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":9},"identifierName":"T"}, + "name": "T" + } + }, + "expression": { + "type": "Identifier", + "start":11,"end":12,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":12},"identifierName":"a"}, + "name": "a" + } + } + ], + "body": { + "type": "BlockStatement", + "start":17,"end":19,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":19}}, + "body": [], + "directives": [] + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/cast/arrow-in-parens-with-parens-node/output.json b/packages/babel-parser/test/fixtures/typescript/cast/arrow-in-parens-with-parens-node/output.json index 29e413f17d6f..f94f25c9a098 100644 --- a/packages/babel-parser/test/fixtures/typescript/cast/arrow-in-parens-with-parens-node/output.json +++ b/packages/babel-parser/test/fixtures/typescript/cast/arrow-in-parens-with-parens-node/output.json @@ -1,203 +1,57 @@ { "type": "File", - "start": 0, - "end": 44, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 44 - } - }, + "start":0,"end":44,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":44}}, "program": { "type": "Program", - "start": 0, - "end": 44, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 44 - } - }, + "start":0,"end":44,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":44}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 44, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 44 - } - }, + "start":0,"end":44,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":44}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 43, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 43 - } - }, + "start":4,"end":43,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":43}}, "id": { "type": "Identifier", - "start": 4, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 13 - }, - "identifierName": "asserted1" - }, + "start":4,"end":13,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":13},"identifierName":"asserted1"}, "name": "asserted1" }, "init": { "type": "TSTypeAssertion", - "start": 16, - "end": 43, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 43 - } - }, + "start":16,"end":43,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":43}}, "typeAnnotation": { "type": "TSAnyKeyword", - "start": 17, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 20 - } - } + "start":17,"end":20,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":20}} }, "expression": { "type": "ParenthesizedExpression", - "start": 21, - "end": 43, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 43 - } - }, + "start":21,"end":43,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":43}}, "expression": { "type": "ArrowFunctionExpression", - "start": 22, - "end": 42, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 42 - } - }, + "start":22,"end":42,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":42}}, "id": null, "generator": false, "async": false, "params": [ { "type": "Identifier", - "start": 23, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 24 - }, - "identifierName": "n" - }, + "start":23,"end":24,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":24},"identifierName":"n"}, "name": "n" } ], "body": { "type": "BlockStatement", - "start": 29, - "end": 42, - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 1, - "column": 42 - } - }, + "start":29,"end":42,"loc":{"start":{"line":1,"column":29},"end":{"line":1,"column":42}}, "body": [ { "type": "ReturnStatement", - "start": 31, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 31 - }, - "end": { - "line": 1, - "column": 40 - } - }, + "start":31,"end":40,"loc":{"start":{"line":1,"column":31},"end":{"line":1,"column":40}}, "argument": { "type": "Identifier", - "start": 38, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 38 - }, - "end": { - "line": 1, - "column": 39 - }, - "identifierName": "n" - }, + "start":38,"end":39,"loc":{"start":{"line":1,"column":38},"end":{"line":1,"column":39},"identifierName":"n"}, "name": "n" } } diff --git a/packages/babel-parser/test/fixtures/typescript/cast/arrow-in-parens/output.json b/packages/babel-parser/test/fixtures/typescript/cast/arrow-in-parens/output.json index 08bffbefa06b..ff31722aed34 100644 --- a/packages/babel-parser/test/fixtures/typescript/cast/arrow-in-parens/output.json +++ b/packages/babel-parser/test/fixtures/typescript/cast/arrow-in-parens/output.json @@ -1,189 +1,54 @@ { "type": "File", - "start": 0, - "end": 44, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 44 - } - }, + "start":0,"end":44,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":44}}, "program": { "type": "Program", - "start": 0, - "end": 44, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 44 - } - }, + "start":0,"end":44,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":44}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 44, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 44 - } - }, + "start":0,"end":44,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":44}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 43, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 43 - } - }, + "start":4,"end":43,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":43}}, "id": { "type": "Identifier", - "start": 4, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 13 - }, - "identifierName": "asserted1" - }, + "start":4,"end":13,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":13},"identifierName":"asserted1"}, "name": "asserted1" }, "init": { "type": "TSTypeAssertion", - "start": 16, - "end": 43, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 43 - } - }, + "start":16,"end":43,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":43}}, "typeAnnotation": { "type": "TSAnyKeyword", - "start": 17, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 20 - } - } + "start":17,"end":20,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":20}} }, "expression": { "type": "ArrowFunctionExpression", - "start": 22, - "end": 42, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 42 - } - }, + "start":22,"end":42,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":42}}, "id": null, "generator": false, "async": false, "params": [ { "type": "Identifier", - "start": 23, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 24 - }, - "identifierName": "n" - }, + "start":23,"end":24,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":24},"identifierName":"n"}, "name": "n" } ], "body": { "type": "BlockStatement", - "start": 29, - "end": 42, - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 1, - "column": 42 - } - }, + "start":29,"end":42,"loc":{"start":{"line":1,"column":29},"end":{"line":1,"column":42}}, "body": [ { "type": "ReturnStatement", - "start": 31, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 31 - }, - "end": { - "line": 1, - "column": 40 - } - }, + "start":31,"end":40,"loc":{"start":{"line":1,"column":31},"end":{"line":1,"column":40}}, "argument": { "type": "Identifier", - "start": 38, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 38 - }, - "end": { - "line": 1, - "column": 39 - }, - "identifierName": "n" - }, + "start":38,"end":39,"loc":{"start":{"line":1,"column":38},"end":{"line":1,"column":39},"identifierName":"n"}, "name": "n" } } diff --git a/packages/babel-parser/test/fixtures/typescript/cast/arrow-parameter-as/options.json b/packages/babel-parser/test/fixtures/typescript/cast/arrow-parameter-as/options.json deleted file mode 100644 index b5bdba868c9f..000000000000 --- a/packages/babel-parser/test/fixtures/typescript/cast/arrow-parameter-as/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected type cast in parameter position. (1:1)" -} diff --git a/packages/babel-parser/test/fixtures/typescript/cast/arrow-parameter-as/output.json b/packages/babel-parser/test/fixtures/typescript/cast/arrow-parameter-as/output.json new file mode 100644 index 000000000000..10d0beeb57d2 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/cast/arrow-parameter-as/output.json @@ -0,0 +1,53 @@ +{ + "type": "File", + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, + "errors": [ + "SyntaxError: Unexpected type cast in parameter position. (1:1)" + ], + "program": { + "type": "Program", + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, + "expression": { + "type": "ArrowFunctionExpression", + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "TSAsExpression", + "start":1,"end":7,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":7}}, + "expression": { + "type": "Identifier", + "start":1,"end":2,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":2},"identifierName":"a"}, + "name": "a" + }, + "typeAnnotation": { + "type": "TSTypeReference", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7}}, + "typeName": { + "type": "Identifier", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"T"}, + "name": "T" + } + } + } + ], + "body": { + "type": "BlockStatement", + "start":12,"end":14,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":14}}, + "body": [], + "directives": [] + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/cast/arrow-parameter-assertion/options.json b/packages/babel-parser/test/fixtures/typescript/cast/arrow-parameter-assertion/options.json deleted file mode 100644 index b5bdba868c9f..000000000000 --- a/packages/babel-parser/test/fixtures/typescript/cast/arrow-parameter-assertion/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected type cast in parameter position. (1:1)" -} diff --git a/packages/babel-parser/test/fixtures/typescript/cast/arrow-parameter-assertion/output.json b/packages/babel-parser/test/fixtures/typescript/cast/arrow-parameter-assertion/output.json new file mode 100644 index 000000000000..81af16cb094e --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/cast/arrow-parameter-assertion/output.json @@ -0,0 +1,53 @@ +{ + "type": "File", + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, + "errors": [ + "SyntaxError: Unexpected type cast in parameter position. (1:1)" + ], + "program": { + "type": "Program", + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, + "expression": { + "type": "ArrowFunctionExpression", + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "TSTypeAssertion", + "start":1,"end":6,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":6}}, + "typeAnnotation": { + "type": "TSTypeReference", + "start":2,"end":3,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":3}}, + "typeName": { + "type": "Identifier", + "start":2,"end":3,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":3},"identifierName":"T"}, + "name": "T" + } + }, + "expression": { + "type": "Identifier", + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"a"}, + "name": "a" + } + } + ], + "body": { + "type": "BlockStatement", + "start":11,"end":13,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":13}}, + "body": [], + "directives": [] + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/cast/as-const/output.json b/packages/babel-parser/test/fixtures/typescript/cast/as-const/output.json index e1177f2c1eff..b0aceac139e4 100644 --- a/packages/babel-parser/test/fixtures/typescript/cast/as-const/output.json +++ b/packages/babel-parser/test/fixtures/typescript/cast/as-const/output.json @@ -1,108 +1,30 @@ { "type": "File", - "start": 0, - "end": 1127, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 39, - "column": 34 - } - }, + "start":0,"end":1127,"loc":{"start":{"line":1,"column":0},"end":{"line":39,"column":34}}, "program": { "type": "Program", - "start": 0, - "end": 1127, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 39, - "column": 34 - } - }, + "start":0,"end":1127,"loc":{"start":{"line":1,"column":0},"end":{"line":39,"column":34}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 143, - "end": 167, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 24 - } - }, + "start":143,"end":167,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":24}}, "declarations": [ { "type": "VariableDeclarator", - "start": 147, - "end": 166, - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 23 - } - }, + "start":147,"end":166,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":23}}, "id": { "type": "Identifier", - "start": 147, - "end": 149, - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 6 - }, - "identifierName": "v1" - }, + "start":147,"end":149,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":6},"identifierName":"v1"}, "name": "v1" }, "init": { "type": "TSAsExpression", - "start": 152, - "end": 166, - "loc": { - "start": { - "line": 3, - "column": 9 - }, - "end": { - "line": 3, - "column": 23 - } - }, + "start":152,"end":166,"loc":{"start":{"line":3,"column":9},"end":{"line":3,"column":23}}, "expression": { "type": "StringLiteral", - "start": 152, - "end": 157, - "loc": { - "start": { - "line": 3, - "column": 9 - }, - "end": { - "line": 3, - "column": 14 - } - }, + "start":152,"end":157,"loc":{"start":{"line":3,"column":9},"end":{"line":3,"column":14}}, "extra": { "rawValue": "abc", "raw": "'abc'" @@ -111,33 +33,10 @@ }, "typeAnnotation": { "type": "TSTypeReference", - "start": 161, - "end": 166, - "loc": { - "start": { - "line": 3, - "column": 18 - }, - "end": { - "line": 3, - "column": 23 - } - }, + "start":161,"end":166,"loc":{"start":{"line":3,"column":18},"end":{"line":3,"column":23}}, "typeName": { "type": "Identifier", - "start": 161, - "end": 166, - "loc": { - "start": { - "line": 3, - "column": 18 - }, - "end": { - "line": 3, - "column": 23 - }, - "identifierName": "const" - }, + "start":161,"end":166,"loc":{"start":{"line":3,"column":18},"end":{"line":3,"column":23},"identifierName":"const"}, "name": "const" } } @@ -149,127 +48,38 @@ { "type": "CommentLine", "value": " Copied over from TypeScript's test case", - "start": 0, - "end": 42, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 42 - } - } + "start":0,"end":42,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":42}} }, { "type": "CommentLine", "value": " https://github.com/Microsoft/TypeScript/blob/master/tests/baselines/reference/constAssertions.js", - "start": 43, - "end": 142, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 99 - } - } + "start":43,"end":142,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":99}} } ] }, { "type": "VariableDeclaration", - "start": 168, - "end": 192, - "loc": { - "start": { - "line": 4, - "column": 0 - }, - "end": { - "line": 4, - "column": 24 - } - }, + "start":168,"end":192,"loc":{"start":{"line":4,"column":0},"end":{"line":4,"column":24}}, "declarations": [ { "type": "VariableDeclarator", - "start": 172, - "end": 191, - "loc": { - "start": { - "line": 4, - "column": 4 - }, - "end": { - "line": 4, - "column": 23 - } - }, + "start":172,"end":191,"loc":{"start":{"line":4,"column":4},"end":{"line":4,"column":23}}, "id": { "type": "Identifier", - "start": 172, - "end": 174, - "loc": { - "start": { - "line": 4, - "column": 4 - }, - "end": { - "line": 4, - "column": 6 - }, - "identifierName": "v2" - }, + "start":172,"end":174,"loc":{"start":{"line":4,"column":4},"end":{"line":4,"column":6},"identifierName":"v2"}, "name": "v2" }, "init": { "type": "TSAsExpression", - "start": 177, - "end": 191, - "loc": { - "start": { - "line": 4, - "column": 9 - }, - "end": { - "line": 4, - "column": 23 - } - }, + "start":177,"end":191,"loc":{"start":{"line":4,"column":9},"end":{"line":4,"column":23}}, "expression": { "type": "TemplateLiteral", - "start": 177, - "end": 182, - "loc": { - "start": { - "line": 4, - "column": 9 - }, - "end": { - "line": 4, - "column": 14 - } - }, + "start":177,"end":182,"loc":{"start":{"line":4,"column":9},"end":{"line":4,"column":14}}, "expressions": [], "quasis": [ { "type": "TemplateElement", - "start": 178, - "end": 181, - "loc": { - "start": { - "line": 4, - "column": 10 - }, - "end": { - "line": 4, - "column": 13 - } - }, + "start":178,"end":181,"loc":{"start":{"line":4,"column":10},"end":{"line":4,"column":13}}, "value": { "raw": "abc", "cooked": "abc" @@ -280,33 +90,10 @@ }, "typeAnnotation": { "type": "TSTypeReference", - "start": 186, - "end": 191, - "loc": { - "start": { - "line": 4, - "column": 18 - }, - "end": { - "line": 4, - "column": 23 - } - }, + "start":186,"end":191,"loc":{"start":{"line":4,"column":18},"end":{"line":4,"column":23}}, "typeName": { "type": "Identifier", - "start": 186, - "end": 191, - "loc": { - "start": { - "line": 4, - "column": 18 - }, - "end": { - "line": 4, - "column": 23 - }, - "identifierName": "const" - }, + "start":186,"end":191,"loc":{"start":{"line":4,"column":18},"end":{"line":4,"column":23},"identifierName":"const"}, "name": "const" } } @@ -317,78 +104,22 @@ }, { "type": "VariableDeclaration", - "start": 193, - "end": 214, - "loc": { - "start": { - "line": 5, - "column": 0 - }, - "end": { - "line": 5, - "column": 21 - } - }, + "start":193,"end":214,"loc":{"start":{"line":5,"column":0},"end":{"line":5,"column":21}}, "declarations": [ { "type": "VariableDeclarator", - "start": 197, - "end": 213, - "loc": { - "start": { - "line": 5, - "column": 4 - }, - "end": { - "line": 5, - "column": 20 - } - }, + "start":197,"end":213,"loc":{"start":{"line":5,"column":4},"end":{"line":5,"column":20}}, "id": { "type": "Identifier", - "start": 197, - "end": 199, - "loc": { - "start": { - "line": 5, - "column": 4 - }, - "end": { - "line": 5, - "column": 6 - }, - "identifierName": "v3" - }, + "start":197,"end":199,"loc":{"start":{"line":5,"column":4},"end":{"line":5,"column":6},"identifierName":"v3"}, "name": "v3" }, "init": { "type": "TSAsExpression", - "start": 202, - "end": 213, - "loc": { - "start": { - "line": 5, - "column": 9 - }, - "end": { - "line": 5, - "column": 20 - } - }, + "start":202,"end":213,"loc":{"start":{"line":5,"column":9},"end":{"line":5,"column":20}}, "expression": { "type": "NumericLiteral", - "start": 202, - "end": 204, - "loc": { - "start": { - "line": 5, - "column": 9 - }, - "end": { - "line": 5, - "column": 11 - } - }, + "start":202,"end":204,"loc":{"start":{"line":5,"column":9},"end":{"line":5,"column":11}}, "extra": { "rawValue": 10, "raw": "10" @@ -397,33 +128,10 @@ }, "typeAnnotation": { "type": "TSTypeReference", - "start": 208, - "end": 213, - "loc": { - "start": { - "line": 5, - "column": 15 - }, - "end": { - "line": 5, - "column": 20 - } - }, + "start":208,"end":213,"loc":{"start":{"line":5,"column":15},"end":{"line":5,"column":20}}, "typeName": { "type": "Identifier", - "start": 208, - "end": 213, - "loc": { - "start": { - "line": 5, - "column": 15 - }, - "end": { - "line": 5, - "column": 20 - }, - "identifierName": "const" - }, + "start":208,"end":213,"loc":{"start":{"line":5,"column":15},"end":{"line":5,"column":20},"identifierName":"const"}, "name": "const" } } @@ -434,94 +142,27 @@ }, { "type": "VariableDeclaration", - "start": 215, - "end": 237, - "loc": { - "start": { - "line": 6, - "column": 0 - }, - "end": { - "line": 6, - "column": 22 - } - }, + "start":215,"end":237,"loc":{"start":{"line":6,"column":0},"end":{"line":6,"column":22}}, "declarations": [ { "type": "VariableDeclarator", - "start": 219, - "end": 236, - "loc": { - "start": { - "line": 6, - "column": 4 - }, - "end": { - "line": 6, - "column": 21 - } - }, + "start":219,"end":236,"loc":{"start":{"line":6,"column":4},"end":{"line":6,"column":21}}, "id": { "type": "Identifier", - "start": 219, - "end": 221, - "loc": { - "start": { - "line": 6, - "column": 4 - }, - "end": { - "line": 6, - "column": 6 - }, - "identifierName": "v4" - }, + "start":219,"end":221,"loc":{"start":{"line":6,"column":4},"end":{"line":6,"column":6},"identifierName":"v4"}, "name": "v4" }, "init": { "type": "TSAsExpression", - "start": 224, - "end": 236, - "loc": { - "start": { - "line": 6, - "column": 9 - }, - "end": { - "line": 6, - "column": 21 - } - }, + "start":224,"end":236,"loc":{"start":{"line":6,"column":9},"end":{"line":6,"column":21}}, "expression": { "type": "UnaryExpression", - "start": 224, - "end": 227, - "loc": { - "start": { - "line": 6, - "column": 9 - }, - "end": { - "line": 6, - "column": 12 - } - }, + "start":224,"end":227,"loc":{"start":{"line":6,"column":9},"end":{"line":6,"column":12}}, "operator": "-", "prefix": true, "argument": { "type": "NumericLiteral", - "start": 225, - "end": 227, - "loc": { - "start": { - "line": 6, - "column": 10 - }, - "end": { - "line": 6, - "column": 12 - } - }, + "start":225,"end":227,"loc":{"start":{"line":6,"column":10},"end":{"line":6,"column":12}}, "extra": { "rawValue": 10, "raw": "10" @@ -531,33 +172,10 @@ }, "typeAnnotation": { "type": "TSTypeReference", - "start": 231, - "end": 236, - "loc": { - "start": { - "line": 6, - "column": 16 - }, - "end": { - "line": 6, - "column": 21 - } - }, + "start":231,"end":236,"loc":{"start":{"line":6,"column":16},"end":{"line":6,"column":21}}, "typeName": { "type": "Identifier", - "start": 231, - "end": 236, - "loc": { - "start": { - "line": 6, - "column": 16 - }, - "end": { - "line": 6, - "column": 21 - }, - "identifierName": "const" - }, + "start":231,"end":236,"loc":{"start":{"line":6,"column":16},"end":{"line":6,"column":21},"identifierName":"const"}, "name": "const" } } @@ -568,94 +186,27 @@ }, { "type": "VariableDeclaration", - "start": 238, - "end": 260, - "loc": { - "start": { - "line": 7, - "column": 0 - }, - "end": { - "line": 7, - "column": 22 - } - }, + "start":238,"end":260,"loc":{"start":{"line":7,"column":0},"end":{"line":7,"column":22}}, "declarations": [ { "type": "VariableDeclarator", - "start": 242, - "end": 259, - "loc": { - "start": { - "line": 7, - "column": 4 - }, - "end": { - "line": 7, - "column": 21 - } - }, + "start":242,"end":259,"loc":{"start":{"line":7,"column":4},"end":{"line":7,"column":21}}, "id": { "type": "Identifier", - "start": 242, - "end": 244, - "loc": { - "start": { - "line": 7, - "column": 4 - }, - "end": { - "line": 7, - "column": 6 - }, - "identifierName": "v5" - }, + "start":242,"end":244,"loc":{"start":{"line":7,"column":4},"end":{"line":7,"column":6},"identifierName":"v5"}, "name": "v5" }, "init": { "type": "TSAsExpression", - "start": 247, - "end": 259, - "loc": { - "start": { - "line": 7, - "column": 9 - }, - "end": { - "line": 7, - "column": 21 - } - }, + "start":247,"end":259,"loc":{"start":{"line":7,"column":9},"end":{"line":7,"column":21}}, "expression": { "type": "UnaryExpression", - "start": 247, - "end": 250, - "loc": { - "start": { - "line": 7, - "column": 9 - }, - "end": { - "line": 7, - "column": 12 - } - }, + "start":247,"end":250,"loc":{"start":{"line":7,"column":9},"end":{"line":7,"column":12}}, "operator": "+", "prefix": true, "argument": { "type": "NumericLiteral", - "start": 248, - "end": 250, - "loc": { - "start": { - "line": 7, - "column": 10 - }, - "end": { - "line": 7, - "column": 12 - } - }, + "start":248,"end":250,"loc":{"start":{"line":7,"column":10},"end":{"line":7,"column":12}}, "extra": { "rawValue": 10, "raw": "10" @@ -665,33 +216,10 @@ }, "typeAnnotation": { "type": "TSTypeReference", - "start": 254, - "end": 259, - "loc": { - "start": { - "line": 7, - "column": 16 - }, - "end": { - "line": 7, - "column": 21 - } - }, + "start":254,"end":259,"loc":{"start":{"line":7,"column":16},"end":{"line":7,"column":21}}, "typeName": { "type": "Identifier", - "start": 254, - "end": 259, - "loc": { - "start": { - "line": 7, - "column": 16 - }, - "end": { - "line": 7, - "column": 21 - }, - "identifierName": "const" - }, + "start":254,"end":259,"loc":{"start":{"line":7,"column":16},"end":{"line":7,"column":21},"identifierName":"const"}, "name": "const" } } @@ -702,78 +230,22 @@ }, { "type": "VariableDeclaration", - "start": 261, - "end": 282, - "loc": { - "start": { - "line": 8, - "column": 0 - }, - "end": { - "line": 8, - "column": 21 - } - }, + "start":261,"end":282,"loc":{"start":{"line":8,"column":0},"end":{"line":8,"column":21}}, "declarations": [ { "type": "VariableDeclarator", - "start": 265, - "end": 281, - "loc": { - "start": { - "line": 8, - "column": 4 - }, - "end": { - "line": 8, - "column": 20 - } - }, + "start":265,"end":281,"loc":{"start":{"line":8,"column":4},"end":{"line":8,"column":20}}, "id": { "type": "Identifier", - "start": 265, - "end": 267, - "loc": { - "start": { - "line": 8, - "column": 4 - }, - "end": { - "line": 8, - "column": 6 - }, - "identifierName": "v6" - }, + "start":265,"end":267,"loc":{"start":{"line":8,"column":4},"end":{"line":8,"column":6},"identifierName":"v6"}, "name": "v6" }, "init": { "type": "TSAsExpression", - "start": 270, - "end": 281, - "loc": { - "start": { - "line": 8, - "column": 9 - }, - "end": { - "line": 8, - "column": 20 - } - }, + "start":270,"end":281,"loc":{"start":{"line":8,"column":9},"end":{"line":8,"column":20}}, "expression": { "type": "NumericLiteral", - "start": 270, - "end": 272, - "loc": { - "start": { - "line": 8, - "column": 9 - }, - "end": { - "line": 8, - "column": 11 - } - }, + "start":270,"end":272,"loc":{"start":{"line":8,"column":9},"end":{"line":8,"column":11}}, "extra": { "rawValue": 10, "raw": "10" @@ -782,33 +254,10 @@ }, "typeAnnotation": { "type": "TSTypeReference", - "start": 276, - "end": 281, - "loc": { - "start": { - "line": 8, - "column": 15 - }, - "end": { - "line": 8, - "column": 20 - } - }, + "start":276,"end":281,"loc":{"start":{"line":8,"column":15},"end":{"line":8,"column":20}}, "typeName": { "type": "Identifier", - "start": 276, - "end": 281, - "loc": { - "start": { - "line": 8, - "column": 15 - }, - "end": { - "line": 8, - "column": 20 - }, - "identifierName": "const" - }, + "start":276,"end":281,"loc":{"start":{"line":8,"column":15},"end":{"line":8,"column":20},"identifierName":"const"}, "name": "const" } } @@ -819,94 +268,27 @@ }, { "type": "VariableDeclaration", - "start": 283, - "end": 305, - "loc": { - "start": { - "line": 9, - "column": 0 - }, - "end": { - "line": 9, - "column": 22 - } - }, + "start":283,"end":305,"loc":{"start":{"line":9,"column":0},"end":{"line":9,"column":22}}, "declarations": [ { "type": "VariableDeclarator", - "start": 287, - "end": 304, - "loc": { - "start": { - "line": 9, - "column": 4 - }, - "end": { - "line": 9, - "column": 21 - } - }, + "start":287,"end":304,"loc":{"start":{"line":9,"column":4},"end":{"line":9,"column":21}}, "id": { "type": "Identifier", - "start": 287, - "end": 289, - "loc": { - "start": { - "line": 9, - "column": 4 - }, - "end": { - "line": 9, - "column": 6 - }, - "identifierName": "v7" - }, + "start":287,"end":289,"loc":{"start":{"line":9,"column":4},"end":{"line":9,"column":6},"identifierName":"v7"}, "name": "v7" }, "init": { "type": "TSAsExpression", - "start": 292, - "end": 304, - "loc": { - "start": { - "line": 9, - "column": 9 - }, - "end": { - "line": 9, - "column": 21 - } - }, + "start":292,"end":304,"loc":{"start":{"line":9,"column":9},"end":{"line":9,"column":21}}, "expression": { "type": "UnaryExpression", - "start": 292, - "end": 295, - "loc": { - "start": { - "line": 9, - "column": 9 - }, - "end": { - "line": 9, - "column": 12 - } - }, + "start":292,"end":295,"loc":{"start":{"line":9,"column":9},"end":{"line":9,"column":12}}, "operator": "-", "prefix": true, "argument": { "type": "NumericLiteral", - "start": 293, - "end": 295, - "loc": { - "start": { - "line": 9, - "column": 10 - }, - "end": { - "line": 9, - "column": 12 - } - }, + "start":293,"end":295,"loc":{"start":{"line":9,"column":10},"end":{"line":9,"column":12}}, "extra": { "rawValue": 10, "raw": "10" @@ -916,33 +298,10 @@ }, "typeAnnotation": { "type": "TSTypeReference", - "start": 299, - "end": 304, - "loc": { - "start": { - "line": 9, - "column": 16 - }, - "end": { - "line": 9, - "column": 21 - } - }, + "start":299,"end":304,"loc":{"start":{"line":9,"column":16},"end":{"line":9,"column":21}}, "typeName": { "type": "Identifier", - "start": 299, - "end": 304, - "loc": { - "start": { - "line": 9, - "column": 16 - }, - "end": { - "line": 9, - "column": 21 - }, - "identifierName": "const" - }, + "start":299,"end":304,"loc":{"start":{"line":9,"column":16},"end":{"line":9,"column":21},"identifierName":"const"}, "name": "const" } } @@ -953,109 +312,30 @@ }, { "type": "VariableDeclaration", - "start": 306, - "end": 329, - "loc": { - "start": { - "line": 10, - "column": 0 - }, - "end": { - "line": 10, - "column": 23 - } - }, + "start":306,"end":329,"loc":{"start":{"line":10,"column":0},"end":{"line":10,"column":23}}, "declarations": [ { "type": "VariableDeclarator", - "start": 310, - "end": 328, - "loc": { - "start": { - "line": 10, - "column": 4 - }, - "end": { - "line": 10, - "column": 22 - } - }, + "start":310,"end":328,"loc":{"start":{"line":10,"column":4},"end":{"line":10,"column":22}}, "id": { "type": "Identifier", - "start": 310, - "end": 312, - "loc": { - "start": { - "line": 10, - "column": 4 - }, - "end": { - "line": 10, - "column": 6 - }, - "identifierName": "v8" - }, + "start":310,"end":312,"loc":{"start":{"line":10,"column":4},"end":{"line":10,"column":6},"identifierName":"v8"}, "name": "v8" }, "init": { "type": "TSAsExpression", - "start": 315, - "end": 328, - "loc": { - "start": { - "line": 10, - "column": 9 - }, - "end": { - "line": 10, - "column": 22 - } - }, + "start":315,"end":328,"loc":{"start":{"line":10,"column":9},"end":{"line":10,"column":22}}, "expression": { "type": "BooleanLiteral", - "start": 315, - "end": 319, - "loc": { - "start": { - "line": 10, - "column": 9 - }, - "end": { - "line": 10, - "column": 13 - } - }, + "start":315,"end":319,"loc":{"start":{"line":10,"column":9},"end":{"line":10,"column":13}}, "value": true }, "typeAnnotation": { "type": "TSTypeReference", - "start": 323, - "end": 328, - "loc": { - "start": { - "line": 10, - "column": 17 - }, - "end": { - "line": 10, - "column": 22 - } - }, + "start":323,"end":328,"loc":{"start":{"line":10,"column":17},"end":{"line":10,"column":22}}, "typeName": { "type": "Identifier", - "start": 323, - "end": 328, - "loc": { - "start": { - "line": 10, - "column": 17 - }, - "end": { - "line": 10, - "column": 22 - }, - "identifierName": "const" - }, + "start":323,"end":328,"loc":{"start":{"line":10,"column":17},"end":{"line":10,"column":22},"identifierName":"const"}, "name": "const" } } @@ -1066,109 +346,30 @@ }, { "type": "VariableDeclaration", - "start": 330, - "end": 354, - "loc": { - "start": { - "line": 11, - "column": 0 - }, - "end": { - "line": 11, - "column": 24 - } - }, + "start":330,"end":354,"loc":{"start":{"line":11,"column":0},"end":{"line":11,"column":24}}, "declarations": [ { "type": "VariableDeclarator", - "start": 334, - "end": 353, - "loc": { - "start": { - "line": 11, - "column": 4 - }, - "end": { - "line": 11, - "column": 23 - } - }, + "start":334,"end":353,"loc":{"start":{"line":11,"column":4},"end":{"line":11,"column":23}}, "id": { "type": "Identifier", - "start": 334, - "end": 336, - "loc": { - "start": { - "line": 11, - "column": 4 - }, - "end": { - "line": 11, - "column": 6 - }, - "identifierName": "v9" - }, + "start":334,"end":336,"loc":{"start":{"line":11,"column":4},"end":{"line":11,"column":6},"identifierName":"v9"}, "name": "v9" }, "init": { "type": "TSAsExpression", - "start": 339, - "end": 353, - "loc": { - "start": { - "line": 11, - "column": 9 - }, - "end": { - "line": 11, - "column": 23 - } - }, + "start":339,"end":353,"loc":{"start":{"line":11,"column":9},"end":{"line":11,"column":23}}, "expression": { "type": "BooleanLiteral", - "start": 339, - "end": 344, - "loc": { - "start": { - "line": 11, - "column": 9 - }, - "end": { - "line": 11, - "column": 14 - } - }, + "start":339,"end":344,"loc":{"start":{"line":11,"column":9},"end":{"line":11,"column":14}}, "value": false }, "typeAnnotation": { "type": "TSTypeReference", - "start": 348, - "end": 353, - "loc": { - "start": { - "line": 11, - "column": 18 - }, - "end": { - "line": 11, - "column": 23 - } - }, + "start":348,"end":353,"loc":{"start":{"line":11,"column":18},"end":{"line":11,"column":23}}, "typeName": { "type": "Identifier", - "start": 348, - "end": 353, - "loc": { - "start": { - "line": 11, - "column": 18 - }, - "end": { - "line": 11, - "column": 23 - }, - "identifierName": "const" - }, + "start":348,"end":353,"loc":{"start":{"line":11,"column":18},"end":{"line":11,"column":23},"identifierName":"const"}, "name": "const" } } @@ -1179,109 +380,30 @@ }, { "type": "VariableDeclaration", - "start": 356, - "end": 377, - "loc": { - "start": { - "line": 13, - "column": 0 - }, - "end": { - "line": 13, - "column": 21 - } - }, + "start":356,"end":377,"loc":{"start":{"line":13,"column":0},"end":{"line":13,"column":21}}, "declarations": [ { "type": "VariableDeclarator", - "start": 360, - "end": 376, - "loc": { - "start": { - "line": 13, - "column": 4 - }, - "end": { - "line": 13, - "column": 20 - } - }, + "start":360,"end":376,"loc":{"start":{"line":13,"column":4},"end":{"line":13,"column":20}}, "id": { "type": "Identifier", - "start": 360, - "end": 362, - "loc": { - "start": { - "line": 13, - "column": 4 - }, - "end": { - "line": 13, - "column": 6 - }, - "identifierName": "a1" - }, + "start":360,"end":362,"loc":{"start":{"line":13,"column":4},"end":{"line":13,"column":6},"identifierName":"a1"}, "name": "a1" }, "init": { "type": "TSAsExpression", - "start": 365, - "end": 376, - "loc": { - "start": { - "line": 13, - "column": 9 - }, - "end": { - "line": 13, - "column": 20 - } - }, + "start":365,"end":376,"loc":{"start":{"line":13,"column":9},"end":{"line":13,"column":20}}, "expression": { "type": "ArrayExpression", - "start": 365, - "end": 367, - "loc": { - "start": { - "line": 13, - "column": 9 - }, - "end": { - "line": 13, - "column": 11 - } - }, + "start":365,"end":367,"loc":{"start":{"line":13,"column":9},"end":{"line":13,"column":11}}, "elements": [] }, "typeAnnotation": { "type": "TSTypeReference", - "start": 371, - "end": 376, - "loc": { - "start": { - "line": 13, - "column": 15 - }, - "end": { - "line": 13, - "column": 20 - } - }, + "start":371,"end":376,"loc":{"start":{"line":13,"column":15},"end":{"line":13,"column":20}}, "typeName": { "type": "Identifier", - "start": 371, - "end": 376, - "loc": { - "start": { - "line": 13, - "column": 15 - }, - "end": { - "line": 13, - "column": 20 - }, - "identifierName": "const" - }, + "start":371,"end":376,"loc":{"start":{"line":13,"column":15},"end":{"line":13,"column":20},"identifierName":"const"}, "name": "const" } } @@ -1292,93 +414,26 @@ }, { "type": "VariableDeclaration", - "start": 378, - "end": 406, - "loc": { - "start": { - "line": 14, - "column": 0 - }, - "end": { - "line": 14, - "column": 28 - } - }, + "start":378,"end":406,"loc":{"start":{"line":14,"column":0},"end":{"line":14,"column":28}}, "declarations": [ { "type": "VariableDeclarator", - "start": 382, - "end": 405, - "loc": { - "start": { - "line": 14, - "column": 4 - }, - "end": { - "line": 14, - "column": 27 - } - }, + "start":382,"end":405,"loc":{"start":{"line":14,"column":4},"end":{"line":14,"column":27}}, "id": { "type": "Identifier", - "start": 382, - "end": 384, - "loc": { - "start": { - "line": 14, - "column": 4 - }, - "end": { - "line": 14, - "column": 6 - }, - "identifierName": "a2" - }, + "start":382,"end":384,"loc":{"start":{"line":14,"column":4},"end":{"line":14,"column":6},"identifierName":"a2"}, "name": "a2" }, "init": { "type": "TSAsExpression", - "start": 387, - "end": 405, - "loc": { - "start": { - "line": 14, - "column": 9 - }, - "end": { - "line": 14, - "column": 27 - } - }, + "start":387,"end":405,"loc":{"start":{"line":14,"column":9},"end":{"line":14,"column":27}}, "expression": { "type": "ArrayExpression", - "start": 387, - "end": 396, - "loc": { - "start": { - "line": 14, - "column": 9 - }, - "end": { - "line": 14, - "column": 18 - } - }, + "start":387,"end":396,"loc":{"start":{"line":14,"column":9},"end":{"line":14,"column":18}}, "elements": [ { "type": "NumericLiteral", - "start": 388, - "end": 389, - "loc": { - "start": { - "line": 14, - "column": 10 - }, - "end": { - "line": 14, - "column": 11 - } - }, + "start":388,"end":389,"loc":{"start":{"line":14,"column":10},"end":{"line":14,"column":11}}, "extra": { "rawValue": 1, "raw": "1" @@ -1387,18 +442,7 @@ }, { "type": "NumericLiteral", - "start": 391, - "end": 392, - "loc": { - "start": { - "line": 14, - "column": 13 - }, - "end": { - "line": 14, - "column": 14 - } - }, + "start":391,"end":392,"loc":{"start":{"line":14,"column":13},"end":{"line":14,"column":14}}, "extra": { "rawValue": 2, "raw": "2" @@ -1407,18 +451,7 @@ }, { "type": "NumericLiteral", - "start": 394, - "end": 395, - "loc": { - "start": { - "line": 14, - "column": 16 - }, - "end": { - "line": 14, - "column": 17 - } - }, + "start":394,"end":395,"loc":{"start":{"line":14,"column":16},"end":{"line":14,"column":17}}, "extra": { "rawValue": 3, "raw": "3" @@ -1429,33 +462,10 @@ }, "typeAnnotation": { "type": "TSTypeReference", - "start": 400, - "end": 405, - "loc": { - "start": { - "line": 14, - "column": 22 - }, - "end": { - "line": 14, - "column": 27 - } - }, + "start":400,"end":405,"loc":{"start":{"line":14,"column":22},"end":{"line":14,"column":27}}, "typeName": { "type": "Identifier", - "start": 400, - "end": 405, - "loc": { - "start": { - "line": 14, - "column": 22 - }, - "end": { - "line": 14, - "column": 27 - }, - "identifierName": "const" - }, + "start":400,"end":405,"loc":{"start":{"line":14,"column":22},"end":{"line":14,"column":27},"identifierName":"const"}, "name": "const" } } @@ -1466,93 +476,26 @@ }, { "type": "VariableDeclaration", - "start": 407, - "end": 445, - "loc": { - "start": { - "line": 15, - "column": 0 - }, - "end": { - "line": 15, - "column": 38 - } - }, + "start":407,"end":445,"loc":{"start":{"line":15,"column":0},"end":{"line":15,"column":38}}, "declarations": [ { "type": "VariableDeclarator", - "start": 411, - "end": 444, - "loc": { - "start": { - "line": 15, - "column": 4 - }, - "end": { - "line": 15, - "column": 37 - } - }, + "start":411,"end":444,"loc":{"start":{"line":15,"column":4},"end":{"line":15,"column":37}}, "id": { "type": "Identifier", - "start": 411, - "end": 413, - "loc": { - "start": { - "line": 15, - "column": 4 - }, - "end": { - "line": 15, - "column": 6 - }, - "identifierName": "a3" - }, + "start":411,"end":413,"loc":{"start":{"line":15,"column":4},"end":{"line":15,"column":6},"identifierName":"a3"}, "name": "a3" }, "init": { "type": "TSAsExpression", - "start": 416, - "end": 444, - "loc": { - "start": { - "line": 15, - "column": 9 - }, - "end": { - "line": 15, - "column": 37 - } - }, + "start":416,"end":444,"loc":{"start":{"line":15,"column":9},"end":{"line":15,"column":37}}, "expression": { "type": "ArrayExpression", - "start": 416, - "end": 435, - "loc": { - "start": { - "line": 15, - "column": 9 - }, - "end": { - "line": 15, - "column": 28 - } - }, + "start":416,"end":435,"loc":{"start":{"line":15,"column":9},"end":{"line":15,"column":28}}, "elements": [ { "type": "NumericLiteral", - "start": 417, - "end": 419, - "loc": { - "start": { - "line": 15, - "column": 10 - }, - "end": { - "line": 15, - "column": 12 - } - }, + "start":417,"end":419,"loc":{"start":{"line":15,"column":10},"end":{"line":15,"column":12}}, "extra": { "rawValue": 10, "raw": "10" @@ -1561,18 +504,7 @@ }, { "type": "StringLiteral", - "start": 421, - "end": 428, - "loc": { - "start": { - "line": 15, - "column": 14 - }, - "end": { - "line": 15, - "column": 21 - } - }, + "start":421,"end":428,"loc":{"start":{"line":15,"column":14},"end":{"line":15,"column":21}}, "extra": { "rawValue": "hello", "raw": "'hello'" @@ -1581,51 +513,17 @@ }, { "type": "BooleanLiteral", - "start": 430, - "end": 434, - "loc": { - "start": { - "line": 15, - "column": 23 - }, - "end": { - "line": 15, - "column": 27 - } - }, + "start":430,"end":434,"loc":{"start":{"line":15,"column":23},"end":{"line":15,"column":27}}, "value": true } ] }, "typeAnnotation": { "type": "TSTypeReference", - "start": 439, - "end": 444, - "loc": { - "start": { - "line": 15, - "column": 32 - }, - "end": { - "line": 15, - "column": 37 - } - }, + "start":439,"end":444,"loc":{"start":{"line":15,"column":32},"end":{"line":15,"column":37}}, "typeName": { "type": "Identifier", - "start": 439, - "end": 444, - "loc": { - "start": { - "line": 15, - "column": 32 - }, - "end": { - "line": 15, - "column": 37 - }, - "identifierName": "const" - }, + "start":439,"end":444,"loc":{"start":{"line":15,"column":32},"end":{"line":15,"column":37},"identifierName":"const"}, "name": "const" } } @@ -1636,122 +534,33 @@ }, { "type": "VariableDeclaration", - "start": 446, - "end": 479, - "loc": { - "start": { - "line": 16, - "column": 0 - }, - "end": { - "line": 16, - "column": 33 - } - }, + "start":446,"end":479,"loc":{"start":{"line":16,"column":0},"end":{"line":16,"column":33}}, "declarations": [ { "type": "VariableDeclarator", - "start": 450, - "end": 478, - "loc": { - "start": { - "line": 16, - "column": 4 - }, - "end": { - "line": 16, - "column": 32 - } - }, + "start":450,"end":478,"loc":{"start":{"line":16,"column":4},"end":{"line":16,"column":32}}, "id": { "type": "Identifier", - "start": 450, - "end": 452, - "loc": { - "start": { - "line": 16, - "column": 4 - }, - "end": { - "line": 16, - "column": 6 - }, - "identifierName": "a4" - }, + "start":450,"end":452,"loc":{"start":{"line":16,"column":4},"end":{"line":16,"column":6},"identifierName":"a4"}, "name": "a4" }, "init": { "type": "TSAsExpression", - "start": 455, - "end": 478, - "loc": { - "start": { - "line": 16, - "column": 9 - }, - "end": { - "line": 16, - "column": 32 - } - }, + "start":455,"end":478,"loc":{"start":{"line":16,"column":9},"end":{"line":16,"column":32}}, "expression": { "type": "ArrayExpression", - "start": 455, - "end": 469, - "loc": { - "start": { - "line": 16, - "column": 9 - }, - "end": { - "line": 16, - "column": 23 - } - }, + "start":455,"end":469,"loc":{"start":{"line":16,"column":9},"end":{"line":16,"column":23}}, "elements": [ { "type": "SpreadElement", - "start": 456, - "end": 468, - "loc": { - "start": { - "line": 16, - "column": 10 - }, - "end": { - "line": 16, - "column": 22 - } - }, + "start":456,"end":468,"loc":{"start":{"line":16,"column":10},"end":{"line":16,"column":22}}, "argument": { "type": "ArrayExpression", - "start": 459, - "end": 468, - "loc": { - "start": { - "line": 16, - "column": 13 - }, - "end": { - "line": 16, - "column": 22 - } - }, + "start":459,"end":468,"loc":{"start":{"line":16,"column":13},"end":{"line":16,"column":22}}, "elements": [ { "type": "NumericLiteral", - "start": 460, - "end": 461, - "loc": { - "start": { - "line": 16, - "column": 14 - }, - "end": { - "line": 16, - "column": 15 - } - }, + "start":460,"end":461,"loc":{"start":{"line":16,"column":14},"end":{"line":16,"column":15}}, "extra": { "rawValue": 1, "raw": "1" @@ -1760,18 +569,7 @@ }, { "type": "NumericLiteral", - "start": 463, - "end": 464, - "loc": { - "start": { - "line": 16, - "column": 17 - }, - "end": { - "line": 16, - "column": 18 - } - }, + "start":463,"end":464,"loc":{"start":{"line":16,"column":17},"end":{"line":16,"column":18}}, "extra": { "rawValue": 2, "raw": "2" @@ -1780,18 +578,7 @@ }, { "type": "NumericLiteral", - "start": 466, - "end": 467, - "loc": { - "start": { - "line": 16, - "column": 20 - }, - "end": { - "line": 16, - "column": 21 - } - }, + "start":466,"end":467,"loc":{"start":{"line":16,"column":20},"end":{"line":16,"column":21}}, "extra": { "rawValue": 3, "raw": "3" @@ -1805,33 +592,10 @@ }, "typeAnnotation": { "type": "TSTypeReference", - "start": 473, - "end": 478, - "loc": { - "start": { - "line": 16, - "column": 27 - }, - "end": { - "line": 16, - "column": 32 - } - }, + "start":473,"end":478,"loc":{"start":{"line":16,"column":27},"end":{"line":16,"column":32}}, "typeName": { "type": "Identifier", - "start": 473, - "end": 478, - "loc": { - "start": { - "line": 16, - "column": 27 - }, - "end": { - "line": 16, - "column": 32 - }, - "identifierName": "const" - }, + "start":473,"end":478,"loc":{"start":{"line":16,"column":27},"end":{"line":16,"column":32},"identifierName":"const"}, "name": "const" } } @@ -1842,79 +606,23 @@ }, { "type": "VariableDeclaration", - "start": 480, - "end": 499, - "loc": { - "start": { - "line": 17, - "column": 0 - }, - "end": { - "line": 17, - "column": 19 - } - }, + "start":480,"end":499,"loc":{"start":{"line":17,"column":0},"end":{"line":17,"column":19}}, "declarations": [ { "type": "VariableDeclarator", - "start": 484, - "end": 498, - "loc": { - "start": { - "line": 17, - "column": 4 - }, - "end": { - "line": 17, - "column": 18 - } - }, + "start":484,"end":498,"loc":{"start":{"line":17,"column":4},"end":{"line":17,"column":18}}, "id": { "type": "Identifier", - "start": 484, - "end": 486, - "loc": { - "start": { - "line": 17, - "column": 4 - }, - "end": { - "line": 17, - "column": 6 - }, - "identifierName": "a5" - }, + "start":484,"end":486,"loc":{"start":{"line":17,"column":4},"end":{"line":17,"column":6},"identifierName":"a5"}, "name": "a5" }, "init": { "type": "ArrayExpression", - "start": 489, - "end": 498, - "loc": { - "start": { - "line": 17, - "column": 9 - }, - "end": { - "line": 17, - "column": 18 - } - }, + "start":489,"end":498,"loc":{"start":{"line":17,"column":9},"end":{"line":17,"column":18}}, "elements": [ { "type": "NumericLiteral", - "start": 490, - "end": 491, - "loc": { - "start": { - "line": 17, - "column": 10 - }, - "end": { - "line": 17, - "column": 11 - } - }, + "start":490,"end":491,"loc":{"start":{"line":17,"column":10},"end":{"line":17,"column":11}}, "extra": { "rawValue": 1, "raw": "1" @@ -1923,18 +631,7 @@ }, { "type": "NumericLiteral", - "start": 493, - "end": 494, - "loc": { - "start": { - "line": 17, - "column": 13 - }, - "end": { - "line": 17, - "column": 14 - } - }, + "start":493,"end":494,"loc":{"start":{"line":17,"column":13},"end":{"line":17,"column":14}}, "extra": { "rawValue": 2, "raw": "2" @@ -1943,18 +640,7 @@ }, { "type": "NumericLiteral", - "start": 496, - "end": 497, - "loc": { - "start": { - "line": 17, - "column": 16 - }, - "end": { - "line": 17, - "column": 17 - } - }, + "start":496,"end":497,"loc":{"start":{"line":17,"column":16},"end":{"line":17,"column":17}}, "extra": { "rawValue": 3, "raw": "3" @@ -1969,108 +655,29 @@ }, { "type": "VariableDeclaration", - "start": 500, - "end": 526, - "loc": { - "start": { - "line": 18, - "column": 0 - }, - "end": { - "line": 18, - "column": 26 - } - }, + "start":500,"end":526,"loc":{"start":{"line":18,"column":0},"end":{"line":18,"column":26}}, "declarations": [ { "type": "VariableDeclarator", - "start": 504, - "end": 525, - "loc": { - "start": { - "line": 18, - "column": 4 - }, - "end": { - "line": 18, - "column": 25 - } - }, + "start":504,"end":525,"loc":{"start":{"line":18,"column":4},"end":{"line":18,"column":25}}, "id": { "type": "Identifier", - "start": 504, - "end": 506, - "loc": { - "start": { - "line": 18, - "column": 4 - }, - "end": { - "line": 18, - "column": 6 - }, - "identifierName": "a6" - }, + "start":504,"end":506,"loc":{"start":{"line":18,"column":4},"end":{"line":18,"column":6},"identifierName":"a6"}, "name": "a6" }, "init": { "type": "TSAsExpression", - "start": 509, - "end": 525, - "loc": { - "start": { - "line": 18, - "column": 9 - }, - "end": { - "line": 18, - "column": 25 - } - }, + "start":509,"end":525,"loc":{"start":{"line":18,"column":9},"end":{"line":18,"column":25}}, "expression": { "type": "ArrayExpression", - "start": 509, - "end": 516, - "loc": { - "start": { - "line": 18, - "column": 9 - }, - "end": { - "line": 18, - "column": 16 - } - }, + "start":509,"end":516,"loc":{"start":{"line":18,"column":9},"end":{"line":18,"column":16}}, "elements": [ { "type": "SpreadElement", - "start": 510, - "end": 515, - "loc": { - "start": { - "line": 18, - "column": 10 - }, - "end": { - "line": 18, - "column": 15 - } - }, + "start":510,"end":515,"loc":{"start":{"line":18,"column":10},"end":{"line":18,"column":15}}, "argument": { "type": "Identifier", - "start": 513, - "end": 515, - "loc": { - "start": { - "line": 18, - "column": 13 - }, - "end": { - "line": 18, - "column": 15 - }, - "identifierName": "a5" - }, + "start":513,"end":515,"loc":{"start":{"line":18,"column":13},"end":{"line":18,"column":15},"identifierName":"a5"}, "name": "a5" } } @@ -2078,33 +685,10 @@ }, "typeAnnotation": { "type": "TSTypeReference", - "start": 520, - "end": 525, - "loc": { - "start": { - "line": 18, - "column": 20 - }, - "end": { - "line": 18, - "column": 25 - } - }, + "start":520,"end":525,"loc":{"start":{"line":18,"column":20},"end":{"line":18,"column":25}}, "typeName": { "type": "Identifier", - "start": 520, - "end": 525, - "loc": { - "start": { - "line": 18, - "column": 20 - }, - "end": { - "line": 18, - "column": 25 - }, - "identifierName": "const" - }, + "start":520,"end":525,"loc":{"start":{"line":18,"column":20},"end":{"line":18,"column":25},"identifierName":"const"}, "name": "const" } } @@ -2115,93 +699,26 @@ }, { "type": "VariableDeclaration", - "start": 527, - "end": 560, - "loc": { - "start": { - "line": 19, - "column": 0 - }, - "end": { - "line": 19, - "column": 33 - } - }, + "start":527,"end":560,"loc":{"start":{"line":19,"column":0},"end":{"line":19,"column":33}}, "declarations": [ { "type": "VariableDeclarator", - "start": 531, - "end": 559, - "loc": { - "start": { - "line": 19, - "column": 4 - }, - "end": { - "line": 19, - "column": 32 - } - }, + "start":531,"end":559,"loc":{"start":{"line":19,"column":4},"end":{"line":19,"column":32}}, "id": { "type": "Identifier", - "start": 531, - "end": 533, - "loc": { - "start": { - "line": 19, - "column": 4 - }, - "end": { - "line": 19, - "column": 6 - }, - "identifierName": "a8" - }, + "start":531,"end":533,"loc":{"start":{"line":19,"column":4},"end":{"line":19,"column":6},"identifierName":"a8"}, "name": "a8" }, "init": { "type": "TSAsExpression", - "start": 536, - "end": 559, - "loc": { - "start": { - "line": 19, - "column": 9 - }, - "end": { - "line": 19, - "column": 32 - } - }, + "start":536,"end":559,"loc":{"start":{"line":19,"column":9},"end":{"line":19,"column":32}}, "expression": { "type": "ArrayExpression", - "start": 536, - "end": 550, - "loc": { - "start": { - "line": 19, - "column": 9 - }, - "end": { - "line": 19, - "column": 23 - } - }, + "start":536,"end":550,"loc":{"start":{"line":19,"column":9},"end":{"line":19,"column":23}}, "elements": [ { "type": "StringLiteral", - "start": 537, - "end": 542, - "loc": { - "start": { - "line": 19, - "column": 10 - }, - "end": { - "line": 19, - "column": 15 - } - }, + "start":537,"end":542,"loc":{"start":{"line":19,"column":10},"end":{"line":19,"column":15}}, "extra": { "rawValue": "abc", "raw": "'abc'" @@ -2210,33 +727,10 @@ }, { "type": "SpreadElement", - "start": 544, - "end": 549, - "loc": { - "start": { - "line": 19, - "column": 17 - }, - "end": { - "line": 19, - "column": 22 - } - }, + "start":544,"end":549,"loc":{"start":{"line":19,"column":17},"end":{"line":19,"column":22}}, "argument": { "type": "Identifier", - "start": 547, - "end": 549, - "loc": { - "start": { - "line": 19, - "column": 20 - }, - "end": { - "line": 19, - "column": 22 - }, - "identifierName": "a7" - }, + "start":547,"end":549,"loc":{"start":{"line":19,"column":20},"end":{"line":19,"column":22},"identifierName":"a7"}, "name": "a7" } } @@ -2244,33 +738,10 @@ }, "typeAnnotation": { "type": "TSTypeReference", - "start": 554, - "end": 559, - "loc": { - "start": { - "line": 19, - "column": 27 - }, - "end": { - "line": 19, - "column": 32 - } - }, + "start":554,"end":559,"loc":{"start":{"line":19,"column":27},"end":{"line":19,"column":32}}, "typeName": { "type": "Identifier", - "start": 554, - "end": 559, - "loc": { - "start": { - "line": 19, - "column": 27 - }, - "end": { - "line": 19, - "column": 32 - }, - "identifierName": "const" - }, + "start":554,"end":559,"loc":{"start":{"line":19,"column":27},"end":{"line":19,"column":32},"identifierName":"const"}, "name": "const" } } @@ -2281,127 +752,37 @@ }, { "type": "VariableDeclaration", - "start": 562, - "end": 597, - "loc": { - "start": { - "line": 21, - "column": 0 - }, - "end": { - "line": 21, - "column": 35 - } - }, + "start":562,"end":597,"loc":{"start":{"line":21,"column":0},"end":{"line":21,"column":35}}, "declarations": [ { "type": "VariableDeclarator", - "start": 566, - "end": 596, - "loc": { - "start": { - "line": 21, - "column": 4 - }, - "end": { - "line": 21, - "column": 34 - } - }, + "start":566,"end":596,"loc":{"start":{"line":21,"column":4},"end":{"line":21,"column":34}}, "id": { "type": "Identifier", - "start": 566, - "end": 568, - "loc": { - "start": { - "line": 21, - "column": 4 - }, - "end": { - "line": 21, - "column": 6 - }, - "identifierName": "o1" - }, + "start":566,"end":568,"loc":{"start":{"line":21,"column":4},"end":{"line":21,"column":6},"identifierName":"o1"}, "name": "o1" }, "init": { "type": "TSAsExpression", - "start": 571, - "end": 596, - "loc": { - "start": { - "line": 21, - "column": 9 - }, - "end": { - "line": 21, - "column": 34 - } - }, + "start":571,"end":596,"loc":{"start":{"line":21,"column":9},"end":{"line":21,"column":34}}, "expression": { "type": "ObjectExpression", - "start": 571, - "end": 587, - "loc": { - "start": { - "line": 21, - "column": 9 - }, - "end": { - "line": 21, - "column": 25 - } - }, + "start":571,"end":587,"loc":{"start":{"line":21,"column":9},"end":{"line":21,"column":25}}, "properties": [ { "type": "ObjectProperty", - "start": 573, - "end": 578, - "loc": { - "start": { - "line": 21, - "column": 11 - }, - "end": { - "line": 21, - "column": 16 - } - }, + "start":573,"end":578,"loc":{"start":{"line":21,"column":11},"end":{"line":21,"column":16}}, "method": false, "key": { "type": "Identifier", - "start": 573, - "end": 574, - "loc": { - "start": { - "line": 21, - "column": 11 - }, - "end": { - "line": 21, - "column": 12 - }, - "identifierName": "x" - }, + "start":573,"end":574,"loc":{"start":{"line":21,"column":11},"end":{"line":21,"column":12},"identifierName":"x"}, "name": "x" }, "computed": false, "shorthand": false, "value": { "type": "NumericLiteral", - "start": 576, - "end": 578, - "loc": { - "start": { - "line": 21, - "column": 14 - }, - "end": { - "line": 21, - "column": 16 - } - }, + "start":576,"end":578,"loc":{"start":{"line":21,"column":14},"end":{"line":21,"column":16}}, "extra": { "rawValue": 10, "raw": "10" @@ -2411,52 +792,18 @@ }, { "type": "ObjectProperty", - "start": 580, - "end": 585, - "loc": { - "start": { - "line": 21, - "column": 18 - }, - "end": { - "line": 21, - "column": 23 - } - }, + "start":580,"end":585,"loc":{"start":{"line":21,"column":18},"end":{"line":21,"column":23}}, "method": false, "key": { "type": "Identifier", - "start": 580, - "end": 581, - "loc": { - "start": { - "line": 21, - "column": 18 - }, - "end": { - "line": 21, - "column": 19 - }, - "identifierName": "y" - }, + "start":580,"end":581,"loc":{"start":{"line":21,"column":18},"end":{"line":21,"column":19},"identifierName":"y"}, "name": "y" }, "computed": false, "shorthand": false, "value": { "type": "NumericLiteral", - "start": 583, - "end": 585, - "loc": { - "start": { - "line": 21, - "column": 21 - }, - "end": { - "line": 21, - "column": 23 - } - }, + "start":583,"end":585,"loc":{"start":{"line":21,"column":21},"end":{"line":21,"column":23}}, "extra": { "rawValue": 20, "raw": "20" @@ -2468,33 +815,10 @@ }, "typeAnnotation": { "type": "TSTypeReference", - "start": 591, - "end": 596, - "loc": { - "start": { - "line": 21, - "column": 29 - }, - "end": { - "line": 21, - "column": 34 - } - }, + "start":591,"end":596,"loc":{"start":{"line":21,"column":29},"end":{"line":21,"column":34}}, "typeName": { "type": "Identifier", - "start": 591, - "end": 596, - "loc": { - "start": { - "line": 21, - "column": 29 - }, - "end": { - "line": 21, - "column": 34 - }, - "identifierName": "const" - }, + "start":591,"end":596,"loc":{"start":{"line":21,"column":29},"end":{"line":21,"column":34},"identifierName":"const"}, "name": "const" } } @@ -2505,127 +829,37 @@ }, { "type": "VariableDeclaration", - "start": 598, - "end": 666, - "loc": { - "start": { - "line": 22, - "column": 0 - }, - "end": { - "line": 22, - "column": 68 - } - }, + "start":598,"end":666,"loc":{"start":{"line":22,"column":0},"end":{"line":22,"column":68}}, "declarations": [ { "type": "VariableDeclarator", - "start": 602, - "end": 665, - "loc": { - "start": { - "line": 22, - "column": 4 - }, - "end": { - "line": 22, - "column": 67 - } - }, + "start":602,"end":665,"loc":{"start":{"line":22,"column":4},"end":{"line":22,"column":67}}, "id": { "type": "Identifier", - "start": 602, - "end": 604, - "loc": { - "start": { - "line": 22, - "column": 4 - }, - "end": { - "line": 22, - "column": 6 - }, - "identifierName": "o2" - }, + "start":602,"end":604,"loc":{"start":{"line":22,"column":4},"end":{"line":22,"column":6},"identifierName":"o2"}, "name": "o2" }, "init": { "type": "TSAsExpression", - "start": 607, - "end": 665, - "loc": { - "start": { - "line": 22, - "column": 9 - }, - "end": { - "line": 22, - "column": 67 - } - }, + "start":607,"end":665,"loc":{"start":{"line":22,"column":9},"end":{"line":22,"column":67}}, "expression": { "type": "ObjectExpression", - "start": 607, - "end": 656, - "loc": { - "start": { - "line": 22, - "column": 9 - }, - "end": { - "line": 22, - "column": 58 - } - }, + "start":607,"end":656,"loc":{"start":{"line":22,"column":9},"end":{"line":22,"column":58}}, "properties": [ { "type": "ObjectProperty", - "start": 609, - "end": 613, - "loc": { - "start": { - "line": 22, - "column": 11 - }, - "end": { - "line": 22, - "column": 15 - } - }, + "start":609,"end":613,"loc":{"start":{"line":22,"column":11},"end":{"line":22,"column":15}}, "method": false, "key": { "type": "Identifier", - "start": 609, - "end": 610, - "loc": { - "start": { - "line": 22, - "column": 11 - }, - "end": { - "line": 22, - "column": 12 - }, - "identifierName": "a" - }, + "start":609,"end":610,"loc":{"start":{"line":22,"column":11},"end":{"line":22,"column":12},"identifierName":"a"}, "name": "a" }, "computed": false, "shorthand": false, "value": { "type": "NumericLiteral", - "start": 612, - "end": 613, - "loc": { - "start": { - "line": 22, - "column": 14 - }, - "end": { - "line": 22, - "column": 15 - } - }, + "start":612,"end":613,"loc":{"start":{"line":22,"column":14},"end":{"line":22,"column":15}}, "extra": { "rawValue": 1, "raw": "1" @@ -2635,33 +869,11 @@ }, { "type": "ObjectProperty", - "start": 615, - "end": 621, - "loc": { - "start": { - "line": 22, - "column": 17 - }, - "end": { - "line": 22, - "column": 23 - } - }, + "start":615,"end":621,"loc":{"start":{"line":22,"column":17},"end":{"line":22,"column":23}}, "method": false, "key": { "type": "StringLiteral", - "start": 615, - "end": 618, - "loc": { - "start": { - "line": 22, - "column": 17 - }, - "end": { - "line": 22, - "column": 20 - } - }, + "start":615,"end":618,"loc":{"start":{"line":22,"column":17},"end":{"line":22,"column":20}}, "extra": { "rawValue": "b", "raw": "'b'" @@ -2672,18 +884,7 @@ "shorthand": false, "value": { "type": "NumericLiteral", - "start": 620, - "end": 621, - "loc": { - "start": { - "line": 22, - "column": 22 - }, - "end": { - "line": 22, - "column": 23 - } - }, + "start":620,"end":621,"loc":{"start":{"line":22,"column":22},"end":{"line":22,"column":23}}, "extra": { "rawValue": 2, "raw": "2" @@ -2693,34 +894,12 @@ }, { "type": "ObjectProperty", - "start": 623, - "end": 631, - "loc": { - "start": { - "line": 22, - "column": 25 - }, - "end": { - "line": 22, - "column": 33 - } - }, + "start":623,"end":631,"loc":{"start":{"line":22,"column":25},"end":{"line":22,"column":33}}, "method": false, "computed": true, "key": { "type": "StringLiteral", - "start": 624, - "end": 627, - "loc": { - "start": { - "line": 22, - "column": 26 - }, - "end": { - "line": 22, - "column": 29 - } - }, + "start":624,"end":627,"loc":{"start":{"line":22,"column":26},"end":{"line":22,"column":29}}, "extra": { "rawValue": "c", "raw": "'c'" @@ -2730,18 +909,7 @@ "shorthand": false, "value": { "type": "NumericLiteral", - "start": 630, - "end": 631, - "loc": { - "start": { - "line": 22, - "column": 32 - }, - "end": { - "line": 22, - "column": 33 - } - }, + "start":630,"end":631,"loc":{"start":{"line":22,"column":32},"end":{"line":22,"column":33}}, "extra": { "rawValue": 3, "raw": "3" @@ -2751,34 +919,11 @@ }, { "type": "ObjectMethod", - "start": 633, - "end": 639, - "loc": { - "start": { - "line": 22, - "column": 35 - }, - "end": { - "line": 22, - "column": 41 - } - }, + "start":633,"end":639,"loc":{"start":{"line":22,"column":35},"end":{"line":22,"column":41}}, "method": true, "key": { "type": "Identifier", - "start": 633, - "end": 634, - "loc": { - "start": { - "line": 22, - "column": 35 - }, - "end": { - "line": 22, - "column": 36 - }, - "identifierName": "d" - }, + "start":633,"end":634,"loc":{"start":{"line":22,"column":35},"end":{"line":22,"column":36},"identifierName":"d"}, "name": "d" }, "computed": false, @@ -2789,66 +934,22 @@ "params": [], "body": { "type": "BlockStatement", - "start": 637, - "end": 639, - "loc": { - "start": { - "line": 22, - "column": 39 - }, - "end": { - "line": 22, - "column": 41 - } - }, + "start":637,"end":639,"loc":{"start":{"line":22,"column":39},"end":{"line":22,"column":41}}, "body": [], "directives": [] } }, { "type": "ObjectProperty", - "start": 641, - "end": 654, - "loc": { - "start": { - "line": 22, - "column": 43 - }, - "end": { - "line": 22, - "column": 56 - } - }, + "start":641,"end":654,"loc":{"start":{"line":22,"column":43},"end":{"line":22,"column":56}}, "method": false, "computed": true, "key": { "type": "BinaryExpression", - "start": 642, - "end": 650, - "loc": { - "start": { - "line": 22, - "column": 44 - }, - "end": { - "line": 22, - "column": 52 - } - }, + "start":642,"end":650,"loc":{"start":{"line":22,"column":44},"end":{"line":22,"column":52}}, "left": { "type": "StringLiteral", - "start": 642, - "end": 645, - "loc": { - "start": { - "line": 22, - "column": 44 - }, - "end": { - "line": 22, - "column": 47 - } - }, + "start":642,"end":645,"loc":{"start":{"line":22,"column":44},"end":{"line":22,"column":47}}, "extra": { "rawValue": "e", "raw": "'e'" @@ -2858,18 +959,7 @@ "operator": "+", "right": { "type": "StringLiteral", - "start": 648, - "end": 650, - "loc": { - "start": { - "line": 22, - "column": 50 - }, - "end": { - "line": 22, - "column": 52 - } - }, + "start":648,"end":650,"loc":{"start":{"line":22,"column":50},"end":{"line":22,"column":52}}, "extra": { "rawValue": "", "raw": "''" @@ -2880,18 +970,7 @@ "shorthand": false, "value": { "type": "NumericLiteral", - "start": 653, - "end": 654, - "loc": { - "start": { - "line": 22, - "column": 55 - }, - "end": { - "line": 22, - "column": 56 - } - }, + "start":653,"end":654,"loc":{"start":{"line":22,"column":55},"end":{"line":22,"column":56}}, "extra": { "rawValue": 4, "raw": "4" @@ -2903,33 +982,10 @@ }, "typeAnnotation": { "type": "TSTypeReference", - "start": 660, - "end": 665, - "loc": { - "start": { - "line": 22, - "column": 62 - }, - "end": { - "line": 22, - "column": 67 - } - }, + "start":660,"end":665,"loc":{"start":{"line":22,"column":62},"end":{"line":22,"column":67}}, "typeName": { "type": "Identifier", - "start": 660, - "end": 665, - "loc": { - "start": { - "line": 22, - "column": 62 - }, - "end": { - "line": 22, - "column": 67 - }, - "identifierName": "const" - }, + "start":660,"end":665,"loc":{"start":{"line":22,"column":62},"end":{"line":22,"column":67},"identifierName":"const"}, "name": "const" } } @@ -2940,140 +996,38 @@ }, { "type": "VariableDeclaration", - "start": 667, - "end": 702, - "loc": { - "start": { - "line": 23, - "column": 0 - }, - "end": { - "line": 23, - "column": 35 - } - }, + "start":667,"end":702,"loc":{"start":{"line":23,"column":0},"end":{"line":23,"column":35}}, "declarations": [ { "type": "VariableDeclarator", - "start": 671, - "end": 701, - "loc": { - "start": { - "line": 23, - "column": 4 - }, - "end": { - "line": 23, - "column": 34 - } - }, + "start":671,"end":701,"loc":{"start":{"line":23,"column":4},"end":{"line":23,"column":34}}, "id": { "type": "Identifier", - "start": 671, - "end": 673, - "loc": { - "start": { - "line": 23, - "column": 4 - }, - "end": { - "line": 23, - "column": 6 - }, - "identifierName": "o3" - }, + "start":671,"end":673,"loc":{"start":{"line":23,"column":4},"end":{"line":23,"column":6},"identifierName":"o3"}, "name": "o3" }, "init": { "type": "TSAsExpression", - "start": 676, - "end": 701, - "loc": { - "start": { - "line": 23, - "column": 9 - }, - "end": { - "line": 23, - "column": 34 - } - }, + "start":676,"end":701,"loc":{"start":{"line":23,"column":9},"end":{"line":23,"column":34}}, "expression": { "type": "ObjectExpression", - "start": 676, - "end": 692, - "loc": { - "start": { - "line": 23, - "column": 9 - }, - "end": { - "line": 23, - "column": 25 - } - }, + "start":676,"end":692,"loc":{"start":{"line":23,"column":9},"end":{"line":23,"column":25}}, "properties": [ { "type": "SpreadElement", - "start": 678, - "end": 683, - "loc": { - "start": { - "line": 23, - "column": 11 - }, - "end": { - "line": 23, - "column": 16 - } - }, + "start":678,"end":683,"loc":{"start":{"line":23,"column":11},"end":{"line":23,"column":16}}, "argument": { "type": "Identifier", - "start": 681, - "end": 683, - "loc": { - "start": { - "line": 23, - "column": 14 - }, - "end": { - "line": 23, - "column": 16 - }, - "identifierName": "o1" - }, + "start":681,"end":683,"loc":{"start":{"line":23,"column":14},"end":{"line":23,"column":16},"identifierName":"o1"}, "name": "o1" } }, { "type": "SpreadElement", - "start": 685, - "end": 690, - "loc": { - "start": { - "line": 23, - "column": 18 - }, - "end": { - "line": 23, - "column": 23 - } - }, + "start":685,"end":690,"loc":{"start":{"line":23,"column":18},"end":{"line":23,"column":23}}, "argument": { "type": "Identifier", - "start": 688, - "end": 690, - "loc": { - "start": { - "line": 23, - "column": 21 - }, - "end": { - "line": 23, - "column": 23 - }, - "identifierName": "o2" - }, + "start":688,"end":690,"loc":{"start":{"line":23,"column":21},"end":{"line":23,"column":23},"identifierName":"o2"}, "name": "o2" } } @@ -3081,33 +1035,10 @@ }, "typeAnnotation": { "type": "TSTypeReference", - "start": 696, - "end": 701, - "loc": { - "start": { - "line": 23, - "column": 29 - }, - "end": { - "line": 23, - "column": 34 - } - }, + "start":696,"end":701,"loc":{"start":{"line":23,"column":29},"end":{"line":23,"column":34}}, "typeName": { "type": "Identifier", - "start": 696, - "end": 701, - "loc": { - "start": { - "line": 23, - "column": 29 - }, - "end": { - "line": 23, - "column": 34 - }, - "identifierName": "const" - }, + "start":696,"end":701,"loc":{"start":{"line":23,"column":29},"end":{"line":23,"column":34},"identifierName":"const"}, "name": "const" } } @@ -3118,108 +1049,29 @@ }, { "type": "VariableDeclaration", - "start": 703, - "end": 731, - "loc": { - "start": { - "line": 24, - "column": 0 - }, - "end": { - "line": 24, - "column": 28 - } - }, + "start":703,"end":731,"loc":{"start":{"line":24,"column":0},"end":{"line":24,"column":28}}, "declarations": [ { "type": "VariableDeclarator", - "start": 707, - "end": 730, - "loc": { - "start": { - "line": 24, - "column": 4 - }, - "end": { - "line": 24, - "column": 27 - } - }, + "start":707,"end":730,"loc":{"start":{"line":24,"column":4},"end":{"line":24,"column":27}}, "id": { "type": "Identifier", - "start": 707, - "end": 709, - "loc": { - "start": { - "line": 24, - "column": 4 - }, - "end": { - "line": 24, - "column": 6 - }, - "identifierName": "o5" - }, + "start":707,"end":709,"loc":{"start":{"line":24,"column":4},"end":{"line":24,"column":6},"identifierName":"o5"}, "name": "o5" }, "init": { "type": "TSAsExpression", - "start": 712, - "end": 730, - "loc": { - "start": { - "line": 24, - "column": 9 - }, - "end": { - "line": 24, - "column": 27 - } - }, + "start":712,"end":730,"loc":{"start":{"line":24,"column":9},"end":{"line":24,"column":27}}, "expression": { "type": "ObjectExpression", - "start": 712, - "end": 721, - "loc": { - "start": { - "line": 24, - "column": 9 - }, - "end": { - "line": 24, - "column": 18 - } - }, + "start":712,"end":721,"loc":{"start":{"line":24,"column":9},"end":{"line":24,"column":18}}, "properties": [ { "type": "SpreadElement", - "start": 714, - "end": 719, - "loc": { - "start": { - "line": 24, - "column": 11 - }, - "end": { - "line": 24, - "column": 16 - } - }, + "start":714,"end":719,"loc":{"start":{"line":24,"column":11},"end":{"line":24,"column":16}}, "argument": { "type": "Identifier", - "start": 717, - "end": 719, - "loc": { - "start": { - "line": 24, - "column": 14 - }, - "end": { - "line": 24, - "column": 16 - }, - "identifierName": "o4" - }, + "start":717,"end":719,"loc":{"start":{"line":24,"column":14},"end":{"line":24,"column":16},"identifierName":"o4"}, "name": "o4" } } @@ -3227,33 +1079,10 @@ }, "typeAnnotation": { "type": "TSTypeReference", - "start": 725, - "end": 730, - "loc": { - "start": { - "line": 24, - "column": 22 - }, - "end": { - "line": 24, - "column": 27 - } - }, + "start":725,"end":730,"loc":{"start":{"line":24,"column":22},"end":{"line":24,"column":27}}, "typeName": { "type": "Identifier", - "start": 725, - "end": 730, - "loc": { - "start": { - "line": 24, - "column": 22 - }, - "end": { - "line": 24, - "column": 27 - }, - "identifierName": "const" - }, + "start":725,"end":730,"loc":{"start":{"line":24,"column":22},"end":{"line":24,"column":27},"identifierName":"const"}, "name": "const" } } @@ -3264,108 +1093,29 @@ }, { "type": "VariableDeclaration", - "start": 732, - "end": 759, - "loc": { - "start": { - "line": 25, - "column": 0 - }, - "end": { - "line": 25, - "column": 27 - } - }, + "start":732,"end":759,"loc":{"start":{"line":25,"column":0},"end":{"line":25,"column":27}}, "declarations": [ { "type": "VariableDeclarator", - "start": 736, - "end": 758, - "loc": { - "start": { - "line": 25, - "column": 4 - }, - "end": { - "line": 25, - "column": 26 - } - }, + "start":736,"end":758,"loc":{"start":{"line":25,"column":4},"end":{"line":25,"column":26}}, "id": { "type": "Identifier", - "start": 736, - "end": 738, - "loc": { - "start": { - "line": 25, - "column": 4 - }, - "end": { - "line": 25, - "column": 6 - }, - "identifierName": "o7" - }, + "start":736,"end":738,"loc":{"start":{"line":25,"column":4},"end":{"line":25,"column":6},"identifierName":"o7"}, "name": "o7" }, "init": { "type": "TSAsExpression", - "start": 741, - "end": 758, - "loc": { - "start": { - "line": 25, - "column": 9 - }, - "end": { - "line": 25, - "column": 26 - } - }, + "start":741,"end":758,"loc":{"start":{"line":25,"column":9},"end":{"line":25,"column":26}}, "expression": { "type": "ObjectExpression", - "start": 741, - "end": 749, - "loc": { - "start": { - "line": 25, - "column": 9 - }, - "end": { - "line": 25, - "column": 17 - } - }, + "start":741,"end":749,"loc":{"start":{"line":25,"column":9},"end":{"line":25,"column":17}}, "properties": [ { "type": "SpreadElement", - "start": 743, - "end": 747, - "loc": { - "start": { - "line": 25, - "column": 11 - }, - "end": { - "line": 25, - "column": 15 - } - }, + "start":743,"end":747,"loc":{"start":{"line":25,"column":11},"end":{"line":25,"column":15}}, "argument": { "type": "Identifier", - "start": 746, - "end": 747, - "loc": { - "start": { - "line": 25, - "column": 14 - }, - "end": { - "line": 25, - "column": 15 - }, - "identifierName": "d" - }, + "start":746,"end":747,"loc":{"start":{"line":25,"column":14},"end":{"line":25,"column":15},"identifierName":"d"}, "name": "d" } } @@ -3373,33 +1123,10 @@ }, "typeAnnotation": { "type": "TSTypeReference", - "start": 753, - "end": 758, - "loc": { - "start": { - "line": 25, - "column": 21 - }, - "end": { - "line": 25, - "column": 26 - } - }, + "start":753,"end":758,"loc":{"start":{"line":25,"column":21},"end":{"line":25,"column":26}}, "typeName": { "type": "Identifier", - "start": 753, - "end": 758, - "loc": { - "start": { - "line": 25, - "column": 21 - }, - "end": { - "line": 25, - "column": 26 - }, - "identifierName": "const" - }, + "start":753,"end":758,"loc":{"start":{"line":25,"column":21},"end":{"line":25,"column":26},"identifierName":"const"}, "name": "const" } } @@ -3410,127 +1137,37 @@ }, { "type": "VariableDeclaration", - "start": 760, - "end": 811, - "loc": { - "start": { - "line": 26, - "column": 0 - }, - "end": { - "line": 26, - "column": 51 - } - }, + "start":760,"end":811,"loc":{"start":{"line":26,"column":0},"end":{"line":26,"column":51}}, "declarations": [ { "type": "VariableDeclarator", - "start": 764, - "end": 810, - "loc": { - "start": { - "line": 26, - "column": 4 - }, - "end": { - "line": 26, - "column": 50 - } - }, + "start":764,"end":810,"loc":{"start":{"line":26,"column":4},"end":{"line":26,"column":50}}, "id": { "type": "Identifier", - "start": 764, - "end": 766, - "loc": { - "start": { - "line": 26, - "column": 4 - }, - "end": { - "line": 26, - "column": 6 - }, - "identifierName": "o9" - }, + "start":764,"end":766,"loc":{"start":{"line":26,"column":4},"end":{"line":26,"column":6},"identifierName":"o9"}, "name": "o9" }, "init": { "type": "TSAsExpression", - "start": 769, - "end": 810, - "loc": { - "start": { - "line": 26, - "column": 9 - }, - "end": { - "line": 26, - "column": 50 - } - }, + "start":769,"end":810,"loc":{"start":{"line":26,"column":9},"end":{"line":26,"column":50}}, "expression": { "type": "ObjectExpression", - "start": 769, - "end": 801, - "loc": { - "start": { - "line": 26, - "column": 9 - }, - "end": { - "line": 26, - "column": 41 - } - }, + "start":769,"end":801,"loc":{"start":{"line":26,"column":9},"end":{"line":26,"column":41}}, "properties": [ { "type": "ObjectProperty", - "start": 771, - "end": 776, - "loc": { - "start": { - "line": 26, - "column": 11 - }, - "end": { - "line": 26, - "column": 16 - } - }, + "start":771,"end":776,"loc":{"start":{"line":26,"column":11},"end":{"line":26,"column":16}}, "method": false, "key": { "type": "Identifier", - "start": 771, - "end": 772, - "loc": { - "start": { - "line": 26, - "column": 11 - }, - "end": { - "line": 26, - "column": 12 - }, - "identifierName": "x" - }, + "start":771,"end":772,"loc":{"start":{"line":26,"column":11},"end":{"line":26,"column":12},"identifierName":"x"}, "name": "x" }, "computed": false, "shorthand": false, "value": { "type": "NumericLiteral", - "start": 774, - "end": 776, - "loc": { - "start": { - "line": 26, - "column": 14 - }, - "end": { - "line": 26, - "column": 16 - } - }, + "start":774,"end":776,"loc":{"start":{"line":26,"column":14},"end":{"line":26,"column":16}}, "extra": { "rawValue": 10, "raw": "10" @@ -3540,34 +1177,11 @@ }, { "type": "ObjectMethod", - "start": 778, - "end": 799, - "loc": { - "start": { - "line": 26, - "column": 18 - }, - "end": { - "line": 26, - "column": 39 - } - }, + "start":778,"end":799,"loc":{"start":{"line":26,"column":18},"end":{"line":26,"column":39}}, "method": true, "key": { "type": "Identifier", - "start": 778, - "end": 781, - "loc": { - "start": { - "line": 26, - "column": 18 - }, - "end": { - "line": 26, - "column": 21 - }, - "identifierName": "foo" - }, + "start":778,"end":781,"loc":{"start":{"line":26,"column":18},"end":{"line":26,"column":21},"identifierName":"foo"}, "name": "foo" }, "computed": false, @@ -3578,110 +1192,32 @@ "params": [], "body": { "type": "BlockStatement", - "start": 784, - "end": 799, - "loc": { - "start": { - "line": 26, - "column": 24 - }, - "end": { - "line": 26, - "column": 39 - } - }, + "start":784,"end":799,"loc":{"start":{"line":26,"column":24},"end":{"line":26,"column":39}}, "body": [ { "type": "ExpressionStatement", - "start": 786, - "end": 797, - "loc": { - "start": { - "line": 26, - "column": 26 - }, - "end": { - "line": 26, - "column": 37 - } - }, + "start":786,"end":797,"loc":{"start":{"line":26,"column":26},"end":{"line":26,"column":37}}, "expression": { "type": "AssignmentExpression", - "start": 786, - "end": 797, - "loc": { - "start": { - "line": 26, - "column": 26 - }, - "end": { - "line": 26, - "column": 37 - } - }, + "start":786,"end":797,"loc":{"start":{"line":26,"column":26},"end":{"line":26,"column":37}}, "operator": "=", "left": { "type": "MemberExpression", - "start": 786, - "end": 792, - "loc": { - "start": { - "line": 26, - "column": 26 - }, - "end": { - "line": 26, - "column": 32 - } - }, + "start":786,"end":792,"loc":{"start":{"line":26,"column":26},"end":{"line":26,"column":32}}, "object": { "type": "ThisExpression", - "start": 786, - "end": 790, - "loc": { - "start": { - "line": 26, - "column": 26 - }, - "end": { - "line": 26, - "column": 30 - } - } + "start":786,"end":790,"loc":{"start":{"line":26,"column":26},"end":{"line":26,"column":30}} }, "property": { "type": "Identifier", - "start": 791, - "end": 792, - "loc": { - "start": { - "line": 26, - "column": 31 - }, - "end": { - "line": 26, - "column": 32 - }, - "identifierName": "x" - }, + "start":791,"end":792,"loc":{"start":{"line":26,"column":31},"end":{"line":26,"column":32},"identifierName":"x"}, "name": "x" }, "computed": false }, "right": { "type": "NumericLiteral", - "start": 795, - "end": 797, - "loc": { - "start": { - "line": 26, - "column": 35 - }, - "end": { - "line": 26, - "column": 37 - } - }, + "start":795,"end":797,"loc":{"start":{"line":26,"column":35},"end":{"line":26,"column":37}}, "extra": { "rawValue": 20, "raw": "20" @@ -3698,33 +1234,10 @@ }, "typeAnnotation": { "type": "TSTypeReference", - "start": 805, - "end": 810, - "loc": { - "start": { - "line": 26, - "column": 45 - }, - "end": { - "line": 26, - "column": 50 - } - }, + "start":805,"end":810,"loc":{"start":{"line":26,"column":45},"end":{"line":26,"column":50}}, "typeName": { "type": "Identifier", - "start": 805, - "end": 810, - "loc": { - "start": { - "line": 26, - "column": 45 - }, - "end": { - "line": 26, - "column": 50 - }, - "identifierName": "const" - }, + "start":805,"end":810,"loc":{"start":{"line":26,"column":45},"end":{"line":26,"column":50},"identifierName":"const"}, "name": "const" } } @@ -3736,95 +1249,28 @@ { "type": "CommentLine", "value": " Error", - "start": 813, - "end": 821, - "loc": { - "start": { - "line": 26, - "column": 53 - }, - "end": { - "line": 26, - "column": 61 - } - } + "start":813,"end":821,"loc":{"start":{"line":26,"column":53},"end":{"line":26,"column":61}} } ] }, { "type": "VariableDeclaration", - "start": 823, - "end": 846, - "loc": { - "start": { - "line": 28, - "column": 0 - }, - "end": { - "line": 28, - "column": 23 - } - }, + "start":823,"end":846,"loc":{"start":{"line":28,"column":0},"end":{"line":28,"column":23}}, "declarations": [ { "type": "VariableDeclarator", - "start": 827, - "end": 845, - "loc": { - "start": { - "line": 28, - "column": 4 - }, - "end": { - "line": 28, - "column": 22 - } - }, + "start":827,"end":845,"loc":{"start":{"line":28,"column":4},"end":{"line":28,"column":22}}, "id": { "type": "Identifier", - "start": 827, - "end": 829, - "loc": { - "start": { - "line": 28, - "column": 4 - }, - "end": { - "line": 28, - "column": 6 - }, - "identifierName": "p1" - }, + "start":827,"end":829,"loc":{"start":{"line":28,"column":4},"end":{"line":28,"column":6},"identifierName":"p1"}, "name": "p1" }, "init": { "type": "TSAsExpression", - "start": 832, - "end": 845, - "loc": { - "start": { - "line": 28, - "column": 9 - }, - "end": { - "line": 28, - "column": 22 - } - }, + "start":832,"end":845,"loc":{"start":{"line":28,"column":9},"end":{"line":28,"column":22}}, "expression": { "type": "NumericLiteral", - "start": 833, - "end": 835, - "loc": { - "start": { - "line": 28, - "column": 10 - }, - "end": { - "line": 28, - "column": 12 - } - }, + "start":833,"end":835,"loc":{"start":{"line":28,"column":10},"end":{"line":28,"column":12}}, "extra": { "rawValue": 10, "raw": "10", @@ -3835,33 +1281,10 @@ }, "typeAnnotation": { "type": "TSTypeReference", - "start": 840, - "end": 845, - "loc": { - "start": { - "line": 28, - "column": 17 - }, - "end": { - "line": 28, - "column": 22 - } - }, + "start":840,"end":845,"loc":{"start":{"line":28,"column":17},"end":{"line":28,"column":22}}, "typeName": { "type": "Identifier", - "start": 840, - "end": 845, - "loc": { - "start": { - "line": 28, - "column": 17 - }, - "end": { - "line": 28, - "column": 22 - }, - "identifierName": "const" - }, + "start":840,"end":845,"loc":{"start":{"line":28,"column":17},"end":{"line":28,"column":22},"identifierName":"const"}, "name": "const" } } @@ -3873,111 +1296,33 @@ { "type": "CommentLine", "value": " Error", - "start": 813, - "end": 821, - "loc": { - "start": { - "line": 26, - "column": 53 - }, - "end": { - "line": 26, - "column": 61 - } - } + "start":813,"end":821,"loc":{"start":{"line":26,"column":53},"end":{"line":26,"column":61}} } ] }, { "type": "VariableDeclaration", - "start": 847, - "end": 873, - "loc": { - "start": { - "line": 29, - "column": 0 - }, - "end": { - "line": 29, - "column": 26 - } - }, + "start":847,"end":873,"loc":{"start":{"line":29,"column":0},"end":{"line":29,"column":26}}, "declarations": [ { "type": "VariableDeclarator", - "start": 851, - "end": 872, - "loc": { - "start": { - "line": 29, - "column": 4 - }, - "end": { - "line": 29, - "column": 25 - } - }, + "start":851,"end":872,"loc":{"start":{"line":29,"column":4},"end":{"line":29,"column":25}}, "id": { "type": "Identifier", - "start": 851, - "end": 853, - "loc": { - "start": { - "line": 29, - "column": 4 - }, - "end": { - "line": 29, - "column": 6 - }, - "identifierName": "p2" - }, + "start":851,"end":853,"loc":{"start":{"line":29,"column":4},"end":{"line":29,"column":6},"identifierName":"p2"}, "name": "p2" }, "init": { "type": "TSAsExpression", - "start": 856, - "end": 872, - "loc": { - "start": { - "line": 29, - "column": 9 - }, - "end": { - "line": 29, - "column": 25 - } - }, + "start":856,"end":872,"loc":{"start":{"line":29,"column":9},"end":{"line":29,"column":25}}, "expression": { "type": "UnaryExpression", - "start": 858, - "end": 861, - "loc": { - "start": { - "line": 29, - "column": 11 - }, - "end": { - "line": 29, - "column": 14 - } - }, + "start":858,"end":861,"loc":{"start":{"line":29,"column":11},"end":{"line":29,"column":14}}, "operator": "-", "prefix": true, "argument": { "type": "NumericLiteral", - "start": 859, - "end": 861, - "loc": { - "start": { - "line": 29, - "column": 12 - }, - "end": { - "line": 29, - "column": 14 - } - }, + "start":859,"end":861,"loc":{"start":{"line":29,"column":12},"end":{"line":29,"column":14}}, "extra": { "rawValue": 10, "raw": "10" @@ -3991,33 +1336,10 @@ }, "typeAnnotation": { "type": "TSTypeReference", - "start": 867, - "end": 872, - "loc": { - "start": { - "line": 29, - "column": 20 - }, - "end": { - "line": 29, - "column": 25 - } - }, + "start":867,"end":872,"loc":{"start":{"line":29,"column":20},"end":{"line":29,"column":25}}, "typeName": { "type": "Identifier", - "start": 867, - "end": 872, - "loc": { - "start": { - "line": 29, - "column": 20 - }, - "end": { - "line": 29, - "column": 25 - }, - "identifierName": "const" - }, + "start":867,"end":872,"loc":{"start":{"line":29,"column":20},"end":{"line":29,"column":25},"identifierName":"const"}, "name": "const" } } @@ -4028,93 +1350,26 @@ }, { "type": "VariableDeclaration", - "start": 874, - "end": 901, - "loc": { - "start": { - "line": 30, - "column": 0 - }, - "end": { - "line": 30, - "column": 27 - } - }, + "start":874,"end":901,"loc":{"start":{"line":30,"column":0},"end":{"line":30,"column":27}}, "declarations": [ { "type": "VariableDeclarator", - "start": 878, - "end": 900, - "loc": { - "start": { - "line": 30, - "column": 4 - }, - "end": { - "line": 30, - "column": 26 - } - }, + "start":878,"end":900,"loc":{"start":{"line":30,"column":4},"end":{"line":30,"column":26}}, "id": { "type": "Identifier", - "start": 878, - "end": 880, - "loc": { - "start": { - "line": 30, - "column": 4 - }, - "end": { - "line": 30, - "column": 6 - }, - "identifierName": "p3" - }, + "start":878,"end":880,"loc":{"start":{"line":30,"column":4},"end":{"line":30,"column":6},"identifierName":"p3"}, "name": "p3" }, "init": { "type": "TSAsExpression", - "start": 883, - "end": 900, - "loc": { - "start": { - "line": 30, - "column": 9 - }, - "end": { - "line": 30, - "column": 26 - } - }, + "start":883,"end":900,"loc":{"start":{"line":30,"column":9},"end":{"line":30,"column":26}}, "expression": { "type": "ArrayExpression", - "start": 884, - "end": 890, - "loc": { - "start": { - "line": 30, - "column": 10 - }, - "end": { - "line": 30, - "column": 16 - } - }, + "start":884,"end":890,"loc":{"start":{"line":30,"column":10},"end":{"line":30,"column":16}}, "elements": [ { "type": "NumericLiteral", - "start": 886, - "end": 888, - "loc": { - "start": { - "line": 30, - "column": 12 - }, - "end": { - "line": 30, - "column": 14 - } - }, + "start":886,"end":888,"loc":{"start":{"line":30,"column":12},"end":{"line":30,"column":14}}, "extra": { "rawValue": 10, "raw": "10", @@ -4131,33 +1386,10 @@ }, "typeAnnotation": { "type": "TSTypeReference", - "start": 895, - "end": 900, - "loc": { - "start": { - "line": 30, - "column": 21 - }, - "end": { - "line": 30, - "column": 26 - } - }, + "start":895,"end":900,"loc":{"start":{"line":30,"column":21},"end":{"line":30,"column":26}}, "typeName": { "type": "Identifier", - "start": 895, - "end": 900, - "loc": { - "start": { - "line": 30, - "column": 21 - }, - "end": { - "line": 30, - "column": 26 - }, - "identifierName": "const" - }, + "start":895,"end":900,"loc":{"start":{"line":30,"column":21},"end":{"line":30,"column":26},"identifierName":"const"}, "name": "const" } } @@ -4168,138 +1400,38 @@ }, { "type": "VariableDeclaration", - "start": 902, - "end": 931, - "loc": { - "start": { - "line": 31, - "column": 0 - }, - "end": { - "line": 31, - "column": 29 - } - }, + "start":902,"end":931,"loc":{"start":{"line":31,"column":0},"end":{"line":31,"column":29}}, "declarations": [ { "type": "VariableDeclarator", - "start": 906, - "end": 930, - "loc": { - "start": { - "line": 31, - "column": 4 - }, - "end": { - "line": 31, - "column": 28 - } - }, + "start":906,"end":930,"loc":{"start":{"line":31,"column":4},"end":{"line":31,"column":28}}, "id": { "type": "Identifier", - "start": 906, - "end": 908, - "loc": { - "start": { - "line": 31, - "column": 4 - }, - "end": { - "line": 31, - "column": 6 - }, - "identifierName": "p4" - }, + "start":906,"end":908,"loc":{"start":{"line":31,"column":4},"end":{"line":31,"column":6},"identifierName":"p4"}, "name": "p4" }, "init": { "type": "TSAsExpression", - "start": 911, - "end": 930, - "loc": { - "start": { - "line": 31, - "column": 9 - }, - "end": { - "line": 31, - "column": 28 - } - }, + "start":911,"end":930,"loc":{"start":{"line":31,"column":9},"end":{"line":31,"column":28}}, "expression": { "type": "ArrayExpression", - "start": 911, - "end": 921, - "loc": { - "start": { - "line": 31, - "column": 9 - }, - "end": { - "line": 31, - "column": 19 - } - }, + "start":911,"end":921,"loc":{"start":{"line":31,"column":9},"end":{"line":31,"column":19}}, "elements": [ { "type": "ArrayExpression", - "start": 912, - "end": 920, - "loc": { - "start": { - "line": 31, - "column": 10 - }, - "end": { - "line": 31, - "column": 18 - } - }, + "start":912,"end":920,"loc":{"start":{"line":31,"column":10},"end":{"line":31,"column":18}}, "elements": [ { "type": "ArrayExpression", - "start": 913, - "end": 919, - "loc": { - "start": { - "line": 31, - "column": 11 - }, - "end": { - "line": 31, - "column": 17 - } - }, + "start":913,"end":919,"loc":{"start":{"line":31,"column":11},"end":{"line":31,"column":17}}, "elements": [ { "type": "ArrayExpression", - "start": 914, - "end": 918, - "loc": { - "start": { - "line": 31, - "column": 12 - }, - "end": { - "line": 31, - "column": 16 - } - }, + "start":914,"end":918,"loc":{"start":{"line":31,"column":12},"end":{"line":31,"column":16}}, "elements": [ { "type": "NumericLiteral", - "start": 915, - "end": 917, - "loc": { - "start": { - "line": 31, - "column": 13 - }, - "end": { - "line": 31, - "column": 15 - } - }, + "start":915,"end":917,"loc":{"start":{"line":31,"column":13},"end":{"line":31,"column":15}}, "extra": { "rawValue": 10, "raw": "10" @@ -4316,33 +1448,10 @@ }, "typeAnnotation": { "type": "TSTypeReference", - "start": 925, - "end": 930, - "loc": { - "start": { - "line": 31, - "column": 23 - }, - "end": { - "line": 31, - "column": 28 - } - }, + "start":925,"end":930,"loc":{"start":{"line":31,"column":23},"end":{"line":31,"column":28}}, "typeName": { "type": "Identifier", - "start": 925, - "end": 930, - "loc": { - "start": { - "line": 31, - "column": 23 - }, - "end": { - "line": 31, - "column": 28 - }, - "identifierName": "const" - }, + "start":925,"end":930,"loc":{"start":{"line":31,"column":23},"end":{"line":31,"column":28},"identifierName":"const"}, "name": "const" } } @@ -4353,127 +1462,37 @@ }, { "type": "VariableDeclaration", - "start": 933, - "end": 995, - "loc": { - "start": { - "line": 33, - "column": 0 - }, - "end": { - "line": 33, - "column": 62 - } - }, + "start":933,"end":995,"loc":{"start":{"line":33,"column":0},"end":{"line":33,"column":62}}, "declarations": [ { "type": "VariableDeclarator", - "start": 937, - "end": 994, - "loc": { - "start": { - "line": 33, - "column": 4 - }, - "end": { - "line": 33, - "column": 61 - } - }, + "start":937,"end":994,"loc":{"start":{"line":33,"column":4},"end":{"line":33,"column":61}}, "id": { "type": "Identifier", - "start": 937, - "end": 939, - "loc": { - "start": { - "line": 33, - "column": 4 - }, - "end": { - "line": 33, - "column": 6 - }, - "identifierName": "x1" - }, + "start":937,"end":939,"loc":{"start":{"line":33,"column":4},"end":{"line":33,"column":6},"identifierName":"x1"}, "name": "x1" }, "init": { "type": "TSAsExpression", - "start": 942, - "end": 994, - "loc": { - "start": { - "line": 33, - "column": 9 - }, - "end": { - "line": 33, - "column": 61 - } - }, + "start":942,"end":994,"loc":{"start":{"line":33,"column":9},"end":{"line":33,"column":61}}, "expression": { "type": "ObjectExpression", - "start": 942, - "end": 985, - "loc": { - "start": { - "line": 33, - "column": 9 - }, - "end": { - "line": 33, - "column": 52 - } - }, + "start":942,"end":985,"loc":{"start":{"line":33,"column":9},"end":{"line":33,"column":52}}, "properties": [ { "type": "ObjectProperty", - "start": 944, - "end": 949, - "loc": { - "start": { - "line": 33, - "column": 11 - }, - "end": { - "line": 33, - "column": 16 - } - }, + "start":944,"end":949,"loc":{"start":{"line":33,"column":11},"end":{"line":33,"column":16}}, "method": false, "key": { "type": "Identifier", - "start": 944, - "end": 945, - "loc": { - "start": { - "line": 33, - "column": 11 - }, - "end": { - "line": 33, - "column": 12 - }, - "identifierName": "x" - }, + "start":944,"end":945,"loc":{"start":{"line":33,"column":11},"end":{"line":33,"column":12},"identifierName":"x"}, "name": "x" }, "computed": false, "shorthand": false, "value": { "type": "NumericLiteral", - "start": 947, - "end": 949, - "loc": { - "start": { - "line": 33, - "column": 14 - }, - "end": { - "line": 33, - "column": 16 - } - }, + "start":947,"end":949,"loc":{"start":{"line":33,"column":14},"end":{"line":33,"column":16}}, "extra": { "rawValue": 10, "raw": "10" @@ -4483,67 +1502,22 @@ }, { "type": "ObjectProperty", - "start": 951, - "end": 962, - "loc": { - "start": { - "line": 33, - "column": 18 - }, - "end": { - "line": 33, - "column": 29 - } - }, + "start":951,"end":962,"loc":{"start":{"line":33,"column":18},"end":{"line":33,"column":29}}, "method": false, "key": { "type": "Identifier", - "start": 951, - "end": 952, - "loc": { - "start": { - "line": 33, - "column": 18 - }, - "end": { - "line": 33, - "column": 19 - }, - "identifierName": "y" - }, + "start":951,"end":952,"loc":{"start":{"line":33,"column":18},"end":{"line":33,"column":19},"identifierName":"y"}, "name": "y" }, "computed": false, "shorthand": false, "value": { "type": "ArrayExpression", - "start": 954, - "end": 962, - "loc": { - "start": { - "line": 33, - "column": 21 - }, - "end": { - "line": 33, - "column": 29 - } - }, + "start":954,"end":962,"loc":{"start":{"line":33,"column":21},"end":{"line":33,"column":29}}, "elements": [ { "type": "NumericLiteral", - "start": 955, - "end": 957, - "loc": { - "start": { - "line": 33, - "column": 22 - }, - "end": { - "line": 33, - "column": 24 - } - }, + "start":955,"end":957,"loc":{"start":{"line":33,"column":22},"end":{"line":33,"column":24}}, "extra": { "rawValue": 20, "raw": "20" @@ -4552,18 +1526,7 @@ }, { "type": "NumericLiteral", - "start": 959, - "end": 961, - "loc": { - "start": { - "line": 33, - "column": 26 - }, - "end": { - "line": 33, - "column": 28 - } - }, + "start":959,"end":961,"loc":{"start":{"line":33,"column":26},"end":{"line":33,"column":28}}, "extra": { "rawValue": 30, "raw": "30" @@ -4575,150 +1538,48 @@ }, { "type": "ObjectProperty", - "start": 964, - "end": 983, - "loc": { - "start": { - "line": 33, - "column": 31 - }, - "end": { - "line": 33, - "column": 50 - } - }, + "start":964,"end":983,"loc":{"start":{"line":33,"column":31},"end":{"line":33,"column":50}}, "method": false, "key": { "type": "Identifier", - "start": 964, - "end": 965, - "loc": { - "start": { - "line": 33, - "column": 31 - }, - "end": { - "line": 33, - "column": 32 - }, - "identifierName": "z" - }, + "start":964,"end":965,"loc":{"start":{"line":33,"column":31},"end":{"line":33,"column":32},"identifierName":"z"}, "name": "z" }, "computed": false, "shorthand": false, "value": { "type": "ObjectExpression", - "start": 967, - "end": 983, - "loc": { - "start": { - "line": 33, - "column": 34 - }, - "end": { - "line": 33, - "column": 50 - } - }, + "start":967,"end":983,"loc":{"start":{"line":33,"column":34},"end":{"line":33,"column":50}}, "properties": [ { "type": "ObjectProperty", - "start": 969, - "end": 981, - "loc": { - "start": { - "line": 33, - "column": 36 - }, - "end": { - "line": 33, - "column": 48 - } - }, + "start":969,"end":981,"loc":{"start":{"line":33,"column":36},"end":{"line":33,"column":48}}, "method": false, "key": { "type": "Identifier", - "start": 969, - "end": 970, - "loc": { - "start": { - "line": 33, - "column": 36 - }, - "end": { - "line": 33, - "column": 37 - }, - "identifierName": "a" - }, + "start":969,"end":970,"loc":{"start":{"line":33,"column":36},"end":{"line":33,"column":37},"identifierName":"a"}, "name": "a" }, "computed": false, "shorthand": false, "value": { "type": "ObjectExpression", - "start": 972, - "end": 981, - "loc": { - "start": { - "line": 33, - "column": 39 - }, - "end": { - "line": 33, - "column": 48 - } - }, + "start":972,"end":981,"loc":{"start":{"line":33,"column":39},"end":{"line":33,"column":48}}, "properties": [ { "type": "ObjectProperty", - "start": 974, - "end": 979, - "loc": { - "start": { - "line": 33, - "column": 41 - }, - "end": { - "line": 33, - "column": 46 - } - }, + "start":974,"end":979,"loc":{"start":{"line":33,"column":41},"end":{"line":33,"column":46}}, "method": false, "key": { "type": "Identifier", - "start": 974, - "end": 975, - "loc": { - "start": { - "line": 33, - "column": 41 - }, - "end": { - "line": 33, - "column": 42 - }, - "identifierName": "b" - }, + "start":974,"end":975,"loc":{"start":{"line":33,"column":41},"end":{"line":33,"column":42},"identifierName":"b"}, "name": "b" }, "computed": false, "shorthand": false, "value": { "type": "NumericLiteral", - "start": 977, - "end": 979, - "loc": { - "start": { - "line": 33, - "column": 44 - }, - "end": { - "line": 33, - "column": 46 - } - }, + "start":977,"end":979,"loc":{"start":{"line":33,"column":44},"end":{"line":33,"column":46}}, "extra": { "rawValue": 42, "raw": "42" @@ -4736,33 +1597,10 @@ }, "typeAnnotation": { "type": "TSTypeReference", - "start": 989, - "end": 994, - "loc": { - "start": { - "line": 33, - "column": 56 - }, - "end": { - "line": 33, - "column": 61 - } - }, + "start":989,"end":994,"loc":{"start":{"line":33,"column":56},"end":{"line":33,"column":61}}, "typeName": { "type": "Identifier", - "start": 989, - "end": 994, - "loc": { - "start": { - "line": 33, - "column": 56 - }, - "end": { - "line": 33, - "column": 61 - }, - "identifierName": "const" - }, + "start":989,"end":994,"loc":{"start":{"line":33,"column":56},"end":{"line":33,"column":61},"identifierName":"const"}, "name": "const" } } @@ -4773,110 +1611,31 @@ }, { "type": "VariableDeclaration", - "start": 997, - "end": 1017, - "loc": { - "start": { - "line": 35, - "column": 0 - }, - "end": { - "line": 35, - "column": 20 - } - }, + "start":997,"end":1017,"loc":{"start":{"line":35,"column":0},"end":{"line":35,"column":20}}, "declarations": [ { "type": "VariableDeclarator", - "start": 1001, - "end": 1016, - "loc": { - "start": { - "line": 35, - "column": 4 - }, - "end": { - "line": 35, - "column": 19 - } - }, + "start":1001,"end":1016,"loc":{"start":{"line":35,"column":4},"end":{"line":35,"column":19}}, "id": { "type": "Identifier", - "start": 1001, - "end": 1003, - "loc": { - "start": { - "line": 35, - "column": 4 - }, - "end": { - "line": 35, - "column": 6 - }, - "identifierName": "q1" - }, + "start":1001,"end":1003,"loc":{"start":{"line":35,"column":4},"end":{"line":35,"column":6},"identifierName":"q1"}, "name": "q1" }, "init": { "type": "TSTypeAssertion", - "start": 1006, - "end": 1016, - "loc": { - "start": { - "line": 35, - "column": 9 - }, - "end": { - "line": 35, - "column": 19 - } - }, + "start":1006,"end":1016,"loc":{"start":{"line":35,"column":9},"end":{"line":35,"column":19}}, "typeAnnotation": { "type": "TSTypeReference", - "start": 1007, - "end": 1012, - "loc": { - "start": { - "line": 35, - "column": 10 - }, - "end": { - "line": 35, - "column": 15 - } - }, + "start":1007,"end":1012,"loc":{"start":{"line":35,"column":10},"end":{"line":35,"column":15}}, "typeName": { "type": "Identifier", - "start": 1007, - "end": 1012, - "loc": { - "start": { - "line": 35, - "column": 10 - }, - "end": { - "line": 35, - "column": 15 - }, - "identifierName": "const" - }, + "start":1007,"end":1012,"loc":{"start":{"line":35,"column":10},"end":{"line":35,"column":15},"identifierName":"const"}, "name": "const" } }, "expression": { "type": "NumericLiteral", - "start": 1014, - "end": 1016, - "loc": { - "start": { - "line": 35, - "column": 17 - }, - "end": { - "line": 35, - "column": 19 - } - }, + "start":1014,"end":1016,"loc":{"start":{"line":35,"column":17},"end":{"line":35,"column":19}}, "extra": { "rawValue": 10, "raw": "10" @@ -4890,110 +1649,31 @@ }, { "type": "VariableDeclaration", - "start": 1018, - "end": 1041, - "loc": { - "start": { - "line": 36, - "column": 0 - }, - "end": { - "line": 36, - "column": 23 - } - }, + "start":1018,"end":1041,"loc":{"start":{"line":36,"column":0},"end":{"line":36,"column":23}}, "declarations": [ { "type": "VariableDeclarator", - "start": 1022, - "end": 1040, - "loc": { - "start": { - "line": 36, - "column": 4 - }, - "end": { - "line": 36, - "column": 22 - } - }, + "start":1022,"end":1040,"loc":{"start":{"line":36,"column":4},"end":{"line":36,"column":22}}, "id": { "type": "Identifier", - "start": 1022, - "end": 1024, - "loc": { - "start": { - "line": 36, - "column": 4 - }, - "end": { - "line": 36, - "column": 6 - }, - "identifierName": "q2" - }, + "start":1022,"end":1024,"loc":{"start":{"line":36,"column":4},"end":{"line":36,"column":6},"identifierName":"q2"}, "name": "q2" }, "init": { "type": "TSTypeAssertion", - "start": 1027, - "end": 1040, - "loc": { - "start": { - "line": 36, - "column": 9 - }, - "end": { - "line": 36, - "column": 22 - } - }, + "start":1027,"end":1040,"loc":{"start":{"line":36,"column":9},"end":{"line":36,"column":22}}, "typeAnnotation": { "type": "TSTypeReference", - "start": 1028, - "end": 1033, - "loc": { - "start": { - "line": 36, - "column": 10 - }, - "end": { - "line": 36, - "column": 15 - } - }, + "start":1028,"end":1033,"loc":{"start":{"line":36,"column":10},"end":{"line":36,"column":15}}, "typeName": { "type": "Identifier", - "start": 1028, - "end": 1033, - "loc": { - "start": { - "line": 36, - "column": 10 - }, - "end": { - "line": 36, - "column": 15 - }, - "identifierName": "const" - }, + "start":1028,"end":1033,"loc":{"start":{"line":36,"column":10},"end":{"line":36,"column":15},"identifierName":"const"}, "name": "const" } }, "expression": { "type": "StringLiteral", - "start": 1035, - "end": 1040, - "loc": { - "start": { - "line": 36, - "column": 17 - }, - "end": { - "line": 36, - "column": 22 - } - }, + "start":1035,"end":1040,"loc":{"start":{"line":36,"column":17},"end":{"line":36,"column":22}}, "extra": { "rawValue": "abc", "raw": "'abc'" @@ -5007,110 +1687,31 @@ }, { "type": "VariableDeclaration", - "start": 1042, - "end": 1064, - "loc": { - "start": { - "line": 37, - "column": 0 - }, - "end": { - "line": 37, - "column": 22 - } - }, + "start":1042,"end":1064,"loc":{"start":{"line":37,"column":0},"end":{"line":37,"column":22}}, "declarations": [ { "type": "VariableDeclarator", - "start": 1046, - "end": 1063, - "loc": { - "start": { - "line": 37, - "column": 4 - }, - "end": { - "line": 37, - "column": 21 - } - }, + "start":1046,"end":1063,"loc":{"start":{"line":37,"column":4},"end":{"line":37,"column":21}}, "id": { "type": "Identifier", - "start": 1046, - "end": 1048, - "loc": { - "start": { - "line": 37, - "column": 4 - }, - "end": { - "line": 37, - "column": 6 - }, - "identifierName": "q3" - }, + "start":1046,"end":1048,"loc":{"start":{"line":37,"column":4},"end":{"line":37,"column":6},"identifierName":"q3"}, "name": "q3" }, "init": { "type": "TSTypeAssertion", - "start": 1051, - "end": 1063, - "loc": { - "start": { - "line": 37, - "column": 9 - }, - "end": { - "line": 37, - "column": 21 - } - }, + "start":1051,"end":1063,"loc":{"start":{"line":37,"column":9},"end":{"line":37,"column":21}}, "typeAnnotation": { "type": "TSTypeReference", - "start": 1052, - "end": 1057, - "loc": { - "start": { - "line": 37, - "column": 10 - }, - "end": { - "line": 37, - "column": 15 - } - }, + "start":1052,"end":1057,"loc":{"start":{"line":37,"column":10},"end":{"line":37,"column":15}}, "typeName": { "type": "Identifier", - "start": 1052, - "end": 1057, - "loc": { - "start": { - "line": 37, - "column": 10 - }, - "end": { - "line": 37, - "column": 15 - }, - "identifierName": "const" - }, + "start":1052,"end":1057,"loc":{"start":{"line":37,"column":10},"end":{"line":37,"column":15},"identifierName":"const"}, "name": "const" } }, "expression": { "type": "BooleanLiteral", - "start": 1059, - "end": 1063, - "loc": { - "start": { - "line": 37, - "column": 17 - }, - "end": { - "line": 37, - "column": 21 - } - }, + "start":1059,"end":1063,"loc":{"start":{"line":37,"column":17},"end":{"line":37,"column":21}}, "value": true } } @@ -5120,125 +1721,35 @@ }, { "type": "VariableDeclaration", - "start": 1065, - "end": 1092, - "loc": { - "start": { - "line": 38, - "column": 0 - }, - "end": { - "line": 38, - "column": 27 - } - }, + "start":1065,"end":1092,"loc":{"start":{"line":38,"column":0},"end":{"line":38,"column":27}}, "declarations": [ { "type": "VariableDeclarator", - "start": 1069, - "end": 1091, - "loc": { - "start": { - "line": 38, - "column": 4 - }, - "end": { - "line": 38, - "column": 26 - } - }, + "start":1069,"end":1091,"loc":{"start":{"line":38,"column":4},"end":{"line":38,"column":26}}, "id": { "type": "Identifier", - "start": 1069, - "end": 1071, - "loc": { - "start": { - "line": 38, - "column": 4 - }, - "end": { - "line": 38, - "column": 6 - }, - "identifierName": "q4" - }, + "start":1069,"end":1071,"loc":{"start":{"line":38,"column":4},"end":{"line":38,"column":6},"identifierName":"q4"}, "name": "q4" }, "init": { "type": "TSTypeAssertion", - "start": 1074, - "end": 1091, - "loc": { - "start": { - "line": 38, - "column": 9 - }, - "end": { - "line": 38, - "column": 26 - } - }, + "start":1074,"end":1091,"loc":{"start":{"line":38,"column":9},"end":{"line":38,"column":26}}, "typeAnnotation": { "type": "TSTypeReference", - "start": 1075, - "end": 1080, - "loc": { - "start": { - "line": 38, - "column": 10 - }, - "end": { - "line": 38, - "column": 15 - } - }, + "start":1075,"end":1080,"loc":{"start":{"line":38,"column":10},"end":{"line":38,"column":15}}, "typeName": { "type": "Identifier", - "start": 1075, - "end": 1080, - "loc": { - "start": { - "line": 38, - "column": 10 - }, - "end": { - "line": 38, - "column": 15 - }, - "identifierName": "const" - }, + "start":1075,"end":1080,"loc":{"start":{"line":38,"column":10},"end":{"line":38,"column":15},"identifierName":"const"}, "name": "const" } }, "expression": { "type": "ArrayExpression", - "start": 1082, - "end": 1091, - "loc": { - "start": { - "line": 38, - "column": 17 - }, - "end": { - "line": 38, - "column": 26 - } - }, + "start":1082,"end":1091,"loc":{"start":{"line":38,"column":17},"end":{"line":38,"column":26}}, "elements": [ { "type": "NumericLiteral", - "start": 1083, - "end": 1084, - "loc": { - "start": { - "line": 38, - "column": 18 - }, - "end": { - "line": 38, - "column": 19 - } - }, + "start":1083,"end":1084,"loc":{"start":{"line":38,"column":18},"end":{"line":38,"column":19}}, "extra": { "rawValue": 1, "raw": "1" @@ -5247,18 +1758,7 @@ }, { "type": "NumericLiteral", - "start": 1086, - "end": 1087, - "loc": { - "start": { - "line": 38, - "column": 21 - }, - "end": { - "line": 38, - "column": 22 - } - }, + "start":1086,"end":1087,"loc":{"start":{"line":38,"column":21},"end":{"line":38,"column":22}}, "extra": { "rawValue": 2, "raw": "2" @@ -5267,18 +1767,7 @@ }, { "type": "NumericLiteral", - "start": 1089, - "end": 1090, - "loc": { - "start": { - "line": 38, - "column": 24 - }, - "end": { - "line": 38, - "column": 25 - } - }, + "start":1089,"end":1090,"loc":{"start":{"line":38,"column":24},"end":{"line":38,"column":25}}, "extra": { "rawValue": 3, "raw": "3" @@ -5294,159 +1783,46 @@ }, { "type": "VariableDeclaration", - "start": 1093, - "end": 1127, - "loc": { - "start": { - "line": 39, - "column": 0 - }, - "end": { - "line": 39, - "column": 34 - } - }, + "start":1093,"end":1127,"loc":{"start":{"line":39,"column":0},"end":{"line":39,"column":34}}, "declarations": [ { "type": "VariableDeclarator", - "start": 1097, - "end": 1126, - "loc": { - "start": { - "line": 39, - "column": 4 - }, - "end": { - "line": 39, - "column": 33 - } - }, + "start":1097,"end":1126,"loc":{"start":{"line":39,"column":4},"end":{"line":39,"column":33}}, "id": { "type": "Identifier", - "start": 1097, - "end": 1099, - "loc": { - "start": { - "line": 39, - "column": 4 - }, - "end": { - "line": 39, - "column": 6 - }, - "identifierName": "q5" - }, + "start":1097,"end":1099,"loc":{"start":{"line":39,"column":4},"end":{"line":39,"column":6},"identifierName":"q5"}, "name": "q5" }, "init": { "type": "TSTypeAssertion", - "start": 1102, - "end": 1126, - "loc": { - "start": { - "line": 39, - "column": 9 - }, - "end": { - "line": 39, - "column": 33 - } - }, + "start":1102,"end":1126,"loc":{"start":{"line":39,"column":9},"end":{"line":39,"column":33}}, "typeAnnotation": { "type": "TSTypeReference", - "start": 1103, - "end": 1108, - "loc": { - "start": { - "line": 39, - "column": 10 - }, - "end": { - "line": 39, - "column": 15 - } - }, + "start":1103,"end":1108,"loc":{"start":{"line":39,"column":10},"end":{"line":39,"column":15}}, "typeName": { "type": "Identifier", - "start": 1103, - "end": 1108, - "loc": { - "start": { - "line": 39, - "column": 10 - }, - "end": { - "line": 39, - "column": 15 - }, - "identifierName": "const" - }, + "start":1103,"end":1108,"loc":{"start":{"line":39,"column":10},"end":{"line":39,"column":15},"identifierName":"const"}, "name": "const" } }, "expression": { "type": "ObjectExpression", - "start": 1110, - "end": 1126, - "loc": { - "start": { - "line": 39, - "column": 17 - }, - "end": { - "line": 39, - "column": 33 - } - }, + "start":1110,"end":1126,"loc":{"start":{"line":39,"column":17},"end":{"line":39,"column":33}}, "properties": [ { "type": "ObjectProperty", - "start": 1112, - "end": 1117, - "loc": { - "start": { - "line": 39, - "column": 19 - }, - "end": { - "line": 39, - "column": 24 - } - }, + "start":1112,"end":1117,"loc":{"start":{"line":39,"column":19},"end":{"line":39,"column":24}}, "method": false, "key": { "type": "Identifier", - "start": 1112, - "end": 1113, - "loc": { - "start": { - "line": 39, - "column": 19 - }, - "end": { - "line": 39, - "column": 20 - }, - "identifierName": "x" - }, + "start":1112,"end":1113,"loc":{"start":{"line":39,"column":19},"end":{"line":39,"column":20},"identifierName":"x"}, "name": "x" }, "computed": false, "shorthand": false, "value": { "type": "NumericLiteral", - "start": 1115, - "end": 1117, - "loc": { - "start": { - "line": 39, - "column": 22 - }, - "end": { - "line": 39, - "column": 24 - } - }, + "start":1115,"end":1117,"loc":{"start":{"line":39,"column":22},"end":{"line":39,"column":24}}, "extra": { "rawValue": 10, "raw": "10" @@ -5456,52 +1832,18 @@ }, { "type": "ObjectProperty", - "start": 1119, - "end": 1124, - "loc": { - "start": { - "line": 39, - "column": 26 - }, - "end": { - "line": 39, - "column": 31 - } - }, + "start":1119,"end":1124,"loc":{"start":{"line":39,"column":26},"end":{"line":39,"column":31}}, "method": false, "key": { "type": "Identifier", - "start": 1119, - "end": 1120, - "loc": { - "start": { - "line": 39, - "column": 26 - }, - "end": { - "line": 39, - "column": 27 - }, - "identifierName": "y" - }, + "start":1119,"end":1120,"loc":{"start":{"line":39,"column":26},"end":{"line":39,"column":27},"identifierName":"y"}, "name": "y" }, "computed": false, "shorthand": false, "value": { "type": "NumericLiteral", - "start": 1122, - "end": 1124, - "loc": { - "start": { - "line": 39, - "column": 29 - }, - "end": { - "line": 39, - "column": 31 - } - }, + "start":1122,"end":1124,"loc":{"start":{"line":39,"column":29},"end":{"line":39,"column":31}}, "extra": { "rawValue": 20, "raw": "20" @@ -5523,50 +1865,17 @@ { "type": "CommentLine", "value": " Copied over from TypeScript's test case", - "start": 0, - "end": 42, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 42 - } - } + "start":0,"end":42,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":42}} }, { "type": "CommentLine", "value": " https://github.com/Microsoft/TypeScript/blob/master/tests/baselines/reference/constAssertions.js", - "start": 43, - "end": 142, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 99 - } - } + "start":43,"end":142,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":99}} }, { "type": "CommentLine", "value": " Error", - "start": 813, - "end": 821, - "loc": { - "start": { - "line": 26, - "column": 53 - }, - "end": { - "line": 26, - "column": 61 - } - } + "start":813,"end":821,"loc":{"start":{"line":26,"column":53},"end":{"line":26,"column":61}} } ] } \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/cast/as/output.json b/packages/babel-parser/test/fixtures/typescript/cast/as/output.json index a83b677640f6..3cba96e6515c 100644 --- a/packages/babel-parser/test/fixtures/typescript/cast/as/output.json +++ b/packages/babel-parser/test/fixtures/typescript/cast/as/output.json @@ -1,108 +1,29 @@ { "type": "File", - "start": 0, - "end": 106, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 14 - } - }, + "start":0,"end":106,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":14}}, "program": { "type": "Program", - "start": 0, - "end": 106, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 14 - } - }, + "start":0,"end":106,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":14}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "expression": { "type": "TSAsExpression", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "expression": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" }, "typeAnnotation": { "type": "TSTypeReference", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, "typeName": { "type": "Identifier", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "T" - }, + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"T"}, "name": "T" } } @@ -110,191 +31,56 @@ }, { "type": "ExpressionStatement", - "start": 8, - "end": 25, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 17 - } - }, + "start":8,"end":25,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":17}}, "expression": { "type": "TSAsExpression", - "start": 8, - "end": 24, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 16 - } - }, + "start":8,"end":24,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":16}}, "expression": { "type": "BinaryExpression", - "start": 8, - "end": 13, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 5 - } - }, + "start":8,"end":13,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":5}}, "left": { "type": "Identifier", - "start": 8, - "end": 9, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 1 - }, - "identifierName": "x" - }, + "start":8,"end":9,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":1},"identifierName":"x"}, "name": "x" }, "operator": "<", "right": { "type": "Identifier", - "start": 12, - "end": 13, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 5 - }, - "identifierName": "y" - }, + "start":12,"end":13,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":5},"identifierName":"y"}, "name": "y" } }, "typeAnnotation": { "type": "TSBooleanKeyword", - "start": 17, - "end": 24, - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 16 - } - } + "start":17,"end":24,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":16}} } }, "trailingComments": [ { "type": "CommentLine", "value": " (x < y) as boolean;", - "start": 26, - "end": 48, - "loc": { - "start": { - "line": 2, - "column": 18 - }, - "end": { - "line": 2, - "column": 40 - } - } + "start":26,"end":48,"loc":{"start":{"line":2,"column":18},"end":{"line":2,"column":40}} } ] }, { "type": "ExpressionStatement", - "start": 49, - "end": 67, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 18 - } - }, + "start":49,"end":67,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":18}}, "expression": { "type": "BinaryExpression", - "start": 49, - "end": 66, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 17 - } - }, + "start":49,"end":66,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":17}}, "left": { "type": "Identifier", - "start": 49, - "end": 50, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - }, - "identifierName": "x" - }, + "start":49,"end":50,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":1},"identifierName":"x"}, "name": "x" }, "operator": "===", "right": { "type": "TSAsExpression", - "start": 55, - "end": 66, - "loc": { - "start": { - "line": 3, - "column": 6 - }, - "end": { - "line": 3, - "column": 17 - } - }, + "start":55,"end":66,"loc":{"start":{"line":3,"column":6},"end":{"line":3,"column":17}}, "expression": { "type": "NumericLiteral", - "start": 55, - "end": 56, - "loc": { - "start": { - "line": 3, - "column": 6 - }, - "end": { - "line": 3, - "column": 7 - } - }, + "start":55,"end":56,"loc":{"start":{"line":3,"column":6},"end":{"line":3,"column":7}}, "extra": { "rawValue": 1, "raw": "1" @@ -303,18 +89,7 @@ }, "typeAnnotation": { "type": "TSNumberKeyword", - "start": 60, - "end": 66, - "loc": { - "start": { - "line": 3, - "column": 11 - }, - "end": { - "line": 3, - "column": 17 - } - } + "start":60,"end":66,"loc":{"start":{"line":3,"column":11},"end":{"line":3,"column":17}} } } }, @@ -322,143 +97,42 @@ { "type": "CommentLine", "value": " (x < y) as boolean;", - "start": 26, - "end": 48, - "loc": { - "start": { - "line": 2, - "column": 18 - }, - "end": { - "line": 2, - "column": 40 - } - } + "start":26,"end":48,"loc":{"start":{"line":2,"column":18},"end":{"line":2,"column":40}} } ], "trailingComments": [ { "type": "CommentLine", "value": " x === (1 as number);", - "start": 68, - "end": 91, - "loc": { - "start": { - "line": 3, - "column": 19 - }, - "end": { - "line": 3, - "column": 42 - } - } + "start":68,"end":91,"loc":{"start":{"line":3,"column":19},"end":{"line":3,"column":42}} } ] }, { "type": "ExpressionStatement", - "start": 92, - "end": 106, - "loc": { - "start": { - "line": 4, - "column": 0 - }, - "end": { - "line": 4, - "column": 14 - } - }, + "start":92,"end":106,"loc":{"start":{"line":4,"column":0},"end":{"line":4,"column":14}}, "expression": { "type": "TSAsExpression", - "start": 92, - "end": 105, - "loc": { - "start": { - "line": 4, - "column": 0 - }, - "end": { - "line": 4, - "column": 13 - } - }, + "start":92,"end":105,"loc":{"start":{"line":4,"column":0},"end":{"line":4,"column":13}}, "expression": { "type": "TSAsExpression", - "start": 92, - "end": 100, - "loc": { - "start": { - "line": 4, - "column": 0 - }, - "end": { - "line": 4, - "column": 8 - } - }, + "start":92,"end":100,"loc":{"start":{"line":4,"column":0},"end":{"line":4,"column":8}}, "expression": { "type": "Identifier", - "start": 92, - "end": 93, - "loc": { - "start": { - "line": 4, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - }, - "identifierName": "x" - }, + "start":92,"end":93,"loc":{"start":{"line":4,"column":0},"end":{"line":4,"column":1},"identifierName":"x"}, "name": "x" }, "typeAnnotation": { "type": "TSAnyKeyword", - "start": 97, - "end": 100, - "loc": { - "start": { - "line": 4, - "column": 5 - }, - "end": { - "line": 4, - "column": 8 - } - } + "start":97,"end":100,"loc":{"start":{"line":4,"column":5},"end":{"line":4,"column":8}} } }, "typeAnnotation": { "type": "TSTypeReference", - "start": 104, - "end": 105, - "loc": { - "start": { - "line": 4, - "column": 12 - }, - "end": { - "line": 4, - "column": 13 - } - }, + "start":104,"end":105,"loc":{"start":{"line":4,"column":12},"end":{"line":4,"column":13}}, "typeName": { "type": "Identifier", - "start": 104, - "end": 105, - "loc": { - "start": { - "line": 4, - "column": 12 - }, - "end": { - "line": 4, - "column": 13 - }, - "identifierName": "T" - }, + "start":104,"end":105,"loc":{"start":{"line":4,"column":12},"end":{"line":4,"column":13},"identifierName":"T"}, "name": "T" } } @@ -467,18 +141,7 @@ { "type": "CommentLine", "value": " x === (1 as number);", - "start": 68, - "end": 91, - "loc": { - "start": { - "line": 3, - "column": 19 - }, - "end": { - "line": 3, - "column": 42 - } - } + "start":68,"end":91,"loc":{"start":{"line":3,"column":19},"end":{"line":3,"column":42}} } ] } @@ -489,34 +152,12 @@ { "type": "CommentLine", "value": " (x < y) as boolean;", - "start": 26, - "end": 48, - "loc": { - "start": { - "line": 2, - "column": 18 - }, - "end": { - "line": 2, - "column": 40 - } - } + "start":26,"end":48,"loc":{"start":{"line":2,"column":18},"end":{"line":2,"column":40}} }, { "type": "CommentLine", "value": " x === (1 as number);", - "start": 68, - "end": 91, - "loc": { - "start": { - "line": 3, - "column": 19 - }, - "end": { - "line": 3, - "column": 42 - } - } + "start":68,"end":91,"loc":{"start":{"line":3,"column":19},"end":{"line":3,"column":42}} } ] } \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/cast/assert-and-assign/output.json b/packages/babel-parser/test/fixtures/typescript/cast/assert-and-assign/output.json index f07df1678fb0..bc0f97cffd33 100644 --- a/packages/babel-parser/test/fixtures/typescript/cast/assert-and-assign/output.json +++ b/packages/babel-parser/test/fixtures/typescript/cast/assert-and-assign/output.json @@ -1,108 +1,30 @@ { "type": "File", - "start": 0, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, "program": { "type": "Program", - "start": 0, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, "expression": { "type": "AssignmentExpression", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, "operator": "=", "left": { "type": "TSAsExpression", - "start": 1, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":1,"end":12,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":12}}, "expression": { "type": "Identifier", - "start": 1, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - }, - "identifierName": "a" - }, + "start":1,"end":2,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":2},"identifierName":"a"}, "name": "a" }, "typeAnnotation": { "type": "TSNumberKeyword", - "start": 6, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 12 - } - } + "start":6,"end":12,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":12}} }, "extra": { "parenthesized": true, @@ -111,18 +33,7 @@ }, "right": { "type": "NumericLiteral", - "start": 16, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":16,"end":18,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":18}}, "extra": { "rawValue": 42, "raw": "42" diff --git a/packages/babel-parser/test/fixtures/typescript/cast/destructure-and-assign/input.ts b/packages/babel-parser/test/fixtures/typescript/cast/destructure-and-assign/input.ts new file mode 100644 index 000000000000..ece9096fb9f6 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/cast/destructure-and-assign/input.ts @@ -0,0 +1,2 @@ +[a as number] = [42]; +[a] = [42]; diff --git a/packages/babel-parser/test/fixtures/typescript/cast/destructure-and-assign/output.json b/packages/babel-parser/test/fixtures/typescript/cast/destructure-and-assign/output.json new file mode 100644 index 000000000000..de6f9dbe8982 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/cast/destructure-and-assign/output.json @@ -0,0 +1,91 @@ +{ + "type": "File", + "start":0,"end":41,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":19}}, + "program": { + "type": "Program", + "start":0,"end":41,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":19}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, + "expression": { + "type": "AssignmentExpression", + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, + "operator": "=", + "left": { + "type": "ArrayPattern", + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "elements": [ + { + "type": "Identifier", + "start":1,"end":12,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":12},"identifierName":"a"}, + "name": "a", + "typeAnnotation": { + "type": "TSNumberKeyword", + "start":6,"end":12,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":12}} + } + } + ] + }, + "right": { + "type": "ArrayExpression", + "start":16,"end":20,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":20}}, + "elements": [ + { + "type": "NumericLiteral", + "start":17,"end":19,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":19}}, + "extra": { + "rawValue": 42, + "raw": "42" + }, + "value": 42 + } + ] + } + } + }, + { + "type": "ExpressionStatement", + "start":22,"end":41,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":19}}, + "expression": { + "type": "AssignmentExpression", + "start":22,"end":40,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":18}}, + "operator": "=", + "left": { + "type": "ArrayPattern", + "start":22,"end":33,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":11}}, + "elements": [ + { + "type": "Identifier", + "start":31,"end":30,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":8},"identifierName":"a"}, + "name": "a", + "typeAnnotation": { + "type": "TSNumberKeyword", + "start":24,"end":30,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":8}} + } + } + ] + }, + "right": { + "type": "ArrayExpression", + "start":36,"end":40,"loc":{"start":{"line":2,"column":14},"end":{"line":2,"column":18}}, + "elements": [ + { + "type": "NumericLiteral", + "start":37,"end":39,"loc":{"start":{"line":2,"column":15},"end":{"line":2,"column":17}}, + "extra": { + "rawValue": 42, + "raw": "42" + }, + "value": 42 + } + ] + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/cast/false-positive/output.json b/packages/babel-parser/test/fixtures/typescript/cast/false-positive/output.json index c7b5f885f22a..5a327e4f420b 100644 --- a/packages/babel-parser/test/fixtures/typescript/cast/false-positive/output.json +++ b/packages/babel-parser/test/fixtures/typescript/cast/false-positive/output.json @@ -1,126 +1,36 @@ { "type": "File", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "program": { "type": "Program", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "expression": { "type": "CallExpression", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "callee": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "f" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"f"}, "name": "f" }, "arguments": [ { "type": "BinaryExpression", - "start": 2, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":2,"end":7,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":7}}, "left": { "type": "Identifier", - "start": 2, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 3 - }, - "identifierName": "x" - }, + "start":2,"end":3,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":3},"identifierName":"x"}, "name": "x" }, "operator": "<", "right": { "type": "NumericLiteral", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7}}, "extra": { "rawValue": 0, "raw": "0" @@ -130,18 +40,7 @@ }, { "type": "RegExpLiteral", - "start": 9, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":9,"end":12,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":12}}, "extra": { "raw": "/a/" }, diff --git a/packages/babel-parser/test/fixtures/typescript/cast/multiple-assert-and-assign/output.json b/packages/babel-parser/test/fixtures/typescript/cast/multiple-assert-and-assign/output.json index 5c3f1fe6b4a6..cbd35d32f71d 100644 --- a/packages/babel-parser/test/fixtures/typescript/cast/multiple-assert-and-assign/output.json +++ b/packages/babel-parser/test/fixtures/typescript/cast/multiple-assert-and-assign/output.json @@ -1,138 +1,38 @@ { "type": "File", - "start": 0, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, "program": { "type": "Program", - "start": 0, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, "expression": { "type": "AssignmentExpression", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, "operator": "=", "left": { "type": "TSAsExpression", - "start": 1, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":1,"end":19,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":19}}, "expression": { "type": "TSAsExpression", - "start": 1, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":1,"end":12,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":12}}, "expression": { "type": "Identifier", - "start": 1, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - }, - "identifierName": "a" - }, + "start":1,"end":2,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":2},"identifierName":"a"}, "name": "a" }, "typeAnnotation": { "type": "TSNumberKeyword", - "start": 6, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 12 - } - } + "start":6,"end":12,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":12}} } }, "typeAnnotation": { "type": "TSAnyKeyword", - "start": 16, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 19 - } - } + "start":16,"end":19,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":19}} }, "extra": { "parenthesized": true, @@ -141,18 +41,7 @@ }, "right": { "type": "NumericLiteral", - "start": 23, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":23,"end":25,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":25}}, "extra": { "rawValue": 42, "raw": "42" diff --git a/packages/babel-parser/test/fixtures/typescript/cast/need-parentheses/output.json b/packages/babel-parser/test/fixtures/typescript/cast/need-parentheses/output.json index bb02e0d6956a..06c4c0109b08 100644 --- a/packages/babel-parser/test/fixtures/typescript/cast/need-parentheses/output.json +++ b/packages/babel-parser/test/fixtures/typescript/cast/need-parentheses/output.json @@ -1,123 +1,33 @@ { "type": "File", - "start": 0, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 5 - } - }, + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":5}}, "program": { "type": "Program", - "start": 0, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 5 - } - }, + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":5}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, "expression": { "type": "MemberExpression", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "object": { "type": "TSTypeAssertion", - "start": 1, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":1,"end":6,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":6}}, "typeAnnotation": { "type": "TSTypeReference", - "start": 2, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 3 - } - }, + "start":2,"end":3,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":3}}, "typeName": { "type": "Identifier", - "start": 2, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 3 - }, - "identifierName": "T" - }, + "start":2,"end":3,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":3},"identifierName":"T"}, "name": "T" } }, "expression": { "type": "Identifier", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "x" - }, + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"x"}, "name": "x" }, "extra": { @@ -127,19 +37,7 @@ }, "property": { "type": "Identifier", - "start": 8, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "y" - }, + "start":8,"end":9,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":9},"identifierName":"y"}, "name": "y" }, "computed": false @@ -147,92 +45,24 @@ }, { "type": "ExpressionStatement", - "start": 11, - "end": 22, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 11 - } - }, + "start":11,"end":22,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":11}}, "expression": { "type": "MemberExpression", - "start": 11, - "end": 21, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 10 - } - }, + "start":11,"end":21,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":10}}, "object": { "type": "TSAsExpression", - "start": 12, - "end": 18, - "loc": { - "start": { - "line": 2, - "column": 1 - }, - "end": { - "line": 2, - "column": 7 - } - }, + "start":12,"end":18,"loc":{"start":{"line":2,"column":1},"end":{"line":2,"column":7}}, "expression": { "type": "Identifier", - "start": 12, - "end": 13, - "loc": { - "start": { - "line": 2, - "column": 1 - }, - "end": { - "line": 2, - "column": 2 - }, - "identifierName": "x" - }, + "start":12,"end":13,"loc":{"start":{"line":2,"column":1},"end":{"line":2,"column":2},"identifierName":"x"}, "name": "x" }, "typeAnnotation": { "type": "TSTypeReference", - "start": 17, - "end": 18, - "loc": { - "start": { - "line": 2, - "column": 6 - }, - "end": { - "line": 2, - "column": 7 - } - }, + "start":17,"end":18,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":7}}, "typeName": { "type": "Identifier", - "start": 17, - "end": 18, - "loc": { - "start": { - "line": 2, - "column": 6 - }, - "end": { - "line": 2, - "column": 7 - }, - "identifierName": "T" - }, + "start":17,"end":18,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":7},"identifierName":"T"}, "name": "T" } }, @@ -243,19 +73,7 @@ }, "property": { "type": "Identifier", - "start": 20, - "end": 21, - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 10 - }, - "identifierName": "y" - }, + "start":20,"end":21,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":10},"identifierName":"y"}, "name": "y" }, "computed": false @@ -263,79 +81,22 @@ }, { "type": "ExpressionStatement", - "start": 23, - "end": 28, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 5 - } - }, + "start":23,"end":28,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":5}}, "expression": { "type": "MemberExpression", - "start": 23, - "end": 27, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 4 - } - }, + "start":23,"end":27,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":4}}, "object": { "type": "TSNonNullExpression", - "start": 23, - "end": 25, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 2 - } - }, + "start":23,"end":25,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":2}}, "expression": { "type": "Identifier", - "start": 23, - "end": 24, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - }, - "identifierName": "x" - }, + "start":23,"end":24,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":1},"identifierName":"x"}, "name": "x" } }, "property": { "type": "Identifier", - "start": 26, - "end": 27, - "loc": { - "start": { - "line": 3, - "column": 3 - }, - "end": { - "line": 3, - "column": 4 - }, - "identifierName": "y" - }, + "start":26,"end":27,"loc":{"start":{"line":3,"column":3},"end":{"line":3,"column":4},"identifierName":"y"}, "name": "y" }, "computed": false diff --git a/packages/babel-parser/test/fixtures/typescript/cast/null-assertion-2/output.json b/packages/babel-parser/test/fixtures/typescript/cast/null-assertion-2/output.json index 66c8f18d05f2..564c221f8e72 100644 --- a/packages/babel-parser/test/fixtures/typescript/cast/null-assertion-2/output.json +++ b/packages/babel-parser/test/fixtures/typescript/cast/null-assertion-2/output.json @@ -1,109 +1,31 @@ { "type": "File", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "program": { "type": "Program", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "expression": { "type": "BinaryExpression", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "left": { "type": "TSNonNullExpression", - "start": 0, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 2 - } - }, + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}}, "expression": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" } }, "operator": "/", "right": { "type": "NumericLiteral", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, "extra": { "rawValue": 2, "raw": "2" diff --git a/packages/babel-parser/test/fixtures/typescript/cast/null-assertion-3/output.json b/packages/babel-parser/test/fixtures/typescript/cast/null-assertion-3/output.json index 1cbff7954979..d8c1cd3047ce 100644 --- a/packages/babel-parser/test/fixtures/typescript/cast/null-assertion-3/output.json +++ b/packages/babel-parser/test/fixtures/typescript/cast/null-assertion-3/output.json @@ -1,123 +1,33 @@ { "type": "File", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "program": { "type": "Program", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "declarations": [ { "type": "VariableDeclarator", - "start": 6, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":6,"end":16,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":16}}, "id": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "x" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"x"}, "name": "x" }, "init": { "type": "TSNonNullExpression", - "start": 10, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":10,"end":16,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":16}}, "expression": { "type": "CallExpression", - "start": 10, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":10,"end":15,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":15}}, "callee": { "type": "Identifier", - "start": 10, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 13 - }, - "identifierName": "foo" - }, + "start":10,"end":13,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":13},"identifierName":"foo"}, "name": "foo" }, "arguments": [] diff --git a/packages/babel-parser/test/fixtures/typescript/cast/null-assertion-and-assign-2/output.json b/packages/babel-parser/test/fixtures/typescript/cast/null-assertion-and-assign-2/output.json index c783913599ca..9e5a3057ec2c 100644 --- a/packages/babel-parser/test/fixtures/typescript/cast/null-assertion-and-assign-2/output.json +++ b/packages/babel-parser/test/fixtures/typescript/cast/null-assertion-and-assign-2/output.json @@ -1,109 +1,31 @@ { "type": "File", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "program": { "type": "Program", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "expression": { "type": "AssignmentExpression", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "operator": "*=", "left": { "type": "TSNonNullExpression", - "start": 0, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 2 - } - }, + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}}, "expression": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" } }, "right": { "type": "NumericLiteral", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7}}, "extra": { "rawValue": 1, "raw": "1" diff --git a/packages/babel-parser/test/fixtures/typescript/cast/null-assertion-and-assign/output.json b/packages/babel-parser/test/fixtures/typescript/cast/null-assertion-and-assign/output.json index 4f8a2a548b75..820cc00e77ec 100644 --- a/packages/babel-parser/test/fixtures/typescript/cast/null-assertion-and-assign/output.json +++ b/packages/babel-parser/test/fixtures/typescript/cast/null-assertion-and-assign/output.json @@ -1,109 +1,31 @@ { "type": "File", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, "program": { "type": "Program", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, "expression": { "type": "AssignmentExpression", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "operator": "+=", "left": { "type": "TSNonNullExpression", - "start": 0, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 2 - } - }, + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}}, "expression": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" } }, "right": { "type": "NumericLiteral", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7}}, "extra": { "rawValue": 1, "raw": "1" diff --git a/packages/babel-parser/test/fixtures/typescript/cast/null-assertion-false-positive/output.json b/packages/babel-parser/test/fixtures/typescript/cast/null-assertion-false-positive/output.json index 9e08ab2e65b7..69f2748151e5 100644 --- a/packages/babel-parser/test/fixtures/typescript/cast/null-assertion-false-positive/output.json +++ b/packages/babel-parser/test/fixtures/typescript/cast/null-assertion-false-positive/output.json @@ -1,111 +1,32 @@ { "type": "File", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 2 - } - }, + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":2}}, "program": { "type": "Program", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 2 - } - }, + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":2}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1}}, "expression": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "a" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"a"}, "name": "a" } }, { "type": "ExpressionStatement", - "start": 2, - "end": 4, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 2 - } - }, + "start":2,"end":4,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":2}}, "expression": { "type": "UnaryExpression", - "start": 2, - "end": 4, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 2 - } - }, + "start":2,"end":4,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":2}}, "operator": "!", "prefix": true, "argument": { "type": "Identifier", - "start": 3, - "end": 4, - "loc": { - "start": { - "line": 2, - "column": 1 - }, - "end": { - "line": 2, - "column": 2 - }, - "identifierName": "b" - }, + "start":3,"end":4,"loc":{"start":{"line":2,"column":1},"end":{"line":2,"column":2},"identifierName":"b"}, "name": "b" } } diff --git a/packages/babel-parser/test/fixtures/typescript/cast/null-assertion-then-property-access/output.json b/packages/babel-parser/test/fixtures/typescript/cast/null-assertion-then-property-access/output.json index 19ec66b99e8f..4f00ec5ea154 100644 --- a/packages/babel-parser/test/fixtures/typescript/cast/null-assertion-then-property-access/output.json +++ b/packages/babel-parser/test/fixtures/typescript/cast/null-assertion-then-property-access/output.json @@ -1,109 +1,30 @@ { "type": "File", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "program": { "type": "Program", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "expression": { "type": "MemberExpression", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - }, + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, "object": { "type": "TSNonNullExpression", - "start": 0, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 2 - } - }, + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}}, "expression": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" } }, "property": { "type": "Identifier", - "start": 3, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 4 - }, - "identifierName": "y" - }, + "start":3,"end":4,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":4},"identifierName":"y"}, "name": "y" }, "computed": false diff --git a/packages/babel-parser/test/fixtures/typescript/cast/null-assertion/output.json b/packages/babel-parser/test/fixtures/typescript/cast/null-assertion/output.json index 093a065ec05e..893ffd407fc5 100644 --- a/packages/babel-parser/test/fixtures/typescript/cast/null-assertion/output.json +++ b/packages/babel-parser/test/fixtures/typescript/cast/null-assertion/output.json @@ -1,77 +1,21 @@ { "type": "File", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, "program": { "type": "Program", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, "expression": { "type": "TSNonNullExpression", - "start": 0, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 2 - } - }, + "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}}, "expression": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "x" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" } } diff --git a/packages/babel-parser/test/fixtures/typescript/cast/parameter-typecast/input.ts b/packages/babel-parser/test/fixtures/typescript/cast/parameter-typecast/input.ts new file mode 100644 index 000000000000..c494cc00bc39 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/cast/parameter-typecast/input.ts @@ -0,0 +1 @@ +func(a: T); diff --git a/packages/babel-parser/test/fixtures/typescript/cast/parameter-typecast/output.json b/packages/babel-parser/test/fixtures/typescript/cast/parameter-typecast/output.json new file mode 100644 index 000000000000..1ed571551016 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/cast/parameter-typecast/output.json @@ -0,0 +1,53 @@ +{ + "type": "File", + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "errors": [ + "SyntaxError: Did not expect a type annotation here. (1:5)" + ], + "program": { + "type": "Program", + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "expression": { + "type": "CallExpression", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "callee": { + "type": "Identifier", + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4},"identifierName":"func"}, + "name": "func" + }, + "arguments": [ + { + "type": "TSTypeCastExpression", + "start":5,"end":9,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":9}}, + "expression": { + "type": "Identifier", + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"a"}, + "name": "a" + }, + "typeAnnotation": { + "type": "TSTypeAnnotation", + "start":6,"end":9,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":9}}, + "typeAnnotation": { + "type": "TSTypeReference", + "start":8,"end":9,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":9}}, + "typeName": { + "type": "Identifier", + "start":8,"end":9,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":9},"identifierName":"T"}, + "name": "T" + } + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/cast/type-assertion-after-operator/output.json b/packages/babel-parser/test/fixtures/typescript/cast/type-assertion-after-operator/output.json index f8020782bcc6..027243b75610 100644 --- a/packages/babel-parser/test/fixtures/typescript/cast/type-assertion-after-operator/output.json +++ b/packages/babel-parser/test/fixtures/typescript/cast/type-assertion-after-operator/output.json @@ -1,76 +1,21 @@ { "type": "File", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "program": { "type": "Program", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "expression": { "type": "BinaryExpression", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "left": { "type": "NumericLiteral", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1}}, "extra": { "rawValue": 1, "raw": "1" @@ -80,47 +25,14 @@ "operator": "+", "right": { "type": "TSTypeAssertion", - "start": 4, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":4,"end":14,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":14}}, "typeAnnotation": { "type": "TSNumberKeyword", - "start": 5, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 11 - } - } + "start":5,"end":11,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":11}} }, "expression": { "type": "NumericLiteral", - "start": 13, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":13,"end":14,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":14}}, "extra": { "rawValue": 1, "raw": "1" diff --git a/packages/babel-parser/test/fixtures/typescript/cast/type-assertion-and-assign/output.json b/packages/babel-parser/test/fixtures/typescript/cast/type-assertion-and-assign/output.json index 964e552cfc5f..5b7a8bb9fd6c 100644 --- a/packages/babel-parser/test/fixtures/typescript/cast/type-assertion-and-assign/output.json +++ b/packages/babel-parser/test/fixtures/typescript/cast/type-assertion-and-assign/output.json @@ -1,107 +1,29 @@ { "type": "File", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, "program": { "type": "Program", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, "expression": { "type": "AssignmentExpression", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "operator": "+=", "left": { "type": "TSTypeAssertion", - "start": 1, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":1,"end":11,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":11}}, "typeAnnotation": { "type": "TSNumberKeyword", - "start": 2, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 8 - } - } + "start":2,"end":8,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":8}} }, "expression": { "type": "Identifier", - "start": 10, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "x" - }, + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11},"identifierName":"x"}, "name": "x" }, "extra": { @@ -111,18 +33,7 @@ }, "right": { "type": "NumericLiteral", - "start": 16, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":16,"end":17,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":17}}, "extra": { "rawValue": 1, "raw": "1" diff --git a/packages/babel-parser/test/fixtures/typescript/cast/type-assertion-before-operator/output.json b/packages/babel-parser/test/fixtures/typescript/cast/type-assertion-before-operator/output.json index 34f750336a37..d0f0c3a11dd0 100644 --- a/packages/babel-parser/test/fixtures/typescript/cast/type-assertion-before-operator/output.json +++ b/packages/babel-parser/test/fixtures/typescript/cast/type-assertion-before-operator/output.json @@ -1,105 +1,28 @@ { "type": "File", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "program": { "type": "Program", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "expression": { "type": "BinaryExpression", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "left": { "type": "TSTypeAssertion", - "start": 0, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, "typeAnnotation": { "type": "TSNumberKeyword", - "start": 1, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 7 - } - } + "start":1,"end":7,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":7}} }, "expression": { "type": "NumericLiteral", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10}}, "extra": { "rawValue": 1, "raw": "1" @@ -110,18 +33,7 @@ "operator": "+", "right": { "type": "NumericLiteral", - "start": 13, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":13,"end":14,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":14}}, "extra": { "rawValue": 1, "raw": "1" diff --git a/packages/babel-parser/test/fixtures/typescript/cast/type-assertion/output.json b/packages/babel-parser/test/fixtures/typescript/cast/type-assertion/output.json index 0da048e7ef02..79fb8312c758 100644 --- a/packages/babel-parser/test/fixtures/typescript/cast/type-assertion/output.json +++ b/packages/babel-parser/test/fixtures/typescript/cast/type-assertion/output.json @@ -1,91 +1,25 @@ { "type": "File", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "program": { "type": "Program", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "expression": { "type": "TSTypeAssertion", - "start": 0, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, "typeAnnotation": { "type": "TSNumberKeyword", - "start": 1, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 7 - } - } + "start":1,"end":7,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":7}} }, "expression": { "type": "NumericLiteral", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10}}, "extra": { "rawValue": 1, "raw": "1" diff --git a/packages/babel-parser/test/fixtures/typescript/class/abstract-false-positive/output.json b/packages/babel-parser/test/fixtures/typescript/class/abstract-false-positive/output.json index e9716a7942b7..31af6553e567 100644 --- a/packages/babel-parser/test/fixtures/typescript/class/abstract-false-positive/output.json +++ b/packages/babel-parser/test/fixtures/typescript/class/abstract-false-positive/output.json @@ -1,81 +1,26 @@ { "type": "File", - "start": 0, - "end": 87, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 24 - } - }, + "start":0,"end":87,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":24}}, "program": { "type": "Program", - "start": 0, - "end": 87, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 24 - } - }, + "start":0,"end":87,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":24}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExportDefaultDeclaration", - "start": 63, - "end": 87, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 24 - } - }, + "start":63,"end":87,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":24}}, + "exportKind": "value", "declaration": { "type": "Identifier", - "start": 78, - "end": 86, - "loc": { - "start": { - "line": 2, - "column": 15 - }, - "end": { - "line": 2, - "column": 23 - }, - "identifierName": "abstract" - }, + "start":78,"end":86,"loc":{"start":{"line":2,"column":15},"end":{"line":2,"column":23},"identifierName":"abstract"}, "name": "abstract" }, "leadingComments": [ { "type": "CommentLine", "value": " Exports an identifier, doesn't try parsing `abstract class`", - "start": 0, - "end": 62, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 62 - } - } + "start":0,"end":62,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":62}} } ] } @@ -86,18 +31,7 @@ { "type": "CommentLine", "value": " Exports an identifier, doesn't try parsing `abstract class`", - "start": 0, - "end": 62, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 62 - } - } + "start":0,"end":62,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":62}} } ] } \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/class/abstract-new-line/output.json b/packages/babel-parser/test/fixtures/typescript/class/abstract-new-line/output.json index 08760bb11d2b..80d77b30c63e 100644 --- a/packages/babel-parser/test/fixtures/typescript/class/abstract-new-line/output.json +++ b/packages/babel-parser/test/fixtures/typescript/class/abstract-new-line/output.json @@ -1,112 +1,33 @@ { "type": "File", - "start": 0, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 10 - } - }, + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":10}}, "program": { "type": "Program", - "start": 0, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 10 - } - }, + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":10}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, "expression": { "type": "Identifier", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - }, - "identifierName": "abstract" - }, + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8},"identifierName":"abstract"}, "name": "abstract" } }, { "type": "ClassDeclaration", - "start": 9, - "end": 19, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 10 - } - }, + "start":9,"end":19,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":10}}, "id": { "type": "Identifier", - "start": 15, - "end": 16, - "loc": { - "start": { - "line": 2, - "column": 6 - }, - "end": { - "line": 2, - "column": 7 - }, - "identifierName": "B" - }, + "start":15,"end":16,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":7},"identifierName":"B"}, "name": "B" }, "superClass": null, "body": { "type": "ClassBody", - "start": 17, - "end": 19, - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 10 - } - }, + "start":17,"end":19,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":10}}, "body": [] } } diff --git a/packages/babel-parser/test/fixtures/typescript/class/abstract/output.json b/packages/babel-parser/test/fixtures/typescript/class/abstract/output.json index 779c334d8f43..a4dd4721982c 100644 --- a/packages/babel-parser/test/fixtures/typescript/class/abstract/output.json +++ b/packages/babel-parser/test/fixtures/typescript/class/abstract/output.json @@ -1,198 +1,64 @@ { "type": "File", - "start": 0, - "end": 254, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 7, - "column": 50 - } - }, + "start":0,"end":254,"loc":{"start":{"line":1,"column":0},"end":{"line":7,"column":50}}, "program": { "type": "Program", - "start": 0, - "end": 254, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 7, - "column": 50 - } - }, + "start":0,"end":254,"loc":{"start":{"line":1,"column":0},"end":{"line":7,"column":50}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, "abstract": true, "id": { "type": "Identifier", - "start": 15, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 17 - }, - "identifierName": "C1" - }, + "start":15,"end":17,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":17},"identifierName":"C1"}, "name": "C1" }, "superClass": null, "body": { "type": "ClassBody", - "start": 18, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":18,"end":20,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":20}}, "body": [] } }, { "type": "ClassDeclaration", - "start": 21, - "end": 49, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 28 - } - }, + "start":21,"end":49,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":28}}, "abstract": true, "id": { "type": "Identifier", - "start": 44, - "end": 46, - "loc": { - "start": { - "line": 2, - "column": 23 - }, - "end": { - "line": 2, - "column": 25 - }, - "identifierName": "C2" - }, + "start":44,"end":46,"loc":{"start":{"line":2,"column":23},"end":{"line":2,"column":25},"identifierName":"C2"}, "name": "C2" }, "superClass": null, "body": { "type": "ClassBody", - "start": 47, - "end": 49, - "loc": { - "start": { - "line": 2, - "column": 26 - }, - "end": { - "line": 2, - "column": 28 - } - }, + "start":47,"end":49,"loc":{"start":{"line":2,"column":26},"end":{"line":2,"column":28}}, "body": [] }, "declare": true }, { "type": "ExportNamedDeclaration", - "start": 50, - "end": 77, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 27 - } - }, + "start":50,"end":77,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":27}}, + "exportKind": "value", "specifiers": [], "source": null, "declaration": { "type": "ClassDeclaration", - "start": 57, - "end": 77, - "loc": { - "start": { - "line": 3, - "column": 7 - }, - "end": { - "line": 3, - "column": 27 - } - }, + "start":57,"end":77,"loc":{"start":{"line":3,"column":7},"end":{"line":3,"column":27}}, "abstract": true, "id": { "type": "Identifier", - "start": 72, - "end": 74, - "loc": { - "start": { - "line": 3, - "column": 22 - }, - "end": { - "line": 3, - "column": 24 - }, - "identifierName": "C3" - }, + "start":72,"end":74,"loc":{"start":{"line":3,"column":22},"end":{"line":3,"column":24},"identifierName":"C3"}, "name": "C3" }, "superClass": null, "body": { "type": "ClassBody", - "start": 75, - "end": 77, - "loc": { - "start": { - "line": 3, - "column": 25 - }, - "end": { - "line": 3, - "column": 27 - } - }, + "start":75,"end":77,"loc":{"start":{"line":3,"column":25},"end":{"line":3,"column":27}}, "body": [] } }, @@ -200,65 +66,22 @@ { "type": "CommentLine", "value": " `export abstract class {}` is not valid TypeScript.", - "start": 78, - "end": 132, - "loc": { - "start": { - "line": 4, - "column": 0 - }, - "end": { - "line": 4, - "column": 54 - } - } + "start":78,"end":132,"loc":{"start":{"line":4,"column":0},"end":{"line":4,"column":54}} } ] }, { "type": "ExportDefaultDeclaration", - "start": 133, - "end": 166, - "loc": { - "start": { - "line": 5, - "column": 0 - }, - "end": { - "line": 5, - "column": 33 - } - }, + "start":133,"end":166,"loc":{"start":{"line":5,"column":0},"end":{"line":5,"column":33}}, + "exportKind": "value", "declaration": { "type": "ClassDeclaration", - "start": 148, - "end": 166, - "loc": { - "start": { - "line": 5, - "column": 15 - }, - "end": { - "line": 5, - "column": 33 - } - }, + "start":148,"end":166,"loc":{"start":{"line":5,"column":15},"end":{"line":5,"column":33}}, "id": null, "superClass": null, "body": { "type": "ClassBody", - "start": 163, - "end": 166, - "loc": { - "start": { - "line": 5, - "column": 30 - }, - "end": { - "line": 5, - "column": 33 - } - }, + "start":163,"end":166,"loc":{"start":{"line":5,"column":30},"end":{"line":5,"column":33}}, "body": [] }, "abstract": true @@ -267,81 +90,26 @@ { "type": "CommentLine", "value": " `export abstract class {}` is not valid TypeScript.", - "start": 78, - "end": 132, - "loc": { - "start": { - "line": 4, - "column": 0 - }, - "end": { - "line": 4, - "column": 54 - } - } + "start":78,"end":132,"loc":{"start":{"line":4,"column":0},"end":{"line":4,"column":54}} } ] }, { "type": "ExportDefaultDeclaration", - "start": 167, - "end": 203, - "loc": { - "start": { - "line": 6, - "column": 0 - }, - "end": { - "line": 6, - "column": 36 - } - }, + "start":167,"end":203,"loc":{"start":{"line":6,"column":0},"end":{"line":6,"column":36}}, + "exportKind": "value", "declaration": { "type": "ClassDeclaration", - "start": 182, - "end": 203, - "loc": { - "start": { - "line": 6, - "column": 15 - }, - "end": { - "line": 6, - "column": 36 - } - }, + "start":182,"end":203,"loc":{"start":{"line":6,"column":15},"end":{"line":6,"column":36}}, "id": { "type": "Identifier", - "start": 197, - "end": 199, - "loc": { - "start": { - "line": 6, - "column": 30 - }, - "end": { - "line": 6, - "column": 32 - }, - "identifierName": "C4" - }, + "start":197,"end":199,"loc":{"start":{"line":6,"column":30},"end":{"line":6,"column":32},"identifierName":"C4"}, "name": "C4" }, "superClass": null, "body": { "type": "ClassBody", - "start": 200, - "end": 203, - "loc": { - "start": { - "line": 6, - "column": 33 - }, - "end": { - "line": 6, - "column": 36 - } - }, + "start":200,"end":203,"loc":{"start":{"line":6,"column":33},"end":{"line":6,"column":36}}, "body": [] }, "abstract": true @@ -350,18 +118,7 @@ { "type": "CommentLine", "value": " `abstract class` is not valid as an expression.", - "start": 204, - "end": 254, - "loc": { - "start": { - "line": 7, - "column": 0 - }, - "end": { - "line": 7, - "column": 50 - } - } + "start":204,"end":254,"loc":{"start":{"line":7,"column":0},"end":{"line":7,"column":50}} } ] } @@ -372,34 +129,12 @@ { "type": "CommentLine", "value": " `export abstract class {}` is not valid TypeScript.", - "start": 78, - "end": 132, - "loc": { - "start": { - "line": 4, - "column": 0 - }, - "end": { - "line": 4, - "column": 54 - } - } + "start":78,"end":132,"loc":{"start":{"line":4,"column":0},"end":{"line":4,"column":54}} }, { "type": "CommentLine", "value": " `abstract class` is not valid as an expression.", - "start": 204, - "end": 254, - "loc": { - "start": { - "line": 7, - "column": 0 - }, - "end": { - "line": 7, - "column": 50 - } - } + "start":204,"end":254,"loc":{"start":{"line":7,"column":0},"end":{"line":7,"column":50}} } ] } \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/class/async-named-properties/input.ts b/packages/babel-parser/test/fixtures/typescript/class/async-named-properties/input.ts new file mode 100644 index 000000000000..1e0af756a626 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/class/async-named-properties/input.ts @@ -0,0 +1,4 @@ +class A { + async?(): void + async?: boolean +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/class/async-named-properties/output.json b/packages/babel-parser/test/fixtures/typescript/class/async-named-properties/output.json new file mode 100644 index 000000000000..2eb4a2e8912b --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/class/async-named-properties/output.json @@ -0,0 +1,75 @@ +{ + "type": "File", + "start":0,"end":46,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "program": { + "type": "Program", + "start":0,"end":46,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start":0,"end":46,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "id": { + "type": "Identifier", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":8,"end":46,"loc":{"start":{"line":1,"column":8},"end":{"line":4,"column":1}}, + "body": [ + { + "type": "TSDeclareMethod", + "start":12,"end":26,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":16}}, + "static": false, + "key": { + "type": "Identifier", + "start":12,"end":17,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":7},"identifierName":"async"}, + "name": "async" + }, + "computed": false, + "optional": true, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [], + "returnType": { + "type": "TSTypeAnnotation", + "start":20,"end":26,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":16}}, + "typeAnnotation": { + "type": "TSVoidKeyword", + "start":22,"end":26,"loc":{"start":{"line":2,"column":12},"end":{"line":2,"column":16}} + } + } + }, + { + "type": "ClassProperty", + "start":29,"end":44,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":17}}, + "static": false, + "key": { + "type": "Identifier", + "start":29,"end":34,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":7},"identifierName":"async"}, + "name": "async" + }, + "computed": false, + "optional": true, + "typeAnnotation": { + "type": "TSTypeAnnotation", + "start":35,"end":44,"loc":{"start":{"line":3,"column":8},"end":{"line":3,"column":17}}, + "typeAnnotation": { + "type": "TSBooleanKeyword", + "start":37,"end":44,"loc":{"start":{"line":3,"column":10},"end":{"line":3,"column":17}} + } + }, + "value": null + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/class/async-optional-method/input.js b/packages/babel-parser/test/fixtures/typescript/class/async-optional-method/input.js new file mode 100644 index 000000000000..8081fad6e8f2 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/class/async-optional-method/input.js @@ -0,0 +1,3 @@ +class A extends B { + async method?(val: string): Promise; +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/class/async-optional-method/output.json b/packages/babel-parser/test/fixtures/typescript/class/async-optional-method/output.json new file mode 100644 index 000000000000..14133610445b --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/class/async-optional-method/output.json @@ -0,0 +1,87 @@ +{ + "type": "File", + "start":0,"end":66,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "program": { + "type": "Program", + "start":0,"end":66,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start":0,"end":66,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "id": { + "type": "Identifier", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, + "name": "A" + }, + "superClass": { + "type": "Identifier", + "start":16,"end":17,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":17},"identifierName":"B"}, + "name": "B" + }, + "body": { + "type": "ClassBody", + "start":18,"end":66,"loc":{"start":{"line":1,"column":18},"end":{"line":3,"column":1}}, + "body": [ + { + "type": "TSDeclareMethod", + "start":22,"end":64,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":44}}, + "static": false, + "key": { + "type": "Identifier", + "start":28,"end":34,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":14},"identifierName":"method"}, + "name": "method" + }, + "computed": false, + "kind": "method", + "optional": true, + "id": null, + "generator": false, + "async": true, + "params": [ + { + "type": "Identifier", + "start":36,"end":47,"loc":{"start":{"line":2,"column":16},"end":{"line":2,"column":27},"identifierName":"val"}, + "name": "val", + "typeAnnotation": { + "type": "TSTypeAnnotation", + "start":39,"end":47,"loc":{"start":{"line":2,"column":19},"end":{"line":2,"column":27}}, + "typeAnnotation": { + "type": "TSStringKeyword", + "start":41,"end":47,"loc":{"start":{"line":2,"column":21},"end":{"line":2,"column":27}} + } + } + } + ], + "returnType": { + "type": "TSTypeAnnotation", + "start":48,"end":63,"loc":{"start":{"line":2,"column":28},"end":{"line":2,"column":43}}, + "typeAnnotation": { + "type": "TSTypeReference", + "start":50,"end":63,"loc":{"start":{"line":2,"column":30},"end":{"line":2,"column":43}}, + "typeName": { + "type": "Identifier", + "start":50,"end":57,"loc":{"start":{"line":2,"column":30},"end":{"line":2,"column":37},"identifierName":"Promise"}, + "name": "Promise" + }, + "typeParameters": { + "type": "TSTypeParameterInstantiation", + "start":57,"end":63,"loc":{"start":{"line":2,"column":37},"end":{"line":2,"column":43}}, + "params": [ + { + "type": "TSVoidKeyword", + "start":58,"end":62,"loc":{"start":{"line":2,"column":38},"end":{"line":2,"column":42}} + } + ] + } + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/class/constructor-with-modifier-names/output.json b/packages/babel-parser/test/fixtures/typescript/class/constructor-with-modifier-names/output.json index 24aeccd1b0bf..92b431cd0825 100644 --- a/packages/babel-parser/test/fixtures/typescript/class/constructor-with-modifier-names/output.json +++ b/packages/babel-parser/test/fixtures/typescript/class/constructor-with-modifier-names/output.json @@ -1,111 +1,32 @@ { "type": "File", - "start": 0, - "end": 91, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":0,"end":91,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 91, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":0,"end":91,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 91, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":0,"end":91,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, "id": { "type": "Identifier", - "start": 6, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "Foo" - }, + "start":6,"end":9,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":9},"identifierName":"Foo"}, "name": "Foo" }, "superClass": null, "body": { "type": "ClassBody", - "start": 10, - "end": 91, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":10,"end":91,"loc":{"start":{"line":1,"column":10},"end":{"line":4,"column":1}}, "body": [ { "type": "ClassMethod", - "start": 14, - "end": 43, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 31 - } - }, + "start":14,"end":43,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":31}}, "static": false, "key": { "type": "Identifier", - "start": 14, - "end": 25, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 13 - }, - "identifierName": "constructor" - }, + "start":14,"end":25,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":13},"identifierName":"constructor"}, "name": "constructor" }, "computed": false, @@ -116,87 +37,29 @@ "params": [ { "type": "Identifier", - "start": 26, - "end": 29, - "loc": { - "start": { - "line": 2, - "column": 14 - }, - "end": { - "line": 2, - "column": 17 - }, - "identifierName": "set" - }, + "start":26,"end":29,"loc":{"start":{"line":2,"column":14},"end":{"line":2,"column":17},"identifierName":"set"}, "name": "set" }, { "type": "Identifier", - "start": 31, - "end": 39, - "loc": { - "start": { - "line": 2, - "column": 19 - }, - "end": { - "line": 2, - "column": 27 - }, - "identifierName": "readonly" - }, + "start":31,"end":39,"loc":{"start":{"line":2,"column":19},"end":{"line":2,"column":27},"identifierName":"readonly"}, "name": "readonly" } ], "body": { "type": "BlockStatement", - "start": 41, - "end": 43, - "loc": { - "start": { - "line": 2, - "column": 29 - }, - "end": { - "line": 2, - "column": 31 - } - }, + "start":41,"end":43,"loc":{"start":{"line":2,"column":29},"end":{"line":2,"column":31}}, "body": [], "directives": [] } }, { "type": "ClassMethod", - "start": 46, - "end": 89, - "loc": { - "start": { - "line": 3, - "column": 2 - }, - "end": { - "line": 3, - "column": 45 - } - }, + "start":46,"end":89,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":45}}, "static": false, "key": { "type": "Identifier", - "start": 46, - "end": 57, - "loc": { - "start": { - "line": 3, - "column": 2 - }, - "end": { - "line": 3, - "column": 13 - }, - "identifierName": "constructor" - }, + "start":46,"end":57,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":13},"identifierName":"constructor"}, "name": "constructor" }, "computed": false, @@ -207,113 +70,34 @@ "params": [ { "type": "Identifier", - "start": 58, - "end": 66, - "loc": { - "start": { - "line": 3, - "column": 14 - }, - "end": { - "line": 3, - "column": 22 - }, - "identifierName": "set" - }, + "start":58,"end":66,"loc":{"start":{"line":3,"column":14},"end":{"line":3,"column":22},"identifierName":"set"}, "name": "set", "typeAnnotation": { "type": "TSTypeAnnotation", - "start": 61, - "end": 66, - "loc": { - "start": { - "line": 3, - "column": 17 - }, - "end": { - "line": 3, - "column": 22 - } - }, + "start":61,"end":66,"loc":{"start":{"line":3,"column":17},"end":{"line":3,"column":22}}, "typeAnnotation": { "type": "TSAnyKeyword", - "start": 63, - "end": 66, - "loc": { - "start": { - "line": 3, - "column": 19 - }, - "end": { - "line": 3, - "column": 22 - } - } + "start":63,"end":66,"loc":{"start":{"line":3,"column":19},"end":{"line":3,"column":22}} } } }, { "type": "Identifier", - "start": 68, - "end": 85, - "loc": { - "start": { - "line": 3, - "column": 24 - }, - "end": { - "line": 3, - "column": 41 - }, - "identifierName": "readonly" - }, + "start":68,"end":85,"loc":{"start":{"line":3,"column":24},"end":{"line":3,"column":41},"identifierName":"readonly"}, "name": "readonly", "typeAnnotation": { "type": "TSTypeAnnotation", - "start": 76, - "end": 85, - "loc": { - "start": { - "line": 3, - "column": 32 - }, - "end": { - "line": 3, - "column": 41 - } - }, + "start":76,"end":85,"loc":{"start":{"line":3,"column":32},"end":{"line":3,"column":41}}, "typeAnnotation": { "type": "TSBooleanKeyword", - "start": 78, - "end": 85, - "loc": { - "start": { - "line": 3, - "column": 34 - }, - "end": { - "line": 3, - "column": 41 - } - } + "start":78,"end":85,"loc":{"start":{"line":3,"column":34},"end":{"line":3,"column":41}} } } } ], "body": { "type": "BlockStatement", - "start": 87, - "end": 89, - "loc": { - "start": { - "line": 3, - "column": 43 - }, - "end": { - "line": 3, - "column": 45 - } - }, + "start":87,"end":89,"loc":{"start":{"line":3,"column":43},"end":{"line":3,"column":45}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/typescript/class/constructor/output.json b/packages/babel-parser/test/fixtures/typescript/class/constructor/output.json index 55d2eac06ccc..4f03b0ae91e0 100644 --- a/packages/babel-parser/test/fixtures/typescript/class/constructor/output.json +++ b/packages/babel-parser/test/fixtures/typescript/class/constructor/output.json @@ -1,111 +1,32 @@ { "type": "File", - "start": 0, - "end": 124, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 1 - } - }, + "start":0,"end":124,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 124, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 1 - } - }, + "start":0,"end":124,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 124, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 1 - } - }, + "start":0,"end":124,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, "id": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "C" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"C"}, "name": "C" }, "superClass": null, "body": { "type": "ClassBody", - "start": 8, - "end": 124, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 5, - "column": 1 - } - }, + "start":8,"end":124,"loc":{"start":{"line":1,"column":8},"end":{"line":5,"column":1}}, "body": [ { "type": "TSDeclareMethod", - "start": 14, - "end": 48, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 38 - } - }, + "start":14,"end":48,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":38}}, "static": false, "key": { "type": "Identifier", - "start": 14, - "end": 25, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 15 - }, - "identifierName": "constructor" - }, + "start":14,"end":25,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":15},"identifierName":"constructor"}, "name": "constructor" }, "computed": false, @@ -116,95 +37,27 @@ "params": [ { "type": "Identifier", - "start": 26, - "end": 35, - "loc": { - "start": { - "line": 2, - "column": 16 - }, - "end": { - "line": 2, - "column": 25 - }, - "identifierName": "x" - }, + "start":26,"end":35,"loc":{"start":{"line":2,"column":16},"end":{"line":2,"column":25},"identifierName":"x"}, "name": "x", "typeAnnotation": { "type": "TSTypeAnnotation", - "start": 27, - "end": 35, - "loc": { - "start": { - "line": 2, - "column": 17 - }, - "end": { - "line": 2, - "column": 25 - } - }, + "start":27,"end":35,"loc":{"start":{"line":2,"column":17},"end":{"line":2,"column":25}}, "typeAnnotation": { "type": "TSNumberKeyword", - "start": 29, - "end": 35, - "loc": { - "start": { - "line": 2, - "column": 19 - }, - "end": { - "line": 2, - "column": 25 - } - } + "start":29,"end":35,"loc":{"start":{"line":2,"column":19},"end":{"line":2,"column":25}} } } }, { "type": "Identifier", - "start": 37, - "end": 46, - "loc": { - "start": { - "line": 2, - "column": 27 - }, - "end": { - "line": 2, - "column": 36 - }, - "identifierName": "y" - }, + "start":37,"end":46,"loc":{"start":{"line":2,"column":27},"end":{"line":2,"column":36},"identifierName":"y"}, "name": "y", "typeAnnotation": { "type": "TSTypeAnnotation", - "start": 38, - "end": 46, - "loc": { - "start": { - "line": 2, - "column": 28 - }, - "end": { - "line": 2, - "column": 36 - } - }, + "start":38,"end":46,"loc":{"start":{"line":2,"column":28},"end":{"line":2,"column":36}}, "typeAnnotation": { "type": "TSNumberKeyword", - "start": 40, - "end": 46, - "loc": { - "start": { - "line": 2, - "column": 30 - }, - "end": { - "line": 2, - "column": 36 - } - } + "start":40,"end":46,"loc":{"start":{"line":2,"column":30},"end":{"line":2,"column":36}} } } } @@ -212,34 +65,11 @@ }, { "type": "TSDeclareMethod", - "start": 53, - "end": 87, - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 38 - } - }, + "start":53,"end":87,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":38}}, "static": false, "key": { "type": "Identifier", - "start": 53, - "end": 64, - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 15 - }, - "identifierName": "constructor" - }, + "start":53,"end":64,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":15},"identifierName":"constructor"}, "name": "constructor" }, "computed": false, @@ -250,95 +80,27 @@ "params": [ { "type": "Identifier", - "start": 65, - "end": 74, - "loc": { - "start": { - "line": 3, - "column": 16 - }, - "end": { - "line": 3, - "column": 25 - }, - "identifierName": "x" - }, + "start":65,"end":74,"loc":{"start":{"line":3,"column":16},"end":{"line":3,"column":25},"identifierName":"x"}, "name": "x", "typeAnnotation": { "type": "TSTypeAnnotation", - "start": 66, - "end": 74, - "loc": { - "start": { - "line": 3, - "column": 17 - }, - "end": { - "line": 3, - "column": 25 - } - }, + "start":66,"end":74,"loc":{"start":{"line":3,"column":17},"end":{"line":3,"column":25}}, "typeAnnotation": { "type": "TSStringKeyword", - "start": 68, - "end": 74, - "loc": { - "start": { - "line": 3, - "column": 19 - }, - "end": { - "line": 3, - "column": 25 - } - } + "start":68,"end":74,"loc":{"start":{"line":3,"column":19},"end":{"line":3,"column":25}} } } }, { "type": "Identifier", - "start": 76, - "end": 85, - "loc": { - "start": { - "line": 3, - "column": 27 - }, - "end": { - "line": 3, - "column": 36 - }, - "identifierName": "y" - }, + "start":76,"end":85,"loc":{"start":{"line":3,"column":27},"end":{"line":3,"column":36},"identifierName":"y"}, "name": "y", "typeAnnotation": { "type": "TSTypeAnnotation", - "start": 77, - "end": 85, - "loc": { - "start": { - "line": 3, - "column": 28 - }, - "end": { - "line": 3, - "column": 36 - } - }, + "start":77,"end":85,"loc":{"start":{"line":3,"column":28},"end":{"line":3,"column":36}}, "typeAnnotation": { "type": "TSStringKeyword", - "start": 79, - "end": 85, - "loc": { - "start": { - "line": 3, - "column": 30 - }, - "end": { - "line": 3, - "column": 36 - } - } + "start":79,"end":85,"loc":{"start":{"line":3,"column":30},"end":{"line":3,"column":36}} } } } @@ -346,34 +108,11 @@ }, { "type": "ClassMethod", - "start": 92, - "end": 122, - "loc": { - "start": { - "line": 4, - "column": 4 - }, - "end": { - "line": 4, - "column": 34 - } - }, + "start":92,"end":122,"loc":{"start":{"line":4,"column":4},"end":{"line":4,"column":34}}, "static": false, "key": { "type": "Identifier", - "start": 92, - "end": 103, - "loc": { - "start": { - "line": 4, - "column": 4 - }, - "end": { - "line": 4, - "column": 15 - }, - "identifierName": "constructor" - }, + "start":92,"end":103,"loc":{"start":{"line":4,"column":4},"end":{"line":4,"column":15},"identifierName":"constructor"}, "name": "constructor" }, "computed": false, @@ -384,113 +123,34 @@ "params": [ { "type": "Identifier", - "start": 104, - "end": 110, - "loc": { - "start": { - "line": 4, - "column": 16 - }, - "end": { - "line": 4, - "column": 22 - }, - "identifierName": "x" - }, + "start":104,"end":110,"loc":{"start":{"line":4,"column":16},"end":{"line":4,"column":22},"identifierName":"x"}, "name": "x", "typeAnnotation": { "type": "TSTypeAnnotation", - "start": 105, - "end": 110, - "loc": { - "start": { - "line": 4, - "column": 17 - }, - "end": { - "line": 4, - "column": 22 - } - }, + "start":105,"end":110,"loc":{"start":{"line":4,"column":17},"end":{"line":4,"column":22}}, "typeAnnotation": { "type": "TSAnyKeyword", - "start": 107, - "end": 110, - "loc": { - "start": { - "line": 4, - "column": 19 - }, - "end": { - "line": 4, - "column": 22 - } - } + "start":107,"end":110,"loc":{"start":{"line":4,"column":19},"end":{"line":4,"column":22}} } } }, { "type": "Identifier", - "start": 112, - "end": 118, - "loc": { - "start": { - "line": 4, - "column": 24 - }, - "end": { - "line": 4, - "column": 30 - }, - "identifierName": "y" - }, + "start":112,"end":118,"loc":{"start":{"line":4,"column":24},"end":{"line":4,"column":30},"identifierName":"y"}, "name": "y", "typeAnnotation": { "type": "TSTypeAnnotation", - "start": 113, - "end": 118, - "loc": { - "start": { - "line": 4, - "column": 25 - }, - "end": { - "line": 4, - "column": 30 - } - }, + "start":113,"end":118,"loc":{"start":{"line":4,"column":25},"end":{"line":4,"column":30}}, "typeAnnotation": { "type": "TSAnyKeyword", - "start": 115, - "end": 118, - "loc": { - "start": { - "line": 4, - "column": 27 - }, - "end": { - "line": 4, - "column": 30 - } - } + "start":115,"end":118,"loc":{"start":{"line":4,"column":27},"end":{"line":4,"column":30}} } } } ], "body": { "type": "BlockStatement", - "start": 120, - "end": 122, - "loc": { - "start": { - "line": 4, - "column": 32 - }, - "end": { - "line": 4, - "column": 34 - } - }, + "start":120,"end":122,"loc":{"start":{"line":4,"column":32},"end":{"line":4,"column":34}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/typescript/class/declare-field-initializer/input.ts b/packages/babel-parser/test/fixtures/typescript/class/declare-field-initializer/input.ts new file mode 100644 index 000000000000..b77a17738bf5 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/class/declare-field-initializer/input.ts @@ -0,0 +1,3 @@ +class A { + declare bar: string = "test"; +} diff --git a/packages/babel-parser/test/fixtures/typescript/class/declare-field-initializer/output.json b/packages/babel-parser/test/fixtures/typescript/class/declare-field-initializer/output.json new file mode 100644 index 000000000000..88767978351c --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/class/declare-field-initializer/output.json @@ -0,0 +1,58 @@ +{ + "type": "File", + "start":0,"end":43,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "program": { + "type": "Program", + "start":0,"end":43,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start":0,"end":43,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "id": { + "type": "Identifier", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":8,"end":43,"loc":{"start":{"line":1,"column":8},"end":{"line":3,"column":1}}, + "body": [ + { + "type": "ClassProperty", + "start":12,"end":41,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":31}}, + "declare": true, + "static": false, + "key": { + "type": "Identifier", + "start":20,"end":23,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":13},"identifierName":"bar"}, + "name": "bar" + }, + "computed": false, + "typeAnnotation": { + "type": "TSTypeAnnotation", + "start":23,"end":31,"loc":{"start":{"line":2,"column":13},"end":{"line":2,"column":21}}, + "typeAnnotation": { + "type": "TSStringKeyword", + "start":25,"end":31,"loc":{"start":{"line":2,"column":15},"end":{"line":2,"column":21}} + } + }, + "value": { + "type": "StringLiteral", + "start":34,"end":40,"loc":{"start":{"line":2,"column":24},"end":{"line":2,"column":30}}, + "extra": { + "rawValue": "test", + "raw": "\"test\"" + }, + "value": "test" + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/class/declare-field-modifiers/input.ts b/packages/babel-parser/test/fixtures/typescript/class/declare-field-modifiers/input.ts new file mode 100644 index 000000000000..5eeb011f60ba --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/class/declare-field-modifiers/input.ts @@ -0,0 +1,11 @@ +class A { + declare static foo; + static declare foo0: string; + + declare public foo1; + public declare foo2; + + declare public static foo4; + public declare static foo3; + public static declare foo5; +} diff --git a/packages/babel-parser/test/fixtures/typescript/class/declare-field-modifiers/output.json b/packages/babel-parser/test/fixtures/typescript/class/declare-field-modifiers/output.json new file mode 100644 index 000000000000..f5caff15c0c2 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/class/declare-field-modifiers/output.json @@ -0,0 +1,133 @@ +{ + "type": "File", + "start":0,"end":202,"loc":{"start":{"line":1,"column":0},"end":{"line":11,"column":1}}, + "program": { + "type": "Program", + "start":0,"end":202,"loc":{"start":{"line":1,"column":0},"end":{"line":11,"column":1}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start":0,"end":202,"loc":{"start":{"line":1,"column":0},"end":{"line":11,"column":1}}, + "id": { + "type": "Identifier", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":8,"end":202,"loc":{"start":{"line":1,"column":8},"end":{"line":11,"column":1}}, + "body": [ + { + "type": "ClassProperty", + "start":12,"end":31,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":21}}, + "declare": true, + "static": true, + "key": { + "type": "Identifier", + "start":27,"end":30,"loc":{"start":{"line":2,"column":17},"end":{"line":2,"column":20},"identifierName":"foo"}, + "name": "foo" + }, + "computed": false, + "value": null + }, + { + "type": "ClassProperty", + "start":34,"end":62,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":30}}, + "declare": true, + "static": true, + "key": { + "type": "Identifier", + "start":49,"end":53,"loc":{"start":{"line":3,"column":17},"end":{"line":3,"column":21},"identifierName":"foo0"}, + "name": "foo0" + }, + "computed": false, + "typeAnnotation": { + "type": "TSTypeAnnotation", + "start":53,"end":61,"loc":{"start":{"line":3,"column":21},"end":{"line":3,"column":29}}, + "typeAnnotation": { + "type": "TSStringKeyword", + "start":55,"end":61,"loc":{"start":{"line":3,"column":23},"end":{"line":3,"column":29}} + } + }, + "value": null + }, + { + "type": "ClassProperty", + "start":66,"end":86,"loc":{"start":{"line":5,"column":2},"end":{"line":5,"column":22}}, + "declare": true, + "accessibility": "public", + "static": false, + "key": { + "type": "Identifier", + "start":81,"end":85,"loc":{"start":{"line":5,"column":17},"end":{"line":5,"column":21},"identifierName":"foo1"}, + "name": "foo1" + }, + "computed": false, + "value": null + }, + { + "type": "ClassProperty", + "start":89,"end":109,"loc":{"start":{"line":6,"column":2},"end":{"line":6,"column":22}}, + "accessibility": "public", + "declare": true, + "static": false, + "key": { + "type": "Identifier", + "start":104,"end":108,"loc":{"start":{"line":6,"column":17},"end":{"line":6,"column":21},"identifierName":"foo2"}, + "name": "foo2" + }, + "computed": false, + "value": null + }, + { + "type": "ClassProperty", + "start":113,"end":140,"loc":{"start":{"line":8,"column":2},"end":{"line":8,"column":29}}, + "declare": true, + "accessibility": "public", + "static": true, + "key": { + "type": "Identifier", + "start":135,"end":139,"loc":{"start":{"line":8,"column":24},"end":{"line":8,"column":28},"identifierName":"foo4"}, + "name": "foo4" + }, + "computed": false, + "value": null + }, + { + "type": "ClassProperty", + "start":143,"end":170,"loc":{"start":{"line":9,"column":2},"end":{"line":9,"column":29}}, + "accessibility": "public", + "declare": true, + "static": true, + "key": { + "type": "Identifier", + "start":165,"end":169,"loc":{"start":{"line":9,"column":24},"end":{"line":9,"column":28},"identifierName":"foo3"}, + "name": "foo3" + }, + "computed": false, + "value": null + }, + { + "type": "ClassProperty", + "start":173,"end":200,"loc":{"start":{"line":10,"column":2},"end":{"line":10,"column":29}}, + "accessibility": "public", + "declare": true, + "static": true, + "key": { + "type": "Identifier", + "start":195,"end":199,"loc":{"start":{"line":10,"column":24},"end":{"line":10,"column":28},"identifierName":"foo5"}, + "name": "foo5" + }, + "computed": false, + "value": null + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/class/declare-field/input.ts b/packages/babel-parser/test/fixtures/typescript/class/declare-field/input.ts new file mode 100644 index 000000000000..a7a8b2d36280 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/class/declare-field/input.ts @@ -0,0 +1,4 @@ +class A { + declare foo; + declare bar: string; +} diff --git a/packages/babel-parser/test/fixtures/typescript/class/declare-field/output.json b/packages/babel-parser/test/fixtures/typescript/class/declare-field/output.json new file mode 100644 index 000000000000..6019ac5ff859 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/class/declare-field/output.json @@ -0,0 +1,63 @@ +{ + "type": "File", + "start":0,"end":49,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "program": { + "type": "Program", + "start":0,"end":49,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start":0,"end":49,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "id": { + "type": "Identifier", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":8,"end":49,"loc":{"start":{"line":1,"column":8},"end":{"line":4,"column":1}}, + "body": [ + { + "type": "ClassProperty", + "start":12,"end":24,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":14}}, + "declare": true, + "static": false, + "key": { + "type": "Identifier", + "start":20,"end":23,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":13},"identifierName":"foo"}, + "name": "foo" + }, + "computed": false, + "value": null + }, + { + "type": "ClassProperty", + "start":27,"end":47,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":22}}, + "declare": true, + "static": false, + "key": { + "type": "Identifier", + "start":35,"end":38,"loc":{"start":{"line":3,"column":10},"end":{"line":3,"column":13},"identifierName":"bar"}, + "name": "bar" + }, + "computed": false, + "typeAnnotation": { + "type": "TSTypeAnnotation", + "start":38,"end":46,"loc":{"start":{"line":3,"column":13},"end":{"line":3,"column":21}}, + "typeAnnotation": { + "type": "TSStringKeyword", + "start":40,"end":46,"loc":{"start":{"line":3,"column":15},"end":{"line":3,"column":21}} + } + }, + "value": null + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/class/declare-method/input.ts b/packages/babel-parser/test/fixtures/typescript/class/declare-method/input.ts new file mode 100644 index 000000000000..0e539a84a2a5 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/class/declare-method/input.ts @@ -0,0 +1,3 @@ +class A { + declare foo() {} +} diff --git a/packages/babel-parser/test/fixtures/typescript/class/declare-method/output.json b/packages/babel-parser/test/fixtures/typescript/class/declare-method/output.json new file mode 100644 index 000000000000..ffa963c815c3 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/class/declare-method/output.json @@ -0,0 +1,55 @@ +{ + "type": "File", + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "errors": [ + "SyntaxError: Class methods cannot have the 'declare' modifier (2:2)" + ], + "program": { + "type": "Program", + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "id": { + "type": "Identifier", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":8,"end":30,"loc":{"start":{"line":1,"column":8},"end":{"line":3,"column":1}}, + "body": [ + { + "type": "ClassMethod", + "start":12,"end":28,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":18}}, + "declare": true, + "static": false, + "key": { + "type": "Identifier", + "start":20,"end":23,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":13},"identifierName":"foo"}, + "name": "foo" + }, + "computed": false, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":26,"end":28,"loc":{"start":{"line":2,"column":16},"end":{"line":2,"column":18}}, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/class/declare-new-line/output.json b/packages/babel-parser/test/fixtures/typescript/class/declare-new-line/output.json index 764a3d2f7efa..8f95aef58bb7 100644 --- a/packages/babel-parser/test/fixtures/typescript/class/declare-new-line/output.json +++ b/packages/babel-parser/test/fixtures/typescript/class/declare-new-line/output.json @@ -1,112 +1,33 @@ { "type": "File", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 10 - } - }, + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":10}}, "program": { "type": "Program", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 10 - } - }, + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":10}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "expression": { "type": "Identifier", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "declare" - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7},"identifierName":"declare"}, "name": "declare" } }, { "type": "ClassDeclaration", - "start": 8, - "end": 18, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 10 - } - }, + "start":8,"end":18,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":10}}, "id": { "type": "Identifier", - "start": 14, - "end": 15, - "loc": { - "start": { - "line": 2, - "column": 6 - }, - "end": { - "line": 2, - "column": 7 - }, - "identifierName": "B" - }, + "start":14,"end":15,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":7},"identifierName":"B"}, "name": "B" }, "superClass": null, "body": { "type": "ClassBody", - "start": 16, - "end": 18, - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 10 - } - }, + "start":16,"end":18,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":10}}, "body": [] } } diff --git a/packages/babel-parser/test/fixtures/typescript/class/declare/output.json b/packages/babel-parser/test/fixtures/typescript/class/declare/output.json index f52b40639e43..05defba81f38 100644 --- a/packages/babel-parser/test/fixtures/typescript/class/declare/output.json +++ b/packages/babel-parser/test/fixtures/typescript/class/declare/output.json @@ -1,205 +1,60 @@ { "type": "File", - "start": 0, - "end": 87, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 7, - "column": 1 - } - }, + "start":0,"end":87,"loc":{"start":{"line":1,"column":0},"end":{"line":7,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 87, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 7, - "column": 1 - } - }, + "start":0,"end":87,"loc":{"start":{"line":1,"column":0},"end":{"line":7,"column":1}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 87, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 7, - "column": 1 - } - }, + "start":0,"end":87,"loc":{"start":{"line":1,"column":0},"end":{"line":7,"column":1}}, + "declare": true, "id": { "type": "Identifier", - "start": 14, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - }, - "identifierName": "C" - }, + "start":14,"end":15,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":15},"identifierName":"C"}, "name": "C" }, "superClass": null, "body": { "type": "ClassBody", - "start": 16, - "end": 87, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 7, - "column": 1 - } - }, + "start":16,"end":87,"loc":{"start":{"line":1,"column":16},"end":{"line":7,"column":1}}, "body": [ { "type": "TSIndexSignature", - "start": 22, - "end": 39, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 21 - } - }, + "start":22,"end":39,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":21}}, "parameters": [ { "type": "Identifier", - "start": 23, - "end": 32, - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 14 - }, - "identifierName": "x" - }, + "start":23,"end":32,"loc":{"start":{"line":2,"column":5},"end":{"line":2,"column":14},"identifierName":"x"}, "name": "x", "typeAnnotation": { "type": "TSTypeAnnotation", - "start": 24, - "end": 32, - "loc": { - "start": { - "line": 2, - "column": 6 - }, - "end": { - "line": 2, - "column": 14 - } - }, + "start":24,"end":32,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":14}}, "typeAnnotation": { "type": "TSStringKeyword", - "start": 26, - "end": 32, - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 14 - } - } + "start":26,"end":32,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":14}} } } } ], "typeAnnotation": { "type": "TSTypeAnnotation", - "start": 33, - "end": 38, - "loc": { - "start": { - "line": 2, - "column": 15 - }, - "end": { - "line": 2, - "column": 20 - } - }, + "start":33,"end":38,"loc":{"start":{"line":2,"column":15},"end":{"line":2,"column":20}}, "typeAnnotation": { "type": "TSAnyKeyword", - "start": 35, - "end": 38, - "loc": { - "start": { - "line": 2, - "column": 17 - }, - "end": { - "line": 2, - "column": 20 - } - } + "start":35,"end":38,"loc":{"start":{"line":2,"column":17},"end":{"line":2,"column":20}} } } }, { "type": "ClassProperty", - "start": 44, - "end": 46, - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 6 - } - }, + "start":44,"end":46,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":6}}, "static": false, "key": { "type": "Identifier", - "start": 44, - "end": 45, - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 5 - }, - "identifierName": "x" - }, + "start":44,"end":45,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":5},"identifierName":"x"}, "name": "x" }, "computed": false, @@ -207,99 +62,31 @@ }, { "type": "ClassProperty", - "start": 51, - "end": 61, - "loc": { - "start": { - "line": 4, - "column": 4 - }, - "end": { - "line": 4, - "column": 14 - } - }, + "start":51,"end":61,"loc":{"start":{"line":4,"column":4},"end":{"line":4,"column":14}}, "static": false, "key": { "type": "Identifier", - "start": 51, - "end": 52, - "loc": { - "start": { - "line": 4, - "column": 4 - }, - "end": { - "line": 4, - "column": 5 - }, - "identifierName": "x" - }, + "start":51,"end":52,"loc":{"start":{"line":4,"column":4},"end":{"line":4,"column":5},"identifierName":"x"}, "name": "x" }, "computed": false, "typeAnnotation": { "type": "TSTypeAnnotation", - "start": 52, - "end": 60, - "loc": { - "start": { - "line": 4, - "column": 5 - }, - "end": { - "line": 4, - "column": 13 - } - }, + "start":52,"end":60,"loc":{"start":{"line":4,"column":5},"end":{"line":4,"column":13}}, "typeAnnotation": { "type": "TSNumberKeyword", - "start": 54, - "end": 60, - "loc": { - "start": { - "line": 4, - "column": 7 - }, - "end": { - "line": 4, - "column": 13 - } - } + "start":54,"end":60,"loc":{"start":{"line":4,"column":7},"end":{"line":4,"column":13}} } }, "value": null }, { "type": "TSDeclareMethod", - "start": 66, - "end": 70, - "loc": { - "start": { - "line": 5, - "column": 4 - }, - "end": { - "line": 5, - "column": 8 - } - }, + "start":66,"end":70,"loc":{"start":{"line":5,"column":4},"end":{"line":5,"column":8}}, "static": false, "key": { "type": "Identifier", - "start": 66, - "end": 67, - "loc": { - "start": { - "line": 5, - "column": 4 - }, - "end": { - "line": 5, - "column": 5 - }, - "identifierName": "f" - }, + "start":66,"end":67,"loc":{"start":{"line":5,"column":4},"end":{"line":5,"column":5},"identifierName":"f"}, "name": "f" }, "computed": false, @@ -311,34 +98,11 @@ }, { "type": "TSDeclareMethod", - "start": 75, - "end": 85, - "loc": { - "start": { - "line": 6, - "column": 4 - }, - "end": { - "line": 6, - "column": 14 - } - }, + "start":75,"end":85,"loc":{"start":{"line":6,"column":4},"end":{"line":6,"column":14}}, "static": false, "key": { "type": "Identifier", - "start": 75, - "end": 76, - "loc": { - "start": { - "line": 6, - "column": 4 - }, - "end": { - "line": 6, - "column": 5 - }, - "identifierName": "f" - }, + "start":75,"end":76,"loc":{"start":{"line":6,"column":4},"end":{"line":6,"column":5},"identifierName":"f"}, "name": "f" }, "computed": false, @@ -349,38 +113,15 @@ "params": [], "returnType": { "type": "TSTypeAnnotation", - "start": 78, - "end": 84, - "loc": { - "start": { - "line": 6, - "column": 7 - }, - "end": { - "line": 6, - "column": 13 - } - }, + "start":78,"end":84,"loc":{"start":{"line":6,"column":7},"end":{"line":6,"column":13}}, "typeAnnotation": { "type": "TSVoidKeyword", - "start": 80, - "end": 84, - "loc": { - "start": { - "line": 6, - "column": 9 - }, - "end": { - "line": 6, - "column": 13 - } - } + "start":80,"end":84,"loc":{"start":{"line":6,"column":9},"end":{"line":6,"column":13}} } } } ] - }, - "declare": true + } } ], "directives": [] diff --git a/packages/babel-parser/test/fixtures/typescript/class/duplicate-modifier-1/input.ts b/packages/babel-parser/test/fixtures/typescript/class/duplicate-modifier-1/input.ts new file mode 100644 index 000000000000..41589defb3c4 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/class/duplicate-modifier-1/input.ts @@ -0,0 +1,3 @@ +class A { + declare public declare foo; +} diff --git a/packages/babel-parser/test/fixtures/typescript/class/duplicate-modifier-1/output.json b/packages/babel-parser/test/fixtures/typescript/class/duplicate-modifier-1/output.json new file mode 100644 index 000000000000..945b98a43008 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/class/duplicate-modifier-1/output.json @@ -0,0 +1,46 @@ +{ + "type": "File", + "start":0,"end":41,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "errors": [ + "SyntaxError: Duplicate modifier: 'declare' (2:17)" + ], + "program": { + "type": "Program", + "start":0,"end":41,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start":0,"end":41,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "id": { + "type": "Identifier", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":8,"end":41,"loc":{"start":{"line":1,"column":8},"end":{"line":3,"column":1}}, + "body": [ + { + "type": "ClassProperty", + "start":12,"end":39,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":29}}, + "declare": true, + "accessibility": "public", + "static": false, + "key": { + "type": "Identifier", + "start":35,"end":38,"loc":{"start":{"line":2,"column":25},"end":{"line":2,"column":28},"identifierName":"foo"}, + "name": "foo" + }, + "computed": false, + "value": null + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/class/duplicate-modifier-2/input.ts b/packages/babel-parser/test/fixtures/typescript/class/duplicate-modifier-2/input.ts new file mode 100644 index 000000000000..d2909835d448 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/class/duplicate-modifier-2/input.ts @@ -0,0 +1,3 @@ +class A { + declare public static declare foo; +} diff --git a/packages/babel-parser/test/fixtures/typescript/class/duplicate-modifier-2/output.json b/packages/babel-parser/test/fixtures/typescript/class/duplicate-modifier-2/output.json new file mode 100644 index 000000000000..d902e7d6b78f --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/class/duplicate-modifier-2/output.json @@ -0,0 +1,46 @@ +{ + "type": "File", + "start":0,"end":48,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "errors": [ + "SyntaxError: Duplicate modifier: 'declare' (2:24)" + ], + "program": { + "type": "Program", + "start":0,"end":48,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start":0,"end":48,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "id": { + "type": "Identifier", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":8,"end":48,"loc":{"start":{"line":1,"column":8},"end":{"line":3,"column":1}}, + "body": [ + { + "type": "ClassProperty", + "start":12,"end":46,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":36}}, + "declare": true, + "accessibility": "public", + "static": true, + "key": { + "type": "Identifier", + "start":42,"end":45,"loc":{"start":{"line":2,"column":32},"end":{"line":2,"column":35},"identifierName":"foo"}, + "name": "foo" + }, + "computed": false, + "value": null + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/class/expression-extends-implements/output.json b/packages/babel-parser/test/fixtures/typescript/class/expression-extends-implements/output.json index be0e8f7c910f..1111ab1f13e5 100644 --- a/packages/babel-parser/test/fixtures/typescript/class/expression-extends-implements/output.json +++ b/packages/babel-parser/test/fixtures/typescript/class/expression-extends-implements/output.json @@ -1,140 +1,39 @@ { "type": "File", - "start": 0, - "end": 91, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 46 - } - }, + "start":0,"end":91,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":46}}, "program": { "type": "Program", - "start": 0, - "end": 91, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 46 - } - }, + "start":0,"end":91,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":46}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 44, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 44 - } - }, + "start":0,"end":44,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":44}}, "expression": { "type": "ClassExpression", - "start": 1, - "end": 42, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 42 - } - }, + "start":1,"end":42,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":42}}, "id": null, "superClass": { "type": "CallExpression", - "start": 15, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":15,"end":18,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":18}}, "callee": { "type": "Identifier", - "start": 15, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - }, - "identifierName": "f" - }, + "start":15,"end":16,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":16},"identifierName":"f"}, "name": "f" }, "arguments": [] }, "superTypeParameters": { "type": "TSTypeParameterInstantiation", - "start": 18, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":18,"end":21,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":21}}, "params": [ { "type": "TSTypeReference", - "start": 19, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":19,"end":20,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":20}}, "typeName": { "type": "Identifier", - "start": 19, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 20 - }, - "identifierName": "T" - }, + "start":19,"end":20,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":20},"identifierName":"T"}, "name": "T" } } @@ -143,111 +42,31 @@ "implements": [ { "type": "TSExpressionWithTypeArguments", - "start": 33, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 33 - }, - "end": { - "line": 1, - "column": 39 - } - }, + "start":33,"end":39,"loc":{"start":{"line":1,"column":33},"end":{"line":1,"column":39}}, "expression": { "type": "TSQualifiedName", - "start": 33, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 33 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":33,"end":36,"loc":{"start":{"line":1,"column":33},"end":{"line":1,"column":36}}, "left": { "type": "Identifier", - "start": 33, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 33 - }, - "end": { - "line": 1, - "column": 34 - }, - "identifierName": "X" - }, + "start":33,"end":34,"loc":{"start":{"line":1,"column":33},"end":{"line":1,"column":34},"identifierName":"X"}, "name": "X" }, "right": { "type": "Identifier", - "start": 35, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 35 - }, - "end": { - "line": 1, - "column": 36 - }, - "identifierName": "Y" - }, + "start":35,"end":36,"loc":{"start":{"line":1,"column":35},"end":{"line":1,"column":36},"identifierName":"Y"}, "name": "Y" } }, "typeParameters": { "type": "TSTypeParameterInstantiation", - "start": 36, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 36 - }, - "end": { - "line": 1, - "column": 39 - } - }, + "start":36,"end":39,"loc":{"start":{"line":1,"column":36},"end":{"line":1,"column":39}}, "params": [ { "type": "TSTypeReference", - "start": 37, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 37 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":37,"end":38,"loc":{"start":{"line":1,"column":37},"end":{"line":1,"column":38}}, "typeName": { "type": "Identifier", - "start": 37, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 37 - }, - "end": { - "line": 1, - "column": 38 - }, - "identifierName": "T" - }, + "start":37,"end":38,"loc":{"start":{"line":1,"column":37},"end":{"line":1,"column":38},"identifierName":"T"}, "name": "T" } } @@ -257,18 +76,7 @@ ], "body": { "type": "ClassBody", - "start": 40, - "end": 42, - "loc": { - "start": { - "line": 1, - "column": 40 - }, - "end": { - "line": 1, - "column": 42 - } - }, + "start":40,"end":42,"loc":{"start":{"line":1,"column":40},"end":{"line":1,"column":42}}, "body": [] }, "extra": { @@ -279,126 +87,35 @@ }, { "type": "ExpressionStatement", - "start": 45, - "end": 91, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 46 - } - }, + "start":45,"end":91,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":46}}, "expression": { "type": "ClassExpression", - "start": 46, - "end": 89, - "loc": { - "start": { - "line": 2, - "column": 1 - }, - "end": { - "line": 2, - "column": 44 - } - }, + "start":46,"end":89,"loc":{"start":{"line":2,"column":1},"end":{"line":2,"column":44}}, "id": { "type": "Identifier", - "start": 52, - "end": 53, - "loc": { - "start": { - "line": 2, - "column": 7 - }, - "end": { - "line": 2, - "column": 8 - }, - "identifierName": "C" - }, + "start":52,"end":53,"loc":{"start":{"line":2,"column":7},"end":{"line":2,"column":8},"identifierName":"C"}, "name": "C" }, "superClass": { "type": "CallExpression", - "start": 62, - "end": 65, - "loc": { - "start": { - "line": 2, - "column": 17 - }, - "end": { - "line": 2, - "column": 20 - } - }, + "start":62,"end":65,"loc":{"start":{"line":2,"column":17},"end":{"line":2,"column":20}}, "callee": { "type": "Identifier", - "start": 62, - "end": 63, - "loc": { - "start": { - "line": 2, - "column": 17 - }, - "end": { - "line": 2, - "column": 18 - }, - "identifierName": "f" - }, + "start":62,"end":63,"loc":{"start":{"line":2,"column":17},"end":{"line":2,"column":18},"identifierName":"f"}, "name": "f" }, "arguments": [] }, "superTypeParameters": { "type": "TSTypeParameterInstantiation", - "start": 65, - "end": 68, - "loc": { - "start": { - "line": 2, - "column": 20 - }, - "end": { - "line": 2, - "column": 23 - } - }, + "start":65,"end":68,"loc":{"start":{"line":2,"column":20},"end":{"line":2,"column":23}}, "params": [ { "type": "TSTypeReference", - "start": 66, - "end": 67, - "loc": { - "start": { - "line": 2, - "column": 21 - }, - "end": { - "line": 2, - "column": 22 - } - }, + "start":66,"end":67,"loc":{"start":{"line":2,"column":21},"end":{"line":2,"column":22}}, "typeName": { "type": "Identifier", - "start": 66, - "end": 67, - "loc": { - "start": { - "line": 2, - "column": 21 - }, - "end": { - "line": 2, - "column": 22 - }, - "identifierName": "T" - }, + "start":66,"end":67,"loc":{"start":{"line":2,"column":21},"end":{"line":2,"column":22},"identifierName":"T"}, "name": "T" } } @@ -407,111 +124,31 @@ "implements": [ { "type": "TSExpressionWithTypeArguments", - "start": 80, - "end": 86, - "loc": { - "start": { - "line": 2, - "column": 35 - }, - "end": { - "line": 2, - "column": 41 - } - }, + "start":80,"end":86,"loc":{"start":{"line":2,"column":35},"end":{"line":2,"column":41}}, "expression": { "type": "TSQualifiedName", - "start": 80, - "end": 83, - "loc": { - "start": { - "line": 2, - "column": 35 - }, - "end": { - "line": 2, - "column": 38 - } - }, + "start":80,"end":83,"loc":{"start":{"line":2,"column":35},"end":{"line":2,"column":38}}, "left": { "type": "Identifier", - "start": 80, - "end": 81, - "loc": { - "start": { - "line": 2, - "column": 35 - }, - "end": { - "line": 2, - "column": 36 - }, - "identifierName": "X" - }, + "start":80,"end":81,"loc":{"start":{"line":2,"column":35},"end":{"line":2,"column":36},"identifierName":"X"}, "name": "X" }, "right": { "type": "Identifier", - "start": 82, - "end": 83, - "loc": { - "start": { - "line": 2, - "column": 37 - }, - "end": { - "line": 2, - "column": 38 - }, - "identifierName": "Y" - }, + "start":82,"end":83,"loc":{"start":{"line":2,"column":37},"end":{"line":2,"column":38},"identifierName":"Y"}, "name": "Y" } }, "typeParameters": { "type": "TSTypeParameterInstantiation", - "start": 83, - "end": 86, - "loc": { - "start": { - "line": 2, - "column": 38 - }, - "end": { - "line": 2, - "column": 41 - } - }, + "start":83,"end":86,"loc":{"start":{"line":2,"column":38},"end":{"line":2,"column":41}}, "params": [ { "type": "TSTypeReference", - "start": 84, - "end": 85, - "loc": { - "start": { - "line": 2, - "column": 39 - }, - "end": { - "line": 2, - "column": 40 - } - }, + "start":84,"end":85,"loc":{"start":{"line":2,"column":39},"end":{"line":2,"column":40}}, "typeName": { "type": "Identifier", - "start": 84, - "end": 85, - "loc": { - "start": { - "line": 2, - "column": 39 - }, - "end": { - "line": 2, - "column": 40 - }, - "identifierName": "T" - }, + "start":84,"end":85,"loc":{"start":{"line":2,"column":39},"end":{"line":2,"column":40},"identifierName":"T"}, "name": "T" } } @@ -521,18 +158,7 @@ ], "body": { "type": "ClassBody", - "start": 87, - "end": 89, - "loc": { - "start": { - "line": 2, - "column": 42 - }, - "end": { - "line": 2, - "column": 44 - } - }, + "start":87,"end":89,"loc":{"start":{"line":2,"column":42},"end":{"line":2,"column":44}}, "body": [] }, "extra": { diff --git a/packages/babel-parser/test/fixtures/typescript/class/expression-extends/output.json b/packages/babel-parser/test/fixtures/typescript/class/expression-extends/output.json index 079c1b83c16b..a5c79a60acdd 100644 --- a/packages/babel-parser/test/fixtures/typescript/class/expression-extends/output.json +++ b/packages/babel-parser/test/fixtures/typescript/class/expression-extends/output.json @@ -1,140 +1,39 @@ { "type": "File", - "start": 0, - "end": 55, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 28 - } - }, + "start":0,"end":55,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":28}}, "program": { "type": "Program", - "start": 0, - "end": 55, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 28 - } - }, + "start":0,"end":55,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":28}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, "expression": { "type": "ClassExpression", - "start": 1, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":1,"end":24,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":24}}, "id": null, "superClass": { "type": "CallExpression", - "start": 15, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":15,"end":18,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":18}}, "callee": { "type": "Identifier", - "start": 15, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - }, - "identifierName": "f" - }, + "start":15,"end":16,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":16},"identifierName":"f"}, "name": "f" }, "arguments": [] }, "superTypeParameters": { "type": "TSTypeParameterInstantiation", - "start": 18, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":18,"end":21,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":21}}, "params": [ { "type": "TSTypeReference", - "start": 19, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":19,"end":20,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":20}}, "typeName": { "type": "Identifier", - "start": 19, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 20 - }, - "identifierName": "T" - }, + "start":19,"end":20,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":20},"identifierName":"T"}, "name": "T" } } @@ -142,18 +41,7 @@ }, "body": { "type": "ClassBody", - "start": 22, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":22,"end":24,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":24}}, "body": [] }, "extra": { @@ -164,126 +52,35 @@ }, { "type": "ExpressionStatement", - "start": 27, - "end": 55, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 28 - } - }, + "start":27,"end":55,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":28}}, "expression": { "type": "ClassExpression", - "start": 28, - "end": 53, - "loc": { - "start": { - "line": 2, - "column": 1 - }, - "end": { - "line": 2, - "column": 26 - } - }, + "start":28,"end":53,"loc":{"start":{"line":2,"column":1},"end":{"line":2,"column":26}}, "id": { "type": "Identifier", - "start": 34, - "end": 35, - "loc": { - "start": { - "line": 2, - "column": 7 - }, - "end": { - "line": 2, - "column": 8 - }, - "identifierName": "C" - }, + "start":34,"end":35,"loc":{"start":{"line":2,"column":7},"end":{"line":2,"column":8},"identifierName":"C"}, "name": "C" }, "superClass": { "type": "CallExpression", - "start": 44, - "end": 47, - "loc": { - "start": { - "line": 2, - "column": 17 - }, - "end": { - "line": 2, - "column": 20 - } - }, + "start":44,"end":47,"loc":{"start":{"line":2,"column":17},"end":{"line":2,"column":20}}, "callee": { "type": "Identifier", - "start": 44, - "end": 45, - "loc": { - "start": { - "line": 2, - "column": 17 - }, - "end": { - "line": 2, - "column": 18 - }, - "identifierName": "f" - }, + "start":44,"end":45,"loc":{"start":{"line":2,"column":17},"end":{"line":2,"column":18},"identifierName":"f"}, "name": "f" }, "arguments": [] }, "superTypeParameters": { "type": "TSTypeParameterInstantiation", - "start": 47, - "end": 50, - "loc": { - "start": { - "line": 2, - "column": 20 - }, - "end": { - "line": 2, - "column": 23 - } - }, + "start":47,"end":50,"loc":{"start":{"line":2,"column":20},"end":{"line":2,"column":23}}, "params": [ { "type": "TSTypeReference", - "start": 48, - "end": 49, - "loc": { - "start": { - "line": 2, - "column": 21 - }, - "end": { - "line": 2, - "column": 22 - } - }, + "start":48,"end":49,"loc":{"start":{"line":2,"column":21},"end":{"line":2,"column":22}}, "typeName": { "type": "Identifier", - "start": 48, - "end": 49, - "loc": { - "start": { - "line": 2, - "column": 21 - }, - "end": { - "line": 2, - "column": 22 - }, - "identifierName": "T" - }, + "start":48,"end":49,"loc":{"start":{"line":2,"column":21},"end":{"line":2,"column":22},"identifierName":"T"}, "name": "T" } } @@ -291,18 +88,7 @@ }, "body": { "type": "ClassBody", - "start": 51, - "end": 53, - "loc": { - "start": { - "line": 2, - "column": 24 - }, - "end": { - "line": 2, - "column": 26 - } - }, + "start":51,"end":53,"loc":{"start":{"line":2,"column":24},"end":{"line":2,"column":26}}, "body": [] }, "extra": { diff --git a/packages/babel-parser/test/fixtures/typescript/class/expression-generic/output.json b/packages/babel-parser/test/fixtures/typescript/class/expression-generic/output.json index 08401f5d6d9e..1947c1767de2 100644 --- a/packages/babel-parser/test/fixtures/typescript/class/expression-generic/output.json +++ b/packages/babel-parser/test/fixtures/typescript/class/expression-generic/output.json @@ -1,92 +1,26 @@ { "type": "File", - "start": 0, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 16 - } - }, + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":16}}, "program": { "type": "Program", - "start": 0, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 16 - } - }, + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":16}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "expression": { "type": "ClassExpression", - "start": 1, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":1,"end":12,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":12}}, "id": null, "typeParameters": { "type": "TSTypeParameterDeclaration", - "start": 6, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":6,"end":9,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":9}}, "params": [ { "type": "TSTypeParameter", - "start": 7, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8}}, "name": "T" } ] @@ -94,18 +28,7 @@ "superClass": null, "body": { "type": "ClassBody", - "start": 10, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":10,"end":12,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":12}}, "body": [] }, "extra": { @@ -116,78 +39,22 @@ }, { "type": "ExpressionStatement", - "start": 15, - "end": 31, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 16 - } - }, + "start":15,"end":31,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":16}}, "expression": { "type": "ClassExpression", - "start": 16, - "end": 29, - "loc": { - "start": { - "line": 2, - "column": 1 - }, - "end": { - "line": 2, - "column": 14 - } - }, + "start":16,"end":29,"loc":{"start":{"line":2,"column":1},"end":{"line":2,"column":14}}, "id": { "type": "Identifier", - "start": 22, - "end": 23, - "loc": { - "start": { - "line": 2, - "column": 7 - }, - "end": { - "line": 2, - "column": 8 - }, - "identifierName": "C" - }, + "start":22,"end":23,"loc":{"start":{"line":2,"column":7},"end":{"line":2,"column":8},"identifierName":"C"}, "name": "C" }, "typeParameters": { "type": "TSTypeParameterDeclaration", - "start": 23, - "end": 26, - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 11 - } - }, + "start":23,"end":26,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":11}}, "params": [ { "type": "TSTypeParameter", - "start": 24, - "end": 25, - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 10 - } - }, + "start":24,"end":25,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":10}}, "name": "T" } ] @@ -195,18 +62,7 @@ "superClass": null, "body": { "type": "ClassBody", - "start": 27, - "end": 29, - "loc": { - "start": { - "line": 2, - "column": 12 - }, - "end": { - "line": 2, - "column": 14 - } - }, + "start":27,"end":29,"loc":{"start":{"line":2,"column":12},"end":{"line":2,"column":14}}, "body": [] }, "extra": { diff --git a/packages/babel-parser/test/fixtures/typescript/class/expression-implements/output.json b/packages/babel-parser/test/fixtures/typescript/class/expression-implements/output.json index e4478a0a5c71..c1df03485db7 100644 --- a/packages/babel-parser/test/fixtures/typescript/class/expression-implements/output.json +++ b/packages/babel-parser/test/fixtures/typescript/class/expression-implements/output.json @@ -1,171 +1,47 @@ { "type": "File", - "start": 0, - "end": 61, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 31 - } - }, + "start":0,"end":61,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":31}}, "program": { "type": "Program", - "start": 0, - "end": 61, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 31 - } - }, + "start":0,"end":61,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":31}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, "expression": { "type": "ClassExpression", - "start": 1, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":1,"end":27,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":27}}, "superClass": null, "implements": [ { "type": "TSExpressionWithTypeArguments", - "start": 18, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":18,"end":24,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":24}}, "expression": { "type": "TSQualifiedName", - "start": 18, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":18,"end":21,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":21}}, "left": { "type": "Identifier", - "start": 18, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - }, - "identifierName": "X" - }, + "start":18,"end":19,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":19},"identifierName":"X"}, "name": "X" }, "right": { "type": "Identifier", - "start": 20, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 21 - }, - "identifierName": "Y" - }, + "start":20,"end":21,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":21},"identifierName":"Y"}, "name": "Y" } }, "typeParameters": { "type": "TSTypeParameterInstantiation", - "start": 21, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":21,"end":24,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":24}}, "params": [ { "type": "TSTypeReference", - "start": 22, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":22,"end":23,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":23}}, "typeName": { "type": "Identifier", - "start": 22, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 23 - }, - "identifierName": "T" - }, + "start":22,"end":23,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":23},"identifierName":"T"}, "name": "T" } } @@ -175,18 +51,7 @@ ], "body": { "type": "ClassBody", - "start": 25, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":25,"end":27,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":27}}, "body": [] }, "extra": { @@ -197,158 +62,44 @@ }, { "type": "ExpressionStatement", - "start": 30, - "end": 61, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 31 - } - }, + "start":30,"end":61,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":31}}, "expression": { "type": "ClassExpression", - "start": 31, - "end": 59, - "loc": { - "start": { - "line": 2, - "column": 1 - }, - "end": { - "line": 2, - "column": 29 - } - }, + "start":31,"end":59,"loc":{"start":{"line":2,"column":1},"end":{"line":2,"column":29}}, "id": { "type": "Identifier", - "start": 37, - "end": 38, - "loc": { - "start": { - "line": 2, - "column": 7 - }, - "end": { - "line": 2, - "column": 8 - }, - "identifierName": "C" - }, + "start":37,"end":38,"loc":{"start":{"line":2,"column":7},"end":{"line":2,"column":8},"identifierName":"C"}, "name": "C" }, "superClass": null, "implements": [ { "type": "TSExpressionWithTypeArguments", - "start": 50, - "end": 56, - "loc": { - "start": { - "line": 2, - "column": 20 - }, - "end": { - "line": 2, - "column": 26 - } - }, + "start":50,"end":56,"loc":{"start":{"line":2,"column":20},"end":{"line":2,"column":26}}, "expression": { "type": "TSQualifiedName", - "start": 50, - "end": 53, - "loc": { - "start": { - "line": 2, - "column": 20 - }, - "end": { - "line": 2, - "column": 23 - } - }, + "start":50,"end":53,"loc":{"start":{"line":2,"column":20},"end":{"line":2,"column":23}}, "left": { "type": "Identifier", - "start": 50, - "end": 51, - "loc": { - "start": { - "line": 2, - "column": 20 - }, - "end": { - "line": 2, - "column": 21 - }, - "identifierName": "X" - }, + "start":50,"end":51,"loc":{"start":{"line":2,"column":20},"end":{"line":2,"column":21},"identifierName":"X"}, "name": "X" }, "right": { "type": "Identifier", - "start": 52, - "end": 53, - "loc": { - "start": { - "line": 2, - "column": 22 - }, - "end": { - "line": 2, - "column": 23 - }, - "identifierName": "Y" - }, + "start":52,"end":53,"loc":{"start":{"line":2,"column":22},"end":{"line":2,"column":23},"identifierName":"Y"}, "name": "Y" } }, "typeParameters": { "type": "TSTypeParameterInstantiation", - "start": 53, - "end": 56, - "loc": { - "start": { - "line": 2, - "column": 23 - }, - "end": { - "line": 2, - "column": 26 - } - }, + "start":53,"end":56,"loc":{"start":{"line":2,"column":23},"end":{"line":2,"column":26}}, "params": [ { "type": "TSTypeReference", - "start": 54, - "end": 55, - "loc": { - "start": { - "line": 2, - "column": 24 - }, - "end": { - "line": 2, - "column": 25 - } - }, + "start":54,"end":55,"loc":{"start":{"line":2,"column":24},"end":{"line":2,"column":25}}, "typeName": { "type": "Identifier", - "start": 54, - "end": 55, - "loc": { - "start": { - "line": 2, - "column": 24 - }, - "end": { - "line": 2, - "column": 25 - }, - "identifierName": "T" - }, + "start":54,"end":55,"loc":{"start":{"line":2,"column":24},"end":{"line":2,"column":25},"identifierName":"T"}, "name": "T" } } @@ -358,18 +109,7 @@ ], "body": { "type": "ClassBody", - "start": 57, - "end": 59, - "loc": { - "start": { - "line": 2, - "column": 27 - }, - "end": { - "line": 2, - "column": 29 - } - }, + "start":57,"end":59,"loc":{"start":{"line":2,"column":27},"end":{"line":2,"column":29}}, "body": [] }, "extra": { diff --git a/packages/babel-parser/test/fixtures/typescript/class/extends-empty/options.json b/packages/babel-parser/test/fixtures/typescript/class/extends-empty/options.json deleted file mode 100644 index 3de0ab8596c4..000000000000 --- a/packages/babel-parser/test/fixtures/typescript/class/extends-empty/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "'extends' list cannot be empty. (1:22)" -} diff --git a/packages/babel-parser/test/fixtures/typescript/class/extends-empty/output.json b/packages/babel-parser/test/fixtures/typescript/class/extends-empty/output.json new file mode 100644 index 000000000000..c27b6af00f12 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/class/extends-empty/output.json @@ -0,0 +1,31 @@ +{ + "type": "File", + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":1}}, + "errors": [ + "SyntaxError: 'extends' list cannot be empty. (1:22)" + ], + "program": { + "type": "Program", + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":1}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "TSInterfaceDeclaration", + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":1}}, + "id": { + "type": "Identifier", + "start":10,"end":13,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":13},"identifierName":"foo"}, + "name": "foo" + }, + "extends": [], + "body": { + "type": "TSInterfaceBody", + "start":22,"end":25,"loc":{"start":{"line":1,"column":22},"end":{"line":2,"column":1}}, + "body": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/class/extends-implements-empty/options.json b/packages/babel-parser/test/fixtures/typescript/class/extends-implements-empty/options.json deleted file mode 100644 index 950506446835..000000000000 --- a/packages/babel-parser/test/fixtures/typescript/class/extends-implements-empty/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "'implements' list cannot be empty. (1:33)" -} diff --git a/packages/babel-parser/test/fixtures/typescript/class/extends-implements-empty/output.json b/packages/babel-parser/test/fixtures/typescript/class/extends-implements-empty/output.json new file mode 100644 index 000000000000..ba6f83ebb007 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/class/extends-implements-empty/output.json @@ -0,0 +1,36 @@ +{ + "type": "File", + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":1}}, + "errors": [ + "SyntaxError: 'implements' list cannot be empty. (1:33)" + ], + "program": { + "type": "Program", + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":1}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":1}}, + "id": { + "type": "Identifier", + "start":6,"end":9,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":9},"identifierName":"Foo"}, + "name": "Foo" + }, + "superClass": { + "type": "Identifier", + "start":18,"end":21,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":21},"identifierName":"Bar"}, + "name": "Bar" + }, + "implements": [], + "body": { + "type": "ClassBody", + "start":33,"end":36,"loc":{"start":{"line":1,"column":33},"end":{"line":2,"column":1}}, + "body": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/class/extends-implements/output.json b/packages/babel-parser/test/fixtures/typescript/class/extends-implements/output.json index e87b66206434..65b948ab9599 100644 --- a/packages/babel-parser/test/fixtures/typescript/class/extends-implements/output.json +++ b/packages/babel-parser/test/fixtures/typescript/class/extends-implements/output.json @@ -1,142 +1,40 @@ { "type": "File", - "start": 0, - "end": 43, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 43 - } - }, + "start":0,"end":43,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":43}}, "program": { "type": "Program", - "start": 0, - "end": 43, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 43 - } - }, + "start":0,"end":43,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":43}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 43, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 43 - } - }, + "start":0,"end":43,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":43}}, "id": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "C" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"C"}, "name": "C" }, "superClass": { "type": "CallExpression", - "start": 16, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":16,"end":19,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":19}}, "callee": { "type": "Identifier", - "start": 16, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - }, - "identifierName": "f" - }, + "start":16,"end":17,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":17},"identifierName":"f"}, "name": "f" }, "arguments": [] }, "superTypeParameters": { "type": "TSTypeParameterInstantiation", - "start": 19, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":19,"end":22,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":22}}, "params": [ { "type": "TSTypeReference", - "start": 20, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":20,"end":21,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":21}}, "typeName": { "type": "Identifier", - "start": 20, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 21 - }, - "identifierName": "T" - }, + "start":20,"end":21,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":21},"identifierName":"T"}, "name": "T" } } @@ -145,111 +43,31 @@ "implements": [ { "type": "TSExpressionWithTypeArguments", - "start": 34, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 34 - }, - "end": { - "line": 1, - "column": 40 - } - }, + "start":34,"end":40,"loc":{"start":{"line":1,"column":34},"end":{"line":1,"column":40}}, "expression": { "type": "TSQualifiedName", - "start": 34, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 34 - }, - "end": { - "line": 1, - "column": 37 - } - }, + "start":34,"end":37,"loc":{"start":{"line":1,"column":34},"end":{"line":1,"column":37}}, "left": { "type": "Identifier", - "start": 34, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 34 - }, - "end": { - "line": 1, - "column": 35 - }, - "identifierName": "X" - }, + "start":34,"end":35,"loc":{"start":{"line":1,"column":34},"end":{"line":1,"column":35},"identifierName":"X"}, "name": "X" }, "right": { "type": "Identifier", - "start": 36, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 36 - }, - "end": { - "line": 1, - "column": 37 - }, - "identifierName": "Y" - }, + "start":36,"end":37,"loc":{"start":{"line":1,"column":36},"end":{"line":1,"column":37},"identifierName":"Y"}, "name": "Y" } }, "typeParameters": { "type": "TSTypeParameterInstantiation", - "start": 37, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 37 - }, - "end": { - "line": 1, - "column": 40 - } - }, + "start":37,"end":40,"loc":{"start":{"line":1,"column":37},"end":{"line":1,"column":40}}, "params": [ { "type": "TSTypeReference", - "start": 38, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 38 - }, - "end": { - "line": 1, - "column": 39 - } - }, + "start":38,"end":39,"loc":{"start":{"line":1,"column":38},"end":{"line":1,"column":39}}, "typeName": { "type": "Identifier", - "start": 38, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 38 - }, - "end": { - "line": 1, - "column": 39 - }, - "identifierName": "T" - }, + "start":38,"end":39,"loc":{"start":{"line":1,"column":38},"end":{"line":1,"column":39},"identifierName":"T"}, "name": "T" } } @@ -259,18 +77,7 @@ ], "body": { "type": "ClassBody", - "start": 41, - "end": 43, - "loc": { - "start": { - "line": 1, - "column": 41 - }, - "end": { - "line": 1, - "column": 43 - } - }, + "start":41,"end":43,"loc":{"start":{"line":1,"column":41},"end":{"line":1,"column":43}}, "body": [] } } diff --git a/packages/babel-parser/test/fixtures/typescript/class/extends/output.json b/packages/babel-parser/test/fixtures/typescript/class/extends/output.json index 458a092357f2..676b374c2e07 100644 --- a/packages/babel-parser/test/fixtures/typescript/class/extends/output.json +++ b/packages/babel-parser/test/fixtures/typescript/class/extends/output.json @@ -1,142 +1,40 @@ { "type": "File", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, "program": { "type": "Program", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, "id": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "C" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"C"}, "name": "C" }, "superClass": { "type": "CallExpression", - "start": 16, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":16,"end":19,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":19}}, "callee": { "type": "Identifier", - "start": 16, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - }, - "identifierName": "f" - }, + "start":16,"end":17,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":17},"identifierName":"f"}, "name": "f" }, "arguments": [] }, "superTypeParameters": { "type": "TSTypeParameterInstantiation", - "start": 19, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":19,"end":22,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":22}}, "params": [ { "type": "TSTypeReference", - "start": 20, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":20,"end":21,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":21}}, "typeName": { "type": "Identifier", - "start": 20, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 21 - }, - "identifierName": "T" - }, + "start":20,"end":21,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":21},"identifierName":"T"}, "name": "T" } } @@ -144,18 +42,7 @@ }, "body": { "type": "ClassBody", - "start": 23, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":23,"end":25,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":25}}, "body": [] } } diff --git a/packages/babel-parser/test/fixtures/typescript/class/generic/output.json b/packages/babel-parser/test/fixtures/typescript/class/generic/output.json index eed6e29d71cf..a01ce54b0ac2 100644 --- a/packages/babel-parser/test/fixtures/typescript/class/generic/output.json +++ b/packages/babel-parser/test/fixtures/typescript/class/generic/output.json @@ -1,185 +1,51 @@ { "type": "File", - "start": 0, - "end": 44, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 44 - } - }, + "start":0,"end":44,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":44}}, "program": { "type": "Program", - "start": 0, - "end": 44, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 44 - } - }, + "start":0,"end":44,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":44}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 44, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 44 - } - }, + "start":0,"end":44,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":44}}, "id": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "C" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"C"}, "name": "C" }, "typeParameters": { "type": "TSTypeParameterDeclaration", - "start": 7, - "end": 41, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 41 - } - }, + "start":7,"end":41,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":41}}, "params": [ { "type": "TSTypeParameter", - "start": 8, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 40 - } - }, + "start":8,"end":40,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":40}}, "name": "T", "constraint": { "type": "TSObjectKeyword", - "start": 18, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 24 - } - } + "start":18,"end":24,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":24}} }, "default": { "type": "TSTypeLiteral", - "start": 27, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 40 - } - }, + "start":27,"end":40,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":40}}, "members": [ { "type": "TSPropertySignature", - "start": 29, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":29,"end":38,"loc":{"start":{"line":1,"column":29},"end":{"line":1,"column":38}}, "key": { "type": "Identifier", - "start": 29, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 1, - "column": 30 - }, - "identifierName": "x" - }, + "start":29,"end":30,"loc":{"start":{"line":1,"column":29},"end":{"line":1,"column":30},"identifierName":"x"}, "name": "x" }, "computed": false, "typeAnnotation": { "type": "TSTypeAnnotation", - "start": 30, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":30,"end":38,"loc":{"start":{"line":1,"column":30},"end":{"line":1,"column":38}}, "typeAnnotation": { "type": "TSNumberKeyword", - "start": 32, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 32 - }, - "end": { - "line": 1, - "column": 38 - } - } + "start":32,"end":38,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":38}} } } } @@ -191,18 +57,7 @@ "superClass": null, "body": { "type": "ClassBody", - "start": 42, - "end": 44, - "loc": { - "start": { - "line": 1, - "column": 42 - }, - "end": { - "line": 1, - "column": 44 - } - }, + "start":42,"end":44,"loc":{"start":{"line":1,"column":42},"end":{"line":1,"column":44}}, "body": [] } } diff --git a/packages/babel-parser/test/fixtures/typescript/class/get-generic/output.json b/packages/babel-parser/test/fixtures/typescript/class/get-generic/output.json index bdf468513b3e..19af433cd482 100644 --- a/packages/babel-parser/test/fixtures/typescript/class/get-generic/output.json +++ b/packages/babel-parser/test/fixtures/typescript/class/get-generic/output.json @@ -1,144 +1,44 @@ { "type": "File", - "start": 0, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "declare": true, "id": { "type": "Identifier", - "start": 14, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - }, - "identifierName": "C" - }, + "start":14,"end":15,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":15},"identifierName":"C"}, "name": "C" }, "superClass": null, "body": { "type": "ClassBody", - "start": 16, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":16,"end":39,"loc":{"start":{"line":1,"column":16},"end":{"line":3,"column":1}}, "body": [ { "type": "TSDeclareMethod", - "start": 22, - "end": 37, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 19 - } - }, + "start":22,"end":37,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":19}}, "static": false, "key": { "type": "Identifier", - "start": 22, - "end": 25, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 7 - }, - "identifierName": "get" - }, + "start":22,"end":25,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":7},"identifierName":"get"}, "name": "get" }, "computed": false, "kind": "method", "typeParameters": { "type": "TSTypeParameterDeclaration", - "start": 25, - "end": 28, - "loc": { - "start": { - "line": 2, - "column": 7 - }, - "end": { - "line": 2, - "column": 10 - } - }, + "start":25,"end":28,"loc":{"start":{"line":2,"column":7},"end":{"line":2,"column":10}}, "params": [ { "type": "TSTypeParameter", - "start": 26, - "end": 27, - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 9 - } - }, + "start":26,"end":27,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":9}}, "name": "T" } ] @@ -149,38 +49,15 @@ "params": [], "returnType": { "type": "TSTypeAnnotation", - "start": 30, - "end": 36, - "loc": { - "start": { - "line": 2, - "column": 12 - }, - "end": { - "line": 2, - "column": 18 - } - }, + "start":30,"end":36,"loc":{"start":{"line":2,"column":12},"end":{"line":2,"column":18}}, "typeAnnotation": { "type": "TSVoidKeyword", - "start": 32, - "end": 36, - "loc": { - "start": { - "line": 2, - "column": 14 - }, - "end": { - "line": 2, - "column": 18 - } - } + "start":32,"end":36,"loc":{"start":{"line":2,"column":14},"end":{"line":2,"column":18}} } } } ] - }, - "declare": true + } } ], "directives": [] diff --git a/packages/babel-parser/test/fixtures/typescript/class/implements-empty/options.json b/packages/babel-parser/test/fixtures/typescript/class/implements-empty/options.json deleted file mode 100644 index 6751fbcc5443..000000000000 --- a/packages/babel-parser/test/fixtures/typescript/class/implements-empty/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "'implements' list cannot be empty. (1:21)" -} diff --git a/packages/babel-parser/test/fixtures/typescript/class/implements-empty/output.json b/packages/babel-parser/test/fixtures/typescript/class/implements-empty/output.json new file mode 100644 index 000000000000..19e0d7bc5a9e --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/class/implements-empty/output.json @@ -0,0 +1,32 @@ +{ + "type": "File", + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":1}}, + "errors": [ + "SyntaxError: 'implements' list cannot be empty. (1:21)" + ], + "program": { + "type": "Program", + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":1}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":1}}, + "id": { + "type": "Identifier", + "start":6,"end":9,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":9},"identifierName":"Foo"}, + "name": "Foo" + }, + "superClass": null, + "implements": [], + "body": { + "type": "ClassBody", + "start":21,"end":24,"loc":{"start":{"line":1,"column":21},"end":{"line":2,"column":1}}, + "body": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/class/implements/output.json b/packages/babel-parser/test/fixtures/typescript/class/implements/output.json index 2117403c6176..931c3c99a40c 100644 --- a/packages/babel-parser/test/fixtures/typescript/class/implements/output.json +++ b/packages/babel-parser/test/fixtures/typescript/class/implements/output.json @@ -1,174 +1,49 @@ { "type": "File", - "start": 0, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, "program": { "type": "Program", - "start": 0, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, "id": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "C" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"C"}, "name": "C" }, "superClass": null, "implements": [ { "type": "TSExpressionWithTypeArguments", - "start": 19, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":19,"end":25,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":25}}, "expression": { "type": "TSQualifiedName", - "start": 19, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":19,"end":22,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":22}}, "left": { "type": "Identifier", - "start": 19, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 20 - }, - "identifierName": "X" - }, + "start":19,"end":20,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":20},"identifierName":"X"}, "name": "X" }, "right": { "type": "Identifier", - "start": 21, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 22 - }, - "identifierName": "Y" - }, + "start":21,"end":22,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":22},"identifierName":"Y"}, "name": "Y" } }, "typeParameters": { "type": "TSTypeParameterInstantiation", - "start": 22, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":22,"end":25,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":25}}, "params": [ { "type": "TSTypeReference", - "start": 23, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":23,"end":24,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":24}}, "typeName": { "type": "Identifier", - "start": 23, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 24 - }, - "identifierName": "T" - }, + "start":23,"end":24,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":24},"identifierName":"T"}, "name": "T" } } @@ -178,18 +53,7 @@ ], "body": { "type": "ClassBody", - "start": 26, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":26,"end":28,"loc":{"start":{"line":1,"column":26},"end":{"line":1,"column":28}}, "body": [] } } diff --git a/packages/babel-parser/test/fixtures/typescript/class/index-signature/output.json b/packages/babel-parser/test/fixtures/typescript/class/index-signature/output.json index b1b3fd1a3517..3e05b3479d18 100644 --- a/packages/babel-parser/test/fixtures/typescript/class/index-signature/output.json +++ b/packages/babel-parser/test/fixtures/typescript/class/index-signature/output.json @@ -1,267 +1,77 @@ { "type": "File", - "start": 0, - "end": 64, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":0,"end":64,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 64, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":0,"end":64,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 64, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":0,"end":64,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, "id": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "C" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"C"}, "name": "C" }, "superClass": null, "body": { "type": "ClassBody", - "start": 8, - "end": 64, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":8,"end":64,"loc":{"start":{"line":1,"column":8},"end":{"line":4,"column":1}}, "body": [ { "type": "TSIndexSignature", - "start": 14, - "end": 31, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 21 - } - }, + "start":14,"end":31,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":21}}, "parameters": [ { "type": "Identifier", - "start": 15, - "end": 24, - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 14 - }, - "identifierName": "x" - }, + "start":15,"end":24,"loc":{"start":{"line":2,"column":5},"end":{"line":2,"column":14},"identifierName":"x"}, "name": "x", "typeAnnotation": { "type": "TSTypeAnnotation", - "start": 16, - "end": 24, - "loc": { - "start": { - "line": 2, - "column": 6 - }, - "end": { - "line": 2, - "column": 14 - } - }, + "start":16,"end":24,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":14}}, "typeAnnotation": { "type": "TSStringKeyword", - "start": 18, - "end": 24, - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 14 - } - } + "start":18,"end":24,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":14}} } } } ], "typeAnnotation": { "type": "TSTypeAnnotation", - "start": 25, - "end": 30, - "loc": { - "start": { - "line": 2, - "column": 15 - }, - "end": { - "line": 2, - "column": 20 - } - }, + "start":25,"end":30,"loc":{"start":{"line":2,"column":15},"end":{"line":2,"column":20}}, "typeAnnotation": { "type": "TSAnyKeyword", - "start": 27, - "end": 30, - "loc": { - "start": { - "line": 2, - "column": 17 - }, - "end": { - "line": 2, - "column": 20 - } - } + "start":27,"end":30,"loc":{"start":{"line":2,"column":17},"end":{"line":2,"column":20}} } } }, { "type": "TSIndexSignature", - "start": 36, - "end": 62, - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 30 - } - }, + "start":36,"end":62,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":30}}, "readonly": true, "parameters": [ { "type": "Identifier", - "start": 46, - "end": 55, - "loc": { - "start": { - "line": 3, - "column": 14 - }, - "end": { - "line": 3, - "column": 23 - }, - "identifierName": "x" - }, + "start":46,"end":55,"loc":{"start":{"line":3,"column":14},"end":{"line":3,"column":23},"identifierName":"x"}, "name": "x", "typeAnnotation": { "type": "TSTypeAnnotation", - "start": 47, - "end": 55, - "loc": { - "start": { - "line": 3, - "column": 15 - }, - "end": { - "line": 3, - "column": 23 - } - }, + "start":47,"end":55,"loc":{"start":{"line":3,"column":15},"end":{"line":3,"column":23}}, "typeAnnotation": { "type": "TSStringKeyword", - "start": 49, - "end": 55, - "loc": { - "start": { - "line": 3, - "column": 17 - }, - "end": { - "line": 3, - "column": 23 - } - } + "start":49,"end":55,"loc":{"start":{"line":3,"column":17},"end":{"line":3,"column":23}} } } } ], "typeAnnotation": { "type": "TSTypeAnnotation", - "start": 56, - "end": 61, - "loc": { - "start": { - "line": 3, - "column": 24 - }, - "end": { - "line": 3, - "column": 29 - } - }, + "start":56,"end":61,"loc":{"start":{"line":3,"column":24},"end":{"line":3,"column":29}}, "typeAnnotation": { "type": "TSAnyKeyword", - "start": 58, - "end": 61, - "loc": { - "start": { - "line": 3, - "column": 26 - }, - "end": { - "line": 3, - "column": 29 - } - } + "start":58,"end":61,"loc":{"start":{"line":3,"column":26},"end":{"line":3,"column":29}} } } } diff --git a/packages/babel-parser/test/fixtures/typescript/class/members-with-modifier-names/output.json b/packages/babel-parser/test/fixtures/typescript/class/members-with-modifier-names/output.json index bcd481d869bd..6619ed4663eb 100644 --- a/packages/babel-parser/test/fixtures/typescript/class/members-with-modifier-names/output.json +++ b/packages/babel-parser/test/fixtures/typescript/class/members-with-modifier-names/output.json @@ -1,111 +1,32 @@ { "type": "File", - "start": 0, - "end": 118, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 7, - "column": 1 - } - }, + "start":0,"end":118,"loc":{"start":{"line":1,"column":0},"end":{"line":7,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 118, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 7, - "column": 1 - } - }, + "start":0,"end":118,"loc":{"start":{"line":1,"column":0},"end":{"line":7,"column":1}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 118, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 7, - "column": 1 - } - }, + "start":0,"end":118,"loc":{"start":{"line":1,"column":0},"end":{"line":7,"column":1}}, "id": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "C" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"C"}, "name": "C" }, "superClass": null, "body": { "type": "ClassBody", - "start": 8, - "end": 118, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 7, - "column": 1 - } - }, + "start":8,"end":118,"loc":{"start":{"line":1,"column":8},"end":{"line":7,"column":1}}, "body": [ { "type": "TSDeclareMethod", - "start": 14, - "end": 29, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 19 - } - }, + "start":14,"end":29,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":19}}, "static": false, "key": { "type": "Identifier", - "start": 14, - "end": 20, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 10 - }, - "identifierName": "public" - }, + "start":14,"end":20,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":10},"identifierName":"public"}, "name": "public" }, "computed": false, @@ -116,67 +37,22 @@ "params": [], "returnType": { "type": "TSTypeAnnotation", - "start": 22, - "end": 28, - "loc": { - "start": { - "line": 2, - "column": 12 - }, - "end": { - "line": 2, - "column": 18 - } - }, + "start":22,"end":28,"loc":{"start":{"line":2,"column":12},"end":{"line":2,"column":18}}, "typeAnnotation": { "type": "TSVoidKeyword", - "start": 24, - "end": 28, - "loc": { - "start": { - "line": 2, - "column": 14 - }, - "end": { - "line": 2, - "column": 18 - } - } + "start":24,"end":28,"loc":{"start":{"line":2,"column":14},"end":{"line":2,"column":18}} } } }, { "type": "TSDeclareMethod", - "start": 34, - "end": 56, - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 26 - } - }, + "start":34,"end":56,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":26}}, "accessibility": "public", "kind": "method", "computed": false, "key": { "type": "Identifier", - "start": 41, - "end": 47, - "loc": { - "start": { - "line": 3, - "column": 11 - }, - "end": { - "line": 3, - "column": 17 - }, - "identifierName": "static" - }, + "start":41,"end":47,"loc":{"start":{"line":3,"column":11},"end":{"line":3,"column":17},"identifierName":"static"}, "name": "static" }, "static": false, @@ -186,82 +62,26 @@ "params": [], "returnType": { "type": "TSTypeAnnotation", - "start": 49, - "end": 55, - "loc": { - "start": { - "line": 3, - "column": 19 - }, - "end": { - "line": 3, - "column": 25 - } - }, + "start":49,"end":55,"loc":{"start":{"line":3,"column":19},"end":{"line":3,"column":25}}, "typeAnnotation": { "type": "TSVoidKeyword", - "start": 51, - "end": 55, - "loc": { - "start": { - "line": 3, - "column": 21 - }, - "end": { - "line": 3, - "column": 25 - } - } + "start":51,"end":55,"loc":{"start":{"line":3,"column":21},"end":{"line":3,"column":25}} } } }, { "type": "ClassProperty", - "start": 61, - "end": 74, - "loc": { - "start": { - "line": 4, - "column": 4 - }, - "end": { - "line": 4, - "column": 17 - } - }, + "start":61,"end":74,"loc":{"start":{"line":4,"column":4},"end":{"line":4,"column":17}}, "static": false, "key": { "type": "Identifier", - "start": 61, - "end": 69, - "loc": { - "start": { - "line": 4, - "column": 4 - }, - "end": { - "line": 4, - "column": 12 - }, - "identifierName": "readonly" - }, + "start":61,"end":69,"loc":{"start":{"line":4,"column":4},"end":{"line":4,"column":12},"identifierName":"readonly"}, "name": "readonly" }, "computed": false, "value": { "type": "NumericLiteral", - "start": 72, - "end": 73, - "loc": { - "start": { - "line": 4, - "column": 15 - }, - "end": { - "line": 4, - "column": 16 - } - }, + "start":72,"end":73,"loc":{"start":{"line":4,"column":15},"end":{"line":4,"column":16}}, "extra": { "rawValue": 0, "raw": "0" @@ -271,67 +91,22 @@ }, { "type": "TSDeclareMethod", - "start": 79, - "end": 96, - "loc": { - "start": { - "line": 5, - "column": 4 - }, - "end": { - "line": 5, - "column": 21 - } - }, + "start":79,"end":96,"loc":{"start":{"line":5,"column":4},"end":{"line":5,"column":21}}, "static": false, "key": { "type": "Identifier", - "start": 79, - "end": 84, - "loc": { - "start": { - "line": 5, - "column": 4 - }, - "end": { - "line": 5, - "column": 9 - }, - "identifierName": "async" - }, + "start":79,"end":84,"loc":{"start":{"line":5,"column":4},"end":{"line":5,"column":9},"identifierName":"async"}, "name": "async" }, "computed": false, "kind": "method", "typeParameters": { "type": "TSTypeParameterDeclaration", - "start": 84, - "end": 87, - "loc": { - "start": { - "line": 5, - "column": 9 - }, - "end": { - "line": 5, - "column": 12 - } - }, + "start":84,"end":87,"loc":{"start":{"line":5,"column":9},"end":{"line":5,"column":12}}, "params": [ { "type": "TSTypeParameter", - "start": 85, - "end": 86, - "loc": { - "start": { - "line": 5, - "column": 10 - }, - "end": { - "line": 5, - "column": 11 - } - }, + "start":85,"end":86,"loc":{"start":{"line":5,"column":10},"end":{"line":5,"column":11}}, "name": "T" } ] @@ -342,97 +117,30 @@ "params": [], "returnType": { "type": "TSTypeAnnotation", - "start": 89, - "end": 95, - "loc": { - "start": { - "line": 5, - "column": 14 - }, - "end": { - "line": 5, - "column": 20 - } - }, + "start":89,"end":95,"loc":{"start":{"line":5,"column":14},"end":{"line":5,"column":20}}, "typeAnnotation": { "type": "TSVoidKeyword", - "start": 91, - "end": 95, - "loc": { - "start": { - "line": 5, - "column": 16 - }, - "end": { - "line": 5, - "column": 20 - } - } + "start":91,"end":95,"loc":{"start":{"line":5,"column":16},"end":{"line":5,"column":20}} } } }, { "type": "ClassProperty", - "start": 101, - "end": 116, - "loc": { - "start": { - "line": 6, - "column": 4 - }, - "end": { - "line": 6, - "column": 19 - } - }, + "start":101,"end":116,"loc":{"start":{"line":6,"column":4},"end":{"line":6,"column":19}}, "static": false, "key": { "type": "Identifier", - "start": 101, - "end": 109, - "loc": { - "start": { - "line": 6, - "column": 4 - }, - "end": { - "line": 6, - "column": 12 - }, - "identifierName": "abstract" - }, + "start":101,"end":109,"loc":{"start":{"line":6,"column":4},"end":{"line":6,"column":12},"identifierName":"abstract"}, "name": "abstract" }, "computed": false, "definite": true, "typeAnnotation": { "type": "TSTypeAnnotation", - "start": 110, - "end": 115, - "loc": { - "start": { - "line": 6, - "column": 13 - }, - "end": { - "line": 6, - "column": 18 - } - }, + "start":110,"end":115,"loc":{"start":{"line":6,"column":13},"end":{"line":6,"column":18}}, "typeAnnotation": { "type": "TSVoidKeyword", - "start": 111, - "end": 115, - "loc": { - "start": { - "line": 6, - "column": 14 - }, - "end": { - "line": 6, - "column": 18 - } - } + "start":111,"end":115,"loc":{"start":{"line":6,"column":14},"end":{"line":6,"column":18}} } }, "value": null diff --git a/packages/babel-parser/test/fixtures/typescript/class/members-with-reserved-names/output.json b/packages/babel-parser/test/fixtures/typescript/class/members-with-reserved-names/output.json index b386e7aadfaf..e73309d58279 100644 --- a/packages/babel-parser/test/fixtures/typescript/class/members-with-reserved-names/output.json +++ b/packages/babel-parser/test/fixtures/typescript/class/members-with-reserved-names/output.json @@ -1,112 +1,33 @@ { "type": "File", - "start": 0, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "id": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "C" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"C"}, "name": "C" }, "superClass": null, "body": { "type": "ClassBody", - "start": 8, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":8,"end":38,"loc":{"start":{"line":1,"column":8},"end":{"line":3,"column":1}}, "body": [ { "type": "TSDeclareMethod", - "start": 14, - "end": 36, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 26 - } - }, + "start":14,"end":36,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":26}}, "accessibility": "public", "static": false, "key": { "type": "Identifier", - "start": 21, - "end": 27, - "loc": { - "start": { - "line": 2, - "column": 11 - }, - "end": { - "line": 2, - "column": 17 - }, - "identifierName": "delete" - }, + "start":21,"end":27,"loc":{"start":{"line":2,"column":11},"end":{"line":2,"column":17},"identifierName":"delete"}, "name": "delete" }, "computed": false, @@ -117,32 +38,10 @@ "params": [], "returnType": { "type": "TSTypeAnnotation", - "start": 29, - "end": 35, - "loc": { - "start": { - "line": 2, - "column": 19 - }, - "end": { - "line": 2, - "column": 25 - } - }, + "start":29,"end":35,"loc":{"start":{"line":2,"column":19},"end":{"line":2,"column":25}}, "typeAnnotation": { "type": "TSVoidKeyword", - "start": 31, - "end": 35, - "loc": { - "start": { - "line": 2, - "column": 21 - }, - "end": { - "line": 2, - "column": 25 - } - } + "start":31,"end":35,"loc":{"start":{"line":2,"column":21},"end":{"line":2,"column":25}} } } } diff --git a/packages/babel-parser/test/fixtures/typescript/class/method-computed/output.json b/packages/babel-parser/test/fixtures/typescript/class/method-computed/output.json index e1021cdafaa1..48a27c3f99cd 100644 --- a/packages/babel-parser/test/fixtures/typescript/class/method-computed/output.json +++ b/packages/babel-parser/test/fixtures/typescript/class/method-computed/output.json @@ -1,143 +1,41 @@ { "type": "File", - "start": 0, - "end": 74, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":0,"end":74,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 74, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":0,"end":74,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 74, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":0,"end":74,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, "id": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "C" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"C"}, "name": "C" }, "superClass": null, "body": { "type": "ClassBody", - "start": 8, - "end": 74, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":8,"end":74,"loc":{"start":{"line":1,"column":8},"end":{"line":4,"column":1}}, "body": [ { "type": "TSDeclareMethod", - "start": 14, - "end": 40, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 30 - } - }, + "start":14,"end":40,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":30}}, "static": false, "computed": true, "key": { "type": "MemberExpression", - "start": 15, - "end": 30, - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 20 - } - }, + "start":15,"end":30,"loc":{"start":{"line":2,"column":5},"end":{"line":2,"column":20}}, "object": { "type": "Identifier", - "start": 15, - "end": 21, - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 11 - }, - "identifierName": "Symbol" - }, + "start":15,"end":21,"loc":{"start":{"line":2,"column":5},"end":{"line":2,"column":11},"identifierName":"Symbol"}, "name": "Symbol" }, "property": { "type": "Identifier", - "start": 22, - "end": 30, - "loc": { - "start": { - "line": 2, - "column": 12 - }, - "end": { - "line": 2, - "column": 20 - }, - "identifierName": "iterator" - }, + "start":22,"end":30,"loc":{"start":{"line":2,"column":12},"end":{"line":2,"column":20},"identifierName":"iterator"}, "name": "iterator" }, "computed": false @@ -149,97 +47,29 @@ "params": [], "returnType": { "type": "TSTypeAnnotation", - "start": 33, - "end": 39, - "loc": { - "start": { - "line": 2, - "column": 23 - }, - "end": { - "line": 2, - "column": 29 - } - }, + "start":33,"end":39,"loc":{"start":{"line":2,"column":23},"end":{"line":2,"column":29}}, "typeAnnotation": { "type": "TSVoidKeyword", - "start": 35, - "end": 39, - "loc": { - "start": { - "line": 2, - "column": 25 - }, - "end": { - "line": 2, - "column": 29 - } - } + "start":35,"end":39,"loc":{"start":{"line":2,"column":25},"end":{"line":2,"column":29}} } } }, { "type": "TSDeclareMethod", - "start": 45, - "end": 72, - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 31 - } - }, + "start":45,"end":72,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":31}}, "static": false, "computed": true, "key": { "type": "MemberExpression", - "start": 46, - "end": 61, - "loc": { - "start": { - "line": 3, - "column": 5 - }, - "end": { - "line": 3, - "column": 20 - } - }, + "start":46,"end":61,"loc":{"start":{"line":3,"column":5},"end":{"line":3,"column":20}}, "object": { "type": "Identifier", - "start": 46, - "end": 52, - "loc": { - "start": { - "line": 3, - "column": 5 - }, - "end": { - "line": 3, - "column": 11 - }, - "identifierName": "Symbol" - }, + "start":46,"end":52,"loc":{"start":{"line":3,"column":5},"end":{"line":3,"column":11},"identifierName":"Symbol"}, "name": "Symbol" }, "property": { "type": "Identifier", - "start": 53, - "end": 61, - "loc": { - "start": { - "line": 3, - "column": 12 - }, - "end": { - "line": 3, - "column": 20 - }, - "identifierName": "iterator" - }, + "start":53,"end":61,"loc":{"start":{"line":3,"column":12},"end":{"line":3,"column":20},"identifierName":"iterator"}, "name": "iterator" }, "computed": false @@ -252,32 +82,10 @@ "params": [], "returnType": { "type": "TSTypeAnnotation", - "start": 65, - "end": 71, - "loc": { - "start": { - "line": 3, - "column": 24 - }, - "end": { - "line": 3, - "column": 30 - } - }, + "start":65,"end":71,"loc":{"start":{"line":3,"column":24},"end":{"line":3,"column":30}}, "typeAnnotation": { "type": "TSVoidKeyword", - "start": 67, - "end": 71, - "loc": { - "start": { - "line": 3, - "column": 26 - }, - "end": { - "line": 3, - "column": 30 - } - } + "start":67,"end":71,"loc":{"start":{"line":3,"column":26},"end":{"line":3,"column":30}} } } } diff --git a/packages/babel-parser/test/fixtures/typescript/class/method-generic/output.json b/packages/babel-parser/test/fixtures/typescript/class/method-generic/output.json index 568975c0bd63..390658ca6609 100644 --- a/packages/babel-parser/test/fixtures/typescript/class/method-generic/output.json +++ b/packages/babel-parser/test/fixtures/typescript/class/method-generic/output.json @@ -1,144 +1,43 @@ { "type": "File", - "start": 0, - "end": 83, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":0,"end":83,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 83, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":0,"end":83,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 83, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":0,"end":83,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, "id": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "C" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"C"}, "name": "C" }, "superClass": null, "body": { "type": "ClassBody", - "start": 8, - "end": 83, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":8,"end":83,"loc":{"start":{"line":1,"column":8},"end":{"line":4,"column":1}}, "body": [ { "type": "ClassMethod", - "start": 14, - "end": 48, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 38 - } - }, + "start":14,"end":48,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":38}}, "static": false, "key": { "type": "Identifier", - "start": 14, - "end": 15, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 5 - }, - "identifierName": "f" - }, + "start":14,"end":15,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":5},"identifierName":"f"}, "name": "f" }, "computed": false, "kind": "method", "typeParameters": { "type": "TSTypeParameterDeclaration", - "start": 15, - "end": 18, - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 8 - } - }, + "start":15,"end":18,"loc":{"start":{"line":2,"column":5},"end":{"line":2,"column":8}}, "params": [ { "type": "TSTypeParameter", - "start": 16, - "end": 17, - "loc": { - "start": { - "line": 2, - "column": 6 - }, - "end": { - "line": 2, - "column": 7 - } - }, + "start":16,"end":17,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":7}}, "name": "T" } ] @@ -149,63 +48,17 @@ "params": [ { "type": "Identifier", - "start": 19, - "end": 23, - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 13 - }, - "identifierName": "a" - }, + "start":19,"end":23,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":13},"identifierName":"a"}, "name": "a", "typeAnnotation": { "type": "TSTypeAnnotation", - "start": 20, - "end": 23, - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 13 - } - }, + "start":20,"end":23,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":13}}, "typeAnnotation": { "type": "TSTypeReference", - "start": 22, - "end": 23, - "loc": { - "start": { - "line": 2, - "column": 12 - }, - "end": { - "line": 2, - "column": 13 - } - }, + "start":22,"end":23,"loc":{"start":{"line":2,"column":12},"end":{"line":2,"column":13}}, "typeName": { "type": "Identifier", - "start": 22, - "end": 23, - "loc": { - "start": { - "line": 2, - "column": 12 - }, - "end": { - "line": 2, - "column": 13 - }, - "identifierName": "T" - }, + "start":22,"end":23,"loc":{"start":{"line":2,"column":12},"end":{"line":2,"column":13},"identifierName":"T"}, "name": "T" } } @@ -213,64 +66,18 @@ }, { "type": "Identifier", - "start": 25, - "end": 30, - "loc": { - "start": { - "line": 2, - "column": 15 - }, - "end": { - "line": 2, - "column": 20 - }, - "identifierName": "b" - }, + "start":25,"end":30,"loc":{"start":{"line":2,"column":15},"end":{"line":2,"column":20},"identifierName":"b"}, "name": "b", "optional": true, "typeAnnotation": { "type": "TSTypeAnnotation", - "start": 27, - "end": 30, - "loc": { - "start": { - "line": 2, - "column": 17 - }, - "end": { - "line": 2, - "column": 20 - } - }, + "start":27,"end":30,"loc":{"start":{"line":2,"column":17},"end":{"line":2,"column":20}}, "typeAnnotation": { "type": "TSTypeReference", - "start": 29, - "end": 30, - "loc": { - "start": { - "line": 2, - "column": 19 - }, - "end": { - "line": 2, - "column": 20 - } - }, + "start":29,"end":30,"loc":{"start":{"line":2,"column":19},"end":{"line":2,"column":20}}, "typeName": { "type": "Identifier", - "start": 29, - "end": 30, - "loc": { - "start": { - "line": 2, - "column": 19 - }, - "end": { - "line": 2, - "column": 20 - }, - "identifierName": "T" - }, + "start":29,"end":30,"loc":{"start":{"line":2,"column":19},"end":{"line":2,"column":20},"identifierName":"T"}, "name": "T" } } @@ -278,92 +85,24 @@ }, { "type": "RestElement", - "start": 32, - "end": 41, - "loc": { - "start": { - "line": 2, - "column": 22 - }, - "end": { - "line": 2, - "column": 31 - } - }, + "start":32,"end":41,"loc":{"start":{"line":2,"column":22},"end":{"line":2,"column":31}}, "argument": { "type": "Identifier", - "start": 35, - "end": 36, - "loc": { - "start": { - "line": 2, - "column": 25 - }, - "end": { - "line": 2, - "column": 26 - }, - "identifierName": "c" - }, + "start":35,"end":36,"loc":{"start":{"line":2,"column":25},"end":{"line":2,"column":26},"identifierName":"c"}, "name": "c" }, "typeAnnotation": { "type": "TSTypeAnnotation", - "start": 36, - "end": 41, - "loc": { - "start": { - "line": 2, - "column": 26 - }, - "end": { - "line": 2, - "column": 31 - } - }, + "start":36,"end":41,"loc":{"start":{"line":2,"column":26},"end":{"line":2,"column":31}}, "typeAnnotation": { "type": "TSArrayType", - "start": 38, - "end": 41, - "loc": { - "start": { - "line": 2, - "column": 28 - }, - "end": { - "line": 2, - "column": 31 - } - }, + "start":38,"end":41,"loc":{"start":{"line":2,"column":28},"end":{"line":2,"column":31}}, "elementType": { "type": "TSTypeReference", - "start": 38, - "end": 39, - "loc": { - "start": { - "line": 2, - "column": 28 - }, - "end": { - "line": 2, - "column": 29 - } - }, + "start":38,"end":39,"loc":{"start":{"line":2,"column":28},"end":{"line":2,"column":29}}, "typeName": { "type": "Identifier", - "start": 38, - "end": 39, - "loc": { - "start": { - "line": 2, - "column": 28 - }, - "end": { - "line": 2, - "column": 29 - }, - "identifierName": "T" - }, + "start":38,"end":39,"loc":{"start":{"line":2,"column":28},"end":{"line":2,"column":29},"identifierName":"T"}, "name": "T" } } @@ -373,131 +112,40 @@ ], "returnType": { "type": "TSTypeAnnotation", - "start": 42, - "end": 45, - "loc": { - "start": { - "line": 2, - "column": 32 - }, - "end": { - "line": 2, - "column": 35 - } - }, + "start":42,"end":45,"loc":{"start":{"line":2,"column":32},"end":{"line":2,"column":35}}, "typeAnnotation": { "type": "TSTypeReference", - "start": 44, - "end": 45, - "loc": { - "start": { - "line": 2, - "column": 34 - }, - "end": { - "line": 2, - "column": 35 - } - }, + "start":44,"end":45,"loc":{"start":{"line":2,"column":34},"end":{"line":2,"column":35}}, "typeName": { "type": "Identifier", - "start": 44, - "end": 45, - "loc": { - "start": { - "line": 2, - "column": 34 - }, - "end": { - "line": 2, - "column": 35 - }, - "identifierName": "T" - }, + "start":44,"end":45,"loc":{"start":{"line":2,"column":34},"end":{"line":2,"column":35},"identifierName":"T"}, "name": "T" } } }, "body": { "type": "BlockStatement", - "start": 46, - "end": 48, - "loc": { - "start": { - "line": 2, - "column": 36 - }, - "end": { - "line": 2, - "column": 38 - } - }, + "start":46,"end":48,"loc":{"start":{"line":2,"column":36},"end":{"line":2,"column":38}}, "body": [], "directives": [] } }, { "type": "ClassMethod", - "start": 53, - "end": 81, - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 32 - } - }, + "start":53,"end":81,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":32}}, "static": false, "computed": true, "key": { "type": "MemberExpression", - "start": 54, - "end": 69, - "loc": { - "start": { - "line": 3, - "column": 5 - }, - "end": { - "line": 3, - "column": 20 - } - }, + "start":54,"end":69,"loc":{"start":{"line":3,"column":5},"end":{"line":3,"column":20}}, "object": { "type": "Identifier", - "start": 54, - "end": 60, - "loc": { - "start": { - "line": 3, - "column": 5 - }, - "end": { - "line": 3, - "column": 11 - }, - "identifierName": "Symbol" - }, + "start":54,"end":60,"loc":{"start":{"line":3,"column":5},"end":{"line":3,"column":11},"identifierName":"Symbol"}, "name": "Symbol" }, "property": { "type": "Identifier", - "start": 61, - "end": 69, - "loc": { - "start": { - "line": 3, - "column": 12 - }, - "end": { - "line": 3, - "column": 20 - }, - "identifierName": "iterator" - }, + "start":61,"end":69,"loc":{"start":{"line":3,"column":12},"end":{"line":3,"column":20},"identifierName":"iterator"}, "name": "iterator" }, "computed": false @@ -505,33 +153,11 @@ "kind": "method", "typeParameters": { "type": "TSTypeParameterDeclaration", - "start": 70, - "end": 73, - "loc": { - "start": { - "line": 3, - "column": 21 - }, - "end": { - "line": 3, - "column": 24 - } - }, + "start":70,"end":73,"loc":{"start":{"line":3,"column":21},"end":{"line":3,"column":24}}, "params": [ { "type": "TSTypeParameter", - "start": 71, - "end": 72, - "loc": { - "start": { - "line": 3, - "column": 22 - }, - "end": { - "line": 3, - "column": 23 - } - }, + "start":71,"end":72,"loc":{"start":{"line":3,"column":22},"end":{"line":3,"column":23}}, "name": "T" } ] @@ -542,65 +168,20 @@ "params": [], "returnType": { "type": "TSTypeAnnotation", - "start": 75, - "end": 78, - "loc": { - "start": { - "line": 3, - "column": 26 - }, - "end": { - "line": 3, - "column": 29 - } - }, + "start":75,"end":78,"loc":{"start":{"line":3,"column":26},"end":{"line":3,"column":29}}, "typeAnnotation": { "type": "TSTypeReference", - "start": 77, - "end": 78, - "loc": { - "start": { - "line": 3, - "column": 28 - }, - "end": { - "line": 3, - "column": 29 - } - }, + "start":77,"end":78,"loc":{"start":{"line":3,"column":28},"end":{"line":3,"column":29}}, "typeName": { "type": "Identifier", - "start": 77, - "end": 78, - "loc": { - "start": { - "line": 3, - "column": 28 - }, - "end": { - "line": 3, - "column": 29 - }, - "identifierName": "T" - }, + "start":77,"end":78,"loc":{"start":{"line":3,"column":28},"end":{"line":3,"column":29},"identifierName":"T"}, "name": "T" } } }, "body": { "type": "BlockStatement", - "start": 79, - "end": 81, - "loc": { - "start": { - "line": 3, - "column": 30 - }, - "end": { - "line": 3, - "column": 32 - } - }, + "start":79,"end":81,"loc":{"start":{"line":3,"column":30},"end":{"line":3,"column":32}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/typescript/class/method-no-body/output.json b/packages/babel-parser/test/fixtures/typescript/class/method-no-body/output.json index cbf364b4ae5a..65872f1e6816 100644 --- a/packages/babel-parser/test/fixtures/typescript/class/method-no-body/output.json +++ b/packages/babel-parser/test/fixtures/typescript/class/method-no-body/output.json @@ -1,111 +1,32 @@ { "type": "File", - "start": 0, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, "id": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "C" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"C"}, "name": "C" }, "superClass": null, "body": { "type": "ClassBody", - "start": 8, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":8,"end":35,"loc":{"start":{"line":1,"column":8},"end":{"line":4,"column":1}}, "body": [ { "type": "TSDeclareMethod", - "start": 14, - "end": 18, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 8 - } - }, + "start":14,"end":18,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":8}}, "static": false, "key": { "type": "Identifier", - "start": 14, - "end": 15, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 5 - }, - "identifierName": "f" - }, + "start":14,"end":15,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":5},"identifierName":"f"}, "name": "f" }, "computed": false, @@ -117,34 +38,11 @@ }, { "type": "TSDeclareMethod", - "start": 23, - "end": 33, - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 14 - } - }, + "start":23,"end":33,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":14}}, "static": false, "key": { "type": "Identifier", - "start": 23, - "end": 24, - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 5 - }, - "identifierName": "f" - }, + "start":23,"end":24,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":5},"identifierName":"f"}, "name": "f" }, "computed": false, @@ -155,32 +53,10 @@ "params": [], "returnType": { "type": "TSTypeAnnotation", - "start": 26, - "end": 32, - "loc": { - "start": { - "line": 3, - "column": 7 - }, - "end": { - "line": 3, - "column": 13 - } - }, + "start":26,"end":32,"loc":{"start":{"line":3,"column":7},"end":{"line":3,"column":13}}, "typeAnnotation": { "type": "TSVoidKeyword", - "start": 28, - "end": 32, - "loc": { - "start": { - "line": 3, - "column": 9 - }, - "end": { - "line": 3, - "column": 13 - } - } + "start":28,"end":32,"loc":{"start":{"line":3,"column":9},"end":{"line":3,"column":13}} } } } diff --git a/packages/babel-parser/test/fixtures/typescript/class/method-optional/output.json b/packages/babel-parser/test/fixtures/typescript/class/method-optional/output.json index 7abca58de307..b4e838b1b960 100644 --- a/packages/babel-parser/test/fixtures/typescript/class/method-optional/output.json +++ b/packages/babel-parser/test/fixtures/typescript/class/method-optional/output.json @@ -1,111 +1,32 @@ { "type": "File", - "start": 0, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "id": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "C" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"C"}, "name": "C" }, "superClass": null, "body": { "type": "ClassBody", - "start": 8, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":8,"end":29,"loc":{"start":{"line":1,"column":8},"end":{"line":3,"column":1}}, "body": [ { "type": "ClassMethod", - "start": 14, - "end": 27, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 17 - } - }, + "start":14,"end":27,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":17}}, "static": false, "key": { "type": "Identifier", - "start": 14, - "end": 15, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 5 - }, - "identifierName": "m" - }, + "start":14,"end":15,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":5},"identifierName":"m"}, "name": "m" }, "computed": false, @@ -117,48 +38,15 @@ "params": [], "returnType": { "type": "TSTypeAnnotation", - "start": 18, - "end": 24, - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 14 - } - }, + "start":18,"end":24,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":14}}, "typeAnnotation": { "type": "TSVoidKeyword", - "start": 20, - "end": 24, - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 14 - } - } + "start":20,"end":24,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":14}} } }, "body": { "type": "BlockStatement", - "start": 25, - "end": 27, - "loc": { - "start": { - "line": 2, - "column": 15 - }, - "end": { - "line": 2, - "column": 17 - } - }, + "start":25,"end":27,"loc":{"start":{"line":2,"column":15},"end":{"line":2,"column":17}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/typescript/class/method-readonly/options.json b/packages/babel-parser/test/fixtures/typescript/class/method-readonly/options.json deleted file mode 100644 index f7dd2e27ef2c..000000000000 --- a/packages/babel-parser/test/fixtures/typescript/class/method-readonly/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected token, expected \";\" (2:14)" -} diff --git a/packages/babel-parser/test/fixtures/typescript/class/method-readonly/output.json b/packages/babel-parser/test/fixtures/typescript/class/method-readonly/output.json new file mode 100644 index 000000000000..85529184ac19 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/class/method-readonly/output.json @@ -0,0 +1,55 @@ +{ + "type": "File", + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "errors": [ + "SyntaxError: Class methods cannot have the 'readonly' modifier (2:4)" + ], + "program": { + "type": "Program", + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "id": { + "type": "Identifier", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"C"}, + "name": "C" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":8,"end":31,"loc":{"start":{"line":1,"column":8},"end":{"line":3,"column":1}}, + "body": [ + { + "type": "ClassMethod", + "start":14,"end":29,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":19}}, + "readonly": true, + "static": false, + "key": { + "type": "Identifier", + "start":23,"end":24,"loc":{"start":{"line":2,"column":13},"end":{"line":2,"column":14},"identifierName":"m"}, + "name": "m" + }, + "computed": false, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":27,"end":29,"loc":{"start":{"line":2,"column":17},"end":{"line":2,"column":19}}, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/class/method-return-type/output.json b/packages/babel-parser/test/fixtures/typescript/class/method-return-type/output.json index 9cb642e1b385..4e1f8f0c5cc1 100644 --- a/packages/babel-parser/test/fixtures/typescript/class/method-return-type/output.json +++ b/packages/babel-parser/test/fixtures/typescript/class/method-return-type/output.json @@ -1,111 +1,32 @@ { "type": "File", - "start": 0, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "id": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "C" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"C"}, "name": "C" }, "superClass": null, "body": { "type": "ClassBody", - "start": 8, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":8,"end":28,"loc":{"start":{"line":1,"column":8},"end":{"line":3,"column":1}}, "body": [ { "type": "ClassMethod", - "start": 14, - "end": 26, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 16 - } - }, + "start":14,"end":26,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":16}}, "static": false, "key": { "type": "Identifier", - "start": 14, - "end": 15, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 5 - }, - "identifierName": "f" - }, + "start":14,"end":15,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":5},"identifierName":"f"}, "name": "f" }, "computed": false, @@ -116,48 +37,15 @@ "params": [], "returnType": { "type": "TSTypeAnnotation", - "start": 17, - "end": 23, - "loc": { - "start": { - "line": 2, - "column": 7 - }, - "end": { - "line": 2, - "column": 13 - } - }, + "start":17,"end":23,"loc":{"start":{"line":2,"column":7},"end":{"line":2,"column":13}}, "typeAnnotation": { "type": "TSVoidKeyword", - "start": 19, - "end": 23, - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 13 - } - } + "start":19,"end":23,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":13}} } }, "body": { "type": "BlockStatement", - "start": 24, - "end": 26, - "loc": { - "start": { - "line": 2, - "column": 14 - }, - "end": { - "line": 2, - "column": 16 - } - }, + "start":24,"end":26,"loc":{"start":{"line":2,"column":14},"end":{"line":2,"column":16}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/typescript/class/method-with-newline-with-body/output.json b/packages/babel-parser/test/fixtures/typescript/class/method-with-newline-with-body/output.json index 5d7a7655956a..a255c200f154 100644 --- a/packages/babel-parser/test/fixtures/typescript/class/method-with-newline-with-body/output.json +++ b/packages/babel-parser/test/fixtures/typescript/class/method-with-newline-with-body/output.json @@ -1,111 +1,32 @@ { "type": "File", - "start": 0, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 6, - "column": 1 - } - }, + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":6,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 6, - "column": 1 - } - }, + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":6,"column":1}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 6, - "column": 1 - } - }, + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":6,"column":1}}, "id": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "C" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"C"}, "name": "C" }, "superClass": null, "body": { "type": "ClassBody", - "start": 8, - "end": 31, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 6, - "column": 1 - } - }, + "start":8,"end":31,"loc":{"start":{"line":2,"column":0},"end":{"line":6,"column":1}}, "body": [ { "type": "ClassMethod", - "start": 14, - "end": 29, - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 5, - "column": 5 - } - }, + "start":14,"end":29,"loc":{"start":{"line":3,"column":4},"end":{"line":5,"column":5}}, "static": false, "key": { "type": "Identifier", - "start": 14, - "end": 15, - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 5 - }, - "identifierName": "m" - }, + "start":14,"end":15,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":5},"identifierName":"m"}, "name": "m" }, "computed": false, @@ -116,18 +37,7 @@ "params": [], "body": { "type": "BlockStatement", - "start": 22, - "end": 29, - "loc": { - "start": { - "line": 4, - "column": 4 - }, - "end": { - "line": 5, - "column": 5 - } - }, + "start":22,"end":29,"loc":{"start":{"line":4,"column":4},"end":{"line":5,"column":5}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/typescript/class/method-with-newline-without-body/output.json b/packages/babel-parser/test/fixtures/typescript/class/method-with-newline-without-body/output.json index a58a0876ceb6..f3b0d34b64a3 100644 --- a/packages/babel-parser/test/fixtures/typescript/class/method-with-newline-without-body/output.json +++ b/packages/babel-parser/test/fixtures/typescript/class/method-with-newline-without-body/output.json @@ -1,111 +1,32 @@ { "type": "File", - "start": 0, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 1 - } - }, + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 1 - } - }, + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 1 - } - }, + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, "id": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "C" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"C"}, "name": "C" }, "superClass": null, "body": { "type": "ClassBody", - "start": 8, - "end": 27, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 5, - "column": 1 - } - }, + "start":8,"end":27,"loc":{"start":{"line":2,"column":0},"end":{"line":5,"column":1}}, "body": [ { "type": "TSDeclareMethod", - "start": 14, - "end": 17, - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 7 - } - }, + "start":14,"end":17,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":7}}, "static": false, "key": { "type": "Identifier", - "start": 14, - "end": 15, - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 5 - }, - "identifierName": "m" - }, + "start":14,"end":15,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":5},"identifierName":"m"}, "name": "m" }, "computed": false, @@ -117,34 +38,11 @@ }, { "type": "TSDeclareMethod", - "start": 22, - "end": 25, - "loc": { - "start": { - "line": 4, - "column": 4 - }, - "end": { - "line": 4, - "column": 7 - } - }, + "start":22,"end":25,"loc":{"start":{"line":4,"column":4},"end":{"line":4,"column":7}}, "static": false, "key": { "type": "Identifier", - "start": 22, - "end": 23, - "loc": { - "start": { - "line": 4, - "column": 4 - }, - "end": { - "line": 4, - "column": 5 - }, - "identifierName": "n" - }, + "start":22,"end":23,"loc":{"start":{"line":4,"column":4},"end":{"line":4,"column":5},"identifierName":"n"}, "name": "n" }, "computed": false, diff --git a/packages/babel-parser/test/fixtures/typescript/class/modifiers-accessors/output.json b/packages/babel-parser/test/fixtures/typescript/class/modifiers-accessors/output.json index 5a44292aaa10..fcd7232c7351 100644 --- a/packages/babel-parser/test/fixtures/typescript/class/modifiers-accessors/output.json +++ b/packages/babel-parser/test/fixtures/typescript/class/modifiers-accessors/output.json @@ -1,113 +1,34 @@ { "type": "File", - "start": 0, - "end": 295, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 11, - "column": 1 - } - }, + "start":0,"end":295,"loc":{"start":{"line":1,"column":0},"end":{"line":11,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 295, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 11, - "column": 1 - } - }, + "start":0,"end":295,"loc":{"start":{"line":1,"column":0},"end":{"line":11,"column":1}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 40, - "end": 295, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 11, - "column": 1 - } - }, + "start":40,"end":295,"loc":{"start":{"line":2,"column":0},"end":{"line":11,"column":1}}, "abstract": true, "id": { "type": "Identifier", - "start": 55, - "end": 56, - "loc": { - "start": { - "line": 2, - "column": 15 - }, - "end": { - "line": 2, - "column": 16 - }, - "identifierName": "C" - }, + "start":55,"end":56,"loc":{"start":{"line":2,"column":15},"end":{"line":2,"column":16},"identifierName":"C"}, "name": "C" }, "superClass": null, "body": { "type": "ClassBody", - "start": 57, - "end": 295, - "loc": { - "start": { - "line": 2, - "column": 17 - }, - "end": { - "line": 11, - "column": 1 - } - }, + "start":57,"end":295,"loc":{"start":{"line":2,"column":17},"end":{"line":11,"column":1}}, "body": [ { "type": "TSDeclareMethod", - "start": 63, - "end": 80, - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 21 - } - }, + "start":63,"end":80,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":21}}, "abstract": true, "static": false, "key": { "type": "Identifier", - "start": 76, - "end": 77, - "loc": { - "start": { - "line": 3, - "column": 17 - }, - "end": { - "line": 3, - "column": 18 - }, - "identifierName": "a" - }, + "start":76,"end":77,"loc":{"start":{"line":3,"column":17},"end":{"line":3,"column":18},"identifierName":"a"}, "name": "a" }, "computed": false, @@ -119,34 +40,11 @@ }, { "type": "ClassMethod", - "start": 85, - "end": 113, - "loc": { - "start": { - "line": 4, - "column": 4 - }, - "end": { - "line": 4, - "column": 32 - } - }, + "start":85,"end":113,"loc":{"start":{"line":4,"column":4},"end":{"line":4,"column":32}}, "static": true, "key": { "type": "Identifier", - "start": 96, - "end": 97, - "loc": { - "start": { - "line": 4, - "column": 15 - }, - "end": { - "line": 4, - "column": 16 - }, - "identifierName": "s" - }, + "start":96,"end":97,"loc":{"start":{"line":4,"column":15},"end":{"line":4,"column":16},"identifierName":"s"}, "name": "s" }, "computed": false, @@ -157,47 +55,14 @@ "params": [], "body": { "type": "BlockStatement", - "start": 100, - "end": 113, - "loc": { - "start": { - "line": 4, - "column": 19 - }, - "end": { - "line": 4, - "column": 32 - } - }, + "start":100,"end":113,"loc":{"start":{"line":4,"column":19},"end":{"line":4,"column":32}}, "body": [ { "type": "ReturnStatement", - "start": 102, - "end": 111, - "loc": { - "start": { - "line": 4, - "column": 21 - }, - "end": { - "line": 4, - "column": 30 - } - }, + "start":102,"end":111,"loc":{"start":{"line":4,"column":21},"end":{"line":4,"column":30}}, "argument": { "type": "NumericLiteral", - "start": 109, - "end": 110, - "loc": { - "start": { - "line": 4, - "column": 28 - }, - "end": { - "line": 4, - "column": 29 - } - }, + "start":109,"end":110,"loc":{"start":{"line":4,"column":28},"end":{"line":4,"column":29}}, "extra": { "rawValue": 0, "raw": "0" @@ -211,36 +76,13 @@ }, { "type": "TSDeclareMethod", - "start": 118, - "end": 144, - "loc": { - "start": { - "line": 5, - "column": 4 - }, - "end": { - "line": 5, - "column": 30 - } - }, + "start":118,"end":144,"loc":{"start":{"line":5,"column":4},"end":{"line":5,"column":30}}, "accessibility": "public", "abstract": true, "static": false, "key": { "type": "Identifier", - "start": 138, - "end": 141, - "loc": { - "start": { - "line": 5, - "column": 24 - }, - "end": { - "line": 5, - "column": 27 - }, - "identifierName": "pua" - }, + "start":138,"end":141,"loc":{"start":{"line":5,"column":24},"end":{"line":5,"column":27},"identifierName":"pua"}, "name": "pua" }, "computed": false, @@ -252,35 +94,12 @@ }, { "type": "ClassMethod", - "start": 149, - "end": 186, - "loc": { - "start": { - "line": 6, - "column": 4 - }, - "end": { - "line": 6, - "column": 41 - } - }, + "start":149,"end":186,"loc":{"start":{"line":6,"column":4},"end":{"line":6,"column":41}}, "accessibility": "public", "static": true, "key": { "type": "Identifier", - "start": 167, - "end": 170, - "loc": { - "start": { - "line": 6, - "column": 22 - }, - "end": { - "line": 6, - "column": 25 - }, - "identifierName": "pus" - }, + "start":167,"end":170,"loc":{"start":{"line":6,"column":22},"end":{"line":6,"column":25},"identifierName":"pus"}, "name": "pus" }, "computed": false, @@ -291,47 +110,14 @@ "params": [], "body": { "type": "BlockStatement", - "start": 173, - "end": 186, - "loc": { - "start": { - "line": 6, - "column": 28 - }, - "end": { - "line": 6, - "column": 41 - } - }, + "start":173,"end":186,"loc":{"start":{"line":6,"column":28},"end":{"line":6,"column":41}}, "body": [ { "type": "ReturnStatement", - "start": 175, - "end": 184, - "loc": { - "start": { - "line": 6, - "column": 30 - }, - "end": { - "line": 6, - "column": 39 - } - }, + "start":175,"end":184,"loc":{"start":{"line":6,"column":30},"end":{"line":6,"column":39}}, "argument": { "type": "NumericLiteral", - "start": 182, - "end": 183, - "loc": { - "start": { - "line": 6, - "column": 37 - }, - "end": { - "line": 6, - "column": 38 - } - }, + "start":182,"end":183,"loc":{"start":{"line":6,"column":37},"end":{"line":6,"column":38}}, "extra": { "rawValue": 0, "raw": "0" @@ -345,35 +131,12 @@ }, { "type": "ClassMethod", - "start": 192, - "end": 221, - "loc": { - "start": { - "line": 8, - "column": 4 - }, - "end": { - "line": 8, - "column": 33 - } - }, + "start":192,"end":221,"loc":{"start":{"line":8,"column":4},"end":{"line":8,"column":33}}, "accessibility": "public", "static": false, "key": { "type": "Identifier", - "start": 203, - "end": 205, - "loc": { - "start": { - "line": 8, - "column": 15 - }, - "end": { - "line": 8, - "column": 17 - }, - "identifierName": "pu" - }, + "start":203,"end":205,"loc":{"start":{"line":8,"column":15},"end":{"line":8,"column":17},"identifierName":"pu"}, "name": "pu" }, "computed": false, @@ -384,47 +147,14 @@ "params": [], "body": { "type": "BlockStatement", - "start": 208, - "end": 221, - "loc": { - "start": { - "line": 8, - "column": 20 - }, - "end": { - "line": 8, - "column": 33 - } - }, + "start":208,"end":221,"loc":{"start":{"line":8,"column":20},"end":{"line":8,"column":33}}, "body": [ { "type": "ReturnStatement", - "start": 210, - "end": 219, - "loc": { - "start": { - "line": 8, - "column": 22 - }, - "end": { - "line": 8, - "column": 31 - } - }, + "start":210,"end":219,"loc":{"start":{"line":8,"column":22},"end":{"line":8,"column":31}}, "argument": { "type": "NumericLiteral", - "start": 217, - "end": 218, - "loc": { - "start": { - "line": 8, - "column": 29 - }, - "end": { - "line": 8, - "column": 30 - } - }, + "start":217,"end":218,"loc":{"start":{"line":8,"column":29},"end":{"line":8,"column":30}}, "extra": { "rawValue": 0, "raw": "0" @@ -438,35 +168,12 @@ }, { "type": "ClassMethod", - "start": 226, - "end": 258, - "loc": { - "start": { - "line": 9, - "column": 4 - }, - "end": { - "line": 9, - "column": 36 - } - }, + "start":226,"end":258,"loc":{"start":{"line":9,"column":4},"end":{"line":9,"column":36}}, "accessibility": "protected", "static": false, "key": { "type": "Identifier", - "start": 240, - "end": 242, - "loc": { - "start": { - "line": 9, - "column": 18 - }, - "end": { - "line": 9, - "column": 20 - }, - "identifierName": "po" - }, + "start":240,"end":242,"loc":{"start":{"line":9,"column":18},"end":{"line":9,"column":20},"identifierName":"po"}, "name": "po" }, "computed": false, @@ -477,47 +184,14 @@ "params": [], "body": { "type": "BlockStatement", - "start": 245, - "end": 258, - "loc": { - "start": { - "line": 9, - "column": 23 - }, - "end": { - "line": 9, - "column": 36 - } - }, + "start":245,"end":258,"loc":{"start":{"line":9,"column":23},"end":{"line":9,"column":36}}, "body": [ { "type": "ReturnStatement", - "start": 247, - "end": 256, - "loc": { - "start": { - "line": 9, - "column": 25 - }, - "end": { - "line": 9, - "column": 34 - } - }, + "start":247,"end":256,"loc":{"start":{"line":9,"column":25},"end":{"line":9,"column":34}}, "argument": { "type": "NumericLiteral", - "start": 254, - "end": 255, - "loc": { - "start": { - "line": 9, - "column": 32 - }, - "end": { - "line": 9, - "column": 33 - } - }, + "start":254,"end":255,"loc":{"start":{"line":9,"column":32},"end":{"line":9,"column":33}}, "extra": { "rawValue": 0, "raw": "0" @@ -531,35 +205,12 @@ }, { "type": "ClassMethod", - "start": 263, - "end": 293, - "loc": { - "start": { - "line": 10, - "column": 4 - }, - "end": { - "line": 10, - "column": 34 - } - }, + "start":263,"end":293,"loc":{"start":{"line":10,"column":4},"end":{"line":10,"column":34}}, "accessibility": "private", "static": false, "key": { "type": "Identifier", - "start": 275, - "end": 277, - "loc": { - "start": { - "line": 10, - "column": 16 - }, - "end": { - "line": 10, - "column": 18 - }, - "identifierName": "pi" - }, + "start":275,"end":277,"loc":{"start":{"line":10,"column":16},"end":{"line":10,"column":18},"identifierName":"pi"}, "name": "pi" }, "computed": false, @@ -570,47 +221,14 @@ "params": [], "body": { "type": "BlockStatement", - "start": 280, - "end": 293, - "loc": { - "start": { - "line": 10, - "column": 21 - }, - "end": { - "line": 10, - "column": 34 - } - }, + "start":280,"end":293,"loc":{"start":{"line":10,"column":21},"end":{"line":10,"column":34}}, "body": [ { "type": "ReturnStatement", - "start": 282, - "end": 291, - "loc": { - "start": { - "line": 10, - "column": 23 - }, - "end": { - "line": 10, - "column": 32 - } - }, + "start":282,"end":291,"loc":{"start":{"line":10,"column":23},"end":{"line":10,"column":32}}, "argument": { "type": "NumericLiteral", - "start": 289, - "end": 290, - "loc": { - "start": { - "line": 10, - "column": 30 - }, - "end": { - "line": 10, - "column": 31 - } - }, + "start":289,"end":290,"loc":{"start":{"line":10,"column":30},"end":{"line":10,"column":31}}, "extra": { "rawValue": 0, "raw": "0" @@ -628,18 +246,7 @@ { "type": "CommentLine", "value": " Copy of modifiers-methods with 'get'", - "start": 0, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 39 - } - } + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":39}} } ] } @@ -650,18 +257,7 @@ { "type": "CommentLine", "value": " Copy of modifiers-methods with 'get'", - "start": 0, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 39 - } - } + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":39}} } ] } \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/class/modifiers-methods-async/output.json b/packages/babel-parser/test/fixtures/typescript/class/modifiers-methods-async/output.json index 051a939e047b..7cd1a5f643a9 100644 --- a/packages/babel-parser/test/fixtures/typescript/class/modifiers-methods-async/output.json +++ b/packages/babel-parser/test/fixtures/typescript/class/modifiers-methods-async/output.json @@ -1,113 +1,34 @@ { "type": "File", - "start": 0, - "end": 256, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 11, - "column": 1 - } - }, + "start":0,"end":256,"loc":{"start":{"line":1,"column":0},"end":{"line":11,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 256, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 11, - "column": 1 - } - }, + "start":0,"end":256,"loc":{"start":{"line":1,"column":0},"end":{"line":11,"column":1}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 42, - "end": 256, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 11, - "column": 1 - } - }, + "start":42,"end":256,"loc":{"start":{"line":2,"column":0},"end":{"line":11,"column":1}}, "abstract": true, "id": { "type": "Identifier", - "start": 57, - "end": 58, - "loc": { - "start": { - "line": 2, - "column": 15 - }, - "end": { - "line": 2, - "column": 16 - }, - "identifierName": "C" - }, + "start":57,"end":58,"loc":{"start":{"line":2,"column":15},"end":{"line":2,"column":16},"identifierName":"C"}, "name": "C" }, "superClass": null, "body": { "type": "ClassBody", - "start": 59, - "end": 256, - "loc": { - "start": { - "line": 2, - "column": 17 - }, - "end": { - "line": 11, - "column": 1 - } - }, + "start":59,"end":256,"loc":{"start":{"line":2,"column":17},"end":{"line":11,"column":1}}, "body": [ { "type": "TSDeclareMethod", - "start": 65, - "end": 84, - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 23 - } - }, + "start":65,"end":84,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":23}}, "abstract": true, "static": false, "key": { "type": "Identifier", - "start": 80, - "end": 81, - "loc": { - "start": { - "line": 3, - "column": 19 - }, - "end": { - "line": 3, - "column": 20 - }, - "identifierName": "a" - }, + "start":80,"end":81,"loc":{"start":{"line":3,"column":19},"end":{"line":3,"column":20},"identifierName":"a"}, "name": "a" }, "computed": false, @@ -119,34 +40,11 @@ }, { "type": "ClassMethod", - "start": 89, - "end": 108, - "loc": { - "start": { - "line": 4, - "column": 4 - }, - "end": { - "line": 4, - "column": 23 - } - }, + "start":89,"end":108,"loc":{"start":{"line":4,"column":4},"end":{"line":4,"column":23}}, "static": true, "key": { "type": "Identifier", - "start": 102, - "end": 103, - "loc": { - "start": { - "line": 4, - "column": 17 - }, - "end": { - "line": 4, - "column": 18 - }, - "identifierName": "s" - }, + "start":102,"end":103,"loc":{"start":{"line":4,"column":17},"end":{"line":4,"column":18},"identifierName":"s"}, "name": "s" }, "computed": false, @@ -157,54 +55,20 @@ "params": [], "body": { "type": "BlockStatement", - "start": 106, - "end": 108, - "loc": { - "start": { - "line": 4, - "column": 21 - }, - "end": { - "line": 4, - "column": 23 - } - }, + "start":106,"end":108,"loc":{"start":{"line":4,"column":21},"end":{"line":4,"column":23}}, "body": [], "directives": [] } }, { "type": "TSDeclareMethod", - "start": 113, - "end": 141, - "loc": { - "start": { - "line": 5, - "column": 4 - }, - "end": { - "line": 5, - "column": 32 - } - }, + "start":113,"end":141,"loc":{"start":{"line":5,"column":4},"end":{"line":5,"column":32}}, "accessibility": "public", "abstract": true, "static": false, "key": { "type": "Identifier", - "start": 135, - "end": 138, - "loc": { - "start": { - "line": 5, - "column": 26 - }, - "end": { - "line": 5, - "column": 29 - }, - "identifierName": "pua" - }, + "start":135,"end":138,"loc":{"start":{"line":5,"column":26},"end":{"line":5,"column":29},"identifierName":"pua"}, "name": "pua" }, "computed": false, @@ -216,35 +80,12 @@ }, { "type": "ClassMethod", - "start": 146, - "end": 174, - "loc": { - "start": { - "line": 6, - "column": 4 - }, - "end": { - "line": 6, - "column": 32 - } - }, + "start":146,"end":174,"loc":{"start":{"line":6,"column":4},"end":{"line":6,"column":32}}, "accessibility": "public", "static": true, "key": { "type": "Identifier", - "start": 166, - "end": 169, - "loc": { - "start": { - "line": 6, - "column": 24 - }, - "end": { - "line": 6, - "column": 27 - }, - "identifierName": "pus" - }, + "start":166,"end":169,"loc":{"start":{"line":6,"column":24},"end":{"line":6,"column":27},"identifierName":"pus"}, "name": "pus" }, "computed": false, @@ -255,53 +96,19 @@ "params": [], "body": { "type": "BlockStatement", - "start": 172, - "end": 174, - "loc": { - "start": { - "line": 6, - "column": 30 - }, - "end": { - "line": 6, - "column": 32 - } - }, + "start":172,"end":174,"loc":{"start":{"line":6,"column":30},"end":{"line":6,"column":32}}, "body": [], "directives": [] } }, { "type": "ClassMethod", - "start": 180, - "end": 200, - "loc": { - "start": { - "line": 8, - "column": 4 - }, - "end": { - "line": 8, - "column": 24 - } - }, + "start":180,"end":200,"loc":{"start":{"line":8,"column":4},"end":{"line":8,"column":24}}, "accessibility": "public", "static": false, "key": { "type": "Identifier", - "start": 193, - "end": 195, - "loc": { - "start": { - "line": 8, - "column": 17 - }, - "end": { - "line": 8, - "column": 19 - }, - "identifierName": "pu" - }, + "start":193,"end":195,"loc":{"start":{"line":8,"column":17},"end":{"line":8,"column":19},"identifierName":"pu"}, "name": "pu" }, "computed": false, @@ -312,53 +119,19 @@ "params": [], "body": { "type": "BlockStatement", - "start": 198, - "end": 200, - "loc": { - "start": { - "line": 8, - "column": 22 - }, - "end": { - "line": 8, - "column": 24 - } - }, + "start":198,"end":200,"loc":{"start":{"line":8,"column":22},"end":{"line":8,"column":24}}, "body": [], "directives": [] } }, { "type": "ClassMethod", - "start": 205, - "end": 228, - "loc": { - "start": { - "line": 9, - "column": 4 - }, - "end": { - "line": 9, - "column": 27 - } - }, + "start":205,"end":228,"loc":{"start":{"line":9,"column":4},"end":{"line":9,"column":27}}, "accessibility": "protected", "static": false, "key": { "type": "Identifier", - "start": 221, - "end": 223, - "loc": { - "start": { - "line": 9, - "column": 20 - }, - "end": { - "line": 9, - "column": 22 - }, - "identifierName": "po" - }, + "start":221,"end":223,"loc":{"start":{"line":9,"column":20},"end":{"line":9,"column":22},"identifierName":"po"}, "name": "po" }, "computed": false, @@ -369,53 +142,19 @@ "params": [], "body": { "type": "BlockStatement", - "start": 226, - "end": 228, - "loc": { - "start": { - "line": 9, - "column": 25 - }, - "end": { - "line": 9, - "column": 27 - } - }, + "start":226,"end":228,"loc":{"start":{"line":9,"column":25},"end":{"line":9,"column":27}}, "body": [], "directives": [] } }, { "type": "ClassMethod", - "start": 233, - "end": 254, - "loc": { - "start": { - "line": 10, - "column": 4 - }, - "end": { - "line": 10, - "column": 25 - } - }, + "start":233,"end":254,"loc":{"start":{"line":10,"column":4},"end":{"line":10,"column":25}}, "accessibility": "private", "static": false, "key": { "type": "Identifier", - "start": 247, - "end": 249, - "loc": { - "start": { - "line": 10, - "column": 18 - }, - "end": { - "line": 10, - "column": 20 - }, - "identifierName": "pi" - }, + "start":247,"end":249,"loc":{"start":{"line":10,"column":18},"end":{"line":10,"column":20},"identifierName":"pi"}, "name": "pi" }, "computed": false, @@ -426,18 +165,7 @@ "params": [], "body": { "type": "BlockStatement", - "start": 252, - "end": 254, - "loc": { - "start": { - "line": 10, - "column": 23 - }, - "end": { - "line": 10, - "column": 25 - } - }, + "start":252,"end":254,"loc":{"start":{"line":10,"column":23},"end":{"line":10,"column":25}}, "body": [], "directives": [] } @@ -448,18 +176,7 @@ { "type": "CommentLine", "value": " Copy of modifiers-methods with 'async'", - "start": 0, - "end": 41, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 41 - } - } + "start":0,"end":41,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":41}} } ] } @@ -470,18 +187,7 @@ { "type": "CommentLine", "value": " Copy of modifiers-methods with 'async'", - "start": 0, - "end": 41, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 41 - } - } + "start":0,"end":41,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":41}} } ] } \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/class/modifiers-properties/output.json b/packages/babel-parser/test/fixtures/typescript/class/modifiers-properties/output.json index 31a91036931a..7f16ab4af1cf 100644 --- a/packages/babel-parser/test/fixtures/typescript/class/modifiers-properties/output.json +++ b/packages/babel-parser/test/fixtures/typescript/class/modifiers-properties/output.json @@ -1,113 +1,34 @@ { "type": "File", - "start": 0, - "end": 396, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 21, - "column": 1 - } - }, + "start":0,"end":396,"loc":{"start":{"line":1,"column":0},"end":{"line":21,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 396, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 21, - "column": 1 - } - }, + "start":0,"end":396,"loc":{"start":{"line":1,"column":0},"end":{"line":21,"column":1}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 396, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 21, - "column": 1 - } - }, + "start":0,"end":396,"loc":{"start":{"line":1,"column":0},"end":{"line":21,"column":1}}, "abstract": true, "id": { "type": "Identifier", - "start": 15, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - }, - "identifierName": "C" - }, + "start":15,"end":16,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":16},"identifierName":"C"}, "name": "C" }, "superClass": null, "body": { "type": "ClassBody", - "start": 17, - "end": 396, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 21, - "column": 1 - } - }, + "start":17,"end":396,"loc":{"start":{"line":1,"column":17},"end":{"line":21,"column":1}}, "body": [ { "type": "ClassProperty", - "start": 23, - "end": 34, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 15 - } - }, + "start":23,"end":34,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":15}}, "readonly": true, "static": false, "key": { "type": "Identifier", - "start": 32, - "end": 33, - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 14 - }, - "identifierName": "r" - }, + "start":32,"end":33,"loc":{"start":{"line":2,"column":13},"end":{"line":2,"column":14},"identifierName":"r"}, "name": "r" }, "computed": false, @@ -115,102 +36,34 @@ }, { "type": "ClassProperty", - "start": 39, - "end": 60, - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 25 - } - }, + "start":39,"end":60,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":25}}, "readonly": true, "static": false, "key": { "type": "Identifier", - "start": 48, - "end": 50, - "loc": { - "start": { - "line": 3, - "column": 13 - }, - "end": { - "line": 3, - "column": 15 - }, - "identifierName": "r2" - }, + "start":48,"end":50,"loc":{"start":{"line":3,"column":13},"end":{"line":3,"column":15},"identifierName":"r2"}, "name": "r2" }, "computed": false, "optional": true, "typeAnnotation": { "type": "TSTypeAnnotation", - "start": 51, - "end": 59, - "loc": { - "start": { - "line": 3, - "column": 16 - }, - "end": { - "line": 3, - "column": 24 - } - }, + "start":51,"end":59,"loc":{"start":{"line":3,"column":16},"end":{"line":3,"column":24}}, "typeAnnotation": { "type": "TSNumberKeyword", - "start": 53, - "end": 59, - "loc": { - "start": { - "line": 3, - "column": 18 - }, - "end": { - "line": 3, - "column": 24 - } - } + "start":53,"end":59,"loc":{"start":{"line":3,"column":18},"end":{"line":3,"column":24}} } }, "value": null }, { "type": "ClassProperty", - "start": 65, - "end": 76, - "loc": { - "start": { - "line": 4, - "column": 4 - }, - "end": { - "line": 4, - "column": 15 - } - }, + "start":65,"end":76,"loc":{"start":{"line":4,"column":4},"end":{"line":4,"column":15}}, "abstract": true, "static": false, "key": { "type": "Identifier", - "start": 74, - "end": 75, - "loc": { - "start": { - "line": 4, - "column": 13 - }, - "end": { - "line": 4, - "column": 14 - }, - "identifierName": "a" - }, + "start":74,"end":75,"loc":{"start":{"line":4,"column":13},"end":{"line":4,"column":14},"identifierName":"a"}, "name": "a" }, "computed": false, @@ -218,34 +71,11 @@ }, { "type": "ClassProperty", - "start": 81, - "end": 90, - "loc": { - "start": { - "line": 5, - "column": 4 - }, - "end": { - "line": 5, - "column": 13 - } - }, + "start":81,"end":90,"loc":{"start":{"line":5,"column":4},"end":{"line":5,"column":13}}, "static": true, "key": { "type": "Identifier", - "start": 88, - "end": 89, - "loc": { - "start": { - "line": 5, - "column": 11 - }, - "end": { - "line": 5, - "column": 12 - }, - "identifierName": "s" - }, + "start":88,"end":89,"loc":{"start":{"line":5,"column":11},"end":{"line":5,"column":12},"identifierName":"s"}, "name": "s" }, "computed": false, @@ -253,35 +83,12 @@ }, { "type": "ClassProperty", - "start": 96, - "end": 106, - "loc": { - "start": { - "line": 7, - "column": 4 - }, - "end": { - "line": 7, - "column": 14 - } - }, + "start":96,"end":106,"loc":{"start":{"line":7,"column":4},"end":{"line":7,"column":14}}, "accessibility": "public", "static": false, "key": { "type": "Identifier", - "start": 103, - "end": 105, - "loc": { - "start": { - "line": 7, - "column": 11 - }, - "end": { - "line": 7, - "column": 13 - }, - "identifierName": "pu" - }, + "start":103,"end":105,"loc":{"start":{"line":7,"column":11},"end":{"line":7,"column":13},"identifierName":"pu"}, "name": "pu" }, "computed": false, @@ -289,35 +96,12 @@ }, { "type": "ClassProperty", - "start": 111, - "end": 124, - "loc": { - "start": { - "line": 8, - "column": 4 - }, - "end": { - "line": 8, - "column": 17 - } - }, + "start":111,"end":124,"loc":{"start":{"line":8,"column":4},"end":{"line":8,"column":17}}, "accessibility": "protected", "static": false, "key": { "type": "Identifier", - "start": 121, - "end": 123, - "loc": { - "start": { - "line": 8, - "column": 14 - }, - "end": { - "line": 8, - "column": 16 - }, - "identifierName": "po" - }, + "start":121,"end":123,"loc":{"start":{"line":8,"column":14},"end":{"line":8,"column":16},"identifierName":"po"}, "name": "po" }, "computed": false, @@ -325,35 +109,12 @@ }, { "type": "ClassProperty", - "start": 129, - "end": 140, - "loc": { - "start": { - "line": 9, - "column": 4 - }, - "end": { - "line": 9, - "column": 15 - } - }, + "start":129,"end":140,"loc":{"start":{"line":9,"column":4},"end":{"line":9,"column":15}}, "accessibility": "private", "static": false, "key": { "type": "Identifier", - "start": 137, - "end": 139, - "loc": { - "start": { - "line": 9, - "column": 12 - }, - "end": { - "line": 9, - "column": 14 - }, - "identifierName": "pi" - }, + "start":137,"end":139,"loc":{"start":{"line":9,"column":12},"end":{"line":9,"column":14},"identifierName":"pi"}, "name": "pi" }, "computed": false, @@ -361,36 +122,13 @@ }, { "type": "ClassProperty", - "start": 146, - "end": 167, - "loc": { - "start": { - "line": 11, - "column": 4 - }, - "end": { - "line": 11, - "column": 25 - } - }, - "abstract": true, + "start":146,"end":167,"loc":{"start":{"line":11,"column":4},"end":{"line":11,"column":25}}, "readonly": true, + "abstract": true, "static": false, "key": { "type": "Identifier", - "start": 164, - "end": 166, - "loc": { - "start": { - "line": 11, - "column": 22 - }, - "end": { - "line": 11, - "column": 24 - }, - "identifierName": "ra" - }, + "start":164,"end":166,"loc":{"start":{"line":11,"column":22},"end":{"line":11,"column":24},"identifierName":"ra"}, "name": "ra" }, "computed": false, @@ -398,36 +136,13 @@ }, { "type": "ClassProperty", - "start": 172, - "end": 193, - "loc": { - "start": { - "line": 12, - "column": 4 - }, - "end": { - "line": 12, - "column": 25 - } - }, + "start":172,"end":193,"loc":{"start":{"line":12,"column":4},"end":{"line":12,"column":25}}, "abstract": true, "readonly": true, "static": false, "key": { "type": "Identifier", - "start": 190, - "end": 192, - "loc": { - "start": { - "line": 12, - "column": 22 - }, - "end": { - "line": 12, - "column": 24 - }, - "identifierName": "ar" - }, + "start":190,"end":192,"loc":{"start":{"line":12,"column":22},"end":{"line":12,"column":24},"identifierName":"ar"}, "name": "ar" }, "computed": false, @@ -435,35 +150,12 @@ }, { "type": "ClassProperty", - "start": 198, - "end": 217, - "loc": { - "start": { - "line": 13, - "column": 4 - }, - "end": { - "line": 13, - "column": 23 - } - }, + "start":198,"end":217,"loc":{"start":{"line":13,"column":4},"end":{"line":13,"column":23}}, "readonly": true, "static": true, "key": { "type": "Identifier", - "start": 214, - "end": 216, - "loc": { - "start": { - "line": 13, - "column": 20 - }, - "end": { - "line": 13, - "column": 22 - }, - "identifierName": "sr" - }, + "start":214,"end":216,"loc":{"start":{"line":13,"column":20},"end":{"line":13,"column":22},"identifierName":"sr"}, "name": "sr" }, "computed": false, @@ -471,36 +163,13 @@ }, { "type": "ClassProperty", - "start": 223, - "end": 243, - "loc": { - "start": { - "line": 15, - "column": 4 - }, - "end": { - "line": 15, - "column": 24 - } - }, + "start":223,"end":243,"loc":{"start":{"line":15,"column":4},"end":{"line":15,"column":24}}, "accessibility": "public", "readonly": true, "static": false, "key": { "type": "Identifier", - "start": 239, - "end": 242, - "loc": { - "start": { - "line": 15, - "column": 20 - }, - "end": { - "line": 15, - "column": 23 - }, - "identifierName": "pur" - }, + "start":239,"end":242,"loc":{"start":{"line":15,"column":20},"end":{"line":15,"column":23},"identifierName":"pur"}, "name": "pur" }, "computed": false, @@ -508,36 +177,13 @@ }, { "type": "ClassProperty", - "start": 248, - "end": 268, - "loc": { - "start": { - "line": 16, - "column": 4 - }, - "end": { - "line": 16, - "column": 24 - } - }, + "start":248,"end":268,"loc":{"start":{"line":16,"column":4},"end":{"line":16,"column":24}}, "accessibility": "public", "abstract": true, "static": false, "key": { "type": "Identifier", - "start": 264, - "end": 267, - "loc": { - "start": { - "line": 16, - "column": 20 - }, - "end": { - "line": 16, - "column": 23 - }, - "identifierName": "pua" - }, + "start":264,"end":267,"loc":{"start":{"line":16,"column":20},"end":{"line":16,"column":23},"identifierName":"pua"}, "name": "pua" }, "computed": false, @@ -545,35 +191,12 @@ }, { "type": "ClassProperty", - "start": 273, - "end": 291, - "loc": { - "start": { - "line": 17, - "column": 4 - }, - "end": { - "line": 17, - "column": 22 - } - }, + "start":273,"end":291,"loc":{"start":{"line":17,"column":4},"end":{"line":17,"column":22}}, "accessibility": "public", "static": true, "key": { "type": "Identifier", - "start": 287, - "end": 290, - "loc": { - "start": { - "line": 17, - "column": 18 - }, - "end": { - "line": 17, - "column": 21 - }, - "identifierName": "pus" - }, + "start":287,"end":290,"loc":{"start":{"line":17,"column":18},"end":{"line":17,"column":21},"identifierName":"pus"}, "name": "pus" }, "computed": false, @@ -581,37 +204,14 @@ }, { "type": "ClassProperty", - "start": 296, - "end": 326, - "loc": { - "start": { - "line": 18, - "column": 4 - }, - "end": { - "line": 18, - "column": 34 - } - }, + "start":296,"end":326,"loc":{"start":{"line":18,"column":4},"end":{"line":18,"column":34}}, "accessibility": "public", - "abstract": true, "readonly": true, + "abstract": true, "static": false, "key": { "type": "Identifier", - "start": 321, - "end": 325, - "loc": { - "start": { - "line": 18, - "column": 29 - }, - "end": { - "line": 18, - "column": 33 - }, - "identifierName": "pura" - }, + "start":321,"end":325,"loc":{"start":{"line":18,"column":29},"end":{"line":18,"column":33},"identifierName":"pura"}, "name": "pura" }, "computed": false, @@ -619,37 +219,14 @@ }, { "type": "ClassProperty", - "start": 331, - "end": 361, - "loc": { - "start": { - "line": 19, - "column": 4 - }, - "end": { - "line": 19, - "column": 34 - } - }, + "start":331,"end":361,"loc":{"start":{"line":19,"column":4},"end":{"line":19,"column":34}}, "accessibility": "public", "abstract": true, "readonly": true, "static": false, "key": { "type": "Identifier", - "start": 356, - "end": 360, - "loc": { - "start": { - "line": 19, - "column": 29 - }, - "end": { - "line": 19, - "column": 33 - }, - "identifierName": "puar" - }, + "start":356,"end":360,"loc":{"start":{"line":19,"column":29},"end":{"line":19,"column":33},"identifierName":"puar"}, "name": "puar" }, "computed": false, @@ -657,36 +234,13 @@ }, { "type": "ClassProperty", - "start": 366, - "end": 394, - "loc": { - "start": { - "line": 20, - "column": 4 - }, - "end": { - "line": 20, - "column": 32 - } - }, + "start":366,"end":394,"loc":{"start":{"line":20,"column":4},"end":{"line":20,"column":32}}, "accessibility": "public", "readonly": true, "static": true, "key": { "type": "Identifier", - "start": 389, - "end": 393, - "loc": { - "start": { - "line": 20, - "column": 27 - }, - "end": { - "line": 20, - "column": 31 - }, - "identifierName": "pusr" - }, + "start":389,"end":393,"loc":{"start":{"line":20,"column":27},"end":{"line":20,"column":31},"identifierName":"pusr"}, "name": "pusr" }, "computed": false, diff --git a/packages/babel-parser/test/fixtures/typescript/class/optional-async-error/input.js b/packages/babel-parser/test/fixtures/typescript/class/optional-async-error/input.js new file mode 100644 index 000000000000..01d6018a50d2 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/class/optional-async-error/input.js @@ -0,0 +1,4 @@ +class B { } +class A extends B { + async? method(val: string): Promise; +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/class/optional-async-error/options.json b/packages/babel-parser/test/fixtures/typescript/class/optional-async-error/options.json new file mode 100644 index 000000000000..03a7d3704a5b --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/class/optional-async-error/options.json @@ -0,0 +1,3 @@ +{ + "throws": "Unexpected token (3:9)" +} diff --git a/packages/babel-parser/test/fixtures/typescript/class/options.json b/packages/babel-parser/test/fixtures/typescript/class/options.json index 9f3a0c2c0ff1..fff045d3a491 100644 --- a/packages/babel-parser/test/fixtures/typescript/class/options.json +++ b/packages/babel-parser/test/fixtures/typescript/class/options.json @@ -1,4 +1,4 @@ { "sourceType": "module", - "plugins": ["typescript", "classProperties"] + "plugins": ["typescript", "classProperties", "classPrivateProperties"] } diff --git a/packages/babel-parser/test/fixtures/typescript/class/parameter-properties-binding-patterns/options.json b/packages/babel-parser/test/fixtures/typescript/class/parameter-properties-binding-patterns/options.json deleted file mode 100644 index b84b0421721a..000000000000 --- a/packages/babel-parser/test/fixtures/typescript/class/parameter-properties-binding-patterns/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "A parameter property may not be declared using a binding pattern. (2:16)" -} diff --git a/packages/babel-parser/test/fixtures/typescript/class/parameter-properties-binding-patterns/output.json b/packages/babel-parser/test/fixtures/typescript/class/parameter-properties-binding-patterns/output.json new file mode 100644 index 000000000000..a2d22a5968a1 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/class/parameter-properties-binding-patterns/output.json @@ -0,0 +1,65 @@ +{ + "type": "File", + "start":0,"end":41,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "errors": [ + "SyntaxError: A parameter property may not be declared using a binding pattern. (2:16)" + ], + "program": { + "type": "Program", + "start":0,"end":41,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start":0,"end":41,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "id": { + "type": "Identifier", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"C"}, + "name": "C" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":8,"end":41,"loc":{"start":{"line":1,"column":8},"end":{"line":3,"column":1}}, + "body": [ + { + "type": "ClassMethod", + "start":14,"end":39,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":29}}, + "static": false, + "key": { + "type": "Identifier", + "start":14,"end":25,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":15},"identifierName":"constructor"}, + "name": "constructor" + }, + "computed": false, + "kind": "constructor", + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "TSParameterProperty", + "start":26,"end":35,"loc":{"start":{"line":2,"column":16},"end":{"line":2,"column":25}}, + "accessibility": "public", + "parameter": { + "type": "ArrayPattern", + "start":33,"end":35,"loc":{"start":{"line":2,"column":23},"end":{"line":2,"column":25}}, + "elements": [] + } + } + ], + "body": { + "type": "BlockStatement", + "start":37,"end":39,"loc":{"start":{"line":2,"column":27},"end":{"line":2,"column":29}}, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/class/parameter-properties-with-decorators/output.json b/packages/babel-parser/test/fixtures/typescript/class/parameter-properties-with-decorators/output.json index a131ac8e6978..0824c1204b7a 100644 --- a/packages/babel-parser/test/fixtures/typescript/class/parameter-properties-with-decorators/output.json +++ b/packages/babel-parser/test/fixtures/typescript/class/parameter-properties-with-decorators/output.json @@ -1,111 +1,32 @@ { "type": "File", - "start": 0, - "end": 55, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":55,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 55, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":55,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 55, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":55,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "id": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "C" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"C"}, "name": "C" }, "superClass": null, "body": { "type": "ClassBody", - "start": 8, - "end": 55, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":8,"end":55,"loc":{"start":{"line":1,"column":8},"end":{"line":3,"column":1}}, "body": [ { "type": "ClassMethod", - "start": 14, - "end": 53, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 43 - } - }, + "start":14,"end":53,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":43}}, "static": false, "key": { "type": "Identifier", - "start": 14, - "end": 25, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 15 - }, - "identifierName": "constructor" - }, + "start":14,"end":25,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":15},"identifierName":"constructor"}, "name": "constructor" }, "computed": false, @@ -116,48 +37,14 @@ "params": [ { "type": "TSParameterProperty", - "start": 31, - "end": 49, - "loc": { - "start": { - "line": 2, - "column": 21 - }, - "end": { - "line": 2, - "column": 39 - } - }, + "start":31,"end":49,"loc":{"start":{"line":2,"column":21},"end":{"line":2,"column":39}}, "decorators": [ { "type": "Decorator", - "start": 26, - "end": 30, - "loc": { - "start": { - "line": 2, - "column": 16 - }, - "end": { - "line": 2, - "column": 20 - } - }, + "start":26,"end":30,"loc":{"start":{"line":2,"column":16},"end":{"line":2,"column":20}}, "expression": { "type": "Identifier", - "start": 27, - "end": 30, - "loc": { - "start": { - "line": 2, - "column": 17 - }, - "end": { - "line": 2, - "column": 20 - }, - "identifierName": "foo" - }, + "start":27,"end":30,"loc":{"start":{"line":2,"column":17},"end":{"line":2,"column":20},"identifierName":"foo"}, "name": "foo" } } @@ -165,48 +52,14 @@ "readonly": true, "parameter": { "type": "Identifier", - "start": 40, - "end": 49, - "loc": { - "start": { - "line": 2, - "column": 30 - }, - "end": { - "line": 2, - "column": 39 - }, - "identifierName": "x" - }, + "start":40,"end":49,"loc":{"start":{"line":2,"column":30},"end":{"line":2,"column":39},"identifierName":"x"}, "name": "x", "typeAnnotation": { "type": "TSTypeAnnotation", - "start": 41, - "end": 49, - "loc": { - "start": { - "line": 2, - "column": 31 - }, - "end": { - "line": 2, - "column": 39 - } - }, + "start":41,"end":49,"loc":{"start":{"line":2,"column":31},"end":{"line":2,"column":39}}, "typeAnnotation": { "type": "TSNumberKeyword", - "start": 43, - "end": 49, - "loc": { - "start": { - "line": 2, - "column": 33 - }, - "end": { - "line": 2, - "column": 39 - } - } + "start":43,"end":49,"loc":{"start":{"line":2,"column":33},"end":{"line":2,"column":39}} } } } @@ -214,18 +67,7 @@ ], "body": { "type": "BlockStatement", - "start": 51, - "end": 53, - "loc": { - "start": { - "line": 2, - "column": 41 - }, - "end": { - "line": 2, - "column": 43 - } - }, + "start":51,"end":53,"loc":{"start":{"line":2,"column":41},"end":{"line":2,"column":43}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/typescript/class/parameter-properties/output.json b/packages/babel-parser/test/fixtures/typescript/class/parameter-properties/output.json index 219e2a2a60b7..0e54ba03db29 100644 --- a/packages/babel-parser/test/fixtures/typescript/class/parameter-properties/output.json +++ b/packages/babel-parser/test/fixtures/typescript/class/parameter-properties/output.json @@ -1,111 +1,32 @@ { "type": "File", - "start": 0, - "end": 257, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 11, - "column": 1 - } - }, + "start":0,"end":257,"loc":{"start":{"line":1,"column":0},"end":{"line":11,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 257, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 11, - "column": 1 - } - }, + "start":0,"end":257,"loc":{"start":{"line":1,"column":0},"end":{"line":11,"column":1}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 257, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 11, - "column": 1 - } - }, + "start":0,"end":257,"loc":{"start":{"line":1,"column":0},"end":{"line":11,"column":1}}, "id": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "C" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"C"}, "name": "C" }, "superClass": null, "body": { "type": "ClassBody", - "start": 8, - "end": 257, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 11, - "column": 1 - } - }, + "start":8,"end":257,"loc":{"start":{"line":1,"column":8},"end":{"line":11,"column":1}}, "body": [ { "type": "ClassMethod", - "start": 14, - "end": 255, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 10, - "column": 33 - } - }, + "start":14,"end":255,"loc":{"start":{"line":2,"column":4},"end":{"line":10,"column":33}}, "static": false, "key": { "type": "Identifier", - "start": 14, - "end": 25, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 15 - }, - "identifierName": "constructor" - }, + "start":14,"end":25,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":15},"identifierName":"constructor"}, "name": "constructor" }, "computed": false, @@ -116,292 +37,88 @@ "params": [ { "type": "TSParameterProperty", - "start": 35, - "end": 45, - "loc": { - "start": { - "line": 3, - "column": 8 - }, - "end": { - "line": 3, - "column": 18 - } - }, + "start":35,"end":45,"loc":{"start":{"line":3,"column":8},"end":{"line":3,"column":18}}, "readonly": true, "parameter": { "type": "Identifier", - "start": 44, - "end": 45, - "loc": { - "start": { - "line": 3, - "column": 17 - }, - "end": { - "line": 3, - "column": 18 - }, - "identifierName": "r" - }, + "start":44,"end":45,"loc":{"start":{"line":3,"column":17},"end":{"line":3,"column":18},"identifierName":"r"}, "name": "r" } }, { "type": "TSParameterProperty", - "start": 55, - "end": 72, - "loc": { - "start": { - "line": 4, - "column": 8 - }, - "end": { - "line": 4, - "column": 25 - } - }, + "start":55,"end":72,"loc":{"start":{"line":4,"column":8},"end":{"line":4,"column":25}}, "accessibility": "public", "parameter": { "type": "Identifier", - "start": 62, - "end": 72, - "loc": { - "start": { - "line": 4, - "column": 15 - }, - "end": { - "line": 4, - "column": 25 - }, - "identifierName": "pu" - }, + "start":62,"end":72,"loc":{"start":{"line":4,"column":15},"end":{"line":4,"column":25},"identifierName":"pu"}, "name": "pu", "typeAnnotation": { "type": "TSTypeAnnotation", - "start": 64, - "end": 72, - "loc": { - "start": { - "line": 4, - "column": 17 - }, - "end": { - "line": 4, - "column": 25 - } - }, + "start":64,"end":72,"loc":{"start":{"line":4,"column":17},"end":{"line":4,"column":25}}, "typeAnnotation": { "type": "TSNumberKeyword", - "start": 66, - "end": 72, - "loc": { - "start": { - "line": 4, - "column": 19 - }, - "end": { - "line": 4, - "column": 25 - } - } + "start":66,"end":72,"loc":{"start":{"line":4,"column":19},"end":{"line":4,"column":25}} } } } }, { "type": "TSParameterProperty", - "start": 82, - "end": 95, - "loc": { - "start": { - "line": 5, - "column": 8 - }, - "end": { - "line": 5, - "column": 21 - } - }, + "start":82,"end":95,"loc":{"start":{"line":5,"column":8},"end":{"line":5,"column":21}}, "accessibility": "protected", "parameter": { "type": "Identifier", - "start": 92, - "end": 95, - "loc": { - "start": { - "line": 5, - "column": 18 - }, - "end": { - "line": 5, - "column": 21 - }, - "identifierName": "po" - }, + "start":92,"end":95,"loc":{"start":{"line":5,"column":18},"end":{"line":5,"column":21},"identifierName":"po"}, "name": "po", "optional": true } }, { "type": "TSParameterProperty", - "start": 105, - "end": 124, - "loc": { - "start": { - "line": 6, - "column": 8 - }, - "end": { - "line": 6, - "column": 27 - } - }, + "start":105,"end":124,"loc":{"start":{"line":6,"column":8},"end":{"line":6,"column":27}}, "accessibility": "private", "parameter": { "type": "Identifier", - "start": 113, - "end": 124, - "loc": { - "start": { - "line": 6, - "column": 16 - }, - "end": { - "line": 6, - "column": 27 - }, - "identifierName": "pi" - }, + "start":113,"end":124,"loc":{"start":{"line":6,"column":16},"end":{"line":6,"column":27},"identifierName":"pi"}, "name": "pi", "optional": true, "typeAnnotation": { "type": "TSTypeAnnotation", - "start": 116, - "end": 124, - "loc": { - "start": { - "line": 6, - "column": 19 - }, - "end": { - "line": 6, - "column": 27 - } - }, + "start":116,"end":124,"loc":{"start":{"line":6,"column":19},"end":{"line":6,"column":27}}, "typeAnnotation": { "type": "TSNumberKeyword", - "start": 118, - "end": 124, - "loc": { - "start": { - "line": 6, - "column": 21 - }, - "end": { - "line": 6, - "column": 27 - } - } + "start":118,"end":124,"loc":{"start":{"line":6,"column":21},"end":{"line":6,"column":27}} } } } }, { "type": "TSParameterProperty", - "start": 134, - "end": 153, - "loc": { - "start": { - "line": 7, - "column": 8 - }, - "end": { - "line": 7, - "column": 27 - } - }, + "start":134,"end":153,"loc":{"start":{"line":7,"column":8},"end":{"line":7,"column":27}}, "accessibility": "public", "readonly": true, "parameter": { "type": "Identifier", - "start": 150, - "end": 153, - "loc": { - "start": { - "line": 7, - "column": 24 - }, - "end": { - "line": 7, - "column": 27 - }, - "identifierName": "pur" - }, + "start":150,"end":153,"loc":{"start":{"line":7,"column":24},"end":{"line":7,"column":27},"identifierName":"pur"}, "name": "pur" } }, { "type": "TSParameterProperty", - "start": 206, - "end": 220, - "loc": { - "start": { - "line": 9, - "column": 8 - }, - "end": { - "line": 9, - "column": 22 - } - }, + "start":206,"end":220,"loc":{"start":{"line":9,"column":8},"end":{"line":9,"column":22}}, "readonly": true, "parameter": { "type": "AssignmentPattern", - "start": 215, - "end": 220, - "loc": { - "start": { - "line": 9, - "column": 17 - }, - "end": { - "line": 9, - "column": 22 - } - }, + "start":215,"end":220,"loc":{"start":{"line":9,"column":17},"end":{"line":9,"column":22}}, "left": { "type": "Identifier", - "start": 215, - "end": 216, - "loc": { - "start": { - "line": 9, - "column": 17 - }, - "end": { - "line": 9, - "column": 18 - }, - "identifierName": "x" - }, + "start":215,"end":216,"loc":{"start":{"line":9,"column":17},"end":{"line":9,"column":18},"identifierName":"x"}, "name": "x" }, "right": { "type": "NumericLiteral", - "start": 219, - "end": 220, - "loc": { - "start": { - "line": 9, - "column": 21 - }, - "end": { - "line": 9, - "column": 22 - } - }, + "start":219,"end":220,"loc":{"start":{"line":9,"column":21},"end":{"line":9,"column":22}}, "extra": { "rawValue": 0, "raw": "0" @@ -413,112 +130,34 @@ { "type": "CommentLine", "value": " Also works on AssignmentPattern", - "start": 163, - "end": 197, - "loc": { - "start": { - "line": 8, - "column": 8 - }, - "end": { - "line": 8, - "column": 42 - } - } + "start":163,"end":197,"loc":{"start":{"line":8,"column":8},"end":{"line":8,"column":42}} } ] }, { "type": "TSParameterProperty", - "start": 230, - "end": 251, - "loc": { - "start": { - "line": 10, - "column": 8 - }, - "end": { - "line": 10, - "column": 29 - } - }, + "start":230,"end":251,"loc":{"start":{"line":10,"column":8},"end":{"line":10,"column":29}}, "accessibility": "public", "parameter": { "type": "AssignmentPattern", - "start": 237, - "end": 251, - "loc": { - "start": { - "line": 10, - "column": 15 - }, - "end": { - "line": 10, - "column": 29 - } - }, + "start":237,"end":251,"loc":{"start":{"line":10,"column":15},"end":{"line":10,"column":29}}, "left": { "type": "Identifier", - "start": 237, - "end": 247, - "loc": { - "start": { - "line": 10, - "column": 15 - }, - "end": { - "line": 10, - "column": 25 - }, - "identifierName": "y" - }, + "start":237,"end":247,"loc":{"start":{"line":10,"column":15},"end":{"line":10,"column":25},"identifierName":"y"}, "name": "y", "optional": true, "typeAnnotation": { "type": "TSTypeAnnotation", - "start": 239, - "end": 247, - "loc": { - "start": { - "line": 10, - "column": 17 - }, - "end": { - "line": 10, - "column": 25 - } - }, + "start":239,"end":247,"loc":{"start":{"line":10,"column":17},"end":{"line":10,"column":25}}, "typeAnnotation": { "type": "TSNumberKeyword", - "start": 241, - "end": 247, - "loc": { - "start": { - "line": 10, - "column": 19 - }, - "end": { - "line": 10, - "column": 25 - } - } + "start":241,"end":247,"loc":{"start":{"line":10,"column":19},"end":{"line":10,"column":25}} } } }, "right": { "type": "NumericLiteral", - "start": 250, - "end": 251, - "loc": { - "start": { - "line": 10, - "column": 28 - }, - "end": { - "line": 10, - "column": 29 - } - }, + "start":250,"end":251,"loc":{"start":{"line":10,"column":28},"end":{"line":10,"column":29}}, "extra": { "rawValue": 0, "raw": "0" @@ -530,18 +169,7 @@ ], "body": { "type": "BlockStatement", - "start": 253, - "end": 255, - "loc": { - "start": { - "line": 10, - "column": 31 - }, - "end": { - "line": 10, - "column": 33 - } - }, + "start":253,"end":255,"loc":{"start":{"line":10,"column":31},"end":{"line":10,"column":33}}, "body": [], "directives": [] } @@ -556,18 +184,7 @@ { "type": "CommentLine", "value": " Also works on AssignmentPattern", - "start": 163, - "end": 197, - "loc": { - "start": { - "line": 8, - "column": 8 - }, - "end": { - "line": 8, - "column": 42 - } - } + "start":163,"end":197,"loc":{"start":{"line":8,"column":8},"end":{"line":8,"column":42}} } ] } \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/class/predicate-types/output.json b/packages/babel-parser/test/fixtures/typescript/class/predicate-types/output.json index a0f7f5f5f39b..22a3ca661e86 100644 --- a/packages/babel-parser/test/fixtures/typescript/class/predicate-types/output.json +++ b/packages/babel-parser/test/fixtures/typescript/class/predicate-types/output.json @@ -1,111 +1,32 @@ { "type": "File", - "start": 0, - "end": 83, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 6, - "column": 1 - } - }, + "start":0,"end":83,"loc":{"start":{"line":1,"column":0},"end":{"line":6,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 83, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 6, - "column": 1 - } - }, + "start":0,"end":83,"loc":{"start":{"line":1,"column":0},"end":{"line":6,"column":1}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 83, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 6, - "column": 1 - } - }, + "start":0,"end":83,"loc":{"start":{"line":1,"column":0},"end":{"line":6,"column":1}}, "id": { "type": "Identifier", - "start": 6, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "Foo" - }, + "start":6,"end":9,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":9},"identifierName":"Foo"}, "name": "Foo" }, "superClass": null, "body": { "type": "ClassBody", - "start": 10, - "end": 83, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 6, - "column": 1 - } - }, + "start":10,"end":83,"loc":{"start":{"line":1,"column":10},"end":{"line":6,"column":1}}, "body": [ { "type": "ClassMethod", - "start": 14, - "end": 43, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 3, - "column": 3 - } - }, + "start":14,"end":43,"loc":{"start":{"line":2,"column":2},"end":{"line":3,"column":3}}, "static": false, "key": { "type": "Identifier", - "start": 14, - "end": 19, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 7 - }, - "identifierName": "isBar" - }, + "start":14,"end":19,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":7},"identifierName":"isBar"}, "name": "isBar" }, "computed": false, @@ -116,215 +37,60 @@ "params": [], "returnType": { "type": "TSTypeAnnotation", - "start": 21, - "end": 37, - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 25 - } - }, + "start":21,"end":37,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":25}}, "typeAnnotation": { "type": "TSTypePredicate", - "start": 23, - "end": 37, - "loc": { - "start": { - "line": 2, - "column": 11 - }, - "end": { - "line": 2, - "column": 25 - } - }, + "start":23,"end":37,"loc":{"start":{"line":2,"column":11},"end":{"line":2,"column":25}}, "parameterName": { "type": "TSThisType", - "start": 23, - "end": 27, - "loc": { - "start": { - "line": 2, - "column": 11 - }, - "end": { - "line": 2, - "column": 15 - } - } + "start":23,"end":27,"loc":{"start":{"line":2,"column":11},"end":{"line":2,"column":15}} }, "typeAnnotation": { "type": "TSTypeAnnotation", - "start": 31, - "end": 37, - "loc": { - "start": { - "line": 2, - "column": 19 - }, - "end": { - "line": 2, - "column": 25 - } - }, + "start":31,"end":37,"loc":{"start":{"line":2,"column":19},"end":{"line":2,"column":25}}, "typeAnnotation": { "type": "TSStringKeyword", - "start": 31, - "end": 37, - "loc": { - "start": { - "line": 2, - "column": 19 - }, - "end": { - "line": 2, - "column": 25 - } - } + "start":31,"end":37,"loc":{"start":{"line":2,"column":19},"end":{"line":2,"column":25}} } } } }, "body": { "type": "BlockStatement", - "start": 38, - "end": 43, - "loc": { - "start": { - "line": 2, - "column": 26 - }, - "end": { - "line": 3, - "column": 3 - } - }, + "start":38,"end":43,"loc":{"start":{"line":2,"column":26},"end":{"line":3,"column":3}}, "body": [], "directives": [] } }, { "type": "ClassProperty", - "start": 46, - "end": 81, - "loc": { - "start": { - "line": 4, - "column": 2 - }, - "end": { - "line": 5, - "column": 3 - } - }, + "start":46,"end":81,"loc":{"start":{"line":4,"column":2},"end":{"line":5,"column":3}}, "static": false, "key": { "type": "Identifier", - "start": 46, - "end": 51, - "loc": { - "start": { - "line": 4, - "column": 2 - }, - "end": { - "line": 4, - "column": 7 - }, - "identifierName": "isBaz" - }, + "start":46,"end":51,"loc":{"start":{"line":4,"column":2},"end":{"line":4,"column":7},"identifierName":"isBaz"}, "name": "isBaz" }, "computed": false, "value": { "type": "ArrowFunctionExpression", - "start": 54, - "end": 81, - "loc": { - "start": { - "line": 4, - "column": 10 - }, - "end": { - "line": 5, - "column": 3 - } - }, + "start":54,"end":81,"loc":{"start":{"line":4,"column":10},"end":{"line":5,"column":3}}, "returnType": { "type": "TSTypeAnnotation", - "start": 56, - "end": 72, - "loc": { - "start": { - "line": 4, - "column": 12 - }, - "end": { - "line": 4, - "column": 28 - } - }, + "start":56,"end":72,"loc":{"start":{"line":4,"column":12},"end":{"line":4,"column":28}}, "typeAnnotation": { "type": "TSTypePredicate", - "start": 58, - "end": 72, - "loc": { - "start": { - "line": 4, - "column": 14 - }, - "end": { - "line": 4, - "column": 28 - } - }, + "start":58,"end":72,"loc":{"start":{"line":4,"column":14},"end":{"line":4,"column":28}}, "parameterName": { "type": "TSThisType", - "start": 58, - "end": 62, - "loc": { - "start": { - "line": 4, - "column": 14 - }, - "end": { - "line": 4, - "column": 18 - } - } + "start":58,"end":62,"loc":{"start":{"line":4,"column":14},"end":{"line":4,"column":18}} }, "typeAnnotation": { "type": "TSTypeAnnotation", - "start": 66, - "end": 72, - "loc": { - "start": { - "line": 4, - "column": 22 - }, - "end": { - "line": 4, - "column": 28 - } - }, + "start":66,"end":72,"loc":{"start":{"line":4,"column":22},"end":{"line":4,"column":28}}, "typeAnnotation": { "type": "TSStringKeyword", - "start": 66, - "end": 72, - "loc": { - "start": { - "line": 4, - "column": 22 - }, - "end": { - "line": 4, - "column": 28 - } - } + "start":66,"end":72,"loc":{"start":{"line":4,"column":22},"end":{"line":4,"column":28}} } } } @@ -335,18 +101,7 @@ "params": [], "body": { "type": "BlockStatement", - "start": 76, - "end": 81, - "loc": { - "start": { - "line": 4, - "column": 32 - }, - "end": { - "line": 5, - "column": 3 - } - }, + "start":76,"end":81,"loc":{"start":{"line":4,"column":32},"end":{"line":5,"column":3}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/typescript/class/private-fields-modifier-abstract/input.ts b/packages/babel-parser/test/fixtures/typescript/class/private-fields-modifier-abstract/input.ts new file mode 100644 index 000000000000..7cf85ea5ec29 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/class/private-fields-modifier-abstract/input.ts @@ -0,0 +1,3 @@ +abstract class A { + abstract #a; +} diff --git a/packages/babel-parser/test/fixtures/typescript/class/private-fields-modifier-abstract/output.json b/packages/babel-parser/test/fixtures/typescript/class/private-fields-modifier-abstract/output.json new file mode 100644 index 000000000000..59f5d53634e7 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/class/private-fields-modifier-abstract/output.json @@ -0,0 +1,49 @@ +{ + "type": "File", + "start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "errors": [ + "SyntaxError: Private elements cannot have the 'abstract' modifier. (2:2)" + ], + "program": { + "type": "Program", + "start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "abstract": true, + "id": { + "type": "Identifier", + "start":15,"end":16,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":16},"identifierName":"A"}, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":17,"end":35,"loc":{"start":{"line":1,"column":17},"end":{"line":3,"column":1}}, + "body": [ + { + "type": "ClassPrivateProperty", + "start":21,"end":33,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":14}}, + "abstract": true, + "static": false, + "key": { + "type": "PrivateName", + "start":30,"end":32,"loc":{"start":{"line":2,"column":11},"end":{"line":2,"column":13}}, + "id": { + "type": "Identifier", + "start":31,"end":32,"loc":{"start":{"line":2,"column":12},"end":{"line":2,"column":13},"identifierName":"a"}, + "name": "a" + } + }, + "value": null + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/class/private-fields-modifier-private/input.ts b/packages/babel-parser/test/fixtures/typescript/class/private-fields-modifier-private/input.ts new file mode 100644 index 000000000000..a4472caceb86 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/class/private-fields-modifier-private/input.ts @@ -0,0 +1,3 @@ +class A { + private #a; +} diff --git a/packages/babel-parser/test/fixtures/typescript/class/private-fields-modifier-private/output.json b/packages/babel-parser/test/fixtures/typescript/class/private-fields-modifier-private/output.json new file mode 100644 index 000000000000..5e3dd363ef99 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/class/private-fields-modifier-private/output.json @@ -0,0 +1,48 @@ +{ + "type": "File", + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "errors": [ + "SyntaxError: Private elements cannot have an accessibility modifier ('private') (2:2)" + ], + "program": { + "type": "Program", + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "id": { + "type": "Identifier", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":8,"end":25,"loc":{"start":{"line":1,"column":8},"end":{"line":3,"column":1}}, + "body": [ + { + "type": "ClassPrivateProperty", + "start":12,"end":23,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":13}}, + "accessibility": "private", + "static": false, + "key": { + "type": "PrivateName", + "start":20,"end":22,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":12}}, + "id": { + "type": "Identifier", + "start":21,"end":22,"loc":{"start":{"line":2,"column":11},"end":{"line":2,"column":12},"identifierName":"a"}, + "name": "a" + } + }, + "value": null + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/class/private-fields-modifier-protected/input.ts b/packages/babel-parser/test/fixtures/typescript/class/private-fields-modifier-protected/input.ts new file mode 100644 index 000000000000..0f35b844a7be --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/class/private-fields-modifier-protected/input.ts @@ -0,0 +1,3 @@ +class A { + protected #a; +} diff --git a/packages/babel-parser/test/fixtures/typescript/class/private-fields-modifier-protected/output.json b/packages/babel-parser/test/fixtures/typescript/class/private-fields-modifier-protected/output.json new file mode 100644 index 000000000000..8a49738f30e3 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/class/private-fields-modifier-protected/output.json @@ -0,0 +1,48 @@ +{ + "type": "File", + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "errors": [ + "SyntaxError: Private elements cannot have an accessibility modifier ('protected') (2:2)" + ], + "program": { + "type": "Program", + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "id": { + "type": "Identifier", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":8,"end":27,"loc":{"start":{"line":1,"column":8},"end":{"line":3,"column":1}}, + "body": [ + { + "type": "ClassPrivateProperty", + "start":12,"end":25,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":15}}, + "accessibility": "protected", + "static": false, + "key": { + "type": "PrivateName", + "start":22,"end":24,"loc":{"start":{"line":2,"column":12},"end":{"line":2,"column":14}}, + "id": { + "type": "Identifier", + "start":23,"end":24,"loc":{"start":{"line":2,"column":13},"end":{"line":2,"column":14},"identifierName":"a"}, + "name": "a" + } + }, + "value": null + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/class/private-fields-modifier-public/input.ts b/packages/babel-parser/test/fixtures/typescript/class/private-fields-modifier-public/input.ts new file mode 100644 index 000000000000..59a236000e60 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/class/private-fields-modifier-public/input.ts @@ -0,0 +1,3 @@ +class A { + public #a; +} diff --git a/packages/babel-parser/test/fixtures/typescript/class/private-fields-modifier-public/output.json b/packages/babel-parser/test/fixtures/typescript/class/private-fields-modifier-public/output.json new file mode 100644 index 000000000000..0bf961bf5037 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/class/private-fields-modifier-public/output.json @@ -0,0 +1,48 @@ +{ + "type": "File", + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "errors": [ + "SyntaxError: Private elements cannot have an accessibility modifier ('public') (2:2)" + ], + "program": { + "type": "Program", + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "id": { + "type": "Identifier", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":8,"end":24,"loc":{"start":{"line":1,"column":8},"end":{"line":3,"column":1}}, + "body": [ + { + "type": "ClassPrivateProperty", + "start":12,"end":22,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":12}}, + "accessibility": "public", + "static": false, + "key": { + "type": "PrivateName", + "start":19,"end":21,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":11}}, + "id": { + "type": "Identifier", + "start":20,"end":21,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":11},"identifierName":"a"}, + "name": "a" + } + }, + "value": null + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/class/private-fields-modifier-readonly/input.ts b/packages/babel-parser/test/fixtures/typescript/class/private-fields-modifier-readonly/input.ts new file mode 100644 index 000000000000..355def79b8b7 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/class/private-fields-modifier-readonly/input.ts @@ -0,0 +1,4 @@ +class A { + readonly #a; + readonly #b: string; +} diff --git a/packages/babel-parser/test/fixtures/typescript/class/private-fields-modifier-readonly/output.json b/packages/babel-parser/test/fixtures/typescript/class/private-fields-modifier-readonly/output.json new file mode 100644 index 000000000000..d97d1b18bcd0 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/class/private-fields-modifier-readonly/output.json @@ -0,0 +1,69 @@ +{ + "type": "File", + "start":0,"end":49,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "program": { + "type": "Program", + "start":0,"end":49,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start":0,"end":49,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "id": { + "type": "Identifier", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":8,"end":49,"loc":{"start":{"line":1,"column":8},"end":{"line":4,"column":1}}, + "body": [ + { + "type": "ClassPrivateProperty", + "start":12,"end":24,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":14}}, + "readonly": true, + "static": false, + "key": { + "type": "PrivateName", + "start":21,"end":23,"loc":{"start":{"line":2,"column":11},"end":{"line":2,"column":13}}, + "id": { + "type": "Identifier", + "start":22,"end":23,"loc":{"start":{"line":2,"column":12},"end":{"line":2,"column":13},"identifierName":"a"}, + "name": "a" + } + }, + "value": null + }, + { + "type": "ClassPrivateProperty", + "start":27,"end":47,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":22}}, + "readonly": true, + "static": false, + "key": { + "type": "PrivateName", + "start":36,"end":38,"loc":{"start":{"line":3,"column":11},"end":{"line":3,"column":13}}, + "id": { + "type": "Identifier", + "start":37,"end":38,"loc":{"start":{"line":3,"column":12},"end":{"line":3,"column":13},"identifierName":"b"}, + "name": "b" + } + }, + "typeAnnotation": { + "type": "TSTypeAnnotation", + "start":38,"end":46,"loc":{"start":{"line":3,"column":13},"end":{"line":3,"column":21}}, + "typeAnnotation": { + "type": "TSStringKeyword", + "start":40,"end":46,"loc":{"start":{"line":3,"column":15},"end":{"line":3,"column":21}} + } + }, + "value": null + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/class/private-fields-static/input.ts b/packages/babel-parser/test/fixtures/typescript/class/private-fields-static/input.ts new file mode 100644 index 000000000000..4725b09bea74 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/class/private-fields-static/input.ts @@ -0,0 +1,4 @@ +class A { + static #x; + static #y: string; +} diff --git a/packages/babel-parser/test/fixtures/typescript/class/private-fields-static/output.json b/packages/babel-parser/test/fixtures/typescript/class/private-fields-static/output.json new file mode 100644 index 000000000000..96b576baa8d2 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/class/private-fields-static/output.json @@ -0,0 +1,67 @@ +{ + "type": "File", + "start":0,"end":45,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "program": { + "type": "Program", + "start":0,"end":45,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start":0,"end":45,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "id": { + "type": "Identifier", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":8,"end":45,"loc":{"start":{"line":1,"column":8},"end":{"line":4,"column":1}}, + "body": [ + { + "type": "ClassPrivateProperty", + "start":12,"end":22,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":12}}, + "static": true, + "key": { + "type": "PrivateName", + "start":19,"end":21,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":11}}, + "id": { + "type": "Identifier", + "start":20,"end":21,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":11},"identifierName":"x"}, + "name": "x" + } + }, + "value": null + }, + { + "type": "ClassPrivateProperty", + "start":25,"end":43,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":20}}, + "static": true, + "key": { + "type": "PrivateName", + "start":32,"end":34,"loc":{"start":{"line":3,"column":9},"end":{"line":3,"column":11}}, + "id": { + "type": "Identifier", + "start":33,"end":34,"loc":{"start":{"line":3,"column":10},"end":{"line":3,"column":11},"identifierName":"y"}, + "name": "y" + } + }, + "typeAnnotation": { + "type": "TSTypeAnnotation", + "start":34,"end":42,"loc":{"start":{"line":3,"column":11},"end":{"line":3,"column":19}}, + "typeAnnotation": { + "type": "TSStringKeyword", + "start":36,"end":42,"loc":{"start":{"line":3,"column":13},"end":{"line":3,"column":19}} + } + }, + "value": null + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/class/private-fields/input.ts b/packages/babel-parser/test/fixtures/typescript/class/private-fields/input.ts new file mode 100644 index 000000000000..30c6024e99ce --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/class/private-fields/input.ts @@ -0,0 +1,7 @@ +class A { + #a: string; + #b?; + #c?: number; + #d!; + #e!: boolean; +} diff --git a/packages/babel-parser/test/fixtures/typescript/class/private-fields/output.json b/packages/babel-parser/test/fixtures/typescript/class/private-fields/output.json new file mode 100644 index 000000000000..6d6a986845db --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/class/private-fields/output.json @@ -0,0 +1,132 @@ +{ + "type": "File", + "start":0,"end":70,"loc":{"start":{"line":1,"column":0},"end":{"line":7,"column":1}}, + "program": { + "type": "Program", + "start":0,"end":70,"loc":{"start":{"line":1,"column":0},"end":{"line":7,"column":1}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start":0,"end":70,"loc":{"start":{"line":1,"column":0},"end":{"line":7,"column":1}}, + "id": { + "type": "Identifier", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":8,"end":70,"loc":{"start":{"line":1,"column":8},"end":{"line":7,"column":1}}, + "body": [ + { + "type": "ClassPrivateProperty", + "start":12,"end":23,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":13}}, + "static": false, + "key": { + "type": "PrivateName", + "start":12,"end":14,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":4}}, + "id": { + "type": "Identifier", + "start":13,"end":14,"loc":{"start":{"line":2,"column":3},"end":{"line":2,"column":4},"identifierName":"a"}, + "name": "a" + } + }, + "typeAnnotation": { + "type": "TSTypeAnnotation", + "start":14,"end":22,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":12}}, + "typeAnnotation": { + "type": "TSStringKeyword", + "start":16,"end":22,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":12}} + } + }, + "value": null + }, + { + "type": "ClassPrivateProperty", + "start":26,"end":30,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":6}}, + "static": false, + "key": { + "type": "PrivateName", + "start":26,"end":28,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":4}}, + "id": { + "type": "Identifier", + "start":27,"end":28,"loc":{"start":{"line":3,"column":3},"end":{"line":3,"column":4},"identifierName":"b"}, + "name": "b" + } + }, + "optional": true, + "value": null + }, + { + "type": "ClassPrivateProperty", + "start":33,"end":45,"loc":{"start":{"line":4,"column":2},"end":{"line":4,"column":14}}, + "static": false, + "key": { + "type": "PrivateName", + "start":33,"end":35,"loc":{"start":{"line":4,"column":2},"end":{"line":4,"column":4}}, + "id": { + "type": "Identifier", + "start":34,"end":35,"loc":{"start":{"line":4,"column":3},"end":{"line":4,"column":4},"identifierName":"c"}, + "name": "c" + } + }, + "optional": true, + "typeAnnotation": { + "type": "TSTypeAnnotation", + "start":36,"end":44,"loc":{"start":{"line":4,"column":5},"end":{"line":4,"column":13}}, + "typeAnnotation": { + "type": "TSNumberKeyword", + "start":38,"end":44,"loc":{"start":{"line":4,"column":7},"end":{"line":4,"column":13}} + } + }, + "value": null + }, + { + "type": "ClassPrivateProperty", + "start":48,"end":52,"loc":{"start":{"line":5,"column":2},"end":{"line":5,"column":6}}, + "static": false, + "key": { + "type": "PrivateName", + "start":48,"end":50,"loc":{"start":{"line":5,"column":2},"end":{"line":5,"column":4}}, + "id": { + "type": "Identifier", + "start":49,"end":50,"loc":{"start":{"line":5,"column":3},"end":{"line":5,"column":4},"identifierName":"d"}, + "name": "d" + } + }, + "definite": true, + "value": null + }, + { + "type": "ClassPrivateProperty", + "start":55,"end":68,"loc":{"start":{"line":6,"column":2},"end":{"line":6,"column":15}}, + "static": false, + "key": { + "type": "PrivateName", + "start":55,"end":57,"loc":{"start":{"line":6,"column":2},"end":{"line":6,"column":4}}, + "id": { + "type": "Identifier", + "start":56,"end":57,"loc":{"start":{"line":6,"column":3},"end":{"line":6,"column":4},"identifierName":"e"}, + "name": "e" + } + }, + "definite": true, + "typeAnnotation": { + "type": "TSTypeAnnotation", + "start":58,"end":67,"loc":{"start":{"line":6,"column":5},"end":{"line":6,"column":14}}, + "typeAnnotation": { + "type": "TSBooleanKeyword", + "start":60,"end":67,"loc":{"start":{"line":6,"column":7},"end":{"line":6,"column":14}} + } + }, + "value": null + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/class/properties/output.json b/packages/babel-parser/test/fixtures/typescript/class/properties/output.json index e2d79f6dbdb2..a0f6801ab6f3 100644 --- a/packages/babel-parser/test/fixtures/typescript/class/properties/output.json +++ b/packages/babel-parser/test/fixtures/typescript/class/properties/output.json @@ -1,111 +1,32 @@ { "type": "File", - "start": 0, - "end": 84, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 8, - "column": 1 - } - }, + "start":0,"end":84,"loc":{"start":{"line":1,"column":0},"end":{"line":8,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 84, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 8, - "column": 1 - } - }, + "start":0,"end":84,"loc":{"start":{"line":1,"column":0},"end":{"line":8,"column":1}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 84, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 8, - "column": 1 - } - }, + "start":0,"end":84,"loc":{"start":{"line":1,"column":0},"end":{"line":8,"column":1}}, "id": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "C" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"C"}, "name": "C" }, "superClass": null, "body": { "type": "ClassBody", - "start": 8, - "end": 84, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 8, - "column": 1 - } - }, + "start":8,"end":84,"loc":{"start":{"line":1,"column":8},"end":{"line":8,"column":1}}, "body": [ { "type": "ClassProperty", - "start": 14, - "end": 16, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 6 - } - }, + "start":14,"end":16,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":6}}, "static": false, "key": { "type": "Identifier", - "start": 14, - "end": 15, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 5 - }, - "identifierName": "x" - }, + "start":14,"end":15,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":5},"identifierName":"x"}, "name": "x" }, "computed": false, @@ -113,34 +34,11 @@ }, { "type": "ClassProperty", - "start": 21, - "end": 24, - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 7 - } - }, + "start":21,"end":24,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":7}}, "static": false, "key": { "type": "Identifier", - "start": 21, - "end": 22, - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 5 - }, - "identifierName": "x" - }, + "start":21,"end":22,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":5},"identifierName":"x"}, "name": "x" }, "computed": false, @@ -149,146 +47,45 @@ }, { "type": "ClassProperty", - "start": 29, - "end": 39, - "loc": { - "start": { - "line": 4, - "column": 4 - }, - "end": { - "line": 4, - "column": 14 - } - }, + "start":29,"end":39,"loc":{"start":{"line":4,"column":4},"end":{"line":4,"column":14}}, "static": false, "key": { "type": "Identifier", - "start": 29, - "end": 30, - "loc": { - "start": { - "line": 4, - "column": 4 - }, - "end": { - "line": 4, - "column": 5 - }, - "identifierName": "x" - }, + "start":29,"end":30,"loc":{"start":{"line":4,"column":4},"end":{"line":4,"column":5},"identifierName":"x"}, "name": "x" }, "computed": false, "typeAnnotation": { "type": "TSTypeAnnotation", - "start": 30, - "end": 38, - "loc": { - "start": { - "line": 4, - "column": 5 - }, - "end": { - "line": 4, - "column": 13 - } - }, + "start":30,"end":38,"loc":{"start":{"line":4,"column":5},"end":{"line":4,"column":13}}, "typeAnnotation": { "type": "TSNumberKeyword", - "start": 32, - "end": 38, - "loc": { - "start": { - "line": 4, - "column": 7 - }, - "end": { - "line": 4, - "column": 13 - } - } + "start":32,"end":38,"loc":{"start":{"line":4,"column":7},"end":{"line":4,"column":13}} } }, "value": null }, { "type": "ClassProperty", - "start": 44, - "end": 58, - "loc": { - "start": { - "line": 5, - "column": 4 - }, - "end": { - "line": 5, - "column": 18 - } - }, + "start":44,"end":58,"loc":{"start":{"line":5,"column":4},"end":{"line":5,"column":18}}, "static": false, "key": { "type": "Identifier", - "start": 44, - "end": 45, - "loc": { - "start": { - "line": 5, - "column": 4 - }, - "end": { - "line": 5, - "column": 5 - }, - "identifierName": "x" - }, + "start":44,"end":45,"loc":{"start":{"line":5,"column":4},"end":{"line":5,"column":5},"identifierName":"x"}, "name": "x" }, "computed": false, "typeAnnotation": { "type": "TSTypeAnnotation", - "start": 45, - "end": 53, - "loc": { - "start": { - "line": 5, - "column": 5 - }, - "end": { - "line": 5, - "column": 13 - } - }, + "start":45,"end":53,"loc":{"start":{"line":5,"column":5},"end":{"line":5,"column":13}}, "typeAnnotation": { "type": "TSNumberKeyword", - "start": 47, - "end": 53, - "loc": { - "start": { - "line": 5, - "column": 7 - }, - "end": { - "line": 5, - "column": 13 - } - } + "start":47,"end":53,"loc":{"start":{"line":5,"column":7},"end":{"line":5,"column":13}} } }, "value": { "type": "NumericLiteral", - "start": 56, - "end": 57, - "loc": { - "start": { - "line": 5, - "column": 16 - }, - "end": { - "line": 5, - "column": 17 - } - }, + "start":56,"end":57,"loc":{"start":{"line":5,"column":16},"end":{"line":5,"column":17}}, "extra": { "rawValue": 1, "raw": "1" @@ -298,34 +95,11 @@ }, { "type": "ClassProperty", - "start": 63, - "end": 66, - "loc": { - "start": { - "line": 6, - "column": 4 - }, - "end": { - "line": 6, - "column": 7 - } - }, + "start":63,"end":66,"loc":{"start":{"line":6,"column":4},"end":{"line":6,"column":7}}, "static": false, "key": { "type": "Identifier", - "start": 63, - "end": 64, - "loc": { - "start": { - "line": 6, - "column": 4 - }, - "end": { - "line": 6, - "column": 5 - }, - "identifierName": "x" - }, + "start":63,"end":64,"loc":{"start":{"line":6,"column":4},"end":{"line":6,"column":5},"identifierName":"x"}, "name": "x" }, "computed": false, @@ -334,66 +108,21 @@ }, { "type": "ClassProperty", - "start": 71, - "end": 82, - "loc": { - "start": { - "line": 7, - "column": 4 - }, - "end": { - "line": 7, - "column": 15 - } - }, + "start":71,"end":82,"loc":{"start":{"line":7,"column":4},"end":{"line":7,"column":15}}, "static": false, "key": { "type": "Identifier", - "start": 71, - "end": 72, - "loc": { - "start": { - "line": 7, - "column": 4 - }, - "end": { - "line": 7, - "column": 5 - }, - "identifierName": "x" - }, + "start":71,"end":72,"loc":{"start":{"line":7,"column":4},"end":{"line":7,"column":5},"identifierName":"x"}, "name": "x" }, "computed": false, "definite": true, "typeAnnotation": { "type": "TSTypeAnnotation", - "start": 73, - "end": 81, - "loc": { - "start": { - "line": 7, - "column": 6 - }, - "end": { - "line": 7, - "column": 14 - } - }, + "start":73,"end":81,"loc":{"start":{"line":7,"column":6},"end":{"line":7,"column":14}}, "typeAnnotation": { "type": "TSNumberKeyword", - "start": 75, - "end": 81, - "loc": { - "start": { - "line": 7, - "column": 8 - }, - "end": { - "line": 7, - "column": 14 - } - } + "start":75,"end":81,"loc":{"start":{"line":7,"column":8},"end":{"line":7,"column":14}} } }, "value": null diff --git a/packages/babel-parser/test/fixtures/typescript/class/property-computed/output.json b/packages/babel-parser/test/fixtures/typescript/class/property-computed/output.json index 4056ed0c50c8..e44bdb7e0136 100644 --- a/packages/babel-parser/test/fixtures/typescript/class/property-computed/output.json +++ b/packages/babel-parser/test/fixtures/typescript/class/property-computed/output.json @@ -1,241 +1,71 @@ { "type": "File", - "start": 0, - "end": 74, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":0,"end":74,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 74, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":0,"end":74,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 74, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":0,"end":74,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, "id": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "C" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"C"}, "name": "C" }, "superClass": null, "body": { "type": "ClassBody", - "start": 8, - "end": 74, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":8,"end":74,"loc":{"start":{"line":1,"column":8},"end":{"line":4,"column":1}}, "body": [ { "type": "ClassProperty", - "start": 14, - "end": 40, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 30 - } - }, + "start":14,"end":40,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":30}}, "static": false, "computed": true, "key": { "type": "MemberExpression", - "start": 15, - "end": 30, - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 20 - } - }, + "start":15,"end":30,"loc":{"start":{"line":2,"column":5},"end":{"line":2,"column":20}}, "object": { "type": "Identifier", - "start": 15, - "end": 21, - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 11 - }, - "identifierName": "Symbol" - }, + "start":15,"end":21,"loc":{"start":{"line":2,"column":5},"end":{"line":2,"column":11},"identifierName":"Symbol"}, "name": "Symbol" }, "property": { "type": "Identifier", - "start": 22, - "end": 30, - "loc": { - "start": { - "line": 2, - "column": 12 - }, - "end": { - "line": 2, - "column": 20 - }, - "identifierName": "iterator" - }, + "start":22,"end":30,"loc":{"start":{"line":2,"column":12},"end":{"line":2,"column":20},"identifierName":"iterator"}, "name": "iterator" }, "computed": false }, "typeAnnotation": { "type": "TSTypeAnnotation", - "start": 31, - "end": 39, - "loc": { - "start": { - "line": 2, - "column": 21 - }, - "end": { - "line": 2, - "column": 29 - } - }, + "start":31,"end":39,"loc":{"start":{"line":2,"column":21},"end":{"line":2,"column":29}}, "typeAnnotation": { "type": "TSNumberKeyword", - "start": 33, - "end": 39, - "loc": { - "start": { - "line": 2, - "column": 23 - }, - "end": { - "line": 2, - "column": 29 - } - } + "start":33,"end":39,"loc":{"start":{"line":2,"column":23},"end":{"line":2,"column":29}} } }, "value": null }, { "type": "ClassProperty", - "start": 45, - "end": 72, - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 31 - } - }, + "start":45,"end":72,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":31}}, "static": false, "computed": true, "key": { "type": "MemberExpression", - "start": 46, - "end": 61, - "loc": { - "start": { - "line": 3, - "column": 5 - }, - "end": { - "line": 3, - "column": 20 - } - }, + "start":46,"end":61,"loc":{"start":{"line":3,"column":5},"end":{"line":3,"column":20}}, "object": { "type": "Identifier", - "start": 46, - "end": 52, - "loc": { - "start": { - "line": 3, - "column": 5 - }, - "end": { - "line": 3, - "column": 11 - }, - "identifierName": "Symbol" - }, + "start":46,"end":52,"loc":{"start":{"line":3,"column":5},"end":{"line":3,"column":11},"identifierName":"Symbol"}, "name": "Symbol" }, "property": { "type": "Identifier", - "start": 53, - "end": 61, - "loc": { - "start": { - "line": 3, - "column": 12 - }, - "end": { - "line": 3, - "column": 20 - }, - "identifierName": "iterator" - }, + "start":53,"end":61,"loc":{"start":{"line":3,"column":12},"end":{"line":3,"column":20},"identifierName":"iterator"}, "name": "iterator" }, "computed": false @@ -243,32 +73,10 @@ "optional": true, "typeAnnotation": { "type": "TSTypeAnnotation", - "start": 63, - "end": 71, - "loc": { - "start": { - "line": 3, - "column": 22 - }, - "end": { - "line": 3, - "column": 30 - } - }, + "start":63,"end":71,"loc":{"start":{"line":3,"column":22},"end":{"line":3,"column":30}}, "typeAnnotation": { "type": "TSNumberKeyword", - "start": 65, - "end": 71, - "loc": { - "start": { - "line": 3, - "column": 24 - }, - "end": { - "line": 3, - "column": 30 - } - } + "start":65,"end":71,"loc":{"start":{"line":3,"column":24},"end":{"line":3,"column":30}} } }, "value": null diff --git a/packages/babel-parser/test/fixtures/typescript/class/static/output.json b/packages/babel-parser/test/fixtures/typescript/class/static/output.json index 4c2c94afa928..6e530a5502c5 100644 --- a/packages/babel-parser/test/fixtures/typescript/class/static/output.json +++ b/packages/babel-parser/test/fixtures/typescript/class/static/output.json @@ -1,111 +1,32 @@ { "type": "File", - "start": 0, - "end": 100, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 6, - "column": 1 - } - }, + "start":0,"end":100,"loc":{"start":{"line":1,"column":0},"end":{"line":6,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 100, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 6, - "column": 1 - } - }, + "start":0,"end":100,"loc":{"start":{"line":1,"column":0},"end":{"line":6,"column":1}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 100, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 6, - "column": 1 - } - }, + "start":0,"end":100,"loc":{"start":{"line":1,"column":0},"end":{"line":6,"column":1}}, "id": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "C" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"C"}, "name": "C" }, "superClass": null, "body": { "type": "ClassBody", - "start": 8, - "end": 100, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 6, - "column": 1 - } - }, + "start":8,"end":100,"loc":{"start":{"line":1,"column":8},"end":{"line":6,"column":1}}, "body": [ { "type": "TSDeclareMethod", - "start": 14, - "end": 25, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 15 - } - }, + "start":14,"end":25,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":15}}, "static": true, "key": { "type": "Identifier", - "start": 21, - "end": 22, - "loc": { - "start": { - "line": 2, - "column": 11 - }, - "end": { - "line": 2, - "column": 12 - }, - "identifierName": "f" - }, + "start":21,"end":22,"loc":{"start":{"line":2,"column":11},"end":{"line":2,"column":12},"identifierName":"f"}, "name": "f" }, "computed": false, @@ -117,35 +38,12 @@ }, { "type": "TSDeclareMethod", - "start": 30, - "end": 48, - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 22 - } - }, + "start":30,"end":48,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":22}}, "accessibility": "public", "static": true, "key": { "type": "Identifier", - "start": 44, - "end": 45, - "loc": { - "start": { - "line": 3, - "column": 18 - }, - "end": { - "line": 3, - "column": 19 - }, - "identifierName": "f" - }, + "start":44,"end":45,"loc":{"start":{"line":3,"column":18},"end":{"line":3,"column":19},"identifierName":"f"}, "name": "f" }, "computed": false, @@ -157,35 +55,12 @@ }, { "type": "TSDeclareMethod", - "start": 53, - "end": 74, - "loc": { - "start": { - "line": 4, - "column": 4 - }, - "end": { - "line": 4, - "column": 25 - } - }, + "start":53,"end":74,"loc":{"start":{"line":4,"column":4},"end":{"line":4,"column":25}}, "accessibility": "protected", "static": true, "key": { "type": "Identifier", - "start": 70, - "end": 71, - "loc": { - "start": { - "line": 4, - "column": 21 - }, - "end": { - "line": 4, - "column": 22 - }, - "identifierName": "f" - }, + "start":70,"end":71,"loc":{"start":{"line":4,"column":21},"end":{"line":4,"column":22},"identifierName":"f"}, "name": "f" }, "computed": false, @@ -197,35 +72,12 @@ }, { "type": "TSDeclareMethod", - "start": 79, - "end": 98, - "loc": { - "start": { - "line": 5, - "column": 4 - }, - "end": { - "line": 5, - "column": 23 - } - }, + "start":79,"end":98,"loc":{"start":{"line":5,"column":4},"end":{"line":5,"column":23}}, "accessibility": "private", "static": true, "key": { "type": "Identifier", - "start": 94, - "end": 95, - "loc": { - "start": { - "line": 5, - "column": 19 - }, - "end": { - "line": 5, - "column": 20 - }, - "identifierName": "f" - }, + "start":94,"end":95,"loc":{"start":{"line":5,"column":19},"end":{"line":5,"column":20},"identifierName":"f"}, "name": "f" }, "computed": false, diff --git a/packages/babel-parser/test/fixtures/typescript/const/no-initializer/output.json b/packages/babel-parser/test/fixtures/typescript/const/no-initializer/output.json index 9562e7979622..abaabd96cdbe 100644 --- a/packages/babel-parser/test/fixtures/typescript/const/no-initializer/output.json +++ b/packages/babel-parser/test/fixtures/typescript/const/no-initializer/output.json @@ -1,107 +1,29 @@ { "type": "File", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "program": { "type": "Program", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "declarations": [ { "type": "VariableDeclarator", - "start": 6, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":6,"end":15,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":15}}, "id": { "type": "Identifier", - "start": 6, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 15 - }, - "identifierName": "x" - }, + "start":6,"end":15,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":15},"identifierName":"x"}, "name": "x", "typeAnnotation": { "type": "TSTypeAnnotation", - "start": 7, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":7,"end":15,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":15}}, "typeAnnotation": { "type": "TSNumberKeyword", - "start": 9, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 15 - } - } + "start":9,"end":15,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":15}} } } }, diff --git a/packages/babel-parser/test/fixtures/typescript/const/reserved-word/options.json b/packages/babel-parser/test/fixtures/typescript/const/reserved-word/options.json index 93db7641c75b..2a28555f76db 100644 --- a/packages/babel-parser/test/fixtures/typescript/const/reserved-word/options.json +++ b/packages/babel-parser/test/fixtures/typescript/const/reserved-word/options.json @@ -1,3 +1,3 @@ { "throws": "Unexpected token (1:9)" -} \ No newline at end of file +} diff --git a/packages/babel-parser/test/fixtures/typescript/declare/const-new-line/output.json b/packages/babel-parser/test/fixtures/typescript/declare/const-new-line/output.json index 4d58e741f456..76b565c7bbcd 100644 --- a/packages/babel-parser/test/fixtures/typescript/declare/const-new-line/output.json +++ b/packages/babel-parser/test/fixtures/typescript/declare/const-new-line/output.json @@ -1,139 +1,38 @@ { "type": "File", - "start": 0, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 27 - } - }, + "start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":27}}, "program": { "type": "Program", - "start": 0, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 27 - } - }, + "start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":27}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "expression": { "type": "Identifier", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "declare" - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7},"identifierName":"declare"}, "name": "declare" } }, { "type": "VariableDeclaration", - "start": 8, - "end": 35, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 27 - } - }, + "start":8,"end":35,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":27}}, "declarations": [ { "type": "VariableDeclarator", - "start": 14, - "end": 23, - "loc": { - "start": { - "line": 2, - "column": 6 - }, - "end": { - "line": 2, - "column": 15 - } - }, + "start":14,"end":23,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":15}}, "id": { "type": "Identifier", - "start": 14, - "end": 23, - "loc": { - "start": { - "line": 2, - "column": 6 - }, - "end": { - "line": 2, - "column": 15 - }, - "identifierName": "x" - }, + "start":14,"end":23,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":15},"identifierName":"x"}, "name": "x", "typeAnnotation": { "type": "TSTypeAnnotation", - "start": 15, - "end": 23, - "loc": { - "start": { - "line": 2, - "column": 7 - }, - "end": { - "line": 2, - "column": 15 - } - }, + "start":15,"end":23,"loc":{"start":{"line":2,"column":7},"end":{"line":2,"column":15}}, "typeAnnotation": { "type": "TSNumberKeyword", - "start": 17, - "end": 23, - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 15 - } - } + "start":17,"end":23,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":15}} } } }, @@ -141,62 +40,17 @@ }, { "type": "VariableDeclarator", - "start": 25, - "end": 34, - "loc": { - "start": { - "line": 2, - "column": 17 - }, - "end": { - "line": 2, - "column": 26 - } - }, + "start":25,"end":34,"loc":{"start":{"line":2,"column":17},"end":{"line":2,"column":26}}, "id": { "type": "Identifier", - "start": 25, - "end": 34, - "loc": { - "start": { - "line": 2, - "column": 17 - }, - "end": { - "line": 2, - "column": 26 - }, - "identifierName": "y" - }, + "start":25,"end":34,"loc":{"start":{"line":2,"column":17},"end":{"line":2,"column":26},"identifierName":"y"}, "name": "y", "typeAnnotation": { "type": "TSTypeAnnotation", - "start": 26, - "end": 34, - "loc": { - "start": { - "line": 2, - "column": 18 - }, - "end": { - "line": 2, - "column": 26 - } - }, + "start":26,"end":34,"loc":{"start":{"line":2,"column":18},"end":{"line":2,"column":26}}, "typeAnnotation": { "type": "TSStringKeyword", - "start": 28, - "end": 34, - "loc": { - "start": { - "line": 2, - "column": 20 - }, - "end": { - "line": 2, - "column": 26 - } - } + "start":28,"end":34,"loc":{"start":{"line":2,"column":20},"end":{"line":2,"column":26}} } } }, diff --git a/packages/babel-parser/test/fixtures/typescript/declare/const/output.json b/packages/babel-parser/test/fixtures/typescript/declare/const/output.json index 234d16b48b3e..c91008a9597b 100644 --- a/packages/babel-parser/test/fixtures/typescript/declare/const/output.json +++ b/packages/babel-parser/test/fixtures/typescript/declare/const/output.json @@ -1,107 +1,29 @@ { "type": "File", - "start": 0, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":35}}, "program": { "type": "Program", - "start": 0, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":35}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":35}}, "declarations": [ { "type": "VariableDeclarator", - "start": 14, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":14,"end":23,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":23}}, "id": { "type": "Identifier", - "start": 14, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 23 - }, - "identifierName": "x" - }, + "start":14,"end":23,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":23},"identifierName":"x"}, "name": "x", "typeAnnotation": { "type": "TSTypeAnnotation", - "start": 15, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":15,"end":23,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":23}}, "typeAnnotation": { "type": "TSNumberKeyword", - "start": 17, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 23 - } - } + "start":17,"end":23,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":23}} } } }, @@ -109,62 +31,17 @@ }, { "type": "VariableDeclarator", - "start": 25, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":25,"end":34,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":34}}, "id": { "type": "Identifier", - "start": 25, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 34 - }, - "identifierName": "y" - }, + "start":25,"end":34,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":34},"identifierName":"y"}, "name": "y", "typeAnnotation": { "type": "TSTypeAnnotation", - "start": 26, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":26,"end":34,"loc":{"start":{"line":1,"column":26},"end":{"line":1,"column":34}}, "typeAnnotation": { "type": "TSStringKeyword", - "start": 28, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 34 - } - } + "start":28,"end":34,"loc":{"start":{"line":1,"column":28},"end":{"line":1,"column":34}} } } }, diff --git a/packages/babel-parser/test/fixtures/typescript/declare/destructure-new-line/output.json b/packages/babel-parser/test/fixtures/typescript/declare/destructure-new-line/output.json index a4ed43a77f94..ad47170376c5 100644 --- a/packages/babel-parser/test/fixtures/typescript/declare/destructure-new-line/output.json +++ b/packages/babel-parser/test/fixtures/typescript/declare/destructure-new-line/output.json @@ -1,159 +1,46 @@ { "type": "File", - "start": 0, - "end": 49, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 41 - } - }, + "start":0,"end":49,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":41}}, "program": { "type": "Program", - "start": 0, - "end": 49, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 41 - } - }, + "start":0,"end":49,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":41}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "expression": { "type": "Identifier", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "declare" - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7},"identifierName":"declare"}, "name": "declare" } }, { "type": "VariableDeclaration", - "start": 8, - "end": 49, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 41 - } - }, + "start":8,"end":49,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":41}}, "declarations": [ { "type": "VariableDeclarator", - "start": 14, - "end": 48, - "loc": { - "start": { - "line": 2, - "column": 6 - }, - "end": { - "line": 2, - "column": 40 - } - }, + "start":14,"end":48,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":40}}, "id": { "type": "ObjectPattern", - "start": 14, - "end": 48, - "loc": { - "start": { - "line": 2, - "column": 6 - }, - "end": { - "line": 2, - "column": 40 - } - }, + "start":14,"end":48,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":40}}, "properties": [ { "type": "ObjectProperty", - "start": 16, - "end": 17, - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 9 - } - }, + "start":16,"end":17,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":9}}, "method": false, "key": { "type": "Identifier", - "start": 16, - "end": 17, - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 9 - }, - "identifierName": "x" - }, + "start":16,"end":17,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":9},"identifierName":"x"}, "name": "x" }, "computed": false, "shorthand": true, "value": { "type": "Identifier", - "start": 16, - "end": 17, - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 9 - }, - "identifierName": "x" - }, + "start":16,"end":17,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":9},"identifierName":"x"}, "name": "x" }, "extra": { @@ -162,53 +49,18 @@ }, { "type": "ObjectProperty", - "start": 19, - "end": 20, - "loc": { - "start": { - "line": 2, - "column": 11 - }, - "end": { - "line": 2, - "column": 12 - } - }, + "start":19,"end":20,"loc":{"start":{"line":2,"column":11},"end":{"line":2,"column":12}}, "method": false, "key": { "type": "Identifier", - "start": 19, - "end": 20, - "loc": { - "start": { - "line": 2, - "column": 11 - }, - "end": { - "line": 2, - "column": 12 - }, - "identifierName": "y" - }, + "start":19,"end":20,"loc":{"start":{"line":2,"column":11},"end":{"line":2,"column":12},"identifierName":"y"}, "name": "y" }, "computed": false, "shorthand": true, "value": { "type": "Identifier", - "start": 19, - "end": 20, - "loc": { - "start": { - "line": 2, - "column": 11 - }, - "end": { - "line": 2, - "column": 12 - }, - "identifierName": "y" - }, + "start":19,"end":20,"loc":{"start":{"line":2,"column":11},"end":{"line":2,"column":12},"identifierName":"y"}, "name": "y" }, "extra": { @@ -218,156 +70,44 @@ ], "typeAnnotation": { "type": "TSTypeAnnotation", - "start": 22, - "end": 48, - "loc": { - "start": { - "line": 2, - "column": 14 - }, - "end": { - "line": 2, - "column": 40 - } - }, + "start":22,"end":48,"loc":{"start":{"line":2,"column":14},"end":{"line":2,"column":40}}, "typeAnnotation": { "type": "TSTypeLiteral", - "start": 24, - "end": 48, - "loc": { - "start": { - "line": 2, - "column": 16 - }, - "end": { - "line": 2, - "column": 40 - } - }, + "start":24,"end":48,"loc":{"start":{"line":2,"column":16},"end":{"line":2,"column":40}}, "members": [ { "type": "TSPropertySignature", - "start": 26, - "end": 36, - "loc": { - "start": { - "line": 2, - "column": 18 - }, - "end": { - "line": 2, - "column": 28 - } - }, + "start":26,"end":36,"loc":{"start":{"line":2,"column":18},"end":{"line":2,"column":28}}, "key": { "type": "Identifier", - "start": 26, - "end": 27, - "loc": { - "start": { - "line": 2, - "column": 18 - }, - "end": { - "line": 2, - "column": 19 - }, - "identifierName": "x" - }, + "start":26,"end":27,"loc":{"start":{"line":2,"column":18},"end":{"line":2,"column":19},"identifierName":"x"}, "name": "x" }, "computed": false, "typeAnnotation": { "type": "TSTypeAnnotation", - "start": 27, - "end": 35, - "loc": { - "start": { - "line": 2, - "column": 19 - }, - "end": { - "line": 2, - "column": 27 - } - }, + "start":27,"end":35,"loc":{"start":{"line":2,"column":19},"end":{"line":2,"column":27}}, "typeAnnotation": { "type": "TSNumberKeyword", - "start": 29, - "end": 35, - "loc": { - "start": { - "line": 2, - "column": 21 - }, - "end": { - "line": 2, - "column": 27 - } - } + "start":29,"end":35,"loc":{"start":{"line":2,"column":21},"end":{"line":2,"column":27}} } } }, { "type": "TSPropertySignature", - "start": 37, - "end": 46, - "loc": { - "start": { - "line": 2, - "column": 29 - }, - "end": { - "line": 2, - "column": 38 - } - }, + "start":37,"end":46,"loc":{"start":{"line":2,"column":29},"end":{"line":2,"column":38}}, "key": { "type": "Identifier", - "start": 37, - "end": 38, - "loc": { - "start": { - "line": 2, - "column": 29 - }, - "end": { - "line": 2, - "column": 30 - }, - "identifierName": "y" - }, + "start":37,"end":38,"loc":{"start":{"line":2,"column":29},"end":{"line":2,"column":30},"identifierName":"y"}, "name": "y" }, "computed": false, "typeAnnotation": { "type": "TSTypeAnnotation", - "start": 38, - "end": 46, - "loc": { - "start": { - "line": 2, - "column": 30 - }, - "end": { - "line": 2, - "column": 38 - } - }, + "start":38,"end":46,"loc":{"start":{"line":2,"column":30},"end":{"line":2,"column":38}}, "typeAnnotation": { "type": "TSNumberKeyword", - "start": 40, - "end": 46, - "loc": { - "start": { - "line": 2, - "column": 32 - }, - "end": { - "line": 2, - "column": 38 - } - } + "start":40,"end":46,"loc":{"start":{"line":2,"column":32},"end":{"line":2,"column":38}} } } } diff --git a/packages/babel-parser/test/fixtures/typescript/declare/destructure/output.json b/packages/babel-parser/test/fixtures/typescript/declare/destructure/output.json index 211767c304a1..32c2b66597b4 100644 --- a/packages/babel-parser/test/fixtures/typescript/declare/destructure/output.json +++ b/packages/babel-parser/test/fixtures/typescript/declare/destructure/output.json @@ -1,127 +1,37 @@ { "type": "File", - "start": 0, - "end": 49, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 49 - } - }, + "start":0,"end":49,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":49}}, "program": { "type": "Program", - "start": 0, - "end": 49, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 49 - } - }, + "start":0,"end":49,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":49}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 49, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 49 - } - }, + "start":0,"end":49,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":49}}, "declarations": [ { "type": "VariableDeclarator", - "start": 14, - "end": 48, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 48 - } - }, + "start":14,"end":48,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":48}}, "id": { "type": "ObjectPattern", - "start": 14, - "end": 48, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 48 - } - }, + "start":14,"end":48,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":48}}, "properties": [ { "type": "ObjectProperty", - "start": 16, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":16,"end":17,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":17}}, "method": false, "key": { "type": "Identifier", - "start": 16, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - }, - "identifierName": "x" - }, + "start":16,"end":17,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":17},"identifierName":"x"}, "name": "x" }, "computed": false, "shorthand": true, "value": { "type": "Identifier", - "start": 16, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - }, - "identifierName": "x" - }, + "start":16,"end":17,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":17},"identifierName":"x"}, "name": "x" }, "extra": { @@ -130,53 +40,18 @@ }, { "type": "ObjectProperty", - "start": 19, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":19,"end":20,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":20}}, "method": false, "key": { "type": "Identifier", - "start": 19, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 20 - }, - "identifierName": "y" - }, + "start":19,"end":20,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":20},"identifierName":"y"}, "name": "y" }, "computed": false, "shorthand": true, "value": { "type": "Identifier", - "start": 19, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 20 - }, - "identifierName": "y" - }, + "start":19,"end":20,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":20},"identifierName":"y"}, "name": "y" }, "extra": { @@ -186,156 +61,44 @@ ], "typeAnnotation": { "type": "TSTypeAnnotation", - "start": 22, - "end": 48, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 48 - } - }, + "start":22,"end":48,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":48}}, "typeAnnotation": { "type": "TSTypeLiteral", - "start": 24, - "end": 48, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 48 - } - }, + "start":24,"end":48,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":48}}, "members": [ { "type": "TSPropertySignature", - "start": 26, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":26,"end":36,"loc":{"start":{"line":1,"column":26},"end":{"line":1,"column":36}}, "key": { "type": "Identifier", - "start": 26, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 27 - }, - "identifierName": "x" - }, + "start":26,"end":27,"loc":{"start":{"line":1,"column":26},"end":{"line":1,"column":27},"identifierName":"x"}, "name": "x" }, "computed": false, "typeAnnotation": { "type": "TSTypeAnnotation", - "start": 27, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":27,"end":35,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":35}}, "typeAnnotation": { "type": "TSNumberKeyword", - "start": 29, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 1, - "column": 35 - } - } + "start":29,"end":35,"loc":{"start":{"line":1,"column":29},"end":{"line":1,"column":35}} } } }, { "type": "TSPropertySignature", - "start": 37, - "end": 46, - "loc": { - "start": { - "line": 1, - "column": 37 - }, - "end": { - "line": 1, - "column": 46 - } - }, + "start":37,"end":46,"loc":{"start":{"line":1,"column":37},"end":{"line":1,"column":46}}, "key": { "type": "Identifier", - "start": 37, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 37 - }, - "end": { - "line": 1, - "column": 38 - }, - "identifierName": "y" - }, + "start":37,"end":38,"loc":{"start":{"line":1,"column":37},"end":{"line":1,"column":38},"identifierName":"y"}, "name": "y" }, "computed": false, "typeAnnotation": { "type": "TSTypeAnnotation", - "start": 38, - "end": 46, - "loc": { - "start": { - "line": 1, - "column": 38 - }, - "end": { - "line": 1, - "column": 46 - } - }, + "start":38,"end":46,"loc":{"start":{"line":1,"column":38},"end":{"line":1,"column":46}}, "typeAnnotation": { "type": "TSNumberKeyword", - "start": 40, - "end": 46, - "loc": { - "start": { - "line": 1, - "column": 40 - }, - "end": { - "line": 1, - "column": 46 - } - } + "start":40,"end":46,"loc":{"start":{"line":1,"column":40},"end":{"line":1,"column":46}} } } } diff --git a/packages/babel-parser/test/fixtures/typescript/declare/interface-new-line/output.json b/packages/babel-parser/test/fixtures/typescript/declare/interface-new-line/output.json index 249423eab47e..5dfedc4e3ee8 100644 --- a/packages/babel-parser/test/fixtures/typescript/declare/interface-new-line/output.json +++ b/packages/babel-parser/test/fixtures/typescript/declare/interface-new-line/output.json @@ -1,111 +1,32 @@ { "type": "File", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 14 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":14}}, "program": { "type": "Program", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 14 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":14}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "expression": { "type": "Identifier", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "declare" - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7},"identifierName":"declare"}, "name": "declare" } }, { "type": "TSInterfaceDeclaration", - "start": 8, - "end": 22, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 14 - } - }, + "start":8,"end":22,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":14}}, "id": { "type": "Identifier", - "start": 18, - "end": 19, - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 11 - }, - "identifierName": "I" - }, + "start":18,"end":19,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":11},"identifierName":"I"}, "name": "I" }, "body": { "type": "TSInterfaceBody", - "start": 20, - "end": 22, - "loc": { - "start": { - "line": 2, - "column": 12 - }, - "end": { - "line": 2, - "column": 14 - } - }, + "start":20,"end":22,"loc":{"start":{"line":2,"column":12},"end":{"line":2,"column":14}}, "body": [] } } diff --git a/packages/babel-parser/test/fixtures/typescript/declare/interface/output.json b/packages/babel-parser/test/fixtures/typescript/declare/interface/output.json index 43242a7a2d90..421694881ab1 100644 --- a/packages/babel-parser/test/fixtures/typescript/declare/interface/output.json +++ b/packages/babel-parser/test/fixtures/typescript/declare/interface/output.json @@ -1,79 +1,23 @@ { "type": "File", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "program": { "type": "Program", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "TSInterfaceDeclaration", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "id": { "type": "Identifier", - "start": 18, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - }, - "identifierName": "I" - }, + "start":18,"end":19,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":19},"identifierName":"I"}, "name": "I" }, "body": { "type": "TSInterfaceBody", - "start": 20, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":20,"end":22,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":22}}, "body": [] }, "declare": true diff --git a/packages/babel-parser/test/fixtures/typescript/declare/let-new-line/output.json b/packages/babel-parser/test/fixtures/typescript/declare/let-new-line/output.json index 2b7786be2c95..a5b611f659cd 100644 --- a/packages/babel-parser/test/fixtures/typescript/declare/let-new-line/output.json +++ b/packages/babel-parser/test/fixtures/typescript/declare/let-new-line/output.json @@ -1,110 +1,31 @@ { "type": "File", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 6 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":6}}, "program": { "type": "Program", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 6 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":6}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "expression": { "type": "Identifier", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "declare" - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7},"identifierName":"declare"}, "name": "declare" } }, { "type": "VariableDeclaration", - "start": 8, - "end": 14, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 6 - } - }, + "start":8,"end":14,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":6}}, "declarations": [ { "type": "VariableDeclarator", - "start": 12, - "end": 13, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 5 - } - }, + "start":12,"end":13,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":5}}, "id": { "type": "Identifier", - "start": 12, - "end": 13, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 5 - }, - "identifierName": "x" - }, + "start":12,"end":13,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":5},"identifierName":"x"}, "name": "x" }, "init": null diff --git a/packages/babel-parser/test/fixtures/typescript/declare/let/output.json b/packages/babel-parser/test/fixtures/typescript/declare/let/output.json index 1091cd74344d..8fe433755c9f 100644 --- a/packages/babel-parser/test/fixtures/typescript/declare/let/output.json +++ b/packages/babel-parser/test/fixtures/typescript/declare/let/output.json @@ -1,78 +1,22 @@ { "type": "File", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "program": { "type": "Program", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "declarations": [ { "type": "VariableDeclarator", - "start": 12, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":12,"end":13,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":13}}, "id": { "type": "Identifier", - "start": 12, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - }, - "identifierName": "x" - }, + "start":12,"end":13,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":13},"identifierName":"x"}, "name": "x" }, "init": null diff --git a/packages/babel-parser/test/fixtures/typescript/declare/var-new-line/output.json b/packages/babel-parser/test/fixtures/typescript/declare/var-new-line/output.json index 63eaea000fef..89a3f765cb0a 100644 --- a/packages/babel-parser/test/fixtures/typescript/declare/var-new-line/output.json +++ b/packages/babel-parser/test/fixtures/typescript/declare/var-new-line/output.json @@ -1,110 +1,31 @@ { "type": "File", - "start": 0, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 11 - } - }, + "start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":11}}, "program": { "type": "Program", - "start": 0, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 11 - } - }, + "start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":11}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "expression": { "type": "Identifier", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "declare" - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7},"identifierName":"declare"}, "name": "declare" } }, { "type": "VariableDeclaration", - "start": 8, - "end": 14, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 6 - } - }, + "start":8,"end":14,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":6}}, "declarations": [ { "type": "VariableDeclarator", - "start": 12, - "end": 13, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 5 - } - }, + "start":12,"end":13,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":5}}, "id": { "type": "Identifier", - "start": 12, - "end": 13, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 5 - }, - "identifierName": "x" - }, + "start":12,"end":13,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":5},"identifierName":"x"}, "name": "x" }, "init": null @@ -114,109 +35,30 @@ }, { "type": "ExpressionStatement", - "start": 16, - "end": 23, - "loc": { - "start": { - "line": 4, - "column": 0 - }, - "end": { - "line": 4, - "column": 7 - } - }, + "start":16,"end":23,"loc":{"start":{"line":4,"column":0},"end":{"line":4,"column":7}}, "expression": { "type": "Identifier", - "start": 16, - "end": 23, - "loc": { - "start": { - "line": 4, - "column": 0 - }, - "end": { - "line": 4, - "column": 7 - }, - "identifierName": "declare" - }, + "start":16,"end":23,"loc":{"start":{"line":4,"column":0},"end":{"line":4,"column":7},"identifierName":"declare"}, "name": "declare" } }, { "type": "VariableDeclaration", - "start": 24, - "end": 35, - "loc": { - "start": { - "line": 5, - "column": 0 - }, - "end": { - "line": 5, - "column": 11 - } - }, + "start":24,"end":35,"loc":{"start":{"line":5,"column":0},"end":{"line":5,"column":11}}, "declarations": [ { "type": "VariableDeclarator", - "start": 28, - "end": 34, - "loc": { - "start": { - "line": 5, - "column": 4 - }, - "end": { - "line": 5, - "column": 10 - } - }, + "start":28,"end":34,"loc":{"start":{"line":5,"column":4},"end":{"line":5,"column":10}}, "id": { "type": "Identifier", - "start": 28, - "end": 34, - "loc": { - "start": { - "line": 5, - "column": 4 - }, - "end": { - "line": 5, - "column": 10 - }, - "identifierName": "x" - }, + "start":28,"end":34,"loc":{"start":{"line":5,"column":4},"end":{"line":5,"column":10},"identifierName":"x"}, "name": "x", "typeAnnotation": { "type": "TSTypeAnnotation", - "start": 29, - "end": 34, - "loc": { - "start": { - "line": 5, - "column": 5 - }, - "end": { - "line": 5, - "column": 10 - } - }, + "start":29,"end":34,"loc":{"start":{"line":5,"column":5},"end":{"line":5,"column":10}}, "typeAnnotation": { "type": "TSAnyKeyword", - "start": 31, - "end": 34, - "loc": { - "start": { - "line": 5, - "column": 7 - }, - "end": { - "line": 5, - "column": 10 - } - } + "start":31,"end":34,"loc":{"start":{"line":5,"column":7},"end":{"line":5,"column":10}} } } }, diff --git a/packages/babel-parser/test/fixtures/typescript/declare/var/output.json b/packages/babel-parser/test/fixtures/typescript/declare/var/output.json index e8db08d8f766..4a0415750ef9 100644 --- a/packages/babel-parser/test/fixtures/typescript/declare/var/output.json +++ b/packages/babel-parser/test/fixtures/typescript/declare/var/output.json @@ -1,78 +1,22 @@ { "type": "File", - "start": 0, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 19 - } - }, + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":19}}, "program": { "type": "Program", - "start": 0, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 19 - } - }, + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":19}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "declarations": [ { "type": "VariableDeclarator", - "start": 12, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":12,"end":13,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":13}}, "id": { "type": "Identifier", - "start": 12, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - }, - "identifierName": "x" - }, + "start":12,"end":13,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":13},"identifierName":"x"}, "name": "x" }, "init": null @@ -83,77 +27,21 @@ }, { "type": "VariableDeclaration", - "start": 15, - "end": 34, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 19 - } - }, + "start":15,"end":34,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":19}}, "declarations": [ { "type": "VariableDeclarator", - "start": 27, - "end": 33, - "loc": { - "start": { - "line": 2, - "column": 12 - }, - "end": { - "line": 2, - "column": 18 - } - }, + "start":27,"end":33,"loc":{"start":{"line":2,"column":12},"end":{"line":2,"column":18}}, "id": { "type": "Identifier", - "start": 27, - "end": 33, - "loc": { - "start": { - "line": 2, - "column": 12 - }, - "end": { - "line": 2, - "column": 18 - }, - "identifierName": "x" - }, + "start":27,"end":33,"loc":{"start":{"line":2,"column":12},"end":{"line":2,"column":18},"identifierName":"x"}, "name": "x", "typeAnnotation": { "type": "TSTypeAnnotation", - "start": 28, - "end": 33, - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 18 - } - }, + "start":28,"end":33,"loc":{"start":{"line":2,"column":13},"end":{"line":2,"column":18}}, "typeAnnotation": { "type": "TSAnyKeyword", - "start": 30, - "end": 33, - "loc": { - "start": { - "line": 2, - "column": 15 - }, - "end": { - "line": 2, - "column": 18 - } - } + "start":30,"end":33,"loc":{"start":{"line":2,"column":15},"end":{"line":2,"column":18}} } } }, diff --git a/packages/babel-parser/test/fixtures/typescript/decorators/type-arguments/output.json b/packages/babel-parser/test/fixtures/typescript/decorators/type-arguments/output.json index 91add31ed156..f546aad36972 100644 --- a/packages/babel-parser/test/fixtures/typescript/decorators/type-arguments/output.json +++ b/packages/babel-parser/test/fixtures/typescript/decorators/type-arguments/output.json @@ -1,124 +1,35 @@ { "type": "File", - "start": 0, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 13 - } - }, + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":13}}, "program": { "type": "Program", - "start": 0, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 13 - } - }, + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":13}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 13 - } - }, + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":13}}, "decorators": [ { "type": "Decorator", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, "expression": { "type": "CallExpression", - "start": 1, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":1,"end":20,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":20}}, "callee": { "type": "Identifier", - "start": 1, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 10 - }, - "identifierName": "decorator" - }, + "start":1,"end":10,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":10},"identifierName":"decorator"}, "name": "decorator" }, "arguments": [], "typeParameters": { "type": "TSTypeParameterInstantiation", - "start": 10, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":10,"end":18,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":18}}, "params": [ { "type": "TSStringKeyword", - "start": 11, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 17 - } - } + "start":11,"end":17,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":17}} } ] } @@ -127,36 +38,13 @@ ], "id": { "type": "Identifier", - "start": 27, - "end": 31, - "loc": { - "start": { - "line": 2, - "column": 6 - }, - "end": { - "line": 2, - "column": 10 - }, - "identifierName": "Test" - }, + "start":27,"end":31,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":10},"identifierName":"Test"}, "name": "Test" }, "superClass": null, "body": { "type": "ClassBody", - "start": 32, - "end": 34, - "loc": { - "start": { - "line": 2, - "column": 11 - }, - "end": { - "line": 2, - "column": 13 - } - }, + "start":32,"end":34,"loc":{"start":{"line":2,"column":11},"end":{"line":2,"column":13}}, "body": [] } } diff --git a/packages/babel-parser/test/fixtures/typescript/enum/const/output.json b/packages/babel-parser/test/fixtures/typescript/enum/const/output.json index 78500087ba53..ba0a6fb31cfe 100644 --- a/packages/babel-parser/test/fixtures/typescript/enum/const/output.json +++ b/packages/babel-parser/test/fixtures/typescript/enum/const/output.json @@ -1,64 +1,19 @@ { "type": "File", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "program": { "type": "Program", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "TSEnumDeclaration", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "const": true, "id": { "type": "Identifier", - "start": 11, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "E" - }, + "start":11,"end":12,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":12},"identifierName":"E"}, "name": "E" }, "members": [] diff --git a/packages/babel-parser/test/fixtures/typescript/enum/declare-const/output.json b/packages/babel-parser/test/fixtures/typescript/enum/declare-const/output.json index 1218597f4b94..795afe3cba3e 100644 --- a/packages/babel-parser/test/fixtures/typescript/enum/declare-const/output.json +++ b/packages/babel-parser/test/fixtures/typescript/enum/declare-const/output.json @@ -1,64 +1,19 @@ { "type": "File", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "program": { "type": "Program", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "TSEnumDeclaration", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "const": true, "id": { "type": "Identifier", - "start": 19, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 20 - }, - "identifierName": "E" - }, + "start":19,"end":20,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":20},"identifierName":"E"}, "name": "E" }, "members": [], diff --git a/packages/babel-parser/test/fixtures/typescript/enum/declare/output.json b/packages/babel-parser/test/fixtures/typescript/enum/declare/output.json index a4bb0b3edc7c..f3af45c42a77 100644 --- a/packages/babel-parser/test/fixtures/typescript/enum/declare/output.json +++ b/packages/babel-parser/test/fixtures/typescript/enum/declare/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "program": { "type": "Program", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "TSEnumDeclaration", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "id": { "type": "Identifier", - "start": 13, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - }, - "identifierName": "E" - }, + "start":13,"end":14,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":14},"identifierName":"E"}, "name": "E" }, "members": [], diff --git a/packages/babel-parser/test/fixtures/typescript/enum/export-const/output.json b/packages/babel-parser/test/fixtures/typescript/enum/export-const/output.json index f897f84f6293..f9ee00cb00c4 100644 --- a/packages/babel-parser/test/fixtures/typescript/enum/export-const/output.json +++ b/packages/babel-parser/test/fixtures/typescript/enum/export-const/output.json @@ -1,80 +1,25 @@ { "type": "File", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "program": { "type": "Program", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExportNamedDeclaration", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, + "exportKind": "value", "specifiers": [], "source": null, "declaration": { "type": "TSEnumDeclaration", - "start": 7, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":7,"end":22,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":22}}, "const": true, "id": { "type": "Identifier", - "start": 18, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - }, - "identifierName": "E" - }, + "start":18,"end":19,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":19},"identifierName":"E"}, "name": "E" }, "members": [] diff --git a/packages/babel-parser/test/fixtures/typescript/enum/export-declare-const/output.json b/packages/babel-parser/test/fixtures/typescript/enum/export-declare-const/output.json index d0a529fa2711..cf57b3872576 100644 --- a/packages/babel-parser/test/fixtures/typescript/enum/export-declare-const/output.json +++ b/packages/babel-parser/test/fixtures/typescript/enum/export-declare-const/output.json @@ -1,80 +1,25 @@ { "type": "File", - "start": 0, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, "program": { "type": "Program", - "start": 0, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExportNamedDeclaration", - "start": 0, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, + "exportKind": "type", "specifiers": [], "source": null, "declaration": { "type": "TSEnumDeclaration", - "start": 7, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":7,"end":30,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":30}}, "const": true, "id": { "type": "Identifier", - "start": 26, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 27 - }, - "identifierName": "E" - }, + "start":26,"end":27,"loc":{"start":{"line":1,"column":26},"end":{"line":1,"column":27},"identifierName":"E"}, "name": "E" }, "members": [], diff --git a/packages/babel-parser/test/fixtures/typescript/enum/export/output.json b/packages/babel-parser/test/fixtures/typescript/enum/export/output.json index d78f0c7187e1..222becba7a6a 100644 --- a/packages/babel-parser/test/fixtures/typescript/enum/export/output.json +++ b/packages/babel-parser/test/fixtures/typescript/enum/export/output.json @@ -1,79 +1,24 @@ { "type": "File", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "program": { "type": "Program", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExportNamedDeclaration", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, + "exportKind": "value", "specifiers": [], "source": null, "declaration": { "type": "TSEnumDeclaration", - "start": 7, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":7,"end":16,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":16}}, "id": { "type": "Identifier", - "start": 12, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - }, - "identifierName": "E" - }, + "start":12,"end":13,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":13},"identifierName":"E"}, "name": "E" }, "members": [] diff --git a/packages/babel-parser/test/fixtures/typescript/enum/members-reserved-words/output.json b/packages/babel-parser/test/fixtures/typescript/enum/members-reserved-words/output.json index 4852ee8f373f..013c08b407eb 100644 --- a/packages/babel-parser/test/fixtures/typescript/enum/members-reserved-words/output.json +++ b/packages/babel-parser/test/fixtures/typescript/enum/members-reserved-words/output.json @@ -1,127 +1,36 @@ { "type": "File", - "start": 0, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "TSEnumDeclaration", - "start": 0, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, "id": { "type": "Identifier", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "E" - }, + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"E"}, "name": "E" }, "members": [ { "type": "TSEnumMember", - "start": 13, - "end": 18, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 9 - } - }, + "start":13,"end":18,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":9}}, "id": { "type": "Identifier", - "start": 13, - "end": 18, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 9 - }, - "identifierName": "const" - }, + "start":13,"end":18,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":9},"identifierName":"const"}, "name": "const" } }, { "type": "TSEnumMember", - "start": 24, - "end": 31, - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 11 - } - }, + "start":24,"end":31,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":11}}, "id": { "type": "Identifier", - "start": 24, - "end": 31, - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 11 - }, - "identifierName": "default" - }, + "start":24,"end":31,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":11},"identifierName":"default"}, "name": "default" } } diff --git a/packages/babel-parser/test/fixtures/typescript/enum/members-strings/output.json b/packages/babel-parser/test/fixtures/typescript/enum/members-strings/output.json index bdf96d51700e..9a9bfcb6239d 100644 --- a/packages/babel-parser/test/fixtures/typescript/enum/members-strings/output.json +++ b/packages/babel-parser/test/fixtures/typescript/enum/members-strings/output.json @@ -1,94 +1,27 @@ { "type": "File", - "start": 0, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "TSEnumDeclaration", - "start": 0, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, "id": { "type": "Identifier", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "E" - }, + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"E"}, "name": "E" }, "members": [ { "type": "TSEnumMember", - "start": 13, - "end": 18, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 9 - } - }, + "start":13,"end":18,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":9}}, "id": { "type": "StringLiteral", - "start": 13, - "end": 18, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 9 - } - }, + "start":13,"end":18,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":9}}, "extra": { "rawValue": "foo", "raw": "\"foo\"" @@ -98,32 +31,10 @@ }, { "type": "TSEnumMember", - "start": 24, - "end": 33, - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 13 - } - }, + "start":24,"end":33,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":13}}, "id": { "type": "StringLiteral", - "start": 24, - "end": 29, - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 9 - } - }, + "start":24,"end":29,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":9}}, "extra": { "rawValue": "bar", "raw": "\"bar\"" @@ -132,18 +43,7 @@ }, "initializer": { "type": "NumericLiteral", - "start": 32, - "end": 33, - "loc": { - "start": { - "line": 3, - "column": 12 - }, - "end": { - "line": 3, - "column": 13 - } - }, + "start":32,"end":33,"loc":{"start":{"line":3,"column":12},"end":{"line":3,"column":13}}, "extra": { "rawValue": 1, "raw": "1" diff --git a/packages/babel-parser/test/fixtures/typescript/enum/members-trailing-comma-with-initializer/output.json b/packages/babel-parser/test/fixtures/typescript/enum/members-trailing-comma-with-initializer/output.json index edde64d01369..fc12e3e8f9f6 100644 --- a/packages/babel-parser/test/fixtures/typescript/enum/members-trailing-comma-with-initializer/output.json +++ b/packages/babel-parser/test/fixtures/typescript/enum/members-trailing-comma-with-initializer/output.json @@ -1,111 +1,32 @@ { "type": "File", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "TSEnumDeclaration", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "id": { "type": "Identifier", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "E" - }, + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"E"}, "name": "E" }, "members": [ { "type": "TSEnumMember", - "start": 13, - "end": 18, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 9 - } - }, + "start":13,"end":18,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":9}}, "id": { "type": "Identifier", - "start": 13, - "end": 14, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 5 - }, - "identifierName": "A" - }, + "start":13,"end":14,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":5},"identifierName":"A"}, "name": "A" }, "initializer": { "type": "NumericLiteral", - "start": 17, - "end": 18, - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 9 - } - }, + "start":17,"end":18,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":9}}, "extra": { "rawValue": 0, "raw": "0" diff --git a/packages/babel-parser/test/fixtures/typescript/enum/members-trailing-comma/output.json b/packages/babel-parser/test/fixtures/typescript/enum/members-trailing-comma/output.json index 946d73d08ba8..b61f1c0a0774 100644 --- a/packages/babel-parser/test/fixtures/typescript/enum/members-trailing-comma/output.json +++ b/packages/babel-parser/test/fixtures/typescript/enum/members-trailing-comma/output.json @@ -1,95 +1,27 @@ { "type": "File", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "TSEnumDeclaration", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "id": { "type": "Identifier", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "E" - }, + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"E"}, "name": "E" }, "members": [ { "type": "TSEnumMember", - "start": 13, - "end": 14, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 5 - } - }, + "start":13,"end":14,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":5}}, "id": { "type": "Identifier", - "start": 13, - "end": 14, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 5 - }, - "identifierName": "A" - }, + "start":13,"end":14,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":5},"identifierName":"A"}, "name": "A" } } diff --git a/packages/babel-parser/test/fixtures/typescript/enum/members/output.json b/packages/babel-parser/test/fixtures/typescript/enum/members/output.json index a3e00ac10bdc..7ff47b34b674 100644 --- a/packages/babel-parser/test/fixtures/typescript/enum/members/output.json +++ b/packages/babel-parser/test/fixtures/typescript/enum/members/output.json @@ -1,143 +1,41 @@ { "type": "File", - "start": 0, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "TSEnumDeclaration", - "start": 0, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, "id": { "type": "Identifier", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "E" - }, + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"E"}, "name": "E" }, "members": [ { "type": "TSEnumMember", - "start": 13, - "end": 14, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 5 - } - }, + "start":13,"end":14,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":5}}, "id": { "type": "Identifier", - "start": 13, - "end": 14, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 5 - }, - "identifierName": "A" - }, + "start":13,"end":14,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":5},"identifierName":"A"}, "name": "A" } }, { "type": "TSEnumMember", - "start": 20, - "end": 25, - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 9 - } - }, + "start":20,"end":25,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":9}}, "id": { "type": "Identifier", - "start": 20, - "end": 21, - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 5 - }, - "identifierName": "B" - }, + "start":20,"end":21,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":5},"identifierName":"B"}, "name": "B" }, "initializer": { "type": "NumericLiteral", - "start": 24, - "end": 25, - "loc": { - "start": { - "line": 3, - "column": 8 - }, - "end": { - "line": 3, - "column": 9 - } - }, + "start":24,"end":25,"loc":{"start":{"line":3,"column":8},"end":{"line":3,"column":9}}, "extra": { "rawValue": 0, "raw": "0" diff --git a/packages/babel-parser/test/fixtures/typescript/estree-compat/shorthand-ambient-module/output.json b/packages/babel-parser/test/fixtures/typescript/estree-compat/shorthand-ambient-module/output.json index 7f7db6c4b6e5..543538f7a1db 100644 --- a/packages/babel-parser/test/fixtures/typescript/estree-compat/shorthand-ambient-module/output.json +++ b/packages/babel-parser/test/fixtures/typescript/estree-compat/shorthand-ambient-module/output.json @@ -1,62 +1,18 @@ { "type": "File", - "start": 0, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, "program": { "type": "Program", - "start": 0, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "TSModuleDeclaration", - "start": 0, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, "id": { "type": "Literal", - "start": 15, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":15,"end":31,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":31}}, "value": "hot-new-module", "raw": "\"hot-new-module\"" }, diff --git a/packages/babel-parser/test/fixtures/typescript/expect-plugin/export-interface/input.js b/packages/babel-parser/test/fixtures/typescript/expect-plugin/export-interface/input.js new file mode 100644 index 000000000000..39df3b83f7e9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/expect-plugin/export-interface/input.js @@ -0,0 +1 @@ +export interface Foo {} diff --git a/packages/babel-parser/test/fixtures/typescript/expect-plugin/export-interface/options.json b/packages/babel-parser/test/fixtures/typescript/expect-plugin/export-interface/options.json new file mode 100644 index 000000000000..6638a1d3d788 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/expect-plugin/export-interface/options.json @@ -0,0 +1,4 @@ +{ + "sourceType": "module", + "throws": "This experimental syntax requires enabling one of the following parser plugin(s): 'flow, typescript' (1:7)" +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/expect-plugin/export-type-named/input.js b/packages/babel-parser/test/fixtures/typescript/expect-plugin/export-type-named/input.js new file mode 100644 index 000000000000..2bece0a4af63 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/expect-plugin/export-type-named/input.js @@ -0,0 +1,2 @@ +var Foo; +export type { Foo }; diff --git a/packages/babel-parser/test/fixtures/typescript/expect-plugin/export-type-named/options.json b/packages/babel-parser/test/fixtures/typescript/expect-plugin/export-type-named/options.json new file mode 100644 index 000000000000..afcf32448a2c --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/expect-plugin/export-type-named/options.json @@ -0,0 +1,4 @@ +{ + "sourceType": "module", + "throws": "This experimental syntax requires enabling one of the following parser plugin(s): 'flow, typescript' (2:7)" +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/expect-plugin/export-type/input.js b/packages/babel-parser/test/fixtures/typescript/expect-plugin/export-type/input.js new file mode 100644 index 000000000000..191a99ee3073 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/expect-plugin/export-type/input.js @@ -0,0 +1 @@ +export type Foo = number; diff --git a/packages/babel-parser/test/fixtures/typescript/expect-plugin/export-type/options.json b/packages/babel-parser/test/fixtures/typescript/expect-plugin/export-type/options.json new file mode 100644 index 000000000000..6638a1d3d788 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/expect-plugin/export-type/options.json @@ -0,0 +1,4 @@ +{ + "sourceType": "module", + "throws": "This experimental syntax requires enabling one of the following parser plugin(s): 'flow, typescript' (1:7)" +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/expect-plugin/options.json b/packages/babel-parser/test/fixtures/typescript/expect-plugin/options.json new file mode 100644 index 000000000000..2104ca43283f --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/expect-plugin/options.json @@ -0,0 +1,3 @@ +{ + "sourceType": "module" +} diff --git a/packages/babel-parser/test/fixtures/typescript/export/as-namespace/output.json b/packages/babel-parser/test/fixtures/typescript/export/as-namespace/output.json index 5b77e5a9e2b1..c4249303c1d8 100644 --- a/packages/babel-parser/test/fixtures/typescript/export/as-namespace/output.json +++ b/packages/babel-parser/test/fixtures/typescript/export/as-namespace/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "program": { "type": "Program", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "TSNamespaceExportDeclaration", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "id": { "type": "Identifier", - "start": 20, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 21 - }, - "identifierName": "A" - }, + "start":20,"end":21,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":21},"identifierName":"A"}, "name": "A" } } diff --git a/packages/babel-parser/test/fixtures/typescript/export/declare/output.json b/packages/babel-parser/test/fixtures/typescript/export/declare/output.json index bd75590c3bd1..bba4bdacb985 100644 --- a/packages/babel-parser/test/fixtures/typescript/export/declare/output.json +++ b/packages/babel-parser/test/fixtures/typescript/export/declare/output.json @@ -1,123 +1,35 @@ { "type": "File", - "start": 0, - "end": 238, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 8, - "column": 26 - } - }, + "start":0,"end":238,"loc":{"start":{"line":1,"column":0},"end":{"line":8,"column":26}}, "program": { "type": "Program", - "start": 0, - "end": 238, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 8, - "column": 26 - } - }, + "start":0,"end":238,"loc":{"start":{"line":1,"column":0},"end":{"line":8,"column":26}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExportNamedDeclaration", - "start": 0, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, + "exportKind": "type", "specifiers": [], "source": null, "declaration": { "type": "VariableDeclaration", - "start": 7, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":7,"end":31,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":31}}, "declarations": [ { "type": "VariableDeclarator", - "start": 21, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":21,"end":30,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":30}}, "id": { "type": "Identifier", - "start": 21, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 30 - }, - "identifierName": "x" - }, + "start":21,"end":30,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":30},"identifierName":"x"}, "name": "x", "typeAnnotation": { "type": "TSTypeAnnotation", - "start": 22, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":22,"end":30,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":30}}, "typeAnnotation": { "type": "TSNumberKeyword", - "start": 24, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 30 - } - } + "start":24,"end":30,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":30}} } } }, @@ -130,49 +42,16 @@ }, { "type": "ExportNamedDeclaration", - "start": 32, - "end": 66, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 34 - } - }, + "start":32,"end":66,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":34}}, + "exportKind": "type", "specifiers": [], "source": null, "declaration": { "type": "TSDeclareFunction", - "start": 39, - "end": 66, - "loc": { - "start": { - "line": 2, - "column": 7 - }, - "end": { - "line": 2, - "column": 34 - } - }, + "start":39,"end":66,"loc":{"start":{"line":2,"column":7},"end":{"line":2,"column":34}}, "id": { "type": "Identifier", - "start": 56, - "end": 57, - "loc": { - "start": { - "line": 2, - "column": 24 - }, - "end": { - "line": 2, - "column": 25 - }, - "identifierName": "f" - }, + "start":56,"end":57,"loc":{"start":{"line":2,"column":24},"end":{"line":2,"column":25},"identifierName":"f"}, "name": "f" }, "generator": false, @@ -180,32 +59,10 @@ "params": [], "returnType": { "type": "TSTypeAnnotation", - "start": 59, - "end": 65, - "loc": { - "start": { - "line": 2, - "column": 27 - }, - "end": { - "line": 2, - "column": 33 - } - }, + "start":59,"end":65,"loc":{"start":{"line":2,"column":27},"end":{"line":2,"column":33}}, "typeAnnotation": { "type": "TSVoidKeyword", - "start": 61, - "end": 65, - "loc": { - "start": { - "line": 2, - "column": 29 - }, - "end": { - "line": 2, - "column": 33 - } - } + "start":61,"end":65,"loc":{"start":{"line":2,"column":29},"end":{"line":2,"column":33}} } }, "declare": true @@ -213,66 +70,22 @@ }, { "type": "ExportNamedDeclaration", - "start": 67, - "end": 92, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 25 - } - }, + "start":67,"end":92,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":25}}, + "exportKind": "type", "specifiers": [], "source": null, "declaration": { "type": "ClassDeclaration", - "start": 74, - "end": 92, - "loc": { - "start": { - "line": 3, - "column": 7 - }, - "end": { - "line": 3, - "column": 25 - } - }, + "start":74,"end":92,"loc":{"start":{"line":3,"column":7},"end":{"line":3,"column":25}}, "id": { "type": "Identifier", - "start": 88, - "end": 89, - "loc": { - "start": { - "line": 3, - "column": 21 - }, - "end": { - "line": 3, - "column": 22 - }, - "identifierName": "C" - }, + "start":88,"end":89,"loc":{"start":{"line":3,"column":21},"end":{"line":3,"column":22},"identifierName":"C"}, "name": "C" }, "superClass": null, "body": { "type": "ClassBody", - "start": 90, - "end": 92, - "loc": { - "start": { - "line": 3, - "column": 23 - }, - "end": { - "line": 3, - "column": 25 - } - }, + "start":90,"end":92,"loc":{"start":{"line":3,"column":23},"end":{"line":3,"column":25}}, "body": [] }, "declare": true @@ -280,65 +93,21 @@ }, { "type": "ExportNamedDeclaration", - "start": 93, - "end": 122, - "loc": { - "start": { - "line": 4, - "column": 0 - }, - "end": { - "line": 4, - "column": 29 - } - }, + "start":93,"end":122,"loc":{"start":{"line":4,"column":0},"end":{"line":4,"column":29}}, + "exportKind": "type", "specifiers": [], "source": null, "declaration": { "type": "TSInterfaceDeclaration", - "start": 100, - "end": 122, - "loc": { - "start": { - "line": 4, - "column": 7 - }, - "end": { - "line": 4, - "column": 29 - } - }, + "start":100,"end":122,"loc":{"start":{"line":4,"column":7},"end":{"line":4,"column":29}}, "id": { "type": "Identifier", - "start": 118, - "end": 119, - "loc": { - "start": { - "line": 4, - "column": 25 - }, - "end": { - "line": 4, - "column": 26 - }, - "identifierName": "I" - }, + "start":118,"end":119,"loc":{"start":{"line":4,"column":25},"end":{"line":4,"column":26},"identifierName":"I"}, "name": "I" }, "body": { "type": "TSInterfaceBody", - "start": 120, - "end": 122, - "loc": { - "start": { - "line": 4, - "column": 27 - }, - "end": { - "line": 4, - "column": 29 - } - }, + "start":120,"end":122,"loc":{"start":{"line":4,"column":27},"end":{"line":4,"column":29}}, "body": [] }, "declare": true @@ -346,130 +115,42 @@ }, { "type": "ExportNamedDeclaration", - "start": 123, - "end": 154, - "loc": { - "start": { - "line": 5, - "column": 0 - }, - "end": { - "line": 5, - "column": 31 - } - }, + "start":123,"end":154,"loc":{"start":{"line":5,"column":0},"end":{"line":5,"column":31}}, + "exportKind": "type", "specifiers": [], "source": null, "declaration": { "type": "TSTypeAliasDeclaration", - "start": 130, - "end": 154, - "loc": { - "start": { - "line": 5, - "column": 7 - }, - "end": { - "line": 5, - "column": 31 - } - }, + "start":130,"end":154,"loc":{"start":{"line":5,"column":7},"end":{"line":5,"column":31}}, "id": { "type": "Identifier", - "start": 143, - "end": 144, - "loc": { - "start": { - "line": 5, - "column": 20 - }, - "end": { - "line": 5, - "column": 21 - }, - "identifierName": "T" - }, + "start":143,"end":144,"loc":{"start":{"line":5,"column":20},"end":{"line":5,"column":21},"identifierName":"T"}, "name": "T" }, "typeAnnotation": { "type": "TSNumberKeyword", - "start": 147, - "end": 153, - "loc": { - "start": { - "line": 5, - "column": 24 - }, - "end": { - "line": 5, - "column": 30 - } - } + "start":147,"end":153,"loc":{"start":{"line":5,"column":24},"end":{"line":5,"column":30}} }, "declare": true } }, { "type": "ExportNamedDeclaration", - "start": 155, - "end": 181, - "loc": { - "start": { - "line": 6, - "column": 0 - }, - "end": { - "line": 6, - "column": 26 - } - }, + "start":155,"end":181,"loc":{"start":{"line":6,"column":0},"end":{"line":6,"column":26}}, + "exportKind": "type", "specifiers": [], "source": null, "declaration": { "type": "TSModuleDeclaration", - "start": 162, - "end": 181, - "loc": { - "start": { - "line": 6, - "column": 7 - }, - "end": { - "line": 6, - "column": 26 - } - }, + "start":162,"end":181,"loc":{"start":{"line":6,"column":7},"end":{"line":6,"column":26}}, "id": { "type": "Identifier", - "start": 177, - "end": 178, - "loc": { - "start": { - "line": 6, - "column": 22 - }, - "end": { - "line": 6, - "column": 23 - }, - "identifierName": "M" - }, + "start":177,"end":178,"loc":{"start":{"line":6,"column":22},"end":{"line":6,"column":23},"identifierName":"M"}, "name": "M" }, "body": { "type": "TSModuleBlock", - "start": 179, - "end": 181, - "loc": { - "start": { - "line": 6, - "column": 24 - }, - "end": { - "line": 6, - "column": 26 - } - }, + "start":179,"end":181,"loc":{"start":{"line":6,"column":24},"end":{"line":6,"column":26}}, "body": [] }, "declare": true @@ -477,65 +158,21 @@ }, { "type": "ExportNamedDeclaration", - "start": 182, - "end": 211, - "loc": { - "start": { - "line": 7, - "column": 0 - }, - "end": { - "line": 7, - "column": 29 - } - }, + "start":182,"end":211,"loc":{"start":{"line":7,"column":0},"end":{"line":7,"column":29}}, + "exportKind": "type", "specifiers": [], "source": null, "declaration": { "type": "TSModuleDeclaration", - "start": 189, - "end": 211, - "loc": { - "start": { - "line": 7, - "column": 7 - }, - "end": { - "line": 7, - "column": 29 - } - }, + "start":189,"end":211,"loc":{"start":{"line":7,"column":7},"end":{"line":7,"column":29}}, "id": { "type": "Identifier", - "start": 207, - "end": 208, - "loc": { - "start": { - "line": 7, - "column": 25 - }, - "end": { - "line": 7, - "column": 26 - }, - "identifierName": "N" - }, + "start":207,"end":208,"loc":{"start":{"line":7,"column":25},"end":{"line":7,"column":26},"identifierName":"N"}, "name": "N" }, "body": { "type": "TSModuleBlock", - "start": 209, - "end": 211, - "loc": { - "start": { - "line": 7, - "column": 27 - }, - "end": { - "line": 7, - "column": 29 - } - }, + "start":209,"end":211,"loc":{"start":{"line":7,"column":27},"end":{"line":7,"column":29}}, "body": [] }, "declare": true @@ -543,49 +180,16 @@ }, { "type": "ExportNamedDeclaration", - "start": 212, - "end": 238, - "loc": { - "start": { - "line": 8, - "column": 0 - }, - "end": { - "line": 8, - "column": 26 - } - }, + "start":212,"end":238,"loc":{"start":{"line":8,"column":0},"end":{"line":8,"column":26}}, + "exportKind": "type", "specifiers": [], "source": null, "declaration": { "type": "TSEnumDeclaration", - "start": 219, - "end": 238, - "loc": { - "start": { - "line": 8, - "column": 7 - }, - "end": { - "line": 8, - "column": 26 - } - }, + "start":219,"end":238,"loc":{"start":{"line":8,"column":7},"end":{"line":8,"column":26}}, "id": { "type": "Identifier", - "start": 232, - "end": 235, - "loc": { - "start": { - "line": 8, - "column": 20 - }, - "end": { - "line": 8, - "column": 23 - }, - "identifierName": "foo" - }, + "start":232,"end":235,"loc":{"start":{"line":8,"column":20},"end":{"line":8,"column":23},"identifierName":"foo"}, "name": "foo" }, "members": [], diff --git a/packages/babel-parser/test/fixtures/typescript/export/equals/output.json b/packages/babel-parser/test/fixtures/typescript/export/equals/output.json index 8d7021f0cabe..653d3c688896 100644 --- a/packages/babel-parser/test/fixtures/typescript/export/equals/output.json +++ b/packages/babel-parser/test/fixtures/typescript/export/equals/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "program": { "type": "Program", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "TSExportAssignment", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "expression": { "type": "Identifier", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - }, - "identifierName": "f" - }, + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"f"}, "name": "f" } } diff --git a/packages/babel-parser/test/fixtures/typescript/export/export-type-declaration/input.ts b/packages/babel-parser/test/fixtures/typescript/export/export-type-declaration/input.ts new file mode 100644 index 000000000000..b8f23bbe7dd4 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/export/export-type-declaration/input.ts @@ -0,0 +1,4 @@ +export type A = 2; +export interface B {} +export declare function a(): string; +export declare var b: string; diff --git a/packages/babel-parser/test/fixtures/typescript/export/export-type-declaration/output.json b/packages/babel-parser/test/fixtures/typescript/export/export-type-declaration/output.json new file mode 100644 index 000000000000..47da0131e957 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/export/export-type-declaration/output.json @@ -0,0 +1,124 @@ +{ + "type": "File", + "start":0,"end":107,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":29}}, + "program": { + "type": "Program", + "start":0,"end":107,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":29}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExportNamedDeclaration", + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, + "exportKind": "type", + "specifiers": [], + "source": null, + "declaration": { + "type": "TSTypeAliasDeclaration", + "start":7,"end":18,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":18}}, + "id": { + "type": "Identifier", + "start":12,"end":13,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":13},"identifierName":"A"}, + "name": "A" + }, + "typeAnnotation": { + "type": "TSLiteralType", + "start":16,"end":17,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":17}}, + "literal": { + "type": "NumericLiteral", + "start":16,"end":17,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":17}}, + "extra": { + "rawValue": 2, + "raw": "2" + }, + "value": 2 + } + } + } + }, + { + "type": "ExportNamedDeclaration", + "start":19,"end":40,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":21}}, + "exportKind": "type", + "specifiers": [], + "source": null, + "declaration": { + "type": "TSInterfaceDeclaration", + "start":26,"end":40,"loc":{"start":{"line":2,"column":7},"end":{"line":2,"column":21}}, + "id": { + "type": "Identifier", + "start":36,"end":37,"loc":{"start":{"line":2,"column":17},"end":{"line":2,"column":18},"identifierName":"B"}, + "name": "B" + }, + "body": { + "type": "TSInterfaceBody", + "start":38,"end":40,"loc":{"start":{"line":2,"column":19},"end":{"line":2,"column":21}}, + "body": [] + } + } + }, + { + "type": "ExportNamedDeclaration", + "start":41,"end":77,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":36}}, + "exportKind": "type", + "specifiers": [], + "source": null, + "declaration": { + "type": "TSDeclareFunction", + "start":48,"end":77,"loc":{"start":{"line":3,"column":7},"end":{"line":3,"column":36}}, + "id": { + "type": "Identifier", + "start":65,"end":66,"loc":{"start":{"line":3,"column":24},"end":{"line":3,"column":25},"identifierName":"a"}, + "name": "a" + }, + "generator": false, + "async": false, + "params": [], + "returnType": { + "type": "TSTypeAnnotation", + "start":68,"end":76,"loc":{"start":{"line":3,"column":27},"end":{"line":3,"column":35}}, + "typeAnnotation": { + "type": "TSStringKeyword", + "start":70,"end":76,"loc":{"start":{"line":3,"column":29},"end":{"line":3,"column":35}} + } + }, + "declare": true + } + }, + { + "type": "ExportNamedDeclaration", + "start":78,"end":107,"loc":{"start":{"line":4,"column":0},"end":{"line":4,"column":29}}, + "exportKind": "type", + "specifiers": [], + "source": null, + "declaration": { + "type": "VariableDeclaration", + "start":85,"end":107,"loc":{"start":{"line":4,"column":7},"end":{"line":4,"column":29}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":97,"end":106,"loc":{"start":{"line":4,"column":19},"end":{"line":4,"column":28}}, + "id": { + "type": "Identifier", + "start":97,"end":106,"loc":{"start":{"line":4,"column":19},"end":{"line":4,"column":28},"identifierName":"b"}, + "name": "b", + "typeAnnotation": { + "type": "TSTypeAnnotation", + "start":98,"end":106,"loc":{"start":{"line":4,"column":20},"end":{"line":4,"column":28}}, + "typeAnnotation": { + "type": "TSStringKeyword", + "start":100,"end":106,"loc":{"start":{"line":4,"column":22},"end":{"line":4,"column":28}} + } + } + }, + "init": null + } + ], + "kind": "var", + "declare": true + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/export/export-type-from/input.ts b/packages/babel-parser/test/fixtures/typescript/export/export-type-from/input.ts new file mode 100644 index 000000000000..a33a1717515e --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/export/export-type-from/input.ts @@ -0,0 +1 @@ +export type { T } from './mod'; diff --git a/packages/babel-parser/test/fixtures/typescript/export/export-type-from/output.json b/packages/babel-parser/test/fixtures/typescript/export/export-type-from/output.json new file mode 100644 index 000000000000..e8399c38636e --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/export/export-type-from/output.json @@ -0,0 +1,44 @@ +{ + "type": "File", + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, + "program": { + "type": "Program", + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExportNamedDeclaration", + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, + "exportKind": "type", + "specifiers": [ + { + "type": "ExportSpecifier", + "start":14,"end":15,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":15}}, + "local": { + "type": "Identifier", + "start":14,"end":15,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":15},"identifierName":"T"}, + "name": "T" + }, + "exported": { + "type": "Identifier", + "start":14,"end":15,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":15},"identifierName":"T"}, + "name": "T" + } + } + ], + "source": { + "type": "StringLiteral", + "start":23,"end":30,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":30}}, + "extra": { + "rawValue": "./mod", + "raw": "'./mod'" + }, + "value": "./mod" + }, + "declaration": null + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/export/export-type/input.ts b/packages/babel-parser/test/fixtures/typescript/export/export-type/input.ts new file mode 100644 index 000000000000..ec228e9bc1da --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/export/export-type/input.ts @@ -0,0 +1,2 @@ +type A = 2; +export type { A }; diff --git a/packages/babel-parser/test/fixtures/typescript/export/export-type/output.json b/packages/babel-parser/test/fixtures/typescript/export/export-type/output.json new file mode 100644 index 000000000000..5c1d6a9647b6 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/export/export-type/output.json @@ -0,0 +1,58 @@ +{ + "type": "File", + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":18}}, + "program": { + "type": "Program", + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":18}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "TSTypeAliasDeclaration", + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "id": { + "type": "Identifier", + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"A"}, + "name": "A" + }, + "typeAnnotation": { + "type": "TSLiteralType", + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10}}, + "literal": { + "type": "NumericLiteral", + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10}}, + "extra": { + "rawValue": 2, + "raw": "2" + }, + "value": 2 + } + } + }, + { + "type": "ExportNamedDeclaration", + "start":12,"end":30,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":18}}, + "exportKind": "type", + "specifiers": [ + { + "type": "ExportSpecifier", + "start":26,"end":27,"loc":{"start":{"line":2,"column":14},"end":{"line":2,"column":15}}, + "local": { + "type": "Identifier", + "start":26,"end":27,"loc":{"start":{"line":2,"column":14},"end":{"line":2,"column":15},"identifierName":"A"}, + "name": "A" + }, + "exported": { + "type": "Identifier", + "start":26,"end":27,"loc":{"start":{"line":2,"column":14},"end":{"line":2,"column":15},"identifierName":"A"}, + "name": "A" + } + } + ], + "source": null, + "declaration": null + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/export/export-value-declaration/input.ts b/packages/babel-parser/test/fixtures/typescript/export/export-value-declaration/input.ts new file mode 100644 index 000000000000..a6aa9c5f6372 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/export/export-value-declaration/input.ts @@ -0,0 +1,6 @@ +export var a; +export function b() {} +export class C {} + +export enum D {} +export namespace E {} diff --git a/packages/babel-parser/test/fixtures/typescript/export/export-value-declaration/output.json b/packages/babel-parser/test/fixtures/typescript/export/export-value-declaration/output.json new file mode 100644 index 000000000000..ef037867a267 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/export/export-value-declaration/output.json @@ -0,0 +1,122 @@ +{ + "type": "File", + "start":0,"end":94,"loc":{"start":{"line":1,"column":0},"end":{"line":6,"column":21}}, + "program": { + "type": "Program", + "start":0,"end":94,"loc":{"start":{"line":1,"column":0},"end":{"line":6,"column":21}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExportNamedDeclaration", + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "exportKind": "value", + "specifiers": [], + "source": null, + "declaration": { + "type": "VariableDeclaration", + "start":7,"end":13,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":13}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":11,"end":12,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":12}}, + "id": { + "type": "Identifier", + "start":11,"end":12,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":12},"identifierName":"a"}, + "name": "a" + }, + "init": null + } + ], + "kind": "var" + } + }, + { + "type": "ExportNamedDeclaration", + "start":14,"end":36,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":22}}, + "exportKind": "value", + "specifiers": [], + "source": null, + "declaration": { + "type": "FunctionDeclaration", + "start":21,"end":36,"loc":{"start":{"line":2,"column":7},"end":{"line":2,"column":22}}, + "id": { + "type": "Identifier", + "start":30,"end":31,"loc":{"start":{"line":2,"column":16},"end":{"line":2,"column":17},"identifierName":"b"}, + "name": "b" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":34,"end":36,"loc":{"start":{"line":2,"column":20},"end":{"line":2,"column":22}}, + "body": [], + "directives": [] + } + } + }, + { + "type": "ExportNamedDeclaration", + "start":37,"end":54,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":17}}, + "exportKind": "value", + "specifiers": [], + "source": null, + "declaration": { + "type": "ClassDeclaration", + "start":44,"end":54,"loc":{"start":{"line":3,"column":7},"end":{"line":3,"column":17}}, + "id": { + "type": "Identifier", + "start":50,"end":51,"loc":{"start":{"line":3,"column":13},"end":{"line":3,"column":14},"identifierName":"C"}, + "name": "C" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":52,"end":54,"loc":{"start":{"line":3,"column":15},"end":{"line":3,"column":17}}, + "body": [] + } + } + }, + { + "type": "ExportNamedDeclaration", + "start":56,"end":72,"loc":{"start":{"line":5,"column":0},"end":{"line":5,"column":16}}, + "exportKind": "value", + "specifiers": [], + "source": null, + "declaration": { + "type": "TSEnumDeclaration", + "start":63,"end":72,"loc":{"start":{"line":5,"column":7},"end":{"line":5,"column":16}}, + "id": { + "type": "Identifier", + "start":68,"end":69,"loc":{"start":{"line":5,"column":12},"end":{"line":5,"column":13},"identifierName":"D"}, + "name": "D" + }, + "members": [] + } + }, + { + "type": "ExportNamedDeclaration", + "start":73,"end":94,"loc":{"start":{"line":6,"column":0},"end":{"line":6,"column":21}}, + "exportKind": "value", + "specifiers": [], + "source": null, + "declaration": { + "type": "TSModuleDeclaration", + "start":80,"end":94,"loc":{"start":{"line":6,"column":7},"end":{"line":6,"column":21}}, + "id": { + "type": "Identifier", + "start":90,"end":91,"loc":{"start":{"line":6,"column":17},"end":{"line":6,"column":18},"identifierName":"E"}, + "name": "E" + }, + "body": { + "type": "TSModuleBlock", + "start":92,"end":94,"loc":{"start":{"line":6,"column":19},"end":{"line":6,"column":21}}, + "body": [] + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/export/nested-same-name/output.json b/packages/babel-parser/test/fixtures/typescript/export/nested-same-name/output.json index df135e3005c0..663a8812ecaf 100644 --- a/packages/babel-parser/test/fixtures/typescript/export/nested-same-name/output.json +++ b/packages/babel-parser/test/fixtures/typescript/export/nested-same-name/output.json @@ -1,110 +1,33 @@ { "type": "File", - "start": 0, - "end": 66, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":0,"end":66,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 66, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":0,"end":66,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExportNamedDeclaration", - "start": 0, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, + "exportKind": "value", "specifiers": [], "source": null, "declaration": { "type": "VariableDeclaration", - "start": 7, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":7,"end":19,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":19}}, "declarations": [ { "type": "VariableDeclarator", - "start": 13, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":13,"end":18,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":18}}, "id": { "type": "Identifier", - "start": 13, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - }, - "identifierName": "x" - }, + "start":13,"end":14,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":14},"identifierName":"x"}, "name": "x" }, "init": { "type": "NumericLiteral", - "start": 17, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":17,"end":18,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":18}}, "extra": { "rawValue": 0, "raw": "0" @@ -118,142 +41,43 @@ }, { "type": "ExportNamedDeclaration", - "start": 20, - "end": 66, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":20,"end":66,"loc":{"start":{"line":2,"column":0},"end":{"line":4,"column":1}}, + "exportKind": "value", "specifiers": [], "source": null, "declaration": { "type": "TSModuleDeclaration", - "start": 27, - "end": 66, - "loc": { - "start": { - "line": 2, - "column": 7 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":27,"end":66,"loc":{"start":{"line":2,"column":7},"end":{"line":4,"column":1}}, "id": { "type": "Identifier", - "start": 37, - "end": 38, - "loc": { - "start": { - "line": 2, - "column": 17 - }, - "end": { - "line": 2, - "column": 18 - }, - "identifierName": "N" - }, + "start":37,"end":38,"loc":{"start":{"line":2,"column":17},"end":{"line":2,"column":18},"identifierName":"N"}, "name": "N" }, "body": { "type": "TSModuleBlock", - "start": 39, - "end": 66, - "loc": { - "start": { - "line": 2, - "column": 19 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":39,"end":66,"loc":{"start":{"line":2,"column":19},"end":{"line":4,"column":1}}, "body": [ { "type": "ExportNamedDeclaration", - "start": 45, - "end": 64, - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 23 - } - }, + "start":45,"end":64,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":23}}, + "exportKind": "value", "specifiers": [], "source": null, "declaration": { "type": "VariableDeclaration", - "start": 52, - "end": 64, - "loc": { - "start": { - "line": 3, - "column": 11 - }, - "end": { - "line": 3, - "column": 23 - } - }, + "start":52,"end":64,"loc":{"start":{"line":3,"column":11},"end":{"line":3,"column":23}}, "declarations": [ { "type": "VariableDeclarator", - "start": 58, - "end": 63, - "loc": { - "start": { - "line": 3, - "column": 17 - }, - "end": { - "line": 3, - "column": 22 - } - }, + "start":58,"end":63,"loc":{"start":{"line":3,"column":17},"end":{"line":3,"column":22}}, "id": { "type": "Identifier", - "start": 58, - "end": 59, - "loc": { - "start": { - "line": 3, - "column": 17 - }, - "end": { - "line": 3, - "column": 18 - }, - "identifierName": "x" - }, + "start":58,"end":59,"loc":{"start":{"line":3,"column":17},"end":{"line":3,"column":18},"identifierName":"x"}, "name": "x" }, "init": { "type": "NumericLiteral", - "start": 62, - "end": 63, - "loc": { - "start": { - "line": 3, - "column": 21 - }, - "end": { - "line": 3, - "column": 22 - } - }, + "start":62,"end":63,"loc":{"start":{"line":3,"column":21},"end":{"line":3,"column":22}}, "extra": { "rawValue": 1, "raw": "1" diff --git a/packages/babel-parser/test/fixtures/typescript/function/annotated/output.json b/packages/babel-parser/test/fixtures/typescript/function/annotated/output.json index 20dcd3d6d8da..6db63dafc279 100644 --- a/packages/babel-parser/test/fixtures/typescript/function/annotated/output.json +++ b/packages/babel-parser/test/fixtures/typescript/function/annotated/output.json @@ -1,96 +1,29 @@ { "type": "File", - "start": 0, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, "program": { "type": "Program", - "start": 0, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, "id": { "type": "Identifier", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - }, - "identifierName": "f" - }, + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"f"}, "name": "f" }, "generator": false, "async": false, "typeParameters": { "type": "TSTypeParameterDeclaration", - "start": 10, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":10,"end":13,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":13}}, "params": [ { "type": "TSTypeParameter", - "start": 11, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":11,"end":12,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":12}}, "name": "T" } ] @@ -98,64 +31,18 @@ "params": [ { "type": "Identifier", - "start": 14, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 19 - }, - "identifierName": "x" - }, + "start":14,"end":19,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":19},"identifierName":"x"}, "name": "x", "optional": true, "typeAnnotation": { "type": "TSTypeAnnotation", - "start": 16, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":16,"end":19,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":19}}, "typeAnnotation": { "type": "TSTypeReference", - "start": 18, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":18,"end":19,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":19}}, "typeName": { "type": "Identifier", - "start": 18, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - }, - "identifierName": "T" - }, + "start":18,"end":19,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":19},"identifierName":"T"}, "name": "T" } } @@ -164,65 +51,20 @@ ], "returnType": { "type": "TSTypeAnnotation", - "start": 20, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":20,"end":23,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":23}}, "typeAnnotation": { "type": "TSTypeReference", - "start": 22, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":22,"end":23,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":23}}, "typeName": { "type": "Identifier", - "start": 22, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 23 - }, - "identifierName": "T" - }, + "start":22,"end":23,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":23},"identifierName":"T"}, "name": "T" } } }, "body": { "type": "BlockStatement", - "start": 24, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":24,"end":26,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":26}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/typescript/function/anonymous-generator/input.ts b/packages/babel-parser/test/fixtures/typescript/function/anonymous-generator/input.ts new file mode 100644 index 000000000000..33ce49c1f4a6 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/function/anonymous-generator/input.ts @@ -0,0 +1,3 @@ +const fn = function* (input: T): Generator { + yield 2; +} diff --git a/packages/babel-parser/test/fixtures/typescript/function/anonymous-generator/output.json b/packages/babel-parser/test/fixtures/typescript/function/anonymous-generator/output.json new file mode 100644 index 000000000000..b48b432ce19a --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/function/anonymous-generator/output.json @@ -0,0 +1,115 @@ +{ + "type": "File", + "start":0,"end":68,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "program": { + "type": "Program", + "start":0,"end":68,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start":0,"end":68,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":6,"end":68,"loc":{"start":{"line":1,"column":6},"end":{"line":3,"column":1}}, + "id": { + "type": "Identifier", + "start":6,"end":8,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":8},"identifierName":"fn"}, + "name": "fn" + }, + "init": { + "type": "FunctionExpression", + "start":11,"end":68,"loc":{"start":{"line":1,"column":11},"end":{"line":3,"column":1}}, + "id": null, + "generator": true, + "async": false, + "typeParameters": { + "type": "TSTypeParameterDeclaration", + "start":21,"end":24,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":24}}, + "params": [ + { + "type": "TSTypeParameter", + "start":22,"end":23,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":23}}, + "name": "T" + } + ] + }, + "params": [ + { + "type": "Identifier", + "start":25,"end":33,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":33},"identifierName":"input"}, + "name": "input", + "typeAnnotation": { + "type": "TSTypeAnnotation", + "start":30,"end":33,"loc":{"start":{"line":1,"column":30},"end":{"line":1,"column":33}}, + "typeAnnotation": { + "type": "TSTypeReference", + "start":32,"end":33,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":33}}, + "typeName": { + "type": "Identifier", + "start":32,"end":33,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":33},"identifierName":"T"}, + "name": "T" + } + } + } + } + ], + "returnType": { + "type": "TSTypeAnnotation", + "start":34,"end":53,"loc":{"start":{"line":1,"column":34},"end":{"line":1,"column":53}}, + "typeAnnotation": { + "type": "TSTypeReference", + "start":36,"end":53,"loc":{"start":{"line":1,"column":36},"end":{"line":1,"column":53}}, + "typeName": { + "type": "Identifier", + "start":36,"end":45,"loc":{"start":{"line":1,"column":36},"end":{"line":1,"column":45},"identifierName":"Generator"}, + "name": "Generator" + }, + "typeParameters": { + "type": "TSTypeParameterInstantiation", + "start":45,"end":53,"loc":{"start":{"line":1,"column":45},"end":{"line":1,"column":53}}, + "params": [ + { + "type": "TSNumberKeyword", + "start":46,"end":52,"loc":{"start":{"line":1,"column":46},"end":{"line":1,"column":52}} + } + ] + } + } + }, + "body": { + "type": "BlockStatement", + "start":54,"end":68,"loc":{"start":{"line":1,"column":54},"end":{"line":3,"column":1}}, + "body": [ + { + "type": "ExpressionStatement", + "start":58,"end":66,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":10}}, + "expression": { + "type": "YieldExpression", + "start":58,"end":65,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":9}}, + "delegate": false, + "argument": { + "type": "NumericLiteral", + "start":64,"end":65,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":9}}, + "extra": { + "rawValue": 2, + "raw": "2" + }, + "value": 2 + } + } + } + ], + "directives": [] + } + } + } + ], + "kind": "const" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/function/anonymous/output.json b/packages/babel-parser/test/fixtures/typescript/function/anonymous/output.json index 562fb348506c..ed420fce066c 100644 --- a/packages/babel-parser/test/fixtures/typescript/function/anonymous/output.json +++ b/packages/babel-parser/test/fixtures/typescript/function/anonymous/output.json @@ -1,126 +1,37 @@ { "type": "File", - "start": 0, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":35}}, "program": { "type": "Program", - "start": 0, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":35}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":35}}, "declarations": [ { "type": "VariableDeclarator", - "start": 6, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":6,"end":34,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":34}}, "id": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "f" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"f"}, "name": "f" }, "init": { "type": "FunctionExpression", - "start": 10, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":10,"end":34,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":34}}, "id": null, "generator": false, "async": false, "typeParameters": { "type": "TSTypeParameterDeclaration", - "start": 18, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":18,"end":21,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":21}}, "params": [ { "type": "TSTypeParameter", - "start": 19, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":19,"end":20,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":20}}, "name": "T" } ] @@ -128,64 +39,18 @@ "params": [ { "type": "Identifier", - "start": 22, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 27 - }, - "identifierName": "x" - }, + "start":22,"end":27,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":27},"identifierName":"x"}, "name": "x", "optional": true, "typeAnnotation": { "type": "TSTypeAnnotation", - "start": 24, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":24,"end":27,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":27}}, "typeAnnotation": { "type": "TSTypeReference", - "start": 26, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":26,"end":27,"loc":{"start":{"line":1,"column":26},"end":{"line":1,"column":27}}, "typeName": { "type": "Identifier", - "start": 26, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 27 - }, - "identifierName": "T" - }, + "start":26,"end":27,"loc":{"start":{"line":1,"column":26},"end":{"line":1,"column":27},"identifierName":"T"}, "name": "T" } } @@ -194,65 +59,20 @@ ], "returnType": { "type": "TSTypeAnnotation", - "start": 28, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":28,"end":31,"loc":{"start":{"line":1,"column":28},"end":{"line":1,"column":31}}, "typeAnnotation": { "type": "TSTypeReference", - "start": 30, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":30,"end":31,"loc":{"start":{"line":1,"column":30},"end":{"line":1,"column":31}}, "typeName": { "type": "Identifier", - "start": 30, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 1, - "column": 31 - }, - "identifierName": "T" - }, + "start":30,"end":31,"loc":{"start":{"line":1,"column":30},"end":{"line":1,"column":31},"identifierName":"T"}, "name": "T" } } }, "body": { "type": "BlockStatement", - "start": 32, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 32 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":32,"end":34,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":34}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/typescript/function/declare/output.json b/packages/babel-parser/test/fixtures/typescript/function/declare/output.json index 18554b17a558..edf987a0149e 100644 --- a/packages/babel-parser/test/fixtures/typescript/function/declare/output.json +++ b/packages/babel-parser/test/fixtures/typescript/function/declare/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 55, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 27 - } - }, + "start":0,"end":55,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":27}}, "program": { "type": "Program", - "start": 0, - "end": 55, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 27 - } - }, + "start":0,"end":55,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":27}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "TSDeclareFunction", - "start": 0, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, "id": { "type": "Identifier", - "start": 17, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - }, - "identifierName": "f" - }, + "start":17,"end":18,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":18},"identifierName":"f"}, "name": "f" }, "generator": false, @@ -65,98 +20,31 @@ "params": [], "returnType": { "type": "TSTypeAnnotation", - "start": 20, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":20,"end":26,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":26}}, "typeAnnotation": { "type": "TSVoidKeyword", - "start": 22, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 26 - } - } + "start":22,"end":26,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":26}} } }, "declare": true }, { "type": "TSDeclareFunction", - "start": 28, - "end": 55, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 27 - } - }, + "start":28,"end":55,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":27}}, "id": { "type": "Identifier", - "start": 45, - "end": 46, - "loc": { - "start": { - "line": 2, - "column": 17 - }, - "end": { - "line": 2, - "column": 18 - }, - "identifierName": "f" - }, + "start":45,"end":46,"loc":{"start":{"line":2,"column":17},"end":{"line":2,"column":18},"identifierName":"f"}, "name": "f" }, "generator": false, "async": false, "typeParameters": { "type": "TSTypeParameterDeclaration", - "start": 46, - "end": 49, - "loc": { - "start": { - "line": 2, - "column": 18 - }, - "end": { - "line": 2, - "column": 21 - } - }, + "start":46,"end":49,"loc":{"start":{"line":2,"column":18},"end":{"line":2,"column":21}}, "params": [ { "type": "TSTypeParameter", - "start": 47, - "end": 48, - "loc": { - "start": { - "line": 2, - "column": 19 - }, - "end": { - "line": 2, - "column": 20 - } - }, + "start":47,"end":48,"loc":{"start":{"line":2,"column":19},"end":{"line":2,"column":20}}, "name": "T" } ] @@ -164,47 +52,13 @@ "params": [], "returnType": { "type": "TSTypeAnnotation", - "start": 51, - "end": 54, - "loc": { - "start": { - "line": 2, - "column": 23 - }, - "end": { - "line": 2, - "column": 26 - } - }, + "start":51,"end":54,"loc":{"start":{"line":2,"column":23},"end":{"line":2,"column":26}}, "typeAnnotation": { "type": "TSTypeReference", - "start": 53, - "end": 54, - "loc": { - "start": { - "line": 2, - "column": 25 - }, - "end": { - "line": 2, - "column": 26 - } - }, + "start":53,"end":54,"loc":{"start":{"line":2,"column":25},"end":{"line":2,"column":26}}, "typeName": { "type": "Identifier", - "start": 53, - "end": 54, - "loc": { - "start": { - "line": 2, - "column": 25 - }, - "end": { - "line": 2, - "column": 26 - }, - "identifierName": "T" - }, + "start":53,"end":54,"loc":{"start":{"line":2,"column":25},"end":{"line":2,"column":26},"identifierName":"T"}, "name": "T" } } diff --git a/packages/babel-parser/test/fixtures/typescript/function/export-default/output.json b/packages/babel-parser/test/fixtures/typescript/function/export-default/output.json index 9ed0b4a6e22b..8aa516aeb780 100644 --- a/packages/babel-parser/test/fixtures/typescript/function/export-default/output.json +++ b/packages/babel-parser/test/fixtures/typescript/function/export-default/output.json @@ -1,143 +1,44 @@ { "type": "File", - "start": 0, - "end": 42, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 42 - } - }, + "start":0,"end":42,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":42}}, "program": { "type": "Program", - "start": 0, - "end": 42, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 42 - } - }, + "start":0,"end":42,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":42}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExportDefaultDeclaration", - "start": 0, - "end": 42, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 42 - } - }, + "start":0,"end":42,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":42}}, + "exportKind": "value", "declaration": { "type": "TSDeclareFunction", - "start": 15, - "end": 42, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 42 - } - }, + "start":15,"end":42,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":42}}, "id": null, "generator": false, "async": false, "params": [ { "type": "Identifier", - "start": 24, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 34 - }, - "identifierName": "x" - }, + "start":24,"end":34,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":34},"identifierName":"x"}, "name": "x", "optional": true, "typeAnnotation": { "type": "TSTypeAnnotation", - "start": 26, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":26,"end":34,"loc":{"start":{"line":1,"column":26},"end":{"line":1,"column":34}}, "typeAnnotation": { "type": "TSNumberKeyword", - "start": 28, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 34 - } - } + "start":28,"end":34,"loc":{"start":{"line":1,"column":28},"end":{"line":1,"column":34}} } } } ], "returnType": { "type": "TSTypeAnnotation", - "start": 35, - "end": 41, - "loc": { - "start": { - "line": 1, - "column": 35 - }, - "end": { - "line": 1, - "column": 41 - } - }, + "start":35,"end":41,"loc":{"start":{"line":1,"column":35},"end":{"line":1,"column":41}}, "typeAnnotation": { "type": "TSVoidKeyword", - "start": 37, - "end": 41, - "loc": { - "start": { - "line": 1, - "column": 37 - }, - "end": { - "line": 1, - "column": 41 - } - } + "start":37,"end":41,"loc":{"start":{"line":1,"column":37},"end":{"line":1,"column":41}} } } } diff --git a/packages/babel-parser/test/fixtures/typescript/function/getter-setter/output.json b/packages/babel-parser/test/fixtures/typescript/function/getter-setter/output.json index ba424efc68ae..9e3783493f1a 100644 --- a/packages/babel-parser/test/fixtures/typescript/function/getter-setter/output.json +++ b/packages/babel-parser/test/fixtures/typescript/function/getter-setter/output.json @@ -1,125 +1,35 @@ { "type": "File", - "start": 0, - "end": 78, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 6, - "column": 2 - } - }, + "start":0,"end":78,"loc":{"start":{"line":1,"column":0},"end":{"line":6,"column":2}}, "program": { "type": "Program", - "start": 0, - "end": 78, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 6, - "column": 2 - } - }, + "start":0,"end":78,"loc":{"start":{"line":1,"column":0},"end":{"line":6,"column":2}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 2 - } - }, + "start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":2}}, "declarations": [ { "type": "VariableDeclarator", - "start": 6, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":6,"end":34,"loc":{"start":{"line":1,"column":6},"end":{"line":3,"column":1}}, "id": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "g" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"g"}, "name": "g" }, "init": { "type": "ObjectExpression", - "start": 10, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":10,"end":34,"loc":{"start":{"line":1,"column":10},"end":{"line":3,"column":1}}, "properties": [ { "type": "ObjectMethod", - "start": 14, - "end": 32, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 20 - } - }, + "start":14,"end":32,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":20}}, "method": false, "key": { "type": "Identifier", - "start": 18, - "end": 19, - "loc": { - "start": { - "line": 2, - "column": 6 - }, - "end": { - "line": 2, - "column": 7 - }, - "identifierName": "m" - }, + "start":18,"end":19,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":7},"identifierName":"m"}, "name": "m" }, "computed": false, @@ -130,48 +40,14 @@ "params": [ { "type": "Identifier", - "start": 20, - "end": 28, - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 16 - }, - "identifierName": "this" - }, + "start":20,"end":28,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":16},"identifierName":"this"}, "name": "this", "typeAnnotation": { "type": "TSTypeAnnotation", - "start": 24, - "end": 28, - "loc": { - "start": { - "line": 2, - "column": 12 - }, - "end": { - "line": 2, - "column": 16 - } - }, + "start":24,"end":28,"loc":{"start":{"line":2,"column":12},"end":{"line":2,"column":16}}, "typeAnnotation": { "type": "TSTypeLiteral", - "start": 26, - "end": 28, - "loc": { - "start": { - "line": 2, - "column": 14 - }, - "end": { - "line": 2, - "column": 16 - } - }, + "start":26,"end":28,"loc":{"start":{"line":2,"column":14},"end":{"line":2,"column":16}}, "members": [] } } @@ -179,18 +55,7 @@ ], "body": { "type": "BlockStatement", - "start": 30, - "end": 32, - "loc": { - "start": { - "line": 2, - "column": 18 - }, - "end": { - "line": 2, - "column": 20 - } - }, + "start":30,"end":32,"loc":{"start":{"line":2,"column":18},"end":{"line":2,"column":20}}, "body": [], "directives": [] } @@ -203,95 +68,27 @@ }, { "type": "VariableDeclaration", - "start": 36, - "end": 78, - "loc": { - "start": { - "line": 4, - "column": 0 - }, - "end": { - "line": 6, - "column": 2 - } - }, + "start":36,"end":78,"loc":{"start":{"line":4,"column":0},"end":{"line":6,"column":2}}, "declarations": [ { "type": "VariableDeclarator", - "start": 42, - "end": 77, - "loc": { - "start": { - "line": 4, - "column": 6 - }, - "end": { - "line": 6, - "column": 1 - } - }, + "start":42,"end":77,"loc":{"start":{"line":4,"column":6},"end":{"line":6,"column":1}}, "id": { "type": "Identifier", - "start": 42, - "end": 43, - "loc": { - "start": { - "line": 4, - "column": 6 - }, - "end": { - "line": 4, - "column": 7 - }, - "identifierName": "s" - }, + "start":42,"end":43,"loc":{"start":{"line":4,"column":6},"end":{"line":4,"column":7},"identifierName":"s"}, "name": "s" }, "init": { "type": "ObjectExpression", - "start": 46, - "end": 77, - "loc": { - "start": { - "line": 4, - "column": 10 - }, - "end": { - "line": 6, - "column": 1 - } - }, + "start":46,"end":77,"loc":{"start":{"line":4,"column":10},"end":{"line":6,"column":1}}, "properties": [ { "type": "ObjectMethod", - "start": 50, - "end": 75, - "loc": { - "start": { - "line": 5, - "column": 2 - }, - "end": { - "line": 5, - "column": 27 - } - }, + "start":50,"end":75,"loc":{"start":{"line":5,"column":2},"end":{"line":5,"column":27}}, "method": false, "key": { "type": "Identifier", - "start": 54, - "end": 55, - "loc": { - "start": { - "line": 5, - "column": 6 - }, - "end": { - "line": 5, - "column": 7 - }, - "identifierName": "m" - }, + "start":54,"end":55,"loc":{"start":{"line":5,"column":6},"end":{"line":5,"column":7},"identifierName":"m"}, "name": "m" }, "computed": false, @@ -302,84 +99,27 @@ "params": [ { "type": "Identifier", - "start": 56, - "end": 64, - "loc": { - "start": { - "line": 5, - "column": 8 - }, - "end": { - "line": 5, - "column": 16 - }, - "identifierName": "this" - }, + "start":56,"end":64,"loc":{"start":{"line":5,"column":8},"end":{"line":5,"column":16},"identifierName":"this"}, "name": "this", "typeAnnotation": { "type": "TSTypeAnnotation", - "start": 60, - "end": 64, - "loc": { - "start": { - "line": 5, - "column": 12 - }, - "end": { - "line": 5, - "column": 16 - } - }, + "start":60,"end":64,"loc":{"start":{"line":5,"column":12},"end":{"line":5,"column":16}}, "typeAnnotation": { "type": "TSTypeLiteral", - "start": 62, - "end": 64, - "loc": { - "start": { - "line": 5, - "column": 14 - }, - "end": { - "line": 5, - "column": 16 - } - }, + "start":62,"end":64,"loc":{"start":{"line":5,"column":14},"end":{"line":5,"column":16}}, "members": [] } } }, { "type": "Identifier", - "start": 66, - "end": 71, - "loc": { - "start": { - "line": 5, - "column": 18 - }, - "end": { - "line": 5, - "column": 23 - }, - "identifierName": "value" - }, + "start":66,"end":71,"loc":{"start":{"line":5,"column":18},"end":{"line":5,"column":23},"identifierName":"value"}, "name": "value" } ], "body": { "type": "BlockStatement", - "start": 73, - "end": 75, - "loc": { - "start": { - "line": 5, - "column": 25 - }, - "end": { - "line": 5, - "column": 27 - } - }, + "start":73,"end":75,"loc":{"start":{"line":5,"column":25},"end":{"line":5,"column":27}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/typescript/function/overloads/output.json b/packages/babel-parser/test/fixtures/typescript/function/overloads/output.json index 2f66c7db6e15..cfed1a795c8d 100644 --- a/packages/babel-parser/test/fixtures/typescript/function/overloads/output.json +++ b/packages/babel-parser/test/fixtures/typescript/function/overloads/output.json @@ -1,79 +1,24 @@ { "type": "File", - "start": 0, - "end": 75, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 37 - } - }, + "start":0,"end":75,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":37}}, "program": { "type": "Program", - "start": 0, - "end": 75, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 37 - } - }, + "start":0,"end":75,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":37}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExportNamedDeclaration", - "start": 0, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 37 - } - }, + "start":0,"end":37,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":37}}, + "exportKind": "value", "specifiers": [], "source": null, "declaration": { "type": "TSDeclareFunction", - "start": 7, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 37 - } - }, + "start":7,"end":37,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":37}}, "id": { "type": "Identifier", - "start": 16, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - }, - "identifierName": "f" - }, + "start":16,"end":17,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":17},"identifierName":"f"}, "name": "f" }, "generator": false, @@ -81,129 +26,40 @@ "params": [ { "type": "Identifier", - "start": 18, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 27 - }, - "identifierName": "x" - }, + "start":18,"end":27,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":27},"identifierName":"x"}, "name": "x", "typeAnnotation": { "type": "TSTypeAnnotation", - "start": 19, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":19,"end":27,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":27}}, "typeAnnotation": { "type": "TSNumberKeyword", - "start": 21, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 27 - } - } + "start":21,"end":27,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":27}} } } } ], "returnType": { "type": "TSTypeAnnotation", - "start": 28, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":28,"end":36,"loc":{"start":{"line":1,"column":28},"end":{"line":1,"column":36}}, "typeAnnotation": { "type": "TSNumberKeyword", - "start": 30, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 1, - "column": 36 - } - } + "start":30,"end":36,"loc":{"start":{"line":1,"column":30},"end":{"line":1,"column":36}} } } } }, { "type": "ExportNamedDeclaration", - "start": 38, - "end": 75, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 37 - } - }, + "start":38,"end":75,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":37}}, + "exportKind": "value", "specifiers": [], "source": null, "declaration": { "type": "TSDeclareFunction", - "start": 45, - "end": 75, - "loc": { - "start": { - "line": 2, - "column": 7 - }, - "end": { - "line": 2, - "column": 37 - } - }, + "start":45,"end":75,"loc":{"start":{"line":2,"column":7},"end":{"line":2,"column":37}}, "id": { "type": "Identifier", - "start": 54, - "end": 55, - "loc": { - "start": { - "line": 2, - "column": 16 - }, - "end": { - "line": 2, - "column": 17 - }, - "identifierName": "f" - }, + "start":54,"end":55,"loc":{"start":{"line":2,"column":16},"end":{"line":2,"column":17},"identifierName":"f"}, "name": "f" }, "generator": false, @@ -211,80 +67,24 @@ "params": [ { "type": "Identifier", - "start": 56, - "end": 65, - "loc": { - "start": { - "line": 2, - "column": 18 - }, - "end": { - "line": 2, - "column": 27 - }, - "identifierName": "x" - }, + "start":56,"end":65,"loc":{"start":{"line":2,"column":18},"end":{"line":2,"column":27},"identifierName":"x"}, "name": "x", "typeAnnotation": { "type": "TSTypeAnnotation", - "start": 57, - "end": 65, - "loc": { - "start": { - "line": 2, - "column": 19 - }, - "end": { - "line": 2, - "column": 27 - } - }, + "start":57,"end":65,"loc":{"start":{"line":2,"column":19},"end":{"line":2,"column":27}}, "typeAnnotation": { "type": "TSStringKeyword", - "start": 59, - "end": 65, - "loc": { - "start": { - "line": 2, - "column": 21 - }, - "end": { - "line": 2, - "column": 27 - } - } + "start":59,"end":65,"loc":{"start":{"line":2,"column":21},"end":{"line":2,"column":27}} } } } ], "returnType": { "type": "TSTypeAnnotation", - "start": 66, - "end": 74, - "loc": { - "start": { - "line": 2, - "column": 28 - }, - "end": { - "line": 2, - "column": 36 - } - }, + "start":66,"end":74,"loc":{"start":{"line":2,"column":28},"end":{"line":2,"column":36}}, "typeAnnotation": { "type": "TSStringKeyword", - "start": 68, - "end": 74, - "loc": { - "start": { - "line": 2, - "column": 30 - }, - "end": { - "line": 2, - "column": 36 - } - } + "start":68,"end":74,"loc":{"start":{"line":2,"column":30},"end":{"line":2,"column":36}} } } } diff --git a/packages/babel-parser/test/fixtures/typescript/function/pattern-parameters/options.json b/packages/babel-parser/test/fixtures/typescript/function/pattern-parameters/options.json deleted file mode 100644 index fb2831d6188b..000000000000 --- a/packages/babel-parser/test/fixtures/typescript/function/pattern-parameters/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "A binding pattern parameter cannot be optional in an implementation signature. (1:11)" -} diff --git a/packages/babel-parser/test/fixtures/typescript/function/pattern-parameters/output.json b/packages/babel-parser/test/fixtures/typescript/function/pattern-parameters/output.json new file mode 100644 index 000000000000..8472638da812 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/function/pattern-parameters/output.json @@ -0,0 +1,46 @@ +{ + "type": "File", + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, + "errors": [ + "SyntaxError: A binding pattern parameter cannot be optional in an implementation signature. (1:11)" + ], + "program": { + "type": "Program", + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, + "id": { + "type": "Identifier", + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"f"}, + "name": "f" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "ArrayPattern", + "start":11,"end":14,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":14}}, + "elements": [], + "optional": true + }, + { + "type": "ObjectPattern", + "start":16,"end":18,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":18}}, + "properties": [] + } + ], + "body": { + "type": "BlockStatement", + "start":20,"end":22,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":22}}, + "body": [], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/function/predicate-types/output.json b/packages/babel-parser/test/fixtures/typescript/function/predicate-types/output.json index 85ab4987f1c2..b834fb54ebb7 100644 --- a/packages/babel-parser/test/fixtures/typescript/function/predicate-types/output.json +++ b/packages/babel-parser/test/fixtures/typescript/function/predicate-types/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 71, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 35 - } - }, + "start":0,"end":71,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":35}}, "program": { "type": "Program", - "start": 0, - "end": 71, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 35 - } - }, + "start":0,"end":71,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":35}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":35}}, "id": { "type": "Identifier", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - }, - "identifierName": "f" - }, + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"f"}, "name": "f" }, "generator": false, @@ -65,318 +20,94 @@ "params": [ { "type": "Identifier", - "start": 11, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 17 - }, - "identifierName": "x" - }, + "start":11,"end":17,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":17},"identifierName":"x"}, "name": "x", "typeAnnotation": { "type": "TSTypeAnnotation", - "start": 12, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":12,"end":17,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":17}}, "typeAnnotation": { "type": "TSAnyKeyword", - "start": 14, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 17 - } - } + "start":14,"end":17,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":17}} } } } ], "returnType": { "type": "TSTypeAnnotation", - "start": 18, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":18,"end":32,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":32}}, "typeAnnotation": { "type": "TSTypePredicate", - "start": 20, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":18,"end":32,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":32}}, "parameterName": { "type": "Identifier", - "start": 20, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 21 - }, - "identifierName": "x" - }, + "start":20,"end":21,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":21},"identifierName":"x"}, "name": "x" }, "typeAnnotation": { "type": "TSTypeAnnotation", - "start": 25, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":25,"end":32,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":32}}, "typeAnnotation": { "type": "TSBooleanKeyword", - "start": 25, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 32 - } - } + "start":25,"end":32,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":32}} } } } }, "body": { "type": "BlockStatement", - "start": 33, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 33 - }, - "end": { - "line": 1, - "column": 35 - } - }, + "start":33,"end":35,"loc":{"start":{"line":1,"column":33},"end":{"line":1,"column":35}}, "body": [], "directives": [] } }, { "type": "ExpressionStatement", - "start": 36, - "end": 71, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 35 - } - }, + "start":36,"end":71,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":35}}, "expression": { "type": "FunctionExpression", - "start": 37, - "end": 70, - "loc": { - "start": { - "line": 2, - "column": 1 - }, - "end": { - "line": 2, - "column": 34 - } - }, + "start":37,"end":70,"loc":{"start":{"line":2,"column":1},"end":{"line":2,"column":34}}, "id": null, "generator": false, "async": false, "params": [ { "type": "Identifier", - "start": 46, - "end": 52, - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 16 - }, - "identifierName": "x" - }, + "start":46,"end":52,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":16},"identifierName":"x"}, "name": "x", "typeAnnotation": { "type": "TSTypeAnnotation", - "start": 47, - "end": 52, - "loc": { - "start": { - "line": 2, - "column": 11 - }, - "end": { - "line": 2, - "column": 16 - } - }, + "start":47,"end":52,"loc":{"start":{"line":2,"column":11},"end":{"line":2,"column":16}}, "typeAnnotation": { "type": "TSAnyKeyword", - "start": 49, - "end": 52, - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 16 - } - } + "start":49,"end":52,"loc":{"start":{"line":2,"column":13},"end":{"line":2,"column":16}} } } } ], "returnType": { "type": "TSTypeAnnotation", - "start": 53, - "end": 67, - "loc": { - "start": { - "line": 2, - "column": 17 - }, - "end": { - "line": 2, - "column": 31 - } - }, + "start":53,"end":67,"loc":{"start":{"line":2,"column":17},"end":{"line":2,"column":31}}, "typeAnnotation": { "type": "TSTypePredicate", - "start": 55, - "end": 67, - "loc": { - "start": { - "line": 2, - "column": 19 - }, - "end": { - "line": 2, - "column": 31 - } - }, + "start":53,"end":67,"loc":{"start":{"line":2,"column":17},"end":{"line":2,"column":31}}, "parameterName": { "type": "Identifier", - "start": 55, - "end": 56, - "loc": { - "start": { - "line": 2, - "column": 19 - }, - "end": { - "line": 2, - "column": 20 - }, - "identifierName": "x" - }, + "start":55,"end":56,"loc":{"start":{"line":2,"column":19},"end":{"line":2,"column":20},"identifierName":"x"}, "name": "x" }, "typeAnnotation": { "type": "TSTypeAnnotation", - "start": 60, - "end": 67, - "loc": { - "start": { - "line": 2, - "column": 24 - }, - "end": { - "line": 2, - "column": 31 - } - }, + "start":60,"end":67,"loc":{"start":{"line":2,"column":24},"end":{"line":2,"column":31}}, "typeAnnotation": { "type": "TSBooleanKeyword", - "start": 60, - "end": 67, - "loc": { - "start": { - "line": 2, - "column": 24 - }, - "end": { - "line": 2, - "column": 31 - } - } + "start":60,"end":67,"loc":{"start":{"line":2,"column":24},"end":{"line":2,"column":31}} } } } }, "body": { "type": "BlockStatement", - "start": 68, - "end": 70, - "loc": { - "start": { - "line": 2, - "column": 32 - }, - "end": { - "line": 2, - "column": 34 - } - }, + "start":68,"end":70,"loc":{"start":{"line":2,"column":32},"end":{"line":2,"column":34}}, "body": [], "directives": [] }, diff --git a/packages/babel-parser/test/fixtures/typescript/import/equals-require/output.json b/packages/babel-parser/test/fixtures/typescript/import/equals-require/output.json index cc6ca197d7ec..a0d01df37243 100644 --- a/packages/babel-parser/test/fixtures/typescript/import/equals-require/output.json +++ b/packages/babel-parser/test/fixtures/typescript/import/equals-require/output.json @@ -1,94 +1,27 @@ { "type": "File", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "program": { "type": "Program", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "TSImportEqualsDeclaration", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "isExport": false, "id": { "type": "Identifier", - "start": 7, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - }, - "identifierName": "a" - }, + "start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8},"identifierName":"a"}, "name": "a" }, "moduleReference": { "type": "TSExternalModuleReference", - "start": 11, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":11,"end":23,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":23}}, "expression": { "type": "StringLiteral", - "start": 19, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":19,"end":22,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":22}}, "extra": { "rawValue": "a", "raw": "\"a\"" diff --git a/packages/babel-parser/test/fixtures/typescript/import/equals/output.json b/packages/babel-parser/test/fixtures/typescript/import/equals/output.json index 4ced84dacea3..956c79da82f4 100644 --- a/packages/babel-parser/test/fixtures/typescript/import/equals/output.json +++ b/packages/babel-parser/test/fixtures/typescript/import/equals/output.json @@ -1,112 +1,32 @@ { "type": "File", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "program": { "type": "Program", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "TSImportEqualsDeclaration", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "isExport": false, "id": { "type": "Identifier", - "start": 7, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - }, - "identifierName": "A" - }, + "start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8},"identifierName":"A"}, "name": "A" }, "moduleReference": { "type": "TSQualifiedName", - "start": 11, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":11,"end":14,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":14}}, "left": { "type": "Identifier", - "start": 11, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "B" - }, + "start":11,"end":12,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":12},"identifierName":"B"}, "name": "B" }, "right": { "type": "Identifier", - "start": 13, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - }, - "identifierName": "C" - }, + "start":13,"end":14,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":14},"identifierName":"C"}, "name": "C" } } diff --git a/packages/babel-parser/test/fixtures/typescript/import/export-import-require/output.json b/packages/babel-parser/test/fixtures/typescript/import/export-import-require/output.json index 03e8106d81c0..0c26c566c6b6 100644 --- a/packages/babel-parser/test/fixtures/typescript/import/export-import-require/output.json +++ b/packages/babel-parser/test/fixtures/typescript/import/export-import-require/output.json @@ -1,94 +1,27 @@ { "type": "File", - "start": 0, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, "program": { "type": "Program", - "start": 0, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "TSImportEqualsDeclaration", - "start": 0, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, "isExport": true, "id": { "type": "Identifier", - "start": 14, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - }, - "identifierName": "a" - }, + "start":14,"end":15,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":15},"identifierName":"a"}, "name": "a" }, "moduleReference": { "type": "TSExternalModuleReference", - "start": 18, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":18,"end":30,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":30}}, "expression": { "type": "StringLiteral", - "start": 26, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":26,"end":29,"loc":{"start":{"line":1,"column":26},"end":{"line":1,"column":29}}, "extra": { "rawValue": "a", "raw": "\"a\"" diff --git a/packages/babel-parser/test/fixtures/typescript/import/export-import/output.json b/packages/babel-parser/test/fixtures/typescript/import/export-import/output.json index 0620bc35a34c..e35c550f8aab 100644 --- a/packages/babel-parser/test/fixtures/typescript/import/export-import/output.json +++ b/packages/babel-parser/test/fixtures/typescript/import/export-import/output.json @@ -1,112 +1,32 @@ { "type": "File", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "program": { "type": "Program", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "TSImportEqualsDeclaration", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "isExport": true, "id": { "type": "Identifier", - "start": 14, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - }, - "identifierName": "A" - }, + "start":14,"end":15,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":15},"identifierName":"A"}, "name": "A" }, "moduleReference": { "type": "TSQualifiedName", - "start": 18, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":18,"end":21,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":21}}, "left": { "type": "Identifier", - "start": 18, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - }, - "identifierName": "B" - }, + "start":18,"end":19,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":19},"identifierName":"B"}, "name": "B" }, "right": { "type": "Identifier", - "start": 20, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 21 - }, - "identifierName": "C" - }, + "start":20,"end":21,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":21},"identifierName":"C"}, "name": "C" } } diff --git a/packages/babel-parser/test/fixtures/typescript/import/export-named-import-require/input.ts b/packages/babel-parser/test/fixtures/typescript/import/export-named-import-require/input.ts new file mode 100644 index 000000000000..6823138bafd9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/import/export-named-import-require/input.ts @@ -0,0 +1,2 @@ +import a = require("a"); +export { a }; diff --git a/packages/babel-parser/test/fixtures/typescript/import/export-named-import-require/output.json b/packages/babel-parser/test/fixtures/typescript/import/export-named-import-require/output.json new file mode 100644 index 000000000000..adc29a8ab46e --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/import/export-named-import-require/output.json @@ -0,0 +1,59 @@ +{ + "type": "File", + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":13}}, + "program": { + "type": "Program", + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":13}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "TSImportEqualsDeclaration", + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, + "isExport": false, + "id": { + "type": "Identifier", + "start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8},"identifierName":"a"}, + "name": "a" + }, + "moduleReference": { + "type": "TSExternalModuleReference", + "start":11,"end":23,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":23}}, + "expression": { + "type": "StringLiteral", + "start":19,"end":22,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":22}}, + "extra": { + "rawValue": "a", + "raw": "\"a\"" + }, + "value": "a" + } + } + }, + { + "type": "ExportNamedDeclaration", + "start":25,"end":38,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":13}}, + "exportKind": "value", + "specifiers": [ + { + "type": "ExportSpecifier", + "start":34,"end":35,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":10}}, + "local": { + "type": "Identifier", + "start":34,"end":35,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":10},"identifierName":"a"}, + "name": "a" + }, + "exported": { + "type": "Identifier", + "start":34,"end":35,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":10},"identifierName":"a"}, + "name": "a" + } + } + ], + "source": null, + "declaration": null + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/import/import-default-and-named-id-type/input.ts b/packages/babel-parser/test/fixtures/typescript/import/import-default-and-named-id-type/input.ts new file mode 100644 index 000000000000..64f64cd72b4f --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/import/import-default-and-named-id-type/input.ts @@ -0,0 +1 @@ +import type, { bar } from 'foo'; diff --git a/packages/babel-parser/test/fixtures/typescript/import/import-default-and-named-id-type/options.json b/packages/babel-parser/test/fixtures/typescript/import/import-default-and-named-id-type/options.json new file mode 100644 index 000000000000..d1b7c8ebeace --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/import/import-default-and-named-id-type/options.json @@ -0,0 +1,6 @@ +{ + "sourceType": "module", + "plugins": [ + "typescript" + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/import/import-default-and-named-id-type/output.json b/packages/babel-parser/test/fixtures/typescript/import/import-default-and-named-id-type/output.json new file mode 100644 index 000000000000..b91fcd5078b0 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/import/import-default-and-named-id-type/output.json @@ -0,0 +1,52 @@ +{ + "type": "File", + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, + "program": { + "type": "Program", + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ImportDeclaration", + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, + "importKind": "value", + "specifiers": [ + { + "type": "ImportDefaultSpecifier", + "start":7,"end":11,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":11}}, + "local": { + "type": "Identifier", + "start":7,"end":11,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":11},"identifierName":"type"}, + "name": "type" + } + }, + { + "type": "ImportSpecifier", + "start":15,"end":18,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":18}}, + "imported": { + "type": "Identifier", + "start":15,"end":18,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":18},"identifierName":"bar"}, + "name": "bar" + }, + "local": { + "type": "Identifier", + "start":15,"end":18,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":18},"identifierName":"bar"}, + "name": "bar" + } + } + ], + "source": { + "type": "StringLiteral", + "start":26,"end":31,"loc":{"start":{"line":1,"column":26},"end":{"line":1,"column":31}}, + "extra": { + "rawValue": "foo", + "raw": "'foo'" + }, + "value": "foo" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/import/import-default-id-type/input.ts b/packages/babel-parser/test/fixtures/typescript/import/import-default-id-type/input.ts new file mode 100644 index 000000000000..23d4b6f9bc9f --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/import/import-default-id-type/input.ts @@ -0,0 +1 @@ +import type from 'foo'; diff --git a/packages/babel-parser/test/fixtures/typescript/import/import-default-id-type/options.json b/packages/babel-parser/test/fixtures/typescript/import/import-default-id-type/options.json new file mode 100644 index 000000000000..d1b7c8ebeace --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/import/import-default-id-type/options.json @@ -0,0 +1,6 @@ +{ + "sourceType": "module", + "plugins": [ + "typescript" + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/import/import-default-id-type/output.json b/packages/babel-parser/test/fixtures/typescript/import/import-default-id-type/output.json new file mode 100644 index 000000000000..32c0a85958f5 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/import/import-default-id-type/output.json @@ -0,0 +1,38 @@ +{ + "type": "File", + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, + "program": { + "type": "Program", + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ImportDeclaration", + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, + "importKind": "value", + "specifiers": [ + { + "type": "ImportDefaultSpecifier", + "start":7,"end":11,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":11}}, + "local": { + "type": "Identifier", + "start":7,"end":11,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":11},"identifierName":"type"}, + "name": "type" + } + } + ], + "source": { + "type": "StringLiteral", + "start":17,"end":22,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":22}}, + "extra": { + "rawValue": "foo", + "raw": "'foo'" + }, + "value": "foo" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/import/import-named/input.ts b/packages/babel-parser/test/fixtures/typescript/import/import-named/input.ts new file mode 100644 index 000000000000..6a9d7a7aed57 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/import/import-named/input.ts @@ -0,0 +1 @@ +import { foo } from "bar"; diff --git a/packages/babel-parser/test/fixtures/typescript/import/import-named/output.json b/packages/babel-parser/test/fixtures/typescript/import/import-named/output.json new file mode 100644 index 000000000000..4f8221972167 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/import/import-named/output.json @@ -0,0 +1,43 @@ +{ + "type": "File", + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, + "program": { + "type": "Program", + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ImportDeclaration", + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, + "importKind": "value", + "specifiers": [ + { + "type": "ImportSpecifier", + "start":9,"end":12,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":12}}, + "imported": { + "type": "Identifier", + "start":9,"end":12,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":12},"identifierName":"foo"}, + "name": "foo" + }, + "local": { + "type": "Identifier", + "start":9,"end":12,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":12},"identifierName":"foo"}, + "name": "foo" + } + } + ], + "source": { + "type": "StringLiteral", + "start":20,"end":25,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":25}}, + "extra": { + "rawValue": "bar", + "raw": "\"bar\"" + }, + "value": "bar" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/import/import-star-as/input.ts b/packages/babel-parser/test/fixtures/typescript/import/import-star-as/input.ts new file mode 100644 index 000000000000..02f2ec844acb --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/import/import-star-as/input.ts @@ -0,0 +1 @@ +import * as a from "a"; diff --git a/packages/babel-parser/test/fixtures/typescript/import/import-star-as/output.json b/packages/babel-parser/test/fixtures/typescript/import/import-star-as/output.json new file mode 100644 index 000000000000..c5eaa9021eb7 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/import/import-star-as/output.json @@ -0,0 +1,38 @@ +{ + "type": "File", + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, + "program": { + "type": "Program", + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ImportDeclaration", + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, + "importKind": "value", + "specifiers": [ + { + "type": "ImportNamespaceSpecifier", + "start":7,"end":13,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":13}}, + "local": { + "type": "Identifier", + "start":12,"end":13,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":13},"identifierName":"a"}, + "name": "a" + } + } + ], + "source": { + "type": "StringLiteral", + "start":19,"end":22,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":22}}, + "extra": { + "rawValue": "a", + "raw": "\"a\"" + }, + "value": "a" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/import/not-top-level/output.json b/packages/babel-parser/test/fixtures/typescript/import/not-top-level/output.json index d8c247aa8f57..dd3c9e4ddda7 100644 --- a/packages/babel-parser/test/fixtures/typescript/import/not-top-level/output.json +++ b/packages/babel-parser/test/fixtures/typescript/import/not-top-level/output.json @@ -1,62 +1,18 @@ { "type": "File", - "start": 0, - "end": 50, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":50,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 50, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":50,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "TSModuleDeclaration", - "start": 0, - "end": 50, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":50,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "id": { "type": "StringLiteral", - "start": 15, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":15,"end":18,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":18}}, "extra": { "rawValue": "m", "raw": "\"m\"" @@ -65,81 +21,26 @@ }, "body": { "type": "TSModuleBlock", - "start": 19, - "end": 50, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":19,"end":50,"loc":{"start":{"line":1,"column":19},"end":{"line":3,"column":1}}, "body": [ { "type": "ImportDeclaration", - "start": 25, - "end": 48, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 27 - } - }, + "start":25,"end":48,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":27}}, + "importKind": "value", "specifiers": [ { "type": "ImportNamespaceSpecifier", - "start": 32, - "end": 38, - "loc": { - "start": { - "line": 2, - "column": 11 - }, - "end": { - "line": 2, - "column": 17 - } - }, + "start":32,"end":38,"loc":{"start":{"line":2,"column":11},"end":{"line":2,"column":17}}, "local": { "type": "Identifier", - "start": 37, - "end": 38, - "loc": { - "start": { - "line": 2, - "column": 16 - }, - "end": { - "line": 2, - "column": 17 - }, - "identifierName": "a" - }, + "start":37,"end":38,"loc":{"start":{"line":2,"column":16},"end":{"line":2,"column":17},"identifierName":"a"}, "name": "a" } } ], "source": { "type": "StringLiteral", - "start": 44, - "end": 47, - "loc": { - "start": { - "line": 2, - "column": 23 - }, - "end": { - "line": 2, - "column": 26 - } - }, + "start":44,"end":47,"loc":{"start":{"line":2,"column":23},"end":{"line":2,"column":26}}, "extra": { "rawValue": "a", "raw": "\"a\"" diff --git a/packages/babel-parser/test/fixtures/typescript/interface/call-signature/output.json b/packages/babel-parser/test/fixtures/typescript/interface/call-signature/output.json index 66865baeaa83..e08c41659ee0 100644 --- a/packages/babel-parser/test/fixtures/typescript/interface/call-signature/output.json +++ b/packages/babel-parser/test/fixtures/typescript/interface/call-signature/output.json @@ -1,171 +1,48 @@ { "type": "File", - "start": 0, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "TSInterfaceDeclaration", - "start": 0, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "id": { "type": "Identifier", - "start": 10, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "I" - }, + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11},"identifierName":"I"}, "name": "I" }, "body": { "type": "TSInterfaceBody", - "start": 12, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":12,"end":38,"loc":{"start":{"line":1,"column":12},"end":{"line":3,"column":1}}, "body": [ { "type": "TSCallSignatureDeclaration", - "start": 18, - "end": 36, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 22 - } - }, + "start":18,"end":36,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":22}}, "parameters": [ { "type": "Identifier", - "start": 19, - "end": 28, - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 14 - }, - "identifierName": "x" - }, + "start":19,"end":28,"loc":{"start":{"line":2,"column":5},"end":{"line":2,"column":14},"identifierName":"x"}, "name": "x", "typeAnnotation": { "type": "TSTypeAnnotation", - "start": 20, - "end": 28, - "loc": { - "start": { - "line": 2, - "column": 6 - }, - "end": { - "line": 2, - "column": 14 - } - }, + "start":20,"end":28,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":14}}, "typeAnnotation": { "type": "TSNumberKeyword", - "start": 22, - "end": 28, - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 14 - } - } + "start":22,"end":28,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":14}} } } } ], "typeAnnotation": { "type": "TSTypeAnnotation", - "start": 29, - "end": 35, - "loc": { - "start": { - "line": 2, - "column": 15 - }, - "end": { - "line": 2, - "column": 21 - } - }, + "start":29,"end":35,"loc":{"start":{"line":2,"column":15},"end":{"line":2,"column":21}}, "typeAnnotation": { "type": "TSVoidKeyword", - "start": 31, - "end": 35, - "loc": { - "start": { - "line": 2, - "column": 17 - }, - "end": { - "line": 2, - "column": 21 - } - } + "start":31,"end":35,"loc":{"start":{"line":2,"column":17},"end":{"line":2,"column":21}} } } } diff --git a/packages/babel-parser/test/fixtures/typescript/interface/construct-signature/output.json b/packages/babel-parser/test/fixtures/typescript/interface/construct-signature/output.json index d3902ee1e913..00ed1c2cc182 100644 --- a/packages/babel-parser/test/fixtures/typescript/interface/construct-signature/output.json +++ b/packages/babel-parser/test/fixtures/typescript/interface/construct-signature/output.json @@ -1,171 +1,48 @@ { "type": "File", - "start": 0, - "end": 42, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":42,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 42, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":42,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "TSInterfaceDeclaration", - "start": 0, - "end": 42, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":42,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "id": { "type": "Identifier", - "start": 10, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "I" - }, + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11},"identifierName":"I"}, "name": "I" }, "body": { "type": "TSInterfaceBody", - "start": 12, - "end": 42, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":12,"end":42,"loc":{"start":{"line":1,"column":12},"end":{"line":3,"column":1}}, "body": [ { "type": "TSConstructSignatureDeclaration", - "start": 18, - "end": 40, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 26 - } - }, + "start":18,"end":40,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":26}}, "parameters": [ { "type": "Identifier", - "start": 23, - "end": 32, - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 18 - }, - "identifierName": "x" - }, + "start":23,"end":32,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":18},"identifierName":"x"}, "name": "x", "typeAnnotation": { "type": "TSTypeAnnotation", - "start": 24, - "end": 32, - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 18 - } - }, + "start":24,"end":32,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":18}}, "typeAnnotation": { "type": "TSNumberKeyword", - "start": 26, - "end": 32, - "loc": { - "start": { - "line": 2, - "column": 12 - }, - "end": { - "line": 2, - "column": 18 - } - } + "start":26,"end":32,"loc":{"start":{"line":2,"column":12},"end":{"line":2,"column":18}} } } } ], "typeAnnotation": { "type": "TSTypeAnnotation", - "start": 33, - "end": 39, - "loc": { - "start": { - "line": 2, - "column": 19 - }, - "end": { - "line": 2, - "column": 25 - } - }, + "start":33,"end":39,"loc":{"start":{"line":2,"column":19},"end":{"line":2,"column":25}}, "typeAnnotation": { "type": "TSVoidKeyword", - "start": 35, - "end": 39, - "loc": { - "start": { - "line": 2, - "column": 21 - }, - "end": { - "line": 2, - "column": 25 - } - } + "start":35,"end":39,"loc":{"start":{"line":2,"column":21},"end":{"line":2,"column":25}} } } } diff --git a/packages/babel-parser/test/fixtures/typescript/interface/export/output.json b/packages/babel-parser/test/fixtures/typescript/interface/export/output.json index 1ad5c8ab4df6..d6b463c693d0 100644 --- a/packages/babel-parser/test/fixtures/typescript/interface/export/output.json +++ b/packages/babel-parser/test/fixtures/typescript/interface/export/output.json @@ -1,158 +1,48 @@ { "type": "File", - "start": 0, - "end": 51, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 29 - } - }, + "start":0,"end":51,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":29}}, "program": { "type": "Program", - "start": 0, - "end": 51, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 29 - } - }, + "start":0,"end":51,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":29}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExportNamedDeclaration", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, + "exportKind": "type", "specifiers": [], "source": null, "declaration": { "type": "TSInterfaceDeclaration", - "start": 7, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":7,"end":21,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":21}}, "id": { "type": "Identifier", - "start": 17, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - }, - "identifierName": "I" - }, + "start":17,"end":18,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":18},"identifierName":"I"}, "name": "I" }, "body": { "type": "TSInterfaceBody", - "start": 19, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":19,"end":21,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":21}}, "body": [] } } }, { "type": "ExportDefaultDeclaration", - "start": 22, - "end": 51, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 29 - } - }, + "start":22,"end":51,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":29}}, + "exportKind": "value", "declaration": { "type": "TSInterfaceDeclaration", - "start": 37, - "end": 51, - "loc": { - "start": { - "line": 2, - "column": 15 - }, - "end": { - "line": 2, - "column": 29 - } - }, + "start":37,"end":51,"loc":{"start":{"line":2,"column":15},"end":{"line":2,"column":29}}, "id": { "type": "Identifier", - "start": 47, - "end": 48, - "loc": { - "start": { - "line": 2, - "column": 25 - }, - "end": { - "line": 2, - "column": 26 - }, - "identifierName": "A" - }, + "start":47,"end":48,"loc":{"start":{"line":2,"column":25},"end":{"line":2,"column":26},"identifierName":"A"}, "name": "A" }, "body": { "type": "TSInterfaceBody", - "start": 49, - "end": 51, - "loc": { - "start": { - "line": 2, - "column": 27 - }, - "end": { - "line": 2, - "column": 29 - } - }, + "start":49,"end":51,"loc":{"start":{"line":2,"column":27},"end":{"line":2,"column":29}}, "body": [] } } diff --git a/packages/babel-parser/test/fixtures/typescript/interface/extends/output.json b/packages/babel-parser/test/fixtures/typescript/interface/extends/output.json index f8891d564146..a01e69d56c38 100644 --- a/packages/babel-parser/test/fixtures/typescript/interface/extends/output.json +++ b/packages/babel-parser/test/fixtures/typescript/interface/extends/output.json @@ -1,173 +1,48 @@ { "type": "File", - "start": 0, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, "program": { "type": "Program", - "start": 0, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "TSInterfaceDeclaration", - "start": 0, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, "id": { "type": "Identifier", - "start": 10, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "I" - }, + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11},"identifierName":"I"}, "name": "I" }, "extends": [ { "type": "TSExpressionWithTypeArguments", - "start": 20, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":20,"end":26,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":26}}, "expression": { "type": "TSQualifiedName", - "start": 20, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":20,"end":23,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":23}}, "left": { "type": "Identifier", - "start": 20, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 21 - }, - "identifierName": "X" - }, + "start":20,"end":21,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":21},"identifierName":"X"}, "name": "X" }, "right": { "type": "Identifier", - "start": 22, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 23 - }, - "identifierName": "Y" - }, + "start":22,"end":23,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":23},"identifierName":"Y"}, "name": "Y" } }, "typeParameters": { "type": "TSTypeParameterInstantiation", - "start": 23, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":23,"end":26,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":26}}, "params": [ { "type": "TSTypeReference", - "start": 24, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":24,"end":25,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":25}}, "typeName": { "type": "Identifier", - "start": 24, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 25 - }, - "identifierName": "Z" - }, + "start":24,"end":25,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":25},"identifierName":"Z"}, "name": "Z" } } @@ -177,18 +52,7 @@ ], "body": { "type": "TSInterfaceBody", - "start": 27, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":27,"end":29,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":29}}, "body": [] } } diff --git a/packages/babel-parser/test/fixtures/typescript/interface/generic/output.json b/packages/babel-parser/test/fixtures/typescript/interface/generic/output.json index 5b09114bb272..7ab2f684e80c 100644 --- a/packages/babel-parser/test/fixtures/typescript/interface/generic/output.json +++ b/packages/babel-parser/test/fixtures/typescript/interface/generic/output.json @@ -1,185 +1,51 @@ { "type": "File", - "start": 0, - "end": 48, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 48 - } - }, + "start":0,"end":48,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":48}}, "program": { "type": "Program", - "start": 0, - "end": 48, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 48 - } - }, + "start":0,"end":48,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":48}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "TSInterfaceDeclaration", - "start": 0, - "end": 48, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 48 - } - }, + "start":0,"end":48,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":48}}, "id": { "type": "Identifier", - "start": 10, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "I" - }, + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11},"identifierName":"I"}, "name": "I" }, "typeParameters": { "type": "TSTypeParameterDeclaration", - "start": 11, - "end": 45, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 45 - } - }, + "start":11,"end":45,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":45}}, "params": [ { "type": "TSTypeParameter", - "start": 12, - "end": 44, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 44 - } - }, + "start":12,"end":44,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":44}}, "name": "T", "constraint": { "type": "TSObjectKeyword", - "start": 22, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 28 - } - } + "start":22,"end":28,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":28}} }, "default": { "type": "TSTypeLiteral", - "start": 31, - "end": 44, - "loc": { - "start": { - "line": 1, - "column": 31 - }, - "end": { - "line": 1, - "column": 44 - } - }, + "start":31,"end":44,"loc":{"start":{"line":1,"column":31},"end":{"line":1,"column":44}}, "members": [ { "type": "TSPropertySignature", - "start": 33, - "end": 42, - "loc": { - "start": { - "line": 1, - "column": 33 - }, - "end": { - "line": 1, - "column": 42 - } - }, + "start":33,"end":42,"loc":{"start":{"line":1,"column":33},"end":{"line":1,"column":42}}, "key": { "type": "Identifier", - "start": 33, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 33 - }, - "end": { - "line": 1, - "column": 34 - }, - "identifierName": "x" - }, + "start":33,"end":34,"loc":{"start":{"line":1,"column":33},"end":{"line":1,"column":34},"identifierName":"x"}, "name": "x" }, "computed": false, "typeAnnotation": { "type": "TSTypeAnnotation", - "start": 34, - "end": 42, - "loc": { - "start": { - "line": 1, - "column": 34 - }, - "end": { - "line": 1, - "column": 42 - } - }, + "start":34,"end":42,"loc":{"start":{"line":1,"column":34},"end":{"line":1,"column":42}}, "typeAnnotation": { "type": "TSNumberKeyword", - "start": 36, - "end": 42, - "loc": { - "start": { - "line": 1, - "column": 36 - }, - "end": { - "line": 1, - "column": 42 - } - } + "start":36,"end":42,"loc":{"start":{"line":1,"column":36},"end":{"line":1,"column":42}} } } } @@ -190,18 +56,7 @@ }, "body": { "type": "TSInterfaceBody", - "start": 46, - "end": 48, - "loc": { - "start": { - "line": 1, - "column": 46 - }, - "end": { - "line": 1, - "column": 48 - } - }, + "start":46,"end":48,"loc":{"start":{"line":1,"column":46},"end":{"line":1,"column":48}}, "body": [] } } diff --git a/packages/babel-parser/test/fixtures/typescript/interface/index-signature/output.json b/packages/babel-parser/test/fixtures/typescript/interface/index-signature/output.json index 6a4a98afb573..f0c29970791a 100644 --- a/packages/babel-parser/test/fixtures/typescript/interface/index-signature/output.json +++ b/packages/babel-parser/test/fixtures/typescript/interface/index-signature/output.json @@ -1,171 +1,48 @@ { "type": "File", - "start": 0, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":40,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":40,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "TSInterfaceDeclaration", - "start": 0, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":40,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "id": { "type": "Identifier", - "start": 10, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "I" - }, + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11},"identifierName":"I"}, "name": "I" }, "body": { "type": "TSInterfaceBody", - "start": 12, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":12,"end":40,"loc":{"start":{"line":1,"column":12},"end":{"line":3,"column":1}}, "body": [ { "type": "TSIndexSignature", - "start": 18, - "end": 38, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 24 - } - }, + "start":18,"end":38,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":24}}, "parameters": [ { "type": "Identifier", - "start": 19, - "end": 28, - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 14 - }, - "identifierName": "s" - }, + "start":19,"end":28,"loc":{"start":{"line":2,"column":5},"end":{"line":2,"column":14},"identifierName":"s"}, "name": "s", "typeAnnotation": { "type": "TSTypeAnnotation", - "start": 20, - "end": 28, - "loc": { - "start": { - "line": 2, - "column": 6 - }, - "end": { - "line": 2, - "column": 14 - } - }, + "start":20,"end":28,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":14}}, "typeAnnotation": { "type": "TSStringKeyword", - "start": 22, - "end": 28, - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 14 - } - } + "start":22,"end":28,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":14}} } } } ], "typeAnnotation": { "type": "TSTypeAnnotation", - "start": 29, - "end": 37, - "loc": { - "start": { - "line": 2, - "column": 15 - }, - "end": { - "line": 2, - "column": 23 - } - }, + "start":29,"end":37,"loc":{"start":{"line":2,"column":15},"end":{"line":2,"column":23}}, "typeAnnotation": { "type": "TSNumberKeyword", - "start": 31, - "end": 37, - "loc": { - "start": { - "line": 2, - "column": 17 - }, - "end": { - "line": 2, - "column": 23 - } - } + "start":31,"end":37,"loc":{"start":{"line":2,"column":17},"end":{"line":2,"column":23}} } } } diff --git a/packages/babel-parser/test/fixtures/typescript/interface/method-computed/output.json b/packages/babel-parser/test/fixtures/typescript/interface/method-computed/output.json index b9bc92ecb7bb..0546e0e21df5 100644 --- a/packages/babel-parser/test/fixtures/typescript/interface/method-computed/output.json +++ b/packages/babel-parser/test/fixtures/typescript/interface/method-computed/output.json @@ -1,141 +1,39 @@ { "type": "File", - "start": 0, - "end": 80, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":0,"end":80,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 80, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":0,"end":80,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "TSInterfaceDeclaration", - "start": 0, - "end": 80, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":0,"end":80,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, "id": { "type": "Identifier", - "start": 10, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "I" - }, + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11},"identifierName":"I"}, "name": "I" }, "body": { "type": "TSInterfaceBody", - "start": 12, - "end": 80, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":12,"end":80,"loc":{"start":{"line":1,"column":12},"end":{"line":4,"column":1}}, "body": [ { "type": "TSMethodSignature", - "start": 18, - "end": 44, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 30 - } - }, + "start":18,"end":44,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":30}}, "computed": true, "key": { "type": "MemberExpression", - "start": 19, - "end": 34, - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 20 - } - }, + "start":19,"end":34,"loc":{"start":{"line":2,"column":5},"end":{"line":2,"column":20}}, "object": { "type": "Identifier", - "start": 19, - "end": 25, - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 11 - }, - "identifierName": "Symbol" - }, + "start":19,"end":25,"loc":{"start":{"line":2,"column":5},"end":{"line":2,"column":11},"identifierName":"Symbol"}, "name": "Symbol" }, "property": { "type": "Identifier", - "start": 26, - "end": 34, - "loc": { - "start": { - "line": 2, - "column": 12 - }, - "end": { - "line": 2, - "column": 20 - }, - "identifierName": "iterator" - }, + "start":26,"end":34,"loc":{"start":{"line":2,"column":12},"end":{"line":2,"column":20},"identifierName":"iterator"}, "name": "iterator" }, "computed": false @@ -143,96 +41,28 @@ "parameters": [], "typeAnnotation": { "type": "TSTypeAnnotation", - "start": 37, - "end": 43, - "loc": { - "start": { - "line": 2, - "column": 23 - }, - "end": { - "line": 2, - "column": 29 - } - }, + "start":37,"end":43,"loc":{"start":{"line":2,"column":23},"end":{"line":2,"column":29}}, "typeAnnotation": { "type": "TSVoidKeyword", - "start": 39, - "end": 43, - "loc": { - "start": { - "line": 2, - "column": 25 - }, - "end": { - "line": 2, - "column": 29 - } - } + "start":39,"end":43,"loc":{"start":{"line":2,"column":25},"end":{"line":2,"column":29}} } } }, { "type": "TSMethodSignature", - "start": 49, - "end": 78, - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 33 - } - }, + "start":49,"end":78,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":33}}, "computed": true, "key": { "type": "MemberExpression", - "start": 50, - "end": 65, - "loc": { - "start": { - "line": 3, - "column": 5 - }, - "end": { - "line": 3, - "column": 20 - } - }, + "start":50,"end":65,"loc":{"start":{"line":3,"column":5},"end":{"line":3,"column":20}}, "object": { "type": "Identifier", - "start": 50, - "end": 56, - "loc": { - "start": { - "line": 3, - "column": 5 - }, - "end": { - "line": 3, - "column": 11 - }, - "identifierName": "Symbol" - }, + "start":50,"end":56,"loc":{"start":{"line":3,"column":5},"end":{"line":3,"column":11},"identifierName":"Symbol"}, "name": "Symbol" }, "property": { "type": "Identifier", - "start": 57, - "end": 65, - "loc": { - "start": { - "line": 3, - "column": 12 - }, - "end": { - "line": 3, - "column": 20 - }, - "identifierName": "iterator" - }, + "start":57,"end":65,"loc":{"start":{"line":3,"column":12},"end":{"line":3,"column":20},"identifierName":"iterator"}, "name": "iterator" }, "computed": false @@ -241,32 +71,10 @@ "parameters": [], "typeAnnotation": { "type": "TSTypeAnnotation", - "start": 69, - "end": 77, - "loc": { - "start": { - "line": 3, - "column": 24 - }, - "end": { - "line": 3, - "column": 32 - } - }, + "start":69,"end":77,"loc":{"start":{"line":3,"column":24},"end":{"line":3,"column":32}}, "typeAnnotation": { "type": "TSNumberKeyword", - "start": 71, - "end": 77, - "loc": { - "start": { - "line": 3, - "column": 26 - }, - "end": { - "line": 3, - "column": 32 - } - } + "start":71,"end":77,"loc":{"start":{"line":3,"column":26},"end":{"line":3,"column":32}} } } } diff --git a/packages/babel-parser/test/fixtures/typescript/interface/method-generic/output.json b/packages/babel-parser/test/fixtures/typescript/interface/method-generic/output.json index 37f707e8f8bc..dcd0be5cd357 100644 --- a/packages/babel-parser/test/fixtures/typescript/interface/method-generic/output.json +++ b/packages/babel-parser/test/fixtures/typescript/interface/method-generic/output.json @@ -1,232 +1,64 @@ { "type": "File", - "start": 0, - "end": 61, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":61,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 61, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":61,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "TSInterfaceDeclaration", - "start": 0, - "end": 61, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":61,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "id": { "type": "Identifier", - "start": 10, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "I" - }, + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11},"identifierName":"I"}, "name": "I" }, "body": { "type": "TSInterfaceBody", - "start": 12, - "end": 61, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":12,"end":61,"loc":{"start":{"line":1,"column":12},"end":{"line":3,"column":1}}, "body": [ { "type": "TSMethodSignature", - "start": 18, - "end": 59, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 45 - } - }, + "start":18,"end":59,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":45}}, "key": { "type": "Identifier", - "start": 18, - "end": 19, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 5 - }, - "identifierName": "m" - }, + "start":18,"end":19,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":5},"identifierName":"m"}, "name": "m" }, "computed": false, "typeParameters": { "type": "TSTypeParameterDeclaration", - "start": 19, - "end": 53, - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 39 - } - }, + "start":19,"end":53,"loc":{"start":{"line":2,"column":5},"end":{"line":2,"column":39}}, "params": [ { "type": "TSTypeParameter", - "start": 20, - "end": 52, - "loc": { - "start": { - "line": 2, - "column": 6 - }, - "end": { - "line": 2, - "column": 38 - } - }, + "start":20,"end":52,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":38}}, "name": "T", "constraint": { "type": "TSObjectKeyword", - "start": 30, - "end": 36, - "loc": { - "start": { - "line": 2, - "column": 16 - }, - "end": { - "line": 2, - "column": 22 - } - } + "start":30,"end":36,"loc":{"start":{"line":2,"column":16},"end":{"line":2,"column":22}} }, "default": { "type": "TSTypeLiteral", - "start": 39, - "end": 52, - "loc": { - "start": { - "line": 2, - "column": 25 - }, - "end": { - "line": 2, - "column": 38 - } - }, + "start":39,"end":52,"loc":{"start":{"line":2,"column":25},"end":{"line":2,"column":38}}, "members": [ { "type": "TSPropertySignature", - "start": 41, - "end": 50, - "loc": { - "start": { - "line": 2, - "column": 27 - }, - "end": { - "line": 2, - "column": 36 - } - }, + "start":41,"end":50,"loc":{"start":{"line":2,"column":27},"end":{"line":2,"column":36}}, "key": { "type": "Identifier", - "start": 41, - "end": 42, - "loc": { - "start": { - "line": 2, - "column": 27 - }, - "end": { - "line": 2, - "column": 28 - }, - "identifierName": "x" - }, + "start":41,"end":42,"loc":{"start":{"line":2,"column":27},"end":{"line":2,"column":28},"identifierName":"x"}, "name": "x" }, "computed": false, "typeAnnotation": { "type": "TSTypeAnnotation", - "start": 42, - "end": 50, - "loc": { - "start": { - "line": 2, - "column": 28 - }, - "end": { - "line": 2, - "column": 36 - } - }, + "start":42,"end":50,"loc":{"start":{"line":2,"column":28},"end":{"line":2,"column":36}}, "typeAnnotation": { "type": "TSNumberKeyword", - "start": 44, - "end": 50, - "loc": { - "start": { - "line": 2, - "column": 30 - }, - "end": { - "line": 2, - "column": 36 - } - } + "start":44,"end":50,"loc":{"start":{"line":2,"column":30},"end":{"line":2,"column":36}} } } } @@ -238,47 +70,13 @@ "parameters": [], "typeAnnotation": { "type": "TSTypeAnnotation", - "start": 55, - "end": 58, - "loc": { - "start": { - "line": 2, - "column": 41 - }, - "end": { - "line": 2, - "column": 44 - } - }, + "start":55,"end":58,"loc":{"start":{"line":2,"column":41},"end":{"line":2,"column":44}}, "typeAnnotation": { "type": "TSTypeReference", - "start": 57, - "end": 58, - "loc": { - "start": { - "line": 2, - "column": 43 - }, - "end": { - "line": 2, - "column": 44 - } - }, + "start":57,"end":58,"loc":{"start":{"line":2,"column":43},"end":{"line":2,"column":44}}, "typeName": { "type": "Identifier", - "start": 57, - "end": 58, - "loc": { - "start": { - "line": 2, - "column": 43 - }, - "end": { - "line": 2, - "column": 44 - }, - "identifierName": "T" - }, + "start":57,"end":58,"loc":{"start":{"line":2,"column":43},"end":{"line":2,"column":44},"identifierName":"T"}, "name": "T" } } diff --git a/packages/babel-parser/test/fixtures/typescript/interface/method-optional/output.json b/packages/babel-parser/test/fixtures/typescript/interface/method-optional/output.json index fa745450cd54..dfaf36169aef 100644 --- a/packages/babel-parser/test/fixtures/typescript/interface/method-optional/output.json +++ b/packages/babel-parser/test/fixtures/typescript/interface/method-optional/output.json @@ -1,109 +1,30 @@ { "type": "File", - "start": 0, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "TSInterfaceDeclaration", - "start": 0, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "id": { "type": "Identifier", - "start": 10, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "I" - }, + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11},"identifierName":"I"}, "name": "I" }, "body": { "type": "TSInterfaceBody", - "start": 12, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":12,"end":31,"loc":{"start":{"line":1,"column":12},"end":{"line":3,"column":1}}, "body": [ { "type": "TSMethodSignature", - "start": 18, - "end": 29, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 15 - } - }, + "start":18,"end":29,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":15}}, "key": { "type": "Identifier", - "start": 18, - "end": 19, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 5 - }, - "identifierName": "m" - }, + "start":18,"end":19,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":5},"identifierName":"m"}, "name": "m" }, "computed": false, @@ -111,32 +32,10 @@ "parameters": [], "typeAnnotation": { "type": "TSTypeAnnotation", - "start": 22, - "end": 28, - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 14 - } - }, + "start":22,"end":28,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":14}}, "typeAnnotation": { "type": "TSVoidKeyword", - "start": 24, - "end": 28, - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 14 - } - } + "start":24,"end":28,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":14}} } } } diff --git a/packages/babel-parser/test/fixtures/typescript/interface/method-plain/output.json b/packages/babel-parser/test/fixtures/typescript/interface/method-plain/output.json index c1c3b22a610d..48f549db12a4 100644 --- a/packages/babel-parser/test/fixtures/typescript/interface/method-plain/output.json +++ b/packages/babel-parser/test/fixtures/typescript/interface/method-plain/output.json @@ -1,109 +1,30 @@ { "type": "File", - "start": 0, - "end": 65, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":0,"end":65,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 65, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":0,"end":65,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "TSInterfaceDeclaration", - "start": 0, - "end": 65, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":0,"end":65,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, "id": { "type": "Identifier", - "start": 10, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "I" - }, + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11},"identifierName":"I"}, "name": "I" }, "body": { "type": "TSInterfaceBody", - "start": 12, - "end": 65, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":12,"end":65,"loc":{"start":{"line":1,"column":12},"end":{"line":4,"column":1}}, "body": [ { "type": "TSMethodSignature", - "start": 18, - "end": 22, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 8 - } - }, + "start":18,"end":22,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":8}}, "key": { "type": "Identifier", - "start": 18, - "end": 19, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 5 - }, - "identifierName": "m" - }, + "start":18,"end":19,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":5},"identifierName":"m"}, "name": "m" }, "computed": false, @@ -111,158 +32,45 @@ }, { "type": "TSMethodSignature", - "start": 27, - "end": 63, - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 40 - } - }, + "start":27,"end":63,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":40}}, "key": { "type": "Identifier", - "start": 27, - "end": 28, - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 5 - }, - "identifierName": "m" - }, + "start":27,"end":28,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":5},"identifierName":"m"}, "name": "m" }, "computed": false, "parameters": [ { "type": "Identifier", - "start": 29, - "end": 39, - "loc": { - "start": { - "line": 3, - "column": 6 - }, - "end": { - "line": 3, - "column": 16 - }, - "identifierName": "x" - }, + "start":29,"end":39,"loc":{"start":{"line":3,"column":6},"end":{"line":3,"column":16},"identifierName":"x"}, "name": "x", "optional": true, "typeAnnotation": { "type": "TSTypeAnnotation", - "start": 31, - "end": 39, - "loc": { - "start": { - "line": 3, - "column": 8 - }, - "end": { - "line": 3, - "column": 16 - } - }, + "start":31,"end":39,"loc":{"start":{"line":3,"column":8},"end":{"line":3,"column":16}}, "typeAnnotation": { "type": "TSNumberKeyword", - "start": 33, - "end": 39, - "loc": { - "start": { - "line": 3, - "column": 10 - }, - "end": { - "line": 3, - "column": 16 - } - } + "start":33,"end":39,"loc":{"start":{"line":3,"column":10},"end":{"line":3,"column":16}} } } }, { "type": "RestElement", - "start": 41, - "end": 55, - "loc": { - "start": { - "line": 3, - "column": 18 - }, - "end": { - "line": 3, - "column": 32 - } - }, + "start":41,"end":55,"loc":{"start":{"line":3,"column":18},"end":{"line":3,"column":32}}, "argument": { "type": "Identifier", - "start": 44, - "end": 45, - "loc": { - "start": { - "line": 3, - "column": 21 - }, - "end": { - "line": 3, - "column": 22 - }, - "identifierName": "y" - }, + "start":44,"end":45,"loc":{"start":{"line":3,"column":21},"end":{"line":3,"column":22},"identifierName":"y"}, "name": "y" }, "typeAnnotation": { "type": "TSTypeAnnotation", - "start": 45, - "end": 55, - "loc": { - "start": { - "line": 3, - "column": 22 - }, - "end": { - "line": 3, - "column": 32 - } - }, + "start":45,"end":55,"loc":{"start":{"line":3,"column":22},"end":{"line":3,"column":32}}, "typeAnnotation": { "type": "TSArrayType", - "start": 47, - "end": 55, - "loc": { - "start": { - "line": 3, - "column": 24 - }, - "end": { - "line": 3, - "column": 32 - } - }, + "start":47,"end":55,"loc":{"start":{"line":3,"column":24},"end":{"line":3,"column":32}}, "elementType": { "type": "TSNumberKeyword", - "start": 47, - "end": 53, - "loc": { - "start": { - "line": 3, - "column": 24 - }, - "end": { - "line": 3, - "column": 30 - } - } + "start":47,"end":53,"loc":{"start":{"line":3,"column":24},"end":{"line":3,"column":30}} } } } @@ -270,32 +78,10 @@ ], "typeAnnotation": { "type": "TSTypeAnnotation", - "start": 56, - "end": 62, - "loc": { - "start": { - "line": 3, - "column": 33 - }, - "end": { - "line": 3, - "column": 39 - } - }, + "start":56,"end":62,"loc":{"start":{"line":3,"column":33},"end":{"line":3,"column":39}}, "typeAnnotation": { "type": "TSVoidKeyword", - "start": 58, - "end": 62, - "loc": { - "start": { - "line": 3, - "column": 35 - }, - "end": { - "line": 3, - "column": 39 - } - } + "start":58,"end":62,"loc":{"start":{"line":3,"column":35},"end":{"line":3,"column":39}} } } } diff --git a/packages/babel-parser/test/fixtures/typescript/interface/modifiers/output.json b/packages/babel-parser/test/fixtures/typescript/interface/modifiers/output.json index 0c1b0a87b174..0038b79005e1 100644 --- a/packages/babel-parser/test/fixtures/typescript/interface/modifiers/output.json +++ b/packages/babel-parser/test/fixtures/typescript/interface/modifiers/output.json @@ -1,141 +1,40 @@ { "type": "File", - "start": 0, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "TSInterfaceDeclaration", - "start": 0, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "id": { "type": "Identifier", - "start": 10, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "I" - }, + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11},"identifierName":"I"}, "name": "I" }, "body": { "type": "TSInterfaceBody", - "start": 12, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":12,"end":39,"loc":{"start":{"line":1,"column":12},"end":{"line":3,"column":1}}, "body": [ { "type": "TSPropertySignature", - "start": 18, - "end": 37, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 23 - } - }, + "start":18,"end":37,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":23}}, "key": { "type": "Identifier", - "start": 27, - "end": 28, - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 14 - }, - "identifierName": "x" - }, + "start":27,"end":28,"loc":{"start":{"line":2,"column":13},"end":{"line":2,"column":14},"identifierName":"x"}, "name": "x" }, "computed": false, "readonly": true, "typeAnnotation": { "type": "TSTypeAnnotation", - "start": 28, - "end": 36, - "loc": { - "start": { - "line": 2, - "column": 14 - }, - "end": { - "line": 2, - "column": 22 - } - }, + "start":28,"end":36,"loc":{"start":{"line":2,"column":14},"end":{"line":2,"column":22}}, "typeAnnotation": { "type": "TSNumberKeyword", - "start": 30, - "end": 36, - "loc": { - "start": { - "line": 2, - "column": 16 - }, - "end": { - "line": 2, - "column": 22 - } - } + "start":30,"end":36,"loc":{"start":{"line":2,"column":16},"end":{"line":2,"column":22}} } } } diff --git a/packages/babel-parser/test/fixtures/typescript/interface/new-line/output.json b/packages/babel-parser/test/fixtures/typescript/interface/new-line/output.json index 56e109b261fa..f4f22a613f28 100644 --- a/packages/babel-parser/test/fixtures/typescript/interface/new-line/output.json +++ b/packages/babel-parser/test/fixtures/typescript/interface/new-line/output.json @@ -1,112 +1,33 @@ { "type": "File", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 2 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":2}}, "program": { "type": "Program", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 2 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":2}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "expression": { "type": "Identifier", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "interface" - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9},"identifierName":"interface"}, "name": "interface" } }, { "type": "ExpressionStatement", - "start": 10, - "end": 11, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 1 - } - }, + "start":10,"end":11,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":1}}, "expression": { "type": "Identifier", - "start": 10, - "end": 11, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 1 - }, - "identifierName": "F" - }, + "start":10,"end":11,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":1},"identifierName":"F"}, "name": "F" } }, { "type": "BlockStatement", - "start": 12, - "end": 14, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 2 - } - }, + "start":12,"end":14,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":2}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/typescript/interface/properties/output.json b/packages/babel-parser/test/fixtures/typescript/interface/properties/output.json index ae16a8b7ddaa..9b822018f0ce 100644 --- a/packages/babel-parser/test/fixtures/typescript/interface/properties/output.json +++ b/packages/babel-parser/test/fixtures/typescript/interface/properties/output.json @@ -1,237 +1,68 @@ { "type": "File", - "start": 0, - "end": 53, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 1 - } - }, + "start":0,"end":53,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 53, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 1 - } - }, + "start":0,"end":53,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "TSInterfaceDeclaration", - "start": 0, - "end": 53, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 1 - } - }, + "start":0,"end":53,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, "id": { "type": "Identifier", - "start": 10, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "I" - }, + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11},"identifierName":"I"}, "name": "I" }, "body": { "type": "TSInterfaceBody", - "start": 12, - "end": 53, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 5, - "column": 1 - } - }, + "start":12,"end":53,"loc":{"start":{"line":1,"column":12},"end":{"line":5,"column":1}}, "body": [ { "type": "TSPropertySignature", - "start": 18, - "end": 20, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 6 - } - }, + "start":18,"end":20,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":6}}, "key": { "type": "Identifier", - "start": 18, - "end": 19, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 5 - }, - "identifierName": "x" - }, + "start":18,"end":19,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":5},"identifierName":"x"}, "name": "x" }, "computed": false }, { "type": "TSPropertySignature", - "start": 25, - "end": 35, - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 14 - } - }, + "start":25,"end":35,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":14}}, "key": { "type": "Identifier", - "start": 25, - "end": 26, - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 5 - }, - "identifierName": "y" - }, + "start":25,"end":26,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":5},"identifierName":"y"}, "name": "y" }, "computed": false, "typeAnnotation": { "type": "TSTypeAnnotation", - "start": 26, - "end": 34, - "loc": { - "start": { - "line": 3, - "column": 5 - }, - "end": { - "line": 3, - "column": 13 - } - }, + "start":26,"end":34,"loc":{"start":{"line":3,"column":5},"end":{"line":3,"column":13}}, "typeAnnotation": { "type": "TSNumberKeyword", - "start": 28, - "end": 34, - "loc": { - "start": { - "line": 3, - "column": 7 - }, - "end": { - "line": 3, - "column": 13 - } - } + "start":28,"end":34,"loc":{"start":{"line":3,"column":7},"end":{"line":3,"column":13}} } } }, { "type": "TSPropertySignature", - "start": 40, - "end": 51, - "loc": { - "start": { - "line": 4, - "column": 4 - }, - "end": { - "line": 4, - "column": 15 - } - }, + "start":40,"end":51,"loc":{"start":{"line":4,"column":4},"end":{"line":4,"column":15}}, "key": { "type": "Identifier", - "start": 40, - "end": 41, - "loc": { - "start": { - "line": 4, - "column": 4 - }, - "end": { - "line": 4, - "column": 5 - }, - "identifierName": "z" - }, + "start":40,"end":41,"loc":{"start":{"line":4,"column":4},"end":{"line":4,"column":5},"identifierName":"z"}, "name": "z" }, "computed": false, "optional": true, "typeAnnotation": { "type": "TSTypeAnnotation", - "start": 42, - "end": 50, - "loc": { - "start": { - "line": 4, - "column": 6 - }, - "end": { - "line": 4, - "column": 14 - } - }, + "start":42,"end":50,"loc":{"start":{"line":4,"column":6},"end":{"line":4,"column":14}}, "typeAnnotation": { "type": "TSNumberKeyword", - "start": 44, - "end": 50, - "loc": { - "start": { - "line": 4, - "column": 8 - }, - "end": { - "line": 4, - "column": 14 - } - } + "start":44,"end":50,"loc":{"start":{"line":4,"column":8},"end":{"line":4,"column":14}} } } } diff --git a/packages/babel-parser/test/fixtures/typescript/interface/property-computed/output.json b/packages/babel-parser/test/fixtures/typescript/interface/property-computed/output.json index 7e53f4c70113..4d2a3072867d 100644 --- a/packages/babel-parser/test/fixtures/typescript/interface/property-computed/output.json +++ b/packages/babel-parser/test/fixtures/typescript/interface/property-computed/output.json @@ -1,237 +1,67 @@ { "type": "File", - "start": 0, - "end": 78, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":0,"end":78,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 78, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":0,"end":78,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "TSInterfaceDeclaration", - "start": 0, - "end": 78, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":0,"end":78,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, "id": { "type": "Identifier", - "start": 10, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "I" - }, + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11},"identifierName":"I"}, "name": "I" }, "body": { "type": "TSInterfaceBody", - "start": 12, - "end": 78, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":12,"end":78,"loc":{"start":{"line":1,"column":12},"end":{"line":4,"column":1}}, "body": [ { "type": "TSPropertySignature", - "start": 18, - "end": 44, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 30 - } - }, + "start":18,"end":44,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":30}}, "computed": true, "key": { "type": "MemberExpression", - "start": 19, - "end": 34, - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 20 - } - }, + "start":19,"end":34,"loc":{"start":{"line":2,"column":5},"end":{"line":2,"column":20}}, "object": { "type": "Identifier", - "start": 19, - "end": 25, - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 11 - }, - "identifierName": "Symbol" - }, + "start":19,"end":25,"loc":{"start":{"line":2,"column":5},"end":{"line":2,"column":11},"identifierName":"Symbol"}, "name": "Symbol" }, "property": { "type": "Identifier", - "start": 26, - "end": 34, - "loc": { - "start": { - "line": 2, - "column": 12 - }, - "end": { - "line": 2, - "column": 20 - }, - "identifierName": "iterator" - }, + "start":26,"end":34,"loc":{"start":{"line":2,"column":12},"end":{"line":2,"column":20},"identifierName":"iterator"}, "name": "iterator" }, "computed": false }, "typeAnnotation": { "type": "TSTypeAnnotation", - "start": 35, - "end": 43, - "loc": { - "start": { - "line": 2, - "column": 21 - }, - "end": { - "line": 2, - "column": 29 - } - }, + "start":35,"end":43,"loc":{"start":{"line":2,"column":21},"end":{"line":2,"column":29}}, "typeAnnotation": { "type": "TSNumberKeyword", - "start": 37, - "end": 43, - "loc": { - "start": { - "line": 2, - "column": 23 - }, - "end": { - "line": 2, - "column": 29 - } - } + "start":37,"end":43,"loc":{"start":{"line":2,"column":23},"end":{"line":2,"column":29}} } } }, { "type": "TSPropertySignature", - "start": 49, - "end": 76, - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 31 - } - }, + "start":49,"end":76,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":31}}, "computed": true, "key": { "type": "MemberExpression", - "start": 50, - "end": 65, - "loc": { - "start": { - "line": 3, - "column": 5 - }, - "end": { - "line": 3, - "column": 20 - } - }, + "start":50,"end":65,"loc":{"start":{"line":3,"column":5},"end":{"line":3,"column":20}}, "object": { "type": "Identifier", - "start": 50, - "end": 56, - "loc": { - "start": { - "line": 3, - "column": 5 - }, - "end": { - "line": 3, - "column": 11 - }, - "identifierName": "Symbol" - }, + "start":50,"end":56,"loc":{"start":{"line":3,"column":5},"end":{"line":3,"column":11},"identifierName":"Symbol"}, "name": "Symbol" }, "property": { "type": "Identifier", - "start": 57, - "end": 65, - "loc": { - "start": { - "line": 3, - "column": 12 - }, - "end": { - "line": 3, - "column": 20 - }, - "identifierName": "iterator" - }, + "start":57,"end":65,"loc":{"start":{"line":3,"column":12},"end":{"line":3,"column":20},"identifierName":"iterator"}, "name": "iterator" }, "computed": false @@ -239,32 +69,10 @@ "optional": true, "typeAnnotation": { "type": "TSTypeAnnotation", - "start": 67, - "end": 75, - "loc": { - "start": { - "line": 3, - "column": 22 - }, - "end": { - "line": 3, - "column": 30 - } - }, + "start":67,"end":75,"loc":{"start":{"line":3,"column":22},"end":{"line":3,"column":30}}, "typeAnnotation": { "type": "TSNumberKeyword", - "start": 69, - "end": 75, - "loc": { - "start": { - "line": 3, - "column": 24 - }, - "end": { - "line": 3, - "column": 30 - } - } + "start":69,"end":75,"loc":{"start":{"line":3,"column":24},"end":{"line":3,"column":30}} } } } diff --git a/packages/babel-parser/test/fixtures/typescript/interface/property-named-public/output.json b/packages/babel-parser/test/fixtures/typescript/interface/property-named-public/output.json index 0f7e0a88bb7a..d9710b301c82 100644 --- a/packages/babel-parser/test/fixtures/typescript/interface/property-named-public/output.json +++ b/packages/babel-parser/test/fixtures/typescript/interface/property-named-public/output.json @@ -1,140 +1,39 @@ { "type": "File", - "start": 0, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "TSInterfaceDeclaration", - "start": 0, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "id": { "type": "Identifier", - "start": 10, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "I" - }, + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11},"identifierName":"I"}, "name": "I" }, "body": { "type": "TSInterfaceBody", - "start": 12, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":12,"end":32,"loc":{"start":{"line":1,"column":12},"end":{"line":3,"column":1}}, "body": [ { "type": "TSPropertySignature", - "start": 15, - "end": 30, - "loc": { - "start": { - "line": 2, - "column": 1 - }, - "end": { - "line": 2, - "column": 16 - } - }, + "start":15,"end":30,"loc":{"start":{"line":2,"column":1},"end":{"line":2,"column":16}}, "key": { "type": "Identifier", - "start": 15, - "end": 21, - "loc": { - "start": { - "line": 2, - "column": 1 - }, - "end": { - "line": 2, - "column": 7 - }, - "identifierName": "public" - }, + "start":15,"end":21,"loc":{"start":{"line":2,"column":1},"end":{"line":2,"column":7},"identifierName":"public"}, "name": "public" }, "computed": false, "typeAnnotation": { "type": "TSTypeAnnotation", - "start": 21, - "end": 29, - "loc": { - "start": { - "line": 2, - "column": 7 - }, - "end": { - "line": 2, - "column": 15 - } - }, + "start":21,"end":29,"loc":{"start":{"line":2,"column":7},"end":{"line":2,"column":15}}, "typeAnnotation": { "type": "TSNumberKeyword", - "start": 23, - "end": 29, - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 15 - } - } + "start":23,"end":29,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":15}} } } } diff --git a/packages/babel-parser/test/fixtures/typescript/interface/reserved-method-name/output.json b/packages/babel-parser/test/fixtures/typescript/interface/reserved-method-name/output.json index ea83a7bd8de3..59bb78a048ef 100644 --- a/packages/babel-parser/test/fixtures/typescript/interface/reserved-method-name/output.json +++ b/packages/babel-parser/test/fixtures/typescript/interface/reserved-method-name/output.json @@ -1,141 +1,40 @@ { "type": "File", - "start": 0, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "TSInterfaceDeclaration", - "start": 0, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "id": { "type": "Identifier", - "start": 10, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "I" - }, + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11},"identifierName":"I"}, "name": "I" }, "body": { "type": "TSInterfaceBody", - "start": 12, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":12,"end":34,"loc":{"start":{"line":1,"column":12},"end":{"line":3,"column":1}}, "body": [ { "type": "TSMethodSignature", - "start": 18, - "end": 32, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 18 - } - }, + "start":18,"end":32,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":18}}, "key": { "type": "Identifier", - "start": 18, - "end": 23, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 9 - }, - "identifierName": "catch" - }, + "start":18,"end":23,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":9},"identifierName":"catch"}, "name": "catch" }, "computed": false, "parameters": [], "typeAnnotation": { "type": "TSTypeAnnotation", - "start": 25, - "end": 31, - "loc": { - "start": { - "line": 2, - "column": 11 - }, - "end": { - "line": 2, - "column": 17 - } - }, + "start":25,"end":31,"loc":{"start":{"line":2,"column":11},"end":{"line":2,"column":17}}, "typeAnnotation": { "type": "TSVoidKeyword", - "start": 27, - "end": 31, - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 17 - } - } + "start":27,"end":31,"loc":{"start":{"line":2,"column":13},"end":{"line":2,"column":17}} } } } diff --git a/packages/babel-parser/test/fixtures/typescript/interface/separators/output.json b/packages/babel-parser/test/fixtures/typescript/interface/separators/output.json index 6b7b44d5d92d..f4e4aad0c27d 100644 --- a/packages/babel-parser/test/fixtures/typescript/interface/separators/output.json +++ b/packages/babel-parser/test/fixtures/typescript/interface/separators/output.json @@ -1,203 +1,57 @@ { "type": "File", - "start": 0, - "end": 130, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 6, - "column": 1 - } - }, + "start":0,"end":130,"loc":{"start":{"line":1,"column":0},"end":{"line":6,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 130, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 6, - "column": 1 - } - }, + "start":0,"end":130,"loc":{"start":{"line":1,"column":0},"end":{"line":6,"column":1}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "TSInterfaceDeclaration", - "start": 0, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 40 - } - }, + "start":0,"end":40,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":40}}, "id": { "type": "Identifier", - "start": 10, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 15 - }, - "identifierName": "Comma" - }, + "start":10,"end":15,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":15},"identifierName":"Comma"}, "name": "Comma" }, "body": { "type": "TSInterfaceBody", - "start": 16, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 40 - } - }, + "start":16,"end":40,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":40}}, "body": [ { "type": "TSPropertySignature", - "start": 18, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":18,"end":28,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":28}}, "key": { "type": "Identifier", - "start": 18, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - }, - "identifierName": "x" - }, + "start":18,"end":19,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":19},"identifierName":"x"}, "name": "x" }, "computed": false, "typeAnnotation": { "type": "TSTypeAnnotation", - "start": 19, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":19,"end":27,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":27}}, "typeAnnotation": { "type": "TSNumberKeyword", - "start": 21, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 27 - } - } + "start":21,"end":27,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":27}} } } }, { "type": "TSPropertySignature", - "start": 29, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":29,"end":38,"loc":{"start":{"line":1,"column":29},"end":{"line":1,"column":38}}, "key": { "type": "Identifier", - "start": 29, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 1, - "column": 30 - }, - "identifierName": "y" - }, + "start":29,"end":30,"loc":{"start":{"line":1,"column":29},"end":{"line":1,"column":30},"identifierName":"y"}, "name": "y" }, "computed": false, "typeAnnotation": { "type": "TSTypeAnnotation", - "start": 30, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":30,"end":38,"loc":{"start":{"line":1,"column":30},"end":{"line":1,"column":38}}, "typeAnnotation": { "type": "TSNumberKeyword", - "start": 32, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 32 - }, - "end": { - "line": 1, - "column": 38 - } - } + "start":32,"end":38,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":38}} } } } @@ -206,173 +60,49 @@ }, { "type": "TSInterfaceDeclaration", - "start": 41, - "end": 80, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 39 - } - }, + "start":41,"end":80,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":39}}, "id": { "type": "Identifier", - "start": 51, - "end": 55, - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 14 - }, - "identifierName": "Semi" - }, + "start":51,"end":55,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":14},"identifierName":"Semi"}, "name": "Semi" }, "body": { "type": "TSInterfaceBody", - "start": 56, - "end": 80, - "loc": { - "start": { - "line": 2, - "column": 15 - }, - "end": { - "line": 2, - "column": 39 - } - }, + "start":56,"end":80,"loc":{"start":{"line":2,"column":15},"end":{"line":2,"column":39}}, "body": [ { "type": "TSPropertySignature", - "start": 58, - "end": 68, - "loc": { - "start": { - "line": 2, - "column": 17 - }, - "end": { - "line": 2, - "column": 27 - } - }, + "start":58,"end":68,"loc":{"start":{"line":2,"column":17},"end":{"line":2,"column":27}}, "key": { "type": "Identifier", - "start": 58, - "end": 59, - "loc": { - "start": { - "line": 2, - "column": 17 - }, - "end": { - "line": 2, - "column": 18 - }, - "identifierName": "x" - }, + "start":58,"end":59,"loc":{"start":{"line":2,"column":17},"end":{"line":2,"column":18},"identifierName":"x"}, "name": "x" }, "computed": false, "typeAnnotation": { "type": "TSTypeAnnotation", - "start": 59, - "end": 67, - "loc": { - "start": { - "line": 2, - "column": 18 - }, - "end": { - "line": 2, - "column": 26 - } - }, + "start":59,"end":67,"loc":{"start":{"line":2,"column":18},"end":{"line":2,"column":26}}, "typeAnnotation": { "type": "TSNumberKeyword", - "start": 61, - "end": 67, - "loc": { - "start": { - "line": 2, - "column": 20 - }, - "end": { - "line": 2, - "column": 26 - } - } + "start":61,"end":67,"loc":{"start":{"line":2,"column":20},"end":{"line":2,"column":26}} } } }, { "type": "TSPropertySignature", - "start": 69, - "end": 78, - "loc": { - "start": { - "line": 2, - "column": 28 - }, - "end": { - "line": 2, - "column": 37 - } - }, + "start":69,"end":78,"loc":{"start":{"line":2,"column":28},"end":{"line":2,"column":37}}, "key": { "type": "Identifier", - "start": 69, - "end": 70, - "loc": { - "start": { - "line": 2, - "column": 28 - }, - "end": { - "line": 2, - "column": 29 - }, - "identifierName": "y" - }, + "start":69,"end":70,"loc":{"start":{"line":2,"column":28},"end":{"line":2,"column":29},"identifierName":"y"}, "name": "y" }, "computed": false, "typeAnnotation": { "type": "TSTypeAnnotation", - "start": 70, - "end": 78, - "loc": { - "start": { - "line": 2, - "column": 29 - }, - "end": { - "line": 2, - "column": 37 - } - }, + "start":70,"end":78,"loc":{"start":{"line":2,"column":29},"end":{"line":2,"column":37}}, "typeAnnotation": { "type": "TSNumberKeyword", - "start": 72, - "end": 78, - "loc": { - "start": { - "line": 2, - "column": 31 - }, - "end": { - "line": 2, - "column": 37 - } - } + "start":72,"end":78,"loc":{"start":{"line":2,"column":31},"end":{"line":2,"column":37}} } } } @@ -381,173 +111,49 @@ }, { "type": "TSInterfaceDeclaration", - "start": 81, - "end": 130, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 6, - "column": 1 - } - }, + "start":81,"end":130,"loc":{"start":{"line":3,"column":0},"end":{"line":6,"column":1}}, "id": { "type": "Identifier", - "start": 91, - "end": 98, - "loc": { - "start": { - "line": 3, - "column": 10 - }, - "end": { - "line": 3, - "column": 17 - }, - "identifierName": "Newline" - }, + "start":91,"end":98,"loc":{"start":{"line":3,"column":10},"end":{"line":3,"column":17},"identifierName":"Newline"}, "name": "Newline" }, "body": { "type": "TSInterfaceBody", - "start": 99, - "end": 130, - "loc": { - "start": { - "line": 3, - "column": 18 - }, - "end": { - "line": 6, - "column": 1 - } - }, + "start":99,"end":130,"loc":{"start":{"line":3,"column":18},"end":{"line":6,"column":1}}, "body": [ { "type": "TSPropertySignature", - "start": 105, - "end": 114, - "loc": { - "start": { - "line": 4, - "column": 4 - }, - "end": { - "line": 4, - "column": 13 - } - }, + "start":105,"end":114,"loc":{"start":{"line":4,"column":4},"end":{"line":4,"column":13}}, "key": { "type": "Identifier", - "start": 105, - "end": 106, - "loc": { - "start": { - "line": 4, - "column": 4 - }, - "end": { - "line": 4, - "column": 5 - }, - "identifierName": "x" - }, + "start":105,"end":106,"loc":{"start":{"line":4,"column":4},"end":{"line":4,"column":5},"identifierName":"x"}, "name": "x" }, "computed": false, "typeAnnotation": { "type": "TSTypeAnnotation", - "start": 106, - "end": 114, - "loc": { - "start": { - "line": 4, - "column": 5 - }, - "end": { - "line": 4, - "column": 13 - } - }, + "start":106,"end":114,"loc":{"start":{"line":4,"column":5},"end":{"line":4,"column":13}}, "typeAnnotation": { "type": "TSNumberKeyword", - "start": 108, - "end": 114, - "loc": { - "start": { - "line": 4, - "column": 7 - }, - "end": { - "line": 4, - "column": 13 - } - } + "start":108,"end":114,"loc":{"start":{"line":4,"column":7},"end":{"line":4,"column":13}} } } }, { "type": "TSPropertySignature", - "start": 119, - "end": 128, - "loc": { - "start": { - "line": 5, - "column": 4 - }, - "end": { - "line": 5, - "column": 13 - } - }, + "start":119,"end":128,"loc":{"start":{"line":5,"column":4},"end":{"line":5,"column":13}}, "key": { "type": "Identifier", - "start": 119, - "end": 120, - "loc": { - "start": { - "line": 5, - "column": 4 - }, - "end": { - "line": 5, - "column": 5 - }, - "identifierName": "y" - }, + "start":119,"end":120,"loc":{"start":{"line":5,"column":4},"end":{"line":5,"column":5},"identifierName":"y"}, "name": "y" }, "computed": false, "typeAnnotation": { "type": "TSTypeAnnotation", - "start": 120, - "end": 128, - "loc": { - "start": { - "line": 5, - "column": 5 - }, - "end": { - "line": 5, - "column": 13 - } - }, + "start":120,"end":128,"loc":{"start":{"line":5,"column":5},"end":{"line":5,"column":13}}, "typeAnnotation": { "type": "TSNumberKeyword", - "start": 122, - "end": 128, - "loc": { - "start": { - "line": 5, - "column": 7 - }, - "end": { - "line": 5, - "column": 13 - } - } + "start":122,"end":128,"loc":{"start":{"line":5,"column":7},"end":{"line":5,"column":13}} } } } diff --git a/packages/babel-parser/test/fixtures/typescript/legacy-decorators/abstract-class/output.json b/packages/babel-parser/test/fixtures/typescript/legacy-decorators/abstract-class/output.json index d286de258eb6..2494ecbfc434 100644 --- a/packages/babel-parser/test/fixtures/typescript/legacy-decorators/abstract-class/output.json +++ b/packages/babel-parser/test/fixtures/typescript/legacy-decorators/abstract-class/output.json @@ -1,93 +1,26 @@ { "type": "File", - "start": 0, - "end": 85, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 6, - "column": 1 - } - }, + "start":0,"end":85,"loc":{"start":{"line":1,"column":0},"end":{"line":6,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 85, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 6, - "column": 1 - } - }, + "start":0,"end":85,"loc":{"start":{"line":1,"column":0},"end":{"line":6,"column":1}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 85, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 6, - "column": 1 - } - }, + "start":0,"end":85,"loc":{"start":{"line":1,"column":0},"end":{"line":6,"column":1}}, "abstract": true, "decorators": [ { "type": "Decorator", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "expression": { "type": "CallExpression", - "start": 1, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":1,"end":11,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":11}}, "callee": { "type": "Identifier", - "start": 1, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "decorate" - }, + "start":1,"end":9,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":9},"identifierName":"decorate"}, "name": "decorate" }, "arguments": [] @@ -96,83 +29,25 @@ ], "id": { "type": "Identifier", - "start": 27, - "end": 31, - "loc": { - "start": { - "line": 2, - "column": 15 - }, - "end": { - "line": 2, - "column": 19 - }, - "identifierName": "Test" - }, + "start":27,"end":31,"loc":{"start":{"line":2,"column":15},"end":{"line":2,"column":19},"identifierName":"Test"}, "name": "Test" }, "superClass": { "type": "Identifier", - "start": 40, - "end": 46, - "loc": { - "start": { - "line": 2, - "column": 28 - }, - "end": { - "line": 2, - "column": 34 - }, - "identifierName": "Object" - }, + "start":40,"end":46,"loc":{"start":{"line":2,"column":28},"end":{"line":2,"column":34},"identifierName":"Object"}, "name": "Object" }, "body": { "type": "ClassBody", - "start": 47, - "end": 85, - "loc": { - "start": { - "line": 2, - "column": 35 - }, - "end": { - "line": 6, - "column": 1 - } - }, + "start":47,"end":85,"loc":{"start":{"line":2,"column":35},"end":{"line":6,"column":1}}, "body": [ { "type": "ClassMethod", - "start": 51, - "end": 83, - "loc": { - "start": { - "line": 3, - "column": 2 - }, - "end": { - "line": 5, - "column": 3 - } - }, + "start":51,"end":83,"loc":{"start":{"line":3,"column":2},"end":{"line":5,"column":3}}, "static": false, "key": { "type": "Identifier", - "start": 51, - "end": 62, - "loc": { - "start": { - "line": 3, - "column": 2 - }, - "end": { - "line": 3, - "column": 13 - }, - "identifierName": "constructor" - }, + "start":51,"end":62,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":13},"identifierName":"constructor"}, "name": "constructor" }, "computed": false, @@ -183,61 +58,17 @@ "params": [], "body": { "type": "BlockStatement", - "start": 65, - "end": 83, - "loc": { - "start": { - "line": 3, - "column": 16 - }, - "end": { - "line": 5, - "column": 3 - } - }, + "start":65,"end":83,"loc":{"start":{"line":3,"column":16},"end":{"line":5,"column":3}}, "body": [ { "type": "ExpressionStatement", - "start": 71, - "end": 79, - "loc": { - "start": { - "line": 4, - "column": 4 - }, - "end": { - "line": 4, - "column": 12 - } - }, + "start":71,"end":79,"loc":{"start":{"line":4,"column":4},"end":{"line":4,"column":12}}, "expression": { "type": "CallExpression", - "start": 71, - "end": 78, - "loc": { - "start": { - "line": 4, - "column": 4 - }, - "end": { - "line": 4, - "column": 11 - } - }, + "start":71,"end":78,"loc":{"start":{"line":4,"column":4},"end":{"line":4,"column":11}}, "callee": { "type": "Super", - "start": 71, - "end": 76, - "loc": { - "start": { - "line": 4, - "column": 4 - }, - "end": { - "line": 4, - "column": 9 - } - } + "start":71,"end":76,"loc":{"start":{"line":4,"column":4},"end":{"line":4,"column":9}} }, "arguments": [] } diff --git a/packages/babel-parser/test/fixtures/typescript/legacy-decorators/type-arguments/output.json b/packages/babel-parser/test/fixtures/typescript/legacy-decorators/type-arguments/output.json index 91add31ed156..f546aad36972 100644 --- a/packages/babel-parser/test/fixtures/typescript/legacy-decorators/type-arguments/output.json +++ b/packages/babel-parser/test/fixtures/typescript/legacy-decorators/type-arguments/output.json @@ -1,124 +1,35 @@ { "type": "File", - "start": 0, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 13 - } - }, + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":13}}, "program": { "type": "Program", - "start": 0, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 13 - } - }, + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":13}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 13 - } - }, + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":13}}, "decorators": [ { "type": "Decorator", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, "expression": { "type": "CallExpression", - "start": 1, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":1,"end":20,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":20}}, "callee": { "type": "Identifier", - "start": 1, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 10 - }, - "identifierName": "decorator" - }, + "start":1,"end":10,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":10},"identifierName":"decorator"}, "name": "decorator" }, "arguments": [], "typeParameters": { "type": "TSTypeParameterInstantiation", - "start": 10, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":10,"end":18,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":18}}, "params": [ { "type": "TSStringKeyword", - "start": 11, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 17 - } - } + "start":11,"end":17,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":17}} } ] } @@ -127,36 +38,13 @@ ], "id": { "type": "Identifier", - "start": 27, - "end": 31, - "loc": { - "start": { - "line": 2, - "column": 6 - }, - "end": { - "line": 2, - "column": 10 - }, - "identifierName": "Test" - }, + "start":27,"end":31,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":10},"identifierName":"Test"}, "name": "Test" }, "superClass": null, "body": { "type": "ClassBody", - "start": 32, - "end": 34, - "loc": { - "start": { - "line": 2, - "column": 11 - }, - "end": { - "line": 2, - "column": 13 - } - }, + "start":32,"end":34,"loc":{"start":{"line":2,"column":11},"end":{"line":2,"column":13}}, "body": [] } } diff --git a/packages/babel-parser/test/fixtures/typescript/module-namespace/body-declare/output.json b/packages/babel-parser/test/fixtures/typescript/module-namespace/body-declare/output.json index 5f8ae8eb5bb1..8bcf5ab69dc8 100644 --- a/packages/babel-parser/test/fixtures/typescript/module-namespace/body-declare/output.json +++ b/packages/babel-parser/test/fixtures/typescript/module-namespace/body-declare/output.json @@ -1,153 +1,41 @@ { "type": "File", - "start": 0, - "end": 44, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":44,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 44, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":44,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "TSModuleDeclaration", - "start": 0, - "end": 44, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":44,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "id": { "type": "Identifier", - "start": 18, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - }, - "identifierName": "N" - }, + "start":18,"end":19,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":19},"identifierName":"N"}, "name": "N" }, "body": { "type": "TSModuleBlock", - "start": 20, - "end": 44, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":20,"end":44,"loc":{"start":{"line":1,"column":20},"end":{"line":3,"column":1}}, "body": [ { "type": "VariableDeclaration", - "start": 26, - "end": 42, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 20 - } - }, + "start":26,"end":42,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":20}}, "declarations": [ { "type": "VariableDeclarator", - "start": 32, - "end": 41, - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 19 - } - }, + "start":32,"end":41,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":19}}, "id": { "type": "Identifier", - "start": 32, - "end": 41, - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 19 - }, - "identifierName": "x" - }, + "start":32,"end":41,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":19},"identifierName":"x"}, "name": "x", "typeAnnotation": { "type": "TSTypeAnnotation", - "start": 33, - "end": 41, - "loc": { - "start": { - "line": 2, - "column": 11 - }, - "end": { - "line": 2, - "column": 19 - } - }, + "start":33,"end":41,"loc":{"start":{"line":2,"column":11},"end":{"line":2,"column":19}}, "typeAnnotation": { "type": "TSNumberKeyword", - "start": 35, - "end": 41, - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 19 - } - } + "start":35,"end":41,"loc":{"start":{"line":2,"column":13},"end":{"line":2,"column":19}} } } }, diff --git a/packages/babel-parser/test/fixtures/typescript/module-namespace/body-nested-declare/output.json b/packages/babel-parser/test/fixtures/typescript/module-namespace/body-nested-declare/output.json index ff0da7268c7e..649baf03a44b 100644 --- a/packages/babel-parser/test/fixtures/typescript/module-namespace/body-nested-declare/output.json +++ b/packages/babel-parser/test/fixtures/typescript/module-namespace/body-nested-declare/output.json @@ -1,199 +1,53 @@ { "type": "File", - "start": 0, - "end": 72, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 1 - } - }, + "start":0,"end":72,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 72, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 1 - } - }, + "start":0,"end":72,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "TSModuleDeclaration", - "start": 0, - "end": 72, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 1 - } - }, + "start":0,"end":72,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, "id": { "type": "Identifier", - "start": 18, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - }, - "identifierName": "A" - }, + "start":18,"end":19,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":19},"identifierName":"A"}, "name": "A" }, "body": { "type": "TSModuleBlock", - "start": 20, - "end": 72, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 5, - "column": 1 - } - }, + "start":20,"end":72,"loc":{"start":{"line":1,"column":20},"end":{"line":5,"column":1}}, "body": [ { "type": "TSModuleDeclaration", - "start": 26, - "end": 70, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 4, - "column": 5 - } - }, + "start":26,"end":70,"loc":{"start":{"line":2,"column":4},"end":{"line":4,"column":5}}, "id": { "type": "Identifier", - "start": 36, - "end": 37, - "loc": { - "start": { - "line": 2, - "column": 14 - }, - "end": { - "line": 2, - "column": 15 - }, - "identifierName": "B" - }, + "start":36,"end":37,"loc":{"start":{"line":2,"column":14},"end":{"line":2,"column":15},"identifierName":"B"}, "name": "B" }, "body": { "type": "TSModuleBlock", - "start": 38, - "end": 70, - "loc": { - "start": { - "line": 2, - "column": 16 - }, - "end": { - "line": 4, - "column": 5 - } - }, + "start":38,"end":70,"loc":{"start":{"line":2,"column":16},"end":{"line":4,"column":5}}, "body": [ { "type": "VariableDeclaration", - "start": 48, - "end": 64, - "loc": { - "start": { - "line": 3, - "column": 8 - }, - "end": { - "line": 3, - "column": 24 - } - }, + "start":48,"end":64,"loc":{"start":{"line":3,"column":8},"end":{"line":3,"column":24}}, "declarations": [ { "type": "VariableDeclarator", - "start": 54, - "end": 63, - "loc": { - "start": { - "line": 3, - "column": 14 - }, - "end": { - "line": 3, - "column": 23 - } - }, + "start":54,"end":63,"loc":{"start":{"line":3,"column":14},"end":{"line":3,"column":23}}, "id": { "type": "Identifier", - "start": 54, - "end": 63, - "loc": { - "start": { - "line": 3, - "column": 14 - }, - "end": { - "line": 3, - "column": 23 - }, - "identifierName": "x" - }, + "start":54,"end":63,"loc":{"start":{"line":3,"column":14},"end":{"line":3,"column":23},"identifierName":"x"}, "name": "x", "typeAnnotation": { "type": "TSTypeAnnotation", - "start": 55, - "end": 63, - "loc": { - "start": { - "line": 3, - "column": 15 - }, - "end": { - "line": 3, - "column": 23 - } - }, + "start":55,"end":63,"loc":{"start":{"line":3,"column":15},"end":{"line":3,"column":23}}, "typeAnnotation": { "type": "TSNumberKeyword", - "start": 57, - "end": 63, - "loc": { - "start": { - "line": 3, - "column": 17 - }, - "end": { - "line": 3, - "column": 23 - } - } + "start":57,"end":63,"loc":{"start":{"line":3,"column":17},"end":{"line":3,"column":23}} } } }, diff --git a/packages/babel-parser/test/fixtures/typescript/module-namespace/body-nested/output.json b/packages/babel-parser/test/fixtures/typescript/module-namespace/body-nested/output.json index 67d5f30c5dbf..0d107dd6726e 100644 --- a/packages/babel-parser/test/fixtures/typescript/module-namespace/body-nested/output.json +++ b/packages/babel-parser/test/fixtures/typescript/module-namespace/body-nested/output.json @@ -1,125 +1,35 @@ { "type": "File", - "start": 0, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "TSModuleDeclaration", - "start": 0, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, "id": { "type": "Identifier", - "start": 10, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "A" - }, + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11},"identifierName":"A"}, "name": "A" }, "body": { "type": "TSModuleBlock", - "start": 12, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 4, - "column": 1 - } - }, + "start":12,"end":39,"loc":{"start":{"line":1,"column":12},"end":{"line":4,"column":1}}, "body": [ { "type": "TSModuleDeclaration", - "start": 18, - "end": 37, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 3, - "column": 5 - } - }, + "start":18,"end":37,"loc":{"start":{"line":2,"column":4},"end":{"line":3,"column":5}}, "id": { "type": "Identifier", - "start": 28, - "end": 29, - "loc": { - "start": { - "line": 2, - "column": 14 - }, - "end": { - "line": 2, - "column": 15 - }, - "identifierName": "B" - }, + "start":28,"end":29,"loc":{"start":{"line":2,"column":14},"end":{"line":2,"column":15},"identifierName":"B"}, "name": "B" }, "body": { "type": "TSModuleBlock", - "start": 30, - "end": 37, - "loc": { - "start": { - "line": 2, - "column": 16 - }, - "end": { - "line": 3, - "column": 5 - } - }, + "start":30,"end":37,"loc":{"start":{"line":2,"column":16},"end":{"line":3,"column":5}}, "body": [] } } diff --git a/packages/babel-parser/test/fixtures/typescript/module-namespace/body/output.json b/packages/babel-parser/test/fixtures/typescript/module-namespace/body/output.json index efae4d5c9247..1bd3f38ff785 100644 --- a/packages/babel-parser/test/fixtures/typescript/module-namespace/body/output.json +++ b/packages/babel-parser/test/fixtures/typescript/module-namespace/body/output.json @@ -1,140 +1,39 @@ { "type": "File", - "start": 0, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "TSModuleDeclaration", - "start": 0, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "id": { "type": "Identifier", - "start": 10, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "N" - }, + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11},"identifierName":"N"}, "name": "N" }, "body": { "type": "TSModuleBlock", - "start": 12, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":12,"end":32,"loc":{"start":{"line":1,"column":12},"end":{"line":3,"column":1}}, "body": [ { "type": "VariableDeclaration", - "start": 18, - "end": 30, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 16 - } - }, + "start":18,"end":30,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":16}}, "declarations": [ { "type": "VariableDeclarator", - "start": 24, - "end": 29, - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 15 - } - }, + "start":24,"end":29,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":15}}, "id": { "type": "Identifier", - "start": 24, - "end": 25, - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 11 - }, - "identifierName": "x" - }, + "start":24,"end":25,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":11},"identifierName":"x"}, "name": "x" }, "init": { "type": "NumericLiteral", - "start": 28, - "end": 29, - "loc": { - "start": { - "line": 2, - "column": 14 - }, - "end": { - "line": 2, - "column": 15 - } - }, + "start":28,"end":29,"loc":{"start":{"line":2,"column":14},"end":{"line":2,"column":15}}, "extra": { "rawValue": 0, "raw": "0" diff --git a/packages/babel-parser/test/fixtures/typescript/module-namespace/declare-shorthand/output.json b/packages/babel-parser/test/fixtures/typescript/module-namespace/declare-shorthand/output.json index 347a92127a0a..24d18495a92f 100644 --- a/packages/babel-parser/test/fixtures/typescript/module-namespace/declare-shorthand/output.json +++ b/packages/babel-parser/test/fixtures/typescript/module-namespace/declare-shorthand/output.json @@ -1,62 +1,18 @@ { "type": "File", - "start": 0, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, "program": { "type": "Program", - "start": 0, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "TSModuleDeclaration", - "start": 0, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, "id": { "type": "StringLiteral", - "start": 15, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":15,"end":18,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":18}}, "extra": { "rawValue": "m", "raw": "\"m\"" diff --git a/packages/babel-parser/test/fixtures/typescript/module-namespace/global-in-module/output.json b/packages/babel-parser/test/fixtures/typescript/module-namespace/global-in-module/output.json index c0f886e67302..74eabed8abd8 100644 --- a/packages/babel-parser/test/fixtures/typescript/module-namespace/global-in-module/output.json +++ b/packages/babel-parser/test/fixtures/typescript/module-namespace/global-in-module/output.json @@ -1,62 +1,18 @@ { "type": "File", - "start": 0, - "end": 64, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 1 - } - }, + "start":0,"end":64,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 64, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 1 - } - }, + "start":0,"end":64,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "TSModuleDeclaration", - "start": 0, - "end": 64, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 1 - } - }, + "start":0,"end":64,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, "id": { "type": "StringLiteral", - "start": 15, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":15,"end":18,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":18}}, "extra": { "rawValue": "m", "raw": "\"m\"" @@ -65,139 +21,38 @@ }, "body": { "type": "TSModuleBlock", - "start": 19, - "end": 64, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 5, - "column": 1 - } - }, + "start":19,"end":64,"loc":{"start":{"line":1,"column":19},"end":{"line":5,"column":1}}, "body": [ { "type": "TSModuleDeclaration", - "start": 25, - "end": 62, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 4, - "column": 5 - } - }, + "start":25,"end":62,"loc":{"start":{"line":2,"column":4},"end":{"line":4,"column":5}}, "global": true, "id": { "type": "Identifier", - "start": 25, - "end": 31, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 10 - }, - "identifierName": "global" - }, + "start":25,"end":31,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":10},"identifierName":"global"}, "name": "global" }, "body": { "type": "TSModuleBlock", - "start": 32, - "end": 62, - "loc": { - "start": { - "line": 2, - "column": 11 - }, - "end": { - "line": 4, - "column": 5 - } - }, + "start":32,"end":62,"loc":{"start":{"line":2,"column":11},"end":{"line":4,"column":5}}, "body": [ { "type": "VariableDeclaration", - "start": 42, - "end": 56, - "loc": { - "start": { - "line": 3, - "column": 8 - }, - "end": { - "line": 3, - "column": 22 - } - }, + "start":42,"end":56,"loc":{"start":{"line":3,"column":8},"end":{"line":3,"column":22}}, "declarations": [ { "type": "VariableDeclarator", - "start": 46, - "end": 55, - "loc": { - "start": { - "line": 3, - "column": 12 - }, - "end": { - "line": 3, - "column": 21 - } - }, + "start":46,"end":55,"loc":{"start":{"line":3,"column":12},"end":{"line":3,"column":21}}, "id": { "type": "Identifier", - "start": 46, - "end": 55, - "loc": { - "start": { - "line": 3, - "column": 12 - }, - "end": { - "line": 3, - "column": 21 - }, - "identifierName": "x" - }, + "start":46,"end":55,"loc":{"start":{"line":3,"column":12},"end":{"line":3,"column":21},"identifierName":"x"}, "name": "x", "typeAnnotation": { "type": "TSTypeAnnotation", - "start": 47, - "end": 55, - "loc": { - "start": { - "line": 3, - "column": 13 - }, - "end": { - "line": 3, - "column": 21 - } - }, + "start":47,"end":55,"loc":{"start":{"line":3,"column":13},"end":{"line":3,"column":21}}, "typeAnnotation": { "type": "TSNumberKeyword", - "start": 49, - "end": 55, - "loc": { - "start": { - "line": 3, - "column": 15 - }, - "end": { - "line": 3, - "column": 21 - } - } + "start":49,"end":55,"loc":{"start":{"line":3,"column":15},"end":{"line":3,"column":21}} } } }, diff --git a/packages/babel-parser/test/fixtures/typescript/module-namespace/head-declare/output.json b/packages/babel-parser/test/fixtures/typescript/module-namespace/head-declare/output.json index 06f90373184b..449aeeac499c 100644 --- a/packages/babel-parser/test/fixtures/typescript/module-namespace/head-declare/output.json +++ b/packages/babel-parser/test/fixtures/typescript/module-namespace/head-declare/output.json @@ -1,110 +1,31 @@ { "type": "File", - "start": 0, - "end": 84, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 17 - } - }, + "start":0,"end":84,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":17}}, "program": { "type": "Program", - "start": 0, - "end": 84, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 17 - } - }, + "start":0,"end":84,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":17}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "TSModuleDeclaration", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "id": { "type": "Identifier", - "start": 18, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - }, - "identifierName": "N" - }, + "start":18,"end":19,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":19},"identifierName":"N"}, "name": "N" }, "body": { "type": "TSModuleDeclaration", - "start": 20, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":20,"end":24,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":24}}, "id": { "type": "Identifier", - "start": 20, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 21 - }, - "identifierName": "M" - }, + "start":20,"end":21,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":21},"identifierName":"M"}, "name": "M" }, "body": { "type": "TSModuleBlock", - "start": 22, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":22,"end":24,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":24}}, "body": [] } }, @@ -112,81 +33,25 @@ }, { "type": "TSModuleDeclaration", - "start": 25, - "end": 44, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 19 - } - }, + "start":25,"end":44,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":19}}, "id": { "type": "Identifier", - "start": 40, - "end": 41, - "loc": { - "start": { - "line": 2, - "column": 15 - }, - "end": { - "line": 2, - "column": 16 - }, - "identifierName": "M" - }, + "start":40,"end":41,"loc":{"start":{"line":2,"column":15},"end":{"line":2,"column":16},"identifierName":"M"}, "name": "M" }, "body": { "type": "TSModuleBlock", - "start": 42, - "end": 44, - "loc": { - "start": { - "line": 2, - "column": 17 - }, - "end": { - "line": 2, - "column": 19 - } - }, + "start":42,"end":44,"loc":{"start":{"line":2,"column":17},"end":{"line":2,"column":19}}, "body": [] }, "declare": true }, { "type": "TSModuleDeclaration", - "start": 45, - "end": 66, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 21 - } - }, + "start":45,"end":66,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":21}}, "id": { "type": "StringLiteral", - "start": 60, - "end": 63, - "loc": { - "start": { - "line": 3, - "column": 15 - }, - "end": { - "line": 3, - "column": 18 - } - }, + "start":60,"end":63,"loc":{"start":{"line":3,"column":15},"end":{"line":3,"column":18}}, "extra": { "rawValue": "m", "raw": "\"m\"" @@ -195,68 +60,23 @@ }, "body": { "type": "TSModuleBlock", - "start": 64, - "end": 66, - "loc": { - "start": { - "line": 3, - "column": 19 - }, - "end": { - "line": 3, - "column": 21 - } - }, + "start":64,"end":66,"loc":{"start":{"line":3,"column":19},"end":{"line":3,"column":21}}, "body": [] }, "declare": true }, { "type": "TSModuleDeclaration", - "start": 67, - "end": 84, - "loc": { - "start": { - "line": 4, - "column": 0 - }, - "end": { - "line": 4, - "column": 17 - } - }, + "start":67,"end":84,"loc":{"start":{"line":4,"column":0},"end":{"line":4,"column":17}}, "global": true, "id": { "type": "Identifier", - "start": 75, - "end": 81, - "loc": { - "start": { - "line": 4, - "column": 8 - }, - "end": { - "line": 4, - "column": 14 - }, - "identifierName": "global" - }, + "start":75,"end":81,"loc":{"start":{"line":4,"column":8},"end":{"line":4,"column":14},"identifierName":"global"}, "name": "global" }, "body": { "type": "TSModuleBlock", - "start": 82, - "end": 84, - "loc": { - "start": { - "line": 4, - "column": 15 - }, - "end": { - "line": 4, - "column": 17 - } - }, + "start":82,"end":84,"loc":{"start":{"line":4,"column":15},"end":{"line":4,"column":17}}, "body": [] }, "declare": true diff --git a/packages/babel-parser/test/fixtures/typescript/module-namespace/head-export/output.json b/packages/babel-parser/test/fixtures/typescript/module-namespace/head-export/output.json index 178571a6d6df..6562e2f3362b 100644 --- a/packages/babel-parser/test/fixtures/typescript/module-namespace/head-export/output.json +++ b/packages/babel-parser/test/fixtures/typescript/module-namespace/head-export/output.json @@ -1,126 +1,37 @@ { "type": "File", - "start": 0, - "end": 42, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 18 - } - }, + "start":0,"end":42,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":18}}, "program": { "type": "Program", - "start": 0, - "end": 42, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 18 - } - }, + "start":0,"end":42,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":18}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExportNamedDeclaration", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, + "exportKind": "value", "specifiers": [], "source": null, "declaration": { "type": "TSModuleDeclaration", - "start": 7, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":7,"end":23,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":23}}, "id": { "type": "Identifier", - "start": 17, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - }, - "identifierName": "X" - }, + "start":17,"end":18,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":18},"identifierName":"X"}, "name": "X" }, "body": { "type": "TSModuleDeclaration", - "start": 19, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":19,"end":23,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":23}}, "id": { "type": "Identifier", - "start": 19, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 20 - }, - "identifierName": "Y" - }, + "start":19,"end":20,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":20},"identifierName":"Y"}, "name": "Y" }, "body": { "type": "TSModuleBlock", - "start": 21, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":21,"end":23,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":23}}, "body": [] } } @@ -128,65 +39,21 @@ }, { "type": "ExportNamedDeclaration", - "start": 24, - "end": 42, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 18 - } - }, + "start":24,"end":42,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":18}}, + "exportKind": "value", "specifiers": [], "source": null, "declaration": { "type": "TSModuleDeclaration", - "start": 31, - "end": 42, - "loc": { - "start": { - "line": 2, - "column": 7 - }, - "end": { - "line": 2, - "column": 18 - } - }, + "start":31,"end":42,"loc":{"start":{"line":2,"column":7},"end":{"line":2,"column":18}}, "id": { "type": "Identifier", - "start": 38, - "end": 39, - "loc": { - "start": { - "line": 2, - "column": 14 - }, - "end": { - "line": 2, - "column": 15 - }, - "identifierName": "X" - }, + "start":38,"end":39,"loc":{"start":{"line":2,"column":14},"end":{"line":2,"column":15},"identifierName":"X"}, "name": "X" }, "body": { "type": "TSModuleBlock", - "start": 40, - "end": 42, - "loc": { - "start": { - "line": 2, - "column": 16 - }, - "end": { - "line": 2, - "column": 18 - } - }, + "start":40,"end":42,"loc":{"start":{"line":2,"column":16},"end":{"line":2,"column":18}}, "body": [] } } diff --git a/packages/babel-parser/test/fixtures/typescript/module-namespace/head/output.json b/packages/babel-parser/test/fixtures/typescript/module-namespace/head/output.json index 6c3609f59ea4..57fe9bd33cc2 100644 --- a/packages/babel-parser/test/fixtures/typescript/module-namespace/head/output.json +++ b/packages/babel-parser/test/fixtures/typescript/module-namespace/head/output.json @@ -1,189 +1,53 @@ { "type": "File", - "start": 0, - "end": 59, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 13 - } - }, + "start":0,"end":59,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":13}}, "program": { "type": "Program", - "start": 0, - "end": 59, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 13 - } - }, + "start":0,"end":59,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":13}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "TSModuleDeclaration", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "id": { "type": "Identifier", - "start": 10, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "N" - }, + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11},"identifierName":"N"}, "name": "N" }, "body": { "type": "TSModuleBlock", - "start": 12, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":12,"end":14,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":14}}, "body": [] } }, { "type": "TSModuleDeclaration", - "start": 15, - "end": 33, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 18 - } - }, + "start":15,"end":33,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":18}}, "id": { "type": "Identifier", - "start": 25, - "end": 26, - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 11 - }, - "identifierName": "M" - }, + "start":25,"end":26,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":11},"identifierName":"M"}, "name": "M" }, "body": { "type": "TSModuleDeclaration", - "start": 27, - "end": 33, - "loc": { - "start": { - "line": 2, - "column": 12 - }, - "end": { - "line": 2, - "column": 18 - } - }, + "start":27,"end":33,"loc":{"start":{"line":2,"column":12},"end":{"line":2,"column":18}}, "id": { "type": "Identifier", - "start": 27, - "end": 28, - "loc": { - "start": { - "line": 2, - "column": 12 - }, - "end": { - "line": 2, - "column": 13 - }, - "identifierName": "N" - }, + "start":27,"end":28,"loc":{"start":{"line":2,"column":12},"end":{"line":2,"column":13},"identifierName":"N"}, "name": "N" }, "body": { "type": "TSModuleDeclaration", - "start": 29, - "end": 33, - "loc": { - "start": { - "line": 2, - "column": 14 - }, - "end": { - "line": 2, - "column": 18 - } - }, + "start":29,"end":33,"loc":{"start":{"line":2,"column":14},"end":{"line":2,"column":18}}, "id": { "type": "Identifier", - "start": 29, - "end": 30, - "loc": { - "start": { - "line": 2, - "column": 14 - }, - "end": { - "line": 2, - "column": 15 - }, - "identifierName": "O" - }, + "start":29,"end":30,"loc":{"start":{"line":2,"column":14},"end":{"line":2,"column":15},"identifierName":"O"}, "name": "O" }, "body": { "type": "TSModuleBlock", - "start": 31, - "end": 33, - "loc": { - "start": { - "line": 2, - "column": 16 - }, - "end": { - "line": 2, - "column": 18 - } - }, + "start":31,"end":33,"loc":{"start":{"line":2,"column":16},"end":{"line":2,"column":18}}, "body": [] } } @@ -191,80 +55,24 @@ }, { "type": "TSModuleDeclaration", - "start": 34, - "end": 45, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 11 - } - }, + "start":34,"end":45,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":11}}, "id": { "type": "Identifier", - "start": 41, - "end": 42, - "loc": { - "start": { - "line": 3, - "column": 7 - }, - "end": { - "line": 3, - "column": 8 - }, - "identifierName": "M" - }, + "start":41,"end":42,"loc":{"start":{"line":3,"column":7},"end":{"line":3,"column":8},"identifierName":"M"}, "name": "M" }, "body": { "type": "TSModuleBlock", - "start": 43, - "end": 45, - "loc": { - "start": { - "line": 3, - "column": 9 - }, - "end": { - "line": 3, - "column": 11 - } - }, + "start":43,"end":45,"loc":{"start":{"line":3,"column":9},"end":{"line":3,"column":11}}, "body": [] } }, { "type": "TSModuleDeclaration", - "start": 46, - "end": 59, - "loc": { - "start": { - "line": 4, - "column": 0 - }, - "end": { - "line": 4, - "column": 13 - } - }, + "start":46,"end":59,"loc":{"start":{"line":4,"column":0},"end":{"line":4,"column":13}}, "id": { "type": "StringLiteral", - "start": 53, - "end": 56, - "loc": { - "start": { - "line": 4, - "column": 7 - }, - "end": { - "line": 4, - "column": 10 - } - }, + "start":53,"end":56,"loc":{"start":{"line":4,"column":7},"end":{"line":4,"column":10}}, "extra": { "rawValue": "m", "raw": "\"m\"" @@ -273,18 +81,7 @@ }, "body": { "type": "TSModuleBlock", - "start": 57, - "end": 59, - "loc": { - "start": { - "line": 4, - "column": 11 - }, - "end": { - "line": 4, - "column": 13 - } - }, + "start":57,"end":59,"loc":{"start":{"line":4,"column":11},"end":{"line":4,"column":13}}, "body": [] } } diff --git a/packages/babel-parser/test/fixtures/typescript/module-namespace/module-new-line/output.json b/packages/babel-parser/test/fixtures/typescript/module-namespace/module-new-line/output.json index bee3b058a55a..172c4f667538 100644 --- a/packages/babel-parser/test/fixtures/typescript/module-namespace/module-new-line/output.json +++ b/packages/babel-parser/test/fixtures/typescript/module-namespace/module-new-line/output.json @@ -1,112 +1,33 @@ { "type": "File", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 2 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":2}}, "program": { "type": "Program", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 2 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":2}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "expression": { "type": "Identifier", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "module" - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6},"identifierName":"module"}, "name": "module" } }, { "type": "ExpressionStatement", - "start": 7, - "end": 10, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 3 - } - }, + "start":7,"end":10,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":3}}, "expression": { "type": "Identifier", - "start": 7, - "end": 10, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 3 - }, - "identifierName": "Foo" - }, + "start":7,"end":10,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":3},"identifierName":"Foo"}, "name": "Foo" } }, { "type": "BlockStatement", - "start": 11, - "end": 13, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 2 - } - }, + "start":11,"end":13,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":2}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/typescript/module-namespace/namespace-new-line/output.json b/packages/babel-parser/test/fixtures/typescript/module-namespace/namespace-new-line/output.json index eadadded2851..69d543dc898b 100644 --- a/packages/babel-parser/test/fixtures/typescript/module-namespace/namespace-new-line/output.json +++ b/packages/babel-parser/test/fixtures/typescript/module-namespace/namespace-new-line/output.json @@ -1,112 +1,33 @@ { "type": "File", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 2 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":2}}, "program": { "type": "Program", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 2 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":2}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "expression": { "type": "Identifier", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "namespace" - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9},"identifierName":"namespace"}, "name": "namespace" } }, { "type": "ExpressionStatement", - "start": 10, - "end": 13, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 3 - } - }, + "start":10,"end":13,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":3}}, "expression": { "type": "Identifier", - "start": 10, - "end": 13, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 3 - }, - "identifierName": "Foo" - }, + "start":10,"end":13,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":3},"identifierName":"Foo"}, "name": "Foo" } }, { "type": "BlockStatement", - "start": 14, - "end": 16, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 2 - } - }, + "start":14,"end":16,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":2}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/typescript/module-namespace/top-level-await/input.ts b/packages/babel-parser/test/fixtures/typescript/module-namespace/top-level-await/input.ts new file mode 100644 index 000000000000..9302309c5933 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/module-namespace/top-level-await/input.ts @@ -0,0 +1,3 @@ +namespace N { + const x = await 42; +} diff --git a/packages/babel-parser/test/fixtures/typescript/module-namespace/top-level-await/options.json b/packages/babel-parser/test/fixtures/typescript/module-namespace/top-level-await/options.json new file mode 100644 index 000000000000..ba579946562a --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/module-namespace/top-level-await/options.json @@ -0,0 +1,8 @@ +{ + "sourceType": "module", + "plugins": [ + "typescript", + "topLevelAwait" + ], + "throws": "Unexpected token, expected \";\" (2:20)" +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/optional-chaining/type-arguments/input.ts b/packages/babel-parser/test/fixtures/typescript/optional-chaining/type-arguments/input.ts new file mode 100644 index 000000000000..731a05f63b36 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/optional-chaining/type-arguments/input.ts @@ -0,0 +1 @@ +example.inner?.greet() diff --git a/packages/babel-parser/test/fixtures/typescript/optional-chaining/type-arguments/options.json b/packages/babel-parser/test/fixtures/typescript/optional-chaining/type-arguments/options.json new file mode 100644 index 000000000000..fe9bffaa5e1a --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/optional-chaining/type-arguments/options.json @@ -0,0 +1,4 @@ +{ + "sourceType": "module", + "plugins": ["typescript"] +} diff --git a/packages/babel-parser/test/fixtures/typescript/optional-chaining/type-arguments/output.json b/packages/babel-parser/test/fixtures/typescript/optional-chaining/type-arguments/output.json new file mode 100644 index 000000000000..0a92626ffd24 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/optional-chaining/type-arguments/output.json @@ -0,0 +1,58 @@ +{ + "type": "File", + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, + "program": { + "type": "Program", + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, + "expression": { + "type": "OptionalCallExpression", + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, + "callee": { + "type": "OptionalMemberExpression", + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, + "object": { + "type": "MemberExpression", + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "object": { + "type": "Identifier", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7},"identifierName":"example"}, + "name": "example" + }, + "property": { + "type": "Identifier", + "start":8,"end":13,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":13},"identifierName":"inner"}, + "name": "inner" + }, + "computed": false + }, + "property": { + "type": "Identifier", + "start":15,"end":20,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":20},"identifierName":"greet"}, + "name": "greet" + }, + "computed": false, + "optional": true + }, + "arguments": [], + "typeParameters": { + "type": "TSTypeParameterInstantiation", + "start":20,"end":28,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":28}}, + "params": [ + { + "type": "TSStringKeyword", + "start":21,"end":27,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":27}} + } + ] + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/regression/async-arrow-generic-9560/output.json b/packages/babel-parser/test/fixtures/typescript/regression/async-arrow-generic-9560/output.json index 8cbb94861b92..967a411d65cf 100644 --- a/packages/babel-parser/test/fixtures/typescript/regression/async-arrow-generic-9560/output.json +++ b/packages/babel-parser/test/fixtures/typescript/regression/async-arrow-generic-9560/output.json @@ -1,157 +1,45 @@ { "type": "File", - "start": 0, - "end": 80, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 8, - "column": 1 - } - }, + "start":0,"end":80,"loc":{"start":{"line":1,"column":0},"end":{"line":8,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 80, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 8, - "column": 1 - } - }, + "start":0,"end":80,"loc":{"start":{"line":1,"column":0},"end":{"line":8,"column":1}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 80, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 8, - "column": 1 - } - }, + "start":0,"end":80,"loc":{"start":{"line":1,"column":0},"end":{"line":8,"column":1}}, "id": { "type": "Identifier", - "start": 6, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 8 - }, - "identifierName": "Cl" - }, + "start":6,"end":8,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":8},"identifierName":"Cl"}, "name": "Cl" }, "superClass": null, "body": { "type": "ClassBody", - "start": 9, - "end": 80, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 8, - "column": 1 - } - }, + "start":9,"end":80,"loc":{"start":{"line":1,"column":9},"end":{"line":8,"column":1}}, "body": [ { "type": "ClassProperty", - "start": 13, - "end": 50, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 4, - "column": 4 - } - }, + "start":13,"end":50,"loc":{"start":{"line":2,"column":2},"end":{"line":4,"column":4}}, "static": false, "key": { "type": "Identifier", - "start": 13, - "end": 14, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 3 - }, - "identifierName": "a" - }, + "start":13,"end":14,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":3},"identifierName":"a"}, "name": "a" }, "computed": false, "value": { "type": "ArrowFunctionExpression", - "start": 17, - "end": 49, - "loc": { - "start": { - "line": 2, - "column": 6 - }, - "end": { - "line": 4, - "column": 3 - } - }, + "start":17,"end":49,"loc":{"start":{"line":2,"column":6},"end":{"line":4,"column":3}}, "typeParameters": { "type": "TSTypeParameterDeclaration", - "start": 22, - "end": 25, - "loc": { - "start": { - "line": 2, - "column": 11 - }, - "end": { - "line": 2, - "column": 14 - } - }, + "start":22,"end":25,"loc":{"start":{"line":2,"column":11},"end":{"line":2,"column":14}}, "params": [ { "type": "TSTypeParameter", - "start": 23, - "end": 24, - "loc": { - "start": { - "line": 2, - "column": 12 - }, - "end": { - "line": 2, - "column": 13 - } - }, + "start":23,"end":24,"loc":{"start":{"line":2,"column":12},"end":{"line":2,"column":13}}, "name": "T" } ] @@ -162,61 +50,17 @@ "async": true, "body": { "type": "BlockStatement", - "start": 31, - "end": 49, - "loc": { - "start": { - "line": 2, - "column": 20 - }, - "end": { - "line": 4, - "column": 3 - } - }, + "start":31,"end":49,"loc":{"start":{"line":2,"column":20},"end":{"line":4,"column":3}}, "body": [ { "type": "ExpressionStatement", - "start": 37, - "end": 45, - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 12 - } - }, + "start":37,"end":45,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":12}}, "expression": { "type": "AwaitExpression", - "start": 37, - "end": 44, - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 11 - } - }, + "start":37,"end":44,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":11}}, "argument": { "type": "NumericLiteral", - "start": 43, - "end": 44, - "loc": { - "start": { - "line": 3, - "column": 10 - }, - "end": { - "line": 3, - "column": 11 - } - }, + "start":43,"end":44,"loc":{"start":{"line":3,"column":10},"end":{"line":3,"column":11}}, "extra": { "rawValue": 0, "raw": "0" @@ -232,80 +76,24 @@ }, { "type": "ClassProperty", - "start": 54, - "end": 78, - "loc": { - "start": { - "line": 6, - "column": 2 - }, - "end": { - "line": 7, - "column": 4 - } - }, + "start":54,"end":78,"loc":{"start":{"line":6,"column":2},"end":{"line":7,"column":4}}, "static": false, "key": { "type": "Identifier", - "start": 54, - "end": 55, - "loc": { - "start": { - "line": 6, - "column": 2 - }, - "end": { - "line": 6, - "column": 3 - }, - "identifierName": "b" - }, + "start":54,"end":55,"loc":{"start":{"line":6,"column":2},"end":{"line":6,"column":3},"identifierName":"b"}, "name": "b" }, "computed": false, "value": { "type": "ArrowFunctionExpression", - "start": 58, - "end": 77, - "loc": { - "start": { - "line": 6, - "column": 6 - }, - "end": { - "line": 7, - "column": 3 - } - }, + "start":58,"end":77,"loc":{"start":{"line":6,"column":6},"end":{"line":7,"column":3}}, "typeParameters": { "type": "TSTypeParameterDeclaration", - "start": 63, - "end": 66, - "loc": { - "start": { - "line": 6, - "column": 11 - }, - "end": { - "line": 6, - "column": 14 - } - }, + "start":63,"end":66,"loc":{"start":{"line":6,"column":11},"end":{"line":6,"column":14}}, "params": [ { "type": "TSTypeParameter", - "start": 64, - "end": 65, - "loc": { - "start": { - "line": 6, - "column": 12 - }, - "end": { - "line": 6, - "column": 13 - } - }, + "start":64,"end":65,"loc":{"start":{"line":6,"column":12},"end":{"line":6,"column":13}}, "name": "T" } ] @@ -316,18 +104,7 @@ "async": true, "body": { "type": "BlockStatement", - "start": 72, - "end": 77, - "loc": { - "start": { - "line": 6, - "column": 20 - }, - "end": { - "line": 7, - "column": 3 - } - }, + "start":72,"end":77,"loc":{"start":{"line":6,"column":20},"end":{"line":7,"column":3}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/typescript/regression/comments-disappearing/output.json b/packages/babel-parser/test/fixtures/typescript/regression/comments-disappearing/output.json index 29dfe9b55540..63473abe7889 100644 --- a/packages/babel-parser/test/fixtures/typescript/regression/comments-disappearing/output.json +++ b/packages/babel-parser/test/fixtures/typescript/regression/comments-disappearing/output.json @@ -1,141 +1,41 @@ { "type": "File", - "start": 0, - "end": 70, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 6, - "column": 1 - } - }, + "start":0,"end":70,"loc":{"start":{"line":1,"column":0},"end":{"line":6,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 70, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 6, - "column": 1 - } - }, + "start":0,"end":70,"loc":{"start":{"line":1,"column":0},"end":{"line":6,"column":1}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 70, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 6, - "column": 1 - } - }, + "start":0,"end":70,"loc":{"start":{"line":1,"column":0},"end":{"line":6,"column":1}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 70, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 6, - "column": 1 - } - }, + "start":4,"end":70,"loc":{"start":{"line":1,"column":4},"end":{"line":6,"column":1}}, "id": { "type": "Identifier", - "start": 4, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "fun" - }, + "start":4,"end":7,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":7},"identifierName":"fun"}, "name": "fun" }, "init": { "type": "ArrowFunctionExpression", - "start": 10, - "end": 70, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 6, - "column": 1 - } - }, + "start":10,"end":70,"loc":{"start":{"line":1,"column":10},"end":{"line":6,"column":1}}, "id": null, "generator": false, "async": false, "params": [], "body": { "type": "BlockStatement", - "start": 16, - "end": 70, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 6, - "column": 1 - } - }, + "start":16,"end":70,"loc":{"start":{"line":1,"column":16},"end":{"line":6,"column":1}}, "body": [ { "type": "ReturnStatement", - "start": 57, - "end": 68, - "loc": { - "start": { - "line": 5, - "column": 4 - }, - "end": { - "line": 5, - "column": 15 - } - }, + "start":57,"end":68,"loc":{"start":{"line":5,"column":4},"end":{"line":5,"column":15}}, "argument": { "type": "NumericLiteral", - "start": 65, - "end": 66, - "loc": { - "start": { - "line": 5, - "column": 12 - }, - "end": { - "line": 5, - "column": 13 - } - }, + "start":65,"end":66,"loc":{"start":{"line":5,"column":12},"end":{"line":5,"column":13}}, "extra": { "rawValue": 1, "raw": "1", @@ -148,50 +48,17 @@ { "type": "CommentLine", "value": " one", - "start": 22, - "end": 28, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 10 - } - } + "start":22,"end":28,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":10}} }, { "type": "CommentLine", "value": " two", - "start": 33, - "end": 39, - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 10 - } - } + "start":33,"end":39,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":10}} }, { "type": "CommentLine", "value": " three", - "start": 44, - "end": 52, - "loc": { - "start": { - "line": 4, - "column": 4 - }, - "end": { - "line": 4, - "column": 12 - } - } + "start":44,"end":52,"loc":{"start":{"line":4,"column":4},"end":{"line":4,"column":12}} } ] } @@ -210,50 +77,17 @@ { "type": "CommentLine", "value": " one", - "start": 22, - "end": 28, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 10 - } - } + "start":22,"end":28,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":10}} }, { "type": "CommentLine", "value": " two", - "start": 33, - "end": 39, - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 10 - } - } + "start":33,"end":39,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":10}} }, { "type": "CommentLine", "value": " three", - "start": 44, - "end": 52, - "loc": { - "start": { - "line": 4, - "column": 4 - }, - "end": { - "line": 4, - "column": 12 - } - } + "start":44,"end":52,"loc":{"start":{"line":4,"column":4},"end":{"line":4,"column":12}} } ] } \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/regression/destructuring-in-function-type/output.json b/packages/babel-parser/test/fixtures/typescript/regression/destructuring-in-function-type/output.json index 38916a842653..c7a987bc3fd2 100644 --- a/packages/babel-parser/test/fixtures/typescript/regression/destructuring-in-function-type/output.json +++ b/packages/babel-parser/test/fixtures/typescript/regression/destructuring-in-function-type/output.json @@ -1,144 +1,42 @@ { "type": "File", - "start": 0, - "end": 75, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 36 - } - }, + "start":0,"end":75,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":36}}, "program": { "type": "Program", - "start": 0, - "end": 75, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 36 - } - }, + "start":0,"end":75,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":36}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "TSTypeAliasDeclaration", - "start": 0, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 37 - } - }, + "start":0,"end":37,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":37}}, "id": { "type": "Identifier", - "start": 5, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "MyType" - }, + "start":5,"end":11,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":11},"identifierName":"MyType"}, "name": "MyType" }, "typeAnnotation": { "type": "TSFunctionType", - "start": 14, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 37 - } - }, + "start":14,"end":37,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":37}}, "parameters": [ { "type": "ObjectPattern", - "start": 15, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":15,"end":29,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":29}}, "properties": [ { "type": "ObjectProperty", - "start": 17, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":17,"end":22,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":22}}, "method": false, "key": { "type": "Identifier", - "start": 17, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 22 - }, - "identifierName": "theme" - }, + "start":17,"end":22,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":22},"identifierName":"theme"}, "name": "theme" }, "computed": false, "shorthand": true, "value": { "type": "Identifier", - "start": 17, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 22 - }, - "identifierName": "theme" - }, + "start":17,"end":22,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":22},"identifierName":"theme"}, "name": "theme" }, "extra": { @@ -148,207 +46,62 @@ ], "typeAnnotation": { "type": "TSTypeAnnotation", - "start": 24, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":24,"end":29,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":29}}, "typeAnnotation": { "type": "TSAnyKeyword", - "start": 26, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 29 - } - } + "start":26,"end":29,"loc":{"start":{"line":1,"column":26},"end":{"line":1,"column":29}} } } } ], "typeAnnotation": { "type": "TSTypeAnnotation", - "start": 31, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 31 - }, - "end": { - "line": 1, - "column": 37 - } - }, + "start":31,"end":37,"loc":{"start":{"line":1,"column":31},"end":{"line":1,"column":37}}, "typeAnnotation": { "type": "TSAnyKeyword", - "start": 34, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 34 - }, - "end": { - "line": 1, - "column": 37 - } - } + "start":34,"end":37,"loc":{"start":{"line":1,"column":34},"end":{"line":1,"column":37}} } } } }, { "type": "TSTypeAliasDeclaration", - "start": 39, - "end": 75, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 36 - } - }, + "start":39,"end":75,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":36}}, "id": { "type": "Identifier", - "start": 44, - "end": 55, - "loc": { - "start": { - "line": 3, - "column": 5 - }, - "end": { - "line": 3, - "column": 16 - }, - "identifierName": "AnotherType" - }, + "start":44,"end":55,"loc":{"start":{"line":3,"column":5},"end":{"line":3,"column":16},"identifierName":"AnotherType"}, "name": "AnotherType" }, "typeAnnotation": { "type": "TSFunctionType", - "start": 58, - "end": 75, - "loc": { - "start": { - "line": 3, - "column": 19 - }, - "end": { - "line": 3, - "column": 36 - } - }, + "start":58,"end":75,"loc":{"start":{"line":3,"column":19},"end":{"line":3,"column":36}}, "parameters": [ { "type": "ArrayPattern", - "start": 59, - "end": 67, - "loc": { - "start": { - "line": 3, - "column": 20 - }, - "end": { - "line": 3, - "column": 28 - } - }, + "start":59,"end":67,"loc":{"start":{"line":3,"column":20},"end":{"line":3,"column":28}}, "elements": [ { "type": "Identifier", - "start": 60, - "end": 61, - "loc": { - "start": { - "line": 3, - "column": 21 - }, - "end": { - "line": 3, - "column": 22 - }, - "identifierName": "a" - }, + "start":60,"end":61,"loc":{"start":{"line":3,"column":21},"end":{"line":3,"column":22},"identifierName":"a"}, "name": "a" } ], "typeAnnotation": { "type": "TSTypeAnnotation", - "start": 62, - "end": 67, - "loc": { - "start": { - "line": 3, - "column": 23 - }, - "end": { - "line": 3, - "column": 28 - } - }, + "start":62,"end":67,"loc":{"start":{"line":3,"column":23},"end":{"line":3,"column":28}}, "typeAnnotation": { "type": "TSAnyKeyword", - "start": 64, - "end": 67, - "loc": { - "start": { - "line": 3, - "column": 25 - }, - "end": { - "line": 3, - "column": 28 - } - } + "start":64,"end":67,"loc":{"start":{"line":3,"column":25},"end":{"line":3,"column":28}} } } } ], "typeAnnotation": { "type": "TSTypeAnnotation", - "start": 69, - "end": 75, - "loc": { - "start": { - "line": 3, - "column": 30 - }, - "end": { - "line": 3, - "column": 36 - } - }, + "start":69,"end":75,"loc":{"start":{"line":3,"column":30},"end":{"line":3,"column":36}}, "typeAnnotation": { "type": "TSAnyKeyword", - "start": 72, - "end": 75, - "loc": { - "start": { - "line": 3, - "column": 33 - }, - "end": { - "line": 3, - "column": 36 - } - } + "start":72,"end":75,"loc":{"start":{"line":3,"column":33},"end":{"line":3,"column":36}} } } } diff --git a/packages/babel-parser/test/fixtures/typescript/regression/is-default-export/output.json b/packages/babel-parser/test/fixtures/typescript/regression/is-default-export/output.json index 406eee594b58..f8b77aefebaa 100644 --- a/packages/babel-parser/test/fixtures/typescript/regression/is-default-export/output.json +++ b/packages/babel-parser/test/fixtures/typescript/regression/is-default-export/output.json @@ -1,143 +1,44 @@ { "type": "File", - "start": 0, - "end": 62, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 21 - } - }, + "start":0,"end":62,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":21}}, "program": { "type": "Program", - "start": 0, - "end": 62, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 21 - } - }, + "start":0,"end":62,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":21}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExportNamedDeclaration", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, + "exportKind": "type", "specifiers": [], "source": null, "declaration": { "type": "TSTypeAliasDeclaration", - "start": 7, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":7,"end":23,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":23}}, "id": { "type": "Identifier", - "start": 12, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - }, - "identifierName": "T" - }, + "start":12,"end":13,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":13},"identifierName":"T"}, "name": "T" }, "typeAnnotation": { "type": "TSNumberKeyword", - "start": 16, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 22 - } - } + "start":16,"end":22,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":22}} } } }, { "type": "ExportNamedDeclaration", - "start": 24, - "end": 40, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 16 - } - }, + "start":24,"end":40,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":16}}, + "exportKind": "value", "specifiers": [], "source": null, "declaration": { "type": "TSEnumDeclaration", - "start": 31, - "end": 40, - "loc": { - "start": { - "line": 2, - "column": 7 - }, - "end": { - "line": 2, - "column": 16 - } - }, + "start":31,"end":40,"loc":{"start":{"line":2,"column":7},"end":{"line":2,"column":16}}, "id": { "type": "Identifier", - "start": 36, - "end": 37, - "loc": { - "start": { - "line": 2, - "column": 12 - }, - "end": { - "line": 2, - "column": 13 - }, - "identifierName": "E" - }, + "start":36,"end":37,"loc":{"start":{"line":2,"column":12},"end":{"line":2,"column":13},"identifierName":"E"}, "name": "E" }, "members": [] @@ -145,65 +46,21 @@ }, { "type": "ExportNamedDeclaration", - "start": 41, - "end": 62, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 21 - } - }, + "start":41,"end":62,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":21}}, + "exportKind": "type", "specifiers": [], "source": null, "declaration": { "type": "TSInterfaceDeclaration", - "start": 48, - "end": 62, - "loc": { - "start": { - "line": 3, - "column": 7 - }, - "end": { - "line": 3, - "column": 21 - } - }, + "start":48,"end":62,"loc":{"start":{"line":3,"column":7},"end":{"line":3,"column":21}}, "id": { "type": "Identifier", - "start": 58, - "end": 59, - "loc": { - "start": { - "line": 3, - "column": 17 - }, - "end": { - "line": 3, - "column": 18 - }, - "identifierName": "I" - }, + "start":58,"end":59,"loc":{"start":{"line":3,"column":17},"end":{"line":3,"column":18},"identifierName":"I"}, "name": "I" }, "body": { "type": "TSInterfaceBody", - "start": 60, - "end": 62, - "loc": { - "start": { - "line": 3, - "column": 19 - }, - "end": { - "line": 3, - "column": 21 - } - }, + "start":60,"end":62,"loc":{"start":{"line":3,"column":19},"end":{"line":3,"column":21}}, "body": [] } } diff --git a/packages/babel-parser/test/fixtures/typescript/regression/issue-7742/output.json b/packages/babel-parser/test/fixtures/typescript/regression/issue-7742/output.json index ad154a88fd59..dee491112796 100644 --- a/packages/babel-parser/test/fixtures/typescript/regression/issue-7742/output.json +++ b/packages/babel-parser/test/fixtures/typescript/regression/issue-7742/output.json @@ -1,156 +1,45 @@ { "type": "File", - "start": 0, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":40,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":40,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "TSInterfaceDeclaration", - "start": 0, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":40,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "id": { "type": "Identifier", - "start": 10, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 13 - }, - "identifierName": "Foo" - }, + "start":10,"end":13,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":13},"identifierName":"Foo"}, "name": "Foo" }, "typeParameters": { "type": "TSTypeParameterDeclaration", - "start": 13, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":13,"end":16,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":16}}, "params": [ { "type": "TSTypeParameter", - "start": 14, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":14,"end":15,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":15}}, "name": "G" } ] }, "body": { "type": "TSInterfaceBody", - "start": 17, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":17,"end":40,"loc":{"start":{"line":1,"column":17},"end":{"line":3,"column":1}}, "body": [ { "type": "TSCallSignatureDeclaration", - "start": 23, - "end": 38, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 19 - } - }, + "start":23,"end":38,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":19}}, "typeParameters": { "type": "TSTypeParameterDeclaration", - "start": 23, - "end": 26, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 7 - } - }, + "start":23,"end":26,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":7}}, "params": [ { "type": "TSTypeParameter", - "start": 24, - "end": 25, - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 6 - } - }, + "start":24,"end":25,"loc":{"start":{"line":2,"column":5},"end":{"line":2,"column":6}}, "name": "T" } ] @@ -158,63 +47,17 @@ "parameters": [ { "type": "Identifier", - "start": 27, - "end": 33, - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 14 - }, - "identifierName": "bar" - }, + "start":27,"end":33,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":14},"identifierName":"bar"}, "name": "bar", "typeAnnotation": { "type": "TSTypeAnnotation", - "start": 30, - "end": 33, - "loc": { - "start": { - "line": 2, - "column": 11 - }, - "end": { - "line": 2, - "column": 14 - } - }, + "start":30,"end":33,"loc":{"start":{"line":2,"column":11},"end":{"line":2,"column":14}}, "typeAnnotation": { "type": "TSTypeReference", - "start": 32, - "end": 33, - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 14 - } - }, + "start":32,"end":33,"loc":{"start":{"line":2,"column":13},"end":{"line":2,"column":14}}, "typeName": { "type": "Identifier", - "start": 32, - "end": 33, - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 14 - }, - "identifierName": "G" - }, + "start":32,"end":33,"loc":{"start":{"line":2,"column":13},"end":{"line":2,"column":14},"identifierName":"G"}, "name": "G" } } @@ -223,47 +66,13 @@ ], "typeAnnotation": { "type": "TSTypeAnnotation", - "start": 34, - "end": 37, - "loc": { - "start": { - "line": 2, - "column": 15 - }, - "end": { - "line": 2, - "column": 18 - } - }, + "start":34,"end":37,"loc":{"start":{"line":2,"column":15},"end":{"line":2,"column":18}}, "typeAnnotation": { "type": "TSTypeReference", - "start": 36, - "end": 37, - "loc": { - "start": { - "line": 2, - "column": 17 - }, - "end": { - "line": 2, - "column": 18 - } - }, + "start":36,"end":37,"loc":{"start":{"line":2,"column":17},"end":{"line":2,"column":18}}, "typeName": { "type": "Identifier", - "start": 36, - "end": 37, - "loc": { - "start": { - "line": 2, - "column": 17 - }, - "end": { - "line": 2, - "column": 18 - }, - "identifierName": "T" - }, + "start":36,"end":37,"loc":{"start":{"line":2,"column":17},"end":{"line":2,"column":18},"identifierName":"T"}, "name": "T" } } diff --git a/packages/babel-parser/test/fixtures/typescript/regression/less-than-edge-case/output.json b/packages/babel-parser/test/fixtures/typescript/regression/less-than-edge-case/output.json index d11131105469..ed163c699405 100644 --- a/packages/babel-parser/test/fixtures/typescript/regression/less-than-edge-case/output.json +++ b/packages/babel-parser/test/fixtures/typescript/regression/less-than-edge-case/output.json @@ -1,108 +1,30 @@ { "type": "File", - "start": 0, - "end": 58, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":58,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "program": { "type": "Program", - "start": 0, - "end": 58, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":58,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ForStatement", - "start": 0, - "end": 58, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":0,"end":58,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "init": { "type": "VariableDeclaration", - "start": 5, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":5,"end":14,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":14}}, "declarations": [ { "type": "VariableDeclarator", - "start": 9, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":9,"end":14,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":14}}, "id": { "type": "Identifier", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - }, - "identifierName": "i" - }, + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"i"}, "name": "i" }, "init": { "type": "NumericLiteral", - "start": 13, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":13,"end":14,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":14}}, "extra": { "rawValue": 0, "raw": "0" @@ -115,96 +37,28 @@ }, "test": { "type": "BinaryExpression", - "start": 16, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":16,"end":38,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":38}}, "left": { "type": "Identifier", - "start": 16, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - }, - "identifierName": "i" - }, + "start":16,"end":17,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":17},"identifierName":"i"}, "name": "i" }, "operator": "<", "right": { "type": "MemberExpression", - "start": 20, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":20,"end":38,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":38}}, "object": { "type": "CallExpression", - "start": 20, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 34 - } - }, + "start":20,"end":34,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":34}}, "callee": { "type": "Identifier", - "start": 20, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 27 - }, - "identifierName": "require" - }, + "start":20,"end":27,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":27},"identifierName":"require"}, "name": "require" }, "arguments": [ { "type": "StringLiteral", - "start": 28, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 33 - } - }, + "start":28,"end":33,"loc":{"start":{"line":1,"column":28},"end":{"line":1,"column":33}}, "extra": { "rawValue": "foo", "raw": "'foo'" @@ -215,19 +69,7 @@ }, "property": { "type": "Identifier", - "start": 35, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 35 - }, - "end": { - "line": 1, - "column": 38 - }, - "identifierName": "bar" - }, + "start":35,"end":38,"loc":{"start":{"line":1,"column":35},"end":{"line":1,"column":38},"identifierName":"bar"}, "name": "bar" }, "computed": false @@ -235,114 +77,34 @@ }, "update": { "type": "UpdateExpression", - "start": 40, - "end": 43, - "loc": { - "start": { - "line": 1, - "column": 40 - }, - "end": { - "line": 1, - "column": 43 - } - }, + "start":40,"end":43,"loc":{"start":{"line":1,"column":40},"end":{"line":1,"column":43}}, "operator": "++", "prefix": false, "argument": { "type": "Identifier", - "start": 40, - "end": 41, - "loc": { - "start": { - "line": 1, - "column": 40 - }, - "end": { - "line": 1, - "column": 41 - }, - "identifierName": "i" - }, + "start":40,"end":41,"loc":{"start":{"line":1,"column":40},"end":{"line":1,"column":41},"identifierName":"i"}, "name": "i" } }, "body": { "type": "BlockStatement", - "start": 45, - "end": 58, - "loc": { - "start": { - "line": 1, - "column": 45 - }, - "end": { - "line": 3, - "column": 1 - } - }, + "start":45,"end":58,"loc":{"start":{"line":1,"column":45},"end":{"line":3,"column":1}}, "body": [ { "type": "ExpressionStatement", - "start": 51, - "end": 56, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 9 - } - }, + "start":51,"end":56,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":9}}, "expression": { "type": "CallExpression", - "start": 51, - "end": 55, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 8 - } - }, + "start":51,"end":55,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":8}}, "callee": { "type": "Identifier", - "start": 51, - "end": 52, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 5 - }, - "identifierName": "x" - }, + "start":51,"end":52,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":5},"identifierName":"x"}, "name": "x" }, "arguments": [ { "type": "Identifier", - "start": 53, - "end": 54, - "loc": { - "start": { - "line": 2, - "column": 6 - }, - "end": { - "line": 2, - "column": 7 - }, - "identifierName": "i" - }, + "start":53,"end":54,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":7},"identifierName":"i"}, "name": "i" } ] diff --git a/packages/babel-parser/test/fixtures/typescript/scope/callable-class-ambient/input.ts b/packages/babel-parser/test/fixtures/typescript/scope/callable-class-ambient/input.ts new file mode 100644 index 000000000000..7714551a2449 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/scope/callable-class-ambient/input.ts @@ -0,0 +1,2 @@ +declare class C { } +declare function C(): void; diff --git a/packages/babel-parser/test/fixtures/typescript/scope/callable-class-ambient/output.json b/packages/babel-parser/test/fixtures/typescript/scope/callable-class-ambient/output.json new file mode 100644 index 000000000000..9369b9ba7d93 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/scope/callable-class-ambient/output.json @@ -0,0 +1,50 @@ +{ + "type": "File", + "start":0,"end":47,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":27}}, + "program": { + "type": "Program", + "start":0,"end":47,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":27}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, + "declare": true, + "id": { + "type": "Identifier", + "start":14,"end":15,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":15},"identifierName":"C"}, + "name": "C" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":16,"end":19,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":19}}, + "body": [] + } + }, + { + "type": "TSDeclareFunction", + "start":20,"end":47,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":27}}, + "id": { + "type": "Identifier", + "start":37,"end":38,"loc":{"start":{"line":2,"column":17},"end":{"line":2,"column":18},"identifierName":"C"}, + "name": "C" + }, + "generator": false, + "async": false, + "params": [], + "returnType": { + "type": "TSTypeAnnotation", + "start":40,"end":46,"loc":{"start":{"line":2,"column":20},"end":{"line":2,"column":26}}, + "typeAnnotation": { + "type": "TSVoidKeyword", + "start":42,"end":46,"loc":{"start":{"line":2,"column":22},"end":{"line":2,"column":26}} + } + }, + "declare": true + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/scope/callable-class/input.ts b/packages/babel-parser/test/fixtures/typescript/scope/callable-class/input.ts new file mode 100644 index 000000000000..e54e510e93ff --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/scope/callable-class/input.ts @@ -0,0 +1,2 @@ +declare class C { } +function C() { } diff --git a/packages/babel-parser/test/fixtures/typescript/scope/callable-class/output.json b/packages/babel-parser/test/fixtures/typescript/scope/callable-class/output.json new file mode 100644 index 000000000000..e6a42390d2a4 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/scope/callable-class/output.json @@ -0,0 +1,47 @@ +{ + "type": "File", + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":16}}, + "program": { + "type": "Program", + "start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":16}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, + "declare": true, + "id": { + "type": "Identifier", + "start":14,"end":15,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":15},"identifierName":"C"}, + "name": "C" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":16,"end":19,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":19}}, + "body": [] + } + }, + { + "type": "FunctionDeclaration", + "start":20,"end":36,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":16}}, + "id": { + "type": "Identifier", + "start":29,"end":30,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":10},"identifierName":"C"}, + "name": "C" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":33,"end":36,"loc":{"start":{"line":2,"column":13},"end":{"line":2,"column":16}}, + "body": [], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/scope/enum-block-scoped/output.json b/packages/babel-parser/test/fixtures/typescript/scope/enum-block-scoped/output.json index ddaa635e8f86..9c74c8de9d07 100644 --- a/packages/babel-parser/test/fixtures/typescript/scope/enum-block-scoped/output.json +++ b/packages/babel-parser/test/fixtures/typescript/scope/enum-block-scoped/output.json @@ -1,78 +1,22 @@ { "type": "File", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 8 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":8}}, "program": { "type": "Program", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 8 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":8}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "BlockStatement", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "body": [ { "type": "TSEnumDeclaration", - "start": 2, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":2,"end":13,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":13}}, "id": { "type": "Identifier", - "start": 7, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 10 - }, - "identifierName": "Foo" - }, + "start":7,"end":10,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":10},"identifierName":"Foo"}, "name": "Foo" }, "members": [] @@ -82,48 +26,14 @@ }, { "type": "VariableDeclaration", - "start": 16, - "end": 24, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 8 - } - }, + "start":16,"end":24,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":8}}, "declarations": [ { "type": "VariableDeclarator", - "start": 20, - "end": 23, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 7 - } - }, + "start":20,"end":23,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":7}}, "id": { "type": "Identifier", - "start": 20, - "end": 23, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 7 - }, - "identifierName": "Foo" - }, + "start":20,"end":23,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":7},"identifierName":"Foo"}, "name": "Foo" }, "init": null diff --git a/packages/babel-parser/test/fixtures/typescript/scope/export-declare-function-after/output.json b/packages/babel-parser/test/fixtures/typescript/scope/export-declare-function-after/output.json index c207baa1677a..72f0f6635a4b 100644 --- a/packages/babel-parser/test/fixtures/typescript/scope/export-declare-function-after/output.json +++ b/packages/babel-parser/test/fixtures/typescript/scope/export-declare-function-after/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 46, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 15 - } - }, + "start":0,"end":46,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":15}}, "program": { "type": "Program", - "start": 0, - "end": 46, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 15 - } - }, + "start":0,"end":46,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":15}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "TSDeclareFunction", - "start": 0, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, "id": { "type": "Identifier", - "start": 17, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 20 - }, - "identifierName": "foo" - }, + "start":17,"end":20,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":20},"identifierName":"foo"}, "name": "foo" }, "generator": false, @@ -65,97 +20,30 @@ "params": [], "returnType": { "type": "TSTypeAnnotation", - "start": 22, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":22,"end":28,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":28}}, "typeAnnotation": { "type": "TSVoidKeyword", - "start": 24, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 28 - } - } + "start":24,"end":28,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":28}} } }, "declare": true }, { "type": "ExportNamedDeclaration", - "start": 31, - "end": 46, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 15 - } - }, + "start":31,"end":46,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":15}}, + "exportKind": "value", "specifiers": [ { "type": "ExportSpecifier", - "start": 40, - "end": 43, - "loc": { - "start": { - "line": 3, - "column": 9 - }, - "end": { - "line": 3, - "column": 12 - } - }, + "start":40,"end":43,"loc":{"start":{"line":3,"column":9},"end":{"line":3,"column":12}}, "local": { "type": "Identifier", - "start": 40, - "end": 43, - "loc": { - "start": { - "line": 3, - "column": 9 - }, - "end": { - "line": 3, - "column": 12 - }, - "identifierName": "foo" - }, + "start":40,"end":43,"loc":{"start":{"line":3,"column":9},"end":{"line":3,"column":12},"identifierName":"foo"}, "name": "foo" }, "exported": { "type": "Identifier", - "start": 40, - "end": 43, - "loc": { - "start": { - "line": 3, - "column": 9 - }, - "end": { - "line": 3, - "column": 12 - }, - "identifierName": "foo" - }, + "start":40,"end":43,"loc":{"start":{"line":3,"column":9},"end":{"line":3,"column":12},"identifierName":"foo"}, "name": "foo" } } diff --git a/packages/babel-parser/test/fixtures/typescript/scope/export-declare-function-before/output.json b/packages/babel-parser/test/fixtures/typescript/scope/export-declare-function-before/output.json index b7071b10e90f..2dc87e91b68e 100644 --- a/packages/babel-parser/test/fixtures/typescript/scope/export-declare-function-before/output.json +++ b/packages/babel-parser/test/fixtures/typescript/scope/export-declare-function-before/output.json @@ -1,95 +1,28 @@ { "type": "File", - "start": 0, - "end": 46, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 29 - } - }, + "start":0,"end":46,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":29}}, "program": { "type": "Program", - "start": 0, - "end": 46, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 29 - } - }, + "start":0,"end":46,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":29}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExportNamedDeclaration", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, + "exportKind": "value", "specifiers": [ { "type": "ExportSpecifier", - "start": 9, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":9,"end":12,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":12}}, "local": { "type": "Identifier", - "start": 9, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "foo" - }, + "start":9,"end":12,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":12},"identifierName":"foo"}, "name": "foo" }, "exported": { "type": "Identifier", - "start": 9, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "foo" - }, + "start":9,"end":12,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":12},"identifierName":"foo"}, "name": "foo" } } @@ -99,33 +32,10 @@ }, { "type": "TSDeclareFunction", - "start": 17, - "end": 46, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 29 - } - }, + "start":17,"end":46,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":29}}, "id": { "type": "Identifier", - "start": 34, - "end": 37, - "loc": { - "start": { - "line": 3, - "column": 17 - }, - "end": { - "line": 3, - "column": 20 - }, - "identifierName": "foo" - }, + "start":34,"end":37,"loc":{"start":{"line":3,"column":17},"end":{"line":3,"column":20},"identifierName":"foo"}, "name": "foo" }, "generator": false, @@ -133,32 +43,10 @@ "params": [], "returnType": { "type": "TSTypeAnnotation", - "start": 39, - "end": 45, - "loc": { - "start": { - "line": 3, - "column": 22 - }, - "end": { - "line": 3, - "column": 28 - } - }, + "start":39,"end":45,"loc":{"start":{"line":3,"column":22},"end":{"line":3,"column":28}}, "typeAnnotation": { "type": "TSVoidKeyword", - "start": 41, - "end": 45, - "loc": { - "start": { - "line": 3, - "column": 24 - }, - "end": { - "line": 3, - "column": 28 - } - } + "start":41,"end":45,"loc":{"start":{"line":3,"column":24},"end":{"line":3,"column":28}} } }, "declare": true diff --git a/packages/babel-parser/test/fixtures/typescript/scope/export-enum-after/output.json b/packages/babel-parser/test/fixtures/typescript/scope/export-enum-after/output.json index c8738ce00309..46d31f603be2 100644 --- a/packages/babel-parser/test/fixtures/typescript/scope/export-enum-after/output.json +++ b/packages/babel-parser/test/fixtures/typescript/scope/export-enum-after/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 87, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 26 - } - }, + "start":0,"end":87,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":26}}, "program": { "type": "Program", - "start": 0, - "end": 87, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 26 - } - }, + "start":0,"end":87,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":26}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "TSEnumDeclaration", - "start": 47, - "end": 59, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 12 - } - }, + "start":47,"end":59,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":12}}, "id": { "type": "Identifier", - "start": 52, - "end": 56, - "loc": { - "start": { - "line": 3, - "column": 5 - }, - "end": { - "line": 3, - "column": 9 - }, - "identifierName": "Test" - }, + "start":52,"end":56,"loc":{"start":{"line":3,"column":5},"end":{"line":3,"column":9},"identifierName":"Test"}, "name": "Test" }, "members": [], @@ -65,82 +20,26 @@ { "type": "CommentLine", "value": " https://github.com/babel/babel/issues/9763", - "start": 0, - "end": 45, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 45 - } - } + "start":0,"end":45,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":45}} } ] }, { "type": "ExportNamedDeclaration", - "start": 61, - "end": 87, - "loc": { - "start": { - "line": 5, - "column": 0 - }, - "end": { - "line": 5, - "column": 26 - } - }, + "start":61,"end":87,"loc":{"start":{"line":5,"column":0},"end":{"line":5,"column":26}}, + "exportKind": "value", "specifiers": [ { "type": "ExportSpecifier", - "start": 70, - "end": 85, - "loc": { - "start": { - "line": 5, - "column": 9 - }, - "end": { - "line": 5, - "column": 24 - } - }, + "start":70,"end":85,"loc":{"start":{"line":5,"column":9},"end":{"line":5,"column":24}}, "local": { "type": "Identifier", - "start": 70, - "end": 74, - "loc": { - "start": { - "line": 5, - "column": 9 - }, - "end": { - "line": 5, - "column": 13 - }, - "identifierName": "Test" - }, + "start":70,"end":74,"loc":{"start":{"line":5,"column":9},"end":{"line":5,"column":13},"identifierName":"Test"}, "name": "Test" }, "exported": { "type": "Identifier", - "start": 78, - "end": 85, - "loc": { - "start": { - "line": 5, - "column": 17 - }, - "end": { - "line": 5, - "column": 24 - }, - "identifierName": "default" - }, + "start":78,"end":85,"loc":{"start":{"line":5,"column":17},"end":{"line":5,"column":24},"identifierName":"default"}, "name": "default" } } @@ -155,18 +54,7 @@ { "type": "CommentLine", "value": " https://github.com/babel/babel/issues/9763", - "start": 0, - "end": 45, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 45 - } - } + "start":0,"end":45,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":45}} } ] } \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/scope/export-enum-before/output.json b/packages/babel-parser/test/fixtures/typescript/scope/export-enum-before/output.json index 43ce8b85cb55..1ee9c0bf6b56 100644 --- a/packages/babel-parser/test/fixtures/typescript/scope/export-enum-before/output.json +++ b/packages/babel-parser/test/fixtures/typescript/scope/export-enum-before/output.json @@ -1,95 +1,28 @@ { "type": "File", - "start": 0, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 12 - } - }, + "start":0,"end":40,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":12}}, "program": { "type": "Program", - "start": 0, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 12 - } - }, + "start":0,"end":40,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":12}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExportNamedDeclaration", - "start": 0, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, + "exportKind": "value", "specifiers": [ { "type": "ExportSpecifier", - "start": 9, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":9,"end":24,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":24}}, "local": { "type": "Identifier", - "start": 9, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 13 - }, - "identifierName": "Test" - }, + "start":9,"end":13,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":13},"identifierName":"Test"}, "name": "Test" }, "exported": { "type": "Identifier", - "start": 17, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 24 - }, - "identifierName": "default" - }, + "start":17,"end":24,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":24},"identifierName":"default"}, "name": "default" } } @@ -99,33 +32,10 @@ }, { "type": "TSEnumDeclaration", - "start": 28, - "end": 40, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 12 - } - }, + "start":28,"end":40,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":12}}, "id": { "type": "Identifier", - "start": 33, - "end": 37, - "loc": { - "start": { - "line": 3, - "column": 5 - }, - "end": { - "line": 3, - "column": 9 - }, - "identifierName": "Test" - }, + "start":33,"end":37,"loc":{"start":{"line":3,"column":5},"end":{"line":3,"column":9},"identifierName":"Test"}, "name": "Test" }, "members": [] diff --git a/packages/babel-parser/test/fixtures/typescript/scope/export-interface-after/output.json b/packages/babel-parser/test/fixtures/typescript/scope/export-interface-after/output.json index 9e575d18d39e..b24638468861 100644 --- a/packages/babel-parser/test/fixtures/typescript/scope/export-interface-after/output.json +++ b/packages/babel-parser/test/fixtures/typescript/scope/export-interface-after/output.json @@ -1,143 +1,42 @@ { "type": "File", - "start": 0, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 13 - } - }, + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":13}}, "program": { "type": "Program", - "start": 0, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 13 - } - }, + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":13}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "TSInterfaceDeclaration", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "id": { "type": "Identifier", - "start": 10, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "A" - }, + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11},"identifierName":"A"}, "name": "A" }, "body": { "type": "TSInterfaceBody", - "start": 12, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":12,"end":14,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":14}}, "body": [] } }, { "type": "ExportNamedDeclaration", - "start": 15, - "end": 28, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 13 - } - }, + "start":15,"end":28,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":13}}, + "exportKind": "value", "specifiers": [ { "type": "ExportSpecifier", - "start": 24, - "end": 25, - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 10 - } - }, + "start":24,"end":25,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":10}}, "local": { "type": "Identifier", - "start": 24, - "end": 25, - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 10 - }, - "identifierName": "A" - }, + "start":24,"end":25,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":10},"identifierName":"A"}, "name": "A" }, "exported": { "type": "Identifier", - "start": 24, - "end": 25, - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 10 - }, - "identifierName": "A" - }, + "start":24,"end":25,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":10},"identifierName":"A"}, "name": "A" } } diff --git a/packages/babel-parser/test/fixtures/typescript/scope/export-interface-before/output.json b/packages/babel-parser/test/fixtures/typescript/scope/export-interface-before/output.json index dd48538d82d9..1d0567998efb 100644 --- a/packages/babel-parser/test/fixtures/typescript/scope/export-interface-before/output.json +++ b/packages/babel-parser/test/fixtures/typescript/scope/export-interface-before/output.json @@ -1,95 +1,28 @@ { "type": "File", - "start": 0, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 14 - } - }, + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":14}}, "program": { "type": "Program", - "start": 0, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 14 - } - }, + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":14}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExportNamedDeclaration", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "exportKind": "value", "specifiers": [ { "type": "ExportSpecifier", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10}}, "local": { "type": "Identifier", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - }, - "identifierName": "A" - }, + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"A"}, "name": "A" }, "exported": { "type": "Identifier", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - }, - "identifierName": "A" - }, + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"A"}, "name": "A" } } @@ -99,49 +32,15 @@ }, { "type": "TSInterfaceDeclaration", - "start": 14, - "end": 28, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 14 - } - }, + "start":14,"end":28,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":14}}, "id": { "type": "Identifier", - "start": 24, - "end": 25, - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 11 - }, - "identifierName": "A" - }, + "start":24,"end":25,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":11},"identifierName":"A"}, "name": "A" }, "body": { "type": "TSInterfaceBody", - "start": 26, - "end": 28, - "loc": { - "start": { - "line": 2, - "column": 12 - }, - "end": { - "line": 2, - "column": 14 - } - }, + "start":26,"end":28,"loc":{"start":{"line":2,"column":12},"end":{"line":2,"column":14}}, "body": [] } } diff --git a/packages/babel-parser/test/fixtures/typescript/scope/export-namespace/output.json b/packages/babel-parser/test/fixtures/typescript/scope/export-namespace/output.json index ec2b4c8349b5..80c8faf0bbb8 100644 --- a/packages/babel-parser/test/fixtures/typescript/scope/export-namespace/output.json +++ b/packages/babel-parser/test/fixtures/typescript/scope/export-namespace/output.json @@ -1,143 +1,42 @@ { "type": "File", - "start": 0, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 13 - } - }, + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":13}}, "program": { "type": "Program", - "start": 0, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 13 - } - }, + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":13}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "TSModuleDeclaration", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "id": { "type": "Identifier", - "start": 10, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "N" - }, + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11},"identifierName":"N"}, "name": "N" }, "body": { "type": "TSModuleBlock", - "start": 12, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":12,"end":14,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":14}}, "body": [] } }, { "type": "ExportNamedDeclaration", - "start": 16, - "end": 29, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 13 - } - }, + "start":16,"end":29,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":13}}, + "exportKind": "value", "specifiers": [ { "type": "ExportSpecifier", - "start": 25, - "end": 26, - "loc": { - "start": { - "line": 3, - "column": 9 - }, - "end": { - "line": 3, - "column": 10 - } - }, + "start":25,"end":26,"loc":{"start":{"line":3,"column":9},"end":{"line":3,"column":10}}, "local": { "type": "Identifier", - "start": 25, - "end": 26, - "loc": { - "start": { - "line": 3, - "column": 9 - }, - "end": { - "line": 3, - "column": 10 - }, - "identifierName": "N" - }, + "start":25,"end":26,"loc":{"start":{"line":3,"column":9},"end":{"line":3,"column":10},"identifierName":"N"}, "name": "N" }, "exported": { "type": "Identifier", - "start": 25, - "end": 26, - "loc": { - "start": { - "line": 3, - "column": 9 - }, - "end": { - "line": 3, - "column": 10 - }, - "identifierName": "N" - }, + "start":25,"end":26,"loc":{"start":{"line":3,"column":9},"end":{"line":3,"column":10},"identifierName":"N"}, "name": "N" } } diff --git a/packages/babel-parser/test/fixtures/typescript/scope/export-type-after/output.json b/packages/babel-parser/test/fixtures/typescript/scope/export-type-after/output.json index d4259d15a749..b5f2fb8ebd93 100644 --- a/packages/babel-parser/test/fixtures/typescript/scope/export-type-after/output.json +++ b/packages/babel-parser/test/fixtures/typescript/scope/export-type-after/output.json @@ -1,142 +1,41 @@ { "type": "File", - "start": 0, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 13 - } - }, + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":13}}, "program": { "type": "Program", - "start": 0, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 13 - } - }, + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":13}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "TSTypeAliasDeclaration", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "id": { "type": "Identifier", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "A" - }, + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"A"}, "name": "A" }, "typeAnnotation": { "type": "TSNumberKeyword", - "start": 9, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 15 - } - } + "start":9,"end":15,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":15}} } }, { "type": "ExportNamedDeclaration", - "start": 17, - "end": 30, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 13 - } - }, + "start":17,"end":30,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":13}}, + "exportKind": "value", "specifiers": [ { "type": "ExportSpecifier", - "start": 26, - "end": 27, - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 10 - } - }, + "start":26,"end":27,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":10}}, "local": { "type": "Identifier", - "start": 26, - "end": 27, - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 10 - }, - "identifierName": "A" - }, + "start":26,"end":27,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":10},"identifierName":"A"}, "name": "A" }, "exported": { "type": "Identifier", - "start": 26, - "end": 27, - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 10 - }, - "identifierName": "A" - }, + "start":26,"end":27,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":10},"identifierName":"A"}, "name": "A" } } diff --git a/packages/babel-parser/test/fixtures/typescript/scope/export-type-before/output.json b/packages/babel-parser/test/fixtures/typescript/scope/export-type-before/output.json index 5086f1f05376..3da921f98898 100644 --- a/packages/babel-parser/test/fixtures/typescript/scope/export-type-before/output.json +++ b/packages/babel-parser/test/fixtures/typescript/scope/export-type-before/output.json @@ -1,95 +1,28 @@ { "type": "File", - "start": 0, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 16 - } - }, + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":16}}, "program": { "type": "Program", - "start": 0, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 16 - } - }, + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":16}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExportNamedDeclaration", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "exportKind": "value", "specifiers": [ { "type": "ExportSpecifier", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10}}, "local": { "type": "Identifier", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - }, - "identifierName": "A" - }, + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"A"}, "name": "A" }, "exported": { "type": "Identifier", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - }, - "identifierName": "A" - }, + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"A"}, "name": "A" } } @@ -99,49 +32,15 @@ }, { "type": "TSTypeAliasDeclaration", - "start": 14, - "end": 30, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 16 - } - }, + "start":14,"end":30,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":16}}, "id": { "type": "Identifier", - "start": 19, - "end": 20, - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 6 - }, - "identifierName": "A" - }, + "start":19,"end":20,"loc":{"start":{"line":2,"column":5},"end":{"line":2,"column":6},"identifierName":"A"}, "name": "A" }, "typeAnnotation": { "type": "TSNumberKeyword", - "start": 23, - "end": 29, - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 15 - } - } + "start":23,"end":29,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":15}} } } ], diff --git a/packages/babel-parser/test/fixtures/typescript/scope/function-type-before-declaration/output.json b/packages/babel-parser/test/fixtures/typescript/scope/function-type-before-declaration/output.json index c17c84eca906..54e57b9a6d14 100644 --- a/packages/babel-parser/test/fixtures/typescript/scope/function-type-before-declaration/output.json +++ b/packages/babel-parser/test/fixtures/typescript/scope/function-type-before-declaration/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 50, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 13 - } - }, + "start":0,"end":50,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":13}}, "program": { "type": "Program", - "start": 0, - "end": 50, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 13 - } - }, + "start":0,"end":50,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":13}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "TSDeclareFunction", - "start": 0, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, "id": { "type": "Identifier", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - }, - "identifierName": "f" - }, + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"f"}, "name": "f" }, "generator": false, @@ -65,64 +20,19 @@ "params": [], "returnType": { "type": "TSTypeAnnotation", - "start": 12, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":12,"end":18,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":18}}, "typeAnnotation": { "type": "TSVoidKeyword", - "start": 14, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 18 - } - } + "start":14,"end":18,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":18}} } } }, { "type": "FunctionDeclaration", - "start": 20, - "end": 35, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 15 - } - }, + "start":20,"end":35,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":15}}, "id": { "type": "Identifier", - "start": 29, - "end": 30, - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 10 - }, - "identifierName": "f" - }, + "start":29,"end":30,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":10},"identifierName":"f"}, "name": "f" }, "generator": false, @@ -130,83 +40,27 @@ "params": [], "body": { "type": "BlockStatement", - "start": 33, - "end": 35, - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 15 - } - }, + "start":33,"end":35,"loc":{"start":{"line":2,"column":13},"end":{"line":2,"column":15}}, "body": [], "directives": [] } }, { "type": "ExportNamedDeclaration", - "start": 37, - "end": 50, - "loc": { - "start": { - "line": 4, - "column": 0 - }, - "end": { - "line": 4, - "column": 13 - } - }, + "start":37,"end":50,"loc":{"start":{"line":4,"column":0},"end":{"line":4,"column":13}}, + "exportKind": "value", "specifiers": [ { "type": "ExportSpecifier", - "start": 46, - "end": 47, - "loc": { - "start": { - "line": 4, - "column": 9 - }, - "end": { - "line": 4, - "column": 10 - } - }, + "start":46,"end":47,"loc":{"start":{"line":4,"column":9},"end":{"line":4,"column":10}}, "local": { "type": "Identifier", - "start": 46, - "end": 47, - "loc": { - "start": { - "line": 4, - "column": 9 - }, - "end": { - "line": 4, - "column": 10 - }, - "identifierName": "f" - }, + "start":46,"end":47,"loc":{"start":{"line":4,"column":9},"end":{"line":4,"column":10},"identifierName":"f"}, "name": "f" }, "exported": { "type": "Identifier", - "start": 46, - "end": 47, - "loc": { - "start": { - "line": 4, - "column": 9 - }, - "end": { - "line": 4, - "column": 10 - }, - "identifierName": "f" - }, + "start":46,"end":47,"loc":{"start":{"line":4,"column":9},"end":{"line":4,"column":10},"identifierName":"f"}, "name": "f" } } diff --git a/packages/babel-parser/test/fixtures/typescript/scope/module-declaration-var-2/input.js b/packages/babel-parser/test/fixtures/typescript/scope/module-declaration-var-2/input.js new file mode 100644 index 000000000000..0cf66b421f31 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/scope/module-declaration-var-2/input.js @@ -0,0 +1,5 @@ +declare class foo { +} +module bar { + export var foo: any; +} diff --git a/packages/babel-parser/test/fixtures/typescript/scope/module-declaration-var-2/output.json b/packages/babel-parser/test/fixtures/typescript/scope/module-declaration-var-2/output.json new file mode 100644 index 000000000000..4d37ea056a7f --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/scope/module-declaration-var-2/output.json @@ -0,0 +1,76 @@ +{ + "type": "File", + "start":0,"end":59,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, + "program": { + "type": "Program", + "start":0,"end":59,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":1}}, + "declare": true, + "id": { + "type": "Identifier", + "start":14,"end":17,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":17},"identifierName":"foo"}, + "name": "foo" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":18,"end":21,"loc":{"start":{"line":1,"column":18},"end":{"line":2,"column":1}}, + "body": [] + } + }, + { + "type": "TSModuleDeclaration", + "start":22,"end":59,"loc":{"start":{"line":3,"column":0},"end":{"line":5,"column":1}}, + "id": { + "type": "Identifier", + "start":29,"end":32,"loc":{"start":{"line":3,"column":7},"end":{"line":3,"column":10},"identifierName":"bar"}, + "name": "bar" + }, + "body": { + "type": "TSModuleBlock", + "start":33,"end":59,"loc":{"start":{"line":3,"column":11},"end":{"line":5,"column":1}}, + "body": [ + { + "type": "ExportNamedDeclaration", + "start":37,"end":57,"loc":{"start":{"line":4,"column":2},"end":{"line":4,"column":22}}, + "exportKind": "value", + "specifiers": [], + "source": null, + "declaration": { + "type": "VariableDeclaration", + "start":44,"end":57,"loc":{"start":{"line":4,"column":9},"end":{"line":4,"column":22}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":48,"end":56,"loc":{"start":{"line":4,"column":13},"end":{"line":4,"column":21}}, + "id": { + "type": "Identifier", + "start":48,"end":56,"loc":{"start":{"line":4,"column":13},"end":{"line":4,"column":21},"identifierName":"foo"}, + "name": "foo", + "typeAnnotation": { + "type": "TSTypeAnnotation", + "start":51,"end":56,"loc":{"start":{"line":4,"column":16},"end":{"line":4,"column":21}}, + "typeAnnotation": { + "type": "TSAnyKeyword", + "start":53,"end":56,"loc":{"start":{"line":4,"column":18},"end":{"line":4,"column":21}} + } + } + }, + "init": null + } + ], + "kind": "var" + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/scope/module-declaration-var/input.js b/packages/babel-parser/test/fixtures/typescript/scope/module-declaration-var/input.js new file mode 100644 index 000000000000..237ff39e1579 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/scope/module-declaration-var/input.js @@ -0,0 +1,5 @@ +declare class foo { +} +declare module 'bar' { + export var foo: any; +} diff --git a/packages/babel-parser/test/fixtures/typescript/scope/module-declaration-var/output.json b/packages/babel-parser/test/fixtures/typescript/scope/module-declaration-var/output.json new file mode 100644 index 000000000000..b5e7e60123d8 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/scope/module-declaration-var/output.json @@ -0,0 +1,81 @@ +{ + "type": "File", + "start":0,"end":69,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, + "program": { + "type": "Program", + "start":0,"end":69,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":1}}, + "declare": true, + "id": { + "type": "Identifier", + "start":14,"end":17,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":17},"identifierName":"foo"}, + "name": "foo" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":18,"end":21,"loc":{"start":{"line":1,"column":18},"end":{"line":2,"column":1}}, + "body": [] + } + }, + { + "type": "TSModuleDeclaration", + "start":22,"end":69,"loc":{"start":{"line":3,"column":0},"end":{"line":5,"column":1}}, + "id": { + "type": "StringLiteral", + "start":37,"end":42,"loc":{"start":{"line":3,"column":15},"end":{"line":3,"column":20}}, + "extra": { + "rawValue": "bar", + "raw": "'bar'" + }, + "value": "bar" + }, + "body": { + "type": "TSModuleBlock", + "start":43,"end":69,"loc":{"start":{"line":3,"column":21},"end":{"line":5,"column":1}}, + "body": [ + { + "type": "ExportNamedDeclaration", + "start":47,"end":67,"loc":{"start":{"line":4,"column":2},"end":{"line":4,"column":22}}, + "exportKind": "value", + "specifiers": [], + "source": null, + "declaration": { + "type": "VariableDeclaration", + "start":54,"end":67,"loc":{"start":{"line":4,"column":9},"end":{"line":4,"column":22}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":58,"end":66,"loc":{"start":{"line":4,"column":13},"end":{"line":4,"column":21}}, + "id": { + "type": "Identifier", + "start":58,"end":66,"loc":{"start":{"line":4,"column":13},"end":{"line":4,"column":21},"identifierName":"foo"}, + "name": "foo", + "typeAnnotation": { + "type": "TSTypeAnnotation", + "start":61,"end":66,"loc":{"start":{"line":4,"column":16},"end":{"line":4,"column":21}}, + "typeAnnotation": { + "type": "TSAnyKeyword", + "start":63,"end":66,"loc":{"start":{"line":4,"column":18},"end":{"line":4,"column":21}} + } + } + }, + "init": null + } + ], + "kind": "var" + } + } + ] + }, + "declare": true + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-class-class/options.json b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-class-class/options.json deleted file mode 100644 index 336686170eb0..000000000000 --- a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-class-class/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'A' has already been declared (2:6)" -} diff --git a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-class-class/output.json b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-class-class/output.json new file mode 100644 index 000000000000..b3b42d74d8e3 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-class-class/output.json @@ -0,0 +1,46 @@ +{ + "type": "File", + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":10}}, + "errors": [ + "SyntaxError: Identifier 'A' has already been declared (2:6)" + ], + "program": { + "type": "Program", + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":10}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "id": { + "type": "Identifier", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":8,"end":10,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":10}}, + "body": [] + } + }, + { + "type": "ClassDeclaration", + "start":11,"end":21,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":10}}, + "id": { + "type": "Identifier", + "start":17,"end":18,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":7},"identifierName":"A"}, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":19,"end":21,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":10}}, + "body": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-class-enum/options.json b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-class-enum/options.json deleted file mode 100644 index 1eed93f49a0e..000000000000 --- a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-class-enum/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'A' has already been declared (2:5)" -} diff --git a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-class-enum/output.json b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-class-enum/output.json new file mode 100644 index 000000000000..a1cc8e60fcc4 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-class-enum/output.json @@ -0,0 +1,41 @@ +{ + "type": "File", + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":9}}, + "errors": [ + "SyntaxError: Identifier 'A' has already been declared (2:5)" + ], + "program": { + "type": "Program", + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":9}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "id": { + "type": "Identifier", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":8,"end":10,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":10}}, + "body": [] + } + }, + { + "type": "TSEnumDeclaration", + "start":11,"end":20,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":9}}, + "id": { + "type": "Identifier", + "start":16,"end":17,"loc":{"start":{"line":2,"column":5},"end":{"line":2,"column":6},"identifierName":"A"}, + "name": "A" + }, + "members": [] + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-class-interface/output.json b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-class-interface/output.json index b44cc7caf564..aa8b62bd8605 100644 --- a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-class-interface/output.json +++ b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-class-interface/output.json @@ -1,128 +1,38 @@ { "type": "File", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 14 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":14}}, "program": { "type": "Program", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 14 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":14}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 0, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, "id": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "A" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, "name": "A" }, "superClass": null, "body": { "type": "ClassBody", - "start": 8, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":8,"end":10,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":10}}, "body": [] } }, { "type": "TSInterfaceDeclaration", - "start": 11, - "end": 25, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 14 - } - }, + "start":11,"end":25,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":14}}, "id": { "type": "Identifier", - "start": 21, - "end": 22, - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 11 - }, - "identifierName": "A" - }, + "start":21,"end":22,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":11},"identifierName":"A"}, "name": "A" }, "body": { "type": "TSInterfaceBody", - "start": 23, - "end": 25, - "loc": { - "start": { - "line": 2, - "column": 12 - }, - "end": { - "line": 2, - "column": 14 - } - }, + "start":23,"end":25,"loc":{"start":{"line":2,"column":12},"end":{"line":2,"column":14}}, "body": [] } } diff --git a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-class-type/options.json b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-class-type/options.json deleted file mode 100644 index 1eed93f49a0e..000000000000 --- a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-class-type/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'A' has already been declared (2:5)" -} diff --git a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-class-type/output.json b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-class-type/output.json new file mode 100644 index 000000000000..caddda18d801 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-class-type/output.json @@ -0,0 +1,44 @@ +{ + "type": "File", + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":16}}, + "errors": [ + "SyntaxError: Identifier 'A' has already been declared (2:5)" + ], + "program": { + "type": "Program", + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":16}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "id": { + "type": "Identifier", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"A"}, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":8,"end":10,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":10}}, + "body": [] + } + }, + { + "type": "TSTypeAliasDeclaration", + "start":11,"end":27,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":16}}, + "id": { + "type": "Identifier", + "start":16,"end":17,"loc":{"start":{"line":2,"column":5},"end":{"line":2,"column":6},"identifierName":"A"}, + "name": "A" + }, + "typeAnnotation": { + "type": "TSNumberKeyword", + "start":20,"end":26,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":15}} + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-const-type/output.json b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-const-type/output.json index b51eb30f5c6c..ceb37c4d1a13 100644 --- a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-const-type/output.json +++ b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-const-type/output.json @@ -1,94 +1,27 @@ { "type": "File", - "start": 0, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 16 - } - }, + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":16}}, "program": { "type": "Program", - "start": 0, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 16 - } - }, + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":16}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "declarations": [ { "type": "VariableDeclarator", - "start": 6, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":6,"end":12,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":12}}, "id": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "X" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"X"}, "name": "X" }, "init": { "type": "StringLiteral", - "start": 10, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":10,"end":12,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":12}}, "extra": { "rawValue": "", "raw": "\"\"" @@ -101,49 +34,15 @@ }, { "type": "TSTypeAliasDeclaration", - "start": 14, - "end": 30, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 16 - } - }, + "start":14,"end":30,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":16}}, "id": { "type": "Identifier", - "start": 19, - "end": 20, - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 6 - }, - "identifierName": "X" - }, + "start":19,"end":20,"loc":{"start":{"line":2,"column":5},"end":{"line":2,"column":6},"identifierName":"X"}, "name": "X" }, "typeAnnotation": { "type": "TSNumberKeyword", - "start": 23, - "end": 29, - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 15 - } - } + "start":23,"end":29,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":15}} } } ], diff --git a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-constenum-constenum/output.json b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-constenum-constenum/output.json index 2120fa78e381..d8c2160f1fdc 100644 --- a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-constenum-constenum/output.json +++ b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-constenum-constenum/output.json @@ -1,98 +1,30 @@ { "type": "File", - "start": 0, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 17 - } - }, + "start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":17}}, "program": { "type": "Program", - "start": 0, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 17 - } - }, + "start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":17}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "TSEnumDeclaration", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, "const": true, "id": { "type": "Identifier", - "start": 11, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 14 - }, - "identifierName": "Foo" - }, + "start":11,"end":14,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":14},"identifierName":"Foo"}, "name": "Foo" }, "members": [] }, { "type": "TSEnumDeclaration", - "start": 18, - "end": 35, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 17 - } - }, + "start":18,"end":35,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":17}}, "const": true, "id": { "type": "Identifier", - "start": 29, - "end": 32, - "loc": { - "start": { - "line": 2, - "column": 11 - }, - "end": { - "line": 2, - "column": 14 - }, - "identifierName": "Foo" - }, + "start":29,"end":32,"loc":{"start":{"line":2,"column":11},"end":{"line":2,"column":14},"identifierName":"Foo"}, "name": "Foo" }, "members": [] diff --git a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-constenum-enum/options.json b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-constenum-enum/options.json deleted file mode 100644 index ee82975e59a3..000000000000 --- a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-constenum-enum/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'X' has already been declared (2:5)" -} diff --git a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-constenum-enum/output.json b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-constenum-enum/output.json new file mode 100644 index 000000000000..baf3fa807a05 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-constenum-enum/output.json @@ -0,0 +1,37 @@ +{ + "type": "File", + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":9}}, + "errors": [ + "SyntaxError: Identifier 'X' has already been declared (2:5)" + ], + "program": { + "type": "Program", + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":9}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "TSEnumDeclaration", + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, + "const": true, + "id": { + "type": "Identifier", + "start":11,"end":12,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":12},"identifierName":"X"}, + "name": "X" + }, + "members": [] + }, + { + "type": "TSEnumDeclaration", + "start":16,"end":25,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":9}}, + "id": { + "type": "Identifier", + "start":21,"end":22,"loc":{"start":{"line":2,"column":5},"end":{"line":2,"column":6},"identifierName":"X"}, + "name": "X" + }, + "members": [] + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-enum-class/options.json b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-enum-class/options.json deleted file mode 100644 index 69462b29a995..000000000000 --- a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-enum-class/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'X' has already been declared (2:6)" -} diff --git a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-enum-class/output.json b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-enum-class/output.json new file mode 100644 index 000000000000..6a310f817190 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-enum-class/output.json @@ -0,0 +1,41 @@ +{ + "type": "File", + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":10}}, + "errors": [ + "SyntaxError: Identifier 'X' has already been declared (2:6)" + ], + "program": { + "type": "Program", + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":10}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "TSEnumDeclaration", + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "id": { + "type": "Identifier", + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"X"}, + "name": "X" + }, + "members": [] + }, + { + "type": "ClassDeclaration", + "start":10,"end":20,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":10}}, + "id": { + "type": "Identifier", + "start":16,"end":17,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":7},"identifierName":"X"}, + "name": "X" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":18,"end":20,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":10}}, + "body": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-enum-constenum/options.json b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-enum-constenum/options.json deleted file mode 100644 index c77fcb7927ac..000000000000 --- a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-enum-constenum/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'X' has already been declared (2:11)" -} diff --git a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-enum-constenum/output.json b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-enum-constenum/output.json new file mode 100644 index 000000000000..0660bfd16649 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-enum-constenum/output.json @@ -0,0 +1,37 @@ +{ + "type": "File", + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":15}}, + "errors": [ + "SyntaxError: Identifier 'X' has already been declared (2:11)" + ], + "program": { + "type": "Program", + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":15}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "TSEnumDeclaration", + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "id": { + "type": "Identifier", + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"X"}, + "name": "X" + }, + "members": [] + }, + { + "type": "TSEnumDeclaration", + "start":10,"end":25,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":15}}, + "const": true, + "id": { + "type": "Identifier", + "start":21,"end":22,"loc":{"start":{"line":2,"column":11},"end":{"line":2,"column":12},"identifierName":"X"}, + "name": "X" + }, + "members": [] + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-enum-enum/output.json b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-enum-enum/output.json index a270131731fb..fe1203f2f8d4 100644 --- a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-enum-enum/output.json +++ b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-enum-enum/output.json @@ -1,96 +1,28 @@ { "type": "File", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 11 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":11}}, "program": { "type": "Program", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 11 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":11}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "TSEnumDeclaration", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "id": { "type": "Identifier", - "start": 5, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 8 - }, - "identifierName": "Foo" - }, + "start":5,"end":8,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":8},"identifierName":"Foo"}, "name": "Foo" }, "members": [] }, { "type": "TSEnumDeclaration", - "start": 12, - "end": 23, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 11 - } - }, + "start":12,"end":23,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":11}}, "id": { "type": "Identifier", - "start": 17, - "end": 20, - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 8 - }, - "identifierName": "Foo" - }, + "start":17,"end":20,"loc":{"start":{"line":2,"column":5},"end":{"line":2,"column":8},"identifierName":"Foo"}, "name": "Foo" }, "members": [] diff --git a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-enum-function/options.json b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-enum-function/options.json deleted file mode 100644 index ee47ddce75a8..000000000000 --- a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-enum-function/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'Foo' has already been declared (2:9)" -} diff --git a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-enum-function/output.json b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-enum-function/output.json new file mode 100644 index 000000000000..d254111a610a --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-enum-function/output.json @@ -0,0 +1,44 @@ +{ + "type": "File", + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":17}}, + "errors": [ + "SyntaxError: Identifier 'Foo' has already been declared (2:9)" + ], + "program": { + "type": "Program", + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":17}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "TSEnumDeclaration", + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "id": { + "type": "Identifier", + "start":5,"end":8,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":8},"identifierName":"Foo"}, + "name": "Foo" + }, + "members": [] + }, + { + "type": "FunctionDeclaration", + "start":12,"end":29,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":17}}, + "id": { + "type": "Identifier", + "start":21,"end":24,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":12},"identifierName":"Foo"}, + "name": "Foo" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":27,"end":29,"loc":{"start":{"line":2,"column":15},"end":{"line":2,"column":17}}, + "body": [], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-enum-interface/options.json b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-enum-interface/options.json deleted file mode 100644 index a5f623f4e212..000000000000 --- a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-enum-interface/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'X' has already been declared (2:10)" -} diff --git a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-enum-interface/output.json b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-enum-interface/output.json new file mode 100644 index 000000000000..62bf37e86c3f --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-enum-interface/output.json @@ -0,0 +1,40 @@ +{ + "type": "File", + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":14}}, + "errors": [ + "SyntaxError: Identifier 'X' has already been declared (2:10)" + ], + "program": { + "type": "Program", + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":14}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "TSEnumDeclaration", + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "id": { + "type": "Identifier", + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"X"}, + "name": "X" + }, + "members": [] + }, + { + "type": "TSInterfaceDeclaration", + "start":10,"end":24,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":14}}, + "id": { + "type": "Identifier", + "start":20,"end":21,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":11},"identifierName":"X"}, + "name": "X" + }, + "body": { + "type": "TSInterfaceBody", + "start":22,"end":24,"loc":{"start":{"line":2,"column":12},"end":{"line":2,"column":14}}, + "body": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-enum-let/options.json b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-enum-let/options.json deleted file mode 100644 index 4172f917bdb1..000000000000 --- a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-enum-let/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'Foo' has already been declared (2:4)" -} diff --git a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-enum-let/output.json b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-enum-let/output.json new file mode 100644 index 000000000000..cf541c4247d4 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-enum-let/output.json @@ -0,0 +1,43 @@ +{ + "type": "File", + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":8}}, + "errors": [ + "SyntaxError: Identifier 'Foo' has already been declared (2:4)" + ], + "program": { + "type": "Program", + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":8}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "TSEnumDeclaration", + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "id": { + "type": "Identifier", + "start":5,"end":8,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":8},"identifierName":"Foo"}, + "name": "Foo" + }, + "members": [] + }, + { + "type": "VariableDeclaration", + "start":12,"end":20,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":8}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":16,"end":19,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":7}}, + "id": { + "type": "Identifier", + "start":16,"end":19,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":7},"identifierName":"Foo"}, + "name": "Foo" + }, + "init": null + } + ], + "kind": "let" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-enum-type/options.json b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-enum-type/options.json deleted file mode 100644 index ee82975e59a3..000000000000 --- a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-enum-type/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'X' has already been declared (2:5)" -} diff --git a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-enum-type/output.json b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-enum-type/output.json new file mode 100644 index 000000000000..7b8d2e208cc2 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-enum-type/output.json @@ -0,0 +1,39 @@ +{ + "type": "File", + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":16}}, + "errors": [ + "SyntaxError: Identifier 'X' has already been declared (2:5)" + ], + "program": { + "type": "Program", + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":16}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "TSEnumDeclaration", + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "id": { + "type": "Identifier", + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"X"}, + "name": "X" + }, + "members": [] + }, + { + "type": "TSTypeAliasDeclaration", + "start":10,"end":26,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":16}}, + "id": { + "type": "Identifier", + "start":15,"end":16,"loc":{"start":{"line":2,"column":5},"end":{"line":2,"column":6},"identifierName":"X"}, + "name": "X" + }, + "typeAnnotation": { + "type": "TSNumberKeyword", + "start":19,"end":25,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":15}} + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-enum-var/options.json b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-enum-var/options.json deleted file mode 100644 index 4172f917bdb1..000000000000 --- a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-enum-var/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'Foo' has already been declared (2:4)" -} diff --git a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-enum-var/output.json b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-enum-var/output.json new file mode 100644 index 000000000000..cf541c4247d4 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-enum-var/output.json @@ -0,0 +1,43 @@ +{ + "type": "File", + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":8}}, + "errors": [ + "SyntaxError: Identifier 'Foo' has already been declared (2:4)" + ], + "program": { + "type": "Program", + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":8}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "TSEnumDeclaration", + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "id": { + "type": "Identifier", + "start":5,"end":8,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":8},"identifierName":"Foo"}, + "name": "Foo" + }, + "members": [] + }, + { + "type": "VariableDeclaration", + "start":12,"end":20,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":8}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":16,"end":19,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":7}}, + "id": { + "type": "Identifier", + "start":16,"end":19,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":7},"identifierName":"Foo"}, + "name": "Foo" + }, + "init": null + } + ], + "kind": "let" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-function-enum/options.json b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-function-enum/options.json deleted file mode 100644 index 92349410e8cf..000000000000 --- a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-function-enum/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'Foo' has already been declared (2:5)" -} diff --git a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-function-enum/output.json b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-function-enum/output.json new file mode 100644 index 000000000000..2613394dc026 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-function-enum/output.json @@ -0,0 +1,44 @@ +{ + "type": "File", + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":11}}, + "errors": [ + "SyntaxError: Identifier 'Foo' has already been declared (2:5)" + ], + "program": { + "type": "Program", + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":11}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, + "id": { + "type": "Identifier", + "start":9,"end":12,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":12},"identifierName":"Foo"}, + "name": "Foo" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":15,"end":17,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":17}}, + "body": [], + "directives": [] + } + }, + { + "type": "TSEnumDeclaration", + "start":18,"end":29,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":11}}, + "id": { + "type": "Identifier", + "start":23,"end":26,"loc":{"start":{"line":2,"column":5},"end":{"line":2,"column":8},"identifierName":"Foo"}, + "name": "Foo" + }, + "members": [] + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-function-interface/output.json b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-function-interface/output.json index 13e97e869b2d..b5b280602ab6 100644 --- a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-function-interface/output.json +++ b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-function-interface/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 14 - } - }, + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":14}}, "program": { "type": "Program", - "start": 0, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 14 - } - }, + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":14}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "id": { "type": "Identifier", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - }, - "identifierName": "A" - }, + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"A"}, "name": "A" }, "generator": false, @@ -65,67 +20,22 @@ "params": [], "body": { "type": "BlockStatement", - "start": 13, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":13,"end":15,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":15}}, "body": [], "directives": [] } }, { "type": "TSInterfaceDeclaration", - "start": 16, - "end": 30, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 14 - } - }, + "start":16,"end":30,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":14}}, "id": { "type": "Identifier", - "start": 26, - "end": 27, - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 11 - }, - "identifierName": "A" - }, + "start":26,"end":27,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":11},"identifierName":"A"}, "name": "A" }, "body": { "type": "TSInterfaceBody", - "start": 28, - "end": 30, - "loc": { - "start": { - "line": 2, - "column": 12 - }, - "end": { - "line": 2, - "column": 14 - } - }, + "start":28,"end":30,"loc":{"start":{"line":2,"column":12},"end":{"line":2,"column":14}}, "body": [] } } diff --git a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-function-type/output.json b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-function-type/output.json index 4258090807ff..7b3e29f9ad14 100644 --- a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-function-type/output.json +++ b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-function-type/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 16 - } - }, + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":16}}, "program": { "type": "Program", - "start": 0, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 16 - } - }, + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":16}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "id": { "type": "Identifier", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - }, - "identifierName": "A" - }, + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"A"}, "name": "A" }, "generator": false, @@ -65,67 +20,22 @@ "params": [], "body": { "type": "BlockStatement", - "start": 13, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":13,"end":15,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":15}}, "body": [], "directives": [] } }, { "type": "TSTypeAliasDeclaration", - "start": 16, - "end": 32, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 16 - } - }, + "start":16,"end":32,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":16}}, "id": { "type": "Identifier", - "start": 21, - "end": 22, - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 6 - }, - "identifierName": "A" - }, + "start":21,"end":22,"loc":{"start":{"line":2,"column":5},"end":{"line":2,"column":6},"identifierName":"A"}, "name": "A" }, "typeAnnotation": { "type": "TSNumberKeyword", - "start": 25, - "end": 31, - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 15 - } - } + "start":25,"end":31,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":15}} } } ], diff --git a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-import-ambient-class/input.ts b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-import-ambient-class/input.ts new file mode 100644 index 000000000000..e57fcdb01a82 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-import-ambient-class/input.ts @@ -0,0 +1,3 @@ +import Something from './somewhere.js' + +declare class Something {} diff --git a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-import-ambient-class/output.json b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-import-ambient-class/output.json new file mode 100644 index 000000000000..479d69c1a16c --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-import-ambient-class/output.json @@ -0,0 +1,54 @@ +{ + "type": "File", + "start":0,"end":66,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":26}}, + "program": { + "type": "Program", + "start":0,"end":66,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":26}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ImportDeclaration", + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":38}}, + "importKind": "value", + "specifiers": [ + { + "type": "ImportDefaultSpecifier", + "start":7,"end":16,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":16}}, + "local": { + "type": "Identifier", + "start":7,"end":16,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":16},"identifierName":"Something"}, + "name": "Something" + } + } + ], + "source": { + "type": "StringLiteral", + "start":22,"end":38,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":38}}, + "extra": { + "rawValue": "./somewhere.js", + "raw": "'./somewhere.js'" + }, + "value": "./somewhere.js" + } + }, + { + "type": "ClassDeclaration", + "start":40,"end":66,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":26}}, + "declare": true, + "id": { + "type": "Identifier", + "start":54,"end":63,"loc":{"start":{"line":3,"column":14},"end":{"line":3,"column":23},"identifierName":"Something"}, + "name": "Something" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":64,"end":66,"loc":{"start":{"line":3,"column":24},"end":{"line":3,"column":26}}, + "body": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-interface-class/output.json b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-interface-class/output.json index 5b0af1060cbb..49647a7e08e0 100644 --- a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-interface-class/output.json +++ b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-interface-class/output.json @@ -1,128 +1,38 @@ { "type": "File", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 10 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":10}}, "program": { "type": "Program", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 10 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":10}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "TSInterfaceDeclaration", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "id": { "type": "Identifier", - "start": 10, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "A" - }, + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11},"identifierName":"A"}, "name": "A" }, "body": { "type": "TSInterfaceBody", - "start": 12, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":12,"end":14,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":14}}, "body": [] } }, { "type": "ClassDeclaration", - "start": 15, - "end": 25, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 10 - } - }, + "start":15,"end":25,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":10}}, "id": { "type": "Identifier", - "start": 21, - "end": 22, - "loc": { - "start": { - "line": 2, - "column": 6 - }, - "end": { - "line": 2, - "column": 7 - }, - "identifierName": "A" - }, + "start":21,"end":22,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":7},"identifierName":"A"}, "name": "A" }, "superClass": null, "body": { "type": "ClassBody", - "start": 23, - "end": 25, - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 10 - } - }, + "start":23,"end":25,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":10}}, "body": [] } } diff --git a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-interface-enum/options.json b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-interface-enum/options.json deleted file mode 100644 index ee82975e59a3..000000000000 --- a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-interface-enum/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'X' has already been declared (2:5)" -} diff --git a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-interface-enum/output.json b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-interface-enum/output.json new file mode 100644 index 000000000000..27a720cd09d3 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-interface-enum/output.json @@ -0,0 +1,40 @@ +{ + "type": "File", + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":9}}, + "errors": [ + "SyntaxError: Identifier 'X' has already been declared (2:5)" + ], + "program": { + "type": "Program", + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":9}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "TSInterfaceDeclaration", + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, + "id": { + "type": "Identifier", + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11},"identifierName":"X"}, + "name": "X" + }, + "body": { + "type": "TSInterfaceBody", + "start":12,"end":14,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":14}}, + "body": [] + } + }, + { + "type": "TSEnumDeclaration", + "start":15,"end":24,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":9}}, + "id": { + "type": "Identifier", + "start":20,"end":21,"loc":{"start":{"line":2,"column":5},"end":{"line":2,"column":6},"identifierName":"X"}, + "name": "X" + }, + "members": [] + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-interface-function/output.json b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-interface-function/output.json index 166403881b86..390d3ba24dc7 100644 --- a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-interface-function/output.json +++ b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-interface-function/output.json @@ -1,111 +1,32 @@ { "type": "File", - "start": 0, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 15 - } - }, + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":15}}, "program": { "type": "Program", - "start": 0, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 15 - } - }, + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":15}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "TSInterfaceDeclaration", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "id": { "type": "Identifier", - "start": 10, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "A" - }, + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11},"identifierName":"A"}, "name": "A" }, "body": { "type": "TSInterfaceBody", - "start": 12, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":12,"end":14,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":14}}, "body": [] } }, { "type": "FunctionDeclaration", - "start": 15, - "end": 30, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 15 - } - }, + "start":15,"end":30,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":15}}, "id": { "type": "Identifier", - "start": 24, - "end": 25, - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 10 - }, - "identifierName": "A" - }, + "start":24,"end":25,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":10},"identifierName":"A"}, "name": "A" }, "generator": false, @@ -113,18 +34,7 @@ "params": [], "body": { "type": "BlockStatement", - "start": 28, - "end": 30, - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 15 - } - }, + "start":28,"end":30,"loc":{"start":{"line":2,"column":13},"end":{"line":2,"column":15}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-interface-interface/output.json b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-interface-interface/output.json index 598f4999cfbc..c10986676275 100644 --- a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-interface-interface/output.json +++ b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-interface-interface/output.json @@ -1,127 +1,37 @@ { "type": "File", - "start": 0, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 14 - } - }, + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":14}}, "program": { "type": "Program", - "start": 0, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 14 - } - }, + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":14}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "TSInterfaceDeclaration", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "id": { "type": "Identifier", - "start": 10, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "A" - }, + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11},"identifierName":"A"}, "name": "A" }, "body": { "type": "TSInterfaceBody", - "start": 12, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":12,"end":14,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":14}}, "body": [] } }, { "type": "TSInterfaceDeclaration", - "start": 15, - "end": 29, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 14 - } - }, + "start":15,"end":29,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":14}}, "id": { "type": "Identifier", - "start": 25, - "end": 26, - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 11 - }, - "identifierName": "A" - }, + "start":25,"end":26,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":11},"identifierName":"A"}, "name": "A" }, "body": { "type": "TSInterfaceBody", - "start": 27, - "end": 29, - "loc": { - "start": { - "line": 2, - "column": 12 - }, - "end": { - "line": 2, - "column": 14 - } - }, + "start":27,"end":29,"loc":{"start":{"line":2,"column":12},"end":{"line":2,"column":14}}, "body": [] } } diff --git a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-interface-let/output.json b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-interface-let/output.json index 0c96b1cd892a..55bc9a70c433 100644 --- a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-interface-let/output.json +++ b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-interface-let/output.json @@ -1,126 +1,36 @@ { "type": "File", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 6 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":6}}, "program": { "type": "Program", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 6 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":6}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "TSInterfaceDeclaration", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "id": { "type": "Identifier", - "start": 10, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "A" - }, + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11},"identifierName":"A"}, "name": "A" }, "body": { "type": "TSInterfaceBody", - "start": 12, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":12,"end":14,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":14}}, "body": [] } }, { "type": "VariableDeclaration", - "start": 15, - "end": 21, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 6 - } - }, + "start":15,"end":21,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":6}}, "declarations": [ { "type": "VariableDeclarator", - "start": 19, - "end": 20, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 5 - } - }, + "start":19,"end":20,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":5}}, "id": { "type": "Identifier", - "start": 19, - "end": 20, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 5 - }, - "identifierName": "A" - }, + "start":19,"end":20,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":5},"identifierName":"A"}, "name": "A" }, "init": null diff --git a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-interface-var/output.json b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-interface-var/output.json index e353b5cd0b83..873109cdac08 100644 --- a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-interface-var/output.json +++ b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-interface-var/output.json @@ -1,126 +1,36 @@ { "type": "File", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 6 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":6}}, "program": { "type": "Program", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 6 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":6}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "TSInterfaceDeclaration", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "id": { "type": "Identifier", - "start": 10, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "A" - }, + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11},"identifierName":"A"}, "name": "A" }, "body": { "type": "TSInterfaceBody", - "start": 12, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":12,"end":14,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":14}}, "body": [] } }, { "type": "VariableDeclaration", - "start": 15, - "end": 21, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 6 - } - }, + "start":15,"end":21,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":6}}, "declarations": [ { "type": "VariableDeclarator", - "start": 19, - "end": 20, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 5 - } - }, + "start":19,"end":20,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":5}}, "id": { "type": "Identifier", - "start": 19, - "end": 20, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 5 - }, - "identifierName": "A" - }, + "start":19,"end":20,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":5},"identifierName":"A"}, "name": "A" }, "init": null diff --git a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-let-enum/options.json b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-let-enum/options.json deleted file mode 100644 index 92349410e8cf..000000000000 --- a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-let-enum/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'Foo' has already been declared (2:5)" -} diff --git a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-let-enum/output.json b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-let-enum/output.json new file mode 100644 index 000000000000..cb3f09c087df --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-let-enum/output.json @@ -0,0 +1,43 @@ +{ + "type": "File", + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":11}}, + "errors": [ + "SyntaxError: Identifier 'Foo' has already been declared (2:5)" + ], + "program": { + "type": "Program", + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":11}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":4,"end":7,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":7}}, + "id": { + "type": "Identifier", + "start":4,"end":7,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":7},"identifierName":"Foo"}, + "name": "Foo" + }, + "init": null + } + ], + "kind": "let" + }, + { + "type": "TSEnumDeclaration", + "start":9,"end":20,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":11}}, + "id": { + "type": "Identifier", + "start":14,"end":17,"loc":{"start":{"line":2,"column":5},"end":{"line":2,"column":8},"identifierName":"Foo"}, + "name": "Foo" + }, + "members": [] + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-let-interface/output.json b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-let-interface/output.json index d1833f641360..46c02e61c9de 100644 --- a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-let-interface/output.json +++ b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-let-interface/output.json @@ -1,78 +1,22 @@ { "type": "File", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 14 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":14}}, "program": { "type": "Program", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 14 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":14}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5}}, "id": { "type": "Identifier", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "A" - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"A"}, "name": "A" }, "init": null @@ -82,49 +26,15 @@ }, { "type": "TSInterfaceDeclaration", - "start": 7, - "end": 21, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 14 - } - }, + "start":7,"end":21,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":14}}, "id": { "type": "Identifier", - "start": 17, - "end": 18, - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 11 - }, - "identifierName": "A" - }, + "start":17,"end":18,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":11},"identifierName":"A"}, "name": "A" }, "body": { "type": "TSInterfaceBody", - "start": 19, - "end": 21, - "loc": { - "start": { - "line": 2, - "column": 12 - }, - "end": { - "line": 2, - "column": 14 - } - }, + "start":19,"end":21,"loc":{"start":{"line":2,"column":12},"end":{"line":2,"column":14}}, "body": [] } } diff --git a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-let-type/output.json b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-let-type/output.json index 8c157d8a364d..9de57fd629d2 100644 --- a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-let-type/output.json +++ b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-let-type/output.json @@ -1,94 +1,27 @@ { "type": "File", - "start": 0, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 16 - } - }, + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":16}}, "program": { "type": "Program", - "start": 0, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 16 - } - }, + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":16}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":4,"end":10,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":10}}, "id": { "type": "Identifier", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "X" - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"X"}, "name": "X" }, "init": { "type": "StringLiteral", - "start": 8, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":8,"end":10,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":10}}, "extra": { "rawValue": "", "raw": "\"\"" @@ -101,49 +34,15 @@ }, { "type": "TSTypeAliasDeclaration", - "start": 12, - "end": 28, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 16 - } - }, + "start":12,"end":28,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":16}}, "id": { "type": "Identifier", - "start": 17, - "end": 18, - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 6 - }, - "identifierName": "X" - }, + "start":17,"end":18,"loc":{"start":{"line":2,"column":5},"end":{"line":2,"column":6},"identifierName":"X"}, "name": "X" }, "typeAnnotation": { "type": "TSNumberKeyword", - "start": 21, - "end": 27, - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 15 - } - } + "start":21,"end":27,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":15}} } } ], diff --git a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-type-class/options.json b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-type-class/options.json deleted file mode 100644 index 336686170eb0..000000000000 --- a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-type-class/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'A' has already been declared (2:6)" -} diff --git a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-type-class/output.json b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-type-class/output.json new file mode 100644 index 000000000000..7738c56de634 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-type-class/output.json @@ -0,0 +1,44 @@ +{ + "type": "File", + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":10}}, + "errors": [ + "SyntaxError: Identifier 'A' has already been declared (2:6)" + ], + "program": { + "type": "Program", + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":10}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "TSTypeAliasDeclaration", + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, + "id": { + "type": "Identifier", + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"A"}, + "name": "A" + }, + "typeAnnotation": { + "type": "TSNumberKeyword", + "start":9,"end":15,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":15}} + } + }, + { + "type": "ClassDeclaration", + "start":17,"end":27,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":10}}, + "id": { + "type": "Identifier", + "start":23,"end":24,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":7},"identifierName":"A"}, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":25,"end":27,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":10}}, + "body": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-type-enum/options.json b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-type-enum/options.json deleted file mode 100644 index 1eed93f49a0e..000000000000 --- a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-type-enum/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'A' has already been declared (2:5)" -} diff --git a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-type-enum/output.json b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-type-enum/output.json new file mode 100644 index 000000000000..775af3064133 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-type-enum/output.json @@ -0,0 +1,39 @@ +{ + "type": "File", + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":9}}, + "errors": [ + "SyntaxError: Identifier 'A' has already been declared (2:5)" + ], + "program": { + "type": "Program", + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":9}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "TSTypeAliasDeclaration", + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, + "id": { + "type": "Identifier", + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"A"}, + "name": "A" + }, + "typeAnnotation": { + "type": "TSNumberKeyword", + "start":9,"end":15,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":15}} + } + }, + { + "type": "TSEnumDeclaration", + "start":17,"end":26,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":9}}, + "id": { + "type": "Identifier", + "start":22,"end":23,"loc":{"start":{"line":2,"column":5},"end":{"line":2,"column":6},"identifierName":"A"}, + "name": "A" + }, + "members": [] + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-type-function/output.json b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-type-function/output.json index 805839ca3c76..a301d8fa075a 100644 --- a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-type-function/output.json +++ b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-type-function/output.json @@ -1,110 +1,31 @@ { "type": "File", - "start": 0, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 15 - } - }, + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":15}}, "program": { "type": "Program", - "start": 0, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 15 - } - }, + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":15}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "TSTypeAliasDeclaration", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "id": { "type": "Identifier", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "A" - }, + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"A"}, "name": "A" }, "typeAnnotation": { "type": "TSNumberKeyword", - "start": 9, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 15 - } - } + "start":9,"end":15,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":15}} } }, { "type": "FunctionDeclaration", - "start": 17, - "end": 32, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 15 - } - }, + "start":17,"end":32,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":15}}, "id": { "type": "Identifier", - "start": 26, - "end": 27, - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 10 - }, - "identifierName": "A" - }, + "start":26,"end":27,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":10},"identifierName":"A"}, "name": "A" }, "generator": false, @@ -112,18 +33,7 @@ "params": [], "body": { "type": "BlockStatement", - "start": 30, - "end": 32, - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 15 - } - }, + "start":30,"end":32,"loc":{"start":{"line":2,"column":13},"end":{"line":2,"column":15}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-type-interface/options.json b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-type-interface/options.json deleted file mode 100644 index 04242bd1565b..000000000000 --- a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-type-interface/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'A' has already been declared (2:10)" -} diff --git a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-type-interface/output.json b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-type-interface/output.json new file mode 100644 index 000000000000..2e27314bf592 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-type-interface/output.json @@ -0,0 +1,43 @@ +{ + "type": "File", + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":14}}, + "errors": [ + "SyntaxError: Identifier 'A' has already been declared (2:10)" + ], + "program": { + "type": "Program", + "start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":14}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "TSTypeAliasDeclaration", + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, + "id": { + "type": "Identifier", + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"A"}, + "name": "A" + }, + "typeAnnotation": { + "type": "TSNumberKeyword", + "start":9,"end":15,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":15}} + } + }, + { + "type": "TSInterfaceDeclaration", + "start":17,"end":31,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":14}}, + "id": { + "type": "Identifier", + "start":27,"end":28,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":11},"identifierName":"A"}, + "name": "A" + }, + "body": { + "type": "TSInterfaceBody", + "start":29,"end":31,"loc":{"start":{"line":2,"column":12},"end":{"line":2,"column":14}}, + "body": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-type-let/output.json b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-type-let/output.json index fb4fc242eac9..c0b3d027b190 100644 --- a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-type-let/output.json +++ b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-type-let/output.json @@ -1,125 +1,35 @@ { "type": "File", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 6 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":6}}, "program": { "type": "Program", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 6 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":6}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "TSTypeAliasDeclaration", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "id": { "type": "Identifier", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "A" - }, + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"A"}, "name": "A" }, "typeAnnotation": { "type": "TSNumberKeyword", - "start": 9, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 15 - } - } + "start":9,"end":15,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":15}} } }, { "type": "VariableDeclaration", - "start": 17, - "end": 23, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 6 - } - }, + "start":17,"end":23,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":6}}, "declarations": [ { "type": "VariableDeclarator", - "start": 21, - "end": 22, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 5 - } - }, + "start":21,"end":22,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":5}}, "id": { "type": "Identifier", - "start": 21, - "end": 22, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 5 - }, - "identifierName": "A" - }, + "start":21,"end":22,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":5},"identifierName":"A"}, "name": "A" }, "init": null diff --git a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-type-type/options.json b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-type-type/options.json deleted file mode 100644 index 1eed93f49a0e..000000000000 --- a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-type-type/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'A' has already been declared (2:5)" -} diff --git a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-type-type/output.json b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-type-type/output.json new file mode 100644 index 000000000000..48fee42b09ad --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-type-type/output.json @@ -0,0 +1,42 @@ +{ + "type": "File", + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":16}}, + "errors": [ + "SyntaxError: Identifier 'A' has already been declared (2:5)" + ], + "program": { + "type": "Program", + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":16}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "TSTypeAliasDeclaration", + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, + "id": { + "type": "Identifier", + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"A"}, + "name": "A" + }, + "typeAnnotation": { + "type": "TSNumberKeyword", + "start":9,"end":15,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":15}} + } + }, + { + "type": "TSTypeAliasDeclaration", + "start":17,"end":33,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":16}}, + "id": { + "type": "Identifier", + "start":22,"end":23,"loc":{"start":{"line":2,"column":5},"end":{"line":2,"column":6},"identifierName":"A"}, + "name": "A" + }, + "typeAnnotation": { + "type": "TSStringKeyword", + "start":26,"end":32,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":15}} + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-type-var/output.json b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-type-var/output.json index 8a2375272f10..32a03fa8d704 100644 --- a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-type-var/output.json +++ b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-type-var/output.json @@ -1,125 +1,35 @@ { "type": "File", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 6 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":6}}, "program": { "type": "Program", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 6 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":6}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "TSTypeAliasDeclaration", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "id": { "type": "Identifier", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "A" - }, + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"A"}, "name": "A" }, "typeAnnotation": { "type": "TSNumberKeyword", - "start": 9, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 15 - } - } + "start":9,"end":15,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":15}} } }, { "type": "VariableDeclaration", - "start": 17, - "end": 23, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 6 - } - }, + "start":17,"end":23,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":6}}, "declarations": [ { "type": "VariableDeclarator", - "start": 21, - "end": 22, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 5 - } - }, + "start":21,"end":22,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":5}}, "id": { "type": "Identifier", - "start": 21, - "end": 22, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 5 - }, - "identifierName": "A" - }, + "start":21,"end":22,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":5},"identifierName":"A"}, "name": "A" }, "init": null diff --git a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-var-enum/options.json b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-var-enum/options.json deleted file mode 100644 index 92349410e8cf..000000000000 --- a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-var-enum/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'Foo' has already been declared (2:5)" -} diff --git a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-var-enum/output.json b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-var-enum/output.json new file mode 100644 index 000000000000..cb3f09c087df --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-var-enum/output.json @@ -0,0 +1,43 @@ +{ + "type": "File", + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":11}}, + "errors": [ + "SyntaxError: Identifier 'Foo' has already been declared (2:5)" + ], + "program": { + "type": "Program", + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":11}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":4,"end":7,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":7}}, + "id": { + "type": "Identifier", + "start":4,"end":7,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":7},"identifierName":"Foo"}, + "name": "Foo" + }, + "init": null + } + ], + "kind": "let" + }, + { + "type": "TSEnumDeclaration", + "start":9,"end":20,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":11}}, + "id": { + "type": "Identifier", + "start":14,"end":17,"loc":{"start":{"line":2,"column":5},"end":{"line":2,"column":8},"identifierName":"Foo"}, + "name": "Foo" + }, + "members": [] + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-var-interface/output.json b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-var-interface/output.json index 068b9e0779a4..1dd2dd5d62cd 100644 --- a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-var-interface/output.json +++ b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-var-interface/output.json @@ -1,78 +1,22 @@ { "type": "File", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 14 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":14}}, "program": { "type": "Program", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 14 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":14}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5}}, "id": { "type": "Identifier", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "A" - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"A"}, "name": "A" }, "init": null @@ -82,49 +26,15 @@ }, { "type": "TSInterfaceDeclaration", - "start": 7, - "end": 21, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 14 - } - }, + "start":7,"end":21,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":14}}, "id": { "type": "Identifier", - "start": 17, - "end": 18, - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 11 - }, - "identifierName": "A" - }, + "start":17,"end":18,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":11},"identifierName":"A"}, "name": "A" }, "body": { "type": "TSInterfaceBody", - "start": 19, - "end": 21, - "loc": { - "start": { - "line": 2, - "column": 12 - }, - "end": { - "line": 2, - "column": 14 - } - }, + "start":19,"end":21,"loc":{"start":{"line":2,"column":12},"end":{"line":2,"column":14}}, "body": [] } } diff --git a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-var-type/output.json b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-var-type/output.json index 6cfc11c09339..b8b8f8ad7135 100644 --- a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-var-type/output.json +++ b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-var-type/output.json @@ -1,94 +1,27 @@ { "type": "File", - "start": 0, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 16 - } - }, + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":16}}, "program": { "type": "Program", - "start": 0, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 16 - } - }, + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":16}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":4,"end":10,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":10}}, "id": { "type": "Identifier", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "X" - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"X"}, "name": "X" }, "init": { "type": "StringLiteral", - "start": 8, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":8,"end":10,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":10}}, "extra": { "rawValue": "", "raw": "\"\"" @@ -101,49 +34,15 @@ }, { "type": "TSTypeAliasDeclaration", - "start": 12, - "end": 28, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 16 - } - }, + "start":12,"end":28,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":16}}, "id": { "type": "Identifier", - "start": 17, - "end": 18, - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 6 - }, - "identifierName": "X" - }, + "start":17,"end":18,"loc":{"start":{"line":2,"column":5},"end":{"line":2,"column":6},"identifierName":"X"}, "name": "X" }, "typeAnnotation": { "type": "TSNumberKeyword", - "start": 21, - "end": 27, - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 15 - } - } + "start":21,"end":27,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":15}} } } ], diff --git a/packages/babel-parser/test/fixtures/typescript/tsx/anonymous-function-generator-invalid/input.ts b/packages/babel-parser/test/fixtures/typescript/tsx/anonymous-function-generator-invalid/input.ts new file mode 100644 index 000000000000..109fe67a21e0 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/tsx/anonymous-function-generator-invalid/input.ts @@ -0,0 +1,3 @@ +const fn = function* <,>(input: T): Generator { + yield 2; +} diff --git a/packages/babel-parser/test/fixtures/typescript/tsx/anonymous-function-generator-invalid/options.json b/packages/babel-parser/test/fixtures/typescript/tsx/anonymous-function-generator-invalid/options.json new file mode 100644 index 000000000000..be27f9417b1b --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/tsx/anonymous-function-generator-invalid/options.json @@ -0,0 +1,5 @@ +{ + "plugins": ["jsx", "typescript"], + "sourceType": "module", + "throws": "Unexpected token (1:22)" +} diff --git a/packages/babel-parser/test/fixtures/typescript/tsx/anonymous-function-generator/input.ts b/packages/babel-parser/test/fixtures/typescript/tsx/anonymous-function-generator/input.ts new file mode 100644 index 000000000000..33ce49c1f4a6 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/tsx/anonymous-function-generator/input.ts @@ -0,0 +1,3 @@ +const fn = function* (input: T): Generator { + yield 2; +} diff --git a/packages/babel-parser/test/fixtures/typescript/tsx/anonymous-function-generator/output.json b/packages/babel-parser/test/fixtures/typescript/tsx/anonymous-function-generator/output.json new file mode 100644 index 000000000000..937ca57900ca --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/tsx/anonymous-function-generator/output.json @@ -0,0 +1,115 @@ +{ + "type": "File", + "start":0,"end":68,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "program": { + "type": "Program", + "start":0,"end":68,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start":0,"end":68,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":6,"end":68,"loc":{"start":{"line":1,"column":6},"end":{"line":3,"column":1}}, + "id": { + "type": "Identifier", + "start":6,"end":8,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":8},"identifierName":"fn"}, + "name": "fn" + }, + "init": { + "type": "FunctionExpression", + "start":11,"end":68,"loc":{"start":{"line":1,"column":11},"end":{"line":3,"column":1}}, + "id": null, + "generator": true, + "async": false, + "typeParameters": { + "type": "TSTypeParameterDeclaration", + "start":21,"end":24,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":24}}, + "params": [ + { + "type": "TSTypeParameter", + "start":22,"end":23,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":23}}, + "name": "T" + } + ] + }, + "params": [ + { + "type": "Identifier", + "start":25,"end":33,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":33},"identifierName":"input"}, + "name": "input", + "typeAnnotation": { + "type": "TSTypeAnnotation", + "start":30,"end":33,"loc":{"start":{"line":1,"column":30},"end":{"line":1,"column":33}}, + "typeAnnotation": { + "type": "TSTypeReference", + "start":32,"end":33,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":33}}, + "typeName": { + "type": "Identifier", + "start":32,"end":33,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":33},"identifierName":"T"}, + "name": "T" + } + } + } + } + ], + "returnType": { + "type": "TSTypeAnnotation", + "start":34,"end":53,"loc":{"start":{"line":1,"column":34},"end":{"line":1,"column":53}}, + "typeAnnotation": { + "type": "TSTypeReference", + "start":36,"end":53,"loc":{"start":{"line":1,"column":36},"end":{"line":1,"column":53}}, + "typeName": { + "type": "Identifier", + "start":36,"end":45,"loc":{"start":{"line":1,"column":36},"end":{"line":1,"column":45},"identifierName":"Generator"}, + "name": "Generator" + }, + "typeParameters": { + "type": "TSTypeParameterInstantiation", + "start":45,"end":53,"loc":{"start":{"line":1,"column":45},"end":{"line":1,"column":53}}, + "params": [ + { + "type": "TSNumberKeyword", + "start":46,"end":52,"loc":{"start":{"line":1,"column":46},"end":{"line":1,"column":52}} + } + ] + } + } + }, + "body": { + "type": "BlockStatement", + "start":54,"end":68,"loc":{"start":{"line":1,"column":54},"end":{"line":3,"column":1}}, + "body": [ + { + "type": "ExpressionStatement", + "start":58,"end":66,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":10}}, + "expression": { + "type": "YieldExpression", + "start":58,"end":65,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":9}}, + "delegate": false, + "argument": { + "type": "NumericLiteral", + "start":64,"end":65,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":9}}, + "extra": { + "rawValue": 2, + "raw": "2" + }, + "value": 2 + } + } + } + ], + "directives": [] + } + } + } + ], + "kind": "const" + } + ], + "directives": [] + } +} diff --git a/packages/babel-parser/test/fixtures/typescript/tsx/brace-is-block/output.json b/packages/babel-parser/test/fixtures/typescript/tsx/brace-is-block/output.json index ec9f551e1fe3..851aa2292336 100644 --- a/packages/babel-parser/test/fixtures/typescript/tsx/brace-is-block/output.json +++ b/packages/babel-parser/test/fixtures/typescript/tsx/brace-is-block/output.json @@ -1,126 +1,35 @@ { "type": "File", - "start": 0, - "end": 127, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 4 - } - }, + "start":0,"end":127,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":4}}, "program": { "type": "Program", - "start": 0, - "end": 127, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 4 - } - }, + "start":0,"end":127,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":4}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ClassDeclaration", - "start": 99, - "end": 122, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 23 - } - }, + "start":99,"end":122,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":23}}, "id": { "type": "Identifier", - "start": 105, - "end": 106, - "loc": { - "start": { - "line": 2, - "column": 6 - }, - "end": { - "line": 2, - "column": 7 - }, - "identifierName": "C" - }, + "start":105,"end":106,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":7},"identifierName":"C"}, "name": "C" }, "superClass": { "type": "Identifier", - "start": 115, - "end": 116, - "loc": { - "start": { - "line": 2, - "column": 16 - }, - "end": { - "line": 2, - "column": 17 - }, - "identifierName": "D" - }, + "start":115,"end":116,"loc":{"start":{"line":2,"column":16},"end":{"line":2,"column":17},"identifierName":"D"}, "name": "D" }, "superTypeParameters": { "type": "TSTypeParameterInstantiation", - "start": 116, - "end": 119, - "loc": { - "start": { - "line": 2, - "column": 17 - }, - "end": { - "line": 2, - "column": 20 - } - }, + "start":116,"end":119,"loc":{"start":{"line":2,"column":17},"end":{"line":2,"column":20}}, "params": [ { "type": "TSTypeReference", - "start": 117, - "end": 118, - "loc": { - "start": { - "line": 2, - "column": 18 - }, - "end": { - "line": 2, - "column": 19 - } - }, + "start":117,"end":118,"loc":{"start":{"line":2,"column":18},"end":{"line":2,"column":19}}, "typeName": { "type": "Identifier", - "start": 117, - "end": 118, - "loc": { - "start": { - "line": 2, - "column": 18 - }, - "end": { - "line": 2, - "column": 19 - }, - "identifierName": "T" - }, + "start":117,"end":118,"loc":{"start":{"line":2,"column":18},"end":{"line":2,"column":19},"identifierName":"T"}, "name": "T" } } @@ -128,98 +37,32 @@ }, "body": { "type": "ClassBody", - "start": 120, - "end": 122, - "loc": { - "start": { - "line": 2, - "column": 21 - }, - "end": { - "line": 2, - "column": 23 - } - }, + "start":120,"end":122,"loc":{"start":{"line":2,"column":21},"end":{"line":2,"column":23}}, "body": [] }, "leadingComments": [ { "type": "CommentLine", "value": " Regression test for tokenizer bug where the `{` after `` was considered a JSX interpolation.", - "start": 0, - "end": 98, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 98 - } - } + "start":0,"end":98,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":98}} } ] }, { "type": "ExpressionStatement", - "start": 123, - "end": 127, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 4 - } - }, + "start":123,"end":127,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":4}}, "expression": { "type": "JSXElement", - "start": 123, - "end": 127, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 4 - } - }, + "start":123,"end":127,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":4}}, "openingElement": { "type": "JSXOpeningElement", - "start": 123, - "end": 127, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 4 - } - }, - "attributes": [], + "start":123,"end":127,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":4}}, "name": { "type": "JSXIdentifier", - "start": 124, - "end": 125, - "loc": { - "start": { - "line": 3, - "column": 1 - }, - "end": { - "line": 3, - "column": 2 - } - }, + "start":124,"end":125,"loc":{"start":{"line":3,"column":1},"end":{"line":3,"column":2}}, "name": "C" }, + "attributes": [], "selfClosing": true }, "closingElement": null, @@ -233,18 +76,7 @@ { "type": "CommentLine", "value": " Regression test for tokenizer bug where the `{` after `` was considered a JSX interpolation.", - "start": 0, - "end": 98, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 98 - } - } + "start":0,"end":98,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":98}} } ] } \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/tsx/type-arguments/output.json b/packages/babel-parser/test/fixtures/typescript/tsx/type-arguments/output.json index a61beb416a56..f29bd2729b7f 100644 --- a/packages/babel-parser/test/fixtures/typescript/tsx/type-arguments/output.json +++ b/packages/babel-parser/test/fixtures/typescript/tsx/type-arguments/output.json @@ -1,124 +1,34 @@ { "type": "File", - "start": 0, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 14 - } - }, + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":14}}, "program": { "type": "Program", - "start": 0, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 14 - } - }, + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":14}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "expression": { "type": "CallExpression", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "callee": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "f" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"f"}, "name": "f" }, "arguments": [], "typeParameters": { "type": "TSTypeParameterInstantiation", - "start": 1, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 4 - } - }, + "start":1,"end":4,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":4}}, "params": [ { "type": "TSTypeReference", - "start": 2, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 3 - } - }, + "start":2,"end":3,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":3}}, "typeName": { "type": "Identifier", - "start": 2, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 3 - }, - "identifierName": "T" - }, + "start":2,"end":3,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":3},"identifierName":"T"}, "name": "T" } } @@ -128,93 +38,25 @@ }, { "type": "ExpressionStatement", - "start": 8, - "end": 19, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 11 - } - }, + "start":8,"end":19,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":11}}, "expression": { "type": "NewExpression", - "start": 8, - "end": 18, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 10 - } - }, + "start":8,"end":18,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":10}}, "callee": { "type": "Identifier", - "start": 12, - "end": 13, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 5 - }, - "identifierName": "C" - }, + "start":12,"end":13,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":5},"identifierName":"C"}, "name": "C" }, "typeParameters": { "type": "TSTypeParameterInstantiation", - "start": 13, - "end": 16, - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 8 - } - }, + "start":13,"end":16,"loc":{"start":{"line":2,"column":5},"end":{"line":2,"column":8}}, "params": [ { "type": "TSTypeReference", - "start": 14, - "end": 15, - "loc": { - "start": { - "line": 2, - "column": 6 - }, - "end": { - "line": 2, - "column": 7 - } - }, + "start":14,"end":15,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":7}}, "typeName": { "type": "Identifier", - "start": 14, - "end": 15, - "loc": { - "start": { - "line": 2, - "column": 6 - }, - "end": { - "line": 2, - "column": 7 - }, - "identifierName": "T" - }, + "start":14,"end":15,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":7},"identifierName":"T"}, "name": "T" } } @@ -225,110 +67,30 @@ }, { "type": "TSTypeAliasDeclaration", - "start": 20, - "end": 34, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 14 - } - }, + "start":20,"end":34,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":14}}, "id": { "type": "Identifier", - "start": 25, - "end": 26, - "loc": { - "start": { - "line": 3, - "column": 5 - }, - "end": { - "line": 3, - "column": 6 - }, - "identifierName": "A" - }, + "start":25,"end":26,"loc":{"start":{"line":3,"column":5},"end":{"line":3,"column":6},"identifierName":"A"}, "name": "A" }, "typeAnnotation": { "type": "TSTypeReference", - "start": 29, - "end": 33, - "loc": { - "start": { - "line": 3, - "column": 9 - }, - "end": { - "line": 3, - "column": 13 - } - }, + "start":29,"end":33,"loc":{"start":{"line":3,"column":9},"end":{"line":3,"column":13}}, "typeName": { "type": "Identifier", - "start": 29, - "end": 30, - "loc": { - "start": { - "line": 3, - "column": 9 - }, - "end": { - "line": 3, - "column": 10 - }, - "identifierName": "T" - }, + "start":29,"end":30,"loc":{"start":{"line":3,"column":9},"end":{"line":3,"column":10},"identifierName":"T"}, "name": "T" }, "typeParameters": { "type": "TSTypeParameterInstantiation", - "start": 30, - "end": 33, - "loc": { - "start": { - "line": 3, - "column": 10 - }, - "end": { - "line": 3, - "column": 13 - } - }, + "start":30,"end":33,"loc":{"start":{"line":3,"column":10},"end":{"line":3,"column":13}}, "params": [ { "type": "TSTypeReference", - "start": 31, - "end": 32, - "loc": { - "start": { - "line": 3, - "column": 11 - }, - "end": { - "line": 3, - "column": 12 - } - }, + "start":31,"end":32,"loc":{"start":{"line":3,"column":11},"end":{"line":3,"column":12}}, "typeName": { "type": "Identifier", - "start": 31, - "end": 32, - "loc": { - "start": { - "line": 3, - "column": 11 - }, - "end": { - "line": 3, - "column": 12 - }, - "identifierName": "T" - }, + "start":31,"end":32,"loc":{"start":{"line":3,"column":11},"end":{"line":3,"column":12},"identifierName":"T"}, "name": "T" } } diff --git a/packages/babel-parser/test/fixtures/typescript/tsx/type-parameters/output.json b/packages/babel-parser/test/fixtures/typescript/tsx/type-parameters/output.json index 6a3a62345736..f4a610d0d307 100644 --- a/packages/babel-parser/test/fixtures/typescript/tsx/type-parameters/output.json +++ b/packages/babel-parser/test/fixtures/typescript/tsx/type-parameters/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, "program": { "type": "Program", - "start": 0, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, "id": { "type": "Identifier", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - }, - "identifierName": "f" - }, + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"f"}, "name": "f" }, "generator": false, @@ -65,61 +20,17 @@ "params": [], "returnType": { "type": "TSTypeAnnotation", - "start": 12, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":12,"end":29,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":29}}, "typeAnnotation": { "type": "TSFunctionType", - "start": 14, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":14,"end":29,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":29}}, "typeParameters": { "type": "TSTypeParameterDeclaration", - "start": 14, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":14,"end":17,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":17}}, "params": [ { "type": "TSTypeParameter", - "start": 15, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":15,"end":16,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":16}}, "name": "T" } ] @@ -127,50 +38,17 @@ "parameters": [], "typeAnnotation": { "type": "TSTypeAnnotation", - "start": 20, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":20,"end":29,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":29}}, "typeAnnotation": { "type": "TSNumberKeyword", - "start": 23, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 29 - } - } + "start":23,"end":29,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":29}} } } } }, "body": { "type": "BlockStatement", - "start": 30, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":30,"end":32,"loc":{"start":{"line":1,"column":30},"end":{"line":1,"column":32}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/typescript/type-alias/declare/output.json b/packages/babel-parser/test/fixtures/typescript/type-alias/declare/output.json index a172139f6af6..fcf7b553f9b8 100644 --- a/packages/babel-parser/test/fixtures/typescript/type-alias/declare/output.json +++ b/packages/babel-parser/test/fixtures/typescript/type-alias/declare/output.json @@ -1,79 +1,23 @@ { "type": "File", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "program": { "type": "Program", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "TSTypeAliasDeclaration", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "id": { "type": "Identifier", - "start": 13, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - }, - "identifierName": "T" - }, + "start":13,"end":14,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":14},"identifierName":"T"}, "name": "T" }, "typeAnnotation": { "type": "TSNumberKeyword", - "start": 17, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 23 - } - } + "start":17,"end":23,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":23}} }, "declare": true } diff --git a/packages/babel-parser/test/fixtures/typescript/type-alias/export/output.json b/packages/babel-parser/test/fixtures/typescript/type-alias/export/output.json index 829dc8b3afcc..0e13050d3971 100644 --- a/packages/babel-parser/test/fixtures/typescript/type-alias/export/output.json +++ b/packages/babel-parser/test/fixtures/typescript/type-alias/export/output.json @@ -1,113 +1,36 @@ { "type": "File", - "start": 0, - "end": 62, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 38 - } - }, + "start":0,"end":62,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":38}}, "program": { "type": "Program", - "start": 0, - "end": 62, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 38 - } - }, + "start":0,"end":62,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":38}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExportNamedDeclaration", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, + "exportKind": "type", "specifiers": [], "source": null, "declaration": { "type": "TSTypeAliasDeclaration", - "start": 7, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":7,"end":23,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":23}}, "id": { "type": "Identifier", - "start": 12, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - }, - "identifierName": "T" - }, + "start":12,"end":13,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":13},"identifierName":"T"}, "name": "T" }, "typeAnnotation": { "type": "TSNumberKeyword", - "start": 16, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 22 - } - } + "start":16,"end":22,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":22}} } }, "trailingComments": [ { "type": "CommentLine", "value": " `export default type` is not valid.", - "start": 24, - "end": 62, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 38 - } - } + "start":24,"end":62,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":38}} } ] } @@ -118,18 +41,7 @@ { "type": "CommentLine", "value": " `export default type` is not valid.", - "start": 24, - "end": 62, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 38 - } - } + "start":24,"end":62,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":38}} } ] } \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/type-alias/generic-complex/input.ts b/packages/babel-parser/test/fixtures/typescript/type-alias/generic-complex-tokens-true/input.ts similarity index 100% rename from packages/babel-parser/test/fixtures/typescript/type-alias/generic-complex/input.ts rename to packages/babel-parser/test/fixtures/typescript/type-alias/generic-complex-tokens-true/input.ts diff --git a/packages/babel-parser/test/fixtures/typescript/type-alias/generic-complex-tokens-true/options.json b/packages/babel-parser/test/fixtures/typescript/type-alias/generic-complex-tokens-true/options.json new file mode 100644 index 000000000000..359dbf5e9514 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/type-alias/generic-complex-tokens-true/options.json @@ -0,0 +1,5 @@ +{ + "sourceType": "module", + "plugins": ["typescript"], + "tokens": true +} diff --git a/packages/babel-parser/test/fixtures/typescript/type-alias/generic-complex-tokens-true/output.json b/packages/babel-parser/test/fixtures/typescript/type-alias/generic-complex-tokens-true/output.json new file mode 100644 index 000000000000..844c6486bec7 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/type-alias/generic-complex-tokens-true/output.json @@ -0,0 +1,393 @@ +{ + "type": "File", + "start":0,"end":52,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":52}}, + "program": { + "type": "Program", + "start":0,"end":52,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":52}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "TSTypeAliasDeclaration", + "start":0,"end":52,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":52}}, + "id": { + "type": "Identifier", + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"T"}, + "name": "T" + }, + "typeParameters": { + "type": "TSTypeParameterDeclaration", + "start":6,"end":40,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":40}}, + "params": [ + { + "type": "TSTypeParameter", + "start":7,"end":39,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":39}}, + "name": "U", + "constraint": { + "type": "TSObjectKeyword", + "start":17,"end":23,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":23}} + }, + "default": { + "type": "TSTypeLiteral", + "start":26,"end":39,"loc":{"start":{"line":1,"column":26},"end":{"line":1,"column":39}}, + "members": [ + { + "type": "TSPropertySignature", + "start":28,"end":37,"loc":{"start":{"line":1,"column":28},"end":{"line":1,"column":37}}, + "key": { + "type": "Identifier", + "start":28,"end":29,"loc":{"start":{"line":1,"column":28},"end":{"line":1,"column":29},"identifierName":"x"}, + "name": "x" + }, + "computed": false, + "typeAnnotation": { + "type": "TSTypeAnnotation", + "start":29,"end":37,"loc":{"start":{"line":1,"column":29},"end":{"line":1,"column":37}}, + "typeAnnotation": { + "type": "TSNumberKeyword", + "start":31,"end":37,"loc":{"start":{"line":1,"column":31},"end":{"line":1,"column":37}} + } + } + } + ] + } + } + ] + }, + "typeAnnotation": { + "type": "TSTypeReference", + "start":43,"end":51,"loc":{"start":{"line":1,"column":43},"end":{"line":1,"column":51}}, + "typeName": { + "type": "Identifier", + "start":43,"end":48,"loc":{"start":{"line":1,"column":43},"end":{"line":1,"column":48},"identifierName":"Array"}, + "name": "Array" + }, + "typeParameters": { + "type": "TSTypeParameterInstantiation", + "start":48,"end":51,"loc":{"start":{"line":1,"column":48},"end":{"line":1,"column":51}}, + "params": [ + { + "type": "TSTypeReference", + "start":49,"end":50,"loc":{"start":{"line":1,"column":49},"end":{"line":1,"column":50}}, + "typeName": { + "type": "Identifier", + "start":49,"end":50,"loc":{"start":{"line":1,"column":49},"end":{"line":1,"column":50},"identifierName":"U"}, + "name": "U" + } + } + ] + } + } + } + ], + "directives": [] + }, + "tokens": [ + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "type", + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}} + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "T", + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6}} + }, + { + "type": { + "label": "/<=/>=", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": 7, + "updateContext": null + }, + "value": "<", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7}} + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "U", + "start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8}} + }, + { + "type": { + "label": "extends", + "keyword": "extends", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "extends", + "start":9,"end":16,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":16}} + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "object", + "start":17,"end":23,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":23}} + }, + { + "type": { + "label": "=", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": true, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "=", + "start":24,"end":25,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":25}} + }, + { + "type": { + "label": "{", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start":26,"end":27,"loc":{"start":{"line":1,"column":26},"end":{"line":1,"column":27}} + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "x", + "start":28,"end":29,"loc":{"start":{"line":1,"column":28},"end":{"line":1,"column":29}} + }, + { + "type": { + "label": ":", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start":29,"end":30,"loc":{"start":{"line":1,"column":29},"end":{"line":1,"column":30}} + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "number", + "start":31,"end":37,"loc":{"start":{"line":1,"column":31},"end":{"line":1,"column":37}} + }, + { + "type": { + "label": "}", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start":38,"end":39,"loc":{"start":{"line":1,"column":38},"end":{"line":1,"column":39}} + }, + { + "type": { + "label": "/<=/>=", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": 7, + "updateContext": null + }, + "value": ">", + "start":39,"end":40,"loc":{"start":{"line":1,"column":39},"end":{"line":1,"column":40}} + }, + { + "type": { + "label": "=", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": true, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "=", + "start":41,"end":42,"loc":{"start":{"line":1,"column":41},"end":{"line":1,"column":42}} + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "Array", + "start":43,"end":48,"loc":{"start":{"line":1,"column":43},"end":{"line":1,"column":48}} + }, + { + "type": { + "label": "/<=/>=", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": 7, + "updateContext": null + }, + "value": "<", + "start":48,"end":49,"loc":{"start":{"line":1,"column":48},"end":{"line":1,"column":49}} + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "U", + "start":49,"end":50,"loc":{"start":{"line":1,"column":49},"end":{"line":1,"column":50}} + }, + { + "type": { + "label": "/<=/>=", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": 7, + "updateContext": null + }, + "value": ">", + "start":50,"end":51,"loc":{"start":{"line":1,"column":50},"end":{"line":1,"column":51}} + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start":51,"end":52,"loc":{"start":{"line":1,"column":51},"end":{"line":1,"column":52}} + }, + { + "type": { + "label": "eof", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start":52,"end":52,"loc":{"start":{"line":1,"column":52},"end":{"line":1,"column":52}} + } + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/type-alias/generic-complex/output.json b/packages/babel-parser/test/fixtures/typescript/type-alias/generic-complex/output.json deleted file mode 100644 index 1e07768dcafd..000000000000 --- a/packages/babel-parser/test/fixtures/typescript/type-alias/generic-complex/output.json +++ /dev/null @@ -1,276 +0,0 @@ -{ - "type": "File", - "start": 0, - "end": 52, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 52 - } - }, - "program": { - "type": "Program", - "start": 0, - "end": 52, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 52 - } - }, - "sourceType": "module", - "interpreter": null, - "body": [ - { - "type": "TSTypeAliasDeclaration", - "start": 0, - "end": 52, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 52 - } - }, - "id": { - "type": "Identifier", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "T" - }, - "name": "T" - }, - "typeParameters": { - "type": "TSTypeParameterDeclaration", - "start": 6, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 40 - } - }, - "params": [ - { - "type": "TSTypeParameter", - "start": 7, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 39 - } - }, - "name": "U", - "constraint": { - "type": "TSObjectKeyword", - "start": 17, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 23 - } - } - }, - "default": { - "type": "TSTypeLiteral", - "start": 26, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 39 - } - }, - "members": [ - { - "type": "TSPropertySignature", - "start": 28, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 37 - } - }, - "key": { - "type": "Identifier", - "start": 28, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 29 - }, - "identifierName": "x" - }, - "name": "x" - }, - "computed": false, - "typeAnnotation": { - "type": "TSTypeAnnotation", - "start": 29, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 1, - "column": 37 - } - }, - "typeAnnotation": { - "type": "TSNumberKeyword", - "start": 31, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 31 - }, - "end": { - "line": 1, - "column": 37 - } - } - } - } - } - ] - } - } - ] - }, - "typeAnnotation": { - "type": "TSTypeReference", - "start": 43, - "end": 51, - "loc": { - "start": { - "line": 1, - "column": 43 - }, - "end": { - "line": 1, - "column": 51 - } - }, - "typeName": { - "type": "Identifier", - "start": 43, - "end": 48, - "loc": { - "start": { - "line": 1, - "column": 43 - }, - "end": { - "line": 1, - "column": 48 - }, - "identifierName": "Array" - }, - "name": "Array" - }, - "typeParameters": { - "type": "TSTypeParameterInstantiation", - "start": 48, - "end": 51, - "loc": { - "start": { - "line": 1, - "column": 48 - }, - "end": { - "line": 1, - "column": 51 - } - }, - "params": [ - { - "type": "TSTypeReference", - "start": 49, - "end": 50, - "loc": { - "start": { - "line": 1, - "column": 49 - }, - "end": { - "line": 1, - "column": 50 - } - }, - "typeName": { - "type": "Identifier", - "start": 49, - "end": 50, - "loc": { - "start": { - "line": 1, - "column": 49 - }, - "end": { - "line": 1, - "column": 50 - }, - "identifierName": "U" - }, - "name": "U" - } - } - ] - } - } - } - ], - "directives": [] - } -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/type-alias/generic/output.json b/packages/babel-parser/test/fixtures/typescript/type-alias/generic/output.json index 914be894cb88..436c0c9bfea0 100644 --- a/packages/babel-parser/test/fixtures/typescript/type-alias/generic/output.json +++ b/packages/babel-parser/test/fixtures/typescript/type-alias/generic/output.json @@ -1,127 +1,37 @@ { "type": "File", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "program": { "type": "Program", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "TSTypeAliasDeclaration", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "id": { "type": "Identifier", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "T" - }, + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"T"}, "name": "T" }, "typeParameters": { "type": "TSTypeParameterDeclaration", - "start": 6, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":6,"end":9,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":9}}, "params": [ { "type": "TSTypeParameter", - "start": 7, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8}}, "name": "U" } ] }, "typeAnnotation": { "type": "TSTypeReference", - "start": 12, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":12,"end":13,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":13}}, "typeName": { "type": "Identifier", - "start": 12, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - }, - "identifierName": "U" - }, + "start":12,"end":13,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":13},"identifierName":"U"}, "name": "U" } } diff --git a/packages/babel-parser/test/fixtures/typescript/type-alias/plain/output.json b/packages/babel-parser/test/fixtures/typescript/type-alias/plain/output.json index 6cb892434456..e267751ff08c 100644 --- a/packages/babel-parser/test/fixtures/typescript/type-alias/plain/output.json +++ b/packages/babel-parser/test/fixtures/typescript/type-alias/plain/output.json @@ -1,79 +1,23 @@ { "type": "File", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "program": { "type": "Program", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "TSTypeAliasDeclaration", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "id": { "type": "Identifier", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "T" - }, + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"T"}, "name": "T" }, "typeAnnotation": { "type": "TSNumberKeyword", - "start": 9, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 15 - } - } + "start":9,"end":15,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":15}} } } ], diff --git a/packages/babel-parser/test/fixtures/typescript/type-arguments/call/output.json b/packages/babel-parser/test/fixtures/typescript/type-arguments/call/output.json index 5b329de3547b..2f64bc6a46b7 100644 --- a/packages/babel-parser/test/fixtures/typescript/type-arguments/call/output.json +++ b/packages/babel-parser/test/fixtures/typescript/type-arguments/call/output.json @@ -1,124 +1,34 @@ { "type": "File", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 10 - } - }, + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":10}}, "program": { "type": "Program", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 10 - } - }, + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":10}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "expression": { "type": "CallExpression", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "callee": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "f" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"f"}, "name": "f" }, "arguments": [], "typeParameters": { "type": "TSTypeParameterInstantiation", - "start": 1, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 4 - } - }, + "start":1,"end":4,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":4}}, "params": [ { "type": "TSTypeReference", - "start": 2, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 3 - } - }, + "start":2,"end":3,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":3}}, "typeName": { "type": "Identifier", - "start": 2, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 3 - }, - "identifierName": "T" - }, + "start":2,"end":3,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":3},"identifierName":"T"}, "name": "T" } } @@ -128,126 +38,35 @@ }, { "type": "ExpressionStatement", - "start": 8, - "end": 18, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 10 - } - }, + "start":8,"end":18,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":10}}, "expression": { "type": "CallExpression", - "start": 8, - "end": 17, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 9 - } - }, + "start":8,"end":17,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":9}}, "callee": { "type": "Identifier", - "start": 8, - "end": 9, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 1 - }, - "identifierName": "f" - }, + "start":8,"end":9,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":1},"identifierName":"f"}, "name": "f" }, "arguments": [], "typeParameters": { "type": "TSTypeParameterInstantiation", - "start": 9, - "end": 15, - "loc": { - "start": { - "line": 2, - "column": 1 - }, - "end": { - "line": 2, - "column": 7 - } - }, + "start":9,"end":15,"loc":{"start":{"line":2,"column":1},"end":{"line":2,"column":7}}, "params": [ { "type": "TSTypeReference", - "start": 10, - "end": 11, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 3 - } - }, + "start":10,"end":11,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":3}}, "typeName": { "type": "Identifier", - "start": 10, - "end": 11, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 3 - }, - "identifierName": "T" - }, + "start":10,"end":11,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":3},"identifierName":"T"}, "name": "T" } }, { "type": "TSTypeReference", - "start": 13, - "end": 14, - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 6 - } - }, + "start":13,"end":14,"loc":{"start":{"line":2,"column":5},"end":{"line":2,"column":6}}, "typeName": { "type": "Identifier", - "start": 13, - "end": 14, - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 6 - }, - "identifierName": "U" - }, + "start":13,"end":14,"loc":{"start":{"line":2,"column":5},"end":{"line":2,"column":6},"identifierName":"U"}, "name": "U" } } diff --git a/packages/babel-parser/test/fixtures/typescript/type-arguments/empty/output.json b/packages/babel-parser/test/fixtures/typescript/type-arguments/empty/output.json index ce11198360c5..7de727879d7a 100644 --- a/packages/babel-parser/test/fixtures/typescript/type-arguments/empty/output.json +++ b/packages/babel-parser/test/fixtures/typescript/type-arguments/empty/output.json @@ -1,94 +1,27 @@ { "type": "File", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "program": { "type": "Program", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "expression": { "type": "CallExpression", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "callee": { "type": "Identifier", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - }, - "identifierName": "foo" - }, + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3},"identifierName":"foo"}, "name": "foo" }, "arguments": [], "typeParameters": { "type": "TSTypeParameterInstantiation", - "start": 3, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":3,"end":5,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":5}}, "params": [] } } diff --git a/packages/babel-parser/test/fixtures/typescript/type-arguments/new-false-positive/output.json b/packages/babel-parser/test/fixtures/typescript/type-arguments/new-false-positive/output.json index f648588de12f..b2b541d1bee6 100644 --- a/packages/babel-parser/test/fixtures/typescript/type-arguments/new-false-positive/output.json +++ b/packages/babel-parser/test/fixtures/typescript/type-arguments/new-false-positive/output.json @@ -1,91 +1,24 @@ { "type": "File", - "start": 0, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, "program": { "type": "Program", - "start": 0, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, "expression": { "type": "BinaryExpression", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "left": { "type": "NewExpression", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, "callee": { "type": "Identifier", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "A" - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"A"}, "name": "A" }, "arguments": [] @@ -93,19 +26,7 @@ "operator": "<", "right": { "type": "Identifier", - "start": 8, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "T" - }, + "start":8,"end":9,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":9},"identifierName":"T"}, "name": "T" } } diff --git a/packages/babel-parser/test/fixtures/typescript/type-arguments/new/output.json b/packages/babel-parser/test/fixtures/typescript/type-arguments/new/output.json index 692ded13ea7d..5071d457d79b 100644 --- a/packages/babel-parser/test/fixtures/typescript/type-arguments/new/output.json +++ b/packages/babel-parser/test/fixtures/typescript/type-arguments/new/output.json @@ -1,123 +1,33 @@ { "type": "File", - "start": 0, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 14 - } - }, + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":14}}, "program": { "type": "Program", - "start": 0, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 14 - } - }, + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":14}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "expression": { "type": "NewExpression", - "start": 0, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, "callee": { "type": "Identifier", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "C" - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"C"}, "name": "C" }, "typeParameters": { "type": "TSTypeParameterInstantiation", - "start": 5, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":5,"end":8,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":8}}, "params": [ { "type": "TSTypeReference", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7}}, "typeName": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "T" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"T"}, "name": "T" } } @@ -128,125 +38,34 @@ }, { "type": "ExpressionStatement", - "start": 12, - "end": 26, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 14 - } - }, + "start":12,"end":26,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":14}}, "expression": { "type": "NewExpression", - "start": 12, - "end": 25, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 13 - } - }, + "start":12,"end":25,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":13}}, "callee": { "type": "Identifier", - "start": 16, - "end": 17, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 5 - }, - "identifierName": "C" - }, + "start":16,"end":17,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":5},"identifierName":"C"}, "name": "C" }, "typeParameters": { "type": "TSTypeParameterInstantiation", - "start": 17, - "end": 23, - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 11 - } - }, + "start":17,"end":23,"loc":{"start":{"line":2,"column":5},"end":{"line":2,"column":11}}, "params": [ { "type": "TSTypeReference", - "start": 18, - "end": 19, - "loc": { - "start": { - "line": 2, - "column": 6 - }, - "end": { - "line": 2, - "column": 7 - } - }, + "start":18,"end":19,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":7}}, "typeName": { "type": "Identifier", - "start": 18, - "end": 19, - "loc": { - "start": { - "line": 2, - "column": 6 - }, - "end": { - "line": 2, - "column": 7 - }, - "identifierName": "T" - }, + "start":18,"end":19,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":7},"identifierName":"T"}, "name": "T" } }, { "type": "TSTypeReference", - "start": 21, - "end": 22, - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 10 - } - }, + "start":21,"end":22,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":10}}, "typeName": { "type": "Identifier", - "start": 21, - "end": 22, - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 10 - }, - "identifierName": "U" - }, + "start":21,"end":22,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":10},"identifierName":"U"}, "name": "U" } } diff --git a/packages/babel-parser/test/fixtures/typescript/type-arguments/tagged-template-no-asi/output.json b/packages/babel-parser/test/fixtures/typescript/type-arguments/tagged-template-no-asi/output.json index 8721061b7f18..a5917216b2ff 100644 --- a/packages/babel-parser/test/fixtures/typescript/type-arguments/tagged-template-no-asi/output.json +++ b/packages/babel-parser/test/fixtures/typescript/type-arguments/tagged-template-no-asi/output.json @@ -1,123 +1,34 @@ { "type": "File", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 2 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":2}}, "program": { "type": "Program", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 2 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":2}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 2 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":2}}, "expression": { "type": "NewExpression", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 2 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":2}}, "callee": { "type": "TaggedTemplateExpression", - "start": 4, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 2, - "column": 2 - } - }, + "start":4,"end":11,"loc":{"start":{"line":1,"column":4},"end":{"line":2,"column":2}}, "tag": { "type": "Identifier", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "C" - }, + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"C"}, "name": "C" }, "quasi": { "type": "TemplateLiteral", - "start": 9, - "end": 11, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 2 - } - }, + "start":9,"end":11,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":2}}, "expressions": [], "quasis": [ { "type": "TemplateElement", - "start": 10, - "end": 10, - "loc": { - "start": { - "line": 2, - "column": 1 - }, - "end": { - "line": 2, - "column": 1 - } - }, + "start":10,"end":10,"loc":{"start":{"line":2,"column":1},"end":{"line":2,"column":1}}, "value": { "raw": "", "cooked": "" @@ -128,48 +39,14 @@ }, "typeParameters": { "type": "TSTypeParameterInstantiation", - "start": 5, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":5,"end":8,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":8}}, "params": [ { "type": "TSTypeReference", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7}}, "typeName": { "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "T" - }, + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"T"}, "name": "T" } } diff --git a/packages/babel-parser/test/fixtures/typescript/type-arguments/tagged-template/output.json b/packages/babel-parser/test/fixtures/typescript/type-arguments/tagged-template/output.json index c8b549d70049..6063c08f37d4 100644 --- a/packages/babel-parser/test/fixtures/typescript/type-arguments/tagged-template/output.json +++ b/packages/babel-parser/test/fixtures/typescript/type-arguments/tagged-template/output.json @@ -1,109 +1,31 @@ { "type": "File", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "program": { "type": "Program", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, "expression": { "type": "TaggedTemplateExpression", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, "tag": { "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "f" - }, + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"f"}, "name": "f" }, "quasi": { "type": "TemplateLiteral", - "start": 4, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 6 - } - }, + "start":4,"end":6,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":6}}, "expressions": [], "quasis": [ { "type": "TemplateElement", - "start": 5, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 5 - } - }, + "start":5,"end":5,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":5}}, "value": { "raw": "", "cooked": "" @@ -114,48 +36,14 @@ }, "typeParameters": { "type": "TSTypeParameterInstantiation", - "start": 1, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 4 - } - }, + "start":1,"end":4,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":4}}, "params": [ { "type": "TSTypeReference", - "start": 2, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 3 - } - }, + "start":2,"end":3,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":3}}, "typeName": { "type": "Identifier", - "start": 2, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 3 - }, - "identifierName": "T" - }, + "start":2,"end":3,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":3},"identifierName":"T"}, "name": "T" } } diff --git a/packages/babel-parser/test/fixtures/typescript/type-arguments/tsx/output.json b/packages/babel-parser/test/fixtures/typescript/type-arguments/tsx/output.json index 15f1e7ebdee1..94c356bcf7d7 100644 --- a/packages/babel-parser/test/fixtures/typescript/type-arguments/tsx/output.json +++ b/packages/babel-parser/test/fixtures/typescript/type-arguments/tsx/output.json @@ -1,121 +1,33 @@ { "type": "File", - "start": 0, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 13 - } - }, + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":13}}, "program": { "type": "Program", - "start": 0, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 13 - } - }, + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":13}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "expression": { "type": "JSXElement", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "openingElement": { "type": "JSXOpeningElement", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "name": { "type": "JSXIdentifier", - "start": 1, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - } - }, + "start":1,"end":2,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":2}}, "name": "C" }, "typeParameters": { "type": "TSTypeParameterInstantiation", - "start": 2, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":2,"end":10,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":10}}, "params": [ { "type": "TSNumberKeyword", - "start": 3, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 9 - } - } + "start":3,"end":9,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":9}} } ] }, @@ -124,32 +36,10 @@ }, "closingElement": { "type": "JSXClosingElement", - "start": 11, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":11,"end":15,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":15}}, "name": { "type": "JSXIdentifier", - "start": 13, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":13,"end":14,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":14}}, "name": "C" } }, @@ -158,91 +48,25 @@ }, { "type": "ExpressionStatement", - "start": 17, - "end": 30, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 13 - } - }, + "start":17,"end":30,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":13}}, "expression": { "type": "JSXElement", - "start": 17, - "end": 29, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 12 - } - }, + "start":17,"end":29,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":12}}, "openingElement": { "type": "JSXOpeningElement", - "start": 17, - "end": 29, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 12 - } - }, + "start":17,"end":29,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":12}}, "name": { "type": "JSXIdentifier", - "start": 18, - "end": 19, - "loc": { - "start": { - "line": 2, - "column": 1 - }, - "end": { - "line": 2, - "column": 2 - } - }, + "start":18,"end":19,"loc":{"start":{"line":2,"column":1},"end":{"line":2,"column":2}}, "name": "C" }, "typeParameters": { "type": "TSTypeParameterInstantiation", - "start": 19, - "end": 27, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 10 - } - }, + "start":19,"end":27,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":10}}, "params": [ { "type": "TSNumberKeyword", - "start": 20, - "end": 26, - "loc": { - "start": { - "line": 2, - "column": 3 - }, - "end": { - "line": 2, - "column": 9 - } - } + "start":20,"end":26,"loc":{"start":{"line":2,"column":3},"end":{"line":2,"column":9}} } ] }, diff --git a/packages/babel-parser/test/fixtures/typescript/type-arguments/whitespace/output.json b/packages/babel-parser/test/fixtures/typescript/type-arguments/whitespace/output.json index 88035f30fd28..503d9fd01ccf 100644 --- a/packages/babel-parser/test/fixtures/typescript/type-arguments/whitespace/output.json +++ b/packages/babel-parser/test/fixtures/typescript/type-arguments/whitespace/output.json @@ -1,96 +1,29 @@ { "type": "File", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "program": { "type": "Program", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, "id": { "type": "Identifier", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - }, - "identifierName": "f" - }, + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"f"}, "name": "f" }, "generator": false, "async": false, "typeParameters": { "type": "TSTypeParameterDeclaration", - "start": 10, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":10,"end":19,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":19}}, "params": [ { "type": "TSTypeParameter", - "start": 13, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":13,"end":14,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":14}}, "name": "T" } ] @@ -98,18 +31,7 @@ "params": [], "body": { "type": "BlockStatement", - "start": 22, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":22,"end":24,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":24}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/typescript/types/array/output.json b/packages/babel-parser/test/fixtures/typescript/types/array/output.json index b710e28b8d21..84bd90c471de 100644 --- a/packages/babel-parser/test/fixtures/typescript/types/array/output.json +++ b/packages/babel-parser/test/fixtures/typescript/types/array/output.json @@ -1,135 +1,35 @@ { "type": "File", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, "program": { "type": "Program", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":4,"end":19,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":19}}, "id": { "type": "Identifier", - "start": 4, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 19 - }, - "identifierName": "arr" - }, + "start":4,"end":19,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":19},"identifierName":"arr"}, "name": "arr", "typeAnnotation": { "type": "TSTypeAnnotation", - "start": 7, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":7,"end":19,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":19}}, "typeAnnotation": { "type": "TSArrayType", - "start": 9, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":9,"end":19,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":19}}, "elementType": { "type": "TSArrayType", - "start": 9, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":9,"end":17,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":17}}, "elementType": { "type": "TSNumberKeyword", - "start": 9, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 15 - } - } + "start":9,"end":15,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":15}} } } } diff --git a/packages/babel-parser/test/fixtures/typescript/types/conditional-infer/output.json b/packages/babel-parser/test/fixtures/typescript/types/conditional-infer/output.json index 221b2e1d9d4a..72dae30c84ec 100644 --- a/packages/babel-parser/test/fixtures/typescript/types/conditional-infer/output.json +++ b/packages/babel-parser/test/fixtures/typescript/types/conditional-infer/output.json @@ -1,200 +1,55 @@ { "type": "File", - "start": 0, - "end": 48, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 48 - } - }, + "start":0,"end":48,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":48}}, "program": { "type": "Program", - "start": 0, - "end": 48, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 48 - } - }, + "start":0,"end":48,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":48}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "TSTypeAliasDeclaration", - "start": 0, - "end": 48, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 48 - } - }, + "start":0,"end":48,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":48}}, "id": { "type": "Identifier", - "start": 5, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "Element" - }, + "start":5,"end":12,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":12},"identifierName":"Element"}, "name": "Element" }, "typeParameters": { "type": "TSTypeParameterDeclaration", - "start": 12, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":12,"end":15,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":15}}, "params": [ { "type": "TSTypeParameter", - "start": 13, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":13,"end":14,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":14}}, "name": "T" } ] }, "typeAnnotation": { "type": "TSConditionalType", - "start": 18, - "end": 47, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 47 - } - }, + "start":18,"end":47,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":47}}, "checkType": { "type": "TSTypeReference", - "start": 18, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - } - }, + "start":18,"end":19,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":19}}, "typeName": { "type": "Identifier", - "start": 18, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - }, - "identifierName": "T" - }, + "start":18,"end":19,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":19},"identifierName":"T"}, "name": "T" } }, "extendsType": { "type": "TSArrayType", - "start": 28, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 39 - } - }, + "start":28,"end":39,"loc":{"start":{"line":1,"column":28},"end":{"line":1,"column":39}}, "elementType": { "type": "TSParenthesizedType", - "start": 28, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 37 - } - }, + "start":28,"end":37,"loc":{"start":{"line":1,"column":28},"end":{"line":1,"column":37}}, "typeAnnotation": { "type": "TSInferType", - "start": 29, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":29,"end":36,"loc":{"start":{"line":1,"column":29},"end":{"line":1,"column":36}}, "typeParameter": { "type": "TSTypeParameter", - "start": 35, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 35 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":35,"end":36,"loc":{"start":{"line":1,"column":35},"end":{"line":1,"column":36}}, "name": "U" } } @@ -202,65 +57,19 @@ }, "trueType": { "type": "TSTypeReference", - "start": 42, - "end": 43, - "loc": { - "start": { - "line": 1, - "column": 42 - }, - "end": { - "line": 1, - "column": 43 - } - }, + "start":42,"end":43,"loc":{"start":{"line":1,"column":42},"end":{"line":1,"column":43}}, "typeName": { "type": "Identifier", - "start": 42, - "end": 43, - "loc": { - "start": { - "line": 1, - "column": 42 - }, - "end": { - "line": 1, - "column": 43 - }, - "identifierName": "U" - }, + "start":42,"end":43,"loc":{"start":{"line":1,"column":42},"end":{"line":1,"column":43},"identifierName":"U"}, "name": "U" } }, "falseType": { "type": "TSTypeReference", - "start": 46, - "end": 47, - "loc": { - "start": { - "line": 1, - "column": 46 - }, - "end": { - "line": 1, - "column": 47 - } - }, + "start":46,"end":47,"loc":{"start":{"line":1,"column":46},"end":{"line":1,"column":47}}, "typeName": { "type": "Identifier", - "start": 46, - "end": 47, - "loc": { - "start": { - "line": 1, - "column": 46 - }, - "end": { - "line": 1, - "column": 47 - }, - "identifierName": "T" - }, + "start":46,"end":47,"loc":{"start":{"line":1,"column":46},"end":{"line":1,"column":47},"identifierName":"T"}, "name": "T" } } diff --git a/packages/babel-parser/test/fixtures/typescript/types/conditional/output.json b/packages/babel-parser/test/fixtures/typescript/types/conditional/output.json index 39c42538452b..6917332b04ae 100644 --- a/packages/babel-parser/test/fixtures/typescript/types/conditional/output.json +++ b/packages/babel-parser/test/fixtures/typescript/types/conditional/output.json @@ -1,166 +1,44 @@ { "type": "File", - "start": 0, - "end": 46, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 46 - } - }, + "start":0,"end":46,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":46}}, "program": { "type": "Program", - "start": 0, - "end": 46, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 46 - } - }, + "start":0,"end":46,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":46}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 46, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 46 - } - }, + "start":0,"end":46,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":46}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 45, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 45 - } - }, + "start":4,"end":45,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":45}}, "id": { "type": "Identifier", - "start": 4, - "end": 45, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 45 - }, - "identifierName": "x" - }, + "start":4,"end":45,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":45},"identifierName":"x"}, "name": "x", "typeAnnotation": { "type": "TSTypeAnnotation", - "start": 5, - "end": 45, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 45 - } - }, + "start":5,"end":45,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":45}}, "typeAnnotation": { "type": "TSConditionalType", - "start": 7, - "end": 45, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 45 - } - }, + "start":7,"end":45,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":45}}, "checkType": { "type": "TSNumberKeyword", - "start": 7, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 13 - } - } + "start":7,"end":13,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":13}} }, "extendsType": { "type": "TSStringKeyword", - "start": 22, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 28 - } - } + "start":22,"end":28,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":28}} }, "trueType": { "type": "TSBooleanKeyword", - "start": 31, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 31 - }, - "end": { - "line": 1, - "column": 38 - } - } + "start":31,"end":38,"loc":{"start":{"line":1,"column":31},"end":{"line":1,"column":38}} }, "falseType": { "type": "TSNullKeyword", - "start": 41, - "end": 45, - "loc": { - "start": { - "line": 1, - "column": 41 - }, - "end": { - "line": 1, - "column": 45 - } - } + "start":41,"end":45,"loc":{"start":{"line":1,"column":41},"end":{"line":1,"column":45}} } } } diff --git a/packages/babel-parser/test/fixtures/typescript/types/function-generic/output.json b/packages/babel-parser/test/fixtures/typescript/types/function-generic/output.json index eeb30b1574ec..e359150e7331 100644 --- a/packages/babel-parser/test/fixtures/typescript/types/function-generic/output.json +++ b/packages/babel-parser/test/fixtures/typescript/types/function-generic/output.json @@ -1,136 +1,36 @@ { "type": "File", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "program": { "type": "Program", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":4,"end":21,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":21}}, "id": { "type": "Identifier", - "start": 4, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 21 - }, - "identifierName": "f" - }, + "start":4,"end":21,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":21},"identifierName":"f"}, "name": "f", "typeAnnotation": { "type": "TSTypeAnnotation", - "start": 5, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":5,"end":21,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":21}}, "typeAnnotation": { "type": "TSFunctionType", - "start": 7, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":7,"end":21,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":21}}, "typeParameters": { "type": "TSTypeParameterDeclaration", - "start": 7, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":7,"end":10,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":10}}, "params": [ { "type": "TSTypeParameter", - "start": 8, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":8,"end":9,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":9}}, "name": "T" } ] @@ -138,63 +38,17 @@ "parameters": [ { "type": "Identifier", - "start": 11, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 15 - }, - "identifierName": "a" - }, + "start":11,"end":15,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":15},"identifierName":"a"}, "name": "a", "typeAnnotation": { "type": "TSTypeAnnotation", - "start": 12, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":12,"end":15,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":15}}, "typeAnnotation": { "type": "TSTypeReference", - "start": 14, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":14,"end":15,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":15}}, "typeName": { "type": "Identifier", - "start": 14, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - }, - "identifierName": "T" - }, + "start":14,"end":15,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":15},"identifierName":"T"}, "name": "T" } } @@ -203,47 +57,13 @@ ], "typeAnnotation": { "type": "TSTypeAnnotation", - "start": 17, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":17,"end":21,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":21}}, "typeAnnotation": { "type": "TSTypeReference", - "start": 20, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":20,"end":21,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":21}}, "typeName": { "type": "Identifier", - "start": 20, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 21 - }, - "identifierName": "T" - }, + "start":20,"end":21,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":21},"identifierName":"T"}, "name": "T" } } diff --git a/packages/babel-parser/test/fixtures/typescript/types/function-in-generic/output.json b/packages/babel-parser/test/fixtures/typescript/types/function-in-generic/output.json index 708c18dc7c5b..9a7acd6e5985 100644 --- a/packages/babel-parser/test/fixtures/typescript/types/function-in-generic/output.json +++ b/packages/babel-parser/test/fixtures/typescript/types/function-in-generic/output.json @@ -1,182 +1,48 @@ { "type": "File", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, "program": { "type": "Program", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":4,"end":24,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":24}}, "id": { "type": "Identifier", - "start": 4, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 24 - }, - "identifierName": "x" - }, + "start":4,"end":24,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":24},"identifierName":"x"}, "name": "x", "typeAnnotation": { "type": "TSTypeAnnotation", - "start": 5, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":5,"end":24,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":24}}, "typeAnnotation": { "type": "TSTypeReference", - "start": 7, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":7,"end":24,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":24}}, "typeName": { "type": "Identifier", - "start": 7, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "Array" - }, + "start":7,"end":12,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":12},"identifierName":"Array"}, "name": "Array" }, "typeParameters": { "type": "TSTypeParameterInstantiation", - "start": 12, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":12,"end":24,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":24}}, "params": [ { "type": "TSFunctionType", - "start": 13, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":13,"end":23,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":23}}, "parameters": [], "typeAnnotation": { "type": "TSTypeAnnotation", - "start": 16, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":16,"end":23,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":23}}, "typeAnnotation": { "type": "TSVoidKeyword", - "start": 19, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 23 - } - } + "start":19,"end":23,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":23}} } } } diff --git a/packages/babel-parser/test/fixtures/typescript/types/function-with-this/output.json b/packages/babel-parser/test/fixtures/typescript/types/function-with-this/output.json index 91e208a34f9c..cae696cfb551 100644 --- a/packages/babel-parser/test/fixtures/typescript/types/function-with-this/output.json +++ b/packages/babel-parser/test/fixtures/typescript/types/function-with-this/output.json @@ -1,184 +1,50 @@ { "type": "File", - "start": 0, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, "program": { "type": "Program", - "start": 0, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 30 - } - }, + "start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":4,"end":29,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":29}}, "id": { "type": "Identifier", - "start": 4, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 29 - }, - "identifierName": "f" - }, + "start":4,"end":29,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":29},"identifierName":"f"}, "name": "f", "typeAnnotation": { "type": "TSTypeAnnotation", - "start": 5, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":5,"end":29,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":29}}, "typeAnnotation": { "type": "TSFunctionType", - "start": 7, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":7,"end":29,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":29}}, "parameters": [ { "type": "Identifier", - "start": 8, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 20 - }, - "identifierName": "this" - }, + "start":8,"end":20,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":20},"identifierName":"this"}, "name": "this", "typeAnnotation": { "type": "TSTypeAnnotation", - "start": 12, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":12,"end":20,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":20}}, "typeAnnotation": { "type": "TSNumberKeyword", - "start": 14, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 20 - } - } + "start":14,"end":20,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":20}} } } } ], "typeAnnotation": { "type": "TSTypeAnnotation", - "start": 22, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":22,"end":29,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":29}}, "typeAnnotation": { "type": "TSVoidKeyword", - "start": 25, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 29 - } - } + "start":25,"end":29,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":29}} } } } diff --git a/packages/babel-parser/test/fixtures/typescript/types/function/output.json b/packages/babel-parser/test/fixtures/typescript/types/function/output.json index be6f63c9ee51..454bedceab87 100644 --- a/packages/babel-parser/test/fixtures/typescript/types/function/output.json +++ b/packages/babel-parser/test/fixtures/typescript/types/function/output.json @@ -1,276 +1,74 @@ { "type": "File", - "start": 0, - "end": 55, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 55 - } - }, + "start":0,"end":55,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":55}}, "program": { "type": "Program", - "start": 0, - "end": 55, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 55 - } - }, + "start":0,"end":55,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":55}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 55, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 55 - } - }, + "start":0,"end":55,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":55}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 54, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 54 - } - }, + "start":4,"end":54,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":54}}, "id": { "type": "Identifier", - "start": 4, - "end": 54, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 54 - }, - "identifierName": "f" - }, + "start":4,"end":54,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":54},"identifierName":"f"}, "name": "f", "typeAnnotation": { "type": "TSTypeAnnotation", - "start": 5, - "end": 54, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 54 - } - }, + "start":5,"end":54,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":54}}, "typeAnnotation": { "type": "TSFunctionType", - "start": 7, - "end": 54, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 54 - } - }, + "start":7,"end":54,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":54}}, "parameters": [ { "type": "Identifier", - "start": 8, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 17 - }, - "identifierName": "a" - }, + "start":8,"end":17,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":17},"identifierName":"a"}, "name": "a", "typeAnnotation": { "type": "TSTypeAnnotation", - "start": 9, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":9,"end":17,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":17}}, "typeAnnotation": { "type": "TSNumberKeyword", - "start": 11, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 17 - } - } + "start":11,"end":17,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":17}} } } }, { "type": "Identifier", - "start": 19, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 29 - }, - "identifierName": "b" - }, + "start":19,"end":29,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":29},"identifierName":"b"}, "name": "b", "optional": true, "typeAnnotation": { "type": "TSTypeAnnotation", - "start": 21, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 29 - } - }, + "start":21,"end":29,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":29}}, "typeAnnotation": { "type": "TSNumberKeyword", - "start": 23, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 29 - } - } + "start":23,"end":29,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":29}} } } }, { "type": "RestElement", - "start": 31, - "end": 45, - "loc": { - "start": { - "line": 1, - "column": 31 - }, - "end": { - "line": 1, - "column": 45 - } - }, + "start":31,"end":45,"loc":{"start":{"line":1,"column":31},"end":{"line":1,"column":45}}, "argument": { "type": "Identifier", - "start": 34, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 34 - }, - "end": { - "line": 1, - "column": 35 - }, - "identifierName": "c" - }, + "start":34,"end":35,"loc":{"start":{"line":1,"column":34},"end":{"line":1,"column":35},"identifierName":"c"}, "name": "c" }, "typeAnnotation": { "type": "TSTypeAnnotation", - "start": 35, - "end": 45, - "loc": { - "start": { - "line": 1, - "column": 35 - }, - "end": { - "line": 1, - "column": 45 - } - }, + "start":35,"end":45,"loc":{"start":{"line":1,"column":35},"end":{"line":1,"column":45}}, "typeAnnotation": { "type": "TSArrayType", - "start": 37, - "end": 45, - "loc": { - "start": { - "line": 1, - "column": 37 - }, - "end": { - "line": 1, - "column": 45 - } - }, + "start":37,"end":45,"loc":{"start":{"line":1,"column":37},"end":{"line":1,"column":45}}, "elementType": { "type": "TSNumberKeyword", - "start": 37, - "end": 43, - "loc": { - "start": { - "line": 1, - "column": 37 - }, - "end": { - "line": 1, - "column": 43 - } - } + "start":37,"end":43,"loc":{"start":{"line":1,"column":37},"end":{"line":1,"column":43}} } } } @@ -278,32 +76,10 @@ ], "typeAnnotation": { "type": "TSTypeAnnotation", - "start": 47, - "end": 54, - "loc": { - "start": { - "line": 1, - "column": 47 - }, - "end": { - "line": 1, - "column": 54 - } - }, + "start":47,"end":54,"loc":{"start":{"line":1,"column":47},"end":{"line":1,"column":54}}, "typeAnnotation": { "type": "TSVoidKeyword", - "start": 50, - "end": 54, - "loc": { - "start": { - "line": 1, - "column": 50 - }, - "end": { - "line": 1, - "column": 54 - } - } + "start":50,"end":54,"loc":{"start":{"line":1,"column":50},"end":{"line":1,"column":54}} } } } diff --git a/packages/babel-parser/test/fixtures/typescript/types/import-type-declaration-error/input.ts b/packages/babel-parser/test/fixtures/typescript/types/import-type-declaration-error/input.ts new file mode 100644 index 000000000000..bcfb7c11d873 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/types/import-type-declaration-error/input.ts @@ -0,0 +1 @@ +import type FooDefault, { Bar, Baz } from "module"; \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/types/import-type-declaration-error/output.json b/packages/babel-parser/test/fixtures/typescript/types/import-type-declaration-error/output.json new file mode 100644 index 000000000000..3df1338cbc58 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/types/import-type-declaration-error/output.json @@ -0,0 +1,69 @@ +{ + "type": "File", + "start":0,"end":51,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":51}}, + "errors": [ + "SyntaxError: A type-only import can specify a default import or named bindings, but not both. (1:0)" + ], + "program": { + "type": "Program", + "start":0,"end":51,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":51}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ImportDeclaration", + "start":0,"end":51,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":51}}, + "importKind": "type", + "specifiers": [ + { + "type": "ImportDefaultSpecifier", + "start":12,"end":22,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":22}}, + "local": { + "type": "Identifier", + "start":12,"end":22,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":22},"identifierName":"FooDefault"}, + "name": "FooDefault" + } + }, + { + "type": "ImportSpecifier", + "start":26,"end":29,"loc":{"start":{"line":1,"column":26},"end":{"line":1,"column":29}}, + "imported": { + "type": "Identifier", + "start":26,"end":29,"loc":{"start":{"line":1,"column":26},"end":{"line":1,"column":29},"identifierName":"Bar"}, + "name": "Bar" + }, + "local": { + "type": "Identifier", + "start":26,"end":29,"loc":{"start":{"line":1,"column":26},"end":{"line":1,"column":29},"identifierName":"Bar"}, + "name": "Bar" + } + }, + { + "type": "ImportSpecifier", + "start":31,"end":34,"loc":{"start":{"line":1,"column":31},"end":{"line":1,"column":34}}, + "imported": { + "type": "Identifier", + "start":31,"end":34,"loc":{"start":{"line":1,"column":31},"end":{"line":1,"column":34},"identifierName":"Baz"}, + "name": "Baz" + }, + "local": { + "type": "Identifier", + "start":31,"end":34,"loc":{"start":{"line":1,"column":31},"end":{"line":1,"column":34},"identifierName":"Baz"}, + "name": "Baz" + } + } + ], + "source": { + "type": "StringLiteral", + "start":42,"end":50,"loc":{"start":{"line":1,"column":42},"end":{"line":1,"column":50}}, + "extra": { + "rawValue": "module", + "raw": "\"module\"" + }, + "value": "module" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/types/import-type-declaration/input.ts b/packages/babel-parser/test/fixtures/typescript/types/import-type-declaration/input.ts new file mode 100644 index 000000000000..2fcb758ba25f --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/types/import-type-declaration/input.ts @@ -0,0 +1,3 @@ +import type T from './mod'; +import type { A, B } from './mod'; +import type * as Types from './mod'; diff --git a/packages/babel-parser/test/fixtures/typescript/types/import-type-declaration/output.json b/packages/babel-parser/test/fixtures/typescript/types/import-type-declaration/output.json new file mode 100644 index 000000000000..b0f9cac40033 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/types/import-type-declaration/output.json @@ -0,0 +1,107 @@ +{ + "type": "File", + "start":0,"end":99,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":36}}, + "program": { + "type": "Program", + "start":0,"end":99,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":36}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ImportDeclaration", + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, + "importKind": "type", + "specifiers": [ + { + "type": "ImportDefaultSpecifier", + "start":12,"end":13,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":13}}, + "local": { + "type": "Identifier", + "start":12,"end":13,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":13},"identifierName":"T"}, + "name": "T" + } + } + ], + "source": { + "type": "StringLiteral", + "start":19,"end":26,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":26}}, + "extra": { + "rawValue": "./mod", + "raw": "'./mod'" + }, + "value": "./mod" + } + }, + { + "type": "ImportDeclaration", + "start":28,"end":62,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":34}}, + "importKind": "type", + "specifiers": [ + { + "type": "ImportSpecifier", + "start":42,"end":43,"loc":{"start":{"line":2,"column":14},"end":{"line":2,"column":15}}, + "imported": { + "type": "Identifier", + "start":42,"end":43,"loc":{"start":{"line":2,"column":14},"end":{"line":2,"column":15},"identifierName":"A"}, + "name": "A" + }, + "local": { + "type": "Identifier", + "start":42,"end":43,"loc":{"start":{"line":2,"column":14},"end":{"line":2,"column":15},"identifierName":"A"}, + "name": "A" + } + }, + { + "type": "ImportSpecifier", + "start":45,"end":46,"loc":{"start":{"line":2,"column":17},"end":{"line":2,"column":18}}, + "imported": { + "type": "Identifier", + "start":45,"end":46,"loc":{"start":{"line":2,"column":17},"end":{"line":2,"column":18},"identifierName":"B"}, + "name": "B" + }, + "local": { + "type": "Identifier", + "start":45,"end":46,"loc":{"start":{"line":2,"column":17},"end":{"line":2,"column":18},"identifierName":"B"}, + "name": "B" + } + } + ], + "source": { + "type": "StringLiteral", + "start":54,"end":61,"loc":{"start":{"line":2,"column":26},"end":{"line":2,"column":33}}, + "extra": { + "rawValue": "./mod", + "raw": "'./mod'" + }, + "value": "./mod" + } + }, + { + "type": "ImportDeclaration", + "start":63,"end":99,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":36}}, + "importKind": "type", + "specifiers": [ + { + "type": "ImportNamespaceSpecifier", + "start":75,"end":85,"loc":{"start":{"line":3,"column":12},"end":{"line":3,"column":22}}, + "local": { + "type": "Identifier", + "start":80,"end":85,"loc":{"start":{"line":3,"column":17},"end":{"line":3,"column":22},"identifierName":"Types"}, + "name": "Types" + } + } + ], + "source": { + "type": "StringLiteral", + "start":91,"end":98,"loc":{"start":{"line":3,"column":28},"end":{"line":3,"column":35}}, + "extra": { + "rawValue": "./mod", + "raw": "'./mod'" + }, + "value": "./mod" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/types/import/input.ts b/packages/babel-parser/test/fixtures/typescript/types/import-type-dynamic/input.ts similarity index 100% rename from packages/babel-parser/test/fixtures/typescript/types/import/input.ts rename to packages/babel-parser/test/fixtures/typescript/types/import-type-dynamic/input.ts diff --git a/packages/babel-parser/test/fixtures/typescript/types/import-type-dynamic/output.json b/packages/babel-parser/test/fixtures/typescript/types/import-type-dynamic/output.json new file mode 100644 index 000000000000..0c20c2d20d0b --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/types/import-type-dynamic/output.json @@ -0,0 +1,148 @@ +{ + "type": "File", + "start":0,"end":89,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":36}}, + "program": { + "type": "Program", + "start":0,"end":89,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":36}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":4,"end":27,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":27}}, + "id": { + "type": "Identifier", + "start":4,"end":27,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":27},"identifierName":"x"}, + "name": "x", + "typeAnnotation": { + "type": "TSTypeAnnotation", + "start":5,"end":27,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":27}}, + "typeAnnotation": { + "type": "TSTypeQuery", + "start":7,"end":27,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":27}}, + "exprName": { + "type": "TSImportType", + "start":14,"end":27,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":27}}, + "argument": { + "type": "StringLiteral", + "start":21,"end":26,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":26}}, + "extra": { + "rawValue": "./x", + "raw": "'./x'" + }, + "value": "./x" + } + } + } + } + }, + "init": null + } + ], + "kind": "let" + }, + { + "type": "VariableDeclaration", + "start":29,"end":52,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":23}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":33,"end":51,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":22}}, + "id": { + "type": "Identifier", + "start":33,"end":51,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":22},"identifierName":"Y"}, + "name": "Y", + "typeAnnotation": { + "type": "TSTypeAnnotation", + "start":34,"end":51,"loc":{"start":{"line":2,"column":5},"end":{"line":2,"column":22}}, + "typeAnnotation": { + "type": "TSImportType", + "start":36,"end":51,"loc":{"start":{"line":2,"column":7},"end":{"line":2,"column":22}}, + "argument": { + "type": "StringLiteral", + "start":43,"end":48,"loc":{"start":{"line":2,"column":14},"end":{"line":2,"column":19}}, + "extra": { + "rawValue": "./y", + "raw": "'./y'" + }, + "value": "./y" + }, + "qualifier": { + "type": "Identifier", + "start":50,"end":51,"loc":{"start":{"line":2,"column":21},"end":{"line":2,"column":22},"identifierName":"Y"}, + "name": "Y" + } + } + } + }, + "init": null + } + ], + "kind": "let" + }, + { + "type": "VariableDeclaration", + "start":53,"end":89,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":36}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":57,"end":88,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":35}}, + "id": { + "type": "Identifier", + "start":57,"end":88,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":35},"identifierName":"z"}, + "name": "z", + "typeAnnotation": { + "type": "TSTypeAnnotation", + "start":58,"end":88,"loc":{"start":{"line":3,"column":5},"end":{"line":3,"column":35}}, + "typeAnnotation": { + "type": "TSImportType", + "start":60,"end":88,"loc":{"start":{"line":3,"column":7},"end":{"line":3,"column":35}}, + "argument": { + "type": "StringLiteral", + "start":67,"end":71,"loc":{"start":{"line":3,"column":14},"end":{"line":3,"column":18}}, + "extra": { + "rawValue": "/z", + "raw": "\"/z\"" + }, + "value": "/z" + }, + "qualifier": { + "type": "TSQualifiedName", + "start":73,"end":80,"loc":{"start":{"line":3,"column":20},"end":{"line":3,"column":27}}, + "left": { + "type": "Identifier", + "start":73,"end":76,"loc":{"start":{"line":3,"column":20},"end":{"line":3,"column":23},"identifierName":"foo"}, + "name": "foo" + }, + "right": { + "type": "Identifier", + "start":77,"end":80,"loc":{"start":{"line":3,"column":24},"end":{"line":3,"column":27},"identifierName":"bar"}, + "name": "bar" + } + }, + "typeParameters": { + "type": "TSTypeParameterInstantiation", + "start":80,"end":88,"loc":{"start":{"line":3,"column":27},"end":{"line":3,"column":35}}, + "params": [ + { + "type": "TSStringKeyword", + "start":81,"end":87,"loc":{"start":{"line":3,"column":28},"end":{"line":3,"column":34}} + } + ] + } + } + } + }, + "init": null + } + ], + "kind": "let" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/types/import-type-escaped-error/input.ts b/packages/babel-parser/test/fixtures/typescript/types/import-type-escaped-error/input.ts new file mode 100644 index 000000000000..a0c06da79d5c --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/types/import-type-escaped-error/input.ts @@ -0,0 +1 @@ +import typ\u{65} typescript from "typescript"; diff --git a/packages/babel-parser/test/fixtures/typescript/types/import-type-escaped-error/options.json b/packages/babel-parser/test/fixtures/typescript/types/import-type-escaped-error/options.json new file mode 100644 index 000000000000..620770863a48 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/types/import-type-escaped-error/options.json @@ -0,0 +1,7 @@ +{ + "sourceType": "module", + "plugins": [ + "typescript" + ], + "throws": "Unexpected token (1:17)" +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/types/import/output.json b/packages/babel-parser/test/fixtures/typescript/types/import/output.json deleted file mode 100644 index a3aa6c8c537b..000000000000 --- a/packages/babel-parser/test/fixtures/typescript/types/import/output.json +++ /dev/null @@ -1,451 +0,0 @@ -{ - "type": "File", - "start": 0, - "end": 89, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 36 - } - }, - "program": { - "type": "Program", - "start": 0, - "end": 89, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 36 - } - }, - "sourceType": "module", - "interpreter": null, - "body": [ - { - "type": "VariableDeclaration", - "start": 0, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 28 - } - }, - "declarations": [ - { - "type": "VariableDeclarator", - "start": 4, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 27 - } - }, - "id": { - "type": "Identifier", - "start": 4, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 27 - }, - "identifierName": "x" - }, - "name": "x", - "typeAnnotation": { - "type": "TSTypeAnnotation", - "start": 5, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 27 - } - }, - "typeAnnotation": { - "type": "TSTypeQuery", - "start": 7, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 27 - } - }, - "exprName": { - "type": "TSImportType", - "start": 14, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 27 - } - }, - "argument": { - "type": "StringLiteral", - "start": 21, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 26 - } - }, - "extra": { - "rawValue": "./x", - "raw": "'./x'" - }, - "value": "./x" - } - } - } - } - }, - "init": null - } - ], - "kind": "let" - }, - { - "type": "VariableDeclaration", - "start": 29, - "end": 52, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 23 - } - }, - "declarations": [ - { - "type": "VariableDeclarator", - "start": 33, - "end": 51, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 22 - } - }, - "id": { - "type": "Identifier", - "start": 33, - "end": 51, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 22 - }, - "identifierName": "Y" - }, - "name": "Y", - "typeAnnotation": { - "type": "TSTypeAnnotation", - "start": 34, - "end": 51, - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 22 - } - }, - "typeAnnotation": { - "type": "TSImportType", - "start": 36, - "end": 51, - "loc": { - "start": { - "line": 2, - "column": 7 - }, - "end": { - "line": 2, - "column": 22 - } - }, - "argument": { - "type": "StringLiteral", - "start": 43, - "end": 48, - "loc": { - "start": { - "line": 2, - "column": 14 - }, - "end": { - "line": 2, - "column": 19 - } - }, - "extra": { - "rawValue": "./y", - "raw": "'./y'" - }, - "value": "./y" - }, - "qualifier": { - "type": "Identifier", - "start": 50, - "end": 51, - "loc": { - "start": { - "line": 2, - "column": 21 - }, - "end": { - "line": 2, - "column": 22 - }, - "identifierName": "Y" - }, - "name": "Y" - } - } - } - }, - "init": null - } - ], - "kind": "let" - }, - { - "type": "VariableDeclaration", - "start": 53, - "end": 89, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 36 - } - }, - "declarations": [ - { - "type": "VariableDeclarator", - "start": 57, - "end": 88, - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 35 - } - }, - "id": { - "type": "Identifier", - "start": 57, - "end": 88, - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 35 - }, - "identifierName": "z" - }, - "name": "z", - "typeAnnotation": { - "type": "TSTypeAnnotation", - "start": 58, - "end": 88, - "loc": { - "start": { - "line": 3, - "column": 5 - }, - "end": { - "line": 3, - "column": 35 - } - }, - "typeAnnotation": { - "type": "TSImportType", - "start": 60, - "end": 88, - "loc": { - "start": { - "line": 3, - "column": 7 - }, - "end": { - "line": 3, - "column": 35 - } - }, - "argument": { - "type": "StringLiteral", - "start": 67, - "end": 71, - "loc": { - "start": { - "line": 3, - "column": 14 - }, - "end": { - "line": 3, - "column": 18 - } - }, - "extra": { - "rawValue": "/z", - "raw": "\"/z\"" - }, - "value": "/z" - }, - "qualifier": { - "type": "TSQualifiedName", - "start": 73, - "end": 80, - "loc": { - "start": { - "line": 3, - "column": 20 - }, - "end": { - "line": 3, - "column": 27 - } - }, - "left": { - "type": "Identifier", - "start": 73, - "end": 76, - "loc": { - "start": { - "line": 3, - "column": 20 - }, - "end": { - "line": 3, - "column": 23 - }, - "identifierName": "foo" - }, - "name": "foo" - }, - "right": { - "type": "Identifier", - "start": 77, - "end": 80, - "loc": { - "start": { - "line": 3, - "column": 24 - }, - "end": { - "line": 3, - "column": 27 - }, - "identifierName": "bar" - }, - "name": "bar" - } - }, - "typeParameters": { - "type": "TSTypeParameterInstantiation", - "start": 80, - "end": 88, - "loc": { - "start": { - "line": 3, - "column": 27 - }, - "end": { - "line": 3, - "column": 35 - } - }, - "params": [ - { - "type": "TSStringKeyword", - "start": 81, - "end": 87, - "loc": { - "start": { - "line": 3, - "column": 28 - }, - "end": { - "line": 3, - "column": 34 - } - } - } - ] - } - } - } - }, - "init": null - } - ], - "kind": "let" - } - ], - "directives": [] - } -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/types/indexed/output.json b/packages/babel-parser/test/fixtures/typescript/types/indexed/output.json index ee52d9dd6d62..309a765c97bb 100644 --- a/packages/babel-parser/test/fixtures/typescript/types/indexed/output.json +++ b/packages/babel-parser/test/fixtures/typescript/types/indexed/output.json @@ -1,168 +1,44 @@ { "type": "File", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, "program": { "type": "Program", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":4,"end":11,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":11}}, "id": { "type": "Identifier", - "start": 4, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "x" - }, + "start":4,"end":11,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":11},"identifierName":"x"}, "name": "x", "typeAnnotation": { "type": "TSTypeAnnotation", - "start": 5, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":5,"end":11,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":11}}, "typeAnnotation": { "type": "TSIndexedAccessType", - "start": 7, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":7,"end":11,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":11}}, "objectType": { "type": "TSTypeReference", - "start": 7, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8}}, "typeName": { "type": "Identifier", - "start": 7, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - }, - "identifierName": "T" - }, + "start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8},"identifierName":"T"}, "name": "T" } }, "indexType": { "type": "TSTypeReference", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10}}, "typeName": { "type": "Identifier", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - }, - "identifierName": "K" - }, + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"K"}, "name": "K" } } diff --git a/packages/babel-parser/test/fixtures/typescript/types/keywords/output.json b/packages/babel-parser/test/fixtures/typescript/types/keywords/output.json index 4c6e48290b18..1bb07f76703c 100644 --- a/packages/babel-parser/test/fixtures/typescript/types/keywords/output.json +++ b/packages/babel-parser/test/fixtures/typescript/types/keywords/output.json @@ -1,107 +1,29 @@ { "type": "File", - "start": 0, - "end": 184, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 12, - "column": 14 - } - }, + "start":0,"end":184,"loc":{"start":{"line":1,"column":0},"end":{"line":12,"column":14}}, "program": { "type": "Program", - "start": 0, - "end": 184, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 12, - "column": 14 - } - }, + "start":0,"end":184,"loc":{"start":{"line":1,"column":0},"end":{"line":12,"column":14}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":4,"end":10,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":10}}, "id": { "type": "Identifier", - "start": 4, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 10 - }, - "identifierName": "a" - }, + "start":4,"end":10,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":10},"identifierName":"a"}, "name": "a", "typeAnnotation": { "type": "TSTypeAnnotation", - "start": 5, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":5,"end":10,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":10}}, "typeAnnotation": { "type": "TSAnyKeyword", - "start": 7, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 10 - } - } + "start":7,"end":10,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":10}} } } }, @@ -112,77 +34,21 @@ }, { "type": "VariableDeclaration", - "start": 12, - "end": 28, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 16 - } - }, + "start":12,"end":28,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":16}}, "declarations": [ { "type": "VariableDeclarator", - "start": 16, - "end": 27, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 15 - } - }, + "start":16,"end":27,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":15}}, "id": { "type": "Identifier", - "start": 16, - "end": 27, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 15 - }, - "identifierName": "un" - }, + "start":16,"end":27,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":15},"identifierName":"un"}, "name": "un", "typeAnnotation": { "type": "TSTypeAnnotation", - "start": 18, - "end": 27, - "loc": { - "start": { - "line": 2, - "column": 6 - }, - "end": { - "line": 2, - "column": 15 - } - }, + "start":18,"end":27,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":15}}, "typeAnnotation": { "type": "TSUnknownKeyword", - "start": 20, - "end": 27, - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 15 - } - } + "start":20,"end":27,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":15}} } } }, @@ -193,77 +59,21 @@ }, { "type": "VariableDeclaration", - "start": 29, - "end": 44, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 15 - } - }, + "start":29,"end":44,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":15}}, "declarations": [ { "type": "VariableDeclarator", - "start": 33, - "end": 43, - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 14 - } - }, + "start":33,"end":43,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":14}}, "id": { "type": "Identifier", - "start": 33, - "end": 43, - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 14 - }, - "identifierName": "b" - }, + "start":33,"end":43,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":14},"identifierName":"b"}, "name": "b", "typeAnnotation": { "type": "TSTypeAnnotation", - "start": 34, - "end": 43, - "loc": { - "start": { - "line": 3, - "column": 5 - }, - "end": { - "line": 3, - "column": 14 - } - }, + "start":34,"end":43,"loc":{"start":{"line":3,"column":5},"end":{"line":3,"column":14}}, "typeAnnotation": { "type": "TSBooleanKeyword", - "start": 36, - "end": 43, - "loc": { - "start": { - "line": 3, - "column": 7 - }, - "end": { - "line": 3, - "column": 14 - } - } + "start":36,"end":43,"loc":{"start":{"line":3,"column":7},"end":{"line":3,"column":14}} } } }, @@ -274,77 +84,21 @@ }, { "type": "VariableDeclaration", - "start": 45, - "end": 59, - "loc": { - "start": { - "line": 4, - "column": 0 - }, - "end": { - "line": 4, - "column": 14 - } - }, + "start":45,"end":59,"loc":{"start":{"line":4,"column":0},"end":{"line":4,"column":14}}, "declarations": [ { "type": "VariableDeclarator", - "start": 49, - "end": 58, - "loc": { - "start": { - "line": 4, - "column": 4 - }, - "end": { - "line": 4, - "column": 13 - } - }, + "start":49,"end":58,"loc":{"start":{"line":4,"column":4},"end":{"line":4,"column":13}}, "id": { "type": "Identifier", - "start": 49, - "end": 58, - "loc": { - "start": { - "line": 4, - "column": 4 - }, - "end": { - "line": 4, - "column": 13 - }, - "identifierName": "ne" - }, + "start":49,"end":58,"loc":{"start":{"line":4,"column":4},"end":{"line":4,"column":13},"identifierName":"ne"}, "name": "ne", "typeAnnotation": { "type": "TSTypeAnnotation", - "start": 51, - "end": 58, - "loc": { - "start": { - "line": 4, - "column": 6 - }, - "end": { - "line": 4, - "column": 13 - } - }, + "start":51,"end":58,"loc":{"start":{"line":4,"column":6},"end":{"line":4,"column":13}}, "typeAnnotation": { "type": "TSNeverKeyword", - "start": 53, - "end": 58, - "loc": { - "start": { - "line": 4, - "column": 8 - }, - "end": { - "line": 4, - "column": 13 - } - } + "start":53,"end":58,"loc":{"start":{"line":4,"column":8},"end":{"line":4,"column":13}} } } }, @@ -355,77 +109,21 @@ }, { "type": "VariableDeclaration", - "start": 60, - "end": 74, - "loc": { - "start": { - "line": 5, - "column": 0 - }, - "end": { - "line": 5, - "column": 14 - } - }, + "start":60,"end":74,"loc":{"start":{"line":5,"column":0},"end":{"line":5,"column":14}}, "declarations": [ { "type": "VariableDeclarator", - "start": 64, - "end": 73, - "loc": { - "start": { - "line": 5, - "column": 4 - }, - "end": { - "line": 5, - "column": 13 - } - }, + "start":64,"end":73,"loc":{"start":{"line":5,"column":4},"end":{"line":5,"column":13}}, "id": { "type": "Identifier", - "start": 64, - "end": 73, - "loc": { - "start": { - "line": 5, - "column": 4 - }, - "end": { - "line": 5, - "column": 13 - }, - "identifierName": "nul" - }, + "start":64,"end":73,"loc":{"start":{"line":5,"column":4},"end":{"line":5,"column":13},"identifierName":"nul"}, "name": "nul", "typeAnnotation": { "type": "TSTypeAnnotation", - "start": 67, - "end": 73, - "loc": { - "start": { - "line": 5, - "column": 7 - }, - "end": { - "line": 5, - "column": 13 - } - }, + "start":67,"end":73,"loc":{"start":{"line":5,"column":7},"end":{"line":5,"column":13}}, "typeAnnotation": { "type": "TSNullKeyword", - "start": 69, - "end": 73, - "loc": { - "start": { - "line": 5, - "column": 9 - }, - "end": { - "line": 5, - "column": 13 - } - } + "start":69,"end":73,"loc":{"start":{"line":5,"column":9},"end":{"line":5,"column":13}} } } }, @@ -436,77 +134,21 @@ }, { "type": "VariableDeclaration", - "start": 75, - "end": 91, - "loc": { - "start": { - "line": 6, - "column": 0 - }, - "end": { - "line": 6, - "column": 16 - } - }, + "start":75,"end":91,"loc":{"start":{"line":6,"column":0},"end":{"line":6,"column":16}}, "declarations": [ { "type": "VariableDeclarator", - "start": 79, - "end": 90, - "loc": { - "start": { - "line": 6, - "column": 4 - }, - "end": { - "line": 6, - "column": 15 - } - }, + "start":79,"end":90,"loc":{"start":{"line":6,"column":4},"end":{"line":6,"column":15}}, "id": { "type": "Identifier", - "start": 79, - "end": 90, - "loc": { - "start": { - "line": 6, - "column": 4 - }, - "end": { - "line": 6, - "column": 15 - }, - "identifierName": "num" - }, + "start":79,"end":90,"loc":{"start":{"line":6,"column":4},"end":{"line":6,"column":15},"identifierName":"num"}, "name": "num", "typeAnnotation": { "type": "TSTypeAnnotation", - "start": 82, - "end": 90, - "loc": { - "start": { - "line": 6, - "column": 7 - }, - "end": { - "line": 6, - "column": 15 - } - }, + "start":82,"end":90,"loc":{"start":{"line":6,"column":7},"end":{"line":6,"column":15}}, "typeAnnotation": { "type": "TSNumberKeyword", - "start": 84, - "end": 90, - "loc": { - "start": { - "line": 6, - "column": 9 - }, - "end": { - "line": 6, - "column": 15 - } - } + "start":84,"end":90,"loc":{"start":{"line":6,"column":9},"end":{"line":6,"column":15}} } } }, @@ -517,77 +159,21 @@ }, { "type": "VariableDeclaration", - "start": 92, - "end": 106, - "loc": { - "start": { - "line": 7, - "column": 0 - }, - "end": { - "line": 7, - "column": 14 - } - }, + "start":92,"end":106,"loc":{"start":{"line":7,"column":0},"end":{"line":7,"column":14}}, "declarations": [ { "type": "VariableDeclarator", - "start": 96, - "end": 105, - "loc": { - "start": { - "line": 7, - "column": 4 - }, - "end": { - "line": 7, - "column": 13 - } - }, + "start":96,"end":105,"loc":{"start":{"line":7,"column":4},"end":{"line":7,"column":13}}, "id": { "type": "Identifier", - "start": 96, - "end": 105, - "loc": { - "start": { - "line": 7, - "column": 4 - }, - "end": { - "line": 7, - "column": 13 - }, - "identifierName": "o" - }, + "start":96,"end":105,"loc":{"start":{"line":7,"column":4},"end":{"line":7,"column":13},"identifierName":"o"}, "name": "o", "typeAnnotation": { "type": "TSTypeAnnotation", - "start": 97, - "end": 105, - "loc": { - "start": { - "line": 7, - "column": 5 - }, - "end": { - "line": 7, - "column": 13 - } - }, + "start":97,"end":105,"loc":{"start":{"line":7,"column":5},"end":{"line":7,"column":13}}, "typeAnnotation": { "type": "TSObjectKeyword", - "start": 99, - "end": 105, - "loc": { - "start": { - "line": 7, - "column": 7 - }, - "end": { - "line": 7, - "column": 13 - } - } + "start":99,"end":105,"loc":{"start":{"line":7,"column":7},"end":{"line":7,"column":13}} } } }, @@ -598,77 +184,21 @@ }, { "type": "VariableDeclaration", - "start": 107, - "end": 122, - "loc": { - "start": { - "line": 8, - "column": 0 - }, - "end": { - "line": 8, - "column": 15 - } - }, + "start":107,"end":122,"loc":{"start":{"line":8,"column":0},"end":{"line":8,"column":15}}, "declarations": [ { "type": "VariableDeclarator", - "start": 111, - "end": 121, - "loc": { - "start": { - "line": 8, - "column": 4 - }, - "end": { - "line": 8, - "column": 14 - } - }, + "start":111,"end":121,"loc":{"start":{"line":8,"column":4},"end":{"line":8,"column":14}}, "id": { "type": "Identifier", - "start": 111, - "end": 121, - "loc": { - "start": { - "line": 8, - "column": 4 - }, - "end": { - "line": 8, - "column": 14 - }, - "identifierName": "st" - }, + "start":111,"end":121,"loc":{"start":{"line":8,"column":4},"end":{"line":8,"column":14},"identifierName":"st"}, "name": "st", "typeAnnotation": { "type": "TSTypeAnnotation", - "start": 113, - "end": 121, - "loc": { - "start": { - "line": 8, - "column": 6 - }, - "end": { - "line": 8, - "column": 14 - } - }, + "start":113,"end":121,"loc":{"start":{"line":8,"column":6},"end":{"line":8,"column":14}}, "typeAnnotation": { "type": "TSStringKeyword", - "start": 115, - "end": 121, - "loc": { - "start": { - "line": 8, - "column": 8 - }, - "end": { - "line": 8, - "column": 14 - } - } + "start":115,"end":121,"loc":{"start":{"line":8,"column":8},"end":{"line":8,"column":14}} } } }, @@ -679,77 +209,21 @@ }, { "type": "VariableDeclaration", - "start": 123, - "end": 138, - "loc": { - "start": { - "line": 9, - "column": 0 - }, - "end": { - "line": 9, - "column": 15 - } - }, + "start":123,"end":138,"loc":{"start":{"line":9,"column":0},"end":{"line":9,"column":15}}, "declarations": [ { "type": "VariableDeclarator", - "start": 127, - "end": 137, - "loc": { - "start": { - "line": 9, - "column": 4 - }, - "end": { - "line": 9, - "column": 14 - } - }, + "start":127,"end":137,"loc":{"start":{"line":9,"column":4},"end":{"line":9,"column":14}}, "id": { "type": "Identifier", - "start": 127, - "end": 137, - "loc": { - "start": { - "line": 9, - "column": 4 - }, - "end": { - "line": 9, - "column": 14 - }, - "identifierName": "sy" - }, + "start":127,"end":137,"loc":{"start":{"line":9,"column":4},"end":{"line":9,"column":14},"identifierName":"sy"}, "name": "sy", "typeAnnotation": { "type": "TSTypeAnnotation", - "start": 129, - "end": 137, - "loc": { - "start": { - "line": 9, - "column": 6 - }, - "end": { - "line": 9, - "column": 14 - } - }, + "start":129,"end":137,"loc":{"start":{"line":9,"column":6},"end":{"line":9,"column":14}}, "typeAnnotation": { "type": "TSSymbolKeyword", - "start": 131, - "end": 137, - "loc": { - "start": { - "line": 9, - "column": 8 - }, - "end": { - "line": 9, - "column": 14 - } - } + "start":131,"end":137,"loc":{"start":{"line":9,"column":8},"end":{"line":9,"column":14}} } } }, @@ -760,77 +234,21 @@ }, { "type": "VariableDeclaration", - "start": 139, - "end": 156, - "loc": { - "start": { - "line": 10, - "column": 0 - }, - "end": { - "line": 10, - "column": 17 - } - }, + "start":139,"end":156,"loc":{"start":{"line":10,"column":0},"end":{"line":10,"column":17}}, "declarations": [ { "type": "VariableDeclarator", - "start": 143, - "end": 155, - "loc": { - "start": { - "line": 10, - "column": 4 - }, - "end": { - "line": 10, - "column": 16 - } - }, + "start":143,"end":155,"loc":{"start":{"line":10,"column":4},"end":{"line":10,"column":16}}, "id": { "type": "Identifier", - "start": 143, - "end": 155, - "loc": { - "start": { - "line": 10, - "column": 4 - }, - "end": { - "line": 10, - "column": 16 - }, - "identifierName": "u" - }, + "start":143,"end":155,"loc":{"start":{"line":10,"column":4},"end":{"line":10,"column":16},"identifierName":"u"}, "name": "u", "typeAnnotation": { "type": "TSTypeAnnotation", - "start": 144, - "end": 155, - "loc": { - "start": { - "line": 10, - "column": 5 - }, - "end": { - "line": 10, - "column": 16 - } - }, + "start":144,"end":155,"loc":{"start":{"line":10,"column":5},"end":{"line":10,"column":16}}, "typeAnnotation": { "type": "TSUndefinedKeyword", - "start": 146, - "end": 155, - "loc": { - "start": { - "line": 10, - "column": 7 - }, - "end": { - "line": 10, - "column": 16 - } - } + "start":146,"end":155,"loc":{"start":{"line":10,"column":7},"end":{"line":10,"column":16}} } } }, @@ -841,77 +259,21 @@ }, { "type": "VariableDeclaration", - "start": 157, - "end": 169, - "loc": { - "start": { - "line": 11, - "column": 0 - }, - "end": { - "line": 11, - "column": 12 - } - }, + "start":157,"end":169,"loc":{"start":{"line":11,"column":0},"end":{"line":11,"column":12}}, "declarations": [ { "type": "VariableDeclarator", - "start": 161, - "end": 168, - "loc": { - "start": { - "line": 11, - "column": 4 - }, - "end": { - "line": 11, - "column": 11 - } - }, + "start":161,"end":168,"loc":{"start":{"line":11,"column":4},"end":{"line":11,"column":11}}, "id": { "type": "Identifier", - "start": 161, - "end": 168, - "loc": { - "start": { - "line": 11, - "column": 4 - }, - "end": { - "line": 11, - "column": 11 - }, - "identifierName": "v" - }, + "start":161,"end":168,"loc":{"start":{"line":11,"column":4},"end":{"line":11,"column":11},"identifierName":"v"}, "name": "v", "typeAnnotation": { "type": "TSTypeAnnotation", - "start": 162, - "end": 168, - "loc": { - "start": { - "line": 11, - "column": 5 - }, - "end": { - "line": 11, - "column": 11 - } - }, + "start":162,"end":168,"loc":{"start":{"line":11,"column":5},"end":{"line":11,"column":11}}, "typeAnnotation": { "type": "TSVoidKeyword", - "start": 164, - "end": 168, - "loc": { - "start": { - "line": 11, - "column": 7 - }, - "end": { - "line": 11, - "column": 11 - } - } + "start":164,"end":168,"loc":{"start":{"line":11,"column":7},"end":{"line":11,"column":11}} } } }, @@ -922,77 +284,21 @@ }, { "type": "VariableDeclaration", - "start": 170, - "end": 184, - "loc": { - "start": { - "line": 12, - "column": 0 - }, - "end": { - "line": 12, - "column": 14 - } - }, + "start":170,"end":184,"loc":{"start":{"line":12,"column":0},"end":{"line":12,"column":14}}, "declarations": [ { "type": "VariableDeclarator", - "start": 174, - "end": 183, - "loc": { - "start": { - "line": 12, - "column": 4 - }, - "end": { - "line": 12, - "column": 13 - } - }, + "start":174,"end":183,"loc":{"start":{"line":12,"column":4},"end":{"line":12,"column":13}}, "id": { "type": "Identifier", - "start": 174, - "end": 183, - "loc": { - "start": { - "line": 12, - "column": 4 - }, - "end": { - "line": 12, - "column": 13 - }, - "identifierName": "n" - }, + "start":174,"end":183,"loc":{"start":{"line":12,"column":4},"end":{"line":12,"column":13},"identifierName":"n"}, "name": "n", "typeAnnotation": { "type": "TSTypeAnnotation", - "start": 175, - "end": 183, - "loc": { - "start": { - "line": 12, - "column": 5 - }, - "end": { - "line": 12, - "column": 13 - } - }, + "start":175,"end":183,"loc":{"start":{"line":12,"column":5},"end":{"line":12,"column":13}}, "typeAnnotation": { "type": "TSBigIntKeyword", - "start": 177, - "end": 183, - "loc": { - "start": { - "line": 12, - "column": 7 - }, - "end": { - "line": 12, - "column": 13 - } - } + "start":177,"end":183,"loc":{"start":{"line":12,"column":7},"end":{"line":12,"column":13}} } } }, diff --git a/packages/babel-parser/test/fixtures/typescript/types/literal-boolean/output.json b/packages/babel-parser/test/fixtures/typescript/types/literal-boolean/output.json index 44bc4f2acb1f..fdab5fe10cbc 100644 --- a/packages/babel-parser/test/fixtures/typescript/types/literal-boolean/output.json +++ b/packages/babel-parser/test/fixtures/typescript/types/literal-boolean/output.json @@ -1,121 +1,32 @@ { "type": "File", - "start": 0, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 14 - } - }, + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":14}}, "program": { "type": "Program", - "start": 0, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 14 - } - }, + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":14}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":4,"end":12,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":12}}, "id": { "type": "Identifier", - "start": 4, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "x1" - }, + "start":4,"end":12,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":12},"identifierName":"x1"}, "name": "x1", "typeAnnotation": { "type": "TSTypeAnnotation", - "start": 6, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":6,"end":12,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":12}}, "typeAnnotation": { "type": "TSLiteralType", - "start": 8, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":8,"end":12,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":12}}, "literal": { "type": "BooleanLiteral", - "start": 8, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":8,"end":12,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":12}}, "value": true } } @@ -128,91 +39,24 @@ }, { "type": "VariableDeclaration", - "start": 14, - "end": 28, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 14 - } - }, + "start":14,"end":28,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":14}}, "declarations": [ { "type": "VariableDeclarator", - "start": 18, - "end": 27, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 13 - } - }, + "start":18,"end":27,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":13}}, "id": { "type": "Identifier", - "start": 18, - "end": 27, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 13 - }, - "identifierName": "x2" - }, + "start":18,"end":27,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":13},"identifierName":"x2"}, "name": "x2", "typeAnnotation": { "type": "TSTypeAnnotation", - "start": 20, - "end": 27, - "loc": { - "start": { - "line": 2, - "column": 6 - }, - "end": { - "line": 2, - "column": 13 - } - }, + "start":20,"end":27,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":13}}, "typeAnnotation": { "type": "TSLiteralType", - "start": 22, - "end": 27, - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 13 - } - }, + "start":22,"end":27,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":13}}, "literal": { "type": "BooleanLiteral", - "start": 22, - "end": 27, - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 13 - } - }, + "start":22,"end":27,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":13}}, "value": false } } diff --git a/packages/babel-parser/test/fixtures/typescript/types/literal-number-negative/output.json b/packages/babel-parser/test/fixtures/typescript/types/literal-number-negative/output.json index 70e16143508f..98188ca7ad59 100644 --- a/packages/babel-parser/test/fixtures/typescript/types/literal-number-negative/output.json +++ b/packages/babel-parser/test/fixtures/typescript/types/literal-number-negative/output.json @@ -1,137 +1,37 @@ { "type": "File", - "start": 0, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, "program": { "type": "Program", - "start": 0, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":4,"end":9,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":9}}, "id": { "type": "Identifier", - "start": 4, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "x" - }, + "start":4,"end":9,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":9},"identifierName":"x"}, "name": "x", "typeAnnotation": { "type": "TSTypeAnnotation", - "start": 5, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":5,"end":9,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":9}}, "typeAnnotation": { "type": "TSLiteralType", - "start": 7, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":7,"end":9,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":9}}, "literal": { "type": "UnaryExpression", - "start": 7, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":7,"end":9,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":9}}, "operator": "-", "prefix": true, "argument": { "type": "NumericLiteral", - "start": 8, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":8,"end":9,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":9}}, "extra": { "rawValue": 1, "raw": "1" diff --git a/packages/babel-parser/test/fixtures/typescript/types/literal-number/output.json b/packages/babel-parser/test/fixtures/typescript/types/literal-number/output.json index ee12b09143a3..0794c7490c11 100644 --- a/packages/babel-parser/test/fixtures/typescript/types/literal-number/output.json +++ b/packages/babel-parser/test/fixtures/typescript/types/literal-number/output.json @@ -1,121 +1,32 @@ { "type": "File", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "program": { "type": "Program", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":4,"end":8,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":8}}, "id": { "type": "Identifier", - "start": 4, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 8 - }, - "identifierName": "x" - }, + "start":4,"end":8,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":8},"identifierName":"x"}, "name": "x", "typeAnnotation": { "type": "TSTypeAnnotation", - "start": 5, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":5,"end":8,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":8}}, "typeAnnotation": { "type": "TSLiteralType", - "start": 7, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8}}, "literal": { "type": "NumericLiteral", - "start": 7, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8}}, "extra": { "rawValue": 0, "raw": "0" diff --git a/packages/babel-parser/test/fixtures/typescript/types/literal-string-1/output.json b/packages/babel-parser/test/fixtures/typescript/types/literal-string-1/output.json index a153fb364a09..66628e71363c 100644 --- a/packages/babel-parser/test/fixtures/typescript/types/literal-string-1/output.json +++ b/packages/babel-parser/test/fixtures/typescript/types/literal-string-1/output.json @@ -1,137 +1,37 @@ { "type": "File", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "program": { "type": "Program", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":4,"end":12,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":12}}, "id": { "type": "Identifier", - "start": 4, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "x" - }, + "start":4,"end":12,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":12},"identifierName":"x"}, "name": "x", "typeAnnotation": { "type": "TSTypeAnnotation", - "start": 5, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":5,"end":12,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":12}}, "typeAnnotation": { "type": "TSLiteralType", - "start": 7, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":7,"end":12,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":12}}, "literal": { "type": "TemplateLiteral", - "start": 7, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":7,"end":12,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":12}}, "expressions": [], "quasis": [ { "type": "TemplateElement", - "start": 8, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 11 - } - }, + "start":8,"end":11,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":11}}, "value": { "raw": "foo", "cooked": "foo" diff --git a/packages/babel-parser/test/fixtures/typescript/types/literal-string-2/options.json b/packages/babel-parser/test/fixtures/typescript/types/literal-string-2/options.json deleted file mode 100644 index 3c001f6afda6..000000000000 --- a/packages/babel-parser/test/fixtures/typescript/types/literal-string-2/options.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "sourceType": "module", - "plugins": [ - "typescript" - ], - "throws": "Template literal types cannot have any substitution (1:14)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/types/literal-string-2/output.json b/packages/babel-parser/test/fixtures/typescript/types/literal-string-2/output.json new file mode 100644 index 000000000000..1b6b7291f9be --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/types/literal-string-2/output.json @@ -0,0 +1,72 @@ +{ + "type": "File", + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, + "errors": [ + "SyntaxError: Template literal types cannot have any substitution (1:14)" + ], + "program": { + "type": "Program", + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":4,"end":19,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":19}}, + "id": { + "type": "Identifier", + "start":4,"end":19,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":19},"identifierName":"x"}, + "name": "x", + "typeAnnotation": { + "type": "TSTypeAnnotation", + "start":5,"end":19,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":19}}, + "typeAnnotation": { + "type": "TSLiteralType", + "start":7,"end":19,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":19}}, + "literal": { + "type": "TemplateLiteral", + "start":7,"end":19,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":19}}, + "expressions": [ + { + "type": "Identifier", + "start":14,"end":17,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":17},"identifierName":"bar"}, + "name": "bar" + } + ], + "quasis": [ + { + "type": "TemplateElement", + "start":8,"end":12,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":12}}, + "value": { + "raw": "foo-", + "cooked": "foo-" + }, + "tail": false + }, + { + "type": "TemplateElement", + "start":18,"end":18,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":18}}, + "value": { + "raw": "", + "cooked": "" + }, + "tail": true + } + ] + } + } + } + }, + "init": null + } + ], + "kind": "let" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/types/literal-string/output.json b/packages/babel-parser/test/fixtures/typescript/types/literal-string/output.json index c9cbc53ac2f8..7a2d467c2d55 100644 --- a/packages/babel-parser/test/fixtures/typescript/types/literal-string/output.json +++ b/packages/babel-parser/test/fixtures/typescript/types/literal-string/output.json @@ -1,121 +1,32 @@ { "type": "File", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "program": { "type": "Program", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":4,"end":12,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":12}}, "id": { "type": "Identifier", - "start": 4, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "x" - }, + "start":4,"end":12,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":12},"identifierName":"x"}, "name": "x", "typeAnnotation": { "type": "TSTypeAnnotation", - "start": 5, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":5,"end":12,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":12}}, "typeAnnotation": { "type": "TSLiteralType", - "start": 7, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":7,"end":12,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":12}}, "literal": { "type": "StringLiteral", - "start": 7, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":7,"end":12,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":12}}, "extra": { "rawValue": "foo", "raw": "\"foo\"" diff --git a/packages/babel-parser/test/fixtures/typescript/types/mapped/output.json b/packages/babel-parser/test/fixtures/typescript/types/mapped/output.json index 5cde8240b24f..7b27bddbec7a 100644 --- a/packages/babel-parser/test/fixtures/typescript/types/mapped/output.json +++ b/packages/babel-parser/test/fixtures/typescript/types/mapped/output.json @@ -1,152 +1,41 @@ { "type": "File", - "start": 0, - "end": 184, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 48 - } - }, + "start":0,"end":184,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":48}}, "program": { "type": "Program", - "start": 0, - "end": 184, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 48 - } - }, + "start":0,"end":184,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":48}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 37 - } - }, + "start":0,"end":37,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":37}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":4,"end":36,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":36}}, "id": { "type": "Identifier", - "start": 4, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 36 - }, - "identifierName": "map1" - }, + "start":4,"end":36,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":36},"identifierName":"map1"}, "name": "map1", "typeAnnotation": { "type": "TSTypeAnnotation", - "start": 8, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":8,"end":36,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":36}}, "typeAnnotation": { "type": "TSMappedType", - "start": 10, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":10,"end":36,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":36}}, "typeParameter": { "type": "TSTypeParameter", - "start": 13, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 24 - } - }, + "start":13,"end":24,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":24}}, "name": "P", "constraint": { "type": "TSStringKeyword", - "start": 18, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 24 - } - } + "start":18,"end":24,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":24}} } }, "typeAnnotation": { "type": "TSNumberKeyword", - "start": 27, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 33 - } - } + "start":27,"end":33,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":33}} } } } @@ -158,124 +47,35 @@ }, { "type": "VariableDeclaration", - "start": 38, - "end": 85, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 47 - } - }, + "start":38,"end":85,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":47}}, "declarations": [ { "type": "VariableDeclarator", - "start": 42, - "end": 84, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 46 - } - }, + "start":42,"end":84,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":46}}, "id": { "type": "Identifier", - "start": 42, - "end": 84, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 46 - }, - "identifierName": "map2" - }, + "start":42,"end":84,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":46},"identifierName":"map2"}, "name": "map2", "typeAnnotation": { "type": "TSTypeAnnotation", - "start": 46, - "end": 84, - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 46 - } - }, + "start":46,"end":84,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":46}}, "typeAnnotation": { "type": "TSMappedType", - "start": 48, - "end": 84, - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 46 - } - }, + "start":48,"end":84,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":46}}, "readonly": true, "typeParameter": { "type": "TSTypeParameter", - "start": 60, - "end": 71, - "loc": { - "start": { - "line": 2, - "column": 22 - }, - "end": { - "line": 2, - "column": 33 - } - }, + "start":60,"end":71,"loc":{"start":{"line":2,"column":22},"end":{"line":2,"column":33}}, "name": "P", "constraint": { "type": "TSStringKeyword", - "start": 65, - "end": 71, - "loc": { - "start": { - "line": 2, - "column": 27 - }, - "end": { - "line": 2, - "column": 33 - } - } + "start":65,"end":71,"loc":{"start":{"line":2,"column":27},"end":{"line":2,"column":33}} } }, "optional": true, "typeAnnotation": { "type": "TSNumberKeyword", - "start": 75, - "end": 81, - "loc": { - "start": { - "line": 2, - "column": 37 - }, - "end": { - "line": 2, - "column": 43 - } - } + "start":75,"end":81,"loc":{"start":{"line":2,"column":37},"end":{"line":2,"column":43}} } } } @@ -287,124 +87,35 @@ }, { "type": "VariableDeclaration", - "start": 86, - "end": 135, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 49 - } - }, + "start":86,"end":135,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":49}}, "declarations": [ { "type": "VariableDeclarator", - "start": 90, - "end": 134, - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 48 - } - }, + "start":90,"end":134,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":48}}, "id": { "type": "Identifier", - "start": 90, - "end": 134, - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 48 - }, - "identifierName": "map3" - }, + "start":90,"end":134,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":48},"identifierName":"map3"}, "name": "map3", "typeAnnotation": { "type": "TSTypeAnnotation", - "start": 94, - "end": 134, - "loc": { - "start": { - "line": 3, - "column": 8 - }, - "end": { - "line": 3, - "column": 48 - } - }, + "start":94,"end":134,"loc":{"start":{"line":3,"column":8},"end":{"line":3,"column":48}}, "typeAnnotation": { "type": "TSMappedType", - "start": 96, - "end": 134, - "loc": { - "start": { - "line": 3, - "column": 10 - }, - "end": { - "line": 3, - "column": 48 - } - }, + "start":96,"end":134,"loc":{"start":{"line":3,"column":10},"end":{"line":3,"column":48}}, "readonly": "+", "typeParameter": { "type": "TSTypeParameter", - "start": 109, - "end": 120, - "loc": { - "start": { - "line": 3, - "column": 23 - }, - "end": { - "line": 3, - "column": 34 - } - }, + "start":109,"end":120,"loc":{"start":{"line":3,"column":23},"end":{"line":3,"column":34}}, "name": "P", "constraint": { "type": "TSStringKeyword", - "start": 114, - "end": 120, - "loc": { - "start": { - "line": 3, - "column": 28 - }, - "end": { - "line": 3, - "column": 34 - } - } + "start":114,"end":120,"loc":{"start":{"line":3,"column":28},"end":{"line":3,"column":34}} } }, "optional": "+", "typeAnnotation": { "type": "TSNumberKeyword", - "start": 125, - "end": 131, - "loc": { - "start": { - "line": 3, - "column": 39 - }, - "end": { - "line": 3, - "column": 45 - } - } + "start":125,"end":131,"loc":{"start":{"line":3,"column":39},"end":{"line":3,"column":45}} } } } @@ -416,124 +127,35 @@ }, { "type": "VariableDeclaration", - "start": 136, - "end": 184, - "loc": { - "start": { - "line": 4, - "column": 0 - }, - "end": { - "line": 4, - "column": 48 - } - }, + "start":136,"end":184,"loc":{"start":{"line":4,"column":0},"end":{"line":4,"column":48}}, "declarations": [ { "type": "VariableDeclarator", - "start": 140, - "end": 183, - "loc": { - "start": { - "line": 4, - "column": 4 - }, - "end": { - "line": 4, - "column": 47 - } - }, + "start":140,"end":183,"loc":{"start":{"line":4,"column":4},"end":{"line":4,"column":47}}, "id": { "type": "Identifier", - "start": 140, - "end": 183, - "loc": { - "start": { - "line": 4, - "column": 4 - }, - "end": { - "line": 4, - "column": 47 - }, - "identifierName": "map4" - }, + "start":140,"end":183,"loc":{"start":{"line":4,"column":4},"end":{"line":4,"column":47},"identifierName":"map4"}, "name": "map4", "typeAnnotation": { "type": "TSTypeAnnotation", - "start": 144, - "end": 183, - "loc": { - "start": { - "line": 4, - "column": 8 - }, - "end": { - "line": 4, - "column": 47 - } - }, + "start":144,"end":183,"loc":{"start":{"line":4,"column":8},"end":{"line":4,"column":47}}, "typeAnnotation": { "type": "TSMappedType", - "start": 146, - "end": 183, - "loc": { - "start": { - "line": 4, - "column": 10 - }, - "end": { - "line": 4, - "column": 47 - } - }, + "start":146,"end":183,"loc":{"start":{"line":4,"column":10},"end":{"line":4,"column":47}}, "readonly": "-", "typeParameter": { "type": "TSTypeParameter", - "start": 159, - "end": 170, - "loc": { - "start": { - "line": 4, - "column": 23 - }, - "end": { - "line": 4, - "column": 34 - } - }, + "start":159,"end":170,"loc":{"start":{"line":4,"column":23},"end":{"line":4,"column":34}}, "name": "P", "constraint": { "type": "TSStringKeyword", - "start": 164, - "end": 170, - "loc": { - "start": { - "line": 4, - "column": 28 - }, - "end": { - "line": 4, - "column": 34 - } - } + "start":164,"end":170,"loc":{"start":{"line":4,"column":28},"end":{"line":4,"column":34}} } }, "optional": "-", "typeAnnotation": { "type": "TSNumberKeyword", - "start": 175, - "end": 181, - "loc": { - "start": { - "line": 4, - "column": 39 - }, - "end": { - "line": 4, - "column": 45 - } - } + "start":175,"end":181,"loc":{"start":{"line":4,"column":39},"end":{"line":4,"column":45}} } } } diff --git a/packages/babel-parser/test/fixtures/typescript/types/new-line/output.json b/packages/babel-parser/test/fixtures/typescript/types/new-line/output.json index 7acae4a0d346..5f00b53a21f0 100644 --- a/packages/babel-parser/test/fixtures/typescript/types/new-line/output.json +++ b/packages/babel-parser/test/fixtures/typescript/types/new-line/output.json @@ -1,127 +1,36 @@ { "type": "File", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 13 - } - }, + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":13}}, "program": { "type": "Program", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 13 - } - }, + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":13}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExpressionStatement", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - }, + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, "expression": { "type": "Identifier", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - }, - "identifierName": "type" - }, + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4},"identifierName":"type"}, "name": "type" } }, { "type": "ExpressionStatement", - "start": 5, - "end": 18, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 13 - } - }, + "start":5,"end":18,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":13}}, "expression": { "type": "AssignmentExpression", - "start": 5, - "end": 17, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 12 - } - }, + "start":5,"end":17,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":12}}, "operator": "=", "left": { "type": "Identifier", - "start": 5, - "end": 8, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 3 - }, - "identifierName": "Foo" - }, + "start":5,"end":8,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":3},"identifierName":"Foo"}, "name": "Foo" }, "right": { "type": "Identifier", - "start": 11, - "end": 17, - "loc": { - "start": { - "line": 2, - "column": 6 - }, - "end": { - "line": 2, - "column": 12 - }, - "identifierName": "string" - }, + "start":11,"end":17,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":12},"identifierName":"string"}, "name": "string" } } diff --git a/packages/babel-parser/test/fixtures/typescript/types/object-shorthand/output.json b/packages/babel-parser/test/fixtures/typescript/types/object-shorthand/output.json index 875a3e53d002..5b8fb1442f77 100644 --- a/packages/babel-parser/test/fixtures/typescript/types/object-shorthand/output.json +++ b/packages/babel-parser/test/fixtures/typescript/types/object-shorthand/output.json @@ -1,233 +1,65 @@ { "type": "File", - "start": 0, - "end": 87, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 2 - } - }, + "start":0,"end":87,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":2}}, "program": { "type": "Program", - "start": 0, - "end": 87, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 2 - } - }, + "start":0,"end":87,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":2}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 87, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 2 - } - }, + "start":0,"end":87,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":2}}, "declarations": [ { "type": "VariableDeclarator", - "start": 6, - "end": 86, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 5, - "column": 1 - } - }, + "start":6,"end":86,"loc":{"start":{"line":1,"column":6},"end":{"line":5,"column":1}}, "id": { "type": "Identifier", - "start": 6, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "table" - }, + "start":6,"end":11,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":11},"identifierName":"table"}, "name": "table" }, "init": { "type": "ObjectExpression", - "start": 14, - "end": 86, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 5, - "column": 1 - } - }, + "start":14,"end":86,"loc":{"start":{"line":1,"column":14},"end":{"line":5,"column":1}}, "properties": [ { "type": "ObjectMethod", - "start": 18, - "end": 84, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 4, - "column": 3 - } - }, + "start":18,"end":84,"loc":{"start":{"line":2,"column":2},"end":{"line":4,"column":3}}, "method": true, "key": { "type": "Identifier", - "start": 18, - "end": 21, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 5 - }, - "identifierName": "put" - }, + "start":18,"end":21,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":5},"identifierName":"put"}, "name": "put" }, "computed": false, "typeParameters": { "type": "TSTypeParameterDeclaration", - "start": 21, - "end": 47, - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 31 - } - }, + "start":21,"end":47,"loc":{"start":{"line":2,"column":5},"end":{"line":2,"column":31}}, "params": [ { "type": "TSTypeParameter", - "start": 22, - "end": 46, - "loc": { - "start": { - "line": 2, - "column": 6 - }, - "end": { - "line": 2, - "column": 30 - } - }, + "start":22,"end":46,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":30}}, "name": "T", "constraint": { "type": "TSTypeLiteral", - "start": 32, - "end": 46, - "loc": { - "start": { - "line": 2, - "column": 16 - }, - "end": { - "line": 2, - "column": 30 - } - }, + "start":32,"end":46,"loc":{"start":{"line":2,"column":16},"end":{"line":2,"column":30}}, "members": [ { "type": "TSPropertySignature", - "start": 34, - "end": 44, - "loc": { - "start": { - "line": 2, - "column": 18 - }, - "end": { - "line": 2, - "column": 28 - } - }, + "start":34,"end":44,"loc":{"start":{"line":2,"column":18},"end":{"line":2,"column":28}}, "key": { "type": "Identifier", - "start": 34, - "end": 36, - "loc": { - "start": { - "line": 2, - "column": 18 - }, - "end": { - "line": 2, - "column": 20 - }, - "identifierName": "id" - }, + "start":34,"end":36,"loc":{"start":{"line":2,"column":18},"end":{"line":2,"column":20},"identifierName":"id"}, "name": "id" }, "computed": false, "typeAnnotation": { "type": "TSTypeAnnotation", - "start": 36, - "end": 44, - "loc": { - "start": { - "line": 2, - "column": 20 - }, - "end": { - "line": 2, - "column": 28 - } - }, + "start":36,"end":44,"loc":{"start":{"line":2,"column":20},"end":{"line":2,"column":28}}, "typeAnnotation": { "type": "TSStringKeyword", - "start": 38, - "end": 44, - "loc": { - "start": { - "line": 2, - "column": 22 - }, - "end": { - "line": 2, - "column": 28 - } - } + "start":38,"end":44,"loc":{"start":{"line":2,"column":22},"end":{"line":2,"column":28}} } } } @@ -243,63 +75,17 @@ "params": [ { "type": "Identifier", - "start": 48, - "end": 56, - "loc": { - "start": { - "line": 2, - "column": 32 - }, - "end": { - "line": 2, - "column": 40 - }, - "identifierName": "value" - }, + "start":48,"end":56,"loc":{"start":{"line":2,"column":32},"end":{"line":2,"column":40},"identifierName":"value"}, "name": "value", "typeAnnotation": { "type": "TSTypeAnnotation", - "start": 53, - "end": 56, - "loc": { - "start": { - "line": 2, - "column": 37 - }, - "end": { - "line": 2, - "column": 40 - } - }, + "start":53,"end":56,"loc":{"start":{"line":2,"column":37},"end":{"line":2,"column":40}}, "typeAnnotation": { "type": "TSTypeReference", - "start": 55, - "end": 56, - "loc": { - "start": { - "line": 2, - "column": 39 - }, - "end": { - "line": 2, - "column": 40 - } - }, + "start":55,"end":56,"loc":{"start":{"line":2,"column":39},"end":{"line":2,"column":40}}, "typeName": { "type": "Identifier", - "start": 55, - "end": 56, - "loc": { - "start": { - "line": 2, - "column": 39 - }, - "end": { - "line": 2, - "column": 40 - }, - "identifierName": "T" - }, + "start":55,"end":56,"loc":{"start":{"line":2,"column":39},"end":{"line":2,"column":40},"identifierName":"T"}, "name": "T" } } @@ -308,36 +94,14 @@ ], "body": { "type": "BlockStatement", - "start": 58, - "end": 84, - "loc": { - "start": { - "line": 2, - "column": 42 - }, - "end": { - "line": 4, - "column": 3 - } - }, + "start":58,"end":84,"loc":{"start":{"line":2,"column":42},"end":{"line":4,"column":3}}, "body": [], "directives": [], "innerComments": [ { "type": "CommentLine", "value": " actually put.", - "start": 64, - "end": 80, - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 20 - } - } + "start":64,"end":80,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":20}} } ] } @@ -355,18 +119,7 @@ { "type": "CommentLine", "value": " actually put.", - "start": 64, - "end": 80, - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 20 - } - } + "start":64,"end":80,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":20}} } ] } \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/types/parenthesized/output.json b/packages/babel-parser/test/fixtures/typescript/types/parenthesized/output.json index 29c9133d8a71..70391b5255e5 100644 --- a/packages/babel-parser/test/fixtures/typescript/types/parenthesized/output.json +++ b/packages/babel-parser/test/fixtures/typescript/types/parenthesized/output.json @@ -1,93 +1,26 @@ { "type": "File", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "program": { "type": "Program", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "TSTypeAliasDeclaration", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, "id": { "type": "Identifier", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "T" - }, + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"T"}, "name": "T" }, "typeAnnotation": { "type": "TSParenthesizedType", - "start": 9, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 13 - } - }, + "start":9,"end":13,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":13}}, "typeAnnotation": { "type": "TSTypeLiteral", - "start": 10, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 12 - } - }, + "start":10,"end":12,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":12}}, "members": [] } } diff --git a/packages/babel-parser/test/fixtures/typescript/types/read-only-1/options.json b/packages/babel-parser/test/fixtures/typescript/types/read-only-1/options.json deleted file mode 100644 index 0a91d0015278..000000000000 --- a/packages/babel-parser/test/fixtures/typescript/types/read-only-1/options.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "sourceType": "module", - "plugins": ["typescript"], - "throws": "'readonly' type modifier is only permitted on array and tuple literal types. (1:11)" -} diff --git a/packages/babel-parser/test/fixtures/typescript/types/read-only-1/output.json b/packages/babel-parser/test/fixtures/typescript/types/read-only-1/output.json new file mode 100644 index 000000000000..05caa4bb0bc0 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/types/read-only-1/output.json @@ -0,0 +1,48 @@ +{ + "type": "File", + "start":0,"end":37,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":37}}, + "errors": [ + "SyntaxError: 'readonly' type modifier is only permitted on array and tuple literal types. (1:11)" + ], + "program": { + "type": "Program", + "start":0,"end":37,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":37}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "TSTypeAliasDeclaration", + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, + "id": { + "type": "Identifier", + "start":5,"end":8,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":8},"identifierName":"T30"}, + "name": "T30" + }, + "typeAnnotation": { + "type": "TSTypeOperator", + "start":11,"end":26,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":26}}, + "operator": "readonly", + "typeAnnotation": { + "type": "TSStringKeyword", + "start":20,"end":26,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":26}} + } + }, + "trailingComments": [ + { + "type": "CommentLine", + "value": " Error", + "start":29,"end":37,"loc":{"start":{"line":1,"column":29},"end":{"line":1,"column":37}} + } + ] + } + ], + "directives": [] + }, + "comments": [ + { + "type": "CommentLine", + "value": " Error", + "start":29,"end":37,"loc":{"start":{"line":1,"column":29},"end":{"line":1,"column":37}} + } + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/types/read-only-2/options.json b/packages/babel-parser/test/fixtures/typescript/types/read-only-2/options.json deleted file mode 100644 index cdb818eee9b2..000000000000 --- a/packages/babel-parser/test/fixtures/typescript/types/read-only-2/options.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "sourceType": "module", - "plugins": [ - "typescript" - ], - "throws": "'readonly' type modifier is only permitted on array and tuple literal types. (1:11)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/types/read-only-2/output.json b/packages/babel-parser/test/fixtures/typescript/types/read-only-2/output.json new file mode 100644 index 000000000000..95f72e236eb9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/types/read-only-2/output.json @@ -0,0 +1,53 @@ +{ + "type": "File", + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, + "errors": [ + "SyntaxError: 'readonly' type modifier is only permitted on array and tuple literal types. (1:11)" + ], + "program": { + "type": "Program", + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "TSTypeAliasDeclaration", + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, + "id": { + "type": "Identifier", + "start":5,"end":8,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":8},"identifierName":"T31"}, + "name": "T31" + }, + "typeAnnotation": { + "type": "TSTypeOperator", + "start":11,"end":21,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":21}}, + "operator": "readonly", + "typeAnnotation": { + "type": "TSTypeReference", + "start":20,"end":21,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":21}}, + "typeName": { + "type": "Identifier", + "start":20,"end":21,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":21},"identifierName":"T"}, + "name": "T" + } + } + }, + "trailingComments": [ + { + "type": "CommentLine", + "value": " Error", + "start":24,"end":32,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":32}} + } + ] + } + ], + "directives": [] + }, + "comments": [ + { + "type": "CommentLine", + "value": " Error", + "start":24,"end":32,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":32}} + } + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/types/read-only-3/options.json b/packages/babel-parser/test/fixtures/typescript/types/read-only-3/options.json deleted file mode 100644 index cdb818eee9b2..000000000000 --- a/packages/babel-parser/test/fixtures/typescript/types/read-only-3/options.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "sourceType": "module", - "plugins": [ - "typescript" - ], - "throws": "'readonly' type modifier is only permitted on array and tuple literal types. (1:11)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/types/read-only-3/output.json b/packages/babel-parser/test/fixtures/typescript/types/read-only-3/output.json new file mode 100644 index 000000000000..852a87e4d306 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/types/read-only-3/output.json @@ -0,0 +1,57 @@ +{ + "type": "File", + "start":0,"end":48,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":48}}, + "errors": [ + "SyntaxError: 'readonly' type modifier is only permitted on array and tuple literal types. (1:11)" + ], + "program": { + "type": "Program", + "start":0,"end":48,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":48}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "TSTypeAliasDeclaration", + "start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":38}}, + "id": { + "type": "Identifier", + "start":5,"end":8,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":8},"identifierName":"T32"}, + "name": "T32" + }, + "typeAnnotation": { + "type": "TSTypeOperator", + "start":11,"end":37,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":37}}, + "operator": "readonly", + "typeAnnotation": { + "type": "TSTypeOperator", + "start":20,"end":37,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":37}}, + "operator": "readonly", + "typeAnnotation": { + "type": "TSArrayType", + "start":29,"end":37,"loc":{"start":{"line":1,"column":29},"end":{"line":1,"column":37}}, + "elementType": { + "type": "TSStringKeyword", + "start":29,"end":35,"loc":{"start":{"line":1,"column":29},"end":{"line":1,"column":35}} + } + } + } + }, + "trailingComments": [ + { + "type": "CommentLine", + "value": " Error", + "start":40,"end":48,"loc":{"start":{"line":1,"column":40},"end":{"line":1,"column":48}} + } + ] + } + ], + "directives": [] + }, + "comments": [ + { + "type": "CommentLine", + "value": " Error", + "start":40,"end":48,"loc":{"start":{"line":1,"column":40},"end":{"line":1,"column":48}} + } + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/types/read-only-4/options.json b/packages/babel-parser/test/fixtures/typescript/types/read-only-4/options.json deleted file mode 100644 index cdb818eee9b2..000000000000 --- a/packages/babel-parser/test/fixtures/typescript/types/read-only-4/options.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "sourceType": "module", - "plugins": [ - "typescript" - ], - "throws": "'readonly' type modifier is only permitted on array and tuple literal types. (1:11)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/types/read-only-4/output.json b/packages/babel-parser/test/fixtures/typescript/types/read-only-4/output.json new file mode 100644 index 000000000000..b787889c9d34 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/types/read-only-4/output.json @@ -0,0 +1,63 @@ +{ + "type": "File", + "start":0,"end":44,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":44}}, + "errors": [ + "SyntaxError: 'readonly' type modifier is only permitted on array and tuple literal types. (1:11)" + ], + "program": { + "type": "Program", + "start":0,"end":44,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":44}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "TSTypeAliasDeclaration", + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, + "id": { + "type": "Identifier", + "start":5,"end":8,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":8},"identifierName":"T33"}, + "name": "T33" + }, + "typeAnnotation": { + "type": "TSTypeOperator", + "start":11,"end":33,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":33}}, + "operator": "readonly", + "typeAnnotation": { + "type": "TSTypeReference", + "start":20,"end":33,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":33}}, + "typeName": { + "type": "Identifier", + "start":20,"end":25,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":25},"identifierName":"Array"}, + "name": "Array" + }, + "typeParameters": { + "type": "TSTypeParameterInstantiation", + "start":25,"end":33,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":33}}, + "params": [ + { + "type": "TSStringKeyword", + "start":26,"end":32,"loc":{"start":{"line":1,"column":26},"end":{"line":1,"column":32}} + } + ] + } + } + }, + "trailingComments": [ + { + "type": "CommentLine", + "value": " Error", + "start":36,"end":44,"loc":{"start":{"line":1,"column":36},"end":{"line":1,"column":44}} + } + ] + } + ], + "directives": [] + }, + "comments": [ + { + "type": "CommentLine", + "value": " Error", + "start":36,"end":44,"loc":{"start":{"line":1,"column":36},"end":{"line":1,"column":44}} + } + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/types/reference-generic-nested/output.json b/packages/babel-parser/test/fixtures/typescript/types/reference-generic-nested/output.json index d233c0685d3c..15946fb36833 100644 --- a/packages/babel-parser/test/fixtures/typescript/types/reference-generic-nested/output.json +++ b/packages/babel-parser/test/fixtures/typescript/types/reference-generic-nested/output.json @@ -1,199 +1,53 @@ { "type": "File", - "start": 0, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, "program": { "type": "Program", - "start": 0, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":4,"end":27,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":27}}, "id": { "type": "Identifier", - "start": 4, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 27 - }, - "identifierName": "x" - }, + "start":4,"end":27,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":27},"identifierName":"x"}, "name": "x", "typeAnnotation": { "type": "TSTypeAnnotation", - "start": 5, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":5,"end":27,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":27}}, "typeAnnotation": { "type": "TSTypeReference", - "start": 7, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":7,"end":27,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":27}}, "typeName": { "type": "Identifier", - "start": 7, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "Array" - }, + "start":7,"end":12,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":12},"identifierName":"Array"}, "name": "Array" }, "typeParameters": { "type": "TSTypeParameterInstantiation", - "start": 12, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":12,"end":27,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":27}}, "params": [ { "type": "TSTypeReference", - "start": 13, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":13,"end":26,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":26}}, "typeName": { "type": "Identifier", - "start": 13, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 18 - }, - "identifierName": "Array" - }, + "start":13,"end":18,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":18},"identifierName":"Array"}, "name": "Array" }, "typeParameters": { "type": "TSTypeParameterInstantiation", - "start": 18, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 26 - } - }, + "start":18,"end":26,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":26}}, "params": [ { "type": "TSNumberKeyword", - "start": 19, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 25 - } - } + "start":19,"end":25,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":25}} } ] } diff --git a/packages/babel-parser/test/fixtures/typescript/types/reference-generic/output.json b/packages/babel-parser/test/fixtures/typescript/types/reference-generic/output.json index 56873561f534..644490d17720 100644 --- a/packages/babel-parser/test/fixtures/typescript/types/reference-generic/output.json +++ b/packages/babel-parser/test/fixtures/typescript/types/reference-generic/output.json @@ -1,153 +1,41 @@ { "type": "File", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, "program": { "type": "Program", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":4,"end":20,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":20}}, "id": { "type": "Identifier", - "start": 4, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 20 - }, - "identifierName": "x" - }, + "start":4,"end":20,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":20},"identifierName":"x"}, "name": "x", "typeAnnotation": { "type": "TSTypeAnnotation", - "start": 5, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":5,"end":20,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":20}}, "typeAnnotation": { "type": "TSTypeReference", - "start": 7, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":7,"end":20,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":20}}, "typeName": { "type": "Identifier", - "start": 7, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "Array" - }, + "start":7,"end":12,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":12},"identifierName":"Array"}, "name": "Array" }, "typeParameters": { "type": "TSTypeParameterInstantiation", - "start": 12, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":12,"end":20,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":20}}, "params": [ { "type": "TSNumberKeyword", - "start": 13, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 19 - } - } + "start":13,"end":19,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":19}} } ] } diff --git a/packages/babel-parser/test/fixtures/typescript/types/reference/output.json b/packages/babel-parser/test/fixtures/typescript/types/reference/output.json index 2608329122d3..74f7532232cd 100644 --- a/packages/babel-parser/test/fixtures/typescript/types/reference/output.json +++ b/packages/babel-parser/test/fixtures/typescript/types/reference/output.json @@ -1,122 +1,32 @@ { "type": "File", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "program": { "type": "Program", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":4,"end":8,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":8}}, "id": { "type": "Identifier", - "start": 4, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 8 - }, - "identifierName": "x" - }, + "start":4,"end":8,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":8},"identifierName":"x"}, "name": "x", "typeAnnotation": { "type": "TSTypeAnnotation", - "start": 5, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":5,"end":8,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":8}}, "typeAnnotation": { "type": "TSTypeReference", - "start": 7, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - }, + "start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8}}, "typeName": { "type": "Identifier", - "start": 7, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - }, - "identifierName": "T" - }, + "start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8},"identifierName":"T"}, "name": "T" } } diff --git a/packages/babel-parser/test/fixtures/typescript/types/tuple-empty/output.json b/packages/babel-parser/test/fixtures/typescript/types/tuple-empty/output.json index 667ffcb301f5..6137ce407347 100644 --- a/packages/babel-parser/test/fixtures/typescript/types/tuple-empty/output.json +++ b/packages/babel-parser/test/fixtures/typescript/types/tuple-empty/output.json @@ -1,107 +1,29 @@ { "type": "File", - "start": 0, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, "program": { "type": "Program", - "start": 0, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - }, + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":4,"end":9,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":9}}, "id": { "type": "Identifier", - "start": 4, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "x" - }, + "start":4,"end":9,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":9},"identifierName":"x"}, "name": "x", "typeAnnotation": { "type": "TSTypeAnnotation", - "start": 5, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":5,"end":9,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":9}}, "typeAnnotation": { "type": "TSTupleType", - "start": 7, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 9 - } - }, + "start":7,"end":9,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":9}}, "elementTypes": [] } } diff --git a/packages/babel-parser/test/fixtures/typescript/types/tuple-optional-invalid/options.json b/packages/babel-parser/test/fixtures/typescript/types/tuple-optional-invalid/options.json deleted file mode 100644 index 15111b29065f..000000000000 --- a/packages/babel-parser/test/fixtures/typescript/types/tuple-optional-invalid/options.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "sourceType": "module", - "plugins": ["typescript"], - "throws": "A required element cannot follow an optional element. (1:17)" -} diff --git a/packages/babel-parser/test/fixtures/typescript/types/tuple-optional-invalid/output.json b/packages/babel-parser/test/fixtures/typescript/types/tuple-optional-invalid/output.json new file mode 100644 index 000000000000..f15efb254a34 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/types/tuple-optional-invalid/output.json @@ -0,0 +1,55 @@ +{ + "type": "File", + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, + "errors": [ + "SyntaxError: A required element cannot follow an optional element. (1:17)" + ], + "program": { + "type": "Program", + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":4,"end":24,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":24}}, + "id": { + "type": "Identifier", + "start":4,"end":24,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":24},"identifierName":"x"}, + "name": "x", + "typeAnnotation": { + "type": "TSTypeAnnotation", + "start":5,"end":24,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":24}}, + "typeAnnotation": { + "type": "TSTupleType", + "start":7,"end":24,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":24}}, + "elementTypes": [ + { + "type": "TSOptionalType", + "start":8,"end":15,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":15}}, + "typeAnnotation": { + "type": "TSStringKeyword", + "start":8,"end":14,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":14}} + } + }, + { + "type": "TSNumberKeyword", + "start":17,"end":23,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":23}} + } + ] + } + } + }, + "init": null + } + ], + "kind": "let" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/types/tuple-optional/output.json b/packages/babel-parser/test/fixtures/typescript/types/tuple-optional/output.json index 90aaa9bc8aac..224e952da41a 100644 --- a/packages/babel-parser/test/fixtures/typescript/types/tuple-optional/output.json +++ b/packages/babel-parser/test/fixtures/typescript/types/tuple-optional/output.json @@ -1,225 +1,59 @@ { "type": "File", - "start": 0, - "end": 44, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 44 - } - }, + "start":0,"end":44,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":44}}, "program": { "type": "Program", - "start": 0, - "end": 44, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 44 - } - }, + "start":0,"end":44,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":44}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 44, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 44 - } - }, + "start":0,"end":44,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":44}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 44, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 44 - } - }, + "start":4,"end":44,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":44}}, "id": { "type": "Identifier", - "start": 4, - "end": 44, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 44 - }, - "identifierName": "x" - }, + "start":4,"end":44,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":44},"identifierName":"x"}, "name": "x", "typeAnnotation": { "type": "TSTypeAnnotation", - "start": 5, - "end": 44, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 44 - } - }, + "start":5,"end":44,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":44}}, "typeAnnotation": { "type": "TSTupleType", - "start": 7, - "end": 44, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 44 - } - }, + "start":7,"end":44,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":44}}, "elementTypes": [ { "type": "TSStringKeyword", - "start": 8, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 14 - } - } + "start":8,"end":14,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":14}} }, { "type": "TSOptionalType", - "start": 16, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":16,"end":23,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":23}}, "typeAnnotation": { "type": "TSNumberKeyword", - "start": 16, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 22 - } - } + "start":16,"end":22,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":22}} } }, { "type": "TSOptionalType", - "start": 25, - "end": 43, - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 43 - } - }, + "start":25,"end":43,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":43}}, "typeAnnotation": { "type": "TSParenthesizedType", - "start": 25, - "end": 42, - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 42 - } - }, + "start":25,"end":42,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":42}}, "typeAnnotation": { "type": "TSUnionType", - "start": 26, - "end": 41, - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 41 - } - }, + "start":26,"end":41,"loc":{"start":{"line":1,"column":26},"end":{"line":1,"column":41}}, "types": [ { "type": "TSStringKeyword", - "start": 26, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 32 - } - } + "start":26,"end":32,"loc":{"start":{"line":1,"column":26},"end":{"line":1,"column":32}} }, { "type": "TSNumberKeyword", - "start": 35, - "end": 41, - "loc": { - "start": { - "line": 1, - "column": 35 - }, - "end": { - "line": 1, - "column": 41 - } - } + "start":35,"end":41,"loc":{"start":{"line":1,"column":35},"end":{"line":1,"column":41}} } ] } @@ -237,4 +71,4 @@ ], "directives": [] } -} +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/types/tuple-rest-after-optional/output.json b/packages/babel-parser/test/fixtures/typescript/types/tuple-rest-after-optional/output.json index 1d71afdaae49..c3bd73a9c07b 100644 --- a/packages/babel-parser/test/fixtures/typescript/types/tuple-rest-after-optional/output.json +++ b/packages/babel-parser/test/fixtures/typescript/types/tuple-rest-after-optional/output.json @@ -1,63 +1,18 @@ { "type": "File", - "start": 0, - "end": 56, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 56 - } - }, + "start":0,"end":56,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":56}}, "program": { "type": "Program", - "start": 0, - "end": 56, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 56 - } - }, + "start":0,"end":56,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":56}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "FunctionDeclaration", - "start": 0, - "end": 56, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 56 - } - }, + "start":0,"end":56,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":56}}, "id": { "type": "Identifier", - "start": 9, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "foo" - }, + "start":9,"end":12,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":12},"identifierName":"foo"}, "name": "foo" }, "generator": false, @@ -65,151 +20,40 @@ "params": [ { "type": "RestElement", - "start": 13, - "end": 52, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 52 - } - }, + "start":13,"end":52,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":52}}, "argument": { "type": "Identifier", - "start": 16, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 20 - }, - "identifierName": "args" - }, + "start":16,"end":20,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":20},"identifierName":"args"}, "name": "args" }, "typeAnnotation": { "type": "TSTypeAnnotation", - "start": 20, - "end": 52, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 52 - } - }, + "start":20,"end":52,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":52}}, "typeAnnotation": { "type": "TSTupleType", - "start": 22, - "end": 52, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 52 - } - }, + "start":22,"end":52,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":52}}, "elementTypes": [ { "type": "TSNumberKeyword", - "start": 23, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 29 - } - } + "start":23,"end":29,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":29}} }, { "type": "TSOptionalType", - "start": 31, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 31 - }, - "end": { - "line": 1, - "column": 38 - } - }, + "start":31,"end":38,"loc":{"start":{"line":1,"column":31},"end":{"line":1,"column":38}}, "typeAnnotation": { "type": "TSStringKeyword", - "start": 31, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 31 - }, - "end": { - "line": 1, - "column": 37 - } - } + "start":31,"end":37,"loc":{"start":{"line":1,"column":31},"end":{"line":1,"column":37}} } }, { "type": "TSRestType", - "start": 40, - "end": 51, - "loc": { - "start": { - "line": 1, - "column": 40 - }, - "end": { - "line": 1, - "column": 51 - } - }, + "start":40,"end":51,"loc":{"start":{"line":1,"column":40},"end":{"line":1,"column":51}}, "typeAnnotation": { "type": "TSArrayType", - "start": 43, - "end": 51, - "loc": { - "start": { - "line": 1, - "column": 43 - }, - "end": { - "line": 1, - "column": 51 - } - }, + "start":43,"end":51,"loc":{"start":{"line":1,"column":43},"end":{"line":1,"column":51}}, "elementType": { "type": "TSNumberKeyword", - "start": 43, - "end": 49, - "loc": { - "start": { - "line": 1, - "column": 43 - }, - "end": { - "line": 1, - "column": 49 - } - } + "start":43,"end":49,"loc":{"start":{"line":1,"column":43},"end":{"line":1,"column":49}} } } } @@ -220,18 +64,7 @@ ], "body": { "type": "BlockStatement", - "start": 54, - "end": 56, - "loc": { - "start": { - "line": 1, - "column": 54 - }, - "end": { - "line": 1, - "column": 56 - } - }, + "start":54,"end":56,"loc":{"start":{"line":1,"column":54},"end":{"line":1,"column":56}}, "body": [], "directives": [] } diff --git a/packages/babel-parser/test/fixtures/typescript/types/tuple-rest-trailing-comma/input.ts b/packages/babel-parser/test/fixtures/typescript/types/tuple-rest-trailing-comma/input.ts new file mode 100644 index 000000000000..416732dd8c56 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/types/tuple-rest-trailing-comma/input.ts @@ -0,0 +1 @@ +let x: [string, ...string[],] diff --git a/packages/babel-parser/test/fixtures/typescript/types/tuple-rest-trailing-comma/output.json b/packages/babel-parser/test/fixtures/typescript/types/tuple-rest-trailing-comma/output.json new file mode 100644 index 000000000000..fcc0224f81ad --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/types/tuple-rest-trailing-comma/output.json @@ -0,0 +1,56 @@ +{ + "type": "File", + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, + "program": { + "type": "Program", + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":4,"end":29,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":29}}, + "id": { + "type": "Identifier", + "start":4,"end":29,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":29},"identifierName":"x"}, + "name": "x", + "typeAnnotation": { + "type": "TSTypeAnnotation", + "start":5,"end":29,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":29}}, + "typeAnnotation": { + "type": "TSTupleType", + "start":7,"end":29,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":29}}, + "elementTypes": [ + { + "type": "TSStringKeyword", + "start":8,"end":14,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":14}} + }, + { + "type": "TSRestType", + "start":16,"end":27,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":27}}, + "typeAnnotation": { + "type": "TSArrayType", + "start":19,"end":27,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":27}}, + "elementType": { + "type": "TSStringKeyword", + "start":19,"end":25,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":25}} + } + } + } + ] + } + } + }, + "init": null + } + ], + "kind": "let" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/types/tuple-rest/output.json b/packages/babel-parser/test/fixtures/typescript/types/tuple-rest/output.json index fd5b5999c51a..45db8aad9323 100644 --- a/packages/babel-parser/test/fixtures/typescript/types/tuple-rest/output.json +++ b/packages/babel-parser/test/fixtures/typescript/types/tuple-rest/output.json @@ -1,165 +1,43 @@ { "type": "File", - "start": 0, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, "program": { "type": "Program", - "start": 0, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":4,"end":28,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":28}}, "id": { "type": "Identifier", - "start": 4, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 28 - }, - "identifierName": "x" - }, + "start":4,"end":28,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":28},"identifierName":"x"}, "name": "x", "typeAnnotation": { "type": "TSTypeAnnotation", - "start": 5, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":5,"end":28,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":28}}, "typeAnnotation": { "type": "TSTupleType", - "start": 7, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 28 - } - }, + "start":7,"end":28,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":28}}, "elementTypes": [ { "type": "TSStringKeyword", - "start": 8, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 14 - } - } + "start":8,"end":14,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":14}} }, { "type": "TSRestType", - "start": 16, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":16,"end":27,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":27}}, "typeAnnotation": { "type": "TSArrayType", - "start": 19, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 27 - } - }, + "start":19,"end":27,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":27}}, "elementType": { "type": "TSNumberKeyword", - "start": 19, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 25 - } - } + "start":19,"end":25,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":25}} } } } @@ -175,4 +53,4 @@ ], "directives": [] } -} +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/types/tuple/output.json b/packages/babel-parser/test/fixtures/typescript/types/tuple/output.json index 5b6c0e2cffd7..429c0b8d80df 100644 --- a/packages/babel-parser/test/fixtures/typescript/types/tuple/output.json +++ b/packages/babel-parser/test/fixtures/typescript/types/tuple/output.json @@ -1,152 +1,41 @@ { "type": "File", - "start": 0, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, "program": { "type": "Program", - "start": 0, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 32 - } - }, + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":4,"end":31,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":31}}, "id": { "type": "Identifier", - "start": 4, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 31 - }, - "identifierName": "x" - }, + "start":4,"end":31,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":31},"identifierName":"x"}, "name": "x", "typeAnnotation": { "type": "TSTypeAnnotation", - "start": 5, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":5,"end":31,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":31}}, "typeAnnotation": { "type": "TSTupleType", - "start": 7, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 31 - } - }, + "start":7,"end":31,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":31}}, "elementTypes": [ { "type": "TSNumberKeyword", - "start": 8, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 14 - } - } + "start":8,"end":14,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":14}} }, { "type": "TSNumberKeyword", - "start": 16, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 22 - } - } + "start":16,"end":22,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":22}} }, { "type": "TSNumberKeyword", - "start": 24, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 30 - } - } + "start":24,"end":30,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":30}} } ] } diff --git a/packages/babel-parser/test/fixtures/typescript/types/type-literal/output.json b/packages/babel-parser/test/fixtures/typescript/types/type-literal/output.json index d3e4066546fb..4522046cb547 100644 --- a/packages/babel-parser/test/fixtures/typescript/types/type-literal/output.json +++ b/packages/babel-parser/test/fixtures/typescript/types/type-literal/output.json @@ -1,168 +1,45 @@ { "type": "File", - "start": 0, - "end": 120, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 96 - } - }, + "start":0,"end":120,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":96}}, "program": { "type": "Program", - "start": 0, - "end": 120, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 96 - } - }, + "start":0,"end":120,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":96}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":4,"end":22,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":22}}, "id": { "type": "Identifier", - "start": 4, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 22 - }, - "identifierName": "obj" - }, + "start":4,"end":22,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":22},"identifierName":"obj"}, "name": "obj", "typeAnnotation": { "type": "TSTypeAnnotation", - "start": 7, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":7,"end":22,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":22}}, "typeAnnotation": { "type": "TSTypeLiteral", - "start": 9, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 22 - } - }, + "start":9,"end":22,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":22}}, "members": [ { "type": "TSPropertySignature", - "start": 11, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":11,"end":20,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":20}}, "key": { "type": "Identifier", - "start": 11, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "x" - }, + "start":11,"end":12,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":12},"identifierName":"x"}, "name": "x" }, "computed": false, "typeAnnotation": { "type": "TSTypeAnnotation", - "start": 12, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 20 - } - }, + "start":12,"end":20,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":20}}, "typeAnnotation": { "type": "TSNumberKeyword", - "start": 14, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 20 - } - } + "start":14,"end":20,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":20}} } } } @@ -178,18 +55,7 @@ { "type": "CommentLine", "value": " Type literals have the same body syntax as interfaces, so see `interface` directory for that.", - "start": 24, - "end": 120, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 96 - } - } + "start":24,"end":120,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":96}} } ] } @@ -200,18 +66,7 @@ { "type": "CommentLine", "value": " Type literals have the same body syntax as interfaces, so see `interface` directory for that.", - "start": 24, - "end": 120, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 96 - } - } + "start":24,"end":120,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":96}} } ] } \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/types/type-operator/output.json b/packages/babel-parser/test/fixtures/typescript/types/type-operator/output.json index 4f8b2fb7589c..166fbe689328 100644 --- a/packages/babel-parser/test/fixtures/typescript/types/type-operator/output.json +++ b/packages/babel-parser/test/fixtures/typescript/types/type-operator/output.json @@ -1,137 +1,36 @@ { "type": "File", - "start": 0, - "end": 98, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 34 - } - }, + "start":0,"end":98,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":34}}, "program": { "type": "Program", - "start": 0, - "end": 98, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 34 - } - }, + "start":0,"end":98,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":34}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":4,"end":14,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":14}}, "id": { "type": "Identifier", - "start": 4, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 14 - }, - "identifierName": "x" - }, + "start":4,"end":14,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":14},"identifierName":"x"}, "name": "x", "typeAnnotation": { "type": "TSTypeAnnotation", - "start": 5, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":5,"end":14,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":14}}, "typeAnnotation": { "type": "TSTypeOperator", - "start": 7, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":7,"end":14,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":14}}, "operator": "keyof", "typeAnnotation": { "type": "TSTypeReference", - "start": 13, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":13,"end":14,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":14}}, "typeName": { "type": "Identifier", - "start": 13, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - }, - "identifierName": "T" - }, + "start":13,"end":14,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":14},"identifierName":"T"}, "name": "T" } } @@ -145,92 +44,25 @@ }, { "type": "VariableDeclaration", - "start": 16, - "end": 37, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 21 - } - }, + "start":16,"end":37,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":21}}, "declarations": [ { "type": "VariableDeclarator", - "start": 20, - "end": 36, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 20 - } - }, + "start":20,"end":36,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":20}}, "id": { "type": "Identifier", - "start": 20, - "end": 36, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 20 - }, - "identifierName": "y" - }, + "start":20,"end":36,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":20},"identifierName":"y"}, "name": "y", "typeAnnotation": { "type": "TSTypeAnnotation", - "start": 21, - "end": 36, - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 20 - } - }, + "start":21,"end":36,"loc":{"start":{"line":2,"column":5},"end":{"line":2,"column":20}}, "typeAnnotation": { "type": "TSTypeOperator", - "start": 23, - "end": 36, - "loc": { - "start": { - "line": 2, - "column": 7 - }, - "end": { - "line": 2, - "column": 20 - } - }, + "start":23,"end":36,"loc":{"start":{"line":2,"column":7},"end":{"line":2,"column":20}}, "operator": "unique", "typeAnnotation": { "type": "TSSymbolKeyword", - "start": 30, - "end": 36, - "loc": { - "start": { - "line": 2, - "column": 14 - }, - "end": { - "line": 2, - "column": 20 - } - } + "start":30,"end":36,"loc":{"start":{"line":2,"column":14},"end":{"line":2,"column":20}} } } } @@ -242,106 +74,28 @@ }, { "type": "VariableDeclaration", - "start": 38, - "end": 63, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 25 - } - }, + "start":38,"end":63,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":25}}, "declarations": [ { "type": "VariableDeclarator", - "start": 42, - "end": 62, - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 24 - } - }, + "start":42,"end":62,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":24}}, "id": { "type": "Identifier", - "start": 42, - "end": 62, - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 24 - }, - "identifierName": "z" - }, + "start":42,"end":62,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":24},"identifierName":"z"}, "name": "z", "typeAnnotation": { "type": "TSTypeAnnotation", - "start": 43, - "end": 62, - "loc": { - "start": { - "line": 3, - "column": 5 - }, - "end": { - "line": 3, - "column": 24 - } - }, + "start":43,"end":62,"loc":{"start":{"line":3,"column":5},"end":{"line":3,"column":24}}, "typeAnnotation": { "type": "TSTypeOperator", - "start": 45, - "end": 62, - "loc": { - "start": { - "line": 3, - "column": 7 - }, - "end": { - "line": 3, - "column": 24 - } - }, + "start":45,"end":62,"loc":{"start":{"line":3,"column":7},"end":{"line":3,"column":24}}, "operator": "readonly", "typeAnnotation": { "type": "TSArrayType", - "start": 54, - "end": 62, - "loc": { - "start": { - "line": 3, - "column": 16 - }, - "end": { - "line": 3, - "column": 24 - } - }, + "start":54,"end":62,"loc":{"start":{"line":3,"column":16},"end":{"line":3,"column":24}}, "elementType": { "type": "TSNumberKeyword", - "start": 54, - "end": 60, - "loc": { - "start": { - "line": 3, - "column": 16 - }, - "end": { - "line": 3, - "column": 22 - } - } + "start":54,"end":60,"loc":{"start":{"line":3,"column":16},"end":{"line":3,"column":22}} } } } @@ -354,122 +108,33 @@ }, { "type": "VariableDeclaration", - "start": 64, - "end": 98, - "loc": { - "start": { - "line": 4, - "column": 0 - }, - "end": { - "line": 4, - "column": 34 - } - }, + "start":64,"end":98,"loc":{"start":{"line":4,"column":0},"end":{"line":4,"column":34}}, "declarations": [ { "type": "VariableDeclarator", - "start": 68, - "end": 97, - "loc": { - "start": { - "line": 4, - "column": 4 - }, - "end": { - "line": 4, - "column": 33 - } - }, + "start":68,"end":97,"loc":{"start":{"line":4,"column":4},"end":{"line":4,"column":33}}, "id": { "type": "Identifier", - "start": 68, - "end": 97, - "loc": { - "start": { - "line": 4, - "column": 4 - }, - "end": { - "line": 4, - "column": 33 - }, - "identifierName": "z1" - }, + "start":68,"end":97,"loc":{"start":{"line":4,"column":4},"end":{"line":4,"column":33},"identifierName":"z1"}, "name": "z1", "typeAnnotation": { "type": "TSTypeAnnotation", - "start": 70, - "end": 97, - "loc": { - "start": { - "line": 4, - "column": 6 - }, - "end": { - "line": 4, - "column": 33 - } - }, + "start":70,"end":97,"loc":{"start":{"line":4,"column":6},"end":{"line":4,"column":33}}, "typeAnnotation": { "type": "TSTypeOperator", - "start": 72, - "end": 97, - "loc": { - "start": { - "line": 4, - "column": 8 - }, - "end": { - "line": 4, - "column": 33 - } - }, + "start":72,"end":97,"loc":{"start":{"line":4,"column":8},"end":{"line":4,"column":33}}, "operator": "readonly", "typeAnnotation": { "type": "TSTupleType", - "start": 81, - "end": 97, - "loc": { - "start": { - "line": 4, - "column": 17 - }, - "end": { - "line": 4, - "column": 33 - } - }, + "start":81,"end":97,"loc":{"start":{"line":4,"column":17},"end":{"line":4,"column":33}}, "elementTypes": [ { "type": "TSNumberKeyword", - "start": 82, - "end": 88, - "loc": { - "start": { - "line": 4, - "column": 18 - }, - "end": { - "line": 4, - "column": 24 - } - } + "start":82,"end":88,"loc":{"start":{"line":4,"column":18},"end":{"line":4,"column":24}} }, { "type": "TSNumberKeyword", - "start": 90, - "end": 96, - "loc": { - "start": { - "line": 4, - "column": 26 - }, - "end": { - "line": 4, - "column": 32 - } - } + "start":90,"end":96,"loc":{"start":{"line":4,"column":26},"end":{"line":4,"column":32}} } ] } diff --git a/packages/babel-parser/test/fixtures/typescript/types/typeof/output.json b/packages/babel-parser/test/fixtures/typescript/types/typeof/output.json index 20e7401b1fe8..4887ea6d5bdd 100644 --- a/packages/babel-parser/test/fixtures/typescript/types/typeof/output.json +++ b/packages/babel-parser/test/fixtures/typescript/types/typeof/output.json @@ -1,153 +1,40 @@ { "type": "File", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, "program": { "type": "Program", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":4,"end":17,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":17}}, "id": { "type": "Identifier", - "start": 4, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 17 - }, - "identifierName": "x" - }, + "start":4,"end":17,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":17},"identifierName":"x"}, "name": "x", "typeAnnotation": { "type": "TSTypeAnnotation", - "start": 5, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":5,"end":17,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":17}}, "typeAnnotation": { "type": "TSTypeQuery", - "start": 7, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":7,"end":17,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":17}}, "exprName": { "type": "TSQualifiedName", - "start": 14, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 17 - } - }, + "start":14,"end":17,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":17}}, "left": { "type": "Identifier", - "start": 14, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - }, - "identifierName": "y" - }, + "start":14,"end":15,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":15},"identifierName":"y"}, "name": "y" }, "right": { "type": "Identifier", - "start": 16, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - }, - "identifierName": "z" - }, + "start":16,"end":17,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":17},"identifierName":"z"}, "name": "z" } } diff --git a/packages/babel-parser/test/fixtures/typescript/types/union-intersection/output.json b/packages/babel-parser/test/fixtures/typescript/types/union-intersection/output.json index 4d1c861ed1df..6d659d4ac72c 100644 --- a/packages/babel-parser/test/fixtures/typescript/types/union-intersection/output.json +++ b/packages/babel-parser/test/fixtures/typescript/types/union-intersection/output.json @@ -1,152 +1,41 @@ { "type": "File", - "start": 0, - "end": 160, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 43 - } - }, + "start":0,"end":160,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":43}}, "program": { "type": "Program", - "start": 0, - "end": 160, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 43 - } - }, + "start":0,"end":160,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":43}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 37 - } - }, + "start":0,"end":37,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":37}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":4,"end":36,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":36}}, "id": { "type": "Identifier", - "start": 4, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 36 - }, - "identifierName": "union" - }, + "start":4,"end":36,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":36},"identifierName":"union"}, "name": "union", "typeAnnotation": { "type": "TSTypeAnnotation", - "start": 9, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":9,"end":36,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":36}}, "typeAnnotation": { "type": "TSUnionType", - "start": 11, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 36 - } - }, + "start":11,"end":36,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":36}}, "types": [ { "type": "TSNumberKeyword", - "start": 11, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 17 - } - } + "start":11,"end":17,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":17}} }, { "type": "TSNullKeyword", - "start": 20, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 24 - } - } + "start":20,"end":24,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":24}} }, { "type": "TSUndefinedKeyword", - "start": 27, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 36 - } - } + "start":27,"end":36,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":36}} } ] } @@ -159,107 +48,29 @@ }, { "type": "VariableDeclaration", - "start": 38, - "end": 72, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 34 - } - }, + "start":38,"end":72,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":34}}, "declarations": [ { "type": "VariableDeclarator", - "start": 42, - "end": 71, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 33 - } - }, + "start":42,"end":71,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":33}}, "id": { "type": "Identifier", - "start": 42, - "end": 71, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 33 - }, - "identifierName": "intersection" - }, + "start":42,"end":71,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":33},"identifierName":"intersection"}, "name": "intersection", "typeAnnotation": { "type": "TSTypeAnnotation", - "start": 54, - "end": 71, - "loc": { - "start": { - "line": 2, - "column": 16 - }, - "end": { - "line": 2, - "column": 33 - } - }, + "start":54,"end":71,"loc":{"start":{"line":2,"column":16},"end":{"line":2,"column":33}}, "typeAnnotation": { "type": "TSIntersectionType", - "start": 56, - "end": 71, - "loc": { - "start": { - "line": 2, - "column": 18 - }, - "end": { - "line": 2, - "column": 33 - } - }, + "start":56,"end":71,"loc":{"start":{"line":2,"column":18},"end":{"line":2,"column":33}}, "types": [ { "type": "TSNumberKeyword", - "start": 56, - "end": 62, - "loc": { - "start": { - "line": 2, - "column": 18 - }, - "end": { - "line": 2, - "column": 24 - } - } + "start":56,"end":62,"loc":{"start":{"line":2,"column":18},"end":{"line":2,"column":24}} }, { "type": "TSStringKeyword", - "start": 65, - "end": 71, - "loc": { - "start": { - "line": 2, - "column": 27 - }, - "end": { - "line": 2, - "column": 33 - } - } + "start":65,"end":71,"loc":{"start":{"line":2,"column":27},"end":{"line":2,"column":33}} } ] } @@ -272,137 +83,37 @@ }, { "type": "VariableDeclaration", - "start": 73, - "end": 116, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 43 - } - }, + "start":73,"end":116,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":43}}, "declarations": [ { "type": "VariableDeclarator", - "start": 77, - "end": 115, - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 42 - } - }, + "start":77,"end":115,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":42}}, "id": { "type": "Identifier", - "start": 77, - "end": 115, - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 42 - }, - "identifierName": "precedence1" - }, + "start":77,"end":115,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":42},"identifierName":"precedence1"}, "name": "precedence1", "typeAnnotation": { "type": "TSTypeAnnotation", - "start": 88, - "end": 115, - "loc": { - "start": { - "line": 3, - "column": 15 - }, - "end": { - "line": 3, - "column": 42 - } - }, + "start":88,"end":115,"loc":{"start":{"line":3,"column":15},"end":{"line":3,"column":42}}, "typeAnnotation": { "type": "TSUnionType", - "start": 90, - "end": 115, - "loc": { - "start": { - "line": 3, - "column": 17 - }, - "end": { - "line": 3, - "column": 42 - } - }, + "start":90,"end":115,"loc":{"start":{"line":3,"column":17},"end":{"line":3,"column":42}}, "types": [ { "type": "TSNumberKeyword", - "start": 90, - "end": 96, - "loc": { - "start": { - "line": 3, - "column": 17 - }, - "end": { - "line": 3, - "column": 23 - } - } + "start":90,"end":96,"loc":{"start":{"line":3,"column":17},"end":{"line":3,"column":23}} }, { "type": "TSIntersectionType", - "start": 99, - "end": 115, - "loc": { - "start": { - "line": 3, - "column": 26 - }, - "end": { - "line": 3, - "column": 42 - } - }, + "start":99,"end":115,"loc":{"start":{"line":3,"column":26},"end":{"line":3,"column":42}}, "types": [ { "type": "TSStringKeyword", - "start": 99, - "end": 105, - "loc": { - "start": { - "line": 3, - "column": 26 - }, - "end": { - "line": 3, - "column": 32 - } - } + "start":99,"end":105,"loc":{"start":{"line":3,"column":26},"end":{"line":3,"column":32}} }, { "type": "TSBooleanKeyword", - "start": 108, - "end": 115, - "loc": { - "start": { - "line": 3, - "column": 35 - }, - "end": { - "line": 3, - "column": 42 - } - } + "start":108,"end":115,"loc":{"start":{"line":3,"column":35},"end":{"line":3,"column":42}} } ] } @@ -417,139 +128,39 @@ }, { "type": "VariableDeclaration", - "start": 117, - "end": 160, - "loc": { - "start": { - "line": 4, - "column": 0 - }, - "end": { - "line": 4, - "column": 43 - } - }, + "start":117,"end":160,"loc":{"start":{"line":4,"column":0},"end":{"line":4,"column":43}}, "declarations": [ { "type": "VariableDeclarator", - "start": 121, - "end": 159, - "loc": { - "start": { - "line": 4, - "column": 4 - }, - "end": { - "line": 4, - "column": 42 - } - }, + "start":121,"end":159,"loc":{"start":{"line":4,"column":4},"end":{"line":4,"column":42}}, "id": { "type": "Identifier", - "start": 121, - "end": 159, - "loc": { - "start": { - "line": 4, - "column": 4 - }, - "end": { - "line": 4, - "column": 42 - }, - "identifierName": "precedence2" - }, + "start":121,"end":159,"loc":{"start":{"line":4,"column":4},"end":{"line":4,"column":42},"identifierName":"precedence2"}, "name": "precedence2", "typeAnnotation": { "type": "TSTypeAnnotation", - "start": 132, - "end": 159, - "loc": { - "start": { - "line": 4, - "column": 15 - }, - "end": { - "line": 4, - "column": 42 - } - }, + "start":132,"end":159,"loc":{"start":{"line":4,"column":15},"end":{"line":4,"column":42}}, "typeAnnotation": { "type": "TSUnionType", - "start": 134, - "end": 159, - "loc": { - "start": { - "line": 4, - "column": 17 - }, - "end": { - "line": 4, - "column": 42 - } - }, + "start":134,"end":159,"loc":{"start":{"line":4,"column":17},"end":{"line":4,"column":42}}, "types": [ { "type": "TSIntersectionType", - "start": 134, - "end": 149, - "loc": { - "start": { - "line": 4, - "column": 17 - }, - "end": { - "line": 4, - "column": 32 - } - }, + "start":134,"end":149,"loc":{"start":{"line":4,"column":17},"end":{"line":4,"column":32}}, "types": [ { "type": "TSNumberKeyword", - "start": 134, - "end": 140, - "loc": { - "start": { - "line": 4, - "column": 17 - }, - "end": { - "line": 4, - "column": 23 - } - } + "start":134,"end":140,"loc":{"start":{"line":4,"column":17},"end":{"line":4,"column":23}} }, { "type": "TSStringKeyword", - "start": 143, - "end": 149, - "loc": { - "start": { - "line": 4, - "column": 26 - }, - "end": { - "line": 4, - "column": 32 - } - } + "start":143,"end":149,"loc":{"start":{"line":4,"column":26},"end":{"line":4,"column":32}} } ] }, { "type": "TSBooleanKeyword", - "start": 152, - "end": 159, - "loc": { - "start": { - "line": 4, - "column": 35 - }, - "end": { - "line": 4, - "column": 42 - } - } + "start":152,"end":159,"loc":{"start":{"line":4,"column":35},"end":{"line":4,"column":42}} } ] } diff --git a/packages/babel-parser/test/fixtures/typescript/variable-declarator/definite-assignment-not-allowed/options.json b/packages/babel-parser/test/fixtures/typescript/variable-declarator/definite-assignment-not-allowed/options.json index 57893e4eee56..c4c1edaca3c6 100644 --- a/packages/babel-parser/test/fixtures/typescript/variable-declarator/definite-assignment-not-allowed/options.json +++ b/packages/babel-parser/test/fixtures/typescript/variable-declarator/definite-assignment-not-allowed/options.json @@ -1,3 +1,3 @@ { - "throws": "Complex binding patterns require an initialization value (1:6)" + "throws": "Unexpected token, expected \";\" (1:6)" } diff --git a/packages/babel-parser/test/fixtures/typescript/variable-declarator/definite-assignment/output.json b/packages/babel-parser/test/fixtures/typescript/variable-declarator/definite-assignment/output.json index abd65b02a231..79a5f5d4fcab 100644 --- a/packages/babel-parser/test/fixtures/typescript/variable-declarator/definite-assignment/output.json +++ b/packages/babel-parser/test/fixtures/typescript/variable-declarator/definite-assignment/output.json @@ -1,107 +1,29 @@ { "type": "File", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "program": { "type": "Program", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "VariableDeclaration", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "declarations": [ { "type": "VariableDeclarator", - "start": 4, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":4,"end":14,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":14}}, "id": { "type": "Identifier", - "start": 4, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 14 - }, - "identifierName": "x" - }, + "start":4,"end":14,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":14},"identifierName":"x"}, "name": "x", "typeAnnotation": { "type": "TSTypeAnnotation", - "start": 6, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 14 - } - }, + "start":6,"end":14,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":14}}, "typeAnnotation": { "type": "TSNumberKeyword", - "start": 8, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 14 - } - } + "start":8,"end":14,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":14}} } } }, diff --git a/packages/babel-parser/test/fixtures/v8intrinsic/_errors/in-bind-expression/input.js b/packages/babel-parser/test/fixtures/v8intrinsic/_errors/in-bind-expression/input.js new file mode 100644 index 000000000000..2828ef73abc6 --- /dev/null +++ b/packages/babel-parser/test/fixtures/v8intrinsic/_errors/in-bind-expression/input.js @@ -0,0 +1 @@ +::%DebugPrint(null) diff --git a/packages/babel-parser/test/fixtures/v8intrinsic/_errors/in-bind-expression/options.json b/packages/babel-parser/test/fixtures/v8intrinsic/_errors/in-bind-expression/options.json new file mode 100644 index 000000000000..f388c1ba2b25 --- /dev/null +++ b/packages/babel-parser/test/fixtures/v8intrinsic/_errors/in-bind-expression/options.json @@ -0,0 +1,4 @@ +{ + "plugins": ["v8intrinsic"], + "throws": "Unexpected token (1:0)" +} diff --git a/packages/babel-parser/test/fixtures/v8intrinsic/_errors/in-member-expression/input.js b/packages/babel-parser/test/fixtures/v8intrinsic/_errors/in-member-expression/input.js new file mode 100644 index 000000000000..11f5e1b795e5 --- /dev/null +++ b/packages/babel-parser/test/fixtures/v8intrinsic/_errors/in-member-expression/input.js @@ -0,0 +1 @@ +a.%DebugPrint(); diff --git a/packages/babel-parser/test/fixtures/v8intrinsic/_errors/in-member-expression/options.json b/packages/babel-parser/test/fixtures/v8intrinsic/_errors/in-member-expression/options.json new file mode 100644 index 000000000000..df3e3517c050 --- /dev/null +++ b/packages/babel-parser/test/fixtures/v8intrinsic/_errors/in-member-expression/options.json @@ -0,0 +1,4 @@ +{ + "plugins": ["v8intrinsic"], + "throws": "Unexpected token (1:2)" +} diff --git a/packages/babel-parser/test/fixtures/v8intrinsic/_errors/no-plugin/input.js b/packages/babel-parser/test/fixtures/v8intrinsic/_errors/no-plugin/input.js new file mode 100644 index 000000000000..3f654b116269 --- /dev/null +++ b/packages/babel-parser/test/fixtures/v8intrinsic/_errors/no-plugin/input.js @@ -0,0 +1 @@ +%DebugPrint(foo) diff --git a/packages/babel-parser/test/fixtures/v8intrinsic/_errors/no-plugin/options.json b/packages/babel-parser/test/fixtures/v8intrinsic/_errors/no-plugin/options.json new file mode 100644 index 000000000000..550f9f8667f9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/v8intrinsic/_errors/no-plugin/options.json @@ -0,0 +1,4 @@ +{ + "plugins": [], + "throws": "Unexpected token (1:0)" +} diff --git a/packages/babel-parser/test/fixtures/v8intrinsic/_errors/not-in-call-expression/input.js b/packages/babel-parser/test/fixtures/v8intrinsic/_errors/not-in-call-expression/input.js new file mode 100644 index 000000000000..1743e18ef4f1 --- /dev/null +++ b/packages/babel-parser/test/fixtures/v8intrinsic/_errors/not-in-call-expression/input.js @@ -0,0 +1,2 @@ +const i = %DebugPrint; +i(foo); diff --git a/packages/babel-parser/test/fixtures/v8intrinsic/_errors/not-in-call-expression/options.json b/packages/babel-parser/test/fixtures/v8intrinsic/_errors/not-in-call-expression/options.json new file mode 100644 index 000000000000..9f69797fc3b1 --- /dev/null +++ b/packages/babel-parser/test/fixtures/v8intrinsic/_errors/not-in-call-expression/options.json @@ -0,0 +1,4 @@ +{ + "plugins": ["v8intrinsic"], + "throws": "Unexpected token (1:10)" +} diff --git a/packages/babel-parser/test/fixtures/v8intrinsic/_errors/optional-call-expression/input.js b/packages/babel-parser/test/fixtures/v8intrinsic/_errors/optional-call-expression/input.js new file mode 100644 index 000000000000..0f2bb372f3f4 --- /dev/null +++ b/packages/babel-parser/test/fixtures/v8intrinsic/_errors/optional-call-expression/input.js @@ -0,0 +1 @@ +%DebugPrint?.(null) diff --git a/packages/babel-parser/test/fixtures/v8intrinsic/_errors/optional-call-expression/options.json b/packages/babel-parser/test/fixtures/v8intrinsic/_errors/optional-call-expression/options.json new file mode 100644 index 000000000000..f388c1ba2b25 --- /dev/null +++ b/packages/babel-parser/test/fixtures/v8intrinsic/_errors/optional-call-expression/options.json @@ -0,0 +1,4 @@ +{ + "plugins": ["v8intrinsic"], + "throws": "Unexpected token (1:0)" +} diff --git a/packages/babel-parser/test/fixtures/v8intrinsic/expression/await-expression/input.js b/packages/babel-parser/test/fixtures/v8intrinsic/expression/await-expression/input.js new file mode 100644 index 000000000000..43d5cb818781 --- /dev/null +++ b/packages/babel-parser/test/fixtures/v8intrinsic/expression/await-expression/input.js @@ -0,0 +1 @@ +async () => { await %StringParseInt("42", 10) } diff --git a/packages/babel-parser/test/fixtures/v8intrinsic/expression/await-expression/output.json b/packages/babel-parser/test/fixtures/v8intrinsic/expression/await-expression/output.json new file mode 100644 index 000000000000..b1bec4d3efbd --- /dev/null +++ b/packages/babel-parser/test/fixtures/v8intrinsic/expression/await-expression/output.json @@ -0,0 +1,69 @@ +{ + "type": "File", + "start":0,"end":47,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":47}}, + "program": { + "type": "Program", + "start":0,"end":47,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":47}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":47,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":47}}, + "expression": { + "type": "ArrowFunctionExpression", + "start":0,"end":47,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":47}}, + "id": null, + "generator": false, + "async": true, + "params": [], + "body": { + "type": "BlockStatement", + "start":12,"end":47,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":47}}, + "body": [ + { + "type": "ExpressionStatement", + "start":14,"end":45,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":45}}, + "expression": { + "type": "AwaitExpression", + "start":14,"end":45,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":45}}, + "argument": { + "type": "CallExpression", + "start":20,"end":45,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":45}}, + "callee": { + "type": "V8IntrinsicIdentifier", + "start":20,"end":35,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":35},"identifierName":"StringParseInt"}, + "name": "StringParseInt" + }, + "arguments": [ + { + "type": "StringLiteral", + "start":36,"end":40,"loc":{"start":{"line":1,"column":36},"end":{"line":1,"column":40}}, + "extra": { + "rawValue": "42", + "raw": "\"42\"" + }, + "value": "42" + }, + { + "type": "NumericLiteral", + "start":42,"end":44,"loc":{"start":{"line":1,"column":42},"end":{"line":1,"column":44}}, + "extra": { + "rawValue": 10, + "raw": "10" + }, + "value": 10 + } + ] + } + } + } + ], + "directives": [] + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/v8intrinsic/expression/call-expression/input.js b/packages/babel-parser/test/fixtures/v8intrinsic/expression/call-expression/input.js new file mode 100644 index 000000000000..3f654b116269 --- /dev/null +++ b/packages/babel-parser/test/fixtures/v8intrinsic/expression/call-expression/input.js @@ -0,0 +1 @@ +%DebugPrint(foo) diff --git a/packages/babel-parser/test/fixtures/v8intrinsic/expression/call-expression/output.json b/packages/babel-parser/test/fixtures/v8intrinsic/expression/call-expression/output.json new file mode 100644 index 000000000000..bb04898cf9de --- /dev/null +++ b/packages/babel-parser/test/fixtures/v8intrinsic/expression/call-expression/output.json @@ -0,0 +1,33 @@ +{ + "type": "File", + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, + "program": { + "type": "Program", + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, + "expression": { + "type": "CallExpression", + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, + "callee": { + "type": "V8IntrinsicIdentifier", + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11},"identifierName":"DebugPrint"}, + "name": "DebugPrint" + }, + "arguments": [ + { + "type": "Identifier", + "start":12,"end":15,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":15},"identifierName":"foo"}, + "name": "foo" + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/v8intrinsic/expression/in-new-expression/input.js b/packages/babel-parser/test/fixtures/v8intrinsic/expression/in-new-expression/input.js new file mode 100644 index 000000000000..cacf4eb63800 --- /dev/null +++ b/packages/babel-parser/test/fixtures/v8intrinsic/expression/in-new-expression/input.js @@ -0,0 +1 @@ +new %DebugPrint(null); diff --git a/packages/babel-parser/test/fixtures/v8intrinsic/expression/in-new-expression/output.json b/packages/babel-parser/test/fixtures/v8intrinsic/expression/in-new-expression/output.json new file mode 100644 index 000000000000..b1955a2da747 --- /dev/null +++ b/packages/babel-parser/test/fixtures/v8intrinsic/expression/in-new-expression/output.json @@ -0,0 +1,32 @@ +{ + "type": "File", + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, + "program": { + "type": "Program", + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, + "expression": { + "type": "NewExpression", + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, + "callee": { + "type": "V8IntrinsicIdentifier", + "start":4,"end":15,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":15},"identifierName":"DebugPrint"}, + "name": "DebugPrint" + }, + "arguments": [ + { + "type": "NullLiteral", + "start":16,"end":20,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":20}} + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/v8intrinsic/expression/multiple-arguments/input.js b/packages/babel-parser/test/fixtures/v8intrinsic/expression/multiple-arguments/input.js new file mode 100644 index 000000000000..82600e018602 --- /dev/null +++ b/packages/babel-parser/test/fixtures/v8intrinsic/expression/multiple-arguments/input.js @@ -0,0 +1 @@ +%StringParseInt("42", 10); diff --git a/packages/babel-parser/test/fixtures/v8intrinsic/expression/multiple-arguments/output.json b/packages/babel-parser/test/fixtures/v8intrinsic/expression/multiple-arguments/output.json new file mode 100644 index 000000000000..108b36d8c024 --- /dev/null +++ b/packages/babel-parser/test/fixtures/v8intrinsic/expression/multiple-arguments/output.json @@ -0,0 +1,46 @@ +{ + "type": "File", + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, + "program": { + "type": "Program", + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, + "expression": { + "type": "CallExpression", + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, + "callee": { + "type": "V8IntrinsicIdentifier", + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15},"identifierName":"StringParseInt"}, + "name": "StringParseInt" + }, + "arguments": [ + { + "type": "StringLiteral", + "start":16,"end":20,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":20}}, + "extra": { + "rawValue": "42", + "raw": "\"42\"" + }, + "value": "42" + }, + { + "type": "NumericLiteral", + "start":22,"end":24,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":24}}, + "extra": { + "rawValue": 10, + "raw": "10" + }, + "value": 10 + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/v8intrinsic/expression/yield-expression/input.js b/packages/babel-parser/test/fixtures/v8intrinsic/expression/yield-expression/input.js new file mode 100644 index 000000000000..da2dc0b2bf49 --- /dev/null +++ b/packages/babel-parser/test/fixtures/v8intrinsic/expression/yield-expression/input.js @@ -0,0 +1,3 @@ +function *foo() { + yield %StringParseInt("42", 10) +} diff --git a/packages/babel-parser/test/fixtures/v8intrinsic/expression/yield-expression/output.json b/packages/babel-parser/test/fixtures/v8intrinsic/expression/yield-expression/output.json new file mode 100644 index 000000000000..4a3d356e56df --- /dev/null +++ b/packages/babel-parser/test/fixtures/v8intrinsic/expression/yield-expression/output.json @@ -0,0 +1,70 @@ +{ + "type": "File", + "start":0,"end":53,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "program": { + "type": "Program", + "start":0,"end":53,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":53,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "id": { + "type": "Identifier", + "start":10,"end":13,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":13},"identifierName":"foo"}, + "name": "foo" + }, + "generator": true, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":16,"end":53,"loc":{"start":{"line":1,"column":16},"end":{"line":3,"column":1}}, + "body": [ + { + "type": "ExpressionStatement", + "start":20,"end":51,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":33}}, + "expression": { + "type": "YieldExpression", + "start":20,"end":51,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":33}}, + "delegate": false, + "argument": { + "type": "CallExpression", + "start":26,"end":51,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":33}}, + "callee": { + "type": "V8IntrinsicIdentifier", + "start":26,"end":41,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":23},"identifierName":"StringParseInt"}, + "name": "StringParseInt" + }, + "arguments": [ + { + "type": "StringLiteral", + "start":42,"end":46,"loc":{"start":{"line":2,"column":24},"end":{"line":2,"column":28}}, + "extra": { + "rawValue": "42", + "raw": "\"42\"" + }, + "value": "42" + }, + { + "type": "NumericLiteral", + "start":48,"end":50,"loc":{"start":{"line":2,"column":30},"end":{"line":2,"column":32}}, + "extra": { + "rawValue": 10, + "raw": "10" + }, + "value": 10 + } + ] + } + } + } + ], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/v8intrinsic/modulo/01/input.js b/packages/babel-parser/test/fixtures/v8intrinsic/modulo/01/input.js new file mode 100644 index 000000000000..72f7312444c3 --- /dev/null +++ b/packages/babel-parser/test/fixtures/v8intrinsic/modulo/01/input.js @@ -0,0 +1 @@ +foo%bar() diff --git a/packages/babel-parser/test/fixtures/v8intrinsic/modulo/01/output.json b/packages/babel-parser/test/fixtures/v8intrinsic/modulo/01/output.json new file mode 100644 index 000000000000..0bbbdb1dc37c --- /dev/null +++ b/packages/babel-parser/test/fixtures/v8intrinsic/modulo/01/output.json @@ -0,0 +1,37 @@ +{ + "type": "File", + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "program": { + "type": "Program", + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "expression": { + "type": "BinaryExpression", + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "left": { + "type": "Identifier", + "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3},"identifierName":"foo"}, + "name": "foo" + }, + "operator": "%", + "right": { + "type": "CallExpression", + "start":4,"end":9,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":9}}, + "callee": { + "type": "Identifier", + "start":4,"end":7,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":7},"identifierName":"bar"}, + "name": "bar" + }, + "arguments": [] + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/v8intrinsic/options.json b/packages/babel-parser/test/fixtures/v8intrinsic/options.json new file mode 100644 index 000000000000..609458c2c65e --- /dev/null +++ b/packages/babel-parser/test/fixtures/v8intrinsic/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["v8intrinsic"] +} diff --git a/packages/babel-parser/test/helpers/runFixtureTests.js b/packages/babel-parser/test/helpers/runFixtureTests.js index 9e97ee46f727..9c21aa351e22 100644 --- a/packages/babel-parser/test/helpers/runFixtureTests.js +++ b/packages/babel-parser/test/helpers/runFixtureTests.js @@ -5,6 +5,8 @@ import path from "path"; const rootPath = path.join(__dirname, "../../../.."); +const serialized = "$$ babel internal serialized type"; + class FixtureError extends Error { constructor(previousError, fixturePath, code) { super(previousError.message); @@ -61,7 +63,7 @@ export function runFixtureTests(fixturesPath, parseFunction) { /^.*Got error message: /, "", ); - fs.writeFileSync(fn, JSON.stringify(task.options, null, " ")); + fs.writeFileSync(fn, JSON.stringify(task.options, null, 2)); } } @@ -106,12 +108,24 @@ export function runThrowTestsWithEstree(fixturesPath, parseFunction) { }); } +// compact loc properties into a single line +function compactFixture(jsonString) { + return jsonString.replace( + /"start": (\d+),\s+"end": (\d+),\s+"loc": \{\s+"start":\s\{\s+"line": (\d+),\s+"column": (\d+)\s+\},\s+"end":\s\{\s+"line": (\d+),\s+"column": (\d+)\s+\s+\}(?:,\s+"identifierName": "(\S+)")?\s+\}/gm, + (_, p1, p2, p3, p4, p5, p6, p7) => { + return ( + `"start":${p1},"end":${p2},"loc":{"start":{"line":${p3},"column":${p4}},"end":{"line":${p5},"column":${p6}}` + + (p7 ? `,"identifierName":"${p7}"}` : "}") + ); + }, + ); +} + function save(test, ast) { - // Ensure that RegExp are serialized as strings - const toJSON = RegExp.prototype.toJSON; - RegExp.prototype.toJSON = RegExp.prototype.toString; - require("fs").writeFileSync(test.expect.loc, JSON.stringify(ast, null, " ")); - RegExp.prototype.toJSON = toJSON; + fs.writeFileSync( + test.expect.loc, + compactFixture(JSON.stringify(ast, (k, v) => serialize(v), 2)), + ); } function runTest(test, parseFunction) { @@ -125,7 +139,7 @@ function runTest(test, parseFunction) { let ast; try { - ast = parseFunction(test.actual.code, opts); + ast = parseFunction(test.actual.code, { errorRecovery: true, ...opts }); } catch (err) { if (opts.throws) { if (err.message === opts.throws) { @@ -135,7 +149,7 @@ function runTest(test, parseFunction) { const fn = path.dirname(test.expect.loc) + "/options.json"; test.options = test.options || {}; test.options.throws = err.message; - fs.writeFileSync(fn, JSON.stringify(test.options, null, " ")); + fs.writeFileSync(fn, JSON.stringify(test.options, null, 2)); return; } @@ -152,6 +166,7 @@ function runTest(test, parseFunction) { } if (ast.comments && !ast.comments.length) delete ast.comments; + if (ast.errors && !ast.errors.length) delete ast.errors; if (!test.expect.code && !opts.throws && !process.env.CI) { test.expect.loc += "on"; @@ -159,6 +174,20 @@ function runTest(test, parseFunction) { } if (opts.throws) { + if (process.env.OVERWRITE) { + const fn = path.dirname(test.expect.loc) + "/options.json"; + test.options = test.options || {}; + delete test.options.throws; + const contents = JSON.stringify(test.options, null, 2); + if (contents === "{}") { + fs.unlinkSync(fn); + } else { + fs.writeFileSync(fn, JSON.stringify(test.options, null, 2)); + } + test.expect.loc += "on"; + return save(test, ast); + } + throw new Error( "Expected error message: " + opts.throws + ". But parsing succeeded.", ); @@ -174,9 +203,43 @@ function runTest(test, parseFunction) { } } +function serialize(value) { + if (typeof value === "bigint") { + return { + [serialized]: "BigInt", + value: value.toString(), + }; + } else if (value instanceof RegExp) { + return { + [serialized]: "RegExp", + source: value.source, + flags: value.flags, + }; + } else if (value instanceof Error) { + // Errors are serialized to a simple string, because are used frequently + return value.toString(); + } + return value; +} + function ppJSON(v) { - v = v instanceof RegExp ? v.toString() : v; - return JSON.stringify(v, null, 2); + if (typeof v === "bigint" || v instanceof Error || v instanceof RegExp) { + return ppJSON(serialize(v)); + } + + if (v && typeof v === "object" && v[serialized]) { + switch (v[serialized]) { + case "BigInt": + return typeof BigInt === "undefined" ? "null" : v.value + "n"; + case "RegExp": + return `/${v.source}/${v.flags}`; + } + } else if (typeof v === "string" && /^[A-Z][a-z]+Error: /.test(v)) { + // Errors are serialized to a simple string, because are used frequently + return v; + } + + return JSON.stringify(v, (k, v) => serialize(v), 2); } function addPath(str, pt) { @@ -188,7 +251,12 @@ function addPath(str, pt) { } function misMatch(exp, act) { - if (exp instanceof RegExp || act instanceof RegExp) { + if ( + act instanceof RegExp || + act instanceof Error || + typeof act === "bigint" || + (exp && typeof exp === "object" && exp[serialized]) + ) { const left = ppJSON(exp); const right = ppJSON(act); if (left !== right) return left + " !== " + right; diff --git a/packages/babel-parser/test/unit/tokenizer/types.js b/packages/babel-parser/test/unit/tokenizer/types.js new file mode 100644 index 000000000000..64a69051963b --- /dev/null +++ b/packages/babel-parser/test/unit/tokenizer/types.js @@ -0,0 +1,15 @@ +import { types } from "../../../src/tokenizer/types"; + +describe("token types", () => { + it("should check if the binOp for relational === in", () => { + expect(types.relational.binop).toEqual(types._in.binop); + }); + + it("should check if the binOp for relational === instanceOf", () => { + expect(types.relational.binop).toEqual(types._instanceof.binop); + }); + + it("should check if the binOp for in === instanceOf", () => { + expect(types._in.binop).toEqual(types._instanceof.binop); + }); +}); diff --git a/packages/babel-parser/typings/babel-parser.d.ts b/packages/babel-parser/typings/babel-parser.d.ts index deba6be0e6a7..40161080996b 100644 --- a/packages/babel-parser/typings/babel-parser.d.ts +++ b/packages/babel-parser/typings/babel-parser.d.ts @@ -36,6 +36,12 @@ export interface ParserOptions { allowSuperOutsideMethod?: boolean; + /** + * By default, exported identifiers must refer to a declared variable. + * Set this to true to allow export statements to reference undeclared variables. + */ + allowUndeclaredExports?: boolean; + /** * Indicate the mode the code should be parsed in. * Can be one of "script", "module", or "unambiguous". Defaults to "script". @@ -89,32 +95,37 @@ export interface ParserOptions { } export type ParserPlugin = - 'estree' | - 'jsx' | - 'flow' | - 'flowComments' | - 'typescript' | - 'doExpressions' | - 'objectRestSpread' | + 'asyncGenerators' | + 'bigInt' | + 'classPrivateMethods' | + 'classPrivateProperties' | + 'classProperties' | 'decorators' | 'decorators-legacy' | - 'classProperties' | - 'classPrivateProperties' | - 'classPrivateMethods' | + 'doExpressions' | + 'dynamicImport' | + 'estree' | 'exportDefaultFrom' | - 'exportNamespaceFrom' | - 'asyncGenerators' | + 'exportNamespaceFrom' | // deprecated + 'flow' | + 'flowComments' | 'functionBind' | 'functionSent' | - 'dynamicImport' | - 'numericSeparator' | - 'optionalChaining' | 'importMeta' | - 'bigInt' | + 'jsx' | + 'logicalAssignment' | + 'nullishCoalescingOperator' | + 'numericSeparator' | + 'objectRestSpread' | 'optionalCatchBinding' | - 'throwExpressions' | + 'optionalChaining' | + 'partialApplication' | 'pipelineOperator' | - 'nullishCoalescingOperator' | + 'placeholders' | + 'throwExpressions' | + 'topLevelAwait' | + 'typescript' | + 'v8intrinsic' | ParserPluginWithOptions; export type ParserPluginWithOptions = diff --git a/packages/babel-plugin-external-helpers/package.json b/packages/babel-plugin-external-helpers/package.json index 7a4bd988941c..bb70f5bf0409 100644 --- a/packages/babel-plugin-external-helpers/package.json +++ b/packages/babel-plugin-external-helpers/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-external-helpers", - "version": "7.2.0", + "version": "7.8.3", "description": "This plugin contains helper functions that’ll be placed at the top of the generated code", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-external-helpers", "license": "MIT", @@ -12,13 +12,13 @@ "babel-plugin" ], "dependencies": { - "@babel/helper-plugin-utils": "^7.0.0" + "@babel/helper-plugin-utils": "^7.8.3" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.2.0", - "@babel/helper-plugin-test-runner": "^7.0.0" + "@babel/core": "^7.8.3", + "@babel/helper-plugin-test-runner": "^7.8.3" } } diff --git a/packages/babel-plugin-external-helpers/test/fixtures/opts/whitelist/output.js b/packages/babel-plugin-external-helpers/test/fixtures/opts/whitelist/output.js index 34a0d30fb1c0..51e19e07fedb 100644 --- a/packages/babel-plugin-external-helpers/test/fixtures/opts/whitelist/output.js +++ b/packages/babel-plugin-external-helpers/test/fixtures/opts/whitelist/output.js @@ -1,8 +1,6 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } -let Foo = -/*#__PURE__*/ -function () { +let Foo = /*#__PURE__*/function () { "use strict"; function Foo() { diff --git a/packages/babel-plugin-proposal-async-generator-functions/package.json b/packages/babel-plugin-proposal-async-generator-functions/package.json index 81db9bcc3d53..4e00ef34879f 100644 --- a/packages/babel-plugin-proposal-async-generator-functions/package.json +++ b/packages/babel-plugin-proposal-async-generator-functions/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-proposal-async-generator-functions", - "version": "7.2.0", + "version": "7.8.3", "description": "Turn async generator functions into ES2015 generators", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-proposal-async-generator-functions", "license": "MIT", @@ -12,15 +12,15 @@ "babel-plugin" ], "dependencies": { - "@babel/helper-plugin-utils": "^7.0.0", - "@babel/helper-remap-async-to-generator": "^7.1.0", - "@babel/plugin-syntax-async-generators": "^7.2.0" + "@babel/helper-plugin-utils": "^7.8.3", + "@babel/helper-remap-async-to-generator": "^7.8.3", + "@babel/plugin-syntax-async-generators": "^7.8.0" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.2.0", - "@babel/helper-plugin-test-runner": "^7.0.0" + "@babel/core": "^7.8.3", + "@babel/helper-plugin-test-runner": "^7.8.3" } } diff --git a/packages/babel-plugin-proposal-async-generator-functions/test/fixtures/nested/async-in-params/output.js b/packages/babel-plugin-proposal-async-generator-functions/test/fixtures/nested/async-in-params/output.js index 2d3f0157c7f1..9b4a4eb3e731 100644 --- a/packages/babel-plugin-proposal-async-generator-functions/test/fixtures/nested/async-in-params/output.js +++ b/packages/babel-plugin-proposal-async-generator-functions/test/fixtures/nested/async-in-params/output.js @@ -3,9 +3,7 @@ function g() { } function _g() { - _g = babelHelpers.wrapAsyncGenerator(function* (x = - /*#__PURE__*/ - babelHelpers.asyncToGenerator(function* () { + _g = babelHelpers.wrapAsyncGenerator(function* (x = /*#__PURE__*/babelHelpers.asyncToGenerator(function* () { yield 1; })) { yield babelHelpers.awaitAsyncGenerator(2); diff --git a/packages/babel-plugin-proposal-async-generator-functions/test/fixtures/yield-star/issue-9905/exec.js b/packages/babel-plugin-proposal-async-generator-functions/test/fixtures/yield-star/issue-9905/exec.js new file mode 100644 index 000000000000..a4bf16180e24 --- /dev/null +++ b/packages/babel-plugin-proposal-async-generator-functions/test/fixtures/yield-star/issue-9905/exec.js @@ -0,0 +1,20 @@ +const log = []; + +async function* func1() { + log.push(1); + yield "a"; + log.push(2); +} + +async function* func2() { + yield* func1(); + log.push(3); +} + +return (async () => { + const iterator = func2(); + await iterator.next(); + await iterator.return(); + + expect(log).toEqual([1]); +})(); \ No newline at end of file diff --git a/packages/babel-plugin-proposal-async-generator-functions/test/fixtures/yield-star/issue-9905/options.json b/packages/babel-plugin-proposal-async-generator-functions/test/fixtures/yield-star/issue-9905/options.json new file mode 100644 index 000000000000..2454c2169cf8 --- /dev/null +++ b/packages/babel-plugin-proposal-async-generator-functions/test/fixtures/yield-star/issue-9905/options.json @@ -0,0 +1,3 @@ +{ + "minNodeVersion": "8.0.0" +} diff --git a/packages/babel-plugin-proposal-async-generator-functions/test/fixtures/yield-star/options.json b/packages/babel-plugin-proposal-async-generator-functions/test/fixtures/yield-star/options.json new file mode 100644 index 000000000000..5459f727f878 --- /dev/null +++ b/packages/babel-plugin-proposal-async-generator-functions/test/fixtures/yield-star/options.json @@ -0,0 +1,10 @@ +{ + "parserOpts": { + "allowReturnOutsideFunction": true + }, + "plugins": [ + "external-helpers", + "transform-async-to-generator", + "proposal-async-generator-functions" + ] +} diff --git a/packages/babel-plugin-proposal-async-generator-functions/test/fixtures/yield-star/return-method-with-finally-multiple-parallel/exec.js b/packages/babel-plugin-proposal-async-generator-functions/test/fixtures/yield-star/return-method-with-finally-multiple-parallel/exec.js new file mode 100644 index 000000000000..1c4ef15d5d06 --- /dev/null +++ b/packages/babel-plugin-proposal-async-generator-functions/test/fixtures/yield-star/return-method-with-finally-multiple-parallel/exec.js @@ -0,0 +1,34 @@ +const log = []; + +async function* inner() { + try { + log.push(1); + yield "a"; + log.push(2); + yield "b"; + log.push(3); + } finally { + log.push(4); + yield "c"; + log.push(5); + } +} + +async function* outer() { + log.push(6); + yield* inner(); + log.push(7); +} + +return (async () => { + const iterator = outer(); + + let res = await iterator.next(); + expect(res).toEqual({ value: "a", done: false }); + expect(log).toEqual([6, 1]); + + const [res1, res2] = await Promise.all([ iterator.return("x"), iterator.return("y") ]); + expect(res1).toEqual({ value: "c", done: false }); + expect(res2).toEqual({ value: "y", done: true }); + expect(log).toEqual([6, 1, 4]); +})(); diff --git a/packages/babel-plugin-proposal-async-generator-functions/test/fixtures/yield-star/return-method-with-finally-multiple-parallel/options.json b/packages/babel-plugin-proposal-async-generator-functions/test/fixtures/yield-star/return-method-with-finally-multiple-parallel/options.json new file mode 100644 index 000000000000..2454c2169cf8 --- /dev/null +++ b/packages/babel-plugin-proposal-async-generator-functions/test/fixtures/yield-star/return-method-with-finally-multiple-parallel/options.json @@ -0,0 +1,3 @@ +{ + "minNodeVersion": "8.0.0" +} diff --git a/packages/babel-plugin-proposal-async-generator-functions/test/fixtures/yield-star/return-method-with-finally-multiple-serial/exec.js b/packages/babel-plugin-proposal-async-generator-functions/test/fixtures/yield-star/return-method-with-finally-multiple-serial/exec.js new file mode 100644 index 000000000000..84865ef6f3df --- /dev/null +++ b/packages/babel-plugin-proposal-async-generator-functions/test/fixtures/yield-star/return-method-with-finally-multiple-serial/exec.js @@ -0,0 +1,37 @@ +const log = []; + +async function* inner() { + try { + log.push(1); + yield "a"; + log.push(2); + yield "b"; + log.push(3); + } finally { + log.push(4); + yield "c"; + log.push(5); + } +} + +async function* outer() { + log.push(6); + yield* inner(); + log.push(7); +} + +return (async () => { + const iterator = outer(); + + let res = await iterator.next(); + expect(res).toEqual({ value: "a", done: false }); + expect(log).toEqual([6, 1]); + + res = await iterator.return("x"); + expect(res).toEqual({ value: "c", done: false }); + expect(log).toEqual([6, 1, 4]); + + res = await iterator.return("y"); + expect(res).toEqual({ value: "y", done: true }); + expect(log).toEqual([6, 1, 4]); +})(); diff --git a/packages/babel-plugin-proposal-async-generator-functions/test/fixtures/yield-star/return-method-with-finally-multiple-serial/options.json b/packages/babel-plugin-proposal-async-generator-functions/test/fixtures/yield-star/return-method-with-finally-multiple-serial/options.json new file mode 100644 index 000000000000..2454c2169cf8 --- /dev/null +++ b/packages/babel-plugin-proposal-async-generator-functions/test/fixtures/yield-star/return-method-with-finally-multiple-serial/options.json @@ -0,0 +1,3 @@ +{ + "minNodeVersion": "8.0.0" +} diff --git a/packages/babel-plugin-proposal-async-generator-functions/test/fixtures/yield-star/return-method-with-finally/exec.js b/packages/babel-plugin-proposal-async-generator-functions/test/fixtures/yield-star/return-method-with-finally/exec.js new file mode 100644 index 000000000000..0ef1d454a19f --- /dev/null +++ b/packages/babel-plugin-proposal-async-generator-functions/test/fixtures/yield-star/return-method-with-finally/exec.js @@ -0,0 +1,37 @@ +const log = []; + +async function* inner() { + try { + log.push(1); + yield "a"; + log.push(2); + yield "b"; + log.push(3); + } finally { + log.push(4); + yield "c"; + log.push(5); + } +} + +async function* outer() { + log.push(6); + yield* inner(); + log.push(7); +} + +return (async () => { + const iterator = outer(); + + let res = await iterator.next(); + expect(res).toEqual({ value: "a", done: false }); + expect(log).toEqual([6, 1]); + + res = await iterator.return(); + expect(res).toEqual({ value: "c", done: false }); + expect(log).toEqual([6, 1, 4]); + + res = await iterator.next(); + expect(res).toEqual({ value: undefined, done: true }); + expect(log).toEqual([6, 1, 4, 5, 7]); +})(); diff --git a/packages/babel-plugin-proposal-async-generator-functions/test/fixtures/yield-star/return-method/exec.js b/packages/babel-plugin-proposal-async-generator-functions/test/fixtures/yield-star/return-method/exec.js new file mode 100644 index 000000000000..73be9d85e495 --- /dev/null +++ b/packages/babel-plugin-proposal-async-generator-functions/test/fixtures/yield-star/return-method/exec.js @@ -0,0 +1,31 @@ +const log = []; + +async function* inner() { + log.push(1); + yield "a"; + log.push(2); + yield "b"; + log.push(3); +} + +async function* outer() { + log.push(4); + yield* inner(); + log.push(5); +} + +return (async () => { + const iterator = outer(); + + let res = await iterator.next(); + expect(res).toEqual({ value: "a", done: false }); + expect(log).toEqual([4, 1]); + + res = await iterator.return(); + expect(res).toEqual({ value: undefined, done: true }); + expect(log).toEqual([4, 1]); + + res = await iterator.next(); + expect(res).toEqual({ value: undefined, done: true }); + expect(log).toEqual([4, 1]); +})(); diff --git a/packages/babel-plugin-proposal-async-generator-functions/test/fixtures/yield-star/return-method/options.json b/packages/babel-plugin-proposal-async-generator-functions/test/fixtures/yield-star/return-method/options.json new file mode 100644 index 000000000000..2454c2169cf8 --- /dev/null +++ b/packages/babel-plugin-proposal-async-generator-functions/test/fixtures/yield-star/return-method/options.json @@ -0,0 +1,3 @@ +{ + "minNodeVersion": "8.0.0" +} diff --git a/packages/babel-plugin-proposal-async-generator-functions/test/fixtures/yield-star/throw-method-with-catch/exec.js b/packages/babel-plugin-proposal-async-generator-functions/test/fixtures/yield-star/throw-method-with-catch/exec.js new file mode 100644 index 000000000000..0859ad463e00 --- /dev/null +++ b/packages/babel-plugin-proposal-async-generator-functions/test/fixtures/yield-star/throw-method-with-catch/exec.js @@ -0,0 +1,37 @@ +const log = []; + +async function* inner() { + try { + log.push(1); + yield "a"; + log.push(2); + yield "b"; + log.push(3); + } catch (e) { + log.push(4); + yield "c"; + log.push(5); + } +} + +async function* outer() { + log.push(6); + yield* inner(); + log.push(7); +} + +return (async () => { + const iterator = outer(); + + let res = await iterator.next(); + expect(res).toEqual({ value: "a", done: false }); + expect(log).toEqual([6, 1]); + + res = await iterator.throw(new Error("TEST")); + expect(res).toEqual({ value: "c", done: false }); + expect(log).toEqual([6, 1, 4]); + + res = await iterator.next(); + expect(res).toEqual({ value: undefined, done: true }); + expect(log).toEqual([6, 1, 4, 5, 7]); +})(); diff --git a/packages/babel-plugin-proposal-async-generator-functions/test/fixtures/yield-star/throw-method-with-finally/exec.js b/packages/babel-plugin-proposal-async-generator-functions/test/fixtures/yield-star/throw-method-with-finally/exec.js new file mode 100644 index 000000000000..425a00b33f80 --- /dev/null +++ b/packages/babel-plugin-proposal-async-generator-functions/test/fixtures/yield-star/throw-method-with-finally/exec.js @@ -0,0 +1,37 @@ +const log = []; + +async function* inner() { + try { + log.push(1); + yield "a"; + log.push(2); + yield "b"; + log.push(3); + } finally { + log.push(4); + yield "c"; + log.push(5); + } +} + +async function* outer() { + log.push(6); + yield* inner(); + log.push(7); +} + +return (async () => { + const iterator = outer(); + + let res = await iterator.next(); + expect(res).toEqual({ value: "a", done: false }); + expect(log).toEqual([6, 1]); + + res = await iterator.throw(new Error("TEST")); + expect(res).toEqual({ value: "c", done: false }); + expect(log).toEqual([6, 1, 4]); + + // "yield" in finally suspended the exception for one turn + await expect(iterator.next()).rejects.toThrow(/TEST/); + expect(log).toEqual([6, 1, 4, 5]); +})(); diff --git a/packages/babel-plugin-proposal-class-properties/package.json b/packages/babel-plugin-proposal-class-properties/package.json index 9a11e1c822a6..5a41b9c537e9 100644 --- a/packages/babel-plugin-proposal-class-properties/package.json +++ b/packages/babel-plugin-proposal-class-properties/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-proposal-class-properties", - "version": "7.5.5", + "version": "7.8.3", "description": "This plugin transforms static class properties as well as properties declared with the property initializer syntax", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-proposal-class-properties", "license": "MIT", @@ -12,14 +12,14 @@ "babel-plugin" ], "dependencies": { - "@babel/helper-create-class-features-plugin": "^7.5.5", - "@babel/helper-plugin-utils": "^7.0.0" + "@babel/helper-create-class-features-plugin": "^7.8.3", + "@babel/helper-plugin-utils": "^7.8.3" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.5.5", - "@babel/helper-plugin-test-runner": "^7.0.0" + "@babel/core": "^7.8.3", + "@babel/helper-plugin-test-runner": "^7.8.3" } } diff --git a/packages/babel-plugin-proposal-class-properties/test/fixtures/decorators-legacy-interop/local-define-property/input.js b/packages/babel-plugin-proposal-class-properties/test/fixtures/decorators-legacy-interop/local-define-property/input.js new file mode 100644 index 000000000000..f939e63b3b71 --- /dev/null +++ b/packages/babel-plugin-proposal-class-properties/test/fixtures/decorators-legacy-interop/local-define-property/input.js @@ -0,0 +1,12 @@ +function dec() {} + +// Create a local function binding so babel has to change the name of the helper +function _defineProperty() {} + +class A { + @dec a; + + @dec b = 123; + + c = 456; +} diff --git a/packages/babel-plugin-proposal-class-properties/test/fixtures/decorators-legacy-interop/local-define-property/options.json b/packages/babel-plugin-proposal-class-properties/test/fixtures/decorators-legacy-interop/local-define-property/options.json new file mode 100644 index 000000000000..6f03cd7aad03 --- /dev/null +++ b/packages/babel-plugin-proposal-class-properties/test/fixtures/decorators-legacy-interop/local-define-property/options.json @@ -0,0 +1,7 @@ +{ + "plugins": [ + ["proposal-decorators", { "legacy": true }], + ["proposal-class-properties"], + "transform-classes" + ] +} diff --git a/packages/babel-plugin-proposal-class-properties/test/fixtures/decorators-legacy-interop/local-define-property/output.js b/packages/babel-plugin-proposal-class-properties/test/fixtures/decorators-legacy-interop/local-define-property/output.js new file mode 100644 index 000000000000..641307b44d0d --- /dev/null +++ b/packages/babel-plugin-proposal-class-properties/test/fixtures/decorators-legacy-interop/local-define-property/output.js @@ -0,0 +1,40 @@ +var _class, _descriptor, _descriptor2, _temp; + +function _initializerDefineProperty(target, property, descriptor, context) { if (!descriptor) return; Object.defineProperty(target, property, { enumerable: descriptor.enumerable, configurable: descriptor.configurable, writable: descriptor.writable, value: descriptor.initializer ? descriptor.initializer.call(context) : void 0 }); } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _defineProperty2(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } + +function _applyDecoratedDescriptor(target, property, decorators, descriptor, context) { var desc = {}; Object.keys(descriptor).forEach(function (key) { desc[key] = descriptor[key]; }); desc.enumerable = !!desc.enumerable; desc.configurable = !!desc.configurable; if ('value' in desc || desc.initializer) { desc.writable = true; } desc = decorators.slice().reverse().reduce(function (desc, decorator) { return decorator(target, property, desc) || desc; }, desc); if (context && desc.initializer !== void 0) { desc.value = desc.initializer ? desc.initializer.call(context) : void 0; desc.initializer = undefined; } if (desc.initializer === void 0) { Object.defineProperty(target, property, desc); desc = null; } return desc; } + +function _initializerWarningHelper(descriptor, context) { throw new Error('Decorating class property failed. Please ensure that ' + 'proposal-class-properties is enabled and runs after the decorators transform.'); } + +function dec() {} // Create a local function binding so babel has to change the name of the helper + + +function _defineProperty() {} + +let A = (_class = (_temp = function A() { + "use strict"; + + _classCallCheck(this, A); + + _initializerDefineProperty(this, "a", _descriptor, this); + + _initializerDefineProperty(this, "b", _descriptor2, this); + + _defineProperty2(this, "c", 456); +}, _temp), (_descriptor = _applyDecoratedDescriptor(_class.prototype, "a", [dec], { + configurable: true, + enumerable: true, + writable: true, + initializer: null +}), _descriptor2 = _applyDecoratedDescriptor(_class.prototype, "b", [dec], { + configurable: true, + enumerable: true, + writable: true, + initializer: function () { + return 123; + } +})), _class); diff --git a/packages/babel-plugin-proposal-class-properties/test/fixtures/decorators-legacy-interop/loose/input.js b/packages/babel-plugin-proposal-class-properties/test/fixtures/decorators-legacy-interop/loose/input.js new file mode 100644 index 000000000000..92298f2eb49b --- /dev/null +++ b/packages/babel-plugin-proposal-class-properties/test/fixtures/decorators-legacy-interop/loose/input.js @@ -0,0 +1,9 @@ +function dec() {} + +class A { + @dec a; + + @dec b = 123; + + c = 456; +} diff --git a/packages/babel-plugin-proposal-class-properties/test/fixtures/decorators-legacy-interop/loose/options.json b/packages/babel-plugin-proposal-class-properties/test/fixtures/decorators-legacy-interop/loose/options.json new file mode 100644 index 000000000000..8c831989533b --- /dev/null +++ b/packages/babel-plugin-proposal-class-properties/test/fixtures/decorators-legacy-interop/loose/options.json @@ -0,0 +1,7 @@ +{ + "plugins": [ + ["proposal-decorators", { "legacy": true }], + ["proposal-class-properties", { "loose": true }], + "transform-classes" + ] +} diff --git a/packages/babel-plugin-proposal-class-properties/test/fixtures/decorators-legacy-interop/loose/output.js b/packages/babel-plugin-proposal-class-properties/test/fixtures/decorators-legacy-interop/loose/output.js new file mode 100644 index 000000000000..0a25e2b1023c --- /dev/null +++ b/packages/babel-plugin-proposal-class-properties/test/fixtures/decorators-legacy-interop/loose/output.js @@ -0,0 +1,35 @@ +var _class, _descriptor, _descriptor2, _temp; + +function _initializerDefineProperty(target, property, descriptor, context) { if (!descriptor) return; Object.defineProperty(target, property, { enumerable: descriptor.enumerable, configurable: descriptor.configurable, writable: descriptor.writable, value: descriptor.initializer ? descriptor.initializer.call(context) : void 0 }); } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _applyDecoratedDescriptor(target, property, decorators, descriptor, context) { var desc = {}; Object.keys(descriptor).forEach(function (key) { desc[key] = descriptor[key]; }); desc.enumerable = !!desc.enumerable; desc.configurable = !!desc.configurable; if ('value' in desc || desc.initializer) { desc.writable = true; } desc = decorators.slice().reverse().reduce(function (desc, decorator) { return decorator(target, property, desc) || desc; }, desc); if (context && desc.initializer !== void 0) { desc.value = desc.initializer ? desc.initializer.call(context) : void 0; desc.initializer = undefined; } if (desc.initializer === void 0) { Object.defineProperty(target, property, desc); desc = null; } return desc; } + +function _initializerWarningHelper(descriptor, context) { throw new Error('Decorating class property failed. Please ensure that ' + 'proposal-class-properties is enabled and runs after the decorators transform.'); } + +function dec() {} + +let A = (_class = (_temp = function A() { + "use strict"; + + _classCallCheck(this, A); + + _initializerDefineProperty(this, "a", _descriptor, this); + + _initializerDefineProperty(this, "b", _descriptor2, this); + + this.c = 456; +}, _temp), (_descriptor = _applyDecoratedDescriptor(_class.prototype, "a", [dec], { + configurable: true, + enumerable: true, + writable: true, + initializer: null +}), _descriptor2 = _applyDecoratedDescriptor(_class.prototype, "b", [dec], { + configurable: true, + enumerable: true, + writable: true, + initializer: function () { + return 123; + } +})), _class); diff --git a/packages/babel-plugin-proposal-class-properties/test/fixtures/decorators-legacy-interop/strict/input.js b/packages/babel-plugin-proposal-class-properties/test/fixtures/decorators-legacy-interop/strict/input.js new file mode 100644 index 000000000000..92298f2eb49b --- /dev/null +++ b/packages/babel-plugin-proposal-class-properties/test/fixtures/decorators-legacy-interop/strict/input.js @@ -0,0 +1,9 @@ +function dec() {} + +class A { + @dec a; + + @dec b = 123; + + c = 456; +} diff --git a/packages/babel-plugin-proposal-class-properties/test/fixtures/decorators-legacy-interop/strict/options.json b/packages/babel-plugin-proposal-class-properties/test/fixtures/decorators-legacy-interop/strict/options.json new file mode 100644 index 000000000000..6f03cd7aad03 --- /dev/null +++ b/packages/babel-plugin-proposal-class-properties/test/fixtures/decorators-legacy-interop/strict/options.json @@ -0,0 +1,7 @@ +{ + "plugins": [ + ["proposal-decorators", { "legacy": true }], + ["proposal-class-properties"], + "transform-classes" + ] +} diff --git a/packages/babel-plugin-proposal-class-properties/test/fixtures/decorators-legacy-interop/strict/output.js b/packages/babel-plugin-proposal-class-properties/test/fixtures/decorators-legacy-interop/strict/output.js new file mode 100644 index 000000000000..11cce4ac923d --- /dev/null +++ b/packages/babel-plugin-proposal-class-properties/test/fixtures/decorators-legacy-interop/strict/output.js @@ -0,0 +1,37 @@ +var _class, _descriptor, _descriptor2, _temp; + +function _initializerDefineProperty(target, property, descriptor, context) { if (!descriptor) return; Object.defineProperty(target, property, { enumerable: descriptor.enumerable, configurable: descriptor.configurable, writable: descriptor.writable, value: descriptor.initializer ? descriptor.initializer.call(context) : void 0 }); } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } + +function _applyDecoratedDescriptor(target, property, decorators, descriptor, context) { var desc = {}; Object.keys(descriptor).forEach(function (key) { desc[key] = descriptor[key]; }); desc.enumerable = !!desc.enumerable; desc.configurable = !!desc.configurable; if ('value' in desc || desc.initializer) { desc.writable = true; } desc = decorators.slice().reverse().reduce(function (desc, decorator) { return decorator(target, property, desc) || desc; }, desc); if (context && desc.initializer !== void 0) { desc.value = desc.initializer ? desc.initializer.call(context) : void 0; desc.initializer = undefined; } if (desc.initializer === void 0) { Object.defineProperty(target, property, desc); desc = null; } return desc; } + +function _initializerWarningHelper(descriptor, context) { throw new Error('Decorating class property failed. Please ensure that ' + 'proposal-class-properties is enabled and runs after the decorators transform.'); } + +function dec() {} + +let A = (_class = (_temp = function A() { + "use strict"; + + _classCallCheck(this, A); + + _initializerDefineProperty(this, "a", _descriptor, this); + + _initializerDefineProperty(this, "b", _descriptor2, this); + + _defineProperty(this, "c", 456); +}, _temp), (_descriptor = _applyDecoratedDescriptor(_class.prototype, "a", [dec], { + configurable: true, + enumerable: true, + writable: true, + initializer: null +}), _descriptor2 = _applyDecoratedDescriptor(_class.prototype, "b", [dec], { + configurable: true, + enumerable: true, + writable: true, + initializer: function () { + return 123; + } +})), _class); diff --git a/packages/babel-plugin-proposal-class-properties/test/fixtures/nested-class/options.json b/packages/babel-plugin-proposal-class-properties/test/fixtures/nested-class/options.json index 0326c24fae36..c67f29027e57 100644 --- a/packages/babel-plugin-proposal-class-properties/test/fixtures/nested-class/options.json +++ b/packages/babel-plugin-proposal-class-properties/test/fixtures/nested-class/options.json @@ -1,6 +1,6 @@ { "plugins": [ - "external-helpers", + ["external-helpers", { "helperVersion": "7.100.0" }], "proposal-class-properties", "transform-classes" ] diff --git a/packages/babel-plugin-proposal-class-properties/test/fixtures/nested-class/super-call-in-key/output.js b/packages/babel-plugin-proposal-class-properties/test/fixtures/nested-class/super-call-in-key/output.js index 117802306abc..412f97e6c007 100644 --- a/packages/babel-plugin-proposal-class-properties/test/fixtures/nested-class/super-call-in-key/output.js +++ b/packages/babel-plugin-proposal-class-properties/test/fixtures/nested-class/super-call-in-key/output.js @@ -10,18 +10,18 @@ let Hello = function Hello() { }; }; -let Outer = -/*#__PURE__*/ -function (_Hello) { +let Outer = /*#__PURE__*/function (_Hello) { babelHelpers.inherits(Outer, _Hello); + var _super = babelHelpers.createSuper(Outer); + function Outer() { let _this2; var _this; babelHelpers.classCallCheck(this, Outer); - _this2 = _this = babelHelpers.possibleConstructorReturn(this, babelHelpers.getPrototypeOf(Outer).call(this)); + _this2 = _this = _super.call(this); let Inner = function Inner() { babelHelpers.classCallCheck(this, Inner); diff --git a/packages/babel-plugin-proposal-class-properties/test/fixtures/nested-class/super-property-in-key/output.js b/packages/babel-plugin-proposal-class-properties/test/fixtures/nested-class/super-property-in-key/output.js index ba9e8dd36f5e..a06cc3e0ca85 100644 --- a/packages/babel-plugin-proposal-class-properties/test/fixtures/nested-class/super-property-in-key/output.js +++ b/packages/babel-plugin-proposal-class-properties/test/fixtures/nested-class/super-property-in-key/output.js @@ -1,8 +1,6 @@ "use strict"; -let Hello = -/*#__PURE__*/ -function () { +let Hello = /*#__PURE__*/function () { function Hello() { babelHelpers.classCallCheck(this, Hello); } @@ -16,19 +14,19 @@ function () { return Hello; }(); -let Outer = -/*#__PURE__*/ -function (_Hello) { +let Outer = /*#__PURE__*/function (_Hello) { babelHelpers.inherits(Outer, _Hello); + var _super = babelHelpers.createSuper(Outer); + function Outer() { let _babelHelpers$get$cal; - var _this; + var _thisSuper, _this; babelHelpers.classCallCheck(this, Outer); - _this = babelHelpers.possibleConstructorReturn(this, babelHelpers.getPrototypeOf(Outer).call(this)); - _babelHelpers$get$cal = babelHelpers.get(babelHelpers.getPrototypeOf(Outer.prototype), "toString", babelHelpers.assertThisInitialized(_this)).call(babelHelpers.assertThisInitialized(_this)); + _this = _super.call(this); + _babelHelpers$get$cal = babelHelpers.get((_thisSuper = babelHelpers.assertThisInitialized(_this), babelHelpers.getPrototypeOf(Outer.prototype)), "toString", _thisSuper).call(_thisSuper); let Inner = function Inner() { babelHelpers.classCallCheck(this, Inner); diff --git a/packages/babel-plugin-proposal-class-properties/test/fixtures/private-loose/assignment/output.js b/packages/babel-plugin-proposal-class-properties/test/fixtures/private-loose/assignment/output.js index 00a33dc992b3..3178119a7657 100644 --- a/packages/babel-plugin-proposal-class-properties/test/fixtures/private-loose/assignment/output.js +++ b/packages/babel-plugin-proposal-class-properties/test/fixtures/private-loose/assignment/output.js @@ -1,6 +1,4 @@ -var Foo = -/*#__PURE__*/ -function () { +var Foo = /*#__PURE__*/function () { "use strict"; function Foo() { diff --git a/packages/babel-plugin-proposal-class-properties/test/fixtures/private-loose/call/output.js b/packages/babel-plugin-proposal-class-properties/test/fixtures/private-loose/call/output.js index 29515449ce3c..383429548dfd 100644 --- a/packages/babel-plugin-proposal-class-properties/test/fixtures/private-loose/call/output.js +++ b/packages/babel-plugin-proposal-class-properties/test/fixtures/private-loose/call/output.js @@ -1,6 +1,4 @@ -var Foo = -/*#__PURE__*/ -function () { +var Foo = /*#__PURE__*/function () { "use strict"; function Foo() { diff --git a/packages/babel-plugin-proposal-class-properties/test/fixtures/private-loose/canonical/output.js b/packages/babel-plugin-proposal-class-properties/test/fixtures/private-loose/canonical/output.js index 47386a7981d4..7c153c4e95b0 100644 --- a/packages/babel-plugin-proposal-class-properties/test/fixtures/private-loose/canonical/output.js +++ b/packages/babel-plugin-proposal-class-properties/test/fixtures/private-loose/canonical/output.js @@ -1,6 +1,4 @@ -var Point = -/*#__PURE__*/ -function () { +var Point = /*#__PURE__*/function () { "use strict"; function Point(x = 0, y = 0) { diff --git a/packages/babel-plugin-proposal-class-properties/test/fixtures/private-loose/derived-multiple-supers/output.js b/packages/babel-plugin-proposal-class-properties/test/fixtures/private-loose/derived-multiple-supers/output.js index c9e24a3826e3..bd303bc40a8f 100644 --- a/packages/babel-plugin-proposal-class-properties/test/fixtures/private-loose/derived-multiple-supers/output.js +++ b/packages/babel-plugin-proposal-class-properties/test/fixtures/private-loose/derived-multiple-supers/output.js @@ -1,23 +1,23 @@ -var Foo = -/*#__PURE__*/ -function (_Bar) { +var Foo = /*#__PURE__*/function (_Bar) { "use strict"; babelHelpers.inherits(Foo, _Bar); + var _super = babelHelpers.createSuper(Foo); + function Foo() { var _this; babelHelpers.classCallCheck(this, Foo); if (condition) { - _this = babelHelpers.possibleConstructorReturn(this, babelHelpers.getPrototypeOf(Foo).call(this)); + _this = _super.call(this); Object.defineProperty(babelHelpers.assertThisInitialized(_this), _bar, { writable: true, value: "foo" }); } else { - _this = babelHelpers.possibleConstructorReturn(this, babelHelpers.getPrototypeOf(Foo).call(this)); + _this = _super.call(this); Object.defineProperty(babelHelpers.assertThisInitialized(_this), _bar, { writable: true, value: "foo" diff --git a/packages/babel-plugin-proposal-class-properties/test/fixtures/private-loose/derived/output.js b/packages/babel-plugin-proposal-class-properties/test/fixtures/private-loose/derived/output.js index b008861733c2..e7be19c316d8 100644 --- a/packages/babel-plugin-proposal-class-properties/test/fixtures/private-loose/derived/output.js +++ b/packages/babel-plugin-proposal-class-properties/test/fixtures/private-loose/derived/output.js @@ -10,18 +10,18 @@ var Foo = function Foo() { var _prop = babelHelpers.classPrivateFieldLooseKey("prop"); -var Bar = -/*#__PURE__*/ -function (_Foo) { +var Bar = /*#__PURE__*/function (_Foo) { "use strict"; babelHelpers.inherits(Bar, _Foo); + var _super = babelHelpers.createSuper(Bar); + function Bar(...args) { var _this; babelHelpers.classCallCheck(this, Bar); - _this = babelHelpers.possibleConstructorReturn(this, babelHelpers.getPrototypeOf(Bar).call(this, ...args)); + _this = _super.call(this, ...args); Object.defineProperty(babelHelpers.assertThisInitialized(_this), _prop2, { writable: true, value: "bar" diff --git a/packages/babel-plugin-proposal-class-properties/test/fixtures/private-loose/foobar/output.js b/packages/babel-plugin-proposal-class-properties/test/fixtures/private-loose/foobar/output.js index c28687635b83..663e43398a95 100644 --- a/packages/babel-plugin-proposal-class-properties/test/fixtures/private-loose/foobar/output.js +++ b/packages/babel-plugin-proposal-class-properties/test/fixtures/private-loose/foobar/output.js @@ -1,15 +1,15 @@ -var Child = -/*#__PURE__*/ -function (_Parent) { +var Child = /*#__PURE__*/function (_Parent) { "use strict"; babelHelpers.inherits(Child, _Parent); + var _super = babelHelpers.createSuper(Child); + function Child() { var _this; babelHelpers.classCallCheck(this, Child); - _this = babelHelpers.possibleConstructorReturn(this, babelHelpers.getPrototypeOf(Child).call(this)); + _this = _super.call(this); Object.defineProperty(babelHelpers.assertThisInitialized(_this), _scopedFunctionWithThis, { writable: true, value: function value() { diff --git a/packages/babel-plugin-proposal-class-properties/test/fixtures/private-loose/nested-class-computed-redeclared/exec.js b/packages/babel-plugin-proposal-class-properties/test/fixtures/private-loose/nested-class-computed-redeclared/exec.js new file mode 100644 index 000000000000..b42463f45085 --- /dev/null +++ b/packages/babel-plugin-proposal-class-properties/test/fixtures/private-loose/nested-class-computed-redeclared/exec.js @@ -0,0 +1,19 @@ +class Foo { + #foo = 1; + + test() { + class Nested { + #foo = 2; + + [this.#foo]() { + } + } + + return new Nested(); + } +} + +const f = new Foo(); +expect(() => { + f.test(); +}).toThrow(); diff --git a/packages/babel-plugin-proposal-class-properties/test/fixtures/private-loose/nested-class-computed-redeclared/input.js b/packages/babel-plugin-proposal-class-properties/test/fixtures/private-loose/nested-class-computed-redeclared/input.js new file mode 100644 index 000000000000..1a8d9de8e720 --- /dev/null +++ b/packages/babel-plugin-proposal-class-properties/test/fixtures/private-loose/nested-class-computed-redeclared/input.js @@ -0,0 +1,14 @@ +class Foo { + #foo = 1; + + test() { + class Nested { + #foo = 2; + + [this.#foo]() { + } + } + + this.#foo; + } +} diff --git a/packages/babel-plugin-proposal-class-properties/test/fixtures/private-loose/nested-class-computed-redeclared/output.js b/packages/babel-plugin-proposal-class-properties/test/fixtures/private-loose/nested-class-computed-redeclared/output.js new file mode 100644 index 000000000000..f664abf3296a --- /dev/null +++ b/packages/babel-plugin-proposal-class-properties/test/fixtures/private-loose/nested-class-computed-redeclared/output.js @@ -0,0 +1,43 @@ +var Foo = /*#__PURE__*/function () { + "use strict"; + + function Foo() { + babelHelpers.classCallCheck(this, Foo); + Object.defineProperty(this, _foo, { + writable: true, + value: 1 + }); + } + + babelHelpers.createClass(Foo, [{ + key: "test", + value: function test() { + var _babelHelpers$classPr; + + _babelHelpers$classPr = babelHelpers.classPrivateFieldLooseBase(this, _foo2)[_foo2]; + + var Nested = /*#__PURE__*/function () { + function Nested() { + babelHelpers.classCallCheck(this, Nested); + Object.defineProperty(this, _foo2, { + writable: true, + value: 2 + }); + } + + babelHelpers.createClass(Nested, [{ + key: _babelHelpers$classPr, + value: function () {} + }]); + return Nested; + }(); + + var _foo2 = babelHelpers.classPrivateFieldLooseKey("foo"); + + babelHelpers.classPrivateFieldLooseBase(this, _foo)[_foo]; + } + }]); + return Foo; +}(); + +var _foo = babelHelpers.classPrivateFieldLooseKey("foo"); diff --git a/packages/babel-plugin-proposal-class-properties/test/fixtures/private-loose/nested-class-computed/exec.js b/packages/babel-plugin-proposal-class-properties/test/fixtures/private-loose/nested-class-computed/exec.js new file mode 100644 index 000000000000..937d281a8ecd --- /dev/null +++ b/packages/babel-plugin-proposal-class-properties/test/fixtures/private-loose/nested-class-computed/exec.js @@ -0,0 +1,17 @@ +class Foo { + #foo = 1; + + test() { + class Nested { + [this.#foo]() { + } + } + + return new Nested(); + } +} + +const f = new Foo(); +expect(() => { + f.test(); +}).not.toThrow(); diff --git a/packages/babel-plugin-proposal-class-properties/test/fixtures/private-loose/nested-class-computed/input.js b/packages/babel-plugin-proposal-class-properties/test/fixtures/private-loose/nested-class-computed/input.js new file mode 100644 index 000000000000..7786425d1c6c --- /dev/null +++ b/packages/babel-plugin-proposal-class-properties/test/fixtures/private-loose/nested-class-computed/input.js @@ -0,0 +1,12 @@ +class Foo { + #foo = 1; + + test() { + class Nested { + [this.#foo]() { + } + } + + this.#foo; + } +} diff --git a/packages/babel-plugin-proposal-class-properties/test/fixtures/private-loose/nested-class-computed/output.js b/packages/babel-plugin-proposal-class-properties/test/fixtures/private-loose/nested-class-computed/output.js new file mode 100644 index 000000000000..57c5ed3249d1 --- /dev/null +++ b/packages/babel-plugin-proposal-class-properties/test/fixtures/private-loose/nested-class-computed/output.js @@ -0,0 +1,35 @@ +var Foo = /*#__PURE__*/function () { + "use strict"; + + function Foo() { + babelHelpers.classCallCheck(this, Foo); + Object.defineProperty(this, _foo, { + writable: true, + value: 1 + }); + } + + babelHelpers.createClass(Foo, [{ + key: "test", + value: function test() { + var _this = this; + + var Nested = /*#__PURE__*/function () { + function Nested() { + babelHelpers.classCallCheck(this, Nested); + } + + babelHelpers.createClass(Nested, [{ + key: babelHelpers.classPrivateFieldLooseBase(_this, _foo)[_foo], + value: function () {} + }]); + return Nested; + }(); + + babelHelpers.classPrivateFieldLooseBase(this, _foo)[_foo]; + } + }]); + return Foo; +}(); + +var _foo = babelHelpers.classPrivateFieldLooseKey("foo"); diff --git a/packages/babel-plugin-proposal-class-properties/test/fixtures/private-loose/nested-class-extends-computed-redeclared/exec.js b/packages/babel-plugin-proposal-class-properties/test/fixtures/private-loose/nested-class-extends-computed-redeclared/exec.js new file mode 100644 index 000000000000..e6ecc61d0c65 --- /dev/null +++ b/packages/babel-plugin-proposal-class-properties/test/fixtures/private-loose/nested-class-extends-computed-redeclared/exec.js @@ -0,0 +1,18 @@ +class Foo { + #foo = 1; + + test() { + class Nested extends class { + #foo = 2; + + [this.#foo] = 2; + } { + #foo = 3; + } + } +} + +const f = new Foo(); +expect(() => { + f.test(); +}).toThrow(); diff --git a/packages/babel-plugin-proposal-class-properties/test/fixtures/private-loose/nested-class-extends-computed-redeclared/input.js b/packages/babel-plugin-proposal-class-properties/test/fixtures/private-loose/nested-class-extends-computed-redeclared/input.js new file mode 100644 index 000000000000..8a57bd3eed55 --- /dev/null +++ b/packages/babel-plugin-proposal-class-properties/test/fixtures/private-loose/nested-class-extends-computed-redeclared/input.js @@ -0,0 +1,12 @@ +class Foo { + #foo = 1; + + test() { + class Nested extends class { + #foo = 2; + [this.#foo] = 2; + } { + #foo = 3; + } + } +} diff --git a/packages/babel-plugin-proposal-class-properties/test/fixtures/private-loose/nested-class-extends-computed-redeclared/output.js b/packages/babel-plugin-proposal-class-properties/test/fixtures/private-loose/nested-class-extends-computed-redeclared/output.js new file mode 100644 index 000000000000..e5a3d47e0354 --- /dev/null +++ b/packages/babel-plugin-proposal-class-properties/test/fixtures/private-loose/nested-class-extends-computed-redeclared/output.js @@ -0,0 +1,56 @@ +var Foo = /*#__PURE__*/function () { + "use strict"; + + function Foo() { + babelHelpers.classCallCheck(this, Foo); + Object.defineProperty(this, _foo, { + writable: true, + value: 1 + }); + } + + babelHelpers.createClass(Foo, [{ + key: "test", + value: function test() { + var _temp, _foo3; + + var _babelHelpers$classPr; + + var Nested = /*#__PURE__*/function (_ref) { + babelHelpers.inherits(Nested, _ref); + + var _super = babelHelpers.createSuper(Nested); + + function Nested(...args) { + var _this; + + babelHelpers.classCallCheck(this, Nested); + _this = _super.call(this, ...args); + Object.defineProperty(babelHelpers.assertThisInitialized(_this), _foo2, { + writable: true, + value: 3 + }); + return _this; + } + + return Nested; + }((_temp = (_babelHelpers$classPr = babelHelpers.classPrivateFieldLooseBase(this, _foo3)[_foo3], /*#__PURE__*/function () { + function _class2() { + babelHelpers.classCallCheck(this, _class2); + Object.defineProperty(this, _foo3, { + writable: true, + value: 2 + }); + this[_babelHelpers$classPr] = 2; + } + + return _class2; + }()), _foo3 = babelHelpers.classPrivateFieldLooseKey("foo"), _temp)); + + var _foo2 = babelHelpers.classPrivateFieldLooseKey("foo"); + } + }]); + return Foo; +}(); + +var _foo = babelHelpers.classPrivateFieldLooseKey("foo"); diff --git a/packages/babel-plugin-proposal-class-properties/test/fixtures/private-loose/nested-class-extends-computed/exec.js b/packages/babel-plugin-proposal-class-properties/test/fixtures/private-loose/nested-class-extends-computed/exec.js new file mode 100644 index 000000000000..ab86e53ad557 --- /dev/null +++ b/packages/babel-plugin-proposal-class-properties/test/fixtures/private-loose/nested-class-extends-computed/exec.js @@ -0,0 +1,18 @@ +class Foo { + #foo = 1; + + test() { + class Nested extends class { + [this.#foo] = 2; + } { + #foo = 3; + } + + return new Nested(); + } +} + +const f = new Foo(); +expect(() => { + f.test(); +}).not.toThrow(); diff --git a/packages/babel-plugin-proposal-class-properties/test/fixtures/private-loose/nested-class-extends-computed/input.js b/packages/babel-plugin-proposal-class-properties/test/fixtures/private-loose/nested-class-extends-computed/input.js new file mode 100644 index 000000000000..80c5199085fd --- /dev/null +++ b/packages/babel-plugin-proposal-class-properties/test/fixtures/private-loose/nested-class-extends-computed/input.js @@ -0,0 +1,11 @@ +class Foo { + #foo = 1; + + test() { + class Nested extends class { + [this.#foo] = 2; + } { + #foo = 3; + } + } +} diff --git a/packages/babel-plugin-proposal-class-properties/test/fixtures/private-loose/nested-class-extends-computed/output.js b/packages/babel-plugin-proposal-class-properties/test/fixtures/private-loose/nested-class-extends-computed/output.js new file mode 100644 index 000000000000..8dd6e4eda055 --- /dev/null +++ b/packages/babel-plugin-proposal-class-properties/test/fixtures/private-loose/nested-class-extends-computed/output.js @@ -0,0 +1,52 @@ +var Foo = /*#__PURE__*/function () { + "use strict"; + + function Foo() { + babelHelpers.classCallCheck(this, Foo); + Object.defineProperty(this, _foo, { + writable: true, + value: 1 + }); + } + + babelHelpers.createClass(Foo, [{ + key: "test", + value: function test() { + var _temp; + + var _babelHelpers$classPr; + + var Nested = /*#__PURE__*/function (_ref) { + babelHelpers.inherits(Nested, _ref); + + var _super = babelHelpers.createSuper(Nested); + + function Nested(...args) { + var _this; + + babelHelpers.classCallCheck(this, Nested); + _this = _super.call(this, ...args); + Object.defineProperty(babelHelpers.assertThisInitialized(_this), _foo2, { + writable: true, + value: 3 + }); + return _this; + } + + return Nested; + }((_temp = (_babelHelpers$classPr = babelHelpers.classPrivateFieldLooseBase(this, _foo)[_foo], /*#__PURE__*/function () { + function _class2() { + babelHelpers.classCallCheck(this, _class2); + this[_babelHelpers$classPr] = 2; + } + + return _class2; + }()), _temp)); + + var _foo2 = babelHelpers.classPrivateFieldLooseKey("foo"); + } + }]); + return Foo; +}(); + +var _foo = babelHelpers.classPrivateFieldLooseKey("foo"); diff --git a/packages/babel-plugin-proposal-class-properties/test/fixtures/private-loose/nested-class-other-redeclared/input.js b/packages/babel-plugin-proposal-class-properties/test/fixtures/private-loose/nested-class-other-redeclared/input.js new file mode 100644 index 000000000000..4e0f3dd8a23f --- /dev/null +++ b/packages/babel-plugin-proposal-class-properties/test/fixtures/private-loose/nested-class-other-redeclared/input.js @@ -0,0 +1,18 @@ +class Foo { + #foo = 1; + #bar = 1; + + test() { + class Nested { + #bar = 2; + + test() { + this.#foo; + this.#bar; + } + } + + this.#foo; + this.#bar; + } +} diff --git a/packages/babel-plugin-proposal-class-properties/test/fixtures/private-loose/nested-class-other-redeclared/output.js b/packages/babel-plugin-proposal-class-properties/test/fixtures/private-loose/nested-class-other-redeclared/output.js new file mode 100644 index 000000000000..f906d5562dd1 --- /dev/null +++ b/packages/babel-plugin-proposal-class-properties/test/fixtures/private-loose/nested-class-other-redeclared/output.js @@ -0,0 +1,49 @@ +var Foo = /*#__PURE__*/function () { + "use strict"; + + function Foo() { + babelHelpers.classCallCheck(this, Foo); + Object.defineProperty(this, _foo, { + writable: true, + value: 1 + }); + Object.defineProperty(this, _bar, { + writable: true, + value: 1 + }); + } + + babelHelpers.createClass(Foo, [{ + key: "test", + value: function test() { + var Nested = /*#__PURE__*/function () { + function Nested() { + babelHelpers.classCallCheck(this, Nested); + Object.defineProperty(this, _bar2, { + writable: true, + value: 2 + }); + } + + babelHelpers.createClass(Nested, [{ + key: "test", + value: function test() { + babelHelpers.classPrivateFieldLooseBase(this, _foo)[_foo]; + babelHelpers.classPrivateFieldLooseBase(this, _bar2)[_bar2]; + } + }]); + return Nested; + }(); + + var _bar2 = babelHelpers.classPrivateFieldLooseKey("bar"); + + babelHelpers.classPrivateFieldLooseBase(this, _foo)[_foo]; + babelHelpers.classPrivateFieldLooseBase(this, _bar)[_bar]; + } + }]); + return Foo; +}(); + +var _foo = babelHelpers.classPrivateFieldLooseKey("foo"); + +var _bar = babelHelpers.classPrivateFieldLooseKey("bar"); diff --git a/packages/babel-plugin-proposal-class-properties/test/fixtures/private-loose/nested-class-redeclared/input.js b/packages/babel-plugin-proposal-class-properties/test/fixtures/private-loose/nested-class-redeclared/input.js new file mode 100644 index 000000000000..c4d2eaa6375c --- /dev/null +++ b/packages/babel-plugin-proposal-class-properties/test/fixtures/private-loose/nested-class-redeclared/input.js @@ -0,0 +1,15 @@ +class Foo { + #foo = 1; + + test() { + class Nested { + #foo = 2; + + test() { + this.#foo; + } + } + + this.#foo; + } +} diff --git a/packages/babel-plugin-proposal-class-properties/test/fixtures/private-loose/nested-class-redeclared/output.js b/packages/babel-plugin-proposal-class-properties/test/fixtures/private-loose/nested-class-redeclared/output.js new file mode 100644 index 000000000000..055ff8b46505 --- /dev/null +++ b/packages/babel-plugin-proposal-class-properties/test/fixtures/private-loose/nested-class-redeclared/output.js @@ -0,0 +1,41 @@ +var Foo = /*#__PURE__*/function () { + "use strict"; + + function Foo() { + babelHelpers.classCallCheck(this, Foo); + Object.defineProperty(this, _foo, { + writable: true, + value: 1 + }); + } + + babelHelpers.createClass(Foo, [{ + key: "test", + value: function test() { + var Nested = /*#__PURE__*/function () { + function Nested() { + babelHelpers.classCallCheck(this, Nested); + Object.defineProperty(this, _foo2, { + writable: true, + value: 2 + }); + } + + babelHelpers.createClass(Nested, [{ + key: "test", + value: function test() { + babelHelpers.classPrivateFieldLooseBase(this, _foo2)[_foo2]; + } + }]); + return Nested; + }(); + + var _foo2 = babelHelpers.classPrivateFieldLooseKey("foo"); + + babelHelpers.classPrivateFieldLooseBase(this, _foo)[_foo]; + } + }]); + return Foo; +}(); + +var _foo = babelHelpers.classPrivateFieldLooseKey("foo"); diff --git a/packages/babel-plugin-proposal-class-properties/test/fixtures/private-loose/nested-class/input.js b/packages/babel-plugin-proposal-class-properties/test/fixtures/private-loose/nested-class/input.js new file mode 100644 index 000000000000..a0b794493ed9 --- /dev/null +++ b/packages/babel-plugin-proposal-class-properties/test/fixtures/private-loose/nested-class/input.js @@ -0,0 +1,13 @@ +class Foo { + #foo = 1; + + test() { + class Nested { + test() { + this.#foo; + } + } + + this.#foo; + } +} diff --git a/packages/babel-plugin-proposal-class-properties/test/fixtures/private-loose/nested-class/output.js b/packages/babel-plugin-proposal-class-properties/test/fixtures/private-loose/nested-class/output.js new file mode 100644 index 000000000000..b12260adcf98 --- /dev/null +++ b/packages/babel-plugin-proposal-class-properties/test/fixtures/private-loose/nested-class/output.js @@ -0,0 +1,35 @@ +var Foo = /*#__PURE__*/function () { + "use strict"; + + function Foo() { + babelHelpers.classCallCheck(this, Foo); + Object.defineProperty(this, _foo, { + writable: true, + value: 1 + }); + } + + babelHelpers.createClass(Foo, [{ + key: "test", + value: function test() { + var Nested = /*#__PURE__*/function () { + function Nested() { + babelHelpers.classCallCheck(this, Nested); + } + + babelHelpers.createClass(Nested, [{ + key: "test", + value: function test() { + babelHelpers.classPrivateFieldLooseBase(this, _foo)[_foo]; + } + }]); + return Nested; + }(); + + babelHelpers.classPrivateFieldLooseBase(this, _foo)[_foo]; + } + }]); + return Foo; +}(); + +var _foo = babelHelpers.classPrivateFieldLooseKey("foo"); diff --git a/packages/babel-plugin-proposal-class-properties/test/fixtures/private-loose/options.json b/packages/babel-plugin-proposal-class-properties/test/fixtures/private-loose/options.json index 5e00622446a2..d0b48e090623 100644 --- a/packages/babel-plugin-proposal-class-properties/test/fixtures/private-loose/options.json +++ b/packages/babel-plugin-proposal-class-properties/test/fixtures/private-loose/options.json @@ -1,11 +1,6 @@ { "plugins": [ - [ - "external-helpers", - { - "helperVersion": "7.0.2" - } - ], + ["external-helpers", { "helperVersion": "7.100.0" }], ["proposal-class-properties", { "loose": true }], "transform-classes", "transform-block-scoping", diff --git a/packages/babel-plugin-proposal-class-properties/test/fixtures/private-loose/private-in-derived/output.js b/packages/babel-plugin-proposal-class-properties/test/fixtures/private-loose/private-in-derived/output.js index 5cdb57084a35..b2e775e1b463 100644 --- a/packages/babel-plugin-proposal-class-properties/test/fixtures/private-loose/private-in-derived/output.js +++ b/packages/babel-plugin-proposal-class-properties/test/fixtures/private-loose/private-in-derived/output.js @@ -7,14 +7,14 @@ var Outer = function Outer() { value: void 0 }); - var Test = - /*#__PURE__*/ - function (_babelHelpers$classPr) { + var Test = /*#__PURE__*/function (_babelHelpers$classPr) { babelHelpers.inherits(Test, _babelHelpers$classPr); + var _super = babelHelpers.createSuper(Test); + function Test() { babelHelpers.classCallCheck(this, Test); - return babelHelpers.possibleConstructorReturn(this, babelHelpers.getPrototypeOf(Test).apply(this, arguments)); + return _super.apply(this, arguments); } return Test; diff --git a/packages/babel-plugin-proposal-class-properties/test/fixtures/private-loose/static-call/output.js b/packages/babel-plugin-proposal-class-properties/test/fixtures/private-loose/static-call/output.js index e130e89295ce..a112202fe5dc 100644 --- a/packages/babel-plugin-proposal-class-properties/test/fixtures/private-loose/static-call/output.js +++ b/packages/babel-plugin-proposal-class-properties/test/fixtures/private-loose/static-call/output.js @@ -1,6 +1,4 @@ -var Foo = -/*#__PURE__*/ -function () { +var Foo = /*#__PURE__*/function () { "use strict"; function Foo() { diff --git a/packages/babel-plugin-proposal-class-properties/test/fixtures/private-loose/super-expression/output.js b/packages/babel-plugin-proposal-class-properties/test/fixtures/private-loose/super-expression/output.js index 70cd36e5258a..168fdba89b9d 100644 --- a/packages/babel-plugin-proposal-class-properties/test/fixtures/private-loose/super-expression/output.js +++ b/packages/babel-plugin-proposal-class-properties/test/fixtures/private-loose/super-expression/output.js @@ -1,15 +1,15 @@ -var Foo = -/*#__PURE__*/ -function (_Bar) { +var Foo = /*#__PURE__*/function (_Bar) { "use strict"; babelHelpers.inherits(Foo, _Bar); + var _super = babelHelpers.createSuper(Foo); + function Foo() { var _temp, _this; babelHelpers.classCallCheck(this, Foo); - foo((_temp = _this = babelHelpers.possibleConstructorReturn(this, babelHelpers.getPrototypeOf(Foo).call(this)), Object.defineProperty(babelHelpers.assertThisInitialized(_this), _bar, { + foo((_temp = _this = _super.call(this), Object.defineProperty(babelHelpers.assertThisInitialized(_this), _bar, { writable: true, value: "foo" }), _temp)); diff --git a/packages/babel-plugin-proposal-class-properties/test/fixtures/private-loose/super-statement/output.js b/packages/babel-plugin-proposal-class-properties/test/fixtures/private-loose/super-statement/output.js index c0f57c4a3319..72eee4648134 100644 --- a/packages/babel-plugin-proposal-class-properties/test/fixtures/private-loose/super-statement/output.js +++ b/packages/babel-plugin-proposal-class-properties/test/fixtures/private-loose/super-statement/output.js @@ -1,15 +1,15 @@ -var Foo = -/*#__PURE__*/ -function (_Bar) { +var Foo = /*#__PURE__*/function (_Bar) { "use strict"; babelHelpers.inherits(Foo, _Bar); + var _super = babelHelpers.createSuper(Foo); + function Foo() { var _this; babelHelpers.classCallCheck(this, Foo); - _this = babelHelpers.possibleConstructorReturn(this, babelHelpers.getPrototypeOf(Foo).call(this)); + _this = _super.call(this); Object.defineProperty(babelHelpers.assertThisInitialized(_this), _bar, { writable: true, value: "foo" diff --git a/packages/babel-plugin-proposal-class-properties/test/fixtures/private-loose/update/output.js b/packages/babel-plugin-proposal-class-properties/test/fixtures/private-loose/update/output.js index dde814f54dac..9ee5301378ce 100644 --- a/packages/babel-plugin-proposal-class-properties/test/fixtures/private-loose/update/output.js +++ b/packages/babel-plugin-proposal-class-properties/test/fixtures/private-loose/update/output.js @@ -1,6 +1,4 @@ -var Foo = -/*#__PURE__*/ -function () { +var Foo = /*#__PURE__*/function () { "use strict"; function Foo() { diff --git a/packages/babel-plugin-proposal-class-properties/test/fixtures/private/assignment/output.js b/packages/babel-plugin-proposal-class-properties/test/fixtures/private/assignment/output.js index 09f9f0b622a5..740304f35183 100644 --- a/packages/babel-plugin-proposal-class-properties/test/fixtures/private/assignment/output.js +++ b/packages/babel-plugin-proposal-class-properties/test/fixtures/private/assignment/output.js @@ -1,6 +1,4 @@ -var Foo = -/*#__PURE__*/ -function () { +var Foo = /*#__PURE__*/function () { "use strict"; function Foo() { diff --git a/packages/babel-plugin-proposal-class-properties/test/fixtures/private/call/output.js b/packages/babel-plugin-proposal-class-properties/test/fixtures/private/call/output.js index 575d880c79dd..d5cea713433c 100644 --- a/packages/babel-plugin-proposal-class-properties/test/fixtures/private/call/output.js +++ b/packages/babel-plugin-proposal-class-properties/test/fixtures/private/call/output.js @@ -1,6 +1,4 @@ -var Foo = -/*#__PURE__*/ -function () { +var Foo = /*#__PURE__*/function () { "use strict"; function Foo() { diff --git a/packages/babel-plugin-proposal-class-properties/test/fixtures/private/canonical/output.js b/packages/babel-plugin-proposal-class-properties/test/fixtures/private/canonical/output.js index b9c9ab8067bb..ff127b0d68fb 100644 --- a/packages/babel-plugin-proposal-class-properties/test/fixtures/private/canonical/output.js +++ b/packages/babel-plugin-proposal-class-properties/test/fixtures/private/canonical/output.js @@ -1,6 +1,4 @@ -var Point = -/*#__PURE__*/ -function () { +var Point = /*#__PURE__*/function () { "use strict"; function Point(x = 0, y = 0) { diff --git a/packages/babel-plugin-proposal-class-properties/test/fixtures/private/derived-multiple-supers/output.js b/packages/babel-plugin-proposal-class-properties/test/fixtures/private/derived-multiple-supers/output.js index e69db438db4e..a8c4abcad7dd 100644 --- a/packages/babel-plugin-proposal-class-properties/test/fixtures/private/derived-multiple-supers/output.js +++ b/packages/babel-plugin-proposal-class-properties/test/fixtures/private/derived-multiple-supers/output.js @@ -1,24 +1,24 @@ -var Foo = -/*#__PURE__*/ -function (_Bar) { +var Foo = /*#__PURE__*/function (_Bar) { "use strict"; babelHelpers.inherits(Foo, _Bar); + var _super = babelHelpers.createSuper(Foo); + function Foo() { var _this; babelHelpers.classCallCheck(this, Foo); if (condition) { - _this = babelHelpers.possibleConstructorReturn(this, babelHelpers.getPrototypeOf(Foo).call(this)); + _this = _super.call(this); _bar.set(babelHelpers.assertThisInitialized(_this), { writable: true, value: "foo" }); } else { - _this = babelHelpers.possibleConstructorReturn(this, babelHelpers.getPrototypeOf(Foo).call(this)); + _this = _super.call(this); _bar.set(babelHelpers.assertThisInitialized(_this), { writable: true, diff --git a/packages/babel-plugin-proposal-class-properties/test/fixtures/private/derived/output.js b/packages/babel-plugin-proposal-class-properties/test/fixtures/private/derived/output.js index e963676ac346..4aaeba669a96 100644 --- a/packages/babel-plugin-proposal-class-properties/test/fixtures/private/derived/output.js +++ b/packages/babel-plugin-proposal-class-properties/test/fixtures/private/derived/output.js @@ -11,18 +11,18 @@ var Foo = function Foo() { var _prop = new WeakMap(); -var Bar = -/*#__PURE__*/ -function (_Foo) { +var Bar = /*#__PURE__*/function (_Foo) { "use strict"; babelHelpers.inherits(Bar, _Foo); + var _super = babelHelpers.createSuper(Bar); + function Bar(...args) { var _this; babelHelpers.classCallCheck(this, Bar); - _this = babelHelpers.possibleConstructorReturn(this, babelHelpers.getPrototypeOf(Bar).call(this, ...args)); + _this = _super.call(this, ...args); _prop2.set(babelHelpers.assertThisInitialized(_this), { writable: true, diff --git a/packages/babel-plugin-proposal-class-properties/test/fixtures/private/foobar/output.js b/packages/babel-plugin-proposal-class-properties/test/fixtures/private/foobar/output.js index 75191222819f..39314dc51ca5 100644 --- a/packages/babel-plugin-proposal-class-properties/test/fixtures/private/foobar/output.js +++ b/packages/babel-plugin-proposal-class-properties/test/fixtures/private/foobar/output.js @@ -1,15 +1,15 @@ -var Child = -/*#__PURE__*/ -function (_Parent) { +var Child = /*#__PURE__*/function (_Parent) { "use strict"; babelHelpers.inherits(Child, _Parent); + var _super = babelHelpers.createSuper(Child); + function Child() { var _this; babelHelpers.classCallCheck(this, Child); - _this = babelHelpers.possibleConstructorReturn(this, babelHelpers.getPrototypeOf(Child).call(this)); + _this = _super.call(this); _scopedFunctionWithThis.set(babelHelpers.assertThisInitialized(_this), { writable: true, diff --git a/packages/babel-plugin-proposal-class-properties/test/fixtures/private/nested-class-computed-redeclared/exec.js b/packages/babel-plugin-proposal-class-properties/test/fixtures/private/nested-class-computed-redeclared/exec.js new file mode 100644 index 000000000000..b42463f45085 --- /dev/null +++ b/packages/babel-plugin-proposal-class-properties/test/fixtures/private/nested-class-computed-redeclared/exec.js @@ -0,0 +1,19 @@ +class Foo { + #foo = 1; + + test() { + class Nested { + #foo = 2; + + [this.#foo]() { + } + } + + return new Nested(); + } +} + +const f = new Foo(); +expect(() => { + f.test(); +}).toThrow(); diff --git a/packages/babel-plugin-proposal-class-properties/test/fixtures/private/nested-class-computed-redeclared/input.js b/packages/babel-plugin-proposal-class-properties/test/fixtures/private/nested-class-computed-redeclared/input.js new file mode 100644 index 000000000000..1a8d9de8e720 --- /dev/null +++ b/packages/babel-plugin-proposal-class-properties/test/fixtures/private/nested-class-computed-redeclared/input.js @@ -0,0 +1,14 @@ +class Foo { + #foo = 1; + + test() { + class Nested { + #foo = 2; + + [this.#foo]() { + } + } + + this.#foo; + } +} diff --git a/packages/babel-plugin-proposal-class-properties/test/fixtures/private/nested-class-computed-redeclared/output.js b/packages/babel-plugin-proposal-class-properties/test/fixtures/private/nested-class-computed-redeclared/output.js new file mode 100644 index 000000000000..c7895115ed34 --- /dev/null +++ b/packages/babel-plugin-proposal-class-properties/test/fixtures/private/nested-class-computed-redeclared/output.js @@ -0,0 +1,45 @@ +var Foo = /*#__PURE__*/function () { + "use strict"; + + function Foo() { + babelHelpers.classCallCheck(this, Foo); + + _foo.set(this, { + writable: true, + value: 1 + }); + } + + babelHelpers.createClass(Foo, [{ + key: "test", + value: function test() { + var _babelHelpers$classPr; + + _babelHelpers$classPr = babelHelpers.classPrivateFieldGet(this, _foo2); + + var Nested = /*#__PURE__*/function () { + function Nested() { + babelHelpers.classCallCheck(this, Nested); + + _foo2.set(this, { + writable: true, + value: 2 + }); + } + + babelHelpers.createClass(Nested, [{ + key: _babelHelpers$classPr, + value: function () {} + }]); + return Nested; + }(); + + var _foo2 = new WeakMap(); + + babelHelpers.classPrivateFieldGet(this, _foo); + } + }]); + return Foo; +}(); + +var _foo = new WeakMap(); diff --git a/packages/babel-plugin-proposal-class-properties/test/fixtures/private/nested-class-computed/exec.js b/packages/babel-plugin-proposal-class-properties/test/fixtures/private/nested-class-computed/exec.js new file mode 100644 index 000000000000..937d281a8ecd --- /dev/null +++ b/packages/babel-plugin-proposal-class-properties/test/fixtures/private/nested-class-computed/exec.js @@ -0,0 +1,17 @@ +class Foo { + #foo = 1; + + test() { + class Nested { + [this.#foo]() { + } + } + + return new Nested(); + } +} + +const f = new Foo(); +expect(() => { + f.test(); +}).not.toThrow(); diff --git a/packages/babel-plugin-proposal-class-properties/test/fixtures/private/nested-class-computed/input.js b/packages/babel-plugin-proposal-class-properties/test/fixtures/private/nested-class-computed/input.js new file mode 100644 index 000000000000..7786425d1c6c --- /dev/null +++ b/packages/babel-plugin-proposal-class-properties/test/fixtures/private/nested-class-computed/input.js @@ -0,0 +1,12 @@ +class Foo { + #foo = 1; + + test() { + class Nested { + [this.#foo]() { + } + } + + this.#foo; + } +} diff --git a/packages/babel-plugin-proposal-class-properties/test/fixtures/private/nested-class-computed/output.js b/packages/babel-plugin-proposal-class-properties/test/fixtures/private/nested-class-computed/output.js new file mode 100644 index 000000000000..4d06d8350652 --- /dev/null +++ b/packages/babel-plugin-proposal-class-properties/test/fixtures/private/nested-class-computed/output.js @@ -0,0 +1,36 @@ +var Foo = /*#__PURE__*/function () { + "use strict"; + + function Foo() { + babelHelpers.classCallCheck(this, Foo); + + _foo.set(this, { + writable: true, + value: 1 + }); + } + + babelHelpers.createClass(Foo, [{ + key: "test", + value: function test() { + var _this = this; + + var Nested = /*#__PURE__*/function () { + function Nested() { + babelHelpers.classCallCheck(this, Nested); + } + + babelHelpers.createClass(Nested, [{ + key: babelHelpers.classPrivateFieldGet(_this, _foo), + value: function () {} + }]); + return Nested; + }(); + + babelHelpers.classPrivateFieldGet(this, _foo); + } + }]); + return Foo; +}(); + +var _foo = new WeakMap(); diff --git a/packages/babel-plugin-proposal-class-properties/test/fixtures/private/nested-class-extends-computed-redeclared/exec.js b/packages/babel-plugin-proposal-class-properties/test/fixtures/private/nested-class-extends-computed-redeclared/exec.js new file mode 100644 index 000000000000..e6ecc61d0c65 --- /dev/null +++ b/packages/babel-plugin-proposal-class-properties/test/fixtures/private/nested-class-extends-computed-redeclared/exec.js @@ -0,0 +1,18 @@ +class Foo { + #foo = 1; + + test() { + class Nested extends class { + #foo = 2; + + [this.#foo] = 2; + } { + #foo = 3; + } + } +} + +const f = new Foo(); +expect(() => { + f.test(); +}).toThrow(); diff --git a/packages/babel-plugin-proposal-class-properties/test/fixtures/private/nested-class-extends-computed-redeclared/input.js b/packages/babel-plugin-proposal-class-properties/test/fixtures/private/nested-class-extends-computed-redeclared/input.js new file mode 100644 index 000000000000..8a57bd3eed55 --- /dev/null +++ b/packages/babel-plugin-proposal-class-properties/test/fixtures/private/nested-class-extends-computed-redeclared/input.js @@ -0,0 +1,12 @@ +class Foo { + #foo = 1; + + test() { + class Nested extends class { + #foo = 2; + [this.#foo] = 2; + } { + #foo = 3; + } + } +} diff --git a/packages/babel-plugin-proposal-class-properties/test/fixtures/private/nested-class-extends-computed-redeclared/output.js b/packages/babel-plugin-proposal-class-properties/test/fixtures/private/nested-class-extends-computed-redeclared/output.js new file mode 100644 index 000000000000..4048382eea90 --- /dev/null +++ b/packages/babel-plugin-proposal-class-properties/test/fixtures/private/nested-class-extends-computed-redeclared/output.js @@ -0,0 +1,61 @@ +var Foo = /*#__PURE__*/function () { + "use strict"; + + function Foo() { + babelHelpers.classCallCheck(this, Foo); + + _foo.set(this, { + writable: true, + value: 1 + }); + } + + babelHelpers.createClass(Foo, [{ + key: "test", + value: function test() { + var _temp, _foo3; + + var _babelHelpers$classPr; + + var Nested = /*#__PURE__*/function (_ref) { + babelHelpers.inherits(Nested, _ref); + + var _super = babelHelpers.createSuper(Nested); + + function Nested(...args) { + var _this; + + babelHelpers.classCallCheck(this, Nested); + _this = _super.call(this, ...args); + + _foo2.set(babelHelpers.assertThisInitialized(_this), { + writable: true, + value: 3 + }); + + return _this; + } + + return Nested; + }((_temp = (_babelHelpers$classPr = babelHelpers.classPrivateFieldGet(this, _foo3), /*#__PURE__*/function () { + function _class2() { + babelHelpers.classCallCheck(this, _class2); + + _foo3.set(this, { + writable: true, + value: 2 + }); + + babelHelpers.defineProperty(this, _babelHelpers$classPr, 2); + } + + return _class2; + }()), _foo3 = new WeakMap(), _temp)); + + var _foo2 = new WeakMap(); + } + }]); + return Foo; +}(); + +var _foo = new WeakMap(); diff --git a/packages/babel-plugin-proposal-class-properties/test/fixtures/private/nested-class-extends-computed/exec.js b/packages/babel-plugin-proposal-class-properties/test/fixtures/private/nested-class-extends-computed/exec.js new file mode 100644 index 000000000000..ab86e53ad557 --- /dev/null +++ b/packages/babel-plugin-proposal-class-properties/test/fixtures/private/nested-class-extends-computed/exec.js @@ -0,0 +1,18 @@ +class Foo { + #foo = 1; + + test() { + class Nested extends class { + [this.#foo] = 2; + } { + #foo = 3; + } + + return new Nested(); + } +} + +const f = new Foo(); +expect(() => { + f.test(); +}).not.toThrow(); diff --git a/packages/babel-plugin-proposal-class-properties/test/fixtures/private/nested-class-extends-computed/input.js b/packages/babel-plugin-proposal-class-properties/test/fixtures/private/nested-class-extends-computed/input.js new file mode 100644 index 000000000000..80c5199085fd --- /dev/null +++ b/packages/babel-plugin-proposal-class-properties/test/fixtures/private/nested-class-extends-computed/input.js @@ -0,0 +1,11 @@ +class Foo { + #foo = 1; + + test() { + class Nested extends class { + [this.#foo] = 2; + } { + #foo = 3; + } + } +} diff --git a/packages/babel-plugin-proposal-class-properties/test/fixtures/private/nested-class-extends-computed/output.js b/packages/babel-plugin-proposal-class-properties/test/fixtures/private/nested-class-extends-computed/output.js new file mode 100644 index 000000000000..6f17afe6bbd3 --- /dev/null +++ b/packages/babel-plugin-proposal-class-properties/test/fixtures/private/nested-class-extends-computed/output.js @@ -0,0 +1,55 @@ +var Foo = /*#__PURE__*/function () { + "use strict"; + + function Foo() { + babelHelpers.classCallCheck(this, Foo); + + _foo.set(this, { + writable: true, + value: 1 + }); + } + + babelHelpers.createClass(Foo, [{ + key: "test", + value: function test() { + var _temp; + + var _babelHelpers$classPr; + + var Nested = /*#__PURE__*/function (_ref) { + babelHelpers.inherits(Nested, _ref); + + var _super = babelHelpers.createSuper(Nested); + + function Nested(...args) { + var _this; + + babelHelpers.classCallCheck(this, Nested); + _this = _super.call(this, ...args); + + _foo2.set(babelHelpers.assertThisInitialized(_this), { + writable: true, + value: 3 + }); + + return _this; + } + + return Nested; + }((_temp = (_babelHelpers$classPr = babelHelpers.classPrivateFieldGet(this, _foo), /*#__PURE__*/function () { + function _class2() { + babelHelpers.classCallCheck(this, _class2); + babelHelpers.defineProperty(this, _babelHelpers$classPr, 2); + } + + return _class2; + }()), _temp)); + + var _foo2 = new WeakMap(); + } + }]); + return Foo; +}(); + +var _foo = new WeakMap(); diff --git a/packages/babel-plugin-proposal-class-properties/test/fixtures/private/nested-class-other-redeclared/input.js b/packages/babel-plugin-proposal-class-properties/test/fixtures/private/nested-class-other-redeclared/input.js new file mode 100644 index 000000000000..4e0f3dd8a23f --- /dev/null +++ b/packages/babel-plugin-proposal-class-properties/test/fixtures/private/nested-class-other-redeclared/input.js @@ -0,0 +1,18 @@ +class Foo { + #foo = 1; + #bar = 1; + + test() { + class Nested { + #bar = 2; + + test() { + this.#foo; + this.#bar; + } + } + + this.#foo; + this.#bar; + } +} diff --git a/packages/babel-plugin-proposal-class-properties/test/fixtures/private/nested-class-other-redeclared/output.js b/packages/babel-plugin-proposal-class-properties/test/fixtures/private/nested-class-other-redeclared/output.js new file mode 100644 index 000000000000..6d65fc229664 --- /dev/null +++ b/packages/babel-plugin-proposal-class-properties/test/fixtures/private/nested-class-other-redeclared/output.js @@ -0,0 +1,52 @@ +var Foo = /*#__PURE__*/function () { + "use strict"; + + function Foo() { + babelHelpers.classCallCheck(this, Foo); + + _foo.set(this, { + writable: true, + value: 1 + }); + + _bar.set(this, { + writable: true, + value: 1 + }); + } + + babelHelpers.createClass(Foo, [{ + key: "test", + value: function test() { + var Nested = /*#__PURE__*/function () { + function Nested() { + babelHelpers.classCallCheck(this, Nested); + + _bar2.set(this, { + writable: true, + value: 2 + }); + } + + babelHelpers.createClass(Nested, [{ + key: "test", + value: function test() { + babelHelpers.classPrivateFieldGet(this, _foo); + babelHelpers.classPrivateFieldGet(this, _bar2); + } + }]); + return Nested; + }(); + + var _bar2 = new WeakMap(); + + babelHelpers.classPrivateFieldGet(this, _foo); + babelHelpers.classPrivateFieldGet(this, _bar); + } + }]); + return Foo; +}(); + +var _foo = new WeakMap(); + +var _bar = new WeakMap(); diff --git a/packages/babel-plugin-proposal-class-properties/test/fixtures/private/nested-class-redeclared/input.js b/packages/babel-plugin-proposal-class-properties/test/fixtures/private/nested-class-redeclared/input.js new file mode 100644 index 000000000000..c4d2eaa6375c --- /dev/null +++ b/packages/babel-plugin-proposal-class-properties/test/fixtures/private/nested-class-redeclared/input.js @@ -0,0 +1,15 @@ +class Foo { + #foo = 1; + + test() { + class Nested { + #foo = 2; + + test() { + this.#foo; + } + } + + this.#foo; + } +} diff --git a/packages/babel-plugin-proposal-class-properties/test/fixtures/private/nested-class-redeclared/output.js b/packages/babel-plugin-proposal-class-properties/test/fixtures/private/nested-class-redeclared/output.js new file mode 100644 index 000000000000..3f61e520351e --- /dev/null +++ b/packages/babel-plugin-proposal-class-properties/test/fixtures/private/nested-class-redeclared/output.js @@ -0,0 +1,43 @@ +var Foo = /*#__PURE__*/function () { + "use strict"; + + function Foo() { + babelHelpers.classCallCheck(this, Foo); + + _foo.set(this, { + writable: true, + value: 1 + }); + } + + babelHelpers.createClass(Foo, [{ + key: "test", + value: function test() { + var Nested = /*#__PURE__*/function () { + function Nested() { + babelHelpers.classCallCheck(this, Nested); + + _foo2.set(this, { + writable: true, + value: 2 + }); + } + + babelHelpers.createClass(Nested, [{ + key: "test", + value: function test() { + babelHelpers.classPrivateFieldGet(this, _foo2); + } + }]); + return Nested; + }(); + + var _foo2 = new WeakMap(); + + babelHelpers.classPrivateFieldGet(this, _foo); + } + }]); + return Foo; +}(); + +var _foo = new WeakMap(); diff --git a/packages/babel-plugin-proposal-class-properties/test/fixtures/private/nested-class/input.js b/packages/babel-plugin-proposal-class-properties/test/fixtures/private/nested-class/input.js new file mode 100644 index 000000000000..a0b794493ed9 --- /dev/null +++ b/packages/babel-plugin-proposal-class-properties/test/fixtures/private/nested-class/input.js @@ -0,0 +1,13 @@ +class Foo { + #foo = 1; + + test() { + class Nested { + test() { + this.#foo; + } + } + + this.#foo; + } +} diff --git a/packages/babel-plugin-proposal-class-properties/test/fixtures/private/nested-class/output.js b/packages/babel-plugin-proposal-class-properties/test/fixtures/private/nested-class/output.js new file mode 100644 index 000000000000..e4d225a4985e --- /dev/null +++ b/packages/babel-plugin-proposal-class-properties/test/fixtures/private/nested-class/output.js @@ -0,0 +1,36 @@ +var Foo = /*#__PURE__*/function () { + "use strict"; + + function Foo() { + babelHelpers.classCallCheck(this, Foo); + + _foo.set(this, { + writable: true, + value: 1 + }); + } + + babelHelpers.createClass(Foo, [{ + key: "test", + value: function test() { + var Nested = /*#__PURE__*/function () { + function Nested() { + babelHelpers.classCallCheck(this, Nested); + } + + babelHelpers.createClass(Nested, [{ + key: "test", + value: function test() { + babelHelpers.classPrivateFieldGet(this, _foo); + } + }]); + return Nested; + }(); + + babelHelpers.classPrivateFieldGet(this, _foo); + } + }]); + return Foo; +}(); + +var _foo = new WeakMap(); diff --git a/packages/babel-plugin-proposal-class-properties/test/fixtures/private/options.json b/packages/babel-plugin-proposal-class-properties/test/fixtures/private/options.json index 5e2180d412eb..1b96399c594a 100644 --- a/packages/babel-plugin-proposal-class-properties/test/fixtures/private/options.json +++ b/packages/babel-plugin-proposal-class-properties/test/fixtures/private/options.json @@ -1,11 +1,6 @@ { "plugins": [ - [ - "external-helpers", - { - "helperVersion": "7.4.4" - } - ], + ["external-helpers", { "helperVersion": "7.100.0" }], "proposal-class-properties", "transform-classes", "transform-block-scoping", diff --git a/packages/babel-plugin-proposal-class-properties/test/fixtures/private/private-in-derived/output.js b/packages/babel-plugin-proposal-class-properties/test/fixtures/private/private-in-derived/output.js index 0ca02451bd88..fe872c14e0b9 100644 --- a/packages/babel-plugin-proposal-class-properties/test/fixtures/private/private-in-derived/output.js +++ b/packages/babel-plugin-proposal-class-properties/test/fixtures/private/private-in-derived/output.js @@ -8,14 +8,14 @@ var Outer = function Outer() { value: void 0 }); - var Test = - /*#__PURE__*/ - function (_babelHelpers$classPr) { + var Test = /*#__PURE__*/function (_babelHelpers$classPr) { babelHelpers.inherits(Test, _babelHelpers$classPr); + var _super = babelHelpers.createSuper(Test); + function Test() { babelHelpers.classCallCheck(this, Test); - return babelHelpers.possibleConstructorReturn(this, babelHelpers.getPrototypeOf(Test).apply(this, arguments)); + return _super.apply(this, arguments); } return Test; diff --git a/packages/babel-plugin-proposal-class-properties/test/fixtures/private/static-call/output.js b/packages/babel-plugin-proposal-class-properties/test/fixtures/private/static-call/output.js index 615955221a59..d3decf141782 100644 --- a/packages/babel-plugin-proposal-class-properties/test/fixtures/private/static-call/output.js +++ b/packages/babel-plugin-proposal-class-properties/test/fixtures/private/static-call/output.js @@ -1,6 +1,4 @@ -var Foo = -/*#__PURE__*/ -function () { +var Foo = /*#__PURE__*/function () { "use strict"; function Foo() { diff --git a/packages/babel-plugin-proposal-class-properties/test/fixtures/private/super-call/output.js b/packages/babel-plugin-proposal-class-properties/test/fixtures/private/super-call/output.js index 460fc4c6bea8..384e8ba85b5b 100644 --- a/packages/babel-plugin-proposal-class-properties/test/fixtures/private/super-call/output.js +++ b/packages/babel-plugin-proposal-class-properties/test/fixtures/private/super-call/output.js @@ -1,6 +1,4 @@ -var A = -/*#__PURE__*/ -function () { +var A = /*#__PURE__*/function () { "use strict"; function A() { @@ -16,22 +14,22 @@ function () { return A; }(); -var B = -/*#__PURE__*/ -function (_A) { +var B = /*#__PURE__*/function (_A) { "use strict"; babelHelpers.inherits(B, _A); + var _super = babelHelpers.createSuper(B); + function B(...args) { - var _this; + var _thisSuper, _this; babelHelpers.classCallCheck(this, B); - _this = babelHelpers.possibleConstructorReturn(this, babelHelpers.getPrototypeOf(B).call(this, ...args)); + _this = _super.call(this, ...args); _foo.set(babelHelpers.assertThisInitialized(_this), { writable: true, - value: babelHelpers.get(babelHelpers.getPrototypeOf(B.prototype), "foo", babelHelpers.assertThisInitialized(_this)).call(babelHelpers.assertThisInitialized(_this)) + value: babelHelpers.get((_thisSuper = babelHelpers.assertThisInitialized(_this), babelHelpers.getPrototypeOf(B.prototype)), "foo", _thisSuper).call(_thisSuper) }); return _this; diff --git a/packages/babel-plugin-proposal-class-properties/test/fixtures/private/super-expression/output.js b/packages/babel-plugin-proposal-class-properties/test/fixtures/private/super-expression/output.js index f4bce1d75894..30481ac4cb3e 100644 --- a/packages/babel-plugin-proposal-class-properties/test/fixtures/private/super-expression/output.js +++ b/packages/babel-plugin-proposal-class-properties/test/fixtures/private/super-expression/output.js @@ -1,15 +1,15 @@ -var Foo = -/*#__PURE__*/ -function (_Bar) { +var Foo = /*#__PURE__*/function (_Bar) { "use strict"; babelHelpers.inherits(Foo, _Bar); + var _super = babelHelpers.createSuper(Foo); + function Foo() { var _temp, _this; babelHelpers.classCallCheck(this, Foo); - foo((_temp = _this = babelHelpers.possibleConstructorReturn(this, babelHelpers.getPrototypeOf(Foo).call(this)), _bar.set(babelHelpers.assertThisInitialized(_this), { + foo((_temp = _this = _super.call(this), _bar.set(babelHelpers.assertThisInitialized(_this), { writable: true, value: "foo" }), _temp)); diff --git a/packages/babel-plugin-proposal-class-properties/test/fixtures/private/super-statement/output.js b/packages/babel-plugin-proposal-class-properties/test/fixtures/private/super-statement/output.js index df484a2a1c7a..d795323464bf 100644 --- a/packages/babel-plugin-proposal-class-properties/test/fixtures/private/super-statement/output.js +++ b/packages/babel-plugin-proposal-class-properties/test/fixtures/private/super-statement/output.js @@ -1,15 +1,15 @@ -var Foo = -/*#__PURE__*/ -function (_Bar) { +var Foo = /*#__PURE__*/function (_Bar) { "use strict"; babelHelpers.inherits(Foo, _Bar); + var _super = babelHelpers.createSuper(Foo); + function Foo() { var _this; babelHelpers.classCallCheck(this, Foo); - _this = babelHelpers.possibleConstructorReturn(this, babelHelpers.getPrototypeOf(Foo).call(this)); + _this = _super.call(this); _bar.set(babelHelpers.assertThisInitialized(_this), { writable: true, diff --git a/packages/babel-plugin-proposal-class-properties/test/fixtures/private/update/output.js b/packages/babel-plugin-proposal-class-properties/test/fixtures/private/update/output.js index 059ef2a09146..91b66147c929 100644 --- a/packages/babel-plugin-proposal-class-properties/test/fixtures/private/update/output.js +++ b/packages/babel-plugin-proposal-class-properties/test/fixtures/private/update/output.js @@ -1,6 +1,4 @@ -var Foo = -/*#__PURE__*/ -function () { +var Foo = /*#__PURE__*/function () { "use strict"; function Foo() { diff --git a/packages/babel-plugin-proposal-class-properties/test/fixtures/public-loose/computed/output.js b/packages/babel-plugin-proposal-class-properties/test/fixtures/public-loose/computed/output.js index 20509438f6a1..7c9f2f4c16a1 100644 --- a/packages/babel-plugin-proposal-class-properties/test/fixtures/public-loose/computed/output.js +++ b/packages/babel-plugin-proposal-class-properties/test/fixtures/public-loose/computed/output.js @@ -15,9 +15,7 @@ _ref3 = /regex/; _baz = baz; _ref4 = `template${expression}`; -var MyClass = -/*#__PURE__*/ -function () { +var MyClass = /*#__PURE__*/function () { "use strict"; function MyClass() { diff --git a/packages/babel-plugin-proposal-class-properties/test/fixtures/public-loose/derived/output.js b/packages/babel-plugin-proposal-class-properties/test/fixtures/public-loose/derived/output.js index 81ae1b19707e..f4c7902b9a33 100644 --- a/packages/babel-plugin-proposal-class-properties/test/fixtures/public-loose/derived/output.js +++ b/packages/babel-plugin-proposal-class-properties/test/fixtures/public-loose/derived/output.js @@ -1,15 +1,15 @@ -var Foo = -/*#__PURE__*/ -function (_Bar) { +var Foo = /*#__PURE__*/function (_Bar) { "use strict"; babelHelpers.inherits(Foo, _Bar); + var _super = babelHelpers.createSuper(Foo); + function Foo(...args) { var _this; babelHelpers.classCallCheck(this, Foo); - _this = babelHelpers.possibleConstructorReturn(this, babelHelpers.getPrototypeOf(Foo).call(this, ...args)); + _this = _super.call(this, ...args); _this.bar = "foo"; return _this; } diff --git a/packages/babel-plugin-proposal-class-properties/test/fixtures/public-loose/foobar/options.json b/packages/babel-plugin-proposal-class-properties/test/fixtures/public-loose/foobar/options.json index f43ead744a23..2abcedf61cd4 100644 --- a/packages/babel-plugin-proposal-class-properties/test/fixtures/public-loose/foobar/options.json +++ b/packages/babel-plugin-proposal-class-properties/test/fixtures/public-loose/foobar/options.json @@ -1,6 +1,6 @@ { "plugins": [ - "external-helpers", + ["external-helpers", { "helperVersion": "7.100.0" }], ["proposal-class-properties", { "loose": true }] ], "presets": ["env"] diff --git a/packages/babel-plugin-proposal-class-properties/test/fixtures/public-loose/foobar/output.js b/packages/babel-plugin-proposal-class-properties/test/fixtures/public-loose/foobar/output.js index 3f43d7eb0f66..86a6067497dc 100644 --- a/packages/babel-plugin-proposal-class-properties/test/fixtures/public-loose/foobar/output.js +++ b/packages/babel-plugin-proposal-class-properties/test/fixtures/public-loose/foobar/output.js @@ -1,15 +1,15 @@ -var Child = -/*#__PURE__*/ -function (_Parent) { +var Child = /*#__PURE__*/function (_Parent) { "use strict"; babelHelpers.inherits(Child, _Parent); + var _super = babelHelpers.createSuper(Child); + function Child() { var _this; babelHelpers.classCallCheck(this, Child); - _this = babelHelpers.possibleConstructorReturn(this, babelHelpers.getPrototypeOf(Child).call(this)); + _this = _super.call(this); _this.scopedFunctionWithThis = function () { _this.name = {}; diff --git a/packages/babel-plugin-proposal-class-properties/test/fixtures/public-loose/non-block-arrow-func/output.mjs b/packages/babel-plugin-proposal-class-properties/test/fixtures/public-loose/non-block-arrow-func/output.mjs index 46d0e190ab2f..328111844f48 100644 --- a/packages/babel-plugin-proposal-class-properties/test/fixtures/public-loose/non-block-arrow-func/output.mjs +++ b/packages/babel-plugin-proposal-class-properties/test/fixtures/public-loose/non-block-arrow-func/output.mjs @@ -1,9 +1,7 @@ export default (param => { var _class, _temp; - return _temp = _class = - /*#__PURE__*/ - function () { + return _temp = _class = /*#__PURE__*/function () { function App() { babelHelpers.classCallCheck(this, App); } diff --git a/packages/babel-plugin-proposal-class-properties/test/fixtures/public-loose/options.json b/packages/babel-plugin-proposal-class-properties/test/fixtures/public-loose/options.json index 524cdc31421b..d0b48e090623 100644 --- a/packages/babel-plugin-proposal-class-properties/test/fixtures/public-loose/options.json +++ b/packages/babel-plugin-proposal-class-properties/test/fixtures/public-loose/options.json @@ -1,6 +1,6 @@ { "plugins": [ - "external-helpers", + ["external-helpers", { "helperVersion": "7.100.0" }], ["proposal-class-properties", { "loose": true }], "transform-classes", "transform-block-scoping", diff --git a/packages/babel-plugin-proposal-class-properties/test/fixtures/public-loose/regression-T6719/output.js b/packages/babel-plugin-proposal-class-properties/test/fixtures/public-loose/regression-T6719/output.js index f8aebbe0260b..337ecc232cb2 100644 --- a/packages/babel-plugin-proposal-class-properties/test/fixtures/public-loose/regression-T6719/output.js +++ b/packages/babel-plugin-proposal-class-properties/test/fixtures/public-loose/regression-T6719/output.js @@ -1,16 +1,16 @@ function withContext(ComposedComponent) { var _class, _temp; - return _temp = _class = - /*#__PURE__*/ - function (_Component) { + return _temp = _class = /*#__PURE__*/function (_Component) { "use strict"; babelHelpers.inherits(WithContext, _Component); + var _super = babelHelpers.createSuper(WithContext); + function WithContext() { babelHelpers.classCallCheck(this, WithContext); - return babelHelpers.possibleConstructorReturn(this, babelHelpers.getPrototypeOf(WithContext).apply(this, arguments)); + return _super.apply(this, arguments); } return WithContext; diff --git a/packages/babel-plugin-proposal-class-properties/test/fixtures/public-loose/regression-T7364/output.mjs b/packages/babel-plugin-proposal-class-properties/test/fixtures/public-loose/regression-T7364/output.mjs index 1fa6373e31ce..24c39cad22bd 100644 --- a/packages/babel-plugin-proposal-class-properties/test/fixtures/public-loose/regression-T7364/output.mjs +++ b/packages/babel-plugin-proposal-class-properties/test/fixtures/public-loose/regression-T7364/output.mjs @@ -2,9 +2,7 @@ class MyClass { constructor() { var _this = this; - this.myAsyncMethod = - /*#__PURE__*/ - babelHelpers.asyncToGenerator(function* () { + this.myAsyncMethod = /*#__PURE__*/babelHelpers.asyncToGenerator(function* () { console.log(_this); }); } @@ -15,9 +13,7 @@ class MyClass { constructor() { var _this2 = this; - this.myAsyncMethod = - /*#__PURE__*/ - babelHelpers.asyncToGenerator(function* () { + this.myAsyncMethod = /*#__PURE__*/babelHelpers.asyncToGenerator(function* () { console.log(_this2); }); } @@ -28,9 +24,7 @@ export default class MyClass3 { constructor() { var _this3 = this; - this.myAsyncMethod = - /*#__PURE__*/ - babelHelpers.asyncToGenerator(function* () { + this.myAsyncMethod = /*#__PURE__*/babelHelpers.asyncToGenerator(function* () { console.log(_this3); }); } diff --git a/packages/babel-plugin-proposal-class-properties/test/fixtures/public-loose/static-super/output.js b/packages/babel-plugin-proposal-class-properties/test/fixtures/public-loose/static-super/output.js index d41e2ff85106..f139990e47fb 100644 --- a/packages/babel-plugin-proposal-class-properties/test/fixtures/public-loose/static-super/output.js +++ b/packages/babel-plugin-proposal-class-properties/test/fixtures/public-loose/static-super/output.js @@ -6,16 +6,16 @@ var A = function A() { A.prop = 1; -var B = -/*#__PURE__*/ -function (_A) { +var B = /*#__PURE__*/function (_A) { "use strict"; babelHelpers.inherits(B, _A); + var _super = babelHelpers.createSuper(B); + function B() { babelHelpers.classCallCheck(this, B); - return babelHelpers.possibleConstructorReturn(this, babelHelpers.getPrototypeOf(B).apply(this, arguments)); + return _super.apply(this, arguments); } return B; diff --git a/packages/babel-plugin-proposal-class-properties/test/fixtures/public-loose/super-call/output.js b/packages/babel-plugin-proposal-class-properties/test/fixtures/public-loose/super-call/output.js index 03819a301505..af3cddf93166 100644 --- a/packages/babel-plugin-proposal-class-properties/test/fixtures/public-loose/super-call/output.js +++ b/packages/babel-plugin-proposal-class-properties/test/fixtures/public-loose/super-call/output.js @@ -1,6 +1,4 @@ -var A = -/*#__PURE__*/ -function () { +var A = /*#__PURE__*/function () { "use strict"; function A() { @@ -16,19 +14,19 @@ function () { return A; }(); -var B = -/*#__PURE__*/ -function (_A) { +var B = /*#__PURE__*/function (_A) { "use strict"; babelHelpers.inherits(B, _A); + var _super = babelHelpers.createSuper(B); + function B(...args) { - var _this; + var _thisSuper, _this; babelHelpers.classCallCheck(this, B); - _this = babelHelpers.possibleConstructorReturn(this, babelHelpers.getPrototypeOf(B).call(this, ...args)); - _this.foo = babelHelpers.get(babelHelpers.getPrototypeOf(B.prototype), "foo", babelHelpers.assertThisInitialized(_this)).call(babelHelpers.assertThisInitialized(_this)); + _this = _super.call(this, ...args); + _this.foo = babelHelpers.get((_thisSuper = babelHelpers.assertThisInitialized(_this), babelHelpers.getPrototypeOf(B.prototype)), "foo", _thisSuper).call(_thisSuper); return _this; } diff --git a/packages/babel-plugin-proposal-class-properties/test/fixtures/public-loose/super-expression/output.js b/packages/babel-plugin-proposal-class-properties/test/fixtures/public-loose/super-expression/output.js index d682e4a6ed6c..032dca07d841 100644 --- a/packages/babel-plugin-proposal-class-properties/test/fixtures/public-loose/super-expression/output.js +++ b/packages/babel-plugin-proposal-class-properties/test/fixtures/public-loose/super-expression/output.js @@ -1,15 +1,15 @@ -var Foo = -/*#__PURE__*/ -function (_Bar) { +var Foo = /*#__PURE__*/function (_Bar) { "use strict"; babelHelpers.inherits(Foo, _Bar); + var _super = babelHelpers.createSuper(Foo); + function Foo() { var _temp, _this; babelHelpers.classCallCheck(this, Foo); - foo((_temp = _this = babelHelpers.possibleConstructorReturn(this, babelHelpers.getPrototypeOf(Foo).call(this)), _this.bar = "foo", _temp)); + foo((_temp = _this = _super.call(this), _this.bar = "foo", _temp)); return _this; } diff --git a/packages/babel-plugin-proposal-class-properties/test/fixtures/public-loose/super-statement/output.js b/packages/babel-plugin-proposal-class-properties/test/fixtures/public-loose/super-statement/output.js index c63a614d0236..293dce824f2e 100644 --- a/packages/babel-plugin-proposal-class-properties/test/fixtures/public-loose/super-statement/output.js +++ b/packages/babel-plugin-proposal-class-properties/test/fixtures/public-loose/super-statement/output.js @@ -1,15 +1,15 @@ -var Foo = -/*#__PURE__*/ -function (_Bar) { +var Foo = /*#__PURE__*/function (_Bar) { "use strict"; babelHelpers.inherits(Foo, _Bar); + var _super = babelHelpers.createSuper(Foo); + function Foo() { var _this; babelHelpers.classCallCheck(this, Foo); - _this = babelHelpers.possibleConstructorReturn(this, babelHelpers.getPrototypeOf(Foo).call(this)); + _this = _super.call(this); _this.bar = "foo"; return _this; } diff --git a/packages/babel-plugin-proposal-class-properties/test/fixtures/public/assignment/output.js b/packages/babel-plugin-proposal-class-properties/test/fixtures/public/assignment/output.js index 83a710d33e55..4b1015500dfd 100644 --- a/packages/babel-plugin-proposal-class-properties/test/fixtures/public/assignment/output.js +++ b/packages/babel-plugin-proposal-class-properties/test/fixtures/public/assignment/output.js @@ -1,6 +1,4 @@ -var Foo = -/*#__PURE__*/ -function () { +var Foo = /*#__PURE__*/function () { "use strict"; function Foo() { diff --git a/packages/babel-plugin-proposal-class-properties/test/fixtures/public/call/output.js b/packages/babel-plugin-proposal-class-properties/test/fixtures/public/call/output.js index b58e59b5fbf7..2b2504076029 100644 --- a/packages/babel-plugin-proposal-class-properties/test/fixtures/public/call/output.js +++ b/packages/babel-plugin-proposal-class-properties/test/fixtures/public/call/output.js @@ -1,6 +1,4 @@ -var Foo = -/*#__PURE__*/ -function () { +var Foo = /*#__PURE__*/function () { "use strict"; function Foo() { diff --git a/packages/babel-plugin-proposal-class-properties/test/fixtures/public/computed-without-block/output.js b/packages/babel-plugin-proposal-class-properties/test/fixtures/public/computed-without-block/output.js index 535a47955ecf..1ced958305ad 100644 --- a/packages/babel-plugin-proposal-class-properties/test/fixtures/public/computed-without-block/output.js +++ b/packages/babel-plugin-proposal-class-properties/test/fixtures/public/computed-without-block/output.js @@ -3,9 +3,7 @@ var createClass = k => { var _k; - return _temp = (_k = k(), - /*#__PURE__*/ - function () { + return _temp = (_k = k(), /*#__PURE__*/function () { "use strict"; function _class2() { diff --git a/packages/babel-plugin-proposal-class-properties/test/fixtures/public/computed/output.js b/packages/babel-plugin-proposal-class-properties/test/fixtures/public/computed/output.js index 259d3c96476d..02e3327c6bd3 100644 --- a/packages/babel-plugin-proposal-class-properties/test/fixtures/public/computed/output.js +++ b/packages/babel-plugin-proposal-class-properties/test/fixtures/public/computed/output.js @@ -15,9 +15,7 @@ _ref3 = /regex/; _baz = baz; _ref4 = `template${expression}`; -var MyClass = -/*#__PURE__*/ -function () { +var MyClass = /*#__PURE__*/function () { "use strict"; function MyClass() { diff --git a/packages/babel-plugin-proposal-class-properties/test/fixtures/public/derived-multiple-supers/output.js b/packages/babel-plugin-proposal-class-properties/test/fixtures/public/derived-multiple-supers/output.js index cb9e03767bc4..6609659cb434 100644 --- a/packages/babel-plugin-proposal-class-properties/test/fixtures/public/derived-multiple-supers/output.js +++ b/packages/babel-plugin-proposal-class-properties/test/fixtures/public/derived-multiple-supers/output.js @@ -1,20 +1,20 @@ -var Foo = -/*#__PURE__*/ -function (_Bar) { +var Foo = /*#__PURE__*/function (_Bar) { "use strict"; babelHelpers.inherits(Foo, _Bar); + var _super = babelHelpers.createSuper(Foo); + function Foo() { var _this; babelHelpers.classCallCheck(this, Foo); if (condition) { - _this = babelHelpers.possibleConstructorReturn(this, babelHelpers.getPrototypeOf(Foo).call(this)); + _this = _super.call(this); babelHelpers.defineProperty(babelHelpers.assertThisInitialized(_this), "bar", "foo"); } else { - _this = babelHelpers.possibleConstructorReturn(this, babelHelpers.getPrototypeOf(Foo).call(this)); + _this = _super.call(this); babelHelpers.defineProperty(babelHelpers.assertThisInitialized(_this), "bar", "foo"); } diff --git a/packages/babel-plugin-proposal-class-properties/test/fixtures/public/derived/output.js b/packages/babel-plugin-proposal-class-properties/test/fixtures/public/derived/output.js index ebfcf1faa2b7..68f1b88a7914 100644 --- a/packages/babel-plugin-proposal-class-properties/test/fixtures/public/derived/output.js +++ b/packages/babel-plugin-proposal-class-properties/test/fixtures/public/derived/output.js @@ -1,15 +1,15 @@ -var Foo = -/*#__PURE__*/ -function (_Bar) { +var Foo = /*#__PURE__*/function (_Bar) { "use strict"; babelHelpers.inherits(Foo, _Bar); + var _super = babelHelpers.createSuper(Foo); + function Foo(...args) { var _this; babelHelpers.classCallCheck(this, Foo); - _this = babelHelpers.possibleConstructorReturn(this, babelHelpers.getPrototypeOf(Foo).call(this, ...args)); + _this = _super.call(this, ...args); babelHelpers.defineProperty(babelHelpers.assertThisInitialized(_this), "bar", "foo"); return _this; } diff --git a/packages/babel-plugin-proposal-class-properties/test/fixtures/public/foobar/output.js b/packages/babel-plugin-proposal-class-properties/test/fixtures/public/foobar/output.js index 3e89c9938bf8..581c92119640 100644 --- a/packages/babel-plugin-proposal-class-properties/test/fixtures/public/foobar/output.js +++ b/packages/babel-plugin-proposal-class-properties/test/fixtures/public/foobar/output.js @@ -1,15 +1,19 @@ -var Child = -/*#__PURE__*/ -function (_Parent) { +function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function () { var Super = babelHelpers.getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = babelHelpers.getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return babelHelpers.possibleConstructorReturn(this, result); }; } + +function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } + +var Child = /*#__PURE__*/function (_Parent) { "use strict"; babelHelpers.inherits(Child, _Parent); + var _super = _createSuper(Child); + function Child() { var _this; babelHelpers.classCallCheck(this, Child); - _this = babelHelpers.possibleConstructorReturn(this, babelHelpers.getPrototypeOf(Child).call(this)); + _this = _super.call(this); babelHelpers.defineProperty(babelHelpers.assertThisInitialized(_this), "scopedFunctionWithThis", function () { _this.name = {}; }); diff --git a/packages/babel-plugin-proposal-class-properties/test/fixtures/public/non-block-arrow-func/output.mjs b/packages/babel-plugin-proposal-class-properties/test/fixtures/public/non-block-arrow-func/output.mjs index b5be8d5c8086..996c6cc9912e 100644 --- a/packages/babel-plugin-proposal-class-properties/test/fixtures/public/non-block-arrow-func/output.mjs +++ b/packages/babel-plugin-proposal-class-properties/test/fixtures/public/non-block-arrow-func/output.mjs @@ -1,9 +1,7 @@ export default (param => { var _class, _temp; - return _temp = _class = - /*#__PURE__*/ - function () { + return _temp = _class = /*#__PURE__*/function () { function App() { babelHelpers.classCallCheck(this, App); } diff --git a/packages/babel-plugin-proposal-class-properties/test/fixtures/public/options.json b/packages/babel-plugin-proposal-class-properties/test/fixtures/public/options.json index d19c255940b8..1b96399c594a 100644 --- a/packages/babel-plugin-proposal-class-properties/test/fixtures/public/options.json +++ b/packages/babel-plugin-proposal-class-properties/test/fixtures/public/options.json @@ -1,6 +1,6 @@ { "plugins": [ - "external-helpers", + ["external-helpers", { "helperVersion": "7.100.0" }], "proposal-class-properties", "transform-classes", "transform-block-scoping", diff --git a/packages/babel-plugin-proposal-class-properties/test/fixtures/public/regression-T6719/output.js b/packages/babel-plugin-proposal-class-properties/test/fixtures/public/regression-T6719/output.js index 4e1760844081..2ac7f4d8a222 100644 --- a/packages/babel-plugin-proposal-class-properties/test/fixtures/public/regression-T6719/output.js +++ b/packages/babel-plugin-proposal-class-properties/test/fixtures/public/regression-T6719/output.js @@ -1,16 +1,16 @@ function withContext(ComposedComponent) { var _class, _temp; - return _temp = _class = - /*#__PURE__*/ - function (_Component) { + return _temp = _class = /*#__PURE__*/function (_Component) { "use strict"; babelHelpers.inherits(WithContext, _Component); + var _super = babelHelpers.createSuper(WithContext); + function WithContext() { babelHelpers.classCallCheck(this, WithContext); - return babelHelpers.possibleConstructorReturn(this, babelHelpers.getPrototypeOf(WithContext).apply(this, arguments)); + return _super.apply(this, arguments); } return WithContext; diff --git a/packages/babel-plugin-proposal-class-properties/test/fixtures/public/regression-T7364/output.mjs b/packages/babel-plugin-proposal-class-properties/test/fixtures/public/regression-T7364/output.mjs index 29773405f124..27e88be84e4e 100644 --- a/packages/babel-plugin-proposal-class-properties/test/fixtures/public/regression-T7364/output.mjs +++ b/packages/babel-plugin-proposal-class-properties/test/fixtures/public/regression-T7364/output.mjs @@ -2,9 +2,7 @@ class MyClass { constructor() { var _this = this; - babelHelpers.defineProperty(this, "myAsyncMethod", - /*#__PURE__*/ - babelHelpers.asyncToGenerator(function* () { + babelHelpers.defineProperty(this, "myAsyncMethod", /*#__PURE__*/babelHelpers.asyncToGenerator(function* () { console.log(_this); })); } @@ -15,9 +13,7 @@ class MyClass { constructor() { var _this2 = this; - babelHelpers.defineProperty(this, "myAsyncMethod", - /*#__PURE__*/ - babelHelpers.asyncToGenerator(function* () { + babelHelpers.defineProperty(this, "myAsyncMethod", /*#__PURE__*/babelHelpers.asyncToGenerator(function* () { console.log(_this2); })); } @@ -28,9 +24,7 @@ export default class MyClass3 { constructor() { var _this3 = this; - babelHelpers.defineProperty(this, "myAsyncMethod", - /*#__PURE__*/ - babelHelpers.asyncToGenerator(function* () { + babelHelpers.defineProperty(this, "myAsyncMethod", /*#__PURE__*/babelHelpers.asyncToGenerator(function* () { console.log(_this3); })); } diff --git a/packages/babel-plugin-proposal-class-properties/test/fixtures/public/static-super/output.js b/packages/babel-plugin-proposal-class-properties/test/fixtures/public/static-super/output.js index bb05940c9083..623ee42f2bf5 100644 --- a/packages/babel-plugin-proposal-class-properties/test/fixtures/public/static-super/output.js +++ b/packages/babel-plugin-proposal-class-properties/test/fixtures/public/static-super/output.js @@ -6,16 +6,16 @@ var A = function A() { babelHelpers.defineProperty(A, "prop", 1); -var B = -/*#__PURE__*/ -function (_A) { +var B = /*#__PURE__*/function (_A) { "use strict"; babelHelpers.inherits(B, _A); + var _super = babelHelpers.createSuper(B); + function B() { babelHelpers.classCallCheck(this, B); - return babelHelpers.possibleConstructorReturn(this, babelHelpers.getPrototypeOf(B).apply(this, arguments)); + return _super.apply(this, arguments); } return B; diff --git a/packages/babel-plugin-proposal-class-properties/test/fixtures/public/super-call/output.js b/packages/babel-plugin-proposal-class-properties/test/fixtures/public/super-call/output.js index 08bb0b4d9bbc..820a6f9159f4 100644 --- a/packages/babel-plugin-proposal-class-properties/test/fixtures/public/super-call/output.js +++ b/packages/babel-plugin-proposal-class-properties/test/fixtures/public/super-call/output.js @@ -1,6 +1,4 @@ -var A = -/*#__PURE__*/ -function () { +var A = /*#__PURE__*/function () { "use strict"; function A() { @@ -16,19 +14,19 @@ function () { return A; }(); -var B = -/*#__PURE__*/ -function (_A) { +var B = /*#__PURE__*/function (_A) { "use strict"; babelHelpers.inherits(B, _A); + var _super = babelHelpers.createSuper(B); + function B(...args) { - var _this; + var _thisSuper, _this; babelHelpers.classCallCheck(this, B); - _this = babelHelpers.possibleConstructorReturn(this, babelHelpers.getPrototypeOf(B).call(this, ...args)); - babelHelpers.defineProperty(babelHelpers.assertThisInitialized(_this), "foo", babelHelpers.get(babelHelpers.getPrototypeOf(B.prototype), "foo", babelHelpers.assertThisInitialized(_this)).call(babelHelpers.assertThisInitialized(_this))); + _this = _super.call(this, ...args); + babelHelpers.defineProperty(babelHelpers.assertThisInitialized(_this), "foo", babelHelpers.get((_thisSuper = babelHelpers.assertThisInitialized(_this), babelHelpers.getPrototypeOf(B.prototype)), "foo", _thisSuper).call(_thisSuper)); return _this; } diff --git a/packages/babel-plugin-proposal-class-properties/test/fixtures/public/super-expression/output.js b/packages/babel-plugin-proposal-class-properties/test/fixtures/public/super-expression/output.js index be7f0ef6822f..7ede665cbf19 100644 --- a/packages/babel-plugin-proposal-class-properties/test/fixtures/public/super-expression/output.js +++ b/packages/babel-plugin-proposal-class-properties/test/fixtures/public/super-expression/output.js @@ -1,15 +1,15 @@ -var Foo = -/*#__PURE__*/ -function (_Bar) { +var Foo = /*#__PURE__*/function (_Bar) { "use strict"; babelHelpers.inherits(Foo, _Bar); + var _super = babelHelpers.createSuper(Foo); + function Foo() { var _temp, _this; babelHelpers.classCallCheck(this, Foo); - foo((_temp = _this = babelHelpers.possibleConstructorReturn(this, babelHelpers.getPrototypeOf(Foo).call(this)), babelHelpers.defineProperty(babelHelpers.assertThisInitialized(_this), "bar", "foo"), _temp)); + foo((_temp = _this = _super.call(this), babelHelpers.defineProperty(babelHelpers.assertThisInitialized(_this), "bar", "foo"), _temp)); return _this; } diff --git a/packages/babel-plugin-proposal-class-properties/test/fixtures/public/super-statement/output.js b/packages/babel-plugin-proposal-class-properties/test/fixtures/public/super-statement/output.js index ef101c0bee33..7de51e029296 100644 --- a/packages/babel-plugin-proposal-class-properties/test/fixtures/public/super-statement/output.js +++ b/packages/babel-plugin-proposal-class-properties/test/fixtures/public/super-statement/output.js @@ -1,15 +1,15 @@ -var Foo = -/*#__PURE__*/ -function (_Bar) { +var Foo = /*#__PURE__*/function (_Bar) { "use strict"; babelHelpers.inherits(Foo, _Bar); + var _super = babelHelpers.createSuper(Foo); + function Foo() { var _this; babelHelpers.classCallCheck(this, Foo); - _this = babelHelpers.possibleConstructorReturn(this, babelHelpers.getPrototypeOf(Foo).call(this)); + _this = _super.call(this); babelHelpers.defineProperty(babelHelpers.assertThisInitialized(_this), "bar", "foo"); return _this; } diff --git a/packages/babel-plugin-proposal-class-properties/test/fixtures/public/update/output.js b/packages/babel-plugin-proposal-class-properties/test/fixtures/public/update/output.js index c2c2a6927ee2..ae3809a1a8fe 100644 --- a/packages/babel-plugin-proposal-class-properties/test/fixtures/public/update/output.js +++ b/packages/babel-plugin-proposal-class-properties/test/fixtures/public/update/output.js @@ -1,6 +1,4 @@ -var Foo = -/*#__PURE__*/ -function () { +var Foo = /*#__PURE__*/function () { "use strict"; function Foo() { diff --git a/packages/babel-plugin-proposal-class-properties/test/fixtures/regression/6154/output.js b/packages/babel-plugin-proposal-class-properties/test/fixtures/regression/6154/output.js index 6c8d4cd1a2f5..fc0704dbd461 100644 --- a/packages/babel-plugin-proposal-class-properties/test/fixtures/regression/6154/output.js +++ b/packages/babel-plugin-proposal-class-properties/test/fixtures/regression/6154/output.js @@ -1,12 +1,16 @@ -function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } +function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } + +function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } + +function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function () { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } - -function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } +function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } function _get(target, property, receiver) { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get; } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(receiver); } return desc.value; }; } return _get(target, property, receiver || target); } @@ -23,15 +27,13 @@ var Test = function Test() { _classCallCheck(this, Test); - var Other = - /*#__PURE__*/ - function (_Test) { + var Other = /*#__PURE__*/function (_Test) { _inherits(Other, _Test); - function Other() { - var _getPrototypeOf2; + var _super = _createSuper(Other); - var _this; + function Other() { + var _thisSuper, _this; _classCallCheck(this, Other); @@ -39,10 +41,10 @@ var Test = function Test() { args[_key] = arguments[_key]; } - _this = _possibleConstructorReturn(this, (_getPrototypeOf2 = _getPrototypeOf(Other)).call.apply(_getPrototypeOf2, [this].concat(args))); + _this = _super.call.apply(_super, [this].concat(args)); _defineProperty(_assertThisInitialized(_this), "a", function () { - return _get(_getPrototypeOf(Other.prototype), "test", _assertThisInitialized(_this)); + return _get((_thisSuper = _assertThisInitialized(_this), _getPrototypeOf(Other.prototype)), "test", _thisSuper); }); return _this; diff --git a/packages/babel-plugin-proposal-class-properties/test/fixtures/regression/T6719/options.json b/packages/babel-plugin-proposal-class-properties/test/fixtures/regression/T6719/options.json index 524cdc31421b..d0b48e090623 100644 --- a/packages/babel-plugin-proposal-class-properties/test/fixtures/regression/T6719/options.json +++ b/packages/babel-plugin-proposal-class-properties/test/fixtures/regression/T6719/options.json @@ -1,6 +1,6 @@ { "plugins": [ - "external-helpers", + ["external-helpers", { "helperVersion": "7.100.0" }], ["proposal-class-properties", { "loose": true }], "transform-classes", "transform-block-scoping", diff --git a/packages/babel-plugin-proposal-class-properties/test/fixtures/regression/T6719/output.js b/packages/babel-plugin-proposal-class-properties/test/fixtures/regression/T6719/output.js index f8aebbe0260b..337ecc232cb2 100644 --- a/packages/babel-plugin-proposal-class-properties/test/fixtures/regression/T6719/output.js +++ b/packages/babel-plugin-proposal-class-properties/test/fixtures/regression/T6719/output.js @@ -1,16 +1,16 @@ function withContext(ComposedComponent) { var _class, _temp; - return _temp = _class = - /*#__PURE__*/ - function (_Component) { + return _temp = _class = /*#__PURE__*/function (_Component) { "use strict"; babelHelpers.inherits(WithContext, _Component); + var _super = babelHelpers.createSuper(WithContext); + function WithContext() { babelHelpers.classCallCheck(this, WithContext); - return babelHelpers.possibleConstructorReturn(this, babelHelpers.getPrototypeOf(WithContext).apply(this, arguments)); + return _super.apply(this, arguments); } return WithContext; diff --git a/packages/babel-plugin-proposal-class-properties/test/fixtures/regression/T7364/output.mjs b/packages/babel-plugin-proposal-class-properties/test/fixtures/regression/T7364/output.mjs index 1fa6373e31ce..24c39cad22bd 100644 --- a/packages/babel-plugin-proposal-class-properties/test/fixtures/regression/T7364/output.mjs +++ b/packages/babel-plugin-proposal-class-properties/test/fixtures/regression/T7364/output.mjs @@ -2,9 +2,7 @@ class MyClass { constructor() { var _this = this; - this.myAsyncMethod = - /*#__PURE__*/ - babelHelpers.asyncToGenerator(function* () { + this.myAsyncMethod = /*#__PURE__*/babelHelpers.asyncToGenerator(function* () { console.log(_this); }); } @@ -15,9 +13,7 @@ class MyClass { constructor() { var _this2 = this; - this.myAsyncMethod = - /*#__PURE__*/ - babelHelpers.asyncToGenerator(function* () { + this.myAsyncMethod = /*#__PURE__*/babelHelpers.asyncToGenerator(function* () { console.log(_this2); }); } @@ -28,9 +24,7 @@ export default class MyClass3 { constructor() { var _this3 = this; - this.myAsyncMethod = - /*#__PURE__*/ - babelHelpers.asyncToGenerator(function* () { + this.myAsyncMethod = /*#__PURE__*/babelHelpers.asyncToGenerator(function* () { console.log(_this3); }); } diff --git a/packages/babel-plugin-proposal-class-properties/test/fixtures/static-property-tdz/decorator-interop/output.js b/packages/babel-plugin-proposal-class-properties/test/fixtures/static-property-tdz/decorator-interop/output.js index 2cd978b722c9..83a51c068110 100644 --- a/packages/babel-plugin-proposal-class-properties/test/fixtures/static-property-tdz/decorator-interop/output.js +++ b/packages/babel-plugin-proposal-class-properties/test/fixtures/static-property-tdz/decorator-interop/output.js @@ -12,13 +12,11 @@ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _d function _applyDecoratedDescriptor(target, property, decorators, descriptor, context) { var desc = {}; Object.keys(descriptor).forEach(function (key) { desc[key] = descriptor[key]; }); desc.enumerable = !!desc.enumerable; desc.configurable = !!desc.configurable; if ('value' in desc || desc.initializer) { desc.writable = true; } desc = decorators.slice().reverse().reduce(function (desc, decorator) { return decorator(target, property, desc) || desc; }, desc); if (context && desc.initializer !== void 0) { desc.value = desc.initializer ? desc.initializer.call(context) : void 0; desc.initializer = undefined; } if (desc.initializer === void 0) { Object.defineProperty(target, property, desc); desc = null; } return desc; } -function _initializerWarningHelper(descriptor, context) { throw new Error('Decorating class property failed. Please ensure that ' + 'proposal-class-properties is enabled and set to use loose mode. ' + 'To use proposal-class-properties in spec mode with decorators, wait for ' + 'the next major version of decorators in stage 2.'); } +function _initializerWarningHelper(descriptor, context) { throw new Error('Decorating class property failed. Please ensure that ' + 'proposal-class-properties is enabled and runs after the decorators transform.'); } function dec() {} -let A = (_class = (_temp = (_Symbol$search = Symbol.search, -/*#__PURE__*/ -function () { +let A = (_class = (_temp = (_Symbol$search = Symbol.search, /*#__PURE__*/function () { "use strict"; function A() { diff --git a/packages/babel-plugin-proposal-decorators/package.json b/packages/babel-plugin-proposal-decorators/package.json index bc14d4ebea01..38640821c184 100644 --- a/packages/babel-plugin-proposal-decorators/package.json +++ b/packages/babel-plugin-proposal-decorators/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-proposal-decorators", - "version": "7.4.4", + "version": "7.8.3", "author": "Logan Smyth ", "license": "MIT", "publishConfig": { @@ -15,15 +15,15 @@ "decorators" ], "dependencies": { - "@babel/helper-create-class-features-plugin": "^7.4.4", - "@babel/helper-plugin-utils": "^7.0.0", - "@babel/plugin-syntax-decorators": "^7.2.0" + "@babel/helper-create-class-features-plugin": "^7.8.3", + "@babel/helper-plugin-utils": "^7.8.3", + "@babel/plugin-syntax-decorators": "^7.8.3" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.4.4", - "@babel/helper-plugin-test-runner": "^7.0.0" + "@babel/core": "^7.8.3", + "@babel/helper-plugin-test-runner": "^7.8.3" } } diff --git a/packages/babel-plugin-proposal-decorators/src/transformer-legacy.js b/packages/babel-plugin-proposal-decorators/src/transformer-legacy.js index 0eb0ebdbd87a..ca23bad24824 100644 --- a/packages/babel-plugin-proposal-decorators/src/transformer-legacy.js +++ b/packages/babel-plugin-proposal-decorators/src/transformer-legacy.js @@ -237,7 +237,7 @@ export default { const replacement = decoratedClassToExpression(decl); if (replacement) { - path.replaceWithMultiple([ + const [varDeclPath] = path.replaceWithMultiple([ replacement, t.exportNamedDeclaration(null, [ t.exportSpecifier( @@ -246,6 +246,10 @@ export default { ), ]), ]); + + if (!decl.node.id) { + path.scope.registerDeclaration(varDeclPath); + } } }, ClassDeclaration(path) { @@ -277,10 +281,33 @@ export default { path.replaceWith( t.callExpression(state.addHelper("initializerDefineProperty"), [ t.cloneNode(path.get("left.object").node), - t.stringLiteral(path.get("left.property").node.name), + t.stringLiteral( + path.get("left.property").node.name || + path.get("left.property").node.value, + ), t.cloneNode(path.get("right.arguments")[0].node), t.cloneNode(path.get("right.arguments")[1].node), ]), ); }, + + CallExpression(path, state) { + if (path.node.arguments.length !== 3) return; + if (!WARNING_CALLS.has(path.node.arguments[2])) return; + + // If the class properties plugin isn't enabled, this line will add an unused helper + // to the code. It's not ideal, but it's ok since the configuration is not valid anyway. + if (path.node.callee.name !== state.addHelper("defineProperty").name) { + return; + } + + path.replaceWith( + t.callExpression(state.addHelper("initializerDefineProperty"), [ + t.cloneNode(path.get("arguments")[0].node), + t.cloneNode(path.get("arguments")[1].node), + t.cloneNode(path.get("arguments.2.arguments")[0].node), + t.cloneNode(path.get("arguments.2.arguments")[1].node), + ]), + ); + }, }; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/legacy-class-prototype-properties/string-literal-properties/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/legacy-class-prototype-properties/string-literal-properties/exec.js new file mode 100644 index 000000000000..c3e4ca274083 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/legacy-class-prototype-properties/string-literal-properties/exec.js @@ -0,0 +1,29 @@ +function dec(target, name, descriptor) { + expect(target).toBeTruthy(); + expect(typeof name).toBe("string"); + expect(typeof descriptor).toBe("object"); + + target.decoratedProps = (target.decoratedProps || []).concat([name]); + + return descriptor; +} + +class Example { + @dec "a-prop"; +} + +let inst = new Example(); + +expect(Example.prototype).toHaveProperty("decoratedProps"); +expect(inst.decoratedProps).toEqual([ + "a-prop" +]); + +expect(inst).toHaveProperty("a-prop"); +expect(inst["a-prop"]).toBeUndefined(); + +const descs = Object.getOwnPropertyDescriptors(inst); + +expect(descs["a-prop"].enumerable).toBeTruthy(); +expect(descs["a-prop"].writable).toBeTruthy(); +expect(descs["a-prop"].configurable).toBeTruthy(); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/legacy-regression/10264/input.mjs b/packages/babel-plugin-proposal-decorators/test/fixtures/legacy-regression/10264/input.mjs new file mode 100644 index 000000000000..90ba5e106f57 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/legacy-regression/10264/input.mjs @@ -0,0 +1,4 @@ +function myDecorator(decoratee) {} + +@myDecorator +export default class {} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/legacy-regression/10264/options.json b/packages/babel-plugin-proposal-decorators/test/fixtures/legacy-regression/10264/options.json new file mode 100644 index 000000000000..ee996d3cfc6f --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/legacy-regression/10264/options.json @@ -0,0 +1,6 @@ +{ + "plugins": [ + "transform-typescript", + ["proposal-decorators", { "legacy": true }] + ] +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/legacy-regression/10264/output.mjs b/packages/babel-plugin-proposal-decorators/test/fixtures/legacy-regression/10264/output.mjs new file mode 100644 index 000000000000..5e99551db44a --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/legacy-regression/10264/output.mjs @@ -0,0 +1,7 @@ +var _class2; + +function myDecorator(decoratee) {} + +let _class = myDecorator(_class2 = class {}) || _class2; + +export { _class as default }; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/legacy-regression/7030/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/legacy-regression/7030/output.js index 3ecd37c2f8d2..9cfd2be63cad 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/legacy-regression/7030/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/legacy-regression/7030/output.js @@ -1,16 +1,20 @@ -function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } +function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } + +function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } + +function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function () { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } + function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } -function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } +function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } - -function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } +function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } function generateAsyncAction(type) { type = type.toUpperCase(); @@ -25,19 +29,19 @@ function generateAsyncAction(type) { return request; } -var A = -/*#__PURE__*/ -function (_B) { +var A = /*#__PURE__*/function (_B) { "use strict"; _inherits(A, _B); + var _super = _createSuper(A); + function A(timestamp) { var _this; _classCallCheck(this, A); - _this = _possibleConstructorReturn(this, _getPrototypeOf(A).call(this)); + _this = _super.call(this); _this.timestamp = timestamp; _this.moment = moment(timestamp); return _this; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/transformation/async-generator-method/options.json b/packages/babel-plugin-proposal-decorators/test/fixtures/transformation/async-generator-method/options.json index a3587a401c6c..0c2c9bd2056d 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/transformation/async-generator-method/options.json +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/transformation/async-generator-method/options.json @@ -2,7 +2,6 @@ "plugins": [ ["proposal-decorators", { "decoratorsBeforeExport": false }], "proposal-class-properties", - "syntax-async-generators", ["external-helpers", { "helperVersion": "7.1.5" }] ] } diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/transformation/class-decorators-yield-await/options.json b/packages/babel-plugin-proposal-decorators/test/fixtures/transformation/class-decorators-yield-await/options.json index 7879b5a6675a..0fbe73eecd01 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/transformation/class-decorators-yield-await/options.json +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/transformation/class-decorators-yield-await/options.json @@ -7,7 +7,6 @@ { "helperVersion": "7.1.5" } - ], - "syntax-async-generators" + ] ] } diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/transformation/extends-await/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/transformation/extends-await/output.js index 707d6439237a..298e8ae7e58a 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/transformation/extends-await/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/transformation/extends-await/output.js @@ -1,8 +1,8 @@ async function g() { - let A = babelHelpers.decorate([dec], function (_initialize, _super) { + let A = babelHelpers.decorate([dec], function (_initialize, _await$B) { "use strict"; - class A extends _super { + class A extends _await$B { constructor(...args) { super(...args); @@ -15,5 +15,5 @@ async function g() { F: A, d: [] }; - }, (await B)); + }, await B); } diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/transformation/extends-yield/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/transformation/extends-yield/output.js index 2ccc1e94acea..70ef16da8901 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/transformation/extends-yield/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/transformation/extends-yield/output.js @@ -1,8 +1,8 @@ function* g() { - let A = babelHelpers.decorate([dec], function (_initialize, _super) { + let A = babelHelpers.decorate([dec], function (_initialize, _yield$B) { "use strict"; - class A extends _super { + class A extends _yield$B { constructor(...args) { super(...args); @@ -15,5 +15,5 @@ function* g() { F: A, d: [] }; - }, (yield B)); + }, yield B); } diff --git a/packages/babel-plugin-proposal-do-expressions/package.json b/packages/babel-plugin-proposal-do-expressions/package.json index 8293f38f0326..caed351d0116 100644 --- a/packages/babel-plugin-proposal-do-expressions/package.json +++ b/packages/babel-plugin-proposal-do-expressions/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-proposal-do-expressions", - "version": "7.5.0", + "version": "7.8.3", "description": "Compile do expressions to ES5", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-proposal-do-expressions", "license": "MIT", @@ -12,14 +12,14 @@ "babel-plugin" ], "dependencies": { - "@babel/helper-plugin-utils": "^7.0.0", - "@babel/plugin-syntax-do-expressions": "^7.2.0" + "@babel/helper-plugin-utils": "^7.8.3", + "@babel/plugin-syntax-do-expressions": "^7.8.3" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.5.0", - "@babel/helper-plugin-test-runner": "^7.0.0" + "@babel/core": "^7.8.3", + "@babel/helper-plugin-test-runner": "^7.8.3" } } diff --git a/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/.fallthrough-multiblock/exec.js b/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/.fallthrough-multiblock/exec.js new file mode 100644 index 000000000000..3811a50b2494 --- /dev/null +++ b/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/.fallthrough-multiblock/exec.js @@ -0,0 +1,36 @@ +// `blockExpressions` before `break` is hard to deal with +// https://github.com/babel/babel/pull/10070#discussion_r296048106 +const x = (n) => do { + switch (n) { + case 0: + { "a"; } + { "b"; }; + case 1: + { "c"; } + break; + { "d"; }; + case 2: + "a"; + "b"; + case 3: + {} + { break; } + case 4: + { "d"; } + { "e"; } + case 5: + "f"; + case 6: + {} + case 7: + } +} + +expect(x(0)).toBe('c') +expect(x(1)).toBe('c') +expect(x(2)).toBeUndefined() +expect(x(3)).toBeUndefined() +expect(x(4)).toBe('f') +expect(x(5)).toBe('f') +expect(x(6)).toBeUndefined() +expect(x(7)).toBeUndefined() diff --git a/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/.fallthrough-multiblock/input.js b/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/.fallthrough-multiblock/input.js new file mode 100644 index 000000000000..adda24b703d1 --- /dev/null +++ b/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/.fallthrough-multiblock/input.js @@ -0,0 +1,25 @@ +const x = (n) => do { + switch (n) { + case 0: + { "a"; } + { "b"; }; + case 1: + { "c"; } + break; + { "d"; }; + case 2: + "a"; + "b"; + case 3: + {} + { break; } + case 4: + { "a"; } + { "b"; } + case 5: + "c"; + case 6: + {} + case 7: + } +} \ No newline at end of file diff --git a/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/declaration-before-break/input.js b/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/declaration-before-break/input.js new file mode 100644 index 000000000000..3e64d8911875 --- /dev/null +++ b/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/declaration-before-break/input.js @@ -0,0 +1,9 @@ +const x = (n) => do { + switch (n) { + case 0: + case 6: + const b = 1; + break; + default: 'bar'; + } +} diff --git a/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/declaration-before-break/output.js b/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/declaration-before-break/output.js new file mode 100644 index 000000000000..a438311f5e24 --- /dev/null +++ b/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/declaration-before-break/output.js @@ -0,0 +1,11 @@ +const x = n => function () { + switch (n) { + case 0: + case 6: + const b = 1; + return void 0; + + default: + return 'bar'; + } +}(); diff --git a/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/empty-case-block/input.js b/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/empty-case-block/input.js new file mode 100644 index 000000000000..920878526152 --- /dev/null +++ b/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/empty-case-block/input.js @@ -0,0 +1,7 @@ +const x = () => do { + switch (new Date().getDay()) { + case 0: + break; + default: "weekday 🚴" + } +} diff --git a/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/empty-case-block/output.js b/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/empty-case-block/output.js new file mode 100644 index 000000000000..15fb9f3537ff --- /dev/null +++ b/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/empty-case-block/output.js @@ -0,0 +1,9 @@ +const x = () => function () { + switch (new Date().getDay()) { + case 0: + return void 0; + + default: + return "weekday 🚴"; + } +}(); diff --git a/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/fallthrough-block-last/exec.js b/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/fallthrough-block-last/exec.js new file mode 100644 index 000000000000..395fdf6f0538 --- /dev/null +++ b/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/fallthrough-block-last/exec.js @@ -0,0 +1,26 @@ +const x = (n) => do { + switch (n) { + case 0: { + 'a'; + } + case 1: { + 'b'; + break; + } + default: { + 'd'; + } + case 2: { + 'c'; + } + case 3: + case 4: + } +} + +expect(x(0)).toBe('b'); +expect(x(1)).toBe('b'); +expect(x(2)).toBe('c'); +expect(x(3)).toBeUndefined(); +expect(x(4)).toBeUndefined(); +expect(x(5)).toBe('c'); \ No newline at end of file diff --git a/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/fallthrough-block-last/input.js b/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/fallthrough-block-last/input.js new file mode 100644 index 000000000000..e9c30a6b4550 --- /dev/null +++ b/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/fallthrough-block-last/input.js @@ -0,0 +1,19 @@ +const x = (n) => do { + switch (n) { + case 0: { + 'a'; + } + case 1: { + 'b'; + break; + } + default: { + 'd'; + } + case 2: { + 'c'; + } + case 3: + case 4: + } +} \ No newline at end of file diff --git a/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/fallthrough-block-last/output.js b/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/fallthrough-block-last/output.js new file mode 100644 index 000000000000..91f6ebcdc15c --- /dev/null +++ b/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/fallthrough-block-last/output.js @@ -0,0 +1,26 @@ +const x = n => function () { + switch (n) { + case 0: + { + 'a'; + } + + case 1: + { + return 'b'; + } + + default: + { + 'd'; + } + + case 2: + { + return 'c'; + } + + case 3: + case 4: + } +}(); diff --git a/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/fallthrough-block/exec.js b/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/fallthrough-block/exec.js new file mode 100644 index 000000000000..f9593ecc8cdb --- /dev/null +++ b/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/fallthrough-block/exec.js @@ -0,0 +1,30 @@ +const x = (n) => do { + switch (n) { + case 0: { + 'a'; + } + case 1: { + 'b'; + break; + } + case 2: { + 'c'; + break; + } + case 3: { + break; + } + case 4: { + 'd'; + 'e'; + } + default: 'f'; + } +} + +expect(x(0)).toBe('b'); +expect(x(1)).toBe('b'); +expect(x(2)).toBe('c'); +expect(x(3)).toBeUndefined(); +expect(x(4)).toBe('f'); +expect(x(5)).toBe('f'); \ No newline at end of file diff --git a/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/fallthrough-block/input.js b/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/fallthrough-block/input.js new file mode 100644 index 000000000000..768140a79198 --- /dev/null +++ b/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/fallthrough-block/input.js @@ -0,0 +1,23 @@ +const x = (n) => do { + switch (n) { + case 0: { + 'a'; + } + case 1: { + 'b'; + break; + } + case 2: { + 'c'; + break; + } + case 3: { + break; + } + case 4: { + 'd'; + 'e'; + } + default: 'f'; + } +} \ No newline at end of file diff --git a/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/fallthrough-block/output.js b/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/fallthrough-block/output.js new file mode 100644 index 000000000000..4bf150750242 --- /dev/null +++ b/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/fallthrough-block/output.js @@ -0,0 +1,30 @@ +const x = n => function () { + switch (n) { + case 0: + { + 'a'; + } + + case 1: + { + return 'b'; + } + + case 2: + { + return 'c'; + } + + case 3: + return void 0; + + case 4: + { + 'd'; + 'e'; + } + + default: + return 'f'; + } +}(); diff --git a/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/fallthrough-last/exec.js b/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/fallthrough-last/exec.js new file mode 100644 index 000000000000..f1a689aa3e1a --- /dev/null +++ b/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/fallthrough-last/exec.js @@ -0,0 +1,21 @@ +const x = (n) => do { + switch (n) { + case 0: + 'a'; + case 1: + 'b'; + break; + default: 'd'; + case 2: + 'c'; + case 3: + case 4: + } +} + +expect(x(0)).toBe('b'); +expect(x(1)).toBe('b'); +expect(x(2)).toBe('c'); +expect(x(3)).toBeUndefined(); +expect(x(4)).toBeUndefined(); +expect(x(5)).toBe('c'); \ No newline at end of file diff --git a/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/fallthrough-last/input.js b/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/fallthrough-last/input.js new file mode 100644 index 000000000000..0c432fe07022 --- /dev/null +++ b/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/fallthrough-last/input.js @@ -0,0 +1,14 @@ +const x = (n) => do { + switch (n) { + case 0: + 'a'; + case 1: + 'b'; + break; + default: 'd'; + case 2: + 'c'; + case 3: + case 4: + } +} \ No newline at end of file diff --git a/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/fallthrough-last/output.js b/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/fallthrough-last/output.js new file mode 100644 index 000000000000..85bec17a0cda --- /dev/null +++ b/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/fallthrough-last/output.js @@ -0,0 +1,18 @@ +const x = n => function () { + switch (n) { + case 0: + 'a'; + + case 1: + return 'b'; + + default: + 'd'; + + case 2: + return 'c'; + + case 3: + case 4: + } +}(); diff --git a/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/fallthrough/exec.js b/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/fallthrough/exec.js new file mode 100644 index 000000000000..6531d426eca8 --- /dev/null +++ b/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/fallthrough/exec.js @@ -0,0 +1,25 @@ +const x = (n) => do { + switch (n) { + case 0: + 'a'; + case 1: + 'b'; + break; + case 2: + 'c'; + break; + case 3: + break; + case 4: + 'd'; + 'e'; + default: 'f'; + } +} + +expect(x(0)).toBe('b'); +expect(x(1)).toBe('b'); +expect(x(2)).toBe('c'); +expect(x(3)).toBeUndefined(); +expect(x(4)).toBe('f'); +expect(x(5)).toBe('f'); diff --git a/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/fallthrough/input.js b/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/fallthrough/input.js new file mode 100644 index 000000000000..ea14170edc44 --- /dev/null +++ b/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/fallthrough/input.js @@ -0,0 +1,18 @@ +const x = (n) => do { + switch (n) { + case 0: + 'a'; + case 1: + 'b'; + break; + case 2: + 'c'; + break; + case 3: + break; + case 4: + 'd'; + 'e'; + default: 'f'; + } +} \ No newline at end of file diff --git a/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/fallthrough/output.js b/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/fallthrough/output.js new file mode 100644 index 000000000000..a006d36deea8 --- /dev/null +++ b/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/fallthrough/output.js @@ -0,0 +1,22 @@ +const x = n => function () { + switch (n) { + case 0: + 'a'; + + case 1: + return 'b'; + + case 2: + return 'c'; + + case 3: + return void 0; + + case 4: + 'd'; + 'e'; + + default: + return 'f'; + } +}(); diff --git a/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/multi-consequent-multiblock/exec.js b/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/multi-consequent-multiblock/exec.js new file mode 100644 index 000000000000..da1fb5e8764b --- /dev/null +++ b/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/multi-consequent-multiblock/exec.js @@ -0,0 +1,36 @@ +const x = (n) => do { + switch (n) { + case 0: + { "a"; } + { break; } + { "b"; }; + case 1: + { "a"; } + break; + { "b"; }; + case 2: + "a"; + { break; } + "b"; + case 3: + "a"; + { "b"; break; } + { "c"; } + case 4: + { "a"; } + { "b"; } + { "c"; break; "d" } + { "e"; break; "f" } + case 5: + { "a"; } + { break; "b"; } + { break; "c"; } + } +} + +expect(x(0)).toBe('a') +expect(x(1)).toBe('a') +expect(x(2)).toBe('a') +expect(x(3)).toBe('b') +expect(x(4)).toBe('c') +expect(x(5)).toBe('a') diff --git a/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/multi-consequent-multiblock/input.js b/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/multi-consequent-multiblock/input.js new file mode 100644 index 000000000000..f038e3b27b39 --- /dev/null +++ b/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/multi-consequent-multiblock/input.js @@ -0,0 +1,29 @@ +const x = (n) => do { + switch (n) { + case 0: + { "a"; } + { break; } + { "b"; }; + case 1: + { "a"; } + break; + { "b"; }; + case 2: + "a"; + { break; } + "b"; + case 3: + "a"; + { "b"; break; } + { "c"; } + case 4: + { "a"; } + { "b"; } + { "c"; break; "d" } + { "e"; break; "f" } + case 5: + { "a"; } + { break; "b"; } + { break; "c"; } + } +} \ No newline at end of file diff --git a/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/multi-consequent-multiblock/output.js b/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/multi-consequent-multiblock/output.js new file mode 100644 index 000000000000..a51ac54ca308 --- /dev/null +++ b/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/multi-consequent-multiblock/output.js @@ -0,0 +1,60 @@ +const x = n => function () { + switch (n) { + case 0: + { + return "a"; + } + { + "b"; + } + ; + + case 1: + { + return "a"; + } + { + "b"; + } + ; + + case 2: + return "a"; + "b"; + + case 3: + "a"; + { + return "b"; + } + { + "c"; + } + + case 4: + { + "a"; + } + { + "b"; + } + { + return "c"; + "d"; + } + { + "e"; + break; + "f"; + } + + case 5: + { + return "a"; + } + { + break; + "c"; + } + } +}(); diff --git a/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/multiple-break/exec.js b/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/multiple-break/exec.js new file mode 100644 index 000000000000..5ae85c2392e4 --- /dev/null +++ b/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/multiple-break/exec.js @@ -0,0 +1,19 @@ +const x = (n) => do { + switch (n) { + case 0: + 'a'; + break; + 'b'; + 'c'; + break; + 'd'; + case 6: + 'e'; + default: + 'f' + } +} + +expect(x(0)).toBe('a'); +expect(x(1)).toBe('f'); +expect(x(6)).toBe('f'); \ No newline at end of file diff --git a/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/multiple-break/input.js b/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/multiple-break/input.js new file mode 100644 index 000000000000..fd57351fe300 --- /dev/null +++ b/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/multiple-break/input.js @@ -0,0 +1,15 @@ +const x = (n) => do { + switch (n) { + case 0: + 'a'; + break; + 'b'; + 'c'; + break; + 'd'; + case 6: + 'e'; + default: + 'f' + } +} diff --git a/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/multiple-break/output.js b/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/multiple-break/output.js new file mode 100644 index 000000000000..36f4c4abcb8b --- /dev/null +++ b/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/multiple-break/output.js @@ -0,0 +1,16 @@ +const x = n => function () { + switch (n) { + case 0: + return 'a'; + 'b'; + 'c'; + break; + 'd'; + + case 6: + 'e'; + + default: + return 'f'; + } +}(); diff --git a/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/multiple-consequent-block/exec.js b/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/multiple-consequent-block/exec.js new file mode 100644 index 000000000000..0a2bce023197 --- /dev/null +++ b/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/multiple-consequent-block/exec.js @@ -0,0 +1,32 @@ +const x = (n) => do { + switch (n) { + case 0: { + 'a'; + break; + } + case 1: { + 'b'; + break; + 'c'; + break; + 'd'; + } + case 2: { + 'e'; + const a = 'e'; + break; + } + case 3: { + const a = 'f'; + break; + 'f'; + } + default: 'g'; + } +} + +expect(x(0)).toBe('a'); +expect(x(1)).toBe('b'); +expect(x(2)).toBeUndefined(); +expect(x(3)).toBeUndefined(); +expect(x(4)).toBe('g'); \ No newline at end of file diff --git a/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/multiple-consequent-block/input.js b/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/multiple-consequent-block/input.js new file mode 100644 index 000000000000..d859f871f276 --- /dev/null +++ b/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/multiple-consequent-block/input.js @@ -0,0 +1,27 @@ +const x = (n) => do { + switch (n) { + case 0: { + get(); + 'a'; + break; + } + case 1: { + 'b'; + break; + 'c'; + break; + 'd'; + } + case 2: { + 'e'; + const a = 'e'; + break; + } + case 3: { + const a = 'f'; + break; + 'f'; + } + default: 'g'; + } +} diff --git a/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/multiple-consequent-block/output.js b/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/multiple-consequent-block/output.js new file mode 100644 index 000000000000..b5d77d0ff7cd --- /dev/null +++ b/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/multiple-consequent-block/output.js @@ -0,0 +1,34 @@ +const x = n => function () { + switch (n) { + case 0: + { + get(); + return 'a'; + } + + case 1: + { + return 'b'; + 'c'; + break; + 'd'; + } + + case 2: + { + 'e'; + const a = 'e'; + return void 0; + } + + case 3: + { + const a = 'f'; + return void 0; + 'f'; + } + + default: + return 'g'; + } +}(); diff --git a/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/multiple-consequent/input.js b/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/multiple-consequent/input.js new file mode 100644 index 000000000000..5ef4ca35d4cc --- /dev/null +++ b/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/multiple-consequent/input.js @@ -0,0 +1,9 @@ +const x = () => do { + switch (new Date().getDay()) { + case 0: + get(); + 1+1; + break; + default: "weekday 🚴" + } +} diff --git a/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/multiple-consequent/output.js b/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/multiple-consequent/output.js new file mode 100644 index 000000000000..ad928a82a82d --- /dev/null +++ b/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/multiple-consequent/output.js @@ -0,0 +1,10 @@ +const x = () => function () { + switch (new Date().getDay()) { + case 0: + get(); + return 1 + 1; + + default: + return "weekday 🚴"; + } +}(); diff --git a/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/options.json b/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/options.json new file mode 100644 index 000000000000..96d2eb705b15 --- /dev/null +++ b/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["proposal-do-expressions"] +} diff --git a/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/single-consequent-block/exec.js b/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/single-consequent-block/exec.js new file mode 100644 index 000000000000..bfb6d498243b --- /dev/null +++ b/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/single-consequent-block/exec.js @@ -0,0 +1,13 @@ +const x = (n) => do { + switch (n) { + case 0: case 6: { + "weekend 🚵"; + break; + } + default: "weekday 🚴" + } +} + +expect(x(0)).toBe('weekend 🚵') +expect(x(1)).toBe('weekday 🚴') +expect(x(6)).toBe('weekend 🚵') \ No newline at end of file diff --git a/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/single-consequent-block/input.js b/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/single-consequent-block/input.js new file mode 100644 index 000000000000..8f41efb7ea45 --- /dev/null +++ b/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/single-consequent-block/input.js @@ -0,0 +1,9 @@ +const x = (n) => do { + switch (n) { + case 0: case 6: { + "weekend 🚵"; + break; + } + default: "weekday 🚴" + } +} diff --git a/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/single-consequent-block/output.js b/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/single-consequent-block/output.js new file mode 100644 index 000000000000..12d69e7a3448 --- /dev/null +++ b/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/single-consequent-block/output.js @@ -0,0 +1,12 @@ +const x = n => function () { + switch (n) { + case 0: + case 6: + { + return "weekend 🚵"; + } + + default: + return "weekday 🚴"; + } +}(); diff --git a/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/single-consequent/exec.js b/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/single-consequent/exec.js new file mode 100644 index 000000000000..c48058f0b36d --- /dev/null +++ b/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/single-consequent/exec.js @@ -0,0 +1,10 @@ +const x = (n) => do { + switch (n) { + case 0: case 6: "weekend 🚵"; break + default: "weekday 🚴" + } +} + +expect(x(0)).toBe('weekend 🚵') +expect(x(1)).toBe('weekday 🚴') +expect(x(6)).toBe('weekend 🚵') \ No newline at end of file diff --git a/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/single-consequent/input.js b/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/single-consequent/input.js new file mode 100644 index 000000000000..e3012915a365 --- /dev/null +++ b/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/single-consequent/input.js @@ -0,0 +1,6 @@ +const x = (n) => do { + switch (n) { + case 0: case 6: "weekend 🚵"; break + default: "weekday 🚴" + } +} diff --git a/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/single-consequent/output.js b/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/single-consequent/output.js new file mode 100644 index 000000000000..2c7f6486cefc --- /dev/null +++ b/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/single-consequent/output.js @@ -0,0 +1,10 @@ +const x = n => function () { + switch (n) { + case 0: + case 6: + return "weekend 🚵"; + + default: + return "weekday 🚴"; + } +}(); diff --git a/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expressions/await/options.json b/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expressions/await/options.json index 7edb6d2fc815..2454c2169cf8 100644 --- a/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expressions/await/options.json +++ b/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expressions/await/options.json @@ -1,3 +1,3 @@ { "minNodeVersion": "8.0.0" -} \ No newline at end of file +} diff --git a/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expressions/finally-block/input.js b/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expressions/finally-block/input.js new file mode 100644 index 000000000000..8827149f32f9 --- /dev/null +++ b/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expressions/finally-block/input.js @@ -0,0 +1,9 @@ +const x = do { + try { + a(); + } catch (e) { + b(); + } finally { + c(); + } +} diff --git a/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expressions/finally-block/options.json b/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expressions/finally-block/options.json new file mode 100644 index 000000000000..116249a4f7a7 --- /dev/null +++ b/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expressions/finally-block/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["transform-block-scoping", "proposal-do-expressions"] +} diff --git a/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expressions/finally-block/output.js b/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expressions/finally-block/output.js new file mode 100644 index 000000000000..22a29ec91b8b --- /dev/null +++ b/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expressions/finally-block/output.js @@ -0,0 +1,9 @@ +var x = function () { + try { + return a(); + } catch (e) { + return b(); + } finally { + c(); + } +}(); diff --git a/packages/babel-plugin-proposal-dynamic-import/package.json b/packages/babel-plugin-proposal-dynamic-import/package.json index a691155641e4..48853a52b62a 100644 --- a/packages/babel-plugin-proposal-dynamic-import/package.json +++ b/packages/babel-plugin-proposal-dynamic-import/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-proposal-dynamic-import", - "version": "7.5.0", + "version": "7.8.3", "description": "Transform import() expressions", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-proposal-dynamic-import", "license": "MIT", @@ -12,14 +12,14 @@ "babel-plugin" ], "dependencies": { - "@babel/helper-plugin-utils": "^7.0.0", - "@babel/plugin-syntax-dynamic-import": "^7.2.0" + "@babel/helper-plugin-utils": "^7.8.3", + "@babel/plugin-syntax-dynamic-import": "^7.8.0" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.5.0", - "@babel/helper-plugin-test-runner": "^7.0.0" + "@babel/core": "^7.8.3", + "@babel/helper-plugin-test-runner": "^7.8.3" } } diff --git a/packages/babel-plugin-proposal-dynamic-import/test/fixtures/amd/missing-plugin/options.json b/packages/babel-plugin-proposal-dynamic-import/test/fixtures/amd/missing-plugin/options.json index 97137d02166f..2a0c361b6895 100644 --- a/packages/babel-plugin-proposal-dynamic-import/test/fixtures/amd/missing-plugin/options.json +++ b/packages/babel-plugin-proposal-dynamic-import/test/fixtures/amd/missing-plugin/options.json @@ -1,6 +1,5 @@ { "plugins": [ - "syntax-dynamic-import", "transform-modules-amd", "external-helpers" ] diff --git a/packages/babel-plugin-proposal-dynamic-import/test/fixtures/commonjs/exec-interop-null/exec.js b/packages/babel-plugin-proposal-dynamic-import/test/fixtures/commonjs/exec-interop-null/exec.js new file mode 100644 index 000000000000..a1d2711151d0 --- /dev/null +++ b/packages/babel-plugin-proposal-dynamic-import/test/fixtures/commonjs/exec-interop-null/exec.js @@ -0,0 +1,3 @@ +return import("./mod.js").then(({ default: def }) => { + expect(def).toBe(null); +}); diff --git a/packages/babel-plugin-proposal-dynamic-import/test/fixtures/commonjs/exec-interop-null/mod.js b/packages/babel-plugin-proposal-dynamic-import/test/fixtures/commonjs/exec-interop-null/mod.js new file mode 100644 index 000000000000..c8a9c8ebee78 --- /dev/null +++ b/packages/babel-plugin-proposal-dynamic-import/test/fixtures/commonjs/exec-interop-null/mod.js @@ -0,0 +1 @@ +module.exports = null; \ No newline at end of file diff --git a/packages/babel-plugin-proposal-dynamic-import/test/fixtures/commonjs/exec-interop-null/options.json b/packages/babel-plugin-proposal-dynamic-import/test/fixtures/commonjs/exec-interop-null/options.json new file mode 100644 index 000000000000..eeebc1a57738 --- /dev/null +++ b/packages/babel-plugin-proposal-dynamic-import/test/fixtures/commonjs/exec-interop-null/options.json @@ -0,0 +1,5 @@ +{ + "parserOpts": { + "allowReturnOutsideFunction": true + } +} diff --git a/packages/babel-plugin-proposal-dynamic-import/test/fixtures/commonjs/exec-interop-string/exec.js b/packages/babel-plugin-proposal-dynamic-import/test/fixtures/commonjs/exec-interop-string/exec.js new file mode 100644 index 000000000000..e228b3fbc3a9 --- /dev/null +++ b/packages/babel-plugin-proposal-dynamic-import/test/fixtures/commonjs/exec-interop-string/exec.js @@ -0,0 +1,3 @@ +return import("./mod.js").then(({ default: def }) => { + expect(def).toBe("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8z8BQDwAEhQGAhKmMIQAAAABJRU5ErkJggg=="); +}); diff --git a/packages/babel-plugin-proposal-dynamic-import/test/fixtures/commonjs/exec-interop-string/mod.js b/packages/babel-plugin-proposal-dynamic-import/test/fixtures/commonjs/exec-interop-string/mod.js new file mode 100644 index 000000000000..bfd0466f4c1d --- /dev/null +++ b/packages/babel-plugin-proposal-dynamic-import/test/fixtures/commonjs/exec-interop-string/mod.js @@ -0,0 +1 @@ +module.exports = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8z8BQDwAEhQGAhKmMIQAAAABJRU5ErkJggg=="; \ No newline at end of file diff --git a/packages/babel-plugin-proposal-dynamic-import/test/fixtures/commonjs/exec-interop-string/options.json b/packages/babel-plugin-proposal-dynamic-import/test/fixtures/commonjs/exec-interop-string/options.json new file mode 100644 index 000000000000..eeebc1a57738 --- /dev/null +++ b/packages/babel-plugin-proposal-dynamic-import/test/fixtures/commonjs/exec-interop-string/options.json @@ -0,0 +1,5 @@ +{ + "parserOpts": { + "allowReturnOutsideFunction": true + } +} diff --git a/packages/babel-plugin-proposal-dynamic-import/test/fixtures/commonjs/missing-plugin/options.json b/packages/babel-plugin-proposal-dynamic-import/test/fixtures/commonjs/missing-plugin/options.json index d0f7c55cbaa3..46b55e8254a8 100644 --- a/packages/babel-plugin-proposal-dynamic-import/test/fixtures/commonjs/missing-plugin/options.json +++ b/packages/babel-plugin-proposal-dynamic-import/test/fixtures/commonjs/missing-plugin/options.json @@ -1,6 +1,5 @@ { "plugins": [ - "syntax-dynamic-import", "transform-modules-commonjs", "external-helpers" ] diff --git a/packages/babel-plugin-proposal-dynamic-import/test/fixtures/commonjs/to-string/output.js b/packages/babel-plugin-proposal-dynamic-import/test/fixtures/commonjs/to-string/output.js index 1babb42d8cec..7ec1d85d66b6 100644 --- a/packages/babel-plugin-proposal-dynamic-import/test/fixtures/commonjs/to-string/output.js +++ b/packages/babel-plugin-proposal-dynamic-import/test/fixtures/commonjs/to-string/output.js @@ -1 +1 @@ -Promise.resolve().then(() => babelHelpers.interopRequireWildcard(require(`${2}`))); +Promise.resolve(`${2}`).then(s => babelHelpers.interopRequireWildcard(require(s))); diff --git a/packages/babel-plugin-proposal-dynamic-import/test/fixtures/systemjs/missing-plugin/options.json b/packages/babel-plugin-proposal-dynamic-import/test/fixtures/systemjs/missing-plugin/options.json index c4fe39793abd..28922079e566 100644 --- a/packages/babel-plugin-proposal-dynamic-import/test/fixtures/systemjs/missing-plugin/options.json +++ b/packages/babel-plugin-proposal-dynamic-import/test/fixtures/systemjs/missing-plugin/options.json @@ -1,6 +1,6 @@ { + "validateLogs": true, "plugins": [ - "syntax-dynamic-import", "transform-modules-systemjs", "external-helpers" ] diff --git a/packages/babel-plugin-proposal-dynamic-import/test/fixtures/systemjs/missing-plugin/stderr.txt b/packages/babel-plugin-proposal-dynamic-import/test/fixtures/systemjs/missing-plugin/stderr.txt new file mode 100644 index 000000000000..6a64047d50bc --- /dev/null +++ b/packages/babel-plugin-proposal-dynamic-import/test/fixtures/systemjs/missing-plugin/stderr.txt @@ -0,0 +1,3 @@ +WARNING: Dynamic import() transformation must be enabled using the + @babel/plugin-proposal-dynamic-import plugin. Babel 8 will + no longer transform import() without using that plugin. diff --git a/packages/babel-plugin-proposal-export-default-from/package.json b/packages/babel-plugin-proposal-export-default-from/package.json index 5062421a48ed..a6bd8e3fe4d2 100644 --- a/packages/babel-plugin-proposal-export-default-from/package.json +++ b/packages/babel-plugin-proposal-export-default-from/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-proposal-export-default-from", - "version": "7.5.2", + "version": "7.8.3", "description": "Compile export default to ES2015", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-proposal-export-default-from", "license": "MIT", @@ -12,14 +12,14 @@ "babel-plugin" ], "dependencies": { - "@babel/helper-plugin-utils": "^7.0.0", - "@babel/plugin-syntax-export-default-from": "^7.2.0" + "@babel/helper-plugin-utils": "^7.8.3", + "@babel/plugin-syntax-export-default-from": "^7.8.3" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.2.0", - "@babel/helper-plugin-test-runner": "^7.0.0" + "@babel/core": "^7.8.3", + "@babel/helper-plugin-test-runner": "^7.8.3" } } diff --git a/packages/babel-plugin-proposal-export-namespace-from/package.json b/packages/babel-plugin-proposal-export-namespace-from/package.json index 1f0081f49c38..6221a03cb80b 100644 --- a/packages/babel-plugin-proposal-export-namespace-from/package.json +++ b/packages/babel-plugin-proposal-export-namespace-from/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-proposal-export-namespace-from", - "version": "7.5.2", + "version": "7.8.3", "description": "Compile export namespace to ES2015", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-proposal-export-namespace-from", "license": "MIT", @@ -12,14 +12,14 @@ "babel-plugin" ], "dependencies": { - "@babel/helper-plugin-utils": "^7.0.0", - "@babel/plugin-syntax-export-namespace-from": "^7.2.0" + "@babel/helper-plugin-utils": "^7.8.3", + "@babel/plugin-syntax-export-namespace-from": "^7.8.3" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.2.0", - "@babel/helper-plugin-test-runner": "^7.0.0" + "@babel/core": "^7.8.3", + "@babel/helper-plugin-test-runner": "^7.8.3" } } diff --git a/packages/babel-plugin-proposal-function-bind/package.json b/packages/babel-plugin-proposal-function-bind/package.json index 177ce26ee514..d80c7d5a9227 100644 --- a/packages/babel-plugin-proposal-function-bind/package.json +++ b/packages/babel-plugin-proposal-function-bind/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-proposal-function-bind", - "version": "7.2.0", + "version": "7.8.3", "description": "Compile function bind operator to ES5", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-proposal-function-bind", "license": "MIT", @@ -12,14 +12,14 @@ "babel-plugin" ], "dependencies": { - "@babel/helper-plugin-utils": "^7.0.0", - "@babel/plugin-syntax-function-bind": "^7.2.0" + "@babel/helper-plugin-utils": "^7.8.3", + "@babel/plugin-syntax-function-bind": "^7.8.3" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.2.0", - "@babel/helper-plugin-test-runner": "^7.0.0" + "@babel/core": "^7.8.3", + "@babel/helper-plugin-test-runner": "^7.8.3" } } diff --git a/packages/babel-plugin-proposal-function-bind/test/fixtures/regression/T6984/output.js b/packages/babel-plugin-proposal-function-bind/test/fixtures/regression/T6984/output.js index 6e30a3b425f2..c65c7095591f 100644 --- a/packages/babel-plugin-proposal-function-bind/test/fixtures/regression/T6984/output.js +++ b/packages/babel-plugin-proposal-function-bind/test/fixtures/regression/T6984/output.js @@ -8,9 +8,7 @@ function _one() {} function _two() {} -let Test1 = -/*#__PURE__*/ -function () { +let Test1 = /*#__PURE__*/function () { "use strict"; function Test1() { diff --git a/packages/babel-plugin-proposal-function-sent/package.json b/packages/babel-plugin-proposal-function-sent/package.json index 0ba394b625af..4b5fac4f6f4e 100644 --- a/packages/babel-plugin-proposal-function-sent/package.json +++ b/packages/babel-plugin-proposal-function-sent/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-proposal-function-sent", - "version": "7.5.0", + "version": "7.8.3", "description": "Compile the function.sent meta property to valid ES2015 code", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-proposal-function-sent", "license": "MIT", @@ -12,15 +12,15 @@ "babel-plugin" ], "dependencies": { - "@babel/helper-plugin-utils": "^7.0.0", - "@babel/helper-wrap-function": "^7.2.0", - "@babel/plugin-syntax-function-sent": "^7.2.0" + "@babel/helper-plugin-utils": "^7.8.3", + "@babel/helper-wrap-function": "^7.8.3", + "@babel/plugin-syntax-function-sent": "^7.8.3" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.5.0", - "@babel/helper-plugin-test-runner": "^7.0.0" + "@babel/core": "^7.8.3", + "@babel/helper-plugin-test-runner": "^7.8.3" } } diff --git a/packages/babel-plugin-proposal-function-sent/test/fixtures/generator-kinds/async-generator/output.js b/packages/babel-plugin-proposal-function-sent/test/fixtures/generator-kinds/async-generator/output.js index a05d6843d84e..8bccb5d80c6c 100644 --- a/packages/babel-plugin-proposal-function-sent/test/fixtures/generator-kinds/async-generator/output.js +++ b/packages/babel-plugin-proposal-function-sent/test/fixtures/generator-kinds/async-generator/output.js @@ -4,7 +4,7 @@ function _awaitAsyncGenerator(value) { return new _AwaitValue(value); } function _wrapAsyncGenerator(fn) { return function () { return new _AsyncGenerator(fn.apply(this, arguments)); }; } -function _AsyncGenerator(gen) { var front, back; function send(key, arg) { return new Promise(function (resolve, reject) { var request = { key: key, arg: arg, resolve: resolve, reject: reject, next: null }; if (back) { back = back.next = request; } else { front = back = request; resume(key, arg); } }); } function resume(key, arg) { try { var result = gen[key](arg); var value = result.value; var wrappedAwait = value instanceof _AwaitValue; Promise.resolve(wrappedAwait ? value.wrapped : value).then(function (arg) { if (wrappedAwait) { resume("next", arg); return; } settle(result.done ? "return" : "normal", arg); }, function (err) { resume("throw", err); }); } catch (err) { settle("throw", err); } } function settle(type, value) { switch (type) { case "return": front.resolve({ value: value, done: true }); break; case "throw": front.reject(value); break; default: front.resolve({ value: value, done: false }); break; } front = front.next; if (front) { resume(front.key, front.arg); } else { back = null; } } this._invoke = send; if (typeof gen.return !== "function") { this.return = undefined; } } +function _AsyncGenerator(gen) { var front, back; function send(key, arg) { return new Promise(function (resolve, reject) { var request = { key: key, arg: arg, resolve: resolve, reject: reject, next: null }; if (back) { back = back.next = request; } else { front = back = request; resume(key, arg); } }); } function resume(key, arg) { try { var result = gen[key](arg); var value = result.value; var wrappedAwait = value instanceof _AwaitValue; Promise.resolve(wrappedAwait ? value.wrapped : value).then(function (arg) { if (wrappedAwait) { resume(key === "return" ? "return" : "next", arg); return; } settle(result.done ? "return" : "normal", arg); }, function (err) { resume("throw", err); }); } catch (err) { settle("throw", err); } } function settle(type, value) { switch (type) { case "return": front.resolve({ value: value, done: true }); break; case "throw": front.reject(value); break; default: front.resolve({ value: value, done: false }); break; } front = front.next; if (front) { resume(front.key, front.arg); } else { back = null; } } this._invoke = send; if (typeof gen.return !== "function") { this.return = undefined; } } if (typeof Symbol === "function" && Symbol.asyncIterator) { _AsyncGenerator.prototype[Symbol.asyncIterator] = function () { return this; }; } diff --git a/packages/babel-plugin-proposal-json-strings/package.json b/packages/babel-plugin-proposal-json-strings/package.json index 421ccf784f36..01240a844c50 100644 --- a/packages/babel-plugin-proposal-json-strings/package.json +++ b/packages/babel-plugin-proposal-json-strings/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-proposal-json-strings", - "version": "7.2.0", + "version": "7.8.3", "description": "Escape U+2028 LINE SEPARATOR and U+2029 PARAGRAPH SEPARATOR in JS strings", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-proposal-json-strings", "license": "MIT", @@ -12,14 +12,14 @@ "babel-plugin" ], "dependencies": { - "@babel/helper-plugin-utils": "^7.0.0", - "@babel/plugin-syntax-json-strings": "^7.2.0" + "@babel/helper-plugin-utils": "^7.8.3", + "@babel/plugin-syntax-json-strings": "^7.8.0" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.2.0", - "@babel/helper-plugin-test-runner": "^7.0.0" + "@babel/core": "^7.8.3", + "@babel/helper-plugin-test-runner": "^7.8.3" } } diff --git a/packages/babel-plugin-proposal-logical-assignment-operators/package.json b/packages/babel-plugin-proposal-logical-assignment-operators/package.json index ee5957903079..dd252582fa38 100644 --- a/packages/babel-plugin-proposal-logical-assignment-operators/package.json +++ b/packages/babel-plugin-proposal-logical-assignment-operators/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-proposal-logical-assignment-operators", - "version": "7.2.0", + "version": "7.8.3", "description": "Transforms logical assignment operators into short-circuited assignments", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-proposal-logical-assignment-operators", "license": "MIT", @@ -12,16 +12,16 @@ "babel-plugin" ], "dependencies": { - "@babel/helper-plugin-utils": "^7.0.0", - "@babel/plugin-syntax-logical-assignment-operators": "^7.2.0" + "@babel/helper-plugin-utils": "^7.8.3", + "@babel/plugin-syntax-logical-assignment-operators": "^7.8.3" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.2.0", - "@babel/helper-plugin-test-runner": "^7.0.0", - "@babel/plugin-proposal-nullish-coalescing-operator": "^7.2.0", - "@babel/plugin-syntax-nullish-coalescing-operator": "^7.2.0" + "@babel/core": "^7.8.3", + "@babel/helper-plugin-test-runner": "^7.8.3", + "@babel/plugin-proposal-nullish-coalescing-operator": "^7.8.3", + "@babel/plugin-syntax-nullish-coalescing-operator": "^7.8.0" } } diff --git a/packages/babel-plugin-proposal-logical-assignment-operators/test/fixtures/logical-assignment/general-semantics/output.js b/packages/babel-plugin-proposal-logical-assignment-operators/test/fixtures/logical-assignment/general-semantics/output.js index 04557ad5d8bd..989eb1cd8e46 100644 --- a/packages/babel-plugin-proposal-logical-assignment-operators/test/fixtures/logical-assignment/general-semantics/output.js +++ b/packages/babel-plugin-proposal-logical-assignment-operators/test/fixtures/logical-assignment/general-semantics/output.js @@ -1,4 +1,4 @@ -var _deep$obj, _deep$obj2, _deep$obj3, _deep$obj4, _ref, _ref2, _ref3, _ref4, _deep$obj5, _ref5, _deep$obj6, _ref6, _deep$obj7, _ref7, _deep$obj8, _ref8; +var _deep$obj, _deep$obj2, _deep$obj3, _deep$obj4, _key, _key2, _key3, _key4, _deep$obj5, _key5, _deep$obj6, _key6, _deep$obj7, _key7, _deep$obj8, _key8; var x = 0; var sets = 0; @@ -38,30 +38,30 @@ expect(gets).toBe(3); expect((_deep$obj4 = deep.obj).x && (_deep$obj4.x = 3)).toBe(0); expect(gets).toBe(4); var key = 0; -expect(obj[_ref = ++key] || (obj[_ref] = 1)).toBe(1); +expect(obj[_key = ++key] || (obj[_key] = 1)).toBe(1); expect(key).toBe(1); key = 0; -expect(obj[_ref2 = ++key] || (obj[_ref2] = 2)).toBe(1); +expect(obj[_key2 = ++key] || (obj[_key2] = 2)).toBe(1); expect(key).toBe(1); key = 0; -expect(obj[_ref3 = ++key] && (obj[_ref3] = 0)).toBe(0); +expect(obj[_key3 = ++key] && (obj[_key3] = 0)).toBe(0); expect(key).toBe(1); key = 0; -expect(obj[_ref4 = ++key] && (obj[_ref4] = 3)).toBe(0); +expect(obj[_key4 = ++key] && (obj[_key4] = 3)).toBe(0); expect(key).toBe(1); key = 0; -expect((_deep$obj5 = deep.obj)[_ref5 = ++key] || (_deep$obj5[_ref5] = 1)).toBe(1); +expect((_deep$obj5 = deep.obj)[_key5 = ++key] || (_deep$obj5[_key5] = 1)).toBe(1); expect(gets).toBe(5); expect(key).toBe(1); key = 0; -expect((_deep$obj6 = deep.obj)[_ref6 = ++key] || (_deep$obj6[_ref6] = 2)).toBe(1); +expect((_deep$obj6 = deep.obj)[_key6 = ++key] || (_deep$obj6[_key6] = 2)).toBe(1); expect(gets).toBe(6); expect(key).toBe(1); key = 0; -expect((_deep$obj7 = deep.obj)[_ref7 = ++key] && (_deep$obj7[_ref7] = 0)).toBe(0); +expect((_deep$obj7 = deep.obj)[_key7 = ++key] && (_deep$obj7[_key7] = 0)).toBe(0); expect(gets).toBe(7); expect(key).toBe(1); key = 0; -expect((_deep$obj8 = deep.obj)[_ref8 = ++key] && (_deep$obj8[_ref8] = 3)).toBe(0); +expect((_deep$obj8 = deep.obj)[_key8 = ++key] && (_deep$obj8[_key8] = 3)).toBe(0); expect(gets).toBe(8); expect(key).toBe(1); diff --git a/packages/babel-plugin-proposal-logical-assignment-operators/test/fixtures/logical-assignment/null-coalescing-without-other/options.json b/packages/babel-plugin-proposal-logical-assignment-operators/test/fixtures/logical-assignment/null-coalescing-without-other/options.json index 8507a894f763..ef8c2205db57 100644 --- a/packages/babel-plugin-proposal-logical-assignment-operators/test/fixtures/logical-assignment/null-coalescing-without-other/options.json +++ b/packages/babel-plugin-proposal-logical-assignment-operators/test/fixtures/logical-assignment/null-coalescing-without-other/options.json @@ -1,6 +1,5 @@ { "plugins": [ - "proposal-logical-assignment-operators", - "syntax-nullish-coalescing-operator" + "proposal-logical-assignment-operators" ] } diff --git a/packages/babel-plugin-proposal-logical-assignment-operators/test/fixtures/logical-assignment/null-coalescing/output.js b/packages/babel-plugin-proposal-logical-assignment-operators/test/fixtures/logical-assignment/null-coalescing/output.js index 35cd7fa05c2b..d34101b49629 100644 --- a/packages/babel-plugin-proposal-logical-assignment-operators/test/fixtures/logical-assignment/null-coalescing/output.js +++ b/packages/babel-plugin-proposal-logical-assignment-operators/test/fixtures/logical-assignment/null-coalescing/output.js @@ -1,4 +1,4 @@ -var _obj$x, _obj$x2, _deep$obj, _x, _deep$obj2, _x2, _ref, _obj, _ref2, _obj2, _deep$obj3, _ref3, _ref4, _deep$obj4, _ref5, _ref6; +var _obj$x, _obj$x2, _deep$obj, _deep$obj$x, _deep$obj2, _deep$obj2$x, _key, _obj$_key, _key2, _obj$_key2, _deep$obj3, _key3, _deep$obj3$_key, _deep$obj4, _key4, _deep$obj4$_key; var x = undefined; var sets = 0; @@ -26,23 +26,23 @@ var deep = { }; obj.x = undefined; -expect((_x = (_deep$obj = deep.obj).x) !== null && _x !== void 0 ? _x : _deep$obj.x = 1).toBe(1); +expect((_deep$obj$x = (_deep$obj = deep.obj).x) !== null && _deep$obj$x !== void 0 ? _deep$obj$x : _deep$obj.x = 1).toBe(1); expect(gets, 1); -expect((_x2 = (_deep$obj2 = deep.obj).x) !== null && _x2 !== void 0 ? _x2 : _deep$obj2.x = 2).toBe(1); +expect((_deep$obj2$x = (_deep$obj2 = deep.obj).x) !== null && _deep$obj2$x !== void 0 ? _deep$obj2$x : _deep$obj2.x = 2).toBe(1); expect(gets, 2); var key = 0; obj.x = undefined; -expect((_obj = obj[_ref = ++key]) !== null && _obj !== void 0 ? _obj : obj[_ref] = 1).toBe(1); +expect((_obj$_key = obj[_key = ++key]) !== null && _obj$_key !== void 0 ? _obj$_key : obj[_key] = 1).toBe(1); expect(key, 1); key = 0; -expect((_obj2 = obj[_ref2 = ++key]) !== null && _obj2 !== void 0 ? _obj2 : obj[_ref2] = 2).toBe(1); +expect((_obj$_key2 = obj[_key2 = ++key]) !== null && _obj$_key2 !== void 0 ? _obj$_key2 : obj[_key2] = 2).toBe(1); expect(key, 1); obj.x = undefined; key = 0; -expect((_ref4 = (_deep$obj3 = deep.obj)[_ref3 = ++key]) !== null && _ref4 !== void 0 ? _ref4 : _deep$obj3[_ref3] = 1).toBe(1); +expect((_deep$obj3$_key = (_deep$obj3 = deep.obj)[_key3 = ++key]) !== null && _deep$obj3$_key !== void 0 ? _deep$obj3$_key : _deep$obj3[_key3] = 1).toBe(1); expect(gets, 3); expect(key, 1); key = 0; -expect((_ref6 = (_deep$obj4 = deep.obj)[_ref5 = ++key]) !== null && _ref6 !== void 0 ? _ref6 : _deep$obj4[_ref5] = 2).toBe(1); +expect((_deep$obj4$_key = (_deep$obj4 = deep.obj)[_key4 = ++key]) !== null && _deep$obj4$_key !== void 0 ? _deep$obj4$_key : _deep$obj4[_key4] = 2).toBe(1); expect(gets, 4); expect(key, 1); diff --git a/packages/babel-plugin-proposal-nullish-coalescing-operator/package.json b/packages/babel-plugin-proposal-nullish-coalescing-operator/package.json index dd9e329c3beb..7871e5f7d579 100644 --- a/packages/babel-plugin-proposal-nullish-coalescing-operator/package.json +++ b/packages/babel-plugin-proposal-nullish-coalescing-operator/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-proposal-nullish-coalescing-operator", - "version": "7.4.4", + "version": "7.8.3", "description": "Remove nullish coalescing operator", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-proposal-nullish-coalescing-operator", "license": "MIT", @@ -12,14 +12,14 @@ "babel-plugin" ], "dependencies": { - "@babel/helper-plugin-utils": "^7.0.0", - "@babel/plugin-syntax-nullish-coalescing-operator": "^7.2.0" + "@babel/helper-plugin-utils": "^7.8.3", + "@babel/plugin-syntax-nullish-coalescing-operator": "^7.8.0" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.4.4", - "@babel/helper-plugin-test-runner": "^7.0.0" + "@babel/core": "^7.8.3", + "@babel/helper-plugin-test-runner": "^7.8.3" } } diff --git a/packages/babel-plugin-proposal-nullish-coalescing-operator/src/index.js b/packages/babel-plugin-proposal-nullish-coalescing-operator/src/index.js index 5b3c2a3a4dc3..848a6c3ee3cd 100644 --- a/packages/babel-plugin-proposal-nullish-coalescing-operator/src/index.js +++ b/packages/babel-plugin-proposal-nullish-coalescing-operator/src/index.js @@ -16,14 +16,15 @@ export default declare((api, { loose = false }) => { return; } - const ref = scope.generateUidIdentifierBasedOnNode(node.left); - scope.push({ id: ref }); - - const assignment = t.assignmentExpression( - "=", - t.cloneNode(ref), - node.left, - ); + let ref = scope.maybeGenerateMemoised(node.left); + let assignment; + // skip creating extra reference when `left` is static + if (ref === null) { + ref = node.left; + assignment = t.cloneNode(node.left); + } else { + assignment = t.assignmentExpression("=", ref, node.left); + } path.replaceWith( t.conditionalExpression( diff --git a/packages/babel-plugin-proposal-nullish-coalescing-operator/test/fixtures/nullish-coalescing/transform-in-default/input.js b/packages/babel-plugin-proposal-nullish-coalescing-operator/test/fixtures/nullish-coalescing/transform-in-default/input.js index 7c7dcae88cf4..0c13164800af 100644 --- a/packages/babel-plugin-proposal-nullish-coalescing-operator/test/fixtures/nullish-coalescing/transform-in-default/input.js +++ b/packages/babel-plugin-proposal-nullish-coalescing-operator/test/fixtures/nullish-coalescing/transform-in-default/input.js @@ -1 +1 @@ -function foo(foo, bar = foo ?? "bar") {} +function foo(foo, qux = foo.bar ?? "qux") {} diff --git a/packages/babel-plugin-proposal-nullish-coalescing-operator/test/fixtures/nullish-coalescing/transform-in-default/output.js b/packages/babel-plugin-proposal-nullish-coalescing-operator/test/fixtures/nullish-coalescing/transform-in-default/output.js index 303ed2159928..2b2f2314b366 100644 --- a/packages/babel-plugin-proposal-nullish-coalescing-operator/test/fixtures/nullish-coalescing/transform-in-default/output.js +++ b/packages/babel-plugin-proposal-nullish-coalescing-operator/test/fixtures/nullish-coalescing/transform-in-default/output.js @@ -1,3 +1,3 @@ -function foo(foo, bar = (_foo = foo) !== null && _foo !== void 0 ? _foo : "bar") { - var _foo; +function foo(foo, qux = (_foo$bar = foo.bar) !== null && _foo$bar !== void 0 ? _foo$bar : "qux") { + var _foo$bar; } diff --git a/packages/babel-plugin-proposal-nullish-coalescing-operator/test/fixtures/nullish-coalescing/transform-static-refs-in-default/input.js b/packages/babel-plugin-proposal-nullish-coalescing-operator/test/fixtures/nullish-coalescing/transform-static-refs-in-default/input.js new file mode 100644 index 000000000000..7c7dcae88cf4 --- /dev/null +++ b/packages/babel-plugin-proposal-nullish-coalescing-operator/test/fixtures/nullish-coalescing/transform-static-refs-in-default/input.js @@ -0,0 +1 @@ +function foo(foo, bar = foo ?? "bar") {} diff --git a/packages/babel-plugin-proposal-nullish-coalescing-operator/test/fixtures/nullish-coalescing/transform-static-refs-in-default/options.json b/packages/babel-plugin-proposal-nullish-coalescing-operator/test/fixtures/nullish-coalescing/transform-static-refs-in-default/options.json new file mode 100644 index 000000000000..47e490d2afcf --- /dev/null +++ b/packages/babel-plugin-proposal-nullish-coalescing-operator/test/fixtures/nullish-coalescing/transform-static-refs-in-default/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["proposal-nullish-coalescing-operator"] +} diff --git a/packages/babel-plugin-proposal-nullish-coalescing-operator/test/fixtures/nullish-coalescing/transform-static-refs-in-default/output.js b/packages/babel-plugin-proposal-nullish-coalescing-operator/test/fixtures/nullish-coalescing/transform-static-refs-in-default/output.js new file mode 100644 index 000000000000..8434439d0782 --- /dev/null +++ b/packages/babel-plugin-proposal-nullish-coalescing-operator/test/fixtures/nullish-coalescing/transform-static-refs-in-default/output.js @@ -0,0 +1 @@ +function foo(foo, bar = foo !== null && foo !== void 0 ? foo : "bar") {} diff --git a/packages/babel-plugin-proposal-nullish-coalescing-operator/test/fixtures/nullish-coalescing/transform-static-refs-in-function/input.js b/packages/babel-plugin-proposal-nullish-coalescing-operator/test/fixtures/nullish-coalescing/transform-static-refs-in-function/input.js new file mode 100644 index 000000000000..8e488a306361 --- /dev/null +++ b/packages/babel-plugin-proposal-nullish-coalescing-operator/test/fixtures/nullish-coalescing/transform-static-refs-in-function/input.js @@ -0,0 +1,3 @@ +function foo() { + var foo = this ?? {}; +} diff --git a/packages/babel-plugin-proposal-nullish-coalescing-operator/test/fixtures/nullish-coalescing/transform-static-refs-in-function/options.json b/packages/babel-plugin-proposal-nullish-coalescing-operator/test/fixtures/nullish-coalescing/transform-static-refs-in-function/options.json new file mode 100644 index 000000000000..47e490d2afcf --- /dev/null +++ b/packages/babel-plugin-proposal-nullish-coalescing-operator/test/fixtures/nullish-coalescing/transform-static-refs-in-function/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["proposal-nullish-coalescing-operator"] +} diff --git a/packages/babel-plugin-proposal-nullish-coalescing-operator/test/fixtures/nullish-coalescing/transform-static-refs-in-function/output.js b/packages/babel-plugin-proposal-nullish-coalescing-operator/test/fixtures/nullish-coalescing/transform-static-refs-in-function/output.js new file mode 100644 index 000000000000..a13ea3508a20 --- /dev/null +++ b/packages/babel-plugin-proposal-nullish-coalescing-operator/test/fixtures/nullish-coalescing/transform-static-refs-in-function/output.js @@ -0,0 +1,3 @@ +function foo() { + var foo = this !== null && this !== void 0 ? this : {}; +} diff --git a/packages/babel-plugin-proposal-numeric-separator/package.json b/packages/babel-plugin-proposal-numeric-separator/package.json index 275d2b8425a9..bea10738fce5 100644 --- a/packages/babel-plugin-proposal-numeric-separator/package.json +++ b/packages/babel-plugin-proposal-numeric-separator/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-proposal-numeric-separator", - "version": "7.2.0", + "version": "7.8.3", "description": "Remove numeric separators from Decimal, Binary, Hex and Octal literals", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-proposal-numeric-separator", "license": "MIT", @@ -12,14 +12,14 @@ "babel-plugin" ], "dependencies": { - "@babel/helper-plugin-utils": "^7.0.0", - "@babel/plugin-syntax-numeric-separator": "^7.2.0" + "@babel/helper-plugin-utils": "^7.8.3", + "@babel/plugin-syntax-numeric-separator": "^7.8.3" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.2.0", - "@babel/helper-plugin-test-runner": "^7.0.0" + "@babel/core": "^7.8.3", + "@babel/helper-plugin-test-runner": "^7.8.3" } } diff --git a/packages/babel-plugin-proposal-numeric-separator/src/index.js b/packages/babel-plugin-proposal-numeric-separator/src/index.js index 99c29d700e1b..915088dffe4b 100644 --- a/packages/babel-plugin-proposal-numeric-separator/src/index.js +++ b/packages/babel-plugin-proposal-numeric-separator/src/index.js @@ -1,30 +1,14 @@ import { declare } from "@babel/helper-plugin-utils"; import syntaxNumericSeparator from "@babel/plugin-syntax-numeric-separator"; -import { types as t } from "@babel/core"; export default declare(api => { api.assertVersion(7); - function replaceNumberArg({ node }) { - if (node.callee.name !== "Number") { - return; - } - - const arg = node.arguments[0]; - if (!t.isStringLiteral(arg)) { - return; - } - - arg.value = arg.value.replace(/_/g, ""); - } - return { name: "proposal-numeric-separator", inherits: syntaxNumericSeparator, visitor: { - CallExpression: replaceNumberArg, - NewExpression: replaceNumberArg, NumericLiteral({ node }) { const { extra } = node; if (extra && /_/.test(extra.raw)) { diff --git a/packages/babel-plugin-proposal-numeric-separator/test/fixtures/number/exec.js b/packages/babel-plugin-proposal-numeric-separator/test/fixtures/number/exec.js deleted file mode 100644 index 238c64241af4..000000000000 --- a/packages/babel-plugin-proposal-numeric-separator/test/fixtures/number/exec.js +++ /dev/null @@ -1,19 +0,0 @@ -expect(Number("1_000")).toBe(Number("1000")); -expect(Number("0xAE_BE_CE")).toBe(Number("0xAEBECE")); -expect(Number("0b1010_0001_1000_0101")).toBe(Number("0b1010000110000101")); -expect(Number("0o0_6_6_6")).toBe(Number("0o0666")); - -expect(new Number("1_000").valueOf()).toBe(new Number("1000").valueOf()); -expect(new Number("0xAE_BE_CE").valueOf()).toBe(new Number("0xAEBECE").valueOf()); -expect(new Number("0b1010_0001_1000_0101").valueOf()).toBe(new Number("0b1010000110000101").valueOf()); -expect(new Number("0o0_6_6_6").valueOf()).toBe(new Number("0o0666").valueOf()); - -expect(Number(1_000)).toBe(Number("1000")); -expect(Number(0xAE_BE_CE)).toBe(Number("0xAEBECE")); -expect(Number(0b1010_0001_1000_0101)).toBe(Number("0b1010000110000101")); -expect(Number(0o0_6_6_6)).toBe(Number("0o0666")); - -expect(new Number(1_000).valueOf()).toBe(new Number("1000").valueOf()); -expect(new Number(0xAE_BE_CE).valueOf()).toBe(new Number("0xAEBECE").valueOf()); -expect(new Number(0b1010_0001_1000_0101).valueOf()).toBe(new Number("0b1010000110000101").valueOf()); -expect(new Number(0o0_6_6_6).valueOf()).toBe(new Number("0o0666").valueOf()); diff --git a/packages/babel-plugin-proposal-numeric-separator/test/fixtures/number/options.json b/packages/babel-plugin-proposal-numeric-separator/test/fixtures/number/options.json deleted file mode 100644 index db4bf9f50d93..000000000000 --- a/packages/babel-plugin-proposal-numeric-separator/test/fixtures/number/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "plugins": ["proposal-numeric-separator"] -} diff --git a/packages/babel-plugin-proposal-object-rest-spread/package.json b/packages/babel-plugin-proposal-object-rest-spread/package.json index e2ac2b6934ad..06ca53c90822 100644 --- a/packages/babel-plugin-proposal-object-rest-spread/package.json +++ b/packages/babel-plugin-proposal-object-rest-spread/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-proposal-object-rest-spread", - "version": "7.5.5", + "version": "7.9.5", "description": "Compile object rest and spread to ES5", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-proposal-object-rest-spread", "license": "MIT", @@ -12,14 +12,15 @@ "babel-plugin" ], "dependencies": { - "@babel/helper-plugin-utils": "^7.0.0", - "@babel/plugin-syntax-object-rest-spread": "^7.2.0" + "@babel/helper-plugin-utils": "^7.8.3", + "@babel/plugin-syntax-object-rest-spread": "^7.8.0", + "@babel/plugin-transform-parameters": "^7.9.5" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.5.5", - "@babel/helper-plugin-test-runner": "^7.0.0" + "@babel/core": "^7.9.0", + "@babel/helper-plugin-test-runner": "^7.8.3" } } diff --git a/packages/babel-plugin-proposal-object-rest-spread/src/index.js b/packages/babel-plugin-proposal-object-rest-spread/src/index.js index 39fcfe42a21c..1ad0862a55cd 100644 --- a/packages/babel-plugin-proposal-object-rest-spread/src/index.js +++ b/packages/babel-plugin-proposal-object-rest-spread/src/index.js @@ -1,6 +1,7 @@ import { declare } from "@babel/helper-plugin-utils"; import syntaxObjectRestSpread from "@babel/plugin-syntax-object-rest-spread"; import { types as t } from "@babel/core"; +import { convertFunctionParams } from "@babel/plugin-transform-parameters"; // TODO: Remove in Babel 8 // @babel/types <=7.3.3 counts FOO as referenced in var { x: FOO }. @@ -30,9 +31,20 @@ export default declare((api, opts) => { function hasRestElement(path) { let foundRestElement = false; - visitRestElements(path, () => { + visitRestElements(path, restElement => { foundRestElement = true; - path.stop(); + restElement.stop(); + }); + return foundRestElement; + } + + function hasObjectPatternRestElement(path) { + let foundRestElement = false; + visitRestElements(path, restElement => { + if (restElement.parentPath.isObjectPattern()) { + foundRestElement = true; + restElement.stop(); + } }); return foundRestElement; } @@ -91,12 +103,12 @@ export default declare((api, opts) => { // replaces impure computed keys with new identifiers // and returns variable declarators of these new identifiers - function replaceImpureComputedKeys(path) { + function replaceImpureComputedKeys(properties, scope) { const impureComputedPropertyDeclarators = []; - for (const propPath of path.get("properties")) { + for (const propPath of properties) { const key = propPath.get("key"); if (propPath.node.computed && !key.isPure()) { - const name = path.scope.generateUidBasedOnNode(key.node); + const name = scope.generateUidBasedOnNode(key.node); const declarator = t.variableDeclarator(t.identifier(name), key.node); impureComputedPropertyDeclarators.push(declarator); key.replaceWith(t.identifier(name)); @@ -128,7 +140,10 @@ export default declare((api, opts) => { const restElement = t.cloneNode(last.node); last.remove(); - const impureComputedPropertyDeclarators = replaceImpureComputedKeys(path); + const impureComputedPropertyDeclarators = replaceImpureComputedKeys( + path.get("properties"), + path.scope, + ); const { keys, allLiteral } = extractNormalizedKeys(path); if (keys.length === 0) { @@ -163,9 +178,9 @@ export default declare((api, opts) => { ]; } - function replaceRestElement(parentPath, paramPath, i, numParams) { + function replaceRestElement(parentPath, paramPath, container) { if (paramPath.isAssignmentPattern()) { - replaceRestElement(parentPath, paramPath.get("left"), i, numParams); + replaceRestElement(parentPath, paramPath.get("left"), container); return; } @@ -173,7 +188,7 @@ export default declare((api, opts) => { const elements = paramPath.get("elements"); for (let i = 0; i < elements.length; i++) { - replaceRestElement(parentPath, elements[i], i, elements.length); + replaceRestElement(parentPath, elements[i], container); } } @@ -184,8 +199,12 @@ export default declare((api, opts) => { t.variableDeclarator(paramPath.node, uid), ]); - parentPath.ensureBlock(); - parentPath.get("body").unshiftContainer("body", declar); + if (container) { + container.push(declar); + } else { + parentPath.ensureBlock(); + parentPath.get("body").unshiftContainer("body", declar); + } paramPath.replaceWith(t.cloneNode(uid)); } } @@ -195,14 +214,74 @@ export default declare((api, opts) => { inherits: syntaxObjectRestSpread, visitor: { - // taken from transform-parameters/src/destructuring.js // function a({ b, ...c }) {} Function(path) { const params = path.get("params"); - for (let i = params.length - 1; i >= 0; i--) { - replaceRestElement(params[i].parentPath, params[i], i, params.length); + const paramsWithRestElement = new Set(); + const idsInRestParams = new Set(); + for (let i = 0; i < params.length; ++i) { + const param = params[i]; + if (hasRestElement(param)) { + paramsWithRestElement.add(i); + for (const name of Object.keys(param.getBindingIdentifiers())) { + idsInRestParams.add(name); + } + } + } + + // if true, a parameter exists that has an id in its initializer + // that is also an id bound in a rest parameter + // example: f({...R}, a = R) + let idInRest = false; + + const IdentifierHandler = function(path, functionScope) { + const name = path.node.name; + if ( + path.scope.getBinding(name) === functionScope.getBinding(name) && + idsInRestParams.has(name) + ) { + idInRest = true; + path.stop(); + } + }; + + let i; + for (i = 0; i < params.length && !idInRest; ++i) { + const param = params[i]; + if (!paramsWithRestElement.has(i)) { + if (param.isReferencedIdentifier() || param.isBindingIdentifier()) { + IdentifierHandler(path, path.scope); + } else { + param.traverse( + { + "Scope|TypeAnnotation|TSTypeAnnotation": path => path.skip(), + "ReferencedIdentifier|BindingIdentifier": IdentifierHandler, + }, + path.scope, + ); + } + } + } + + if (!idInRest) { + for (let i = 0; i < params.length; ++i) { + const param = params[i]; + if (paramsWithRestElement.has(i)) { + replaceRestElement(param.parentPath, param); + } + } + } else { + const shouldTransformParam = idx => + idx >= i - 1 || paramsWithRestElement.has(idx); + convertFunctionParams( + path, + loose, + shouldTransformParam, + replaceRestElement, + ); } }, + // adapted from transform-destructuring/src/index.js#pushObjectRest // const { a, ...b } = c; VariableDeclarator(path, file) { @@ -254,18 +333,21 @@ export default declare((api, opts) => { path.findParent(path => { if (path.isObjectProperty()) { - refPropertyPath.unshift(path.node.key.name); + refPropertyPath.unshift(path); } else if (path.isVariableDeclarator()) { kind = path.parentPath.node.kind; return true; } }); - if (refPropertyPath.length) { - refPropertyPath.forEach(prop => { - ref = t.memberExpression(ref, t.identifier(prop)); - }); - } + const impureObjRefComputedDeclarators = replaceImpureComputedKeys( + refPropertyPath, + path.scope, + ); + refPropertyPath.forEach(prop => { + const { node } = prop; + ref = t.memberExpression(ref, t.cloneNode(node.key), node.computed); + }); const objectPatternPath = path.findParent(path => path.isObjectPattern(), @@ -285,6 +367,8 @@ export default declare((api, opts) => { insertionPath.insertBefore(impureComputedPropertyDeclarators); + insertionPath.insertBefore(impureObjRefComputedDeclarators); + insertionPath.insertAfter( t.variableDeclarator(argument, callExpression), ); @@ -302,6 +386,7 @@ export default declare((api, opts) => { } }); }, + // taken from transform-destructuring/src/index.js#visitor // export var { a, ...b } = c; ExportNamedDeclaration(path) { @@ -310,7 +395,7 @@ export default declare((api, opts) => { const hasRest = declaration .get("declarations") - .some(path => hasRestElement(path.get("id"))); + .some(path => hasObjectPatternRestElement(path.get("id"))); if (!hasRest) return; const specifiers = []; @@ -327,11 +412,13 @@ export default declare((api, opts) => { path.replaceWith(declaration.node); path.insertAfter(t.exportNamedDeclaration(null, specifiers)); }, + // try {} catch ({a, ...b}) {} CatchClause(path) { const paramPath = path.get("param"); replaceRestElement(paramPath.parentPath, paramPath); }, + // ({a, ...b} = c); AssignmentExpression(path, file) { const leftPath = path.get("left"); @@ -374,14 +461,19 @@ export default declare((api, opts) => { path.replaceWithMultiple(nodes); } }, + // taken from transform-destructuring/src/index.js#visitor ForXStatement(path) { const { node, scope } = path; const leftPath = path.get("left"); const left = node.left; - // for ({a, ...b} of []) {} - if (t.isObjectPattern(left) && hasRestElement(leftPath)) { + if (!hasObjectPatternRestElement(leftPath)) { + return; + } + + if (!t.isVariableDeclaration(left)) { + // for ({a, ...b} of []) {} const temp = scope.generateUidIdentifier("ref"); node.left = t.variableDeclaration("var", [ @@ -401,52 +493,60 @@ export default declare((api, opts) => { t.assignmentExpression("=", left, t.cloneNode(temp)), ), ); + } else { + // for (var {a, ...b} of []) {} + const pattern = left.declarations[0].id; - return; - } + const key = scope.generateUidIdentifier("ref"); + node.left = t.variableDeclaration(left.kind, [ + t.variableDeclarator(key, null), + ]); - if (!t.isVariableDeclaration(left)) return; + path.ensureBlock(); - const pattern = left.declarations[0].id; - if (!t.isObjectPattern(pattern)) return; + node.body.body.unshift( + t.variableDeclaration(node.left.kind, [ + t.variableDeclarator(pattern, t.cloneNode(key)), + ]), + ); + } + }, - const key = scope.generateUidIdentifier("ref"); - node.left = t.variableDeclaration(left.kind, [ - t.variableDeclarator(key, null), - ]); + // [{a, ...b}] = c; + ArrayPattern(path) { + const objectPatterns = []; - path.ensureBlock(); + visitRestElements(path, path => { + if (!path.parentPath.isObjectPattern()) { + // Return early if the parent is not an ObjectPattern, but + // (for example) an ArrayPattern or Function, because that + // means this RestElement is an not an object property. + return; + } - node.body.body.unshift( - t.variableDeclaration(node.left.kind, [ - t.variableDeclarator(pattern, t.cloneNode(key)), - ]), - ); - }, - // var a = { ...b, ...c } - ObjectExpression(path, file) { - if (!hasSpread(path.node)) return; + const objectPattern = path.parentPath; - const args = []; - let props = []; + const uid = path.scope.generateUidIdentifier("ref"); + objectPatterns.push(t.variableDeclarator(objectPattern.node, uid)); - function push() { - args.push(t.objectExpression(props)); - props = []; - } + objectPattern.replaceWith(t.cloneNode(uid)); + path.skip(); + }); - for (const prop of (path.node.properties: Array)) { - if (t.isSpreadElement(prop)) { - push(); - args.push(prop.argument); - } else { - props.push(prop); - } + if (objectPatterns.length > 0) { + const statementPath = path.getStatementParent(); + statementPath.insertAfter( + t.variableDeclaration( + statementPath.node.kind || "var", + objectPatterns, + ), + ); } + }, - if (props.length) { - push(); - } + // var a = { ...b, ...c } + ObjectExpression(path, file) { + if (!hasSpread(path.node)) return; let helper; if (loose) { @@ -466,7 +566,40 @@ export default declare((api, opts) => { } } - path.replaceWith(t.callExpression(helper, args)); + let exp = null; + let props = []; + + function make() { + const hadProps = props.length > 0; + const obj = t.objectExpression(props); + props = []; + + if (!exp) { + exp = t.callExpression(helper, [obj]); + return; + } + + exp = t.callExpression(t.cloneNode(helper), [ + exp, + // If we have static props, we need to insert an empty object + // becuase the odd arguments are copied with [[Get]], not + // [[GetOwnProperty]] + ...(hadProps ? [t.objectExpression([]), obj] : []), + ]); + } + + for (const prop of (path.node.properties: Array)) { + if (t.isSpreadElement(prop)) { + make(); + exp.arguments.push(prop.argument); + } else { + props.push(prop); + } + } + + if (props.length) make(); + + path.replaceWith(exp); }, }, }; diff --git a/packages/babel-plugin-proposal-object-rest-spread/test/fixtures/object-rest/export/input.mjs b/packages/babel-plugin-proposal-object-rest-spread/test/fixtures/object-rest/export/input.mjs index 5f0d8f60672d..47c63cdcdd51 100644 --- a/packages/babel-plugin-proposal-object-rest-spread/test/fixtures/object-rest/export/input.mjs +++ b/packages/babel-plugin-proposal-object-rest-spread/test/fixtures/object-rest/export/input.mjs @@ -2,4 +2,4 @@ export var { b, ...c } = asdf2; // Skip export var { bb, cc } = ads; -export var [ dd, ee ] = ads; +export var [ dd, ee, ...ff ] = ads; diff --git a/packages/babel-plugin-proposal-object-rest-spread/test/fixtures/object-rest/export/output.mjs b/packages/babel-plugin-proposal-object-rest-spread/test/fixtures/object-rest/export/output.mjs index fec0e7836e8f..428fb62c861b 100644 --- a/packages/babel-plugin-proposal-object-rest-spread/test/fixtures/object-rest/export/output.mjs +++ b/packages/babel-plugin-proposal-object-rest-spread/test/fixtures/object-rest/export/output.mjs @@ -9,4 +9,4 @@ export var { bb, cc } = ads; -export var [dd, ee] = ads; +export var [dd, ee, ...ff] = ads; diff --git a/packages/babel-plugin-proposal-object-rest-spread/test/fixtures/object-rest/for-x-array-pattern/input.js b/packages/babel-plugin-proposal-object-rest-spread/test/fixtures/object-rest/for-x-array-pattern/input.js new file mode 100644 index 000000000000..8ab978fb9402 --- /dev/null +++ b/packages/babel-plugin-proposal-object-rest-spread/test/fixtures/object-rest/for-x-array-pattern/input.js @@ -0,0 +1,19 @@ +// ForXStatement +for (const [{a, ...b}] of []) {} +for ([{a, ...b}] of []) {} +async function a() { + for await ([{a, ...b}] of []) {} +} + +// skip +for ([{a}] in {}) {} +for ([{a}] of []) {} +async function a() { + for await ([{a}] of []) {} +} + +for ([a, ...b] in {}) {} +for ([a, ...b] of []) {} +async function a() { + for await ([a, ...b] of []) {} +} diff --git a/packages/babel-plugin-proposal-object-rest-spread/test/fixtures/object-rest/for-x-array-pattern/output.js b/packages/babel-plugin-proposal-object-rest-spread/test/fixtures/object-rest/for-x-array-pattern/output.js new file mode 100644 index 000000000000..d4b3f61d7efd --- /dev/null +++ b/packages/babel-plugin-proposal-object-rest-spread/test/fixtures/object-rest/for-x-array-pattern/output.js @@ -0,0 +1,49 @@ +// ForXStatement +for (const _ref of []) { + const [_ref2] = _ref; + const { + a + } = _ref2, + b = babelHelpers.objectWithoutProperties(_ref2, ["a"]); +} + +for (var _ref3 of []) { + [_ref4] = _ref3; + var { + a + } = _ref4, + b = babelHelpers.objectWithoutProperties(_ref4, ["a"]); +} + +async function a() { + for await (var _ref5 of []) { + [_ref6] = _ref5; + var { + a + } = _ref6, + b = babelHelpers.objectWithoutProperties(_ref6, ["a"]); + } +} // skip + + +for ([{ + a +}] in {}) {} + +for ([{ + a +}] of []) {} + +async function a() { + for await ([{ + a + }] of []) {} +} + +for ([a, ...b] in {}) {} + +for ([a, ...b] of []) {} + +async function a() { + for await ([a, ...b] of []) {} +} diff --git a/packages/babel-plugin-proposal-object-rest-spread/test/fixtures/object-rest/impure-computed/output.js b/packages/babel-plugin-proposal-object-rest-spread/test/fixtures/object-rest/impure-computed/output.js index ae9c4e2e2505..c8fe1ed6e8a6 100644 --- a/packages/babel-plugin-proposal-object-rest-spread/test/fixtures/object-rest/impure-computed/output.js +++ b/packages/babel-plugin-proposal-object-rest-spread/test/fixtures/object-rest/impure-computed/output.js @@ -6,11 +6,11 @@ var _$a = { 1: 1, a: 1 }, - _ref = key++, + _key = key++, { - [_ref]: y + [_key]: y } = _$a, - x = babelHelpers.objectWithoutProperties(_$a, [_ref].map(babelHelpers.toPropertyKey)); + x = babelHelpers.objectWithoutProperties(_$a, [_key].map(babelHelpers.toPropertyKey)); expect(x).toEqual({ a: 1 @@ -24,13 +24,13 @@ var _$ = { 2: 2, 3: 3 }, - _ref2 = ++key, - _ref3 = ++key, + _key2 = ++key, + _key3 = ++key, { - [_ref2]: y, - [_ref3]: z + [_key2]: y, + [_key3]: z } = _$, - rest = babelHelpers.objectWithoutProperties(_$, [_ref2, _ref3].map(babelHelpers.toPropertyKey)); + rest = babelHelpers.objectWithoutProperties(_$, [_key2, _key3].map(babelHelpers.toPropertyKey)); expect(y).toBe(2); expect(z).toBe(3); // pure, computed property should remain as-is diff --git a/packages/babel-plugin-proposal-object-rest-spread/test/fixtures/object-rest/nested-array-2/input.js b/packages/babel-plugin-proposal-object-rest-spread/test/fixtures/object-rest/nested-array-2/input.js new file mode 100644 index 000000000000..08cf30b7ab32 --- /dev/null +++ b/packages/babel-plugin-proposal-object-rest-spread/test/fixtures/object-rest/nested-array-2/input.js @@ -0,0 +1 @@ +const [a, [{b, ...c}], {d, ...e}, [{ f, ...g}, {h: [i, {j, ...k}] }]] = x; diff --git a/packages/babel-plugin-proposal-object-rest-spread/test/fixtures/object-rest/nested-array-2/output.js b/packages/babel-plugin-proposal-object-rest-spread/test/fixtures/object-rest/nested-array-2/output.js new file mode 100644 index 000000000000..6c688a3b4bff --- /dev/null +++ b/packages/babel-plugin-proposal-object-rest-spread/test/fixtures/object-rest/nested-array-2/output.js @@ -0,0 +1,19 @@ +const [a, [_ref], _ref2, [_ref3, { + h: [i, _ref4] +}]] = x; +const { + b +} = _ref, + c = babelHelpers.objectWithoutProperties(_ref, ["b"]), + { + d +} = _ref2, + e = babelHelpers.objectWithoutProperties(_ref2, ["d"]), + { + f +} = _ref3, + g = babelHelpers.objectWithoutProperties(_ref3, ["f"]), + { + j +} = _ref4, + k = babelHelpers.objectWithoutProperties(_ref4, ["j"]); diff --git a/packages/babel-plugin-proposal-object-rest-spread/test/fixtures/object-rest/nested-array/input.js b/packages/babel-plugin-proposal-object-rest-spread/test/fixtures/object-rest/nested-array/input.js new file mode 100644 index 000000000000..0845134f7dbc --- /dev/null +++ b/packages/babel-plugin-proposal-object-rest-spread/test/fixtures/object-rest/nested-array/input.js @@ -0,0 +1,6 @@ +const [a, {b, ...c}] = x; + +let [d, {e, ...f}] = x; + +[g, {h, ...i}] = x; + diff --git a/packages/babel-plugin-proposal-object-rest-spread/test/fixtures/object-rest/nested-array/output.js b/packages/babel-plugin-proposal-object-rest-spread/test/fixtures/object-rest/nested-array/output.js new file mode 100644 index 000000000000..bd3be0a9f607 --- /dev/null +++ b/packages/babel-plugin-proposal-object-rest-spread/test/fixtures/object-rest/nested-array/output.js @@ -0,0 +1,15 @@ +const [a, _ref] = x; +const { + b +} = _ref, + c = babelHelpers.objectWithoutProperties(_ref, ["b"]); +let [d, _ref2] = x; +let { + e +} = _ref2, + f = babelHelpers.objectWithoutProperties(_ref2, ["e"]); +[g, _ref3] = x; +var { + h +} = _ref3, + i = babelHelpers.objectWithoutProperties(_ref3, ["h"]); diff --git a/packages/babel-plugin-proposal-object-rest-spread/test/fixtures/object-rest/object-ref-computed-exec/exec.js b/packages/babel-plugin-proposal-object-rest-spread/test/fixtures/object-rest/object-ref-computed-exec/exec.js new file mode 100644 index 000000000000..53012ea3f1af --- /dev/null +++ b/packages/babel-plugin-proposal-object-rest-spread/test/fixtures/object-rest/object-ref-computed-exec/exec.js @@ -0,0 +1,20 @@ +var key, x, y, z; +// impure +key = 1; +var { [key++]: { y, ...x } } = { 1: { a: 1, y: 1 } }; +expect(x).toEqual({ a: 1 }); +expect(key).toBe(2); +expect(y).toBe(1); + +// takes care of the order + +key = 1; +var { + [++key]: { y, ...rest_y }, + [++key]: { z, ...rest_z } +} = {2: { y: 2, z: 3 }, 3: { y: 2, z: 3 } }; +expect(y).toBe(2); +expect(rest_y).toEqual({z: 3}); +expect(z).toBe(3); +expect(rest_z).toEqual({ y: 2 }); +expect(key).toBe(3); diff --git a/packages/babel-plugin-proposal-object-rest-spread/test/fixtures/object-rest/object-ref-computed/input.js b/packages/babel-plugin-proposal-object-rest-spread/test/fixtures/object-rest/object-ref-computed/input.js new file mode 100644 index 000000000000..53012ea3f1af --- /dev/null +++ b/packages/babel-plugin-proposal-object-rest-spread/test/fixtures/object-rest/object-ref-computed/input.js @@ -0,0 +1,20 @@ +var key, x, y, z; +// impure +key = 1; +var { [key++]: { y, ...x } } = { 1: { a: 1, y: 1 } }; +expect(x).toEqual({ a: 1 }); +expect(key).toBe(2); +expect(y).toBe(1); + +// takes care of the order + +key = 1; +var { + [++key]: { y, ...rest_y }, + [++key]: { z, ...rest_z } +} = {2: { y: 2, z: 3 }, 3: { y: 2, z: 3 } }; +expect(y).toBe(2); +expect(rest_y).toEqual({z: 3}); +expect(z).toBe(3); +expect(rest_z).toEqual({ y: 2 }); +expect(key).toBe(3); diff --git a/packages/babel-plugin-proposal-object-rest-spread/test/fixtures/object-rest/object-ref-computed/output.js b/packages/babel-plugin-proposal-object-rest-spread/test/fixtures/object-rest/object-ref-computed/output.js new file mode 100644 index 000000000000..c038f07d1c26 --- /dev/null +++ b/packages/babel-plugin-proposal-object-rest-spread/test/fixtures/object-rest/object-ref-computed/output.js @@ -0,0 +1,62 @@ +var key, x, y, z; // impure + +key = 1; + +var _key = key++, + { + [_key]: { + y + } +} = { + 1: { + a: 1, + y: 1 + } +}, + x = babelHelpers.objectWithoutProperties({ + 1: { + a: 1, + y: 1 + } +}[_key], ["y"]); + +expect(x).toEqual({ + a: 1 +}); +expect(key).toBe(2); +expect(y).toBe(1); // takes care of the order + +key = 1; + +var _$ = { + 2: { + y: 2, + z: 3 + }, + 3: { + y: 2, + z: 3 + } +}, + _key2 = ++key, + _key3 = ++key, + { + [_key3]: { + y + }, + [_key2]: { + z + } +} = _$, + rest_y = babelHelpers.objectWithoutProperties(_$[_key3], ["y"]), + rest_z = babelHelpers.objectWithoutProperties(_$[_key2], ["z"]); + +expect(y).toBe(2); +expect(rest_y).toEqual({ + z: 3 +}); +expect(z).toBe(3); +expect(rest_z).toEqual({ + y: 2 +}); +expect(key).toBe(3); diff --git a/packages/babel-plugin-proposal-object-rest-spread/test/fixtures/object-rest/options.json b/packages/babel-plugin-proposal-object-rest-spread/test/fixtures/object-rest/options.json index ac791b82acf2..6f9add3661d6 100644 --- a/packages/babel-plugin-proposal-object-rest-spread/test/fixtures/object-rest/options.json +++ b/packages/babel-plugin-proposal-object-rest-spread/test/fixtures/object-rest/options.json @@ -1,6 +1,5 @@ { "plugins": [ - "syntax-async-generators", "proposal-object-rest-spread", ["external-helpers", { "helperVersion": "7.1.5" }] ] diff --git a/packages/babel-plugin-proposal-object-rest-spread/test/fixtures/object-rest/parameters-exec/exec.js b/packages/babel-plugin-proposal-object-rest-spread/test/fixtures/object-rest/parameters-exec/exec.js new file mode 100644 index 000000000000..4ba66da90c43 --- /dev/null +++ b/packages/babel-plugin-proposal-object-rest-spread/test/fixtures/object-rest/parameters-exec/exec.js @@ -0,0 +1,9 @@ +function sum(x, y, z) { + return x + y + z; +} +function test() { + var args = arguments; + return sum(...args); +} + +expect(test(1, 2, 3)).toBe(6); diff --git a/packages/babel-plugin-proposal-object-rest-spread/test/fixtures/object-rest/parameters-exec/options.json b/packages/babel-plugin-proposal-object-rest-spread/test/fixtures/object-rest/parameters-exec/options.json new file mode 100644 index 000000000000..5f1948cd5615 --- /dev/null +++ b/packages/babel-plugin-proposal-object-rest-spread/test/fixtures/object-rest/parameters-exec/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["proposal-object-rest-spread"] +} diff --git a/packages/babel-plugin-proposal-object-rest-spread/test/fixtures/object-rest/parameters-extra/input.js b/packages/babel-plugin-proposal-object-rest-spread/test/fixtures/object-rest/parameters-extra/input.js new file mode 100644 index 000000000000..b32b0596f42c --- /dev/null +++ b/packages/babel-plugin-proposal-object-rest-spread/test/fixtures/object-rest/parameters-extra/input.js @@ -0,0 +1,9 @@ +({...R}, a = R) => {} +({X: Y,...R}, {a = {Y}}) => {} +(a = R, {...R}) => {} +({...R}, e, c = 2, a = R, f = q) => { let q; } +({...R}, a = f(R)) => {} +({...R}, { [R.key]: a = 42 }) => {} + +({...R}, {a = {R: b}}) => {} +({...R}, {a = R => R} = {b: R => R}) => {} diff --git a/packages/babel-plugin-proposal-object-rest-spread/test/fixtures/object-rest/parameters-extra/output.js b/packages/babel-plugin-proposal-object-rest-spread/test/fixtures/object-rest/parameters-extra/output.js new file mode 100644 index 000000000000..8033a4d76105 --- /dev/null +++ b/packages/babel-plugin-proposal-object-rest-spread/test/fixtures/object-rest/parameters-extra/output.js @@ -0,0 +1,61 @@ +(_ref) => { + let R = babelHelpers.extends({}, _ref); + let a = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : R; +}; + +(_ref2, _ref3) => { + let { + X: Y + } = _ref2, + R = babelHelpers.objectWithoutProperties(_ref2, ["X"]); + let { + a = { + Y + } + } = _ref3; +}; + +() => { + let a = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : R; + + let _ref4 = arguments.length > 1 ? arguments[1] : undefined; + + let R = babelHelpers.extends({}, _ref4); +}; + +(_ref5, e, c = 2) => { + let R = babelHelpers.extends({}, _ref5); + let a = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : R; + let f = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : q; + return function () { + let q; + }(); +}; + +(_ref6) => { + let R = babelHelpers.extends({}, _ref6); + let a = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : f(R); +}; + +(_ref7, _ref8) => { + let R = babelHelpers.extends({}, _ref7); + let { + [R.key]: a = 42 + } = _ref8; +}; + +(_ref9, { + a = { + R: b + } +}) => { + let R = babelHelpers.extends({}, _ref9); +}; + +(_ref10, { + a = R => R +} = { + b: R => R +}) => { + let R = babelHelpers.extends({}, _ref10); +}; diff --git a/packages/babel-plugin-proposal-object-rest-spread/test/fixtures/object-rest/parameters/output.js b/packages/babel-plugin-proposal-object-rest-spread/test/fixtures/object-rest/parameters/output.js index 3fcf29325f96..ba6a49ecdba1 100644 --- a/packages/babel-plugin-proposal-object-rest-spread/test/fixtures/object-rest/parameters/output.js +++ b/packages/babel-plugin-proposal-object-rest-spread/test/fixtures/object-rest/parameters/output.js @@ -17,15 +17,15 @@ function a3(_ref3) { c2 = babelHelpers.objectWithoutProperties(_ref3, ["a2", "b2"]); } -function a4(_ref5, _ref4) { +function a4(_ref4, _ref5) { let { - a3 + a5 } = _ref5, - c3 = babelHelpers.objectWithoutProperties(_ref5, ["a3"]); + c5 = babelHelpers.objectWithoutProperties(_ref5, ["a5"]); let { - a5 + a3 } = _ref4, - c5 = babelHelpers.objectWithoutProperties(_ref4, ["a5"]); + c3 = babelHelpers.objectWithoutProperties(_ref4, ["a3"]); } function a5(_ref6) { diff --git a/packages/babel-plugin-proposal-object-rest-spread/test/fixtures/object-spread/assignment/input.js b/packages/babel-plugin-proposal-object-rest-spread/test/fixtures/object-spread/assignment/input.js index 6f0367fb7c70..093a8e9f9351 100644 --- a/packages/babel-plugin-proposal-object-rest-spread/test/fixtures/object-spread/assignment/input.js +++ b/packages/babel-plugin-proposal-object-rest-spread/test/fixtures/object-spread/assignment/input.js @@ -1,3 +1,7 @@ +var x; +var y; +var z; + z = { x, ...y }; z = { x, w: { ...y } }; diff --git a/packages/babel-plugin-proposal-object-rest-spread/test/fixtures/object-spread/assignment/output.js b/packages/babel-plugin-proposal-object-rest-spread/test/fixtures/object-spread/assignment/output.js index bca55509f8df..9f13316b8658 100644 --- a/packages/babel-plugin-proposal-object-rest-spread/test/fixtures/object-spread/assignment/output.js +++ b/packages/babel-plugin-proposal-object-rest-spread/test/fixtures/object-spread/assignment/output.js @@ -1,9 +1,12 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } -function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } +function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } +var x; +var y; +var z; z = _objectSpread({ x }, y); diff --git a/packages/babel-plugin-proposal-object-rest-spread/test/fixtures/object-spread/expression/input.js b/packages/babel-plugin-proposal-object-rest-spread/test/fixtures/object-spread/expression/input.js index a20f61241b3c..da4e7b689505 100644 --- a/packages/babel-plugin-proposal-object-rest-spread/test/fixtures/object-spread/expression/input.js +++ b/packages/babel-plugin-proposal-object-rest-spread/test/fixtures/object-spread/expression/input.js @@ -1,3 +1,10 @@ +var a; +var b; +var c; +var d; +var x; +var y; + ({ x, ...y, a, ...b, c }); ({ ...Object.prototype }); diff --git a/packages/babel-plugin-proposal-object-rest-spread/test/fixtures/object-spread/expression/output.js b/packages/babel-plugin-proposal-object-rest-spread/test/fixtures/object-spread/expression/output.js index ba0e5ad1c8e3..da325b840aa2 100644 --- a/packages/babel-plugin-proposal-object-rest-spread/test/fixtures/object-spread/expression/output.js +++ b/packages/babel-plugin-proposal-object-rest-spread/test/fixtures/object-spread/expression/output.js @@ -1,14 +1,21 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } -function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } +function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } -_objectSpread({ +var a; +var b; +var c; +var d; +var x; +var y; + +_objectSpread(_objectSpread(_objectSpread({ x -}, y, { +}, y), {}, { a -}, b, { +}, b), {}, { c }); @@ -18,9 +25,9 @@ _objectSpread({}, { foo: 'bar' }); -_objectSpread({}, { +_objectSpread(_objectSpread({}, { foo: 'bar' -}, {}, { +}), { bar: 'baz' }); diff --git a/packages/babel-plugin-proposal-object-rest-spread/test/fixtures/object-spread/loose-mode-builtins/input.js b/packages/babel-plugin-proposal-object-rest-spread/test/fixtures/object-spread/loose-mode-builtins/input.js index 6f0367fb7c70..093a8e9f9351 100644 --- a/packages/babel-plugin-proposal-object-rest-spread/test/fixtures/object-spread/loose-mode-builtins/input.js +++ b/packages/babel-plugin-proposal-object-rest-spread/test/fixtures/object-spread/loose-mode-builtins/input.js @@ -1,3 +1,7 @@ +var x; +var y; +var z; + z = { x, ...y }; z = { x, w: { ...y } }; diff --git a/packages/babel-plugin-proposal-object-rest-spread/test/fixtures/object-spread/loose-mode-builtins/output.js b/packages/babel-plugin-proposal-object-rest-spread/test/fixtures/object-spread/loose-mode-builtins/output.js index 457fa6a6069d..8e9602898ed6 100644 --- a/packages/babel-plugin-proposal-object-rest-spread/test/fixtures/object-spread/loose-mode-builtins/output.js +++ b/packages/babel-plugin-proposal-object-rest-spread/test/fixtures/object-spread/loose-mode-builtins/output.js @@ -1,3 +1,6 @@ +var x; +var y; +var z; z = Object.assign({ x }, y); diff --git a/packages/babel-plugin-proposal-object-rest-spread/test/fixtures/object-spread/loose-mode/input.js b/packages/babel-plugin-proposal-object-rest-spread/test/fixtures/object-spread/loose-mode/input.js index 07beed075a6c..f05d6d6b8917 100644 --- a/packages/babel-plugin-proposal-object-rest-spread/test/fixtures/object-spread/loose-mode/input.js +++ b/packages/babel-plugin-proposal-object-rest-spread/test/fixtures/object-spread/loose-mode/input.js @@ -1,3 +1,7 @@ +var x; +var y; +var z; + z = { x, ...y }; z = { x, w: { ...y } }; diff --git a/packages/babel-plugin-proposal-object-rest-spread/test/fixtures/object-spread/loose-mode/output.js b/packages/babel-plugin-proposal-object-rest-spread/test/fixtures/object-spread/loose-mode/output.js index 1d477e3f1bb8..d33583d41054 100644 --- a/packages/babel-plugin-proposal-object-rest-spread/test/fixtures/object-spread/loose-mode/output.js +++ b/packages/babel-plugin-proposal-object-rest-spread/test/fixtures/object-spread/loose-mode/output.js @@ -2,6 +2,9 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } +var x; +var y; +var z; z = _extends({ x }, y); diff --git a/packages/babel-plugin-proposal-object-rest-spread/test/fixtures/object-spread/side-effect/exec.js b/packages/babel-plugin-proposal-object-rest-spread/test/fixtures/object-spread/side-effect/exec.js new file mode 100644 index 000000000000..15144e7782ec --- /dev/null +++ b/packages/babel-plugin-proposal-object-rest-spread/test/fixtures/object-spread/side-effect/exec.js @@ -0,0 +1,8 @@ +var k = { a: 1, b: 2 }; +var o = { a: 3, ...k, b: k.a++ }; +expect(o).toEqual({a: 1, b: 1}); + +var k = { a: 1, get b() { l = { z: 9 }; return 2; } }; +var l = { c: 3 }; +var o = { ...k, ...l }; +expect(o).toEqual({ a: 1, b: 2, z: 9 }); diff --git a/packages/babel-plugin-proposal-object-rest-spread/test/fixtures/object-spread/side-effect/input.js b/packages/babel-plugin-proposal-object-rest-spread/test/fixtures/object-spread/side-effect/input.js new file mode 100644 index 000000000000..f2c856b9fcd4 --- /dev/null +++ b/packages/babel-plugin-proposal-object-rest-spread/test/fixtures/object-spread/side-effect/input.js @@ -0,0 +1,16 @@ +var k = { a: 1, b: 2 }; +var o = { a: 3, ...k, b: k.a++ }; + +var pureA = {}; +var pureB = {}; +var pureC = {}; +var pureD = {}; +var pureE = {}; + +function impureFunc() { + console.log('hello') +} + +var output = { ...pureA, get foo() {}, get bar() {}, ...pureB, ...pureC, ...impureFunc(), ...pureD, pureD } + +var simpleOutput = { ...pureA, test: '1', ...pureB, } \ No newline at end of file diff --git a/packages/babel-plugin-proposal-object-rest-spread/test/fixtures/object-spread/side-effect/output.js b/packages/babel-plugin-proposal-object-rest-spread/test/fixtures/object-spread/side-effect/output.js new file mode 100644 index 000000000000..a06b7aceb423 --- /dev/null +++ b/packages/babel-plugin-proposal-object-rest-spread/test/fixtures/object-spread/side-effect/output.js @@ -0,0 +1,39 @@ +function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } + +function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } + +function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } + +var k = { + a: 1, + b: 2 +}; + +var o = _objectSpread(_objectSpread({ + a: 3 +}, k), {}, { + b: k.a++ +}); + +var pureA = {}; +var pureB = {}; +var pureC = {}; +var pureD = {}; +var pureE = {}; + +function impureFunc() { + console.log('hello'); +} + +var output = _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({}, pureA), {}, { + get foo() {}, + + get bar() {} + +}, pureB), pureC), impureFunc()), pureD), {}, { + pureD +}); + +var simpleOutput = _objectSpread(_objectSpread({}, pureA), {}, { + test: '1' +}, pureB); diff --git a/packages/babel-plugin-proposal-object-rest-spread/test/fixtures/object-spread/string-exec/exec.js b/packages/babel-plugin-proposal-object-rest-spread/test/fixtures/object-spread/string-exec/exec.js new file mode 100644 index 000000000000..bff6fc07971f --- /dev/null +++ b/packages/babel-plugin-proposal-object-rest-spread/test/fixtures/object-spread/string-exec/exec.js @@ -0,0 +1,3 @@ +expect([...'']).toHaveLength(0); +expect([...'abc']).toHaveLength(3); +expect([...'def']).toMatchObject(['d','e','f']); diff --git a/packages/babel-plugin-proposal-object-rest-spread/test/fixtures/object-spread/variable-declaration/output.js b/packages/babel-plugin-proposal-object-rest-spread/test/fixtures/object-spread/variable-declaration/output.js index 1370408b8354..9fabf3047b3d 100644 --- a/packages/babel-plugin-proposal-object-rest-spread/test/fixtures/object-spread/variable-declaration/output.js +++ b/packages/babel-plugin-proposal-object-rest-spread/test/fixtures/object-spread/variable-declaration/output.js @@ -1,6 +1,6 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } -function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } +function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } diff --git a/packages/babel-plugin-proposal-optional-catch-binding/package.json b/packages/babel-plugin-proposal-optional-catch-binding/package.json index 86e80fad2678..daaf65e4e94c 100644 --- a/packages/babel-plugin-proposal-optional-catch-binding/package.json +++ b/packages/babel-plugin-proposal-optional-catch-binding/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-proposal-optional-catch-binding", - "version": "7.2.0", + "version": "7.8.3", "description": "Compile optional catch bindings", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-proposal-optional-catch-binding", "license": "MIT", @@ -12,14 +12,14 @@ "babel-plugin" ], "dependencies": { - "@babel/helper-plugin-utils": "^7.0.0", - "@babel/plugin-syntax-optional-catch-binding": "^7.2.0" + "@babel/helper-plugin-utils": "^7.8.3", + "@babel/plugin-syntax-optional-catch-binding": "^7.8.0" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.2.0", - "@babel/helper-plugin-test-runner": "^7.0.0" + "@babel/core": "^7.8.3", + "@babel/helper-plugin-test-runner": "^7.8.3" } } diff --git a/packages/babel-plugin-proposal-optional-chaining/package.json b/packages/babel-plugin-proposal-optional-chaining/package.json index fb71c57cf9a3..f63745683fb1 100644 --- a/packages/babel-plugin-proposal-optional-chaining/package.json +++ b/packages/babel-plugin-proposal-optional-chaining/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-proposal-optional-chaining", - "version": "7.2.0", + "version": "7.9.0", "description": "Transform optional chaining operators into a series of nil checks", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-proposal-optional-chaining", "license": "MIT", @@ -12,15 +12,15 @@ "babel-plugin" ], "dependencies": { - "@babel/helper-plugin-utils": "^7.0.0", - "@babel/plugin-syntax-optional-chaining": "^7.2.0" + "@babel/helper-plugin-utils": "^7.8.3", + "@babel/plugin-syntax-optional-chaining": "^7.8.0" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.2.0", - "@babel/helper-plugin-test-runner": "^7.0.0", - "@babel/plugin-transform-block-scoping": "^7.2.0" + "@babel/core": "^7.9.0", + "@babel/helper-plugin-test-runner": "^7.8.3", + "@babel/plugin-transform-block-scoping": "^7.8.3" } } diff --git a/packages/babel-plugin-proposal-optional-chaining/src/index.js b/packages/babel-plugin-proposal-optional-chaining/src/index.js index c3e324041520..2cfce5263b46 100644 --- a/packages/babel-plugin-proposal-optional-chaining/src/index.js +++ b/packages/babel-plugin-proposal-optional-chaining/src/index.js @@ -7,6 +7,16 @@ export default declare((api, options) => { const { loose = false } = options; + function isSimpleMemberExpression(expression) { + return ( + t.isIdentifier(expression) || + t.isSuper(expression) || + (t.isMemberExpression(expression) && + !expression.computed && + isSimpleMemberExpression(expression.object)) + ); + } + return { name: "proposal-optional-chaining", inherits: syntaxOptionalChaining, @@ -14,6 +24,7 @@ export default declare((api, options) => { visitor: { "OptionalCallExpression|OptionalMemberExpression"(path) { const { parentPath, scope } = path; + let isDeleteOperation = false; const optionals = []; let optionalPath = path; @@ -38,6 +49,7 @@ export default declare((api, options) => { let replacementPath = path; if (parentPath.isUnaryExpression({ operator: "delete" })) { replacementPath = parentPath; + isDeleteOperation = true; } for (let i = optionals.length - 1; i >= 0; i--) { const node = optionals[i]; @@ -48,9 +60,10 @@ export default declare((api, options) => { let ref; let check; - if (loose && isCall) { + if (loose && isCall && isSimpleMemberExpression(chain)) { // If we are using a loose transform (avoiding a Function#call) and we are at the call, - // we can avoid a needless memoize. + // we can avoid a needless memoize. We only do this if the callee is a simple member + // expression, to avoid multiple calls to nested call expressions. check = ref = chain; } else { ref = scope.maybeGenerateMemoised(chain); @@ -71,7 +84,7 @@ export default declare((api, options) => { // Ensure call expressions have the proper `this` // `foo.bar()` has context `foo`. if (isCall && t.isMemberExpression(chain)) { - if (loose) { + if (loose && isSimpleMemberExpression(chain)) { // To avoid a Function#call, we can instead re-grab the property from the context object. // `a.?b.?()` translates roughly to `_a.b != null && _a.b()` node.callee = chain; @@ -82,6 +95,8 @@ export default declare((api, options) => { let context = scope.maybeGenerateMemoised(object); if (context) { chain.object = t.assignmentExpression("=", context, object); + } else if (t.isSuper(object)) { + context = t.thisExpression(); } else { context = object; } @@ -111,7 +126,9 @@ export default declare((api, options) => { scope.buildUndefinedNode(), ), ), - scope.buildUndefinedNode(), + isDeleteOperation + ? t.booleanLiteral(true) + : scope.buildUndefinedNode(), replacementPath.node, ), ); diff --git a/packages/babel-plugin-proposal-optional-chaining/test/fixtures/general/delete/exec.js b/packages/babel-plugin-proposal-optional-chaining/test/fixtures/general/delete/exec.js index b2ecbb0a69c0..51021b6cbdb9 100644 --- a/packages/babel-plugin-proposal-optional-chaining/test/fixtures/general/delete/exec.js +++ b/packages/babel-plugin-proposal-optional-chaining/test/fixtures/general/delete/exec.js @@ -16,7 +16,7 @@ expect(test).toBe(true); test = delete obj?.b?.b; expect(obj.b).toBeUndefined(); -expect(test).toBeUndefined(); +expect(test).toBe(true); delete obj?.a; expect(obj.a).toBeUndefined(); diff --git a/packages/babel-plugin-proposal-optional-chaining/test/fixtures/general/delete/output.js b/packages/babel-plugin-proposal-optional-chaining/test/fixtures/general/delete/output.js index 5a9498166caf..e5260f8ca9a0 100644 --- a/packages/babel-plugin-proposal-optional-chaining/test/fixtures/general/delete/output.js +++ b/packages/babel-plugin-proposal-optional-chaining/test/fixtures/general/delete/output.js @@ -7,7 +7,7 @@ const obj = { b: 0 } }; -let test = obj === null || obj === void 0 ? void 0 : (_obj$a = obj.a) === null || _obj$a === void 0 ? void 0 : delete _obj$a.b; -test = obj === null || obj === void 0 ? void 0 : delete obj.a.b; -test = obj === null || obj === void 0 ? void 0 : (_obj$b = obj.b) === null || _obj$b === void 0 ? void 0 : delete _obj$b.b; -obj === null || obj === void 0 ? void 0 : delete obj.a; +let test = obj === null || obj === void 0 ? true : (_obj$a = obj.a) === null || _obj$a === void 0 ? true : delete _obj$a.b; +test = obj === null || obj === void 0 ? true : delete obj.a.b; +test = obj === null || obj === void 0 ? true : (_obj$b = obj.b) === null || _obj$b === void 0 ? true : delete _obj$b.b; +obj === null || obj === void 0 ? true : delete obj.a; diff --git a/packages/babel-plugin-proposal-optional-chaining/test/fixtures/general/memoize-loose/input.js b/packages/babel-plugin-proposal-optional-chaining/test/fixtures/general/memoize-loose/input.js index ffe543adde41..bbb26771f34e 100644 --- a/packages/babel-plugin-proposal-optional-chaining/test/fixtures/general/memoize-loose/input.js +++ b/packages/babel-plugin-proposal-optional-chaining/test/fixtures/general/memoize-loose/input.js @@ -7,6 +7,14 @@ function test(foo) { foo?.bar() + foo.get(bar)?.() + + foo.bar()?.() + foo[bar]()?.() + + foo.bar().baz?.() + foo[bar]().baz?.() + foo.bar?.(foo.bar, false) foo?.bar?.(foo.bar, true) diff --git a/packages/babel-plugin-proposal-optional-chaining/test/fixtures/general/memoize-loose/output.js b/packages/babel-plugin-proposal-optional-chaining/test/fixtures/general/memoize-loose/output.js index 00635776f339..806487a206aa 100644 --- a/packages/babel-plugin-proposal-optional-chaining/test/fixtures/general/memoize-loose/output.js +++ b/packages/babel-plugin-proposal-optional-chaining/test/fixtures/general/memoize-loose/output.js @@ -1,14 +1,19 @@ function test(foo) { - var _foo$bar, _foo$bar2, _foo$bar3, _foo$bar4, _foo$bar5; + var _foo$bar, _foo$get, _foo$bar2, _foo$bar3, _foo$bar$baz, _foo$bar4, _foo$bar$baz2, _foo$bar5, _foo$bar6, _foo$bar7, _foo$bar8, _foo$bar9; foo == null ? void 0 : foo.bar; foo == null ? void 0 : (_foo$bar = foo.bar) == null ? void 0 : _foo$bar.baz; foo == null ? void 0 : foo(foo); foo == null ? void 0 : foo.bar(); + (_foo$get = foo.get(bar)) == null ? void 0 : _foo$get(); + (_foo$bar2 = foo.bar()) == null ? void 0 : _foo$bar2(); + (_foo$bar3 = foo[bar]()) == null ? void 0 : _foo$bar3(); + (_foo$bar$baz = (_foo$bar4 = foo.bar()).baz) == null ? void 0 : _foo$bar$baz.call(_foo$bar4); + (_foo$bar$baz2 = (_foo$bar5 = foo[bar]()).baz) == null ? void 0 : _foo$bar$baz2.call(_foo$bar5); foo.bar == null ? void 0 : foo.bar(foo.bar, false); foo == null ? void 0 : foo.bar == null ? void 0 : foo.bar(foo.bar, true); - (_foo$bar2 = foo.bar) == null ? void 0 : _foo$bar2.baz(foo.bar, false); - foo == null ? void 0 : (_foo$bar3 = foo.bar) == null ? void 0 : _foo$bar3.baz(foo.bar, true); - (_foo$bar4 = foo.bar) == null ? void 0 : _foo$bar4.baz == null ? void 0 : _foo$bar4.baz(foo.bar, false); - foo == null ? void 0 : (_foo$bar5 = foo.bar) == null ? void 0 : _foo$bar5.baz == null ? void 0 : _foo$bar5.baz(foo.bar, true); + (_foo$bar6 = foo.bar) == null ? void 0 : _foo$bar6.baz(foo.bar, false); + foo == null ? void 0 : (_foo$bar7 = foo.bar) == null ? void 0 : _foo$bar7.baz(foo.bar, true); + (_foo$bar8 = foo.bar) == null ? void 0 : _foo$bar8.baz == null ? void 0 : _foo$bar8.baz(foo.bar, false); + foo == null ? void 0 : (_foo$bar9 = foo.bar) == null ? void 0 : _foo$bar9.baz == null ? void 0 : _foo$bar9.baz(foo.bar, true); } diff --git a/packages/babel-plugin-proposal-optional-chaining/test/fixtures/general/super-method-call-loose/input.js b/packages/babel-plugin-proposal-optional-chaining/test/fixtures/general/super-method-call-loose/input.js new file mode 100644 index 000000000000..445c06ab259e --- /dev/null +++ b/packages/babel-plugin-proposal-optional-chaining/test/fixtures/general/super-method-call-loose/input.js @@ -0,0 +1,12 @@ +"use strict"; +class Base { + method() { + return 'Hello!'; + } +} + +class Derived extends Base { + method() { + return super.method?.() + } +} diff --git a/packages/babel-plugin-proposal-optional-chaining/test/fixtures/general/super-method-call-loose/options.json b/packages/babel-plugin-proposal-optional-chaining/test/fixtures/general/super-method-call-loose/options.json new file mode 100644 index 000000000000..39ea3f99c7ff --- /dev/null +++ b/packages/babel-plugin-proposal-optional-chaining/test/fixtures/general/super-method-call-loose/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["proposal-optional-chaining", { "loose": true }]] +} diff --git a/packages/babel-plugin-proposal-optional-chaining/test/fixtures/general/super-method-call-loose/output.js b/packages/babel-plugin-proposal-optional-chaining/test/fixtures/general/super-method-call-loose/output.js new file mode 100644 index 000000000000..6fd3890a61aa --- /dev/null +++ b/packages/babel-plugin-proposal-optional-chaining/test/fixtures/general/super-method-call-loose/output.js @@ -0,0 +1,15 @@ +"use strict"; + +class Base { + method() { + return 'Hello!'; + } + +} + +class Derived extends Base { + method() { + return super.method == null ? void 0 : super.method(); + } + +} diff --git a/packages/babel-plugin-proposal-optional-chaining/test/fixtures/general/super-method-call/input.js b/packages/babel-plugin-proposal-optional-chaining/test/fixtures/general/super-method-call/input.js new file mode 100644 index 000000000000..445c06ab259e --- /dev/null +++ b/packages/babel-plugin-proposal-optional-chaining/test/fixtures/general/super-method-call/input.js @@ -0,0 +1,12 @@ +"use strict"; +class Base { + method() { + return 'Hello!'; + } +} + +class Derived extends Base { + method() { + return super.method?.() + } +} diff --git a/packages/babel-plugin-proposal-optional-chaining/test/fixtures/general/super-method-call/output.js b/packages/babel-plugin-proposal-optional-chaining/test/fixtures/general/super-method-call/output.js new file mode 100644 index 000000000000..891da0508e27 --- /dev/null +++ b/packages/babel-plugin-proposal-optional-chaining/test/fixtures/general/super-method-call/output.js @@ -0,0 +1,17 @@ +"use strict"; + +class Base { + method() { + return 'Hello!'; + } + +} + +class Derived extends Base { + method() { + var _super$method; + + return (_super$method = super.method) === null || _super$method === void 0 ? void 0 : _super$method.call(this); + } + +} diff --git a/packages/babel-plugin-proposal-optional-chaining/test/fixtures/regression/8354/exec.js b/packages/babel-plugin-proposal-optional-chaining/test/fixtures/regression/8354/exec.js new file mode 100644 index 000000000000..c050ed412a62 --- /dev/null +++ b/packages/babel-plugin-proposal-optional-chaining/test/fixtures/regression/8354/exec.js @@ -0,0 +1,5 @@ +const foo = undefined; +const bar = 'bar'; +const foobar = foo?.replace(`foo${bar}`, ''); + +expect(foobar).toBe(undefined); \ No newline at end of file diff --git a/packages/babel-plugin-proposal-optional-chaining/test/fixtures/regression/8354/options.json b/packages/babel-plugin-proposal-optional-chaining/test/fixtures/regression/8354/options.json new file mode 100644 index 000000000000..a172da6589bf --- /dev/null +++ b/packages/babel-plugin-proposal-optional-chaining/test/fixtures/regression/8354/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["proposal-optional-chaining", "transform-template-literals"] +} diff --git a/packages/babel-plugin-proposal-partial-application/package.json b/packages/babel-plugin-proposal-partial-application/package.json index 79303c737cc7..9fbde0b99b1b 100644 --- a/packages/babel-plugin-proposal-partial-application/package.json +++ b/packages/babel-plugin-proposal-partial-application/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-proposal-partial-application", - "version": "7.4.4", + "version": "7.8.3", "description": "Introduces a new ? token in an argument list which allows for partially applying an argument list to a call expression", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-proposal-partial-application", "license": "MIT", @@ -12,14 +12,14 @@ "babel-plugin" ], "dependencies": { - "@babel/helper-plugin-utils": "^7.0.0", - "@babel/plugin-syntax-partial-application": "^7.4.4" + "@babel/helper-plugin-utils": "^7.8.3", + "@babel/plugin-syntax-partial-application": "^7.8.3" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.4.4", - "@babel/helper-plugin-test-runner": "^7.0.0" + "@babel/core": "^7.8.3", + "@babel/helper-plugin-test-runner": "^7.8.3" } } diff --git a/packages/babel-plugin-proposal-partial-application/test/fixtures/general/with-spread/output.js b/packages/babel-plugin-proposal-partial-application/test/fixtures/general/with-spread/output.js index 9f4f7ab6f99b..ac3bbb32ab4e 100644 --- a/packages/babel-plugin-proposal-partial-application/test/fixtures/general/with-spread/output.js +++ b/packages/babel-plugin-proposal-partial-application/test/fixtures/general/with-spread/output.js @@ -1,13 +1,13 @@ "use strict"; -var _a, _param, _foo, _x, _param2, _bar, _param3, _obj$baz, _obj; +var _a, _b, _foo, _x, _y, _bar, _d, _obj$baz, _obj; -const q = (_foo = foo, _a = a, _param = [...b], function foo(_argPlaceholder) { - return _foo(_a, ..._param, _argPlaceholder); +const q = (_foo = foo, _a = a, _b = [...b], function foo(_argPlaceholder) { + return _foo(_a, ..._b, _argPlaceholder); }); -const w = (_bar = bar, _x = x, _param2 = [...y], function bar(_argPlaceholder2, _argPlaceholder3) { - return _bar(1, _x, _argPlaceholder2, ..._param2, _argPlaceholder3, 2); +const w = (_bar = bar, _x = x, _y = [...y], function bar(_argPlaceholder2, _argPlaceholder3) { + return _bar(1, _x, _argPlaceholder2, ..._y, _argPlaceholder3, 2); }); -const z = (_obj = obj, _obj$baz = _obj.baz, _param3 = [...d], function baz(_argPlaceholder4) { - return _obj$baz.call(_obj, _argPlaceholder4, ..._param3); +const z = (_obj = obj, _obj$baz = _obj.baz, _d = [...d], function baz(_argPlaceholder4) { + return _obj$baz.call(_obj, _argPlaceholder4, ..._d); }); diff --git a/packages/babel-plugin-proposal-pipeline-operator/.npmignore b/packages/babel-plugin-proposal-pipeline-operator/.npmignore new file mode 100644 index 000000000000..2b1fceba679b --- /dev/null +++ b/packages/babel-plugin-proposal-pipeline-operator/.npmignore @@ -0,0 +1,3 @@ +*.log +src +test diff --git a/packages/babel-plugin-proposal-pipeline-operator/package.json b/packages/babel-plugin-proposal-pipeline-operator/package.json index bf0b947a8e84..4c4944ba3f62 100644 --- a/packages/babel-plugin-proposal-pipeline-operator/package.json +++ b/packages/babel-plugin-proposal-pipeline-operator/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-proposal-pipeline-operator", - "version": "7.5.0", + "version": "7.8.3", "description": "Transform pipeline operator into call expressions", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-proposal-pipeline-operator", "license": "MIT", @@ -12,14 +12,14 @@ "babel-plugin" ], "dependencies": { - "@babel/helper-plugin-utils": "^7.0.0", - "@babel/plugin-syntax-pipeline-operator": "^7.5.0" + "@babel/helper-plugin-utils": "^7.8.3", + "@babel/plugin-syntax-pipeline-operator": "^7.8.3" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.5.0", - "@babel/helper-plugin-test-runner": "^7.0.0" + "@babel/core": "^7.8.3", + "@babel/helper-plugin-test-runner": "^7.8.3" } } diff --git a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/fsharp/await/options.json b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/fsharp/await/options.json index c5a39e971027..970314ed16fe 100644 --- a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/fsharp/await/options.json +++ b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/fsharp/await/options.json @@ -1,7 +1,5 @@ { - "plugins": [ - ["proposal-pipeline-operator", { "proposal": "fsharp" }] - ], + "plugins": [["proposal-pipeline-operator", { "proposal": "fsharp" }]], "parserOpts": { "allowReturnOutsideFunction": true }, diff --git a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/fsharp/options.json b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/fsharp/options.json index 4e41244cc302..d94a839f79a3 100644 --- a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/fsharp/options.json +++ b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/fsharp/options.json @@ -1,7 +1,5 @@ { - "plugins": [ - ["proposal-pipeline-operator", { "proposal": "fsharp" }] - ], + "plugins": [["proposal-pipeline-operator", { "proposal": "fsharp" }]], "parserOpts": { "allowReturnOutsideFunction": true } diff --git a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/minimal/async-arrow/output.js b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/minimal/async-arrow/output.js index ca8e5ed0c54d..3f39b0e539df 100644 --- a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/minimal/async-arrow/output.js +++ b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/minimal/async-arrow/output.js @@ -2,7 +2,7 @@ var _ref, _; function then(fn) { return async value => { - return fn((await value)); + return fn(await value); }; } diff --git a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/smart/await/options.json b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/smart/await/options.json index ef8ed8865bd4..df1848815387 100644 --- a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/smart/await/options.json +++ b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/smart/await/options.json @@ -1,7 +1,5 @@ { - "plugins": [ - ["proposal-pipeline-operator", { "proposal": "smart" }] - ], + "plugins": [["proposal-pipeline-operator", { "proposal": "smart" }]], "parserOpts": { "allowReturnOutsideFunction": true }, diff --git a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/smart/bare-function/output.js b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/smart/bare-function/output.js index 24663cdab26a..d89c931323d0 100644 --- a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/smart/bare-function/output.js +++ b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/smart/bare-function/output.js @@ -1,4 +1,4 @@ -var _ref, _ref2; +var _ref, _; const abs = Math.abs; -const value = (_ref = (_ref2 = -5.9, abs(_ref2)), Math.floor(_ref)); +const value = (_ref = (_ = -5.9, abs(_)), Math.floor(_ref)); diff --git a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/smart/object-literal/output.js b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/smart/object-literal/output.js index c8c1d0f95f04..f558d2a62a01 100644 --- a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/smart/object-literal/output.js +++ b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/smart/object-literal/output.js @@ -1,10 +1,10 @@ -var _ref, _ref2, _ref3; +var _ref, _ref2, _; function area(rect) { return rect.width * rect.height; } -const result = (_ref = (_ref2 = (_ref3 = -5, Math.abs(_ref3)), { +const result = (_ref = (_ref2 = (_ = -5, Math.abs(_)), { width: _ref2, height: _ref2 + 3 }), area(_ref)); diff --git a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/smart/options.json b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/smart/options.json index c82020184d7b..d8c03ffdf701 100644 --- a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/smart/options.json +++ b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/smart/options.json @@ -1,7 +1,5 @@ { - "plugins": [ - ["proposal-pipeline-operator", { "proposal": "smart" }] - ], + "plugins": [["proposal-pipeline-operator", { "proposal": "smart" }]], "parserOpts": { "allowReturnOutsideFunction": true } diff --git a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/smart/topic-inside-arrow-function/output.js b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/smart/topic-inside-arrow-function/output.js index 5517a532410f..35aee7ed2a42 100644 --- a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/smart/topic-inside-arrow-function/output.js +++ b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/smart/topic-inside-arrow-function/output.js @@ -1,7 +1,7 @@ -var _ref, _ref2, _ref3, _ref4; +var _ref, _ref2, _ref3, _; -const result = (_ref = (_ref2 = (_ref3 = (_ref4 = -2.2 // -2.2 -, Math.floor(_ref4) // -3 +const result = (_ref = (_ref2 = (_ref3 = (_ = -2.2 // -2.2 +, Math.floor(_) // -3 ), () => Math.pow(_ref3, 5) // () => -243 ), _ref2() // -243 ), Math.sign(_ref)); // -1 diff --git a/packages/babel-plugin-proposal-private-methods/package.json b/packages/babel-plugin-proposal-private-methods/package.json index cd9cef01e36b..62b2565034ca 100644 --- a/packages/babel-plugin-proposal-private-methods/package.json +++ b/packages/babel-plugin-proposal-private-methods/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-proposal-private-methods", - "version": "7.4.4", + "version": "7.8.3", "description": "This plugin transforms private class methods", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-proposal-private-methods", "license": "MIT", @@ -12,14 +12,14 @@ "babel-plugin" ], "dependencies": { - "@babel/helper-create-class-features-plugin": "^7.4.4", - "@babel/helper-plugin-utils": "^7.0.0" + "@babel/helper-create-class-features-plugin": "^7.8.3", + "@babel/helper-plugin-utils": "^7.8.3" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.4.4", - "@babel/helper-plugin-test-runner": "^7.0.0" + "@babel/core": "^7.8.3", + "@babel/helper-plugin-test-runner": "^7.8.3" } } diff --git a/packages/babel-plugin-proposal-private-methods/test/fixtures/accessors-loose/get-only-setter/output.js b/packages/babel-plugin-proposal-private-methods/test/fixtures/accessors-loose/get-only-setter/output.js index 05866e2142fb..9d7d52b847b8 100644 --- a/packages/babel-plugin-proposal-private-methods/test/fixtures/accessors-loose/get-only-setter/output.js +++ b/packages/babel-plugin-proposal-private-methods/test/fixtures/accessors-loose/get-only-setter/output.js @@ -1,6 +1,7 @@ class Cl { constructor() { Object.defineProperty(this, _privateFieldValue, { + get: void 0, set: _set_privateFieldValue }); Object.defineProperty(this, _privateField, { diff --git a/packages/babel-plugin-proposal-private-methods/test/fixtures/accessors-loose/set-only-getter/output.js b/packages/babel-plugin-proposal-private-methods/test/fixtures/accessors-loose/set-only-getter/output.js index 57a8789016fa..eb046676cf54 100644 --- a/packages/babel-plugin-proposal-private-methods/test/fixtures/accessors-loose/set-only-getter/output.js +++ b/packages/babel-plugin-proposal-private-methods/test/fixtures/accessors-loose/set-only-getter/output.js @@ -1,7 +1,8 @@ class Cl { constructor() { Object.defineProperty(this, _privateFieldValue, { - get: _get_privateFieldValue + get: _get_privateFieldValue, + set: void 0 }); Object.defineProperty(this, _privateField, { writable: true, diff --git a/packages/babel-plugin-proposal-private-methods/test/fixtures/accessors/get-only-setter/output.js b/packages/babel-plugin-proposal-private-methods/test/fixtures/accessors/get-only-setter/output.js index 0906668c51fe..15691ee34a50 100644 --- a/packages/babel-plugin-proposal-private-methods/test/fixtures/accessors/get-only-setter/output.js +++ b/packages/babel-plugin-proposal-private-methods/test/fixtures/accessors/get-only-setter/output.js @@ -1,6 +1,7 @@ class Cl { constructor() { _privateFieldValue.set(this, { + get: void 0, set: _set_privateFieldValue }); diff --git a/packages/babel-plugin-proposal-private-methods/test/fixtures/accessors/set-only-getter/output.js b/packages/babel-plugin-proposal-private-methods/test/fixtures/accessors/set-only-getter/output.js index 4ea497e71a17..e301c07805de 100644 --- a/packages/babel-plugin-proposal-private-methods/test/fixtures/accessors/set-only-getter/output.js +++ b/packages/babel-plugin-proposal-private-methods/test/fixtures/accessors/set-only-getter/output.js @@ -1,7 +1,8 @@ class Cl { constructor() { _privateFieldValue.set(this, { - get: _get_privateFieldValue + get: _get_privateFieldValue, + set: void 0 }); _privateField.set(this, { diff --git a/packages/babel-plugin-proposal-private-methods/test/fixtures/duplicated-names/get-get/options.json b/packages/babel-plugin-proposal-private-methods/test/fixtures/duplicated-names/get-get/options.json index 9c0ba0e4b46a..49dcfc816842 100644 --- a/packages/babel-plugin-proposal-private-methods/test/fixtures/duplicated-names/get-get/options.json +++ b/packages/babel-plugin-proposal-private-methods/test/fixtures/duplicated-names/get-get/options.json @@ -1,3 +1,3 @@ { - "throws": "Duplicate private field" + "throws": "Duplicate private name #getSet" } diff --git a/packages/babel-plugin-proposal-private-methods/test/fixtures/duplicated-names/get-method/options.json b/packages/babel-plugin-proposal-private-methods/test/fixtures/duplicated-names/get-method/options.json index 9c0ba0e4b46a..1edb048c1285 100644 --- a/packages/babel-plugin-proposal-private-methods/test/fixtures/duplicated-names/get-method/options.json +++ b/packages/babel-plugin-proposal-private-methods/test/fixtures/duplicated-names/get-method/options.json @@ -1,3 +1,3 @@ { - "throws": "Duplicate private field" + "throws": "Duplicate private name #foo" } diff --git a/packages/babel-plugin-proposal-private-methods/test/fixtures/duplicated-names/method-get/options.json b/packages/babel-plugin-proposal-private-methods/test/fixtures/duplicated-names/method-get/options.json index 9c0ba0e4b46a..1edb048c1285 100644 --- a/packages/babel-plugin-proposal-private-methods/test/fixtures/duplicated-names/method-get/options.json +++ b/packages/babel-plugin-proposal-private-methods/test/fixtures/duplicated-names/method-get/options.json @@ -1,3 +1,3 @@ { - "throws": "Duplicate private field" + "throws": "Duplicate private name #foo" } diff --git a/packages/babel-plugin-proposal-private-methods/test/fixtures/duplicated-names/method-method/options.json b/packages/babel-plugin-proposal-private-methods/test/fixtures/duplicated-names/method-method/options.json index 9c0ba0e4b46a..b3e2e5dade0d 100644 --- a/packages/babel-plugin-proposal-private-methods/test/fixtures/duplicated-names/method-method/options.json +++ b/packages/babel-plugin-proposal-private-methods/test/fixtures/duplicated-names/method-method/options.json @@ -1,3 +1,3 @@ { - "throws": "Duplicate private field" + "throws": "Duplicate private name #dank" } diff --git a/packages/babel-plugin-proposal-private-methods/test/fixtures/duplicated-names/method-set/options.json b/packages/babel-plugin-proposal-private-methods/test/fixtures/duplicated-names/method-set/options.json index 9c0ba0e4b46a..1edb048c1285 100644 --- a/packages/babel-plugin-proposal-private-methods/test/fixtures/duplicated-names/method-set/options.json +++ b/packages/babel-plugin-proposal-private-methods/test/fixtures/duplicated-names/method-set/options.json @@ -1,3 +1,3 @@ { - "throws": "Duplicate private field" + "throws": "Duplicate private name #foo" } diff --git a/packages/babel-plugin-proposal-private-methods/test/fixtures/duplicated-names/set-method/options.json b/packages/babel-plugin-proposal-private-methods/test/fixtures/duplicated-names/set-method/options.json index 9c0ba0e4b46a..1edb048c1285 100644 --- a/packages/babel-plugin-proposal-private-methods/test/fixtures/duplicated-names/set-method/options.json +++ b/packages/babel-plugin-proposal-private-methods/test/fixtures/duplicated-names/set-method/options.json @@ -1,3 +1,3 @@ { - "throws": "Duplicate private field" + "throws": "Duplicate private name #foo" } diff --git a/packages/babel-plugin-proposal-private-methods/test/fixtures/duplicated-names/set-set/options.json b/packages/babel-plugin-proposal-private-methods/test/fixtures/duplicated-names/set-set/options.json index 9c0ba0e4b46a..49dcfc816842 100644 --- a/packages/babel-plugin-proposal-private-methods/test/fixtures/duplicated-names/set-set/options.json +++ b/packages/babel-plugin-proposal-private-methods/test/fixtures/duplicated-names/set-set/options.json @@ -1,3 +1,3 @@ { - "throws": "Duplicate private field" + "throws": "Duplicate private name #getSet" } diff --git a/packages/babel-plugin-proposal-private-methods/test/fixtures/private-static-method-loose/this/output.js b/packages/babel-plugin-proposal-private-methods/test/fixtures/private-static-method-loose/this/output.js index 4a5cddf8618c..0bccfda42bec 100644 --- a/packages/babel-plugin-proposal-private-methods/test/fixtures/private-static-method-loose/this/output.js +++ b/packages/babel-plugin-proposal-private-methods/test/fixtures/private-static-method-loose/this/output.js @@ -20,6 +20,10 @@ var _getA = babelHelpers.classPrivateFieldLooseKey("getA"); var _getB = babelHelpers.classPrivateFieldLooseKey("getB"); +var _getB2 = function _getB2() { + return this.b; +}; + var _getA2 = function _getA2() { return A.a; }; @@ -27,11 +31,6 @@ var _getA2 = function _getA2() { Object.defineProperty(B, _getA, { value: _getA2 }); - -var _getB2 = function _getB2() { - return this.b; -}; - Object.defineProperty(B, _getB, { value: _getB2 }); diff --git a/packages/babel-plugin-proposal-private-methods/test/fixtures/private-static-method/this/output.js b/packages/babel-plugin-proposal-private-methods/test/fixtures/private-static-method/this/output.js index e440955ecc99..49a4f4a7c600 100644 --- a/packages/babel-plugin-proposal-private-methods/test/fixtures/private-static-method/this/output.js +++ b/packages/babel-plugin-proposal-private-methods/test/fixtures/private-static-method/this/output.js @@ -16,12 +16,12 @@ class B extends A { } -var _getA = function _getA() { - return babelHelpers.get(babelHelpers.getPrototypeOf(B), "a", this); -}; - var _getB = function _getB() { return this.b; }; +var _getA = function _getA() { + return babelHelpers.get(babelHelpers.getPrototypeOf(B), "a", this); +}; + var [getA, getB] = B.extract(); diff --git a/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors-loose/basic/exec.js b/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors-loose/basic/exec.js new file mode 100644 index 000000000000..791a59034af9 --- /dev/null +++ b/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors-loose/basic/exec.js @@ -0,0 +1,23 @@ +class Cl { + static #PRIVATE_STATIC_FIELD = "top secret string"; + + static get #privateStaticFieldValue() { + return Cl.#PRIVATE_STATIC_FIELD; + } + + static set #privateStaticFieldValue(newValue) { + Cl.#PRIVATE_STATIC_FIELD = `Updated: ${newValue}`; + } + + static getValue() { + return Cl.#privateStaticFieldValue; + } + + static setValue() { + Cl.#privateStaticFieldValue = "dank"; + } +} + +expect(Cl.getValue()).toEqual("top secret string"); +Cl.setValue(); +expect(Cl.getValue()).toEqual("Updated: dank"); \ No newline at end of file diff --git a/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors-loose/basic/input.js b/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors-loose/basic/input.js new file mode 100644 index 000000000000..c79cdbe5ff0e --- /dev/null +++ b/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors-loose/basic/input.js @@ -0,0 +1,19 @@ +class Cl { + static #PRIVATE_STATIC_FIELD = "top secret string"; + + static get #privateStaticFieldValue() { + return Cl.#PRIVATE_STATIC_FIELD; + } + + static set #privateStaticFieldValue(newValue) { + Cl.#PRIVATE_STATIC_FIELD = `Updated: ${newValue}`; + } + + static getValue() { + return Cl.#privateStaticFieldValue; + } + + static setValue() { + Cl.#privateStaticFieldValue = "dank"; + } +} \ No newline at end of file diff --git a/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors-loose/basic/output.js b/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors-loose/basic/output.js new file mode 100644 index 000000000000..83619d5323e6 --- /dev/null +++ b/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors-loose/basic/output.js @@ -0,0 +1,31 @@ +class Cl { + static getValue() { + return babelHelpers.classPrivateFieldLooseBase(Cl, _privateStaticFieldValue)[_privateStaticFieldValue]; + } + + static setValue() { + babelHelpers.classPrivateFieldLooseBase(Cl, _privateStaticFieldValue)[_privateStaticFieldValue] = "dank"; + } + +} + +var _PRIVATE_STATIC_FIELD = babelHelpers.classPrivateFieldLooseKey("PRIVATE_STATIC_FIELD"); + +var _privateStaticFieldValue = babelHelpers.classPrivateFieldLooseKey("privateStaticFieldValue"); + +var _set_privateStaticFieldValue = function (newValue) { + babelHelpers.classPrivateFieldLooseBase(Cl, _PRIVATE_STATIC_FIELD)[_PRIVATE_STATIC_FIELD] = `Updated: ${newValue}`; +}; + +var _get_privateStaticFieldValue = function () { + return babelHelpers.classPrivateFieldLooseBase(Cl, _PRIVATE_STATIC_FIELD)[_PRIVATE_STATIC_FIELD]; +}; + +Object.defineProperty(Cl, _PRIVATE_STATIC_FIELD, { + writable: true, + value: "top secret string" +}); +Object.defineProperty(Cl, _privateStaticFieldValue, { + get: _get_privateStaticFieldValue, + set: _set_privateStaticFieldValue +}); diff --git a/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors-loose/get-only-setter/exec.js b/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors-loose/get-only-setter/exec.js new file mode 100644 index 000000000000..0c14f25c0938 --- /dev/null +++ b/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors-loose/get-only-setter/exec.js @@ -0,0 +1,13 @@ +class Cl { + static #PRIVATE_STATIC_FIELD = 0; + + static set #privateStaticFieldValue(newValue) { + Cl.#PRIVATE_STATIC_FIELD = newValue; + } + + static getPrivateStaticFieldValue() { + return Cl.#privateStaticFieldValue; + } +} + +expect(Cl.getPrivateStaticFieldValue()).toBeUndefined(); \ No newline at end of file diff --git a/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors-loose/get-only-setter/input.js b/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors-loose/get-only-setter/input.js new file mode 100644 index 000000000000..ab8771074ec7 --- /dev/null +++ b/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors-loose/get-only-setter/input.js @@ -0,0 +1,11 @@ +class Cl { + static #PRIVATE_STATIC_FIELD = 0; + + static set #privateStaticFieldValue(newValue) { + Cl.#PRIVATE_STATIC_FIELD = newValue; + } + + static getPrivateStaticFieldValue() { + return Cl.#privateStaticFieldValue; + } +} \ No newline at end of file diff --git a/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors-loose/get-only-setter/output.js b/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors-loose/get-only-setter/output.js new file mode 100644 index 000000000000..adb85a9ead8c --- /dev/null +++ b/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors-loose/get-only-setter/output.js @@ -0,0 +1,23 @@ +class Cl { + static getPrivateStaticFieldValue() { + return babelHelpers.classPrivateFieldLooseBase(Cl, _privateStaticFieldValue)[_privateStaticFieldValue]; + } + +} + +var _PRIVATE_STATIC_FIELD = babelHelpers.classPrivateFieldLooseKey("PRIVATE_STATIC_FIELD"); + +var _privateStaticFieldValue = babelHelpers.classPrivateFieldLooseKey("privateStaticFieldValue"); + +var _set_privateStaticFieldValue = function (newValue) { + babelHelpers.classPrivateFieldLooseBase(Cl, _PRIVATE_STATIC_FIELD)[_PRIVATE_STATIC_FIELD] = newValue; +}; + +Object.defineProperty(Cl, _PRIVATE_STATIC_FIELD, { + writable: true, + value: 0 +}); +Object.defineProperty(Cl, _privateStaticFieldValue, { + get: void 0, + set: _set_privateStaticFieldValue +}); diff --git a/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors-loose/options.json b/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors-loose/options.json new file mode 100644 index 000000000000..50c7612f8387 --- /dev/null +++ b/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors-loose/options.json @@ -0,0 +1,14 @@ +{ + "plugins": [ + [ + "external-helpers", + { + "helperVersion": "7.1000.0" + } + ], + ["proposal-private-methods", { "loose": true }], + ["proposal-class-properties", { "loose": true }], + "transform-block-scoping", + "syntax-class-properties" + ] +} diff --git a/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors-loose/set-only-getter/exec.js b/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors-loose/set-only-getter/exec.js new file mode 100644 index 000000000000..7069abfadc9d --- /dev/null +++ b/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors-loose/set-only-getter/exec.js @@ -0,0 +1,13 @@ +class Cl { + static #PRIVATE_STATIC_FIELD = 0; + + static get #privateStaticFieldValue() { + return Cl.#PRIVATE_STATIC_FIELD; + } + + static setPrivateStaticFieldValue() { + Cl.#privateStaticFieldValue = 1; + } +} + +expect(() => Cl.setPrivateStaticFieldValue()).toThrow(TypeError); \ No newline at end of file diff --git a/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors-loose/set-only-getter/input.js b/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors-loose/set-only-getter/input.js new file mode 100644 index 000000000000..d54ce4e2c2d0 --- /dev/null +++ b/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors-loose/set-only-getter/input.js @@ -0,0 +1,11 @@ +class Cl { + static #PRIVATE_STATIC_FIELD = 0; + + static get #privateStaticFieldValue() { + return Cl.#PRIVATE_STATIC_FIELD; + } + + static setPrivateStaticFieldValue() { + Cl.#privateStaticFieldValue = 1; + } +} \ No newline at end of file diff --git a/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors-loose/set-only-getter/output.js b/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors-loose/set-only-getter/output.js new file mode 100644 index 000000000000..73e658037394 --- /dev/null +++ b/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors-loose/set-only-getter/output.js @@ -0,0 +1,23 @@ +class Cl { + static setPrivateStaticFieldValue() { + babelHelpers.classPrivateFieldLooseBase(Cl, _privateStaticFieldValue)[_privateStaticFieldValue] = 1; + } + +} + +var _PRIVATE_STATIC_FIELD = babelHelpers.classPrivateFieldLooseKey("PRIVATE_STATIC_FIELD"); + +var _privateStaticFieldValue = babelHelpers.classPrivateFieldLooseKey("privateStaticFieldValue"); + +var _get_privateStaticFieldValue = function () { + return babelHelpers.classPrivateFieldLooseBase(Cl, _PRIVATE_STATIC_FIELD)[_PRIVATE_STATIC_FIELD]; +}; + +Object.defineProperty(Cl, _PRIVATE_STATIC_FIELD, { + writable: true, + value: 0 +}); +Object.defineProperty(Cl, _privateStaticFieldValue, { + get: _get_privateStaticFieldValue, + set: void 0 +}); diff --git a/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors-loose/updates/exec.js b/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors-loose/updates/exec.js new file mode 100644 index 000000000000..05f70aecceec --- /dev/null +++ b/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors-loose/updates/exec.js @@ -0,0 +1,46 @@ +class Cl { + static #privateField = "top secret string"; + static publicField = "not secret string"; + + static get #privateFieldValue() { + return Cl.#privateField; + } + + static set #privateFieldValue(newValue) { + Cl.#privateField = newValue; + } + + static publicGetPrivateField() { + return Cl.#privateFieldValue; + } + + static publicSetPrivateField(newValue) { + Cl.#privateFieldValue = newValue; + } + + static get publicFieldValue() { + return Cl.publicField; + } + + static set publicFieldValue(newValue) { + Cl.publicField = newValue; + } + + static testUpdates() { + Cl.#privateField = 0; + Cl.publicField = 0; + Cl.#privateFieldValue = Cl.#privateFieldValue++; + Cl.publicFieldValue = Cl.publicFieldValue++; + expect(Cl.#privateField).toEqual(Cl.publicField); + + ++Cl.#privateFieldValue; + ++Cl.publicFieldValue; + expect(Cl.#privateField).toEqual(Cl.publicField); + + Cl.#privateFieldValue += 1; + Cl.publicFieldValue += 1; + expect(Cl.#privateField).toEqual(Cl.publicField); + } +} + +Cl.testUpdates(); \ No newline at end of file diff --git a/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors-loose/updates/input.js b/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors-loose/updates/input.js new file mode 100644 index 000000000000..33c7b39d9cb4 --- /dev/null +++ b/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors-loose/updates/input.js @@ -0,0 +1,44 @@ +class Cl { + static #privateField = "top secret string"; + static publicField = "not secret string"; + + static get #privateFieldValue() { + return Cl.#privateField; + } + + static set #privateFieldValue(newValue) { + Cl.#privateField = newValue; + } + + static publicGetPrivateField() { + return Cl.#privateFieldValue; + } + + static publicSetPrivateField(newValue) { + Cl.#privateFieldValue = newValue; + } + + static get publicFieldValue() { + return Cl.publicField; + } + + static set publicFieldValue(newValue) { + Cl.publicField = newValue; + } + + static testUpdates() { + Cl.#privateField = 0; + Cl.publicField = 0; + Cl.#privateFieldValue = Cl.#privateFieldValue++; + Cl.publicFieldValue = Cl.publicFieldValue++; + + ++Cl.#privateFieldValue; + ++Cl.publicFieldValue; + + Cl.#privateFieldValue += 1; + Cl.publicFieldValue += 1; + + Cl.#privateFieldValue = -(Cl.#privateFieldValue ** Cl.#privateFieldValue); + Cl.publicFieldValue = -(Cl.publicFieldValue ** Cl.publicFieldValue); + } +} \ No newline at end of file diff --git a/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors-loose/updates/output.js b/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors-loose/updates/output.js new file mode 100644 index 000000000000..b75fa4a4d18c --- /dev/null +++ b/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors-loose/updates/output.js @@ -0,0 +1,53 @@ +class Cl { + static publicGetPrivateField() { + return babelHelpers.classPrivateFieldLooseBase(Cl, _privateFieldValue)[_privateFieldValue]; + } + + static publicSetPrivateField(newValue) { + babelHelpers.classPrivateFieldLooseBase(Cl, _privateFieldValue)[_privateFieldValue] = newValue; + } + + static get publicFieldValue() { + return Cl.publicField; + } + + static set publicFieldValue(newValue) { + Cl.publicField = newValue; + } + + static testUpdates() { + babelHelpers.classPrivateFieldLooseBase(Cl, _privateField)[_privateField] = 0; + Cl.publicField = 0; + babelHelpers.classPrivateFieldLooseBase(Cl, _privateFieldValue)[_privateFieldValue] = babelHelpers.classPrivateFieldLooseBase(Cl, _privateFieldValue)[_privateFieldValue]++; + Cl.publicFieldValue = Cl.publicFieldValue++; + ++babelHelpers.classPrivateFieldLooseBase(Cl, _privateFieldValue)[_privateFieldValue]; + ++Cl.publicFieldValue; + babelHelpers.classPrivateFieldLooseBase(Cl, _privateFieldValue)[_privateFieldValue] += 1; + Cl.publicFieldValue += 1; + babelHelpers.classPrivateFieldLooseBase(Cl, _privateFieldValue)[_privateFieldValue] = -(babelHelpers.classPrivateFieldLooseBase(Cl, _privateFieldValue)[_privateFieldValue] ** babelHelpers.classPrivateFieldLooseBase(Cl, _privateFieldValue)[_privateFieldValue]); + Cl.publicFieldValue = -(Cl.publicFieldValue ** Cl.publicFieldValue); + } + +} + +var _privateField = babelHelpers.classPrivateFieldLooseKey("privateField"); + +var _privateFieldValue = babelHelpers.classPrivateFieldLooseKey("privateFieldValue"); + +var _set_privateFieldValue = function (newValue) { + babelHelpers.classPrivateFieldLooseBase(Cl, _privateField)[_privateField] = newValue; +}; + +var _get_privateFieldValue = function () { + return babelHelpers.classPrivateFieldLooseBase(Cl, _privateField)[_privateField]; +}; + +Object.defineProperty(Cl, _privateField, { + writable: true, + value: "top secret string" +}); +Cl.publicField = "not secret string"; +Object.defineProperty(Cl, _privateFieldValue, { + get: _get_privateFieldValue, + set: _set_privateFieldValue +}); diff --git a/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors/basic/exec.js b/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors/basic/exec.js new file mode 100644 index 000000000000..791a59034af9 --- /dev/null +++ b/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors/basic/exec.js @@ -0,0 +1,23 @@ +class Cl { + static #PRIVATE_STATIC_FIELD = "top secret string"; + + static get #privateStaticFieldValue() { + return Cl.#PRIVATE_STATIC_FIELD; + } + + static set #privateStaticFieldValue(newValue) { + Cl.#PRIVATE_STATIC_FIELD = `Updated: ${newValue}`; + } + + static getValue() { + return Cl.#privateStaticFieldValue; + } + + static setValue() { + Cl.#privateStaticFieldValue = "dank"; + } +} + +expect(Cl.getValue()).toEqual("top secret string"); +Cl.setValue(); +expect(Cl.getValue()).toEqual("Updated: dank"); \ No newline at end of file diff --git a/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors/basic/input.js b/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors/basic/input.js new file mode 100644 index 000000000000..c79cdbe5ff0e --- /dev/null +++ b/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors/basic/input.js @@ -0,0 +1,19 @@ +class Cl { + static #PRIVATE_STATIC_FIELD = "top secret string"; + + static get #privateStaticFieldValue() { + return Cl.#PRIVATE_STATIC_FIELD; + } + + static set #privateStaticFieldValue(newValue) { + Cl.#PRIVATE_STATIC_FIELD = `Updated: ${newValue}`; + } + + static getValue() { + return Cl.#privateStaticFieldValue; + } + + static setValue() { + Cl.#privateStaticFieldValue = "dank"; + } +} \ No newline at end of file diff --git a/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors/basic/output.js b/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors/basic/output.js new file mode 100644 index 000000000000..7dc0b26977eb --- /dev/null +++ b/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors/basic/output.js @@ -0,0 +1,27 @@ +class Cl { + static getValue() { + return babelHelpers.classStaticPrivateFieldSpecGet(Cl, Cl, _privateStaticFieldValue); + } + + static setValue() { + babelHelpers.classStaticPrivateFieldSpecSet(Cl, Cl, _privateStaticFieldValue, "dank"); + } + +} + +var _set_privateStaticFieldValue = function (newValue) { + babelHelpers.classStaticPrivateFieldSpecSet(Cl, Cl, _PRIVATE_STATIC_FIELD, `Updated: ${newValue}`); +}; + +var _get_privateStaticFieldValue = function () { + return babelHelpers.classStaticPrivateFieldSpecGet(Cl, Cl, _PRIVATE_STATIC_FIELD); +}; + +var _PRIVATE_STATIC_FIELD = { + writable: true, + value: "top secret string" +}; +var _privateStaticFieldValue = { + get: _get_privateStaticFieldValue, + set: _set_privateStaticFieldValue +}; diff --git a/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors/get-only-setter/exec.js b/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors/get-only-setter/exec.js new file mode 100644 index 000000000000..0c14f25c0938 --- /dev/null +++ b/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors/get-only-setter/exec.js @@ -0,0 +1,13 @@ +class Cl { + static #PRIVATE_STATIC_FIELD = 0; + + static set #privateStaticFieldValue(newValue) { + Cl.#PRIVATE_STATIC_FIELD = newValue; + } + + static getPrivateStaticFieldValue() { + return Cl.#privateStaticFieldValue; + } +} + +expect(Cl.getPrivateStaticFieldValue()).toBeUndefined(); \ No newline at end of file diff --git a/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors/get-only-setter/input.js b/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors/get-only-setter/input.js new file mode 100644 index 000000000000..ab8771074ec7 --- /dev/null +++ b/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors/get-only-setter/input.js @@ -0,0 +1,11 @@ +class Cl { + static #PRIVATE_STATIC_FIELD = 0; + + static set #privateStaticFieldValue(newValue) { + Cl.#PRIVATE_STATIC_FIELD = newValue; + } + + static getPrivateStaticFieldValue() { + return Cl.#privateStaticFieldValue; + } +} \ No newline at end of file diff --git a/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors/get-only-setter/output.js b/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors/get-only-setter/output.js new file mode 100644 index 000000000000..31c1bf46873e --- /dev/null +++ b/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors/get-only-setter/output.js @@ -0,0 +1,19 @@ +class Cl { + static getPrivateStaticFieldValue() { + return babelHelpers.classStaticPrivateFieldSpecGet(Cl, Cl, _privateStaticFieldValue); + } + +} + +var _set_privateStaticFieldValue = function (newValue) { + babelHelpers.classStaticPrivateFieldSpecSet(Cl, Cl, _PRIVATE_STATIC_FIELD, newValue); +}; + +var _PRIVATE_STATIC_FIELD = { + writable: true, + value: 0 +}; +var _privateStaticFieldValue = { + get: void 0, + set: _set_privateStaticFieldValue +}; diff --git a/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors/options.json b/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors/options.json new file mode 100644 index 000000000000..c5e6649e4ea8 --- /dev/null +++ b/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors/options.json @@ -0,0 +1,14 @@ +{ + "plugins": [ + [ + "external-helpers", + { + "helperVersion": "7.1000.0" + } + ], + "proposal-private-methods", + "proposal-class-properties", + "transform-block-scoping", + "syntax-class-properties" + ] +} diff --git a/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors/set-only-getter/exec.js b/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors/set-only-getter/exec.js new file mode 100644 index 000000000000..7069abfadc9d --- /dev/null +++ b/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors/set-only-getter/exec.js @@ -0,0 +1,13 @@ +class Cl { + static #PRIVATE_STATIC_FIELD = 0; + + static get #privateStaticFieldValue() { + return Cl.#PRIVATE_STATIC_FIELD; + } + + static setPrivateStaticFieldValue() { + Cl.#privateStaticFieldValue = 1; + } +} + +expect(() => Cl.setPrivateStaticFieldValue()).toThrow(TypeError); \ No newline at end of file diff --git a/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors/set-only-getter/input.js b/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors/set-only-getter/input.js new file mode 100644 index 000000000000..d54ce4e2c2d0 --- /dev/null +++ b/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors/set-only-getter/input.js @@ -0,0 +1,11 @@ +class Cl { + static #PRIVATE_STATIC_FIELD = 0; + + static get #privateStaticFieldValue() { + return Cl.#PRIVATE_STATIC_FIELD; + } + + static setPrivateStaticFieldValue() { + Cl.#privateStaticFieldValue = 1; + } +} \ No newline at end of file diff --git a/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors/set-only-getter/output.js b/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors/set-only-getter/output.js new file mode 100644 index 000000000000..fa3aebd45bfc --- /dev/null +++ b/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors/set-only-getter/output.js @@ -0,0 +1,19 @@ +class Cl { + static setPrivateStaticFieldValue() { + babelHelpers.classStaticPrivateFieldSpecSet(Cl, Cl, _privateStaticFieldValue, 1); + } + +} + +var _get_privateStaticFieldValue = function () { + return babelHelpers.classStaticPrivateFieldSpecGet(Cl, Cl, _PRIVATE_STATIC_FIELD); +}; + +var _PRIVATE_STATIC_FIELD = { + writable: true, + value: 0 +}; +var _privateStaticFieldValue = { + get: _get_privateStaticFieldValue, + set: void 0 +}; diff --git a/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors/updates/exec.js b/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors/updates/exec.js new file mode 100644 index 000000000000..05f70aecceec --- /dev/null +++ b/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors/updates/exec.js @@ -0,0 +1,46 @@ +class Cl { + static #privateField = "top secret string"; + static publicField = "not secret string"; + + static get #privateFieldValue() { + return Cl.#privateField; + } + + static set #privateFieldValue(newValue) { + Cl.#privateField = newValue; + } + + static publicGetPrivateField() { + return Cl.#privateFieldValue; + } + + static publicSetPrivateField(newValue) { + Cl.#privateFieldValue = newValue; + } + + static get publicFieldValue() { + return Cl.publicField; + } + + static set publicFieldValue(newValue) { + Cl.publicField = newValue; + } + + static testUpdates() { + Cl.#privateField = 0; + Cl.publicField = 0; + Cl.#privateFieldValue = Cl.#privateFieldValue++; + Cl.publicFieldValue = Cl.publicFieldValue++; + expect(Cl.#privateField).toEqual(Cl.publicField); + + ++Cl.#privateFieldValue; + ++Cl.publicFieldValue; + expect(Cl.#privateField).toEqual(Cl.publicField); + + Cl.#privateFieldValue += 1; + Cl.publicFieldValue += 1; + expect(Cl.#privateField).toEqual(Cl.publicField); + } +} + +Cl.testUpdates(); \ No newline at end of file diff --git a/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors/updates/input.js b/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors/updates/input.js new file mode 100644 index 000000000000..33c7b39d9cb4 --- /dev/null +++ b/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors/updates/input.js @@ -0,0 +1,44 @@ +class Cl { + static #privateField = "top secret string"; + static publicField = "not secret string"; + + static get #privateFieldValue() { + return Cl.#privateField; + } + + static set #privateFieldValue(newValue) { + Cl.#privateField = newValue; + } + + static publicGetPrivateField() { + return Cl.#privateFieldValue; + } + + static publicSetPrivateField(newValue) { + Cl.#privateFieldValue = newValue; + } + + static get publicFieldValue() { + return Cl.publicField; + } + + static set publicFieldValue(newValue) { + Cl.publicField = newValue; + } + + static testUpdates() { + Cl.#privateField = 0; + Cl.publicField = 0; + Cl.#privateFieldValue = Cl.#privateFieldValue++; + Cl.publicFieldValue = Cl.publicFieldValue++; + + ++Cl.#privateFieldValue; + ++Cl.publicFieldValue; + + Cl.#privateFieldValue += 1; + Cl.publicFieldValue += 1; + + Cl.#privateFieldValue = -(Cl.#privateFieldValue ** Cl.#privateFieldValue); + Cl.publicFieldValue = -(Cl.publicFieldValue ** Cl.publicFieldValue); + } +} \ No newline at end of file diff --git a/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors/updates/output.js b/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors/updates/output.js new file mode 100644 index 000000000000..1869c5b6ead8 --- /dev/null +++ b/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors/updates/output.js @@ -0,0 +1,51 @@ +class Cl { + static publicGetPrivateField() { + return babelHelpers.classStaticPrivateFieldSpecGet(Cl, Cl, _privateFieldValue); + } + + static publicSetPrivateField(newValue) { + babelHelpers.classStaticPrivateFieldSpecSet(Cl, Cl, _privateFieldValue, newValue); + } + + static get publicFieldValue() { + return Cl.publicField; + } + + static set publicFieldValue(newValue) { + Cl.publicField = newValue; + } + + static testUpdates() { + var _Cl$privateFieldValue, _Cl$privateFieldValue2; + + babelHelpers.classStaticPrivateFieldSpecSet(Cl, Cl, _privateField, 0); + Cl.publicField = 0; + babelHelpers.classStaticPrivateFieldSpecSet(Cl, Cl, _privateFieldValue, (babelHelpers.classStaticPrivateFieldSpecSet(Cl, Cl, _privateFieldValue, (_Cl$privateFieldValue2 = +babelHelpers.classStaticPrivateFieldSpecGet(Cl, Cl, _privateFieldValue)) + 1), _Cl$privateFieldValue2)); + Cl.publicFieldValue = Cl.publicFieldValue++; + babelHelpers.classStaticPrivateFieldSpecSet(Cl, Cl, _privateFieldValue, +babelHelpers.classStaticPrivateFieldSpecGet(Cl, Cl, _privateFieldValue) + 1); + ++Cl.publicFieldValue; + babelHelpers.classStaticPrivateFieldSpecSet(Cl, Cl, _privateFieldValue, babelHelpers.classStaticPrivateFieldSpecGet(Cl, Cl, _privateFieldValue) + 1); + Cl.publicFieldValue += 1; + babelHelpers.classStaticPrivateFieldSpecSet(Cl, Cl, _privateFieldValue, -(babelHelpers.classStaticPrivateFieldSpecGet(Cl, Cl, _privateFieldValue) ** babelHelpers.classStaticPrivateFieldSpecGet(Cl, Cl, _privateFieldValue))); + Cl.publicFieldValue = -(Cl.publicFieldValue ** Cl.publicFieldValue); + } + +} + +var _set_privateFieldValue = function (newValue) { + babelHelpers.classStaticPrivateFieldSpecSet(Cl, Cl, _privateField, newValue); +}; + +var _get_privateFieldValue = function () { + return babelHelpers.classStaticPrivateFieldSpecGet(Cl, Cl, _privateField); +}; + +var _privateField = { + writable: true, + value: "top secret string" +}; +babelHelpers.defineProperty(Cl, "publicField", "not secret string"); +var _privateFieldValue = { + get: _get_privateFieldValue, + set: _set_privateFieldValue +}; diff --git a/packages/babel-plugin-proposal-throw-expressions/package.json b/packages/babel-plugin-proposal-throw-expressions/package.json index 2f6bc414a717..3c70650eb032 100644 --- a/packages/babel-plugin-proposal-throw-expressions/package.json +++ b/packages/babel-plugin-proposal-throw-expressions/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-proposal-throw-expressions", - "version": "7.2.0", + "version": "7.8.3", "description": "Wraps Throw Expressions in an IIFE", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-proposal-throw-expressions", "license": "MIT", @@ -12,14 +12,14 @@ "babel-plugin" ], "dependencies": { - "@babel/helper-plugin-utils": "^7.0.0", - "@babel/plugin-syntax-throw-expressions": "^7.2.0" + "@babel/helper-plugin-utils": "^7.8.3", + "@babel/plugin-syntax-throw-expressions": "^7.8.3" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.2.0", - "@babel/helper-plugin-test-runner": "^7.0.0" + "@babel/core": "^7.8.3", + "@babel/helper-plugin-test-runner": "^7.8.3" } } diff --git a/packages/babel-plugin-proposal-throw-expressions/test/fixtures/stupid-fixture-nesting-folder/await-in-argument/output.js b/packages/babel-plugin-proposal-throw-expressions/test/fixtures/stupid-fixture-nesting-folder/await-in-argument/output.js index f0d7fa4b5e76..489e10add99a 100644 --- a/packages/babel-plugin-proposal-throw-expressions/test/fixtures/stupid-fixture-nesting-folder/await-in-argument/output.js +++ b/packages/babel-plugin-proposal-throw-expressions/test/fixtures/stupid-fixture-nesting-folder/await-in-argument/output.js @@ -1,5 +1,5 @@ async function test() { (function (e) { throw e; - })(new Error((await 'test'))); + })(new Error(await 'test')); } diff --git a/packages/babel-plugin-proposal-throw-expressions/test/fixtures/stupid-fixture-nesting-folder/yield-in-argument/output.js b/packages/babel-plugin-proposal-throw-expressions/test/fixtures/stupid-fixture-nesting-folder/yield-in-argument/output.js index f8739d12fbb4..5fbea228f860 100644 --- a/packages/babel-plugin-proposal-throw-expressions/test/fixtures/stupid-fixture-nesting-folder/yield-in-argument/output.js +++ b/packages/babel-plugin-proposal-throw-expressions/test/fixtures/stupid-fixture-nesting-folder/yield-in-argument/output.js @@ -1,5 +1,5 @@ function* test() { (function (e) { throw e; - })(new Error((yield 'test'))); + })(new Error(yield 'test')); } diff --git a/packages/babel-plugin-proposal-unicode-property-regex/.npmignore b/packages/babel-plugin-proposal-unicode-property-regex/.npmignore new file mode 100644 index 000000000000..2b1fceba679b --- /dev/null +++ b/packages/babel-plugin-proposal-unicode-property-regex/.npmignore @@ -0,0 +1,3 @@ +*.log +src +test diff --git a/packages/babel-plugin-proposal-unicode-property-regex/package.json b/packages/babel-plugin-proposal-unicode-property-regex/package.json index 96bdc44c4698..8c83b241eaa6 100644 --- a/packages/babel-plugin-proposal-unicode-property-regex/package.json +++ b/packages/babel-plugin-proposal-unicode-property-regex/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-proposal-unicode-property-regex", - "version": "7.4.4", + "version": "7.8.8", "description": "Compile Unicode property escapes in Unicode regular expressions to ES5.", "homepage": "https://babeljs.io/", "license": "MIT", @@ -22,15 +22,14 @@ "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-proposal-unicode-property-regex", "bugs": "https://github.com/babel/babel/issues", "dependencies": { - "@babel/helper-plugin-utils": "^7.0.0", - "@babel/helper-regex": "^7.4.4", - "regexpu-core": "^4.5.4" + "@babel/helper-create-regexp-features-plugin": "^7.8.8", + "@babel/helper-plugin-utils": "^7.8.3" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.4.4", - "@babel/helper-plugin-test-runner": "^7.0.0" + "@babel/core": "^7.8.3", + "@babel/helper-plugin-test-runner": "^7.8.3" } } diff --git a/packages/babel-plugin-proposal-unicode-property-regex/src/index.js b/packages/babel-plugin-proposal-unicode-property-regex/src/index.js index b0245892311f..bf76031cbf12 100644 --- a/packages/babel-plugin-proposal-unicode-property-regex/src/index.js +++ b/packages/babel-plugin-proposal-unicode-property-regex/src/index.js @@ -1,6 +1,6 @@ +/* eslint-disable @babel/development/plugin-name */ +import { createRegExpFeaturePlugin } from "@babel/helper-create-regexp-features-plugin"; import { declare } from "@babel/helper-plugin-utils"; -import rewritePattern from "regexpu-core"; -import * as regex from "@babel/helper-regex"; export default declare((api, options) => { api.assertVersion(7); @@ -10,23 +10,9 @@ export default declare((api, options) => { throw new Error(".useUnicodeFlag must be a boolean, or undefined"); } - return { + return createRegExpFeaturePlugin({ name: "proposal-unicode-property-regex", - - visitor: { - RegExpLiteral(path) { - const node = path.node; - if (!regex.is(node, "u")) { - return; - } - node.pattern = rewritePattern(node.pattern, node.flags, { - unicodePropertyEscape: true, - useUnicodeFlag, - }); - if (!useUnicodeFlag) { - regex.pullFlag(node, "u"); - } - }, - }, - }; + feature: "unicodePropertyEscape", + options: { useUnicodeFlag }, + }); }); diff --git a/packages/babel-plugin-proposal-unicode-property-regex/test/fixtures/with-unicode-flag/unicode-12/input.js b/packages/babel-plugin-proposal-unicode-property-regex/test/fixtures/with-unicode-flag/unicode-12/input.js index 711dde943b3c..e50ab9eb68e0 100644 --- a/packages/babel-plugin-proposal-unicode-property-regex/test/fixtures/with-unicode-flag/unicode-12/input.js +++ b/packages/babel-plugin-proposal-unicode-property-regex/test/fixtures/with-unicode-flag/unicode-12/input.js @@ -1 +1 @@ -var regex = /[\u{1E2C0}-\u{1E2F9}\u{1E2FF}]/u; +var regex = /[\p{Script_Extensions=Wancho}]/u; diff --git a/packages/babel-plugin-proposal-unicode-property-regex/test/fixtures/with-unicode-flag/unicode-13/input.js b/packages/babel-plugin-proposal-unicode-property-regex/test/fixtures/with-unicode-flag/unicode-13/input.js new file mode 100644 index 000000000000..d77998ee4c06 --- /dev/null +++ b/packages/babel-plugin-proposal-unicode-property-regex/test/fixtures/with-unicode-flag/unicode-13/input.js @@ -0,0 +1 @@ +/\p{Script_Extensions=Yezi}/u; diff --git a/packages/babel-plugin-proposal-unicode-property-regex/test/fixtures/with-unicode-flag/unicode-13/output.js b/packages/babel-plugin-proposal-unicode-property-regex/test/fixtures/with-unicode-flag/unicode-13/output.js new file mode 100644 index 000000000000..30b392dcbfb4 --- /dev/null +++ b/packages/babel-plugin-proposal-unicode-property-regex/test/fixtures/with-unicode-flag/unicode-13/output.js @@ -0,0 +1 @@ +/[\u060C\u061B\u061F\u0660-\u0669\u{10E80}-\u{10EA9}\u{10EAB}-\u{10EAD}\u{10EB0}\u{10EB1}]/u; diff --git a/packages/babel-plugin-proposal-unicode-property-regex/test/fixtures/without-unicode-flag/unicode-13/input.js b/packages/babel-plugin-proposal-unicode-property-regex/test/fixtures/without-unicode-flag/unicode-13/input.js new file mode 100644 index 000000000000..d77998ee4c06 --- /dev/null +++ b/packages/babel-plugin-proposal-unicode-property-regex/test/fixtures/without-unicode-flag/unicode-13/input.js @@ -0,0 +1 @@ +/\p{Script_Extensions=Yezi}/u; diff --git a/packages/babel-plugin-proposal-unicode-property-regex/test/fixtures/without-unicode-flag/unicode-13/output.js b/packages/babel-plugin-proposal-unicode-property-regex/test/fixtures/without-unicode-flag/unicode-13/output.js new file mode 100644 index 000000000000..3382c609e611 --- /dev/null +++ b/packages/babel-plugin-proposal-unicode-property-regex/test/fixtures/without-unicode-flag/unicode-13/output.js @@ -0,0 +1 @@ +/(?:[\u060C\u061B\u061F\u0660-\u0669]|\uD803[\uDE80-\uDEA9\uDEAB-\uDEAD\uDEB0\uDEB1])/; diff --git a/packages/babel-plugin-syntax-async-generators/README.md b/packages/babel-plugin-syntax-async-generators/README.md deleted file mode 100644 index 4fdb68df562d..000000000000 --- a/packages/babel-plugin-syntax-async-generators/README.md +++ /dev/null @@ -1,19 +0,0 @@ -# @babel/plugin-syntax-async-generators - -> Allow parsing of async generator functions - -See our website [@babel/plugin-syntax-async-generators](https://babeljs.io/docs/en/next/babel-plugin-syntax-async-generators.html) for more information. - -## Install - -Using npm: - -```sh -npm install --save-dev @babel/plugin-syntax-async-generators -``` - -or using yarn: - -```sh -yarn add @babel/plugin-syntax-async-generators --dev -``` diff --git a/packages/babel-plugin-syntax-async-generators/package.json b/packages/babel-plugin-syntax-async-generators/package.json deleted file mode 100644 index 60a1702af977..000000000000 --- a/packages/babel-plugin-syntax-async-generators/package.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "name": "@babel/plugin-syntax-async-generators", - "version": "7.2.0", - "description": "Allow parsing of async generator functions", - "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-syntax-async-generators", - "license": "MIT", - "publishConfig": { - "access": "public" - }, - "main": "lib/index.js", - "keywords": [ - "babel-plugin" - ], - "dependencies": { - "@babel/helper-plugin-utils": "^7.0.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - }, - "devDependencies": { - "@babel/core": "^7.2.0" - } -} diff --git a/packages/babel-plugin-syntax-async-generators/src/index.js b/packages/babel-plugin-syntax-async-generators/src/index.js deleted file mode 100644 index e18612556b27..000000000000 --- a/packages/babel-plugin-syntax-async-generators/src/index.js +++ /dev/null @@ -1,13 +0,0 @@ -import { declare } from "@babel/helper-plugin-utils"; - -export default declare(api => { - api.assertVersion(7); - - return { - name: "syntax-async-generators", - - manipulateOptions(opts, parserOpts) { - parserOpts.plugins.push("asyncGenerators"); - }, - }; -}); diff --git a/packages/babel-plugin-syntax-bigint/README.md b/packages/babel-plugin-syntax-bigint/README.md deleted file mode 100644 index bb49aab8ee34..000000000000 --- a/packages/babel-plugin-syntax-bigint/README.md +++ /dev/null @@ -1,19 +0,0 @@ -# @babel/plugin-syntax-bigint - -> Allow parsing of BigInt literals - -See our website [@babel/plugin-syntax-bigint](https://babeljs.io/docs/en/next/babel-plugin-syntax-bigint.html) for more information. - -## Install - -Using npm: - -```sh -npm install --save-dev @babel/plugin-syntax-bigint -``` - -or using yarn: - -```sh -yarn add @babel/plugin-syntax-bigint --dev -``` diff --git a/packages/babel-plugin-syntax-bigint/package.json b/packages/babel-plugin-syntax-bigint/package.json deleted file mode 100644 index 9993d4d33f1a..000000000000 --- a/packages/babel-plugin-syntax-bigint/package.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "name": "@babel/plugin-syntax-bigint", - "version": "7.4.4", - "description": "Allow parsing of BigInt literals", - "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-syntax-bigint", - "license": "MIT", - "publishConfig": { - "access": "public" - }, - "main": "lib/index.js", - "keywords": [ - "babel-plugin" - ], - "dependencies": { - "@babel/helper-plugin-utils": "^7.0.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - }, - "devDependencies": { - "@babel/core": "^7.4.4" - } -} diff --git a/packages/babel-plugin-syntax-bigint/src/index.js b/packages/babel-plugin-syntax-bigint/src/index.js deleted file mode 100644 index 89129a5f06d4..000000000000 --- a/packages/babel-plugin-syntax-bigint/src/index.js +++ /dev/null @@ -1,13 +0,0 @@ -import { declare } from "@babel/helper-plugin-utils"; - -export default declare(api => { - api.assertVersion(7); - - return { - name: "syntax-bigint", - - manipulateOptions(opts, parserOpts) { - parserOpts.plugins.push("bigInt"); - }, - }; -}); diff --git a/packages/babel-plugin-syntax-class-properties/package.json b/packages/babel-plugin-syntax-class-properties/package.json index dba0685a8477..68cbc402a4c3 100644 --- a/packages/babel-plugin-syntax-class-properties/package.json +++ b/packages/babel-plugin-syntax-class-properties/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-syntax-class-properties", - "version": "7.2.0", + "version": "7.8.3", "description": "Allow parsing of class properties", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-syntax-class-properties", "license": "MIT", @@ -12,12 +12,12 @@ "babel-plugin" ], "dependencies": { - "@babel/helper-plugin-utils": "^7.0.0" + "@babel/helper-plugin-utils": "^7.8.3" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.2.0" + "@babel/core": "^7.8.3" } } diff --git a/packages/babel-plugin-syntax-decorators/package.json b/packages/babel-plugin-syntax-decorators/package.json index a8bae4e61af0..839628a32c4d 100644 --- a/packages/babel-plugin-syntax-decorators/package.json +++ b/packages/babel-plugin-syntax-decorators/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-syntax-decorators", - "version": "7.2.0", + "version": "7.8.3", "description": "Allow parsing of decorators", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-syntax-decorators", "license": "MIT", @@ -12,12 +12,12 @@ "babel-plugin" ], "dependencies": { - "@babel/helper-plugin-utils": "^7.0.0" + "@babel/helper-plugin-utils": "^7.8.3" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.2.0" + "@babel/core": "^7.8.3" } } diff --git a/packages/babel-plugin-syntax-decorators/test/index.js b/packages/babel-plugin-syntax-decorators/test/index.js index d84797d7bbf8..bd5ff21888f3 100644 --- a/packages/babel-plugin-syntax-decorators/test/index.js +++ b/packages/babel-plugin-syntax-decorators/test/index.js @@ -33,7 +33,7 @@ describe("'decoratorsBeforeExport' option", function() { expect(makeParser("", { decoratorsBeforeExport: "before" })).toThrow(); }); - test.skip("is required", function() { + test("is required", function() { expect(makeParser("", { legacy: false })).toThrow(/decoratorsBeforeExport/); }); diff --git a/packages/babel-plugin-syntax-do-expressions/package.json b/packages/babel-plugin-syntax-do-expressions/package.json index d95b511792ad..a7b8506891a8 100644 --- a/packages/babel-plugin-syntax-do-expressions/package.json +++ b/packages/babel-plugin-syntax-do-expressions/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-syntax-do-expressions", - "version": "7.2.0", + "version": "7.8.3", "description": "Allow parsing of do expressions", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-syntax-do-expressions", "license": "MIT", @@ -12,12 +12,12 @@ "babel-plugin" ], "dependencies": { - "@babel/helper-plugin-utils": "^7.0.0" + "@babel/helper-plugin-utils": "^7.8.3" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.2.0" + "@babel/core": "^7.8.3" } } diff --git a/packages/babel-plugin-syntax-dynamic-import/README.md b/packages/babel-plugin-syntax-dynamic-import/README.md deleted file mode 100644 index 127903505f21..000000000000 --- a/packages/babel-plugin-syntax-dynamic-import/README.md +++ /dev/null @@ -1,19 +0,0 @@ -# @babel/plugin-syntax-dynamic-import - -> Allow parsing of import() - -See our website [@babel/plugin-syntax-dynamic-import](https://babeljs.io/docs/en/next/babel-plugin-syntax-dynamic-import.html) for more information. - -## Install - -Using npm: - -```sh -npm install --save-dev @babel/plugin-syntax-dynamic-import -``` - -or using yarn: - -```sh -yarn add @babel/plugin-syntax-dynamic-import --dev -``` diff --git a/packages/babel-plugin-syntax-dynamic-import/package.json b/packages/babel-plugin-syntax-dynamic-import/package.json deleted file mode 100644 index 23240cbaa16e..000000000000 --- a/packages/babel-plugin-syntax-dynamic-import/package.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "name": "@babel/plugin-syntax-dynamic-import", - "version": "7.2.0", - "description": "Allow parsing of import()", - "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-syntax-dynamic-import", - "license": "MIT", - "publishConfig": { - "access": "public" - }, - "main": "lib/index.js", - "keywords": [ - "babel-plugin" - ], - "dependencies": { - "@babel/helper-plugin-utils": "^7.0.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - }, - "devDependencies": { - "@babel/core": "^7.2.0" - } -} diff --git a/packages/babel-plugin-syntax-dynamic-import/src/index.js b/packages/babel-plugin-syntax-dynamic-import/src/index.js deleted file mode 100644 index 13914e3ada57..000000000000 --- a/packages/babel-plugin-syntax-dynamic-import/src/index.js +++ /dev/null @@ -1,13 +0,0 @@ -import { declare } from "@babel/helper-plugin-utils"; - -export default declare(api => { - api.assertVersion(7); - - return { - name: "syntax-dynamic-import", - - manipulateOptions(opts, parserOpts) { - parserOpts.plugins.push("dynamicImport"); - }, - }; -}); diff --git a/packages/babel-plugin-syntax-export-default-from/package.json b/packages/babel-plugin-syntax-export-default-from/package.json index 7c2f2ab05435..e1c15ddba36c 100644 --- a/packages/babel-plugin-syntax-export-default-from/package.json +++ b/packages/babel-plugin-syntax-export-default-from/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-syntax-export-default-from", - "version": "7.2.0", + "version": "7.8.3", "description": "Allow parsing of export default from", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-syntax-export-default-from", "license": "MIT", @@ -12,12 +12,12 @@ "babel-plugin" ], "dependencies": { - "@babel/helper-plugin-utils": "^7.0.0" + "@babel/helper-plugin-utils": "^7.8.3" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.2.0" + "@babel/core": "^7.8.3" } } diff --git a/packages/babel-plugin-syntax-export-namespace-from/README.md b/packages/babel-plugin-syntax-export-namespace-from/README.md deleted file mode 100644 index 1f45440935f1..000000000000 --- a/packages/babel-plugin-syntax-export-namespace-from/README.md +++ /dev/null @@ -1,19 +0,0 @@ -# @babel/plugin-syntax-export-namespace-from - -> Allow parsing of export namespace from - -See our website [@babel/plugin-syntax-export-namespace-from](https://babeljs.io/docs/en/next/babel-plugin-syntax-export-namespace-from.html) for more information. - -## Install - -Using npm: - -```sh -npm install --save-dev @babel/plugin-syntax-export-namespace-from -``` - -or using yarn: - -```sh -yarn add @babel/plugin-syntax-export-namespace-from --dev -``` diff --git a/packages/babel-plugin-syntax-export-namespace-from/package.json b/packages/babel-plugin-syntax-export-namespace-from/package.json deleted file mode 100644 index fde4093e1be8..000000000000 --- a/packages/babel-plugin-syntax-export-namespace-from/package.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "name": "@babel/plugin-syntax-export-namespace-from", - "version": "7.2.0", - "description": "Allow parsing of export namespace from", - "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-syntax-export-namespace-from", - "license": "MIT", - "publishConfig": { - "access": "public" - }, - "main": "lib/index.js", - "keywords": [ - "babel-plugin" - ], - "dependencies": { - "@babel/helper-plugin-utils": "^7.0.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - }, - "devDependencies": { - "@babel/core": "^7.2.0" - } -} diff --git a/packages/babel-plugin-syntax-export-namespace-from/src/index.js b/packages/babel-plugin-syntax-export-namespace-from/src/index.js deleted file mode 100644 index 3bf85c518390..000000000000 --- a/packages/babel-plugin-syntax-export-namespace-from/src/index.js +++ /dev/null @@ -1,13 +0,0 @@ -import { declare } from "@babel/helper-plugin-utils"; - -export default declare(api => { - api.assertVersion(7); - - return { - name: "syntax-export-namespace-from", - - manipulateOptions(opts, parserOpts) { - parserOpts.plugins.push("exportNamespaceFrom"); - }, - }; -}); diff --git a/packages/babel-plugin-syntax-flow/package.json b/packages/babel-plugin-syntax-flow/package.json index 864023567a5d..b762f6da4157 100644 --- a/packages/babel-plugin-syntax-flow/package.json +++ b/packages/babel-plugin-syntax-flow/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-syntax-flow", - "version": "7.2.0", + "version": "7.8.3", "description": "Allow parsing of the flow syntax", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-syntax-flow", "license": "MIT", @@ -12,12 +12,12 @@ "babel-plugin" ], "dependencies": { - "@babel/helper-plugin-utils": "^7.0.0" + "@babel/helper-plugin-utils": "^7.8.3" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.2.0" + "@babel/core": "^7.8.3" } } diff --git a/packages/babel-plugin-syntax-flow/src/index.js b/packages/babel-plugin-syntax-flow/src/index.js index 0062dbee50e6..72fb7dc60b95 100644 --- a/packages/babel-plugin-syntax-flow/src/index.js +++ b/packages/babel-plugin-syntax-flow/src/index.js @@ -5,12 +5,16 @@ export default declare((api, options) => { // When enabled and plugins includes flow, all files should be parsed as if // the @flow pragma was provided. - const { all } = options; + const { all, enums } = options; if (typeof all !== "boolean" && typeof all !== "undefined") { throw new Error(".all must be a boolean, or undefined"); } + if (typeof enums !== "boolean" && typeof enums !== "undefined") { + throw new Error(".enums must be a boolean, or undefined"); + } + return { name: "syntax-flow", @@ -25,7 +29,7 @@ export default declare((api, options) => { return; } - parserOpts.plugins.push(["flow", { all }]); + parserOpts.plugins.push(["flow", { all, enums }]); }, }; }); diff --git a/packages/babel-plugin-syntax-function-bind/package.json b/packages/babel-plugin-syntax-function-bind/package.json index 86cf0265d67e..8b767e563a6a 100644 --- a/packages/babel-plugin-syntax-function-bind/package.json +++ b/packages/babel-plugin-syntax-function-bind/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-syntax-function-bind", - "version": "7.2.0", + "version": "7.8.3", "description": "Allow parsing of function bind", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-syntax-function-bind", "license": "MIT", @@ -12,12 +12,12 @@ "babel-plugin" ], "dependencies": { - "@babel/helper-plugin-utils": "^7.0.0" + "@babel/helper-plugin-utils": "^7.8.3" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.2.0" + "@babel/core": "^7.8.3" } } diff --git a/packages/babel-plugin-syntax-function-sent/package.json b/packages/babel-plugin-syntax-function-sent/package.json index 1b503528cb48..61903d76f327 100644 --- a/packages/babel-plugin-syntax-function-sent/package.json +++ b/packages/babel-plugin-syntax-function-sent/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-syntax-function-sent", - "version": "7.2.0", + "version": "7.8.3", "description": "Allow parsing of the function.sent meta property", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-syntax-function-sent", "license": "MIT", @@ -12,12 +12,12 @@ "babel-plugin" ], "dependencies": { - "@babel/helper-plugin-utils": "^7.0.0" + "@babel/helper-plugin-utils": "^7.8.3" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.2.0" + "@babel/core": "^7.8.3" } } diff --git a/packages/babel-plugin-syntax-import-meta/package.json b/packages/babel-plugin-syntax-import-meta/package.json index 25c7cb70c748..dd82f0e31f57 100644 --- a/packages/babel-plugin-syntax-import-meta/package.json +++ b/packages/babel-plugin-syntax-import-meta/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-syntax-import-meta", - "version": "7.2.0", + "version": "7.8.3", "description": "Allow parsing of import.meta", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-syntax-import-meta", "license": "MIT", @@ -12,12 +12,12 @@ "babel-plugin" ], "dependencies": { - "@babel/helper-plugin-utils": "^7.0.0" + "@babel/helper-plugin-utils": "^7.8.3" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.2.0" + "@babel/core": "^7.8.3" } } diff --git a/packages/babel-plugin-syntax-json-strings/README.md b/packages/babel-plugin-syntax-json-strings/README.md deleted file mode 100644 index 03c00a2d1764..000000000000 --- a/packages/babel-plugin-syntax-json-strings/README.md +++ /dev/null @@ -1,19 +0,0 @@ -# @babel/plugin-syntax-json-strings - -> Allow parsing of the U+2028 LINE SEPARATOR and U+2029 PARAGRAPH SEPARATOR in JS strings - -See our website [@babel/plugin-syntax-json-strings](https://babeljs.io/docs/en/next/babel-plugin-syntax-json-strings.html) for more information. - -## Install - -Using npm: - -```sh -npm install --save-dev @babel/plugin-syntax-json-strings -``` - -or using yarn: - -```sh -yarn add @babel/plugin-syntax-json-strings --dev -``` diff --git a/packages/babel-plugin-syntax-json-strings/package.json b/packages/babel-plugin-syntax-json-strings/package.json deleted file mode 100644 index 3f1dcab3841e..000000000000 --- a/packages/babel-plugin-syntax-json-strings/package.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "name": "@babel/plugin-syntax-json-strings", - "version": "7.2.0", - "description": "Allow parsing of the U+2028 LINE SEPARATOR and U+2029 PARAGRAPH SEPARATOR in JS strings", - "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-syntax-json-strings", - "license": "MIT", - "publishConfig": { - "access": "public" - }, - "main": "lib/index.js", - "keywords": [ - "babel-plugin" - ], - "dependencies": { - "@babel/helper-plugin-utils": "^7.0.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - }, - "devDependencies": { - "@babel/core": "^7.2.0" - } -} diff --git a/packages/babel-plugin-syntax-json-strings/src/index.js b/packages/babel-plugin-syntax-json-strings/src/index.js deleted file mode 100644 index 0a61997b8a6f..000000000000 --- a/packages/babel-plugin-syntax-json-strings/src/index.js +++ /dev/null @@ -1,13 +0,0 @@ -import { declare } from "@babel/helper-plugin-utils"; - -export default declare(api => { - api.assertVersion(7); - - return { - name: "syntax-json-strings", - - manipulateOptions(opts, parserOpts) { - parserOpts.plugins.push("jsonStrings"); - }, - }; -}); diff --git a/packages/babel-plugin-syntax-jsx/package.json b/packages/babel-plugin-syntax-jsx/package.json index dd4ead2baaf8..607003242268 100644 --- a/packages/babel-plugin-syntax-jsx/package.json +++ b/packages/babel-plugin-syntax-jsx/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-syntax-jsx", - "version": "7.2.0", + "version": "7.8.3", "description": "Allow parsing of jsx", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-syntax-jsx", "license": "MIT", @@ -12,12 +12,12 @@ "babel-plugin" ], "dependencies": { - "@babel/helper-plugin-utils": "^7.0.0" + "@babel/helper-plugin-utils": "^7.8.3" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.2.0" + "@babel/core": "^7.8.3" } } diff --git a/packages/babel-plugin-syntax-logical-assignment-operators/package.json b/packages/babel-plugin-syntax-logical-assignment-operators/package.json index aeea2eaa72e7..68dff072600e 100644 --- a/packages/babel-plugin-syntax-logical-assignment-operators/package.json +++ b/packages/babel-plugin-syntax-logical-assignment-operators/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-syntax-logical-assignment-operators", - "version": "7.2.0", + "version": "7.8.3", "description": "Allow parsing of the logical assignment operators", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-syntax-logical-assignment-operators", "license": "MIT", @@ -12,12 +12,12 @@ "babel-plugin" ], "dependencies": { - "@babel/helper-plugin-utils": "^7.0.0" + "@babel/helper-plugin-utils": "^7.8.3" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.2.0" + "@babel/core": "^7.8.3" } } diff --git a/packages/babel-plugin-syntax-nullish-coalescing-operator/README.md b/packages/babel-plugin-syntax-nullish-coalescing-operator/README.md deleted file mode 100644 index f91e8117f785..000000000000 --- a/packages/babel-plugin-syntax-nullish-coalescing-operator/README.md +++ /dev/null @@ -1,19 +0,0 @@ -# @babel/plugin-syntax-nullish-coalescing-operator - -> Allow parsing of the nullish-coalescing operator - -See our website [@babel/plugin-syntax-nullish-coalescing-operator](https://babeljs.io/docs/en/next/babel-plugin-syntax-nullish-coalescing-operator.html) for more information. - -## Install - -Using npm: - -```sh -npm install --save-dev @babel/plugin-syntax-nullish-coalescing-operator -``` - -or using yarn: - -```sh -yarn add @babel/plugin-syntax-nullish-coalescing-operator --dev -``` diff --git a/packages/babel-plugin-syntax-nullish-coalescing-operator/package.json b/packages/babel-plugin-syntax-nullish-coalescing-operator/package.json deleted file mode 100644 index 323934061e24..000000000000 --- a/packages/babel-plugin-syntax-nullish-coalescing-operator/package.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "name": "@babel/plugin-syntax-nullish-coalescing-operator", - "version": "7.2.0", - "description": "Allow parsing of the nullish-coalescing operator", - "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-syntax-nullish-coalescing-operator", - "license": "MIT", - "publishConfig": { - "access": "public" - }, - "main": "lib/index.js", - "keywords": [ - "babel-plugin" - ], - "dependencies": { - "@babel/helper-plugin-utils": "^7.0.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - }, - "devDependencies": { - "@babel/core": "^7.2.0" - } -} diff --git a/packages/babel-plugin-syntax-nullish-coalescing-operator/src/index.js b/packages/babel-plugin-syntax-nullish-coalescing-operator/src/index.js deleted file mode 100644 index 0bd6c5d70048..000000000000 --- a/packages/babel-plugin-syntax-nullish-coalescing-operator/src/index.js +++ /dev/null @@ -1,13 +0,0 @@ -import { declare } from "@babel/helper-plugin-utils"; - -export default declare(api => { - api.assertVersion(7); - - return { - name: "syntax-nullish-coalescing-operator", - - manipulateOptions(opts, parserOpts) { - parserOpts.plugins.push("nullishCoalescingOperator"); - }, - }; -}); diff --git a/packages/babel-plugin-syntax-numeric-separator/package.json b/packages/babel-plugin-syntax-numeric-separator/package.json index c60d9ccdf975..143a79126062 100644 --- a/packages/babel-plugin-syntax-numeric-separator/package.json +++ b/packages/babel-plugin-syntax-numeric-separator/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-syntax-numeric-separator", - "version": "7.2.0", + "version": "7.8.3", "description": "Allow parsing of Decimal, Binary, Hex and Octal literals that contain a Numeric Literal Separator", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-syntax-numeric-separator", "license": "MIT", @@ -12,12 +12,12 @@ "babel-plugin" ], "dependencies": { - "@babel/helper-plugin-utils": "^7.0.0" + "@babel/helper-plugin-utils": "^7.8.3" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.2.0" + "@babel/core": "^7.8.3" } } diff --git a/packages/babel-plugin-syntax-object-rest-spread/.npmignore b/packages/babel-plugin-syntax-object-rest-spread/.npmignore deleted file mode 100644 index f9806945836e..000000000000 --- a/packages/babel-plugin-syntax-object-rest-spread/.npmignore +++ /dev/null @@ -1,3 +0,0 @@ -src -test -*.log diff --git a/packages/babel-plugin-syntax-object-rest-spread/README.md b/packages/babel-plugin-syntax-object-rest-spread/README.md deleted file mode 100644 index 95c4472ebe68..000000000000 --- a/packages/babel-plugin-syntax-object-rest-spread/README.md +++ /dev/null @@ -1,19 +0,0 @@ -# @babel/plugin-syntax-object-rest-spread - -> Allow parsing of object rest/spread - -See our website [@babel/plugin-syntax-object-rest-spread](https://babeljs.io/docs/en/next/babel-plugin-syntax-object-rest-spread.html) for more information. - -## Install - -Using npm: - -```sh -npm install --save-dev @babel/plugin-syntax-object-rest-spread -``` - -or using yarn: - -```sh -yarn add @babel/plugin-syntax-object-rest-spread --dev -``` diff --git a/packages/babel-plugin-syntax-object-rest-spread/package.json b/packages/babel-plugin-syntax-object-rest-spread/package.json deleted file mode 100644 index e0b6524d3a5b..000000000000 --- a/packages/babel-plugin-syntax-object-rest-spread/package.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "name": "@babel/plugin-syntax-object-rest-spread", - "version": "7.2.0", - "description": "Allow parsing of object rest/spread", - "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-syntax-object-rest-spread", - "license": "MIT", - "publishConfig": { - "access": "public" - }, - "main": "lib/index.js", - "keywords": [ - "babel-plugin" - ], - "dependencies": { - "@babel/helper-plugin-utils": "^7.0.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - }, - "devDependencies": { - "@babel/core": "^7.2.0" - } -} diff --git a/packages/babel-plugin-syntax-object-rest-spread/src/index.js b/packages/babel-plugin-syntax-object-rest-spread/src/index.js deleted file mode 100644 index 66f909c5a1d9..000000000000 --- a/packages/babel-plugin-syntax-object-rest-spread/src/index.js +++ /dev/null @@ -1,13 +0,0 @@ -import { declare } from "@babel/helper-plugin-utils"; - -export default declare(api => { - api.assertVersion(7); - - return { - name: "syntax-object-rest-spread", - - manipulateOptions(opts, parserOpts) { - parserOpts.plugins.push("objectRestSpread"); - }, - }; -}); diff --git a/packages/babel-plugin-syntax-optional-catch-binding/.npmignore b/packages/babel-plugin-syntax-optional-catch-binding/.npmignore deleted file mode 100644 index f9806945836e..000000000000 --- a/packages/babel-plugin-syntax-optional-catch-binding/.npmignore +++ /dev/null @@ -1,3 +0,0 @@ -src -test -*.log diff --git a/packages/babel-plugin-syntax-optional-catch-binding/README.md b/packages/babel-plugin-syntax-optional-catch-binding/README.md deleted file mode 100644 index 9085f9180c54..000000000000 --- a/packages/babel-plugin-syntax-optional-catch-binding/README.md +++ /dev/null @@ -1,19 +0,0 @@ -# @babel/plugin-syntax-optional-catch-binding - -> Allow parsing of optional catch bindings - -See our website [@babel/plugin-syntax-optional-catch-binding](https://babeljs.io/docs/en/next/babel-plugin-syntax-optional-catch-binding.html) for more information. - -## Install - -Using npm: - -```sh -npm install --save-dev @babel/plugin-syntax-optional-catch-binding -``` - -or using yarn: - -```sh -yarn add @babel/plugin-syntax-optional-catch-binding --dev -``` diff --git a/packages/babel-plugin-syntax-optional-catch-binding/package.json b/packages/babel-plugin-syntax-optional-catch-binding/package.json deleted file mode 100644 index 09e1ff1b176f..000000000000 --- a/packages/babel-plugin-syntax-optional-catch-binding/package.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "name": "@babel/plugin-syntax-optional-catch-binding", - "version": "7.2.0", - "description": "Allow parsing of optional catch bindings", - "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-syntax-optional-catch-binding", - "license": "MIT", - "publishConfig": { - "access": "public" - }, - "main": "lib/index.js", - "keywords": [ - "babel-plugin" - ], - "dependencies": { - "@babel/helper-plugin-utils": "^7.0.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - }, - "devDependencies": { - "@babel/core": "^7.2.0" - } -} diff --git a/packages/babel-plugin-syntax-optional-catch-binding/src/index.js b/packages/babel-plugin-syntax-optional-catch-binding/src/index.js deleted file mode 100644 index 68de2be52c31..000000000000 --- a/packages/babel-plugin-syntax-optional-catch-binding/src/index.js +++ /dev/null @@ -1,13 +0,0 @@ -import { declare } from "@babel/helper-plugin-utils"; - -export default declare(api => { - api.assertVersion(7); - - return { - name: "syntax-optional-catch-binding", - - manipulateOptions(opts, parserOpts) { - parserOpts.plugins.push("optionalCatchBinding"); - }, - }; -}); diff --git a/packages/babel-plugin-syntax-optional-chaining/.npmignore b/packages/babel-plugin-syntax-optional-chaining/.npmignore deleted file mode 100644 index f9806945836e..000000000000 --- a/packages/babel-plugin-syntax-optional-chaining/.npmignore +++ /dev/null @@ -1,3 +0,0 @@ -src -test -*.log diff --git a/packages/babel-plugin-syntax-optional-chaining/README.md b/packages/babel-plugin-syntax-optional-chaining/README.md deleted file mode 100644 index 712abc37046d..000000000000 --- a/packages/babel-plugin-syntax-optional-chaining/README.md +++ /dev/null @@ -1,19 +0,0 @@ -# @babel/plugin-syntax-optional-chaining - -> Allow parsing of optional properties - -See our website [@babel/plugin-syntax-optional-chaining](https://babeljs.io/docs/en/next/babel-plugin-syntax-optional-chaining.html) for more information. - -## Install - -Using npm: - -```sh -npm install --save-dev @babel/plugin-syntax-optional-chaining -``` - -or using yarn: - -```sh -yarn add @babel/plugin-syntax-optional-chaining --dev -``` diff --git a/packages/babel-plugin-syntax-optional-chaining/package.json b/packages/babel-plugin-syntax-optional-chaining/package.json deleted file mode 100644 index 22adb320d437..000000000000 --- a/packages/babel-plugin-syntax-optional-chaining/package.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "name": "@babel/plugin-syntax-optional-chaining", - "version": "7.2.0", - "description": "Allow parsing of optional properties", - "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-syntax-optional-chaining", - "license": "MIT", - "publishConfig": { - "access": "public" - }, - "main": "lib/index.js", - "keywords": [ - "babel-plugin" - ], - "dependencies": { - "@babel/helper-plugin-utils": "^7.0.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - }, - "devDependencies": { - "@babel/core": "^7.2.0" - } -} diff --git a/packages/babel-plugin-syntax-optional-chaining/src/index.js b/packages/babel-plugin-syntax-optional-chaining/src/index.js deleted file mode 100644 index 968f34dd728e..000000000000 --- a/packages/babel-plugin-syntax-optional-chaining/src/index.js +++ /dev/null @@ -1,13 +0,0 @@ -import { declare } from "@babel/helper-plugin-utils"; - -export default declare(api => { - api.assertVersion(7); - - return { - name: "syntax-optional-chaining", - - manipulateOptions(opts, parserOpts) { - parserOpts.plugins.push("optionalChaining"); - }, - }; -}); diff --git a/packages/babel-plugin-syntax-partial-application/package.json b/packages/babel-plugin-syntax-partial-application/package.json index 50f8fcdf7e6b..4556ac19a1a5 100644 --- a/packages/babel-plugin-syntax-partial-application/package.json +++ b/packages/babel-plugin-syntax-partial-application/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-syntax-partial-application", - "version": "7.4.4", + "version": "7.8.3", "description": "Allow parsing of partial application syntax", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-syntax-partial-application", "license": "MIT", @@ -12,12 +12,12 @@ "babel-plugin" ], "dependencies": { - "@babel/helper-plugin-utils": "^7.0.0" + "@babel/helper-plugin-utils": "^7.8.3" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.4.4" + "@babel/core": "^7.8.3" } } diff --git a/packages/babel-plugin-syntax-pipeline-operator/.npmignore b/packages/babel-plugin-syntax-pipeline-operator/.npmignore new file mode 100644 index 000000000000..2b1fceba679b --- /dev/null +++ b/packages/babel-plugin-syntax-pipeline-operator/.npmignore @@ -0,0 +1,3 @@ +*.log +src +test diff --git a/packages/babel-plugin-syntax-pipeline-operator/package.json b/packages/babel-plugin-syntax-pipeline-operator/package.json index 61f571097149..a4eeafea4981 100644 --- a/packages/babel-plugin-syntax-pipeline-operator/package.json +++ b/packages/babel-plugin-syntax-pipeline-operator/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-syntax-pipeline-operator", - "version": "7.5.0", + "version": "7.8.3", "description": "Allow parsing of the pipeline operator", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-syntax-pipeline-operator", "license": "MIT", @@ -12,12 +12,12 @@ "babel-plugin" ], "dependencies": { - "@babel/helper-plugin-utils": "^7.0.0" + "@babel/helper-plugin-utils": "^7.8.3" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.5.0" + "@babel/core": "^7.8.3" } } diff --git a/packages/babel-plugin-syntax-json-strings/.npmignore b/packages/babel-plugin-syntax-record-and-tuple/.npmignore similarity index 100% rename from packages/babel-plugin-syntax-json-strings/.npmignore rename to packages/babel-plugin-syntax-record-and-tuple/.npmignore diff --git a/packages/babel-plugin-syntax-record-and-tuple/README.md b/packages/babel-plugin-syntax-record-and-tuple/README.md new file mode 100644 index 000000000000..8f91e3d16a0a --- /dev/null +++ b/packages/babel-plugin-syntax-record-and-tuple/README.md @@ -0,0 +1,19 @@ +# @babel/plugin-syntax-record-and-tuple + +> Allow parsing of records and tuples. + +See our website [@babel/plugin-syntax-record-and-tuple](https://babeljs.io/docs/en/next/babel-plugin-syntax-record-and-tuple.html) for more information. + +## Install + +Using npm: + +```sh +npm install --save-dev @babel/plugin-syntax-record-and-tuple +``` + +or using yarn: + +```sh +yarn add @babel/plugin-syntax-record-and-tuple --dev +``` diff --git a/packages/babel-plugin-syntax-record-and-tuple/package.json b/packages/babel-plugin-syntax-record-and-tuple/package.json new file mode 100644 index 000000000000..e795fda1eadf --- /dev/null +++ b/packages/babel-plugin-syntax-record-and-tuple/package.json @@ -0,0 +1,23 @@ +{ + "name": "@babel/plugin-syntax-record-and-tuple", + "version": "7.9.0", + "description": "Allow parsing of records and tuples.", + "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-syntax-record-and-tuple", + "license": "MIT", + "publishConfig": { + "access": "public" + }, + "main": "lib/index.js", + "keywords": [ + "babel-plugin" + ], + "dependencies": { + "@babel/helper-plugin-utils": "^7.0.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0" + }, + "devDependencies": { + "@babel/core": "^7.9.0" + } +} diff --git a/packages/babel-plugin-syntax-record-and-tuple/src/index.js b/packages/babel-plugin-syntax-record-and-tuple/src/index.js new file mode 100644 index 000000000000..12f50f60c952 --- /dev/null +++ b/packages/babel-plugin-syntax-record-and-tuple/src/index.js @@ -0,0 +1,18 @@ +import { declare } from "@babel/helper-plugin-utils"; + +export default declare((api, options) => { + api.assertVersion(7); + + return { + name: "syntax-record-and-tuple", + + manipulateOptions(opts, parserOpts) { + opts.generatorOpts.recordAndTupleSyntaxType = options.syntaxType; + + parserOpts.plugins.push([ + "recordAndTuple", + { syntaxType: options.syntaxType }, + ]); + }, + }; +}); diff --git a/packages/babel-plugin-syntax-throw-expressions/package.json b/packages/babel-plugin-syntax-throw-expressions/package.json index 55afeeb6b1dc..d5b16af51a63 100644 --- a/packages/babel-plugin-syntax-throw-expressions/package.json +++ b/packages/babel-plugin-syntax-throw-expressions/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-syntax-throw-expressions", - "version": "7.2.0", + "version": "7.8.3", "description": "Allow parsing of Throw Expressions", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-syntax-throw-expressions", "license": "MIT", @@ -12,12 +12,12 @@ "babel-plugin" ], "dependencies": { - "@babel/helper-plugin-utils": "^7.0.0" + "@babel/helper-plugin-utils": "^7.8.3" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.2.0" + "@babel/core": "^7.8.3" } } diff --git a/packages/babel-plugin-syntax-bigint/.npmignore b/packages/babel-plugin-syntax-top-level-await/.npmignore similarity index 100% rename from packages/babel-plugin-syntax-bigint/.npmignore rename to packages/babel-plugin-syntax-top-level-await/.npmignore diff --git a/packages/babel-plugin-syntax-top-level-await/README.md b/packages/babel-plugin-syntax-top-level-await/README.md new file mode 100644 index 000000000000..476cb27d6bbb --- /dev/null +++ b/packages/babel-plugin-syntax-top-level-await/README.md @@ -0,0 +1,19 @@ +# @babel/plugin-syntax-top-level-await + +> Allow parsing of top-level await in modules + +See our website [@babel/plugin-syntax-top-level-await](https://babeljs.io/docs/en/next/babel-plugin-syntax-top-level-await.html) for more information. + +## Install + +Using npm: + +```sh +npm install --save-dev @babel/plugin-syntax-top-level-await +``` + +or using yarn: + +```sh +yarn add @babel/plugin-syntax-top-level-await --dev +``` diff --git a/packages/babel-plugin-syntax-top-level-await/package.json b/packages/babel-plugin-syntax-top-level-await/package.json new file mode 100644 index 000000000000..20383fe62eaa --- /dev/null +++ b/packages/babel-plugin-syntax-top-level-await/package.json @@ -0,0 +1,23 @@ +{ + "name": "@babel/plugin-syntax-top-level-await", + "version": "7.8.3", + "description": "Allow parsing of top-level await in modules", + "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-syntax-top-level-await", + "license": "MIT", + "publishConfig": { + "access": "public" + }, + "main": "lib/index.js", + "keywords": [ + "babel-plugin" + ], + "dependencies": { + "@babel/helper-plugin-utils": "^7.8.3" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + }, + "devDependencies": { + "@babel/core": "^7.8.3" + } +} diff --git a/packages/babel-plugin-syntax-top-level-await/src/index.js b/packages/babel-plugin-syntax-top-level-await/src/index.js new file mode 100644 index 000000000000..2429b8ead657 --- /dev/null +++ b/packages/babel-plugin-syntax-top-level-await/src/index.js @@ -0,0 +1,13 @@ +import { declare } from "@babel/helper-plugin-utils"; + +export default declare(api => { + api.assertVersion(7); + + return { + name: "syntax-top-level-await", + + manipulateOptions(opts, parserOpts) { + parserOpts.plugins.push("topLevelAwait"); + }, + }; +}); diff --git a/packages/babel-plugin-syntax-typescript/package.json b/packages/babel-plugin-syntax-typescript/package.json index d3410aca3a27..dbf6bb8c1678 100644 --- a/packages/babel-plugin-syntax-typescript/package.json +++ b/packages/babel-plugin-syntax-typescript/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-syntax-typescript", - "version": "7.3.3", + "version": "7.8.3", "description": "Allow parsing of TypeScript syntax", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-syntax-typescript", "license": "MIT", @@ -13,12 +13,12 @@ "typescript" ], "dependencies": { - "@babel/helper-plugin-utils": "^7.0.0" + "@babel/helper-plugin-utils": "^7.8.3" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.3.3" + "@babel/core": "^7.8.3" } } diff --git a/packages/babel-plugin-transform-arrow-functions/package.json b/packages/babel-plugin-transform-arrow-functions/package.json index 7506dfc22b99..60fac1704868 100644 --- a/packages/babel-plugin-transform-arrow-functions/package.json +++ b/packages/babel-plugin-transform-arrow-functions/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-transform-arrow-functions", - "version": "7.2.0", + "version": "7.8.3", "description": "Compile ES2015 arrow functions to ES5", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-arrow-functions", "license": "MIT", @@ -12,14 +12,14 @@ "babel-plugin" ], "dependencies": { - "@babel/helper-plugin-utils": "^7.0.0" + "@babel/helper-plugin-utils": "^7.8.3" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.2.0", - "@babel/helper-plugin-test-runner": "^7.0.0", - "@babel/traverse": "^7.0.0" + "@babel/core": "^7.8.3", + "@babel/helper-plugin-test-runner": "^7.8.3", + "@babel/traverse": "^7.8.3" } } diff --git a/packages/babel-plugin-transform-async-to-generator/package.json b/packages/babel-plugin-transform-async-to-generator/package.json index d6b8b908e89a..738b247a5ee2 100644 --- a/packages/babel-plugin-transform-async-to-generator/package.json +++ b/packages/babel-plugin-transform-async-to-generator/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-transform-async-to-generator", - "version": "7.5.0", + "version": "7.8.3", "description": "Turn async functions into ES2015 generators", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-async-to-generator", "license": "MIT", @@ -12,15 +12,15 @@ "babel-plugin" ], "dependencies": { - "@babel/helper-module-imports": "^7.0.0", - "@babel/helper-plugin-utils": "^7.0.0", - "@babel/helper-remap-async-to-generator": "^7.1.0" + "@babel/helper-module-imports": "^7.8.3", + "@babel/helper-plugin-utils": "^7.8.3", + "@babel/helper-remap-async-to-generator": "^7.8.3" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.5.0", - "@babel/helper-plugin-test-runner": "^7.0.0" + "@babel/core": "^7.8.3", + "@babel/helper-plugin-test-runner": "^7.8.3" } } diff --git a/packages/babel-plugin-transform-async-to-generator/test/fixtures/async-to-generator/async-arrow-in-method/output.js b/packages/babel-plugin-transform-async-to-generator/test/fixtures/async-to-generator/async-arrow-in-method/output.js index bf401d13974e..bc1e37c57efb 100644 --- a/packages/babel-plugin-transform-async-to-generator/test/fixtures/async-to-generator/async-arrow-in-method/output.js +++ b/packages/babel-plugin-transform-async-to-generator/test/fixtures/async-to-generator/async-arrow-in-method/output.js @@ -4,9 +4,7 @@ let TestClass = { testMethodFailure() { var _this = this; - return new Promise( - /*#__PURE__*/ - function () { + return new Promise( /*#__PURE__*/function () { var _ref = babelHelpers.asyncToGenerator(function* (resolve) { console.log(_this); setTimeout(resolve, 1000); diff --git a/packages/babel-plugin-transform-async-to-generator/test/fixtures/async-to-generator/async-iife-with-regenerator-spec/output.js b/packages/babel-plugin-transform-async-to-generator/test/fixtures/async-to-generator/async-iife-with-regenerator-spec/output.js index 1dd679cfa250..dd0f8dcca460 100644 --- a/packages/babel-plugin-transform-async-to-generator/test/fixtures/async-to-generator/async-iife-with-regenerator-spec/output.js +++ b/packages/babel-plugin-transform-async-to-generator/test/fixtures/async-to-generator/async-iife-with-regenerator-spec/output.js @@ -1,8 +1,6 @@ var _this = this; -babelHelpers.asyncToGenerator( -/*#__PURE__*/ -regeneratorRuntime.mark(function _callee() { +babelHelpers.asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() { return regeneratorRuntime.wrap(function _callee$(_context) { while (1) switch (_context.prev = _context.next) { case 0: @@ -15,9 +13,7 @@ regeneratorRuntime.mark(function _callee() { } }, _callee); }))(); -babelHelpers.asyncToGenerator( -/*#__PURE__*/ -regeneratorRuntime.mark(function _callee2() { +babelHelpers.asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2() { return regeneratorRuntime.wrap(function _callee2$(_context2) { while (1) switch (_context2.prev = _context2.next) { case 0: @@ -34,9 +30,7 @@ regeneratorRuntime.mark(function _callee2() { /*#__PURE__*/ (function () { - var _notIIFE = babelHelpers.asyncToGenerator( - /*#__PURE__*/ - regeneratorRuntime.mark(function _callee3() { + var _notIIFE = babelHelpers.asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee3() { return regeneratorRuntime.wrap(function _callee3$(_context3) { while (1) switch (_context3.prev = _context3.next) { case 0: @@ -58,9 +52,7 @@ regeneratorRuntime.mark(function _callee2() { })(); /*#__PURE__*/ -babelHelpers.asyncToGenerator( -/*#__PURE__*/ -regeneratorRuntime.mark(function _callee4() { +babelHelpers.asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee4() { return regeneratorRuntime.wrap(function _callee4$(_context4) { while (1) switch (_context4.prev = _context4.next) { case 0: diff --git a/packages/babel-plugin-transform-async-to-generator/test/fixtures/async-to-generator/async-iife-with-regenerator/output.js b/packages/babel-plugin-transform-async-to-generator/test/fixtures/async-to-generator/async-iife-with-regenerator/output.js index 97c381e41ed7..73f454fc9e5b 100644 --- a/packages/babel-plugin-transform-async-to-generator/test/fixtures/async-to-generator/async-iife-with-regenerator/output.js +++ b/packages/babel-plugin-transform-async-to-generator/test/fixtures/async-to-generator/async-iife-with-regenerator/output.js @@ -1,6 +1,4 @@ -babelHelpers.asyncToGenerator( -/*#__PURE__*/ -regeneratorRuntime.mark(function _callee() { +babelHelpers.asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() { return regeneratorRuntime.wrap(function _callee$(_context) { while (1) switch (_context.prev = _context.next) { case 0: @@ -13,9 +11,7 @@ regeneratorRuntime.mark(function _callee() { } }, _callee); }))(); -babelHelpers.asyncToGenerator( -/*#__PURE__*/ -regeneratorRuntime.mark(function _callee2() { +babelHelpers.asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2() { return regeneratorRuntime.wrap(function _callee2$(_context2) { while (1) switch (_context2.prev = _context2.next) { case 0: @@ -31,9 +27,7 @@ regeneratorRuntime.mark(function _callee2() { /*#__PURE__*/ (function () { - var _notIIFE = babelHelpers.asyncToGenerator( - /*#__PURE__*/ - regeneratorRuntime.mark(function _callee3() { + var _notIIFE = babelHelpers.asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee3() { return regeneratorRuntime.wrap(function _callee3$(_context3) { while (1) switch (_context3.prev = _context3.next) { case 0: @@ -55,9 +49,7 @@ regeneratorRuntime.mark(function _callee2() { })(); /*#__PURE__*/ -babelHelpers.asyncToGenerator( -/*#__PURE__*/ -regeneratorRuntime.mark(function _callee4() { +babelHelpers.asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee4() { return regeneratorRuntime.wrap(function _callee4$(_context4) { while (1) switch (_context4.prev = _context4.next) { case 0: diff --git a/packages/babel-plugin-transform-async-to-generator/test/fixtures/async-to-generator/deeply-nested-asyncs/output.js b/packages/babel-plugin-transform-async-to-generator/test/fixtures/async-to-generator/deeply-nested-asyncs/output.js index a5914b25f780..798687e28c3e 100644 --- a/packages/babel-plugin-transform-async-to-generator/test/fixtures/async-to-generator/deeply-nested-asyncs/output.js +++ b/packages/babel-plugin-transform-async-to-generator/test/fixtures/async-to-generator/deeply-nested-asyncs/output.js @@ -4,20 +4,16 @@ function s(_x) { function _s() { _s = babelHelpers.asyncToGenerator(function* (x) { - var _this = this, - _arguments = arguments; + var _arguments = arguments, + _this = this; for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { args[_key - 1] = arguments[_key]; } - let t = - /*#__PURE__*/ - function () { + let t = /*#__PURE__*/function () { var _ref = babelHelpers.asyncToGenerator(function* (y, a) { - let r = - /*#__PURE__*/ - function () { + let r = /*#__PURE__*/function () { var _ref2 = babelHelpers.asyncToGenerator(function* (z, b) { yield z; diff --git a/packages/babel-plugin-transform-async-to-generator/test/fixtures/async-to-generator/expression/output.js b/packages/babel-plugin-transform-async-to-generator/test/fixtures/async-to-generator/expression/output.js index d8e3231885c4..28e6e5d5625a 100644 --- a/packages/babel-plugin-transform-async-to-generator/test/fixtures/async-to-generator/expression/output.js +++ b/packages/babel-plugin-transform-async-to-generator/test/fixtures/async-to-generator/expression/output.js @@ -1,6 +1,4 @@ -var foo = -/*#__PURE__*/ -function () { +var foo = /*#__PURE__*/function () { var _ref = babelHelpers.asyncToGenerator(function* () { var wat = yield bar(); }); @@ -10,9 +8,7 @@ function () { }; }(); -var foo2 = -/*#__PURE__*/ -function () { +var foo2 = /*#__PURE__*/function () { var _ref2 = babelHelpers.asyncToGenerator(function* () { var wat = yield bar(); }); @@ -21,9 +17,7 @@ function () { return _ref2.apply(this, arguments); }; }(), - bar = -/*#__PURE__*/ -function () { + bar = /*#__PURE__*/function () { var _ref3 = babelHelpers.asyncToGenerator(function* () { var wat = yield foo(); }); diff --git a/packages/babel-plugin-transform-async-to-generator/test/fixtures/async-to-generator/named-expression/output.js b/packages/babel-plugin-transform-async-to-generator/test/fixtures/async-to-generator/named-expression/output.js index 9dad5008a8ed..96088c4edce1 100644 --- a/packages/babel-plugin-transform-async-to-generator/test/fixtures/async-to-generator/named-expression/output.js +++ b/packages/babel-plugin-transform-async-to-generator/test/fixtures/async-to-generator/named-expression/output.js @@ -1,6 +1,4 @@ -var foo = -/*#__PURE__*/ -function () { +var foo = /*#__PURE__*/function () { var _bar = babelHelpers.asyncToGenerator(function* () { console.log(bar); }); diff --git a/packages/babel-plugin-transform-async-to-generator/test/fixtures/async-to-generator/no-parameters-and-no-id/output.js b/packages/babel-plugin-transform-async-to-generator/test/fixtures/async-to-generator/no-parameters-and-no-id/output.js index 438c8979be93..1dda565d4241 100644 --- a/packages/babel-plugin-transform-async-to-generator/test/fixtures/async-to-generator/no-parameters-and-no-id/output.js +++ b/packages/babel-plugin-transform-async-to-generator/test/fixtures/async-to-generator/no-parameters-and-no-id/output.js @@ -1,3 +1 @@ -foo( -/*#__PURE__*/ -babelHelpers.asyncToGenerator(function* () {})); +foo( /*#__PURE__*/babelHelpers.asyncToGenerator(function* () {})); diff --git a/packages/babel-plugin-transform-async-to-generator/test/fixtures/async-to-generator/object-method-with-super/output.js b/packages/babel-plugin-transform-async-to-generator/test/fixtures/async-to-generator/object-method-with-super/output.js index c8bccac252f7..6e26d643e065 100644 --- a/packages/babel-plugin-transform-async-to-generator/test/fixtures/async-to-generator/object-method-with-super/output.js +++ b/packages/babel-plugin-transform-async-to-generator/test/fixtures/async-to-generator/object-method-with-super/output.js @@ -1,11 +1,12 @@ class Foo extends class {} { method() { - var _superprop_callMethod = (..._args) => super.method(..._args); + var _superprop_getMethod = () => super.method, + _this = this; return babelHelpers.asyncToGenerator(function* () { - _superprop_callMethod(); + _superprop_getMethod().call(_this); - var arrow = () => _superprop_callMethod(); + var arrow = () => _superprop_getMethod().call(_this); })(); } diff --git a/packages/babel-plugin-transform-async-to-generator/test/fixtures/bluebird-coroutines/expression/output.js b/packages/babel-plugin-transform-async-to-generator/test/fixtures/bluebird-coroutines/expression/output.js index 295a91f9ed1a..5248c6007426 100644 --- a/packages/babel-plugin-transform-async-to-generator/test/fixtures/bluebird-coroutines/expression/output.js +++ b/packages/babel-plugin-transform-async-to-generator/test/fixtures/bluebird-coroutines/expression/output.js @@ -1,8 +1,6 @@ var _coroutine = require("bluebird").coroutine; -var foo = -/*#__PURE__*/ -function () { +var foo = /*#__PURE__*/function () { var _ref = _coroutine(function* () { var wat = yield bar(); }); diff --git a/packages/babel-plugin-transform-async-to-generator/test/fixtures/bluebird-coroutines/named-expression/output.js b/packages/babel-plugin-transform-async-to-generator/test/fixtures/bluebird-coroutines/named-expression/output.js index 7bbf45dac641..09d0a9213cce 100644 --- a/packages/babel-plugin-transform-async-to-generator/test/fixtures/bluebird-coroutines/named-expression/output.js +++ b/packages/babel-plugin-transform-async-to-generator/test/fixtures/bluebird-coroutines/named-expression/output.js @@ -1,8 +1,6 @@ var _coroutine = require("bluebird").coroutine; -var foo = -/*#__PURE__*/ -function () { +var foo = /*#__PURE__*/function () { var _bar = _coroutine(function* () { console.log(bar); }); diff --git a/packages/babel-plugin-transform-async-to-generator/test/fixtures/export-async/default-arrow-export/output.js b/packages/babel-plugin-transform-async-to-generator/test/fixtures/export-async/default-arrow-export/output.js index d14b32505a54..39a3a6e76f76 100644 --- a/packages/babel-plugin-transform-async-to-generator/test/fixtures/export-async/default-arrow-export/output.js +++ b/packages/babel-plugin-transform-async-to-generator/test/fixtures/export-async/default-arrow-export/output.js @@ -5,9 +5,7 @@ Object.defineProperty(exports, "__esModule", { }); exports.default = void 0; -var _default = -/*#__PURE__*/ -babelHelpers.asyncToGenerator(function* () { +var _default = /*#__PURE__*/babelHelpers.asyncToGenerator(function* () { return yield foo(); }); diff --git a/packages/babel-plugin-transform-async-to-generator/test/fixtures/regression/7178/output.js b/packages/babel-plugin-transform-async-to-generator/test/fixtures/regression/7178/output.js index 834e46ca35ad..890bc6fa11f0 100644 --- a/packages/babel-plugin-transform-async-to-generator/test/fixtures/regression/7178/output.js +++ b/packages/babel-plugin-transform-async-to-generator/test/fixtures/regression/7178/output.js @@ -4,9 +4,7 @@ function action() { return _action.apply(this, arguments); } -var _ref = -/*#__PURE__*/ -React.createElement(Contact, { +var _ref = /*#__PURE__*/React.createElement(Contact, { title: title }); diff --git a/packages/babel-plugin-transform-async-to-generator/test/fixtures/regression/8783/output.js b/packages/babel-plugin-transform-async-to-generator/test/fixtures/regression/8783/output.js index 39a8061003c9..819b9a4b22a9 100644 --- a/packages/babel-plugin-transform-async-to-generator/test/fixtures/regression/8783/output.js +++ b/packages/babel-plugin-transform-async-to-generator/test/fixtures/regression/8783/output.js @@ -4,7 +4,7 @@ function _asyncToGenerator(fn) { return function () { var self = this, args = ar (function () { var _poll = _asyncToGenerator(function* () { - console.log((yield Promise.resolve('Hello'))); + console.log(yield Promise.resolve('Hello')); setTimeout(poll, 1000); }); diff --git a/packages/babel-plugin-transform-async-to-generator/test/fixtures/regression/T7108/output.js b/packages/babel-plugin-transform-async-to-generator/test/fixtures/regression/T7108/output.js index 3d8286517d39..271ebeaa71f8 100644 --- a/packages/babel-plugin-transform-async-to-generator/test/fixtures/regression/T7108/output.js +++ b/packages/babel-plugin-transform-async-to-generator/test/fixtures/regression/T7108/output.js @@ -4,9 +4,7 @@ class Test { return babelHelpers.asyncToGenerator(function* () { console.log(_this); - setTimeout( - /*#__PURE__*/ - babelHelpers.asyncToGenerator(function* () { + setTimeout( /*#__PURE__*/babelHelpers.asyncToGenerator(function* () { console.log(_this); })); })(); @@ -17,9 +15,7 @@ class Test { return babelHelpers.asyncToGenerator(function* () { console.log(_this2); - setTimeout( - /*#__PURE__*/ - function () { + setTimeout( /*#__PURE__*/function () { var _ref2 = babelHelpers.asyncToGenerator(function* (arg) { console.log(_this2); }); @@ -36,9 +32,7 @@ class Test { return babelHelpers.asyncToGenerator(function* () { console.log(_this3); - setTimeout( - /*#__PURE__*/ - babelHelpers.asyncToGenerator(function* () { + setTimeout( /*#__PURE__*/babelHelpers.asyncToGenerator(function* () { console.log(_this3); })); })(); @@ -49,9 +43,7 @@ class Test { return babelHelpers.asyncToGenerator(function* () { console.log(_this4); - setTimeout( - /*#__PURE__*/ - function () { + setTimeout( /*#__PURE__*/function () { var _ref4 = babelHelpers.asyncToGenerator(function* (arg) { console.log(_this4); }); diff --git a/packages/babel-plugin-transform-async-to-generator/test/fixtures/regression/T7194/output.js b/packages/babel-plugin-transform-async-to-generator/test/fixtures/regression/T7194/output.js index 42828c1f8bb1..90779a7a07cf 100644 --- a/packages/babel-plugin-transform-async-to-generator/test/fixtures/regression/T7194/output.js +++ b/packages/babel-plugin-transform-async-to-generator/test/fixtures/regression/T7194/output.js @@ -1,7 +1,5 @@ function f() { - g( - /*#__PURE__*/ - babelHelpers.asyncToGenerator(function* () { + g( /*#__PURE__*/babelHelpers.asyncToGenerator(function* () { var _this = this; c(function () { diff --git a/packages/babel-plugin-transform-async-to-generator/test/fixtures/regression/gh-6923/output.js b/packages/babel-plugin-transform-async-to-generator/test/fixtures/regression/gh-6923/output.js index e42a824bdc78..ac123d4b1139 100644 --- a/packages/babel-plugin-transform-async-to-generator/test/fixtures/regression/gh-6923/output.js +++ b/packages/babel-plugin-transform-async-to-generator/test/fixtures/regression/gh-6923/output.js @@ -3,17 +3,13 @@ function foo() { } function _foo() { - _foo = babelHelpers.asyncToGenerator( - /*#__PURE__*/ - regeneratorRuntime.mark(function _callee2() { + _foo = babelHelpers.asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2() { return regeneratorRuntime.wrap(function _callee2$(_context2) { while (1) switch (_context2.prev = _context2.next) { case 0: /*#__PURE__*/ (function () { - var _ref = babelHelpers.asyncToGenerator( - /*#__PURE__*/ - regeneratorRuntime.mark(function _callee(number) { + var _ref = babelHelpers.asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(number) { var tmp; return regeneratorRuntime.wrap(function _callee$(_context) { while (1) switch (_context.prev = _context.next) { diff --git a/packages/babel-plugin-transform-block-scoped-functions/package.json b/packages/babel-plugin-transform-block-scoped-functions/package.json index b6ea3d6117f3..faacc88d68d7 100644 --- a/packages/babel-plugin-transform-block-scoped-functions/package.json +++ b/packages/babel-plugin-transform-block-scoped-functions/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-transform-block-scoped-functions", - "version": "7.2.0", + "version": "7.8.3", "description": "Babel plugin to ensure function declarations at the block level are block scoped", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-block-scoped-functions", "license": "MIT", @@ -12,13 +12,13 @@ "babel-plugin" ], "dependencies": { - "@babel/helper-plugin-utils": "^7.0.0" + "@babel/helper-plugin-utils": "^7.8.3" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.2.0", - "@babel/helper-plugin-test-runner": "^7.0.0" + "@babel/core": "^7.8.3", + "@babel/helper-plugin-test-runner": "^7.8.3" } } diff --git a/packages/babel-plugin-transform-block-scoping/package.json b/packages/babel-plugin-transform-block-scoping/package.json index d942568230ab..71672e895cf3 100644 --- a/packages/babel-plugin-transform-block-scoping/package.json +++ b/packages/babel-plugin-transform-block-scoping/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-transform-block-scoping", - "version": "7.5.5", + "version": "7.8.3", "description": "Compile ES2015 block scoping (const and let) to ES5", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-block-scoping", "license": "MIT", @@ -9,7 +9,7 @@ }, "main": "lib/index.js", "dependencies": { - "@babel/helper-plugin-utils": "^7.0.0", + "@babel/helper-plugin-utils": "^7.8.3", "lodash": "^4.17.13" }, "keywords": [ @@ -19,7 +19,7 @@ "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.5.5", - "@babel/helper-plugin-test-runner": "^7.0.0" + "@babel/core": "^7.8.3", + "@babel/helper-plugin-test-runner": "^7.8.3" } } diff --git a/packages/babel-plugin-transform-block-scoping/src/index.js b/packages/babel-plugin-transform-block-scoping/src/index.js index cc63c554ddcd..5391032751c4 100644 --- a/packages/babel-plugin-transform-block-scoping/src/index.js +++ b/packages/babel-plugin-transform-block-scoping/src/index.js @@ -16,7 +16,7 @@ export default declare((api, opts) => { throw new Error(`.throwIfClosureRequired must be a boolean, or undefined`); } if (typeof tdzEnabled !== "boolean") { - throw new Error(`.throwIfClosureRequired must be a boolean, or undefined`); + throw new Error(`.tdz must be a boolean, or undefined`); } return { @@ -33,11 +33,13 @@ export default declare((api, opts) => { for (let i = 0; i < node.declarations.length; i++) { const decl = node.declarations[i]; - if (decl.init) { - const assign = t.assignmentExpression("=", decl.id, decl.init); - assign._ignoreBlockScopingTDZ = true; - nodes.push(t.expressionStatement(assign)); - } + const assign = t.assignmentExpression( + "=", + decl.id, + decl.init || scope.buildUndefinedNode(), + ); + assign._ignoreBlockScopingTDZ = true; + nodes.push(t.expressionStatement(assign)); decl.init = this.addHelper("temporalUndefined"); } @@ -181,6 +183,8 @@ const letReferenceBlockVisitor = traverse.visitors.merge([ // simply rename the variables. if (state.loopDepth > 0) { path.traverse(letReferenceFunctionVisitor, state); + } else { + path.traverse(tdzVisitor, state); } return path.skip(); }, @@ -437,22 +441,25 @@ class BlockScoping { } updateScopeInfo(wrappedInClosure) { - const scope = this.scope; + const blockScope = this.blockPath.scope; - const parentScope = scope.getFunctionParent() || scope.getProgramParent(); + const parentScope = + blockScope.getFunctionParent() || blockScope.getProgramParent(); const letRefs = this.letReferences; for (const key of Object.keys(letRefs)) { const ref = letRefs[key]; - const binding = scope.getBinding(ref.name); + const binding = blockScope.getBinding(ref.name); if (!binding) continue; if (binding.kind === "let" || binding.kind === "const") { binding.kind = "var"; if (wrappedInClosure) { - scope.removeBinding(ref.name); + if (blockScope.hasOwnBinding(ref.name)) { + blockScope.removeBinding(ref.name); + } } else { - scope.moveBindingTo(ref.name, parentScope); + blockScope.moveBindingTo(ref.name, parentScope); } } } @@ -756,7 +763,7 @@ class BlockScoping { closurify: false, loopDepth: 0, tdzEnabled: this.tdzEnabled, - addHelper: name => this.addHelper(name), + addHelper: name => this.state.addHelper(name), }; if (isInLoop(this.blockPath)) { diff --git a/packages/babel-plugin-transform-block-scoping/src/tdz.js b/packages/babel-plugin-transform-block-scoping/src/tdz.js index 9612b8deb210..0588e2a276d1 100644 --- a/packages/babel-plugin-transform-block-scoping/src/tdz.js +++ b/packages/babel-plugin-transform-block-scoping/src/tdz.js @@ -1,12 +1,12 @@ -import { types as t } from "@babel/core"; +import { types as t, template } from "@babel/core"; function getTDZStatus(refPath, bindingPath) { const executionStatus = bindingPath._guessExecutionStatusRelativeTo(refPath); if (executionStatus === "before") { - return "inside"; - } else if (executionStatus === "after") { return "outside"; + } else if (executionStatus === "after") { + return "inside"; } else { return "maybe"; } @@ -41,7 +41,7 @@ export const visitor = { if (bindingPath.isFunctionDeclaration()) return; const status = getTDZStatus(path, bindingPath); - if (status === "inside") return; + if (status === "outside") return; if (status === "maybe") { const assert = buildTDZAssert(node, state); @@ -57,19 +57,8 @@ export const visitor = { } else { path.replaceWith(assert); } - } else if (status === "outside") { - path.replaceWith( - t.throwStatement( - t.inherits( - t.newExpression(t.identifier("ReferenceError"), [ - t.stringLiteral( - `${node.name} is not defined - temporal dead zone`, - ), - ]), - node, - ), - ), - ); + } else if (status === "inside") { + path.replaceWith(template.ast`${state.addHelper("tdz")}("${node.name}")`); } }, @@ -87,14 +76,14 @@ export const visitor = { const id = ids[name]; if (isReference(id, path.scope, state)) { - nodes.push(buildTDZAssert(id, state)); + nodes.push(id); } } if (nodes.length) { node._ignoreBlockScopingTDZ = true; nodes.push(node); - path.replaceWithMultiple(nodes.map(t.expressionStatement)); + path.replaceWithMultiple(nodes.map(n => t.expressionStatement(n))); } }, }, diff --git a/packages/babel-plugin-transform-block-scoping/test/fixtures/const-violations/flow-declar/input.js b/packages/babel-plugin-transform-block-scoping/test/fixtures/const-violations/flow-declar/input.js index e9ca299ae87e..666d38e3a4ed 100644 --- a/packages/babel-plugin-transform-block-scoping/test/fixtures/const-violations/flow-declar/input.js +++ b/packages/babel-plugin-transform-block-scoping/test/fixtures/const-violations/flow-declar/input.js @@ -1,2 +1,2 @@ declare class foo {} -const foo = 1; +const foo1 = 1; diff --git a/packages/babel-plugin-transform-block-scoping/test/fixtures/const-violations/flow-declar/output.js b/packages/babel-plugin-transform-block-scoping/test/fixtures/const-violations/flow-declar/output.js index 9375fc4abd22..0332cc0604b1 100644 --- a/packages/babel-plugin-transform-block-scoping/test/fixtures/const-violations/flow-declar/output.js +++ b/packages/babel-plugin-transform-block-scoping/test/fixtures/const-violations/flow-declar/output.js @@ -1 +1 @@ -var foo = 1; +var foo1 = 1; diff --git a/packages/babel-plugin-transform-block-scoping/test/fixtures/exec/scope-bindings.js b/packages/babel-plugin-transform-block-scoping/test/fixtures/exec/scope-bindings.js index 877467f94cfd..3014558a0261 100644 --- a/packages/babel-plugin-transform-block-scoping/test/fixtures/exec/scope-bindings.js +++ b/packages/babel-plugin-transform-block-scoping/test/fixtures/exec/scope-bindings.js @@ -5,6 +5,7 @@ if (x) { var innerScope = true; var res = transform(code, { + configFile: false, plugins: opts.plugins.concat([ function (b) { var t = b.types; @@ -34,3 +35,4 @@ if (x) { }`; expect(res.code).toBe(expected); +expect(innerScope).toBe(false); diff --git a/packages/babel-plugin-transform-block-scoping/test/fixtures/general/hoisting/options.json b/packages/babel-plugin-transform-block-scoping/test/fixtures/general/hoisting/options.json index c1b2fe494b7f..9d3c67e6ce2d 100644 --- a/packages/babel-plugin-transform-block-scoping/test/fixtures/general/hoisting/options.json +++ b/packages/babel-plugin-transform-block-scoping/test/fixtures/general/hoisting/options.json @@ -4,6 +4,7 @@ "syntax-jsx", "transform-react-jsx", "transform-block-scoped-functions", - "transform-for-of" + "transform-for-of", + ["external-helpers", { "helperVersion": "7.100.0" }] ] } diff --git a/packages/babel-plugin-transform-block-scoping/test/fixtures/general/hoisting/output.js b/packages/babel-plugin-transform-block-scoping/test/fixtures/general/hoisting/output.js index 0562fd1fe6f4..f9a734b608c3 100644 --- a/packages/babel-plugin-transform-block-scoping/test/fixtures/general/hoisting/output.js +++ b/packages/babel-plugin-transform-block-scoping/test/fixtures/general/hoisting/output.js @@ -10,12 +10,11 @@ var _loop = function (i) { }); }; -var _iteratorNormalCompletion = true; -var _didIteratorError = false; -var _iteratorError = undefined; +var _iterator = babelHelpers.createForOfIteratorHelper(nums), + _step; try { - for (var _iterator = nums[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { + for (_iterator.s(); !(_step = _iterator.n()).done;) { var i = _step.value; var x; var f; @@ -23,16 +22,7 @@ try { _loop(i); } } catch (err) { - _didIteratorError = true; - _iteratorError = err; + _iterator.e(err); } finally { - try { - if (!_iteratorNormalCompletion && _iterator.return != null) { - _iterator.return(); - } - } finally { - if (_didIteratorError) { - throw _iteratorError; - } - } + _iterator.f(); } diff --git a/packages/babel-plugin-transform-block-scoping/test/fixtures/general/issue-10339/exec.js b/packages/babel-plugin-transform-block-scoping/test/fixtures/general/issue-10339/exec.js new file mode 100644 index 000000000000..9fea95129bb4 --- /dev/null +++ b/packages/babel-plugin-transform-block-scoping/test/fixtures/general/issue-10339/exec.js @@ -0,0 +1,38 @@ +const code = multiline([ + "for (const {foo, ...bar} of { bar: [] }) {", + "() => foo;", + "const [qux] = bar;", + "try {} catch (e) {", + "let quux = qux;", + "}", + "}" +]); + +let programPath; +let forOfPath; +let functionPath; + +transform(code, { + configFile: false, + plugins: [ + "../../../../lib", + { + post({ path }) { + programPath = path; + path.traverse({ + ForOfStatement(path) { forOfPath = path }, + FunctionExpression(path) { functionPath = path } + }); + } + } + ] +}); + +expect(Object.keys(programPath.scope.bindings)).toEqual(["foo", "bar"]); + +// for declarations should be transformed to for bindings +expect(forOfPath.scope.bindings).toEqual({}); +// The body should be wrapped into closure +expect(forOfPath.get("body").scope.bindings).toEqual({}); + +expect(Object.keys(functionPath.scope.bindings)).toEqual(["foo", "bar", "qux", "quux"]); diff --git a/packages/babel-plugin-transform-block-scoping/test/fixtures/general/issue-10339/input.js b/packages/babel-plugin-transform-block-scoping/test/fixtures/general/issue-10339/input.js new file mode 100644 index 000000000000..dcca3b6e2d97 --- /dev/null +++ b/packages/babel-plugin-transform-block-scoping/test/fixtures/general/issue-10339/input.js @@ -0,0 +1,7 @@ +for (const {foo, ...bar} of {}) { + () => foo; + const [qux] = bar; + try {} catch (e) { + const quux = qux; + } +} diff --git a/packages/babel-plugin-transform-block-scoping/test/fixtures/general/issue-10339/options.json b/packages/babel-plugin-transform-block-scoping/test/fixtures/general/issue-10339/options.json new file mode 100644 index 000000000000..c71915a51cc7 --- /dev/null +++ b/packages/babel-plugin-transform-block-scoping/test/fixtures/general/issue-10339/options.json @@ -0,0 +1,6 @@ +{ + "plugins": [ + "transform-block-scoping", + ["proposal-object-rest-spread", { "loose": true }] + ] +} diff --git a/packages/babel-plugin-transform-block-scoping/test/fixtures/general/issue-10339/output.js b/packages/babel-plugin-transform-block-scoping/test/fixtures/general/issue-10339/output.js new file mode 100644 index 000000000000..b482807df22a --- /dev/null +++ b/packages/babel-plugin-transform-block-scoping/test/fixtures/general/issue-10339/output.js @@ -0,0 +1,20 @@ +function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; } + +var _loop = function (foo, bar) { + () => foo; + + var [qux] = bar; + + try {} catch (e) { + var quux = qux; + } +}; + +for (var _ref of {}) { + var { + foo + } = _ref, + bar = _objectWithoutPropertiesLoose(_ref, ["foo"]); + + _loop(foo, bar); +} diff --git a/packages/babel-plugin-transform-block-scoping/test/fixtures/general/jsx-identifier/output.js b/packages/babel-plugin-transform-block-scoping/test/fixtures/general/jsx-identifier/output.js index 5e8476c8d2de..c3c6e9d68cbc 100644 --- a/packages/babel-plugin-transform-block-scoping/test/fixtures/general/jsx-identifier/output.js +++ b/packages/babel-plugin-transform-block-scoping/test/fixtures/general/jsx-identifier/output.js @@ -2,5 +2,5 @@ var arr = []; for (var i = 0; i < 4; ++i) { - arr.push(React.createElement("i", null)); + arr.push( /*#__PURE__*/React.createElement("i", null)); } diff --git a/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/block-ref-function-call/exec.js b/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/block-ref-function-call/exec.js index f62c4127af3c..759123317338 100644 --- a/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/block-ref-function-call/exec.js +++ b/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/block-ref-function-call/exec.js @@ -1,3 +1,5 @@ -f(); +expect(() => { + f(); -const f = function f() {} + const f = function f() {} +}).toThrow(ReferenceError); diff --git a/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/block-ref-function-call/input.js b/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/block-ref-function-call/input.js new file mode 100644 index 000000000000..f62c4127af3c --- /dev/null +++ b/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/block-ref-function-call/input.js @@ -0,0 +1,3 @@ +f(); + +const f = function f() {} diff --git a/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/block-ref-function-call/options.json b/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/block-ref-function-call/options.json deleted file mode 100644 index 7a63bc19c6c6..000000000000 --- a/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/block-ref-function-call/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "f is not defined - temporal dead zone" -} diff --git a/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/block-ref-function-call/output.js b/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/block-ref-function-call/output.js new file mode 100644 index 000000000000..6ef35b6f90bf --- /dev/null +++ b/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/block-ref-function-call/output.js @@ -0,0 +1,3 @@ +babelHelpers.tdz("f")(); + +var f = function f() {}; diff --git a/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/destructured-self-reference/exec.js b/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/destructured-self-reference/exec.js index 166d7445f1ff..95ff7d58546f 100644 --- a/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/destructured-self-reference/exec.js +++ b/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/destructured-self-reference/exec.js @@ -1 +1,3 @@ -let { b: d } = { d } +expect(() => { + let { b: d } = { d } +}).toThrow(ReferenceError); \ No newline at end of file diff --git a/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/destructured-self-reference/input.js b/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/destructured-self-reference/input.js new file mode 100644 index 000000000000..166d7445f1ff --- /dev/null +++ b/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/destructured-self-reference/input.js @@ -0,0 +1 @@ +let { b: d } = { d } diff --git a/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/destructured-self-reference/options.json b/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/destructured-self-reference/options.json deleted file mode 100644 index e727ad851d25..000000000000 --- a/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/destructured-self-reference/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "d is not defined - temporal dead zone" -} diff --git a/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/destructured-self-reference/output.js b/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/destructured-self-reference/output.js new file mode 100644 index 000000000000..e80677c113d3 --- /dev/null +++ b/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/destructured-self-reference/output.js @@ -0,0 +1,5 @@ +var { + b: d +} = { + d: babelHelpers.tdz("d") +}; diff --git a/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/exported-fn/input.mjs b/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/exported-fn/input.mjs new file mode 100644 index 000000000000..ce79efd8d1e2 --- /dev/null +++ b/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/exported-fn/input.mjs @@ -0,0 +1,14 @@ +import { foo } from "somewhere"; + +// foo might call "bar" +foo(); + +a; + +let a; + +a; + +export function bar() { + return a; +} diff --git a/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/exported-fn/output.mjs b/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/exported-fn/output.mjs new file mode 100644 index 000000000000..b7679ea67438 --- /dev/null +++ b/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/exported-fn/output.mjs @@ -0,0 +1,10 @@ +var a = babelHelpers.temporalUndefined; +import { foo } from "somewhere"; // foo might call "bar" + +foo(); +babelHelpers.tdz("a"); +a = void 0; +a; +export function bar() { + return babelHelpers.temporalRef(a, "a"); +} diff --git a/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/function-call-after/exec.js b/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/function-call-after/exec.js new file mode 100644 index 000000000000..57f99f6fd0ae --- /dev/null +++ b/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/function-call-after/exec.js @@ -0,0 +1,7 @@ +expect(() => { + function f() { + x; + } + let x; + f(); +}).not.toThrow(); diff --git a/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/function-call-no-throw/exec.js b/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/function-call-after/input.js similarity index 100% rename from packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/function-call-no-throw/exec.js rename to packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/function-call-after/input.js diff --git a/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/function-call-after/output.js b/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/function-call-after/output.js new file mode 100644 index 000000000000..0666189283c9 --- /dev/null +++ b/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/function-call-after/output.js @@ -0,0 +1,6 @@ +function f() { + x; +} + +var x; +f(); diff --git a/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/function-call-before/exec.js b/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/function-call-before/exec.js new file mode 100644 index 000000000000..afd1da8d03bd --- /dev/null +++ b/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/function-call-before/exec.js @@ -0,0 +1,7 @@ +expect(() => { + function f() { + x; + } + f(); + let x; +}).toThrow(ReferenceError); diff --git a/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/function-call-before/input.js b/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/function-call-before/input.js new file mode 100644 index 000000000000..65d75d718937 --- /dev/null +++ b/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/function-call-before/input.js @@ -0,0 +1,5 @@ +function f() { + x; +} +f(); +let x; diff --git a/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/function-call-before/output.js b/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/function-call-before/output.js new file mode 100644 index 000000000000..12dfbdd8c187 --- /dev/null +++ b/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/function-call-before/output.js @@ -0,0 +1,6 @@ +function f() { + babelHelpers.tdz("x"); +} + +f(); +var x; diff --git a/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/function-call-maybe-real-after/exec.js b/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/function-call-maybe-real-after/exec.js new file mode 100644 index 000000000000..04e3cc201038 --- /dev/null +++ b/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/function-call-maybe-real-after/exec.js @@ -0,0 +1,6 @@ +expect(() => { + function f() { x } + Math.random() === 2 && f(); + let x; + f(); +}).not.toThrow(); diff --git a/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/function-call-maybe-real-after/input.js b/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/function-call-maybe-real-after/input.js new file mode 100644 index 000000000000..9f43c5a414d7 --- /dev/null +++ b/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/function-call-maybe-real-after/input.js @@ -0,0 +1,4 @@ +function f() { x } +Math.random() === 2 && f(); +let x; +f(); diff --git a/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/function-call-maybe-real-after/output.js b/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/function-call-maybe-real-after/output.js new file mode 100644 index 000000000000..be10d14b421e --- /dev/null +++ b/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/function-call-maybe-real-after/output.js @@ -0,0 +1,9 @@ +var x = babelHelpers.temporalUndefined; + +function f() { + babelHelpers.temporalRef(x, "x"); +} + +Math.random() === 2 && f(); +x = void 0; +f(); diff --git a/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/function-call-maybe-value-assign/exec.js b/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/function-call-maybe-value-assign/exec.js new file mode 100644 index 000000000000..6b24914bd9a9 --- /dev/null +++ b/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/function-call-maybe-value-assign/exec.js @@ -0,0 +1,5 @@ +function f() { x } +Math.random() === 2 && f(); +let x = 3; + +expect(x).toBe(3); diff --git a/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/function-call-maybe-value-assign/input.js b/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/function-call-maybe-value-assign/input.js new file mode 100644 index 000000000000..6b24914bd9a9 --- /dev/null +++ b/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/function-call-maybe-value-assign/input.js @@ -0,0 +1,5 @@ +function f() { x } +Math.random() === 2 && f(); +let x = 3; + +expect(x).toBe(3); diff --git a/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/function-call-maybe-value-assign/output.js b/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/function-call-maybe-value-assign/output.js new file mode 100644 index 000000000000..65855262f71a --- /dev/null +++ b/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/function-call-maybe-value-assign/output.js @@ -0,0 +1,9 @@ +var x = babelHelpers.temporalUndefined; + +function f() { + babelHelpers.temporalRef(x, "x"); +} + +Math.random() === 2 && f(); +x = 3; +expect(x).toBe(3); diff --git a/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/function-call-maybe/exec.js b/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/function-call-maybe/exec.js new file mode 100644 index 000000000000..4b2b4b9e3177 --- /dev/null +++ b/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/function-call-maybe/exec.js @@ -0,0 +1,29 @@ +// "random" :) +let random = (i => { + const vals = [0, 0, 1, 1]; + return () => vals[i++]; +})(0); + +expect(() => { + function f() { x } + random() && f(); + let x; +}).not.toThrow(); + +expect(() => { + function f() { x } + random() || f(); + let x; +}).toThrow(ReferenceError); + +expect(() => { + function f() { x } + random() && f(); + let x; +}).toThrow(ReferenceError); + +expect(() => { + function f() { x } + random() || f(); + let x; +}).not.toThrow(); diff --git a/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/function-call-maybe/input.js b/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/function-call-maybe/input.js new file mode 100644 index 000000000000..41390ee1f4a6 --- /dev/null +++ b/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/function-call-maybe/input.js @@ -0,0 +1,3 @@ +function f() { x } +Math.random() && f(); +let x; diff --git a/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/function-call-maybe/output.js b/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/function-call-maybe/output.js new file mode 100644 index 000000000000..7d416473c45e --- /dev/null +++ b/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/function-call-maybe/output.js @@ -0,0 +1,9 @@ +var x = babelHelpers.temporalUndefined; + +function f() { + babelHelpers.temporalRef(x, "x"); +} + +Math.random() && f(); +x = void 0; +void 0; diff --git a/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/function-call-nested-function/exec.js b/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/function-call-nested-function/exec.js new file mode 100644 index 000000000000..44763e65ec3f --- /dev/null +++ b/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/function-call-nested-function/exec.js @@ -0,0 +1,17 @@ +expect(() => { + function f() { + return function() { x }; + } + let g = f(); + let x; + g(); +}).not.toThrow(); + +expect(() => { + function f() { + return function() { x }; + } + let g = f(); + g(); + let x; +}).toThrow(ReferenceError); diff --git a/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/function-call-nested-function/input.js b/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/function-call-nested-function/input.js new file mode 100644 index 000000000000..473220910b97 --- /dev/null +++ b/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/function-call-nested-function/input.js @@ -0,0 +1,5 @@ +function f() { + return function() { x }; +} +f(); +let x; \ No newline at end of file diff --git a/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/function-call-nested-function/output.js b/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/function-call-nested-function/output.js new file mode 100644 index 000000000000..262dd53d4306 --- /dev/null +++ b/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/function-call-nested-function/output.js @@ -0,0 +1,11 @@ +var x = babelHelpers.temporalUndefined; + +function f() { + return function () { + babelHelpers.temporalRef(x, "x"); + }; +} + +f(); +x = void 0; +void 0; diff --git a/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/function-call-recursive-after/exec.js b/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/function-call-recursive-after/exec.js new file mode 100644 index 000000000000..0e7185778c41 --- /dev/null +++ b/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/function-call-recursive-after/exec.js @@ -0,0 +1,9 @@ +expect(() => { + function f(i) { + if (i) f(i - 1); + x; + } + + let x; + f(3); +}).not.toThrow(); diff --git a/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/function-call-recursive-after/input.js b/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/function-call-recursive-after/input.js new file mode 100644 index 000000000000..d50d6a69743e --- /dev/null +++ b/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/function-call-recursive-after/input.js @@ -0,0 +1,7 @@ +function f(i) { + if (i) f(i - 1); + x; +} + +let x; +f(3); diff --git a/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/function-call-recursive-after/output.js b/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/function-call-recursive-after/output.js new file mode 100644 index 000000000000..c63e0af30e2d --- /dev/null +++ b/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/function-call-recursive-after/output.js @@ -0,0 +1,7 @@ +function f(i) { + if (i) f(i - 1); + x; +} + +var x; +f(3); diff --git a/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/function-call-recursive-before/exec.js b/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/function-call-recursive-before/exec.js new file mode 100644 index 000000000000..eef606be9fe5 --- /dev/null +++ b/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/function-call-recursive-before/exec.js @@ -0,0 +1,9 @@ +expect(() => { + function f(i) { + if (i) f(i - 1); + x; + } + + f(3); + let x; +}).toThrow(ReferenceError); diff --git a/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/function-call-recursive-before/input.js b/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/function-call-recursive-before/input.js new file mode 100644 index 000000000000..b07cb1e2235f --- /dev/null +++ b/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/function-call-recursive-before/input.js @@ -0,0 +1,7 @@ +function f(i) { + if (i) f(i - 1); + x; +} + +f(3); +let x; diff --git a/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/function-call-recursive-before/output.js b/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/function-call-recursive-before/output.js new file mode 100644 index 000000000000..38da18f3e1ea --- /dev/null +++ b/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/function-call-recursive-before/output.js @@ -0,0 +1,7 @@ +function f(i) { + if (i) f(i - 1); + babelHelpers.tdz("x"); +} + +f(3); +var x; diff --git a/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/function-call-recursive-reference/exec.js b/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/function-call-recursive-reference/exec.js new file mode 100644 index 000000000000..7dd31073305c --- /dev/null +++ b/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/function-call-recursive-reference/exec.js @@ -0,0 +1,12 @@ +expect(() => { + function f(i) { + return () => { + x; + f(i - 1); + }; + } + + const g = f(1); + let x; + g(); +}).not.toThrow(); diff --git a/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/function-call-recursive-reference/input.js b/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/function-call-recursive-reference/input.js new file mode 100644 index 000000000000..07c586249f11 --- /dev/null +++ b/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/function-call-recursive-reference/input.js @@ -0,0 +1,10 @@ +function f(i) { + return () => { + x; + f(i - 1); + }; +} + +const g = f(1); +let x; +g(); diff --git a/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/function-call-recursive-reference/output.js b/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/function-call-recursive-reference/output.js new file mode 100644 index 000000000000..0621da46002f --- /dev/null +++ b/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/function-call-recursive-reference/output.js @@ -0,0 +1,12 @@ +var x = babelHelpers.temporalUndefined; + +function f(i) { + return () => { + babelHelpers.temporalRef(x, "x"); + f(i - 1); + }; +} + +var g = f(1); +x = void 0; +g(); diff --git a/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/function-ref/input.js b/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/function-ref/input.js new file mode 100644 index 000000000000..4955ea61d31a --- /dev/null +++ b/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/function-ref/input.js @@ -0,0 +1,3 @@ +function f() { x } +maybeCall(f); +let x; diff --git a/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/function-ref/output.js b/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/function-ref/output.js new file mode 100644 index 000000000000..816fba494e3d --- /dev/null +++ b/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/function-ref/output.js @@ -0,0 +1,9 @@ +var x = babelHelpers.temporalUndefined; + +function f() { + babelHelpers.temporalRef(x, "x"); +} + +maybeCall(f); +x = void 0; +void 0; diff --git a/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/hoisted-function/exec.js b/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/hoisted-function/exec.js index 4f5fd2025711..254ec1eb3200 100644 --- a/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/hoisted-function/exec.js +++ b/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/hoisted-function/exec.js @@ -1,3 +1,5 @@ -f(); +expect(() => { + f(); -function f() {} + function f() {} +}).not.toThrow(); diff --git a/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/hoisted-function/input.js b/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/hoisted-function/input.js new file mode 100644 index 000000000000..4f5fd2025711 --- /dev/null +++ b/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/hoisted-function/input.js @@ -0,0 +1,3 @@ +f(); + +function f() {} diff --git a/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/hoisted-function/output.js b/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/hoisted-function/output.js new file mode 100644 index 000000000000..4f5fd2025711 --- /dev/null +++ b/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/hoisted-function/output.js @@ -0,0 +1,3 @@ +f(); + +function f() {} diff --git a/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/hoisted-var/exec.js b/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/hoisted-var/exec.js index 4c3aa2b2feaa..a63f521aa873 100644 --- a/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/hoisted-var/exec.js +++ b/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/hoisted-var/exec.js @@ -1,3 +1,5 @@ -x = 3; +expect(() => { + x = 3; -var x; + var x; +}).not.toThrow(); diff --git a/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/hoisted-var/input.js b/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/hoisted-var/input.js new file mode 100644 index 000000000000..4c3aa2b2feaa --- /dev/null +++ b/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/hoisted-var/input.js @@ -0,0 +1,3 @@ +x = 3; + +var x; diff --git a/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/hoisted-var/output.js b/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/hoisted-var/output.js new file mode 100644 index 000000000000..ba478df54193 --- /dev/null +++ b/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/hoisted-var/output.js @@ -0,0 +1,2 @@ +x = 3; +var x; diff --git a/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/options.json b/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/options.json index 07942e513ebc..e04afdec5da4 100644 --- a/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/options.json +++ b/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/options.json @@ -1,3 +1,6 @@ { - "plugins": [["transform-block-scoping", { "tdz": true }]] + "plugins": [ + ["transform-block-scoping", { "tdz": true }], + ["external-helpers", { "helperVersion": "7.1000.0" }] + ] } diff --git a/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/self-reference/exec.js b/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/self-reference/exec.js index 29ade8c5aade..a2fbc3b8e865 100644 --- a/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/self-reference/exec.js +++ b/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/self-reference/exec.js @@ -1 +1,3 @@ -let x = x; +expect(() => { + let x = x; +}).toThrow(ReferenceError); diff --git a/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/self-reference/input.js b/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/self-reference/input.js new file mode 100644 index 000000000000..29ade8c5aade --- /dev/null +++ b/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/self-reference/input.js @@ -0,0 +1 @@ +let x = x; diff --git a/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/self-reference/options.json b/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/self-reference/options.json deleted file mode 100644 index 9bf6222fbc72..000000000000 --- a/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/self-reference/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "x is not defined - temporal dead zone" -} diff --git a/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/self-reference/output.js b/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/self-reference/output.js new file mode 100644 index 000000000000..6b6c616e8b6f --- /dev/null +++ b/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/self-reference/output.js @@ -0,0 +1 @@ +var x = babelHelpers.tdz("x"); diff --git a/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/shadow-outer-var/exec.js b/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/shadow-outer-var/exec.js index 88558f3540ef..1adbbf90a20a 100644 --- a/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/shadow-outer-var/exec.js +++ b/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/shadow-outer-var/exec.js @@ -1,3 +1,8 @@ -var a = 5; -if (a){ console.log(a); let a = 2; } -console.log(a); +expect(() => { + var a = 5; + if (a) { + a; + let a = 2; + } + a; +}).toThrow(ReferenceError); diff --git a/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/shadow-outer-var/input.js b/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/shadow-outer-var/input.js new file mode 100644 index 000000000000..00b816f4bea8 --- /dev/null +++ b/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/shadow-outer-var/input.js @@ -0,0 +1,6 @@ +var a = 5; +if (a) { + a; + let a = 2; +} +a; diff --git a/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/shadow-outer-var/options.json b/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/shadow-outer-var/options.json deleted file mode 100644 index c97e0b72d066..000000000000 --- a/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/shadow-outer-var/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "a is not defined - temporal dead zone" -} diff --git a/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/shadow-outer-var/output.js b/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/shadow-outer-var/output.js new file mode 100644 index 000000000000..387cd33a8a8b --- /dev/null +++ b/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/shadow-outer-var/output.js @@ -0,0 +1,8 @@ +var a = 5; + +if (a) { + babelHelpers.tdz("a"); + var _a = 2; +} + +a; diff --git a/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/simple-assign/exec.js b/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/simple-assign/exec.js new file mode 100644 index 000000000000..c05e082ae3cf --- /dev/null +++ b/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/simple-assign/exec.js @@ -0,0 +1,4 @@ +expect(() => { + i = 2; + let i +}).toThrow(ReferenceError); diff --git a/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/simple-assign/input.js b/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/simple-assign/input.js new file mode 100644 index 000000000000..818e85c9e7a3 --- /dev/null +++ b/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/simple-assign/input.js @@ -0,0 +1,2 @@ +i = 2; +let i diff --git a/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/simple-assign/output.js b/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/simple-assign/output.js new file mode 100644 index 000000000000..b6ec817e6248 --- /dev/null +++ b/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/simple-assign/output.js @@ -0,0 +1,3 @@ +babelHelpers.tdz("i"); +i = 2; +var i; diff --git a/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/simple-reference/exec.js b/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/simple-reference/exec.js index 99758d996390..37f6df1e98d8 100644 --- a/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/simple-reference/exec.js +++ b/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/simple-reference/exec.js @@ -1,2 +1,4 @@ -i -let i +expect(() => { + i + let i +}).toThrow(ReferenceError); diff --git a/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/simple-reference/input.js b/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/simple-reference/input.js new file mode 100644 index 000000000000..99758d996390 --- /dev/null +++ b/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/simple-reference/input.js @@ -0,0 +1,2 @@ +i +let i diff --git a/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/simple-reference/options.json b/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/simple-reference/options.json deleted file mode 100644 index 7983b3617563..000000000000 --- a/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/simple-reference/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "i is not defined - temporal dead zone" -} diff --git a/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/simple-reference/output.js b/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/simple-reference/output.js new file mode 100644 index 000000000000..b9ae80d157d5 --- /dev/null +++ b/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/simple-reference/output.js @@ -0,0 +1,2 @@ +babelHelpers.tdz("i"); +var i; diff --git a/packages/babel-plugin-transform-classes/package.json b/packages/babel-plugin-transform-classes/package.json index f1fcc8a2e80b..aa2d4431ac72 100644 --- a/packages/babel-plugin-transform-classes/package.json +++ b/packages/babel-plugin-transform-classes/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-transform-classes", - "version": "7.5.5", + "version": "7.9.5", "description": "Compile ES2015 classes to ES5", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-classes", "license": "MIT", @@ -9,13 +9,13 @@ }, "main": "lib/index.js", "dependencies": { - "@babel/helper-annotate-as-pure": "^7.0.0", - "@babel/helper-define-map": "^7.5.5", - "@babel/helper-function-name": "^7.1.0", - "@babel/helper-optimise-call-expression": "^7.0.0", - "@babel/helper-plugin-utils": "^7.0.0", - "@babel/helper-replace-supers": "^7.5.5", - "@babel/helper-split-export-declaration": "^7.4.4", + "@babel/helper-annotate-as-pure": "^7.8.3", + "@babel/helper-define-map": "^7.8.3", + "@babel/helper-function-name": "^7.9.5", + "@babel/helper-optimise-call-expression": "^7.8.3", + "@babel/helper-plugin-utils": "^7.8.3", + "@babel/helper-replace-supers": "^7.8.6", + "@babel/helper-split-export-declaration": "^7.8.3", "globals": "^11.1.0" }, "keywords": [ @@ -25,7 +25,7 @@ "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.5.5", - "@babel/helper-plugin-test-runner": "^7.0.0" + "@babel/core": "^7.9.0", + "@babel/helper-plugin-test-runner": "^7.8.3" } } diff --git a/packages/babel-plugin-transform-classes/src/inline-createSuper-helpers.js b/packages/babel-plugin-transform-classes/src/inline-createSuper-helpers.js new file mode 100644 index 000000000000..d0a8b592a359 --- /dev/null +++ b/packages/babel-plugin-transform-classes/src/inline-createSuper-helpers.js @@ -0,0 +1,72 @@ +import { template, types as t } from "@babel/core"; + +const helperIDs = new WeakMap(); + +export default function addCreateSuperHelper(file) { + if (helperIDs.has(file)) { + // TODO: Only use t.cloneNode in Babel 8 + // t.cloneNode isn't supported in every version + return (t.cloneNode || t.clone)(helperIDs.get(file)); + } + + try { + return file.addHelper("createSuper"); + } catch { + // Babel <7.9.0 doesn't support the helper. + } + + const id = file.scope.generateUidIdentifier("createSuper"); + helperIDs.set(file, id); + + const fn = helper({ + CREATE_SUPER: id, + GET_PROTOTYPE_OF: file.addHelper("getPrototypeOf"), + POSSIBLE_CONSTRUCTOR_RETURN: file.addHelper("possibleConstructorReturn"), + }); + + file.path.unshiftContainer("body", [fn]); + file.scope.registerDeclaration(file.path.get("body.0")); + + return t.cloneNode(id); +} + +const helper = template.statement` + function CREATE_SUPER(Derived) { + function isNativeReflectConstruct() { + if (typeof Reflect === "undefined" || !Reflect.construct) return false; + + // core-js@3 + if (Reflect.construct.sham) return false; + + // Proxy can't be polyfilled. Every browser implemented + // proxies before or at the same time as Reflect.construct, + // so if they support Proxy they also support Reflect.construct. + if (typeof Proxy === "function") return true; + + // Since Reflect.construct can't be properly polyfilled, some + // implementations (e.g. core-js@2) don't set the correct internal slots. + // Those polyfills don't allow us to subclass built-ins, so we need to + // use our fallback implementation. + try { + // If the internal slots aren't set, this throws an error similar to + // TypeError: this is not a Date object. + Date.prototype.toString.call(Reflect.construct(Date, [], function() {})); + return true; + } catch (e) { + return false; + } + } + + return function () { + var Super = GET_PROTOTYPE_OF(Derived), result; + if (isNativeReflectConstruct()) { + // NOTE: This doesn't work if this.__proto__.constructor has been modified. + var NewTarget = GET_PROTOTYPE_OF(this).constructor; + result = Reflect.construct(Super, arguments, NewTarget); + } else { + result = Super.apply(this, arguments); + } + return POSSIBLE_CONSTRUCTOR_RETURN(this, result); + } + } +`; diff --git a/packages/babel-plugin-transform-classes/src/transformClass.js b/packages/babel-plugin-transform-classes/src/transformClass.js index 0335e363439a..57440d3f567c 100644 --- a/packages/babel-plugin-transform-classes/src/transformClass.js +++ b/packages/babel-plugin-transform-classes/src/transformClass.js @@ -6,6 +6,9 @@ import ReplaceSupers, { import optimiseCall from "@babel/helper-optimise-call-expression"; import * as defineMap from "@babel/helper-define-map"; import { traverse, template, types as t } from "@babel/core"; +import annotateAsPure from "@babel/helper-annotate-as-pure"; + +import addCreateSuperHelper from "./inline-createSuper-helpers"; type ReadonlySet = Set | { has(val: T): boolean }; @@ -34,6 +37,7 @@ export default function transformClass( classId: undefined, classRef: undefined, + superFnId: undefined, superName: undefined, superReturns: [], isDerived: false, @@ -256,7 +260,7 @@ export default function transformClass( } function wrapSuperCall(bareSuper, superRef, thisRef, body) { - let bareSuperNode = bareSuper.node; + const bareSuperNode = bareSuper.node; let call; if (classState.isLoose) { @@ -283,18 +287,11 @@ export default function transformClass( call = t.logicalExpression("||", bareSuperNode, t.thisExpression()); } else { - bareSuperNode = optimiseCall( - t.callExpression(classState.file.addHelper("getPrototypeOf"), [ - t.cloneNode(classState.classRef), - ]), + call = optimiseCall( + t.cloneNode(classState.superFnId), t.thisExpression(), bareSuperNode.arguments, ); - - call = t.callExpression( - classState.file.addHelper("possibleConstructorReturn"), - [t.thisExpression(), bareSuperNode], - ); } if ( @@ -543,10 +540,26 @@ export default function transformClass( function pushInheritsToBody() { if (!classState.isDerived || classState.pushedInherits) return; - setState({ pushedInherits: true }); + const superFnId = path.scope.generateUidIdentifier("super"); + + setState({ pushedInherits: true, superFnId }); // Unshift to ensure that the constructor inheritance is set up before // any properties can be assigned to the prototype. + + if (!classState.isLoose) { + classState.body.unshift( + t.variableDeclaration("var", [ + t.variableDeclarator( + superFnId, + t.callExpression(addCreateSuperHelper(classState.file), [ + t.cloneNode(classState.classRef), + ]), + ), + ]), + ); + } + classState.body.unshift( t.expressionStatement( t.callExpression( @@ -565,11 +578,14 @@ export default function transformClass( const closureArgs = []; if (classState.isDerived) { - const arg = classState.extendsNative - ? t.callExpression(classState.file.addHelper("wrapNativeSuper"), [ - t.cloneNode(superName), - ]) - : t.cloneNode(superName); + let arg = t.cloneNode(superName); + if (classState.extendsNative) { + arg = t.callExpression(classState.file.addHelper("wrapNativeSuper"), [ + arg, + ]); + annotateAsPure(arg); + } + const param = classState.scope.generateUidIdentifierBasedOnNode( superName, ); diff --git a/packages/babel-plugin-transform-classes/test/fixtures/extend-builtins/loose/output.js b/packages/babel-plugin-transform-classes/test/fixtures/extend-builtins/loose/output.js index e41d1690f68e..a52a5f4da9d8 100644 --- a/packages/babel-plugin-transform-classes/test/fixtures/extend-builtins/loose/output.js +++ b/packages/babel-plugin-transform-classes/test/fixtures/extend-builtins/loose/output.js @@ -2,9 +2,9 @@ function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.crea function _wrapNativeSuper(Class) { var _cache = typeof Map === "function" ? new Map() : undefined; _wrapNativeSuper = function _wrapNativeSuper(Class) { if (Class === null || !_isNativeFunction(Class)) return Class; if (typeof Class !== "function") { throw new TypeError("Super expression must either be null or a function"); } if (typeof _cache !== "undefined") { if (_cache.has(Class)) return _cache.get(Class); _cache.set(Class, Wrapper); } function Wrapper() { return _construct(Class, arguments, _getPrototypeOf(this).constructor); } Wrapper.prototype = Object.create(Class.prototype, { constructor: { value: Wrapper, enumerable: false, writable: true, configurable: true } }); return _setPrototypeOf(Wrapper, Class); }; return _wrapNativeSuper(Class); } -function isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } +function _construct(Parent, args, Class) { if (_isNativeReflectConstruct()) { _construct = Reflect.construct; } else { _construct = function _construct(Parent, args, Class) { var a = [null]; a.push.apply(a, args); var Constructor = Function.bind.apply(Parent, a); var instance = new Constructor(); if (Class) _setPrototypeOf(instance, Class.prototype); return instance; }; } return _construct.apply(null, arguments); } -function _construct(Parent, args, Class) { if (isNativeReflectConstruct()) { _construct = Reflect.construct; } else { _construct = function _construct(Parent, args, Class) { var a = [null]; a.push.apply(a, args); var Constructor = Function.bind.apply(Parent, a); var instance = new Constructor(); if (Class) _setPrototypeOf(instance, Class.prototype); return instance; }; } return _construct.apply(null, arguments); } +function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } function _isNativeFunction(fn) { return Function.toString.call(fn).indexOf("[native code]") !== -1; } @@ -12,9 +12,7 @@ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || func function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } -var List = -/*#__PURE__*/ -function (_Array) { +var List = /*#__PURE__*/function (_Array) { "use strict"; _inheritsLoose(List, _Array); @@ -24,4 +22,4 @@ function (_Array) { } return List; -}(_wrapNativeSuper(Array)); +}( /*#__PURE__*/_wrapNativeSuper(Array)); diff --git a/packages/babel-plugin-transform-classes/test/fixtures/extend-builtins/shadowed/output.js b/packages/babel-plugin-transform-classes/test/fixtures/extend-builtins/shadowed/output.js index dae69708600a..6aa1dbe7adb8 100644 --- a/packages/babel-plugin-transform-classes/test/fixtures/extend-builtins/shadowed/output.js +++ b/packages/babel-plugin-transform-classes/test/fixtures/extend-builtins/shadowed/output.js @@ -1,19 +1,23 @@ +function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function () { var Super = babelHelpers.getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = babelHelpers.getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return babelHelpers.possibleConstructorReturn(this, result); }; } + +function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } + let Array = function Array() { "use strict"; babelHelpers.classCallCheck(this, Array); }; -let List = -/*#__PURE__*/ -function (_Array) { +let List = /*#__PURE__*/function (_Array) { "use strict"; babelHelpers.inherits(List, _Array); + var _super = _createSuper(List); + function List() { babelHelpers.classCallCheck(this, List); - return babelHelpers.possibleConstructorReturn(this, babelHelpers.getPrototypeOf(List).apply(this, arguments)); + return _super.apply(this, arguments); } return List; diff --git a/packages/babel-plugin-transform-classes/test/fixtures/extend-builtins/spec/output.js b/packages/babel-plugin-transform-classes/test/fixtures/extend-builtins/spec/output.js index 8128d008f696..89f3026a0e43 100644 --- a/packages/babel-plugin-transform-classes/test/fixtures/extend-builtins/spec/output.js +++ b/packages/babel-plugin-transform-classes/test/fixtures/extend-builtins/spec/output.js @@ -1,16 +1,18 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } + +function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function () { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } + function _possibleConstructorReturn(self, call) { if (call && (typeof call === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } - function _wrapNativeSuper(Class) { var _cache = typeof Map === "function" ? new Map() : undefined; _wrapNativeSuper = function _wrapNativeSuper(Class) { if (Class === null || !_isNativeFunction(Class)) return Class; if (typeof Class !== "function") { throw new TypeError("Super expression must either be null or a function"); } if (typeof _cache !== "undefined") { if (_cache.has(Class)) return _cache.get(Class); _cache.set(Class, Wrapper); } function Wrapper() { return _construct(Class, arguments, _getPrototypeOf(this).constructor); } Wrapper.prototype = Object.create(Class.prototype, { constructor: { value: Wrapper, enumerable: false, writable: true, configurable: true } }); return _setPrototypeOf(Wrapper, Class); }; return _wrapNativeSuper(Class); } -function isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } +function _construct(Parent, args, Class) { if (_isNativeReflectConstruct()) { _construct = Reflect.construct; } else { _construct = function _construct(Parent, args, Class) { var a = [null]; a.push.apply(a, args); var Constructor = Function.bind.apply(Parent, a); var instance = new Constructor(); if (Class) _setPrototypeOf(instance, Class.prototype); return instance; }; } return _construct.apply(null, arguments); } -function _construct(Parent, args, Class) { if (isNativeReflectConstruct()) { _construct = Reflect.construct; } else { _construct = function _construct(Parent, args, Class) { var a = [null]; a.push.apply(a, args); var Constructor = Function.bind.apply(Parent, a); var instance = new Constructor(); if (Class) _setPrototypeOf(instance, Class.prototype); return instance; }; } return _construct.apply(null, arguments); } +function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } function _isNativeFunction(fn) { return Function.toString.call(fn).indexOf("[native code]") !== -1; } @@ -18,18 +20,18 @@ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || func function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } -var List = -/*#__PURE__*/ -function (_Array) { +var List = /*#__PURE__*/function (_Array) { "use strict"; _inherits(List, _Array); + var _super = _createSuper(List); + function List() { _classCallCheck(this, List); - return _possibleConstructorReturn(this, _getPrototypeOf(List).apply(this, arguments)); + return _super.apply(this, arguments); } return List; -}(_wrapNativeSuper(Array)); +}( /*#__PURE__*/_wrapNativeSuper(Array)); diff --git a/packages/babel-plugin-transform-classes/test/fixtures/get-set-loose/call-semantics-data-defined-on-parent/output.js b/packages/babel-plugin-transform-classes/test/fixtures/get-set-loose/call-semantics-data-defined-on-parent/output.js index ee6d7888aaa6..36ae19da78ef 100644 --- a/packages/babel-plugin-transform-classes/test/fixtures/get-set-loose/call-semantics-data-defined-on-parent/output.js +++ b/packages/babel-plugin-transform-classes/test/fixtures/get-set-loose/call-semantics-data-defined-on-parent/output.js @@ -2,9 +2,7 @@ function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; } -let Base = -/*#__PURE__*/ -function () { +let Base = /*#__PURE__*/function () { function Base() {} var _proto = Base.prototype; @@ -18,9 +16,7 @@ function () { return Base; }(); -let Obj = -/*#__PURE__*/ -function (_Base) { +let Obj = /*#__PURE__*/function (_Base) { _inheritsLoose(Obj, _Base); function Obj() { diff --git a/packages/babel-plugin-transform-classes/test/fixtures/get-set-loose/call-semantics-getter-defined-on-parent/output.js b/packages/babel-plugin-transform-classes/test/fixtures/get-set-loose/call-semantics-getter-defined-on-parent/output.js index e221a210b240..22e33e1fbd8f 100644 --- a/packages/babel-plugin-transform-classes/test/fixtures/get-set-loose/call-semantics-getter-defined-on-parent/output.js +++ b/packages/babel-plugin-transform-classes/test/fixtures/get-set-loose/call-semantics-getter-defined-on-parent/output.js @@ -6,9 +6,7 @@ function _defineProperties(target, props) { for (var i = 0; i < props.length; i+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } -let Base = -/*#__PURE__*/ -function () { +let Base = /*#__PURE__*/function () { function Base() {} _createClass(Base, [{ @@ -28,9 +26,7 @@ function () { return Base; }(); -let Obj = -/*#__PURE__*/ -function (_Base) { +let Obj = /*#__PURE__*/function (_Base) { _inheritsLoose(Obj, _Base); function Obj() { diff --git a/packages/babel-plugin-transform-classes/test/fixtures/get-set-loose/call-semantics-not-defined-on-parent/output.js b/packages/babel-plugin-transform-classes/test/fixtures/get-set-loose/call-semantics-not-defined-on-parent/output.js index 19a5133e9a66..35437a744d3b 100644 --- a/packages/babel-plugin-transform-classes/test/fixtures/get-set-loose/call-semantics-not-defined-on-parent/output.js +++ b/packages/babel-plugin-transform-classes/test/fixtures/get-set-loose/call-semantics-not-defined-on-parent/output.js @@ -4,9 +4,7 @@ function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.crea let Base = function Base() {}; -let Obj = -/*#__PURE__*/ -function (_Base) { +let Obj = /*#__PURE__*/function (_Base) { _inheritsLoose(Obj, _Base); function Obj() { diff --git a/packages/babel-plugin-transform-classes/test/fixtures/get-set-loose/call-semantics-setter-defined-on-parent/output.js b/packages/babel-plugin-transform-classes/test/fixtures/get-set-loose/call-semantics-setter-defined-on-parent/output.js index 002192c52d83..43755b886d77 100644 --- a/packages/babel-plugin-transform-classes/test/fixtures/get-set-loose/call-semantics-setter-defined-on-parent/output.js +++ b/packages/babel-plugin-transform-classes/test/fixtures/get-set-loose/call-semantics-setter-defined-on-parent/output.js @@ -6,9 +6,7 @@ function _defineProperties(target, props) { for (var i = 0; i < props.length; i+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } -let Base = -/*#__PURE__*/ -function () { +let Base = /*#__PURE__*/function () { function Base() {} _createClass(Base, [{ @@ -21,9 +19,7 @@ function () { return Base; }(); -let Obj = -/*#__PURE__*/ -function (_Base) { +let Obj = /*#__PURE__*/function (_Base) { _inheritsLoose(Obj, _Base); function Obj() { diff --git a/packages/babel-plugin-transform-classes/test/fixtures/get-set-loose/get-semantics-data-defined-on-parent/output.js b/packages/babel-plugin-transform-classes/test/fixtures/get-set-loose/get-semantics-data-defined-on-parent/output.js index 9526f8a361db..073dbb8f9086 100644 --- a/packages/babel-plugin-transform-classes/test/fixtures/get-set-loose/get-semantics-data-defined-on-parent/output.js +++ b/packages/babel-plugin-transform-classes/test/fixtures/get-set-loose/get-semantics-data-defined-on-parent/output.js @@ -6,9 +6,7 @@ let Base = function Base() {}; Base.prototype.test = 1; -let Obj = -/*#__PURE__*/ -function (_Base) { +let Obj = /*#__PURE__*/function (_Base) { _inheritsLoose(Obj, _Base); function Obj() { diff --git a/packages/babel-plugin-transform-classes/test/fixtures/get-set-loose/get-semantics-getter-defined-on-parent/output.js b/packages/babel-plugin-transform-classes/test/fixtures/get-set-loose/get-semantics-getter-defined-on-parent/output.js index 36ab29407fd2..e100018292d6 100644 --- a/packages/babel-plugin-transform-classes/test/fixtures/get-set-loose/get-semantics-getter-defined-on-parent/output.js +++ b/packages/babel-plugin-transform-classes/test/fixtures/get-set-loose/get-semantics-getter-defined-on-parent/output.js @@ -6,9 +6,7 @@ function _defineProperties(target, props) { for (var i = 0; i < props.length; i+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } -let Base = -/*#__PURE__*/ -function () { +let Base = /*#__PURE__*/function () { function Base() {} _createClass(Base, [{ @@ -24,9 +22,7 @@ function () { return Base; }(); -let Obj = -/*#__PURE__*/ -function (_Base) { +let Obj = /*#__PURE__*/function (_Base) { _inheritsLoose(Obj, _Base); function Obj() { diff --git a/packages/babel-plugin-transform-classes/test/fixtures/get-set-loose/get-semantics-not-defined-on-parent/output.js b/packages/babel-plugin-transform-classes/test/fixtures/get-set-loose/get-semantics-not-defined-on-parent/output.js index 9880bfe11307..62247a8c4d96 100644 --- a/packages/babel-plugin-transform-classes/test/fixtures/get-set-loose/get-semantics-not-defined-on-parent/output.js +++ b/packages/babel-plugin-transform-classes/test/fixtures/get-set-loose/get-semantics-not-defined-on-parent/output.js @@ -4,9 +4,7 @@ function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.crea let Base = function Base() {}; -let Obj = -/*#__PURE__*/ -function (_Base) { +let Obj = /*#__PURE__*/function (_Base) { _inheritsLoose(Obj, _Base); function Obj() { diff --git a/packages/babel-plugin-transform-classes/test/fixtures/get-set-loose/get-semantics-setter-defined-on-parent/output.js b/packages/babel-plugin-transform-classes/test/fixtures/get-set-loose/get-semantics-setter-defined-on-parent/output.js index 4e03f7e9fcfa..9afd6ef654fc 100644 --- a/packages/babel-plugin-transform-classes/test/fixtures/get-set-loose/get-semantics-setter-defined-on-parent/output.js +++ b/packages/babel-plugin-transform-classes/test/fixtures/get-set-loose/get-semantics-setter-defined-on-parent/output.js @@ -6,9 +6,7 @@ function _defineProperties(target, props) { for (var i = 0; i < props.length; i+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } -let Base = -/*#__PURE__*/ -function () { +let Base = /*#__PURE__*/function () { function Base() {} _createClass(Base, [{ @@ -21,9 +19,7 @@ function () { return Base; }(); -let Obj = -/*#__PURE__*/ -function (_Base) { +let Obj = /*#__PURE__*/function (_Base) { _inheritsLoose(Obj, _Base); function Obj() { diff --git a/packages/babel-plugin-transform-classes/test/fixtures/get-set-loose/memoized-assign/output.js b/packages/babel-plugin-transform-classes/test/fixtures/get-set-loose/memoized-assign/output.js index 10536326298b..92cb4f6d39aa 100644 --- a/packages/babel-plugin-transform-classes/test/fixtures/get-set-loose/memoized-assign/output.js +++ b/packages/babel-plugin-transform-classes/test/fixtures/get-set-loose/memoized-assign/output.js @@ -22,9 +22,7 @@ const proper = { }; -let Obj = -/*#__PURE__*/ -function (_Base) { +let Obj = /*#__PURE__*/function (_Base) { _inheritsLoose(Obj, _Base); function Obj() { diff --git a/packages/babel-plugin-transform-classes/test/fixtures/get-set-loose/memoized-update/output.js b/packages/babel-plugin-transform-classes/test/fixtures/get-set-loose/memoized-update/output.js index eaeea288da15..950af23a4295 100644 --- a/packages/babel-plugin-transform-classes/test/fixtures/get-set-loose/memoized-update/output.js +++ b/packages/babel-plugin-transform-classes/test/fixtures/get-set-loose/memoized-update/output.js @@ -22,9 +22,7 @@ const proper = { }; -let Obj = -/*#__PURE__*/ -function (_Base) { +let Obj = /*#__PURE__*/function (_Base) { _inheritsLoose(Obj, _Base); function Obj() { diff --git a/packages/babel-plugin-transform-classes/test/fixtures/get-set-loose/set-semantics-data-defined-on-parent/output.js b/packages/babel-plugin-transform-classes/test/fixtures/get-set-loose/set-semantics-data-defined-on-parent/output.js index 498198dd54ee..bfb30c85242a 100644 --- a/packages/babel-plugin-transform-classes/test/fixtures/get-set-loose/set-semantics-data-defined-on-parent/output.js +++ b/packages/babel-plugin-transform-classes/test/fixtures/get-set-loose/set-semantics-data-defined-on-parent/output.js @@ -10,9 +10,7 @@ Object.defineProperty(Base.prototype, 'test', { configurable: true }); -let Obj = -/*#__PURE__*/ -function (_Base) { +let Obj = /*#__PURE__*/function (_Base) { _inheritsLoose(Obj, _Base); function Obj() { diff --git a/packages/babel-plugin-transform-classes/test/fixtures/get-set-loose/set-semantics-getter-defined-on-parent/output.js b/packages/babel-plugin-transform-classes/test/fixtures/get-set-loose/set-semantics-getter-defined-on-parent/output.js index 27c87b612321..386a31be8017 100644 --- a/packages/babel-plugin-transform-classes/test/fixtures/get-set-loose/set-semantics-getter-defined-on-parent/output.js +++ b/packages/babel-plugin-transform-classes/test/fixtures/get-set-loose/set-semantics-getter-defined-on-parent/output.js @@ -8,9 +8,7 @@ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _d let called = false; -let Base = -/*#__PURE__*/ -function () { +let Base = /*#__PURE__*/function () { function Base() {} _createClass(Base, [{ @@ -26,9 +24,7 @@ function () { ; -let Obj = -/*#__PURE__*/ -function (_Base) { +let Obj = /*#__PURE__*/function (_Base) { _inheritsLoose(Obj, _Base); function Obj() { diff --git a/packages/babel-plugin-transform-classes/test/fixtures/get-set-loose/set-semantics-not-defined-on-parent-data-on-obj/output.js b/packages/babel-plugin-transform-classes/test/fixtures/get-set-loose/set-semantics-not-defined-on-parent-data-on-obj/output.js index 639eba6cc16c..6bee588327f5 100644 --- a/packages/babel-plugin-transform-classes/test/fixtures/get-set-loose/set-semantics-not-defined-on-parent-data-on-obj/output.js +++ b/packages/babel-plugin-transform-classes/test/fixtures/get-set-loose/set-semantics-not-defined-on-parent-data-on-obj/output.js @@ -4,9 +4,7 @@ function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.crea let Base = function Base() {}; -let Obj = -/*#__PURE__*/ -function (_Base) { +let Obj = /*#__PURE__*/function (_Base) { _inheritsLoose(Obj, _Base); function Obj() { diff --git a/packages/babel-plugin-transform-classes/test/fixtures/get-set-loose/set-semantics-not-defined-on-parent-getter-on-obj/output.js b/packages/babel-plugin-transform-classes/test/fixtures/get-set-loose/set-semantics-not-defined-on-parent-getter-on-obj/output.js index e66fd7e19178..80aa04f8ebeb 100644 --- a/packages/babel-plugin-transform-classes/test/fixtures/get-set-loose/set-semantics-not-defined-on-parent-getter-on-obj/output.js +++ b/packages/babel-plugin-transform-classes/test/fixtures/get-set-loose/set-semantics-not-defined-on-parent-getter-on-obj/output.js @@ -10,9 +10,7 @@ let Base = function Base() {}; let called = false; -let Obj = -/*#__PURE__*/ -function (_Base) { +let Obj = /*#__PURE__*/function (_Base) { _inheritsLoose(Obj, _Base); function Obj() { diff --git a/packages/babel-plugin-transform-classes/test/fixtures/get-set-loose/set-semantics-not-defined-on-parent-not-on-obj/output.js b/packages/babel-plugin-transform-classes/test/fixtures/get-set-loose/set-semantics-not-defined-on-parent-not-on-obj/output.js index c5cb38d3efee..6035452d69ec 100644 --- a/packages/babel-plugin-transform-classes/test/fixtures/get-set-loose/set-semantics-not-defined-on-parent-not-on-obj/output.js +++ b/packages/babel-plugin-transform-classes/test/fixtures/get-set-loose/set-semantics-not-defined-on-parent-not-on-obj/output.js @@ -4,9 +4,7 @@ function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.crea let Base = function Base() {}; -let Obj = -/*#__PURE__*/ -function (_Base) { +let Obj = /*#__PURE__*/function (_Base) { _inheritsLoose(Obj, _Base); function Obj() { diff --git a/packages/babel-plugin-transform-classes/test/fixtures/get-set-loose/set-semantics-not-defined-on-parent-setter-on-obj/output.js b/packages/babel-plugin-transform-classes/test/fixtures/get-set-loose/set-semantics-not-defined-on-parent-setter-on-obj/output.js index 583f064e8679..d3349f28f1ae 100644 --- a/packages/babel-plugin-transform-classes/test/fixtures/get-set-loose/set-semantics-not-defined-on-parent-setter-on-obj/output.js +++ b/packages/babel-plugin-transform-classes/test/fixtures/get-set-loose/set-semantics-not-defined-on-parent-setter-on-obj/output.js @@ -10,9 +10,7 @@ let Base = function Base() {}; let value = 2; -let Obj = -/*#__PURE__*/ -function (_Base) { +let Obj = /*#__PURE__*/function (_Base) { _inheritsLoose(Obj, _Base); function Obj() { diff --git a/packages/babel-plugin-transform-classes/test/fixtures/get-set-loose/set-semantics-setter-defined-on-parent/output.js b/packages/babel-plugin-transform-classes/test/fixtures/get-set-loose/set-semantics-setter-defined-on-parent/output.js index 271a214803b7..85df34460909 100644 --- a/packages/babel-plugin-transform-classes/test/fixtures/get-set-loose/set-semantics-setter-defined-on-parent/output.js +++ b/packages/babel-plugin-transform-classes/test/fixtures/get-set-loose/set-semantics-setter-defined-on-parent/output.js @@ -8,9 +8,7 @@ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _d let value = 1; -let Base = -/*#__PURE__*/ -function () { +let Base = /*#__PURE__*/function () { function Base() {} _createClass(Base, [{ @@ -23,9 +21,7 @@ function () { return Base; }(); -let Obj = -/*#__PURE__*/ -function (_Base) { +let Obj = /*#__PURE__*/function (_Base) { _inheritsLoose(Obj, _Base); function Obj() { diff --git a/packages/babel-plugin-transform-classes/test/fixtures/get-set/call-semantics-data-defined-on-parent/output.js b/packages/babel-plugin-transform-classes/test/fixtures/get-set/call-semantics-data-defined-on-parent/output.js index b6ec2c9d20f3..bca3f596e743 100644 --- a/packages/babel-plugin-transform-classes/test/fixtures/get-set/call-semantics-data-defined-on-parent/output.js +++ b/packages/babel-plugin-transform-classes/test/fixtures/get-set/call-semantics-data-defined-on-parent/output.js @@ -1,28 +1,30 @@ "use strict"; -function _possibleConstructorReturn(self, call) { if (call && (typeof call === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } - -function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } - function _get(target, property, receiver) { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get; } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(receiver); } return desc.value; }; } return _get(target, property, receiver || target); } function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; } -function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } - function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } +function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function () { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } + +function _possibleConstructorReturn(self, call) { if (call && (typeof call === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } + +function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } + +function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } + +function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } -let Base = -/*#__PURE__*/ -function () { +let Base = /*#__PURE__*/function () { function Base() { _classCallCheck(this, Base); } @@ -39,15 +41,15 @@ function () { return Base; }(); -let Obj = -/*#__PURE__*/ -function (_Base) { +let Obj = /*#__PURE__*/function (_Base) { _inherits(Obj, _Base); + var _super = _createSuper(Obj); + function Obj() { _classCallCheck(this, Obj); - return _possibleConstructorReturn(this, _getPrototypeOf(Obj).apply(this, arguments)); + return _super.apply(this, arguments); } _createClass(Obj, [{ diff --git a/packages/babel-plugin-transform-classes/test/fixtures/get-set/call-semantics-getter-defined-on-parent/output.js b/packages/babel-plugin-transform-classes/test/fixtures/get-set/call-semantics-getter-defined-on-parent/output.js index 1882922d30d9..5cac4d2608bb 100644 --- a/packages/babel-plugin-transform-classes/test/fixtures/get-set/call-semantics-getter-defined-on-parent/output.js +++ b/packages/babel-plugin-transform-classes/test/fixtures/get-set/call-semantics-getter-defined-on-parent/output.js @@ -1,28 +1,30 @@ "use strict"; -function _possibleConstructorReturn(self, call) { if (call && (typeof call === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } - -function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } - function _get(target, property, receiver) { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get; } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(receiver); } return desc.value; }; } return _get(target, property, receiver || target); } function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; } -function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } - function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } +function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function () { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } + +function _possibleConstructorReturn(self, call) { if (call && (typeof call === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } + +function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } + +function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } + +function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } -let Base = -/*#__PURE__*/ -function () { +let Base = /*#__PURE__*/function () { function Base() { _classCallCheck(this, Base); } @@ -42,15 +44,15 @@ function () { return Base; }(); -let Obj = -/*#__PURE__*/ -function (_Base) { +let Obj = /*#__PURE__*/function (_Base) { _inherits(Obj, _Base); + var _super = _createSuper(Obj); + function Obj() { _classCallCheck(this, Obj); - return _possibleConstructorReturn(this, _getPrototypeOf(Obj).apply(this, arguments)); + return _super.apply(this, arguments); } _createClass(Obj, [{ diff --git a/packages/babel-plugin-transform-classes/test/fixtures/get-set/call-semantics-not-defined-on-parent/output.js b/packages/babel-plugin-transform-classes/test/fixtures/get-set/call-semantics-not-defined-on-parent/output.js index ed3a319213b5..4260e81b4602 100644 --- a/packages/babel-plugin-transform-classes/test/fixtures/get-set/call-semantics-not-defined-on-parent/output.js +++ b/packages/babel-plugin-transform-classes/test/fixtures/get-set/call-semantics-not-defined-on-parent/output.js @@ -4,35 +4,39 @@ function _defineProperties(target, props) { for (var i = 0; i < props.length; i+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } -function _possibleConstructorReturn(self, call) { if (call && (typeof call === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } - -function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } - function _get(target, property, receiver) { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get; } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(receiver); } return desc.value; }; } return _get(target, property, receiver || target); } function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; } -function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } - function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } +function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function () { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } + +function _possibleConstructorReturn(self, call) { if (call && (typeof call === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } + +function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } + +function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } + +function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } let Base = function Base() { _classCallCheck(this, Base); }; -let Obj = -/*#__PURE__*/ -function (_Base) { +let Obj = /*#__PURE__*/function (_Base) { _inherits(Obj, _Base); + var _super = _createSuper(Obj); + function Obj() { _classCallCheck(this, Obj); - return _possibleConstructorReturn(this, _getPrototypeOf(Obj).apply(this, arguments)); + return _super.apply(this, arguments); } _createClass(Obj, [{ diff --git a/packages/babel-plugin-transform-classes/test/fixtures/get-set/call-semantics-setter-defined-on-parent/output.js b/packages/babel-plugin-transform-classes/test/fixtures/get-set/call-semantics-setter-defined-on-parent/output.js index a5e95d1274ef..19c8ad5fd593 100644 --- a/packages/babel-plugin-transform-classes/test/fixtures/get-set/call-semantics-setter-defined-on-parent/output.js +++ b/packages/babel-plugin-transform-classes/test/fixtures/get-set/call-semantics-setter-defined-on-parent/output.js @@ -1,28 +1,30 @@ "use strict"; -function _possibleConstructorReturn(self, call) { if (call && (typeof call === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } - -function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } - function _get(target, property, receiver) { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get; } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(receiver); } return desc.value; }; } return _get(target, property, receiver || target); } function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; } -function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } - function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } +function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function () { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } + +function _possibleConstructorReturn(self, call) { if (call && (typeof call === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } + +function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } + +function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } + +function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } -let Base = -/*#__PURE__*/ -function () { +let Base = /*#__PURE__*/function () { function Base() { _classCallCheck(this, Base); } @@ -37,15 +39,15 @@ function () { return Base; }(); -let Obj = -/*#__PURE__*/ -function (_Base) { +let Obj = /*#__PURE__*/function (_Base) { _inherits(Obj, _Base); + var _super = _createSuper(Obj); + function Obj() { _classCallCheck(this, Obj); - return _possibleConstructorReturn(this, _getPrototypeOf(Obj).apply(this, arguments)); + return _super.apply(this, arguments); } _createClass(Obj, [{ diff --git a/packages/babel-plugin-transform-classes/test/fixtures/get-set/get-semantics-data-defined-on-parent/output.js b/packages/babel-plugin-transform-classes/test/fixtures/get-set/get-semantics-data-defined-on-parent/output.js index 5ded4c810e50..eef428a16607 100644 --- a/packages/babel-plugin-transform-classes/test/fixtures/get-set/get-semantics-data-defined-on-parent/output.js +++ b/packages/babel-plugin-transform-classes/test/fixtures/get-set/get-semantics-data-defined-on-parent/output.js @@ -4,20 +4,24 @@ function _defineProperties(target, props) { for (var i = 0; i < props.length; i+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } -function _possibleConstructorReturn(self, call) { if (call && (typeof call === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } - -function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } - function _get(target, property, receiver) { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get; } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(receiver); } return desc.value; }; } return _get(target, property, receiver || target); } function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; } -function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } - function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } +function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function () { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } + +function _possibleConstructorReturn(self, call) { if (call && (typeof call === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } + +function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } + +function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } + +function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } let Base = function Base() { @@ -26,15 +30,15 @@ let Base = function Base() { Base.prototype.test = 1; -let Obj = -/*#__PURE__*/ -function (_Base) { +let Obj = /*#__PURE__*/function (_Base) { _inherits(Obj, _Base); + var _super = _createSuper(Obj); + function Obj() { _classCallCheck(this, Obj); - return _possibleConstructorReturn(this, _getPrototypeOf(Obj).apply(this, arguments)); + return _super.apply(this, arguments); } _createClass(Obj, [{ diff --git a/packages/babel-plugin-transform-classes/test/fixtures/get-set/get-semantics-getter-defined-on-parent/output.js b/packages/babel-plugin-transform-classes/test/fixtures/get-set/get-semantics-getter-defined-on-parent/output.js index 751f21606609..f26fc55bb513 100644 --- a/packages/babel-plugin-transform-classes/test/fixtures/get-set/get-semantics-getter-defined-on-parent/output.js +++ b/packages/babel-plugin-transform-classes/test/fixtures/get-set/get-semantics-getter-defined-on-parent/output.js @@ -1,28 +1,30 @@ "use strict"; -function _possibleConstructorReturn(self, call) { if (call && (typeof call === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } - -function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } - function _get(target, property, receiver) { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get; } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(receiver); } return desc.value; }; } return _get(target, property, receiver || target); } function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; } -function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } - function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } +function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function () { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } + +function _possibleConstructorReturn(self, call) { if (call && (typeof call === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } + +function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } + +function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } + +function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } -let Base = -/*#__PURE__*/ -function () { +let Base = /*#__PURE__*/function () { function Base() { _classCallCheck(this, Base); } @@ -38,15 +40,15 @@ function () { return Base; }(); -let Obj = -/*#__PURE__*/ -function (_Base) { +let Obj = /*#__PURE__*/function (_Base) { _inherits(Obj, _Base); + var _super = _createSuper(Obj); + function Obj() { _classCallCheck(this, Obj); - return _possibleConstructorReturn(this, _getPrototypeOf(Obj).apply(this, arguments)); + return _super.apply(this, arguments); } _createClass(Obj, [{ diff --git a/packages/babel-plugin-transform-classes/test/fixtures/get-set/get-semantics-not-defined-on-parent/output.js b/packages/babel-plugin-transform-classes/test/fixtures/get-set/get-semantics-not-defined-on-parent/output.js index 790dc28d590e..684712ef3faa 100644 --- a/packages/babel-plugin-transform-classes/test/fixtures/get-set/get-semantics-not-defined-on-parent/output.js +++ b/packages/babel-plugin-transform-classes/test/fixtures/get-set/get-semantics-not-defined-on-parent/output.js @@ -4,35 +4,39 @@ function _defineProperties(target, props) { for (var i = 0; i < props.length; i+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } -function _possibleConstructorReturn(self, call) { if (call && (typeof call === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } - -function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } - function _get(target, property, receiver) { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get; } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(receiver); } return desc.value; }; } return _get(target, property, receiver || target); } function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; } -function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } - function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } +function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function () { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } + +function _possibleConstructorReturn(self, call) { if (call && (typeof call === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } + +function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } + +function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } + +function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } let Base = function Base() { _classCallCheck(this, Base); }; -let Obj = -/*#__PURE__*/ -function (_Base) { +let Obj = /*#__PURE__*/function (_Base) { _inherits(Obj, _Base); + var _super = _createSuper(Obj); + function Obj() { _classCallCheck(this, Obj); - return _possibleConstructorReturn(this, _getPrototypeOf(Obj).apply(this, arguments)); + return _super.apply(this, arguments); } _createClass(Obj, [{ diff --git a/packages/babel-plugin-transform-classes/test/fixtures/get-set/get-semantics-setter-defined-on-parent/output.js b/packages/babel-plugin-transform-classes/test/fixtures/get-set/get-semantics-setter-defined-on-parent/output.js index 3fb37ea4fae0..2f0a7d6b6f58 100644 --- a/packages/babel-plugin-transform-classes/test/fixtures/get-set/get-semantics-setter-defined-on-parent/output.js +++ b/packages/babel-plugin-transform-classes/test/fixtures/get-set/get-semantics-setter-defined-on-parent/output.js @@ -1,28 +1,30 @@ "use strict"; -function _possibleConstructorReturn(self, call) { if (call && (typeof call === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } - -function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } - function _get(target, property, receiver) { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get; } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(receiver); } return desc.value; }; } return _get(target, property, receiver || target); } function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; } -function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } - function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } +function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function () { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } + +function _possibleConstructorReturn(self, call) { if (call && (typeof call === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } + +function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } + +function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } + +function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } -let Base = -/*#__PURE__*/ -function () { +let Base = /*#__PURE__*/function () { function Base() { _classCallCheck(this, Base); } @@ -37,15 +39,15 @@ function () { return Base; }(); -let Obj = -/*#__PURE__*/ -function (_Base) { +let Obj = /*#__PURE__*/function (_Base) { _inherits(Obj, _Base); + var _super = _createSuper(Obj); + function Obj() { _classCallCheck(this, Obj); - return _possibleConstructorReturn(this, _getPrototypeOf(Obj).apply(this, arguments)); + return _super.apply(this, arguments); } _createClass(Obj, [{ diff --git a/packages/babel-plugin-transform-classes/test/fixtures/get-set/memoized-assign/output.js b/packages/babel-plugin-transform-classes/test/fixtures/get-set/memoized-assign/output.js index 53c5587ab59f..360264faa2d7 100644 --- a/packages/babel-plugin-transform-classes/test/fixtures/get-set/memoized-assign/output.js +++ b/packages/babel-plugin-transform-classes/test/fixtures/get-set/memoized-assign/output.js @@ -4,10 +4,6 @@ function _defineProperties(target, props) { for (var i = 0; i < props.length; i+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } -function _possibleConstructorReturn(self, call) { if (call && (typeof call === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } - -function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } - function set(target, property, value, receiver) { if (typeof Reflect !== "undefined" && Reflect.set) { set = Reflect.set; } else { set = function set(target, property, value, receiver) { var base = _superPropBase(target, property); var desc; if (base) { desc = Object.getOwnPropertyDescriptor(base, property); if (desc.set) { desc.set.call(receiver, value); return true; } else if (!desc.writable) { return false; } } desc = Object.getOwnPropertyDescriptor(receiver, property); if (desc) { if (!desc.writable) { return false; } desc.value = value; Object.defineProperty(receiver, property, desc); } else { _defineProperty(receiver, property, value); } return true; }; } return set(target, property, value, receiver); } function _set(target, property, value, receiver, isStrict) { var s = set(target, property, value, receiver || target); if (!s && isStrict) { throw new Error('failed to set property'); } return value; } @@ -18,12 +14,20 @@ function _get(target, property, receiver) { if (typeof Reflect !== "undefined" & function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; } -function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } - function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } +function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function () { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } + +function _possibleConstructorReturn(self, call) { if (call && (typeof call === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } + +function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } + +function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } + +function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } let Base = function Base() { @@ -48,15 +52,15 @@ const proper = { }; -let Obj = -/*#__PURE__*/ -function (_Base) { +let Obj = /*#__PURE__*/function (_Base) { _inherits(Obj, _Base); + var _super = _createSuper(Obj); + function Obj() { _classCallCheck(this, Obj); - return _possibleConstructorReturn(this, _getPrototypeOf(Obj).apply(this, arguments)); + return _super.apply(this, arguments); } _createClass(Obj, [{ diff --git a/packages/babel-plugin-transform-classes/test/fixtures/get-set/memoized-update/output.js b/packages/babel-plugin-transform-classes/test/fixtures/get-set/memoized-update/output.js index 6fbcdfc3f5f6..469c183050f1 100644 --- a/packages/babel-plugin-transform-classes/test/fixtures/get-set/memoized-update/output.js +++ b/packages/babel-plugin-transform-classes/test/fixtures/get-set/memoized-update/output.js @@ -4,10 +4,6 @@ function _defineProperties(target, props) { for (var i = 0; i < props.length; i+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } -function _possibleConstructorReturn(self, call) { if (call && (typeof call === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } - -function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } - function set(target, property, value, receiver) { if (typeof Reflect !== "undefined" && Reflect.set) { set = Reflect.set; } else { set = function set(target, property, value, receiver) { var base = _superPropBase(target, property); var desc; if (base) { desc = Object.getOwnPropertyDescriptor(base, property); if (desc.set) { desc.set.call(receiver, value); return true; } else if (!desc.writable) { return false; } } desc = Object.getOwnPropertyDescriptor(receiver, property); if (desc) { if (!desc.writable) { return false; } desc.value = value; Object.defineProperty(receiver, property, desc); } else { _defineProperty(receiver, property, value); } return true; }; } return set(target, property, value, receiver); } function _set(target, property, value, receiver, isStrict) { var s = set(target, property, value, receiver || target); if (!s && isStrict) { throw new Error('failed to set property'); } return value; } @@ -18,12 +14,20 @@ function _get(target, property, receiver) { if (typeof Reflect !== "undefined" & function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; } -function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } - function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } +function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function () { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } + +function _possibleConstructorReturn(self, call) { if (call && (typeof call === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } + +function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } + +function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } + +function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } let Base = function Base() { @@ -48,15 +52,15 @@ const proper = { }; -let Obj = -/*#__PURE__*/ -function (_Base) { +let Obj = /*#__PURE__*/function (_Base) { _inherits(Obj, _Base); + var _super = _createSuper(Obj); + function Obj() { _classCallCheck(this, Obj); - return _possibleConstructorReturn(this, _getPrototypeOf(Obj).apply(this, arguments)); + return _super.apply(this, arguments); } _createClass(Obj, [{ diff --git a/packages/babel-plugin-transform-classes/test/fixtures/get-set/set-semantics-data-defined-on-parent/output.js b/packages/babel-plugin-transform-classes/test/fixtures/get-set/set-semantics-data-defined-on-parent/output.js index 7a7af63a98d5..b5d00938c4c7 100644 --- a/packages/babel-plugin-transform-classes/test/fixtures/get-set/set-semantics-data-defined-on-parent/output.js +++ b/packages/babel-plugin-transform-classes/test/fixtures/get-set/set-semantics-data-defined-on-parent/output.js @@ -4,10 +4,6 @@ function _defineProperties(target, props) { for (var i = 0; i < props.length; i+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } -function _possibleConstructorReturn(self, call) { if (call && (typeof call === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } - -function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } - function set(target, property, value, receiver) { if (typeof Reflect !== "undefined" && Reflect.set) { set = Reflect.set; } else { set = function set(target, property, value, receiver) { var base = _superPropBase(target, property); var desc; if (base) { desc = Object.getOwnPropertyDescriptor(base, property); if (desc.set) { desc.set.call(receiver, value); return true; } else if (!desc.writable) { return false; } } desc = Object.getOwnPropertyDescriptor(receiver, property); if (desc) { if (!desc.writable) { return false; } desc.value = value; Object.defineProperty(receiver, property, desc); } else { _defineProperty(receiver, property, value); } return true; }; } return set(target, property, value, receiver); } function _set(target, property, value, receiver, isStrict) { var s = set(target, property, value, receiver || target); if (!s && isStrict) { throw new Error('failed to set property'); } return value; } @@ -16,12 +12,20 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; } -function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } - function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } +function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function () { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } + +function _possibleConstructorReturn(self, call) { if (call && (typeof call === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } + +function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } + +function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } + +function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } let Base = function Base() { @@ -34,15 +38,15 @@ Object.defineProperty(Base.prototype, 'test', { configurable: true }); -let Obj = -/*#__PURE__*/ -function (_Base) { +let Obj = /*#__PURE__*/function (_Base) { _inherits(Obj, _Base); + var _super = _createSuper(Obj); + function Obj() { _classCallCheck(this, Obj); - return _possibleConstructorReturn(this, _getPrototypeOf(Obj).apply(this, arguments)); + return _super.apply(this, arguments); } _createClass(Obj, [{ diff --git a/packages/babel-plugin-transform-classes/test/fixtures/get-set/set-semantics-getter-defined-on-parent/output.js b/packages/babel-plugin-transform-classes/test/fixtures/get-set/set-semantics-getter-defined-on-parent/output.js index 5f535dab4210..76a086c61f6b 100644 --- a/packages/babel-plugin-transform-classes/test/fixtures/get-set/set-semantics-getter-defined-on-parent/output.js +++ b/packages/babel-plugin-transform-classes/test/fixtures/get-set/set-semantics-getter-defined-on-parent/output.js @@ -1,9 +1,5 @@ "use strict"; -function _possibleConstructorReturn(self, call) { if (call && (typeof call === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } - -function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } - function set(target, property, value, receiver) { if (typeof Reflect !== "undefined" && Reflect.set) { set = Reflect.set; } else { set = function set(target, property, value, receiver) { var base = _superPropBase(target, property); var desc; if (base) { desc = Object.getOwnPropertyDescriptor(base, property); if (desc.set) { desc.set.call(receiver, value); return true; } else if (!desc.writable) { return false; } } desc = Object.getOwnPropertyDescriptor(receiver, property); if (desc) { if (!desc.writable) { return false; } desc.value = value; Object.defineProperty(receiver, property, desc); } else { _defineProperty(receiver, property, value); } return true; }; } return set(target, property, value, receiver); } function _set(target, property, value, receiver, isStrict) { var s = set(target, property, value, receiver || target); if (!s && isStrict) { throw new Error('failed to set property'); } return value; } @@ -12,21 +8,27 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; } -function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } - function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } +function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function () { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } + +function _possibleConstructorReturn(self, call) { if (call && (typeof call === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } + +function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } + +function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } + +function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } -let Base = -/*#__PURE__*/ -function () { +let Base = /*#__PURE__*/function () { function Base() { _classCallCheck(this, Base); } @@ -43,15 +45,15 @@ function () { ; -let Obj = -/*#__PURE__*/ -function (_Base) { +let Obj = /*#__PURE__*/function (_Base) { _inherits(Obj, _Base); + var _super = _createSuper(Obj); + function Obj() { _classCallCheck(this, Obj); - return _possibleConstructorReturn(this, _getPrototypeOf(Obj).apply(this, arguments)); + return _super.apply(this, arguments); } _createClass(Obj, [{ diff --git a/packages/babel-plugin-transform-classes/test/fixtures/get-set/set-semantics-not-defined-on-parent-data-on-obj/output.js b/packages/babel-plugin-transform-classes/test/fixtures/get-set/set-semantics-not-defined-on-parent-data-on-obj/output.js index a2eed62a692c..983498655a45 100644 --- a/packages/babel-plugin-transform-classes/test/fixtures/get-set/set-semantics-not-defined-on-parent-data-on-obj/output.js +++ b/packages/babel-plugin-transform-classes/test/fixtures/get-set/set-semantics-not-defined-on-parent-data-on-obj/output.js @@ -4,10 +4,6 @@ function _defineProperties(target, props) { for (var i = 0; i < props.length; i+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } -function _possibleConstructorReturn(self, call) { if (call && (typeof call === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } - -function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } - function set(target, property, value, receiver) { if (typeof Reflect !== "undefined" && Reflect.set) { set = Reflect.set; } else { set = function set(target, property, value, receiver) { var base = _superPropBase(target, property); var desc; if (base) { desc = Object.getOwnPropertyDescriptor(base, property); if (desc.set) { desc.set.call(receiver, value); return true; } else if (!desc.writable) { return false; } } desc = Object.getOwnPropertyDescriptor(receiver, property); if (desc) { if (!desc.writable) { return false; } desc.value = value; Object.defineProperty(receiver, property, desc); } else { _defineProperty(receiver, property, value); } return true; }; } return set(target, property, value, receiver); } function _set(target, property, value, receiver, isStrict) { var s = set(target, property, value, receiver || target); if (!s && isStrict) { throw new Error('failed to set property'); } return value; } @@ -16,27 +12,35 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; } -function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } - function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } +function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function () { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } + +function _possibleConstructorReturn(self, call) { if (call && (typeof call === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } + +function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } + +function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } + +function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } let Base = function Base() { _classCallCheck(this, Base); }; -let Obj = -/*#__PURE__*/ -function (_Base) { +let Obj = /*#__PURE__*/function (_Base) { _inherits(Obj, _Base); + var _super = _createSuper(Obj); + function Obj() { _classCallCheck(this, Obj); - return _possibleConstructorReturn(this, _getPrototypeOf(Obj).apply(this, arguments)); + return _super.apply(this, arguments); } _createClass(Obj, [{ diff --git a/packages/babel-plugin-transform-classes/test/fixtures/get-set/set-semantics-not-defined-on-parent-getter-on-obj/output.js b/packages/babel-plugin-transform-classes/test/fixtures/get-set/set-semantics-not-defined-on-parent-getter-on-obj/output.js index aa20e6ad8dfd..110439336416 100644 --- a/packages/babel-plugin-transform-classes/test/fixtures/get-set/set-semantics-not-defined-on-parent-getter-on-obj/output.js +++ b/packages/babel-plugin-transform-classes/test/fixtures/get-set/set-semantics-not-defined-on-parent-getter-on-obj/output.js @@ -4,10 +4,6 @@ function _defineProperties(target, props) { for (var i = 0; i < props.length; i+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } -function _possibleConstructorReturn(self, call) { if (call && (typeof call === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } - -function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } - function set(target, property, value, receiver) { if (typeof Reflect !== "undefined" && Reflect.set) { set = Reflect.set; } else { set = function set(target, property, value, receiver) { var base = _superPropBase(target, property); var desc; if (base) { desc = Object.getOwnPropertyDescriptor(base, property); if (desc.set) { desc.set.call(receiver, value); return true; } else if (!desc.writable) { return false; } } desc = Object.getOwnPropertyDescriptor(receiver, property); if (desc) { if (!desc.writable) { return false; } desc.value = value; Object.defineProperty(receiver, property, desc); } else { _defineProperty(receiver, property, value); } return true; }; } return set(target, property, value, receiver); } function _set(target, property, value, receiver, isStrict) { var s = set(target, property, value, receiver || target); if (!s && isStrict) { throw new Error('failed to set property'); } return value; } @@ -16,27 +12,35 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; } -function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } - function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } +function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function () { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } + +function _possibleConstructorReturn(self, call) { if (call && (typeof call === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } + +function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } + +function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } + +function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } let Base = function Base() { _classCallCheck(this, Base); }; -let Obj = -/*#__PURE__*/ -function (_Base) { +let Obj = /*#__PURE__*/function (_Base) { _inherits(Obj, _Base); + var _super = _createSuper(Obj); + function Obj() { _classCallCheck(this, Obj); - return _possibleConstructorReturn(this, _getPrototypeOf(Obj).apply(this, arguments)); + return _super.apply(this, arguments); } _createClass(Obj, [{ diff --git a/packages/babel-plugin-transform-classes/test/fixtures/get-set/set-semantics-not-defined-on-parent-not-on-obj/output.js b/packages/babel-plugin-transform-classes/test/fixtures/get-set/set-semantics-not-defined-on-parent-not-on-obj/output.js index 83302cdb2ced..abc68a6a7203 100644 --- a/packages/babel-plugin-transform-classes/test/fixtures/get-set/set-semantics-not-defined-on-parent-not-on-obj/output.js +++ b/packages/babel-plugin-transform-classes/test/fixtures/get-set/set-semantics-not-defined-on-parent-not-on-obj/output.js @@ -4,10 +4,6 @@ function _defineProperties(target, props) { for (var i = 0; i < props.length; i+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } -function _possibleConstructorReturn(self, call) { if (call && (typeof call === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } - -function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } - function set(target, property, value, receiver) { if (typeof Reflect !== "undefined" && Reflect.set) { set = Reflect.set; } else { set = function set(target, property, value, receiver) { var base = _superPropBase(target, property); var desc; if (base) { desc = Object.getOwnPropertyDescriptor(base, property); if (desc.set) { desc.set.call(receiver, value); return true; } else if (!desc.writable) { return false; } } desc = Object.getOwnPropertyDescriptor(receiver, property); if (desc) { if (!desc.writable) { return false; } desc.value = value; Object.defineProperty(receiver, property, desc); } else { _defineProperty(receiver, property, value); } return true; }; } return set(target, property, value, receiver); } function _set(target, property, value, receiver, isStrict) { var s = set(target, property, value, receiver || target); if (!s && isStrict) { throw new Error('failed to set property'); } return value; } @@ -16,27 +12,35 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; } -function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } - function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } +function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function () { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } + +function _possibleConstructorReturn(self, call) { if (call && (typeof call === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } + +function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } + +function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } + +function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } let Base = function Base() { _classCallCheck(this, Base); }; -let Obj = -/*#__PURE__*/ -function (_Base) { +let Obj = /*#__PURE__*/function (_Base) { _inherits(Obj, _Base); + var _super = _createSuper(Obj); + function Obj() { _classCallCheck(this, Obj); - return _possibleConstructorReturn(this, _getPrototypeOf(Obj).apply(this, arguments)); + return _super.apply(this, arguments); } _createClass(Obj, [{ diff --git a/packages/babel-plugin-transform-classes/test/fixtures/get-set/set-semantics-not-defined-on-parent-setter-on-obj/output.js b/packages/babel-plugin-transform-classes/test/fixtures/get-set/set-semantics-not-defined-on-parent-setter-on-obj/output.js index f74c110fe1ea..013ba14355ec 100644 --- a/packages/babel-plugin-transform-classes/test/fixtures/get-set/set-semantics-not-defined-on-parent-setter-on-obj/output.js +++ b/packages/babel-plugin-transform-classes/test/fixtures/get-set/set-semantics-not-defined-on-parent-setter-on-obj/output.js @@ -4,10 +4,6 @@ function _defineProperties(target, props) { for (var i = 0; i < props.length; i+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } -function _possibleConstructorReturn(self, call) { if (call && (typeof call === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } - -function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } - function set(target, property, value, receiver) { if (typeof Reflect !== "undefined" && Reflect.set) { set = Reflect.set; } else { set = function set(target, property, value, receiver) { var base = _superPropBase(target, property); var desc; if (base) { desc = Object.getOwnPropertyDescriptor(base, property); if (desc.set) { desc.set.call(receiver, value); return true; } else if (!desc.writable) { return false; } } desc = Object.getOwnPropertyDescriptor(receiver, property); if (desc) { if (!desc.writable) { return false; } desc.value = value; Object.defineProperty(receiver, property, desc); } else { _defineProperty(receiver, property, value); } return true; }; } return set(target, property, value, receiver); } function _set(target, property, value, receiver, isStrict) { var s = set(target, property, value, receiver || target); if (!s && isStrict) { throw new Error('failed to set property'); } return value; } @@ -16,12 +12,20 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; } -function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } - function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } +function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function () { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } + +function _possibleConstructorReturn(self, call) { if (call && (typeof call === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } + +function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } + +function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } + +function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } let Base = function Base() { @@ -30,15 +34,15 @@ let Base = function Base() { let value = 2; -let Obj = -/*#__PURE__*/ -function (_Base) { +let Obj = /*#__PURE__*/function (_Base) { _inherits(Obj, _Base); + var _super = _createSuper(Obj); + function Obj() { _classCallCheck(this, Obj); - return _possibleConstructorReturn(this, _getPrototypeOf(Obj).apply(this, arguments)); + return _super.apply(this, arguments); } _createClass(Obj, [{ diff --git a/packages/babel-plugin-transform-classes/test/fixtures/get-set/set-semantics-setter-defined-on-parent/output.js b/packages/babel-plugin-transform-classes/test/fixtures/get-set/set-semantics-setter-defined-on-parent/output.js index 7f66bea53cff..a390ba89b46a 100644 --- a/packages/babel-plugin-transform-classes/test/fixtures/get-set/set-semantics-setter-defined-on-parent/output.js +++ b/packages/babel-plugin-transform-classes/test/fixtures/get-set/set-semantics-setter-defined-on-parent/output.js @@ -1,9 +1,5 @@ "use strict"; -function _possibleConstructorReturn(self, call) { if (call && (typeof call === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } - -function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } - function set(target, property, value, receiver) { if (typeof Reflect !== "undefined" && Reflect.set) { set = Reflect.set; } else { set = function set(target, property, value, receiver) { var base = _superPropBase(target, property); var desc; if (base) { desc = Object.getOwnPropertyDescriptor(base, property); if (desc.set) { desc.set.call(receiver, value); return true; } else if (!desc.writable) { return false; } } desc = Object.getOwnPropertyDescriptor(receiver, property); if (desc) { if (!desc.writable) { return false; } desc.value = value; Object.defineProperty(receiver, property, desc); } else { _defineProperty(receiver, property, value); } return true; }; } return set(target, property, value, receiver); } function _set(target, property, value, receiver, isStrict) { var s = set(target, property, value, receiver || target); if (!s && isStrict) { throw new Error('failed to set property'); } return value; } @@ -12,12 +8,20 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; } -function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } - function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } +function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function () { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } + +function _possibleConstructorReturn(self, call) { if (call && (typeof call === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } + +function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } + +function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } + +function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } @@ -26,9 +30,7 @@ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _d let value = 1; -let Base = -/*#__PURE__*/ -function () { +let Base = /*#__PURE__*/function () { function Base() { _classCallCheck(this, Base); } @@ -43,15 +45,15 @@ function () { return Base; }(); -let Obj = -/*#__PURE__*/ -function (_Base) { +let Obj = /*#__PURE__*/function (_Base) { _inherits(Obj, _Base); + var _super = _createSuper(Obj); + function Obj() { _classCallCheck(this, Obj); - return _possibleConstructorReturn(this, _getPrototypeOf(Obj).apply(this, arguments)); + return _super.apply(this, arguments); } _createClass(Obj, [{ diff --git a/packages/babel-plugin-transform-classes/test/fixtures/loose-classCallCheck/with-constructor/output.js b/packages/babel-plugin-transform-classes/test/fixtures/loose-classCallCheck/with-constructor/output.js index 1844688c05db..5995f96bd6a5 100644 --- a/packages/babel-plugin-transform-classes/test/fixtures/loose-classCallCheck/with-constructor/output.js +++ b/packages/babel-plugin-transform-classes/test/fixtures/loose-classCallCheck/with-constructor/output.js @@ -4,9 +4,7 @@ let A = function A() { console.log('a'); }; -let B = -/*#__PURE__*/ -function () { +let B = /*#__PURE__*/function () { "use strict"; function B() {} diff --git a/packages/babel-plugin-transform-classes/test/fixtures/loose-classCallCheck/with-superClass/output.js b/packages/babel-plugin-transform-classes/test/fixtures/loose-classCallCheck/with-superClass/output.js index 7dfbc2cda9e9..d2dd7f34e2ec 100644 --- a/packages/babel-plugin-transform-classes/test/fixtures/loose-classCallCheck/with-superClass/output.js +++ b/packages/babel-plugin-transform-classes/test/fixtures/loose-classCallCheck/with-superClass/output.js @@ -6,9 +6,7 @@ let B = function B() { "use strict"; }; -let A = -/*#__PURE__*/ -function (_B) { +let A = /*#__PURE__*/function (_B) { "use strict"; _inheritsLoose(A, _B); diff --git a/packages/babel-plugin-transform-classes/test/fixtures/loose/accessing-super-class/output.js b/packages/babel-plugin-transform-classes/test/fixtures/loose/accessing-super-class/output.js index 1d260c689e82..eff73dbfb3a6 100644 --- a/packages/babel-plugin-transform-classes/test/fixtures/loose/accessing-super-class/output.js +++ b/packages/babel-plugin-transform-classes/test/fixtures/loose/accessing-super-class/output.js @@ -1,6 +1,4 @@ -var Test = -/*#__PURE__*/ -function (_Foo) { +var Test = /*#__PURE__*/function (_Foo) { "use strict"; babelHelpers.inheritsLoose(Test, _Foo); diff --git a/packages/babel-plugin-transform-classes/test/fixtures/loose/accessing-super-properties/output.js b/packages/babel-plugin-transform-classes/test/fixtures/loose/accessing-super-properties/output.js index 8ecd49b4caf6..6f6704143517 100644 --- a/packages/babel-plugin-transform-classes/test/fixtures/loose/accessing-super-properties/output.js +++ b/packages/babel-plugin-transform-classes/test/fixtures/loose/accessing-super-properties/output.js @@ -1,6 +1,4 @@ -var Test = -/*#__PURE__*/ -function (_Foo) { +var Test = /*#__PURE__*/function (_Foo) { "use strict"; babelHelpers.inheritsLoose(Test, _Foo); diff --git a/packages/babel-plugin-transform-classes/test/fixtures/loose/blockstatement-with-use-strict-directive/output.js b/packages/babel-plugin-transform-classes/test/fixtures/loose/blockstatement-with-use-strict-directive/output.js index 9295d5720e60..97d93e03e9a2 100644 --- a/packages/babel-plugin-transform-classes/test/fixtures/loose/blockstatement-with-use-strict-directive/output.js +++ b/packages/babel-plugin-transform-classes/test/fixtures/loose/blockstatement-with-use-strict-directive/output.js @@ -1,9 +1,7 @@ function t() { "use strict"; - var Foo = - /*#__PURE__*/ - function () { + var Foo = /*#__PURE__*/function () { function Foo() {} var _proto = Foo.prototype; diff --git a/packages/babel-plugin-transform-classes/test/fixtures/loose/calling-super-properties/output.js b/packages/babel-plugin-transform-classes/test/fixtures/loose/calling-super-properties/output.js index a643db1ebd6b..ce2f520f331a 100644 --- a/packages/babel-plugin-transform-classes/test/fixtures/loose/calling-super-properties/output.js +++ b/packages/babel-plugin-transform-classes/test/fixtures/loose/calling-super-properties/output.js @@ -1,6 +1,4 @@ -var Test = -/*#__PURE__*/ -function (_Foo) { +var Test = /*#__PURE__*/function (_Foo) { "use strict"; babelHelpers.inheritsLoose(Test, _Foo); diff --git a/packages/babel-plugin-transform-classes/test/fixtures/loose/constructor-order/output.js b/packages/babel-plugin-transform-classes/test/fixtures/loose/constructor-order/output.js index 388e99e45968..e8d0c7d31e8e 100644 --- a/packages/babel-plugin-transform-classes/test/fixtures/loose/constructor-order/output.js +++ b/packages/babel-plugin-transform-classes/test/fixtures/loose/constructor-order/output.js @@ -1,6 +1,4 @@ -var x = -/*#__PURE__*/ -function () { +var x = /*#__PURE__*/function () { "use strict"; var _proto = x.prototype; diff --git a/packages/babel-plugin-transform-classes/test/fixtures/loose/default-super/output.js b/packages/babel-plugin-transform-classes/test/fixtures/loose/default-super/output.js index 03bcc774b8bf..21ba73d7b642 100644 --- a/packages/babel-plugin-transform-classes/test/fixtures/loose/default-super/output.js +++ b/packages/babel-plugin-transform-classes/test/fixtures/loose/default-super/output.js @@ -1,6 +1,4 @@ -var Test = -/*#__PURE__*/ -function () { +var Test = /*#__PURE__*/function () { "use strict"; function Test() { diff --git a/packages/babel-plugin-transform-classes/test/fixtures/loose/derived-constructor-must-call-super/output.js b/packages/babel-plugin-transform-classes/test/fixtures/loose/derived-constructor-must-call-super/output.js index a221b7cfb724..5ec44193fbf4 100644 --- a/packages/babel-plugin-transform-classes/test/fixtures/loose/derived-constructor-must-call-super/output.js +++ b/packages/babel-plugin-transform-classes/test/fixtures/loose/derived-constructor-must-call-super/output.js @@ -1,6 +1,4 @@ -var Foo = -/*#__PURE__*/ -function (_Bar) { +var Foo = /*#__PURE__*/function (_Bar) { "use strict"; babelHelpers.inheritsLoose(Foo, _Bar); diff --git a/packages/babel-plugin-transform-classes/test/fixtures/loose/derived-constructor-no-super-return-falsey/output.js b/packages/babel-plugin-transform-classes/test/fixtures/loose/derived-constructor-no-super-return-falsey/output.js index c8ecc7ad2adf..f1631c3f0da1 100644 --- a/packages/babel-plugin-transform-classes/test/fixtures/loose/derived-constructor-no-super-return-falsey/output.js +++ b/packages/babel-plugin-transform-classes/test/fixtures/loose/derived-constructor-no-super-return-falsey/output.js @@ -1,6 +1,4 @@ -var Child = -/*#__PURE__*/ -function (_Base) { +var Child = /*#__PURE__*/function (_Base) { "use strict"; babelHelpers.inheritsLoose(Child, _Base); diff --git a/packages/babel-plugin-transform-classes/test/fixtures/loose/derived-constructor-no-super-return-object/output.js b/packages/babel-plugin-transform-classes/test/fixtures/loose/derived-constructor-no-super-return-object/output.js index fe7950eb71db..60a3d860a4c5 100644 --- a/packages/babel-plugin-transform-classes/test/fixtures/loose/derived-constructor-no-super-return-object/output.js +++ b/packages/babel-plugin-transform-classes/test/fixtures/loose/derived-constructor-no-super-return-object/output.js @@ -1,6 +1,4 @@ -var Child = -/*#__PURE__*/ -function (_Base) { +var Child = /*#__PURE__*/function (_Base) { "use strict"; babelHelpers.inheritsLoose(Child, _Base); diff --git a/packages/babel-plugin-transform-classes/test/fixtures/loose/literal-key/output.js b/packages/babel-plugin-transform-classes/test/fixtures/loose/literal-key/output.js index 15ab4f17a69b..56882e7c3f46 100644 --- a/packages/babel-plugin-transform-classes/test/fixtures/loose/literal-key/output.js +++ b/packages/babel-plugin-transform-classes/test/fixtures/loose/literal-key/output.js @@ -1,6 +1,4 @@ -var Foo = -/*#__PURE__*/ -function () { +var Foo = /*#__PURE__*/function () { "use strict"; function Foo() {} diff --git a/packages/babel-plugin-transform-classes/test/fixtures/loose/method-return-type-annotation/output.js b/packages/babel-plugin-transform-classes/test/fixtures/loose/method-return-type-annotation/output.js index a545674a572e..45403829143d 100644 --- a/packages/babel-plugin-transform-classes/test/fixtures/loose/method-return-type-annotation/output.js +++ b/packages/babel-plugin-transform-classes/test/fixtures/loose/method-return-type-annotation/output.js @@ -1,7 +1,5 @@ // @flow -var C = -/*#__PURE__*/ -function () { +var C = /*#__PURE__*/function () { "use strict"; function C() {} diff --git a/packages/babel-plugin-transform-classes/test/fixtures/loose/method-reuse-prototype/output.js b/packages/babel-plugin-transform-classes/test/fixtures/loose/method-reuse-prototype/output.js index 49978484eb4b..023d4e591889 100644 --- a/packages/babel-plugin-transform-classes/test/fixtures/loose/method-reuse-prototype/output.js +++ b/packages/babel-plugin-transform-classes/test/fixtures/loose/method-reuse-prototype/output.js @@ -1,6 +1,4 @@ -var Test = -/*#__PURE__*/ -function () { +var Test = /*#__PURE__*/function () { "use strict"; function Test() {} diff --git a/packages/babel-plugin-transform-classes/test/fixtures/loose/options.json b/packages/babel-plugin-transform-classes/test/fixtures/loose/options.json index a89247845869..6b7851da95fe 100644 --- a/packages/babel-plugin-transform-classes/test/fixtures/loose/options.json +++ b/packages/babel-plugin-transform-classes/test/fixtures/loose/options.json @@ -1,6 +1,6 @@ { "plugins": [ - "external-helpers", + ["external-helpers", { "helperVersion": "7.100.0" }], "transform-function-name", ["transform-classes", { "loose": true }], ["transform-spread", { "loose": true }], diff --git a/packages/babel-plugin-transform-classes/test/fixtures/loose/program-with-use-strict-directive/output.js b/packages/babel-plugin-transform-classes/test/fixtures/loose/program-with-use-strict-directive/output.js index 54034fca6202..507a490d701b 100644 --- a/packages/babel-plugin-transform-classes/test/fixtures/loose/program-with-use-strict-directive/output.js +++ b/packages/babel-plugin-transform-classes/test/fixtures/loose/program-with-use-strict-directive/output.js @@ -1,8 +1,6 @@ "use strict"; -var Foo = -/*#__PURE__*/ -function () { +var Foo = /*#__PURE__*/function () { function Foo() {} var _proto = Foo.prototype; diff --git a/packages/babel-plugin-transform-classes/test/fixtures/loose/super-class-id-member-expression/output.js b/packages/babel-plugin-transform-classes/test/fixtures/loose/super-class-id-member-expression/output.js index 1a90473147ca..e96b1f982a5e 100644 --- a/packages/babel-plugin-transform-classes/test/fixtures/loose/super-class-id-member-expression/output.js +++ b/packages/babel-plugin-transform-classes/test/fixtures/loose/super-class-id-member-expression/output.js @@ -1,6 +1,4 @@ -var BaseController = -/*#__PURE__*/ -function (_Chaplin$Controller) { +var BaseController = /*#__PURE__*/function (_Chaplin$Controller) { "use strict"; babelHelpers.inheritsLoose(BaseController, _Chaplin$Controller); @@ -12,9 +10,7 @@ function (_Chaplin$Controller) { return BaseController; }(Chaplin.Controller); -var BaseController2 = -/*#__PURE__*/ -function (_Chaplin$Controller$A) { +var BaseController2 = /*#__PURE__*/function (_Chaplin$Controller$A) { "use strict"; babelHelpers.inheritsLoose(BaseController2, _Chaplin$Controller$A); diff --git a/packages/babel-plugin-transform-classes/test/fixtures/loose/super-class/output.js b/packages/babel-plugin-transform-classes/test/fixtures/loose/super-class/output.js index 779cd3877c78..e0204405affa 100644 --- a/packages/babel-plugin-transform-classes/test/fixtures/loose/super-class/output.js +++ b/packages/babel-plugin-transform-classes/test/fixtures/loose/super-class/output.js @@ -1,6 +1,4 @@ -var Test = -/*#__PURE__*/ -function (_Foo) { +var Test = /*#__PURE__*/function (_Foo) { "use strict"; babelHelpers.inheritsLoose(Test, _Foo); diff --git a/packages/babel-plugin-transform-classes/test/fixtures/loose/super-destructuring-array-pattern-1/output.js b/packages/babel-plugin-transform-classes/test/fixtures/loose/super-destructuring-array-pattern-1/output.js index 79753b87162a..936ee7bd5b20 100644 --- a/packages/babel-plugin-transform-classes/test/fixtures/loose/super-destructuring-array-pattern-1/output.js +++ b/packages/babel-plugin-transform-classes/test/fixtures/loose/super-destructuring-array-pattern-1/output.js @@ -1,6 +1,4 @@ -var Foo = -/*#__PURE__*/ -function () { +var Foo = /*#__PURE__*/function () { "use strict"; function Foo() {} diff --git a/packages/babel-plugin-transform-classes/test/fixtures/loose/super-destructuring-array-pattern/output.js b/packages/babel-plugin-transform-classes/test/fixtures/loose/super-destructuring-array-pattern/output.js index 0672ad62fdab..2cd91d8e7fc7 100644 --- a/packages/babel-plugin-transform-classes/test/fixtures/loose/super-destructuring-array-pattern/output.js +++ b/packages/babel-plugin-transform-classes/test/fixtures/loose/super-destructuring-array-pattern/output.js @@ -1,6 +1,4 @@ -var Foo = -/*#__PURE__*/ -function () { +var Foo = /*#__PURE__*/function () { "use strict"; function Foo() {} diff --git a/packages/babel-plugin-transform-classes/test/fixtures/loose/super-destructuring-object-pattern-1/output.js b/packages/babel-plugin-transform-classes/test/fixtures/loose/super-destructuring-object-pattern-1/output.js index 896273e40f43..6385b4db3c2a 100644 --- a/packages/babel-plugin-transform-classes/test/fixtures/loose/super-destructuring-object-pattern-1/output.js +++ b/packages/babel-plugin-transform-classes/test/fixtures/loose/super-destructuring-object-pattern-1/output.js @@ -1,6 +1,4 @@ -var Foo = -/*#__PURE__*/ -function () { +var Foo = /*#__PURE__*/function () { "use strict"; function Foo() {} diff --git a/packages/babel-plugin-transform-classes/test/fixtures/loose/super-destructuring-object-pattern/output.js b/packages/babel-plugin-transform-classes/test/fixtures/loose/super-destructuring-object-pattern/output.js index 816071362136..2da30e7055d8 100644 --- a/packages/babel-plugin-transform-classes/test/fixtures/loose/super-destructuring-object-pattern/output.js +++ b/packages/babel-plugin-transform-classes/test/fixtures/loose/super-destructuring-object-pattern/output.js @@ -1,6 +1,4 @@ -var Foo = -/*#__PURE__*/ -function () { +var Foo = /*#__PURE__*/function () { "use strict"; function Foo() {} diff --git a/packages/babel-plugin-transform-classes/test/fixtures/regression/2663/output.js b/packages/babel-plugin-transform-classes/test/fixtures/regression/2663/output.js index 4ac5364faf8f..cbdd827a68bc 100644 --- a/packages/babel-plugin-transform-classes/test/fixtures/regression/2663/output.js +++ b/packages/babel-plugin-transform-classes/test/fixtures/regression/2663/output.js @@ -11,17 +11,21 @@ var _events = require("events"); var _binarySerializer = babelHelpers.interopRequireDefault(require("./helpers/binary-serializer")); +function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function () { var Super = babelHelpers.getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = babelHelpers.getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return babelHelpers.possibleConstructorReturn(this, result); }; } + +function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } + // import ... -var Connection = -/*#__PURE__*/ -function (_EventEmitter) { +var Connection = /*#__PURE__*/function (_EventEmitter) { babelHelpers.inherits(Connection, _EventEmitter); + var _super = _createSuper(Connection); + function Connection(endpoint, joinKey, joinData, roomId) { var _this; babelHelpers.classCallCheck(this, Connection); - _this = babelHelpers.possibleConstructorReturn(this, babelHelpers.getPrototypeOf(Connection).call(this)); + _this = _super.call(this); _this.isConnected = false; _this.roomId = roomId; // ... diff --git a/packages/babel-plugin-transform-classes/test/fixtures/regression/2694/output.js b/packages/babel-plugin-transform-classes/test/fixtures/regression/2694/output.js index 32ea562ad9b2..f6e2d284ee26 100644 --- a/packages/babel-plugin-transform-classes/test/fixtures/regression/2694/output.js +++ b/packages/babel-plugin-transform-classes/test/fixtures/regression/2694/output.js @@ -7,14 +7,18 @@ exports["default"] = void 0; var _BaseFoo2 = babelHelpers.interopRequireDefault(require("./BaseFoo")); -var SubFoo = -/*#__PURE__*/ -function (_BaseFoo) { +function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function () { var Super = babelHelpers.getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = babelHelpers.getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return babelHelpers.possibleConstructorReturn(this, result); }; } + +function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } + +var SubFoo = /*#__PURE__*/function (_BaseFoo) { babelHelpers.inherits(SubFoo, _BaseFoo); + var _super = _createSuper(SubFoo); + function SubFoo() { babelHelpers.classCallCheck(this, SubFoo); - return babelHelpers.possibleConstructorReturn(this, babelHelpers.getPrototypeOf(SubFoo).apply(this, arguments)); + return _super.apply(this, arguments); } babelHelpers.createClass(SubFoo, null, [{ diff --git a/packages/babel-plugin-transform-classes/test/fixtures/regression/2775/output.js b/packages/babel-plugin-transform-classes/test/fixtures/regression/2775/output.js index 19b7f10208f7..9df074bf2ff8 100644 --- a/packages/babel-plugin-transform-classes/test/fixtures/regression/2775/output.js +++ b/packages/babel-plugin-transform-classes/test/fixtures/regression/2775/output.js @@ -7,22 +7,26 @@ exports["default"] = void 0; var _react = babelHelpers.interopRequireDefault(require("react")); -var RandomComponent = -/*#__PURE__*/ -function (_Component) { +function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function () { var Super = babelHelpers.getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = babelHelpers.getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return babelHelpers.possibleConstructorReturn(this, result); }; } + +function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } + +var RandomComponent = /*#__PURE__*/function (_Component) { babelHelpers.inherits(RandomComponent, _Component); + var _super = _createSuper(RandomComponent); + function RandomComponent() { babelHelpers.classCallCheck(this, RandomComponent); - return babelHelpers.possibleConstructorReturn(this, babelHelpers.getPrototypeOf(RandomComponent).call(this)); + return _super.call(this); } babelHelpers.createClass(RandomComponent, [{ key: "render", value: function render() { - return _react["default"].createElement("div", { + return /*#__PURE__*/_react["default"].createElement("div", { className: "sui-RandomComponent" - }, _react["default"].createElement("h2", null, "Hi there!")); + }, /*#__PURE__*/_react["default"].createElement("h2", null, "Hi there!")); } }]); return RandomComponent; diff --git a/packages/babel-plugin-transform-classes/test/fixtures/regression/3028/output.js b/packages/babel-plugin-transform-classes/test/fixtures/regression/3028/output.js index 333b2e176c1f..db3fd9ba9bf3 100644 --- a/packages/babel-plugin-transform-classes/test/fixtures/regression/3028/output.js +++ b/packages/babel-plugin-transform-classes/test/fixtures/regression/3028/output.js @@ -5,20 +5,24 @@ Object.defineProperty(exports, "__esModule", { }); exports["default"] = void 0; +function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function () { var Super = babelHelpers.getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = babelHelpers.getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return babelHelpers.possibleConstructorReturn(this, result); }; } + +function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } + var b = function b() { babelHelpers.classCallCheck(this, b); }; -var a1 = -/*#__PURE__*/ -function (_b) { +var a1 = /*#__PURE__*/function (_b) { babelHelpers.inherits(a1, _b); + var _super = _createSuper(a1); + function a1() { var _this; babelHelpers.classCallCheck(this, a1); - _this = babelHelpers.possibleConstructorReturn(this, babelHelpers.getPrototypeOf(a1).call(this)); + _this = _super.call(this); _this.x = function () { return babelHelpers.assertThisInitialized(_this); @@ -30,16 +34,16 @@ function (_b) { return a1; }(b); -var a2 = -/*#__PURE__*/ -function (_b2) { +var a2 = /*#__PURE__*/function (_b2) { babelHelpers.inherits(a2, _b2); + var _super2 = _createSuper(a2); + function a2() { var _this2; babelHelpers.classCallCheck(this, a2); - _this2 = babelHelpers.possibleConstructorReturn(this, babelHelpers.getPrototypeOf(a2).call(this)); + _this2 = _super2.call(this); _this2.x = function () { return babelHelpers.assertThisInitialized(_this2); diff --git a/packages/babel-plugin-transform-classes/test/fixtures/regression/5769/output.js b/packages/babel-plugin-transform-classes/test/fixtures/regression/5769/output.js index 41f9eda52e41..c0276814f4a6 100644 --- a/packages/babel-plugin-transform-classes/test/fixtures/regression/5769/output.js +++ b/packages/babel-plugin-transform-classes/test/fixtures/regression/5769/output.js @@ -1,6 +1,8 @@ -var Point = -/*#__PURE__*/ -function () { +function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function () { var Super = babelHelpers.getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = babelHelpers.getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return babelHelpers.possibleConstructorReturn(this, result); }; } + +function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } + +var Point = /*#__PURE__*/function () { "use strict"; function Point() { @@ -16,23 +18,23 @@ function () { return Point; }(); -var ColorPoint = -/*#__PURE__*/ -function (_Point) { +var ColorPoint = /*#__PURE__*/function (_Point) { "use strict"; babelHelpers.inherits(ColorPoint, _Point); + var _super = _createSuper(ColorPoint); + function ColorPoint() { - var _this; + var _thisSuper, _thisSuper2, _this; babelHelpers.classCallCheck(this, ColorPoint); - _this = babelHelpers.possibleConstructorReturn(this, babelHelpers.getPrototypeOf(ColorPoint).call(this)); + _this = _super.call(this); _this.x = 2; - babelHelpers.set(babelHelpers.getPrototypeOf(ColorPoint.prototype), "x", 3, babelHelpers.assertThisInitialized(_this), true); + babelHelpers.set((_thisSuper = babelHelpers.assertThisInitialized(_this), babelHelpers.getPrototypeOf(ColorPoint.prototype)), "x", 3, _thisSuper, true); expect(_this.x).toBe(3); // A - expect(babelHelpers.get(babelHelpers.getPrototypeOf(ColorPoint.prototype), "x", babelHelpers.assertThisInitialized(_this))).toBeUndefined(); // B + expect(babelHelpers.get((_thisSuper2 = babelHelpers.assertThisInitialized(_this), babelHelpers.getPrototypeOf(ColorPoint.prototype)), "x", _thisSuper2)).toBeUndefined(); // B return _this; } diff --git a/packages/babel-plugin-transform-classes/test/fixtures/regression/5817/output.js b/packages/babel-plugin-transform-classes/test/fixtures/regression/5817/output.js index af6350f201df..72a0d27c8af1 100644 --- a/packages/babel-plugin-transform-classes/test/fixtures/regression/5817/output.js +++ b/packages/babel-plugin-transform-classes/test/fixtures/regression/5817/output.js @@ -1,15 +1,19 @@ -var A = -/*#__PURE__*/ -function (_B) { +function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function () { var Super = babelHelpers.getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = babelHelpers.getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return babelHelpers.possibleConstructorReturn(this, result); }; } + +function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } + +var A = /*#__PURE__*/function (_B) { "use strict"; babelHelpers.inherits(A, _B); + var _super = _createSuper(A); + function A() { var _this; babelHelpers.classCallCheck(this, A); - _this = babelHelpers.possibleConstructorReturn(this, babelHelpers.getPrototypeOf(A).call(this)); + _this = _super.call(this); _this.arrow1 = function (x) { return x; diff --git a/packages/babel-plugin-transform-classes/test/fixtures/regression/8499/exec.js b/packages/babel-plugin-transform-classes/test/fixtures/regression/8499/exec.js index 45af5099a97e..1a5d146d5e17 100644 --- a/packages/babel-plugin-transform-classes/test/fixtures/regression/8499/exec.js +++ b/packages/babel-plugin-transform-classes/test/fixtures/regression/8499/exec.js @@ -1,17 +1,26 @@ -// Pretend that `Reflect.construct` isn't supported. -this.Reflect = undefined; +const oldReflect = this.Reflect; +const oldHTMLElement = this.HTMLElement; -this.HTMLElement = function() { - // Here, `this.HTMLElement` is this function, not the original HTMLElement - // constructor. `this.constructor` should be this function too, but isn't. - constructor = this.constructor; -}; +try { + // Pretend that `Reflect.construct` isn't supported. + this.Reflect = undefined; -var constructor; + this.HTMLElement = function() { + // Here, `this.HTMLElement` is this function, not the original HTMLElement + // constructor. `this.constructor` should be this function too, but isn't. + constructor = this.constructor; + }; -class CustomElement extends HTMLElement {}; -new CustomElement(); + var constructor; -expect(constructor).toBe(CustomElement); + class CustomElement extends HTMLElement {}; + new CustomElement(); + + expect(constructor).toBe(CustomElement); +} finally { + // Restore original env + this.Reflect = oldReflect; + this.HTMLElement = oldHTMLElement; +} diff --git a/packages/babel-plugin-transform-classes/test/fixtures/regression/8499/input.js b/packages/babel-plugin-transform-classes/test/fixtures/regression/8499/input.js index 45af5099a97e..1a5d146d5e17 100644 --- a/packages/babel-plugin-transform-classes/test/fixtures/regression/8499/input.js +++ b/packages/babel-plugin-transform-classes/test/fixtures/regression/8499/input.js @@ -1,17 +1,26 @@ -// Pretend that `Reflect.construct` isn't supported. -this.Reflect = undefined; +const oldReflect = this.Reflect; +const oldHTMLElement = this.HTMLElement; -this.HTMLElement = function() { - // Here, `this.HTMLElement` is this function, not the original HTMLElement - // constructor. `this.constructor` should be this function too, but isn't. - constructor = this.constructor; -}; +try { + // Pretend that `Reflect.construct` isn't supported. + this.Reflect = undefined; -var constructor; + this.HTMLElement = function() { + // Here, `this.HTMLElement` is this function, not the original HTMLElement + // constructor. `this.constructor` should be this function too, but isn't. + constructor = this.constructor; + }; -class CustomElement extends HTMLElement {}; -new CustomElement(); + var constructor; -expect(constructor).toBe(CustomElement); + class CustomElement extends HTMLElement {}; + new CustomElement(); + + expect(constructor).toBe(CustomElement); +} finally { + // Restore original env + this.Reflect = oldReflect; + this.HTMLElement = oldHTMLElement; +} diff --git a/packages/babel-plugin-transform-classes/test/fixtures/regression/8499/output.js b/packages/babel-plugin-transform-classes/test/fixtures/regression/8499/output.js index b14eb4235371..ea46593a3f35 100644 --- a/packages/babel-plugin-transform-classes/test/fixtures/regression/8499/output.js +++ b/packages/babel-plugin-transform-classes/test/fixtures/regression/8499/output.js @@ -1,29 +1,42 @@ -// Pretend that `Reflect.construct` isn't supported. -this.Reflect = undefined; +function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function () { var Super = babelHelpers.getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = babelHelpers.getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return babelHelpers.possibleConstructorReturn(this, result); }; } -this.HTMLElement = function () { - // Here, `this.HTMLElement` is this function, not the original HTMLElement - // constructor. `this.constructor` should be this function too, but isn't. - constructor = this.constructor; -}; +function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } -var constructor; +var oldReflect = this.Reflect; +var oldHTMLElement = this.HTMLElement; -var CustomElement = -/*#__PURE__*/ -function (_HTMLElement) { - "use strict"; +try { + // Pretend that `Reflect.construct` isn't supported. + this.Reflect = undefined; - babelHelpers.inherits(CustomElement, _HTMLElement); + this.HTMLElement = function () { + // Here, `this.HTMLElement` is this function, not the original HTMLElement + // constructor. `this.constructor` should be this function too, but isn't. + constructor = this.constructor; + }; - function CustomElement() { - babelHelpers.classCallCheck(this, CustomElement); - return babelHelpers.possibleConstructorReturn(this, babelHelpers.getPrototypeOf(CustomElement).apply(this, arguments)); - } + var constructor; - return CustomElement; -}(babelHelpers.wrapNativeSuper(HTMLElement)); + var CustomElement = /*#__PURE__*/function (_HTMLElement) { + "use strict"; -; -new CustomElement(); -expect(constructor).toBe(CustomElement); + babelHelpers.inherits(CustomElement, _HTMLElement); + + var _super = _createSuper(CustomElement); + + function CustomElement() { + babelHelpers.classCallCheck(this, CustomElement); + return _super.apply(this, arguments); + } + + return CustomElement; + }( /*#__PURE__*/babelHelpers.wrapNativeSuper(HTMLElement)); + + ; + new CustomElement(); + expect(constructor).toBe(CustomElement); +} finally { + // Restore original env + this.Reflect = oldReflect; + this.HTMLElement = oldHTMLElement; +} diff --git a/packages/babel-plugin-transform-classes/test/fixtures/regression/T2494/output.js b/packages/babel-plugin-transform-classes/test/fixtures/regression/T2494/output.js index 2ec0ec90d8fd..157f64e27b6c 100644 --- a/packages/babel-plugin-transform-classes/test/fixtures/regression/T2494/output.js +++ b/packages/babel-plugin-transform-classes/test/fixtures/regression/T2494/output.js @@ -1,14 +1,18 @@ +function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function () { var Super = babelHelpers.getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = babelHelpers.getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return babelHelpers.possibleConstructorReturn(this, result); }; } + +function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } + var x = { - Foo: - /*#__PURE__*/ - function (_Foo) { + Foo: /*#__PURE__*/function (_Foo) { "use strict"; babelHelpers.inherits(_class, _Foo); + var _super = _createSuper(_class); + function _class() { babelHelpers.classCallCheck(this, _class); - return babelHelpers.possibleConstructorReturn(this, babelHelpers.getPrototypeOf(_class).apply(this, arguments)); + return _super.apply(this, arguments); } return _class; diff --git a/packages/babel-plugin-transform-classes/test/fixtures/regression/T2997/output.js b/packages/babel-plugin-transform-classes/test/fixtures/regression/T2997/output.js index 57794290557d..e694047f253f 100644 --- a/packages/babel-plugin-transform-classes/test/fixtures/regression/T2997/output.js +++ b/packages/babel-plugin-transform-classes/test/fixtures/regression/T2997/output.js @@ -1,21 +1,25 @@ +function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function () { var Super = babelHelpers.getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = babelHelpers.getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return babelHelpers.possibleConstructorReturn(this, result); }; } + +function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } + var A = function A() { "use strict"; babelHelpers.classCallCheck(this, A); }; -var B = -/*#__PURE__*/ -function (_A) { +var B = /*#__PURE__*/function (_A) { "use strict"; babelHelpers.inherits(B, _A); + var _super = _createSuper(B); + function B() { var _this; babelHelpers.classCallCheck(this, B); - return babelHelpers.possibleConstructorReturn(_this, _this = babelHelpers.possibleConstructorReturn(this, babelHelpers.getPrototypeOf(B).call(this))); + return babelHelpers.possibleConstructorReturn(_this, _this = _super.call(this)); } return B; diff --git a/packages/babel-plugin-transform-classes/test/fixtures/regression/T6712/output.js b/packages/babel-plugin-transform-classes/test/fixtures/regression/T6712/output.js index 0ab1f6cb2bf4..9fb8344af8f9 100644 --- a/packages/babel-plugin-transform-classes/test/fixtures/regression/T6712/output.js +++ b/packages/babel-plugin-transform-classes/test/fixtures/regression/T6712/output.js @@ -1,6 +1,4 @@ -var A = -/*#__PURE__*/ -function () { +var A = /*#__PURE__*/function () { "use strict"; function A() { diff --git a/packages/babel-plugin-transform-classes/test/fixtures/regression/T6750/output.js b/packages/babel-plugin-transform-classes/test/fixtures/regression/T6750/output.js index 5ea54d765c16..c9d7b956370b 100644 --- a/packages/babel-plugin-transform-classes/test/fixtures/regression/T6750/output.js +++ b/packages/babel-plugin-transform-classes/test/fixtures/regression/T6750/output.js @@ -6,18 +6,15 @@ Object.defineProperty(exports, "__esModule", { exports["default"] = _default; function _default() { - return ( - /*#__PURE__*/ - function () { - function Select() { - babelHelpers.classCallCheck(this, Select); - } + return /*#__PURE__*/function () { + function Select() { + babelHelpers.classCallCheck(this, Select); + } - babelHelpers.createClass(Select, [{ - key: "query", - value: function query(_query) {} - }]); - return Select; - }() - ); + babelHelpers.createClass(Select, [{ + key: "query", + value: function query(_query) {} + }]); + return Select; + }(); } diff --git a/packages/babel-plugin-transform-classes/test/fixtures/regression/T6755/output.js b/packages/babel-plugin-transform-classes/test/fixtures/regression/T6755/output.js index 435ad8c4dfa3..202b822df32d 100644 --- a/packages/babel-plugin-transform-classes/test/fixtures/regression/T6755/output.js +++ b/packages/babel-plugin-transform-classes/test/fixtures/regression/T6755/output.js @@ -2,21 +2,15 @@ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; } -var Example = -/*#__PURE__*/ -function () { +var Example = /*#__PURE__*/function () { "use strict"; function Example() {} var _proto = Example.prototype; - _proto.test1 = - /*#__PURE__*/ - function () { - var _test = _asyncToGenerator( - /*#__PURE__*/ - regeneratorRuntime.mark(function _callee() { + _proto.test1 = /*#__PURE__*/function () { + var _test = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() { return regeneratorRuntime.wrap(function _callee$(_context) { while (1) { switch (_context.prev = _context.next) { @@ -39,9 +33,7 @@ function () { return test1; }(); - _proto.test2 = - /*#__PURE__*/ - regeneratorRuntime.mark(function test2() { + _proto.test2 = /*#__PURE__*/regeneratorRuntime.mark(function test2() { return regeneratorRuntime.wrap(function test2$(_context2) { while (1) { switch (_context2.prev = _context2.next) { diff --git a/packages/babel-plugin-transform-classes/test/fixtures/regression/T7010/output.js b/packages/babel-plugin-transform-classes/test/fixtures/regression/T7010/output.js index 724512cb3250..7e06e4f28a58 100644 --- a/packages/babel-plugin-transform-classes/test/fixtures/regression/T7010/output.js +++ b/packages/babel-plugin-transform-classes/test/fixtures/regression/T7010/output.js @@ -1,6 +1,4 @@ -var Foo = -/*#__PURE__*/ -function () { +var Foo = /*#__PURE__*/function () { "use strict"; function Foo(val) { diff --git a/packages/babel-plugin-transform-classes/test/fixtures/regression/T7537/output.js b/packages/babel-plugin-transform-classes/test/fixtures/regression/T7537/output.js index 5e43e6dd208d..e2d510bd2a1b 100644 --- a/packages/babel-plugin-transform-classes/test/fixtures/regression/T7537/output.js +++ b/packages/babel-plugin-transform-classes/test/fixtures/regression/T7537/output.js @@ -1,14 +1,18 @@ -function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } +function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } + +function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } + +function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function () { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } -function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } +function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } - -function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } +function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } @@ -18,19 +22,19 @@ var B = function B() { _classCallCheck(this, B); }; -var A = -/*#__PURE__*/ -function (_B) { +var A = /*#__PURE__*/function (_B) { "use strict"; _inherits(A, _B); + var _super = _createSuper(A); + function A(track) { var _this; _classCallCheck(this, A); - if (track !== undefined) _this = _possibleConstructorReturn(this, _getPrototypeOf(A).call(this, track));else _this = _possibleConstructorReturn(this, _getPrototypeOf(A).call(this)); + if (track !== undefined) _this = _super.call(this, track);else _this = _super.call(this); return _possibleConstructorReturn(_this); } diff --git a/packages/babel-plugin-transform-classes/test/fixtures/spec/accessing-super-class/output.js b/packages/babel-plugin-transform-classes/test/fixtures/spec/accessing-super-class/output.js index 8d6922614b92..8c5c0dd98f69 100644 --- a/packages/babel-plugin-transform-classes/test/fixtures/spec/accessing-super-class/output.js +++ b/packages/babel-plugin-transform-classes/test/fixtures/spec/accessing-super-class/output.js @@ -1,24 +1,24 @@ -var Test = -/*#__PURE__*/ -function (_Foo) { +var Test = /*#__PURE__*/function (_Foo) { "use strict"; babelHelpers.inherits(Test, _Foo); + var _super = babelHelpers.createSuper(Test); + function Test() { - var _babelHelpers$getProt, _babelHelpers$get; + var _babelHelpers$get; - var _this; + var _thisSuper, _thisSuper2, _thisSuper3, _this; babelHelpers.classCallCheck(this, Test); woops.super.test(); - _this = babelHelpers.possibleConstructorReturn(this, babelHelpers.getPrototypeOf(Test).call(this)); - babelHelpers.get(babelHelpers.getPrototypeOf(Test.prototype), "test", babelHelpers.assertThisInitialized(_this)).call(babelHelpers.assertThisInitialized(_this)); - _this = babelHelpers.possibleConstructorReturn(this, babelHelpers.getPrototypeOf(Test).apply(this, arguments)); - _this = babelHelpers.possibleConstructorReturn(this, (_babelHelpers$getProt = babelHelpers.getPrototypeOf(Test)).call.apply(_babelHelpers$getProt, [this, "test"].concat(Array.prototype.slice.call(arguments)))); - babelHelpers.get(babelHelpers.getPrototypeOf(Test.prototype), "test", babelHelpers.assertThisInitialized(_this)).apply(babelHelpers.assertThisInitialized(_this), arguments); + _this = _super.call(this); + babelHelpers.get((_thisSuper = babelHelpers.assertThisInitialized(_this), babelHelpers.getPrototypeOf(Test.prototype)), "test", _thisSuper).call(_thisSuper); + _this = _super.apply(this, arguments); + _this = _super.call.apply(_super, [this, "test"].concat(Array.prototype.slice.call(arguments))); + babelHelpers.get((_thisSuper2 = babelHelpers.assertThisInitialized(_this), babelHelpers.getPrototypeOf(Test.prototype)), "test", _thisSuper2).apply(_thisSuper2, arguments); - (_babelHelpers$get = babelHelpers.get(babelHelpers.getPrototypeOf(Test.prototype), "test", babelHelpers.assertThisInitialized(_this))).call.apply(_babelHelpers$get, [babelHelpers.assertThisInitialized(_this), "test"].concat(Array.prototype.slice.call(arguments))); + (_babelHelpers$get = babelHelpers.get((_thisSuper3 = babelHelpers.assertThisInitialized(_this), babelHelpers.getPrototypeOf(Test.prototype)), "test", _thisSuper3)).call.apply(_babelHelpers$get, [_thisSuper3, "test"].concat(Array.prototype.slice.call(arguments))); return _this; } diff --git a/packages/babel-plugin-transform-classes/test/fixtures/spec/accessing-super-properties/output.js b/packages/babel-plugin-transform-classes/test/fixtures/spec/accessing-super-properties/output.js index aef35bbb3165..db08cc901b23 100644 --- a/packages/babel-plugin-transform-classes/test/fixtures/spec/accessing-super-properties/output.js +++ b/packages/babel-plugin-transform-classes/test/fixtures/spec/accessing-super-properties/output.js @@ -1,17 +1,17 @@ -var Test = -/*#__PURE__*/ -function (_Foo) { +var Test = /*#__PURE__*/function (_Foo) { "use strict"; babelHelpers.inherits(Test, _Foo); + var _super = babelHelpers.createSuper(Test); + function Test() { - var _this; + var _thisSuper, _thisSuper2, _this; babelHelpers.classCallCheck(this, Test); - _this = babelHelpers.possibleConstructorReturn(this, babelHelpers.getPrototypeOf(Test).call(this)); - babelHelpers.get(babelHelpers.getPrototypeOf(Test.prototype), "test", babelHelpers.assertThisInitialized(_this)); - babelHelpers.get(babelHelpers.getPrototypeOf(Test.prototype), "test", babelHelpers.assertThisInitialized(_this)).whatever; + _this = _super.call(this); + babelHelpers.get((_thisSuper = babelHelpers.assertThisInitialized(_this), babelHelpers.getPrototypeOf(Test.prototype)), "test", _thisSuper); + babelHelpers.get((_thisSuper2 = babelHelpers.assertThisInitialized(_this), babelHelpers.getPrototypeOf(Test.prototype)), "test", _thisSuper2).whatever; return _this; } diff --git a/packages/babel-plugin-transform-classes/test/fixtures/spec/calling-super-properties/output.js b/packages/babel-plugin-transform-classes/test/fixtures/spec/calling-super-properties/output.js index 8c3eaf881132..8f1ba80052a8 100644 --- a/packages/babel-plugin-transform-classes/test/fixtures/spec/calling-super-properties/output.js +++ b/packages/babel-plugin-transform-classes/test/fixtures/spec/calling-super-properties/output.js @@ -1,17 +1,17 @@ -var Test = -/*#__PURE__*/ -function (_Foo) { +var Test = /*#__PURE__*/function (_Foo) { "use strict"; babelHelpers.inherits(Test, _Foo); + var _super = babelHelpers.createSuper(Test); + function Test() { - var _this; + var _thisSuper, _thisSuper2, _this; babelHelpers.classCallCheck(this, Test); - _this = babelHelpers.possibleConstructorReturn(this, babelHelpers.getPrototypeOf(Test).call(this)); - babelHelpers.get(babelHelpers.getPrototypeOf(Test.prototype), "test", babelHelpers.assertThisInitialized(_this)).whatever(); - babelHelpers.get(babelHelpers.getPrototypeOf(Test.prototype), "test", babelHelpers.assertThisInitialized(_this)).call(babelHelpers.assertThisInitialized(_this)); + _this = _super.call(this); + babelHelpers.get((_thisSuper = babelHelpers.assertThisInitialized(_this), babelHelpers.getPrototypeOf(Test.prototype)), "test", _thisSuper).whatever(); + babelHelpers.get((_thisSuper2 = babelHelpers.assertThisInitialized(_this), babelHelpers.getPrototypeOf(Test.prototype)), "test", _thisSuper2).call(_thisSuper2); return _this; } diff --git a/packages/babel-plugin-transform-classes/test/fixtures/spec/computed-methods/output.js b/packages/babel-plugin-transform-classes/test/fixtures/spec/computed-methods/output.js index 63761f596e2a..a61dbbe410e9 100644 --- a/packages/babel-plugin-transform-classes/test/fixtures/spec/computed-methods/output.js +++ b/packages/babel-plugin-transform-classes/test/fixtures/spec/computed-methods/output.js @@ -1,6 +1,4 @@ -var Foo = -/*#__PURE__*/ -function () { +var Foo = /*#__PURE__*/function () { "use strict"; function Foo() { diff --git a/packages/babel-plugin-transform-classes/test/fixtures/spec/constructor/output.js b/packages/babel-plugin-transform-classes/test/fixtures/spec/constructor/output.js index 2ebe633512c1..6946e46f345b 100644 --- a/packages/babel-plugin-transform-classes/test/fixtures/spec/constructor/output.js +++ b/packages/babel-plugin-transform-classes/test/fixtures/spec/constructor/output.js @@ -5,18 +5,18 @@ var Test = function Test() { this.state = "test"; }; -var Foo = -/*#__PURE__*/ -function (_Bar) { +var Foo = /*#__PURE__*/function (_Bar) { "use strict"; babelHelpers.inherits(Foo, _Bar); + var _super = babelHelpers.createSuper(Foo); + function Foo() { var _this; babelHelpers.classCallCheck(this, Foo); - _this = babelHelpers.possibleConstructorReturn(this, babelHelpers.getPrototypeOf(Foo).call(this)); + _this = _super.call(this); _this.state = "test"; return _this; } diff --git a/packages/babel-plugin-transform-classes/test/fixtures/spec/default-super/output.js b/packages/babel-plugin-transform-classes/test/fixtures/spec/default-super/output.js index 8996a90b766b..d093c769cb79 100644 --- a/packages/babel-plugin-transform-classes/test/fixtures/spec/default-super/output.js +++ b/packages/babel-plugin-transform-classes/test/fixtures/spec/default-super/output.js @@ -1,6 +1,4 @@ -var Test = -/*#__PURE__*/ -function () { +var Test = /*#__PURE__*/function () { "use strict"; function Test() { diff --git a/packages/babel-plugin-transform-classes/test/fixtures/spec/delay-arrow-function-for-bare-super-derived/output.js b/packages/babel-plugin-transform-classes/test/fixtures/spec/delay-arrow-function-for-bare-super-derived/output.js index 83a4d9b34146..ade319d8d45b 100644 --- a/packages/babel-plugin-transform-classes/test/fixtures/spec/delay-arrow-function-for-bare-super-derived/output.js +++ b/packages/babel-plugin-transform-classes/test/fixtures/spec/delay-arrow-function-for-bare-super-derived/output.js @@ -1,17 +1,17 @@ -var Foo = -/*#__PURE__*/ -function (_Bar) { +var Foo = /*#__PURE__*/function (_Bar) { "use strict"; babelHelpers.inherits(Foo, _Bar); + var _super = babelHelpers.createSuper(Foo); + function Foo() { var _this; babelHelpers.classCallCheck(this, Foo); - return _this = babelHelpers.possibleConstructorReturn(this, babelHelpers.getPrototypeOf(Foo).call(this, () => { + return _this = _super.call(this, () => { _this.test; - })); + }); } return Foo; diff --git a/packages/babel-plugin-transform-classes/test/fixtures/spec/derived-constructor-must-call-super-2/output.js b/packages/babel-plugin-transform-classes/test/fixtures/spec/derived-constructor-must-call-super-2/output.js index 876987aef3b4..b3d1b7a57f7a 100644 --- a/packages/babel-plugin-transform-classes/test/fixtures/spec/derived-constructor-must-call-super-2/output.js +++ b/packages/babel-plugin-transform-classes/test/fixtures/spec/derived-constructor-must-call-super-2/output.js @@ -1,15 +1,15 @@ -var Foo = -/*#__PURE__*/ -function (_Bar) { +var Foo = /*#__PURE__*/function (_Bar) { "use strict"; babelHelpers.inherits(Foo, _Bar); + var _super = babelHelpers.createSuper(Foo); + function Foo() { var _this; babelHelpers.classCallCheck(this, Foo); - if (eval("false")) _this = babelHelpers.possibleConstructorReturn(this, babelHelpers.getPrototypeOf(Foo).call(this)); + if (eval("false")) _this = _super.call(this); return babelHelpers.possibleConstructorReturn(_this); } diff --git a/packages/babel-plugin-transform-classes/test/fixtures/spec/derived-constructor-must-call-super-3/output.js b/packages/babel-plugin-transform-classes/test/fixtures/spec/derived-constructor-must-call-super-3/output.js index 1859492a7bfa..5f3edc9406a3 100644 --- a/packages/babel-plugin-transform-classes/test/fixtures/spec/derived-constructor-must-call-super-3/output.js +++ b/packages/babel-plugin-transform-classes/test/fixtures/spec/derived-constructor-must-call-super-3/output.js @@ -1,16 +1,16 @@ -var Foo = -/*#__PURE__*/ -function (_Bar) { +var Foo = /*#__PURE__*/function (_Bar) { "use strict"; babelHelpers.inherits(Foo, _Bar); + var _super = babelHelpers.createSuper(Foo); + function Foo() { var _this; babelHelpers.classCallCheck(this, Foo); - var fn = () => _this = babelHelpers.possibleConstructorReturn(this, babelHelpers.getPrototypeOf(Foo).call(this)); + var fn = () => _this = _super.call(this); fn(); return babelHelpers.possibleConstructorReturn(_this); diff --git a/packages/babel-plugin-transform-classes/test/fixtures/spec/derived-constructor-must-call-super-4/output.js b/packages/babel-plugin-transform-classes/test/fixtures/spec/derived-constructor-must-call-super-4/output.js index 3ffe7db5e611..370e4fcc20b3 100644 --- a/packages/babel-plugin-transform-classes/test/fixtures/spec/derived-constructor-must-call-super-4/output.js +++ b/packages/babel-plugin-transform-classes/test/fixtures/spec/derived-constructor-must-call-super-4/output.js @@ -1,16 +1,16 @@ -var Foo = -/*#__PURE__*/ -function (_Bar) { +var Foo = /*#__PURE__*/function (_Bar) { "use strict"; babelHelpers.inherits(Foo, _Bar); + var _super = babelHelpers.createSuper(Foo); + function Foo() { var _this; babelHelpers.classCallCheck(this, Foo); - var fn = () => _this = babelHelpers.possibleConstructorReturn(this, babelHelpers.getPrototypeOf(Foo).call(this)); + var fn = () => _this = _super.call(this); return babelHelpers.possibleConstructorReturn(_this); } diff --git a/packages/babel-plugin-transform-classes/test/fixtures/spec/derived-constructor-must-call-super/output.js b/packages/babel-plugin-transform-classes/test/fixtures/spec/derived-constructor-must-call-super/output.js index 1a1fed3e09e0..a157017211b6 100644 --- a/packages/babel-plugin-transform-classes/test/fixtures/spec/derived-constructor-must-call-super/output.js +++ b/packages/babel-plugin-transform-classes/test/fixtures/spec/derived-constructor-must-call-super/output.js @@ -1,10 +1,10 @@ -var Foo = -/*#__PURE__*/ -function (_Bar) { +var Foo = /*#__PURE__*/function (_Bar) { "use strict"; babelHelpers.inherits(Foo, _Bar); + var _super = babelHelpers.createSuper(Foo); + function Foo() { var _this; diff --git a/packages/babel-plugin-transform-classes/test/fixtures/spec/derived-constructor-no-super-return-falsey/output.js b/packages/babel-plugin-transform-classes/test/fixtures/spec/derived-constructor-no-super-return-falsey/output.js index 231c297d7d48..a7f2e0026fb3 100644 --- a/packages/babel-plugin-transform-classes/test/fixtures/spec/derived-constructor-no-super-return-falsey/output.js +++ b/packages/babel-plugin-transform-classes/test/fixtures/spec/derived-constructor-no-super-return-falsey/output.js @@ -1,10 +1,10 @@ -var Child = -/*#__PURE__*/ -function (_Base) { +var Child = /*#__PURE__*/function (_Base) { "use strict"; babelHelpers.inherits(Child, _Base); + var _super = babelHelpers.createSuper(Child); + function Child() { var _this; diff --git a/packages/babel-plugin-transform-classes/test/fixtures/spec/derived-constructor-no-super-return-object/output.js b/packages/babel-plugin-transform-classes/test/fixtures/spec/derived-constructor-no-super-return-object/output.js index f0f8887eda1e..7e0a9e8bbb1c 100644 --- a/packages/babel-plugin-transform-classes/test/fixtures/spec/derived-constructor-no-super-return-object/output.js +++ b/packages/babel-plugin-transform-classes/test/fixtures/spec/derived-constructor-no-super-return-object/output.js @@ -1,10 +1,10 @@ -var Child = -/*#__PURE__*/ -function (_Base) { +var Child = /*#__PURE__*/function (_Base) { "use strict"; babelHelpers.inherits(Child, _Base); + var _super = babelHelpers.createSuper(Child); + function Child() { var _this; diff --git a/packages/babel-plugin-transform-classes/test/fixtures/spec/export-super-class/output.mjs b/packages/babel-plugin-transform-classes/test/fixtures/spec/export-super-class/output.mjs index e37e167cda89..1a0e60f72428 100644 --- a/packages/babel-plugin-transform-classes/test/fixtures/spec/export-super-class/output.mjs +++ b/packages/babel-plugin-transform-classes/test/fixtures/spec/export-super-class/output.mjs @@ -1,11 +1,11 @@ -var _default = -/*#__PURE__*/ -function (_A) { +var _default = /*#__PURE__*/function (_A) { babelHelpers.inherits(_default, _A); + var _super = babelHelpers.createSuper(_default); + function _default() { babelHelpers.classCallCheck(this, _default); - return babelHelpers.possibleConstructorReturn(this, babelHelpers.getPrototypeOf(_default).apply(this, arguments)); + return _super.apply(this, arguments); } return _default; diff --git a/packages/babel-plugin-transform-classes/test/fixtures/spec/extend-untranspiled-class/exec.js b/packages/babel-plugin-transform-classes/test/fixtures/spec/extend-untranspiled-class/exec.js new file mode 100644 index 000000000000..a2b35ba4627d --- /dev/null +++ b/packages/babel-plugin-transform-classes/test/fixtures/spec/extend-untranspiled-class/exec.js @@ -0,0 +1,35 @@ +"use strict"; + +var log = []; +var SuperClass = require("module-which-exports-native-class"); + +class SubClass extends SuperClass { + constructor() { + log.push(4); + super(); + } + method() { + log.push(5); + super.method(); + } + static method() { + log.push(6); + super.method(); + } +} + +new SubClass().method(); +SubClass.method(); + +expect(log).toEqual([4, 1, 5, 2, 6, 3]); + +// Magic function to avoid transpiling class +function require() { + return eval(`( + class SuperClass { + constructor() { log.push(1); } + method() { log.push(2); } + static method() { log.push(3); } + } + )`); +} diff --git a/packages/babel-plugin-transform-classes/test/fixtures/spec/instance-getter-and-setter/output.js b/packages/babel-plugin-transform-classes/test/fixtures/spec/instance-getter-and-setter/output.js index fb7c1e0a4485..68605d444a06 100644 --- a/packages/babel-plugin-transform-classes/test/fixtures/spec/instance-getter-and-setter/output.js +++ b/packages/babel-plugin-transform-classes/test/fixtures/spec/instance-getter-and-setter/output.js @@ -1,6 +1,4 @@ -var Test = -/*#__PURE__*/ -function () { +var Test = /*#__PURE__*/function () { "use strict"; function Test() { diff --git a/packages/babel-plugin-transform-classes/test/fixtures/spec/instance-getter/output.js b/packages/babel-plugin-transform-classes/test/fixtures/spec/instance-getter/output.js index 788172802258..d05b79603150 100644 --- a/packages/babel-plugin-transform-classes/test/fixtures/spec/instance-getter/output.js +++ b/packages/babel-plugin-transform-classes/test/fixtures/spec/instance-getter/output.js @@ -1,6 +1,4 @@ -var Test = -/*#__PURE__*/ -function () { +var Test = /*#__PURE__*/function () { "use strict"; function Test() { diff --git a/packages/babel-plugin-transform-classes/test/fixtures/spec/instance-method/output.js b/packages/babel-plugin-transform-classes/test/fixtures/spec/instance-method/output.js index 88d63804cf28..69a706801567 100644 --- a/packages/babel-plugin-transform-classes/test/fixtures/spec/instance-method/output.js +++ b/packages/babel-plugin-transform-classes/test/fixtures/spec/instance-method/output.js @@ -1,6 +1,4 @@ -var Test = -/*#__PURE__*/ -function () { +var Test = /*#__PURE__*/function () { "use strict"; function Test() { diff --git a/packages/babel-plugin-transform-classes/test/fixtures/spec/instance-setter/output.js b/packages/babel-plugin-transform-classes/test/fixtures/spec/instance-setter/output.js index 86ccf7f55204..48c6820da7b0 100644 --- a/packages/babel-plugin-transform-classes/test/fixtures/spec/instance-setter/output.js +++ b/packages/babel-plugin-transform-classes/test/fixtures/spec/instance-setter/output.js @@ -1,6 +1,4 @@ -var Test = -/*#__PURE__*/ -function () { +var Test = /*#__PURE__*/function () { "use strict"; function Test() { diff --git a/packages/babel-plugin-transform-classes/test/fixtures/spec/method-return-type-annotation/output.js b/packages/babel-plugin-transform-classes/test/fixtures/spec/method-return-type-annotation/output.js index 3452df105440..5218e1bfd4dd 100644 --- a/packages/babel-plugin-transform-classes/test/fixtures/spec/method-return-type-annotation/output.js +++ b/packages/babel-plugin-transform-classes/test/fixtures/spec/method-return-type-annotation/output.js @@ -1,7 +1,5 @@ // @flow -var C = -/*#__PURE__*/ -function () { +var C = /*#__PURE__*/function () { "use strict"; function C() { diff --git a/packages/babel-plugin-transform-classes/test/fixtures/spec/name-method-collision/output.js b/packages/babel-plugin-transform-classes/test/fixtures/spec/name-method-collision/output.js index 9a71c2a3d368..cc8a5eef588a 100644 --- a/packages/babel-plugin-transform-classes/test/fixtures/spec/name-method-collision/output.js +++ b/packages/babel-plugin-transform-classes/test/fixtures/spec/name-method-collision/output.js @@ -2,9 +2,7 @@ var _a2 = require("./a"); -var Foo = -/*#__PURE__*/ -function () { +var Foo = /*#__PURE__*/function () { function Foo() { babelHelpers.classCallCheck(this, Foo); } diff --git a/packages/babel-plugin-transform-classes/test/fixtures/spec/nested-class-super-call-in-key/output.js b/packages/babel-plugin-transform-classes/test/fixtures/spec/nested-class-super-call-in-key/output.js index eb661ef2b3c3..fe4902958d94 100644 --- a/packages/babel-plugin-transform-classes/test/fixtures/spec/nested-class-super-call-in-key/output.js +++ b/packages/babel-plugin-transform-classes/test/fixtures/spec/nested-class-super-call-in-key/output.js @@ -10,11 +10,11 @@ var Hello = function Hello() { }; }; -var Outer = -/*#__PURE__*/ -function (_Hello) { +var Outer = /*#__PURE__*/function (_Hello) { babelHelpers.inherits(Outer, _Hello); + var _super = babelHelpers.createSuper(Outer); + function Outer() { var _this2 = this; @@ -22,15 +22,13 @@ function (_Hello) { babelHelpers.classCallCheck(this, Outer); - var Inner = - /*#__PURE__*/ - function () { + var Inner = /*#__PURE__*/function () { function Inner() { babelHelpers.classCallCheck(this, Inner); } babelHelpers.createClass(Inner, [{ - key: _this = babelHelpers.possibleConstructorReturn(_this2, babelHelpers.getPrototypeOf(Outer).call(_this2)), + key: _this = _super.call(_this2), value: function value() { return 'hello'; } diff --git a/packages/babel-plugin-transform-classes/test/fixtures/spec/nested-class-super-property-in-key/output.js b/packages/babel-plugin-transform-classes/test/fixtures/spec/nested-class-super-property-in-key/output.js index 86533f3dead0..9b3145d21416 100644 --- a/packages/babel-plugin-transform-classes/test/fixtures/spec/nested-class-super-property-in-key/output.js +++ b/packages/babel-plugin-transform-classes/test/fixtures/spec/nested-class-super-property-in-key/output.js @@ -1,8 +1,6 @@ "use strict"; -var Hello = -/*#__PURE__*/ -function () { +var Hello = /*#__PURE__*/function () { function Hello() { babelHelpers.classCallCheck(this, Hello); } @@ -16,26 +14,24 @@ function () { return Hello; }(); -var Outer = -/*#__PURE__*/ -function (_Hello) { +var Outer = /*#__PURE__*/function (_Hello) { babelHelpers.inherits(Outer, _Hello); + var _super = babelHelpers.createSuper(Outer); + function Outer() { - var _this; + var _thisSuper, _this; babelHelpers.classCallCheck(this, Outer); - _this = babelHelpers.possibleConstructorReturn(this, babelHelpers.getPrototypeOf(Outer).call(this)); + _this = _super.call(this); - var Inner = - /*#__PURE__*/ - function () { + var Inner = /*#__PURE__*/function () { function Inner() { babelHelpers.classCallCheck(this, Inner); } babelHelpers.createClass(Inner, [{ - key: babelHelpers.get(babelHelpers.getPrototypeOf(Outer.prototype), "toString", babelHelpers.assertThisInitialized(_this)).call(babelHelpers.assertThisInitialized(_this)), + key: babelHelpers.get((_thisSuper = babelHelpers.assertThisInitialized(_this), babelHelpers.getPrototypeOf(Outer.prototype)), "toString", _thisSuper).call(_thisSuper), value: function value() { return 'hello'; } diff --git a/packages/babel-plugin-transform-classes/test/fixtures/spec/nested-object-super-call-in-key/output.js b/packages/babel-plugin-transform-classes/test/fixtures/spec/nested-object-super-call-in-key/output.js index d540908b48df..ea22ce935a6a 100644 --- a/packages/babel-plugin-transform-classes/test/fixtures/spec/nested-object-super-call-in-key/output.js +++ b/packages/babel-plugin-transform-classes/test/fixtures/spec/nested-object-super-call-in-key/output.js @@ -10,17 +10,17 @@ var Hello = function Hello() { }; }; -var Outer = -/*#__PURE__*/ -function (_Hello) { +var Outer = /*#__PURE__*/function (_Hello) { babelHelpers.inherits(Outer, _Hello); + var _super = babelHelpers.createSuper(Outer); + function Outer() { var _this; babelHelpers.classCallCheck(this, Outer); var Inner = { - [_this = babelHelpers.possibleConstructorReturn(this, babelHelpers.getPrototypeOf(Outer).call(this))]() { + [_this = _super.call(this)]() { return 'hello'; } diff --git a/packages/babel-plugin-transform-classes/test/fixtures/spec/nested-object-super-property-in-key/output.js b/packages/babel-plugin-transform-classes/test/fixtures/spec/nested-object-super-property-in-key/output.js index 45f4172368cb..388fce9a4341 100644 --- a/packages/babel-plugin-transform-classes/test/fixtures/spec/nested-object-super-property-in-key/output.js +++ b/packages/babel-plugin-transform-classes/test/fixtures/spec/nested-object-super-property-in-key/output.js @@ -1,8 +1,6 @@ "use strict"; -var Hello = -/*#__PURE__*/ -function () { +var Hello = /*#__PURE__*/function () { function Hello() { babelHelpers.classCallCheck(this, Hello); } @@ -16,18 +14,18 @@ function () { return Hello; }(); -var Outer = -/*#__PURE__*/ -function (_Hello) { +var Outer = /*#__PURE__*/function (_Hello) { babelHelpers.inherits(Outer, _Hello); + var _super = babelHelpers.createSuper(Outer); + function Outer() { - var _this; + var _thisSuper, _this; babelHelpers.classCallCheck(this, Outer); - _this = babelHelpers.possibleConstructorReturn(this, babelHelpers.getPrototypeOf(Outer).call(this)); + _this = _super.call(this); var Inner = { - [babelHelpers.get(babelHelpers.getPrototypeOf(Outer.prototype), "toString", babelHelpers.assertThisInitialized(_this)).call(babelHelpers.assertThisInitialized(_this))]() { + [babelHelpers.get((_thisSuper = babelHelpers.assertThisInitialized(_this), babelHelpers.getPrototypeOf(Outer.prototype)), "toString", _thisSuper).call(_thisSuper)]() { return 'hello'; } diff --git a/packages/babel-plugin-transform-classes/test/fixtures/spec/options.json b/packages/babel-plugin-transform-classes/test/fixtures/spec/options.json index 8d402a794c7e..cac9bea7af04 100644 --- a/packages/babel-plugin-transform-classes/test/fixtures/spec/options.json +++ b/packages/babel-plugin-transform-classes/test/fixtures/spec/options.json @@ -1,6 +1,6 @@ { "plugins": [ - "external-helpers", + ["external-helpers", { "helperVersion": "7.100.0" }], "transform-function-name", "transform-classes", "transform-spread", diff --git a/packages/babel-plugin-transform-classes/test/fixtures/spec/relaxed-method-coercion/output.js b/packages/babel-plugin-transform-classes/test/fixtures/spec/relaxed-method-coercion/output.js index c233a15a0e99..5d9a2b9a2e46 100644 --- a/packages/babel-plugin-transform-classes/test/fixtures/spec/relaxed-method-coercion/output.js +++ b/packages/babel-plugin-transform-classes/test/fixtures/spec/relaxed-method-coercion/output.js @@ -1,7 +1,5 @@ // #1649 -var Foo = -/*#__PURE__*/ -function () { +var Foo = /*#__PURE__*/function () { "use strict"; function Foo() { diff --git a/packages/babel-plugin-transform-classes/test/fixtures/spec/statement/output.js b/packages/babel-plugin-transform-classes/test/fixtures/spec/statement/output.js index 29c3bfc821a5..d9c3eba07384 100644 --- a/packages/babel-plugin-transform-classes/test/fixtures/spec/statement/output.js +++ b/packages/babel-plugin-transform-classes/test/fixtures/spec/statement/output.js @@ -12,9 +12,7 @@ var BaseView = function BaseView() { this.autoRender = true; }; -var BaseView = -/*#__PURE__*/ -function () { +var BaseView = /*#__PURE__*/function () { "use strict"; function BaseView() { diff --git a/packages/babel-plugin-transform-classes/test/fixtures/spec/static/output.js b/packages/babel-plugin-transform-classes/test/fixtures/spec/static/output.js index 9b1a8ffa5cf0..046f38dacf75 100644 --- a/packages/babel-plugin-transform-classes/test/fixtures/spec/static/output.js +++ b/packages/babel-plugin-transform-classes/test/fixtures/spec/static/output.js @@ -1,6 +1,4 @@ -var A = -/*#__PURE__*/ -function () { +var A = /*#__PURE__*/function () { "use strict"; function A() { diff --git a/packages/babel-plugin-transform-classes/test/fixtures/spec/super-class-anonymous/output.js b/packages/babel-plugin-transform-classes/test/fixtures/spec/super-class-anonymous/output.js index 614dc6c2d9ea..6e3ff68be6e4 100644 --- a/packages/babel-plugin-transform-classes/test/fixtures/spec/super-class-anonymous/output.js +++ b/packages/babel-plugin-transform-classes/test/fixtures/spec/super-class-anonymous/output.js @@ -1,19 +1,17 @@ -var TestEmpty = -/*#__PURE__*/ -function (_ref) { +var TestEmpty = /*#__PURE__*/function (_ref) { "use strict"; babelHelpers.inherits(TestEmpty, _ref); + var _super = babelHelpers.createSuper(TestEmpty); + function TestEmpty() { babelHelpers.classCallCheck(this, TestEmpty); - return babelHelpers.possibleConstructorReturn(this, babelHelpers.getPrototypeOf(TestEmpty).apply(this, arguments)); + return _super.apply(this, arguments); } return TestEmpty; -}( -/*#__PURE__*/ -function () { +}( /*#__PURE__*/function () { "use strict"; function _class() { @@ -23,22 +21,20 @@ function () { return _class; }()); -var TestConstructorOnly = -/*#__PURE__*/ -function (_ref2) { +var TestConstructorOnly = /*#__PURE__*/function (_ref2) { "use strict"; babelHelpers.inherits(TestConstructorOnly, _ref2); + var _super2 = babelHelpers.createSuper(TestConstructorOnly); + function TestConstructorOnly() { babelHelpers.classCallCheck(this, TestConstructorOnly); - return babelHelpers.possibleConstructorReturn(this, babelHelpers.getPrototypeOf(TestConstructorOnly).apply(this, arguments)); + return _super2.apply(this, arguments); } return TestConstructorOnly; -}( -/*#__PURE__*/ -function () { +}( /*#__PURE__*/function () { "use strict"; function _class2() { @@ -48,22 +44,20 @@ function () { return _class2; }()); -var TestMethodOnly = -/*#__PURE__*/ -function (_ref3) { +var TestMethodOnly = /*#__PURE__*/function (_ref3) { "use strict"; babelHelpers.inherits(TestMethodOnly, _ref3); + var _super3 = babelHelpers.createSuper(TestMethodOnly); + function TestMethodOnly() { babelHelpers.classCallCheck(this, TestMethodOnly); - return babelHelpers.possibleConstructorReturn(this, babelHelpers.getPrototypeOf(TestMethodOnly).apply(this, arguments)); + return _super3.apply(this, arguments); } return TestMethodOnly; -}( -/*#__PURE__*/ -function () { +}( /*#__PURE__*/function () { "use strict"; function _class3() { @@ -77,22 +71,20 @@ function () { return _class3; }()); -var TestConstructorAndMethod = -/*#__PURE__*/ -function (_ref4) { +var TestConstructorAndMethod = /*#__PURE__*/function (_ref4) { "use strict"; babelHelpers.inherits(TestConstructorAndMethod, _ref4); + var _super4 = babelHelpers.createSuper(TestConstructorAndMethod); + function TestConstructorAndMethod() { babelHelpers.classCallCheck(this, TestConstructorAndMethod); - return babelHelpers.possibleConstructorReturn(this, babelHelpers.getPrototypeOf(TestConstructorAndMethod).apply(this, arguments)); + return _super4.apply(this, arguments); } return TestConstructorAndMethod; -}( -/*#__PURE__*/ -function () { +}( /*#__PURE__*/function () { "use strict"; function _class4() { @@ -106,22 +98,20 @@ function () { return _class4; }()); -var TestMultipleMethods = -/*#__PURE__*/ -function (_ref5) { +var TestMultipleMethods = /*#__PURE__*/function (_ref5) { "use strict"; babelHelpers.inherits(TestMultipleMethods, _ref5); + var _super5 = babelHelpers.createSuper(TestMultipleMethods); + function TestMultipleMethods() { babelHelpers.classCallCheck(this, TestMultipleMethods); - return babelHelpers.possibleConstructorReturn(this, babelHelpers.getPrototypeOf(TestMultipleMethods).apply(this, arguments)); + return _super5.apply(this, arguments); } return TestMultipleMethods; -}( -/*#__PURE__*/ -function () { +}( /*#__PURE__*/function () { "use strict"; function _class5() { diff --git a/packages/babel-plugin-transform-classes/test/fixtures/spec/super-class-id-member-expression/output.js b/packages/babel-plugin-transform-classes/test/fixtures/spec/super-class-id-member-expression/output.js index d656ac9528ab..b78e78a090e7 100644 --- a/packages/babel-plugin-transform-classes/test/fixtures/spec/super-class-id-member-expression/output.js +++ b/packages/babel-plugin-transform-classes/test/fixtures/spec/super-class-id-member-expression/output.js @@ -1,28 +1,28 @@ -var BaseController = -/*#__PURE__*/ -function (_Chaplin$Controller) { +var BaseController = /*#__PURE__*/function (_Chaplin$Controller) { "use strict"; babelHelpers.inherits(BaseController, _Chaplin$Controller); + var _super = babelHelpers.createSuper(BaseController); + function BaseController() { babelHelpers.classCallCheck(this, BaseController); - return babelHelpers.possibleConstructorReturn(this, babelHelpers.getPrototypeOf(BaseController).apply(this, arguments)); + return _super.apply(this, arguments); } return BaseController; }(Chaplin.Controller); -var BaseController2 = -/*#__PURE__*/ -function (_Chaplin$Controller$A) { +var BaseController2 = /*#__PURE__*/function (_Chaplin$Controller$A) { "use strict"; babelHelpers.inherits(BaseController2, _Chaplin$Controller$A); + var _super2 = babelHelpers.createSuper(BaseController2); + function BaseController2() { babelHelpers.classCallCheck(this, BaseController2); - return babelHelpers.possibleConstructorReturn(this, babelHelpers.getPrototypeOf(BaseController2).apply(this, arguments)); + return _super2.apply(this, arguments); } return BaseController2; diff --git a/packages/babel-plugin-transform-classes/test/fixtures/spec/super-class/output.js b/packages/babel-plugin-transform-classes/test/fixtures/spec/super-class/output.js index 8a994335e8d7..be0405d4817c 100644 --- a/packages/babel-plugin-transform-classes/test/fixtures/spec/super-class/output.js +++ b/packages/babel-plugin-transform-classes/test/fixtures/spec/super-class/output.js @@ -1,13 +1,13 @@ -var Test = -/*#__PURE__*/ -function (_Foo) { +var Test = /*#__PURE__*/function (_Foo) { "use strict"; babelHelpers.inherits(Test, _Foo); + var _super = babelHelpers.createSuper(Test); + function Test() { babelHelpers.classCallCheck(this, Test); - return babelHelpers.possibleConstructorReturn(this, babelHelpers.getPrototypeOf(Test).apply(this, arguments)); + return _super.apply(this, arguments); } return Test; diff --git a/packages/babel-plugin-transform-classes/test/fixtures/spec/super-correct-new-target/exec.js b/packages/babel-plugin-transform-classes/test/fixtures/spec/super-correct-new-target/exec.js new file mode 100644 index 000000000000..c99db1bcaea6 --- /dev/null +++ b/packages/babel-plugin-transform-classes/test/fixtures/spec/super-correct-new-target/exec.js @@ -0,0 +1,14 @@ +"use strict"; + +let NewTarget; + +class A { + constructor() { NewTarget = new.target; } +} +class B extends A {} + +new A(); +expect(NewTarget).toBe(A); + +new B(); +expect(NewTarget).toBe(B); diff --git a/packages/babel-plugin-transform-classes/test/fixtures/spec/super-proto-modifications/exec.js b/packages/babel-plugin-transform-classes/test/fixtures/spec/super-proto-modifications/exec.js new file mode 100644 index 000000000000..a2fbf656ed3c --- /dev/null +++ b/packages/babel-plugin-transform-classes/test/fixtures/spec/super-proto-modifications/exec.js @@ -0,0 +1,15 @@ +var A_called = false; +var X_called = false; + +class A { constructor() { A_called = true } } +class X { constructor() { X_called = true } } +class B extends A {} + +B.prototype.__proto__ = X.prototype; +B.__proto__ = X; + +expect(new B() instanceof B).toBe(true); +expect(new B() instanceof A).toBe(false); +expect(new B() instanceof X).toBe(true); +expect(A_called).toBe(false); +expect(X_called).toBe(true); diff --git a/packages/babel-plugin-transform-classes/test/fixtures/spec/super-reference-before-bare-super-inline/output.js b/packages/babel-plugin-transform-classes/test/fixtures/spec/super-reference-before-bare-super-inline/output.js index 5c63d332cc3e..6e5459eaf60d 100644 --- a/packages/babel-plugin-transform-classes/test/fixtures/spec/super-reference-before-bare-super-inline/output.js +++ b/packages/babel-plugin-transform-classes/test/fixtures/spec/super-reference-before-bare-super-inline/output.js @@ -1,12 +1,16 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } + +function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } + +function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function () { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } + function _possibleConstructorReturn(self, call) { if (call && (typeof call === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } - -function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } +function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } function _get(target, property, receiver) { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get; } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(receiver); } return desc.value; }; } return _get(target, property, receiver || target); } @@ -14,19 +18,19 @@ function _superPropBase(object, property) { while (!Object.prototype.hasOwnPrope function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } -var Foo = -/*#__PURE__*/ -function (_Bar) { +var Foo = /*#__PURE__*/function (_Bar) { "use strict"; _inherits(Foo, _Bar); + var _super = _createSuper(Foo); + function Foo() { - var _this; + var _thisSuper, _this; _classCallCheck(this, Foo); - _get(_getPrototypeOf(Foo.prototype), "foo", _assertThisInitialized(_this)).call(_assertThisInitialized(_this), _this = _possibleConstructorReturn(this, _getPrototypeOf(Foo).call(this))); + _get((_thisSuper = _assertThisInitialized(_this), _getPrototypeOf(Foo.prototype)), "foo", _thisSuper).call(_thisSuper, _this = _super.call(this)); return _this; } diff --git a/packages/babel-plugin-transform-classes/test/fixtures/spec/super-reference-before-bare-super/output.js b/packages/babel-plugin-transform-classes/test/fixtures/spec/super-reference-before-bare-super/output.js index 9ad7dc9e277c..accaa6d28ae2 100644 --- a/packages/babel-plugin-transform-classes/test/fixtures/spec/super-reference-before-bare-super/output.js +++ b/packages/babel-plugin-transform-classes/test/fixtures/spec/super-reference-before-bare-super/output.js @@ -1,12 +1,16 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } + +function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } + +function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function () { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } + function _possibleConstructorReturn(self, call) { if (call && (typeof call === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } - -function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } +function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } function _get(target, property, receiver) { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get; } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(receiver); } return desc.value; }; } return _get(target, property, receiver || target); } @@ -14,21 +18,21 @@ function _superPropBase(object, property) { while (!Object.prototype.hasOwnPrope function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } -var Foo = -/*#__PURE__*/ -function (_Bar) { +var Foo = /*#__PURE__*/function (_Bar) { "use strict"; _inherits(Foo, _Bar); + var _super = _createSuper(Foo); + function Foo() { - var _this; + var _thisSuper, _this; _classCallCheck(this, Foo); - _get(_getPrototypeOf(Foo.prototype), "foo", _assertThisInitialized(_this)).call(_assertThisInitialized(_this)); + _get((_thisSuper = _assertThisInitialized(_this), _getPrototypeOf(Foo.prototype)), "foo", _thisSuper).call(_thisSuper); - return _this = _possibleConstructorReturn(this, _getPrototypeOf(Foo).call(this)); + return _this = _super.call(this); } return Foo; diff --git a/packages/babel-plugin-transform-classes/test/fixtures/spec/super-reference-before-in-lambda-2/options.json b/packages/babel-plugin-transform-classes/test/fixtures/spec/super-reference-before-in-lambda-2/options.json index 93725c3c0e72..4b2ee4905cff 100644 --- a/packages/babel-plugin-transform-classes/test/fixtures/spec/super-reference-before-in-lambda-2/options.json +++ b/packages/babel-plugin-transform-classes/test/fixtures/spec/super-reference-before-in-lambda-2/options.json @@ -1,6 +1,6 @@ { "plugins": [ - "external-helpers", + ["external-helpers", { "helperVersion": "7.100.0" }], "transform-classes", "transform-block-scoping" ] diff --git a/packages/babel-plugin-transform-classes/test/fixtures/spec/super-reference-before-in-lambda-2/output.js b/packages/babel-plugin-transform-classes/test/fixtures/spec/super-reference-before-in-lambda-2/output.js index a9d35599dfac..aa06de3e6d38 100644 --- a/packages/babel-plugin-transform-classes/test/fixtures/spec/super-reference-before-in-lambda-2/output.js +++ b/packages/babel-plugin-transform-classes/test/fixtures/spec/super-reference-before-in-lambda-2/output.js @@ -1,19 +1,19 @@ -var Foo = -/*#__PURE__*/ -function (_Bar) { +var Foo = /*#__PURE__*/function (_Bar) { "use strict"; babelHelpers.inherits(Foo, _Bar); + var _super = babelHelpers.createSuper(Foo); + function Foo() { - var _this; + var _thisSuper, _thisSuper2, _this; babelHelpers.classCallCheck(this, Foo); - var t = () => babelHelpers.get(babelHelpers.getPrototypeOf(Foo.prototype), "test", babelHelpers.assertThisInitialized(_this)).call(babelHelpers.assertThisInitialized(_this)); + var t = () => babelHelpers.get((_thisSuper = babelHelpers.assertThisInitialized(_this), babelHelpers.getPrototypeOf(Foo.prototype)), "test", _thisSuper).call(_thisSuper); - babelHelpers.get(babelHelpers.getPrototypeOf(Foo.prototype), "foo", babelHelpers.assertThisInitialized(_this)).call(babelHelpers.assertThisInitialized(_this)); - return _this = babelHelpers.possibleConstructorReturn(this, babelHelpers.getPrototypeOf(Foo).call(this)); + babelHelpers.get((_thisSuper2 = babelHelpers.assertThisInitialized(_this), babelHelpers.getPrototypeOf(Foo.prototype)), "foo", _thisSuper2).call(_thisSuper2); + return _this = _super.call(this); } return Foo; diff --git a/packages/babel-plugin-transform-classes/test/fixtures/spec/super-reference-before-in-lambda-3/options.json b/packages/babel-plugin-transform-classes/test/fixtures/spec/super-reference-before-in-lambda-3/options.json index 93725c3c0e72..4b2ee4905cff 100644 --- a/packages/babel-plugin-transform-classes/test/fixtures/spec/super-reference-before-in-lambda-3/options.json +++ b/packages/babel-plugin-transform-classes/test/fixtures/spec/super-reference-before-in-lambda-3/options.json @@ -1,6 +1,6 @@ { "plugins": [ - "external-helpers", + ["external-helpers", { "helperVersion": "7.100.0" }], "transform-classes", "transform-block-scoping" ] diff --git a/packages/babel-plugin-transform-classes/test/fixtures/spec/super-reference-before-in-lambda-3/output.js b/packages/babel-plugin-transform-classes/test/fixtures/spec/super-reference-before-in-lambda-3/output.js index 1058746336b6..1180a97186d0 100644 --- a/packages/babel-plugin-transform-classes/test/fixtures/spec/super-reference-before-in-lambda-3/output.js +++ b/packages/babel-plugin-transform-classes/test/fixtures/spec/super-reference-before-in-lambda-3/output.js @@ -1,18 +1,18 @@ -var Foo = -/*#__PURE__*/ -function (_Bar) { +var Foo = /*#__PURE__*/function (_Bar) { "use strict"; babelHelpers.inherits(Foo, _Bar); + var _super = babelHelpers.createSuper(Foo); + function Foo() { - var _this; + var _thisSuper, _this; babelHelpers.classCallCheck(this, Foo); - var t = () => babelHelpers.get(babelHelpers.getPrototypeOf(Foo.prototype), "test", babelHelpers.assertThisInitialized(_this)).call(babelHelpers.assertThisInitialized(_this)); + var t = () => babelHelpers.get((_thisSuper = babelHelpers.assertThisInitialized(_this), babelHelpers.getPrototypeOf(Foo.prototype)), "test", _thisSuper).call(_thisSuper); - _this = babelHelpers.possibleConstructorReturn(this, babelHelpers.getPrototypeOf(Foo).call(this)); + _this = _super.call(this); t(); return _this; } diff --git a/packages/babel-plugin-transform-classes/test/fixtures/spec/super-reference-before-in-lambda/options.json b/packages/babel-plugin-transform-classes/test/fixtures/spec/super-reference-before-in-lambda/options.json index 93725c3c0e72..4b2ee4905cff 100644 --- a/packages/babel-plugin-transform-classes/test/fixtures/spec/super-reference-before-in-lambda/options.json +++ b/packages/babel-plugin-transform-classes/test/fixtures/spec/super-reference-before-in-lambda/options.json @@ -1,6 +1,6 @@ { "plugins": [ - "external-helpers", + ["external-helpers", { "helperVersion": "7.100.0" }], "transform-classes", "transform-block-scoping" ] diff --git a/packages/babel-plugin-transform-classes/test/fixtures/spec/super-reference-before-in-lambda/output.js b/packages/babel-plugin-transform-classes/test/fixtures/spec/super-reference-before-in-lambda/output.js index 6836413a2149..08dd8278d837 100644 --- a/packages/babel-plugin-transform-classes/test/fixtures/spec/super-reference-before-in-lambda/output.js +++ b/packages/babel-plugin-transform-classes/test/fixtures/spec/super-reference-before-in-lambda/output.js @@ -1,18 +1,18 @@ -var Foo = -/*#__PURE__*/ -function (_Bar) { +var Foo = /*#__PURE__*/function (_Bar) { "use strict"; babelHelpers.inherits(Foo, _Bar); + var _super = babelHelpers.createSuper(Foo); + function Foo() { - var _this; + var _thisSuper, _this; babelHelpers.classCallCheck(this, Foo); - var t = () => babelHelpers.get(babelHelpers.getPrototypeOf(Foo.prototype), "test", babelHelpers.assertThisInitialized(_this)).call(babelHelpers.assertThisInitialized(_this)); + var t = () => babelHelpers.get((_thisSuper = babelHelpers.assertThisInitialized(_this), babelHelpers.getPrototypeOf(Foo.prototype)), "test", _thisSuper).call(_thisSuper); - return _this = babelHelpers.possibleConstructorReturn(this, babelHelpers.getPrototypeOf(Foo).call(this)); + return _this = _super.call(this); } return Foo; diff --git a/packages/babel-plugin-transform-classes/test/fixtures/spec/super-reference-in-prop-exression/exec.js b/packages/babel-plugin-transform-classes/test/fixtures/spec/super-reference-in-prop-exression/exec.js index 294b5ecc0980..da7312b7d725 100644 --- a/packages/babel-plugin-transform-classes/test/fixtures/spec/super-reference-in-prop-exression/exec.js +++ b/packages/babel-plugin-transform-classes/test/fixtures/spec/super-reference-in-prop-exression/exec.js @@ -1,20 +1,18 @@ let called = false; class A { - method() { + get prop() { called = true; } - - get methodName() { - return "method"; - } } class B extends A { constructor() { - super[super().methodName]() + super[super().prop] } } -new B(); -expect(called).toBe(true); +expect(() => { + new B(); +}).toThrow(); +expect(called).toBe(false); diff --git a/packages/babel-plugin-transform-classes/test/fixtures/spec/super-reference-in-prop-exression/output.js b/packages/babel-plugin-transform-classes/test/fixtures/spec/super-reference-in-prop-exression/output.js index c501dacfaf95..1148ad06b51a 100644 --- a/packages/babel-plugin-transform-classes/test/fixtures/spec/super-reference-in-prop-exression/output.js +++ b/packages/babel-plugin-transform-classes/test/fixtures/spec/super-reference-in-prop-exression/output.js @@ -1,15 +1,15 @@ -var Foo = -/*#__PURE__*/ -function (_Bar) { +var Foo = /*#__PURE__*/function (_Bar) { "use strict"; babelHelpers.inherits(Foo, _Bar); + var _super = babelHelpers.createSuper(Foo); + function Foo() { - var _this; + var _thisSuper, _this; babelHelpers.classCallCheck(this, Foo); - babelHelpers.get(babelHelpers.getPrototypeOf(Foo.prototype), (_this = babelHelpers.possibleConstructorReturn(this, babelHelpers.getPrototypeOf(Foo).call(this))).method, babelHelpers.assertThisInitialized(_this)).call(babelHelpers.assertThisInitialized(_this)); + babelHelpers.get((_thisSuper = babelHelpers.assertThisInitialized(_this), babelHelpers.getPrototypeOf(Foo.prototype)), (_this = _super.call(this)).method, _thisSuper).call(_thisSuper); return _this; } diff --git a/packages/babel-plugin-transform-classes/test/fixtures/spec/this-not-allowed-before-super-in-derived-classes-2/output.js b/packages/babel-plugin-transform-classes/test/fixtures/spec/this-not-allowed-before-super-in-derived-classes-2/output.js index ec1d652c8dad..1e69b5b44494 100644 --- a/packages/babel-plugin-transform-classes/test/fixtures/spec/this-not-allowed-before-super-in-derived-classes-2/output.js +++ b/packages/babel-plugin-transform-classes/test/fixtures/spec/this-not-allowed-before-super-in-derived-classes-2/output.js @@ -1,15 +1,15 @@ -var Foo = -/*#__PURE__*/ -function (_Bar) { +var Foo = /*#__PURE__*/function (_Bar) { "use strict"; babelHelpers.inherits(Foo, _Bar); + var _super = babelHelpers.createSuper(Foo); + function Foo() { var _this; babelHelpers.classCallCheck(this, Foo); - return _this = babelHelpers.possibleConstructorReturn(this, babelHelpers.getPrototypeOf(Foo).call(this, babelHelpers.assertThisInitialized(_this))); + return _this = _super.call(this, babelHelpers.assertThisInitialized(_this)); } return Foo; diff --git a/packages/babel-plugin-transform-classes/test/fixtures/spec/this-not-allowed-before-super-in-derived-classes-3/output.js b/packages/babel-plugin-transform-classes/test/fixtures/spec/this-not-allowed-before-super-in-derived-classes-3/output.js index 06e41b47d3a1..04debc242ceb 100644 --- a/packages/babel-plugin-transform-classes/test/fixtures/spec/this-not-allowed-before-super-in-derived-classes-3/output.js +++ b/packages/babel-plugin-transform-classes/test/fixtures/spec/this-not-allowed-before-super-in-derived-classes-3/output.js @@ -1,10 +1,10 @@ -var Foo = -/*#__PURE__*/ -function (_Bar) { +var Foo = /*#__PURE__*/function (_Bar) { "use strict"; babelHelpers.inherits(Foo, _Bar); + var _super = babelHelpers.createSuper(Foo); + function Foo() { var _this; @@ -13,7 +13,7 @@ function (_Bar) { var fn = () => babelHelpers.assertThisInitialized(_this); fn(); - return _this = babelHelpers.possibleConstructorReturn(this, babelHelpers.getPrototypeOf(Foo).call(this)); + return _this = _super.call(this); } return Foo; diff --git a/packages/babel-plugin-transform-classes/test/fixtures/spec/this-not-allowed-before-super-in-derived-classes-4/output.js b/packages/babel-plugin-transform-classes/test/fixtures/spec/this-not-allowed-before-super-in-derived-classes-4/output.js index 2bce474839d1..78625ee2d406 100644 --- a/packages/babel-plugin-transform-classes/test/fixtures/spec/this-not-allowed-before-super-in-derived-classes-4/output.js +++ b/packages/babel-plugin-transform-classes/test/fixtures/spec/this-not-allowed-before-super-in-derived-classes-4/output.js @@ -1,10 +1,10 @@ -var Foo = -/*#__PURE__*/ -function (_Bar) { +var Foo = /*#__PURE__*/function (_Bar) { "use strict"; babelHelpers.inherits(Foo, _Bar); + var _super = babelHelpers.createSuper(Foo); + function Foo() { var _this; @@ -12,7 +12,7 @@ function (_Bar) { var fn = () => babelHelpers.assertThisInitialized(_this); - _this = babelHelpers.possibleConstructorReturn(this, babelHelpers.getPrototypeOf(Foo).call(this)); + _this = _super.call(this); fn(); return _this; } diff --git a/packages/babel-plugin-transform-classes/test/fixtures/spec/this-not-allowed-before-super-in-derived-classes-5/output.js b/packages/babel-plugin-transform-classes/test/fixtures/spec/this-not-allowed-before-super-in-derived-classes-5/output.js index a49d2be8091e..02d2986d7f81 100644 --- a/packages/babel-plugin-transform-classes/test/fixtures/spec/this-not-allowed-before-super-in-derived-classes-5/output.js +++ b/packages/babel-plugin-transform-classes/test/fixtures/spec/this-not-allowed-before-super-in-derived-classes-5/output.js @@ -1,10 +1,10 @@ -var Foo = -/*#__PURE__*/ -function (_Bar) { +var Foo = /*#__PURE__*/function (_Bar) { "use strict"; babelHelpers.inherits(Foo, _Bar); + var _super = babelHelpers.createSuper(Foo); + function Foo() { var _this; diff --git a/packages/babel-plugin-transform-classes/test/fixtures/spec/this-not-allowed-before-super-in-derived-classes/output.js b/packages/babel-plugin-transform-classes/test/fixtures/spec/this-not-allowed-before-super-in-derived-classes/output.js index cab6da87e8a7..ddac8f31f485 100644 --- a/packages/babel-plugin-transform-classes/test/fixtures/spec/this-not-allowed-before-super-in-derived-classes/output.js +++ b/packages/babel-plugin-transform-classes/test/fixtures/spec/this-not-allowed-before-super-in-derived-classes/output.js @@ -1,16 +1,16 @@ -var Foo = -/*#__PURE__*/ -function (_Bar) { +var Foo = /*#__PURE__*/function (_Bar) { "use strict"; babelHelpers.inherits(Foo, _Bar); + var _super = babelHelpers.createSuper(Foo); + function Foo() { var _this; babelHelpers.classCallCheck(this, Foo); _this.foo = "bar"; - return _this = babelHelpers.possibleConstructorReturn(this, babelHelpers.getPrototypeOf(Foo).call(this)); + return _this = _super.call(this); } return Foo; diff --git a/packages/babel-plugin-transform-computed-properties/package.json b/packages/babel-plugin-transform-computed-properties/package.json index c749cfab88d6..43b9f70e6fb1 100644 --- a/packages/babel-plugin-transform-computed-properties/package.json +++ b/packages/babel-plugin-transform-computed-properties/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-transform-computed-properties", - "version": "7.2.0", + "version": "7.8.3", "description": "Compile ES2015 computed properties to ES5", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-computed-properties", "license": "MIT", @@ -12,13 +12,13 @@ "babel-plugin" ], "dependencies": { - "@babel/helper-plugin-utils": "^7.0.0" + "@babel/helper-plugin-utils": "^7.8.3" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.2.0", - "@babel/helper-plugin-test-runner": "^7.0.0" + "@babel/core": "^7.8.3", + "@babel/helper-plugin-test-runner": "^7.8.3" } } diff --git a/packages/babel-plugin-transform-destructuring/package.json b/packages/babel-plugin-transform-destructuring/package.json index fde64105a8bc..925dac6fb53e 100644 --- a/packages/babel-plugin-transform-destructuring/package.json +++ b/packages/babel-plugin-transform-destructuring/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-transform-destructuring", - "version": "7.5.0", + "version": "7.9.5", "description": "Compile ES2015 destructuring to ES5", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-destructuring", "license": "MIT", @@ -12,13 +12,13 @@ "babel-plugin" ], "dependencies": { - "@babel/helper-plugin-utils": "^7.0.0" + "@babel/helper-plugin-utils": "^7.8.3" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.4.4", - "@babel/helper-plugin-test-runner": "^7.0.0" + "@babel/core": "^7.8.3", + "@babel/helper-plugin-test-runner": "^7.8.3" } } diff --git a/packages/babel-plugin-transform-destructuring/src/index.js b/packages/babel-plugin-transform-destructuring/src/index.js index 04cb37b4afa9..cc60ebd458b0 100644 --- a/packages/babel-plugin-transform-destructuring/src/index.js +++ b/packages/babel-plugin-transform-destructuring/src/index.js @@ -166,7 +166,7 @@ export default declare((api, options) => { let patternId; let node; - if (this.kind === "const") { + if (this.kind === "const" || this.kind === "let") { patternId = this.scope.generateUidIdentifier(tempId.name); node = this.buildVariableDeclaration(patternId, tempConditional); } else { @@ -599,6 +599,7 @@ export default declare((api, options) => { } path.replaceWithMultiple(nodes); + path.scope.crawl(); }, VariableDeclaration(path) { diff --git a/packages/babel-plugin-transform-destructuring/test/fixtures/destructuring/array-symbol-unsupported/exec.js b/packages/babel-plugin-transform-destructuring/test/fixtures/destructuring/array-symbol-unsupported/exec.js new file mode 100644 index 000000000000..ea73919662e2 --- /dev/null +++ b/packages/babel-plugin-transform-destructuring/test/fixtures/destructuring/array-symbol-unsupported/exec.js @@ -0,0 +1,13 @@ +var a = (() => [1, 2, 3])(); + +// Simulate old environment +let _Symbol = Symbol; +Symbol = void 0; +try { + var [first, ...rest] = a; + + expect(first).toBe(1); + expect(rest).toEqual([2, 3]); +} finally { + Symbol = _Symbol; +} diff --git a/packages/babel-plugin-transform-destructuring/test/fixtures/destructuring/array-symbol-unsupported/input.js b/packages/babel-plugin-transform-destructuring/test/fixtures/destructuring/array-symbol-unsupported/input.js new file mode 100644 index 000000000000..ea501d37a051 --- /dev/null +++ b/packages/babel-plugin-transform-destructuring/test/fixtures/destructuring/array-symbol-unsupported/input.js @@ -0,0 +1,6 @@ +var a = (() => [1, 2, 3])(); + +// !!! In order to run this test, this shouldn't be optimized using type inference +// If it's optimized and doesn't call toArray, please modify this test +// and exec.js +var [first, ...rest] = a; diff --git a/packages/babel-plugin-transform-destructuring/test/fixtures/destructuring/array-symbol-unsupported/output.js b/packages/babel-plugin-transform-destructuring/test/fixtures/destructuring/array-symbol-unsupported/output.js new file mode 100644 index 000000000000..f9d095f2d823 --- /dev/null +++ b/packages/babel-plugin-transform-destructuring/test/fixtures/destructuring/array-symbol-unsupported/output.js @@ -0,0 +1,8 @@ +var a = (() => [1, 2, 3])(); // !!! In order to run this test, this shouldn't be optimized using type inference +// If it's optimized and doesn't call toArray, please modify this test +// and exec.js + + +var _a = babelHelpers.toArray(a), + first = _a[0], + rest = _a.slice(1); diff --git a/packages/babel-plugin-transform-destructuring/test/fixtures/destructuring/for-let-nest/input.js b/packages/babel-plugin-transform-destructuring/test/fixtures/destructuring/for-let-nest/input.js new file mode 100644 index 000000000000..4c54b1e75dfc --- /dev/null +++ b/packages/babel-plugin-transform-destructuring/test/fixtures/destructuring/for-let-nest/input.js @@ -0,0 +1,2 @@ +for (let [[x] = [1]] = []; ; ) { +} \ No newline at end of file diff --git a/packages/babel-plugin-transform-destructuring/test/fixtures/destructuring/for-let-nest/output.js b/packages/babel-plugin-transform-destructuring/test/fixtures/destructuring/for-let-nest/output.js new file mode 100644 index 000000000000..9c0f8685efb4 --- /dev/null +++ b/packages/babel-plugin-transform-destructuring/test/fixtures/destructuring/for-let-nest/output.js @@ -0,0 +1 @@ +for (var _ref = [], _ref$ = _ref[0], _ref$2 = _ref$ === void 0 ? [1] : _ref$, _ref$3 = babelHelpers.slicedToArray(_ref$2, 1), x = _ref$3[0];;) {} \ No newline at end of file diff --git a/packages/babel-plugin-transform-destructuring/test/fixtures/destructuring/non-iterable/exec.js b/packages/babel-plugin-transform-destructuring/test/fixtures/destructuring/non-iterable/exec.js new file mode 100644 index 000000000000..e0bac050d60a --- /dev/null +++ b/packages/babel-plugin-transform-destructuring/test/fixtures/destructuring/non-iterable/exec.js @@ -0,0 +1,22 @@ +var foo, bar; + +expect( + () => [foo, bar] = undefined +).toThrow(/destructure non-iterable/); + +expect( + () => [foo, bar] = {} +).toThrow(/destructure non-iterable/); + +// Simulate old browser +let _Symbol = Symbol; +Symbol = void 0; +try { + + expect( + () => [foo, bar] = {} + ).toThrow(/destructure non-iterable/); + +} finally { + Symbol = _Symbol; +} diff --git a/packages/babel-plugin-transform-destructuring/test/fixtures/destructuring/non-iterable/options.json b/packages/babel-plugin-transform-destructuring/test/fixtures/destructuring/non-iterable/options.json new file mode 100644 index 000000000000..23c0b75d2acd --- /dev/null +++ b/packages/babel-plugin-transform-destructuring/test/fixtures/destructuring/non-iterable/options.json @@ -0,0 +1,5 @@ +{ + "plugins": [ + "transform-destructuring" + ] +} diff --git a/packages/babel-plugin-transform-destructuring/test/fixtures/regression/11210/input.mjs b/packages/babel-plugin-transform-destructuring/test/fixtures/regression/11210/input.mjs new file mode 100644 index 000000000000..6ce63b17715b --- /dev/null +++ b/packages/babel-plugin-transform-destructuring/test/fixtures/regression/11210/input.mjs @@ -0,0 +1,5 @@ +export default class A { + handle = value => { + ({ value } = {}); + } +} diff --git a/packages/babel-plugin-transform-destructuring/test/fixtures/regression/11210/options.json b/packages/babel-plugin-transform-destructuring/test/fixtures/regression/11210/options.json new file mode 100644 index 000000000000..33010297d1df --- /dev/null +++ b/packages/babel-plugin-transform-destructuring/test/fixtures/regression/11210/options.json @@ -0,0 +1,7 @@ +{ + "plugins": [ + "proposal-class-properties", + "transform-parameters", + "transform-destructuring" + ] +} diff --git a/packages/babel-plugin-transform-destructuring/test/fixtures/regression/11210/output.mjs b/packages/babel-plugin-transform-destructuring/test/fixtures/regression/11210/output.mjs new file mode 100644 index 000000000000..031ed5b8a475 --- /dev/null +++ b/packages/babel-plugin-transform-destructuring/test/fixtures/regression/11210/output.mjs @@ -0,0 +1,11 @@ +function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } + +export default class A { + constructor() { + _defineProperty(this, "handle", value => { + var _ref = {}; + value = _ref.value; + }); + } + +} diff --git a/packages/babel-plugin-transform-dotall-regex/.npmignore b/packages/babel-plugin-transform-dotall-regex/.npmignore new file mode 100644 index 000000000000..2b1fceba679b --- /dev/null +++ b/packages/babel-plugin-transform-dotall-regex/.npmignore @@ -0,0 +1,3 @@ +*.log +src +test diff --git a/packages/babel-plugin-transform-dotall-regex/package.json b/packages/babel-plugin-transform-dotall-regex/package.json index 2e36b5923586..ec17bdc61eeb 100644 --- a/packages/babel-plugin-transform-dotall-regex/package.json +++ b/packages/babel-plugin-transform-dotall-regex/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-transform-dotall-regex", - "version": "7.4.4", + "version": "7.8.3", "description": "Compile regular expressions using the `s` (`dotAll`) flag to ES5.", "homepage": "https://babeljs.io/", "license": "MIT", @@ -8,9 +8,6 @@ "access": "public" }, "main": "lib/index.js", - "engines": { - "node": ">=4" - }, "keywords": [ "babel-plugin", "regex", @@ -21,15 +18,14 @@ "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-dotall-regex", "bugs": "https://github.com/babel/babel/issues", "dependencies": { - "@babel/helper-plugin-utils": "^7.0.0", - "@babel/helper-regex": "^7.4.4", - "regexpu-core": "^4.5.4" + "@babel/helper-create-regexp-features-plugin": "^7.8.3", + "@babel/helper-plugin-utils": "^7.8.3" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.4.4", - "@babel/helper-plugin-test-runner": "^7.0.0" + "@babel/core": "^7.8.3", + "@babel/helper-plugin-test-runner": "^7.8.3" } } diff --git a/packages/babel-plugin-transform-dotall-regex/src/index.js b/packages/babel-plugin-transform-dotall-regex/src/index.js index af11660ea05e..a41961076922 100644 --- a/packages/babel-plugin-transform-dotall-regex/src/index.js +++ b/packages/babel-plugin-transform-dotall-regex/src/index.js @@ -1,25 +1,12 @@ +/* eslint-disable @babel/development/plugin-name */ +import { createRegExpFeaturePlugin } from "@babel/helper-create-regexp-features-plugin"; import { declare } from "@babel/helper-plugin-utils"; -import rewritePattern from "regexpu-core"; -import * as regex from "@babel/helper-regex"; export default declare(api => { api.assertVersion(7); - return { + return createRegExpFeaturePlugin({ name: "transform-dotall-regex", - - visitor: { - RegExpLiteral(path) { - const node = path.node; - if (!regex.is(node, "s")) { - return; - } - node.pattern = rewritePattern(node.pattern, node.flags, { - dotAllFlag: true, - useUnicodeFlag: regex.is(node, "u"), - }); - regex.pullFlag(node, "s"); - }, - }, - }; + feature: "dotAllFlag", + }); }); diff --git a/packages/babel-plugin-transform-dotall-regex/test/fixtures/dotall-regex/simple/output.js b/packages/babel-plugin-transform-dotall-regex/test/fixtures/dotall-regex/simple/output.js index dec34325752f..283718ce96ce 100644 --- a/packages/babel-plugin-transform-dotall-regex/test/fixtures/dotall-regex/simple/output.js +++ b/packages/babel-plugin-transform-dotall-regex/test/fixtures/dotall-regex/simple/output.js @@ -1,2 +1,2 @@ var a = /./; -var b = /[\0-\uFFFF]/; +var b = /[\s\S]/; diff --git a/packages/babel-plugin-transform-dotall-regex/test/fixtures/dotall-regex/with-unicode-property-escape/input.js b/packages/babel-plugin-transform-dotall-regex/test/fixtures/dotall-regex/with-unicode-property-escape/input.js new file mode 100644 index 000000000000..dc74dbc0d615 --- /dev/null +++ b/packages/babel-plugin-transform-dotall-regex/test/fixtures/dotall-regex/with-unicode-property-escape/input.js @@ -0,0 +1,2 @@ +var a = /\p{Unified_Ideograph}./u; +var b = /\p{Unified_Ideograph}./su; diff --git a/packages/babel-plugin-transform-dotall-regex/test/fixtures/dotall-regex/with-unicode-property-escape/options.json b/packages/babel-plugin-transform-dotall-regex/test/fixtures/dotall-regex/with-unicode-property-escape/options.json new file mode 100644 index 000000000000..2078653dce15 --- /dev/null +++ b/packages/babel-plugin-transform-dotall-regex/test/fixtures/dotall-regex/with-unicode-property-escape/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["transform-dotall-regex", "proposal-unicode-property-regex"] +} diff --git a/packages/babel-plugin-transform-dotall-regex/test/fixtures/dotall-regex/with-unicode-property-escape/output.js b/packages/babel-plugin-transform-dotall-regex/test/fixtures/dotall-regex/with-unicode-property-escape/output.js new file mode 100644 index 000000000000..c00aa15a9c1f --- /dev/null +++ b/packages/babel-plugin-transform-dotall-regex/test/fixtures/dotall-regex/with-unicode-property-escape/output.js @@ -0,0 +1,2 @@ +var a = /[\u3400-\u4DBF\u4E00-\u9FFC\uFA0E\uFA0F\uFA11\uFA13\uFA14\uFA1F\uFA21\uFA23\uFA24\uFA27-\uFA29\u{20000}-\u{2A6DD}\u{2A700}-\u{2B734}\u{2B740}-\u{2B81D}\u{2B820}-\u{2CEA1}\u{2CEB0}-\u{2EBE0}\u{30000}-\u{3134A}][\0-\t\x0B\f\x0E-\u2027\u202A-\u{10FFFF}]/u; +var b = /[\u3400-\u4DBF\u4E00-\u9FFC\uFA0E\uFA0F\uFA11\uFA13\uFA14\uFA1F\uFA21\uFA23\uFA24\uFA27-\uFA29\u{20000}-\u{2A6DD}\u{2A700}-\u{2B734}\u{2B740}-\u{2B81D}\u{2B820}-\u{2CEA1}\u{2CEB0}-\u{2EBE0}\u{30000}-\u{3134A}][\0-\u{10FFFF}]/u; diff --git a/packages/babel-plugin-transform-duplicate-keys/package.json b/packages/babel-plugin-transform-duplicate-keys/package.json index e58d6908cf20..74f1fe33ec92 100644 --- a/packages/babel-plugin-transform-duplicate-keys/package.json +++ b/packages/babel-plugin-transform-duplicate-keys/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-transform-duplicate-keys", - "version": "7.5.0", + "version": "7.8.3", "description": "Compile objects with duplicate keys to valid strict ES5", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-duplicate-keys", "license": "MIT", @@ -12,13 +12,13 @@ "babel-plugin" ], "dependencies": { - "@babel/helper-plugin-utils": "^7.0.0" + "@babel/helper-plugin-utils": "^7.8.3" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.5.0", - "@babel/helper-plugin-test-runner": "^7.0.0" + "@babel/core": "^7.8.3", + "@babel/helper-plugin-test-runner": "^7.8.3" } } diff --git a/packages/babel-plugin-transform-exponentiation-operator/package.json b/packages/babel-plugin-transform-exponentiation-operator/package.json index aaf4029930b0..5ade53de54dd 100644 --- a/packages/babel-plugin-transform-exponentiation-operator/package.json +++ b/packages/babel-plugin-transform-exponentiation-operator/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-transform-exponentiation-operator", - "version": "7.2.0", + "version": "7.8.3", "description": "Compile exponentiation operator to ES5", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-exponentiation-operator", "license": "MIT", @@ -12,14 +12,14 @@ "babel-plugin" ], "dependencies": { - "@babel/helper-builder-binary-assignment-operator-visitor": "^7.1.0", - "@babel/helper-plugin-utils": "^7.0.0" + "@babel/helper-builder-binary-assignment-operator-visitor": "^7.8.3", + "@babel/helper-plugin-utils": "^7.8.3" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.2.0", - "@babel/helper-plugin-test-runner": "^7.0.0" + "@babel/core": "^7.8.3", + "@babel/helper-plugin-test-runner": "^7.8.3" } } diff --git a/packages/babel-plugin-transform-flow-comments/package.json b/packages/babel-plugin-transform-flow-comments/package.json index 34123bbcc748..8a83330fd212 100644 --- a/packages/babel-plugin-transform-flow-comments/package.json +++ b/packages/babel-plugin-transform-flow-comments/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-transform-flow-comments", - "version": "7.5.5", + "version": "7.8.3", "description": "Turn flow type annotations into comments", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-flow-comments", "license": "MIT", @@ -12,15 +12,15 @@ "babel-plugin" ], "dependencies": { - "@babel/generator": "^7.5.5", - "@babel/helper-plugin-utils": "^7.0.0", - "@babel/plugin-syntax-flow": "^7.2.0" + "@babel/generator": "^7.8.3", + "@babel/helper-plugin-utils": "^7.8.3", + "@babel/plugin-syntax-flow": "^7.8.3" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.5.5", - "@babel/helper-plugin-test-runner": "^7.0.0" + "@babel/core": "^7.8.3", + "@babel/helper-plugin-test-runner": "^7.8.3" } } diff --git a/packages/babel-plugin-transform-flow-comments/src/index.js b/packages/babel-plugin-transform-flow-comments/src/index.js index 2d54ae9d9854..742db1f0f263 100644 --- a/packages/babel-plugin-transform-flow-comments/src/index.js +++ b/packages/babel-plugin-transform-flow-comments/src/index.js @@ -6,27 +6,73 @@ import generateCode from "@babel/generator"; export default declare(api => { api.assertVersion(7); - function attachComment(path, comment) { - let attach = path.getPrevSibling(); - let where = "trailing"; - if (!attach.node) { - attach = path.parentPath; + function commentFromString(comment) { + return typeof comment === "string" + ? { type: "CommentBlock", value: comment } + : comment; + } + + function attachComment({ + ofPath, + toPath, + where = "trailing", + optional = false, + comments = generateComment(ofPath, optional), + keepType = false, + }) { + if (!toPath || !toPath.node) { + toPath = ofPath.getPrevSibling(); + where = "trailing"; + } + if (!toPath.node) { + toPath = ofPath.getNextSibling(); + where = "leading"; + } + if (!toPath.node) { + toPath = ofPath.parentPath; where = "inner"; } - attach.addComment(where, comment); - path.remove(); + if (!Array.isArray(comments)) { + comments = [comments]; + } + comments = comments.map(commentFromString); + if (!keepType && ofPath && ofPath.node) { + // Removes the node at `ofPath` while conserving the comments attached + // to it. + const node = ofPath.node; + const parent = ofPath.parentPath; + const prev = ofPath.getPrevSibling(); + const next = ofPath.getNextSibling(); + const isSingleChild = !(prev.node || next.node); + const leading = node.leadingComments; + const trailing = node.trailingComments; + + if (isSingleChild && leading) { + parent.addComments("inner", leading); + } + toPath.addComments(where, comments); + ofPath.remove(); + if (isSingleChild && trailing) { + parent.addComments("inner", trailing); + } + } else { + toPath.addComments(where, comments); + } } - function wrapInFlowComment(path, parent) { - attachComment(path, generateComment(path, parent)); + function wrapInFlowComment(path) { + attachComment({ + ofPath: path, + comments: generateComment(path, path.parent.optional), + }); } - function generateComment(path, parent) { + function generateComment(path, optional) { let comment = path .getSource() .replace(/\*-\//g, "*-ESCAPED/") .replace(/\*\//g, "*-/"); - if (parent && parent.optional) comment = "?" + comment; + if (optional) comment = "?" + comment; if (comment[0] !== ":") comment = ":: " + comment; return comment; } @@ -42,28 +88,32 @@ export default declare(api => { visitor: { TypeCastExpression(path) { const { node } = path; - path - .get("expression") - .addComment("trailing", generateComment(path.get("typeAnnotation"))); + attachComment({ + ofPath: path.get("typeAnnotation"), + toPath: path.get("expression"), + keepType: true, + }); path.replaceWith(t.parenthesizedExpression(node.expression)); }, // support function a(b?) {} Identifier(path) { - if (path.parentPath.isFlow()) { - return; - } - + if (path.parentPath.isFlow()) return; const { node } = path; if (node.typeAnnotation) { - const typeAnnotation = path.get("typeAnnotation"); - path.addComment("trailing", generateComment(typeAnnotation, node)); - typeAnnotation.remove(); + attachComment({ + ofPath: path.get("typeAnnotation"), + toPath: path, + optional: node.optional || node.typeAnnotation.optional, + }); if (node.optional) { node.optional = false; } } else if (node.optional) { - path.addComment("trailing", ":: ?"); + attachComment({ + toPath: path, + comments: ":: ?", + }); node.optional = false; } }, @@ -81,58 +131,51 @@ export default declare(api => { Function(path) { if (path.isDeclareFunction()) return; const { node } = path; - if (node.returnType) { - const returnType = path.get("returnType"); - const typeAnnotation = returnType.get("typeAnnotation"); - const block = path.get("body"); - block.addComment( - "leading", - generateComment(returnType, typeAnnotation.node), - ); - returnType.remove(); - } if (node.typeParameters) { - const typeParameters = path.get("typeParameters"); - const id = path.get("id"); - id.addComment( - "trailing", - generateComment(typeParameters, typeParameters.node), - ); - typeParameters.remove(); + attachComment({ + ofPath: path.get("typeParameters"), + toPath: path.get("id"), + optional: node.typeParameters.optional, + }); + } + if (node.returnType) { + attachComment({ + ofPath: path.get("returnType"), + toPath: path.get("body"), + where: "leading", + optional: node.returnType.typeAnnotation.optional, + }); } }, // support for `class X { foo: string }` - #4622 ClassProperty(path) { - const { node, parent } = path; + const { node } = path; if (!node.value) { - wrapInFlowComment(path, parent); + wrapInFlowComment(path); } else if (node.typeAnnotation) { - const typeAnnotation = path.get("typeAnnotation"); - path - .get("key") - .addComment( - "trailing", - generateComment(typeAnnotation, typeAnnotation.node), - ); - typeAnnotation.remove(); + attachComment({ + ofPath: path.get("typeAnnotation"), + toPath: path.get("key"), + optional: node.typeAnnotation.optional, + }); } }, // support `export type a = {}` - #8 Error: You passed path.replaceWith() a falsy node ExportNamedDeclaration(path) { - const { node, parent } = path; + const { node } = path; if (node.exportKind !== "type" && !t.isFlow(node.declaration)) { return; } - wrapInFlowComment(path, parent); + wrapInFlowComment(path); }, // support `import type A` and `import typeof A` #10 ImportDeclaration(path) { - const { node, parent } = path; + const { node } = path; if (isTypeImport(node.importKind)) { - wrapInFlowComment(path, parent); + wrapInFlowComment(path); return; } @@ -148,61 +191,88 @@ export default declare(api => { if (typeSpecifiers.length > 0) { const typeImportNode = t.cloneNode(node); typeImportNode.specifiers = typeSpecifiers; + const comment = `:: ${generateCode(typeImportNode).code}`; if (nonTypeSpecifiers.length > 0) { - path.addComment( - "trailing", - `:: ${generateCode(typeImportNode).code}`, - ); + attachComment({ toPath: path, comments: comment }); } else { - attachComment(path, `:: ${generateCode(typeImportNode).code}`); + attachComment({ ofPath: path, comments: comment }); } } }, ObjectPattern(path) { const { node } = path; if (node.typeAnnotation) { - const typeAnnotation = path.get("typeAnnotation"); - path.addComment( - "trailing", - generateComment(typeAnnotation, typeAnnotation.node), - ); - typeAnnotation.remove(); + attachComment({ + ofPath: path.get("typeAnnotation"), + toPath: path, + optional: node.optional || node.typeAnnotation.optional, + }); } }, Flow(path) { - const { parent } = path; - wrapInFlowComment(path, parent); + wrapInFlowComment(path); }, Class(path) { const { node } = path; - if (node.typeParameters || node.implements) { - const comments = []; - if (node.typeParameters) { - const typeParameters = path.get("typeParameters"); + let comments = []; + if (node.typeParameters) { + const typeParameters = path.get("typeParameters"); + comments.push( + generateComment(typeParameters, node.typeParameters.optional), + ); + const trailingComments = node.typeParameters.trailingComments; + if (trailingComments) { + comments.push(...trailingComments); + } + typeParameters.remove(); + } + + if (node.superClass) { + if (comments.length > 0) { + attachComment({ + toPath: path.get("id"), + comments: comments, + }); + comments = []; + } + + if (node.superTypeParameters) { + const superTypeParameters = path.get("superTypeParameters"); comments.push( - generateComment(typeParameters, typeParameters.node).replace( - /^:: /, - "", + generateComment( + superTypeParameters, + superTypeParameters.node.optional, ), ); - typeParameters.remove(); + superTypeParameters.remove(); } - if (node.implements) { - const impls = path.get("implements"); - comments.push( - "implements " + - impls - .map(impl => generateComment(impl).replace(/^:: /, "")) - .join(", "), - ); - delete node["implements"]; + } + + if (node.implements) { + const impls = path.get("implements"); + const comment = + "implements " + + impls + .map(impl => generateComment(impl).replace(/^:: /, "")) + .join(", "); + delete node["implements"]; + + if (comments.length === 1) { + comments[0] += ` ${comment}`; + } else { + comments.push(`:: ${comment}`); } + } - const block = path.get("body"); - block.addComment("leading", ":: " + comments.join(" ")); + if (comments.length > 0) { + attachComment({ + toPath: path.get("body"), + where: "leading", + comments: comments, + }); } }, }, diff --git a/packages/babel-plugin-transform-flow-comments/test/fixtures/flow-comments/class-extends-type-parameter/input.js b/packages/babel-plugin-transform-flow-comments/test/fixtures/flow-comments/class-extends-type-parameter/input.js new file mode 100644 index 000000000000..c75d5b793b2e --- /dev/null +++ b/packages/babel-plugin-transform-flow-comments/test/fixtures/flow-comments/class-extends-type-parameter/input.js @@ -0,0 +1 @@ +class Foo extends Bar {} diff --git a/packages/babel-plugin-transform-flow-comments/test/fixtures/flow-comments/class-extends-type-parameter/output.js b/packages/babel-plugin-transform-flow-comments/test/fixtures/flow-comments/class-extends-type-parameter/output.js new file mode 100644 index 000000000000..b4f9a9dba49c --- /dev/null +++ b/packages/babel-plugin-transform-flow-comments/test/fixtures/flow-comments/class-extends-type-parameter/output.js @@ -0,0 +1,3 @@ +class Foo extends Bar +/*:: */ +{} diff --git a/packages/babel-plugin-transform-flow-comments/test/fixtures/flow-comments/class-type-parameter-extends-type-parameter/input.js b/packages/babel-plugin-transform-flow-comments/test/fixtures/flow-comments/class-type-parameter-extends-type-parameter/input.js new file mode 100644 index 000000000000..7a7673af94cc --- /dev/null +++ b/packages/babel-plugin-transform-flow-comments/test/fixtures/flow-comments/class-type-parameter-extends-type-parameter/input.js @@ -0,0 +1,3 @@ +class Foo /* inner */ extends Bar {} + +/*a*/class /*b*/Baz/*c*//*d*/extends /*e*/Bar/*f*//*g*/ {/*h*/}/*i*/ diff --git a/packages/babel-plugin-transform-flow-comments/test/fixtures/flow-comments/class-type-parameter-extends-type-parameter/output.js b/packages/babel-plugin-transform-flow-comments/test/fixtures/flow-comments/class-type-parameter-extends-type-parameter/output.js new file mode 100644 index 000000000000..45e9c5e696fa --- /dev/null +++ b/packages/babel-plugin-transform-flow-comments/test/fixtures/flow-comments/class-type-parameter-extends-type-parameter/output.js @@ -0,0 +1,30 @@ +class Foo +/*:: */ + +/* inner */ +extends Bar +/*:: */ +{} +/*a*/ + + +class +/*b*/ +Baz +/*c*/ + +/*:: */ + +/*d*/ +extends +/*e*/ +Bar +/*f*/ + +/*:: */ + +/*g*/ +{} +/*h*/ + +/*i*/ diff --git a/packages/babel-plugin-transform-flow-comments/test/fixtures/flow-comments/class-type-parameter-extends/input.js b/packages/babel-plugin-transform-flow-comments/test/fixtures/flow-comments/class-type-parameter-extends/input.js new file mode 100644 index 000000000000..3fb5906c3afc --- /dev/null +++ b/packages/babel-plugin-transform-flow-comments/test/fixtures/flow-comments/class-type-parameter-extends/input.js @@ -0,0 +1 @@ +class Foo extends Bar {} diff --git a/packages/babel-plugin-transform-flow-comments/test/fixtures/flow-comments/class-type-parameter-extends/output.js b/packages/babel-plugin-transform-flow-comments/test/fixtures/flow-comments/class-type-parameter-extends/output.js new file mode 100644 index 000000000000..47ca6593757d --- /dev/null +++ b/packages/babel-plugin-transform-flow-comments/test/fixtures/flow-comments/class-type-parameter-extends/output.js @@ -0,0 +1,3 @@ +class Foo +/*:: */ +extends Bar {} diff --git a/packages/babel-plugin-transform-flow-comments/test/fixtures/flow-comments/declare-statements/input.js b/packages/babel-plugin-transform-flow-comments/test/fixtures/flow-comments/declare-statements/input.js index 7c2826479454..64db78b233dc 100644 --- a/packages/babel-plugin-transform-flow-comments/test/fixtures/flow-comments/declare-statements/input.js +++ b/packages/babel-plugin-transform-flow-comments/test/fixtures/flow-comments/declare-statements/input.js @@ -4,13 +4,13 @@ declare function foo(): void declare function foo(): void; declare function foo(): void; declare function foo(x: number, y: string): void; -declare class A {} -declare class A extends B { x: number } -declare class A { static foo(): number, static x : string } -declare class A { static [ indexer: number]: string } -declare class A { static () : number } -declare class A mixins B, C {} -declare type A = string +declare class A1 {} +declare class A1 extends B { x: number } +declare class A1 { static foo(): number, static x : string } +declare class A1 { static [ indexer: number]: string } +declare class A1 { static () : number } +declare class A1 mixins B, C {} +declare type A2 = string declare type T = { [k:string]: U } -declare interface I { foo: string } -declare interface I { foo: T } +declare interface I1 { foo: string } +declare interface I2 { foo: T } diff --git a/packages/babel-plugin-transform-flow-comments/test/fixtures/flow-comments/declare-statements/output.js b/packages/babel-plugin-transform-flow-comments/test/fixtures/flow-comments/declare-statements/output.js index 3be48955c146..3feecb2a9347 100644 --- a/packages/babel-plugin-transform-flow-comments/test/fixtures/flow-comments/declare-statements/output.js +++ b/packages/babel-plugin-transform-flow-comments/test/fixtures/flow-comments/declare-statements/output.js @@ -10,22 +10,22 @@ /*:: declare function foo(x: number, y: string): void;*/ -/*:: declare class A {}*/ +/*:: declare class A1 {}*/ -/*:: declare class A extends B { x: number }*/ +/*:: declare class A1 extends B { x: number }*/ -/*:: declare class A { static foo(): number, static x : string }*/ +/*:: declare class A1 { static foo(): number, static x : string }*/ -/*:: declare class A { static [ indexer: number]: string }*/ +/*:: declare class A1 { static [ indexer: number]: string }*/ -/*:: declare class A { static () : number }*/ +/*:: declare class A1 { static () : number }*/ -/*:: declare class A mixins B, C {}*/ +/*:: declare class A1 mixins B, C {}*/ -/*:: declare type A = string*/ +/*:: declare type A2 = string*/ /*:: declare type T = { [k:string]: U }*/ -/*:: declare interface I { foo: string }*/ +/*:: declare interface I1 { foo: string }*/ -/*:: declare interface I { foo: T }*/ +/*:: declare interface I2 { foo: T }*/ diff --git a/packages/babel-plugin-transform-flow-comments/test/fixtures/flow-comments/preserve-comments-order/input.js b/packages/babel-plugin-transform-flow-comments/test/fixtures/flow-comments/preserve-comments-order/input.js new file mode 100644 index 000000000000..e21008c2f7d7 --- /dev/null +++ b/packages/babel-plugin-transform-flow-comments/test/fixtures/flow-comments/preserve-comments-order/input.js @@ -0,0 +1,7 @@ +/*a*/ +type Foo = number; +/*b*/ +var foo; +/*c*/ +type Bar = number; +/*d*/ diff --git a/packages/babel-plugin-transform-flow-comments/test/fixtures/flow-comments/preserve-comments-order/output.js b/packages/babel-plugin-transform-flow-comments/test/fixtures/flow-comments/preserve-comments-order/output.js new file mode 100644 index 000000000000..8365f7d536e2 --- /dev/null +++ b/packages/babel-plugin-transform-flow-comments/test/fixtures/flow-comments/preserve-comments-order/output.js @@ -0,0 +1,11 @@ +/*a*/ + +/*:: type Foo = number;*/ + +/*b*/ +var foo; +/*c*/ + +/*:: type Bar = number;*/ + +/*d*/ diff --git a/packages/babel-plugin-transform-flow-comments/test/fixtures/flow-comments/preserve-comments/input.js b/packages/babel-plugin-transform-flow-comments/test/fixtures/flow-comments/preserve-comments/input.js new file mode 100644 index 000000000000..4de529bb0fda --- /dev/null +++ b/packages/babel-plugin-transform-flow-comments/test/fixtures/flow-comments/preserve-comments/input.js @@ -0,0 +1,2 @@ +/**/ +type Foo = number; diff --git a/packages/babel-plugin-transform-flow-comments/test/fixtures/flow-comments/preserve-comments/output.js b/packages/babel-plugin-transform-flow-comments/test/fixtures/flow-comments/preserve-comments/output.js new file mode 100644 index 000000000000..95b2dd0f9cbf --- /dev/null +++ b/packages/babel-plugin-transform-flow-comments/test/fixtures/flow-comments/preserve-comments/output.js @@ -0,0 +1,3 @@ +/**/ + +/*:: type Foo = number;*/ diff --git a/packages/babel-plugin-transform-flow-comments/test/fixtures/flow-comments/transformed-class-method-loose-return-type-annotation/output.js b/packages/babel-plugin-transform-flow-comments/test/fixtures/flow-comments/transformed-class-method-loose-return-type-annotation/output.js index 8b6befeca12d..dc10e81bd149 100644 --- a/packages/babel-plugin-transform-flow-comments/test/fixtures/flow-comments/transformed-class-method-loose-return-type-annotation/output.js +++ b/packages/babel-plugin-transform-flow-comments/test/fixtures/flow-comments/transformed-class-method-loose-return-type-annotation/output.js @@ -1,7 +1,5 @@ // @flow -var C = -/*#__PURE__*/ -function () { +var C = /*#__PURE__*/function () { "use strict"; function C() {} diff --git a/packages/babel-plugin-transform-flow-comments/test/fixtures/flow-comments/transformed-class-method-return-type-annotation/output.js b/packages/babel-plugin-transform-flow-comments/test/fixtures/flow-comments/transformed-class-method-return-type-annotation/output.js index 33fc41f5b9c5..00c067be3ffc 100644 --- a/packages/babel-plugin-transform-flow-comments/test/fixtures/flow-comments/transformed-class-method-return-type-annotation/output.js +++ b/packages/babel-plugin-transform-flow-comments/test/fixtures/flow-comments/transformed-class-method-return-type-annotation/output.js @@ -1,7 +1,5 @@ // @flow -var C = -/*#__PURE__*/ -function () { +var C = /*#__PURE__*/function () { "use strict"; function C() { diff --git a/packages/babel-plugin-transform-flow-strip-types/package.json b/packages/babel-plugin-transform-flow-strip-types/package.json index c484570c331d..606bcc3574d5 100644 --- a/packages/babel-plugin-transform-flow-strip-types/package.json +++ b/packages/babel-plugin-transform-flow-strip-types/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-transform-flow-strip-types", - "version": "7.4.4", + "version": "7.9.0", "description": "Strip flow type annotations from your output code.", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-flow-strip-types", "license": "MIT", @@ -12,14 +12,14 @@ "babel-plugin" ], "dependencies": { - "@babel/helper-plugin-utils": "^7.0.0", - "@babel/plugin-syntax-flow": "^7.2.0" + "@babel/helper-plugin-utils": "^7.8.3", + "@babel/plugin-syntax-flow": "^7.8.3" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.4.4", - "@babel/helper-plugin-test-runner": "^7.0.0" + "@babel/core": "^7.9.0", + "@babel/helper-plugin-test-runner": "^7.8.3" } } diff --git a/packages/babel-plugin-transform-flow-strip-types/src/index.js b/packages/babel-plugin-transform-flow-strip-types/src/index.js index bf4e5acafff0..7779fd75232b 100644 --- a/packages/babel-plugin-transform-flow-strip-types/src/index.js +++ b/packages/babel-plugin-transform-flow-strip-types/src/index.js @@ -2,13 +2,15 @@ import { declare } from "@babel/helper-plugin-utils"; import syntaxFlow from "@babel/plugin-syntax-flow"; import { types as t } from "@babel/core"; -export default declare(api => { +export default declare((api, opts) => { api.assertVersion(7); const FLOW_DIRECTIVE = /(@flow(\s+(strict(-local)?|weak))?|@noflow)/; let skipStrip = false; + const { requireDirective = false, allowDeclareFields = false } = opts; + return { name: "transform-flow-strip-types", inherits: syntaxFlow, @@ -20,7 +22,6 @@ export default declare(api => { file: { ast: { comments }, }, - opts, }, ) { skipStrip = false; @@ -42,7 +43,7 @@ export default declare(api => { } } - if (!directiveFound && opts.requireDirective) { + if (!directiveFound && requireDirective) { skipStrip = true; } }, @@ -74,13 +75,6 @@ export default declare(api => { path.remove(); }, - ClassProperty(path) { - if (skipStrip) return; - path.node.variance = null; - path.node.typeAnnotation = null; - if (!path.node.value) path.remove(); - }, - ClassPrivateProperty(path) { if (skipStrip) return; path.node.typeAnnotation = null; @@ -94,8 +88,25 @@ export default declare(api => { // would transform the class before we reached the class property. path.get("body.body").forEach(child => { if (child.isClassProperty()) { - child.node.typeAnnotation = null; - if (!child.node.value) child.remove(); + const { node } = child; + + if (!allowDeclareFields && node.declare) { + throw child.buildCodeFrameError( + `The 'declare' modifier is only allowed when the ` + + `'allowDeclareFields' option of ` + + `@babel/plugin-transform-flow-strip-types or ` + + `@babel/preset-flow is enabled.`, + ); + } + + if (node.declare) { + child.remove(); + } else if (!allowDeclareFields && !node.value && !node.decorators) { + child.remove(); + } else { + node.variance = null; + node.typeAnnotation = null; + } } }); }, diff --git a/packages/babel-plugin-transform-flow-strip-types/test/fixtures/class/declare-not-enabled/input.js b/packages/babel-plugin-transform-flow-strip-types/test/fixtures/class/declare-not-enabled/input.js new file mode 100644 index 000000000000..3cb9d54665fa --- /dev/null +++ b/packages/babel-plugin-transform-flow-strip-types/test/fixtures/class/declare-not-enabled/input.js @@ -0,0 +1,3 @@ +class A { + declare x; +} diff --git a/packages/babel-plugin-transform-flow-strip-types/test/fixtures/class/declare-not-enabled/options.json b/packages/babel-plugin-transform-flow-strip-types/test/fixtures/class/declare-not-enabled/options.json new file mode 100644 index 000000000000..73835049c4ca --- /dev/null +++ b/packages/babel-plugin-transform-flow-strip-types/test/fixtures/class/declare-not-enabled/options.json @@ -0,0 +1,7 @@ +{ + "plugins": [ + "transform-flow-strip-types", + "syntax-class-properties" + ], + "throws": "The 'declare' modifier is only allowed when the 'allowDeclareFields' option of @babel/plugin-transform-flow-strip-types or @babel/preset-flow is enabled." +} diff --git a/packages/babel-plugin-transform-flow-strip-types/test/fixtures/class/declare/input.js b/packages/babel-plugin-transform-flow-strip-types/test/fixtures/class/declare/input.js new file mode 100644 index 000000000000..7ab37b71fb39 --- /dev/null +++ b/packages/babel-plugin-transform-flow-strip-types/test/fixtures/class/declare/input.js @@ -0,0 +1,3 @@ +class A { + declare x; +} \ No newline at end of file diff --git a/packages/babel-plugin-transform-flow-strip-types/test/fixtures/class/declare/options.json b/packages/babel-plugin-transform-flow-strip-types/test/fixtures/class/declare/options.json new file mode 100644 index 000000000000..f5bedcb81ada --- /dev/null +++ b/packages/babel-plugin-transform-flow-strip-types/test/fixtures/class/declare/options.json @@ -0,0 +1,6 @@ +{ + "plugins": [ + ["transform-flow-strip-types", { "allowDeclareFields": true }], + "syntax-class-properties" + ] +} diff --git a/packages/babel-plugin-transform-flow-strip-types/test/fixtures/class/declare/output.js b/packages/babel-plugin-transform-flow-strip-types/test/fixtures/class/declare/output.js new file mode 100644 index 000000000000..a869c2849526 --- /dev/null +++ b/packages/babel-plugin-transform-flow-strip-types/test/fixtures/class/declare/output.js @@ -0,0 +1 @@ +class A {} diff --git a/packages/babel-plugin-transform-flow-strip-types/test/fixtures/regression/transformed-class-method-loose-return-type-annotation/output.js b/packages/babel-plugin-transform-flow-strip-types/test/fixtures/regression/transformed-class-method-loose-return-type-annotation/output.js index ce79f9ddf9f4..79254ef5e2c1 100644 --- a/packages/babel-plugin-transform-flow-strip-types/test/fixtures/regression/transformed-class-method-loose-return-type-annotation/output.js +++ b/packages/babel-plugin-transform-flow-strip-types/test/fixtures/regression/transformed-class-method-loose-return-type-annotation/output.js @@ -1,6 +1,4 @@ -var C = -/*#__PURE__*/ -function () { +var C = /*#__PURE__*/function () { "use strict"; function C() {} diff --git a/packages/babel-plugin-transform-flow-strip-types/test/fixtures/regression/transformed-class-method-return-type-annotation/output.js b/packages/babel-plugin-transform-flow-strip-types/test/fixtures/regression/transformed-class-method-return-type-annotation/output.js index 8c3aab122671..d0150638bf89 100644 --- a/packages/babel-plugin-transform-flow-strip-types/test/fixtures/regression/transformed-class-method-return-type-annotation/output.js +++ b/packages/babel-plugin-transform-flow-strip-types/test/fixtures/regression/transformed-class-method-return-type-annotation/output.js @@ -1,6 +1,4 @@ -var C = -/*#__PURE__*/ -function () { +var C = /*#__PURE__*/function () { "use strict"; function C() { diff --git a/packages/babel-plugin-transform-flow-strip-types/test/fixtures/strip-types/def-site-variance/input.js b/packages/babel-plugin-transform-flow-strip-types/test/fixtures/strip-types/def-site-variance/input.js index eb188c5c908a..9cc374a5d523 100644 --- a/packages/babel-plugin-transform-flow-strip-types/test/fixtures/strip-types/def-site-variance/input.js +++ b/packages/babel-plugin-transform-flow-strip-types/test/fixtures/strip-types/def-site-variance/input.js @@ -5,10 +5,10 @@ type T1 = { +p: T } type T2 = { -p: T } type T3 = { +[k:K]: V } type T4 = { -[k:K]: V } -interface I { +p: T } -interface I { -p: T } -interface I { +[k:K]: V } -interface I { -[k:K]: V } +interface I1 { +p: T } +interface I2 { -p: T } +interface I3 { +[k:K]: V } +interface I4 { -[k:K]: V } declare class I { +p: T } declare class I { -p: T } declare class I { +[k:K]: V } diff --git a/packages/babel-plugin-transform-flow-strip-types/test/fixtures/strip-types/strip-declare-statements/input.js b/packages/babel-plugin-transform-flow-strip-types/test/fixtures/strip-types/strip-declare-statements/input.js index 75b24828392c..10cce21e41f8 100644 --- a/packages/babel-plugin-transform-flow-strip-types/test/fixtures/strip-types/strip-declare-statements/input.js +++ b/packages/babel-plugin-transform-flow-strip-types/test/fixtures/strip-types/strip-declare-statements/input.js @@ -4,14 +4,14 @@ declare function foo(): void declare function foo(): void; declare function foo(): void; declare function foo(x: number, y: string): void; -declare class A {} -declare class A extends B { x: number } -declare class A { static foo(): number; static x : string } -declare class A { static [ indexer: number]: string } -declare class A { static () : number } -declare class A mixins B, C {} -declare type A = string +declare class A1 {} +declare class A1 extends B { x: number } +declare class A1 { static foo(): number; static x : string } +declare class A1 { static [ indexer: number]: string } +declare class A1 { static () : number } +declare class A1 mixins B, C {} +declare type A2 = string declare type T = { [k:string]: U } -declare interface I { foo: string } -declare interface I { foo: T } +declare interface I1 { foo: string } +declare interface I2 { foo: T } declare module.exports: string; diff --git a/packages/babel-plugin-transform-flow-strip-types/test/fixtures/strip-types/strip-interfaces-module-and-script/input.js b/packages/babel-plugin-transform-flow-strip-types/test/fixtures/strip-types/strip-interfaces-module-and-script/input.js index 2e37dfaf618d..1ee5de6c9ea3 100644 --- a/packages/babel-plugin-transform-flow-strip-types/test/fixtures/strip-types/strip-interfaces-module-and-script/input.js +++ b/packages/babel-plugin-transform-flow-strip-types/test/fixtures/strip-types/strip-interfaces-module-and-script/input.js @@ -1,7 +1,7 @@ -interface A {} -interface A extends B {} -interface A extends B, C {} -interface A { foo: () => number; } +interface A1 {} +interface A2 extends B {} +interface A3 extends B, C {} +interface A4 { foo: () => number; } interface Dictionary { [index: string]: string; length: number; } class Foo implements Bar {} class Foo2 extends Bar implements Bat, Man {} diff --git a/packages/babel-plugin-transform-flow-strip-types/test/fixtures/strip-types/strip-iterator/input.js b/packages/babel-plugin-transform-flow-strip-types/test/fixtures/strip-types/strip-iterator/input.js index 741c23987d23..7a1d4011b35a 100644 --- a/packages/babel-plugin-transform-flow-strip-types/test/fixtures/strip-types/strip-iterator/input.js +++ b/packages/babel-plugin-transform-flow-strip-types/test/fixtures/strip-types/strip-iterator/input.js @@ -6,10 +6,10 @@ declare class A { @@asyncIterator(): Iterator; } -interface A { +interface A1 { @@iterator(): Iterator; } -interface A { +interface A2 { @@asyncIterator(): Iterator; } diff --git a/packages/babel-plugin-transform-flow-strip-types/test/fixtures/strip-types/strip-typeapp-call/options.json b/packages/babel-plugin-transform-flow-strip-types/test/fixtures/strip-types/strip-typeapp-call/options.json index 81c1ea3a2294..1eca5cfc9f6b 100644 --- a/packages/babel-plugin-transform-flow-strip-types/test/fixtures/strip-types/strip-typeapp-call/options.json +++ b/packages/babel-plugin-transform-flow-strip-types/test/fixtures/strip-types/strip-typeapp-call/options.json @@ -1,7 +1,6 @@ { "plugins": [ "syntax-jsx", - "syntax-optional-chaining", "transform-flow-strip-types" ] } diff --git a/packages/babel-plugin-transform-for-of/package.json b/packages/babel-plugin-transform-for-of/package.json index 66d3aa78455d..f58454602716 100644 --- a/packages/babel-plugin-transform-for-of/package.json +++ b/packages/babel-plugin-transform-for-of/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-transform-for-of", - "version": "7.4.4", + "version": "7.9.0", "description": "Compile ES2015 for...of to ES5", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-for-of", "license": "MIT", @@ -12,13 +12,13 @@ "babel-plugin" ], "dependencies": { - "@babel/helper-plugin-utils": "^7.0.0" + "@babel/helper-plugin-utils": "^7.8.3" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.4.4", - "@babel/helper-plugin-test-runner": "^7.0.0" + "@babel/core": "^7.9.0", + "@babel/helper-plugin-test-runner": "^7.8.3" } } diff --git a/packages/babel-plugin-transform-for-of/src/index.js b/packages/babel-plugin-transform-for-of/src/index.js index cd4c6e17bcd5..429f2899a93a 100644 --- a/packages/babel-plugin-transform-for-of/src/index.js +++ b/packages/babel-plugin-transform-for-of/src/index.js @@ -1,6 +1,8 @@ import { declare } from "@babel/helper-plugin-utils"; import { template, types as t } from "@babel/core"; +import transformWithoutHelper from "./no-helper-implementation"; + export default declare((api, options) => { api.assertVersion(7); @@ -19,7 +21,10 @@ export default declare((api, options) => { visitor: { ForOfStatement(path) { const { scope } = path; - const { left, right, body } = path.node; + const { left, right, await: isAwait } = path.node; + if (isAwait) { + return; + } const i = scope.generateUidIdentifier("i"); let array = scope.maybeGenerateMemoised(right, true); @@ -45,8 +50,19 @@ export default declare((api, options) => { ); } - const block = t.toBlock(body); - block.body.unshift(assignment); + let blockBody; + const body = path.get("body"); + if ( + body.isBlockStatement() && + Object.keys(path.getBindingIdentifiers()).some(id => + body.scope.hasOwnBinding(id), + ) + ) { + blockBody = t.blockStatement([assignment, body.node]); + } else { + blockBody = t.toBlock(body.node); + blockBody.body.unshift(assignment); + } path.replaceWith( t.forStatement( @@ -57,7 +73,7 @@ export default declare((api, options) => { t.memberExpression(t.cloneNode(array), t.identifier("length")), ), t.updateExpression("++", t.cloneNode(i)), - block, + blockBody, ), ); }, @@ -65,64 +81,45 @@ export default declare((api, options) => { }; } - const pushComputedProps = loose - ? pushComputedPropsLoose - : pushComputedPropsSpec; - const buildForOfArray = template(` for (var KEY = 0, NAME = ARR; KEY < NAME.length; KEY++) BODY; `); - const buildForOfLoose = template(` - for (var LOOP_OBJECT = OBJECT, - IS_ARRAY = Array.isArray(LOOP_OBJECT), - INDEX = 0, - LOOP_OBJECT = IS_ARRAY ? LOOP_OBJECT : LOOP_OBJECT[Symbol.iterator]();;) { - INTERMEDIATE; - if (IS_ARRAY) { - if (INDEX >= LOOP_OBJECT.length) break; - ID = LOOP_OBJECT[INDEX++]; - } else { - INDEX = LOOP_OBJECT.next(); - if (INDEX.done) break; - ID = INDEX.value; - } - } + const buildForOfLoose = template.statements(` + for (var ITERATOR_HELPER = CREATE_ITERATOR_HELPER(OBJECT), STEP_KEY; + !(STEP_KEY = ITERATOR_HELPER()).done;) BODY; `); - const buildForOf = template(` - var ITERATOR_COMPLETION = true; - var ITERATOR_HAD_ERROR_KEY = false; - var ITERATOR_ERROR_KEY = undefined; + const buildForOf = template.statements(` + var ITERATOR_HELPER = CREATE_ITERATOR_HELPER(OBJECT), STEP_KEY; try { - for ( - var ITERATOR_KEY = OBJECT[Symbol.iterator](), STEP_KEY; - !(ITERATOR_COMPLETION = (STEP_KEY = ITERATOR_KEY.next()).done); - ITERATOR_COMPLETION = true - ) {} + for (ITERATOR_HELPER.s(); !(STEP_KEY = ITERATOR_HELPER.n()).done;) BODY; } catch (err) { - ITERATOR_HAD_ERROR_KEY = true; - ITERATOR_ERROR_KEY = err; + ITERATOR_HELPER.e(err); } finally { - try { - if (!ITERATOR_COMPLETION && ITERATOR_KEY.return != null) { - ITERATOR_KEY.return(); - } - } finally { - if (ITERATOR_HAD_ERROR_KEY) { - throw ITERATOR_ERROR_KEY; - } - } + ITERATOR_HELPER.f(); } `); + const builder = loose + ? { + build: buildForOfLoose, + helper: "createForOfIteratorHelperLoose", + getContainer: nodes => nodes, + } + : { + build: buildForOf, + helper: "createForOfIteratorHelper", + getContainer: nodes => nodes[1].block.body, + }; + function _ForOfStatementArray(path) { const { node, scope } = path; const right = scope.generateUidIdentifierBasedOnNode(node.right, "arr"); const iterationKey = scope.generateUidIdentifier("i"); - let loop = buildForOfArray({ + const loop = buildForOfArray({ BODY: node.body, KEY: iterationKey, NAME: right, @@ -150,19 +147,7 @@ export default declare((api, options) => { ); } - if (path.parentPath.isLabeledStatement()) { - loop = t.labeledStatement(path.parentPath.node.label, loop); - } - - return [loop]; - } - - function replaceWithArray(path) { - if (path.parentPath.isLabeledStatement()) { - path.parentPath.replaceWithMultiple(_ForOfStatementArray(path)); - } else { - path.replaceWithMultiple(_ForOfStatementArray(path)); - } + return loop; } return { @@ -175,156 +160,64 @@ export default declare((api, options) => { right.isGenericType("Array") || t.isArrayTypeAnnotation(right.getTypeAnnotation()) ) { - replaceWithArray(path); + path.replaceWith(_ForOfStatementArray(path)); return; } - const { node } = path; - const build = pushComputedProps(path, state); - const declar = build.declar; - const loop = build.loop; - const block = loop.body; + if (!state.availableHelper(builder.helper)) { + // Babel <7.9.0 doesn't support this helper + transformWithoutHelper(loose, path, state); + return; + } + + const { node, parent, scope } = path; + const left = node.left; + let declar; + + const stepKey = scope.generateUid("step"); + const stepValue = t.memberExpression( + t.identifier(stepKey), + t.identifier("value"), + ); + + if (t.isVariableDeclaration(left)) { + // for (let i of test) + declar = t.variableDeclaration(left.kind, [ + t.variableDeclarator(left.declarations[0].id, stepValue), + ]); + } else { + // for (i of test), for ({ i } of test) + declar = t.expressionStatement( + t.assignmentExpression("=", left, stepValue), + ); + } // ensure that it's a block so we can take all its statements path.ensureBlock(); - // add the value declaration to the new loop body - if (declar) { - block.body.push(declar); - } + node.body.body.unshift(declar); - // push the rest of the original loop body onto our new body - block.body = block.body.concat(node.body.body); + const nodes = builder.build({ + CREATE_ITERATOR_HELPER: state.addHelper(builder.helper), + ITERATOR_HELPER: scope.generateUidIdentifier("iterator"), + STEP_KEY: t.identifier(stepKey), + OBJECT: node.right, + BODY: node.body, + }); + const container = builder.getContainer(nodes); - t.inherits(loop, node); - t.inherits(loop.body, node.body); + t.inherits(container[0], node); + t.inherits(container[0].body, node.body); - if (build.replaceParent) { - path.parentPath.replaceWithMultiple(build.node); + if (t.isLabeledStatement(parent)) { + container[0] = t.labeledStatement(parent.label, container[0]); + + path.parentPath.replaceWithMultiple(nodes); path.remove(); } else { - path.replaceWithMultiple(build.node); + path.replaceWithMultiple(nodes); } }, }, }; - - function pushComputedPropsLoose(path, file) { - const { node, scope, parent } = path; - const { left } = node; - let declar, id, intermediate; - - if ( - t.isIdentifier(left) || - t.isPattern(left) || - t.isMemberExpression(left) - ) { - // for (i of test), for ({ i } of test) - id = left; - intermediate = null; - } else if (t.isVariableDeclaration(left)) { - // for (let i of test) - id = scope.generateUidIdentifier("ref"); - declar = t.variableDeclaration(left.kind, [ - t.variableDeclarator(left.declarations[0].id, t.identifier(id.name)), - ]); - intermediate = t.variableDeclaration("var", [ - t.variableDeclarator(t.identifier(id.name)), - ]); - } else { - throw file.buildCodeFrameError( - left, - `Unknown node type ${left.type} in ForStatement`, - ); - } - - const iteratorKey = scope.generateUidIdentifier("iterator"); - const isArrayKey = scope.generateUidIdentifier("isArray"); - - const loop = buildForOfLoose({ - LOOP_OBJECT: iteratorKey, - IS_ARRAY: isArrayKey, - OBJECT: node.right, - INDEX: scope.generateUidIdentifier("i"), - ID: id, - INTERMEDIATE: intermediate, - }); - - // - const isLabeledParent = t.isLabeledStatement(parent); - let labeled; - - if (isLabeledParent) { - labeled = t.labeledStatement(parent.label, loop); - } - - return { - replaceParent: isLabeledParent, - declar: declar, - node: labeled || loop, - loop: loop, - }; - } - - function pushComputedPropsSpec(path, file) { - const { node, scope, parent } = path; - const left = node.left; - let declar; - - const stepKey = scope.generateUid("step"); - const stepValue = t.memberExpression( - t.identifier(stepKey), - t.identifier("value"), - ); - - if ( - t.isIdentifier(left) || - t.isPattern(left) || - t.isMemberExpression(left) - ) { - // for (i of test), for ({ i } of test) - declar = t.expressionStatement( - t.assignmentExpression("=", left, stepValue), - ); - } else if (t.isVariableDeclaration(left)) { - // for (let i of test) - declar = t.variableDeclaration(left.kind, [ - t.variableDeclarator(left.declarations[0].id, stepValue), - ]); - } else { - throw file.buildCodeFrameError( - left, - `Unknown node type ${left.type} in ForStatement`, - ); - } - - const template = buildForOf({ - ITERATOR_HAD_ERROR_KEY: scope.generateUidIdentifier("didIteratorError"), - ITERATOR_COMPLETION: scope.generateUidIdentifier( - "iteratorNormalCompletion", - ), - ITERATOR_ERROR_KEY: scope.generateUidIdentifier("iteratorError"), - ITERATOR_KEY: scope.generateUidIdentifier("iterator"), - STEP_KEY: t.identifier(stepKey), - OBJECT: node.right, - }); - - const isLabeledParent = t.isLabeledStatement(parent); - - const tryBody = template[3].block.body; - const loop = tryBody[0]; - - if (isLabeledParent) { - tryBody[0] = t.labeledStatement(parent.label, loop); - } - - // - - return { - replaceParent: isLabeledParent, - declar: declar, - loop: loop, - node: template, - }; - } }); diff --git a/packages/babel-plugin-transform-for-of/src/no-helper-implementation.js b/packages/babel-plugin-transform-for-of/src/no-helper-implementation.js new file mode 100644 index 000000000000..2624f0bc9093 --- /dev/null +++ b/packages/babel-plugin-transform-for-of/src/no-helper-implementation.js @@ -0,0 +1,192 @@ +import { template, types as t } from "@babel/core"; + +// This is the legacy implementation, which inlines all the code. +// It must be kept for compatibility reasons. +// TODO (Babel 8): Remove this code. + +export default function transformWithoutHelper(loose, path, state) { + const pushComputedProps = loose + ? pushComputedPropsLoose + : pushComputedPropsSpec; + + const { node } = path; + const build = pushComputedProps(path, state); + const declar = build.declar; + const loop = build.loop; + const block = loop.body; + + // ensure that it's a block so we can take all its statements + path.ensureBlock(); + + // add the value declaration to the new loop body + if (declar) { + block.body.push(declar); + } + + // push the rest of the original loop body onto our new body + block.body = block.body.concat(node.body.body); + + t.inherits(loop, node); + t.inherits(loop.body, node.body); + + if (build.replaceParent) { + path.parentPath.replaceWithMultiple(build.node); + path.remove(); + } else { + path.replaceWithMultiple(build.node); + } +} + +const buildForOfLoose = template(` + for (var LOOP_OBJECT = OBJECT, + IS_ARRAY = Array.isArray(LOOP_OBJECT), + INDEX = 0, + LOOP_OBJECT = IS_ARRAY ? LOOP_OBJECT : LOOP_OBJECT[Symbol.iterator]();;) { + INTERMEDIATE; + if (IS_ARRAY) { + if (INDEX >= LOOP_OBJECT.length) break; + ID = LOOP_OBJECT[INDEX++]; + } else { + INDEX = LOOP_OBJECT.next(); + if (INDEX.done) break; + ID = INDEX.value; + } + } +`); + +const buildForOf = template(` + var ITERATOR_COMPLETION = true; + var ITERATOR_HAD_ERROR_KEY = false; + var ITERATOR_ERROR_KEY = undefined; + try { + for ( + var ITERATOR_KEY = OBJECT[Symbol.iterator](), STEP_KEY; + !(ITERATOR_COMPLETION = (STEP_KEY = ITERATOR_KEY.next()).done); + ITERATOR_COMPLETION = true + ) {} + } catch (err) { + ITERATOR_HAD_ERROR_KEY = true; + ITERATOR_ERROR_KEY = err; + } finally { + try { + if (!ITERATOR_COMPLETION && ITERATOR_KEY.return != null) { + ITERATOR_KEY.return(); + } + } finally { + if (ITERATOR_HAD_ERROR_KEY) { + throw ITERATOR_ERROR_KEY; + } + } + } +`); + +function pushComputedPropsLoose(path, file) { + const { node, scope, parent } = path; + const { left } = node; + let declar, id, intermediate; + + if (t.isIdentifier(left) || t.isPattern(left) || t.isMemberExpression(left)) { + // for (i of test), for ({ i } of test) + id = left; + intermediate = null; + } else if (t.isVariableDeclaration(left)) { + // for (let i of test) + id = scope.generateUidIdentifier("ref"); + declar = t.variableDeclaration(left.kind, [ + t.variableDeclarator(left.declarations[0].id, t.identifier(id.name)), + ]); + intermediate = t.variableDeclaration("var", [ + t.variableDeclarator(t.identifier(id.name)), + ]); + } else { + throw file.buildCodeFrameError( + left, + `Unknown node type ${left.type} in ForStatement`, + ); + } + + const iteratorKey = scope.generateUidIdentifier("iterator"); + const isArrayKey = scope.generateUidIdentifier("isArray"); + + const loop = buildForOfLoose({ + LOOP_OBJECT: iteratorKey, + IS_ARRAY: isArrayKey, + OBJECT: node.right, + INDEX: scope.generateUidIdentifier("i"), + ID: id, + INTERMEDIATE: intermediate, + }); + + // + const isLabeledParent = t.isLabeledStatement(parent); + let labeled; + + if (isLabeledParent) { + labeled = t.labeledStatement(parent.label, loop); + } + + return { + replaceParent: isLabeledParent, + declar: declar, + node: labeled || loop, + loop: loop, + }; +} + +function pushComputedPropsSpec(path, file) { + const { node, scope, parent } = path; + const left = node.left; + let declar; + + const stepKey = scope.generateUid("step"); + const stepValue = t.memberExpression( + t.identifier(stepKey), + t.identifier("value"), + ); + + if (t.isIdentifier(left) || t.isPattern(left) || t.isMemberExpression(left)) { + // for (i of test), for ({ i } of test) + declar = t.expressionStatement( + t.assignmentExpression("=", left, stepValue), + ); + } else if (t.isVariableDeclaration(left)) { + // for (let i of test) + declar = t.variableDeclaration(left.kind, [ + t.variableDeclarator(left.declarations[0].id, stepValue), + ]); + } else { + throw file.buildCodeFrameError( + left, + `Unknown node type ${left.type} in ForStatement`, + ); + } + + const template = buildForOf({ + ITERATOR_HAD_ERROR_KEY: scope.generateUidIdentifier("didIteratorError"), + ITERATOR_COMPLETION: scope.generateUidIdentifier( + "iteratorNormalCompletion", + ), + ITERATOR_ERROR_KEY: scope.generateUidIdentifier("iteratorError"), + ITERATOR_KEY: scope.generateUidIdentifier("iterator"), + STEP_KEY: t.identifier(stepKey), + OBJECT: node.right, + }); + + const isLabeledParent = t.isLabeledStatement(parent); + + const tryBody = template[3].block.body; + const loop = tryBody[0]; + + if (isLabeledParent) { + tryBody[0] = t.labeledStatement(parent.label, loop); + } + + // + + return { + replaceParent: isLabeledParent, + declar: declar, + loop: loop, + node: template, + }; +} diff --git a/packages/babel-plugin-transform-for-of/test/fixtures/for-of-as-array/for-await-of/input.js b/packages/babel-plugin-transform-for-of/test/fixtures/for-of-as-array/for-await-of/input.js new file mode 100644 index 000000000000..623d204b34cb --- /dev/null +++ b/packages/babel-plugin-transform-for-of/test/fixtures/for-of-as-array/for-await-of/input.js @@ -0,0 +1 @@ +async () => { for await (let foo of []); }; diff --git a/packages/babel-plugin-transform-for-of/test/fixtures/for-of-as-array/for-await-of/output.js b/packages/babel-plugin-transform-for-of/test/fixtures/for-of-as-array/for-await-of/output.js new file mode 100644 index 000000000000..03379d55586f --- /dev/null +++ b/packages/babel-plugin-transform-for-of/test/fixtures/for-of-as-array/for-await-of/output.js @@ -0,0 +1,3 @@ +async () => { + for await (let foo of []); +}; diff --git a/packages/babel-plugin-transform-for-of/test/fixtures/for-of-as-array/for-of-partial-redeclaration-in-body-array-pattern/input.js b/packages/babel-plugin-transform-for-of/test/fixtures/for-of-as-array/for-of-partial-redeclaration-in-body-array-pattern/input.js new file mode 100644 index 000000000000..9c42dd07cf92 --- /dev/null +++ b/packages/babel-plugin-transform-for-of/test/fixtures/for-of-as-array/for-of-partial-redeclaration-in-body-array-pattern/input.js @@ -0,0 +1,5 @@ +for (const [head, ...tail] of array) { + const head = 1; + console.log(tail); + console.log(head); +} diff --git a/packages/babel-plugin-transform-for-of/test/fixtures/for-of-as-array/for-of-partial-redeclaration-in-body-array-pattern/output.js b/packages/babel-plugin-transform-for-of/test/fixtures/for-of-as-array/for-of-partial-redeclaration-in-body-array-pattern/output.js new file mode 100644 index 000000000000..d10f3cea1988 --- /dev/null +++ b/packages/babel-plugin-transform-for-of/test/fixtures/for-of-as-array/for-of-partial-redeclaration-in-body-array-pattern/output.js @@ -0,0 +1,8 @@ +for (let _i = 0, _array = array; _i < _array.length; _i++) { + const [head, ...tail] = _array[_i]; + { + const head = 1; + console.log(tail); + console.log(head); + } +} diff --git a/packages/babel-plugin-transform-for-of/test/fixtures/for-of-as-array/for-of-partial-redeclaration-in-body-object-pattern/input.js b/packages/babel-plugin-transform-for-of/test/fixtures/for-of-as-array/for-of-partial-redeclaration-in-body-object-pattern/input.js new file mode 100644 index 000000000000..5d9d07cdff54 --- /dev/null +++ b/packages/babel-plugin-transform-for-of/test/fixtures/for-of-as-array/for-of-partial-redeclaration-in-body-object-pattern/input.js @@ -0,0 +1,5 @@ +for (const [type, ...rest] of array) { + const type = 1; + console.log(rest); + console.log(type); +} diff --git a/packages/babel-plugin-transform-for-of/test/fixtures/for-of-as-array/for-of-partial-redeclaration-in-body-object-pattern/output.js b/packages/babel-plugin-transform-for-of/test/fixtures/for-of-as-array/for-of-partial-redeclaration-in-body-object-pattern/output.js new file mode 100644 index 000000000000..bca1a961708b --- /dev/null +++ b/packages/babel-plugin-transform-for-of/test/fixtures/for-of-as-array/for-of-partial-redeclaration-in-body-object-pattern/output.js @@ -0,0 +1,8 @@ +for (let _i = 0, _array = array; _i < _array.length; _i++) { + const [type, ...rest] = _array[_i]; + { + const type = 1; + console.log(rest); + console.log(type); + } +} diff --git a/packages/babel-plugin-transform-for-of/test/fixtures/for-of-as-array/for-of-redeclaration-in-body-array-pattern/input.js b/packages/babel-plugin-transform-for-of/test/fixtures/for-of-as-array/for-of-redeclaration-in-body-array-pattern/input.js new file mode 100644 index 000000000000..150e02bcd775 --- /dev/null +++ b/packages/babel-plugin-transform-for-of/test/fixtures/for-of-as-array/for-of-redeclaration-in-body-array-pattern/input.js @@ -0,0 +1,6 @@ +for (const [head, ...tail] of array) { + const head = 1; + let tail; + console.log(tail); + console.log(head); +} diff --git a/packages/babel-plugin-transform-for-of/test/fixtures/for-of-as-array/for-of-redeclaration-in-body-array-pattern/output.js b/packages/babel-plugin-transform-for-of/test/fixtures/for-of-as-array/for-of-redeclaration-in-body-array-pattern/output.js new file mode 100644 index 000000000000..bb103233d714 --- /dev/null +++ b/packages/babel-plugin-transform-for-of/test/fixtures/for-of-as-array/for-of-redeclaration-in-body-array-pattern/output.js @@ -0,0 +1,9 @@ +for (let _i = 0, _array = array; _i < _array.length; _i++) { + const [head, ...tail] = _array[_i]; + { + const head = 1; + let tail; + console.log(tail); + console.log(head); + } +} diff --git a/packages/babel-plugin-transform-for-of/test/fixtures/for-of-as-array/for-of-redeclaration-in-body-object-pattern/input.js b/packages/babel-plugin-transform-for-of/test/fixtures/for-of-as-array/for-of-redeclaration-in-body-object-pattern/input.js new file mode 100644 index 000000000000..756ecda0da25 --- /dev/null +++ b/packages/babel-plugin-transform-for-of/test/fixtures/for-of-as-array/for-of-redeclaration-in-body-object-pattern/input.js @@ -0,0 +1,6 @@ +for (const {type, ...rest} of array) { + const type = 1; + let rest; + console.log(rest); + console.log(type); +} diff --git a/packages/babel-plugin-transform-for-of/test/fixtures/for-of-as-array/for-of-redeclaration-in-body-object-pattern/output.js b/packages/babel-plugin-transform-for-of/test/fixtures/for-of-as-array/for-of-redeclaration-in-body-object-pattern/output.js new file mode 100644 index 000000000000..03a45647d69f --- /dev/null +++ b/packages/babel-plugin-transform-for-of/test/fixtures/for-of-as-array/for-of-redeclaration-in-body-object-pattern/output.js @@ -0,0 +1,12 @@ +for (let _i = 0, _array = array; _i < _array.length; _i++) { + const { + type, + ...rest + } = _array[_i]; + { + const type = 1; + let rest; + console.log(rest); + console.log(type); + } +} diff --git a/packages/babel-plugin-transform-for-of/test/fixtures/for-of-as-array/for-of-redeclaration-in-body/input.js b/packages/babel-plugin-transform-for-of/test/fixtures/for-of-as-array/for-of-redeclaration-in-body/input.js new file mode 100644 index 000000000000..ded052290862 --- /dev/null +++ b/packages/babel-plugin-transform-for-of/test/fixtures/for-of-as-array/for-of-redeclaration-in-body/input.js @@ -0,0 +1,3 @@ +for (const elm of array) { + const elm = 2; +} diff --git a/packages/babel-plugin-transform-for-of/test/fixtures/for-of-as-array/for-of-redeclaration-in-body/output.js b/packages/babel-plugin-transform-for-of/test/fixtures/for-of-as-array/for-of-redeclaration-in-body/output.js new file mode 100644 index 000000000000..f05d069d547d --- /dev/null +++ b/packages/babel-plugin-transform-for-of/test/fixtures/for-of-as-array/for-of-redeclaration-in-body/output.js @@ -0,0 +1,6 @@ +for (let _i = 0, _array = array; _i < _array.length; _i++) { + const elm = _array[_i]; + { + const elm = 2; + } +} diff --git a/packages/babel-plugin-transform-for-of/test/fixtures/for-of-as-array/for-of-redeclare/input.js b/packages/babel-plugin-transform-for-of/test/fixtures/for-of-as-array/for-of-redeclare-iterable/input.js similarity index 100% rename from packages/babel-plugin-transform-for-of/test/fixtures/for-of-as-array/for-of-redeclare/input.js rename to packages/babel-plugin-transform-for-of/test/fixtures/for-of-as-array/for-of-redeclare-iterable/input.js diff --git a/packages/babel-plugin-transform-for-of/test/fixtures/for-of-as-array/for-of-redeclare/output.js b/packages/babel-plugin-transform-for-of/test/fixtures/for-of-as-array/for-of-redeclare-iterable/output.js similarity index 100% rename from packages/babel-plugin-transform-for-of/test/fixtures/for-of-as-array/for-of-redeclare/output.js rename to packages/babel-plugin-transform-for-of/test/fixtures/for-of-as-array/for-of-redeclare-iterable/output.js diff --git a/packages/babel-plugin-transform-for-of/test/fixtures/loose-exec/arguments-symbol-unsupported.js b/packages/babel-plugin-transform-for-of/test/fixtures/loose-exec/arguments-symbol-unsupported.js new file mode 100644 index 000000000000..d8c9899f8d99 --- /dev/null +++ b/packages/babel-plugin-transform-for-of/test/fixtures/loose-exec/arguments-symbol-unsupported.js @@ -0,0 +1,18 @@ +function getArgs() { return arguments; } + +let args = getArgs(1, 2, 3); +let res = []; + +// Simulate old environment +delete args[Symbol.iterator]; +let _Symbol = Symbol; +Symbol = void 0; + +try { + for (let i of args) res.push(i); + + expect(res).toEqual([1, 2, 3]); +} finally { + Symbol = _Symbol; +} + diff --git a/packages/babel-plugin-transform-for-of/test/fixtures/loose-exec/array-break.js b/packages/babel-plugin-transform-for-of/test/fixtures/loose-exec/array-break.js new file mode 100644 index 000000000000..ffa1dbfb4296 --- /dev/null +++ b/packages/babel-plugin-transform-for-of/test/fixtures/loose-exec/array-break.js @@ -0,0 +1,9 @@ +let arr = (() => [1, 2, 3])(); // Disable inference +let res = []; + +for (const x of arr) { + if (x === 2) break; + res.push(x); +} + +expect(res).toEqual([1]); diff --git a/packages/babel-plugin-transform-for-of/test/fixtures/loose-exec/array-continue.js b/packages/babel-plugin-transform-for-of/test/fixtures/loose-exec/array-continue.js new file mode 100644 index 000000000000..d0112f95c4a7 --- /dev/null +++ b/packages/babel-plugin-transform-for-of/test/fixtures/loose-exec/array-continue.js @@ -0,0 +1,9 @@ +let arr = (() => [1, 2, 3])(); // Disable inference +let res = []; + +for (const x of arr) { + if (x === 2) continue; + res.push(x); +} + +expect(res).toEqual([1, 3]); diff --git a/packages/babel-plugin-transform-for-of/test/fixtures/loose-exec/array.js b/packages/babel-plugin-transform-for-of/test/fixtures/loose-exec/array.js new file mode 100644 index 000000000000..7750c2d157a6 --- /dev/null +++ b/packages/babel-plugin-transform-for-of/test/fixtures/loose-exec/array.js @@ -0,0 +1,6 @@ +let arr = (() => [1, 2, 3])(); // Disable inference +let res = []; + +for (const x of arr) res.push(x); + +expect(res).toEqual([1, 2, 3]); diff --git a/packages/babel-plugin-transform-for-of/test/fixtures/loose-exec/generator-break.js b/packages/babel-plugin-transform-for-of/test/fixtures/loose-exec/generator-break.js new file mode 100644 index 000000000000..2509928d098b --- /dev/null +++ b/packages/babel-plugin-transform-for-of/test/fixtures/loose-exec/generator-break.js @@ -0,0 +1,12 @@ +function* f() { + yield 1; yield 2; yield 3; +} + +let res = []; + +for (const x of f()) { + if (x === 2) break; + res.push(x); +} + +expect(res).toEqual([1]); diff --git a/packages/babel-plugin-transform-for-of/test/fixtures/loose-exec/generator-continue.js b/packages/babel-plugin-transform-for-of/test/fixtures/loose-exec/generator-continue.js new file mode 100644 index 000000000000..393a703d19a1 --- /dev/null +++ b/packages/babel-plugin-transform-for-of/test/fixtures/loose-exec/generator-continue.js @@ -0,0 +1,12 @@ +function* f() { + yield 1; yield 2; yield 3; +} + +let res = []; + +for (const x of f()) { + if (x === 2) continue; + res.push(x); +} + +expect(res).toEqual([1, 3]); diff --git a/packages/babel-plugin-transform-for-of/test/fixtures/loose-exec/generator.js b/packages/babel-plugin-transform-for-of/test/fixtures/loose-exec/generator.js new file mode 100644 index 000000000000..988f89a46aec --- /dev/null +++ b/packages/babel-plugin-transform-for-of/test/fixtures/loose-exec/generator.js @@ -0,0 +1,9 @@ +function* f() { + yield 1; yield 2; yield 3; +} + +let res = []; + +for (const x of f()) res.push(x); + +expect(res).toEqual([1, 2, 3]); diff --git a/packages/babel-plugin-transform-for-of/test/fixtures/loose-exec/options.json b/packages/babel-plugin-transform-for-of/test/fixtures/loose-exec/options.json new file mode 100644 index 000000000000..56e88c472f4f --- /dev/null +++ b/packages/babel-plugin-transform-for-of/test/fixtures/loose-exec/options.json @@ -0,0 +1,6 @@ +{ + "plugins": [ + ["transform-for-of", { "loose": true }], + ["external-helpers", { "helperVersion": "7.100.0" }] + ] +} diff --git a/packages/babel-plugin-transform-for-of/test/fixtures/loose/identifier/output.js b/packages/babel-plugin-transform-for-of/test/fixtures/loose/identifier/output.js index 4ce44f50f58c..09cfa4b62184 100644 --- a/packages/babel-plugin-transform-for-of/test/fixtures/loose/identifier/output.js +++ b/packages/babel-plugin-transform-for-of/test/fixtures/loose/identifier/output.js @@ -1,10 +1,3 @@ -for (var _iterator = arr, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) { - if (_isArray) { - if (_i >= _iterator.length) break; - i = _iterator[_i++]; - } else { - _i = _iterator.next(); - if (_i.done) break; - i = _i.value; - } +for (var _iterator = babelHelpers.createForOfIteratorHelperLoose(arr), _step; !(_step = _iterator()).done;) { + i = _step.value; } diff --git a/packages/babel-plugin-transform-for-of/test/fixtures/loose/ignore-cases/output.js b/packages/babel-plugin-transform-for-of/test/fixtures/loose/ignore-cases/output.js index 9c64275021c0..346e9bed2735 100644 --- a/packages/babel-plugin-transform-for-of/test/fixtures/loose/ignore-cases/output.js +++ b/packages/babel-plugin-transform-for-of/test/fixtures/loose/ignore-cases/output.js @@ -1,16 +1,5 @@ -for (var _iterator = foo, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) { - var _ref; - - if (_isArray) { - if (_i >= _iterator.length) break; - _ref = _iterator[_i++]; - } else { - _i = _iterator.next(); - if (_i.done) break; - _ref = _i.value; - } - - var i = _ref; +for (var _iterator = babelHelpers.createForOfIteratorHelperLoose(foo), _step; !(_step = _iterator()).done;) { + var i = _step.value; switch (i) { case 1: diff --git a/packages/babel-plugin-transform-for-of/test/fixtures/loose/let/output.js b/packages/babel-plugin-transform-for-of/test/fixtures/loose/let/output.js index 097ced3ac720..5181b1253590 100644 --- a/packages/babel-plugin-transform-for-of/test/fixtures/loose/let/output.js +++ b/packages/babel-plugin-transform-for-of/test/fixtures/loose/let/output.js @@ -1,14 +1,3 @@ -for (var _iterator = arr, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) { - var _ref; - - if (_isArray) { - if (_i >= _iterator.length) break; - _ref = _iterator[_i++]; - } else { - _i = _iterator.next(); - if (_i.done) break; - _ref = _i.value; - } - - let i = _ref; +for (var _iterator = babelHelpers.createForOfIteratorHelperLoose(arr), _step; !(_step = _iterator()).done;) { + let i = _step.value; } diff --git a/packages/babel-plugin-transform-for-of/test/fixtures/loose/member-expression/output.js b/packages/babel-plugin-transform-for-of/test/fixtures/loose/member-expression/output.js index 4945bb71274f..670a8f952d51 100644 --- a/packages/babel-plugin-transform-for-of/test/fixtures/loose/member-expression/output.js +++ b/packages/babel-plugin-transform-for-of/test/fixtures/loose/member-expression/output.js @@ -1,10 +1,3 @@ -for (var _iterator = arr, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) { - if (_isArray) { - if (_i >= _iterator.length) break; - obj.prop = _iterator[_i++]; - } else { - _i = _iterator.next(); - if (_i.done) break; - obj.prop = _i.value; - } +for (var _iterator = babelHelpers.createForOfIteratorHelperLoose(arr), _step; !(_step = _iterator()).done;) { + obj.prop = _step.value; } diff --git a/packages/babel-plugin-transform-for-of/test/fixtures/loose/multiple/output.js b/packages/babel-plugin-transform-for-of/test/fixtures/loose/multiple/output.js index 985c62fc8563..adc55422e337 100644 --- a/packages/babel-plugin-transform-for-of/test/fixtures/loose/multiple/output.js +++ b/packages/babel-plugin-transform-for-of/test/fixtures/loose/multiple/output.js @@ -1,29 +1,7 @@ -for (var _iterator = arr, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) { - var _ref; - - if (_isArray) { - if (_i >= _iterator.length) break; - _ref = _iterator[_i++]; - } else { - _i = _iterator.next(); - if (_i.done) break; - _ref = _i.value; - } - - var i = _ref; +for (var _iterator = babelHelpers.createForOfIteratorHelperLoose(arr), _step; !(_step = _iterator()).done;) { + var i = _step.value; } -for (var _iterator2 = numbers, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator]();;) { - var _ref2; - - if (_isArray2) { - if (_i2 >= _iterator2.length) break; - _ref2 = _iterator2[_i2++]; - } else { - _i2 = _iterator2.next(); - if (_i2.done) break; - _ref2 = _i2.value; - } - - var i = _ref2; +for (var _iterator2 = babelHelpers.createForOfIteratorHelperLoose(numbers), _step2; !(_step2 = _iterator2()).done;) { + var i = _step2.value; } diff --git a/packages/babel-plugin-transform-for-of/test/fixtures/loose/nested-label-for-of/output.js b/packages/babel-plugin-transform-for-of/test/fixtures/loose/nested-label-for-of/output.js index eb23e78167bd..87e1ddec80f7 100644 --- a/packages/babel-plugin-transform-for-of/test/fixtures/loose/nested-label-for-of/output.js +++ b/packages/babel-plugin-transform-for-of/test/fixtures/loose/nested-label-for-of/output.js @@ -1,30 +1,8 @@ -b: for (var _iterator = d(), _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) { - var _ref; +b: for (var _iterator = babelHelpers.createForOfIteratorHelperLoose(d()), _step; !(_step = _iterator()).done;) { + let c = _step.value; - if (_isArray) { - if (_i >= _iterator.length) break; - _ref = _iterator[_i++]; - } else { - _i = _iterator.next(); - if (_i.done) break; - _ref = _i.value; - } - - let c = _ref; - - for (var _iterator2 = f(), _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator]();;) { - var _ref2; - - if (_isArray2) { - if (_i2 >= _iterator2.length) break; - _ref2 = _iterator2[_i2++]; - } else { - _i2 = _iterator2.next(); - if (_i2.done) break; - _ref2 = _i2.value; - } - - let e = _ref2; + for (var _iterator2 = babelHelpers.createForOfIteratorHelperLoose(f()), _step2; !(_step2 = _iterator2()).done;) { + let e = _step2.value; continue b; } } diff --git a/packages/babel-plugin-transform-for-of/test/fixtures/loose/options.json b/packages/babel-plugin-transform-for-of/test/fixtures/loose/options.json index b180b3b7a8c9..56e88c472f4f 100644 --- a/packages/babel-plugin-transform-for-of/test/fixtures/loose/options.json +++ b/packages/babel-plugin-transform-for-of/test/fixtures/loose/options.json @@ -1,3 +1,6 @@ { - "plugins": [["transform-for-of", { "loose": true }]] + "plugins": [ + ["transform-for-of", { "loose": true }], + ["external-helpers", { "helperVersion": "7.100.0" }] + ] } diff --git a/packages/babel-plugin-transform-for-of/test/fixtures/loose/var/output.js b/packages/babel-plugin-transform-for-of/test/fixtures/loose/var/output.js index 7565d63def0a..c9f297e237ab 100644 --- a/packages/babel-plugin-transform-for-of/test/fixtures/loose/var/output.js +++ b/packages/babel-plugin-transform-for-of/test/fixtures/loose/var/output.js @@ -1,14 +1,3 @@ -for (var _iterator = arr, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) { - var _ref; - - if (_isArray) { - if (_i >= _iterator.length) break; - _ref = _iterator[_i++]; - } else { - _i = _iterator.next(); - if (_i.done) break; - _ref = _i.value; - } - - var i = _ref; +for (var _iterator = babelHelpers.createForOfIteratorHelperLoose(arr), _step; !(_step = _iterator()).done;) { + var i = _step.value; } diff --git a/packages/babel-plugin-transform-for-of/test/fixtures/opt/options.json b/packages/babel-plugin-transform-for-of/test/fixtures/opt/options.json index 5ac45b8e39fe..fab63f43b1f5 100644 --- a/packages/babel-plugin-transform-for-of/test/fixtures/opt/options.json +++ b/packages/babel-plugin-transform-for-of/test/fixtures/opt/options.json @@ -1,3 +1,7 @@ { - "plugins": ["transform-for-of", "transform-flow-strip-types"] + "plugins": [ + "transform-for-of", + "transform-flow-strip-types", + ["external-helpers", { "helperVersion": "7.100.0" }] + ] } diff --git a/packages/babel-plugin-transform-for-of/test/fixtures/opt/typeannotation/output.js b/packages/babel-plugin-transform-for-of/test/fixtures/opt/typeannotation/output.js index 55ebccb8d7db..7b047a5d5517 100644 --- a/packages/babel-plugin-transform-for-of/test/fixtures/opt/typeannotation/output.js +++ b/packages/babel-plugin-transform-for-of/test/fixtures/opt/typeannotation/output.js @@ -3,26 +3,16 @@ for (var _i = 0, _arr = b; _i < _arr.length; _i++) { } function a(b) { - var _iteratorNormalCompletion = true; - var _didIteratorError = false; - var _iteratorError = undefined; + var _iterator = babelHelpers.createForOfIteratorHelper(b), + _step; try { - for (var _iterator = b[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { + for (_iterator.s(); !(_step = _iterator.n()).done;) { const y = _step.value; } } catch (err) { - _didIteratorError = true; - _iteratorError = err; + _iterator.e(err); } finally { - try { - if (!_iteratorNormalCompletion && _iterator.return != null) { - _iterator.return(); - } - } finally { - if (_didIteratorError) { - throw _iteratorError; - } - } + _iterator.f(); } } diff --git a/packages/babel-plugin-transform-for-of/test/fixtures/regression/if-label-3858/output.js b/packages/babel-plugin-transform-for-of/test/fixtures/regression/if-label-3858/output.js index 0085c57dcafa..25a2ca8e2f22 100644 --- a/packages/babel-plugin-transform-for-of/test/fixtures/regression/if-label-3858/output.js +++ b/packages/babel-plugin-transform-for-of/test/fixtures/regression/if-label-3858/output.js @@ -1,5 +1,3 @@ -if (true) { - loop: for (var _i = 0, _arr = []; _i < _arr.length; _i++) { - let ch = _arr[_i]; - } +if (true) loop: for (var _i = 0, _arr = []; _i < _arr.length; _i++) { + let ch = _arr[_i]; } diff --git a/packages/babel-plugin-transform-for-of/test/fixtures/regression/label-object-with-comment-4995/output.js b/packages/babel-plugin-transform-for-of/test/fixtures/regression/label-object-with-comment-4995/output.js index 6350ca6bee63..81e37c25b3a5 100644 --- a/packages/babel-plugin-transform-for-of/test/fixtures/regression/label-object-with-comment-4995/output.js +++ b/packages/babel-plugin-transform-for-of/test/fixtures/regression/label-object-with-comment-4995/output.js @@ -1,24 +1,14 @@ -var _iteratorNormalCompletion = true; -var _didIteratorError = false; -var _iteratorError = undefined; +var _iterator = babelHelpers.createForOfIteratorHelper(b), + _step; try { myLabel: //woops - for (var _iterator = b[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { + for (_iterator.s(); !(_step = _iterator.n()).done;) { let a = _step.value; continue myLabel; } } catch (err) { - _didIteratorError = true; - _iteratorError = err; + _iterator.e(err); } finally { - try { - if (!_iteratorNormalCompletion && _iterator.return != null) { - _iterator.return(); - } - } finally { - if (_didIteratorError) { - throw _iteratorError; - } - } + _iterator.f(); } diff --git a/packages/babel-plugin-transform-for-of/test/fixtures/regression/options.json b/packages/babel-plugin-transform-for-of/test/fixtures/regression/options.json index 9d8c9cc3446e..529e1126a163 100644 --- a/packages/babel-plugin-transform-for-of/test/fixtures/regression/options.json +++ b/packages/babel-plugin-transform-for-of/test/fixtures/regression/options.json @@ -1,3 +1,6 @@ { - "plugins": ["transform-for-of"] + "plugins": [ + "transform-for-of", + ["external-helpers", { "helperVersion": "7.100.0" }] + ] } diff --git a/packages/babel-plugin-transform-for-of/test/fixtures/spec-exec/arguments-symbol-unsupported.js b/packages/babel-plugin-transform-for-of/test/fixtures/spec-exec/arguments-symbol-unsupported.js new file mode 100644 index 000000000000..d8c9899f8d99 --- /dev/null +++ b/packages/babel-plugin-transform-for-of/test/fixtures/spec-exec/arguments-symbol-unsupported.js @@ -0,0 +1,18 @@ +function getArgs() { return arguments; } + +let args = getArgs(1, 2, 3); +let res = []; + +// Simulate old environment +delete args[Symbol.iterator]; +let _Symbol = Symbol; +Symbol = void 0; + +try { + for (let i of args) res.push(i); + + expect(res).toEqual([1, 2, 3]); +} finally { + Symbol = _Symbol; +} + diff --git a/packages/babel-plugin-transform-for-of/test/fixtures/spec-exec/array-break.js b/packages/babel-plugin-transform-for-of/test/fixtures/spec-exec/array-break.js new file mode 100644 index 000000000000..ffa1dbfb4296 --- /dev/null +++ b/packages/babel-plugin-transform-for-of/test/fixtures/spec-exec/array-break.js @@ -0,0 +1,9 @@ +let arr = (() => [1, 2, 3])(); // Disable inference +let res = []; + +for (const x of arr) { + if (x === 2) break; + res.push(x); +} + +expect(res).toEqual([1]); diff --git a/packages/babel-plugin-transform-for-of/test/fixtures/spec-exec/array-continue.js b/packages/babel-plugin-transform-for-of/test/fixtures/spec-exec/array-continue.js new file mode 100644 index 000000000000..d0112f95c4a7 --- /dev/null +++ b/packages/babel-plugin-transform-for-of/test/fixtures/spec-exec/array-continue.js @@ -0,0 +1,9 @@ +let arr = (() => [1, 2, 3])(); // Disable inference +let res = []; + +for (const x of arr) { + if (x === 2) continue; + res.push(x); +} + +expect(res).toEqual([1, 3]); diff --git a/packages/babel-plugin-transform-for-of/test/fixtures/spec-exec/array-symbol-unsupported-throw.js b/packages/babel-plugin-transform-for-of/test/fixtures/spec-exec/array-symbol-unsupported-throw.js new file mode 100644 index 000000000000..d0960352c267 --- /dev/null +++ b/packages/babel-plugin-transform-for-of/test/fixtures/spec-exec/array-symbol-unsupported-throw.js @@ -0,0 +1,23 @@ +var a = (() => [1, 2, 3])(); + +// Simulate old environment +let _Symbol = Symbol; +Symbol = void 0; +try { + let didErr = false, err; + let obj = {}; + + try { + for (let i of a) { + if (i === 2) throw obj; + } + } catch (e) { + didErr = true; + err = e; + } + + expect(didErr).toBe(true); + expect(obj).toBe(err); +} finally { + Symbol = _Symbol; +} diff --git a/packages/babel-plugin-transform-for-of/test/fixtures/spec-exec/array.js b/packages/babel-plugin-transform-for-of/test/fixtures/spec-exec/array.js new file mode 100644 index 000000000000..7750c2d157a6 --- /dev/null +++ b/packages/babel-plugin-transform-for-of/test/fixtures/spec-exec/array.js @@ -0,0 +1,6 @@ +let arr = (() => [1, 2, 3])(); // Disable inference +let res = []; + +for (const x of arr) res.push(x); + +expect(res).toEqual([1, 2, 3]); diff --git a/packages/babel-plugin-transform-for-of/test/fixtures/spec-exec/generator-break.js b/packages/babel-plugin-transform-for-of/test/fixtures/spec-exec/generator-break.js new file mode 100644 index 000000000000..2509928d098b --- /dev/null +++ b/packages/babel-plugin-transform-for-of/test/fixtures/spec-exec/generator-break.js @@ -0,0 +1,12 @@ +function* f() { + yield 1; yield 2; yield 3; +} + +let res = []; + +for (const x of f()) { + if (x === 2) break; + res.push(x); +} + +expect(res).toEqual([1]); diff --git a/packages/babel-plugin-transform-for-of/test/fixtures/spec-exec/generator-continue.js b/packages/babel-plugin-transform-for-of/test/fixtures/spec-exec/generator-continue.js new file mode 100644 index 000000000000..393a703d19a1 --- /dev/null +++ b/packages/babel-plugin-transform-for-of/test/fixtures/spec-exec/generator-continue.js @@ -0,0 +1,12 @@ +function* f() { + yield 1; yield 2; yield 3; +} + +let res = []; + +for (const x of f()) { + if (x === 2) continue; + res.push(x); +} + +expect(res).toEqual([1, 3]); diff --git a/packages/babel-plugin-transform-for-of/test/fixtures/spec-exec/generator.js b/packages/babel-plugin-transform-for-of/test/fixtures/spec-exec/generator.js new file mode 100644 index 000000000000..988f89a46aec --- /dev/null +++ b/packages/babel-plugin-transform-for-of/test/fixtures/spec-exec/generator.js @@ -0,0 +1,9 @@ +function* f() { + yield 1; yield 2; yield 3; +} + +let res = []; + +for (const x of f()) res.push(x); + +expect(res).toEqual([1, 2, 3]); diff --git a/packages/babel-plugin-transform-for-of/test/fixtures/spec-exec/options.json b/packages/babel-plugin-transform-for-of/test/fixtures/spec-exec/options.json new file mode 100644 index 000000000000..4cfffdb34840 --- /dev/null +++ b/packages/babel-plugin-transform-for-of/test/fixtures/spec-exec/options.json @@ -0,0 +1,6 @@ +{ + "plugins": [ + ["transform-for-of", { "loose": false }], + ["external-helpers", { "helperVersion": "7.100.0" }] + ] +} diff --git a/packages/babel-plugin-transform-for-of/test/fixtures/spec-exec/throw-iterator-handling.js b/packages/babel-plugin-transform-for-of/test/fixtures/spec-exec/throw-iterator-handling.js new file mode 100644 index 000000000000..50a5f512137e --- /dev/null +++ b/packages/babel-plugin-transform-for-of/test/fixtures/spec-exec/throw-iterator-handling.js @@ -0,0 +1,35 @@ +let done = false, value = 0; + +// jest.fn isn't available in exec tests +function fn(impl = () => {}) { + function f() { + f.calls++; + return impl(); + } + f.calls = 0; + return f; +} + +const iterator = { + next: fn(() => ({ done, value })), + throw: fn(), + return: fn(() => { throw {} }), +}; + +const obj = { + [Symbol.iterator]: fn(() => iterator), +}; + +const err = new Error(); + +expect(() => { + for (const x of obj) { + value++; + if (value == 2) throw err; + } +}).toThrow(err); + +expect(obj[Symbol.iterator].calls).toBe(1); +expect(iterator.next.calls).toBe(2); +expect(iterator.throw.calls).toBe(0); +expect(iterator.return.calls).toBe(1); diff --git a/packages/babel-plugin-transform-for-of/test/fixtures/spec/identifier/output.js b/packages/babel-plugin-transform-for-of/test/fixtures/spec/identifier/output.js index a8f3a57a580f..e4f502d49422 100644 --- a/packages/babel-plugin-transform-for-of/test/fixtures/spec/identifier/output.js +++ b/packages/babel-plugin-transform-for-of/test/fixtures/spec/identifier/output.js @@ -1,22 +1,12 @@ -var _iteratorNormalCompletion = true; -var _didIteratorError = false; -var _iteratorError = undefined; +var _iterator = babelHelpers.createForOfIteratorHelper(arr), + _step; try { - for (var _iterator = arr[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { + for (_iterator.s(); !(_step = _iterator.n()).done;) { i = _step.value; } } catch (err) { - _didIteratorError = true; - _iteratorError = err; + _iterator.e(err); } finally { - try { - if (!_iteratorNormalCompletion && _iterator.return != null) { - _iterator.return(); - } - } finally { - if (_didIteratorError) { - throw _iteratorError; - } - } + _iterator.f(); } diff --git a/packages/babel-plugin-transform-for-of/test/fixtures/spec/ignore-cases/output.js b/packages/babel-plugin-transform-for-of/test/fixtures/spec/ignore-cases/output.js index 908af15f61c5..0b4feeecf9d9 100644 --- a/packages/babel-plugin-transform-for-of/test/fixtures/spec/ignore-cases/output.js +++ b/packages/babel-plugin-transform-for-of/test/fixtures/spec/ignore-cases/output.js @@ -1,9 +1,8 @@ -var _iteratorNormalCompletion = true; -var _didIteratorError = false; -var _iteratorError = undefined; +var _iterator = babelHelpers.createForOfIteratorHelper(foo), + _step; try { - for (var _iterator = foo[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { + for (_iterator.s(); !(_step = _iterator.n()).done;) { var i = _step.value; switch (i) { @@ -12,16 +11,7 @@ try { } } } catch (err) { - _didIteratorError = true; - _iteratorError = err; + _iterator.e(err); } finally { - try { - if (!_iteratorNormalCompletion && _iterator.return != null) { - _iterator.return(); - } - } finally { - if (_didIteratorError) { - throw _iteratorError; - } - } + _iterator.f(); } diff --git a/packages/babel-plugin-transform-for-of/test/fixtures/spec/let/output.js b/packages/babel-plugin-transform-for-of/test/fixtures/spec/let/output.js index 2dbda90cd964..fd1743ed5d38 100644 --- a/packages/babel-plugin-transform-for-of/test/fixtures/spec/let/output.js +++ b/packages/babel-plugin-transform-for-of/test/fixtures/spec/let/output.js @@ -1,22 +1,12 @@ -var _iteratorNormalCompletion = true; -var _didIteratorError = false; -var _iteratorError = undefined; +var _iterator = babelHelpers.createForOfIteratorHelper(arr), + _step; try { - for (var _iterator = arr[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { + for (_iterator.s(); !(_step = _iterator.n()).done;) { let i = _step.value; } } catch (err) { - _didIteratorError = true; - _iteratorError = err; + _iterator.e(err); } finally { - try { - if (!_iteratorNormalCompletion && _iterator.return != null) { - _iterator.return(); - } - } finally { - if (_didIteratorError) { - throw _iteratorError; - } - } + _iterator.f(); } diff --git a/packages/babel-plugin-transform-for-of/test/fixtures/spec/member-expression/output.js b/packages/babel-plugin-transform-for-of/test/fixtures/spec/member-expression/output.js index ffe31ebc3c10..5707826b647b 100644 --- a/packages/babel-plugin-transform-for-of/test/fixtures/spec/member-expression/output.js +++ b/packages/babel-plugin-transform-for-of/test/fixtures/spec/member-expression/output.js @@ -1,22 +1,12 @@ -var _iteratorNormalCompletion = true; -var _didIteratorError = false; -var _iteratorError = undefined; +var _iterator = babelHelpers.createForOfIteratorHelper(arr), + _step; try { - for (var _iterator = arr[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { + for (_iterator.s(); !(_step = _iterator.n()).done;) { obj.prop = _step.value; } } catch (err) { - _didIteratorError = true; - _iteratorError = err; + _iterator.e(err); } finally { - try { - if (!_iteratorNormalCompletion && _iterator.return != null) { - _iterator.return(); - } - } finally { - if (_didIteratorError) { - throw _iteratorError; - } - } + _iterator.f(); } diff --git a/packages/babel-plugin-transform-for-of/test/fixtures/spec/multiple/output.js b/packages/babel-plugin-transform-for-of/test/fixtures/spec/multiple/output.js index d467fabeb6ff..6f636f1b5743 100644 --- a/packages/babel-plugin-transform-for-of/test/fixtures/spec/multiple/output.js +++ b/packages/babel-plugin-transform-for-of/test/fixtures/spec/multiple/output.js @@ -1,45 +1,25 @@ -var _iteratorNormalCompletion = true; -var _didIteratorError = false; -var _iteratorError = undefined; +var _iterator = babelHelpers.createForOfIteratorHelper(arr), + _step; try { - for (var _iterator = arr[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { + for (_iterator.s(); !(_step = _iterator.n()).done;) { var i = _step.value; } } catch (err) { - _didIteratorError = true; - _iteratorError = err; + _iterator.e(err); } finally { - try { - if (!_iteratorNormalCompletion && _iterator.return != null) { - _iterator.return(); - } - } finally { - if (_didIteratorError) { - throw _iteratorError; - } - } + _iterator.f(); } -var _iteratorNormalCompletion2 = true; -var _didIteratorError2 = false; -var _iteratorError2 = undefined; +var _iterator2 = babelHelpers.createForOfIteratorHelper(numbers), + _step2; try { - for (var _iterator2 = numbers[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) { + for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) { var i = _step2.value; } } catch (err) { - _didIteratorError2 = true; - _iteratorError2 = err; + _iterator2.e(err); } finally { - try { - if (!_iteratorNormalCompletion2 && _iterator2.return != null) { - _iterator2.return(); - } - } finally { - if (_didIteratorError2) { - throw _iteratorError2; - } - } + _iterator2.f(); } diff --git a/packages/babel-plugin-transform-for-of/test/fixtures/spec/nested-label-for-of/output.js b/packages/babel-plugin-transform-for-of/test/fixtures/spec/nested-label-for-of/output.js index 95b8cc547295..2a3ce2b3627e 100644 --- a/packages/babel-plugin-transform-for-of/test/fixtures/spec/nested-label-for-of/output.js +++ b/packages/babel-plugin-transform-for-of/test/fixtures/spec/nested-label-for-of/output.js @@ -1,45 +1,26 @@ -var _iteratorNormalCompletion = true; -var _didIteratorError = false; -var _iteratorError = undefined; +var _iterator = babelHelpers.createForOfIteratorHelper(d()), + _step; try { - b: for (var _iterator = d()[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { + b: for (_iterator.s(); !(_step = _iterator.n()).done;) { let c = _step.value; - var _iteratorNormalCompletion2 = true; - var _didIteratorError2 = false; - var _iteratorError2 = undefined; + + var _iterator2 = babelHelpers.createForOfIteratorHelper(f()), + _step2; try { - for (var _iterator2 = f()[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) { + for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) { let e = _step2.value; continue b; } } catch (err) { - _didIteratorError2 = true; - _iteratorError2 = err; + _iterator2.e(err); } finally { - try { - if (!_iteratorNormalCompletion2 && _iterator2.return != null) { - _iterator2.return(); - } - } finally { - if (_didIteratorError2) { - throw _iteratorError2; - } - } + _iterator2.f(); } } } catch (err) { - _didIteratorError = true; - _iteratorError = err; + _iterator.e(err); } finally { - try { - if (!_iteratorNormalCompletion && _iterator.return != null) { - _iterator.return(); - } - } finally { - if (_didIteratorError) { - throw _iteratorError; - } - } + _iterator.f(); } diff --git a/packages/babel-plugin-transform-for-of/test/fixtures/spec/options.json b/packages/babel-plugin-transform-for-of/test/fixtures/spec/options.json index 9d8c9cc3446e..3e99d8381d2b 100644 --- a/packages/babel-plugin-transform-for-of/test/fixtures/spec/options.json +++ b/packages/babel-plugin-transform-for-of/test/fixtures/spec/options.json @@ -1,3 +1,6 @@ { - "plugins": ["transform-for-of"] + "plugins": [ + "transform-for-of", + ["external-helpers", { "helperVersion": "7.100.0" }] + ] } diff --git a/packages/babel-plugin-transform-for-of/test/fixtures/spec/var/output.js b/packages/babel-plugin-transform-for-of/test/fixtures/spec/var/output.js index ec97a710aed5..941432518de7 100644 --- a/packages/babel-plugin-transform-for-of/test/fixtures/spec/var/output.js +++ b/packages/babel-plugin-transform-for-of/test/fixtures/spec/var/output.js @@ -1,22 +1,12 @@ -var _iteratorNormalCompletion = true; -var _didIteratorError = false; -var _iteratorError = undefined; +var _iterator = babelHelpers.createForOfIteratorHelper(arr), + _step; try { - for (var _iterator = arr[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { + for (_iterator.s(); !(_step = _iterator.n()).done;) { var i = _step.value; } } catch (err) { - _didIteratorError = true; - _iteratorError = err; + _iterator.e(err); } finally { - try { - if (!_iteratorNormalCompletion && _iterator.return != null) { - _iterator.return(); - } - } finally { - if (_didIteratorError) { - throw _iteratorError; - } - } + _iterator.f(); } diff --git a/packages/babel-plugin-transform-function-name/package.json b/packages/babel-plugin-transform-function-name/package.json index 2a03ae1b21ac..913d13885fc1 100644 --- a/packages/babel-plugin-transform-function-name/package.json +++ b/packages/babel-plugin-transform-function-name/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-transform-function-name", - "version": "7.4.4", + "version": "7.8.3", "description": "Apply ES2015 function.name semantics to all functions", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-function-name", "license": "MIT", @@ -12,14 +12,14 @@ "babel-plugin" ], "dependencies": { - "@babel/helper-function-name": "^7.1.0", - "@babel/helper-plugin-utils": "^7.0.0" + "@babel/helper-function-name": "^7.8.3", + "@babel/helper-plugin-utils": "^7.8.3" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.4.4", - "@babel/helper-plugin-test-runner": "^7.0.0" + "@babel/core": "^7.8.3", + "@babel/helper-plugin-test-runner": "^7.8.3" } } diff --git a/packages/babel-plugin-transform-function-name/test/fixtures/function-name/class-method/output.js b/packages/babel-plugin-transform-function-name/test/fixtures/function-name/class-method/output.js index 80ef49fb816b..d1f53ffe9ecb 100644 --- a/packages/babel-plugin-transform-function-name/test/fixtures/function-name/class-method/output.js +++ b/packages/babel-plugin-transform-function-name/test/fixtures/function-name/class-method/output.js @@ -1,6 +1,4 @@ -let Foo = -/*#__PURE__*/ -function () { +let Foo = /*#__PURE__*/function () { "use strict"; function Foo() { diff --git a/packages/babel-plugin-transform-function-name/test/fixtures/function-name/export-default-arrow-renaming-3/output.js b/packages/babel-plugin-transform-function-name/test/fixtures/function-name/export-default-arrow-renaming-3/output.js index d408ec5652ca..4bfd9a85b302 100644 --- a/packages/babel-plugin-transform-function-name/test/fixtures/function-name/export-default-arrow-renaming-3/output.js +++ b/packages/babel-plugin-transform-function-name/test/fixtures/function-name/export-default-arrow-renaming-3/output.js @@ -7,7 +7,7 @@ exports["default"] = void 0; var _default = function _default(_ref) { var _onClick = _ref.onClick; - return React.createElement("div", { + return /*#__PURE__*/React.createElement("div", { onClick: function onClick() { return _onClick(); } diff --git a/packages/babel-plugin-transform-function-name/test/fixtures/function-name/export-default-arrow-renaming-module-umd/output.js b/packages/babel-plugin-transform-function-name/test/fixtures/function-name/export-default-arrow-renaming-module-umd/output.js index 318c2544cd52..cd8510701baf 100644 --- a/packages/babel-plugin-transform-function-name/test/fixtures/function-name/export-default-arrow-renaming-module-umd/output.js +++ b/packages/babel-plugin-transform-function-name/test/fixtures/function-name/export-default-arrow-renaming-module-umd/output.js @@ -10,7 +10,7 @@ factory(mod.exports); global.input = mod.exports; } -})(this, function (_exports) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports) { "use strict"; Object.defineProperty(_exports, "__esModule", { diff --git a/packages/babel-plugin-transform-function-name/test/fixtures/function-name/function-assignment/input.js b/packages/babel-plugin-transform-function-name/test/fixtures/function-name/function-assignment/input.js index e8efb0c87a4e..3725d0fe7260 100644 --- a/packages/babel-plugin-transform-function-name/test/fixtures/function-name/function-assignment/input.js +++ b/packages/babel-plugin-transform-function-name/test/fixtures/function-name/function-assignment/input.js @@ -11,3 +11,5 @@ baz = 12; bar = function() { bar(); }; + +qux += function() {} diff --git a/packages/babel-plugin-transform-function-name/test/fixtures/function-name/function-assignment/output.js b/packages/babel-plugin-transform-function-name/test/fixtures/function-name/function-assignment/output.js index d0313b653d93..8527bf833e5b 100644 --- a/packages/babel-plugin-transform-function-name/test/fixtures/function-name/function-assignment/output.js +++ b/packages/babel-plugin-transform-function-name/test/fixtures/function-name/function-assignment/output.js @@ -23,3 +23,5 @@ bar = function (_bar) { }(function () { bar(); }); + +qux += function () {}; diff --git a/packages/babel-plugin-transform-function-name/test/fixtures/function-name/modules-2/output.js b/packages/babel-plugin-transform-function-name/test/fixtures/function-name/modules-2/output.js index 863ef1dec5b3..e93ccaf15946 100644 --- a/packages/babel-plugin-transform-function-name/test/fixtures/function-name/modules-2/output.js +++ b/packages/babel-plugin-transform-function-name/test/fixtures/function-name/modules-2/output.js @@ -7,9 +7,7 @@ exports.default = void 0; var _last2 = babelHelpers.interopRequireDefault(require("lodash/last")); -let Container = -/*#__PURE__*/ -function () { +let Container = /*#__PURE__*/function () { function Container() { babelHelpers.classCallCheck(this, Container); } diff --git a/packages/babel-plugin-transform-function-name/test/fixtures/function-name/modules-3/output.js b/packages/babel-plugin-transform-function-name/test/fixtures/function-name/modules-3/output.js index 79a6de9fc32f..5926deeecfcf 100644 --- a/packages/babel-plugin-transform-function-name/test/fixtures/function-name/modules-3/output.js +++ b/packages/babel-plugin-transform-function-name/test/fixtures/function-name/modules-3/output.js @@ -7,14 +7,18 @@ exports.default = void 0; var _store = require("./store"); -let Login = -/*#__PURE__*/ -function (_React$Component) { +function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function () { var Super = babelHelpers.getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = babelHelpers.getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return babelHelpers.possibleConstructorReturn(this, result); }; } + +function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } + +let Login = /*#__PURE__*/function (_React$Component) { babelHelpers.inherits(Login, _React$Component); + var _super = _createSuper(Login); + function Login() { babelHelpers.classCallCheck(this, Login); - return babelHelpers.possibleConstructorReturn(this, babelHelpers.getPrototypeOf(Login).apply(this, arguments)); + return _super.apply(this, arguments); } babelHelpers.createClass(Login, [{ diff --git a/packages/babel-plugin-transform-function-name/test/fixtures/function-name/modules/output.js b/packages/babel-plugin-transform-function-name/test/fixtures/function-name/modules/output.js index 43ca96ddf4e1..690a135242a0 100644 --- a/packages/babel-plugin-transform-function-name/test/fixtures/function-name/modules/output.js +++ b/packages/babel-plugin-transform-function-name/test/fixtures/function-name/modules/output.js @@ -2,9 +2,7 @@ var _events2 = babelHelpers.interopRequireDefault(require("events")); -let Template = -/*#__PURE__*/ -function () { +let Template = /*#__PURE__*/function () { function Template() { babelHelpers.classCallCheck(this, Template); } diff --git a/packages/babel-plugin-transform-instanceof/package.json b/packages/babel-plugin-transform-instanceof/package.json index 323984f68c50..9bd553ed59e0 100644 --- a/packages/babel-plugin-transform-instanceof/package.json +++ b/packages/babel-plugin-transform-instanceof/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-transform-instanceof", - "version": "7.5.5", + "version": "7.8.3", "description": "This plugin transforms all the ES2015 'instanceof' methods", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-instanceof", "license": "MIT", @@ -12,13 +12,13 @@ "babel-plugin" ], "dependencies": { - "@babel/helper-plugin-utils": "^7.0.0" + "@babel/helper-plugin-utils": "^7.8.3" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.5.5", - "@babel/helper-plugin-test-runner": "^7.0.0" + "@babel/core": "^7.8.3", + "@babel/helper-plugin-test-runner": "^7.8.3" } } diff --git a/packages/babel-plugin-transform-jscript/package.json b/packages/babel-plugin-transform-jscript/package.json index 81bbf34e52c0..bc9ab280489e 100644 --- a/packages/babel-plugin-transform-jscript/package.json +++ b/packages/babel-plugin-transform-jscript/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-transform-jscript", - "version": "7.2.0", + "version": "7.8.3", "description": "Babel plugin to fix buggy JScript named function expressions", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-jscript", "license": "MIT", @@ -12,13 +12,13 @@ "babel-plugin" ], "dependencies": { - "@babel/helper-plugin-utils": "^7.0.0" + "@babel/helper-plugin-utils": "^7.8.3" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.2.0", - "@babel/helper-plugin-test-runner": "^7.0.0" + "@babel/core": "^7.8.3", + "@babel/helper-plugin-test-runner": "^7.8.3" } } diff --git a/packages/babel-plugin-transform-literals/README.md b/packages/babel-plugin-transform-literals/README.md index a226d23421d3..0f9723063c63 100644 --- a/packages/babel-plugin-transform-literals/README.md +++ b/packages/babel-plugin-transform-literals/README.md @@ -1,6 +1,6 @@ # @babel/plugin-transform-literals -> Compile ES2015 unicode string and number literals to ES5 +> Compile ES2015 Unicode string and number literals to ES5 See our website [@babel/plugin-transform-literals](https://babeljs.io/docs/en/next/babel-plugin-transform-literals.html) for more information. diff --git a/packages/babel-plugin-transform-literals/package.json b/packages/babel-plugin-transform-literals/package.json index 5f171fa2f0e8..c19719cc927d 100644 --- a/packages/babel-plugin-transform-literals/package.json +++ b/packages/babel-plugin-transform-literals/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-transform-literals", - "version": "7.2.0", + "version": "7.8.3", "description": "Compile ES2015 unicode string and number literals to ES5", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-literals", "license": "MIT", @@ -12,13 +12,13 @@ "babel-plugin" ], "dependencies": { - "@babel/helper-plugin-utils": "^7.0.0" + "@babel/helper-plugin-utils": "^7.8.3" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.2.0", - "@babel/helper-plugin-test-runner": "^7.0.0" + "@babel/core": "^7.8.3", + "@babel/helper-plugin-test-runner": "^7.8.3" } } diff --git a/packages/babel-plugin-transform-member-expression-literals/package.json b/packages/babel-plugin-transform-member-expression-literals/package.json index 58e267904e81..9d849a51b3e8 100644 --- a/packages/babel-plugin-transform-member-expression-literals/package.json +++ b/packages/babel-plugin-transform-member-expression-literals/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-transform-member-expression-literals", - "version": "7.2.0", + "version": "7.8.3", "description": "Ensure that reserved words are quoted in property accesses", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-member-expression-literals", "license": "MIT", @@ -12,13 +12,13 @@ "babel-plugin" ], "dependencies": { - "@babel/helper-plugin-utils": "^7.0.0" + "@babel/helper-plugin-utils": "^7.8.3" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.2.0", - "@babel/helper-plugin-test-runner": "^7.0.0" + "@babel/core": "^7.8.3", + "@babel/helper-plugin-test-runner": "^7.8.3" } } diff --git a/packages/babel-plugin-transform-modules-amd/package.json b/packages/babel-plugin-transform-modules-amd/package.json index fd87e33c074a..4ee38b207901 100644 --- a/packages/babel-plugin-transform-modules-amd/package.json +++ b/packages/babel-plugin-transform-modules-amd/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-transform-modules-amd", - "version": "7.5.0", + "version": "7.9.0", "description": "This plugin transforms ES2015 modules to AMD", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-modules-amd", "license": "MIT", @@ -9,9 +9,9 @@ }, "main": "lib/index.js", "dependencies": { - "@babel/helper-module-transforms": "^7.1.0", - "@babel/helper-plugin-utils": "^7.0.0", - "babel-plugin-dynamic-import-node": "^2.3.0" + "@babel/helper-module-transforms": "^7.9.0", + "@babel/helper-plugin-utils": "^7.8.3", + "babel-plugin-dynamic-import-node": "^2.3.3" }, "keywords": [ "babel-plugin" @@ -20,7 +20,7 @@ "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.5.0", - "@babel/helper-plugin-test-runner": "^7.0.0" + "@babel/core": "^7.9.0", + "@babel/helper-plugin-test-runner": "^7.8.3" } } diff --git a/packages/babel-plugin-transform-modules-amd/src/index.js b/packages/babel-plugin-transform-modules-amd/src/index.js index 5ad9cd9861a3..b69d8025be5d 100644 --- a/packages/babel-plugin-transform-modules-amd/src/index.js +++ b/packages/babel-plugin-transform-modules-amd/src/index.js @@ -7,6 +7,7 @@ import { buildNamespaceInitStatements, ensureStatementsHoisted, wrapInterop, + getModuleName, } from "@babel/helper-module-transforms"; import { template, types as t } from "@babel/core"; import { getImportSource } from "babel-plugin-dynamic-import-node/utils"; @@ -96,7 +97,7 @@ export default declare((api, options) => { importNames.push(requireId); } - let moduleName = this.getModuleName(); + let moduleName = getModuleName(this.file.opts, options); if (moduleName) moduleName = t.stringLiteral(moduleName); const { meta, headers } = rewriteModuleStatementsAndPrepareHeader( diff --git a/packages/babel-plugin-transform-modules-amd/test/fixtures/amd/get-module-name-option-compat/input.js b/packages/babel-plugin-transform-modules-amd/test/fixtures/amd/get-module-name-option-compat/input.js new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/packages/babel-plugin-transform-modules-amd/test/fixtures/amd/get-module-name-option-compat/options.json b/packages/babel-plugin-transform-modules-amd/test/fixtures/amd/get-module-name-option-compat/options.json new file mode 100644 index 000000000000..ef11b00e2ba2 --- /dev/null +++ b/packages/babel-plugin-transform-modules-amd/test/fixtures/amd/get-module-name-option-compat/options.json @@ -0,0 +1,5 @@ +{ + "sourceType": "module", + "moduleIds": true, + "moduleId": "my custom module name" +} diff --git a/packages/babel-plugin-transform-modules-amd/test/fixtures/amd/get-module-name-option-compat/output.js b/packages/babel-plugin-transform-modules-amd/test/fixtures/amd/get-module-name-option-compat/output.js new file mode 100644 index 000000000000..f1f858900a21 --- /dev/null +++ b/packages/babel-plugin-transform-modules-amd/test/fixtures/amd/get-module-name-option-compat/output.js @@ -0,0 +1,3 @@ +define("my custom module name", [], function () { + "use strict"; +}); diff --git a/packages/babel-plugin-transform-modules-amd/test/fixtures/amd/get-module-name-option/options.json b/packages/babel-plugin-transform-modules-amd/test/fixtures/amd/get-module-name-option/options.json index ef11b00e2ba2..c4146535aa91 100644 --- a/packages/babel-plugin-transform-modules-amd/test/fixtures/amd/get-module-name-option/options.json +++ b/packages/babel-plugin-transform-modules-amd/test/fixtures/amd/get-module-name-option/options.json @@ -1,5 +1,10 @@ { "sourceType": "module", - "moduleIds": true, - "moduleId": "my custom module name" + "plugins": [ + "external-helpers", + ["transform-modules-amd", { + "moduleIds": true, + "moduleId": "my custom module name" + }] + ] } diff --git a/packages/babel-plugin-transform-modules-amd/test/fixtures/amd/module-name-compat/input.js b/packages/babel-plugin-transform-modules-amd/test/fixtures/amd/module-name-compat/input.js new file mode 100644 index 000000000000..f3b473756e59 --- /dev/null +++ b/packages/babel-plugin-transform-modules-amd/test/fixtures/amd/module-name-compat/input.js @@ -0,0 +1 @@ +foobar(); diff --git a/packages/babel-plugin-transform-modules-amd/test/fixtures/amd/module-name-compat/options.json b/packages/babel-plugin-transform-modules-amd/test/fixtures/amd/module-name-compat/options.json new file mode 100644 index 000000000000..5b0398abbe6f --- /dev/null +++ b/packages/babel-plugin-transform-modules-amd/test/fixtures/amd/module-name-compat/options.json @@ -0,0 +1,4 @@ +{ + "sourceType": "module", + "moduleIds": true +} diff --git a/packages/babel-plugin-transform-modules-amd/test/fixtures/amd/module-name-compat/output.js b/packages/babel-plugin-transform-modules-amd/test/fixtures/amd/module-name-compat/output.js new file mode 100644 index 000000000000..73ae58b80e38 --- /dev/null +++ b/packages/babel-plugin-transform-modules-amd/test/fixtures/amd/module-name-compat/output.js @@ -0,0 +1,5 @@ +define("amd/module-name-compat/input", [], function () { + "use strict"; + + foobar(); +}); diff --git a/packages/babel-plugin-transform-modules-amd/test/fixtures/amd/module-name/options.json b/packages/babel-plugin-transform-modules-amd/test/fixtures/amd/module-name/options.json index 5b0398abbe6f..6aab7e2d4ba8 100644 --- a/packages/babel-plugin-transform-modules-amd/test/fixtures/amd/module-name/options.json +++ b/packages/babel-plugin-transform-modules-amd/test/fixtures/amd/module-name/options.json @@ -1,4 +1,7 @@ { "sourceType": "module", - "moduleIds": true + "plugins": [ + "external-helpers", + ["transform-modules-amd", { "moduleIds": true }] + ] } diff --git a/packages/babel-plugin-transform-modules-amd/test/fixtures/loose/get-module-name-option-compat/input.js b/packages/babel-plugin-transform-modules-amd/test/fixtures/loose/get-module-name-option-compat/input.js new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/packages/babel-plugin-transform-modules-amd/test/fixtures/loose/get-module-name-option-compat/options.json b/packages/babel-plugin-transform-modules-amd/test/fixtures/loose/get-module-name-option-compat/options.json new file mode 100644 index 000000000000..918617aab900 --- /dev/null +++ b/packages/babel-plugin-transform-modules-amd/test/fixtures/loose/get-module-name-option-compat/options.json @@ -0,0 +1,6 @@ +{ + "sourceType": "module", + "moduleIds": true, + "moduleId": "my custom module name", + "plugins": ["external-helpers", ["transform-modules-amd", { "loose": true }]] +} diff --git a/packages/babel-plugin-transform-modules-amd/test/fixtures/loose/get-module-name-option-compat/output.js b/packages/babel-plugin-transform-modules-amd/test/fixtures/loose/get-module-name-option-compat/output.js new file mode 100644 index 000000000000..f1f858900a21 --- /dev/null +++ b/packages/babel-plugin-transform-modules-amd/test/fixtures/loose/get-module-name-option-compat/output.js @@ -0,0 +1,3 @@ +define("my custom module name", [], function () { + "use strict"; +}); diff --git a/packages/babel-plugin-transform-modules-amd/test/fixtures/loose/get-module-name-option/options.json b/packages/babel-plugin-transform-modules-amd/test/fixtures/loose/get-module-name-option/options.json index 918617aab900..119cb21bfbe5 100644 --- a/packages/babel-plugin-transform-modules-amd/test/fixtures/loose/get-module-name-option/options.json +++ b/packages/babel-plugin-transform-modules-amd/test/fixtures/loose/get-module-name-option/options.json @@ -1,6 +1,11 @@ { "sourceType": "module", - "moduleIds": true, - "moduleId": "my custom module name", - "plugins": ["external-helpers", ["transform-modules-amd", { "loose": true }]] + "plugins": [ + "external-helpers", + ["transform-modules-amd", { + "loose": true, + "moduleIds": true, + "moduleId": "my custom module name" + }] + ] } diff --git a/packages/babel-plugin-transform-modules-amd/test/fixtures/loose/module-name-compat/input.js b/packages/babel-plugin-transform-modules-amd/test/fixtures/loose/module-name-compat/input.js new file mode 100644 index 000000000000..f3b473756e59 --- /dev/null +++ b/packages/babel-plugin-transform-modules-amd/test/fixtures/loose/module-name-compat/input.js @@ -0,0 +1 @@ +foobar(); diff --git a/packages/babel-plugin-transform-modules-amd/test/fixtures/loose/module-name-compat/options.json b/packages/babel-plugin-transform-modules-amd/test/fixtures/loose/module-name-compat/options.json new file mode 100644 index 000000000000..c231826eafff --- /dev/null +++ b/packages/babel-plugin-transform-modules-amd/test/fixtures/loose/module-name-compat/options.json @@ -0,0 +1,5 @@ +{ + "sourceType": "module", + "moduleIds": true, + "plugins": ["external-helpers", ["transform-modules-amd", { "loose": true }]] +} diff --git a/packages/babel-plugin-transform-modules-amd/test/fixtures/loose/module-name-compat/output.js b/packages/babel-plugin-transform-modules-amd/test/fixtures/loose/module-name-compat/output.js new file mode 100644 index 000000000000..dade0a07e66d --- /dev/null +++ b/packages/babel-plugin-transform-modules-amd/test/fixtures/loose/module-name-compat/output.js @@ -0,0 +1,5 @@ +define("loose/module-name-compat/input", [], function () { + "use strict"; + + foobar(); +}); diff --git a/packages/babel-plugin-transform-modules-amd/test/fixtures/loose/module-name/options.json b/packages/babel-plugin-transform-modules-amd/test/fixtures/loose/module-name/options.json index c231826eafff..cc6c05b5fd6c 100644 --- a/packages/babel-plugin-transform-modules-amd/test/fixtures/loose/module-name/options.json +++ b/packages/babel-plugin-transform-modules-amd/test/fixtures/loose/module-name/options.json @@ -1,5 +1,10 @@ { "sourceType": "module", - "moduleIds": true, - "plugins": ["external-helpers", ["transform-modules-amd", { "loose": true }]] + "plugins": [ + "external-helpers", + ["transform-modules-amd", { + "loose": true, + "moduleIds": true + }] + ] } diff --git a/packages/babel-plugin-transform-modules-amd/test/fixtures/regression/9346/input.mjs b/packages/babel-plugin-transform-modules-amd/test/fixtures/regression/9346/input.mjs new file mode 100644 index 000000000000..a662778eac25 --- /dev/null +++ b/packages/babel-plugin-transform-modules-amd/test/fixtures/regression/9346/input.mjs @@ -0,0 +1,4 @@ +export function bug() {} +{ + let bug = 2; +} diff --git a/packages/babel-plugin-transform-modules-amd/test/fixtures/regression/9346/options.json b/packages/babel-plugin-transform-modules-amd/test/fixtures/regression/9346/options.json new file mode 100644 index 000000000000..8cbc099aab70 --- /dev/null +++ b/packages/babel-plugin-transform-modules-amd/test/fixtures/regression/9346/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["transform-modules-amd"] +} diff --git a/packages/babel-plugin-transform-modules-amd/test/fixtures/regression/9346/output.js b/packages/babel-plugin-transform-modules-amd/test/fixtures/regression/9346/output.js new file mode 100644 index 000000000000..f76724189f9f --- /dev/null +++ b/packages/babel-plugin-transform-modules-amd/test/fixtures/regression/9346/output.js @@ -0,0 +1,14 @@ +define(["exports"], function (_exports) { + "use strict"; + + Object.defineProperty(_exports, "__esModule", { + value: true + }); + _exports.bug = bug; + + function bug() {} + + { + let bug = 2; + } +}); diff --git a/packages/babel-plugin-transform-modules-commonjs/package.json b/packages/babel-plugin-transform-modules-commonjs/package.json index 00a0df0c6201..632dea3faab0 100644 --- a/packages/babel-plugin-transform-modules-commonjs/package.json +++ b/packages/babel-plugin-transform-modules-commonjs/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-transform-modules-commonjs", - "version": "7.5.0", + "version": "7.9.0", "description": "This plugin transforms ES2015 modules to CommonJS", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-modules-commonjs", "license": "MIT", @@ -9,10 +9,10 @@ }, "main": "lib/index.js", "dependencies": { - "@babel/helper-module-transforms": "^7.4.4", - "@babel/helper-plugin-utils": "^7.0.0", - "@babel/helper-simple-access": "^7.1.0", - "babel-plugin-dynamic-import-node": "^2.3.0" + "@babel/helper-module-transforms": "^7.9.0", + "@babel/helper-plugin-utils": "^7.8.3", + "@babel/helper-simple-access": "^7.8.3", + "babel-plugin-dynamic-import-node": "^2.3.3" }, "keywords": [ "babel-plugin" @@ -21,8 +21,8 @@ "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.5.0", - "@babel/helper-plugin-test-runner": "^7.0.0", - "@babel/plugin-syntax-object-rest-spread": "^7.2.0" + "@babel/core": "^7.9.0", + "@babel/helper-plugin-test-runner": "^7.8.3", + "@babel/plugin-syntax-object-rest-spread": "^7.8.0" } } diff --git a/packages/babel-plugin-transform-modules-commonjs/src/index.js b/packages/babel-plugin-transform-modules-commonjs/src/index.js index 11d4617f4398..de9274d890f7 100644 --- a/packages/babel-plugin-transform-modules-commonjs/src/index.js +++ b/packages/babel-plugin-transform-modules-commonjs/src/index.js @@ -6,6 +6,7 @@ import { buildNamespaceInitStatements, ensureStatementsHoisted, wrapInterop, + getModuleName, } from "@babel/helper-module-transforms"; import simplifyAccess from "@babel/helper-simple-access"; import { template, types as t } from "@babel/core"; @@ -161,7 +162,7 @@ export default declare((api, options) => { }); } - let moduleName = this.getModuleName(); + let moduleName = getModuleName(this.file.opts, options); if (moduleName) moduleName = t.stringLiteral(moduleName); const { meta, headers } = rewriteModuleStatementsAndPrepareHeader( diff --git a/packages/babel-plugin-transform-modules-commonjs/test/fixtures/class-properties/options.json b/packages/babel-plugin-transform-modules-commonjs/test/fixtures/class-properties/options.json index cfb4f002f46a..4aaaa6971f9e 100644 --- a/packages/babel-plugin-transform-modules-commonjs/test/fixtures/class-properties/options.json +++ b/packages/babel-plugin-transform-modules-commonjs/test/fixtures/class-properties/options.json @@ -1,6 +1,10 @@ { "parserOpts": { - "plugins": ["classProperties", "classPrivateProperties", "classPrivateMethods"] + "plugins": [ + "classProperties", + "classPrivateProperties", + "classPrivateMethods" + ] }, "plugins": ["transform-modules-commonjs"] } diff --git a/packages/babel-plugin-transform-modules-commonjs/test/fixtures/misc/copy-getters-setters-star/output.js b/packages/babel-plugin-transform-modules-commonjs/test/fixtures/misc/copy-getters-setters-star/output.js index 71696cd623e0..015566b41f7a 100644 --- a/packages/babel-plugin-transform-modules-commonjs/test/fixtures/misc/copy-getters-setters-star/output.js +++ b/packages/babel-plugin-transform-modules-commonjs/test/fixtures/misc/copy-getters-setters-star/output.js @@ -9,4 +9,6 @@ var foo = _interopRequireWildcard(require("./moduleWithGetter")); exports.foo = foo; -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } } +function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; } + +function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } diff --git a/packages/babel-plugin-transform-modules-commonjs/test/fixtures/misc/for-of-in-export/input.mjs b/packages/babel-plugin-transform-modules-commonjs/test/fixtures/misc/for-of-in-export/input.mjs new file mode 100644 index 000000000000..fe09208eea2c --- /dev/null +++ b/packages/babel-plugin-transform-modules-commonjs/test/fixtures/misc/for-of-in-export/input.mjs @@ -0,0 +1,22 @@ +export let foo; +export {foo as bar} + +for (foo of []) {} +for (foo in []) {} +for (foo of []) { + let foo; +} +for ({foo} of []) {} +for ({foo} of []) { + let foo; +} +for ({test: {foo}} of []) {} +for ([foo, [...foo]] of []) {} +for ([foo, [...foo]] of []) { + let foo; +} + +{ + let foo; + for(foo of []) {} +} \ No newline at end of file diff --git a/packages/babel-plugin-transform-modules-commonjs/test/fixtures/misc/for-of-in-export/output.js b/packages/babel-plugin-transform-modules-commonjs/test/fixtures/misc/for-of-in-export/output.js new file mode 100644 index 000000000000..bb8330350160 --- /dev/null +++ b/packages/babel-plugin-transform-modules-commonjs/test/fixtures/misc/for-of-in-export/output.js @@ -0,0 +1,65 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.bar = exports.foo = void 0; +let foo; +exports.bar = exports.foo = foo; + +for (let _foo of []) { + exports.bar = exports.foo = foo = _foo; +} + +for (let _foo2 in []) { + exports.bar = exports.foo = foo = _foo2; +} + +for (let _foo4 of []) { + exports.bar = exports.foo = foo = _foo4; + + let _foo3; +} + +for (let _foo5 of []) { + ({ + foo + } = _foo5); + exports.bar = exports.foo = foo; +} + +for (let _foo7 of []) { + ({ + foo + } = _foo7); + exports.bar = exports.foo = foo; + + let _foo6; +} + +for (let _test of []) { + ({ + test: { + foo + } + } = _test); + exports.bar = exports.foo = foo; +} + +for (let _ref of []) { + [foo, [...foo]] = _ref; + exports.bar = exports.foo = foo; +} + +for (let _ref2 of []) { + [foo, [...foo]] = _ref2; + exports.bar = exports.foo = foo; + + let _foo8; +} + +{ + let foo; + + for (foo of []) {} +} diff --git a/packages/babel-plugin-transform-modules-commonjs/test/fixtures/misc/import-shadowed-assign/input.mjs b/packages/babel-plugin-transform-modules-commonjs/test/fixtures/misc/import-shadowed-assign/input.mjs new file mode 100644 index 000000000000..0ba3bfe4e6bc --- /dev/null +++ b/packages/babel-plugin-transform-modules-commonjs/test/fixtures/misc/import-shadowed-assign/input.mjs @@ -0,0 +1,12 @@ +import { foo } from "x"; + +function f(foo) { + foo = 2; + [foo] = []; + ({ foo } = {}); +} + + +foo = 2; +[foo] = []; +({ foo } = {}); diff --git a/packages/babel-plugin-transform-modules-commonjs/test/fixtures/misc/import-shadowed-assign/output.js b/packages/babel-plugin-transform-modules-commonjs/test/fixtures/misc/import-shadowed-assign/output.js new file mode 100644 index 000000000000..d78aaf7826e6 --- /dev/null +++ b/packages/babel-plugin-transform-modules-commonjs/test/fixtures/misc/import-shadowed-assign/output.js @@ -0,0 +1,23 @@ +"use strict"; + +var _x = require("x"); + +function f(foo) { + foo = 2; + [foo] = []; + ({ + foo + } = {}); +} + +_x.foo = (2, function () { + throw new Error('"' + "foo" + '" is read-only.'); +}()); +[foo] = ([], function () { + throw new Error('"' + "foo" + '" is read-only.'); +}()); +({ + foo +} = ({}, function () { + throw new Error('"' + "foo" + '" is read-only.'); +}())); diff --git a/packages/babel-plugin-transform-modules-commonjs/test/fixtures/misc/undefined-this-computed-class-method-1/input.mjs b/packages/babel-plugin-transform-modules-commonjs/test/fixtures/misc/undefined-this-computed-class-method-1/input.mjs new file mode 100644 index 000000000000..803624cdb476 --- /dev/null +++ b/packages/babel-plugin-transform-modules-commonjs/test/fixtures/misc/undefined-this-computed-class-method-1/input.mjs @@ -0,0 +1 @@ +export class C { [this.name]() {} } diff --git a/packages/babel-plugin-transform-modules-commonjs/test/fixtures/misc/undefined-this-computed-class-method-1/options.json b/packages/babel-plugin-transform-modules-commonjs/test/fixtures/misc/undefined-this-computed-class-method-1/options.json new file mode 100644 index 000000000000..60ad58ace53a --- /dev/null +++ b/packages/babel-plugin-transform-modules-commonjs/test/fixtures/misc/undefined-this-computed-class-method-1/options.json @@ -0,0 +1,7 @@ +{ + "plugins": [ + "external-helpers", + "transform-modules-commonjs", + "syntax-class-properties" + ] +} diff --git a/packages/babel-plugin-transform-modules-commonjs/test/fixtures/misc/undefined-this-computed-class-method-1/output.js b/packages/babel-plugin-transform-modules-commonjs/test/fixtures/misc/undefined-this-computed-class-method-1/output.js new file mode 100644 index 000000000000..c2b9efb88c0d --- /dev/null +++ b/packages/babel-plugin-transform-modules-commonjs/test/fixtures/misc/undefined-this-computed-class-method-1/output.js @@ -0,0 +1,13 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.C = void 0; + +class C { + [(void 0).name]() {} + +} + +exports.C = C; diff --git a/packages/babel-plugin-transform-modules-commonjs/test/fixtures/misc/undefined-this-computed-class-method-2/input.mjs b/packages/babel-plugin-transform-modules-commonjs/test/fixtures/misc/undefined-this-computed-class-method-2/input.mjs new file mode 100644 index 000000000000..55156089e6a8 --- /dev/null +++ b/packages/babel-plugin-transform-modules-commonjs/test/fixtures/misc/undefined-this-computed-class-method-2/input.mjs @@ -0,0 +1,3 @@ +class A { + [() => this.name]() {} +} \ No newline at end of file diff --git a/packages/babel-plugin-transform-modules-commonjs/test/fixtures/misc/undefined-this-computed-class-method-2/options.json b/packages/babel-plugin-transform-modules-commonjs/test/fixtures/misc/undefined-this-computed-class-method-2/options.json new file mode 100644 index 000000000000..60ad58ace53a --- /dev/null +++ b/packages/babel-plugin-transform-modules-commonjs/test/fixtures/misc/undefined-this-computed-class-method-2/options.json @@ -0,0 +1,7 @@ +{ + "plugins": [ + "external-helpers", + "transform-modules-commonjs", + "syntax-class-properties" + ] +} diff --git a/packages/babel-plugin-transform-modules-commonjs/test/fixtures/misc/undefined-this-computed-class-method-2/output.js b/packages/babel-plugin-transform-modules-commonjs/test/fixtures/misc/undefined-this-computed-class-method-2/output.js new file mode 100644 index 000000000000..8536a6332e60 --- /dev/null +++ b/packages/babel-plugin-transform-modules-commonjs/test/fixtures/misc/undefined-this-computed-class-method-2/output.js @@ -0,0 +1,6 @@ +"use strict"; + +class A { + [() => (void 0).name]() {} + +} diff --git a/packages/babel-plugin-transform-modules-commonjs/test/fixtures/misc/undefined-this-computed-class-method-3/input.mjs b/packages/babel-plugin-transform-modules-commonjs/test/fixtures/misc/undefined-this-computed-class-method-3/input.mjs new file mode 100644 index 000000000000..878eeffad744 --- /dev/null +++ b/packages/babel-plugin-transform-modules-commonjs/test/fixtures/misc/undefined-this-computed-class-method-3/input.mjs @@ -0,0 +1,3 @@ +class A { + [function () { this.name; }]() {} +} \ No newline at end of file diff --git a/packages/babel-plugin-transform-modules-commonjs/test/fixtures/misc/undefined-this-computed-class-method-3/options.json b/packages/babel-plugin-transform-modules-commonjs/test/fixtures/misc/undefined-this-computed-class-method-3/options.json new file mode 100644 index 000000000000..60ad58ace53a --- /dev/null +++ b/packages/babel-plugin-transform-modules-commonjs/test/fixtures/misc/undefined-this-computed-class-method-3/options.json @@ -0,0 +1,7 @@ +{ + "plugins": [ + "external-helpers", + "transform-modules-commonjs", + "syntax-class-properties" + ] +} diff --git a/packages/babel-plugin-transform-modules-commonjs/test/fixtures/misc/undefined-this-computed-class-method-3/output.js b/packages/babel-plugin-transform-modules-commonjs/test/fixtures/misc/undefined-this-computed-class-method-3/output.js new file mode 100644 index 000000000000..4f99944fc431 --- /dev/null +++ b/packages/babel-plugin-transform-modules-commonjs/test/fixtures/misc/undefined-this-computed-class-method-3/output.js @@ -0,0 +1,8 @@ +"use strict"; + +class A { + [function () { + this.name; + }]() {} + +} diff --git a/packages/babel-plugin-transform-modules-commonjs/test/fixtures/misc/undefined-this-computed-class-property-name/input.mjs b/packages/babel-plugin-transform-modules-commonjs/test/fixtures/misc/undefined-this-computed-class-property-name/input.mjs new file mode 100644 index 000000000000..f65287402e51 --- /dev/null +++ b/packages/babel-plugin-transform-modules-commonjs/test/fixtures/misc/undefined-this-computed-class-property-name/input.mjs @@ -0,0 +1 @@ +export class C { [this.name] = 42 } \ No newline at end of file diff --git a/packages/babel-plugin-transform-modules-commonjs/test/fixtures/misc/undefined-this-computed-class-property-name/options.json b/packages/babel-plugin-transform-modules-commonjs/test/fixtures/misc/undefined-this-computed-class-property-name/options.json new file mode 100644 index 000000000000..60ad58ace53a --- /dev/null +++ b/packages/babel-plugin-transform-modules-commonjs/test/fixtures/misc/undefined-this-computed-class-property-name/options.json @@ -0,0 +1,7 @@ +{ + "plugins": [ + "external-helpers", + "transform-modules-commonjs", + "syntax-class-properties" + ] +} diff --git a/packages/babel-plugin-transform-modules-commonjs/test/fixtures/misc/undefined-this-computed-class-property-name/output.js b/packages/babel-plugin-transform-modules-commonjs/test/fixtures/misc/undefined-this-computed-class-property-name/output.js new file mode 100644 index 000000000000..9c05bd6e9a4e --- /dev/null +++ b/packages/babel-plugin-transform-modules-commonjs/test/fixtures/misc/undefined-this-computed-class-property-name/output.js @@ -0,0 +1,12 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.C = void 0; + +class C { + [(void 0).name] = 42; +} + +exports.C = C; diff --git a/packages/babel-plugin-transform-modules-commonjs/test/fixtures/regression/T7199/output.js b/packages/babel-plugin-transform-modules-commonjs/test/fixtures/regression/T7199/output.js index 563d49889bff..c6933130a9d1 100644 --- a/packages/babel-plugin-transform-modules-commonjs/test/fixtures/regression/T7199/output.js +++ b/packages/babel-plugin-transform-modules-commonjs/test/fixtures/regression/T7199/output.js @@ -4,11 +4,15 @@ var _foo = _interopRequireDefault(require("foo")); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } -function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); } +function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); } -function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } +function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } -function _iterableToArrayLimit(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } +function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } + +function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; } + +function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } diff --git a/packages/babel-plugin-transform-modules-commonjs/test/fixtures/strict/import/input.mjs b/packages/babel-plugin-transform-modules-commonjs/test/fixtures/strict/import/input.mjs index 5b84f44e6659..0195246aa49c 100644 --- a/packages/babel-plugin-transform-modules-commonjs/test/fixtures/strict/import/input.mjs +++ b/packages/babel-plugin-transform-modules-commonjs/test/fixtures/strict/import/input.mjs @@ -7,3 +7,5 @@ foo; foo2; foo3; foo3(); +foo3``; +foo3?.(); diff --git a/packages/babel-plugin-transform-modules-commonjs/test/fixtures/strict/import/output.js b/packages/babel-plugin-transform-modules-commonjs/test/fixtures/strict/import/output.js index 1c2bc5f8e059..445e5f55895c 100644 --- a/packages/babel-plugin-transform-modules-commonjs/test/fixtures/strict/import/output.js +++ b/packages/babel-plugin-transform-modules-commonjs/test/fixtures/strict/import/output.js @@ -5,3 +5,5 @@ foo4.default; foo4.default; foo4.foo3; (0, foo4.foo3)(); +(0, foo4.foo3)``; +(0, foo4.foo3)?.(); diff --git a/packages/babel-plugin-transform-modules-commonjs/test/fixtures/strict/options.json b/packages/babel-plugin-transform-modules-commonjs/test/fixtures/strict/options.json index caedc022efa4..3e4f571b01d8 100644 --- a/packages/babel-plugin-transform-modules-commonjs/test/fixtures/strict/options.json +++ b/packages/babel-plugin-transform-modules-commonjs/test/fixtures/strict/options.json @@ -1,7 +1,6 @@ { "plugins": [ "external-helpers", - "syntax-object-rest-spread", [ "transform-modules-commonjs", { "strict": true, "mjsStrictNamespace": false } diff --git a/packages/babel-plugin-transform-modules-systemjs/package.json b/packages/babel-plugin-transform-modules-systemjs/package.json index d827ae959527..03690f55b1a8 100644 --- a/packages/babel-plugin-transform-modules-systemjs/package.json +++ b/packages/babel-plugin-transform-modules-systemjs/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-transform-modules-systemjs", - "version": "7.5.0", + "version": "7.9.0", "description": "This plugin transforms ES2015 modules to SystemJS", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-modules-systemjs", "license": "MIT", @@ -9,9 +9,10 @@ }, "main": "lib/index.js", "dependencies": { - "@babel/helper-hoist-variables": "^7.4.4", - "@babel/helper-plugin-utils": "^7.0.0", - "babel-plugin-dynamic-import-node": "^2.3.0" + "@babel/helper-hoist-variables": "^7.8.3", + "@babel/helper-module-transforms": "^7.9.0", + "@babel/helper-plugin-utils": "^7.8.3", + "babel-plugin-dynamic-import-node": "^2.3.3" }, "keywords": [ "babel-plugin" @@ -20,8 +21,8 @@ "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.5.0", - "@babel/helper-plugin-test-runner": "^7.0.0", - "@babel/plugin-syntax-dynamic-import": "^7.2.0" + "@babel/core": "^7.9.0", + "@babel/helper-plugin-test-runner": "^7.8.3", + "@babel/plugin-syntax-dynamic-import": "^7.8.0" } } diff --git a/packages/babel-plugin-transform-modules-systemjs/src/index.js b/packages/babel-plugin-transform-modules-systemjs/src/index.js index 779b76170cdc..2f56ad078f82 100644 --- a/packages/babel-plugin-transform-modules-systemjs/src/index.js +++ b/packages/babel-plugin-transform-modules-systemjs/src/index.js @@ -2,6 +2,7 @@ import { declare } from "@babel/helper-plugin-utils"; import hoistVariables from "@babel/helper-hoist-variables"; import { template, types as t } from "@babel/core"; import { getImportSource } from "babel-plugin-dynamic-import-node/utils"; +import { rewriteThis, getModuleName } from "@babel/helper-module-transforms"; const buildTemplate = template(` SYSTEM_REGISTER(MODULE_NAME, SOURCES, function (EXPORT_IDENTIFIER, CONTEXT_IDENTIFIER) { @@ -106,7 +107,7 @@ function constructExportCall( export default declare((api, options) => { api.assertVersion(7); - const { systemGlobal = "System" } = options; + const { systemGlobal = "System", allowTopLevelThis = false } = options; const IGNORE_REASSIGNMENT_SYMBOL = Symbol(); const reassignmentVisitor = { @@ -227,6 +228,9 @@ export default declare((api, options) => { Program: { enter(path, state) { state.contextIdent = path.scope.generateUid("context"); + if (!allowTopLevelThis) { + rewriteThis(path); + } }, exit(path, state) { const undefinedIdent = path.scope.buildUndefinedNode(); @@ -413,6 +417,8 @@ export default declare((api, options) => { path.replaceWithMultiple(nodes); } + } else { + path.remove(); } } } @@ -495,7 +501,7 @@ export default declare((api, options) => { ); }); - let moduleName = this.getModuleName(); + let moduleName = getModuleName(this.file.opts, options); if (moduleName) moduleName = t.stringLiteral(moduleName); hoistVariables( diff --git a/packages/babel-plugin-transform-modules-systemjs/test/fixtures/allow-top-level-this/false/input.mjs b/packages/babel-plugin-transform-modules-systemjs/test/fixtures/allow-top-level-this/false/input.mjs new file mode 100644 index 000000000000..91f171590120 --- /dev/null +++ b/packages/babel-plugin-transform-modules-systemjs/test/fixtures/allow-top-level-this/false/input.mjs @@ -0,0 +1 @@ +export var v = this; diff --git a/packages/babel-plugin-transform-modules-systemjs/test/fixtures/allow-top-level-this/false/options.json b/packages/babel-plugin-transform-modules-systemjs/test/fixtures/allow-top-level-this/false/options.json new file mode 100644 index 000000000000..51c1aaefdc1d --- /dev/null +++ b/packages/babel-plugin-transform-modules-systemjs/test/fixtures/allow-top-level-this/false/options.json @@ -0,0 +1,7 @@ +{ + "plugins": [ + ["transform-modules-systemjs", { + "allowTopLevelThis": false + }] + ] +} diff --git a/packages/babel-plugin-transform-modules-systemjs/test/fixtures/allow-top-level-this/false/output.mjs b/packages/babel-plugin-transform-modules-systemjs/test/fixtures/allow-top-level-this/false/output.mjs new file mode 100644 index 000000000000..de6449909d41 --- /dev/null +++ b/packages/babel-plugin-transform-modules-systemjs/test/fixtures/allow-top-level-this/false/output.mjs @@ -0,0 +1,11 @@ +System.register([], function (_export, _context) { + "use strict"; + + var v; + return { + setters: [], + execute: function () { + _export("v", v = void 0); + } + }; +}); diff --git a/packages/babel-plugin-transform-modules-systemjs/test/fixtures/allow-top-level-this/true/input.mjs b/packages/babel-plugin-transform-modules-systemjs/test/fixtures/allow-top-level-this/true/input.mjs new file mode 100644 index 000000000000..91f171590120 --- /dev/null +++ b/packages/babel-plugin-transform-modules-systemjs/test/fixtures/allow-top-level-this/true/input.mjs @@ -0,0 +1 @@ +export var v = this; diff --git a/packages/babel-plugin-transform-modules-systemjs/test/fixtures/allow-top-level-this/true/options.json b/packages/babel-plugin-transform-modules-systemjs/test/fixtures/allow-top-level-this/true/options.json new file mode 100644 index 000000000000..066522d40d09 --- /dev/null +++ b/packages/babel-plugin-transform-modules-systemjs/test/fixtures/allow-top-level-this/true/options.json @@ -0,0 +1,7 @@ +{ + "plugins": [ + ["transform-modules-systemjs", { + "allowTopLevelThis": true + }] + ] +} diff --git a/packages/babel-plugin-transform-modules-systemjs/test/fixtures/allow-top-level-this/true/output.mjs b/packages/babel-plugin-transform-modules-systemjs/test/fixtures/allow-top-level-this/true/output.mjs new file mode 100644 index 000000000000..032cb659bdc2 --- /dev/null +++ b/packages/babel-plugin-transform-modules-systemjs/test/fixtures/allow-top-level-this/true/output.mjs @@ -0,0 +1,11 @@ +System.register([], function (_export, _context) { + "use strict"; + + var v; + return { + setters: [], + execute: function () { + _export("v", v = this); + } + }; +}); diff --git a/packages/babel-plugin-transform-modules-systemjs/test/fixtures/import-meta/options.json b/packages/babel-plugin-transform-modules-systemjs/test/fixtures/import-meta/options.json index 7513a834e42e..cb038f2e52c5 100644 --- a/packages/babel-plugin-transform-modules-systemjs/test/fixtures/import-meta/options.json +++ b/packages/babel-plugin-transform-modules-systemjs/test/fixtures/import-meta/options.json @@ -1,7 +1,6 @@ { "plugins": [ "external-helpers", - "syntax-dynamic-import", "syntax-import-meta", "transform-modules-systemjs" ] diff --git a/packages/babel-plugin-transform-modules-systemjs/test/fixtures/systemjs/export-const-destructuring-object-rest/options.json b/packages/babel-plugin-transform-modules-systemjs/test/fixtures/systemjs/export-const-destructuring-object-rest/options.json index 09137adf8d2e..3329c8d9519f 100644 --- a/packages/babel-plugin-transform-modules-systemjs/test/fixtures/systemjs/export-const-destructuring-object-rest/options.json +++ b/packages/babel-plugin-transform-modules-systemjs/test/fixtures/systemjs/export-const-destructuring-object-rest/options.json @@ -1,7 +1,6 @@ { "plugins": [ "external-helpers", - "transform-modules-systemjs", - "syntax-object-rest-spread" + "transform-modules-systemjs" ] } diff --git a/packages/babel-plugin-transform-modules-systemjs/test/fixtures/systemjs/export-named-8/input.mjs b/packages/babel-plugin-transform-modules-systemjs/test/fixtures/systemjs/export-named-8/input.mjs new file mode 100644 index 000000000000..336ce12bb910 --- /dev/null +++ b/packages/babel-plugin-transform-modules-systemjs/test/fixtures/systemjs/export-named-8/input.mjs @@ -0,0 +1 @@ +export {} diff --git a/packages/babel-plugin-transform-modules-systemjs/test/fixtures/systemjs/export-named-8/output.mjs b/packages/babel-plugin-transform-modules-systemjs/test/fixtures/systemjs/export-named-8/output.mjs new file mode 100644 index 000000000000..5ed7cacb99d1 --- /dev/null +++ b/packages/babel-plugin-transform-modules-systemjs/test/fixtures/systemjs/export-named-8/output.mjs @@ -0,0 +1,8 @@ +System.register([], function (_export, _context) { + "use strict"; + + return { + setters: [], + execute: function () {} + }; +}); diff --git a/packages/babel-plugin-transform-modules-systemjs/test/fixtures/systemjs/get-module-name-option-compat/input.js b/packages/babel-plugin-transform-modules-systemjs/test/fixtures/systemjs/get-module-name-option-compat/input.js new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/packages/babel-plugin-transform-modules-systemjs/test/fixtures/systemjs/get-module-name-option-compat/options.json b/packages/babel-plugin-transform-modules-systemjs/test/fixtures/systemjs/get-module-name-option-compat/options.json new file mode 100644 index 000000000000..6d0cdb5a6f0c --- /dev/null +++ b/packages/babel-plugin-transform-modules-systemjs/test/fixtures/systemjs/get-module-name-option-compat/options.json @@ -0,0 +1,4 @@ +{ + "moduleIds": true, + "moduleId": "my custom module name" +} diff --git a/packages/babel-plugin-transform-modules-systemjs/test/fixtures/systemjs/get-module-name-option-compat/output.js b/packages/babel-plugin-transform-modules-systemjs/test/fixtures/systemjs/get-module-name-option-compat/output.js new file mode 100644 index 000000000000..34d9b6bfd7cb --- /dev/null +++ b/packages/babel-plugin-transform-modules-systemjs/test/fixtures/systemjs/get-module-name-option-compat/output.js @@ -0,0 +1,8 @@ +System.register("my custom module name", [], function (_export, _context) { + "use strict"; + + return { + setters: [], + execute: function () {} + }; +}); diff --git a/packages/babel-plugin-transform-modules-systemjs/test/fixtures/systemjs/get-module-name-option/options.json b/packages/babel-plugin-transform-modules-systemjs/test/fixtures/systemjs/get-module-name-option/options.json index 6d0cdb5a6f0c..a6532e913785 100644 --- a/packages/babel-plugin-transform-modules-systemjs/test/fixtures/systemjs/get-module-name-option/options.json +++ b/packages/babel-plugin-transform-modules-systemjs/test/fixtures/systemjs/get-module-name-option/options.json @@ -1,4 +1,9 @@ { - "moduleIds": true, - "moduleId": "my custom module name" + "plugins": [ + "external-helpers", + ["transform-modules-systemjs", { + "moduleIds": true, + "moduleId": "my custom module name" + }] + ] } diff --git a/packages/babel-plugin-transform-modules-umd/package.json b/packages/babel-plugin-transform-modules-umd/package.json index 9dd0f73213e6..dfaaa147e010 100644 --- a/packages/babel-plugin-transform-modules-umd/package.json +++ b/packages/babel-plugin-transform-modules-umd/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-transform-modules-umd", - "version": "7.2.0", + "version": "7.9.0", "description": "This plugin transforms ES2015 modules to UMD", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-modules-umd", "license": "MIT", @@ -9,8 +9,8 @@ }, "main": "lib/index.js", "dependencies": { - "@babel/helper-module-transforms": "^7.1.0", - "@babel/helper-plugin-utils": "^7.0.0" + "@babel/helper-module-transforms": "^7.9.0", + "@babel/helper-plugin-utils": "^7.8.3" }, "keywords": [ "babel-plugin" @@ -19,7 +19,7 @@ "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.2.0", - "@babel/helper-plugin-test-runner": "^7.0.0" + "@babel/core": "^7.9.0", + "@babel/helper-plugin-test-runner": "^7.8.3" } } diff --git a/packages/babel-plugin-transform-modules-umd/src/index.js b/packages/babel-plugin-transform-modules-umd/src/index.js index cd8000febb85..0f85d5f9a324 100644 --- a/packages/babel-plugin-transform-modules-umd/src/index.js +++ b/packages/babel-plugin-transform-modules-umd/src/index.js @@ -8,13 +8,16 @@ import { buildNamespaceInitStatements, ensureStatementsHoisted, wrapInterop, + getModuleName, } from "@babel/helper-module-transforms"; import { types as t, template } from "@babel/core"; const buildPrerequisiteAssignment = template(` GLOBAL_REFERENCE = GLOBAL_REFERENCE || {} `); - +// Note: we avoid comparing typeof results with "object" or "symbol" otherwise +// they will be processed by `transform-typeof-symbol`, which in return could +// cause typeof helper used before declaration const buildWrapper = template(` (function (global, factory) { if (typeof define === "function" && define.amd) { @@ -27,7 +30,11 @@ const buildWrapper = template(` GLOBAL_TO_ASSIGN; } - })(this, function(IMPORT_NAMES) { + })( + typeof globalThis !== "undefined" ? globalThis + : typeof self !== "undefined" ? self + : this, + function(IMPORT_NAMES) { }) `); @@ -134,7 +141,7 @@ export default declare((api, options) => { const browserGlobals = globals || {}; - let moduleName = this.getModuleName(); + let moduleName = getModuleName(this.file.opts, options); if (moduleName) moduleName = t.stringLiteral(moduleName); const { meta, headers } = rewriteModuleStatementsAndPrepareHeader( diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-default-10/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-default-10/output.js index f8e0cb66efbf..16cf5dab5b0e 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-default-10/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-default-10/output.js @@ -10,7 +10,7 @@ factory(mod.exports); global.input = mod.exports; } -})(this, function (_exports) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports) { "use strict"; _exports.__esModule = true; diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-default-11/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-default-11/output.js index 44e4e41f1697..43f6f4120ba2 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-default-11/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-default-11/output.js @@ -10,7 +10,7 @@ factory(mod.exports); global.input = mod.exports; } -})(this, function (_exports) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports) { "use strict"; _exports.__esModule = true; diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-default-2/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-default-2/output.js index 690c27a48c25..1eb753f05ea7 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-default-2/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-default-2/output.js @@ -10,7 +10,7 @@ factory(mod.exports); global.input = mod.exports; } -})(this, function (_exports) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports) { "use strict"; _exports.__esModule = true; diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-default-3/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-default-3/output.js index 956a4b228e56..8b28dd6ec87b 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-default-3/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-default-3/output.js @@ -10,7 +10,7 @@ factory(mod.exports); global.input = mod.exports; } -})(this, function (_exports) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports) { "use strict"; _exports.__esModule = true; diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-default-4/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-default-4/output.js index dcc999f2fb2b..d1aa080c8110 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-default-4/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-default-4/output.js @@ -10,7 +10,7 @@ factory(mod.exports); global.input = mod.exports; } -})(this, function (_exports) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports) { "use strict"; _exports.__esModule = true; diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-default-5/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-default-5/output.js index 255345ddc41e..50d6e6ae7234 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-default-5/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-default-5/output.js @@ -10,7 +10,7 @@ factory(mod.exports); global.input = mod.exports; } -})(this, function (_exports) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports) { "use strict"; _exports.__esModule = true; diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-default-6/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-default-6/output.js index c10daf42709d..2e9a39834a8f 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-default-6/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-default-6/output.js @@ -10,7 +10,7 @@ factory(mod.exports); global.input = mod.exports; } -})(this, function (_exports) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports) { "use strict"; _exports.__esModule = true; diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-default-7/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-default-7/output.js index 7cfc99ccd16c..99ed0428f6f9 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-default-7/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-default-7/output.js @@ -10,7 +10,7 @@ factory(mod.exports); global.input = mod.exports; } -})(this, function (_exports) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports) { "use strict"; _exports.__esModule = true; diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-default-8/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-default-8/output.js index 605b6c2762f8..50619c0ab739 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-default-8/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-default-8/output.js @@ -10,7 +10,7 @@ factory(mod.exports); global.input = mod.exports; } -})(this, function (_exports) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports) { "use strict"; _exports.__esModule = true; diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-default-9/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-default-9/output.js index 493509da29c4..78580db2a617 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-default-9/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-default-9/output.js @@ -10,7 +10,7 @@ factory(mod.exports); global.input = mod.exports; } -})(this, function (_exports) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports) { "use strict"; _exports.__esModule = true; diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-default/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-default/output.js index 406ad75ef7dc..005e2f9b8237 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-default/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-default/output.js @@ -10,7 +10,7 @@ factory(mod.exports); global.input = mod.exports; } -})(this, function (_exports) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports) { "use strict"; _exports.__esModule = true; diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-from-2/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-from-2/output.js index b03b7b38d0f8..75e19b01ab38 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-from-2/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-from-2/output.js @@ -10,7 +10,7 @@ factory(mod.exports, global.foo); global.input = mod.exports; } -})(this, function (_exports, _foo) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports, _foo) { "use strict"; _exports.__esModule = true; diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-from-3/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-from-3/output.js index 99cc2cff28f4..d6c735f4b8c8 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-from-3/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-from-3/output.js @@ -10,7 +10,7 @@ factory(mod.exports, global.foo); global.input = mod.exports; } -})(this, function (_exports, _foo) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports, _foo) { "use strict"; _exports.__esModule = true; diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-from-4/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-from-4/output.js index 36925b451778..13cd6c56cf1a 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-from-4/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-from-4/output.js @@ -10,7 +10,7 @@ factory(mod.exports, global.foo); global.input = mod.exports; } -})(this, function (_exports, _foo) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports, _foo) { "use strict"; _exports.__esModule = true; diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-from-5/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-from-5/output.js index eaa85ea93a42..db35ffb83d9e 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-from-5/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-from-5/output.js @@ -10,7 +10,7 @@ factory(mod.exports, global.foo); global.input = mod.exports; } -})(this, function (_exports, _foo) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports, _foo) { "use strict"; _exports.__esModule = true; diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-from-6/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-from-6/output.js index b7d54d8219b9..8405ded47ad5 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-from-6/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-from-6/output.js @@ -10,7 +10,7 @@ factory(mod.exports, global.foo); global.input = mod.exports; } -})(this, function (_exports, _foo) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports, _foo) { "use strict"; _exports.__esModule = true; diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-from/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-from/output.js index cde17ba82168..f200b057fbbf 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-from/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-from/output.js @@ -10,7 +10,7 @@ factory(mod.exports, global.foo); global.input = mod.exports; } -})(this, function (_exports, _foo) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports, _foo) { "use strict"; _exports.__esModule = true; diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-named-2/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-named-2/output.js index 493509da29c4..78580db2a617 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-named-2/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-named-2/output.js @@ -10,7 +10,7 @@ factory(mod.exports); global.input = mod.exports; } -})(this, function (_exports) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports) { "use strict"; _exports.__esModule = true; diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-named-3/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-named-3/output.js index c0e16dfcdfd3..4e96e316480b 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-named-3/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-named-3/output.js @@ -10,7 +10,7 @@ factory(mod.exports); global.input = mod.exports; } -})(this, function (_exports) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports) { "use strict"; _exports.__esModule = true; diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-named-4/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-named-4/output.js index b612eb59ae64..e19d1a5d1fc3 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-named-4/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-named-4/output.js @@ -10,7 +10,7 @@ factory(mod.exports); global.input = mod.exports; } -})(this, function (_exports) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports) { "use strict"; _exports.__esModule = true; diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-named-5/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-named-5/output.js index 37b7013b6631..c9353e2a5bd1 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-named-5/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-named-5/output.js @@ -10,7 +10,7 @@ factory(mod.exports); global.input = mod.exports; } -})(this, function (_exports) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports) { "use strict"; _exports.__esModule = true; diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-named/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-named/output.js index e1e04041f87f..23ff6af10e6e 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-named/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-named/output.js @@ -10,7 +10,7 @@ factory(mod.exports); global.input = mod.exports; } -})(this, function (_exports) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports) { "use strict"; _exports.__esModule = true; diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/exports-variable/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/exports-variable/output.js index 5606fe898c1a..d4aeec297660 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/exports-variable/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/exports-variable/output.js @@ -10,7 +10,7 @@ factory(mod.exports); global.input = mod.exports; } -})(this, function (_exports) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports) { "use strict"; _exports.__esModule = true; diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/get-module-name-option-compat/input.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/get-module-name-option-compat/input.js new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/get-module-name-option-compat/options.json b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/get-module-name-option-compat/options.json new file mode 100644 index 000000000000..039bece2c37e --- /dev/null +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/get-module-name-option-compat/options.json @@ -0,0 +1,6 @@ +{ + "sourceType": "module", + "moduleIds": true, + "moduleId": "my custom module name", + "plugins": ["external-helpers", ["transform-modules-umd", { "loose": true }]] +} diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/get-module-name-option-compat/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/get-module-name-option-compat/output.js new file mode 100644 index 000000000000..bbfb355912b8 --- /dev/null +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/get-module-name-option-compat/output.js @@ -0,0 +1,15 @@ +(function (global, factory) { + if (typeof define === "function" && define.amd) { + define("my custom module name", [], factory); + } else if (typeof exports !== "undefined") { + factory(); + } else { + var mod = { + exports: {} + }; + factory(); + global.myCustomModuleName = mod.exports; + } +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function () { + "use strict"; +}); diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/get-module-name-option/options.json b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/get-module-name-option/options.json index 039bece2c37e..1dc44a20c5c2 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/get-module-name-option/options.json +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/get-module-name-option/options.json @@ -1,6 +1,11 @@ { "sourceType": "module", - "moduleIds": true, - "moduleId": "my custom module name", - "plugins": ["external-helpers", ["transform-modules-umd", { "loose": true }]] + "plugins": [ + "external-helpers", + ["transform-modules-umd", { + "loose": true, + "moduleIds": true, + "moduleId": "my custom module name" + }] + ] } diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/get-module-name-option/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/get-module-name-option/output.js index d5c94066201a..bbfb355912b8 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/get-module-name-option/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/get-module-name-option/output.js @@ -10,6 +10,6 @@ factory(); global.myCustomModuleName = mod.exports; } -})(this, function () { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function () { "use strict"; }); diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/hoist-function-exports/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/hoist-function-exports/output.js index 87e3e0226890..640ce3bb776c 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/hoist-function-exports/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/hoist-function-exports/output.js @@ -10,7 +10,7 @@ factory(mod.exports, global.evens); global.input = mod.exports; } -})(this, function (_exports, _evens) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports, _evens) { "use strict"; _exports.__esModule = true; diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/imports-default/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/imports-default/output.js index bdc895976fd3..71c3133b263f 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/imports-default/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/imports-default/output.js @@ -10,7 +10,7 @@ factory(global.foo); global.input = mod.exports; } -})(this, function (_foo) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_foo) { "use strict"; _foo = babelHelpers.interopRequireDefault(_foo); diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/imports-exact-globals-false-with-overrides/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/imports-exact-globals-false-with-overrides/output.js index 79531c289ced..c751e3aee868 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/imports-exact-globals-false-with-overrides/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/imports-exact-globals-false-with-overrides/output.js @@ -10,7 +10,7 @@ factory(global.fooBAR, global.fooBAR, global.fizzBuzz); global.input = mod.exports; } -})(this, function (_fooBar, _fooBar2, _fizzbuzz) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_fooBar, _fooBar2, _fizzbuzz) { "use strict"; _fooBar = babelHelpers.interopRequireDefault(_fooBar); diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/imports-exact-globals-false/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/imports-exact-globals-false/output.js index 72d8bf864d29..5229781b738a 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/imports-exact-globals-false/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/imports-exact-globals-false/output.js @@ -10,7 +10,7 @@ factory(global.fooBar, global.fooBar, global.fizzbuzz); global.input = mod.exports; } -})(this, function (_fooBar, _fooBar2, _fizzbuzz) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_fooBar, _fooBar2, _fizzbuzz) { "use strict"; _fooBar = babelHelpers.interopRequireDefault(_fooBar); diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/imports-exact-globals-true-with-overrides/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/imports-exact-globals-true-with-overrides/output.js index bd083836e425..54211b04b3c0 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/imports-exact-globals-true-with-overrides/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/imports-exact-globals-true-with-overrides/output.js @@ -10,7 +10,7 @@ factory(global.fooBAR, global.mylib.fooBar, global.fizz.buzz); global.input = mod.exports; } -})(this, function (_fooBar, _fooBar2, _fizzbuzz) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_fooBar, _fooBar2, _fizzbuzz) { "use strict"; _fooBar = babelHelpers.interopRequireDefault(_fooBar); diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/imports-exact-globals-true/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/imports-exact-globals-true/output.js index c16c74d6d69c..bf4c741e6ce0 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/imports-exact-globals-true/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/imports-exact-globals-true/output.js @@ -10,7 +10,7 @@ factory(global.fooBar, global.mylibFooBar, global.fizzbuzz); global.input = mod.exports; } -})(this, function (_fooBar, _fooBar2, _fizzbuzz) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_fooBar, _fooBar2, _fizzbuzz) { "use strict"; _fooBar = babelHelpers.interopRequireDefault(_fooBar); diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/imports-glob/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/imports-glob/output.js index 3f403ba8ad4a..be83fe78d33c 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/imports-glob/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/imports-glob/output.js @@ -10,7 +10,7 @@ factory(global.foo); global.input = mod.exports; } -})(this, function (foo) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (foo) { "use strict"; foo = babelHelpers.interopRequireWildcard(foo); diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/imports-mixing/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/imports-mixing/output.js index f51c2d99aefa..17bf5e1fac30 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/imports-mixing/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/imports-mixing/output.js @@ -10,7 +10,7 @@ factory(global.foo); global.input = mod.exports; } -})(this, function (_foo) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_foo) { "use strict"; _foo = babelHelpers.interopRequireWildcard(_foo); diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/imports-named/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/imports-named/output.js index d0629b1666d4..d6e7457a2618 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/imports-named/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/imports-named/output.js @@ -10,7 +10,7 @@ factory(global.foo); global.input = mod.exports; } -})(this, function (_foo) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_foo) { "use strict"; _foo.bar; diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/imports/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/imports/output.js index c625f2ad0f13..5d36f0f1abf6 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/imports/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/imports/output.js @@ -10,6 +10,6 @@ factory(global.foo, global.fooBar, global.fooBar); global.input = mod.exports; } -})(this, function (_foo, _fooBar, _fooBar2) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_foo, _fooBar, _fooBar2) { "use strict"; }); diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/module-id-with-overridden-global-in-namespace/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/module-id-with-overridden-global-in-namespace/output.js index b1b88602b1d5..06cb04062449 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/module-id-with-overridden-global-in-namespace/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/module-id-with-overridden-global-in-namespace/output.js @@ -11,7 +11,7 @@ global.foo = global.foo || {}; global.foo.bar = mod.exports; } -})(this, function (_exports) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports) { "use strict"; _exports.__esModule = true; diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/module-id-with-overridden-global-in-very-nested-namespace/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/module-id-with-overridden-global-in-very-nested-namespace/output.js index bcae91ef8031..da053338dc3b 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/module-id-with-overridden-global-in-very-nested-namespace/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/module-id-with-overridden-global-in-very-nested-namespace/output.js @@ -13,7 +13,7 @@ global.foo.bar.baz = global.foo.bar.baz || {}; global.foo.bar.baz.qux = mod.exports; } -})(this, function (_exports) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports) { "use strict"; _exports.__esModule = true; diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/module-id-with-overridden-global/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/module-id-with-overridden-global/output.js index e643ca1729cf..55f97d820fda 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/module-id-with-overridden-global/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/module-id-with-overridden-global/output.js @@ -10,7 +10,7 @@ factory(mod.exports); global.baz = mod.exports; } -})(this, function (_exports) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports) { "use strict"; _exports.__esModule = true; diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/module-id/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/module-id/output.js index 2e8e731219b9..2d9c9cd817c0 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/module-id/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/module-id/output.js @@ -10,7 +10,7 @@ factory(); global.MyLib = mod.exports; } -})(this, function () { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function () { "use strict"; foobar(); diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/module-name-compat/input.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/module-name-compat/input.js new file mode 100644 index 000000000000..f3b473756e59 --- /dev/null +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/module-name-compat/input.js @@ -0,0 +1 @@ +foobar(); diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/module-name-compat/options.json b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/module-name-compat/options.json new file mode 100644 index 000000000000..6ee8c312f9bf --- /dev/null +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/module-name-compat/options.json @@ -0,0 +1,5 @@ +{ + "sourceType": "module", + "moduleIds": true, + "plugins": ["external-helpers", ["transform-modules-umd", { "loose": true }]] +} diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/module-name-compat/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/module-name-compat/output.js new file mode 100644 index 000000000000..1366dccf59fa --- /dev/null +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/module-name-compat/output.js @@ -0,0 +1,17 @@ +(function (global, factory) { + if (typeof define === "function" && define.amd) { + define("loose/module-name-compat/input", [], factory); + } else if (typeof exports !== "undefined") { + factory(); + } else { + var mod = { + exports: {} + }; + factory(); + global.looseModuleNameCompatInput = mod.exports; + } +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function () { + "use strict"; + + foobar(); +}); diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/module-name-with-overridden-global-compat/input.mjs b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/module-name-with-overridden-global-compat/input.mjs new file mode 100644 index 000000000000..7a4e8a723a40 --- /dev/null +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/module-name-with-overridden-global-compat/input.mjs @@ -0,0 +1 @@ +export default 42; diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/module-name-with-overridden-global-compat/options.json b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/module-name-with-overridden-global-compat/options.json new file mode 100644 index 000000000000..745ff7a7ea53 --- /dev/null +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/module-name-with-overridden-global-compat/options.json @@ -0,0 +1,16 @@ +{ + "plugins": [ + "external-helpers", + [ + "transform-modules-umd", + { + "globals": { + "umd/module-name-with-overridden-global/expected": "baz" + }, + "exactGlobals": true, + "loose": true + } + ] + ], + "moduleIds": true +} diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/module-name-with-overridden-global-compat/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/module-name-with-overridden-global-compat/output.js new file mode 100644 index 000000000000..bad492ef7807 --- /dev/null +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/module-name-with-overridden-global-compat/output.js @@ -0,0 +1,20 @@ +(function (global, factory) { + if (typeof define === "function" && define.amd) { + define("loose/module-name-with-overridden-global-compat/input", ["exports"], factory); + } else if (typeof exports !== "undefined") { + factory(exports); + } else { + var mod = { + exports: {} + }; + factory(mod.exports); + global.looseModuleNameWithOverriddenGlobalCompatInput = mod.exports; + } +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports) { + "use strict"; + + _exports.__esModule = true; + _exports.default = void 0; + var _default = 42; + _exports.default = _default; +}); diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/module-name-with-overridden-global/options.json b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/module-name-with-overridden-global/options.json index 745ff7a7ea53..0a4089dfb8e5 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/module-name-with-overridden-global/options.json +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/module-name-with-overridden-global/options.json @@ -8,9 +8,9 @@ "umd/module-name-with-overridden-global/expected": "baz" }, "exactGlobals": true, + "moduleIds": true, "loose": true } ] - ], - "moduleIds": true + ] } diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/module-name-with-overridden-global/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/module-name-with-overridden-global/output.js index 516c1e9a10c0..45d0bcb7c75b 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/module-name-with-overridden-global/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/module-name-with-overridden-global/output.js @@ -10,7 +10,7 @@ factory(mod.exports); global.looseModuleNameWithOverriddenGlobalInput = mod.exports; } -})(this, function (_exports) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports) { "use strict"; _exports.__esModule = true; diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/module-name/options.json b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/module-name/options.json index 6ee8c312f9bf..b5625da73103 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/module-name/options.json +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/module-name/options.json @@ -1,5 +1,10 @@ { "sourceType": "module", - "moduleIds": true, - "plugins": ["external-helpers", ["transform-modules-umd", { "loose": true }]] + "plugins": [ + "external-helpers", + ["transform-modules-umd", { + "loose": true, + "moduleIds": true + }] + ] } diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/module-name/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/module-name/output.js index 37b367916622..ec9d725704c7 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/module-name/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/module-name/output.js @@ -10,7 +10,7 @@ factory(); global.looseModuleNameInput = mod.exports; } -})(this, function () { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function () { "use strict"; foobar(); diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/non-default-imports/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/non-default-imports/output.js index a9273b54d4ba..81afa0c2b734 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/non-default-imports/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/non-default-imports/output.js @@ -10,6 +10,6 @@ factory(global.render); global.input = mod.exports; } -})(this, function (_render) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_render) { "use strict"; }); diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/override-export-name/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/override-export-name/output.js index 406ad75ef7dc..005e2f9b8237 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/override-export-name/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/override-export-name/output.js @@ -10,7 +10,7 @@ factory(mod.exports); global.input = mod.exports; } -})(this, function (_exports) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports) { "use strict"; _exports.__esModule = true; diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/override-import-name/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/override-import-name/output.js index 21f8cbe8bd64..9a60cc93eeff 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/override-import-name/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/override-import-name/output.js @@ -10,6 +10,6 @@ factory(global.Promise); global.input = mod.exports; } -})(this, function (_es6Promise) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_es6Promise) { "use strict"; }); diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/overview/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/overview/output.js index b66382de9469..92177358c8c4 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/overview/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/overview/output.js @@ -10,7 +10,7 @@ factory(mod.exports, global.foo, global.fooBar, global.fooBar); global.input = mod.exports; } -})(this, function (_exports, foo2, _fooBar, _fooBar2) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports, foo2, _fooBar, _fooBar2) { "use strict"; _exports.__esModule = true; diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/remap/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/remap/output.js index 32e24f80c89b..03b4c1258a54 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/remap/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/remap/output.js @@ -10,7 +10,7 @@ factory(mod.exports); global.input = mod.exports; } -})(this, function (_exports) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports) { "use strict"; _exports.__esModule = true; diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/regression/4192/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/regression/4192/output.js index 83495f9586e8..78689e28938e 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/regression/4192/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/regression/4192/output.js @@ -10,7 +10,7 @@ factory(mod.exports); global.input = mod.exports; } -})(this, function (_exports) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports) { "use strict"; Object.defineProperty(_exports, "__esModule", { diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-default-10/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-default-10/output.js index b4d81f7d48c9..96660c937784 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-default-10/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-default-10/output.js @@ -10,7 +10,7 @@ factory(mod.exports); global.input = mod.exports; } -})(this, function (_exports) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports) { "use strict"; Object.defineProperty(_exports, "__esModule", { diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-default-11/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-default-11/output.js index 053cce392d75..670be0b97f02 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-default-11/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-default-11/output.js @@ -10,7 +10,7 @@ factory(mod.exports); global.input = mod.exports; } -})(this, function (_exports) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports) { "use strict"; Object.defineProperty(_exports, "__esModule", { diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-default-2/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-default-2/output.js index 91736c0197c2..ec688671cff5 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-default-2/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-default-2/output.js @@ -10,7 +10,7 @@ factory(mod.exports); global.input = mod.exports; } -})(this, function (_exports) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports) { "use strict"; Object.defineProperty(_exports, "__esModule", { diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-default-3/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-default-3/output.js index 3ca1ff7d7423..b982d97d90da 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-default-3/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-default-3/output.js @@ -10,7 +10,7 @@ factory(mod.exports); global.input = mod.exports; } -})(this, function (_exports) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports) { "use strict"; Object.defineProperty(_exports, "__esModule", { diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-default-4/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-default-4/output.js index 006b7c28772a..e5dafcbe9c01 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-default-4/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-default-4/output.js @@ -10,7 +10,7 @@ factory(mod.exports); global.input = mod.exports; } -})(this, function (_exports) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports) { "use strict"; Object.defineProperty(_exports, "__esModule", { diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-default-5/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-default-5/output.js index e9d30703b26f..b57a16c2680f 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-default-5/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-default-5/output.js @@ -10,7 +10,7 @@ factory(mod.exports); global.input = mod.exports; } -})(this, function (_exports) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports) { "use strict"; Object.defineProperty(_exports, "__esModule", { diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-default-6/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-default-6/output.js index 7fdc39f6adf3..b244eea085de 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-default-6/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-default-6/output.js @@ -10,7 +10,7 @@ factory(mod.exports); global.input = mod.exports; } -})(this, function (_exports) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports) { "use strict"; Object.defineProperty(_exports, "__esModule", { diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-default-7/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-default-7/output.js index 15cad508a21a..7a36751246c2 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-default-7/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-default-7/output.js @@ -10,7 +10,7 @@ factory(mod.exports); global.input = mod.exports; } -})(this, function (_exports) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports) { "use strict"; Object.defineProperty(_exports, "__esModule", { diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-default-8/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-default-8/output.js index c92a85338f1b..260883e265f2 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-default-8/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-default-8/output.js @@ -10,7 +10,7 @@ factory(mod.exports); global.input = mod.exports; } -})(this, function (_exports) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports) { "use strict"; Object.defineProperty(_exports, "__esModule", { diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-default-9/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-default-9/output.js index b6a052ac6671..20b42c4faae2 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-default-9/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-default-9/output.js @@ -10,7 +10,7 @@ factory(mod.exports); global.input = mod.exports; } -})(this, function (_exports) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports) { "use strict"; Object.defineProperty(_exports, "__esModule", { diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-default/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-default/output.js index 3f5a188475c0..127234bed6d4 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-default/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-default/output.js @@ -10,7 +10,7 @@ factory(mod.exports); global.input = mod.exports; } -})(this, function (_exports) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports) { "use strict"; Object.defineProperty(_exports, "__esModule", { diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-from-2/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-from-2/output.js index fe946f300c70..3580d4361beb 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-from-2/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-from-2/output.js @@ -10,7 +10,7 @@ factory(mod.exports, global.foo); global.input = mod.exports; } -})(this, function (_exports, _foo) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports, _foo) { "use strict"; Object.defineProperty(_exports, "__esModule", { diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-from-3/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-from-3/output.js index 126e1be461b0..033dc64eadbe 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-from-3/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-from-3/output.js @@ -10,7 +10,7 @@ factory(mod.exports, global.foo); global.input = mod.exports; } -})(this, function (_exports, _foo) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports, _foo) { "use strict"; Object.defineProperty(_exports, "__esModule", { diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-from-4/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-from-4/output.js index dc6f562b4e3a..1a2577046f54 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-from-4/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-from-4/output.js @@ -10,7 +10,7 @@ factory(mod.exports, global.foo); global.input = mod.exports; } -})(this, function (_exports, _foo) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports, _foo) { "use strict"; Object.defineProperty(_exports, "__esModule", { diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-from-5/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-from-5/output.js index f0381a2ddba0..fd5bfbed33af 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-from-5/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-from-5/output.js @@ -10,7 +10,7 @@ factory(mod.exports, global.foo); global.input = mod.exports; } -})(this, function (_exports, _foo) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports, _foo) { "use strict"; Object.defineProperty(_exports, "__esModule", { diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-from-6/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-from-6/output.js index ec9180133584..46e4a2b27dd2 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-from-6/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-from-6/output.js @@ -10,7 +10,7 @@ factory(mod.exports, global.foo); global.input = mod.exports; } -})(this, function (_exports, _foo) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports, _foo) { "use strict"; Object.defineProperty(_exports, "__esModule", { diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-from/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-from/output.js index 116bc257736a..cda318717a4c 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-from/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-from/output.js @@ -10,7 +10,7 @@ factory(mod.exports, global.foo); global.input = mod.exports; } -})(this, function (_exports, _foo) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports, _foo) { "use strict"; Object.defineProperty(_exports, "__esModule", { diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-named-2/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-named-2/output.js index b6a052ac6671..20b42c4faae2 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-named-2/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-named-2/output.js @@ -10,7 +10,7 @@ factory(mod.exports); global.input = mod.exports; } -})(this, function (_exports) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports) { "use strict"; Object.defineProperty(_exports, "__esModule", { diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-named-3/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-named-3/output.js index 7263e5f91f48..9b45a5008053 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-named-3/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-named-3/output.js @@ -10,7 +10,7 @@ factory(mod.exports); global.input = mod.exports; } -})(this, function (_exports) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports) { "use strict"; Object.defineProperty(_exports, "__esModule", { diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-named-4/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-named-4/output.js index 14c4273fdc06..096434af4d2e 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-named-4/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-named-4/output.js @@ -10,7 +10,7 @@ factory(mod.exports); global.input = mod.exports; } -})(this, function (_exports) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports) { "use strict"; Object.defineProperty(_exports, "__esModule", { diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-named-5/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-named-5/output.js index 0ac1f5a990cc..6966fb097e00 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-named-5/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-named-5/output.js @@ -10,7 +10,7 @@ factory(mod.exports); global.input = mod.exports; } -})(this, function (_exports) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports) { "use strict"; Object.defineProperty(_exports, "__esModule", { diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-named/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-named/output.js index 009aedbfef27..1062cc37298a 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-named/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-named/output.js @@ -10,7 +10,7 @@ factory(mod.exports); global.input = mod.exports; } -})(this, function (_exports) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports) { "use strict"; Object.defineProperty(_exports, "__esModule", { diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/exports-variable/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/exports-variable/output.js index 90292c4609f7..9ad3023932a7 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/exports-variable/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/exports-variable/output.js @@ -10,7 +10,7 @@ factory(mod.exports); global.input = mod.exports; } -})(this, function (_exports) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports) { "use strict"; Object.defineProperty(_exports, "__esModule", { diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/get-module-name-option-compat/input.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/get-module-name-option-compat/input.js new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/get-module-name-option-compat/options.json b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/get-module-name-option-compat/options.json new file mode 100644 index 000000000000..ef11b00e2ba2 --- /dev/null +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/get-module-name-option-compat/options.json @@ -0,0 +1,5 @@ +{ + "sourceType": "module", + "moduleIds": true, + "moduleId": "my custom module name" +} diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/get-module-name-option-compat/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/get-module-name-option-compat/output.js new file mode 100644 index 000000000000..bbfb355912b8 --- /dev/null +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/get-module-name-option-compat/output.js @@ -0,0 +1,15 @@ +(function (global, factory) { + if (typeof define === "function" && define.amd) { + define("my custom module name", [], factory); + } else if (typeof exports !== "undefined") { + factory(); + } else { + var mod = { + exports: {} + }; + factory(); + global.myCustomModuleName = mod.exports; + } +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function () { + "use strict"; +}); diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/get-module-name-option/options.json b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/get-module-name-option/options.json index ef11b00e2ba2..e1a151d01e62 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/get-module-name-option/options.json +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/get-module-name-option/options.json @@ -1,5 +1,10 @@ { "sourceType": "module", - "moduleIds": true, - "moduleId": "my custom module name" + "plugins": [ + "external-helpers", + ["transform-modules-umd", { + "moduleIds": true, + "moduleId": "my custom module name" + }] + ] } diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/get-module-name-option/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/get-module-name-option/output.js index d5c94066201a..bbfb355912b8 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/get-module-name-option/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/get-module-name-option/output.js @@ -10,6 +10,6 @@ factory(); global.myCustomModuleName = mod.exports; } -})(this, function () { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function () { "use strict"; }); diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/hoist-function-exports/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/hoist-function-exports/output.js index f5427d448fd1..f6448a39188b 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/hoist-function-exports/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/hoist-function-exports/output.js @@ -10,7 +10,7 @@ factory(mod.exports, global.evens); global.input = mod.exports; } -})(this, function (_exports, _evens) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports, _evens) { "use strict"; Object.defineProperty(_exports, "__esModule", { diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/imports-default/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/imports-default/output.js index bdc895976fd3..71c3133b263f 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/imports-default/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/imports-default/output.js @@ -10,7 +10,7 @@ factory(global.foo); global.input = mod.exports; } -})(this, function (_foo) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_foo) { "use strict"; _foo = babelHelpers.interopRequireDefault(_foo); diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/imports-exact-globals-false-with-overrides/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/imports-exact-globals-false-with-overrides/output.js index 79531c289ced..c751e3aee868 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/imports-exact-globals-false-with-overrides/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/imports-exact-globals-false-with-overrides/output.js @@ -10,7 +10,7 @@ factory(global.fooBAR, global.fooBAR, global.fizzBuzz); global.input = mod.exports; } -})(this, function (_fooBar, _fooBar2, _fizzbuzz) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_fooBar, _fooBar2, _fizzbuzz) { "use strict"; _fooBar = babelHelpers.interopRequireDefault(_fooBar); diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/imports-exact-globals-false/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/imports-exact-globals-false/output.js index 72d8bf864d29..5229781b738a 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/imports-exact-globals-false/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/imports-exact-globals-false/output.js @@ -10,7 +10,7 @@ factory(global.fooBar, global.fooBar, global.fizzbuzz); global.input = mod.exports; } -})(this, function (_fooBar, _fooBar2, _fizzbuzz) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_fooBar, _fooBar2, _fizzbuzz) { "use strict"; _fooBar = babelHelpers.interopRequireDefault(_fooBar); diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/imports-exact-globals-true-with-overrides/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/imports-exact-globals-true-with-overrides/output.js index bd083836e425..54211b04b3c0 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/imports-exact-globals-true-with-overrides/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/imports-exact-globals-true-with-overrides/output.js @@ -10,7 +10,7 @@ factory(global.fooBAR, global.mylib.fooBar, global.fizz.buzz); global.input = mod.exports; } -})(this, function (_fooBar, _fooBar2, _fizzbuzz) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_fooBar, _fooBar2, _fizzbuzz) { "use strict"; _fooBar = babelHelpers.interopRequireDefault(_fooBar); diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/imports-exact-globals-true/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/imports-exact-globals-true/output.js index c16c74d6d69c..bf4c741e6ce0 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/imports-exact-globals-true/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/imports-exact-globals-true/output.js @@ -10,7 +10,7 @@ factory(global.fooBar, global.mylibFooBar, global.fizzbuzz); global.input = mod.exports; } -})(this, function (_fooBar, _fooBar2, _fizzbuzz) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_fooBar, _fooBar2, _fizzbuzz) { "use strict"; _fooBar = babelHelpers.interopRequireDefault(_fooBar); diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/imports-glob/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/imports-glob/output.js index 3f403ba8ad4a..be83fe78d33c 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/imports-glob/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/imports-glob/output.js @@ -10,7 +10,7 @@ factory(global.foo); global.input = mod.exports; } -})(this, function (foo) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (foo) { "use strict"; foo = babelHelpers.interopRequireWildcard(foo); diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/imports-mixing/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/imports-mixing/output.js index f51c2d99aefa..17bf5e1fac30 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/imports-mixing/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/imports-mixing/output.js @@ -10,7 +10,7 @@ factory(global.foo); global.input = mod.exports; } -})(this, function (_foo) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_foo) { "use strict"; _foo = babelHelpers.interopRequireWildcard(_foo); diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/imports-named/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/imports-named/output.js index d0629b1666d4..d6e7457a2618 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/imports-named/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/imports-named/output.js @@ -10,7 +10,7 @@ factory(global.foo); global.input = mod.exports; } -})(this, function (_foo) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_foo) { "use strict"; _foo.bar; diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/imports/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/imports/output.js index c625f2ad0f13..5d36f0f1abf6 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/imports/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/imports/output.js @@ -10,6 +10,6 @@ factory(global.foo, global.fooBar, global.fooBar); global.input = mod.exports; } -})(this, function (_foo, _fooBar, _fooBar2) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_foo, _fooBar, _fooBar2) { "use strict"; }); diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/module-id-with-overridden-global-in-namespace/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/module-id-with-overridden-global-in-namespace/output.js index 3f43c9478122..db961cbcdf89 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/module-id-with-overridden-global-in-namespace/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/module-id-with-overridden-global-in-namespace/output.js @@ -11,7 +11,7 @@ global.foo = global.foo || {}; global.foo.bar = mod.exports; } -})(this, function (_exports) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports) { "use strict"; Object.defineProperty(_exports, "__esModule", { diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/module-id-with-overridden-global-in-very-nested-namespace/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/module-id-with-overridden-global-in-very-nested-namespace/output.js index 1ddcae34725f..c3bd11fb105c 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/module-id-with-overridden-global-in-very-nested-namespace/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/module-id-with-overridden-global-in-very-nested-namespace/output.js @@ -13,7 +13,7 @@ global.foo.bar.baz = global.foo.bar.baz || {}; global.foo.bar.baz.qux = mod.exports; } -})(this, function (_exports) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports) { "use strict"; Object.defineProperty(_exports, "__esModule", { diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/module-id-with-overridden-global/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/module-id-with-overridden-global/output.js index a9feedf65627..dd85a01acf7d 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/module-id-with-overridden-global/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/module-id-with-overridden-global/output.js @@ -10,7 +10,7 @@ factory(mod.exports); global.baz = mod.exports; } -})(this, function (_exports) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports) { "use strict"; Object.defineProperty(_exports, "__esModule", { diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/module-id/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/module-id/output.js index 2e8e731219b9..2d9c9cd817c0 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/module-id/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/module-id/output.js @@ -10,7 +10,7 @@ factory(); global.MyLib = mod.exports; } -})(this, function () { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function () { "use strict"; foobar(); diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/module-name-compat/input.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/module-name-compat/input.js new file mode 100644 index 000000000000..f3b473756e59 --- /dev/null +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/module-name-compat/input.js @@ -0,0 +1 @@ +foobar(); diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/module-name-compat/options.json b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/module-name-compat/options.json new file mode 100644 index 000000000000..5b0398abbe6f --- /dev/null +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/module-name-compat/options.json @@ -0,0 +1,4 @@ +{ + "sourceType": "module", + "moduleIds": true +} diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/module-name-compat/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/module-name-compat/output.js new file mode 100644 index 000000000000..c2f6401c74ce --- /dev/null +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/module-name-compat/output.js @@ -0,0 +1,17 @@ +(function (global, factory) { + if (typeof define === "function" && define.amd) { + define("umd/module-name-compat/input", [], factory); + } else if (typeof exports !== "undefined") { + factory(); + } else { + var mod = { + exports: {} + }; + factory(); + global.umdModuleNameCompatInput = mod.exports; + } +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function () { + "use strict"; + + foobar(); +}); diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/module-name-with-overridden-global-compat/input.mjs b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/module-name-with-overridden-global-compat/input.mjs new file mode 100644 index 000000000000..7a4e8a723a40 --- /dev/null +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/module-name-with-overridden-global-compat/input.mjs @@ -0,0 +1 @@ +export default 42; diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/module-name-with-overridden-global-compat/options.json b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/module-name-with-overridden-global-compat/options.json new file mode 100644 index 000000000000..369639e804b5 --- /dev/null +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/module-name-with-overridden-global-compat/options.json @@ -0,0 +1,15 @@ +{ + "plugins": [ + "external-helpers", + [ + "transform-modules-umd", + { + "globals": { + "umd/module-name-with-overridden-global/expected": "baz" + }, + "exactGlobals": true + } + ] + ], + "moduleIds": true +} diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/module-name-with-overridden-global-compat/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/module-name-with-overridden-global-compat/output.js new file mode 100644 index 000000000000..77b9676b4f07 --- /dev/null +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/module-name-with-overridden-global-compat/output.js @@ -0,0 +1,22 @@ +(function (global, factory) { + if (typeof define === "function" && define.amd) { + define("umd/module-name-with-overridden-global-compat/input", ["exports"], factory); + } else if (typeof exports !== "undefined") { + factory(exports); + } else { + var mod = { + exports: {} + }; + factory(mod.exports); + global.umdModuleNameWithOverriddenGlobalCompatInput = mod.exports; + } +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports) { + "use strict"; + + Object.defineProperty(_exports, "__esModule", { + value: true + }); + _exports.default = void 0; + var _default = 42; + _exports.default = _default; +}); diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/module-name-with-overridden-global/options.json b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/module-name-with-overridden-global/options.json index 369639e804b5..f3aca6c65673 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/module-name-with-overridden-global/options.json +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/module-name-with-overridden-global/options.json @@ -7,9 +7,9 @@ "globals": { "umd/module-name-with-overridden-global/expected": "baz" }, - "exactGlobals": true + "exactGlobals": true, + "moduleIds": true } ] - ], - "moduleIds": true + ] } diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/module-name-with-overridden-global/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/module-name-with-overridden-global/output.js index b17d582429ed..e6186c39d886 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/module-name-with-overridden-global/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/module-name-with-overridden-global/output.js @@ -10,7 +10,7 @@ factory(mod.exports); global.umdModuleNameWithOverriddenGlobalInput = mod.exports; } -})(this, function (_exports) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports) { "use strict"; Object.defineProperty(_exports, "__esModule", { diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/module-name/options.json b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/module-name/options.json index 5b0398abbe6f..991874b44564 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/module-name/options.json +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/module-name/options.json @@ -1,4 +1,9 @@ { "sourceType": "module", - "moduleIds": true + "plugins": [ + "external-helpers", + ["transform-modules-umd", { + "moduleIds": true + }] + ] } diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/module-name/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/module-name/output.js index 3967f520001c..e85460f205bb 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/module-name/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/module-name/output.js @@ -10,7 +10,7 @@ factory(); global.umdModuleNameInput = mod.exports; } -})(this, function () { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function () { "use strict"; foobar(); diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/non-default-imports/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/non-default-imports/output.js index a9273b54d4ba..81afa0c2b734 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/non-default-imports/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/non-default-imports/output.js @@ -10,6 +10,6 @@ factory(global.render); global.input = mod.exports; } -})(this, function (_render) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_render) { "use strict"; }); diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/override-export-name/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/override-export-name/output.js index 3f5a188475c0..127234bed6d4 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/override-export-name/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/override-export-name/output.js @@ -10,7 +10,7 @@ factory(mod.exports); global.input = mod.exports; } -})(this, function (_exports) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports) { "use strict"; Object.defineProperty(_exports, "__esModule", { diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/override-import-name/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/override-import-name/output.js index 21f8cbe8bd64..9a60cc93eeff 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/override-import-name/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/override-import-name/output.js @@ -10,6 +10,6 @@ factory(global.Promise); global.input = mod.exports; } -})(this, function (_es6Promise) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_es6Promise) { "use strict"; }); diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/overview/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/overview/output.js index e60dd5dcb0e2..294904dbbd39 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/overview/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/overview/output.js @@ -10,7 +10,7 @@ factory(mod.exports, global.foo, global.fooBar, global.fooBar); global.input = mod.exports; } -})(this, function (_exports, foo2, _fooBar, _fooBar2) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports, foo2, _fooBar, _fooBar2) { "use strict"; Object.defineProperty(_exports, "__esModule", { diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/remap/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/remap/output.js index e5d904ca9981..33c36e34dc22 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/remap/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/remap/output.js @@ -10,7 +10,7 @@ factory(mod.exports); global.input = mod.exports; } -})(this, function (_exports) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports) { "use strict"; Object.defineProperty(_exports, "__esModule", { diff --git a/packages/babel-plugin-transform-named-capturing-groups-regex/package.json b/packages/babel-plugin-transform-named-capturing-groups-regex/package.json index 3de8ee619969..b59d12e5b479 100644 --- a/packages/babel-plugin-transform-named-capturing-groups-regex/package.json +++ b/packages/babel-plugin-transform-named-capturing-groups-regex/package.json @@ -1,9 +1,12 @@ { "name": "@babel/plugin-transform-named-capturing-groups-regex", - "version": "7.4.5", + "version": "7.8.3", "description": "Compile regular expressions using named groups to ES5.", "homepage": "https://babeljs.io/", "license": "MIT", + "publishConfig": { + "access": "public" + }, "main": "lib/index.js", "keywords": [ "babel-plugin", @@ -11,16 +14,22 @@ "regexp", "regular expressions" ], - "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-named-capturing-groups-regex", + "repository": { + "type": "git", + "url": "https://github.com/babel/babel.git", + "directory": "packages/babel-plugin-transform-named-capturing-groups-regex" + }, "bugs": "https://github.com/babel/babel/issues", "dependencies": { - "regexp-tree": "^0.1.6" + "@babel/helper-create-regexp-features-plugin": "^7.8.3" }, "peerDependencies": { "@babel/core": "^7.0.0" }, "devDependencies": { - "@babel/core": "^7.4.5", - "@babel/helper-plugin-test-runner": "^7.0.0" + "@babel/core": "^7.8.3", + "@babel/helper-plugin-test-runner": "^7.8.3", + "core-js": "^3.2.1", + "core-js-pure": "^3.2.1" } } diff --git a/packages/babel-plugin-transform-named-capturing-groups-regex/src/index.js b/packages/babel-plugin-transform-named-capturing-groups-regex/src/index.js index 042d16de9d4d..2cc0193310fd 100644 --- a/packages/babel-plugin-transform-named-capturing-groups-regex/src/index.js +++ b/packages/babel-plugin-transform-named-capturing-groups-regex/src/index.js @@ -1,54 +1,15 @@ -import regexpTree from "regexp-tree"; +/* eslint-disable @babel/development/plugin-name */ +import { createRegExpFeaturePlugin } from "@babel/helper-create-regexp-features-plugin"; -export default function({ types: t }, options) { +export default function(core, options) { const { runtime = true } = options; if (typeof runtime !== "boolean") { throw new Error("The 'runtime' option must be boolean"); } - return { + return createRegExpFeaturePlugin({ name: "transform-named-capturing-groups-regex", - - visitor: { - RegExpLiteral(path) { - const node = path.node; - if (node.pattern.indexOf("(?<") === -1) { - // Return early if there are no named groups. - // The .indexOf check may have false positives (e.g. /\(? 0 - ) { - node.pattern = result.getSource(); - - if (runtime && !isRegExpTest(path)) { - path.replaceWith( - t.callExpression(this.addHelper("wrapRegExp"), [ - node, - t.valueToNode(namedCapturingGroups), - ]), - ); - } - } - }, - }, - }; -} - -function isRegExpTest(path) { - return ( - path.parentPath.isMemberExpression({ - object: path.node, - computed: false, - }) && path.parentPath.get("property").isIdentifier({ name: "test" }) - ); + feature: "namedCaptureGroups", + options: { runtime }, + }); } diff --git a/packages/babel-plugin-transform-named-capturing-groups-regex/test/fixtures/runtime/issue-10393/exec.js b/packages/babel-plugin-transform-named-capturing-groups-regex/test/fixtures/runtime/issue-10393/exec.js new file mode 100644 index 000000000000..e12e576b6b0c --- /dev/null +++ b/packages/babel-plugin-transform-named-capturing-groups-regex/test/fixtures/runtime/issue-10393/exec.js @@ -0,0 +1,7 @@ +const regex = /(?<=a)(?[a])/ + +const result = regex.exec("aa"); + +expect(result.groups).toEqual({ + a: "a" +}); diff --git a/packages/babel-plugin-transform-named-capturing-groups-regex/test/fixtures/runtime/issue-10393/options.json b/packages/babel-plugin-transform-named-capturing-groups-regex/test/fixtures/runtime/issue-10393/options.json new file mode 100644 index 000000000000..2454c2169cf8 --- /dev/null +++ b/packages/babel-plugin-transform-named-capturing-groups-regex/test/fixtures/runtime/issue-10393/options.json @@ -0,0 +1,3 @@ +{ + "minNodeVersion": "8.0.0" +} diff --git a/packages/babel-plugin-transform-named-capturing-groups-regex/test/fixtures/runtime/issue-10601/exec.js b/packages/babel-plugin-transform-named-capturing-groups-regex/test/fixtures/runtime/issue-10601/exec.js new file mode 100644 index 000000000000..21136a48f1ac --- /dev/null +++ b/packages/babel-plugin-transform-named-capturing-groups-regex/test/fixtures/runtime/issue-10601/exec.js @@ -0,0 +1,7 @@ +const regex = /<(?\d)+>.*?<\/\k>/su; + +const result = regex.exec('<0>xxx\nyyy'); + +expect(result.groups).toEqual({ + tag: "0" +}); diff --git a/packages/babel-plugin-transform-named-capturing-groups-regex/test/fixtures/runtime/issue-10601/options.json b/packages/babel-plugin-transform-named-capturing-groups-regex/test/fixtures/runtime/issue-10601/options.json new file mode 100644 index 000000000000..2454c2169cf8 --- /dev/null +++ b/packages/babel-plugin-transform-named-capturing-groups-regex/test/fixtures/runtime/issue-10601/options.json @@ -0,0 +1,3 @@ +{ + "minNodeVersion": "8.0.0" +} diff --git a/packages/babel-plugin-transform-named-capturing-groups-regex/test/fixtures/runtime/match-all-corejs/exec.js b/packages/babel-plugin-transform-named-capturing-groups-regex/test/fixtures/runtime/match-all-corejs/exec.js new file mode 100644 index 000000000000..321c2557ffa9 --- /dev/null +++ b/packages/babel-plugin-transform-named-capturing-groups-regex/test/fixtures/runtime/match-all-corejs/exec.js @@ -0,0 +1,16 @@ +require('core-js/features/string/match-all.js'); + +const string = "Favorite GitHub repos: tc39/ecma262 v8/v8.dev"; +const regex = /\b(?[a-z0-9]+)\/(?[a-z0-9\.]+)\b/g; + +const matches = string.matchAll(regex); + +expect(matches.next().value.groups).toEqual({ + owner: "tc39", + repo: "ecma262", +}); + +expect(matches.next().value.groups).toEqual({ + owner: "v8", + repo: "v8.dev", +}); diff --git a/packages/babel-plugin-transform-named-capturing-groups-regex/test/fixtures/runtime/match-all/exec.js b/packages/babel-plugin-transform-named-capturing-groups-regex/test/fixtures/runtime/match-all/exec.js new file mode 100644 index 000000000000..975a485204bb --- /dev/null +++ b/packages/babel-plugin-transform-named-capturing-groups-regex/test/fixtures/runtime/match-all/exec.js @@ -0,0 +1,14 @@ +const string = "Favorite GitHub repos: tc39/ecma262 v8/v8.dev"; +const regex = /\b(?[a-z0-9]+)\/(?[a-z0-9\.]+)\b/g; + +const matches = string.matchAll(regex); + +expect(matches.next().value.groups).toEqual({ + owner: "tc39", + repo: "ecma262", +}); + +expect(matches.next().value.groups).toEqual({ + owner: "v8", + repo: "v8.dev", +}); diff --git a/packages/babel-plugin-transform-named-capturing-groups-regex/test/fixtures/runtime/match-all/options.json b/packages/babel-plugin-transform-named-capturing-groups-regex/test/fixtures/runtime/match-all/options.json new file mode 100644 index 000000000000..22b476c4bb57 --- /dev/null +++ b/packages/babel-plugin-transform-named-capturing-groups-regex/test/fixtures/runtime/match-all/options.json @@ -0,0 +1,3 @@ +{ + "minNodeVersion": "12.0.0" +} diff --git a/packages/babel-plugin-transform-named-capturing-groups-regex/test/fixtures/syntax/escape-no-unicode-flag/options.json b/packages/babel-plugin-transform-named-capturing-groups-regex/test/fixtures/syntax/escape-no-unicode-flag/options.json index 47dc981e754b..f41e9ff57d0e 100644 --- a/packages/babel-plugin-transform-named-capturing-groups-regex/test/fixtures/syntax/escape-no-unicode-flag/options.json +++ b/packages/babel-plugin-transform-named-capturing-groups-regex/test/fixtures/syntax/escape-no-unicode-flag/options.json @@ -1,3 +1,3 @@ { - "throws": "invalid group Unicode name \"\\u{41}\", use `u` flag." + "throws": "Invalid escape sequence at position 3" } diff --git a/packages/babel-plugin-transform-named-capturing-groups-regex/test/fixtures/wrapper/basic/output.js b/packages/babel-plugin-transform-named-capturing-groups-regex/test/fixtures/wrapper/basic/output.js index 2c6eed2f6dec..779aac3d8537 100644 --- a/packages/babel-plugin-transform-named-capturing-groups-regex/test/fixtures/wrapper/basic/output.js +++ b/packages/babel-plugin-transform-named-capturing-groups-regex/test/fixtures/wrapper/basic/output.js @@ -1,3 +1,3 @@ -"foo".match(babelHelpers.wrapRegExp(/(.)\1/, { +"foo".match( /*#__PURE__*/babelHelpers.wrapRegExp(/(.)\1/, { double: 1 })); diff --git a/packages/babel-plugin-transform-named-capturing-groups-regex/test/fixtures/wrapper/looks-like-a-group-unicode/input.js b/packages/babel-plugin-transform-named-capturing-groups-regex/test/fixtures/wrapper/looks-like-a-group-unicode/input.js new file mode 100644 index 000000000000..00a7c78b9344 --- /dev/null +++ b/packages/babel-plugin-transform-named-capturing-groups-regex/test/fixtures/wrapper/looks-like-a-group-unicode/input.js @@ -0,0 +1 @@ +/no-groups-\(?looks\)\u{10000}/u; diff --git a/packages/babel-plugin-transform-named-capturing-groups-regex/test/fixtures/wrapper/looks-like-a-group-unicode/options.json b/packages/babel-plugin-transform-named-capturing-groups-regex/test/fixtures/wrapper/looks-like-a-group-unicode/options.json new file mode 100644 index 000000000000..1832df9cd6ad --- /dev/null +++ b/packages/babel-plugin-transform-named-capturing-groups-regex/test/fixtures/wrapper/looks-like-a-group-unicode/options.json @@ -0,0 +1,7 @@ +{ + "plugins": [ + ["external-helpers", { "helperVersion": "7.1000.0" }], + "transform-named-capturing-groups-regex", + "transform-unicode-regex" + ] +} diff --git a/packages/babel-plugin-transform-named-capturing-groups-regex/test/fixtures/wrapper/looks-like-a-group-unicode/output.js b/packages/babel-plugin-transform-named-capturing-groups-regex/test/fixtures/wrapper/looks-like-a-group-unicode/output.js new file mode 100644 index 000000000000..af299f8fceaf --- /dev/null +++ b/packages/babel-plugin-transform-named-capturing-groups-regex/test/fixtures/wrapper/looks-like-a-group-unicode/output.js @@ -0,0 +1 @@ +/no\x2Dgroups\x2D\(?looks\)(?:\uD800\uDC00)/; diff --git a/packages/babel-plugin-transform-named-capturing-groups-regex/test/fixtures/wrapper/looks-like-a-group/output.js b/packages/babel-plugin-transform-named-capturing-groups-regex/test/fixtures/wrapper/looks-like-a-group/output.js index 4c55ef0dbe17..6fe7c2ef533c 100644 --- a/packages/babel-plugin-transform-named-capturing-groups-regex/test/fixtures/wrapper/looks-like-a-group/output.js +++ b/packages/babel-plugin-transform-named-capturing-groups-regex/test/fixtures/wrapper/looks-like-a-group/output.js @@ -1 +1 @@ -/no-groups-\(?looks\)/; +/no\x2Dgroups\x2D\(?looks\)/; diff --git a/packages/babel-plugin-transform-named-capturing-groups-regex/test/fixtures/wrapper/skips-anonymous-capturing-groups/output.js b/packages/babel-plugin-transform-named-capturing-groups-regex/test/fixtures/wrapper/skips-anonymous-capturing-groups/output.js index f9da17ab47a1..16f5e24236b2 100644 --- a/packages/babel-plugin-transform-named-capturing-groups-regex/test/fixtures/wrapper/skips-anonymous-capturing-groups/output.js +++ b/packages/babel-plugin-transform-named-capturing-groups-regex/test/fixtures/wrapper/skips-anonymous-capturing-groups/output.js @@ -1,3 +1,3 @@ -"abba".match(babelHelpers.wrapRegExp(/(.)(.)\2\1/, { +"abba".match( /*#__PURE__*/babelHelpers.wrapRegExp(/(.)(.)\2\1/, { n: 2 })); diff --git a/packages/babel-plugin-transform-new-target/package.json b/packages/babel-plugin-transform-new-target/package.json index f415edcfec42..71d0e6e71786 100644 --- a/packages/babel-plugin-transform-new-target/package.json +++ b/packages/babel-plugin-transform-new-target/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-transform-new-target", - "version": "7.4.4", + "version": "7.8.3", "description": "Transforms new.target meta property", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-new-target", "license": "MIT", @@ -12,15 +12,15 @@ "babel-plugin" ], "dependencies": { - "@babel/helper-plugin-utils": "^7.0.0" + "@babel/helper-plugin-utils": "^7.8.3" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.4.4", - "@babel/helper-plugin-test-runner": "^7.0.0", - "@babel/plugin-proposal-class-properties": "^7.4.4", - "@babel/plugin-transform-arrow-functions": "^7.0.0" + "@babel/core": "^7.8.3", + "@babel/helper-plugin-test-runner": "^7.8.3", + "@babel/plugin-proposal-class-properties": "^7.8.3", + "@babel/plugin-transform-arrow-functions": "^7.8.3" } } diff --git a/packages/babel-plugin-transform-object-assign/package.json b/packages/babel-plugin-transform-object-assign/package.json index b0852beb749c..0ddc53f8cfc3 100644 --- a/packages/babel-plugin-transform-object-assign/package.json +++ b/packages/babel-plugin-transform-object-assign/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-transform-object-assign", - "version": "7.2.0", + "version": "7.8.3", "description": "Replace Object.assign with an inline helper", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-object-assign", "author": "Jed Watson", @@ -13,13 +13,13 @@ "babel-plugin" ], "dependencies": { - "@babel/helper-plugin-utils": "^7.0.0" + "@babel/helper-plugin-utils": "^7.8.3" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.2.0", - "@babel/helper-plugin-test-runner": "^7.0.0" + "@babel/core": "^7.8.3", + "@babel/helper-plugin-test-runner": "^7.8.3" } } diff --git a/packages/babel-plugin-transform-object-set-prototype-of-to-assign/package.json b/packages/babel-plugin-transform-object-set-prototype-of-to-assign/package.json index 850f7c9e1c53..1af849a37337 100644 --- a/packages/babel-plugin-transform-object-set-prototype-of-to-assign/package.json +++ b/packages/babel-plugin-transform-object-set-prototype-of-to-assign/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-transform-object-set-prototype-of-to-assign", - "version": "7.2.0", + "version": "7.8.3", "description": "Turn Object.setPrototypeOf to assignments", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-object-set-prototype-of-to-assign", "license": "MIT", @@ -12,13 +12,13 @@ "babel-plugin" ], "dependencies": { - "@babel/helper-plugin-utils": "^7.0.0" + "@babel/helper-plugin-utils": "^7.8.3" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.2.0", - "@babel/helper-plugin-test-runner": "^7.0.0" + "@babel/core": "^7.8.3", + "@babel/helper-plugin-test-runner": "^7.8.3" } } diff --git a/packages/babel-plugin-transform-object-super/package.json b/packages/babel-plugin-transform-object-super/package.json index 488357a6e245..7325ef334c35 100644 --- a/packages/babel-plugin-transform-object-super/package.json +++ b/packages/babel-plugin-transform-object-super/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-transform-object-super", - "version": "7.5.5", + "version": "7.8.3", "description": "Compile ES2015 object super to ES5", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-object-super", "license": "MIT", @@ -12,14 +12,14 @@ "babel-plugin" ], "dependencies": { - "@babel/helper-plugin-utils": "^7.0.0", - "@babel/helper-replace-supers": "^7.5.5" + "@babel/helper-plugin-utils": "^7.8.3", + "@babel/helper-replace-supers": "^7.8.3" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.5.5", - "@babel/helper-plugin-test-runner": "^7.0.0" + "@babel/core": "^7.8.3", + "@babel/helper-plugin-test-runner": "^7.8.3" } } diff --git a/packages/babel-plugin-transform-parameters/package.json b/packages/babel-plugin-transform-parameters/package.json index fa8403ed44ce..e75c55a4d565 100644 --- a/packages/babel-plugin-transform-parameters/package.json +++ b/packages/babel-plugin-transform-parameters/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-transform-parameters", - "version": "7.4.4", + "version": "7.9.5", "description": "Compile ES2015 default and rest parameters to ES5", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-parameters", "license": "MIT", @@ -9,9 +9,8 @@ }, "main": "lib/index.js", "dependencies": { - "@babel/helper-call-delegate": "^7.4.4", - "@babel/helper-get-function-arity": "^7.0.0", - "@babel/helper-plugin-utils": "^7.0.0" + "@babel/helper-get-function-arity": "^7.8.3", + "@babel/helper-plugin-utils": "^7.8.3" }, "keywords": [ "babel-plugin" @@ -20,7 +19,7 @@ "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.4.4", - "@babel/helper-plugin-test-runner": "^7.0.0" + "@babel/core": "^7.8.7", + "@babel/helper-plugin-test-runner": "^7.8.3" } } diff --git a/packages/babel-plugin-transform-parameters/src/index.js b/packages/babel-plugin-transform-parameters/src/index.js index 5ba89ba9eec1..1f5cb7184b04 100644 --- a/packages/babel-plugin-transform-parameters/src/index.js +++ b/packages/babel-plugin-transform-parameters/src/index.js @@ -1,6 +1,7 @@ import { declare } from "@babel/helper-plugin-utils"; import convertFunctionParams from "./params"; import convertFunctionRest from "./rest"; +export { convertFunctionParams }; export default declare((api, options) => { api.assertVersion(7); diff --git a/packages/babel-plugin-transform-parameters/src/params.js b/packages/babel-plugin-transform-parameters/src/params.js index 000a8505a581..51901e1a26ba 100644 --- a/packages/babel-plugin-transform-parameters/src/params.js +++ b/packages/babel-plugin-transform-parameters/src/params.js @@ -1,4 +1,3 @@ -import callDelegate from "@babel/helper-call-delegate"; import { template, types as t } from "@babel/core"; const buildDefaultParam = template(` @@ -23,43 +22,106 @@ const buildSafeArgumentsAccess = template(` let $0 = arguments.length > $1 ? arguments[$1] : undefined; `); -function isSafeBinding(scope, node) { - if (!scope.hasOwnBinding(node.name)) return true; - const { kind } = scope.getOwnBinding(node.name); - return kind === "param" || kind === "local"; -} - const iifeVisitor = { - ReferencedIdentifier(path, state) { + "ReferencedIdentifier|BindingIdentifier"(path, state) { const { scope, node } = path; - if (node.name === "eval" || !isSafeBinding(scope, node)) { - state.iife = true; + const { name } = node; + + if ( + name === "eval" || + (scope.getBinding(name) === state.scope.parent.getBinding(name) && + state.scope.hasOwnBinding(name)) + ) { + state.needsOuterBinding = true; path.stop(); } }, - - Scope(path) { - // different bindings - path.skip(); - }, + // type annotations don't use or introduce "real" bindings + "TypeAnnotation|TSTypeAnnotation|TypeParameterDeclaration|TSTypeParameterDeclaration": path => + path.skip(), }; -export default function convertFunctionParams(path, loose) { +// last 2 parameters are optional -- they are used by proposal-object-rest-spread/src/index.js +export default function convertFunctionParams( + path, + loose, + shouldTransformParam, + replaceRestElement, +) { + const params = path.get("params"); + + const isSimpleParameterList = params.every(param => param.isIdentifier()); + if (isSimpleParameterList) return false; + const { node, scope } = path; const state = { - iife: false, - scope: scope, + stop: false, + needsOuterBinding: false, + scope, }; const body = []; - const params = path.get("params"); + const shadowedParams = new Set(); + + for (const param of params) { + for (const name of Object.keys(param.getBindingIdentifiers())) { + const constantViolations = scope.bindings[name]?.constantViolations; + if (constantViolations) { + for (const redeclarator of constantViolations) { + const node = redeclarator.node; + // If a constant violation is a var or a function declaration, + // we first check to see if it's a var without an init. + // If so, we remove that declarator. + // Otherwise, we have to wrap it in an IIFE. + switch (node.type) { + case "VariableDeclarator": { + if (node.init === null) { + const declaration = redeclarator.parentPath; + // The following uninitialized var declarators should not be removed + // for (var x in {}) + // for (var x;;) + if ( + !declaration.parentPath.isFor() || + declaration.parentPath.get("body") === declaration + ) { + redeclarator.remove(); + break; + } + } + + shadowedParams.add(name); + break; + } + case "FunctionDeclaration": + shadowedParams.add(name); + break; + } + } + } + } + } + + if (shadowedParams.size === 0) { + for (const param of params) { + if (!param.isIdentifier()) param.traverse(iifeVisitor, state); + if (state.needsOuterBinding) break; + } + } let firstOptionalIndex = null; for (let i = 0; i < params.length; i++) { const param = params[i]; + if (shouldTransformParam && !shouldTransformParam(i)) { + continue; + } + const transformedRestNodes = []; + if (replaceRestElement) { + replaceRestElement(param.parentPath, param, transformedRestNodes); + } + const paramIsAssignmentPattern = param.isAssignmentPattern(); if (paramIsAssignmentPattern && (loose || node.kind === "set")) { const left = param.get("left"); @@ -94,15 +156,6 @@ export default function convertFunctionParams(path, loose) { const left = param.get("left"); const right = param.get("right"); - if (!state.iife) { - if (right.isIdentifier() && !isSafeBinding(scope, right.node)) { - // the right hand side references a parameter - state.iife = true; - } else { - right.traverse(iifeVisitor, state); - } - } - const defNode = buildDefaultParam({ VARIABLE_NAME: left.node, DEFAULT_VALUE: right.node, @@ -126,13 +179,13 @@ export default function convertFunctionParams(path, loose) { param.replaceWith(t.cloneNode(uid)); } - if (!state.iife && !param.isIdentifier()) { - param.traverse(iifeVisitor, state); + if (transformedRestNodes) { + for (const transformedNode of transformedRestNodes) { + body.push(transformedNode); + } } } - if (body.length === 0) return false; - // we need to cut off all trailing parameters if (firstOptionalIndex !== null) { node.params = node.params.slice(0, firstOptionalIndex); @@ -141,12 +194,41 @@ export default function convertFunctionParams(path, loose) { // ensure it's a block, useful for arrow functions path.ensureBlock(); - if (state.iife) { - body.push(callDelegate(path, scope)); + if (state.needsOuterBinding || shadowedParams.size > 0) { + body.push(buildScopeIIFE(shadowedParams, path.get("body").node)); + path.set("body", t.blockStatement(body)); + + // We inject an arrow and then transform it to a normal function, to be + // sure that we correctly handle this and arguments. + const bodyPath = path.get("body.body"); + const arrowPath = bodyPath[bodyPath.length - 1].get("argument.callee"); + arrowPath.arrowFunctionToExpression(); + + arrowPath.node.generator = path.node.generator; + arrowPath.node.async = path.node.async; + + // We don't reset "async" because if the default value of a parameter + // throws, it must reject asynchronously. + path.node.generator = false; } else { path.get("body").unshiftContainer("body", body); } return true; } + +function buildScopeIIFE(shadowedParams, body) { + const args = []; + const params = []; + + for (const name of shadowedParams) { + // We create them twice; the other option is to use t.cloneNode + args.push(t.identifier(name)); + params.push(t.identifier(name)); + } + + return t.returnStatement( + t.callExpression(t.arrowFunctionExpression(params, body), params), + ); +} diff --git a/packages/babel-plugin-transform-parameters/src/rest.js b/packages/babel-plugin-transform-parameters/src/rest.js index da85c7e5ad95..cfba76ce4ae4 100644 --- a/packages/babel-plugin-transform-parameters/src/rest.js +++ b/packages/babel-plugin-transform-parameters/src/rest.js @@ -87,26 +87,28 @@ const memberExpressionOptimisationVisitor = { const argsOptEligible = !state.deopted && - !// ex: `args[0] = "whatever"` - ( - (grandparentPath.isAssignmentExpression() && - parentPath.node === grandparentPath.node.left) || - // ex: `[args[0]] = ["whatever"]` - grandparentPath.isLVal() || - // ex: `for (rest[0] in this)` - // ex: `for (rest[0] of this)` - grandparentPath.isForXStatement() || - // ex: `++args[0]` - // ex: `args[0]--` - grandparentPath.isUpdateExpression() || - // ex: `delete args[0]` - grandparentPath.isUnaryExpression({ operator: "delete" }) || - // ex: `args[0]()` - // ex: `new args[0]()` - // ex: `new args[0]` - ((grandparentPath.isCallExpression() || - grandparentPath.isNewExpression()) && - parentPath.node === grandparentPath.node.callee) + !( + // ex: `args[0] = "whatever"` + ( + (grandparentPath.isAssignmentExpression() && + parentPath.node === grandparentPath.node.left) || + // ex: `[args[0]] = ["whatever"]` + grandparentPath.isLVal() || + // ex: `for (rest[0] in this)` + // ex: `for (rest[0] of this)` + grandparentPath.isForXStatement() || + // ex: `++args[0]` + // ex: `args[0]--` + grandparentPath.isUpdateExpression() || + // ex: `delete args[0]` + grandparentPath.isUnaryExpression({ operator: "delete" }) || + // ex: `args[0]()` + // ex: `new args[0]()` + // ex: `new args[0]` + ((grandparentPath.isCallExpression() || + grandparentPath.isNewExpression()) && + parentPath.node === grandparentPath.node.callee) + ) ); if (argsOptEligible) { @@ -153,6 +155,16 @@ const memberExpressionOptimisationVisitor = { } }, }; + +function getParamsCount(node) { + let count = node.params.length; + // skip the first parameter if it is a TypeScript 'this parameter' + if (count > 0 && t.isIdentifier(node.params[0], { name: "this" })) { + count -= 1; + } + return count; +} + function hasRest(node) { const length = node.params.length; return length > 0 && t.isRestElement(node.params[length - 1]); @@ -242,10 +254,12 @@ export default function convertFunctionRest(path) { node.body.body.unshift(declar); } + const paramsCount = getParamsCount(node); + // check and optimise for extremely common cases const state = { references: [], - offset: node.params.length, + offset: paramsCount, argumentsNode: argsId, outerBinding: scope.getBindingIdentifier(rest.name), @@ -295,12 +309,12 @@ export default function convertFunctionRest(path) { state.candidates.map(({ path }) => path), ); - const start = t.numericLiteral(node.params.length); + const start = t.numericLiteral(paramsCount); const key = scope.generateUidIdentifier("key"); const len = scope.generateUidIdentifier("len"); let arrKey, arrLen; - if (node.params.length) { + if (paramsCount) { // this method has additional params, so we need to subtract // the index of the current argument position from the // position in the array that we want to populate diff --git a/packages/babel-plugin-transform-parameters/test/fixtures/parameters/default-iife-4253/output.js b/packages/babel-plugin-transform-parameters/test/fixtures/parameters/default-iife-4253/output.js index 4432ba6ae305..5db5c3247b1f 100644 --- a/packages/babel-plugin-transform-parameters/test/fixtures/parameters/default-iife-4253/output.js +++ b/packages/babel-plugin-transform-parameters/test/fixtures/parameters/default-iife-4253/output.js @@ -1,6 +1,4 @@ -var Ref = -/*#__PURE__*/ -function () { +var Ref = /*#__PURE__*/function () { "use strict"; function Ref() { diff --git a/packages/babel-plugin-transform-parameters/test/fixtures/parameters/default-iife-9947/input.js b/packages/babel-plugin-transform-parameters/test/fixtures/parameters/default-iife-9947/input.js new file mode 100644 index 000000000000..e2ca36c7ddb2 --- /dev/null +++ b/packages/babel-plugin-transform-parameters/test/fixtures/parameters/default-iife-9947/input.js @@ -0,0 +1,6 @@ +let x = "outside"; +function outer(a = () => x) { + let x = "inside"; + return a(); +} +outer(); diff --git a/packages/babel-plugin-transform-parameters/test/fixtures/parameters/default-iife-9947/output.js b/packages/babel-plugin-transform-parameters/test/fixtures/parameters/default-iife-9947/output.js new file mode 100644 index 000000000000..74ff50c2df94 --- /dev/null +++ b/packages/babel-plugin-transform-parameters/test/fixtures/parameters/default-iife-9947/output.js @@ -0,0 +1,13 @@ +var x = "outside"; + +function outer() { + var a = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : function () { + return x; + }; + return function () { + var x = "inside"; + return a(); + }(); +} + +outer(); diff --git a/packages/babel-plugin-transform-parameters/test/fixtures/parameters/default-iife-self/output.js b/packages/babel-plugin-transform-parameters/test/fixtures/parameters/default-iife-self/output.js index c63f10e4374d..4f4cc0f11424 100644 --- a/packages/babel-plugin-transform-parameters/test/fixtures/parameters/default-iife-self/output.js +++ b/packages/babel-plugin-transform-parameters/test/fixtures/parameters/default-iife-self/output.js @@ -1,6 +1,4 @@ -var Ref = -/*#__PURE__*/ -function () { +var Ref = /*#__PURE__*/function () { "use strict"; function Ref() { @@ -12,9 +10,7 @@ function () { return Ref; }(); -var X = -/*#__PURE__*/ -function () { +var X = /*#__PURE__*/function () { "use strict"; function X() { diff --git a/packages/babel-plugin-transform-parameters/test/fixtures/parameters/fn-decl-same-as-param/input.js b/packages/babel-plugin-transform-parameters/test/fixtures/parameters/fn-decl-same-as-param/input.js new file mode 100644 index 000000000000..cf2e4b632204 --- /dev/null +++ b/packages/babel-plugin-transform-parameters/test/fixtures/parameters/fn-decl-same-as-param/input.js @@ -0,0 +1,5 @@ +function foo(a = 2) { + function a() { + + } +} diff --git a/packages/babel-plugin-transform-parameters/test/fixtures/parameters/fn-decl-same-as-param/output.js b/packages/babel-plugin-transform-parameters/test/fixtures/parameters/fn-decl-same-as-param/output.js new file mode 100644 index 000000000000..2e9898d82f96 --- /dev/null +++ b/packages/babel-plugin-transform-parameters/test/fixtures/parameters/fn-decl-same-as-param/output.js @@ -0,0 +1,6 @@ +function foo() { + var a = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 2; + return function (a) { + function a() {} + }(a); +} diff --git a/packages/babel-plugin-transform-parameters/test/fixtures/parameters/iife-this-9385/output.js b/packages/babel-plugin-transform-parameters/test/fixtures/parameters/iife-this-9385/output.js index 5e502c2384f7..c8c2ef9b1c06 100644 --- a/packages/babel-plugin-transform-parameters/test/fixtures/parameters/iife-this-9385/output.js +++ b/packages/babel-plugin-transform-parameters/test/fixtures/parameters/iife-this-9385/output.js @@ -11,9 +11,7 @@ function _defineProperties(target, props) { for (var i = 0; i < props.length; i+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } -var Test = -/*#__PURE__*/ -function () { +var Test = /*#__PURE__*/function () { function Test() { _classCallCheck(this, Test); } diff --git a/packages/babel-plugin-transform-parameters/test/fixtures/parameters/iife-this/output.js b/packages/babel-plugin-transform-parameters/test/fixtures/parameters/iife-this/output.js index d199a0d7866f..46b777531fbd 100644 --- a/packages/babel-plugin-transform-parameters/test/fixtures/parameters/iife-this/output.js +++ b/packages/babel-plugin-transform-parameters/test/fixtures/parameters/iife-this/output.js @@ -1,8 +1,6 @@ var a; -var Test = -/*#__PURE__*/ -function () { +var Test = /*#__PURE__*/function () { "use strict"; function Test() { @@ -12,11 +10,13 @@ function () { babelHelpers.createClass(Test, [{ key: "invite", value: function invite() { + var _this = this; + var p = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : a; return function () { var a; - this; - }.apply(this); + _this; + }(); } }]); return Test; diff --git a/packages/babel-plugin-transform-parameters/test/fixtures/parameters/let-for-init-same-as-param/exec.js b/packages/babel-plugin-transform-parameters/test/fixtures/parameters/let-for-init-same-as-param/exec.js new file mode 100644 index 000000000000..fef1489f3047 --- /dev/null +++ b/packages/babel-plugin-transform-parameters/test/fixtures/parameters/let-for-init-same-as-param/exec.js @@ -0,0 +1,5 @@ +function foo(a = 2) { + for (let a = 1; a > 0; a--); + expect(a).toBe(2); +} +foo(); diff --git a/packages/babel-plugin-transform-parameters/test/fixtures/parameters/let-no-init-for-init-same-as-param/exec.js b/packages/babel-plugin-transform-parameters/test/fixtures/parameters/let-no-init-for-init-same-as-param/exec.js new file mode 100644 index 000000000000..400a947ffdb8 --- /dev/null +++ b/packages/babel-plugin-transform-parameters/test/fixtures/parameters/let-no-init-for-init-same-as-param/exec.js @@ -0,0 +1,5 @@ +function foo(a = 2) { + for (let a, i = 0; i < 1; i++) a = 1; + expect(a).toBe(2); +} +foo(); diff --git a/packages/babel-plugin-transform-parameters/test/fixtures/parameters/options.json b/packages/babel-plugin-transform-parameters/test/fixtures/parameters/options.json index 4ee046b12d4c..81ab23a54067 100644 --- a/packages/babel-plugin-transform-parameters/test/fixtures/parameters/options.json +++ b/packages/babel-plugin-transform-parameters/test/fixtures/parameters/options.json @@ -1,7 +1,8 @@ { "plugins": [ "proposal-class-properties", - "external-helpers", + ["external-helpers", { "helperVersion": "7.100.0" }], + "syntax-typescript", "syntax-flow", "transform-parameters", "transform-block-scoping", diff --git a/packages/babel-plugin-transform-parameters/test/fixtures/parameters/regression-4348/output.js b/packages/babel-plugin-transform-parameters/test/fixtures/parameters/regression-4348/output.js index e6e8f4c01a8d..08bc2b52ab19 100644 --- a/packages/babel-plugin-transform-parameters/test/fixtures/parameters/regression-4348/output.js +++ b/packages/babel-plugin-transform-parameters/test/fixtures/parameters/regression-4348/output.js @@ -1,6 +1,6 @@ function first() { - var _ref; + var _index; var index = 0; - return _ref = index++, _ref < 0 || arguments.length <= _ref ? undefined : arguments[_ref]; + return _index = index++, _index < 0 || arguments.length <= _index ? undefined : arguments[_index]; } diff --git a/packages/babel-plugin-transform-parameters/test/fixtures/parameters/rest-async-arrow-functions/output.js b/packages/babel-plugin-transform-parameters/test/fixtures/parameters/rest-async-arrow-functions/output.js index 8b6db36160d0..6fa4312eb950 100644 --- a/packages/babel-plugin-transform-parameters/test/fixtures/parameters/rest-async-arrow-functions/output.js +++ b/packages/babel-plugin-transform-parameters/test/fixtures/parameters/rest-async-arrow-functions/output.js @@ -1,6 +1,4 @@ -var concat = -/*#__PURE__*/ -function () { +var concat = /*#__PURE__*/function () { var _ref = babelHelpers.asyncToGenerator(function* () { var x = arguments.length <= 0 ? undefined : arguments[0]; var y = arguments.length <= 1 ? undefined : arguments[1]; @@ -11,9 +9,7 @@ function () { }; }(); -var x = -/*#__PURE__*/ -function () { +var x = /*#__PURE__*/function () { var _ref2 = babelHelpers.asyncToGenerator(function* () { if (noNeedToWork) return 0; diff --git a/packages/babel-plugin-transform-parameters/test/fixtures/parameters/rest-member-expression-deoptimisation/output.js b/packages/babel-plugin-transform-parameters/test/fixtures/parameters/rest-member-expression-deoptimisation/output.js index 29238be5a127..8330132f0bf9 100644 --- a/packages/babel-plugin-transform-parameters/test/fixtures/parameters/rest-member-expression-deoptimisation/output.js +++ b/packages/babel-plugin-transform-parameters/test/fixtures/parameters/rest-member-expression-deoptimisation/output.js @@ -153,28 +153,18 @@ function forOf() { rest[_key16] = arguments[_key16]; } - var _iteratorNormalCompletion = true; - var _didIteratorError = false; - var _iteratorError = undefined; + var _iterator = babelHelpers.createForOfIteratorHelper(this), + _step; try { - for (var _iterator = this[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { + for (_iterator.s(); !(_step = _iterator.n()).done;) { rest[0] = _step.value; ; } } catch (err) { - _didIteratorError = true; - _iteratorError = err; + _iterator.e(err); } finally { - try { - if (!_iteratorNormalCompletion && _iterator.return != null) { - _iterator.return(); - } - } finally { - if (_didIteratorError) { - throw _iteratorError; - } - } + _iterator.f(); } } diff --git a/packages/babel-plugin-transform-parameters/test/fixtures/parameters/rest-nested-iife/output.js b/packages/babel-plugin-transform-parameters/test/fixtures/parameters/rest-nested-iife/output.js index d11588d86bb9..72b8f12f86a7 100644 --- a/packages/babel-plugin-transform-parameters/test/fixtures/parameters/rest-nested-iife/output.js +++ b/packages/babel-plugin-transform-parameters/test/fixtures/parameters/rest-nested-iife/output.js @@ -1,15 +1,15 @@ function broken(x) { if (true) { - var Foo = - /*#__PURE__*/ - function (_Bar) { + var Foo = /*#__PURE__*/function (_Bar) { "use strict"; babelHelpers.inherits(Foo, _Bar); + var _super = babelHelpers.createSuper(Foo); + function Foo() { babelHelpers.classCallCheck(this, Foo); - return babelHelpers.possibleConstructorReturn(this, babelHelpers.getPrototypeOf(Foo).apply(this, arguments)); + return _super.apply(this, arguments); } return Foo; diff --git a/packages/babel-plugin-transform-parameters/test/fixtures/parameters/rest-ts-this-parameter/input.js b/packages/babel-plugin-transform-parameters/test/fixtures/parameters/rest-ts-this-parameter/input.js new file mode 100644 index 000000000000..1d2875453ecd --- /dev/null +++ b/packages/babel-plugin-transform-parameters/test/fixtures/parameters/rest-ts-this-parameter/input.js @@ -0,0 +1,7 @@ +function u(this: Foo, ...items) { + items[0]; +} + +function v(this: Foo, event: string, ...args: any[]) { + args; +} diff --git a/packages/babel-plugin-transform-parameters/test/fixtures/parameters/rest-ts-this-parameter/output.js b/packages/babel-plugin-transform-parameters/test/fixtures/parameters/rest-ts-this-parameter/output.js new file mode 100644 index 000000000000..55822308fd13 --- /dev/null +++ b/packages/babel-plugin-transform-parameters/test/fixtures/parameters/rest-ts-this-parameter/output.js @@ -0,0 +1,11 @@ +function u(this: Foo) { + arguments.length <= 0 ? undefined : arguments[0]; +} + +function v(this: Foo, event: string) { + for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { + args[_key - 1] = arguments[_key]; + } + + args; +} diff --git a/packages/babel-plugin-transform-parameters/test/fixtures/parameters/var-for-body-same-as-param/exec.js b/packages/babel-plugin-transform-parameters/test/fixtures/parameters/var-for-body-same-as-param/exec.js new file mode 100644 index 000000000000..15080691ad69 --- /dev/null +++ b/packages/babel-plugin-transform-parameters/test/fixtures/parameters/var-for-body-same-as-param/exec.js @@ -0,0 +1,5 @@ +function foo(a = 2) { + for (var i of [0]) var a = 1; + expect(a).toBe(1); +} +foo(); diff --git a/packages/babel-plugin-transform-parameters/test/fixtures/parameters/var-for-init-same-as-param/exec.js b/packages/babel-plugin-transform-parameters/test/fixtures/parameters/var-for-init-same-as-param/exec.js new file mode 100644 index 000000000000..3a0c8b460f12 --- /dev/null +++ b/packages/babel-plugin-transform-parameters/test/fixtures/parameters/var-for-init-same-as-param/exec.js @@ -0,0 +1,5 @@ +function foo(a = 2) { + for (var [a] of [[1]]); + expect(a).toBe(1); +} +foo(); diff --git a/packages/babel-plugin-transform-parameters/test/fixtures/parameters/var-no-init-for-body-same-as-param/exec.js b/packages/babel-plugin-transform-parameters/test/fixtures/parameters/var-no-init-for-body-same-as-param/exec.js new file mode 100644 index 000000000000..a1b43e1f42a6 --- /dev/null +++ b/packages/babel-plugin-transform-parameters/test/fixtures/parameters/var-no-init-for-body-same-as-param/exec.js @@ -0,0 +1,5 @@ +function foo(a = 2) { + for (var i of [0]) var a; + expect(a).toBe(2); +} +foo(); diff --git a/packages/babel-plugin-transform-parameters/test/fixtures/parameters/var-no-init-for-init-same-as-param/exec.js b/packages/babel-plugin-transform-parameters/test/fixtures/parameters/var-no-init-for-init-same-as-param/exec.js new file mode 100644 index 000000000000..55140f5240e9 --- /dev/null +++ b/packages/babel-plugin-transform-parameters/test/fixtures/parameters/var-no-init-for-init-same-as-param/exec.js @@ -0,0 +1,5 @@ +function foo(a = 2) { + for (var a, i = 0; i < 1; i++); + expect(a).toBe(2); +} +foo(); diff --git a/packages/babel-plugin-transform-parameters/test/fixtures/parameters/var-no-init-same-as-param/input.js b/packages/babel-plugin-transform-parameters/test/fixtures/parameters/var-no-init-same-as-param/input.js new file mode 100644 index 000000000000..fae31de5603d --- /dev/null +++ b/packages/babel-plugin-transform-parameters/test/fixtures/parameters/var-no-init-same-as-param/input.js @@ -0,0 +1,6 @@ +function f(a = 2, b = 3) { + var a, b = 4; + var a; + var b; + return a + b; +} diff --git a/packages/babel-plugin-transform-parameters/test/fixtures/parameters/var-no-init-same-as-param/output.js b/packages/babel-plugin-transform-parameters/test/fixtures/parameters/var-no-init-same-as-param/output.js new file mode 100644 index 000000000000..2fc3189a8d85 --- /dev/null +++ b/packages/babel-plugin-transform-parameters/test/fixtures/parameters/var-no-init-same-as-param/output.js @@ -0,0 +1,8 @@ +function f() { + var a = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 2; + var b = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 3; + return function (b) { + var b = 4; + return a + b; + }(b); +} diff --git a/packages/babel-plugin-transform-parameters/test/fixtures/parameters/var-no-init-then-var-with-init-same-as-param/input.js b/packages/babel-plugin-transform-parameters/test/fixtures/parameters/var-no-init-then-var-with-init-same-as-param/input.js new file mode 100644 index 000000000000..9838300d2b35 --- /dev/null +++ b/packages/babel-plugin-transform-parameters/test/fixtures/parameters/var-no-init-then-var-with-init-same-as-param/input.js @@ -0,0 +1,5 @@ +function f(a = 2, b = 3) { + var a; + var { a } = { a: 4 }; + return a + b; +} diff --git a/packages/babel-plugin-transform-parameters/test/fixtures/parameters/var-no-init-then-var-with-init-same-as-param/output.js b/packages/babel-plugin-transform-parameters/test/fixtures/parameters/var-no-init-then-var-with-init-same-as-param/output.js new file mode 100644 index 000000000000..813e3c43e414 --- /dev/null +++ b/packages/babel-plugin-transform-parameters/test/fixtures/parameters/var-no-init-then-var-with-init-same-as-param/output.js @@ -0,0 +1,11 @@ +function f() { + var a = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 2; + var b = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 3; + return function (a) { + var _a = { + a: 4 + }, + a = _a.a; + return a + b; + }(a); +} diff --git a/packages/babel-plugin-transform-parameters/test/fixtures/parameters/var-same-as-array-pattern-param/input.js b/packages/babel-plugin-transform-parameters/test/fixtures/parameters/var-same-as-array-pattern-param/input.js new file mode 100644 index 000000000000..b90b5d3411bf --- /dev/null +++ b/packages/babel-plugin-transform-parameters/test/fixtures/parameters/var-same-as-array-pattern-param/input.js @@ -0,0 +1,5 @@ +function foo({a, b}) { + var a = 3; + var c = 2; + var d = a + b + c; +} diff --git a/packages/babel-plugin-transform-parameters/test/fixtures/parameters/var-same-as-array-pattern-param/output.js b/packages/babel-plugin-transform-parameters/test/fixtures/parameters/var-same-as-array-pattern-param/output.js new file mode 100644 index 000000000000..391fb5405e1d --- /dev/null +++ b/packages/babel-plugin-transform-parameters/test/fixtures/parameters/var-same-as-array-pattern-param/output.js @@ -0,0 +1,9 @@ +function foo(_ref) { + var a = _ref.a, + b = _ref.b; + return function (a) { + var a = 3; + var c = 2; + var d = a + b + c; + }(a); +} diff --git a/packages/babel-plugin-transform-parameters/test/fixtures/parameters/var-same-as-object-pattern-param/input.js b/packages/babel-plugin-transform-parameters/test/fixtures/parameters/var-same-as-object-pattern-param/input.js new file mode 100644 index 000000000000..54bb95b0a33d --- /dev/null +++ b/packages/babel-plugin-transform-parameters/test/fixtures/parameters/var-same-as-object-pattern-param/input.js @@ -0,0 +1,5 @@ +function foo([a, b]) { + var a = 3; + var c = 2; + var d = a + b + c; +} diff --git a/packages/babel-plugin-transform-parameters/test/fixtures/parameters/var-same-as-object-pattern-param/output.js b/packages/babel-plugin-transform-parameters/test/fixtures/parameters/var-same-as-object-pattern-param/output.js new file mode 100644 index 000000000000..1409778402d4 --- /dev/null +++ b/packages/babel-plugin-transform-parameters/test/fixtures/parameters/var-same-as-object-pattern-param/output.js @@ -0,0 +1,11 @@ +function foo(_ref) { + var _ref2 = babelHelpers.slicedToArray(_ref, 2), + a = _ref2[0], + b = _ref2[1]; + + return function (a) { + var a = 3; + var c = 2; + var d = a + b + c; + }(a); +} diff --git a/packages/babel-plugin-transform-parameters/test/fixtures/parameters/var-same-as-param-closure/exec.js b/packages/babel-plugin-transform-parameters/test/fixtures/parameters/var-same-as-param-closure/exec.js new file mode 100644 index 000000000000..1f35e3dd4526 --- /dev/null +++ b/packages/babel-plugin-transform-parameters/test/fixtures/parameters/var-same-as-param-closure/exec.js @@ -0,0 +1,8 @@ +var x = 1 +function foo(x, y = function () { x = 2 }) { + var x = 3 + y() + expect(x).toBe(3); +} +foo() +expect(x).toBe(1); diff --git a/packages/babel-plugin-transform-parameters/test/fixtures/parameters/var-same-as-param/input.js b/packages/babel-plugin-transform-parameters/test/fixtures/parameters/var-same-as-param/input.js new file mode 100644 index 000000000000..2f3ac79e04c6 --- /dev/null +++ b/packages/babel-plugin-transform-parameters/test/fixtures/parameters/var-same-as-param/input.js @@ -0,0 +1,3 @@ +function foo(a = 2) { + var a = 1; +} diff --git a/packages/babel-plugin-transform-parameters/test/fixtures/parameters/var-same-as-param/output.js b/packages/babel-plugin-transform-parameters/test/fixtures/parameters/var-same-as-param/output.js new file mode 100644 index 000000000000..321ee1b90c99 --- /dev/null +++ b/packages/babel-plugin-transform-parameters/test/fixtures/parameters/var-same-as-param/output.js @@ -0,0 +1,6 @@ +function foo() { + var a = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 2; + return function (a) { + var a = 1; + }(a); +} diff --git a/packages/babel-plugin-transform-parameters/test/fixtures/parameters/var-with-init-then-var-no-init-same-as-param/input.js b/packages/babel-plugin-transform-parameters/test/fixtures/parameters/var-with-init-then-var-no-init-same-as-param/input.js new file mode 100644 index 000000000000..7a0460a5ad2a --- /dev/null +++ b/packages/babel-plugin-transform-parameters/test/fixtures/parameters/var-with-init-then-var-no-init-same-as-param/input.js @@ -0,0 +1,6 @@ +function f(a = 2, b = 3) { + var { a } = { a: 4 }; + var a; + var b; + return a + b; +} diff --git a/packages/babel-plugin-transform-parameters/test/fixtures/parameters/var-with-init-then-var-no-init-same-as-param/output.js b/packages/babel-plugin-transform-parameters/test/fixtures/parameters/var-with-init-then-var-no-init-same-as-param/output.js new file mode 100644 index 000000000000..813e3c43e414 --- /dev/null +++ b/packages/babel-plugin-transform-parameters/test/fixtures/parameters/var-with-init-then-var-no-init-same-as-param/output.js @@ -0,0 +1,11 @@ +function f() { + var a = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 2; + var b = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 3; + return function (a) { + var _a = { + a: 4 + }, + a = _a.a; + return a + b; + }(a); +} diff --git a/packages/babel-plugin-transform-parameters/test/fixtures/regression/11231/input.mjs b/packages/babel-plugin-transform-parameters/test/fixtures/regression/11231/input.mjs new file mode 100644 index 000000000000..8b05176beeed --- /dev/null +++ b/packages/babel-plugin-transform-parameters/test/fixtures/regression/11231/input.mjs @@ -0,0 +1,3 @@ +(i = "__proto__") => { + for (var i in {}); +}; diff --git a/packages/babel-plugin-transform-parameters/test/fixtures/regression/11231/options.json b/packages/babel-plugin-transform-parameters/test/fixtures/regression/11231/options.json new file mode 100644 index 000000000000..3a9f55e6405f --- /dev/null +++ b/packages/babel-plugin-transform-parameters/test/fixtures/regression/11231/options.json @@ -0,0 +1,5 @@ +{ + "plugins": [ + "transform-parameters" + ] +} diff --git a/packages/babel-plugin-transform-parameters/test/fixtures/regression/11231/output.mjs b/packages/babel-plugin-transform-parameters/test/fixtures/regression/11231/output.mjs new file mode 100644 index 000000000000..e260f00d5edb --- /dev/null +++ b/packages/babel-plugin-transform-parameters/test/fixtures/regression/11231/output.mjs @@ -0,0 +1,6 @@ +(function () { + let i = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "__proto__"; + return function (i) { + for (var i in {}); + }(i); +}); diff --git a/packages/babel-plugin-transform-parameters/test/fixtures/regression/11256/input.js b/packages/babel-plugin-transform-parameters/test/fixtures/regression/11256/input.js new file mode 100644 index 000000000000..c8bdbb254927 --- /dev/null +++ b/packages/babel-plugin-transform-parameters/test/fixtures/regression/11256/input.js @@ -0,0 +1,7 @@ +class A { + a = b => { + { + ({ b } = {}); + } + }; +} diff --git a/packages/babel-plugin-transform-parameters/test/fixtures/regression/11256/options.json b/packages/babel-plugin-transform-parameters/test/fixtures/regression/11256/options.json new file mode 100644 index 000000000000..5571fe0ba689 --- /dev/null +++ b/packages/babel-plugin-transform-parameters/test/fixtures/regression/11256/options.json @@ -0,0 +1,8 @@ +{ + "plugins": [ + "proposal-class-properties", + "transform-parameters", + "transform-destructuring", + ["external-helpers", { "helperVersion": "7.100.0" }] + ] +} diff --git a/packages/babel-plugin-transform-parameters/test/fixtures/regression/11256/output.js b/packages/babel-plugin-transform-parameters/test/fixtures/regression/11256/output.js new file mode 100644 index 000000000000..310af5054065 --- /dev/null +++ b/packages/babel-plugin-transform-parameters/test/fixtures/regression/11256/output.js @@ -0,0 +1,11 @@ +class A { + constructor() { + babelHelpers.defineProperty(this, "a", b => { + { + var _ref = {}; + b = _ref.b; + } + }); + } + +} diff --git a/packages/babel-plugin-transform-parameters/test/fixtures/regression/11303/exec.js b/packages/babel-plugin-transform-parameters/test/fixtures/regression/11303/exec.js new file mode 100644 index 000000000000..700c3fbf6d1f --- /dev/null +++ b/packages/babel-plugin-transform-parameters/test/fixtures/regression/11303/exec.js @@ -0,0 +1,6 @@ +function test(a, b = 1) { + var a = a + b; + return a; +} + +expect(test(2)).toBe(3); diff --git a/packages/babel-plugin-transform-parameters/test/fixtures/regression/11303/input.js b/packages/babel-plugin-transform-parameters/test/fixtures/regression/11303/input.js new file mode 100644 index 000000000000..bc0102371f58 --- /dev/null +++ b/packages/babel-plugin-transform-parameters/test/fixtures/regression/11303/input.js @@ -0,0 +1,4 @@ +function test(a, b = 1) { + var a = a + b; + return a; +} diff --git a/packages/babel-plugin-transform-parameters/test/fixtures/regression/11303/options.json b/packages/babel-plugin-transform-parameters/test/fixtures/regression/11303/options.json new file mode 100644 index 000000000000..3a9f55e6405f --- /dev/null +++ b/packages/babel-plugin-transform-parameters/test/fixtures/regression/11303/options.json @@ -0,0 +1,5 @@ +{ + "plugins": [ + "transform-parameters" + ] +} diff --git a/packages/babel-plugin-transform-parameters/test/fixtures/regression/11303/output.js b/packages/babel-plugin-transform-parameters/test/fixtures/regression/11303/output.js new file mode 100644 index 000000000000..350279f5688b --- /dev/null +++ b/packages/babel-plugin-transform-parameters/test/fixtures/regression/11303/output.js @@ -0,0 +1,7 @@ +function test(a) { + let b = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1; + return function (a) { + var a = a + b; + return a; + }(a); +} diff --git a/packages/babel-plugin-transform-parameters/test/fixtures/regression/11344-flow/input.js b/packages/babel-plugin-transform-parameters/test/fixtures/regression/11344-flow/input.js new file mode 100644 index 000000000000..953d0473e286 --- /dev/null +++ b/packages/babel-plugin-transform-parameters/test/fixtures/regression/11344-flow/input.js @@ -0,0 +1,7 @@ +function a(b: (c) => void = {}) { + let c; +} + +function d(e = () => {}) { + let T; +} diff --git a/packages/babel-plugin-transform-parameters/test/fixtures/regression/11344-flow/options.json b/packages/babel-plugin-transform-parameters/test/fixtures/regression/11344-flow/options.json new file mode 100644 index 000000000000..8fe7e8dceccb --- /dev/null +++ b/packages/babel-plugin-transform-parameters/test/fixtures/regression/11344-flow/options.json @@ -0,0 +1,6 @@ +{ + "plugins": [ + "transform-parameters", + "syntax-flow" + ] +} diff --git a/packages/babel-plugin-transform-parameters/test/fixtures/regression/11344-flow/output.js b/packages/babel-plugin-transform-parameters/test/fixtures/regression/11344-flow/output.js new file mode 100644 index 000000000000..d4d757d31d0d --- /dev/null +++ b/packages/babel-plugin-transform-parameters/test/fixtures/regression/11344-flow/output.js @@ -0,0 +1,9 @@ +function a() { + let b: (c) => void = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; + let c; +} + +function d() { + let e = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : () => {}; + let T; +} diff --git a/packages/babel-plugin-transform-parameters/test/fixtures/regression/11344-typescript/input.js b/packages/babel-plugin-transform-parameters/test/fixtures/regression/11344-typescript/input.js new file mode 100644 index 000000000000..953d0473e286 --- /dev/null +++ b/packages/babel-plugin-transform-parameters/test/fixtures/regression/11344-typescript/input.js @@ -0,0 +1,7 @@ +function a(b: (c) => void = {}) { + let c; +} + +function d(e = () => {}) { + let T; +} diff --git a/packages/babel-plugin-transform-parameters/test/fixtures/regression/11344-typescript/options.json b/packages/babel-plugin-transform-parameters/test/fixtures/regression/11344-typescript/options.json new file mode 100644 index 000000000000..abf00ef61215 --- /dev/null +++ b/packages/babel-plugin-transform-parameters/test/fixtures/regression/11344-typescript/options.json @@ -0,0 +1,6 @@ +{ + "plugins": [ + "transform-parameters", + "syntax-typescript" + ] +} diff --git a/packages/babel-plugin-transform-parameters/test/fixtures/regression/11344-typescript/output.js b/packages/babel-plugin-transform-parameters/test/fixtures/regression/11344-typescript/output.js new file mode 100644 index 000000000000..d4d757d31d0d --- /dev/null +++ b/packages/babel-plugin-transform-parameters/test/fixtures/regression/11344-typescript/output.js @@ -0,0 +1,9 @@ +function a() { + let b: (c) => void = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; + let c; +} + +function d() { + let e = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : () => {}; + let T; +} diff --git a/packages/babel-plugin-transform-parameters/test/fixtures/regression/4209/output.js b/packages/babel-plugin-transform-parameters/test/fixtures/regression/4209/output.js index cd0bbaf374f1..9254fa65f8ab 100644 --- a/packages/babel-plugin-transform-parameters/test/fixtures/regression/4209/output.js +++ b/packages/babel-plugin-transform-parameters/test/fixtures/regression/4209/output.js @@ -8,9 +8,7 @@ function _defineProperties(target, props) { for (var i = 0; i < props.length; i+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } -var Thing = -/*#__PURE__*/ -function () { +var Thing = /*#__PURE__*/function () { function Thing() { _classCallCheck(this, Thing); } diff --git a/packages/babel-plugin-transform-parameters/test/fixtures/regression/6057-expanded/output.js b/packages/babel-plugin-transform-parameters/test/fixtures/regression/6057-expanded/output.js index 451673e683d4..8c505c673db1 100644 --- a/packages/babel-plugin-transform-parameters/test/fixtures/regression/6057-expanded/output.js +++ b/packages/babel-plugin-transform-parameters/test/fixtures/regression/6057-expanded/output.js @@ -9,7 +9,7 @@ var _args = _interopRequireDefault(require("utils/url/args")); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } -function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } +function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } @@ -17,26 +17,28 @@ function _defineProperties(target, props) { for (var i = 0; i < props.length; i+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } -function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } -function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } +function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } + +function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function () { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } + +function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } +function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } -function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } +function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } -var App = -/*#__PURE__*/ -function (_Component) { +var App = /*#__PURE__*/function (_Component) { _inherits(App, _Component); - function App() { - var _getPrototypeOf2; + var _super = _createSuper(App); + function App() { var _this; _classCallCheck(this, App); @@ -45,7 +47,7 @@ function (_Component) { args[_key] = arguments[_key]; } - _this = _possibleConstructorReturn(this, (_getPrototypeOf2 = _getPrototypeOf(App)).call.apply(_getPrototypeOf2, [this].concat(args))); + _this = _super.call.apply(_super, [this].concat(args)); _defineProperty(_assertThisInitialized(_this), "exportType", ''); diff --git a/packages/babel-plugin-transform-parameters/test/fixtures/regression/scope-async-param-error-async/exec.js b/packages/babel-plugin-transform-parameters/test/fixtures/regression/scope-async-param-error-async/exec.js new file mode 100644 index 000000000000..005e1dc68b19 --- /dev/null +++ b/packages/babel-plugin-transform-parameters/test/fixtures/regression/scope-async-param-error-async/exec.js @@ -0,0 +1,13 @@ +const err = new Error(); + +async function f(a = (() => { throw err })()) { + throw 1; + var a = await a; + return a; +} + +return (async () => { + let p; + expect(() => { p = f() }).not.toThrow(); + await expect(p).rejects.toThrow(err); +})(); diff --git a/packages/babel-plugin-transform-parameters/test/fixtures/regression/scope-async-param-error-async/options.json b/packages/babel-plugin-transform-parameters/test/fixtures/regression/scope-async-param-error-async/options.json new file mode 100644 index 000000000000..a4560df366eb --- /dev/null +++ b/packages/babel-plugin-transform-parameters/test/fixtures/regression/scope-async-param-error-async/options.json @@ -0,0 +1,9 @@ +{ + "plugins": [ + "transform-parameters" + ], + "parserOpts": { + "allowReturnOutsideFunction": true + }, + "minNodeVersion": "8.0.0" +} diff --git a/packages/babel-plugin-transform-parameters/test/fixtures/regression/scope-gen-async/input.js b/packages/babel-plugin-transform-parameters/test/fixtures/regression/scope-gen-async/input.js new file mode 100644 index 000000000000..e46127c51439 --- /dev/null +++ b/packages/babel-plugin-transform-parameters/test/fixtures/regression/scope-gen-async/input.js @@ -0,0 +1,14 @@ +function* f(a = 1) { + var a = yield a; + return a; +} + +async function g(a = 1) { + var a = await a; + return a; +} + +async function* h(a = 1) { + var a = await (yield a); + return a; +} diff --git a/packages/babel-plugin-transform-parameters/test/fixtures/regression/scope-gen-async/options.json b/packages/babel-plugin-transform-parameters/test/fixtures/regression/scope-gen-async/options.json new file mode 100644 index 000000000000..3a9f55e6405f --- /dev/null +++ b/packages/babel-plugin-transform-parameters/test/fixtures/regression/scope-gen-async/options.json @@ -0,0 +1,5 @@ +{ + "plugins": [ + "transform-parameters" + ] +} diff --git a/packages/babel-plugin-transform-parameters/test/fixtures/regression/scope-gen-async/output.js b/packages/babel-plugin-transform-parameters/test/fixtures/regression/scope-gen-async/output.js new file mode 100644 index 000000000000..1df77b61c2c0 --- /dev/null +++ b/packages/babel-plugin-transform-parameters/test/fixtures/regression/scope-gen-async/output.js @@ -0,0 +1,23 @@ +function f() { + let a = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1; + return function* (a) { + var a = yield a; + return a; + }(a); +} + +async function g() { + let a = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1; + return async function (a) { + var a = await a; + return a; + }(a); +} + +async function h() { + let a = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1; + return async function* (a) { + var a = await (yield a); + return a; + }(a); +} diff --git a/packages/babel-plugin-transform-property-literals/package.json b/packages/babel-plugin-transform-property-literals/package.json index d74f95007361..2453c446a61f 100644 --- a/packages/babel-plugin-transform-property-literals/package.json +++ b/packages/babel-plugin-transform-property-literals/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-transform-property-literals", - "version": "7.2.0", + "version": "7.8.3", "description": "Ensure that reserved words are quoted in object property keys", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-property-literals", "license": "MIT", @@ -12,13 +12,13 @@ "babel-plugin" ], "dependencies": { - "@babel/helper-plugin-utils": "^7.0.0" + "@babel/helper-plugin-utils": "^7.8.3" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.2.0", - "@babel/helper-plugin-test-runner": "^7.0.0" + "@babel/core": "^7.8.3", + "@babel/helper-plugin-test-runner": "^7.8.3" } } diff --git a/packages/babel-plugin-transform-property-mutators/package.json b/packages/babel-plugin-transform-property-mutators/package.json index b280968195ce..d77149509f5a 100644 --- a/packages/babel-plugin-transform-property-mutators/package.json +++ b/packages/babel-plugin-transform-property-mutators/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-transform-property-mutators", - "version": "7.2.0", + "version": "7.8.3", "description": "Compile ES5 property mutator shorthand syntax to Object.defineProperty", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-property-mutators", "license": "MIT", @@ -12,14 +12,14 @@ "babel-plugin" ], "dependencies": { - "@babel/helper-define-map": "^7.1.0", - "@babel/helper-plugin-utils": "^7.0.0" + "@babel/helper-define-map": "^7.8.3", + "@babel/helper-plugin-utils": "^7.8.3" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.2.0", - "@babel/helper-plugin-test-runner": "^7.0.0" + "@babel/core": "^7.8.3", + "@babel/helper-plugin-test-runner": "^7.8.3" } } diff --git a/packages/babel-plugin-transform-proto-to-assign/package.json b/packages/babel-plugin-transform-proto-to-assign/package.json index 7b5799fa217d..76fea74a12d6 100644 --- a/packages/babel-plugin-transform-proto-to-assign/package.json +++ b/packages/babel-plugin-transform-proto-to-assign/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-transform-proto-to-assign", - "version": "7.5.5", + "version": "7.8.3", "description": "Babel plugin for turning __proto__ into a shallow property clone", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-proto-to-assign", "license": "MIT", @@ -12,14 +12,14 @@ "babel-plugin" ], "dependencies": { - "@babel/helper-plugin-utils": "^7.0.0", + "@babel/helper-plugin-utils": "^7.8.3", "lodash": "^4.17.13" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.5.5", - "@babel/helper-plugin-test-runner": "^7.0.0" + "@babel/core": "^7.8.3", + "@babel/helper-plugin-test-runner": "^7.8.3" } } diff --git a/packages/babel-plugin-transform-react-constant-elements/package.json b/packages/babel-plugin-transform-react-constant-elements/package.json index fd4533b2adba..acc397fd99cd 100644 --- a/packages/babel-plugin-transform-react-constant-elements/package.json +++ b/packages/babel-plugin-transform-react-constant-elements/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-transform-react-constant-elements", - "version": "7.5.0", + "version": "7.9.0", "description": "Treat React JSX elements as value types and hoist them to the highest scope", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-react-constant-elements", "license": "MIT", @@ -12,14 +12,13 @@ "babel-plugin" ], "dependencies": { - "@babel/helper-annotate-as-pure": "^7.0.0", - "@babel/helper-plugin-utils": "^7.0.0" + "@babel/helper-plugin-utils": "^7.8.3" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.5.0", - "@babel/helper-plugin-test-runner": "^7.0.0" + "@babel/core": "^7.9.0", + "@babel/helper-plugin-test-runner": "^7.8.3" } } diff --git a/packages/babel-plugin-transform-react-constant-elements/src/index.js b/packages/babel-plugin-transform-react-constant-elements/src/index.js index 15589bd808f0..4d434bdc3aea 100644 --- a/packages/babel-plugin-transform-react-constant-elements/src/index.js +++ b/packages/babel-plugin-transform-react-constant-elements/src/index.js @@ -1,6 +1,5 @@ import { declare } from "@babel/helper-plugin-utils"; import { types as t } from "@babel/core"; -import annotateAsPure from "@babel/helper-annotate-as-pure"; export default declare((api, options) => { api.assertVersion(7); @@ -59,7 +58,8 @@ export default declare((api, options) => { const { value } = expressionResult; const isMutable = (!state.mutablePropsAllowed && - (value && typeof value === "object")) || + value && + typeof value === "object") || typeof value === "function"; if (!isMutable) { // It evaluated to an immutable value, so we can hoist it. @@ -106,13 +106,7 @@ export default declare((api, options) => { // Traverse all props passed to this element for immutability. path.traverse(immutabilityVisitor, state); - if (state.isImmutable) { - const hoisted = path.hoist(); - - if (hoisted) { - annotateAsPure(hoisted); - } - } + if (state.isImmutable) path.hoist(); }, }, }; diff --git a/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/append-to-end-when-declared-in-scope-2/output.mjs b/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/append-to-end-when-declared-in-scope-2/output.mjs index e44a4b518dc9..5f4d4762cf4f 100644 --- a/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/append-to-end-when-declared-in-scope-2/output.mjs +++ b/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/append-to-end-when-declared-in-scope-2/output.mjs @@ -1,14 +1,10 @@ -var _ref = -/*#__PURE__*/ -
child
; +var _ref =
child
; const AppItem = () => { return _ref; }; -var _ref2 = -/*#__PURE__*/ -
+var _ref2 =

Parent

; diff --git a/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/append-to-end-when-declared-in-scope-3/output.js b/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/append-to-end-when-declared-in-scope-3/output.js index 602d3eb3b184..5b5fdfbf7731 100644 --- a/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/append-to-end-when-declared-in-scope-3/output.js +++ b/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/append-to-end-when-declared-in-scope-3/output.js @@ -1,10 +1,6 @@ -var _ref2 = -/*#__PURE__*/ -
child
; +var _ref2 =
child
; -var _ref3 = -/*#__PURE__*/ -

Parent

; +var _ref3 =

Parent

; (function () { class App extends React.Component { @@ -17,9 +13,7 @@ var _ref3 = const AppItem = () => { return _ref2; }, - _ref = - /*#__PURE__*/ -
+ _ref =
{_ref3}
; diff --git a/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/append-to-end-when-declared-in-scope-4/output.js b/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/append-to-end-when-declared-in-scope-4/output.js index 21fa63efbd88..7088d18dca32 100644 --- a/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/append-to-end-when-declared-in-scope-4/output.js +++ b/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/append-to-end-when-declared-in-scope-4/output.js @@ -1,19 +1,13 @@ -var _ref = -/*#__PURE__*/ -
child
; +var _ref =
child
; -var _ref3 = -/*#__PURE__*/ -

Parent

; +var _ref3 =

Parent

; (function () { const AppItem = () => { return _ref; }; - var _ref2 = - /*#__PURE__*/ -
+ var _ref2 =
{_ref3}
; diff --git a/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/append-to-end-when-declared-in-scope/output.mjs b/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/append-to-end-when-declared-in-scope/output.mjs index 730a99a08cd8..e7f8ea322a44 100644 --- a/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/append-to-end-when-declared-in-scope/output.mjs +++ b/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/append-to-end-when-declared-in-scope/output.mjs @@ -5,16 +5,12 @@ export default class App extends React.Component { } -var _ref2 = -/*#__PURE__*/ -
child
; +var _ref2 =
child
; const AppItem = () => { return _ref2; }, - _ref = -/*#__PURE__*/ -
+ _ref =

Parent

; diff --git a/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/children/output.js b/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/children/output.js index b341d7309f56..9f725b28e808 100644 --- a/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/children/output.js +++ b/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/children/output.js @@ -1,6 +1,4 @@ -var _ref = -/*#__PURE__*/ -; +var _ref = ; var Foo = React.createClass({ render: function () { diff --git a/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/class-assign-unreferenced-param-deopt/output.mjs b/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/class-assign-unreferenced-param-deopt/output.mjs index a57a8005bedc..cb11c5579d5b 100644 --- a/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/class-assign-unreferenced-param-deopt/output.mjs +++ b/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/class-assign-unreferenced-param-deopt/output.mjs @@ -1,8 +1,6 @@ import React from 'react'; // Regression test for https://github.com/babel/babel/issues/5552 -var _ref = -/*#__PURE__*/ -
; +var _ref =
; class BugReport extends React.Component { constructor(...args) { diff --git a/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/compound-assignment/output.mjs b/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/compound-assignment/output.mjs index 3f305943f7bb..ed30e4854564 100644 --- a/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/compound-assignment/output.mjs +++ b/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/compound-assignment/output.mjs @@ -1,13 +1,9 @@ import React from 'react'; import Loader from 'loader'; -var _ref = -/*#__PURE__*/ -; +var _ref = ; -var _ref2 = -/*#__PURE__*/ -; +var _ref2 = ; const errorComesHere = () => _ref, thisWorksFine = () => _ref2; diff --git a/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/constructor/output.js b/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/constructor/output.js index ff7176d24ff8..e3e86ae68d6e 100644 --- a/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/constructor/output.js +++ b/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/constructor/output.js @@ -1,8 +1,6 @@ var Foo = require("Foo"); -var _ref = -/*#__PURE__*/ -; +var _ref = ; function render() { return _ref; diff --git a/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/deep-constant-violation/output.js b/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/deep-constant-violation/output.js index 482d9ccbc4dc..325f0daf7c80 100644 --- a/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/deep-constant-violation/output.js +++ b/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/deep-constant-violation/output.js @@ -1,10 +1,6 @@ -var _ref = -/*#__PURE__*/ -; +var _ref = ; -var _ref2 = -/*#__PURE__*/ -; +var _ref2 = ; function render() { var children = _ref; diff --git a/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/deopt-mutable-complex/input.mjs b/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/deopt-mutable-complex/input.mjs new file mode 100644 index 000000000000..d55eaf7cd0ec --- /dev/null +++ b/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/deopt-mutable-complex/input.mjs @@ -0,0 +1,10 @@ +let foo = 'hello'; + +const mutate = () => { + foo = 'goodbye'; +} + +export const Component = () => { + if (Math.random() > 0.5) mutate(); + return {foo}; +}; diff --git a/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/deopt-mutable-complex/output.mjs b/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/deopt-mutable-complex/output.mjs new file mode 100644 index 000000000000..83c8f677226e --- /dev/null +++ b/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/deopt-mutable-complex/output.mjs @@ -0,0 +1,10 @@ +let foo = 'hello'; + +const mutate = () => { + foo = 'goodbye'; +}; + +export const Component = () => { + if (Math.random() > 0.5) mutate(); + return {foo}; +}; diff --git a/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/deopt-mutable/input.mjs b/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/deopt-mutable/input.mjs new file mode 100644 index 000000000000..1225d11e87eb --- /dev/null +++ b/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/deopt-mutable/input.mjs @@ -0,0 +1,6 @@ +let foo = 'hello'; + +export const Component = () => { + foo = 'goodbye'; + return {foo}; +}; diff --git a/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/deopt-mutable/output.mjs b/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/deopt-mutable/output.mjs new file mode 100644 index 000000000000..dd266a198d47 --- /dev/null +++ b/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/deopt-mutable/output.mjs @@ -0,0 +1,5 @@ +let foo = 'hello'; +export const Component = () => { + foo = 'goodbye'; + return {foo}; +}; diff --git a/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/dont-hoist-before-class/output.mjs b/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/dont-hoist-before-class/output.mjs index 3cab082e24b8..060811816d12 100644 --- a/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/dont-hoist-before-class/output.mjs +++ b/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/dont-hoist-before-class/output.mjs @@ -4,15 +4,11 @@ const Parent = ({}) => _ref; export default Parent; -var _ref2 = -/*#__PURE__*/ -
+var _ref2 =
ChildTextContent
; let Child = () => _ref2, - _ref = -/*#__PURE__*/ -
+ _ref =
; diff --git a/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/dont-hoist-before-declaration/output.js b/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/dont-hoist-before-declaration/output.js index a8a3c7e28599..878e19404bce 100644 --- a/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/dont-hoist-before-declaration/output.js +++ b/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/dont-hoist-before-declaration/output.js @@ -1,8 +1,6 @@ function render() { const bar = "bar", - _ref = - /*#__PURE__*/ - , + _ref = , renderFoo = () => _ref; return renderFoo(); @@ -12,9 +10,7 @@ function render() { const bar = "bar", renderFoo = () => _ref2, baz = "baz", - _ref2 = - /*#__PURE__*/ - ; + _ref2 = ; return renderFoo(); } diff --git a/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/dont-hoist-before-default-params-2/output.js b/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/dont-hoist-before-default-params-2/output.js index fccc84ff7b1d..86a47eb10a31 100644 --- a/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/dont-hoist-before-default-params-2/output.js +++ b/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/dont-hoist-before-default-params-2/output.js @@ -1,9 +1,7 @@ function render() { var title = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ''; - var _ref = - /*#__PURE__*/ - ; + var _ref = ; return () => _ref; } diff --git a/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/dont-hoist-before-default-params/output.js b/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/dont-hoist-before-default-params/output.js index 93a36e512ca6..6780bc3d8930 100644 --- a/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/dont-hoist-before-default-params/output.js +++ b/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/dont-hoist-before-default-params/output.js @@ -1,8 +1,6 @@ function render(Component) { var text = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '', - _ref = - /*#__PURE__*/ - ; + _ref = ; return function () { return _ref; diff --git a/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/dont-hoist-before-hoc/output.mjs b/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/dont-hoist-before-hoc/output.mjs index 105e9ef2a580..d1521a3baf4b 100644 --- a/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/dont-hoist-before-hoc/output.mjs +++ b/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/dont-hoist-before-hoc/output.mjs @@ -6,9 +6,7 @@ const Parent = ({}) => _ref; export default Parent; -var _ref2 = -/*#__PURE__*/ -
+var _ref2 =
ChildTextContent
; @@ -16,8 +14,6 @@ let Child = () => _ref2; Child = HOC(Child); -var _ref = -/*#__PURE__*/ -
+var _ref =
; diff --git a/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/function-parameter/output.js b/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/function-parameter/output.js index 9aa0a32a4848..0e737624dad5 100644 --- a/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/function-parameter/output.js +++ b/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/function-parameter/output.js @@ -1,7 +1,5 @@ function render(text) { - var _ref = - /*#__PURE__*/ - {text}; + var _ref = {text}; return function () { return _ref; @@ -11,9 +9,7 @@ function render(text) { var Foo2 = require("Foo"); function createComponent(text) { - var _ref2 = - /*#__PURE__*/ - {text}; + var _ref2 = {text}; return function render() { return _ref2; diff --git a/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/global-reference/output.js b/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/global-reference/output.js index 0e89a63b8f0d..2bfa9cf8e676 100644 --- a/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/global-reference/output.js +++ b/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/global-reference/output.js @@ -1,6 +1,4 @@ -var _ref = -/*#__PURE__*/ -
; +var _ref =
; var Foo = React.createClass({ render: function render() { diff --git a/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/html-element/output.js b/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/html-element/output.js index 68181887a482..7ec3220a51ab 100644 --- a/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/html-element/output.js +++ b/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/html-element/output.js @@ -1,14 +1,10 @@ -var _ref = -/*#__PURE__*/ -; +var _ref = ; function render() { return _ref; } -var _ref2 = -/*#__PURE__*/ -
; +var _ref2 =
; function render() { return _ref2; diff --git a/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/inline-elements/output.js b/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/inline-elements/output.js index 27a2ad4df045..488564b4a34c 100644 --- a/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/inline-elements/output.js +++ b/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/inline-elements/output.js @@ -1,10 +1,8 @@ var REACT_ELEMENT_TYPE; -function _jsx(type, props, key, children) { if (!REACT_ELEMENT_TYPE) { REACT_ELEMENT_TYPE = typeof Symbol === "function" && Symbol["for"] && Symbol["for"]("react.element") || 0xeac7; } var defaultProps = type && type.defaultProps; var childrenLength = arguments.length - 3; if (!props && childrenLength !== 0) { props = { children: void 0 }; } if (props && defaultProps) { for (var propName in defaultProps) { if (props[propName] === void 0) { props[propName] = defaultProps[propName]; } } } else if (!props) { props = defaultProps || {}; } if (childrenLength === 1) { props.children = children; } else if (childrenLength > 1) { var childArray = new Array(childrenLength); for (var i = 0; i < childrenLength; i++) { childArray[i] = arguments[i + 3]; } props.children = childArray; } return { $$typeof: REACT_ELEMENT_TYPE, type: type, key: key === undefined ? null : '' + key, ref: null, props: props, _owner: null }; } +function _jsx(type, props, key, children) { if (!REACT_ELEMENT_TYPE) { REACT_ELEMENT_TYPE = typeof Symbol === "function" && Symbol["for"] && Symbol["for"]("react.element") || 0xeac7; } var defaultProps = type && type.defaultProps; var childrenLength = arguments.length - 3; if (!props && childrenLength !== 0) { props = { children: void 0 }; } if (childrenLength === 1) { props.children = children; } else if (childrenLength > 1) { var childArray = new Array(childrenLength); for (var i = 0; i < childrenLength; i++) { childArray[i] = arguments[i + 3]; } props.children = childArray; } if (props && defaultProps) { for (var propName in defaultProps) { if (props[propName] === void 0) { props[propName] = defaultProps[propName]; } } } else if (!props) { props = defaultProps || {}; } return { $$typeof: REACT_ELEMENT_TYPE, type: type, key: key === undefined ? null : '' + key, ref: null, props: props, _owner: null }; } -var _ref = -/*#__PURE__*/ -_jsx("foo", {}); +var _ref = /*#__PURE__*/_jsx("foo", {}); function render() { return _ref; @@ -13,9 +11,7 @@ function render() { function render() { var text = getText(); - var _ref2 = - /*#__PURE__*/ - _jsx("foo", {}, void 0, text); + var _ref2 = /*#__PURE__*/_jsx("foo", {}, void 0, text); return function () { return _ref2; diff --git a/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/inner-declaration/output.js b/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/inner-declaration/output.js index 0175f703f8a8..b0e2cde1adf9 100644 --- a/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/inner-declaration/output.js +++ b/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/inner-declaration/output.js @@ -1,9 +1,7 @@ function render() { var text = getText(); - var _ref = - /*#__PURE__*/ - {text}; + var _ref = {text}; return function () { return _ref; diff --git a/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/member-expression-constant/output.js b/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/member-expression-constant/output.js index ff03fb77d1b2..aa7a9994baeb 100644 --- a/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/member-expression-constant/output.js +++ b/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/member-expression-constant/output.js @@ -1,9 +1,7 @@ function render() { this.component = "div"; - var _ref = - /*#__PURE__*/ - ; + var _ref = ; return () => _ref; } diff --git a/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/member-expression-this/output.js b/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/member-expression-this/output.js index 5e976810ed9f..b9e52e3a52ab 100644 --- a/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/member-expression-this/output.js +++ b/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/member-expression-this/output.js @@ -1,6 +1,4 @@ -var _ref = -/*#__PURE__*/ -Sub Component; +var _ref = Sub Component; class Component extends React.Component { constructor(...args) { @@ -8,9 +6,7 @@ class Component extends React.Component { this.subComponent = () => _ref; - var _ref2 = - /*#__PURE__*/ - ; + var _ref2 = ; this.render = () => _ref2; } diff --git a/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/member-expression/output.js b/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/member-expression/output.js index eb5e7d23e1eb..96fc93c58dee 100644 --- a/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/member-expression/output.js +++ b/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/member-expression/output.js @@ -1,14 +1,10 @@ -var _ref = -/*#__PURE__*/ -Sub Component; +var _ref = Sub Component; const els = { subComponent: () => _ref }; -var _ref2 = -/*#__PURE__*/ -; +var _ref2 = ; class Component extends React.Component { constructor(...args) { diff --git a/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/param-and-var/output.js b/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/param-and-var/output.js index 0060b3149672..599a2b929768 100644 --- a/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/param-and-var/output.js +++ b/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/param-and-var/output.js @@ -1,8 +1,6 @@ function fn(Component, obj) { var data = obj.data, - _ref = - /*#__PURE__*/ - ; + _ref = ; return () => _ref; } diff --git a/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/parameter-destructure-multi/output.js b/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/parameter-destructure-multi/output.js index 8b89a78b032b..c039c14143f5 100644 --- a/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/parameter-destructure-multi/output.js +++ b/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/parameter-destructure-multi/output.js @@ -3,9 +3,7 @@ function render(_ref) { className = _ref.className, id = _ref.id; - var _ref2 = - /*#__PURE__*/ - ; + var _ref2 = ; return () => _ref2; } diff --git a/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/parameter-destructure-rest/options.json b/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/parameter-destructure-rest/options.json index 1b0cc13a7a3f..01101cd37ccb 100644 --- a/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/parameter-destructure-rest/options.json +++ b/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/parameter-destructure-rest/options.json @@ -3,7 +3,6 @@ "transform-destructuring", "transform-parameters", "transform-spread", - "syntax-object-rest-spread", "transform-react-constant-elements", "syntax-jsx", "external-helpers" diff --git a/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/parameter-destructure-rest/output.js b/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/parameter-destructure-rest/output.js index c457d2415822..a00f73f6f44f 100644 --- a/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/parameter-destructure-rest/output.js +++ b/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/parameter-destructure-rest/output.js @@ -4,9 +4,7 @@ function render(_ref) { id = _ref.id, props = babelHelpers.objectWithoutProperties(_ref, ["text", "className", "id"]); - var _ref2 = - /*#__PURE__*/ - ; + var _ref2 = ; // intentionally ignoring props return () => _ref2; diff --git a/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/parameter-destructure-spread-deopt/options.json b/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/parameter-destructure-spread-deopt/options.json index 1b0cc13a7a3f..01101cd37ccb 100644 --- a/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/parameter-destructure-spread-deopt/options.json +++ b/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/parameter-destructure-spread-deopt/options.json @@ -3,7 +3,6 @@ "transform-destructuring", "transform-parameters", "transform-spread", - "syntax-object-rest-spread", "transform-react-constant-elements", "syntax-jsx", "external-helpers" diff --git a/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/parameter-destructure/output.js b/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/parameter-destructure/output.js index f890296a95d6..272a607c98cc 100644 --- a/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/parameter-destructure/output.js +++ b/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/parameter-destructure/output.js @@ -1,9 +1,7 @@ function render(_ref) { let text = _ref.text; - var _ref2 = - /*#__PURE__*/ - ; + var _ref2 = ; return () => _ref2; } diff --git a/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/parameter-reference/output.js b/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/parameter-reference/output.js index 00492afc72d9..bec3e3499344 100644 --- a/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/parameter-reference/output.js +++ b/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/parameter-reference/output.js @@ -1,7 +1,5 @@ function render(text) { - var _ref = - /*#__PURE__*/ -
{text}
; + var _ref =
{text}
; return function () { return _ref; diff --git a/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/pure-expression-2/output.js b/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/pure-expression-2/output.js index 0e6144849ed0..71dfc286ceb0 100644 --- a/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/pure-expression-2/output.js +++ b/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/pure-expression-2/output.js @@ -1,7 +1,5 @@ function render(offset) { - var _ref = - /*#__PURE__*/ -
; + var _ref =
; return function () { return _ref; diff --git a/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/pure-expression-3/output.js b/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/pure-expression-3/output.js index 41fa9cc9d389..79c8b1db9907 100644 --- a/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/pure-expression-3/output.js +++ b/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/pure-expression-3/output.js @@ -1,8 +1,6 @@ const OFFSET = 3; -var _ref = -/*#__PURE__*/ -
; +var _ref =
; var Foo = React.createClass({ render: function () { diff --git a/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/pure-expression-whitelist-member/output.mjs b/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/pure-expression-whitelist-member/output.mjs index 255829f6ab96..1452baefa3a7 100644 --- a/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/pure-expression-whitelist-member/output.mjs +++ b/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/pure-expression-whitelist-member/output.mjs @@ -1,8 +1,6 @@ import Intl from 'react-intl'; -var _ref = -/*#__PURE__*/ -; diff --git a/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/pure-expression-whitelist/output.js b/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/pure-expression-whitelist/output.js index 49e73a566362..9df27d0157b4 100644 --- a/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/pure-expression-whitelist/output.js +++ b/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/pure-expression-whitelist/output.js @@ -1,6 +1,4 @@ -var _ref = -/*#__PURE__*/ -; diff --git a/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/pure-expression/output.js b/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/pure-expression/output.js index 81c65bf5eddf..957dc4a8a21b 100644 --- a/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/pure-expression/output.js +++ b/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/pure-expression/output.js @@ -1,6 +1,4 @@ -var _ref = -/*#__PURE__*/ -
; +var _ref =
; var Foo = React.createClass({ render: function () { diff --git a/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/reassignment/output.js b/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/reassignment/output.js index 48b45690df71..9eb9d792f143 100644 --- a/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/reassignment/output.js +++ b/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/reassignment/output.js @@ -1,9 +1,7 @@ function render(text) { text += "yes"; - var _ref = - /*#__PURE__*/ -
{text}
; + var _ref =
{text}
; return function () { return _ref; diff --git a/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/regression-node-type-export-default/output.mjs b/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/regression-node-type-export-default/output.mjs index 285010c07551..d85957714c53 100644 --- a/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/regression-node-type-export-default/output.mjs +++ b/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/regression-node-type-export-default/output.mjs @@ -7,6 +7,4 @@ class A { export default class B {} -var _ref = -/*#__PURE__*/ -React.createElement(B, null); +var _ref = /*#__PURE__*/React.createElement(B, null); diff --git a/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/regression-node-type-export/output.mjs b/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/regression-node-type-export/output.mjs index 1192322d7be8..2240e0bc5c8f 100644 --- a/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/regression-node-type-export/output.mjs +++ b/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/regression-node-type-export/output.mjs @@ -7,6 +7,4 @@ class A { export class B {} -var _ref = -/*#__PURE__*/ -React.createElement(B, null); +var _ref = /*#__PURE__*/React.createElement(B, null); diff --git a/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/text-children/output.js b/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/text-children/output.js index dc358b421fe2..43898f741313 100644 --- a/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/text-children/output.js +++ b/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/text-children/output.js @@ -1,6 +1,4 @@ -var _ref = -/*#__PURE__*/ -
+var _ref =
Text
; diff --git a/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/var/output.js b/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/var/output.js index 0c7bcb7eb2aa..a0bf6d783bed 100644 --- a/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/var/output.js +++ b/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/var/output.js @@ -1,8 +1,6 @@ function fn(Component) { var data = "prop", - _ref = - /*#__PURE__*/ - ; + _ref = ; return () => _ref; } diff --git a/packages/babel-plugin-transform-react-display-name/package.json b/packages/babel-plugin-transform-react-display-name/package.json index 97aa1609d217..1932b063bf8b 100644 --- a/packages/babel-plugin-transform-react-display-name/package.json +++ b/packages/babel-plugin-transform-react-display-name/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-transform-react-display-name", - "version": "7.2.0", + "version": "7.8.3", "description": "Add displayName to React.createClass calls", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-react-display-name", "license": "MIT", @@ -12,13 +12,13 @@ "babel-plugin" ], "dependencies": { - "@babel/helper-plugin-utils": "^7.0.0" + "@babel/helper-plugin-utils": "^7.8.3" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.2.0", - "@babel/helper-plugin-test-runner": "^7.0.0" + "@babel/core": "^7.8.3", + "@babel/helper-plugin-test-runner": "^7.8.3" } } diff --git a/packages/babel-plugin-transform-react-inline-elements/package.json b/packages/babel-plugin-transform-react-inline-elements/package.json index fe32f272e543..87e2a8175883 100644 --- a/packages/babel-plugin-transform-react-inline-elements/package.json +++ b/packages/babel-plugin-transform-react-inline-elements/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-transform-react-inline-elements", - "version": "7.2.0", + "version": "7.9.0", "description": "Turn JSX elements into exploded React objects", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-react-inline-elements", "license": "MIT", @@ -12,14 +12,14 @@ "babel-plugin" ], "dependencies": { - "@babel/helper-builder-react-jsx": "^7.0.0", - "@babel/helper-plugin-utils": "^7.0.0" + "@babel/helper-builder-react-jsx": "^7.9.0", + "@babel/helper-plugin-utils": "^7.8.3" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.2.0", - "@babel/helper-plugin-test-runner": "^7.0.0" + "@babel/core": "^7.9.0", + "@babel/helper-plugin-test-runner": "^7.8.3" } } diff --git a/packages/babel-plugin-transform-react-inline-elements/src/index.js b/packages/babel-plugin-transform-react-inline-elements/src/index.js index ab81b6b51a06..925d46032c4f 100644 --- a/packages/babel-plugin-transform-react-inline-elements/src/index.js +++ b/packages/babel-plugin-transform-react-inline-elements/src/index.js @@ -62,6 +62,8 @@ export default declare(api => { if (!hasKey && state.args.length > 2) { state.args.splice(2, 0, t.unaryExpression("void", t.numericLiteral(0))); } + + state.pure = true; }, }); return { diff --git a/packages/babel-plugin-transform-react-inline-elements/test/fixtures/inline-elements/children-exists/output.js b/packages/babel-plugin-transform-react-inline-elements/test/fixtures/inline-elements/children-exists/output.js index 3aacdd9605c3..a09478386d26 100644 --- a/packages/babel-plugin-transform-react-inline-elements/test/fixtures/inline-elements/children-exists/output.js +++ b/packages/babel-plugin-transform-react-inline-elements/test/fixtures/inline-elements/children-exists/output.js @@ -1,3 +1,4 @@ +/*#__PURE__*/ babelHelpers.jsx("div", { children: "foo" }, void 0, "bar"); diff --git a/packages/babel-plugin-transform-react-inline-elements/test/fixtures/inline-elements/component-with-props/output.js b/packages/babel-plugin-transform-react-inline-elements/test/fixtures/inline-elements/component-with-props/output.js index a512d982d331..fdfed4e48814 100644 --- a/packages/babel-plugin-transform-react-inline-elements/test/fixtures/inline-elements/component-with-props/output.js +++ b/packages/babel-plugin-transform-react-inline-elements/test/fixtures/inline-elements/component-with-props/output.js @@ -1,3 +1,4 @@ +/*#__PURE__*/ babelHelpers.jsx(Baz, { foo: "bar" }); diff --git a/packages/babel-plugin-transform-react-inline-elements/test/fixtures/inline-elements/component/output.js b/packages/babel-plugin-transform-react-inline-elements/test/fixtures/inline-elements/component/output.js index 0e606e15ed55..54489a5a9b8e 100644 --- a/packages/babel-plugin-transform-react-inline-elements/test/fixtures/inline-elements/component/output.js +++ b/packages/babel-plugin-transform-react-inline-elements/test/fixtures/inline-elements/component/output.js @@ -1 +1,2 @@ +/*#__PURE__*/ babelHelpers.jsx(Baz, {}); diff --git a/packages/babel-plugin-transform-react-inline-elements/test/fixtures/inline-elements/expression-container/output.js b/packages/babel-plugin-transform-react-inline-elements/test/fixtures/inline-elements/expression-container/output.js index 0b5a3dbe8dc4..2052b4b8a5b5 100644 --- a/packages/babel-plugin-transform-react-inline-elements/test/fixtures/inline-elements/expression-container/output.js +++ b/packages/babel-plugin-transform-react-inline-elements/test/fixtures/inline-elements/expression-container/output.js @@ -1,6 +1,6 @@ var TestComponent = React.createClass({ render: function () { - return babelHelpers.jsx("span", { + return /*#__PURE__*/babelHelpers.jsx("span", { className: this.props.someProp }); } diff --git a/packages/babel-plugin-transform-react-inline-elements/test/fixtures/inline-elements/fragment/output.js b/packages/babel-plugin-transform-react-inline-elements/test/fixtures/inline-elements/fragment/output.js index 55fbad164bcb..ef11b9ecda4a 100644 --- a/packages/babel-plugin-transform-react-inline-elements/test/fixtures/inline-elements/fragment/output.js +++ b/packages/babel-plugin-transform-react-inline-elements/test/fixtures/inline-elements/fragment/output.js @@ -1 +1,2 @@ -React.createElement(React.Fragment, null, babelHelpers.jsx("span", {}), babelHelpers.jsx("div", {})); +/*#__PURE__*/ +React.createElement(React.Fragment, null, /*#__PURE__*/babelHelpers.jsx("span", {}), /*#__PURE__*/babelHelpers.jsx("div", {})); diff --git a/packages/babel-plugin-transform-react-inline-elements/test/fixtures/inline-elements/html-element-with-props/output.js b/packages/babel-plugin-transform-react-inline-elements/test/fixtures/inline-elements/html-element-with-props/output.js index abff32a5b508..c1d0af001c11 100644 --- a/packages/babel-plugin-transform-react-inline-elements/test/fixtures/inline-elements/html-element-with-props/output.js +++ b/packages/babel-plugin-transform-react-inline-elements/test/fixtures/inline-elements/html-element-with-props/output.js @@ -1,3 +1,4 @@ +/*#__PURE__*/ babelHelpers.jsx("foo", { bar: "foo" }); diff --git a/packages/babel-plugin-transform-react-inline-elements/test/fixtures/inline-elements/html-element/output.js b/packages/babel-plugin-transform-react-inline-elements/test/fixtures/inline-elements/html-element/output.js index 39a91f19d852..e7dd64e8abed 100644 --- a/packages/babel-plugin-transform-react-inline-elements/test/fixtures/inline-elements/html-element/output.js +++ b/packages/babel-plugin-transform-react-inline-elements/test/fixtures/inline-elements/html-element/output.js @@ -1 +1,2 @@ +/*#__PURE__*/ babelHelpers.jsx("foo", {}); diff --git a/packages/babel-plugin-transform-react-inline-elements/test/fixtures/inline-elements/key-computed/output.js b/packages/babel-plugin-transform-react-inline-elements/test/fixtures/inline-elements/key-computed/output.js index 64a65e8256c7..27854ce106d9 100644 --- a/packages/babel-plugin-transform-react-inline-elements/test/fixtures/inline-elements/key-computed/output.js +++ b/packages/babel-plugin-transform-react-inline-elements/test/fixtures/inline-elements/key-computed/output.js @@ -1,3 +1,4 @@ +/*#__PURE__*/ babelHelpers.jsx(Foo, { "data-value": "bar" }, "foo" + "baz"); diff --git a/packages/babel-plugin-transform-react-inline-elements/test/fixtures/inline-elements/key/output.js b/packages/babel-plugin-transform-react-inline-elements/test/fixtures/inline-elements/key/output.js index 6b049a75bd90..03cff11c9be9 100644 --- a/packages/babel-plugin-transform-react-inline-elements/test/fixtures/inline-elements/key/output.js +++ b/packages/babel-plugin-transform-react-inline-elements/test/fixtures/inline-elements/key/output.js @@ -1,3 +1,4 @@ +/*#__PURE__*/ babelHelpers.jsx(Foo, { "data-value": "bar" }, "foo"); diff --git a/packages/babel-plugin-transform-react-inline-elements/test/fixtures/inline-elements/lowercase-member-expression/output.js b/packages/babel-plugin-transform-react-inline-elements/test/fixtures/inline-elements/lowercase-member-expression/output.js index 27a9501e654d..963b0be35b1f 100644 --- a/packages/babel-plugin-transform-react-inline-elements/test/fixtures/inline-elements/lowercase-member-expression/output.js +++ b/packages/babel-plugin-transform-react-inline-elements/test/fixtures/inline-elements/lowercase-member-expression/output.js @@ -4,5 +4,5 @@ var _export = require("./export"); //index.js file function ParentComponent() { - return babelHelpers.jsx(_export.form.TestComponent, {}); + return /*#__PURE__*/babelHelpers.jsx(_export.form.TestComponent, {}); } diff --git a/packages/babel-plugin-transform-react-inline-elements/test/fixtures/inline-elements/member-expression/output.js b/packages/babel-plugin-transform-react-inline-elements/test/fixtures/inline-elements/member-expression/output.js index fa4e99bf5ea0..51e8f24077e4 100644 --- a/packages/babel-plugin-transform-react-inline-elements/test/fixtures/inline-elements/member-expression/output.js +++ b/packages/babel-plugin-transform-react-inline-elements/test/fixtures/inline-elements/member-expression/output.js @@ -7,6 +7,6 @@ exports.default = void 0; var _reactBootstrap = require("react-bootstrap"); -var _default = CustomModal = () => babelHelpers.jsx(_reactBootstrap.Modal.Header, {}, void 0, "foobar"); +var _default = CustomModal = () => /*#__PURE__*/babelHelpers.jsx(_reactBootstrap.Modal.Header, {}, void 0, "foobar"); exports.default = _default; diff --git a/packages/babel-plugin-transform-react-inline-elements/test/fixtures/inline-elements/multiline/output.js b/packages/babel-plugin-transform-react-inline-elements/test/fixtures/inline-elements/multiline/output.js index 0e606e15ed55..54489a5a9b8e 100644 --- a/packages/babel-plugin-transform-react-inline-elements/test/fixtures/inline-elements/multiline/output.js +++ b/packages/babel-plugin-transform-react-inline-elements/test/fixtures/inline-elements/multiline/output.js @@ -1 +1,2 @@ +/*#__PURE__*/ babelHelpers.jsx(Baz, {}); diff --git a/packages/babel-plugin-transform-react-inline-elements/test/fixtures/inline-elements/nested-components/output.js b/packages/babel-plugin-transform-react-inline-elements/test/fixtures/inline-elements/nested-components/output.js index 3a860d500559..b6fa7c0282e1 100644 --- a/packages/babel-plugin-transform-react-inline-elements/test/fixtures/inline-elements/nested-components/output.js +++ b/packages/babel-plugin-transform-react-inline-elements/test/fixtures/inline-elements/nested-components/output.js @@ -1,3 +1,4 @@ +/*#__PURE__*/ babelHelpers.jsx(Foo, { className: "foo" -}, void 0, bar, babelHelpers.jsx(Baz, {}, "baz")); +}, void 0, bar, /*#__PURE__*/babelHelpers.jsx(Baz, {}, "baz")); diff --git a/packages/babel-plugin-transform-react-inline-elements/test/fixtures/inline-elements/nested-html-elements/output.js b/packages/babel-plugin-transform-react-inline-elements/test/fixtures/inline-elements/nested-html-elements/output.js index 0b662168ca60..c16ba861e55f 100644 --- a/packages/babel-plugin-transform-react-inline-elements/test/fixtures/inline-elements/nested-html-elements/output.js +++ b/packages/babel-plugin-transform-react-inline-elements/test/fixtures/inline-elements/nested-html-elements/output.js @@ -1,3 +1,4 @@ +/*#__PURE__*/ babelHelpers.jsx("div", { className: "foo" }, void 0, bar); diff --git a/packages/babel-plugin-transform-react-inline-elements/test/fixtures/inline-elements/nested/output.js b/packages/babel-plugin-transform-react-inline-elements/test/fixtures/inline-elements/nested/output.js index ca0b66721a8f..98bcf8d65f20 100644 --- a/packages/babel-plugin-transform-react-inline-elements/test/fixtures/inline-elements/nested/output.js +++ b/packages/babel-plugin-transform-react-inline-elements/test/fixtures/inline-elements/nested/output.js @@ -1,3 +1,4 @@ +/*#__PURE__*/ babelHelpers.jsx("div", { className: "foo" -}, void 0, bar, babelHelpers.jsx(Baz, {}, "baz")); +}, void 0, bar, /*#__PURE__*/babelHelpers.jsx(Baz, {}, "baz")); diff --git a/packages/babel-plugin-transform-react-inline-elements/test/fixtures/inline-elements/ref-deopt/output.js b/packages/babel-plugin-transform-react-inline-elements/test/fixtures/inline-elements/ref-deopt/output.js index f0768d27155f..bd841c189317 100644 --- a/packages/babel-plugin-transform-react-inline-elements/test/fixtures/inline-elements/ref-deopt/output.js +++ b/packages/babel-plugin-transform-react-inline-elements/test/fixtures/inline-elements/ref-deopt/output.js @@ -1,3 +1,4 @@ +/*#__PURE__*/ React.createElement(Foo, { ref: "bar" }); diff --git a/packages/babel-plugin-transform-react-inline-elements/test/fixtures/inline-elements/self-closing-component-with-props/output.js b/packages/babel-plugin-transform-react-inline-elements/test/fixtures/inline-elements/self-closing-component-with-props/output.js index a512d982d331..fdfed4e48814 100644 --- a/packages/babel-plugin-transform-react-inline-elements/test/fixtures/inline-elements/self-closing-component-with-props/output.js +++ b/packages/babel-plugin-transform-react-inline-elements/test/fixtures/inline-elements/self-closing-component-with-props/output.js @@ -1,3 +1,4 @@ +/*#__PURE__*/ babelHelpers.jsx(Baz, { foo: "bar" }); diff --git a/packages/babel-plugin-transform-react-inline-elements/test/fixtures/inline-elements/self-closing-component/output.js b/packages/babel-plugin-transform-react-inline-elements/test/fixtures/inline-elements/self-closing-component/output.js index 0e606e15ed55..54489a5a9b8e 100644 --- a/packages/babel-plugin-transform-react-inline-elements/test/fixtures/inline-elements/self-closing-component/output.js +++ b/packages/babel-plugin-transform-react-inline-elements/test/fixtures/inline-elements/self-closing-component/output.js @@ -1 +1,2 @@ +/*#__PURE__*/ babelHelpers.jsx(Baz, {}); diff --git a/packages/babel-plugin-transform-react-inline-elements/test/fixtures/inline-elements/self-closing-html-element-with-props/output.js b/packages/babel-plugin-transform-react-inline-elements/test/fixtures/inline-elements/self-closing-html-element-with-props/output.js index abff32a5b508..c1d0af001c11 100644 --- a/packages/babel-plugin-transform-react-inline-elements/test/fixtures/inline-elements/self-closing-html-element-with-props/output.js +++ b/packages/babel-plugin-transform-react-inline-elements/test/fixtures/inline-elements/self-closing-html-element-with-props/output.js @@ -1,3 +1,4 @@ +/*#__PURE__*/ babelHelpers.jsx("foo", { bar: "foo" }); diff --git a/packages/babel-plugin-transform-react-inline-elements/test/fixtures/inline-elements/self-closing-html-element/output.js b/packages/babel-plugin-transform-react-inline-elements/test/fixtures/inline-elements/self-closing-html-element/output.js index 39a91f19d852..e7dd64e8abed 100644 --- a/packages/babel-plugin-transform-react-inline-elements/test/fixtures/inline-elements/self-closing-html-element/output.js +++ b/packages/babel-plugin-transform-react-inline-elements/test/fixtures/inline-elements/self-closing-html-element/output.js @@ -1 +1,2 @@ +/*#__PURE__*/ babelHelpers.jsx("foo", {}); diff --git a/packages/babel-plugin-transform-react-inline-elements/test/fixtures/inline-elements/shorthand-attributes/output.js b/packages/babel-plugin-transform-react-inline-elements/test/fixtures/inline-elements/shorthand-attributes/output.js index ffd4e433d9db..90137d5ddfe5 100644 --- a/packages/babel-plugin-transform-react-inline-elements/test/fixtures/inline-elements/shorthand-attributes/output.js +++ b/packages/babel-plugin-transform-react-inline-elements/test/fixtures/inline-elements/shorthand-attributes/output.js @@ -1,3 +1,4 @@ +/*#__PURE__*/ babelHelpers.jsx(Foo, { bar: true }); diff --git a/packages/babel-plugin-transform-react-inline-elements/test/fixtures/inline-elements/spread-deopt/output.js b/packages/babel-plugin-transform-react-inline-elements/test/fixtures/inline-elements/spread-deopt/output.js index 5672885bad36..5f16ff6ba3ea 100644 --- a/packages/babel-plugin-transform-react-inline-elements/test/fixtures/inline-elements/spread-deopt/output.js +++ b/packages/babel-plugin-transform-react-inline-elements/test/fixtures/inline-elements/spread-deopt/output.js @@ -1 +1,2 @@ +/*#__PURE__*/ React.createElement(Foo, bar); diff --git a/packages/babel-plugin-transform-react-inline-elements/test/fixtures/regressions/6276/output.js b/packages/babel-plugin-transform-react-inline-elements/test/fixtures/regressions/6276/output.js index 0eb30c15e366..229a5d2ee9af 100644 --- a/packages/babel-plugin-transform-react-inline-elements/test/fixtures/regressions/6276/output.js +++ b/packages/babel-plugin-transform-react-inline-elements/test/fixtures/regressions/6276/output.js @@ -1,3 +1,3 @@ -var test = babelHelpers.jsx(T, { +var test = /*#__PURE__*/babelHelpers.jsx(T, { default: " some string " }); diff --git a/packages/babel-plugin-transform-react-jsx-compat/package.json b/packages/babel-plugin-transform-react-jsx-compat/package.json index 87a9d5e4735e..6b890d53da07 100644 --- a/packages/babel-plugin-transform-react-jsx-compat/package.json +++ b/packages/babel-plugin-transform-react-jsx-compat/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-transform-react-jsx-compat", - "version": "7.2.0", + "version": "7.8.3", "description": "Turn JSX into React Pre-0.12 function calls", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-react-jsx-compat", "license": "MIT", @@ -12,14 +12,14 @@ "babel-plugin" ], "dependencies": { - "@babel/helper-builder-react-jsx": "^7.0.0", - "@babel/helper-plugin-utils": "^7.0.0" + "@babel/helper-builder-react-jsx": "^7.8.3", + "@babel/helper-plugin-utils": "^7.8.3" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.2.0", - "@babel/helper-plugin-test-runner": "^7.0.0" + "@babel/core": "^7.8.3", + "@babel/helper-plugin-test-runner": "^7.8.3" } } diff --git a/packages/babel-plugin-syntax-nullish-coalescing-operator/.npmignore b/packages/babel-plugin-transform-react-jsx-development/.npmignore similarity index 100% rename from packages/babel-plugin-syntax-nullish-coalescing-operator/.npmignore rename to packages/babel-plugin-transform-react-jsx-development/.npmignore diff --git a/packages/babel-plugin-transform-react-jsx-development/package.json b/packages/babel-plugin-transform-react-jsx-development/package.json new file mode 100644 index 000000000000..7cab19aebc08 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx-development/package.json @@ -0,0 +1,26 @@ +{ + "name": "@babel/plugin-transform-react-jsx-development", + "version": "7.9.0", + "description": "Turn JSX into React function calls in development", + "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-react-jsx-development", + "license": "MIT", + "publishConfig": { + "access": "public" + }, + "main": "lib/index.js", + "keywords": [ + "babel-plugin" + ], + "dependencies": { + "@babel/helper-builder-react-jsx-experimental": "^7.9.0", + "@babel/helper-plugin-utils": "^7.8.3", + "@babel/plugin-syntax-jsx": "^7.8.3" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + }, + "devDependencies": { + "@babel/core": "^7.9.0", + "@babel/helper-plugin-test-runner": "^7.8.3" + } +} diff --git a/packages/babel-plugin-transform-react-jsx-development/src/index.js b/packages/babel-plugin-transform-react-jsx-development/src/index.js new file mode 100644 index 000000000000..4fb52ad62946 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx-development/src/index.js @@ -0,0 +1,52 @@ +import jsx from "@babel/plugin-syntax-jsx"; +import { helper } from "@babel/helper-builder-react-jsx-experimental"; +import { declare } from "@babel/helper-plugin-utils"; +import { types as t } from "@babel/core"; + +export default declare((api, options) => { + const PURE_ANNOTATION = options.pure; + + const visitor = helper(api, { + pre(state) { + const tagName = state.tagName; + const args = state.args; + if (t.react.isCompatTag(tagName)) { + args.push(t.stringLiteral(tagName)); + } else { + args.push(state.tagExpr); + } + }, + + post(state, pass) { + if (pass.get("@babel/plugin-react-jsx/runtime") === "classic") { + state.createElementCallee = pass.get( + "@babel/plugin-react-jsx/createElementIdentifier", + )(); + + state.pure = + PURE_ANNOTATION ?? !pass.get("@babel/plugin-react-jsx/pragmaSet"); + } else { + state.jsxCallee = pass.get("@babel/plugin-react-jsx/jsxIdentifier")(); + state.jsxStaticCallee = pass.get( + "@babel/plugin-react-jsx/jsxStaticIdentifier", + )(); + state.createElementCallee = pass.get( + "@babel/plugin-react-jsx/createElementIdentifier", + )(); + + state.pure = + PURE_ANNOTATION ?? + !pass.get("@babel/plugin-react-jsx/importSourceSet"); + } + }, + + ...options, + development: true, + }); + + return { + name: "transform-react-jsx", + inherits: jsx, + visitor, + }; +}); diff --git a/packages/babel-plugin-transform-react-jsx-development/test/fixtures/linux/auto-import-dev/input.js b/packages/babel-plugin-transform-react-jsx-development/test/fixtures/linux/auto-import-dev/input.js new file mode 100644 index 000000000000..28cff700818f --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx-development/test/fixtures/linux/auto-import-dev/input.js @@ -0,0 +1,10 @@ +var x = ( + <> +
+
+
+
+
+
+ +); diff --git a/packages/babel-plugin-transform-react-jsx-development/test/fixtures/linux/auto-import-dev/options.json b/packages/babel-plugin-transform-react-jsx-development/test/fixtures/linux/auto-import-dev/options.json new file mode 100644 index 000000000000..3773ed52bde8 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx-development/test/fixtures/linux/auto-import-dev/options.json @@ -0,0 +1,5 @@ +{ + "plugins": ["transform-react-jsx-development"], + "sourceType": "module", + "os": ["linux", "darwin"] +} diff --git a/packages/babel-plugin-transform-react-jsx-development/test/fixtures/linux/auto-import-dev/output.mjs b/packages/babel-plugin-transform-react-jsx-development/test/fixtures/linux/auto-import-dev/output.mjs new file mode 100644 index 000000000000..dcdeec458630 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx-development/test/fixtures/linux/auto-import-dev/output.mjs @@ -0,0 +1,36 @@ +import { createElement as _createElement } from "react"; +import { jsxDEV as _jsxDEV } from "react/jsx-dev-runtime"; +import { Fragment as _Fragment } from "react/jsx-dev-runtime"; +var _jsxFileName = "/packages/babel-plugin-transform-react-jsx-development/test/fixtures/linux/auto-import-dev/input.js"; + +var x = /*#__PURE__*/_jsxDEV(_Fragment, { + children: /*#__PURE__*/_jsxDEV("div", { + children: [/*#__PURE__*/_jsxDEV("div", {}, "1", false, { + fileName: _jsxFileName, + lineNumber: 4, + columnNumber: 7 + }, this), /*#__PURE__*/_jsxDEV("div", { + meow: "wolf" + }, "2", false, { + fileName: _jsxFileName, + lineNumber: 5, + columnNumber: 7 + }, this), /*#__PURE__*/_jsxDEV("div", {}, "3", false, { + fileName: _jsxFileName, + lineNumber: 6, + columnNumber: 7 + }, this), /*#__PURE__*/_createElement("div", { ...props, + key: "4", + __source: { + fileName: _jsxFileName, + lineNumber: 7, + columnNumber: 7 + }, + __self: this + })] + }, void 0, true, { + fileName: _jsxFileName, + lineNumber: 3, + columnNumber: 5 + }, this) +}, void 0, false); diff --git a/packages/babel-plugin-transform-react-jsx-development/test/fixtures/linux/classic-runtime-with-source-self-plugins/input.js b/packages/babel-plugin-transform-react-jsx-development/test/fixtures/linux/classic-runtime-with-source-self-plugins/input.js new file mode 100644 index 000000000000..28cff700818f --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx-development/test/fixtures/linux/classic-runtime-with-source-self-plugins/input.js @@ -0,0 +1,10 @@ +var x = ( + <> +
+
+
+
+
+
+ +); diff --git a/packages/babel-plugin-transform-react-jsx-development/test/fixtures/linux/classic-runtime-with-source-self-plugins/options.json b/packages/babel-plugin-transform-react-jsx-development/test/fixtures/linux/classic-runtime-with-source-self-plugins/options.json new file mode 100644 index 000000000000..3d7af506b7c5 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx-development/test/fixtures/linux/classic-runtime-with-source-self-plugins/options.json @@ -0,0 +1,9 @@ +{ + "plugins": [ + ["transform-react-jsx-development", { "runtime": "classic" }], + "transform-react-jsx-source", + "transform-react-jsx-self" + ], + "os": ["linux", "darwin"], + "throws": "Duplicate __self prop found. You are most likely using the deprecated transform-react-jsx-self Babel plugin. Both __source and __self are automatically set when using the automatic runtime. Please remove transform-react-jsx-source and transform-react-jsx-self from your Babel config." +} diff --git a/packages/babel-plugin-transform-react-jsx-development/test/fixtures/linux/classic-runtime/input.js b/packages/babel-plugin-transform-react-jsx-development/test/fixtures/linux/classic-runtime/input.js new file mode 100644 index 000000000000..6f1e6e91c601 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx-development/test/fixtures/linux/classic-runtime/input.js @@ -0,0 +1,10 @@ +var x = ( + <> +
+
+
+
+
+
+ + ); \ No newline at end of file diff --git a/packages/babel-plugin-transform-react-jsx-development/test/fixtures/linux/classic-runtime/options.json b/packages/babel-plugin-transform-react-jsx-development/test/fixtures/linux/classic-runtime/options.json new file mode 100644 index 000000000000..5f1b689d655e --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx-development/test/fixtures/linux/classic-runtime/options.json @@ -0,0 +1,4 @@ +{ + "plugins": [["transform-react-jsx-development", { "runtime": "classic" }]], + "os": ["linux", "darwin"] +} diff --git a/packages/babel-plugin-transform-react-jsx-development/test/fixtures/linux/classic-runtime/output.js b/packages/babel-plugin-transform-react-jsx-development/test/fixtures/linux/classic-runtime/output.js new file mode 100644 index 000000000000..ae50081c209c --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx-development/test/fixtures/linux/classic-runtime/output.js @@ -0,0 +1,42 @@ +var _jsxFileName = "/packages/babel-plugin-transform-react-jsx-development/test/fixtures/linux/classic-runtime/input.js"; +var x = /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", { + __source: { + fileName: _jsxFileName, + lineNumber: 3, + columnNumber: 5 + }, + __self: this +}, /*#__PURE__*/React.createElement("div", { + key: "1", + __source: { + fileName: _jsxFileName, + lineNumber: 4, + columnNumber: 9 + }, + __self: this +}), /*#__PURE__*/React.createElement("div", { + key: "2", + meow: "wolf", + __source: { + fileName: _jsxFileName, + lineNumber: 5, + columnNumber: 9 + }, + __self: this +}), /*#__PURE__*/React.createElement("div", { + key: "3", + __source: { + fileName: _jsxFileName, + lineNumber: 6, + columnNumber: 9 + }, + __self: this +}), /*#__PURE__*/React.createElement("div", { ...props, + key: "4", + __source: { + fileName: _jsxFileName, + lineNumber: 7, + columnNumber: 9 + }, + __self: this +}))); diff --git a/packages/babel-plugin-transform-react-jsx-development/test/fixtures/linux/fragments/input.js b/packages/babel-plugin-transform-react-jsx-development/test/fixtures/linux/fragments/input.js new file mode 100644 index 000000000000..4b7a88337505 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx-development/test/fixtures/linux/fragments/input.js @@ -0,0 +1 @@ +var x = <>
; \ No newline at end of file diff --git a/packages/babel-plugin-transform-react-jsx-development/test/fixtures/linux/fragments/output.js b/packages/babel-plugin-transform-react-jsx-development/test/fixtures/linux/fragments/output.js new file mode 100644 index 000000000000..9f7c06bf2e6b --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx-development/test/fixtures/linux/fragments/output.js @@ -0,0 +1,11 @@ +var _reactJsxDevRuntime = require("react/jsx-dev-runtime"); + +var _jsxFileName = "/packages/babel-plugin-transform-react-jsx-development/test/fixtures/linux/fragments/input.js"; + +var x = /*#__PURE__*/_reactJsxDevRuntime.jsxDEV(_reactJsxDevRuntime.Fragment, { + children: /*#__PURE__*/_reactJsxDevRuntime.jsxDEV("div", {}, void 0, false, { + fileName: _jsxFileName, + lineNumber: 1, + columnNumber: 11 + }, this) +}, void 0, false); diff --git a/packages/babel-plugin-transform-react-jsx-development/test/fixtures/linux/handle-fragments-with-key/input.js b/packages/babel-plugin-transform-react-jsx-development/test/fixtures/linux/handle-fragments-with-key/input.js new file mode 100644 index 000000000000..c9f991d0f1bc --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx-development/test/fixtures/linux/handle-fragments-with-key/input.js @@ -0,0 +1 @@ +var x = ; diff --git a/packages/babel-plugin-transform-react-jsx-development/test/fixtures/linux/handle-fragments-with-key/output.js b/packages/babel-plugin-transform-react-jsx-development/test/fixtures/linux/handle-fragments-with-key/output.js new file mode 100644 index 000000000000..cce20f0ed3b2 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx-development/test/fixtures/linux/handle-fragments-with-key/output.js @@ -0,0 +1,9 @@ +var _reactJsxDevRuntime = require("react/jsx-dev-runtime"); + +var _jsxFileName = "/packages/babel-plugin-transform-react-jsx-development/test/fixtures/linux/handle-fragments-with-key/input.js"; + +var x = /*#__PURE__*/_reactJsxDevRuntime.jsxDEV(React.Fragment, {}, "foo", false, { + fileName: _jsxFileName, + lineNumber: 1, + columnNumber: 9 +}, this); diff --git a/packages/babel-plugin-transform-react-jsx-development/test/fixtures/linux/handle-nonstatic-children/input.js b/packages/babel-plugin-transform-react-jsx-development/test/fixtures/linux/handle-nonstatic-children/input.js new file mode 100644 index 000000000000..26223d316770 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx-development/test/fixtures/linux/handle-nonstatic-children/input.js @@ -0,0 +1 @@ +var x =
{[, ]}
; diff --git a/packages/babel-plugin-transform-react-jsx-development/test/fixtures/linux/handle-nonstatic-children/output.js b/packages/babel-plugin-transform-react-jsx-development/test/fixtures/linux/handle-nonstatic-children/output.js new file mode 100644 index 000000000000..b0fca3139a19 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx-development/test/fixtures/linux/handle-nonstatic-children/output.js @@ -0,0 +1,19 @@ +var _reactJsxDevRuntime = require("react/jsx-dev-runtime"); + +var _jsxFileName = "/packages/babel-plugin-transform-react-jsx-development/test/fixtures/linux/handle-nonstatic-children/input.js"; + +var x = /*#__PURE__*/_reactJsxDevRuntime.jsxDEV("div", { + children: [/*#__PURE__*/_reactJsxDevRuntime.jsxDEV("span", {}, "0", false, { + fileName: _jsxFileName, + lineNumber: 1, + columnNumber: 16 + }, this), /*#__PURE__*/_reactJsxDevRuntime.jsxDEV("span", {}, "1", false, { + fileName: _jsxFileName, + lineNumber: 1, + columnNumber: 36 + }, this)] +}, void 0, false, { + fileName: _jsxFileName, + lineNumber: 1, + columnNumber: 9 +}, this); diff --git a/packages/babel-plugin-transform-react-jsx-development/test/fixtures/linux/handle-static-children/input.js b/packages/babel-plugin-transform-react-jsx-development/test/fixtures/linux/handle-static-children/input.js new file mode 100644 index 000000000000..582e8568c031 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx-development/test/fixtures/linux/handle-static-children/input.js @@ -0,0 +1,6 @@ +var x = ( +
+ + {[, ]} +
+); diff --git a/packages/babel-plugin-transform-react-jsx-development/test/fixtures/linux/handle-static-children/output.js b/packages/babel-plugin-transform-react-jsx-development/test/fixtures/linux/handle-static-children/output.js new file mode 100644 index 000000000000..b0886b4fb839 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx-development/test/fixtures/linux/handle-static-children/output.js @@ -0,0 +1,23 @@ +var _reactJsxDevRuntime = require("react/jsx-dev-runtime"); + +var _jsxFileName = "/packages/babel-plugin-transform-react-jsx-development/test/fixtures/linux/handle-static-children/input.js"; + +var x = /*#__PURE__*/_reactJsxDevRuntime.jsxDEV("div", { + children: [/*#__PURE__*/_reactJsxDevRuntime.jsxDEV("span", {}, void 0, false, { + fileName: _jsxFileName, + lineNumber: 3, + columnNumber: 5 + }, this), [/*#__PURE__*/_reactJsxDevRuntime.jsxDEV("span", {}, "0", false, { + fileName: _jsxFileName, + lineNumber: 4, + columnNumber: 7 + }, this), /*#__PURE__*/_reactJsxDevRuntime.jsxDEV("span", {}, "1", false, { + fileName: _jsxFileName, + lineNumber: 4, + columnNumber: 27 + }, this)]] +}, void 0, true, { + fileName: _jsxFileName, + lineNumber: 2, + columnNumber: 3 +}, this); diff --git a/packages/babel-plugin-transform-react-jsx-development/test/fixtures/linux/options.json b/packages/babel-plugin-transform-react-jsx-development/test/fixtures/linux/options.json new file mode 100644 index 000000000000..10f3a57264bb --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx-development/test/fixtures/linux/options.json @@ -0,0 +1,9 @@ +{ + "plugins": [ + "external-helpers", + "transform-react-jsx-development", + "transform-react-display-name", + "transform-arrow-functions" + ], + "os": ["linux", "darwin"] +} diff --git a/packages/babel-plugin-transform-react-jsx-development/test/fixtures/linux/self-inside-arrow/input.mjs b/packages/babel-plugin-transform-react-jsx-development/test/fixtures/linux/self-inside-arrow/input.mjs new file mode 100644 index 000000000000..10fa67b30f61 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx-development/test/fixtures/linux/self-inside-arrow/input.mjs @@ -0,0 +1,7 @@ +
; +() =>
; + +function fn() { +
; + () =>
; +} diff --git a/packages/babel-plugin-transform-react-jsx-development/test/fixtures/linux/self-inside-arrow/output.mjs b/packages/babel-plugin-transform-react-jsx-development/test/fixtures/linux/self-inside-arrow/output.mjs new file mode 100644 index 000000000000..a7d8f61fd51a --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx-development/test/fixtures/linux/self-inside-arrow/output.mjs @@ -0,0 +1,38 @@ +import { jsxDEV as _jsxDEV } from "react/jsx-dev-runtime"; + +var _jsxFileName = "/packages/babel-plugin-transform-react-jsx-development/test/fixtures/linux/self-inside-arrow/input.mjs", + _this = this; + +/*#__PURE__*/ +_jsxDEV("div", {}, void 0, false, { + fileName: _jsxFileName, + lineNumber: 1, + columnNumber: 1 +}, this); + +(function () { + return /*#__PURE__*/_jsxDEV("div", {}, void 0, false, { + fileName: _jsxFileName, + lineNumber: 2, + columnNumber: 7 + }, _this); +}); + +function fn() { + var _this2 = this; + + /*#__PURE__*/ + _jsxDEV("div", {}, void 0, false, { + fileName: _jsxFileName, + lineNumber: 5, + columnNumber: 3 + }, this); + + (function () { + return /*#__PURE__*/_jsxDEV("div", {}, void 0, false, { + fileName: _jsxFileName, + lineNumber: 6, + columnNumber: 9 + }, _this2); + }); +} diff --git a/packages/babel-plugin-transform-react-jsx-development/test/fixtures/linux/source-and-self-defined/input.js b/packages/babel-plugin-transform-react-jsx-development/test/fixtures/linux/source-and-self-defined/input.js new file mode 100644 index 000000000000..28cff700818f --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx-development/test/fixtures/linux/source-and-self-defined/input.js @@ -0,0 +1,10 @@ +var x = ( + <> +
+
+
+
+
+
+ +); diff --git a/packages/babel-plugin-transform-react-jsx-development/test/fixtures/linux/source-and-self-defined/options.json b/packages/babel-plugin-transform-react-jsx-development/test/fixtures/linux/source-and-self-defined/options.json new file mode 100644 index 000000000000..a2be725ca1cd --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx-development/test/fixtures/linux/source-and-self-defined/options.json @@ -0,0 +1,10 @@ +{ + "plugins": [ + "transform-react-jsx-development", + "transform-react-jsx-source", + "transform-react-jsx-self" + ], + "sourceType": "module", + "os": ["linux", "darwin"], + "throws": "Duplicate __self prop found. You are most likely using the deprecated transform-react-jsx-self Babel plugin. Both __source and __self are automatically set when using the automatic runtime. Please remove transform-react-jsx-source and transform-react-jsx-self from your Babel config." +} diff --git a/packages/babel-plugin-transform-react-jsx-development/test/fixtures/windows/auto-import-dev-windows/input.js b/packages/babel-plugin-transform-react-jsx-development/test/fixtures/windows/auto-import-dev-windows/input.js new file mode 100644 index 000000000000..28cff700818f --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx-development/test/fixtures/windows/auto-import-dev-windows/input.js @@ -0,0 +1,10 @@ +var x = ( + <> +
+
+
+
+
+
+ +); diff --git a/packages/babel-plugin-transform-react-jsx-development/test/fixtures/windows/auto-import-dev-windows/options.json b/packages/babel-plugin-transform-react-jsx-development/test/fixtures/windows/auto-import-dev-windows/options.json new file mode 100644 index 000000000000..6eee73c411a2 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx-development/test/fixtures/windows/auto-import-dev-windows/options.json @@ -0,0 +1,4 @@ +{ + "plugins": ["transform-react-jsx-development"], + "sourceType": "module" +} diff --git a/packages/babel-plugin-transform-react-jsx-development/test/fixtures/windows/auto-import-dev-windows/output.mjs b/packages/babel-plugin-transform-react-jsx-development/test/fixtures/windows/auto-import-dev-windows/output.mjs new file mode 100644 index 000000000000..f77614cefd0d --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx-development/test/fixtures/windows/auto-import-dev-windows/output.mjs @@ -0,0 +1,36 @@ +import { createElement as _createElement } from "react"; +import { jsxDEV as _jsxDEV } from "react/jsx-dev-runtime"; +import { Fragment as _Fragment } from "react/jsx-dev-runtime"; +var _jsxFileName = "\\packages\\babel-plugin-transform-react-jsx-development\\test\\fixtures\\windows\\auto-import-dev-windows\\input.js"; + +var x = /*#__PURE__*/_jsxDEV(_Fragment, { + children: /*#__PURE__*/_jsxDEV("div", { + children: [/*#__PURE__*/_jsxDEV("div", {}, "1", false, { + fileName: _jsxFileName, + lineNumber: 4, + columnNumber: 7 + }, this), /*#__PURE__*/_jsxDEV("div", { + meow: "wolf" + }, "2", false, { + fileName: _jsxFileName, + lineNumber: 5, + columnNumber: 7 + }, this), /*#__PURE__*/_jsxDEV("div", {}, "3", false, { + fileName: _jsxFileName, + lineNumber: 6, + columnNumber: 7 + }, this), /*#__PURE__*/_createElement("div", { ...props, + key: "4", + __source: { + fileName: _jsxFileName, + lineNumber: 7, + columnNumber: 7 + }, + __self: this + })] + }, void 0, true, { + fileName: _jsxFileName, + lineNumber: 3, + columnNumber: 5 + }, this) +}, void 0, false); diff --git a/packages/babel-plugin-transform-react-jsx-development/test/fixtures/windows/classic-runtime-windows/input.js b/packages/babel-plugin-transform-react-jsx-development/test/fixtures/windows/classic-runtime-windows/input.js new file mode 100644 index 000000000000..28cff700818f --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx-development/test/fixtures/windows/classic-runtime-windows/input.js @@ -0,0 +1,10 @@ +var x = ( + <> +
+
+
+
+
+
+ +); diff --git a/packages/babel-plugin-transform-react-jsx-development/test/fixtures/windows/classic-runtime-windows/options.json b/packages/babel-plugin-transform-react-jsx-development/test/fixtures/windows/classic-runtime-windows/options.json new file mode 100644 index 000000000000..802b77806846 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx-development/test/fixtures/windows/classic-runtime-windows/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["transform-react-jsx-development", { "runtime": "classic" }]] +} diff --git a/packages/babel-plugin-transform-react-jsx-development/test/fixtures/windows/classic-runtime-windows/output.js b/packages/babel-plugin-transform-react-jsx-development/test/fixtures/windows/classic-runtime-windows/output.js new file mode 100644 index 000000000000..7596d192aeb5 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx-development/test/fixtures/windows/classic-runtime-windows/output.js @@ -0,0 +1,42 @@ +var _jsxFileName = "\\packages\\babel-plugin-transform-react-jsx-development\\test\\fixtures\\windows\\classic-runtime-windows\\input.js"; +var x = /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", { + __source: { + fileName: _jsxFileName, + lineNumber: 3, + columnNumber: 5 + }, + __self: this +}, /*#__PURE__*/React.createElement("div", { + key: "1", + __source: { + fileName: _jsxFileName, + lineNumber: 4, + columnNumber: 7 + }, + __self: this +}), /*#__PURE__*/React.createElement("div", { + key: "2", + meow: "wolf", + __source: { + fileName: _jsxFileName, + lineNumber: 5, + columnNumber: 7 + }, + __self: this +}), /*#__PURE__*/React.createElement("div", { + key: "3", + __source: { + fileName: _jsxFileName, + lineNumber: 6, + columnNumber: 7 + }, + __self: this +}), /*#__PURE__*/React.createElement("div", { ...props, + key: "4", + __source: { + fileName: _jsxFileName, + lineNumber: 7, + columnNumber: 7 + }, + __self: this +}))); diff --git a/packages/babel-plugin-transform-react-jsx-development/test/fixtures/windows/classic-runtime-with-source-self-plugins-windows/input.js b/packages/babel-plugin-transform-react-jsx-development/test/fixtures/windows/classic-runtime-with-source-self-plugins-windows/input.js new file mode 100644 index 000000000000..28cff700818f --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx-development/test/fixtures/windows/classic-runtime-with-source-self-plugins-windows/input.js @@ -0,0 +1,10 @@ +var x = ( + <> +
+
+
+
+
+
+ +); diff --git a/packages/babel-plugin-transform-react-jsx-development/test/fixtures/windows/classic-runtime-with-source-self-plugins-windows/options.json b/packages/babel-plugin-transform-react-jsx-development/test/fixtures/windows/classic-runtime-with-source-self-plugins-windows/options.json new file mode 100644 index 000000000000..9c71d64a534a --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx-development/test/fixtures/windows/classic-runtime-with-source-self-plugins-windows/options.json @@ -0,0 +1,9 @@ +{ + "plugins": [ + ["transform-react-jsx-development", { "runtime": "classic" }], + "transform-react-jsx-source", + "transform-react-jsx-self" + ], + "os": ["windows"], + "throws": "Duplicate __self prop found. You are most likely using the deprecated transform-react-jsx-self Babel plugin. Both __source and __self are automatically set when using the automatic runtime. Please remove transform-react-jsx-source and transform-react-jsx-self from your Babel config." +} diff --git a/packages/babel-plugin-transform-react-jsx-development/test/fixtures/windows/fragments-windows/input.js b/packages/babel-plugin-transform-react-jsx-development/test/fixtures/windows/fragments-windows/input.js new file mode 100644 index 000000000000..4b7a88337505 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx-development/test/fixtures/windows/fragments-windows/input.js @@ -0,0 +1 @@ +var x = <>
; \ No newline at end of file diff --git a/packages/babel-plugin-transform-react-jsx-development/test/fixtures/windows/fragments-windows/output.js b/packages/babel-plugin-transform-react-jsx-development/test/fixtures/windows/fragments-windows/output.js new file mode 100644 index 000000000000..9dd8a9878a37 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx-development/test/fixtures/windows/fragments-windows/output.js @@ -0,0 +1,11 @@ +var _reactJsxDevRuntime = require("react/jsx-dev-runtime"); + +var _jsxFileName = "\\packages\\babel-plugin-transform-react-jsx-development\\test\\fixtures\\windows\\fragments-windows\\input.js"; + +var x = /*#__PURE__*/_reactJsxDevRuntime.jsxDEV(_reactJsxDevRuntime.Fragment, { + children: /*#__PURE__*/_reactJsxDevRuntime.jsxDEV("div", {}, void 0, false, { + fileName: _jsxFileName, + lineNumber: 1, + columnNumber: 11 + }, this) +}, void 0, false); diff --git a/packages/babel-plugin-transform-react-jsx-development/test/fixtures/windows/handle-fragments-with-key-windows/input.js b/packages/babel-plugin-transform-react-jsx-development/test/fixtures/windows/handle-fragments-with-key-windows/input.js new file mode 100644 index 000000000000..9d4dbf1746fe --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx-development/test/fixtures/windows/handle-fragments-with-key-windows/input.js @@ -0,0 +1 @@ +var x = ; \ No newline at end of file diff --git a/packages/babel-plugin-transform-react-jsx-development/test/fixtures/windows/handle-fragments-with-key-windows/output.js b/packages/babel-plugin-transform-react-jsx-development/test/fixtures/windows/handle-fragments-with-key-windows/output.js new file mode 100644 index 000000000000..84f83813b07a --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx-development/test/fixtures/windows/handle-fragments-with-key-windows/output.js @@ -0,0 +1,9 @@ +var _reactJsxDevRuntime = require("react/jsx-dev-runtime"); + +var _jsxFileName = "\\packages\\babel-plugin-transform-react-jsx-development\\test\\fixtures\\windows\\handle-fragments-with-key-windows\\input.js"; + +var x = /*#__PURE__*/_reactJsxDevRuntime.jsxDEV(React.Fragment, {}, 'foo', false, { + fileName: _jsxFileName, + lineNumber: 1, + columnNumber: 9 +}, this); diff --git a/packages/babel-plugin-transform-react-jsx-development/test/fixtures/windows/handle-nonstatic-children-windows/input.js b/packages/babel-plugin-transform-react-jsx-development/test/fixtures/windows/handle-nonstatic-children-windows/input.js new file mode 100644 index 000000000000..c2e26f4e7d9d --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx-development/test/fixtures/windows/handle-nonstatic-children-windows/input.js @@ -0,0 +1,5 @@ +var x = ( +
+ {[, ]} +
+); \ No newline at end of file diff --git a/packages/babel-plugin-transform-react-jsx-development/test/fixtures/windows/handle-nonstatic-children-windows/output.js b/packages/babel-plugin-transform-react-jsx-development/test/fixtures/windows/handle-nonstatic-children-windows/output.js new file mode 100644 index 000000000000..50193748b4bc --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx-development/test/fixtures/windows/handle-nonstatic-children-windows/output.js @@ -0,0 +1,19 @@ +var _reactJsxDevRuntime = require("react/jsx-dev-runtime"); + +var _jsxFileName = "\\packages\\babel-plugin-transform-react-jsx-development\\test\\fixtures\\windows\\handle-nonstatic-children-windows\\input.js"; + +var x = /*#__PURE__*/_reactJsxDevRuntime.jsxDEV("div", { + children: [/*#__PURE__*/_reactJsxDevRuntime.jsxDEV("span", {}, '0', false, { + fileName: _jsxFileName, + lineNumber: 3, + columnNumber: 11 + }, this), /*#__PURE__*/_reactJsxDevRuntime.jsxDEV("span", {}, '1', false, { + fileName: _jsxFileName, + lineNumber: 3, + columnNumber: 31 + }, this)] +}, void 0, false, { + fileName: _jsxFileName, + lineNumber: 2, + columnNumber: 5 +}, this); diff --git a/packages/babel-plugin-transform-react-jsx-development/test/fixtures/windows/handle-static-children-windows/input.js b/packages/babel-plugin-transform-react-jsx-development/test/fixtures/windows/handle-static-children-windows/input.js new file mode 100644 index 000000000000..1d59d09f087f --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx-development/test/fixtures/windows/handle-static-children-windows/input.js @@ -0,0 +1,6 @@ +var x = ( +
+ + {[, ]} +
+); \ No newline at end of file diff --git a/packages/babel-plugin-transform-react-jsx-development/test/fixtures/windows/handle-static-children-windows/output.js b/packages/babel-plugin-transform-react-jsx-development/test/fixtures/windows/handle-static-children-windows/output.js new file mode 100644 index 000000000000..38817a08da54 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx-development/test/fixtures/windows/handle-static-children-windows/output.js @@ -0,0 +1,23 @@ +var _reactJsxDevRuntime = require("react/jsx-dev-runtime"); + +var _jsxFileName = "\\packages\\babel-plugin-transform-react-jsx-development\\test\\fixtures\\windows\\handle-static-children-windows\\input.js"; + +var x = /*#__PURE__*/_reactJsxDevRuntime.jsxDEV("div", { + children: [/*#__PURE__*/_reactJsxDevRuntime.jsxDEV("span", {}, void 0, false, { + fileName: _jsxFileName, + lineNumber: 3, + columnNumber: 9 + }, this), [/*#__PURE__*/_reactJsxDevRuntime.jsxDEV("span", {}, '0', false, { + fileName: _jsxFileName, + lineNumber: 4, + columnNumber: 11 + }, this), /*#__PURE__*/_reactJsxDevRuntime.jsxDEV("span", {}, '1', false, { + fileName: _jsxFileName, + lineNumber: 4, + columnNumber: 31 + }, this)]] +}, void 0, true, { + fileName: _jsxFileName, + lineNumber: 2, + columnNumber: 5 +}, this); diff --git a/packages/babel-plugin-transform-react-jsx-development/test/fixtures/windows/options.json b/packages/babel-plugin-transform-react-jsx-development/test/fixtures/windows/options.json new file mode 100644 index 000000000000..9cac84b4141c --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx-development/test/fixtures/windows/options.json @@ -0,0 +1,9 @@ +{ + "plugins": [ + "external-helpers", + "transform-react-jsx-development", + "transform-react-display-name", + "transform-arrow-functions" + ], + "os": ["win32"] +} diff --git a/packages/babel-plugin-transform-react-jsx-development/test/fixtures/windows/self-inside-arrow-windows/input.mjs b/packages/babel-plugin-transform-react-jsx-development/test/fixtures/windows/self-inside-arrow-windows/input.mjs new file mode 100644 index 000000000000..10fa67b30f61 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx-development/test/fixtures/windows/self-inside-arrow-windows/input.mjs @@ -0,0 +1,7 @@ +
; +() =>
; + +function fn() { +
; + () =>
; +} diff --git a/packages/babel-plugin-transform-react-jsx-development/test/fixtures/windows/self-inside-arrow-windows/output.mjs b/packages/babel-plugin-transform-react-jsx-development/test/fixtures/windows/self-inside-arrow-windows/output.mjs new file mode 100644 index 000000000000..67fb4e780593 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx-development/test/fixtures/windows/self-inside-arrow-windows/output.mjs @@ -0,0 +1,38 @@ +import { jsxDEV as _jsxDEV } from "react/jsx-dev-runtime"; + +var _jsxFileName = "\\packages\\babel-plugin-transform-react-jsx-development\\test\\fixtures\\windows\\self-inside-arrow-windows\\input.mjs", + _this = this; + +/*#__PURE__*/ +_jsxDEV("div", {}, void 0, false, { + fileName: _jsxFileName, + lineNumber: 1, + columnNumber: 1 +}, this); + +(function () { + return /*#__PURE__*/_jsxDEV("div", {}, void 0, false, { + fileName: _jsxFileName, + lineNumber: 2, + columnNumber: 7 + }, _this); +}); + +function fn() { + var _this2 = this; + + /*#__PURE__*/ + _jsxDEV("div", {}, void 0, false, { + fileName: _jsxFileName, + lineNumber: 5, + columnNumber: 3 + }, this); + + (function () { + return /*#__PURE__*/_jsxDEV("div", {}, void 0, false, { + fileName: _jsxFileName, + lineNumber: 6, + columnNumber: 9 + }, _this2); + }); +} diff --git a/packages/babel-plugin-transform-react-jsx-development/test/fixtures/windows/source-and-self-defined-windows/input.js b/packages/babel-plugin-transform-react-jsx-development/test/fixtures/windows/source-and-self-defined-windows/input.js new file mode 100644 index 000000000000..7f63bbaf38d3 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx-development/test/fixtures/windows/source-and-self-defined-windows/input.js @@ -0,0 +1,10 @@ +var x = ( + <> +
+
+
+
+
+
+ + ); \ No newline at end of file diff --git a/packages/babel-plugin-transform-react-jsx-development/test/fixtures/windows/source-and-self-defined-windows/options.json b/packages/babel-plugin-transform-react-jsx-development/test/fixtures/windows/source-and-self-defined-windows/options.json new file mode 100644 index 000000000000..db90159c6e2b --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx-development/test/fixtures/windows/source-and-self-defined-windows/options.json @@ -0,0 +1,10 @@ +{ + "plugins": [ + "transform-react-jsx-development", + "transform-react-jsx-source", + "transform-react-jsx-self" + ], + "sourceType": "module", + "os": ["windows"], + "throws": "Duplicate __self prop found. You are most likely using the deprecated transform-react-jsx-self Babel plugin. Both __source and __self are automatically set when using the automatic runtime. Please remove transform-react-jsx-source and transform-react-jsx-self from your Babel config." +} diff --git a/packages/babel-plugin-transform-react-jsx-development/test/index.js b/packages/babel-plugin-transform-react-jsx-development/test/index.js new file mode 100644 index 000000000000..1b534b8fc64a --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx-development/test/index.js @@ -0,0 +1,3 @@ +import runner from "@babel/helper-plugin-test-runner"; + +runner(__dirname); diff --git a/packages/babel-plugin-transform-react-jsx-self/package.json b/packages/babel-plugin-transform-react-jsx-self/package.json index d649d89f05ae..9fd9b3e1df66 100644 --- a/packages/babel-plugin-transform-react-jsx-self/package.json +++ b/packages/babel-plugin-transform-react-jsx-self/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-transform-react-jsx-self", - "version": "7.2.0", + "version": "7.9.0", "description": "Add a __self prop to all JSX Elements", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-react-jsx-self", "license": "MIT", @@ -12,14 +12,14 @@ "babel-plugin" ], "dependencies": { - "@babel/helper-plugin-utils": "^7.0.0", - "@babel/plugin-syntax-jsx": "^7.2.0" + "@babel/helper-plugin-utils": "^7.8.3", + "@babel/plugin-syntax-jsx": "^7.8.3" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.2.0", - "@babel/helper-plugin-test-runner": "^7.0.0" + "@babel/core": "^7.9.0", + "@babel/helper-plugin-test-runner": "^7.8.3" } } diff --git a/packages/babel-plugin-transform-react-jsx-self/src/index.js b/packages/babel-plugin-transform-react-jsx-self/src/index.js index 208de870d821..6d5403ef9cd0 100644 --- a/packages/babel-plugin-transform-react-jsx-self/src/index.js +++ b/packages/babel-plugin-transform-react-jsx-self/src/index.js @@ -30,6 +30,10 @@ export default declare(api => { return { name: "transform-react-jsx-self", - visitor, + visitor: { + Program(path) { + path.traverse(visitor); + }, + }, }; }); diff --git a/packages/babel-plugin-transform-react-jsx-self/test/fixtures/react-source/arrow-function/input.js b/packages/babel-plugin-transform-react-jsx-self/test/fixtures/react-source/arrow-function/input.js new file mode 100644 index 000000000000..10fa67b30f61 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx-self/test/fixtures/react-source/arrow-function/input.js @@ -0,0 +1,7 @@ +
; +() =>
; + +function fn() { +
; + () =>
; +} diff --git a/packages/babel-plugin-transform-react-jsx-self/test/fixtures/react-source/arrow-function/options.json b/packages/babel-plugin-transform-react-jsx-self/test/fixtures/react-source/arrow-function/options.json new file mode 100644 index 000000000000..772751db0b30 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx-self/test/fixtures/react-source/arrow-function/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["syntax-jsx", "transform-react-jsx-self", "transform-arrow-functions"] +} diff --git a/packages/babel-plugin-transform-react-jsx-self/test/fixtures/react-source/arrow-function/output.js b/packages/babel-plugin-transform-react-jsx-self/test/fixtures/react-source/arrow-function/output.js new file mode 100644 index 000000000000..176d82ae5625 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx-self/test/fixtures/react-source/arrow-function/output.js @@ -0,0 +1,17 @@ +var _this = this; + +
; + +(function () { + return
; +}); + +function fn() { + var _this2 = this; + +
; + + (function () { + return
; + }); +} diff --git a/packages/babel-plugin-transform-react-jsx-self/test/fixtures/react-source/options.json b/packages/babel-plugin-transform-react-jsx-self/test/fixtures/react-source/options.json index 5a2d48a4a86a..c3ef5d45f68c 100644 --- a/packages/babel-plugin-transform-react-jsx-self/test/fixtures/react-source/options.json +++ b/packages/babel-plugin-transform-react-jsx-self/test/fixtures/react-source/options.json @@ -1,3 +1,4 @@ { - "plugins": ["syntax-jsx", "transform-react-jsx-self"] + "plugins": ["syntax-jsx", "transform-react-jsx-self"], + "sourceType": "script" } diff --git a/packages/babel-plugin-transform-react-jsx-source/package.json b/packages/babel-plugin-transform-react-jsx-source/package.json index 829536fe4dc2..51f56aa82229 100644 --- a/packages/babel-plugin-transform-react-jsx-source/package.json +++ b/packages/babel-plugin-transform-react-jsx-source/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-transform-react-jsx-source", - "version": "7.5.0", + "version": "7.9.0", "description": "Add a __source prop to all JSX Elements", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-react-jsx-source", "license": "MIT", @@ -12,14 +12,14 @@ "babel-plugin" ], "dependencies": { - "@babel/helper-plugin-utils": "^7.0.0", - "@babel/plugin-syntax-jsx": "^7.2.0" + "@babel/helper-plugin-utils": "^7.8.3", + "@babel/plugin-syntax-jsx": "^7.8.3" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.5.0", - "@babel/helper-plugin-test-runner": "^7.0.0" + "@babel/core": "^7.9.0", + "@babel/helper-plugin-test-runner": "^7.8.3" } } diff --git a/packages/babel-plugin-transform-react-jsx-source/src/index.js b/packages/babel-plugin-transform-react-jsx-source/src/index.js index 9c0f99ed41cc..6b25c93a8ff0 100644 --- a/packages/babel-plugin-transform-react-jsx-source/src/index.js +++ b/packages/babel-plugin-transform-react-jsx-source/src/index.js @@ -1,7 +1,7 @@ /** - * This adds {fileName, lineNumber} annotations to React component definitions - * and to jsx tag literals. + * This adds {fileName, lineNumber, columnNumber} annotations to JSX tags. * + * NOTE: lineNumber and columnNumber are both 1-based. * * == JSX Literals == * @@ -10,7 +10,7 @@ * becomes: * * var __jsxFileName = 'this/file.js'; - * + * */ import { declare } from "@babel/helper-plugin-utils"; import { types as t } from "@babel/core"; @@ -21,9 +21,13 @@ const FILE_NAME_VAR = "_jsxFileName"; export default declare(api => { api.assertVersion(7); - function makeTrace(fileNameIdentifier, lineNumber) { + function makeTrace(fileNameIdentifier, lineNumber, column0Based) { const fileLineLiteral = lineNumber != null ? t.numericLiteral(lineNumber) : t.nullLiteral(); + const fileColumnLiteral = + column0Based != null + ? t.numericLiteral(column0Based + 1) + : t.nullLiteral(); const fileNameProperty = t.objectProperty( t.identifier("fileName"), fileNameIdentifier, @@ -32,7 +36,15 @@ export default declare(api => { t.identifier("lineNumber"), fileLineLiteral, ); - return t.objectExpression([fileNameProperty, lineNumberProperty]); + const columnNumberProperty = t.objectProperty( + t.identifier("columnNumber"), + fileColumnLiteral, + ); + return t.objectExpression([ + fileNameProperty, + lineNumberProperty, + columnNumberProperty, + ]); } const visitor = { @@ -69,7 +81,11 @@ export default declare(api => { state.fileNameIdentifier = fileNameIdentifier; } - const trace = makeTrace(state.fileNameIdentifier, location.start.line); + const trace = makeTrace( + state.fileNameIdentifier, + location.start.line, + location.start.column, + ); attributes.push(t.jsxAttribute(id, t.jsxExpressionContainer(trace))); }, }; diff --git a/packages/babel-plugin-transform-react-jsx-source/test/fixtures/react-source/basic-sample/exec.js b/packages/babel-plugin-transform-react-jsx-source/test/fixtures/react-source/basic-sample/exec.js index e44c3e5e7edd..c3bb77823870 100644 --- a/packages/babel-plugin-transform-react-jsx-source/test/fixtures/react-source/basic-sample/exec.js +++ b/packages/babel-plugin-transform-react-jsx-source/test/fixtures/react-source/basic-sample/exec.js @@ -7,7 +7,8 @@ var expected = multiline([ 'var _jsxFileName = "/fake/path/mock.js";', 'var x = ;', ]); diff --git a/packages/babel-plugin-transform-react-jsx-source/test/fixtures/react-source/basic-sample/options.json b/packages/babel-plugin-transform-react-jsx-source/test/fixtures/react-source/basic-sample/options.json new file mode 100644 index 000000000000..d6180568ae8d --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx-source/test/fixtures/react-source/basic-sample/options.json @@ -0,0 +1,3 @@ +{ + "os": ["linux", "darwin"] +} diff --git a/packages/babel-plugin-transform-react-jsx-source/test/fixtures/react-source/with-source/options.json b/packages/babel-plugin-transform-react-jsx-source/test/fixtures/react-source/with-source/options.json new file mode 100644 index 000000000000..d6180568ae8d --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx-source/test/fixtures/react-source/with-source/options.json @@ -0,0 +1,3 @@ +{ + "os": ["linux", "darwin"] +} diff --git a/packages/babel-plugin-transform-react-jsx/package.json b/packages/babel-plugin-transform-react-jsx/package.json index 5af70957b122..0bb86704789c 100644 --- a/packages/babel-plugin-transform-react-jsx/package.json +++ b/packages/babel-plugin-transform-react-jsx/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-transform-react-jsx", - "version": "7.3.0", + "version": "7.9.4", "description": "Turn JSX into React function calls", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-react-jsx", "license": "MIT", @@ -12,15 +12,16 @@ "babel-plugin" ], "dependencies": { - "@babel/helper-builder-react-jsx": "^7.3.0", - "@babel/helper-plugin-utils": "^7.0.0", - "@babel/plugin-syntax-jsx": "^7.2.0" + "@babel/helper-builder-react-jsx": "^7.9.0", + "@babel/helper-builder-react-jsx-experimental": "^7.9.0", + "@babel/helper-plugin-utils": "^7.8.3", + "@babel/plugin-syntax-jsx": "^7.8.3" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.2.0", - "@babel/helper-plugin-test-runner": "^7.0.0" + "@babel/core": "^7.9.0", + "@babel/helper-plugin-test-runner": "^7.8.3" } } diff --git a/packages/babel-plugin-transform-react-jsx/src/index.js b/packages/babel-plugin-transform-react-jsx/src/index.js index 778e5f960b7a..4e0c5b69b3bb 100644 --- a/packages/babel-plugin-transform-react-jsx/src/index.js +++ b/packages/babel-plugin-transform-react-jsx/src/index.js @@ -1,100 +1,18 @@ +/* eslint-disable-next-line @babel/development/plugin-name */ +import transformClassic from "./transform-classic"; +/* eslint-disable-next-line @babel/development/plugin-name */ +import transformAutomatic from "./transform-automatic"; import { declare } from "@babel/helper-plugin-utils"; -import jsx from "@babel/plugin-syntax-jsx"; -import helper from "@babel/helper-builder-react-jsx"; -import { types as t } from "@babel/core"; export default declare((api, options) => { - api.assertVersion(7); - - const THROW_IF_NAMESPACE = - options.throwIfNamespace === undefined ? true : !!options.throwIfNamespace; - - const PRAGMA_DEFAULT = options.pragma || "React.createElement"; - const PRAGMA_FRAG_DEFAULT = options.pragmaFrag || "React.Fragment"; - - const JSX_ANNOTATION_REGEX = /\*?\s*@jsx\s+([^\s]+)/; - const JSX_FRAG_ANNOTATION_REGEX = /\*?\s*@jsxFrag\s+([^\s]+)/; - - // returns a closure that returns an identifier or memberExpression node - // based on the given id - const createIdentifierParser = (id: string) => () => { - return id - .split(".") - .map(name => t.identifier(name)) - .reduce((object, property) => t.memberExpression(object, property)); - }; - - const visitor = helper({ - pre(state) { - const tagName = state.tagName; - const args = state.args; - if (t.react.isCompatTag(tagName)) { - args.push(t.stringLiteral(tagName)); - } else { - args.push(state.tagExpr); - } - }, - - post(state, pass) { - state.callee = pass.get("jsxIdentifier")(); - }, - - throwIfNamespace: THROW_IF_NAMESPACE, - }); - - visitor.Program = { - enter(path, state) { - const { file } = state; - - let pragma = PRAGMA_DEFAULT; - let pragmaFrag = PRAGMA_FRAG_DEFAULT; - let pragmaSet = !!options.pragma; - let pragmaFragSet = !!options.pragmaFrag; - - if (file.ast.comments) { - for (const comment of (file.ast.comments: Array)) { - const jsxMatches = JSX_ANNOTATION_REGEX.exec(comment.value); - if (jsxMatches) { - pragma = jsxMatches[1]; - pragmaSet = true; - } - const jsxFragMatches = JSX_FRAG_ANNOTATION_REGEX.exec(comment.value); - if (jsxFragMatches) { - pragmaFrag = jsxFragMatches[1]; - pragmaFragSet = true; - } - } - } - - state.set("jsxIdentifier", createIdentifierParser(pragma)); - state.set("jsxFragIdentifier", createIdentifierParser(pragmaFrag)); - state.set("usedFragment", false); - state.set("pragmaSet", pragmaSet); - state.set("pragmaFragSet", pragmaFragSet); - }, - exit(path, state) { - if ( - state.get("pragmaSet") && - state.get("usedFragment") && - !state.get("pragmaFragSet") - ) { - throw new Error( - "transform-react-jsx: pragma has been set but " + - "pragmafrag has not been set", - ); - } - }, - }; - - visitor.JSXAttribute = function(path) { - if (t.isJSXElement(path.node.value)) { - path.node.value = t.jsxExpressionContainer(path.node.value); - } - }; - - return { - name: "transform-react-jsx", - inherits: jsx, - visitor, - }; + const { runtime = "classic" } = options; + + // we throw a warning in helper-builder-react-jsx-experimental if runtime + // is neither automatic or classic because we will remove this file + // in v8.0.0 + if (runtime === "classic") { + return transformClassic(api, options); + } else { + return transformAutomatic(api, options); + } }); diff --git a/packages/babel-plugin-transform-react-jsx/src/transform-automatic.js b/packages/babel-plugin-transform-react-jsx/src/transform-automatic.js new file mode 100644 index 000000000000..543b9ef07133 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/src/transform-automatic.js @@ -0,0 +1,52 @@ +import jsx from "@babel/plugin-syntax-jsx"; +import { helper } from "@babel/helper-builder-react-jsx-experimental"; +import { declare } from "@babel/helper-plugin-utils"; +import { types as t } from "@babel/core"; + +export default declare((api, options) => { + const PURE_ANNOTATION = options.pure; + + const visitor = helper(api, { + pre(state) { + const tagName = state.tagName; + const args = state.args; + if (t.react.isCompatTag(tagName)) { + args.push(t.stringLiteral(tagName)); + } else { + args.push(state.tagExpr); + } + }, + + post(state, pass) { + if (pass.get("@babel/plugin-react-jsx/runtime") === "classic") { + state.createElementCallee = pass.get( + "@babel/plugin-react-jsx/createElementIdentifier", + )(); + + state.pure = + PURE_ANNOTATION ?? !pass.get("@babel/plugin-react-jsx/pragmaSet"); + } else { + state.jsxCallee = pass.get("@babel/plugin-react-jsx/jsxIdentifier")(); + state.jsxStaticCallee = pass.get( + "@babel/plugin-react-jsx/jsxStaticIdentifier", + )(); + state.createElementCallee = pass.get( + "@babel/plugin-react-jsx/createElementIdentifier", + )(); + + state.pure = + PURE_ANNOTATION ?? + !pass.get("@babel/plugin-react-jsx/importSourceSet"); + } + }, + + ...options, + development: false, + }); + + return { + name: "transform-react-jsx", + inherits: jsx, + visitor, + }; +}); diff --git a/packages/babel-plugin-transform-react-jsx/src/transform-classic.js b/packages/babel-plugin-transform-react-jsx/src/transform-classic.js new file mode 100644 index 000000000000..6fd8e9d80a78 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/src/transform-classic.js @@ -0,0 +1,106 @@ +import { declare } from "@babel/helper-plugin-utils"; +import jsx from "@babel/plugin-syntax-jsx"; +import helper from "@babel/helper-builder-react-jsx"; +import { types as t } from "@babel/core"; + +const DEFAULT = { + pragma: "React.createElement", + pragmaFrag: "React.Fragment", +}; + +export default declare((api, options) => { + const THROW_IF_NAMESPACE = + options.throwIfNamespace === undefined ? true : !!options.throwIfNamespace; + + const PRAGMA_DEFAULT = options.pragma || DEFAULT.pragma; + const PRAGMA_FRAG_DEFAULT = options.pragmaFrag || DEFAULT.pragmaFrag; + const PURE_ANNOTATION = options.pure; + + const JSX_ANNOTATION_REGEX = /\*?\s*@jsx\s+([^\s]+)/; + const JSX_FRAG_ANNOTATION_REGEX = /\*?\s*@jsxFrag\s+([^\s]+)/; + + // returns a closure that returns an identifier or memberExpression node + // based on the given id + const createIdentifierParser = (id: string) => () => { + return id + .split(".") + .map(name => t.identifier(name)) + .reduce((object, property) => t.memberExpression(object, property)); + }; + + const visitor = helper({ + pre(state) { + const tagName = state.tagName; + const args = state.args; + if (t.react.isCompatTag(tagName)) { + args.push(t.stringLiteral(tagName)); + } else { + args.push(state.tagExpr); + } + }, + + post(state, pass) { + state.callee = pass.get("jsxIdentifier")(); + state.pure = PURE_ANNOTATION ?? pass.get("pragma") === DEFAULT.pragma; + }, + + throwIfNamespace: THROW_IF_NAMESPACE, + }); + + visitor.Program = { + enter(path, state) { + const { file } = state; + + let pragma = PRAGMA_DEFAULT; + let pragmaFrag = PRAGMA_FRAG_DEFAULT; + let pragmaSet = !!options.pragma; + let pragmaFragSet = !!options.pragma; + + if (file.ast.comments) { + for (const comment of (file.ast.comments: Array)) { + const jsxMatches = JSX_ANNOTATION_REGEX.exec(comment.value); + if (jsxMatches) { + pragma = jsxMatches[1]; + pragmaSet = true; + } + const jsxFragMatches = JSX_FRAG_ANNOTATION_REGEX.exec(comment.value); + if (jsxFragMatches) { + pragmaFrag = jsxFragMatches[1]; + pragmaFragSet = true; + } + } + } + + state.set("jsxIdentifier", createIdentifierParser(pragma)); + state.set("jsxFragIdentifier", createIdentifierParser(pragmaFrag)); + state.set("usedFragment", false); + state.set("pragma", pragma); + state.set("pragmaSet", pragmaSet); + state.set("pragmaFragSet", pragmaFragSet); + }, + exit(path, state) { + if ( + state.get("pragmaSet") && + state.get("usedFragment") && + !state.get("pragmaFragSet") + ) { + throw new Error( + "transform-react-jsx: pragma has been set but " + + "pragmaFrag has not been set", + ); + } + }, + }; + + visitor.JSXAttribute = function(path) { + if (t.isJSXElement(path.node.value)) { + path.node.value = t.jsxExpressionContainer(path.node.value); + } + }; + + return { + name: "transform-react-jsx", + inherits: jsx, + visitor, + }; +}); diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextAutoImport/auto-import-react-source-type-module/input.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextAutoImport/auto-import-react-source-type-module/input.js new file mode 100644 index 000000000000..3a24e66a0547 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextAutoImport/auto-import-react-source-type-module/input.js @@ -0,0 +1,10 @@ +var x = ( + <> +
+
+
+
+
+
+ +); \ No newline at end of file diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextAutoImport/auto-import-react-source-type-module/options.json b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextAutoImport/auto-import-react-source-type-module/options.json new file mode 100644 index 000000000000..1c3260292f20 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextAutoImport/auto-import-react-source-type-module/options.json @@ -0,0 +1,4 @@ +{ + "plugins": [["transform-react-jsx", { "runtime": "automatic" }]], + "sourceType": "module" +} diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextAutoImport/auto-import-react-source-type-module/output.mjs b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextAutoImport/auto-import-react-source-type-module/output.mjs new file mode 100644 index 000000000000..00a9fb933326 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextAutoImport/auto-import-react-source-type-module/output.mjs @@ -0,0 +1,14 @@ +import { createElement as _createElement } from "react"; +import { jsxs as _jsxs } from "react/jsx-runtime"; +import { jsx as _jsx } from "react/jsx-runtime"; +import { Fragment as _Fragment } from "react/jsx-runtime"; + +var x = /*#__PURE__*/_jsx(_Fragment, { + children: /*#__PURE__*/_jsxs("div", { + children: [/*#__PURE__*/_jsx("div", {}, "1"), /*#__PURE__*/_jsx("div", { + meow: "wolf" + }, "2"), /*#__PURE__*/_jsx("div", {}, "3"), /*#__PURE__*/_createElement("div", { ...props, + key: "4" + })] + }) +}); diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextAutoImport/auto-import-react-source-type-script/input.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextAutoImport/auto-import-react-source-type-script/input.js new file mode 100644 index 000000000000..3a24e66a0547 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextAutoImport/auto-import-react-source-type-script/input.js @@ -0,0 +1,10 @@ +var x = ( + <> +
+
+
+
+
+
+ +); \ No newline at end of file diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextAutoImport/auto-import-react-source-type-script/options.json b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextAutoImport/auto-import-react-source-type-script/options.json new file mode 100644 index 000000000000..0ab40c5a69df --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextAutoImport/auto-import-react-source-type-script/options.json @@ -0,0 +1,4 @@ +{ + "plugins": [["transform-react-jsx", { "runtime": "automatic" }]], + "sourceType": "script" +} diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextAutoImport/auto-import-react-source-type-script/output.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextAutoImport/auto-import-react-source-type-script/output.js new file mode 100644 index 000000000000..61a0eebb30ce --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextAutoImport/auto-import-react-source-type-script/output.js @@ -0,0 +1,13 @@ +var _react = require("react"); + +var _reactJsxRuntime = require("react/jsx-runtime"); + +var x = /*#__PURE__*/_reactJsxRuntime.jsx(_reactJsxRuntime.Fragment, { + children: /*#__PURE__*/_reactJsxRuntime.jsxs("div", { + children: [/*#__PURE__*/_reactJsxRuntime.jsx("div", {}, "1"), /*#__PURE__*/_reactJsxRuntime.jsx("div", { + meow: "wolf" + }, "2"), /*#__PURE__*/_reactJsxRuntime.jsx("div", {}, "3"), /*#__PURE__*/_react.createElement("div", { ...props, + key: "4" + })] + }) +}); diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextAutoImport/complicated-scope-module/input.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextAutoImport/complicated-scope-module/input.js new file mode 100644 index 000000000000..3cbea31e438a --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextAutoImport/complicated-scope-module/input.js @@ -0,0 +1,15 @@ +const Bar = () => { + const Foo = () => { + const Component = ({thing, ..._react}) => { + if (!thing) { + var _react2 = "something useless"; + var b = _react3(); + var c = _react5(); + var jsx = 1; + var _jsx = 2; + return
; + }; + return ; + }; + } +} \ No newline at end of file diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextAutoImport/complicated-scope-module/options.json b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextAutoImport/complicated-scope-module/options.json new file mode 100644 index 000000000000..1c3260292f20 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextAutoImport/complicated-scope-module/options.json @@ -0,0 +1,4 @@ +{ + "plugins": [["transform-react-jsx", { "runtime": "automatic" }]], + "sourceType": "module" +} diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextAutoImport/complicated-scope-module/output.mjs b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextAutoImport/complicated-scope-module/output.mjs new file mode 100644 index 000000000000..bd4dc3f85039 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextAutoImport/complicated-scope-module/output.mjs @@ -0,0 +1,25 @@ +import { jsx as _jsx2 } from "react/jsx-runtime"; + +const Bar = () => { + const Foo = () => { + const Component = ({ + thing, + ..._react + }) => { + if (!thing) { + var _react2 = "something useless"; + + var b = _react3(); + + var c = _react5(); + + var jsx = 1; + var _jsx = 2; + return /*#__PURE__*/_jsx2("div", {}); + } + + ; + return /*#__PURE__*/_jsx2("span", {}); + }; + }; +}; diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextAutoImport/complicated-scope-script/input.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextAutoImport/complicated-scope-script/input.js new file mode 100644 index 000000000000..3cbea31e438a --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextAutoImport/complicated-scope-script/input.js @@ -0,0 +1,15 @@ +const Bar = () => { + const Foo = () => { + const Component = ({thing, ..._react}) => { + if (!thing) { + var _react2 = "something useless"; + var b = _react3(); + var c = _react5(); + var jsx = 1; + var _jsx = 2; + return
; + }; + return ; + }; + } +} \ No newline at end of file diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextAutoImport/complicated-scope-script/options.json b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextAutoImport/complicated-scope-script/options.json new file mode 100644 index 000000000000..0ab40c5a69df --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextAutoImport/complicated-scope-script/options.json @@ -0,0 +1,4 @@ +{ + "plugins": [["transform-react-jsx", { "runtime": "automatic" }]], + "sourceType": "script" +} diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextAutoImport/complicated-scope-script/output.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextAutoImport/complicated-scope-script/output.js new file mode 100644 index 000000000000..8784a681200d --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextAutoImport/complicated-scope-script/output.js @@ -0,0 +1,25 @@ +var _reactJsxRuntime = require("react/jsx-runtime"); + +const Bar = () => { + const Foo = () => { + const Component = ({ + thing, + ..._react + }) => { + if (!thing) { + var _react2 = "something useless"; + + var b = _react3(); + + var c = _react5(); + + var jsx = 1; + var _jsx = 2; + return /*#__PURE__*/_reactJsxRuntime.jsx("div", {}); + } + + ; + return /*#__PURE__*/_reactJsxRuntime.jsx("span", {}); + }; + }; +}; diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextAutoImport/import-source-pragma/input.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextAutoImport/import-source-pragma/input.js new file mode 100644 index 000000000000..8384da556f8f --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextAutoImport/import-source-pragma/input.js @@ -0,0 +1,2 @@ +/** @jsxImportSource baz */ +var x = (
); \ No newline at end of file diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextAutoImport/import-source-pragma/output.mjs b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextAutoImport/import-source-pragma/output.mjs new file mode 100644 index 000000000000..0049c235923c --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextAutoImport/import-source-pragma/output.mjs @@ -0,0 +1,6 @@ +import { jsx as _jsx } from "baz/jsx-runtime"; + +/** @jsxImportSource baz */ +var x = _jsx("div", { + children: _jsx("span", {}) +}); diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextAutoImport/import-source/input.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextAutoImport/import-source/input.js new file mode 100644 index 000000000000..6a6f1f219c0d --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextAutoImport/import-source/input.js @@ -0,0 +1 @@ +var x = (
); \ No newline at end of file diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextAutoImport/import-source/options.json b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextAutoImport/import-source/options.json new file mode 100644 index 000000000000..669a4d7c9ab3 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextAutoImport/import-source/options.json @@ -0,0 +1,5 @@ +{ + "plugins": [ + ["transform-react-jsx", { "importSource": "foo", "runtime": "automatic" }] + ] +} diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextAutoImport/import-source/output.mjs b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextAutoImport/import-source/output.mjs new file mode 100644 index 000000000000..05dafe98f54b --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextAutoImport/import-source/output.mjs @@ -0,0 +1,5 @@ +import { jsx as _jsx } from "foo/jsx-runtime"; + +var x = _jsx("div", { + children: _jsx("span", {}) +}); diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextAutoImport/no-jsx/input.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextAutoImport/no-jsx/input.js new file mode 100644 index 000000000000..3ea99257fd41 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextAutoImport/no-jsx/input.js @@ -0,0 +1 @@ +var foo = "
"; \ No newline at end of file diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextAutoImport/no-jsx/output.mjs b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextAutoImport/no-jsx/output.mjs new file mode 100644 index 000000000000..9afe2bdf3f51 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextAutoImport/no-jsx/output.mjs @@ -0,0 +1 @@ +var foo = "
"; diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextAutoImport/options.json b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextAutoImport/options.json new file mode 100644 index 000000000000..1c3260292f20 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextAutoImport/options.json @@ -0,0 +1,4 @@ +{ + "plugins": [["transform-react-jsx", { "runtime": "automatic" }]], + "sourceType": "module" +} diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextAutoImport/react-defined/input.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextAutoImport/react-defined/input.js new file mode 100644 index 000000000000..bde12661d8ec --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextAutoImport/react-defined/input.js @@ -0,0 +1,10 @@ +import * as react from "react"; +var y = react.createElement("div", {foo: 1}); +var x = ( +
+
+
+
+
+
+); \ No newline at end of file diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextAutoImport/react-defined/options.json b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextAutoImport/react-defined/options.json new file mode 100644 index 000000000000..350f3e415810 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextAutoImport/react-defined/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["transform-react-jsx", { "runtime": "automatic" }]] +} diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextAutoImport/react-defined/output.mjs b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextAutoImport/react-defined/output.mjs new file mode 100644 index 000000000000..18af1b0b5e21 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextAutoImport/react-defined/output.mjs @@ -0,0 +1,15 @@ +import { createElement as _createElement } from "react"; +import { jsx as _jsx } from "react/jsx-runtime"; +import { jsxs as _jsxs } from "react/jsx-runtime"; +import * as react from "react"; +var y = react.createElement("div", { + foo: 1 +}); + +var x = /*#__PURE__*/_jsxs("div", { + children: [/*#__PURE__*/_jsx("div", {}, "1"), /*#__PURE__*/_jsx("div", { + meow: "wolf" + }, "2"), /*#__PURE__*/_jsx("div", {}, "3"), /*#__PURE__*/_createElement("div", { ...props, + key: "4" + })] +}); diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/.should-properly-handle-comments-adjacent-to-children/input.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/.should-properly-handle-comments-adjacent-to-children/input.js new file mode 100644 index 000000000000..412984681eea --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/.should-properly-handle-comments-adjacent-to-children/input.js @@ -0,0 +1,13 @@ +var x = ( +
+ {/* A comment at the beginning */} + {/* A second comment at the beginning */} + + {/* A nested comment */} + + {/* A sandwiched comment */} +
+ {/* A comment at the end */} + {/* A second comment at the end */} +
+); diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/adds-appropriate-newlines-when-using-spread-attribute/input.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/adds-appropriate-newlines-when-using-spread-attribute/input.js new file mode 100644 index 000000000000..2c800f155830 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/adds-appropriate-newlines-when-using-spread-attribute/input.js @@ -0,0 +1,3 @@ + diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/adds-appropriate-newlines-when-using-spread-attribute/output.mjs b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/adds-appropriate-newlines-when-using-spread-attribute/output.mjs new file mode 100644 index 000000000000..2c3a2180d2ec --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/adds-appropriate-newlines-when-using-spread-attribute/output.mjs @@ -0,0 +1,6 @@ +import { jsx as _jsx } from "react/jsx-runtime"; + +/*#__PURE__*/ +_jsx(Component, { ...props, + sound: "moo" +}); diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/arrow-functions/input.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/arrow-functions/input.js new file mode 100644 index 000000000000..91f343d34974 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/arrow-functions/input.js @@ -0,0 +1,7 @@ +var foo = function () { + return () => ; +}; + +var bar = function () { + return () => ; +}; diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/arrow-functions/output.mjs b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/arrow-functions/output.mjs new file mode 100644 index 000000000000..e5a605c67c18 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/arrow-functions/output.mjs @@ -0,0 +1,17 @@ +import { jsx as _jsx } from "react/jsx-runtime"; + +var foo = function () { + var _this = this; + + return function () { + return /*#__PURE__*/_jsx(_this, {}); + }; +}; + +var bar = function () { + var _this2 = this; + + return function () { + return /*#__PURE__*/_jsx(_this2.foo, {}); + }; +}; diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/assignment/input.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/assignment/input.js new file mode 100644 index 000000000000..4caacb6aa17d --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/assignment/input.js @@ -0,0 +1 @@ +var div = diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/assignment/output.mjs b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/assignment/output.mjs new file mode 100644 index 000000000000..05860f319a72 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/assignment/output.mjs @@ -0,0 +1,5 @@ +import { jsx as _jsx } from "react/jsx-runtime"; + +var div = /*#__PURE__*/_jsx(Component, { ...props, + foo: "bar" +}); diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/concatenates-adjacent-string-literals/input.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/concatenates-adjacent-string-literals/input.js new file mode 100644 index 000000000000..f3f30af04408 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/concatenates-adjacent-string-literals/input.js @@ -0,0 +1,13 @@ +var x = +
+ foo + {"bar"} + baz +
+ buz + bang +
+ qux + {null} + quack +
diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/concatenates-adjacent-string-literals/output.mjs b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/concatenates-adjacent-string-literals/output.mjs new file mode 100644 index 000000000000..303129243f5e --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/concatenates-adjacent-string-literals/output.mjs @@ -0,0 +1,8 @@ +import { jsx as _jsx } from "react/jsx-runtime"; +import { jsxs as _jsxs } from "react/jsx-runtime"; + +var x = /*#__PURE__*/_jsxs("div", { + children: ["foo", "bar", "baz", /*#__PURE__*/_jsx("div", { + children: "buz bang" + }), "qux", null, "quack"] +}); diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/display-name-assignment-expression/input.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/display-name-assignment-expression/input.js new file mode 100644 index 000000000000..5b06299bc0de --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/display-name-assignment-expression/input.js @@ -0,0 +1,6 @@ +var Component; +Component = React.createClass({ + render: function render() { + return null; + } +}); diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/display-name-assignment-expression/output.mjs b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/display-name-assignment-expression/output.mjs new file mode 100644 index 000000000000..12fa356793b9 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/display-name-assignment-expression/output.mjs @@ -0,0 +1,7 @@ +var Component; +Component = React.createClass({ + displayName: "Component", + render: function render() { + return null; + } +}); diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/display-name-export-default/input.mjs b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/display-name-export-default/input.mjs new file mode 100644 index 000000000000..4331da16ef3a --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/display-name-export-default/input.mjs @@ -0,0 +1,5 @@ +export default React.createClass({ + render: function render() { + return null; + } +}); diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/display-name-export-default/output.mjs b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/display-name-export-default/output.mjs new file mode 100644 index 000000000000..6714246222b9 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/display-name-export-default/output.mjs @@ -0,0 +1,6 @@ +export default React.createClass({ + displayName: "input", + render: function render() { + return null; + } +}); diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/display-name-if-missing/input.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/display-name-if-missing/input.js new file mode 100644 index 000000000000..73cb1e0d33ff --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/display-name-if-missing/input.js @@ -0,0 +1,13 @@ +var Whateva = React.createClass({ + displayName: "Whatever", + render: function render() { + return null; + } +}); + +var Bar = React.createClass({ + "displayName": "Ba", + render: function render() { + return null; + } +}); diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/display-name-if-missing/output.mjs b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/display-name-if-missing/output.mjs new file mode 100644 index 000000000000..a2bfac0833a1 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/display-name-if-missing/output.mjs @@ -0,0 +1,12 @@ +var Whateva = React.createClass({ + displayName: "Whatever", + render: function render() { + return null; + } +}); +var Bar = React.createClass({ + "displayName": "Ba", + render: function render() { + return null; + } +}); diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/display-name-object-declaration/input.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/display-name-object-declaration/input.js new file mode 100644 index 000000000000..904383aab8a3 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/display-name-object-declaration/input.js @@ -0,0 +1,7 @@ +exports = { + Component: React.createClass({ + render: function render() { + return null; + } + }) +}; diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/display-name-object-declaration/output.mjs b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/display-name-object-declaration/output.mjs new file mode 100644 index 000000000000..e6565826f5d7 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/display-name-object-declaration/output.mjs @@ -0,0 +1,8 @@ +exports = { + Component: React.createClass({ + displayName: "Component", + render: function render() { + return null; + } + }) +}; diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/display-name-property-assignment/input.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/display-name-property-assignment/input.js new file mode 100644 index 000000000000..d9d2c1ad6693 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/display-name-property-assignment/input.js @@ -0,0 +1,5 @@ +exports.Component = React.createClass({ + render: function render() { + return null; + } +}); diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/display-name-property-assignment/output.mjs b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/display-name-property-assignment/output.mjs new file mode 100644 index 000000000000..e08bf5d35d67 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/display-name-property-assignment/output.mjs @@ -0,0 +1,6 @@ +exports.Component = React.createClass({ + displayName: "Component", + render: function render() { + return null; + } +}); diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/display-name-variable-declaration/input.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/display-name-variable-declaration/input.js new file mode 100644 index 000000000000..1d32784d13f5 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/display-name-variable-declaration/input.js @@ -0,0 +1,5 @@ +var Component = React.createClass({ + render: function render() { + return null; + } +}); diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/display-name-variable-declaration/output.mjs b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/display-name-variable-declaration/output.mjs new file mode 100644 index 000000000000..d6393b01057e --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/display-name-variable-declaration/output.mjs @@ -0,0 +1,6 @@ +var Component = React.createClass({ + displayName: "Component", + render: function render() { + return null; + } +}); diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/does-not-add-source-self-automatic/input.mjs b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/does-not-add-source-self-automatic/input.mjs new file mode 100644 index 000000000000..ebd66ec03e0a --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/does-not-add-source-self-automatic/input.mjs @@ -0,0 +1,10 @@ +var x = ( + <> +
+
+
+
+
+
+ +); diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/does-not-add-source-self-automatic/options.json b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/does-not-add-source-self-automatic/options.json new file mode 100644 index 000000000000..8183c589d151 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/does-not-add-source-self-automatic/options.json @@ -0,0 +1,11 @@ +{ + "plugins": [ + [ + "transform-react-jsx", + { + "autoImport": "namedExports", + "runtime": "automatic" + } + ] + ] +} diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/does-not-add-source-self-automatic/output.mjs b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/does-not-add-source-self-automatic/output.mjs new file mode 100644 index 000000000000..00a9fb933326 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/does-not-add-source-self-automatic/output.mjs @@ -0,0 +1,14 @@ +import { createElement as _createElement } from "react"; +import { jsxs as _jsxs } from "react/jsx-runtime"; +import { jsx as _jsx } from "react/jsx-runtime"; +import { Fragment as _Fragment } from "react/jsx-runtime"; + +var x = /*#__PURE__*/_jsx(_Fragment, { + children: /*#__PURE__*/_jsxs("div", { + children: [/*#__PURE__*/_jsx("div", {}, "1"), /*#__PURE__*/_jsx("div", { + meow: "wolf" + }, "2"), /*#__PURE__*/_jsx("div", {}, "3"), /*#__PURE__*/_createElement("div", { ...props, + key: "4" + })] + }) +}); diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/dont-coerce-expression-containers/input.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/dont-coerce-expression-containers/input.js new file mode 100644 index 000000000000..c8da55022283 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/dont-coerce-expression-containers/input.js @@ -0,0 +1,4 @@ + + To get started, edit index.ios.js!!!{"\n"} + Press Cmd+R to reload + diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/dont-coerce-expression-containers/output.mjs b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/dont-coerce-expression-containers/output.mjs new file mode 100644 index 000000000000..c4264e2580e0 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/dont-coerce-expression-containers/output.mjs @@ -0,0 +1,6 @@ +import { jsxs as _jsxs } from "react/jsx-runtime"; + +/*#__PURE__*/ +_jsxs(Text, { + children: ["To get started, edit index.ios.js!!!", "\n", "Press Cmd+R to reload"] +}); diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/handle-fragments-with-key/input.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/handle-fragments-with-key/input.js new file mode 100644 index 000000000000..9fac2d0f9850 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/handle-fragments-with-key/input.js @@ -0,0 +1,3 @@ +import * as React from "react"; + +var x = ; \ No newline at end of file diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/handle-fragments-with-key/output.mjs b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/handle-fragments-with-key/output.mjs new file mode 100644 index 000000000000..93d0763c4e17 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/handle-fragments-with-key/output.mjs @@ -0,0 +1,4 @@ +import { jsx as _jsx } from "react/jsx-runtime"; +import * as React from "react"; + +var x = /*#__PURE__*/_jsx(React.Fragment, {}, "foo"); diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/handle-fragments-with-no-children/input.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/handle-fragments-with-no-children/input.js new file mode 100644 index 000000000000..d766356c98c2 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/handle-fragments-with-no-children/input.js @@ -0,0 +1 @@ +var x = <>; \ No newline at end of file diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/handle-fragments-with-no-children/output.mjs b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/handle-fragments-with-no-children/output.mjs new file mode 100644 index 000000000000..a749832fa170 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/handle-fragments-with-no-children/output.mjs @@ -0,0 +1,4 @@ +import { jsx as _jsx } from "react/jsx-runtime"; +import { Fragment as _Fragment } from "react/jsx-runtime"; + +var x = /*#__PURE__*/_jsx(_Fragment, {}); diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/handle-fragments/input.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/handle-fragments/input.js new file mode 100644 index 000000000000..d2a2902b8574 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/handle-fragments/input.js @@ -0,0 +1 @@ +var x = <>
\ No newline at end of file diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/handle-fragments/output.mjs b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/handle-fragments/output.mjs new file mode 100644 index 000000000000..b34f1fa72cf7 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/handle-fragments/output.mjs @@ -0,0 +1,6 @@ +import { jsx as _jsx } from "react/jsx-runtime"; +import { Fragment as _Fragment } from "react/jsx-runtime"; + +var x = /*#__PURE__*/_jsx(_Fragment, { + children: /*#__PURE__*/_jsx("div", {}) +}); diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/handle-nonstatic-children/input.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/handle-nonstatic-children/input.js new file mode 100644 index 000000000000..e0fab82c495b --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/handle-nonstatic-children/input.js @@ -0,0 +1,5 @@ +var x = ( +
+ {[, ]} +
+); \ No newline at end of file diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/handle-nonstatic-children/output.mjs b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/handle-nonstatic-children/output.mjs new file mode 100644 index 000000000000..1b19cdfcbdbf --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/handle-nonstatic-children/output.mjs @@ -0,0 +1,5 @@ +import { jsx as _jsx } from "react/jsx-runtime"; + +var x = /*#__PURE__*/_jsx("div", { + children: [/*#__PURE__*/_jsx("span", {}, '0'), /*#__PURE__*/_jsx("span", {}, '1')] +}); diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/handle-static-children/input.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/handle-static-children/input.js new file mode 100644 index 000000000000..fbe28fd373c6 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/handle-static-children/input.js @@ -0,0 +1,6 @@ +var x = ( +
+ + {[, ]} +
+); diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/handle-static-children/output.mjs b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/handle-static-children/output.mjs new file mode 100644 index 000000000000..b1451ada1901 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/handle-static-children/output.mjs @@ -0,0 +1,6 @@ +import { jsx as _jsx } from "react/jsx-runtime"; +import { jsxs as _jsxs } from "react/jsx-runtime"; + +var x = /*#__PURE__*/_jsxs("div", { + children: [/*#__PURE__*/_jsx("span", {}), [/*#__PURE__*/_jsx("span", {}, '0'), /*#__PURE__*/_jsx("span", {}, '1')]] +}); diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/honor-custom-jsx-comment/input.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/honor-custom-jsx-comment/input.js new file mode 100644 index 000000000000..69b21ce257a7 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/honor-custom-jsx-comment/input.js @@ -0,0 +1,6 @@ +; + +var profile =
+ +

{[user.firstName, user.lastName].join(" ")}

+
; \ No newline at end of file diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/honor-custom-jsx-comment/output.mjs b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/honor-custom-jsx-comment/output.mjs new file mode 100644 index 000000000000..dbfa96810678 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/honor-custom-jsx-comment/output.mjs @@ -0,0 +1,14 @@ +import { jsxs as _jsxs } from "react/jsx-runtime"; +import { jsx as _jsx } from "react/jsx-runtime"; + +/*#__PURE__*/ +_jsx(Foo, {}); + +var profile = /*#__PURE__*/_jsxs("div", { + children: [/*#__PURE__*/_jsx("img", { + src: "avatar.png", + className: "profile" + }), /*#__PURE__*/_jsx("h3", { + children: [user.firstName, user.lastName].join(" ") + })] +}); diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/jsx-with-retainlines-option/input.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/jsx-with-retainlines-option/input.js new file mode 100644 index 000000000000..1addddeb1500 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/jsx-with-retainlines-option/input.js @@ -0,0 +1 @@ +var div =
test
; diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/jsx-with-retainlines-option/options.json b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/jsx-with-retainlines-option/options.json new file mode 100644 index 000000000000..97925bbcb61b --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/jsx-with-retainlines-option/options.json @@ -0,0 +1,3 @@ +{ + "retainLines": true +} diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/jsx-with-retainlines-option/output.mjs b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/jsx-with-retainlines-option/output.mjs new file mode 100644 index 000000000000..81cfa808941f --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/jsx-with-retainlines-option/output.mjs @@ -0,0 +1 @@ +import { jsx as _jsx } from "react/jsx-runtime";var div = /*#__PURE__*/_jsx("div", { children: "test" }); diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/jsx-without-retainlines-option/input.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/jsx-without-retainlines-option/input.js new file mode 100644 index 000000000000..1addddeb1500 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/jsx-without-retainlines-option/input.js @@ -0,0 +1 @@ +var div =
test
; diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/jsx-without-retainlines-option/output.mjs b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/jsx-without-retainlines-option/output.mjs new file mode 100644 index 000000000000..e74b251a647e --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/jsx-without-retainlines-option/output.mjs @@ -0,0 +1,5 @@ +import { jsx as _jsx } from "react/jsx-runtime"; + +var div = /*#__PURE__*/_jsx("div", { + children: "test" +}); diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/key-undefined-works/input.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/key-undefined-works/input.js new file mode 100644 index 000000000000..23d79e4ffb04 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/key-undefined-works/input.js @@ -0,0 +1,2 @@ +const props = {foo: true}; +var x = (
) diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/key-undefined-works/output.mjs b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/key-undefined-works/output.mjs new file mode 100644 index 000000000000..3c78adf144f7 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/key-undefined-works/output.mjs @@ -0,0 +1,8 @@ +import { createElement as _createElement } from "react"; +const props = { + foo: true +}; + +var x = /*#__PURE__*/_createElement("div", { ...props, + key: undefined +}); diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/optimisation.react.constant-elements/input.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/optimisation.react.constant-elements/input.js new file mode 100644 index 000000000000..87ccec557d36 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/optimisation.react.constant-elements/input.js @@ -0,0 +1,17 @@ +class App extends React.Component { + render() { + const navbarHeader =
+ + + +
; + + return
+ +
; + } +} diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/optimisation.react.constant-elements/options.json b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/optimisation.react.constant-elements/options.json new file mode 100644 index 000000000000..721403cf3973 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/optimisation.react.constant-elements/options.json @@ -0,0 +1,8 @@ +{ + "plugins": [ + ["external-helpers", { "helperVersion": "7.100.0" }], + "transform-react-constant-elements", + "transform-classes", + "syntax-jsx" + ] +} diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/optimisation.react.constant-elements/output.mjs b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/optimisation.react.constant-elements/output.mjs new file mode 100644 index 000000000000..188cfa91ed06 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/optimisation.react.constant-elements/output.mjs @@ -0,0 +1,31 @@ +var _ref =
+ + + +
; + +let App = /*#__PURE__*/function (_React$Component) { + babelHelpers.inherits(App, _React$Component); + + var _super = babelHelpers.createSuper(App); + + function App() { + babelHelpers.classCallCheck(this, App); + return _super.apply(this, arguments); + } + + babelHelpers.createClass(App, [{ + key: "render", + value: function render() { + const navbarHeader = _ref; + return
+ +
; + } + }]); + return App; +}(React.Component); diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/options.json b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/options.json new file mode 100644 index 000000000000..8bbe36458205 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/options.json @@ -0,0 +1,9 @@ +{ + "plugins": [ + "external-helpers", + ["transform-react-jsx", { "runtime": "automatic" }], + "transform-react-display-name", + "transform-arrow-functions" + ], + "sourceType": "module" +} diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/pragma-works-with-no-space-at-the-end/input.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/pragma-works-with-no-space-at-the-end/input.js new file mode 100644 index 000000000000..73a676f679ae --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/pragma-works-with-no-space-at-the-end/input.js @@ -0,0 +1,2 @@ +/* @jsxImportSource foo*/ +
Hi
; \ No newline at end of file diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/pragma-works-with-no-space-at-the-end/output.mjs b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/pragma-works-with-no-space-at-the-end/output.mjs new file mode 100644 index 000000000000..7f8eea819da1 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/pragma-works-with-no-space-at-the-end/output.mjs @@ -0,0 +1,6 @@ +import { jsx as _jsx } from "foo/jsx-runtime"; + +/* @jsxImportSource foo*/ +_jsx("div", { + children: "Hi" +}); diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-add-quotes-es3/input.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-add-quotes-es3/input.js new file mode 100644 index 000000000000..a47734ffb31a --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-add-quotes-es3/input.js @@ -0,0 +1 @@ +var es3 = ; diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-add-quotes-es3/options.json b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-add-quotes-es3/options.json new file mode 100644 index 000000000000..05afa82f8856 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-add-quotes-es3/options.json @@ -0,0 +1,6 @@ +{ + "plugins": [ + ["transform-react-jsx", { "runtime": "automatic" }], + "transform-property-literals" + ] +} diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-add-quotes-es3/output.mjs b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-add-quotes-es3/output.mjs new file mode 100644 index 000000000000..a57a04a49508 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-add-quotes-es3/output.mjs @@ -0,0 +1,10 @@ +import { jsx as _jsx } from "react/jsx-runtime"; + +var es3 = /*#__PURE__*/_jsx(F, { + aaa: true, + "new": true, + "const": true, + "var": true, + "default": true, + "foo-bar": true +}); diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-allow-constructor-as-prop/input.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-allow-constructor-as-prop/input.js new file mode 100644 index 000000000000..29c24a7630ab --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-allow-constructor-as-prop/input.js @@ -0,0 +1 @@ +; diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-allow-constructor-as-prop/output.mjs b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-allow-constructor-as-prop/output.mjs new file mode 100644 index 000000000000..1a28ef6db34e --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-allow-constructor-as-prop/output.mjs @@ -0,0 +1,6 @@ +import { jsx as _jsx } from "react/jsx-runtime"; + +/*#__PURE__*/ +_jsx(Component, { + constructor: "foo" +}); diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-allow-deeper-js-namespacing/input.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-allow-deeper-js-namespacing/input.js new file mode 100644 index 000000000000..158b9a9dee08 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-allow-deeper-js-namespacing/input.js @@ -0,0 +1 @@ +; diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-allow-deeper-js-namespacing/output.mjs b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-allow-deeper-js-namespacing/output.mjs new file mode 100644 index 000000000000..9aa4c3656720 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-allow-deeper-js-namespacing/output.mjs @@ -0,0 +1,4 @@ +import { jsx as _jsx } from "react/jsx-runtime"; + +/*#__PURE__*/ +_jsx(Namespace.DeepNamespace.Component, {}); diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-allow-elements-as-attributes/input.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-allow-elements-as-attributes/input.js new file mode 100644 index 000000000000..240f6d37ae05 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-allow-elements-as-attributes/input.js @@ -0,0 +1 @@ +
/> diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-allow-elements-as-attributes/output.mjs b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-allow-elements-as-attributes/output.mjs new file mode 100644 index 000000000000..9d18ed3e73f0 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-allow-elements-as-attributes/output.mjs @@ -0,0 +1,6 @@ +import { jsx as _jsx } from "react/jsx-runtime"; + +/*#__PURE__*/ +_jsx("div", { + attr: /*#__PURE__*/_jsx("div", {}) +}); diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-allow-js-namespacing/blacklist.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-allow-js-namespacing/blacklist.js new file mode 100644 index 000000000000..980df4572437 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-allow-js-namespacing/blacklist.js @@ -0,0 +1 @@ +React.createElement(Namespace.Component, null); diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-allow-js-namespacing/input.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-allow-js-namespacing/input.js new file mode 100644 index 000000000000..6c104620cff4 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-allow-js-namespacing/input.js @@ -0,0 +1 @@ +; diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-allow-js-namespacing/output.mjs b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-allow-js-namespacing/output.mjs new file mode 100644 index 000000000000..c0b46c897498 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-allow-js-namespacing/output.mjs @@ -0,0 +1,4 @@ +import { jsx as _jsx } from "react/jsx-runtime"; + +/*#__PURE__*/ +_jsx(Namespace.Component, {}); diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-allow-nested-fragments/input.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-allow-nested-fragments/input.js new file mode 100644 index 000000000000..73b5cad5588d --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-allow-nested-fragments/input.js @@ -0,0 +1,12 @@ +
+ < > + <> + Hello + world + + <> + Goodbye + world + + +
diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-allow-nested-fragments/output.mjs b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-allow-nested-fragments/output.mjs new file mode 100644 index 000000000000..89cc0c22a809 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-allow-nested-fragments/output.mjs @@ -0,0 +1,22 @@ +import { jsxs as _jsxs } from "react/jsx-runtime"; +import { Fragment as _Fragment } from "react/jsx-runtime"; +import { jsx as _jsx } from "react/jsx-runtime"; + +/*#__PURE__*/ +_jsx("div", { + children: /*#__PURE__*/_jsxs(_Fragment, { + children: [/*#__PURE__*/_jsxs(_Fragment, { + children: [/*#__PURE__*/_jsx("span", { + children: "Hello" + }), /*#__PURE__*/_jsx("span", { + children: "world" + })] + }), /*#__PURE__*/_jsxs(_Fragment, { + children: [/*#__PURE__*/_jsx("span", { + children: "Goodbye" + }), /*#__PURE__*/_jsx("span", { + children: "world" + })] + })] + }) +}); diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-avoid-wrapping-in-extra-parens-if-not-needed/input.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-avoid-wrapping-in-extra-parens-if-not-needed/input.js new file mode 100644 index 000000000000..0304845f88c1 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-avoid-wrapping-in-extra-parens-if-not-needed/input.js @@ -0,0 +1,15 @@ +var x =
+ +
; + +var x =
+ {props.children} +
; + +var x = + {props.children} +; + +var x = + +; diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-avoid-wrapping-in-extra-parens-if-not-needed/output.mjs b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-avoid-wrapping-in-extra-parens-if-not-needed/output.mjs new file mode 100644 index 000000000000..99f063b7fdd6 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-avoid-wrapping-in-extra-parens-if-not-needed/output.mjs @@ -0,0 +1,17 @@ +import { jsx as _jsx } from "react/jsx-runtime"; + +var x = /*#__PURE__*/_jsx("div", { + children: /*#__PURE__*/_jsx(Component, {}) +}); + +var x = /*#__PURE__*/_jsx("div", { + children: props.children +}); + +var x = /*#__PURE__*/_jsx(Composite, { + children: props.children +}); + +var x = /*#__PURE__*/_jsx(Composite, { + children: /*#__PURE__*/_jsx(Composite2, {}) +}); diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-convert-simple-tags/input.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-convert-simple-tags/input.js new file mode 100644 index 000000000000..b6d801a6bc26 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-convert-simple-tags/input.js @@ -0,0 +1 @@ +var x =
; diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-convert-simple-tags/output.mjs b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-convert-simple-tags/output.mjs new file mode 100644 index 000000000000..dac95436f8e9 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-convert-simple-tags/output.mjs @@ -0,0 +1,3 @@ +import { jsx as _jsx } from "react/jsx-runtime"; + +var x = /*#__PURE__*/_jsx("div", {}); diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-convert-simple-text/input.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-convert-simple-text/input.js new file mode 100644 index 000000000000..42c927f15a90 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-convert-simple-text/input.js @@ -0,0 +1 @@ +var x =
text
; diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-convert-simple-text/output.mjs b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-convert-simple-text/output.mjs new file mode 100644 index 000000000000..7791e6759733 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-convert-simple-text/output.mjs @@ -0,0 +1,5 @@ +import { jsx as _jsx } from "react/jsx-runtime"; + +var x = /*#__PURE__*/_jsx("div", { + children: "text" +}); diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-disallow-spread-children/input.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-disallow-spread-children/input.js new file mode 100644 index 000000000000..6a05e108dc66 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-disallow-spread-children/input.js @@ -0,0 +1 @@ +
{...children}
; diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-disallow-spread-children/options.json b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-disallow-spread-children/options.json new file mode 100644 index 000000000000..bcb773e34314 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-disallow-spread-children/options.json @@ -0,0 +1,3 @@ +{ + "throws": "Spread children are not supported in React." +} diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-disallow-xml-namespacing/input.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-disallow-xml-namespacing/input.js new file mode 100644 index 000000000000..50df717c1267 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-disallow-xml-namespacing/input.js @@ -0,0 +1 @@ +; diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-disallow-xml-namespacing/options.json b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-disallow-xml-namespacing/options.json new file mode 100644 index 000000000000..746037e9f505 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-disallow-xml-namespacing/options.json @@ -0,0 +1,3 @@ +{ + "throws": "Namespace tags are not supported by default. React's JSX doesn't support namespace tags. You can set `throwIfNamespace: false` to bypass this warning." +} diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-escape-xhtml-jsxattribute/input.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-escape-xhtml-jsxattribute/input.js new file mode 100644 index 000000000000..addae3b9f807 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-escape-xhtml-jsxattribute/input.js @@ -0,0 +1,3 @@ +
; +
; +
; diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-escape-xhtml-jsxattribute/output.mjs b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-escape-xhtml-jsxattribute/output.mjs new file mode 100644 index 000000000000..9a5aedeff449 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-escape-xhtml-jsxattribute/output.mjs @@ -0,0 +1,16 @@ +import { jsx as _jsx } from "react/jsx-runtime"; + +/*#__PURE__*/ +_jsx("div", { + id: "w\xF4w" +}); + +/*#__PURE__*/ +_jsx("div", { + id: "\\w" +}); + +/*#__PURE__*/ +_jsx("div", { + id: "w < w" +}); diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-escape-xhtml-jsxtext/input.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-escape-xhtml-jsxtext/input.js new file mode 100644 index 000000000000..2104766109bb --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-escape-xhtml-jsxtext/input.js @@ -0,0 +1,12 @@ +
wow
; +
wôw
; + +
w & w
; +
w & w
; + +
w   w
; +
this should not parse as unicode: \u00a0
; +
this should parse as nbsp:  
; +
this should parse as unicode: {'\u00a0 '}
; + +
w < w
; diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-escape-xhtml-jsxtext/output.mjs b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-escape-xhtml-jsxtext/output.mjs new file mode 100644 index 000000000000..32cb47cd42ed --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-escape-xhtml-jsxtext/output.mjs @@ -0,0 +1,47 @@ +import { jsxs as _jsxs } from "react/jsx-runtime"; +import { jsx as _jsx } from "react/jsx-runtime"; + +/*#__PURE__*/ +_jsx("div", { + children: "wow" +}); + +/*#__PURE__*/ +_jsx("div", { + children: "w\xF4w" +}); + +/*#__PURE__*/ +_jsx("div", { + children: "w & w" +}); + +/*#__PURE__*/ +_jsx("div", { + children: "w & w" +}); + +/*#__PURE__*/ +_jsx("div", { + children: "w \xA0 w" +}); + +/*#__PURE__*/ +_jsx("div", { + children: "this should not parse as unicode: \\u00a0" +}); + +/*#__PURE__*/ +_jsx("div", { + children: "this should parse as nbsp: \xA0 " +}); + +/*#__PURE__*/ +_jsxs("div", { + children: ["this should parse as unicode: ", '\u00a0 '] +}); + +/*#__PURE__*/ +_jsx("div", { + children: "w < w" +}); diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-handle-attributed-elements/input.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-handle-attributed-elements/input.js new file mode 100644 index 000000000000..e17965916169 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-handle-attributed-elements/input.js @@ -0,0 +1,11 @@ +var HelloMessage = React.createClass({ + render: function() { + return
Hello {this.props.name}
; + } +}); + +React.render( + Sebastian + +} />, mountNode); diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-handle-attributed-elements/output.mjs b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-handle-attributed-elements/output.mjs new file mode 100644 index 000000000000..27287d025dae --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-handle-attributed-elements/output.mjs @@ -0,0 +1,15 @@ +import { jsx as _jsx } from "react/jsx-runtime"; +import { jsxs as _jsxs } from "react/jsx-runtime"; +var HelloMessage = React.createClass({ + displayName: "HelloMessage", + render: function () { + return /*#__PURE__*/_jsxs("div", { + children: ["Hello ", this.props.name] + }); + } +}); +React.render( /*#__PURE__*/_jsx(HelloMessage, { + name: /*#__PURE__*/_jsx("span", { + children: "Sebastian" + }) +}), mountNode); diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-handle-has-own-property-correctly/input.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-handle-has-own-property-correctly/input.js new file mode 100644 index 000000000000..4d5e8fb63c73 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-handle-has-own-property-correctly/input.js @@ -0,0 +1 @@ +testing; diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-handle-has-own-property-correctly/output.mjs b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-handle-has-own-property-correctly/output.mjs new file mode 100644 index 000000000000..7c7ac7d56bbf --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-handle-has-own-property-correctly/output.mjs @@ -0,0 +1,6 @@ +import { jsx as _jsx } from "react/jsx-runtime"; + +/*#__PURE__*/ +_jsx("hasOwnProperty", { + children: "testing" +}); diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-have-correct-comma-in-nested-children/input.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-have-correct-comma-in-nested-children/input.js new file mode 100644 index 000000000000..fa82e1cd08cb --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-have-correct-comma-in-nested-children/input.js @@ -0,0 +1,5 @@ +var x =
+

+ {foo}
{bar}
+
+
; diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-have-correct-comma-in-nested-children/output.mjs b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-have-correct-comma-in-nested-children/output.mjs new file mode 100644 index 000000000000..ffb137dfab63 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-have-correct-comma-in-nested-children/output.mjs @@ -0,0 +1,10 @@ +import { jsx as _jsx } from "react/jsx-runtime"; +import { jsxs as _jsxs } from "react/jsx-runtime"; + +var x = /*#__PURE__*/_jsxs("div", { + children: [/*#__PURE__*/_jsx("div", { + children: /*#__PURE__*/_jsx("br", {}) + }), /*#__PURE__*/_jsxs(Component, { + children: [foo, /*#__PURE__*/_jsx("br", {}), bar] + }), /*#__PURE__*/_jsx("br", {})] +}); diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-insert-commas-after-expressions-before-whitespace/input.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-insert-commas-after-expressions-before-whitespace/input.js new file mode 100644 index 000000000000..92541bbb3554 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-insert-commas-after-expressions-before-whitespace/input.js @@ -0,0 +1,16 @@ +var x = +
+
diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-insert-commas-after-expressions-before-whitespace/output.mjs b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-insert-commas-after-expressions-before-whitespace/output.mjs new file mode 100644 index 000000000000..a7dc56ee3195 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-insert-commas-after-expressions-before-whitespace/output.mjs @@ -0,0 +1,8 @@ +import { jsx as _jsx } from "react/jsx-runtime"; + +var x = /*#__PURE__*/_jsx("div", { + attr1: "foo" + "bar", + attr2: "foo" + "bar" + "baz" + "bug", + attr3: "foo" + "bar" + "baz" + "bug", + attr4: "baz" +}); diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-not-add-quotes-to-identifier-names/input.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-not-add-quotes-to-identifier-names/input.js new file mode 100644 index 000000000000..44d58a60fecf --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-not-add-quotes-to-identifier-names/input.js @@ -0,0 +1 @@ +var e = ; diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-not-add-quotes-to-identifier-names/output.mjs b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-not-add-quotes-to-identifier-names/output.mjs new file mode 100644 index 000000000000..210066ec1feb --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-not-add-quotes-to-identifier-names/output.mjs @@ -0,0 +1,10 @@ +import { jsx as _jsx } from "react/jsx-runtime"; + +var e = /*#__PURE__*/_jsx(F, { + aaa: true, + new: true, + const: true, + var: true, + default: true, + "foo-bar": true +}); diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-not-mangle-expressioncontainer-attribute-values/input.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-not-mangle-expressioncontainer-attribute-values/input.js new file mode 100644 index 000000000000..acecaa910f20 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-not-mangle-expressioncontainer-attribute-values/input.js @@ -0,0 +1 @@ +; diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-not-mangle-expressioncontainer-attribute-values/output.mjs b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-not-mangle-expressioncontainer-attribute-values/output.mjs new file mode 100644 index 000000000000..198de8a24158 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-not-mangle-expressioncontainer-attribute-values/output.mjs @@ -0,0 +1,7 @@ +import { jsx as _jsx } from "react/jsx-runtime"; + +/*#__PURE__*/ +_jsx("button", { + "data-value": "a value\n with\nnewlines\n and spaces", + children: "Button" +}); diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-not-strip-nbsp-even-coupled-with-other-whitespace/input.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-not-strip-nbsp-even-coupled-with-other-whitespace/input.js new file mode 100644 index 000000000000..38d8acbab545 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-not-strip-nbsp-even-coupled-with-other-whitespace/input.js @@ -0,0 +1 @@ +
 
; diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-not-strip-nbsp-even-coupled-with-other-whitespace/output.mjs b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-not-strip-nbsp-even-coupled-with-other-whitespace/output.mjs new file mode 100644 index 000000000000..86f0e9eaecea --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-not-strip-nbsp-even-coupled-with-other-whitespace/output.mjs @@ -0,0 +1,6 @@ +import { jsx as _jsx } from "react/jsx-runtime"; + +/*#__PURE__*/ +_jsx("div", { + children: "\xA0 " +}); diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-not-strip-tags-with-a-single-child-of-nbsp/input.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-not-strip-tags-with-a-single-child-of-nbsp/input.js new file mode 100644 index 000000000000..0e05a7be8d23 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-not-strip-tags-with-a-single-child-of-nbsp/input.js @@ -0,0 +1 @@ +
 
; diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-not-strip-tags-with-a-single-child-of-nbsp/output.mjs b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-not-strip-tags-with-a-single-child-of-nbsp/output.mjs new file mode 100644 index 000000000000..6a0ea18e16cc --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-not-strip-tags-with-a-single-child-of-nbsp/output.mjs @@ -0,0 +1,6 @@ +import { jsx as _jsx } from "react/jsx-runtime"; + +/*#__PURE__*/ +_jsx("div", { + children: "\xA0" +}); diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-properly-handle-comments-between-props/input.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-properly-handle-comments-between-props/input.js new file mode 100644 index 000000000000..8b1943e8f683 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-properly-handle-comments-between-props/input.js @@ -0,0 +1,10 @@ +var x = ( +
+ +
+); diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-properly-handle-comments-between-props/output.mjs b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-properly-handle-comments-between-props/output.mjs new file mode 100644 index 000000000000..7b0923e09649 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-properly-handle-comments-between-props/output.mjs @@ -0,0 +1,11 @@ +import { jsx as _jsx } from "react/jsx-runtime"; + +var x = /*#__PURE__*/_jsx("div", { + /* a multi-line + comment */ + attr1: "foo", + children: /*#__PURE__*/_jsx("span", { + // a double-slash comment + attr2: "bar" + }) +}); diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-properly-handle-keys/input.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-properly-handle-keys/input.js new file mode 100644 index 000000000000..336592502a4b --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-properly-handle-keys/input.js @@ -0,0 +1,7 @@ +var x = ( +
+
+
+
+
+); \ No newline at end of file diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-properly-handle-keys/output.mjs b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-properly-handle-keys/output.mjs new file mode 100644 index 000000000000..3b72b3dc762e --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-properly-handle-keys/output.mjs @@ -0,0 +1,8 @@ +import { jsx as _jsx } from "react/jsx-runtime"; +import { jsxs as _jsxs } from "react/jsx-runtime"; + +var x = /*#__PURE__*/_jsxs("div", { + children: [/*#__PURE__*/_jsx("div", {}, "1"), /*#__PURE__*/_jsx("div", { + meow: "wolf" + }, "2"), /*#__PURE__*/_jsx("div", {}, "3")] +}); diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-properly-handle-null-prop-spread/input.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-properly-handle-null-prop-spread/input.js new file mode 100644 index 000000000000..e0b99b87da51 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-properly-handle-null-prop-spread/input.js @@ -0,0 +1,2 @@ +var foo = null; +var x =
; diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-properly-handle-null-prop-spread/output.mjs b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-properly-handle-null-prop-spread/output.mjs new file mode 100644 index 000000000000..075d0ab77a09 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-properly-handle-null-prop-spread/output.mjs @@ -0,0 +1,5 @@ +import { jsx as _jsx } from "react/jsx-runtime"; +var foo = null; + +var x = /*#__PURE__*/_jsx("div", { ...foo +}); diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-quote-jsx-attributes/input.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-quote-jsx-attributes/input.js new file mode 100644 index 000000000000..c794650e94a6 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-quote-jsx-attributes/input.js @@ -0,0 +1 @@ +; diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-quote-jsx-attributes/output.mjs b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-quote-jsx-attributes/output.mjs new file mode 100644 index 000000000000..6644401db9a0 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-quote-jsx-attributes/output.mjs @@ -0,0 +1,7 @@ +import { jsx as _jsx } from "react/jsx-runtime"; + +/*#__PURE__*/ +_jsx("button", { + "data-value": "a value", + children: "Button" +}); diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-support-xml-namespaces-if-flag/input.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-support-xml-namespaces-if-flag/input.js new file mode 100644 index 000000000000..48d051a95141 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-support-xml-namespaces-if-flag/input.js @@ -0,0 +1 @@ +; diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-support-xml-namespaces-if-flag/options.json b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-support-xml-namespaces-if-flag/options.json new file mode 100644 index 000000000000..01032c9b0642 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-support-xml-namespaces-if-flag/options.json @@ -0,0 +1,11 @@ +{ + "plugins": [ + [ + "transform-react-jsx", + { + "throwIfNamespace": false, + "runtime": "automatic" + } + ] + ] +} diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-support-xml-namespaces-if-flag/output.mjs b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-support-xml-namespaces-if-flag/output.mjs new file mode 100644 index 000000000000..a1da85af076e --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-support-xml-namespaces-if-flag/output.mjs @@ -0,0 +1,6 @@ +import { jsx as _jsx } from "react/jsx-runtime"; + +/*#__PURE__*/ +_jsx("f:image", { + "n:attr": true +}); diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-throw-error-namespaces-if-not-flag/input.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-throw-error-namespaces-if-not-flag/input.js new file mode 100644 index 000000000000..4888b2b70588 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-throw-error-namespaces-if-not-flag/input.js @@ -0,0 +1 @@ +; diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-throw-error-namespaces-if-not-flag/options.json b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-throw-error-namespaces-if-not-flag/options.json new file mode 100644 index 000000000000..a950825ce2f8 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-throw-error-namespaces-if-not-flag/options.json @@ -0,0 +1,12 @@ +{ + "plugins": [ + [ + "transform-react-jsx", + { + "throwIfNamespace": true, + "runtime": "automatic" + } + ] + ], + "throws": "Namespace tags are not supported by default. React's JSX doesn't support namespace tags. You can set `throwIfNamespace: false` to bypass this warning." +} diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-transform-known-hyphenated-tags/input.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-transform-known-hyphenated-tags/input.js new file mode 100644 index 000000000000..1cb54dd68816 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-transform-known-hyphenated-tags/input.js @@ -0,0 +1 @@ +; diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-transform-known-hyphenated-tags/output.mjs b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-transform-known-hyphenated-tags/output.mjs new file mode 100644 index 000000000000..2ea1f6082aca --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-transform-known-hyphenated-tags/output.mjs @@ -0,0 +1,4 @@ +import { jsx as _jsx } from "react/jsx-runtime"; + +/*#__PURE__*/ +_jsx("font-face", {}); diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-use-createElement-when-key-comes-after-spread/input.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-use-createElement-when-key-comes-after-spread/input.js new file mode 100644 index 000000000000..927a4174b6ed --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-use-createElement-when-key-comes-after-spread/input.js @@ -0,0 +1,3 @@ +var x = ( +
+); \ No newline at end of file diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-use-createElement-when-key-comes-after-spread/output.mjs b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-use-createElement-when-key-comes-after-spread/output.mjs new file mode 100644 index 000000000000..312d7cfc2a8a --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-use-createElement-when-key-comes-after-spread/output.mjs @@ -0,0 +1,6 @@ +import { createElement as _createElement } from "react"; + +var x = /*#__PURE__*/_createElement("div", { ...props, + key: "1", + foo: "bar" +}); diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-use-jsx-when-key-comes-before-spread/input.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-use-jsx-when-key-comes-before-spread/input.js new file mode 100644 index 000000000000..650a8354fe4a --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-use-jsx-when-key-comes-before-spread/input.js @@ -0,0 +1,3 @@ +var x = ( +
+); \ No newline at end of file diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-use-jsx-when-key-comes-before-spread/output.mjs b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-use-jsx-when-key-comes-before-spread/output.mjs new file mode 100644 index 000000000000..5e449874dd87 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-use-jsx-when-key-comes-before-spread/output.mjs @@ -0,0 +1,5 @@ +import { jsx as _jsx } from "react/jsx-runtime"; + +var x = /*#__PURE__*/_jsx("div", { ...props, + foo: "bar" +}, "1"); diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-warn-when-pragma-or-pragmaFrag-is-set/input.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-warn-when-pragma-or-pragmaFrag-is-set/input.js new file mode 100644 index 000000000000..1addddeb1500 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-warn-when-pragma-or-pragmaFrag-is-set/input.js @@ -0,0 +1 @@ +var div =
test
; diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-warn-when-pragma-or-pragmaFrag-is-set/options.json b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-warn-when-pragma-or-pragmaFrag-is-set/options.json new file mode 100644 index 000000000000..4c953facac1e --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-warn-when-pragma-or-pragmaFrag-is-set/options.json @@ -0,0 +1,13 @@ +{ + "plugins": [ + [ + "transform-react-jsx", + { + "runtime": "automatic", + "pragma": "foo" + } + ] + ], + "sourceType": "module", + "throws": "pragma and pragmaFrag cannot be set when runtime is automatic." +} diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-warn-when-pragma-or-pragmaFrag-pragma-is-set.1/input.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-warn-when-pragma-or-pragmaFrag-pragma-is-set.1/input.js new file mode 100644 index 000000000000..cf33e0165ae1 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-warn-when-pragma-or-pragmaFrag-pragma-is-set.1/input.js @@ -0,0 +1,4 @@ +/** @jsx foo */ +/** @jsx bar */ + +var div =
test
; diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-warn-when-pragma-or-pragmaFrag-pragma-is-set.1/options.json b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-warn-when-pragma-or-pragmaFrag-pragma-is-set.1/options.json new file mode 100644 index 000000000000..3f3adc0cc707 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/should-warn-when-pragma-or-pragmaFrag-pragma-is-set.1/options.json @@ -0,0 +1,3 @@ +{ + "throws": "pragma and pragmaFrag cannot be set when runtime is automatic." +} diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/this-tag-name/input.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/this-tag-name/input.js new file mode 100644 index 000000000000..f65588acf7b4 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/this-tag-name/input.js @@ -0,0 +1 @@ +var div = test; diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/this-tag-name/output.mjs b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/this-tag-name/output.mjs new file mode 100644 index 000000000000..eb3f1f63a15b --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/this-tag-name/output.mjs @@ -0,0 +1,5 @@ +import { jsx as _jsx } from "react/jsx-runtime"; + +var div = /*#__PURE__*/_jsx(this.foo, { + children: "test" +}); diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/weird-symbols/input.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/weird-symbols/input.js new file mode 100644 index 000000000000..e4bc0b7035e2 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/weird-symbols/input.js @@ -0,0 +1,5 @@ +class MobileHomeActivityTaskPriorityIcon extends React.PureComponent { + render() { + return  {this.props.value} ; + } +} diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/weird-symbols/output.mjs b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/weird-symbols/output.mjs new file mode 100644 index 000000000000..65cfda12fc6a --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/weird-symbols/output.mjs @@ -0,0 +1,10 @@ +import { jsxs as _jsxs } from "react/jsx-runtime"; + +class MobileHomeActivityTaskPriorityIcon extends React.PureComponent { + render() { + return /*#__PURE__*/_jsxs(Text, { + children: ["\xA0", this.props.value, "\xA0"] + }); + } + +} diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/wraps-props-in-react-spread-for-last-spread-attributes/input.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/wraps-props-in-react-spread-for-last-spread-attributes/input.js new file mode 100644 index 000000000000..ce7fb5b60f9f --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/wraps-props-in-react-spread-for-last-spread-attributes/input.js @@ -0,0 +1 @@ + diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/wraps-props-in-react-spread-for-last-spread-attributes/output.mjs b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/wraps-props-in-react-spread-for-last-spread-attributes/output.mjs new file mode 100644 index 000000000000..cc9c33d709a1 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/wraps-props-in-react-spread-for-last-spread-attributes/output.mjs @@ -0,0 +1,8 @@ +import { jsx as _jsx } from "react/jsx-runtime"; + +/*#__PURE__*/ +_jsx(Component, { + y: 2, + z: true, + ...x +}); diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/wraps-props-in-react-spread-for-middle-spread-attributes/input.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/wraps-props-in-react-spread-for-middle-spread-attributes/input.js new file mode 100644 index 000000000000..919adaebb41e --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/wraps-props-in-react-spread-for-middle-spread-attributes/input.js @@ -0,0 +1 @@ + diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/wraps-props-in-react-spread-for-middle-spread-attributes/output.mjs b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/wraps-props-in-react-spread-for-middle-spread-attributes/output.mjs new file mode 100644 index 000000000000..c63d50f6fcbb --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReact/wraps-props-in-react-spread-for-middle-spread-attributes/output.mjs @@ -0,0 +1,8 @@ +import { jsx as _jsx } from "react/jsx-runtime"; + +/*#__PURE__*/ +_jsx(Component, { + y: 2, + ...x, + z: true +}); diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/.should-properly-handle-comments-adjacent-to-children/input.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/.should-properly-handle-comments-adjacent-to-children/input.js new file mode 100644 index 000000000000..412984681eea --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/.should-properly-handle-comments-adjacent-to-children/input.js @@ -0,0 +1,13 @@ +var x = ( +
+ {/* A comment at the beginning */} + {/* A second comment at the beginning */} + + {/* A nested comment */} + + {/* A sandwiched comment */} +
+ {/* A comment at the end */} + {/* A second comment at the end */} +
+); diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/adds-appropriate-newlines-when-using-spread-attribute/input.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/adds-appropriate-newlines-when-using-spread-attribute/input.js new file mode 100644 index 000000000000..e09c3885b741 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/adds-appropriate-newlines-when-using-spread-attribute/input.js @@ -0,0 +1,4 @@ +/** @jsxRuntime classic */ + diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/adds-appropriate-newlines-when-using-spread-attribute/output.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/adds-appropriate-newlines-when-using-spread-attribute/output.js new file mode 100644 index 000000000000..fae9bf83c1fd --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/adds-appropriate-newlines-when-using-spread-attribute/output.js @@ -0,0 +1,6 @@ +/** @jsxRuntime classic */ + +/*#__PURE__*/ +React.createElement(Component, { ...props, + sound: "moo" +}); diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/arrow-functions/input.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/arrow-functions/input.js new file mode 100644 index 000000000000..146b5b55bc11 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/arrow-functions/input.js @@ -0,0 +1,8 @@ +/** @jsxRuntime classic */ +var foo = function () { + return () => ; +}; + +var bar = function () { + return () => ; +}; diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/arrow-functions/output.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/arrow-functions/output.js new file mode 100644 index 000000000000..9efe9c1f81c1 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/arrow-functions/output.js @@ -0,0 +1,16 @@ +/** @jsxRuntime classic */ +var foo = function () { + var _this = this; + + return function () { + return /*#__PURE__*/React.createElement(_this, null); + }; +}; + +var bar = function () { + var _this2 = this; + + return function () { + return /*#__PURE__*/React.createElement(_this2.foo, null); + }; +}; diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/assignment/input.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/assignment/input.js new file mode 100644 index 000000000000..3cfebe4848c2 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/assignment/input.js @@ -0,0 +1,2 @@ +/** @jsxRuntime classic */ +var div = diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/assignment/output.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/assignment/output.js new file mode 100644 index 000000000000..ca1e5ccf7a27 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/assignment/output.js @@ -0,0 +1,4 @@ +/** @jsxRuntime classic */ +var div = /*#__PURE__*/React.createElement(Component, { ...props, + foo: "bar" +}); diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/concatenates-adjacent-string-literals/input.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/concatenates-adjacent-string-literals/input.js new file mode 100644 index 000000000000..f6bc6c9137cd --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/concatenates-adjacent-string-literals/input.js @@ -0,0 +1,14 @@ +/** @jsxRuntime classic */ +var x = +
+ foo + {"bar"} + baz +
+ buz + bang +
+ qux + {null} + quack +
diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/concatenates-adjacent-string-literals/output.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/concatenates-adjacent-string-literals/output.js new file mode 100644 index 000000000000..8a2a3cc5e614 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/concatenates-adjacent-string-literals/output.js @@ -0,0 +1,2 @@ +/** @jsxRuntime classic */ +var x = /*#__PURE__*/React.createElement("div", null, "foo", "bar", "baz", /*#__PURE__*/React.createElement("div", null, "buz bang"), "qux", null, "quack"); diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/does-not-add-source-self/input.mjs b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/does-not-add-source-self/input.mjs new file mode 100644 index 000000000000..76b067760e24 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/does-not-add-source-self/input.mjs @@ -0,0 +1,11 @@ +/** @jsxRuntime classic */ +var x = ( + <> +
+
+
+
+
+
+ +); diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/does-not-add-source-self/options.json b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/does-not-add-source-self/options.json new file mode 100644 index 000000000000..aa1ff2bb27dd --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/does-not-add-source-self/options.json @@ -0,0 +1,5 @@ +{ + "plugins": [ + ["transform-react-jsx", { "runtime": "automatic" }] + ] +} diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/does-not-add-source-self/output.mjs b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/does-not-add-source-self/output.mjs new file mode 100644 index 000000000000..d35cf1d205b8 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/does-not-add-source-self/output.mjs @@ -0,0 +1,11 @@ +/** @jsxRuntime classic */ +var x = /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", { + key: "1" +}), /*#__PURE__*/React.createElement("div", { + key: "2", + meow: "wolf" +}), /*#__PURE__*/React.createElement("div", { + key: "3" +}), /*#__PURE__*/React.createElement("div", { ...props, + key: "4" +}))); diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/dont-coerce-expression-containers/input.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/dont-coerce-expression-containers/input.js new file mode 100644 index 000000000000..94a0cf377be2 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/dont-coerce-expression-containers/input.js @@ -0,0 +1,6 @@ +/** @jsxRuntime classic */ + + + To get started, edit index.ios.js!!!{"\n"} + Press Cmd+R to reload + diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/dont-coerce-expression-containers/output.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/dont-coerce-expression-containers/output.js new file mode 100644 index 000000000000..2f9477527194 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/dont-coerce-expression-containers/output.js @@ -0,0 +1,4 @@ +/** @jsxRuntime classic */ + +/*#__PURE__*/ +React.createElement(Text, null, "To get started, edit index.ios.js!!!", "\n", "Press Cmd+R to reload"); diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/honor-custom-jsx-comment-if-jsx-pragma-option-set/input.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/honor-custom-jsx-comment-if-jsx-pragma-option-set/input.js new file mode 100644 index 000000000000..69fe030d073e --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/honor-custom-jsx-comment-if-jsx-pragma-option-set/input.js @@ -0,0 +1,9 @@ +/** @jsx dom */ +/** @jsxRuntime classic */ + +; + +var profile =
+ +

{[user.firstName, user.lastName].join(" ")}

+
; \ No newline at end of file diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/honor-custom-jsx-comment-if-jsx-pragma-option-set/options.json b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/honor-custom-jsx-comment-if-jsx-pragma-option-set/options.json new file mode 100644 index 000000000000..3ad1bbd803fd --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/honor-custom-jsx-comment-if-jsx-pragma-option-set/options.json @@ -0,0 +1,5 @@ +{ + "plugins": [ + ["transform-react-jsx", { "pragma": "foo.bar", "runtime": "automatic" }] + ] +} diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/honor-custom-jsx-comment-if-jsx-pragma-option-set/output.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/honor-custom-jsx-comment-if-jsx-pragma-option-set/output.js new file mode 100644 index 000000000000..8a16fa51ad57 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/honor-custom-jsx-comment-if-jsx-pragma-option-set/output.js @@ -0,0 +1,8 @@ +/** @jsx dom */ + +/** @jsxRuntime classic */ +dom(Foo, null); +var profile = dom("div", null, dom("img", { + src: "avatar.png", + className: "profile" +}), dom("h3", null, [user.firstName, user.lastName].join(" "))); diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/honor-custom-jsx-comment/input.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/honor-custom-jsx-comment/input.js new file mode 100644 index 000000000000..69fe030d073e --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/honor-custom-jsx-comment/input.js @@ -0,0 +1,9 @@ +/** @jsx dom */ +/** @jsxRuntime classic */ + +; + +var profile =
+ +

{[user.firstName, user.lastName].join(" ")}

+
; \ No newline at end of file diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/honor-custom-jsx-comment/output.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/honor-custom-jsx-comment/output.js new file mode 100644 index 000000000000..8a16fa51ad57 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/honor-custom-jsx-comment/output.js @@ -0,0 +1,8 @@ +/** @jsx dom */ + +/** @jsxRuntime classic */ +dom(Foo, null); +var profile = dom("div", null, dom("img", { + src: "avatar.png", + className: "profile" +}), dom("h3", null, [user.firstName, user.lastName].join(" "))); diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/honor-custom-jsx-pragma-option/input.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/honor-custom-jsx-pragma-option/input.js new file mode 100644 index 000000000000..3ddd98910aa4 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/honor-custom-jsx-pragma-option/input.js @@ -0,0 +1,8 @@ +/** @jsxRuntime classic */ + +; + +var profile =
+ +

{[user.firstName, user.lastName].join(" ")}

+
; diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/honor-custom-jsx-pragma-option/options.json b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/honor-custom-jsx-pragma-option/options.json new file mode 100644 index 000000000000..b2f377aecdc7 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/honor-custom-jsx-pragma-option/options.json @@ -0,0 +1,5 @@ +{ + "plugins": [ + ["transform-react-jsx", { "pragma": "dom", "runtime": "automatic" }] + ] +} diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/honor-custom-jsx-pragma-option/output.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/honor-custom-jsx-pragma-option/output.js new file mode 100644 index 000000000000..901d0380b45b --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/honor-custom-jsx-pragma-option/output.js @@ -0,0 +1,6 @@ +/** @jsxRuntime classic */ +dom(Foo, null); +var profile = dom("div", null, dom("img", { + src: "avatar.png", + className: "profile" +}), dom("h3", null, [user.firstName, user.lastName].join(" "))); diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/jsx-with-retainlines-option/input.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/jsx-with-retainlines-option/input.js new file mode 100644 index 000000000000..7925155a5faf --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/jsx-with-retainlines-option/input.js @@ -0,0 +1,3 @@ +/** @jsxRuntime classic */ + +var div =
test
; diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/jsx-with-retainlines-option/options.json b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/jsx-with-retainlines-option/options.json new file mode 100644 index 000000000000..97925bbcb61b --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/jsx-with-retainlines-option/options.json @@ -0,0 +1,3 @@ +{ + "retainLines": true +} diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/jsx-with-retainlines-option/output.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/jsx-with-retainlines-option/output.js new file mode 100644 index 000000000000..2400c365d313 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/jsx-with-retainlines-option/output.js @@ -0,0 +1,3 @@ +/** @jsxRuntime classic */ + +var div = /*#__PURE__*/React.createElement("div", null, "test"); diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/jsx-without-retainlines-option/input.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/jsx-without-retainlines-option/input.js new file mode 100644 index 000000000000..7925155a5faf --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/jsx-without-retainlines-option/input.js @@ -0,0 +1,3 @@ +/** @jsxRuntime classic */ + +var div =
test
; diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/jsx-without-retainlines-option/output.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/jsx-without-retainlines-option/output.js new file mode 100644 index 000000000000..43741ba3ba10 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/jsx-without-retainlines-option/output.js @@ -0,0 +1,2 @@ +/** @jsxRuntime classic */ +var div = /*#__PURE__*/React.createElement("div", null, "test"); diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/options.json b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/options.json new file mode 100644 index 000000000000..a2a30a0fea14 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/options.json @@ -0,0 +1,9 @@ +{ + "plugins": [ + "external-helpers", + "syntax-jsx", + ["transform-react-jsx", { "runtime": "automatic" }], + "transform-react-display-name", + "transform-arrow-functions" + ] +} diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/pragma-works-with-no-space-at-the-end/input.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/pragma-works-with-no-space-at-the-end/input.js new file mode 100644 index 000000000000..51b521e971cb --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/pragma-works-with-no-space-at-the-end/input.js @@ -0,0 +1,3 @@ +/* @jsx foo*/ +/* @jsxRuntime classic*/ +
Hi
; \ No newline at end of file diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/pragma-works-with-no-space-at-the-end/output.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/pragma-works-with-no-space-at-the-end/output.js new file mode 100644 index 000000000000..4d728dbbc31d --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/pragma-works-with-no-space-at-the-end/output.js @@ -0,0 +1,4 @@ +/* @jsx foo*/ + +/* @jsxRuntime classic*/ +foo("div", null, "Hi"); diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-add-quotes-es3/input.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-add-quotes-es3/input.js new file mode 100644 index 000000000000..85136cce1ea3 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-add-quotes-es3/input.js @@ -0,0 +1,3 @@ +/** @jsxRuntime classic */ + +var es3 = ; diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-add-quotes-es3/options.json b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-add-quotes-es3/options.json new file mode 100644 index 000000000000..05afa82f8856 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-add-quotes-es3/options.json @@ -0,0 +1,6 @@ +{ + "plugins": [ + ["transform-react-jsx", { "runtime": "automatic" }], + "transform-property-literals" + ] +} diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-add-quotes-es3/output.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-add-quotes-es3/output.js new file mode 100644 index 000000000000..f6df48def162 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-add-quotes-es3/output.js @@ -0,0 +1,9 @@ +/** @jsxRuntime classic */ +var es3 = /*#__PURE__*/React.createElement(F, { + aaa: true, + "new": true, + "const": true, + "var": true, + "default": true, + "foo-bar": true +}); diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-allow-constructor-as-prop/input.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-allow-constructor-as-prop/input.js new file mode 100644 index 000000000000..800405ccf161 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-allow-constructor-as-prop/input.js @@ -0,0 +1,3 @@ +/** @jsxRuntime classic */ + +; diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-allow-constructor-as-prop/output.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-allow-constructor-as-prop/output.js new file mode 100644 index 000000000000..0254eb89ac3d --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-allow-constructor-as-prop/output.js @@ -0,0 +1,6 @@ +/** @jsxRuntime classic */ + +/*#__PURE__*/ +React.createElement(Component, { + constructor: "foo" +}); diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-allow-deeper-js-namespacing/input.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-allow-deeper-js-namespacing/input.js new file mode 100644 index 000000000000..b1901371c78c --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-allow-deeper-js-namespacing/input.js @@ -0,0 +1,3 @@ +/** @jsxRuntime classic */ + +; diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-allow-deeper-js-namespacing/output.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-allow-deeper-js-namespacing/output.js new file mode 100644 index 000000000000..35f62488191e --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-allow-deeper-js-namespacing/output.js @@ -0,0 +1,4 @@ +/** @jsxRuntime classic */ + +/*#__PURE__*/ +React.createElement(Namespace.DeepNamespace.Component, null); diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-allow-elements-as-attributes/input.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-allow-elements-as-attributes/input.js new file mode 100644 index 000000000000..03e9c398f659 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-allow-elements-as-attributes/input.js @@ -0,0 +1,3 @@ +/** @jsxRuntime classic */ + +
/> diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-allow-elements-as-attributes/output.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-allow-elements-as-attributes/output.js new file mode 100644 index 000000000000..58f1a3e44b69 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-allow-elements-as-attributes/output.js @@ -0,0 +1,6 @@ +/** @jsxRuntime classic */ + +/*#__PURE__*/ +React.createElement("div", { + attr: /*#__PURE__*/React.createElement("div", null) +}); diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-allow-js-namespacing/blacklist.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-allow-js-namespacing/blacklist.js new file mode 100644 index 000000000000..980df4572437 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-allow-js-namespacing/blacklist.js @@ -0,0 +1 @@ +React.createElement(Namespace.Component, null); diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-allow-js-namespacing/input.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-allow-js-namespacing/input.js new file mode 100644 index 000000000000..2efe6a4507fe --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-allow-js-namespacing/input.js @@ -0,0 +1,3 @@ +/** @jsxRuntime classic */ + +; diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-allow-js-namespacing/output.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-allow-js-namespacing/output.js new file mode 100644 index 000000000000..8155fe4bee44 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-allow-js-namespacing/output.js @@ -0,0 +1,4 @@ +/** @jsxRuntime classic */ + +/*#__PURE__*/ +React.createElement(Namespace.Component, null); diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-allow-nested-fragments/input.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-allow-nested-fragments/input.js new file mode 100644 index 000000000000..272313559aa0 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-allow-nested-fragments/input.js @@ -0,0 +1,14 @@ +/** @jsxRuntime classic */ + +
+ < > + <> + Hello + world + + <> + Goodbye + world + + +
diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-allow-nested-fragments/output.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-allow-nested-fragments/output.js new file mode 100644 index 000000000000..57aa42727bc2 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-allow-nested-fragments/output.js @@ -0,0 +1,4 @@ +/** @jsxRuntime classic */ + +/*#__PURE__*/ +React.createElement("div", null, /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("span", null, "Hello"), /*#__PURE__*/React.createElement("span", null, "world")), /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("span", null, "Goodbye"), /*#__PURE__*/React.createElement("span", null, "world")))); diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-allow-no-pragmafrag-if-frag-unused/input.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-allow-no-pragmafrag-if-frag-unused/input.js new file mode 100644 index 000000000000..6502862189e8 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-allow-no-pragmafrag-if-frag-unused/input.js @@ -0,0 +1,4 @@ +/** @jsx dom */ +/** @jsxRuntime classic */ + +
no fragment is used
diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-allow-no-pragmafrag-if-frag-unused/output.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-allow-no-pragmafrag-if-frag-unused/output.js new file mode 100644 index 000000000000..7bee4e0fd605 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-allow-no-pragmafrag-if-frag-unused/output.js @@ -0,0 +1,4 @@ +/** @jsx dom */ + +/** @jsxRuntime classic */ +dom("div", null, "no fragment is used"); diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-allow-pragmafrag-and-frag/input.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-allow-pragmafrag-and-frag/input.js new file mode 100644 index 000000000000..1935a8d935df --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-allow-pragmafrag-and-frag/input.js @@ -0,0 +1,5 @@ +/** @jsx dom */ +/** @jsxFrag DomFrag */ +/** @jsxRuntime classic */ + +<> diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-allow-pragmafrag-and-frag/output.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-allow-pragmafrag-and-frag/output.js new file mode 100644 index 000000000000..3de4670bb103 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-allow-pragmafrag-and-frag/output.js @@ -0,0 +1,6 @@ +/** @jsx dom */ + +/** @jsxFrag DomFrag */ + +/** @jsxRuntime classic */ +dom(DomFrag, null); diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-avoid-wrapping-in-extra-parens-if-not-needed/input.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-avoid-wrapping-in-extra-parens-if-not-needed/input.js new file mode 100644 index 000000000000..96e5ee53a337 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-avoid-wrapping-in-extra-parens-if-not-needed/input.js @@ -0,0 +1,17 @@ +/** @jsxRuntime classic */ + +var x =
+ +
; + +var x =
+ {props.children} +
; + +var x = + {props.children} +; + +var x = + +; diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-avoid-wrapping-in-extra-parens-if-not-needed/output.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-avoid-wrapping-in-extra-parens-if-not-needed/output.js new file mode 100644 index 000000000000..c930341f467f --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-avoid-wrapping-in-extra-parens-if-not-needed/output.js @@ -0,0 +1,5 @@ +/** @jsxRuntime classic */ +var x = /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Component, null)); +var x = /*#__PURE__*/React.createElement("div", null, props.children); +var x = /*#__PURE__*/React.createElement(Composite, null, props.children); +var x = /*#__PURE__*/React.createElement(Composite, null, /*#__PURE__*/React.createElement(Composite2, null)); diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-convert-simple-tags/input.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-convert-simple-tags/input.js new file mode 100644 index 000000000000..b44c9df498ad --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-convert-simple-tags/input.js @@ -0,0 +1,3 @@ +/** @jsxRuntime classic */ + +var x =
; diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-convert-simple-tags/output.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-convert-simple-tags/output.js new file mode 100644 index 000000000000..a52c7633a135 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-convert-simple-tags/output.js @@ -0,0 +1,2 @@ +/** @jsxRuntime classic */ +var x = /*#__PURE__*/React.createElement("div", null); diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-convert-simple-text/input.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-convert-simple-text/input.js new file mode 100644 index 000000000000..58ce60409dff --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-convert-simple-text/input.js @@ -0,0 +1,3 @@ +/** @jsxRuntime classic */ + +var x =
text
; diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-convert-simple-text/output.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-convert-simple-text/output.js new file mode 100644 index 000000000000..93df9c804ead --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-convert-simple-text/output.js @@ -0,0 +1,2 @@ +/** @jsxRuntime classic */ +var x = /*#__PURE__*/React.createElement("div", null, "text"); diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-disallow-spread-children/input.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-disallow-spread-children/input.js new file mode 100644 index 000000000000..f03824881760 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-disallow-spread-children/input.js @@ -0,0 +1,3 @@ +/** @jsxRuntime classic */ + +
{...children}
; diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-disallow-spread-children/options.json b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-disallow-spread-children/options.json new file mode 100644 index 000000000000..bcb773e34314 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-disallow-spread-children/options.json @@ -0,0 +1,3 @@ +{ + "throws": "Spread children are not supported in React." +} diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-disallow-xml-namespacing/input.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-disallow-xml-namespacing/input.js new file mode 100644 index 000000000000..bf7dfa85e491 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-disallow-xml-namespacing/input.js @@ -0,0 +1,3 @@ +/** @jsxRuntime classic */ + +; diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-disallow-xml-namespacing/options.json b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-disallow-xml-namespacing/options.json new file mode 100644 index 000000000000..746037e9f505 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-disallow-xml-namespacing/options.json @@ -0,0 +1,3 @@ +{ + "throws": "Namespace tags are not supported by default. React's JSX doesn't support namespace tags. You can set `throwIfNamespace: false` to bypass this warning." +} diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-escape-xhtml-jsxattribute/input.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-escape-xhtml-jsxattribute/input.js new file mode 100644 index 000000000000..e2bf4e81ff6b --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-escape-xhtml-jsxattribute/input.js @@ -0,0 +1,5 @@ +/** @jsxRuntime classic */ + +
; +
; +
; diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-escape-xhtml-jsxattribute/output.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-escape-xhtml-jsxattribute/output.js new file mode 100644 index 000000000000..b0727d295e1b --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-escape-xhtml-jsxattribute/output.js @@ -0,0 +1,16 @@ +/** @jsxRuntime classic */ + +/*#__PURE__*/ +React.createElement("div", { + id: "w\xF4w" +}); + +/*#__PURE__*/ +React.createElement("div", { + id: "\\w" +}); + +/*#__PURE__*/ +React.createElement("div", { + id: "w < w" +}); diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-escape-xhtml-jsxtext/input.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-escape-xhtml-jsxtext/input.js new file mode 100644 index 000000000000..c8ace0874559 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-escape-xhtml-jsxtext/input.js @@ -0,0 +1,14 @@ +/** @jsxRuntime classic */ + +
wow
; +
wôw
; + +
w & w
; +
w & w
; + +
w   w
; +
this should not parse as unicode: \u00a0
; +
this should parse as nbsp:  
; +
this should parse as unicode: {'\u00a0 '}
; + +
w < w
; diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-escape-xhtml-jsxtext/output.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-escape-xhtml-jsxtext/output.js new file mode 100644 index 000000000000..c4288df1dd0f --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-escape-xhtml-jsxtext/output.js @@ -0,0 +1,28 @@ +/** @jsxRuntime classic */ + +/*#__PURE__*/ +React.createElement("div", null, "wow"); + +/*#__PURE__*/ +React.createElement("div", null, "w\xF4w"); + +/*#__PURE__*/ +React.createElement("div", null, "w & w"); + +/*#__PURE__*/ +React.createElement("div", null, "w & w"); + +/*#__PURE__*/ +React.createElement("div", null, "w \xA0 w"); + +/*#__PURE__*/ +React.createElement("div", null, "this should not parse as unicode: \\u00a0"); + +/*#__PURE__*/ +React.createElement("div", null, "this should parse as nbsp: \xA0 "); + +/*#__PURE__*/ +React.createElement("div", null, "this should parse as unicode: ", '\u00a0 '); + +/*#__PURE__*/ +React.createElement("div", null, "w < w"); diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-handle-attributed-elements/input.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-handle-attributed-elements/input.js new file mode 100644 index 000000000000..d98877346313 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-handle-attributed-elements/input.js @@ -0,0 +1,13 @@ +/** @jsxRuntime classic */ + +var HelloMessage = React.createClass({ + render: function() { + return
Hello {this.props.name}
; + } +}); + +React.render( + Sebastian + +} />, mountNode); diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-handle-attributed-elements/output.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-handle-attributed-elements/output.js new file mode 100644 index 000000000000..b23971257af1 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-handle-attributed-elements/output.js @@ -0,0 +1,10 @@ +/** @jsxRuntime classic */ +var HelloMessage = React.createClass({ + displayName: "HelloMessage", + render: function () { + return /*#__PURE__*/React.createElement("div", null, "Hello ", this.props.name); + } +}); +React.render( /*#__PURE__*/React.createElement(HelloMessage, { + name: /*#__PURE__*/React.createElement("span", null, "Sebastian") +}), mountNode); diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-handle-has-own-property-correctly/input.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-handle-has-own-property-correctly/input.js new file mode 100644 index 000000000000..ae52aae15dc4 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-handle-has-own-property-correctly/input.js @@ -0,0 +1,3 @@ +/** @jsxRuntime classic */ + +testing; diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-handle-has-own-property-correctly/output.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-handle-has-own-property-correctly/output.js new file mode 100644 index 000000000000..821ec2ada955 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-handle-has-own-property-correctly/output.js @@ -0,0 +1,4 @@ +/** @jsxRuntime classic */ + +/*#__PURE__*/ +React.createElement("hasOwnProperty", null, "testing"); diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-have-correct-comma-in-nested-children/input.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-have-correct-comma-in-nested-children/input.js new file mode 100644 index 000000000000..e52b86a63c72 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-have-correct-comma-in-nested-children/input.js @@ -0,0 +1,7 @@ +/** @jsxRuntime classic */ + +var x =
+

+ {foo}
{bar}
+
+
; diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-have-correct-comma-in-nested-children/output.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-have-correct-comma-in-nested-children/output.js new file mode 100644 index 000000000000..aa4bcfb68912 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-have-correct-comma-in-nested-children/output.js @@ -0,0 +1,2 @@ +/** @jsxRuntime classic */ +var x = /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("br", null)), /*#__PURE__*/React.createElement(Component, null, foo, /*#__PURE__*/React.createElement("br", null), bar), /*#__PURE__*/React.createElement("br", null)); diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-insert-commas-after-expressions-before-whitespace/input.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-insert-commas-after-expressions-before-whitespace/input.js new file mode 100644 index 000000000000..0ae0d87be78c --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-insert-commas-after-expressions-before-whitespace/input.js @@ -0,0 +1,18 @@ +/** @jsxRuntime classic */ + +var x = +
+
diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-insert-commas-after-expressions-before-whitespace/output.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-insert-commas-after-expressions-before-whitespace/output.js new file mode 100644 index 000000000000..b9aab6fda7a0 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-insert-commas-after-expressions-before-whitespace/output.js @@ -0,0 +1,7 @@ +/** @jsxRuntime classic */ +var x = /*#__PURE__*/React.createElement("div", { + attr1: "foo" + "bar", + attr2: "foo" + "bar" + "baz" + "bug", + attr3: "foo" + "bar" + "baz" + "bug", + attr4: "baz" +}); diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-not-add-quotes-to-identifier-names/input.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-not-add-quotes-to-identifier-names/input.js new file mode 100644 index 000000000000..46d290d40ab8 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-not-add-quotes-to-identifier-names/input.js @@ -0,0 +1,3 @@ +/** @jsxRuntime classic */ + +var e = ; diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-not-add-quotes-to-identifier-names/output.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-not-add-quotes-to-identifier-names/output.js new file mode 100644 index 000000000000..b913a10251a9 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-not-add-quotes-to-identifier-names/output.js @@ -0,0 +1,9 @@ +/** @jsxRuntime classic */ +var e = /*#__PURE__*/React.createElement(F, { + aaa: true, + new: true, + const: true, + var: true, + default: true, + "foo-bar": true +}); diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-not-mangle-expressioncontainer-attribute-values/input.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-not-mangle-expressioncontainer-attribute-values/input.js new file mode 100644 index 000000000000..ae5c7e9ea9c9 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-not-mangle-expressioncontainer-attribute-values/input.js @@ -0,0 +1,3 @@ +/** @jsxRuntime classic */ + +; diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-not-mangle-expressioncontainer-attribute-values/output.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-not-mangle-expressioncontainer-attribute-values/output.js new file mode 100644 index 000000000000..ac6e8018c90e --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-not-mangle-expressioncontainer-attribute-values/output.js @@ -0,0 +1,6 @@ +/** @jsxRuntime classic */ + +/*#__PURE__*/ +React.createElement("button", { + "data-value": "a value\n with\nnewlines\n and spaces" +}, "Button"); diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-not-strip-nbsp-even-coupled-with-other-whitespace/input.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-not-strip-nbsp-even-coupled-with-other-whitespace/input.js new file mode 100644 index 000000000000..789953ea0edb --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-not-strip-nbsp-even-coupled-with-other-whitespace/input.js @@ -0,0 +1,3 @@ +/** @jsxRuntime classic */ + +
 
; diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-not-strip-nbsp-even-coupled-with-other-whitespace/output.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-not-strip-nbsp-even-coupled-with-other-whitespace/output.js new file mode 100644 index 000000000000..3985d6e82655 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-not-strip-nbsp-even-coupled-with-other-whitespace/output.js @@ -0,0 +1,4 @@ +/** @jsxRuntime classic */ + +/*#__PURE__*/ +React.createElement("div", null, "\xA0 "); diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-not-strip-tags-with-a-single-child-of-nbsp/input.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-not-strip-tags-with-a-single-child-of-nbsp/input.js new file mode 100644 index 000000000000..f6f9afef7293 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-not-strip-tags-with-a-single-child-of-nbsp/input.js @@ -0,0 +1,3 @@ +/** @jsxRuntime classic */ + +
 
; diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-not-strip-tags-with-a-single-child-of-nbsp/output.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-not-strip-tags-with-a-single-child-of-nbsp/output.js new file mode 100644 index 000000000000..0be067277050 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-not-strip-tags-with-a-single-child-of-nbsp/output.js @@ -0,0 +1,4 @@ +/** @jsxRuntime classic */ + +/*#__PURE__*/ +React.createElement("div", null, "\xA0"); diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-properly-handle-comments-between-props/input.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-properly-handle-comments-between-props/input.js new file mode 100644 index 000000000000..2e3a655a52d3 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-properly-handle-comments-between-props/input.js @@ -0,0 +1,12 @@ +/** @jsxRuntime classic */ + +var x = ( +
+ +
+); diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-properly-handle-comments-between-props/output.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-properly-handle-comments-between-props/output.js new file mode 100644 index 000000000000..82d04a2f1f07 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-properly-handle-comments-between-props/output.js @@ -0,0 +1,9 @@ +/** @jsxRuntime classic */ +var x = /*#__PURE__*/React.createElement("div", { + /* a multi-line + comment */ + attr1: "foo" +}, /*#__PURE__*/React.createElement("span", { + // a double-slash comment + attr2: "bar" +})); diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-quote-jsx-attributes/input.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-quote-jsx-attributes/input.js new file mode 100644 index 000000000000..399eddb8b475 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-quote-jsx-attributes/input.js @@ -0,0 +1,3 @@ +/** @jsxRuntime classic */ + +; diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-quote-jsx-attributes/output.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-quote-jsx-attributes/output.js new file mode 100644 index 000000000000..f7cbf047eb31 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-quote-jsx-attributes/output.js @@ -0,0 +1,6 @@ +/** @jsxRuntime classic */ + +/*#__PURE__*/ +React.createElement("button", { + "data-value": "a value" +}, "Button"); diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-support-xml-namespaces-if-flag/input.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-support-xml-namespaces-if-flag/input.js new file mode 100644 index 000000000000..c5de49d37618 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-support-xml-namespaces-if-flag/input.js @@ -0,0 +1,3 @@ +/** @jsxRuntime classic */ + +; diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-support-xml-namespaces-if-flag/options.json b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-support-xml-namespaces-if-flag/options.json new file mode 100644 index 000000000000..c5af191ffe67 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-support-xml-namespaces-if-flag/options.json @@ -0,0 +1,12 @@ +{ + "plugins": [ + [ + "transform-react-jsx", + { + "pragma": "h", + "throwIfNamespace": false, + "runtime": "automatic" + } + ] + ] +} diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-support-xml-namespaces-if-flag/output.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-support-xml-namespaces-if-flag/output.js new file mode 100644 index 000000000000..4ffc02d7cded --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-support-xml-namespaces-if-flag/output.js @@ -0,0 +1,4 @@ +/** @jsxRuntime classic */ +h("f:image", { + "n:attr": true +}); diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-throw-error-namespaces-if-not-flag/input.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-throw-error-namespaces-if-not-flag/input.js new file mode 100644 index 000000000000..2734035ec061 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-throw-error-namespaces-if-not-flag/input.js @@ -0,0 +1,3 @@ +/** @jsxRuntime classic */ + +; diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-throw-error-namespaces-if-not-flag/options.json b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-throw-error-namespaces-if-not-flag/options.json new file mode 100644 index 000000000000..426249807eb6 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-throw-error-namespaces-if-not-flag/options.json @@ -0,0 +1,12 @@ +{ + "plugins": [ + [ + "transform-react-jsx", + { + "pragma": "h", + "throwIfNamespace": true + } + ] + ], + "throws": "Namespace tags are not supported by default. React's JSX doesn't support namespace tags. You can set `throwIfNamespace: false` to bypass this warning." +} diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-transform-known-hyphenated-tags/input.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-transform-known-hyphenated-tags/input.js new file mode 100644 index 000000000000..65294a1b6c43 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-transform-known-hyphenated-tags/input.js @@ -0,0 +1,3 @@ +/** @jsxRuntime classic */ + +; diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-transform-known-hyphenated-tags/output.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-transform-known-hyphenated-tags/output.js new file mode 100644 index 000000000000..f225452a4dcd --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-transform-known-hyphenated-tags/output.js @@ -0,0 +1,4 @@ +/** @jsxRuntime classic */ + +/*#__PURE__*/ +React.createElement("font-face", null); diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-warn-when-importSource-is-set/input.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-warn-when-importSource-is-set/input.js new file mode 100644 index 000000000000..7925155a5faf --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-warn-when-importSource-is-set/input.js @@ -0,0 +1,3 @@ +/** @jsxRuntime classic */ + +var div =
test
; diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-warn-when-importSource-is-set/options.json b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-warn-when-importSource-is-set/options.json new file mode 100644 index 000000000000..2c19d76eee3e --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-warn-when-importSource-is-set/options.json @@ -0,0 +1,13 @@ +{ + "plugins": [ + [ + "transform-react-jsx", + { + "runtime": "automatic", + "importSource": "foo" + } + ] + ], + "sourceType": "module", + "throws": "importSource cannot be set when runtime is classic." +} diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-warn-when-importSource-pragma-is-set/input.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-warn-when-importSource-pragma-is-set/input.js new file mode 100644 index 000000000000..8d4d4fb30175 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-warn-when-importSource-pragma-is-set/input.js @@ -0,0 +1,4 @@ +/** @jsxRuntime classic */ +/** @jsxImportSource foo */ + +var div =
test
; diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-warn-when-importSource-pragma-is-set/options.json b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-warn-when-importSource-pragma-is-set/options.json new file mode 100644 index 000000000000..a25dd07e9124 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/should-warn-when-importSource-pragma-is-set/options.json @@ -0,0 +1,3 @@ +{ + "throws": "importSource cannot be set when runtime is classic." +} diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/this-tag-name/input.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/this-tag-name/input.js new file mode 100644 index 000000000000..dff2c5b0e863 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/this-tag-name/input.js @@ -0,0 +1,3 @@ +/** @jsxRuntime classic */ + +var div = test; diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/this-tag-name/output.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/this-tag-name/output.js new file mode 100644 index 000000000000..19d03fb7828e --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/this-tag-name/output.js @@ -0,0 +1,2 @@ +/** @jsxRuntime classic */ +var div = /*#__PURE__*/React.createElement(this.foo, null, "test"); diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/throw-if-pragma-set-but-not-pragmafrag-and-frag-used/input.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/throw-if-pragma-set-but-not-pragmafrag-and-frag-used/input.js new file mode 100644 index 000000000000..c361fa6b7ab3 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/throw-if-pragma-set-but-not-pragmafrag-and-frag-used/input.js @@ -0,0 +1,5 @@ +/** @jsx dom */ +/** @jsxRuntime classic */ + + +<> diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/throw-if-pragma-set-but-not-pragmafrag-and-frag-used/options.json b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/throw-if-pragma-set-but-not-pragmafrag-and-frag-used/options.json new file mode 100644 index 000000000000..1bfb659b3c98 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/throw-if-pragma-set-but-not-pragmafrag-and-frag-used/options.json @@ -0,0 +1,3 @@ +{ + "throws": "transform-react-jsx: pragma has been set but pragmaFrag has not been set" +} diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/weird-symbols/input.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/weird-symbols/input.js new file mode 100644 index 000000000000..c0245177d289 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/weird-symbols/input.js @@ -0,0 +1,7 @@ +/** @jsxRuntime classic */ + +class MobileHomeActivityTaskPriorityIcon extends React.PureComponent { + render() { + return  {this.props.value} ; + } +} diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/weird-symbols/output.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/weird-symbols/output.js new file mode 100644 index 000000000000..3f5b87cb2239 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/weird-symbols/output.js @@ -0,0 +1,7 @@ +/** @jsxRuntime classic */ +class MobileHomeActivityTaskPriorityIcon extends React.PureComponent { + render() { + return /*#__PURE__*/React.createElement(Text, null, "\xA0", this.props.value, "\xA0"); + } + +} diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/wraps-props-in-react-spread-for-first-spread-attributes/input.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/wraps-props-in-react-spread-for-first-spread-attributes/input.js new file mode 100644 index 000000000000..e9ada7436fca --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/wraps-props-in-react-spread-for-first-spread-attributes/input.js @@ -0,0 +1,4 @@ +/** @jsxRuntime classic */ + + diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/wraps-props-in-react-spread-for-first-spread-attributes/output.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/wraps-props-in-react-spread-for-first-spread-attributes/output.js new file mode 100644 index 000000000000..27875bec6775 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/wraps-props-in-react-spread-for-first-spread-attributes/output.js @@ -0,0 +1,7 @@ +/** @jsxRuntime classic */ + +/*#__PURE__*/ +React.createElement(Component, { ...x, + y: 2, + z: true +}); diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/wraps-props-in-react-spread-for-last-spread-attributes/input.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/wraps-props-in-react-spread-for-last-spread-attributes/input.js new file mode 100644 index 000000000000..547ac8c77303 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/wraps-props-in-react-spread-for-last-spread-attributes/input.js @@ -0,0 +1,3 @@ +/** @jsxRuntime classic */ + + diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/wraps-props-in-react-spread-for-last-spread-attributes/output.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/wraps-props-in-react-spread-for-last-spread-attributes/output.js new file mode 100644 index 000000000000..3ce8e7d09f1d --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/wraps-props-in-react-spread-for-last-spread-attributes/output.js @@ -0,0 +1,8 @@ +/** @jsxRuntime classic */ + +/*#__PURE__*/ +React.createElement(Component, { + y: 2, + z: true, + ...x +}); diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/wraps-props-in-react-spread-for-middle-spread-attributes/input.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/wraps-props-in-react-spread-for-middle-spread-attributes/input.js new file mode 100644 index 000000000000..592896ed5627 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/wraps-props-in-react-spread-for-middle-spread-attributes/input.js @@ -0,0 +1,3 @@ +/** @jsxRuntime classic */ + + diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/wraps-props-in-react-spread-for-middle-spread-attributes/output.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/wraps-props-in-react-spread-for-middle-spread-attributes/output.js new file mode 100644 index 000000000000..8555a70b3131 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/nextReactClassic/wraps-props-in-react-spread-for-middle-spread-attributes/output.js @@ -0,0 +1,8 @@ +/** @jsxRuntime classic */ + +/*#__PURE__*/ +React.createElement(Component, { + y: 2, + ...x, + z: true +}); diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/false-default-pragma/input.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/false-default-pragma/input.js new file mode 100644 index 000000000000..cbe1d12c589b --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/false-default-pragma/input.js @@ -0,0 +1 @@ +
; diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/false-default-pragma/options.json b/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/false-default-pragma/options.json new file mode 100644 index 000000000000..8608ef373955 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/false-default-pragma/options.json @@ -0,0 +1,5 @@ +{ + "plugins": [ + ["transform-react-jsx", { "pure": false }] + ] +} diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/false-default-pragma/output.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/false-default-pragma/output.js new file mode 100644 index 000000000000..3cd05d5f9f2f --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/false-default-pragma/output.js @@ -0,0 +1 @@ +React.createElement("div", null); diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/false-pragma-comment/input.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/false-pragma-comment/input.js new file mode 100644 index 000000000000..6b8761b4a90a --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/false-pragma-comment/input.js @@ -0,0 +1,3 @@ +/* @jsx h */ + +
; diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/false-pragma-comment/options.json b/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/false-pragma-comment/options.json new file mode 100644 index 000000000000..8608ef373955 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/false-pragma-comment/options.json @@ -0,0 +1,5 @@ +{ + "plugins": [ + ["transform-react-jsx", { "pure": false }] + ] +} diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/false-pragma-comment/output.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/false-pragma-comment/output.js new file mode 100644 index 000000000000..6dc3b55a8a61 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/false-pragma-comment/output.js @@ -0,0 +1,2 @@ +/* @jsx h */ +h("div", null); diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/false-pragma-option/input.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/false-pragma-option/input.js new file mode 100644 index 000000000000..cbe1d12c589b --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/false-pragma-option/input.js @@ -0,0 +1 @@ +
; diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/false-pragma-option/options.json b/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/false-pragma-option/options.json new file mode 100644 index 000000000000..65d9e8ae0d93 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/false-pragma-option/options.json @@ -0,0 +1,5 @@ +{ + "plugins": [ + ["transform-react-jsx", { "pragma": "h", "pure": false }] + ] +} diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/false-pragma-option/output.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/false-pragma-option/output.js new file mode 100644 index 000000000000..5b745cd1b863 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/false-pragma-option/output.js @@ -0,0 +1 @@ +h("div", null); diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/true-default-pragma/input.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/true-default-pragma/input.js new file mode 100644 index 000000000000..cbe1d12c589b --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/true-default-pragma/input.js @@ -0,0 +1 @@ +
; diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/true-default-pragma/options.json b/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/true-default-pragma/options.json new file mode 100644 index 000000000000..c9f1fc61d318 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/true-default-pragma/options.json @@ -0,0 +1,5 @@ +{ + "plugins": [ + ["transform-react-jsx", { "pure": true }] + ] +} diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/true-default-pragma/output.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/true-default-pragma/output.js new file mode 100644 index 000000000000..6ad0513bb203 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/true-default-pragma/output.js @@ -0,0 +1,2 @@ +/*#__PURE__*/ +React.createElement("div", null); diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/true-pragma-comment/input.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/true-pragma-comment/input.js new file mode 100644 index 000000000000..6b8761b4a90a --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/true-pragma-comment/input.js @@ -0,0 +1,3 @@ +/* @jsx h */ + +
; diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/true-pragma-comment/options.json b/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/true-pragma-comment/options.json new file mode 100644 index 000000000000..c9f1fc61d318 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/true-pragma-comment/options.json @@ -0,0 +1,5 @@ +{ + "plugins": [ + ["transform-react-jsx", { "pure": true }] + ] +} diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/true-pragma-comment/output.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/true-pragma-comment/output.js new file mode 100644 index 000000000000..f9bf7e4e5fbc --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/true-pragma-comment/output.js @@ -0,0 +1,4 @@ +/* @jsx h */ + +/*#__PURE__*/ +h("div", null); diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/true-pragma-option/input.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/true-pragma-option/input.js new file mode 100644 index 000000000000..cbe1d12c589b --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/true-pragma-option/input.js @@ -0,0 +1 @@ +
; diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/true-pragma-option/options.json b/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/true-pragma-option/options.json new file mode 100644 index 000000000000..8d4223a48bf5 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/true-pragma-option/options.json @@ -0,0 +1,5 @@ +{ + "plugins": [ + ["transform-react-jsx", { "pragma": "h", "pure": true }] + ] +} diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/true-pragma-option/output.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/true-pragma-option/output.js new file mode 100644 index 000000000000..64cd477b1617 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/true-pragma-option/output.js @@ -0,0 +1,2 @@ +/*#__PURE__*/ +h("div", null); diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/unset-default-pragma/input.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/unset-default-pragma/input.js new file mode 100644 index 000000000000..cbe1d12c589b --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/unset-default-pragma/input.js @@ -0,0 +1 @@ +
; diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/unset-default-pragma/options.json b/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/unset-default-pragma/options.json new file mode 100644 index 000000000000..c6c850168596 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/unset-default-pragma/options.json @@ -0,0 +1,5 @@ +{ + "plugins": [ + ["transform-react-jsx", {}] + ] +} diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/unset-default-pragma/output.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/unset-default-pragma/output.js new file mode 100644 index 000000000000..6ad0513bb203 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/unset-default-pragma/output.js @@ -0,0 +1,2 @@ +/*#__PURE__*/ +React.createElement("div", null); diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/unset-pragma-comment/input.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/unset-pragma-comment/input.js new file mode 100644 index 000000000000..6b8761b4a90a --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/unset-pragma-comment/input.js @@ -0,0 +1,3 @@ +/* @jsx h */ + +
; diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/unset-pragma-comment/options.json b/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/unset-pragma-comment/options.json new file mode 100644 index 000000000000..c6c850168596 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/unset-pragma-comment/options.json @@ -0,0 +1,5 @@ +{ + "plugins": [ + ["transform-react-jsx", {}] + ] +} diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/unset-pragma-comment/output.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/unset-pragma-comment/output.js new file mode 100644 index 000000000000..6dc3b55a8a61 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/unset-pragma-comment/output.js @@ -0,0 +1,2 @@ +/* @jsx h */ +h("div", null); diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/unset-pragma-option/input.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/unset-pragma-option/input.js new file mode 100644 index 000000000000..cbe1d12c589b --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/unset-pragma-option/input.js @@ -0,0 +1 @@ +
; diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/unset-pragma-option/options.json b/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/unset-pragma-option/options.json new file mode 100644 index 000000000000..46f657580a52 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/unset-pragma-option/options.json @@ -0,0 +1,5 @@ +{ + "plugins": [ + ["transform-react-jsx", { "pragma": "h" }] + ] +} diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/unset-pragma-option/output.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/unset-pragma-option/output.js new file mode 100644 index 000000000000..5b745cd1b863 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/unset-pragma-option/output.js @@ -0,0 +1 @@ +h("div", null); diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/react/adds-appropriate-newlines-when-using-spread-attribute/output.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/react/adds-appropriate-newlines-when-using-spread-attribute/output.js index de69246a1417..bfd6ae7c13f9 100644 --- a/packages/babel-plugin-transform-react-jsx/test/fixtures/react/adds-appropriate-newlines-when-using-spread-attribute/output.js +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/react/adds-appropriate-newlines-when-using-spread-attribute/output.js @@ -1,3 +1,4 @@ +/*#__PURE__*/ React.createElement(Component, babelHelpers.extends({}, props, { sound: "moo" })); diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/react/arrow-functions/output.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/react/arrow-functions/output.js index dc9fe7116119..6ee7dcc94f2e 100644 --- a/packages/babel-plugin-transform-react-jsx/test/fixtures/react/arrow-functions/output.js +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/react/arrow-functions/output.js @@ -2,7 +2,7 @@ var foo = function () { var _this = this; return function () { - return React.createElement(_this, null); + return /*#__PURE__*/React.createElement(_this, null); }; }; @@ -10,6 +10,6 @@ var bar = function () { var _this2 = this; return function () { - return React.createElement(_this2.foo, null); + return /*#__PURE__*/React.createElement(_this2.foo, null); }; }; diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/react/concatenates-adjacent-string-literals/output.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/react/concatenates-adjacent-string-literals/output.js index bbce53edfaaf..d3772171e065 100644 --- a/packages/babel-plugin-transform-react-jsx/test/fixtures/react/concatenates-adjacent-string-literals/output.js +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/react/concatenates-adjacent-string-literals/output.js @@ -1 +1 @@ -var x = React.createElement("div", null, "foo", "bar", "baz", React.createElement("div", null, "buz bang"), "qux", null, "quack"); +var x = /*#__PURE__*/React.createElement("div", null, "foo", "bar", "baz", /*#__PURE__*/React.createElement("div", null, "buz bang"), "qux", null, "quack"); diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/react/dont-coerce-expression-containers/output.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/react/dont-coerce-expression-containers/output.js index a73dcc46c620..30d36264bde9 100644 --- a/packages/babel-plugin-transform-react-jsx/test/fixtures/react/dont-coerce-expression-containers/output.js +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/react/dont-coerce-expression-containers/output.js @@ -1 +1,2 @@ +/*#__PURE__*/ React.createElement(Text, null, "To get started, edit index.ios.js!!!", "\n", "Press Cmd+R to reload"); diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/react/jsx-with-retainlines-option/output.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/react/jsx-with-retainlines-option/output.js index f3210cb915aa..7a1aee57ef3e 100644 --- a/packages/babel-plugin-transform-react-jsx/test/fixtures/react/jsx-with-retainlines-option/output.js +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/react/jsx-with-retainlines-option/output.js @@ -1 +1 @@ -var div = React.createElement("div", null, "test"); +var div = /*#__PURE__*/React.createElement("div", null, "test"); diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/react/jsx-without-retainlines-option/output.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/react/jsx-without-retainlines-option/output.js index f3210cb915aa..7a1aee57ef3e 100644 --- a/packages/babel-plugin-transform-react-jsx/test/fixtures/react/jsx-without-retainlines-option/output.js +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/react/jsx-without-retainlines-option/output.js @@ -1 +1 @@ -var div = React.createElement("div", null, "test"); +var div = /*#__PURE__*/React.createElement("div", null, "test"); diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/react/optimisation.react.constant-elements/output.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/react/optimisation.react.constant-elements/output.js index 1af954e46867..fa49731c7fc2 100644 --- a/packages/babel-plugin-transform-react-jsx/test/fixtures/react/optimisation.react.constant-elements/output.js +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/react/optimisation.react.constant-elements/output.js @@ -1,21 +1,23 @@ -var _ref = -/*#__PURE__*/ -
+function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function () { var Super = babelHelpers.getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = babelHelpers.getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return babelHelpers.possibleConstructorReturn(this, result); }; } + +function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } + +var _ref = ; -let App = -/*#__PURE__*/ -function (_React$Component) { +let App = /*#__PURE__*/function (_React$Component) { "use strict"; babelHelpers.inherits(App, _React$Component); + var _super = _createSuper(App); + function App() { babelHelpers.classCallCheck(this, App); - return babelHelpers.possibleConstructorReturn(this, babelHelpers.getPrototypeOf(App).apply(this, arguments)); + return _super.apply(this, arguments); } babelHelpers.createClass(App, [{ diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/react/pragma-works-with-no-space-at-the-end/input.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/react/pragma-works-with-no-space-at-the-end/input.js new file mode 100644 index 000000000000..1a449a84872c --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/react/pragma-works-with-no-space-at-the-end/input.js @@ -0,0 +1,2 @@ +/* @jsx foo*/ +
Hi
; \ No newline at end of file diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/react/pragma-works-with-no-space-at-the-end/output.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/react/pragma-works-with-no-space-at-the-end/output.js new file mode 100644 index 000000000000..31b6fe25a483 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/react/pragma-works-with-no-space-at-the-end/output.js @@ -0,0 +1,2 @@ +/* @jsx foo*/ +foo("div", null, "Hi"); diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/react/should-add-quotes-es3/output.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/react/should-add-quotes-es3/output.js index 2306516ef51f..e67cc4ba42d5 100644 --- a/packages/babel-plugin-transform-react-jsx/test/fixtures/react/should-add-quotes-es3/output.js +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/react/should-add-quotes-es3/output.js @@ -1,4 +1,4 @@ -var es3 = React.createElement(F, { +var es3 = /*#__PURE__*/React.createElement(F, { aaa: true, "new": true, "const": true, diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/react/should-allow-constructor-as-prop/output.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/react/should-allow-constructor-as-prop/output.js index 5bda6d624fe2..68157cf0a134 100644 --- a/packages/babel-plugin-transform-react-jsx/test/fixtures/react/should-allow-constructor-as-prop/output.js +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/react/should-allow-constructor-as-prop/output.js @@ -1,3 +1,4 @@ +/*#__PURE__*/ React.createElement(Component, { constructor: "foo" }); diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/react/should-allow-deeper-js-namespacing/output.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/react/should-allow-deeper-js-namespacing/output.js index 8dc54f904a4d..51e8fd555561 100644 --- a/packages/babel-plugin-transform-react-jsx/test/fixtures/react/should-allow-deeper-js-namespacing/output.js +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/react/should-allow-deeper-js-namespacing/output.js @@ -1 +1,2 @@ +/*#__PURE__*/ React.createElement(Namespace.DeepNamespace.Component, null); diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/react/should-allow-elements-as-attributes/output.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/react/should-allow-elements-as-attributes/output.js index 27ead2eb0555..06428ad3807d 100644 --- a/packages/babel-plugin-transform-react-jsx/test/fixtures/react/should-allow-elements-as-attributes/output.js +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/react/should-allow-elements-as-attributes/output.js @@ -1,3 +1,4 @@ +/*#__PURE__*/ React.createElement("div", { - attr: React.createElement("div", null) + attr: /*#__PURE__*/React.createElement("div", null) }); diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/react/should-allow-js-namespacing/output.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/react/should-allow-js-namespacing/output.js index 980df4572437..870cb0a6db33 100644 --- a/packages/babel-plugin-transform-react-jsx/test/fixtures/react/should-allow-js-namespacing/output.js +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/react/should-allow-js-namespacing/output.js @@ -1 +1,2 @@ +/*#__PURE__*/ React.createElement(Namespace.Component, null); diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/react/should-allow-nested-fragments/output.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/react/should-allow-nested-fragments/output.js index e4f93efcc1d9..2ac191c03c5a 100644 --- a/packages/babel-plugin-transform-react-jsx/test/fixtures/react/should-allow-nested-fragments/output.js +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/react/should-allow-nested-fragments/output.js @@ -1 +1,2 @@ -React.createElement("div", null, React.createElement(React.Fragment, null, React.createElement(React.Fragment, null, React.createElement("span", null, "Hello"), React.createElement("span", null, "world")), React.createElement(React.Fragment, null, React.createElement("span", null, "Goodbye"), React.createElement("span", null, "world")))); +/*#__PURE__*/ +React.createElement("div", null, /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("span", null, "Hello"), /*#__PURE__*/React.createElement("span", null, "world")), /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("span", null, "Goodbye"), /*#__PURE__*/React.createElement("span", null, "world")))); diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/react/should-avoid-wrapping-in-extra-parens-if-not-needed/output.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/react/should-avoid-wrapping-in-extra-parens-if-not-needed/output.js index 539bd017a676..98d7262c3a78 100644 --- a/packages/babel-plugin-transform-react-jsx/test/fixtures/react/should-avoid-wrapping-in-extra-parens-if-not-needed/output.js +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/react/should-avoid-wrapping-in-extra-parens-if-not-needed/output.js @@ -1,4 +1,4 @@ -var x = React.createElement("div", null, React.createElement(Component, null)); -var x = React.createElement("div", null, props.children); -var x = React.createElement(Composite, null, props.children); -var x = React.createElement(Composite, null, React.createElement(Composite2, null)); +var x = /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Component, null)); +var x = /*#__PURE__*/React.createElement("div", null, props.children); +var x = /*#__PURE__*/React.createElement(Composite, null, props.children); +var x = /*#__PURE__*/React.createElement(Composite, null, /*#__PURE__*/React.createElement(Composite2, null)); diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/react/should-convert-simple-tags/output.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/react/should-convert-simple-tags/output.js index 73d0a3e9d56f..2973c9e9fd14 100644 --- a/packages/babel-plugin-transform-react-jsx/test/fixtures/react/should-convert-simple-tags/output.js +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/react/should-convert-simple-tags/output.js @@ -1 +1 @@ -var x = React.createElement("div", null); +var x = /*#__PURE__*/React.createElement("div", null); diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/react/should-convert-simple-text/output.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/react/should-convert-simple-text/output.js index 4a89144887a0..afcefb65f15d 100644 --- a/packages/babel-plugin-transform-react-jsx/test/fixtures/react/should-convert-simple-text/output.js +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/react/should-convert-simple-text/output.js @@ -1 +1 @@ -var x = React.createElement("div", null, "text"); +var x = /*#__PURE__*/React.createElement("div", null, "text"); diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/react/should-disallow-xml-namespacing/options.json b/packages/babel-plugin-transform-react-jsx/test/fixtures/react/should-disallow-xml-namespacing/options.json index 8285c733a003..746037e9f505 100644 --- a/packages/babel-plugin-transform-react-jsx/test/fixtures/react/should-disallow-xml-namespacing/options.json +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/react/should-disallow-xml-namespacing/options.json @@ -1,3 +1,3 @@ { - "throws": "Namespace tags are not supported by default. React's JSX doesn't support namespace tags. You can turn on the 'throwIfNamespace' flag to bypass this warning." + "throws": "Namespace tags are not supported by default. React's JSX doesn't support namespace tags. You can set `throwIfNamespace: false` to bypass this warning." } diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/react/should-escape-xhtml-jsxattribute/output.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/react/should-escape-xhtml-jsxattribute/output.js index 48730b4133d0..60f6fd9294d9 100644 --- a/packages/babel-plugin-transform-react-jsx/test/fixtures/react/should-escape-xhtml-jsxattribute/output.js +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/react/should-escape-xhtml-jsxattribute/output.js @@ -1,9 +1,14 @@ +/*#__PURE__*/ React.createElement("div", { id: "w\xF4w" }); + +/*#__PURE__*/ React.createElement("div", { id: "\\w" }); + +/*#__PURE__*/ React.createElement("div", { id: "w < w" }); diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/react/should-escape-xhtml-jsxtext/output.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/react/should-escape-xhtml-jsxtext/output.js index 42ecff839522..64f33c72531a 100644 --- a/packages/babel-plugin-transform-react-jsx/test/fixtures/react/should-escape-xhtml-jsxtext/output.js +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/react/should-escape-xhtml-jsxtext/output.js @@ -1,9 +1,26 @@ +/*#__PURE__*/ React.createElement("div", null, "wow"); + +/*#__PURE__*/ React.createElement("div", null, "w\xF4w"); + +/*#__PURE__*/ React.createElement("div", null, "w & w"); + +/*#__PURE__*/ React.createElement("div", null, "w & w"); + +/*#__PURE__*/ React.createElement("div", null, "w \xA0 w"); + +/*#__PURE__*/ React.createElement("div", null, "this should not parse as unicode: \\u00a0"); + +/*#__PURE__*/ React.createElement("div", null, "this should parse as nbsp: \xA0 "); + +/*#__PURE__*/ React.createElement("div", null, "this should parse as unicode: ", '\u00a0 '); + +/*#__PURE__*/ React.createElement("div", null, "w < w"); diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/react/should-handle-attributed-elements/output.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/react/should-handle-attributed-elements/output.js index 7feb71c28005..04876829e9cc 100644 --- a/packages/babel-plugin-transform-react-jsx/test/fixtures/react/should-handle-attributed-elements/output.js +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/react/should-handle-attributed-elements/output.js @@ -1,9 +1,9 @@ var HelloMessage = React.createClass({ displayName: "HelloMessage", render: function () { - return React.createElement("div", null, "Hello ", this.props.name); + return /*#__PURE__*/React.createElement("div", null, "Hello ", this.props.name); } }); -React.render(React.createElement(HelloMessage, { - name: React.createElement("span", null, "Sebastian") +React.render( /*#__PURE__*/React.createElement(HelloMessage, { + name: /*#__PURE__*/React.createElement("span", null, "Sebastian") }), mountNode); diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/react/should-handle-has-own-property-correctly/output.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/react/should-handle-has-own-property-correctly/output.js index 55c8cea17044..5a06e153c496 100644 --- a/packages/babel-plugin-transform-react-jsx/test/fixtures/react/should-handle-has-own-property-correctly/output.js +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/react/should-handle-has-own-property-correctly/output.js @@ -1 +1,2 @@ +/*#__PURE__*/ React.createElement("hasOwnProperty", null, "testing"); diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/react/should-have-correct-comma-in-nested-children/output.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/react/should-have-correct-comma-in-nested-children/output.js index f8a085117349..d8667f762c7d 100644 --- a/packages/babel-plugin-transform-react-jsx/test/fixtures/react/should-have-correct-comma-in-nested-children/output.js +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/react/should-have-correct-comma-in-nested-children/output.js @@ -1 +1 @@ -var x = React.createElement("div", null, React.createElement("div", null, React.createElement("br", null)), React.createElement(Component, null, foo, React.createElement("br", null), bar), React.createElement("br", null)); +var x = /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("br", null)), /*#__PURE__*/React.createElement(Component, null, foo, /*#__PURE__*/React.createElement("br", null), bar), /*#__PURE__*/React.createElement("br", null)); diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/react/should-insert-commas-after-expressions-before-whitespace/output.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/react/should-insert-commas-after-expressions-before-whitespace/output.js index f7a07f8b6c30..9ae706684fd7 100644 --- a/packages/babel-plugin-transform-react-jsx/test/fixtures/react/should-insert-commas-after-expressions-before-whitespace/output.js +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/react/should-insert-commas-after-expressions-before-whitespace/output.js @@ -1,4 +1,4 @@ -var x = React.createElement("div", { +var x = /*#__PURE__*/React.createElement("div", { attr1: "foo" + "bar", attr2: "foo" + "bar" + "baz" + "bug", attr3: "foo" + "bar" + "baz" + "bug", diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/react/should-not-add-quotes-to-identifier-names/output.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/react/should-not-add-quotes-to-identifier-names/output.js index b60eb0ba8ea9..1be1c61decda 100644 --- a/packages/babel-plugin-transform-react-jsx/test/fixtures/react/should-not-add-quotes-to-identifier-names/output.js +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/react/should-not-add-quotes-to-identifier-names/output.js @@ -1,4 +1,4 @@ -var e = React.createElement(F, { +var e = /*#__PURE__*/React.createElement(F, { aaa: true, new: true, const: true, diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/react/should-not-mangle-expressioncontainer-attribute-values/output.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/react/should-not-mangle-expressioncontainer-attribute-values/output.js index e7dc9637a1b4..2e104ae0ae17 100644 --- a/packages/babel-plugin-transform-react-jsx/test/fixtures/react/should-not-mangle-expressioncontainer-attribute-values/output.js +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/react/should-not-mangle-expressioncontainer-attribute-values/output.js @@ -1,3 +1,4 @@ +/*#__PURE__*/ React.createElement("button", { "data-value": "a value\n with\nnewlines\n and spaces" }, "Button"); diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/react/should-not-strip-nbsp-even-coupled-with-other-whitespace/output.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/react/should-not-strip-nbsp-even-coupled-with-other-whitespace/output.js index 5f5e3192706e..a8114f7ca5d4 100644 --- a/packages/babel-plugin-transform-react-jsx/test/fixtures/react/should-not-strip-nbsp-even-coupled-with-other-whitespace/output.js +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/react/should-not-strip-nbsp-even-coupled-with-other-whitespace/output.js @@ -1 +1,2 @@ +/*#__PURE__*/ React.createElement("div", null, "\xA0 "); diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/react/should-not-strip-tags-with-a-single-child-of-nbsp/output.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/react/should-not-strip-tags-with-a-single-child-of-nbsp/output.js index d9d43fd992a8..b01dbe6b0816 100644 --- a/packages/babel-plugin-transform-react-jsx/test/fixtures/react/should-not-strip-tags-with-a-single-child-of-nbsp/output.js +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/react/should-not-strip-tags-with-a-single-child-of-nbsp/output.js @@ -1 +1,2 @@ +/*#__PURE__*/ React.createElement("div", null, "\xA0"); diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/react/should-properly-handle-comments-between-props/output.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/react/should-properly-handle-comments-between-props/output.js index 52a8177e5f1f..fbe9b6dd6844 100644 --- a/packages/babel-plugin-transform-react-jsx/test/fixtures/react/should-properly-handle-comments-between-props/output.js +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/react/should-properly-handle-comments-between-props/output.js @@ -1,8 +1,8 @@ -var x = React.createElement("div", { +var x = /*#__PURE__*/React.createElement("div", { /* a multi-line comment */ attr1: "foo" -}, React.createElement("span", { +}, /*#__PURE__*/React.createElement("span", { // a double-slash comment attr2: "bar" })); diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/react/should-quote-jsx-attributes/output.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/react/should-quote-jsx-attributes/output.js index 0eb02e4d39be..c8ab96101ebc 100644 --- a/packages/babel-plugin-transform-react-jsx/test/fixtures/react/should-quote-jsx-attributes/output.js +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/react/should-quote-jsx-attributes/output.js @@ -1,3 +1,4 @@ +/*#__PURE__*/ React.createElement("button", { "data-value": "a value" }, "Button"); diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/react/should-throw-error-namespaces-if-not-flag/options.json b/packages/babel-plugin-transform-react-jsx/test/fixtures/react/should-throw-error-namespaces-if-not-flag/options.json index 261ae7727779..426249807eb6 100644 --- a/packages/babel-plugin-transform-react-jsx/test/fixtures/react/should-throw-error-namespaces-if-not-flag/options.json +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/react/should-throw-error-namespaces-if-not-flag/options.json @@ -8,5 +8,5 @@ } ] ], - "throws": "Namespace tags are not supported by default. React's JSX doesn't support namespace tags. You can turn on the 'throwIfNamespace' flag to bypass this warning." + "throws": "Namespace tags are not supported by default. React's JSX doesn't support namespace tags. You can set `throwIfNamespace: false` to bypass this warning." } diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/react/should-transform-known-hyphenated-tags/output.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/react/should-transform-known-hyphenated-tags/output.js index 140f5b1b8c41..24118629b8eb 100644 --- a/packages/babel-plugin-transform-react-jsx/test/fixtures/react/should-transform-known-hyphenated-tags/output.js +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/react/should-transform-known-hyphenated-tags/output.js @@ -1 +1,2 @@ +/*#__PURE__*/ React.createElement("font-face", null); diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/react/throw-if-pragma-set-but-not-pragmafrag-and-frag-used/options.json b/packages/babel-plugin-transform-react-jsx/test/fixtures/react/throw-if-pragma-set-but-not-pragmafrag-and-frag-used/options.json index b89035fd105e..1bfb659b3c98 100644 --- a/packages/babel-plugin-transform-react-jsx/test/fixtures/react/throw-if-pragma-set-but-not-pragmafrag-and-frag-used/options.json +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/react/throw-if-pragma-set-but-not-pragmafrag-and-frag-used/options.json @@ -1,3 +1,3 @@ { - "throws": "transform-react-jsx: pragma has been set but pragmafrag has not been set" + "throws": "transform-react-jsx: pragma has been set but pragmaFrag has not been set" } diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/react/weird-symbols/input.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/react/weird-symbols/input.js new file mode 100644 index 000000000000..c0245177d289 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/react/weird-symbols/input.js @@ -0,0 +1,7 @@ +/** @jsxRuntime classic */ + +class MobileHomeActivityTaskPriorityIcon extends React.PureComponent { + render() { + return  {this.props.value} ; + } +} diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/react/weird-symbols/output.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/react/weird-symbols/output.js new file mode 100644 index 000000000000..3f5b87cb2239 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/react/weird-symbols/output.js @@ -0,0 +1,7 @@ +/** @jsxRuntime classic */ +class MobileHomeActivityTaskPriorityIcon extends React.PureComponent { + render() { + return /*#__PURE__*/React.createElement(Text, null, "\xA0", this.props.value, "\xA0"); + } + +} diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/react/wraps-props-in-react-spread-for-first-spread-attributes/output.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/react/wraps-props-in-react-spread-for-first-spread-attributes/output.js index 9db2ccf7cc5c..b6fe512bfda8 100644 --- a/packages/babel-plugin-transform-react-jsx/test/fixtures/react/wraps-props-in-react-spread-for-first-spread-attributes/output.js +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/react/wraps-props-in-react-spread-for-first-spread-attributes/output.js @@ -1,3 +1,4 @@ +/*#__PURE__*/ React.createElement(Component, babelHelpers.extends({}, x, { y: 2, z: true diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/react/wraps-props-in-react-spread-for-last-spread-attributes/output.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/react/wraps-props-in-react-spread-for-last-spread-attributes/output.js index 926dceda6c0f..c1c22b02c9da 100644 --- a/packages/babel-plugin-transform-react-jsx/test/fixtures/react/wraps-props-in-react-spread-for-last-spread-attributes/output.js +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/react/wraps-props-in-react-spread-for-last-spread-attributes/output.js @@ -1,3 +1,4 @@ +/*#__PURE__*/ React.createElement(Component, babelHelpers.extends({ y: 2, z: true diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/react/wraps-props-in-react-spread-for-middle-spread-attributes/output.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/react/wraps-props-in-react-spread-for-middle-spread-attributes/output.js index c3e1be2707d3..7d99b1a29c3d 100644 --- a/packages/babel-plugin-transform-react-jsx/test/fixtures/react/wraps-props-in-react-spread-for-middle-spread-attributes/output.js +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/react/wraps-props-in-react-spread-for-middle-spread-attributes/output.js @@ -1,3 +1,4 @@ +/*#__PURE__*/ React.createElement(Component, babelHelpers.extends({ y: 2 }, x, { diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/regression/pragma-frag-set-default/input.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/regression/pragma-frag-set-default/input.js new file mode 100644 index 000000000000..b0dacd1181a3 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/regression/pragma-frag-set-default/input.js @@ -0,0 +1,3 @@ +/* @jsxFrag React.Fragment */ +/* @jsx h */ +<>Test; diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/regression/pragma-frag-set-default/options.json b/packages/babel-plugin-transform-react-jsx/test/fixtures/regression/pragma-frag-set-default/options.json new file mode 100644 index 000000000000..5e1d82404dd3 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/regression/pragma-frag-set-default/options.json @@ -0,0 +1,5 @@ +{ + "plugins": [ + "transform-react-jsx" + ] +} diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/regression/pragma-frag-set-default/output.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/regression/pragma-frag-set-default/output.js new file mode 100644 index 000000000000..8a621e8a4575 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/regression/pragma-frag-set-default/output.js @@ -0,0 +1,4 @@ +/* @jsxFrag React.Fragment */ + +/* @jsx h */ +h(React.Fragment, null, "Test"); diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/runtime/classic/input.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/runtime/classic/input.js new file mode 100644 index 000000000000..6a6f1f219c0d --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/runtime/classic/input.js @@ -0,0 +1 @@ +var x = (
); \ No newline at end of file diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/runtime/classic/options.json b/packages/babel-plugin-transform-react-jsx/test/fixtures/runtime/classic/options.json new file mode 100644 index 000000000000..d160ab6860bc --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/runtime/classic/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["transform-react-jsx", { "runtime": "classic" }]] +} diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/runtime/classic/output.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/runtime/classic/output.js new file mode 100644 index 000000000000..ebd8fce02e70 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/runtime/classic/output.js @@ -0,0 +1 @@ +var x = /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("span", null)); diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/runtime/defaults-to-classic/input.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/runtime/defaults-to-classic/input.js new file mode 100644 index 000000000000..6a6f1f219c0d --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/runtime/defaults-to-classic/input.js @@ -0,0 +1 @@ +var x = (
); \ No newline at end of file diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/runtime/defaults-to-classic/options.json b/packages/babel-plugin-transform-react-jsx/test/fixtures/runtime/defaults-to-classic/options.json new file mode 100644 index 000000000000..4f654b820699 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/runtime/defaults-to-classic/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["transform-react-jsx"] +} diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/runtime/defaults-to-classic/output.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/runtime/defaults-to-classic/output.js new file mode 100644 index 000000000000..ebd8fce02e70 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/runtime/defaults-to-classic/output.js @@ -0,0 +1 @@ +var x = /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("span", null)); diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/runtime/invalid-runtime/input.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/runtime/invalid-runtime/input.js new file mode 100644 index 000000000000..6a6f1f219c0d --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/runtime/invalid-runtime/input.js @@ -0,0 +1 @@ +var x = (
); \ No newline at end of file diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/runtime/invalid-runtime/options.json b/packages/babel-plugin-transform-react-jsx/test/fixtures/runtime/invalid-runtime/options.json new file mode 100644 index 000000000000..2fb8c2b01d57 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/runtime/invalid-runtime/options.json @@ -0,0 +1,4 @@ +{ + "plugins": [["transform-react-jsx", { "runtime": "invalidOption" }]], + "throws": "Runtime must be either \"classic\" or \"automatic\"." +} diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/runtime/pragma-runtime-classsic/input.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/runtime/pragma-runtime-classsic/input.js new file mode 100644 index 000000000000..0b5717e407b4 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/runtime/pragma-runtime-classsic/input.js @@ -0,0 +1,3 @@ +/** @jsxRuntime classic */ + +var x = (
); \ No newline at end of file diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/runtime/pragma-runtime-classsic/options.json b/packages/babel-plugin-transform-react-jsx/test/fixtures/runtime/pragma-runtime-classsic/options.json new file mode 100644 index 000000000000..e963e89a9c2c --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/runtime/pragma-runtime-classsic/options.json @@ -0,0 +1,10 @@ +{ + "plugins": [ + [ + "transform-react-jsx", + { + "runtime": "automatic" + } + ] + ] +} diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/runtime/pragma-runtime-classsic/output.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/runtime/pragma-runtime-classsic/output.js new file mode 100644 index 000000000000..8785f4a11be5 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/runtime/pragma-runtime-classsic/output.js @@ -0,0 +1,2 @@ +/** @jsxRuntime classic */ +var x = /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("span", null)); diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/runtime/runtime-automatic/input.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/runtime/runtime-automatic/input.js new file mode 100644 index 000000000000..6a6f1f219c0d --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/runtime/runtime-automatic/input.js @@ -0,0 +1 @@ +var x = (
); \ No newline at end of file diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/runtime/runtime-automatic/options.json b/packages/babel-plugin-transform-react-jsx/test/fixtures/runtime/runtime-automatic/options.json new file mode 100644 index 000000000000..e963e89a9c2c --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/runtime/runtime-automatic/options.json @@ -0,0 +1,10 @@ +{ + "plugins": [ + [ + "transform-react-jsx", + { + "runtime": "automatic" + } + ] + ] +} diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/runtime/runtime-automatic/output.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/runtime/runtime-automatic/output.js new file mode 100644 index 000000000000..607dafdc732b --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/runtime/runtime-automatic/output.js @@ -0,0 +1,5 @@ +var _reactJsxRuntime = require("react/jsx-runtime"); + +var x = /*#__PURE__*/_reactJsxRuntime.jsx("div", { + children: /*#__PURE__*/_reactJsxRuntime.jsx("span", {}) +}); diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/useBuiltIns/assignment/output.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/useBuiltIns/assignment/output.js index 0641f0b294c1..a4005fba7aeb 100644 --- a/packages/babel-plugin-transform-react-jsx/test/fixtures/useBuiltIns/assignment/output.js +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/useBuiltIns/assignment/output.js @@ -1,3 +1,3 @@ -var div = React.createElement(Component, Object.assign({}, props, { +var div = /*#__PURE__*/React.createElement(Component, Object.assign({}, props, { foo: "bar" })); diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/useSpread/assignment-invalid-option/input.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/useSpread/assignment-invalid-option/input.js new file mode 100644 index 000000000000..4caacb6aa17d --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/useSpread/assignment-invalid-option/input.js @@ -0,0 +1 @@ +var div = diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/useSpread/assignment-invalid-option/options.json b/packages/babel-plugin-transform-react-jsx/test/fixtures/useSpread/assignment-invalid-option/options.json new file mode 100644 index 000000000000..ff6406c9a4e2 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/useSpread/assignment-invalid-option/options.json @@ -0,0 +1,4 @@ +{ + "plugins": [["transform-react-jsx", { "useSpread": 0 }]], + "throws": "transform-react-jsx currently only accepts a boolean option for useSpread (defaults to false)" +} diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/useSpread/assignment-use-builtin/input.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/useSpread/assignment-use-builtin/input.js new file mode 100644 index 000000000000..4caacb6aa17d --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/useSpread/assignment-use-builtin/input.js @@ -0,0 +1 @@ +var div = diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/useSpread/assignment-use-builtin/options.json b/packages/babel-plugin-transform-react-jsx/test/fixtures/useSpread/assignment-use-builtin/options.json new file mode 100644 index 000000000000..eab6051daa03 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/useSpread/assignment-use-builtin/options.json @@ -0,0 +1,6 @@ +{ + "plugins": [ + ["transform-react-jsx", { "useSpread": true, "useBuiltIns": true }] + ], + "throws": "transform-react-jsx currently only accepts useBuiltIns or useSpread but not both" +} diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/useSpread/assignment/input.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/useSpread/assignment/input.js new file mode 100644 index 000000000000..4caacb6aa17d --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/useSpread/assignment/input.js @@ -0,0 +1 @@ +var div = diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/useSpread/assignment/output.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/useSpread/assignment/output.js new file mode 100644 index 000000000000..0c5b1f75b073 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/useSpread/assignment/output.js @@ -0,0 +1,3 @@ +var div = /*#__PURE__*/React.createElement(Component, { ...props, + foo: "bar" +}); diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/useSpread/options.json b/packages/babel-plugin-transform-react-jsx/test/fixtures/useSpread/options.json new file mode 100644 index 000000000000..7e0d5fcba0f3 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/useSpread/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["transform-react-jsx", { "useSpread": true }]] +} diff --git a/packages/babel-plugin-transform-regenerator/package.json b/packages/babel-plugin-transform-regenerator/package.json index 9dbdaa4c6c7c..56079dce1ad3 100644 --- a/packages/babel-plugin-transform-regenerator/package.json +++ b/packages/babel-plugin-transform-regenerator/package.json @@ -2,12 +2,12 @@ "name": "@babel/plugin-transform-regenerator", "author": "Ben Newman ", "description": "Explode async and generator functions into a state machine.", - "version": "7.4.5", + "version": "7.8.7", "homepage": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-regenerator", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-regenerator", "main": "lib/index.js", "dependencies": { - "regenerator-transform": "^0.14.0" + "regenerator-transform": "^0.14.2" }, "license": "MIT", "publishConfig": { @@ -17,7 +17,7 @@ "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.4.5", - "@babel/helper-plugin-test-runner": "^7.0.0" + "@babel/core": "^7.8.7", + "@babel/helper-plugin-test-runner": "^7.8.3" } } diff --git a/packages/babel-plugin-transform-regenerator/test/fixtures/computed-properties/example/output.js b/packages/babel-plugin-transform-regenerator/test/fixtures/computed-properties/example/output.js index 923673d960df..761ca3a29919 100644 --- a/packages/babel-plugin-transform-regenerator/test/fixtures/computed-properties/example/output.js +++ b/packages/babel-plugin-transform-regenerator/test/fixtures/computed-properties/example/output.js @@ -1,20 +1,17 @@ var o = { foo() { - return ( - /*#__PURE__*/ - regeneratorRuntime.mark(function _callee() { - return regeneratorRuntime.wrap(function _callee$(_context) { - while (1) switch (_context.prev = _context.next) { - case 0: - return _context.abrupt("return", "foo"); + return /*#__PURE__*/regeneratorRuntime.mark(function _callee() { + return regeneratorRuntime.wrap(function _callee$(_context) { + while (1) switch (_context.prev = _context.next) { + case 0: + return _context.abrupt("return", "foo"); - case 1: - case "end": - return _context.stop(); - } - }, _callee); - })() - ); + case 1: + case "end": + return _context.stop(); + } + }, _callee); + })(); } }; diff --git a/packages/babel-plugin-transform-regenerator/test/fixtures/regression/4219/output.js b/packages/babel-plugin-transform-regenerator/test/fixtures/regression/4219/output.js index 0b2d02f3770d..67483b243904 100644 --- a/packages/babel-plugin-transform-regenerator/test/fixtures/regression/4219/output.js +++ b/packages/babel-plugin-transform-regenerator/test/fixtures/regression/4219/output.js @@ -3,24 +3,19 @@ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; } function test(fn) { - return ( - /*#__PURE__*/ - _asyncToGenerator( - /*#__PURE__*/ - regeneratorRuntime.mark(function _callee() { - var _args = arguments; - return regeneratorRuntime.wrap(function _callee$(_context) { - while (1) { - switch (_context.prev = _context.next) { - case 0: - return _context.abrupt("return", fn.apply(void 0, _args)); + return /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() { + var _args = arguments; + return regeneratorRuntime.wrap(function _callee$(_context) { + while (1) { + switch (_context.prev = _context.next) { + case 0: + return _context.abrupt("return", fn.apply(void 0, _args)); - case 1: - case "end": - return _context.stop(); - } + case 1: + case "end": + return _context.stop(); } - }, _callee); - })) - ); + } + }, _callee); + })); } diff --git a/packages/babel-plugin-transform-regenerator/test/fixtures/regression/6733/output.js b/packages/babel-plugin-transform-regenerator/test/fixtures/regression/6733/output.js index 869290481d30..e1a1c95c9eb0 100644 --- a/packages/babel-plugin-transform-regenerator/test/fixtures/regression/6733/output.js +++ b/packages/babel-plugin-transform-regenerator/test/fixtures/regression/6733/output.js @@ -5,9 +5,7 @@ Object.defineProperty(exports, "__esModule", { }); exports["default"] = _callee; -var _marked = -/*#__PURE__*/ -regeneratorRuntime.mark(_callee); +var _marked = /*#__PURE__*/regeneratorRuntime.mark(_callee); function _callee() { var x; diff --git a/packages/babel-plugin-transform-regenerator/test/fixtures/regression/T7041/output.js b/packages/babel-plugin-transform-regenerator/test/fixtures/regression/T7041/output.js index 5c1627f53221..6b9b21a8f7ef 100644 --- a/packages/babel-plugin-transform-regenerator/test/fixtures/regression/T7041/output.js +++ b/packages/babel-plugin-transform-regenerator/test/fixtures/regression/T7041/output.js @@ -1,8 +1,6 @@ var _regeneratorRuntime = require("@babel/runtime/regenerator"); -var _marked = -/*#__PURE__*/ -_regeneratorRuntime.mark(fn); +var _marked = /*#__PURE__*/_regeneratorRuntime.mark(fn); Object.keys({}); diff --git a/packages/babel-plugin-transform-regenerator/test/fixtures/scope/10193/input.mjs b/packages/babel-plugin-transform-regenerator/test/fixtures/scope/10193/input.mjs new file mode 100644 index 000000000000..d1225b7e3829 --- /dev/null +++ b/packages/babel-plugin-transform-regenerator/test/fixtures/scope/10193/input.mjs @@ -0,0 +1,5 @@ +import { someAction } from 'actions'; + +function* foo() { + const someAction = bar; +} diff --git a/packages/babel-plugin-transform-regenerator/test/fixtures/scope/10193/options.json b/packages/babel-plugin-transform-regenerator/test/fixtures/scope/10193/options.json new file mode 100644 index 000000000000..e756fd03c438 --- /dev/null +++ b/packages/babel-plugin-transform-regenerator/test/fixtures/scope/10193/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["transform-regenerator", "transform-modules-commonjs"] +} diff --git a/packages/babel-plugin-transform-regenerator/test/fixtures/scope/10193/output.js b/packages/babel-plugin-transform-regenerator/test/fixtures/scope/10193/output.js new file mode 100644 index 000000000000..8b8fc8545a6f --- /dev/null +++ b/packages/babel-plugin-transform-regenerator/test/fixtures/scope/10193/output.js @@ -0,0 +1,19 @@ +"use strict"; + +var _actions = require("actions"); + +var _marked = /*#__PURE__*/regeneratorRuntime.mark(foo); + +function foo() { + var someAction; + return regeneratorRuntime.wrap(function foo$(_context) { + while (1) switch (_context.prev = _context.next) { + case 0: + someAction = bar; + + case 1: + case "end": + return _context.stop(); + } + }, _marked); +} diff --git a/packages/babel-plugin-transform-regenerator/test/fixtures/scope/6923/input.js b/packages/babel-plugin-transform-regenerator/test/fixtures/scope/6923/input.js new file mode 100644 index 000000000000..20634a9543a4 --- /dev/null +++ b/packages/babel-plugin-transform-regenerator/test/fixtures/scope/6923/input.js @@ -0,0 +1,5 @@ +async function foo() { + (async function (number) { + const tmp = number + }) +} diff --git a/packages/babel-plugin-transform-regenerator/test/fixtures/scope/6923/options.json b/packages/babel-plugin-transform-regenerator/test/fixtures/scope/6923/options.json new file mode 100644 index 000000000000..9e14e1cefa56 --- /dev/null +++ b/packages/babel-plugin-transform-regenerator/test/fixtures/scope/6923/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["transform-regenerator"] +} diff --git a/packages/babel-plugin-transform-regenerator/test/fixtures/scope/6923/output.js b/packages/babel-plugin-transform-regenerator/test/fixtures/scope/6923/output.js new file mode 100644 index 000000000000..67391bafa12d --- /dev/null +++ b/packages/babel-plugin-transform-regenerator/test/fixtures/scope/6923/output.js @@ -0,0 +1,24 @@ +function foo() { + return regeneratorRuntime.async(function foo$(_context2) { + while (1) switch (_context2.prev = _context2.next) { + case 0: + (function _callee(number) { + var tmp; + return regeneratorRuntime.async(function _callee$(_context) { + while (1) switch (_context.prev = _context.next) { + case 0: + tmp = number; + + case 1: + case "end": + return _context.stop(); + } + }, null, null, null, Promise); + }); + + case 1: + case "end": + return _context2.stop(); + } + }, null, null, null, Promise); +} diff --git a/packages/babel-plugin-transform-regenerator/test/fixtures/scope/8525/input.js b/packages/babel-plugin-transform-regenerator/test/fixtures/scope/8525/input.js new file mode 100644 index 000000000000..1910145f3fb9 --- /dev/null +++ b/packages/babel-plugin-transform-regenerator/test/fixtures/scope/8525/input.js @@ -0,0 +1,7 @@ + + {() => { + const saveSession = async () => { + const newSessionId = await someAsyncFunc(); + }; + }} +; diff --git a/packages/babel-plugin-transform-regenerator/test/fixtures/scope/8525/options.json b/packages/babel-plugin-transform-regenerator/test/fixtures/scope/8525/options.json new file mode 100644 index 000000000000..1cb51ff34f02 --- /dev/null +++ b/packages/babel-plugin-transform-regenerator/test/fixtures/scope/8525/options.json @@ -0,0 +1,4 @@ +{ + "presets": ["react"], + "plugins": ["transform-regenerator"] +} diff --git a/packages/babel-plugin-transform-regenerator/test/fixtures/scope/8525/output.js b/packages/babel-plugin-transform-regenerator/test/fixtures/scope/8525/output.js new file mode 100644 index 000000000000..e106484acff3 --- /dev/null +++ b/packages/babel-plugin-transform-regenerator/test/fixtures/scope/8525/output.js @@ -0,0 +1,20 @@ +/*#__PURE__*/ +React.createElement(Component, null, () => { + const saveSession = () => { + var newSessionId; + return regeneratorRuntime.async(function _callee$(_context) { + while (1) switch (_context.prev = _context.next) { + case 0: + _context.next = 2; + return regeneratorRuntime.awrap(someAsyncFunc()); + + case 2: + newSessionId = _context.sent; + + case 3: + case "end": + return _context.stop(); + } + }, null, null, null, Promise); + }; +}); diff --git a/packages/babel-plugin-transform-reserved-words/package.json b/packages/babel-plugin-transform-reserved-words/package.json index dfce3bc9cf07..1c80adbb6775 100644 --- a/packages/babel-plugin-transform-reserved-words/package.json +++ b/packages/babel-plugin-transform-reserved-words/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-transform-reserved-words", - "version": "7.2.0", + "version": "7.8.3", "description": "Ensure that no reserved words are used.", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-reserved-words", "license": "MIT", @@ -12,13 +12,13 @@ "babel-plugin" ], "dependencies": { - "@babel/helper-plugin-utils": "^7.0.0" + "@babel/helper-plugin-utils": "^7.8.3" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.2.0", - "@babel/helper-plugin-test-runner": "^7.0.0" + "@babel/core": "^7.8.3", + "@babel/helper-plugin-test-runner": "^7.8.3" } } diff --git a/packages/babel-plugin-transform-runtime/package.json b/packages/babel-plugin-transform-runtime/package.json index d6881ae6fb63..5e0cd84f4bf5 100644 --- a/packages/babel-plugin-transform-runtime/package.json +++ b/packages/babel-plugin-transform-runtime/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-transform-runtime", - "version": "7.5.5", + "version": "7.9.0", "description": "Externalise references to helpers and builtins, automatically polyfilling your code without polluting globals", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-runtime", "license": "MIT", @@ -11,9 +11,13 @@ "keywords": [ "babel-plugin" ], + "browser": { + "./lib/get-runtime-path/index.js": "./lib/get-runtime-path/browser.js", + "./src/get-runtime-path/index.js": "./src/get-runtime-path/browser.js" + }, "dependencies": { - "@babel/helper-module-imports": "^7.0.0", - "@babel/helper-plugin-utils": "^7.0.0", + "@babel/helper-module-imports": "^7.8.3", + "@babel/helper-plugin-utils": "^7.8.3", "resolve": "^1.8.1", "semver": "^5.5.1" }, @@ -21,13 +25,13 @@ "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.5.5", - "@babel/helper-plugin-test-runner": "^7.0.0", - "@babel/helpers": "^7.5.5", - "@babel/plugin-transform-runtime": "^7.5.5", - "@babel/preset-env": "^7.5.5", - "@babel/runtime": "^7.5.5", - "@babel/template": "^7.4.4", - "@babel/types": "7.0.0-beta.53" + "@babel/core": "^7.9.0", + "@babel/helper-plugin-test-runner": "^7.8.3", + "@babel/helpers": "^7.9.0", + "@babel/plugin-transform-typeof-symbol": "^7.8.3", + "@babel/preset-env": "^7.9.0", + "@babel/runtime": "^7.9.0", + "@babel/template": "^7.8.3", + "@babel/types": "^7.9.0" } } diff --git a/packages/babel-plugin-transform-runtime/scripts/build-dist.js b/packages/babel-plugin-transform-runtime/scripts/build-dist.js index e36ef0c68b0a..a5ee8f16da6f 100644 --- a/packages/babel-plugin-transform-runtime/scripts/build-dist.js +++ b/packages/babel-plugin-transform-runtime/scripts/build-dist.js @@ -9,6 +9,7 @@ const t = require("@babel/types"); const transformRuntime = require("../"); +const runtimeVersion = require("@babel/runtime/package.json").version; const corejs2Definitions = require("../lib/runtime-corejs2-definitions").default(); const corejs3Definitions = require("../lib/runtime-corejs3-definitions").default(); @@ -133,6 +134,7 @@ function buildHelper( if (!esm) { bindings = []; + helpers.ensure(helperName, babel.File); for (const dep of helpers.getDependencies(helperName)) { const id = (dependencies[dep] = t.identifier(t.toIdentifier(dep))); tree.body.push(template.statement.ast` @@ -151,15 +153,30 @@ function buildHelper( tree.body.push(...helper.nodes); return babel.transformFromAst(tree, null, { - presets: [[require("@babel/preset-env"), { modules: false }]], + filename: helperFilename, + presets: [ + [ + "@babel/preset-env", + { modules: false, exclude: ["@babel/plugin-transform-typeof-symbol"] }, + ], + ], plugins: [ - [transformRuntime, { corejs, useESModules: esm }], + [ + transformRuntime, + { corejs, useESModules: esm, version: runtimeVersion }, + ], buildRuntimeRewritePlugin( runtimeName, path.relative(path.dirname(helperFilename), pkgDirname), helperName ), ], + overrides: [ + { + exclude: /typeof/, + plugins: ["@babel/plugin-transform-typeof-symbol"], + }, + ], }).code; } diff --git a/packages/babel-plugin-transform-runtime/src/get-runtime-path/browser.js b/packages/babel-plugin-transform-runtime/src/get-runtime-path/browser.js new file mode 100644 index 000000000000..1d407ae99a99 --- /dev/null +++ b/packages/babel-plugin-transform-runtime/src/get-runtime-path/browser.js @@ -0,0 +1,7 @@ +export default function(moduleName, dirname, absoluteRuntime) { + if (absoluteRuntime === false) return moduleName; + + throw new Error( + "The 'absoluteRuntime' option is not supported when using @babel/standalone.", + ); +} diff --git a/packages/babel-plugin-transform-runtime/src/get-runtime-path/index.js b/packages/babel-plugin-transform-runtime/src/get-runtime-path/index.js new file mode 100644 index 000000000000..393bde793888 --- /dev/null +++ b/packages/babel-plugin-transform-runtime/src/get-runtime-path/index.js @@ -0,0 +1,30 @@ +import path from "path"; +import resolve from "resolve"; + +export default function(moduleName, dirname, absoluteRuntime) { + if (absoluteRuntime === false) return moduleName; + + return resolveAbsoluteRuntime( + moduleName, + path.resolve(dirname, absoluteRuntime === true ? "." : absoluteRuntime), + ); +} + +function resolveAbsoluteRuntime(moduleName: string, dirname: string) { + try { + return path + .dirname(resolve.sync(`${moduleName}/package.json`, { basedir: dirname })) + .replace(/\\/g, "/"); + } catch (err) { + if (err.code !== "MODULE_NOT_FOUND") throw err; + + throw Object.assign( + new Error(`Failed to resolve "${moduleName}" relative to "${dirname}"`), + { + code: "BABEL_RUNTIME_NOT_FOUND", + runtime: moduleName, + dirname, + }, + ); + } +} diff --git a/packages/babel-plugin-transform-runtime/src/index.js b/packages/babel-plugin-transform-runtime/src/index.js index 3b7ff68e9c2f..ca203e13b20b 100644 --- a/packages/babel-plugin-transform-runtime/src/index.js +++ b/packages/babel-plugin-transform-runtime/src/index.js @@ -1,5 +1,3 @@ -import path from "path"; -import resolve from "resolve"; import { declare } from "@babel/helper-plugin-utils"; import { addDefault, isModule } from "@babel/helper-module-imports"; import { types as t } from "@babel/core"; @@ -7,25 +5,7 @@ import { types as t } from "@babel/core"; import getCoreJS2Definitions from "./runtime-corejs2-definitions"; import getCoreJS3Definitions from "./runtime-corejs3-definitions"; import { typeAnnotationToString } from "./helpers"; - -function resolveAbsoluteRuntime(moduleName: string, dirname: string) { - try { - return path.dirname( - resolve.sync(`${moduleName}/package.json`, { basedir: dirname }), - ); - } catch (err) { - if (err.code !== "MODULE_NOT_FOUND") throw err; - - throw Object.assign( - new Error(`Failed to resolve "${moduleName}" relative to "${dirname}"`), - { - code: "BABEL_RUNTIME_NOT_FOUND", - runtime: moduleName, - dirname, - }, - ); - } -} +import getRuntimePath from "./get-runtime-path"; function supportsStaticESM(caller) { return !!(caller && caller.supportsStaticESM); @@ -113,7 +93,14 @@ export default declare((api, options, dirname) => { ); } + function isNamespaced(path) { + const binding = path.scope.getBinding(path.node.name); + if (!binding) return false; + return binding.path.isImportNamespaceSpecifier(); + } + function maybeNeedsPolyfill(path, methods, name) { + if (isNamespaced(path.get("object"))) return false; if (!methods[name].types) return true; const typeAnnotation = path.get("object").getTypeAnnotation(); @@ -123,6 +110,14 @@ export default declare((api, options, dirname) => { return methods[name].types.some(name => name === type); } + function resolvePropertyName(path, computed) { + const { node } = path; + if (!computed) return node.name; + if (path.isStringLiteral()) return node.value; + const result = path.evaluate(); + return result.value; + } + if (has(options, "useBuiltIns")) { if (options.useBuiltIns) { throw new Error( @@ -181,13 +176,7 @@ export default declare((api, options, dirname) => { const HEADER_HELPERS = ["interopRequireWildcard", "interopRequireDefault"]; - let modulePath = moduleName; - if (absoluteRuntime !== false) { - modulePath = resolveAbsoluteRuntime( - moduleName, - path.resolve(dirname, absoluteRuntime === true ? "." : absoluteRuntime), - ); - } + const modulePath = getRuntimePath(moduleName, dirname, absoluteRuntime); return { name: "transform-runtime", @@ -290,8 +279,11 @@ export default declare((api, options, dirname) => { if (!t.isMemberExpression(callee)) return; - const { object, property } = callee; - const propertyName = property.name; + const { object } = callee; + const propertyName = resolvePropertyName( + path.get("callee.property"), + callee.computed, + ); // transform calling instance methods like `something.includes()` if (injectCoreJS3 && !hasStaticMapping(object.name, propertyName)) { @@ -314,9 +306,7 @@ export default declare((api, options, dirname) => { node.callee = t.memberExpression( t.callExpression( this.addDefaultImport( - `${moduleName}/${corejsRoot}/instance/${ - InstanceProperties[propertyName].path - }`, + `${moduleName}/${corejsRoot}/instance/${InstanceProperties[propertyName].path}`, `${propertyName}InstanceProperty`, ), [context2], @@ -370,29 +360,33 @@ export default declare((api, options, dirname) => { if (!path.isReferenced()) return; const { node } = path; - const { object, property } = node; + const { object } = node; if (!t.isReferenced(object, node)) return; - if (node.computed) { - if (injectCoreJS2) return; - // transform `something[Symbol.iterator]` to calling `getIteratorMethod(something)` helper - if (path.get("property").matchesPattern("Symbol.iterator")) { - path.replaceWith( - t.callExpression( - this.addDefaultImport( - `${moduleName}/core-js/get-iterator-method`, - "getIteratorMethod", - ), - [object], + // transform `something[Symbol.iterator]` to calling `getIteratorMethod(something)` helper + if ( + !injectCoreJS2 && + node.computed && + path.get("property").matchesPattern("Symbol.iterator") + ) { + path.replaceWith( + t.callExpression( + this.addDefaultImport( + `${moduleName}/core-js/get-iterator-method`, + "getIteratorMethod", ), - ); - } + [object], + ), + ); return; } const objectName = object.name; - const propertyName = property.name; + const propertyName = resolvePropertyName( + path.get("property"), + node.computed, + ); // doesn't reference the global if ( path.scope.getBindingIdentifier(objectName) || @@ -407,9 +401,7 @@ export default declare((api, options, dirname) => { path.replaceWith( t.callExpression( this.addDefaultImport( - `${moduleName}/${corejsRoot}/instance/${ - InstanceProperties[propertyName].path - }`, + `${moduleName}/${corejsRoot}/instance/${InstanceProperties[propertyName].path}`, `${propertyName}InstanceProperty`, ), [object], @@ -421,9 +413,7 @@ export default declare((api, options, dirname) => { path.replaceWith( this.addDefaultImport( - `${modulePath}/${corejsRoot}/${ - StaticProperties[objectName][propertyName].path - }`, + `${modulePath}/${corejsRoot}/${StaticProperties[objectName][propertyName].path}`, `${objectName}$${propertyName}`, ), ); diff --git a/packages/babel-plugin-transform-runtime/test/fixtures/absoluteRuntime/options.json b/packages/babel-plugin-transform-runtime/test/fixtures/absoluteRuntime/options.json new file mode 100644 index 000000000000..d6180568ae8d --- /dev/null +++ b/packages/babel-plugin-transform-runtime/test/fixtures/absoluteRuntime/options.json @@ -0,0 +1,3 @@ +{ + "os": ["linux", "darwin"] +} diff --git a/packages/babel-plugin-transform-runtime/test/fixtures/absoluteRuntime/relative/output.js b/packages/babel-plugin-transform-runtime/test/fixtures/absoluteRuntime/relative/output.js index e783188c9e48..4e7a5218225f 100644 --- a/packages/babel-plugin-transform-runtime/test/fixtures/absoluteRuntime/relative/output.js +++ b/packages/babel-plugin-transform-runtime/test/fixtures/absoluteRuntime/relative/output.js @@ -1,4 +1,4 @@ -var _classCallCheck = require("/packages/babel-plugin-transform-runtime/node_modules/@babel/runtime/helpers/classCallCheck"); +var _classCallCheck = require("/packages/babel-plugin-transform-runtime/test/fixtures/absoluteRuntime/relative/subfolder/node_modules/@babel/runtime/helpers/classCallCheck"); let Foo = function Foo() { "use strict"; diff --git a/packages/babel-plugin-transform-runtime/test/fixtures/absoluteRuntime/relative/subfolder/node_modules/@babel/runtime/package.json b/packages/babel-plugin-transform-runtime/test/fixtures/absoluteRuntime/relative/subfolder/node_modules/@babel/runtime/package.json new file mode 100644 index 000000000000..652fee89ae19 --- /dev/null +++ b/packages/babel-plugin-transform-runtime/test/fixtures/absoluteRuntime/relative/subfolder/node_modules/@babel/runtime/package.json @@ -0,0 +1,4 @@ +{ + "name": "@babel/runtime", + "private": true +} diff --git a/packages/babel-plugin-transform-runtime/test/fixtures/runtime-corejs2/es6-for-of/options.json b/packages/babel-plugin-transform-runtime/test/fixtures/runtime-corejs2/es6-for-of/options.json index 5b5b7b35f106..a855e9bdf376 100644 --- a/packages/babel-plugin-transform-runtime/test/fixtures/runtime-corejs2/es6-for-of/options.json +++ b/packages/babel-plugin-transform-runtime/test/fixtures/runtime-corejs2/es6-for-of/options.json @@ -1,3 +1,6 @@ { - "plugins": ["transform-for-of", ["transform-runtime", { "corejs": 2 }]] + "plugins": [ + "transform-for-of", + ["transform-runtime", { "corejs": 2, "version": "7.100.0" }] + ] } diff --git a/packages/babel-plugin-transform-runtime/test/fixtures/runtime-corejs2/es6-for-of/output.js b/packages/babel-plugin-transform-runtime/test/fixtures/runtime-corejs2/es6-for-of/output.js index be11791731f3..ad7039a8ea59 100644 --- a/packages/babel-plugin-transform-runtime/test/fixtures/runtime-corejs2/es6-for-of/output.js +++ b/packages/babel-plugin-transform-runtime/test/fixtures/runtime-corejs2/es6-for-of/output.js @@ -1,24 +1,14 @@ -var _getIterator = require("@babel/runtime-corejs2/core-js/get-iterator"); +var _createForOfIteratorHelper = require("@babel/runtime-corejs2/helpers/createForOfIteratorHelper"); -var _iteratorNormalCompletion = true; -var _didIteratorError = false; -var _iteratorError = undefined; +var _iterator = _createForOfIteratorHelper(arr), + _step; try { - for (var _iterator = _getIterator(arr), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { + for (_iterator.s(); !(_step = _iterator.n()).done;) { var i = _step.value; } } catch (err) { - _didIteratorError = true; - _iteratorError = err; + _iterator.e(err); } finally { - try { - if (!_iteratorNormalCompletion && _iterator.return != null) { - _iterator.return(); - } - } finally { - if (_didIteratorError) { - throw _iteratorError; - } - } + _iterator.f(); } diff --git a/packages/babel-plugin-transform-runtime/test/fixtures/runtime-corejs2/evaluated-static-methods/input.js b/packages/babel-plugin-transform-runtime/test/fixtures/runtime-corejs2/evaluated-static-methods/input.js new file mode 100644 index 000000000000..6968e9a2729b --- /dev/null +++ b/packages/babel-plugin-transform-runtime/test/fixtures/runtime-corejs2/evaluated-static-methods/input.js @@ -0,0 +1,5 @@ +var _isArray = "isArray"; + +Array["from"]; // polyfill +Array[_isArray]; // polyfill +Array[of]; // don't polyfill diff --git a/packages/babel-plugin-transform-runtime/test/fixtures/runtime-corejs2/evaluated-static-methods/options.json b/packages/babel-plugin-transform-runtime/test/fixtures/runtime-corejs2/evaluated-static-methods/options.json new file mode 100644 index 000000000000..3514ed63b409 --- /dev/null +++ b/packages/babel-plugin-transform-runtime/test/fixtures/runtime-corejs2/evaluated-static-methods/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["transform-runtime", { "corejs": 2 }]] +} diff --git a/packages/babel-plugin-transform-runtime/test/fixtures/runtime-corejs2/evaluated-static-methods/output.js b/packages/babel-plugin-transform-runtime/test/fixtures/runtime-corejs2/evaluated-static-methods/output.js new file mode 100644 index 000000000000..59868c6f60d5 --- /dev/null +++ b/packages/babel-plugin-transform-runtime/test/fixtures/runtime-corejs2/evaluated-static-methods/output.js @@ -0,0 +1,10 @@ +var _Array$isArray = require("@babel/runtime-corejs2/core-js/array/is-array"); + +var _Array$from = require("@babel/runtime-corejs2/core-js/array/from"); + +var _isArray = "isArray"; +_Array$from; // polyfill + +_Array$isArray; // polyfill + +Array[of]; // don't polyfill diff --git a/packages/babel-plugin-transform-runtime/test/fixtures/runtime-corejs2/full/output.mjs b/packages/babel-plugin-transform-runtime/test/fixtures/runtime-corejs2/full/output.mjs index 841a99d5778e..a3ccbb960734 100644 --- a/packages/babel-plugin-transform-runtime/test/fixtures/runtime-corejs2/full/output.mjs +++ b/packages/babel-plugin-transform-runtime/test/fixtures/runtime-corejs2/full/output.mjs @@ -1,9 +1,7 @@ import _regeneratorRuntime from "@babel/runtime-corejs2/regenerator"; import _Symbol from "@babel/runtime-corejs2/core-js/symbol"; -var _marked = -/*#__PURE__*/ -_regeneratorRuntime.mark(giveWord); +var _marked = /*#__PURE__*/_regeneratorRuntime.mark(giveWord); import foo, * as bar from "someModule"; export const myWord = _Symbol("abc"); diff --git a/packages/babel-plugin-transform-runtime/test/fixtures/runtime-corejs2/instance-computed/input.js b/packages/babel-plugin-transform-runtime/test/fixtures/runtime-corejs2/instance-computed/input.js index 87ed431301c8..0ca5137f3896 100644 --- a/packages/babel-plugin-transform-runtime/test/fixtures/runtime-corejs2/instance-computed/input.js +++ b/packages/babel-plugin-transform-runtime/test/fixtures/runtime-corejs2/instance-computed/input.js @@ -1 +1 @@ -bar[filter]() \ No newline at end of file +bar[filter]() diff --git a/packages/babel-plugin-transform-runtime/test/fixtures/runtime-corejs2/modules-helpers/output.js b/packages/babel-plugin-transform-runtime/test/fixtures/runtime-corejs2/modules-helpers/output.js index 8b91c079a609..a76fee64666b 100644 --- a/packages/babel-plugin-transform-runtime/test/fixtures/runtime-corejs2/modules-helpers/output.js +++ b/packages/babel-plugin-transform-runtime/test/fixtures/runtime-corejs2/modules-helpers/output.js @@ -8,9 +8,7 @@ var _createClass2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpe var _foo = _interopRequireDefault(require("foo")); -let Example = -/*#__PURE__*/ -function () { +let Example = /*#__PURE__*/function () { function Example() { (0, _classCallCheck2.default)(this, Example); } diff --git a/packages/babel-plugin-transform-runtime/test/fixtures/runtime-corejs2/regenerator-runtime/output.js b/packages/babel-plugin-transform-runtime/test/fixtures/runtime-corejs2/regenerator-runtime/output.js index 852c24b9c4a3..f7e6f94493fe 100644 --- a/packages/babel-plugin-transform-runtime/test/fixtures/runtime-corejs2/regenerator-runtime/output.js +++ b/packages/babel-plugin-transform-runtime/test/fixtures/runtime-corejs2/regenerator-runtime/output.js @@ -1,8 +1,6 @@ var _regeneratorRuntime = require("@babel/runtime-corejs2/regenerator"); -void -/*#__PURE__*/ -_regeneratorRuntime.mark(function _callee() { +void /*#__PURE__*/_regeneratorRuntime.mark(function _callee() { return _regeneratorRuntime.wrap(function _callee$(_context) { while (1) switch (_context.prev = _context.next) { case 0: diff --git a/packages/babel-plugin-transform-runtime/test/fixtures/runtime-corejs3/built-in-globals-proposals/options.json b/packages/babel-plugin-transform-runtime/test/fixtures/runtime-corejs3/built-in-globals-proposals/options.json index 1e8ea7d11308..2b36aa6019b4 100644 --- a/packages/babel-plugin-transform-runtime/test/fixtures/runtime-corejs3/built-in-globals-proposals/options.json +++ b/packages/babel-plugin-transform-runtime/test/fixtures/runtime-corejs3/built-in-globals-proposals/options.json @@ -1,3 +1,5 @@ { - "plugins": [["transform-runtime", { "corejs": { "version": 3, "proposals": true } }]] + "plugins": [ + ["transform-runtime", { "corejs": { "version": 3, "proposals": true } }] + ] } diff --git a/packages/babel-plugin-transform-runtime/test/fixtures/runtime-corejs3/built-in-instance-methods-proposals/options.json b/packages/babel-plugin-transform-runtime/test/fixtures/runtime-corejs3/built-in-instance-methods-proposals/options.json index 1e8ea7d11308..2b36aa6019b4 100644 --- a/packages/babel-plugin-transform-runtime/test/fixtures/runtime-corejs3/built-in-instance-methods-proposals/options.json +++ b/packages/babel-plugin-transform-runtime/test/fixtures/runtime-corejs3/built-in-instance-methods-proposals/options.json @@ -1,3 +1,5 @@ { - "plugins": [["transform-runtime", { "corejs": { "version": 3, "proposals": true } }]] + "plugins": [ + ["transform-runtime", { "corejs": { "version": 3, "proposals": true } }] + ] } diff --git a/packages/babel-plugin-transform-runtime/test/fixtures/runtime-corejs3/built-in-static-methods-proposals/options.json b/packages/babel-plugin-transform-runtime/test/fixtures/runtime-corejs3/built-in-static-methods-proposals/options.json index 1e8ea7d11308..2b36aa6019b4 100644 --- a/packages/babel-plugin-transform-runtime/test/fixtures/runtime-corejs3/built-in-static-methods-proposals/options.json +++ b/packages/babel-plugin-transform-runtime/test/fixtures/runtime-corejs3/built-in-static-methods-proposals/options.json @@ -1,3 +1,5 @@ { - "plugins": [["transform-runtime", { "corejs": { "version": 3, "proposals": true } }]] + "plugins": [ + ["transform-runtime", { "corejs": { "version": 3, "proposals": true } }] + ] } diff --git a/packages/babel-plugin-transform-runtime/test/fixtures/runtime-corejs3/es6-for-of/options.json b/packages/babel-plugin-transform-runtime/test/fixtures/runtime-corejs3/es6-for-of/options.json index 79f4e0ec1085..e26d8d98a9bc 100644 --- a/packages/babel-plugin-transform-runtime/test/fixtures/runtime-corejs3/es6-for-of/options.json +++ b/packages/babel-plugin-transform-runtime/test/fixtures/runtime-corejs3/es6-for-of/options.json @@ -1,3 +1,6 @@ { - "plugins": ["transform-for-of", ["transform-runtime", { "corejs": 3 }]] + "plugins": [ + "transform-for-of", + ["transform-runtime", { "corejs": 3, "version": "7.100.0" }] + ] } diff --git a/packages/babel-plugin-transform-runtime/test/fixtures/runtime-corejs3/es6-for-of/output.js b/packages/babel-plugin-transform-runtime/test/fixtures/runtime-corejs3/es6-for-of/output.js index 2bb4ba66cbc7..a8dac71ca6f0 100644 --- a/packages/babel-plugin-transform-runtime/test/fixtures/runtime-corejs3/es6-for-of/output.js +++ b/packages/babel-plugin-transform-runtime/test/fixtures/runtime-corejs3/es6-for-of/output.js @@ -1,24 +1,14 @@ -var _getIterator = require("@babel/runtime-corejs3/core-js/get-iterator"); +var _createForOfIteratorHelper = require("@babel/runtime-corejs3/helpers/createForOfIteratorHelper"); -var _iteratorNormalCompletion = true; -var _didIteratorError = false; -var _iteratorError = undefined; +var _iterator = _createForOfIteratorHelper(arr), + _step; try { - for (var _iterator = _getIterator(arr), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { + for (_iterator.s(); !(_step = _iterator.n()).done;) { var i = _step.value; } } catch (err) { - _didIteratorError = true; - _iteratorError = err; + _iterator.e(err); } finally { - try { - if (!_iteratorNormalCompletion && _iterator.return != null) { - _iterator.return(); - } - } finally { - if (_didIteratorError) { - throw _iteratorError; - } - } + _iterator.f(); } diff --git a/packages/babel-plugin-transform-runtime/test/fixtures/runtime-corejs3/evaluated-instance-methods/input.js b/packages/babel-plugin-transform-runtime/test/fixtures/runtime-corejs3/evaluated-instance-methods/input.js new file mode 100644 index 000000000000..edc557316374 --- /dev/null +++ b/packages/babel-plugin-transform-runtime/test/fixtures/runtime-corejs3/evaluated-instance-methods/input.js @@ -0,0 +1,9 @@ +var _map = "map"; + +object["filter"]; // polyfill +object[_map]; // polyfill +object[find]; // don't polyfill + +object["filter"](); // polyfill +object[_map](); // polyfill +object[find](); // don't polyfill diff --git a/packages/babel-plugin-transform-runtime/test/fixtures/runtime-corejs3/evaluated-instance-methods/options.json b/packages/babel-plugin-transform-runtime/test/fixtures/runtime-corejs3/evaluated-instance-methods/options.json new file mode 100644 index 000000000000..2b36aa6019b4 --- /dev/null +++ b/packages/babel-plugin-transform-runtime/test/fixtures/runtime-corejs3/evaluated-instance-methods/options.json @@ -0,0 +1,5 @@ +{ + "plugins": [ + ["transform-runtime", { "corejs": { "version": 3, "proposals": true } }] + ] +} diff --git a/packages/babel-plugin-transform-runtime/test/fixtures/runtime-corejs3/evaluated-instance-methods/output.js b/packages/babel-plugin-transform-runtime/test/fixtures/runtime-corejs3/evaluated-instance-methods/output.js new file mode 100644 index 000000000000..1f2bc8c78155 --- /dev/null +++ b/packages/babel-plugin-transform-runtime/test/fixtures/runtime-corejs3/evaluated-instance-methods/output.js @@ -0,0 +1,21 @@ +var _mapInstanceProperty = require("@babel/runtime-corejs3/core-js/instance/map"); + +var _filterInstanceProperty = require("@babel/runtime-corejs3/core-js/instance/filter"); + +var _map = "map"; + +_filterInstanceProperty(object); // polyfill + + +_mapInstanceProperty(object); // polyfill + + +object[find]; // don't polyfill + +_filterInstanceProperty(object).call(object); // polyfill + + +_mapInstanceProperty(object).call(object); // polyfill + + +object[find](); // don't polyfill diff --git a/packages/babel-plugin-transform-runtime/test/fixtures/runtime-corejs3/evaluated-static-methods/input.js b/packages/babel-plugin-transform-runtime/test/fixtures/runtime-corejs3/evaluated-static-methods/input.js new file mode 100644 index 000000000000..6968e9a2729b --- /dev/null +++ b/packages/babel-plugin-transform-runtime/test/fixtures/runtime-corejs3/evaluated-static-methods/input.js @@ -0,0 +1,5 @@ +var _isArray = "isArray"; + +Array["from"]; // polyfill +Array[_isArray]; // polyfill +Array[of]; // don't polyfill diff --git a/packages/babel-plugin-transform-runtime/test/fixtures/runtime-corejs3/evaluated-static-methods/options.json b/packages/babel-plugin-transform-runtime/test/fixtures/runtime-corejs3/evaluated-static-methods/options.json new file mode 100644 index 000000000000..2b36aa6019b4 --- /dev/null +++ b/packages/babel-plugin-transform-runtime/test/fixtures/runtime-corejs3/evaluated-static-methods/options.json @@ -0,0 +1,5 @@ +{ + "plugins": [ + ["transform-runtime", { "corejs": { "version": 3, "proposals": true } }] + ] +} diff --git a/packages/babel-plugin-transform-runtime/test/fixtures/runtime-corejs3/evaluated-static-methods/output.js b/packages/babel-plugin-transform-runtime/test/fixtures/runtime-corejs3/evaluated-static-methods/output.js new file mode 100644 index 000000000000..83dde082836f --- /dev/null +++ b/packages/babel-plugin-transform-runtime/test/fixtures/runtime-corejs3/evaluated-static-methods/output.js @@ -0,0 +1,10 @@ +var _Array$isArray = require("@babel/runtime-corejs3/core-js/array/is-array"); + +var _Array$from = require("@babel/runtime-corejs3/core-js/array/from"); + +var _isArray = "isArray"; +_Array$from; // polyfill + +_Array$isArray; // polyfill + +Array[of]; // don't polyfill diff --git a/packages/babel-plugin-transform-runtime/test/fixtures/runtime-corejs3/full/output.mjs b/packages/babel-plugin-transform-runtime/test/fixtures/runtime-corejs3/full/output.mjs index e0183d2e2afd..9478cc95129b 100644 --- a/packages/babel-plugin-transform-runtime/test/fixtures/runtime-corejs3/full/output.mjs +++ b/packages/babel-plugin-transform-runtime/test/fixtures/runtime-corejs3/full/output.mjs @@ -1,9 +1,7 @@ import _regeneratorRuntime from "@babel/runtime-corejs3/regenerator"; import _Symbol from "@babel/runtime-corejs3/core-js-stable/symbol"; -var _marked = -/*#__PURE__*/ -_regeneratorRuntime.mark(giveWord); +var _marked = /*#__PURE__*/_regeneratorRuntime.mark(giveWord); import foo, * as bar from "someModule"; export const myWord = _Symbol("abc"); diff --git a/packages/babel-plugin-transform-runtime/test/fixtures/runtime-corejs3/instance-computed/input.js b/packages/babel-plugin-transform-runtime/test/fixtures/runtime-corejs3/instance-computed/input.js index 87ed431301c8..225ac3534de6 100644 --- a/packages/babel-plugin-transform-runtime/test/fixtures/runtime-corejs3/instance-computed/input.js +++ b/packages/babel-plugin-transform-runtime/test/fixtures/runtime-corejs3/instance-computed/input.js @@ -1 +1 @@ -bar[filter]() \ No newline at end of file +bar['filter']() diff --git a/packages/babel-plugin-transform-runtime/test/fixtures/runtime-corejs3/modules-helpers/output.js b/packages/babel-plugin-transform-runtime/test/fixtures/runtime-corejs3/modules-helpers/output.js index cef08c661a7f..0f285bd5043d 100644 --- a/packages/babel-plugin-transform-runtime/test/fixtures/runtime-corejs3/modules-helpers/output.js +++ b/packages/babel-plugin-transform-runtime/test/fixtures/runtime-corejs3/modules-helpers/output.js @@ -8,9 +8,7 @@ var _createClass2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpe var _foo = _interopRequireDefault(require("foo")); -let Example = -/*#__PURE__*/ -function () { +let Example = /*#__PURE__*/function () { function Example() { (0, _classCallCheck2.default)(this, Example); } diff --git a/packages/babel-plugin-transform-runtime/test/fixtures/runtime-corejs3/modules-namespaced/input.mjs b/packages/babel-plugin-transform-runtime/test/fixtures/runtime-corejs3/modules-namespaced/input.mjs new file mode 100644 index 000000000000..7962c3d2005c --- /dev/null +++ b/packages/babel-plugin-transform-runtime/test/fixtures/runtime-corejs3/modules-namespaced/input.mjs @@ -0,0 +1,2 @@ +import * as bar from "bar"; +bar.map(); diff --git a/packages/babel-plugin-transform-runtime/test/fixtures/runtime-corejs3/modules-namespaced/options.json b/packages/babel-plugin-transform-runtime/test/fixtures/runtime-corejs3/modules-namespaced/options.json new file mode 100644 index 000000000000..ea8bb9c3aa1c --- /dev/null +++ b/packages/babel-plugin-transform-runtime/test/fixtures/runtime-corejs3/modules-namespaced/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["transform-runtime", { "corejs": 3 }]] +} diff --git a/packages/babel-plugin-transform-runtime/test/fixtures/runtime-corejs3/modules-namespaced/output.mjs b/packages/babel-plugin-transform-runtime/test/fixtures/runtime-corejs3/modules-namespaced/output.mjs new file mode 100644 index 000000000000..7962c3d2005c --- /dev/null +++ b/packages/babel-plugin-transform-runtime/test/fixtures/runtime-corejs3/modules-namespaced/output.mjs @@ -0,0 +1,2 @@ +import * as bar from "bar"; +bar.map(); diff --git a/packages/babel-plugin-transform-runtime/test/fixtures/runtime-corejs3/regenerator-runtime/output.js b/packages/babel-plugin-transform-runtime/test/fixtures/runtime-corejs3/regenerator-runtime/output.js index 217ed8f6dc06..75fad4e36d56 100644 --- a/packages/babel-plugin-transform-runtime/test/fixtures/runtime-corejs3/regenerator-runtime/output.js +++ b/packages/babel-plugin-transform-runtime/test/fixtures/runtime-corejs3/regenerator-runtime/output.js @@ -1,8 +1,6 @@ var _regeneratorRuntime = require("@babel/runtime-corejs3/regenerator"); -void -/*#__PURE__*/ -_regeneratorRuntime.mark(function _callee() { +void /*#__PURE__*/_regeneratorRuntime.mark(function _callee() { return _regeneratorRuntime.wrap(function _callee$(_context) { while (1) switch (_context.prev = _context.next) { case 0: diff --git a/packages/babel-plugin-transform-runtime/test/fixtures/runtime/es6-for-of/options.json b/packages/babel-plugin-transform-runtime/test/fixtures/runtime/es6-for-of/options.json index 79e414ae0c4a..7823a1ff438a 100644 --- a/packages/babel-plugin-transform-runtime/test/fixtures/runtime/es6-for-of/options.json +++ b/packages/babel-plugin-transform-runtime/test/fixtures/runtime/es6-for-of/options.json @@ -1,3 +1,6 @@ { - "plugins": ["transform-for-of", "transform-runtime"] + "plugins": [ + "transform-for-of", + ["transform-runtime", { "version": "7.100.0" }] + ] } diff --git a/packages/babel-plugin-transform-runtime/test/fixtures/runtime/es6-for-of/output.js b/packages/babel-plugin-transform-runtime/test/fixtures/runtime/es6-for-of/output.js index ec97a710aed5..7a9a9c6cf2e5 100644 --- a/packages/babel-plugin-transform-runtime/test/fixtures/runtime/es6-for-of/output.js +++ b/packages/babel-plugin-transform-runtime/test/fixtures/runtime/es6-for-of/output.js @@ -1,22 +1,14 @@ -var _iteratorNormalCompletion = true; -var _didIteratorError = false; -var _iteratorError = undefined; +var _createForOfIteratorHelper = require("@babel/runtime/helpers/createForOfIteratorHelper"); + +var _iterator = _createForOfIteratorHelper(arr), + _step; try { - for (var _iterator = arr[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { + for (_iterator.s(); !(_step = _iterator.n()).done;) { var i = _step.value; } } catch (err) { - _didIteratorError = true; - _iteratorError = err; + _iterator.e(err); } finally { - try { - if (!_iteratorNormalCompletion && _iterator.return != null) { - _iterator.return(); - } - } finally { - if (_didIteratorError) { - throw _iteratorError; - } - } + _iterator.f(); } diff --git a/packages/babel-plugin-transform-runtime/test/fixtures/runtime/full/output.mjs b/packages/babel-plugin-transform-runtime/test/fixtures/runtime/full/output.mjs index 2576947e3dd3..3ee26a45a4f7 100644 --- a/packages/babel-plugin-transform-runtime/test/fixtures/runtime/full/output.mjs +++ b/packages/babel-plugin-transform-runtime/test/fixtures/runtime/full/output.mjs @@ -1,8 +1,6 @@ import _regeneratorRuntime from "@babel/runtime/regenerator"; -var _marked = -/*#__PURE__*/ -_regeneratorRuntime.mark(giveWord); +var _marked = /*#__PURE__*/_regeneratorRuntime.mark(giveWord); import foo, * as bar from "someModule"; export const myWord = Symbol("abc"); diff --git a/packages/babel-plugin-transform-runtime/test/fixtures/runtime/modules-helpers/output.js b/packages/babel-plugin-transform-runtime/test/fixtures/runtime/modules-helpers/output.js index 7a95ad78e496..ea8efeab5c18 100644 --- a/packages/babel-plugin-transform-runtime/test/fixtures/runtime/modules-helpers/output.js +++ b/packages/babel-plugin-transform-runtime/test/fixtures/runtime/modules-helpers/output.js @@ -8,9 +8,7 @@ var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/creat var _foo = _interopRequireDefault(require("foo")); -let Example = -/*#__PURE__*/ -function () { +let Example = /*#__PURE__*/function () { function Example() { (0, _classCallCheck2.default)(this, Example); } diff --git a/packages/babel-plugin-transform-runtime/test/fixtures/runtime/regenerator-runtime/output.js b/packages/babel-plugin-transform-runtime/test/fixtures/runtime/regenerator-runtime/output.js index 5bd92072ae8f..a0ef2acfc7ce 100644 --- a/packages/babel-plugin-transform-runtime/test/fixtures/runtime/regenerator-runtime/output.js +++ b/packages/babel-plugin-transform-runtime/test/fixtures/runtime/regenerator-runtime/output.js @@ -1,8 +1,6 @@ var _regeneratorRuntime = require("@babel/runtime/regenerator"); -void -/*#__PURE__*/ -_regeneratorRuntime.mark(function _callee() { +void /*#__PURE__*/_regeneratorRuntime.mark(function _callee() { return _regeneratorRuntime.wrap(function _callee$(_context) { while (1) switch (_context.prev = _context.next) { case 0: diff --git a/packages/babel-plugin-transform-runtime/test/fixtures/use-options/corejs-useES6Modules/output.mjs b/packages/babel-plugin-transform-runtime/test/fixtures/use-options/corejs-useES6Modules/output.mjs index 828c9aa787ef..7431a0fb60b9 100644 --- a/packages/babel-plugin-transform-runtime/test/fixtures/use-options/corejs-useES6Modules/output.mjs +++ b/packages/babel-plugin-transform-runtime/test/fixtures/use-options/corejs-useES6Modules/output.mjs @@ -1,17 +1,22 @@ +import _Reflect$construct from "@babel/runtime-corejs2/core-js/reflect/construct"; import _classCallCheck from "@babel/runtime-corejs2/helpers/esm/classCallCheck"; +import _inherits from "@babel/runtime-corejs2/helpers/esm/inherits"; import _possibleConstructorReturn from "@babel/runtime-corejs2/helpers/esm/possibleConstructorReturn"; import _getPrototypeOf from "@babel/runtime-corejs2/helpers/esm/getPrototypeOf"; -import _inherits from "@babel/runtime-corejs2/helpers/esm/inherits"; -let Foo = -/*#__PURE__*/ -function (_Bar) { +function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function () { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = _Reflect$construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } + +function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !_Reflect$construct) return false; if (_Reflect$construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(_Reflect$construct(Date, [], function () {})); return true; } catch (e) { return false; } } + +let Foo = /*#__PURE__*/function (_Bar) { _inherits(Foo, _Bar); + var _super = _createSuper(Foo); + function Foo() { _classCallCheck(this, Foo); - return _possibleConstructorReturn(this, _getPrototypeOf(Foo).apply(this, arguments)); + return _super.apply(this, arguments); } return Foo; diff --git a/packages/babel-plugin-transform-runtime/test/fixtures/use-options/corejs/output.mjs b/packages/babel-plugin-transform-runtime/test/fixtures/use-options/corejs/output.mjs index 44f4d72a0409..b3cf65f6427c 100644 --- a/packages/babel-plugin-transform-runtime/test/fixtures/use-options/corejs/output.mjs +++ b/packages/babel-plugin-transform-runtime/test/fixtures/use-options/corejs/output.mjs @@ -1,17 +1,22 @@ +import _Reflect$construct from "@babel/runtime-corejs2/core-js/reflect/construct"; import _classCallCheck from "@babel/runtime-corejs2/helpers/classCallCheck"; +import _inherits from "@babel/runtime-corejs2/helpers/inherits"; import _possibleConstructorReturn from "@babel/runtime-corejs2/helpers/possibleConstructorReturn"; import _getPrototypeOf from "@babel/runtime-corejs2/helpers/getPrototypeOf"; -import _inherits from "@babel/runtime-corejs2/helpers/inherits"; -let Foo = -/*#__PURE__*/ -function (_Bar) { +function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function () { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = _Reflect$construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } + +function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !_Reflect$construct) return false; if (_Reflect$construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(_Reflect$construct(Date, [], function () {})); return true; } catch (e) { return false; } } + +let Foo = /*#__PURE__*/function (_Bar) { _inherits(Foo, _Bar); + var _super = _createSuper(Foo); + function Foo() { _classCallCheck(this, Foo); - return _possibleConstructorReturn(this, _getPrototypeOf(Foo).apply(this, arguments)); + return _super.apply(this, arguments); } return Foo; diff --git a/packages/babel-plugin-transform-runtime/test/fixtures/use-options/useESModules-cjs-auto/output.js b/packages/babel-plugin-transform-runtime/test/fixtures/use-options/useESModules-cjs-auto/output.js index 39882dcd466a..9163dc0bf689 100644 --- a/packages/babel-plugin-transform-runtime/test/fixtures/use-options/useESModules-cjs-auto/output.js +++ b/packages/babel-plugin-transform-runtime/test/fixtures/use-options/useESModules-cjs-auto/output.js @@ -1,22 +1,26 @@ var _classCallCheck = require("@babel/runtime/helpers/classCallCheck"); +var _inherits = require("@babel/runtime/helpers/inherits"); + var _possibleConstructorReturn = require("@babel/runtime/helpers/possibleConstructorReturn"); var _getPrototypeOf = require("@babel/runtime/helpers/getPrototypeOf"); -var _inherits = require("@babel/runtime/helpers/inherits"); +function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function () { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } -let Foo = -/*#__PURE__*/ -function (_Bar) { +function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } + +let Foo = /*#__PURE__*/function (_Bar) { "use strict"; _inherits(Foo, _Bar); + var _super = _createSuper(Foo); + function Foo() { _classCallCheck(this, Foo); - return _possibleConstructorReturn(this, _getPrototypeOf(Foo).apply(this, arguments)); + return _super.apply(this, arguments); } return Foo; diff --git a/packages/babel-plugin-transform-runtime/test/fixtures/use-options/useESModules-cjs/output.js b/packages/babel-plugin-transform-runtime/test/fixtures/use-options/useESModules-cjs/output.js index 39882dcd466a..9163dc0bf689 100644 --- a/packages/babel-plugin-transform-runtime/test/fixtures/use-options/useESModules-cjs/output.js +++ b/packages/babel-plugin-transform-runtime/test/fixtures/use-options/useESModules-cjs/output.js @@ -1,22 +1,26 @@ var _classCallCheck = require("@babel/runtime/helpers/classCallCheck"); +var _inherits = require("@babel/runtime/helpers/inherits"); + var _possibleConstructorReturn = require("@babel/runtime/helpers/possibleConstructorReturn"); var _getPrototypeOf = require("@babel/runtime/helpers/getPrototypeOf"); -var _inherits = require("@babel/runtime/helpers/inherits"); +function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function () { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } -let Foo = -/*#__PURE__*/ -function (_Bar) { +function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } + +let Foo = /*#__PURE__*/function (_Bar) { "use strict"; _inherits(Foo, _Bar); + var _super = _createSuper(Foo); + function Foo() { _classCallCheck(this, Foo); - return _possibleConstructorReturn(this, _getPrototypeOf(Foo).apply(this, arguments)); + return _super.apply(this, arguments); } return Foo; diff --git a/packages/babel-plugin-transform-runtime/test/fixtures/use-options/useESModules-mjs-auto/output.mjs b/packages/babel-plugin-transform-runtime/test/fixtures/use-options/useESModules-mjs-auto/output.mjs index 0247fa0b5556..343007e0f272 100644 --- a/packages/babel-plugin-transform-runtime/test/fixtures/use-options/useESModules-mjs-auto/output.mjs +++ b/packages/babel-plugin-transform-runtime/test/fixtures/use-options/useESModules-mjs-auto/output.mjs @@ -1,17 +1,21 @@ import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck"; +import _inherits from "@babel/runtime/helpers/esm/inherits"; import _possibleConstructorReturn from "@babel/runtime/helpers/esm/possibleConstructorReturn"; import _getPrototypeOf from "@babel/runtime/helpers/esm/getPrototypeOf"; -import _inherits from "@babel/runtime/helpers/esm/inherits"; -let Foo = -/*#__PURE__*/ -function (_Bar) { +function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function () { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } + +function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } + +let Foo = /*#__PURE__*/function (_Bar) { _inherits(Foo, _Bar); + var _super = _createSuper(Foo); + function Foo() { _classCallCheck(this, Foo); - return _possibleConstructorReturn(this, _getPrototypeOf(Foo).apply(this, arguments)); + return _super.apply(this, arguments); } return Foo; diff --git a/packages/babel-plugin-transform-runtime/test/fixtures/use-options/useESModules-mjs/output.mjs b/packages/babel-plugin-transform-runtime/test/fixtures/use-options/useESModules-mjs/output.mjs index 0247fa0b5556..343007e0f272 100644 --- a/packages/babel-plugin-transform-runtime/test/fixtures/use-options/useESModules-mjs/output.mjs +++ b/packages/babel-plugin-transform-runtime/test/fixtures/use-options/useESModules-mjs/output.mjs @@ -1,17 +1,21 @@ import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck"; +import _inherits from "@babel/runtime/helpers/esm/inherits"; import _possibleConstructorReturn from "@babel/runtime/helpers/esm/possibleConstructorReturn"; import _getPrototypeOf from "@babel/runtime/helpers/esm/getPrototypeOf"; -import _inherits from "@babel/runtime/helpers/esm/inherits"; -let Foo = -/*#__PURE__*/ -function (_Bar) { +function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function () { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } + +function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } + +let Foo = /*#__PURE__*/function (_Bar) { _inherits(Foo, _Bar); + var _super = _createSuper(Foo); + function Foo() { _classCallCheck(this, Foo); - return _possibleConstructorReturn(this, _getPrototypeOf(Foo).apply(this, arguments)); + return _super.apply(this, arguments); } return Foo; diff --git a/packages/babel-plugin-transform-runtime/test/fixtures/windows/absoluteRuntime/input.js b/packages/babel-plugin-transform-runtime/test/fixtures/windows/absoluteRuntime/input.js new file mode 100644 index 000000000000..42f8907ec4c7 --- /dev/null +++ b/packages/babel-plugin-transform-runtime/test/fixtures/windows/absoluteRuntime/input.js @@ -0,0 +1,9 @@ +async function test () { + console.log('test') +} + +async function main () { + console.log(await test()) +} + +main() diff --git a/packages/babel-plugin-transform-runtime/test/fixtures/windows/absoluteRuntime/options.json b/packages/babel-plugin-transform-runtime/test/fixtures/windows/absoluteRuntime/options.json new file mode 100644 index 000000000000..de2d6991e33e --- /dev/null +++ b/packages/babel-plugin-transform-runtime/test/fixtures/windows/absoluteRuntime/options.json @@ -0,0 +1,23 @@ +{ + "presets": [ + [ + "@babel/preset-env", + { + "corejs": 3, + "useBuiltIns": "entry" + } + ] + ], + "plugins": [ + [ + "transform-runtime", + { + "regenerator": false, + "corejs": false, + "helpers": true, + "useESModules": true, + "absoluteRuntime": true + } + ] + ] +} diff --git a/packages/babel-plugin-transform-runtime/test/fixtures/windows/absoluteRuntime/output.js b/packages/babel-plugin-transform-runtime/test/fixtures/windows/absoluteRuntime/output.js new file mode 100644 index 000000000000..323f1271c204 --- /dev/null +++ b/packages/babel-plugin-transform-runtime/test/fixtures/windows/absoluteRuntime/output.js @@ -0,0 +1,54 @@ +var _asyncToGenerator = require("/packages/babel-plugin-transform-runtime/node_modules/@babel/runtime/helpers/asyncToGenerator"); + +function test() { + return _test.apply(this, arguments); +} + +function _test() { + _test = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() { + return regeneratorRuntime.wrap(function _callee$(_context) { + while (1) { + switch (_context.prev = _context.next) { + case 0: + console.log('test'); + + case 1: + case "end": + return _context.stop(); + } + } + }, _callee); + })); + return _test.apply(this, arguments); +} + +function main() { + return _main.apply(this, arguments); +} + +function _main() { + _main = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2() { + return regeneratorRuntime.wrap(function _callee2$(_context2) { + while (1) { + switch (_context2.prev = _context2.next) { + case 0: + _context2.t0 = console; + _context2.next = 3; + return test(); + + case 3: + _context2.t1 = _context2.sent; + + _context2.t0.log.call(_context2.t0, _context2.t1); + + case 5: + case "end": + return _context2.stop(); + } + } + }, _callee2); + })); + return _main.apply(this, arguments); +} + +main(); diff --git a/packages/babel-plugin-transform-runtime/test/fixtures/windows/options.json b/packages/babel-plugin-transform-runtime/test/fixtures/windows/options.json new file mode 100644 index 000000000000..2163a20634fe --- /dev/null +++ b/packages/babel-plugin-transform-runtime/test/fixtures/windows/options.json @@ -0,0 +1,3 @@ +{ + "os": ["win32"] +} diff --git a/packages/babel-plugin-transform-shorthand-properties/package.json b/packages/babel-plugin-transform-shorthand-properties/package.json index 5233742c2adf..52df3edbf670 100644 --- a/packages/babel-plugin-transform-shorthand-properties/package.json +++ b/packages/babel-plugin-transform-shorthand-properties/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-transform-shorthand-properties", - "version": "7.2.0", + "version": "7.8.3", "description": "Compile ES2015 shorthand properties to ES5", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-shorthand-properties", "license": "MIT", @@ -12,13 +12,13 @@ "babel-plugin" ], "dependencies": { - "@babel/helper-plugin-utils": "^7.0.0" + "@babel/helper-plugin-utils": "^7.8.3" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.2.0", - "@babel/helper-plugin-test-runner": "^7.0.0" + "@babel/core": "^7.8.3", + "@babel/helper-plugin-test-runner": "^7.8.3" } } diff --git a/packages/babel-plugin-transform-spread/package.json b/packages/babel-plugin-transform-spread/package.json index 5c051240523d..1bcfe9a81492 100644 --- a/packages/babel-plugin-transform-spread/package.json +++ b/packages/babel-plugin-transform-spread/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-transform-spread", - "version": "7.2.2", + "version": "7.8.3", "description": "Compile ES2015 spread to ES5", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-spread", "license": "MIT", @@ -12,13 +12,13 @@ "babel-plugin" ], "dependencies": { - "@babel/helper-plugin-utils": "^7.0.0" + "@babel/helper-plugin-utils": "^7.8.3" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.2.2", - "@babel/helper-plugin-test-runner": "^7.0.0" + "@babel/core": "^7.8.3", + "@babel/helper-plugin-test-runner": "^7.8.3" } } diff --git a/packages/babel-plugin-transform-spread/test/fixtures/regression/10416/input.mjs b/packages/babel-plugin-transform-spread/test/fixtures/regression/10416/input.mjs new file mode 100644 index 000000000000..9aed42e1cc6c --- /dev/null +++ b/packages/babel-plugin-transform-spread/test/fixtures/regression/10416/input.mjs @@ -0,0 +1,6 @@ +const E_ARR = []; + +export default function () { + const someVar = E_ARR; + return [...someVar]; +} \ No newline at end of file diff --git a/packages/babel-plugin-transform-spread/test/fixtures/regression/10416/output.mjs b/packages/babel-plugin-transform-spread/test/fixtures/regression/10416/output.mjs new file mode 100644 index 000000000000..9593cc5ad0ba --- /dev/null +++ b/packages/babel-plugin-transform-spread/test/fixtures/regression/10416/output.mjs @@ -0,0 +1,5 @@ +const E_ARR = []; +export default function () { + const someVar = E_ARR; + return babelHelpers.toConsumableArray(someVar); +} diff --git a/packages/babel-plugin-transform-spread/test/fixtures/spread/array-symbol-unsupported/exec.js b/packages/babel-plugin-transform-spread/test/fixtures/spread/array-symbol-unsupported/exec.js new file mode 100644 index 000000000000..93ad0b7a1e33 --- /dev/null +++ b/packages/babel-plugin-transform-spread/test/fixtures/spread/array-symbol-unsupported/exec.js @@ -0,0 +1,10 @@ +var a = (() => [2, 3])(); + +// Simulate old environment +let _Symbol = Symbol; +Symbol = void 0; +try { + expect([1, ...a]).toEqual([1, 2, 3]); +} finally { + Symbol = _Symbol; +} diff --git a/packages/babel-plugin-transform-spread/test/fixtures/spread/array-symbol-unsupported/input.js b/packages/babel-plugin-transform-spread/test/fixtures/spread/array-symbol-unsupported/input.js new file mode 100644 index 000000000000..50d65a58a087 --- /dev/null +++ b/packages/babel-plugin-transform-spread/test/fixtures/spread/array-symbol-unsupported/input.js @@ -0,0 +1,6 @@ +var a = (() => [2, 3])(); + +// !!! In order to run this test, this shouldn't be optimized using type inference +// If it's optimized and doesn't call toConsumableArray, please modify this test +// and exec.js +[1, ...a]; diff --git a/packages/babel-plugin-transform-spread/test/fixtures/spread/array-symbol-unsupported/output.js b/packages/babel-plugin-transform-spread/test/fixtures/spread/array-symbol-unsupported/output.js new file mode 100644 index 000000000000..b4c314291e02 --- /dev/null +++ b/packages/babel-plugin-transform-spread/test/fixtures/spread/array-symbol-unsupported/output.js @@ -0,0 +1,6 @@ +var a = (() => [2, 3])(); // !!! In order to run this test, this shouldn't be optimized using type inference +// If it's optimized and doesn't call toConsumableArray, please modify this test +// and exec.js + + +[1].concat(babelHelpers.toConsumableArray(a)); diff --git a/packages/babel-plugin-transform-spread/test/fixtures/spread/non-iterable/exec.js b/packages/babel-plugin-transform-spread/test/fixtures/spread/non-iterable/exec.js new file mode 100644 index 000000000000..0ff7a4876673 --- /dev/null +++ b/packages/babel-plugin-transform-spread/test/fixtures/spread/non-iterable/exec.js @@ -0,0 +1,10 @@ +var o = {}; + +expect(() => [...undefined]).toThrow(/spread non-iterable/); + +expect(() => [...o]).toThrow(/spread non-iterable/); + +// Simulate old browser +Symbol = void 0; + +expect(() => [...o]).toThrow(/spread non-iterable/); diff --git a/packages/babel-plugin-transform-sticky-regex/package.json b/packages/babel-plugin-transform-sticky-regex/package.json index 0ff694871615..94c8c5c1c39e 100644 --- a/packages/babel-plugin-transform-sticky-regex/package.json +++ b/packages/babel-plugin-transform-sticky-regex/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-transform-sticky-regex", - "version": "7.2.0", + "version": "7.8.3", "description": "Compile ES2015 sticky regex to an ES5 RegExp constructor", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-sticky-regex", "license": "MIT", @@ -12,14 +12,14 @@ "babel-plugin" ], "dependencies": { - "@babel/helper-plugin-utils": "^7.0.0", - "@babel/helper-regex": "^7.0.0" + "@babel/helper-plugin-utils": "^7.8.3", + "@babel/helper-regex": "^7.8.3" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.2.0", - "@babel/helper-plugin-test-runner": "^7.0.0" + "@babel/core": "^7.8.3", + "@babel/helper-plugin-test-runner": "^7.8.3" } } diff --git a/packages/babel-plugin-transform-strict-mode/package.json b/packages/babel-plugin-transform-strict-mode/package.json index bb59d8c74be0..04611071dd64 100644 --- a/packages/babel-plugin-transform-strict-mode/package.json +++ b/packages/babel-plugin-transform-strict-mode/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-transform-strict-mode", - "version": "7.2.0", + "version": "7.8.3", "description": "This plugin places a 'use strict'; directive at the top of all files to enable strict mode", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-strict-mode", "license": "MIT", @@ -12,13 +12,13 @@ "babel-plugin" ], "dependencies": { - "@babel/helper-plugin-utils": "^7.0.0" + "@babel/helper-plugin-utils": "^7.8.3" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.2.0", - "@babel/helper-plugin-test-runner": "^7.0.0" + "@babel/core": "^7.8.3", + "@babel/helper-plugin-test-runner": "^7.8.3" } } diff --git a/packages/babel-plugin-transform-template-literals/package.json b/packages/babel-plugin-transform-template-literals/package.json index 0cf36ea7c2ed..07469e863647 100644 --- a/packages/babel-plugin-transform-template-literals/package.json +++ b/packages/babel-plugin-transform-template-literals/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-transform-template-literals", - "version": "7.4.4", + "version": "7.8.3", "description": "Compile ES2015 template literals to ES5", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-template-literals", "license": "MIT", @@ -9,8 +9,8 @@ }, "main": "lib/index.js", "dependencies": { - "@babel/helper-annotate-as-pure": "^7.0.0", - "@babel/helper-plugin-utils": "^7.0.0" + "@babel/helper-annotate-as-pure": "^7.8.3", + "@babel/helper-plugin-utils": "^7.8.3" }, "keywords": [ "babel-plugin" @@ -19,7 +19,7 @@ "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.4.4", - "@babel/helper-plugin-test-runner": "^7.0.0" + "@babel/core": "^7.8.3", + "@babel/helper-plugin-test-runner": "^7.8.3" } } diff --git a/packages/babel-plugin-transform-typeof-symbol/package.json b/packages/babel-plugin-transform-typeof-symbol/package.json index e893284ebc60..746f74dec649 100644 --- a/packages/babel-plugin-transform-typeof-symbol/package.json +++ b/packages/babel-plugin-transform-typeof-symbol/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-transform-typeof-symbol", - "version": "7.2.0", + "version": "7.8.4", "description": "This transformer wraps all typeof expressions with a method that replicates native behaviour. (ie. returning “symbol” for symbols)", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-typeof-symbol", "license": "MIT", @@ -12,13 +12,17 @@ "babel-plugin" ], "dependencies": { - "@babel/helper-plugin-utils": "^7.0.0" + "@babel/helper-plugin-utils": "^7.8.3" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.2.0", - "@babel/helper-plugin-test-runner": "^7.0.0" + "@babel/core": "^7.8.4", + "@babel/helper-plugin-test-runner": "^7.8.3", + "@babel/runtime": "^7.8.4", + "@babel/runtime-corejs2": "^7.8.4", + "@babel/runtime-corejs3": "^7.8.4", + "resolve": "^1.15.0" } } diff --git a/packages/babel-plugin-transform-typeof-symbol/src/index.js b/packages/babel-plugin-transform-typeof-symbol/src/index.js index b969f216d7c8..1faea61b4b55 100644 --- a/packages/babel-plugin-transform-typeof-symbol/src/index.js +++ b/packages/babel-plugin-transform-typeof-symbol/src/index.js @@ -36,8 +36,23 @@ export default declare(api => { } } + let isUnderHelper = path.findParent(path => { + if (path.isFunction()) { + return ( + path.get("body.directives.0")?.node.value.value === + "@babel/helpers - typeof" + ); + } + }); + + if (isUnderHelper) return; + const helper = this.addHelper("typeof"); - const isUnderHelper = path.findParent(path => { + + // TODO: This is needed for backward compatibility with + // @babel/helpers <= 7.8.3. + // Remove in Babel 8 + isUnderHelper = path.findParent(path => { return ( (path.isVariableDeclarator() && path.node.id === helper) || (path.isFunctionDeclaration() && diff --git a/packages/babel-plugin-transform-typeof-symbol/test/fixtures/symbols/builtin-global/output.mjs b/packages/babel-plugin-transform-typeof-symbol/test/fixtures/symbols/builtin-global/output.mjs index 8b1124c31ba1..35e7d5e1f7bf 100644 --- a/packages/babel-plugin-transform-typeof-symbol/test/fixtures/symbols/builtin-global/output.mjs +++ b/packages/babel-plugin-transform-typeof-symbol/test/fixtures/symbols/builtin-global/output.mjs @@ -1,3 +1,3 @@ -function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function (obj) { return typeof obj; }; } else { _typeof = function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } +function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function (obj) { return typeof obj; }; } else { _typeof = function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } (typeof Reflect === "undefined" ? "undefined" : _typeof(Reflect)) === "object"; diff --git a/packages/babel-plugin-transform-typeof-symbol/test/fixtures/symbols/default-export/output.mjs b/packages/babel-plugin-transform-typeof-symbol/test/fixtures/symbols/default-export/output.mjs index fd697ccdc932..5db84a8c4952 100644 --- a/packages/babel-plugin-transform-typeof-symbol/test/fixtures/symbols/default-export/output.mjs +++ b/packages/babel-plugin-transform-typeof-symbol/test/fixtures/symbols/default-export/output.mjs @@ -1,4 +1,4 @@ -function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function (obj) { return typeof obj; }; } else { _typeof = function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } +function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function (obj) { return typeof obj; }; } else { _typeof = function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } export default function () { _typeof({}) === "object"; diff --git a/packages/babel-plugin-transform-typeof-symbol/test/fixtures/symbols/shadow/output.js b/packages/babel-plugin-transform-typeof-symbol/test/fixtures/symbols/shadow/output.js index fc5cee7b35ab..05b5e743592f 100644 --- a/packages/babel-plugin-transform-typeof-symbol/test/fixtures/symbols/shadow/output.js +++ b/packages/babel-plugin-transform-typeof-symbol/test/fixtures/symbols/shadow/output.js @@ -1,4 +1,4 @@ -function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function (obj) { return typeof obj; }; } else { _typeof = function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } +function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function (obj) { return typeof obj; }; } else { _typeof = function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } var _Symbol = foo(); diff --git a/packages/babel-plugin-transform-typeof-symbol/test/helper.spec.js b/packages/babel-plugin-transform-typeof-symbol/test/helper.spec.js new file mode 100644 index 000000000000..9a89884a3c5f --- /dev/null +++ b/packages/babel-plugin-transform-typeof-symbol/test/helper.spec.js @@ -0,0 +1,52 @@ +import * as babel from "@babel/core"; +import resolvePath from "resolve"; +import fs from "fs"; + +import transformTypeofSymbol from ".."; + +const resolve = path => + new Promise((resolve, reject) => + resolvePath(path, (err, path) => (err ? reject(err) : resolve(path))), + ); +const readFile = path => + new Promise((resolve, reject) => + fs.readFile(path, "utf8", (err, contents) => { + if (err) reject(err); + else resolve(contents); + }), + ); + +describe("@babel/plugin-transform-typeof-symbol", () => { + test.each` + runtime | type + ${"@babel/runtime"} | ${"esm"} + ${"@babel/runtime"} | ${"cjs"} + ${"@babel/runtime-corejs2"} | ${"esm"} + ${"@babel/runtime-corejs2"} | ${"cjs"} + ${"@babel/runtime-corejs3"} | ${"esm"} + ${"@babel/runtime-corejs3"} | ${"cjs"} + `( + "shouldn't transpile the $type $runtime helper", + async ({ type, runtime }) => { + const path = await resolve( + `${runtime}/helpers${type === "esm" ? "/esm/" : "/"}typeof`, + ); + const src = await readFile(path); + + const ast = babel.parseSync(src, { + configFile: false, + sourceType: type === "esm" ? "module" : "script", + }); + + const withPlugin = babel.transformFromAstSync(ast, src, { + configFile: false, + plugins: [transformTypeofSymbol], + }); + const withoutPlugin = babel.transformFromAstSync(ast, src, { + configFile: false, + }); + + expect(withPlugin.code).toBe(withoutPlugin.code); + }, + ); +}); diff --git a/packages/babel-plugin-transform-typescript/package.json b/packages/babel-plugin-transform-typescript/package.json index 7f146e81339b..9f589f4879ff 100644 --- a/packages/babel-plugin-transform-typescript/package.json +++ b/packages/babel-plugin-transform-typescript/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-transform-typescript", - "version": "7.5.5", + "version": "7.9.4", "description": "Transform TypeScript into ES.next", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-typescript", "license": "MIT", @@ -13,15 +13,15 @@ "typescript" ], "dependencies": { - "@babel/helper-create-class-features-plugin": "^7.5.5", - "@babel/helper-plugin-utils": "^7.0.0", - "@babel/plugin-syntax-typescript": "^7.2.0" + "@babel/helper-create-class-features-plugin": "^7.8.3", + "@babel/helper-plugin-utils": "^7.8.3", + "@babel/plugin-syntax-typescript": "^7.8.3" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.5.5", - "@babel/helper-plugin-test-runner": "^7.0.0" + "@babel/core": "^7.9.0", + "@babel/helper-plugin-test-runner": "^7.8.3" } } diff --git a/packages/babel-plugin-transform-typescript/src/enum.js b/packages/babel-plugin-transform-typescript/src/enum.js index 11c7b5376d83..808f2fcf499f 100644 --- a/packages/babel-plugin-transform-typescript/src/enum.js +++ b/packages/babel-plugin-transform-typescript/src/enum.js @@ -3,15 +3,15 @@ import { template } from "@babel/core"; export default function transpileEnum(path, t) { const { node } = path; + if (node.const) { + throw path.buildCodeFrameError("'const' enums are not supported."); + } + if (node.declare) { path.remove(); return; } - if (node.const) { - throw path.buildCodeFrameError("'const' enums are not supported."); - } - const name = node.id.name; const fill = enumFill(path, t, node.id); @@ -144,13 +144,12 @@ function evaluate( expr, seen: PreviousEnumMembers, ): number | string | typeof undefined { - if (expr.type === "StringLiteral") { - return expr.value; - } return evalConstant(expr); function evalConstant(expr): number | typeof undefined { switch (expr.type) { + case "StringLiteral": + return expr.value; case "UnaryExpression": return evalUnaryExpression(expr); case "BinaryExpression": @@ -161,6 +160,11 @@ function evaluate( return evalConstant(expr.expression); case "Identifier": return seen[expr.name]; + case "TemplateLiteral": + if (expr.quasis.length === 1) { + return expr.quasis[0].value.cooked; + } + /* falls through */ default: return undefined; } diff --git a/packages/babel-plugin-transform-typescript/src/index.js b/packages/babel-plugin-transform-typescript/src/index.js index c89e2dbe8185..f53a1e343715 100644 --- a/packages/babel-plugin-transform-typescript/src/index.js +++ b/packages/babel-plugin-transform-typescript/src/index.js @@ -44,11 +44,104 @@ function registerGlobalType(programScope, name) { } export default declare( - (api, { jsxPragma = "React", allowNamespaces = false }) => { + ( + api, + { + jsxPragma = "React", + allowNamespaces = false, + allowDeclareFields = false, + onlyRemoveTypeImports = false, + }, + ) => { api.assertVersion(7); const JSX_ANNOTATION_REGEX = /\*?\s*@jsx\s+([^\s]+)/; + const classMemberVisitors = { + field(path) { + const { node } = path; + + if (!allowDeclareFields && node.declare) { + throw path.buildCodeFrameError( + `The 'declare' modifier is only allowed when the 'allowDeclareFields' option of ` + + `@babel/plugin-transform-typescript or @babel/preset-typescript is enabled.`, + ); + } + if (node.definite || node.declare) { + if (node.value) { + throw path.buildCodeFrameError( + `Definietly assigned fields and fields with the 'declare' modifier cannot` + + ` be initialized here, but only in the constructor`, + ); + } + + if (!node.decorators) { + path.remove(); + } + } else if ( + !allowDeclareFields && + !node.value && + !node.decorators && + !t.isClassPrivateProperty(node) + ) { + path.remove(); + } + + if (node.accessibility) node.accessibility = null; + if (node.abstract) node.abstract = null; + if (node.readonly) node.readonly = null; + if (node.optional) node.optional = null; + if (node.typeAnnotation) node.typeAnnotation = null; + if (node.definite) node.definite = null; + }, + method({ node }) { + if (node.accessibility) node.accessibility = null; + if (node.abstract) node.abstract = null; + if (node.optional) node.optional = null; + + // Rest handled by Function visitor + }, + constructor(path, classPath) { + if (path.node.accessibility) path.node.accessibility = null; + // Collects parameter properties so that we can add an assignment + // for each of them in the constructor body + // + // We use a WeakSet to ensure an assignment for a parameter + // property is only added once. This is necessary for cases like + // using `transform-classes`, which causes this visitor to run + // twice. + const parameterProperties = []; + for (const param of path.node.params) { + if ( + param.type === "TSParameterProperty" && + !PARSED_PARAMS.has(param.parameter) + ) { + PARSED_PARAMS.add(param.parameter); + parameterProperties.push(param.parameter); + } + } + + if (parameterProperties.length) { + const assigns = parameterProperties.map(p => { + let id; + if (t.isIdentifier(p)) { + id = p; + } else if (t.isAssignmentPattern(p) && t.isIdentifier(p.left)) { + id = p.left; + } else { + throw path.buildCodeFrameError( + "Parameter properties can not be destructuring patterns.", + ); + } + + return template.statement.ast`this.${id} = ${id}`; + }); + + injectInitialization(classPath, path, assigns); + } + }, + }; + return { name: "transform-typescript", inherits: syntaxTypeScript, @@ -79,43 +172,52 @@ export default declare( // remove type imports for (let stmt of path.get("body")) { if (t.isImportDeclaration(stmt)) { - // Note: this will allow both `import { } from "m"` and `import "m";`. - // In TypeScript, the former would be elided. - if (stmt.node.specifiers.length === 0) { + if (stmt.node.importKind === "type") { + stmt.remove(); continue; } - let allElided = true; - const importsToRemove: Path[] = []; - - for (const specifier of stmt.node.specifiers) { - const binding = stmt.scope.getBinding(specifier.local.name); - - // The binding may not exist if the import node was explicitly - // injected by another plugin. Currently core does not do a good job - // of keeping scope bindings synchronized with the AST. For now we - // just bail if there is no binding, since chances are good that if - // the import statement was injected then it wasn't a typescript type - // import anyway. - if ( - binding && - isImportTypeOnly({ - binding, - programPath: path, - jsxPragma: fileJsxPragma || jsxPragma, - }) - ) { - importsToRemove.push(binding.path); - } else { - allElided = false; + // If onlyRemoveTypeImports is `true`, only remove type-only imports + // and exports introduced in TypeScript 3.8. + if (!onlyRemoveTypeImports) { + // Note: this will allow both `import { } from "m"` and `import "m";`. + // In TypeScript, the former would be elided. + if (stmt.node.specifiers.length === 0) { + continue; } - } - if (allElided) { - stmt.remove(); - } else { - for (const importPath of importsToRemove) { - importPath.remove(); + let allElided = true; + const importsToRemove: Path[] = []; + + for (const specifier of stmt.node.specifiers) { + const binding = stmt.scope.getBinding(specifier.local.name); + + // The binding may not exist if the import node was explicitly + // injected by another plugin. Currently core does not do a good job + // of keeping scope bindings synchronized with the AST. For now we + // just bail if there is no binding, since chances are good that if + // the import statement was injected then it wasn't a typescript type + // import anyway. + if ( + binding && + isImportTypeOnly({ + binding, + programPath: path, + jsxPragma: fileJsxPragma || jsxPragma, + }) + ) { + importsToRemove.push(binding.path); + } else { + allElided = false; + } + } + + if (allElided) { + stmt.remove(); + } else { + for (const importPath of importsToRemove) { + importPath.remove(); + } } } @@ -145,7 +247,18 @@ export default declare( }, ExportNamedDeclaration(path) { + if (path.node.exportKind === "type") { + path.remove(); + return; + } + // remove export declaration if it's exporting only types + // This logic is needed when exportKind is "value", because + // currently the "type" keyword is optional. + // TODO: + // Also, currently @babel/parser sets exportKind to "value" for + // export interface A {} + // etc. if ( !path.node.source && path.node.specifiers.length > 0 && @@ -192,27 +305,6 @@ export default declare( if (node.definite) node.definite = null; }, - ClassMethod(path) { - const { node } = path; - - if (node.accessibility) node.accessibility = null; - if (node.abstract) node.abstract = null; - if (node.optional) node.optional = null; - - // Rest handled by Function visitor - }, - - ClassProperty(path) { - const { node } = path; - - if (node.accessibility) node.accessibility = null; - if (node.abstract) node.abstract = null; - if (node.readonly) node.readonly = null; - if (node.optional) node.optional = null; - if (node.definite) node.definite = null; - if (node.typeAnnotation) node.typeAnnotation = null; - }, - TSIndexSignature(path) { path.remove(); }, @@ -238,54 +330,17 @@ export default declare( // class transform would transform the class, causing more specific // visitors to not run. path.get("body.body").forEach(child => { - const childNode = child.node; - - if (t.isClassMethod(childNode, { kind: "constructor" })) { - // Collects parameter properties so that we can add an assignment - // for each of them in the constructor body - // - // We use a WeakSet to ensure an assignment for a parameter - // property is only added once. This is necessary for cases like - // using `transform-classes`, which causes this visitor to run - // twice. - const parameterProperties = []; - for (const param of childNode.params) { - if ( - param.type === "TSParameterProperty" && - !PARSED_PARAMS.has(param.parameter) - ) { - PARSED_PARAMS.add(param.parameter); - parameterProperties.push(param.parameter); - } - } - - if (parameterProperties.length) { - const assigns = parameterProperties.map(p => { - let id; - if (t.isIdentifier(p)) { - id = p; - } else if ( - t.isAssignmentPattern(p) && - t.isIdentifier(p.left) - ) { - id = p.left; - } else { - throw path.buildCodeFrameError( - "Parameter properties can not be destructuring patterns.", - ); - } - - return template.statement.ast`this.${id} = ${id}`; - }); - - injectInitialization(path, child, assigns); - } - } else if (child.isClassProperty()) { - childNode.typeAnnotation = null; - - if (!childNode.value && !childNode.decorators) { - child.remove(); + if (child.isClassMethod() || child.isClassPrivateMethod()) { + if (child.node.kind === "constructor") { + classMemberVisitors.constructor(child, path); + } else { + classMemberVisitors.method(child, path); } + } else if ( + child.isClassProperty() || + child.isClassPrivateProperty() + ) { + classMemberVisitors.field(child, path); } }); }, diff --git a/packages/babel-plugin-transform-typescript/test/fixtures/class/abstract-class-decorated-parameter/output.mjs b/packages/babel-plugin-transform-typescript/test/fixtures/class/abstract-class-decorated-parameter/output.mjs index e8982550efbf..58aa80d516ec 100644 --- a/packages/babel-plugin-transform-typescript/test/fixtures/class/abstract-class-decorated-parameter/output.mjs +++ b/packages/babel-plugin-transform-typescript/test/fixtures/class/abstract-class-decorated-parameter/output.mjs @@ -2,7 +2,7 @@ var _class, _descriptor; function _applyDecoratedDescriptor(target, property, decorators, descriptor, context) { var desc = {}; Object.keys(descriptor).forEach(function (key) { desc[key] = descriptor[key]; }); desc.enumerable = !!desc.enumerable; desc.configurable = !!desc.configurable; if ('value' in desc || desc.initializer) { desc.writable = true; } desc = decorators.slice().reverse().reduce(function (desc, decorator) { return decorator(target, property, desc) || desc; }, desc); if (context && desc.initializer !== void 0) { desc.value = desc.initializer ? desc.initializer.call(context) : void 0; desc.initializer = undefined; } if (desc.initializer === void 0) { Object.defineProperty(target, property, desc); desc = null; } return desc; } -function _initializerWarningHelper(descriptor, context) { throw new Error('Decorating class property failed. Please ensure that ' + 'proposal-class-properties is enabled and set to use loose mode. ' + 'To use proposal-class-properties in spec mode with decorators, wait for ' + 'the next major version of decorators in stage 2.'); } +function _initializerWarningHelper(descriptor, context) { throw new Error('Decorating class property failed. Please ensure that ' + 'proposal-class-properties is enabled and runs after the decorators transform.'); } import { observable } from 'mobx'; let Foo = (_class = class Foo { diff --git a/packages/babel-plugin-transform-typescript/test/fixtures/class/declare-not-enabled/input.ts b/packages/babel-plugin-transform-typescript/test/fixtures/class/declare-not-enabled/input.ts new file mode 100644 index 000000000000..3cb9d54665fa --- /dev/null +++ b/packages/babel-plugin-transform-typescript/test/fixtures/class/declare-not-enabled/input.ts @@ -0,0 +1,3 @@ +class A { + declare x; +} diff --git a/packages/babel-plugin-transform-typescript/test/fixtures/class/declare-not-enabled/options.json b/packages/babel-plugin-transform-typescript/test/fixtures/class/declare-not-enabled/options.json new file mode 100644 index 000000000000..c844b0ad736c --- /dev/null +++ b/packages/babel-plugin-transform-typescript/test/fixtures/class/declare-not-enabled/options.json @@ -0,0 +1,4 @@ +{ + "plugins": ["transform-typescript"], + "throws": "The 'declare' modifier is only allowed when the 'allowDeclareFields' option of @babel/plugin-transform-typescript or @babel/preset-typescript is enabled." +} diff --git a/packages/babel-plugin-transform-typescript/test/fixtures/class/declare-not-initialized/input.ts b/packages/babel-plugin-transform-typescript/test/fixtures/class/declare-not-initialized/input.ts new file mode 100644 index 000000000000..c7c42323a390 --- /dev/null +++ b/packages/babel-plugin-transform-typescript/test/fixtures/class/declare-not-initialized/input.ts @@ -0,0 +1,3 @@ +class A { + x; +} \ No newline at end of file diff --git a/packages/babel-plugin-transform-typescript/test/fixtures/class/declare-not-initialized/options.json b/packages/babel-plugin-transform-typescript/test/fixtures/class/declare-not-initialized/options.json new file mode 100644 index 000000000000..a6d406a50e49 --- /dev/null +++ b/packages/babel-plugin-transform-typescript/test/fixtures/class/declare-not-initialized/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["transform-typescript", { "allowDeclareFields": true }]] +} diff --git a/packages/babel-plugin-transform-typescript/test/fixtures/class/declare-not-initialized/output.js b/packages/babel-plugin-transform-typescript/test/fixtures/class/declare-not-initialized/output.js new file mode 100644 index 000000000000..eebf5c5c33db --- /dev/null +++ b/packages/babel-plugin-transform-typescript/test/fixtures/class/declare-not-initialized/output.js @@ -0,0 +1,3 @@ +class A { + x; +} diff --git a/packages/babel-plugin-transform-typescript/test/fixtures/class/declare/input.ts b/packages/babel-plugin-transform-typescript/test/fixtures/class/declare/input.ts new file mode 100644 index 000000000000..7ab37b71fb39 --- /dev/null +++ b/packages/babel-plugin-transform-typescript/test/fixtures/class/declare/input.ts @@ -0,0 +1,3 @@ +class A { + declare x; +} \ No newline at end of file diff --git a/packages/babel-plugin-transform-typescript/test/fixtures/class/declare/options.json b/packages/babel-plugin-transform-typescript/test/fixtures/class/declare/options.json new file mode 100644 index 000000000000..a6d406a50e49 --- /dev/null +++ b/packages/babel-plugin-transform-typescript/test/fixtures/class/declare/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["transform-typescript", { "allowDeclareFields": true }]] +} diff --git a/packages/babel-plugin-transform-typescript/test/fixtures/class/declare/output.js b/packages/babel-plugin-transform-typescript/test/fixtures/class/declare/output.js new file mode 100644 index 000000000000..a869c2849526 --- /dev/null +++ b/packages/babel-plugin-transform-typescript/test/fixtures/class/declare/output.js @@ -0,0 +1 @@ +class A {} diff --git a/packages/babel-plugin-transform-typescript/test/fixtures/class/methods/input.ts b/packages/babel-plugin-transform-typescript/test/fixtures/class/methods/input.ts index 35f255f2b23e..8c8966cecd3f 100644 --- a/packages/babel-plugin-transform-typescript/test/fixtures/class/methods/input.ts +++ b/packages/babel-plugin-transform-typescript/test/fixtures/class/methods/input.ts @@ -1,4 +1,6 @@ class C { + #m(x: number): void {} m(): void; public m(x?: number, ...y: number[]): void {} + public constructor() {} } diff --git a/packages/babel-plugin-transform-typescript/test/fixtures/class/methods/options.json b/packages/babel-plugin-transform-typescript/test/fixtures/class/methods/options.json new file mode 100644 index 000000000000..9d466a3f3fbd --- /dev/null +++ b/packages/babel-plugin-transform-typescript/test/fixtures/class/methods/options.json @@ -0,0 +1,6 @@ +{ + "plugins": [ + "transform-typescript", + "syntax-class-properties" + ] +} diff --git a/packages/babel-plugin-transform-typescript/test/fixtures/class/methods/output.js b/packages/babel-plugin-transform-typescript/test/fixtures/class/methods/output.js index cb6e585efbb4..701c92d9ed0b 100644 --- a/packages/babel-plugin-transform-typescript/test/fixtures/class/methods/output.js +++ b/packages/babel-plugin-transform-typescript/test/fixtures/class/methods/output.js @@ -1,4 +1,8 @@ class C { + #m(x) {} + m(x, ...y) {} + constructor() {} + } diff --git a/packages/babel-plugin-transform-typescript/test/fixtures/class/parameter-properties-with-class-and-super/output.js b/packages/babel-plugin-transform-typescript/test/fixtures/class/parameter-properties-with-class-and-super/output.js index 0d266ddf94e6..dedd029922f6 100644 --- a/packages/babel-plugin-transform-typescript/test/fixtures/class/parameter-properties-with-class-and-super/output.js +++ b/packages/babel-plugin-transform-typescript/test/fixtures/class/parameter-properties-with-class-and-super/output.js @@ -1,28 +1,32 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } + +function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } + +function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function () { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } + function _possibleConstructorReturn(self, call) { if (call && (typeof call === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } -function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } +function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } - -function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } +function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } -let Employee = -/*#__PURE__*/ -function (_Person) { +let Employee = /*#__PURE__*/function (_Person) { "use strict"; _inherits(Employee, _Person); + var _super = _createSuper(Employee); + function Employee(name) { var _this; _classCallCheck(this, Employee); - _this = _possibleConstructorReturn(this, _getPrototypeOf(Employee).call(this)); + _this = _super.call(this); _this.name = name; return _this; } diff --git a/packages/babel-plugin-transform-typescript/test/fixtures/class/parameter-properties-with-class/output.js b/packages/babel-plugin-transform-typescript/test/fixtures/class/parameter-properties-with-class/output.js index d59f465ff951..51dac97b4e31 100644 --- a/packages/babel-plugin-transform-typescript/test/fixtures/class/parameter-properties-with-class/output.js +++ b/packages/babel-plugin-transform-typescript/test/fixtures/class/parameter-properties-with-class/output.js @@ -1,8 +1,6 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } -let Person = -/*#__PURE__*/ -function () { +let Person = /*#__PURE__*/function () { "use strict"; function Person(name) { diff --git a/packages/babel-plugin-transform-typescript/test/fixtures/class/properties/input.ts b/packages/babel-plugin-transform-typescript/test/fixtures/class/properties/input.ts index abb53ac69bc3..02769c7faa21 100644 --- a/packages/babel-plugin-transform-typescript/test/fixtures/class/properties/input.ts +++ b/packages/babel-plugin-transform-typescript/test/fixtures/class/properties/input.ts @@ -1,7 +1,11 @@ class C { public a?: number; private b: number = 0; - readonly c!: number = 1; + readonly c: number = 1; @foo d: number; @foo e: number = 3; + f!: number; + @foo g!: number; + #h: string; + #i: number = 10; } diff --git a/packages/babel-plugin-transform-typescript/test/fixtures/class/properties/options.json b/packages/babel-plugin-transform-typescript/test/fixtures/class/properties/options.json index 14b2876dc1cf..a3d66ed683ba 100644 --- a/packages/babel-plugin-transform-typescript/test/fixtures/class/properties/options.json +++ b/packages/babel-plugin-transform-typescript/test/fixtures/class/properties/options.json @@ -1,3 +1,7 @@ { - "plugins": ["transform-typescript", ["syntax-decorators", { "legacy": true }]] + "plugins": [ + "transform-typescript", + ["syntax-decorators", { "legacy": true }], + "syntax-class-properties" + ] } diff --git a/packages/babel-plugin-transform-typescript/test/fixtures/class/properties/output.js b/packages/babel-plugin-transform-typescript/test/fixtures/class/properties/output.js index 8dd079732dbc..139775da655a 100644 --- a/packages/babel-plugin-transform-typescript/test/fixtures/class/properties/output.js +++ b/packages/babel-plugin-transform-typescript/test/fixtures/class/properties/output.js @@ -5,4 +5,8 @@ class C { d; @foo e = 3; + @foo + g; + #h; + #i = 10; } diff --git a/packages/babel-plugin-transform-typescript/test/fixtures/class/transform-properties-declare-wrong-order/input.ts b/packages/babel-plugin-transform-typescript/test/fixtures/class/transform-properties-declare-wrong-order/input.ts new file mode 100644 index 000000000000..afc220470140 --- /dev/null +++ b/packages/babel-plugin-transform-typescript/test/fixtures/class/transform-properties-declare-wrong-order/input.ts @@ -0,0 +1,4 @@ +class A { + declare x; + y; +} \ No newline at end of file diff --git a/packages/babel-plugin-transform-typescript/test/fixtures/class/transform-properties-declare-wrong-order/options.json b/packages/babel-plugin-transform-typescript/test/fixtures/class/transform-properties-declare-wrong-order/options.json new file mode 100644 index 000000000000..8a07f1cc2003 --- /dev/null +++ b/packages/babel-plugin-transform-typescript/test/fixtures/class/transform-properties-declare-wrong-order/options.json @@ -0,0 +1,7 @@ +{ + "plugins": [ + "proposal-class-properties", + ["transform-typescript", { "allowDeclareFields": true }] + ], + "throws": "TypeScript 'declare' fields must first be transformed by @babel/plugin-transform-typescript.\nIf you have already enabled that plugin (or '@babel/preset-typescript'), make sure that it runs before any plugin related to additional class features:\n - @babel/plugin-proposal-class-properties\n - @babel/plugin-proposal-private-methods\n - @babel/plugin-proposal-decorators" +} diff --git a/packages/babel-plugin-transform-typescript/test/fixtures/class/transform-properties-declare/input.ts b/packages/babel-plugin-transform-typescript/test/fixtures/class/transform-properties-declare/input.ts new file mode 100644 index 000000000000..afc220470140 --- /dev/null +++ b/packages/babel-plugin-transform-typescript/test/fixtures/class/transform-properties-declare/input.ts @@ -0,0 +1,4 @@ +class A { + declare x; + y; +} \ No newline at end of file diff --git a/packages/babel-plugin-transform-typescript/test/fixtures/class/transform-properties-declare/options.json b/packages/babel-plugin-transform-typescript/test/fixtures/class/transform-properties-declare/options.json new file mode 100644 index 000000000000..832ece64097b --- /dev/null +++ b/packages/babel-plugin-transform-typescript/test/fixtures/class/transform-properties-declare/options.json @@ -0,0 +1,6 @@ +{ + "plugins": [ + ["transform-typescript", { "allowDeclareFields": true }], + "proposal-class-properties" + ] +} diff --git a/packages/babel-plugin-transform-typescript/test/fixtures/class/transform-properties-declare/output.js b/packages/babel-plugin-transform-typescript/test/fixtures/class/transform-properties-declare/output.js new file mode 100644 index 000000000000..44b56f160013 --- /dev/null +++ b/packages/babel-plugin-transform-typescript/test/fixtures/class/transform-properties-declare/output.js @@ -0,0 +1,8 @@ +function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } + +class A { + constructor() { + _defineProperty(this, "y", void 0); + } + +} diff --git a/packages/babel-plugin-transform-typescript/test/fixtures/class/uninitialized-definite-with-declare-enabled/input.ts b/packages/babel-plugin-transform-typescript/test/fixtures/class/uninitialized-definite-with-declare-enabled/input.ts new file mode 100644 index 000000000000..4bb8da7936c6 --- /dev/null +++ b/packages/babel-plugin-transform-typescript/test/fixtures/class/uninitialized-definite-with-declare-enabled/input.ts @@ -0,0 +1,3 @@ +class A { + x!; +} \ No newline at end of file diff --git a/packages/babel-plugin-transform-typescript/test/fixtures/class/uninitialized-definite-with-declare-enabled/options.json b/packages/babel-plugin-transform-typescript/test/fixtures/class/uninitialized-definite-with-declare-enabled/options.json new file mode 100644 index 000000000000..a6d406a50e49 --- /dev/null +++ b/packages/babel-plugin-transform-typescript/test/fixtures/class/uninitialized-definite-with-declare-enabled/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["transform-typescript", { "allowDeclareFields": true }]] +} diff --git a/packages/babel-plugin-transform-typescript/test/fixtures/class/uninitialized-definite-with-declare-enabled/output.js b/packages/babel-plugin-transform-typescript/test/fixtures/class/uninitialized-definite-with-declare-enabled/output.js new file mode 100644 index 000000000000..a869c2849526 --- /dev/null +++ b/packages/babel-plugin-transform-typescript/test/fixtures/class/uninitialized-definite-with-declare-enabled/output.js @@ -0,0 +1 @@ +class A {} diff --git a/packages/babel-plugin-transform-typescript/test/fixtures/declarations/const-enum/input.ts b/packages/babel-plugin-transform-typescript/test/fixtures/declarations/const-enum/input.ts new file mode 100644 index 000000000000..4a3fc75be0db --- /dev/null +++ b/packages/babel-plugin-transform-typescript/test/fixtures/declarations/const-enum/input.ts @@ -0,0 +1 @@ +declare const enum E {} diff --git a/packages/babel-plugin-transform-typescript/test/fixtures/declarations/const-enum/options.json b/packages/babel-plugin-transform-typescript/test/fixtures/declarations/const-enum/options.json new file mode 100644 index 000000000000..26f55acbbd35 --- /dev/null +++ b/packages/babel-plugin-transform-typescript/test/fixtures/declarations/const-enum/options.json @@ -0,0 +1 @@ +{ "throws": "'const' enums are not supported." } diff --git a/packages/babel-plugin-transform-typescript/test/fixtures/enum/string-value-template/input.ts b/packages/babel-plugin-transform-typescript/test/fixtures/enum/string-value-template/input.ts new file mode 100644 index 000000000000..01086419eaff --- /dev/null +++ b/packages/babel-plugin-transform-typescript/test/fixtures/enum/string-value-template/input.ts @@ -0,0 +1,3 @@ +enum E { + A = `Hey` +} diff --git a/packages/babel-plugin-transform-typescript/test/fixtures/enum/string-value-template/output.js b/packages/babel-plugin-transform-typescript/test/fixtures/enum/string-value-template/output.js new file mode 100644 index 000000000000..dfc0f72fcd49 --- /dev/null +++ b/packages/babel-plugin-transform-typescript/test/fixtures/enum/string-value-template/output.js @@ -0,0 +1,5 @@ +var E; + +(function (E) { + E["A"] = "Hey"; +})(E || (E = {})); diff --git a/packages/babel-plugin-transform-typescript/test/fixtures/enum/string-values/input.ts b/packages/babel-plugin-transform-typescript/test/fixtures/enum/string-value/input.ts similarity index 100% rename from packages/babel-plugin-transform-typescript/test/fixtures/enum/string-values/input.ts rename to packages/babel-plugin-transform-typescript/test/fixtures/enum/string-value/input.ts diff --git a/packages/babel-plugin-transform-typescript/test/fixtures/enum/string-values/output.js b/packages/babel-plugin-transform-typescript/test/fixtures/enum/string-value/output.js similarity index 100% rename from packages/babel-plugin-transform-typescript/test/fixtures/enum/string-values/output.js rename to packages/babel-plugin-transform-typescript/test/fixtures/enum/string-value/output.js diff --git a/packages/babel-plugin-transform-typescript/test/fixtures/enum/string-values-computed/input.ts b/packages/babel-plugin-transform-typescript/test/fixtures/enum/string-values-computed/input.ts index ac52806fb927..06e9b00f0682 100644 --- a/packages/babel-plugin-transform-typescript/test/fixtures/enum/string-values-computed/input.ts +++ b/packages/babel-plugin-transform-typescript/test/fixtures/enum/string-values-computed/input.ts @@ -1,4 +1,3 @@ -// Not type-correct code enum E { A = "HALLO" + "WERLD" } diff --git a/packages/babel-plugin-transform-typescript/test/fixtures/enum/string-values-computed/output.js b/packages/babel-plugin-transform-typescript/test/fixtures/enum/string-values-computed/output.js index e449a1ca233d..a0f3ea2ca81f 100644 --- a/packages/babel-plugin-transform-typescript/test/fixtures/enum/string-values-computed/output.js +++ b/packages/babel-plugin-transform-typescript/test/fixtures/enum/string-values-computed/output.js @@ -1,6 +1,5 @@ -// Not type-correct code var E; (function (E) { - E[E["A"] = "HALLO" + "WERLD"] = "A"; + E["A"] = "HALLOWERLD"; })(E || (E = {})); diff --git a/packages/babel-plugin-transform-typescript/test/fixtures/exports/export-type-from/input.ts b/packages/babel-plugin-transform-typescript/test/fixtures/exports/export-type-from/input.ts new file mode 100644 index 000000000000..d49327a766e3 --- /dev/null +++ b/packages/babel-plugin-transform-typescript/test/fixtures/exports/export-type-from/input.ts @@ -0,0 +1,2 @@ +export type { A } from "./mod"; +; diff --git a/packages/babel-plugin-transform-typescript/test/fixtures/exports/export-type-from/output.mjs b/packages/babel-plugin-transform-typescript/test/fixtures/exports/export-type-from/output.mjs new file mode 100644 index 000000000000..092bc2b04126 --- /dev/null +++ b/packages/babel-plugin-transform-typescript/test/fixtures/exports/export-type-from/output.mjs @@ -0,0 +1 @@ +; diff --git a/packages/babel-plugin-transform-typescript/test/fixtures/exports/export-type/input.ts b/packages/babel-plugin-transform-typescript/test/fixtures/exports/export-type/input.ts new file mode 100644 index 000000000000..4a7f4367fecb --- /dev/null +++ b/packages/babel-plugin-transform-typescript/test/fixtures/exports/export-type/input.ts @@ -0,0 +1,4 @@ +type A = 2; + +export type { A }; +; diff --git a/packages/babel-plugin-transform-typescript/test/fixtures/exports/export-type/output.mjs b/packages/babel-plugin-transform-typescript/test/fixtures/exports/export-type/output.mjs new file mode 100644 index 000000000000..092bc2b04126 --- /dev/null +++ b/packages/babel-plugin-transform-typescript/test/fixtures/exports/export-type/output.mjs @@ -0,0 +1 @@ +; diff --git a/packages/babel-plugin-transform-typescript/test/fixtures/function/overloads-exports/input.mjs b/packages/babel-plugin-transform-typescript/test/fixtures/function/overloads-exports/input.mjs new file mode 100644 index 000000000000..d2e9958f6aaf --- /dev/null +++ b/packages/babel-plugin-transform-typescript/test/fixtures/function/overloads-exports/input.mjs @@ -0,0 +1,4 @@ +function f(): void; +function f(): void { +} +export { f } \ No newline at end of file diff --git a/packages/babel-plugin-transform-typescript/test/fixtures/function/overloads-exports/options.json b/packages/babel-plugin-transform-typescript/test/fixtures/function/overloads-exports/options.json new file mode 100644 index 000000000000..d5e8a7e4201b --- /dev/null +++ b/packages/babel-plugin-transform-typescript/test/fixtures/function/overloads-exports/options.json @@ -0,0 +1,4 @@ +{ + "plugins": ["transform-typescript"], + "sourceType": "module" +} diff --git a/packages/babel-plugin-transform-typescript/test/fixtures/function/overloads-exports/output.mjs b/packages/babel-plugin-transform-typescript/test/fixtures/function/overloads-exports/output.mjs new file mode 100644 index 000000000000..a7997dca3a66 --- /dev/null +++ b/packages/babel-plugin-transform-typescript/test/fixtures/function/overloads-exports/output.mjs @@ -0,0 +1,3 @@ +function f() {} + +export { f }; diff --git a/packages/babel-plugin-transform-typescript/test/fixtures/imports/import-named-type-default-and-named/input.ts b/packages/babel-plugin-transform-typescript/test/fixtures/imports/import-named-type-default-and-named/input.ts new file mode 100644 index 000000000000..64f64cd72b4f --- /dev/null +++ b/packages/babel-plugin-transform-typescript/test/fixtures/imports/import-named-type-default-and-named/input.ts @@ -0,0 +1 @@ +import type, { bar } from 'foo'; diff --git a/packages/babel-plugin-transform-typescript/test/fixtures/imports/import-named-type-default-and-named/options.json b/packages/babel-plugin-transform-typescript/test/fixtures/imports/import-named-type-default-and-named/options.json new file mode 100644 index 000000000000..ce280969f6e9 --- /dev/null +++ b/packages/babel-plugin-transform-typescript/test/fixtures/imports/import-named-type-default-and-named/options.json @@ -0,0 +1,8 @@ +{ + "plugins": [[ + "transform-typescript", + { + "onlyRemoveTypeImports": true + } + ]] +} diff --git a/packages/babel-plugin-transform-typescript/test/fixtures/imports/import-named-type-default-and-named/output.mjs b/packages/babel-plugin-transform-typescript/test/fixtures/imports/import-named-type-default-and-named/output.mjs new file mode 100644 index 000000000000..64f64cd72b4f --- /dev/null +++ b/packages/babel-plugin-transform-typescript/test/fixtures/imports/import-named-type-default-and-named/output.mjs @@ -0,0 +1 @@ +import type, { bar } from 'foo'; diff --git a/packages/babel-plugin-transform-typescript/test/fixtures/imports/import-named-type/input.ts b/packages/babel-plugin-transform-typescript/test/fixtures/imports/import-named-type/input.ts new file mode 100644 index 000000000000..23d4b6f9bc9f --- /dev/null +++ b/packages/babel-plugin-transform-typescript/test/fixtures/imports/import-named-type/input.ts @@ -0,0 +1 @@ +import type from 'foo'; diff --git a/packages/babel-plugin-transform-typescript/test/fixtures/imports/import-named-type/options.json b/packages/babel-plugin-transform-typescript/test/fixtures/imports/import-named-type/options.json new file mode 100644 index 000000000000..ce280969f6e9 --- /dev/null +++ b/packages/babel-plugin-transform-typescript/test/fixtures/imports/import-named-type/options.json @@ -0,0 +1,8 @@ +{ + "plugins": [[ + "transform-typescript", + { + "onlyRemoveTypeImports": true + } + ]] +} diff --git a/packages/babel-plugin-transform-typescript/test/fixtures/imports/import-named-type/output.mjs b/packages/babel-plugin-transform-typescript/test/fixtures/imports/import-named-type/output.mjs new file mode 100644 index 000000000000..23d4b6f9bc9f --- /dev/null +++ b/packages/babel-plugin-transform-typescript/test/fixtures/imports/import-named-type/output.mjs @@ -0,0 +1 @@ +import type from 'foo'; diff --git a/packages/babel-plugin-transform-typescript/test/fixtures/imports/import-removed-exceptions/input.ts b/packages/babel-plugin-transform-typescript/test/fixtures/imports/import-removed-exceptions/input.ts new file mode 100644 index 000000000000..744ae808eaa9 --- /dev/null +++ b/packages/babel-plugin-transform-typescript/test/fixtures/imports/import-removed-exceptions/input.ts @@ -0,0 +1,13 @@ +import a from "a"; +import { b } from "b"; +import { c as c2 } from "c"; +import d, { d2 } from "d"; +import e, { e3 as e4 } from "e"; + +import {} from "f"; +import "g"; + +import type H from "h"; +import type { I, I2 } from "i"; +import type * as J from "j"; +; diff --git a/packages/babel-plugin-transform-typescript/test/fixtures/imports/import-removed-exceptions/output.mjs b/packages/babel-plugin-transform-typescript/test/fixtures/imports/import-removed-exceptions/output.mjs new file mode 100644 index 000000000000..25cfa2dc5c2b --- /dev/null +++ b/packages/babel-plugin-transform-typescript/test/fixtures/imports/import-removed-exceptions/output.mjs @@ -0,0 +1,3 @@ +import "f"; +import "g"; +; diff --git a/packages/babel-plugin-transform-typescript/test/fixtures/imports/import-type-not-removed/input.ts b/packages/babel-plugin-transform-typescript/test/fixtures/imports/import-type-not-removed/input.ts new file mode 100644 index 000000000000..80988c65072d --- /dev/null +++ b/packages/babel-plugin-transform-typescript/test/fixtures/imports/import-type-not-removed/input.ts @@ -0,0 +1,4 @@ +import type A from "x"; +// TODO: This should not be removed +import B from "y"; +; \ No newline at end of file diff --git a/packages/babel-plugin-transform-typescript/test/fixtures/imports/import-type-not-removed/output.mjs b/packages/babel-plugin-transform-typescript/test/fixtures/imports/import-type-not-removed/output.mjs new file mode 100644 index 000000000000..3e83039477c8 --- /dev/null +++ b/packages/babel-plugin-transform-typescript/test/fixtures/imports/import-type-not-removed/output.mjs @@ -0,0 +1,2 @@ +// TODO: This should not be removed +; diff --git a/packages/babel-plugin-transform-typescript/test/fixtures/imports/import-type/input.ts b/packages/babel-plugin-transform-typescript/test/fixtures/imports/import-type/input.ts new file mode 100644 index 000000000000..50348ae13866 --- /dev/null +++ b/packages/babel-plugin-transform-typescript/test/fixtures/imports/import-type/input.ts @@ -0,0 +1,4 @@ +import type T from './mod'; +import type { A, B } from './mod'; +import type * as Types from './mod'; +; \ No newline at end of file diff --git a/packages/babel-plugin-transform-typescript/test/fixtures/imports/import-type/output.mjs b/packages/babel-plugin-transform-typescript/test/fixtures/imports/import-type/output.mjs new file mode 100644 index 000000000000..092bc2b04126 --- /dev/null +++ b/packages/babel-plugin-transform-typescript/test/fixtures/imports/import-type/output.mjs @@ -0,0 +1 @@ +; diff --git a/packages/babel-plugin-transform-typescript/test/fixtures/imports/only-remove-type-imports/input.ts b/packages/babel-plugin-transform-typescript/test/fixtures/imports/only-remove-type-imports/input.ts new file mode 100644 index 000000000000..744ae808eaa9 --- /dev/null +++ b/packages/babel-plugin-transform-typescript/test/fixtures/imports/only-remove-type-imports/input.ts @@ -0,0 +1,13 @@ +import a from "a"; +import { b } from "b"; +import { c as c2 } from "c"; +import d, { d2 } from "d"; +import e, { e3 as e4 } from "e"; + +import {} from "f"; +import "g"; + +import type H from "h"; +import type { I, I2 } from "i"; +import type * as J from "j"; +; diff --git a/packages/babel-plugin-transform-typescript/test/fixtures/imports/only-remove-type-imports/options.json b/packages/babel-plugin-transform-typescript/test/fixtures/imports/only-remove-type-imports/options.json new file mode 100644 index 000000000000..ce280969f6e9 --- /dev/null +++ b/packages/babel-plugin-transform-typescript/test/fixtures/imports/only-remove-type-imports/options.json @@ -0,0 +1,8 @@ +{ + "plugins": [[ + "transform-typescript", + { + "onlyRemoveTypeImports": true + } + ]] +} diff --git a/packages/babel-plugin-transform-typescript/test/fixtures/imports/only-remove-type-imports/output.mjs b/packages/babel-plugin-transform-typescript/test/fixtures/imports/only-remove-type-imports/output.mjs new file mode 100644 index 000000000000..d86475cacac8 --- /dev/null +++ b/packages/babel-plugin-transform-typescript/test/fixtures/imports/only-remove-type-imports/output.mjs @@ -0,0 +1,8 @@ +import a from "a"; +import { b } from "b"; +import { c as c2 } from "c"; +import d, { d2 } from "d"; +import e, { e3 as e4 } from "e"; +import "f"; +import "g"; +; diff --git a/packages/babel-plugin-transform-typescript/test/fixtures/regression/10338/input.ts b/packages/babel-plugin-transform-typescript/test/fixtures/regression/10338/input.ts new file mode 100644 index 000000000000..36a5d899a6e1 --- /dev/null +++ b/packages/babel-plugin-transform-typescript/test/fixtures/regression/10338/input.ts @@ -0,0 +1,4 @@ +const {result} = idArray.reduce( + (a, b) => {}, + {result: [] as (number | bigint)[]}, +) \ No newline at end of file diff --git a/packages/babel-plugin-transform-typescript/test/fixtures/regression/10338/options.json b/packages/babel-plugin-transform-typescript/test/fixtures/regression/10338/options.json new file mode 100644 index 000000000000..c22d3cb0914c --- /dev/null +++ b/packages/babel-plugin-transform-typescript/test/fixtures/regression/10338/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["transform-typescript", "transform-destructuring"] +} diff --git a/packages/babel-plugin-transform-typescript/test/fixtures/regression/10338/output.js b/packages/babel-plugin-transform-typescript/test/fixtures/regression/10338/output.js new file mode 100644 index 000000000000..20db22353cb9 --- /dev/null +++ b/packages/babel-plugin-transform-typescript/test/fixtures/regression/10338/output.js @@ -0,0 +1,4 @@ +const _idArray$reduce = idArray.reduce((a, b) => {}, { + result: [] +}), + result = _idArray$reduce.result; diff --git a/packages/babel-plugin-transform-unicode-regex/package.json b/packages/babel-plugin-transform-unicode-regex/package.json index 32610f9c7d4b..458fe89d0798 100644 --- a/packages/babel-plugin-transform-unicode-regex/package.json +++ b/packages/babel-plugin-transform-unicode-regex/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-transform-unicode-regex", - "version": "7.4.4", + "version": "7.8.3", "description": "Compile ES2015 Unicode regex to ES5", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-unicode-regex", "license": "MIT", @@ -12,15 +12,14 @@ "babel-plugin" ], "dependencies": { - "@babel/helper-plugin-utils": "^7.0.0", - "@babel/helper-regex": "^7.4.4", - "regexpu-core": "^4.5.4" + "@babel/helper-create-regexp-features-plugin": "^7.8.3", + "@babel/helper-plugin-utils": "^7.8.3" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.4.4", - "@babel/helper-plugin-test-runner": "^7.0.0" + "@babel/core": "^7.8.3", + "@babel/helper-plugin-test-runner": "^7.8.3" } } diff --git a/packages/babel-plugin-transform-unicode-regex/src/index.js b/packages/babel-plugin-transform-unicode-regex/src/index.js index 88593e055917..cfc4cd8a40f2 100644 --- a/packages/babel-plugin-transform-unicode-regex/src/index.js +++ b/packages/babel-plugin-transform-unicode-regex/src/index.js @@ -1,19 +1,12 @@ +/* eslint-disable @babel/development/plugin-name */ +import { createRegExpFeaturePlugin } from "@babel/helper-create-regexp-features-plugin"; import { declare } from "@babel/helper-plugin-utils"; -import rewritePattern from "regexpu-core"; -import * as regex from "@babel/helper-regex"; export default declare(api => { api.assertVersion(7); - return { + return createRegExpFeaturePlugin({ name: "transform-unicode-regex", - - visitor: { - RegExpLiteral({ node }) { - if (!regex.is(node, "u")) return; - node.pattern = rewritePattern(node.pattern, node.flags); - regex.pullFlag(node, "u"); - }, - }, - }; + feature: "unicodeFlag", + }); }); diff --git a/packages/babel-polyfill/package.json b/packages/babel-polyfill/package.json index 9fb6d4b92eea..8e9c1c725678 100644 --- a/packages/babel-polyfill/package.json +++ b/packages/babel-polyfill/package.json @@ -1,6 +1,6 @@ { "name": "@babel/polyfill", - "version": "7.4.4", + "version": "7.8.7", "description": "Provides polyfills necessary for a full ES2015+ environment", "author": "Sebastian McKenzie ", "homepage": "https://babeljs.io/", @@ -8,10 +8,14 @@ "publishConfig": { "access": "public" }, + "scripts": { + "prepublishOnly": "cp dist/polyfill.min.js browser.js", + "postpublish": "rm browser.js" + }, "repository": "https://github.com/babel/babel/tree/master/packages/babel-polyfill", "main": "lib/index.js", "dependencies": { "core-js": "^2.6.5", - "regenerator-runtime": "^0.13.2" + "regenerator-runtime": "^0.13.4" } } diff --git a/packages/babel-polyfill/scripts/build-dist.sh b/packages/babel-polyfill/scripts/build-dist.sh index db5b2bd2ed0a..0128c59321c6 100755 --- a/packages/babel-polyfill/scripts/build-dist.sh +++ b/packages/babel-polyfill/scripts/build-dist.sh @@ -12,6 +12,6 @@ node $BROWSERIFY_CMD lib/index.js \ --plugin derequire/plugin \ >dist/polyfill.js node $UGLIFY_CMD dist/polyfill.js \ - --compress keep_fnames,keep_fargs,warnings=false \ + --compress keep_fnames,keep_fargs \ --mangle keep_fnames \ >dist/polyfill.min.js diff --git a/packages/babel-polyfill/scripts/postpublish.js b/packages/babel-polyfill/scripts/postpublish.js deleted file mode 100644 index 57a59218c810..000000000000 --- a/packages/babel-polyfill/scripts/postpublish.js +++ /dev/null @@ -1,8 +0,0 @@ -"use strict"; - -const fs = require("fs"); -const path = require("path"); - -try { - fs.unlinkSync(path.join(__dirname, "../browser.js")); -} catch (err) {} diff --git a/packages/babel-polyfill/scripts/prepublish.js b/packages/babel-polyfill/scripts/prepublish.js deleted file mode 100644 index 84276779f950..000000000000 --- a/packages/babel-polyfill/scripts/prepublish.js +++ /dev/null @@ -1,13 +0,0 @@ -"use strict"; - -const fs = require("fs"); -const path = require("path"); - -function relative(loc) { - return path.join(__dirname, "..", loc); -} - -fs.writeFileSync( - relative("browser.js"), - fs.readFileSync(relative("dist/polyfill.min.js")) -); diff --git a/packages/babel-preset-env-standalone/README.md b/packages/babel-preset-env-standalone/README.md deleted file mode 100644 index 61352bcac5a3..000000000000 --- a/packages/babel-preset-env-standalone/README.md +++ /dev/null @@ -1,19 +0,0 @@ -# @babel/preset-env-standalone - -> Standalone build of babel-prest-env for use in non-Node.js environments. - -See our website [@babel/preset-env-standalone](https://babeljs.io/docs/en/next/babel-preset-env-standalone.html) for more information. - -## Install - -Using npm: - -```sh -npm install --save-dev @babel/preset-env-standalone -``` - -or using yarn: - -```sh -yarn add @babel/preset-env-standalone --dev -``` diff --git a/packages/babel-preset-env-standalone/package.json b/packages/babel-preset-env-standalone/package.json deleted file mode 100644 index 410419bb4d58..000000000000 --- a/packages/babel-preset-env-standalone/package.json +++ /dev/null @@ -1,43 +0,0 @@ -{ - "name": "@babel/preset-env-standalone", - "version": "7.5.5", - "description": "Standalone build of babel-prest-env for use in non-Node.js environments.", - "main": "babel-preset-env.js", - "files": [ - "babel-preset-env.js", - "babel-preset-env.min.js", - "src" - ], - "devDependencies": { - "@babel/plugin-proposal-dynamic-import": "^7.5.0", - "@babel/plugin-proposal-json-strings": "^7.0.0", - "@babel/plugin-transform-named-capturing-groups-regex": "^7.4.5", - "@babel/plugin-transform-new-target": "^7.4.4", - "@babel/preset-env": "^7.5.5", - "@babel/standalone": "^7.5.5" - }, - "keywords": [ - "babel", - "babel-preset-env", - "babeljs", - "6to5", - "transpile", - "preset", - "standalone", - "transpiler" - ], - "license": "MIT", - "publishConfig": { - "access": "public" - }, - "bugs": { - "url": "https://github.com/babel/babel/issues" - }, - "homepage": "https://github.com/babel/babel/packages/babel-preset-env-standalone#readme", - "jest": { - "transformIgnorePatterns": [ - "/node_modules/", - "babel-preset-env.js" - ] - } -} diff --git a/packages/babel-preset-env-standalone/scripts/prepublish.js b/packages/babel-preset-env-standalone/scripts/prepublish.js deleted file mode 100644 index bff650fb032d..000000000000 --- a/packages/babel-preset-env-standalone/scripts/prepublish.js +++ /dev/null @@ -1,11 +0,0 @@ -// This file is executed by lerna before publishing, -// @babel/preset-env-standalone so that it has the -// new version and not the old one. - -require("child_process").execSync( - "make prepublish-build-preset-env-standalone", - { - cwd: require("path").resolve(__dirname, "../../.."), - stdio: "inherit", - } -); diff --git a/packages/babel-preset-env-standalone/src/available-plugins.js b/packages/babel-preset-env-standalone/src/available-plugins.js deleted file mode 100644 index 9d9e68640234..000000000000 --- a/packages/babel-preset-env-standalone/src/available-plugins.js +++ /dev/null @@ -1,16 +0,0 @@ -import { availablePlugins, registerPlugin } from "@babel/standalone"; - -const notIncludedPlugins = { - "transform-named-capturing-groups-regex": require("@babel/plugin-transform-named-capturing-groups-regex"), - "transform-new-target": require("@babel/plugin-transform-new-target"), - "proposal-json-strings": require("@babel/plugin-proposal-json-strings"), - "proposal-dynamic-import": require("@babel/plugin-proposal-dynamic-import"), -}; - -Object.keys(notIncludedPlugins).forEach(pluginName => { - if (!availablePlugins[pluginName]) { - registerPlugin(pluginName, notIncludedPlugins[pluginName]); - } -}); - -export default availablePlugins; diff --git a/packages/babel-preset-env-standalone/src/caniuse-lite-regions.js b/packages/babel-preset-env-standalone/src/caniuse-lite-regions.js deleted file mode 100644 index f053ebf7976e..000000000000 --- a/packages/babel-preset-env-standalone/src/caniuse-lite-regions.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = {}; diff --git a/packages/babel-preset-env-standalone/src/index.js b/packages/babel-preset-env-standalone/src/index.js deleted file mode 100644 index e02ce8176d92..000000000000 --- a/packages/babel-preset-env-standalone/src/index.js +++ /dev/null @@ -1,8 +0,0 @@ -/* global VERSION */ - -import { registerPreset } from "@babel/standalone"; -import babelPresetEnv from "@babel/preset-env"; - -registerPreset("env", babelPresetEnv); - -export const version = VERSION; diff --git a/packages/babel-preset-env-standalone/test/babel-preset-env.js b/packages/babel-preset-env-standalone/test/babel-preset-env.js deleted file mode 100644 index 6ecd097b1404..000000000000 --- a/packages/babel-preset-env-standalone/test/babel-preset-env.js +++ /dev/null @@ -1,63 +0,0 @@ -(process.env.TEST_TYPE === "cov" ? describe.skip : describe)( - "babel-preset-env-standalone", - () => { - const Babel = require("@babel/standalone/babel"); - jest.mock("Babel", () => require("@babel/standalone/babel"), { - virtual: true, - }); - require("../babel-preset-env"); - - it("works w/o targets", () => { - const output = Babel.transform("const a = 1;", { - sourceType: "script", - presets: ["env"], - }).code; - expect(output).toBe("var a = 1;"); - }); - - it("doesn't transpile `const` with chrome 60", () => { - const output = Babel.transform("const a = 1;", { - sourceType: "script", - presets: [ - [ - "env", - { - targets: { - chrome: 60, - }, - }, - ], - ], - }).code; - expect(output).toBe("const a = 1;"); - }); - - it("transpiles `const` with chrome 60 and preset-es2015", () => { - const output = Babel.transform("const a = 1;", { - sourceType: "script", - presets: [ - [ - "env", - { - targets: { - chrome: 60, - }, - }, - ], - "es2015", - ], - }).code; - expect(output).toBe("var a = 1;"); - }); - - it("uses transform-new-targets plugin", () => { - const output = Babel.transform("function Foo() {new.target}", { - sourceType: "script", - presets: ["env"], - }).code; - expect(output).toBe( - "function Foo() {\n this instanceof Foo ? this.constructor : void 0;\n}", - ); - }); - }, -); diff --git a/packages/babel-preset-env/.gitignore b/packages/babel-preset-env/.gitignore index b8733fbb9848..8f638248faad 100644 --- a/packages/babel-preset-env/.gitignore +++ b/packages/babel-preset-env/.gitignore @@ -8,3 +8,4 @@ test/tmp .nyc_output tmp babel-preset-env-*.tgz +/build diff --git a/packages/babel-preset-env/.npmignore b/packages/babel-preset-env/.npmignore index 40425577dea0..23e47c751654 100644 --- a/packages/babel-preset-env/.npmignore +++ b/packages/babel-preset-env/.npmignore @@ -15,3 +15,5 @@ babel-preset-env-*.tgz flow-typed .github .idea +/build +CONTRIBUTING.md diff --git a/packages/babel-preset-env/CONTRIBUTING.md b/packages/babel-preset-env/CONTRIBUTING.md index de861d996e6d..2271a8c74834 100644 --- a/packages/babel-preset-env/CONTRIBUTING.md +++ b/packages/babel-preset-env/CONTRIBUTING.md @@ -2,7 +2,7 @@ ## Adding a new plugin or polyfill to support (when approved in the next ECMAScript version) -### Update [`plugin-features.js`](https://github.com/babel/babel/blob/master/packages/babel-preset-env/data/plugin-features.js) +### Update [`plugin-features.js`](https://github.com/babel/babel/blob/master/packages/babel-compat-data/scripts/data/plugin-features.js) *Example:* @@ -63,25 +63,16 @@ If you want to mark a new proposal as shipped, add it to [this list](https://git ### Update [`plugins.json`](https://github.com/babel/babel/blob/master/packages/babel-preset-env/data/plugins.json) -Until `compat-table` is a standalone npm module for data we are using the git url +Until `compat-table` is a standalone npm module for data we are using the git commit in `packages/babel-compat-data/scripts/download-compat-table.sh` -`"compat-table": "kangax/compat-table#[latest-commit-hash]"`, +`COMPAT_TABLE_COMMIT=[latest-commit-hash]`, So we update and then run `npm run build-data`. If there are no changes, then `plugins.json` will be the same. ## Tests -### Running tests locally - -```bash -npm test -``` - -### Checking code coverage locally - -```bash -npm run coverage -``` +### Running tests +See general [CONTRIBUTING.md](https://github.com/babel/babel/blob/master/CONTRIBUTING.md#running-lintingtests). ### Writing tests diff --git a/packages/babel-preset-env/data/built-in-modules.js b/packages/babel-preset-env/data/built-in-modules.js new file mode 100644 index 000000000000..161ddb8ea7ab --- /dev/null +++ b/packages/babel-preset-env/data/built-in-modules.js @@ -0,0 +1,3 @@ +// TODO: Remove in Babel 8 + +module.exports = require("@babel/compat-data/native-modules"); diff --git a/packages/babel-preset-env/data/built-in-modules.json b/packages/babel-preset-env/data/built-in-modules.json deleted file mode 100644 index 5bada5f51b38..000000000000 --- a/packages/babel-preset-env/data/built-in-modules.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "es6.module": { - "edge": "16", - "firefox": "60", - "chrome": "61", - "safari": "10.1", - "opera": "48", - "ios_saf": "10.3", - "and_chr": "71", - "and_ff": "64" - } -} diff --git a/packages/babel-preset-env/data/built-in-modules.json.js b/packages/babel-preset-env/data/built-in-modules.json.js new file mode 100644 index 000000000000..161ddb8ea7ab --- /dev/null +++ b/packages/babel-preset-env/data/built-in-modules.json.js @@ -0,0 +1,3 @@ +// TODO: Remove in Babel 8 + +module.exports = require("@babel/compat-data/native-modules"); diff --git a/packages/babel-preset-env/data/built-ins.js b/packages/babel-preset-env/data/built-ins.js new file mode 100644 index 000000000000..38f8a09add7a --- /dev/null +++ b/packages/babel-preset-env/data/built-ins.js @@ -0,0 +1,4 @@ +// TODO: Remove in Babel 8 +// https://github.com/vuejs/vue-cli/issues/3671 + +module.exports = require("./corejs2-built-ins.json"); diff --git a/packages/babel-preset-env/data/corejs2-built-ins.js b/packages/babel-preset-env/data/corejs2-built-ins.js new file mode 100644 index 000000000000..486f3b1e1b2a --- /dev/null +++ b/packages/babel-preset-env/data/corejs2-built-ins.js @@ -0,0 +1,3 @@ +// TODO: Remove in Babel 8 + +module.exports = require("@babel/compat-data/corejs2-built-ins"); diff --git a/packages/babel-preset-env/data/corejs2-built-ins.json.js b/packages/babel-preset-env/data/corejs2-built-ins.json.js new file mode 100644 index 000000000000..486f3b1e1b2a --- /dev/null +++ b/packages/babel-preset-env/data/corejs2-built-ins.json.js @@ -0,0 +1,3 @@ +// TODO: Remove in Babel 8 + +module.exports = require("@babel/compat-data/corejs2-built-ins"); diff --git a/packages/babel-preset-env/data/plugin-features.js b/packages/babel-preset-env/data/plugin-features.js deleted file mode 100644 index 3a84be381683..000000000000 --- a/packages/babel-preset-env/data/plugin-features.js +++ /dev/null @@ -1,108 +0,0 @@ -const es = { - "transform-template-literals": { - features: ["template literals"], - }, - "transform-literals": { - features: ["Unicode code point escapes"], - }, - "transform-function-name": { - features: ['function "name" property'], - }, - "transform-arrow-functions": { - features: ["arrow functions"], - }, - "transform-block-scoped-functions": { - features: ["block-level function declaration"], - }, - "transform-classes": { - features: ["class", "super"], - }, - "transform-object-super": { - features: ["super"], - }, - "transform-shorthand-properties": { - features: ["object literal extensions / shorthand properties"], - }, - "transform-duplicate-keys": { - features: ["miscellaneous / duplicate property names in strict mode"], - }, - "transform-computed-properties": { - features: ["object literal extensions / computed properties"], - }, - "transform-for-of": { - features: ["for..of loops"], - }, - "transform-sticky-regex": { - features: [ - 'RegExp "y" and "u" flags / "y" flag, lastIndex', - 'RegExp "y" and "u" flags / "y" flag', - ], - }, - - // We want to apply this prior to unicode regex so that "." and "u" - // are properly handled. - // - // Ref: https://github.com/babel/babel/pull/7065#issuecomment-395959112 - "transform-dotall-regex": "s (dotAll) flag for regular expressions", - - "transform-unicode-regex": { - features: [ - 'RegExp "y" and "u" flags / "u" flag, case folding', - 'RegExp "y" and "u" flags / "u" flag, Unicode code point escapes', - 'RegExp "y" and "u" flags / "u" flag, non-BMP Unicode characters', - 'RegExp "y" and "u" flags / "u" flag', - ], - }, - - "transform-spread": { - features: "spread syntax for iterable objects", - }, - "transform-parameters": { - features: [ - "default function parameters", - "rest parameters", - "destructuring, parameters / defaults, arrow function", - ], - }, - "transform-destructuring": { - features: [ - "destructuring, assignment", - "destructuring, declarations", - ], - }, - "transform-block-scoping": { - features: ["const", "let"], - }, - "transform-typeof-symbol": { - features: ["Symbol / typeof support"], - }, - "transform-new-target": { - features: ["new.target"], - }, - "transform-regenerator": { - features: ["generators"], - }, - - "transform-exponentiation-operator": { - features: ["exponentiation (**) operator"], - }, - - "transform-async-to-generator": { - features: ["async functions"], - }, - - "proposal-async-generator-functions": "Asynchronous Iterators", - "proposal-object-rest-spread": "object rest/spread properties", - "proposal-unicode-property-regex": "RegExp Unicode Property Escapes", - - "proposal-json-strings": "JSON superset", - "proposal-optional-catch-binding": "optional catch binding", - "transform-named-capturing-groups-regex": "RegExp named capture groups", - "transform-member-expression-literals": "Object/array literal extensions / Reserved words as property names", - "transform-property-literals": "Object/array literal extensions / Reserved words as property names", - "transform-reserved-words": "Miscellaneous / Unreserved words", -}; - -const proposals = require("./shipped-proposals").features; - -module.exports = Object.assign({}, es, proposals); diff --git a/packages/babel-preset-env/data/plugins.js b/packages/babel-preset-env/data/plugins.js new file mode 100644 index 000000000000..b5d6b4361f10 --- /dev/null +++ b/packages/babel-preset-env/data/plugins.js @@ -0,0 +1,3 @@ +// TODO: Remove in Babel 8 + +module.exports = require("@babel/compat-data/plugins"); diff --git a/packages/babel-preset-env/data/plugins.json.js b/packages/babel-preset-env/data/plugins.json.js new file mode 100644 index 000000000000..b5d6b4361f10 --- /dev/null +++ b/packages/babel-preset-env/data/plugins.json.js @@ -0,0 +1,3 @@ +// TODO: Remove in Babel 8 + +module.exports = require("@babel/compat-data/plugins"); diff --git a/packages/babel-preset-env/data/shipped-proposals.js b/packages/babel-preset-env/data/shipped-proposals.js index 90864b6c94b6..e7fd15c3b1a3 100644 --- a/packages/babel-preset-env/data/shipped-proposals.js +++ b/packages/babel-preset-env/data/shipped-proposals.js @@ -1,14 +1,27 @@ +/* eslint sort-keys: "error" */ // These mappings represent the syntax proposals that have been // shipped by browsers, and are enabled by the `shippedProposals` option. -const proposalPlugins = {}; - -const pluginSyntaxMap = new Map([ - ["proposal-async-generator-functions", "syntax-async-generators"], - ["proposal-object-rest-spread", "syntax-object-rest-spread"], - ["proposal-optional-catch-binding", "syntax-optional-catch-binding"], - ["proposal-unicode-property-regex", null], - ["proposal-json-strings", "syntax-json-strings"], +const proposalPlugins = new Set([ + "proposal-numeric-separator", ]); -module.exports = { proposalPlugins, pluginSyntaxMap }; +// use intermediary object to enforce alphabetical key order +const pluginSyntaxObject = { + "proposal-async-generator-functions": "syntax-async-generators", + "proposal-json-strings": "syntax-json-strings", + "proposal-nullish-coalescing-operator": "syntax-nullish-coalescing-operator", + "proposal-numeric-separator": "syntax-numeric-separator", + "proposal-object-rest-spread": "syntax-object-rest-spread", + "proposal-optional-catch-binding": "syntax-optional-catch-binding", + "proposal-optional-chaining": "syntax-optional-chaining", + "proposal-unicode-property-regex": null, +}; + +const pluginSyntaxEntries = Object.keys(pluginSyntaxObject).map(function (key) { + return [key, pluginSyntaxObject[key]]; +}); + +const pluginSyntaxMap = new Map(pluginSyntaxEntries); + +module.exports = { pluginSyntaxMap, proposalPlugins }; diff --git a/packages/babel-preset-env/data/unreleased-labels.js b/packages/babel-preset-env/data/unreleased-labels.js index bc5130567d2f..112d859930d8 100644 --- a/packages/babel-preset-env/data/unreleased-labels.js +++ b/packages/babel-preset-env/data/unreleased-labels.js @@ -1,3 +1,3 @@ -module.exports = { - safari: "tp", -}; +// TODO: Remove in Babel 8 + +module.exports = require("@babel/helper-compilation-targets").unreleasedLabels; diff --git a/packages/babel-preset-env/package.json b/packages/babel-preset-env/package.json index 0e4230400a87..28cd5414ea5a 100644 --- a/packages/babel-preset-env/package.json +++ b/packages/babel-preset-env/package.json @@ -1,6 +1,6 @@ { "name": "@babel/preset-env", - "version": "7.5.5", + "version": "7.9.5", "description": "A Babel preset for each environment.", "author": "Henry Zhu ", "homepage": "https://babeljs.io/", @@ -10,72 +10,76 @@ }, "repository": "https://github.com/babel/babel/tree/master/packages/babel-preset-env", "main": "lib/index.js", - "scripts": { - "build-data": "node ./scripts/build-data.js; node ./scripts/build-modules-support.js" - }, "dependencies": { - "@babel/helper-module-imports": "^7.0.0", - "@babel/helper-plugin-utils": "^7.0.0", - "@babel/plugin-proposal-async-generator-functions": "^7.2.0", - "@babel/plugin-proposal-dynamic-import": "^7.5.0", - "@babel/plugin-proposal-json-strings": "^7.2.0", - "@babel/plugin-proposal-object-rest-spread": "^7.5.5", - "@babel/plugin-proposal-optional-catch-binding": "^7.2.0", - "@babel/plugin-proposal-unicode-property-regex": "^7.4.4", - "@babel/plugin-syntax-async-generators": "^7.2.0", - "@babel/plugin-syntax-dynamic-import": "^7.2.0", - "@babel/plugin-syntax-json-strings": "^7.2.0", - "@babel/plugin-syntax-object-rest-spread": "^7.2.0", - "@babel/plugin-syntax-optional-catch-binding": "^7.2.0", - "@babel/plugin-transform-arrow-functions": "^7.2.0", - "@babel/plugin-transform-async-to-generator": "^7.5.0", - "@babel/plugin-transform-block-scoped-functions": "^7.2.0", - "@babel/plugin-transform-block-scoping": "^7.5.5", - "@babel/plugin-transform-classes": "^7.5.5", - "@babel/plugin-transform-computed-properties": "^7.2.0", - "@babel/plugin-transform-destructuring": "^7.5.0", - "@babel/plugin-transform-dotall-regex": "^7.4.4", - "@babel/plugin-transform-duplicate-keys": "^7.5.0", - "@babel/plugin-transform-exponentiation-operator": "^7.2.0", - "@babel/plugin-transform-for-of": "^7.4.4", - "@babel/plugin-transform-function-name": "^7.4.4", - "@babel/plugin-transform-literals": "^7.2.0", - "@babel/plugin-transform-member-expression-literals": "^7.2.0", - "@babel/plugin-transform-modules-amd": "^7.5.0", - "@babel/plugin-transform-modules-commonjs": "^7.5.0", - "@babel/plugin-transform-modules-systemjs": "^7.5.0", - "@babel/plugin-transform-modules-umd": "^7.2.0", - "@babel/plugin-transform-named-capturing-groups-regex": "^7.4.5", - "@babel/plugin-transform-new-target": "^7.4.4", - "@babel/plugin-transform-object-super": "^7.5.5", - "@babel/plugin-transform-parameters": "^7.4.4", - "@babel/plugin-transform-property-literals": "^7.2.0", - "@babel/plugin-transform-regenerator": "^7.4.5", - "@babel/plugin-transform-reserved-words": "^7.2.0", - "@babel/plugin-transform-shorthand-properties": "^7.2.0", - "@babel/plugin-transform-spread": "^7.2.0", - "@babel/plugin-transform-sticky-regex": "^7.2.0", - "@babel/plugin-transform-template-literals": "^7.4.4", - "@babel/plugin-transform-typeof-symbol": "^7.2.0", - "@babel/plugin-transform-unicode-regex": "^7.4.4", - "@babel/types": "^7.5.5", - "browserslist": "^4.6.0", - "core-js-compat": "^3.1.1", + "@babel/compat-data": "^7.9.0", + "@babel/helper-compilation-targets": "^7.8.7", + "@babel/helper-module-imports": "^7.8.3", + "@babel/helper-plugin-utils": "^7.8.3", + "@babel/plugin-proposal-async-generator-functions": "^7.8.3", + "@babel/plugin-proposal-dynamic-import": "^7.8.3", + "@babel/plugin-proposal-json-strings": "^7.8.3", + "@babel/plugin-proposal-nullish-coalescing-operator": "^7.8.3", + "@babel/plugin-proposal-numeric-separator": "^7.8.3", + "@babel/plugin-proposal-object-rest-spread": "^7.9.5", + "@babel/plugin-proposal-optional-catch-binding": "^7.8.3", + "@babel/plugin-proposal-optional-chaining": "^7.9.0", + "@babel/plugin-proposal-unicode-property-regex": "^7.8.3", + "@babel/plugin-syntax-async-generators": "^7.8.0", + "@babel/plugin-syntax-dynamic-import": "^7.8.0", + "@babel/plugin-syntax-json-strings": "^7.8.0", + "@babel/plugin-syntax-nullish-coalescing-operator": "^7.8.0", + "@babel/plugin-syntax-numeric-separator": "^7.8.0", + "@babel/plugin-syntax-object-rest-spread": "^7.8.0", + "@babel/plugin-syntax-optional-catch-binding": "^7.8.0", + "@babel/plugin-syntax-optional-chaining": "^7.8.0", + "@babel/plugin-syntax-top-level-await": "^7.8.3", + "@babel/plugin-transform-arrow-functions": "^7.8.3", + "@babel/plugin-transform-async-to-generator": "^7.8.3", + "@babel/plugin-transform-block-scoped-functions": "^7.8.3", + "@babel/plugin-transform-block-scoping": "^7.8.3", + "@babel/plugin-transform-classes": "^7.9.5", + "@babel/plugin-transform-computed-properties": "^7.8.3", + "@babel/plugin-transform-destructuring": "^7.9.5", + "@babel/plugin-transform-dotall-regex": "^7.8.3", + "@babel/plugin-transform-duplicate-keys": "^7.8.3", + "@babel/plugin-transform-exponentiation-operator": "^7.8.3", + "@babel/plugin-transform-for-of": "^7.9.0", + "@babel/plugin-transform-function-name": "^7.8.3", + "@babel/plugin-transform-literals": "^7.8.3", + "@babel/plugin-transform-member-expression-literals": "^7.8.3", + "@babel/plugin-transform-modules-amd": "^7.9.0", + "@babel/plugin-transform-modules-commonjs": "^7.9.0", + "@babel/plugin-transform-modules-systemjs": "^7.9.0", + "@babel/plugin-transform-modules-umd": "^7.9.0", + "@babel/plugin-transform-named-capturing-groups-regex": "^7.8.3", + "@babel/plugin-transform-new-target": "^7.8.3", + "@babel/plugin-transform-object-super": "^7.8.3", + "@babel/plugin-transform-parameters": "^7.9.5", + "@babel/plugin-transform-property-literals": "^7.8.3", + "@babel/plugin-transform-regenerator": "^7.8.7", + "@babel/plugin-transform-reserved-words": "^7.8.3", + "@babel/plugin-transform-shorthand-properties": "^7.8.3", + "@babel/plugin-transform-spread": "^7.8.3", + "@babel/plugin-transform-sticky-regex": "^7.8.3", + "@babel/plugin-transform-template-literals": "^7.8.3", + "@babel/plugin-transform-typeof-symbol": "^7.8.4", + "@babel/plugin-transform-unicode-regex": "^7.8.3", + "@babel/preset-modules": "^0.1.3", + "@babel/types": "^7.9.5", + "browserslist": "^4.11.1", + "core-js-compat": "^3.6.2", "invariant": "^2.2.2", - "js-levenshtein": "^1.1.3", + "levenary": "^1.1.1", "semver": "^5.5.0" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/cli": "^7.5.5", - "@babel/core": "^7.5.5", - "@babel/helper-fixtures": "^7.5.5", - "@babel/helper-plugin-test-runner": "^7.0.0", - "@babel/plugin-syntax-dynamic-import": "^7.2.0", - "caniuse-db": "1.0.30000969", - "compat-table": "kangax/compat-table#071b478a44694cbf72a78db8ab39189c5ae31b2c", - "electron-to-chromium": "1.3.113" + "@babel/cli": "^7.8.4", + "@babel/core": "^7.9.0", + "@babel/helper-fixtures": "^7.8.6", + "@babel/helper-plugin-test-runner": "^7.8.3", + "@babel/plugin-syntax-dynamic-import": "^7.2.0" } } diff --git a/packages/babel-preset-env/scripts/build-data.js b/packages/babel-preset-env/scripts/build-data.js deleted file mode 100644 index d4502ddaa91f..000000000000 --- a/packages/babel-preset-env/scripts/build-data.js +++ /dev/null @@ -1,315 +0,0 @@ -"use strict"; - -const fs = require("fs"); -const path = require("path"); -const semver = require("semver"); -const flattenDeep = require("lodash/flattenDeep"); -const isEqual = require("lodash/isEqual"); -const mapValues = require("lodash/mapValues"); -const pickBy = require("lodash/pickBy"); -const unreleasedLabels = require("../data/unreleased-labels"); -const electronToChromiumVersions = require("electron-to-chromium").versions; - -const electronToChromiumKeys = Object.keys( - electronToChromiumVersions -).reverse(); - -const chromiumToElectronMap = electronToChromiumKeys.reduce((all, electron) => { - all[electronToChromiumVersions[electron]] = +electron; - return all; -}, {}); -const chromiumToElectronVersions = Object.keys(chromiumToElectronMap); - -const findClosestElectronVersion = targetVersion => { - const chromiumVersionsLength = chromiumToElectronVersions.length; - const maxChromium = +chromiumToElectronVersions[chromiumVersionsLength - 1]; - if (targetVersion > maxChromium) return null; - - const closestChrome = chromiumToElectronVersions.find( - version => targetVersion <= version - ); - return chromiumToElectronMap[closestChrome]; -}; - -const chromiumToElectron = chromium => - chromiumToElectronMap[chromium] || findClosestElectronVersion(chromium); - -const renameTests = (tests, getName, category) => - tests.map(test => - Object.assign({}, test, { name: getName(test.name), category }) - ); - -// The following is adapted from compat-table: -// https://github.com/kangax/compat-table/blob/gh-pages/build.js -// -// It parses and interpolates data so environments that "equal" other -// environments (node4 and chrome45), as well as familial relationships (edge -// and ie11) can be handled properly. - -const envs = require("compat-table/environments"); - -const byTestSuite = suite => browser => { - return Array.isArray(browser.test_suites) - ? browser.test_suites.indexOf(suite) > -1 - : true; -}; - -const compatSources = ["es5", "es6", "es2016plus", "esnext"].reduce( - (result, source) => { - const data = require(`compat-table/data-${source}`); - data.browsers = pickBy(envs, byTestSuite(source)); - result.push(data); - return result; - }, - [] -); - -const interpolateAllResults = (rawBrowsers, tests) => { - const interpolateResults = res => { - let browser; - let prevBrowser; - let result; - let prevResult; - let prevBid; - - for (const bid in rawBrowsers) { - // For browsers that are essentially equal to other browsers, - // copy over the results. - browser = rawBrowsers[bid]; - if (browser.equals && res[bid] === undefined) { - result = res[browser.equals]; - res[bid] = - browser.ignore_flagged && result === "flagged" ? false : result; - // For each browser, check if the previous browser has the same - // browser full name (e.g. Firefox) or family name (e.g. Chakra) as this one. - } else if ( - prevBrowser && - (prevBrowser.full.replace(/,.+$/, "") === - browser.full.replace(/,.+$/, "") || - (browser.family !== undefined && - prevBrowser.family === browser.family)) - ) { - // For each test, check if the previous browser has a result - // that this browser lacks. - result = res[bid]; - prevResult = res[prevBid]; - if (prevResult !== undefined && result === undefined) { - res[bid] = prevResult; - } - } - prevBrowser = browser; - prevBid = bid; - } - }; - - // Now print the results. - tests.forEach(function(t) { - // Calculate the result totals for tests which consist solely of subtests. - if ("subtests" in t) { - t.subtests.forEach(function(e) { - interpolateResults(e.res); - }); - } else { - interpolateResults(t.res); - } - }); -}; - -compatSources.forEach(({ browsers, tests }) => - interpolateAllResults(browsers, tests) -); - -// End of compat-table code adaptation - -const environments = [ - "chrome", - "opera", - "edge", - "firefox", - "safari", - "node", - "ie", - "android", - "ios", - "phantom", - "samsung", -]; - -const compatibilityTests = flattenDeep( - compatSources.map(data => - data.tests.map(test => { - return test.subtests - ? [ - test, - renameTests( - test.subtests, - name => test.name + " / " + name, - test.category - ), - ] - : test; - }) - ) -); - -const getLowestImplementedVersion = ({ features }, env) => { - const tests = compatibilityTests - .filter(test => { - return ( - features.indexOf(test.name) >= 0 || - // for features === ["DataView"] - // it covers "DataView (Int8)" and "DataView (UInt8)" - (features.length === 1 && test.name.indexOf(features[0]) === 0) - ); - }) - .reduce((result, test) => { - if (!test.subtests) { - result.push({ - name: test.name, - res: test.res, - }); - } else { - test.subtests.forEach(subtest => - result.push({ - name: `${test.name}/${subtest.name}`, - res: subtest.res, - }) - ); - } - - return result; - }, []); - - const unreleasedLabelForEnv = unreleasedLabels[env]; - const envTests = tests.map(({ res: test }, i) => { - const reportedVersions = Object.keys(test) - .filter(t => t.startsWith(env)) - .map(t => { - const version = t.replace(/_/g, ".").replace(env, ""); - return { - version, - semver: semver.coerce(version) || version, - // Babel assumes strict mode - implements: tests[i].res[t] === true || tests[i].res[t] === "strict", - }; - }) - // version must be label from the unreleasedLabels (like tp) or number. - .filter( - version => - unreleasedLabelForEnv === version.version || - !isNaN(parseFloat(version.version)) - ) - // Sort in desc order, with unreleasedLabelForEnv coming last. - .sort(({ semver: av }, { semver: bv }) => { - if (av === unreleasedLabelForEnv) return -1; - if (bv === unreleasedLabelForEnv) return 1; - if (semver.gt(av, bv)) return -1; - if (semver.gt(bv, av)) return 1; - return 0; - }); - - // Find the lowest version such that all higher versions implement it. - // Eg, given { chrome70: true, chrome60: false, chrome50: true }, the - // lowest version is chrome70, not chrome50. - let lowest = null; - for (const version of reportedVersions) { - if (!version.implements) { - break; - } - lowest = version; - } - return lowest; - }); - - const envFiltered = envTests.filter(t => t); - if (envTests.length > envFiltered.length || envTests.length === 0) { - // envTests.forEach((test, i) => { - // if (!test) { - // // print unsupported features - // if (env === 'node') { - // console.log(`ENV(${env}): ${tests[i].name}`); - // } - // } - // }); - return null; - } - - return envFiltered.reduce((a, b) => { - if ( - a.semver === unreleasedLabelForEnv || - b.semver === unreleasedLabelForEnv - ) { - return unreleasedLabelForEnv; - } - - return semver.lt(a.semver, b.semver) ? b : a; - }); -}; - -const generateData = (environments, features) => { - return mapValues(features, options => { - if (!options.features) { - options = { - features: [options], - }; - } - - const plugin = {}; - - environments.forEach(env => { - const version = getLowestImplementedVersion(options, env); - - if (version !== null) { - const versionString = version.version; - - // NOTE(bng): A number of environments in compat-table changed to - // include a trailing zero (node10 -> node10_0), so for now stripping - // it to be consistent - plugin[env] = versionString.endsWith(".0") - ? versionString.slice(0, -2) - : versionString; - } - }); - - if (plugin.chrome) { - // add opera - if (plugin.chrome >= 28) { - plugin.opera = (plugin.chrome - 13).toString(); - } else if (plugin.chrome === 5) { - plugin.opera = "12"; - } - - // add electron - const electronVersion = chromiumToElectron(plugin.chrome); - if (electronVersion) { - plugin.electron = electronVersion.toString(); - } - } - - return plugin; - }); -}; - -["plugin", "corejs2-built-in"].forEach(target => { - const newData = generateData( - environments, - require(`../data/${target}-features`) - ); - const dataPath = path.join(__dirname, `../data/${target}s.json`); - - if (process.argv[2] === "--check") { - const currentData = require(dataPath); - - if (!isEqual(currentData, newData)) { - console.error( - "The newly generated plugin/built-in data does not match the current " + - "files. Re-run `npm run build-data`." - ); - process.exit(1); - } - - process.exit(0); - } - - fs.writeFileSync(dataPath, `${JSON.stringify(newData, null, 2)}\n`); -}); diff --git a/packages/babel-preset-env/scripts/build-modules-support.js b/packages/babel-preset-env/scripts/build-modules-support.js deleted file mode 100644 index 40add39e0cb0..000000000000 --- a/packages/babel-preset-env/scripts/build-modules-support.js +++ /dev/null @@ -1,36 +0,0 @@ -const path = require("path"); -const fs = require("fs"); - -const moduleSupport = require("caniuse-db/features-json/es6-module.json"); - -const skipList = new Set(["android", "samsung"]); -const acceptedWithCaveats = new Set(["safari", "ios_saf"]); - -const { stats } = moduleSupport; - -const allowedBrowsers = {}; - -Object.keys(stats).forEach(browser => { - if (!skipList.has(browser)) { - const browserVersions = stats[browser]; - const allowedVersions = Object.keys(browserVersions) - .filter(value => { - // Edge 16/17 are marked as "y #6" - return acceptedWithCaveats.has(browser) - ? browserVersions[value][0] === "a" - : browserVersions[value].startsWith("y"); - }) - .sort((a, b) => a - b); - - if (allowedVersions[0] !== undefined) { - // Handle cases where caniuse specifies version as: "11.0-11.2" - allowedBrowsers[browser] = allowedVersions[0].split("-")[0]; - } - } -}); - -const dataPath = path.join(__dirname, "../data/built-in-modules.json"); -const data = { - "es6.module": allowedBrowsers, -}; -fs.writeFileSync(dataPath, `${JSON.stringify(data, null, 2)}\n`); diff --git a/packages/babel-preset-env/scripts/smoke-test.js b/packages/babel-preset-env/scripts/smoke-test.js index 607bdcdabf82..a06dcf5303f0 100755 --- a/packages/babel-preset-env/scripts/smoke-test.js +++ b/packages/babel-preset-env/scripts/smoke-test.js @@ -108,4 +108,4 @@ console.log("Cleaning up"); fs.removeSync(tempFolderPath); fs.removeSync(packPath); -process.exit(errorOccurred ? 1 : 0); +process.exitCode = errorOccurred ? 1 : 0; diff --git a/packages/babel-preset-env/src/available-plugins.js b/packages/babel-preset-env/src/available-plugins.js index 77da4ff02cf0..ef815702aa47 100644 --- a/packages/babel-preset-env/src/available-plugins.js +++ b/packages/babel-preset-env/src/available-plugins.js @@ -1,46 +1,117 @@ // @flow +/* eslint sort-keys: "error" */ + +import syntaxAsyncGenerators from "@babel/plugin-syntax-async-generators"; +import syntaxDynamicImport from "@babel/plugin-syntax-dynamic-import"; +import syntaxJsonStrings from "@babel/plugin-syntax-json-strings"; +import syntaxNullishCoalescingOperator from "@babel/plugin-syntax-nullish-coalescing-operator"; +import syntaxNumericSeparator from "@babel/plugin-syntax-numeric-separator"; +import syntaxObjectRestSpread from "@babel/plugin-syntax-object-rest-spread"; +import syntaxOptionalCatchBinding from "@babel/plugin-syntax-optional-catch-binding"; +import syntaxOptionalChaining from "@babel/plugin-syntax-optional-chaining"; +import syntaxTopLevelAwait from "@babel/plugin-syntax-top-level-await"; +import proposalAsyncGeneratorFunctions from "@babel/plugin-proposal-async-generator-functions"; +import proposalDynamicImport from "@babel/plugin-proposal-dynamic-import"; +import proposalJsonStrings from "@babel/plugin-proposal-json-strings"; +import proposalNullishCoalescingOperator from "@babel/plugin-proposal-nullish-coalescing-operator"; +import proposalNumericSeparator from "@babel/plugin-proposal-numeric-separator"; +import proposalObjectRestSpread from "@babel/plugin-proposal-object-rest-spread"; +import proposalOptionalCatchBinding from "@babel/plugin-proposal-optional-catch-binding"; +import proposalOptionalChaining from "@babel/plugin-proposal-optional-chaining"; +import proposalUnicodePropertyRegex from "@babel/plugin-proposal-unicode-property-regex"; +import transformAsyncToGenerator from "@babel/plugin-transform-async-to-generator"; +import transformArrowFunctions from "@babel/plugin-transform-arrow-functions"; +import transformBlockScopedFunctions from "@babel/plugin-transform-block-scoped-functions"; +import transformBlockScoping from "@babel/plugin-transform-block-scoping"; +import transformClasses from "@babel/plugin-transform-classes"; +import transformComputedProperties from "@babel/plugin-transform-computed-properties"; +import transformDestructuring from "@babel/plugin-transform-destructuring"; +import transformDotallRegex from "@babel/plugin-transform-dotall-regex"; +import transformDuplicateKeys from "@babel/plugin-transform-duplicate-keys"; +import transformExponentialOperator from "@babel/plugin-transform-exponentiation-operator"; +import transformForOf from "@babel/plugin-transform-for-of"; +import transformFunctionName from "@babel/plugin-transform-function-name"; +import transformLiterals from "@babel/plugin-transform-literals"; +import transformMemberExpressionLiterals from "@babel/plugin-transform-member-expression-literals"; +import transformModulesAmd from "@babel/plugin-transform-modules-amd"; +import transformModulesCommonjs from "@babel/plugin-transform-modules-commonjs"; +import transformModulesSystemjs from "@babel/plugin-transform-modules-systemjs"; +import transformModulesUmd from "@babel/plugin-transform-modules-umd"; +import transformNamedCapturingGroupsRegex from "@babel/plugin-transform-named-capturing-groups-regex"; +import transformNewTarget from "@babel/plugin-transform-new-target"; +import transformObjectSuper from "@babel/plugin-transform-object-super"; +import transformParameters from "@babel/plugin-transform-parameters"; +import transformPropertyLiterals from "@babel/plugin-transform-property-literals"; +import transformRegenerator from "@babel/plugin-transform-regenerator"; +import transformReservedWords from "@babel/plugin-transform-reserved-words"; +import transformShorthandProperties from "@babel/plugin-transform-shorthand-properties"; +import transformSpread from "@babel/plugin-transform-spread"; +import transformStickyRegex from "@babel/plugin-transform-sticky-regex"; +import transformTemplateLiterals from "@babel/plugin-transform-template-literals"; +import transformTypeofSymbol from "@babel/plugin-transform-typeof-symbol"; +import transformUnicodeRegex from "@babel/plugin-transform-unicode-regex"; + +import bugfixAsyncArrowsInClass from "@babel/preset-modules/lib/plugins/transform-async-arrows-in-class"; +import bugfixEdgeDefaultParameters from "@babel/preset-modules/lib/plugins/transform-edge-default-parameters"; +import bugfixEdgeFunctionName from "@babel/preset-modules/lib/plugins/transform-edge-function-name"; +import bugfixTaggedTemplateCaching from "@babel/preset-modules/lib/plugins/transform-tagged-template-caching"; +import bugfixSafariBlockShadowing from "@babel/preset-modules/lib/plugins/transform-safari-block-shadowing"; +import bugfixSafariForShadowing from "@babel/preset-modules/lib/plugins/transform-safari-for-shadowing"; export default { - "syntax-async-generators": require("@babel/plugin-syntax-async-generators"), - "syntax-dynamic-import": require("@babel/plugin-syntax-dynamic-import"), - "syntax-json-strings": require("@babel/plugin-syntax-json-strings"), - "syntax-object-rest-spread": require("@babel/plugin-syntax-object-rest-spread"), - "syntax-optional-catch-binding": require("@babel/plugin-syntax-optional-catch-binding"), - "transform-async-to-generator": require("@babel/plugin-transform-async-to-generator"), - "proposal-async-generator-functions": require("@babel/plugin-proposal-async-generator-functions"), - "proposal-dynamic-import": require("@babel/plugin-proposal-dynamic-import"), - "proposal-json-strings": require("@babel/plugin-proposal-json-strings"), - "transform-arrow-functions": require("@babel/plugin-transform-arrow-functions"), - "transform-block-scoped-functions": require("@babel/plugin-transform-block-scoped-functions"), - "transform-block-scoping": require("@babel/plugin-transform-block-scoping"), - "transform-classes": require("@babel/plugin-transform-classes"), - "transform-computed-properties": require("@babel/plugin-transform-computed-properties"), - "transform-destructuring": require("@babel/plugin-transform-destructuring"), - "transform-dotall-regex": require("@babel/plugin-transform-dotall-regex"), - "transform-duplicate-keys": require("@babel/plugin-transform-duplicate-keys"), - "transform-for-of": require("@babel/plugin-transform-for-of"), - "transform-function-name": require("@babel/plugin-transform-function-name"), - "transform-literals": require("@babel/plugin-transform-literals"), - "transform-member-expression-literals": require("@babel/plugin-transform-member-expression-literals"), - "transform-modules-amd": require("@babel/plugin-transform-modules-amd"), - "transform-modules-commonjs": require("@babel/plugin-transform-modules-commonjs"), - "transform-modules-systemjs": require("@babel/plugin-transform-modules-systemjs"), - "transform-modules-umd": require("@babel/plugin-transform-modules-umd"), - "transform-named-capturing-groups-regex": require("@babel/plugin-transform-named-capturing-groups-regex"), - "transform-object-super": require("@babel/plugin-transform-object-super"), - "transform-parameters": require("@babel/plugin-transform-parameters"), - "transform-property-literals": require("@babel/plugin-transform-property-literals"), - "transform-reserved-words": require("@babel/plugin-transform-reserved-words"), - "transform-shorthand-properties": require("@babel/plugin-transform-shorthand-properties"), - "transform-spread": require("@babel/plugin-transform-spread"), - "transform-sticky-regex": require("@babel/plugin-transform-sticky-regex"), - "transform-template-literals": require("@babel/plugin-transform-template-literals"), - "transform-typeof-symbol": require("@babel/plugin-transform-typeof-symbol"), - "transform-unicode-regex": require("@babel/plugin-transform-unicode-regex"), - "transform-exponentiation-operator": require("@babel/plugin-transform-exponentiation-operator"), - "transform-new-target": require("@babel/plugin-transform-new-target"), - "proposal-object-rest-spread": require("@babel/plugin-proposal-object-rest-spread"), - "proposal-optional-catch-binding": require("@babel/plugin-proposal-optional-catch-binding"), - "transform-regenerator": require("@babel/plugin-transform-regenerator"), - "proposal-unicode-property-regex": require("@babel/plugin-proposal-unicode-property-regex"), + "bugfix/transform-async-arrows-in-class": bugfixAsyncArrowsInClass, + "bugfix/transform-edge-default-parameters": bugfixEdgeDefaultParameters, + "bugfix/transform-edge-function-name": bugfixEdgeFunctionName, + "bugfix/transform-safari-block-shadowing": bugfixSafariBlockShadowing, + "bugfix/transform-safari-for-shadowing": bugfixSafariForShadowing, + "bugfix/transform-tagged-template-caching": bugfixTaggedTemplateCaching, + "proposal-async-generator-functions": proposalAsyncGeneratorFunctions, + "proposal-dynamic-import": proposalDynamicImport, + "proposal-json-strings": proposalJsonStrings, + "proposal-nullish-coalescing-operator": proposalNullishCoalescingOperator, + "proposal-numeric-separator": proposalNumericSeparator, + "proposal-object-rest-spread": proposalObjectRestSpread, + "proposal-optional-catch-binding": proposalOptionalCatchBinding, + "proposal-optional-chaining": proposalOptionalChaining, + "proposal-unicode-property-regex": proposalUnicodePropertyRegex, + "syntax-async-generators": syntaxAsyncGenerators, + "syntax-dynamic-import": syntaxDynamicImport, + "syntax-json-strings": syntaxJsonStrings, + "syntax-nullish-coalescing-operator": syntaxNullishCoalescingOperator, + "syntax-numeric-separator": syntaxNumericSeparator, + "syntax-object-rest-spread": syntaxObjectRestSpread, + "syntax-optional-catch-binding": syntaxOptionalCatchBinding, + "syntax-optional-chaining": syntaxOptionalChaining, + "syntax-top-level-await": syntaxTopLevelAwait, + "transform-arrow-functions": transformArrowFunctions, + "transform-async-to-generator": transformAsyncToGenerator, + "transform-block-scoped-functions": transformBlockScopedFunctions, + "transform-block-scoping": transformBlockScoping, + "transform-classes": transformClasses, + "transform-computed-properties": transformComputedProperties, + "transform-destructuring": transformDestructuring, + "transform-dotall-regex": transformDotallRegex, + "transform-duplicate-keys": transformDuplicateKeys, + "transform-exponentiation-operator": transformExponentialOperator, + "transform-for-of": transformForOf, + "transform-function-name": transformFunctionName, + "transform-literals": transformLiterals, + "transform-member-expression-literals": transformMemberExpressionLiterals, + "transform-modules-amd": transformModulesAmd, + "transform-modules-commonjs": transformModulesCommonjs, + "transform-modules-systemjs": transformModulesSystemjs, + "transform-modules-umd": transformModulesUmd, + "transform-named-capturing-groups-regex": transformNamedCapturingGroupsRegex, + "transform-new-target": transformNewTarget, + "transform-object-super": transformObjectSuper, + "transform-parameters": transformParameters, + "transform-property-literals": transformPropertyLiterals, + "transform-regenerator": transformRegenerator, + "transform-reserved-words": transformReservedWords, + "transform-shorthand-properties": transformShorthandProperties, + "transform-spread": transformSpread, + "transform-sticky-regex": transformStickyRegex, + "transform-template-literals": transformTemplateLiterals, + "transform-typeof-symbol": transformTypeofSymbol, + "transform-unicode-regex": transformUnicodeRegex, }; diff --git a/packages/babel-preset-env/src/debug.js b/packages/babel-preset-env/src/debug.js index db72cf0c3e3e..b91499e72275 100644 --- a/packages/babel-preset-env/src/debug.js +++ b/packages/babel-preset-env/src/debug.js @@ -1,9 +1,9 @@ // @flow -/*eslint quotes: ["error", "double", { "avoidEscape": true }]*/ -import semver from "semver"; -import { isUnreleasedVersion, prettifyVersion, semverify } from "./utils"; -import type { Targets } from "./types"; +import { + getInclusionReasons, + type Targets, +} from "@babel/helper-compilation-targets"; const wordEnds = (size: number) => { return size > 1 ? "s" : ""; @@ -16,29 +16,7 @@ export const logPluginOrPolyfill = ( targetVersions: Targets, list: { [key: string]: Targets }, ) => { - const minVersions = list[item] || {}; - - const filteredList = Object.keys(targetVersions).reduce((result, env) => { - const minVersion = minVersions[env]; - const targetVersion = targetVersions[env]; - - if (!minVersion) { - result[env] = prettifyVersion(targetVersion); - } else { - const minIsUnreleased = isUnreleasedVersion(minVersion, env); - const targetIsUnreleased = isUnreleasedVersion(targetVersion, env); - - if ( - !targetIsUnreleased && - (minIsUnreleased || - semver.lt(targetVersion.toString(), semverify(minVersion))) - ) { - result[env] = prettifyVersion(targetVersion); - } - } - - return result; - }, {}); + const filteredList = getInclusionReasons(item, targetVersions, list); const formattedTargets = JSON.stringify(filteredList) .replace(/,/g, ", ") @@ -56,6 +34,10 @@ export const logEntryPolyfills = ( polyfillTargets: Targets, allBuiltInsList: { [key: string]: Targets }, ) => { + // normalize filename to generate consistent preset-env test fixtures + if (process.env.BABEL_ENV === "test") { + filename = filename.replace(/\\/g, "/"); + } if (!importPolyfillIncluded) { console.log(`\n[${filename}] Import of ${polyfillName} was not found.`); return; @@ -83,6 +65,10 @@ export const logUsagePolyfills = ( polyfillTargets: Targets, allBuiltInsList: { [key: string]: Targets }, ) => { + // normalize filename to generate consistent preset-env test fixtures + if (process.env.BABEL_ENV === "test") { + filename = filename.replace(/\\/g, "/"); + } if (!polyfills.size) { console.log( `\n[${filename}] Based on your code and targets, core-js polyfills were not added.`, diff --git a/packages/babel-preset-env/src/filter-items.js b/packages/babel-preset-env/src/filter-items.js index 7d9c07026eba..a0041b3f082b 100644 --- a/packages/babel-preset-env/src/filter-items.js +++ b/packages/babel-preset-env/src/filter-items.js @@ -1,87 +1,11 @@ // @flow -import semver from "semver"; -import { semverify, isUnreleasedVersion } from "./utils"; -import type { Targets } from "./types"; - -export function isPluginRequired( - supportedEnvironments: Targets, - plugin: Targets, +export function removeUnnecessaryItems( + items: Set, + overlapping: { [name: string]: string[] }, ) { - const targetEnvironments = Object.keys(supportedEnvironments); - - if (targetEnvironments.length === 0) { - return true; - } - - const isRequiredForEnvironments = targetEnvironments.filter(environment => { - // Feature is not implemented in that environment - if (!plugin[environment]) { - return true; - } - - const lowestImplementedVersion = plugin[environment]; - const lowestTargetedVersion = supportedEnvironments[environment]; - - // If targets has unreleased value as a lowest version, then don't require a plugin. - if (isUnreleasedVersion(lowestTargetedVersion, environment)) { - return false; - } - - // Include plugin if it is supported in the unreleased environment, which wasn't specified in targets - if (isUnreleasedVersion(lowestImplementedVersion, environment)) { - return true; - } - - if (!semver.valid(lowestTargetedVersion.toString())) { - throw new Error( - `Invalid version passed for target "${environment}": "${lowestTargetedVersion}". ` + - "Versions must be in semver format (major.minor.patch)", - ); - } - - return semver.gt( - semverify(lowestImplementedVersion), - lowestTargetedVersion.toString(), - ); + items.forEach(item => { + // $FlowIgnore Flow doesn't support calls in optional chains + overlapping[item]?.forEach(name => items.delete(name)); }); - - return isRequiredForEnvironments.length > 0; -} - -export default function( - list: { [feature: string]: Targets }, - includes: Set, - excludes: Set, - targets: Targets, - defaultIncludes: Array | null, - defaultExcludes?: Array | null, - pluginSyntaxMap?: Map, -) { - const result = new Set(); - - for (const item in list) { - if ( - !excludes.has(item) && - (isPluginRequired(targets, list[item]) || includes.has(item)) - ) { - result.add(item); - } else if (pluginSyntaxMap) { - const shippedProposalsSyntax = pluginSyntaxMap.get(item); - - if (shippedProposalsSyntax) { - result.add(shippedProposalsSyntax); - } - } - } - - if (defaultIncludes) { - defaultIncludes.forEach(item => !excludes.has(item) && result.add(item)); - } - - if (defaultExcludes) { - defaultExcludes.forEach(item => !includes.has(item) && result.delete(item)); - } - - return result; } diff --git a/packages/babel-preset-env/src/index.js b/packages/babel-preset-env/src/index.js index 85a784476b83..4aea6ea731e3 100644 --- a/packages/babel-preset-env/src/index.js +++ b/packages/babel-preset-env/src/index.js @@ -1,12 +1,17 @@ //@flow +import { SemVer } from "semver"; import { logPluginOrPolyfill } from "./debug"; import getOptionSpecificExcludesFor from "./get-option-specific-excludes"; -import filterItems from "./filter-items"; +import { removeUnnecessaryItems } from "./filter-items"; import moduleTransformations from "./module-transformations"; import normalizeOptions from "./normalize-options"; -import pluginList from "../data/plugins.json"; import { proposalPlugins, pluginSyntaxMap } from "../data/shipped-proposals"; +import { + plugins as pluginsList, + pluginsBugfixes as pluginsBugfixesList, +} from "./plugins-compat-data"; +import overlappingPlugins from "@babel/compat-data/overlapping-plugins"; import addCoreJS2UsagePlugin from "./polyfills/corejs2/usage-plugin"; import addCoreJS3UsagePlugin from "./polyfills/corejs3/usage-plugin"; @@ -15,17 +20,49 @@ import replaceCoreJS2EntryPlugin from "./polyfills/corejs2/entry-plugin"; import replaceCoreJS3EntryPlugin from "./polyfills/corejs3/entry-plugin"; import removeRegeneratorEntryPlugin from "./polyfills/regenerator/entry-plugin"; -import getTargets from "./targets-parser"; +import getTargets, { + prettifyTargets, + filterItems, + isRequired, + type Targets, +} from "@babel/helper-compilation-targets"; import availablePlugins from "./available-plugins"; -import { filterStageFromList, prettifyTargets } from "./utils"; +import { filterStageFromList } from "./utils"; import { declare } from "@babel/helper-plugin-utils"; -export { isPluginRequired } from "./filter-items"; +import typeof ModuleTransformationsType from "./module-transformations"; +import type { BuiltInsOption, ModuleOption } from "./types"; -const pluginListWithoutProposals = filterStageFromList( - pluginList, - proposalPlugins, -); +// TODO: Remove in Babel 8 +export function isPluginRequired(targets: Targets, support: Targets) { + return isRequired("fake-name", targets, { + compatData: { "fake-name": support }, + }); +} + +const pluginLists = { + withProposals: { + withoutBugfixes: pluginsList, + withBugfixes: Object.assign({}, pluginsList, pluginsBugfixesList), + }, + withoutProposals: { + withoutBugfixes: filterStageFromList(pluginsList, proposalPlugins), + withBugfixes: filterStageFromList( + Object.assign({}, pluginsList, pluginsBugfixesList), + proposalPlugins, + ), + }, +}; + +function getPluginList(proposals: boolean, bugfixes: boolean) { + if (proposals) { + if (bugfixes) return pluginLists.withProposals.withBugfixes; + else return pluginLists.withProposals.withoutBugfixes; + } else { + if (bugfixes) return pluginLists.withoutProposals.withBugfixes; + else return pluginLists.withoutProposals.withoutBugfixes; + } +} const getPlugin = (pluginName: string) => { const plugin = availablePlugins[pluginName]; @@ -56,6 +93,110 @@ export const transformIncludesAndExcludes = (opts: Array): Object => { ); }; +export const getModulesPluginNames = ({ + modules, + transformations, + shouldTransformESM, + shouldTransformDynamicImport, + shouldParseTopLevelAwait, +}: { + modules: ModuleOption, + transformations: ModuleTransformationsType, + shouldTransformESM: boolean, + shouldTransformDynamicImport: boolean, + shouldParseTopLevelAwait: boolean, +}) => { + const modulesPluginNames = []; + if (modules !== false && transformations[modules]) { + if (shouldTransformESM) { + modulesPluginNames.push(transformations[modules]); + } + + if ( + shouldTransformDynamicImport && + shouldTransformESM && + modules !== "umd" + ) { + modulesPluginNames.push("proposal-dynamic-import"); + } else { + if (shouldTransformDynamicImport) { + console.warn( + "Dynamic import can only be supported when transforming ES modules" + + " to AMD, CommonJS or SystemJS. Only the parser plugin will be enabled.", + ); + } + modulesPluginNames.push("syntax-dynamic-import"); + } + } else { + modulesPluginNames.push("syntax-dynamic-import"); + } + + if (shouldParseTopLevelAwait) { + modulesPluginNames.push("syntax-top-level-await"); + } + + return modulesPluginNames; +}; + +export const getPolyfillPlugins = ({ + useBuiltIns, + corejs, + polyfillTargets, + include, + exclude, + proposals, + shippedProposals, + regenerator, + debug, +}: { + useBuiltIns: BuiltInsOption, + corejs: typeof SemVer | null | false, + polyfillTargets: Targets, + include: Set, + exclude: Set, + proposals: boolean, + shippedProposals: boolean, + regenerator: boolean, + debug: boolean, +}) => { + const polyfillPlugins = []; + if (useBuiltIns === "usage" || useBuiltIns === "entry") { + const pluginOptions = { + corejs, + polyfillTargets, + include, + exclude, + proposals, + shippedProposals, + regenerator, + debug, + }; + + if (corejs) { + if (useBuiltIns === "usage") { + if (corejs.major === 2) { + polyfillPlugins.push([addCoreJS2UsagePlugin, pluginOptions]); + } else { + polyfillPlugins.push([addCoreJS3UsagePlugin, pluginOptions]); + } + if (regenerator) { + polyfillPlugins.push([addRegeneratorUsagePlugin, pluginOptions]); + } + } else { + if (corejs.major === 2) { + polyfillPlugins.push([replaceCoreJS2EntryPlugin, pluginOptions]); + } else { + polyfillPlugins.push([replaceCoreJS3EntryPlugin, pluginOptions]); + if (!regenerator) { + polyfillPlugins.push([removeRegeneratorEntryPlugin, pluginOptions]); + } + } + } + } + } + return polyfillPlugins; +}; + function supportsStaticESM(caller) { return !!(caller && caller.supportsStaticESM); } @@ -64,10 +205,15 @@ function supportsDynamicImport(caller) { return !!(caller && caller.supportsDynamicImport); } +function supportsTopLevelAwait(caller) { + return !!(caller && caller.supportsTopLevelAwait); +} + export default declare((api, opts) => { api.assertVersion(7); const { + bugfixes, configPath, debug, exclude: optionsExclude, @@ -115,58 +261,48 @@ export default declare((api, opts) => { const transformTargets = forceAllTransforms || hasUglifyTarget ? {} : targets; - const transformations = filterItems( - shippedProposals ? pluginList : pluginListWithoutProposals, + const modulesPluginNames = getModulesPluginNames({ + modules, + transformations: moduleTransformations, + // TODO: Remove the 'api.caller' check eventually. Just here to prevent + // unnecessary breakage in the short term for users on older betas/RCs. + shouldTransformESM: + modules !== "auto" || !api.caller || !api.caller(supportsStaticESM), + shouldTransformDynamicImport: + modules !== "auto" || !api.caller || !api.caller(supportsDynamicImport), + shouldParseTopLevelAwait: !api.caller || api.caller(supportsTopLevelAwait), + }); + + const pluginNames = filterItems( + getPluginList(shippedProposals, bugfixes), include.plugins, exclude.plugins, transformTargets, - null, + modulesPluginNames, getOptionSpecificExcludesFor({ loose }), pluginSyntaxMap, ); + removeUnnecessaryItems(pluginNames, overlappingPlugins); - const plugins = []; - const pluginUseBuiltIns = useBuiltIns !== false; - - if (modules !== false && moduleTransformations[modules]) { - // TODO: Remove the 'api.caller' check eventually. Just here to prevent - // unnecessary breakage in the short term for users on older betas/RCs. - const shouldTransformESM = - modules !== "auto" || !api.caller || !api.caller(supportsStaticESM); - const shouldTransformDynamicImport = - modules !== "auto" || !api.caller || !api.caller(supportsDynamicImport); - - if (shouldTransformESM) { - // NOTE: not giving spec here yet to avoid compatibility issues when - // transform-modules-commonjs gets its spec mode - plugins.push([getPlugin(moduleTransformations[modules]), { loose }]); - } - - if ( - shouldTransformDynamicImport && - shouldTransformESM && - modules !== "umd" - ) { - plugins.push([getPlugin("proposal-dynamic-import"), { loose }]); - } else { - if (shouldTransformDynamicImport) { - console.warn( - "Dynamic import can only be supported when transforming ES modules" + - " to AMD, CommonJS or SystemJS. Only the parser plugin will be enabled.", - ); - } - plugins.push(getPlugin("syntax-dynamic-import")); - } - } else { - plugins.push(getPlugin("syntax-dynamic-import")); - } + const polyfillPlugins = getPolyfillPlugins({ + useBuiltIns, + corejs, + polyfillTargets: targets, + include: include.builtIns, + exclude: exclude.builtIns, + proposals, + shippedProposals, + regenerator: pluginNames.has("transform-regenerator"), + debug, + }); - transformations.forEach(pluginName => - plugins.push([ + const pluginUseBuiltIns = useBuiltIns !== false; + const plugins = Array.from(pluginNames) + .map(pluginName => [ getPlugin(pluginName), { spec, loose, useBuiltIns: pluginUseBuiltIns }, - ]), - ); + ]) + .concat(polyfillPlugins); if (debug) { console.log("@babel/preset-env: `DEBUG` option"); @@ -174,8 +310,8 @@ export default declare((api, opts) => { console.log(JSON.stringify(prettifyTargets(targets), null, 2)); console.log(`\nUsing modules transform: ${modules.toString()}`); console.log("\nUsing plugins:"); - transformations.forEach(transform => { - logPluginOrPolyfill(transform, targets, pluginList); + pluginNames.forEach(pluginName => { + logPluginOrPolyfill(pluginName, targets, pluginsList); }); if (!useBuiltIns) { @@ -183,46 +319,10 @@ export default declare((api, opts) => { "\nUsing polyfills: No polyfills were added, since the `useBuiltIns` option was not set.", ); } else { + // NOTE: Polyfill plugins are outputting debug info internally console.log(`\nUsing polyfills with \`${useBuiltIns}\` option:`); } } - if (useBuiltIns === "usage" || useBuiltIns === "entry") { - const regenerator = transformations.has("transform-regenerator"); - - const pluginOptions = { - corejs, - polyfillTargets: targets, - include: include.builtIns, - exclude: exclude.builtIns, - proposals, - shippedProposals, - regenerator, - debug, - }; - - if (corejs) { - if (useBuiltIns === "usage") { - if (corejs.major === 2) { - plugins.push([addCoreJS2UsagePlugin, pluginOptions]); - } else { - plugins.push([addCoreJS3UsagePlugin, pluginOptions]); - } - if (regenerator) { - plugins.push([addRegeneratorUsagePlugin, pluginOptions]); - } - } else { - if (corejs.major === 2) { - plugins.push([replaceCoreJS2EntryPlugin, pluginOptions]); - } else { - plugins.push([replaceCoreJS3EntryPlugin, pluginOptions]); - if (!regenerator) { - plugins.push([removeRegeneratorEntryPlugin, pluginOptions]); - } - } - } - } - } - return { plugins }; }); diff --git a/packages/babel-preset-env/src/normalize-options.js b/packages/babel-preset-env/src/normalize-options.js index 76b13f5a7e39..1095880a3eba 100644 --- a/packages/babel-preset-env/src/normalize-options.js +++ b/packages/babel-preset-env/src/normalize-options.js @@ -1,14 +1,13 @@ // @flow import corejs3Polyfills from "core-js-compat/data"; +import findSuggestion from "levenary"; import invariant from "invariant"; import { coerce, SemVer } from "semver"; -import corejs2Polyfills from "../data/corejs2-built-ins.json"; -import pluginsList from "../data/plugins.json"; +import corejs2Polyfills from "@babel/compat-data/corejs2-built-ins"; +import { plugins as pluginsList } from "./plugins-compat-data"; import moduleTransformations from "./module-transformations"; import { TopLevelOptions, ModulesOption, UseBuiltInsOption } from "./options"; import { defaultWebIncludes } from "./polyfills/corejs2/get-platform-specific-default"; -import { isBrowsersQueryValid } from "./targets-parser"; -import { findSuggestion } from "./utils"; import type { BuiltInsOption, @@ -26,29 +25,35 @@ const validateTopLevelOptions = (options: Options) => { if (!TopLevelOptions[option]) { throw new Error( `Invalid Option: ${option} is not a valid top-level option. - Maybe you meant to use '${findSuggestion(validOptions, option)}'?`, + Maybe you meant to use '${findSuggestion(option, validOptions)}'?`, ); } } }; -const allPluginsList = [ - ...Object.keys(pluginsList), +const allPluginsList = Object.keys(pluginsList); + +// NOTE: Since module plugins are handled seperatly compared to other plugins (via the "modules" option) it +// should only be possible to exclude and not include module plugins, otherwise it's possible that preset-env +// will add a module plugin twice. +const modulePlugins = [ + "proposal-dynamic-import", ...Object.keys(moduleTransformations).map(m => moduleTransformations[m]), ]; -const validIncludesAndExcludesWithoutCoreJS = new Set(allPluginsList); - -const validIncludesAndExcludesWithCoreJS2 = new Set([ - ...allPluginsList, - ...Object.keys(corejs2Polyfills), - ...defaultWebIncludes, -]); - -const validIncludesAndExcludesWithCoreJS3 = new Set([ - ...allPluginsList, - ...Object.keys(corejs3Polyfills), -]); +const getValidIncludesAndExcludes = ( + type: "include" | "exclude", + corejs: number | false, +) => + new Set([ + ...allPluginsList, + ...(type === "exclude" ? modulePlugins : []), + ...(corejs + ? corejs == 2 + ? [...Object.keys(corejs2Polyfills), ...defaultWebIncludes] + : Object.keys(corejs3Polyfills) + : []), + ]); const pluginToRegExp = (plugin: PluginListItem) => { if (plugin instanceof RegExp) return plugin; @@ -59,14 +64,14 @@ const pluginToRegExp = (plugin: PluginListItem) => { } }; -const selectPlugins = (regexp: RegExp | null, corejs: number | false) => - Array.from( - corejs - ? corejs == 2 - ? validIncludesAndExcludesWithCoreJS2 - : validIncludesAndExcludesWithCoreJS3 - : validIncludesAndExcludesWithoutCoreJS, - ).filter(item => regexp instanceof RegExp && regexp.test(item)); +const selectPlugins = ( + regexp: RegExp | null, + type: "include" | "exclude", + corejs: number | false, +) => + Array.from(getValidIncludesAndExcludes(type, corejs)).filter( + item => regexp instanceof RegExp && regexp.test(item), + ); const flatten = (array: Array>): Array => [].concat(...array); @@ -78,7 +83,7 @@ const expandIncludesAndExcludes = ( if (plugins.length === 0) return []; const selectedPlugins = plugins.map(plugin => - selectPlugins(pluginToRegExp(plugin), corejs), + selectPlugins(pluginToRegExp(plugin), type, corejs), ); const invalidRegExpList = plugins.filter( (p, i) => selectedPlugins[i].length === 0, @@ -115,7 +120,7 @@ export const checkDuplicateIncludeExcludes = ( const normalizeTargets = targets => { // TODO: Allow to use only query or strings as a targets from next breaking change. - if (isBrowsersQueryValid(targets)) { + if (typeof targets === "string" || Array.isArray(targets)) { return { browsers: targets }; } return { @@ -162,8 +167,7 @@ export const validateModulesOption = ( modulesOpt: ModuleOption = ModulesOption.auto, ) => { invariant( - ModulesOption[modulesOpt.toString()] || - ModulesOption[modulesOpt.toString()] === ModulesOption.false, + ModulesOption[modulesOpt.toString()] || modulesOpt === ModulesOption.false, `Invalid Option: The 'modules' option must be one of \n` + ` - 'false' to indicate no module processing\n` + ` - a specific module type: 'commonjs', 'amd', 'umd', 'systemjs'` + @@ -179,7 +183,7 @@ export const validateUseBuiltInsOption = ( ) => { invariant( UseBuiltInsOption[builtInsOpt.toString()] || - UseBuiltInsOption[builtInsOpt.toString()] === UseBuiltInsOption.false, + builtInsOpt === UseBuiltInsOption.false, `Invalid Option: The 'useBuiltIns' option must be either 'false' (default) to indicate no polyfill, '"entry"' to indicate replacing the entry polyfill, or @@ -262,14 +266,18 @@ export default function normalizeOptions(opts: Options) { checkDuplicateIncludeExcludes(include, exclude); - const shippedProposals = - validateBoolOption( - TopLevelOptions.shippedProposals, - opts.shippedProposals, - false, - ) || corejs.proposals; + const shippedProposals = validateBoolOption( + TopLevelOptions.shippedProposals, + opts.shippedProposals, + false, + ); return { + bugfixes: validateBoolOption( + TopLevelOptions.bugfixes, + opts.bugfixes, + false, + ), configPath: validateConfigPathOption(opts.configPath), corejs, debug: validateBoolOption(TopLevelOptions.debug, opts.debug, false), diff --git a/packages/babel-preset-env/src/options.js b/packages/babel-preset-env/src/options.js index f8bf5d0bba6c..6ebfff2e0838 100644 --- a/packages/babel-preset-env/src/options.js +++ b/packages/babel-preset-env/src/options.js @@ -1,6 +1,7 @@ // @flow export const TopLevelOptions = { + bugfixes: "bugfixes", configPath: "configPath", corejs: "corejs", debug: "debug", @@ -31,22 +32,3 @@ export const UseBuiltInsOption = { entry: "entry", usage: "usage", }; - -export const TargetNames = { - esmodules: "esmodules", - node: "node", - browsers: "browsers", - chrome: "chrome", - opera: "opera", - edge: "edge", - firefox: "firefox", - safari: "safari", - ie: "ie", - ios: "ios", - android: "android", - electron: "electron", - samsung: "samsung", - - // deprecated - uglify: "uglify", -}; diff --git a/packages/babel-preset-env/src/plugins-compat-data.js b/packages/babel-preset-env/src/plugins-compat-data.js new file mode 100644 index 000000000000..132cabc562eb --- /dev/null +++ b/packages/babel-preset-env/src/plugins-compat-data.js @@ -0,0 +1,22 @@ +// @flow + +import plugins from "@babel/compat-data/plugins"; +import bugfixPlugins from "@babel/compat-data/plugin-bugfixes"; +import availablePlugins from "./available-plugins"; + +const pluginsFiltered = {}; +const bugfixPluginsFiltered = {}; + +for (const plugin of Object.keys(plugins)) { + if (Object.hasOwnProperty.call(availablePlugins, plugin)) { + pluginsFiltered[plugin] = plugins[plugin]; + } +} + +for (const plugin of Object.keys(bugfixPlugins)) { + if (Object.hasOwnProperty.call(availablePlugins, plugin)) { + bugfixPluginsFiltered[plugin] = bugfixPlugins[plugin]; + } +} + +export { pluginsFiltered as plugins, bugfixPluginsFiltered as pluginsBugfixes }; diff --git a/packages/babel-preset-env/src/polyfills/corejs2/entry-plugin.js b/packages/babel-preset-env/src/polyfills/corejs2/entry-plugin.js index 82fa4dd9f237..da8010e2c731 100644 --- a/packages/babel-preset-env/src/polyfills/corejs2/entry-plugin.js +++ b/packages/babel-preset-env/src/polyfills/corejs2/entry-plugin.js @@ -1,8 +1,8 @@ // @flow -import corejs2Polyfills from "../../../data/corejs2-built-ins.json"; +import corejs2Polyfills from "@babel/compat-data/corejs2-built-ins"; +import { filterItems } from "@babel/helper-compilation-targets"; import getPlatformSpecificDefaultFor from "./get-platform-specific-default"; -import filterItems from "../../filter-items"; import { createImport, isPolyfillSource, diff --git a/packages/babel-preset-env/src/polyfills/corejs2/get-platform-specific-default.js b/packages/babel-preset-env/src/polyfills/corejs2/get-platform-specific-default.js index aa89ebfb1900..3674a2be8d4e 100644 --- a/packages/babel-preset-env/src/polyfills/corejs2/get-platform-specific-default.js +++ b/packages/babel-preset-env/src/polyfills/corejs2/get-platform-specific-default.js @@ -1,6 +1,6 @@ // @flow -import type { Targets } from "../../types"; +import type { Targets } from "@babel/helper-compilation-targets"; export const defaultWebIncludes = [ "web.timers", diff --git a/packages/babel-preset-env/src/polyfills/corejs2/usage-plugin.js b/packages/babel-preset-env/src/polyfills/corejs2/usage-plugin.js index 038736100841..a9269237e5ae 100644 --- a/packages/babel-preset-env/src/polyfills/corejs2/usage-plugin.js +++ b/packages/babel-preset-env/src/polyfills/corejs2/usage-plugin.js @@ -1,8 +1,8 @@ // @flow -import corejs2Polyfills from "../../../data/corejs2-built-ins.json"; +import corejs2Polyfills from "@babel/compat-data/corejs2-built-ins"; +import { filterItems } from "@babel/helper-compilation-targets"; import getPlatformSpecificDefaultFor from "./get-platform-specific-default"; -import filterItems from "../../filter-items"; import { BuiltIns, StaticProperties, @@ -15,6 +15,7 @@ import { isPolyfillSource, getImportSource, getRequireSource, + isNamespaced, } from "../../utils"; import { logUsagePolyfills } from "../../debug"; @@ -102,8 +103,11 @@ export default function( const { node } = path; const { object, property } = node; + // ignore namespace + if (isNamespaced(path.get("object"))) return; + let evaluatedPropType = object.name; - let propertyName = property.name; + let propertyName = ""; let instanceType = ""; if (node.computed) { @@ -115,6 +119,8 @@ export default function( propertyName = result.value; } } + } else { + propertyName = property.name; } if (path.scope.getBindingIdentifier(object.name)) { diff --git a/packages/babel-preset-env/src/polyfills/corejs3/built-in-definitions.js b/packages/babel-preset-env/src/polyfills/corejs3/built-in-definitions.js index 656738f16fee..4b1ad78271d9 100644 --- a/packages/babel-preset-env/src/polyfills/corejs3/built-in-definitions.js +++ b/packages/babel-preset-env/src/polyfills/corejs3/built-in-definitions.js @@ -158,7 +158,7 @@ export const BuiltIns: ObjectMap = { compositeKey: ["esnext.composite-key"], compositeSymbol: ["esnext.composite-symbol", ...SymbolDependencies], fetch: PromiseDependencies, - globalThis: ["esnext.global-this"], + globalThis: ["es.global-this", "esnext.global-this"], parseFloat: ["es.parse-float"], parseInt: ["es.parse-int"], queueMicrotask: ["web.queue-microtask"], @@ -197,7 +197,7 @@ export const InstanceProperties: ObjectMap = { forEach: ["es.array.for-each", "web.dom-collections.for-each"], includes: ["es.array.includes", "es.string.includes"], indexOf: ["es.array.index-of"], - italic: ["es.string.italics"], + italics: ["es.string.italics"], join: ["es.array.join"], keys: ArrayNatureIteratorsWithTag, lastIndex: ["esnext.array.last-index"], @@ -205,7 +205,7 @@ export const InstanceProperties: ObjectMap = { lastItem: ["esnext.array.last-item"], link: ["es.string.link"], match: ["es.string.match", "es.regexp.exec"], - matchAll: ["esnext.string.match-all"], + matchAll: ["es.string.match-all", "esnext.string.match-all"], map: ["es.array.map"], name: ["es.function.name"], padEnd: ["es.string.pad-end"], @@ -215,7 +215,7 @@ export const InstanceProperties: ObjectMap = { repeat: ["es.string.repeat"], replace: ["es.string.replace", "es.regexp.exec"], replaceAll: ["esnext.string.replace-all"], - reverse: ["es.string.reverse"], + reverse: ["es.array.reverse"], search: ["es.string.search", "es.regexp.exec"], slice: ["es.array.slice"], small: ["es.string.small"], @@ -355,10 +355,15 @@ export const StaticProperties: ObjectMap> = { Promise: { all: PromiseDependenciesWithIterators, allSettled: [ + "es.promise.all-settled", "esnext.promise.all-settled", ...PromiseDependenciesWithIterators, ], - any: ["esnext.promise.any", ...PromiseDependenciesWithIterators], + any: [ + "esnext.promise.any", + "esnext.aggregate-error", + ...PromiseDependenciesWithIterators, + ], race: PromiseDependenciesWithIterators, try: ["esnext.promise.try", ...PromiseDependenciesWithIterators], }, diff --git a/packages/babel-preset-env/src/polyfills/corejs3/entry-plugin.js b/packages/babel-preset-env/src/polyfills/corejs3/entry-plugin.js index 1d8d3df0a2fa..3ec5875d2b85 100644 --- a/packages/babel-preset-env/src/polyfills/corejs3/entry-plugin.js +++ b/packages/babel-preset-env/src/polyfills/corejs3/entry-plugin.js @@ -3,13 +3,14 @@ import corejs3Polyfills from "core-js-compat/data"; import corejsEntries from "core-js-compat/entries"; import getModulesListForTargetVersion from "core-js-compat/get-modules-list-for-target-version"; -import filterItems from "../../filter-items"; +import { filterItems } from "@babel/helper-compilation-targets"; import { has, intersection, createImport, getImportSource, getRequireSource, + getModulePath, } from "../../utils"; import { logEntryPolyfills } from "../../debug"; @@ -48,6 +49,20 @@ export default function( const available = new Set(getModulesListForTargetVersion(corejs.version)); + function shouldReplace(source, modules) { + if (!modules) return false; + if ( + // Don't replace an import with itself to avoid an infinite loop + modules.length === 1 && + polyfills.has(modules[0]) && + available.has(modules[0]) && + getModulePath(modules[0]) === source + ) { + return false; + } + return true; + } + const isPolyfillImport = { ImportDeclaration(path: NodePath) { const source = getImportSource(path); @@ -56,24 +71,40 @@ export default function( console.warn(BABEL_POLYFILL_DEPRECATION); } else { const modules = isCoreJSSource(source); - if (modules) { + if (shouldReplace(source, modules)) { this.replaceBySeparateModulesImport(path, modules); } } }, - Program(path: NodePath) { - path.get("body").forEach(bodyPath => { - const source = getRequireSource(bodyPath); - if (!source) return; - if (isBabelPolyfillSource(source)) { - console.warn(BABEL_POLYFILL_DEPRECATION); - } else { - const modules = isCoreJSSource(source); - if (modules) { - this.replaceBySeparateModulesImport(bodyPath, modules); + Program: { + enter(path: NodePath) { + path.get("body").forEach(bodyPath => { + const source = getRequireSource(bodyPath); + if (!source) return; + if (isBabelPolyfillSource(source)) { + console.warn(BABEL_POLYFILL_DEPRECATION); + } else { + const modules = isCoreJSSource(source); + if (shouldReplace(source, modules)) { + this.replaceBySeparateModulesImport(bodyPath, modules); + } + } + }); + }, + exit(path: NodePath) { + const filtered = intersection(polyfills, this.polyfillsSet, available); + const reversed = Array.from(filtered).reverse(); + + for (const module of reversed) { + // Program:exit could be called multiple times. + // Avoid injecting the polyfills twice. + if (!this.injectedPolyfills.has(module)) { + createImport(path, module); } } - }); + + filtered.forEach(module => this.injectedPolyfills.add(module)); + }, }, }; @@ -81,6 +112,7 @@ export default function( name: "corejs3-entry", visitor: isPolyfillImport, pre() { + this.injectedPolyfills = new Set(); this.polyfillsSet = new Set(); this.replaceBySeparateModulesImport = function(path, modules) { @@ -91,19 +123,12 @@ export default function( path.remove(); }; }, - post({ path }: { path: NodePath }) { - const filtered = intersection(polyfills, this.polyfillsSet, available); - const reversed = Array.from(filtered).reverse(); - - for (const module of reversed) { - createImport(path, module); - } - + post() { if (debug) { logEntryPolyfills( "core-js", - this.polyfillsSet.size > 0, - filtered, + this.injectedPolyfills.size > 0, + this.injectedPolyfills, this.file.opts.filename, polyfillTargets, corejs3Polyfills, diff --git a/packages/babel-preset-env/src/polyfills/corejs3/shipped-proposals.js b/packages/babel-preset-env/src/polyfills/corejs3/shipped-proposals.js deleted file mode 100644 index c2d2ee875aa6..000000000000 --- a/packages/babel-preset-env/src/polyfills/corejs3/shipped-proposals.js +++ /dev/null @@ -1,3 +0,0 @@ -// @flow - -export default (["esnext.global-this", "esnext.string.match-all"]: string[]); diff --git a/packages/babel-preset-env/src/polyfills/corejs3/usage-plugin.js b/packages/babel-preset-env/src/polyfills/corejs3/usage-plugin.js index ea1e06492134..2b54fa7d2835 100644 --- a/packages/babel-preset-env/src/polyfills/corejs3/usage-plugin.js +++ b/packages/babel-preset-env/src/polyfills/corejs3/usage-plugin.js @@ -1,9 +1,9 @@ // @flow import corejs3Polyfills from "core-js-compat/data"; -import corejs3ShippedProposalsList from "./shipped-proposals"; +import corejs3ShippedProposalsList from "@babel/compat-data/corejs3-shipped-proposals"; import getModulesListForTargetVersion from "core-js-compat/get-modules-list-for-target-version"; -import filterItems from "../../filter-items"; +import { filterItems } from "@babel/helper-compilation-targets"; import { BuiltIns, StaticProperties, @@ -21,6 +21,7 @@ import { isPolyfillSource, getImportSource, getRequireSource, + isNamespaced, } from "../../utils"; import { logUsagePolyfills } from "../../debug"; @@ -38,7 +39,7 @@ const corejs3PolyfillsWithoutProposals = Object.keys(corejs3Polyfills) return memo; }, {}); -const corejs3PolyfillsWithShippedProposals = corejs3ShippedProposalsList.reduce( +const corejs3PolyfillsWithShippedProposals = (corejs3ShippedProposalsList: string[]).reduce( (memo, key) => { memo[key] = corejs3Polyfills[key]; return memo; @@ -98,7 +99,7 @@ export default function( } } } - return { builtIn, instanceType }; + return { builtIn, instanceType, isNamespaced: isNamespaced(path) }; } const addAndRemovePolyfillImports = { @@ -111,13 +112,30 @@ export default function( }, // require('core-js') - Program(path: NodePath) { - path.get("body").forEach(bodyPath => { - if (isPolyfillSource(getRequireSource(bodyPath))) { - console.warn(NO_DIRECT_POLYFILL_IMPORT); - bodyPath.remove(); + Program: { + enter(path: NodePath) { + path.get("body").forEach(bodyPath => { + if (isPolyfillSource(getRequireSource(bodyPath))) { + console.warn(NO_DIRECT_POLYFILL_IMPORT); + bodyPath.remove(); + } + }); + }, + + exit(path: NodePath) { + const filtered = intersection(polyfills, this.polyfillsSet, available); + const reversed = Array.from(filtered).reverse(); + + for (const module of reversed) { + // Program:exit could be called multiple times. + // Avoid injecting the polyfills twice. + if (!this.injectedPolyfills.has(module)) { + createImport(path, module); + } } - }); + + filtered.forEach(module => this.injectedPolyfills.add(module)); + }, }, // import('something').then(...) @@ -213,6 +231,7 @@ export default function( return { name: "corejs3-usage", pre() { + this.injectedPolyfills = new Set(); this.polyfillsSet = new Set(); this.addUnsupported = function(builtIn) { @@ -230,7 +249,8 @@ export default function( }; this.addPropertyDependencies = function(source = {}, key) { - const { builtIn, instanceType } = source; + const { builtIn, instanceType, isNamespaced } = source; + if (isNamespaced) return; if (PossibleGlobalObjects.has(builtIn)) { this.addBuiltInDependencies(key); } else if (has(StaticProperties, builtIn)) { @@ -250,17 +270,10 @@ export default function( this.addUnsupported(InstancePropertyDependencies); }; }, - post({ path }: { path: NodePath }) { - const filtered = intersection(polyfills, this.polyfillsSet, available); - const reversed = Array.from(filtered).reverse(); - - for (const module of reversed) { - createImport(path, module); - } - + post() { if (debug) { logUsagePolyfills( - filtered, + this.injectedPolyfills, this.file.opts.filename, polyfillTargets, corejs3Polyfills, diff --git a/packages/babel-preset-env/src/polyfills/regenerator/entry-plugin.js b/packages/babel-preset-env/src/polyfills/regenerator/entry-plugin.js index a7872ac5429f..53db45877398 100644 --- a/packages/babel-preset-env/src/polyfills/regenerator/entry-plugin.js +++ b/packages/babel-preset-env/src/polyfills/regenerator/entry-plugin.js @@ -33,10 +33,13 @@ export default function() { }, post() { if (this.opts.debug && this.regeneratorImportExcluded) { + let filename = this.file.opts.filename; + // normalize filename to generate consistent preset-env test fixtures + if (process.env.BABEL_ENV === "test") { + filename = filename.replace(/\\/g, "/"); + } console.log( - `\n[${ - this.file.opts.filename - }] Based on your targets, regenerator-runtime import excluded.`, + `\n[${filename}] Based on your targets, regenerator-runtime import excluded.`, ); } }, diff --git a/packages/babel-preset-env/src/polyfills/regenerator/usage-plugin.js b/packages/babel-preset-env/src/polyfills/regenerator/usage-plugin.js index 36ac15502b18..f417cf248de8 100644 --- a/packages/babel-preset-env/src/polyfills/regenerator/usage-plugin.js +++ b/packages/babel-preset-env/src/polyfills/regenerator/usage-plugin.js @@ -21,10 +21,13 @@ export default function() { }, post() { if (this.opts.debug && this.usesRegenerator) { + let filename = this.file.opts.filename; + // normalize filename to generate consistent preset-env test fixtures + if (process.env.BABEL_ENV === "test") { + filename = filename.replace(/\\/g, "/"); + } console.log( - `\n[${ - this.file.opts.filename - }] Based on your code and targets, added regenerator-runtime.`, + `\n[${filename}] Based on your code and targets, added regenerator-runtime.`, ); } }, diff --git a/packages/babel-preset-env/src/targets-parser.js b/packages/babel-preset-env/src/targets-parser.js index 4c006bf2f073..3697cb58f26f 100644 --- a/packages/babel-preset-env/src/targets-parser.js +++ b/packages/babel-preset-env/src/targets-parser.js @@ -1,265 +1,7 @@ -// @flow +// TODO: Remove in Babel 8 -import browserslist from "browserslist"; -import invariant from "invariant"; -import semver from "semver"; -import { - semverify, - isUnreleasedVersion, - getLowestUnreleased, - findSuggestion, -} from "./utils"; -import browserModulesData from "../data/built-in-modules.json"; -import { TargetNames } from "./options"; -import type { Targets } from "./types"; - -const browserslistDefaults = browserslist.defaults; - -const validBrowserslistTargets = [ - ...Object.keys(browserslist.data), - ...Object.keys(browserslist.aliases), -]; - -const objectToBrowserslist = (object: Targets): Array => { - return Object.keys(object).reduce((list, targetName) => { - if (validBrowserslistTargets.indexOf(targetName) >= 0) { - const targetVersion = object[targetName]; - return list.concat(`${targetName} ${targetVersion}`); - } - return list; - }, []); -}; - -const validateTargetNames = (targets: Targets): void => { - const validTargets = Object.keys(TargetNames); - for (const target in targets) { - if (!TargetNames[target]) { - throw new Error( - `Invalid Option: '${target}' is not a valid target - Maybe you meant to use '${findSuggestion(validTargets, target)}'?`, - ); - } - } -}; - -const browserNameMap = { - and_chr: "chrome", - and_ff: "firefox", - android: "android", - chrome: "chrome", - edge: "edge", - firefox: "firefox", - ie: "ie", - ie_mob: "ie", - ios_saf: "ios", - node: "node", - op_mob: "opera", - opera: "opera", - safari: "safari", - samsung: "samsung", -}; - -export const isBrowsersQueryValid = ( - browsers: string | Array | Targets, -): boolean => typeof browsers === "string" || Array.isArray(browsers); - -const validateBrowsers = browsers => { - invariant( - typeof browsers === "undefined" || isBrowsersQueryValid(browsers), - `Invalid Option: '${browsers}' is not a valid browserslist query`, - ); - - return browsers; -}; - -export const semverMin = (first: ?string, second: string): string => { - return first && semver.lt(first, second) ? first : second; -}; - -const mergeBrowsers = (fromQuery: Targets, fromTarget: Targets) => { - return Object.keys(fromTarget).reduce((queryObj, targKey) => { - if (targKey !== TargetNames.browsers) { - queryObj[targKey] = fromTarget[targKey]; - } - return queryObj; - }, fromQuery); -}; - -const getLowestVersions = (browsers: Array): Targets => { - return browsers.reduce((all: Object, browser: string): Object => { - const [browserName, browserVersion] = browser.split(" "); - const normalizedBrowserName = browserNameMap[browserName]; - - if (!normalizedBrowserName) { - return all; - } - - try { - // Browser version can return as "10.0-10.2" - const splitVersion = browserVersion.split("-")[0].toLowerCase(); - const isSplitUnreleased = isUnreleasedVersion(splitVersion, browserName); - - if (!all[normalizedBrowserName]) { - all[normalizedBrowserName] = isSplitUnreleased - ? splitVersion - : semverify(splitVersion); - return all; - } - - const version = all[normalizedBrowserName]; - const isUnreleased = isUnreleasedVersion(version, browserName); - - if (isUnreleased && isSplitUnreleased) { - all[normalizedBrowserName] = getLowestUnreleased( - version, - splitVersion, - browserName, - ); - } else if (isUnreleased) { - all[normalizedBrowserName] = semverify(splitVersion); - } else if (!isUnreleased && !isSplitUnreleased) { - const parsedBrowserVersion = semverify(splitVersion); - - all[normalizedBrowserName] = semverMin(version, parsedBrowserVersion); - } - } catch (e) {} - - return all; - }, {}); -}; - -const outputDecimalWarning = (decimalTargets: Array): void => { - if (!decimalTargets || !decimalTargets.length) { - return; - } - - console.log("Warning, the following targets are using a decimal version:"); - console.log(""); - decimalTargets.forEach(({ target, value }) => - console.log(` ${target}: ${value}`), - ); - console.log(""); - console.log( - "We recommend using a string for minor/patch versions to avoid numbers like 6.10", - ); - console.log("getting parsed as 6.1, which can lead to unexpected behavior."); - console.log(""); -}; - -const semverifyTarget = (target, value) => { - try { - return semverify(value); - } catch (error) { - throw new Error( - `Invalid Option: '${value}' is not a valid value for 'targets.${target}'.`, - ); - } -}; - -const targetParserMap = { - __default: (target, value) => { - const version = isUnreleasedVersion(value, target) - ? value.toLowerCase() - : semverifyTarget(target, value); - return [target, version]; - }, - - // Parse `node: true` and `node: "current"` to version - node: (target, value) => { - const parsed = - value === true || value === "current" - ? process.versions.node - : semverifyTarget(target, value); - return [target, parsed]; - }, -}; - -type ParsedResult = { - targets: Targets, - decimalWarnings: Array, -}; - -const getTargets = (targets: Object = {}, options: Object = {}): Targets => { - const targetOpts: Targets = {}; - - validateTargetNames(targets); - - // `esmodules` as a target indicates the specific set of browsers supporting ES Modules. - // These values OVERRIDE the `browsers` field. - if (targets.esmodules) { - const supportsESModules = browserModulesData["es6.module"]; - targets.browsers = Object.keys(supportsESModules) - .map(browser => `${browser} ${supportsESModules[browser]}`) - .join(", "); - } - - // Parse browsers target via browserslist - const browsersquery = validateBrowsers(targets.browsers); - - const hasTargets = Object.keys(targets).length > 0; - const shouldParseBrowsers = !!targets.browsers; - const shouldSearchForConfig = - !options.ignoreBrowserslistConfig && !hasTargets; - - if (shouldParseBrowsers || shouldSearchForConfig) { - // If no targets are passed, we need to overwrite browserslist's defaults - // so that we enable all transforms (acting like the now deprecated - // preset-latest). - // - // Note, if browserslist resolves the config (ex. package.json), then usage - // of `defaults` in queries will be different since we don't want to break - // the behavior of "no targets is the same as preset-latest". - if (!hasTargets) { - browserslist.defaults = objectToBrowserslist(targets); - } - - const browsers = browserslist(browsersquery, { - path: options.configPath, - mobileToDesktop: true, - }); - - const queryBrowsers = getLowestVersions(browsers); - targets = mergeBrowsers(queryBrowsers, targets); - - // Reset browserslist defaults - browserslist.defaults = browserslistDefaults; - } - - // Parse remaining targets - const parsed = Object.keys(targets) - .filter(value => value !== TargetNames.esmodules) - .sort() - .reduce( - (results: ParsedResult, target: string): ParsedResult => { - if (target !== TargetNames.browsers) { - const value = targets[target]; - - // Warn when specifying minor/patch as a decimal - if (typeof value === "number" && value % 1 !== 0) { - results.decimalWarnings.push({ target, value }); - } - - // Check if we have a target parser? - const parser = targetParserMap[target] || targetParserMap.__default; - const [parsedTarget, parsedValue] = parser(target, value); - - if (parsedValue) { - // Merge (lowest wins) - results.targets[parsedTarget] = parsedValue; - } - } - - return results; - }, - { - targets: targetOpts, - decimalWarnings: [], - }, - ); - - outputDecimalWarning(parsed.decimalWarnings); - - return parsed.targets; -}; - -export default getTargets; +export { + default, + isBrowsersQueryValid, + semverMin, +} from "@babel/helper-compilation-targets"; diff --git a/packages/babel-preset-env/src/types.js b/packages/babel-preset-env/src/types.js index c1c3157eb27d..4e81d5eef0eb 100644 --- a/packages/babel-preset-env/src/types.js +++ b/packages/babel-preset-env/src/types.js @@ -2,24 +2,7 @@ import { ModulesOption, UseBuiltInsOption } from "./options"; import type { NormalizedCorejsOption } from "./normalize-options"; - -// Targets -export type Target = - | "node" - | "chrome" - | "opera" - | "edge" - | "firefox" - | "safari" - | "ie" - | "ios" - | "android" - | "electron" - | "samsung"; - -export type Targets = { - [target: Target]: string, -}; +import type { Targets } from "@babel/helper-compilation-targets"; // Options // Use explicit modules to prevent typo errors. @@ -37,6 +20,7 @@ export type PluginListItem = string | RegExp; export type PluginListOption = Array; export type Options = { + bugfixes: boolean, configPath: string, corejs: CorejsOption, debug: boolean, diff --git a/packages/babel-preset-env/src/utils.js b/packages/babel-preset-env/src/utils.js index 81c1c3721c99..2630f5a1c428 100644 --- a/packages/babel-preset-env/src/utils.js +++ b/packages/babel-preset-env/src/utils.js @@ -2,13 +2,8 @@ import * as t from "@babel/types"; import type { NodePath } from "@babel/traverse"; -import invariant from "invariant"; -import semver from "semver"; -import levenshtein from "js-levenshtein"; import { addSideEffect } from "@babel/helper-module-imports"; -import unreleasedLabels from "../data/unreleased-labels"; -import { semverMin } from "./targets-parser"; -import type { Targets } from "./types"; +import type { Targets } from "@babel/helper-compilation-targets"; export const has = Object.hasOwnProperty.call.bind(Object.hasOwnProperty); @@ -19,28 +14,6 @@ export function getType(target: any): string { .toLowerCase(); } -const versionRegExp = /^(\d+|\d+.\d+)$/; - -// Convert version to a semver value. -// 2.5 -> 2.5.0; 1 -> 1.0.0; -export function semverify(version: number | string): string { - if (typeof version === "string" && semver.valid(version)) { - return version; - } - - invariant( - typeof version === "number" || - (typeof version === "string" && versionRegExp.test(version)), - `'${version}' is not a valid version`, - ); - - const split = version.toString().split("."); - while (split.length < 3) { - split.push("0"); - } - return split.join("."); -} - export function intersection( first: Set, second: Set, @@ -53,77 +26,12 @@ export function intersection( return result; } -export function findSuggestion(options: string[], option: string): string { - let levenshteinValue = Infinity; - return options.reduce((suggestion, validOption) => { - const value = levenshtein(validOption, option); - if (value < levenshteinValue) { - levenshteinValue = value; - return validOption; - } - return suggestion; - }, undefined); -} - -export function prettifyVersion(version: string) { - if (typeof version !== "string") { - return version; - } - - const parts = [semver.major(version)]; - const minor = semver.minor(version); - const patch = semver.patch(version); - - if (minor || patch) { - parts.push(minor); - } - - if (patch) { - parts.push(patch); - } - - return parts.join("."); -} - -export function prettifyTargets(targets: Targets): Targets { - return Object.keys(targets).reduce((results, target) => { - let value = targets[target]; - - const unreleasedLabel = unreleasedLabels[target]; - if (typeof value === "string" && unreleasedLabel !== value) { - value = prettifyVersion(value); - } - - results[target] = value; - return results; - }, {}); -} - -export function isUnreleasedVersion( - version: string | number, - env: string, -): boolean { - const unreleasedLabel = unreleasedLabels[env]; - return ( - !!unreleasedLabel && unreleasedLabel === version.toString().toLowerCase() - ); -} - -export function getLowestUnreleased(a: string, b: string, env: string): string { - const unreleasedLabel = unreleasedLabels[env]; - const hasUnreleased = [a, b].some(item => item === unreleasedLabel); - if (hasUnreleased) { - return a === hasUnreleased ? b : a || b; - } - return semverMin(a, b); -} - export function filterStageFromList( list: { [feature: string]: Targets }, - stageList: { [feature: string]: boolean }, + stageList: Set, ) { return Object.keys(list).reduce((result, item) => { - if (!stageList[item]) { + if (!stageList.has(item)) { result[item] = list[item]; } @@ -162,3 +70,10 @@ export function getModulePath(mod: string): string { export function createImport(path: NodePath, mod: string) { return addSideEffect(path, getModulePath(mod)); } + +export function isNamespaced(path: NodePath) { + if (!path.node) return false; + const binding = path.scope.getBinding(path.node.name); + if (!binding) return false; + return binding.path.isImportNamespaceSpecifier(); +} diff --git a/packages/babel-preset-env/test/debug-fixtures.js b/packages/babel-preset-env/test/debug-fixtures.js deleted file mode 100644 index 959a2fd133b5..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures.js +++ /dev/null @@ -1,148 +0,0 @@ -const child = require("child_process"); -const fs = require("fs-extra"); -const helper = require("@babel/helper-fixtures"); -const path = require("path"); - -const fixtureLoc = path.join(__dirname, "debug-fixtures"); -const tmpLoc = path.join(__dirname, "tmp"); - -const clear = () => { - process.chdir(__dirname); - if (fs.existsSync(tmpLoc)) fs.removeSync(tmpLoc); - fs.mkdirSync(tmpLoc); - process.chdir(tmpLoc); -}; - -const saveInFiles = files => { - Object.keys(files).forEach(filename => { - const content = files[filename]; - fs.outputFileSync(filename, content); - }); -}; - -const testOutputType = (type, stdTarg, opts) => { - stdTarg = stdTarg.trim(); - stdTarg = stdTarg.replace(/\\/g, "/"); - const optsTarg = opts[type]; - - if (optsTarg) { - const expectStdout = optsTarg.trim(); - expect(stdTarg).toBe(expectStdout); - } else { - const file = path.join(opts.testLoc, `${type}.txt`); - console.log(`New test file created: ${file}`); - fs.outputFileSync(file, stdTarg); - } -}; - -const assertTest = (stdout, stderr, opts) => { - testOutputType("stdout", stdout, opts); - if (stderr) { - testOutputType("stderr", stderr, opts); - } -}; - -const buildTest = opts => { - const binLoc = require.resolve("@babel/cli/bin/babel"); - - return callback => { - clear(); - saveInFiles(opts.inFiles); - - let args = [binLoc]; - args = args.concat(opts.args); - - const spawn = child.spawn(process.execPath, args, { - cwd: tmpLoc, - }); - - let stdout = ""; - let stderr = ""; - - spawn.stdout.on("data", chunk => (stdout += chunk)); - spawn.stderr.on("data", chunk => (stderr += chunk)); - - spawn.on("close", () => { - let err; - - try { - stdout = replacePaths(stdout); - stderr = replacePaths(stderr); - - assertTest(stdout, stderr, opts); - } catch (e) { - err = e; - } - - callback(err); - }); - }; -}; - -function replacePaths(str) { - let prev; - do { - prev = str; - str = str.replace(tmpLoc, ""); - } while (str !== prev); - - return str; -} - -describe("debug output", () => { - let cwd; - - beforeEach(() => { - cwd = process.cwd(); - }); - - afterEach(() => { - process.chdir(cwd); - }); - - fs.readdirSync(fixtureLoc).forEach(testName => { - if (testName.slice(0, 1) === ".") return; - const testLoc = path.join(fixtureLoc, testName); - - const opts = { - args: ["src", "--out-dir", "lib"], - testLoc: testLoc, - }; - - const stdoutLoc = path.join(testLoc, "stdout.txt"); - const stderrLoc = path.join(testLoc, "stderr.txt"); - - if (fs.existsSync(stdoutLoc)) { - opts.stdout = helper.readFile(stdoutLoc); - } - - if (fs.existsSync(stderrLoc)) { - opts.stderr = helper.readFile(stderrLoc); - } - - const optionsLoc = path.join(testLoc, "options.json"); - - if (!fs.existsSync(optionsLoc)) { - throw new Error( - `Debug test '${testName}' is missing an options.json file`, - ); - } - - const inFilesFolderLoc = path.join(testLoc, "in"); - - opts.inFiles = { - ".babelrc": helper.readFile(optionsLoc), - }; - - if (!fs.existsSync(inFilesFolderLoc)) { - opts.inFiles["src/in.js"] = ""; - } else { - fs.readdirSync(inFilesFolderLoc).forEach(filename => { - opts.inFiles[`src/${filename}`] = helper.readFile( - path.join(inFilesFolderLoc, filename), - ); - }); - } - it(testName, buildTest(opts)); - }); -}); diff --git a/packages/babel-preset-env/test/debug-fixtures/corejs-without-usebuiltins/options.json b/packages/babel-preset-env/test/debug-fixtures/corejs-without-usebuiltins/options.json deleted file mode 100644 index 5e051fe4e1b1..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/corejs-without-usebuiltins/options.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "presets": [ - ["../../lib", { - "debug": true, - "corejs": 3 - }] - ] -} diff --git a/packages/babel-preset-env/test/debug-fixtures/corejs-without-usebuiltins/stdout.txt b/packages/babel-preset-env/test/debug-fixtures/corejs-without-usebuiltins/stdout.txt deleted file mode 100644 index 1480ffe6bec5..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/corejs-without-usebuiltins/stdout.txt +++ /dev/null @@ -1,45 +0,0 @@ -The `corejs` option only has an effect when the `useBuiltIns` option is not `false` - -@babel/preset-env: `DEBUG` option - -Using targets: -{} - -Using modules transform: auto - -Using plugins: - transform-template-literals {} - transform-literals {} - transform-function-name {} - transform-arrow-functions {} - transform-block-scoped-functions {} - transform-classes {} - transform-object-super {} - transform-shorthand-properties {} - transform-duplicate-keys {} - transform-computed-properties {} - transform-for-of {} - transform-sticky-regex {} - transform-dotall-regex {} - transform-unicode-regex {} - transform-spread {} - transform-parameters {} - transform-destructuring {} - transform-block-scoping {} - transform-typeof-symbol {} - transform-new-target {} - transform-regenerator {} - transform-exponentiation-operator {} - transform-async-to-generator {} - proposal-async-generator-functions {} - proposal-object-rest-spread {} - proposal-unicode-property-regex {} - proposal-json-strings {} - proposal-optional-catch-binding {} - transform-named-capturing-groups-regex {} - transform-member-expression-literals {} - transform-property-literals {} - transform-reserved-words {} - -Using polyfills: No polyfills were added, since the `useBuiltIns` option was not set. -Successfully compiled 1 file with Babel. \ No newline at end of file diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs2-android/options.json b/packages/babel-preset-env/test/debug-fixtures/entry-corejs2-android/options.json deleted file mode 100644 index 4874a2298d1e..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-corejs2-android/options.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "presets": [ - ["../../lib", { - "debug": true, - "targets": { - "browsers": [ "Android >= 4" ] - }, - "useBuiltIns": "entry", - "corejs": 2 - }] - ] -} diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs2-android/stdout.txt b/packages/babel-preset-env/test/debug-fixtures/entry-corejs2-android/stdout.txt deleted file mode 100644 index f3d91c14ed87..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-corejs2-android/stdout.txt +++ /dev/null @@ -1,159 +0,0 @@ -@babel/preset-env: `DEBUG` option - -Using targets: -{ - "android": "4" -} - -Using modules transform: auto - -Using plugins: - transform-template-literals { "android":"4" } - transform-literals { "android":"4" } - transform-function-name { "android":"4" } - transform-arrow-functions { "android":"4" } - transform-block-scoped-functions { "android":"4" } - transform-classes { "android":"4" } - transform-object-super { "android":"4" } - transform-shorthand-properties { "android":"4" } - transform-duplicate-keys { "android":"4" } - transform-computed-properties { "android":"4" } - transform-for-of { "android":"4" } - transform-sticky-regex { "android":"4" } - transform-dotall-regex { "android":"4" } - transform-unicode-regex { "android":"4" } - transform-spread { "android":"4" } - transform-parameters { "android":"4" } - transform-destructuring { "android":"4" } - transform-block-scoping { "android":"4" } - transform-typeof-symbol { "android":"4" } - transform-new-target { "android":"4" } - transform-regenerator { "android":"4" } - transform-exponentiation-operator { "android":"4" } - transform-async-to-generator { "android":"4" } - proposal-async-generator-functions { "android":"4" } - proposal-object-rest-spread { "android":"4" } - proposal-unicode-property-regex { "android":"4" } - proposal-json-strings { "android":"4" } - proposal-optional-catch-binding { "android":"4" } - transform-named-capturing-groups-regex { "android":"4" } - transform-reserved-words { "android":"4" } - -Using polyfills with `entry` option: - -[/src/in.js] Replaced @babel/polyfill entries with the following polyfills: - es6.array.copy-within { "android":"4" } - es6.array.fill { "android":"4" } - es6.array.find { "android":"4" } - es6.array.find-index { "android":"4" } - es7.array.flat-map { "android":"4" } - es6.array.from { "android":"4" } - es7.array.includes { "android":"4" } - es6.array.iterator { "android":"4" } - es6.array.of { "android":"4" } - es6.array.sort { "android":"4" } - es6.array.species { "android":"4" } - es6.date.to-primitive { "android":"4" } - es6.function.has-instance { "android":"4" } - es6.map { "android":"4" } - es6.math.acosh { "android":"4" } - es6.math.asinh { "android":"4" } - es6.math.atanh { "android":"4" } - es6.math.cbrt { "android":"4" } - es6.math.clz32 { "android":"4" } - es6.math.cosh { "android":"4" } - es6.math.expm1 { "android":"4" } - es6.math.fround { "android":"4" } - es6.math.hypot { "android":"4" } - es6.math.imul { "android":"4" } - es6.math.log1p { "android":"4" } - es6.math.log10 { "android":"4" } - es6.math.log2 { "android":"4" } - es6.math.sign { "android":"4" } - es6.math.sinh { "android":"4" } - es6.math.tanh { "android":"4" } - es6.math.trunc { "android":"4" } - es6.number.constructor { "android":"4" } - es6.number.epsilon { "android":"4" } - es6.number.is-finite { "android":"4" } - es6.number.is-integer { "android":"4" } - es6.number.is-nan { "android":"4" } - es6.number.is-safe-integer { "android":"4" } - es6.number.max-safe-integer { "android":"4" } - es6.number.min-safe-integer { "android":"4" } - es6.number.parse-float { "android":"4" } - es6.number.parse-int { "android":"4" } - es6.object.assign { "android":"4" } - es7.object.define-getter { "android":"4" } - es7.object.define-setter { "android":"4" } - es7.object.entries { "android":"4" } - es6.object.freeze { "android":"4" } - es6.object.get-own-property-descriptor { "android":"4" } - es7.object.get-own-property-descriptors { "android":"4" } - es6.object.get-own-property-names { "android":"4" } - es6.object.get-prototype-of { "android":"4" } - es7.object.lookup-getter { "android":"4" } - es7.object.lookup-setter { "android":"4" } - es6.object.prevent-extensions { "android":"4" } - es6.object.to-string { "android":"4" } - es6.object.is { "android":"4" } - es6.object.is-frozen { "android":"4" } - es6.object.is-sealed { "android":"4" } - es6.object.is-extensible { "android":"4" } - es6.object.keys { "android":"4" } - es6.object.seal { "android":"4" } - es6.object.set-prototype-of { "android":"4" } - es7.object.values { "android":"4" } - es6.promise { "android":"4" } - es7.promise.finally { "android":"4" } - es6.reflect.apply { "android":"4" } - es6.reflect.construct { "android":"4" } - es6.reflect.define-property { "android":"4" } - es6.reflect.delete-property { "android":"4" } - es6.reflect.get { "android":"4" } - es6.reflect.get-own-property-descriptor { "android":"4" } - es6.reflect.get-prototype-of { "android":"4" } - es6.reflect.has { "android":"4" } - es6.reflect.is-extensible { "android":"4" } - es6.reflect.own-keys { "android":"4" } - es6.reflect.prevent-extensions { "android":"4" } - es6.reflect.set { "android":"4" } - es6.reflect.set-prototype-of { "android":"4" } - es6.regexp.constructor { "android":"4" } - es6.regexp.flags { "android":"4" } - es6.regexp.match { "android":"4" } - es6.regexp.replace { "android":"4" } - es6.regexp.split { "android":"4" } - es6.regexp.search { "android":"4" } - es6.regexp.to-string { "android":"4" } - es6.set { "android":"4" } - es6.symbol { "android":"4" } - es7.symbol.async-iterator { "android":"4" } - es6.string.code-point-at { "android":"4" } - es6.string.ends-with { "android":"4" } - es6.string.from-code-point { "android":"4" } - es6.string.includes { "android":"4" } - es6.string.iterator { "android":"4" } - es7.string.pad-start { "android":"4" } - es7.string.pad-end { "android":"4" } - es6.string.raw { "android":"4" } - es6.string.repeat { "android":"4" } - es6.string.starts-with { "android":"4" } - es7.string.trim-left { "android":"4" } - es7.string.trim-right { "android":"4" } - es6.typed.array-buffer { "android":"4" } - es6.typed.int8-array { "android":"4" } - es6.typed.uint8-array { "android":"4" } - es6.typed.uint8-clamped-array { "android":"4" } - es6.typed.int16-array { "android":"4" } - es6.typed.uint16-array { "android":"4" } - es6.typed.int32-array { "android":"4" } - es6.typed.uint32-array { "android":"4" } - es6.typed.float32-array { "android":"4" } - es6.typed.float64-array { "android":"4" } - es6.weak-map { "android":"4" } - es6.weak-set { "android":"4" } - web.timers { "android":"4" } - web.immediate { "android":"4" } - web.dom.iterable { "android":"4" } -Successfully compiled 1 file with Babel. \ No newline at end of file diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs2-electron/options.json b/packages/babel-preset-env/test/debug-fixtures/entry-corejs2-electron/options.json deleted file mode 100644 index 7055c2d63318..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-corejs2-electron/options.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "presets": [ - ["../../lib", { - "debug": true, - "targets": { - "electron": 0.36 - }, - "useBuiltIns": "entry", - "corejs": 2 - }] - ] -} diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs2-electron/stdout.txt b/packages/babel-preset-env/test/debug-fixtures/entry-corejs2-electron/stdout.txt deleted file mode 100644 index e0c6a95adc0d..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-corejs2-electron/stdout.txt +++ /dev/null @@ -1,134 +0,0 @@ -Warning, the following targets are using a decimal version: - - electron: 0.36 - -We recommend using a string for minor/patch versions to avoid numbers like 6.10 -getting parsed as 6.1, which can lead to unexpected behavior. - -@babel/preset-env: `DEBUG` option - -Using targets: -{ - "electron": "0.36" -} - -Using modules transform: auto - -Using plugins: - transform-function-name { "electron":"0.36" } - transform-for-of { "electron":"0.36" } - transform-sticky-regex { "electron":"0.36" } - transform-dotall-regex { "electron":"0.36" } - transform-unicode-regex { "electron":"0.36" } - transform-parameters { "electron":"0.36" } - transform-destructuring { "electron":"0.36" } - transform-block-scoping { "electron":"0.36" } - transform-regenerator { "electron":"0.36" } - transform-exponentiation-operator { "electron":"0.36" } - transform-async-to-generator { "electron":"0.36" } - proposal-async-generator-functions { "electron":"0.36" } - proposal-object-rest-spread { "electron":"0.36" } - proposal-unicode-property-regex { "electron":"0.36" } - proposal-json-strings { "electron":"0.36" } - proposal-optional-catch-binding { "electron":"0.36" } - transform-named-capturing-groups-regex { "electron":"0.36" } - transform-member-expression-literals { "electron":"0.36" } - transform-property-literals { "electron":"0.36" } - -Using polyfills with `entry` option: - -[/src/in.js] Replaced @babel/polyfill entries with the following polyfills: - es6.array.every { "electron":"0.36" } - es6.array.filter { "electron":"0.36" } - es7.array.flat-map { "electron":"0.36" } - es6.array.for-each { "electron":"0.36" } - es6.array.from { "electron":"0.36" } - es6.array.index-of { "electron":"0.36" } - es6.array.is-array { "electron":"0.36" } - es6.array.last-index-of { "electron":"0.36" } - es6.array.map { "electron":"0.36" } - es6.array.reduce { "electron":"0.36" } - es6.array.reduce-right { "electron":"0.36" } - es6.array.some { "electron":"0.36" } - es6.array.sort { "electron":"0.36" } - es6.array.species { "electron":"0.36" } - es6.date.now { "electron":"0.36" } - es6.date.to-iso-string { "electron":"0.36" } - es6.date.to-json { "electron":"0.36" } - es6.date.to-string { "electron":"0.36" } - es6.function.bind { "electron":"0.36" } - es6.function.has-instance { "electron":"0.36" } - es6.function.name { "electron":"0.36" } - es6.map { "electron":"0.36" } - es6.object.assign { "electron":"0.36" } - es6.object.create { "electron":"0.36" } - es7.object.define-getter { "electron":"0.36" } - es7.object.define-setter { "electron":"0.36" } - es6.object.define-property { "electron":"0.36" } - es6.object.define-properties { "electron":"0.36" } - es7.object.entries { "electron":"0.36" } - es7.object.get-own-property-descriptors { "electron":"0.36" } - es7.object.lookup-getter { "electron":"0.36" } - es7.object.lookup-setter { "electron":"0.36" } - es6.object.to-string { "electron":"0.36" } - es7.object.values { "electron":"0.36" } - es6.promise { "electron":"0.36" } - es7.promise.finally { "electron":"0.36" } - es6.reflect.apply { "electron":"0.36" } - es6.reflect.construct { "electron":"0.36" } - es6.reflect.define-property { "electron":"0.36" } - es6.reflect.delete-property { "electron":"0.36" } - es6.reflect.get { "electron":"0.36" } - es6.reflect.get-own-property-descriptor { "electron":"0.36" } - es6.reflect.get-prototype-of { "electron":"0.36" } - es6.reflect.has { "electron":"0.36" } - es6.reflect.is-extensible { "electron":"0.36" } - es6.reflect.own-keys { "electron":"0.36" } - es6.reflect.prevent-extensions { "electron":"0.36" } - es6.reflect.set { "electron":"0.36" } - es6.reflect.set-prototype-of { "electron":"0.36" } - es6.regexp.constructor { "electron":"0.36" } - es6.regexp.flags { "electron":"0.36" } - es6.regexp.match { "electron":"0.36" } - es6.regexp.replace { "electron":"0.36" } - es6.regexp.split { "electron":"0.36" } - es6.regexp.search { "electron":"0.36" } - es6.regexp.to-string { "electron":"0.36" } - es6.set { "electron":"0.36" } - es6.symbol { "electron":"0.36" } - es7.symbol.async-iterator { "electron":"0.36" } - es6.string.anchor { "electron":"0.36" } - es6.string.big { "electron":"0.36" } - es6.string.blink { "electron":"0.36" } - es6.string.bold { "electron":"0.36" } - es6.string.fixed { "electron":"0.36" } - es6.string.fontcolor { "electron":"0.36" } - es6.string.fontsize { "electron":"0.36" } - es6.string.italics { "electron":"0.36" } - es6.string.link { "electron":"0.36" } - es7.string.pad-start { "electron":"0.36" } - es7.string.pad-end { "electron":"0.36" } - es6.string.small { "electron":"0.36" } - es6.string.strike { "electron":"0.36" } - es6.string.sub { "electron":"0.36" } - es6.string.sup { "electron":"0.36" } - es6.string.trim { "electron":"0.36" } - es7.string.trim-left { "electron":"0.36" } - es7.string.trim-right { "electron":"0.36" } - es6.typed.array-buffer { "electron":"0.36" } - es6.typed.data-view { "electron":"0.36" } - es6.typed.int8-array { "electron":"0.36" } - es6.typed.uint8-array { "electron":"0.36" } - es6.typed.uint8-clamped-array { "electron":"0.36" } - es6.typed.int16-array { "electron":"0.36" } - es6.typed.uint16-array { "electron":"0.36" } - es6.typed.int32-array { "electron":"0.36" } - es6.typed.uint32-array { "electron":"0.36" } - es6.typed.float32-array { "electron":"0.36" } - es6.typed.float64-array { "electron":"0.36" } - es6.weak-map { "electron":"0.36" } - es6.weak-set { "electron":"0.36" } - web.timers { "electron":"0.36" } - web.immediate { "electron":"0.36" } - web.dom.iterable { "electron":"0.36" } -Successfully compiled 1 file with Babel. \ No newline at end of file diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs2-force-all-transforms/options.json b/packages/babel-preset-env/test/debug-fixtures/entry-corejs2-force-all-transforms/options.json deleted file mode 100644 index 3615dbaff0f6..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-corejs2-force-all-transforms/options.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "presets": [ - ["../../lib", { - "debug": true, - "modules": false, - "targets": { - "chrome": 55 - }, - "useBuiltIns": "entry", - "corejs": 2, - "forceAllTransforms": true - }] - ] -} diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs2-force-all-transforms/stdout.txt b/packages/babel-preset-env/test/debug-fixtures/entry-corejs2-force-all-transforms/stdout.txt deleted file mode 100644 index 988f64db332a..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-corejs2-force-all-transforms/stdout.txt +++ /dev/null @@ -1,63 +0,0 @@ -@babel/preset-env: `DEBUG` option - -Using targets: -{ - "chrome": "55" -} - -Using modules transform: false - -Using plugins: - transform-template-literals {} - transform-literals {} - transform-function-name {} - transform-arrow-functions {} - transform-block-scoped-functions {} - transform-classes {} - transform-object-super {} - transform-shorthand-properties {} - transform-duplicate-keys {} - transform-computed-properties {} - transform-for-of {} - transform-sticky-regex {} - transform-dotall-regex { "chrome":"55" } - transform-unicode-regex {} - transform-spread {} - transform-parameters {} - transform-destructuring {} - transform-block-scoping {} - transform-typeof-symbol {} - transform-new-target {} - transform-regenerator {} - transform-exponentiation-operator {} - transform-async-to-generator {} - proposal-async-generator-functions { "chrome":"55" } - proposal-object-rest-spread { "chrome":"55" } - proposal-unicode-property-regex { "chrome":"55" } - proposal-json-strings { "chrome":"55" } - proposal-optional-catch-binding { "chrome":"55" } - transform-named-capturing-groups-regex { "chrome":"55" } - transform-member-expression-literals {} - transform-property-literals {} - transform-reserved-words {} - -Using polyfills with `entry` option: - -[/src/in.js] Replaced @babel/polyfill entries with the following polyfills: - es7.array.flat-map { "chrome":"55" } - es6.array.sort { "chrome":"55" } - es7.object.define-getter { "chrome":"55" } - es7.object.define-setter { "chrome":"55" } - es7.object.lookup-getter { "chrome":"55" } - es7.object.lookup-setter { "chrome":"55" } - es6.object.to-string { "chrome":"55" } - es7.promise.finally { "chrome":"55" } - es7.symbol.async-iterator { "chrome":"55" } - es7.string.pad-start { "chrome":"55" } - es7.string.pad-end { "chrome":"55" } - es7.string.trim-left { "chrome":"55" } - es7.string.trim-right { "chrome":"55" } - web.timers { "chrome":"55" } - web.immediate { "chrome":"55" } - web.dom.iterable { "chrome":"55" } -Successfully compiled 1 file with Babel. \ No newline at end of file diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs2-no-import/options.json b/packages/babel-preset-env/test/debug-fixtures/entry-corejs2-no-import/options.json deleted file mode 100644 index b8acc7a56de8..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-corejs2-no-import/options.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "presets": [ - ["../../lib", { - "debug": true, - "targets": { - "node": 6 - }, - "useBuiltIns": "entry", - "corejs": 2 - }] - ] -} diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs2-no-import/stdout.txt b/packages/babel-preset-env/test/debug-fixtures/entry-corejs2-no-import/stdout.txt deleted file mode 100644 index ac37a584bfdf..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-corejs2-no-import/stdout.txt +++ /dev/null @@ -1,27 +0,0 @@ -@babel/preset-env: `DEBUG` option - -Using targets: -{ - "node": "6" -} - -Using modules transform: auto - -Using plugins: - transform-function-name { "node":"6" } - transform-for-of { "node":"6" } - transform-dotall-regex { "node":"6" } - transform-destructuring { "node":"6" } - transform-exponentiation-operator { "node":"6" } - transform-async-to-generator { "node":"6" } - proposal-async-generator-functions { "node":"6" } - proposal-object-rest-spread { "node":"6" } - proposal-unicode-property-regex { "node":"6" } - proposal-json-strings { "node":"6" } - proposal-optional-catch-binding { "node":"6" } - transform-named-capturing-groups-regex { "node":"6" } - -Using polyfills with `entry` option: - -[/src/in.js] Import of @babel/polyfill was not found. -Successfully compiled 1 file with Babel. \ No newline at end of file diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs2-proposals-chrome-71/options.json b/packages/babel-preset-env/test/debug-fixtures/entry-corejs2-proposals-chrome-71/options.json deleted file mode 100644 index 6873f884f7c8..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-corejs2-proposals-chrome-71/options.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "presets": [ - ["../../lib", { - "debug": true, - "targets": { - "browsers": "chrome 71" - }, - "useBuiltIns": "entry", - "corejs": { "version": 2, "proposals": true } - }] - ] -} diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs2-proposals-chrome-71/stdout.txt b/packages/babel-preset-env/test/debug-fixtures/entry-corejs2-proposals-chrome-71/stdout.txt deleted file mode 100644 index c5a336627064..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-corejs2-proposals-chrome-71/stdout.txt +++ /dev/null @@ -1,22 +0,0 @@ -@babel/preset-env: `DEBUG` option - -Using targets: -{ - "chrome": "71" -} - -Using modules transform: auto - -Using plugins: - syntax-async-generators { "chrome":"71" } - syntax-object-rest-spread { "chrome":"71" } - syntax-json-strings { "chrome":"71" } - syntax-optional-catch-binding { "chrome":"71" } - -Using polyfills with `entry` option: - -[/src/in.js] Replaced @babel/polyfill entries with the following polyfills: - web.timers { "chrome":"71" } - web.immediate { "chrome":"71" } - web.dom.iterable { "chrome":"71" } -Successfully compiled 1 file with Babel. \ No newline at end of file diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs2-proposals/options.json b/packages/babel-preset-env/test/debug-fixtures/entry-corejs2-proposals/options.json deleted file mode 100644 index e95eabddbf17..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-corejs2-proposals/options.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "presets": [ - ["../../lib", { - "debug": true, - "useBuiltIns": "entry", - "corejs": { "version": 2, "proposals": true } - }] - ] -} diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs2-proposals/stdout.txt b/packages/babel-preset-env/test/debug-fixtures/entry-corejs2-proposals/stdout.txt deleted file mode 100644 index 04e8ce0e5829..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-corejs2-proposals/stdout.txt +++ /dev/null @@ -1,193 +0,0 @@ -@babel/preset-env: `DEBUG` option - -Using targets: -{} - -Using modules transform: auto - -Using plugins: - transform-template-literals {} - transform-literals {} - transform-function-name {} - transform-arrow-functions {} - transform-block-scoped-functions {} - transform-classes {} - transform-object-super {} - transform-shorthand-properties {} - transform-duplicate-keys {} - transform-computed-properties {} - transform-for-of {} - transform-sticky-regex {} - transform-dotall-regex {} - transform-unicode-regex {} - transform-spread {} - transform-parameters {} - transform-destructuring {} - transform-block-scoping {} - transform-typeof-symbol {} - transform-new-target {} - transform-regenerator {} - transform-exponentiation-operator {} - transform-async-to-generator {} - proposal-async-generator-functions {} - proposal-object-rest-spread {} - proposal-unicode-property-regex {} - proposal-json-strings {} - proposal-optional-catch-binding {} - transform-named-capturing-groups-regex {} - transform-member-expression-literals {} - transform-property-literals {} - transform-reserved-words {} - -Using polyfills with `entry` option: - -[/src/in.js] Replaced @babel/polyfill entries with the following polyfills: - es6.array.copy-within {} - es6.array.every {} - es6.array.fill {} - es6.array.filter {} - es6.array.find {} - es6.array.find-index {} - es7.array.flat-map {} - es6.array.for-each {} - es6.array.from {} - es7.array.includes {} - es6.array.index-of {} - es6.array.is-array {} - es6.array.iterator {} - es6.array.last-index-of {} - es6.array.map {} - es6.array.of {} - es6.array.reduce {} - es6.array.reduce-right {} - es6.array.some {} - es6.array.sort {} - es6.array.species {} - es6.date.now {} - es6.date.to-iso-string {} - es6.date.to-json {} - es6.date.to-primitive {} - es6.date.to-string {} - es6.function.bind {} - es6.function.has-instance {} - es6.function.name {} - es6.map {} - es6.math.acosh {} - es6.math.asinh {} - es6.math.atanh {} - es6.math.cbrt {} - es6.math.clz32 {} - es6.math.cosh {} - es6.math.expm1 {} - es6.math.fround {} - es6.math.hypot {} - es6.math.imul {} - es6.math.log1p {} - es6.math.log10 {} - es6.math.log2 {} - es6.math.sign {} - es6.math.sinh {} - es6.math.tanh {} - es6.math.trunc {} - es6.number.constructor {} - es6.number.epsilon {} - es6.number.is-finite {} - es6.number.is-integer {} - es6.number.is-nan {} - es6.number.is-safe-integer {} - es6.number.max-safe-integer {} - es6.number.min-safe-integer {} - es6.number.parse-float {} - es6.number.parse-int {} - es6.object.assign {} - es6.object.create {} - es7.object.define-getter {} - es7.object.define-setter {} - es6.object.define-property {} - es6.object.define-properties {} - es7.object.entries {} - es6.object.freeze {} - es6.object.get-own-property-descriptor {} - es7.object.get-own-property-descriptors {} - es6.object.get-own-property-names {} - es6.object.get-prototype-of {} - es7.object.lookup-getter {} - es7.object.lookup-setter {} - es6.object.prevent-extensions {} - es6.object.to-string {} - es6.object.is {} - es6.object.is-frozen {} - es6.object.is-sealed {} - es6.object.is-extensible {} - es6.object.keys {} - es6.object.seal {} - es6.object.set-prototype-of {} - es7.object.values {} - es6.promise {} - es7.promise.finally {} - es6.reflect.apply {} - es6.reflect.construct {} - es6.reflect.define-property {} - es6.reflect.delete-property {} - es6.reflect.get {} - es6.reflect.get-own-property-descriptor {} - es6.reflect.get-prototype-of {} - es6.reflect.has {} - es6.reflect.is-extensible {} - es6.reflect.own-keys {} - es6.reflect.prevent-extensions {} - es6.reflect.set {} - es6.reflect.set-prototype-of {} - es6.regexp.constructor {} - es6.regexp.flags {} - es6.regexp.match {} - es6.regexp.replace {} - es6.regexp.split {} - es6.regexp.search {} - es6.regexp.to-string {} - es6.set {} - es6.symbol {} - es7.symbol.async-iterator {} - es6.string.anchor {} - es6.string.big {} - es6.string.blink {} - es6.string.bold {} - es6.string.code-point-at {} - es6.string.ends-with {} - es6.string.fixed {} - es6.string.fontcolor {} - es6.string.fontsize {} - es6.string.from-code-point {} - es6.string.includes {} - es6.string.italics {} - es6.string.iterator {} - es6.string.link {} - es7.string.pad-start {} - es7.string.pad-end {} - es6.string.raw {} - es6.string.repeat {} - es6.string.small {} - es6.string.starts-with {} - es6.string.strike {} - es6.string.sub {} - es6.string.sup {} - es6.string.trim {} - es7.string.trim-left {} - es7.string.trim-right {} - es6.typed.array-buffer {} - es6.typed.data-view {} - es6.typed.int8-array {} - es6.typed.uint8-array {} - es6.typed.uint8-clamped-array {} - es6.typed.int16-array {} - es6.typed.uint16-array {} - es6.typed.int32-array {} - es6.typed.uint32-array {} - es6.typed.float32-array {} - es6.typed.float64-array {} - es6.weak-map {} - es6.weak-set {} - web.timers {} - web.immediate {} - web.dom.iterable {} -Successfully compiled 1 file with Babel. \ No newline at end of file diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs2-shippedProposals-chrome-71/options.json b/packages/babel-preset-env/test/debug-fixtures/entry-corejs2-shippedProposals-chrome-71/options.json deleted file mode 100644 index 2998e96d184b..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-corejs2-shippedProposals-chrome-71/options.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "presets": [ - ["../../lib", { - "debug": true, - "targets": { - "browsers": "chrome 71" - }, - "shippedProposals": true, - "useBuiltIns": "entry", - "corejs": 2 - }] - ] -} diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs2-shippedProposals-chrome-71/stdout.txt b/packages/babel-preset-env/test/debug-fixtures/entry-corejs2-shippedProposals-chrome-71/stdout.txt deleted file mode 100644 index c5a336627064..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-corejs2-shippedProposals-chrome-71/stdout.txt +++ /dev/null @@ -1,22 +0,0 @@ -@babel/preset-env: `DEBUG` option - -Using targets: -{ - "chrome": "71" -} - -Using modules transform: auto - -Using plugins: - syntax-async-generators { "chrome":"71" } - syntax-object-rest-spread { "chrome":"71" } - syntax-json-strings { "chrome":"71" } - syntax-optional-catch-binding { "chrome":"71" } - -Using polyfills with `entry` option: - -[/src/in.js] Replaced @babel/polyfill entries with the following polyfills: - web.timers { "chrome":"71" } - web.immediate { "chrome":"71" } - web.dom.iterable { "chrome":"71" } -Successfully compiled 1 file with Babel. \ No newline at end of file diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs2-shippedProposals/options.json b/packages/babel-preset-env/test/debug-fixtures/entry-corejs2-shippedProposals/options.json deleted file mode 100644 index 519fd0ad0e7b..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-corejs2-shippedProposals/options.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "presets": [ - ["../../lib", { - "debug": true, - "shippedProposals": true, - "useBuiltIns": "entry", - "corejs": 2 - }] - ] -} diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs2-shippedProposals/stdout.txt b/packages/babel-preset-env/test/debug-fixtures/entry-corejs2-shippedProposals/stdout.txt deleted file mode 100644 index 04e8ce0e5829..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-corejs2-shippedProposals/stdout.txt +++ /dev/null @@ -1,193 +0,0 @@ -@babel/preset-env: `DEBUG` option - -Using targets: -{} - -Using modules transform: auto - -Using plugins: - transform-template-literals {} - transform-literals {} - transform-function-name {} - transform-arrow-functions {} - transform-block-scoped-functions {} - transform-classes {} - transform-object-super {} - transform-shorthand-properties {} - transform-duplicate-keys {} - transform-computed-properties {} - transform-for-of {} - transform-sticky-regex {} - transform-dotall-regex {} - transform-unicode-regex {} - transform-spread {} - transform-parameters {} - transform-destructuring {} - transform-block-scoping {} - transform-typeof-symbol {} - transform-new-target {} - transform-regenerator {} - transform-exponentiation-operator {} - transform-async-to-generator {} - proposal-async-generator-functions {} - proposal-object-rest-spread {} - proposal-unicode-property-regex {} - proposal-json-strings {} - proposal-optional-catch-binding {} - transform-named-capturing-groups-regex {} - transform-member-expression-literals {} - transform-property-literals {} - transform-reserved-words {} - -Using polyfills with `entry` option: - -[/src/in.js] Replaced @babel/polyfill entries with the following polyfills: - es6.array.copy-within {} - es6.array.every {} - es6.array.fill {} - es6.array.filter {} - es6.array.find {} - es6.array.find-index {} - es7.array.flat-map {} - es6.array.for-each {} - es6.array.from {} - es7.array.includes {} - es6.array.index-of {} - es6.array.is-array {} - es6.array.iterator {} - es6.array.last-index-of {} - es6.array.map {} - es6.array.of {} - es6.array.reduce {} - es6.array.reduce-right {} - es6.array.some {} - es6.array.sort {} - es6.array.species {} - es6.date.now {} - es6.date.to-iso-string {} - es6.date.to-json {} - es6.date.to-primitive {} - es6.date.to-string {} - es6.function.bind {} - es6.function.has-instance {} - es6.function.name {} - es6.map {} - es6.math.acosh {} - es6.math.asinh {} - es6.math.atanh {} - es6.math.cbrt {} - es6.math.clz32 {} - es6.math.cosh {} - es6.math.expm1 {} - es6.math.fround {} - es6.math.hypot {} - es6.math.imul {} - es6.math.log1p {} - es6.math.log10 {} - es6.math.log2 {} - es6.math.sign {} - es6.math.sinh {} - es6.math.tanh {} - es6.math.trunc {} - es6.number.constructor {} - es6.number.epsilon {} - es6.number.is-finite {} - es6.number.is-integer {} - es6.number.is-nan {} - es6.number.is-safe-integer {} - es6.number.max-safe-integer {} - es6.number.min-safe-integer {} - es6.number.parse-float {} - es6.number.parse-int {} - es6.object.assign {} - es6.object.create {} - es7.object.define-getter {} - es7.object.define-setter {} - es6.object.define-property {} - es6.object.define-properties {} - es7.object.entries {} - es6.object.freeze {} - es6.object.get-own-property-descriptor {} - es7.object.get-own-property-descriptors {} - es6.object.get-own-property-names {} - es6.object.get-prototype-of {} - es7.object.lookup-getter {} - es7.object.lookup-setter {} - es6.object.prevent-extensions {} - es6.object.to-string {} - es6.object.is {} - es6.object.is-frozen {} - es6.object.is-sealed {} - es6.object.is-extensible {} - es6.object.keys {} - es6.object.seal {} - es6.object.set-prototype-of {} - es7.object.values {} - es6.promise {} - es7.promise.finally {} - es6.reflect.apply {} - es6.reflect.construct {} - es6.reflect.define-property {} - es6.reflect.delete-property {} - es6.reflect.get {} - es6.reflect.get-own-property-descriptor {} - es6.reflect.get-prototype-of {} - es6.reflect.has {} - es6.reflect.is-extensible {} - es6.reflect.own-keys {} - es6.reflect.prevent-extensions {} - es6.reflect.set {} - es6.reflect.set-prototype-of {} - es6.regexp.constructor {} - es6.regexp.flags {} - es6.regexp.match {} - es6.regexp.replace {} - es6.regexp.split {} - es6.regexp.search {} - es6.regexp.to-string {} - es6.set {} - es6.symbol {} - es7.symbol.async-iterator {} - es6.string.anchor {} - es6.string.big {} - es6.string.blink {} - es6.string.bold {} - es6.string.code-point-at {} - es6.string.ends-with {} - es6.string.fixed {} - es6.string.fontcolor {} - es6.string.fontsize {} - es6.string.from-code-point {} - es6.string.includes {} - es6.string.italics {} - es6.string.iterator {} - es6.string.link {} - es7.string.pad-start {} - es7.string.pad-end {} - es6.string.raw {} - es6.string.repeat {} - es6.string.small {} - es6.string.starts-with {} - es6.string.strike {} - es6.string.sub {} - es6.string.sup {} - es6.string.trim {} - es7.string.trim-left {} - es7.string.trim-right {} - es6.typed.array-buffer {} - es6.typed.data-view {} - es6.typed.int8-array {} - es6.typed.uint8-array {} - es6.typed.uint8-clamped-array {} - es6.typed.int16-array {} - es6.typed.uint16-array {} - es6.typed.int32-array {} - es6.typed.uint32-array {} - es6.typed.float32-array {} - es6.typed.float64-array {} - es6.weak-map {} - es6.weak-set {} - web.timers {} - web.immediate {} - web.dom.iterable {} -Successfully compiled 1 file with Babel. \ No newline at end of file diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs2-specific-targets/options.json b/packages/babel-preset-env/test/debug-fixtures/entry-corejs2-specific-targets/options.json deleted file mode 100644 index dc30ad296d4b..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-corejs2-specific-targets/options.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "presets": [ - ["../../lib", { - "debug": true, - "targets": { - "browsers": "ie 10, ios 9, safari 7, edge 13, chrome 54, firefox 49" - }, - "useBuiltIns": "entry", - "corejs": 2 - }] - ] -} diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs2-specific-targets/stdout.txt b/packages/babel-preset-env/test/debug-fixtures/entry-corejs2-specific-targets/stdout.txt deleted file mode 100644 index a7c6a94b05aa..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-corejs2-specific-targets/stdout.txt +++ /dev/null @@ -1,178 +0,0 @@ -@babel/preset-env: `DEBUG` option - -Using targets: -{ - "chrome": "54", - "edge": "13", - "firefox": "49", - "ie": "10", - "ios": "9", - "safari": "7" -} - -Using modules transform: auto - -Using plugins: - transform-template-literals { "ie":"10", "ios":"9", "safari":"7" } - transform-literals { "firefox":"49", "ie":"10", "safari":"7" } - transform-function-name { "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } - transform-arrow-functions { "ie":"10", "ios":"9", "safari":"7" } - transform-block-scoped-functions { "ie":"10", "ios":"9", "safari":"7" } - transform-classes { "ie":"10", "ios":"9", "safari":"7" } - transform-object-super { "ie":"10", "ios":"9", "safari":"7" } - transform-shorthand-properties { "ie":"10", "safari":"7" } - transform-duplicate-keys { "ie":"10", "safari":"7" } - transform-computed-properties { "ie":"10", "safari":"7" } - transform-for-of { "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } - transform-sticky-regex { "ie":"10", "ios":"9", "safari":"7" } - transform-dotall-regex { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } - transform-unicode-regex { "ie":"10", "ios":"9", "safari":"7" } - transform-spread { "ie":"10", "ios":"9", "safari":"7" } - transform-parameters { "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } - transform-destructuring { "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } - transform-block-scoping { "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } - transform-typeof-symbol { "ie":"10", "safari":"7" } - transform-new-target { "edge":"13", "ie":"10", "ios":"9", "safari":"7" } - transform-regenerator { "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } - transform-exponentiation-operator { "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } - transform-async-to-generator { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } - proposal-async-generator-functions { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } - proposal-object-rest-spread { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } - proposal-unicode-property-regex { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } - proposal-json-strings { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } - proposal-optional-catch-binding { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } - transform-named-capturing-groups-regex { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } - -Using polyfills with `entry` option: - -[/src/in.js] Replaced @babel/polyfill entries with the following polyfills: - es6.array.copy-within { "ie":"10", "safari":"7" } - es6.array.fill { "ie":"10", "safari":"7" } - es6.array.find { "ie":"10", "safari":"7" } - es6.array.find-index { "ie":"10", "safari":"7" } - es7.array.flat-map { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } - es6.array.from { "edge":"13", "ie":"10", "ios":"9", "safari":"7" } - es7.array.includes { "edge":"13", "ie":"10", "ios":"9", "safari":"7" } - es6.array.iterator { "ie":"10", "safari":"7" } - es6.array.of { "ie":"10", "safari":"7" } - es6.array.sort { "chrome":"54", "ios":"9", "safari":"7" } - es6.array.species { "ie":"10", "ios":"9", "safari":"7" } - es6.date.to-json { "ios":"9", "safari":"7" } - es6.date.to-primitive { "edge":"13", "ie":"10", "ios":"9", "safari":"7" } - es6.function.has-instance { "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } - es6.function.name { "edge":"13", "ie":"10" } - es6.map { "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } - es6.math.acosh { "ie":"10", "safari":"7" } - es6.math.asinh { "ie":"10", "safari":"7" } - es6.math.atanh { "ie":"10", "safari":"7" } - es6.math.cbrt { "ie":"10", "safari":"7" } - es6.math.clz32 { "ie":"10", "safari":"7" } - es6.math.cosh { "ie":"10", "safari":"7" } - es6.math.expm1 { "ie":"10", "safari":"7" } - es6.math.fround { "ie":"10", "safari":"7" } - es6.math.hypot { "ie":"10", "safari":"7" } - es6.math.imul { "ie":"10" } - es6.math.log1p { "ie":"10", "safari":"7" } - es6.math.log10 { "ie":"10", "safari":"7" } - es6.math.log2 { "ie":"10", "safari":"7" } - es6.math.sign { "ie":"10", "safari":"7" } - es6.math.sinh { "ie":"10", "safari":"7" } - es6.math.tanh { "ie":"10", "safari":"7" } - es6.math.trunc { "ie":"10", "safari":"7" } - es6.number.constructor { "ie":"10", "safari":"7" } - es6.number.epsilon { "ie":"10", "safari":"7" } - es6.number.is-finite { "ie":"10", "safari":"7" } - es6.number.is-integer { "ie":"10", "safari":"7" } - es6.number.is-nan { "ie":"10", "safari":"7" } - es6.number.is-safe-integer { "ie":"10", "safari":"7" } - es6.number.max-safe-integer { "ie":"10", "safari":"7" } - es6.number.min-safe-integer { "ie":"10", "safari":"7" } - es6.number.parse-float { "ie":"10", "safari":"7" } - es6.number.parse-int { "ie":"10", "safari":"7" } - es6.object.assign { "ie":"10", "ios":"9", "safari":"7" } - es7.object.define-getter { "chrome":"54", "edge":"13", "ie":"10", "safari":"7" } - es7.object.define-setter { "chrome":"54", "edge":"13", "ie":"10", "safari":"7" } - es7.object.entries { "edge":"13", "ie":"10", "ios":"9", "safari":"7" } - es6.object.freeze { "ie":"10", "safari":"7" } - es6.object.get-own-property-descriptor { "ie":"10", "safari":"7" } - es7.object.get-own-property-descriptors { "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } - es6.object.get-own-property-names { "ie":"10", "safari":"7" } - es6.object.get-prototype-of { "ie":"10", "safari":"7" } - es7.object.lookup-getter { "chrome":"54", "edge":"13", "ie":"10", "safari":"7" } - es7.object.lookup-setter { "chrome":"54", "edge":"13", "ie":"10", "safari":"7" } - es6.object.prevent-extensions { "ie":"10", "safari":"7" } - es6.object.to-string { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } - es6.object.is { "ie":"10", "safari":"7" } - es6.object.is-frozen { "ie":"10", "safari":"7" } - es6.object.is-sealed { "ie":"10", "safari":"7" } - es6.object.is-extensible { "ie":"10", "safari":"7" } - es6.object.keys { "ie":"10", "safari":"7" } - es6.object.seal { "ie":"10", "safari":"7" } - es6.object.set-prototype-of { "ie":"10", "safari":"7" } - es7.object.values { "edge":"13", "ie":"10", "ios":"9", "safari":"7" } - es6.promise { "edge":"13", "ie":"10", "ios":"9", "safari":"7" } - es7.promise.finally { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } - es6.reflect.apply { "ie":"10", "ios":"9", "safari":"7" } - es6.reflect.construct { "ie":"10", "ios":"9", "safari":"7" } - es6.reflect.define-property { "ie":"10", "ios":"9", "safari":"7" } - es6.reflect.delete-property { "ie":"10", "ios":"9", "safari":"7" } - es6.reflect.get { "ie":"10", "ios":"9", "safari":"7" } - es6.reflect.get-own-property-descriptor { "ie":"10", "ios":"9", "safari":"7" } - es6.reflect.get-prototype-of { "ie":"10", "ios":"9", "safari":"7" } - es6.reflect.has { "ie":"10", "ios":"9", "safari":"7" } - es6.reflect.is-extensible { "ie":"10", "ios":"9", "safari":"7" } - es6.reflect.own-keys { "ie":"10", "ios":"9", "safari":"7" } - es6.reflect.prevent-extensions { "ie":"10", "ios":"9", "safari":"7" } - es6.reflect.set { "ie":"10", "ios":"9", "safari":"7" } - es6.reflect.set-prototype-of { "ie":"10", "ios":"9", "safari":"7" } - es6.regexp.constructor { "edge":"13", "ie":"10", "ios":"9", "safari":"7" } - es6.regexp.flags { "edge":"13", "ie":"10", "safari":"7" } - es6.regexp.match { "edge":"13", "ie":"10", "ios":"9", "safari":"7" } - es6.regexp.replace { "edge":"13", "ie":"10", "ios":"9", "safari":"7" } - es6.regexp.split { "edge":"13", "ie":"10", "ios":"9", "safari":"7" } - es6.regexp.search { "edge":"13", "ie":"10", "ios":"9", "safari":"7" } - es6.regexp.to-string { "edge":"13", "ie":"10", "ios":"9", "safari":"7" } - es6.set { "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } - es6.symbol { "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } - es7.symbol.async-iterator { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } - es6.string.anchor { "ie":"10" } - es6.string.big { "ie":"10" } - es6.string.blink { "ie":"10" } - es6.string.bold { "ie":"10" } - es6.string.code-point-at { "ie":"10", "safari":"7" } - es6.string.ends-with { "ie":"10", "safari":"7" } - es6.string.fixed { "ie":"10" } - es6.string.fontcolor { "ie":"10" } - es6.string.fontsize { "ie":"10" } - es6.string.from-code-point { "ie":"10", "safari":"7" } - es6.string.includes { "ie":"10", "safari":"7" } - es6.string.italics { "ie":"10" } - es6.string.iterator { "ie":"10", "safari":"7" } - es6.string.link { "ie":"10" } - es7.string.pad-start { "chrome":"54", "edge":"13", "ie":"10", "ios":"9", "safari":"7" } - es7.string.pad-end { "chrome":"54", "edge":"13", "ie":"10", "ios":"9", "safari":"7" } - es6.string.raw { "ie":"10", "safari":"7" } - es6.string.repeat { "ie":"10", "safari":"7" } - es6.string.small { "ie":"10" } - es6.string.starts-with { "ie":"10", "safari":"7" } - es6.string.strike { "ie":"10" } - es6.string.sub { "ie":"10" } - es6.string.sup { "ie":"10" } - es7.string.trim-left { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } - es7.string.trim-right { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } - es6.typed.array-buffer { "ie":"10", "ios":"9", "safari":"7" } - es6.typed.int8-array { "ie":"10", "ios":"9", "safari":"7" } - es6.typed.uint8-array { "ie":"10", "ios":"9", "safari":"7" } - es6.typed.uint8-clamped-array { "ie":"10", "ios":"9", "safari":"7" } - es6.typed.int16-array { "ie":"10", "ios":"9", "safari":"7" } - es6.typed.uint16-array { "ie":"10", "ios":"9", "safari":"7" } - es6.typed.int32-array { "ie":"10", "ios":"9", "safari":"7" } - es6.typed.uint32-array { "ie":"10", "ios":"9", "safari":"7" } - es6.typed.float32-array { "ie":"10", "ios":"9", "safari":"7" } - es6.typed.float64-array { "ie":"10", "ios":"9", "safari":"7" } - es6.weak-map { "edge":"13", "firefox":"49", "ie":"10", "safari":"7" } - es6.weak-set { "edge":"13", "firefox":"49", "ie":"10", "safari":"7" } - web.timers { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } - web.immediate { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } - web.dom.iterable { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } -Successfully compiled 1 file with Babel. \ No newline at end of file diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs2-versions-decimals/options.json b/packages/babel-preset-env/test/debug-fixtures/entry-corejs2-versions-decimals/options.json deleted file mode 100644 index abf19b511667..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-corejs2-versions-decimals/options.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "presets": [ - ["../../lib", { - "useBuiltIns": "entry", - "corejs": 2, - "debug": true, - "targets": { - "chrome": 54, - "electron": 0.36, - "node": 6.10, - "ie": 10 - } - }] - ] -} diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs2-versions-decimals/stdout.txt b/packages/babel-preset-env/test/debug-fixtures/entry-corejs2-versions-decimals/stdout.txt deleted file mode 100644 index 3988359b77cf..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-corejs2-versions-decimals/stdout.txt +++ /dev/null @@ -1,205 +0,0 @@ -Warning, the following targets are using a decimal version: - - electron: 0.36 - node: 6.1 - -We recommend using a string for minor/patch versions to avoid numbers like 6.10 -getting parsed as 6.1, which can lead to unexpected behavior. - -@babel/preset-env: `DEBUG` option - -Using targets: -{ - "chrome": "54", - "electron": "0.36", - "ie": "10", - "node": "6.1" -} - -Using modules transform: auto - -Using plugins: - transform-template-literals { "ie":"10" } - transform-literals { "ie":"10" } - transform-function-name { "electron":"0.36", "ie":"10", "node":"6.1" } - transform-arrow-functions { "ie":"10" } - transform-block-scoped-functions { "ie":"10" } - transform-classes { "ie":"10" } - transform-object-super { "ie":"10" } - transform-shorthand-properties { "ie":"10" } - transform-duplicate-keys { "ie":"10" } - transform-computed-properties { "ie":"10" } - transform-for-of { "electron":"0.36", "ie":"10", "node":"6.1" } - transform-sticky-regex { "electron":"0.36", "ie":"10" } - transform-dotall-regex { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } - transform-unicode-regex { "electron":"0.36", "ie":"10" } - transform-spread { "ie":"10" } - transform-parameters { "electron":"0.36", "ie":"10" } - transform-destructuring { "electron":"0.36", "ie":"10", "node":"6.1" } - transform-block-scoping { "electron":"0.36", "ie":"10" } - transform-typeof-symbol { "ie":"10" } - transform-new-target { "ie":"10" } - transform-regenerator { "electron":"0.36", "ie":"10" } - transform-exponentiation-operator { "electron":"0.36", "ie":"10", "node":"6.1" } - transform-async-to-generator { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } - proposal-async-generator-functions { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } - proposal-object-rest-spread { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } - proposal-unicode-property-regex { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } - proposal-json-strings { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } - proposal-optional-catch-binding { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } - transform-named-capturing-groups-regex { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } - transform-member-expression-literals { "electron":"0.36" } - transform-property-literals { "electron":"0.36" } - -Using polyfills with `entry` option: - -[/src/in.js] Replaced @babel/polyfill entries with the following polyfills: - es6.array.copy-within { "ie":"10" } - es6.array.every { "electron":"0.36" } - es6.array.fill { "ie":"10" } - es6.array.filter { "electron":"0.36" } - es6.array.find { "ie":"10" } - es6.array.find-index { "ie":"10" } - es7.array.flat-map { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } - es6.array.for-each { "electron":"0.36" } - es6.array.from { "electron":"0.36", "ie":"10", "node":"6.1" } - es7.array.includes { "ie":"10" } - es6.array.index-of { "electron":"0.36" } - es6.array.is-array { "electron":"0.36" } - es6.array.iterator { "ie":"10" } - es6.array.last-index-of { "electron":"0.36" } - es6.array.map { "electron":"0.36" } - es6.array.of { "ie":"10" } - es6.array.reduce { "electron":"0.36" } - es6.array.reduce-right { "electron":"0.36" } - es6.array.some { "electron":"0.36" } - es6.array.sort { "chrome":"54", "electron":"0.36", "node":"6.1" } - es6.array.species { "electron":"0.36", "ie":"10", "node":"6.1" } - es6.date.now { "electron":"0.36" } - es6.date.to-iso-string { "electron":"0.36" } - es6.date.to-json { "electron":"0.36" } - es6.date.to-primitive { "ie":"10" } - es6.date.to-string { "electron":"0.36" } - es6.function.bind { "electron":"0.36" } - es6.function.has-instance { "electron":"0.36", "ie":"10", "node":"6.1" } - es6.function.name { "electron":"0.36", "ie":"10" } - es6.map { "electron":"0.36", "ie":"10", "node":"6.1" } - es6.math.acosh { "ie":"10" } - es6.math.asinh { "ie":"10" } - es6.math.atanh { "ie":"10" } - es6.math.cbrt { "ie":"10" } - es6.math.clz32 { "ie":"10" } - es6.math.cosh { "ie":"10" } - es6.math.expm1 { "ie":"10" } - es6.math.fround { "ie":"10" } - es6.math.hypot { "ie":"10" } - es6.math.imul { "ie":"10" } - es6.math.log1p { "ie":"10" } - es6.math.log10 { "ie":"10" } - es6.math.log2 { "ie":"10" } - es6.math.sign { "ie":"10" } - es6.math.sinh { "ie":"10" } - es6.math.tanh { "ie":"10" } - es6.math.trunc { "ie":"10" } - es6.number.constructor { "ie":"10" } - es6.number.epsilon { "ie":"10" } - es6.number.is-finite { "ie":"10" } - es6.number.is-integer { "ie":"10" } - es6.number.is-nan { "ie":"10" } - es6.number.is-safe-integer { "ie":"10" } - es6.number.max-safe-integer { "ie":"10" } - es6.number.min-safe-integer { "ie":"10" } - es6.number.parse-float { "ie":"10" } - es6.number.parse-int { "ie":"10" } - es6.object.assign { "electron":"0.36", "ie":"10" } - es6.object.create { "electron":"0.36" } - es7.object.define-getter { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } - es7.object.define-setter { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } - es6.object.define-property { "electron":"0.36" } - es6.object.define-properties { "electron":"0.36" } - es7.object.entries { "electron":"0.36", "ie":"10", "node":"6.1" } - es6.object.freeze { "ie":"10" } - es6.object.get-own-property-descriptor { "ie":"10" } - es7.object.get-own-property-descriptors { "electron":"0.36", "ie":"10", "node":"6.1" } - es6.object.get-own-property-names { "ie":"10" } - es6.object.get-prototype-of { "ie":"10" } - es7.object.lookup-getter { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } - es7.object.lookup-setter { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } - es6.object.prevent-extensions { "ie":"10" } - es6.object.to-string { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } - es6.object.is { "ie":"10" } - es6.object.is-frozen { "ie":"10" } - es6.object.is-sealed { "ie":"10" } - es6.object.is-extensible { "ie":"10" } - es6.object.keys { "ie":"10" } - es6.object.seal { "ie":"10" } - es6.object.set-prototype-of { "ie":"10" } - es7.object.values { "electron":"0.36", "ie":"10", "node":"6.1" } - es6.promise { "electron":"0.36", "ie":"10", "node":"6.1" } - es7.promise.finally { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } - es6.reflect.apply { "electron":"0.36", "ie":"10" } - es6.reflect.construct { "electron":"0.36", "ie":"10" } - es6.reflect.define-property { "electron":"0.36", "ie":"10" } - es6.reflect.delete-property { "electron":"0.36", "ie":"10" } - es6.reflect.get { "electron":"0.36", "ie":"10" } - es6.reflect.get-own-property-descriptor { "electron":"0.36", "ie":"10" } - es6.reflect.get-prototype-of { "electron":"0.36", "ie":"10" } - es6.reflect.has { "electron":"0.36", "ie":"10" } - es6.reflect.is-extensible { "electron":"0.36", "ie":"10" } - es6.reflect.own-keys { "electron":"0.36", "ie":"10" } - es6.reflect.prevent-extensions { "electron":"0.36", "ie":"10" } - es6.reflect.set { "electron":"0.36", "ie":"10" } - es6.reflect.set-prototype-of { "electron":"0.36", "ie":"10" } - es6.regexp.constructor { "electron":"0.36", "ie":"10" } - es6.regexp.flags { "electron":"0.36", "ie":"10" } - es6.regexp.match { "electron":"0.36", "ie":"10" } - es6.regexp.replace { "electron":"0.36", "ie":"10" } - es6.regexp.split { "electron":"0.36", "ie":"10" } - es6.regexp.search { "electron":"0.36", "ie":"10" } - es6.regexp.to-string { "electron":"0.36", "ie":"10" } - es6.set { "electron":"0.36", "ie":"10", "node":"6.1" } - es6.symbol { "electron":"0.36", "ie":"10", "node":"6.1" } - es7.symbol.async-iterator { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } - es6.string.anchor { "electron":"0.36", "ie":"10" } - es6.string.big { "electron":"0.36", "ie":"10" } - es6.string.blink { "electron":"0.36", "ie":"10" } - es6.string.bold { "electron":"0.36", "ie":"10" } - es6.string.code-point-at { "ie":"10" } - es6.string.ends-with { "ie":"10" } - es6.string.fixed { "electron":"0.36", "ie":"10" } - es6.string.fontcolor { "electron":"0.36", "ie":"10" } - es6.string.fontsize { "electron":"0.36", "ie":"10" } - es6.string.from-code-point { "ie":"10" } - es6.string.includes { "ie":"10" } - es6.string.italics { "electron":"0.36", "ie":"10" } - es6.string.iterator { "ie":"10" } - es6.string.link { "electron":"0.36", "ie":"10" } - es7.string.pad-start { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } - es7.string.pad-end { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } - es6.string.raw { "ie":"10" } - es6.string.repeat { "ie":"10" } - es6.string.small { "electron":"0.36", "ie":"10" } - es6.string.starts-with { "ie":"10" } - es6.string.strike { "electron":"0.36", "ie":"10" } - es6.string.sub { "electron":"0.36", "ie":"10" } - es6.string.sup { "electron":"0.36", "ie":"10" } - es6.string.trim { "electron":"0.36" } - es7.string.trim-left { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } - es7.string.trim-right { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } - es6.typed.array-buffer { "electron":"0.36", "ie":"10", "node":"6.1" } - es6.typed.data-view { "electron":"0.36" } - es6.typed.int8-array { "electron":"0.36", "ie":"10", "node":"6.1" } - es6.typed.uint8-array { "electron":"0.36", "ie":"10", "node":"6.1" } - es6.typed.uint8-clamped-array { "electron":"0.36", "ie":"10", "node":"6.1" } - es6.typed.int16-array { "electron":"0.36", "ie":"10", "node":"6.1" } - es6.typed.uint16-array { "electron":"0.36", "ie":"10", "node":"6.1" } - es6.typed.int32-array { "electron":"0.36", "ie":"10", "node":"6.1" } - es6.typed.uint32-array { "electron":"0.36", "ie":"10", "node":"6.1" } - es6.typed.float32-array { "electron":"0.36", "ie":"10", "node":"6.1" } - es6.typed.float64-array { "electron":"0.36", "ie":"10", "node":"6.1" } - es6.weak-map { "electron":"0.36", "ie":"10", "node":"6.1" } - es6.weak-set { "electron":"0.36", "ie":"10", "node":"6.1" } - web.timers { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } - web.immediate { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } - web.dom.iterable { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } -Successfully compiled 1 file with Babel. \ No newline at end of file diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs2-versions-strings/options.json b/packages/babel-preset-env/test/debug-fixtures/entry-corejs2-versions-strings/options.json deleted file mode 100644 index e586d8bb545e..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-corejs2-versions-strings/options.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "presets": [ - ["../../lib", { - "useBuiltIns": "entry", - "corejs": 2, - "debug": true, - "targets": { - "chrome": "54", - "node": "6.10", - "ie": "10" - } - }] - ] -} diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs2-versions-strings/stdout.txt b/packages/babel-preset-env/test/debug-fixtures/entry-corejs2-versions-strings/stdout.txt deleted file mode 100644 index 2599a836d290..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-corejs2-versions-strings/stdout.txt +++ /dev/null @@ -1,174 +0,0 @@ -@babel/preset-env: `DEBUG` option - -Using targets: -{ - "chrome": "54", - "ie": "10", - "node": "6.10" -} - -Using modules transform: auto - -Using plugins: - transform-template-literals { "ie":"10" } - transform-literals { "ie":"10" } - transform-function-name { "ie":"10" } - transform-arrow-functions { "ie":"10" } - transform-block-scoped-functions { "ie":"10" } - transform-classes { "ie":"10" } - transform-object-super { "ie":"10" } - transform-shorthand-properties { "ie":"10" } - transform-duplicate-keys { "ie":"10" } - transform-computed-properties { "ie":"10" } - transform-for-of { "ie":"10" } - transform-sticky-regex { "ie":"10" } - transform-dotall-regex { "chrome":"54", "ie":"10", "node":"6.10" } - transform-unicode-regex { "ie":"10" } - transform-spread { "ie":"10" } - transform-parameters { "ie":"10" } - transform-destructuring { "ie":"10" } - transform-block-scoping { "ie":"10" } - transform-typeof-symbol { "ie":"10" } - transform-new-target { "ie":"10" } - transform-regenerator { "ie":"10" } - transform-exponentiation-operator { "ie":"10", "node":"6.10" } - transform-async-to-generator { "chrome":"54", "ie":"10", "node":"6.10" } - proposal-async-generator-functions { "chrome":"54", "ie":"10", "node":"6.10" } - proposal-object-rest-spread { "chrome":"54", "ie":"10", "node":"6.10" } - proposal-unicode-property-regex { "chrome":"54", "ie":"10", "node":"6.10" } - proposal-json-strings { "chrome":"54", "ie":"10", "node":"6.10" } - proposal-optional-catch-binding { "chrome":"54", "ie":"10", "node":"6.10" } - transform-named-capturing-groups-regex { "chrome":"54", "ie":"10", "node":"6.10" } - -Using polyfills with `entry` option: - -[/src/in.js] Replaced @babel/polyfill entries with the following polyfills: - es6.array.copy-within { "ie":"10" } - es6.array.fill { "ie":"10" } - es6.array.find { "ie":"10" } - es6.array.find-index { "ie":"10" } - es7.array.flat-map { "chrome":"54", "ie":"10", "node":"6.10" } - es6.array.from { "ie":"10" } - es7.array.includes { "ie":"10" } - es6.array.iterator { "ie":"10" } - es6.array.of { "ie":"10" } - es6.array.sort { "chrome":"54", "node":"6.10" } - es6.array.species { "ie":"10" } - es6.date.to-primitive { "ie":"10" } - es6.function.has-instance { "ie":"10" } - es6.function.name { "ie":"10" } - es6.map { "ie":"10" } - es6.math.acosh { "ie":"10" } - es6.math.asinh { "ie":"10" } - es6.math.atanh { "ie":"10" } - es6.math.cbrt { "ie":"10" } - es6.math.clz32 { "ie":"10" } - es6.math.cosh { "ie":"10" } - es6.math.expm1 { "ie":"10" } - es6.math.fround { "ie":"10" } - es6.math.hypot { "ie":"10" } - es6.math.imul { "ie":"10" } - es6.math.log1p { "ie":"10" } - es6.math.log10 { "ie":"10" } - es6.math.log2 { "ie":"10" } - es6.math.sign { "ie":"10" } - es6.math.sinh { "ie":"10" } - es6.math.tanh { "ie":"10" } - es6.math.trunc { "ie":"10" } - es6.number.constructor { "ie":"10" } - es6.number.epsilon { "ie":"10" } - es6.number.is-finite { "ie":"10" } - es6.number.is-integer { "ie":"10" } - es6.number.is-nan { "ie":"10" } - es6.number.is-safe-integer { "ie":"10" } - es6.number.max-safe-integer { "ie":"10" } - es6.number.min-safe-integer { "ie":"10" } - es6.number.parse-float { "ie":"10" } - es6.number.parse-int { "ie":"10" } - es6.object.assign { "ie":"10" } - es7.object.define-getter { "chrome":"54", "ie":"10", "node":"6.10" } - es7.object.define-setter { "chrome":"54", "ie":"10", "node":"6.10" } - es7.object.entries { "ie":"10", "node":"6.10" } - es6.object.freeze { "ie":"10" } - es6.object.get-own-property-descriptor { "ie":"10" } - es7.object.get-own-property-descriptors { "ie":"10", "node":"6.10" } - es6.object.get-own-property-names { "ie":"10" } - es6.object.get-prototype-of { "ie":"10" } - es7.object.lookup-getter { "chrome":"54", "ie":"10", "node":"6.10" } - es7.object.lookup-setter { "chrome":"54", "ie":"10", "node":"6.10" } - es6.object.prevent-extensions { "ie":"10" } - es6.object.to-string { "chrome":"54", "ie":"10", "node":"6.10" } - es6.object.is { "ie":"10" } - es6.object.is-frozen { "ie":"10" } - es6.object.is-sealed { "ie":"10" } - es6.object.is-extensible { "ie":"10" } - es6.object.keys { "ie":"10" } - es6.object.seal { "ie":"10" } - es6.object.set-prototype-of { "ie":"10" } - es7.object.values { "ie":"10", "node":"6.10" } - es6.promise { "ie":"10" } - es7.promise.finally { "chrome":"54", "ie":"10", "node":"6.10" } - es6.reflect.apply { "ie":"10" } - es6.reflect.construct { "ie":"10" } - es6.reflect.define-property { "ie":"10" } - es6.reflect.delete-property { "ie":"10" } - es6.reflect.get { "ie":"10" } - es6.reflect.get-own-property-descriptor { "ie":"10" } - es6.reflect.get-prototype-of { "ie":"10" } - es6.reflect.has { "ie":"10" } - es6.reflect.is-extensible { "ie":"10" } - es6.reflect.own-keys { "ie":"10" } - es6.reflect.prevent-extensions { "ie":"10" } - es6.reflect.set { "ie":"10" } - es6.reflect.set-prototype-of { "ie":"10" } - es6.regexp.constructor { "ie":"10" } - es6.regexp.flags { "ie":"10" } - es6.regexp.match { "ie":"10" } - es6.regexp.replace { "ie":"10" } - es6.regexp.split { "ie":"10" } - es6.regexp.search { "ie":"10" } - es6.regexp.to-string { "ie":"10" } - es6.set { "ie":"10" } - es6.symbol { "ie":"10" } - es7.symbol.async-iterator { "chrome":"54", "ie":"10", "node":"6.10" } - es6.string.anchor { "ie":"10" } - es6.string.big { "ie":"10" } - es6.string.blink { "ie":"10" } - es6.string.bold { "ie":"10" } - es6.string.code-point-at { "ie":"10" } - es6.string.ends-with { "ie":"10" } - es6.string.fixed { "ie":"10" } - es6.string.fontcolor { "ie":"10" } - es6.string.fontsize { "ie":"10" } - es6.string.from-code-point { "ie":"10" } - es6.string.includes { "ie":"10" } - es6.string.italics { "ie":"10" } - es6.string.iterator { "ie":"10" } - es6.string.link { "ie":"10" } - es7.string.pad-start { "chrome":"54", "ie":"10", "node":"6.10" } - es7.string.pad-end { "chrome":"54", "ie":"10", "node":"6.10" } - es6.string.raw { "ie":"10" } - es6.string.repeat { "ie":"10" } - es6.string.small { "ie":"10" } - es6.string.starts-with { "ie":"10" } - es6.string.strike { "ie":"10" } - es6.string.sub { "ie":"10" } - es6.string.sup { "ie":"10" } - es7.string.trim-left { "chrome":"54", "ie":"10", "node":"6.10" } - es7.string.trim-right { "chrome":"54", "ie":"10", "node":"6.10" } - es6.typed.array-buffer { "ie":"10" } - es6.typed.int8-array { "ie":"10" } - es6.typed.uint8-array { "ie":"10" } - es6.typed.uint8-clamped-array { "ie":"10" } - es6.typed.int16-array { "ie":"10" } - es6.typed.uint16-array { "ie":"10" } - es6.typed.int32-array { "ie":"10" } - es6.typed.uint32-array { "ie":"10" } - es6.typed.float32-array { "ie":"10" } - es6.typed.float64-array { "ie":"10" } - es6.weak-map { "ie":"10" } - es6.weak-set { "ie":"10" } - web.timers { "chrome":"54", "ie":"10", "node":"6.10" } - web.immediate { "chrome":"54", "ie":"10", "node":"6.10" } - web.dom.iterable { "chrome":"54", "ie":"10", "node":"6.10" } -Successfully compiled 1 file with Babel. \ No newline at end of file diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs2/options.json b/packages/babel-preset-env/test/debug-fixtures/entry-corejs2/options.json deleted file mode 100644 index de9fd3231ddf..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-corejs2/options.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "presets": [ - ["../../lib", { - "debug": true, - "targets": { - "browsers": "chrome >= 54, ie 10", - "node": 6 - }, - "useBuiltIns": "entry", - "corejs": 2 - }] - ] -} diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs2/stdout.txt b/packages/babel-preset-env/test/debug-fixtures/entry-corejs2/stdout.txt deleted file mode 100644 index 943bad68b9b1..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-corejs2/stdout.txt +++ /dev/null @@ -1,174 +0,0 @@ -@babel/preset-env: `DEBUG` option - -Using targets: -{ - "chrome": "54", - "ie": "10", - "node": "6" -} - -Using modules transform: auto - -Using plugins: - transform-template-literals { "ie":"10" } - transform-literals { "ie":"10" } - transform-function-name { "ie":"10", "node":"6" } - transform-arrow-functions { "ie":"10" } - transform-block-scoped-functions { "ie":"10" } - transform-classes { "ie":"10" } - transform-object-super { "ie":"10" } - transform-shorthand-properties { "ie":"10" } - transform-duplicate-keys { "ie":"10" } - transform-computed-properties { "ie":"10" } - transform-for-of { "ie":"10", "node":"6" } - transform-sticky-regex { "ie":"10" } - transform-dotall-regex { "chrome":"54", "ie":"10", "node":"6" } - transform-unicode-regex { "ie":"10" } - transform-spread { "ie":"10" } - transform-parameters { "ie":"10" } - transform-destructuring { "ie":"10", "node":"6" } - transform-block-scoping { "ie":"10" } - transform-typeof-symbol { "ie":"10" } - transform-new-target { "ie":"10" } - transform-regenerator { "ie":"10" } - transform-exponentiation-operator { "ie":"10", "node":"6" } - transform-async-to-generator { "chrome":"54", "ie":"10", "node":"6" } - proposal-async-generator-functions { "chrome":"54", "ie":"10", "node":"6" } - proposal-object-rest-spread { "chrome":"54", "ie":"10", "node":"6" } - proposal-unicode-property-regex { "chrome":"54", "ie":"10", "node":"6" } - proposal-json-strings { "chrome":"54", "ie":"10", "node":"6" } - proposal-optional-catch-binding { "chrome":"54", "ie":"10", "node":"6" } - transform-named-capturing-groups-regex { "chrome":"54", "ie":"10", "node":"6" } - -Using polyfills with `entry` option: - -[/src/in.js] Replaced @babel/polyfill entries with the following polyfills: - es6.array.copy-within { "ie":"10" } - es6.array.fill { "ie":"10" } - es6.array.find { "ie":"10" } - es6.array.find-index { "ie":"10" } - es7.array.flat-map { "chrome":"54", "ie":"10", "node":"6" } - es6.array.from { "ie":"10", "node":"6" } - es7.array.includes { "ie":"10" } - es6.array.iterator { "ie":"10" } - es6.array.of { "ie":"10" } - es6.array.sort { "chrome":"54", "node":"6" } - es6.array.species { "ie":"10", "node":"6" } - es6.date.to-primitive { "ie":"10" } - es6.function.has-instance { "ie":"10", "node":"6" } - es6.function.name { "ie":"10" } - es6.map { "ie":"10", "node":"6" } - es6.math.acosh { "ie":"10" } - es6.math.asinh { "ie":"10" } - es6.math.atanh { "ie":"10" } - es6.math.cbrt { "ie":"10" } - es6.math.clz32 { "ie":"10" } - es6.math.cosh { "ie":"10" } - es6.math.expm1 { "ie":"10" } - es6.math.fround { "ie":"10" } - es6.math.hypot { "ie":"10" } - es6.math.imul { "ie":"10" } - es6.math.log1p { "ie":"10" } - es6.math.log10 { "ie":"10" } - es6.math.log2 { "ie":"10" } - es6.math.sign { "ie":"10" } - es6.math.sinh { "ie":"10" } - es6.math.tanh { "ie":"10" } - es6.math.trunc { "ie":"10" } - es6.number.constructor { "ie":"10" } - es6.number.epsilon { "ie":"10" } - es6.number.is-finite { "ie":"10" } - es6.number.is-integer { "ie":"10" } - es6.number.is-nan { "ie":"10" } - es6.number.is-safe-integer { "ie":"10" } - es6.number.max-safe-integer { "ie":"10" } - es6.number.min-safe-integer { "ie":"10" } - es6.number.parse-float { "ie":"10" } - es6.number.parse-int { "ie":"10" } - es6.object.assign { "ie":"10" } - es7.object.define-getter { "chrome":"54", "ie":"10", "node":"6" } - es7.object.define-setter { "chrome":"54", "ie":"10", "node":"6" } - es7.object.entries { "ie":"10", "node":"6" } - es6.object.freeze { "ie":"10" } - es6.object.get-own-property-descriptor { "ie":"10" } - es7.object.get-own-property-descriptors { "ie":"10", "node":"6" } - es6.object.get-own-property-names { "ie":"10" } - es6.object.get-prototype-of { "ie":"10" } - es7.object.lookup-getter { "chrome":"54", "ie":"10", "node":"6" } - es7.object.lookup-setter { "chrome":"54", "ie":"10", "node":"6" } - es6.object.prevent-extensions { "ie":"10" } - es6.object.to-string { "chrome":"54", "ie":"10", "node":"6" } - es6.object.is { "ie":"10" } - es6.object.is-frozen { "ie":"10" } - es6.object.is-sealed { "ie":"10" } - es6.object.is-extensible { "ie":"10" } - es6.object.keys { "ie":"10" } - es6.object.seal { "ie":"10" } - es6.object.set-prototype-of { "ie":"10" } - es7.object.values { "ie":"10", "node":"6" } - es6.promise { "ie":"10", "node":"6" } - es7.promise.finally { "chrome":"54", "ie":"10", "node":"6" } - es6.reflect.apply { "ie":"10" } - es6.reflect.construct { "ie":"10" } - es6.reflect.define-property { "ie":"10" } - es6.reflect.delete-property { "ie":"10" } - es6.reflect.get { "ie":"10" } - es6.reflect.get-own-property-descriptor { "ie":"10" } - es6.reflect.get-prototype-of { "ie":"10" } - es6.reflect.has { "ie":"10" } - es6.reflect.is-extensible { "ie":"10" } - es6.reflect.own-keys { "ie":"10" } - es6.reflect.prevent-extensions { "ie":"10" } - es6.reflect.set { "ie":"10" } - es6.reflect.set-prototype-of { "ie":"10" } - es6.regexp.constructor { "ie":"10" } - es6.regexp.flags { "ie":"10" } - es6.regexp.match { "ie":"10" } - es6.regexp.replace { "ie":"10" } - es6.regexp.split { "ie":"10" } - es6.regexp.search { "ie":"10" } - es6.regexp.to-string { "ie":"10" } - es6.set { "ie":"10", "node":"6" } - es6.symbol { "ie":"10", "node":"6" } - es7.symbol.async-iterator { "chrome":"54", "ie":"10", "node":"6" } - es6.string.anchor { "ie":"10" } - es6.string.big { "ie":"10" } - es6.string.blink { "ie":"10" } - es6.string.bold { "ie":"10" } - es6.string.code-point-at { "ie":"10" } - es6.string.ends-with { "ie":"10" } - es6.string.fixed { "ie":"10" } - es6.string.fontcolor { "ie":"10" } - es6.string.fontsize { "ie":"10" } - es6.string.from-code-point { "ie":"10" } - es6.string.includes { "ie":"10" } - es6.string.italics { "ie":"10" } - es6.string.iterator { "ie":"10" } - es6.string.link { "ie":"10" } - es7.string.pad-start { "chrome":"54", "ie":"10", "node":"6" } - es7.string.pad-end { "chrome":"54", "ie":"10", "node":"6" } - es6.string.raw { "ie":"10" } - es6.string.repeat { "ie":"10" } - es6.string.small { "ie":"10" } - es6.string.starts-with { "ie":"10" } - es6.string.strike { "ie":"10" } - es6.string.sub { "ie":"10" } - es6.string.sup { "ie":"10" } - es7.string.trim-left { "chrome":"54", "ie":"10", "node":"6" } - es7.string.trim-right { "chrome":"54", "ie":"10", "node":"6" } - es6.typed.array-buffer { "ie":"10", "node":"6" } - es6.typed.int8-array { "ie":"10", "node":"6" } - es6.typed.uint8-array { "ie":"10", "node":"6" } - es6.typed.uint8-clamped-array { "ie":"10", "node":"6" } - es6.typed.int16-array { "ie":"10", "node":"6" } - es6.typed.uint16-array { "ie":"10", "node":"6" } - es6.typed.int32-array { "ie":"10", "node":"6" } - es6.typed.uint32-array { "ie":"10", "node":"6" } - es6.typed.float32-array { "ie":"10", "node":"6" } - es6.typed.float64-array { "ie":"10", "node":"6" } - es6.weak-map { "ie":"10", "node":"6" } - es6.weak-set { "ie":"10", "node":"6" } - web.timers { "chrome":"54", "ie":"10", "node":"6" } - web.immediate { "chrome":"54", "ie":"10", "node":"6" } - web.dom.iterable { "chrome":"54", "ie":"10", "node":"6" } -Successfully compiled 1 file with Babel. \ No newline at end of file diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-all-chrome-71/options.json b/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-all-chrome-71/options.json deleted file mode 100644 index b9db1e21e401..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-all-chrome-71/options.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "presets": [ - ["../../lib", { - "debug": true, - "targets": { - "browsers": "chrome 71" - }, - "shippedProposals": true, - "useBuiltIns": "entry", - "corejs": 3 - }] - ] -} diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-all-chrome-71/stdout.txt b/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-all-chrome-71/stdout.txt deleted file mode 100644 index 9bd35deedc21..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-all-chrome-71/stdout.txt +++ /dev/null @@ -1,106 +0,0 @@ -@babel/preset-env: `DEBUG` option - -Using targets: -{ - "chrome": "71" -} - -Using modules transform: auto - -Using plugins: - syntax-async-generators { "chrome":"71" } - syntax-object-rest-spread { "chrome":"71" } - syntax-json-strings { "chrome":"71" } - syntax-optional-catch-binding { "chrome":"71" } - -Using polyfills with `entry` option: - -[/src/in.js] Replaced core-js entries with the following polyfills: - es.array.unscopables.flat { "chrome":"71" } - es.array.unscopables.flat-map { "chrome":"71" } - es.object.from-entries { "chrome":"71" } - esnext.aggregate-error { "chrome":"71" } - esnext.array.last-index { "chrome":"71" } - esnext.array.last-item { "chrome":"71" } - esnext.composite-key { "chrome":"71" } - esnext.composite-symbol { "chrome":"71" } - esnext.map.delete-all { "chrome":"71" } - esnext.map.every { "chrome":"71" } - esnext.map.filter { "chrome":"71" } - esnext.map.find { "chrome":"71" } - esnext.map.find-key { "chrome":"71" } - esnext.map.from { "chrome":"71" } - esnext.map.group-by { "chrome":"71" } - esnext.map.includes { "chrome":"71" } - esnext.map.key-by { "chrome":"71" } - esnext.map.key-of { "chrome":"71" } - esnext.map.map-keys { "chrome":"71" } - esnext.map.map-values { "chrome":"71" } - esnext.map.merge { "chrome":"71" } - esnext.map.of { "chrome":"71" } - esnext.map.reduce { "chrome":"71" } - esnext.map.some { "chrome":"71" } - esnext.map.update { "chrome":"71" } - esnext.math.clamp { "chrome":"71" } - esnext.math.deg-per-rad { "chrome":"71" } - esnext.math.degrees { "chrome":"71" } - esnext.math.fscale { "chrome":"71" } - esnext.math.iaddh { "chrome":"71" } - esnext.math.imulh { "chrome":"71" } - esnext.math.isubh { "chrome":"71" } - esnext.math.rad-per-deg { "chrome":"71" } - esnext.math.radians { "chrome":"71" } - esnext.math.scale { "chrome":"71" } - esnext.math.seeded-prng { "chrome":"71" } - esnext.math.signbit { "chrome":"71" } - esnext.math.umulh { "chrome":"71" } - esnext.number.from-string { "chrome":"71" } - esnext.observable { "chrome":"71" } - esnext.promise.all-settled { "chrome":"71" } - esnext.promise.any { "chrome":"71" } - esnext.promise.try { "chrome":"71" } - esnext.reflect.define-metadata { "chrome":"71" } - esnext.reflect.delete-metadata { "chrome":"71" } - esnext.reflect.get-metadata { "chrome":"71" } - esnext.reflect.get-metadata-keys { "chrome":"71" } - esnext.reflect.get-own-metadata { "chrome":"71" } - esnext.reflect.get-own-metadata-keys { "chrome":"71" } - esnext.reflect.has-metadata { "chrome":"71" } - esnext.reflect.has-own-metadata { "chrome":"71" } - esnext.reflect.metadata { "chrome":"71" } - esnext.set.add-all { "chrome":"71" } - esnext.set.delete-all { "chrome":"71" } - esnext.set.difference { "chrome":"71" } - esnext.set.every { "chrome":"71" } - esnext.set.filter { "chrome":"71" } - esnext.set.find { "chrome":"71" } - esnext.set.from { "chrome":"71" } - esnext.set.intersection { "chrome":"71" } - esnext.set.is-disjoint-from { "chrome":"71" } - esnext.set.is-subset-of { "chrome":"71" } - esnext.set.is-superset-of { "chrome":"71" } - esnext.set.join { "chrome":"71" } - esnext.set.map { "chrome":"71" } - esnext.set.of { "chrome":"71" } - esnext.set.reduce { "chrome":"71" } - esnext.set.some { "chrome":"71" } - esnext.set.symmetric-difference { "chrome":"71" } - esnext.set.union { "chrome":"71" } - esnext.string.at { "chrome":"71" } - esnext.string.code-points { "chrome":"71" } - esnext.string.replace-all { "chrome":"71" } - esnext.symbol.dispose { "chrome":"71" } - esnext.symbol.observable { "chrome":"71" } - esnext.symbol.pattern-match { "chrome":"71" } - esnext.weak-map.delete-all { "chrome":"71" } - esnext.weak-map.from { "chrome":"71" } - esnext.weak-map.of { "chrome":"71" } - esnext.weak-set.add-all { "chrome":"71" } - esnext.weak-set.delete-all { "chrome":"71" } - esnext.weak-set.from { "chrome":"71" } - esnext.weak-set.of { "chrome":"71" } - web.immediate { "chrome":"71" } - esnext.string.match-all { "chrome":"71" } - -[/src/in.js] Based on your targets, regenerator-runtime import excluded. -Successfully compiled 1 file with Babel. \ No newline at end of file diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-all/options.json b/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-all/options.json deleted file mode 100644 index 1e5ef9ed0a56..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-all/options.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "presets": [ - ["../../lib", { - "debug": true, - "shippedProposals": true, - "useBuiltIns": "entry", - "corejs": 3 - }] - ] -} diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-all/stdout.txt b/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-all/stdout.txt deleted file mode 100644 index cf2f612260b2..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-all/stdout.txt +++ /dev/null @@ -1,335 +0,0 @@ -@babel/preset-env: `DEBUG` option - -Using targets: -{} - -Using modules transform: auto - -Using plugins: - transform-template-literals {} - transform-literals {} - transform-function-name {} - transform-arrow-functions {} - transform-block-scoped-functions {} - transform-classes {} - transform-object-super {} - transform-shorthand-properties {} - transform-duplicate-keys {} - transform-computed-properties {} - transform-for-of {} - transform-sticky-regex {} - transform-dotall-regex {} - transform-unicode-regex {} - transform-spread {} - transform-parameters {} - transform-destructuring {} - transform-block-scoping {} - transform-typeof-symbol {} - transform-new-target {} - transform-regenerator {} - transform-exponentiation-operator {} - transform-async-to-generator {} - proposal-async-generator-functions {} - proposal-object-rest-spread {} - proposal-unicode-property-regex {} - proposal-json-strings {} - proposal-optional-catch-binding {} - transform-named-capturing-groups-regex {} - transform-member-expression-literals {} - transform-property-literals {} - transform-reserved-words {} - -Using polyfills with `entry` option: - -[/src/in.js] Replaced core-js entries with the following polyfills: - es.symbol {} - es.symbol.description {} - es.symbol.async-iterator {} - es.symbol.has-instance {} - es.symbol.is-concat-spreadable {} - es.symbol.iterator {} - es.symbol.match {} - es.symbol.replace {} - es.symbol.search {} - es.symbol.species {} - es.symbol.split {} - es.symbol.to-primitive {} - es.symbol.to-string-tag {} - es.symbol.unscopables {} - es.array.concat {} - es.array.copy-within {} - es.array.every {} - es.array.fill {} - es.array.filter {} - es.array.find {} - es.array.find-index {} - es.array.flat {} - es.array.flat-map {} - es.array.for-each {} - es.array.from {} - es.array.includes {} - es.array.index-of {} - es.array.is-array {} - es.array.iterator {} - es.array.join {} - es.array.last-index-of {} - es.array.map {} - es.array.of {} - es.array.reduce {} - es.array.reduce-right {} - es.array.reverse {} - es.array.slice {} - es.array.some {} - es.array.sort {} - es.array.species {} - es.array.splice {} - es.array.unscopables.flat {} - es.array.unscopables.flat-map {} - es.array-buffer.constructor {} - es.array-buffer.is-view {} - es.array-buffer.slice {} - es.data-view {} - es.date.now {} - es.date.to-iso-string {} - es.date.to-json {} - es.date.to-primitive {} - es.date.to-string {} - es.function.bind {} - es.function.has-instance {} - es.function.name {} - es.json.to-string-tag {} - es.map {} - es.math.acosh {} - es.math.asinh {} - es.math.atanh {} - es.math.cbrt {} - es.math.clz32 {} - es.math.cosh {} - es.math.expm1 {} - es.math.fround {} - es.math.hypot {} - es.math.imul {} - es.math.log10 {} - es.math.log1p {} - es.math.log2 {} - es.math.sign {} - es.math.sinh {} - es.math.tanh {} - es.math.to-string-tag {} - es.math.trunc {} - es.number.constructor {} - es.number.epsilon {} - es.number.is-finite {} - es.number.is-integer {} - es.number.is-nan {} - es.number.is-safe-integer {} - es.number.max-safe-integer {} - es.number.min-safe-integer {} - es.number.parse-float {} - es.number.parse-int {} - es.number.to-fixed {} - es.number.to-precision {} - es.object.assign {} - es.object.create {} - es.object.define-getter {} - es.object.define-properties {} - es.object.define-property {} - es.object.define-setter {} - es.object.entries {} - es.object.freeze {} - es.object.from-entries {} - es.object.get-own-property-descriptor {} - es.object.get-own-property-descriptors {} - es.object.get-own-property-names {} - es.object.get-prototype-of {} - es.object.is {} - es.object.is-extensible {} - es.object.is-frozen {} - es.object.is-sealed {} - es.object.keys {} - es.object.lookup-getter {} - es.object.lookup-setter {} - es.object.prevent-extensions {} - es.object.seal {} - es.object.set-prototype-of {} - es.object.to-string {} - es.object.values {} - es.parse-float {} - es.parse-int {} - es.promise {} - es.promise.finally {} - es.reflect.apply {} - es.reflect.construct {} - es.reflect.define-property {} - es.reflect.delete-property {} - es.reflect.get {} - es.reflect.get-own-property-descriptor {} - es.reflect.get-prototype-of {} - es.reflect.has {} - es.reflect.is-extensible {} - es.reflect.own-keys {} - es.reflect.prevent-extensions {} - es.reflect.set {} - es.reflect.set-prototype-of {} - es.regexp.constructor {} - es.regexp.exec {} - es.regexp.flags {} - es.regexp.to-string {} - es.set {} - es.string.code-point-at {} - es.string.ends-with {} - es.string.from-code-point {} - es.string.includes {} - es.string.iterator {} - es.string.match {} - es.string.pad-end {} - es.string.pad-start {} - es.string.raw {} - es.string.repeat {} - es.string.replace {} - es.string.search {} - es.string.split {} - es.string.starts-with {} - es.string.trim {} - es.string.trim-end {} - es.string.trim-start {} - es.string.anchor {} - es.string.big {} - es.string.blink {} - es.string.bold {} - es.string.fixed {} - es.string.fontcolor {} - es.string.fontsize {} - es.string.italics {} - es.string.link {} - es.string.small {} - es.string.strike {} - es.string.sub {} - es.string.sup {} - es.typed-array.float32-array {} - es.typed-array.float64-array {} - es.typed-array.int8-array {} - es.typed-array.int16-array {} - es.typed-array.int32-array {} - es.typed-array.uint8-array {} - es.typed-array.uint8-clamped-array {} - es.typed-array.uint16-array {} - es.typed-array.uint32-array {} - es.typed-array.copy-within {} - es.typed-array.every {} - es.typed-array.fill {} - es.typed-array.filter {} - es.typed-array.find {} - es.typed-array.find-index {} - es.typed-array.for-each {} - es.typed-array.from {} - es.typed-array.includes {} - es.typed-array.index-of {} - es.typed-array.iterator {} - es.typed-array.join {} - es.typed-array.last-index-of {} - es.typed-array.map {} - es.typed-array.of {} - es.typed-array.reduce {} - es.typed-array.reduce-right {} - es.typed-array.reverse {} - es.typed-array.set {} - es.typed-array.slice {} - es.typed-array.some {} - es.typed-array.sort {} - es.typed-array.subarray {} - es.typed-array.to-locale-string {} - es.typed-array.to-string {} - es.weak-map {} - es.weak-set {} - esnext.aggregate-error {} - esnext.array.last-index {} - esnext.array.last-item {} - esnext.composite-key {} - esnext.composite-symbol {} - esnext.global-this {} - esnext.map.delete-all {} - esnext.map.every {} - esnext.map.filter {} - esnext.map.find {} - esnext.map.find-key {} - esnext.map.from {} - esnext.map.group-by {} - esnext.map.includes {} - esnext.map.key-by {} - esnext.map.key-of {} - esnext.map.map-keys {} - esnext.map.map-values {} - esnext.map.merge {} - esnext.map.of {} - esnext.map.reduce {} - esnext.map.some {} - esnext.map.update {} - esnext.math.clamp {} - esnext.math.deg-per-rad {} - esnext.math.degrees {} - esnext.math.fscale {} - esnext.math.iaddh {} - esnext.math.imulh {} - esnext.math.isubh {} - esnext.math.rad-per-deg {} - esnext.math.radians {} - esnext.math.scale {} - esnext.math.seeded-prng {} - esnext.math.signbit {} - esnext.math.umulh {} - esnext.number.from-string {} - esnext.observable {} - esnext.promise.all-settled {} - esnext.promise.any {} - esnext.promise.try {} - esnext.reflect.define-metadata {} - esnext.reflect.delete-metadata {} - esnext.reflect.get-metadata {} - esnext.reflect.get-metadata-keys {} - esnext.reflect.get-own-metadata {} - esnext.reflect.get-own-metadata-keys {} - esnext.reflect.has-metadata {} - esnext.reflect.has-own-metadata {} - esnext.reflect.metadata {} - esnext.set.add-all {} - esnext.set.delete-all {} - esnext.set.difference {} - esnext.set.every {} - esnext.set.filter {} - esnext.set.find {} - esnext.set.from {} - esnext.set.intersection {} - esnext.set.is-disjoint-from {} - esnext.set.is-subset-of {} - esnext.set.is-superset-of {} - esnext.set.join {} - esnext.set.map {} - esnext.set.of {} - esnext.set.reduce {} - esnext.set.some {} - esnext.set.symmetric-difference {} - esnext.set.union {} - esnext.string.at {} - esnext.string.code-points {} - esnext.string.replace-all {} - esnext.symbol.dispose {} - esnext.symbol.observable {} - esnext.symbol.pattern-match {} - esnext.weak-map.delete-all {} - esnext.weak-map.from {} - esnext.weak-map.of {} - esnext.weak-set.add-all {} - esnext.weak-set.delete-all {} - esnext.weak-set.from {} - esnext.weak-set.of {} - web.dom-collections.for-each {} - web.dom-collections.iterator {} - web.immediate {} - web.queue-microtask {} - web.timers {} - web.url {} - web.url.to-json {} - web.url-search-params {} - esnext.string.match-all {} -Successfully compiled 1 file with Babel. \ No newline at end of file diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-android/options.json b/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-android/options.json deleted file mode 100644 index e7f7ecdb7292..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-android/options.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "presets": [ - ["../../lib", { - "debug": true, - "targets": { - "browsers": [ "Android >= 4" ] - }, - "useBuiltIns": "entry", - "corejs": 3 - }] - ] -} diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-android/stdout.txt b/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-android/stdout.txt deleted file mode 100644 index b73850b76698..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-android/stdout.txt +++ /dev/null @@ -1,248 +0,0 @@ -@babel/preset-env: `DEBUG` option - -Using targets: -{ - "android": "4" -} - -Using modules transform: auto - -Using plugins: - transform-template-literals { "android":"4" } - transform-literals { "android":"4" } - transform-function-name { "android":"4" } - transform-arrow-functions { "android":"4" } - transform-block-scoped-functions { "android":"4" } - transform-classes { "android":"4" } - transform-object-super { "android":"4" } - transform-shorthand-properties { "android":"4" } - transform-duplicate-keys { "android":"4" } - transform-computed-properties { "android":"4" } - transform-for-of { "android":"4" } - transform-sticky-regex { "android":"4" } - transform-dotall-regex { "android":"4" } - transform-unicode-regex { "android":"4" } - transform-spread { "android":"4" } - transform-parameters { "android":"4" } - transform-destructuring { "android":"4" } - transform-block-scoping { "android":"4" } - transform-typeof-symbol { "android":"4" } - transform-new-target { "android":"4" } - transform-regenerator { "android":"4" } - transform-exponentiation-operator { "android":"4" } - transform-async-to-generator { "android":"4" } - proposal-async-generator-functions { "android":"4" } - proposal-object-rest-spread { "android":"4" } - proposal-unicode-property-regex { "android":"4" } - proposal-json-strings { "android":"4" } - proposal-optional-catch-binding { "android":"4" } - transform-named-capturing-groups-regex { "android":"4" } - transform-reserved-words { "android":"4" } - -Using polyfills with `entry` option: - -[/src/in.js] Replaced core-js entries with the following polyfills: - es.symbol { "android":"4" } - es.symbol.description { "android":"4" } - es.symbol.async-iterator { "android":"4" } - es.symbol.has-instance { "android":"4" } - es.symbol.is-concat-spreadable { "android":"4" } - es.symbol.iterator { "android":"4" } - es.symbol.match { "android":"4" } - es.symbol.replace { "android":"4" } - es.symbol.search { "android":"4" } - es.symbol.species { "android":"4" } - es.symbol.split { "android":"4" } - es.symbol.to-primitive { "android":"4" } - es.symbol.to-string-tag { "android":"4" } - es.symbol.unscopables { "android":"4" } - es.array.concat { "android":"4" } - es.array.copy-within { "android":"4" } - es.array.every { "android":"4" } - es.array.fill { "android":"4" } - es.array.filter { "android":"4" } - es.array.find { "android":"4" } - es.array.find-index { "android":"4" } - es.array.flat { "android":"4" } - es.array.flat-map { "android":"4" } - es.array.for-each { "android":"4" } - es.array.from { "android":"4" } - es.array.includes { "android":"4" } - es.array.index-of { "android":"4" } - es.array.iterator { "android":"4" } - es.array.join { "android":"4" } - es.array.last-index-of { "android":"4" } - es.array.map { "android":"4" } - es.array.of { "android":"4" } - es.array.reduce { "android":"4" } - es.array.reduce-right { "android":"4" } - es.array.reverse { "android":"4" } - es.array.slice { "android":"4" } - es.array.some { "android":"4" } - es.array.sort { "android":"4" } - es.array.species { "android":"4" } - es.array.splice { "android":"4" } - es.array.unscopables.flat { "android":"4" } - es.array.unscopables.flat-map { "android":"4" } - es.array-buffer.constructor { "android":"4" } - es.array-buffer.is-view { "android":"4" } - es.array-buffer.slice { "android":"4" } - es.data-view { "android":"4" } - es.date.to-iso-string { "android":"4" } - es.date.to-json { "android":"4" } - es.date.to-primitive { "android":"4" } - es.date.to-string { "android":"4" } - es.function.has-instance { "android":"4" } - es.function.name { "android":"4" } - es.json.to-string-tag { "android":"4" } - es.map { "android":"4" } - es.math.acosh { "android":"4" } - es.math.asinh { "android":"4" } - es.math.atanh { "android":"4" } - es.math.cbrt { "android":"4" } - es.math.clz32 { "android":"4" } - es.math.cosh { "android":"4" } - es.math.expm1 { "android":"4" } - es.math.fround { "android":"4" } - es.math.hypot { "android":"4" } - es.math.imul { "android":"4" } - es.math.log10 { "android":"4" } - es.math.log1p { "android":"4" } - es.math.log2 { "android":"4" } - es.math.sign { "android":"4" } - es.math.sinh { "android":"4" } - es.math.tanh { "android":"4" } - es.math.to-string-tag { "android":"4" } - es.math.trunc { "android":"4" } - es.number.constructor { "android":"4" } - es.number.epsilon { "android":"4" } - es.number.is-finite { "android":"4" } - es.number.is-integer { "android":"4" } - es.number.is-nan { "android":"4" } - es.number.is-safe-integer { "android":"4" } - es.number.max-safe-integer { "android":"4" } - es.number.min-safe-integer { "android":"4" } - es.number.parse-float { "android":"4" } - es.number.parse-int { "android":"4" } - es.number.to-fixed { "android":"4" } - es.number.to-precision { "android":"4" } - es.object.assign { "android":"4" } - es.object.define-getter { "android":"4" } - es.object.define-properties { "android":"4" } - es.object.define-property { "android":"4" } - es.object.define-setter { "android":"4" } - es.object.entries { "android":"4" } - es.object.freeze { "android":"4" } - es.object.from-entries { "android":"4" } - es.object.get-own-property-descriptor { "android":"4" } - es.object.get-own-property-descriptors { "android":"4" } - es.object.get-own-property-names { "android":"4" } - es.object.get-prototype-of { "android":"4" } - es.object.is { "android":"4" } - es.object.is-extensible { "android":"4" } - es.object.is-frozen { "android":"4" } - es.object.is-sealed { "android":"4" } - es.object.keys { "android":"4" } - es.object.lookup-getter { "android":"4" } - es.object.lookup-setter { "android":"4" } - es.object.prevent-extensions { "android":"4" } - es.object.seal { "android":"4" } - es.object.set-prototype-of { "android":"4" } - es.object.to-string { "android":"4" } - es.object.values { "android":"4" } - es.parse-float { "android":"4" } - es.parse-int { "android":"4" } - es.promise { "android":"4" } - es.promise.finally { "android":"4" } - es.reflect.apply { "android":"4" } - es.reflect.construct { "android":"4" } - es.reflect.define-property { "android":"4" } - es.reflect.delete-property { "android":"4" } - es.reflect.get { "android":"4" } - es.reflect.get-own-property-descriptor { "android":"4" } - es.reflect.get-prototype-of { "android":"4" } - es.reflect.has { "android":"4" } - es.reflect.is-extensible { "android":"4" } - es.reflect.own-keys { "android":"4" } - es.reflect.prevent-extensions { "android":"4" } - es.reflect.set { "android":"4" } - es.reflect.set-prototype-of { "android":"4" } - es.regexp.constructor { "android":"4" } - es.regexp.exec { "android":"4" } - es.regexp.flags { "android":"4" } - es.regexp.to-string { "android":"4" } - es.set { "android":"4" } - es.string.code-point-at { "android":"4" } - es.string.ends-with { "android":"4" } - es.string.from-code-point { "android":"4" } - es.string.includes { "android":"4" } - es.string.iterator { "android":"4" } - es.string.match { "android":"4" } - es.string.pad-end { "android":"4" } - es.string.pad-start { "android":"4" } - es.string.raw { "android":"4" } - es.string.repeat { "android":"4" } - es.string.replace { "android":"4" } - es.string.search { "android":"4" } - es.string.split { "android":"4" } - es.string.starts-with { "android":"4" } - es.string.trim { "android":"4" } - es.string.trim-end { "android":"4" } - es.string.trim-start { "android":"4" } - es.string.anchor { "android":"4" } - es.string.big { "android":"4" } - es.string.blink { "android":"4" } - es.string.bold { "android":"4" } - es.string.fixed { "android":"4" } - es.string.fontcolor { "android":"4" } - es.string.fontsize { "android":"4" } - es.string.italics { "android":"4" } - es.string.link { "android":"4" } - es.string.small { "android":"4" } - es.string.strike { "android":"4" } - es.string.sub { "android":"4" } - es.string.sup { "android":"4" } - es.typed-array.float32-array { "android":"4" } - es.typed-array.float64-array { "android":"4" } - es.typed-array.int8-array { "android":"4" } - es.typed-array.int16-array { "android":"4" } - es.typed-array.int32-array { "android":"4" } - es.typed-array.uint8-array { "android":"4" } - es.typed-array.uint8-clamped-array { "android":"4" } - es.typed-array.uint16-array { "android":"4" } - es.typed-array.uint32-array { "android":"4" } - es.typed-array.copy-within { "android":"4" } - es.typed-array.every { "android":"4" } - es.typed-array.fill { "android":"4" } - es.typed-array.filter { "android":"4" } - es.typed-array.find { "android":"4" } - es.typed-array.find-index { "android":"4" } - es.typed-array.for-each { "android":"4" } - es.typed-array.from { "android":"4" } - es.typed-array.includes { "android":"4" } - es.typed-array.index-of { "android":"4" } - es.typed-array.iterator { "android":"4" } - es.typed-array.join { "android":"4" } - es.typed-array.last-index-of { "android":"4" } - es.typed-array.map { "android":"4" } - es.typed-array.of { "android":"4" } - es.typed-array.reduce { "android":"4" } - es.typed-array.reduce-right { "android":"4" } - es.typed-array.reverse { "android":"4" } - es.typed-array.set { "android":"4" } - es.typed-array.slice { "android":"4" } - es.typed-array.some { "android":"4" } - es.typed-array.sort { "android":"4" } - es.typed-array.subarray { "android":"4" } - es.typed-array.to-locale-string { "android":"4" } - es.typed-array.to-string { "android":"4" } - es.weak-map { "android":"4" } - es.weak-set { "android":"4" } - web.dom-collections.for-each { "android":"4" } - web.dom-collections.iterator { "android":"4" } - web.immediate { "android":"4" } - web.queue-microtask { "android":"4" } - web.url { "android":"4" } - web.url.to-json { "android":"4" } - web.url-search-params { "android":"4" } -Successfully compiled 1 file with Babel. \ No newline at end of file diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-babel-polyfill/options.json b/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-babel-polyfill/options.json deleted file mode 100644 index 1e5ef9ed0a56..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-babel-polyfill/options.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "presets": [ - ["../../lib", { - "debug": true, - "shippedProposals": true, - "useBuiltIns": "entry", - "corejs": 3 - }] - ] -} diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-babel-polyfill/stdout.txt b/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-babel-polyfill/stdout.txt deleted file mode 100644 index 22616b88ea89..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-babel-polyfill/stdout.txt +++ /dev/null @@ -1,45 +0,0 @@ -@babel/preset-env: `DEBUG` option - -Using targets: -{} - -Using modules transform: auto - -Using plugins: - transform-template-literals {} - transform-literals {} - transform-function-name {} - transform-arrow-functions {} - transform-block-scoped-functions {} - transform-classes {} - transform-object-super {} - transform-shorthand-properties {} - transform-duplicate-keys {} - transform-computed-properties {} - transform-for-of {} - transform-sticky-regex {} - transform-dotall-regex {} - transform-unicode-regex {} - transform-spread {} - transform-parameters {} - transform-destructuring {} - transform-block-scoping {} - transform-typeof-symbol {} - transform-new-target {} - transform-regenerator {} - transform-exponentiation-operator {} - transform-async-to-generator {} - proposal-async-generator-functions {} - proposal-object-rest-spread {} - proposal-unicode-property-regex {} - proposal-json-strings {} - proposal-optional-catch-binding {} - transform-named-capturing-groups-regex {} - transform-member-expression-literals {} - transform-property-literals {} - transform-reserved-words {} - -Using polyfills with `entry` option: - -[/src/in.js] Import of core-js was not found. -Successfully compiled 1 file with Babel. \ No newline at end of file diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-electron/options.json b/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-electron/options.json deleted file mode 100644 index acc203c75c8e..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-electron/options.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "presets": [ - ["../../lib", { - "debug": true, - "targets": { - "electron": 0.36 - }, - "useBuiltIns": "entry", - "corejs": 3 - }] - ] -} diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-electron/stdout.txt b/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-electron/stdout.txt deleted file mode 100644 index f554ec16ce1f..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-electron/stdout.txt +++ /dev/null @@ -1,136 +0,0 @@ -Warning, the following targets are using a decimal version: - - electron: 0.36 - -We recommend using a string for minor/patch versions to avoid numbers like 6.10 -getting parsed as 6.1, which can lead to unexpected behavior. - -@babel/preset-env: `DEBUG` option - -Using targets: -{ - "electron": "0.36" -} - -Using modules transform: auto - -Using plugins: - transform-function-name { "electron":"0.36" } - transform-for-of { "electron":"0.36" } - transform-sticky-regex { "electron":"0.36" } - transform-dotall-regex { "electron":"0.36" } - transform-unicode-regex { "electron":"0.36" } - transform-parameters { "electron":"0.36" } - transform-destructuring { "electron":"0.36" } - transform-block-scoping { "electron":"0.36" } - transform-regenerator { "electron":"0.36" } - transform-exponentiation-operator { "electron":"0.36" } - transform-async-to-generator { "electron":"0.36" } - proposal-async-generator-functions { "electron":"0.36" } - proposal-object-rest-spread { "electron":"0.36" } - proposal-unicode-property-regex { "electron":"0.36" } - proposal-json-strings { "electron":"0.36" } - proposal-optional-catch-binding { "electron":"0.36" } - transform-named-capturing-groups-regex { "electron":"0.36" } - transform-member-expression-literals { "electron":"0.36" } - transform-property-literals { "electron":"0.36" } - -Using polyfills with `entry` option: - -[/src/in.js] Replaced core-js entries with the following polyfills: - es.symbol { "electron":"0.36" } - es.symbol.description { "electron":"0.36" } - es.symbol.async-iterator { "electron":"0.36" } - es.symbol.has-instance { "electron":"0.36" } - es.symbol.is-concat-spreadable { "electron":"0.36" } - es.symbol.match { "electron":"0.36" } - es.symbol.replace { "electron":"0.36" } - es.symbol.search { "electron":"0.36" } - es.symbol.species { "electron":"0.36" } - es.symbol.split { "electron":"0.36" } - es.symbol.to-string-tag { "electron":"0.36" } - es.array.concat { "electron":"0.36" } - es.array.filter { "electron":"0.36" } - es.array.flat { "electron":"0.36" } - es.array.flat-map { "electron":"0.36" } - es.array.from { "electron":"0.36" } - es.array.includes { "electron":"0.36" } - es.array.index-of { "electron":"0.36" } - es.array.iterator { "electron":"0.36" } - es.array.last-index-of { "electron":"0.36" } - es.array.map { "electron":"0.36" } - es.array.slice { "electron":"0.36" } - es.array.sort { "electron":"0.36" } - es.array.species { "electron":"0.36" } - es.array.splice { "electron":"0.36" } - es.array.unscopables.flat { "electron":"0.36" } - es.array.unscopables.flat-map { "electron":"0.36" } - es.function.has-instance { "electron":"0.36" } - es.json.to-string-tag { "electron":"0.36" } - es.map { "electron":"0.36" } - es.math.acosh { "electron":"0.36" } - es.math.to-string-tag { "electron":"0.36" } - es.object.assign { "electron":"0.36" } - es.object.define-getter { "electron":"0.36" } - es.object.define-setter { "electron":"0.36" } - es.object.entries { "electron":"0.36" } - es.object.from-entries { "electron":"0.36" } - es.object.get-own-property-descriptors { "electron":"0.36" } - es.object.lookup-getter { "electron":"0.36" } - es.object.lookup-setter { "electron":"0.36" } - es.object.to-string { "electron":"0.36" } - es.object.values { "electron":"0.36" } - es.promise { "electron":"0.36" } - es.promise.finally { "electron":"0.36" } - es.reflect.apply { "electron":"0.36" } - es.reflect.construct { "electron":"0.36" } - es.reflect.define-property { "electron":"0.36" } - es.reflect.delete-property { "electron":"0.36" } - es.reflect.get { "electron":"0.36" } - es.reflect.get-own-property-descriptor { "electron":"0.36" } - es.reflect.get-prototype-of { "electron":"0.36" } - es.reflect.has { "electron":"0.36" } - es.reflect.is-extensible { "electron":"0.36" } - es.reflect.own-keys { "electron":"0.36" } - es.reflect.prevent-extensions { "electron":"0.36" } - es.reflect.set { "electron":"0.36" } - es.reflect.set-prototype-of { "electron":"0.36" } - es.regexp.constructor { "electron":"0.36" } - es.regexp.flags { "electron":"0.36" } - es.regexp.to-string { "electron":"0.36" } - es.set { "electron":"0.36" } - es.string.ends-with { "electron":"0.36" } - es.string.includes { "electron":"0.36" } - es.string.match { "electron":"0.36" } - es.string.pad-end { "electron":"0.36" } - es.string.pad-start { "electron":"0.36" } - es.string.replace { "electron":"0.36" } - es.string.search { "electron":"0.36" } - es.string.split { "electron":"0.36" } - es.string.starts-with { "electron":"0.36" } - es.string.trim { "electron":"0.36" } - es.string.trim-end { "electron":"0.36" } - es.string.trim-start { "electron":"0.36" } - es.typed-array.float32-array { "electron":"0.36" } - es.typed-array.float64-array { "electron":"0.36" } - es.typed-array.int8-array { "electron":"0.36" } - es.typed-array.int16-array { "electron":"0.36" } - es.typed-array.int32-array { "electron":"0.36" } - es.typed-array.uint8-array { "electron":"0.36" } - es.typed-array.uint8-clamped-array { "electron":"0.36" } - es.typed-array.uint16-array { "electron":"0.36" } - es.typed-array.uint32-array { "electron":"0.36" } - es.typed-array.from { "electron":"0.36" } - es.typed-array.includes { "electron":"0.36" } - es.typed-array.of { "electron":"0.36" } - es.typed-array.to-string { "electron":"0.36" } - es.weak-map { "electron":"0.36" } - es.weak-set { "electron":"0.36" } - web.dom-collections.for-each { "electron":"0.36" } - web.dom-collections.iterator { "electron":"0.36" } - web.immediate { "electron":"0.36" } - web.queue-microtask { "electron":"0.36" } - web.url { "electron":"0.36" } - web.url.to-json { "electron":"0.36" } - web.url-search-params { "electron":"0.36" } -Successfully compiled 1 file with Babel. \ No newline at end of file diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-es-chrome-71/options.json b/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-es-chrome-71/options.json deleted file mode 100644 index b9db1e21e401..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-es-chrome-71/options.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "presets": [ - ["../../lib", { - "debug": true, - "targets": { - "browsers": "chrome 71" - }, - "shippedProposals": true, - "useBuiltIns": "entry", - "corejs": 3 - }] - ] -} diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-es-chrome-71/stdout.txt b/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-es-chrome-71/stdout.txt deleted file mode 100644 index 1e83b69ce75f..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-es-chrome-71/stdout.txt +++ /dev/null @@ -1,24 +0,0 @@ -@babel/preset-env: `DEBUG` option - -Using targets: -{ - "chrome": "71" -} - -Using modules transform: auto - -Using plugins: - syntax-async-generators { "chrome":"71" } - syntax-object-rest-spread { "chrome":"71" } - syntax-json-strings { "chrome":"71" } - syntax-optional-catch-binding { "chrome":"71" } - -Using polyfills with `entry` option: - -[/src/in.js] Replaced core-js entries with the following polyfills: - es.array.unscopables.flat { "chrome":"71" } - es.array.unscopables.flat-map { "chrome":"71" } - es.object.from-entries { "chrome":"71" } - -[/src/in.js] Based on your targets, regenerator-runtime import excluded. -Successfully compiled 1 file with Babel. \ No newline at end of file diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-es-proposals-chrome-71/options.json b/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-es-proposals-chrome-71/options.json deleted file mode 100644 index b9db1e21e401..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-es-proposals-chrome-71/options.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "presets": [ - ["../../lib", { - "debug": true, - "targets": { - "browsers": "chrome 71" - }, - "shippedProposals": true, - "useBuiltIns": "entry", - "corejs": 3 - }] - ] -} diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-es-proposals-chrome-71/stdout.txt b/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-es-proposals-chrome-71/stdout.txt deleted file mode 100644 index 6d0687966b22..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-es-proposals-chrome-71/stdout.txt +++ /dev/null @@ -1,105 +0,0 @@ -@babel/preset-env: `DEBUG` option - -Using targets: -{ - "chrome": "71" -} - -Using modules transform: auto - -Using plugins: - syntax-async-generators { "chrome":"71" } - syntax-object-rest-spread { "chrome":"71" } - syntax-json-strings { "chrome":"71" } - syntax-optional-catch-binding { "chrome":"71" } - -Using polyfills with `entry` option: - -[/src/in.js] Replaced core-js entries with the following polyfills: - es.array.unscopables.flat { "chrome":"71" } - es.array.unscopables.flat-map { "chrome":"71" } - es.object.from-entries { "chrome":"71" } - esnext.aggregate-error { "chrome":"71" } - esnext.array.last-index { "chrome":"71" } - esnext.array.last-item { "chrome":"71" } - esnext.composite-key { "chrome":"71" } - esnext.composite-symbol { "chrome":"71" } - esnext.map.delete-all { "chrome":"71" } - esnext.map.every { "chrome":"71" } - esnext.map.filter { "chrome":"71" } - esnext.map.find { "chrome":"71" } - esnext.map.find-key { "chrome":"71" } - esnext.map.from { "chrome":"71" } - esnext.map.group-by { "chrome":"71" } - esnext.map.includes { "chrome":"71" } - esnext.map.key-by { "chrome":"71" } - esnext.map.key-of { "chrome":"71" } - esnext.map.map-keys { "chrome":"71" } - esnext.map.map-values { "chrome":"71" } - esnext.map.merge { "chrome":"71" } - esnext.map.of { "chrome":"71" } - esnext.map.reduce { "chrome":"71" } - esnext.map.some { "chrome":"71" } - esnext.map.update { "chrome":"71" } - esnext.math.clamp { "chrome":"71" } - esnext.math.deg-per-rad { "chrome":"71" } - esnext.math.degrees { "chrome":"71" } - esnext.math.fscale { "chrome":"71" } - esnext.math.iaddh { "chrome":"71" } - esnext.math.imulh { "chrome":"71" } - esnext.math.isubh { "chrome":"71" } - esnext.math.rad-per-deg { "chrome":"71" } - esnext.math.radians { "chrome":"71" } - esnext.math.scale { "chrome":"71" } - esnext.math.seeded-prng { "chrome":"71" } - esnext.math.signbit { "chrome":"71" } - esnext.math.umulh { "chrome":"71" } - esnext.number.from-string { "chrome":"71" } - esnext.observable { "chrome":"71" } - esnext.promise.all-settled { "chrome":"71" } - esnext.promise.any { "chrome":"71" } - esnext.promise.try { "chrome":"71" } - esnext.reflect.define-metadata { "chrome":"71" } - esnext.reflect.delete-metadata { "chrome":"71" } - esnext.reflect.get-metadata { "chrome":"71" } - esnext.reflect.get-metadata-keys { "chrome":"71" } - esnext.reflect.get-own-metadata { "chrome":"71" } - esnext.reflect.get-own-metadata-keys { "chrome":"71" } - esnext.reflect.has-metadata { "chrome":"71" } - esnext.reflect.has-own-metadata { "chrome":"71" } - esnext.reflect.metadata { "chrome":"71" } - esnext.set.add-all { "chrome":"71" } - esnext.set.delete-all { "chrome":"71" } - esnext.set.difference { "chrome":"71" } - esnext.set.every { "chrome":"71" } - esnext.set.filter { "chrome":"71" } - esnext.set.find { "chrome":"71" } - esnext.set.from { "chrome":"71" } - esnext.set.intersection { "chrome":"71" } - esnext.set.is-disjoint-from { "chrome":"71" } - esnext.set.is-subset-of { "chrome":"71" } - esnext.set.is-superset-of { "chrome":"71" } - esnext.set.join { "chrome":"71" } - esnext.set.map { "chrome":"71" } - esnext.set.of { "chrome":"71" } - esnext.set.reduce { "chrome":"71" } - esnext.set.some { "chrome":"71" } - esnext.set.symmetric-difference { "chrome":"71" } - esnext.set.union { "chrome":"71" } - esnext.string.at { "chrome":"71" } - esnext.string.code-points { "chrome":"71" } - esnext.string.replace-all { "chrome":"71" } - esnext.symbol.dispose { "chrome":"71" } - esnext.symbol.observable { "chrome":"71" } - esnext.symbol.pattern-match { "chrome":"71" } - esnext.weak-map.delete-all { "chrome":"71" } - esnext.weak-map.from { "chrome":"71" } - esnext.weak-map.of { "chrome":"71" } - esnext.weak-set.add-all { "chrome":"71" } - esnext.weak-set.delete-all { "chrome":"71" } - esnext.weak-set.from { "chrome":"71" } - esnext.weak-set.of { "chrome":"71" } - esnext.string.match-all { "chrome":"71" } - -[/src/in.js] Based on your targets, regenerator-runtime import excluded. -Successfully compiled 1 file with Babel. \ No newline at end of file diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-es-proposals/options.json b/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-es-proposals/options.json deleted file mode 100644 index 1e5ef9ed0a56..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-es-proposals/options.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "presets": [ - ["../../lib", { - "debug": true, - "shippedProposals": true, - "useBuiltIns": "entry", - "corejs": 3 - }] - ] -} diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-es-proposals/stdout.txt b/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-es-proposals/stdout.txt deleted file mode 100644 index 954fd4133665..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-es-proposals/stdout.txt +++ /dev/null @@ -1,330 +0,0 @@ -@babel/preset-env: `DEBUG` option - -Using targets: -{} - -Using modules transform: auto - -Using plugins: - transform-template-literals {} - transform-literals {} - transform-function-name {} - transform-arrow-functions {} - transform-block-scoped-functions {} - transform-classes {} - transform-object-super {} - transform-shorthand-properties {} - transform-duplicate-keys {} - transform-computed-properties {} - transform-for-of {} - transform-sticky-regex {} - transform-dotall-regex {} - transform-unicode-regex {} - transform-spread {} - transform-parameters {} - transform-destructuring {} - transform-block-scoping {} - transform-typeof-symbol {} - transform-new-target {} - transform-regenerator {} - transform-exponentiation-operator {} - transform-async-to-generator {} - proposal-async-generator-functions {} - proposal-object-rest-spread {} - proposal-unicode-property-regex {} - proposal-json-strings {} - proposal-optional-catch-binding {} - transform-named-capturing-groups-regex {} - transform-member-expression-literals {} - transform-property-literals {} - transform-reserved-words {} - -Using polyfills with `entry` option: - -[/src/in.js] Replaced core-js entries with the following polyfills: - es.symbol {} - es.symbol.description {} - es.symbol.async-iterator {} - es.symbol.has-instance {} - es.symbol.is-concat-spreadable {} - es.symbol.iterator {} - es.symbol.match {} - es.symbol.replace {} - es.symbol.search {} - es.symbol.species {} - es.symbol.split {} - es.symbol.to-primitive {} - es.symbol.to-string-tag {} - es.symbol.unscopables {} - es.array.concat {} - es.array.copy-within {} - es.array.every {} - es.array.fill {} - es.array.filter {} - es.array.find {} - es.array.find-index {} - es.array.flat {} - es.array.flat-map {} - es.array.for-each {} - es.array.from {} - es.array.includes {} - es.array.index-of {} - es.array.is-array {} - es.array.iterator {} - es.array.join {} - es.array.last-index-of {} - es.array.map {} - es.array.of {} - es.array.reduce {} - es.array.reduce-right {} - es.array.reverse {} - es.array.slice {} - es.array.some {} - es.array.sort {} - es.array.species {} - es.array.splice {} - es.array.unscopables.flat {} - es.array.unscopables.flat-map {} - es.array-buffer.constructor {} - es.array-buffer.is-view {} - es.array-buffer.slice {} - es.data-view {} - es.date.now {} - es.date.to-iso-string {} - es.date.to-json {} - es.date.to-primitive {} - es.date.to-string {} - es.function.bind {} - es.function.has-instance {} - es.function.name {} - es.json.to-string-tag {} - es.map {} - es.math.acosh {} - es.math.asinh {} - es.math.atanh {} - es.math.cbrt {} - es.math.clz32 {} - es.math.cosh {} - es.math.expm1 {} - es.math.fround {} - es.math.hypot {} - es.math.imul {} - es.math.log10 {} - es.math.log1p {} - es.math.log2 {} - es.math.sign {} - es.math.sinh {} - es.math.tanh {} - es.math.to-string-tag {} - es.math.trunc {} - es.number.constructor {} - es.number.epsilon {} - es.number.is-finite {} - es.number.is-integer {} - es.number.is-nan {} - es.number.is-safe-integer {} - es.number.max-safe-integer {} - es.number.min-safe-integer {} - es.number.parse-float {} - es.number.parse-int {} - es.number.to-fixed {} - es.number.to-precision {} - es.object.assign {} - es.object.create {} - es.object.define-getter {} - es.object.define-properties {} - es.object.define-property {} - es.object.define-setter {} - es.object.entries {} - es.object.freeze {} - es.object.from-entries {} - es.object.get-own-property-descriptor {} - es.object.get-own-property-descriptors {} - es.object.get-own-property-names {} - es.object.get-prototype-of {} - es.object.is {} - es.object.is-extensible {} - es.object.is-frozen {} - es.object.is-sealed {} - es.object.keys {} - es.object.lookup-getter {} - es.object.lookup-setter {} - es.object.prevent-extensions {} - es.object.seal {} - es.object.set-prototype-of {} - es.object.to-string {} - es.object.values {} - es.parse-float {} - es.parse-int {} - es.promise {} - es.promise.finally {} - es.reflect.apply {} - es.reflect.construct {} - es.reflect.define-property {} - es.reflect.delete-property {} - es.reflect.get {} - es.reflect.get-own-property-descriptor {} - es.reflect.get-prototype-of {} - es.reflect.has {} - es.reflect.is-extensible {} - es.reflect.own-keys {} - es.reflect.prevent-extensions {} - es.reflect.set {} - es.reflect.set-prototype-of {} - es.regexp.constructor {} - es.regexp.exec {} - es.regexp.flags {} - es.regexp.to-string {} - es.set {} - es.string.code-point-at {} - es.string.ends-with {} - es.string.from-code-point {} - es.string.includes {} - es.string.iterator {} - es.string.match {} - es.string.pad-end {} - es.string.pad-start {} - es.string.raw {} - es.string.repeat {} - es.string.replace {} - es.string.search {} - es.string.split {} - es.string.starts-with {} - es.string.trim {} - es.string.trim-end {} - es.string.trim-start {} - es.string.anchor {} - es.string.big {} - es.string.blink {} - es.string.bold {} - es.string.fixed {} - es.string.fontcolor {} - es.string.fontsize {} - es.string.italics {} - es.string.link {} - es.string.small {} - es.string.strike {} - es.string.sub {} - es.string.sup {} - es.typed-array.float32-array {} - es.typed-array.float64-array {} - es.typed-array.int8-array {} - es.typed-array.int16-array {} - es.typed-array.int32-array {} - es.typed-array.uint8-array {} - es.typed-array.uint8-clamped-array {} - es.typed-array.uint16-array {} - es.typed-array.uint32-array {} - es.typed-array.copy-within {} - es.typed-array.every {} - es.typed-array.fill {} - es.typed-array.filter {} - es.typed-array.find {} - es.typed-array.find-index {} - es.typed-array.for-each {} - es.typed-array.from {} - es.typed-array.includes {} - es.typed-array.index-of {} - es.typed-array.iterator {} - es.typed-array.join {} - es.typed-array.last-index-of {} - es.typed-array.map {} - es.typed-array.of {} - es.typed-array.reduce {} - es.typed-array.reduce-right {} - es.typed-array.reverse {} - es.typed-array.set {} - es.typed-array.slice {} - es.typed-array.some {} - es.typed-array.sort {} - es.typed-array.subarray {} - es.typed-array.to-locale-string {} - es.typed-array.to-string {} - es.weak-map {} - es.weak-set {} - esnext.aggregate-error {} - esnext.array.last-index {} - esnext.array.last-item {} - esnext.composite-key {} - esnext.composite-symbol {} - esnext.global-this {} - esnext.map.delete-all {} - esnext.map.every {} - esnext.map.filter {} - esnext.map.find {} - esnext.map.find-key {} - esnext.map.from {} - esnext.map.group-by {} - esnext.map.includes {} - esnext.map.key-by {} - esnext.map.key-of {} - esnext.map.map-keys {} - esnext.map.map-values {} - esnext.map.merge {} - esnext.map.of {} - esnext.map.reduce {} - esnext.map.some {} - esnext.map.update {} - esnext.math.clamp {} - esnext.math.deg-per-rad {} - esnext.math.degrees {} - esnext.math.fscale {} - esnext.math.iaddh {} - esnext.math.imulh {} - esnext.math.isubh {} - esnext.math.rad-per-deg {} - esnext.math.radians {} - esnext.math.scale {} - esnext.math.seeded-prng {} - esnext.math.signbit {} - esnext.math.umulh {} - esnext.number.from-string {} - esnext.observable {} - esnext.promise.all-settled {} - esnext.promise.any {} - esnext.promise.try {} - esnext.reflect.define-metadata {} - esnext.reflect.delete-metadata {} - esnext.reflect.get-metadata {} - esnext.reflect.get-metadata-keys {} - esnext.reflect.get-own-metadata {} - esnext.reflect.get-own-metadata-keys {} - esnext.reflect.has-metadata {} - esnext.reflect.has-own-metadata {} - esnext.reflect.metadata {} - esnext.set.add-all {} - esnext.set.delete-all {} - esnext.set.difference {} - esnext.set.every {} - esnext.set.filter {} - esnext.set.find {} - esnext.set.from {} - esnext.set.intersection {} - esnext.set.is-disjoint-from {} - esnext.set.is-subset-of {} - esnext.set.is-superset-of {} - esnext.set.join {} - esnext.set.map {} - esnext.set.of {} - esnext.set.reduce {} - esnext.set.some {} - esnext.set.symmetric-difference {} - esnext.set.union {} - esnext.string.at {} - esnext.string.code-points {} - esnext.string.replace-all {} - esnext.symbol.dispose {} - esnext.symbol.observable {} - esnext.symbol.pattern-match {} - esnext.weak-map.delete-all {} - esnext.weak-map.from {} - esnext.weak-map.of {} - esnext.weak-set.add-all {} - esnext.weak-set.delete-all {} - esnext.weak-set.from {} - esnext.weak-set.of {} - web.url {} - web.url.to-json {} - web.url-search-params {} - esnext.string.match-all {} -Successfully compiled 1 file with Babel. \ No newline at end of file diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-es/options.json b/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-es/options.json deleted file mode 100644 index 1e5ef9ed0a56..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-es/options.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "presets": [ - ["../../lib", { - "debug": true, - "shippedProposals": true, - "useBuiltIns": "entry", - "corejs": 3 - }] - ] -} diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-es/stdout.txt b/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-es/stdout.txt deleted file mode 100644 index cf961ab95885..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-es/stdout.txt +++ /dev/null @@ -1,245 +0,0 @@ -@babel/preset-env: `DEBUG` option - -Using targets: -{} - -Using modules transform: auto - -Using plugins: - transform-template-literals {} - transform-literals {} - transform-function-name {} - transform-arrow-functions {} - transform-block-scoped-functions {} - transform-classes {} - transform-object-super {} - transform-shorthand-properties {} - transform-duplicate-keys {} - transform-computed-properties {} - transform-for-of {} - transform-sticky-regex {} - transform-dotall-regex {} - transform-unicode-regex {} - transform-spread {} - transform-parameters {} - transform-destructuring {} - transform-block-scoping {} - transform-typeof-symbol {} - transform-new-target {} - transform-regenerator {} - transform-exponentiation-operator {} - transform-async-to-generator {} - proposal-async-generator-functions {} - proposal-object-rest-spread {} - proposal-unicode-property-regex {} - proposal-json-strings {} - proposal-optional-catch-binding {} - transform-named-capturing-groups-regex {} - transform-member-expression-literals {} - transform-property-literals {} - transform-reserved-words {} - -Using polyfills with `entry` option: - -[/src/in.js] Replaced core-js entries with the following polyfills: - es.symbol {} - es.symbol.description {} - es.symbol.async-iterator {} - es.symbol.has-instance {} - es.symbol.is-concat-spreadable {} - es.symbol.iterator {} - es.symbol.match {} - es.symbol.replace {} - es.symbol.search {} - es.symbol.species {} - es.symbol.split {} - es.symbol.to-primitive {} - es.symbol.to-string-tag {} - es.symbol.unscopables {} - es.array.concat {} - es.array.copy-within {} - es.array.every {} - es.array.fill {} - es.array.filter {} - es.array.find {} - es.array.find-index {} - es.array.flat {} - es.array.flat-map {} - es.array.for-each {} - es.array.from {} - es.array.includes {} - es.array.index-of {} - es.array.is-array {} - es.array.iterator {} - es.array.join {} - es.array.last-index-of {} - es.array.map {} - es.array.of {} - es.array.reduce {} - es.array.reduce-right {} - es.array.reverse {} - es.array.slice {} - es.array.some {} - es.array.sort {} - es.array.species {} - es.array.splice {} - es.array.unscopables.flat {} - es.array.unscopables.flat-map {} - es.array-buffer.constructor {} - es.array-buffer.is-view {} - es.array-buffer.slice {} - es.data-view {} - es.date.now {} - es.date.to-iso-string {} - es.date.to-json {} - es.date.to-primitive {} - es.date.to-string {} - es.function.bind {} - es.function.has-instance {} - es.function.name {} - es.json.to-string-tag {} - es.map {} - es.math.acosh {} - es.math.asinh {} - es.math.atanh {} - es.math.cbrt {} - es.math.clz32 {} - es.math.cosh {} - es.math.expm1 {} - es.math.fround {} - es.math.hypot {} - es.math.imul {} - es.math.log10 {} - es.math.log1p {} - es.math.log2 {} - es.math.sign {} - es.math.sinh {} - es.math.tanh {} - es.math.to-string-tag {} - es.math.trunc {} - es.number.constructor {} - es.number.epsilon {} - es.number.is-finite {} - es.number.is-integer {} - es.number.is-nan {} - es.number.is-safe-integer {} - es.number.max-safe-integer {} - es.number.min-safe-integer {} - es.number.parse-float {} - es.number.parse-int {} - es.number.to-fixed {} - es.number.to-precision {} - es.object.assign {} - es.object.create {} - es.object.define-getter {} - es.object.define-properties {} - es.object.define-property {} - es.object.define-setter {} - es.object.entries {} - es.object.freeze {} - es.object.from-entries {} - es.object.get-own-property-descriptor {} - es.object.get-own-property-descriptors {} - es.object.get-own-property-names {} - es.object.get-prototype-of {} - es.object.is {} - es.object.is-extensible {} - es.object.is-frozen {} - es.object.is-sealed {} - es.object.keys {} - es.object.lookup-getter {} - es.object.lookup-setter {} - es.object.prevent-extensions {} - es.object.seal {} - es.object.set-prototype-of {} - es.object.to-string {} - es.object.values {} - es.parse-float {} - es.parse-int {} - es.promise {} - es.promise.finally {} - es.reflect.apply {} - es.reflect.construct {} - es.reflect.define-property {} - es.reflect.delete-property {} - es.reflect.get {} - es.reflect.get-own-property-descriptor {} - es.reflect.get-prototype-of {} - es.reflect.has {} - es.reflect.is-extensible {} - es.reflect.own-keys {} - es.reflect.prevent-extensions {} - es.reflect.set {} - es.reflect.set-prototype-of {} - es.regexp.constructor {} - es.regexp.exec {} - es.regexp.flags {} - es.regexp.to-string {} - es.set {} - es.string.code-point-at {} - es.string.ends-with {} - es.string.from-code-point {} - es.string.includes {} - es.string.iterator {} - es.string.match {} - es.string.pad-end {} - es.string.pad-start {} - es.string.raw {} - es.string.repeat {} - es.string.replace {} - es.string.search {} - es.string.split {} - es.string.starts-with {} - es.string.trim {} - es.string.trim-end {} - es.string.trim-start {} - es.string.anchor {} - es.string.big {} - es.string.blink {} - es.string.bold {} - es.string.fixed {} - es.string.fontcolor {} - es.string.fontsize {} - es.string.italics {} - es.string.link {} - es.string.small {} - es.string.strike {} - es.string.sub {} - es.string.sup {} - es.typed-array.float32-array {} - es.typed-array.float64-array {} - es.typed-array.int8-array {} - es.typed-array.int16-array {} - es.typed-array.int32-array {} - es.typed-array.uint8-array {} - es.typed-array.uint8-clamped-array {} - es.typed-array.uint16-array {} - es.typed-array.uint32-array {} - es.typed-array.copy-within {} - es.typed-array.every {} - es.typed-array.fill {} - es.typed-array.filter {} - es.typed-array.find {} - es.typed-array.find-index {} - es.typed-array.for-each {} - es.typed-array.from {} - es.typed-array.includes {} - es.typed-array.index-of {} - es.typed-array.iterator {} - es.typed-array.join {} - es.typed-array.last-index-of {} - es.typed-array.map {} - es.typed-array.of {} - es.typed-array.reduce {} - es.typed-array.reduce-right {} - es.typed-array.reverse {} - es.typed-array.set {} - es.typed-array.slice {} - es.typed-array.some {} - es.typed-array.sort {} - es.typed-array.subarray {} - es.typed-array.to-locale-string {} - es.typed-array.to-string {} - es.weak-map {} - es.weak-set {} -Successfully compiled 1 file with Babel. \ No newline at end of file diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-force-all-transforms/options.json b/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-force-all-transforms/options.json deleted file mode 100644 index c1c4390e7125..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-force-all-transforms/options.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "presets": [ - ["../../lib", { - "debug": true, - "modules": false, - "targets": { - "chrome": 55 - }, - "useBuiltIns": "entry", - "corejs": 3, - "forceAllTransforms": true - }] - ] -} diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-force-all-transforms/stdout.txt b/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-force-all-transforms/stdout.txt deleted file mode 100644 index 332da98e97bf..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-force-all-transforms/stdout.txt +++ /dev/null @@ -1,75 +0,0 @@ -@babel/preset-env: `DEBUG` option - -Using targets: -{ - "chrome": "55" -} - -Using modules transform: false - -Using plugins: - transform-template-literals {} - transform-literals {} - transform-function-name {} - transform-arrow-functions {} - transform-block-scoped-functions {} - transform-classes {} - transform-object-super {} - transform-shorthand-properties {} - transform-duplicate-keys {} - transform-computed-properties {} - transform-for-of {} - transform-sticky-regex {} - transform-dotall-regex { "chrome":"55" } - transform-unicode-regex {} - transform-spread {} - transform-parameters {} - transform-destructuring {} - transform-block-scoping {} - transform-typeof-symbol {} - transform-new-target {} - transform-regenerator {} - transform-exponentiation-operator {} - transform-async-to-generator {} - proposal-async-generator-functions { "chrome":"55" } - proposal-object-rest-spread { "chrome":"55" } - proposal-unicode-property-regex { "chrome":"55" } - proposal-json-strings { "chrome":"55" } - proposal-optional-catch-binding { "chrome":"55" } - transform-named-capturing-groups-regex { "chrome":"55" } - transform-member-expression-literals {} - transform-property-literals {} - transform-reserved-words {} - -Using polyfills with `entry` option: - -[/src/in.js] Replaced core-js entries with the following polyfills: - es.symbol.description { "chrome":"55" } - es.symbol.async-iterator { "chrome":"55" } - es.array.flat { "chrome":"55" } - es.array.flat-map { "chrome":"55" } - es.array.iterator { "chrome":"55" } - es.array.sort { "chrome":"55" } - es.array.unscopables.flat { "chrome":"55" } - es.array.unscopables.flat-map { "chrome":"55" } - es.object.define-getter { "chrome":"55" } - es.object.define-setter { "chrome":"55" } - es.object.from-entries { "chrome":"55" } - es.object.lookup-getter { "chrome":"55" } - es.object.lookup-setter { "chrome":"55" } - es.promise { "chrome":"55" } - es.promise.finally { "chrome":"55" } - es.string.pad-end { "chrome":"55" } - es.string.pad-start { "chrome":"55" } - es.string.replace { "chrome":"55" } - es.string.trim { "chrome":"55" } - es.string.trim-end { "chrome":"55" } - es.string.trim-start { "chrome":"55" } - web.dom-collections.for-each { "chrome":"55" } - web.dom-collections.iterator { "chrome":"55" } - web.immediate { "chrome":"55" } - web.queue-microtask { "chrome":"55" } - web.url { "chrome":"55" } - web.url.to-json { "chrome":"55" } - web.url-search-params { "chrome":"55" } -Successfully compiled 1 file with Babel. \ No newline at end of file diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-no-import/options.json b/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-no-import/options.json deleted file mode 100644 index 394e16ee1e55..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-no-import/options.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "presets": [ - ["../../lib", { - "debug": true, - "targets": { - "node": 6 - }, - "useBuiltIns": "entry", - "corejs": 3 - }] - ] -} diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-no-import/stdout.txt b/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-no-import/stdout.txt deleted file mode 100644 index 73ffcc5860ea..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-no-import/stdout.txt +++ /dev/null @@ -1,27 +0,0 @@ -@babel/preset-env: `DEBUG` option - -Using targets: -{ - "node": "6" -} - -Using modules transform: auto - -Using plugins: - transform-function-name { "node":"6" } - transform-for-of { "node":"6" } - transform-dotall-regex { "node":"6" } - transform-destructuring { "node":"6" } - transform-exponentiation-operator { "node":"6" } - transform-async-to-generator { "node":"6" } - proposal-async-generator-functions { "node":"6" } - proposal-object-rest-spread { "node":"6" } - proposal-unicode-property-regex { "node":"6" } - proposal-json-strings { "node":"6" } - proposal-optional-catch-binding { "node":"6" } - transform-named-capturing-groups-regex { "node":"6" } - -Using polyfills with `entry` option: - -[/src/in.js] Import of core-js was not found. -Successfully compiled 1 file with Babel. \ No newline at end of file diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-proposals-chrome-71/options.json b/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-proposals-chrome-71/options.json deleted file mode 100644 index f08309ca7b73..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-proposals-chrome-71/options.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "presets": [ - ["../../lib", { - "debug": true, - "targets": { - "browsers": "chrome 71" - }, - "useBuiltIns": "entry", - "corejs": { "version": 3, "proposals": true } - }] - ] -} diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-proposals-chrome-71/stdout.txt b/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-proposals-chrome-71/stdout.txt deleted file mode 100644 index 7b8630d1d45f..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-proposals-chrome-71/stdout.txt +++ /dev/null @@ -1,102 +0,0 @@ -@babel/preset-env: `DEBUG` option - -Using targets: -{ - "chrome": "71" -} - -Using modules transform: auto - -Using plugins: - syntax-async-generators { "chrome":"71" } - syntax-object-rest-spread { "chrome":"71" } - syntax-json-strings { "chrome":"71" } - syntax-optional-catch-binding { "chrome":"71" } - -Using polyfills with `entry` option: - -[/src/in.js] Replaced core-js entries with the following polyfills: - esnext.aggregate-error { "chrome":"71" } - esnext.array.last-index { "chrome":"71" } - esnext.array.last-item { "chrome":"71" } - esnext.composite-key { "chrome":"71" } - esnext.composite-symbol { "chrome":"71" } - esnext.map.delete-all { "chrome":"71" } - esnext.map.every { "chrome":"71" } - esnext.map.filter { "chrome":"71" } - esnext.map.find { "chrome":"71" } - esnext.map.find-key { "chrome":"71" } - esnext.map.from { "chrome":"71" } - esnext.map.group-by { "chrome":"71" } - esnext.map.includes { "chrome":"71" } - esnext.map.key-by { "chrome":"71" } - esnext.map.key-of { "chrome":"71" } - esnext.map.map-keys { "chrome":"71" } - esnext.map.map-values { "chrome":"71" } - esnext.map.merge { "chrome":"71" } - esnext.map.of { "chrome":"71" } - esnext.map.reduce { "chrome":"71" } - esnext.map.some { "chrome":"71" } - esnext.map.update { "chrome":"71" } - esnext.math.clamp { "chrome":"71" } - esnext.math.deg-per-rad { "chrome":"71" } - esnext.math.degrees { "chrome":"71" } - esnext.math.fscale { "chrome":"71" } - esnext.math.iaddh { "chrome":"71" } - esnext.math.imulh { "chrome":"71" } - esnext.math.isubh { "chrome":"71" } - esnext.math.rad-per-deg { "chrome":"71" } - esnext.math.radians { "chrome":"71" } - esnext.math.scale { "chrome":"71" } - esnext.math.seeded-prng { "chrome":"71" } - esnext.math.signbit { "chrome":"71" } - esnext.math.umulh { "chrome":"71" } - esnext.number.from-string { "chrome":"71" } - esnext.observable { "chrome":"71" } - esnext.promise.all-settled { "chrome":"71" } - esnext.promise.any { "chrome":"71" } - esnext.promise.try { "chrome":"71" } - esnext.reflect.define-metadata { "chrome":"71" } - esnext.reflect.delete-metadata { "chrome":"71" } - esnext.reflect.get-metadata { "chrome":"71" } - esnext.reflect.get-metadata-keys { "chrome":"71" } - esnext.reflect.get-own-metadata { "chrome":"71" } - esnext.reflect.get-own-metadata-keys { "chrome":"71" } - esnext.reflect.has-metadata { "chrome":"71" } - esnext.reflect.has-own-metadata { "chrome":"71" } - esnext.reflect.metadata { "chrome":"71" } - esnext.set.add-all { "chrome":"71" } - esnext.set.delete-all { "chrome":"71" } - esnext.set.difference { "chrome":"71" } - esnext.set.every { "chrome":"71" } - esnext.set.filter { "chrome":"71" } - esnext.set.find { "chrome":"71" } - esnext.set.from { "chrome":"71" } - esnext.set.intersection { "chrome":"71" } - esnext.set.is-disjoint-from { "chrome":"71" } - esnext.set.is-subset-of { "chrome":"71" } - esnext.set.is-superset-of { "chrome":"71" } - esnext.set.join { "chrome":"71" } - esnext.set.map { "chrome":"71" } - esnext.set.of { "chrome":"71" } - esnext.set.reduce { "chrome":"71" } - esnext.set.some { "chrome":"71" } - esnext.set.symmetric-difference { "chrome":"71" } - esnext.set.union { "chrome":"71" } - esnext.string.at { "chrome":"71" } - esnext.string.code-points { "chrome":"71" } - esnext.string.replace-all { "chrome":"71" } - esnext.symbol.dispose { "chrome":"71" } - esnext.symbol.observable { "chrome":"71" } - esnext.symbol.pattern-match { "chrome":"71" } - esnext.weak-map.delete-all { "chrome":"71" } - esnext.weak-map.from { "chrome":"71" } - esnext.weak-map.of { "chrome":"71" } - esnext.weak-set.add-all { "chrome":"71" } - esnext.weak-set.delete-all { "chrome":"71" } - esnext.weak-set.from { "chrome":"71" } - esnext.weak-set.of { "chrome":"71" } - esnext.string.match-all { "chrome":"71" } - -[/src/in.js] Based on your targets, regenerator-runtime import excluded. -Successfully compiled 1 file with Babel. \ No newline at end of file diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-proposals/options.json b/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-proposals/options.json deleted file mode 100644 index 56005256589a..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-proposals/options.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "presets": [ - ["../../lib", { - "debug": true, - "useBuiltIns": "entry", - "corejs": { "version": 3, "proposals": true } - }] - ] -} diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-proposals/stdout.txt b/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-proposals/stdout.txt deleted file mode 100644 index 34bf4094e273..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-proposals/stdout.txt +++ /dev/null @@ -1,130 +0,0 @@ -@babel/preset-env: `DEBUG` option - -Using targets: -{} - -Using modules transform: auto - -Using plugins: - transform-template-literals {} - transform-literals {} - transform-function-name {} - transform-arrow-functions {} - transform-block-scoped-functions {} - transform-classes {} - transform-object-super {} - transform-shorthand-properties {} - transform-duplicate-keys {} - transform-computed-properties {} - transform-for-of {} - transform-sticky-regex {} - transform-dotall-regex {} - transform-unicode-regex {} - transform-spread {} - transform-parameters {} - transform-destructuring {} - transform-block-scoping {} - transform-typeof-symbol {} - transform-new-target {} - transform-regenerator {} - transform-exponentiation-operator {} - transform-async-to-generator {} - proposal-async-generator-functions {} - proposal-object-rest-spread {} - proposal-unicode-property-regex {} - proposal-json-strings {} - proposal-optional-catch-binding {} - transform-named-capturing-groups-regex {} - transform-member-expression-literals {} - transform-property-literals {} - transform-reserved-words {} - -Using polyfills with `entry` option: - -[/src/in.js] Replaced core-js entries with the following polyfills: - esnext.aggregate-error {} - esnext.array.last-index {} - esnext.array.last-item {} - esnext.composite-key {} - esnext.composite-symbol {} - esnext.global-this {} - esnext.map.delete-all {} - esnext.map.every {} - esnext.map.filter {} - esnext.map.find {} - esnext.map.find-key {} - esnext.map.from {} - esnext.map.group-by {} - esnext.map.includes {} - esnext.map.key-by {} - esnext.map.key-of {} - esnext.map.map-keys {} - esnext.map.map-values {} - esnext.map.merge {} - esnext.map.of {} - esnext.map.reduce {} - esnext.map.some {} - esnext.map.update {} - esnext.math.clamp {} - esnext.math.deg-per-rad {} - esnext.math.degrees {} - esnext.math.fscale {} - esnext.math.iaddh {} - esnext.math.imulh {} - esnext.math.isubh {} - esnext.math.rad-per-deg {} - esnext.math.radians {} - esnext.math.scale {} - esnext.math.seeded-prng {} - esnext.math.signbit {} - esnext.math.umulh {} - esnext.number.from-string {} - esnext.observable {} - esnext.promise.all-settled {} - esnext.promise.any {} - esnext.promise.try {} - esnext.reflect.define-metadata {} - esnext.reflect.delete-metadata {} - esnext.reflect.get-metadata {} - esnext.reflect.get-metadata-keys {} - esnext.reflect.get-own-metadata {} - esnext.reflect.get-own-metadata-keys {} - esnext.reflect.has-metadata {} - esnext.reflect.has-own-metadata {} - esnext.reflect.metadata {} - esnext.set.add-all {} - esnext.set.delete-all {} - esnext.set.difference {} - esnext.set.every {} - esnext.set.filter {} - esnext.set.find {} - esnext.set.from {} - esnext.set.intersection {} - esnext.set.is-disjoint-from {} - esnext.set.is-subset-of {} - esnext.set.is-superset-of {} - esnext.set.join {} - esnext.set.map {} - esnext.set.of {} - esnext.set.reduce {} - esnext.set.some {} - esnext.set.symmetric-difference {} - esnext.set.union {} - esnext.string.at {} - esnext.string.code-points {} - esnext.string.replace-all {} - esnext.symbol.dispose {} - esnext.symbol.observable {} - esnext.symbol.pattern-match {} - esnext.weak-map.delete-all {} - esnext.weak-map.from {} - esnext.weak-map.of {} - esnext.weak-set.add-all {} - esnext.weak-set.delete-all {} - esnext.weak-set.from {} - esnext.weak-set.of {} - web.url {} - web.url.to-json {} - web.url-search-params {} - esnext.string.match-all {} -Successfully compiled 1 file with Babel. \ No newline at end of file diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-runtime-only-chrome-71/options.json b/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-runtime-only-chrome-71/options.json deleted file mode 100644 index b9db1e21e401..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-runtime-only-chrome-71/options.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "presets": [ - ["../../lib", { - "debug": true, - "targets": { - "browsers": "chrome 71" - }, - "shippedProposals": true, - "useBuiltIns": "entry", - "corejs": 3 - }] - ] -} diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-runtime-only-chrome-71/stdout.txt b/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-runtime-only-chrome-71/stdout.txt deleted file mode 100644 index 2420ffb75e8e..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-runtime-only-chrome-71/stdout.txt +++ /dev/null @@ -1,21 +0,0 @@ -@babel/preset-env: `DEBUG` option - -Using targets: -{ - "chrome": "71" -} - -Using modules transform: auto - -Using plugins: - syntax-async-generators { "chrome":"71" } - syntax-object-rest-spread { "chrome":"71" } - syntax-json-strings { "chrome":"71" } - syntax-optional-catch-binding { "chrome":"71" } - -Using polyfills with `entry` option: - -[/src/in.js] Import of core-js was not found. - -[/src/in.js] Based on your targets, regenerator-runtime import excluded. -Successfully compiled 1 file with Babel. \ No newline at end of file diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-runtime-only/options.json b/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-runtime-only/options.json deleted file mode 100644 index b9db1e21e401..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-runtime-only/options.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "presets": [ - ["../../lib", { - "debug": true, - "targets": { - "browsers": "chrome 71" - }, - "shippedProposals": true, - "useBuiltIns": "entry", - "corejs": 3 - }] - ] -} diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-runtime-only/stdout.txt b/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-runtime-only/stdout.txt deleted file mode 100644 index 2420ffb75e8e..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-runtime-only/stdout.txt +++ /dev/null @@ -1,21 +0,0 @@ -@babel/preset-env: `DEBUG` option - -Using targets: -{ - "chrome": "71" -} - -Using modules transform: auto - -Using plugins: - syntax-async-generators { "chrome":"71" } - syntax-object-rest-spread { "chrome":"71" } - syntax-json-strings { "chrome":"71" } - syntax-optional-catch-binding { "chrome":"71" } - -Using polyfills with `entry` option: - -[/src/in.js] Import of core-js was not found. - -[/src/in.js] Based on your targets, regenerator-runtime import excluded. -Successfully compiled 1 file with Babel. \ No newline at end of file diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-specific-entries-chrome-71/options.json b/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-specific-entries-chrome-71/options.json deleted file mode 100644 index b9db1e21e401..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-specific-entries-chrome-71/options.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "presets": [ - ["../../lib", { - "debug": true, - "targets": { - "browsers": "chrome 71" - }, - "shippedProposals": true, - "useBuiltIns": "entry", - "corejs": 3 - }] - ] -} diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-specific-entries-chrome-71/stdout.txt b/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-specific-entries-chrome-71/stdout.txt deleted file mode 100644 index e77af2686b72..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-specific-entries-chrome-71/stdout.txt +++ /dev/null @@ -1,31 +0,0 @@ -@babel/preset-env: `DEBUG` option - -Using targets: -{ - "chrome": "71" -} - -Using modules transform: auto - -Using plugins: - syntax-async-generators { "chrome":"71" } - syntax-object-rest-spread { "chrome":"71" } - syntax-json-strings { "chrome":"71" } - syntax-optional-catch-binding { "chrome":"71" } - -Using polyfills with `entry` option: - -[/src/in.js] Replaced core-js entries with the following polyfills: - es.object.from-entries { "chrome":"71" } - esnext.reflect.define-metadata { "chrome":"71" } - esnext.reflect.delete-metadata { "chrome":"71" } - esnext.reflect.get-metadata { "chrome":"71" } - esnext.reflect.get-metadata-keys { "chrome":"71" } - esnext.reflect.get-own-metadata { "chrome":"71" } - esnext.reflect.get-own-metadata-keys { "chrome":"71" } - esnext.reflect.has-metadata { "chrome":"71" } - esnext.reflect.has-own-metadata { "chrome":"71" } - esnext.reflect.metadata { "chrome":"71" } - -[/src/in.js] Based on your targets, regenerator-runtime import excluded. -Successfully compiled 1 file with Babel. \ No newline at end of file diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-specific-entries/options.json b/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-specific-entries/options.json deleted file mode 100644 index 1e5ef9ed0a56..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-specific-entries/options.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "presets": [ - ["../../lib", { - "debug": true, - "shippedProposals": true, - "useBuiltIns": "entry", - "corejs": 3 - }] - ] -} diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-specific-entries/stdout.txt b/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-specific-entries/stdout.txt deleted file mode 100644 index d8ff0734f2d0..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-specific-entries/stdout.txt +++ /dev/null @@ -1,95 +0,0 @@ -@babel/preset-env: `DEBUG` option - -Using targets: -{} - -Using modules transform: auto - -Using plugins: - transform-template-literals {} - transform-literals {} - transform-function-name {} - transform-arrow-functions {} - transform-block-scoped-functions {} - transform-classes {} - transform-object-super {} - transform-shorthand-properties {} - transform-duplicate-keys {} - transform-computed-properties {} - transform-for-of {} - transform-sticky-regex {} - transform-dotall-regex {} - transform-unicode-regex {} - transform-spread {} - transform-parameters {} - transform-destructuring {} - transform-block-scoping {} - transform-typeof-symbol {} - transform-new-target {} - transform-regenerator {} - transform-exponentiation-operator {} - transform-async-to-generator {} - proposal-async-generator-functions {} - proposal-object-rest-spread {} - proposal-unicode-property-regex {} - proposal-json-strings {} - proposal-optional-catch-binding {} - transform-named-capturing-groups-regex {} - transform-member-expression-literals {} - transform-property-literals {} - transform-reserved-words {} - -Using polyfills with `entry` option: - -[/src/in.js] Replaced core-js entries with the following polyfills: - es.symbol {} - es.json.to-string-tag {} - es.math.to-string-tag {} - es.object.assign {} - es.object.create {} - es.object.define-getter {} - es.object.define-properties {} - es.object.define-property {} - es.object.define-setter {} - es.object.entries {} - es.object.freeze {} - es.object.from-entries {} - es.object.get-own-property-descriptor {} - es.object.get-own-property-descriptors {} - es.object.get-own-property-names {} - es.object.get-prototype-of {} - es.object.is {} - es.object.is-extensible {} - es.object.is-frozen {} - es.object.is-sealed {} - es.object.keys {} - es.object.lookup-getter {} - es.object.lookup-setter {} - es.object.prevent-extensions {} - es.object.seal {} - es.object.set-prototype-of {} - es.object.to-string {} - es.object.values {} - es.reflect.apply {} - es.reflect.construct {} - es.reflect.define-property {} - es.reflect.delete-property {} - es.reflect.get {} - es.reflect.get-own-property-descriptor {} - es.reflect.get-prototype-of {} - es.reflect.has {} - es.reflect.is-extensible {} - es.reflect.own-keys {} - es.reflect.prevent-extensions {} - es.reflect.set {} - es.reflect.set-prototype-of {} - esnext.reflect.define-metadata {} - esnext.reflect.delete-metadata {} - esnext.reflect.get-metadata {} - esnext.reflect.get-metadata-keys {} - esnext.reflect.get-own-metadata {} - esnext.reflect.get-own-metadata-keys {} - esnext.reflect.has-metadata {} - esnext.reflect.has-own-metadata {} - esnext.reflect.metadata {} -Successfully compiled 1 file with Babel. \ No newline at end of file diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-specific-targets/options.json b/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-specific-targets/options.json deleted file mode 100644 index b5693669350b..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-specific-targets/options.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "presets": [ - ["../../lib", { - "debug": true, - "targets": { - "browsers": "ie 10, ios 9, safari 7, edge 13, chrome 54, firefox 49" - }, - "useBuiltIns": "entry", - "corejs": 3 - }] - ] -} diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-specific-targets/stdout.txt b/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-specific-targets/stdout.txt deleted file mode 100644 index 0be270e41146..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-specific-targets/stdout.txt +++ /dev/null @@ -1,252 +0,0 @@ -@babel/preset-env: `DEBUG` option - -Using targets: -{ - "chrome": "54", - "edge": "13", - "firefox": "49", - "ie": "10", - "ios": "9", - "safari": "7" -} - -Using modules transform: auto - -Using plugins: - transform-template-literals { "ie":"10", "ios":"9", "safari":"7" } - transform-literals { "firefox":"49", "ie":"10", "safari":"7" } - transform-function-name { "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } - transform-arrow-functions { "ie":"10", "ios":"9", "safari":"7" } - transform-block-scoped-functions { "ie":"10", "ios":"9", "safari":"7" } - transform-classes { "ie":"10", "ios":"9", "safari":"7" } - transform-object-super { "ie":"10", "ios":"9", "safari":"7" } - transform-shorthand-properties { "ie":"10", "safari":"7" } - transform-duplicate-keys { "ie":"10", "safari":"7" } - transform-computed-properties { "ie":"10", "safari":"7" } - transform-for-of { "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } - transform-sticky-regex { "ie":"10", "ios":"9", "safari":"7" } - transform-dotall-regex { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } - transform-unicode-regex { "ie":"10", "ios":"9", "safari":"7" } - transform-spread { "ie":"10", "ios":"9", "safari":"7" } - transform-parameters { "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } - transform-destructuring { "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } - transform-block-scoping { "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } - transform-typeof-symbol { "ie":"10", "safari":"7" } - transform-new-target { "edge":"13", "ie":"10", "ios":"9", "safari":"7" } - transform-regenerator { "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } - transform-exponentiation-operator { "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } - transform-async-to-generator { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } - proposal-async-generator-functions { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } - proposal-object-rest-spread { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } - proposal-unicode-property-regex { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } - proposal-json-strings { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } - proposal-optional-catch-binding { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } - transform-named-capturing-groups-regex { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } - -Using polyfills with `entry` option: - -[/src/in.js] Replaced core-js entries with the following polyfills: - es.symbol { "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } - es.symbol.description { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } - es.symbol.async-iterator { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } - es.symbol.has-instance { "edge":"13", "ie":"10", "ios":"9", "safari":"7" } - es.symbol.is-concat-spreadable { "edge":"13", "ie":"10", "ios":"9", "safari":"7" } - es.symbol.iterator { "ie":"10", "safari":"7" } - es.symbol.match { "edge":"13", "ie":"10", "ios":"9", "safari":"7" } - es.symbol.replace { "edge":"13", "ie":"10", "ios":"9", "safari":"7" } - es.symbol.search { "edge":"13", "ie":"10", "ios":"9", "safari":"7" } - es.symbol.species { "ie":"10", "ios":"9", "safari":"7" } - es.symbol.split { "edge":"13", "ie":"10", "ios":"9", "safari":"7" } - es.symbol.to-primitive { "edge":"13", "ie":"10", "ios":"9", "safari":"7" } - es.symbol.to-string-tag { "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } - es.symbol.unscopables { "ie":"10", "safari":"7" } - es.array.concat { "edge":"13", "ie":"10", "ios":"9", "safari":"7" } - es.array.copy-within { "ie":"10", "safari":"7" } - es.array.every { "safari":"7" } - es.array.fill { "ie":"10", "safari":"7" } - es.array.filter { "ie":"10", "ios":"9", "safari":"7" } - es.array.find { "ie":"10", "safari":"7" } - es.array.find-index { "ie":"10", "safari":"7" } - es.array.flat { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } - es.array.flat-map { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } - es.array.for-each { "safari":"7" } - es.array.from { "edge":"13", "firefox":"49", "ie":"10", "safari":"7" } - es.array.includes { "edge":"13", "ie":"10", "ios":"9", "safari":"7" } - es.array.index-of { "safari":"7" } - es.array.iterator { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } - es.array.join { "ie":"10", "safari":"7" } - es.array.last-index-of { "safari":"7" } - es.array.map { "ie":"10", "ios":"9", "safari":"7" } - es.array.of { "ie":"10", "safari":"7" } - es.array.reduce { "safari":"7" } - es.array.reduce-right { "safari":"7" } - es.array.reverse { "ios":"9", "safari":"7" } - es.array.slice { "ie":"10", "ios":"9", "safari":"7" } - es.array.some { "safari":"7" } - es.array.sort { "chrome":"54", "ios":"9", "safari":"7" } - es.array.species { "ie":"10", "ios":"9", "safari":"7" } - es.array.splice { "ie":"10", "ios":"9", "safari":"7" } - es.array.unscopables.flat { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } - es.array.unscopables.flat-map { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } - es.array-buffer.constructor { "edge":"13", "ie":"10", "ios":"9", "safari":"7" } - es.array-buffer.is-view { "ie":"10", "safari":"7" } - es.array-buffer.slice { "ie":"10", "ios":"9", "safari":"7" } - es.data-view { "safari":"7" } - es.date.to-iso-string { "safari":"7" } - es.date.to-json { "ios":"9", "safari":"7" } - es.date.to-primitive { "edge":"13", "ie":"10", "ios":"9", "safari":"7" } - es.date.to-string { "safari":"7" } - es.function.has-instance { "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } - es.function.name { "edge":"13", "ie":"10", "safari":"7" } - es.json.to-string-tag { "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } - es.map { "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } - es.math.acosh { "ie":"10", "safari":"7" } - es.math.asinh { "ie":"10", "safari":"7" } - es.math.atanh { "ie":"10", "safari":"7" } - es.math.cbrt { "ie":"10", "safari":"7" } - es.math.clz32 { "ie":"10", "safari":"7" } - es.math.cosh { "ie":"10", "safari":"7" } - es.math.expm1 { "ie":"10", "safari":"7" } - es.math.fround { "ie":"10", "safari":"7" } - es.math.hypot { "ie":"10", "safari":"7" } - es.math.imul { "ie":"10", "safari":"7" } - es.math.log10 { "ie":"10", "safari":"7" } - es.math.log1p { "ie":"10", "safari":"7" } - es.math.log2 { "ie":"10", "safari":"7" } - es.math.sign { "ie":"10", "safari":"7" } - es.math.sinh { "ie":"10", "safari":"7" } - es.math.tanh { "ie":"10", "safari":"7" } - es.math.to-string-tag { "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } - es.math.trunc { "ie":"10", "safari":"7" } - es.number.constructor { "ie":"10", "safari":"7" } - es.number.epsilon { "ie":"10", "safari":"7" } - es.number.is-finite { "ie":"10", "safari":"7" } - es.number.is-integer { "ie":"10", "safari":"7" } - es.number.is-nan { "ie":"10", "safari":"7" } - es.number.is-safe-integer { "ie":"10", "safari":"7" } - es.number.max-safe-integer { "ie":"10", "safari":"7" } - es.number.min-safe-integer { "ie":"10", "safari":"7" } - es.number.parse-float { "ie":"10", "ios":"9", "safari":"7" } - es.number.parse-int { "ie":"10", "safari":"7" } - es.number.to-fixed { "edge":"13", "ie":"10", "safari":"7" } - es.number.to-precision { "safari":"7" } - es.object.assign { "ie":"10", "safari":"7" } - es.object.define-getter { "chrome":"54", "edge":"13", "ie":"10", "safari":"7" } - es.object.define-properties { "safari":"7" } - es.object.define-property { "safari":"7" } - es.object.define-setter { "chrome":"54", "edge":"13", "ie":"10", "safari":"7" } - es.object.entries { "edge":"13", "ie":"10", "ios":"9", "safari":"7" } - es.object.freeze { "ie":"10", "safari":"7" } - es.object.from-entries { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } - es.object.get-own-property-descriptor { "ie":"10", "safari":"7" } - es.object.get-own-property-descriptors { "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } - es.object.get-own-property-names { "ie":"10", "safari":"7" } - es.object.get-prototype-of { "ie":"10", "safari":"7" } - es.object.is { "ie":"10", "safari":"7" } - es.object.is-extensible { "ie":"10", "safari":"7" } - es.object.is-frozen { "ie":"10", "safari":"7" } - es.object.is-sealed { "ie":"10", "safari":"7" } - es.object.keys { "ie":"10", "safari":"7" } - es.object.lookup-getter { "chrome":"54", "edge":"13", "ie":"10", "safari":"7" } - es.object.lookup-setter { "chrome":"54", "edge":"13", "ie":"10", "safari":"7" } - es.object.prevent-extensions { "ie":"10", "safari":"7" } - es.object.seal { "ie":"10", "safari":"7" } - es.object.set-prototype-of { "ie":"10", "safari":"7" } - es.object.to-string { "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } - es.object.values { "edge":"13", "ie":"10", "ios":"9", "safari":"7" } - es.parse-float { "safari":"7" } - es.parse-int { "safari":"7" } - es.promise { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } - es.promise.finally { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } - es.reflect.apply { "edge":"13", "ie":"10", "ios":"9", "safari":"7" } - es.reflect.construct { "edge":"13", "ie":"10", "ios":"9", "safari":"7" } - es.reflect.define-property { "ie":"10", "ios":"9", "safari":"7" } - es.reflect.delete-property { "ie":"10", "ios":"9", "safari":"7" } - es.reflect.get { "ie":"10", "ios":"9", "safari":"7" } - es.reflect.get-own-property-descriptor { "ie":"10", "ios":"9", "safari":"7" } - es.reflect.get-prototype-of { "ie":"10", "ios":"9", "safari":"7" } - es.reflect.has { "ie":"10", "ios":"9", "safari":"7" } - es.reflect.is-extensible { "ie":"10", "ios":"9", "safari":"7" } - es.reflect.own-keys { "ie":"10", "ios":"9", "safari":"7" } - es.reflect.prevent-extensions { "ie":"10", "ios":"9", "safari":"7" } - es.reflect.set { "ie":"10", "ios":"9", "safari":"7" } - es.reflect.set-prototype-of { "ie":"10", "ios":"9", "safari":"7" } - es.regexp.constructor { "edge":"13", "ie":"10", "ios":"9", "safari":"7" } - es.regexp.exec { "safari":"7" } - es.regexp.flags { "edge":"13", "ie":"10", "safari":"7" } - es.regexp.to-string { "edge":"13", "ie":"10", "ios":"9", "safari":"7" } - es.set { "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } - es.string.code-point-at { "ie":"10", "safari":"7" } - es.string.ends-with { "edge":"13", "ie":"10", "ios":"9", "safari":"7" } - es.string.from-code-point { "ie":"10", "safari":"7" } - es.string.includes { "edge":"13", "ie":"10", "ios":"9", "safari":"7" } - es.string.iterator { "ie":"10", "safari":"7" } - es.string.match { "edge":"13", "ie":"10", "ios":"9", "safari":"7" } - es.string.pad-end { "chrome":"54", "edge":"13", "ie":"10", "ios":"9", "safari":"7" } - es.string.pad-start { "chrome":"54", "edge":"13", "ie":"10", "ios":"9", "safari":"7" } - es.string.raw { "ie":"10", "safari":"7" } - es.string.repeat { "ie":"10", "safari":"7" } - es.string.replace { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } - es.string.search { "edge":"13", "ie":"10", "ios":"9", "safari":"7" } - es.string.split { "edge":"13", "ie":"10", "ios":"9", "safari":"7" } - es.string.starts-with { "edge":"13", "ie":"10", "ios":"9", "safari":"7" } - es.string.trim { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } - es.string.trim-end { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } - es.string.trim-start { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } - es.string.anchor { "ie":"10", "safari":"7" } - es.string.big { "ie":"10", "safari":"7" } - es.string.blink { "ie":"10", "safari":"7" } - es.string.bold { "ie":"10", "safari":"7" } - es.string.fixed { "ie":"10", "safari":"7" } - es.string.fontcolor { "ie":"10", "safari":"7" } - es.string.fontsize { "ie":"10", "safari":"7" } - es.string.italics { "ie":"10", "safari":"7" } - es.string.link { "ie":"10", "safari":"7" } - es.string.small { "ie":"10", "safari":"7" } - es.string.strike { "ie":"10", "safari":"7" } - es.string.sub { "ie":"10", "safari":"7" } - es.string.sup { "ie":"10", "safari":"7" } - es.typed-array.float32-array { "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } - es.typed-array.float64-array { "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } - es.typed-array.int8-array { "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } - es.typed-array.int16-array { "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } - es.typed-array.int32-array { "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } - es.typed-array.uint8-array { "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } - es.typed-array.uint8-clamped-array { "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } - es.typed-array.uint16-array { "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } - es.typed-array.uint32-array { "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } - es.typed-array.copy-within { "ie":"10", "ios":"9", "safari":"7" } - es.typed-array.every { "ie":"10", "ios":"9", "safari":"7" } - es.typed-array.fill { "ie":"10", "ios":"9", "safari":"7" } - es.typed-array.filter { "ie":"10", "ios":"9", "safari":"7" } - es.typed-array.find { "ie":"10", "ios":"9", "safari":"7" } - es.typed-array.find-index { "ie":"10", "ios":"9", "safari":"7" } - es.typed-array.for-each { "ie":"10", "ios":"9", "safari":"7" } - es.typed-array.from { "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } - es.typed-array.includes { "edge":"13", "ie":"10", "ios":"9", "safari":"7" } - es.typed-array.index-of { "ie":"10", "ios":"9", "safari":"7" } - es.typed-array.iterator { "ie":"10", "ios":"9", "safari":"7" } - es.typed-array.join { "ie":"10", "ios":"9", "safari":"7" } - es.typed-array.last-index-of { "ie":"10", "ios":"9", "safari":"7" } - es.typed-array.map { "ie":"10", "ios":"9", "safari":"7" } - es.typed-array.of { "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } - es.typed-array.reduce { "ie":"10", "ios":"9", "safari":"7" } - es.typed-array.reduce-right { "ie":"10", "ios":"9", "safari":"7" } - es.typed-array.reverse { "ie":"10", "ios":"9", "safari":"7" } - es.typed-array.set { "ie":"10", "safari":"7" } - es.typed-array.slice { "ie":"10", "ios":"9", "safari":"7" } - es.typed-array.some { "ie":"10", "ios":"9", "safari":"7" } - es.typed-array.sort { "ie":"10", "ios":"9", "safari":"7" } - es.typed-array.subarray { "ie":"10", "safari":"7" } - es.typed-array.to-locale-string { "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } - es.typed-array.to-string { "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } - es.weak-map { "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } - es.weak-set { "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } - web.dom-collections.for-each { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } - web.dom-collections.iterator { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } - web.immediate { "chrome":"54", "firefox":"49", "ios":"9", "safari":"7" } - web.queue-microtask { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } - web.url { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } - web.url.to-json { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } - web.url-search-params { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } -Successfully compiled 1 file with Babel. \ No newline at end of file diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-stable-chrome-71/options.json b/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-stable-chrome-71/options.json deleted file mode 100644 index b9db1e21e401..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-stable-chrome-71/options.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "presets": [ - ["../../lib", { - "debug": true, - "targets": { - "browsers": "chrome 71" - }, - "shippedProposals": true, - "useBuiltIns": "entry", - "corejs": 3 - }] - ] -} diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-stable-chrome-71/stdout.txt b/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-stable-chrome-71/stdout.txt deleted file mode 100644 index 781f32ad0974..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-stable-chrome-71/stdout.txt +++ /dev/null @@ -1,25 +0,0 @@ -@babel/preset-env: `DEBUG` option - -Using targets: -{ - "chrome": "71" -} - -Using modules transform: auto - -Using plugins: - syntax-async-generators { "chrome":"71" } - syntax-object-rest-spread { "chrome":"71" } - syntax-json-strings { "chrome":"71" } - syntax-optional-catch-binding { "chrome":"71" } - -Using polyfills with `entry` option: - -[/src/in.js] Replaced core-js entries with the following polyfills: - es.array.unscopables.flat { "chrome":"71" } - es.array.unscopables.flat-map { "chrome":"71" } - es.object.from-entries { "chrome":"71" } - web.immediate { "chrome":"71" } - -[/src/in.js] Based on your targets, regenerator-runtime import excluded. -Successfully compiled 1 file with Babel. \ No newline at end of file diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-stable-samsung-8.2/options.json b/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-stable-samsung-8.2/options.json deleted file mode 100644 index 381749958890..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-stable-samsung-8.2/options.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "presets": [ - ["../../lib", { - "debug": true, - "targets": { - "browsers": "samsung 8.2" - }, - "shippedProposals": true, - "useBuiltIns": "entry", - "corejs": 3 - }] - ] -} diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-stable-samsung-8.2/stdout.txt b/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-stable-samsung-8.2/stdout.txt deleted file mode 100644 index 50f7b3e20e25..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-stable-samsung-8.2/stdout.txt +++ /dev/null @@ -1,39 +0,0 @@ -@babel/preset-env: `DEBUG` option - -Using targets: -{ - "samsung": "8.2" -} - -Using modules transform: auto - -Using plugins: - syntax-async-generators { "samsung":"8.2" } - syntax-object-rest-spread { "samsung":"8.2" } - proposal-unicode-property-regex { "samsung":"8.2" } - proposal-json-strings { "samsung":"8.2" } - proposal-optional-catch-binding { "samsung":"8.2" } - transform-named-capturing-groups-regex { "samsung":"8.2" } - -Using polyfills with `entry` option: - -[/src/in.js] Replaced core-js entries with the following polyfills: - es.symbol.description { "samsung":"8.2" } - es.array.flat { "samsung":"8.2" } - es.array.flat-map { "samsung":"8.2" } - es.array.iterator { "samsung":"8.2" } - es.array.unscopables.flat { "samsung":"8.2" } - es.array.unscopables.flat-map { "samsung":"8.2" } - es.object.from-entries { "samsung":"8.2" } - es.promise { "samsung":"8.2" } - es.promise.finally { "samsung":"8.2" } - es.string.replace { "samsung":"8.2" } - es.string.trim-end { "samsung":"8.2" } - es.string.trim-start { "samsung":"8.2" } - web.dom-collections.iterator { "samsung":"8.2" } - web.immediate { "samsung":"8.2" } - web.queue-microtask { "samsung":"8.2" } - web.url.to-json { "samsung":"8.2" } - -[/src/in.js] Based on your targets, regenerator-runtime import excluded. -Successfully compiled 1 file with Babel. \ No newline at end of file diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-stable/options.json b/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-stable/options.json deleted file mode 100644 index 1e5ef9ed0a56..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-stable/options.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "presets": [ - ["../../lib", { - "debug": true, - "shippedProposals": true, - "useBuiltIns": "entry", - "corejs": 3 - }] - ] -} diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-stable/stdout.txt b/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-stable/stdout.txt deleted file mode 100644 index ac359171f3f1..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-stable/stdout.txt +++ /dev/null @@ -1,253 +0,0 @@ -@babel/preset-env: `DEBUG` option - -Using targets: -{} - -Using modules transform: auto - -Using plugins: - transform-template-literals {} - transform-literals {} - transform-function-name {} - transform-arrow-functions {} - transform-block-scoped-functions {} - transform-classes {} - transform-object-super {} - transform-shorthand-properties {} - transform-duplicate-keys {} - transform-computed-properties {} - transform-for-of {} - transform-sticky-regex {} - transform-dotall-regex {} - transform-unicode-regex {} - transform-spread {} - transform-parameters {} - transform-destructuring {} - transform-block-scoping {} - transform-typeof-symbol {} - transform-new-target {} - transform-regenerator {} - transform-exponentiation-operator {} - transform-async-to-generator {} - proposal-async-generator-functions {} - proposal-object-rest-spread {} - proposal-unicode-property-regex {} - proposal-json-strings {} - proposal-optional-catch-binding {} - transform-named-capturing-groups-regex {} - transform-member-expression-literals {} - transform-property-literals {} - transform-reserved-words {} - -Using polyfills with `entry` option: - -[/src/in.js] Replaced core-js entries with the following polyfills: - es.symbol {} - es.symbol.description {} - es.symbol.async-iterator {} - es.symbol.has-instance {} - es.symbol.is-concat-spreadable {} - es.symbol.iterator {} - es.symbol.match {} - es.symbol.replace {} - es.symbol.search {} - es.symbol.species {} - es.symbol.split {} - es.symbol.to-primitive {} - es.symbol.to-string-tag {} - es.symbol.unscopables {} - es.array.concat {} - es.array.copy-within {} - es.array.every {} - es.array.fill {} - es.array.filter {} - es.array.find {} - es.array.find-index {} - es.array.flat {} - es.array.flat-map {} - es.array.for-each {} - es.array.from {} - es.array.includes {} - es.array.index-of {} - es.array.is-array {} - es.array.iterator {} - es.array.join {} - es.array.last-index-of {} - es.array.map {} - es.array.of {} - es.array.reduce {} - es.array.reduce-right {} - es.array.reverse {} - es.array.slice {} - es.array.some {} - es.array.sort {} - es.array.species {} - es.array.splice {} - es.array.unscopables.flat {} - es.array.unscopables.flat-map {} - es.array-buffer.constructor {} - es.array-buffer.is-view {} - es.array-buffer.slice {} - es.data-view {} - es.date.now {} - es.date.to-iso-string {} - es.date.to-json {} - es.date.to-primitive {} - es.date.to-string {} - es.function.bind {} - es.function.has-instance {} - es.function.name {} - es.json.to-string-tag {} - es.map {} - es.math.acosh {} - es.math.asinh {} - es.math.atanh {} - es.math.cbrt {} - es.math.clz32 {} - es.math.cosh {} - es.math.expm1 {} - es.math.fround {} - es.math.hypot {} - es.math.imul {} - es.math.log10 {} - es.math.log1p {} - es.math.log2 {} - es.math.sign {} - es.math.sinh {} - es.math.tanh {} - es.math.to-string-tag {} - es.math.trunc {} - es.number.constructor {} - es.number.epsilon {} - es.number.is-finite {} - es.number.is-integer {} - es.number.is-nan {} - es.number.is-safe-integer {} - es.number.max-safe-integer {} - es.number.min-safe-integer {} - es.number.parse-float {} - es.number.parse-int {} - es.number.to-fixed {} - es.number.to-precision {} - es.object.assign {} - es.object.create {} - es.object.define-getter {} - es.object.define-properties {} - es.object.define-property {} - es.object.define-setter {} - es.object.entries {} - es.object.freeze {} - es.object.from-entries {} - es.object.get-own-property-descriptor {} - es.object.get-own-property-descriptors {} - es.object.get-own-property-names {} - es.object.get-prototype-of {} - es.object.is {} - es.object.is-extensible {} - es.object.is-frozen {} - es.object.is-sealed {} - es.object.keys {} - es.object.lookup-getter {} - es.object.lookup-setter {} - es.object.prevent-extensions {} - es.object.seal {} - es.object.set-prototype-of {} - es.object.to-string {} - es.object.values {} - es.parse-float {} - es.parse-int {} - es.promise {} - es.promise.finally {} - es.reflect.apply {} - es.reflect.construct {} - es.reflect.define-property {} - es.reflect.delete-property {} - es.reflect.get {} - es.reflect.get-own-property-descriptor {} - es.reflect.get-prototype-of {} - es.reflect.has {} - es.reflect.is-extensible {} - es.reflect.own-keys {} - es.reflect.prevent-extensions {} - es.reflect.set {} - es.reflect.set-prototype-of {} - es.regexp.constructor {} - es.regexp.exec {} - es.regexp.flags {} - es.regexp.to-string {} - es.set {} - es.string.code-point-at {} - es.string.ends-with {} - es.string.from-code-point {} - es.string.includes {} - es.string.iterator {} - es.string.match {} - es.string.pad-end {} - es.string.pad-start {} - es.string.raw {} - es.string.repeat {} - es.string.replace {} - es.string.search {} - es.string.split {} - es.string.starts-with {} - es.string.trim {} - es.string.trim-end {} - es.string.trim-start {} - es.string.anchor {} - es.string.big {} - es.string.blink {} - es.string.bold {} - es.string.fixed {} - es.string.fontcolor {} - es.string.fontsize {} - es.string.italics {} - es.string.link {} - es.string.small {} - es.string.strike {} - es.string.sub {} - es.string.sup {} - es.typed-array.float32-array {} - es.typed-array.float64-array {} - es.typed-array.int8-array {} - es.typed-array.int16-array {} - es.typed-array.int32-array {} - es.typed-array.uint8-array {} - es.typed-array.uint8-clamped-array {} - es.typed-array.uint16-array {} - es.typed-array.uint32-array {} - es.typed-array.copy-within {} - es.typed-array.every {} - es.typed-array.fill {} - es.typed-array.filter {} - es.typed-array.find {} - es.typed-array.find-index {} - es.typed-array.for-each {} - es.typed-array.from {} - es.typed-array.includes {} - es.typed-array.index-of {} - es.typed-array.iterator {} - es.typed-array.join {} - es.typed-array.last-index-of {} - es.typed-array.map {} - es.typed-array.of {} - es.typed-array.reduce {} - es.typed-array.reduce-right {} - es.typed-array.reverse {} - es.typed-array.set {} - es.typed-array.slice {} - es.typed-array.some {} - es.typed-array.sort {} - es.typed-array.subarray {} - es.typed-array.to-locale-string {} - es.typed-array.to-string {} - es.weak-map {} - es.weak-set {} - web.dom-collections.for-each {} - web.dom-collections.iterator {} - web.immediate {} - web.queue-microtask {} - web.timers {} - web.url {} - web.url.to-json {} - web.url-search-params {} -Successfully compiled 1 file with Babel. \ No newline at end of file diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-stage-chrome-71/options.json b/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-stage-chrome-71/options.json deleted file mode 100644 index b9db1e21e401..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-stage-chrome-71/options.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "presets": [ - ["../../lib", { - "debug": true, - "targets": { - "browsers": "chrome 71" - }, - "shippedProposals": true, - "useBuiltIns": "entry", - "corejs": 3 - }] - ] -} diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-stage-chrome-71/stdout.txt b/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-stage-chrome-71/stdout.txt deleted file mode 100644 index 7b8630d1d45f..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-stage-chrome-71/stdout.txt +++ /dev/null @@ -1,102 +0,0 @@ -@babel/preset-env: `DEBUG` option - -Using targets: -{ - "chrome": "71" -} - -Using modules transform: auto - -Using plugins: - syntax-async-generators { "chrome":"71" } - syntax-object-rest-spread { "chrome":"71" } - syntax-json-strings { "chrome":"71" } - syntax-optional-catch-binding { "chrome":"71" } - -Using polyfills with `entry` option: - -[/src/in.js] Replaced core-js entries with the following polyfills: - esnext.aggregate-error { "chrome":"71" } - esnext.array.last-index { "chrome":"71" } - esnext.array.last-item { "chrome":"71" } - esnext.composite-key { "chrome":"71" } - esnext.composite-symbol { "chrome":"71" } - esnext.map.delete-all { "chrome":"71" } - esnext.map.every { "chrome":"71" } - esnext.map.filter { "chrome":"71" } - esnext.map.find { "chrome":"71" } - esnext.map.find-key { "chrome":"71" } - esnext.map.from { "chrome":"71" } - esnext.map.group-by { "chrome":"71" } - esnext.map.includes { "chrome":"71" } - esnext.map.key-by { "chrome":"71" } - esnext.map.key-of { "chrome":"71" } - esnext.map.map-keys { "chrome":"71" } - esnext.map.map-values { "chrome":"71" } - esnext.map.merge { "chrome":"71" } - esnext.map.of { "chrome":"71" } - esnext.map.reduce { "chrome":"71" } - esnext.map.some { "chrome":"71" } - esnext.map.update { "chrome":"71" } - esnext.math.clamp { "chrome":"71" } - esnext.math.deg-per-rad { "chrome":"71" } - esnext.math.degrees { "chrome":"71" } - esnext.math.fscale { "chrome":"71" } - esnext.math.iaddh { "chrome":"71" } - esnext.math.imulh { "chrome":"71" } - esnext.math.isubh { "chrome":"71" } - esnext.math.rad-per-deg { "chrome":"71" } - esnext.math.radians { "chrome":"71" } - esnext.math.scale { "chrome":"71" } - esnext.math.seeded-prng { "chrome":"71" } - esnext.math.signbit { "chrome":"71" } - esnext.math.umulh { "chrome":"71" } - esnext.number.from-string { "chrome":"71" } - esnext.observable { "chrome":"71" } - esnext.promise.all-settled { "chrome":"71" } - esnext.promise.any { "chrome":"71" } - esnext.promise.try { "chrome":"71" } - esnext.reflect.define-metadata { "chrome":"71" } - esnext.reflect.delete-metadata { "chrome":"71" } - esnext.reflect.get-metadata { "chrome":"71" } - esnext.reflect.get-metadata-keys { "chrome":"71" } - esnext.reflect.get-own-metadata { "chrome":"71" } - esnext.reflect.get-own-metadata-keys { "chrome":"71" } - esnext.reflect.has-metadata { "chrome":"71" } - esnext.reflect.has-own-metadata { "chrome":"71" } - esnext.reflect.metadata { "chrome":"71" } - esnext.set.add-all { "chrome":"71" } - esnext.set.delete-all { "chrome":"71" } - esnext.set.difference { "chrome":"71" } - esnext.set.every { "chrome":"71" } - esnext.set.filter { "chrome":"71" } - esnext.set.find { "chrome":"71" } - esnext.set.from { "chrome":"71" } - esnext.set.intersection { "chrome":"71" } - esnext.set.is-disjoint-from { "chrome":"71" } - esnext.set.is-subset-of { "chrome":"71" } - esnext.set.is-superset-of { "chrome":"71" } - esnext.set.join { "chrome":"71" } - esnext.set.map { "chrome":"71" } - esnext.set.of { "chrome":"71" } - esnext.set.reduce { "chrome":"71" } - esnext.set.some { "chrome":"71" } - esnext.set.symmetric-difference { "chrome":"71" } - esnext.set.union { "chrome":"71" } - esnext.string.at { "chrome":"71" } - esnext.string.code-points { "chrome":"71" } - esnext.string.replace-all { "chrome":"71" } - esnext.symbol.dispose { "chrome":"71" } - esnext.symbol.observable { "chrome":"71" } - esnext.symbol.pattern-match { "chrome":"71" } - esnext.weak-map.delete-all { "chrome":"71" } - esnext.weak-map.from { "chrome":"71" } - esnext.weak-map.of { "chrome":"71" } - esnext.weak-set.add-all { "chrome":"71" } - esnext.weak-set.delete-all { "chrome":"71" } - esnext.weak-set.from { "chrome":"71" } - esnext.weak-set.of { "chrome":"71" } - esnext.string.match-all { "chrome":"71" } - -[/src/in.js] Based on your targets, regenerator-runtime import excluded. -Successfully compiled 1 file with Babel. \ No newline at end of file diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-stage/options.json b/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-stage/options.json deleted file mode 100644 index 1e5ef9ed0a56..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-stage/options.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "presets": [ - ["../../lib", { - "debug": true, - "shippedProposals": true, - "useBuiltIns": "entry", - "corejs": 3 - }] - ] -} diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-stage/stdout.txt b/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-stage/stdout.txt deleted file mode 100644 index 34bf4094e273..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-stage/stdout.txt +++ /dev/null @@ -1,130 +0,0 @@ -@babel/preset-env: `DEBUG` option - -Using targets: -{} - -Using modules transform: auto - -Using plugins: - transform-template-literals {} - transform-literals {} - transform-function-name {} - transform-arrow-functions {} - transform-block-scoped-functions {} - transform-classes {} - transform-object-super {} - transform-shorthand-properties {} - transform-duplicate-keys {} - transform-computed-properties {} - transform-for-of {} - transform-sticky-regex {} - transform-dotall-regex {} - transform-unicode-regex {} - transform-spread {} - transform-parameters {} - transform-destructuring {} - transform-block-scoping {} - transform-typeof-symbol {} - transform-new-target {} - transform-regenerator {} - transform-exponentiation-operator {} - transform-async-to-generator {} - proposal-async-generator-functions {} - proposal-object-rest-spread {} - proposal-unicode-property-regex {} - proposal-json-strings {} - proposal-optional-catch-binding {} - transform-named-capturing-groups-regex {} - transform-member-expression-literals {} - transform-property-literals {} - transform-reserved-words {} - -Using polyfills with `entry` option: - -[/src/in.js] Replaced core-js entries with the following polyfills: - esnext.aggregate-error {} - esnext.array.last-index {} - esnext.array.last-item {} - esnext.composite-key {} - esnext.composite-symbol {} - esnext.global-this {} - esnext.map.delete-all {} - esnext.map.every {} - esnext.map.filter {} - esnext.map.find {} - esnext.map.find-key {} - esnext.map.from {} - esnext.map.group-by {} - esnext.map.includes {} - esnext.map.key-by {} - esnext.map.key-of {} - esnext.map.map-keys {} - esnext.map.map-values {} - esnext.map.merge {} - esnext.map.of {} - esnext.map.reduce {} - esnext.map.some {} - esnext.map.update {} - esnext.math.clamp {} - esnext.math.deg-per-rad {} - esnext.math.degrees {} - esnext.math.fscale {} - esnext.math.iaddh {} - esnext.math.imulh {} - esnext.math.isubh {} - esnext.math.rad-per-deg {} - esnext.math.radians {} - esnext.math.scale {} - esnext.math.seeded-prng {} - esnext.math.signbit {} - esnext.math.umulh {} - esnext.number.from-string {} - esnext.observable {} - esnext.promise.all-settled {} - esnext.promise.any {} - esnext.promise.try {} - esnext.reflect.define-metadata {} - esnext.reflect.delete-metadata {} - esnext.reflect.get-metadata {} - esnext.reflect.get-metadata-keys {} - esnext.reflect.get-own-metadata {} - esnext.reflect.get-own-metadata-keys {} - esnext.reflect.has-metadata {} - esnext.reflect.has-own-metadata {} - esnext.reflect.metadata {} - esnext.set.add-all {} - esnext.set.delete-all {} - esnext.set.difference {} - esnext.set.every {} - esnext.set.filter {} - esnext.set.find {} - esnext.set.from {} - esnext.set.intersection {} - esnext.set.is-disjoint-from {} - esnext.set.is-subset-of {} - esnext.set.is-superset-of {} - esnext.set.join {} - esnext.set.map {} - esnext.set.of {} - esnext.set.reduce {} - esnext.set.some {} - esnext.set.symmetric-difference {} - esnext.set.union {} - esnext.string.at {} - esnext.string.code-points {} - esnext.string.replace-all {} - esnext.symbol.dispose {} - esnext.symbol.observable {} - esnext.symbol.pattern-match {} - esnext.weak-map.delete-all {} - esnext.weak-map.from {} - esnext.weak-map.of {} - esnext.weak-set.add-all {} - esnext.weak-set.delete-all {} - esnext.weak-set.from {} - esnext.weak-set.of {} - web.url {} - web.url.to-json {} - web.url-search-params {} - esnext.string.match-all {} -Successfully compiled 1 file with Babel. \ No newline at end of file diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-versions-decimals/options.json b/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-versions-decimals/options.json deleted file mode 100644 index 8eebdab425d8..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-versions-decimals/options.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "presets": [ - ["../../lib", { - "useBuiltIns": "entry", - "corejs": 3, - "debug": true, - "targets": { - "chrome": 54, - "electron": 0.36, - "node": 6.10, - "ie": 10 - } - }] - ] -} diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-versions-decimals/stdout.txt b/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-versions-decimals/stdout.txt deleted file mode 100644 index 359bbdb07bdd..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-versions-decimals/stdout.txt +++ /dev/null @@ -1,244 +0,0 @@ -Warning, the following targets are using a decimal version: - - electron: 0.36 - node: 6.1 - -We recommend using a string for minor/patch versions to avoid numbers like 6.10 -getting parsed as 6.1, which can lead to unexpected behavior. - -@babel/preset-env: `DEBUG` option - -Using targets: -{ - "chrome": "54", - "electron": "0.36", - "ie": "10", - "node": "6.1" -} - -Using modules transform: auto - -Using plugins: - transform-template-literals { "ie":"10" } - transform-literals { "ie":"10" } - transform-function-name { "electron":"0.36", "ie":"10", "node":"6.1" } - transform-arrow-functions { "ie":"10" } - transform-block-scoped-functions { "ie":"10" } - transform-classes { "ie":"10" } - transform-object-super { "ie":"10" } - transform-shorthand-properties { "ie":"10" } - transform-duplicate-keys { "ie":"10" } - transform-computed-properties { "ie":"10" } - transform-for-of { "electron":"0.36", "ie":"10", "node":"6.1" } - transform-sticky-regex { "electron":"0.36", "ie":"10" } - transform-dotall-regex { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } - transform-unicode-regex { "electron":"0.36", "ie":"10" } - transform-spread { "ie":"10" } - transform-parameters { "electron":"0.36", "ie":"10" } - transform-destructuring { "electron":"0.36", "ie":"10", "node":"6.1" } - transform-block-scoping { "electron":"0.36", "ie":"10" } - transform-typeof-symbol { "ie":"10" } - transform-new-target { "ie":"10" } - transform-regenerator { "electron":"0.36", "ie":"10" } - transform-exponentiation-operator { "electron":"0.36", "ie":"10", "node":"6.1" } - transform-async-to-generator { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } - proposal-async-generator-functions { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } - proposal-object-rest-spread { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } - proposal-unicode-property-regex { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } - proposal-json-strings { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } - proposal-optional-catch-binding { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } - transform-named-capturing-groups-regex { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } - transform-member-expression-literals { "electron":"0.36" } - transform-property-literals { "electron":"0.36" } - -Using polyfills with `entry` option: - -[/src/in.js] Replaced core-js entries with the following polyfills: - es.symbol { "electron":"0.36", "ie":"10" } - es.symbol.description { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } - es.symbol.async-iterator { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } - es.symbol.has-instance { "electron":"0.36", "ie":"10" } - es.symbol.is-concat-spreadable { "electron":"0.36", "ie":"10" } - es.symbol.iterator { "ie":"10" } - es.symbol.match { "electron":"0.36", "ie":"10" } - es.symbol.replace { "electron":"0.36", "ie":"10" } - es.symbol.search { "electron":"0.36", "ie":"10" } - es.symbol.species { "electron":"0.36", "ie":"10", "node":"6.1" } - es.symbol.split { "electron":"0.36", "ie":"10" } - es.symbol.to-primitive { "ie":"10" } - es.symbol.to-string-tag { "electron":"0.36", "ie":"10" } - es.symbol.unscopables { "ie":"10" } - es.array.concat { "electron":"0.36", "ie":"10", "node":"6.1" } - es.array.copy-within { "ie":"10" } - es.array.fill { "ie":"10" } - es.array.filter { "electron":"0.36", "ie":"10", "node":"6.1" } - es.array.find { "ie":"10" } - es.array.find-index { "ie":"10" } - es.array.flat { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } - es.array.flat-map { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } - es.array.from { "electron":"0.36", "ie":"10", "node":"6.1" } - es.array.includes { "electron":"0.36", "ie":"10", "node":"6.1" } - es.array.index-of { "electron":"0.36", "node":"6.1" } - es.array.iterator { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } - es.array.join { "ie":"10" } - es.array.last-index-of { "electron":"0.36", "node":"6.1" } - es.array.map { "electron":"0.36", "ie":"10", "node":"6.1" } - es.array.of { "ie":"10" } - es.array.slice { "electron":"0.36", "ie":"10", "node":"6.1" } - es.array.sort { "chrome":"54", "electron":"0.36", "node":"6.1" } - es.array.species { "electron":"0.36", "ie":"10", "node":"6.1" } - es.array.splice { "electron":"0.36", "ie":"10", "node":"6.1" } - es.array.unscopables.flat { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } - es.array.unscopables.flat-map { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } - es.array-buffer.constructor { "ie":"10" } - es.array-buffer.is-view { "ie":"10" } - es.array-buffer.slice { "ie":"10" } - es.date.to-primitive { "ie":"10" } - es.function.has-instance { "electron":"0.36", "ie":"10", "node":"6.1" } - es.function.name { "ie":"10" } - es.json.to-string-tag { "electron":"0.36", "ie":"10" } - es.map { "electron":"0.36", "ie":"10", "node":"6.1" } - es.math.acosh { "electron":"0.36", "ie":"10", "node":"6.1" } - es.math.asinh { "ie":"10" } - es.math.atanh { "ie":"10" } - es.math.cbrt { "ie":"10" } - es.math.clz32 { "ie":"10" } - es.math.cosh { "ie":"10" } - es.math.expm1 { "ie":"10" } - es.math.fround { "ie":"10" } - es.math.hypot { "ie":"10" } - es.math.imul { "ie":"10" } - es.math.log10 { "ie":"10" } - es.math.log1p { "ie":"10" } - es.math.log2 { "ie":"10" } - es.math.sign { "ie":"10" } - es.math.sinh { "ie":"10" } - es.math.tanh { "ie":"10" } - es.math.to-string-tag { "electron":"0.36", "ie":"10" } - es.math.trunc { "ie":"10" } - es.number.constructor { "ie":"10" } - es.number.epsilon { "ie":"10" } - es.number.is-finite { "ie":"10" } - es.number.is-integer { "ie":"10" } - es.number.is-nan { "ie":"10" } - es.number.is-safe-integer { "ie":"10" } - es.number.max-safe-integer { "ie":"10" } - es.number.min-safe-integer { "ie":"10" } - es.number.parse-float { "ie":"10" } - es.number.parse-int { "ie":"10" } - es.number.to-fixed { "ie":"10" } - es.object.assign { "electron":"0.36", "ie":"10" } - es.object.define-getter { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } - es.object.define-setter { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } - es.object.entries { "electron":"0.36", "ie":"10", "node":"6.1" } - es.object.freeze { "ie":"10" } - es.object.from-entries { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } - es.object.get-own-property-descriptor { "ie":"10" } - es.object.get-own-property-descriptors { "electron":"0.36", "ie":"10", "node":"6.1" } - es.object.get-own-property-names { "ie":"10" } - es.object.get-prototype-of { "ie":"10" } - es.object.is { "ie":"10" } - es.object.is-extensible { "ie":"10" } - es.object.is-frozen { "ie":"10" } - es.object.is-sealed { "ie":"10" } - es.object.keys { "ie":"10" } - es.object.lookup-getter { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } - es.object.lookup-setter { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } - es.object.prevent-extensions { "ie":"10" } - es.object.seal { "ie":"10" } - es.object.set-prototype-of { "ie":"10" } - es.object.to-string { "electron":"0.36", "ie":"10" } - es.object.values { "electron":"0.36", "ie":"10", "node":"6.1" } - es.promise { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } - es.promise.finally { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } - es.reflect.apply { "electron":"0.36", "ie":"10" } - es.reflect.construct { "electron":"0.36", "ie":"10" } - es.reflect.define-property { "electron":"0.36", "ie":"10" } - es.reflect.delete-property { "electron":"0.36", "ie":"10" } - es.reflect.get { "electron":"0.36", "ie":"10" } - es.reflect.get-own-property-descriptor { "electron":"0.36", "ie":"10" } - es.reflect.get-prototype-of { "electron":"0.36", "ie":"10" } - es.reflect.has { "electron":"0.36", "ie":"10" } - es.reflect.is-extensible { "electron":"0.36", "ie":"10" } - es.reflect.own-keys { "electron":"0.36", "ie":"10" } - es.reflect.prevent-extensions { "electron":"0.36", "ie":"10" } - es.reflect.set { "electron":"0.36", "ie":"10" } - es.reflect.set-prototype-of { "electron":"0.36", "ie":"10" } - es.regexp.constructor { "electron":"0.36", "ie":"10", "node":"6.1" } - es.regexp.flags { "electron":"0.36", "ie":"10" } - es.regexp.to-string { "electron":"0.36", "ie":"10" } - es.set { "electron":"0.36", "ie":"10", "node":"6.1" } - es.string.code-point-at { "ie":"10" } - es.string.ends-with { "electron":"0.36", "ie":"10", "node":"6.1" } - es.string.from-code-point { "ie":"10" } - es.string.includes { "electron":"0.36", "ie":"10", "node":"6.1" } - es.string.iterator { "ie":"10" } - es.string.match { "electron":"0.36", "ie":"10", "node":"6.1" } - es.string.pad-end { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } - es.string.pad-start { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } - es.string.raw { "ie":"10" } - es.string.repeat { "ie":"10" } - es.string.replace { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } - es.string.search { "electron":"0.36", "ie":"10", "node":"6.1" } - es.string.split { "electron":"0.36", "ie":"10", "node":"6.1" } - es.string.starts-with { "electron":"0.36", "ie":"10", "node":"6.1" } - es.string.trim { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } - es.string.trim-end { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } - es.string.trim-start { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } - es.string.anchor { "ie":"10" } - es.string.big { "ie":"10" } - es.string.blink { "ie":"10" } - es.string.bold { "ie":"10" } - es.string.fixed { "ie":"10" } - es.string.fontcolor { "ie":"10" } - es.string.fontsize { "ie":"10" } - es.string.italics { "ie":"10" } - es.string.link { "ie":"10" } - es.string.small { "ie":"10" } - es.string.strike { "ie":"10" } - es.string.sub { "ie":"10" } - es.string.sup { "ie":"10" } - es.typed-array.float32-array { "electron":"0.36", "ie":"10", "node":"6.1" } - es.typed-array.float64-array { "electron":"0.36", "ie":"10", "node":"6.1" } - es.typed-array.int8-array { "electron":"0.36", "ie":"10", "node":"6.1" } - es.typed-array.int16-array { "electron":"0.36", "ie":"10", "node":"6.1" } - es.typed-array.int32-array { "electron":"0.36", "ie":"10", "node":"6.1" } - es.typed-array.uint8-array { "electron":"0.36", "ie":"10", "node":"6.1" } - es.typed-array.uint8-clamped-array { "electron":"0.36", "ie":"10", "node":"6.1" } - es.typed-array.uint16-array { "electron":"0.36", "ie":"10", "node":"6.1" } - es.typed-array.uint32-array { "electron":"0.36", "ie":"10", "node":"6.1" } - es.typed-array.copy-within { "ie":"10" } - es.typed-array.every { "ie":"10" } - es.typed-array.fill { "ie":"10" } - es.typed-array.filter { "ie":"10" } - es.typed-array.find { "ie":"10" } - es.typed-array.find-index { "ie":"10" } - es.typed-array.for-each { "ie":"10" } - es.typed-array.from { "electron":"0.36", "ie":"10", "node":"6.1" } - es.typed-array.includes { "electron":"0.36", "ie":"10" } - es.typed-array.index-of { "ie":"10" } - es.typed-array.iterator { "ie":"10" } - es.typed-array.join { "ie":"10" } - es.typed-array.last-index-of { "ie":"10" } - es.typed-array.map { "ie":"10" } - es.typed-array.of { "electron":"0.36", "ie":"10", "node":"6.1" } - es.typed-array.reduce { "ie":"10" } - es.typed-array.reduce-right { "ie":"10" } - es.typed-array.reverse { "ie":"10" } - es.typed-array.set { "ie":"10" } - es.typed-array.slice { "ie":"10" } - es.typed-array.some { "ie":"10" } - es.typed-array.sort { "ie":"10" } - es.typed-array.subarray { "ie":"10" } - es.typed-array.to-locale-string { "ie":"10" } - es.typed-array.to-string { "electron":"0.36", "ie":"10", "node":"6.1" } - es.weak-map { "electron":"0.36", "ie":"10", "node":"6.1" } - es.weak-set { "electron":"0.36", "ie":"10", "node":"6.1" } - web.dom-collections.for-each { "chrome":"54", "electron":"0.36", "ie":"10" } - web.dom-collections.iterator { "chrome":"54", "electron":"0.36", "ie":"10" } - web.immediate { "chrome":"54", "electron":"0.36" } - web.queue-microtask { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } - web.url { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } - web.url.to-json { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } - web.url-search-params { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } -Successfully compiled 1 file with Babel. \ No newline at end of file diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-versions-strings-minor-3.0/options.json b/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-versions-strings-minor-3.0/options.json deleted file mode 100644 index 41cfee645021..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-versions-strings-minor-3.0/options.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "presets": [ - ["../../lib", { - "useBuiltIns": "entry", - "corejs": "3.0", - "debug": true, - "targets": { - "chrome": "54", - "node": "6.10", - "ie": "10" - } - }] - ] -} diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-versions-strings-minor-3.0/stdout.txt b/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-versions-strings-minor-3.0/stdout.txt deleted file mode 100644 index d51520a95c36..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-versions-strings-minor-3.0/stdout.txt +++ /dev/null @@ -1,231 +0,0 @@ -@babel/preset-env: `DEBUG` option - -Using targets: -{ - "chrome": "54", - "ie": "10", - "node": "6.10" -} - -Using modules transform: auto - -Using plugins: - transform-template-literals { "ie":"10" } - transform-literals { "ie":"10" } - transform-function-name { "ie":"10" } - transform-arrow-functions { "ie":"10" } - transform-block-scoped-functions { "ie":"10" } - transform-classes { "ie":"10" } - transform-object-super { "ie":"10" } - transform-shorthand-properties { "ie":"10" } - transform-duplicate-keys { "ie":"10" } - transform-computed-properties { "ie":"10" } - transform-for-of { "ie":"10" } - transform-sticky-regex { "ie":"10" } - transform-dotall-regex { "chrome":"54", "ie":"10", "node":"6.10" } - transform-unicode-regex { "ie":"10" } - transform-spread { "ie":"10" } - transform-parameters { "ie":"10" } - transform-destructuring { "ie":"10" } - transform-block-scoping { "ie":"10" } - transform-typeof-symbol { "ie":"10" } - transform-new-target { "ie":"10" } - transform-regenerator { "ie":"10" } - transform-exponentiation-operator { "ie":"10", "node":"6.10" } - transform-async-to-generator { "chrome":"54", "ie":"10", "node":"6.10" } - proposal-async-generator-functions { "chrome":"54", "ie":"10", "node":"6.10" } - proposal-object-rest-spread { "chrome":"54", "ie":"10", "node":"6.10" } - proposal-unicode-property-regex { "chrome":"54", "ie":"10", "node":"6.10" } - proposal-json-strings { "chrome":"54", "ie":"10", "node":"6.10" } - proposal-optional-catch-binding { "chrome":"54", "ie":"10", "node":"6.10" } - transform-named-capturing-groups-regex { "chrome":"54", "ie":"10", "node":"6.10" } - -Using polyfills with `entry` option: - -[/src/in.js] Replaced core-js entries with the following polyfills: - es.symbol { "ie":"10" } - es.symbol.description { "chrome":"54", "ie":"10", "node":"6.10" } - es.symbol.async-iterator { "chrome":"54", "ie":"10", "node":"6.10" } - es.symbol.has-instance { "ie":"10" } - es.symbol.is-concat-spreadable { "ie":"10" } - es.symbol.iterator { "ie":"10" } - es.symbol.match { "ie":"10" } - es.symbol.replace { "ie":"10" } - es.symbol.search { "ie":"10" } - es.symbol.species { "ie":"10" } - es.symbol.split { "ie":"10" } - es.symbol.to-primitive { "ie":"10" } - es.symbol.to-string-tag { "ie":"10" } - es.symbol.unscopables { "ie":"10" } - es.array.concat { "ie":"10" } - es.array.copy-within { "ie":"10" } - es.array.fill { "ie":"10" } - es.array.filter { "ie":"10" } - es.array.find { "ie":"10" } - es.array.find-index { "ie":"10" } - es.array.flat { "chrome":"54", "ie":"10", "node":"6.10" } - es.array.flat-map { "chrome":"54", "ie":"10", "node":"6.10" } - es.array.from { "ie":"10" } - es.array.includes { "ie":"10", "node":"6.10" } - es.array.iterator { "chrome":"54", "ie":"10", "node":"6.10" } - es.array.join { "ie":"10" } - es.array.map { "ie":"10" } - es.array.of { "ie":"10" } - es.array.slice { "ie":"10" } - es.array.sort { "chrome":"54", "node":"6.10" } - es.array.species { "ie":"10" } - es.array.splice { "ie":"10" } - es.array.unscopables.flat { "chrome":"54", "ie":"10", "node":"6.10" } - es.array.unscopables.flat-map { "chrome":"54", "ie":"10", "node":"6.10" } - es.array-buffer.constructor { "ie":"10" } - es.array-buffer.is-view { "ie":"10" } - es.array-buffer.slice { "ie":"10" } - es.date.to-primitive { "ie":"10" } - es.function.has-instance { "ie":"10" } - es.function.name { "ie":"10" } - es.json.to-string-tag { "ie":"10" } - es.map { "ie":"10" } - es.math.acosh { "ie":"10", "node":"6.10" } - es.math.asinh { "ie":"10" } - es.math.atanh { "ie":"10" } - es.math.cbrt { "ie":"10" } - es.math.clz32 { "ie":"10" } - es.math.cosh { "ie":"10" } - es.math.expm1 { "ie":"10" } - es.math.fround { "ie":"10" } - es.math.hypot { "ie":"10" } - es.math.imul { "ie":"10" } - es.math.log10 { "ie":"10" } - es.math.log1p { "ie":"10" } - es.math.log2 { "ie":"10" } - es.math.sign { "ie":"10" } - es.math.sinh { "ie":"10" } - es.math.tanh { "ie":"10" } - es.math.to-string-tag { "ie":"10" } - es.math.trunc { "ie":"10" } - es.number.constructor { "ie":"10" } - es.number.epsilon { "ie":"10" } - es.number.is-finite { "ie":"10" } - es.number.is-integer { "ie":"10" } - es.number.is-nan { "ie":"10" } - es.number.is-safe-integer { "ie":"10" } - es.number.max-safe-integer { "ie":"10" } - es.number.min-safe-integer { "ie":"10" } - es.number.parse-float { "ie":"10" } - es.number.parse-int { "ie":"10" } - es.number.to-fixed { "ie":"10" } - es.object.assign { "ie":"10" } - es.object.define-getter { "chrome":"54", "ie":"10", "node":"6.10" } - es.object.define-setter { "chrome":"54", "ie":"10", "node":"6.10" } - es.object.entries { "ie":"10", "node":"6.10" } - es.object.freeze { "ie":"10" } - es.object.from-entries { "chrome":"54", "ie":"10", "node":"6.10" } - es.object.get-own-property-descriptor { "ie":"10" } - es.object.get-own-property-descriptors { "ie":"10", "node":"6.10" } - es.object.get-own-property-names { "ie":"10" } - es.object.get-prototype-of { "ie":"10" } - es.object.is { "ie":"10" } - es.object.is-extensible { "ie":"10" } - es.object.is-frozen { "ie":"10" } - es.object.is-sealed { "ie":"10" } - es.object.keys { "ie":"10" } - es.object.lookup-getter { "chrome":"54", "ie":"10", "node":"6.10" } - es.object.lookup-setter { "chrome":"54", "ie":"10", "node":"6.10" } - es.object.prevent-extensions { "ie":"10" } - es.object.seal { "ie":"10" } - es.object.set-prototype-of { "ie":"10" } - es.object.to-string { "ie":"10" } - es.object.values { "ie":"10", "node":"6.10" } - es.promise { "chrome":"54", "ie":"10", "node":"6.10" } - es.promise.finally { "chrome":"54", "ie":"10", "node":"6.10" } - es.reflect.apply { "ie":"10" } - es.reflect.construct { "ie":"10" } - es.reflect.define-property { "ie":"10" } - es.reflect.delete-property { "ie":"10" } - es.reflect.get { "ie":"10" } - es.reflect.get-own-property-descriptor { "ie":"10" } - es.reflect.get-prototype-of { "ie":"10" } - es.reflect.has { "ie":"10" } - es.reflect.is-extensible { "ie":"10" } - es.reflect.own-keys { "ie":"10" } - es.reflect.prevent-extensions { "ie":"10" } - es.reflect.set { "ie":"10" } - es.reflect.set-prototype-of { "ie":"10" } - es.regexp.constructor { "ie":"10" } - es.regexp.flags { "ie":"10" } - es.regexp.to-string { "ie":"10" } - es.set { "ie":"10" } - es.string.code-point-at { "ie":"10" } - es.string.ends-with { "ie":"10" } - es.string.from-code-point { "ie":"10" } - es.string.includes { "ie":"10" } - es.string.iterator { "ie":"10" } - es.string.match { "ie":"10" } - es.string.pad-end { "chrome":"54", "ie":"10", "node":"6.10" } - es.string.pad-start { "chrome":"54", "ie":"10", "node":"6.10" } - es.string.raw { "ie":"10" } - es.string.repeat { "ie":"10" } - es.string.replace { "chrome":"54", "ie":"10", "node":"6.10" } - es.string.search { "ie":"10" } - es.string.split { "ie":"10", "node":"6.10" } - es.string.starts-with { "ie":"10" } - es.string.trim { "chrome":"54", "ie":"10", "node":"6.10" } - es.string.trim-end { "chrome":"54", "ie":"10", "node":"6.10" } - es.string.trim-start { "chrome":"54", "ie":"10", "node":"6.10" } - es.string.anchor { "ie":"10" } - es.string.big { "ie":"10" } - es.string.blink { "ie":"10" } - es.string.bold { "ie":"10" } - es.string.fixed { "ie":"10" } - es.string.fontcolor { "ie":"10" } - es.string.fontsize { "ie":"10" } - es.string.italics { "ie":"10" } - es.string.link { "ie":"10" } - es.string.small { "ie":"10" } - es.string.strike { "ie":"10" } - es.string.sub { "ie":"10" } - es.string.sup { "ie":"10" } - es.typed-array.float32-array { "ie":"10", "node":"6.10" } - es.typed-array.float64-array { "ie":"10", "node":"6.10" } - es.typed-array.int8-array { "ie":"10", "node":"6.10" } - es.typed-array.int16-array { "ie":"10", "node":"6.10" } - es.typed-array.int32-array { "ie":"10", "node":"6.10" } - es.typed-array.uint8-array { "ie":"10", "node":"6.10" } - es.typed-array.uint8-clamped-array { "ie":"10", "node":"6.10" } - es.typed-array.uint16-array { "ie":"10", "node":"6.10" } - es.typed-array.uint32-array { "ie":"10", "node":"6.10" } - es.typed-array.copy-within { "ie":"10" } - es.typed-array.every { "ie":"10" } - es.typed-array.fill { "ie":"10" } - es.typed-array.filter { "ie":"10" } - es.typed-array.find { "ie":"10" } - es.typed-array.find-index { "ie":"10" } - es.typed-array.for-each { "ie":"10" } - es.typed-array.from { "ie":"10", "node":"6.10" } - es.typed-array.includes { "ie":"10" } - es.typed-array.index-of { "ie":"10" } - es.typed-array.iterator { "ie":"10" } - es.typed-array.join { "ie":"10" } - es.typed-array.last-index-of { "ie":"10" } - es.typed-array.map { "ie":"10" } - es.typed-array.of { "ie":"10", "node":"6.10" } - es.typed-array.reduce { "ie":"10" } - es.typed-array.reduce-right { "ie":"10" } - es.typed-array.reverse { "ie":"10" } - es.typed-array.set { "ie":"10" } - es.typed-array.slice { "ie":"10" } - es.typed-array.some { "ie":"10" } - es.typed-array.sort { "ie":"10" } - es.typed-array.subarray { "ie":"10" } - es.typed-array.to-locale-string { "ie":"10" } - es.typed-array.to-string { "ie":"10" } - es.weak-map { "ie":"10" } - es.weak-set { "ie":"10" } - web.dom-collections.for-each { "chrome":"54", "ie":"10" } - web.dom-collections.iterator { "chrome":"54", "ie":"10" } - web.immediate { "chrome":"54" } - web.queue-microtask { "chrome":"54", "ie":"10", "node":"6.10" } - web.url { "chrome":"54", "ie":"10", "node":"6.10" } - web.url.to-json { "chrome":"54", "ie":"10", "node":"6.10" } - web.url-search-params { "chrome":"54", "ie":"10", "node":"6.10" } -Successfully compiled 1 file with Babel. \ No newline at end of file diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-versions-strings-minor-3.1/options.json b/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-versions-strings-minor-3.1/options.json deleted file mode 100644 index fd88d31055ef..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-versions-strings-minor-3.1/options.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "presets": [ - ["../../lib", { - "useBuiltIns": "entry", - "corejs": "3.1", - "debug": true, - "targets": { - "chrome": "54", - "node": "6.10", - "ie": "10" - } - }] - ] -} diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-versions-strings-minor-3.1/stdout.txt b/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-versions-strings-minor-3.1/stdout.txt deleted file mode 100644 index 9bdec21bb16c..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-versions-strings-minor-3.1/stdout.txt +++ /dev/null @@ -1,233 +0,0 @@ -@babel/preset-env: `DEBUG` option - -Using targets: -{ - "chrome": "54", - "ie": "10", - "node": "6.10" -} - -Using modules transform: auto - -Using plugins: - transform-template-literals { "ie":"10" } - transform-literals { "ie":"10" } - transform-function-name { "ie":"10" } - transform-arrow-functions { "ie":"10" } - transform-block-scoped-functions { "ie":"10" } - transform-classes { "ie":"10" } - transform-object-super { "ie":"10" } - transform-shorthand-properties { "ie":"10" } - transform-duplicate-keys { "ie":"10" } - transform-computed-properties { "ie":"10" } - transform-for-of { "ie":"10" } - transform-sticky-regex { "ie":"10" } - transform-dotall-regex { "chrome":"54", "ie":"10", "node":"6.10" } - transform-unicode-regex { "ie":"10" } - transform-spread { "ie":"10" } - transform-parameters { "ie":"10" } - transform-destructuring { "ie":"10" } - transform-block-scoping { "ie":"10" } - transform-typeof-symbol { "ie":"10" } - transform-new-target { "ie":"10" } - transform-regenerator { "ie":"10" } - transform-exponentiation-operator { "ie":"10", "node":"6.10" } - transform-async-to-generator { "chrome":"54", "ie":"10", "node":"6.10" } - proposal-async-generator-functions { "chrome":"54", "ie":"10", "node":"6.10" } - proposal-object-rest-spread { "chrome":"54", "ie":"10", "node":"6.10" } - proposal-unicode-property-regex { "chrome":"54", "ie":"10", "node":"6.10" } - proposal-json-strings { "chrome":"54", "ie":"10", "node":"6.10" } - proposal-optional-catch-binding { "chrome":"54", "ie":"10", "node":"6.10" } - transform-named-capturing-groups-regex { "chrome":"54", "ie":"10", "node":"6.10" } - -Using polyfills with `entry` option: - -[/src/in.js] Replaced core-js entries with the following polyfills: - es.symbol { "ie":"10" } - es.symbol.description { "chrome":"54", "ie":"10", "node":"6.10" } - es.symbol.async-iterator { "chrome":"54", "ie":"10", "node":"6.10" } - es.symbol.has-instance { "ie":"10" } - es.symbol.is-concat-spreadable { "ie":"10" } - es.symbol.iterator { "ie":"10" } - es.symbol.match { "ie":"10" } - es.symbol.match-all { "chrome":"54", "ie":"10", "node":"6.10" } - es.symbol.replace { "ie":"10" } - es.symbol.search { "ie":"10" } - es.symbol.species { "ie":"10" } - es.symbol.split { "ie":"10" } - es.symbol.to-primitive { "ie":"10" } - es.symbol.to-string-tag { "ie":"10" } - es.symbol.unscopables { "ie":"10" } - es.array.concat { "ie":"10" } - es.array.copy-within { "ie":"10" } - es.array.fill { "ie":"10" } - es.array.filter { "ie":"10" } - es.array.find { "ie":"10" } - es.array.find-index { "ie":"10" } - es.array.flat { "chrome":"54", "ie":"10", "node":"6.10" } - es.array.flat-map { "chrome":"54", "ie":"10", "node":"6.10" } - es.array.from { "ie":"10" } - es.array.includes { "ie":"10", "node":"6.10" } - es.array.iterator { "chrome":"54", "ie":"10", "node":"6.10" } - es.array.join { "ie":"10" } - es.array.map { "ie":"10" } - es.array.of { "ie":"10" } - es.array.slice { "ie":"10" } - es.array.sort { "chrome":"54", "node":"6.10" } - es.array.species { "ie":"10" } - es.array.splice { "ie":"10" } - es.array.unscopables.flat { "chrome":"54", "ie":"10", "node":"6.10" } - es.array.unscopables.flat-map { "chrome":"54", "ie":"10", "node":"6.10" } - es.array-buffer.constructor { "ie":"10" } - es.array-buffer.is-view { "ie":"10" } - es.array-buffer.slice { "ie":"10" } - es.date.to-primitive { "ie":"10" } - es.function.has-instance { "ie":"10" } - es.function.name { "ie":"10" } - es.json.to-string-tag { "ie":"10" } - es.map { "ie":"10" } - es.math.acosh { "ie":"10", "node":"6.10" } - es.math.asinh { "ie":"10" } - es.math.atanh { "ie":"10" } - es.math.cbrt { "ie":"10" } - es.math.clz32 { "ie":"10" } - es.math.cosh { "ie":"10" } - es.math.expm1 { "ie":"10" } - es.math.fround { "ie":"10" } - es.math.hypot { "ie":"10" } - es.math.imul { "ie":"10" } - es.math.log10 { "ie":"10" } - es.math.log1p { "ie":"10" } - es.math.log2 { "ie":"10" } - es.math.sign { "ie":"10" } - es.math.sinh { "ie":"10" } - es.math.tanh { "ie":"10" } - es.math.to-string-tag { "ie":"10" } - es.math.trunc { "ie":"10" } - es.number.constructor { "ie":"10" } - es.number.epsilon { "ie":"10" } - es.number.is-finite { "ie":"10" } - es.number.is-integer { "ie":"10" } - es.number.is-nan { "ie":"10" } - es.number.is-safe-integer { "ie":"10" } - es.number.max-safe-integer { "ie":"10" } - es.number.min-safe-integer { "ie":"10" } - es.number.parse-float { "ie":"10" } - es.number.parse-int { "ie":"10" } - es.number.to-fixed { "ie":"10" } - es.object.assign { "ie":"10" } - es.object.define-getter { "chrome":"54", "ie":"10", "node":"6.10" } - es.object.define-setter { "chrome":"54", "ie":"10", "node":"6.10" } - es.object.entries { "ie":"10", "node":"6.10" } - es.object.freeze { "ie":"10" } - es.object.from-entries { "chrome":"54", "ie":"10", "node":"6.10" } - es.object.get-own-property-descriptor { "ie":"10" } - es.object.get-own-property-descriptors { "ie":"10", "node":"6.10" } - es.object.get-own-property-names { "ie":"10" } - es.object.get-prototype-of { "ie":"10" } - es.object.is { "ie":"10" } - es.object.is-extensible { "ie":"10" } - es.object.is-frozen { "ie":"10" } - es.object.is-sealed { "ie":"10" } - es.object.keys { "ie":"10" } - es.object.lookup-getter { "chrome":"54", "ie":"10", "node":"6.10" } - es.object.lookup-setter { "chrome":"54", "ie":"10", "node":"6.10" } - es.object.prevent-extensions { "ie":"10" } - es.object.seal { "ie":"10" } - es.object.set-prototype-of { "ie":"10" } - es.object.to-string { "ie":"10" } - es.object.values { "ie":"10", "node":"6.10" } - es.promise { "chrome":"54", "ie":"10", "node":"6.10" } - es.promise.finally { "chrome":"54", "ie":"10", "node":"6.10" } - es.reflect.apply { "ie":"10" } - es.reflect.construct { "ie":"10" } - es.reflect.define-property { "ie":"10" } - es.reflect.delete-property { "ie":"10" } - es.reflect.get { "ie":"10" } - es.reflect.get-own-property-descriptor { "ie":"10" } - es.reflect.get-prototype-of { "ie":"10" } - es.reflect.has { "ie":"10" } - es.reflect.is-extensible { "ie":"10" } - es.reflect.own-keys { "ie":"10" } - es.reflect.prevent-extensions { "ie":"10" } - es.reflect.set { "ie":"10" } - es.reflect.set-prototype-of { "ie":"10" } - es.regexp.constructor { "ie":"10" } - es.regexp.flags { "ie":"10" } - es.regexp.to-string { "ie":"10" } - es.set { "ie":"10" } - es.string.code-point-at { "ie":"10" } - es.string.ends-with { "ie":"10" } - es.string.from-code-point { "ie":"10" } - es.string.includes { "ie":"10" } - es.string.iterator { "ie":"10" } - es.string.match { "ie":"10" } - es.string.match-all { "chrome":"54", "ie":"10", "node":"6.10" } - es.string.pad-end { "chrome":"54", "ie":"10", "node":"6.10" } - es.string.pad-start { "chrome":"54", "ie":"10", "node":"6.10" } - es.string.raw { "ie":"10" } - es.string.repeat { "ie":"10" } - es.string.replace { "chrome":"54", "ie":"10", "node":"6.10" } - es.string.search { "ie":"10" } - es.string.split { "ie":"10", "node":"6.10" } - es.string.starts-with { "ie":"10" } - es.string.trim { "chrome":"54", "ie":"10", "node":"6.10" } - es.string.trim-end { "chrome":"54", "ie":"10", "node":"6.10" } - es.string.trim-start { "chrome":"54", "ie":"10", "node":"6.10" } - es.string.anchor { "ie":"10" } - es.string.big { "ie":"10" } - es.string.blink { "ie":"10" } - es.string.bold { "ie":"10" } - es.string.fixed { "ie":"10" } - es.string.fontcolor { "ie":"10" } - es.string.fontsize { "ie":"10" } - es.string.italics { "ie":"10" } - es.string.link { "ie":"10" } - es.string.small { "ie":"10" } - es.string.strike { "ie":"10" } - es.string.sub { "ie":"10" } - es.string.sup { "ie":"10" } - es.typed-array.float32-array { "ie":"10", "node":"6.10" } - es.typed-array.float64-array { "ie":"10", "node":"6.10" } - es.typed-array.int8-array { "ie":"10", "node":"6.10" } - es.typed-array.int16-array { "ie":"10", "node":"6.10" } - es.typed-array.int32-array { "ie":"10", "node":"6.10" } - es.typed-array.uint8-array { "ie":"10", "node":"6.10" } - es.typed-array.uint8-clamped-array { "ie":"10", "node":"6.10" } - es.typed-array.uint16-array { "ie":"10", "node":"6.10" } - es.typed-array.uint32-array { "ie":"10", "node":"6.10" } - es.typed-array.copy-within { "ie":"10" } - es.typed-array.every { "ie":"10" } - es.typed-array.fill { "ie":"10" } - es.typed-array.filter { "ie":"10" } - es.typed-array.find { "ie":"10" } - es.typed-array.find-index { "ie":"10" } - es.typed-array.for-each { "ie":"10" } - es.typed-array.from { "ie":"10", "node":"6.10" } - es.typed-array.includes { "ie":"10" } - es.typed-array.index-of { "ie":"10" } - es.typed-array.iterator { "ie":"10" } - es.typed-array.join { "ie":"10" } - es.typed-array.last-index-of { "ie":"10" } - es.typed-array.map { "ie":"10" } - es.typed-array.of { "ie":"10", "node":"6.10" } - es.typed-array.reduce { "ie":"10" } - es.typed-array.reduce-right { "ie":"10" } - es.typed-array.reverse { "ie":"10" } - es.typed-array.set { "ie":"10" } - es.typed-array.slice { "ie":"10" } - es.typed-array.some { "ie":"10" } - es.typed-array.sort { "ie":"10" } - es.typed-array.subarray { "ie":"10" } - es.typed-array.to-locale-string { "ie":"10" } - es.typed-array.to-string { "ie":"10" } - es.weak-map { "ie":"10" } - es.weak-set { "ie":"10" } - web.dom-collections.for-each { "chrome":"54", "ie":"10" } - web.dom-collections.iterator { "chrome":"54", "ie":"10" } - web.immediate { "chrome":"54" } - web.queue-microtask { "chrome":"54", "ie":"10", "node":"6.10" } - web.url { "chrome":"54", "ie":"10", "node":"6.10" } - web.url.to-json { "chrome":"54", "ie":"10", "node":"6.10" } - web.url-search-params { "chrome":"54", "ie":"10", "node":"6.10" } -Successfully compiled 1 file with Babel. \ No newline at end of file diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-versions-strings/options.json b/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-versions-strings/options.json deleted file mode 100644 index 7cda7fb38c22..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-versions-strings/options.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "presets": [ - ["../../lib", { - "useBuiltIns": "entry", - "corejs": 3, - "debug": true, - "targets": { - "chrome": "54", - "node": "6.10", - "ie": "10" - } - }] - ] -} diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-versions-strings/stdout.txt b/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-versions-strings/stdout.txt deleted file mode 100644 index d51520a95c36..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-versions-strings/stdout.txt +++ /dev/null @@ -1,231 +0,0 @@ -@babel/preset-env: `DEBUG` option - -Using targets: -{ - "chrome": "54", - "ie": "10", - "node": "6.10" -} - -Using modules transform: auto - -Using plugins: - transform-template-literals { "ie":"10" } - transform-literals { "ie":"10" } - transform-function-name { "ie":"10" } - transform-arrow-functions { "ie":"10" } - transform-block-scoped-functions { "ie":"10" } - transform-classes { "ie":"10" } - transform-object-super { "ie":"10" } - transform-shorthand-properties { "ie":"10" } - transform-duplicate-keys { "ie":"10" } - transform-computed-properties { "ie":"10" } - transform-for-of { "ie":"10" } - transform-sticky-regex { "ie":"10" } - transform-dotall-regex { "chrome":"54", "ie":"10", "node":"6.10" } - transform-unicode-regex { "ie":"10" } - transform-spread { "ie":"10" } - transform-parameters { "ie":"10" } - transform-destructuring { "ie":"10" } - transform-block-scoping { "ie":"10" } - transform-typeof-symbol { "ie":"10" } - transform-new-target { "ie":"10" } - transform-regenerator { "ie":"10" } - transform-exponentiation-operator { "ie":"10", "node":"6.10" } - transform-async-to-generator { "chrome":"54", "ie":"10", "node":"6.10" } - proposal-async-generator-functions { "chrome":"54", "ie":"10", "node":"6.10" } - proposal-object-rest-spread { "chrome":"54", "ie":"10", "node":"6.10" } - proposal-unicode-property-regex { "chrome":"54", "ie":"10", "node":"6.10" } - proposal-json-strings { "chrome":"54", "ie":"10", "node":"6.10" } - proposal-optional-catch-binding { "chrome":"54", "ie":"10", "node":"6.10" } - transform-named-capturing-groups-regex { "chrome":"54", "ie":"10", "node":"6.10" } - -Using polyfills with `entry` option: - -[/src/in.js] Replaced core-js entries with the following polyfills: - es.symbol { "ie":"10" } - es.symbol.description { "chrome":"54", "ie":"10", "node":"6.10" } - es.symbol.async-iterator { "chrome":"54", "ie":"10", "node":"6.10" } - es.symbol.has-instance { "ie":"10" } - es.symbol.is-concat-spreadable { "ie":"10" } - es.symbol.iterator { "ie":"10" } - es.symbol.match { "ie":"10" } - es.symbol.replace { "ie":"10" } - es.symbol.search { "ie":"10" } - es.symbol.species { "ie":"10" } - es.symbol.split { "ie":"10" } - es.symbol.to-primitive { "ie":"10" } - es.symbol.to-string-tag { "ie":"10" } - es.symbol.unscopables { "ie":"10" } - es.array.concat { "ie":"10" } - es.array.copy-within { "ie":"10" } - es.array.fill { "ie":"10" } - es.array.filter { "ie":"10" } - es.array.find { "ie":"10" } - es.array.find-index { "ie":"10" } - es.array.flat { "chrome":"54", "ie":"10", "node":"6.10" } - es.array.flat-map { "chrome":"54", "ie":"10", "node":"6.10" } - es.array.from { "ie":"10" } - es.array.includes { "ie":"10", "node":"6.10" } - es.array.iterator { "chrome":"54", "ie":"10", "node":"6.10" } - es.array.join { "ie":"10" } - es.array.map { "ie":"10" } - es.array.of { "ie":"10" } - es.array.slice { "ie":"10" } - es.array.sort { "chrome":"54", "node":"6.10" } - es.array.species { "ie":"10" } - es.array.splice { "ie":"10" } - es.array.unscopables.flat { "chrome":"54", "ie":"10", "node":"6.10" } - es.array.unscopables.flat-map { "chrome":"54", "ie":"10", "node":"6.10" } - es.array-buffer.constructor { "ie":"10" } - es.array-buffer.is-view { "ie":"10" } - es.array-buffer.slice { "ie":"10" } - es.date.to-primitive { "ie":"10" } - es.function.has-instance { "ie":"10" } - es.function.name { "ie":"10" } - es.json.to-string-tag { "ie":"10" } - es.map { "ie":"10" } - es.math.acosh { "ie":"10", "node":"6.10" } - es.math.asinh { "ie":"10" } - es.math.atanh { "ie":"10" } - es.math.cbrt { "ie":"10" } - es.math.clz32 { "ie":"10" } - es.math.cosh { "ie":"10" } - es.math.expm1 { "ie":"10" } - es.math.fround { "ie":"10" } - es.math.hypot { "ie":"10" } - es.math.imul { "ie":"10" } - es.math.log10 { "ie":"10" } - es.math.log1p { "ie":"10" } - es.math.log2 { "ie":"10" } - es.math.sign { "ie":"10" } - es.math.sinh { "ie":"10" } - es.math.tanh { "ie":"10" } - es.math.to-string-tag { "ie":"10" } - es.math.trunc { "ie":"10" } - es.number.constructor { "ie":"10" } - es.number.epsilon { "ie":"10" } - es.number.is-finite { "ie":"10" } - es.number.is-integer { "ie":"10" } - es.number.is-nan { "ie":"10" } - es.number.is-safe-integer { "ie":"10" } - es.number.max-safe-integer { "ie":"10" } - es.number.min-safe-integer { "ie":"10" } - es.number.parse-float { "ie":"10" } - es.number.parse-int { "ie":"10" } - es.number.to-fixed { "ie":"10" } - es.object.assign { "ie":"10" } - es.object.define-getter { "chrome":"54", "ie":"10", "node":"6.10" } - es.object.define-setter { "chrome":"54", "ie":"10", "node":"6.10" } - es.object.entries { "ie":"10", "node":"6.10" } - es.object.freeze { "ie":"10" } - es.object.from-entries { "chrome":"54", "ie":"10", "node":"6.10" } - es.object.get-own-property-descriptor { "ie":"10" } - es.object.get-own-property-descriptors { "ie":"10", "node":"6.10" } - es.object.get-own-property-names { "ie":"10" } - es.object.get-prototype-of { "ie":"10" } - es.object.is { "ie":"10" } - es.object.is-extensible { "ie":"10" } - es.object.is-frozen { "ie":"10" } - es.object.is-sealed { "ie":"10" } - es.object.keys { "ie":"10" } - es.object.lookup-getter { "chrome":"54", "ie":"10", "node":"6.10" } - es.object.lookup-setter { "chrome":"54", "ie":"10", "node":"6.10" } - es.object.prevent-extensions { "ie":"10" } - es.object.seal { "ie":"10" } - es.object.set-prototype-of { "ie":"10" } - es.object.to-string { "ie":"10" } - es.object.values { "ie":"10", "node":"6.10" } - es.promise { "chrome":"54", "ie":"10", "node":"6.10" } - es.promise.finally { "chrome":"54", "ie":"10", "node":"6.10" } - es.reflect.apply { "ie":"10" } - es.reflect.construct { "ie":"10" } - es.reflect.define-property { "ie":"10" } - es.reflect.delete-property { "ie":"10" } - es.reflect.get { "ie":"10" } - es.reflect.get-own-property-descriptor { "ie":"10" } - es.reflect.get-prototype-of { "ie":"10" } - es.reflect.has { "ie":"10" } - es.reflect.is-extensible { "ie":"10" } - es.reflect.own-keys { "ie":"10" } - es.reflect.prevent-extensions { "ie":"10" } - es.reflect.set { "ie":"10" } - es.reflect.set-prototype-of { "ie":"10" } - es.regexp.constructor { "ie":"10" } - es.regexp.flags { "ie":"10" } - es.regexp.to-string { "ie":"10" } - es.set { "ie":"10" } - es.string.code-point-at { "ie":"10" } - es.string.ends-with { "ie":"10" } - es.string.from-code-point { "ie":"10" } - es.string.includes { "ie":"10" } - es.string.iterator { "ie":"10" } - es.string.match { "ie":"10" } - es.string.pad-end { "chrome":"54", "ie":"10", "node":"6.10" } - es.string.pad-start { "chrome":"54", "ie":"10", "node":"6.10" } - es.string.raw { "ie":"10" } - es.string.repeat { "ie":"10" } - es.string.replace { "chrome":"54", "ie":"10", "node":"6.10" } - es.string.search { "ie":"10" } - es.string.split { "ie":"10", "node":"6.10" } - es.string.starts-with { "ie":"10" } - es.string.trim { "chrome":"54", "ie":"10", "node":"6.10" } - es.string.trim-end { "chrome":"54", "ie":"10", "node":"6.10" } - es.string.trim-start { "chrome":"54", "ie":"10", "node":"6.10" } - es.string.anchor { "ie":"10" } - es.string.big { "ie":"10" } - es.string.blink { "ie":"10" } - es.string.bold { "ie":"10" } - es.string.fixed { "ie":"10" } - es.string.fontcolor { "ie":"10" } - es.string.fontsize { "ie":"10" } - es.string.italics { "ie":"10" } - es.string.link { "ie":"10" } - es.string.small { "ie":"10" } - es.string.strike { "ie":"10" } - es.string.sub { "ie":"10" } - es.string.sup { "ie":"10" } - es.typed-array.float32-array { "ie":"10", "node":"6.10" } - es.typed-array.float64-array { "ie":"10", "node":"6.10" } - es.typed-array.int8-array { "ie":"10", "node":"6.10" } - es.typed-array.int16-array { "ie":"10", "node":"6.10" } - es.typed-array.int32-array { "ie":"10", "node":"6.10" } - es.typed-array.uint8-array { "ie":"10", "node":"6.10" } - es.typed-array.uint8-clamped-array { "ie":"10", "node":"6.10" } - es.typed-array.uint16-array { "ie":"10", "node":"6.10" } - es.typed-array.uint32-array { "ie":"10", "node":"6.10" } - es.typed-array.copy-within { "ie":"10" } - es.typed-array.every { "ie":"10" } - es.typed-array.fill { "ie":"10" } - es.typed-array.filter { "ie":"10" } - es.typed-array.find { "ie":"10" } - es.typed-array.find-index { "ie":"10" } - es.typed-array.for-each { "ie":"10" } - es.typed-array.from { "ie":"10", "node":"6.10" } - es.typed-array.includes { "ie":"10" } - es.typed-array.index-of { "ie":"10" } - es.typed-array.iterator { "ie":"10" } - es.typed-array.join { "ie":"10" } - es.typed-array.last-index-of { "ie":"10" } - es.typed-array.map { "ie":"10" } - es.typed-array.of { "ie":"10", "node":"6.10" } - es.typed-array.reduce { "ie":"10" } - es.typed-array.reduce-right { "ie":"10" } - es.typed-array.reverse { "ie":"10" } - es.typed-array.set { "ie":"10" } - es.typed-array.slice { "ie":"10" } - es.typed-array.some { "ie":"10" } - es.typed-array.sort { "ie":"10" } - es.typed-array.subarray { "ie":"10" } - es.typed-array.to-locale-string { "ie":"10" } - es.typed-array.to-string { "ie":"10" } - es.weak-map { "ie":"10" } - es.weak-set { "ie":"10" } - web.dom-collections.for-each { "chrome":"54", "ie":"10" } - web.dom-collections.iterator { "chrome":"54", "ie":"10" } - web.immediate { "chrome":"54" } - web.queue-microtask { "chrome":"54", "ie":"10", "node":"6.10" } - web.url { "chrome":"54", "ie":"10", "node":"6.10" } - web.url.to-json { "chrome":"54", "ie":"10", "node":"6.10" } - web.url-search-params { "chrome":"54", "ie":"10", "node":"6.10" } -Successfully compiled 1 file with Babel. \ No newline at end of file diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-web-chrome-71/options.json b/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-web-chrome-71/options.json deleted file mode 100644 index b9db1e21e401..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-web-chrome-71/options.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "presets": [ - ["../../lib", { - "debug": true, - "targets": { - "browsers": "chrome 71" - }, - "shippedProposals": true, - "useBuiltIns": "entry", - "corejs": 3 - }] - ] -} diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-web-chrome-71/stdout.txt b/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-web-chrome-71/stdout.txt deleted file mode 100644 index 47e1b712c226..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-web-chrome-71/stdout.txt +++ /dev/null @@ -1,22 +0,0 @@ -@babel/preset-env: `DEBUG` option - -Using targets: -{ - "chrome": "71" -} - -Using modules transform: auto - -Using plugins: - syntax-async-generators { "chrome":"71" } - syntax-object-rest-spread { "chrome":"71" } - syntax-json-strings { "chrome":"71" } - syntax-optional-catch-binding { "chrome":"71" } - -Using polyfills with `entry` option: - -[/src/in.js] Replaced core-js entries with the following polyfill: - web.immediate { "chrome":"71" } - -[/src/in.js] Based on your targets, regenerator-runtime import excluded. -Successfully compiled 1 file with Babel. \ No newline at end of file diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-web/options.json b/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-web/options.json deleted file mode 100644 index 1e5ef9ed0a56..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-web/options.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "presets": [ - ["../../lib", { - "debug": true, - "shippedProposals": true, - "useBuiltIns": "entry", - "corejs": 3 - }] - ] -} diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-web/stdout.txt b/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-web/stdout.txt deleted file mode 100644 index 10497d8551ab..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-web/stdout.txt +++ /dev/null @@ -1,53 +0,0 @@ -@babel/preset-env: `DEBUG` option - -Using targets: -{} - -Using modules transform: auto - -Using plugins: - transform-template-literals {} - transform-literals {} - transform-function-name {} - transform-arrow-functions {} - transform-block-scoped-functions {} - transform-classes {} - transform-object-super {} - transform-shorthand-properties {} - transform-duplicate-keys {} - transform-computed-properties {} - transform-for-of {} - transform-sticky-regex {} - transform-dotall-regex {} - transform-unicode-regex {} - transform-spread {} - transform-parameters {} - transform-destructuring {} - transform-block-scoping {} - transform-typeof-symbol {} - transform-new-target {} - transform-regenerator {} - transform-exponentiation-operator {} - transform-async-to-generator {} - proposal-async-generator-functions {} - proposal-object-rest-spread {} - proposal-unicode-property-regex {} - proposal-json-strings {} - proposal-optional-catch-binding {} - transform-named-capturing-groups-regex {} - transform-member-expression-literals {} - transform-property-literals {} - transform-reserved-words {} - -Using polyfills with `entry` option: - -[/src/in.js] Replaced core-js entries with the following polyfills: - web.dom-collections.for-each {} - web.dom-collections.iterator {} - web.immediate {} - web.queue-microtask {} - web.timers {} - web.url {} - web.url.to-json {} - web.url-search-params {} -Successfully compiled 1 file with Babel. \ No newline at end of file diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3/options.json b/packages/babel-preset-env/test/debug-fixtures/entry-corejs3/options.json deleted file mode 100644 index d4af133772ff..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3/options.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "presets": [ - ["../../lib", { - "debug": true, - "targets": { - "browsers": "chrome >= 54, ie 10", - "node": 6 - }, - "useBuiltIns": "entry", - "corejs": 3 - }] - ] -} diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3/stdout.txt b/packages/babel-preset-env/test/debug-fixtures/entry-corejs3/stdout.txt deleted file mode 100644 index be4132d6b1f0..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3/stdout.txt +++ /dev/null @@ -1,233 +0,0 @@ -@babel/preset-env: `DEBUG` option - -Using targets: -{ - "chrome": "54", - "ie": "10", - "node": "6" -} - -Using modules transform: auto - -Using plugins: - transform-template-literals { "ie":"10" } - transform-literals { "ie":"10" } - transform-function-name { "ie":"10", "node":"6" } - transform-arrow-functions { "ie":"10" } - transform-block-scoped-functions { "ie":"10" } - transform-classes { "ie":"10" } - transform-object-super { "ie":"10" } - transform-shorthand-properties { "ie":"10" } - transform-duplicate-keys { "ie":"10" } - transform-computed-properties { "ie":"10" } - transform-for-of { "ie":"10", "node":"6" } - transform-sticky-regex { "ie":"10" } - transform-dotall-regex { "chrome":"54", "ie":"10", "node":"6" } - transform-unicode-regex { "ie":"10" } - transform-spread { "ie":"10" } - transform-parameters { "ie":"10" } - transform-destructuring { "ie":"10", "node":"6" } - transform-block-scoping { "ie":"10" } - transform-typeof-symbol { "ie":"10" } - transform-new-target { "ie":"10" } - transform-regenerator { "ie":"10" } - transform-exponentiation-operator { "ie":"10", "node":"6" } - transform-async-to-generator { "chrome":"54", "ie":"10", "node":"6" } - proposal-async-generator-functions { "chrome":"54", "ie":"10", "node":"6" } - proposal-object-rest-spread { "chrome":"54", "ie":"10", "node":"6" } - proposal-unicode-property-regex { "chrome":"54", "ie":"10", "node":"6" } - proposal-json-strings { "chrome":"54", "ie":"10", "node":"6" } - proposal-optional-catch-binding { "chrome":"54", "ie":"10", "node":"6" } - transform-named-capturing-groups-regex { "chrome":"54", "ie":"10", "node":"6" } - -Using polyfills with `entry` option: - -[/src/in.js] Replaced core-js entries with the following polyfills: - es.symbol { "ie":"10" } - es.symbol.description { "chrome":"54", "ie":"10", "node":"6" } - es.symbol.async-iterator { "chrome":"54", "ie":"10", "node":"6" } - es.symbol.has-instance { "ie":"10" } - es.symbol.is-concat-spreadable { "ie":"10" } - es.symbol.iterator { "ie":"10" } - es.symbol.match { "ie":"10" } - es.symbol.replace { "ie":"10" } - es.symbol.search { "ie":"10" } - es.symbol.species { "ie":"10", "node":"6" } - es.symbol.split { "ie":"10" } - es.symbol.to-primitive { "ie":"10" } - es.symbol.to-string-tag { "ie":"10" } - es.symbol.unscopables { "ie":"10" } - es.array.concat { "ie":"10", "node":"6" } - es.array.copy-within { "ie":"10" } - es.array.fill { "ie":"10" } - es.array.filter { "ie":"10", "node":"6" } - es.array.find { "ie":"10" } - es.array.find-index { "ie":"10" } - es.array.flat { "chrome":"54", "ie":"10", "node":"6" } - es.array.flat-map { "chrome":"54", "ie":"10", "node":"6" } - es.array.from { "ie":"10", "node":"6" } - es.array.includes { "ie":"10", "node":"6" } - es.array.index-of { "node":"6" } - es.array.iterator { "chrome":"54", "ie":"10", "node":"6" } - es.array.join { "ie":"10" } - es.array.last-index-of { "node":"6" } - es.array.map { "ie":"10", "node":"6" } - es.array.of { "ie":"10" } - es.array.slice { "ie":"10", "node":"6" } - es.array.sort { "chrome":"54", "node":"6" } - es.array.species { "ie":"10", "node":"6" } - es.array.splice { "ie":"10", "node":"6" } - es.array.unscopables.flat { "chrome":"54", "ie":"10", "node":"6" } - es.array.unscopables.flat-map { "chrome":"54", "ie":"10", "node":"6" } - es.array-buffer.constructor { "ie":"10" } - es.array-buffer.is-view { "ie":"10" } - es.array-buffer.slice { "ie":"10" } - es.date.to-primitive { "ie":"10" } - es.function.has-instance { "ie":"10", "node":"6" } - es.function.name { "ie":"10" } - es.json.to-string-tag { "ie":"10" } - es.map { "ie":"10", "node":"6" } - es.math.acosh { "ie":"10", "node":"6" } - es.math.asinh { "ie":"10" } - es.math.atanh { "ie":"10" } - es.math.cbrt { "ie":"10" } - es.math.clz32 { "ie":"10" } - es.math.cosh { "ie":"10" } - es.math.expm1 { "ie":"10" } - es.math.fround { "ie":"10" } - es.math.hypot { "ie":"10" } - es.math.imul { "ie":"10" } - es.math.log10 { "ie":"10" } - es.math.log1p { "ie":"10" } - es.math.log2 { "ie":"10" } - es.math.sign { "ie":"10" } - es.math.sinh { "ie":"10" } - es.math.tanh { "ie":"10" } - es.math.to-string-tag { "ie":"10" } - es.math.trunc { "ie":"10" } - es.number.constructor { "ie":"10" } - es.number.epsilon { "ie":"10" } - es.number.is-finite { "ie":"10" } - es.number.is-integer { "ie":"10" } - es.number.is-nan { "ie":"10" } - es.number.is-safe-integer { "ie":"10" } - es.number.max-safe-integer { "ie":"10" } - es.number.min-safe-integer { "ie":"10" } - es.number.parse-float { "ie":"10" } - es.number.parse-int { "ie":"10" } - es.number.to-fixed { "ie":"10" } - es.object.assign { "ie":"10" } - es.object.define-getter { "chrome":"54", "ie":"10", "node":"6" } - es.object.define-setter { "chrome":"54", "ie":"10", "node":"6" } - es.object.entries { "ie":"10", "node":"6" } - es.object.freeze { "ie":"10" } - es.object.from-entries { "chrome":"54", "ie":"10", "node":"6" } - es.object.get-own-property-descriptor { "ie":"10" } - es.object.get-own-property-descriptors { "ie":"10", "node":"6" } - es.object.get-own-property-names { "ie":"10" } - es.object.get-prototype-of { "ie":"10" } - es.object.is { "ie":"10" } - es.object.is-extensible { "ie":"10" } - es.object.is-frozen { "ie":"10" } - es.object.is-sealed { "ie":"10" } - es.object.keys { "ie":"10" } - es.object.lookup-getter { "chrome":"54", "ie":"10", "node":"6" } - es.object.lookup-setter { "chrome":"54", "ie":"10", "node":"6" } - es.object.prevent-extensions { "ie":"10" } - es.object.seal { "ie":"10" } - es.object.set-prototype-of { "ie":"10" } - es.object.to-string { "ie":"10" } - es.object.values { "ie":"10", "node":"6" } - es.promise { "chrome":"54", "ie":"10", "node":"6" } - es.promise.finally { "chrome":"54", "ie":"10", "node":"6" } - es.reflect.apply { "ie":"10" } - es.reflect.construct { "ie":"10" } - es.reflect.define-property { "ie":"10" } - es.reflect.delete-property { "ie":"10" } - es.reflect.get { "ie":"10" } - es.reflect.get-own-property-descriptor { "ie":"10" } - es.reflect.get-prototype-of { "ie":"10" } - es.reflect.has { "ie":"10" } - es.reflect.is-extensible { "ie":"10" } - es.reflect.own-keys { "ie":"10" } - es.reflect.prevent-extensions { "ie":"10" } - es.reflect.set { "ie":"10" } - es.reflect.set-prototype-of { "ie":"10" } - es.regexp.constructor { "ie":"10", "node":"6" } - es.regexp.flags { "ie":"10" } - es.regexp.to-string { "ie":"10" } - es.set { "ie":"10", "node":"6" } - es.string.code-point-at { "ie":"10" } - es.string.ends-with { "ie":"10", "node":"6" } - es.string.from-code-point { "ie":"10" } - es.string.includes { "ie":"10", "node":"6" } - es.string.iterator { "ie":"10" } - es.string.match { "ie":"10", "node":"6" } - es.string.pad-end { "chrome":"54", "ie":"10", "node":"6" } - es.string.pad-start { "chrome":"54", "ie":"10", "node":"6" } - es.string.raw { "ie":"10" } - es.string.repeat { "ie":"10" } - es.string.replace { "chrome":"54", "ie":"10", "node":"6" } - es.string.search { "ie":"10", "node":"6" } - es.string.split { "ie":"10", "node":"6" } - es.string.starts-with { "ie":"10", "node":"6" } - es.string.trim { "chrome":"54", "ie":"10", "node":"6" } - es.string.trim-end { "chrome":"54", "ie":"10", "node":"6" } - es.string.trim-start { "chrome":"54", "ie":"10", "node":"6" } - es.string.anchor { "ie":"10" } - es.string.big { "ie":"10" } - es.string.blink { "ie":"10" } - es.string.bold { "ie":"10" } - es.string.fixed { "ie":"10" } - es.string.fontcolor { "ie":"10" } - es.string.fontsize { "ie":"10" } - es.string.italics { "ie":"10" } - es.string.link { "ie":"10" } - es.string.small { "ie":"10" } - es.string.strike { "ie":"10" } - es.string.sub { "ie":"10" } - es.string.sup { "ie":"10" } - es.typed-array.float32-array { "ie":"10", "node":"6" } - es.typed-array.float64-array { "ie":"10", "node":"6" } - es.typed-array.int8-array { "ie":"10", "node":"6" } - es.typed-array.int16-array { "ie":"10", "node":"6" } - es.typed-array.int32-array { "ie":"10", "node":"6" } - es.typed-array.uint8-array { "ie":"10", "node":"6" } - es.typed-array.uint8-clamped-array { "ie":"10", "node":"6" } - es.typed-array.uint16-array { "ie":"10", "node":"6" } - es.typed-array.uint32-array { "ie":"10", "node":"6" } - es.typed-array.copy-within { "ie":"10" } - es.typed-array.every { "ie":"10" } - es.typed-array.fill { "ie":"10" } - es.typed-array.filter { "ie":"10" } - es.typed-array.find { "ie":"10" } - es.typed-array.find-index { "ie":"10" } - es.typed-array.for-each { "ie":"10" } - es.typed-array.from { "ie":"10", "node":"6" } - es.typed-array.includes { "ie":"10" } - es.typed-array.index-of { "ie":"10" } - es.typed-array.iterator { "ie":"10" } - es.typed-array.join { "ie":"10" } - es.typed-array.last-index-of { "ie":"10" } - es.typed-array.map { "ie":"10" } - es.typed-array.of { "ie":"10", "node":"6" } - es.typed-array.reduce { "ie":"10" } - es.typed-array.reduce-right { "ie":"10" } - es.typed-array.reverse { "ie":"10" } - es.typed-array.set { "ie":"10" } - es.typed-array.slice { "ie":"10" } - es.typed-array.some { "ie":"10" } - es.typed-array.sort { "ie":"10" } - es.typed-array.subarray { "ie":"10" } - es.typed-array.to-locale-string { "ie":"10" } - es.typed-array.to-string { "ie":"10", "node":"6" } - es.weak-map { "ie":"10", "node":"6" } - es.weak-set { "ie":"10", "node":"6" } - web.dom-collections.for-each { "chrome":"54", "ie":"10" } - web.dom-collections.iterator { "chrome":"54", "ie":"10" } - web.immediate { "chrome":"54" } - web.queue-microtask { "chrome":"54", "ie":"10", "node":"6" } - web.url { "chrome":"54", "ie":"10", "node":"6" } - web.url.to-json { "chrome":"54", "ie":"10", "node":"6" } - web.url-search-params { "chrome":"54", "ie":"10", "node":"6" } -Successfully compiled 1 file with Babel. \ No newline at end of file diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-no-corejs-no-import/options.json b/packages/babel-preset-env/test/debug-fixtures/entry-no-corejs-no-import/options.json deleted file mode 100644 index c852ad03f690..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-no-corejs-no-import/options.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "presets": [ - ["../../lib", { - "debug": true, - "targets": { - "node": 6 - }, - "useBuiltIns": "entry" - }] - ] -} diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-no-corejs-no-import/stdout.txt b/packages/babel-preset-env/test/debug-fixtures/entry-no-corejs-no-import/stdout.txt deleted file mode 100644 index ac37a584bfdf..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-no-corejs-no-import/stdout.txt +++ /dev/null @@ -1,27 +0,0 @@ -@babel/preset-env: `DEBUG` option - -Using targets: -{ - "node": "6" -} - -Using modules transform: auto - -Using plugins: - transform-function-name { "node":"6" } - transform-for-of { "node":"6" } - transform-dotall-regex { "node":"6" } - transform-destructuring { "node":"6" } - transform-exponentiation-operator { "node":"6" } - transform-async-to-generator { "node":"6" } - proposal-async-generator-functions { "node":"6" } - proposal-object-rest-spread { "node":"6" } - proposal-unicode-property-regex { "node":"6" } - proposal-json-strings { "node":"6" } - proposal-optional-catch-binding { "node":"6" } - transform-named-capturing-groups-regex { "node":"6" } - -Using polyfills with `entry` option: - -[/src/in.js] Import of @babel/polyfill was not found. -Successfully compiled 1 file with Babel. \ No newline at end of file diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-no-corejs-shippedProposals/options.json b/packages/babel-preset-env/test/debug-fixtures/entry-no-corejs-shippedProposals/options.json deleted file mode 100644 index 40884decf8fd..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-no-corejs-shippedProposals/options.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "presets": [ - ["../../lib", { - "debug": true, - "shippedProposals": true, - "useBuiltIns": "entry" - }] - ] -} diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-no-corejs-shippedProposals/stdout.txt b/packages/babel-preset-env/test/debug-fixtures/entry-no-corejs-shippedProposals/stdout.txt deleted file mode 100644 index 04e8ce0e5829..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-no-corejs-shippedProposals/stdout.txt +++ /dev/null @@ -1,193 +0,0 @@ -@babel/preset-env: `DEBUG` option - -Using targets: -{} - -Using modules transform: auto - -Using plugins: - transform-template-literals {} - transform-literals {} - transform-function-name {} - transform-arrow-functions {} - transform-block-scoped-functions {} - transform-classes {} - transform-object-super {} - transform-shorthand-properties {} - transform-duplicate-keys {} - transform-computed-properties {} - transform-for-of {} - transform-sticky-regex {} - transform-dotall-regex {} - transform-unicode-regex {} - transform-spread {} - transform-parameters {} - transform-destructuring {} - transform-block-scoping {} - transform-typeof-symbol {} - transform-new-target {} - transform-regenerator {} - transform-exponentiation-operator {} - transform-async-to-generator {} - proposal-async-generator-functions {} - proposal-object-rest-spread {} - proposal-unicode-property-regex {} - proposal-json-strings {} - proposal-optional-catch-binding {} - transform-named-capturing-groups-regex {} - transform-member-expression-literals {} - transform-property-literals {} - transform-reserved-words {} - -Using polyfills with `entry` option: - -[/src/in.js] Replaced @babel/polyfill entries with the following polyfills: - es6.array.copy-within {} - es6.array.every {} - es6.array.fill {} - es6.array.filter {} - es6.array.find {} - es6.array.find-index {} - es7.array.flat-map {} - es6.array.for-each {} - es6.array.from {} - es7.array.includes {} - es6.array.index-of {} - es6.array.is-array {} - es6.array.iterator {} - es6.array.last-index-of {} - es6.array.map {} - es6.array.of {} - es6.array.reduce {} - es6.array.reduce-right {} - es6.array.some {} - es6.array.sort {} - es6.array.species {} - es6.date.now {} - es6.date.to-iso-string {} - es6.date.to-json {} - es6.date.to-primitive {} - es6.date.to-string {} - es6.function.bind {} - es6.function.has-instance {} - es6.function.name {} - es6.map {} - es6.math.acosh {} - es6.math.asinh {} - es6.math.atanh {} - es6.math.cbrt {} - es6.math.clz32 {} - es6.math.cosh {} - es6.math.expm1 {} - es6.math.fround {} - es6.math.hypot {} - es6.math.imul {} - es6.math.log1p {} - es6.math.log10 {} - es6.math.log2 {} - es6.math.sign {} - es6.math.sinh {} - es6.math.tanh {} - es6.math.trunc {} - es6.number.constructor {} - es6.number.epsilon {} - es6.number.is-finite {} - es6.number.is-integer {} - es6.number.is-nan {} - es6.number.is-safe-integer {} - es6.number.max-safe-integer {} - es6.number.min-safe-integer {} - es6.number.parse-float {} - es6.number.parse-int {} - es6.object.assign {} - es6.object.create {} - es7.object.define-getter {} - es7.object.define-setter {} - es6.object.define-property {} - es6.object.define-properties {} - es7.object.entries {} - es6.object.freeze {} - es6.object.get-own-property-descriptor {} - es7.object.get-own-property-descriptors {} - es6.object.get-own-property-names {} - es6.object.get-prototype-of {} - es7.object.lookup-getter {} - es7.object.lookup-setter {} - es6.object.prevent-extensions {} - es6.object.to-string {} - es6.object.is {} - es6.object.is-frozen {} - es6.object.is-sealed {} - es6.object.is-extensible {} - es6.object.keys {} - es6.object.seal {} - es6.object.set-prototype-of {} - es7.object.values {} - es6.promise {} - es7.promise.finally {} - es6.reflect.apply {} - es6.reflect.construct {} - es6.reflect.define-property {} - es6.reflect.delete-property {} - es6.reflect.get {} - es6.reflect.get-own-property-descriptor {} - es6.reflect.get-prototype-of {} - es6.reflect.has {} - es6.reflect.is-extensible {} - es6.reflect.own-keys {} - es6.reflect.prevent-extensions {} - es6.reflect.set {} - es6.reflect.set-prototype-of {} - es6.regexp.constructor {} - es6.regexp.flags {} - es6.regexp.match {} - es6.regexp.replace {} - es6.regexp.split {} - es6.regexp.search {} - es6.regexp.to-string {} - es6.set {} - es6.symbol {} - es7.symbol.async-iterator {} - es6.string.anchor {} - es6.string.big {} - es6.string.blink {} - es6.string.bold {} - es6.string.code-point-at {} - es6.string.ends-with {} - es6.string.fixed {} - es6.string.fontcolor {} - es6.string.fontsize {} - es6.string.from-code-point {} - es6.string.includes {} - es6.string.italics {} - es6.string.iterator {} - es6.string.link {} - es7.string.pad-start {} - es7.string.pad-end {} - es6.string.raw {} - es6.string.repeat {} - es6.string.small {} - es6.string.starts-with {} - es6.string.strike {} - es6.string.sub {} - es6.string.sup {} - es6.string.trim {} - es7.string.trim-left {} - es7.string.trim-right {} - es6.typed.array-buffer {} - es6.typed.data-view {} - es6.typed.int8-array {} - es6.typed.uint8-array {} - es6.typed.uint8-clamped-array {} - es6.typed.int16-array {} - es6.typed.uint16-array {} - es6.typed.int32-array {} - es6.typed.uint32-array {} - es6.typed.float32-array {} - es6.typed.float64-array {} - es6.weak-map {} - es6.weak-set {} - web.timers {} - web.immediate {} - web.dom.iterable {} -Successfully compiled 1 file with Babel. \ No newline at end of file diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-no-corejs-uglify/options.json b/packages/babel-preset-env/test/debug-fixtures/entry-no-corejs-uglify/options.json deleted file mode 100644 index 99859f1e9d1c..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-no-corejs-uglify/options.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "presets": [ - ["../../lib", { - "debug": true, - "targets": { - "chrome": 55, - "uglify": true - }, - "useBuiltIns": "entry", - "modules": false - }] - ] -} diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-no-corejs-uglify/stdout.txt b/packages/babel-preset-env/test/debug-fixtures/entry-no-corejs-uglify/stdout.txt deleted file mode 100644 index 2a97e7973107..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-no-corejs-uglify/stdout.txt +++ /dev/null @@ -1,66 +0,0 @@ -The uglify target has been deprecated. Set the top level -option `forceAllTransforms: true` instead. - -@babel/preset-env: `DEBUG` option - -Using targets: -{ - "chrome": "55" -} - -Using modules transform: false - -Using plugins: - transform-template-literals {} - transform-literals {} - transform-function-name {} - transform-arrow-functions {} - transform-block-scoped-functions {} - transform-classes {} - transform-object-super {} - transform-shorthand-properties {} - transform-duplicate-keys {} - transform-computed-properties {} - transform-for-of {} - transform-sticky-regex {} - transform-dotall-regex { "chrome":"55" } - transform-unicode-regex {} - transform-spread {} - transform-parameters {} - transform-destructuring {} - transform-block-scoping {} - transform-typeof-symbol {} - transform-new-target {} - transform-regenerator {} - transform-exponentiation-operator {} - transform-async-to-generator {} - proposal-async-generator-functions { "chrome":"55" } - proposal-object-rest-spread { "chrome":"55" } - proposal-unicode-property-regex { "chrome":"55" } - proposal-json-strings { "chrome":"55" } - proposal-optional-catch-binding { "chrome":"55" } - transform-named-capturing-groups-regex { "chrome":"55" } - transform-member-expression-literals {} - transform-property-literals {} - transform-reserved-words {} - -Using polyfills with `entry` option: - -[/src/in.js] Replaced @babel/polyfill entries with the following polyfills: - es7.array.flat-map { "chrome":"55" } - es6.array.sort { "chrome":"55" } - es7.object.define-getter { "chrome":"55" } - es7.object.define-setter { "chrome":"55" } - es7.object.lookup-getter { "chrome":"55" } - es7.object.lookup-setter { "chrome":"55" } - es6.object.to-string { "chrome":"55" } - es7.promise.finally { "chrome":"55" } - es7.symbol.async-iterator { "chrome":"55" } - es7.string.pad-start { "chrome":"55" } - es7.string.pad-end { "chrome":"55" } - es7.string.trim-left { "chrome":"55" } - es7.string.trim-right { "chrome":"55" } - web.timers { "chrome":"55" } - web.immediate { "chrome":"55" } - web.dom.iterable { "chrome":"55" } -Successfully compiled 1 file with Babel. \ No newline at end of file diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-no-corejs/options.json b/packages/babel-preset-env/test/debug-fixtures/entry-no-corejs/options.json deleted file mode 100644 index 8a1de9062d64..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-no-corejs/options.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "presets": [ - ["../../lib", { - "debug": true, - "targets": { - "browsers": "chrome >= 54, ie 10", - "node": 6 - }, - "useBuiltIns": "entry" - }] - ] -} diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-no-corejs/stdout.txt b/packages/babel-preset-env/test/debug-fixtures/entry-no-corejs/stdout.txt deleted file mode 100644 index 943bad68b9b1..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-no-corejs/stdout.txt +++ /dev/null @@ -1,174 +0,0 @@ -@babel/preset-env: `DEBUG` option - -Using targets: -{ - "chrome": "54", - "ie": "10", - "node": "6" -} - -Using modules transform: auto - -Using plugins: - transform-template-literals { "ie":"10" } - transform-literals { "ie":"10" } - transform-function-name { "ie":"10", "node":"6" } - transform-arrow-functions { "ie":"10" } - transform-block-scoped-functions { "ie":"10" } - transform-classes { "ie":"10" } - transform-object-super { "ie":"10" } - transform-shorthand-properties { "ie":"10" } - transform-duplicate-keys { "ie":"10" } - transform-computed-properties { "ie":"10" } - transform-for-of { "ie":"10", "node":"6" } - transform-sticky-regex { "ie":"10" } - transform-dotall-regex { "chrome":"54", "ie":"10", "node":"6" } - transform-unicode-regex { "ie":"10" } - transform-spread { "ie":"10" } - transform-parameters { "ie":"10" } - transform-destructuring { "ie":"10", "node":"6" } - transform-block-scoping { "ie":"10" } - transform-typeof-symbol { "ie":"10" } - transform-new-target { "ie":"10" } - transform-regenerator { "ie":"10" } - transform-exponentiation-operator { "ie":"10", "node":"6" } - transform-async-to-generator { "chrome":"54", "ie":"10", "node":"6" } - proposal-async-generator-functions { "chrome":"54", "ie":"10", "node":"6" } - proposal-object-rest-spread { "chrome":"54", "ie":"10", "node":"6" } - proposal-unicode-property-regex { "chrome":"54", "ie":"10", "node":"6" } - proposal-json-strings { "chrome":"54", "ie":"10", "node":"6" } - proposal-optional-catch-binding { "chrome":"54", "ie":"10", "node":"6" } - transform-named-capturing-groups-regex { "chrome":"54", "ie":"10", "node":"6" } - -Using polyfills with `entry` option: - -[/src/in.js] Replaced @babel/polyfill entries with the following polyfills: - es6.array.copy-within { "ie":"10" } - es6.array.fill { "ie":"10" } - es6.array.find { "ie":"10" } - es6.array.find-index { "ie":"10" } - es7.array.flat-map { "chrome":"54", "ie":"10", "node":"6" } - es6.array.from { "ie":"10", "node":"6" } - es7.array.includes { "ie":"10" } - es6.array.iterator { "ie":"10" } - es6.array.of { "ie":"10" } - es6.array.sort { "chrome":"54", "node":"6" } - es6.array.species { "ie":"10", "node":"6" } - es6.date.to-primitive { "ie":"10" } - es6.function.has-instance { "ie":"10", "node":"6" } - es6.function.name { "ie":"10" } - es6.map { "ie":"10", "node":"6" } - es6.math.acosh { "ie":"10" } - es6.math.asinh { "ie":"10" } - es6.math.atanh { "ie":"10" } - es6.math.cbrt { "ie":"10" } - es6.math.clz32 { "ie":"10" } - es6.math.cosh { "ie":"10" } - es6.math.expm1 { "ie":"10" } - es6.math.fround { "ie":"10" } - es6.math.hypot { "ie":"10" } - es6.math.imul { "ie":"10" } - es6.math.log1p { "ie":"10" } - es6.math.log10 { "ie":"10" } - es6.math.log2 { "ie":"10" } - es6.math.sign { "ie":"10" } - es6.math.sinh { "ie":"10" } - es6.math.tanh { "ie":"10" } - es6.math.trunc { "ie":"10" } - es6.number.constructor { "ie":"10" } - es6.number.epsilon { "ie":"10" } - es6.number.is-finite { "ie":"10" } - es6.number.is-integer { "ie":"10" } - es6.number.is-nan { "ie":"10" } - es6.number.is-safe-integer { "ie":"10" } - es6.number.max-safe-integer { "ie":"10" } - es6.number.min-safe-integer { "ie":"10" } - es6.number.parse-float { "ie":"10" } - es6.number.parse-int { "ie":"10" } - es6.object.assign { "ie":"10" } - es7.object.define-getter { "chrome":"54", "ie":"10", "node":"6" } - es7.object.define-setter { "chrome":"54", "ie":"10", "node":"6" } - es7.object.entries { "ie":"10", "node":"6" } - es6.object.freeze { "ie":"10" } - es6.object.get-own-property-descriptor { "ie":"10" } - es7.object.get-own-property-descriptors { "ie":"10", "node":"6" } - es6.object.get-own-property-names { "ie":"10" } - es6.object.get-prototype-of { "ie":"10" } - es7.object.lookup-getter { "chrome":"54", "ie":"10", "node":"6" } - es7.object.lookup-setter { "chrome":"54", "ie":"10", "node":"6" } - es6.object.prevent-extensions { "ie":"10" } - es6.object.to-string { "chrome":"54", "ie":"10", "node":"6" } - es6.object.is { "ie":"10" } - es6.object.is-frozen { "ie":"10" } - es6.object.is-sealed { "ie":"10" } - es6.object.is-extensible { "ie":"10" } - es6.object.keys { "ie":"10" } - es6.object.seal { "ie":"10" } - es6.object.set-prototype-of { "ie":"10" } - es7.object.values { "ie":"10", "node":"6" } - es6.promise { "ie":"10", "node":"6" } - es7.promise.finally { "chrome":"54", "ie":"10", "node":"6" } - es6.reflect.apply { "ie":"10" } - es6.reflect.construct { "ie":"10" } - es6.reflect.define-property { "ie":"10" } - es6.reflect.delete-property { "ie":"10" } - es6.reflect.get { "ie":"10" } - es6.reflect.get-own-property-descriptor { "ie":"10" } - es6.reflect.get-prototype-of { "ie":"10" } - es6.reflect.has { "ie":"10" } - es6.reflect.is-extensible { "ie":"10" } - es6.reflect.own-keys { "ie":"10" } - es6.reflect.prevent-extensions { "ie":"10" } - es6.reflect.set { "ie":"10" } - es6.reflect.set-prototype-of { "ie":"10" } - es6.regexp.constructor { "ie":"10" } - es6.regexp.flags { "ie":"10" } - es6.regexp.match { "ie":"10" } - es6.regexp.replace { "ie":"10" } - es6.regexp.split { "ie":"10" } - es6.regexp.search { "ie":"10" } - es6.regexp.to-string { "ie":"10" } - es6.set { "ie":"10", "node":"6" } - es6.symbol { "ie":"10", "node":"6" } - es7.symbol.async-iterator { "chrome":"54", "ie":"10", "node":"6" } - es6.string.anchor { "ie":"10" } - es6.string.big { "ie":"10" } - es6.string.blink { "ie":"10" } - es6.string.bold { "ie":"10" } - es6.string.code-point-at { "ie":"10" } - es6.string.ends-with { "ie":"10" } - es6.string.fixed { "ie":"10" } - es6.string.fontcolor { "ie":"10" } - es6.string.fontsize { "ie":"10" } - es6.string.from-code-point { "ie":"10" } - es6.string.includes { "ie":"10" } - es6.string.italics { "ie":"10" } - es6.string.iterator { "ie":"10" } - es6.string.link { "ie":"10" } - es7.string.pad-start { "chrome":"54", "ie":"10", "node":"6" } - es7.string.pad-end { "chrome":"54", "ie":"10", "node":"6" } - es6.string.raw { "ie":"10" } - es6.string.repeat { "ie":"10" } - es6.string.small { "ie":"10" } - es6.string.starts-with { "ie":"10" } - es6.string.strike { "ie":"10" } - es6.string.sub { "ie":"10" } - es6.string.sup { "ie":"10" } - es7.string.trim-left { "chrome":"54", "ie":"10", "node":"6" } - es7.string.trim-right { "chrome":"54", "ie":"10", "node":"6" } - es6.typed.array-buffer { "ie":"10", "node":"6" } - es6.typed.int8-array { "ie":"10", "node":"6" } - es6.typed.uint8-array { "ie":"10", "node":"6" } - es6.typed.uint8-clamped-array { "ie":"10", "node":"6" } - es6.typed.int16-array { "ie":"10", "node":"6" } - es6.typed.uint16-array { "ie":"10", "node":"6" } - es6.typed.int32-array { "ie":"10", "node":"6" } - es6.typed.uint32-array { "ie":"10", "node":"6" } - es6.typed.float32-array { "ie":"10", "node":"6" } - es6.typed.float64-array { "ie":"10", "node":"6" } - es6.weak-map { "ie":"10", "node":"6" } - es6.weak-set { "ie":"10", "node":"6" } - web.timers { "chrome":"54", "ie":"10", "node":"6" } - web.immediate { "chrome":"54", "ie":"10", "node":"6" } - web.dom.iterable { "chrome":"54", "ie":"10", "node":"6" } -Successfully compiled 1 file with Babel. \ No newline at end of file diff --git a/packages/babel-preset-env/test/debug-fixtures/plugins-only/options.json b/packages/babel-preset-env/test/debug-fixtures/plugins-only/options.json deleted file mode 100644 index ec9d6a4e722a..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/plugins-only/options.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "presets": [ - ["../../lib", { - "debug": true, - "exclude": [ - "transform-async-to-generator", - "transform-regenerator", - "transform-parameters" - ], - "targets": { - "firefox": 52, - "node": 7.4 - }, - "useBuiltIns": false - }] - ] -} diff --git a/packages/babel-preset-env/test/debug-fixtures/plugins-only/stdout.txt b/packages/babel-preset-env/test/debug-fixtures/plugins-only/stdout.txt deleted file mode 100644 index b9408aae4462..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/plugins-only/stdout.txt +++ /dev/null @@ -1,32 +0,0 @@ -Warning, the following targets are using a decimal version: - - node: 7.4 - -We recommend using a string for minor/patch versions to avoid numbers like 6.10 -getting parsed as 6.1, which can lead to unexpected behavior. - -@babel/preset-env: `DEBUG` option - -Using targets: -{ - "firefox": "52", - "node": "7.4" -} - -Using modules transform: auto - -Using plugins: - transform-literals { "firefox":"52" } - transform-function-name { "firefox":"52" } - transform-for-of { "firefox":"52" } - transform-dotall-regex { "firefox":"52", "node":"7.4" } - transform-destructuring { "firefox":"52" } - proposal-async-generator-functions { "firefox":"52", "node":"7.4" } - proposal-object-rest-spread { "firefox":"52", "node":"7.4" } - proposal-unicode-property-regex { "firefox":"52", "node":"7.4" } - proposal-json-strings { "firefox":"52", "node":"7.4" } - proposal-optional-catch-binding { "firefox":"52", "node":"7.4" } - transform-named-capturing-groups-regex { "firefox":"52", "node":"7.4" } - -Using polyfills: No polyfills were added, since the `useBuiltIns` option was not set. -Successfully compiled 1 file with Babel. \ No newline at end of file diff --git a/packages/babel-preset-env/test/debug-fixtures/usage-corejs2-chrome-71/options.json b/packages/babel-preset-env/test/debug-fixtures/usage-corejs2-chrome-71/options.json deleted file mode 100644 index b2ed793a3530..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/usage-corejs2-chrome-71/options.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "presets": [ - ["../../lib", { - "debug": true, - "targets": { - "chrome": 71 - }, - "useBuiltIns": "usage", - "corejs": 2 - }] - ] -} diff --git a/packages/babel-preset-env/test/debug-fixtures/usage-corejs2-chrome-71/stdout.txt b/packages/babel-preset-env/test/debug-fixtures/usage-corejs2-chrome-71/stdout.txt deleted file mode 100644 index b3df5f0872ba..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/usage-corejs2-chrome-71/stdout.txt +++ /dev/null @@ -1,23 +0,0 @@ -@babel/preset-env: `DEBUG` option - -Using targets: -{ - "chrome": "71" -} - -Using modules transform: auto - -Using plugins: - syntax-async-generators { "chrome":"71" } - syntax-object-rest-spread { "chrome":"71" } - syntax-json-strings { "chrome":"71" } - syntax-optional-catch-binding { "chrome":"71" } - -Using polyfills with `usage` option: - -[/src/in.js] Added following core-js polyfill: - web.dom.iterable { "chrome":"71" } - -[/src/in2.js] Added following core-js polyfill: - web.dom.iterable { "chrome":"71" } -Successfully compiled 2 files with Babel. \ No newline at end of file diff --git a/packages/babel-preset-env/test/debug-fixtures/usage-corejs2-none/options.json b/packages/babel-preset-env/test/debug-fixtures/usage-corejs2-none/options.json deleted file mode 100644 index 087a0efc9f65..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/usage-corejs2-none/options.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "presets": [ - ["../../lib", { - "debug": true, - "targets": { - "chrome": 52, - "firefox": 50, - "ie": 11 - }, - "useBuiltIns": "usage", - "corejs": 2 - }] - ] -} diff --git a/packages/babel-preset-env/test/debug-fixtures/usage-corejs2-none/stdout.txt b/packages/babel-preset-env/test/debug-fixtures/usage-corejs2-none/stdout.txt deleted file mode 100644 index fafdcfca187c..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/usage-corejs2-none/stdout.txt +++ /dev/null @@ -1,47 +0,0 @@ -@babel/preset-env: `DEBUG` option - -Using targets: -{ - "chrome": "52", - "firefox": "50", - "ie": "11" -} - -Using modules transform: auto - -Using plugins: - transform-template-literals { "ie":"11" } - transform-literals { "firefox":"50", "ie":"11" } - transform-function-name { "firefox":"50", "ie":"11" } - transform-arrow-functions { "ie":"11" } - transform-classes { "ie":"11" } - transform-object-super { "ie":"11" } - transform-shorthand-properties { "ie":"11" } - transform-duplicate-keys { "ie":"11" } - transform-computed-properties { "ie":"11" } - transform-for-of { "firefox":"50", "ie":"11" } - transform-sticky-regex { "ie":"11" } - transform-dotall-regex { "chrome":"52", "firefox":"50", "ie":"11" } - transform-unicode-regex { "ie":"11" } - transform-spread { "ie":"11" } - transform-parameters { "firefox":"50", "ie":"11" } - transform-destructuring { "firefox":"50", "ie":"11" } - transform-block-scoping { "firefox":"50", "ie":"11" } - transform-typeof-symbol { "ie":"11" } - transform-new-target { "ie":"11" } - transform-regenerator { "firefox":"50", "ie":"11" } - transform-exponentiation-operator { "firefox":"50", "ie":"11" } - transform-async-to-generator { "chrome":"52", "firefox":"50", "ie":"11" } - proposal-async-generator-functions { "chrome":"52", "firefox":"50", "ie":"11" } - proposal-object-rest-spread { "chrome":"52", "firefox":"50", "ie":"11" } - proposal-unicode-property-regex { "chrome":"52", "firefox":"50", "ie":"11" } - proposal-json-strings { "chrome":"52", "firefox":"50", "ie":"11" } - proposal-optional-catch-binding { "chrome":"52", "firefox":"50", "ie":"11" } - transform-named-capturing-groups-regex { "chrome":"52", "firefox":"50", "ie":"11" } - -Using polyfills with `usage` option: - -[/src/in.js] Based on your code and targets, core-js polyfills were not added. - -[/src/in2.js] Based on your code and targets, core-js polyfills were not added. -Successfully compiled 2 files with Babel. \ No newline at end of file diff --git a/packages/babel-preset-env/test/debug-fixtures/usage-corejs2-proposals-chrome-71/options.json b/packages/babel-preset-env/test/debug-fixtures/usage-corejs2-proposals-chrome-71/options.json deleted file mode 100644 index b2110d7ec87a..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/usage-corejs2-proposals-chrome-71/options.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "presets": [ - ["../../lib", { - "debug": true, - "targets": { - "chrome": 71 - }, - "useBuiltIns": "usage", - "corejs": { "version": 2, "proposals": true } - }] - ] -} diff --git a/packages/babel-preset-env/test/debug-fixtures/usage-corejs2-proposals-chrome-71/stdout.txt b/packages/babel-preset-env/test/debug-fixtures/usage-corejs2-proposals-chrome-71/stdout.txt deleted file mode 100644 index b3df5f0872ba..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/usage-corejs2-proposals-chrome-71/stdout.txt +++ /dev/null @@ -1,23 +0,0 @@ -@babel/preset-env: `DEBUG` option - -Using targets: -{ - "chrome": "71" -} - -Using modules transform: auto - -Using plugins: - syntax-async-generators { "chrome":"71" } - syntax-object-rest-spread { "chrome":"71" } - syntax-json-strings { "chrome":"71" } - syntax-optional-catch-binding { "chrome":"71" } - -Using polyfills with `usage` option: - -[/src/in.js] Added following core-js polyfill: - web.dom.iterable { "chrome":"71" } - -[/src/in2.js] Added following core-js polyfill: - web.dom.iterable { "chrome":"71" } -Successfully compiled 2 files with Babel. \ No newline at end of file diff --git a/packages/babel-preset-env/test/debug-fixtures/usage-corejs2-proposals/options.json b/packages/babel-preset-env/test/debug-fixtures/usage-corejs2-proposals/options.json deleted file mode 100644 index 04beb327c6ab..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/usage-corejs2-proposals/options.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "presets": [ - ["../../lib", { - "debug": true, - "targets": { - "chrome": 52, - "firefox": 50, - "ie": 11 - }, - "useBuiltIns": "usage", - "corejs": { "version": 2, "proposals": true } - }] - ] -} diff --git a/packages/babel-preset-env/test/debug-fixtures/usage-corejs2-proposals/stdout.txt b/packages/babel-preset-env/test/debug-fixtures/usage-corejs2-proposals/stdout.txt deleted file mode 100644 index 8d1136d823bd..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/usage-corejs2-proposals/stdout.txt +++ /dev/null @@ -1,56 +0,0 @@ -@babel/preset-env: `DEBUG` option - -Using targets: -{ - "chrome": "52", - "firefox": "50", - "ie": "11" -} - -Using modules transform: auto - -Using plugins: - transform-template-literals { "ie":"11" } - transform-literals { "firefox":"50", "ie":"11" } - transform-function-name { "firefox":"50", "ie":"11" } - transform-arrow-functions { "ie":"11" } - transform-classes { "ie":"11" } - transform-object-super { "ie":"11" } - transform-shorthand-properties { "ie":"11" } - transform-duplicate-keys { "ie":"11" } - transform-computed-properties { "ie":"11" } - transform-for-of { "firefox":"50", "ie":"11" } - transform-sticky-regex { "ie":"11" } - transform-dotall-regex { "chrome":"52", "firefox":"50", "ie":"11" } - transform-unicode-regex { "ie":"11" } - transform-spread { "ie":"11" } - transform-parameters { "firefox":"50", "ie":"11" } - transform-destructuring { "firefox":"50", "ie":"11" } - transform-block-scoping { "firefox":"50", "ie":"11" } - transform-typeof-symbol { "ie":"11" } - transform-new-target { "ie":"11" } - transform-regenerator { "firefox":"50", "ie":"11" } - transform-exponentiation-operator { "firefox":"50", "ie":"11" } - transform-async-to-generator { "chrome":"52", "firefox":"50", "ie":"11" } - proposal-async-generator-functions { "chrome":"52", "firefox":"50", "ie":"11" } - proposal-object-rest-spread { "chrome":"52", "firefox":"50", "ie":"11" } - proposal-unicode-property-regex { "chrome":"52", "firefox":"50", "ie":"11" } - proposal-json-strings { "chrome":"52", "firefox":"50", "ie":"11" } - proposal-optional-catch-binding { "chrome":"52", "firefox":"50", "ie":"11" } - transform-named-capturing-groups-regex { "chrome":"52", "firefox":"50", "ie":"11" } - -Using polyfills with `usage` option: - -[/src/in.js] Added following core-js polyfills: - es6.object.to-string { "chrome":"52", "firefox":"50", "ie":"11" } - es6.promise { "ie":"11" } - es6.map { "firefox":"50", "ie":"11" } - es6.string.iterator { "ie":"11" } - es6.array.iterator { "ie":"11" } - web.dom.iterable { "chrome":"52", "firefox":"50", "ie":"11" } - -[/src/in2.js] Added following core-js polyfill: - web.dom.iterable { "chrome":"52", "firefox":"50", "ie":"11" } - -[/src/in2.js] Based on your code and targets, added regenerator-runtime. -Successfully compiled 2 files with Babel. \ No newline at end of file diff --git a/packages/babel-preset-env/test/debug-fixtures/usage-corejs2-shippedProposals/options.json b/packages/babel-preset-env/test/debug-fixtures/usage-corejs2-shippedProposals/options.json deleted file mode 100644 index 448b3d6f1e8e..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/usage-corejs2-shippedProposals/options.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "presets": [ - ["../../lib", { - "debug": true, - "targets": { - "chrome": 52, - "firefox": 50, - "ie": 11 - }, - "shippedProposals": true, - "useBuiltIns": "usage", - "corejs": 2 - }] - ] -} diff --git a/packages/babel-preset-env/test/debug-fixtures/usage-corejs2-shippedProposals/stdout.txt b/packages/babel-preset-env/test/debug-fixtures/usage-corejs2-shippedProposals/stdout.txt deleted file mode 100644 index 8d1136d823bd..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/usage-corejs2-shippedProposals/stdout.txt +++ /dev/null @@ -1,56 +0,0 @@ -@babel/preset-env: `DEBUG` option - -Using targets: -{ - "chrome": "52", - "firefox": "50", - "ie": "11" -} - -Using modules transform: auto - -Using plugins: - transform-template-literals { "ie":"11" } - transform-literals { "firefox":"50", "ie":"11" } - transform-function-name { "firefox":"50", "ie":"11" } - transform-arrow-functions { "ie":"11" } - transform-classes { "ie":"11" } - transform-object-super { "ie":"11" } - transform-shorthand-properties { "ie":"11" } - transform-duplicate-keys { "ie":"11" } - transform-computed-properties { "ie":"11" } - transform-for-of { "firefox":"50", "ie":"11" } - transform-sticky-regex { "ie":"11" } - transform-dotall-regex { "chrome":"52", "firefox":"50", "ie":"11" } - transform-unicode-regex { "ie":"11" } - transform-spread { "ie":"11" } - transform-parameters { "firefox":"50", "ie":"11" } - transform-destructuring { "firefox":"50", "ie":"11" } - transform-block-scoping { "firefox":"50", "ie":"11" } - transform-typeof-symbol { "ie":"11" } - transform-new-target { "ie":"11" } - transform-regenerator { "firefox":"50", "ie":"11" } - transform-exponentiation-operator { "firefox":"50", "ie":"11" } - transform-async-to-generator { "chrome":"52", "firefox":"50", "ie":"11" } - proposal-async-generator-functions { "chrome":"52", "firefox":"50", "ie":"11" } - proposal-object-rest-spread { "chrome":"52", "firefox":"50", "ie":"11" } - proposal-unicode-property-regex { "chrome":"52", "firefox":"50", "ie":"11" } - proposal-json-strings { "chrome":"52", "firefox":"50", "ie":"11" } - proposal-optional-catch-binding { "chrome":"52", "firefox":"50", "ie":"11" } - transform-named-capturing-groups-regex { "chrome":"52", "firefox":"50", "ie":"11" } - -Using polyfills with `usage` option: - -[/src/in.js] Added following core-js polyfills: - es6.object.to-string { "chrome":"52", "firefox":"50", "ie":"11" } - es6.promise { "ie":"11" } - es6.map { "firefox":"50", "ie":"11" } - es6.string.iterator { "ie":"11" } - es6.array.iterator { "ie":"11" } - web.dom.iterable { "chrome":"52", "firefox":"50", "ie":"11" } - -[/src/in2.js] Added following core-js polyfill: - web.dom.iterable { "chrome":"52", "firefox":"50", "ie":"11" } - -[/src/in2.js] Based on your code and targets, added regenerator-runtime. -Successfully compiled 2 files with Babel. \ No newline at end of file diff --git a/packages/babel-preset-env/test/debug-fixtures/usage-corejs2-with-import/options.json b/packages/babel-preset-env/test/debug-fixtures/usage-corejs2-with-import/options.json deleted file mode 100644 index ab34fa8b5159..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/usage-corejs2-with-import/options.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "presets": [ - ["../../lib", { - "debug": true, - "targets": { - "chrome": 55 - }, - "useBuiltIns": "usage", - "corejs": 2 - }] - ] -} diff --git a/packages/babel-preset-env/test/debug-fixtures/usage-corejs2-with-import/stdout.txt b/packages/babel-preset-env/test/debug-fixtures/usage-corejs2-with-import/stdout.txt deleted file mode 100644 index e976e00c5f93..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/usage-corejs2-with-import/stdout.txt +++ /dev/null @@ -1,22 +0,0 @@ -@babel/preset-env: `DEBUG` option - -Using targets: -{ - "chrome": "55" -} - -Using modules transform: auto - -Using plugins: - transform-dotall-regex { "chrome":"55" } - proposal-async-generator-functions { "chrome":"55" } - proposal-object-rest-spread { "chrome":"55" } - proposal-unicode-property-regex { "chrome":"55" } - proposal-json-strings { "chrome":"55" } - proposal-optional-catch-binding { "chrome":"55" } - transform-named-capturing-groups-regex { "chrome":"55" } - -Using polyfills with `usage` option: - -[/src/in.js] Based on your code and targets, core-js polyfills were not added. -Successfully compiled 1 file with Babel. \ No newline at end of file diff --git a/packages/babel-preset-env/test/debug-fixtures/usage-corejs2/options.json b/packages/babel-preset-env/test/debug-fixtures/usage-corejs2/options.json deleted file mode 100644 index 087a0efc9f65..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/usage-corejs2/options.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "presets": [ - ["../../lib", { - "debug": true, - "targets": { - "chrome": 52, - "firefox": 50, - "ie": 11 - }, - "useBuiltIns": "usage", - "corejs": 2 - }] - ] -} diff --git a/packages/babel-preset-env/test/debug-fixtures/usage-corejs2/stdout.txt b/packages/babel-preset-env/test/debug-fixtures/usage-corejs2/stdout.txt deleted file mode 100644 index 8d1136d823bd..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/usage-corejs2/stdout.txt +++ /dev/null @@ -1,56 +0,0 @@ -@babel/preset-env: `DEBUG` option - -Using targets: -{ - "chrome": "52", - "firefox": "50", - "ie": "11" -} - -Using modules transform: auto - -Using plugins: - transform-template-literals { "ie":"11" } - transform-literals { "firefox":"50", "ie":"11" } - transform-function-name { "firefox":"50", "ie":"11" } - transform-arrow-functions { "ie":"11" } - transform-classes { "ie":"11" } - transform-object-super { "ie":"11" } - transform-shorthand-properties { "ie":"11" } - transform-duplicate-keys { "ie":"11" } - transform-computed-properties { "ie":"11" } - transform-for-of { "firefox":"50", "ie":"11" } - transform-sticky-regex { "ie":"11" } - transform-dotall-regex { "chrome":"52", "firefox":"50", "ie":"11" } - transform-unicode-regex { "ie":"11" } - transform-spread { "ie":"11" } - transform-parameters { "firefox":"50", "ie":"11" } - transform-destructuring { "firefox":"50", "ie":"11" } - transform-block-scoping { "firefox":"50", "ie":"11" } - transform-typeof-symbol { "ie":"11" } - transform-new-target { "ie":"11" } - transform-regenerator { "firefox":"50", "ie":"11" } - transform-exponentiation-operator { "firefox":"50", "ie":"11" } - transform-async-to-generator { "chrome":"52", "firefox":"50", "ie":"11" } - proposal-async-generator-functions { "chrome":"52", "firefox":"50", "ie":"11" } - proposal-object-rest-spread { "chrome":"52", "firefox":"50", "ie":"11" } - proposal-unicode-property-regex { "chrome":"52", "firefox":"50", "ie":"11" } - proposal-json-strings { "chrome":"52", "firefox":"50", "ie":"11" } - proposal-optional-catch-binding { "chrome":"52", "firefox":"50", "ie":"11" } - transform-named-capturing-groups-regex { "chrome":"52", "firefox":"50", "ie":"11" } - -Using polyfills with `usage` option: - -[/src/in.js] Added following core-js polyfills: - es6.object.to-string { "chrome":"52", "firefox":"50", "ie":"11" } - es6.promise { "ie":"11" } - es6.map { "firefox":"50", "ie":"11" } - es6.string.iterator { "ie":"11" } - es6.array.iterator { "ie":"11" } - web.dom.iterable { "chrome":"52", "firefox":"50", "ie":"11" } - -[/src/in2.js] Added following core-js polyfill: - web.dom.iterable { "chrome":"52", "firefox":"50", "ie":"11" } - -[/src/in2.js] Based on your code and targets, added regenerator-runtime. -Successfully compiled 2 files with Babel. \ No newline at end of file diff --git a/packages/babel-preset-env/test/debug-fixtures/usage-corejs3-chrome-71/options.json b/packages/babel-preset-env/test/debug-fixtures/usage-corejs3-chrome-71/options.json deleted file mode 100644 index 31c2a9c77a6f..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/usage-corejs3-chrome-71/options.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "presets": [ - ["../../lib", { - "debug": true, - "targets": { - "chrome": 71 - }, - "useBuiltIns": "usage", - "corejs": 3 - }] - ] -} diff --git a/packages/babel-preset-env/test/debug-fixtures/usage-corejs3-chrome-71/stdout.txt b/packages/babel-preset-env/test/debug-fixtures/usage-corejs3-chrome-71/stdout.txt deleted file mode 100644 index 3b0d7b91373c..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/usage-corejs3-chrome-71/stdout.txt +++ /dev/null @@ -1,21 +0,0 @@ -@babel/preset-env: `DEBUG` option - -Using targets: -{ - "chrome": "71" -} - -Using modules transform: auto - -Using plugins: - syntax-async-generators { "chrome":"71" } - syntax-object-rest-spread { "chrome":"71" } - syntax-json-strings { "chrome":"71" } - syntax-optional-catch-binding { "chrome":"71" } - -Using polyfills with `usage` option: - -[/src/in.js] Based on your code and targets, core-js polyfills were not added. - -[/src/in2.js] Based on your code and targets, core-js polyfills were not added. -Successfully compiled 2 files with Babel. \ No newline at end of file diff --git a/packages/babel-preset-env/test/debug-fixtures/usage-corejs3-none/options.json b/packages/babel-preset-env/test/debug-fixtures/usage-corejs3-none/options.json deleted file mode 100644 index 6c2922e8970d..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/usage-corejs3-none/options.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "presets": [ - ["../../lib", { - "debug": true, - "targets": { - "chrome": 52, - "firefox": 50, - "ie": 11 - }, - "useBuiltIns": "usage", - "corejs": 3 - }] - ] -} diff --git a/packages/babel-preset-env/test/debug-fixtures/usage-corejs3-none/stdout.txt b/packages/babel-preset-env/test/debug-fixtures/usage-corejs3-none/stdout.txt deleted file mode 100644 index fafdcfca187c..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/usage-corejs3-none/stdout.txt +++ /dev/null @@ -1,47 +0,0 @@ -@babel/preset-env: `DEBUG` option - -Using targets: -{ - "chrome": "52", - "firefox": "50", - "ie": "11" -} - -Using modules transform: auto - -Using plugins: - transform-template-literals { "ie":"11" } - transform-literals { "firefox":"50", "ie":"11" } - transform-function-name { "firefox":"50", "ie":"11" } - transform-arrow-functions { "ie":"11" } - transform-classes { "ie":"11" } - transform-object-super { "ie":"11" } - transform-shorthand-properties { "ie":"11" } - transform-duplicate-keys { "ie":"11" } - transform-computed-properties { "ie":"11" } - transform-for-of { "firefox":"50", "ie":"11" } - transform-sticky-regex { "ie":"11" } - transform-dotall-regex { "chrome":"52", "firefox":"50", "ie":"11" } - transform-unicode-regex { "ie":"11" } - transform-spread { "ie":"11" } - transform-parameters { "firefox":"50", "ie":"11" } - transform-destructuring { "firefox":"50", "ie":"11" } - transform-block-scoping { "firefox":"50", "ie":"11" } - transform-typeof-symbol { "ie":"11" } - transform-new-target { "ie":"11" } - transform-regenerator { "firefox":"50", "ie":"11" } - transform-exponentiation-operator { "firefox":"50", "ie":"11" } - transform-async-to-generator { "chrome":"52", "firefox":"50", "ie":"11" } - proposal-async-generator-functions { "chrome":"52", "firefox":"50", "ie":"11" } - proposal-object-rest-spread { "chrome":"52", "firefox":"50", "ie":"11" } - proposal-unicode-property-regex { "chrome":"52", "firefox":"50", "ie":"11" } - proposal-json-strings { "chrome":"52", "firefox":"50", "ie":"11" } - proposal-optional-catch-binding { "chrome":"52", "firefox":"50", "ie":"11" } - transform-named-capturing-groups-regex { "chrome":"52", "firefox":"50", "ie":"11" } - -Using polyfills with `usage` option: - -[/src/in.js] Based on your code and targets, core-js polyfills were not added. - -[/src/in2.js] Based on your code and targets, core-js polyfills were not added. -Successfully compiled 2 files with Babel. \ No newline at end of file diff --git a/packages/babel-preset-env/test/debug-fixtures/usage-corejs3-proposals-chrome-71/options.json b/packages/babel-preset-env/test/debug-fixtures/usage-corejs3-proposals-chrome-71/options.json deleted file mode 100644 index 24bc77a0d5e0..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/usage-corejs3-proposals-chrome-71/options.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "presets": [ - ["../../lib", { - "debug": true, - "targets": { - "chrome": 71 - }, - "useBuiltIns": "usage", - "corejs": { "version": 3, "proposals": true } - }] - ] -} diff --git a/packages/babel-preset-env/test/debug-fixtures/usage-corejs3-proposals-chrome-71/stdout.txt b/packages/babel-preset-env/test/debug-fixtures/usage-corejs3-proposals-chrome-71/stdout.txt deleted file mode 100644 index e3546e022a16..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/usage-corejs3-proposals-chrome-71/stdout.txt +++ /dev/null @@ -1,36 +0,0 @@ -@babel/preset-env: `DEBUG` option - -Using targets: -{ - "chrome": "71" -} - -Using modules transform: auto - -Using plugins: - syntax-async-generators { "chrome":"71" } - syntax-object-rest-spread { "chrome":"71" } - syntax-json-strings { "chrome":"71" } - syntax-optional-catch-binding { "chrome":"71" } - -Using polyfills with `usage` option: - -[/src/in.js] Added following core-js polyfills: - esnext.map.delete-all { "chrome":"71" } - esnext.map.every { "chrome":"71" } - esnext.map.filter { "chrome":"71" } - esnext.map.find { "chrome":"71" } - esnext.map.find-key { "chrome":"71" } - esnext.map.includes { "chrome":"71" } - esnext.map.key-of { "chrome":"71" } - esnext.map.map-keys { "chrome":"71" } - esnext.map.map-values { "chrome":"71" } - esnext.map.merge { "chrome":"71" } - esnext.map.reduce { "chrome":"71" } - esnext.map.some { "chrome":"71" } - esnext.map.update { "chrome":"71" } - esnext.observable { "chrome":"71" } - esnext.symbol.observable { "chrome":"71" } - -[/src/in2.js] Based on your code and targets, core-js polyfills were not added. -Successfully compiled 2 files with Babel. \ No newline at end of file diff --git a/packages/babel-preset-env/test/debug-fixtures/usage-corejs3-proposals/options.json b/packages/babel-preset-env/test/debug-fixtures/usage-corejs3-proposals/options.json deleted file mode 100644 index 437b707652d3..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/usage-corejs3-proposals/options.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "presets": [ - ["../../lib", { - "debug": true, - "targets": { - "chrome": 52, - "firefox": 50, - "ie": 11 - }, - "useBuiltIns": "usage", - "corejs": { "version": 3, "proposals": true } - }] - ] -} diff --git a/packages/babel-preset-env/test/debug-fixtures/usage-corejs3-proposals/stdout.txt b/packages/babel-preset-env/test/debug-fixtures/usage-corejs3-proposals/stdout.txt deleted file mode 100644 index cec7b6803911..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/usage-corejs3-proposals/stdout.txt +++ /dev/null @@ -1,75 +0,0 @@ -@babel/preset-env: `DEBUG` option - -Using targets: -{ - "chrome": "52", - "firefox": "50", - "ie": "11" -} - -Using modules transform: auto - -Using plugins: - transform-template-literals { "ie":"11" } - transform-literals { "firefox":"50", "ie":"11" } - transform-function-name { "firefox":"50", "ie":"11" } - transform-arrow-functions { "ie":"11" } - transform-classes { "ie":"11" } - transform-object-super { "ie":"11" } - transform-shorthand-properties { "ie":"11" } - transform-duplicate-keys { "ie":"11" } - transform-computed-properties { "ie":"11" } - transform-for-of { "firefox":"50", "ie":"11" } - transform-sticky-regex { "ie":"11" } - transform-dotall-regex { "chrome":"52", "firefox":"50", "ie":"11" } - transform-unicode-regex { "ie":"11" } - transform-spread { "ie":"11" } - transform-parameters { "firefox":"50", "ie":"11" } - transform-destructuring { "firefox":"50", "ie":"11" } - transform-block-scoping { "firefox":"50", "ie":"11" } - transform-typeof-symbol { "ie":"11" } - transform-new-target { "ie":"11" } - transform-regenerator { "firefox":"50", "ie":"11" } - transform-exponentiation-operator { "firefox":"50", "ie":"11" } - transform-async-to-generator { "chrome":"52", "firefox":"50", "ie":"11" } - proposal-async-generator-functions { "chrome":"52", "firefox":"50", "ie":"11" } - proposal-object-rest-spread { "chrome":"52", "firefox":"50", "ie":"11" } - proposal-unicode-property-regex { "chrome":"52", "firefox":"50", "ie":"11" } - proposal-json-strings { "chrome":"52", "firefox":"50", "ie":"11" } - proposal-optional-catch-binding { "chrome":"52", "firefox":"50", "ie":"11" } - transform-named-capturing-groups-regex { "chrome":"52", "firefox":"50", "ie":"11" } - -Using polyfills with `usage` option: - -[/src/in.js] Added following core-js polyfills: - es.array.iterator { "chrome":"52", "firefox":"50", "ie":"11" } - es.map { "firefox":"50", "ie":"11" } - es.object.to-string { "firefox":"50", "ie":"11" } - es.promise { "chrome":"52", "firefox":"50", "ie":"11" } - es.string.iterator { "ie":"11" } - esnext.global-this { "chrome":"52", "firefox":"50", "ie":"11" } - esnext.map.delete-all { "chrome":"52", "firefox":"50", "ie":"11" } - esnext.map.every { "chrome":"52", "firefox":"50", "ie":"11" } - esnext.map.filter { "chrome":"52", "firefox":"50", "ie":"11" } - esnext.map.find { "chrome":"52", "firefox":"50", "ie":"11" } - esnext.map.find-key { "chrome":"52", "firefox":"50", "ie":"11" } - esnext.map.includes { "chrome":"52", "firefox":"50", "ie":"11" } - esnext.map.key-of { "chrome":"52", "firefox":"50", "ie":"11" } - esnext.map.map-keys { "chrome":"52", "firefox":"50", "ie":"11" } - esnext.map.map-values { "chrome":"52", "firefox":"50", "ie":"11" } - esnext.map.merge { "chrome":"52", "firefox":"50", "ie":"11" } - esnext.map.reduce { "chrome":"52", "firefox":"50", "ie":"11" } - esnext.map.some { "chrome":"52", "firefox":"50", "ie":"11" } - esnext.map.update { "chrome":"52", "firefox":"50", "ie":"11" } - esnext.observable { "chrome":"52", "firefox":"50", "ie":"11" } - esnext.symbol.observable { "chrome":"52", "firefox":"50", "ie":"11" } - web.dom-collections.iterator { "chrome":"52", "firefox":"50", "ie":"11" } - web.queue-microtask { "chrome":"52", "firefox":"50", "ie":"11" } - -[/src/in2.js] Added following core-js polyfills: - es.array.iterator { "chrome":"52", "firefox":"50", "ie":"11" } - es.string.iterator { "ie":"11" } - web.dom-collections.iterator { "chrome":"52", "firefox":"50", "ie":"11" } - -[/src/in2.js] Based on your code and targets, added regenerator-runtime. -Successfully compiled 2 files with Babel. \ No newline at end of file diff --git a/packages/babel-preset-env/test/debug-fixtures/usage-corejs3-shippedProposals/options.json b/packages/babel-preset-env/test/debug-fixtures/usage-corejs3-shippedProposals/options.json deleted file mode 100644 index 0c80d936a7fb..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/usage-corejs3-shippedProposals/options.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "presets": [ - ["../../lib", { - "debug": true, - "targets": { - "chrome": 52, - "firefox": 50, - "ie": 11 - }, - "shippedProposals": true, - "useBuiltIns": "usage", - "corejs": 3 - }] - ] -} diff --git a/packages/babel-preset-env/test/debug-fixtures/usage-corejs3-shippedProposals/stdout.txt b/packages/babel-preset-env/test/debug-fixtures/usage-corejs3-shippedProposals/stdout.txt deleted file mode 100644 index c9d333c5820b..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/usage-corejs3-shippedProposals/stdout.txt +++ /dev/null @@ -1,60 +0,0 @@ -@babel/preset-env: `DEBUG` option - -Using targets: -{ - "chrome": "52", - "firefox": "50", - "ie": "11" -} - -Using modules transform: auto - -Using plugins: - transform-template-literals { "ie":"11" } - transform-literals { "firefox":"50", "ie":"11" } - transform-function-name { "firefox":"50", "ie":"11" } - transform-arrow-functions { "ie":"11" } - transform-classes { "ie":"11" } - transform-object-super { "ie":"11" } - transform-shorthand-properties { "ie":"11" } - transform-duplicate-keys { "ie":"11" } - transform-computed-properties { "ie":"11" } - transform-for-of { "firefox":"50", "ie":"11" } - transform-sticky-regex { "ie":"11" } - transform-dotall-regex { "chrome":"52", "firefox":"50", "ie":"11" } - transform-unicode-regex { "ie":"11" } - transform-spread { "ie":"11" } - transform-parameters { "firefox":"50", "ie":"11" } - transform-destructuring { "firefox":"50", "ie":"11" } - transform-block-scoping { "firefox":"50", "ie":"11" } - transform-typeof-symbol { "ie":"11" } - transform-new-target { "ie":"11" } - transform-regenerator { "firefox":"50", "ie":"11" } - transform-exponentiation-operator { "firefox":"50", "ie":"11" } - transform-async-to-generator { "chrome":"52", "firefox":"50", "ie":"11" } - proposal-async-generator-functions { "chrome":"52", "firefox":"50", "ie":"11" } - proposal-object-rest-spread { "chrome":"52", "firefox":"50", "ie":"11" } - proposal-unicode-property-regex { "chrome":"52", "firefox":"50", "ie":"11" } - proposal-json-strings { "chrome":"52", "firefox":"50", "ie":"11" } - proposal-optional-catch-binding { "chrome":"52", "firefox":"50", "ie":"11" } - transform-named-capturing-groups-regex { "chrome":"52", "firefox":"50", "ie":"11" } - -Using polyfills with `usage` option: - -[/src/in.js] Added following core-js polyfills: - es.array.iterator { "chrome":"52", "firefox":"50", "ie":"11" } - es.map { "firefox":"50", "ie":"11" } - es.object.to-string { "firefox":"50", "ie":"11" } - es.promise { "chrome":"52", "firefox":"50", "ie":"11" } - es.string.iterator { "ie":"11" } - web.dom-collections.iterator { "chrome":"52", "firefox":"50", "ie":"11" } - web.queue-microtask { "chrome":"52", "firefox":"50", "ie":"11" } - esnext.global-this { "chrome":"52", "firefox":"50", "ie":"11" } - -[/src/in2.js] Added following core-js polyfills: - es.array.iterator { "chrome":"52", "firefox":"50", "ie":"11" } - es.string.iterator { "ie":"11" } - web.dom-collections.iterator { "chrome":"52", "firefox":"50", "ie":"11" } - -[/src/in2.js] Based on your code and targets, added regenerator-runtime. -Successfully compiled 2 files with Babel. \ No newline at end of file diff --git a/packages/babel-preset-env/test/debug-fixtures/usage-corejs3-versions-strings-minor-3.0/options.json b/packages/babel-preset-env/test/debug-fixtures/usage-corejs3-versions-strings-minor-3.0/options.json deleted file mode 100644 index b0adb5c0910f..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/usage-corejs3-versions-strings-minor-3.0/options.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "presets": [ - ["../../lib", { - "debug": true, - "targets": { - "chrome": 52, - "firefox": 50, - "ie": 11 - }, - "useBuiltIns": "usage", - "corejs": "3.0" - }] - ] -} diff --git a/packages/babel-preset-env/test/debug-fixtures/usage-corejs3-versions-strings-minor-3.0/stdout.txt b/packages/babel-preset-env/test/debug-fixtures/usage-corejs3-versions-strings-minor-3.0/stdout.txt deleted file mode 100644 index 5c7a63345026..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/usage-corejs3-versions-strings-minor-3.0/stdout.txt +++ /dev/null @@ -1,59 +0,0 @@ -@babel/preset-env: `DEBUG` option - -Using targets: -{ - "chrome": "52", - "firefox": "50", - "ie": "11" -} - -Using modules transform: auto - -Using plugins: - transform-template-literals { "ie":"11" } - transform-literals { "firefox":"50", "ie":"11" } - transform-function-name { "firefox":"50", "ie":"11" } - transform-arrow-functions { "ie":"11" } - transform-classes { "ie":"11" } - transform-object-super { "ie":"11" } - transform-shorthand-properties { "ie":"11" } - transform-duplicate-keys { "ie":"11" } - transform-computed-properties { "ie":"11" } - transform-for-of { "firefox":"50", "ie":"11" } - transform-sticky-regex { "ie":"11" } - transform-dotall-regex { "chrome":"52", "firefox":"50", "ie":"11" } - transform-unicode-regex { "ie":"11" } - transform-spread { "ie":"11" } - transform-parameters { "firefox":"50", "ie":"11" } - transform-destructuring { "firefox":"50", "ie":"11" } - transform-block-scoping { "firefox":"50", "ie":"11" } - transform-typeof-symbol { "ie":"11" } - transform-new-target { "ie":"11" } - transform-regenerator { "firefox":"50", "ie":"11" } - transform-exponentiation-operator { "firefox":"50", "ie":"11" } - transform-async-to-generator { "chrome":"52", "firefox":"50", "ie":"11" } - proposal-async-generator-functions { "chrome":"52", "firefox":"50", "ie":"11" } - proposal-object-rest-spread { "chrome":"52", "firefox":"50", "ie":"11" } - proposal-unicode-property-regex { "chrome":"52", "firefox":"50", "ie":"11" } - proposal-json-strings { "chrome":"52", "firefox":"50", "ie":"11" } - proposal-optional-catch-binding { "chrome":"52", "firefox":"50", "ie":"11" } - transform-named-capturing-groups-regex { "chrome":"52", "firefox":"50", "ie":"11" } - -Using polyfills with `usage` option: - -[/src/in.js] Added following core-js polyfills: - es.array.iterator { "chrome":"52", "firefox":"50", "ie":"11" } - es.map { "firefox":"50", "ie":"11" } - es.object.to-string { "firefox":"50", "ie":"11" } - es.promise { "chrome":"52", "firefox":"50", "ie":"11" } - es.string.iterator { "ie":"11" } - web.dom-collections.iterator { "chrome":"52", "firefox":"50", "ie":"11" } - web.queue-microtask { "chrome":"52", "firefox":"50", "ie":"11" } - -[/src/in2.js] Added following core-js polyfills: - es.array.iterator { "chrome":"52", "firefox":"50", "ie":"11" } - es.string.iterator { "ie":"11" } - web.dom-collections.iterator { "chrome":"52", "firefox":"50", "ie":"11" } - -[/src/in2.js] Based on your code and targets, added regenerator-runtime. -Successfully compiled 2 files with Babel. \ No newline at end of file diff --git a/packages/babel-preset-env/test/debug-fixtures/usage-corejs3-versions-strings-minor-3.1/options.json b/packages/babel-preset-env/test/debug-fixtures/usage-corejs3-versions-strings-minor-3.1/options.json deleted file mode 100644 index c2e64be32390..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/usage-corejs3-versions-strings-minor-3.1/options.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "presets": [ - ["../../lib", { - "debug": true, - "targets": { - "chrome": 52, - "firefox": 50, - "ie": 11 - }, - "useBuiltIns": "usage", - "corejs": "3.1" - }] - ] -} diff --git a/packages/babel-preset-env/test/debug-fixtures/usage-corejs3-versions-strings-minor-3.1/stdout.txt b/packages/babel-preset-env/test/debug-fixtures/usage-corejs3-versions-strings-minor-3.1/stdout.txt deleted file mode 100644 index 5c7a63345026..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/usage-corejs3-versions-strings-minor-3.1/stdout.txt +++ /dev/null @@ -1,59 +0,0 @@ -@babel/preset-env: `DEBUG` option - -Using targets: -{ - "chrome": "52", - "firefox": "50", - "ie": "11" -} - -Using modules transform: auto - -Using plugins: - transform-template-literals { "ie":"11" } - transform-literals { "firefox":"50", "ie":"11" } - transform-function-name { "firefox":"50", "ie":"11" } - transform-arrow-functions { "ie":"11" } - transform-classes { "ie":"11" } - transform-object-super { "ie":"11" } - transform-shorthand-properties { "ie":"11" } - transform-duplicate-keys { "ie":"11" } - transform-computed-properties { "ie":"11" } - transform-for-of { "firefox":"50", "ie":"11" } - transform-sticky-regex { "ie":"11" } - transform-dotall-regex { "chrome":"52", "firefox":"50", "ie":"11" } - transform-unicode-regex { "ie":"11" } - transform-spread { "ie":"11" } - transform-parameters { "firefox":"50", "ie":"11" } - transform-destructuring { "firefox":"50", "ie":"11" } - transform-block-scoping { "firefox":"50", "ie":"11" } - transform-typeof-symbol { "ie":"11" } - transform-new-target { "ie":"11" } - transform-regenerator { "firefox":"50", "ie":"11" } - transform-exponentiation-operator { "firefox":"50", "ie":"11" } - transform-async-to-generator { "chrome":"52", "firefox":"50", "ie":"11" } - proposal-async-generator-functions { "chrome":"52", "firefox":"50", "ie":"11" } - proposal-object-rest-spread { "chrome":"52", "firefox":"50", "ie":"11" } - proposal-unicode-property-regex { "chrome":"52", "firefox":"50", "ie":"11" } - proposal-json-strings { "chrome":"52", "firefox":"50", "ie":"11" } - proposal-optional-catch-binding { "chrome":"52", "firefox":"50", "ie":"11" } - transform-named-capturing-groups-regex { "chrome":"52", "firefox":"50", "ie":"11" } - -Using polyfills with `usage` option: - -[/src/in.js] Added following core-js polyfills: - es.array.iterator { "chrome":"52", "firefox":"50", "ie":"11" } - es.map { "firefox":"50", "ie":"11" } - es.object.to-string { "firefox":"50", "ie":"11" } - es.promise { "chrome":"52", "firefox":"50", "ie":"11" } - es.string.iterator { "ie":"11" } - web.dom-collections.iterator { "chrome":"52", "firefox":"50", "ie":"11" } - web.queue-microtask { "chrome":"52", "firefox":"50", "ie":"11" } - -[/src/in2.js] Added following core-js polyfills: - es.array.iterator { "chrome":"52", "firefox":"50", "ie":"11" } - es.string.iterator { "ie":"11" } - web.dom-collections.iterator { "chrome":"52", "firefox":"50", "ie":"11" } - -[/src/in2.js] Based on your code and targets, added regenerator-runtime. -Successfully compiled 2 files with Babel. \ No newline at end of file diff --git a/packages/babel-preset-env/test/debug-fixtures/usage-corejs3-with-import/options.json b/packages/babel-preset-env/test/debug-fixtures/usage-corejs3-with-import/options.json deleted file mode 100644 index 66118c78ad68..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/usage-corejs3-with-import/options.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "presets": [ - ["../../lib", { - "debug": true, - "targets": { - "chrome": 55 - }, - "useBuiltIns": "usage", - "corejs": 3 - }] - ] -} diff --git a/packages/babel-preset-env/test/debug-fixtures/usage-corejs3-with-import/stdout.txt b/packages/babel-preset-env/test/debug-fixtures/usage-corejs3-with-import/stdout.txt deleted file mode 100644 index e976e00c5f93..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/usage-corejs3-with-import/stdout.txt +++ /dev/null @@ -1,22 +0,0 @@ -@babel/preset-env: `DEBUG` option - -Using targets: -{ - "chrome": "55" -} - -Using modules transform: auto - -Using plugins: - transform-dotall-regex { "chrome":"55" } - proposal-async-generator-functions { "chrome":"55" } - proposal-object-rest-spread { "chrome":"55" } - proposal-unicode-property-regex { "chrome":"55" } - proposal-json-strings { "chrome":"55" } - proposal-optional-catch-binding { "chrome":"55" } - transform-named-capturing-groups-regex { "chrome":"55" } - -Using polyfills with `usage` option: - -[/src/in.js] Based on your code and targets, core-js polyfills were not added. -Successfully compiled 1 file with Babel. \ No newline at end of file diff --git a/packages/babel-preset-env/test/debug-fixtures/usage-corejs3/options.json b/packages/babel-preset-env/test/debug-fixtures/usage-corejs3/options.json deleted file mode 100644 index 6c2922e8970d..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/usage-corejs3/options.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "presets": [ - ["../../lib", { - "debug": true, - "targets": { - "chrome": 52, - "firefox": 50, - "ie": 11 - }, - "useBuiltIns": "usage", - "corejs": 3 - }] - ] -} diff --git a/packages/babel-preset-env/test/debug-fixtures/usage-corejs3/stdout.txt b/packages/babel-preset-env/test/debug-fixtures/usage-corejs3/stdout.txt deleted file mode 100644 index 5c7a63345026..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/usage-corejs3/stdout.txt +++ /dev/null @@ -1,59 +0,0 @@ -@babel/preset-env: `DEBUG` option - -Using targets: -{ - "chrome": "52", - "firefox": "50", - "ie": "11" -} - -Using modules transform: auto - -Using plugins: - transform-template-literals { "ie":"11" } - transform-literals { "firefox":"50", "ie":"11" } - transform-function-name { "firefox":"50", "ie":"11" } - transform-arrow-functions { "ie":"11" } - transform-classes { "ie":"11" } - transform-object-super { "ie":"11" } - transform-shorthand-properties { "ie":"11" } - transform-duplicate-keys { "ie":"11" } - transform-computed-properties { "ie":"11" } - transform-for-of { "firefox":"50", "ie":"11" } - transform-sticky-regex { "ie":"11" } - transform-dotall-regex { "chrome":"52", "firefox":"50", "ie":"11" } - transform-unicode-regex { "ie":"11" } - transform-spread { "ie":"11" } - transform-parameters { "firefox":"50", "ie":"11" } - transform-destructuring { "firefox":"50", "ie":"11" } - transform-block-scoping { "firefox":"50", "ie":"11" } - transform-typeof-symbol { "ie":"11" } - transform-new-target { "ie":"11" } - transform-regenerator { "firefox":"50", "ie":"11" } - transform-exponentiation-operator { "firefox":"50", "ie":"11" } - transform-async-to-generator { "chrome":"52", "firefox":"50", "ie":"11" } - proposal-async-generator-functions { "chrome":"52", "firefox":"50", "ie":"11" } - proposal-object-rest-spread { "chrome":"52", "firefox":"50", "ie":"11" } - proposal-unicode-property-regex { "chrome":"52", "firefox":"50", "ie":"11" } - proposal-json-strings { "chrome":"52", "firefox":"50", "ie":"11" } - proposal-optional-catch-binding { "chrome":"52", "firefox":"50", "ie":"11" } - transform-named-capturing-groups-regex { "chrome":"52", "firefox":"50", "ie":"11" } - -Using polyfills with `usage` option: - -[/src/in.js] Added following core-js polyfills: - es.array.iterator { "chrome":"52", "firefox":"50", "ie":"11" } - es.map { "firefox":"50", "ie":"11" } - es.object.to-string { "firefox":"50", "ie":"11" } - es.promise { "chrome":"52", "firefox":"50", "ie":"11" } - es.string.iterator { "ie":"11" } - web.dom-collections.iterator { "chrome":"52", "firefox":"50", "ie":"11" } - web.queue-microtask { "chrome":"52", "firefox":"50", "ie":"11" } - -[/src/in2.js] Added following core-js polyfills: - es.array.iterator { "chrome":"52", "firefox":"50", "ie":"11" } - es.string.iterator { "ie":"11" } - web.dom-collections.iterator { "chrome":"52", "firefox":"50", "ie":"11" } - -[/src/in2.js] Based on your code and targets, added regenerator-runtime. -Successfully compiled 2 files with Babel. \ No newline at end of file diff --git a/packages/babel-preset-env/test/debug-fixtures/usage-no-corejs-none/options.json b/packages/babel-preset-env/test/debug-fixtures/usage-no-corejs-none/options.json deleted file mode 100644 index f1f5db8b10f6..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/usage-no-corejs-none/options.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "presets": [ - ["../../lib", { - "debug": true, - "targets": { - "chrome": 52, - "firefox": 50, - "ie": 11 - }, - "useBuiltIns": "usage" - }] - ] -} diff --git a/packages/babel-preset-env/test/debug-fixtures/usage-no-corejs-none/stdout.txt b/packages/babel-preset-env/test/debug-fixtures/usage-no-corejs-none/stdout.txt deleted file mode 100644 index fafdcfca187c..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/usage-no-corejs-none/stdout.txt +++ /dev/null @@ -1,47 +0,0 @@ -@babel/preset-env: `DEBUG` option - -Using targets: -{ - "chrome": "52", - "firefox": "50", - "ie": "11" -} - -Using modules transform: auto - -Using plugins: - transform-template-literals { "ie":"11" } - transform-literals { "firefox":"50", "ie":"11" } - transform-function-name { "firefox":"50", "ie":"11" } - transform-arrow-functions { "ie":"11" } - transform-classes { "ie":"11" } - transform-object-super { "ie":"11" } - transform-shorthand-properties { "ie":"11" } - transform-duplicate-keys { "ie":"11" } - transform-computed-properties { "ie":"11" } - transform-for-of { "firefox":"50", "ie":"11" } - transform-sticky-regex { "ie":"11" } - transform-dotall-regex { "chrome":"52", "firefox":"50", "ie":"11" } - transform-unicode-regex { "ie":"11" } - transform-spread { "ie":"11" } - transform-parameters { "firefox":"50", "ie":"11" } - transform-destructuring { "firefox":"50", "ie":"11" } - transform-block-scoping { "firefox":"50", "ie":"11" } - transform-typeof-symbol { "ie":"11" } - transform-new-target { "ie":"11" } - transform-regenerator { "firefox":"50", "ie":"11" } - transform-exponentiation-operator { "firefox":"50", "ie":"11" } - transform-async-to-generator { "chrome":"52", "firefox":"50", "ie":"11" } - proposal-async-generator-functions { "chrome":"52", "firefox":"50", "ie":"11" } - proposal-object-rest-spread { "chrome":"52", "firefox":"50", "ie":"11" } - proposal-unicode-property-regex { "chrome":"52", "firefox":"50", "ie":"11" } - proposal-json-strings { "chrome":"52", "firefox":"50", "ie":"11" } - proposal-optional-catch-binding { "chrome":"52", "firefox":"50", "ie":"11" } - transform-named-capturing-groups-regex { "chrome":"52", "firefox":"50", "ie":"11" } - -Using polyfills with `usage` option: - -[/src/in.js] Based on your code and targets, core-js polyfills were not added. - -[/src/in2.js] Based on your code and targets, core-js polyfills were not added. -Successfully compiled 2 files with Babel. \ No newline at end of file diff --git a/packages/babel-preset-env/test/debug-fixtures/usage-no-corejs/options.json b/packages/babel-preset-env/test/debug-fixtures/usage-no-corejs/options.json deleted file mode 100644 index f1f5db8b10f6..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/usage-no-corejs/options.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "presets": [ - ["../../lib", { - "debug": true, - "targets": { - "chrome": 52, - "firefox": 50, - "ie": 11 - }, - "useBuiltIns": "usage" - }] - ] -} diff --git a/packages/babel-preset-env/test/debug-fixtures/usage-no-corejs/stdout.txt b/packages/babel-preset-env/test/debug-fixtures/usage-no-corejs/stdout.txt deleted file mode 100644 index 8d1136d823bd..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/usage-no-corejs/stdout.txt +++ /dev/null @@ -1,56 +0,0 @@ -@babel/preset-env: `DEBUG` option - -Using targets: -{ - "chrome": "52", - "firefox": "50", - "ie": "11" -} - -Using modules transform: auto - -Using plugins: - transform-template-literals { "ie":"11" } - transform-literals { "firefox":"50", "ie":"11" } - transform-function-name { "firefox":"50", "ie":"11" } - transform-arrow-functions { "ie":"11" } - transform-classes { "ie":"11" } - transform-object-super { "ie":"11" } - transform-shorthand-properties { "ie":"11" } - transform-duplicate-keys { "ie":"11" } - transform-computed-properties { "ie":"11" } - transform-for-of { "firefox":"50", "ie":"11" } - transform-sticky-regex { "ie":"11" } - transform-dotall-regex { "chrome":"52", "firefox":"50", "ie":"11" } - transform-unicode-regex { "ie":"11" } - transform-spread { "ie":"11" } - transform-parameters { "firefox":"50", "ie":"11" } - transform-destructuring { "firefox":"50", "ie":"11" } - transform-block-scoping { "firefox":"50", "ie":"11" } - transform-typeof-symbol { "ie":"11" } - transform-new-target { "ie":"11" } - transform-regenerator { "firefox":"50", "ie":"11" } - transform-exponentiation-operator { "firefox":"50", "ie":"11" } - transform-async-to-generator { "chrome":"52", "firefox":"50", "ie":"11" } - proposal-async-generator-functions { "chrome":"52", "firefox":"50", "ie":"11" } - proposal-object-rest-spread { "chrome":"52", "firefox":"50", "ie":"11" } - proposal-unicode-property-regex { "chrome":"52", "firefox":"50", "ie":"11" } - proposal-json-strings { "chrome":"52", "firefox":"50", "ie":"11" } - proposal-optional-catch-binding { "chrome":"52", "firefox":"50", "ie":"11" } - transform-named-capturing-groups-regex { "chrome":"52", "firefox":"50", "ie":"11" } - -Using polyfills with `usage` option: - -[/src/in.js] Added following core-js polyfills: - es6.object.to-string { "chrome":"52", "firefox":"50", "ie":"11" } - es6.promise { "ie":"11" } - es6.map { "firefox":"50", "ie":"11" } - es6.string.iterator { "ie":"11" } - es6.array.iterator { "ie":"11" } - web.dom.iterable { "chrome":"52", "firefox":"50", "ie":"11" } - -[/src/in2.js] Added following core-js polyfill: - web.dom.iterable { "chrome":"52", "firefox":"50", "ie":"11" } - -[/src/in2.js] Based on your code and targets, added regenerator-runtime. -Successfully compiled 2 files with Babel. \ No newline at end of file diff --git a/packages/babel-preset-env/test/fixtures/.plugins-overlapping/chrome-49/input.js b/packages/babel-preset-env/test/fixtures/.plugins-overlapping/chrome-49/input.js new file mode 100644 index 000000000000..9604ae0250bb --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/.plugins-overlapping/chrome-49/input.js @@ -0,0 +1 @@ +async function foo() {} \ No newline at end of file diff --git a/packages/babel-preset-env/test/fixtures/.plugins-overlapping/chrome-49/options.json b/packages/babel-preset-env/test/fixtures/.plugins-overlapping/chrome-49/options.json new file mode 100644 index 000000000000..41ee66e16cc0 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/.plugins-overlapping/chrome-49/options.json @@ -0,0 +1,11 @@ +{ + "plugins": [], + "presets": [ + [ + "../../../../lib", + { + "targets": { "chrome": "49" } + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/.plugins-overlapping/chrome-49/output.js b/packages/babel-preset-env/test/fixtures/.plugins-overlapping/chrome-49/output.js new file mode 100644 index 000000000000..19684e4a4db3 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/.plugins-overlapping/chrome-49/output.js @@ -0,0 +1,9 @@ +function foo() { + return regeneratorRuntime.async(function foo$(_context) { + while (1) switch (_context.prev = _context.next) { + case 0: + case "end": + return _context.stop(); + } + }); +} diff --git a/packages/babel-preset-env/test/fixtures/.plugins-overlapping/chrome-50/input.js b/packages/babel-preset-env/test/fixtures/.plugins-overlapping/chrome-50/input.js new file mode 100644 index 000000000000..9604ae0250bb --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/.plugins-overlapping/chrome-50/input.js @@ -0,0 +1 @@ +async function foo() {} \ No newline at end of file diff --git a/packages/babel-preset-env/test/fixtures/.plugins-overlapping/chrome-50/options.json b/packages/babel-preset-env/test/fixtures/.plugins-overlapping/chrome-50/options.json new file mode 100644 index 000000000000..df56e583e65b --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/.plugins-overlapping/chrome-50/options.json @@ -0,0 +1,11 @@ +{ + "plugins": [], + "presets": [ + [ + "../../../../lib", + { + "targets": { "chrome": "50" } + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/.plugins-overlapping/chrome-50/output.js b/packages/babel-preset-env/test/fixtures/.plugins-overlapping/chrome-50/output.js new file mode 100644 index 000000000000..d69b16f0660c --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/.plugins-overlapping/chrome-50/output.js @@ -0,0 +1,12 @@ +function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } } + +function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; } + +function foo() { + return _foo.apply(this, arguments); +} + +function _foo() { + _foo = _asyncToGenerator(function* () {}); + return _foo.apply(this, arguments); +} diff --git a/packages/babel-preset-env/test/fixtures/.plugins-overlapping/chrome-54/input.js b/packages/babel-preset-env/test/fixtures/.plugins-overlapping/chrome-54/input.js new file mode 100644 index 000000000000..9604ae0250bb --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/.plugins-overlapping/chrome-54/input.js @@ -0,0 +1 @@ +async function foo() {} \ No newline at end of file diff --git a/packages/babel-preset-env/test/fixtures/.plugins-overlapping/chrome-54/options.json b/packages/babel-preset-env/test/fixtures/.plugins-overlapping/chrome-54/options.json new file mode 100644 index 000000000000..d76f324a91bb --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/.plugins-overlapping/chrome-54/options.json @@ -0,0 +1,11 @@ +{ + "plugins": [], + "presets": [ + [ + "../../../../lib", + { + "targets": { "chrome": "54" } + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/.plugins-overlapping/chrome-54/output.js b/packages/babel-preset-env/test/fixtures/.plugins-overlapping/chrome-54/output.js new file mode 100644 index 000000000000..d69b16f0660c --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/.plugins-overlapping/chrome-54/output.js @@ -0,0 +1,12 @@ +function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } } + +function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; } + +function foo() { + return _foo.apply(this, arguments); +} + +function _foo() { + _foo = _asyncToGenerator(function* () {}); + return _foo.apply(this, arguments); +} diff --git a/packages/babel-preset-env/test/fixtures/.plugins-overlapping/chrome-55/input.js b/packages/babel-preset-env/test/fixtures/.plugins-overlapping/chrome-55/input.js new file mode 100644 index 000000000000..9604ae0250bb --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/.plugins-overlapping/chrome-55/input.js @@ -0,0 +1 @@ +async function foo() {} \ No newline at end of file diff --git a/packages/babel-preset-env/test/fixtures/.plugins-overlapping/chrome-55/options.json b/packages/babel-preset-env/test/fixtures/.plugins-overlapping/chrome-55/options.json new file mode 100644 index 000000000000..c08a917cbc95 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/.plugins-overlapping/chrome-55/options.json @@ -0,0 +1,11 @@ +{ + "plugins": [], + "presets": [ + [ + "../../../../lib", + { + "targets": { "chrome": "55" } + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/.plugins-overlapping/chrome-55/output.js b/packages/babel-preset-env/test/fixtures/.plugins-overlapping/chrome-55/output.js new file mode 100644 index 000000000000..f9df9686dd67 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/.plugins-overlapping/chrome-55/output.js @@ -0,0 +1 @@ +async function foo() {} diff --git a/packages/babel-preset-env/test/fixtures/bugfixes/_esmodules-no-bugfixes/input.js b/packages/babel-preset-env/test/fixtures/bugfixes/_esmodules-no-bugfixes/input.js new file mode 100644 index 000000000000..d2dc30789971 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/bugfixes/_esmodules-no-bugfixes/input.js @@ -0,0 +1,8 @@ +// Edge +({ x = 2 }) => {}; + +// Safari +{ + let x; + { let x; } +} diff --git a/packages/babel-preset-env/test/fixtures/bugfixes/_esmodules-no-bugfixes/options.json b/packages/babel-preset-env/test/fixtures/bugfixes/_esmodules-no-bugfixes/options.json new file mode 100644 index 000000000000..fd7e92176f81 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/bugfixes/_esmodules-no-bugfixes/options.json @@ -0,0 +1,12 @@ +{ + "validateLogs": true, + "presets": [ + ["env", { + "debug": true, + "bugfixes": false, + "targets": { + "esmodules": true + } + }] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/bugfixes/_esmodules-no-bugfixes/output.js b/packages/babel-preset-env/test/fixtures/bugfixes/_esmodules-no-bugfixes/output.js new file mode 100644 index 000000000000..06783423c900 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/bugfixes/_esmodules-no-bugfixes/output.js @@ -0,0 +1,14 @@ +// Edge +(_ref) => { + var { + x = 2 + } = _ref; +}; // Safari + + +{ + var x; + { + var _x; + } +} diff --git a/packages/babel-preset-env/test/fixtures/bugfixes/_esmodules-no-bugfixes/stdout.txt b/packages/babel-preset-env/test/fixtures/bugfixes/_esmodules-no-bugfixes/stdout.txt new file mode 100644 index 000000000000..7dd3383636d1 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/bugfixes/_esmodules-no-bugfixes/stdout.txt @@ -0,0 +1,36 @@ +@babel/preset-env: `DEBUG` option + +Using targets: +{ + "android": "61", + "chrome": "61", + "edge": "16", + "firefox": "60", + "ios": "10.3", + "opera": "48", + "safari": "10.1", + "samsung": "8.2" +} + +Using modules transform: auto + +Using plugins: + proposal-nullish-coalescing-operator { "android":"61", "chrome":"61", "edge":"16", "firefox":"60", "ios":"10.3", "opera":"48", "safari":"10.1", "samsung":"8.2" } + proposal-optional-chaining { "android":"61", "chrome":"61", "edge":"16", "firefox":"60", "ios":"10.3", "opera":"48", "safari":"10.1", "samsung":"8.2" } + proposal-json-strings { "android":"61", "chrome":"61", "edge":"16", "firefox":"60", "ios":"10.3", "opera":"48", "safari":"10.1", "samsung":"8.2" } + proposal-optional-catch-binding { "android":"61", "chrome":"61", "edge":"16", "ios":"10.3", "opera":"48", "safari":"10.1", "samsung":"8.2" } + transform-parameters { "edge":"16" } + proposal-async-generator-functions { "android":"61", "chrome":"61", "edge":"16", "ios":"10.3", "opera":"48", "safari":"10.1" } + proposal-object-rest-spread { "edge":"16", "ios":"10.3", "safari":"10.1" } + transform-dotall-regex { "android":"61", "chrome":"61", "edge":"16", "firefox":"60", "ios":"10.3", "opera":"48", "safari":"10.1" } + proposal-unicode-property-regex { "android":"61", "chrome":"61", "edge":"16", "firefox":"60", "ios":"10.3", "opera":"48", "safari":"10.1", "samsung":"8.2" } + transform-named-capturing-groups-regex { "android":"61", "chrome":"61", "edge":"16", "firefox":"60", "ios":"10.3", "opera":"48", "safari":"10.1", "samsung":"8.2" } + transform-async-to-generator { "ios":"10.3", "safari":"10.1" } + transform-template-literals { "ios":"10.3", "safari":"10.1" } + transform-function-name { "edge":"16" } + transform-unicode-regex { "ios":"10.3", "safari":"10.1" } + transform-block-scoping { "ios":"10.3", "safari":"10.1" } + transform-modules-commonjs { "android":"61", "chrome":"61", "edge":"16", "firefox":"60", "ios":"10.3", "opera":"48", "safari":"10.1", "samsung":"8.2" } + proposal-dynamic-import { "android":"61", "chrome":"61", "edge":"16", "firefox":"60", "ios":"10.3", "opera":"48", "safari":"10.1", "samsung":"8.2" } + +Using polyfills: No polyfills were added, since the `useBuiltIns` option was not set. diff --git a/packages/babel-preset-env/test/fixtures/bugfixes/_esmodules/input.js b/packages/babel-preset-env/test/fixtures/bugfixes/_esmodules/input.js new file mode 100644 index 000000000000..d2dc30789971 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/bugfixes/_esmodules/input.js @@ -0,0 +1,8 @@ +// Edge +({ x = 2 }) => {}; + +// Safari +{ + let x; + { let x; } +} diff --git a/packages/babel-preset-env/test/fixtures/bugfixes/_esmodules/options.json b/packages/babel-preset-env/test/fixtures/bugfixes/_esmodules/options.json new file mode 100644 index 000000000000..66c9f4e7d965 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/bugfixes/_esmodules/options.json @@ -0,0 +1,12 @@ +{ + "validateLogs": true, + "presets": [ + ["env", { + "debug": true, + "bugfixes": true, + "targets": { + "esmodules": true + } + }] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/bugfixes/_esmodules/output.js b/packages/babel-preset-env/test/fixtures/bugfixes/_esmodules/output.js new file mode 100644 index 000000000000..a394add00c93 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/bugfixes/_esmodules/output.js @@ -0,0 +1,12 @@ +// Edge +({ + x: _x = 2 +}) => {}; // Safari + + +{ + let x; + { + let _x2; + } +} diff --git a/packages/babel-preset-env/test/fixtures/bugfixes/_esmodules/stdout.txt b/packages/babel-preset-env/test/fixtures/bugfixes/_esmodules/stdout.txt new file mode 100644 index 000000000000..3f19ec611846 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/bugfixes/_esmodules/stdout.txt @@ -0,0 +1,37 @@ +@babel/preset-env: `DEBUG` option + +Using targets: +{ + "android": "61", + "chrome": "61", + "edge": "16", + "firefox": "60", + "ios": "10.3", + "opera": "48", + "safari": "10.1", + "samsung": "8.2" +} + +Using modules transform: auto + +Using plugins: + proposal-nullish-coalescing-operator { "android":"61", "chrome":"61", "edge":"16", "firefox":"60", "ios":"10.3", "opera":"48", "safari":"10.1", "samsung":"8.2" } + proposal-optional-chaining { "android":"61", "chrome":"61", "edge":"16", "firefox":"60", "ios":"10.3", "opera":"48", "safari":"10.1", "samsung":"8.2" } + proposal-json-strings { "android":"61", "chrome":"61", "edge":"16", "firefox":"60", "ios":"10.3", "opera":"48", "safari":"10.1", "samsung":"8.2" } + proposal-optional-catch-binding { "android":"61", "chrome":"61", "edge":"16", "ios":"10.3", "opera":"48", "safari":"10.1", "samsung":"8.2" } + proposal-async-generator-functions { "android":"61", "chrome":"61", "edge":"16", "ios":"10.3", "opera":"48", "safari":"10.1" } + proposal-object-rest-spread { "edge":"16", "ios":"10.3", "safari":"10.1" } + transform-dotall-regex { "android":"61", "chrome":"61", "edge":"16", "firefox":"60", "ios":"10.3", "opera":"48", "safari":"10.1" } + proposal-unicode-property-regex { "android":"61", "chrome":"61", "edge":"16", "firefox":"60", "ios":"10.3", "opera":"48", "safari":"10.1", "samsung":"8.2" } + transform-named-capturing-groups-regex { "android":"61", "chrome":"61", "edge":"16", "firefox":"60", "ios":"10.3", "opera":"48", "safari":"10.1", "samsung":"8.2" } + transform-unicode-regex { "ios":"10.3", "safari":"10.1" } + bugfix/transform-async-arrows-in-class { "android":"61", "chrome":"61", "edge":"16", "firefox":"60", "ios":"10.3", "opera":"48", "safari":"10.1", "samsung":"8.2" } + bugfix/transform-edge-default-parameters { "android":"61", "chrome":"61", "edge":"16", "firefox":"60", "ios":"10.3", "opera":"48", "safari":"10.1", "samsung":"8.2" } + bugfix/transform-edge-function-name { "android":"61", "chrome":"61", "edge":"16", "firefox":"60", "ios":"10.3", "opera":"48", "safari":"10.1", "samsung":"8.2" } + bugfix/transform-safari-block-shadowing { "android":"61", "chrome":"61", "edge":"16", "firefox":"60", "ios":"10.3", "opera":"48", "safari":"10.1", "samsung":"8.2" } + bugfix/transform-safari-for-shadowing { "android":"61", "chrome":"61", "edge":"16", "firefox":"60", "ios":"10.3", "opera":"48", "safari":"10.1", "samsung":"8.2" } + bugfix/transform-tagged-template-caching { "android":"61", "chrome":"61", "edge":"16", "firefox":"60", "ios":"10.3", "opera":"48", "safari":"10.1", "samsung":"8.2" } + transform-modules-commonjs { "android":"61", "chrome":"61", "edge":"16", "firefox":"60", "ios":"10.3", "opera":"48", "safari":"10.1", "samsung":"8.2" } + proposal-dynamic-import { "android":"61", "chrome":"61", "edge":"16", "firefox":"60", "ios":"10.3", "opera":"48", "safari":"10.1", "samsung":"8.2" } + +Using polyfills: No polyfills were added, since the `useBuiltIns` option was not set. diff --git a/packages/babel-preset-env/test/fixtures/bugfixes/edge-default-params-chrome-40/input.js b/packages/babel-preset-env/test/fixtures/bugfixes/edge-default-params-chrome-40/input.js new file mode 100644 index 000000000000..e2971527b36e --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/bugfixes/edge-default-params-chrome-40/input.js @@ -0,0 +1 @@ +({ x = 2 }) => {}; \ No newline at end of file diff --git a/packages/babel-preset-env/test/fixtures/bugfixes/edge-default-params-chrome-40/options.json b/packages/babel-preset-env/test/fixtures/bugfixes/edge-default-params-chrome-40/options.json new file mode 100644 index 000000000000..f6058d14bab2 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/bugfixes/edge-default-params-chrome-40/options.json @@ -0,0 +1,13 @@ +{ + "validateLogs": true, + "presets": [ + ["env", { + "debug": true, + "bugfixes": true, + "targets": { + "chrome": "40" + }, + "exclude": ["transform-destructuring", "transform-arrow-functions"] + }] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/bugfixes/edge-default-params-chrome-40/output.js b/packages/babel-preset-env/test/fixtures/bugfixes/edge-default-params-chrome-40/output.js new file mode 100644 index 000000000000..889201c488e6 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/bugfixes/edge-default-params-chrome-40/output.js @@ -0,0 +1,5 @@ +(_ref) => { + var { + x = 2 + } = _ref; +}; diff --git a/packages/babel-preset-env/test/fixtures/bugfixes/edge-default-params-chrome-40/stdout.txt b/packages/babel-preset-env/test/fixtures/bugfixes/edge-default-params-chrome-40/stdout.txt new file mode 100644 index 000000000000..4b4b9cf2469b --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/bugfixes/edge-default-params-chrome-40/stdout.txt @@ -0,0 +1,42 @@ +@babel/preset-env: `DEBUG` option + +Using targets: +{ + "chrome": "40" +} + +Using modules transform: auto + +Using plugins: + proposal-nullish-coalescing-operator { "chrome":"40" } + proposal-optional-chaining { "chrome":"40" } + proposal-json-strings { "chrome":"40" } + proposal-optional-catch-binding { "chrome":"40" } + transform-parameters { "chrome":"40" } + proposal-async-generator-functions { "chrome":"40" } + proposal-object-rest-spread { "chrome":"40" } + transform-dotall-regex { "chrome":"40" } + proposal-unicode-property-regex { "chrome":"40" } + transform-named-capturing-groups-regex { "chrome":"40" } + transform-async-to-generator { "chrome":"40" } + transform-exponentiation-operator { "chrome":"40" } + transform-template-literals { "chrome":"40" } + transform-literals { "chrome":"40" } + transform-function-name { "chrome":"40" } + transform-block-scoped-functions { "chrome":"40" } + transform-classes { "chrome":"40" } + transform-object-super { "chrome":"40" } + transform-shorthand-properties { "chrome":"40" } + transform-duplicate-keys { "chrome":"40" } + transform-computed-properties { "chrome":"40" } + transform-for-of { "chrome":"40" } + transform-sticky-regex { "chrome":"40" } + transform-unicode-regex { "chrome":"40" } + transform-spread { "chrome":"40" } + transform-block-scoping { "chrome":"40" } + transform-new-target { "chrome":"40" } + transform-regenerator { "chrome":"40" } + transform-modules-commonjs { "chrome":"40" } + proposal-dynamic-import { "chrome":"40" } + +Using polyfills: No polyfills were added, since the `useBuiltIns` option was not set. diff --git a/packages/babel-preset-env/test/fixtures/bugfixes/edge-default-params-chrome-70/input.js b/packages/babel-preset-env/test/fixtures/bugfixes/edge-default-params-chrome-70/input.js new file mode 100644 index 000000000000..e2971527b36e --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/bugfixes/edge-default-params-chrome-70/input.js @@ -0,0 +1 @@ +({ x = 2 }) => {}; \ No newline at end of file diff --git a/packages/babel-preset-env/test/fixtures/bugfixes/edge-default-params-chrome-70/options.json b/packages/babel-preset-env/test/fixtures/bugfixes/edge-default-params-chrome-70/options.json new file mode 100644 index 000000000000..6af1f99c2bc9 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/bugfixes/edge-default-params-chrome-70/options.json @@ -0,0 +1,12 @@ +{ + "validateLogs": true, + "presets": [ + ["env", { + "debug": true, + "bugfixes": true, + "targets": { + "chrome": "70" + } + }] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/bugfixes/edge-default-params-chrome-70/output.js b/packages/babel-preset-env/test/fixtures/bugfixes/edge-default-params-chrome-70/output.js new file mode 100644 index 000000000000..04e489808431 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/bugfixes/edge-default-params-chrome-70/output.js @@ -0,0 +1,3 @@ +({ + x = 2 +}) => {}; diff --git a/packages/babel-preset-env/test/fixtures/bugfixes/edge-default-params-chrome-70/stdout.txt b/packages/babel-preset-env/test/fixtures/bugfixes/edge-default-params-chrome-70/stdout.txt new file mode 100644 index 000000000000..0cc2b0ed9d8e --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/bugfixes/edge-default-params-chrome-70/stdout.txt @@ -0,0 +1,20 @@ +@babel/preset-env: `DEBUG` option + +Using targets: +{ + "chrome": "70" +} + +Using modules transform: auto + +Using plugins: + proposal-nullish-coalescing-operator { "chrome":"70" } + proposal-optional-chaining { "chrome":"70" } + syntax-json-strings { "chrome":"70" } + syntax-optional-catch-binding { "chrome":"70" } + syntax-async-generators { "chrome":"70" } + syntax-object-rest-spread { "chrome":"70" } + transform-modules-commonjs { "chrome":"70" } + proposal-dynamic-import { "chrome":"70" } + +Using polyfills: No polyfills were added, since the `useBuiltIns` option was not set. diff --git a/packages/babel-preset-env/test/fixtures/bugfixes/edge-default-params-edge-14/input.js b/packages/babel-preset-env/test/fixtures/bugfixes/edge-default-params-edge-14/input.js new file mode 100644 index 000000000000..e2971527b36e --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/bugfixes/edge-default-params-edge-14/input.js @@ -0,0 +1 @@ +({ x = 2 }) => {}; \ No newline at end of file diff --git a/packages/babel-preset-env/test/fixtures/bugfixes/edge-default-params-edge-14/options.json b/packages/babel-preset-env/test/fixtures/bugfixes/edge-default-params-edge-14/options.json new file mode 100644 index 000000000000..af45f41d7dc0 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/bugfixes/edge-default-params-edge-14/options.json @@ -0,0 +1,12 @@ +{ + "validateLogs": true, + "presets": [ + ["env", { + "debug": true, + "bugfixes": true, + "targets": { + "edge": "14" + } + }] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/bugfixes/edge-default-params-edge-14/output.js b/packages/babel-preset-env/test/fixtures/bugfixes/edge-default-params-edge-14/output.js new file mode 100644 index 000000000000..e93f11f57a97 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/bugfixes/edge-default-params-edge-14/output.js @@ -0,0 +1,4 @@ +(_ref) => { + let _ref$x = _ref.x, + x = _ref$x === void 0 ? 2 : _ref$x; +}; diff --git a/packages/babel-preset-env/test/fixtures/bugfixes/edge-default-params-edge-14/stdout.txt b/packages/babel-preset-env/test/fixtures/bugfixes/edge-default-params-edge-14/stdout.txt new file mode 100644 index 000000000000..7a388e0ae02c --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/bugfixes/edge-default-params-edge-14/stdout.txt @@ -0,0 +1,28 @@ +@babel/preset-env: `DEBUG` option + +Using targets: +{ + "edge": "14" +} + +Using modules transform: auto + +Using plugins: + proposal-nullish-coalescing-operator { "edge":"14" } + proposal-optional-chaining { "edge":"14" } + proposal-json-strings { "edge":"14" } + proposal-optional-catch-binding { "edge":"14" } + transform-parameters { "edge":"14" } + proposal-async-generator-functions { "edge":"14" } + proposal-object-rest-spread { "edge":"14" } + transform-dotall-regex { "edge":"14" } + proposal-unicode-property-regex { "edge":"14" } + transform-named-capturing-groups-regex { "edge":"14" } + transform-async-to-generator { "edge":"14" } + transform-for-of { "edge":"14" } + transform-destructuring { "edge":"14" } + bugfix/transform-edge-function-name { "edge":"14" } + transform-modules-commonjs { "edge":"14" } + proposal-dynamic-import { "edge":"14" } + +Using polyfills: No polyfills were added, since the `useBuiltIns` option was not set. diff --git a/packages/babel-preset-env/test/fixtures/bugfixes/edge-default-params-edge-15/input.js b/packages/babel-preset-env/test/fixtures/bugfixes/edge-default-params-edge-15/input.js new file mode 100644 index 000000000000..e2971527b36e --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/bugfixes/edge-default-params-edge-15/input.js @@ -0,0 +1 @@ +({ x = 2 }) => {}; \ No newline at end of file diff --git a/packages/babel-preset-env/test/fixtures/bugfixes/edge-default-params-edge-15/options.json b/packages/babel-preset-env/test/fixtures/bugfixes/edge-default-params-edge-15/options.json new file mode 100644 index 000000000000..04cd785ba8cc --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/bugfixes/edge-default-params-edge-15/options.json @@ -0,0 +1,13 @@ +{ + "validateLogs": true, + "presets": [ + ["env", { + "debug": true, + "bugfixes": true, + "targets": { + "edge": "15" + }, + "exclude": ["transform-destructuring", "transform-arrow-functions"] + }] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/bugfixes/edge-default-params-edge-15/output.js b/packages/babel-preset-env/test/fixtures/bugfixes/edge-default-params-edge-15/output.js new file mode 100644 index 000000000000..2e677628dfb3 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/bugfixes/edge-default-params-edge-15/output.js @@ -0,0 +1,3 @@ +({ + x: _x = 2 +}) => {}; diff --git a/packages/babel-preset-env/test/fixtures/bugfixes/edge-default-params-edge-15/stdout.txt b/packages/babel-preset-env/test/fixtures/bugfixes/edge-default-params-edge-15/stdout.txt new file mode 100644 index 000000000000..9510c3518847 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/bugfixes/edge-default-params-edge-15/stdout.txt @@ -0,0 +1,25 @@ +@babel/preset-env: `DEBUG` option + +Using targets: +{ + "edge": "15" +} + +Using modules transform: auto + +Using plugins: + proposal-nullish-coalescing-operator { "edge":"15" } + proposal-optional-chaining { "edge":"15" } + proposal-json-strings { "edge":"15" } + proposal-optional-catch-binding { "edge":"15" } + proposal-async-generator-functions { "edge":"15" } + proposal-object-rest-spread { "edge":"15" } + transform-dotall-regex { "edge":"15" } + proposal-unicode-property-regex { "edge":"15" } + transform-named-capturing-groups-regex { "edge":"15" } + bugfix/transform-edge-default-parameters { "edge":"15" } + bugfix/transform-edge-function-name { "edge":"15" } + transform-modules-commonjs { "edge":"15" } + proposal-dynamic-import { "edge":"15" } + +Using polyfills: No polyfills were added, since the `useBuiltIns` option was not set. diff --git a/packages/babel-preset-env/test/fixtures/bugfixes/edge-default-params-edge-17-no-bugfixes/input.js b/packages/babel-preset-env/test/fixtures/bugfixes/edge-default-params-edge-17-no-bugfixes/input.js new file mode 100644 index 000000000000..e2971527b36e --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/bugfixes/edge-default-params-edge-17-no-bugfixes/input.js @@ -0,0 +1 @@ +({ x = 2 }) => {}; \ No newline at end of file diff --git a/packages/babel-preset-env/test/fixtures/bugfixes/edge-default-params-edge-17-no-bugfixes/options.json b/packages/babel-preset-env/test/fixtures/bugfixes/edge-default-params-edge-17-no-bugfixes/options.json new file mode 100644 index 000000000000..8c786f29fba2 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/bugfixes/edge-default-params-edge-17-no-bugfixes/options.json @@ -0,0 +1,12 @@ +{ + "validateLogs": true, + "presets": [ + ["env", { + "debug": true, + "bugfixes": false, + "targets": { + "edge": "17" + } + }] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/bugfixes/edge-default-params-edge-17-no-bugfixes/output.js b/packages/babel-preset-env/test/fixtures/bugfixes/edge-default-params-edge-17-no-bugfixes/output.js new file mode 100644 index 000000000000..4b87aa152fb2 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/bugfixes/edge-default-params-edge-17-no-bugfixes/output.js @@ -0,0 +1,5 @@ +(_ref) => { + let { + x = 2 + } = _ref; +}; diff --git a/packages/babel-preset-env/test/fixtures/bugfixes/edge-default-params-edge-17-no-bugfixes/stdout.txt b/packages/babel-preset-env/test/fixtures/bugfixes/edge-default-params-edge-17-no-bugfixes/stdout.txt new file mode 100644 index 000000000000..954199e544e4 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/bugfixes/edge-default-params-edge-17-no-bugfixes/stdout.txt @@ -0,0 +1,25 @@ +@babel/preset-env: `DEBUG` option + +Using targets: +{ + "edge": "17" +} + +Using modules transform: auto + +Using plugins: + proposal-nullish-coalescing-operator { "edge":"17" } + proposal-optional-chaining { "edge":"17" } + proposal-json-strings { "edge":"17" } + proposal-optional-catch-binding { "edge":"17" } + transform-parameters { "edge":"17" } + proposal-async-generator-functions { "edge":"17" } + proposal-object-rest-spread { "edge":"17" } + transform-dotall-regex { "edge":"17" } + proposal-unicode-property-regex { "edge":"17" } + transform-named-capturing-groups-regex { "edge":"17" } + transform-function-name { "edge":"17" } + transform-modules-commonjs { "edge":"17" } + proposal-dynamic-import { "edge":"17" } + +Using polyfills: No polyfills were added, since the `useBuiltIns` option was not set. diff --git a/packages/babel-preset-env/test/fixtures/bugfixes/edge-default-params-edge-17/input.js b/packages/babel-preset-env/test/fixtures/bugfixes/edge-default-params-edge-17/input.js new file mode 100644 index 000000000000..e2971527b36e --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/bugfixes/edge-default-params-edge-17/input.js @@ -0,0 +1 @@ +({ x = 2 }) => {}; \ No newline at end of file diff --git a/packages/babel-preset-env/test/fixtures/bugfixes/edge-default-params-edge-17/options.json b/packages/babel-preset-env/test/fixtures/bugfixes/edge-default-params-edge-17/options.json new file mode 100644 index 000000000000..257dedaed812 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/bugfixes/edge-default-params-edge-17/options.json @@ -0,0 +1,12 @@ +{ + "validateLogs": true, + "presets": [ + ["env", { + "debug": true, + "bugfixes": true, + "targets": { + "edge": "17" + } + }] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/bugfixes/edge-default-params-edge-17/output.js b/packages/babel-preset-env/test/fixtures/bugfixes/edge-default-params-edge-17/output.js new file mode 100644 index 000000000000..2e677628dfb3 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/bugfixes/edge-default-params-edge-17/output.js @@ -0,0 +1,3 @@ +({ + x: _x = 2 +}) => {}; diff --git a/packages/babel-preset-env/test/fixtures/bugfixes/edge-default-params-edge-17/stdout.txt b/packages/babel-preset-env/test/fixtures/bugfixes/edge-default-params-edge-17/stdout.txt new file mode 100644 index 000000000000..b728cabff9da --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/bugfixes/edge-default-params-edge-17/stdout.txt @@ -0,0 +1,25 @@ +@babel/preset-env: `DEBUG` option + +Using targets: +{ + "edge": "17" +} + +Using modules transform: auto + +Using plugins: + proposal-nullish-coalescing-operator { "edge":"17" } + proposal-optional-chaining { "edge":"17" } + proposal-json-strings { "edge":"17" } + proposal-optional-catch-binding { "edge":"17" } + proposal-async-generator-functions { "edge":"17" } + proposal-object-rest-spread { "edge":"17" } + transform-dotall-regex { "edge":"17" } + proposal-unicode-property-regex { "edge":"17" } + transform-named-capturing-groups-regex { "edge":"17" } + bugfix/transform-edge-default-parameters { "edge":"17" } + bugfix/transform-edge-function-name { "edge":"17" } + transform-modules-commonjs { "edge":"17" } + proposal-dynamic-import { "edge":"17" } + +Using polyfills: No polyfills were added, since the `useBuiltIns` option was not set. diff --git a/packages/babel-preset-env/test/fixtures/bugfixes/edge-default-params-edge-18/input.js b/packages/babel-preset-env/test/fixtures/bugfixes/edge-default-params-edge-18/input.js new file mode 100644 index 000000000000..e2971527b36e --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/bugfixes/edge-default-params-edge-18/input.js @@ -0,0 +1 @@ +({ x = 2 }) => {}; \ No newline at end of file diff --git a/packages/babel-preset-env/test/fixtures/bugfixes/edge-default-params-edge-18/options.json b/packages/babel-preset-env/test/fixtures/bugfixes/edge-default-params-edge-18/options.json new file mode 100644 index 000000000000..926451b06165 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/bugfixes/edge-default-params-edge-18/options.json @@ -0,0 +1,12 @@ +{ + "validateLogs": true, + "presets": [ + ["env", { + "debug": true, + "bugfixes": true, + "targets": { + "edge": "18" + } + }] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/bugfixes/edge-default-params-edge-18/output.js b/packages/babel-preset-env/test/fixtures/bugfixes/edge-default-params-edge-18/output.js new file mode 100644 index 000000000000..04e489808431 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/bugfixes/edge-default-params-edge-18/output.js @@ -0,0 +1,3 @@ +({ + x = 2 +}) => {}; diff --git a/packages/babel-preset-env/test/fixtures/bugfixes/edge-default-params-edge-18/stdout.txt b/packages/babel-preset-env/test/fixtures/bugfixes/edge-default-params-edge-18/stdout.txt new file mode 100644 index 000000000000..30bcc97de1ee --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/bugfixes/edge-default-params-edge-18/stdout.txt @@ -0,0 +1,24 @@ +@babel/preset-env: `DEBUG` option + +Using targets: +{ + "edge": "18" +} + +Using modules transform: auto + +Using plugins: + proposal-nullish-coalescing-operator { "edge":"18" } + proposal-optional-chaining { "edge":"18" } + proposal-json-strings { "edge":"18" } + proposal-optional-catch-binding { "edge":"18" } + proposal-async-generator-functions { "edge":"18" } + proposal-object-rest-spread { "edge":"18" } + transform-dotall-regex { "edge":"18" } + proposal-unicode-property-regex { "edge":"18" } + transform-named-capturing-groups-regex { "edge":"18" } + bugfix/transform-edge-function-name { "edge":"18" } + transform-modules-commonjs { "edge":"18" } + proposal-dynamic-import { "edge":"18" } + +Using polyfills: No polyfills were added, since the `useBuiltIns` option was not set. diff --git a/packages/babel-preset-env/test/fixtures/bugfixes/edge-function-name-edge-14-no-bugfixes/input.js b/packages/babel-preset-env/test/fixtures/bugfixes/edge-function-name-edge-14-no-bugfixes/input.js new file mode 100644 index 000000000000..17d6a917dc99 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/bugfixes/edge-function-name-edge-14-no-bugfixes/input.js @@ -0,0 +1,2 @@ +var a = function() {}; +({ obj: function() {} }); \ No newline at end of file diff --git a/packages/babel-preset-env/test/fixtures/bugfixes/edge-function-name-edge-14-no-bugfixes/options.json b/packages/babel-preset-env/test/fixtures/bugfixes/edge-function-name-edge-14-no-bugfixes/options.json new file mode 100644 index 000000000000..fead32b8483d --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/bugfixes/edge-function-name-edge-14-no-bugfixes/options.json @@ -0,0 +1,12 @@ +{ + "validateLogs": true, + "presets": [ + ["env", { + "debug": true, + "bugfixes": false, + "targets": { + "edge": "14" + } + }] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/bugfixes/edge-function-name-edge-14-no-bugfixes/output.js b/packages/babel-preset-env/test/fixtures/bugfixes/edge-function-name-edge-14-no-bugfixes/output.js new file mode 100644 index 000000000000..ba146f08e475 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/bugfixes/edge-function-name-edge-14-no-bugfixes/output.js @@ -0,0 +1,5 @@ +var a = function a() {}; + +({ + obj: function obj() {} +}); diff --git a/packages/babel-preset-env/test/fixtures/bugfixes/edge-function-name-edge-14-no-bugfixes/stdout.txt b/packages/babel-preset-env/test/fixtures/bugfixes/edge-function-name-edge-14-no-bugfixes/stdout.txt new file mode 100644 index 000000000000..ac366c8a1cdb --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/bugfixes/edge-function-name-edge-14-no-bugfixes/stdout.txt @@ -0,0 +1,28 @@ +@babel/preset-env: `DEBUG` option + +Using targets: +{ + "edge": "14" +} + +Using modules transform: auto + +Using plugins: + proposal-nullish-coalescing-operator { "edge":"14" } + proposal-optional-chaining { "edge":"14" } + proposal-json-strings { "edge":"14" } + proposal-optional-catch-binding { "edge":"14" } + transform-parameters { "edge":"14" } + proposal-async-generator-functions { "edge":"14" } + proposal-object-rest-spread { "edge":"14" } + transform-dotall-regex { "edge":"14" } + proposal-unicode-property-regex { "edge":"14" } + transform-named-capturing-groups-regex { "edge":"14" } + transform-async-to-generator { "edge":"14" } + transform-function-name { "edge":"14" } + transform-for-of { "edge":"14" } + transform-destructuring { "edge":"14" } + transform-modules-commonjs { "edge":"14" } + proposal-dynamic-import { "edge":"14" } + +Using polyfills: No polyfills were added, since the `useBuiltIns` option was not set. diff --git a/packages/babel-preset-env/test/fixtures/bugfixes/edge-function-name-edge-14/input.js b/packages/babel-preset-env/test/fixtures/bugfixes/edge-function-name-edge-14/input.js new file mode 100644 index 000000000000..17d6a917dc99 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/bugfixes/edge-function-name-edge-14/input.js @@ -0,0 +1,2 @@ +var a = function() {}; +({ obj: function() {} }); \ No newline at end of file diff --git a/packages/babel-preset-env/test/fixtures/bugfixes/edge-function-name-edge-14/options.json b/packages/babel-preset-env/test/fixtures/bugfixes/edge-function-name-edge-14/options.json new file mode 100644 index 000000000000..af45f41d7dc0 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/bugfixes/edge-function-name-edge-14/options.json @@ -0,0 +1,12 @@ +{ + "validateLogs": true, + "presets": [ + ["env", { + "debug": true, + "bugfixes": true, + "targets": { + "edge": "14" + } + }] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/bugfixes/edge-function-name-edge-14/output.js b/packages/babel-preset-env/test/fixtures/bugfixes/edge-function-name-edge-14/output.js new file mode 100644 index 000000000000..41d1e0720ae5 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/bugfixes/edge-function-name-edge-14/output.js @@ -0,0 +1,5 @@ +var a = function a() {}; + +({ + obj: function () {} +}); diff --git a/packages/babel-preset-env/test/fixtures/bugfixes/edge-function-name-edge-14/stdout.txt b/packages/babel-preset-env/test/fixtures/bugfixes/edge-function-name-edge-14/stdout.txt new file mode 100644 index 000000000000..7a388e0ae02c --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/bugfixes/edge-function-name-edge-14/stdout.txt @@ -0,0 +1,28 @@ +@babel/preset-env: `DEBUG` option + +Using targets: +{ + "edge": "14" +} + +Using modules transform: auto + +Using plugins: + proposal-nullish-coalescing-operator { "edge":"14" } + proposal-optional-chaining { "edge":"14" } + proposal-json-strings { "edge":"14" } + proposal-optional-catch-binding { "edge":"14" } + transform-parameters { "edge":"14" } + proposal-async-generator-functions { "edge":"14" } + proposal-object-rest-spread { "edge":"14" } + transform-dotall-regex { "edge":"14" } + proposal-unicode-property-regex { "edge":"14" } + transform-named-capturing-groups-regex { "edge":"14" } + transform-async-to-generator { "edge":"14" } + transform-for-of { "edge":"14" } + transform-destructuring { "edge":"14" } + bugfix/transform-edge-function-name { "edge":"14" } + transform-modules-commonjs { "edge":"14" } + proposal-dynamic-import { "edge":"14" } + +Using polyfills: No polyfills were added, since the `useBuiltIns` option was not set. diff --git a/packages/babel-preset-env/test/fixtures/bugfixes/edge-function-name-edge-15/input.js b/packages/babel-preset-env/test/fixtures/bugfixes/edge-function-name-edge-15/input.js new file mode 100644 index 000000000000..17d6a917dc99 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/bugfixes/edge-function-name-edge-15/input.js @@ -0,0 +1,2 @@ +var a = function() {}; +({ obj: function() {} }); \ No newline at end of file diff --git a/packages/babel-preset-env/test/fixtures/bugfixes/edge-function-name-edge-15/options.json b/packages/babel-preset-env/test/fixtures/bugfixes/edge-function-name-edge-15/options.json new file mode 100644 index 000000000000..0fd9478bcb49 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/bugfixes/edge-function-name-edge-15/options.json @@ -0,0 +1,12 @@ +{ + "validateLogs": true, + "presets": [ + ["env", { + "debug": true, + "bugfixes": true, + "targets": { + "edge": "15" + } + }] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/bugfixes/edge-function-name-edge-15/output.js b/packages/babel-preset-env/test/fixtures/bugfixes/edge-function-name-edge-15/output.js new file mode 100644 index 000000000000..41d1e0720ae5 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/bugfixes/edge-function-name-edge-15/output.js @@ -0,0 +1,5 @@ +var a = function a() {}; + +({ + obj: function () {} +}); diff --git a/packages/babel-preset-env/test/fixtures/bugfixes/edge-function-name-edge-15/stdout.txt b/packages/babel-preset-env/test/fixtures/bugfixes/edge-function-name-edge-15/stdout.txt new file mode 100644 index 000000000000..9510c3518847 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/bugfixes/edge-function-name-edge-15/stdout.txt @@ -0,0 +1,25 @@ +@babel/preset-env: `DEBUG` option + +Using targets: +{ + "edge": "15" +} + +Using modules transform: auto + +Using plugins: + proposal-nullish-coalescing-operator { "edge":"15" } + proposal-optional-chaining { "edge":"15" } + proposal-json-strings { "edge":"15" } + proposal-optional-catch-binding { "edge":"15" } + proposal-async-generator-functions { "edge":"15" } + proposal-object-rest-spread { "edge":"15" } + transform-dotall-regex { "edge":"15" } + proposal-unicode-property-regex { "edge":"15" } + transform-named-capturing-groups-regex { "edge":"15" } + bugfix/transform-edge-default-parameters { "edge":"15" } + bugfix/transform-edge-function-name { "edge":"15" } + transform-modules-commonjs { "edge":"15" } + proposal-dynamic-import { "edge":"15" } + +Using polyfills: No polyfills were added, since the `useBuiltIns` option was not set. diff --git a/packages/babel-preset-env/test/fixtures/bugfixes/safari-block-scoping-safari-10-no-bugfixes/input.js b/packages/babel-preset-env/test/fixtures/bugfixes/safari-block-scoping-safari-10-no-bugfixes/input.js new file mode 100644 index 000000000000..22f9d66c9b9d --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/bugfixes/safari-block-scoping-safari-10-no-bugfixes/input.js @@ -0,0 +1,8 @@ +e => { + for (let e of []); +}; + +{ + let a; + { let a; } +} diff --git a/packages/babel-preset-env/test/fixtures/bugfixes/safari-block-scoping-safari-10-no-bugfixes/options.json b/packages/babel-preset-env/test/fixtures/bugfixes/safari-block-scoping-safari-10-no-bugfixes/options.json new file mode 100644 index 000000000000..9effbbf3ad44 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/bugfixes/safari-block-scoping-safari-10-no-bugfixes/options.json @@ -0,0 +1,12 @@ +{ + "validateLogs": true, + "presets": [ + ["env", { + "debug": true, + "bugfixes": false, + "targets": { + "safari": "10" + } + }] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/bugfixes/safari-block-scoping-safari-10-no-bugfixes/output.js b/packages/babel-preset-env/test/fixtures/bugfixes/safari-block-scoping-safari-10-no-bugfixes/output.js new file mode 100644 index 000000000000..ef05e24f4851 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/bugfixes/safari-block-scoping-safari-10-no-bugfixes/output.js @@ -0,0 +1,12 @@ +e => { + for (var _e of []) { + ; + } +}; + +{ + var a; + { + var _a; + } +} diff --git a/packages/babel-preset-env/test/fixtures/bugfixes/safari-block-scoping-safari-10-no-bugfixes/stdout.txt b/packages/babel-preset-env/test/fixtures/bugfixes/safari-block-scoping-safari-10-no-bugfixes/stdout.txt new file mode 100644 index 000000000000..6425e78aaaf7 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/bugfixes/safari-block-scoping-safari-10-no-bugfixes/stdout.txt @@ -0,0 +1,28 @@ +@babel/preset-env: `DEBUG` option + +Using targets: +{ + "safari": "10" +} + +Using modules transform: auto + +Using plugins: + proposal-nullish-coalescing-operator { "safari":"10" } + proposal-optional-chaining { "safari":"10" } + proposal-json-strings { "safari":"10" } + proposal-optional-catch-binding { "safari":"10" } + proposal-async-generator-functions { "safari":"10" } + proposal-object-rest-spread { "safari":"10" } + transform-dotall-regex { "safari":"10" } + proposal-unicode-property-regex { "safari":"10" } + transform-named-capturing-groups-regex { "safari":"10" } + transform-async-to-generator { "safari":"10" } + transform-exponentiation-operator { "safari":"10" } + transform-template-literals { "safari":"10" } + transform-unicode-regex { "safari":"10" } + transform-block-scoping { "safari":"10" } + transform-modules-commonjs { "safari":"10" } + proposal-dynamic-import { "safari":"10" } + +Using polyfills: No polyfills were added, since the `useBuiltIns` option was not set. diff --git a/packages/babel-preset-env/test/fixtures/bugfixes/safari-block-scoping-safari-10/input.js b/packages/babel-preset-env/test/fixtures/bugfixes/safari-block-scoping-safari-10/input.js new file mode 100644 index 000000000000..22f9d66c9b9d --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/bugfixes/safari-block-scoping-safari-10/input.js @@ -0,0 +1,8 @@ +e => { + for (let e of []); +}; + +{ + let a; + { let a; } +} diff --git a/packages/babel-preset-env/test/fixtures/bugfixes/safari-block-scoping-safari-10/options.json b/packages/babel-preset-env/test/fixtures/bugfixes/safari-block-scoping-safari-10/options.json new file mode 100644 index 000000000000..7efdb762bf62 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/bugfixes/safari-block-scoping-safari-10/options.json @@ -0,0 +1,12 @@ +{ + "validateLogs": true, + "presets": [ + ["env", { + "debug": true, + "bugfixes": true, + "targets": { + "safari": "10" + } + }] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/bugfixes/safari-block-scoping-safari-10/output.js b/packages/babel-preset-env/test/fixtures/bugfixes/safari-block-scoping-safari-10/output.js new file mode 100644 index 000000000000..4e92d546c7f7 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/bugfixes/safari-block-scoping-safari-10/output.js @@ -0,0 +1,10 @@ +e => { + for (let _e of []); +}; + +{ + let a; + { + let _a; + } +} diff --git a/packages/babel-preset-env/test/fixtures/bugfixes/safari-block-scoping-safari-10/stdout.txt b/packages/babel-preset-env/test/fixtures/bugfixes/safari-block-scoping-safari-10/stdout.txt new file mode 100644 index 000000000000..779d34b4ba24 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/bugfixes/safari-block-scoping-safari-10/stdout.txt @@ -0,0 +1,29 @@ +@babel/preset-env: `DEBUG` option + +Using targets: +{ + "safari": "10" +} + +Using modules transform: auto + +Using plugins: + proposal-nullish-coalescing-operator { "safari":"10" } + proposal-optional-chaining { "safari":"10" } + proposal-json-strings { "safari":"10" } + proposal-optional-catch-binding { "safari":"10" } + proposal-async-generator-functions { "safari":"10" } + proposal-object-rest-spread { "safari":"10" } + transform-dotall-regex { "safari":"10" } + proposal-unicode-property-regex { "safari":"10" } + transform-named-capturing-groups-regex { "safari":"10" } + transform-async-to-generator { "safari":"10" } + transform-exponentiation-operator { "safari":"10" } + transform-unicode-regex { "safari":"10" } + bugfix/transform-safari-block-shadowing { "safari":"10" } + bugfix/transform-safari-for-shadowing { "safari":"10" } + bugfix/transform-tagged-template-caching { "safari":"10" } + transform-modules-commonjs { "safari":"10" } + proposal-dynamic-import { "safari":"10" } + +Using polyfills: No polyfills were added, since the `useBuiltIns` option was not set. diff --git a/packages/babel-preset-env/test/fixtures/bugfixes/safari-block-scoping-safari-11/input.js b/packages/babel-preset-env/test/fixtures/bugfixes/safari-block-scoping-safari-11/input.js new file mode 100644 index 000000000000..22f9d66c9b9d --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/bugfixes/safari-block-scoping-safari-11/input.js @@ -0,0 +1,8 @@ +e => { + for (let e of []); +}; + +{ + let a; + { let a; } +} diff --git a/packages/babel-preset-env/test/fixtures/bugfixes/safari-block-scoping-safari-11/options.json b/packages/babel-preset-env/test/fixtures/bugfixes/safari-block-scoping-safari-11/options.json new file mode 100644 index 000000000000..453e36fc7027 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/bugfixes/safari-block-scoping-safari-11/options.json @@ -0,0 +1,12 @@ +{ + "validateLogs": true, + "presets": [ + ["env", { + "debug": true, + "bugfixes": true, + "targets": { + "safari": "11" + } + }] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/bugfixes/safari-block-scoping-safari-11/output.js b/packages/babel-preset-env/test/fixtures/bugfixes/safari-block-scoping-safari-11/output.js new file mode 100644 index 000000000000..5bd9c2edb95a --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/bugfixes/safari-block-scoping-safari-11/output.js @@ -0,0 +1,10 @@ +e => { + for (let e of []); +}; + +{ + let a; + { + let a; + } +} diff --git a/packages/babel-preset-env/test/fixtures/bugfixes/safari-block-scoping-safari-11/stdout.txt b/packages/babel-preset-env/test/fixtures/bugfixes/safari-block-scoping-safari-11/stdout.txt new file mode 100644 index 000000000000..e9cfcb3dd8b2 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/bugfixes/safari-block-scoping-safari-11/stdout.txt @@ -0,0 +1,25 @@ +@babel/preset-env: `DEBUG` option + +Using targets: +{ + "safari": "11" +} + +Using modules transform: auto + +Using plugins: + proposal-nullish-coalescing-operator { "safari":"11" } + proposal-optional-chaining { "safari":"11" } + proposal-json-strings { "safari":"11" } + proposal-optional-catch-binding { "safari":"11" } + proposal-async-generator-functions { "safari":"11" } + proposal-object-rest-spread { "safari":"11" } + transform-dotall-regex { "safari":"11" } + proposal-unicode-property-regex { "safari":"11" } + transform-named-capturing-groups-regex { "safari":"11" } + transform-unicode-regex { "safari":"11" } + bugfix/transform-tagged-template-caching { "safari":"11" } + transform-modules-commonjs { "safari":"11" } + proposal-dynamic-import { "safari":"11" } + +Using polyfills: No polyfills were added, since the `useBuiltIns` option was not set. diff --git a/packages/babel-preset-env/test/fixtures/bugfixes/safari-block-scoping-safari-9/input.js b/packages/babel-preset-env/test/fixtures/bugfixes/safari-block-scoping-safari-9/input.js new file mode 100644 index 000000000000..22f9d66c9b9d --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/bugfixes/safari-block-scoping-safari-9/input.js @@ -0,0 +1,8 @@ +e => { + for (let e of []); +}; + +{ + let a; + { let a; } +} diff --git a/packages/babel-preset-env/test/fixtures/bugfixes/safari-block-scoping-safari-9/options.json b/packages/babel-preset-env/test/fixtures/bugfixes/safari-block-scoping-safari-9/options.json new file mode 100644 index 000000000000..9eefa6a6f6f5 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/bugfixes/safari-block-scoping-safari-9/options.json @@ -0,0 +1,13 @@ +{ + "validateLogs": true, + "presets": [ + ["env", { + "debug": true, + "bugfixes": true, + "targets": { + "safari": "9" + }, + "exclude": ["transform-for-of", "transform-arrow-functions"] + }] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/bugfixes/safari-block-scoping-safari-9/output.js b/packages/babel-preset-env/test/fixtures/bugfixes/safari-block-scoping-safari-9/output.js new file mode 100644 index 000000000000..ef05e24f4851 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/bugfixes/safari-block-scoping-safari-9/output.js @@ -0,0 +1,12 @@ +e => { + for (var _e of []) { + ; + } +}; + +{ + var a; + { + var _a; + } +} diff --git a/packages/babel-preset-env/test/fixtures/bugfixes/safari-block-scoping-safari-9/stdout.txt b/packages/babel-preset-env/test/fixtures/bugfixes/safari-block-scoping-safari-9/stdout.txt new file mode 100644 index 000000000000..c1dd2f892833 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/bugfixes/safari-block-scoping-safari-9/stdout.txt @@ -0,0 +1,38 @@ +@babel/preset-env: `DEBUG` option + +Using targets: +{ + "safari": "9" +} + +Using modules transform: auto + +Using plugins: + proposal-nullish-coalescing-operator { "safari":"9" } + proposal-optional-chaining { "safari":"9" } + proposal-json-strings { "safari":"9" } + proposal-optional-catch-binding { "safari":"9" } + transform-parameters { "safari":"9" } + proposal-async-generator-functions { "safari":"9" } + proposal-object-rest-spread { "safari":"9" } + transform-dotall-regex { "safari":"9" } + proposal-unicode-property-regex { "safari":"9" } + transform-named-capturing-groups-regex { "safari":"9" } + transform-async-to-generator { "safari":"9" } + transform-exponentiation-operator { "safari":"9" } + transform-function-name { "safari":"9" } + transform-block-scoped-functions { "safari":"9" } + transform-classes { "safari":"9" } + transform-object-super { "safari":"9" } + transform-sticky-regex { "safari":"9" } + transform-unicode-regex { "safari":"9" } + transform-spread { "safari":"9" } + transform-destructuring { "safari":"9" } + transform-block-scoping { "safari":"9" } + transform-new-target { "safari":"9" } + transform-regenerator { "safari":"9" } + bugfix/transform-tagged-template-caching { "safari":"9" } + transform-modules-commonjs { "safari":"9" } + proposal-dynamic-import { "safari":"9" } + +Using polyfills: No polyfills were added, since the `useBuiltIns` option was not set. diff --git a/packages/babel-preset-env/test/fixtures/corejs2/entry-electron/output.mjs b/packages/babel-preset-env/test/fixtures/corejs2/entry-electron/output.mjs index c71a6a9b4044..8879ad8a39bf 100644 --- a/packages/babel-preset-env/test/fixtures/corejs2/entry-electron/output.mjs +++ b/packages/babel-preset-env/test/fixtures/corejs2/entry-electron/output.mjs @@ -1,6 +1,5 @@ import "core-js/modules/es7.array.flat-map"; import "core-js/modules/es6.array.sort"; -import "core-js/modules/es6.function.bind"; import "core-js/modules/es7.object.define-getter"; import "core-js/modules/es7.object.define-setter"; import "core-js/modules/es7.object.entries"; diff --git a/packages/babel-preset-env/test/fixtures/corejs2/entry-shippedProposals/output.js b/packages/babel-preset-env/test/fixtures/corejs2/entry-shippedProposals/output.js index 6618653a758e..c70b52bf9a03 100644 --- a/packages/babel-preset-env/test/fixtures/corejs2/entry-shippedProposals/output.js +++ b/packages/babel-preset-env/test/fixtures/corejs2/entry-shippedProposals/output.js @@ -298,7 +298,7 @@ require("regenerator-runtime/runtime"); function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } -function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } +function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } @@ -310,7 +310,7 @@ function _awaitAsyncGenerator(value) { return new _AwaitValue(value); } function _wrapAsyncGenerator(fn) { return function () { return new _AsyncGenerator(fn.apply(this, arguments)); }; } -function _AsyncGenerator(gen) { var front, back; function send(key, arg) { return new Promise(function (resolve, reject) { var request = { key: key, arg: arg, resolve: resolve, reject: reject, next: null }; if (back) { back = back.next = request; } else { front = back = request; resume(key, arg); } }); } function resume(key, arg) { try { var result = gen[key](arg); var value = result.value; var wrappedAwait = value instanceof _AwaitValue; Promise.resolve(wrappedAwait ? value.wrapped : value).then(function (arg) { if (wrappedAwait) { resume("next", arg); return; } settle(result.done ? "return" : "normal", arg); }, function (err) { resume("throw", err); }); } catch (err) { settle("throw", err); } } function settle(type, value) { switch (type) { case "return": front.resolve({ value: value, done: true }); break; case "throw": front.reject(value); break; default: front.resolve({ value: value, done: false }); break; } front = front.next; if (front) { resume(front.key, front.arg); } else { back = null; } } this._invoke = send; if (typeof gen["return"] !== "function") { this["return"] = undefined; } } +function _AsyncGenerator(gen) { var front, back; function send(key, arg) { return new Promise(function (resolve, reject) { var request = { key: key, arg: arg, resolve: resolve, reject: reject, next: null }; if (back) { back = back.next = request; } else { front = back = request; resume(key, arg); } }); } function resume(key, arg) { try { var result = gen[key](arg); var value = result.value; var wrappedAwait = value instanceof _AwaitValue; Promise.resolve(wrappedAwait ? value.wrapped : value).then(function (arg) { if (wrappedAwait) { resume(key === "return" ? "return" : "next", arg); return; } settle(result.done ? "return" : "normal", arg); }, function (err) { resume("throw", err); }); } catch (err) { settle("throw", err); } } function settle(type, value) { switch (type) { case "return": front.resolve({ value: value, done: true }); break; case "throw": front.reject(value); break; default: front.resolve({ value: value, done: false }); break; } front = front.next; if (front) { resume(front.key, front.arg); } else { back = null; } } this._invoke = send; if (typeof gen["return"] !== "function") { this["return"] = undefined; } } if (typeof Symbol === "function" && Symbol.asyncIterator) { _AsyncGenerator.prototype[Symbol.asyncIterator] = function () { return this; }; } @@ -342,9 +342,7 @@ function agf() { } function _agf() { - _agf = _wrapAsyncGenerator( - /*#__PURE__*/ - regeneratorRuntime.mark(function _callee() { + _agf = _wrapAsyncGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() { return regeneratorRuntime.wrap(function _callee$(_context) { while (1) { switch (_context.prev = _context.next) { diff --git a/packages/babel-preset-env/test/fixtures/corejs2/usage-browserslist-config-ignore/options.json b/packages/babel-preset-env/test/fixtures/corejs2/usage-browserslist-config-ignore/options.json index f0e1e2cba61d..d7dca0ca75ef 100644 --- a/packages/babel-preset-env/test/fixtures/corejs2/usage-browserslist-config-ignore/options.json +++ b/packages/babel-preset-env/test/fixtures/corejs2/usage-browserslist-config-ignore/options.json @@ -1,4 +1,5 @@ { + "validateLogs": true, "presets": [ [ "../../../../lib", diff --git a/packages/babel-preset-env/test/fixtures/corejs2/usage-browserslist-config-ignore/stdout.txt b/packages/babel-preset-env/test/fixtures/corejs2/usage-browserslist-config-ignore/stdout.txt new file mode 100644 index 000000000000..800eb975dc7c --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/corejs2/usage-browserslist-config-ignore/stdout.txt @@ -0,0 +1,38 @@ +@babel/preset-env: `DEBUG` option + +Using targets: +{ + "android": "61", + "chrome": "61", + "edge": "16", + "firefox": "60", + "ios": "10.3", + "opera": "48", + "safari": "10.1", + "samsung": "8.2" +} + +Using modules transform: false + +Using plugins: + proposal-nullish-coalescing-operator { "android":"61", "chrome":"61", "edge":"16", "firefox":"60", "ios":"10.3", "opera":"48", "safari":"10.1", "samsung":"8.2" } + proposal-optional-chaining { "android":"61", "chrome":"61", "edge":"16", "firefox":"60", "ios":"10.3", "opera":"48", "safari":"10.1", "samsung":"8.2" } + proposal-json-strings { "android":"61", "chrome":"61", "edge":"16", "firefox":"60", "ios":"10.3", "opera":"48", "safari":"10.1", "samsung":"8.2" } + proposal-optional-catch-binding { "android":"61", "chrome":"61", "edge":"16", "ios":"10.3", "opera":"48", "safari":"10.1", "samsung":"8.2" } + transform-parameters { "edge":"16" } + proposal-async-generator-functions { "android":"61", "chrome":"61", "edge":"16", "ios":"10.3", "opera":"48", "safari":"10.1" } + proposal-object-rest-spread { "edge":"16", "ios":"10.3", "safari":"10.1" } + transform-dotall-regex { "android":"61", "chrome":"61", "edge":"16", "firefox":"60", "ios":"10.3", "opera":"48", "safari":"10.1" } + proposal-unicode-property-regex { "android":"61", "chrome":"61", "edge":"16", "firefox":"60", "ios":"10.3", "opera":"48", "safari":"10.1", "samsung":"8.2" } + transform-named-capturing-groups-regex { "android":"61", "chrome":"61", "edge":"16", "firefox":"60", "ios":"10.3", "opera":"48", "safari":"10.1", "samsung":"8.2" } + transform-async-to-generator { "ios":"10.3", "safari":"10.1" } + transform-template-literals { "ios":"10.3", "safari":"10.1" } + transform-function-name { "edge":"16" } + transform-unicode-regex { "ios":"10.3", "safari":"10.1" } + transform-block-scoping { "ios":"10.3", "safari":"10.1" } + syntax-dynamic-import { "android":"61", "chrome":"61", "edge":"16", "firefox":"60", "ios":"10.3", "opera":"48", "safari":"10.1", "samsung":"8.2" } + +Using polyfills with `usage` option: + +[/packages/babel-preset-env/test/fixtures/corejs2/usage-browserslist-config-ignore/input.mjs] Added following core-js polyfill: + web.dom.iterable { "android":"61", "chrome":"61", "edge":"16", "firefox":"60", "ios":"10.3", "opera":"48", "safari":"10.1", "samsung":"8.2" } diff --git a/packages/babel-preset-env/test/fixtures/corejs2/usage-evaluated-not-confident/input.mjs b/packages/babel-preset-env/test/fixtures/corejs2/usage-evaluated-not-confident/input.mjs new file mode 100644 index 000000000000..279b65c0b53e --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/corejs2/usage-evaluated-not-confident/input.mjs @@ -0,0 +1,5 @@ +Object['values'](); // include +[]['map'](); // include + +Object[keys](); // don't include +[][filter](); // don't include diff --git a/packages/babel-preset-env/test/fixtures/corejs2/usage-evaluated-not-confident/options.json b/packages/babel-preset-env/test/fixtures/corejs2/usage-evaluated-not-confident/options.json new file mode 100644 index 000000000000..fe3e4d6cf9c9 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/corejs2/usage-evaluated-not-confident/options.json @@ -0,0 +1,12 @@ +{ + "presets": [ + [ + "../../../../lib", + { + "useBuiltIns": "usage", + "corejs": 2, + "modules": false + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/corejs2/usage-evaluated-not-confident/output.mjs b/packages/babel-preset-env/test/fixtures/corejs2/usage-evaluated-not-confident/output.mjs new file mode 100644 index 000000000000..dfd826b75852 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/corejs2/usage-evaluated-not-confident/output.mjs @@ -0,0 +1,12 @@ +import "core-js/modules/es6.array.map"; +import "core-js/modules/web.dom.iterable"; +import "core-js/modules/es6.array.iterator"; +import "core-js/modules/es6.object.to-string"; +import "core-js/modules/es7.object.values"; +Object['values'](); // include + +[]['map'](); // include + +Object[keys](); // don't include + +[][filter](); // don't include diff --git a/packages/babel-preset-env/test/fixtures/corejs2/usage-for-of-destructure-with/output.mjs b/packages/babel-preset-env/test/fixtures/corejs2/usage-for-of-destructure-with/output.mjs index 18b1bb0bfb15..6762f8384120 100644 --- a/packages/babel-preset-env/test/fixtures/corejs2/usage-for-of-destructure-with/output.mjs +++ b/packages/babel-preset-env/test/fixtures/corejs2/usage-for-of-destructure-with/output.mjs @@ -1,9 +1,8 @@ import "core-js/modules/es7.string.pad-end"; import "core-js/modules/es7.string.pad-start"; -for (const _ref of foo) { - const { - padStart - } = _ref; +for (const { + padStart +} of foo) { console.log('b'.padEnd(5)); } diff --git a/packages/babel-preset-env/test/fixtures/corejs2/usage-modules-namespaced/input.mjs b/packages/babel-preset-env/test/fixtures/corejs2/usage-modules-namespaced/input.mjs new file mode 100644 index 000000000000..3f57abb6052e --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/corejs2/usage-modules-namespaced/input.mjs @@ -0,0 +1,2 @@ +import * as ns from "ns"; +ns.map; diff --git a/packages/babel-preset-env/test/fixtures/corejs2/usage-modules-namespaced/options.json b/packages/babel-preset-env/test/fixtures/corejs2/usage-modules-namespaced/options.json new file mode 100644 index 000000000000..429ee132c960 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/corejs2/usage-modules-namespaced/options.json @@ -0,0 +1,12 @@ +{ + "presets": [ + [ + "../../../../lib", + { + "modules": false, + "useBuiltIns": "usage", + "corejs": 2 + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/corejs2/usage-modules-namespaced/output.mjs b/packages/babel-preset-env/test/fixtures/corejs2/usage-modules-namespaced/output.mjs new file mode 100644 index 000000000000..4efb9b0a495f --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/corejs2/usage-modules-namespaced/output.mjs @@ -0,0 +1,3 @@ +import * as ns from "ns"; +ns.map; + diff --git a/packages/babel-preset-env/test/fixtures/corejs2/usage-regenerator-used-async/output.mjs b/packages/babel-preset-env/test/fixtures/corejs2/usage-regenerator-used-async/output.mjs index db18b8bfe116..d6e9c55f3e2b 100644 --- a/packages/babel-preset-env/test/fixtures/corejs2/usage-regenerator-used-async/output.mjs +++ b/packages/babel-preset-env/test/fixtures/corejs2/usage-regenerator-used-async/output.mjs @@ -11,9 +11,7 @@ function a() { } function _a() { - _a = _asyncToGenerator( - /*#__PURE__*/ - regeneratorRuntime.mark(function _callee() { + _a = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() { return regeneratorRuntime.wrap(function _callee$(_context) { while (1) { switch (_context.prev = _context.next) { diff --git a/packages/babel-preset-env/test/fixtures/corejs2/usage-regenerator-used-generator/output.mjs b/packages/babel-preset-env/test/fixtures/corejs2/usage-regenerator-used-generator/output.mjs index ce5acd262e9f..62d15abf1f61 100644 --- a/packages/babel-preset-env/test/fixtures/corejs2/usage-regenerator-used-generator/output.mjs +++ b/packages/babel-preset-env/test/fixtures/corejs2/usage-regenerator-used-generator/output.mjs @@ -1,8 +1,6 @@ import "regenerator-runtime/runtime"; -var _marked = -/*#__PURE__*/ -regeneratorRuntime.mark(a); +var _marked = /*#__PURE__*/regeneratorRuntime.mark(a); function a() { return regeneratorRuntime.wrap(function a$(_context) { diff --git a/packages/babel-preset-env/test/fixtures/corejs2/usage-remove-babel-polyfill-import/options.json b/packages/babel-preset-env/test/fixtures/corejs2/usage-remove-babel-polyfill-import/options.json index fe3e4d6cf9c9..71b68e4379e7 100644 --- a/packages/babel-preset-env/test/fixtures/corejs2/usage-remove-babel-polyfill-import/options.json +++ b/packages/babel-preset-env/test/fixtures/corejs2/usage-remove-babel-polyfill-import/options.json @@ -1,4 +1,5 @@ { + "validateLogs": true, "presets": [ [ "../../../../lib", diff --git a/packages/babel-preset-env/test/fixtures/corejs2/usage-remove-babel-polyfill-import/output.mjs b/packages/babel-preset-env/test/fixtures/corejs2/usage-remove-babel-polyfill-import/output.mjs new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/packages/babel-preset-env/test/fixtures/corejs2/usage-remove-babel-polyfill-import/stderr.txt b/packages/babel-preset-env/test/fixtures/corejs2/usage-remove-babel-polyfill-import/stderr.txt new file mode 100644 index 000000000000..6234fa874573 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/corejs2/usage-remove-babel-polyfill-import/stderr.txt @@ -0,0 +1,11 @@ +When setting `useBuiltIns: 'usage'`, polyfills are automatically imported when needed. + Please remove the `import '@babel/polyfill'` call or use `useBuiltIns: 'entry'` instead. + + When setting `useBuiltIns: 'usage'`, polyfills are automatically imported when needed. + Please remove the `import '@babel/polyfill'` call or use `useBuiltIns: 'entry'` instead. + + When setting `useBuiltIns: 'usage'`, polyfills are automatically imported when needed. + Please remove the `import '@babel/polyfill'` call or use `useBuiltIns: 'entry'` instead. + + When setting `useBuiltIns: 'usage'`, polyfills are automatically imported when needed. + Please remove the `import '@babel/polyfill'` call or use `useBuiltIns: 'entry'` instead. diff --git a/packages/babel-preset-env/test/fixtures/corejs2/usage-shippedProposals/output.js b/packages/babel-preset-env/test/fixtures/corejs2/usage-shippedProposals/output.js index 341d5845145e..0494407264d1 100644 --- a/packages/babel-preset-env/test/fixtures/corejs2/usage-shippedProposals/output.js +++ b/packages/babel-preset-env/test/fixtures/corejs2/usage-shippedProposals/output.js @@ -30,7 +30,7 @@ require("core-js/modules/es6.object.to-string"); function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } -function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } +function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } @@ -42,7 +42,7 @@ function _awaitAsyncGenerator(value) { return new _AwaitValue(value); } function _wrapAsyncGenerator(fn) { return function () { return new _AsyncGenerator(fn.apply(this, arguments)); }; } -function _AsyncGenerator(gen) { var front, back; function send(key, arg) { return new Promise(function (resolve, reject) { var request = { key: key, arg: arg, resolve: resolve, reject: reject, next: null }; if (back) { back = back.next = request; } else { front = back = request; resume(key, arg); } }); } function resume(key, arg) { try { var result = gen[key](arg); var value = result.value; var wrappedAwait = value instanceof _AwaitValue; Promise.resolve(wrappedAwait ? value.wrapped : value).then(function (arg) { if (wrappedAwait) { resume("next", arg); return; } settle(result.done ? "return" : "normal", arg); }, function (err) { resume("throw", err); }); } catch (err) { settle("throw", err); } } function settle(type, value) { switch (type) { case "return": front.resolve({ value: value, done: true }); break; case "throw": front.reject(value); break; default: front.resolve({ value: value, done: false }); break; } front = front.next; if (front) { resume(front.key, front.arg); } else { back = null; } } this._invoke = send; if (typeof gen["return"] !== "function") { this["return"] = undefined; } } +function _AsyncGenerator(gen) { var front, back; function send(key, arg) { return new Promise(function (resolve, reject) { var request = { key: key, arg: arg, resolve: resolve, reject: reject, next: null }; if (back) { back = back.next = request; } else { front = back = request; resume(key, arg); } }); } function resume(key, arg) { try { var result = gen[key](arg); var value = result.value; var wrappedAwait = value instanceof _AwaitValue; Promise.resolve(wrappedAwait ? value.wrapped : value).then(function (arg) { if (wrappedAwait) { resume(key === "return" ? "return" : "next", arg); return; } settle(result.done ? "return" : "normal", arg); }, function (err) { resume("throw", err); }); } catch (err) { settle("throw", err); } } function settle(type, value) { switch (type) { case "return": front.resolve({ value: value, done: true }); break; case "throw": front.reject(value); break; default: front.resolve({ value: value, done: false }); break; } front = front.next; if (front) { resume(front.key, front.arg); } else { back = null; } } this._invoke = send; if (typeof gen["return"] !== "function") { this["return"] = undefined; } } if (typeof Symbol === "function" && Symbol.asyncIterator) { _AsyncGenerator.prototype[Symbol.asyncIterator] = function () { return this; }; } @@ -74,9 +74,7 @@ function agf() { } function _agf() { - _agf = _wrapAsyncGenerator( - /*#__PURE__*/ - regeneratorRuntime.mark(function _callee() { + _agf = _wrapAsyncGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() { return regeneratorRuntime.wrap(function _callee$(_context) { while (1) { switch (_context.prev = _context.next) { diff --git a/packages/babel-preset-env/test/fixtures/corejs3/entry-all-chrome-71/output.mjs b/packages/babel-preset-env/test/fixtures/corejs3/entry-all-chrome-71/output.mjs index b0bfda361f5d..efa4728cac88 100644 --- a/packages/babel-preset-env/test/fixtures/corejs3/entry-all-chrome-71/output.mjs +++ b/packages/babel-preset-env/test/fixtures/corejs3/entry-all-chrome-71/output.mjs @@ -1,5 +1,6 @@ import "core-js/modules/es.array.unscopables.flat"; import "core-js/modules/es.array.unscopables.flat-map"; +import "core-js/modules/es.math.hypot"; import "core-js/modules/es.object.from-entries"; import "core-js/modules/esnext.aggregate-error"; import "core-js/modules/esnext.array.last-index"; @@ -70,6 +71,7 @@ import "core-js/modules/esnext.set.symmetric-difference"; import "core-js/modules/esnext.set.union"; import "core-js/modules/esnext.string.at"; import "core-js/modules/esnext.string.code-points"; +import "core-js/modules/esnext.string.match-all"; import "core-js/modules/esnext.string.replace-all"; import "core-js/modules/esnext.symbol.dispose"; import "core-js/modules/esnext.symbol.observable"; @@ -82,4 +84,3 @@ import "core-js/modules/esnext.weak-set.delete-all"; import "core-js/modules/esnext.weak-set.from"; import "core-js/modules/esnext.weak-set.of"; import "core-js/modules/web.immediate"; -import "core-js/modules/esnext.string.match-all"; diff --git a/packages/babel-preset-env/test/fixtures/corejs3/entry-all/output.mjs b/packages/babel-preset-env/test/fixtures/corejs3/entry-all/output.mjs index d1fd6163046e..de6d3f35f1d0 100644 --- a/packages/babel-preset-env/test/fixtures/corejs3/entry-all/output.mjs +++ b/packages/babel-preset-env/test/fixtures/corejs3/entry-all/output.mjs @@ -268,6 +268,7 @@ import "core-js/modules/esnext.set.symmetric-difference"; import "core-js/modules/esnext.set.union"; import "core-js/modules/esnext.string.at"; import "core-js/modules/esnext.string.code-points"; +import "core-js/modules/esnext.string.match-all"; import "core-js/modules/esnext.string.replace-all"; import "core-js/modules/esnext.symbol.dispose"; import "core-js/modules/esnext.symbol.observable"; @@ -287,5 +288,4 @@ import "core-js/modules/web.timers"; import "core-js/modules/web.url"; import "core-js/modules/web.url.to-json"; import "core-js/modules/web.url-search-params"; -import "core-js/modules/esnext.string.match-all"; import 'regenerator-runtime/runtime'; diff --git a/packages/babel-preset-env/test/fixtures/corejs3/entry-babel-polyfill/options.json b/packages/babel-preset-env/test/fixtures/corejs3/entry-babel-polyfill/options.json index fe930890ee20..1b870fc5224a 100644 --- a/packages/babel-preset-env/test/fixtures/corejs3/entry-babel-polyfill/options.json +++ b/packages/babel-preset-env/test/fixtures/corejs3/entry-babel-polyfill/options.json @@ -1,4 +1,5 @@ { + "validateLogs": true, "presets": [ [ "../../../../lib", diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-babel-polyfill/stderr.txt b/packages/babel-preset-env/test/fixtures/corejs3/entry-babel-polyfill/stderr.txt similarity index 100% rename from packages/babel-preset-env/test/debug-fixtures/entry-corejs3-babel-polyfill/stderr.txt rename to packages/babel-preset-env/test/fixtures/corejs3/entry-babel-polyfill/stderr.txt diff --git a/packages/babel-preset-env/test/fixtures/corejs3/entry-chrome-48/output.mjs b/packages/babel-preset-env/test/fixtures/corejs3/entry-chrome-48/output.mjs index 4714da27c5b2..064f9d4a4469 100644 --- a/packages/babel-preset-env/test/fixtures/corejs3/entry-chrome-48/output.mjs +++ b/packages/babel-preset-env/test/fixtures/corejs3/entry-chrome-48/output.mjs @@ -28,6 +28,7 @@ import "core-js/modules/es.function.has-instance"; import "core-js/modules/es.json.to-string-tag"; import "core-js/modules/es.map"; import "core-js/modules/es.math.acosh"; +import "core-js/modules/es.math.hypot"; import "core-js/modules/es.math.to-string-tag"; import "core-js/modules/es.object.assign"; import "core-js/modules/es.object.define-getter"; diff --git a/packages/babel-preset-env/test/fixtures/corejs3/entry-chrome-49/output.mjs b/packages/babel-preset-env/test/fixtures/corejs3/entry-chrome-49/output.mjs index d38ec2742978..add5d817c3ca 100644 --- a/packages/babel-preset-env/test/fixtures/corejs3/entry-chrome-49/output.mjs +++ b/packages/babel-preset-env/test/fixtures/corejs3/entry-chrome-49/output.mjs @@ -26,6 +26,7 @@ import "core-js/modules/es.function.has-instance"; import "core-js/modules/es.json.to-string-tag"; import "core-js/modules/es.map"; import "core-js/modules/es.math.acosh"; +import "core-js/modules/es.math.hypot"; import "core-js/modules/es.math.to-string-tag"; import "core-js/modules/es.object.define-getter"; import "core-js/modules/es.object.define-setter"; diff --git a/packages/babel-preset-env/test/fixtures/corejs3/entry-chrome-66/output.mjs b/packages/babel-preset-env/test/fixtures/corejs3/entry-chrome-66/output.mjs index f367b9447dc2..8051a9cde054 100644 --- a/packages/babel-preset-env/test/fixtures/corejs3/entry-chrome-66/output.mjs +++ b/packages/babel-preset-env/test/fixtures/corejs3/entry-chrome-66/output.mjs @@ -3,12 +3,15 @@ import "core-js/modules/es.array.flat"; import "core-js/modules/es.array.flat-map"; import "core-js/modules/es.array.unscopables.flat"; import "core-js/modules/es.array.unscopables.flat-map"; +import "core-js/modules/es.math.hypot"; import "core-js/modules/es.object.from-entries"; import "core-js/modules/es.promise"; import "core-js/modules/es.promise.finally"; import "core-js/modules/web.immediate"; import "core-js/modules/web.queue-microtask"; +import "core-js/modules/web.url"; import "core-js/modules/web.url.to-json"; +import "core-js/modules/web.url-search-params"; const foo = { a: true }; diff --git a/packages/babel-preset-env/test/fixtures/corejs3/entry-chrome-71/output.mjs b/packages/babel-preset-env/test/fixtures/corejs3/entry-chrome-71/output.mjs index e7e57e8ebb0d..7ff494cd47e4 100644 --- a/packages/babel-preset-env/test/fixtures/corejs3/entry-chrome-71/output.mjs +++ b/packages/babel-preset-env/test/fixtures/corejs3/entry-chrome-71/output.mjs @@ -1,5 +1,6 @@ import "core-js/modules/es.array.unscopables.flat"; import "core-js/modules/es.array.unscopables.flat-map"; +import "core-js/modules/es.math.hypot"; import "core-js/modules/es.object.from-entries"; import "core-js/modules/web.immediate"; const foo = { diff --git a/packages/babel-preset-env/test/fixtures/corejs3/entry-chromeandroid/output.mjs b/packages/babel-preset-env/test/fixtures/corejs3/entry-chromeandroid/output.mjs index e3be757cb2a9..929415b8b20e 100644 --- a/packages/babel-preset-env/test/fixtures/corejs3/entry-chromeandroid/output.mjs +++ b/packages/babel-preset-env/test/fixtures/corejs3/entry-chromeandroid/output.mjs @@ -6,6 +6,7 @@ import "core-js/modules/es.array.iterator"; import "core-js/modules/es.array.sort"; import "core-js/modules/es.array.unscopables.flat"; import "core-js/modules/es.array.unscopables.flat-map"; +import "core-js/modules/es.math.hypot"; import "core-js/modules/es.object.define-getter"; import "core-js/modules/es.object.define-setter"; import "core-js/modules/es.object.from-entries"; diff --git a/packages/babel-preset-env/test/fixtures/corejs3/entry-electron/output.mjs b/packages/babel-preset-env/test/fixtures/corejs3/entry-electron/output.mjs index daf15be68f3a..34a798940e85 100644 --- a/packages/babel-preset-env/test/fixtures/corejs3/entry-electron/output.mjs +++ b/packages/babel-preset-env/test/fixtures/corejs3/entry-electron/output.mjs @@ -6,6 +6,7 @@ import "core-js/modules/es.array.iterator"; import "core-js/modules/es.array.sort"; import "core-js/modules/es.array.unscopables.flat"; import "core-js/modules/es.array.unscopables.flat-map"; +import "core-js/modules/es.math.hypot"; import "core-js/modules/es.object.define-getter"; import "core-js/modules/es.object.define-setter"; import "core-js/modules/es.object.from-entries"; diff --git a/packages/babel-preset-env/test/fixtures/corejs3/entry-entries-es-proposals-stage-chrome-71/output.mjs b/packages/babel-preset-env/test/fixtures/corejs3/entry-entries-es-proposals-stage-chrome-71/output.mjs index a6c680fa982e..be5df68026ae 100644 --- a/packages/babel-preset-env/test/fixtures/corejs3/entry-entries-es-proposals-stage-chrome-71/output.mjs +++ b/packages/babel-preset-env/test/fixtures/corejs3/entry-entries-es-proposals-stage-chrome-71/output.mjs @@ -1,5 +1,6 @@ import "core-js/modules/es.array.unscopables.flat"; import "core-js/modules/es.array.unscopables.flat-map"; +import "core-js/modules/es.math.hypot"; import "core-js/modules/es.object.from-entries"; import "core-js/modules/esnext.aggregate-error"; import "core-js/modules/esnext.array.last-index"; @@ -70,6 +71,7 @@ import "core-js/modules/esnext.set.symmetric-difference"; import "core-js/modules/esnext.set.union"; import "core-js/modules/esnext.string.at"; import "core-js/modules/esnext.string.code-points"; +import "core-js/modules/esnext.string.match-all"; import "core-js/modules/esnext.string.replace-all"; import "core-js/modules/esnext.symbol.dispose"; import "core-js/modules/esnext.symbol.observable"; @@ -81,4 +83,3 @@ import "core-js/modules/esnext.weak-set.add-all"; import "core-js/modules/esnext.weak-set.delete-all"; import "core-js/modules/esnext.weak-set.from"; import "core-js/modules/esnext.weak-set.of"; -import "core-js/modules/esnext.string.match-all"; diff --git a/packages/babel-preset-env/test/fixtures/corejs3/entry-entries-es-proposals-stage/output.mjs b/packages/babel-preset-env/test/fixtures/corejs3/entry-entries-es-proposals-stage/output.mjs index c90f59ea1482..51a04c11f07a 100644 --- a/packages/babel-preset-env/test/fixtures/corejs3/entry-entries-es-proposals-stage/output.mjs +++ b/packages/babel-preset-env/test/fixtures/corejs3/entry-entries-es-proposals-stage/output.mjs @@ -268,6 +268,7 @@ import "core-js/modules/esnext.set.symmetric-difference"; import "core-js/modules/esnext.set.union"; import "core-js/modules/esnext.string.at"; import "core-js/modules/esnext.string.code-points"; +import "core-js/modules/esnext.string.match-all"; import "core-js/modules/esnext.string.replace-all"; import "core-js/modules/esnext.symbol.dispose"; import "core-js/modules/esnext.symbol.observable"; @@ -282,5 +283,4 @@ import "core-js/modules/esnext.weak-set.of"; import "core-js/modules/web.url"; import "core-js/modules/web.url.to-json"; import "core-js/modules/web.url-search-params"; -import "core-js/modules/esnext.string.match-all"; import 'regenerator-runtime/runtime'; diff --git a/packages/babel-preset-env/test/fixtures/corejs3/entry-entries-modules-chrome-71/output.mjs b/packages/babel-preset-env/test/fixtures/corejs3/entry-entries-modules-chrome-71/output.mjs index 44a025d6a453..55d6e9dbd5c4 100644 --- a/packages/babel-preset-env/test/fixtures/corejs3/entry-entries-modules-chrome-71/output.mjs +++ b/packages/babel-preset-env/test/fixtures/corejs3/entry-entries-modules-chrome-71/output.mjs @@ -1,2 +1,2 @@ -import "core-js/modules/es.object.from-entries"; -import "core-js/modules/esnext.string.replace-all"; +import 'core-js/modules/es.object.from-entries'; +import 'core-js/modules/esnext.string.replace-all'; diff --git a/packages/babel-preset-env/test/fixtures/corejs3/entry-entries-modules/output.mjs b/packages/babel-preset-env/test/fixtures/corejs3/entry-entries-modules/output.mjs index 16b33e2fd0b9..e761a4ac12c5 100644 --- a/packages/babel-preset-env/test/fixtures/corejs3/entry-entries-modules/output.mjs +++ b/packages/babel-preset-env/test/fixtures/corejs3/entry-entries-modules/output.mjs @@ -1,3 +1,3 @@ -import "core-js/modules/es.symbol"; -import "core-js/modules/es.object.from-entries"; -import "core-js/modules/esnext.string.replace-all"; +import 'core-js/modules/es.symbol'; +import 'core-js/modules/es.object.from-entries'; +import 'core-js/modules/esnext.string.replace-all'; diff --git a/packages/babel-preset-env/test/fixtures/corejs3/entry-entries-proposals-chrome-71/output.mjs b/packages/babel-preset-env/test/fixtures/corejs3/entry-entries-proposals-chrome-71/output.mjs index 56b2198265f2..c010a7b5fccb 100644 --- a/packages/babel-preset-env/test/fixtures/corejs3/entry-entries-proposals-chrome-71/output.mjs +++ b/packages/babel-preset-env/test/fixtures/corejs3/entry-entries-proposals-chrome-71/output.mjs @@ -67,6 +67,7 @@ import "core-js/modules/esnext.set.symmetric-difference"; import "core-js/modules/esnext.set.union"; import "core-js/modules/esnext.string.at"; import "core-js/modules/esnext.string.code-points"; +import "core-js/modules/esnext.string.match-all"; import "core-js/modules/esnext.string.replace-all"; import "core-js/modules/esnext.symbol.dispose"; import "core-js/modules/esnext.symbol.observable"; @@ -78,4 +79,3 @@ import "core-js/modules/esnext.weak-set.add-all"; import "core-js/modules/esnext.weak-set.delete-all"; import "core-js/modules/esnext.weak-set.from"; import "core-js/modules/esnext.weak-set.of"; -import "core-js/modules/esnext.string.match-all"; diff --git a/packages/babel-preset-env/test/fixtures/corejs3/entry-entries-proposals/output.mjs b/packages/babel-preset-env/test/fixtures/corejs3/entry-entries-proposals/output.mjs index 65c37496e056..d59c98b71768 100644 --- a/packages/babel-preset-env/test/fixtures/corejs3/entry-entries-proposals/output.mjs +++ b/packages/babel-preset-env/test/fixtures/corejs3/entry-entries-proposals/output.mjs @@ -68,6 +68,7 @@ import "core-js/modules/esnext.set.symmetric-difference"; import "core-js/modules/esnext.set.union"; import "core-js/modules/esnext.string.at"; import "core-js/modules/esnext.string.code-points"; +import "core-js/modules/esnext.string.match-all"; import "core-js/modules/esnext.string.replace-all"; import "core-js/modules/esnext.symbol.dispose"; import "core-js/modules/esnext.symbol.observable"; @@ -82,5 +83,4 @@ import "core-js/modules/esnext.weak-set.of"; import "core-js/modules/web.url"; import "core-js/modules/web.url.to-json"; import "core-js/modules/web.url-search-params"; -import "core-js/modules/esnext.string.match-all"; import 'regenerator-runtime/runtime'; diff --git a/packages/babel-preset-env/test/fixtures/corejs3/entry-entries-stage-chrome-71/output.mjs b/packages/babel-preset-env/test/fixtures/corejs3/entry-entries-stage-chrome-71/output.mjs index 56b2198265f2..c010a7b5fccb 100644 --- a/packages/babel-preset-env/test/fixtures/corejs3/entry-entries-stage-chrome-71/output.mjs +++ b/packages/babel-preset-env/test/fixtures/corejs3/entry-entries-stage-chrome-71/output.mjs @@ -67,6 +67,7 @@ import "core-js/modules/esnext.set.symmetric-difference"; import "core-js/modules/esnext.set.union"; import "core-js/modules/esnext.string.at"; import "core-js/modules/esnext.string.code-points"; +import "core-js/modules/esnext.string.match-all"; import "core-js/modules/esnext.string.replace-all"; import "core-js/modules/esnext.symbol.dispose"; import "core-js/modules/esnext.symbol.observable"; @@ -78,4 +79,3 @@ import "core-js/modules/esnext.weak-set.add-all"; import "core-js/modules/esnext.weak-set.delete-all"; import "core-js/modules/esnext.weak-set.from"; import "core-js/modules/esnext.weak-set.of"; -import "core-js/modules/esnext.string.match-all"; diff --git a/packages/babel-preset-env/test/fixtures/corejs3/entry-entries-stage/output.mjs b/packages/babel-preset-env/test/fixtures/corejs3/entry-entries-stage/output.mjs index 65c37496e056..d59c98b71768 100644 --- a/packages/babel-preset-env/test/fixtures/corejs3/entry-entries-stage/output.mjs +++ b/packages/babel-preset-env/test/fixtures/corejs3/entry-entries-stage/output.mjs @@ -68,6 +68,7 @@ import "core-js/modules/esnext.set.symmetric-difference"; import "core-js/modules/esnext.set.union"; import "core-js/modules/esnext.string.at"; import "core-js/modules/esnext.string.code-points"; +import "core-js/modules/esnext.string.match-all"; import "core-js/modules/esnext.string.replace-all"; import "core-js/modules/esnext.symbol.dispose"; import "core-js/modules/esnext.symbol.observable"; @@ -82,5 +83,4 @@ import "core-js/modules/esnext.weak-set.of"; import "core-js/modules/web.url"; import "core-js/modules/web.url.to-json"; import "core-js/modules/web.url-search-params"; -import "core-js/modules/esnext.string.match-all"; import 'regenerator-runtime/runtime'; diff --git a/packages/babel-preset-env/test/fixtures/corejs3/entry-ie-11/output.mjs b/packages/babel-preset-env/test/fixtures/corejs3/entry-ie-11/output.mjs index f6b2431273cf..8f5bacb3d250 100644 --- a/packages/babel-preset-env/test/fixtures/corejs3/entry-ie-11/output.mjs +++ b/packages/babel-preset-env/test/fixtures/corejs3/entry-ie-11/output.mjs @@ -14,19 +14,26 @@ import "core-js/modules/es.symbol.to-string-tag"; import "core-js/modules/es.symbol.unscopables"; import "core-js/modules/es.array.concat"; import "core-js/modules/es.array.copy-within"; +import "core-js/modules/es.array.every"; import "core-js/modules/es.array.fill"; import "core-js/modules/es.array.filter"; import "core-js/modules/es.array.find"; import "core-js/modules/es.array.find-index"; import "core-js/modules/es.array.flat"; import "core-js/modules/es.array.flat-map"; +import "core-js/modules/es.array.for-each"; import "core-js/modules/es.array.from"; import "core-js/modules/es.array.includes"; +import "core-js/modules/es.array.index-of"; import "core-js/modules/es.array.iterator"; import "core-js/modules/es.array.join"; +import "core-js/modules/es.array.last-index-of"; import "core-js/modules/es.array.map"; import "core-js/modules/es.array.of"; +import "core-js/modules/es.array.reduce"; +import "core-js/modules/es.array.reduce-right"; import "core-js/modules/es.array.slice"; +import "core-js/modules/es.array.some"; import "core-js/modules/es.array.species"; import "core-js/modules/es.array.splice"; import "core-js/modules/es.array.unscopables.flat"; @@ -103,6 +110,7 @@ import "core-js/modules/es.reflect.prevent-extensions"; import "core-js/modules/es.reflect.set"; import "core-js/modules/es.reflect.set-prototype-of"; import "core-js/modules/es.regexp.constructor"; +import "core-js/modules/es.regexp.exec"; import "core-js/modules/es.regexp.flags"; import "core-js/modules/es.regexp.to-string"; import "core-js/modules/es.set"; diff --git a/packages/babel-preset-env/test/fixtures/corejs3/entry-ie-9/output.mjs b/packages/babel-preset-env/test/fixtures/corejs3/entry-ie-9/output.mjs index 80f642659b89..4882a3abee1d 100644 --- a/packages/babel-preset-env/test/fixtures/corejs3/entry-ie-9/output.mjs +++ b/packages/babel-preset-env/test/fixtures/corejs3/entry-ie-9/output.mjs @@ -14,19 +14,26 @@ import "core-js/modules/es.symbol.to-string-tag"; import "core-js/modules/es.symbol.unscopables"; import "core-js/modules/es.array.concat"; import "core-js/modules/es.array.copy-within"; +import "core-js/modules/es.array.every"; import "core-js/modules/es.array.fill"; import "core-js/modules/es.array.filter"; import "core-js/modules/es.array.find"; import "core-js/modules/es.array.find-index"; import "core-js/modules/es.array.flat"; import "core-js/modules/es.array.flat-map"; +import "core-js/modules/es.array.for-each"; import "core-js/modules/es.array.from"; import "core-js/modules/es.array.includes"; +import "core-js/modules/es.array.index-of"; import "core-js/modules/es.array.iterator"; import "core-js/modules/es.array.join"; +import "core-js/modules/es.array.last-index-of"; import "core-js/modules/es.array.map"; import "core-js/modules/es.array.of"; +import "core-js/modules/es.array.reduce"; +import "core-js/modules/es.array.reduce-right"; import "core-js/modules/es.array.slice"; +import "core-js/modules/es.array.some"; import "core-js/modules/es.array.species"; import "core-js/modules/es.array.splice"; import "core-js/modules/es.array.unscopables.flat"; @@ -107,6 +114,7 @@ import "core-js/modules/es.reflect.prevent-extensions"; import "core-js/modules/es.reflect.set"; import "core-js/modules/es.reflect.set-prototype-of"; import "core-js/modules/es.regexp.constructor"; +import "core-js/modules/es.regexp.exec"; import "core-js/modules/es.regexp.flags"; import "core-js/modules/es.regexp.to-string"; import "core-js/modules/es.set"; diff --git a/packages/babel-preset-env/test/fixtures/corejs3/entry-import/output.mjs b/packages/babel-preset-env/test/fixtures/corejs3/entry-import/output.mjs index f891a16256c3..1332106cce0a 100644 --- a/packages/babel-preset-env/test/fixtures/corejs3/entry-import/output.mjs +++ b/packages/babel-preset-env/test/fixtures/corejs3/entry-import/output.mjs @@ -6,6 +6,7 @@ import "core-js/modules/es.array.iterator"; import "core-js/modules/es.array.sort"; import "core-js/modules/es.array.unscopables.flat"; import "core-js/modules/es.array.unscopables.flat-map"; +import "core-js/modules/es.math.hypot"; import "core-js/modules/es.object.define-getter"; import "core-js/modules/es.object.define-setter"; import "core-js/modules/es.object.from-entries"; diff --git a/packages/babel-preset-env/test/fixtures/corejs3/entry-node-10.13/output.mjs b/packages/babel-preset-env/test/fixtures/corejs3/entry-node-10.13/output.mjs index ff125b389f5e..dd8a2c20f45c 100644 --- a/packages/babel-preset-env/test/fixtures/corejs3/entry-node-10.13/output.mjs +++ b/packages/babel-preset-env/test/fixtures/corejs3/entry-node-10.13/output.mjs @@ -3,5 +3,6 @@ import "core-js/modules/es.array.flat"; import "core-js/modules/es.array.flat-map"; import "core-js/modules/es.array.unscopables.flat"; import "core-js/modules/es.array.unscopables.flat-map"; +import "core-js/modules/es.math.hypot"; import "core-js/modules/es.object.from-entries"; import "core-js/modules/web.queue-microtask"; diff --git a/packages/babel-preset-env/test/fixtures/corejs3/entry-node-11/output.mjs b/packages/babel-preset-env/test/fixtures/corejs3/entry-node-11/output.mjs index d8b2d0eb8b78..db959e64958b 100644 --- a/packages/babel-preset-env/test/fixtures/corejs3/entry-node-11/output.mjs +++ b/packages/babel-preset-env/test/fixtures/corejs3/entry-node-11/output.mjs @@ -1,4 +1,5 @@ import "core-js/modules/es.array.unscopables.flat"; import "core-js/modules/es.array.unscopables.flat-map"; +import "core-js/modules/es.math.hypot"; import "core-js/modules/es.object.from-entries"; import "core-js/modules/web.queue-microtask"; diff --git a/packages/babel-preset-env/test/fixtures/corejs3/entry-node-web/output.mjs b/packages/babel-preset-env/test/fixtures/corejs3/entry-node-web/output.mjs index d5e59efa8f02..cd01fb3f1a40 100644 --- a/packages/babel-preset-env/test/fixtures/corejs3/entry-node-web/output.mjs +++ b/packages/babel-preset-env/test/fixtures/corejs3/entry-node-web/output.mjs @@ -6,6 +6,7 @@ import "core-js/modules/es.array.iterator"; import "core-js/modules/es.array.sort"; import "core-js/modules/es.array.unscopables.flat"; import "core-js/modules/es.array.unscopables.flat-map"; +import "core-js/modules/es.math.hypot"; import "core-js/modules/es.object.define-getter"; import "core-js/modules/es.object.define-setter"; import "core-js/modules/es.object.from-entries"; diff --git a/packages/babel-preset-env/test/fixtures/corejs3/entry-node/output.mjs b/packages/babel-preset-env/test/fixtures/corejs3/entry-node/output.mjs index 87a92e7348c0..a3a45d940508 100644 --- a/packages/babel-preset-env/test/fixtures/corejs3/entry-node/output.mjs +++ b/packages/babel-preset-env/test/fixtures/corejs3/entry-node/output.mjs @@ -6,6 +6,7 @@ import "core-js/modules/es.array.iterator"; import "core-js/modules/es.array.sort"; import "core-js/modules/es.array.unscopables.flat"; import "core-js/modules/es.array.unscopables.flat-map"; +import "core-js/modules/es.math.hypot"; import "core-js/modules/es.object.define-getter"; import "core-js/modules/es.object.define-setter"; import "core-js/modules/es.object.from-entries"; diff --git a/packages/babel-preset-env/test/fixtures/corejs3/entry-require-all/output.js b/packages/babel-preset-env/test/fixtures/corejs3/entry-require-all/output.js index ac1379a63561..788e39cdfeb8 100644 --- a/packages/babel-preset-env/test/fixtures/corejs3/entry-require-all/output.js +++ b/packages/babel-preset-env/test/fixtures/corejs3/entry-require-all/output.js @@ -14,6 +14,8 @@ require("core-js/modules/es.array.unscopables.flat"); require("core-js/modules/es.array.unscopables.flat-map"); +require("core-js/modules/es.math.hypot"); + require("core-js/modules/es.object.define-getter"); require("core-js/modules/es.object.define-setter"); @@ -180,6 +182,8 @@ require("core-js/modules/esnext.string.at"); require("core-js/modules/esnext.string.code-points"); +require("core-js/modules/esnext.string.match-all"); + require("core-js/modules/esnext.string.replace-all"); require("core-js/modules/esnext.symbol.dispose"); @@ -216,6 +220,4 @@ require("core-js/modules/web.url.to-json"); require("core-js/modules/web.url-search-params"); -require("core-js/modules/esnext.string.match-all"); - 1 ** 2; diff --git a/packages/babel-preset-env/test/fixtures/corejs3/entry-require-babel-polyfill/options.json b/packages/babel-preset-env/test/fixtures/corejs3/entry-require-babel-polyfill/options.json index bc7cfa8eb23e..fc08c036754a 100644 --- a/packages/babel-preset-env/test/fixtures/corejs3/entry-require-babel-polyfill/options.json +++ b/packages/babel-preset-env/test/fixtures/corejs3/entry-require-babel-polyfill/options.json @@ -1,4 +1,5 @@ { + "validateLogs": true, "presets": [ [ "../../../../lib", diff --git a/packages/babel-preset-env/test/fixtures/corejs3/entry-require-babel-polyfill/stderr.txt b/packages/babel-preset-env/test/fixtures/corejs3/entry-require-babel-polyfill/stderr.txt new file mode 100644 index 000000000000..eaf553660fd2 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/corejs3/entry-require-babel-polyfill/stderr.txt @@ -0,0 +1,2 @@ +`@babel/polyfill` is deprecated. Please, use required parts of `core-js` + and `regenerator-runtime/runtime` separately diff --git a/packages/babel-preset-env/test/fixtures/corejs3/entry-require-es-chrome-71/output.js b/packages/babel-preset-env/test/fixtures/corejs3/entry-require-es-chrome-71/output.js index af7ecd4cda07..ca0c13b8c25b 100644 --- a/packages/babel-preset-env/test/fixtures/corejs3/entry-require-es-chrome-71/output.js +++ b/packages/babel-preset-env/test/fixtures/corejs3/entry-require-es-chrome-71/output.js @@ -2,6 +2,8 @@ require("core-js/modules/es.array.unscopables.flat"); require("core-js/modules/es.array.unscopables.flat-map"); +require("core-js/modules/es.math.hypot"); + require("core-js/modules/es.object.from-entries"); 1 ** 2; diff --git a/packages/babel-preset-env/test/fixtures/corejs3/entry-require-es-proposals/output.js b/packages/babel-preset-env/test/fixtures/corejs3/entry-require-es-proposals/output.js index 31ec22fc83ba..72ba892bc13d 100644 --- a/packages/babel-preset-env/test/fixtures/corejs3/entry-require-es-proposals/output.js +++ b/packages/babel-preset-env/test/fixtures/corejs3/entry-require-es-proposals/output.js @@ -14,6 +14,8 @@ require("core-js/modules/es.array.unscopables.flat"); require("core-js/modules/es.array.unscopables.flat-map"); +require("core-js/modules/es.math.hypot"); + require("core-js/modules/es.object.define-getter"); require("core-js/modules/es.object.define-setter"); @@ -180,6 +182,8 @@ require("core-js/modules/esnext.string.at"); require("core-js/modules/esnext.string.code-points"); +require("core-js/modules/esnext.string.match-all"); + require("core-js/modules/esnext.string.replace-all"); require("core-js/modules/esnext.symbol.dispose"); @@ -208,6 +212,4 @@ require("core-js/modules/web.url.to-json"); require("core-js/modules/web.url-search-params"); -require("core-js/modules/esnext.string.match-all"); - 1 ** 2; diff --git a/packages/babel-preset-env/test/fixtures/corejs3/entry-require/output.js b/packages/babel-preset-env/test/fixtures/corejs3/entry-require/output.js index 49aa2d8f4ca3..974ad1fee63b 100644 --- a/packages/babel-preset-env/test/fixtures/corejs3/entry-require/output.js +++ b/packages/babel-preset-env/test/fixtures/corejs3/entry-require/output.js @@ -14,6 +14,8 @@ require("core-js/modules/es.array.unscopables.flat"); require("core-js/modules/es.array.unscopables.flat-map"); +require("core-js/modules/es.math.hypot"); + require("core-js/modules/es.object.define-getter"); require("core-js/modules/es.object.define-setter"); diff --git a/packages/babel-preset-env/test/fixtures/corejs3/entry-stable-chrome-71/output.mjs b/packages/babel-preset-env/test/fixtures/corejs3/entry-stable-chrome-71/output.mjs index de648a923f2b..521c32b6f351 100644 --- a/packages/babel-preset-env/test/fixtures/corejs3/entry-stable-chrome-71/output.mjs +++ b/packages/babel-preset-env/test/fixtures/corejs3/entry-stable-chrome-71/output.mjs @@ -1,4 +1,5 @@ import "core-js/modules/es.array.unscopables.flat"; import "core-js/modules/es.array.unscopables.flat-map"; +import "core-js/modules/es.math.hypot"; import "core-js/modules/es.object.from-entries"; import "core-js/modules/web.immediate"; diff --git a/packages/babel-preset-env/test/fixtures/corejs3/entry-stable-samsung-8.2/output.mjs b/packages/babel-preset-env/test/fixtures/corejs3/entry-stable-samsung-8.2/output.mjs index b55987d82a9f..e99fb491804b 100644 --- a/packages/babel-preset-env/test/fixtures/corejs3/entry-stable-samsung-8.2/output.mjs +++ b/packages/babel-preset-env/test/fixtures/corejs3/entry-stable-samsung-8.2/output.mjs @@ -4,6 +4,7 @@ import "core-js/modules/es.array.flat-map"; import "core-js/modules/es.array.iterator"; import "core-js/modules/es.array.unscopables.flat"; import "core-js/modules/es.array.unscopables.flat-map"; +import "core-js/modules/es.math.hypot"; import "core-js/modules/es.object.from-entries"; import "core-js/modules/es.promise"; import "core-js/modules/es.promise.finally"; @@ -13,4 +14,6 @@ import "core-js/modules/es.string.trim-start"; import "core-js/modules/web.dom-collections.iterator"; import "core-js/modules/web.immediate"; import "core-js/modules/web.queue-microtask"; +import "core-js/modules/web.url"; import "core-js/modules/web.url.to-json"; +import "core-js/modules/web.url-search-params"; diff --git a/packages/babel-preset-env/test/fixtures/corejs3/exclude-built-ins/output.mjs b/packages/babel-preset-env/test/fixtures/corejs3/exclude-built-ins/output.mjs index 8dc8ff014a4c..cb63c2cc360c 100644 --- a/packages/babel-preset-env/test/fixtures/corejs3/exclude-built-ins/output.mjs +++ b/packages/babel-preset-env/test/fixtures/corejs3/exclude-built-ins/output.mjs @@ -4,6 +4,7 @@ import "core-js/modules/es.array.flat-map"; import "core-js/modules/es.array.iterator"; import "core-js/modules/es.array.unscopables.flat"; import "core-js/modules/es.array.unscopables.flat-map"; +import "core-js/modules/es.math.hypot"; import "core-js/modules/es.object.from-entries"; import "core-js/modules/es.promise"; import "core-js/modules/es.promise.finally"; @@ -11,4 +12,6 @@ import "core-js/modules/es.string.replace"; import "core-js/modules/es.string.trim-end"; import "core-js/modules/es.string.trim-start"; import "core-js/modules/web.queue-microtask"; +import "core-js/modules/web.url"; import "core-js/modules/web.url.to-json"; +import "core-js/modules/web.url-search-params"; diff --git a/packages/babel-preset-env/test/fixtures/corejs3/exclude-include/output.mjs b/packages/babel-preset-env/test/fixtures/corejs3/exclude-include/output.mjs index e116abf02cf1..170d86bd7cae 100644 --- a/packages/babel-preset-env/test/fixtures/corejs3/exclude-include/output.mjs +++ b/packages/babel-preset-env/test/fixtures/corejs3/exclude-include/output.mjs @@ -7,6 +7,7 @@ import "core-js/modules/es.array.sort"; import "core-js/modules/es.array.unscopables.flat"; import "core-js/modules/es.array.unscopables.flat-map"; import "core-js/modules/es.map"; +import "core-js/modules/es.math.hypot"; import "core-js/modules/es.object.define-getter"; import "core-js/modules/es.object.define-setter"; import "core-js/modules/es.object.from-entries"; diff --git a/packages/babel-preset-env/test/fixtures/corejs3/force-all-transforms/output.mjs b/packages/babel-preset-env/test/fixtures/corejs3/force-all-transforms/output.mjs index 698280d4465c..acdf857cf0e3 100644 --- a/packages/babel-preset-env/test/fixtures/corejs3/force-all-transforms/output.mjs +++ b/packages/babel-preset-env/test/fixtures/corejs3/force-all-transforms/output.mjs @@ -6,6 +6,7 @@ import "core-js/modules/es.array.iterator"; import "core-js/modules/es.array.sort"; import "core-js/modules/es.array.unscopables.flat"; import "core-js/modules/es.array.unscopables.flat-map"; +import "core-js/modules/es.math.hypot"; import "core-js/modules/es.object.define-getter"; import "core-js/modules/es.object.define-setter"; import "core-js/modules/es.object.from-entries"; diff --git a/packages/babel-preset-env/test/fixtures/corejs3/include-built-ins/output.mjs b/packages/babel-preset-env/test/fixtures/corejs3/include-built-ins/output.mjs index 504b23702786..49a4b1893150 100644 --- a/packages/babel-preset-env/test/fixtures/corejs3/include-built-ins/output.mjs +++ b/packages/babel-preset-env/test/fixtures/corejs3/include-built-ins/output.mjs @@ -7,6 +7,7 @@ import "core-js/modules/es.array.sort"; import "core-js/modules/es.array.unscopables.flat"; import "core-js/modules/es.array.unscopables.flat-map"; import "core-js/modules/es.map"; +import "core-js/modules/es.math.hypot"; import "core-js/modules/es.object.define-getter"; import "core-js/modules/es.object.define-setter"; import "core-js/modules/es.object.from-entries"; diff --git a/packages/babel-preset-env/test/fixtures/corejs3/usage-all/input.mjs b/packages/babel-preset-env/test/fixtures/corejs3/usage-all/input.mjs index 39641419b1cb..79e759ec821f 100644 --- a/packages/babel-preset-env/test/fixtures/corejs3/usage-all/input.mjs +++ b/packages/babel-preset-env/test/fixtures/corejs3/usage-all/input.mjs @@ -24,3 +24,6 @@ const foo = new Promise((resolve) => { queueMicrotask(() => globalThis); Observable.from(10); + +Promise.allSettled([]); +S.matchAll(); diff --git a/packages/babel-preset-env/test/fixtures/corejs3/usage-all/options.json b/packages/babel-preset-env/test/fixtures/corejs3/usage-all/options.json index c7f8e1de8403..ba576bd3a8c1 100644 --- a/packages/babel-preset-env/test/fixtures/corejs3/usage-all/options.json +++ b/packages/babel-preset-env/test/fixtures/corejs3/usage-all/options.json @@ -4,7 +4,7 @@ "../../../../lib", { "useBuiltIns": "usage", - "corejs": 3, + "corejs": "3.6", "modules": false } ] diff --git a/packages/babel-preset-env/test/fixtures/corejs3/usage-all/output.mjs b/packages/babel-preset-env/test/fixtures/corejs3/usage-all/output.mjs index 320fcf8662c5..16087609731d 100644 --- a/packages/babel-preset-env/test/fixtures/corejs3/usage-all/output.mjs +++ b/packages/babel-preset-env/test/fixtures/corejs3/usage-all/output.mjs @@ -4,12 +4,15 @@ import "core-js/modules/es.symbol.iterator"; import "core-js/modules/es.symbol.match"; import "core-js/modules/es.array.from"; import "core-js/modules/es.array.iterator"; +import "core-js/modules/es.global-this"; import "core-js/modules/es.map"; import "core-js/modules/es.object.to-string"; import "core-js/modules/es.promise"; +import "core-js/modules/es.promise.all-settled"; import "core-js/modules/es.regexp.exec"; import "core-js/modules/es.string.iterator"; import "core-js/modules/es.string.match"; +import "core-js/modules/es.string.match-all"; import "core-js/modules/web.dom-collections.iterator"; import "core-js/modules/web.queue-microtask"; Array.from; // static method @@ -49,3 +52,5 @@ queueMicrotask(function () { return globalThis; }); Observable.from(10); +Promise.allSettled([]); +S.matchAll(); diff --git a/packages/babel-preset-env/test/fixtures/corejs3/usage-browserslist-config-ignore/options.json b/packages/babel-preset-env/test/fixtures/corejs3/usage-browserslist-config-ignore/options.json index 95a82bb5ec7a..ffb21b1f8aa2 100644 --- a/packages/babel-preset-env/test/fixtures/corejs3/usage-browserslist-config-ignore/options.json +++ b/packages/babel-preset-env/test/fixtures/corejs3/usage-browserslist-config-ignore/options.json @@ -1,4 +1,5 @@ { + "validateLogs": true, "presets": [ [ "../../../../lib", diff --git a/packages/babel-preset-env/test/fixtures/corejs3/usage-browserslist-config-ignore/stdout.txt b/packages/babel-preset-env/test/fixtures/corejs3/usage-browserslist-config-ignore/stdout.txt new file mode 100644 index 000000000000..20ac22e7bc73 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/corejs3/usage-browserslist-config-ignore/stdout.txt @@ -0,0 +1,39 @@ +@babel/preset-env: `DEBUG` option + +Using targets: +{ + "android": "61", + "chrome": "61", + "edge": "16", + "firefox": "60", + "ios": "10.3", + "opera": "48", + "safari": "10.1", + "samsung": "8.2" +} + +Using modules transform: false + +Using plugins: + proposal-nullish-coalescing-operator { "android":"61", "chrome":"61", "edge":"16", "firefox":"60", "ios":"10.3", "opera":"48", "safari":"10.1", "samsung":"8.2" } + proposal-optional-chaining { "android":"61", "chrome":"61", "edge":"16", "firefox":"60", "ios":"10.3", "opera":"48", "safari":"10.1", "samsung":"8.2" } + proposal-json-strings { "android":"61", "chrome":"61", "edge":"16", "firefox":"60", "ios":"10.3", "opera":"48", "safari":"10.1", "samsung":"8.2" } + proposal-optional-catch-binding { "android":"61", "chrome":"61", "edge":"16", "ios":"10.3", "opera":"48", "safari":"10.1", "samsung":"8.2" } + transform-parameters { "edge":"16" } + proposal-async-generator-functions { "android":"61", "chrome":"61", "edge":"16", "ios":"10.3", "opera":"48", "safari":"10.1" } + proposal-object-rest-spread { "edge":"16", "ios":"10.3", "safari":"10.1" } + transform-dotall-regex { "android":"61", "chrome":"61", "edge":"16", "firefox":"60", "ios":"10.3", "opera":"48", "safari":"10.1" } + proposal-unicode-property-regex { "android":"61", "chrome":"61", "edge":"16", "firefox":"60", "ios":"10.3", "opera":"48", "safari":"10.1", "samsung":"8.2" } + transform-named-capturing-groups-regex { "android":"61", "chrome":"61", "edge":"16", "firefox":"60", "ios":"10.3", "opera":"48", "safari":"10.1", "samsung":"8.2" } + transform-async-to-generator { "ios":"10.3", "safari":"10.1" } + transform-template-literals { "ios":"10.3", "safari":"10.1" } + transform-function-name { "edge":"16" } + transform-unicode-regex { "ios":"10.3", "safari":"10.1" } + transform-block-scoping { "ios":"10.3", "safari":"10.1" } + syntax-dynamic-import { "android":"61", "chrome":"61", "edge":"16", "firefox":"60", "ios":"10.3", "opera":"48", "safari":"10.1", "samsung":"8.2" } + +Using polyfills with `usage` option: + +[/packages/babel-preset-env/test/fixtures/corejs3/usage-browserslist-config-ignore/input.mjs] Added following core-js polyfills: + es.array.iterator { "android":"61", "chrome":"61", "opera":"48", "samsung":"8.2" } + web.dom-collections.iterator { "android":"61", "chrome":"61", "edge":"16", "ios":"10.3", "opera":"48", "safari":"10.1", "samsung":"8.2" } diff --git a/packages/babel-preset-env/test/fixtures/corejs3/usage-dynamic-import-chrome-71/options.json b/packages/babel-preset-env/test/fixtures/corejs3/usage-dynamic-import-chrome-71/options.json index 26b5f87194db..eb821662bc64 100644 --- a/packages/babel-preset-env/test/fixtures/corejs3/usage-dynamic-import-chrome-71/options.json +++ b/packages/babel-preset-env/test/fixtures/corejs3/usage-dynamic-import-chrome-71/options.json @@ -1,5 +1,4 @@ { - "plugins": ["syntax-dynamic-import"], "presets": [ [ "../../../../lib", diff --git a/packages/babel-preset-env/test/fixtures/corejs3/usage-dynamic-import/options.json b/packages/babel-preset-env/test/fixtures/corejs3/usage-dynamic-import/options.json index 563713faab57..c7f8e1de8403 100644 --- a/packages/babel-preset-env/test/fixtures/corejs3/usage-dynamic-import/options.json +++ b/packages/babel-preset-env/test/fixtures/corejs3/usage-dynamic-import/options.json @@ -1,5 +1,4 @@ { - "plugins": ["syntax-dynamic-import"], "presets": [ [ "../../../../lib", diff --git a/packages/babel-preset-env/test/fixtures/corejs3/usage-for-of-destructure-with/output.mjs b/packages/babel-preset-env/test/fixtures/corejs3/usage-for-of-destructure-with/output.mjs index 5237617a6e67..2769d6c95b21 100644 --- a/packages/babel-preset-env/test/fixtures/corejs3/usage-for-of-destructure-with/output.mjs +++ b/packages/babel-preset-env/test/fixtures/corejs3/usage-for-of-destructure-with/output.mjs @@ -2,9 +2,8 @@ import "core-js/modules/es.array.iterator"; import "core-js/modules/es.string.pad-end"; import "core-js/modules/es.string.pad-start"; -for (const _ref of foo) { - const { - padStart - } = _ref; +for (const { + padStart +} of foo) { console.log('b'.padEnd(5)); } diff --git a/packages/babel-preset-env/test/fixtures/corejs3/usage-modules-namespaced/input.mjs b/packages/babel-preset-env/test/fixtures/corejs3/usage-modules-namespaced/input.mjs new file mode 100644 index 000000000000..3f57abb6052e --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/corejs3/usage-modules-namespaced/input.mjs @@ -0,0 +1,2 @@ +import * as ns from "ns"; +ns.map; diff --git a/packages/babel-preset-env/test/fixtures/corejs3/usage-modules-namespaced/options.json b/packages/babel-preset-env/test/fixtures/corejs3/usage-modules-namespaced/options.json new file mode 100644 index 000000000000..d15a6c1c2826 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/corejs3/usage-modules-namespaced/options.json @@ -0,0 +1,12 @@ +{ + "presets": [ + [ + "../../../../lib", + { + "modules": false, + "useBuiltIns": "usage", + "corejs": 3 + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/corejs3/usage-modules-namespaced/output.mjs b/packages/babel-preset-env/test/fixtures/corejs3/usage-modules-namespaced/output.mjs new file mode 100644 index 000000000000..3f57abb6052e --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/corejs3/usage-modules-namespaced/output.mjs @@ -0,0 +1,2 @@ +import * as ns from "ns"; +ns.map; diff --git a/packages/babel-preset-env/test/fixtures/corejs3/usage-regenerator-used-async/output.mjs b/packages/babel-preset-env/test/fixtures/corejs3/usage-regenerator-used-async/output.mjs index 5663fd906a75..a878be5c4097 100644 --- a/packages/babel-preset-env/test/fixtures/corejs3/usage-regenerator-used-async/output.mjs +++ b/packages/babel-preset-env/test/fixtures/corejs3/usage-regenerator-used-async/output.mjs @@ -11,9 +11,7 @@ function a() { } function _a() { - _a = _asyncToGenerator( - /*#__PURE__*/ - regeneratorRuntime.mark(function _callee() { + _a = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() { return regeneratorRuntime.wrap(function _callee$(_context) { while (1) { switch (_context.prev = _context.next) { diff --git a/packages/babel-preset-env/test/fixtures/corejs3/usage-regenerator-used-generator/output.mjs b/packages/babel-preset-env/test/fixtures/corejs3/usage-regenerator-used-generator/output.mjs index ce5acd262e9f..62d15abf1f61 100644 --- a/packages/babel-preset-env/test/fixtures/corejs3/usage-regenerator-used-generator/output.mjs +++ b/packages/babel-preset-env/test/fixtures/corejs3/usage-regenerator-used-generator/output.mjs @@ -1,8 +1,6 @@ import "regenerator-runtime/runtime"; -var _marked = -/*#__PURE__*/ -regeneratorRuntime.mark(a); +var _marked = /*#__PURE__*/regeneratorRuntime.mark(a); function a() { return regeneratorRuntime.wrap(function a$(_context) { diff --git a/packages/babel-preset-env/test/fixtures/debug/browserslists-android-3/input.mjs b/packages/babel-preset-env/test/fixtures/debug/browserslists-android-3/input.mjs new file mode 100644 index 000000000000..c3fee8a17564 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/browserslists-android-3/input.mjs @@ -0,0 +1 @@ +import "core-js"; diff --git a/packages/babel-preset-env/test/fixtures/debug/browserslists-android-3/options.json b/packages/babel-preset-env/test/fixtures/debug/browserslists-android-3/options.json new file mode 100644 index 000000000000..b8ccf9b2471e --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/browserslists-android-3/options.json @@ -0,0 +1,17 @@ +{ + "validateLogs": true, + "ignoreOutput": true, + "presets": [ + [ + "env", + { + "debug": true, + "targets": { + "browsers": [ + "android 3" + ] + } + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/debug/browserslists-android-3/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/browserslists-android-3/stdout.txt new file mode 100644 index 000000000000..8aca688738cf --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/browserslists-android-3/stdout.txt @@ -0,0 +1,48 @@ +@babel/preset-env: `DEBUG` option + +Using targets: +{ + "android": "3" +} + +Using modules transform: auto + +Using plugins: + proposal-nullish-coalescing-operator { "android":"3" } + proposal-optional-chaining { "android":"3" } + proposal-json-strings { "android":"3" } + proposal-optional-catch-binding { "android":"3" } + transform-parameters { "android":"3" } + proposal-async-generator-functions { "android":"3" } + proposal-object-rest-spread { "android":"3" } + transform-dotall-regex { "android":"3" } + proposal-unicode-property-regex { "android":"3" } + transform-named-capturing-groups-regex { "android":"3" } + transform-async-to-generator { "android":"3" } + transform-exponentiation-operator { "android":"3" } + transform-template-literals { "android":"3" } + transform-literals { "android":"3" } + transform-function-name { "android":"3" } + transform-arrow-functions { "android":"3" } + transform-block-scoped-functions { "android":"3" } + transform-classes { "android":"3" } + transform-object-super { "android":"3" } + transform-shorthand-properties { "android":"3" } + transform-duplicate-keys { "android":"3" } + transform-computed-properties { "android":"3" } + transform-for-of { "android":"3" } + transform-sticky-regex { "android":"3" } + transform-unicode-regex { "android":"3" } + transform-spread { "android":"3" } + transform-destructuring { "android":"3" } + transform-block-scoping { "android":"3" } + transform-typeof-symbol { "android":"3" } + transform-new-target { "android":"3" } + transform-regenerator { "android":"3" } + transform-member-expression-literals { "android":"3" } + transform-property-literals { "android":"3" } + transform-reserved-words { "android":"3" } + transform-modules-commonjs { "android":"3" } + proposal-dynamic-import { "android":"3" } + +Using polyfills: No polyfills were added, since the `useBuiltIns` option was not set. diff --git a/packages/babel-preset-env/test/fixtures/debug/browserslists-defaults-not-ie/input.mjs b/packages/babel-preset-env/test/fixtures/debug/browserslists-defaults-not-ie/input.mjs new file mode 100644 index 000000000000..c3fee8a17564 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/browserslists-defaults-not-ie/input.mjs @@ -0,0 +1 @@ +import "core-js"; diff --git a/packages/babel-preset-env/test/fixtures/debug/browserslists-defaults-not-ie/options.json b/packages/babel-preset-env/test/fixtures/debug/browserslists-defaults-not-ie/options.json new file mode 100644 index 000000000000..8bbb1c0f23d9 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/browserslists-defaults-not-ie/options.json @@ -0,0 +1,19 @@ +{ + "validateLogs": true, + "ignoreOutput": true, + "presets": [ + [ + "env", + { + "debug": true, + "targets": { + "browsers": [ + "defaults", + "not ie 11", + "not ie_mob 11" + ] + } + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/debug/browserslists-defaults-not-ie/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/browserslists-defaults-not-ie/stdout.txt new file mode 100644 index 000000000000..3dfb02970313 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/browserslists-defaults-not-ie/stdout.txt @@ -0,0 +1,32 @@ +@babel/preset-env: `DEBUG` option + +Using targets: +{ + "android": "80", + "chrome": "79", + "edge": "18", + "firefox": "68", + "ios": "12.2", + "opera": "67", + "safari": "12.1", + "samsung": "10.1" +} + +Using modules transform: auto + +Using plugins: + proposal-nullish-coalescing-operator { "chrome":"79", "edge":"18", "firefox":"68", "ios":"12.2", "safari":"12.1", "samsung":"10.1" } + proposal-optional-chaining { "chrome":"79", "edge":"18", "firefox":"68", "ios":"12.2", "safari":"12.1", "samsung":"10.1" } + proposal-json-strings { "edge":"18" } + proposal-optional-catch-binding { "edge":"18" } + proposal-async-generator-functions { "edge":"18" } + proposal-object-rest-spread { "edge":"18" } + transform-dotall-regex { "edge":"18", "firefox":"68" } + proposal-unicode-property-regex { "edge":"18", "firefox":"68" } + transform-named-capturing-groups-regex { "edge":"18", "firefox":"68" } + transform-template-literals { "ios":"12.2", "safari":"12.1" } + transform-function-name { "edge":"18" } + transform-modules-commonjs { "android":"80", "chrome":"79", "edge":"18", "firefox":"68", "ios":"12.2", "opera":"67", "safari":"12.1", "samsung":"10.1" } + proposal-dynamic-import { "android":"80", "chrome":"79", "edge":"18", "firefox":"68", "ios":"12.2", "opera":"67", "safari":"12.1", "samsung":"10.1" } + +Using polyfills: No polyfills were added, since the `useBuiltIns` option was not set. diff --git a/packages/babel-preset-env/test/fixtures/debug/browserslists-defaults/input.mjs b/packages/babel-preset-env/test/fixtures/debug/browserslists-defaults/input.mjs new file mode 100644 index 000000000000..c3fee8a17564 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/browserslists-defaults/input.mjs @@ -0,0 +1 @@ +import "core-js"; diff --git a/packages/babel-preset-env/test/fixtures/debug/browserslists-defaults/options.json b/packages/babel-preset-env/test/fixtures/debug/browserslists-defaults/options.json new file mode 100644 index 000000000000..b4fbce958eac --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/browserslists-defaults/options.json @@ -0,0 +1,15 @@ +{ + "validateLogs": true, + "ignoreOutput": true, + "presets": [ + [ + "env", + { + "debug": true, + "targets": { + "browsers": "defaults" + } + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/debug/browserslists-defaults/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/browserslists-defaults/stdout.txt new file mode 100644 index 000000000000..6d8deebaaced --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/browserslists-defaults/stdout.txt @@ -0,0 +1,52 @@ +@babel/preset-env: `DEBUG` option + +Using targets: +{ + "android": "80", + "chrome": "79", + "edge": "18", + "firefox": "68", + "ie": "11", + "ios": "12.2", + "opera": "67", + "safari": "12.1", + "samsung": "10.1" +} + +Using modules transform: auto + +Using plugins: + proposal-nullish-coalescing-operator { "chrome":"79", "edge":"18", "firefox":"68", "ie":"11", "ios":"12.2", "safari":"12.1", "samsung":"10.1" } + proposal-optional-chaining { "chrome":"79", "edge":"18", "firefox":"68", "ie":"11", "ios":"12.2", "safari":"12.1", "samsung":"10.1" } + proposal-json-strings { "edge":"18", "ie":"11" } + proposal-optional-catch-binding { "edge":"18", "ie":"11" } + transform-parameters { "ie":"11" } + proposal-async-generator-functions { "edge":"18", "ie":"11" } + proposal-object-rest-spread { "edge":"18", "ie":"11" } + transform-dotall-regex { "edge":"18", "firefox":"68", "ie":"11" } + proposal-unicode-property-regex { "edge":"18", "firefox":"68", "ie":"11" } + transform-named-capturing-groups-regex { "edge":"18", "firefox":"68", "ie":"11" } + transform-async-to-generator { "ie":"11" } + transform-exponentiation-operator { "ie":"11" } + transform-template-literals { "ie":"11", "ios":"12.2", "safari":"12.1" } + transform-literals { "ie":"11" } + transform-function-name { "edge":"18", "ie":"11" } + transform-arrow-functions { "ie":"11" } + transform-classes { "ie":"11" } + transform-object-super { "ie":"11" } + transform-shorthand-properties { "ie":"11" } + transform-duplicate-keys { "ie":"11" } + transform-computed-properties { "ie":"11" } + transform-for-of { "ie":"11" } + transform-sticky-regex { "ie":"11" } + transform-unicode-regex { "ie":"11" } + transform-spread { "ie":"11" } + transform-destructuring { "ie":"11" } + transform-block-scoping { "ie":"11" } + transform-typeof-symbol { "ie":"11" } + transform-new-target { "ie":"11" } + transform-regenerator { "ie":"11" } + transform-modules-commonjs { "android":"80", "chrome":"79", "edge":"18", "firefox":"68", "ie":"11", "ios":"12.2", "opera":"67", "safari":"12.1", "samsung":"10.1" } + proposal-dynamic-import { "android":"80", "chrome":"79", "edge":"18", "firefox":"68", "ie":"11", "ios":"12.2", "opera":"67", "safari":"12.1", "samsung":"10.1" } + +Using polyfills: No polyfills were added, since the `useBuiltIns` option was not set. diff --git a/packages/babel-preset-env/test/fixtures/debug/browserslists-last-2-versions-not-ie/input.mjs b/packages/babel-preset-env/test/fixtures/debug/browserslists-last-2-versions-not-ie/input.mjs new file mode 100644 index 000000000000..c3fee8a17564 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/browserslists-last-2-versions-not-ie/input.mjs @@ -0,0 +1 @@ +import "core-js"; diff --git a/packages/babel-preset-env/test/fixtures/debug/browserslists-last-2-versions-not-ie/options.json b/packages/babel-preset-env/test/fixtures/debug/browserslists-last-2-versions-not-ie/options.json new file mode 100644 index 000000000000..58797fc7f4e1 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/browserslists-last-2-versions-not-ie/options.json @@ -0,0 +1,19 @@ +{ + "validateLogs": true, + "ignoreOutput": true, + "presets": [ + [ + "env", + { + "debug": true, + "targets": { + "browsers": [ + "last 2 versions", + "not ie <= 11", + "not ie_mob <= 11" + ] + } + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/debug/browserslists-last-2-versions-not-ie/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/browserslists-last-2-versions-not-ie/stdout.txt new file mode 100644 index 000000000000..a26f5163043a --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/browserslists-last-2-versions-not-ie/stdout.txt @@ -0,0 +1,31 @@ +@babel/preset-env: `DEBUG` option + +Using targets: +{ + "android": "80", + "chrome": "80", + "edge": "80", + "firefox": "74", + "ios": "13.2", + "opera": "67", + "safari": "12.1", + "samsung": "10.1" +} + +Using modules transform: auto + +Using plugins: + proposal-nullish-coalescing-operator { "ios":"13.2", "safari":"12.1", "samsung":"10.1" } + proposal-optional-chaining { "ios":"13.2", "safari":"12.1", "samsung":"10.1" } + syntax-json-strings { "android":"80", "chrome":"80", "edge":"80", "firefox":"74", "ios":"13.2", "opera":"67", "safari":"12.1", "samsung":"10.1" } + syntax-optional-catch-binding { "android":"80", "chrome":"80", "edge":"80", "firefox":"74", "ios":"13.2", "opera":"67", "safari":"12.1", "samsung":"10.1" } + syntax-async-generators { "android":"80", "chrome":"80", "edge":"80", "firefox":"74", "ios":"13.2", "opera":"67", "safari":"12.1", "samsung":"10.1" } + syntax-object-rest-spread { "android":"80", "chrome":"80", "edge":"80", "firefox":"74", "ios":"13.2", "opera":"67", "safari":"12.1", "samsung":"10.1" } + transform-dotall-regex { "firefox":"74" } + proposal-unicode-property-regex { "firefox":"74" } + transform-named-capturing-groups-regex { "firefox":"74" } + transform-template-literals { "safari":"12.1" } + transform-modules-commonjs { "android":"80", "chrome":"80", "edge":"80", "firefox":"74", "ios":"13.2", "opera":"67", "safari":"12.1", "samsung":"10.1" } + proposal-dynamic-import { "android":"80", "chrome":"80", "edge":"80", "firefox":"74", "ios":"13.2", "opera":"67", "safari":"12.1", "samsung":"10.1" } + +Using polyfills: No polyfills were added, since the `useBuiltIns` option was not set. diff --git a/packages/babel-preset-env/test/debug-fixtures/corejs-without-usebuiltins/in/in.js b/packages/babel-preset-env/test/fixtures/debug/corejs-without-usebuiltins/input.mjs similarity index 100% rename from packages/babel-preset-env/test/debug-fixtures/corejs-without-usebuiltins/in/in.js rename to packages/babel-preset-env/test/fixtures/debug/corejs-without-usebuiltins/input.mjs diff --git a/packages/babel-preset-env/test/fixtures/debug/corejs-without-usebuiltins/options.json b/packages/babel-preset-env/test/fixtures/debug/corejs-without-usebuiltins/options.json new file mode 100644 index 000000000000..bb7efd202301 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/corejs-without-usebuiltins/options.json @@ -0,0 +1,13 @@ +{ + "validateLogs": true, + "ignoreOutput": true, + "presets": [ + [ + "env", + { + "debug": true, + "corejs": 3 + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/debug/corejs-without-usebuiltins/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/corejs-without-usebuiltins/stdout.txt new file mode 100644 index 000000000000..22ef23b56af2 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/corejs-without-usebuiltins/stdout.txt @@ -0,0 +1,48 @@ +The `corejs` option only has an effect when the `useBuiltIns` option is not `false` + +@babel/preset-env: `DEBUG` option + +Using targets: +{} + +Using modules transform: auto + +Using plugins: + proposal-nullish-coalescing-operator {} + proposal-optional-chaining {} + proposal-json-strings {} + proposal-optional-catch-binding {} + transform-parameters {} + proposal-async-generator-functions {} + proposal-object-rest-spread {} + transform-dotall-regex {} + proposal-unicode-property-regex {} + transform-named-capturing-groups-regex {} + transform-async-to-generator {} + transform-exponentiation-operator {} + transform-template-literals {} + transform-literals {} + transform-function-name {} + transform-arrow-functions {} + transform-block-scoped-functions {} + transform-classes {} + transform-object-super {} + transform-shorthand-properties {} + transform-duplicate-keys {} + transform-computed-properties {} + transform-for-of {} + transform-sticky-regex {} + transform-unicode-regex {} + transform-spread {} + transform-destructuring {} + transform-block-scoping {} + transform-typeof-symbol {} + transform-new-target {} + transform-regenerator {} + transform-member-expression-literals {} + transform-property-literals {} + transform-reserved-words {} + transform-modules-commonjs {} + proposal-dynamic-import {} + +Using polyfills: No polyfills were added, since the `useBuiltIns` option was not set. diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs2-android/in/in.js b/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-android/input.mjs similarity index 100% rename from packages/babel-preset-env/test/debug-fixtures/entry-corejs2-android/in/in.js rename to packages/babel-preset-env/test/fixtures/debug/entry-corejs2-android/input.mjs diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-android/options.json b/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-android/options.json new file mode 100644 index 000000000000..7c23631533a1 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-android/options.json @@ -0,0 +1,17 @@ +{ + "validateLogs": true, + "ignoreOutput": true, + "presets": [ + [ + "env", + { + "debug": true, + "targets": { + "browsers": ["Android >= 4"] + }, + "useBuiltIns": "entry", + "corejs": 2 + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-android/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-android/stdout.txt new file mode 100644 index 000000000000..61e29fd11fc4 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-android/stdout.txt @@ -0,0 +1,162 @@ +@babel/preset-env: `DEBUG` option + +Using targets: +{ + "android": "4" +} + +Using modules transform: auto + +Using plugins: + proposal-nullish-coalescing-operator { "android":"4" } + proposal-optional-chaining { "android":"4" } + proposal-json-strings { "android":"4" } + proposal-optional-catch-binding { "android":"4" } + transform-parameters { "android":"4" } + proposal-async-generator-functions { "android":"4" } + proposal-object-rest-spread { "android":"4" } + transform-dotall-regex { "android":"4" } + proposal-unicode-property-regex { "android":"4" } + transform-named-capturing-groups-regex { "android":"4" } + transform-async-to-generator { "android":"4" } + transform-exponentiation-operator { "android":"4" } + transform-template-literals { "android":"4" } + transform-literals { "android":"4" } + transform-function-name { "android":"4" } + transform-arrow-functions { "android":"4" } + transform-block-scoped-functions { "android":"4" } + transform-classes { "android":"4" } + transform-object-super { "android":"4" } + transform-shorthand-properties { "android":"4" } + transform-duplicate-keys { "android":"4" } + transform-computed-properties { "android":"4" } + transform-for-of { "android":"4" } + transform-sticky-regex { "android":"4" } + transform-unicode-regex { "android":"4" } + transform-spread { "android":"4" } + transform-destructuring { "android":"4" } + transform-block-scoping { "android":"4" } + transform-typeof-symbol { "android":"4" } + transform-new-target { "android":"4" } + transform-regenerator { "android":"4" } + transform-reserved-words { "android":"4" } + transform-modules-commonjs { "android":"4" } + proposal-dynamic-import { "android":"4" } + +Using polyfills with `entry` option: + +[/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-android/input.mjs] Replaced @babel/polyfill entries with the following polyfills: + es6.array.copy-within { "android":"4" } + es6.array.fill { "android":"4" } + es6.array.find { "android":"4" } + es6.array.find-index { "android":"4" } + es7.array.flat-map { "android":"4" } + es6.array.from { "android":"4" } + es7.array.includes { "android":"4" } + es6.array.iterator { "android":"4" } + es6.array.of { "android":"4" } + es6.array.sort { "android":"4" } + es6.array.species { "android":"4" } + es6.date.to-primitive { "android":"4" } + es6.function.has-instance { "android":"4" } + es6.map { "android":"4" } + es6.math.acosh { "android":"4" } + es6.math.asinh { "android":"4" } + es6.math.atanh { "android":"4" } + es6.math.cbrt { "android":"4" } + es6.math.clz32 { "android":"4" } + es6.math.cosh { "android":"4" } + es6.math.expm1 { "android":"4" } + es6.math.fround { "android":"4" } + es6.math.hypot { "android":"4" } + es6.math.imul { "android":"4" } + es6.math.log1p { "android":"4" } + es6.math.log10 { "android":"4" } + es6.math.log2 { "android":"4" } + es6.math.sign { "android":"4" } + es6.math.sinh { "android":"4" } + es6.math.tanh { "android":"4" } + es6.math.trunc { "android":"4" } + es6.number.constructor { "android":"4" } + es6.number.epsilon { "android":"4" } + es6.number.is-finite { "android":"4" } + es6.number.is-integer { "android":"4" } + es6.number.is-nan { "android":"4" } + es6.number.is-safe-integer { "android":"4" } + es6.number.max-safe-integer { "android":"4" } + es6.number.min-safe-integer { "android":"4" } + es6.number.parse-float { "android":"4" } + es6.number.parse-int { "android":"4" } + es6.object.assign { "android":"4" } + es7.object.define-getter { "android":"4" } + es7.object.define-setter { "android":"4" } + es7.object.entries { "android":"4" } + es6.object.freeze { "android":"4" } + es6.object.get-own-property-descriptor { "android":"4" } + es7.object.get-own-property-descriptors { "android":"4" } + es6.object.get-own-property-names { "android":"4" } + es6.object.get-prototype-of { "android":"4" } + es7.object.lookup-getter { "android":"4" } + es7.object.lookup-setter { "android":"4" } + es6.object.prevent-extensions { "android":"4" } + es6.object.to-string { "android":"4" } + es6.object.is { "android":"4" } + es6.object.is-frozen { "android":"4" } + es6.object.is-sealed { "android":"4" } + es6.object.is-extensible { "android":"4" } + es6.object.keys { "android":"4" } + es6.object.seal { "android":"4" } + es6.object.set-prototype-of { "android":"4" } + es7.object.values { "android":"4" } + es6.promise { "android":"4" } + es7.promise.finally { "android":"4" } + es6.reflect.apply { "android":"4" } + es6.reflect.construct { "android":"4" } + es6.reflect.define-property { "android":"4" } + es6.reflect.delete-property { "android":"4" } + es6.reflect.get { "android":"4" } + es6.reflect.get-own-property-descriptor { "android":"4" } + es6.reflect.get-prototype-of { "android":"4" } + es6.reflect.has { "android":"4" } + es6.reflect.is-extensible { "android":"4" } + es6.reflect.own-keys { "android":"4" } + es6.reflect.prevent-extensions { "android":"4" } + es6.reflect.set { "android":"4" } + es6.reflect.set-prototype-of { "android":"4" } + es6.regexp.constructor { "android":"4" } + es6.regexp.flags { "android":"4" } + es6.regexp.match { "android":"4" } + es6.regexp.replace { "android":"4" } + es6.regexp.split { "android":"4" } + es6.regexp.search { "android":"4" } + es6.regexp.to-string { "android":"4" } + es6.set { "android":"4" } + es6.symbol { "android":"4" } + es7.symbol.async-iterator { "android":"4" } + es6.string.code-point-at { "android":"4" } + es6.string.ends-with { "android":"4" } + es6.string.from-code-point { "android":"4" } + es6.string.includes { "android":"4" } + es6.string.iterator { "android":"4" } + es7.string.pad-start { "android":"4" } + es7.string.pad-end { "android":"4" } + es6.string.raw { "android":"4" } + es6.string.repeat { "android":"4" } + es6.string.starts-with { "android":"4" } + es7.string.trim-left { "android":"4" } + es7.string.trim-right { "android":"4" } + es6.typed.array-buffer { "android":"4" } + es6.typed.int8-array { "android":"4" } + es6.typed.uint8-array { "android":"4" } + es6.typed.uint8-clamped-array { "android":"4" } + es6.typed.int16-array { "android":"4" } + es6.typed.uint16-array { "android":"4" } + es6.typed.int32-array { "android":"4" } + es6.typed.uint32-array { "android":"4" } + es6.typed.float32-array { "android":"4" } + es6.typed.float64-array { "android":"4" } + es6.weak-map { "android":"4" } + es6.weak-set { "android":"4" } + web.timers { "android":"4" } + web.immediate { "android":"4" } + web.dom.iterable { "android":"4" } diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs2-electron/in/in.js b/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-electron/input.mjs similarity index 100% rename from packages/babel-preset-env/test/debug-fixtures/entry-corejs2-electron/in/in.js rename to packages/babel-preset-env/test/fixtures/debug/entry-corejs2-electron/input.mjs diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-electron/options.json b/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-electron/options.json new file mode 100644 index 000000000000..87ebef4f6836 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-electron/options.json @@ -0,0 +1,17 @@ +{ + "validateLogs": true, + "ignoreOutput": true, + "presets": [ + [ + "env", + { + "debug": true, + "targets": { + "electron": 0.36 + }, + "useBuiltIns": "entry", + "corejs": 2 + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-electron/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-electron/stdout.txt new file mode 100644 index 000000000000..f578ebd93eb3 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-electron/stdout.txt @@ -0,0 +1,101 @@ +Warning, the following targets are using a decimal version: + + electron: 0.36 + +We recommend using a string for minor/patch versions to avoid numbers like 6.10 +getting parsed as 6.1, which can lead to unexpected behavior. + +@babel/preset-env: `DEBUG` option + +Using targets: +{ + "electron": "0.36" +} + +Using modules transform: auto + +Using plugins: + proposal-nullish-coalescing-operator { "electron":"0.36" } + proposal-optional-chaining { "electron":"0.36" } + proposal-json-strings { "electron":"0.36" } + proposal-optional-catch-binding { "electron":"0.36" } + transform-parameters { "electron":"0.36" } + proposal-async-generator-functions { "electron":"0.36" } + proposal-object-rest-spread { "electron":"0.36" } + transform-dotall-regex { "electron":"0.36" } + proposal-unicode-property-regex { "electron":"0.36" } + transform-named-capturing-groups-regex { "electron":"0.36" } + transform-async-to-generator { "electron":"0.36" } + transform-exponentiation-operator { "electron":"0.36" } + transform-function-name { "electron":"0.36" } + transform-for-of { "electron":"0.36" } + transform-sticky-regex { "electron":"0.36" } + transform-unicode-regex { "electron":"0.36" } + transform-destructuring { "electron":"0.36" } + transform-block-scoping { "electron":"0.36" } + transform-regenerator { "electron":"0.36" } + transform-modules-commonjs { "electron":"0.36" } + proposal-dynamic-import { "electron":"0.36" } + +Using polyfills with `entry` option: + +[/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-electron/input.mjs] Replaced @babel/polyfill entries with the following polyfills: + es7.array.flat-map { "electron":"0.36" } + es6.array.from { "electron":"0.36" } + es6.array.sort { "electron":"0.36" } + es6.array.species { "electron":"0.36" } + es6.function.has-instance { "electron":"0.36" } + es6.map { "electron":"0.36" } + es6.object.assign { "electron":"0.36" } + es7.object.define-getter { "electron":"0.36" } + es7.object.define-setter { "electron":"0.36" } + es7.object.entries { "electron":"0.36" } + es7.object.get-own-property-descriptors { "electron":"0.36" } + es7.object.lookup-getter { "electron":"0.36" } + es7.object.lookup-setter { "electron":"0.36" } + es6.object.to-string { "electron":"0.36" } + es7.object.values { "electron":"0.36" } + es6.promise { "electron":"0.36" } + es7.promise.finally { "electron":"0.36" } + es6.reflect.apply { "electron":"0.36" } + es6.reflect.construct { "electron":"0.36" } + es6.reflect.define-property { "electron":"0.36" } + es6.reflect.delete-property { "electron":"0.36" } + es6.reflect.get { "electron":"0.36" } + es6.reflect.get-own-property-descriptor { "electron":"0.36" } + es6.reflect.get-prototype-of { "electron":"0.36" } + es6.reflect.has { "electron":"0.36" } + es6.reflect.is-extensible { "electron":"0.36" } + es6.reflect.own-keys { "electron":"0.36" } + es6.reflect.prevent-extensions { "electron":"0.36" } + es6.reflect.set { "electron":"0.36" } + es6.reflect.set-prototype-of { "electron":"0.36" } + es6.regexp.constructor { "electron":"0.36" } + es6.regexp.flags { "electron":"0.36" } + es6.regexp.match { "electron":"0.36" } + es6.regexp.replace { "electron":"0.36" } + es6.regexp.split { "electron":"0.36" } + es6.regexp.search { "electron":"0.36" } + es6.regexp.to-string { "electron":"0.36" } + es6.set { "electron":"0.36" } + es6.symbol { "electron":"0.36" } + es7.symbol.async-iterator { "electron":"0.36" } + es7.string.pad-start { "electron":"0.36" } + es7.string.pad-end { "electron":"0.36" } + es7.string.trim-left { "electron":"0.36" } + es7.string.trim-right { "electron":"0.36" } + es6.typed.array-buffer { "electron":"0.36" } + es6.typed.int8-array { "electron":"0.36" } + es6.typed.uint8-array { "electron":"0.36" } + es6.typed.uint8-clamped-array { "electron":"0.36" } + es6.typed.int16-array { "electron":"0.36" } + es6.typed.uint16-array { "electron":"0.36" } + es6.typed.int32-array { "electron":"0.36" } + es6.typed.uint32-array { "electron":"0.36" } + es6.typed.float32-array { "electron":"0.36" } + es6.typed.float64-array { "electron":"0.36" } + es6.weak-map { "electron":"0.36" } + es6.weak-set { "electron":"0.36" } + web.timers { "electron":"0.36" } + web.immediate { "electron":"0.36" } + web.dom.iterable { "electron":"0.36" } diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs2-force-all-transforms/in/in.js b/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-force-all-transforms/input.mjs similarity index 100% rename from packages/babel-preset-env/test/debug-fixtures/entry-corejs2-force-all-transforms/in/in.js rename to packages/babel-preset-env/test/fixtures/debug/entry-corejs2-force-all-transforms/input.mjs diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-force-all-transforms/options.json b/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-force-all-transforms/options.json new file mode 100644 index 000000000000..63316b736f5c --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-force-all-transforms/options.json @@ -0,0 +1,19 @@ +{ + "validateLogs": true, + "ignoreOutput": true, + "presets": [ + [ + "env", + { + "debug": true, + "modules": false, + "targets": { + "chrome": 55 + }, + "useBuiltIns": "entry", + "corejs": 2, + "forceAllTransforms": true + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-force-all-transforms/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-force-all-transforms/stdout.txt new file mode 100644 index 000000000000..1957d44bf5c7 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-force-all-transforms/stdout.txt @@ -0,0 +1,65 @@ +@babel/preset-env: `DEBUG` option + +Using targets: +{ + "chrome": "55" +} + +Using modules transform: false + +Using plugins: + proposal-nullish-coalescing-operator { "chrome":"55" } + proposal-optional-chaining { "chrome":"55" } + proposal-json-strings { "chrome":"55" } + proposal-optional-catch-binding { "chrome":"55" } + transform-parameters {} + proposal-async-generator-functions { "chrome":"55" } + proposal-object-rest-spread { "chrome":"55" } + transform-dotall-regex { "chrome":"55" } + proposal-unicode-property-regex { "chrome":"55" } + transform-named-capturing-groups-regex { "chrome":"55" } + transform-async-to-generator {} + transform-exponentiation-operator {} + transform-template-literals {} + transform-literals {} + transform-function-name {} + transform-arrow-functions {} + transform-block-scoped-functions {} + transform-classes {} + transform-object-super {} + transform-shorthand-properties {} + transform-duplicate-keys {} + transform-computed-properties {} + transform-for-of {} + transform-sticky-regex {} + transform-unicode-regex {} + transform-spread {} + transform-destructuring {} + transform-block-scoping {} + transform-typeof-symbol {} + transform-new-target {} + transform-regenerator {} + transform-member-expression-literals {} + transform-property-literals {} + transform-reserved-words {} + syntax-dynamic-import { "chrome":"55" } + +Using polyfills with `entry` option: + +[/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-force-all-transforms/input.mjs] Replaced @babel/polyfill entries with the following polyfills: + es7.array.flat-map { "chrome":"55" } + es6.array.sort { "chrome":"55" } + es7.object.define-getter { "chrome":"55" } + es7.object.define-setter { "chrome":"55" } + es7.object.lookup-getter { "chrome":"55" } + es7.object.lookup-setter { "chrome":"55" } + es6.object.to-string { "chrome":"55" } + es7.promise.finally { "chrome":"55" } + es7.symbol.async-iterator { "chrome":"55" } + es7.string.pad-start { "chrome":"55" } + es7.string.pad-end { "chrome":"55" } + es7.string.trim-left { "chrome":"55" } + es7.string.trim-right { "chrome":"55" } + web.timers { "chrome":"55" } + web.immediate { "chrome":"55" } + web.dom.iterable { "chrome":"55" } diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs2-no-import/in/in.js b/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-no-import/input.js similarity index 100% rename from packages/babel-preset-env/test/debug-fixtures/entry-corejs2-no-import/in/in.js rename to packages/babel-preset-env/test/fixtures/debug/entry-corejs2-no-import/input.js diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-no-import/options.json b/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-no-import/options.json new file mode 100644 index 000000000000..c1bb48f690fe --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-no-import/options.json @@ -0,0 +1,17 @@ +{ + "validateLogs": true, + "ignoreOutput": true, + "presets": [ + [ + "env", + { + "debug": true, + "targets": { + "node": 6 + }, + "useBuiltIns": "entry", + "corejs": 2 + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-no-import/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-no-import/stdout.txt new file mode 100644 index 000000000000..78ce760b41b3 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-no-import/stdout.txt @@ -0,0 +1,30 @@ +@babel/preset-env: `DEBUG` option + +Using targets: +{ + "node": "6" +} + +Using modules transform: auto + +Using plugins: + proposal-nullish-coalescing-operator { "node":"6" } + proposal-optional-chaining { "node":"6" } + proposal-json-strings { "node":"6" } + proposal-optional-catch-binding { "node":"6" } + proposal-async-generator-functions { "node":"6" } + proposal-object-rest-spread { "node":"6" } + transform-dotall-regex { "node":"6" } + proposal-unicode-property-regex { "node":"6" } + transform-named-capturing-groups-regex { "node":"6" } + transform-async-to-generator { "node":"6" } + transform-exponentiation-operator { "node":"6" } + transform-function-name { "node":"6" } + transform-for-of { "node":"6" } + transform-destructuring { "node":"6" } + transform-modules-commonjs { "node":"6" } + proposal-dynamic-import { "node":"6" } + +Using polyfills with `entry` option: + +[/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-no-import/input.js] Import of @babel/polyfill was not found. diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs2-proposals-chrome-71/in/in.js b/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-proposals-chrome-71/input.mjs similarity index 100% rename from packages/babel-preset-env/test/debug-fixtures/entry-corejs2-proposals-chrome-71/in/in.js rename to packages/babel-preset-env/test/fixtures/debug/entry-corejs2-proposals-chrome-71/input.mjs diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-proposals-chrome-71/options.json b/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-proposals-chrome-71/options.json new file mode 100644 index 000000000000..c40fbcce5f07 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-proposals-chrome-71/options.json @@ -0,0 +1,17 @@ +{ + "validateLogs": true, + "ignoreOutput": true, + "presets": [ + [ + "env", + { + "debug": true, + "targets": { + "browsers": "chrome 71" + }, + "useBuiltIns": "entry", + "corejs": { "version": 2, "proposals": true } + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-proposals-chrome-71/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-proposals-chrome-71/stdout.txt new file mode 100644 index 000000000000..7530969348af --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-proposals-chrome-71/stdout.txt @@ -0,0 +1,25 @@ +@babel/preset-env: `DEBUG` option + +Using targets: +{ + "chrome": "71" +} + +Using modules transform: auto + +Using plugins: + proposal-nullish-coalescing-operator { "chrome":"71" } + proposal-optional-chaining { "chrome":"71" } + syntax-json-strings { "chrome":"71" } + syntax-optional-catch-binding { "chrome":"71" } + syntax-async-generators { "chrome":"71" } + syntax-object-rest-spread { "chrome":"71" } + transform-modules-commonjs { "chrome":"71" } + proposal-dynamic-import { "chrome":"71" } + +Using polyfills with `entry` option: + +[/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-proposals-chrome-71/input.mjs] Replaced @babel/polyfill entries with the following polyfills: + web.timers { "chrome":"71" } + web.immediate { "chrome":"71" } + web.dom.iterable { "chrome":"71" } diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs2-proposals/in/in.js b/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-proposals/input.mjs similarity index 100% rename from packages/babel-preset-env/test/debug-fixtures/entry-corejs2-proposals/in/in.js rename to packages/babel-preset-env/test/fixtures/debug/entry-corejs2-proposals/input.mjs diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-proposals/options.json b/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-proposals/options.json new file mode 100644 index 000000000000..b7911d7ee093 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-proposals/options.json @@ -0,0 +1,14 @@ +{ + "validateLogs": true, + "ignoreOutput": true, + "presets": [ + [ + "env", + { + "debug": true, + "useBuiltIns": "entry", + "corejs": { "version": 2, "proposals": true } + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-proposals/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-proposals/stdout.txt new file mode 100644 index 000000000000..450f60f279b1 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-proposals/stdout.txt @@ -0,0 +1,196 @@ +@babel/preset-env: `DEBUG` option + +Using targets: +{} + +Using modules transform: auto + +Using plugins: + proposal-nullish-coalescing-operator {} + proposal-optional-chaining {} + proposal-json-strings {} + proposal-optional-catch-binding {} + transform-parameters {} + proposal-async-generator-functions {} + proposal-object-rest-spread {} + transform-dotall-regex {} + proposal-unicode-property-regex {} + transform-named-capturing-groups-regex {} + transform-async-to-generator {} + transform-exponentiation-operator {} + transform-template-literals {} + transform-literals {} + transform-function-name {} + transform-arrow-functions {} + transform-block-scoped-functions {} + transform-classes {} + transform-object-super {} + transform-shorthand-properties {} + transform-duplicate-keys {} + transform-computed-properties {} + transform-for-of {} + transform-sticky-regex {} + transform-unicode-regex {} + transform-spread {} + transform-destructuring {} + transform-block-scoping {} + transform-typeof-symbol {} + transform-new-target {} + transform-regenerator {} + transform-member-expression-literals {} + transform-property-literals {} + transform-reserved-words {} + transform-modules-commonjs {} + proposal-dynamic-import {} + +Using polyfills with `entry` option: + +[/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-proposals/input.mjs] Replaced @babel/polyfill entries with the following polyfills: + es6.array.copy-within {} + es6.array.every {} + es6.array.fill {} + es6.array.filter {} + es6.array.find {} + es6.array.find-index {} + es7.array.flat-map {} + es6.array.for-each {} + es6.array.from {} + es7.array.includes {} + es6.array.index-of {} + es6.array.is-array {} + es6.array.iterator {} + es6.array.last-index-of {} + es6.array.map {} + es6.array.of {} + es6.array.reduce {} + es6.array.reduce-right {} + es6.array.some {} + es6.array.sort {} + es6.array.species {} + es6.date.now {} + es6.date.to-iso-string {} + es6.date.to-json {} + es6.date.to-primitive {} + es6.date.to-string {} + es6.function.bind {} + es6.function.has-instance {} + es6.function.name {} + es6.map {} + es6.math.acosh {} + es6.math.asinh {} + es6.math.atanh {} + es6.math.cbrt {} + es6.math.clz32 {} + es6.math.cosh {} + es6.math.expm1 {} + es6.math.fround {} + es6.math.hypot {} + es6.math.imul {} + es6.math.log1p {} + es6.math.log10 {} + es6.math.log2 {} + es6.math.sign {} + es6.math.sinh {} + es6.math.tanh {} + es6.math.trunc {} + es6.number.constructor {} + es6.number.epsilon {} + es6.number.is-finite {} + es6.number.is-integer {} + es6.number.is-nan {} + es6.number.is-safe-integer {} + es6.number.max-safe-integer {} + es6.number.min-safe-integer {} + es6.number.parse-float {} + es6.number.parse-int {} + es6.object.assign {} + es6.object.create {} + es7.object.define-getter {} + es7.object.define-setter {} + es6.object.define-property {} + es6.object.define-properties {} + es7.object.entries {} + es6.object.freeze {} + es6.object.get-own-property-descriptor {} + es7.object.get-own-property-descriptors {} + es6.object.get-own-property-names {} + es6.object.get-prototype-of {} + es7.object.lookup-getter {} + es7.object.lookup-setter {} + es6.object.prevent-extensions {} + es6.object.to-string {} + es6.object.is {} + es6.object.is-frozen {} + es6.object.is-sealed {} + es6.object.is-extensible {} + es6.object.keys {} + es6.object.seal {} + es6.object.set-prototype-of {} + es7.object.values {} + es6.promise {} + es7.promise.finally {} + es6.reflect.apply {} + es6.reflect.construct {} + es6.reflect.define-property {} + es6.reflect.delete-property {} + es6.reflect.get {} + es6.reflect.get-own-property-descriptor {} + es6.reflect.get-prototype-of {} + es6.reflect.has {} + es6.reflect.is-extensible {} + es6.reflect.own-keys {} + es6.reflect.prevent-extensions {} + es6.reflect.set {} + es6.reflect.set-prototype-of {} + es6.regexp.constructor {} + es6.regexp.flags {} + es6.regexp.match {} + es6.regexp.replace {} + es6.regexp.split {} + es6.regexp.search {} + es6.regexp.to-string {} + es6.set {} + es6.symbol {} + es7.symbol.async-iterator {} + es6.string.anchor {} + es6.string.big {} + es6.string.blink {} + es6.string.bold {} + es6.string.code-point-at {} + es6.string.ends-with {} + es6.string.fixed {} + es6.string.fontcolor {} + es6.string.fontsize {} + es6.string.from-code-point {} + es6.string.includes {} + es6.string.italics {} + es6.string.iterator {} + es6.string.link {} + es7.string.pad-start {} + es7.string.pad-end {} + es6.string.raw {} + es6.string.repeat {} + es6.string.small {} + es6.string.starts-with {} + es6.string.strike {} + es6.string.sub {} + es6.string.sup {} + es6.string.trim {} + es7.string.trim-left {} + es7.string.trim-right {} + es6.typed.array-buffer {} + es6.typed.data-view {} + es6.typed.int8-array {} + es6.typed.uint8-array {} + es6.typed.uint8-clamped-array {} + es6.typed.int16-array {} + es6.typed.uint16-array {} + es6.typed.int32-array {} + es6.typed.uint32-array {} + es6.typed.float32-array {} + es6.typed.float64-array {} + es6.weak-map {} + es6.weak-set {} + web.timers {} + web.immediate {} + web.dom.iterable {} diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs2-shippedProposals-chrome-71/in/in.js b/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-shippedProposals-chrome-71/input.mjs similarity index 100% rename from packages/babel-preset-env/test/debug-fixtures/entry-corejs2-shippedProposals-chrome-71/in/in.js rename to packages/babel-preset-env/test/fixtures/debug/entry-corejs2-shippedProposals-chrome-71/input.mjs diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-shippedProposals-chrome-71/options.json b/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-shippedProposals-chrome-71/options.json new file mode 100644 index 000000000000..eca9a1a6033d --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-shippedProposals-chrome-71/options.json @@ -0,0 +1,18 @@ +{ + "validateLogs": true, + "ignoreOutput": true, + "presets": [ + [ + "env", + { + "debug": true, + "targets": { + "browsers": "chrome 71" + }, + "shippedProposals": true, + "useBuiltIns": "entry", + "corejs": 2 + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-shippedProposals-chrome-71/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-shippedProposals-chrome-71/stdout.txt new file mode 100644 index 000000000000..9eafdd6a2c11 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-shippedProposals-chrome-71/stdout.txt @@ -0,0 +1,26 @@ +@babel/preset-env: `DEBUG` option + +Using targets: +{ + "chrome": "71" +} + +Using modules transform: auto + +Using plugins: + proposal-numeric-separator { "chrome":"71" } + proposal-nullish-coalescing-operator { "chrome":"71" } + proposal-optional-chaining { "chrome":"71" } + syntax-json-strings { "chrome":"71" } + syntax-optional-catch-binding { "chrome":"71" } + syntax-async-generators { "chrome":"71" } + syntax-object-rest-spread { "chrome":"71" } + transform-modules-commonjs { "chrome":"71" } + proposal-dynamic-import { "chrome":"71" } + +Using polyfills with `entry` option: + +[/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-shippedProposals-chrome-71/input.mjs] Replaced @babel/polyfill entries with the following polyfills: + web.timers { "chrome":"71" } + web.immediate { "chrome":"71" } + web.dom.iterable { "chrome":"71" } diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs2-shippedProposals/in/in.js b/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-shippedProposals/input.mjs similarity index 100% rename from packages/babel-preset-env/test/debug-fixtures/entry-corejs2-shippedProposals/in/in.js rename to packages/babel-preset-env/test/fixtures/debug/entry-corejs2-shippedProposals/input.mjs diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-shippedProposals/options.json b/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-shippedProposals/options.json new file mode 100644 index 000000000000..7cc745ffc6f5 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-shippedProposals/options.json @@ -0,0 +1,15 @@ +{ + "validateLogs": true, + "ignoreOutput": true, + "presets": [ + [ + "env", + { + "debug": true, + "shippedProposals": true, + "useBuiltIns": "entry", + "corejs": 2 + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-shippedProposals/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-shippedProposals/stdout.txt new file mode 100644 index 000000000000..a23c7d99305d --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-shippedProposals/stdout.txt @@ -0,0 +1,197 @@ +@babel/preset-env: `DEBUG` option + +Using targets: +{} + +Using modules transform: auto + +Using plugins: + proposal-numeric-separator {} + proposal-nullish-coalescing-operator {} + proposal-optional-chaining {} + proposal-json-strings {} + proposal-optional-catch-binding {} + transform-parameters {} + proposal-async-generator-functions {} + proposal-object-rest-spread {} + transform-dotall-regex {} + proposal-unicode-property-regex {} + transform-named-capturing-groups-regex {} + transform-async-to-generator {} + transform-exponentiation-operator {} + transform-template-literals {} + transform-literals {} + transform-function-name {} + transform-arrow-functions {} + transform-block-scoped-functions {} + transform-classes {} + transform-object-super {} + transform-shorthand-properties {} + transform-duplicate-keys {} + transform-computed-properties {} + transform-for-of {} + transform-sticky-regex {} + transform-unicode-regex {} + transform-spread {} + transform-destructuring {} + transform-block-scoping {} + transform-typeof-symbol {} + transform-new-target {} + transform-regenerator {} + transform-member-expression-literals {} + transform-property-literals {} + transform-reserved-words {} + transform-modules-commonjs {} + proposal-dynamic-import {} + +Using polyfills with `entry` option: + +[/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-shippedProposals/input.mjs] Replaced @babel/polyfill entries with the following polyfills: + es6.array.copy-within {} + es6.array.every {} + es6.array.fill {} + es6.array.filter {} + es6.array.find {} + es6.array.find-index {} + es7.array.flat-map {} + es6.array.for-each {} + es6.array.from {} + es7.array.includes {} + es6.array.index-of {} + es6.array.is-array {} + es6.array.iterator {} + es6.array.last-index-of {} + es6.array.map {} + es6.array.of {} + es6.array.reduce {} + es6.array.reduce-right {} + es6.array.some {} + es6.array.sort {} + es6.array.species {} + es6.date.now {} + es6.date.to-iso-string {} + es6.date.to-json {} + es6.date.to-primitive {} + es6.date.to-string {} + es6.function.bind {} + es6.function.has-instance {} + es6.function.name {} + es6.map {} + es6.math.acosh {} + es6.math.asinh {} + es6.math.atanh {} + es6.math.cbrt {} + es6.math.clz32 {} + es6.math.cosh {} + es6.math.expm1 {} + es6.math.fround {} + es6.math.hypot {} + es6.math.imul {} + es6.math.log1p {} + es6.math.log10 {} + es6.math.log2 {} + es6.math.sign {} + es6.math.sinh {} + es6.math.tanh {} + es6.math.trunc {} + es6.number.constructor {} + es6.number.epsilon {} + es6.number.is-finite {} + es6.number.is-integer {} + es6.number.is-nan {} + es6.number.is-safe-integer {} + es6.number.max-safe-integer {} + es6.number.min-safe-integer {} + es6.number.parse-float {} + es6.number.parse-int {} + es6.object.assign {} + es6.object.create {} + es7.object.define-getter {} + es7.object.define-setter {} + es6.object.define-property {} + es6.object.define-properties {} + es7.object.entries {} + es6.object.freeze {} + es6.object.get-own-property-descriptor {} + es7.object.get-own-property-descriptors {} + es6.object.get-own-property-names {} + es6.object.get-prototype-of {} + es7.object.lookup-getter {} + es7.object.lookup-setter {} + es6.object.prevent-extensions {} + es6.object.to-string {} + es6.object.is {} + es6.object.is-frozen {} + es6.object.is-sealed {} + es6.object.is-extensible {} + es6.object.keys {} + es6.object.seal {} + es6.object.set-prototype-of {} + es7.object.values {} + es6.promise {} + es7.promise.finally {} + es6.reflect.apply {} + es6.reflect.construct {} + es6.reflect.define-property {} + es6.reflect.delete-property {} + es6.reflect.get {} + es6.reflect.get-own-property-descriptor {} + es6.reflect.get-prototype-of {} + es6.reflect.has {} + es6.reflect.is-extensible {} + es6.reflect.own-keys {} + es6.reflect.prevent-extensions {} + es6.reflect.set {} + es6.reflect.set-prototype-of {} + es6.regexp.constructor {} + es6.regexp.flags {} + es6.regexp.match {} + es6.regexp.replace {} + es6.regexp.split {} + es6.regexp.search {} + es6.regexp.to-string {} + es6.set {} + es6.symbol {} + es7.symbol.async-iterator {} + es6.string.anchor {} + es6.string.big {} + es6.string.blink {} + es6.string.bold {} + es6.string.code-point-at {} + es6.string.ends-with {} + es6.string.fixed {} + es6.string.fontcolor {} + es6.string.fontsize {} + es6.string.from-code-point {} + es6.string.includes {} + es6.string.italics {} + es6.string.iterator {} + es6.string.link {} + es7.string.pad-start {} + es7.string.pad-end {} + es6.string.raw {} + es6.string.repeat {} + es6.string.small {} + es6.string.starts-with {} + es6.string.strike {} + es6.string.sub {} + es6.string.sup {} + es6.string.trim {} + es7.string.trim-left {} + es7.string.trim-right {} + es6.typed.array-buffer {} + es6.typed.data-view {} + es6.typed.int8-array {} + es6.typed.uint8-array {} + es6.typed.uint8-clamped-array {} + es6.typed.int16-array {} + es6.typed.uint16-array {} + es6.typed.int32-array {} + es6.typed.uint32-array {} + es6.typed.float32-array {} + es6.typed.float64-array {} + es6.weak-map {} + es6.weak-set {} + web.timers {} + web.immediate {} + web.dom.iterable {} diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs2-specific-targets/in/in.js b/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-specific-targets/input.mjs similarity index 100% rename from packages/babel-preset-env/test/debug-fixtures/entry-corejs2-specific-targets/in/in.js rename to packages/babel-preset-env/test/fixtures/debug/entry-corejs2-specific-targets/input.mjs diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-specific-targets/options.json b/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-specific-targets/options.json new file mode 100644 index 000000000000..2c036f8e4d1d --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-specific-targets/options.json @@ -0,0 +1,17 @@ +{ + "validateLogs": true, + "ignoreOutput": true, + "presets": [ + [ + "env", + { + "debug": true, + "targets": { + "browsers": "ie 10, ios 9, safari 7, edge 13, chrome 54, firefox 49" + }, + "useBuiltIns": "entry", + "corejs": 2 + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-specific-targets/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-specific-targets/stdout.txt new file mode 100644 index 000000000000..d8ff428f891a --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-specific-targets/stdout.txt @@ -0,0 +1,181 @@ +@babel/preset-env: `DEBUG` option + +Using targets: +{ + "chrome": "54", + "edge": "13", + "firefox": "49", + "ie": "10", + "ios": "9", + "safari": "7" +} + +Using modules transform: auto + +Using plugins: + proposal-nullish-coalescing-operator { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + proposal-optional-chaining { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + proposal-json-strings { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + proposal-optional-catch-binding { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + transform-parameters { "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + proposal-async-generator-functions { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + proposal-object-rest-spread { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + transform-dotall-regex { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + proposal-unicode-property-regex { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + transform-named-capturing-groups-regex { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + transform-async-to-generator { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + transform-exponentiation-operator { "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + transform-template-literals { "ie":"10", "ios":"9", "safari":"7" } + transform-literals { "firefox":"49", "ie":"10", "safari":"7" } + transform-function-name { "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + transform-arrow-functions { "ie":"10", "ios":"9", "safari":"7" } + transform-block-scoped-functions { "ie":"10", "ios":"9", "safari":"7" } + transform-classes { "ie":"10", "ios":"9", "safari":"7" } + transform-object-super { "ie":"10", "ios":"9", "safari":"7" } + transform-shorthand-properties { "ie":"10", "safari":"7" } + transform-duplicate-keys { "ie":"10", "safari":"7" } + transform-computed-properties { "ie":"10", "safari":"7" } + transform-for-of { "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + transform-sticky-regex { "ie":"10", "ios":"9", "safari":"7" } + transform-unicode-regex { "ie":"10", "ios":"9", "safari":"7" } + transform-spread { "ie":"10", "ios":"9", "safari":"7" } + transform-destructuring { "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + transform-block-scoping { "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + transform-typeof-symbol { "ie":"10", "safari":"7" } + transform-new-target { "edge":"13", "ie":"10", "ios":"9", "safari":"7" } + transform-regenerator { "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + transform-modules-commonjs { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + proposal-dynamic-import { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + +Using polyfills with `entry` option: + +[/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-specific-targets/input.mjs] Replaced @babel/polyfill entries with the following polyfills: + es6.array.copy-within { "ie":"10", "safari":"7" } + es6.array.fill { "ie":"10", "safari":"7" } + es6.array.find { "ie":"10", "safari":"7" } + es6.array.find-index { "ie":"10", "safari":"7" } + es7.array.flat-map { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + es6.array.from { "edge":"13", "ie":"10", "ios":"9", "safari":"7" } + es7.array.includes { "edge":"13", "ie":"10", "ios":"9", "safari":"7" } + es6.array.iterator { "ie":"10", "safari":"7" } + es6.array.of { "ie":"10", "safari":"7" } + es6.array.sort { "chrome":"54", "ios":"9", "safari":"7" } + es6.array.species { "ie":"10", "ios":"9", "safari":"7" } + es6.date.to-json { "ios":"9", "safari":"7" } + es6.date.to-primitive { "edge":"13", "ie":"10", "ios":"9", "safari":"7" } + es6.function.has-instance { "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + es6.function.name { "edge":"13", "ie":"10" } + es6.map { "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + es6.math.acosh { "ie":"10", "safari":"7" } + es6.math.asinh { "ie":"10", "safari":"7" } + es6.math.atanh { "ie":"10", "safari":"7" } + es6.math.cbrt { "ie":"10", "safari":"7" } + es6.math.clz32 { "ie":"10", "safari":"7" } + es6.math.cosh { "ie":"10", "safari":"7" } + es6.math.expm1 { "ie":"10", "safari":"7" } + es6.math.fround { "ie":"10", "safari":"7" } + es6.math.hypot { "ie":"10", "safari":"7" } + es6.math.imul { "ie":"10" } + es6.math.log1p { "ie":"10", "safari":"7" } + es6.math.log10 { "ie":"10", "safari":"7" } + es6.math.log2 { "ie":"10", "safari":"7" } + es6.math.sign { "ie":"10", "safari":"7" } + es6.math.sinh { "ie":"10", "safari":"7" } + es6.math.tanh { "ie":"10", "safari":"7" } + es6.math.trunc { "ie":"10", "safari":"7" } + es6.number.constructor { "ie":"10", "safari":"7" } + es6.number.epsilon { "ie":"10", "safari":"7" } + es6.number.is-finite { "ie":"10", "safari":"7" } + es6.number.is-integer { "ie":"10", "safari":"7" } + es6.number.is-nan { "ie":"10", "safari":"7" } + es6.number.is-safe-integer { "ie":"10", "safari":"7" } + es6.number.max-safe-integer { "ie":"10", "safari":"7" } + es6.number.min-safe-integer { "ie":"10", "safari":"7" } + es6.number.parse-float { "ie":"10", "safari":"7" } + es6.number.parse-int { "ie":"10", "safari":"7" } + es6.object.assign { "ie":"10", "ios":"9", "safari":"7" } + es7.object.define-getter { "chrome":"54", "edge":"13", "ie":"10", "safari":"7" } + es7.object.define-setter { "chrome":"54", "edge":"13", "ie":"10", "safari":"7" } + es7.object.entries { "edge":"13", "ie":"10", "ios":"9", "safari":"7" } + es6.object.freeze { "ie":"10", "safari":"7" } + es6.object.get-own-property-descriptor { "ie":"10", "safari":"7" } + es7.object.get-own-property-descriptors { "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + es6.object.get-own-property-names { "ie":"10", "safari":"7" } + es6.object.get-prototype-of { "ie":"10", "safari":"7" } + es7.object.lookup-getter { "chrome":"54", "edge":"13", "ie":"10", "safari":"7" } + es7.object.lookup-setter { "chrome":"54", "edge":"13", "ie":"10", "safari":"7" } + es6.object.prevent-extensions { "ie":"10", "safari":"7" } + es6.object.to-string { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + es6.object.is { "ie":"10", "safari":"7" } + es6.object.is-frozen { "ie":"10", "safari":"7" } + es6.object.is-sealed { "ie":"10", "safari":"7" } + es6.object.is-extensible { "ie":"10", "safari":"7" } + es6.object.keys { "ie":"10", "safari":"7" } + es6.object.seal { "ie":"10", "safari":"7" } + es6.object.set-prototype-of { "ie":"10", "safari":"7" } + es7.object.values { "edge":"13", "ie":"10", "ios":"9", "safari":"7" } + es6.promise { "edge":"13", "ie":"10", "ios":"9", "safari":"7" } + es7.promise.finally { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + es6.reflect.apply { "ie":"10", "ios":"9", "safari":"7" } + es6.reflect.construct { "ie":"10", "ios":"9", "safari":"7" } + es6.reflect.define-property { "ie":"10", "ios":"9", "safari":"7" } + es6.reflect.delete-property { "ie":"10", "ios":"9", "safari":"7" } + es6.reflect.get { "ie":"10", "ios":"9", "safari":"7" } + es6.reflect.get-own-property-descriptor { "ie":"10", "ios":"9", "safari":"7" } + es6.reflect.get-prototype-of { "ie":"10", "ios":"9", "safari":"7" } + es6.reflect.has { "ie":"10", "ios":"9", "safari":"7" } + es6.reflect.is-extensible { "ie":"10", "ios":"9", "safari":"7" } + es6.reflect.own-keys { "ie":"10", "ios":"9", "safari":"7" } + es6.reflect.prevent-extensions { "ie":"10", "ios":"9", "safari":"7" } + es6.reflect.set { "ie":"10", "ios":"9", "safari":"7" } + es6.reflect.set-prototype-of { "ie":"10", "ios":"9", "safari":"7" } + es6.regexp.constructor { "edge":"13", "ie":"10", "ios":"9", "safari":"7" } + es6.regexp.flags { "edge":"13", "ie":"10", "safari":"7" } + es6.regexp.match { "edge":"13", "ie":"10", "ios":"9", "safari":"7" } + es6.regexp.replace { "edge":"13", "ie":"10", "ios":"9", "safari":"7" } + es6.regexp.split { "edge":"13", "ie":"10", "ios":"9", "safari":"7" } + es6.regexp.search { "edge":"13", "ie":"10", "ios":"9", "safari":"7" } + es6.regexp.to-string { "edge":"13", "ie":"10", "ios":"9", "safari":"7" } + es6.set { "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + es6.symbol { "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + es7.symbol.async-iterator { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + es6.string.anchor { "ie":"10" } + es6.string.big { "ie":"10" } + es6.string.blink { "ie":"10" } + es6.string.bold { "ie":"10" } + es6.string.code-point-at { "ie":"10", "safari":"7" } + es6.string.ends-with { "ie":"10", "safari":"7" } + es6.string.fixed { "ie":"10" } + es6.string.fontcolor { "ie":"10" } + es6.string.fontsize { "ie":"10" } + es6.string.from-code-point { "ie":"10", "safari":"7" } + es6.string.includes { "ie":"10", "safari":"7" } + es6.string.italics { "ie":"10" } + es6.string.iterator { "ie":"10", "safari":"7" } + es6.string.link { "ie":"10" } + es7.string.pad-start { "chrome":"54", "edge":"13", "ie":"10", "ios":"9", "safari":"7" } + es7.string.pad-end { "chrome":"54", "edge":"13", "ie":"10", "ios":"9", "safari":"7" } + es6.string.raw { "ie":"10", "safari":"7" } + es6.string.repeat { "ie":"10", "safari":"7" } + es6.string.small { "ie":"10" } + es6.string.starts-with { "ie":"10", "safari":"7" } + es6.string.strike { "ie":"10" } + es6.string.sub { "ie":"10" } + es6.string.sup { "ie":"10" } + es7.string.trim-left { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + es7.string.trim-right { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + es6.typed.array-buffer { "ie":"10", "ios":"9", "safari":"7" } + es6.typed.int8-array { "ie":"10", "ios":"9", "safari":"7" } + es6.typed.uint8-array { "ie":"10", "ios":"9", "safari":"7" } + es6.typed.uint8-clamped-array { "ie":"10", "ios":"9", "safari":"7" } + es6.typed.int16-array { "ie":"10", "ios":"9", "safari":"7" } + es6.typed.uint16-array { "ie":"10", "ios":"9", "safari":"7" } + es6.typed.int32-array { "ie":"10", "ios":"9", "safari":"7" } + es6.typed.uint32-array { "ie":"10", "ios":"9", "safari":"7" } + es6.typed.float32-array { "ie":"10", "ios":"9", "safari":"7" } + es6.typed.float64-array { "ie":"10", "ios":"9", "safari":"7" } + es6.weak-map { "edge":"13", "firefox":"49", "ie":"10", "safari":"7" } + es6.weak-set { "edge":"13", "firefox":"49", "ie":"10", "safari":"7" } + web.timers { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + web.immediate { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + web.dom.iterable { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs2-versions-decimals/in/in.js b/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-versions-decimals/input.mjs similarity index 100% rename from packages/babel-preset-env/test/debug-fixtures/entry-corejs2-versions-decimals/in/in.js rename to packages/babel-preset-env/test/fixtures/debug/entry-corejs2-versions-decimals/input.mjs diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-versions-decimals/options.json b/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-versions-decimals/options.json new file mode 100644 index 000000000000..637bfdfe8456 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-versions-decimals/options.json @@ -0,0 +1,20 @@ +{ + "validateLogs": true, + "ignoreOutput": true, + "presets": [ + [ + "env", + { + "useBuiltIns": "entry", + "corejs": 2, + "debug": true, + "targets": { + "chrome": 54, + "electron": 0.36, + "node": 6.1, + "ie": 10 + } + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-versions-decimals/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-versions-decimals/stdout.txt new file mode 100644 index 000000000000..5e0461926b22 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-versions-decimals/stdout.txt @@ -0,0 +1,186 @@ +Warning, the following targets are using a decimal version: + + electron: 0.36 + node: 6.1 + +We recommend using a string for minor/patch versions to avoid numbers like 6.10 +getting parsed as 6.1, which can lead to unexpected behavior. + +@babel/preset-env: `DEBUG` option + +Using targets: +{ + "chrome": "54", + "electron": "0.36", + "ie": "10", + "node": "6.1" +} + +Using modules transform: auto + +Using plugins: + proposal-nullish-coalescing-operator { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } + proposal-optional-chaining { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } + proposal-json-strings { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } + proposal-optional-catch-binding { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } + transform-parameters { "electron":"0.36", "ie":"10" } + proposal-async-generator-functions { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } + proposal-object-rest-spread { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } + transform-dotall-regex { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } + proposal-unicode-property-regex { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } + transform-named-capturing-groups-regex { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } + transform-async-to-generator { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } + transform-exponentiation-operator { "electron":"0.36", "ie":"10", "node":"6.1" } + transform-template-literals { "ie":"10" } + transform-literals { "ie":"10" } + transform-function-name { "electron":"0.36", "ie":"10", "node":"6.1" } + transform-arrow-functions { "ie":"10" } + transform-block-scoped-functions { "ie":"10" } + transform-classes { "ie":"10" } + transform-object-super { "ie":"10" } + transform-shorthand-properties { "ie":"10" } + transform-duplicate-keys { "ie":"10" } + transform-computed-properties { "ie":"10" } + transform-for-of { "electron":"0.36", "ie":"10", "node":"6.1" } + transform-sticky-regex { "electron":"0.36", "ie":"10" } + transform-unicode-regex { "electron":"0.36", "ie":"10" } + transform-spread { "ie":"10" } + transform-destructuring { "electron":"0.36", "ie":"10", "node":"6.1" } + transform-block-scoping { "electron":"0.36", "ie":"10" } + transform-typeof-symbol { "ie":"10" } + transform-new-target { "ie":"10" } + transform-regenerator { "electron":"0.36", "ie":"10" } + transform-modules-commonjs { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } + proposal-dynamic-import { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } + +Using polyfills with `entry` option: + +[/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-versions-decimals/input.mjs] Replaced @babel/polyfill entries with the following polyfills: + es6.array.copy-within { "ie":"10" } + es6.array.fill { "ie":"10" } + es6.array.find { "ie":"10" } + es6.array.find-index { "ie":"10" } + es7.array.flat-map { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } + es6.array.from { "electron":"0.36", "ie":"10", "node":"6.1" } + es7.array.includes { "ie":"10" } + es6.array.iterator { "ie":"10" } + es6.array.of { "ie":"10" } + es6.array.sort { "chrome":"54", "electron":"0.36", "node":"6.1" } + es6.array.species { "electron":"0.36", "ie":"10", "node":"6.1" } + es6.date.to-primitive { "ie":"10" } + es6.function.has-instance { "electron":"0.36", "ie":"10", "node":"6.1" } + es6.function.name { "ie":"10" } + es6.map { "electron":"0.36", "ie":"10", "node":"6.1" } + es6.math.acosh { "ie":"10" } + es6.math.asinh { "ie":"10" } + es6.math.atanh { "ie":"10" } + es6.math.cbrt { "ie":"10" } + es6.math.clz32 { "ie":"10" } + es6.math.cosh { "ie":"10" } + es6.math.expm1 { "ie":"10" } + es6.math.fround { "ie":"10" } + es6.math.hypot { "ie":"10" } + es6.math.imul { "ie":"10" } + es6.math.log1p { "ie":"10" } + es6.math.log10 { "ie":"10" } + es6.math.log2 { "ie":"10" } + es6.math.sign { "ie":"10" } + es6.math.sinh { "ie":"10" } + es6.math.tanh { "ie":"10" } + es6.math.trunc { "ie":"10" } + es6.number.constructor { "ie":"10" } + es6.number.epsilon { "ie":"10" } + es6.number.is-finite { "ie":"10" } + es6.number.is-integer { "ie":"10" } + es6.number.is-nan { "ie":"10" } + es6.number.is-safe-integer { "ie":"10" } + es6.number.max-safe-integer { "ie":"10" } + es6.number.min-safe-integer { "ie":"10" } + es6.number.parse-float { "ie":"10" } + es6.number.parse-int { "ie":"10" } + es6.object.assign { "electron":"0.36", "ie":"10" } + es7.object.define-getter { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } + es7.object.define-setter { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } + es7.object.entries { "electron":"0.36", "ie":"10", "node":"6.1" } + es6.object.freeze { "ie":"10" } + es6.object.get-own-property-descriptor { "ie":"10" } + es7.object.get-own-property-descriptors { "electron":"0.36", "ie":"10", "node":"6.1" } + es6.object.get-own-property-names { "ie":"10" } + es6.object.get-prototype-of { "ie":"10" } + es7.object.lookup-getter { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } + es7.object.lookup-setter { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } + es6.object.prevent-extensions { "ie":"10" } + es6.object.to-string { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } + es6.object.is { "ie":"10" } + es6.object.is-frozen { "ie":"10" } + es6.object.is-sealed { "ie":"10" } + es6.object.is-extensible { "ie":"10" } + es6.object.keys { "ie":"10" } + es6.object.seal { "ie":"10" } + es6.object.set-prototype-of { "ie":"10" } + es7.object.values { "electron":"0.36", "ie":"10", "node":"6.1" } + es6.promise { "electron":"0.36", "ie":"10", "node":"6.1" } + es7.promise.finally { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } + es6.reflect.apply { "electron":"0.36", "ie":"10" } + es6.reflect.construct { "electron":"0.36", "ie":"10" } + es6.reflect.define-property { "electron":"0.36", "ie":"10" } + es6.reflect.delete-property { "electron":"0.36", "ie":"10" } + es6.reflect.get { "electron":"0.36", "ie":"10" } + es6.reflect.get-own-property-descriptor { "electron":"0.36", "ie":"10" } + es6.reflect.get-prototype-of { "electron":"0.36", "ie":"10" } + es6.reflect.has { "electron":"0.36", "ie":"10" } + es6.reflect.is-extensible { "electron":"0.36", "ie":"10" } + es6.reflect.own-keys { "electron":"0.36", "ie":"10" } + es6.reflect.prevent-extensions { "electron":"0.36", "ie":"10" } + es6.reflect.set { "electron":"0.36", "ie":"10" } + es6.reflect.set-prototype-of { "electron":"0.36", "ie":"10" } + es6.regexp.constructor { "electron":"0.36", "ie":"10" } + es6.regexp.flags { "electron":"0.36", "ie":"10" } + es6.regexp.match { "electron":"0.36", "ie":"10" } + es6.regexp.replace { "electron":"0.36", "ie":"10" } + es6.regexp.split { "electron":"0.36", "ie":"10" } + es6.regexp.search { "electron":"0.36", "ie":"10" } + es6.regexp.to-string { "electron":"0.36", "ie":"10" } + es6.set { "electron":"0.36", "ie":"10", "node":"6.1" } + es6.symbol { "electron":"0.36", "ie":"10", "node":"6.1" } + es7.symbol.async-iterator { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } + es6.string.anchor { "ie":"10" } + es6.string.big { "ie":"10" } + es6.string.blink { "ie":"10" } + es6.string.bold { "ie":"10" } + es6.string.code-point-at { "ie":"10" } + es6.string.ends-with { "ie":"10" } + es6.string.fixed { "ie":"10" } + es6.string.fontcolor { "ie":"10" } + es6.string.fontsize { "ie":"10" } + es6.string.from-code-point { "ie":"10" } + es6.string.includes { "ie":"10" } + es6.string.italics { "ie":"10" } + es6.string.iterator { "ie":"10" } + es6.string.link { "ie":"10" } + es7.string.pad-start { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } + es7.string.pad-end { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } + es6.string.raw { "ie":"10" } + es6.string.repeat { "ie":"10" } + es6.string.small { "ie":"10" } + es6.string.starts-with { "ie":"10" } + es6.string.strike { "ie":"10" } + es6.string.sub { "ie":"10" } + es6.string.sup { "ie":"10" } + es7.string.trim-left { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } + es7.string.trim-right { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } + es6.typed.array-buffer { "electron":"0.36", "ie":"10", "node":"6.1" } + es6.typed.int8-array { "electron":"0.36", "ie":"10", "node":"6.1" } + es6.typed.uint8-array { "electron":"0.36", "ie":"10", "node":"6.1" } + es6.typed.uint8-clamped-array { "electron":"0.36", "ie":"10", "node":"6.1" } + es6.typed.int16-array { "electron":"0.36", "ie":"10", "node":"6.1" } + es6.typed.uint16-array { "electron":"0.36", "ie":"10", "node":"6.1" } + es6.typed.int32-array { "electron":"0.36", "ie":"10", "node":"6.1" } + es6.typed.uint32-array { "electron":"0.36", "ie":"10", "node":"6.1" } + es6.typed.float32-array { "electron":"0.36", "ie":"10", "node":"6.1" } + es6.typed.float64-array { "electron":"0.36", "ie":"10", "node":"6.1" } + es6.weak-map { "electron":"0.36", "ie":"10", "node":"6.1" } + es6.weak-set { "electron":"0.36", "ie":"10", "node":"6.1" } + web.timers { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } + web.immediate { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } + web.dom.iterable { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs2-versions-strings/in/in.js b/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-versions-strings/input.mjs similarity index 100% rename from packages/babel-preset-env/test/debug-fixtures/entry-corejs2-versions-strings/in/in.js rename to packages/babel-preset-env/test/fixtures/debug/entry-corejs2-versions-strings/input.mjs diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-versions-strings/options.json b/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-versions-strings/options.json new file mode 100644 index 000000000000..7fcba34b836c --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-versions-strings/options.json @@ -0,0 +1,19 @@ +{ + "validateLogs": true, + "ignoreOutput": true, + "presets": [ + [ + "env", + { + "useBuiltIns": "entry", + "corejs": 2, + "debug": true, + "targets": { + "chrome": "54", + "node": "6.10", + "ie": "10" + } + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-versions-strings/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-versions-strings/stdout.txt new file mode 100644 index 000000000000..ceefa4e733e1 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-versions-strings/stdout.txt @@ -0,0 +1,177 @@ +@babel/preset-env: `DEBUG` option + +Using targets: +{ + "chrome": "54", + "ie": "10", + "node": "6.10" +} + +Using modules transform: auto + +Using plugins: + proposal-nullish-coalescing-operator { "chrome":"54", "ie":"10", "node":"6.10" } + proposal-optional-chaining { "chrome":"54", "ie":"10", "node":"6.10" } + proposal-json-strings { "chrome":"54", "ie":"10", "node":"6.10" } + proposal-optional-catch-binding { "chrome":"54", "ie":"10", "node":"6.10" } + transform-parameters { "ie":"10" } + proposal-async-generator-functions { "chrome":"54", "ie":"10", "node":"6.10" } + proposal-object-rest-spread { "chrome":"54", "ie":"10", "node":"6.10" } + transform-dotall-regex { "chrome":"54", "ie":"10", "node":"6.10" } + proposal-unicode-property-regex { "chrome":"54", "ie":"10", "node":"6.10" } + transform-named-capturing-groups-regex { "chrome":"54", "ie":"10", "node":"6.10" } + transform-async-to-generator { "chrome":"54", "ie":"10", "node":"6.10" } + transform-exponentiation-operator { "ie":"10", "node":"6.10" } + transform-template-literals { "ie":"10" } + transform-literals { "ie":"10" } + transform-function-name { "ie":"10" } + transform-arrow-functions { "ie":"10" } + transform-block-scoped-functions { "ie":"10" } + transform-classes { "ie":"10" } + transform-object-super { "ie":"10" } + transform-shorthand-properties { "ie":"10" } + transform-duplicate-keys { "ie":"10" } + transform-computed-properties { "ie":"10" } + transform-for-of { "ie":"10" } + transform-sticky-regex { "ie":"10" } + transform-unicode-regex { "ie":"10" } + transform-spread { "ie":"10" } + transform-destructuring { "ie":"10" } + transform-block-scoping { "ie":"10" } + transform-typeof-symbol { "ie":"10" } + transform-new-target { "ie":"10" } + transform-regenerator { "ie":"10" } + transform-modules-commonjs { "chrome":"54", "ie":"10", "node":"6.10" } + proposal-dynamic-import { "chrome":"54", "ie":"10", "node":"6.10" } + +Using polyfills with `entry` option: + +[/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-versions-strings/input.mjs] Replaced @babel/polyfill entries with the following polyfills: + es6.array.copy-within { "ie":"10" } + es6.array.fill { "ie":"10" } + es6.array.find { "ie":"10" } + es6.array.find-index { "ie":"10" } + es7.array.flat-map { "chrome":"54", "ie":"10", "node":"6.10" } + es6.array.from { "ie":"10" } + es7.array.includes { "ie":"10" } + es6.array.iterator { "ie":"10" } + es6.array.of { "ie":"10" } + es6.array.sort { "chrome":"54", "node":"6.10" } + es6.array.species { "ie":"10" } + es6.date.to-primitive { "ie":"10" } + es6.function.has-instance { "ie":"10" } + es6.function.name { "ie":"10" } + es6.map { "ie":"10" } + es6.math.acosh { "ie":"10" } + es6.math.asinh { "ie":"10" } + es6.math.atanh { "ie":"10" } + es6.math.cbrt { "ie":"10" } + es6.math.clz32 { "ie":"10" } + es6.math.cosh { "ie":"10" } + es6.math.expm1 { "ie":"10" } + es6.math.fround { "ie":"10" } + es6.math.hypot { "ie":"10" } + es6.math.imul { "ie":"10" } + es6.math.log1p { "ie":"10" } + es6.math.log10 { "ie":"10" } + es6.math.log2 { "ie":"10" } + es6.math.sign { "ie":"10" } + es6.math.sinh { "ie":"10" } + es6.math.tanh { "ie":"10" } + es6.math.trunc { "ie":"10" } + es6.number.constructor { "ie":"10" } + es6.number.epsilon { "ie":"10" } + es6.number.is-finite { "ie":"10" } + es6.number.is-integer { "ie":"10" } + es6.number.is-nan { "ie":"10" } + es6.number.is-safe-integer { "ie":"10" } + es6.number.max-safe-integer { "ie":"10" } + es6.number.min-safe-integer { "ie":"10" } + es6.number.parse-float { "ie":"10" } + es6.number.parse-int { "ie":"10" } + es6.object.assign { "ie":"10" } + es7.object.define-getter { "chrome":"54", "ie":"10", "node":"6.10" } + es7.object.define-setter { "chrome":"54", "ie":"10", "node":"6.10" } + es7.object.entries { "ie":"10", "node":"6.10" } + es6.object.freeze { "ie":"10" } + es6.object.get-own-property-descriptor { "ie":"10" } + es7.object.get-own-property-descriptors { "ie":"10", "node":"6.10" } + es6.object.get-own-property-names { "ie":"10" } + es6.object.get-prototype-of { "ie":"10" } + es7.object.lookup-getter { "chrome":"54", "ie":"10", "node":"6.10" } + es7.object.lookup-setter { "chrome":"54", "ie":"10", "node":"6.10" } + es6.object.prevent-extensions { "ie":"10" } + es6.object.to-string { "chrome":"54", "ie":"10", "node":"6.10" } + es6.object.is { "ie":"10" } + es6.object.is-frozen { "ie":"10" } + es6.object.is-sealed { "ie":"10" } + es6.object.is-extensible { "ie":"10" } + es6.object.keys { "ie":"10" } + es6.object.seal { "ie":"10" } + es6.object.set-prototype-of { "ie":"10" } + es7.object.values { "ie":"10", "node":"6.10" } + es6.promise { "ie":"10" } + es7.promise.finally { "chrome":"54", "ie":"10", "node":"6.10" } + es6.reflect.apply { "ie":"10" } + es6.reflect.construct { "ie":"10" } + es6.reflect.define-property { "ie":"10" } + es6.reflect.delete-property { "ie":"10" } + es6.reflect.get { "ie":"10" } + es6.reflect.get-own-property-descriptor { "ie":"10" } + es6.reflect.get-prototype-of { "ie":"10" } + es6.reflect.has { "ie":"10" } + es6.reflect.is-extensible { "ie":"10" } + es6.reflect.own-keys { "ie":"10" } + es6.reflect.prevent-extensions { "ie":"10" } + es6.reflect.set { "ie":"10" } + es6.reflect.set-prototype-of { "ie":"10" } + es6.regexp.constructor { "ie":"10" } + es6.regexp.flags { "ie":"10" } + es6.regexp.match { "ie":"10" } + es6.regexp.replace { "ie":"10" } + es6.regexp.split { "ie":"10" } + es6.regexp.search { "ie":"10" } + es6.regexp.to-string { "ie":"10" } + es6.set { "ie":"10" } + es6.symbol { "ie":"10" } + es7.symbol.async-iterator { "chrome":"54", "ie":"10", "node":"6.10" } + es6.string.anchor { "ie":"10" } + es6.string.big { "ie":"10" } + es6.string.blink { "ie":"10" } + es6.string.bold { "ie":"10" } + es6.string.code-point-at { "ie":"10" } + es6.string.ends-with { "ie":"10" } + es6.string.fixed { "ie":"10" } + es6.string.fontcolor { "ie":"10" } + es6.string.fontsize { "ie":"10" } + es6.string.from-code-point { "ie":"10" } + es6.string.includes { "ie":"10" } + es6.string.italics { "ie":"10" } + es6.string.iterator { "ie":"10" } + es6.string.link { "ie":"10" } + es7.string.pad-start { "chrome":"54", "ie":"10", "node":"6.10" } + es7.string.pad-end { "chrome":"54", "ie":"10", "node":"6.10" } + es6.string.raw { "ie":"10" } + es6.string.repeat { "ie":"10" } + es6.string.small { "ie":"10" } + es6.string.starts-with { "ie":"10" } + es6.string.strike { "ie":"10" } + es6.string.sub { "ie":"10" } + es6.string.sup { "ie":"10" } + es7.string.trim-left { "chrome":"54", "ie":"10", "node":"6.10" } + es7.string.trim-right { "chrome":"54", "ie":"10", "node":"6.10" } + es6.typed.array-buffer { "ie":"10" } + es6.typed.int8-array { "ie":"10" } + es6.typed.uint8-array { "ie":"10" } + es6.typed.uint8-clamped-array { "ie":"10" } + es6.typed.int16-array { "ie":"10" } + es6.typed.uint16-array { "ie":"10" } + es6.typed.int32-array { "ie":"10" } + es6.typed.uint32-array { "ie":"10" } + es6.typed.float32-array { "ie":"10" } + es6.typed.float64-array { "ie":"10" } + es6.weak-map { "ie":"10" } + es6.weak-set { "ie":"10" } + web.timers { "chrome":"54", "ie":"10", "node":"6.10" } + web.immediate { "chrome":"54", "ie":"10", "node":"6.10" } + web.dom.iterable { "chrome":"54", "ie":"10", "node":"6.10" } diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs2/in/in.js b/packages/babel-preset-env/test/fixtures/debug/entry-corejs2/input.mjs similarity index 100% rename from packages/babel-preset-env/test/debug-fixtures/entry-corejs2/in/in.js rename to packages/babel-preset-env/test/fixtures/debug/entry-corejs2/input.mjs diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs2/options.json b/packages/babel-preset-env/test/fixtures/debug/entry-corejs2/options.json new file mode 100644 index 000000000000..e8cc67c9ac8e --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs2/options.json @@ -0,0 +1,18 @@ +{ + "validateLogs": true, + "ignoreOutput": true, + "presets": [ + [ + "env", + { + "debug": true, + "targets": { + "browsers": "chrome >= 54, ie 10", + "node": 6 + }, + "useBuiltIns": "entry", + "corejs": 2 + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs2/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/entry-corejs2/stdout.txt new file mode 100644 index 000000000000..5244ee91b413 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs2/stdout.txt @@ -0,0 +1,177 @@ +@babel/preset-env: `DEBUG` option + +Using targets: +{ + "chrome": "54", + "ie": "10", + "node": "6" +} + +Using modules transform: auto + +Using plugins: + proposal-nullish-coalescing-operator { "chrome":"54", "ie":"10", "node":"6" } + proposal-optional-chaining { "chrome":"54", "ie":"10", "node":"6" } + proposal-json-strings { "chrome":"54", "ie":"10", "node":"6" } + proposal-optional-catch-binding { "chrome":"54", "ie":"10", "node":"6" } + transform-parameters { "ie":"10" } + proposal-async-generator-functions { "chrome":"54", "ie":"10", "node":"6" } + proposal-object-rest-spread { "chrome":"54", "ie":"10", "node":"6" } + transform-dotall-regex { "chrome":"54", "ie":"10", "node":"6" } + proposal-unicode-property-regex { "chrome":"54", "ie":"10", "node":"6" } + transform-named-capturing-groups-regex { "chrome":"54", "ie":"10", "node":"6" } + transform-async-to-generator { "chrome":"54", "ie":"10", "node":"6" } + transform-exponentiation-operator { "ie":"10", "node":"6" } + transform-template-literals { "ie":"10" } + transform-literals { "ie":"10" } + transform-function-name { "ie":"10", "node":"6" } + transform-arrow-functions { "ie":"10" } + transform-block-scoped-functions { "ie":"10" } + transform-classes { "ie":"10" } + transform-object-super { "ie":"10" } + transform-shorthand-properties { "ie":"10" } + transform-duplicate-keys { "ie":"10" } + transform-computed-properties { "ie":"10" } + transform-for-of { "ie":"10", "node":"6" } + transform-sticky-regex { "ie":"10" } + transform-unicode-regex { "ie":"10" } + transform-spread { "ie":"10" } + transform-destructuring { "ie":"10", "node":"6" } + transform-block-scoping { "ie":"10" } + transform-typeof-symbol { "ie":"10" } + transform-new-target { "ie":"10" } + transform-regenerator { "ie":"10" } + transform-modules-commonjs { "chrome":"54", "ie":"10", "node":"6" } + proposal-dynamic-import { "chrome":"54", "ie":"10", "node":"6" } + +Using polyfills with `entry` option: + +[/packages/babel-preset-env/test/fixtures/debug/entry-corejs2/input.mjs] Replaced @babel/polyfill entries with the following polyfills: + es6.array.copy-within { "ie":"10" } + es6.array.fill { "ie":"10" } + es6.array.find { "ie":"10" } + es6.array.find-index { "ie":"10" } + es7.array.flat-map { "chrome":"54", "ie":"10", "node":"6" } + es6.array.from { "ie":"10", "node":"6" } + es7.array.includes { "ie":"10" } + es6.array.iterator { "ie":"10" } + es6.array.of { "ie":"10" } + es6.array.sort { "chrome":"54", "node":"6" } + es6.array.species { "ie":"10", "node":"6" } + es6.date.to-primitive { "ie":"10" } + es6.function.has-instance { "ie":"10", "node":"6" } + es6.function.name { "ie":"10" } + es6.map { "ie":"10", "node":"6" } + es6.math.acosh { "ie":"10" } + es6.math.asinh { "ie":"10" } + es6.math.atanh { "ie":"10" } + es6.math.cbrt { "ie":"10" } + es6.math.clz32 { "ie":"10" } + es6.math.cosh { "ie":"10" } + es6.math.expm1 { "ie":"10" } + es6.math.fround { "ie":"10" } + es6.math.hypot { "ie":"10" } + es6.math.imul { "ie":"10" } + es6.math.log1p { "ie":"10" } + es6.math.log10 { "ie":"10" } + es6.math.log2 { "ie":"10" } + es6.math.sign { "ie":"10" } + es6.math.sinh { "ie":"10" } + es6.math.tanh { "ie":"10" } + es6.math.trunc { "ie":"10" } + es6.number.constructor { "ie":"10" } + es6.number.epsilon { "ie":"10" } + es6.number.is-finite { "ie":"10" } + es6.number.is-integer { "ie":"10" } + es6.number.is-nan { "ie":"10" } + es6.number.is-safe-integer { "ie":"10" } + es6.number.max-safe-integer { "ie":"10" } + es6.number.min-safe-integer { "ie":"10" } + es6.number.parse-float { "ie":"10" } + es6.number.parse-int { "ie":"10" } + es6.object.assign { "ie":"10" } + es7.object.define-getter { "chrome":"54", "ie":"10", "node":"6" } + es7.object.define-setter { "chrome":"54", "ie":"10", "node":"6" } + es7.object.entries { "ie":"10", "node":"6" } + es6.object.freeze { "ie":"10" } + es6.object.get-own-property-descriptor { "ie":"10" } + es7.object.get-own-property-descriptors { "ie":"10", "node":"6" } + es6.object.get-own-property-names { "ie":"10" } + es6.object.get-prototype-of { "ie":"10" } + es7.object.lookup-getter { "chrome":"54", "ie":"10", "node":"6" } + es7.object.lookup-setter { "chrome":"54", "ie":"10", "node":"6" } + es6.object.prevent-extensions { "ie":"10" } + es6.object.to-string { "chrome":"54", "ie":"10", "node":"6" } + es6.object.is { "ie":"10" } + es6.object.is-frozen { "ie":"10" } + es6.object.is-sealed { "ie":"10" } + es6.object.is-extensible { "ie":"10" } + es6.object.keys { "ie":"10" } + es6.object.seal { "ie":"10" } + es6.object.set-prototype-of { "ie":"10" } + es7.object.values { "ie":"10", "node":"6" } + es6.promise { "ie":"10", "node":"6" } + es7.promise.finally { "chrome":"54", "ie":"10", "node":"6" } + es6.reflect.apply { "ie":"10" } + es6.reflect.construct { "ie":"10" } + es6.reflect.define-property { "ie":"10" } + es6.reflect.delete-property { "ie":"10" } + es6.reflect.get { "ie":"10" } + es6.reflect.get-own-property-descriptor { "ie":"10" } + es6.reflect.get-prototype-of { "ie":"10" } + es6.reflect.has { "ie":"10" } + es6.reflect.is-extensible { "ie":"10" } + es6.reflect.own-keys { "ie":"10" } + es6.reflect.prevent-extensions { "ie":"10" } + es6.reflect.set { "ie":"10" } + es6.reflect.set-prototype-of { "ie":"10" } + es6.regexp.constructor { "ie":"10" } + es6.regexp.flags { "ie":"10" } + es6.regexp.match { "ie":"10" } + es6.regexp.replace { "ie":"10" } + es6.regexp.split { "ie":"10" } + es6.regexp.search { "ie":"10" } + es6.regexp.to-string { "ie":"10" } + es6.set { "ie":"10", "node":"6" } + es6.symbol { "ie":"10", "node":"6" } + es7.symbol.async-iterator { "chrome":"54", "ie":"10", "node":"6" } + es6.string.anchor { "ie":"10" } + es6.string.big { "ie":"10" } + es6.string.blink { "ie":"10" } + es6.string.bold { "ie":"10" } + es6.string.code-point-at { "ie":"10" } + es6.string.ends-with { "ie":"10" } + es6.string.fixed { "ie":"10" } + es6.string.fontcolor { "ie":"10" } + es6.string.fontsize { "ie":"10" } + es6.string.from-code-point { "ie":"10" } + es6.string.includes { "ie":"10" } + es6.string.italics { "ie":"10" } + es6.string.iterator { "ie":"10" } + es6.string.link { "ie":"10" } + es7.string.pad-start { "chrome":"54", "ie":"10", "node":"6" } + es7.string.pad-end { "chrome":"54", "ie":"10", "node":"6" } + es6.string.raw { "ie":"10" } + es6.string.repeat { "ie":"10" } + es6.string.small { "ie":"10" } + es6.string.starts-with { "ie":"10" } + es6.string.strike { "ie":"10" } + es6.string.sub { "ie":"10" } + es6.string.sup { "ie":"10" } + es7.string.trim-left { "chrome":"54", "ie":"10", "node":"6" } + es7.string.trim-right { "chrome":"54", "ie":"10", "node":"6" } + es6.typed.array-buffer { "ie":"10", "node":"6" } + es6.typed.int8-array { "ie":"10", "node":"6" } + es6.typed.uint8-array { "ie":"10", "node":"6" } + es6.typed.uint8-clamped-array { "ie":"10", "node":"6" } + es6.typed.int16-array { "ie":"10", "node":"6" } + es6.typed.uint16-array { "ie":"10", "node":"6" } + es6.typed.int32-array { "ie":"10", "node":"6" } + es6.typed.uint32-array { "ie":"10", "node":"6" } + es6.typed.float32-array { "ie":"10", "node":"6" } + es6.typed.float64-array { "ie":"10", "node":"6" } + es6.weak-map { "ie":"10", "node":"6" } + es6.weak-set { "ie":"10", "node":"6" } + web.timers { "chrome":"54", "ie":"10", "node":"6" } + web.immediate { "chrome":"54", "ie":"10", "node":"6" } + web.dom.iterable { "chrome":"54", "ie":"10", "node":"6" } diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-all-chrome-71/in/in.js b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-all-chrome-71/input.mjs similarity index 100% rename from packages/babel-preset-env/test/debug-fixtures/entry-corejs3-all-chrome-71/in/in.js rename to packages/babel-preset-env/test/fixtures/debug/entry-corejs3-all-chrome-71/input.mjs diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-all-chrome-71/options.json b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-all-chrome-71/options.json new file mode 100644 index 000000000000..6e8f4a357b28 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-all-chrome-71/options.json @@ -0,0 +1,18 @@ +{ + "validateLogs": true, + "ignoreOutput": true, + "presets": [ + [ + "env", + { + "debug": true, + "targets": { + "browsers": "chrome 71" + }, + "shippedProposals": true, + "useBuiltIns": "entry", + "corejs": 3 + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-all-chrome-71/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-all-chrome-71/stdout.txt new file mode 100644 index 000000000000..280158e72cca --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-all-chrome-71/stdout.txt @@ -0,0 +1,111 @@ +@babel/preset-env: `DEBUG` option + +Using targets: +{ + "chrome": "71" +} + +Using modules transform: auto + +Using plugins: + proposal-numeric-separator { "chrome":"71" } + proposal-nullish-coalescing-operator { "chrome":"71" } + proposal-optional-chaining { "chrome":"71" } + syntax-json-strings { "chrome":"71" } + syntax-optional-catch-binding { "chrome":"71" } + syntax-async-generators { "chrome":"71" } + syntax-object-rest-spread { "chrome":"71" } + transform-modules-commonjs { "chrome":"71" } + proposal-dynamic-import { "chrome":"71" } + +Using polyfills with `entry` option: + +[/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-all-chrome-71/input.mjs] Replaced core-js entries with the following polyfills: + es.array.unscopables.flat { "chrome":"71" } + es.array.unscopables.flat-map { "chrome":"71" } + es.math.hypot { "chrome":"71" } + es.object.from-entries { "chrome":"71" } + esnext.aggregate-error { "chrome":"71" } + esnext.array.last-index { "chrome":"71" } + esnext.array.last-item { "chrome":"71" } + esnext.composite-key { "chrome":"71" } + esnext.composite-symbol { "chrome":"71" } + esnext.map.delete-all { "chrome":"71" } + esnext.map.every { "chrome":"71" } + esnext.map.filter { "chrome":"71" } + esnext.map.find { "chrome":"71" } + esnext.map.find-key { "chrome":"71" } + esnext.map.from { "chrome":"71" } + esnext.map.group-by { "chrome":"71" } + esnext.map.includes { "chrome":"71" } + esnext.map.key-by { "chrome":"71" } + esnext.map.key-of { "chrome":"71" } + esnext.map.map-keys { "chrome":"71" } + esnext.map.map-values { "chrome":"71" } + esnext.map.merge { "chrome":"71" } + esnext.map.of { "chrome":"71" } + esnext.map.reduce { "chrome":"71" } + esnext.map.some { "chrome":"71" } + esnext.map.update { "chrome":"71" } + esnext.math.clamp { "chrome":"71" } + esnext.math.deg-per-rad { "chrome":"71" } + esnext.math.degrees { "chrome":"71" } + esnext.math.fscale { "chrome":"71" } + esnext.math.iaddh { "chrome":"71" } + esnext.math.imulh { "chrome":"71" } + esnext.math.isubh { "chrome":"71" } + esnext.math.rad-per-deg { "chrome":"71" } + esnext.math.radians { "chrome":"71" } + esnext.math.scale { "chrome":"71" } + esnext.math.seeded-prng { "chrome":"71" } + esnext.math.signbit { "chrome":"71" } + esnext.math.umulh { "chrome":"71" } + esnext.number.from-string { "chrome":"71" } + esnext.observable { "chrome":"71" } + esnext.promise.all-settled { "chrome":"71" } + esnext.promise.any { "chrome":"71" } + esnext.promise.try { "chrome":"71" } + esnext.reflect.define-metadata { "chrome":"71" } + esnext.reflect.delete-metadata { "chrome":"71" } + esnext.reflect.get-metadata { "chrome":"71" } + esnext.reflect.get-metadata-keys { "chrome":"71" } + esnext.reflect.get-own-metadata { "chrome":"71" } + esnext.reflect.get-own-metadata-keys { "chrome":"71" } + esnext.reflect.has-metadata { "chrome":"71" } + esnext.reflect.has-own-metadata { "chrome":"71" } + esnext.reflect.metadata { "chrome":"71" } + esnext.set.add-all { "chrome":"71" } + esnext.set.delete-all { "chrome":"71" } + esnext.set.difference { "chrome":"71" } + esnext.set.every { "chrome":"71" } + esnext.set.filter { "chrome":"71" } + esnext.set.find { "chrome":"71" } + esnext.set.from { "chrome":"71" } + esnext.set.intersection { "chrome":"71" } + esnext.set.is-disjoint-from { "chrome":"71" } + esnext.set.is-subset-of { "chrome":"71" } + esnext.set.is-superset-of { "chrome":"71" } + esnext.set.join { "chrome":"71" } + esnext.set.map { "chrome":"71" } + esnext.set.of { "chrome":"71" } + esnext.set.reduce { "chrome":"71" } + esnext.set.some { "chrome":"71" } + esnext.set.symmetric-difference { "chrome":"71" } + esnext.set.union { "chrome":"71" } + esnext.string.at { "chrome":"71" } + esnext.string.code-points { "chrome":"71" } + esnext.string.match-all { "chrome":"71" } + esnext.string.replace-all { "chrome":"71" } + esnext.symbol.dispose { "chrome":"71" } + esnext.symbol.observable { "chrome":"71" } + esnext.symbol.pattern-match { "chrome":"71" } + esnext.weak-map.delete-all { "chrome":"71" } + esnext.weak-map.from { "chrome":"71" } + esnext.weak-map.of { "chrome":"71" } + esnext.weak-set.add-all { "chrome":"71" } + esnext.weak-set.delete-all { "chrome":"71" } + esnext.weak-set.from { "chrome":"71" } + esnext.weak-set.of { "chrome":"71" } + web.immediate { "chrome":"71" } + +[/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-all-chrome-71/input.mjs] Based on your targets, regenerator-runtime import excluded. diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-all/in/in.js b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-all/input.mjs similarity index 100% rename from packages/babel-preset-env/test/debug-fixtures/entry-corejs3-all/in/in.js rename to packages/babel-preset-env/test/fixtures/debug/entry-corejs3-all/input.mjs diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-all/options.json b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-all/options.json new file mode 100644 index 000000000000..edf42df8057e --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-all/options.json @@ -0,0 +1,15 @@ +{ + "validateLogs": true, + "ignoreOutput": true, + "presets": [ + [ + "env", + { + "debug": true, + "shippedProposals": true, + "useBuiltIns": "entry", + "corejs": 3 + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-all/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-all/stdout.txt new file mode 100644 index 000000000000..363c0bd3c67c --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-all/stdout.txt @@ -0,0 +1,339 @@ +@babel/preset-env: `DEBUG` option + +Using targets: +{} + +Using modules transform: auto + +Using plugins: + proposal-numeric-separator {} + proposal-nullish-coalescing-operator {} + proposal-optional-chaining {} + proposal-json-strings {} + proposal-optional-catch-binding {} + transform-parameters {} + proposal-async-generator-functions {} + proposal-object-rest-spread {} + transform-dotall-regex {} + proposal-unicode-property-regex {} + transform-named-capturing-groups-regex {} + transform-async-to-generator {} + transform-exponentiation-operator {} + transform-template-literals {} + transform-literals {} + transform-function-name {} + transform-arrow-functions {} + transform-block-scoped-functions {} + transform-classes {} + transform-object-super {} + transform-shorthand-properties {} + transform-duplicate-keys {} + transform-computed-properties {} + transform-for-of {} + transform-sticky-regex {} + transform-unicode-regex {} + transform-spread {} + transform-destructuring {} + transform-block-scoping {} + transform-typeof-symbol {} + transform-new-target {} + transform-regenerator {} + transform-member-expression-literals {} + transform-property-literals {} + transform-reserved-words {} + transform-modules-commonjs {} + proposal-dynamic-import {} + +Using polyfills with `entry` option: + +[/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-all/input.mjs] Replaced core-js entries with the following polyfills: + es.symbol {} + es.symbol.description {} + es.symbol.async-iterator {} + es.symbol.has-instance {} + es.symbol.is-concat-spreadable {} + es.symbol.iterator {} + es.symbol.match {} + es.symbol.replace {} + es.symbol.search {} + es.symbol.species {} + es.symbol.split {} + es.symbol.to-primitive {} + es.symbol.to-string-tag {} + es.symbol.unscopables {} + es.array.concat {} + es.array.copy-within {} + es.array.every {} + es.array.fill {} + es.array.filter {} + es.array.find {} + es.array.find-index {} + es.array.flat {} + es.array.flat-map {} + es.array.for-each {} + es.array.from {} + es.array.includes {} + es.array.index-of {} + es.array.is-array {} + es.array.iterator {} + es.array.join {} + es.array.last-index-of {} + es.array.map {} + es.array.of {} + es.array.reduce {} + es.array.reduce-right {} + es.array.reverse {} + es.array.slice {} + es.array.some {} + es.array.sort {} + es.array.species {} + es.array.splice {} + es.array.unscopables.flat {} + es.array.unscopables.flat-map {} + es.array-buffer.constructor {} + es.array-buffer.is-view {} + es.array-buffer.slice {} + es.data-view {} + es.date.now {} + es.date.to-iso-string {} + es.date.to-json {} + es.date.to-primitive {} + es.date.to-string {} + es.function.bind {} + es.function.has-instance {} + es.function.name {} + es.json.to-string-tag {} + es.map {} + es.math.acosh {} + es.math.asinh {} + es.math.atanh {} + es.math.cbrt {} + es.math.clz32 {} + es.math.cosh {} + es.math.expm1 {} + es.math.fround {} + es.math.hypot {} + es.math.imul {} + es.math.log10 {} + es.math.log1p {} + es.math.log2 {} + es.math.sign {} + es.math.sinh {} + es.math.tanh {} + es.math.to-string-tag {} + es.math.trunc {} + es.number.constructor {} + es.number.epsilon {} + es.number.is-finite {} + es.number.is-integer {} + es.number.is-nan {} + es.number.is-safe-integer {} + es.number.max-safe-integer {} + es.number.min-safe-integer {} + es.number.parse-float {} + es.number.parse-int {} + es.number.to-fixed {} + es.number.to-precision {} + es.object.assign {} + es.object.create {} + es.object.define-getter {} + es.object.define-properties {} + es.object.define-property {} + es.object.define-setter {} + es.object.entries {} + es.object.freeze {} + es.object.from-entries {} + es.object.get-own-property-descriptor {} + es.object.get-own-property-descriptors {} + es.object.get-own-property-names {} + es.object.get-prototype-of {} + es.object.is {} + es.object.is-extensible {} + es.object.is-frozen {} + es.object.is-sealed {} + es.object.keys {} + es.object.lookup-getter {} + es.object.lookup-setter {} + es.object.prevent-extensions {} + es.object.seal {} + es.object.set-prototype-of {} + es.object.to-string {} + es.object.values {} + es.parse-float {} + es.parse-int {} + es.promise {} + es.promise.finally {} + es.reflect.apply {} + es.reflect.construct {} + es.reflect.define-property {} + es.reflect.delete-property {} + es.reflect.get {} + es.reflect.get-own-property-descriptor {} + es.reflect.get-prototype-of {} + es.reflect.has {} + es.reflect.is-extensible {} + es.reflect.own-keys {} + es.reflect.prevent-extensions {} + es.reflect.set {} + es.reflect.set-prototype-of {} + es.regexp.constructor {} + es.regexp.exec {} + es.regexp.flags {} + es.regexp.to-string {} + es.set {} + es.string.code-point-at {} + es.string.ends-with {} + es.string.from-code-point {} + es.string.includes {} + es.string.iterator {} + es.string.match {} + es.string.pad-end {} + es.string.pad-start {} + es.string.raw {} + es.string.repeat {} + es.string.replace {} + es.string.search {} + es.string.split {} + es.string.starts-with {} + es.string.trim {} + es.string.trim-end {} + es.string.trim-start {} + es.string.anchor {} + es.string.big {} + es.string.blink {} + es.string.bold {} + es.string.fixed {} + es.string.fontcolor {} + es.string.fontsize {} + es.string.italics {} + es.string.link {} + es.string.small {} + es.string.strike {} + es.string.sub {} + es.string.sup {} + es.typed-array.float32-array {} + es.typed-array.float64-array {} + es.typed-array.int8-array {} + es.typed-array.int16-array {} + es.typed-array.int32-array {} + es.typed-array.uint8-array {} + es.typed-array.uint8-clamped-array {} + es.typed-array.uint16-array {} + es.typed-array.uint32-array {} + es.typed-array.copy-within {} + es.typed-array.every {} + es.typed-array.fill {} + es.typed-array.filter {} + es.typed-array.find {} + es.typed-array.find-index {} + es.typed-array.for-each {} + es.typed-array.from {} + es.typed-array.includes {} + es.typed-array.index-of {} + es.typed-array.iterator {} + es.typed-array.join {} + es.typed-array.last-index-of {} + es.typed-array.map {} + es.typed-array.of {} + es.typed-array.reduce {} + es.typed-array.reduce-right {} + es.typed-array.reverse {} + es.typed-array.set {} + es.typed-array.slice {} + es.typed-array.some {} + es.typed-array.sort {} + es.typed-array.subarray {} + es.typed-array.to-locale-string {} + es.typed-array.to-string {} + es.weak-map {} + es.weak-set {} + esnext.aggregate-error {} + esnext.array.last-index {} + esnext.array.last-item {} + esnext.composite-key {} + esnext.composite-symbol {} + esnext.global-this {} + esnext.map.delete-all {} + esnext.map.every {} + esnext.map.filter {} + esnext.map.find {} + esnext.map.find-key {} + esnext.map.from {} + esnext.map.group-by {} + esnext.map.includes {} + esnext.map.key-by {} + esnext.map.key-of {} + esnext.map.map-keys {} + esnext.map.map-values {} + esnext.map.merge {} + esnext.map.of {} + esnext.map.reduce {} + esnext.map.some {} + esnext.map.update {} + esnext.math.clamp {} + esnext.math.deg-per-rad {} + esnext.math.degrees {} + esnext.math.fscale {} + esnext.math.iaddh {} + esnext.math.imulh {} + esnext.math.isubh {} + esnext.math.rad-per-deg {} + esnext.math.radians {} + esnext.math.scale {} + esnext.math.seeded-prng {} + esnext.math.signbit {} + esnext.math.umulh {} + esnext.number.from-string {} + esnext.observable {} + esnext.promise.all-settled {} + esnext.promise.any {} + esnext.promise.try {} + esnext.reflect.define-metadata {} + esnext.reflect.delete-metadata {} + esnext.reflect.get-metadata {} + esnext.reflect.get-metadata-keys {} + esnext.reflect.get-own-metadata {} + esnext.reflect.get-own-metadata-keys {} + esnext.reflect.has-metadata {} + esnext.reflect.has-own-metadata {} + esnext.reflect.metadata {} + esnext.set.add-all {} + esnext.set.delete-all {} + esnext.set.difference {} + esnext.set.every {} + esnext.set.filter {} + esnext.set.find {} + esnext.set.from {} + esnext.set.intersection {} + esnext.set.is-disjoint-from {} + esnext.set.is-subset-of {} + esnext.set.is-superset-of {} + esnext.set.join {} + esnext.set.map {} + esnext.set.of {} + esnext.set.reduce {} + esnext.set.some {} + esnext.set.symmetric-difference {} + esnext.set.union {} + esnext.string.at {} + esnext.string.code-points {} + esnext.string.match-all {} + esnext.string.replace-all {} + esnext.symbol.dispose {} + esnext.symbol.observable {} + esnext.symbol.pattern-match {} + esnext.weak-map.delete-all {} + esnext.weak-map.from {} + esnext.weak-map.of {} + esnext.weak-set.add-all {} + esnext.weak-set.delete-all {} + esnext.weak-set.from {} + esnext.weak-set.of {} + web.dom-collections.for-each {} + web.dom-collections.iterator {} + web.immediate {} + web.queue-microtask {} + web.timers {} + web.url {} + web.url.to-json {} + web.url-search-params {} diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-android/in/in.js b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-android/input.mjs similarity index 100% rename from packages/babel-preset-env/test/debug-fixtures/entry-corejs3-android/in/in.js rename to packages/babel-preset-env/test/fixtures/debug/entry-corejs3-android/input.mjs diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-android/options.json b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-android/options.json new file mode 100644 index 000000000000..ca76bce5c006 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-android/options.json @@ -0,0 +1,17 @@ +{ + "validateLogs": true, + "ignoreOutput": true, + "presets": [ + [ + "env", + { + "debug": true, + "targets": { + "browsers": ["Android >= 4"] + }, + "useBuiltIns": "entry", + "corejs": 3 + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-android/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-android/stdout.txt new file mode 100644 index 000000000000..4ed2ea61df94 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-android/stdout.txt @@ -0,0 +1,233 @@ +@babel/preset-env: `DEBUG` option + +Using targets: +{ + "android": "4" +} + +Using modules transform: auto + +Using plugins: + proposal-nullish-coalescing-operator { "android":"4" } + proposal-optional-chaining { "android":"4" } + proposal-json-strings { "android":"4" } + proposal-optional-catch-binding { "android":"4" } + transform-parameters { "android":"4" } + proposal-async-generator-functions { "android":"4" } + proposal-object-rest-spread { "android":"4" } + transform-dotall-regex { "android":"4" } + proposal-unicode-property-regex { "android":"4" } + transform-named-capturing-groups-regex { "android":"4" } + transform-async-to-generator { "android":"4" } + transform-exponentiation-operator { "android":"4" } + transform-template-literals { "android":"4" } + transform-literals { "android":"4" } + transform-function-name { "android":"4" } + transform-arrow-functions { "android":"4" } + transform-block-scoped-functions { "android":"4" } + transform-classes { "android":"4" } + transform-object-super { "android":"4" } + transform-shorthand-properties { "android":"4" } + transform-duplicate-keys { "android":"4" } + transform-computed-properties { "android":"4" } + transform-for-of { "android":"4" } + transform-sticky-regex { "android":"4" } + transform-unicode-regex { "android":"4" } + transform-spread { "android":"4" } + transform-destructuring { "android":"4" } + transform-block-scoping { "android":"4" } + transform-typeof-symbol { "android":"4" } + transform-new-target { "android":"4" } + transform-regenerator { "android":"4" } + transform-reserved-words { "android":"4" } + transform-modules-commonjs { "android":"4" } + proposal-dynamic-import { "android":"4" } + +Using polyfills with `entry` option: + +[/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-android/input.mjs] Replaced core-js entries with the following polyfills: + es.symbol { "android":"4" } + es.symbol.description { "android":"4" } + es.symbol.async-iterator { "android":"4" } + es.symbol.has-instance { "android":"4" } + es.symbol.is-concat-spreadable { "android":"4" } + es.symbol.iterator { "android":"4" } + es.symbol.match { "android":"4" } + es.symbol.replace { "android":"4" } + es.symbol.search { "android":"4" } + es.symbol.species { "android":"4" } + es.symbol.split { "android":"4" } + es.symbol.to-primitive { "android":"4" } + es.symbol.to-string-tag { "android":"4" } + es.symbol.unscopables { "android":"4" } + es.array.concat { "android":"4" } + es.array.copy-within { "android":"4" } + es.array.every { "android":"4" } + es.array.fill { "android":"4" } + es.array.filter { "android":"4" } + es.array.find { "android":"4" } + es.array.find-index { "android":"4" } + es.array.flat { "android":"4" } + es.array.flat-map { "android":"4" } + es.array.for-each { "android":"4" } + es.array.from { "android":"4" } + es.array.includes { "android":"4" } + es.array.index-of { "android":"4" } + es.array.iterator { "android":"4" } + es.array.join { "android":"4" } + es.array.last-index-of { "android":"4" } + es.array.map { "android":"4" } + es.array.of { "android":"4" } + es.array.reduce { "android":"4" } + es.array.reduce-right { "android":"4" } + es.array.slice { "android":"4" } + es.array.some { "android":"4" } + es.array.sort { "android":"4" } + es.array.species { "android":"4" } + es.array.splice { "android":"4" } + es.array.unscopables.flat { "android":"4" } + es.array.unscopables.flat-map { "android":"4" } + es.array-buffer.constructor { "android":"4" } + es.array-buffer.is-view { "android":"4" } + es.array-buffer.slice { "android":"4" } + es.data-view { "android":"4" } + es.date.to-iso-string { "android":"4" } + es.date.to-json { "android":"4" } + es.date.to-primitive { "android":"4" } + es.function.has-instance { "android":"4" } + es.json.to-string-tag { "android":"4" } + es.map { "android":"4" } + es.math.acosh { "android":"4" } + es.math.asinh { "android":"4" } + es.math.atanh { "android":"4" } + es.math.cbrt { "android":"4" } + es.math.clz32 { "android":"4" } + es.math.cosh { "android":"4" } + es.math.expm1 { "android":"4" } + es.math.fround { "android":"4" } + es.math.hypot { "android":"4" } + es.math.imul { "android":"4" } + es.math.log10 { "android":"4" } + es.math.log1p { "android":"4" } + es.math.log2 { "android":"4" } + es.math.sign { "android":"4" } + es.math.sinh { "android":"4" } + es.math.tanh { "android":"4" } + es.math.to-string-tag { "android":"4" } + es.math.trunc { "android":"4" } + es.number.constructor { "android":"4" } + es.number.epsilon { "android":"4" } + es.number.is-finite { "android":"4" } + es.number.is-integer { "android":"4" } + es.number.is-nan { "android":"4" } + es.number.is-safe-integer { "android":"4" } + es.number.max-safe-integer { "android":"4" } + es.number.min-safe-integer { "android":"4" } + es.number.parse-float { "android":"4" } + es.number.parse-int { "android":"4" } + es.number.to-fixed { "android":"4" } + es.number.to-precision { "android":"4" } + es.object.assign { "android":"4" } + es.object.define-getter { "android":"4" } + es.object.define-setter { "android":"4" } + es.object.entries { "android":"4" } + es.object.freeze { "android":"4" } + es.object.from-entries { "android":"4" } + es.object.get-own-property-descriptor { "android":"4" } + es.object.get-own-property-descriptors { "android":"4" } + es.object.get-own-property-names { "android":"4" } + es.object.get-prototype-of { "android":"4" } + es.object.is { "android":"4" } + es.object.is-extensible { "android":"4" } + es.object.is-frozen { "android":"4" } + es.object.is-sealed { "android":"4" } + es.object.keys { "android":"4" } + es.object.lookup-getter { "android":"4" } + es.object.lookup-setter { "android":"4" } + es.object.prevent-extensions { "android":"4" } + es.object.seal { "android":"4" } + es.object.set-prototype-of { "android":"4" } + es.object.to-string { "android":"4" } + es.object.values { "android":"4" } + es.parse-float { "android":"4" } + es.parse-int { "android":"4" } + es.promise { "android":"4" } + es.promise.finally { "android":"4" } + es.reflect.apply { "android":"4" } + es.reflect.construct { "android":"4" } + es.reflect.define-property { "android":"4" } + es.reflect.delete-property { "android":"4" } + es.reflect.get { "android":"4" } + es.reflect.get-own-property-descriptor { "android":"4" } + es.reflect.get-prototype-of { "android":"4" } + es.reflect.has { "android":"4" } + es.reflect.is-extensible { "android":"4" } + es.reflect.own-keys { "android":"4" } + es.reflect.prevent-extensions { "android":"4" } + es.reflect.set { "android":"4" } + es.reflect.set-prototype-of { "android":"4" } + es.regexp.constructor { "android":"4" } + es.regexp.exec { "android":"4" } + es.regexp.flags { "android":"4" } + es.regexp.to-string { "android":"4" } + es.set { "android":"4" } + es.string.code-point-at { "android":"4" } + es.string.ends-with { "android":"4" } + es.string.from-code-point { "android":"4" } + es.string.includes { "android":"4" } + es.string.iterator { "android":"4" } + es.string.match { "android":"4" } + es.string.pad-end { "android":"4" } + es.string.pad-start { "android":"4" } + es.string.raw { "android":"4" } + es.string.repeat { "android":"4" } + es.string.replace { "android":"4" } + es.string.search { "android":"4" } + es.string.split { "android":"4" } + es.string.starts-with { "android":"4" } + es.string.trim { "android":"4" } + es.string.trim-end { "android":"4" } + es.string.trim-start { "android":"4" } + es.typed-array.float32-array { "android":"4" } + es.typed-array.float64-array { "android":"4" } + es.typed-array.int8-array { "android":"4" } + es.typed-array.int16-array { "android":"4" } + es.typed-array.int32-array { "android":"4" } + es.typed-array.uint8-array { "android":"4" } + es.typed-array.uint8-clamped-array { "android":"4" } + es.typed-array.uint16-array { "android":"4" } + es.typed-array.uint32-array { "android":"4" } + es.typed-array.copy-within { "android":"4" } + es.typed-array.every { "android":"4" } + es.typed-array.fill { "android":"4" } + es.typed-array.filter { "android":"4" } + es.typed-array.find { "android":"4" } + es.typed-array.find-index { "android":"4" } + es.typed-array.for-each { "android":"4" } + es.typed-array.from { "android":"4" } + es.typed-array.includes { "android":"4" } + es.typed-array.index-of { "android":"4" } + es.typed-array.iterator { "android":"4" } + es.typed-array.join { "android":"4" } + es.typed-array.last-index-of { "android":"4" } + es.typed-array.map { "android":"4" } + es.typed-array.of { "android":"4" } + es.typed-array.reduce { "android":"4" } + es.typed-array.reduce-right { "android":"4" } + es.typed-array.reverse { "android":"4" } + es.typed-array.set { "android":"4" } + es.typed-array.slice { "android":"4" } + es.typed-array.some { "android":"4" } + es.typed-array.sort { "android":"4" } + es.typed-array.subarray { "android":"4" } + es.typed-array.to-locale-string { "android":"4" } + es.typed-array.to-string { "android":"4" } + es.weak-map { "android":"4" } + es.weak-set { "android":"4" } + web.dom-collections.for-each { "android":"4" } + web.dom-collections.iterator { "android":"4" } + web.immediate { "android":"4" } + web.queue-microtask { "android":"4" } + web.url { "android":"4" } + web.url.to-json { "android":"4" } + web.url-search-params { "android":"4" } diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-babel-polyfill/in/in.js b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-babel-polyfill/input.mjs similarity index 100% rename from packages/babel-preset-env/test/debug-fixtures/entry-corejs3-babel-polyfill/in/in.js rename to packages/babel-preset-env/test/fixtures/debug/entry-corejs3-babel-polyfill/input.mjs diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-babel-polyfill/options.json b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-babel-polyfill/options.json new file mode 100644 index 000000000000..edf42df8057e --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-babel-polyfill/options.json @@ -0,0 +1,15 @@ +{ + "validateLogs": true, + "ignoreOutput": true, + "presets": [ + [ + "env", + { + "debug": true, + "shippedProposals": true, + "useBuiltIns": "entry", + "corejs": 3 + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-babel-polyfill/stderr.txt b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-babel-polyfill/stderr.txt new file mode 100644 index 000000000000..228f1a052848 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-babel-polyfill/stderr.txt @@ -0,0 +1,2 @@ +`@babel/polyfill` is deprecated. Please, use required parts of `core-js` + and `regenerator-runtime/runtime` separately \ No newline at end of file diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-babel-polyfill/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-babel-polyfill/stdout.txt new file mode 100644 index 000000000000..27066e050aff --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-babel-polyfill/stdout.txt @@ -0,0 +1,49 @@ +@babel/preset-env: `DEBUG` option + +Using targets: +{} + +Using modules transform: auto + +Using plugins: + proposal-numeric-separator {} + proposal-nullish-coalescing-operator {} + proposal-optional-chaining {} + proposal-json-strings {} + proposal-optional-catch-binding {} + transform-parameters {} + proposal-async-generator-functions {} + proposal-object-rest-spread {} + transform-dotall-regex {} + proposal-unicode-property-regex {} + transform-named-capturing-groups-regex {} + transform-async-to-generator {} + transform-exponentiation-operator {} + transform-template-literals {} + transform-literals {} + transform-function-name {} + transform-arrow-functions {} + transform-block-scoped-functions {} + transform-classes {} + transform-object-super {} + transform-shorthand-properties {} + transform-duplicate-keys {} + transform-computed-properties {} + transform-for-of {} + transform-sticky-regex {} + transform-unicode-regex {} + transform-spread {} + transform-destructuring {} + transform-block-scoping {} + transform-typeof-symbol {} + transform-new-target {} + transform-regenerator {} + transform-member-expression-literals {} + transform-property-literals {} + transform-reserved-words {} + transform-modules-commonjs {} + proposal-dynamic-import {} + +Using polyfills with `entry` option: + +[/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-babel-polyfill/input.mjs] Import of core-js was not found. diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-electron/in/in.js b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-electron/input.mjs similarity index 100% rename from packages/babel-preset-env/test/debug-fixtures/entry-corejs3-electron/in/in.js rename to packages/babel-preset-env/test/fixtures/debug/entry-corejs3-electron/input.mjs diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-electron/options.json b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-electron/options.json new file mode 100644 index 000000000000..294459fe21ec --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-electron/options.json @@ -0,0 +1,17 @@ +{ + "validateLogs": true, + "ignoreOutput": true, + "presets": [ + [ + "env", + { + "debug": true, + "targets": { + "electron": 0.36 + }, + "useBuiltIns": "entry", + "corejs": 3 + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-electron/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-electron/stdout.txt new file mode 100644 index 000000000000..579c0bbddc0c --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-electron/stdout.txt @@ -0,0 +1,143 @@ +Warning, the following targets are using a decimal version: + + electron: 0.36 + +We recommend using a string for minor/patch versions to avoid numbers like 6.10 +getting parsed as 6.1, which can lead to unexpected behavior. + +@babel/preset-env: `DEBUG` option + +Using targets: +{ + "electron": "0.36" +} + +Using modules transform: auto + +Using plugins: + proposal-nullish-coalescing-operator { "electron":"0.36" } + proposal-optional-chaining { "electron":"0.36" } + proposal-json-strings { "electron":"0.36" } + proposal-optional-catch-binding { "electron":"0.36" } + transform-parameters { "electron":"0.36" } + proposal-async-generator-functions { "electron":"0.36" } + proposal-object-rest-spread { "electron":"0.36" } + transform-dotall-regex { "electron":"0.36" } + proposal-unicode-property-regex { "electron":"0.36" } + transform-named-capturing-groups-regex { "electron":"0.36" } + transform-async-to-generator { "electron":"0.36" } + transform-exponentiation-operator { "electron":"0.36" } + transform-function-name { "electron":"0.36" } + transform-for-of { "electron":"0.36" } + transform-sticky-regex { "electron":"0.36" } + transform-unicode-regex { "electron":"0.36" } + transform-destructuring { "electron":"0.36" } + transform-block-scoping { "electron":"0.36" } + transform-regenerator { "electron":"0.36" } + transform-modules-commonjs { "electron":"0.36" } + proposal-dynamic-import { "electron":"0.36" } + +Using polyfills with `entry` option: + +[/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-electron/input.mjs] Replaced core-js entries with the following polyfills: + es.symbol { "electron":"0.36" } + es.symbol.description { "electron":"0.36" } + es.symbol.async-iterator { "electron":"0.36" } + es.symbol.has-instance { "electron":"0.36" } + es.symbol.is-concat-spreadable { "electron":"0.36" } + es.symbol.match { "electron":"0.36" } + es.symbol.replace { "electron":"0.36" } + es.symbol.search { "electron":"0.36" } + es.symbol.species { "electron":"0.36" } + es.symbol.split { "electron":"0.36" } + es.symbol.to-string-tag { "electron":"0.36" } + es.array.concat { "electron":"0.36" } + es.array.every { "electron":"0.36" } + es.array.filter { "electron":"0.36" } + es.array.flat { "electron":"0.36" } + es.array.flat-map { "electron":"0.36" } + es.array.for-each { "electron":"0.36" } + es.array.from { "electron":"0.36" } + es.array.includes { "electron":"0.36" } + es.array.index-of { "electron":"0.36" } + es.array.iterator { "electron":"0.36" } + es.array.last-index-of { "electron":"0.36" } + es.array.map { "electron":"0.36" } + es.array.reduce { "electron":"0.36" } + es.array.reduce-right { "electron":"0.36" } + es.array.slice { "electron":"0.36" } + es.array.some { "electron":"0.36" } + es.array.sort { "electron":"0.36" } + es.array.species { "electron":"0.36" } + es.array.splice { "electron":"0.36" } + es.array.unscopables.flat { "electron":"0.36" } + es.array.unscopables.flat-map { "electron":"0.36" } + es.function.has-instance { "electron":"0.36" } + es.json.to-string-tag { "electron":"0.36" } + es.map { "electron":"0.36" } + es.math.acosh { "electron":"0.36" } + es.math.hypot { "electron":"0.36" } + es.math.to-string-tag { "electron":"0.36" } + es.object.assign { "electron":"0.36" } + es.object.define-getter { "electron":"0.36" } + es.object.define-setter { "electron":"0.36" } + es.object.entries { "electron":"0.36" } + es.object.from-entries { "electron":"0.36" } + es.object.get-own-property-descriptors { "electron":"0.36" } + es.object.lookup-getter { "electron":"0.36" } + es.object.lookup-setter { "electron":"0.36" } + es.object.to-string { "electron":"0.36" } + es.object.values { "electron":"0.36" } + es.promise { "electron":"0.36" } + es.promise.finally { "electron":"0.36" } + es.reflect.apply { "electron":"0.36" } + es.reflect.construct { "electron":"0.36" } + es.reflect.define-property { "electron":"0.36" } + es.reflect.delete-property { "electron":"0.36" } + es.reflect.get { "electron":"0.36" } + es.reflect.get-own-property-descriptor { "electron":"0.36" } + es.reflect.get-prototype-of { "electron":"0.36" } + es.reflect.has { "electron":"0.36" } + es.reflect.is-extensible { "electron":"0.36" } + es.reflect.own-keys { "electron":"0.36" } + es.reflect.prevent-extensions { "electron":"0.36" } + es.reflect.set { "electron":"0.36" } + es.reflect.set-prototype-of { "electron":"0.36" } + es.regexp.constructor { "electron":"0.36" } + es.regexp.flags { "electron":"0.36" } + es.regexp.to-string { "electron":"0.36" } + es.set { "electron":"0.36" } + es.string.ends-with { "electron":"0.36" } + es.string.includes { "electron":"0.36" } + es.string.match { "electron":"0.36" } + es.string.pad-end { "electron":"0.36" } + es.string.pad-start { "electron":"0.36" } + es.string.replace { "electron":"0.36" } + es.string.search { "electron":"0.36" } + es.string.split { "electron":"0.36" } + es.string.starts-with { "electron":"0.36" } + es.string.trim { "electron":"0.36" } + es.string.trim-end { "electron":"0.36" } + es.string.trim-start { "electron":"0.36" } + es.typed-array.float32-array { "electron":"0.36" } + es.typed-array.float64-array { "electron":"0.36" } + es.typed-array.int8-array { "electron":"0.36" } + es.typed-array.int16-array { "electron":"0.36" } + es.typed-array.int32-array { "electron":"0.36" } + es.typed-array.uint8-array { "electron":"0.36" } + es.typed-array.uint8-clamped-array { "electron":"0.36" } + es.typed-array.uint16-array { "electron":"0.36" } + es.typed-array.uint32-array { "electron":"0.36" } + es.typed-array.from { "electron":"0.36" } + es.typed-array.includes { "electron":"0.36" } + es.typed-array.of { "electron":"0.36" } + es.typed-array.to-string { "electron":"0.36" } + es.weak-map { "electron":"0.36" } + es.weak-set { "electron":"0.36" } + web.dom-collections.for-each { "electron":"0.36" } + web.dom-collections.iterator { "electron":"0.36" } + web.immediate { "electron":"0.36" } + web.queue-microtask { "electron":"0.36" } + web.url { "electron":"0.36" } + web.url.to-json { "electron":"0.36" } + web.url-search-params { "electron":"0.36" } diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-es-chrome-71/in/in.js b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-es-chrome-71/input.mjs similarity index 100% rename from packages/babel-preset-env/test/debug-fixtures/entry-corejs3-es-chrome-71/in/in.js rename to packages/babel-preset-env/test/fixtures/debug/entry-corejs3-es-chrome-71/input.mjs diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-es-chrome-71/options.json b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-es-chrome-71/options.json new file mode 100644 index 000000000000..6e8f4a357b28 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-es-chrome-71/options.json @@ -0,0 +1,18 @@ +{ + "validateLogs": true, + "ignoreOutput": true, + "presets": [ + [ + "env", + { + "debug": true, + "targets": { + "browsers": "chrome 71" + }, + "shippedProposals": true, + "useBuiltIns": "entry", + "corejs": 3 + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-es-chrome-71/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-es-chrome-71/stdout.txt new file mode 100644 index 000000000000..63661167c681 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-es-chrome-71/stdout.txt @@ -0,0 +1,29 @@ +@babel/preset-env: `DEBUG` option + +Using targets: +{ + "chrome": "71" +} + +Using modules transform: auto + +Using plugins: + proposal-numeric-separator { "chrome":"71" } + proposal-nullish-coalescing-operator { "chrome":"71" } + proposal-optional-chaining { "chrome":"71" } + syntax-json-strings { "chrome":"71" } + syntax-optional-catch-binding { "chrome":"71" } + syntax-async-generators { "chrome":"71" } + syntax-object-rest-spread { "chrome":"71" } + transform-modules-commonjs { "chrome":"71" } + proposal-dynamic-import { "chrome":"71" } + +Using polyfills with `entry` option: + +[/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-es-chrome-71/input.mjs] Replaced core-js entries with the following polyfills: + es.array.unscopables.flat { "chrome":"71" } + es.array.unscopables.flat-map { "chrome":"71" } + es.math.hypot { "chrome":"71" } + es.object.from-entries { "chrome":"71" } + +[/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-es-chrome-71/input.mjs] Based on your targets, regenerator-runtime import excluded. diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-es-proposals-chrome-71/in/in.js b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-es-proposals-chrome-71/input.mjs similarity index 100% rename from packages/babel-preset-env/test/debug-fixtures/entry-corejs3-es-proposals-chrome-71/in/in.js rename to packages/babel-preset-env/test/fixtures/debug/entry-corejs3-es-proposals-chrome-71/input.mjs diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-es-proposals-chrome-71/options.json b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-es-proposals-chrome-71/options.json new file mode 100644 index 000000000000..6e8f4a357b28 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-es-proposals-chrome-71/options.json @@ -0,0 +1,18 @@ +{ + "validateLogs": true, + "ignoreOutput": true, + "presets": [ + [ + "env", + { + "debug": true, + "targets": { + "browsers": "chrome 71" + }, + "shippedProposals": true, + "useBuiltIns": "entry", + "corejs": 3 + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-es-proposals-chrome-71/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-es-proposals-chrome-71/stdout.txt new file mode 100644 index 000000000000..579c124ba841 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-es-proposals-chrome-71/stdout.txt @@ -0,0 +1,110 @@ +@babel/preset-env: `DEBUG` option + +Using targets: +{ + "chrome": "71" +} + +Using modules transform: auto + +Using plugins: + proposal-numeric-separator { "chrome":"71" } + proposal-nullish-coalescing-operator { "chrome":"71" } + proposal-optional-chaining { "chrome":"71" } + syntax-json-strings { "chrome":"71" } + syntax-optional-catch-binding { "chrome":"71" } + syntax-async-generators { "chrome":"71" } + syntax-object-rest-spread { "chrome":"71" } + transform-modules-commonjs { "chrome":"71" } + proposal-dynamic-import { "chrome":"71" } + +Using polyfills with `entry` option: + +[/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-es-proposals-chrome-71/input.mjs] Replaced core-js entries with the following polyfills: + es.array.unscopables.flat { "chrome":"71" } + es.array.unscopables.flat-map { "chrome":"71" } + es.math.hypot { "chrome":"71" } + es.object.from-entries { "chrome":"71" } + esnext.aggregate-error { "chrome":"71" } + esnext.array.last-index { "chrome":"71" } + esnext.array.last-item { "chrome":"71" } + esnext.composite-key { "chrome":"71" } + esnext.composite-symbol { "chrome":"71" } + esnext.map.delete-all { "chrome":"71" } + esnext.map.every { "chrome":"71" } + esnext.map.filter { "chrome":"71" } + esnext.map.find { "chrome":"71" } + esnext.map.find-key { "chrome":"71" } + esnext.map.from { "chrome":"71" } + esnext.map.group-by { "chrome":"71" } + esnext.map.includes { "chrome":"71" } + esnext.map.key-by { "chrome":"71" } + esnext.map.key-of { "chrome":"71" } + esnext.map.map-keys { "chrome":"71" } + esnext.map.map-values { "chrome":"71" } + esnext.map.merge { "chrome":"71" } + esnext.map.of { "chrome":"71" } + esnext.map.reduce { "chrome":"71" } + esnext.map.some { "chrome":"71" } + esnext.map.update { "chrome":"71" } + esnext.math.clamp { "chrome":"71" } + esnext.math.deg-per-rad { "chrome":"71" } + esnext.math.degrees { "chrome":"71" } + esnext.math.fscale { "chrome":"71" } + esnext.math.iaddh { "chrome":"71" } + esnext.math.imulh { "chrome":"71" } + esnext.math.isubh { "chrome":"71" } + esnext.math.rad-per-deg { "chrome":"71" } + esnext.math.radians { "chrome":"71" } + esnext.math.scale { "chrome":"71" } + esnext.math.seeded-prng { "chrome":"71" } + esnext.math.signbit { "chrome":"71" } + esnext.math.umulh { "chrome":"71" } + esnext.number.from-string { "chrome":"71" } + esnext.observable { "chrome":"71" } + esnext.promise.all-settled { "chrome":"71" } + esnext.promise.any { "chrome":"71" } + esnext.promise.try { "chrome":"71" } + esnext.reflect.define-metadata { "chrome":"71" } + esnext.reflect.delete-metadata { "chrome":"71" } + esnext.reflect.get-metadata { "chrome":"71" } + esnext.reflect.get-metadata-keys { "chrome":"71" } + esnext.reflect.get-own-metadata { "chrome":"71" } + esnext.reflect.get-own-metadata-keys { "chrome":"71" } + esnext.reflect.has-metadata { "chrome":"71" } + esnext.reflect.has-own-metadata { "chrome":"71" } + esnext.reflect.metadata { "chrome":"71" } + esnext.set.add-all { "chrome":"71" } + esnext.set.delete-all { "chrome":"71" } + esnext.set.difference { "chrome":"71" } + esnext.set.every { "chrome":"71" } + esnext.set.filter { "chrome":"71" } + esnext.set.find { "chrome":"71" } + esnext.set.from { "chrome":"71" } + esnext.set.intersection { "chrome":"71" } + esnext.set.is-disjoint-from { "chrome":"71" } + esnext.set.is-subset-of { "chrome":"71" } + esnext.set.is-superset-of { "chrome":"71" } + esnext.set.join { "chrome":"71" } + esnext.set.map { "chrome":"71" } + esnext.set.of { "chrome":"71" } + esnext.set.reduce { "chrome":"71" } + esnext.set.some { "chrome":"71" } + esnext.set.symmetric-difference { "chrome":"71" } + esnext.set.union { "chrome":"71" } + esnext.string.at { "chrome":"71" } + esnext.string.code-points { "chrome":"71" } + esnext.string.match-all { "chrome":"71" } + esnext.string.replace-all { "chrome":"71" } + esnext.symbol.dispose { "chrome":"71" } + esnext.symbol.observable { "chrome":"71" } + esnext.symbol.pattern-match { "chrome":"71" } + esnext.weak-map.delete-all { "chrome":"71" } + esnext.weak-map.from { "chrome":"71" } + esnext.weak-map.of { "chrome":"71" } + esnext.weak-set.add-all { "chrome":"71" } + esnext.weak-set.delete-all { "chrome":"71" } + esnext.weak-set.from { "chrome":"71" } + esnext.weak-set.of { "chrome":"71" } + +[/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-es-proposals-chrome-71/input.mjs] Based on your targets, regenerator-runtime import excluded. diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-es-proposals/in/in.js b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-es-proposals/input.mjs similarity index 100% rename from packages/babel-preset-env/test/debug-fixtures/entry-corejs3-es-proposals/in/in.js rename to packages/babel-preset-env/test/fixtures/debug/entry-corejs3-es-proposals/input.mjs diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-es-proposals/options.json b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-es-proposals/options.json new file mode 100644 index 000000000000..edf42df8057e --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-es-proposals/options.json @@ -0,0 +1,15 @@ +{ + "validateLogs": true, + "ignoreOutput": true, + "presets": [ + [ + "env", + { + "debug": true, + "shippedProposals": true, + "useBuiltIns": "entry", + "corejs": 3 + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-es-proposals/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-es-proposals/stdout.txt new file mode 100644 index 000000000000..50609a36cdb0 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-es-proposals/stdout.txt @@ -0,0 +1,334 @@ +@babel/preset-env: `DEBUG` option + +Using targets: +{} + +Using modules transform: auto + +Using plugins: + proposal-numeric-separator {} + proposal-nullish-coalescing-operator {} + proposal-optional-chaining {} + proposal-json-strings {} + proposal-optional-catch-binding {} + transform-parameters {} + proposal-async-generator-functions {} + proposal-object-rest-spread {} + transform-dotall-regex {} + proposal-unicode-property-regex {} + transform-named-capturing-groups-regex {} + transform-async-to-generator {} + transform-exponentiation-operator {} + transform-template-literals {} + transform-literals {} + transform-function-name {} + transform-arrow-functions {} + transform-block-scoped-functions {} + transform-classes {} + transform-object-super {} + transform-shorthand-properties {} + transform-duplicate-keys {} + transform-computed-properties {} + transform-for-of {} + transform-sticky-regex {} + transform-unicode-regex {} + transform-spread {} + transform-destructuring {} + transform-block-scoping {} + transform-typeof-symbol {} + transform-new-target {} + transform-regenerator {} + transform-member-expression-literals {} + transform-property-literals {} + transform-reserved-words {} + transform-modules-commonjs {} + proposal-dynamic-import {} + +Using polyfills with `entry` option: + +[/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-es-proposals/input.mjs] Replaced core-js entries with the following polyfills: + es.symbol {} + es.symbol.description {} + es.symbol.async-iterator {} + es.symbol.has-instance {} + es.symbol.is-concat-spreadable {} + es.symbol.iterator {} + es.symbol.match {} + es.symbol.replace {} + es.symbol.search {} + es.symbol.species {} + es.symbol.split {} + es.symbol.to-primitive {} + es.symbol.to-string-tag {} + es.symbol.unscopables {} + es.array.concat {} + es.array.copy-within {} + es.array.every {} + es.array.fill {} + es.array.filter {} + es.array.find {} + es.array.find-index {} + es.array.flat {} + es.array.flat-map {} + es.array.for-each {} + es.array.from {} + es.array.includes {} + es.array.index-of {} + es.array.is-array {} + es.array.iterator {} + es.array.join {} + es.array.last-index-of {} + es.array.map {} + es.array.of {} + es.array.reduce {} + es.array.reduce-right {} + es.array.reverse {} + es.array.slice {} + es.array.some {} + es.array.sort {} + es.array.species {} + es.array.splice {} + es.array.unscopables.flat {} + es.array.unscopables.flat-map {} + es.array-buffer.constructor {} + es.array-buffer.is-view {} + es.array-buffer.slice {} + es.data-view {} + es.date.now {} + es.date.to-iso-string {} + es.date.to-json {} + es.date.to-primitive {} + es.date.to-string {} + es.function.bind {} + es.function.has-instance {} + es.function.name {} + es.json.to-string-tag {} + es.map {} + es.math.acosh {} + es.math.asinh {} + es.math.atanh {} + es.math.cbrt {} + es.math.clz32 {} + es.math.cosh {} + es.math.expm1 {} + es.math.fround {} + es.math.hypot {} + es.math.imul {} + es.math.log10 {} + es.math.log1p {} + es.math.log2 {} + es.math.sign {} + es.math.sinh {} + es.math.tanh {} + es.math.to-string-tag {} + es.math.trunc {} + es.number.constructor {} + es.number.epsilon {} + es.number.is-finite {} + es.number.is-integer {} + es.number.is-nan {} + es.number.is-safe-integer {} + es.number.max-safe-integer {} + es.number.min-safe-integer {} + es.number.parse-float {} + es.number.parse-int {} + es.number.to-fixed {} + es.number.to-precision {} + es.object.assign {} + es.object.create {} + es.object.define-getter {} + es.object.define-properties {} + es.object.define-property {} + es.object.define-setter {} + es.object.entries {} + es.object.freeze {} + es.object.from-entries {} + es.object.get-own-property-descriptor {} + es.object.get-own-property-descriptors {} + es.object.get-own-property-names {} + es.object.get-prototype-of {} + es.object.is {} + es.object.is-extensible {} + es.object.is-frozen {} + es.object.is-sealed {} + es.object.keys {} + es.object.lookup-getter {} + es.object.lookup-setter {} + es.object.prevent-extensions {} + es.object.seal {} + es.object.set-prototype-of {} + es.object.to-string {} + es.object.values {} + es.parse-float {} + es.parse-int {} + es.promise {} + es.promise.finally {} + es.reflect.apply {} + es.reflect.construct {} + es.reflect.define-property {} + es.reflect.delete-property {} + es.reflect.get {} + es.reflect.get-own-property-descriptor {} + es.reflect.get-prototype-of {} + es.reflect.has {} + es.reflect.is-extensible {} + es.reflect.own-keys {} + es.reflect.prevent-extensions {} + es.reflect.set {} + es.reflect.set-prototype-of {} + es.regexp.constructor {} + es.regexp.exec {} + es.regexp.flags {} + es.regexp.to-string {} + es.set {} + es.string.code-point-at {} + es.string.ends-with {} + es.string.from-code-point {} + es.string.includes {} + es.string.iterator {} + es.string.match {} + es.string.pad-end {} + es.string.pad-start {} + es.string.raw {} + es.string.repeat {} + es.string.replace {} + es.string.search {} + es.string.split {} + es.string.starts-with {} + es.string.trim {} + es.string.trim-end {} + es.string.trim-start {} + es.string.anchor {} + es.string.big {} + es.string.blink {} + es.string.bold {} + es.string.fixed {} + es.string.fontcolor {} + es.string.fontsize {} + es.string.italics {} + es.string.link {} + es.string.small {} + es.string.strike {} + es.string.sub {} + es.string.sup {} + es.typed-array.float32-array {} + es.typed-array.float64-array {} + es.typed-array.int8-array {} + es.typed-array.int16-array {} + es.typed-array.int32-array {} + es.typed-array.uint8-array {} + es.typed-array.uint8-clamped-array {} + es.typed-array.uint16-array {} + es.typed-array.uint32-array {} + es.typed-array.copy-within {} + es.typed-array.every {} + es.typed-array.fill {} + es.typed-array.filter {} + es.typed-array.find {} + es.typed-array.find-index {} + es.typed-array.for-each {} + es.typed-array.from {} + es.typed-array.includes {} + es.typed-array.index-of {} + es.typed-array.iterator {} + es.typed-array.join {} + es.typed-array.last-index-of {} + es.typed-array.map {} + es.typed-array.of {} + es.typed-array.reduce {} + es.typed-array.reduce-right {} + es.typed-array.reverse {} + es.typed-array.set {} + es.typed-array.slice {} + es.typed-array.some {} + es.typed-array.sort {} + es.typed-array.subarray {} + es.typed-array.to-locale-string {} + es.typed-array.to-string {} + es.weak-map {} + es.weak-set {} + esnext.aggregate-error {} + esnext.array.last-index {} + esnext.array.last-item {} + esnext.composite-key {} + esnext.composite-symbol {} + esnext.global-this {} + esnext.map.delete-all {} + esnext.map.every {} + esnext.map.filter {} + esnext.map.find {} + esnext.map.find-key {} + esnext.map.from {} + esnext.map.group-by {} + esnext.map.includes {} + esnext.map.key-by {} + esnext.map.key-of {} + esnext.map.map-keys {} + esnext.map.map-values {} + esnext.map.merge {} + esnext.map.of {} + esnext.map.reduce {} + esnext.map.some {} + esnext.map.update {} + esnext.math.clamp {} + esnext.math.deg-per-rad {} + esnext.math.degrees {} + esnext.math.fscale {} + esnext.math.iaddh {} + esnext.math.imulh {} + esnext.math.isubh {} + esnext.math.rad-per-deg {} + esnext.math.radians {} + esnext.math.scale {} + esnext.math.seeded-prng {} + esnext.math.signbit {} + esnext.math.umulh {} + esnext.number.from-string {} + esnext.observable {} + esnext.promise.all-settled {} + esnext.promise.any {} + esnext.promise.try {} + esnext.reflect.define-metadata {} + esnext.reflect.delete-metadata {} + esnext.reflect.get-metadata {} + esnext.reflect.get-metadata-keys {} + esnext.reflect.get-own-metadata {} + esnext.reflect.get-own-metadata-keys {} + esnext.reflect.has-metadata {} + esnext.reflect.has-own-metadata {} + esnext.reflect.metadata {} + esnext.set.add-all {} + esnext.set.delete-all {} + esnext.set.difference {} + esnext.set.every {} + esnext.set.filter {} + esnext.set.find {} + esnext.set.from {} + esnext.set.intersection {} + esnext.set.is-disjoint-from {} + esnext.set.is-subset-of {} + esnext.set.is-superset-of {} + esnext.set.join {} + esnext.set.map {} + esnext.set.of {} + esnext.set.reduce {} + esnext.set.some {} + esnext.set.symmetric-difference {} + esnext.set.union {} + esnext.string.at {} + esnext.string.code-points {} + esnext.string.match-all {} + esnext.string.replace-all {} + esnext.symbol.dispose {} + esnext.symbol.observable {} + esnext.symbol.pattern-match {} + esnext.weak-map.delete-all {} + esnext.weak-map.from {} + esnext.weak-map.of {} + esnext.weak-set.add-all {} + esnext.weak-set.delete-all {} + esnext.weak-set.from {} + esnext.weak-set.of {} + web.url {} + web.url.to-json {} + web.url-search-params {} diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-es/in/in.js b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-es/input.mjs similarity index 100% rename from packages/babel-preset-env/test/debug-fixtures/entry-corejs3-es/in/in.js rename to packages/babel-preset-env/test/fixtures/debug/entry-corejs3-es/input.mjs diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-es/options.json b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-es/options.json new file mode 100644 index 000000000000..edf42df8057e --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-es/options.json @@ -0,0 +1,15 @@ +{ + "validateLogs": true, + "ignoreOutput": true, + "presets": [ + [ + "env", + { + "debug": true, + "shippedProposals": true, + "useBuiltIns": "entry", + "corejs": 3 + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-es/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-es/stdout.txt new file mode 100644 index 000000000000..27aca61b0e0c --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-es/stdout.txt @@ -0,0 +1,249 @@ +@babel/preset-env: `DEBUG` option + +Using targets: +{} + +Using modules transform: auto + +Using plugins: + proposal-numeric-separator {} + proposal-nullish-coalescing-operator {} + proposal-optional-chaining {} + proposal-json-strings {} + proposal-optional-catch-binding {} + transform-parameters {} + proposal-async-generator-functions {} + proposal-object-rest-spread {} + transform-dotall-regex {} + proposal-unicode-property-regex {} + transform-named-capturing-groups-regex {} + transform-async-to-generator {} + transform-exponentiation-operator {} + transform-template-literals {} + transform-literals {} + transform-function-name {} + transform-arrow-functions {} + transform-block-scoped-functions {} + transform-classes {} + transform-object-super {} + transform-shorthand-properties {} + transform-duplicate-keys {} + transform-computed-properties {} + transform-for-of {} + transform-sticky-regex {} + transform-unicode-regex {} + transform-spread {} + transform-destructuring {} + transform-block-scoping {} + transform-typeof-symbol {} + transform-new-target {} + transform-regenerator {} + transform-member-expression-literals {} + transform-property-literals {} + transform-reserved-words {} + transform-modules-commonjs {} + proposal-dynamic-import {} + +Using polyfills with `entry` option: + +[/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-es/input.mjs] Replaced core-js entries with the following polyfills: + es.symbol {} + es.symbol.description {} + es.symbol.async-iterator {} + es.symbol.has-instance {} + es.symbol.is-concat-spreadable {} + es.symbol.iterator {} + es.symbol.match {} + es.symbol.replace {} + es.symbol.search {} + es.symbol.species {} + es.symbol.split {} + es.symbol.to-primitive {} + es.symbol.to-string-tag {} + es.symbol.unscopables {} + es.array.concat {} + es.array.copy-within {} + es.array.every {} + es.array.fill {} + es.array.filter {} + es.array.find {} + es.array.find-index {} + es.array.flat {} + es.array.flat-map {} + es.array.for-each {} + es.array.from {} + es.array.includes {} + es.array.index-of {} + es.array.is-array {} + es.array.iterator {} + es.array.join {} + es.array.last-index-of {} + es.array.map {} + es.array.of {} + es.array.reduce {} + es.array.reduce-right {} + es.array.reverse {} + es.array.slice {} + es.array.some {} + es.array.sort {} + es.array.species {} + es.array.splice {} + es.array.unscopables.flat {} + es.array.unscopables.flat-map {} + es.array-buffer.constructor {} + es.array-buffer.is-view {} + es.array-buffer.slice {} + es.data-view {} + es.date.now {} + es.date.to-iso-string {} + es.date.to-json {} + es.date.to-primitive {} + es.date.to-string {} + es.function.bind {} + es.function.has-instance {} + es.function.name {} + es.json.to-string-tag {} + es.map {} + es.math.acosh {} + es.math.asinh {} + es.math.atanh {} + es.math.cbrt {} + es.math.clz32 {} + es.math.cosh {} + es.math.expm1 {} + es.math.fround {} + es.math.hypot {} + es.math.imul {} + es.math.log10 {} + es.math.log1p {} + es.math.log2 {} + es.math.sign {} + es.math.sinh {} + es.math.tanh {} + es.math.to-string-tag {} + es.math.trunc {} + es.number.constructor {} + es.number.epsilon {} + es.number.is-finite {} + es.number.is-integer {} + es.number.is-nan {} + es.number.is-safe-integer {} + es.number.max-safe-integer {} + es.number.min-safe-integer {} + es.number.parse-float {} + es.number.parse-int {} + es.number.to-fixed {} + es.number.to-precision {} + es.object.assign {} + es.object.create {} + es.object.define-getter {} + es.object.define-properties {} + es.object.define-property {} + es.object.define-setter {} + es.object.entries {} + es.object.freeze {} + es.object.from-entries {} + es.object.get-own-property-descriptor {} + es.object.get-own-property-descriptors {} + es.object.get-own-property-names {} + es.object.get-prototype-of {} + es.object.is {} + es.object.is-extensible {} + es.object.is-frozen {} + es.object.is-sealed {} + es.object.keys {} + es.object.lookup-getter {} + es.object.lookup-setter {} + es.object.prevent-extensions {} + es.object.seal {} + es.object.set-prototype-of {} + es.object.to-string {} + es.object.values {} + es.parse-float {} + es.parse-int {} + es.promise {} + es.promise.finally {} + es.reflect.apply {} + es.reflect.construct {} + es.reflect.define-property {} + es.reflect.delete-property {} + es.reflect.get {} + es.reflect.get-own-property-descriptor {} + es.reflect.get-prototype-of {} + es.reflect.has {} + es.reflect.is-extensible {} + es.reflect.own-keys {} + es.reflect.prevent-extensions {} + es.reflect.set {} + es.reflect.set-prototype-of {} + es.regexp.constructor {} + es.regexp.exec {} + es.regexp.flags {} + es.regexp.to-string {} + es.set {} + es.string.code-point-at {} + es.string.ends-with {} + es.string.from-code-point {} + es.string.includes {} + es.string.iterator {} + es.string.match {} + es.string.pad-end {} + es.string.pad-start {} + es.string.raw {} + es.string.repeat {} + es.string.replace {} + es.string.search {} + es.string.split {} + es.string.starts-with {} + es.string.trim {} + es.string.trim-end {} + es.string.trim-start {} + es.string.anchor {} + es.string.big {} + es.string.blink {} + es.string.bold {} + es.string.fixed {} + es.string.fontcolor {} + es.string.fontsize {} + es.string.italics {} + es.string.link {} + es.string.small {} + es.string.strike {} + es.string.sub {} + es.string.sup {} + es.typed-array.float32-array {} + es.typed-array.float64-array {} + es.typed-array.int8-array {} + es.typed-array.int16-array {} + es.typed-array.int32-array {} + es.typed-array.uint8-array {} + es.typed-array.uint8-clamped-array {} + es.typed-array.uint16-array {} + es.typed-array.uint32-array {} + es.typed-array.copy-within {} + es.typed-array.every {} + es.typed-array.fill {} + es.typed-array.filter {} + es.typed-array.find {} + es.typed-array.find-index {} + es.typed-array.for-each {} + es.typed-array.from {} + es.typed-array.includes {} + es.typed-array.index-of {} + es.typed-array.iterator {} + es.typed-array.join {} + es.typed-array.last-index-of {} + es.typed-array.map {} + es.typed-array.of {} + es.typed-array.reduce {} + es.typed-array.reduce-right {} + es.typed-array.reverse {} + es.typed-array.set {} + es.typed-array.slice {} + es.typed-array.some {} + es.typed-array.sort {} + es.typed-array.subarray {} + es.typed-array.to-locale-string {} + es.typed-array.to-string {} + es.weak-map {} + es.weak-set {} diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-force-all-transforms/in/in.js b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-force-all-transforms/input.mjs similarity index 100% rename from packages/babel-preset-env/test/debug-fixtures/entry-corejs3-force-all-transforms/in/in.js rename to packages/babel-preset-env/test/fixtures/debug/entry-corejs3-force-all-transforms/input.mjs diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-force-all-transforms/options.json b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-force-all-transforms/options.json new file mode 100644 index 000000000000..7a7ff504fed3 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-force-all-transforms/options.json @@ -0,0 +1,19 @@ +{ + "validateLogs": true, + "ignoreOutput": true, + "presets": [ + [ + "env", + { + "debug": true, + "modules": false, + "targets": { + "chrome": 55 + }, + "useBuiltIns": "entry", + "corejs": 3, + "forceAllTransforms": true + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-force-all-transforms/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-force-all-transforms/stdout.txt new file mode 100644 index 000000000000..f2048d5abaa8 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-force-all-transforms/stdout.txt @@ -0,0 +1,78 @@ +@babel/preset-env: `DEBUG` option + +Using targets: +{ + "chrome": "55" +} + +Using modules transform: false + +Using plugins: + proposal-nullish-coalescing-operator { "chrome":"55" } + proposal-optional-chaining { "chrome":"55" } + proposal-json-strings { "chrome":"55" } + proposal-optional-catch-binding { "chrome":"55" } + transform-parameters {} + proposal-async-generator-functions { "chrome":"55" } + proposal-object-rest-spread { "chrome":"55" } + transform-dotall-regex { "chrome":"55" } + proposal-unicode-property-regex { "chrome":"55" } + transform-named-capturing-groups-regex { "chrome":"55" } + transform-async-to-generator {} + transform-exponentiation-operator {} + transform-template-literals {} + transform-literals {} + transform-function-name {} + transform-arrow-functions {} + transform-block-scoped-functions {} + transform-classes {} + transform-object-super {} + transform-shorthand-properties {} + transform-duplicate-keys {} + transform-computed-properties {} + transform-for-of {} + transform-sticky-regex {} + transform-unicode-regex {} + transform-spread {} + transform-destructuring {} + transform-block-scoping {} + transform-typeof-symbol {} + transform-new-target {} + transform-regenerator {} + transform-member-expression-literals {} + transform-property-literals {} + transform-reserved-words {} + syntax-dynamic-import { "chrome":"55" } + +Using polyfills with `entry` option: + +[/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-force-all-transforms/input.mjs] Replaced core-js entries with the following polyfills: + es.symbol.description { "chrome":"55" } + es.symbol.async-iterator { "chrome":"55" } + es.array.flat { "chrome":"55" } + es.array.flat-map { "chrome":"55" } + es.array.iterator { "chrome":"55" } + es.array.sort { "chrome":"55" } + es.array.unscopables.flat { "chrome":"55" } + es.array.unscopables.flat-map { "chrome":"55" } + es.math.hypot { "chrome":"55" } + es.object.define-getter { "chrome":"55" } + es.object.define-setter { "chrome":"55" } + es.object.from-entries { "chrome":"55" } + es.object.lookup-getter { "chrome":"55" } + es.object.lookup-setter { "chrome":"55" } + es.promise { "chrome":"55" } + es.promise.finally { "chrome":"55" } + es.string.pad-end { "chrome":"55" } + es.string.pad-start { "chrome":"55" } + es.string.replace { "chrome":"55" } + es.string.trim { "chrome":"55" } + es.string.trim-end { "chrome":"55" } + es.string.trim-start { "chrome":"55" } + web.dom-collections.for-each { "chrome":"55" } + web.dom-collections.iterator { "chrome":"55" } + web.immediate { "chrome":"55" } + web.queue-microtask { "chrome":"55" } + web.url { "chrome":"55" } + web.url.to-json { "chrome":"55" } + web.url-search-params { "chrome":"55" } diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-no-import/in/in.js b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-no-import/input.js similarity index 100% rename from packages/babel-preset-env/test/debug-fixtures/entry-corejs3-no-import/in/in.js rename to packages/babel-preset-env/test/fixtures/debug/entry-corejs3-no-import/input.js diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-no-import/options.json b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-no-import/options.json new file mode 100644 index 000000000000..06c8e01e63ad --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-no-import/options.json @@ -0,0 +1,17 @@ +{ + "validateLogs": true, + "ignoreOutput": true, + "presets": [ + [ + "env", + { + "debug": true, + "targets": { + "node": 6 + }, + "useBuiltIns": "entry", + "corejs": 3 + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-no-import/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-no-import/stdout.txt new file mode 100644 index 000000000000..d0765709ed86 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-no-import/stdout.txt @@ -0,0 +1,30 @@ +@babel/preset-env: `DEBUG` option + +Using targets: +{ + "node": "6" +} + +Using modules transform: auto + +Using plugins: + proposal-nullish-coalescing-operator { "node":"6" } + proposal-optional-chaining { "node":"6" } + proposal-json-strings { "node":"6" } + proposal-optional-catch-binding { "node":"6" } + proposal-async-generator-functions { "node":"6" } + proposal-object-rest-spread { "node":"6" } + transform-dotall-regex { "node":"6" } + proposal-unicode-property-regex { "node":"6" } + transform-named-capturing-groups-regex { "node":"6" } + transform-async-to-generator { "node":"6" } + transform-exponentiation-operator { "node":"6" } + transform-function-name { "node":"6" } + transform-for-of { "node":"6" } + transform-destructuring { "node":"6" } + transform-modules-commonjs { "node":"6" } + proposal-dynamic-import { "node":"6" } + +Using polyfills with `entry` option: + +[/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-no-import/input.js] Import of core-js was not found. diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-proposals-chrome-71/in/in.js b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-proposals-chrome-71/input.mjs similarity index 100% rename from packages/babel-preset-env/test/debug-fixtures/entry-corejs3-proposals-chrome-71/in/in.js rename to packages/babel-preset-env/test/fixtures/debug/entry-corejs3-proposals-chrome-71/input.mjs diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-proposals-chrome-71/options.json b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-proposals-chrome-71/options.json new file mode 100644 index 000000000000..c33ddf46d323 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-proposals-chrome-71/options.json @@ -0,0 +1,17 @@ +{ + "validateLogs": true, + "ignoreOutput": true, + "presets": [ + [ + "env", + { + "debug": true, + "targets": { + "browsers": "chrome 71" + }, + "useBuiltIns": "entry", + "corejs": { "version": 3, "proposals": true } + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-proposals-chrome-71/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-proposals-chrome-71/stdout.txt new file mode 100644 index 000000000000..e68ee42d02c5 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-proposals-chrome-71/stdout.txt @@ -0,0 +1,105 @@ +@babel/preset-env: `DEBUG` option + +Using targets: +{ + "chrome": "71" +} + +Using modules transform: auto + +Using plugins: + proposal-nullish-coalescing-operator { "chrome":"71" } + proposal-optional-chaining { "chrome":"71" } + syntax-json-strings { "chrome":"71" } + syntax-optional-catch-binding { "chrome":"71" } + syntax-async-generators { "chrome":"71" } + syntax-object-rest-spread { "chrome":"71" } + transform-modules-commonjs { "chrome":"71" } + proposal-dynamic-import { "chrome":"71" } + +Using polyfills with `entry` option: + +[/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-proposals-chrome-71/input.mjs] Replaced core-js entries with the following polyfills: + esnext.aggregate-error { "chrome":"71" } + esnext.array.last-index { "chrome":"71" } + esnext.array.last-item { "chrome":"71" } + esnext.composite-key { "chrome":"71" } + esnext.composite-symbol { "chrome":"71" } + esnext.map.delete-all { "chrome":"71" } + esnext.map.every { "chrome":"71" } + esnext.map.filter { "chrome":"71" } + esnext.map.find { "chrome":"71" } + esnext.map.find-key { "chrome":"71" } + esnext.map.from { "chrome":"71" } + esnext.map.group-by { "chrome":"71" } + esnext.map.includes { "chrome":"71" } + esnext.map.key-by { "chrome":"71" } + esnext.map.key-of { "chrome":"71" } + esnext.map.map-keys { "chrome":"71" } + esnext.map.map-values { "chrome":"71" } + esnext.map.merge { "chrome":"71" } + esnext.map.of { "chrome":"71" } + esnext.map.reduce { "chrome":"71" } + esnext.map.some { "chrome":"71" } + esnext.map.update { "chrome":"71" } + esnext.math.clamp { "chrome":"71" } + esnext.math.deg-per-rad { "chrome":"71" } + esnext.math.degrees { "chrome":"71" } + esnext.math.fscale { "chrome":"71" } + esnext.math.iaddh { "chrome":"71" } + esnext.math.imulh { "chrome":"71" } + esnext.math.isubh { "chrome":"71" } + esnext.math.rad-per-deg { "chrome":"71" } + esnext.math.radians { "chrome":"71" } + esnext.math.scale { "chrome":"71" } + esnext.math.seeded-prng { "chrome":"71" } + esnext.math.signbit { "chrome":"71" } + esnext.math.umulh { "chrome":"71" } + esnext.number.from-string { "chrome":"71" } + esnext.observable { "chrome":"71" } + esnext.promise.all-settled { "chrome":"71" } + esnext.promise.any { "chrome":"71" } + esnext.promise.try { "chrome":"71" } + esnext.reflect.define-metadata { "chrome":"71" } + esnext.reflect.delete-metadata { "chrome":"71" } + esnext.reflect.get-metadata { "chrome":"71" } + esnext.reflect.get-metadata-keys { "chrome":"71" } + esnext.reflect.get-own-metadata { "chrome":"71" } + esnext.reflect.get-own-metadata-keys { "chrome":"71" } + esnext.reflect.has-metadata { "chrome":"71" } + esnext.reflect.has-own-metadata { "chrome":"71" } + esnext.reflect.metadata { "chrome":"71" } + esnext.set.add-all { "chrome":"71" } + esnext.set.delete-all { "chrome":"71" } + esnext.set.difference { "chrome":"71" } + esnext.set.every { "chrome":"71" } + esnext.set.filter { "chrome":"71" } + esnext.set.find { "chrome":"71" } + esnext.set.from { "chrome":"71" } + esnext.set.intersection { "chrome":"71" } + esnext.set.is-disjoint-from { "chrome":"71" } + esnext.set.is-subset-of { "chrome":"71" } + esnext.set.is-superset-of { "chrome":"71" } + esnext.set.join { "chrome":"71" } + esnext.set.map { "chrome":"71" } + esnext.set.of { "chrome":"71" } + esnext.set.reduce { "chrome":"71" } + esnext.set.some { "chrome":"71" } + esnext.set.symmetric-difference { "chrome":"71" } + esnext.set.union { "chrome":"71" } + esnext.string.at { "chrome":"71" } + esnext.string.code-points { "chrome":"71" } + esnext.string.match-all { "chrome":"71" } + esnext.string.replace-all { "chrome":"71" } + esnext.symbol.dispose { "chrome":"71" } + esnext.symbol.observable { "chrome":"71" } + esnext.symbol.pattern-match { "chrome":"71" } + esnext.weak-map.delete-all { "chrome":"71" } + esnext.weak-map.from { "chrome":"71" } + esnext.weak-map.of { "chrome":"71" } + esnext.weak-set.add-all { "chrome":"71" } + esnext.weak-set.delete-all { "chrome":"71" } + esnext.weak-set.from { "chrome":"71" } + esnext.weak-set.of { "chrome":"71" } + +[/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-proposals-chrome-71/input.mjs] Based on your targets, regenerator-runtime import excluded. diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-proposals/in/in.js b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-proposals/input.mjs similarity index 100% rename from packages/babel-preset-env/test/debug-fixtures/entry-corejs3-proposals/in/in.js rename to packages/babel-preset-env/test/fixtures/debug/entry-corejs3-proposals/input.mjs diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-proposals/options.json b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-proposals/options.json new file mode 100644 index 000000000000..be2441059196 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-proposals/options.json @@ -0,0 +1,14 @@ +{ + "validateLogs": true, + "ignoreOutput": true, + "presets": [ + [ + "env", + { + "debug": true, + "useBuiltIns": "entry", + "corejs": { "version": 3, "proposals": true } + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-proposals/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-proposals/stdout.txt new file mode 100644 index 000000000000..6019d4ccdc8a --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-proposals/stdout.txt @@ -0,0 +1,133 @@ +@babel/preset-env: `DEBUG` option + +Using targets: +{} + +Using modules transform: auto + +Using plugins: + proposal-nullish-coalescing-operator {} + proposal-optional-chaining {} + proposal-json-strings {} + proposal-optional-catch-binding {} + transform-parameters {} + proposal-async-generator-functions {} + proposal-object-rest-spread {} + transform-dotall-regex {} + proposal-unicode-property-regex {} + transform-named-capturing-groups-regex {} + transform-async-to-generator {} + transform-exponentiation-operator {} + transform-template-literals {} + transform-literals {} + transform-function-name {} + transform-arrow-functions {} + transform-block-scoped-functions {} + transform-classes {} + transform-object-super {} + transform-shorthand-properties {} + transform-duplicate-keys {} + transform-computed-properties {} + transform-for-of {} + transform-sticky-regex {} + transform-unicode-regex {} + transform-spread {} + transform-destructuring {} + transform-block-scoping {} + transform-typeof-symbol {} + transform-new-target {} + transform-regenerator {} + transform-member-expression-literals {} + transform-property-literals {} + transform-reserved-words {} + transform-modules-commonjs {} + proposal-dynamic-import {} + +Using polyfills with `entry` option: + +[/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-proposals/input.mjs] Replaced core-js entries with the following polyfills: + esnext.aggregate-error {} + esnext.array.last-index {} + esnext.array.last-item {} + esnext.composite-key {} + esnext.composite-symbol {} + esnext.global-this {} + esnext.map.delete-all {} + esnext.map.every {} + esnext.map.filter {} + esnext.map.find {} + esnext.map.find-key {} + esnext.map.from {} + esnext.map.group-by {} + esnext.map.includes {} + esnext.map.key-by {} + esnext.map.key-of {} + esnext.map.map-keys {} + esnext.map.map-values {} + esnext.map.merge {} + esnext.map.of {} + esnext.map.reduce {} + esnext.map.some {} + esnext.map.update {} + esnext.math.clamp {} + esnext.math.deg-per-rad {} + esnext.math.degrees {} + esnext.math.fscale {} + esnext.math.iaddh {} + esnext.math.imulh {} + esnext.math.isubh {} + esnext.math.rad-per-deg {} + esnext.math.radians {} + esnext.math.scale {} + esnext.math.seeded-prng {} + esnext.math.signbit {} + esnext.math.umulh {} + esnext.number.from-string {} + esnext.observable {} + esnext.promise.all-settled {} + esnext.promise.any {} + esnext.promise.try {} + esnext.reflect.define-metadata {} + esnext.reflect.delete-metadata {} + esnext.reflect.get-metadata {} + esnext.reflect.get-metadata-keys {} + esnext.reflect.get-own-metadata {} + esnext.reflect.get-own-metadata-keys {} + esnext.reflect.has-metadata {} + esnext.reflect.has-own-metadata {} + esnext.reflect.metadata {} + esnext.set.add-all {} + esnext.set.delete-all {} + esnext.set.difference {} + esnext.set.every {} + esnext.set.filter {} + esnext.set.find {} + esnext.set.from {} + esnext.set.intersection {} + esnext.set.is-disjoint-from {} + esnext.set.is-subset-of {} + esnext.set.is-superset-of {} + esnext.set.join {} + esnext.set.map {} + esnext.set.of {} + esnext.set.reduce {} + esnext.set.some {} + esnext.set.symmetric-difference {} + esnext.set.union {} + esnext.string.at {} + esnext.string.code-points {} + esnext.string.match-all {} + esnext.string.replace-all {} + esnext.symbol.dispose {} + esnext.symbol.observable {} + esnext.symbol.pattern-match {} + esnext.weak-map.delete-all {} + esnext.weak-map.from {} + esnext.weak-map.of {} + esnext.weak-set.add-all {} + esnext.weak-set.delete-all {} + esnext.weak-set.from {} + esnext.weak-set.of {} + web.url {} + web.url.to-json {} + web.url-search-params {} diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-runtime-only-chrome-71/in/in.js b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-runtime-only-chrome-71/input.mjs similarity index 100% rename from packages/babel-preset-env/test/debug-fixtures/entry-corejs3-runtime-only-chrome-71/in/in.js rename to packages/babel-preset-env/test/fixtures/debug/entry-corejs3-runtime-only-chrome-71/input.mjs diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-runtime-only-chrome-71/options.json b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-runtime-only-chrome-71/options.json new file mode 100644 index 000000000000..6e8f4a357b28 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-runtime-only-chrome-71/options.json @@ -0,0 +1,18 @@ +{ + "validateLogs": true, + "ignoreOutput": true, + "presets": [ + [ + "env", + { + "debug": true, + "targets": { + "browsers": "chrome 71" + }, + "shippedProposals": true, + "useBuiltIns": "entry", + "corejs": 3 + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-runtime-only-chrome-71/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-runtime-only-chrome-71/stdout.txt new file mode 100644 index 000000000000..7d9e05d8a537 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-runtime-only-chrome-71/stdout.txt @@ -0,0 +1,25 @@ +@babel/preset-env: `DEBUG` option + +Using targets: +{ + "chrome": "71" +} + +Using modules transform: auto + +Using plugins: + proposal-numeric-separator { "chrome":"71" } + proposal-nullish-coalescing-operator { "chrome":"71" } + proposal-optional-chaining { "chrome":"71" } + syntax-json-strings { "chrome":"71" } + syntax-optional-catch-binding { "chrome":"71" } + syntax-async-generators { "chrome":"71" } + syntax-object-rest-spread { "chrome":"71" } + transform-modules-commonjs { "chrome":"71" } + proposal-dynamic-import { "chrome":"71" } + +Using polyfills with `entry` option: + +[/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-runtime-only-chrome-71/input.mjs] Import of core-js was not found. + +[/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-runtime-only-chrome-71/input.mjs] Based on your targets, regenerator-runtime import excluded. diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-runtime-only/in/in.js b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-runtime-only/input.mjs similarity index 100% rename from packages/babel-preset-env/test/debug-fixtures/entry-corejs3-runtime-only/in/in.js rename to packages/babel-preset-env/test/fixtures/debug/entry-corejs3-runtime-only/input.mjs diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-runtime-only/options.json b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-runtime-only/options.json new file mode 100644 index 000000000000..6e8f4a357b28 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-runtime-only/options.json @@ -0,0 +1,18 @@ +{ + "validateLogs": true, + "ignoreOutput": true, + "presets": [ + [ + "env", + { + "debug": true, + "targets": { + "browsers": "chrome 71" + }, + "shippedProposals": true, + "useBuiltIns": "entry", + "corejs": 3 + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-runtime-only/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-runtime-only/stdout.txt new file mode 100644 index 000000000000..3ae605d986ad --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-runtime-only/stdout.txt @@ -0,0 +1,25 @@ +@babel/preset-env: `DEBUG` option + +Using targets: +{ + "chrome": "71" +} + +Using modules transform: auto + +Using plugins: + proposal-numeric-separator { "chrome":"71" } + proposal-nullish-coalescing-operator { "chrome":"71" } + proposal-optional-chaining { "chrome":"71" } + syntax-json-strings { "chrome":"71" } + syntax-optional-catch-binding { "chrome":"71" } + syntax-async-generators { "chrome":"71" } + syntax-object-rest-spread { "chrome":"71" } + transform-modules-commonjs { "chrome":"71" } + proposal-dynamic-import { "chrome":"71" } + +Using polyfills with `entry` option: + +[/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-runtime-only/input.mjs] Import of core-js was not found. + +[/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-runtime-only/input.mjs] Based on your targets, regenerator-runtime import excluded. diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-specific-entries-chrome-71/in/in.js b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-specific-entries-chrome-71/input.mjs similarity index 100% rename from packages/babel-preset-env/test/debug-fixtures/entry-corejs3-specific-entries-chrome-71/in/in.js rename to packages/babel-preset-env/test/fixtures/debug/entry-corejs3-specific-entries-chrome-71/input.mjs diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-specific-entries-chrome-71/options.json b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-specific-entries-chrome-71/options.json new file mode 100644 index 000000000000..6e8f4a357b28 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-specific-entries-chrome-71/options.json @@ -0,0 +1,18 @@ +{ + "validateLogs": true, + "ignoreOutput": true, + "presets": [ + [ + "env", + { + "debug": true, + "targets": { + "browsers": "chrome 71" + }, + "shippedProposals": true, + "useBuiltIns": "entry", + "corejs": 3 + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-specific-entries-chrome-71/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-specific-entries-chrome-71/stdout.txt new file mode 100644 index 000000000000..590c0f6e445a --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-specific-entries-chrome-71/stdout.txt @@ -0,0 +1,35 @@ +@babel/preset-env: `DEBUG` option + +Using targets: +{ + "chrome": "71" +} + +Using modules transform: auto + +Using plugins: + proposal-numeric-separator { "chrome":"71" } + proposal-nullish-coalescing-operator { "chrome":"71" } + proposal-optional-chaining { "chrome":"71" } + syntax-json-strings { "chrome":"71" } + syntax-optional-catch-binding { "chrome":"71" } + syntax-async-generators { "chrome":"71" } + syntax-object-rest-spread { "chrome":"71" } + transform-modules-commonjs { "chrome":"71" } + proposal-dynamic-import { "chrome":"71" } + +Using polyfills with `entry` option: + +[/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-specific-entries-chrome-71/input.mjs] Replaced core-js entries with the following polyfills: + es.object.from-entries { "chrome":"71" } + esnext.reflect.define-metadata { "chrome":"71" } + esnext.reflect.delete-metadata { "chrome":"71" } + esnext.reflect.get-metadata { "chrome":"71" } + esnext.reflect.get-metadata-keys { "chrome":"71" } + esnext.reflect.get-own-metadata { "chrome":"71" } + esnext.reflect.get-own-metadata-keys { "chrome":"71" } + esnext.reflect.has-metadata { "chrome":"71" } + esnext.reflect.has-own-metadata { "chrome":"71" } + esnext.reflect.metadata { "chrome":"71" } + +[/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-specific-entries-chrome-71/input.mjs] Based on your targets, regenerator-runtime import excluded. diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-specific-entries/in/in.js b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-specific-entries/input.mjs similarity index 100% rename from packages/babel-preset-env/test/debug-fixtures/entry-corejs3-specific-entries/in/in.js rename to packages/babel-preset-env/test/fixtures/debug/entry-corejs3-specific-entries/input.mjs diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-specific-entries/options.json b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-specific-entries/options.json new file mode 100644 index 000000000000..edf42df8057e --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-specific-entries/options.json @@ -0,0 +1,15 @@ +{ + "validateLogs": true, + "ignoreOutput": true, + "presets": [ + [ + "env", + { + "debug": true, + "shippedProposals": true, + "useBuiltIns": "entry", + "corejs": 3 + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-specific-entries/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-specific-entries/stdout.txt new file mode 100644 index 000000000000..b28a0ffd93de --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-specific-entries/stdout.txt @@ -0,0 +1,99 @@ +@babel/preset-env: `DEBUG` option + +Using targets: +{} + +Using modules transform: auto + +Using plugins: + proposal-numeric-separator {} + proposal-nullish-coalescing-operator {} + proposal-optional-chaining {} + proposal-json-strings {} + proposal-optional-catch-binding {} + transform-parameters {} + proposal-async-generator-functions {} + proposal-object-rest-spread {} + transform-dotall-regex {} + proposal-unicode-property-regex {} + transform-named-capturing-groups-regex {} + transform-async-to-generator {} + transform-exponentiation-operator {} + transform-template-literals {} + transform-literals {} + transform-function-name {} + transform-arrow-functions {} + transform-block-scoped-functions {} + transform-classes {} + transform-object-super {} + transform-shorthand-properties {} + transform-duplicate-keys {} + transform-computed-properties {} + transform-for-of {} + transform-sticky-regex {} + transform-unicode-regex {} + transform-spread {} + transform-destructuring {} + transform-block-scoping {} + transform-typeof-symbol {} + transform-new-target {} + transform-regenerator {} + transform-member-expression-literals {} + transform-property-literals {} + transform-reserved-words {} + transform-modules-commonjs {} + proposal-dynamic-import {} + +Using polyfills with `entry` option: + +[/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-specific-entries/input.mjs] Replaced core-js entries with the following polyfills: + es.symbol {} + es.json.to-string-tag {} + es.math.to-string-tag {} + es.object.assign {} + es.object.create {} + es.object.define-getter {} + es.object.define-properties {} + es.object.define-property {} + es.object.define-setter {} + es.object.entries {} + es.object.freeze {} + es.object.from-entries {} + es.object.get-own-property-descriptor {} + es.object.get-own-property-descriptors {} + es.object.get-own-property-names {} + es.object.get-prototype-of {} + es.object.is {} + es.object.is-extensible {} + es.object.is-frozen {} + es.object.is-sealed {} + es.object.keys {} + es.object.lookup-getter {} + es.object.lookup-setter {} + es.object.prevent-extensions {} + es.object.seal {} + es.object.set-prototype-of {} + es.object.to-string {} + es.object.values {} + es.reflect.apply {} + es.reflect.construct {} + es.reflect.define-property {} + es.reflect.delete-property {} + es.reflect.get {} + es.reflect.get-own-property-descriptor {} + es.reflect.get-prototype-of {} + es.reflect.has {} + es.reflect.is-extensible {} + es.reflect.own-keys {} + es.reflect.prevent-extensions {} + es.reflect.set {} + es.reflect.set-prototype-of {} + esnext.reflect.define-metadata {} + esnext.reflect.delete-metadata {} + esnext.reflect.get-metadata {} + esnext.reflect.get-metadata-keys {} + esnext.reflect.get-own-metadata {} + esnext.reflect.get-own-metadata-keys {} + esnext.reflect.has-metadata {} + esnext.reflect.has-own-metadata {} + esnext.reflect.metadata {} diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-specific-targets/in/in.js b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-specific-targets/input.mjs similarity index 100% rename from packages/babel-preset-env/test/debug-fixtures/entry-corejs3-specific-targets/in/in.js rename to packages/babel-preset-env/test/fixtures/debug/entry-corejs3-specific-targets/input.mjs diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-specific-targets/options.json b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-specific-targets/options.json new file mode 100644 index 000000000000..29b3f9326ffb --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-specific-targets/options.json @@ -0,0 +1,17 @@ +{ + "validateLogs": true, + "ignoreOutput": true, + "presets": [ + [ + "env", + { + "debug": true, + "targets": { + "browsers": "ie 10, ios 9, safari 7, edge 13, chrome 54, firefox 49" + }, + "useBuiltIns": "entry", + "corejs": 3 + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-specific-targets/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-specific-targets/stdout.txt new file mode 100644 index 000000000000..e687ac4dbc31 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-specific-targets/stdout.txt @@ -0,0 +1,252 @@ +@babel/preset-env: `DEBUG` option + +Using targets: +{ + "chrome": "54", + "edge": "13", + "firefox": "49", + "ie": "10", + "ios": "9", + "safari": "7" +} + +Using modules transform: auto + +Using plugins: + proposal-nullish-coalescing-operator { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + proposal-optional-chaining { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + proposal-json-strings { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + proposal-optional-catch-binding { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + transform-parameters { "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + proposal-async-generator-functions { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + proposal-object-rest-spread { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + transform-dotall-regex { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + proposal-unicode-property-regex { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + transform-named-capturing-groups-regex { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + transform-async-to-generator { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + transform-exponentiation-operator { "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + transform-template-literals { "ie":"10", "ios":"9", "safari":"7" } + transform-literals { "firefox":"49", "ie":"10", "safari":"7" } + transform-function-name { "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + transform-arrow-functions { "ie":"10", "ios":"9", "safari":"7" } + transform-block-scoped-functions { "ie":"10", "ios":"9", "safari":"7" } + transform-classes { "ie":"10", "ios":"9", "safari":"7" } + transform-object-super { "ie":"10", "ios":"9", "safari":"7" } + transform-shorthand-properties { "ie":"10", "safari":"7" } + transform-duplicate-keys { "ie":"10", "safari":"7" } + transform-computed-properties { "ie":"10", "safari":"7" } + transform-for-of { "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + transform-sticky-regex { "ie":"10", "ios":"9", "safari":"7" } + transform-unicode-regex { "ie":"10", "ios":"9", "safari":"7" } + transform-spread { "ie":"10", "ios":"9", "safari":"7" } + transform-destructuring { "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + transform-block-scoping { "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + transform-typeof-symbol { "ie":"10", "safari":"7" } + transform-new-target { "edge":"13", "ie":"10", "ios":"9", "safari":"7" } + transform-regenerator { "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + transform-modules-commonjs { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + proposal-dynamic-import { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + +Using polyfills with `entry` option: + +[/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-specific-targets/input.mjs] Replaced core-js entries with the following polyfills: + es.symbol { "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + es.symbol.description { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + es.symbol.async-iterator { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + es.symbol.has-instance { "edge":"13", "ie":"10", "ios":"9", "safari":"7" } + es.symbol.is-concat-spreadable { "edge":"13", "ie":"10", "ios":"9", "safari":"7" } + es.symbol.iterator { "ie":"10", "safari":"7" } + es.symbol.match { "edge":"13", "ie":"10", "ios":"9", "safari":"7" } + es.symbol.replace { "edge":"13", "ie":"10", "ios":"9", "safari":"7" } + es.symbol.search { "edge":"13", "ie":"10", "ios":"9", "safari":"7" } + es.symbol.species { "ie":"10", "ios":"9", "safari":"7" } + es.symbol.split { "edge":"13", "ie":"10", "ios":"9", "safari":"7" } + es.symbol.to-primitive { "edge":"13", "ie":"10", "ios":"9", "safari":"7" } + es.symbol.to-string-tag { "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + es.symbol.unscopables { "ie":"10", "safari":"7" } + es.array.concat { "edge":"13", "ie":"10", "ios":"9", "safari":"7" } + es.array.copy-within { "ie":"10", "safari":"7" } + es.array.every { "edge":"13", "firefox":"49", "ie":"10", "safari":"7" } + es.array.fill { "ie":"10", "safari":"7" } + es.array.filter { "edge":"13", "ie":"10", "ios":"9", "safari":"7" } + es.array.find { "ie":"10", "safari":"7" } + es.array.find-index { "ie":"10", "safari":"7" } + es.array.flat { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + es.array.flat-map { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + es.array.for-each { "edge":"13", "firefox":"49", "ie":"10", "safari":"7" } + es.array.from { "edge":"13", "firefox":"49", "ie":"10", "safari":"7" } + es.array.includes { "edge":"13", "ie":"10", "ios":"9", "safari":"7" } + es.array.index-of { "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + es.array.iterator { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + es.array.join { "ie":"10", "safari":"7" } + es.array.last-index-of { "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + es.array.map { "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + es.array.of { "ie":"10", "safari":"7" } + es.array.reduce { "edge":"13", "firefox":"49", "ie":"10", "safari":"7" } + es.array.reduce-right { "edge":"13", "firefox":"49", "ie":"10", "safari":"7" } + es.array.reverse { "ios":"9", "safari":"7" } + es.array.slice { "edge":"13", "ie":"10", "ios":"9", "safari":"7" } + es.array.some { "edge":"13", "firefox":"49", "ie":"10", "safari":"7" } + es.array.sort { "chrome":"54", "ios":"9", "safari":"7" } + es.array.species { "ie":"10", "ios":"9", "safari":"7" } + es.array.splice { "edge":"13", "ie":"10", "ios":"9", "safari":"7" } + es.array.unscopables.flat { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + es.array.unscopables.flat-map { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + es.array-buffer.constructor { "edge":"13", "ie":"10", "ios":"9", "safari":"7" } + es.array-buffer.is-view { "ie":"10", "safari":"7" } + es.array-buffer.slice { "ie":"10", "ios":"9", "safari":"7" } + es.data-view { "safari":"7" } + es.date.to-iso-string { "safari":"7" } + es.date.to-json { "ios":"9", "safari":"7" } + es.date.to-primitive { "edge":"13", "ie":"10", "ios":"9", "safari":"7" } + es.function.has-instance { "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + es.function.name { "ie":"10" } + es.json.to-string-tag { "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + es.map { "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + es.math.acosh { "ie":"10", "safari":"7" } + es.math.asinh { "ie":"10", "safari":"7" } + es.math.atanh { "ie":"10", "safari":"7" } + es.math.cbrt { "ie":"10", "safari":"7" } + es.math.clz32 { "ie":"10", "safari":"7" } + es.math.cosh { "ie":"10", "safari":"7" } + es.math.expm1 { "ie":"10", "safari":"7" } + es.math.fround { "ie":"10", "safari":"7" } + es.math.hypot { "chrome":"54", "ie":"10", "safari":"7" } + es.math.imul { "ie":"10", "safari":"7" } + es.math.log10 { "ie":"10", "safari":"7" } + es.math.log1p { "ie":"10", "safari":"7" } + es.math.log2 { "ie":"10", "safari":"7" } + es.math.sign { "ie":"10", "safari":"7" } + es.math.sinh { "ie":"10", "safari":"7" } + es.math.tanh { "ie":"10", "safari":"7" } + es.math.to-string-tag { "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + es.math.trunc { "ie":"10", "safari":"7" } + es.number.constructor { "ie":"10", "safari":"7" } + es.number.epsilon { "ie":"10", "safari":"7" } + es.number.is-finite { "ie":"10", "safari":"7" } + es.number.is-integer { "ie":"10", "safari":"7" } + es.number.is-nan { "ie":"10", "safari":"7" } + es.number.is-safe-integer { "ie":"10", "safari":"7" } + es.number.max-safe-integer { "ie":"10", "safari":"7" } + es.number.min-safe-integer { "ie":"10", "safari":"7" } + es.number.parse-float { "ie":"10", "ios":"9", "safari":"7" } + es.number.parse-int { "ie":"10", "safari":"7" } + es.number.to-fixed { "edge":"13", "ie":"10", "safari":"7" } + es.number.to-precision { "safari":"7" } + es.object.assign { "edge":"13", "ie":"10", "safari":"7" } + es.object.define-getter { "chrome":"54", "edge":"13", "ie":"10", "safari":"7" } + es.object.define-setter { "chrome":"54", "edge":"13", "ie":"10", "safari":"7" } + es.object.entries { "edge":"13", "ie":"10", "ios":"9", "safari":"7" } + es.object.freeze { "ie":"10", "safari":"7" } + es.object.from-entries { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + es.object.get-own-property-descriptor { "ie":"10", "safari":"7" } + es.object.get-own-property-descriptors { "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + es.object.get-own-property-names { "ie":"10", "safari":"7" } + es.object.get-prototype-of { "ie":"10", "safari":"7" } + es.object.is { "ie":"10", "safari":"7" } + es.object.is-extensible { "ie":"10", "safari":"7" } + es.object.is-frozen { "ie":"10", "safari":"7" } + es.object.is-sealed { "ie":"10", "safari":"7" } + es.object.keys { "ie":"10", "safari":"7" } + es.object.lookup-getter { "chrome":"54", "edge":"13", "ie":"10", "safari":"7" } + es.object.lookup-setter { "chrome":"54", "edge":"13", "ie":"10", "safari":"7" } + es.object.prevent-extensions { "ie":"10", "safari":"7" } + es.object.seal { "ie":"10", "safari":"7" } + es.object.set-prototype-of { "ie":"10", "safari":"7" } + es.object.to-string { "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + es.object.values { "edge":"13", "ie":"10", "ios":"9", "safari":"7" } + es.parse-float { "safari":"7" } + es.parse-int { "safari":"7" } + es.promise { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + es.promise.finally { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + es.reflect.apply { "edge":"13", "ie":"10", "ios":"9", "safari":"7" } + es.reflect.construct { "edge":"13", "ie":"10", "ios":"9", "safari":"7" } + es.reflect.define-property { "ie":"10", "ios":"9", "safari":"7" } + es.reflect.delete-property { "ie":"10", "ios":"9", "safari":"7" } + es.reflect.get { "ie":"10", "ios":"9", "safari":"7" } + es.reflect.get-own-property-descriptor { "ie":"10", "ios":"9", "safari":"7" } + es.reflect.get-prototype-of { "ie":"10", "ios":"9", "safari":"7" } + es.reflect.has { "ie":"10", "ios":"9", "safari":"7" } + es.reflect.is-extensible { "ie":"10", "ios":"9", "safari":"7" } + es.reflect.own-keys { "ie":"10", "ios":"9", "safari":"7" } + es.reflect.prevent-extensions { "ie":"10", "ios":"9", "safari":"7" } + es.reflect.set { "edge":"13", "ie":"10", "ios":"9", "safari":"7" } + es.reflect.set-prototype-of { "ie":"10", "ios":"9", "safari":"7" } + es.regexp.constructor { "edge":"13", "ie":"10", "ios":"9", "safari":"7" } + es.regexp.exec { "ie":"10", "ios":"9", "safari":"7" } + es.regexp.flags { "edge":"13", "ie":"10", "safari":"7" } + es.regexp.to-string { "edge":"13", "ie":"10", "ios":"9", "safari":"7" } + es.set { "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + es.string.code-point-at { "ie":"10", "safari":"7" } + es.string.ends-with { "edge":"13", "ie":"10", "ios":"9", "safari":"7" } + es.string.from-code-point { "ie":"10", "safari":"7" } + es.string.includes { "edge":"13", "ie":"10", "ios":"9", "safari":"7" } + es.string.iterator { "ie":"10", "safari":"7" } + es.string.match { "edge":"13", "ie":"10", "ios":"9", "safari":"7" } + es.string.pad-end { "chrome":"54", "edge":"13", "ie":"10", "ios":"9", "safari":"7" } + es.string.pad-start { "chrome":"54", "edge":"13", "ie":"10", "ios":"9", "safari":"7" } + es.string.raw { "ie":"10", "safari":"7" } + es.string.repeat { "ie":"10", "safari":"7" } + es.string.replace { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + es.string.search { "edge":"13", "ie":"10", "ios":"9", "safari":"7" } + es.string.split { "edge":"13", "ie":"10", "ios":"9", "safari":"7" } + es.string.starts-with { "edge":"13", "ie":"10", "ios":"9", "safari":"7" } + es.string.trim { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + es.string.trim-end { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + es.string.trim-start { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + es.string.anchor { "ie":"10" } + es.string.big { "ie":"10" } + es.string.blink { "ie":"10" } + es.string.bold { "ie":"10" } + es.string.fixed { "ie":"10" } + es.string.fontcolor { "ie":"10" } + es.string.fontsize { "ie":"10" } + es.string.italics { "ie":"10" } + es.string.link { "ie":"10" } + es.string.small { "ie":"10" } + es.string.strike { "ie":"10" } + es.string.sub { "ie":"10" } + es.string.sup { "ie":"10" } + es.typed-array.float32-array { "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + es.typed-array.float64-array { "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + es.typed-array.int8-array { "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + es.typed-array.int16-array { "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + es.typed-array.int32-array { "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + es.typed-array.uint8-array { "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + es.typed-array.uint8-clamped-array { "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + es.typed-array.uint16-array { "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + es.typed-array.uint32-array { "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + es.typed-array.copy-within { "ie":"10", "ios":"9", "safari":"7" } + es.typed-array.every { "ie":"10", "ios":"9", "safari":"7" } + es.typed-array.fill { "ie":"10", "ios":"9", "safari":"7" } + es.typed-array.filter { "ie":"10", "ios":"9", "safari":"7" } + es.typed-array.find { "ie":"10", "ios":"9", "safari":"7" } + es.typed-array.find-index { "ie":"10", "ios":"9", "safari":"7" } + es.typed-array.for-each { "ie":"10", "ios":"9", "safari":"7" } + es.typed-array.from { "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + es.typed-array.includes { "edge":"13", "ie":"10", "ios":"9", "safari":"7" } + es.typed-array.index-of { "ie":"10", "ios":"9", "safari":"7" } + es.typed-array.iterator { "ie":"10", "ios":"9", "safari":"7" } + es.typed-array.join { "ie":"10", "ios":"9", "safari":"7" } + es.typed-array.last-index-of { "ie":"10", "ios":"9", "safari":"7" } + es.typed-array.map { "ie":"10", "ios":"9", "safari":"7" } + es.typed-array.of { "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + es.typed-array.reduce { "ie":"10", "ios":"9", "safari":"7" } + es.typed-array.reduce-right { "ie":"10", "ios":"9", "safari":"7" } + es.typed-array.reverse { "ie":"10", "ios":"9", "safari":"7" } + es.typed-array.set { "ie":"10", "safari":"7" } + es.typed-array.slice { "ie":"10", "ios":"9", "safari":"7" } + es.typed-array.some { "ie":"10", "ios":"9", "safari":"7" } + es.typed-array.sort { "ie":"10", "ios":"9", "safari":"7" } + es.typed-array.subarray { "ie":"10", "safari":"7" } + es.typed-array.to-locale-string { "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + es.typed-array.to-string { "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + es.weak-map { "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + es.weak-set { "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + web.dom-collections.for-each { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + web.dom-collections.iterator { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + web.immediate { "chrome":"54", "edge":"13", "firefox":"49", "ios":"9", "safari":"7" } + web.queue-microtask { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + web.url { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + web.url.to-json { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + web.url-search-params { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-stable-chrome-71/in/in.js b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-stable-chrome-71/input.mjs similarity index 100% rename from packages/babel-preset-env/test/debug-fixtures/entry-corejs3-stable-chrome-71/in/in.js rename to packages/babel-preset-env/test/fixtures/debug/entry-corejs3-stable-chrome-71/input.mjs diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-stable-chrome-71/options.json b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-stable-chrome-71/options.json new file mode 100644 index 000000000000..6e8f4a357b28 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-stable-chrome-71/options.json @@ -0,0 +1,18 @@ +{ + "validateLogs": true, + "ignoreOutput": true, + "presets": [ + [ + "env", + { + "debug": true, + "targets": { + "browsers": "chrome 71" + }, + "shippedProposals": true, + "useBuiltIns": "entry", + "corejs": 3 + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-stable-chrome-71/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-stable-chrome-71/stdout.txt new file mode 100644 index 000000000000..7e15258bac56 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-stable-chrome-71/stdout.txt @@ -0,0 +1,30 @@ +@babel/preset-env: `DEBUG` option + +Using targets: +{ + "chrome": "71" +} + +Using modules transform: auto + +Using plugins: + proposal-numeric-separator { "chrome":"71" } + proposal-nullish-coalescing-operator { "chrome":"71" } + proposal-optional-chaining { "chrome":"71" } + syntax-json-strings { "chrome":"71" } + syntax-optional-catch-binding { "chrome":"71" } + syntax-async-generators { "chrome":"71" } + syntax-object-rest-spread { "chrome":"71" } + transform-modules-commonjs { "chrome":"71" } + proposal-dynamic-import { "chrome":"71" } + +Using polyfills with `entry` option: + +[/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-stable-chrome-71/input.mjs] Replaced core-js entries with the following polyfills: + es.array.unscopables.flat { "chrome":"71" } + es.array.unscopables.flat-map { "chrome":"71" } + es.math.hypot { "chrome":"71" } + es.object.from-entries { "chrome":"71" } + web.immediate { "chrome":"71" } + +[/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-stable-chrome-71/input.mjs] Based on your targets, regenerator-runtime import excluded. diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-stable-samsung-8.2/in/in.js b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-stable-samsung-8.2/input.mjs similarity index 100% rename from packages/babel-preset-env/test/debug-fixtures/entry-corejs3-stable-samsung-8.2/in/in.js rename to packages/babel-preset-env/test/fixtures/debug/entry-corejs3-stable-samsung-8.2/input.mjs diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-stable-samsung-8.2/options.json b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-stable-samsung-8.2/options.json new file mode 100644 index 000000000000..016c09c862a2 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-stable-samsung-8.2/options.json @@ -0,0 +1,18 @@ +{ + "validateLogs": true, + "ignoreOutput": true, + "presets": [ + [ + "env", + { + "debug": true, + "targets": { + "browsers": "samsung 8.2" + }, + "shippedProposals": true, + "useBuiltIns": "entry", + "corejs": 3 + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-stable-samsung-8.2/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-stable-samsung-8.2/stdout.txt new file mode 100644 index 000000000000..5cb7061bf9e7 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-stable-samsung-8.2/stdout.txt @@ -0,0 +1,46 @@ +@babel/preset-env: `DEBUG` option + +Using targets: +{ + "samsung": "8.2" +} + +Using modules transform: auto + +Using plugins: + proposal-numeric-separator { "samsung":"8.2" } + proposal-nullish-coalescing-operator { "samsung":"8.2" } + proposal-optional-chaining { "samsung":"8.2" } + proposal-json-strings { "samsung":"8.2" } + proposal-optional-catch-binding { "samsung":"8.2" } + syntax-async-generators { "samsung":"8.2" } + syntax-object-rest-spread { "samsung":"8.2" } + proposal-unicode-property-regex { "samsung":"8.2" } + transform-named-capturing-groups-regex { "samsung":"8.2" } + transform-modules-commonjs { "samsung":"8.2" } + proposal-dynamic-import { "samsung":"8.2" } + +Using polyfills with `entry` option: + +[/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-stable-samsung-8.2/input.mjs] Replaced core-js entries with the following polyfills: + es.symbol.description { "samsung":"8.2" } + es.array.flat { "samsung":"8.2" } + es.array.flat-map { "samsung":"8.2" } + es.array.iterator { "samsung":"8.2" } + es.array.unscopables.flat { "samsung":"8.2" } + es.array.unscopables.flat-map { "samsung":"8.2" } + es.math.hypot { "samsung":"8.2" } + es.object.from-entries { "samsung":"8.2" } + es.promise { "samsung":"8.2" } + es.promise.finally { "samsung":"8.2" } + es.string.replace { "samsung":"8.2" } + es.string.trim-end { "samsung":"8.2" } + es.string.trim-start { "samsung":"8.2" } + web.dom-collections.iterator { "samsung":"8.2" } + web.immediate { "samsung":"8.2" } + web.queue-microtask { "samsung":"8.2" } + web.url { "samsung":"8.2" } + web.url.to-json { "samsung":"8.2" } + web.url-search-params { "samsung":"8.2" } + +[/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-stable-samsung-8.2/input.mjs] Based on your targets, regenerator-runtime import excluded. diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-stable/in/in.js b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-stable/input.mjs similarity index 100% rename from packages/babel-preset-env/test/debug-fixtures/entry-corejs3-stable/in/in.js rename to packages/babel-preset-env/test/fixtures/debug/entry-corejs3-stable/input.mjs diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-stable/options.json b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-stable/options.json new file mode 100644 index 000000000000..edf42df8057e --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-stable/options.json @@ -0,0 +1,15 @@ +{ + "validateLogs": true, + "ignoreOutput": true, + "presets": [ + [ + "env", + { + "debug": true, + "shippedProposals": true, + "useBuiltIns": "entry", + "corejs": 3 + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-stable/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-stable/stdout.txt new file mode 100644 index 000000000000..5c4d29fd8bb7 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-stable/stdout.txt @@ -0,0 +1,257 @@ +@babel/preset-env: `DEBUG` option + +Using targets: +{} + +Using modules transform: auto + +Using plugins: + proposal-numeric-separator {} + proposal-nullish-coalescing-operator {} + proposal-optional-chaining {} + proposal-json-strings {} + proposal-optional-catch-binding {} + transform-parameters {} + proposal-async-generator-functions {} + proposal-object-rest-spread {} + transform-dotall-regex {} + proposal-unicode-property-regex {} + transform-named-capturing-groups-regex {} + transform-async-to-generator {} + transform-exponentiation-operator {} + transform-template-literals {} + transform-literals {} + transform-function-name {} + transform-arrow-functions {} + transform-block-scoped-functions {} + transform-classes {} + transform-object-super {} + transform-shorthand-properties {} + transform-duplicate-keys {} + transform-computed-properties {} + transform-for-of {} + transform-sticky-regex {} + transform-unicode-regex {} + transform-spread {} + transform-destructuring {} + transform-block-scoping {} + transform-typeof-symbol {} + transform-new-target {} + transform-regenerator {} + transform-member-expression-literals {} + transform-property-literals {} + transform-reserved-words {} + transform-modules-commonjs {} + proposal-dynamic-import {} + +Using polyfills with `entry` option: + +[/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-stable/input.mjs] Replaced core-js entries with the following polyfills: + es.symbol {} + es.symbol.description {} + es.symbol.async-iterator {} + es.symbol.has-instance {} + es.symbol.is-concat-spreadable {} + es.symbol.iterator {} + es.symbol.match {} + es.symbol.replace {} + es.symbol.search {} + es.symbol.species {} + es.symbol.split {} + es.symbol.to-primitive {} + es.symbol.to-string-tag {} + es.symbol.unscopables {} + es.array.concat {} + es.array.copy-within {} + es.array.every {} + es.array.fill {} + es.array.filter {} + es.array.find {} + es.array.find-index {} + es.array.flat {} + es.array.flat-map {} + es.array.for-each {} + es.array.from {} + es.array.includes {} + es.array.index-of {} + es.array.is-array {} + es.array.iterator {} + es.array.join {} + es.array.last-index-of {} + es.array.map {} + es.array.of {} + es.array.reduce {} + es.array.reduce-right {} + es.array.reverse {} + es.array.slice {} + es.array.some {} + es.array.sort {} + es.array.species {} + es.array.splice {} + es.array.unscopables.flat {} + es.array.unscopables.flat-map {} + es.array-buffer.constructor {} + es.array-buffer.is-view {} + es.array-buffer.slice {} + es.data-view {} + es.date.now {} + es.date.to-iso-string {} + es.date.to-json {} + es.date.to-primitive {} + es.date.to-string {} + es.function.bind {} + es.function.has-instance {} + es.function.name {} + es.json.to-string-tag {} + es.map {} + es.math.acosh {} + es.math.asinh {} + es.math.atanh {} + es.math.cbrt {} + es.math.clz32 {} + es.math.cosh {} + es.math.expm1 {} + es.math.fround {} + es.math.hypot {} + es.math.imul {} + es.math.log10 {} + es.math.log1p {} + es.math.log2 {} + es.math.sign {} + es.math.sinh {} + es.math.tanh {} + es.math.to-string-tag {} + es.math.trunc {} + es.number.constructor {} + es.number.epsilon {} + es.number.is-finite {} + es.number.is-integer {} + es.number.is-nan {} + es.number.is-safe-integer {} + es.number.max-safe-integer {} + es.number.min-safe-integer {} + es.number.parse-float {} + es.number.parse-int {} + es.number.to-fixed {} + es.number.to-precision {} + es.object.assign {} + es.object.create {} + es.object.define-getter {} + es.object.define-properties {} + es.object.define-property {} + es.object.define-setter {} + es.object.entries {} + es.object.freeze {} + es.object.from-entries {} + es.object.get-own-property-descriptor {} + es.object.get-own-property-descriptors {} + es.object.get-own-property-names {} + es.object.get-prototype-of {} + es.object.is {} + es.object.is-extensible {} + es.object.is-frozen {} + es.object.is-sealed {} + es.object.keys {} + es.object.lookup-getter {} + es.object.lookup-setter {} + es.object.prevent-extensions {} + es.object.seal {} + es.object.set-prototype-of {} + es.object.to-string {} + es.object.values {} + es.parse-float {} + es.parse-int {} + es.promise {} + es.promise.finally {} + es.reflect.apply {} + es.reflect.construct {} + es.reflect.define-property {} + es.reflect.delete-property {} + es.reflect.get {} + es.reflect.get-own-property-descriptor {} + es.reflect.get-prototype-of {} + es.reflect.has {} + es.reflect.is-extensible {} + es.reflect.own-keys {} + es.reflect.prevent-extensions {} + es.reflect.set {} + es.reflect.set-prototype-of {} + es.regexp.constructor {} + es.regexp.exec {} + es.regexp.flags {} + es.regexp.to-string {} + es.set {} + es.string.code-point-at {} + es.string.ends-with {} + es.string.from-code-point {} + es.string.includes {} + es.string.iterator {} + es.string.match {} + es.string.pad-end {} + es.string.pad-start {} + es.string.raw {} + es.string.repeat {} + es.string.replace {} + es.string.search {} + es.string.split {} + es.string.starts-with {} + es.string.trim {} + es.string.trim-end {} + es.string.trim-start {} + es.string.anchor {} + es.string.big {} + es.string.blink {} + es.string.bold {} + es.string.fixed {} + es.string.fontcolor {} + es.string.fontsize {} + es.string.italics {} + es.string.link {} + es.string.small {} + es.string.strike {} + es.string.sub {} + es.string.sup {} + es.typed-array.float32-array {} + es.typed-array.float64-array {} + es.typed-array.int8-array {} + es.typed-array.int16-array {} + es.typed-array.int32-array {} + es.typed-array.uint8-array {} + es.typed-array.uint8-clamped-array {} + es.typed-array.uint16-array {} + es.typed-array.uint32-array {} + es.typed-array.copy-within {} + es.typed-array.every {} + es.typed-array.fill {} + es.typed-array.filter {} + es.typed-array.find {} + es.typed-array.find-index {} + es.typed-array.for-each {} + es.typed-array.from {} + es.typed-array.includes {} + es.typed-array.index-of {} + es.typed-array.iterator {} + es.typed-array.join {} + es.typed-array.last-index-of {} + es.typed-array.map {} + es.typed-array.of {} + es.typed-array.reduce {} + es.typed-array.reduce-right {} + es.typed-array.reverse {} + es.typed-array.set {} + es.typed-array.slice {} + es.typed-array.some {} + es.typed-array.sort {} + es.typed-array.subarray {} + es.typed-array.to-locale-string {} + es.typed-array.to-string {} + es.weak-map {} + es.weak-set {} + web.dom-collections.for-each {} + web.dom-collections.iterator {} + web.immediate {} + web.queue-microtask {} + web.timers {} + web.url {} + web.url.to-json {} + web.url-search-params {} diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-stage-chrome-71/in/in.js b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-stage-chrome-71/input.mjs similarity index 100% rename from packages/babel-preset-env/test/debug-fixtures/entry-corejs3-stage-chrome-71/in/in.js rename to packages/babel-preset-env/test/fixtures/debug/entry-corejs3-stage-chrome-71/input.mjs diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-stage-chrome-71/options.json b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-stage-chrome-71/options.json new file mode 100644 index 000000000000..6e8f4a357b28 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-stage-chrome-71/options.json @@ -0,0 +1,18 @@ +{ + "validateLogs": true, + "ignoreOutput": true, + "presets": [ + [ + "env", + { + "debug": true, + "targets": { + "browsers": "chrome 71" + }, + "shippedProposals": true, + "useBuiltIns": "entry", + "corejs": 3 + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-stage-chrome-71/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-stage-chrome-71/stdout.txt new file mode 100644 index 000000000000..80baff5d5173 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-stage-chrome-71/stdout.txt @@ -0,0 +1,106 @@ +@babel/preset-env: `DEBUG` option + +Using targets: +{ + "chrome": "71" +} + +Using modules transform: auto + +Using plugins: + proposal-numeric-separator { "chrome":"71" } + proposal-nullish-coalescing-operator { "chrome":"71" } + proposal-optional-chaining { "chrome":"71" } + syntax-json-strings { "chrome":"71" } + syntax-optional-catch-binding { "chrome":"71" } + syntax-async-generators { "chrome":"71" } + syntax-object-rest-spread { "chrome":"71" } + transform-modules-commonjs { "chrome":"71" } + proposal-dynamic-import { "chrome":"71" } + +Using polyfills with `entry` option: + +[/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-stage-chrome-71/input.mjs] Replaced core-js entries with the following polyfills: + esnext.aggregate-error { "chrome":"71" } + esnext.array.last-index { "chrome":"71" } + esnext.array.last-item { "chrome":"71" } + esnext.composite-key { "chrome":"71" } + esnext.composite-symbol { "chrome":"71" } + esnext.map.delete-all { "chrome":"71" } + esnext.map.every { "chrome":"71" } + esnext.map.filter { "chrome":"71" } + esnext.map.find { "chrome":"71" } + esnext.map.find-key { "chrome":"71" } + esnext.map.from { "chrome":"71" } + esnext.map.group-by { "chrome":"71" } + esnext.map.includes { "chrome":"71" } + esnext.map.key-by { "chrome":"71" } + esnext.map.key-of { "chrome":"71" } + esnext.map.map-keys { "chrome":"71" } + esnext.map.map-values { "chrome":"71" } + esnext.map.merge { "chrome":"71" } + esnext.map.of { "chrome":"71" } + esnext.map.reduce { "chrome":"71" } + esnext.map.some { "chrome":"71" } + esnext.map.update { "chrome":"71" } + esnext.math.clamp { "chrome":"71" } + esnext.math.deg-per-rad { "chrome":"71" } + esnext.math.degrees { "chrome":"71" } + esnext.math.fscale { "chrome":"71" } + esnext.math.iaddh { "chrome":"71" } + esnext.math.imulh { "chrome":"71" } + esnext.math.isubh { "chrome":"71" } + esnext.math.rad-per-deg { "chrome":"71" } + esnext.math.radians { "chrome":"71" } + esnext.math.scale { "chrome":"71" } + esnext.math.seeded-prng { "chrome":"71" } + esnext.math.signbit { "chrome":"71" } + esnext.math.umulh { "chrome":"71" } + esnext.number.from-string { "chrome":"71" } + esnext.observable { "chrome":"71" } + esnext.promise.all-settled { "chrome":"71" } + esnext.promise.any { "chrome":"71" } + esnext.promise.try { "chrome":"71" } + esnext.reflect.define-metadata { "chrome":"71" } + esnext.reflect.delete-metadata { "chrome":"71" } + esnext.reflect.get-metadata { "chrome":"71" } + esnext.reflect.get-metadata-keys { "chrome":"71" } + esnext.reflect.get-own-metadata { "chrome":"71" } + esnext.reflect.get-own-metadata-keys { "chrome":"71" } + esnext.reflect.has-metadata { "chrome":"71" } + esnext.reflect.has-own-metadata { "chrome":"71" } + esnext.reflect.metadata { "chrome":"71" } + esnext.set.add-all { "chrome":"71" } + esnext.set.delete-all { "chrome":"71" } + esnext.set.difference { "chrome":"71" } + esnext.set.every { "chrome":"71" } + esnext.set.filter { "chrome":"71" } + esnext.set.find { "chrome":"71" } + esnext.set.from { "chrome":"71" } + esnext.set.intersection { "chrome":"71" } + esnext.set.is-disjoint-from { "chrome":"71" } + esnext.set.is-subset-of { "chrome":"71" } + esnext.set.is-superset-of { "chrome":"71" } + esnext.set.join { "chrome":"71" } + esnext.set.map { "chrome":"71" } + esnext.set.of { "chrome":"71" } + esnext.set.reduce { "chrome":"71" } + esnext.set.some { "chrome":"71" } + esnext.set.symmetric-difference { "chrome":"71" } + esnext.set.union { "chrome":"71" } + esnext.string.at { "chrome":"71" } + esnext.string.code-points { "chrome":"71" } + esnext.string.match-all { "chrome":"71" } + esnext.string.replace-all { "chrome":"71" } + esnext.symbol.dispose { "chrome":"71" } + esnext.symbol.observable { "chrome":"71" } + esnext.symbol.pattern-match { "chrome":"71" } + esnext.weak-map.delete-all { "chrome":"71" } + esnext.weak-map.from { "chrome":"71" } + esnext.weak-map.of { "chrome":"71" } + esnext.weak-set.add-all { "chrome":"71" } + esnext.weak-set.delete-all { "chrome":"71" } + esnext.weak-set.from { "chrome":"71" } + esnext.weak-set.of { "chrome":"71" } + +[/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-stage-chrome-71/input.mjs] Based on your targets, regenerator-runtime import excluded. diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-stage/in/in.js b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-stage/input.mjs similarity index 100% rename from packages/babel-preset-env/test/debug-fixtures/entry-corejs3-stage/in/in.js rename to packages/babel-preset-env/test/fixtures/debug/entry-corejs3-stage/input.mjs diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-stage/options.json b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-stage/options.json new file mode 100644 index 000000000000..edf42df8057e --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-stage/options.json @@ -0,0 +1,15 @@ +{ + "validateLogs": true, + "ignoreOutput": true, + "presets": [ + [ + "env", + { + "debug": true, + "shippedProposals": true, + "useBuiltIns": "entry", + "corejs": 3 + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-stage/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-stage/stdout.txt new file mode 100644 index 000000000000..7ccc0e599efb --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-stage/stdout.txt @@ -0,0 +1,134 @@ +@babel/preset-env: `DEBUG` option + +Using targets: +{} + +Using modules transform: auto + +Using plugins: + proposal-numeric-separator {} + proposal-nullish-coalescing-operator {} + proposal-optional-chaining {} + proposal-json-strings {} + proposal-optional-catch-binding {} + transform-parameters {} + proposal-async-generator-functions {} + proposal-object-rest-spread {} + transform-dotall-regex {} + proposal-unicode-property-regex {} + transform-named-capturing-groups-regex {} + transform-async-to-generator {} + transform-exponentiation-operator {} + transform-template-literals {} + transform-literals {} + transform-function-name {} + transform-arrow-functions {} + transform-block-scoped-functions {} + transform-classes {} + transform-object-super {} + transform-shorthand-properties {} + transform-duplicate-keys {} + transform-computed-properties {} + transform-for-of {} + transform-sticky-regex {} + transform-unicode-regex {} + transform-spread {} + transform-destructuring {} + transform-block-scoping {} + transform-typeof-symbol {} + transform-new-target {} + transform-regenerator {} + transform-member-expression-literals {} + transform-property-literals {} + transform-reserved-words {} + transform-modules-commonjs {} + proposal-dynamic-import {} + +Using polyfills with `entry` option: + +[/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-stage/input.mjs] Replaced core-js entries with the following polyfills: + esnext.aggregate-error {} + esnext.array.last-index {} + esnext.array.last-item {} + esnext.composite-key {} + esnext.composite-symbol {} + esnext.global-this {} + esnext.map.delete-all {} + esnext.map.every {} + esnext.map.filter {} + esnext.map.find {} + esnext.map.find-key {} + esnext.map.from {} + esnext.map.group-by {} + esnext.map.includes {} + esnext.map.key-by {} + esnext.map.key-of {} + esnext.map.map-keys {} + esnext.map.map-values {} + esnext.map.merge {} + esnext.map.of {} + esnext.map.reduce {} + esnext.map.some {} + esnext.map.update {} + esnext.math.clamp {} + esnext.math.deg-per-rad {} + esnext.math.degrees {} + esnext.math.fscale {} + esnext.math.iaddh {} + esnext.math.imulh {} + esnext.math.isubh {} + esnext.math.rad-per-deg {} + esnext.math.radians {} + esnext.math.scale {} + esnext.math.seeded-prng {} + esnext.math.signbit {} + esnext.math.umulh {} + esnext.number.from-string {} + esnext.observable {} + esnext.promise.all-settled {} + esnext.promise.any {} + esnext.promise.try {} + esnext.reflect.define-metadata {} + esnext.reflect.delete-metadata {} + esnext.reflect.get-metadata {} + esnext.reflect.get-metadata-keys {} + esnext.reflect.get-own-metadata {} + esnext.reflect.get-own-metadata-keys {} + esnext.reflect.has-metadata {} + esnext.reflect.has-own-metadata {} + esnext.reflect.metadata {} + esnext.set.add-all {} + esnext.set.delete-all {} + esnext.set.difference {} + esnext.set.every {} + esnext.set.filter {} + esnext.set.find {} + esnext.set.from {} + esnext.set.intersection {} + esnext.set.is-disjoint-from {} + esnext.set.is-subset-of {} + esnext.set.is-superset-of {} + esnext.set.join {} + esnext.set.map {} + esnext.set.of {} + esnext.set.reduce {} + esnext.set.some {} + esnext.set.symmetric-difference {} + esnext.set.union {} + esnext.string.at {} + esnext.string.code-points {} + esnext.string.match-all {} + esnext.string.replace-all {} + esnext.symbol.dispose {} + esnext.symbol.observable {} + esnext.symbol.pattern-match {} + esnext.weak-map.delete-all {} + esnext.weak-map.from {} + esnext.weak-map.of {} + esnext.weak-set.add-all {} + esnext.weak-set.delete-all {} + esnext.weak-set.from {} + esnext.weak-set.of {} + web.url {} + web.url.to-json {} + web.url-search-params {} diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-versions-decimals/in/in.js b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-versions-decimals/input.mjs similarity index 100% rename from packages/babel-preset-env/test/debug-fixtures/entry-corejs3-versions-decimals/in/in.js rename to packages/babel-preset-env/test/fixtures/debug/entry-corejs3-versions-decimals/input.mjs diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-versions-decimals/options.json b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-versions-decimals/options.json new file mode 100644 index 000000000000..7b937537dd8c --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-versions-decimals/options.json @@ -0,0 +1,20 @@ +{ + "validateLogs": true, + "ignoreOutput": true, + "presets": [ + [ + "env", + { + "useBuiltIns": "entry", + "corejs": 3, + "debug": true, + "targets": { + "chrome": 54, + "electron": 0.36, + "node": 6.1, + "ie": 10 + } + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-versions-decimals/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-versions-decimals/stdout.txt new file mode 100644 index 000000000000..d54a72009d03 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-versions-decimals/stdout.txt @@ -0,0 +1,251 @@ +Warning, the following targets are using a decimal version: + + electron: 0.36 + node: 6.1 + +We recommend using a string for minor/patch versions to avoid numbers like 6.10 +getting parsed as 6.1, which can lead to unexpected behavior. + +@babel/preset-env: `DEBUG` option + +Using targets: +{ + "chrome": "54", + "electron": "0.36", + "ie": "10", + "node": "6.1" +} + +Using modules transform: auto + +Using plugins: + proposal-nullish-coalescing-operator { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } + proposal-optional-chaining { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } + proposal-json-strings { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } + proposal-optional-catch-binding { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } + transform-parameters { "electron":"0.36", "ie":"10" } + proposal-async-generator-functions { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } + proposal-object-rest-spread { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } + transform-dotall-regex { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } + proposal-unicode-property-regex { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } + transform-named-capturing-groups-regex { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } + transform-async-to-generator { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } + transform-exponentiation-operator { "electron":"0.36", "ie":"10", "node":"6.1" } + transform-template-literals { "ie":"10" } + transform-literals { "ie":"10" } + transform-function-name { "electron":"0.36", "ie":"10", "node":"6.1" } + transform-arrow-functions { "ie":"10" } + transform-block-scoped-functions { "ie":"10" } + transform-classes { "ie":"10" } + transform-object-super { "ie":"10" } + transform-shorthand-properties { "ie":"10" } + transform-duplicate-keys { "ie":"10" } + transform-computed-properties { "ie":"10" } + transform-for-of { "electron":"0.36", "ie":"10", "node":"6.1" } + transform-sticky-regex { "electron":"0.36", "ie":"10" } + transform-unicode-regex { "electron":"0.36", "ie":"10" } + transform-spread { "ie":"10" } + transform-destructuring { "electron":"0.36", "ie":"10", "node":"6.1" } + transform-block-scoping { "electron":"0.36", "ie":"10" } + transform-typeof-symbol { "ie":"10" } + transform-new-target { "ie":"10" } + transform-regenerator { "electron":"0.36", "ie":"10" } + transform-modules-commonjs { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } + proposal-dynamic-import { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } + +Using polyfills with `entry` option: + +[/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-versions-decimals/input.mjs] Replaced core-js entries with the following polyfills: + es.symbol { "electron":"0.36", "ie":"10" } + es.symbol.description { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } + es.symbol.async-iterator { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } + es.symbol.has-instance { "electron":"0.36", "ie":"10" } + es.symbol.is-concat-spreadable { "electron":"0.36", "ie":"10" } + es.symbol.iterator { "ie":"10" } + es.symbol.match { "electron":"0.36", "ie":"10" } + es.symbol.replace { "electron":"0.36", "ie":"10" } + es.symbol.search { "electron":"0.36", "ie":"10" } + es.symbol.species { "electron":"0.36", "ie":"10", "node":"6.1" } + es.symbol.split { "electron":"0.36", "ie":"10" } + es.symbol.to-primitive { "ie":"10" } + es.symbol.to-string-tag { "electron":"0.36", "ie":"10" } + es.symbol.unscopables { "ie":"10" } + es.array.concat { "electron":"0.36", "ie":"10", "node":"6.1" } + es.array.copy-within { "ie":"10" } + es.array.every { "electron":"0.36", "ie":"10" } + es.array.fill { "ie":"10" } + es.array.filter { "electron":"0.36", "ie":"10", "node":"6.1" } + es.array.find { "ie":"10" } + es.array.find-index { "ie":"10" } + es.array.flat { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } + es.array.flat-map { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } + es.array.for-each { "electron":"0.36", "ie":"10" } + es.array.from { "electron":"0.36", "ie":"10", "node":"6.1" } + es.array.includes { "electron":"0.36", "ie":"10", "node":"6.1" } + es.array.index-of { "electron":"0.36", "ie":"10", "node":"6.1" } + es.array.iterator { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } + es.array.join { "ie":"10" } + es.array.last-index-of { "electron":"0.36", "ie":"10", "node":"6.1" } + es.array.map { "electron":"0.36", "ie":"10", "node":"6.1" } + es.array.of { "ie":"10" } + es.array.reduce { "electron":"0.36", "ie":"10" } + es.array.reduce-right { "electron":"0.36", "ie":"10" } + es.array.slice { "electron":"0.36", "ie":"10", "node":"6.1" } + es.array.some { "electron":"0.36", "ie":"10" } + es.array.sort { "chrome":"54", "electron":"0.36", "node":"6.1" } + es.array.species { "electron":"0.36", "ie":"10", "node":"6.1" } + es.array.splice { "electron":"0.36", "ie":"10", "node":"6.1" } + es.array.unscopables.flat { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } + es.array.unscopables.flat-map { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } + es.array-buffer.constructor { "ie":"10" } + es.array-buffer.is-view { "ie":"10" } + es.array-buffer.slice { "ie":"10" } + es.date.to-primitive { "ie":"10" } + es.function.has-instance { "electron":"0.36", "ie":"10", "node":"6.1" } + es.function.name { "ie":"10" } + es.json.to-string-tag { "electron":"0.36", "ie":"10" } + es.map { "electron":"0.36", "ie":"10", "node":"6.1" } + es.math.acosh { "electron":"0.36", "ie":"10", "node":"6.1" } + es.math.asinh { "ie":"10" } + es.math.atanh { "ie":"10" } + es.math.cbrt { "ie":"10" } + es.math.clz32 { "ie":"10" } + es.math.cosh { "ie":"10" } + es.math.expm1 { "ie":"10" } + es.math.fround { "ie":"10" } + es.math.hypot { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } + es.math.imul { "ie":"10" } + es.math.log10 { "ie":"10" } + es.math.log1p { "ie":"10" } + es.math.log2 { "ie":"10" } + es.math.sign { "ie":"10" } + es.math.sinh { "ie":"10" } + es.math.tanh { "ie":"10" } + es.math.to-string-tag { "electron":"0.36", "ie":"10" } + es.math.trunc { "ie":"10" } + es.number.constructor { "ie":"10" } + es.number.epsilon { "ie":"10" } + es.number.is-finite { "ie":"10" } + es.number.is-integer { "ie":"10" } + es.number.is-nan { "ie":"10" } + es.number.is-safe-integer { "ie":"10" } + es.number.max-safe-integer { "ie":"10" } + es.number.min-safe-integer { "ie":"10" } + es.number.parse-float { "ie":"10" } + es.number.parse-int { "ie":"10" } + es.number.to-fixed { "ie":"10" } + es.object.assign { "electron":"0.36", "ie":"10" } + es.object.define-getter { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } + es.object.define-setter { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } + es.object.entries { "electron":"0.36", "ie":"10", "node":"6.1" } + es.object.freeze { "ie":"10" } + es.object.from-entries { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } + es.object.get-own-property-descriptor { "ie":"10" } + es.object.get-own-property-descriptors { "electron":"0.36", "ie":"10", "node":"6.1" } + es.object.get-own-property-names { "ie":"10" } + es.object.get-prototype-of { "ie":"10" } + es.object.is { "ie":"10" } + es.object.is-extensible { "ie":"10" } + es.object.is-frozen { "ie":"10" } + es.object.is-sealed { "ie":"10" } + es.object.keys { "ie":"10" } + es.object.lookup-getter { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } + es.object.lookup-setter { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } + es.object.prevent-extensions { "ie":"10" } + es.object.seal { "ie":"10" } + es.object.set-prototype-of { "ie":"10" } + es.object.to-string { "electron":"0.36", "ie":"10" } + es.object.values { "electron":"0.36", "ie":"10", "node":"6.1" } + es.promise { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } + es.promise.finally { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } + es.reflect.apply { "electron":"0.36", "ie":"10" } + es.reflect.construct { "electron":"0.36", "ie":"10" } + es.reflect.define-property { "electron":"0.36", "ie":"10" } + es.reflect.delete-property { "electron":"0.36", "ie":"10" } + es.reflect.get { "electron":"0.36", "ie":"10" } + es.reflect.get-own-property-descriptor { "electron":"0.36", "ie":"10" } + es.reflect.get-prototype-of { "electron":"0.36", "ie":"10" } + es.reflect.has { "electron":"0.36", "ie":"10" } + es.reflect.is-extensible { "electron":"0.36", "ie":"10" } + es.reflect.own-keys { "electron":"0.36", "ie":"10" } + es.reflect.prevent-extensions { "electron":"0.36", "ie":"10" } + es.reflect.set { "electron":"0.36", "ie":"10" } + es.reflect.set-prototype-of { "electron":"0.36", "ie":"10" } + es.regexp.constructor { "electron":"0.36", "ie":"10", "node":"6.1" } + es.regexp.exec { "ie":"10" } + es.regexp.flags { "electron":"0.36", "ie":"10" } + es.regexp.to-string { "electron":"0.36", "ie":"10" } + es.set { "electron":"0.36", "ie":"10", "node":"6.1" } + es.string.code-point-at { "ie":"10" } + es.string.ends-with { "electron":"0.36", "ie":"10", "node":"6.1" } + es.string.from-code-point { "ie":"10" } + es.string.includes { "electron":"0.36", "ie":"10", "node":"6.1" } + es.string.iterator { "ie":"10" } + es.string.match { "electron":"0.36", "ie":"10", "node":"6.1" } + es.string.pad-end { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } + es.string.pad-start { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } + es.string.raw { "ie":"10" } + es.string.repeat { "ie":"10" } + es.string.replace { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } + es.string.search { "electron":"0.36", "ie":"10", "node":"6.1" } + es.string.split { "electron":"0.36", "ie":"10", "node":"6.1" } + es.string.starts-with { "electron":"0.36", "ie":"10", "node":"6.1" } + es.string.trim { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } + es.string.trim-end { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } + es.string.trim-start { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } + es.string.anchor { "ie":"10" } + es.string.big { "ie":"10" } + es.string.blink { "ie":"10" } + es.string.bold { "ie":"10" } + es.string.fixed { "ie":"10" } + es.string.fontcolor { "ie":"10" } + es.string.fontsize { "ie":"10" } + es.string.italics { "ie":"10" } + es.string.link { "ie":"10" } + es.string.small { "ie":"10" } + es.string.strike { "ie":"10" } + es.string.sub { "ie":"10" } + es.string.sup { "ie":"10" } + es.typed-array.float32-array { "electron":"0.36", "ie":"10", "node":"6.1" } + es.typed-array.float64-array { "electron":"0.36", "ie":"10", "node":"6.1" } + es.typed-array.int8-array { "electron":"0.36", "ie":"10", "node":"6.1" } + es.typed-array.int16-array { "electron":"0.36", "ie":"10", "node":"6.1" } + es.typed-array.int32-array { "electron":"0.36", "ie":"10", "node":"6.1" } + es.typed-array.uint8-array { "electron":"0.36", "ie":"10", "node":"6.1" } + es.typed-array.uint8-clamped-array { "electron":"0.36", "ie":"10", "node":"6.1" } + es.typed-array.uint16-array { "electron":"0.36", "ie":"10", "node":"6.1" } + es.typed-array.uint32-array { "electron":"0.36", "ie":"10", "node":"6.1" } + es.typed-array.copy-within { "ie":"10" } + es.typed-array.every { "ie":"10" } + es.typed-array.fill { "ie":"10" } + es.typed-array.filter { "ie":"10" } + es.typed-array.find { "ie":"10" } + es.typed-array.find-index { "ie":"10" } + es.typed-array.for-each { "ie":"10" } + es.typed-array.from { "electron":"0.36", "ie":"10", "node":"6.1" } + es.typed-array.includes { "electron":"0.36", "ie":"10" } + es.typed-array.index-of { "ie":"10" } + es.typed-array.iterator { "ie":"10" } + es.typed-array.join { "ie":"10" } + es.typed-array.last-index-of { "ie":"10" } + es.typed-array.map { "ie":"10" } + es.typed-array.of { "electron":"0.36", "ie":"10", "node":"6.1" } + es.typed-array.reduce { "ie":"10" } + es.typed-array.reduce-right { "ie":"10" } + es.typed-array.reverse { "ie":"10" } + es.typed-array.set { "ie":"10" } + es.typed-array.slice { "ie":"10" } + es.typed-array.some { "ie":"10" } + es.typed-array.sort { "ie":"10" } + es.typed-array.subarray { "ie":"10" } + es.typed-array.to-locale-string { "ie":"10" } + es.typed-array.to-string { "electron":"0.36", "ie":"10", "node":"6.1" } + es.weak-map { "electron":"0.36", "ie":"10", "node":"6.1" } + es.weak-set { "electron":"0.36", "ie":"10", "node":"6.1" } + web.dom-collections.for-each { "chrome":"54", "electron":"0.36", "ie":"10" } + web.dom-collections.iterator { "chrome":"54", "electron":"0.36", "ie":"10" } + web.immediate { "chrome":"54", "electron":"0.36" } + web.queue-microtask { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } + web.url { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } + web.url.to-json { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } + web.url-search-params { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-versions-strings-minor-3.0/in/in.js b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-versions-strings-minor-3.0/input.mjs similarity index 100% rename from packages/babel-preset-env/test/debug-fixtures/entry-corejs3-versions-strings-minor-3.0/in/in.js rename to packages/babel-preset-env/test/fixtures/debug/entry-corejs3-versions-strings-minor-3.0/input.mjs diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-versions-strings-minor-3.0/options.json b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-versions-strings-minor-3.0/options.json new file mode 100644 index 000000000000..e3f89d06a7a3 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-versions-strings-minor-3.0/options.json @@ -0,0 +1,19 @@ +{ + "validateLogs": true, + "ignoreOutput": true, + "presets": [ + [ + "env", + { + "useBuiltIns": "entry", + "corejs": "3.0", + "debug": true, + "targets": { + "chrome": "54", + "node": "6.10", + "ie": "10" + } + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-versions-strings-minor-3.0/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-versions-strings-minor-3.0/stdout.txt new file mode 100644 index 000000000000..5c51854907ad --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-versions-strings-minor-3.0/stdout.txt @@ -0,0 +1,242 @@ +@babel/preset-env: `DEBUG` option + +Using targets: +{ + "chrome": "54", + "ie": "10", + "node": "6.10" +} + +Using modules transform: auto + +Using plugins: + proposal-nullish-coalescing-operator { "chrome":"54", "ie":"10", "node":"6.10" } + proposal-optional-chaining { "chrome":"54", "ie":"10", "node":"6.10" } + proposal-json-strings { "chrome":"54", "ie":"10", "node":"6.10" } + proposal-optional-catch-binding { "chrome":"54", "ie":"10", "node":"6.10" } + transform-parameters { "ie":"10" } + proposal-async-generator-functions { "chrome":"54", "ie":"10", "node":"6.10" } + proposal-object-rest-spread { "chrome":"54", "ie":"10", "node":"6.10" } + transform-dotall-regex { "chrome":"54", "ie":"10", "node":"6.10" } + proposal-unicode-property-regex { "chrome":"54", "ie":"10", "node":"6.10" } + transform-named-capturing-groups-regex { "chrome":"54", "ie":"10", "node":"6.10" } + transform-async-to-generator { "chrome":"54", "ie":"10", "node":"6.10" } + transform-exponentiation-operator { "ie":"10", "node":"6.10" } + transform-template-literals { "ie":"10" } + transform-literals { "ie":"10" } + transform-function-name { "ie":"10" } + transform-arrow-functions { "ie":"10" } + transform-block-scoped-functions { "ie":"10" } + transform-classes { "ie":"10" } + transform-object-super { "ie":"10" } + transform-shorthand-properties { "ie":"10" } + transform-duplicate-keys { "ie":"10" } + transform-computed-properties { "ie":"10" } + transform-for-of { "ie":"10" } + transform-sticky-regex { "ie":"10" } + transform-unicode-regex { "ie":"10" } + transform-spread { "ie":"10" } + transform-destructuring { "ie":"10" } + transform-block-scoping { "ie":"10" } + transform-typeof-symbol { "ie":"10" } + transform-new-target { "ie":"10" } + transform-regenerator { "ie":"10" } + transform-modules-commonjs { "chrome":"54", "ie":"10", "node":"6.10" } + proposal-dynamic-import { "chrome":"54", "ie":"10", "node":"6.10" } + +Using polyfills with `entry` option: + +[/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-versions-strings-minor-3.0/input.mjs] Replaced core-js entries with the following polyfills: + es.symbol { "ie":"10" } + es.symbol.description { "chrome":"54", "ie":"10", "node":"6.10" } + es.symbol.async-iterator { "chrome":"54", "ie":"10", "node":"6.10" } + es.symbol.has-instance { "ie":"10" } + es.symbol.is-concat-spreadable { "ie":"10" } + es.symbol.iterator { "ie":"10" } + es.symbol.match { "ie":"10" } + es.symbol.replace { "ie":"10" } + es.symbol.search { "ie":"10" } + es.symbol.species { "ie":"10" } + es.symbol.split { "ie":"10" } + es.symbol.to-primitive { "ie":"10" } + es.symbol.to-string-tag { "ie":"10" } + es.symbol.unscopables { "ie":"10" } + es.array.concat { "ie":"10" } + es.array.copy-within { "ie":"10" } + es.array.every { "ie":"10" } + es.array.fill { "ie":"10" } + es.array.filter { "ie":"10" } + es.array.find { "ie":"10" } + es.array.find-index { "ie":"10" } + es.array.flat { "chrome":"54", "ie":"10", "node":"6.10" } + es.array.flat-map { "chrome":"54", "ie":"10", "node":"6.10" } + es.array.for-each { "ie":"10" } + es.array.from { "ie":"10" } + es.array.includes { "ie":"10", "node":"6.10" } + es.array.index-of { "ie":"10" } + es.array.iterator { "chrome":"54", "ie":"10", "node":"6.10" } + es.array.join { "ie":"10" } + es.array.last-index-of { "ie":"10" } + es.array.map { "ie":"10" } + es.array.of { "ie":"10" } + es.array.reduce { "ie":"10" } + es.array.reduce-right { "ie":"10" } + es.array.slice { "ie":"10" } + es.array.some { "ie":"10" } + es.array.sort { "chrome":"54", "node":"6.10" } + es.array.species { "ie":"10" } + es.array.splice { "ie":"10" } + es.array.unscopables.flat { "chrome":"54", "ie":"10", "node":"6.10" } + es.array.unscopables.flat-map { "chrome":"54", "ie":"10", "node":"6.10" } + es.array-buffer.constructor { "ie":"10" } + es.array-buffer.is-view { "ie":"10" } + es.array-buffer.slice { "ie":"10" } + es.date.to-primitive { "ie":"10" } + es.function.has-instance { "ie":"10" } + es.function.name { "ie":"10" } + es.json.to-string-tag { "ie":"10" } + es.map { "ie":"10" } + es.math.acosh { "ie":"10", "node":"6.10" } + es.math.asinh { "ie":"10" } + es.math.atanh { "ie":"10" } + es.math.cbrt { "ie":"10" } + es.math.clz32 { "ie":"10" } + es.math.cosh { "ie":"10" } + es.math.expm1 { "ie":"10" } + es.math.fround { "ie":"10" } + es.math.hypot { "chrome":"54", "ie":"10", "node":"6.10" } + es.math.imul { "ie":"10" } + es.math.log10 { "ie":"10" } + es.math.log1p { "ie":"10" } + es.math.log2 { "ie":"10" } + es.math.sign { "ie":"10" } + es.math.sinh { "ie":"10" } + es.math.tanh { "ie":"10" } + es.math.to-string-tag { "ie":"10" } + es.math.trunc { "ie":"10" } + es.number.constructor { "ie":"10" } + es.number.epsilon { "ie":"10" } + es.number.is-finite { "ie":"10" } + es.number.is-integer { "ie":"10" } + es.number.is-nan { "ie":"10" } + es.number.is-safe-integer { "ie":"10" } + es.number.max-safe-integer { "ie":"10" } + es.number.min-safe-integer { "ie":"10" } + es.number.parse-float { "ie":"10" } + es.number.parse-int { "ie":"10" } + es.number.to-fixed { "ie":"10" } + es.object.assign { "ie":"10" } + es.object.define-getter { "chrome":"54", "ie":"10", "node":"6.10" } + es.object.define-setter { "chrome":"54", "ie":"10", "node":"6.10" } + es.object.entries { "ie":"10", "node":"6.10" } + es.object.freeze { "ie":"10" } + es.object.from-entries { "chrome":"54", "ie":"10", "node":"6.10" } + es.object.get-own-property-descriptor { "ie":"10" } + es.object.get-own-property-descriptors { "ie":"10", "node":"6.10" } + es.object.get-own-property-names { "ie":"10" } + es.object.get-prototype-of { "ie":"10" } + es.object.is { "ie":"10" } + es.object.is-extensible { "ie":"10" } + es.object.is-frozen { "ie":"10" } + es.object.is-sealed { "ie":"10" } + es.object.keys { "ie":"10" } + es.object.lookup-getter { "chrome":"54", "ie":"10", "node":"6.10" } + es.object.lookup-setter { "chrome":"54", "ie":"10", "node":"6.10" } + es.object.prevent-extensions { "ie":"10" } + es.object.seal { "ie":"10" } + es.object.set-prototype-of { "ie":"10" } + es.object.to-string { "ie":"10" } + es.object.values { "ie":"10", "node":"6.10" } + es.promise { "chrome":"54", "ie":"10", "node":"6.10" } + es.promise.finally { "chrome":"54", "ie":"10", "node":"6.10" } + es.reflect.apply { "ie":"10" } + es.reflect.construct { "ie":"10" } + es.reflect.define-property { "ie":"10" } + es.reflect.delete-property { "ie":"10" } + es.reflect.get { "ie":"10" } + es.reflect.get-own-property-descriptor { "ie":"10" } + es.reflect.get-prototype-of { "ie":"10" } + es.reflect.has { "ie":"10" } + es.reflect.is-extensible { "ie":"10" } + es.reflect.own-keys { "ie":"10" } + es.reflect.prevent-extensions { "ie":"10" } + es.reflect.set { "ie":"10" } + es.reflect.set-prototype-of { "ie":"10" } + es.regexp.constructor { "ie":"10" } + es.regexp.exec { "ie":"10" } + es.regexp.flags { "ie":"10" } + es.regexp.to-string { "ie":"10" } + es.set { "ie":"10" } + es.string.code-point-at { "ie":"10" } + es.string.ends-with { "ie":"10" } + es.string.from-code-point { "ie":"10" } + es.string.includes { "ie":"10" } + es.string.iterator { "ie":"10" } + es.string.match { "ie":"10" } + es.string.pad-end { "chrome":"54", "ie":"10", "node":"6.10" } + es.string.pad-start { "chrome":"54", "ie":"10", "node":"6.10" } + es.string.raw { "ie":"10" } + es.string.repeat { "ie":"10" } + es.string.replace { "chrome":"54", "ie":"10", "node":"6.10" } + es.string.search { "ie":"10" } + es.string.split { "ie":"10", "node":"6.10" } + es.string.starts-with { "ie":"10" } + es.string.trim { "chrome":"54", "ie":"10", "node":"6.10" } + es.string.trim-end { "chrome":"54", "ie":"10", "node":"6.10" } + es.string.trim-start { "chrome":"54", "ie":"10", "node":"6.10" } + es.string.anchor { "ie":"10" } + es.string.big { "ie":"10" } + es.string.blink { "ie":"10" } + es.string.bold { "ie":"10" } + es.string.fixed { "ie":"10" } + es.string.fontcolor { "ie":"10" } + es.string.fontsize { "ie":"10" } + es.string.italics { "ie":"10" } + es.string.link { "ie":"10" } + es.string.small { "ie":"10" } + es.string.strike { "ie":"10" } + es.string.sub { "ie":"10" } + es.string.sup { "ie":"10" } + es.typed-array.float32-array { "ie":"10", "node":"6.10" } + es.typed-array.float64-array { "ie":"10", "node":"6.10" } + es.typed-array.int8-array { "ie":"10", "node":"6.10" } + es.typed-array.int16-array { "ie":"10", "node":"6.10" } + es.typed-array.int32-array { "ie":"10", "node":"6.10" } + es.typed-array.uint8-array { "ie":"10", "node":"6.10" } + es.typed-array.uint8-clamped-array { "ie":"10", "node":"6.10" } + es.typed-array.uint16-array { "ie":"10", "node":"6.10" } + es.typed-array.uint32-array { "ie":"10", "node":"6.10" } + es.typed-array.copy-within { "ie":"10" } + es.typed-array.every { "ie":"10" } + es.typed-array.fill { "ie":"10" } + es.typed-array.filter { "ie":"10" } + es.typed-array.find { "ie":"10" } + es.typed-array.find-index { "ie":"10" } + es.typed-array.for-each { "ie":"10" } + es.typed-array.from { "ie":"10", "node":"6.10" } + es.typed-array.includes { "ie":"10" } + es.typed-array.index-of { "ie":"10" } + es.typed-array.iterator { "ie":"10" } + es.typed-array.join { "ie":"10" } + es.typed-array.last-index-of { "ie":"10" } + es.typed-array.map { "ie":"10" } + es.typed-array.of { "ie":"10", "node":"6.10" } + es.typed-array.reduce { "ie":"10" } + es.typed-array.reduce-right { "ie":"10" } + es.typed-array.reverse { "ie":"10" } + es.typed-array.set { "ie":"10" } + es.typed-array.slice { "ie":"10" } + es.typed-array.some { "ie":"10" } + es.typed-array.sort { "ie":"10" } + es.typed-array.subarray { "ie":"10" } + es.typed-array.to-locale-string { "ie":"10" } + es.typed-array.to-string { "ie":"10" } + es.weak-map { "ie":"10" } + es.weak-set { "ie":"10" } + web.dom-collections.for-each { "chrome":"54", "ie":"10" } + web.dom-collections.iterator { "chrome":"54", "ie":"10" } + web.immediate { "chrome":"54" } + web.queue-microtask { "chrome":"54", "ie":"10", "node":"6.10" } + web.url { "chrome":"54", "ie":"10", "node":"6.10" } + web.url.to-json { "chrome":"54", "ie":"10", "node":"6.10" } + web.url-search-params { "chrome":"54", "ie":"10", "node":"6.10" } diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-versions-strings-minor-3.1/in/in.js b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-versions-strings-minor-3.1/input.mjs similarity index 100% rename from packages/babel-preset-env/test/debug-fixtures/entry-corejs3-versions-strings-minor-3.1/in/in.js rename to packages/babel-preset-env/test/fixtures/debug/entry-corejs3-versions-strings-minor-3.1/input.mjs diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-versions-strings-minor-3.1/options.json b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-versions-strings-minor-3.1/options.json new file mode 100644 index 000000000000..69bc8e9d06c3 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-versions-strings-minor-3.1/options.json @@ -0,0 +1,19 @@ +{ + "validateLogs": true, + "ignoreOutput": true, + "presets": [ + [ + "env", + { + "useBuiltIns": "entry", + "corejs": "3.1", + "debug": true, + "targets": { + "chrome": "54", + "node": "6.10", + "ie": "10" + } + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-versions-strings-minor-3.1/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-versions-strings-minor-3.1/stdout.txt new file mode 100644 index 000000000000..9d157e38564c --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-versions-strings-minor-3.1/stdout.txt @@ -0,0 +1,244 @@ +@babel/preset-env: `DEBUG` option + +Using targets: +{ + "chrome": "54", + "ie": "10", + "node": "6.10" +} + +Using modules transform: auto + +Using plugins: + proposal-nullish-coalescing-operator { "chrome":"54", "ie":"10", "node":"6.10" } + proposal-optional-chaining { "chrome":"54", "ie":"10", "node":"6.10" } + proposal-json-strings { "chrome":"54", "ie":"10", "node":"6.10" } + proposal-optional-catch-binding { "chrome":"54", "ie":"10", "node":"6.10" } + transform-parameters { "ie":"10" } + proposal-async-generator-functions { "chrome":"54", "ie":"10", "node":"6.10" } + proposal-object-rest-spread { "chrome":"54", "ie":"10", "node":"6.10" } + transform-dotall-regex { "chrome":"54", "ie":"10", "node":"6.10" } + proposal-unicode-property-regex { "chrome":"54", "ie":"10", "node":"6.10" } + transform-named-capturing-groups-regex { "chrome":"54", "ie":"10", "node":"6.10" } + transform-async-to-generator { "chrome":"54", "ie":"10", "node":"6.10" } + transform-exponentiation-operator { "ie":"10", "node":"6.10" } + transform-template-literals { "ie":"10" } + transform-literals { "ie":"10" } + transform-function-name { "ie":"10" } + transform-arrow-functions { "ie":"10" } + transform-block-scoped-functions { "ie":"10" } + transform-classes { "ie":"10" } + transform-object-super { "ie":"10" } + transform-shorthand-properties { "ie":"10" } + transform-duplicate-keys { "ie":"10" } + transform-computed-properties { "ie":"10" } + transform-for-of { "ie":"10" } + transform-sticky-regex { "ie":"10" } + transform-unicode-regex { "ie":"10" } + transform-spread { "ie":"10" } + transform-destructuring { "ie":"10" } + transform-block-scoping { "ie":"10" } + transform-typeof-symbol { "ie":"10" } + transform-new-target { "ie":"10" } + transform-regenerator { "ie":"10" } + transform-modules-commonjs { "chrome":"54", "ie":"10", "node":"6.10" } + proposal-dynamic-import { "chrome":"54", "ie":"10", "node":"6.10" } + +Using polyfills with `entry` option: + +[/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-versions-strings-minor-3.1/input.mjs] Replaced core-js entries with the following polyfills: + es.symbol { "ie":"10" } + es.symbol.description { "chrome":"54", "ie":"10", "node":"6.10" } + es.symbol.async-iterator { "chrome":"54", "ie":"10", "node":"6.10" } + es.symbol.has-instance { "ie":"10" } + es.symbol.is-concat-spreadable { "ie":"10" } + es.symbol.iterator { "ie":"10" } + es.symbol.match { "ie":"10" } + es.symbol.match-all { "chrome":"54", "ie":"10", "node":"6.10" } + es.symbol.replace { "ie":"10" } + es.symbol.search { "ie":"10" } + es.symbol.species { "ie":"10" } + es.symbol.split { "ie":"10" } + es.symbol.to-primitive { "ie":"10" } + es.symbol.to-string-tag { "ie":"10" } + es.symbol.unscopables { "ie":"10" } + es.array.concat { "ie":"10" } + es.array.copy-within { "ie":"10" } + es.array.every { "ie":"10" } + es.array.fill { "ie":"10" } + es.array.filter { "ie":"10" } + es.array.find { "ie":"10" } + es.array.find-index { "ie":"10" } + es.array.flat { "chrome":"54", "ie":"10", "node":"6.10" } + es.array.flat-map { "chrome":"54", "ie":"10", "node":"6.10" } + es.array.for-each { "ie":"10" } + es.array.from { "ie":"10" } + es.array.includes { "ie":"10", "node":"6.10" } + es.array.index-of { "ie":"10" } + es.array.iterator { "chrome":"54", "ie":"10", "node":"6.10" } + es.array.join { "ie":"10" } + es.array.last-index-of { "ie":"10" } + es.array.map { "ie":"10" } + es.array.of { "ie":"10" } + es.array.reduce { "ie":"10" } + es.array.reduce-right { "ie":"10" } + es.array.slice { "ie":"10" } + es.array.some { "ie":"10" } + es.array.sort { "chrome":"54", "node":"6.10" } + es.array.species { "ie":"10" } + es.array.splice { "ie":"10" } + es.array.unscopables.flat { "chrome":"54", "ie":"10", "node":"6.10" } + es.array.unscopables.flat-map { "chrome":"54", "ie":"10", "node":"6.10" } + es.array-buffer.constructor { "ie":"10" } + es.array-buffer.is-view { "ie":"10" } + es.array-buffer.slice { "ie":"10" } + es.date.to-primitive { "ie":"10" } + es.function.has-instance { "ie":"10" } + es.function.name { "ie":"10" } + es.json.to-string-tag { "ie":"10" } + es.map { "ie":"10" } + es.math.acosh { "ie":"10", "node":"6.10" } + es.math.asinh { "ie":"10" } + es.math.atanh { "ie":"10" } + es.math.cbrt { "ie":"10" } + es.math.clz32 { "ie":"10" } + es.math.cosh { "ie":"10" } + es.math.expm1 { "ie":"10" } + es.math.fround { "ie":"10" } + es.math.hypot { "chrome":"54", "ie":"10", "node":"6.10" } + es.math.imul { "ie":"10" } + es.math.log10 { "ie":"10" } + es.math.log1p { "ie":"10" } + es.math.log2 { "ie":"10" } + es.math.sign { "ie":"10" } + es.math.sinh { "ie":"10" } + es.math.tanh { "ie":"10" } + es.math.to-string-tag { "ie":"10" } + es.math.trunc { "ie":"10" } + es.number.constructor { "ie":"10" } + es.number.epsilon { "ie":"10" } + es.number.is-finite { "ie":"10" } + es.number.is-integer { "ie":"10" } + es.number.is-nan { "ie":"10" } + es.number.is-safe-integer { "ie":"10" } + es.number.max-safe-integer { "ie":"10" } + es.number.min-safe-integer { "ie":"10" } + es.number.parse-float { "ie":"10" } + es.number.parse-int { "ie":"10" } + es.number.to-fixed { "ie":"10" } + es.object.assign { "ie":"10" } + es.object.define-getter { "chrome":"54", "ie":"10", "node":"6.10" } + es.object.define-setter { "chrome":"54", "ie":"10", "node":"6.10" } + es.object.entries { "ie":"10", "node":"6.10" } + es.object.freeze { "ie":"10" } + es.object.from-entries { "chrome":"54", "ie":"10", "node":"6.10" } + es.object.get-own-property-descriptor { "ie":"10" } + es.object.get-own-property-descriptors { "ie":"10", "node":"6.10" } + es.object.get-own-property-names { "ie":"10" } + es.object.get-prototype-of { "ie":"10" } + es.object.is { "ie":"10" } + es.object.is-extensible { "ie":"10" } + es.object.is-frozen { "ie":"10" } + es.object.is-sealed { "ie":"10" } + es.object.keys { "ie":"10" } + es.object.lookup-getter { "chrome":"54", "ie":"10", "node":"6.10" } + es.object.lookup-setter { "chrome":"54", "ie":"10", "node":"6.10" } + es.object.prevent-extensions { "ie":"10" } + es.object.seal { "ie":"10" } + es.object.set-prototype-of { "ie":"10" } + es.object.to-string { "ie":"10" } + es.object.values { "ie":"10", "node":"6.10" } + es.promise { "chrome":"54", "ie":"10", "node":"6.10" } + es.promise.finally { "chrome":"54", "ie":"10", "node":"6.10" } + es.reflect.apply { "ie":"10" } + es.reflect.construct { "ie":"10" } + es.reflect.define-property { "ie":"10" } + es.reflect.delete-property { "ie":"10" } + es.reflect.get { "ie":"10" } + es.reflect.get-own-property-descriptor { "ie":"10" } + es.reflect.get-prototype-of { "ie":"10" } + es.reflect.has { "ie":"10" } + es.reflect.is-extensible { "ie":"10" } + es.reflect.own-keys { "ie":"10" } + es.reflect.prevent-extensions { "ie":"10" } + es.reflect.set { "ie":"10" } + es.reflect.set-prototype-of { "ie":"10" } + es.regexp.constructor { "ie":"10" } + es.regexp.exec { "ie":"10" } + es.regexp.flags { "ie":"10" } + es.regexp.to-string { "ie":"10" } + es.set { "ie":"10" } + es.string.code-point-at { "ie":"10" } + es.string.ends-with { "ie":"10" } + es.string.from-code-point { "ie":"10" } + es.string.includes { "ie":"10" } + es.string.iterator { "ie":"10" } + es.string.match { "ie":"10" } + es.string.match-all { "chrome":"54", "ie":"10", "node":"6.10" } + es.string.pad-end { "chrome":"54", "ie":"10", "node":"6.10" } + es.string.pad-start { "chrome":"54", "ie":"10", "node":"6.10" } + es.string.raw { "ie":"10" } + es.string.repeat { "ie":"10" } + es.string.replace { "chrome":"54", "ie":"10", "node":"6.10" } + es.string.search { "ie":"10" } + es.string.split { "ie":"10", "node":"6.10" } + es.string.starts-with { "ie":"10" } + es.string.trim { "chrome":"54", "ie":"10", "node":"6.10" } + es.string.trim-end { "chrome":"54", "ie":"10", "node":"6.10" } + es.string.trim-start { "chrome":"54", "ie":"10", "node":"6.10" } + es.string.anchor { "ie":"10" } + es.string.big { "ie":"10" } + es.string.blink { "ie":"10" } + es.string.bold { "ie":"10" } + es.string.fixed { "ie":"10" } + es.string.fontcolor { "ie":"10" } + es.string.fontsize { "ie":"10" } + es.string.italics { "ie":"10" } + es.string.link { "ie":"10" } + es.string.small { "ie":"10" } + es.string.strike { "ie":"10" } + es.string.sub { "ie":"10" } + es.string.sup { "ie":"10" } + es.typed-array.float32-array { "ie":"10", "node":"6.10" } + es.typed-array.float64-array { "ie":"10", "node":"6.10" } + es.typed-array.int8-array { "ie":"10", "node":"6.10" } + es.typed-array.int16-array { "ie":"10", "node":"6.10" } + es.typed-array.int32-array { "ie":"10", "node":"6.10" } + es.typed-array.uint8-array { "ie":"10", "node":"6.10" } + es.typed-array.uint8-clamped-array { "ie":"10", "node":"6.10" } + es.typed-array.uint16-array { "ie":"10", "node":"6.10" } + es.typed-array.uint32-array { "ie":"10", "node":"6.10" } + es.typed-array.copy-within { "ie":"10" } + es.typed-array.every { "ie":"10" } + es.typed-array.fill { "ie":"10" } + es.typed-array.filter { "ie":"10" } + es.typed-array.find { "ie":"10" } + es.typed-array.find-index { "ie":"10" } + es.typed-array.for-each { "ie":"10" } + es.typed-array.from { "ie":"10", "node":"6.10" } + es.typed-array.includes { "ie":"10" } + es.typed-array.index-of { "ie":"10" } + es.typed-array.iterator { "ie":"10" } + es.typed-array.join { "ie":"10" } + es.typed-array.last-index-of { "ie":"10" } + es.typed-array.map { "ie":"10" } + es.typed-array.of { "ie":"10", "node":"6.10" } + es.typed-array.reduce { "ie":"10" } + es.typed-array.reduce-right { "ie":"10" } + es.typed-array.reverse { "ie":"10" } + es.typed-array.set { "ie":"10" } + es.typed-array.slice { "ie":"10" } + es.typed-array.some { "ie":"10" } + es.typed-array.sort { "ie":"10" } + es.typed-array.subarray { "ie":"10" } + es.typed-array.to-locale-string { "ie":"10" } + es.typed-array.to-string { "ie":"10" } + es.weak-map { "ie":"10" } + es.weak-set { "ie":"10" } + web.dom-collections.for-each { "chrome":"54", "ie":"10" } + web.dom-collections.iterator { "chrome":"54", "ie":"10" } + web.immediate { "chrome":"54" } + web.queue-microtask { "chrome":"54", "ie":"10", "node":"6.10" } + web.url { "chrome":"54", "ie":"10", "node":"6.10" } + web.url.to-json { "chrome":"54", "ie":"10", "node":"6.10" } + web.url-search-params { "chrome":"54", "ie":"10", "node":"6.10" } diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-versions-strings/in/in.js b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-versions-strings/input.mjs similarity index 100% rename from packages/babel-preset-env/test/debug-fixtures/entry-corejs3-versions-strings/in/in.js rename to packages/babel-preset-env/test/fixtures/debug/entry-corejs3-versions-strings/input.mjs diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-versions-strings/options.json b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-versions-strings/options.json new file mode 100644 index 000000000000..2f72dab2dc93 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-versions-strings/options.json @@ -0,0 +1,19 @@ +{ + "validateLogs": true, + "ignoreOutput": true, + "presets": [ + [ + "env", + { + "useBuiltIns": "entry", + "corejs": 3, + "debug": true, + "targets": { + "chrome": "54", + "node": "6.10", + "ie": "10" + } + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-versions-strings/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-versions-strings/stdout.txt new file mode 100644 index 000000000000..7e13e7aa70dd --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-versions-strings/stdout.txt @@ -0,0 +1,242 @@ +@babel/preset-env: `DEBUG` option + +Using targets: +{ + "chrome": "54", + "ie": "10", + "node": "6.10" +} + +Using modules transform: auto + +Using plugins: + proposal-nullish-coalescing-operator { "chrome":"54", "ie":"10", "node":"6.10" } + proposal-optional-chaining { "chrome":"54", "ie":"10", "node":"6.10" } + proposal-json-strings { "chrome":"54", "ie":"10", "node":"6.10" } + proposal-optional-catch-binding { "chrome":"54", "ie":"10", "node":"6.10" } + transform-parameters { "ie":"10" } + proposal-async-generator-functions { "chrome":"54", "ie":"10", "node":"6.10" } + proposal-object-rest-spread { "chrome":"54", "ie":"10", "node":"6.10" } + transform-dotall-regex { "chrome":"54", "ie":"10", "node":"6.10" } + proposal-unicode-property-regex { "chrome":"54", "ie":"10", "node":"6.10" } + transform-named-capturing-groups-regex { "chrome":"54", "ie":"10", "node":"6.10" } + transform-async-to-generator { "chrome":"54", "ie":"10", "node":"6.10" } + transform-exponentiation-operator { "ie":"10", "node":"6.10" } + transform-template-literals { "ie":"10" } + transform-literals { "ie":"10" } + transform-function-name { "ie":"10" } + transform-arrow-functions { "ie":"10" } + transform-block-scoped-functions { "ie":"10" } + transform-classes { "ie":"10" } + transform-object-super { "ie":"10" } + transform-shorthand-properties { "ie":"10" } + transform-duplicate-keys { "ie":"10" } + transform-computed-properties { "ie":"10" } + transform-for-of { "ie":"10" } + transform-sticky-regex { "ie":"10" } + transform-unicode-regex { "ie":"10" } + transform-spread { "ie":"10" } + transform-destructuring { "ie":"10" } + transform-block-scoping { "ie":"10" } + transform-typeof-symbol { "ie":"10" } + transform-new-target { "ie":"10" } + transform-regenerator { "ie":"10" } + transform-modules-commonjs { "chrome":"54", "ie":"10", "node":"6.10" } + proposal-dynamic-import { "chrome":"54", "ie":"10", "node":"6.10" } + +Using polyfills with `entry` option: + +[/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-versions-strings/input.mjs] Replaced core-js entries with the following polyfills: + es.symbol { "ie":"10" } + es.symbol.description { "chrome":"54", "ie":"10", "node":"6.10" } + es.symbol.async-iterator { "chrome":"54", "ie":"10", "node":"6.10" } + es.symbol.has-instance { "ie":"10" } + es.symbol.is-concat-spreadable { "ie":"10" } + es.symbol.iterator { "ie":"10" } + es.symbol.match { "ie":"10" } + es.symbol.replace { "ie":"10" } + es.symbol.search { "ie":"10" } + es.symbol.species { "ie":"10" } + es.symbol.split { "ie":"10" } + es.symbol.to-primitive { "ie":"10" } + es.symbol.to-string-tag { "ie":"10" } + es.symbol.unscopables { "ie":"10" } + es.array.concat { "ie":"10" } + es.array.copy-within { "ie":"10" } + es.array.every { "ie":"10" } + es.array.fill { "ie":"10" } + es.array.filter { "ie":"10" } + es.array.find { "ie":"10" } + es.array.find-index { "ie":"10" } + es.array.flat { "chrome":"54", "ie":"10", "node":"6.10" } + es.array.flat-map { "chrome":"54", "ie":"10", "node":"6.10" } + es.array.for-each { "ie":"10" } + es.array.from { "ie":"10" } + es.array.includes { "ie":"10", "node":"6.10" } + es.array.index-of { "ie":"10" } + es.array.iterator { "chrome":"54", "ie":"10", "node":"6.10" } + es.array.join { "ie":"10" } + es.array.last-index-of { "ie":"10" } + es.array.map { "ie":"10" } + es.array.of { "ie":"10" } + es.array.reduce { "ie":"10" } + es.array.reduce-right { "ie":"10" } + es.array.slice { "ie":"10" } + es.array.some { "ie":"10" } + es.array.sort { "chrome":"54", "node":"6.10" } + es.array.species { "ie":"10" } + es.array.splice { "ie":"10" } + es.array.unscopables.flat { "chrome":"54", "ie":"10", "node":"6.10" } + es.array.unscopables.flat-map { "chrome":"54", "ie":"10", "node":"6.10" } + es.array-buffer.constructor { "ie":"10" } + es.array-buffer.is-view { "ie":"10" } + es.array-buffer.slice { "ie":"10" } + es.date.to-primitive { "ie":"10" } + es.function.has-instance { "ie":"10" } + es.function.name { "ie":"10" } + es.json.to-string-tag { "ie":"10" } + es.map { "ie":"10" } + es.math.acosh { "ie":"10", "node":"6.10" } + es.math.asinh { "ie":"10" } + es.math.atanh { "ie":"10" } + es.math.cbrt { "ie":"10" } + es.math.clz32 { "ie":"10" } + es.math.cosh { "ie":"10" } + es.math.expm1 { "ie":"10" } + es.math.fround { "ie":"10" } + es.math.hypot { "chrome":"54", "ie":"10", "node":"6.10" } + es.math.imul { "ie":"10" } + es.math.log10 { "ie":"10" } + es.math.log1p { "ie":"10" } + es.math.log2 { "ie":"10" } + es.math.sign { "ie":"10" } + es.math.sinh { "ie":"10" } + es.math.tanh { "ie":"10" } + es.math.to-string-tag { "ie":"10" } + es.math.trunc { "ie":"10" } + es.number.constructor { "ie":"10" } + es.number.epsilon { "ie":"10" } + es.number.is-finite { "ie":"10" } + es.number.is-integer { "ie":"10" } + es.number.is-nan { "ie":"10" } + es.number.is-safe-integer { "ie":"10" } + es.number.max-safe-integer { "ie":"10" } + es.number.min-safe-integer { "ie":"10" } + es.number.parse-float { "ie":"10" } + es.number.parse-int { "ie":"10" } + es.number.to-fixed { "ie":"10" } + es.object.assign { "ie":"10" } + es.object.define-getter { "chrome":"54", "ie":"10", "node":"6.10" } + es.object.define-setter { "chrome":"54", "ie":"10", "node":"6.10" } + es.object.entries { "ie":"10", "node":"6.10" } + es.object.freeze { "ie":"10" } + es.object.from-entries { "chrome":"54", "ie":"10", "node":"6.10" } + es.object.get-own-property-descriptor { "ie":"10" } + es.object.get-own-property-descriptors { "ie":"10", "node":"6.10" } + es.object.get-own-property-names { "ie":"10" } + es.object.get-prototype-of { "ie":"10" } + es.object.is { "ie":"10" } + es.object.is-extensible { "ie":"10" } + es.object.is-frozen { "ie":"10" } + es.object.is-sealed { "ie":"10" } + es.object.keys { "ie":"10" } + es.object.lookup-getter { "chrome":"54", "ie":"10", "node":"6.10" } + es.object.lookup-setter { "chrome":"54", "ie":"10", "node":"6.10" } + es.object.prevent-extensions { "ie":"10" } + es.object.seal { "ie":"10" } + es.object.set-prototype-of { "ie":"10" } + es.object.to-string { "ie":"10" } + es.object.values { "ie":"10", "node":"6.10" } + es.promise { "chrome":"54", "ie":"10", "node":"6.10" } + es.promise.finally { "chrome":"54", "ie":"10", "node":"6.10" } + es.reflect.apply { "ie":"10" } + es.reflect.construct { "ie":"10" } + es.reflect.define-property { "ie":"10" } + es.reflect.delete-property { "ie":"10" } + es.reflect.get { "ie":"10" } + es.reflect.get-own-property-descriptor { "ie":"10" } + es.reflect.get-prototype-of { "ie":"10" } + es.reflect.has { "ie":"10" } + es.reflect.is-extensible { "ie":"10" } + es.reflect.own-keys { "ie":"10" } + es.reflect.prevent-extensions { "ie":"10" } + es.reflect.set { "ie":"10" } + es.reflect.set-prototype-of { "ie":"10" } + es.regexp.constructor { "ie":"10" } + es.regexp.exec { "ie":"10" } + es.regexp.flags { "ie":"10" } + es.regexp.to-string { "ie":"10" } + es.set { "ie":"10" } + es.string.code-point-at { "ie":"10" } + es.string.ends-with { "ie":"10" } + es.string.from-code-point { "ie":"10" } + es.string.includes { "ie":"10" } + es.string.iterator { "ie":"10" } + es.string.match { "ie":"10" } + es.string.pad-end { "chrome":"54", "ie":"10", "node":"6.10" } + es.string.pad-start { "chrome":"54", "ie":"10", "node":"6.10" } + es.string.raw { "ie":"10" } + es.string.repeat { "ie":"10" } + es.string.replace { "chrome":"54", "ie":"10", "node":"6.10" } + es.string.search { "ie":"10" } + es.string.split { "ie":"10", "node":"6.10" } + es.string.starts-with { "ie":"10" } + es.string.trim { "chrome":"54", "ie":"10", "node":"6.10" } + es.string.trim-end { "chrome":"54", "ie":"10", "node":"6.10" } + es.string.trim-start { "chrome":"54", "ie":"10", "node":"6.10" } + es.string.anchor { "ie":"10" } + es.string.big { "ie":"10" } + es.string.blink { "ie":"10" } + es.string.bold { "ie":"10" } + es.string.fixed { "ie":"10" } + es.string.fontcolor { "ie":"10" } + es.string.fontsize { "ie":"10" } + es.string.italics { "ie":"10" } + es.string.link { "ie":"10" } + es.string.small { "ie":"10" } + es.string.strike { "ie":"10" } + es.string.sub { "ie":"10" } + es.string.sup { "ie":"10" } + es.typed-array.float32-array { "ie":"10", "node":"6.10" } + es.typed-array.float64-array { "ie":"10", "node":"6.10" } + es.typed-array.int8-array { "ie":"10", "node":"6.10" } + es.typed-array.int16-array { "ie":"10", "node":"6.10" } + es.typed-array.int32-array { "ie":"10", "node":"6.10" } + es.typed-array.uint8-array { "ie":"10", "node":"6.10" } + es.typed-array.uint8-clamped-array { "ie":"10", "node":"6.10" } + es.typed-array.uint16-array { "ie":"10", "node":"6.10" } + es.typed-array.uint32-array { "ie":"10", "node":"6.10" } + es.typed-array.copy-within { "ie":"10" } + es.typed-array.every { "ie":"10" } + es.typed-array.fill { "ie":"10" } + es.typed-array.filter { "ie":"10" } + es.typed-array.find { "ie":"10" } + es.typed-array.find-index { "ie":"10" } + es.typed-array.for-each { "ie":"10" } + es.typed-array.from { "ie":"10", "node":"6.10" } + es.typed-array.includes { "ie":"10" } + es.typed-array.index-of { "ie":"10" } + es.typed-array.iterator { "ie":"10" } + es.typed-array.join { "ie":"10" } + es.typed-array.last-index-of { "ie":"10" } + es.typed-array.map { "ie":"10" } + es.typed-array.of { "ie":"10", "node":"6.10" } + es.typed-array.reduce { "ie":"10" } + es.typed-array.reduce-right { "ie":"10" } + es.typed-array.reverse { "ie":"10" } + es.typed-array.set { "ie":"10" } + es.typed-array.slice { "ie":"10" } + es.typed-array.some { "ie":"10" } + es.typed-array.sort { "ie":"10" } + es.typed-array.subarray { "ie":"10" } + es.typed-array.to-locale-string { "ie":"10" } + es.typed-array.to-string { "ie":"10" } + es.weak-map { "ie":"10" } + es.weak-set { "ie":"10" } + web.dom-collections.for-each { "chrome":"54", "ie":"10" } + web.dom-collections.iterator { "chrome":"54", "ie":"10" } + web.immediate { "chrome":"54" } + web.queue-microtask { "chrome":"54", "ie":"10", "node":"6.10" } + web.url { "chrome":"54", "ie":"10", "node":"6.10" } + web.url.to-json { "chrome":"54", "ie":"10", "node":"6.10" } + web.url-search-params { "chrome":"54", "ie":"10", "node":"6.10" } diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-web-chrome-71/in/in.js b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-web-chrome-71/input.mjs similarity index 100% rename from packages/babel-preset-env/test/debug-fixtures/entry-corejs3-web-chrome-71/in/in.js rename to packages/babel-preset-env/test/fixtures/debug/entry-corejs3-web-chrome-71/input.mjs diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-web-chrome-71/options.json b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-web-chrome-71/options.json new file mode 100644 index 000000000000..6e8f4a357b28 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-web-chrome-71/options.json @@ -0,0 +1,18 @@ +{ + "validateLogs": true, + "ignoreOutput": true, + "presets": [ + [ + "env", + { + "debug": true, + "targets": { + "browsers": "chrome 71" + }, + "shippedProposals": true, + "useBuiltIns": "entry", + "corejs": 3 + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-web-chrome-71/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-web-chrome-71/stdout.txt new file mode 100644 index 000000000000..678a904aba1d --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-web-chrome-71/stdout.txt @@ -0,0 +1,26 @@ +@babel/preset-env: `DEBUG` option + +Using targets: +{ + "chrome": "71" +} + +Using modules transform: auto + +Using plugins: + proposal-numeric-separator { "chrome":"71" } + proposal-nullish-coalescing-operator { "chrome":"71" } + proposal-optional-chaining { "chrome":"71" } + syntax-json-strings { "chrome":"71" } + syntax-optional-catch-binding { "chrome":"71" } + syntax-async-generators { "chrome":"71" } + syntax-object-rest-spread { "chrome":"71" } + transform-modules-commonjs { "chrome":"71" } + proposal-dynamic-import { "chrome":"71" } + +Using polyfills with `entry` option: + +[/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-web-chrome-71/input.mjs] Replaced core-js entries with the following polyfill: + web.immediate { "chrome":"71" } + +[/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-web-chrome-71/input.mjs] Based on your targets, regenerator-runtime import excluded. diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-web/in/in.js b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-web/input.mjs similarity index 100% rename from packages/babel-preset-env/test/debug-fixtures/entry-corejs3-web/in/in.js rename to packages/babel-preset-env/test/fixtures/debug/entry-corejs3-web/input.mjs diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-web/options.json b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-web/options.json new file mode 100644 index 000000000000..edf42df8057e --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-web/options.json @@ -0,0 +1,15 @@ +{ + "validateLogs": true, + "ignoreOutput": true, + "presets": [ + [ + "env", + { + "debug": true, + "shippedProposals": true, + "useBuiltIns": "entry", + "corejs": 3 + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-web/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-web/stdout.txt new file mode 100644 index 000000000000..48969ccc8be7 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-web/stdout.txt @@ -0,0 +1,57 @@ +@babel/preset-env: `DEBUG` option + +Using targets: +{} + +Using modules transform: auto + +Using plugins: + proposal-numeric-separator {} + proposal-nullish-coalescing-operator {} + proposal-optional-chaining {} + proposal-json-strings {} + proposal-optional-catch-binding {} + transform-parameters {} + proposal-async-generator-functions {} + proposal-object-rest-spread {} + transform-dotall-regex {} + proposal-unicode-property-regex {} + transform-named-capturing-groups-regex {} + transform-async-to-generator {} + transform-exponentiation-operator {} + transform-template-literals {} + transform-literals {} + transform-function-name {} + transform-arrow-functions {} + transform-block-scoped-functions {} + transform-classes {} + transform-object-super {} + transform-shorthand-properties {} + transform-duplicate-keys {} + transform-computed-properties {} + transform-for-of {} + transform-sticky-regex {} + transform-unicode-regex {} + transform-spread {} + transform-destructuring {} + transform-block-scoping {} + transform-typeof-symbol {} + transform-new-target {} + transform-regenerator {} + transform-member-expression-literals {} + transform-property-literals {} + transform-reserved-words {} + transform-modules-commonjs {} + proposal-dynamic-import {} + +Using polyfills with `entry` option: + +[/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-web/input.mjs] Replaced core-js entries with the following polyfills: + web.dom-collections.for-each {} + web.dom-collections.iterator {} + web.immediate {} + web.queue-microtask {} + web.timers {} + web.url {} + web.url.to-json {} + web.url-search-params {} diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3/in/in.js b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3/input.mjs similarity index 100% rename from packages/babel-preset-env/test/debug-fixtures/entry-corejs3/in/in.js rename to packages/babel-preset-env/test/fixtures/debug/entry-corejs3/input.mjs diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs3/options.json b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3/options.json new file mode 100644 index 000000000000..9dcd68d59ce9 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3/options.json @@ -0,0 +1,18 @@ +{ + "validateLogs": true, + "ignoreOutput": true, + "presets": [ + [ + "env", + { + "debug": true, + "targets": { + "browsers": "chrome >= 54, ie 10", + "node": 6 + }, + "useBuiltIns": "entry", + "corejs": 3 + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs3/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3/stdout.txt new file mode 100644 index 000000000000..943367823653 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3/stdout.txt @@ -0,0 +1,242 @@ +@babel/preset-env: `DEBUG` option + +Using targets: +{ + "chrome": "54", + "ie": "10", + "node": "6" +} + +Using modules transform: auto + +Using plugins: + proposal-nullish-coalescing-operator { "chrome":"54", "ie":"10", "node":"6" } + proposal-optional-chaining { "chrome":"54", "ie":"10", "node":"6" } + proposal-json-strings { "chrome":"54", "ie":"10", "node":"6" } + proposal-optional-catch-binding { "chrome":"54", "ie":"10", "node":"6" } + transform-parameters { "ie":"10" } + proposal-async-generator-functions { "chrome":"54", "ie":"10", "node":"6" } + proposal-object-rest-spread { "chrome":"54", "ie":"10", "node":"6" } + transform-dotall-regex { "chrome":"54", "ie":"10", "node":"6" } + proposal-unicode-property-regex { "chrome":"54", "ie":"10", "node":"6" } + transform-named-capturing-groups-regex { "chrome":"54", "ie":"10", "node":"6" } + transform-async-to-generator { "chrome":"54", "ie":"10", "node":"6" } + transform-exponentiation-operator { "ie":"10", "node":"6" } + transform-template-literals { "ie":"10" } + transform-literals { "ie":"10" } + transform-function-name { "ie":"10", "node":"6" } + transform-arrow-functions { "ie":"10" } + transform-block-scoped-functions { "ie":"10" } + transform-classes { "ie":"10" } + transform-object-super { "ie":"10" } + transform-shorthand-properties { "ie":"10" } + transform-duplicate-keys { "ie":"10" } + transform-computed-properties { "ie":"10" } + transform-for-of { "ie":"10", "node":"6" } + transform-sticky-regex { "ie":"10" } + transform-unicode-regex { "ie":"10" } + transform-spread { "ie":"10" } + transform-destructuring { "ie":"10", "node":"6" } + transform-block-scoping { "ie":"10" } + transform-typeof-symbol { "ie":"10" } + transform-new-target { "ie":"10" } + transform-regenerator { "ie":"10" } + transform-modules-commonjs { "chrome":"54", "ie":"10", "node":"6" } + proposal-dynamic-import { "chrome":"54", "ie":"10", "node":"6" } + +Using polyfills with `entry` option: + +[/packages/babel-preset-env/test/fixtures/debug/entry-corejs3/input.mjs] Replaced core-js entries with the following polyfills: + es.symbol { "ie":"10" } + es.symbol.description { "chrome":"54", "ie":"10", "node":"6" } + es.symbol.async-iterator { "chrome":"54", "ie":"10", "node":"6" } + es.symbol.has-instance { "ie":"10" } + es.symbol.is-concat-spreadable { "ie":"10" } + es.symbol.iterator { "ie":"10" } + es.symbol.match { "ie":"10" } + es.symbol.replace { "ie":"10" } + es.symbol.search { "ie":"10" } + es.symbol.species { "ie":"10", "node":"6" } + es.symbol.split { "ie":"10" } + es.symbol.to-primitive { "ie":"10" } + es.symbol.to-string-tag { "ie":"10" } + es.symbol.unscopables { "ie":"10" } + es.array.concat { "ie":"10", "node":"6" } + es.array.copy-within { "ie":"10" } + es.array.every { "ie":"10" } + es.array.fill { "ie":"10" } + es.array.filter { "ie":"10", "node":"6" } + es.array.find { "ie":"10" } + es.array.find-index { "ie":"10" } + es.array.flat { "chrome":"54", "ie":"10", "node":"6" } + es.array.flat-map { "chrome":"54", "ie":"10", "node":"6" } + es.array.for-each { "ie":"10" } + es.array.from { "ie":"10", "node":"6" } + es.array.includes { "ie":"10", "node":"6" } + es.array.index-of { "ie":"10", "node":"6" } + es.array.iterator { "chrome":"54", "ie":"10", "node":"6" } + es.array.join { "ie":"10" } + es.array.last-index-of { "ie":"10", "node":"6" } + es.array.map { "ie":"10", "node":"6" } + es.array.of { "ie":"10" } + es.array.reduce { "ie":"10" } + es.array.reduce-right { "ie":"10" } + es.array.slice { "ie":"10", "node":"6" } + es.array.some { "ie":"10" } + es.array.sort { "chrome":"54", "node":"6" } + es.array.species { "ie":"10", "node":"6" } + es.array.splice { "ie":"10", "node":"6" } + es.array.unscopables.flat { "chrome":"54", "ie":"10", "node":"6" } + es.array.unscopables.flat-map { "chrome":"54", "ie":"10", "node":"6" } + es.array-buffer.constructor { "ie":"10" } + es.array-buffer.is-view { "ie":"10" } + es.array-buffer.slice { "ie":"10" } + es.date.to-primitive { "ie":"10" } + es.function.has-instance { "ie":"10", "node":"6" } + es.function.name { "ie":"10" } + es.json.to-string-tag { "ie":"10" } + es.map { "ie":"10", "node":"6" } + es.math.acosh { "ie":"10", "node":"6" } + es.math.asinh { "ie":"10" } + es.math.atanh { "ie":"10" } + es.math.cbrt { "ie":"10" } + es.math.clz32 { "ie":"10" } + es.math.cosh { "ie":"10" } + es.math.expm1 { "ie":"10" } + es.math.fround { "ie":"10" } + es.math.hypot { "chrome":"54", "ie":"10", "node":"6" } + es.math.imul { "ie":"10" } + es.math.log10 { "ie":"10" } + es.math.log1p { "ie":"10" } + es.math.log2 { "ie":"10" } + es.math.sign { "ie":"10" } + es.math.sinh { "ie":"10" } + es.math.tanh { "ie":"10" } + es.math.to-string-tag { "ie":"10" } + es.math.trunc { "ie":"10" } + es.number.constructor { "ie":"10" } + es.number.epsilon { "ie":"10" } + es.number.is-finite { "ie":"10" } + es.number.is-integer { "ie":"10" } + es.number.is-nan { "ie":"10" } + es.number.is-safe-integer { "ie":"10" } + es.number.max-safe-integer { "ie":"10" } + es.number.min-safe-integer { "ie":"10" } + es.number.parse-float { "ie":"10" } + es.number.parse-int { "ie":"10" } + es.number.to-fixed { "ie":"10" } + es.object.assign { "ie":"10" } + es.object.define-getter { "chrome":"54", "ie":"10", "node":"6" } + es.object.define-setter { "chrome":"54", "ie":"10", "node":"6" } + es.object.entries { "ie":"10", "node":"6" } + es.object.freeze { "ie":"10" } + es.object.from-entries { "chrome":"54", "ie":"10", "node":"6" } + es.object.get-own-property-descriptor { "ie":"10" } + es.object.get-own-property-descriptors { "ie":"10", "node":"6" } + es.object.get-own-property-names { "ie":"10" } + es.object.get-prototype-of { "ie":"10" } + es.object.is { "ie":"10" } + es.object.is-extensible { "ie":"10" } + es.object.is-frozen { "ie":"10" } + es.object.is-sealed { "ie":"10" } + es.object.keys { "ie":"10" } + es.object.lookup-getter { "chrome":"54", "ie":"10", "node":"6" } + es.object.lookup-setter { "chrome":"54", "ie":"10", "node":"6" } + es.object.prevent-extensions { "ie":"10" } + es.object.seal { "ie":"10" } + es.object.set-prototype-of { "ie":"10" } + es.object.to-string { "ie":"10" } + es.object.values { "ie":"10", "node":"6" } + es.promise { "chrome":"54", "ie":"10", "node":"6" } + es.promise.finally { "chrome":"54", "ie":"10", "node":"6" } + es.reflect.apply { "ie":"10" } + es.reflect.construct { "ie":"10" } + es.reflect.define-property { "ie":"10" } + es.reflect.delete-property { "ie":"10" } + es.reflect.get { "ie":"10" } + es.reflect.get-own-property-descriptor { "ie":"10" } + es.reflect.get-prototype-of { "ie":"10" } + es.reflect.has { "ie":"10" } + es.reflect.is-extensible { "ie":"10" } + es.reflect.own-keys { "ie":"10" } + es.reflect.prevent-extensions { "ie":"10" } + es.reflect.set { "ie":"10" } + es.reflect.set-prototype-of { "ie":"10" } + es.regexp.constructor { "ie":"10", "node":"6" } + es.regexp.exec { "ie":"10" } + es.regexp.flags { "ie":"10" } + es.regexp.to-string { "ie":"10" } + es.set { "ie":"10", "node":"6" } + es.string.code-point-at { "ie":"10" } + es.string.ends-with { "ie":"10", "node":"6" } + es.string.from-code-point { "ie":"10" } + es.string.includes { "ie":"10", "node":"6" } + es.string.iterator { "ie":"10" } + es.string.match { "ie":"10", "node":"6" } + es.string.pad-end { "chrome":"54", "ie":"10", "node":"6" } + es.string.pad-start { "chrome":"54", "ie":"10", "node":"6" } + es.string.raw { "ie":"10" } + es.string.repeat { "ie":"10" } + es.string.replace { "chrome":"54", "ie":"10", "node":"6" } + es.string.search { "ie":"10", "node":"6" } + es.string.split { "ie":"10", "node":"6" } + es.string.starts-with { "ie":"10", "node":"6" } + es.string.trim { "chrome":"54", "ie":"10", "node":"6" } + es.string.trim-end { "chrome":"54", "ie":"10", "node":"6" } + es.string.trim-start { "chrome":"54", "ie":"10", "node":"6" } + es.string.anchor { "ie":"10" } + es.string.big { "ie":"10" } + es.string.blink { "ie":"10" } + es.string.bold { "ie":"10" } + es.string.fixed { "ie":"10" } + es.string.fontcolor { "ie":"10" } + es.string.fontsize { "ie":"10" } + es.string.italics { "ie":"10" } + es.string.link { "ie":"10" } + es.string.small { "ie":"10" } + es.string.strike { "ie":"10" } + es.string.sub { "ie":"10" } + es.string.sup { "ie":"10" } + es.typed-array.float32-array { "ie":"10", "node":"6" } + es.typed-array.float64-array { "ie":"10", "node":"6" } + es.typed-array.int8-array { "ie":"10", "node":"6" } + es.typed-array.int16-array { "ie":"10", "node":"6" } + es.typed-array.int32-array { "ie":"10", "node":"6" } + es.typed-array.uint8-array { "ie":"10", "node":"6" } + es.typed-array.uint8-clamped-array { "ie":"10", "node":"6" } + es.typed-array.uint16-array { "ie":"10", "node":"6" } + es.typed-array.uint32-array { "ie":"10", "node":"6" } + es.typed-array.copy-within { "ie":"10" } + es.typed-array.every { "ie":"10" } + es.typed-array.fill { "ie":"10" } + es.typed-array.filter { "ie":"10" } + es.typed-array.find { "ie":"10" } + es.typed-array.find-index { "ie":"10" } + es.typed-array.for-each { "ie":"10" } + es.typed-array.from { "ie":"10", "node":"6" } + es.typed-array.includes { "ie":"10" } + es.typed-array.index-of { "ie":"10" } + es.typed-array.iterator { "ie":"10" } + es.typed-array.join { "ie":"10" } + es.typed-array.last-index-of { "ie":"10" } + es.typed-array.map { "ie":"10" } + es.typed-array.of { "ie":"10", "node":"6" } + es.typed-array.reduce { "ie":"10" } + es.typed-array.reduce-right { "ie":"10" } + es.typed-array.reverse { "ie":"10" } + es.typed-array.set { "ie":"10" } + es.typed-array.slice { "ie":"10" } + es.typed-array.some { "ie":"10" } + es.typed-array.sort { "ie":"10" } + es.typed-array.subarray { "ie":"10" } + es.typed-array.to-locale-string { "ie":"10" } + es.typed-array.to-string { "ie":"10", "node":"6" } + es.weak-map { "ie":"10", "node":"6" } + es.weak-set { "ie":"10", "node":"6" } + web.dom-collections.for-each { "chrome":"54", "ie":"10" } + web.dom-collections.iterator { "chrome":"54", "ie":"10" } + web.immediate { "chrome":"54" } + web.queue-microtask { "chrome":"54", "ie":"10", "node":"6" } + web.url { "chrome":"54", "ie":"10", "node":"6" } + web.url.to-json { "chrome":"54", "ie":"10", "node":"6" } + web.url-search-params { "chrome":"54", "ie":"10", "node":"6" } diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-no-corejs-no-import/in/in.js b/packages/babel-preset-env/test/fixtures/debug/entry-no-corejs-no-import/input.js similarity index 100% rename from packages/babel-preset-env/test/debug-fixtures/entry-no-corejs-no-import/in/in.js rename to packages/babel-preset-env/test/fixtures/debug/entry-no-corejs-no-import/input.js diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-no-corejs-no-import/options.json b/packages/babel-preset-env/test/fixtures/debug/entry-no-corejs-no-import/options.json new file mode 100644 index 000000000000..fd9dfe7fbea6 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-no-corejs-no-import/options.json @@ -0,0 +1,16 @@ +{ + "validateLogs": true, + "ignoreOutput": true, + "presets": [ + [ + "env", + { + "debug": true, + "targets": { + "node": 6 + }, + "useBuiltIns": "entry" + } + ] + ] +} diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-no-corejs-no-import/stderr.txt b/packages/babel-preset-env/test/fixtures/debug/entry-no-corejs-no-import/stderr.txt similarity index 100% rename from packages/babel-preset-env/test/debug-fixtures/entry-no-corejs-no-import/stderr.txt rename to packages/babel-preset-env/test/fixtures/debug/entry-no-corejs-no-import/stderr.txt diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-no-corejs-no-import/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/entry-no-corejs-no-import/stdout.txt new file mode 100644 index 000000000000..5a3f2a1bf3cc --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-no-corejs-no-import/stdout.txt @@ -0,0 +1,30 @@ +@babel/preset-env: `DEBUG` option + +Using targets: +{ + "node": "6" +} + +Using modules transform: auto + +Using plugins: + proposal-nullish-coalescing-operator { "node":"6" } + proposal-optional-chaining { "node":"6" } + proposal-json-strings { "node":"6" } + proposal-optional-catch-binding { "node":"6" } + proposal-async-generator-functions { "node":"6" } + proposal-object-rest-spread { "node":"6" } + transform-dotall-regex { "node":"6" } + proposal-unicode-property-regex { "node":"6" } + transform-named-capturing-groups-regex { "node":"6" } + transform-async-to-generator { "node":"6" } + transform-exponentiation-operator { "node":"6" } + transform-function-name { "node":"6" } + transform-for-of { "node":"6" } + transform-destructuring { "node":"6" } + transform-modules-commonjs { "node":"6" } + proposal-dynamic-import { "node":"6" } + +Using polyfills with `entry` option: + +[/packages/babel-preset-env/test/fixtures/debug/entry-no-corejs-no-import/input.js] Import of @babel/polyfill was not found. diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-no-corejs-shippedProposals/in/in.js b/packages/babel-preset-env/test/fixtures/debug/entry-no-corejs-shippedProposals/input.mjs similarity index 100% rename from packages/babel-preset-env/test/debug-fixtures/entry-no-corejs-shippedProposals/in/in.js rename to packages/babel-preset-env/test/fixtures/debug/entry-no-corejs-shippedProposals/input.mjs diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-no-corejs-shippedProposals/options.json b/packages/babel-preset-env/test/fixtures/debug/entry-no-corejs-shippedProposals/options.json new file mode 100644 index 000000000000..736ae7777264 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-no-corejs-shippedProposals/options.json @@ -0,0 +1,14 @@ +{ + "validateLogs": true, + "ignoreOutput": true, + "presets": [ + [ + "env", + { + "debug": true, + "shippedProposals": true, + "useBuiltIns": "entry" + } + ] + ] +} diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-no-corejs-shippedProposals/stderr.txt b/packages/babel-preset-env/test/fixtures/debug/entry-no-corejs-shippedProposals/stderr.txt similarity index 100% rename from packages/babel-preset-env/test/debug-fixtures/entry-no-corejs-shippedProposals/stderr.txt rename to packages/babel-preset-env/test/fixtures/debug/entry-no-corejs-shippedProposals/stderr.txt diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-no-corejs-shippedProposals/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/entry-no-corejs-shippedProposals/stdout.txt new file mode 100644 index 000000000000..d3f31edabfe2 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-no-corejs-shippedProposals/stdout.txt @@ -0,0 +1,197 @@ +@babel/preset-env: `DEBUG` option + +Using targets: +{} + +Using modules transform: auto + +Using plugins: + proposal-numeric-separator {} + proposal-nullish-coalescing-operator {} + proposal-optional-chaining {} + proposal-json-strings {} + proposal-optional-catch-binding {} + transform-parameters {} + proposal-async-generator-functions {} + proposal-object-rest-spread {} + transform-dotall-regex {} + proposal-unicode-property-regex {} + transform-named-capturing-groups-regex {} + transform-async-to-generator {} + transform-exponentiation-operator {} + transform-template-literals {} + transform-literals {} + transform-function-name {} + transform-arrow-functions {} + transform-block-scoped-functions {} + transform-classes {} + transform-object-super {} + transform-shorthand-properties {} + transform-duplicate-keys {} + transform-computed-properties {} + transform-for-of {} + transform-sticky-regex {} + transform-unicode-regex {} + transform-spread {} + transform-destructuring {} + transform-block-scoping {} + transform-typeof-symbol {} + transform-new-target {} + transform-regenerator {} + transform-member-expression-literals {} + transform-property-literals {} + transform-reserved-words {} + transform-modules-commonjs {} + proposal-dynamic-import {} + +Using polyfills with `entry` option: + +[/packages/babel-preset-env/test/fixtures/debug/entry-no-corejs-shippedProposals/input.mjs] Replaced @babel/polyfill entries with the following polyfills: + es6.array.copy-within {} + es6.array.every {} + es6.array.fill {} + es6.array.filter {} + es6.array.find {} + es6.array.find-index {} + es7.array.flat-map {} + es6.array.for-each {} + es6.array.from {} + es7.array.includes {} + es6.array.index-of {} + es6.array.is-array {} + es6.array.iterator {} + es6.array.last-index-of {} + es6.array.map {} + es6.array.of {} + es6.array.reduce {} + es6.array.reduce-right {} + es6.array.some {} + es6.array.sort {} + es6.array.species {} + es6.date.now {} + es6.date.to-iso-string {} + es6.date.to-json {} + es6.date.to-primitive {} + es6.date.to-string {} + es6.function.bind {} + es6.function.has-instance {} + es6.function.name {} + es6.map {} + es6.math.acosh {} + es6.math.asinh {} + es6.math.atanh {} + es6.math.cbrt {} + es6.math.clz32 {} + es6.math.cosh {} + es6.math.expm1 {} + es6.math.fround {} + es6.math.hypot {} + es6.math.imul {} + es6.math.log1p {} + es6.math.log10 {} + es6.math.log2 {} + es6.math.sign {} + es6.math.sinh {} + es6.math.tanh {} + es6.math.trunc {} + es6.number.constructor {} + es6.number.epsilon {} + es6.number.is-finite {} + es6.number.is-integer {} + es6.number.is-nan {} + es6.number.is-safe-integer {} + es6.number.max-safe-integer {} + es6.number.min-safe-integer {} + es6.number.parse-float {} + es6.number.parse-int {} + es6.object.assign {} + es6.object.create {} + es7.object.define-getter {} + es7.object.define-setter {} + es6.object.define-property {} + es6.object.define-properties {} + es7.object.entries {} + es6.object.freeze {} + es6.object.get-own-property-descriptor {} + es7.object.get-own-property-descriptors {} + es6.object.get-own-property-names {} + es6.object.get-prototype-of {} + es7.object.lookup-getter {} + es7.object.lookup-setter {} + es6.object.prevent-extensions {} + es6.object.to-string {} + es6.object.is {} + es6.object.is-frozen {} + es6.object.is-sealed {} + es6.object.is-extensible {} + es6.object.keys {} + es6.object.seal {} + es6.object.set-prototype-of {} + es7.object.values {} + es6.promise {} + es7.promise.finally {} + es6.reflect.apply {} + es6.reflect.construct {} + es6.reflect.define-property {} + es6.reflect.delete-property {} + es6.reflect.get {} + es6.reflect.get-own-property-descriptor {} + es6.reflect.get-prototype-of {} + es6.reflect.has {} + es6.reflect.is-extensible {} + es6.reflect.own-keys {} + es6.reflect.prevent-extensions {} + es6.reflect.set {} + es6.reflect.set-prototype-of {} + es6.regexp.constructor {} + es6.regexp.flags {} + es6.regexp.match {} + es6.regexp.replace {} + es6.regexp.split {} + es6.regexp.search {} + es6.regexp.to-string {} + es6.set {} + es6.symbol {} + es7.symbol.async-iterator {} + es6.string.anchor {} + es6.string.big {} + es6.string.blink {} + es6.string.bold {} + es6.string.code-point-at {} + es6.string.ends-with {} + es6.string.fixed {} + es6.string.fontcolor {} + es6.string.fontsize {} + es6.string.from-code-point {} + es6.string.includes {} + es6.string.italics {} + es6.string.iterator {} + es6.string.link {} + es7.string.pad-start {} + es7.string.pad-end {} + es6.string.raw {} + es6.string.repeat {} + es6.string.small {} + es6.string.starts-with {} + es6.string.strike {} + es6.string.sub {} + es6.string.sup {} + es6.string.trim {} + es7.string.trim-left {} + es7.string.trim-right {} + es6.typed.array-buffer {} + es6.typed.data-view {} + es6.typed.int8-array {} + es6.typed.uint8-array {} + es6.typed.uint8-clamped-array {} + es6.typed.int16-array {} + es6.typed.uint16-array {} + es6.typed.int32-array {} + es6.typed.uint32-array {} + es6.typed.float32-array {} + es6.typed.float64-array {} + es6.weak-map {} + es6.weak-set {} + web.timers {} + web.immediate {} + web.dom.iterable {} diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-no-corejs-uglify/in/in.js b/packages/babel-preset-env/test/fixtures/debug/entry-no-corejs-uglify/input.mjs similarity index 100% rename from packages/babel-preset-env/test/debug-fixtures/entry-no-corejs-uglify/in/in.js rename to packages/babel-preset-env/test/fixtures/debug/entry-no-corejs-uglify/input.mjs diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-no-corejs-uglify/options.json b/packages/babel-preset-env/test/fixtures/debug/entry-no-corejs-uglify/options.json new file mode 100644 index 000000000000..5e37354bd855 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-no-corejs-uglify/options.json @@ -0,0 +1,18 @@ +{ + "validateLogs": true, + "ignoreOutput": true, + "presets": [ + [ + "env", + { + "debug": true, + "targets": { + "chrome": 55, + "uglify": true + }, + "useBuiltIns": "entry", + "modules": false + } + ] + ] +} diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-no-corejs-uglify/stderr.txt b/packages/babel-preset-env/test/fixtures/debug/entry-no-corejs-uglify/stderr.txt similarity index 100% rename from packages/babel-preset-env/test/debug-fixtures/entry-no-corejs-uglify/stderr.txt rename to packages/babel-preset-env/test/fixtures/debug/entry-no-corejs-uglify/stderr.txt diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-no-corejs-uglify/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/entry-no-corejs-uglify/stdout.txt new file mode 100644 index 000000000000..f72d6ce0d339 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-no-corejs-uglify/stdout.txt @@ -0,0 +1,68 @@ +The uglify target has been deprecated. Set the top level +option `forceAllTransforms: true` instead. + +@babel/preset-env: `DEBUG` option + +Using targets: +{ + "chrome": "55" +} + +Using modules transform: false + +Using plugins: + proposal-nullish-coalescing-operator { "chrome":"55" } + proposal-optional-chaining { "chrome":"55" } + proposal-json-strings { "chrome":"55" } + proposal-optional-catch-binding { "chrome":"55" } + transform-parameters {} + proposal-async-generator-functions { "chrome":"55" } + proposal-object-rest-spread { "chrome":"55" } + transform-dotall-regex { "chrome":"55" } + proposal-unicode-property-regex { "chrome":"55" } + transform-named-capturing-groups-regex { "chrome":"55" } + transform-async-to-generator {} + transform-exponentiation-operator {} + transform-template-literals {} + transform-literals {} + transform-function-name {} + transform-arrow-functions {} + transform-block-scoped-functions {} + transform-classes {} + transform-object-super {} + transform-shorthand-properties {} + transform-duplicate-keys {} + transform-computed-properties {} + transform-for-of {} + transform-sticky-regex {} + transform-unicode-regex {} + transform-spread {} + transform-destructuring {} + transform-block-scoping {} + transform-typeof-symbol {} + transform-new-target {} + transform-regenerator {} + transform-member-expression-literals {} + transform-property-literals {} + transform-reserved-words {} + syntax-dynamic-import { "chrome":"55" } + +Using polyfills with `entry` option: + +[/packages/babel-preset-env/test/fixtures/debug/entry-no-corejs-uglify/input.mjs] Replaced @babel/polyfill entries with the following polyfills: + es7.array.flat-map { "chrome":"55" } + es6.array.sort { "chrome":"55" } + es7.object.define-getter { "chrome":"55" } + es7.object.define-setter { "chrome":"55" } + es7.object.lookup-getter { "chrome":"55" } + es7.object.lookup-setter { "chrome":"55" } + es6.object.to-string { "chrome":"55" } + es7.promise.finally { "chrome":"55" } + es7.symbol.async-iterator { "chrome":"55" } + es7.string.pad-start { "chrome":"55" } + es7.string.pad-end { "chrome":"55" } + es7.string.trim-left { "chrome":"55" } + es7.string.trim-right { "chrome":"55" } + web.timers { "chrome":"55" } + web.immediate { "chrome":"55" } + web.dom.iterable { "chrome":"55" } diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-no-corejs/in/in.js b/packages/babel-preset-env/test/fixtures/debug/entry-no-corejs/input.mjs similarity index 100% rename from packages/babel-preset-env/test/debug-fixtures/entry-no-corejs/in/in.js rename to packages/babel-preset-env/test/fixtures/debug/entry-no-corejs/input.mjs diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-no-corejs/options.json b/packages/babel-preset-env/test/fixtures/debug/entry-no-corejs/options.json new file mode 100644 index 000000000000..850e0357fd0d --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-no-corejs/options.json @@ -0,0 +1,17 @@ +{ + "validateLogs": true, + "ignoreOutput": true, + "presets": [ + [ + "env", + { + "debug": true, + "targets": { + "browsers": "chrome >= 54, ie 10", + "node": 6 + }, + "useBuiltIns": "entry" + } + ] + ] +} diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-no-corejs/stderr.txt b/packages/babel-preset-env/test/fixtures/debug/entry-no-corejs/stderr.txt similarity index 100% rename from packages/babel-preset-env/test/debug-fixtures/entry-no-corejs/stderr.txt rename to packages/babel-preset-env/test/fixtures/debug/entry-no-corejs/stderr.txt diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-no-corejs/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/entry-no-corejs/stdout.txt new file mode 100644 index 000000000000..6beee91afe13 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-no-corejs/stdout.txt @@ -0,0 +1,177 @@ +@babel/preset-env: `DEBUG` option + +Using targets: +{ + "chrome": "54", + "ie": "10", + "node": "6" +} + +Using modules transform: auto + +Using plugins: + proposal-nullish-coalescing-operator { "chrome":"54", "ie":"10", "node":"6" } + proposal-optional-chaining { "chrome":"54", "ie":"10", "node":"6" } + proposal-json-strings { "chrome":"54", "ie":"10", "node":"6" } + proposal-optional-catch-binding { "chrome":"54", "ie":"10", "node":"6" } + transform-parameters { "ie":"10" } + proposal-async-generator-functions { "chrome":"54", "ie":"10", "node":"6" } + proposal-object-rest-spread { "chrome":"54", "ie":"10", "node":"6" } + transform-dotall-regex { "chrome":"54", "ie":"10", "node":"6" } + proposal-unicode-property-regex { "chrome":"54", "ie":"10", "node":"6" } + transform-named-capturing-groups-regex { "chrome":"54", "ie":"10", "node":"6" } + transform-async-to-generator { "chrome":"54", "ie":"10", "node":"6" } + transform-exponentiation-operator { "ie":"10", "node":"6" } + transform-template-literals { "ie":"10" } + transform-literals { "ie":"10" } + transform-function-name { "ie":"10", "node":"6" } + transform-arrow-functions { "ie":"10" } + transform-block-scoped-functions { "ie":"10" } + transform-classes { "ie":"10" } + transform-object-super { "ie":"10" } + transform-shorthand-properties { "ie":"10" } + transform-duplicate-keys { "ie":"10" } + transform-computed-properties { "ie":"10" } + transform-for-of { "ie":"10", "node":"6" } + transform-sticky-regex { "ie":"10" } + transform-unicode-regex { "ie":"10" } + transform-spread { "ie":"10" } + transform-destructuring { "ie":"10", "node":"6" } + transform-block-scoping { "ie":"10" } + transform-typeof-symbol { "ie":"10" } + transform-new-target { "ie":"10" } + transform-regenerator { "ie":"10" } + transform-modules-commonjs { "chrome":"54", "ie":"10", "node":"6" } + proposal-dynamic-import { "chrome":"54", "ie":"10", "node":"6" } + +Using polyfills with `entry` option: + +[/packages/babel-preset-env/test/fixtures/debug/entry-no-corejs/input.mjs] Replaced @babel/polyfill entries with the following polyfills: + es6.array.copy-within { "ie":"10" } + es6.array.fill { "ie":"10" } + es6.array.find { "ie":"10" } + es6.array.find-index { "ie":"10" } + es7.array.flat-map { "chrome":"54", "ie":"10", "node":"6" } + es6.array.from { "ie":"10", "node":"6" } + es7.array.includes { "ie":"10" } + es6.array.iterator { "ie":"10" } + es6.array.of { "ie":"10" } + es6.array.sort { "chrome":"54", "node":"6" } + es6.array.species { "ie":"10", "node":"6" } + es6.date.to-primitive { "ie":"10" } + es6.function.has-instance { "ie":"10", "node":"6" } + es6.function.name { "ie":"10" } + es6.map { "ie":"10", "node":"6" } + es6.math.acosh { "ie":"10" } + es6.math.asinh { "ie":"10" } + es6.math.atanh { "ie":"10" } + es6.math.cbrt { "ie":"10" } + es6.math.clz32 { "ie":"10" } + es6.math.cosh { "ie":"10" } + es6.math.expm1 { "ie":"10" } + es6.math.fround { "ie":"10" } + es6.math.hypot { "ie":"10" } + es6.math.imul { "ie":"10" } + es6.math.log1p { "ie":"10" } + es6.math.log10 { "ie":"10" } + es6.math.log2 { "ie":"10" } + es6.math.sign { "ie":"10" } + es6.math.sinh { "ie":"10" } + es6.math.tanh { "ie":"10" } + es6.math.trunc { "ie":"10" } + es6.number.constructor { "ie":"10" } + es6.number.epsilon { "ie":"10" } + es6.number.is-finite { "ie":"10" } + es6.number.is-integer { "ie":"10" } + es6.number.is-nan { "ie":"10" } + es6.number.is-safe-integer { "ie":"10" } + es6.number.max-safe-integer { "ie":"10" } + es6.number.min-safe-integer { "ie":"10" } + es6.number.parse-float { "ie":"10" } + es6.number.parse-int { "ie":"10" } + es6.object.assign { "ie":"10" } + es7.object.define-getter { "chrome":"54", "ie":"10", "node":"6" } + es7.object.define-setter { "chrome":"54", "ie":"10", "node":"6" } + es7.object.entries { "ie":"10", "node":"6" } + es6.object.freeze { "ie":"10" } + es6.object.get-own-property-descriptor { "ie":"10" } + es7.object.get-own-property-descriptors { "ie":"10", "node":"6" } + es6.object.get-own-property-names { "ie":"10" } + es6.object.get-prototype-of { "ie":"10" } + es7.object.lookup-getter { "chrome":"54", "ie":"10", "node":"6" } + es7.object.lookup-setter { "chrome":"54", "ie":"10", "node":"6" } + es6.object.prevent-extensions { "ie":"10" } + es6.object.to-string { "chrome":"54", "ie":"10", "node":"6" } + es6.object.is { "ie":"10" } + es6.object.is-frozen { "ie":"10" } + es6.object.is-sealed { "ie":"10" } + es6.object.is-extensible { "ie":"10" } + es6.object.keys { "ie":"10" } + es6.object.seal { "ie":"10" } + es6.object.set-prototype-of { "ie":"10" } + es7.object.values { "ie":"10", "node":"6" } + es6.promise { "ie":"10", "node":"6" } + es7.promise.finally { "chrome":"54", "ie":"10", "node":"6" } + es6.reflect.apply { "ie":"10" } + es6.reflect.construct { "ie":"10" } + es6.reflect.define-property { "ie":"10" } + es6.reflect.delete-property { "ie":"10" } + es6.reflect.get { "ie":"10" } + es6.reflect.get-own-property-descriptor { "ie":"10" } + es6.reflect.get-prototype-of { "ie":"10" } + es6.reflect.has { "ie":"10" } + es6.reflect.is-extensible { "ie":"10" } + es6.reflect.own-keys { "ie":"10" } + es6.reflect.prevent-extensions { "ie":"10" } + es6.reflect.set { "ie":"10" } + es6.reflect.set-prototype-of { "ie":"10" } + es6.regexp.constructor { "ie":"10" } + es6.regexp.flags { "ie":"10" } + es6.regexp.match { "ie":"10" } + es6.regexp.replace { "ie":"10" } + es6.regexp.split { "ie":"10" } + es6.regexp.search { "ie":"10" } + es6.regexp.to-string { "ie":"10" } + es6.set { "ie":"10", "node":"6" } + es6.symbol { "ie":"10", "node":"6" } + es7.symbol.async-iterator { "chrome":"54", "ie":"10", "node":"6" } + es6.string.anchor { "ie":"10" } + es6.string.big { "ie":"10" } + es6.string.blink { "ie":"10" } + es6.string.bold { "ie":"10" } + es6.string.code-point-at { "ie":"10" } + es6.string.ends-with { "ie":"10" } + es6.string.fixed { "ie":"10" } + es6.string.fontcolor { "ie":"10" } + es6.string.fontsize { "ie":"10" } + es6.string.from-code-point { "ie":"10" } + es6.string.includes { "ie":"10" } + es6.string.italics { "ie":"10" } + es6.string.iterator { "ie":"10" } + es6.string.link { "ie":"10" } + es7.string.pad-start { "chrome":"54", "ie":"10", "node":"6" } + es7.string.pad-end { "chrome":"54", "ie":"10", "node":"6" } + es6.string.raw { "ie":"10" } + es6.string.repeat { "ie":"10" } + es6.string.small { "ie":"10" } + es6.string.starts-with { "ie":"10" } + es6.string.strike { "ie":"10" } + es6.string.sub { "ie":"10" } + es6.string.sup { "ie":"10" } + es7.string.trim-left { "chrome":"54", "ie":"10", "node":"6" } + es7.string.trim-right { "chrome":"54", "ie":"10", "node":"6" } + es6.typed.array-buffer { "ie":"10", "node":"6" } + es6.typed.int8-array { "ie":"10", "node":"6" } + es6.typed.uint8-array { "ie":"10", "node":"6" } + es6.typed.uint8-clamped-array { "ie":"10", "node":"6" } + es6.typed.int16-array { "ie":"10", "node":"6" } + es6.typed.uint16-array { "ie":"10", "node":"6" } + es6.typed.int32-array { "ie":"10", "node":"6" } + es6.typed.uint32-array { "ie":"10", "node":"6" } + es6.typed.float32-array { "ie":"10", "node":"6" } + es6.typed.float64-array { "ie":"10", "node":"6" } + es6.weak-map { "ie":"10", "node":"6" } + es6.weak-set { "ie":"10", "node":"6" } + web.timers { "chrome":"54", "ie":"10", "node":"6" } + web.immediate { "chrome":"54", "ie":"10", "node":"6" } + web.dom.iterable { "chrome":"54", "ie":"10", "node":"6" } diff --git a/packages/babel-preset-env/test/debug-fixtures/plugins-only/in/in.js b/packages/babel-preset-env/test/fixtures/debug/plugins-only/input.mjs similarity index 100% rename from packages/babel-preset-env/test/debug-fixtures/plugins-only/in/in.js rename to packages/babel-preset-env/test/fixtures/debug/plugins-only/input.mjs diff --git a/packages/babel-preset-env/test/fixtures/debug/plugins-only/options.json b/packages/babel-preset-env/test/fixtures/debug/plugins-only/options.json new file mode 100644 index 000000000000..fb4eeeaf5e71 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/plugins-only/options.json @@ -0,0 +1,22 @@ +{ + "validateLogs": true, + "ignoreOutput": true, + "presets": [ + [ + "env", + { + "debug": true, + "exclude": [ + "transform-async-to-generator", + "transform-regenerator", + "transform-parameters" + ], + "targets": { + "firefox": 52, + "node": 7.4 + }, + "useBuiltIns": false + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/debug/plugins-only/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/plugins-only/stdout.txt new file mode 100644 index 000000000000..5df73c211101 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/plugins-only/stdout.txt @@ -0,0 +1,35 @@ +Warning, the following targets are using a decimal version: + + node: 7.4 + +We recommend using a string for minor/patch versions to avoid numbers like 6.10 +getting parsed as 6.1, which can lead to unexpected behavior. + +@babel/preset-env: `DEBUG` option + +Using targets: +{ + "firefox": "52", + "node": "7.4" +} + +Using modules transform: auto + +Using plugins: + proposal-nullish-coalescing-operator { "firefox":"52", "node":"7.4" } + proposal-optional-chaining { "firefox":"52", "node":"7.4" } + proposal-json-strings { "firefox":"52", "node":"7.4" } + proposal-optional-catch-binding { "firefox":"52", "node":"7.4" } + proposal-async-generator-functions { "firefox":"52", "node":"7.4" } + proposal-object-rest-spread { "firefox":"52", "node":"7.4" } + transform-dotall-regex { "firefox":"52", "node":"7.4" } + proposal-unicode-property-regex { "firefox":"52", "node":"7.4" } + transform-named-capturing-groups-regex { "firefox":"52", "node":"7.4" } + transform-literals { "firefox":"52" } + transform-function-name { "firefox":"52" } + transform-for-of { "firefox":"52" } + transform-destructuring { "firefox":"52" } + transform-modules-commonjs { "firefox":"52", "node":"7.4" } + proposal-dynamic-import { "firefox":"52", "node":"7.4" } + +Using polyfills: No polyfills were added, since the `useBuiltIns` option was not set. diff --git a/packages/babel-preset-env/test/debug-fixtures/usage-corejs2-chrome-71/in/in.js b/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-1/input.js similarity index 100% rename from packages/babel-preset-env/test/debug-fixtures/usage-corejs2-chrome-71/in/in.js rename to packages/babel-preset-env/test/fixtures/debug/usage-corejs2-1/input.js diff --git a/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-1/options.json b/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-1/options.json new file mode 100644 index 000000000000..bc84c3a017cd --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-1/options.json @@ -0,0 +1,19 @@ +{ + "validateLogs": true, + "ignoreOutput": true, + "presets": [ + [ + "env", + { + "debug": true, + "targets": { + "chrome": 52, + "firefox": 50, + "ie": 11 + }, + "useBuiltIns": "usage", + "corejs": 2 + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-1/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-1/stdout.txt new file mode 100644 index 000000000000..86d9ee9c268a --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-1/stdout.txt @@ -0,0 +1,54 @@ +@babel/preset-env: `DEBUG` option + +Using targets: +{ + "chrome": "52", + "firefox": "50", + "ie": "11" +} + +Using modules transform: auto + +Using plugins: + proposal-nullish-coalescing-operator { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-optional-chaining { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-json-strings { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-optional-catch-binding { "chrome":"52", "firefox":"50", "ie":"11" } + transform-parameters { "firefox":"50", "ie":"11" } + proposal-async-generator-functions { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-object-rest-spread { "chrome":"52", "firefox":"50", "ie":"11" } + transform-dotall-regex { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-unicode-property-regex { "chrome":"52", "firefox":"50", "ie":"11" } + transform-named-capturing-groups-regex { "chrome":"52", "firefox":"50", "ie":"11" } + transform-async-to-generator { "chrome":"52", "firefox":"50", "ie":"11" } + transform-exponentiation-operator { "firefox":"50", "ie":"11" } + transform-template-literals { "ie":"11" } + transform-literals { "firefox":"50", "ie":"11" } + transform-function-name { "firefox":"50", "ie":"11" } + transform-arrow-functions { "ie":"11" } + transform-classes { "ie":"11" } + transform-object-super { "ie":"11" } + transform-shorthand-properties { "ie":"11" } + transform-duplicate-keys { "ie":"11" } + transform-computed-properties { "ie":"11" } + transform-for-of { "firefox":"50", "ie":"11" } + transform-sticky-regex { "ie":"11" } + transform-unicode-regex { "ie":"11" } + transform-spread { "ie":"11" } + transform-destructuring { "firefox":"50", "ie":"11" } + transform-block-scoping { "firefox":"50", "ie":"11" } + transform-typeof-symbol { "ie":"11" } + transform-new-target { "ie":"11" } + transform-regenerator { "firefox":"50", "ie":"11" } + transform-modules-commonjs { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-dynamic-import { "chrome":"52", "firefox":"50", "ie":"11" } + +Using polyfills with `usage` option: + +[/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-1/input.js] Added following core-js polyfills: + es6.object.to-string { "chrome":"52", "firefox":"50", "ie":"11" } + es6.promise { "ie":"11" } + es6.map { "firefox":"50", "ie":"11" } + es6.string.iterator { "ie":"11" } + es6.array.iterator { "ie":"11" } + web.dom.iterable { "chrome":"52", "firefox":"50", "ie":"11" } diff --git a/packages/babel-preset-env/test/debug-fixtures/usage-corejs2-chrome-71/in/in2.js b/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-2/input.js similarity index 100% rename from packages/babel-preset-env/test/debug-fixtures/usage-corejs2-chrome-71/in/in2.js rename to packages/babel-preset-env/test/fixtures/debug/usage-corejs2-2/input.js diff --git a/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-2/options.json b/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-2/options.json new file mode 100644 index 000000000000..bc84c3a017cd --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-2/options.json @@ -0,0 +1,19 @@ +{ + "validateLogs": true, + "ignoreOutput": true, + "presets": [ + [ + "env", + { + "debug": true, + "targets": { + "chrome": 52, + "firefox": 50, + "ie": 11 + }, + "useBuiltIns": "usage", + "corejs": 2 + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-2/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-2/stdout.txt new file mode 100644 index 000000000000..0a9ec16db807 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-2/stdout.txt @@ -0,0 +1,51 @@ +@babel/preset-env: `DEBUG` option + +Using targets: +{ + "chrome": "52", + "firefox": "50", + "ie": "11" +} + +Using modules transform: auto + +Using plugins: + proposal-nullish-coalescing-operator { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-optional-chaining { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-json-strings { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-optional-catch-binding { "chrome":"52", "firefox":"50", "ie":"11" } + transform-parameters { "firefox":"50", "ie":"11" } + proposal-async-generator-functions { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-object-rest-spread { "chrome":"52", "firefox":"50", "ie":"11" } + transform-dotall-regex { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-unicode-property-regex { "chrome":"52", "firefox":"50", "ie":"11" } + transform-named-capturing-groups-regex { "chrome":"52", "firefox":"50", "ie":"11" } + transform-async-to-generator { "chrome":"52", "firefox":"50", "ie":"11" } + transform-exponentiation-operator { "firefox":"50", "ie":"11" } + transform-template-literals { "ie":"11" } + transform-literals { "firefox":"50", "ie":"11" } + transform-function-name { "firefox":"50", "ie":"11" } + transform-arrow-functions { "ie":"11" } + transform-classes { "ie":"11" } + transform-object-super { "ie":"11" } + transform-shorthand-properties { "ie":"11" } + transform-duplicate-keys { "ie":"11" } + transform-computed-properties { "ie":"11" } + transform-for-of { "firefox":"50", "ie":"11" } + transform-sticky-regex { "ie":"11" } + transform-unicode-regex { "ie":"11" } + transform-spread { "ie":"11" } + transform-destructuring { "firefox":"50", "ie":"11" } + transform-block-scoping { "firefox":"50", "ie":"11" } + transform-typeof-symbol { "ie":"11" } + transform-new-target { "ie":"11" } + transform-regenerator { "firefox":"50", "ie":"11" } + transform-modules-commonjs { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-dynamic-import { "chrome":"52", "firefox":"50", "ie":"11" } + +Using polyfills with `usage` option: + +[/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-2/input.js] Added following core-js polyfill: + web.dom.iterable { "chrome":"52", "firefox":"50", "ie":"11" } + +[/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-2/input.js] Based on your code and targets, added regenerator-runtime. diff --git a/packages/babel-preset-env/test/debug-fixtures/usage-corejs2-proposals-chrome-71/in/in.js b/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-chrome-71-1/input.js similarity index 100% rename from packages/babel-preset-env/test/debug-fixtures/usage-corejs2-proposals-chrome-71/in/in.js rename to packages/babel-preset-env/test/fixtures/debug/usage-corejs2-chrome-71-1/input.js diff --git a/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-chrome-71-1/options.json b/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-chrome-71-1/options.json new file mode 100644 index 000000000000..d028d3be910f --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-chrome-71-1/options.json @@ -0,0 +1,17 @@ +{ + "validateLogs": true, + "ignoreOutput": true, + "presets": [ + [ + "env", + { + "debug": true, + "targets": { + "chrome": 71 + }, + "useBuiltIns": "usage", + "corejs": 2 + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-chrome-71-1/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-chrome-71-1/stdout.txt new file mode 100644 index 000000000000..86ae8fc24991 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-chrome-71-1/stdout.txt @@ -0,0 +1,23 @@ +@babel/preset-env: `DEBUG` option + +Using targets: +{ + "chrome": "71" +} + +Using modules transform: auto + +Using plugins: + proposal-nullish-coalescing-operator { "chrome":"71" } + proposal-optional-chaining { "chrome":"71" } + syntax-json-strings { "chrome":"71" } + syntax-optional-catch-binding { "chrome":"71" } + syntax-async-generators { "chrome":"71" } + syntax-object-rest-spread { "chrome":"71" } + transform-modules-commonjs { "chrome":"71" } + proposal-dynamic-import { "chrome":"71" } + +Using polyfills with `usage` option: + +[/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-chrome-71-1/input.js] Added following core-js polyfill: + web.dom.iterable { "chrome":"71" } diff --git a/packages/babel-preset-env/test/debug-fixtures/usage-corejs2-proposals-chrome-71/in/in2.js b/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-chrome-71-2/input.js similarity index 100% rename from packages/babel-preset-env/test/debug-fixtures/usage-corejs2-proposals-chrome-71/in/in2.js rename to packages/babel-preset-env/test/fixtures/debug/usage-corejs2-chrome-71-2/input.js diff --git a/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-chrome-71-2/options.json b/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-chrome-71-2/options.json new file mode 100644 index 000000000000..d028d3be910f --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-chrome-71-2/options.json @@ -0,0 +1,17 @@ +{ + "validateLogs": true, + "ignoreOutput": true, + "presets": [ + [ + "env", + { + "debug": true, + "targets": { + "chrome": 71 + }, + "useBuiltIns": "usage", + "corejs": 2 + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-chrome-71-2/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-chrome-71-2/stdout.txt new file mode 100644 index 000000000000..d1ed996d7e2c --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-chrome-71-2/stdout.txt @@ -0,0 +1,23 @@ +@babel/preset-env: `DEBUG` option + +Using targets: +{ + "chrome": "71" +} + +Using modules transform: auto + +Using plugins: + proposal-nullish-coalescing-operator { "chrome":"71" } + proposal-optional-chaining { "chrome":"71" } + syntax-json-strings { "chrome":"71" } + syntax-optional-catch-binding { "chrome":"71" } + syntax-async-generators { "chrome":"71" } + syntax-object-rest-spread { "chrome":"71" } + transform-modules-commonjs { "chrome":"71" } + proposal-dynamic-import { "chrome":"71" } + +Using polyfills with `usage` option: + +[/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-chrome-71-2/input.js] Added following core-js polyfill: + web.dom.iterable { "chrome":"71" } diff --git a/packages/babel-preset-env/test/debug-fixtures/usage-corejs2-none/in/in.js b/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-none-1/input.js similarity index 100% rename from packages/babel-preset-env/test/debug-fixtures/usage-corejs2-none/in/in.js rename to packages/babel-preset-env/test/fixtures/debug/usage-corejs2-none-1/input.js diff --git a/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-none-1/options.json b/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-none-1/options.json new file mode 100644 index 000000000000..bc84c3a017cd --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-none-1/options.json @@ -0,0 +1,19 @@ +{ + "validateLogs": true, + "ignoreOutput": true, + "presets": [ + [ + "env", + { + "debug": true, + "targets": { + "chrome": 52, + "firefox": 50, + "ie": 11 + }, + "useBuiltIns": "usage", + "corejs": 2 + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-none-1/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-none-1/stdout.txt new file mode 100644 index 000000000000..6d8652b78cdc --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-none-1/stdout.txt @@ -0,0 +1,48 @@ +@babel/preset-env: `DEBUG` option + +Using targets: +{ + "chrome": "52", + "firefox": "50", + "ie": "11" +} + +Using modules transform: auto + +Using plugins: + proposal-nullish-coalescing-operator { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-optional-chaining { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-json-strings { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-optional-catch-binding { "chrome":"52", "firefox":"50", "ie":"11" } + transform-parameters { "firefox":"50", "ie":"11" } + proposal-async-generator-functions { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-object-rest-spread { "chrome":"52", "firefox":"50", "ie":"11" } + transform-dotall-regex { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-unicode-property-regex { "chrome":"52", "firefox":"50", "ie":"11" } + transform-named-capturing-groups-regex { "chrome":"52", "firefox":"50", "ie":"11" } + transform-async-to-generator { "chrome":"52", "firefox":"50", "ie":"11" } + transform-exponentiation-operator { "firefox":"50", "ie":"11" } + transform-template-literals { "ie":"11" } + transform-literals { "firefox":"50", "ie":"11" } + transform-function-name { "firefox":"50", "ie":"11" } + transform-arrow-functions { "ie":"11" } + transform-classes { "ie":"11" } + transform-object-super { "ie":"11" } + transform-shorthand-properties { "ie":"11" } + transform-duplicate-keys { "ie":"11" } + transform-computed-properties { "ie":"11" } + transform-for-of { "firefox":"50", "ie":"11" } + transform-sticky-regex { "ie":"11" } + transform-unicode-regex { "ie":"11" } + transform-spread { "ie":"11" } + transform-destructuring { "firefox":"50", "ie":"11" } + transform-block-scoping { "firefox":"50", "ie":"11" } + transform-typeof-symbol { "ie":"11" } + transform-new-target { "ie":"11" } + transform-regenerator { "firefox":"50", "ie":"11" } + transform-modules-commonjs { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-dynamic-import { "chrome":"52", "firefox":"50", "ie":"11" } + +Using polyfills with `usage` option: + +[/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-none-1/input.js] Based on your code and targets, core-js polyfills were not added. diff --git a/packages/babel-preset-env/test/debug-fixtures/usage-corejs2-none/in/in2.js b/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-none-2/input.js similarity index 100% rename from packages/babel-preset-env/test/debug-fixtures/usage-corejs2-none/in/in2.js rename to packages/babel-preset-env/test/fixtures/debug/usage-corejs2-none-2/input.js diff --git a/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-none-2/options.json b/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-none-2/options.json new file mode 100644 index 000000000000..bc84c3a017cd --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-none-2/options.json @@ -0,0 +1,19 @@ +{ + "validateLogs": true, + "ignoreOutput": true, + "presets": [ + [ + "env", + { + "debug": true, + "targets": { + "chrome": 52, + "firefox": 50, + "ie": 11 + }, + "useBuiltIns": "usage", + "corejs": 2 + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-none-2/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-none-2/stdout.txt new file mode 100644 index 000000000000..ccc7599dda50 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-none-2/stdout.txt @@ -0,0 +1,48 @@ +@babel/preset-env: `DEBUG` option + +Using targets: +{ + "chrome": "52", + "firefox": "50", + "ie": "11" +} + +Using modules transform: auto + +Using plugins: + proposal-nullish-coalescing-operator { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-optional-chaining { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-json-strings { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-optional-catch-binding { "chrome":"52", "firefox":"50", "ie":"11" } + transform-parameters { "firefox":"50", "ie":"11" } + proposal-async-generator-functions { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-object-rest-spread { "chrome":"52", "firefox":"50", "ie":"11" } + transform-dotall-regex { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-unicode-property-regex { "chrome":"52", "firefox":"50", "ie":"11" } + transform-named-capturing-groups-regex { "chrome":"52", "firefox":"50", "ie":"11" } + transform-async-to-generator { "chrome":"52", "firefox":"50", "ie":"11" } + transform-exponentiation-operator { "firefox":"50", "ie":"11" } + transform-template-literals { "ie":"11" } + transform-literals { "firefox":"50", "ie":"11" } + transform-function-name { "firefox":"50", "ie":"11" } + transform-arrow-functions { "ie":"11" } + transform-classes { "ie":"11" } + transform-object-super { "ie":"11" } + transform-shorthand-properties { "ie":"11" } + transform-duplicate-keys { "ie":"11" } + transform-computed-properties { "ie":"11" } + transform-for-of { "firefox":"50", "ie":"11" } + transform-sticky-regex { "ie":"11" } + transform-unicode-regex { "ie":"11" } + transform-spread { "ie":"11" } + transform-destructuring { "firefox":"50", "ie":"11" } + transform-block-scoping { "firefox":"50", "ie":"11" } + transform-typeof-symbol { "ie":"11" } + transform-new-target { "ie":"11" } + transform-regenerator { "firefox":"50", "ie":"11" } + transform-modules-commonjs { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-dynamic-import { "chrome":"52", "firefox":"50", "ie":"11" } + +Using polyfills with `usage` option: + +[/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-none-2/input.js] Based on your code and targets, core-js polyfills were not added. diff --git a/packages/babel-preset-env/test/debug-fixtures/usage-corejs2-proposals/in/in.js b/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-proposals-1/input.js similarity index 100% rename from packages/babel-preset-env/test/debug-fixtures/usage-corejs2-proposals/in/in.js rename to packages/babel-preset-env/test/fixtures/debug/usage-corejs2-proposals-1/input.js diff --git a/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-proposals-1/options.json b/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-proposals-1/options.json new file mode 100644 index 000000000000..17e594c8c6f1 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-proposals-1/options.json @@ -0,0 +1,19 @@ +{ + "validateLogs": true, + "ignoreOutput": true, + "presets": [ + [ + "env", + { + "debug": true, + "targets": { + "chrome": 52, + "firefox": 50, + "ie": 11 + }, + "useBuiltIns": "usage", + "corejs": { "version": 2, "proposals": true } + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-proposals-1/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-proposals-1/stdout.txt new file mode 100644 index 000000000000..cd711febc4cc --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-proposals-1/stdout.txt @@ -0,0 +1,54 @@ +@babel/preset-env: `DEBUG` option + +Using targets: +{ + "chrome": "52", + "firefox": "50", + "ie": "11" +} + +Using modules transform: auto + +Using plugins: + proposal-nullish-coalescing-operator { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-optional-chaining { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-json-strings { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-optional-catch-binding { "chrome":"52", "firefox":"50", "ie":"11" } + transform-parameters { "firefox":"50", "ie":"11" } + proposal-async-generator-functions { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-object-rest-spread { "chrome":"52", "firefox":"50", "ie":"11" } + transform-dotall-regex { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-unicode-property-regex { "chrome":"52", "firefox":"50", "ie":"11" } + transform-named-capturing-groups-regex { "chrome":"52", "firefox":"50", "ie":"11" } + transform-async-to-generator { "chrome":"52", "firefox":"50", "ie":"11" } + transform-exponentiation-operator { "firefox":"50", "ie":"11" } + transform-template-literals { "ie":"11" } + transform-literals { "firefox":"50", "ie":"11" } + transform-function-name { "firefox":"50", "ie":"11" } + transform-arrow-functions { "ie":"11" } + transform-classes { "ie":"11" } + transform-object-super { "ie":"11" } + transform-shorthand-properties { "ie":"11" } + transform-duplicate-keys { "ie":"11" } + transform-computed-properties { "ie":"11" } + transform-for-of { "firefox":"50", "ie":"11" } + transform-sticky-regex { "ie":"11" } + transform-unicode-regex { "ie":"11" } + transform-spread { "ie":"11" } + transform-destructuring { "firefox":"50", "ie":"11" } + transform-block-scoping { "firefox":"50", "ie":"11" } + transform-typeof-symbol { "ie":"11" } + transform-new-target { "ie":"11" } + transform-regenerator { "firefox":"50", "ie":"11" } + transform-modules-commonjs { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-dynamic-import { "chrome":"52", "firefox":"50", "ie":"11" } + +Using polyfills with `usage` option: + +[/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-proposals-1/input.js] Added following core-js polyfills: + es6.object.to-string { "chrome":"52", "firefox":"50", "ie":"11" } + es6.promise { "ie":"11" } + es6.map { "firefox":"50", "ie":"11" } + es6.string.iterator { "ie":"11" } + es6.array.iterator { "ie":"11" } + web.dom.iterable { "chrome":"52", "firefox":"50", "ie":"11" } diff --git a/packages/babel-preset-env/test/debug-fixtures/usage-corejs2-proposals/in/in2.js b/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-proposals-2/input.js similarity index 100% rename from packages/babel-preset-env/test/debug-fixtures/usage-corejs2-proposals/in/in2.js rename to packages/babel-preset-env/test/fixtures/debug/usage-corejs2-proposals-2/input.js diff --git a/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-proposals-2/options.json b/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-proposals-2/options.json new file mode 100644 index 000000000000..17e594c8c6f1 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-proposals-2/options.json @@ -0,0 +1,19 @@ +{ + "validateLogs": true, + "ignoreOutput": true, + "presets": [ + [ + "env", + { + "debug": true, + "targets": { + "chrome": 52, + "firefox": 50, + "ie": 11 + }, + "useBuiltIns": "usage", + "corejs": { "version": 2, "proposals": true } + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-proposals-2/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-proposals-2/stdout.txt new file mode 100644 index 000000000000..ace7d9316f59 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-proposals-2/stdout.txt @@ -0,0 +1,51 @@ +@babel/preset-env: `DEBUG` option + +Using targets: +{ + "chrome": "52", + "firefox": "50", + "ie": "11" +} + +Using modules transform: auto + +Using plugins: + proposal-nullish-coalescing-operator { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-optional-chaining { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-json-strings { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-optional-catch-binding { "chrome":"52", "firefox":"50", "ie":"11" } + transform-parameters { "firefox":"50", "ie":"11" } + proposal-async-generator-functions { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-object-rest-spread { "chrome":"52", "firefox":"50", "ie":"11" } + transform-dotall-regex { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-unicode-property-regex { "chrome":"52", "firefox":"50", "ie":"11" } + transform-named-capturing-groups-regex { "chrome":"52", "firefox":"50", "ie":"11" } + transform-async-to-generator { "chrome":"52", "firefox":"50", "ie":"11" } + transform-exponentiation-operator { "firefox":"50", "ie":"11" } + transform-template-literals { "ie":"11" } + transform-literals { "firefox":"50", "ie":"11" } + transform-function-name { "firefox":"50", "ie":"11" } + transform-arrow-functions { "ie":"11" } + transform-classes { "ie":"11" } + transform-object-super { "ie":"11" } + transform-shorthand-properties { "ie":"11" } + transform-duplicate-keys { "ie":"11" } + transform-computed-properties { "ie":"11" } + transform-for-of { "firefox":"50", "ie":"11" } + transform-sticky-regex { "ie":"11" } + transform-unicode-regex { "ie":"11" } + transform-spread { "ie":"11" } + transform-destructuring { "firefox":"50", "ie":"11" } + transform-block-scoping { "firefox":"50", "ie":"11" } + transform-typeof-symbol { "ie":"11" } + transform-new-target { "ie":"11" } + transform-regenerator { "firefox":"50", "ie":"11" } + transform-modules-commonjs { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-dynamic-import { "chrome":"52", "firefox":"50", "ie":"11" } + +Using polyfills with `usage` option: + +[/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-proposals-2/input.js] Added following core-js polyfill: + web.dom.iterable { "chrome":"52", "firefox":"50", "ie":"11" } + +[/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-proposals-2/input.js] Based on your code and targets, added regenerator-runtime. diff --git a/packages/babel-preset-env/test/debug-fixtures/usage-corejs2-shippedProposals/in/in.js b/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-proposals-chrome-71-1/input.js similarity index 100% rename from packages/babel-preset-env/test/debug-fixtures/usage-corejs2-shippedProposals/in/in.js rename to packages/babel-preset-env/test/fixtures/debug/usage-corejs2-proposals-chrome-71-1/input.js diff --git a/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-proposals-chrome-71-1/options.json b/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-proposals-chrome-71-1/options.json new file mode 100644 index 000000000000..7239e5721426 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-proposals-chrome-71-1/options.json @@ -0,0 +1,17 @@ +{ + "validateLogs": true, + "ignoreOutput": true, + "presets": [ + [ + "env", + { + "debug": true, + "targets": { + "chrome": 71 + }, + "useBuiltIns": "usage", + "corejs": { "version": 2, "proposals": true } + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-proposals-chrome-71-1/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-proposals-chrome-71-1/stdout.txt new file mode 100644 index 000000000000..130f8d8d3002 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-proposals-chrome-71-1/stdout.txt @@ -0,0 +1,23 @@ +@babel/preset-env: `DEBUG` option + +Using targets: +{ + "chrome": "71" +} + +Using modules transform: auto + +Using plugins: + proposal-nullish-coalescing-operator { "chrome":"71" } + proposal-optional-chaining { "chrome":"71" } + syntax-json-strings { "chrome":"71" } + syntax-optional-catch-binding { "chrome":"71" } + syntax-async-generators { "chrome":"71" } + syntax-object-rest-spread { "chrome":"71" } + transform-modules-commonjs { "chrome":"71" } + proposal-dynamic-import { "chrome":"71" } + +Using polyfills with `usage` option: + +[/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-proposals-chrome-71-1/input.js] Added following core-js polyfill: + web.dom.iterable { "chrome":"71" } diff --git a/packages/babel-preset-env/test/debug-fixtures/usage-corejs2-shippedProposals/in/in2.js b/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-proposals-chrome-71-2/input.js similarity index 100% rename from packages/babel-preset-env/test/debug-fixtures/usage-corejs2-shippedProposals/in/in2.js rename to packages/babel-preset-env/test/fixtures/debug/usage-corejs2-proposals-chrome-71-2/input.js diff --git a/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-proposals-chrome-71-2/options.json b/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-proposals-chrome-71-2/options.json new file mode 100644 index 000000000000..7239e5721426 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-proposals-chrome-71-2/options.json @@ -0,0 +1,17 @@ +{ + "validateLogs": true, + "ignoreOutput": true, + "presets": [ + [ + "env", + { + "debug": true, + "targets": { + "chrome": 71 + }, + "useBuiltIns": "usage", + "corejs": { "version": 2, "proposals": true } + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-proposals-chrome-71-2/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-proposals-chrome-71-2/stdout.txt new file mode 100644 index 000000000000..efe8c9bf0a24 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-proposals-chrome-71-2/stdout.txt @@ -0,0 +1,23 @@ +@babel/preset-env: `DEBUG` option + +Using targets: +{ + "chrome": "71" +} + +Using modules transform: auto + +Using plugins: + proposal-nullish-coalescing-operator { "chrome":"71" } + proposal-optional-chaining { "chrome":"71" } + syntax-json-strings { "chrome":"71" } + syntax-optional-catch-binding { "chrome":"71" } + syntax-async-generators { "chrome":"71" } + syntax-object-rest-spread { "chrome":"71" } + transform-modules-commonjs { "chrome":"71" } + proposal-dynamic-import { "chrome":"71" } + +Using polyfills with `usage` option: + +[/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-proposals-chrome-71-2/input.js] Added following core-js polyfill: + web.dom.iterable { "chrome":"71" } diff --git a/packages/babel-preset-env/test/debug-fixtures/usage-corejs2/in/in.js b/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-shippedProposals-1/input.js similarity index 100% rename from packages/babel-preset-env/test/debug-fixtures/usage-corejs2/in/in.js rename to packages/babel-preset-env/test/fixtures/debug/usage-corejs2-shippedProposals-1/input.js diff --git a/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-shippedProposals-1/options.json b/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-shippedProposals-1/options.json new file mode 100644 index 000000000000..9069c3b78807 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-shippedProposals-1/options.json @@ -0,0 +1,20 @@ +{ + "validateLogs": true, + "ignoreOutput": true, + "presets": [ + [ + "env", + { + "debug": true, + "targets": { + "chrome": 52, + "firefox": 50, + "ie": 11 + }, + "shippedProposals": true, + "useBuiltIns": "usage", + "corejs": 2 + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-shippedProposals-1/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-shippedProposals-1/stdout.txt new file mode 100644 index 000000000000..e9987a6c8ad7 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-shippedProposals-1/stdout.txt @@ -0,0 +1,55 @@ +@babel/preset-env: `DEBUG` option + +Using targets: +{ + "chrome": "52", + "firefox": "50", + "ie": "11" +} + +Using modules transform: auto + +Using plugins: + proposal-numeric-separator { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-nullish-coalescing-operator { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-optional-chaining { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-json-strings { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-optional-catch-binding { "chrome":"52", "firefox":"50", "ie":"11" } + transform-parameters { "firefox":"50", "ie":"11" } + proposal-async-generator-functions { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-object-rest-spread { "chrome":"52", "firefox":"50", "ie":"11" } + transform-dotall-regex { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-unicode-property-regex { "chrome":"52", "firefox":"50", "ie":"11" } + transform-named-capturing-groups-regex { "chrome":"52", "firefox":"50", "ie":"11" } + transform-async-to-generator { "chrome":"52", "firefox":"50", "ie":"11" } + transform-exponentiation-operator { "firefox":"50", "ie":"11" } + transform-template-literals { "ie":"11" } + transform-literals { "firefox":"50", "ie":"11" } + transform-function-name { "firefox":"50", "ie":"11" } + transform-arrow-functions { "ie":"11" } + transform-classes { "ie":"11" } + transform-object-super { "ie":"11" } + transform-shorthand-properties { "ie":"11" } + transform-duplicate-keys { "ie":"11" } + transform-computed-properties { "ie":"11" } + transform-for-of { "firefox":"50", "ie":"11" } + transform-sticky-regex { "ie":"11" } + transform-unicode-regex { "ie":"11" } + transform-spread { "ie":"11" } + transform-destructuring { "firefox":"50", "ie":"11" } + transform-block-scoping { "firefox":"50", "ie":"11" } + transform-typeof-symbol { "ie":"11" } + transform-new-target { "ie":"11" } + transform-regenerator { "firefox":"50", "ie":"11" } + transform-modules-commonjs { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-dynamic-import { "chrome":"52", "firefox":"50", "ie":"11" } + +Using polyfills with `usage` option: + +[/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-shippedProposals-1/input.js] Added following core-js polyfills: + es6.object.to-string { "chrome":"52", "firefox":"50", "ie":"11" } + es6.promise { "ie":"11" } + es6.map { "firefox":"50", "ie":"11" } + es6.string.iterator { "ie":"11" } + es6.array.iterator { "ie":"11" } + web.dom.iterable { "chrome":"52", "firefox":"50", "ie":"11" } diff --git a/packages/babel-preset-env/test/debug-fixtures/usage-corejs2/in/in2.js b/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-shippedProposals-2/input.js similarity index 100% rename from packages/babel-preset-env/test/debug-fixtures/usage-corejs2/in/in2.js rename to packages/babel-preset-env/test/fixtures/debug/usage-corejs2-shippedProposals-2/input.js diff --git a/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-shippedProposals-2/options.json b/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-shippedProposals-2/options.json new file mode 100644 index 000000000000..9069c3b78807 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-shippedProposals-2/options.json @@ -0,0 +1,20 @@ +{ + "validateLogs": true, + "ignoreOutput": true, + "presets": [ + [ + "env", + { + "debug": true, + "targets": { + "chrome": 52, + "firefox": 50, + "ie": 11 + }, + "shippedProposals": true, + "useBuiltIns": "usage", + "corejs": 2 + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-shippedProposals-2/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-shippedProposals-2/stdout.txt new file mode 100644 index 000000000000..c635aa38aba7 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-shippedProposals-2/stdout.txt @@ -0,0 +1,52 @@ +@babel/preset-env: `DEBUG` option + +Using targets: +{ + "chrome": "52", + "firefox": "50", + "ie": "11" +} + +Using modules transform: auto + +Using plugins: + proposal-numeric-separator { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-nullish-coalescing-operator { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-optional-chaining { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-json-strings { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-optional-catch-binding { "chrome":"52", "firefox":"50", "ie":"11" } + transform-parameters { "firefox":"50", "ie":"11" } + proposal-async-generator-functions { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-object-rest-spread { "chrome":"52", "firefox":"50", "ie":"11" } + transform-dotall-regex { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-unicode-property-regex { "chrome":"52", "firefox":"50", "ie":"11" } + transform-named-capturing-groups-regex { "chrome":"52", "firefox":"50", "ie":"11" } + transform-async-to-generator { "chrome":"52", "firefox":"50", "ie":"11" } + transform-exponentiation-operator { "firefox":"50", "ie":"11" } + transform-template-literals { "ie":"11" } + transform-literals { "firefox":"50", "ie":"11" } + transform-function-name { "firefox":"50", "ie":"11" } + transform-arrow-functions { "ie":"11" } + transform-classes { "ie":"11" } + transform-object-super { "ie":"11" } + transform-shorthand-properties { "ie":"11" } + transform-duplicate-keys { "ie":"11" } + transform-computed-properties { "ie":"11" } + transform-for-of { "firefox":"50", "ie":"11" } + transform-sticky-regex { "ie":"11" } + transform-unicode-regex { "ie":"11" } + transform-spread { "ie":"11" } + transform-destructuring { "firefox":"50", "ie":"11" } + transform-block-scoping { "firefox":"50", "ie":"11" } + transform-typeof-symbol { "ie":"11" } + transform-new-target { "ie":"11" } + transform-regenerator { "firefox":"50", "ie":"11" } + transform-modules-commonjs { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-dynamic-import { "chrome":"52", "firefox":"50", "ie":"11" } + +Using polyfills with `usage` option: + +[/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-shippedProposals-2/input.js] Added following core-js polyfill: + web.dom.iterable { "chrome":"52", "firefox":"50", "ie":"11" } + +[/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-shippedProposals-2/input.js] Based on your code and targets, added regenerator-runtime. diff --git a/packages/babel-preset-env/test/debug-fixtures/usage-corejs2-with-import/in/in.js b/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-with-import/input.mjs similarity index 100% rename from packages/babel-preset-env/test/debug-fixtures/usage-corejs2-with-import/in/in.js rename to packages/babel-preset-env/test/fixtures/debug/usage-corejs2-with-import/input.mjs diff --git a/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-with-import/options.json b/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-with-import/options.json new file mode 100644 index 000000000000..c1118296ce3a --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-with-import/options.json @@ -0,0 +1,17 @@ +{ + "validateLogs": true, + "ignoreOutput": true, + "presets": [ + [ + "env", + { + "debug": true, + "targets": { + "chrome": 55 + }, + "useBuiltIns": "usage", + "corejs": 2 + } + ] + ] +} diff --git a/packages/babel-preset-env/test/debug-fixtures/usage-corejs2-with-import/stderr.txt b/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-with-import/stderr.txt similarity index 100% rename from packages/babel-preset-env/test/debug-fixtures/usage-corejs2-with-import/stderr.txt rename to packages/babel-preset-env/test/fixtures/debug/usage-corejs2-with-import/stderr.txt diff --git a/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-with-import/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-with-import/stdout.txt new file mode 100644 index 000000000000..25f7f945af46 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-with-import/stdout.txt @@ -0,0 +1,25 @@ +@babel/preset-env: `DEBUG` option + +Using targets: +{ + "chrome": "55" +} + +Using modules transform: auto + +Using plugins: + proposal-nullish-coalescing-operator { "chrome":"55" } + proposal-optional-chaining { "chrome":"55" } + proposal-json-strings { "chrome":"55" } + proposal-optional-catch-binding { "chrome":"55" } + proposal-async-generator-functions { "chrome":"55" } + proposal-object-rest-spread { "chrome":"55" } + transform-dotall-regex { "chrome":"55" } + proposal-unicode-property-regex { "chrome":"55" } + transform-named-capturing-groups-regex { "chrome":"55" } + transform-modules-commonjs { "chrome":"55" } + proposal-dynamic-import { "chrome":"55" } + +Using polyfills with `usage` option: + +[/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-with-import/input.mjs] Based on your code and targets, core-js polyfills were not added. diff --git a/packages/babel-preset-env/test/debug-fixtures/usage-corejs3-chrome-71/in/in.js b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-1/input.js similarity index 100% rename from packages/babel-preset-env/test/debug-fixtures/usage-corejs3-chrome-71/in/in.js rename to packages/babel-preset-env/test/fixtures/debug/usage-corejs3-1/input.js diff --git a/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-1/options.json b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-1/options.json new file mode 100644 index 000000000000..64cd6071b99d --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-1/options.json @@ -0,0 +1,19 @@ +{ + "validateLogs": true, + "ignoreOutput": true, + "presets": [ + [ + "env", + { + "debug": true, + "targets": { + "chrome": 52, + "firefox": 50, + "ie": 11 + }, + "useBuiltIns": "usage", + "corejs": 3 + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-1/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-1/stdout.txt new file mode 100644 index 000000000000..15055784cbe1 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-1/stdout.txt @@ -0,0 +1,55 @@ +@babel/preset-env: `DEBUG` option + +Using targets: +{ + "chrome": "52", + "firefox": "50", + "ie": "11" +} + +Using modules transform: auto + +Using plugins: + proposal-nullish-coalescing-operator { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-optional-chaining { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-json-strings { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-optional-catch-binding { "chrome":"52", "firefox":"50", "ie":"11" } + transform-parameters { "firefox":"50", "ie":"11" } + proposal-async-generator-functions { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-object-rest-spread { "chrome":"52", "firefox":"50", "ie":"11" } + transform-dotall-regex { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-unicode-property-regex { "chrome":"52", "firefox":"50", "ie":"11" } + transform-named-capturing-groups-regex { "chrome":"52", "firefox":"50", "ie":"11" } + transform-async-to-generator { "chrome":"52", "firefox":"50", "ie":"11" } + transform-exponentiation-operator { "firefox":"50", "ie":"11" } + transform-template-literals { "ie":"11" } + transform-literals { "firefox":"50", "ie":"11" } + transform-function-name { "firefox":"50", "ie":"11" } + transform-arrow-functions { "ie":"11" } + transform-classes { "ie":"11" } + transform-object-super { "ie":"11" } + transform-shorthand-properties { "ie":"11" } + transform-duplicate-keys { "ie":"11" } + transform-computed-properties { "ie":"11" } + transform-for-of { "firefox":"50", "ie":"11" } + transform-sticky-regex { "ie":"11" } + transform-unicode-regex { "ie":"11" } + transform-spread { "ie":"11" } + transform-destructuring { "firefox":"50", "ie":"11" } + transform-block-scoping { "firefox":"50", "ie":"11" } + transform-typeof-symbol { "ie":"11" } + transform-new-target { "ie":"11" } + transform-regenerator { "firefox":"50", "ie":"11" } + transform-modules-commonjs { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-dynamic-import { "chrome":"52", "firefox":"50", "ie":"11" } + +Using polyfills with `usage` option: + +[/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-1/input.js] Added following core-js polyfills: + es.array.iterator { "chrome":"52", "firefox":"50", "ie":"11" } + es.map { "firefox":"50", "ie":"11" } + es.object.to-string { "firefox":"50", "ie":"11" } + es.promise { "chrome":"52", "firefox":"50", "ie":"11" } + es.string.iterator { "ie":"11" } + web.dom-collections.iterator { "chrome":"52", "firefox":"50", "ie":"11" } + web.queue-microtask { "chrome":"52", "firefox":"50", "ie":"11" } diff --git a/packages/babel-preset-env/test/debug-fixtures/usage-corejs3-chrome-71/in/in2.js b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-2/input.js similarity index 100% rename from packages/babel-preset-env/test/debug-fixtures/usage-corejs3-chrome-71/in/in2.js rename to packages/babel-preset-env/test/fixtures/debug/usage-corejs3-2/input.js diff --git a/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-2/options.json b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-2/options.json new file mode 100644 index 000000000000..64cd6071b99d --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-2/options.json @@ -0,0 +1,19 @@ +{ + "validateLogs": true, + "ignoreOutput": true, + "presets": [ + [ + "env", + { + "debug": true, + "targets": { + "chrome": 52, + "firefox": 50, + "ie": 11 + }, + "useBuiltIns": "usage", + "corejs": 3 + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-2/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-2/stdout.txt new file mode 100644 index 000000000000..1ba69f0d95a6 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-2/stdout.txt @@ -0,0 +1,53 @@ +@babel/preset-env: `DEBUG` option + +Using targets: +{ + "chrome": "52", + "firefox": "50", + "ie": "11" +} + +Using modules transform: auto + +Using plugins: + proposal-nullish-coalescing-operator { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-optional-chaining { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-json-strings { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-optional-catch-binding { "chrome":"52", "firefox":"50", "ie":"11" } + transform-parameters { "firefox":"50", "ie":"11" } + proposal-async-generator-functions { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-object-rest-spread { "chrome":"52", "firefox":"50", "ie":"11" } + transform-dotall-regex { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-unicode-property-regex { "chrome":"52", "firefox":"50", "ie":"11" } + transform-named-capturing-groups-regex { "chrome":"52", "firefox":"50", "ie":"11" } + transform-async-to-generator { "chrome":"52", "firefox":"50", "ie":"11" } + transform-exponentiation-operator { "firefox":"50", "ie":"11" } + transform-template-literals { "ie":"11" } + transform-literals { "firefox":"50", "ie":"11" } + transform-function-name { "firefox":"50", "ie":"11" } + transform-arrow-functions { "ie":"11" } + transform-classes { "ie":"11" } + transform-object-super { "ie":"11" } + transform-shorthand-properties { "ie":"11" } + transform-duplicate-keys { "ie":"11" } + transform-computed-properties { "ie":"11" } + transform-for-of { "firefox":"50", "ie":"11" } + transform-sticky-regex { "ie":"11" } + transform-unicode-regex { "ie":"11" } + transform-spread { "ie":"11" } + transform-destructuring { "firefox":"50", "ie":"11" } + transform-block-scoping { "firefox":"50", "ie":"11" } + transform-typeof-symbol { "ie":"11" } + transform-new-target { "ie":"11" } + transform-regenerator { "firefox":"50", "ie":"11" } + transform-modules-commonjs { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-dynamic-import { "chrome":"52", "firefox":"50", "ie":"11" } + +Using polyfills with `usage` option: + +[/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-2/input.js] Added following core-js polyfills: + es.array.iterator { "chrome":"52", "firefox":"50", "ie":"11" } + es.string.iterator { "ie":"11" } + web.dom-collections.iterator { "chrome":"52", "firefox":"50", "ie":"11" } + +[/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-2/input.js] Based on your code and targets, added regenerator-runtime. diff --git a/packages/babel-preset-env/test/debug-fixtures/usage-corejs3-proposals-chrome-71/in/in.js b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-chrome-71-1/input.js similarity index 100% rename from packages/babel-preset-env/test/debug-fixtures/usage-corejs3-proposals-chrome-71/in/in.js rename to packages/babel-preset-env/test/fixtures/debug/usage-corejs3-chrome-71-1/input.js diff --git a/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-chrome-71-1/options.json b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-chrome-71-1/options.json new file mode 100644 index 000000000000..affda23d0ad5 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-chrome-71-1/options.json @@ -0,0 +1,17 @@ +{ + "validateLogs": true, + "ignoreOutput": true, + "presets": [ + [ + "env", + { + "debug": true, + "targets": { + "chrome": 71 + }, + "useBuiltIns": "usage", + "corejs": 3 + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-chrome-71-1/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-chrome-71-1/stdout.txt new file mode 100644 index 000000000000..91f9f62e9885 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-chrome-71-1/stdout.txt @@ -0,0 +1,22 @@ +@babel/preset-env: `DEBUG` option + +Using targets: +{ + "chrome": "71" +} + +Using modules transform: auto + +Using plugins: + proposal-nullish-coalescing-operator { "chrome":"71" } + proposal-optional-chaining { "chrome":"71" } + syntax-json-strings { "chrome":"71" } + syntax-optional-catch-binding { "chrome":"71" } + syntax-async-generators { "chrome":"71" } + syntax-object-rest-spread { "chrome":"71" } + transform-modules-commonjs { "chrome":"71" } + proposal-dynamic-import { "chrome":"71" } + +Using polyfills with `usage` option: + +[/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-chrome-71-1/input.js] Based on your code and targets, core-js polyfills were not added. diff --git a/packages/babel-preset-env/test/debug-fixtures/usage-corejs3-proposals-chrome-71/in/in2.js b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-chrome-71-2/input.js similarity index 100% rename from packages/babel-preset-env/test/debug-fixtures/usage-corejs3-proposals-chrome-71/in/in2.js rename to packages/babel-preset-env/test/fixtures/debug/usage-corejs3-chrome-71-2/input.js diff --git a/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-chrome-71-2/options.json b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-chrome-71-2/options.json new file mode 100644 index 000000000000..affda23d0ad5 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-chrome-71-2/options.json @@ -0,0 +1,17 @@ +{ + "validateLogs": true, + "ignoreOutput": true, + "presets": [ + [ + "env", + { + "debug": true, + "targets": { + "chrome": 71 + }, + "useBuiltIns": "usage", + "corejs": 3 + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-chrome-71-2/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-chrome-71-2/stdout.txt new file mode 100644 index 000000000000..dfeb23a0356a --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-chrome-71-2/stdout.txt @@ -0,0 +1,22 @@ +@babel/preset-env: `DEBUG` option + +Using targets: +{ + "chrome": "71" +} + +Using modules transform: auto + +Using plugins: + proposal-nullish-coalescing-operator { "chrome":"71" } + proposal-optional-chaining { "chrome":"71" } + syntax-json-strings { "chrome":"71" } + syntax-optional-catch-binding { "chrome":"71" } + syntax-async-generators { "chrome":"71" } + syntax-object-rest-spread { "chrome":"71" } + transform-modules-commonjs { "chrome":"71" } + proposal-dynamic-import { "chrome":"71" } + +Using polyfills with `usage` option: + +[/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-chrome-71-2/input.js] Based on your code and targets, core-js polyfills were not added. diff --git a/packages/babel-preset-env/test/debug-fixtures/usage-corejs3-none/in/in.js b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-none-1/input.js similarity index 100% rename from packages/babel-preset-env/test/debug-fixtures/usage-corejs3-none/in/in.js rename to packages/babel-preset-env/test/fixtures/debug/usage-corejs3-none-1/input.js diff --git a/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-none-1/options.json b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-none-1/options.json new file mode 100644 index 000000000000..64cd6071b99d --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-none-1/options.json @@ -0,0 +1,19 @@ +{ + "validateLogs": true, + "ignoreOutput": true, + "presets": [ + [ + "env", + { + "debug": true, + "targets": { + "chrome": 52, + "firefox": 50, + "ie": 11 + }, + "useBuiltIns": "usage", + "corejs": 3 + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-none-1/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-none-1/stdout.txt new file mode 100644 index 000000000000..754bdb719947 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-none-1/stdout.txt @@ -0,0 +1,48 @@ +@babel/preset-env: `DEBUG` option + +Using targets: +{ + "chrome": "52", + "firefox": "50", + "ie": "11" +} + +Using modules transform: auto + +Using plugins: + proposal-nullish-coalescing-operator { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-optional-chaining { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-json-strings { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-optional-catch-binding { "chrome":"52", "firefox":"50", "ie":"11" } + transform-parameters { "firefox":"50", "ie":"11" } + proposal-async-generator-functions { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-object-rest-spread { "chrome":"52", "firefox":"50", "ie":"11" } + transform-dotall-regex { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-unicode-property-regex { "chrome":"52", "firefox":"50", "ie":"11" } + transform-named-capturing-groups-regex { "chrome":"52", "firefox":"50", "ie":"11" } + transform-async-to-generator { "chrome":"52", "firefox":"50", "ie":"11" } + transform-exponentiation-operator { "firefox":"50", "ie":"11" } + transform-template-literals { "ie":"11" } + transform-literals { "firefox":"50", "ie":"11" } + transform-function-name { "firefox":"50", "ie":"11" } + transform-arrow-functions { "ie":"11" } + transform-classes { "ie":"11" } + transform-object-super { "ie":"11" } + transform-shorthand-properties { "ie":"11" } + transform-duplicate-keys { "ie":"11" } + transform-computed-properties { "ie":"11" } + transform-for-of { "firefox":"50", "ie":"11" } + transform-sticky-regex { "ie":"11" } + transform-unicode-regex { "ie":"11" } + transform-spread { "ie":"11" } + transform-destructuring { "firefox":"50", "ie":"11" } + transform-block-scoping { "firefox":"50", "ie":"11" } + transform-typeof-symbol { "ie":"11" } + transform-new-target { "ie":"11" } + transform-regenerator { "firefox":"50", "ie":"11" } + transform-modules-commonjs { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-dynamic-import { "chrome":"52", "firefox":"50", "ie":"11" } + +Using polyfills with `usage` option: + +[/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-none-1/input.js] Based on your code and targets, core-js polyfills were not added. diff --git a/packages/babel-preset-env/test/debug-fixtures/usage-corejs3-none/in/in2.js b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-none-2/input.js similarity index 100% rename from packages/babel-preset-env/test/debug-fixtures/usage-corejs3-none/in/in2.js rename to packages/babel-preset-env/test/fixtures/debug/usage-corejs3-none-2/input.js diff --git a/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-none-2/options.json b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-none-2/options.json new file mode 100644 index 000000000000..64cd6071b99d --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-none-2/options.json @@ -0,0 +1,19 @@ +{ + "validateLogs": true, + "ignoreOutput": true, + "presets": [ + [ + "env", + { + "debug": true, + "targets": { + "chrome": 52, + "firefox": 50, + "ie": 11 + }, + "useBuiltIns": "usage", + "corejs": 3 + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-none-2/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-none-2/stdout.txt new file mode 100644 index 000000000000..fd82852217e7 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-none-2/stdout.txt @@ -0,0 +1,48 @@ +@babel/preset-env: `DEBUG` option + +Using targets: +{ + "chrome": "52", + "firefox": "50", + "ie": "11" +} + +Using modules transform: auto + +Using plugins: + proposal-nullish-coalescing-operator { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-optional-chaining { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-json-strings { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-optional-catch-binding { "chrome":"52", "firefox":"50", "ie":"11" } + transform-parameters { "firefox":"50", "ie":"11" } + proposal-async-generator-functions { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-object-rest-spread { "chrome":"52", "firefox":"50", "ie":"11" } + transform-dotall-regex { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-unicode-property-regex { "chrome":"52", "firefox":"50", "ie":"11" } + transform-named-capturing-groups-regex { "chrome":"52", "firefox":"50", "ie":"11" } + transform-async-to-generator { "chrome":"52", "firefox":"50", "ie":"11" } + transform-exponentiation-operator { "firefox":"50", "ie":"11" } + transform-template-literals { "ie":"11" } + transform-literals { "firefox":"50", "ie":"11" } + transform-function-name { "firefox":"50", "ie":"11" } + transform-arrow-functions { "ie":"11" } + transform-classes { "ie":"11" } + transform-object-super { "ie":"11" } + transform-shorthand-properties { "ie":"11" } + transform-duplicate-keys { "ie":"11" } + transform-computed-properties { "ie":"11" } + transform-for-of { "firefox":"50", "ie":"11" } + transform-sticky-regex { "ie":"11" } + transform-unicode-regex { "ie":"11" } + transform-spread { "ie":"11" } + transform-destructuring { "firefox":"50", "ie":"11" } + transform-block-scoping { "firefox":"50", "ie":"11" } + transform-typeof-symbol { "ie":"11" } + transform-new-target { "ie":"11" } + transform-regenerator { "firefox":"50", "ie":"11" } + transform-modules-commonjs { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-dynamic-import { "chrome":"52", "firefox":"50", "ie":"11" } + +Using polyfills with `usage` option: + +[/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-none-2/input.js] Based on your code and targets, core-js polyfills were not added. diff --git a/packages/babel-preset-env/test/debug-fixtures/usage-corejs3-proposals/in/in.js b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-proposals-1/input.js similarity index 100% rename from packages/babel-preset-env/test/debug-fixtures/usage-corejs3-proposals/in/in.js rename to packages/babel-preset-env/test/fixtures/debug/usage-corejs3-proposals-1/input.js diff --git a/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-proposals-1/options.json b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-proposals-1/options.json new file mode 100644 index 000000000000..06974bf0dca0 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-proposals-1/options.json @@ -0,0 +1,19 @@ +{ + "validateLogs": true, + "ignoreOutput": true, + "presets": [ + [ + "env", + { + "debug": true, + "targets": { + "chrome": 52, + "firefox": 50, + "ie": 11 + }, + "useBuiltIns": "usage", + "corejs": { "version": 3, "proposals": true } + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-proposals-1/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-proposals-1/stdout.txt new file mode 100644 index 000000000000..2d1cbf4c9e26 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-proposals-1/stdout.txt @@ -0,0 +1,71 @@ +@babel/preset-env: `DEBUG` option + +Using targets: +{ + "chrome": "52", + "firefox": "50", + "ie": "11" +} + +Using modules transform: auto + +Using plugins: + proposal-nullish-coalescing-operator { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-optional-chaining { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-json-strings { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-optional-catch-binding { "chrome":"52", "firefox":"50", "ie":"11" } + transform-parameters { "firefox":"50", "ie":"11" } + proposal-async-generator-functions { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-object-rest-spread { "chrome":"52", "firefox":"50", "ie":"11" } + transform-dotall-regex { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-unicode-property-regex { "chrome":"52", "firefox":"50", "ie":"11" } + transform-named-capturing-groups-regex { "chrome":"52", "firefox":"50", "ie":"11" } + transform-async-to-generator { "chrome":"52", "firefox":"50", "ie":"11" } + transform-exponentiation-operator { "firefox":"50", "ie":"11" } + transform-template-literals { "ie":"11" } + transform-literals { "firefox":"50", "ie":"11" } + transform-function-name { "firefox":"50", "ie":"11" } + transform-arrow-functions { "ie":"11" } + transform-classes { "ie":"11" } + transform-object-super { "ie":"11" } + transform-shorthand-properties { "ie":"11" } + transform-duplicate-keys { "ie":"11" } + transform-computed-properties { "ie":"11" } + transform-for-of { "firefox":"50", "ie":"11" } + transform-sticky-regex { "ie":"11" } + transform-unicode-regex { "ie":"11" } + transform-spread { "ie":"11" } + transform-destructuring { "firefox":"50", "ie":"11" } + transform-block-scoping { "firefox":"50", "ie":"11" } + transform-typeof-symbol { "ie":"11" } + transform-new-target { "ie":"11" } + transform-regenerator { "firefox":"50", "ie":"11" } + transform-modules-commonjs { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-dynamic-import { "chrome":"52", "firefox":"50", "ie":"11" } + +Using polyfills with `usage` option: + +[/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-proposals-1/input.js] Added following core-js polyfills: + es.array.iterator { "chrome":"52", "firefox":"50", "ie":"11" } + es.map { "firefox":"50", "ie":"11" } + es.object.to-string { "firefox":"50", "ie":"11" } + es.promise { "chrome":"52", "firefox":"50", "ie":"11" } + es.string.iterator { "ie":"11" } + esnext.global-this { "chrome":"52", "firefox":"50", "ie":"11" } + esnext.map.delete-all { "chrome":"52", "firefox":"50", "ie":"11" } + esnext.map.every { "chrome":"52", "firefox":"50", "ie":"11" } + esnext.map.filter { "chrome":"52", "firefox":"50", "ie":"11" } + esnext.map.find { "chrome":"52", "firefox":"50", "ie":"11" } + esnext.map.find-key { "chrome":"52", "firefox":"50", "ie":"11" } + esnext.map.includes { "chrome":"52", "firefox":"50", "ie":"11" } + esnext.map.key-of { "chrome":"52", "firefox":"50", "ie":"11" } + esnext.map.map-keys { "chrome":"52", "firefox":"50", "ie":"11" } + esnext.map.map-values { "chrome":"52", "firefox":"50", "ie":"11" } + esnext.map.merge { "chrome":"52", "firefox":"50", "ie":"11" } + esnext.map.reduce { "chrome":"52", "firefox":"50", "ie":"11" } + esnext.map.some { "chrome":"52", "firefox":"50", "ie":"11" } + esnext.map.update { "chrome":"52", "firefox":"50", "ie":"11" } + esnext.observable { "chrome":"52", "firefox":"50", "ie":"11" } + esnext.symbol.observable { "chrome":"52", "firefox":"50", "ie":"11" } + web.dom-collections.iterator { "chrome":"52", "firefox":"50", "ie":"11" } + web.queue-microtask { "chrome":"52", "firefox":"50", "ie":"11" } diff --git a/packages/babel-preset-env/test/debug-fixtures/usage-corejs3-proposals/in/in2.js b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-proposals-2/input.js similarity index 100% rename from packages/babel-preset-env/test/debug-fixtures/usage-corejs3-proposals/in/in2.js rename to packages/babel-preset-env/test/fixtures/debug/usage-corejs3-proposals-2/input.js diff --git a/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-proposals-2/options.json b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-proposals-2/options.json new file mode 100644 index 000000000000..06974bf0dca0 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-proposals-2/options.json @@ -0,0 +1,19 @@ +{ + "validateLogs": true, + "ignoreOutput": true, + "presets": [ + [ + "env", + { + "debug": true, + "targets": { + "chrome": 52, + "firefox": 50, + "ie": 11 + }, + "useBuiltIns": "usage", + "corejs": { "version": 3, "proposals": true } + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-proposals-2/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-proposals-2/stdout.txt new file mode 100644 index 000000000000..f723e9bfab49 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-proposals-2/stdout.txt @@ -0,0 +1,53 @@ +@babel/preset-env: `DEBUG` option + +Using targets: +{ + "chrome": "52", + "firefox": "50", + "ie": "11" +} + +Using modules transform: auto + +Using plugins: + proposal-nullish-coalescing-operator { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-optional-chaining { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-json-strings { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-optional-catch-binding { "chrome":"52", "firefox":"50", "ie":"11" } + transform-parameters { "firefox":"50", "ie":"11" } + proposal-async-generator-functions { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-object-rest-spread { "chrome":"52", "firefox":"50", "ie":"11" } + transform-dotall-regex { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-unicode-property-regex { "chrome":"52", "firefox":"50", "ie":"11" } + transform-named-capturing-groups-regex { "chrome":"52", "firefox":"50", "ie":"11" } + transform-async-to-generator { "chrome":"52", "firefox":"50", "ie":"11" } + transform-exponentiation-operator { "firefox":"50", "ie":"11" } + transform-template-literals { "ie":"11" } + transform-literals { "firefox":"50", "ie":"11" } + transform-function-name { "firefox":"50", "ie":"11" } + transform-arrow-functions { "ie":"11" } + transform-classes { "ie":"11" } + transform-object-super { "ie":"11" } + transform-shorthand-properties { "ie":"11" } + transform-duplicate-keys { "ie":"11" } + transform-computed-properties { "ie":"11" } + transform-for-of { "firefox":"50", "ie":"11" } + transform-sticky-regex { "ie":"11" } + transform-unicode-regex { "ie":"11" } + transform-spread { "ie":"11" } + transform-destructuring { "firefox":"50", "ie":"11" } + transform-block-scoping { "firefox":"50", "ie":"11" } + transform-typeof-symbol { "ie":"11" } + transform-new-target { "ie":"11" } + transform-regenerator { "firefox":"50", "ie":"11" } + transform-modules-commonjs { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-dynamic-import { "chrome":"52", "firefox":"50", "ie":"11" } + +Using polyfills with `usage` option: + +[/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-proposals-2/input.js] Added following core-js polyfills: + es.array.iterator { "chrome":"52", "firefox":"50", "ie":"11" } + es.string.iterator { "ie":"11" } + web.dom-collections.iterator { "chrome":"52", "firefox":"50", "ie":"11" } + +[/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-proposals-2/input.js] Based on your code and targets, added regenerator-runtime. diff --git a/packages/babel-preset-env/test/debug-fixtures/usage-corejs3-shippedProposals/in/in.js b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-proposals-chrome-71-1/input.js similarity index 100% rename from packages/babel-preset-env/test/debug-fixtures/usage-corejs3-shippedProposals/in/in.js rename to packages/babel-preset-env/test/fixtures/debug/usage-corejs3-proposals-chrome-71-1/input.js diff --git a/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-proposals-chrome-71-1/options.json b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-proposals-chrome-71-1/options.json new file mode 100644 index 000000000000..18332716ece1 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-proposals-chrome-71-1/options.json @@ -0,0 +1,17 @@ +{ + "validateLogs": true, + "ignoreOutput": true, + "presets": [ + [ + "env", + { + "debug": true, + "targets": { + "chrome": 71 + }, + "useBuiltIns": "usage", + "corejs": { "version": 3, "proposals": true } + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-proposals-chrome-71-1/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-proposals-chrome-71-1/stdout.txt new file mode 100644 index 000000000000..db3815977e15 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-proposals-chrome-71-1/stdout.txt @@ -0,0 +1,37 @@ +@babel/preset-env: `DEBUG` option + +Using targets: +{ + "chrome": "71" +} + +Using modules transform: auto + +Using plugins: + proposal-nullish-coalescing-operator { "chrome":"71" } + proposal-optional-chaining { "chrome":"71" } + syntax-json-strings { "chrome":"71" } + syntax-optional-catch-binding { "chrome":"71" } + syntax-async-generators { "chrome":"71" } + syntax-object-rest-spread { "chrome":"71" } + transform-modules-commonjs { "chrome":"71" } + proposal-dynamic-import { "chrome":"71" } + +Using polyfills with `usage` option: + +[/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-proposals-chrome-71-1/input.js] Added following core-js polyfills: + esnext.map.delete-all { "chrome":"71" } + esnext.map.every { "chrome":"71" } + esnext.map.filter { "chrome":"71" } + esnext.map.find { "chrome":"71" } + esnext.map.find-key { "chrome":"71" } + esnext.map.includes { "chrome":"71" } + esnext.map.key-of { "chrome":"71" } + esnext.map.map-keys { "chrome":"71" } + esnext.map.map-values { "chrome":"71" } + esnext.map.merge { "chrome":"71" } + esnext.map.reduce { "chrome":"71" } + esnext.map.some { "chrome":"71" } + esnext.map.update { "chrome":"71" } + esnext.observable { "chrome":"71" } + esnext.symbol.observable { "chrome":"71" } diff --git a/packages/babel-preset-env/test/debug-fixtures/usage-corejs3-shippedProposals/in/in2.js b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-proposals-chrome-71-2/input.js similarity index 100% rename from packages/babel-preset-env/test/debug-fixtures/usage-corejs3-shippedProposals/in/in2.js rename to packages/babel-preset-env/test/fixtures/debug/usage-corejs3-proposals-chrome-71-2/input.js diff --git a/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-proposals-chrome-71-2/options.json b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-proposals-chrome-71-2/options.json new file mode 100644 index 000000000000..18332716ece1 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-proposals-chrome-71-2/options.json @@ -0,0 +1,17 @@ +{ + "validateLogs": true, + "ignoreOutput": true, + "presets": [ + [ + "env", + { + "debug": true, + "targets": { + "chrome": 71 + }, + "useBuiltIns": "usage", + "corejs": { "version": 3, "proposals": true } + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-proposals-chrome-71-2/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-proposals-chrome-71-2/stdout.txt new file mode 100644 index 000000000000..7b02e2d05164 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-proposals-chrome-71-2/stdout.txt @@ -0,0 +1,22 @@ +@babel/preset-env: `DEBUG` option + +Using targets: +{ + "chrome": "71" +} + +Using modules transform: auto + +Using plugins: + proposal-nullish-coalescing-operator { "chrome":"71" } + proposal-optional-chaining { "chrome":"71" } + syntax-json-strings { "chrome":"71" } + syntax-optional-catch-binding { "chrome":"71" } + syntax-async-generators { "chrome":"71" } + syntax-object-rest-spread { "chrome":"71" } + transform-modules-commonjs { "chrome":"71" } + proposal-dynamic-import { "chrome":"71" } + +Using polyfills with `usage` option: + +[/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-proposals-chrome-71-2/input.js] Based on your code and targets, core-js polyfills were not added. diff --git a/packages/babel-preset-env/test/debug-fixtures/usage-corejs3-versions-strings-minor-3.0/in/in.js b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-shippedProposals-1/input.js similarity index 100% rename from packages/babel-preset-env/test/debug-fixtures/usage-corejs3-versions-strings-minor-3.0/in/in.js rename to packages/babel-preset-env/test/fixtures/debug/usage-corejs3-shippedProposals-1/input.js diff --git a/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-shippedProposals-1/options.json b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-shippedProposals-1/options.json new file mode 100644 index 000000000000..5bd93bb47155 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-shippedProposals-1/options.json @@ -0,0 +1,20 @@ +{ + "validateLogs": true, + "ignoreOutput": true, + "presets": [ + [ + "env", + { + "debug": true, + "targets": { + "chrome": 52, + "firefox": 50, + "ie": 11 + }, + "shippedProposals": true, + "useBuiltIns": "usage", + "corejs": 3 + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-shippedProposals-1/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-shippedProposals-1/stdout.txt new file mode 100644 index 000000000000..50d9dfd4faa3 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-shippedProposals-1/stdout.txt @@ -0,0 +1,57 @@ +@babel/preset-env: `DEBUG` option + +Using targets: +{ + "chrome": "52", + "firefox": "50", + "ie": "11" +} + +Using modules transform: auto + +Using plugins: + proposal-numeric-separator { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-nullish-coalescing-operator { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-optional-chaining { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-json-strings { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-optional-catch-binding { "chrome":"52", "firefox":"50", "ie":"11" } + transform-parameters { "firefox":"50", "ie":"11" } + proposal-async-generator-functions { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-object-rest-spread { "chrome":"52", "firefox":"50", "ie":"11" } + transform-dotall-regex { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-unicode-property-regex { "chrome":"52", "firefox":"50", "ie":"11" } + transform-named-capturing-groups-regex { "chrome":"52", "firefox":"50", "ie":"11" } + transform-async-to-generator { "chrome":"52", "firefox":"50", "ie":"11" } + transform-exponentiation-operator { "firefox":"50", "ie":"11" } + transform-template-literals { "ie":"11" } + transform-literals { "firefox":"50", "ie":"11" } + transform-function-name { "firefox":"50", "ie":"11" } + transform-arrow-functions { "ie":"11" } + transform-classes { "ie":"11" } + transform-object-super { "ie":"11" } + transform-shorthand-properties { "ie":"11" } + transform-duplicate-keys { "ie":"11" } + transform-computed-properties { "ie":"11" } + transform-for-of { "firefox":"50", "ie":"11" } + transform-sticky-regex { "ie":"11" } + transform-unicode-regex { "ie":"11" } + transform-spread { "ie":"11" } + transform-destructuring { "firefox":"50", "ie":"11" } + transform-block-scoping { "firefox":"50", "ie":"11" } + transform-typeof-symbol { "ie":"11" } + transform-new-target { "ie":"11" } + transform-regenerator { "firefox":"50", "ie":"11" } + transform-modules-commonjs { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-dynamic-import { "chrome":"52", "firefox":"50", "ie":"11" } + +Using polyfills with `usage` option: + +[/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-shippedProposals-1/input.js] Added following core-js polyfills: + es.array.iterator { "chrome":"52", "firefox":"50", "ie":"11" } + es.map { "firefox":"50", "ie":"11" } + es.object.to-string { "firefox":"50", "ie":"11" } + es.promise { "chrome":"52", "firefox":"50", "ie":"11" } + es.string.iterator { "ie":"11" } + web.dom-collections.iterator { "chrome":"52", "firefox":"50", "ie":"11" } + web.queue-microtask { "chrome":"52", "firefox":"50", "ie":"11" } + esnext.global-this { "chrome":"52", "firefox":"50", "ie":"11" } diff --git a/packages/babel-preset-env/test/debug-fixtures/usage-corejs3-versions-strings-minor-3.0/in/in2.js b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-shippedProposals-2/input.js similarity index 100% rename from packages/babel-preset-env/test/debug-fixtures/usage-corejs3-versions-strings-minor-3.0/in/in2.js rename to packages/babel-preset-env/test/fixtures/debug/usage-corejs3-shippedProposals-2/input.js diff --git a/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-shippedProposals-2/options.json b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-shippedProposals-2/options.json new file mode 100644 index 000000000000..5bd93bb47155 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-shippedProposals-2/options.json @@ -0,0 +1,20 @@ +{ + "validateLogs": true, + "ignoreOutput": true, + "presets": [ + [ + "env", + { + "debug": true, + "targets": { + "chrome": 52, + "firefox": 50, + "ie": 11 + }, + "shippedProposals": true, + "useBuiltIns": "usage", + "corejs": 3 + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-shippedProposals-2/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-shippedProposals-2/stdout.txt new file mode 100644 index 000000000000..58804db33659 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-shippedProposals-2/stdout.txt @@ -0,0 +1,54 @@ +@babel/preset-env: `DEBUG` option + +Using targets: +{ + "chrome": "52", + "firefox": "50", + "ie": "11" +} + +Using modules transform: auto + +Using plugins: + proposal-numeric-separator { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-nullish-coalescing-operator { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-optional-chaining { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-json-strings { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-optional-catch-binding { "chrome":"52", "firefox":"50", "ie":"11" } + transform-parameters { "firefox":"50", "ie":"11" } + proposal-async-generator-functions { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-object-rest-spread { "chrome":"52", "firefox":"50", "ie":"11" } + transform-dotall-regex { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-unicode-property-regex { "chrome":"52", "firefox":"50", "ie":"11" } + transform-named-capturing-groups-regex { "chrome":"52", "firefox":"50", "ie":"11" } + transform-async-to-generator { "chrome":"52", "firefox":"50", "ie":"11" } + transform-exponentiation-operator { "firefox":"50", "ie":"11" } + transform-template-literals { "ie":"11" } + transform-literals { "firefox":"50", "ie":"11" } + transform-function-name { "firefox":"50", "ie":"11" } + transform-arrow-functions { "ie":"11" } + transform-classes { "ie":"11" } + transform-object-super { "ie":"11" } + transform-shorthand-properties { "ie":"11" } + transform-duplicate-keys { "ie":"11" } + transform-computed-properties { "ie":"11" } + transform-for-of { "firefox":"50", "ie":"11" } + transform-sticky-regex { "ie":"11" } + transform-unicode-regex { "ie":"11" } + transform-spread { "ie":"11" } + transform-destructuring { "firefox":"50", "ie":"11" } + transform-block-scoping { "firefox":"50", "ie":"11" } + transform-typeof-symbol { "ie":"11" } + transform-new-target { "ie":"11" } + transform-regenerator { "firefox":"50", "ie":"11" } + transform-modules-commonjs { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-dynamic-import { "chrome":"52", "firefox":"50", "ie":"11" } + +Using polyfills with `usage` option: + +[/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-shippedProposals-2/input.js] Added following core-js polyfills: + es.array.iterator { "chrome":"52", "firefox":"50", "ie":"11" } + es.string.iterator { "ie":"11" } + web.dom-collections.iterator { "chrome":"52", "firefox":"50", "ie":"11" } + +[/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-shippedProposals-2/input.js] Based on your code and targets, added regenerator-runtime. diff --git a/packages/babel-preset-env/test/debug-fixtures/usage-corejs3-versions-strings-minor-3.1/in/in.js b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-versions-strings-minor-3.0-1/input.js similarity index 100% rename from packages/babel-preset-env/test/debug-fixtures/usage-corejs3-versions-strings-minor-3.1/in/in.js rename to packages/babel-preset-env/test/fixtures/debug/usage-corejs3-versions-strings-minor-3.0-1/input.js diff --git a/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-versions-strings-minor-3.0-1/options.json b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-versions-strings-minor-3.0-1/options.json new file mode 100644 index 000000000000..14e2af08bf42 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-versions-strings-minor-3.0-1/options.json @@ -0,0 +1,19 @@ +{ + "validateLogs": true, + "ignoreOutput": true, + "presets": [ + [ + "env", + { + "debug": true, + "targets": { + "chrome": 52, + "firefox": 50, + "ie": 11 + }, + "useBuiltIns": "usage", + "corejs": "3.0" + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-versions-strings-minor-3.0-1/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-versions-strings-minor-3.0-1/stdout.txt new file mode 100644 index 000000000000..d9325f917ac1 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-versions-strings-minor-3.0-1/stdout.txt @@ -0,0 +1,55 @@ +@babel/preset-env: `DEBUG` option + +Using targets: +{ + "chrome": "52", + "firefox": "50", + "ie": "11" +} + +Using modules transform: auto + +Using plugins: + proposal-nullish-coalescing-operator { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-optional-chaining { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-json-strings { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-optional-catch-binding { "chrome":"52", "firefox":"50", "ie":"11" } + transform-parameters { "firefox":"50", "ie":"11" } + proposal-async-generator-functions { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-object-rest-spread { "chrome":"52", "firefox":"50", "ie":"11" } + transform-dotall-regex { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-unicode-property-regex { "chrome":"52", "firefox":"50", "ie":"11" } + transform-named-capturing-groups-regex { "chrome":"52", "firefox":"50", "ie":"11" } + transform-async-to-generator { "chrome":"52", "firefox":"50", "ie":"11" } + transform-exponentiation-operator { "firefox":"50", "ie":"11" } + transform-template-literals { "ie":"11" } + transform-literals { "firefox":"50", "ie":"11" } + transform-function-name { "firefox":"50", "ie":"11" } + transform-arrow-functions { "ie":"11" } + transform-classes { "ie":"11" } + transform-object-super { "ie":"11" } + transform-shorthand-properties { "ie":"11" } + transform-duplicate-keys { "ie":"11" } + transform-computed-properties { "ie":"11" } + transform-for-of { "firefox":"50", "ie":"11" } + transform-sticky-regex { "ie":"11" } + transform-unicode-regex { "ie":"11" } + transform-spread { "ie":"11" } + transform-destructuring { "firefox":"50", "ie":"11" } + transform-block-scoping { "firefox":"50", "ie":"11" } + transform-typeof-symbol { "ie":"11" } + transform-new-target { "ie":"11" } + transform-regenerator { "firefox":"50", "ie":"11" } + transform-modules-commonjs { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-dynamic-import { "chrome":"52", "firefox":"50", "ie":"11" } + +Using polyfills with `usage` option: + +[/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-versions-strings-minor-3.0-1/input.js] Added following core-js polyfills: + es.array.iterator { "chrome":"52", "firefox":"50", "ie":"11" } + es.map { "firefox":"50", "ie":"11" } + es.object.to-string { "firefox":"50", "ie":"11" } + es.promise { "chrome":"52", "firefox":"50", "ie":"11" } + es.string.iterator { "ie":"11" } + web.dom-collections.iterator { "chrome":"52", "firefox":"50", "ie":"11" } + web.queue-microtask { "chrome":"52", "firefox":"50", "ie":"11" } diff --git a/packages/babel-preset-env/test/debug-fixtures/usage-corejs3-versions-strings-minor-3.1/in/in2.js b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-versions-strings-minor-3.0-2/input.js similarity index 100% rename from packages/babel-preset-env/test/debug-fixtures/usage-corejs3-versions-strings-minor-3.1/in/in2.js rename to packages/babel-preset-env/test/fixtures/debug/usage-corejs3-versions-strings-minor-3.0-2/input.js diff --git a/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-versions-strings-minor-3.0-2/options.json b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-versions-strings-minor-3.0-2/options.json new file mode 100644 index 000000000000..14e2af08bf42 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-versions-strings-minor-3.0-2/options.json @@ -0,0 +1,19 @@ +{ + "validateLogs": true, + "ignoreOutput": true, + "presets": [ + [ + "env", + { + "debug": true, + "targets": { + "chrome": 52, + "firefox": 50, + "ie": 11 + }, + "useBuiltIns": "usage", + "corejs": "3.0" + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-versions-strings-minor-3.0-2/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-versions-strings-minor-3.0-2/stdout.txt new file mode 100644 index 000000000000..82dc0922f317 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-versions-strings-minor-3.0-2/stdout.txt @@ -0,0 +1,53 @@ +@babel/preset-env: `DEBUG` option + +Using targets: +{ + "chrome": "52", + "firefox": "50", + "ie": "11" +} + +Using modules transform: auto + +Using plugins: + proposal-nullish-coalescing-operator { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-optional-chaining { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-json-strings { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-optional-catch-binding { "chrome":"52", "firefox":"50", "ie":"11" } + transform-parameters { "firefox":"50", "ie":"11" } + proposal-async-generator-functions { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-object-rest-spread { "chrome":"52", "firefox":"50", "ie":"11" } + transform-dotall-regex { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-unicode-property-regex { "chrome":"52", "firefox":"50", "ie":"11" } + transform-named-capturing-groups-regex { "chrome":"52", "firefox":"50", "ie":"11" } + transform-async-to-generator { "chrome":"52", "firefox":"50", "ie":"11" } + transform-exponentiation-operator { "firefox":"50", "ie":"11" } + transform-template-literals { "ie":"11" } + transform-literals { "firefox":"50", "ie":"11" } + transform-function-name { "firefox":"50", "ie":"11" } + transform-arrow-functions { "ie":"11" } + transform-classes { "ie":"11" } + transform-object-super { "ie":"11" } + transform-shorthand-properties { "ie":"11" } + transform-duplicate-keys { "ie":"11" } + transform-computed-properties { "ie":"11" } + transform-for-of { "firefox":"50", "ie":"11" } + transform-sticky-regex { "ie":"11" } + transform-unicode-regex { "ie":"11" } + transform-spread { "ie":"11" } + transform-destructuring { "firefox":"50", "ie":"11" } + transform-block-scoping { "firefox":"50", "ie":"11" } + transform-typeof-symbol { "ie":"11" } + transform-new-target { "ie":"11" } + transform-regenerator { "firefox":"50", "ie":"11" } + transform-modules-commonjs { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-dynamic-import { "chrome":"52", "firefox":"50", "ie":"11" } + +Using polyfills with `usage` option: + +[/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-versions-strings-minor-3.0-2/input.js] Added following core-js polyfills: + es.array.iterator { "chrome":"52", "firefox":"50", "ie":"11" } + es.string.iterator { "ie":"11" } + web.dom-collections.iterator { "chrome":"52", "firefox":"50", "ie":"11" } + +[/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-versions-strings-minor-3.0-2/input.js] Based on your code and targets, added regenerator-runtime. diff --git a/packages/babel-preset-env/test/debug-fixtures/usage-corejs3/in/in.js b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-versions-strings-minor-3.1-1/input.js similarity index 100% rename from packages/babel-preset-env/test/debug-fixtures/usage-corejs3/in/in.js rename to packages/babel-preset-env/test/fixtures/debug/usage-corejs3-versions-strings-minor-3.1-1/input.js diff --git a/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-versions-strings-minor-3.1-1/options.json b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-versions-strings-minor-3.1-1/options.json new file mode 100644 index 000000000000..de96a9fb2a2f --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-versions-strings-minor-3.1-1/options.json @@ -0,0 +1,19 @@ +{ + "validateLogs": true, + "ignoreOutput": true, + "presets": [ + [ + "env", + { + "debug": true, + "targets": { + "chrome": 52, + "firefox": 50, + "ie": 11 + }, + "useBuiltIns": "usage", + "corejs": "3.1" + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-versions-strings-minor-3.1-1/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-versions-strings-minor-3.1-1/stdout.txt new file mode 100644 index 000000000000..c9852b6e5b36 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-versions-strings-minor-3.1-1/stdout.txt @@ -0,0 +1,55 @@ +@babel/preset-env: `DEBUG` option + +Using targets: +{ + "chrome": "52", + "firefox": "50", + "ie": "11" +} + +Using modules transform: auto + +Using plugins: + proposal-nullish-coalescing-operator { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-optional-chaining { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-json-strings { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-optional-catch-binding { "chrome":"52", "firefox":"50", "ie":"11" } + transform-parameters { "firefox":"50", "ie":"11" } + proposal-async-generator-functions { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-object-rest-spread { "chrome":"52", "firefox":"50", "ie":"11" } + transform-dotall-regex { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-unicode-property-regex { "chrome":"52", "firefox":"50", "ie":"11" } + transform-named-capturing-groups-regex { "chrome":"52", "firefox":"50", "ie":"11" } + transform-async-to-generator { "chrome":"52", "firefox":"50", "ie":"11" } + transform-exponentiation-operator { "firefox":"50", "ie":"11" } + transform-template-literals { "ie":"11" } + transform-literals { "firefox":"50", "ie":"11" } + transform-function-name { "firefox":"50", "ie":"11" } + transform-arrow-functions { "ie":"11" } + transform-classes { "ie":"11" } + transform-object-super { "ie":"11" } + transform-shorthand-properties { "ie":"11" } + transform-duplicate-keys { "ie":"11" } + transform-computed-properties { "ie":"11" } + transform-for-of { "firefox":"50", "ie":"11" } + transform-sticky-regex { "ie":"11" } + transform-unicode-regex { "ie":"11" } + transform-spread { "ie":"11" } + transform-destructuring { "firefox":"50", "ie":"11" } + transform-block-scoping { "firefox":"50", "ie":"11" } + transform-typeof-symbol { "ie":"11" } + transform-new-target { "ie":"11" } + transform-regenerator { "firefox":"50", "ie":"11" } + transform-modules-commonjs { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-dynamic-import { "chrome":"52", "firefox":"50", "ie":"11" } + +Using polyfills with `usage` option: + +[/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-versions-strings-minor-3.1-1/input.js] Added following core-js polyfills: + es.array.iterator { "chrome":"52", "firefox":"50", "ie":"11" } + es.map { "firefox":"50", "ie":"11" } + es.object.to-string { "firefox":"50", "ie":"11" } + es.promise { "chrome":"52", "firefox":"50", "ie":"11" } + es.string.iterator { "ie":"11" } + web.dom-collections.iterator { "chrome":"52", "firefox":"50", "ie":"11" } + web.queue-microtask { "chrome":"52", "firefox":"50", "ie":"11" } diff --git a/packages/babel-preset-env/test/debug-fixtures/usage-corejs3/in/in2.js b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-versions-strings-minor-3.1-2/input.js similarity index 100% rename from packages/babel-preset-env/test/debug-fixtures/usage-corejs3/in/in2.js rename to packages/babel-preset-env/test/fixtures/debug/usage-corejs3-versions-strings-minor-3.1-2/input.js diff --git a/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-versions-strings-minor-3.1-2/options.json b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-versions-strings-minor-3.1-2/options.json new file mode 100644 index 000000000000..de96a9fb2a2f --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-versions-strings-minor-3.1-2/options.json @@ -0,0 +1,19 @@ +{ + "validateLogs": true, + "ignoreOutput": true, + "presets": [ + [ + "env", + { + "debug": true, + "targets": { + "chrome": 52, + "firefox": 50, + "ie": 11 + }, + "useBuiltIns": "usage", + "corejs": "3.1" + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-versions-strings-minor-3.1-2/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-versions-strings-minor-3.1-2/stdout.txt new file mode 100644 index 000000000000..0b189d6a732d --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-versions-strings-minor-3.1-2/stdout.txt @@ -0,0 +1,53 @@ +@babel/preset-env: `DEBUG` option + +Using targets: +{ + "chrome": "52", + "firefox": "50", + "ie": "11" +} + +Using modules transform: auto + +Using plugins: + proposal-nullish-coalescing-operator { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-optional-chaining { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-json-strings { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-optional-catch-binding { "chrome":"52", "firefox":"50", "ie":"11" } + transform-parameters { "firefox":"50", "ie":"11" } + proposal-async-generator-functions { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-object-rest-spread { "chrome":"52", "firefox":"50", "ie":"11" } + transform-dotall-regex { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-unicode-property-regex { "chrome":"52", "firefox":"50", "ie":"11" } + transform-named-capturing-groups-regex { "chrome":"52", "firefox":"50", "ie":"11" } + transform-async-to-generator { "chrome":"52", "firefox":"50", "ie":"11" } + transform-exponentiation-operator { "firefox":"50", "ie":"11" } + transform-template-literals { "ie":"11" } + transform-literals { "firefox":"50", "ie":"11" } + transform-function-name { "firefox":"50", "ie":"11" } + transform-arrow-functions { "ie":"11" } + transform-classes { "ie":"11" } + transform-object-super { "ie":"11" } + transform-shorthand-properties { "ie":"11" } + transform-duplicate-keys { "ie":"11" } + transform-computed-properties { "ie":"11" } + transform-for-of { "firefox":"50", "ie":"11" } + transform-sticky-regex { "ie":"11" } + transform-unicode-regex { "ie":"11" } + transform-spread { "ie":"11" } + transform-destructuring { "firefox":"50", "ie":"11" } + transform-block-scoping { "firefox":"50", "ie":"11" } + transform-typeof-symbol { "ie":"11" } + transform-new-target { "ie":"11" } + transform-regenerator { "firefox":"50", "ie":"11" } + transform-modules-commonjs { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-dynamic-import { "chrome":"52", "firefox":"50", "ie":"11" } + +Using polyfills with `usage` option: + +[/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-versions-strings-minor-3.1-2/input.js] Added following core-js polyfills: + es.array.iterator { "chrome":"52", "firefox":"50", "ie":"11" } + es.string.iterator { "ie":"11" } + web.dom-collections.iterator { "chrome":"52", "firefox":"50", "ie":"11" } + +[/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-versions-strings-minor-3.1-2/input.js] Based on your code and targets, added regenerator-runtime. diff --git a/packages/babel-preset-env/test/debug-fixtures/usage-corejs3-with-import/in/in.js b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-with-import/input.mjs similarity index 100% rename from packages/babel-preset-env/test/debug-fixtures/usage-corejs3-with-import/in/in.js rename to packages/babel-preset-env/test/fixtures/debug/usage-corejs3-with-import/input.mjs diff --git a/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-with-import/options.json b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-with-import/options.json new file mode 100644 index 000000000000..a1d0ee8004f5 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-with-import/options.json @@ -0,0 +1,17 @@ +{ + "validateLogs": true, + "ignoreOutput": true, + "presets": [ + [ + "env", + { + "debug": true, + "targets": { + "chrome": 55 + }, + "useBuiltIns": "usage", + "corejs": 3 + } + ] + ] +} diff --git a/packages/babel-preset-env/test/debug-fixtures/usage-corejs3-with-import/stderr.txt b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-with-import/stderr.txt similarity index 100% rename from packages/babel-preset-env/test/debug-fixtures/usage-corejs3-with-import/stderr.txt rename to packages/babel-preset-env/test/fixtures/debug/usage-corejs3-with-import/stderr.txt diff --git a/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-with-import/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-with-import/stdout.txt new file mode 100644 index 000000000000..c14d41b62de9 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-with-import/stdout.txt @@ -0,0 +1,25 @@ +@babel/preset-env: `DEBUG` option + +Using targets: +{ + "chrome": "55" +} + +Using modules transform: auto + +Using plugins: + proposal-nullish-coalescing-operator { "chrome":"55" } + proposal-optional-chaining { "chrome":"55" } + proposal-json-strings { "chrome":"55" } + proposal-optional-catch-binding { "chrome":"55" } + proposal-async-generator-functions { "chrome":"55" } + proposal-object-rest-spread { "chrome":"55" } + transform-dotall-regex { "chrome":"55" } + proposal-unicode-property-regex { "chrome":"55" } + transform-named-capturing-groups-regex { "chrome":"55" } + transform-modules-commonjs { "chrome":"55" } + proposal-dynamic-import { "chrome":"55" } + +Using polyfills with `usage` option: + +[/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-with-import/input.mjs] Based on your code and targets, core-js polyfills were not added. diff --git a/packages/babel-preset-env/test/debug-fixtures/usage-no-corejs/in/in.js b/packages/babel-preset-env/test/fixtures/debug/usage-no-corejs-1/input.js similarity index 100% rename from packages/babel-preset-env/test/debug-fixtures/usage-no-corejs/in/in.js rename to packages/babel-preset-env/test/fixtures/debug/usage-no-corejs-1/input.js diff --git a/packages/babel-preset-env/test/fixtures/debug/usage-no-corejs-1/options.json b/packages/babel-preset-env/test/fixtures/debug/usage-no-corejs-1/options.json new file mode 100644 index 000000000000..e811528ee105 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/usage-no-corejs-1/options.json @@ -0,0 +1,18 @@ +{ + "validateLogs": true, + "ignoreOutput": true, + "presets": [ + [ + "env", + { + "debug": true, + "targets": { + "chrome": 52, + "firefox": 50, + "ie": 11 + }, + "useBuiltIns": "usage" + } + ] + ] +} diff --git a/packages/babel-preset-env/test/debug-fixtures/usage-no-corejs-none/stderr.txt b/packages/babel-preset-env/test/fixtures/debug/usage-no-corejs-1/stderr.txt similarity index 100% rename from packages/babel-preset-env/test/debug-fixtures/usage-no-corejs-none/stderr.txt rename to packages/babel-preset-env/test/fixtures/debug/usage-no-corejs-1/stderr.txt diff --git a/packages/babel-preset-env/test/fixtures/debug/usage-no-corejs-1/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/usage-no-corejs-1/stdout.txt new file mode 100644 index 000000000000..3d43e271e9ab --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/usage-no-corejs-1/stdout.txt @@ -0,0 +1,54 @@ +@babel/preset-env: `DEBUG` option + +Using targets: +{ + "chrome": "52", + "firefox": "50", + "ie": "11" +} + +Using modules transform: auto + +Using plugins: + proposal-nullish-coalescing-operator { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-optional-chaining { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-json-strings { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-optional-catch-binding { "chrome":"52", "firefox":"50", "ie":"11" } + transform-parameters { "firefox":"50", "ie":"11" } + proposal-async-generator-functions { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-object-rest-spread { "chrome":"52", "firefox":"50", "ie":"11" } + transform-dotall-regex { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-unicode-property-regex { "chrome":"52", "firefox":"50", "ie":"11" } + transform-named-capturing-groups-regex { "chrome":"52", "firefox":"50", "ie":"11" } + transform-async-to-generator { "chrome":"52", "firefox":"50", "ie":"11" } + transform-exponentiation-operator { "firefox":"50", "ie":"11" } + transform-template-literals { "ie":"11" } + transform-literals { "firefox":"50", "ie":"11" } + transform-function-name { "firefox":"50", "ie":"11" } + transform-arrow-functions { "ie":"11" } + transform-classes { "ie":"11" } + transform-object-super { "ie":"11" } + transform-shorthand-properties { "ie":"11" } + transform-duplicate-keys { "ie":"11" } + transform-computed-properties { "ie":"11" } + transform-for-of { "firefox":"50", "ie":"11" } + transform-sticky-regex { "ie":"11" } + transform-unicode-regex { "ie":"11" } + transform-spread { "ie":"11" } + transform-destructuring { "firefox":"50", "ie":"11" } + transform-block-scoping { "firefox":"50", "ie":"11" } + transform-typeof-symbol { "ie":"11" } + transform-new-target { "ie":"11" } + transform-regenerator { "firefox":"50", "ie":"11" } + transform-modules-commonjs { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-dynamic-import { "chrome":"52", "firefox":"50", "ie":"11" } + +Using polyfills with `usage` option: + +[/packages/babel-preset-env/test/fixtures/debug/usage-no-corejs-1/input.js] Added following core-js polyfills: + es6.object.to-string { "chrome":"52", "firefox":"50", "ie":"11" } + es6.promise { "ie":"11" } + es6.map { "firefox":"50", "ie":"11" } + es6.string.iterator { "ie":"11" } + es6.array.iterator { "ie":"11" } + web.dom.iterable { "chrome":"52", "firefox":"50", "ie":"11" } diff --git a/packages/babel-preset-env/test/debug-fixtures/usage-no-corejs/in/in2.js b/packages/babel-preset-env/test/fixtures/debug/usage-no-corejs-2/input.js similarity index 100% rename from packages/babel-preset-env/test/debug-fixtures/usage-no-corejs/in/in2.js rename to packages/babel-preset-env/test/fixtures/debug/usage-no-corejs-2/input.js diff --git a/packages/babel-preset-env/test/fixtures/debug/usage-no-corejs-2/options.json b/packages/babel-preset-env/test/fixtures/debug/usage-no-corejs-2/options.json new file mode 100644 index 000000000000..e811528ee105 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/usage-no-corejs-2/options.json @@ -0,0 +1,18 @@ +{ + "validateLogs": true, + "ignoreOutput": true, + "presets": [ + [ + "env", + { + "debug": true, + "targets": { + "chrome": 52, + "firefox": 50, + "ie": 11 + }, + "useBuiltIns": "usage" + } + ] + ] +} diff --git a/packages/babel-preset-env/test/debug-fixtures/usage-no-corejs/stderr.txt b/packages/babel-preset-env/test/fixtures/debug/usage-no-corejs-2/stderr.txt similarity index 100% rename from packages/babel-preset-env/test/debug-fixtures/usage-no-corejs/stderr.txt rename to packages/babel-preset-env/test/fixtures/debug/usage-no-corejs-2/stderr.txt diff --git a/packages/babel-preset-env/test/fixtures/debug/usage-no-corejs-2/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/usage-no-corejs-2/stdout.txt new file mode 100644 index 000000000000..0ab8583382c1 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/usage-no-corejs-2/stdout.txt @@ -0,0 +1,51 @@ +@babel/preset-env: `DEBUG` option + +Using targets: +{ + "chrome": "52", + "firefox": "50", + "ie": "11" +} + +Using modules transform: auto + +Using plugins: + proposal-nullish-coalescing-operator { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-optional-chaining { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-json-strings { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-optional-catch-binding { "chrome":"52", "firefox":"50", "ie":"11" } + transform-parameters { "firefox":"50", "ie":"11" } + proposal-async-generator-functions { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-object-rest-spread { "chrome":"52", "firefox":"50", "ie":"11" } + transform-dotall-regex { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-unicode-property-regex { "chrome":"52", "firefox":"50", "ie":"11" } + transform-named-capturing-groups-regex { "chrome":"52", "firefox":"50", "ie":"11" } + transform-async-to-generator { "chrome":"52", "firefox":"50", "ie":"11" } + transform-exponentiation-operator { "firefox":"50", "ie":"11" } + transform-template-literals { "ie":"11" } + transform-literals { "firefox":"50", "ie":"11" } + transform-function-name { "firefox":"50", "ie":"11" } + transform-arrow-functions { "ie":"11" } + transform-classes { "ie":"11" } + transform-object-super { "ie":"11" } + transform-shorthand-properties { "ie":"11" } + transform-duplicate-keys { "ie":"11" } + transform-computed-properties { "ie":"11" } + transform-for-of { "firefox":"50", "ie":"11" } + transform-sticky-regex { "ie":"11" } + transform-unicode-regex { "ie":"11" } + transform-spread { "ie":"11" } + transform-destructuring { "firefox":"50", "ie":"11" } + transform-block-scoping { "firefox":"50", "ie":"11" } + transform-typeof-symbol { "ie":"11" } + transform-new-target { "ie":"11" } + transform-regenerator { "firefox":"50", "ie":"11" } + transform-modules-commonjs { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-dynamic-import { "chrome":"52", "firefox":"50", "ie":"11" } + +Using polyfills with `usage` option: + +[/packages/babel-preset-env/test/fixtures/debug/usage-no-corejs-2/input.js] Added following core-js polyfill: + web.dom.iterable { "chrome":"52", "firefox":"50", "ie":"11" } + +[/packages/babel-preset-env/test/fixtures/debug/usage-no-corejs-2/input.js] Based on your code and targets, added regenerator-runtime. diff --git a/packages/babel-preset-env/test/debug-fixtures/usage-no-corejs-none/in/in.js b/packages/babel-preset-env/test/fixtures/debug/usage-no-corejs-none-1/input.js similarity index 100% rename from packages/babel-preset-env/test/debug-fixtures/usage-no-corejs-none/in/in.js rename to packages/babel-preset-env/test/fixtures/debug/usage-no-corejs-none-1/input.js diff --git a/packages/babel-preset-env/test/fixtures/debug/usage-no-corejs-none-1/options.json b/packages/babel-preset-env/test/fixtures/debug/usage-no-corejs-none-1/options.json new file mode 100644 index 000000000000..e811528ee105 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/usage-no-corejs-none-1/options.json @@ -0,0 +1,18 @@ +{ + "validateLogs": true, + "ignoreOutput": true, + "presets": [ + [ + "env", + { + "debug": true, + "targets": { + "chrome": 52, + "firefox": 50, + "ie": 11 + }, + "useBuiltIns": "usage" + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/debug/usage-no-corejs-none-1/stderr.txt b/packages/babel-preset-env/test/fixtures/debug/usage-no-corejs-none-1/stderr.txt new file mode 100644 index 000000000000..dbee5e8f3eb3 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/usage-no-corejs-none-1/stderr.txt @@ -0,0 +1,6 @@ +WARNING: We noticed you're using the `useBuiltIns` option without declaring a core-js version. Currently, we assume version 2.x when no version is passed. Since this default version will likely change in future versions of Babel, we recommend explicitly setting the core-js version you are using via the `corejs` option. + +You should also be sure that the version you pass to the `corejs` option matches the version specified in your `package.json`'s `dependencies` section. If it doesn't, you need to run one of the following commands: + + npm install --save core-js@2 npm install --save core-js@3 + yarn add core-js@2 yarn add core-js@3 \ No newline at end of file diff --git a/packages/babel-preset-env/test/fixtures/debug/usage-no-corejs-none-1/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/usage-no-corejs-none-1/stdout.txt new file mode 100644 index 000000000000..88512c2a579a --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/usage-no-corejs-none-1/stdout.txt @@ -0,0 +1,48 @@ +@babel/preset-env: `DEBUG` option + +Using targets: +{ + "chrome": "52", + "firefox": "50", + "ie": "11" +} + +Using modules transform: auto + +Using plugins: + proposal-nullish-coalescing-operator { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-optional-chaining { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-json-strings { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-optional-catch-binding { "chrome":"52", "firefox":"50", "ie":"11" } + transform-parameters { "firefox":"50", "ie":"11" } + proposal-async-generator-functions { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-object-rest-spread { "chrome":"52", "firefox":"50", "ie":"11" } + transform-dotall-regex { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-unicode-property-regex { "chrome":"52", "firefox":"50", "ie":"11" } + transform-named-capturing-groups-regex { "chrome":"52", "firefox":"50", "ie":"11" } + transform-async-to-generator { "chrome":"52", "firefox":"50", "ie":"11" } + transform-exponentiation-operator { "firefox":"50", "ie":"11" } + transform-template-literals { "ie":"11" } + transform-literals { "firefox":"50", "ie":"11" } + transform-function-name { "firefox":"50", "ie":"11" } + transform-arrow-functions { "ie":"11" } + transform-classes { "ie":"11" } + transform-object-super { "ie":"11" } + transform-shorthand-properties { "ie":"11" } + transform-duplicate-keys { "ie":"11" } + transform-computed-properties { "ie":"11" } + transform-for-of { "firefox":"50", "ie":"11" } + transform-sticky-regex { "ie":"11" } + transform-unicode-regex { "ie":"11" } + transform-spread { "ie":"11" } + transform-destructuring { "firefox":"50", "ie":"11" } + transform-block-scoping { "firefox":"50", "ie":"11" } + transform-typeof-symbol { "ie":"11" } + transform-new-target { "ie":"11" } + transform-regenerator { "firefox":"50", "ie":"11" } + transform-modules-commonjs { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-dynamic-import { "chrome":"52", "firefox":"50", "ie":"11" } + +Using polyfills with `usage` option: + +[/packages/babel-preset-env/test/fixtures/debug/usage-no-corejs-none-1/input.js] Based on your code and targets, core-js polyfills were not added. diff --git a/packages/babel-preset-env/test/debug-fixtures/usage-no-corejs-none/in/in2.js b/packages/babel-preset-env/test/fixtures/debug/usage-no-corejs-none-2/input.js similarity index 100% rename from packages/babel-preset-env/test/debug-fixtures/usage-no-corejs-none/in/in2.js rename to packages/babel-preset-env/test/fixtures/debug/usage-no-corejs-none-2/input.js diff --git a/packages/babel-preset-env/test/fixtures/debug/usage-no-corejs-none-2/options.json b/packages/babel-preset-env/test/fixtures/debug/usage-no-corejs-none-2/options.json new file mode 100644 index 000000000000..e811528ee105 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/usage-no-corejs-none-2/options.json @@ -0,0 +1,18 @@ +{ + "validateLogs": true, + "ignoreOutput": true, + "presets": [ + [ + "env", + { + "debug": true, + "targets": { + "chrome": 52, + "firefox": 50, + "ie": 11 + }, + "useBuiltIns": "usage" + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/debug/usage-no-corejs-none-2/stderr.txt b/packages/babel-preset-env/test/fixtures/debug/usage-no-corejs-none-2/stderr.txt new file mode 100644 index 000000000000..dbee5e8f3eb3 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/usage-no-corejs-none-2/stderr.txt @@ -0,0 +1,6 @@ +WARNING: We noticed you're using the `useBuiltIns` option without declaring a core-js version. Currently, we assume version 2.x when no version is passed. Since this default version will likely change in future versions of Babel, we recommend explicitly setting the core-js version you are using via the `corejs` option. + +You should also be sure that the version you pass to the `corejs` option matches the version specified in your `package.json`'s `dependencies` section. If it doesn't, you need to run one of the following commands: + + npm install --save core-js@2 npm install --save core-js@3 + yarn add core-js@2 yarn add core-js@3 \ No newline at end of file diff --git a/packages/babel-preset-env/test/fixtures/debug/usage-no-corejs-none-2/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/usage-no-corejs-none-2/stdout.txt new file mode 100644 index 000000000000..991eaf43c452 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/usage-no-corejs-none-2/stdout.txt @@ -0,0 +1,48 @@ +@babel/preset-env: `DEBUG` option + +Using targets: +{ + "chrome": "52", + "firefox": "50", + "ie": "11" +} + +Using modules transform: auto + +Using plugins: + proposal-nullish-coalescing-operator { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-optional-chaining { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-json-strings { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-optional-catch-binding { "chrome":"52", "firefox":"50", "ie":"11" } + transform-parameters { "firefox":"50", "ie":"11" } + proposal-async-generator-functions { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-object-rest-spread { "chrome":"52", "firefox":"50", "ie":"11" } + transform-dotall-regex { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-unicode-property-regex { "chrome":"52", "firefox":"50", "ie":"11" } + transform-named-capturing-groups-regex { "chrome":"52", "firefox":"50", "ie":"11" } + transform-async-to-generator { "chrome":"52", "firefox":"50", "ie":"11" } + transform-exponentiation-operator { "firefox":"50", "ie":"11" } + transform-template-literals { "ie":"11" } + transform-literals { "firefox":"50", "ie":"11" } + transform-function-name { "firefox":"50", "ie":"11" } + transform-arrow-functions { "ie":"11" } + transform-classes { "ie":"11" } + transform-object-super { "ie":"11" } + transform-shorthand-properties { "ie":"11" } + transform-duplicate-keys { "ie":"11" } + transform-computed-properties { "ie":"11" } + transform-for-of { "firefox":"50", "ie":"11" } + transform-sticky-regex { "ie":"11" } + transform-unicode-regex { "ie":"11" } + transform-spread { "ie":"11" } + transform-destructuring { "firefox":"50", "ie":"11" } + transform-block-scoping { "firefox":"50", "ie":"11" } + transform-typeof-symbol { "ie":"11" } + transform-new-target { "ie":"11" } + transform-regenerator { "firefox":"50", "ie":"11" } + transform-modules-commonjs { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-dynamic-import { "chrome":"52", "firefox":"50", "ie":"11" } + +Using polyfills with `usage` option: + +[/packages/babel-preset-env/test/fixtures/debug/usage-no-corejs-none-2/input.js] Based on your code and targets, core-js polyfills were not added. diff --git a/packages/babel-preset-env/test/fixtures/dynamic-import/auto-esm-supported-import-supported/options.json b/packages/babel-preset-env/test/fixtures/dynamic-import/auto-esm-supported-import-supported/options.json index 154ea4199025..65df7ec7a7d3 100644 --- a/packages/babel-preset-env/test/fixtures/dynamic-import/auto-esm-supported-import-supported/options.json +++ b/packages/babel-preset-env/test/fixtures/dynamic-import/auto-esm-supported-import-supported/options.json @@ -1,4 +1,5 @@ { + "validateLogs": true, "caller": { "name": "test-fixture", "supportsStaticESM": true, diff --git a/packages/babel-preset-env/test/fixtures/dynamic-import/auto-esm-supported-import-unsupported/options.json b/packages/babel-preset-env/test/fixtures/dynamic-import/auto-esm-supported-import-unsupported/options.json index c444f60ae955..85b4d7deafad 100644 --- a/packages/babel-preset-env/test/fixtures/dynamic-import/auto-esm-supported-import-unsupported/options.json +++ b/packages/babel-preset-env/test/fixtures/dynamic-import/auto-esm-supported-import-unsupported/options.json @@ -1,4 +1,5 @@ { + "validateLogs": true, "caller": { "name": "test-fixture", "supportsStaticESM": true, diff --git a/packages/babel-preset-env/test/fixtures/dynamic-import/auto-esm-supported-import-unsupported/stderr.txt b/packages/babel-preset-env/test/fixtures/dynamic-import/auto-esm-supported-import-unsupported/stderr.txt new file mode 100644 index 000000000000..f3e3df470839 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/dynamic-import/auto-esm-supported-import-unsupported/stderr.txt @@ -0,0 +1 @@ +Dynamic import can only be supported when transforming ES modules to AMD, CommonJS or SystemJS. Only the parser plugin will be enabled. diff --git a/packages/babel-preset-env/test/fixtures/dynamic-import/auto-esm-unsupported-import-unsupported/options.json b/packages/babel-preset-env/test/fixtures/dynamic-import/auto-esm-unsupported-import-unsupported/options.json index 370b48e76fb2..60d72e63221a 100644 --- a/packages/babel-preset-env/test/fixtures/dynamic-import/auto-esm-unsupported-import-unsupported/options.json +++ b/packages/babel-preset-env/test/fixtures/dynamic-import/auto-esm-unsupported-import-unsupported/options.json @@ -1,4 +1,5 @@ { + "validateLogs": true, "caller": { "name": "test-fixture", "supportsStaticESM": false, diff --git a/packages/babel-preset-env/test/fixtures/dynamic-import/auto-esm-unsupported-import-unsupported/output.js b/packages/babel-preset-env/test/fixtures/dynamic-import/auto-esm-unsupported-import-unsupported/output.js index 9c2292edabb1..1fbdb0891dc5 100644 --- a/packages/babel-preset-env/test/fixtures/dynamic-import/auto-esm-unsupported-import-unsupported/output.js +++ b/packages/babel-preset-env/test/fixtures/dynamic-import/auto-esm-unsupported-import-unsupported/output.js @@ -1,6 +1,10 @@ "use strict"; -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj["default"] = obj; return newObj; } } +function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } + +function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; } + +function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; } Promise.resolve().then(function () { return _interopRequireWildcard(require("foo")); diff --git a/packages/babel-preset-env/test/fixtures/dynamic-import/modules-amd/options.json b/packages/babel-preset-env/test/fixtures/dynamic-import/modules-amd/options.json index e34f77e9664c..dad5640aa571 100644 --- a/packages/babel-preset-env/test/fixtures/dynamic-import/modules-amd/options.json +++ b/packages/babel-preset-env/test/fixtures/dynamic-import/modules-amd/options.json @@ -1,3 +1,4 @@ { + "validateLogs": true, "presets": [["env", { "modules": "amd" }]] } diff --git a/packages/babel-preset-env/test/fixtures/dynamic-import/modules-amd/output.js b/packages/babel-preset-env/test/fixtures/dynamic-import/modules-amd/output.js index 07297795f680..3625cc4157ca 100644 --- a/packages/babel-preset-env/test/fixtures/dynamic-import/modules-amd/output.js +++ b/packages/babel-preset-env/test/fixtures/dynamic-import/modules-amd/output.js @@ -1,5 +1,9 @@ define(["require"], function (_require) { - function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj["default"] = obj; return newObj; } } + function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } + + function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; } + + function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; } new Promise(function (_resolve, _reject) { return _require(["foo"], function (imported) { diff --git a/packages/babel-preset-env/test/fixtures/dynamic-import/modules-cjs/options.json b/packages/babel-preset-env/test/fixtures/dynamic-import/modules-cjs/options.json index 1b03b37c6f6d..091b0e2a32c6 100644 --- a/packages/babel-preset-env/test/fixtures/dynamic-import/modules-cjs/options.json +++ b/packages/babel-preset-env/test/fixtures/dynamic-import/modules-cjs/options.json @@ -1,3 +1,4 @@ { + "validateLogs": true, "presets": [["env", { "modules": "cjs" }]] } diff --git a/packages/babel-preset-env/test/fixtures/dynamic-import/modules-cjs/output.js b/packages/babel-preset-env/test/fixtures/dynamic-import/modules-cjs/output.js index 9c2292edabb1..1fbdb0891dc5 100644 --- a/packages/babel-preset-env/test/fixtures/dynamic-import/modules-cjs/output.js +++ b/packages/babel-preset-env/test/fixtures/dynamic-import/modules-cjs/output.js @@ -1,6 +1,10 @@ "use strict"; -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj["default"] = obj; return newObj; } } +function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } + +function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; } + +function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; } Promise.resolve().then(function () { return _interopRequireWildcard(require("foo")); diff --git a/packages/babel-preset-env/test/fixtures/dynamic-import/modules-false/options.json b/packages/babel-preset-env/test/fixtures/dynamic-import/modules-false/options.json index 3c22b6872e58..c7c066f78489 100644 --- a/packages/babel-preset-env/test/fixtures/dynamic-import/modules-false/options.json +++ b/packages/babel-preset-env/test/fixtures/dynamic-import/modules-false/options.json @@ -1,3 +1,4 @@ { + "validateLogs": true, "presets": [["env", { "modules": false }]] } diff --git a/packages/babel-preset-env/test/fixtures/dynamic-import/modules-systemjs/options.json b/packages/babel-preset-env/test/fixtures/dynamic-import/modules-systemjs/options.json index 9be6fdb3812e..206e080b9c53 100644 --- a/packages/babel-preset-env/test/fixtures/dynamic-import/modules-systemjs/options.json +++ b/packages/babel-preset-env/test/fixtures/dynamic-import/modules-systemjs/options.json @@ -1,3 +1,4 @@ { + "validateLogs": true, "presets": [["env", { "modules": "systemjs" }]] } diff --git a/packages/babel-preset-env/test/fixtures/dynamic-import/modules-umd/options.json b/packages/babel-preset-env/test/fixtures/dynamic-import/modules-umd/options.json index da7772e2d584..6315da5c545a 100644 --- a/packages/babel-preset-env/test/fixtures/dynamic-import/modules-umd/options.json +++ b/packages/babel-preset-env/test/fixtures/dynamic-import/modules-umd/options.json @@ -1,3 +1,4 @@ { + "validateLogs": true, "presets": [["env", { "modules": "umd" }]] } diff --git a/packages/babel-preset-env/test/fixtures/dynamic-import/modules-umd/output.js b/packages/babel-preset-env/test/fixtures/dynamic-import/modules-umd/output.js index f66adb1fb317..f4b267b43c0b 100644 --- a/packages/babel-preset-env/test/fixtures/dynamic-import/modules-umd/output.js +++ b/packages/babel-preset-env/test/fixtures/dynamic-import/modules-umd/output.js @@ -10,7 +10,7 @@ factory(); global.input = mod.exports; } -})(this, function () { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function () { "use strict"; import("foo"); // warns diff --git a/packages/babel-preset-env/test/fixtures/dynamic-import/modules-umd/stderr.txt b/packages/babel-preset-env/test/fixtures/dynamic-import/modules-umd/stderr.txt new file mode 100644 index 000000000000..f3e3df470839 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/dynamic-import/modules-umd/stderr.txt @@ -0,0 +1 @@ +Dynamic import can only be supported when transforming ES modules to AMD, CommonJS or SystemJS. Only the parser plugin will be enabled. diff --git a/packages/babel-preset-env/test/fixtures/modules/auto-esm/options.json b/packages/babel-preset-env/test/fixtures/modules/auto-esm/options.json index c4294fee0e57..154ea4199025 100644 --- a/packages/babel-preset-env/test/fixtures/modules/auto-esm/options.json +++ b/packages/babel-preset-env/test/fixtures/modules/auto-esm/options.json @@ -1,7 +1,8 @@ { "caller": { "name": "test-fixture", - "supportsStaticESM": true + "supportsStaticESM": true, + "supportsDynamicImport": true }, "presets": ["env"] } diff --git a/packages/babel-preset-env/test/fixtures/modules/modules-umd/options.json b/packages/babel-preset-env/test/fixtures/modules/modules-umd/options.json index 18b39b6fa2e9..d4838a7e7e06 100644 --- a/packages/babel-preset-env/test/fixtures/modules/modules-umd/options.json +++ b/packages/babel-preset-env/test/fixtures/modules/modules-umd/options.json @@ -1,4 +1,5 @@ { + "validateLogs": true, "presets": [ [ "../../../../lib", diff --git a/packages/babel-preset-env/test/fixtures/modules/modules-umd/output.js b/packages/babel-preset-env/test/fixtures/modules/modules-umd/output.js index 231614902dde..f4afd867e11a 100644 --- a/packages/babel-preset-env/test/fixtures/modules/modules-umd/output.js +++ b/packages/babel-preset-env/test/fixtures/modules/modules-umd/output.js @@ -10,7 +10,7 @@ factory(global.a); global.input = mod.exports; } -})(this, function (_a) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_a) { "use strict"; _a = _interopRequireDefault(_a); diff --git a/packages/babel-preset-env/test/fixtures/modules/modules-umd/stderr.txt b/packages/babel-preset-env/test/fixtures/modules/modules-umd/stderr.txt new file mode 100644 index 000000000000..f3e3df470839 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/modules/modules-umd/stderr.txt @@ -0,0 +1 @@ +Dynamic import can only be supported when transforming ES modules to AMD, CommonJS or SystemJS. Only the parser plugin will be enabled. diff --git a/packages/babel-preset-env/test/fixtures/plugins-integration/issue-10662/input.mjs b/packages/babel-preset-env/test/fixtures/plugins-integration/issue-10662/input.mjs new file mode 100644 index 000000000000..99f2bc766393 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/plugins-integration/issue-10662/input.mjs @@ -0,0 +1,2 @@ +var globalThis = {}; +typeof globalThis; diff --git a/packages/babel-preset-env/test/fixtures/plugins-integration/issue-10662/options.json b/packages/babel-preset-env/test/fixtures/plugins-integration/issue-10662/options.json new file mode 100644 index 000000000000..0d3d80b290fc --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/plugins-integration/issue-10662/options.json @@ -0,0 +1,12 @@ +{ + "validateLogs": true, + "presets": [ + [ + "env", + { + "modules": "umd", + "targets": ["Safari 8", "IE 11"] + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/plugins-integration/issue-10662/output.js b/packages/babel-preset-env/test/fixtures/plugins-integration/issue-10662/output.js new file mode 100644 index 000000000000..8f9250faa0a2 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/plugins-integration/issue-10662/output.js @@ -0,0 +1,21 @@ +(function (global, factory) { + if (typeof define === "function" && define.amd) { + define([], factory); + } else if (typeof exports !== "undefined") { + factory(); + } else { + var mod = { + exports: {} + }; + factory(); + global.input = mod.exports; + } +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function () { + "use strict"; + + function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } + + var globalThis = {}; + + _typeof(globalThis); +}); diff --git a/packages/babel-preset-env/test/fixtures/plugins-integration/issue-10662/stderr.txt b/packages/babel-preset-env/test/fixtures/plugins-integration/issue-10662/stderr.txt new file mode 100644 index 000000000000..f3e3df470839 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/plugins-integration/issue-10662/stderr.txt @@ -0,0 +1 @@ +Dynamic import can only be supported when transforming ES modules to AMD, CommonJS or SystemJS. Only the parser plugin will be enabled. diff --git a/packages/babel-preset-env/test/fixtures/plugins-integration/issue-11278/input.mjs b/packages/babel-preset-env/test/fixtures/plugins-integration/issue-11278/input.mjs new file mode 100644 index 000000000000..aa7663d8e6f2 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/plugins-integration/issue-11278/input.mjs @@ -0,0 +1 @@ +function F({ a, ...O }, b = O){} diff --git a/packages/babel-preset-env/test/fixtures/plugins-integration/issue-11278/options.json b/packages/babel-preset-env/test/fixtures/plugins-integration/issue-11278/options.json new file mode 100644 index 000000000000..c2c1dcf03077 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/plugins-integration/issue-11278/options.json @@ -0,0 +1,11 @@ +{ + "presets": [ + [ + "env", + { + "targets": ["chrome 48"] + } + ] + ], + "plugins": ["external-helpers"] +} diff --git a/packages/babel-preset-env/test/fixtures/plugins-integration/issue-11278/output.js b/packages/babel-preset-env/test/fixtures/plugins-integration/issue-11278/output.js new file mode 100644 index 000000000000..f9c870793882 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/plugins-integration/issue-11278/output.js @@ -0,0 +1,7 @@ +"use strict"; + +function F(_ref) { + var a = _ref.a, + O = babelHelpers.objectWithoutProperties(_ref, ["a"]); + var b = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : O; +} diff --git a/packages/babel-preset-env/test/fixtures/plugins-integration/issue-7527/output.js b/packages/babel-preset-env/test/fixtures/plugins-integration/issue-7527/output.js index d0111f1a27ab..b0072c110849 100644 --- a/packages/babel-preset-env/test/fixtures/plugins-integration/issue-7527/output.js +++ b/packages/babel-preset-env/test/fixtures/plugins-integration/issue-7527/output.js @@ -1,20 +1,22 @@ "use strict"; -function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } +function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } + +function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function () { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } + function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } - function _wrapNativeSuper(Class) { var _cache = typeof Map === "function" ? new Map() : undefined; _wrapNativeSuper = function _wrapNativeSuper(Class) { if (Class === null || !_isNativeFunction(Class)) return Class; if (typeof Class !== "function") { throw new TypeError("Super expression must either be null or a function"); } if (typeof _cache !== "undefined") { if (_cache.has(Class)) return _cache.get(Class); _cache.set(Class, Wrapper); } function Wrapper() { return _construct(Class, arguments, _getPrototypeOf(this).constructor); } Wrapper.prototype = Object.create(Class.prototype, { constructor: { value: Wrapper, enumerable: false, writable: true, configurable: true } }); return _setPrototypeOf(Wrapper, Class); }; return _wrapNativeSuper(Class); } -function isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } +function _construct(Parent, args, Class) { if (_isNativeReflectConstruct()) { _construct = Reflect.construct; } else { _construct = function _construct(Parent, args, Class) { var a = [null]; a.push.apply(a, args); var Constructor = Function.bind.apply(Parent, a); var instance = new Constructor(); if (Class) _setPrototypeOf(instance, Class.prototype); return instance; }; } return _construct.apply(null, arguments); } -function _construct(Parent, args, Class) { if (isNativeReflectConstruct()) { _construct = Reflect.construct; } else { _construct = function _construct(Parent, args, Class) { var a = [null]; a.push.apply(a, args); var Constructor = Function.bind.apply(Parent, a); var instance = new Constructor(); if (Class) _setPrototypeOf(instance, Class.prototype); return instance; }; } return _construct.apply(null, arguments); } +function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } function _isNativeFunction(fn) { return Function.toString.call(fn).indexOf("[native code]") !== -1; } @@ -22,18 +24,18 @@ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || func function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } -var MyDate = -/*#__PURE__*/ -function (_Date) { +var MyDate = /*#__PURE__*/function (_Date) { _inherits(MyDate, _Date); + var _super = _createSuper(MyDate); + function MyDate(time) { _classCallCheck(this, MyDate); - return _possibleConstructorReturn(this, _getPrototypeOf(MyDate).call(this, time)); + return _super.call(this, time); } return MyDate; -}(_wrapNativeSuper(Date)); +}( /*#__PURE__*/_wrapNativeSuper(Date)); var myDate = new MyDate(); diff --git a/packages/babel-preset-env/test/fixtures/plugins-integration/issue-8951/exec.js b/packages/babel-preset-env/test/fixtures/plugins-integration/issue-8951/exec.js new file mode 100644 index 000000000000..0372fa5d04ee --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/plugins-integration/issue-8951/exec.js @@ -0,0 +1,3 @@ +expect(/.(?\p{ASCII})/su.exec("\nA").groups).toEqual({ + code: "A" +}); diff --git a/packages/babel-preset-env/test/fixtures/plugins-integration/issue-8951/options.json b/packages/babel-preset-env/test/fixtures/plugins-integration/issue-8951/options.json new file mode 100644 index 000000000000..26bf537b2805 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/plugins-integration/issue-8951/options.json @@ -0,0 +1,4 @@ +{ + "plugins": [], + "presets": ["../../../../lib"] +} diff --git a/packages/babel-preset-env/test/fixtures/plugins-integration/issue-9892/exec.js b/packages/babel-preset-env/test/fixtures/plugins-integration/issue-9892/exec.js new file mode 100644 index 000000000000..dad5dc1ba34f --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/plugins-integration/issue-9892/exec.js @@ -0,0 +1 @@ +expect(/[\p{L}\d_]+/u.test('ŁŻŹĆ')).toBe(true); diff --git a/packages/babel-preset-env/test/fixtures/plugins-integration/issue-9892/options.json b/packages/babel-preset-env/test/fixtures/plugins-integration/issue-9892/options.json new file mode 100644 index 000000000000..26bf537b2805 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/plugins-integration/issue-9892/options.json @@ -0,0 +1,4 @@ +{ + "plugins": [], + "presets": ["../../../../lib"] +} diff --git a/packages/babel-preset-env/test/fixtures/plugins-integration/issue-9935/input.js b/packages/babel-preset-env/test/fixtures/plugins-integration/issue-9935/input.js new file mode 100644 index 000000000000..af57902922e0 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/plugins-integration/issue-9935/input.js @@ -0,0 +1,7 @@ +class MyClass extends BaseClass { + async loadEntity() { + this.website = await this.loadWebsite(); + this.report.setCompany(this.website.company); + super.loadEntity(); + } +} diff --git a/packages/babel-preset-env/test/fixtures/plugins-integration/issue-9935/options.json b/packages/babel-preset-env/test/fixtures/plugins-integration/issue-9935/options.json new file mode 100644 index 000000000000..70f242c2ca72 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/plugins-integration/issue-9935/options.json @@ -0,0 +1,16 @@ +{ + "presets": [ + [ + "env", + { + "targets": [ + "Chrome >= 60", + "Safari >= 11", + "iOS >= 10.3", + "Firefox >= 55", + "Edge >= 16" + ] + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/plugins-integration/issue-9935/output.js b/packages/babel-preset-env/test/fixtures/plugins-integration/issue-9935/output.js new file mode 100644 index 000000000000..c955d4e85a46 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/plugins-integration/issue-9935/output.js @@ -0,0 +1,19 @@ +function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } } + +function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; } + +class MyClass extends BaseClass { + loadEntity() { + var _superprop_getLoadEntity = () => super.loadEntity, + _this = this; + + return _asyncToGenerator(function* () { + _this.website = yield _this.loadWebsite(); + + _this.report.setCompany(_this.website.company); + + _superprop_getLoadEntity().call(_this); + })(); + } + +} diff --git a/packages/babel-preset-env/test/fixtures/preset-options/browserslist-defaults-2/options.json b/packages/babel-preset-env/test/fixtures/preset-options/browserslist-defaults-2/options.json deleted file mode 100644 index 7ee0ee1a8a81..000000000000 --- a/packages/babel-preset-env/test/fixtures/preset-options/browserslist-defaults-2/options.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "presets": [ - [ - "../../../../lib", - { - "targets": { - "node": "current", - "browsers": ["defaults", "not ie <= 10"] - } - } - ] - ] -} diff --git a/packages/babel-preset-env/test/fixtures/preset-options/browserslist-defaults-2/output.js b/packages/babel-preset-env/test/fixtures/preset-options/browserslist-defaults-2/output.js deleted file mode 100644 index f894dda6a490..000000000000 --- a/packages/babel-preset-env/test/fixtures/preset-options/browserslist-defaults-2/output.js +++ /dev/null @@ -1,16 +0,0 @@ -"use strict"; - -function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); } - -function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } - -function _iterableToArrayLimit(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } - -function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } - -var test = function test(a, _ref, c) { - var _ref2 = _slicedToArray(_ref, 1), - b = _ref2[0]; - - return ""; -}; diff --git a/packages/babel-preset-env/test/fixtures/preset-options/browserslist-defaults-2/input.mjs b/packages/babel-preset-env/test/fixtures/preset-options/browserslist-defaults-not-ie/input.mjs similarity index 100% rename from packages/babel-preset-env/test/fixtures/preset-options/browserslist-defaults-2/input.mjs rename to packages/babel-preset-env/test/fixtures/preset-options/browserslist-defaults-not-ie/input.mjs diff --git a/packages/babel-preset-env/test/fixtures/preset-options/browserslist-defaults-not-ie/options.json b/packages/babel-preset-env/test/fixtures/preset-options/browserslist-defaults-not-ie/options.json new file mode 100644 index 000000000000..63828ae6c658 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/preset-options/browserslist-defaults-not-ie/options.json @@ -0,0 +1,13 @@ +{ + "presets": [ + [ + "../../../../lib", + { + "targets": { + "node": "current", + "browsers": ["defaults", "not ie <= 10", "not ie_mob <= 10"] + } + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/preset-options/browserslist-defaults-not-ie/output.js b/packages/babel-preset-env/test/fixtures/preset-options/browserslist-defaults-not-ie/output.js new file mode 100644 index 000000000000..fee7b6fb93ab --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/preset-options/browserslist-defaults-not-ie/output.js @@ -0,0 +1,20 @@ +"use strict"; + +function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); } + +function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } + +function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } + +function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } + +function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } + +function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } + +var test = function test(a, _ref, c) { + var _ref2 = _slicedToArray(_ref, 1), + b = _ref2[0]; + + return ""; +}; diff --git a/packages/babel-preset-env/test/fixtures/preset-options/loose-with-typeof-symbol-includes/output.js b/packages/babel-preset-env/test/fixtures/preset-options/loose-with-typeof-symbol-includes/output.js index 47a605e27410..80d9f2721b48 100644 --- a/packages/babel-preset-env/test/fixtures/preset-options/loose-with-typeof-symbol-includes/output.js +++ b/packages/babel-preset-env/test/fixtures/preset-options/loose-with-typeof-symbol-includes/output.js @@ -1,5 +1,5 @@ "use strict"; -function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } +function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } _typeof(Symbol()); diff --git a/packages/babel-preset-env/test/fixtures/preset-options/safari-10_3-block-scoped/options.json b/packages/babel-preset-env/test/fixtures/preset-options/safari-10_3-block-scoped/options.json index 7eca9afc37fe..daee94dc032e 100644 --- a/packages/babel-preset-env/test/fixtures/preset-options/safari-10_3-block-scoped/options.json +++ b/packages/babel-preset-env/test/fixtures/preset-options/safari-10_3-block-scoped/options.json @@ -1,4 +1,5 @@ { + "validateLogs": true, "presets": [ [ "../../../../lib", diff --git a/packages/babel-preset-env/test/fixtures/preset-options/safari-10_3-block-scoped/stdout.txt b/packages/babel-preset-env/test/fixtures/preset-options/safari-10_3-block-scoped/stdout.txt new file mode 100644 index 000000000000..6425e78aaaf7 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/preset-options/safari-10_3-block-scoped/stdout.txt @@ -0,0 +1,28 @@ +@babel/preset-env: `DEBUG` option + +Using targets: +{ + "safari": "10" +} + +Using modules transform: auto + +Using plugins: + proposal-nullish-coalescing-operator { "safari":"10" } + proposal-optional-chaining { "safari":"10" } + proposal-json-strings { "safari":"10" } + proposal-optional-catch-binding { "safari":"10" } + proposal-async-generator-functions { "safari":"10" } + proposal-object-rest-spread { "safari":"10" } + transform-dotall-regex { "safari":"10" } + proposal-unicode-property-regex { "safari":"10" } + transform-named-capturing-groups-regex { "safari":"10" } + transform-async-to-generator { "safari":"10" } + transform-exponentiation-operator { "safari":"10" } + transform-template-literals { "safari":"10" } + transform-unicode-regex { "safari":"10" } + transform-block-scoping { "safari":"10" } + transform-modules-commonjs { "safari":"10" } + proposal-dynamic-import { "safari":"10" } + +Using polyfills: No polyfills were added, since the `useBuiltIns` option was not set. diff --git a/packages/babel-preset-env/test/fixtures/preset-options/shippedProposals/output.js b/packages/babel-preset-env/test/fixtures/preset-options/shippedProposals/output.js index 4719ee3716e8..98267bac25f8 100644 --- a/packages/babel-preset-env/test/fixtures/preset-options/shippedProposals/output.js +++ b/packages/babel-preset-env/test/fixtures/preset-options/shippedProposals/output.js @@ -1,6 +1,6 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } -function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } +function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } @@ -12,7 +12,7 @@ function _awaitAsyncGenerator(value) { return new _AwaitValue(value); } function _wrapAsyncGenerator(fn) { return function () { return new _AsyncGenerator(fn.apply(this, arguments)); }; } -function _AsyncGenerator(gen) { var front, back; function send(key, arg) { return new Promise(function (resolve, reject) { var request = { key: key, arg: arg, resolve: resolve, reject: reject, next: null }; if (back) { back = back.next = request; } else { front = back = request; resume(key, arg); } }); } function resume(key, arg) { try { var result = gen[key](arg); var value = result.value; var wrappedAwait = value instanceof _AwaitValue; Promise.resolve(wrappedAwait ? value.wrapped : value).then(function (arg) { if (wrappedAwait) { resume("next", arg); return; } settle(result.done ? "return" : "normal", arg); }, function (err) { resume("throw", err); }); } catch (err) { settle("throw", err); } } function settle(type, value) { switch (type) { case "return": front.resolve({ value: value, done: true }); break; case "throw": front.reject(value); break; default: front.resolve({ value: value, done: false }); break; } front = front.next; if (front) { resume(front.key, front.arg); } else { back = null; } } this._invoke = send; if (typeof gen["return"] !== "function") { this["return"] = undefined; } } +function _AsyncGenerator(gen) { var front, back; function send(key, arg) { return new Promise(function (resolve, reject) { var request = { key: key, arg: arg, resolve: resolve, reject: reject, next: null }; if (back) { back = back.next = request; } else { front = back = request; resume(key, arg); } }); } function resume(key, arg) { try { var result = gen[key](arg); var value = result.value; var wrappedAwait = value instanceof _AwaitValue; Promise.resolve(wrappedAwait ? value.wrapped : value).then(function (arg) { if (wrappedAwait) { resume(key === "return" ? "return" : "next", arg); return; } settle(result.done ? "return" : "normal", arg); }, function (err) { resume("throw", err); }); } catch (err) { settle("throw", err); } } function settle(type, value) { switch (type) { case "return": front.resolve({ value: value, done: true }); break; case "throw": front.reject(value); break; default: front.resolve({ value: value, done: false }); break; } front = front.next; if (front) { resume(front.key, front.arg); } else { back = null; } } this._invoke = send; if (typeof gen["return"] !== "function") { this["return"] = undefined; } } if (typeof Symbol === "function" && Symbol.asyncIterator) { _AsyncGenerator.prototype[Symbol.asyncIterator] = function () { return this; }; } @@ -44,9 +44,7 @@ function agf() { } function _agf() { - _agf = _wrapAsyncGenerator( - /*#__PURE__*/ - regeneratorRuntime.mark(function _callee() { + _agf = _wrapAsyncGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() { return regeneratorRuntime.wrap(function _callee$(_context) { while (1) { switch (_context.prev = _context.next) { diff --git a/packages/babel-preset-env/test/fixtures/preset-options/unicode-property-regex-chrome-49/input.js b/packages/babel-preset-env/test/fixtures/preset-options/unicode-property-regex-chrome-49/input.js new file mode 100644 index 000000000000..4dc88814e7a9 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/preset-options/unicode-property-regex-chrome-49/input.js @@ -0,0 +1 @@ +/\p{Script_Extensions=Greek}/u; diff --git a/packages/babel-preset-env/test/fixtures/preset-options/unicode-property-regex-chrome-49/options.json b/packages/babel-preset-env/test/fixtures/preset-options/unicode-property-regex-chrome-49/options.json new file mode 100644 index 000000000000..0594e8b2ce13 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/preset-options/unicode-property-regex-chrome-49/options.json @@ -0,0 +1,10 @@ +{ + "presets": [ + [ + "../../../../lib", + { + "targets": "chrome 49" + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/preset-options/unicode-property-regex-chrome-49/output.js b/packages/babel-preset-env/test/fixtures/preset-options/unicode-property-regex-chrome-49/output.js new file mode 100644 index 000000000000..ca4cbfc0fb21 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/preset-options/unicode-property-regex-chrome-49/output.js @@ -0,0 +1 @@ +/(?:[\u0342\u0345\u0370-\u0373\u0375-\u0377\u037A-\u037D\u037F\u0384\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03E1\u03F0-\u03FF\u1D26-\u1D2A\u1D5D-\u1D61\u1D66-\u1D6A\u1DBF-\u1DC1\u1F00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FC4\u1FC6-\u1FD3\u1FD6-\u1FDB\u1FDD-\u1FEF\u1FF2-\u1FF4\u1FF6-\u1FFE\u2126\uAB65]|\uD800[\uDD40-\uDD8E\uDDA0]|\uD834[\uDE00-\uDE45])/; diff --git a/packages/babel-preset-env/test/fixtures/sanity/block-scoping-for-of/output.js b/packages/babel-preset-env/test/fixtures/sanity/block-scoping-for-of/output.js index 391887c3e15c..1eecdd7fcc05 100644 --- a/packages/babel-preset-env/test/fixtures/sanity/block-scoping-for-of/output.js +++ b/packages/babel-preset-env/test/fixtures/sanity/block-scoping-for-of/output.js @@ -1,15 +1,20 @@ -function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); } +function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); } -function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } +function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } -function _iterableToArrayLimit(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } +function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } +function _createForOfIteratorHelper(o) { if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { if (Array.isArray(o) || (o = _unsupportedIterableToArray(o))) { var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var it, normalCompletion = true, didErr = false, err; return { s: function s() { it = o[Symbol.iterator](); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; } + +function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } + +function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } + // https://github.com/babel/babel/issues/7557 -var _iteratorNormalCompletion = true; -var _didIteratorError = false; -var _iteratorError = undefined; +var _iterator = _createForOfIteratorHelper(c), + _step; try { var _loop = function _loop() { @@ -23,20 +28,11 @@ try { }); }; - for (var _iterator = c[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { + for (_iterator.s(); !(_step = _iterator.n()).done;) { _loop(); } } catch (err) { - _didIteratorError = true; - _iteratorError = err; + _iterator.e(err); } finally { - try { - if (!_iteratorNormalCompletion && _iterator["return"] != null) { - _iterator["return"](); - } - } finally { - if (_didIteratorError) { - throw _iteratorError; - } - } + _iterator.f(); } diff --git a/packages/babel-preset-env/test/fixtures/sanity/issue-10142-corejs2-entry/input.mjs b/packages/babel-preset-env/test/fixtures/sanity/issue-10142-corejs2-entry/input.mjs new file mode 100644 index 000000000000..bd6332b8bac3 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/sanity/issue-10142-corejs2-entry/input.mjs @@ -0,0 +1 @@ +import "core-js"; \ No newline at end of file diff --git a/packages/babel-preset-env/test/fixtures/sanity/issue-10142-corejs2-entry/options.json b/packages/babel-preset-env/test/fixtures/sanity/issue-10142-corejs2-entry/options.json new file mode 100644 index 000000000000..786316f22efb --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/sanity/issue-10142-corejs2-entry/options.json @@ -0,0 +1,14 @@ +{ + "presets": [ + [ + "env", + { + "useBuiltIns": "entry", + "corejs": 2, + "modules": false, + "targets": { "chrome": 65 } + } + ] + ], + "plugins": ["./plugin.js"] +} diff --git a/packages/babel-preset-env/test/fixtures/sanity/issue-10142-corejs2-entry/output.mjs b/packages/babel-preset-env/test/fixtures/sanity/issue-10142-corejs2-entry/output.mjs new file mode 100644 index 000000000000..05407cabf92a --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/sanity/issue-10142-corejs2-entry/output.mjs @@ -0,0 +1,6 @@ +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; diff --git a/packages/babel-preset-env/test/fixtures/sanity/issue-10142-corejs2-entry/plugin.js b/packages/babel-preset-env/test/fixtures/sanity/issue-10142-corejs2-entry/plugin.js new file mode 100644 index 000000000000..931322f3b71d --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/sanity/issue-10142-corejs2-entry/plugin.js @@ -0,0 +1,8 @@ +module.exports = () => ({ + visitor: { + ImportDeclaration(path) { + if (path.node.source.value === "core-js") return; + path.node.source.value = "MODIFIED"; + }, + }, +}); diff --git a/packages/babel-preset-env/test/fixtures/sanity/issue-10142-corejs2-usage/input.mjs b/packages/babel-preset-env/test/fixtures/sanity/issue-10142-corejs2-usage/input.mjs new file mode 100644 index 000000000000..b24e09f0c2fd --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/sanity/issue-10142-corejs2-usage/input.mjs @@ -0,0 +1 @@ +new Map(); \ No newline at end of file diff --git a/packages/babel-preset-env/test/fixtures/sanity/issue-10142-corejs2-usage/options.json b/packages/babel-preset-env/test/fixtures/sanity/issue-10142-corejs2-usage/options.json new file mode 100644 index 000000000000..d7ce4a4a7218 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/sanity/issue-10142-corejs2-usage/options.json @@ -0,0 +1,6 @@ +{ + "presets": [ + ["env", { "useBuiltIns": "usage", "corejs": 2, "modules": false }] + ], + "plugins": ["./plugin.js"] +} diff --git a/packages/babel-preset-env/test/fixtures/sanity/issue-10142-corejs2-usage/output.mjs b/packages/babel-preset-env/test/fixtures/sanity/issue-10142-corejs2-usage/output.mjs new file mode 100644 index 000000000000..2e074eea8b62 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/sanity/issue-10142-corejs2-usage/output.mjs @@ -0,0 +1,6 @@ +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +new Map(); diff --git a/packages/babel-preset-env/test/fixtures/sanity/issue-10142-corejs2-usage/plugin.js b/packages/babel-preset-env/test/fixtures/sanity/issue-10142-corejs2-usage/plugin.js new file mode 100644 index 000000000000..ddfe181cf61e --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/sanity/issue-10142-corejs2-usage/plugin.js @@ -0,0 +1,7 @@ +module.exports = () => ({ + visitor: { + ImportDeclaration(path) { + path.node.source.value = "MODIFIED"; + }, + }, +}); diff --git a/packages/babel-preset-env/test/fixtures/sanity/issue-10142-corejs3-entry/input.mjs b/packages/babel-preset-env/test/fixtures/sanity/issue-10142-corejs3-entry/input.mjs new file mode 100644 index 000000000000..bd6332b8bac3 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/sanity/issue-10142-corejs3-entry/input.mjs @@ -0,0 +1 @@ +import "core-js"; \ No newline at end of file diff --git a/packages/babel-preset-env/test/fixtures/sanity/issue-10142-corejs3-entry/options.json b/packages/babel-preset-env/test/fixtures/sanity/issue-10142-corejs3-entry/options.json new file mode 100644 index 000000000000..79d8456fac83 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/sanity/issue-10142-corejs3-entry/options.json @@ -0,0 +1,14 @@ +{ + "presets": [ + [ + "env", + { + "useBuiltIns": "entry", + "corejs": 3, + "modules": false, + "targets": { "chrome": 65 } + } + ] + ], + "plugins": ["./plugin.js"] +} diff --git a/packages/babel-preset-env/test/fixtures/sanity/issue-10142-corejs3-entry/output.mjs b/packages/babel-preset-env/test/fixtures/sanity/issue-10142-corejs3-entry/output.mjs new file mode 100644 index 000000000000..da903d0b0539 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/sanity/issue-10142-corejs3-entry/output.mjs @@ -0,0 +1,100 @@ +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; diff --git a/packages/babel-preset-env/test/fixtures/sanity/issue-10142-corejs3-entry/plugin.js b/packages/babel-preset-env/test/fixtures/sanity/issue-10142-corejs3-entry/plugin.js new file mode 100644 index 000000000000..931322f3b71d --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/sanity/issue-10142-corejs3-entry/plugin.js @@ -0,0 +1,8 @@ +module.exports = () => ({ + visitor: { + ImportDeclaration(path) { + if (path.node.source.value === "core-js") return; + path.node.source.value = "MODIFIED"; + }, + }, +}); diff --git a/packages/babel-preset-env/test/fixtures/sanity/issue-10142-corejs3-usage/input.mjs b/packages/babel-preset-env/test/fixtures/sanity/issue-10142-corejs3-usage/input.mjs new file mode 100644 index 000000000000..b24e09f0c2fd --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/sanity/issue-10142-corejs3-usage/input.mjs @@ -0,0 +1 @@ +new Map(); \ No newline at end of file diff --git a/packages/babel-preset-env/test/fixtures/sanity/issue-10142-corejs3-usage/options.json b/packages/babel-preset-env/test/fixtures/sanity/issue-10142-corejs3-usage/options.json new file mode 100644 index 000000000000..3d488206b51d --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/sanity/issue-10142-corejs3-usage/options.json @@ -0,0 +1,6 @@ +{ + "presets": [ + ["env", { "useBuiltIns": "usage", "corejs": 3, "modules": false }] + ], + "plugins": ["./plugin.js"] +} diff --git a/packages/babel-preset-env/test/fixtures/sanity/issue-10142-corejs3-usage/output.mjs b/packages/babel-preset-env/test/fixtures/sanity/issue-10142-corejs3-usage/output.mjs new file mode 100644 index 000000000000..2e074eea8b62 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/sanity/issue-10142-corejs3-usage/output.mjs @@ -0,0 +1,6 @@ +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +new Map(); diff --git a/packages/babel-preset-env/test/fixtures/sanity/issue-10142-corejs3-usage/plugin.js b/packages/babel-preset-env/test/fixtures/sanity/issue-10142-corejs3-usage/plugin.js new file mode 100644 index 000000000000..ddfe181cf61e --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/sanity/issue-10142-corejs3-usage/plugin.js @@ -0,0 +1,7 @@ +module.exports = () => ({ + visitor: { + ImportDeclaration(path) { + path.node.source.value = "MODIFIED"; + }, + }, +}); diff --git a/packages/babel-preset-env/test/fixtures/sanity/regex-dot-all/output.js b/packages/babel-preset-env/test/fixtures/sanity/regex-dot-all/output.js index a83a16174172..e11606be750b 100644 --- a/packages/babel-preset-env/test/fixtures/sanity/regex-dot-all/output.js +++ b/packages/babel-preset-env/test/fixtures/sanity/regex-dot-all/output.js @@ -1,2 +1,2 @@ -/[\0-\uFFFF]/; +/[\s\S]/; /(?:[\0-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/; diff --git a/packages/babel-preset-env/test/fixtures/top-level-await/supported/input.mjs b/packages/babel-preset-env/test/fixtures/top-level-await/supported/input.mjs new file mode 100644 index 000000000000..d8ddd6c0ad0b --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/top-level-await/supported/input.mjs @@ -0,0 +1 @@ +await 0; \ No newline at end of file diff --git a/packages/babel-preset-env/test/fixtures/top-level-await/supported/options.json b/packages/babel-preset-env/test/fixtures/top-level-await/supported/options.json new file mode 100644 index 000000000000..2bd09619445b --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/top-level-await/supported/options.json @@ -0,0 +1,9 @@ +{ + "caller": { + "name": "test-fixture", + "supportsStaticESM": true, + "supportsDynamicImport": true, + "supportsTopLevelAwait": true + }, + "presets": ["env"] +} diff --git a/packages/babel-preset-env/test/fixtures/top-level-await/supported/output.mjs b/packages/babel-preset-env/test/fixtures/top-level-await/supported/output.mjs new file mode 100644 index 000000000000..0a5e432fc91c --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/top-level-await/supported/output.mjs @@ -0,0 +1 @@ +await 0; diff --git a/packages/babel-preset-env/test/fixtures/top-level-await/unsupported/input.mjs b/packages/babel-preset-env/test/fixtures/top-level-await/unsupported/input.mjs new file mode 100644 index 000000000000..0a5e432fc91c --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/top-level-await/unsupported/input.mjs @@ -0,0 +1 @@ +await 0; diff --git a/packages/babel-preset-env/test/fixtures/top-level-await/unsupported/options.json b/packages/babel-preset-env/test/fixtures/top-level-await/unsupported/options.json new file mode 100644 index 000000000000..c3be96c108e5 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/top-level-await/unsupported/options.json @@ -0,0 +1,10 @@ +{ + "caller": { + "name": "test-fixture", + "supportsStaticESM": true, + "supportsDynamicImport": true, + "supportsTopLevelAwait": false + }, + "presets": ["env"], + "throws": "Can not use keyword 'await' outside an async function (1:0)" +} diff --git a/packages/babel-preset-env/test/index.spec.js b/packages/babel-preset-env/test/index.spec.js index 7b281f4e1885..f275da47abf2 100644 --- a/packages/babel-preset-env/test/index.spec.js +++ b/packages/babel-preset-env/test/index.spec.js @@ -1,6 +1,22 @@ "use strict"; const babelPresetEnv = require("../lib/index"); +const addCoreJS2UsagePlugin = require("../lib/polyfills/corejs2/usage-plugin") + .default; +const addCoreJS3UsagePlugin = require("../lib/polyfills/corejs3/usage-plugin") + .default; +const addRegeneratorUsagePlugin = require("../lib/polyfills/regenerator/usage-plugin") + .default; +const replaceCoreJS2EntryPlugin = require("../lib/polyfills/corejs2/entry-plugin") + .default; +const replaceCoreJS3EntryPlugin = require("../lib/polyfills/corejs3/entry-plugin") + .default; +const removeRegeneratorEntryPlugin = require("../lib/polyfills/regenerator/entry-plugin") + .default; +const transformations = require("../lib/module-transformations").default; + +const compatData = require("@babel/compat-data/plugins"); +const availablePlugins = require("../lib/available-plugins").default; describe("babel-preset-env", () => { describe("transformIncludesAndExcludes", () => { @@ -24,4 +40,222 @@ describe("babel-preset-env", () => { }); }); }); + describe("getModulesPluginNames", () => { + describe("modules is set to false", () => { + it("returns only syntax-dynamic-import", () => { + expect( + babelPresetEnv.getModulesPluginNames({ + modules: false, + transformations, + shouldTransformESM: false, + shouldTransformDynamicImport: false, + }), + ).toEqual(["syntax-dynamic-import"]); + }); + }); + describe("modules is not set to false", () => { + describe("ESMs should not be transformed", () => { + it("returns syntax-dynamic-import", () => { + expect( + babelPresetEnv.getModulesPluginNames({ + modules: "commonjs", + transformations, + shouldTransformESM: false, + shouldTransformDynamicImport: false, + }), + ).toEqual(["syntax-dynamic-import"]); + }); + }); + describe("ESMs should be transformed", () => { + describe("dynamic imports should not be transformed", () => { + it("returns specified modules transform and syntax-dynamic-import", () => { + expect( + babelPresetEnv.getModulesPluginNames({ + modules: "commonjs", + transformations, + shouldTransformESM: true, + shouldTransformDynamicImport: false, + }), + ).toEqual(["transform-modules-commonjs", "syntax-dynamic-import"]); + }); + }); + describe("dynamic imports should be transformed", () => { + it("returns specified modules transform and proposal-dynamic-import", () => { + expect( + babelPresetEnv.getModulesPluginNames({ + modules: "systemjs", + transformations, + shouldTransformESM: true, + shouldTransformDynamicImport: true, + }), + ).toEqual([ + "transform-modules-systemjs", + "proposal-dynamic-import", + ]); + }); + }); + }); + }); + }); + describe("getPolyfillPlugins", () => { + const staticProps = { + polyfillTargets: [], + include: new Set(), + exclude: new Set(), + proposals: false, + shippedProposals: false, + debug: false, + }; + describe("useBuiltIns is false", () => { + it("returns no polyfill plugins", () => { + expect( + babelPresetEnv.getPolyfillPlugins( + Object.assign( + { + useBuiltIns: false, + corejs: false, + regenerator: false, + }, + staticProps, + ), + ), + ).toEqual([]); + }); + }); + describe("useBuiltIns is not false", () => { + describe("corejs is not given", () => { + it("returns no polyfill plugins", () => { + expect( + babelPresetEnv.getPolyfillPlugins( + Object.assign( + { + useBuiltIns: "usage", + corejs: false, + regenerator: false, + }, + staticProps, + ), + ), + ).toEqual([]); + }); + }); + describe("useBuiltIns is set to usage", () => { + describe("using corejs 2", () => { + it("returns an array with core js 2 usage plugin", () => { + const polyfillPlugins = babelPresetEnv.getPolyfillPlugins( + Object.assign( + { + useBuiltIns: "usage", + corejs: { major: 2 }, + regenerator: false, + }, + staticProps, + ), + ); + expect(polyfillPlugins.length).toBe(1); + expect(polyfillPlugins[0][0]).toEqual(addCoreJS2UsagePlugin); + }); + }); + describe("using corejs 3", () => { + describe("regenerator is set to false", () => { + it("returns an array with core js 3 usage plugin", () => { + const polyfillPlugins = babelPresetEnv.getPolyfillPlugins( + Object.assign( + { + useBuiltIns: "usage", + corejs: { major: 3 }, + regenerator: false, + }, + staticProps, + ), + ); + expect(polyfillPlugins.length).toBe(1); + expect(polyfillPlugins[0][0]).toEqual(addCoreJS3UsagePlugin); + }); + }); + + describe("regenerator is set to true", () => { + it("returns an array with core js 3 usage plugin and add regenerator usage plugin", () => { + const polyfillPlugins = babelPresetEnv.getPolyfillPlugins( + Object.assign( + { + useBuiltIns: "usage", + corejs: { major: 3 }, + regenerator: true, + }, + staticProps, + ), + ); + expect(polyfillPlugins.length).toBe(2); + expect(polyfillPlugins[0][0]).toEqual(addCoreJS3UsagePlugin); + expect(polyfillPlugins[1][0]).toEqual(addRegeneratorUsagePlugin); + }); + }); + }); + }); + describe("useBuiltIns is set to entry", () => { + describe("using corejs 2", () => { + it("returns an array with core js 2 entry plugin", () => { + const polyfillPlugins = babelPresetEnv.getPolyfillPlugins( + Object.assign( + { + useBuiltIns: "entry", + corejs: { major: 2 }, + regenerator: true, + }, + staticProps, + ), + ); + expect(polyfillPlugins.length).toBe(1); + expect(polyfillPlugins[0][0]).toEqual(replaceCoreJS2EntryPlugin); + }); + }); + describe("using corejs 3", () => { + describe("regenerator is set to true", () => { + it("returns an array with core js 3 entry plugin", () => { + const polyfillPlugins = babelPresetEnv.getPolyfillPlugins( + Object.assign( + { + useBuiltIns: "entry", + corejs: { major: 3 }, + regenerator: true, + }, + staticProps, + ), + ); + expect(polyfillPlugins.length).toBe(1); + expect(polyfillPlugins[0][0]).toEqual(replaceCoreJS3EntryPlugin); + }); + }); + + describe("regenerator is set to false", () => { + it("returns an array with core js 3 entry plugin and remove regenerator entry plugin", () => { + const polyfillPlugins = babelPresetEnv.getPolyfillPlugins( + Object.assign( + { + useBuiltIns: "entry", + corejs: { major: 3 }, + regenerator: false, + }, + staticProps, + ), + ); + expect(polyfillPlugins.length).toBe(2); + expect(polyfillPlugins[0][0]).toEqual(replaceCoreJS3EntryPlugin); + expect(polyfillPlugins[1][0]).toEqual( + removeRegeneratorEntryPlugin, + ); + }); + }); + }); + }); + }); + }); + + it("available-plugins is in sync with @babel/compat-data", () => { + const arrAvailablePlugins = Object.keys(availablePlugins).sort(); + const arrCompatData = Object.keys(compatData).sort(); + + expect(arrAvailablePlugins).toEqual(expect.arrayContaining(arrCompatData)); + }); }); diff --git a/packages/babel-preset-env/test/is-plugin-required.js b/packages/babel-preset-env/test/is-plugin-required.js deleted file mode 100644 index be999b7c9828..000000000000 --- a/packages/babel-preset-env/test/is-plugin-required.js +++ /dev/null @@ -1,82 +0,0 @@ -"use strict"; - -const presetEnv = require("../"); - -describe("isPluginRequired", () => { - const MAX_VERSION = `${Number.MAX_SAFE_INTEGER}.0.0`; - - it("returns true if no targets are specified", () => { - expect(presetEnv.isPluginRequired({}, {})).toBe(true); - }); - - it("returns true if plugin feature is not implemented in one or more targets", () => { - let targets; - const plugin = { - edge: false, - firefox: 45, - chrome: 49, - }; - - targets = { - chrome: MAX_VERSION, - firefox: MAX_VERSION, - }; - expect(presetEnv.isPluginRequired(targets, plugin)).toBe(false); - - targets = { - edge: "12", - }; - expect(presetEnv.isPluginRequired(targets, plugin)).toBe(true); - }); - - it("returns false if plugin feature is implemented by lower than target", () => { - const plugin = { - chrome: 49, - }; - const targets = { - chrome: MAX_VERSION, - }; - - expect(presetEnv.isPluginRequired(targets, plugin)).toBe(false); - }); - - it("returns false if plugin feature is implemented is equal to target", () => { - const plugin = { - chrome: 49, - }; - const targets = { - chrome: "49.0.0", - }; - expect(presetEnv.isPluginRequired(targets, plugin)).toBe(false); - }); - - it("returns true if plugin feature is implemented is greater than target", () => { - const plugin = { - chrome: 50, - }; - const targets = { - chrome: "49.0.0", - }; - expect(presetEnv.isPluginRequired(targets, plugin)).toBe(true); - }); - - it("returns when target is a decimal", () => { - const plugin = { - node: 6.9, - }; - const targets = { - node: "6.10.0", - }; - expect(presetEnv.isPluginRequired(targets, plugin)).toBe(false); - }); - - it("throws an error if target version is invalid", () => { - const plugin = { - chrome: 50, - }; - const targets = { - chrome: 55, - }; - expect(() => presetEnv.isPluginRequired(targets, plugin)).toThrow(); - }); -}); diff --git a/packages/babel-preset-env/test/normalize-options.spec.js b/packages/babel-preset-env/test/normalize-options.spec.js index eefb69e45f46..62636e4882cf 100644 --- a/packages/babel-preset-env/test/normalize-options.spec.js +++ b/packages/babel-preset-env/test/normalize-options.spec.js @@ -6,6 +6,7 @@ const { checkDuplicateIncludeExcludes, validateBoolOption, validateModulesOption, + validateUseBuiltInsOption, normalizePluginName, } = normalizeOptions; describe("normalize-options", () => { @@ -84,6 +85,24 @@ describe("normalize-options", () => { }); }); }); + + it("throws when including module plugins", () => { + expect(() => + normalizeOptions.default({ include: ["proposal-dynamic-import"] }), + ).toThrow(); + expect(() => + normalizeOptions.default({ include: ["transform-modules-amd"] }), + ).toThrow(); + }); + + it("allows exclusion of module plugins ", () => { + expect(() => + normalizeOptions.default({ exclude: ["proposal-dynamic-import"] }), + ).not.toThrow(); + expect(() => + normalizeOptions.default({ exclude: ["transform-modules-commonjs"] }), + ).not.toThrow(); + }); }); describe("Config format validation", () => { @@ -224,10 +243,36 @@ describe("normalize-options", () => { }).toThrow(); }); + it("`'false'` option is invalid", () => { + expect(() => { + validateModulesOption("false"); + }).toThrow(); + }); + it("array option is invalid", () => { expect(() => { validateModulesOption([]); }).toThrow(); }); }); + + describe("validateUseBuiltInsOptions", () => { + it("usage option is valid", () => { + expect(validateUseBuiltInsOption("usage")).toBe("usage"); + }); + + it("entry option is valid", () => { + expect(validateUseBuiltInsOption("entry")).toBe("entry"); + }); + + it("`false` option returns false", () => { + expect(validateUseBuiltInsOption(false)).toBe(false); + }); + + it("`'false'` option is invalid", () => { + expect(() => { + validateUseBuiltInsOption("false"); + }).toThrow(); + }); + }); }); diff --git a/packages/babel-preset-env/test/utils.spec.js b/packages/babel-preset-env/test/utils.spec.js deleted file mode 100644 index 2dce5f76c504..000000000000 --- a/packages/babel-preset-env/test/utils.spec.js +++ /dev/null @@ -1,61 +0,0 @@ -"use strict"; - -const utils = require("../lib/utils"); - -const { prettifyTargets, prettifyVersion, semverify, findSuggestion } = utils; - -describe("utils", () => { - describe("semverify", () => { - it("returns", () => { - expect(semverify("1")).toBe("1.0.0"); - expect(semverify("1.0")).toBe("1.0.0"); - expect(semverify("1.0.0")).toBe("1.0.0"); - expect(semverify(1)).toBe("1.0.0"); - expect(semverify(1.2)).toBe("1.2.0"); - }); - - it("throws", () => { - const invalidSemver = () => { - semverify("invalid"); - }; - expect(invalidSemver).toThrow(); - }); - }); - - describe("prettifyVersion", () => { - it("returns", () => { - expect(prettifyVersion(true)).toBe(true); - expect(prettifyVersion("0.16.0")).toBe("0.16"); - expect(prettifyVersion("1.0.0")).toBe("1"); - expect(prettifyVersion("1.1.0")).toBe("1.1"); - expect(prettifyVersion("1.0.2")).toBe("1.0.2"); - expect(prettifyVersion("1.2.3")).toBe("1.2.3"); - }); - }); - - describe("prettifyTargets", () => { - it("returns", () => { - expect(prettifyTargets({})).toEqual({}); - - expect( - prettifyTargets({ - chrome: "54.0.0", - electron: "1.6.0", - node: "0.12.0", - }), - ).toEqual({ - chrome: "54", - electron: "1.6", - node: "0.12", - }); - }); - }); - - describe("findSuggestion", () => { - it("returns", () => { - const options = ["one", "two", "three"]; - expect(findSuggestion(options, "onr")).toEqual("one"); - expect(findSuggestion(options, "tree")).toEqual("three"); - }); - }); -}); diff --git a/packages/babel-preset-flow/package.json b/packages/babel-preset-flow/package.json index 80db216b5fdc..9ab10cade14d 100644 --- a/packages/babel-preset-flow/package.json +++ b/packages/babel-preset-flow/package.json @@ -1,6 +1,6 @@ { "name": "@babel/preset-flow", - "version": "7.0.0", + "version": "7.9.0", "description": "Babel preset for all Flow plugins.", "author": "James Kyle ", "repository": "https://github.com/babel/babel/tree/master/packages/babel-preset-flow", @@ -16,14 +16,14 @@ "types" ], "dependencies": { - "@babel/helper-plugin-utils": "^7.0.0", - "@babel/plugin-transform-flow-strip-types": "^7.0.0" + "@babel/helper-plugin-utils": "^7.8.3", + "@babel/plugin-transform-flow-strip-types": "^7.9.0" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.0.0", - "@babel/helper-plugin-test-runner": "^7.0.0" + "@babel/core": "^7.9.0", + "@babel/helper-plugin-test-runner": "^7.8.3" } } diff --git a/packages/babel-preset-flow/src/index.js b/packages/babel-preset-flow/src/index.js index 6fbd56a196a4..da02e7e6c026 100644 --- a/packages/babel-preset-flow/src/index.js +++ b/packages/babel-preset-flow/src/index.js @@ -1,10 +1,10 @@ import { declare } from "@babel/helper-plugin-utils"; import transformFlowStripTypes from "@babel/plugin-transform-flow-strip-types"; -export default declare((api, { all }) => { +export default declare((api, { all, allowDeclareFields }) => { api.assertVersion(7); return { - plugins: [[transformFlowStripTypes, { all }]], + plugins: [[transformFlowStripTypes, { all, allowDeclareFields }]], }; }); diff --git a/packages/babel-preset-react/package.json b/packages/babel-preset-react/package.json index a7c6e195a5ad..83ceffe03d3b 100644 --- a/packages/babel-preset-react/package.json +++ b/packages/babel-preset-react/package.json @@ -1,6 +1,6 @@ { "name": "@babel/preset-react", - "version": "7.0.0", + "version": "7.9.4", "description": "Babel preset for all React plugins.", "author": "Sebastian McKenzie ", "homepage": "https://babeljs.io/", @@ -11,18 +11,19 @@ "repository": "https://github.com/babel/babel/tree/master/packages/babel-preset-react", "main": "lib/index.js", "dependencies": { - "@babel/helper-plugin-utils": "^7.0.0", - "@babel/plugin-transform-react-display-name": "^7.0.0", - "@babel/plugin-transform-react-jsx": "^7.0.0", - "@babel/plugin-transform-react-jsx-self": "^7.0.0", - "@babel/plugin-transform-react-jsx-source": "^7.0.0" + "@babel/helper-plugin-utils": "^7.8.3", + "@babel/plugin-transform-react-display-name": "^7.8.3", + "@babel/plugin-transform-react-jsx": "^7.9.4", + "@babel/plugin-transform-react-jsx-development": "^7.9.0", + "@babel/plugin-transform-react-jsx-self": "^7.9.0", + "@babel/plugin-transform-react-jsx-source": "^7.9.0" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.0.0", - "@babel/helper-plugin-test-runner": "^7.0.0", - "@babel/helper-transform-fixture-test-runner": "^7.0.0" + "@babel/core": "^7.9.0", + "@babel/helper-plugin-test-runner": "^7.8.3", + "@babel/helper-transform-fixture-test-runner": "^7.8.3" } } diff --git a/packages/babel-preset-react/src/index.js b/packages/babel-preset-react/src/index.js index f99fe36e0b1c..40f3e0e635d6 100644 --- a/packages/babel-preset-react/src/index.js +++ b/packages/babel-preset-react/src/index.js @@ -1,5 +1,6 @@ import { declare } from "@babel/helper-plugin-utils"; import transformReactJSX from "@babel/plugin-transform-react-jsx"; +import transformReactJSXDevelopment from "@babel/plugin-transform-react-jsx-development"; import transformReactDisplayName from "@babel/plugin-transform-react-display-name"; import transformReactJSXSource from "@babel/plugin-transform-react-jsx-source"; import transformReactJSXSelf from "@babel/plugin-transform-react-jsx-self"; @@ -7,10 +8,23 @@ import transformReactJSXSelf from "@babel/plugin-transform-react-jsx-self"; export default declare((api, opts) => { api.assertVersion(7); - const pragma = opts.pragma || "React.createElement"; - const pragmaFrag = opts.pragmaFrag || "React.Fragment"; - const throwIfNamespace = - opts.throwIfNamespace === undefined ? true : !!opts.throwIfNamespace; + let { pragma, pragmaFrag } = opts; + + const { + pure, + throwIfNamespace = true, + useSpread, + runtime = "classic", + importSource, + } = opts; + + // TODO: (Babel 8) Remove setting these defaults + if (runtime === "classic") { + pragma = pragma || "React.createElement"; + pragmaFrag = pragmaFrag || "React.Fragment"; + } + + // TODO: (Babel 8) Don't cast these options but validate it const development = !!opts.development; const useBuiltIns = !!opts.useBuiltIns; @@ -20,16 +34,30 @@ export default declare((api, opts) => { ); } + const transformReactJSXPlugin = + runtime === "automatic" && development + ? transformReactJSXDevelopment + : transformReactJSX; + return { plugins: [ [ - transformReactJSX, - { pragma, pragmaFrag, throwIfNamespace, useBuiltIns }, + transformReactJSXPlugin, + { + importSource, + pragma, + pragmaFrag, + runtime, + throwIfNamespace, + useBuiltIns, + useSpread, + pure, + }, ], transformReactDisplayName, - development && transformReactJSXSource, - development && transformReactJSXSelf, + development && runtime === "classic" && transformReactJSXSource, + development && runtime === "classic" && transformReactJSXSelf, ].filter(Boolean), }; }); diff --git a/packages/babel-preset-react/test/fixtures/preset-options/development-runtime-automatic-windows/input.js b/packages/babel-preset-react/test/fixtures/preset-options/development-runtime-automatic-windows/input.js new file mode 100644 index 000000000000..378e2ae67b48 --- /dev/null +++ b/packages/babel-preset-react/test/fixtures/preset-options/development-runtime-automatic-windows/input.js @@ -0,0 +1 @@ + diff --git a/packages/babel-preset-react/test/fixtures/preset-options/development-runtime-automatic-windows/options.json b/packages/babel-preset-react/test/fixtures/preset-options/development-runtime-automatic-windows/options.json new file mode 100644 index 000000000000..5ad045f3cce9 --- /dev/null +++ b/packages/babel-preset-react/test/fixtures/preset-options/development-runtime-automatic-windows/options.json @@ -0,0 +1,4 @@ +{ + "presets": [["react", { "runtime": "automatic", "development": true }]], + "os": ["win32"] +} diff --git a/packages/babel-preset-react/test/fixtures/preset-options/development-runtime-automatic-windows/output.js b/packages/babel-preset-react/test/fixtures/preset-options/development-runtime-automatic-windows/output.js new file mode 100644 index 000000000000..baa69a7eb2f6 --- /dev/null +++ b/packages/babel-preset-react/test/fixtures/preset-options/development-runtime-automatic-windows/output.js @@ -0,0 +1,12 @@ +var _reactJsxDevRuntime = require("react/jsx-dev-runtime"); + +var _jsxFileName = "\\packages\\babel-preset-react\\test\\fixtures\\preset-options\\development-runtime-automatic-windows\\input.js"; + +/*#__PURE__*/ +_reactJsxDevRuntime.jsxDEV(Foo, { + bar: "baz" +}, void 0, false, { + fileName: _jsxFileName, + lineNumber: 1, + columnNumber: 1 +}, this); diff --git a/packages/babel-preset-react/test/fixtures/preset-options/development-runtime-automatic/input.js b/packages/babel-preset-react/test/fixtures/preset-options/development-runtime-automatic/input.js new file mode 100644 index 000000000000..378e2ae67b48 --- /dev/null +++ b/packages/babel-preset-react/test/fixtures/preset-options/development-runtime-automatic/input.js @@ -0,0 +1 @@ + diff --git a/packages/babel-preset-react/test/fixtures/preset-options/development-runtime-automatic/options.json b/packages/babel-preset-react/test/fixtures/preset-options/development-runtime-automatic/options.json new file mode 100644 index 000000000000..afe69b43a8d2 --- /dev/null +++ b/packages/babel-preset-react/test/fixtures/preset-options/development-runtime-automatic/options.json @@ -0,0 +1,4 @@ +{ + "presets": [["react", { "runtime": "automatic", "development": true }]], + "os": ["linux", "darwin"] +} diff --git a/packages/babel-preset-react/test/fixtures/preset-options/development-runtime-automatic/output.js b/packages/babel-preset-react/test/fixtures/preset-options/development-runtime-automatic/output.js new file mode 100644 index 000000000000..40c4ec890b5b --- /dev/null +++ b/packages/babel-preset-react/test/fixtures/preset-options/development-runtime-automatic/output.js @@ -0,0 +1,12 @@ +var _reactJsxDevRuntime = require("react/jsx-dev-runtime"); + +var _jsxFileName = "/packages/babel-preset-react/test/fixtures/preset-options/development-runtime-automatic/input.js"; + +/*#__PURE__*/ +_reactJsxDevRuntime.jsxDEV(Foo, { + bar: "baz" +}, void 0, false, { + fileName: _jsxFileName, + lineNumber: 1, + columnNumber: 1 +}, this); diff --git a/packages/babel-preset-react/test/fixtures/preset-options/development-windows/input.js b/packages/babel-preset-react/test/fixtures/preset-options/development-windows/input.js new file mode 100644 index 000000000000..86481bc26221 --- /dev/null +++ b/packages/babel-preset-react/test/fixtures/preset-options/development-windows/input.js @@ -0,0 +1 @@ +; diff --git a/packages/babel-preset-react/test/fixtures/preset-options/development-windows/options.json b/packages/babel-preset-react/test/fixtures/preset-options/development-windows/options.json new file mode 100644 index 000000000000..6ca8659a61e3 --- /dev/null +++ b/packages/babel-preset-react/test/fixtures/preset-options/development-windows/options.json @@ -0,0 +1,4 @@ +{ + "presets": [["react", { "development": true }]], + "os": ["win32"] +} diff --git a/packages/babel-preset-react/test/fixtures/preset-options/development-windows/output.js b/packages/babel-preset-react/test/fixtures/preset-options/development-windows/output.js new file mode 100644 index 000000000000..bad7508ddc0f --- /dev/null +++ b/packages/babel-preset-react/test/fixtures/preset-options/development-windows/output.js @@ -0,0 +1,12 @@ +var _jsxFileName = "\\packages\\babel-preset-react\\test\\fixtures\\preset-options\\development-windows\\input.js"; + +/*#__PURE__*/ +React.createElement(Foo, { + bar: "baz", + __self: this, + __source: { + fileName: _jsxFileName, + lineNumber: 1, + columnNumber: 1 + } +}); diff --git a/packages/babel-preset-react/test/fixtures/preset-options/development/exec.js b/packages/babel-preset-react/test/fixtures/preset-options/development/exec.js deleted file mode 100644 index 5ceb5a4a01c8..000000000000 --- a/packages/babel-preset-react/test/fixtures/preset-options/development/exec.js +++ /dev/null @@ -1,19 +0,0 @@ -const actual = transform( - '', - Object.assign({}, opts, { filename: '/fake/path/mock.js' }) -).code; - -const expected = multiline([ - 'var _jsxFileName = "/fake/path/mock.js";', - 'React.createElement(Foo, {', - ' bar: "baz",', - ' __source: {', - ' fileName: _jsxFileName,', - ' lineNumber: 1', - ' },', - ' __self: this', - '});', -]); - - -expect(actual).toBe(expected); diff --git a/packages/babel-preset-react/test/fixtures/preset-options/development/input.js b/packages/babel-preset-react/test/fixtures/preset-options/development/input.js new file mode 100644 index 000000000000..86481bc26221 --- /dev/null +++ b/packages/babel-preset-react/test/fixtures/preset-options/development/input.js @@ -0,0 +1 @@ +; diff --git a/packages/babel-preset-react/test/fixtures/preset-options/development/options.json b/packages/babel-preset-react/test/fixtures/preset-options/development/options.json index 20fb8a7d4beb..69900e734466 100644 --- a/packages/babel-preset-react/test/fixtures/preset-options/development/options.json +++ b/packages/babel-preset-react/test/fixtures/preset-options/development/options.json @@ -1,3 +1,4 @@ { - "presets": [["react", { "development": true }]] + "presets": [["react", { "development": true }]], + "os": ["linux", "darwin"] } diff --git a/packages/babel-preset-react/test/fixtures/preset-options/development/output.js b/packages/babel-preset-react/test/fixtures/preset-options/development/output.js new file mode 100644 index 000000000000..624cd815dc05 --- /dev/null +++ b/packages/babel-preset-react/test/fixtures/preset-options/development/output.js @@ -0,0 +1,12 @@ +var _jsxFileName = "/packages/babel-preset-react/test/fixtures/preset-options/development/input.js"; + +/*#__PURE__*/ +React.createElement(Foo, { + bar: "baz", + __self: this, + __source: { + fileName: _jsxFileName, + lineNumber: 1, + columnNumber: 1 + } +}); diff --git a/packages/babel-preset-react/test/fixtures/preset-options/empty-options/output.js b/packages/babel-preset-react/test/fixtures/preset-options/empty-options/output.js index 835263a79b1f..6bb6d5f16940 100644 --- a/packages/babel-preset-react/test/fixtures/preset-options/empty-options/output.js +++ b/packages/babel-preset-react/test/fixtures/preset-options/empty-options/output.js @@ -1,3 +1,4 @@ +/*#__PURE__*/ React.createElement(Foo, { bar: "baz" }); diff --git a/packages/babel-preset-react/test/fixtures/preset-options/no-options/output.js b/packages/babel-preset-react/test/fixtures/preset-options/no-options/output.js index 835263a79b1f..6bb6d5f16940 100644 --- a/packages/babel-preset-react/test/fixtures/preset-options/no-options/output.js +++ b/packages/babel-preset-react/test/fixtures/preset-options/no-options/output.js @@ -1,3 +1,4 @@ +/*#__PURE__*/ React.createElement(Foo, { bar: "baz" }); diff --git a/packages/babel-preset-react/test/fixtures/preset-options/runtime-automatic/input.js b/packages/babel-preset-react/test/fixtures/preset-options/runtime-automatic/input.js new file mode 100644 index 000000000000..378e2ae67b48 --- /dev/null +++ b/packages/babel-preset-react/test/fixtures/preset-options/runtime-automatic/input.js @@ -0,0 +1 @@ + diff --git a/packages/babel-preset-react/test/fixtures/preset-options/runtime-automatic/options.json b/packages/babel-preset-react/test/fixtures/preset-options/runtime-automatic/options.json new file mode 100644 index 000000000000..f9d93007e680 --- /dev/null +++ b/packages/babel-preset-react/test/fixtures/preset-options/runtime-automatic/options.json @@ -0,0 +1,3 @@ +{ + "presets": [["react", { "runtime": "automatic" }]] +} diff --git a/packages/babel-preset-react/test/fixtures/preset-options/runtime-automatic/output.js b/packages/babel-preset-react/test/fixtures/preset-options/runtime-automatic/output.js new file mode 100644 index 000000000000..1b9e086df135 --- /dev/null +++ b/packages/babel-preset-react/test/fixtures/preset-options/runtime-automatic/output.js @@ -0,0 +1,6 @@ +var _reactJsxRuntime = require("react/jsx-runtime"); + +/*#__PURE__*/ +_reactJsxRuntime.jsx(Foo, { + bar: "baz" +}); diff --git a/packages/babel-preset-react/test/fixtures/preset-options/runtime-classic-pragma-no-frag/input.js b/packages/babel-preset-react/test/fixtures/preset-options/runtime-classic-pragma-no-frag/input.js new file mode 100644 index 000000000000..a8deab21bf33 --- /dev/null +++ b/packages/babel-preset-react/test/fixtures/preset-options/runtime-classic-pragma-no-frag/input.js @@ -0,0 +1,3 @@ +/** @jsx jsx */ + +const Foo = <>; diff --git a/packages/babel-preset-react/test/fixtures/preset-options/runtime-classic-pragma-no-frag/options.json b/packages/babel-preset-react/test/fixtures/preset-options/runtime-classic-pragma-no-frag/options.json new file mode 100644 index 000000000000..12d195e58bc0 --- /dev/null +++ b/packages/babel-preset-react/test/fixtures/preset-options/runtime-classic-pragma-no-frag/options.json @@ -0,0 +1,3 @@ +{ + "presets": ["react"] +} diff --git a/packages/babel-preset-react/test/fixtures/preset-options/runtime-classic-pragma-no-frag/output.js b/packages/babel-preset-react/test/fixtures/preset-options/runtime-classic-pragma-no-frag/output.js new file mode 100644 index 000000000000..bc6f729c4978 --- /dev/null +++ b/packages/babel-preset-react/test/fixtures/preset-options/runtime-classic-pragma-no-frag/output.js @@ -0,0 +1,2 @@ +/** @jsx jsx */ +const Foo = jsx(React.Fragment, null); diff --git a/packages/babel-preset-react/test/fixtures/preset-options/runtime-classic/input.js b/packages/babel-preset-react/test/fixtures/preset-options/runtime-classic/input.js new file mode 100644 index 000000000000..378e2ae67b48 --- /dev/null +++ b/packages/babel-preset-react/test/fixtures/preset-options/runtime-classic/input.js @@ -0,0 +1 @@ + diff --git a/packages/babel-preset-react/test/fixtures/preset-options/runtime-classic/options.json b/packages/babel-preset-react/test/fixtures/preset-options/runtime-classic/options.json new file mode 100644 index 000000000000..feb8a2e82ffa --- /dev/null +++ b/packages/babel-preset-react/test/fixtures/preset-options/runtime-classic/options.json @@ -0,0 +1,3 @@ +{ + "presets": [["react", { "runtime": "classic" }]] +} diff --git a/packages/babel-preset-react/test/fixtures/preset-options/runtime-classic/output.js b/packages/babel-preset-react/test/fixtures/preset-options/runtime-classic/output.js new file mode 100644 index 000000000000..6bb6d5f16940 --- /dev/null +++ b/packages/babel-preset-react/test/fixtures/preset-options/runtime-classic/output.js @@ -0,0 +1,4 @@ +/*#__PURE__*/ +React.createElement(Foo, { + bar: "baz" +}); diff --git a/packages/babel-preset-react/test/fixtures/regression/11294/input.mjs b/packages/babel-preset-react/test/fixtures/regression/11294/input.mjs new file mode 100644 index 000000000000..ce3a2d3fffb9 --- /dev/null +++ b/packages/babel-preset-react/test/fixtures/regression/11294/input.mjs @@ -0,0 +1,2 @@ +import React from 'react'; +const D = <>; diff --git a/packages/babel-preset-react/test/fixtures/regression/11294/options.json b/packages/babel-preset-react/test/fixtures/regression/11294/options.json new file mode 100644 index 000000000000..238981a96b81 --- /dev/null +++ b/packages/babel-preset-react/test/fixtures/regression/11294/options.json @@ -0,0 +1,4 @@ +{ + "presets": [ + ["react", { "pragma": "__jsx" }]] +} diff --git a/packages/babel-preset-react/test/fixtures/regression/11294/output.mjs b/packages/babel-preset-react/test/fixtures/regression/11294/output.mjs new file mode 100644 index 000000000000..91e0be8760ba --- /dev/null +++ b/packages/babel-preset-react/test/fixtures/regression/11294/output.mjs @@ -0,0 +1,3 @@ +import React from 'react'; + +const D = __jsx(React.Fragment, null); diff --git a/packages/babel-preset-stage-0/.npmignore b/packages/babel-preset-stage-0/.npmignore deleted file mode 100644 index f9806945836e..000000000000 --- a/packages/babel-preset-stage-0/.npmignore +++ /dev/null @@ -1,3 +0,0 @@ -src -test -*.log diff --git a/packages/babel-preset-stage-0/README.md b/packages/babel-preset-stage-0/README.md deleted file mode 100644 index 682610488941..000000000000 --- a/packages/babel-preset-stage-0/README.md +++ /dev/null @@ -1,65 +0,0 @@ -# @babel/preset-stage-0 - -As of v7.0.0-beta.55, we've removed Babel's Stage presets. Please consider reading our [blog post](https://babeljs.io/blog/2018/07/27/removing-babels-stage-presets) on this decision for more details. TL;DR is that it's more beneficial in the long run to explicitly add which proposals to use. - ---- - -For a more automatic migration, we have updated [babel-upgrade](https://github.com/babel/babel-upgrade) to do this for you (you can run `npx babel-upgrade`). - -If you want the same configuration as before: - -```jsonc -{ - "plugins": [ - // Stage 0 - "@babel/plugin-proposal-function-bind", - - // Stage 1 - "@babel/plugin-proposal-export-default-from", - "@babel/plugin-proposal-logical-assignment-operators", - ["@babel/plugin-proposal-optional-chaining", { "loose": false }], - ["@babel/plugin-proposal-pipeline-operator", { "proposal": "minimal" }], - ["@babel/plugin-proposal-nullish-coalescing-operator", { "loose": false }], - "@babel/plugin-proposal-do-expressions", - - // Stage 2 - ["@babel/plugin-proposal-decorators", { "legacy": true }], - "@babel/plugin-proposal-function-sent", - "@babel/plugin-proposal-export-namespace-from", - "@babel/plugin-proposal-numeric-separator", - "@babel/plugin-proposal-throw-expressions", - - // Stage 3 - "@babel/plugin-syntax-dynamic-import", - "@babel/plugin-syntax-import-meta", - ["@babel/plugin-proposal-class-properties", { "loose": true }], - "@babel/plugin-proposal-json-strings" - ] -} -``` - -If you're using the same configuration across many separate projects, -keep in mind that you can also create your own custom presets with -whichever plugins and presets you're looking to use. - -```js -module.exports = function() { - return { - plugins: [ - require("@babel/plugin-syntax-dynamic-import"), - [require("@babel/plugin-proposal-decorators"), { "legacy": true }], - [require("@babel/plugin-proposal-class-properties"), { "loose": true }], - ], - presets: [ - // ... - ], - }; -}; -``` - -**NOTE: Compatibility between `@babel/plugin-proposal-class-properties` and `@babel/plugin-proposal-decorators`** -If you are including your plugins manually and using `@babel/plugin-proposal-class-properties`, make sure that `@babel/plugin-proposal-decorators` comes before `@babel/plugin-proposal-class-properties`. - -When using the `legacy: true` option of `@babel/plugin-proposal-decorators`, `@babel/plugin-proposal-class-properties` must be used in `loose: true` mode. - -If you are not using `@babel/plugin-proposal-decorators`, `loose` mode is not needed. \ No newline at end of file diff --git a/packages/babel-preset-stage-0/package.json b/packages/babel-preset-stage-0/package.json deleted file mode 100644 index dc2ea43dc886..000000000000 --- a/packages/babel-preset-stage-0/package.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "name": "@babel/preset-stage-0", - "version": "7.0.0", - "description": "Babel preset for stage 0 plugins", - "author": "Sebastian McKenzie ", - "homepage": "https://babeljs.io/", - "license": "MIT", - "publishConfig": { - "access": "public" - }, - "repository": "https://github.com/babel/babel/tree/master/packages/babel-preset-stage-0", - "main": "lib/index.js" -} diff --git a/packages/babel-preset-stage-0/src/index.js b/packages/babel-preset-stage-0/src/index.js deleted file mode 100644 index da2a61a9f4bd..000000000000 --- a/packages/babel-preset-stage-0/src/index.js +++ /dev/null @@ -1,60 +0,0 @@ -export default function() { - throw new Error(` -As of v7.0.0-beta.55, we've removed Babel's Stage presets. -Please consider reading our blog post on this decision at -https://babeljs.io/blog/2018/07/27/removing-babels-stage-presets -for more details. TL;DR is that it's more beneficial in the - long run to explicitly add which proposals to use. - -For a more automatic migration, we have updated babel-upgrade, -https://github.com/babel/babel-upgrade to do this for you with -"npx babel-upgrade". - -If you want the same configuration as before: - -{ - "plugins": [ - // Stage 0 - "@babel/plugin-proposal-function-bind", - - // Stage 1 - "@babel/plugin-proposal-export-default-from", - "@babel/plugin-proposal-logical-assignment-operators", - ["@babel/plugin-proposal-optional-chaining", { "loose": false }], - ["@babel/plugin-proposal-pipeline-operator", { "proposal": "minimal" }], - ["@babel/plugin-proposal-nullish-coalescing-operator", { "loose": false }], - "@babel/plugin-proposal-do-expressions", - - // Stage 2 - ["@babel/plugin-proposal-decorators", { "legacy": true }], - "@babel/plugin-proposal-function-sent", - "@babel/plugin-proposal-export-namespace-from", - "@babel/plugin-proposal-numeric-separator", - "@babel/plugin-proposal-throw-expressions", - - // Stage 3 - "@babel/plugin-syntax-dynamic-import", - "@babel/plugin-syntax-import-meta", - ["@babel/plugin-proposal-class-properties", { "loose": false }], - "@babel/plugin-proposal-json-strings" - ] -} - -If you're using the same configuration across many separate projects, -keep in mind that you can also create your own custom presets with -whichever plugins and presets you're looking to use. - -module.exports = function() { - return { - plugins: [ - require("@babel/plugin-syntax-dynamic-import"), - [require("@babel/plugin-proposal-decorators"), { "legacy": true }], - [require("@babel/plugin-proposal-class-properties"), { "loose": false }], - ], - presets: [ - // ... - ], - }; -}; - `); -} diff --git a/packages/babel-preset-stage-1/.npmignore b/packages/babel-preset-stage-1/.npmignore deleted file mode 100644 index f9806945836e..000000000000 --- a/packages/babel-preset-stage-1/.npmignore +++ /dev/null @@ -1,3 +0,0 @@ -src -test -*.log diff --git a/packages/babel-preset-stage-1/README.md b/packages/babel-preset-stage-1/README.md deleted file mode 100644 index f8757e944ad2..000000000000 --- a/packages/babel-preset-stage-1/README.md +++ /dev/null @@ -1,62 +0,0 @@ -# @babel/preset-stage-1 - -As of v7.0.0-beta.55, we've removed Babel's Stage presets. Please consider reading our [blog post](https://babeljs.io/blog/2018/07/27/removing-babels-stage-presets) on this decision for more details. TL;DR is that it's more beneficial in the long run to explicitly add which proposals to use. - ---- - -For a more automatic migration, we have updated [babel-upgrade](https://github.com/babel/babel-upgrade) to do this for you (you can run `npx babel-upgrade`). - -If you want the same configuration as before: - -```jsonc -{ - "plugins": [ - // Stage 1 - "@babel/plugin-proposal-export-default-from", - "@babel/plugin-proposal-logical-assignment-operators", - ["@babel/plugin-proposal-optional-chaining", { "loose": false }], - ["@babel/plugin-proposal-pipeline-operator", { "proposal": "minimal" }], - ["@babel/plugin-proposal-nullish-coalescing-operator", { "loose": false }], - "@babel/plugin-proposal-do-expressions", - - // Stage 2 - ["@babel/plugin-proposal-decorators", { "legacy": true }], - "@babel/plugin-proposal-function-sent", - "@babel/plugin-proposal-export-namespace-from", - "@babel/plugin-proposal-numeric-separator", - "@babel/plugin-proposal-throw-expressions", - - // Stage 3 - "@babel/plugin-syntax-dynamic-import", - "@babel/plugin-syntax-import-meta", - ["@babel/plugin-proposal-class-properties", { "loose": true }], - "@babel/plugin-proposal-json-strings" - ] -} -``` - -If you're using the same configuration across many separate projects, -keep in mind that you can also create your own custom presets with -whichever plugins and presets you're looking to use. - -```js -module.exports = function() { - return { - plugins: [ - require("@babel/plugin-syntax-dynamic-import"), - [require("@babel/plugin-proposal-decorators"), { "legacy": true }], - [require("@babel/plugin-proposal-class-properties"), { "loose": false }], - ], - presets: [ - // ... - ], - }; -}; -``` - -**NOTE: Compatibility between `@babel/plugin-proposal-class-properties` and `@babel/plugin-proposal-decorators`** -If you are including your plugins manually and using `@babel/plugin-proposal-class-properties`, make sure that `@babel/plugin-proposal-decorators` comes before `@babel/plugin-proposal-class-properties`. - -When using the `legacy: true` option of `@babel/plugin-proposal-decorators`, `@babel/plugin-proposal-class-properties` must be used in `loose: true` mode. - -If you are not using `@babel/plugin-proposal-decorators`, `loose` mode is not needed. \ No newline at end of file diff --git a/packages/babel-preset-stage-1/package.json b/packages/babel-preset-stage-1/package.json deleted file mode 100644 index 377959f83400..000000000000 --- a/packages/babel-preset-stage-1/package.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "name": "@babel/preset-stage-1", - "version": "7.0.0", - "description": "Babel preset for stage 1 plugins", - "author": "Sebastian McKenzie ", - "homepage": "https://babeljs.io/", - "license": "MIT", - "publishConfig": { - "access": "public" - }, - "repository": "https://github.com/babel/babel/tree/master/packages/babel-preset-stage-1", - "main": "lib/index.js" -} diff --git a/packages/babel-preset-stage-1/src/index.js b/packages/babel-preset-stage-1/src/index.js deleted file mode 100644 index 7b7055285591..000000000000 --- a/packages/babel-preset-stage-1/src/index.js +++ /dev/null @@ -1,57 +0,0 @@ -export default function() { - throw new Error(` -As of v7.0.0-beta.55, we've removed Babel's Stage presets. -Please consider reading our blog post on this decision at -https://babeljs.io/blog/2018/07/27/removing-babels-stage-presets -for more details. TL;DR is that it's more beneficial in the - long run to explicitly add which proposals to use. - -For a more automatic migration, we have updated babel-upgrade, -https://github.com/babel/babel-upgrade to do this for you with -"npx babel-upgrade". - -If you want the same configuration as before: - -{ - "plugins": [ - // Stage 1 - "@babel/plugin-proposal-export-default-from", - "@babel/plugin-proposal-logical-assignment-operators", - ["@babel/plugin-proposal-optional-chaining", { "loose": false }], - ["@babel/plugin-proposal-pipeline-operator", { "proposal": "minimal" }], - ["@babel/plugin-proposal-nullish-coalescing-operator", { "loose": false }], - "@babel/plugin-proposal-do-expressions", - - // Stage 2 - ["@babel/plugin-proposal-decorators", { "legacy": true }], - "@babel/plugin-proposal-function-sent", - "@babel/plugin-proposal-export-namespace-from", - "@babel/plugin-proposal-numeric-separator", - "@babel/plugin-proposal-throw-expressions", - - // Stage 3 - "@babel/plugin-syntax-dynamic-import", - "@babel/plugin-syntax-import-meta", - ["@babel/plugin-proposal-class-properties", { "loose": false }], - "@babel/plugin-proposal-json-strings" - ] -} - -If you're using the same configuration across many separate projects, -keep in mind that you can also create your own custom presets with -whichever plugins and presets you're looking to use. - -module.exports = function() { - return { - plugins: [ - require("@babel/plugin-syntax-dynamic-import"), - [require("@babel/plugin-proposal-decorators"), { "legacy": true }], - [require("@babel/plugin-proposal-class-properties"), { "loose": false }], - ], - presets: [ - // ... - ], - }; -}; -`); -} diff --git a/packages/babel-preset-stage-2/.npmignore b/packages/babel-preset-stage-2/.npmignore deleted file mode 100644 index f9806945836e..000000000000 --- a/packages/babel-preset-stage-2/.npmignore +++ /dev/null @@ -1,3 +0,0 @@ -src -test -*.log diff --git a/packages/babel-preset-stage-2/README.md b/packages/babel-preset-stage-2/README.md deleted file mode 100644 index 920801e0004a..000000000000 --- a/packages/babel-preset-stage-2/README.md +++ /dev/null @@ -1,54 +0,0 @@ -# @babel/preset-stage-2 - -As of v7.0.0-beta.55, we've removed Babel's Stage presets. Please consider reading our [blog post](https://babeljs.io/blog/2018/07/27/removing-babels-stage-presets) on this decision for more details. TL;DR is that it's more beneficial in the long run to explicitly add which proposals to use. - ---- - -For a more automatic migration, we have updated [babel-upgrade](https://github.com/babel/babel-upgrade) to do this for you (you can run `npx babel-upgrade`). - -If you want the same configuration as before: - -```jsonc -{ - "plugins": [ - // Stage 2 - ["@babel/plugin-proposal-decorators", { "legacy": true }], - "@babel/plugin-proposal-function-sent", - "@babel/plugin-proposal-export-namespace-from", - "@babel/plugin-proposal-numeric-separator", - "@babel/plugin-proposal-throw-expressions", - - // Stage 3 - "@babel/plugin-syntax-dynamic-import", - "@babel/plugin-syntax-import-meta", - ["@babel/plugin-proposal-class-properties", { "loose": true }], - "@babel/plugin-proposal-json-strings" - ] -} -``` - -If you're using the same configuration across many separate projects, -keep in mind that you can also create your own custom presets with -whichever plugins and presets you're looking to use. - -```js -module.exports = function() { - return { - plugins: [ - require("@babel/plugin-syntax-dynamic-import"), - [require("@babel/plugin-proposal-decorators"), { "legacy": true }], - [require("@babel/plugin-proposal-class-properties"), { "loose": false }], - ], - presets: [ - // ... - ], - }; -}; -``` - -**NOTE: Compatibility between `@babel/plugin-proposal-class-properties` and `@babel/plugin-proposal-decorators`** -If you are including your plugins manually and using `@babel/plugin-proposal-class-properties`, make sure that `@babel/plugin-proposal-decorators` comes before `@babel/plugin-proposal-class-properties`. - -When using the `legacy: true` option of `@babel/plugin-proposal-decorators`, `@babel/plugin-proposal-class-properties` must be used in `loose: true` mode. - -If you are not using `@babel/plugin-proposal-decorators`, `loose` mode is not needed. \ No newline at end of file diff --git a/packages/babel-preset-stage-2/package.json b/packages/babel-preset-stage-2/package.json deleted file mode 100644 index af2594050681..000000000000 --- a/packages/babel-preset-stage-2/package.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "name": "@babel/preset-stage-2", - "version": "7.0.0", - "description": "Babel preset for stage 2 plugins", - "author": "Sebastian McKenzie ", - "homepage": "https://babeljs.io/", - "license": "MIT", - "publishConfig": { - "access": "public" - }, - "repository": "https://github.com/babel/babel/tree/master/packages/babel-preset-stage-2", - "main": "lib/index.js" -} diff --git a/packages/babel-preset-stage-2/src/index.js b/packages/babel-preset-stage-2/src/index.js deleted file mode 100644 index 4d3a38d42559..000000000000 --- a/packages/babel-preset-stage-2/src/index.js +++ /dev/null @@ -1,49 +0,0 @@ -export default function() { - throw new Error(` -As of v7.0.0-beta.55, we've removed Babel's Stage presets. -Please consider reading our blog post on this decision at -https://babeljs.io/blog/2018/07/27/removing-babels-stage-presets -for more details. TL;DR is that it's more beneficial in the - long run to explicitly add which proposals to use. - -For a more automatic migration, we have updated babel-upgrade, -https://github.com/babel/babel-upgrade to do this for you with -"npx babel-upgrade". - -If you want the same configuration as before: - -{ - "plugins": [ - // Stage 2 - ["@babel/plugin-proposal-decorators", { "legacy": true }], - "@babel/plugin-proposal-function-sent", - "@babel/plugin-proposal-export-namespace-from", - "@babel/plugin-proposal-numeric-separator", - "@babel/plugin-proposal-throw-expressions", - - // Stage 3 - "@babel/plugin-syntax-dynamic-import", - "@babel/plugin-syntax-import-meta", - ["@babel/plugin-proposal-class-properties", { "loose": false }], - "@babel/plugin-proposal-json-strings" - ] -} - -If you're using the same configuration across many separate projects, -keep in mind that you can also create your own custom presets with -whichever plugins and presets you're looking to use. - -module.exports = function() { - return { - plugins: [ - require("@babel/plugin-syntax-dynamic-import"), - [require("@babel/plugin-proposal-decorators"), { "legacy": true }], - [require("@babel/plugin-proposal-class-properties"), { "loose": false }], - ], - presets: [ - // ... - ], - }; -}; -`); -} diff --git a/packages/babel-preset-stage-3/.npmignore b/packages/babel-preset-stage-3/.npmignore deleted file mode 100644 index f9806945836e..000000000000 --- a/packages/babel-preset-stage-3/.npmignore +++ /dev/null @@ -1,3 +0,0 @@ -src -test -*.log diff --git a/packages/babel-preset-stage-3/README.md b/packages/babel-preset-stage-3/README.md deleted file mode 100644 index 33ec721e3045..000000000000 --- a/packages/babel-preset-stage-3/README.md +++ /dev/null @@ -1,46 +0,0 @@ -# @babel/preset-stage-3 - -As of v7.0.0-beta.55, we've removed Babel's Stage presets. Please consider reading our [blog post](https://babeljs.io/blog/2018/07/27/removing-babels-stage-presets) on this decision for more details. TL;DR is that it's more beneficial in the long run to explicitly add which proposals to use. - ---- - -For a more automatic migration, we have updated [babel-upgrade](https://github.com/babel/babel-upgrade) to do this for you (you can run `npx babel-upgrade`). - -If you want the same configuration as before: - -```json -{ - "plugins": [ - "@babel/plugin-syntax-dynamic-import", - "@babel/plugin-syntax-import-meta", - ["@babel/plugin-proposal-class-properties", { "loose": false }], - "@babel/plugin-proposal-json-strings" - ] -} -``` - -If you're using the same configuration across many separate projects, -keep in mind that you can also create your own custom presets with -whichever plugins and presets you're looking to use. - -```js -module.exports = function() { - return { - plugins: [ - require("@babel/plugin-syntax-dynamic-import"), - [require("@babel/plugin-proposal-decorators"), { "legacy": true }], - [require("@babel/plugin-proposal-class-properties"), { "loose": true }], - ], - presets: [ - // ... - ], - }; -}; -``` - -**NOTE: Compatibility between `@babel/plugin-proposal-class-properties` and `@babel/plugin-proposal-decorators`** -If you are including your plugins manually and using `@babel/plugin-proposal-class-properties`, make sure that `@babel/plugin-proposal-decorators` comes before `@babel/plugin-proposal-class-properties`. - -When using the `legacy: true` option of `@babel/plugin-proposal-decorators`, `@babel/plugin-proposal-class-properties` must be used in `loose: true` mode. - -If you are not using `@babel/plugin-proposal-decorators`, `loose` mode is not needed. \ No newline at end of file diff --git a/packages/babel-preset-stage-3/package.json b/packages/babel-preset-stage-3/package.json deleted file mode 100644 index 2bb6507112e9..000000000000 --- a/packages/babel-preset-stage-3/package.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "name": "@babel/preset-stage-3", - "version": "7.0.0", - "description": "Babel preset for stage 3 plugins", - "author": "Sebastian McKenzie ", - "homepage": "https://babeljs.io/", - "license": "MIT", - "publishConfig": { - "access": "public" - }, - "repository": "https://github.com/babel/babel/tree/master/packages/babel-preset-stage-3", - "main": "lib/index.js" -} diff --git a/packages/babel-preset-stage-3/src/index.js b/packages/babel-preset-stage-3/src/index.js deleted file mode 100644 index 5e7c9b841038..000000000000 --- a/packages/babel-preset-stage-3/src/index.js +++ /dev/null @@ -1,42 +0,0 @@ -export default function() { - throw new Error(` -As of v7.0.0-beta.55, we've removed Babel's Stage presets. -Please consider reading our blog post on this decision at -https://babeljs.io/blog/2018/07/27/removing-babels-stage-presets -for more details. TL;DR is that it's more beneficial in the - long run to explicitly add which proposals to use. - -For a more automatic migration, we have updated babel-upgrade, -https://github.com/babel/babel-upgrade to do this for you with -"npx babel-upgrade". - -If you want the same configuration as before: - -{ - "plugins": [ - "@babel/plugin-syntax-dynamic-import", - "@babel/plugin-syntax-import-meta", - ["@babel/plugin-proposal-class-properties", { "loose": false }], - "@babel/plugin-proposal-json-strings" - ] -} - - -If you're using the same configuration across many separate projects, -keep in mind that you can also create your own custom presets with -whichever plugins and presets you're looking to use. - -module.exports = function() { - return { - plugins: [ - require("@babel/plugin-syntax-dynamic-import"), - [require("@babel/plugin-proposal-decorators"), { "legacy": true }], - [require("@babel/plugin-proposal-class-properties"), { "loose": false }], - ], - presets: [ - // ... - ], - }; -}; -`); -} diff --git a/packages/babel-preset-typescript/.npmignore b/packages/babel-preset-typescript/.npmignore new file mode 100644 index 000000000000..2b1fceba679b --- /dev/null +++ b/packages/babel-preset-typescript/.npmignore @@ -0,0 +1,3 @@ +*.log +src +test diff --git a/packages/babel-preset-typescript/package.json b/packages/babel-preset-typescript/package.json index b4db8bc25602..2c9f38e2ed93 100644 --- a/packages/babel-preset-typescript/package.json +++ b/packages/babel-preset-typescript/package.json @@ -1,6 +1,6 @@ { "name": "@babel/preset-typescript", - "version": "7.3.3", + "version": "7.9.0", "description": "Babel preset for TypeScript.", "repository": "https://github.com/babel/babel/tree/master/packages/babel-preset-typescript", "license": "MIT", @@ -13,14 +13,14 @@ "typescript" ], "dependencies": { - "@babel/helper-plugin-utils": "^7.0.0", - "@babel/plugin-transform-typescript": "^7.3.2" + "@babel/helper-plugin-utils": "^7.8.3", + "@babel/plugin-transform-typescript": "^7.9.0" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.3.3", - "@babel/helper-plugin-test-runner": "^7.0.0" + "@babel/core": "^7.9.0", + "@babel/helper-plugin-test-runner": "^7.8.3" } } diff --git a/packages/babel-preset-typescript/src/index.js b/packages/babel-preset-typescript/src/index.js index ebbb2390fde1..74f885371395 100644 --- a/packages/babel-preset-typescript/src/index.js +++ b/packages/babel-preset-typescript/src/index.js @@ -2,12 +2,23 @@ import { declare } from "@babel/helper-plugin-utils"; import transformTypeScript from "@babel/plugin-transform-typescript"; export default declare( - (api, { jsxPragma, allExtensions = false, isTSX = false }) => { + ( + api, + { + allExtensions = false, + allowDeclareFields, + allowNamespaces, + jsxPragma, + isTSX = false, + onlyRemoveTypeImports, + }, + ) => { api.assertVersion(7); if (typeof allExtensions !== "boolean") { throw new Error(".allExtensions must be a boolean, or undefined"); } + if (typeof isTSX !== "boolean") { throw new Error(".isTSX must be a boolean, or undefined"); } @@ -16,11 +27,19 @@ export default declare( throw new Error("isTSX:true requires allExtensions:true"); } + const pluginOptions = isTSX => ({ + allowDeclareFields, + allowNamespaces, + isTSX, + jsxPragma, + onlyRemoveTypeImports, + }); + return { overrides: allExtensions ? [ { - plugins: [[transformTypeScript, { jsxPragma, isTSX }]], + plugins: [[transformTypeScript, pluginOptions(isTSX)]], }, ] : [ @@ -28,13 +47,13 @@ export default declare( // Only set 'test' if explicitly requested, since it requires that // Babel is being called` test: /\.ts$/, - plugins: [[transformTypeScript, { jsxPragma }]], + plugins: [[transformTypeScript, pluginOptions(false)]], }, { // Only set 'test' if explicitly requested, since it requires that // Babel is being called` test: /\.tsx$/, - plugins: [[transformTypeScript, { jsxPragma, isTSX: true }]], + plugins: [[transformTypeScript, pluginOptions(true)]], }, ], }; diff --git a/packages/babel-preset-typescript/test/fixtures/jsx-compat/js-valid/output.js b/packages/babel-preset-typescript/test/fixtures/jsx-compat/js-valid/output.js index 3cd05d5f9f2f..6ad0513bb203 100644 --- a/packages/babel-preset-typescript/test/fixtures/jsx-compat/js-valid/output.js +++ b/packages/babel-preset-typescript/test/fixtures/jsx-compat/js-valid/output.js @@ -1 +1,2 @@ +/*#__PURE__*/ React.createElement("div", null); diff --git a/packages/babel-preset-typescript/test/fixtures/jsx-compat/ts-invalid/options.json b/packages/babel-preset-typescript/test/fixtures/jsx-compat/ts-invalid/options.json index 4c0aa124656f..c11cb6fdfbdf 100644 --- a/packages/babel-preset-typescript/test/fixtures/jsx-compat/ts-invalid/options.json +++ b/packages/babel-preset-typescript/test/fixtures/jsx-compat/ts-invalid/options.json @@ -1,3 +1,3 @@ { - "throws": "Unexpected token, expected \"/<=/>=\" (1:6)" + "throws": "Unexpected token, expected \",\" (1:6)" } diff --git a/packages/babel-preset-typescript/test/fixtures/jsx-compat/tsx-valid/output.js b/packages/babel-preset-typescript/test/fixtures/jsx-compat/tsx-valid/output.js index 3cd05d5f9f2f..6ad0513bb203 100644 --- a/packages/babel-preset-typescript/test/fixtures/jsx-compat/tsx-valid/output.js +++ b/packages/babel-preset-typescript/test/fixtures/jsx-compat/tsx-valid/output.js @@ -1 +1,2 @@ +/*#__PURE__*/ React.createElement("div", null); diff --git a/packages/babel-register/package.json b/packages/babel-register/package.json index 28923cfdd186..fb4161315eee 100644 --- a/packages/babel-register/package.json +++ b/packages/babel-register/package.json @@ -1,6 +1,6 @@ { "name": "@babel/register", - "version": "7.5.5", + "version": "7.9.0", "description": "babel require hook", "license": "MIT", "publishConfig": { @@ -13,18 +13,19 @@ "./lib/node.js": "./lib/browser.js" }, "dependencies": { - "core-js": "^3.0.0", "find-cache-dir": "^2.0.0", "lodash": "^4.17.13", - "mkdirp": "^0.5.1", + "make-dir": "^2.1.0", "pirates": "^4.0.0", - "source-map-support": "^0.5.9" + "source-map-support": "^0.5.16" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.5.5", + "@babel/core": "^7.9.0", + "@babel/plugin-transform-modules-commonjs": "^7.9.0", + "browserify": "16.5.0", "default-require-extensions": "^2.0.0" } } diff --git a/packages/babel-register/src/cache.js b/packages/babel-register/src/cache.js index 439c92c30851..39eb9b78284b 100644 --- a/packages/babel-register/src/cache.js +++ b/packages/babel-register/src/cache.js @@ -1,7 +1,7 @@ import path from "path"; import fs from "fs"; import os from "os"; -import { sync as mkdirpSync } from "mkdirp"; +import { sync as makeDirSync } from "make-dir"; import * as babel from "@babel/core"; import findCacheDir from "find-cache-dir"; @@ -14,11 +14,17 @@ const DEFAULT_FILENAME = path.join( const FILENAME: string = process.env.BABEL_CACHE_PATH || DEFAULT_FILENAME; let data: Object = {}; +let cacheDisabled = false; + +function isCacheDisabled() { + return process.env.BABEL_DISABLE_CACHE ?? cacheDisabled; +} /** * Write stringified cache to disk. */ export function save() { + if (isCacheDisabled()) return; let serialised: string = "{}"; try { @@ -32,8 +38,33 @@ export function save() { } } - mkdirpSync(path.dirname(FILENAME)); - fs.writeFileSync(FILENAME, serialised); + try { + makeDirSync(path.dirname(FILENAME)); + fs.writeFileSync(FILENAME, serialised); + } catch (e) { + switch (e.code) { + // workaround https://github.com/nodejs/node/issues/31481 + // todo: remove the ENOENT error check when we drop node.js 13 support + case "ENOENT": + case "EACCES": + case "EPERM": + console.warn( + `Babel could not write cache to file: ${FILENAME} +due to a permission issue. Cache is disabled.`, + ); + cacheDisabled = true; + break; + case "EROFS": + console.warn( + `Babel could not write cache to file: ${FILENAME} +because it resides in a readonly filesystem. Cache is disabled.`, + ); + cacheDisabled = true; + break; + default: + throw e; + } + } } /** @@ -41,18 +72,37 @@ export function save() { */ export function load() { - if (process.env.BABEL_DISABLE_CACHE) return; + if (isCacheDisabled()) { + data = {}; + return; + } process.on("exit", save); process.nextTick(save); - if (!fs.existsSync(FILENAME)) return; + let cacheContent; try { - data = JSON.parse(fs.readFileSync(FILENAME)); - } catch (err) { - return; + cacheContent = fs.readFileSync(FILENAME); + } catch (e) { + switch (e.code) { + // check EACCES only as fs.readFileSync will never throw EPERM on Windows + // https://github.com/libuv/libuv/blob/076df64dbbda4320f93375913a728efc40e12d37/src/win/fs.c#L735 + case "EACCES": + console.warn( + `Babel could not read cache file: ${FILENAME} +due to a permission issue. Cache is disabled.`, + ); + cacheDisabled = true; + /* fall through */ + default: + return; + } } + + try { + data = JSON.parse(cacheContent); + } catch {} } /** diff --git a/packages/babel-register/src/node.js b/packages/babel-register/src/node.js index 84dbe8b5cd1a..ed527cdac549 100644 --- a/packages/babel-register/src/node.js +++ b/packages/babel-register/src/node.js @@ -41,7 +41,7 @@ function compile(code, filename) { const opts = new OptionManager().init( // sourceRoot can be overwritten { - sourceRoot: path.dirname(filename), + sourceRoot: path.dirname(filename) + path.sep, ...deepClone(transformOpts), filename, }, diff --git a/packages/babel-core/test/browserify.js b/packages/babel-register/test/browserify.js similarity index 100% rename from packages/babel-core/test/browserify.js rename to packages/babel-register/test/browserify.js diff --git a/packages/babel-register/test/cache.js b/packages/babel-register/test/cache.js index c9704cbdd3ab..f4fb2de2e8ec 100644 --- a/packages/babel-register/test/cache.js +++ b/packages/babel-register/test/cache.js @@ -7,12 +7,12 @@ const oldBabelDisableCacheValue = process.env.BABEL_DISABLE_CACHE; process.env.BABEL_CACHE_PATH = testCacheFilename; delete process.env.BABEL_DISABLE_CACHE; -function writeCache(data) { +function writeCache(data, mode = 0o666) { if (typeof data === "object") { data = JSON.stringify(data); } - fs.writeFileSync(testCacheFilename, data); + fs.writeFileSync(testCacheFilename, data, { mode }); } function cleanCache() { @@ -73,5 +73,39 @@ describe("@babel/register - caching", () => { expect(fs.existsSync(testCacheFilename)).toBe(true); expect(get()).toEqual({}); }); + + it("should create the cache after load", cb => { + load(); + + process.nextTick(() => { + expect(fs.existsSync(testCacheFilename)).toBe(true); + expect(get()).toEqual({}); + cb(); + }); + }); + + // Only write mode is effective on Windows + if (process.platform !== "win32") { + it("should be disabled when CACHE_PATH is not allowed to read", () => { + writeCache({ foo: "bar" }, 0o266); + + load(); + + expect(get()).toEqual({}); + }); + } + + it("should be disabled when CACHE_PATH is not allowed to write", cb => { + writeCache({ foo: "bar" }, 0o466); + + load(); + + expect(get()).toEqual({ foo: "bar" }); + process.nextTick(() => { + load(); + expect(get()).toEqual({}); + cb(); + }); + }); }); }); diff --git a/packages/babel-register/test/__data__/.babelrc b/packages/babel-register/test/fixtures/babelrc/.babelrc similarity index 100% rename from packages/babel-register/test/__data__/.babelrc rename to packages/babel-register/test/fixtures/babelrc/.babelrc diff --git a/packages/babel-register/test/__data__/es2015.js b/packages/babel-register/test/fixtures/babelrc/es2015.js similarity index 100% rename from packages/babel-register/test/__data__/es2015.js rename to packages/babel-register/test/fixtures/babelrc/es2015.js diff --git a/packages/babel-core/test/fixtures/browserify/register.js b/packages/babel-register/test/fixtures/browserify/register.js similarity index 100% rename from packages/babel-core/test/fixtures/browserify/register.js rename to packages/babel-register/test/fixtures/browserify/register.js diff --git a/packages/babel-register/test/fixtures/source-map/foo/bar.js b/packages/babel-register/test/fixtures/source-map/foo/bar.js new file mode 100644 index 000000000000..86eb6d1316ee --- /dev/null +++ b/packages/babel-register/test/fixtures/source-map/foo/bar.js @@ -0,0 +1,3 @@ +function add(a, b) { + return a + b; +} diff --git a/packages/babel-register/test/fixtures/source-map/index.js b/packages/babel-register/test/fixtures/source-map/index.js new file mode 100644 index 000000000000..7da2f9e4511d --- /dev/null +++ b/packages/babel-register/test/fixtures/source-map/index.js @@ -0,0 +1,7 @@ +const { retrieveSourceMap } = require('source-map-support'); + +const path = require.resolve('./foo/bar'); + +require('./foo/bar'); + +console.log(JSON.stringify(retrieveSourceMap(path))); diff --git a/packages/babel-register/test/index.js b/packages/babel-register/test/index.js index 1f54094e9d9a..eb1b93dad513 100644 --- a/packages/babel-register/test/index.js +++ b/packages/babel-register/test/index.js @@ -1,13 +1,18 @@ import fs from "fs"; import path from "path"; +import child from "child_process"; let currentHook; let currentOptions; let sourceMapSupport = false; const registerFile = require.resolve("../lib/node"); -const testFile = require.resolve("./__data__/es2015"); +const testFile = require.resolve("./fixtures/babelrc/es2015"); const testFileContent = fs.readFileSync(testFile); +const sourceMapTestFile = require.resolve("./fixtures/source-map/index"); +const sourceMapNestedTestFile = require.resolve( + "./fixtures/source-map/foo/bar", +); jest.mock("pirates", () => { return { @@ -110,6 +115,45 @@ describe("@babel/register", function() { expect(sourceMapSupport).toBe(false); }); + it("returns concatenatable sourceRoot and sources", callback => { + // The Source Maps R3 standard https://sourcemaps.info/spec.html states + // that `sourceRoot` is “prepended to the individual entries in the + // ‘source’ field.” If `sources` contains file names, and `sourceRoot` + // is intended to refer to a directory but doesn’t end with a trailing + // slash, any consumers of the source map are in for a bad day. + // + // The underlying problem seems to only get triggered if one file + // requires() another with @babel/register active, and I couldn’t get + // that working inside a test, possibly because of jest’s mocking + // hooks, so we spawn a separate process. + + const args = ["-r", registerFile, sourceMapTestFile]; + const spawn = child.spawn(process.execPath, args, { cwd: __dirname }); + + let output = ""; + + for (const stream of [spawn.stderr, spawn.stdout]) { + stream.on("data", chunk => { + output += chunk; + }); + } + + spawn.on("close", function() { + let err; + + try { + const sourceMap = JSON.parse(output); + expect(sourceMap.map.sourceRoot + sourceMap.map.sources[0]).toBe( + sourceMapNestedTestFile, + ); + } catch (e) { + err = e; + } + + callback(err); + }); + }); + test("hook transpiles with config", () => { setupRegister({ babelrc: false, diff --git a/packages/babel-runtime-corejs2/helpers/esm/iterableToArray.js b/packages/babel-runtime-corejs2/helpers/esm/iterableToArray.js index 9f20ecdbd956..a42a3a260c11 100644 --- a/packages/babel-runtime-corejs2/helpers/esm/iterableToArray.js +++ b/packages/babel-runtime-corejs2/helpers/esm/iterableToArray.js @@ -1,5 +1,6 @@ import _Array$from from "../../core-js/array/from"; import _isIterable from "../../core-js/is-iterable"; +import _Symbol from "../../core-js/symbol"; export default function _iterableToArray(iter) { - if (_isIterable(Object(iter)) || Object.prototype.toString.call(iter) === "[object Arguments]") return _Array$from(iter); + if (typeof _Symbol !== "undefined" && _isIterable(Object(iter))) return _Array$from(iter); } \ No newline at end of file diff --git a/packages/babel-runtime-corejs2/helpers/esm/package.json b/packages/babel-runtime-corejs2/helpers/esm/package.json new file mode 100644 index 000000000000..aead43de364c --- /dev/null +++ b/packages/babel-runtime-corejs2/helpers/esm/package.json @@ -0,0 +1,3 @@ +{ + "type": "module" +} \ No newline at end of file diff --git a/packages/babel-runtime-corejs2/helpers/esm/temporalRef.js b/packages/babel-runtime-corejs2/helpers/esm/temporalRef.js index 4b0679c64cfc..6d167a30397b 100644 --- a/packages/babel-runtime-corejs2/helpers/esm/temporalRef.js +++ b/packages/babel-runtime-corejs2/helpers/esm/temporalRef.js @@ -1,8 +1,5 @@ import undef from "./temporalUndefined"; +import err from "./tdz"; export default function _temporalRef(val, name) { - if (val === undef) { - throw new ReferenceError(name + " is not defined - temporal dead zone"); - } else { - return val; - } + return val === undef ? err(name) : val; } \ No newline at end of file diff --git a/packages/babel-runtime-corejs2/helpers/esm/toArray.js b/packages/babel-runtime-corejs2/helpers/esm/toArray.js index 5acb22b388ad..7d4a65d192d6 100644 --- a/packages/babel-runtime-corejs2/helpers/esm/toArray.js +++ b/packages/babel-runtime-corejs2/helpers/esm/toArray.js @@ -1,6 +1,7 @@ import arrayWithHoles from "./arrayWithHoles"; import iterableToArray from "./iterableToArray"; +import unsupportedIterableToArray from "./unsupportedIterableToArray"; import nonIterableRest from "./nonIterableRest"; export default function _toArray(arr) { - return arrayWithHoles(arr) || iterableToArray(arr) || nonIterableRest(); + return arrayWithHoles(arr) || iterableToArray(arr) || unsupportedIterableToArray(arr) || nonIterableRest(); } \ No newline at end of file diff --git a/packages/babel-runtime-corejs2/helpers/iterableToArray.js b/packages/babel-runtime-corejs2/helpers/iterableToArray.js index c7834a312257..3a3579554e88 100644 --- a/packages/babel-runtime-corejs2/helpers/iterableToArray.js +++ b/packages/babel-runtime-corejs2/helpers/iterableToArray.js @@ -2,8 +2,10 @@ var _Array$from = require("../core-js/array/from"); var _isIterable = require("../core-js/is-iterable"); +var _Symbol = require("../core-js/symbol"); + function _iterableToArray(iter) { - if (_isIterable(Object(iter)) || Object.prototype.toString.call(iter) === "[object Arguments]") return _Array$from(iter); + if (typeof _Symbol !== "undefined" && _isIterable(Object(iter))) return _Array$from(iter); } module.exports = _iterableToArray; \ No newline at end of file diff --git a/packages/babel-runtime-corejs2/helpers/temporalRef.js b/packages/babel-runtime-corejs2/helpers/temporalRef.js index 20b2652a1f8c..8aa5e5e58dcb 100644 --- a/packages/babel-runtime-corejs2/helpers/temporalRef.js +++ b/packages/babel-runtime-corejs2/helpers/temporalRef.js @@ -1,11 +1,9 @@ var temporalUndefined = require("./temporalUndefined"); +var tdz = require("./tdz"); + function _temporalRef(val, name) { - if (val === temporalUndefined) { - throw new ReferenceError(name + " is not defined - temporal dead zone"); - } else { - return val; - } + return val === temporalUndefined ? tdz(name) : val; } module.exports = _temporalRef; \ No newline at end of file diff --git a/packages/babel-runtime-corejs2/helpers/toArray.js b/packages/babel-runtime-corejs2/helpers/toArray.js index c28fd9e46ef9..f113822988de 100644 --- a/packages/babel-runtime-corejs2/helpers/toArray.js +++ b/packages/babel-runtime-corejs2/helpers/toArray.js @@ -2,10 +2,12 @@ var arrayWithHoles = require("./arrayWithHoles"); var iterableToArray = require("./iterableToArray"); +var unsupportedIterableToArray = require("./unsupportedIterableToArray"); + var nonIterableRest = require("./nonIterableRest"); function _toArray(arr) { - return arrayWithHoles(arr) || iterableToArray(arr) || nonIterableRest(); + return arrayWithHoles(arr) || iterableToArray(arr) || unsupportedIterableToArray(arr) || nonIterableRest(); } module.exports = _toArray; \ No newline at end of file diff --git a/packages/babel-runtime-corejs2/package.json b/packages/babel-runtime-corejs2/package.json index 5ae56e822e16..5478a00cb762 100644 --- a/packages/babel-runtime-corejs2/package.json +++ b/packages/babel-runtime-corejs2/package.json @@ -1,6 +1,6 @@ { "name": "@babel/runtime-corejs2", - "version": "7.5.5", + "version": "7.9.2", "description": "babel's modular runtime helpers with core-js@2 polyfilling", "license": "MIT", "publishConfig": { @@ -10,9 +10,9 @@ "author": "Sebastian McKenzie ", "dependencies": { "core-js": "^2.6.5", - "regenerator-runtime": "^0.13.2" + "regenerator-runtime": "^0.13.4" }, "devDependencies": { - "@babel/helpers": "^7.5.5" + "@babel/helpers": "^7.9.2" } } diff --git a/packages/babel-runtime-corejs3/helpers/esm/package.json b/packages/babel-runtime-corejs3/helpers/esm/package.json new file mode 100644 index 000000000000..aead43de364c --- /dev/null +++ b/packages/babel-runtime-corejs3/helpers/esm/package.json @@ -0,0 +1,3 @@ +{ + "type": "module" +} \ No newline at end of file diff --git a/packages/babel-runtime-corejs3/package.json b/packages/babel-runtime-corejs3/package.json index 5a0f640973d6..90ec2d8a7577 100644 --- a/packages/babel-runtime-corejs3/package.json +++ b/packages/babel-runtime-corejs3/package.json @@ -1,6 +1,6 @@ { "name": "@babel/runtime-corejs3", - "version": "7.5.5", + "version": "7.9.2", "description": "babel's modular runtime helpers with core-js@3 polyfilling", "license": "MIT", "publishConfig": { @@ -10,6 +10,6 @@ "author": "Denis Pushkarev ", "dependencies": { "core-js-pure": "^3.0.0", - "regenerator-runtime": "^0.13.2" + "regenerator-runtime": "^0.13.4" } } diff --git a/packages/babel-runtime-corejs3/test/index.spec.js b/packages/babel-runtime-corejs3/test/index.spec.js index 5f58d25022aa..88af741b9b43 100644 --- a/packages/babel-runtime-corejs3/test/index.spec.js +++ b/packages/babel-runtime-corejs3/test/index.spec.js @@ -274,7 +274,7 @@ describe("babel-runtime", () => { it("matchAll, exists", () => { expect( - typeof require("../core-js/instance/match-all")("").call("qwe", /./).next, + typeof require("../core-js/instance/match-all")("").call("qwe", /./g).next, ).toEqual("function"); }); diff --git a/packages/babel-runtime/helpers/esm/iterableToArray.js b/packages/babel-runtime/helpers/esm/iterableToArray.js index 671e400d9166..6cd6ae353c37 100644 --- a/packages/babel-runtime/helpers/esm/iterableToArray.js +++ b/packages/babel-runtime/helpers/esm/iterableToArray.js @@ -1,3 +1,3 @@ export default function _iterableToArray(iter) { - if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); + if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); } \ No newline at end of file diff --git a/packages/babel-runtime/helpers/esm/package.json b/packages/babel-runtime/helpers/esm/package.json new file mode 100644 index 000000000000..aead43de364c --- /dev/null +++ b/packages/babel-runtime/helpers/esm/package.json @@ -0,0 +1,3 @@ +{ + "type": "module" +} \ No newline at end of file diff --git a/packages/babel-runtime/helpers/esm/temporalRef.js b/packages/babel-runtime/helpers/esm/temporalRef.js index 4b0679c64cfc..6d167a30397b 100644 --- a/packages/babel-runtime/helpers/esm/temporalRef.js +++ b/packages/babel-runtime/helpers/esm/temporalRef.js @@ -1,8 +1,5 @@ import undef from "./temporalUndefined"; +import err from "./tdz"; export default function _temporalRef(val, name) { - if (val === undef) { - throw new ReferenceError(name + " is not defined - temporal dead zone"); - } else { - return val; - } + return val === undef ? err(name) : val; } \ No newline at end of file diff --git a/packages/babel-runtime/helpers/esm/toArray.js b/packages/babel-runtime/helpers/esm/toArray.js index 5acb22b388ad..7d4a65d192d6 100644 --- a/packages/babel-runtime/helpers/esm/toArray.js +++ b/packages/babel-runtime/helpers/esm/toArray.js @@ -1,6 +1,7 @@ import arrayWithHoles from "./arrayWithHoles"; import iterableToArray from "./iterableToArray"; +import unsupportedIterableToArray from "./unsupportedIterableToArray"; import nonIterableRest from "./nonIterableRest"; export default function _toArray(arr) { - return arrayWithHoles(arr) || iterableToArray(arr) || nonIterableRest(); + return arrayWithHoles(arr) || iterableToArray(arr) || unsupportedIterableToArray(arr) || nonIterableRest(); } \ No newline at end of file diff --git a/packages/babel-runtime/helpers/iterableToArray.js b/packages/babel-runtime/helpers/iterableToArray.js index e917e57937bf..954244b9fee4 100644 --- a/packages/babel-runtime/helpers/iterableToArray.js +++ b/packages/babel-runtime/helpers/iterableToArray.js @@ -1,5 +1,5 @@ function _iterableToArray(iter) { - if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); + if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); } module.exports = _iterableToArray; \ No newline at end of file diff --git a/packages/babel-runtime/helpers/temporalRef.js b/packages/babel-runtime/helpers/temporalRef.js index 20b2652a1f8c..8aa5e5e58dcb 100644 --- a/packages/babel-runtime/helpers/temporalRef.js +++ b/packages/babel-runtime/helpers/temporalRef.js @@ -1,11 +1,9 @@ var temporalUndefined = require("./temporalUndefined"); +var tdz = require("./tdz"); + function _temporalRef(val, name) { - if (val === temporalUndefined) { - throw new ReferenceError(name + " is not defined - temporal dead zone"); - } else { - return val; - } + return val === temporalUndefined ? tdz(name) : val; } module.exports = _temporalRef; \ No newline at end of file diff --git a/packages/babel-runtime/helpers/toArray.js b/packages/babel-runtime/helpers/toArray.js index c28fd9e46ef9..f113822988de 100644 --- a/packages/babel-runtime/helpers/toArray.js +++ b/packages/babel-runtime/helpers/toArray.js @@ -2,10 +2,12 @@ var arrayWithHoles = require("./arrayWithHoles"); var iterableToArray = require("./iterableToArray"); +var unsupportedIterableToArray = require("./unsupportedIterableToArray"); + var nonIterableRest = require("./nonIterableRest"); function _toArray(arr) { - return arrayWithHoles(arr) || iterableToArray(arr) || nonIterableRest(); + return arrayWithHoles(arr) || iterableToArray(arr) || unsupportedIterableToArray(arr) || nonIterableRest(); } module.exports = _toArray; \ No newline at end of file diff --git a/packages/babel-runtime/package.json b/packages/babel-runtime/package.json index bb097bddded6..69bf779734ce 100644 --- a/packages/babel-runtime/package.json +++ b/packages/babel-runtime/package.json @@ -1,17 +1,22 @@ { "name": "@babel/runtime", - "version": "7.5.5", + "version": "7.9.2", "description": "babel's modular runtime helpers", "license": "MIT", "publishConfig": { "access": "public" }, - "repository": "https://github.com/babel/babel/tree/master/packages/babel-runtime", + "repository": { + "type": "git", + "url": "https://github.com/babel/babel.git", + "directory": "packages/babel-runtime" + }, + "homepage": "https://babeljs.io/docs/en/next/babel-runtime", "author": "Sebastian McKenzie ", "dependencies": { - "regenerator-runtime": "^0.13.2" + "regenerator-runtime": "^0.13.4" }, "devDependencies": { - "@babel/helpers": "^7.5.5" + "@babel/helpers": "^7.9.2" } } diff --git a/packages/babel-standalone/package.json b/packages/babel-standalone/package.json index 7d94b31d7a1c..d03314a134e4 100644 --- a/packages/babel-standalone/package.json +++ b/packages/babel-standalone/package.json @@ -1,103 +1,109 @@ { "name": "@babel/standalone", - "version": "7.5.5", + "version": "7.9.5", "description": "Standalone build of Babel for use in non-Node.js environments.", "main": "babel.js", "files": [ "babel.js", - "babel.min.js", - "src" + "babel.min.js" ], + "scripts": { + "prepublishOnly": "cd ../.. && make prepublish-build-standalone" + }, "devDependencies": { - "@babel/core": "^7.5.5", - "@babel/helper-plugin-utils": "^7.0.0", - "@babel/plugin-external-helpers": "^7.2.0", - "@babel/plugin-proposal-async-generator-functions": "^7.2.0", - "@babel/plugin-proposal-class-properties": "^7.5.5", - "@babel/plugin-proposal-decorators": "^7.4.4", - "@babel/plugin-proposal-do-expressions": "^7.5.0", - "@babel/plugin-proposal-export-default-from": "^7.5.2", - "@babel/plugin-proposal-export-namespace-from": "^7.5.2", - "@babel/plugin-proposal-function-bind": "^7.2.0", - "@babel/plugin-proposal-function-sent": "^7.5.0", - "@babel/plugin-proposal-json-strings": "^7.2.0", - "@babel/plugin-proposal-logical-assignment-operators": "^7.2.0", - "@babel/plugin-proposal-nullish-coalescing-operator": "^7.4.4", - "@babel/plugin-proposal-numeric-separator": "^7.2.0", - "@babel/plugin-proposal-object-rest-spread": "^7.5.5", - "@babel/plugin-proposal-optional-catch-binding": "^7.2.0", - "@babel/plugin-proposal-optional-chaining": "^7.2.0", - "@babel/plugin-proposal-pipeline-operator": "^7.5.0", - "@babel/plugin-proposal-private-methods": "^7.4.4", - "@babel/plugin-proposal-throw-expressions": "^7.2.0", - "@babel/plugin-proposal-unicode-property-regex": "^7.4.4", - "@babel/plugin-syntax-async-generators": "^7.2.0", - "@babel/plugin-syntax-class-properties": "^7.2.0", - "@babel/plugin-syntax-decorators": "^7.2.0", - "@babel/plugin-syntax-do-expressions": "^7.2.0", - "@babel/plugin-syntax-dynamic-import": "^7.2.0", - "@babel/plugin-syntax-export-default-from": "^7.2.0", - "@babel/plugin-syntax-export-namespace-from": "^7.2.0", - "@babel/plugin-syntax-flow": "^7.2.0", - "@babel/plugin-syntax-function-bind": "^7.2.0", - "@babel/plugin-syntax-function-sent": "^7.2.0", - "@babel/plugin-syntax-import-meta": "^7.2.0", - "@babel/plugin-syntax-jsx": "^7.2.0", - "@babel/plugin-syntax-object-rest-spread": "^7.2.0", - "@babel/plugin-syntax-optional-catch-binding": "^7.2.0", - "@babel/plugin-syntax-pipeline-operator": "^7.5.0", - "@babel/plugin-syntax-typescript": "^7.3.3", - "@babel/plugin-transform-arrow-functions": "^7.2.0", - "@babel/plugin-transform-async-to-generator": "^7.5.0", - "@babel/plugin-transform-block-scoped-functions": "^7.2.0", - "@babel/plugin-transform-block-scoping": "^7.5.5", - "@babel/plugin-transform-classes": "^7.5.5", - "@babel/plugin-transform-computed-properties": "^7.2.0", - "@babel/plugin-transform-destructuring": "^7.5.0", - "@babel/plugin-transform-dotall-regex": "^7.4.4", - "@babel/plugin-transform-duplicate-keys": "^7.5.0", - "@babel/plugin-transform-exponentiation-operator": "^7.2.0", - "@babel/plugin-transform-flow-comments": "^7.5.5", - "@babel/plugin-transform-flow-strip-types": "^7.4.4", - "@babel/plugin-transform-for-of": "^7.4.4", - "@babel/plugin-transform-function-name": "^7.4.4", - "@babel/plugin-transform-instanceof": "^7.5.5", - "@babel/plugin-transform-jscript": "^7.2.0", - "@babel/plugin-transform-literals": "^7.2.0", - "@babel/plugin-transform-member-expression-literals": "^7.2.0", - "@babel/plugin-transform-modules-amd": "^7.5.0", - "@babel/plugin-transform-modules-commonjs": "^7.5.0", - "@babel/plugin-transform-modules-systemjs": "^7.5.0", - "@babel/plugin-transform-modules-umd": "^7.2.0", - "@babel/plugin-transform-new-target": "^7.4.4", - "@babel/plugin-transform-object-assign": "^7.2.0", - "@babel/plugin-transform-object-set-prototype-of-to-assign": "^7.2.0", - "@babel/plugin-transform-object-super": "^7.5.5", - "@babel/plugin-transform-parameters": "^7.4.4", - "@babel/plugin-transform-property-literals": "^7.2.0", - "@babel/plugin-transform-property-mutators": "^7.2.0", - "@babel/plugin-transform-proto-to-assign": "^7.5.5", - "@babel/plugin-transform-react-constant-elements": "^7.5.0", - "@babel/plugin-transform-react-display-name": "^7.2.0", - "@babel/plugin-transform-react-inline-elements": "^7.2.0", - "@babel/plugin-transform-react-jsx": "^7.3.0", - "@babel/plugin-transform-react-jsx-compat": "^7.2.0", - "@babel/plugin-transform-react-jsx-self": "^7.2.0", - "@babel/plugin-transform-react-jsx-source": "^7.5.0", - "@babel/plugin-transform-regenerator": "^7.4.5", - "@babel/plugin-transform-reserved-words": "^7.2.0", - "@babel/plugin-transform-runtime": "^7.5.5", - "@babel/plugin-transform-shorthand-properties": "^7.2.0", - "@babel/plugin-transform-spread": "^7.2.2", - "@babel/plugin-transform-sticky-regex": "^7.2.0", - "@babel/plugin-transform-strict-mode": "^7.2.0", - "@babel/plugin-transform-template-literals": "^7.4.4", - "@babel/plugin-transform-typeof-symbol": "^7.2.0", - "@babel/plugin-transform-typescript": "^7.5.5", - "@babel/plugin-transform-unicode-regex": "^7.4.4", - "@babel/preset-flow": "^7.0.0", - "@babel/preset-react": "^7.0.0", - "@babel/preset-typescript": "^7.3.3" + "@babel/core": "^7.9.0", + "@babel/helper-plugin-utils": "^7.8.3", + "@babel/plugin-external-helpers": "^7.8.3", + "@babel/plugin-proposal-async-generator-functions": "^7.8.3", + "@babel/plugin-proposal-class-properties": "^7.8.3", + "@babel/plugin-proposal-decorators": "^7.8.3", + "@babel/plugin-proposal-do-expressions": "^7.8.3", + "@babel/plugin-proposal-dynamic-import": "^7.8.3", + "@babel/plugin-proposal-export-default-from": "^7.8.3", + "@babel/plugin-proposal-export-namespace-from": "^7.8.3", + "@babel/plugin-proposal-function-bind": "^7.8.3", + "@babel/plugin-proposal-function-sent": "^7.8.3", + "@babel/plugin-proposal-json-strings": "^7.8.3", + "@babel/plugin-proposal-logical-assignment-operators": "^7.8.3", + "@babel/plugin-proposal-nullish-coalescing-operator": "^7.8.3", + "@babel/plugin-proposal-numeric-separator": "^7.8.3", + "@babel/plugin-proposal-object-rest-spread": "^7.9.5", + "@babel/plugin-proposal-optional-catch-binding": "^7.8.3", + "@babel/plugin-proposal-optional-chaining": "^7.9.0", + "@babel/plugin-proposal-pipeline-operator": "^7.8.3", + "@babel/plugin-proposal-private-methods": "^7.8.3", + "@babel/plugin-proposal-throw-expressions": "^7.8.3", + "@babel/plugin-proposal-unicode-property-regex": "^7.8.8", + "@babel/plugin-syntax-async-generators": "^7.8.0", + "@babel/plugin-syntax-class-properties": "^7.8.3", + "@babel/plugin-syntax-decorators": "^7.8.3", + "@babel/plugin-syntax-do-expressions": "^7.8.3", + "@babel/plugin-syntax-export-default-from": "^7.8.3", + "@babel/plugin-syntax-flow": "^7.8.3", + "@babel/plugin-syntax-function-bind": "^7.8.3", + "@babel/plugin-syntax-function-sent": "^7.8.3", + "@babel/plugin-syntax-import-meta": "^7.8.3", + "@babel/plugin-syntax-jsx": "^7.8.3", + "@babel/plugin-syntax-object-rest-spread": "^7.8.0", + "@babel/plugin-syntax-optional-catch-binding": "^7.8.0", + "@babel/plugin-syntax-pipeline-operator": "^7.8.3", + "@babel/plugin-syntax-record-and-tuple": "^7.9.0", + "@babel/plugin-syntax-top-level-await": "^7.8.3", + "@babel/plugin-syntax-typescript": "^7.8.3", + "@babel/plugin-transform-arrow-functions": "^7.8.3", + "@babel/plugin-transform-async-to-generator": "^7.8.3", + "@babel/plugin-transform-block-scoped-functions": "^7.8.3", + "@babel/plugin-transform-block-scoping": "^7.8.3", + "@babel/plugin-transform-classes": "^7.9.5", + "@babel/plugin-transform-computed-properties": "^7.8.3", + "@babel/plugin-transform-destructuring": "^7.9.5", + "@babel/plugin-transform-dotall-regex": "^7.8.3", + "@babel/plugin-transform-duplicate-keys": "^7.8.3", + "@babel/plugin-transform-exponentiation-operator": "^7.8.3", + "@babel/plugin-transform-flow-comments": "^7.8.3", + "@babel/plugin-transform-flow-strip-types": "^7.9.0", + "@babel/plugin-transform-for-of": "^7.9.0", + "@babel/plugin-transform-function-name": "^7.8.3", + "@babel/plugin-transform-instanceof": "^7.8.3", + "@babel/plugin-transform-jscript": "^7.8.3", + "@babel/plugin-transform-literals": "^7.8.3", + "@babel/plugin-transform-member-expression-literals": "^7.8.3", + "@babel/plugin-transform-modules-amd": "^7.9.0", + "@babel/plugin-transform-modules-commonjs": "^7.9.0", + "@babel/plugin-transform-modules-systemjs": "^7.9.0", + "@babel/plugin-transform-modules-umd": "^7.9.0", + "@babel/plugin-transform-named-capturing-groups-regex": "^7.8.3", + "@babel/plugin-transform-new-target": "^7.8.3", + "@babel/plugin-transform-object-assign": "^7.8.3", + "@babel/plugin-transform-object-set-prototype-of-to-assign": "^7.8.3", + "@babel/plugin-transform-object-super": "^7.8.3", + "@babel/plugin-transform-parameters": "^7.9.5", + "@babel/plugin-transform-property-literals": "^7.8.3", + "@babel/plugin-transform-property-mutators": "^7.8.3", + "@babel/plugin-transform-proto-to-assign": "^7.8.3", + "@babel/plugin-transform-react-constant-elements": "^7.9.0", + "@babel/plugin-transform-react-display-name": "^7.8.3", + "@babel/plugin-transform-react-inline-elements": "^7.9.0", + "@babel/plugin-transform-react-jsx": "^7.9.4", + "@babel/plugin-transform-react-jsx-compat": "^7.8.3", + "@babel/plugin-transform-react-jsx-development": "^7.9.0", + "@babel/plugin-transform-react-jsx-self": "^7.9.0", + "@babel/plugin-transform-react-jsx-source": "^7.9.0", + "@babel/plugin-transform-regenerator": "^7.8.7", + "@babel/plugin-transform-reserved-words": "^7.8.3", + "@babel/plugin-transform-runtime": "^7.9.0", + "@babel/plugin-transform-shorthand-properties": "^7.8.3", + "@babel/plugin-transform-spread": "^7.8.3", + "@babel/plugin-transform-sticky-regex": "^7.8.3", + "@babel/plugin-transform-strict-mode": "^7.8.3", + "@babel/plugin-transform-template-literals": "^7.8.3", + "@babel/plugin-transform-typeof-symbol": "^7.8.4", + "@babel/plugin-transform-typescript": "^7.9.4", + "@babel/plugin-transform-unicode-regex": "^7.8.3", + "@babel/preset-env": "^7.9.5", + "@babel/preset-flow": "^7.9.0", + "@babel/preset-react": "^7.9.4", + "@babel/preset-typescript": "^7.9.0" }, "keywords": [ "babel", diff --git a/packages/babel-standalone/scripts/pluginConfig.json b/packages/babel-standalone/scripts/pluginConfig.json index 338d1d1f1bc9..856d0869b5e5 100644 --- a/packages/babel-standalone/scripts/pluginConfig.json +++ b/packages/babel-standalone/scripts/pluginConfig.json @@ -4,9 +4,7 @@ "syntax-class-properties", "syntax-decorators", "syntax-do-expressions", - "syntax-dynamic-import", "syntax-export-default-from", - "syntax-export-namespace-from", "syntax-flow", "syntax-function-bind", "syntax-function-sent", @@ -15,11 +13,14 @@ "syntax-object-rest-spread", "syntax-optional-catch-binding", "syntax-pipeline-operator", + "syntax-record-and-tuple", + "syntax-top-level-await", "syntax-typescript", "proposal-async-generator-functions", "proposal-class-properties", "proposal-decorators", "proposal-do-expressions", + "proposal-dynamic-import", "proposal-export-default-from", "proposal-export-namespace-from", "proposal-function-bind", @@ -57,6 +58,7 @@ "transform-modules-commonjs", "transform-modules-systemjs", "transform-modules-umd", + "transform-named-capturing-groups-regex", "transform-new-target", "transform-object-assign", "transform-object-super", @@ -70,6 +72,7 @@ "transform-react-inline-elements", "transform-react-jsx", "transform-react-jsx-compat", + "transform-react-jsx-development", "transform-react-jsx-self", "transform-react-jsx-source", "transform-regenerator", diff --git a/packages/babel-standalone/scripts/prepublish.js b/packages/babel-standalone/scripts/prepublish.js deleted file mode 100644 index daadffb117ef..000000000000 --- a/packages/babel-standalone/scripts/prepublish.js +++ /dev/null @@ -1,7 +0,0 @@ -// This file is executed by lerna before publishing @babel/standalone, -// so that it has the new version and not the old one. - -require("child_process").execSync("make prepublish-build-standalone", { - cwd: require("path").resolve(__dirname, "../../.."), - stdio: "inherit", -}); diff --git a/packages/babel-standalone/src/generated/plugins.js b/packages/babel-standalone/src/generated/plugins.js index 3967a839565c..0b55279003db 100644 --- a/packages/babel-standalone/src/generated/plugins.js +++ b/packages/babel-standalone/src/generated/plugins.js @@ -8,9 +8,7 @@ import syntaxAsyncGenerators from "@babel/plugin-syntax-async-generators"; import syntaxClassProperties from "@babel/plugin-syntax-class-properties"; import syntaxDecorators from "@babel/plugin-syntax-decorators"; import syntaxDoExpressions from "@babel/plugin-syntax-do-expressions"; -import syntaxDynamicImport from "@babel/plugin-syntax-dynamic-import"; import syntaxExportDefaultFrom from "@babel/plugin-syntax-export-default-from"; -import syntaxExportNamespaceFrom from "@babel/plugin-syntax-export-namespace-from"; import syntaxFlow from "@babel/plugin-syntax-flow"; import syntaxFunctionBind from "@babel/plugin-syntax-function-bind"; import syntaxFunctionSent from "@babel/plugin-syntax-function-sent"; @@ -19,11 +17,14 @@ import syntaxJsx from "@babel/plugin-syntax-jsx"; import syntaxObjectRestSpread from "@babel/plugin-syntax-object-rest-spread"; import syntaxOptionalCatchBinding from "@babel/plugin-syntax-optional-catch-binding"; import syntaxPipelineOperator from "@babel/plugin-syntax-pipeline-operator"; +import syntaxRecordAndTuple from "@babel/plugin-syntax-record-and-tuple"; +import syntaxTopLevelAwait from "@babel/plugin-syntax-top-level-await"; import syntaxTypescript from "@babel/plugin-syntax-typescript"; import proposalAsyncGeneratorFunctions from "@babel/plugin-proposal-async-generator-functions"; import proposalClassProperties from "@babel/plugin-proposal-class-properties"; import proposalDecorators from "@babel/plugin-proposal-decorators"; import proposalDoExpressions from "@babel/plugin-proposal-do-expressions"; +import proposalDynamicImport from "@babel/plugin-proposal-dynamic-import"; import proposalExportDefaultFrom from "@babel/plugin-proposal-export-default-from"; import proposalExportNamespaceFrom from "@babel/plugin-proposal-export-namespace-from"; import proposalFunctionBind from "@babel/plugin-proposal-function-bind"; @@ -61,6 +62,7 @@ import transformModulesAmd from "@babel/plugin-transform-modules-amd"; import transformModulesCommonjs from "@babel/plugin-transform-modules-commonjs"; import transformModulesSystemjs from "@babel/plugin-transform-modules-systemjs"; import transformModulesUmd from "@babel/plugin-transform-modules-umd"; +import transformNamedCapturingGroupsRegex from "@babel/plugin-transform-named-capturing-groups-regex"; import transformNewTarget from "@babel/plugin-transform-new-target"; import transformObjectAssign from "@babel/plugin-transform-object-assign"; import transformObjectSuper from "@babel/plugin-transform-object-super"; @@ -74,6 +76,7 @@ import transformReactDisplayName from "@babel/plugin-transform-react-display-nam import transformReactInlineElements from "@babel/plugin-transform-react-inline-elements"; import transformReactJsx from "@babel/plugin-transform-react-jsx"; import transformReactJsxCompat from "@babel/plugin-transform-react-jsx-compat"; +import transformReactJsxDevelopment from "@babel/plugin-transform-react-jsx-development"; import transformReactJsxSelf from "@babel/plugin-transform-react-jsx-self"; import transformReactJsxSource from "@babel/plugin-transform-react-jsx-source"; import transformRegenerator from "@babel/plugin-transform-regenerator"; @@ -94,9 +97,7 @@ export { syntaxClassProperties, syntaxDecorators, syntaxDoExpressions, - syntaxDynamicImport, syntaxExportDefaultFrom, - syntaxExportNamespaceFrom, syntaxFlow, syntaxFunctionBind, syntaxFunctionSent, @@ -105,11 +106,14 @@ export { syntaxObjectRestSpread, syntaxOptionalCatchBinding, syntaxPipelineOperator, + syntaxRecordAndTuple, + syntaxTopLevelAwait, syntaxTypescript, proposalAsyncGeneratorFunctions, proposalClassProperties, proposalDecorators, proposalDoExpressions, + proposalDynamicImport, proposalExportDefaultFrom, proposalExportNamespaceFrom, proposalFunctionBind, @@ -147,6 +151,7 @@ export { transformModulesCommonjs, transformModulesSystemjs, transformModulesUmd, + transformNamedCapturingGroupsRegex, transformNewTarget, transformObjectAssign, transformObjectSuper, @@ -160,6 +165,7 @@ export { transformReactInlineElements, transformReactJsx, transformReactJsxCompat, + transformReactJsxDevelopment, transformReactJsxSelf, transformReactJsxSource, transformRegenerator, @@ -181,9 +187,7 @@ export const all = { "syntax-class-properties": syntaxClassProperties, "syntax-decorators": syntaxDecorators, "syntax-do-expressions": syntaxDoExpressions, - "syntax-dynamic-import": syntaxDynamicImport, "syntax-export-default-from": syntaxExportDefaultFrom, - "syntax-export-namespace-from": syntaxExportNamespaceFrom, "syntax-flow": syntaxFlow, "syntax-function-bind": syntaxFunctionBind, "syntax-function-sent": syntaxFunctionSent, @@ -192,11 +196,14 @@ export const all = { "syntax-object-rest-spread": syntaxObjectRestSpread, "syntax-optional-catch-binding": syntaxOptionalCatchBinding, "syntax-pipeline-operator": syntaxPipelineOperator, + "syntax-record-and-tuple": syntaxRecordAndTuple, + "syntax-top-level-await": syntaxTopLevelAwait, "syntax-typescript": syntaxTypescript, "proposal-async-generator-functions": proposalAsyncGeneratorFunctions, "proposal-class-properties": proposalClassProperties, "proposal-decorators": proposalDecorators, "proposal-do-expressions": proposalDoExpressions, + "proposal-dynamic-import": proposalDynamicImport, "proposal-export-default-from": proposalExportDefaultFrom, "proposal-export-namespace-from": proposalExportNamespaceFrom, "proposal-function-bind": proposalFunctionBind, @@ -234,6 +241,7 @@ export const all = { "transform-modules-commonjs": transformModulesCommonjs, "transform-modules-systemjs": transformModulesSystemjs, "transform-modules-umd": transformModulesUmd, + "transform-named-capturing-groups-regex": transformNamedCapturingGroupsRegex, "transform-new-target": transformNewTarget, "transform-object-assign": transformObjectAssign, "transform-object-super": transformObjectSuper, @@ -247,6 +255,7 @@ export const all = { "transform-react-inline-elements": transformReactInlineElements, "transform-react-jsx": transformReactJsx, "transform-react-jsx-compat": transformReactJsxCompat, + "transform-react-jsx-development": transformReactJsxDevelopment, "transform-react-jsx-self": transformReactJsxSelf, "transform-react-jsx-source": transformReactJsxSource, "transform-regenerator": transformRegenerator, diff --git a/packages/babel-standalone/src/index.js b/packages/babel-standalone/src/index.js index 1e7c83d30c6c..cc7870028095 100644 --- a/packages/babel-standalone/src/index.js +++ b/packages/babel-standalone/src/index.js @@ -21,8 +21,9 @@ import presetStage0 from "./preset-stage-0"; import presetStage1 from "./preset-stage-1"; import presetStage2 from "./preset-stage-2"; import presetStage3 from "./preset-stage-3"; -import presetReact from "@babel/preset-react"; +import presetEnv from "@babel/preset-env"; import presetFlow from "@babel/preset-flow"; +import presetReact from "@babel/preset-react"; import presetTypescript from "@babel/preset-typescript"; import { runScripts } from "./transformScriptTags"; @@ -40,7 +41,7 @@ const isArray = */ function loadBuiltin(builtinTable, name) { if (isArray(name) && typeof name[0] === "string") { - if (builtinTable.hasOwnProperty(name[0])) { + if (Object.prototype.hasOwnProperty.call(builtinTable, name[0])) { return [builtinTable[name[0]]].concat(name.slice(1)); } return; @@ -66,7 +67,7 @@ function processOptions(options) { if ( isArray(preset) && typeof preset[0] === "object" && - preset[0].hasOwnProperty("buildPreset") + Object.prototype.hasOwnProperty.call(preset[0], "buildPreset") ) { preset[0] = { ...preset[0], buildPreset: preset[0].buildPreset }; } @@ -112,7 +113,7 @@ export const buildExternalHelpers = babelBuildExternalHelpers; * Registers a named plugin for use with Babel. */ export function registerPlugin(name: string, plugin: Object | Function): void { - if (availablePlugins.hasOwnProperty(name)) { + if (Object.prototype.hasOwnProperty.call(availablePlugins, name)) { console.warn( `A plugin named "${name}" is already registered, it will be overridden`, ); @@ -135,10 +136,16 @@ export function registerPlugins(newPlugins: { * Registers a named preset for use with Babel. */ export function registerPreset(name: string, preset: Object | Function): void { - if (availablePresets.hasOwnProperty(name)) { - console.warn( - `A preset named "${name}" is already registered, it will be overridden`, - ); + if (Object.prototype.hasOwnProperty.call(availablePresets, name)) { + if (name === "env") { + console.warn( + "@babel/preset-env is now included in @babel/standalone, please remove @babel/preset-env-standalone", + ); + } else { + console.warn( + `A preset named "${name}" is already registered, it will be overridden`, + ); + } } availablePresets[name] = preset; } @@ -163,6 +170,7 @@ registerPlugins(all); // Want to get rid of this whitelist of presets? // Wait! Please read https://github.com/babel/babel/pull/6177 first. registerPresets({ + env: presetEnv, es2015: preset2015, es2016: () => { return { diff --git a/packages/babel-standalone/src/preset-stage-1.js b/packages/babel-standalone/src/preset-stage-1.js index 0018a48f4334..2d8aba73a2db 100644 --- a/packages/babel-standalone/src/preset-stage-1.js +++ b/packages/babel-standalone/src/preset-stage-1.js @@ -9,6 +9,7 @@ export default (_: any, opts: Object = {}) => { decoratorsLegacy = false, decoratorsBeforeExport, pipelineProposal = "minimal", + recordAndTupleSyntax: recordAndTupleSyntax = "hash", } = opts; return { @@ -19,11 +20,9 @@ export default (_: any, opts: Object = {}) => { ], ], plugins: [ + [babelPlugins.syntaxRecordAndTuple, { syntaxType: recordAndTupleSyntax }], babelPlugins.proposalExportDefaultFrom, - babelPlugins.proposalLogicalAssignmentOperators, - [babelPlugins.proposalOptionalChaining, { loose }], [babelPlugins.proposalPipelineOperator, { proposal: pipelineProposal }], - [babelPlugins.proposalNullishCoalescingOperator, { loose }], babelPlugins.proposalDoExpressions, ], }; diff --git a/packages/babel-standalone/src/preset-stage-2.js b/packages/babel-standalone/src/preset-stage-2.js index b7ba787ae64c..7df7c1492346 100644 --- a/packages/babel-standalone/src/preset-stage-2.js +++ b/packages/babel-standalone/src/preset-stage-2.js @@ -18,8 +18,6 @@ export default (_: any, opts: Object = {}) => { { legacy: decoratorsLegacy, decoratorsBeforeExport }, ], babelPlugins.proposalFunctionSent, - babelPlugins.proposalExportNamespaceFrom, - babelPlugins.proposalNumericSeparator, babelPlugins.proposalThrowExpressions, ], }; diff --git a/packages/babel-standalone/src/preset-stage-3.js b/packages/babel-standalone/src/preset-stage-3.js index 6885719f2fd2..2b42d24f4e83 100644 --- a/packages/babel-standalone/src/preset-stage-3.js +++ b/packages/babel-standalone/src/preset-stage-3.js @@ -10,10 +10,15 @@ export default (_: any, opts: Object) => { return { plugins: [ - babelPlugins.syntaxDynamicImport, babelPlugins.syntaxImportMeta, + babelPlugins.syntaxTopLevelAwait, + babelPlugins.proposalExportNamespaceFrom, + babelPlugins.proposalLogicalAssignmentOperators, + [babelPlugins.proposalOptionalChaining, { loose }], + [babelPlugins.proposalNullishCoalescingOperator, { loose }], [babelPlugins.proposalClassProperties, { loose }], babelPlugins.proposalJsonStrings, + babelPlugins.proposalNumericSeparator, [babelPlugins.proposalPrivateMethods, { loose }], ], }; diff --git a/packages/babel-standalone/src/transformScriptTags.js b/packages/babel-standalone/src/transformScriptTags.js index 6448a9fe0e25..369fc28f0ee2 100644 --- a/packages/babel-standalone/src/transformScriptTags.js +++ b/packages/babel-standalone/src/transformScriptTags.js @@ -26,18 +26,16 @@ function transformCode(transformFn, script) { } } - return transformFn(script.content, { - filename: source, - ...buildBabelOptions(script), - }).code; + return transformFn(script.content, buildBabelOptions(script, source)).code; } /** * Builds the Babel options for transforming the specified script, using some * sensible default presets and plugins if none were explicitly provided. */ -function buildBabelOptions(script) { +function buildBabelOptions(script, filename) { return { + filename, presets: script.presets || ["react", "es2015"], plugins: script.plugins || [ "proposal-class-properties", @@ -45,6 +43,7 @@ function buildBabelOptions(script) { "transform-flow-strip-types", ], sourceMaps: "inline", + sourceFileName: filename, }; } diff --git a/packages/babel-standalone/test/babel.js b/packages/babel-standalone/test/babel.js index 056bfafca847..20dbe7606d39 100644 --- a/packages/babel-standalone/test/babel.js +++ b/packages/babel-standalone/test/babel.js @@ -68,7 +68,7 @@ }, ).code; expect(output).toBe( - 'const someDiv = React.createElement("div", null, getMessage());', + 'const someDiv = /*#__PURE__*/React.createElement("div", null, getMessage());', ); }); @@ -110,6 +110,61 @@ ).toThrow(/Invalid plugin specified in Babel options: "lolfail"/); }); + describe("env preset", () => { + it("works w/o targets", () => { + const output = Babel.transform("const a = 1;", { + sourceType: "script", + presets: ["env"], + }).code; + expect(output).toBe("var a = 1;"); + }); + + it("doesn't transpile `const` with chrome 60", () => { + const output = Babel.transform("const a = 1;", { + sourceType: "script", + presets: [ + [ + "env", + { + targets: { + chrome: 60, + }, + }, + ], + ], + }).code; + expect(output).toBe("const a = 1;"); + }); + + it("transpiles `const` with chrome 60 and preset-es2015", () => { + const output = Babel.transform("const a = 1;", { + sourceType: "script", + presets: [ + [ + "env", + { + targets: { + chrome: 60, + }, + }, + ], + "es2015", + ], + }).code; + expect(output).toBe("var a = 1;"); + }); + + it("uses transform-new-targets plugin", () => { + const output = Babel.transform("function Foo() {new.target}", { + sourceType: "script", + presets: ["env"], + }).code; + expect(output).toBe( + "function Foo() {\n this instanceof Foo ? this.constructor : void 0;\n}", + ); + }); + }); + describe("custom plugins and presets", () => { const lolizer = () => ({ visitor: { diff --git a/packages/babel-template/package.json b/packages/babel-template/package.json index 40c19ddee051..0978a48720ab 100644 --- a/packages/babel-template/package.json +++ b/packages/babel-template/package.json @@ -1,6 +1,6 @@ { "name": "@babel/template", - "version": "7.4.4", + "version": "7.8.6", "description": "Generate an AST from a string template.", "author": "Sebastian McKenzie ", "homepage": "https://babeljs.io/", @@ -11,8 +11,8 @@ "repository": "https://github.com/babel/babel/tree/master/packages/babel-template", "main": "lib/index.js", "dependencies": { - "@babel/code-frame": "^7.0.0", - "@babel/parser": "^7.4.4", - "@babel/types": "^7.4.4" + "@babel/code-frame": "^7.8.3", + "@babel/parser": "^7.8.6", + "@babel/types": "^7.8.6" } } diff --git a/packages/babel-template/src/options.js b/packages/babel-template/src/options.js index cb2639319e51..b1c6f38a6e86 100644 --- a/packages/babel-template/src/options.js +++ b/packages/babel-template/src/options.js @@ -131,7 +131,7 @@ export function validate(opts: mixed): TemplateOpts { placeholderWhitelist: placeholderWhitelist || undefined, placeholderPattern: placeholderPattern == null ? undefined : placeholderPattern, - preserveComments: preserveComments == null ? false : preserveComments, + preserveComments: preserveComments == null ? undefined : preserveComments, syntacticPlaceholders: syntacticPlaceholders == null ? undefined : syntacticPlaceholders, }; @@ -149,7 +149,7 @@ export function normalizeReplacements( return acc; }, {}); } else if (typeof replacements === "object" || replacements == null) { - return replacements || undefined; + return (replacements: any) || undefined; } throw new Error( diff --git a/packages/babel-template/src/populate.js b/packages/babel-template/src/populate.js index 93cf4f1b677e..90b13853ba67 100644 --- a/packages/babel-template/src/populate.js +++ b/packages/babel-template/src/populate.js @@ -32,7 +32,7 @@ export default function populatePlaceholders( }); } - // Process in reverse order to AST mutation doesn't change indices that + // Process in reverse order so AST mutation doesn't change indices that // will be needed for later calls to `placeholder.resolve()`. metadata.placeholders .slice() @@ -45,9 +45,7 @@ export default function populatePlaceholders( (replacements && replacements[placeholder.name]) || null, ); } catch (e) { - e.message = `@babel/template placeholder "${placeholder.name}": ${ - e.message - }`; + e.message = `@babel/template placeholder "${placeholder.name}": ${e.message}`; throw e; } }); diff --git a/packages/babel-template/test/index.js b/packages/babel-template/test/index.js index a90db40540e4..58e552e94049 100644 --- a/packages/babel-template/test/index.js +++ b/packages/babel-template/test/index.js @@ -28,6 +28,18 @@ describe("@babel/template", function() { expect(generator(output).code).toBe(comments); }); + it("should preserve comments with a flag", function() { + const output = template(comments, { preserveComments: true })(); + expect(generator(output).code).toBe(comments); + }); + + it("should preserve comments with a flag when using .ast", function() { + const output1 = template.ast(comments, { preserveComments: true }); + const output2 = template({ preserveComments: true }).ast(comments); + expect(generator(output1).code).toBe(comments); + expect(generator(output2).code).toBe(comments); + }); + describe("string-based", () => { it("should handle replacing values from an object", () => { const value = t.stringLiteral("some string value"); @@ -219,7 +231,7 @@ describe("@babel/template", function() { }); }); - describe.only(".syntacticPlaceholders", () => { + describe(".syntacticPlaceholders", () => { it("works in function body", () => { const output = template(`function f() %%A%%`)({ A: t.blockStatement([]), @@ -302,12 +314,10 @@ describe("@babel/template", function() { }); it("replaces identifiers", () => { - expect(() => { - const output = template(`FOO`)({ - FOO: t.numericLiteral(1), - }); - expect(generator(output).code).toMatchInlineSnapshot(`"1;"`); + const output = template(`FOO`)({ + FOO: t.numericLiteral(1), }); + expect(generator(output).code).toMatchInlineSnapshot(`"1;"`); }); it("doesn't mix placeholder styles", () => { diff --git a/packages/babel-traverse/package.json b/packages/babel-traverse/package.json index ea0fee988408..8ee6022d59b1 100644 --- a/packages/babel-traverse/package.json +++ b/packages/babel-traverse/package.json @@ -1,6 +1,6 @@ { "name": "@babel/traverse", - "version": "7.5.5", + "version": "7.9.5", "description": "The Babel Traverse module maintains the overall tree state, and is responsible for replacing, removing, and adding nodes", "author": "Sebastian McKenzie ", "homepage": "https://babeljs.io/", @@ -11,17 +11,17 @@ "repository": "https://github.com/babel/babel/tree/master/packages/babel-traverse", "main": "lib/index.js", "dependencies": { - "@babel/code-frame": "^7.5.5", - "@babel/generator": "^7.5.5", - "@babel/helper-function-name": "^7.1.0", - "@babel/helper-split-export-declaration": "^7.4.4", - "@babel/parser": "^7.5.5", - "@babel/types": "^7.5.5", + "@babel/code-frame": "^7.8.3", + "@babel/generator": "^7.9.5", + "@babel/helper-function-name": "^7.9.5", + "@babel/helper-split-export-declaration": "^7.8.3", + "@babel/parser": "^7.9.0", + "@babel/types": "^7.9.5", "debug": "^4.1.0", "globals": "^11.1.0", "lodash": "^4.17.13" }, "devDependencies": { - "@babel/helper-plugin-test-runner": "^7.0.0" + "@babel/helper-plugin-test-runner": "^7.8.3" } } diff --git a/packages/babel-traverse/src/index.js b/packages/babel-traverse/src/index.js index 5b1ebfdc6ed2..da880632ad40 100644 --- a/packages/babel-traverse/src/index.js +++ b/packages/babel-traverse/src/index.js @@ -25,14 +25,16 @@ export default function traverse( if (parent.type !== "Program" && parent.type !== "File") { throw new Error( "You must pass a scope and parentPath unless traversing a Program/File. " + - `Instead of that you tried to traverse a ${ - parent.type - } node without ` + + `Instead of that you tried to traverse a ${parent.type} node without ` + "passing scope and parentPath.", ); } } + if (!t.VISITOR_KEYS[parent.type]) { + return; + } + visitors.explode(opts); traverse.node(parent, opts, scope, state, parentPath); diff --git a/packages/babel-traverse/src/path/ancestry.js b/packages/babel-traverse/src/path/ancestry.js index 7cc341032255..e2667d1c8dd0 100644 --- a/packages/babel-traverse/src/path/ancestry.js +++ b/packages/babel-traverse/src/path/ancestry.js @@ -4,8 +4,10 @@ import * as t from "@babel/types"; import NodePath from "./index"; /** - * Call the provided `callback` with the `NodePath`s of all the parents. - * When the `callback` returns a truthy value, we return that node path. + * Starting at the parent path of the current `NodePath` and going up the + * tree, return the first `NodePath` that causes the provided `callback` + * to return a truthy value, or `null` if the `callback` never returns a + * truthy value. */ export function findParent(callback): ?NodePath { @@ -18,7 +20,8 @@ export function findParent(callback): ?NodePath { /** * Starting at current `NodePath` and going up the tree, return the first - * `NodePath` that causes the provided `callback` to return a truthy value. + * `NodePath` that causes the provided `callback` to return a truthy value, + * or `null` if the `callback` never returns a truthy value. */ export function find(callback): ?NodePath { diff --git a/packages/babel-traverse/src/path/comments.js b/packages/babel-traverse/src/path/comments.js index 79e4abd9097e..3a967aa1c874 100644 --- a/packages/babel-traverse/src/path/comments.js +++ b/packages/babel-traverse/src/path/comments.js @@ -20,10 +20,9 @@ export function shareCommentsWithSiblings() { const next = this.getSibling(this.key + 1); const hasPrev = Boolean(prev.node); const hasNext = Boolean(next.node); - if (hasPrev && hasNext) { - } else if (hasPrev) { + if (hasPrev && !hasNext) { prev.addComments("trailing", trailing); - } else if (hasNext) { + } else if (hasNext && !hasPrev) { next.addComments("leading", leading); } } diff --git a/packages/babel-traverse/src/path/context.js b/packages/babel-traverse/src/path/context.js index faa5e9d3f15e..4a8c54197bb7 100644 --- a/packages/babel-traverse/src/path/context.js +++ b/packages/babel-traverse/src/path/context.js @@ -1,6 +1,7 @@ // This file contains methods responsible for maintaining a TraversalContext. import traverse from "../index"; +import { SHOULD_SKIP, SHOULD_STOP } from "./index"; export function call(key): boolean { const opts = this.opts; @@ -43,7 +44,8 @@ export function _call(fns?: Array): boolean { // node has been replaced, it will have been requeued if (this.node !== node) return true; - if (this.shouldStop || this.shouldSkip || this.removed) return true; + // this.shouldSkip || this.shouldStop || this.removed + if (this._traverseFlags > 0) return true; } return false; @@ -67,7 +69,12 @@ export function visit(): boolean { return false; } - if (this.call("enter") || this.shouldSkip) { + // Note: We need to check "this.shouldSkip" twice because + // the visitor can set it to true. Usually .shouldSkip is false + // before calling the enter visitor, but it can be true in case of + // a requeued node (e.g. by .replaceWith()) that is then marked + // with .skip(). + if (this.shouldSkip || this.call("enter") || this.shouldSkip) { this.debug("Skip..."); return this.shouldStop; } @@ -92,12 +99,15 @@ export function skip() { } export function skipKey(key) { + if (this.skipKeys == null) { + this.skipKeys = {}; + } this.skipKeys[key] = true; } export function stop() { - this.shouldStop = true; - this.shouldSkip = true; + // this.shouldSkip = true; this.shouldStop = true; + this._traverseFlags |= SHOULD_SKIP | SHOULD_STOP; } export function setScope() { @@ -117,10 +127,11 @@ export function setScope() { } export function setContext(context) { - this.shouldSkip = false; - this.shouldStop = false; - this.removed = false; - this.skipKeys = {}; + if (this.skipKeys != null) { + this.skipKeys = {}; + } + // this.shouldSkip = false; this.shouldStop = false; this.removed = false; + this._traverseFlags = 0; if (context) { this.context = context; @@ -215,9 +226,7 @@ export function pushContext(context) { } export function setup(parentPath, container, listKey, key) { - this.inList = !!listKey; this.listKey = listKey; - this.parentKey = listKey || key; this.container = container; this.parentPath = parentPath || this.parentPath; @@ -233,6 +242,14 @@ export function setKey(key) { export function requeue(pathToQueue = this) { if (pathToQueue.removed) return; + // TODO: Uncomment in Babel 8. If a path is skipped, and then replaced with a + // new one, the new one shouldn't probably be skipped. + // Note that this currently causes an infinite loop because of + // packages/babel-plugin-transform-block-scoping/src/tdz.js#L52-L59 + // (b5b8055cc00756f94bf71deb45f288738520ee3c) + // + // pathToQueue.shouldSkip = false; + // TODO(loganfsmyth): This should be switched back to queue in parent contexts // automatically once #2892 and #4135 have been resolved. See #4140. // let contexts = this._getQueueContexts(); diff --git a/packages/babel-traverse/src/path/conversion.js b/packages/babel-traverse/src/path/conversion.js index 99a2b00a733c..fd149535441a 100644 --- a/packages/babel-traverse/src/path/conversion.js +++ b/packages/babel-traverse/src/path/conversion.js @@ -216,30 +216,6 @@ function hoistFunctionEnvironment( }); } - // Convert all "this" references in the arrow to point at the alias. - let thisBinding; - if (thisPaths.length > 0 || specCompliant) { - thisBinding = getThisBinding(thisEnvFn, inConstructor); - - if ( - !specCompliant || - // In subclass constructors, still need to rewrite because "this" can't be bound in spec mode - // because it might not have been initialized yet. - (inConstructor && hasSuperClass(thisEnvFn)) - ) { - thisPaths.forEach(thisChild => { - const thisRef = thisChild.isJSX() - ? t.jsxIdentifier(thisBinding) - : t.identifier(thisBinding); - - thisRef.loc = thisChild.node.loc; - thisChild.replaceWith(thisRef); - }); - - if (specCompliant) thisBinding = null; - } - } - // Convert all "arguments" references in the arrow to point at the alias. if (argumentsPaths.length > 0) { const argumentsBinding = getBinding(thisEnvFn, "arguments", () => @@ -286,42 +262,64 @@ function hoistFunctionEnvironment( ? "" : superProp.get("property").node.name; - if (superProp.parentPath.isCallExpression({ callee: superProp.node })) { - const superBinding = getSuperPropCallBinding(thisEnvFn, key); + const isAssignment = superProp.parentPath.isAssignmentExpression({ + left: superProp.node, + }); + const isCall = superProp.parentPath.isCallExpression({ + callee: superProp.node, + }); + const superBinding = getSuperPropBinding(thisEnvFn, isAssignment, key); + + const args = []; + if (superProp.node.computed) { + args.push(superProp.get("property").node); + } + + if (isAssignment) { + const value = superProp.parentPath.node.right; + args.push(value); + } + + const call = t.callExpression(t.identifier(superBinding), args); - if (superProp.node.computed) { - const prop = superProp.get("property").node; - superProp.replaceWith(t.identifier(superBinding)); - superProp.parentPath.node.arguments.unshift(prop); - } else { - superProp.replaceWith(t.identifier(superBinding)); - } + if (isCall) { + superProp.parentPath.unshiftContainer("arguments", t.thisExpression()); + superProp.replaceWith(t.memberExpression(call, t.identifier("call"))); + + thisPaths.push(superProp.parentPath.get("arguments.0")); + } else if (isAssignment) { + // Replace not only the super.prop, but the whole assignment + superProp.parentPath.replaceWith(call); } else { - const isAssignment = superProp.parentPath.isAssignmentExpression({ - left: superProp.node, - }); - const superBinding = getSuperPropBinding(thisEnvFn, isAssignment, key); - - const args = []; - if (superProp.node.computed) { - args.push(superProp.get("property").node); - } - - if (isAssignment) { - const value = superProp.parentPath.node.right; - args.push(value); - superProp.parentPath.replaceWith( - t.callExpression(t.identifier(superBinding), args), - ); - } else { - superProp.replaceWith( - t.callExpression(t.identifier(superBinding), args), - ); - } + superProp.replaceWith(call); } }); } + // Convert all "this" references in the arrow to point at the alias. + let thisBinding; + if (thisPaths.length > 0 || specCompliant) { + thisBinding = getThisBinding(thisEnvFn, inConstructor); + + if ( + !specCompliant || + // In subclass constructors, still need to rewrite because "this" can't be bound in spec mode + // because it might not have been initialized yet. + (inConstructor && hasSuperClass(thisEnvFn)) + ) { + thisPaths.forEach(thisChild => { + const thisRef = thisChild.isJSX() + ? t.jsxIdentifier(thisBinding) + : t.identifier(thisBinding); + + thisRef.loc = thisChild.node.loc; + thisChild.replaceWith(thisRef); + }); + + if (specCompliant) thisBinding = null; + } + } + return thisBinding; } @@ -485,37 +483,6 @@ function getSuperBinding(thisEnvFn) { }); } -// Create a binding for a function that will call "super.foo()" or "super[foo]()". -function getSuperPropCallBinding(thisEnvFn, propName) { - return getBinding(thisEnvFn, `superprop_call:${propName || ""}`, () => { - const argsBinding = thisEnvFn.scope.generateUidIdentifier("args"); - const argsList = [t.restElement(argsBinding)]; - - let fnBody; - if (propName) { - // (...args) => super.foo(...args) - fnBody = t.callExpression( - t.memberExpression(t.super(), t.identifier(propName)), - [t.spreadElement(t.identifier(argsBinding.name))], - ); - } else { - const method = thisEnvFn.scope.generateUidIdentifier("prop"); - // (method, ...args) => super[method](...args) - argsList.unshift(method); - fnBody = t.callExpression( - t.memberExpression( - t.super(), - t.identifier(method.name), - true /* computed */, - ), - [t.spreadElement(t.identifier(argsBinding.name))], - ); - } - - return t.arrowFunctionExpression(argsList, fnBody); - }); -} - // Create a binding for a function that will call "super.foo" or "super[foo]". function getSuperPropBinding(thisEnvFn, isAssignment, propName) { const op = isAssignment ? "set" : "get"; diff --git a/packages/babel-traverse/src/path/family.js b/packages/babel-traverse/src/path/family.js index 0af3d2b110cb..b2d9cefc4e1b 100644 --- a/packages/babel-traverse/src/path/family.js +++ b/packages/babel-traverse/src/path/family.js @@ -18,6 +18,61 @@ function addCompletionRecords(path, paths) { return paths; } +function completionRecordForSwitch(cases, paths) { + let isLastCaseWithConsequent = true; + + for (let i = cases.length - 1; i >= 0; i--) { + const switchCase = cases[i]; + const consequent = switchCase.get("consequent"); + + let breakStatement; + findBreak: for (const statement of consequent) { + if (statement.isBlockStatement()) { + for (const statementInBlock of statement.get("body")) { + if (statementInBlock.isBreakStatement()) { + breakStatement = statementInBlock; + break findBreak; + } + } + } else if (statement.isBreakStatement()) { + breakStatement = statement; + break; + } + } + + if (breakStatement) { + while ( + breakStatement.key === 0 && + breakStatement.parentPath.isBlockStatement() + ) { + breakStatement = breakStatement.parentPath; + } + + const prevSibling = breakStatement.getPrevSibling(); + if ( + breakStatement.key > 0 && + (prevSibling.isExpressionStatement() || prevSibling.isBlockStatement()) + ) { + paths = addCompletionRecords(prevSibling, paths); + breakStatement.remove(); + } else { + breakStatement.replaceWith(breakStatement.scope.buildUndefinedNode()); + paths = addCompletionRecords(breakStatement, paths); + } + } else if (isLastCaseWithConsequent) { + const statementFinder = statement => + !statement.isBlockStatement() || + statement.get("body").some(statementFinder); + const hasConsequent = consequent.some(statementFinder); + if (hasConsequent) { + paths = addCompletionRecords(consequent[consequent.length - 1], paths); + isLastCaseWithConsequent = false; + } + } + } + return paths; +} + export function getCompletionRecords(): NodePath[] { let paths = []; @@ -33,9 +88,10 @@ export function getCompletionRecords(): NodePath[] { } else if (this.isTryStatement()) { paths = addCompletionRecords(this.get("block"), paths); paths = addCompletionRecords(this.get("handler"), paths); - paths = addCompletionRecords(this.get("finalizer"), paths); } else if (this.isCatchClause()) { paths = addCompletionRecords(this.get("body"), paths); + } else if (this.isSwitchStatement()) { + paths = completionRecordForSwitch(this.get("cases"), paths); } else { paths.push(this); } diff --git a/packages/babel-traverse/src/path/index.js b/packages/babel-traverse/src/path/index.js index a1be4f5d8d00..79ef05092857 100644 --- a/packages/babel-traverse/src/path/index.js +++ b/packages/babel-traverse/src/path/index.js @@ -23,15 +23,18 @@ import * as NodePath_comments from "./comments"; const debug = buildDebug("babel"); +export const REMOVED = 1 << 0; +export const SHOULD_STOP = 1 << 1; +export const SHOULD_SKIP = 1 << 2; + export default class NodePath { constructor(hub: HubInterface, parent: Object) { this.parent = parent; this.hub = hub; this.contexts = []; - this.data = Object.create(null); - this.shouldSkip = false; - this.shouldStop = false; - this.removed = false; + this.data = null; + // this.shouldSkip = false; this.shouldStop = false; this.removed = false; + this._traverseFlags = 0; this.state = null; this.opts = null; this.skipKeys = null; @@ -39,13 +42,10 @@ export default class NodePath { this.context = null; this.container = null; this.listKey = null; - this.inList = false; - this.parentKey = null; this.key = null; this.node = null; this.scope = null; this.type = null; - this.typeAnnotation = null; } parent: Object; @@ -57,18 +57,16 @@ export default class NodePath { removed: boolean; state: any; opts: ?Object; + _traverseFlags: number; skipKeys: ?Object; parentPath: ?NodePath; context: TraversalContext; container: ?Object | Array; listKey: ?string; - inList: boolean; - parentKey: ?string; key: ?string; node: ?Object; scope: Scope; type: ?string; - typeAnnotation: ?Object; static get({ hub, parentPath, parent, container, listKey, key }): NodePath { if (!hub && parentPath) { @@ -111,10 +109,16 @@ export default class NodePath { } setData(key: string, val: any): any { + if (this.data == null) { + this.data = Object.create(null); + } return (this.data[key] = val); } getData(key: string, def?: any): any { + if (this.data == null) { + this.data = Object.create(null); + } let val = this.data[key]; if (val === undefined && def !== undefined) val = this.data[key] = def; return val; @@ -152,6 +156,56 @@ export default class NodePath { toString() { return generator(this.node).code; } + + get inList() { + return !!this.listKey; + } + + set inList(inList) { + if (!inList) { + this.listKey = null; + } + // ignore inList = true as it should depend on `listKey` + } + + get parentKey() { + return this.listKey || this.key; + } + + get shouldSkip() { + return !!(this._traverseFlags & SHOULD_SKIP); + } + + set shouldSkip(v) { + if (v) { + this._traverseFlags |= SHOULD_SKIP; + } else { + this._traverseFlags &= ~SHOULD_SKIP; + } + } + + get shouldStop() { + return !!(this._traverseFlags & SHOULD_STOP); + } + + set shouldStop(v) { + if (v) { + this._traverseFlags |= SHOULD_STOP; + } else { + this._traverseFlags &= ~SHOULD_STOP; + } + } + + get removed() { + return !!(this._traverseFlags & REMOVED); + } + set removed(v) { + if (v) { + this._traverseFlags |= REMOVED; + } else { + this._traverseFlags &= ~REMOVED; + } + } } Object.assign( diff --git a/packages/babel-traverse/src/path/inference/inferer-reference.js b/packages/babel-traverse/src/path/inference/inferer-reference.js index 1cac5e10641b..54e6a8b98108 100644 --- a/packages/babel-traverse/src/path/inference/inferer-reference.js +++ b/packages/babel-traverse/src/path/inference/inferer-reference.js @@ -91,9 +91,19 @@ function getTypeAnnotationBindingConstantViolations(binding, path, name) { } } - if (types.length) { - return t.createUnionTypeAnnotation(types); + if (!types.length) { + return; + } + + if (t.isTSTypeAnnotation(types[0]) && t.createTSUnionType) { + return t.createTSUnionType(types); + } + + if (t.createFlowUnionType) { + return t.createFlowUnionType(types); } + + return t.createUnionTypeAnnotation(types); } function getConstantViolationsBefore(binding, path, functions) { @@ -102,7 +112,7 @@ function getConstantViolationsBefore(binding, path, functions) { return violations.filter(violation => { violation = violation.resolve(); const status = violation._guessExecutionStatusRelativeTo(path); - if (functions && status === "function") functions.push(violation); + if (functions && status === "unknown") functions.push(violation); return status === "before"; }); } @@ -201,6 +211,20 @@ function getConditionalAnnotation(binding, path, name) { } if (types.length) { + if (t.isTSTypeAnnotation(types[0]) && t.createTSUnionType) { + return { + typeAnnotation: t.createTSUnionType(types), + ifStatement, + }; + } + + if (t.createFlowUnionType) { + return { + typeAnnotation: t.createFlowUnionType(types), + ifStatement, + }; + } + return { typeAnnotation: t.createUnionTypeAnnotation(types), ifStatement, diff --git a/packages/babel-traverse/src/path/inference/inferers.js b/packages/babel-traverse/src/path/inference/inferers.js index fb9a467b1f64..fd9e97bafcf8 100644 --- a/packages/babel-traverse/src/path/inference/inferers.js +++ b/packages/babel-traverse/src/path/inference/inferers.js @@ -83,17 +83,37 @@ export function BinaryExpression(node) { } export function LogicalExpression() { - return t.createUnionTypeAnnotation([ + const argumentTypes = [ this.get("left").getTypeAnnotation(), this.get("right").getTypeAnnotation(), - ]); + ]; + + if (t.isTSTypeAnnotation(argumentTypes[0]) && t.createTSUnionType) { + return t.createTSUnionType(argumentTypes); + } + + if (t.createFlowUnionType) { + return t.createFlowUnionType(argumentTypes); + } + + return t.createUnionTypeAnnotation(argumentTypes); } export function ConditionalExpression() { - return t.createUnionTypeAnnotation([ + const argumentTypes = [ this.get("consequent").getTypeAnnotation(), this.get("alternate").getTypeAnnotation(), - ]); + ]; + + if (t.isTSTypeAnnotation(argumentTypes[0]) && t.createTSUnionType) { + return t.createTSUnionType(argumentTypes); + } + + if (t.createFlowUnionType) { + return t.createFlowUnionType(argumentTypes); + } + + return t.createUnionTypeAnnotation(argumentTypes); } export function SequenceExpression() { diff --git a/packages/babel-traverse/src/path/introspection.js b/packages/babel-traverse/src/path/introspection.js index 626ca307af8c..b660cf666e94 100644 --- a/packages/babel-traverse/src/path/introspection.js +++ b/packages/babel-traverse/src/path/introspection.js @@ -206,6 +206,75 @@ export function willIMaybeExecuteBefore(target) { return this._guessExecutionStatusRelativeTo(target) !== "after"; } +function getOuterFunction(path) { + return (path.scope.getFunctionParent() || path.scope.getProgramParent()).path; +} + +function isExecutionUncertain(type, key) { + switch (type) { + // a && FOO + // a || FOO + case "LogicalExpression": + return key === "right"; + + // a ? FOO : FOO + // if (a) FOO; else FOO; + case "ConditionalExpression": + case "IfStatement": + return key === "consequent" || key === "alternate"; + + // while (a) FOO; + case "WhileStatement": + case "DoWhileStatement": + case "ForInStatement": + case "ForOfStatement": + return key === "body"; + + // for (a; b; FOO) FOO; + case "ForStatement": + return key === "body" || key === "update"; + + // switch (a) { FOO } + case "SwitchStatement": + return key === "cases"; + + // try { a } catch FOO finally { b } + case "TryStatement": + return key === "handler"; + + // var [ x = FOO ] + case "AssignmentPattern": + return key === "right"; + + // a?.[FOO] + case "OptionalMemberExpression": + return key === "property"; + + // a?.(FOO) + case "OptionalCallExpression": + return key === "arguments"; + + default: + return false; + } +} + +function isExecutionUncertainInList(paths, maxIndex) { + for (let i = 0; i < maxIndex; i++) { + const path = paths[i]; + if (isExecutionUncertain(path.parent.type, path.parentKey)) { + return true; + } + } + return false; +} + +// TODO (Babel 8) +// This can be { before: boolean, after: boolean, unknown: boolean }. +// This allows transforms like the tdz one to treat cases when the status +// is both before and unknown/after like if it were before. +type RelativeExecutionStatus = "before" | "after" | "unknown"; + /** * Given a `target` check the execution status of it relative to the current path. * @@ -213,108 +282,137 @@ export function willIMaybeExecuteBefore(target) { * before or after the input `target` element. */ -export function _guessExecutionStatusRelativeTo(target) { +export function _guessExecutionStatusRelativeTo( + target: NodePath, +): RelativeExecutionStatus { // check if the two paths are in different functions, we can't track execution of these - const targetFuncParent = - target.scope.getFunctionParent() || target.scope.getProgramParent(); - const selfFuncParent = - this.scope.getFunctionParent() || target.scope.getProgramParent(); + const funcParent = { + this: getOuterFunction(this), + target: getOuterFunction(target), + }; // here we check the `node` equality as sometimes we may have different paths for the // same node due to path thrashing - if (targetFuncParent.node !== selfFuncParent.node) { - const status = this._guessExecutionStatusRelativeToDifferentFunctions( - targetFuncParent, + if (funcParent.target.node !== funcParent.this.node) { + return this._guessExecutionStatusRelativeToDifferentFunctions( + funcParent.target, ); - if (status) { - return status; - } else { - target = targetFuncParent.path; - } } - const targetPaths = target.getAncestry(); - if (targetPaths.indexOf(this) >= 0) return "after"; + const paths = { + target: target.getAncestry(), + this: this.getAncestry(), + }; - const selfPaths = this.getAncestry(); + // If this is an ancestor of the target path, + // e.g. f(g); where this is f and target is g. + if (paths.target.indexOf(this) >= 0) return "after"; + if (paths.this.indexOf(target) >= 0) return "before"; // get ancestor where the branches intersect let commonPath; - let targetIndex; - let selfIndex; - for (selfIndex = 0; selfIndex < selfPaths.length; selfIndex++) { - const selfPath = selfPaths[selfIndex]; - targetIndex = targetPaths.indexOf(selfPath); - if (targetIndex >= 0) { - commonPath = selfPath; - break; + const commonIndex = { target: 0, this: 0 }; + + while (!commonPath && commonIndex.this < paths.this.length) { + const path = paths.this[commonIndex.this]; + commonIndex.target = paths.target.indexOf(path); + if (commonIndex.target >= 0) { + commonPath = path; + } else { + commonIndex.this++; } } + if (!commonPath) { - return "before"; + throw new Error( + "Internal Babel error - The two compared nodes" + + " don't appear to belong to the same program.", + ); } - // get the relationship paths that associate these nodes to their common ancestor - const targetRelationship = targetPaths[targetIndex - 1]; - const selfRelationship = selfPaths[selfIndex - 1]; - if (!targetRelationship || !selfRelationship) { - return "before"; + if ( + isExecutionUncertainInList(paths.this, commonIndex.this - 1) || + isExecutionUncertainInList(paths.target, commonIndex.target - 1) + ) { + return "unknown"; } + const divergence = { + this: paths.this[commonIndex.this - 1], + target: paths.target[commonIndex.target - 1], + }; + // container list so let's see which one is after the other + // e.g. [ THIS, TARGET ] if ( - targetRelationship.listKey && - targetRelationship.container === selfRelationship.container + divergence.target.listKey && + divergence.this.listKey && + divergence.target.container === divergence.this.container ) { - return targetRelationship.key > selfRelationship.key ? "before" : "after"; + return divergence.target.key > divergence.this.key ? "before" : "after"; } // otherwise we're associated by a parent node, check which key comes before the other const keys = t.VISITOR_KEYS[commonPath.type]; - const targetKeyPosition = keys.indexOf(targetRelationship.key); - const selfKeyPosition = keys.indexOf(selfRelationship.key); - return targetKeyPosition > selfKeyPosition ? "before" : "after"; + const keyPosition = { + this: keys.indexOf(divergence.this.parentKey), + target: keys.indexOf(divergence.target.parentKey), + }; + return keyPosition.target > keyPosition.this ? "before" : "after"; } +// Used to avoid infinite recursion in cases like +// function f() { if (false) f(); } +// f(); +// It also works with indirect recursion. +const executionOrderCheckedNodes = new WeakSet(); + export function _guessExecutionStatusRelativeToDifferentFunctions( - targetFuncParent, -) { - const targetFuncPath = targetFuncParent.path; - if (!targetFuncPath.isFunctionDeclaration()) return; + target: NodePath, +): RelativeExecutionStatus { + if ( + !target.isFunctionDeclaration() || + target.parentPath.isExportDeclaration() + ) { + return "unknown"; + } // so we're in a completely different function, if this is a function declaration // then we can be a bit smarter and handle cases where the function is either // a. not called at all (part of an export) // b. called directly - const binding = targetFuncPath.scope.getBinding(targetFuncPath.node.id.name); + const binding = target.scope.getBinding(target.node.id.name); // no references! if (!binding.references) return "before"; const referencePaths: Array = binding.referencePaths; - // verify that all of the references are calls - for (const path of referencePaths) { - if (path.key !== "callee" || !path.parentPath.isCallExpression()) { - return; - } - } - let allStatus; // verify that all the calls have the same execution status for (const path of referencePaths) { // if a reference is a child of the function we're checking against then we can // safely ignore it - const childOfFunction = !!path.find( - path => path.node === targetFuncPath.node, - ); + const childOfFunction = !!path.find(path => path.node === target.node); if (childOfFunction) continue; + if (path.key !== "callee" || !path.parentPath.isCallExpression()) { + // This function is passed as a reference, so we don't + // know when it will be called. + return "unknown"; + } + + // Prevent infinte loops in recursive functions + if (executionOrderCheckedNodes.has(path.node)) continue; + executionOrderCheckedNodes.add(path.node); + const status = this._guessExecutionStatusRelativeTo(path); - if (allStatus) { - if (allStatus !== status) return; + executionOrderCheckedNodes.delete(path.node); + + if (allStatus && allStatus !== status) { + return "unknown"; } else { allStatus = status; } diff --git a/packages/babel-traverse/src/path/lib/hoister.js b/packages/babel-traverse/src/path/lib/hoister.js index 2fd8339eaa7d..7e7f85034628 100644 --- a/packages/babel-traverse/src/path/lib/hoister.js +++ b/packages/babel-traverse/src/path/lib/hoister.js @@ -32,6 +32,15 @@ const referenceVisitor = { const binding = path.scope.getBinding(path.node.name); if (!binding) return; + // we can handle reassignments only if they happen in the same scope as the declaration + for (const violation of binding.constantViolations) { + if (violation.scope !== binding.path.scope) { + state.mutableBinding = true; + path.stop(); + return; + } + } + // this binding isn't accessible from the parent scope so we can safely ignore it // eg. it's in a closure etc if (binding !== state.scope.getBinding(path.node.name)) return; @@ -46,6 +55,9 @@ export default class PathHoister { this.breakOnScopePaths = []; // Storage for bindings that may affect what path we can hoist to. this.bindings = {}; + // "true" if the current path contains a reference to a binding whose + // value can change and thus can't be safely hoisted. + this.mutableBinding = false; // Storage for eligible scopes. this.scopes = []; // Our original scope and path. @@ -195,6 +207,8 @@ export default class PathHoister { run() { this.path.traverse(referenceVisitor, this); + if (this.mutableBinding) return; + this.getCompatibleScopes(); const attachTo = this.getAttachmentPath(); diff --git a/packages/babel-traverse/src/path/lib/virtual-types.js b/packages/babel-traverse/src/path/lib/virtual-types.js index 97cec0e3af99..d7072d6f6e4a 100644 --- a/packages/babel-traverse/src/path/lib/virtual-types.js +++ b/packages/babel-traverse/src/path/lib/virtual-types.js @@ -64,7 +64,8 @@ export const Expression = { }; export const Scope = { - types: ["Scopable"], + // When pattern is inside the function params, it is a scope + types: ["Scopable", "Pattern"], checkPath(path) { return t.isScope(path.node, path.parent); }, diff --git a/packages/babel-traverse/src/path/modification.js b/packages/babel-traverse/src/path/modification.js index 6039a94c6090..1f6d2a0b32db 100644 --- a/packages/babel-traverse/src/path/modification.js +++ b/packages/babel-traverse/src/path/modification.js @@ -115,7 +115,9 @@ export function insertAfter(nodes) { }), ); } else if ( - (this.isNodeType("Expression") && !this.isJSXElement()) || + (this.isNodeType("Expression") && + !this.isJSXElement() && + !parentPath.isJSXElement()) || (parentPath.isForStatement() && this.key === "init") ) { if (this.node) { diff --git a/packages/babel-traverse/src/path/removal.js b/packages/babel-traverse/src/path/removal.js index b4d1330b256d..85123863762f 100644 --- a/packages/babel-traverse/src/path/removal.js +++ b/packages/babel-traverse/src/path/removal.js @@ -1,12 +1,15 @@ // This file contains methods responsible for removing a node. import { hooks } from "./lib/removal-hooks"; +import { REMOVED, SHOULD_SKIP } from "./index"; export function remove() { this._assertUnremoved(); this.resync(); - this._removeFromScope(); + if (!this.opts || !this.opts.noScope) { + this._removeFromScope(); + } if (this._callRemovalHooks()) { this._markRemoved(); @@ -39,8 +42,8 @@ export function _remove() { } export function _markRemoved() { - this.shouldSkip = true; - this.removed = true; + // this.shouldSkip = true; this.removed = true; + this._traverseFlags |= SHOULD_SKIP | REMOVED; this.node = null; } diff --git a/packages/babel-traverse/src/scope/index.js b/packages/babel-traverse/src/scope/index.js index 375d5827b970..42581748bf5c 100644 --- a/packages/babel-traverse/src/scope/index.js +++ b/packages/babel-traverse/src/scope/index.js @@ -11,37 +11,141 @@ import { scope as scopeCache } from "../cache"; // Recursively gathers the identifying names of a node. function gatherNodeParts(node: Object, parts: Array) { - if (t.isModuleDeclaration(node)) { - if (node.source) { - gatherNodeParts(node.source, parts); - } else if (node.specifiers && node.specifiers.length) { - for (const specifier of (node.specifiers: Array)) { - gatherNodeParts(specifier, parts); + switch (node?.type) { + default: + if (t.isModuleDeclaration(node)) { + if (node.source) { + gatherNodeParts(node.source, parts); + } else if (node.specifiers && node.specifiers.length) { + for (const e of node.specifiers) gatherNodeParts(e, parts); + } else if (node.declaration) { + gatherNodeParts(node.declaration, parts); + } + } else if (t.isModuleSpecifier(node)) { + gatherNodeParts(node.local, parts); + } else if (t.isLiteral(node)) { + parts.push(node.value); + } + break; + + case "MemberExpression": + case "OptionalMemberExpression": + case "JSXMemberExpression": + gatherNodeParts(node.object, parts); + gatherNodeParts(node.property, parts); + break; + + case "Identifier": + case "JSXIdentifier": + parts.push(node.name); + break; + + case "CallExpression": + case "OptionalCallExpression": + case "NewExpression": + gatherNodeParts(node.callee, parts); + break; + + case "ObjectExpression": + case "ObjectPattern": + for (const e of node.properties) { + gatherNodeParts(e, parts); } - } else if (node.declaration) { - gatherNodeParts(node.declaration, parts); - } - } else if (t.isModuleSpecifier(node)) { - gatherNodeParts(node.local, parts); - } else if (t.isMemberExpression(node)) { - gatherNodeParts(node.object, parts); - gatherNodeParts(node.property, parts); - } else if (t.isIdentifier(node)) { - parts.push(node.name); - } else if (t.isLiteral(node)) { - parts.push(node.value); - } else if (t.isCallExpression(node)) { - gatherNodeParts(node.callee, parts); - } else if (t.isObjectExpression(node) || t.isObjectPattern(node)) { - for (const prop of (node.properties: Array)) { - gatherNodeParts(prop.key || prop.argument, parts); - } - } else if (t.isPrivateName(node)) { - gatherNodeParts(node.id, parts); - } else if (t.isThisExpression(node)) { - parts.push("this"); - } else if (t.isSuper(node)) { - parts.push("super"); + break; + + case "SpreadElement": + case "RestElement": + gatherNodeParts(node.argument, parts); + break; + + case "ObjectProperty": + case "ObjectMethod": + case "ClassProperty": + case "ClassMethod": + case "ClassPrivateProperty": + case "ClassPrivateMethod": + gatherNodeParts(node.key, parts); + break; + + case "ThisExpression": + parts.push("this"); + break; + + case "Super": + parts.push("super"); + break; + + case "Import": + parts.push("import"); + break; + + case "DoExpression": + parts.push("do"); + break; + + case "YieldExpression": + parts.push("yield"); + gatherNodeParts(node.argument, parts); + break; + + case "AwaitExpression": + parts.push("await"); + gatherNodeParts(node.argument, parts); + break; + + case "AssignmentExpression": + gatherNodeParts(node.left, parts); + break; + + case "VariableDeclarator": + gatherNodeParts(node.id, parts); + break; + + case "FunctionExpression": + case "FunctionDeclaration": + case "ClassExpression": + case "ClassDeclaration": + gatherNodeParts(node.id, parts); + break; + + case "PrivateName": + gatherNodeParts(node.id, parts); + break; + + case "ParenthesizedExpression": + gatherNodeParts(node.expression, parts); + break; + + case "UnaryExpression": + case "UpdateExpression": + gatherNodeParts(node.argument, parts); + break; + + case "MetaProperty": + gatherNodeParts(node.meta, parts); + gatherNodeParts(node.property, parts); + break; + + case "JSXElement": + gatherNodeParts(node.openingElement, parts); + break; + + case "JSXOpeningElement": + parts.push(node.name); + break; + + case "JSXFragment": + gatherNodeParts(node.openingFragment, parts); + break; + + case "JSXOpeningFragment": + parts.push("Fragment"); + break; + + case "JSXNamespacedName": + gatherNodeParts(node.namespace, parts); + gatherNodeParts(node.name, parts); + break; } } @@ -51,6 +155,7 @@ const collectorVisitor = { For(path) { for (const key of (t.FOR_INIT_KEYS: Array)) { const declar = path.get(key); + // delegate block scope handling to the `BlockScoped` method if (declar.isVar()) { const parentScope = path.scope.getFunctionParent() || path.scope.getProgramParent(); @@ -128,15 +233,17 @@ const collectorVisitor = { BlockScoped(path) { let scope = path.scope; if (scope.path === path) scope = scope.parent; - scope.getBlockParent().registerDeclaration(path); - }, - ClassDeclaration(path) { - const id = path.node.id; - if (!id) return; + const parent = scope.getBlockParent(); + parent.registerDeclaration(path); - const name = id.name; - path.scope.bindings[name] = path.scope.getBinding(name); + // Register class identifier in class' scope if this is a class declaration. + if (path.isClassDeclaration() && path.node.id) { + const id = path.node.id; + const name = id.name; + + path.scope.bindings[name] = path.scope.parent.getBinding(name); + } }, Block(path) { @@ -147,6 +254,31 @@ const collectorVisitor = { } } }, + + CatchClause(path) { + path.scope.registerBinding("let", path); + }, + + Function(path) { + if ( + path.isFunctionExpression() && + path.has("id") && + !path.get("id").node[t.NOT_LOCAL_BINDING] + ) { + path.scope.registerBinding("local", path.get("id"), path); + } + + const params: Array = path.get("params"); + for (const param of params) { + path.scope.registerBinding("param", param); + } + }, + + ClassExpression(path) { + if (path.has("id") && !path.get("id").node[t.NOT_LOCAL_BINDING]) { + path.scope.registerBinding("local", path); + } + }, }; let uid = 0; @@ -173,6 +305,7 @@ export default class Scope { this.path = path; this.labels = new Map(); + this.inited = false; } /** @@ -265,17 +398,7 @@ export default class Scope { return `_${id}`; } - generateUidBasedOnNode(parent: Object, defaultName?: String) { - let node = parent; - - if (t.isAssignmentExpression(parent)) { - node = parent.left; - } else if (t.isVariableDeclarator(parent)) { - node = parent.id; - } else if (t.isObjectProperty(node) || t.isObjectMethod(node)) { - node = node.key; - } - + generateUidBasedOnNode(node: Object, defaultName?: String) { const parts = []; gatherNodeParts(node, parts); @@ -289,11 +412,8 @@ export default class Scope { * Generate a unique identifier based on a node. */ - generateUidIdentifierBasedOnNode( - parent: Object, - defaultName?: String, - ): Object { - return t.identifier(this.generateUidBasedOnNode(parent, defaultName)); + generateUidIdentifierBasedOnNode(node: Object, defaultName?: String): Object { + return t.identifier(this.generateUidBasedOnNode(node, defaultName)); } /** @@ -490,12 +610,7 @@ export default class Scope { } buildUndefinedNode() { - if (this.hasBinding("undefined")) { - return t.unaryExpression("void", t.numericLiteral(0), true); - } else { - // eslint-disable-next-line @babel/development/no-undefined-identifier - return t.identifier("undefined"); - } + return t.unaryExpression("void", t.numericLiteral(0), true); } registerConstantViolation(path: NodePath) { @@ -521,6 +636,8 @@ export default class Scope { const ids = path.getOuterBindingIdentifiers(true); for (const name of Object.keys(ids)) { + parent.references[name] = true; + for (const id of (ids[name]: Array)) { const local = this.getOwnBinding(name); @@ -532,8 +649,6 @@ export default class Scope { this.checkBlockScopedCollisions(local, kind, name, id); } - parent.references[name] = true; - // A redeclaration of an existing variable is a modification if (local) { this.registerConstantViolation(bindingPath); @@ -574,13 +689,7 @@ export default class Scope { } hasReference(name: string): boolean { - let scope = this; - - do { - if (scope.references[name]) return true; - } while ((scope = scope.parent)); - - return false; + return !!this.getProgramParent().references[name]; } isPure(node, constantsOnly?: boolean) { @@ -614,7 +723,7 @@ export default class Scope { if (!this.isPure(prop, constantsOnly)) return false; } return true; - } else if (t.isClassMethod(node)) { + } else if (t.isMethod(node)) { if (node.computed && !this.isPure(node.key, constantsOnly)) return false; if (node.kind === "get" || node.kind === "set") return false; return true; @@ -673,7 +782,10 @@ export default class Scope { } init() { - if (!this.references) this.crawl(); + if (!this.inited) { + this.inited = true; + this.crawl(); + } } crawl() { @@ -685,50 +797,24 @@ export default class Scope { this.uids = Object.create(null); this.data = Object.create(null); - // ForStatement - left, init - - if (path.isLoop()) { - for (const key of (t.FOR_INIT_KEYS: Array)) { - const node = path.get(key); - if (node.isBlockScoped()) this.registerBinding(node.node.kind, node); - } - } - - // FunctionExpression - id - - if (path.isFunctionExpression() && path.has("id")) { - if (!path.get("id").node[t.NOT_LOCAL_BINDING]) { + // TODO: explore removing this as it should be covered by collectorVisitor + if (path.isFunction()) { + if ( + path.isFunctionExpression() && + path.has("id") && + !path.get("id").node[t.NOT_LOCAL_BINDING] + ) { this.registerBinding("local", path.get("id"), path); } - } - - // Class - - if (path.isClassExpression() && path.has("id")) { - if (!path.get("id").node[t.NOT_LOCAL_BINDING]) { - this.registerBinding("local", path); - } - } - - // Function - params, rest - if (path.isFunction()) { const params: Array = path.get("params"); for (const param of params) { this.registerBinding("param", param); } } - // CatchClause - param - - if (path.isCatchClause()) { - this.registerBinding("let", path); - } - - // Program - - const parent = this.getProgramParent(); - if (parent.crawling) return; + const programParent = this.getProgramParent(); + if (programParent.crawling) return; const state = { references: [], @@ -744,11 +830,8 @@ export default class Scope { for (const path of state.assignments) { // register undeclared bindings as globals const ids = path.getBindingIdentifiers(); - let programParent; for (const name of Object.keys(ids)) { if (path.scope.getBinding(name)) continue; - - programParent = programParent || path.scope.getProgramParent(); programParent.addGlobal(ids[name]); } @@ -762,7 +845,7 @@ export default class Scope { if (binding) { binding.reference(ref); } else { - ref.scope.getProgramParent().addGlobal(ref.node); + programParent.addGlobal(ref.node); } } @@ -902,10 +985,27 @@ export default class Scope { getBinding(name: string) { let scope = this; + let previousPath; do { const binding = scope.getOwnBinding(name); - if (binding) return binding; + if (binding) { + // Check if a pattern is a part of parameter expressions. + // 9.2.10.28: The closure created by this expression should not have visibility of + // declarations in the function body. If the binding is not a `param`-kind, + // then it must be defined inside the function body, thus it should be skipped + if ( + previousPath && + previousPath.isPattern() && + previousPath.parentPath.isFunction() && + binding.kind !== "param" + ) { + // do nothing + } else { + return binding; + } + } + previousPath = scope.path; } while ((scope = scope.parent)); } diff --git a/packages/babel-traverse/src/scope/lib/renamer.js b/packages/babel-traverse/src/scope/lib/renamer.js index cdfd90819681..4fb0a5fa180c 100644 --- a/packages/babel-traverse/src/scope/lib/renamer.js +++ b/packages/babel-traverse/src/scope/lib/renamer.js @@ -62,6 +62,7 @@ export default class Renamer { // retain the `name` of a class/function declaration + // eslint-disable-next-line no-unreachable if (!path.isFunctionDeclaration() && !path.isClassDeclaration()) return; if (this.binding.kind !== "hoisted") return; @@ -83,6 +84,7 @@ export default class Renamer { // retain the `name` of a class/function expression + // eslint-disable-next-line no-unreachable if (!path.isFunctionExpression() && !path.isClassExpression()) return; if (this.binding.kind !== "local") return; diff --git a/packages/babel-traverse/src/visitors.js b/packages/babel-traverse/src/visitors.js index 77c1488d5d55..eb8516a451fa 100644 --- a/packages/babel-traverse/src/visitors.js +++ b/packages/babel-traverse/src/visitors.js @@ -227,6 +227,11 @@ function wrapWithStateOrWrapper(oldVisitor, state, wrapper: ?Function) { newFn = wrapper(state.key, key, newFn); } + // Override toString in case this function is printed, we want to print the wrapped function, same as we do in `wrapCheck` + if (newFn !== fn) { + newFn.toString = () => fn.toString(); + } + return newFn; }); diff --git a/packages/babel-traverse/test/__snapshots__/scope.js.snap b/packages/babel-traverse/test/__snapshots__/scope.js.snap index 631ca61d5af7..a7b6a4d195df 100644 --- a/packages/babel-traverse/test/__snapshots__/scope.js.snap +++ b/packages/babel-traverse/test/__snapshots__/scope.js.snap @@ -4,8 +4,12 @@ exports[`scope duplicate bindings catch const 1`] = `"Duplicate declaration \\"e exports[`scope duplicate bindings catch let 1`] = `"Duplicate declaration \\"e\\""`; +exports[`scope duplicate bindings global class/const 1`] = `"Duplicate declaration \\"foo\\""`; + exports[`scope duplicate bindings global class/function 1`] = `"Duplicate declaration \\"foo\\""`; +exports[`scope duplicate bindings global class/let 1`] = `"Duplicate declaration \\"foo\\""`; + exports[`scope duplicate bindings global const/class 1`] = `"Duplicate declaration \\"foo\\""`; exports[`scope duplicate bindings global const/const 1`] = `"Duplicate declaration \\"foo\\""`; @@ -16,10 +20,18 @@ exports[`scope duplicate bindings global const/let 1`] = `"Duplicate declaration exports[`scope duplicate bindings global const/var 1`] = `"Duplicate declaration \\"foo\\""`; +exports[`scope duplicate bindings global function/class 1`] = `"Duplicate declaration \\"foo\\""`; + +exports[`scope duplicate bindings global function/let 1`] = `"Duplicate declaration \\"foo\\""`; + exports[`scope duplicate bindings global let/class 1`] = `"Duplicate declaration \\"foo\\""`; +exports[`scope duplicate bindings global let/const 1`] = `"Duplicate declaration \\"foo\\""`; + exports[`scope duplicate bindings global let/function 1`] = `"Duplicate declaration \\"foo\\""`; exports[`scope duplicate bindings global let/let 1`] = `"Duplicate declaration \\"foo\\""`; exports[`scope duplicate bindings global let/var 1`] = `"Duplicate declaration \\"foo\\""`; + +exports[`scope duplicate bindings global var/let 1`] = `"Duplicate declaration \\"foo\\""`; diff --git a/packages/babel-traverse/test/arrow-transform.js b/packages/babel-traverse/test/arrow-transform.js index f21ba52ac3ec..fdeeb4bd66de 100644 --- a/packages/babel-traverse/test/arrow-transform.js +++ b/packages/babel-traverse/test/arrow-transform.js @@ -539,7 +539,7 @@ describe("arrow function conversion", () => { ); }); - it("should convert super.prop() calls", () => { + it("should convert super.prop() calls without params", () => { assertConversion( ` () => { @@ -549,10 +549,11 @@ describe("arrow function conversion", () => { () => super.foo(); `, ` - var _superprop_callFoo = (..._args) => super.foo(..._args); + var _superprop_getFoo = () => super.foo, + _this = this; (function () { - _superprop_callFoo(); + _superprop_getFoo().call(_this); }); super.foo(); () => super.foo(); @@ -560,6 +561,28 @@ describe("arrow function conversion", () => { ); }); + it("should convert super.prop() calls with params", () => { + assertConversion( + ` + () => { + super.foo(a, b, ...c); + }; + super.foo(a, b, ...c); + () => super.foo(a, b, ...c); + `, + ` + var _superprop_getFoo = () => super.foo, + _this = this; + + (function () { + _superprop_getFoo().call(_this, a, b, ...c); + }); + super.foo(a, b, ...c); + () => super.foo(a, b, ...c); + `, + ); + }); + it("should convert super[prop]() calls", () => { assertConversion( ` @@ -570,10 +593,11 @@ describe("arrow function conversion", () => { () => super[foo](); `, ` - var _superprop_call = (_prop, ..._args) => super[_prop](..._args); + var _superprop_get = _prop => super[_prop], + _this = this; (function () { - _superprop_call(foo); + _superprop_get(foo).call(_this); }); super[foo](); () => super[foo](); diff --git a/packages/babel-traverse/test/fixtures/rename/parameter-default-1/input.js b/packages/babel-traverse/test/fixtures/rename/parameter-default-1/input.js new file mode 100644 index 000000000000..c40f808feb63 --- /dev/null +++ b/packages/babel-traverse/test/fixtures/rename/parameter-default-1/input.js @@ -0,0 +1,7 @@ +let a = "outside"; + +function f(g = () => a) { + let a = "inside"; + return g(); +} + diff --git a/packages/babel-traverse/test/fixtures/rename/parameter-default-1/options.json b/packages/babel-traverse/test/fixtures/rename/parameter-default-1/options.json new file mode 100644 index 000000000000..14af0e5feac8 --- /dev/null +++ b/packages/babel-traverse/test/fixtures/rename/parameter-default-1/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["./plugin"] +} diff --git a/packages/babel-traverse/test/fixtures/rename/parameter-default-1/output.js b/packages/babel-traverse/test/fixtures/rename/parameter-default-1/output.js new file mode 100644 index 000000000000..32d258e83c15 --- /dev/null +++ b/packages/babel-traverse/test/fixtures/rename/parameter-default-1/output.js @@ -0,0 +1,6 @@ +let a = "outside"; + +function f(g = () => a) { + let z = "inside"; + return g(); +} diff --git a/packages/babel-traverse/test/fixtures/rename/parameter-default-1/plugin.js b/packages/babel-traverse/test/fixtures/rename/parameter-default-1/plugin.js new file mode 100644 index 000000000000..830481588123 --- /dev/null +++ b/packages/babel-traverse/test/fixtures/rename/parameter-default-1/plugin.js @@ -0,0 +1,9 @@ +module.exports = function() { + return { + visitor: { + FunctionDeclaration(path) { + path.scope.rename("a", "z"); + } + } + }; +}; diff --git a/packages/babel-traverse/test/fixtures/rename/parameter-default-10/input.js b/packages/babel-traverse/test/fixtures/rename/parameter-default-10/input.js new file mode 100644 index 000000000000..60898eb184b6 --- /dev/null +++ b/packages/babel-traverse/test/fixtures/rename/parameter-default-10/input.js @@ -0,0 +1,5 @@ +let a = "outside"; + +function r({ a: b }, { [a]: { c } = a }) { + g(a); +} diff --git a/packages/babel-traverse/test/fixtures/rename/parameter-default-10/options.json b/packages/babel-traverse/test/fixtures/rename/parameter-default-10/options.json new file mode 100644 index 000000000000..14af0e5feac8 --- /dev/null +++ b/packages/babel-traverse/test/fixtures/rename/parameter-default-10/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["./plugin"] +} diff --git a/packages/babel-traverse/test/fixtures/rename/parameter-default-10/output.js b/packages/babel-traverse/test/fixtures/rename/parameter-default-10/output.js new file mode 100644 index 000000000000..91af3aed8340 --- /dev/null +++ b/packages/babel-traverse/test/fixtures/rename/parameter-default-10/output.js @@ -0,0 +1,11 @@ +let z = "outside"; + +function r({ + a: b +}, { + [z]: { + c + } = z +}) { + g(z); +} diff --git a/packages/babel-traverse/test/fixtures/rename/parameter-default-10/plugin.js b/packages/babel-traverse/test/fixtures/rename/parameter-default-10/plugin.js new file mode 100644 index 000000000000..830481588123 --- /dev/null +++ b/packages/babel-traverse/test/fixtures/rename/parameter-default-10/plugin.js @@ -0,0 +1,9 @@ +module.exports = function() { + return { + visitor: { + FunctionDeclaration(path) { + path.scope.rename("a", "z"); + } + } + }; +}; diff --git a/packages/babel-traverse/test/fixtures/rename/parameter-default-2/input.js b/packages/babel-traverse/test/fixtures/rename/parameter-default-2/input.js new file mode 100644 index 000000000000..f80651d80616 --- /dev/null +++ b/packages/babel-traverse/test/fixtures/rename/parameter-default-2/input.js @@ -0,0 +1,5 @@ +let a = "outside"; + +function h(a, g = () => a) { + return g(); +} diff --git a/packages/babel-traverse/test/fixtures/rename/parameter-default-2/options.json b/packages/babel-traverse/test/fixtures/rename/parameter-default-2/options.json new file mode 100644 index 000000000000..14af0e5feac8 --- /dev/null +++ b/packages/babel-traverse/test/fixtures/rename/parameter-default-2/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["./plugin"] +} diff --git a/packages/babel-traverse/test/fixtures/rename/parameter-default-2/output.js b/packages/babel-traverse/test/fixtures/rename/parameter-default-2/output.js new file mode 100644 index 000000000000..dd64606a5b19 --- /dev/null +++ b/packages/babel-traverse/test/fixtures/rename/parameter-default-2/output.js @@ -0,0 +1,5 @@ +let a = "outside"; + +function h(z, g = () => z) { + return g(); +} diff --git a/packages/babel-traverse/test/fixtures/rename/parameter-default-2/plugin.js b/packages/babel-traverse/test/fixtures/rename/parameter-default-2/plugin.js new file mode 100644 index 000000000000..830481588123 --- /dev/null +++ b/packages/babel-traverse/test/fixtures/rename/parameter-default-2/plugin.js @@ -0,0 +1,9 @@ +module.exports = function() { + return { + visitor: { + FunctionDeclaration(path) { + path.scope.rename("a", "z"); + } + } + }; +}; diff --git a/packages/babel-traverse/test/fixtures/rename/parameter-default-3/input.js b/packages/babel-traverse/test/fixtures/rename/parameter-default-3/input.js new file mode 100644 index 000000000000..a6a4bdd4c336 --- /dev/null +++ b/packages/babel-traverse/test/fixtures/rename/parameter-default-3/input.js @@ -0,0 +1,6 @@ +let a = "outside"; + +function j(g = a) { + let a = "inside"; + return g; +} diff --git a/packages/babel-traverse/test/fixtures/rename/parameter-default-3/options.json b/packages/babel-traverse/test/fixtures/rename/parameter-default-3/options.json new file mode 100644 index 000000000000..14af0e5feac8 --- /dev/null +++ b/packages/babel-traverse/test/fixtures/rename/parameter-default-3/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["./plugin"] +} diff --git a/packages/babel-traverse/test/fixtures/rename/parameter-default-3/output.js b/packages/babel-traverse/test/fixtures/rename/parameter-default-3/output.js new file mode 100644 index 000000000000..a5cb0dab0cc3 --- /dev/null +++ b/packages/babel-traverse/test/fixtures/rename/parameter-default-3/output.js @@ -0,0 +1,6 @@ +let a = "outside"; + +function j(g = a) { + let z = "inside"; + return g; +} diff --git a/packages/babel-traverse/test/fixtures/rename/parameter-default-3/plugin.js b/packages/babel-traverse/test/fixtures/rename/parameter-default-3/plugin.js new file mode 100644 index 000000000000..830481588123 --- /dev/null +++ b/packages/babel-traverse/test/fixtures/rename/parameter-default-3/plugin.js @@ -0,0 +1,9 @@ +module.exports = function() { + return { + visitor: { + FunctionDeclaration(path) { + path.scope.rename("a", "z"); + } + } + }; +}; diff --git a/packages/babel-traverse/test/fixtures/rename/parameter-default-4/input.js b/packages/babel-traverse/test/fixtures/rename/parameter-default-4/input.js new file mode 100644 index 000000000000..0f7ddb008ef1 --- /dev/null +++ b/packages/babel-traverse/test/fixtures/rename/parameter-default-4/input.js @@ -0,0 +1,8 @@ +let a = "outside"; + +function k([{ + g = a +}]) { + let a = "inside"; + return g; +} diff --git a/packages/babel-traverse/test/fixtures/rename/parameter-default-4/options.json b/packages/babel-traverse/test/fixtures/rename/parameter-default-4/options.json new file mode 100644 index 000000000000..14af0e5feac8 --- /dev/null +++ b/packages/babel-traverse/test/fixtures/rename/parameter-default-4/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["./plugin"] +} diff --git a/packages/babel-traverse/test/fixtures/rename/parameter-default-4/output.js b/packages/babel-traverse/test/fixtures/rename/parameter-default-4/output.js new file mode 100644 index 000000000000..65ab1aa82f5f --- /dev/null +++ b/packages/babel-traverse/test/fixtures/rename/parameter-default-4/output.js @@ -0,0 +1,8 @@ +let a = "outside"; + +function k([{ + g = a +}]) { + let z = "inside"; + return g; +} diff --git a/packages/babel-traverse/test/fixtures/rename/parameter-default-4/plugin.js b/packages/babel-traverse/test/fixtures/rename/parameter-default-4/plugin.js new file mode 100644 index 000000000000..830481588123 --- /dev/null +++ b/packages/babel-traverse/test/fixtures/rename/parameter-default-4/plugin.js @@ -0,0 +1,9 @@ +module.exports = function() { + return { + visitor: { + FunctionDeclaration(path) { + path.scope.rename("a", "z"); + } + } + }; +}; diff --git a/packages/babel-traverse/test/fixtures/rename/parameter-default-5/input.js b/packages/babel-traverse/test/fixtures/rename/parameter-default-5/input.js new file mode 100644 index 000000000000..9586b93c5fcb --- /dev/null +++ b/packages/babel-traverse/test/fixtures/rename/parameter-default-5/input.js @@ -0,0 +1,8 @@ +let a = "outside"; + +function f([{ + [a]: g +}]) { + let a = "inside"; + return g; +} diff --git a/packages/babel-traverse/test/fixtures/rename/parameter-default-5/options.json b/packages/babel-traverse/test/fixtures/rename/parameter-default-5/options.json new file mode 100644 index 000000000000..14af0e5feac8 --- /dev/null +++ b/packages/babel-traverse/test/fixtures/rename/parameter-default-5/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["./plugin"] +} diff --git a/packages/babel-traverse/test/fixtures/rename/parameter-default-5/output.js b/packages/babel-traverse/test/fixtures/rename/parameter-default-5/output.js new file mode 100644 index 000000000000..f703a83d601b --- /dev/null +++ b/packages/babel-traverse/test/fixtures/rename/parameter-default-5/output.js @@ -0,0 +1,8 @@ +let a = "outside"; + +function f([{ + [a]: g +}]) { + let z = "inside"; + return g; +} diff --git a/packages/babel-traverse/test/fixtures/rename/parameter-default-5/plugin.js b/packages/babel-traverse/test/fixtures/rename/parameter-default-5/plugin.js new file mode 100644 index 000000000000..830481588123 --- /dev/null +++ b/packages/babel-traverse/test/fixtures/rename/parameter-default-5/plugin.js @@ -0,0 +1,9 @@ +module.exports = function() { + return { + visitor: { + FunctionDeclaration(path) { + path.scope.rename("a", "z"); + } + } + }; +}; diff --git a/packages/babel-traverse/test/fixtures/rename/parameter-default-6/input.js b/packages/babel-traverse/test/fixtures/rename/parameter-default-6/input.js new file mode 100644 index 000000000000..d33571e9a053 --- /dev/null +++ b/packages/babel-traverse/test/fixtures/rename/parameter-default-6/input.js @@ -0,0 +1,5 @@ +let a = "outside"; + +function n(g = (a = a) => {}) { + let a = "inside"; +} diff --git a/packages/babel-traverse/test/fixtures/rename/parameter-default-6/options.json b/packages/babel-traverse/test/fixtures/rename/parameter-default-6/options.json new file mode 100644 index 000000000000..14af0e5feac8 --- /dev/null +++ b/packages/babel-traverse/test/fixtures/rename/parameter-default-6/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["./plugin"] +} diff --git a/packages/babel-traverse/test/fixtures/rename/parameter-default-6/output.js b/packages/babel-traverse/test/fixtures/rename/parameter-default-6/output.js new file mode 100644 index 000000000000..917b0bb1c749 --- /dev/null +++ b/packages/babel-traverse/test/fixtures/rename/parameter-default-6/output.js @@ -0,0 +1,5 @@ +let a = "outside"; + +function n(g = (a = a) => {}) { + let z = "inside"; +} diff --git a/packages/babel-traverse/test/fixtures/rename/parameter-default-6/plugin.js b/packages/babel-traverse/test/fixtures/rename/parameter-default-6/plugin.js new file mode 100644 index 000000000000..830481588123 --- /dev/null +++ b/packages/babel-traverse/test/fixtures/rename/parameter-default-6/plugin.js @@ -0,0 +1,9 @@ +module.exports = function() { + return { + visitor: { + FunctionDeclaration(path) { + path.scope.rename("a", "z"); + } + } + }; +}; diff --git a/packages/babel-traverse/test/fixtures/rename/parameter-default-7/input.js b/packages/babel-traverse/test/fixtures/rename/parameter-default-7/input.js new file mode 100644 index 000000000000..273324bf46df --- /dev/null +++ b/packages/babel-traverse/test/fixtures/rename/parameter-default-7/input.js @@ -0,0 +1,5 @@ +let a = "outside"; + +function n(a, g = (a = a) => {}) { + a = "inside"; +} diff --git a/packages/babel-traverse/test/fixtures/rename/parameter-default-7/options.json b/packages/babel-traverse/test/fixtures/rename/parameter-default-7/options.json new file mode 100644 index 000000000000..14af0e5feac8 --- /dev/null +++ b/packages/babel-traverse/test/fixtures/rename/parameter-default-7/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["./plugin"] +} diff --git a/packages/babel-traverse/test/fixtures/rename/parameter-default-7/output.js b/packages/babel-traverse/test/fixtures/rename/parameter-default-7/output.js new file mode 100644 index 000000000000..5d6b37398318 --- /dev/null +++ b/packages/babel-traverse/test/fixtures/rename/parameter-default-7/output.js @@ -0,0 +1,5 @@ +let a = "outside"; + +function n(z, g = (a = a) => {}) { + z = "inside"; +} diff --git a/packages/babel-traverse/test/fixtures/rename/parameter-default-7/plugin.js b/packages/babel-traverse/test/fixtures/rename/parameter-default-7/plugin.js new file mode 100644 index 000000000000..830481588123 --- /dev/null +++ b/packages/babel-traverse/test/fixtures/rename/parameter-default-7/plugin.js @@ -0,0 +1,9 @@ +module.exports = function() { + return { + visitor: { + FunctionDeclaration(path) { + path.scope.rename("a", "z"); + } + } + }; +}; diff --git a/packages/babel-traverse/test/fixtures/rename/parameter-default-8/input.js b/packages/babel-traverse/test/fixtures/rename/parameter-default-8/input.js new file mode 100644 index 000000000000..3349776fcb77 --- /dev/null +++ b/packages/babel-traverse/test/fixtures/rename/parameter-default-8/input.js @@ -0,0 +1,5 @@ +let a = "outside"; + +function q(a, g = (b = a) => b) { + g(a); +} diff --git a/packages/babel-traverse/test/fixtures/rename/parameter-default-8/options.json b/packages/babel-traverse/test/fixtures/rename/parameter-default-8/options.json new file mode 100644 index 000000000000..14af0e5feac8 --- /dev/null +++ b/packages/babel-traverse/test/fixtures/rename/parameter-default-8/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["./plugin"] +} diff --git a/packages/babel-traverse/test/fixtures/rename/parameter-default-8/output.js b/packages/babel-traverse/test/fixtures/rename/parameter-default-8/output.js new file mode 100644 index 000000000000..3894a8a76152 --- /dev/null +++ b/packages/babel-traverse/test/fixtures/rename/parameter-default-8/output.js @@ -0,0 +1,5 @@ +let a = "outside"; + +function q(z, g = (b = z) => b) { + g(z); +} diff --git a/packages/babel-traverse/test/fixtures/rename/parameter-default-8/plugin.js b/packages/babel-traverse/test/fixtures/rename/parameter-default-8/plugin.js new file mode 100644 index 000000000000..830481588123 --- /dev/null +++ b/packages/babel-traverse/test/fixtures/rename/parameter-default-8/plugin.js @@ -0,0 +1,9 @@ +module.exports = function() { + return { + visitor: { + FunctionDeclaration(path) { + path.scope.rename("a", "z"); + } + } + }; +}; diff --git a/packages/babel-traverse/test/fixtures/rename/parameter-default-9/input.js b/packages/babel-traverse/test/fixtures/rename/parameter-default-9/input.js new file mode 100644 index 000000000000..4a57005f1db1 --- /dev/null +++ b/packages/babel-traverse/test/fixtures/rename/parameter-default-9/input.js @@ -0,0 +1,5 @@ +let a = "outside"; + +function r(a, g = (a, b = a) => a) { + g(a); +} diff --git a/packages/babel-traverse/test/fixtures/rename/parameter-default-9/options.json b/packages/babel-traverse/test/fixtures/rename/parameter-default-9/options.json new file mode 100644 index 000000000000..14af0e5feac8 --- /dev/null +++ b/packages/babel-traverse/test/fixtures/rename/parameter-default-9/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["./plugin"] +} diff --git a/packages/babel-traverse/test/fixtures/rename/parameter-default-9/output.js b/packages/babel-traverse/test/fixtures/rename/parameter-default-9/output.js new file mode 100644 index 000000000000..886bfcd11375 --- /dev/null +++ b/packages/babel-traverse/test/fixtures/rename/parameter-default-9/output.js @@ -0,0 +1,5 @@ +let a = "outside"; + +function r(z, g = (a, b = a) => a) { + g(z); +} diff --git a/packages/babel-traverse/test/fixtures/rename/parameter-default-9/plugin.js b/packages/babel-traverse/test/fixtures/rename/parameter-default-9/plugin.js new file mode 100644 index 000000000000..830481588123 --- /dev/null +++ b/packages/babel-traverse/test/fixtures/rename/parameter-default-9/plugin.js @@ -0,0 +1,9 @@ +module.exports = function() { + return { + visitor: { + FunctionDeclaration(path) { + path.scope.rename("a", "z"); + } + } + }; +}; diff --git a/packages/babel-traverse/test/fixtures/type-reference/input.ts b/packages/babel-traverse/test/fixtures/type-reference/input.ts new file mode 100644 index 000000000000..9fc2c011bd9c --- /dev/null +++ b/packages/babel-traverse/test/fixtures/type-reference/input.ts @@ -0,0 +1,13 @@ +function foo() { + const x = 1 ? a() : b(); + + return [...x]; +} + +function a(): number[] { + return []; +} + +function b(): number[] { + return []; +} diff --git a/packages/babel-traverse/test/fixtures/type-reference/options.json b/packages/babel-traverse/test/fixtures/type-reference/options.json new file mode 100644 index 000000000000..f809bfc203e2 --- /dev/null +++ b/packages/babel-traverse/test/fixtures/type-reference/options.json @@ -0,0 +1,4 @@ +{ + "plugins": ["transform-spread"], + "presets": ["typescript"] +} diff --git a/packages/babel-traverse/test/removal.js b/packages/babel-traverse/test/removal.js index f500eb37ddd0..46ad1a438ca9 100644 --- a/packages/babel-traverse/test/removal.js +++ b/packages/babel-traverse/test/removal.js @@ -33,4 +33,16 @@ describe("removal", function() { expect(generateCode(rootPath)).toBe("x = () => {};"); }); }); + + it("remove with noScope", function() { + const ast = parse("a=1"); + traverse(ast, { + AssignmentExpression: function(path) { + path.remove(); + }, + noScope: true, + }); + + expect(generate(ast).code).toBe(""); + }); }); diff --git a/packages/babel-traverse/test/replacement.js b/packages/babel-traverse/test/replacement.js index 3454937fe506..6d54972611f2 100644 --- a/packages/babel-traverse/test/replacement.js +++ b/packages/babel-traverse/test/replacement.js @@ -1,5 +1,6 @@ import traverse from "../lib"; import { parse } from "@babel/parser"; +import generate from "@babel/generator"; import * as t from "@babel/types"; describe("path/replacement", function() { @@ -97,4 +98,19 @@ describe("path/replacement", function() { ); }); }); + describe("replaceWithMultiple", () => { + it("does not add extra parentheses for a JSXElement with a JSXElement parent", () => { + const ast = parse(`

`, { + plugins: ["jsx"], + }); + traverse(ast, { + JSXElement: path => { + if (path.node.openingElement.name.name === "span") { + path.replaceWithMultiple(path.node.children.filter(t.isJSXElement)); + } + }, + }); + expect(generate(ast).code).toBe("

;"); + }); + }); }); diff --git a/packages/babel-traverse/test/scope.js b/packages/babel-traverse/test/scope.js index aa7c0dba2752..d62675a5b51a 100644 --- a/packages/babel-traverse/test/scope.js +++ b/packages/babel-traverse/test/scope.js @@ -73,6 +73,25 @@ describe("scope", () => { ).toBe("Identifier"); }); + describe("function parameter expression", function() { + it("should not have visibility of declarations inside function body", () => { + expect( + getPath( + `var a = "outside"; (function foo(b = a) { let a = "inside" })`, + ) + .get("body.1.expression.params.0") + .scope.getBinding("a").path.node.init.value, + ).toBe("outside"); + }); + it("should have visibility on parameter bindings", () => { + expect( + getPath(`var a = "outside"; (function foo(b = a, a = "inside") {})`) + .get("body.1.expression.params.0") + .scope.getBinding("a").path.node.right.value, + ).toBe("inside"); + }); + }); + it("variable declaration", function() { expect(getPath("var foo = null;").scope.getBinding("foo").path.type).toBe( "VariableDeclarator", @@ -184,11 +203,17 @@ describe("scope", () => { it("purity", function() { expect( - getPath("({ x: 1 })") + getPath("({ x: 1, foo() { return 1 } })") .get("body")[0] .get("expression") .isPure(), ).toBeTruthy(); + expect( + getPath("class X { get foo() { return 1 } }") + .get("body")[0] + .get("expression") + .isPure(), + ).toBeFalsy(); expect( getPath("`${a}`") .get("body")[0] @@ -270,6 +295,74 @@ describe("scope", () => { column: 32, }); }); + + it("class identifier available in class scope after crawl", function() { + const path = getPath("class a { build() { return new a(); } }"); + + path.scope.crawl(); + + let referencePaths = path.scope.bindings.a.referencePaths; + expect(referencePaths).toHaveLength(1); + + referencePaths = path.get("body[0]").scope.bindings.a.referencePaths; + expect(referencePaths).toHaveLength(1); + + expect(path.scope.bindings.a).toBe(path.get("body[0]").scope.bindings.a); + }); + + it("references after re-crawling", function() { + const path = getPath("function Foo() { var _jsx; }"); + + path.scope.crawl(); + path.scope.crawl(); + + expect(path.scope.references._jsx).toBeTruthy(); + }); + + test("generateUid collision check after re-crawling", function() { + const path = getPath("function Foo() { var _jsx; }"); + + path.scope.crawl(); + path.scope.crawl(); + + expect(path.scope.generateUid("jsx")).toBe("_jsx2"); + }); + + test("generateUid collision check after re-crawling (function expression local id)", function() { + const path = getPath("var fn = function _name(){}"); + + path.scope.crawl(); + path.scope.crawl(); + + expect(path.scope.generateUid("name")).toBe("_name2"); + }); + + test("generateUid collision check after re-crawling (function params)", function() { + const path = getPath("[].map(_unicorn => [_unicorn])"); + + path.scope.crawl(); + path.scope.crawl(); + + expect(path.scope.generateUid("unicorn")).toBe("_unicorn2"); + }); + + test("generateUid collision check after re-crawling (catch clause)", function() { + const path = getPath("try {} catch (_err) {}"); + + path.scope.crawl(); + path.scope.crawl(); + + expect(path.scope.generateUid("err")).toBe("_err2"); + }); + + test("generateUid collision check after re-crawling (class expression local id)", function() { + const path = getPath("var C = class _Cls{}"); + + path.scope.crawl(); + path.scope.crawl(); + + expect(path.scope.generateUid("Cls")).toBe("_Cls2"); + }); }); describe("duplicate bindings", () => { @@ -389,7 +482,11 @@ describe("scope", () => { } }); - /*if (kind1 !== kind2) { + if (kind1 !== kind2) { + //todo: remove the if whitelist + if (kind1 === "const" && (kind2 === "function" || kind2 === "var")) { + continue; + } it(`${kind2}/${kind1}`, () => { const ast = createAST(kind2, kind1); @@ -399,7 +496,7 @@ describe("scope", () => { expect(() => getPath(ast)).toThrowErrorMatchingSnapshot(); } }); - }*/ + } } }); }); diff --git a/packages/babel-traverse/test/traverse.js b/packages/babel-traverse/test/traverse.js index a4b391c0b2fa..3d21529cea1c 100644 --- a/packages/babel-traverse/test/traverse.js +++ b/packages/babel-traverse/test/traverse.js @@ -1,6 +1,7 @@ import cloneDeep from "lodash/cloneDeep"; import traverse from "../lib"; import { parse } from "@babel/parser"; +import * as t from "@babel/types"; describe("traverse", function() { const code = ` @@ -174,4 +175,46 @@ describe("traverse", function() { expect(p).not.toBe(scopes[i]); }); }); + + describe("path.skip()", function() { + it("replaced paths can be skipped", function() { + const ast = parse("id"); + + let skipped; + traverse(ast, { + noScope: true, + Identifier(path) { + path.replaceWith(t.numericLiteral(0)); + path.skip(); + skipped = true; + }, + NumericLiteral() { + skipped = false; + }, + }); + + expect(skipped).toBe(true); + }); + + // Skipped: see the comment in the `NodePath.requeue` method. + // eslint-disable-next-line jest/no-disabled-tests + it.skip("skipped and requeued paths should be visited", function() { + const ast = parse("id"); + + let visited = false; + traverse(ast, { + noScope: true, + Identifier(path) { + path.replaceWith(t.numericLiteral(0)); + path.skip(); + path.requeue(); + }, + NumericLiteral() { + visited = true; + }, + }); + + expect(visited).toBe(true); + }); + }); }); diff --git a/packages/babel-types/package.json b/packages/babel-types/package.json index 66694f3b90f6..1720c7c3586a 100644 --- a/packages/babel-types/package.json +++ b/packages/babel-types/package.json @@ -1,20 +1,23 @@ { "name": "@babel/types", - "version": "7.5.5", + "version": "7.9.5", "description": "Babel Types is a Lodash-esque utility library for AST nodes", "author": "Sebastian McKenzie ", "homepage": "https://babeljs.io/", "license": "MIT", + "publishConfig": { + "access": "public" + }, "repository": "https://github.com/babel/babel/tree/master/packages/babel-types", "main": "lib/index.js", "types": "lib/index.d.ts", "dependencies": { - "esutils": "^2.0.2", + "@babel/helper-validator-identifier": "^7.9.5", "lodash": "^4.17.13", "to-fast-properties": "^2.0.0" }, "devDependencies": { - "@babel/generator": "^7.5.5", - "@babel/parser": "^7.5.5" + "@babel/generator": "^7.9.5", + "@babel/parser": "^7.9.0" } } diff --git a/packages/babel-types/scripts/generators/docs.js b/packages/babel-types/scripts/generators/docs.js index 3bbb52362400..340dbbc11315 100644 --- a/packages/babel-types/scripts/generators/docs.js +++ b/packages/babel-types/scripts/generators/docs.js @@ -101,8 +101,12 @@ Object.keys(types.BUILDER_KEYS) } if (defaultValue !== null || types.NODE_FIELDS[key][field].optional) { fieldDescription.push( - " (default: `" + util.inspect(defaultValue) + "`)" + " (default: `" + util.inspect(defaultValue) + "`" ); + if (types.BUILDER_KEYS[key].indexOf(field) < 0) { + fieldDescription.push(", excluded from builder function"); + } + fieldDescription.push(")"); } else { fieldDescription.push(" (required)"); } diff --git a/packages/babel-types/scripts/generators/flow.js b/packages/babel-types/scripts/generators/flow.js index daab2411d742..58c1a1614aa1 100644 --- a/packages/babel-types/scripts/generators/flow.js +++ b/packages/babel-types/scripts/generators/flow.js @@ -54,6 +54,7 @@ for (const type in t.NODE_FIELDS) { const struct = ['type: "' + type + '";']; const args = []; + const builderNames = t.BUILDER_KEYS[type]; Object.keys(t.NODE_FIELDS[type]) .sort((fieldA, fieldB) => { @@ -80,8 +81,9 @@ for (const type in t.NODE_FIELDS) { if (typeAnnotation) { suffix += ": " + typeAnnotation; } - - args.push(t.toBindingIdentifierName(fieldName) + suffix); + if (builderNames.includes(fieldName)) { + args.push(t.toBindingIdentifierName(fieldName) + suffix); + } if (t.isValidIdentifier(fieldName)) { struct.push(fieldName + suffix + ";"); @@ -99,13 +101,19 @@ for (const type in t.NODE_FIELDS) { ", " )}): ${NODE_PREFIX}${type};` ); + } else { + const functionName = toFunctionName(type); + lines.push( + `declare function _${functionName}(${args.join( + ", " + )}): ${NODE_PREFIX}${type};`, + `declare export { _${functionName} as ${functionName} }` + ); } } for (let i = 0; i < t.TYPES.length; i++) { - let decl = `declare function is${ - t.TYPES[i] - }(node: ?Object, opts?: ?Object): boolean`; + let decl = `declare function is${t.TYPES[i]}(node: ?Object, opts?: ?Object): boolean`; if (t.NODE_FIELDS[t.TYPES[i]]) { decl += ` %checks (node instanceof ${NODE_PREFIX}${t.TYPES[i]})`; @@ -115,11 +123,72 @@ for (let i = 0; i < t.TYPES.length; i++) { } lines.push( - `declare function validate(n: BabelNode, key: string, value: mixed): void;`, + // builders/ + // eslint-disable-next-line max-len + `declare function createTypeAnnotationBasedOnTypeof(type: 'string' | 'number' | 'undefined' | 'boolean' | 'function' | 'object' | 'symbol'): ${NODE_PREFIX}TypeAnnotation`, + // eslint-disable-next-line max-len + `declare function createUnionTypeAnnotation(types: Array<${NODE_PREFIX}FlowType>): ${NODE_PREFIX}UnionTypeAnnotation`, + // eslint-disable-next-line max-len + `declare function createFlowUnionType(types: Array<${NODE_PREFIX}FlowType>): ${NODE_PREFIX}UnionTypeAnnotation`, + // this smells like "internal API" + // eslint-disable-next-line max-len + `declare function buildChildren(node: { children: Array<${NODE_PREFIX}JSXText | ${NODE_PREFIX}JSXExpressionContainer | ${NODE_PREFIX}JSXSpreadChild | ${NODE_PREFIX}JSXElement | ${NODE_PREFIX}JSXFragment | ${NODE_PREFIX}JSXEmptyExpression> }): Array<${NODE_PREFIX}JSXText | ${NODE_PREFIX}JSXExpressionContainer | ${NODE_PREFIX}JSXSpreadChild | ${NODE_PREFIX}JSXElement | ${NODE_PREFIX}JSXFragment>`, + + // clone/ `declare function clone(n: T): T;`, `declare function cloneDeep(n: T): T;`, + `declare function cloneDeepWithoutLoc(n: T): T;`, + `declare function cloneNode(n: T, deep?: boolean, withoutLoc?: boolean): T;`, + `declare function cloneWithoutLoc(n: T): T;`, + + // comments/ + `declare type CommentTypeShorthand = 'leading' | 'inner' | 'trailing'`, + // eslint-disable-next-line max-len + `declare function addComment(node: T, type: CommentTypeShorthand, content: string, line?: boolean): T`, + // eslint-disable-next-line max-len + `declare function addComments(node: T, type: CommentTypeShorthand, comments: Array): T`, + `declare function inheritInnerComments(node: Node, parent: Node): void`, + `declare function inheritLeadingComments(node: Node, parent: Node): void`, + `declare function inheritsComments(node: T, parent: Node): void`, + `declare function inheritTrailingComments(node: Node, parent: Node): void`, + `declare function removeComments(node: T): T`, + + // converters/ + `declare function ensureBlock(node: ${NODE_PREFIX}, key: string): ${NODE_PREFIX}BlockStatement`, + `declare function toBindingIdentifierName(name?: ?string): string`, + // eslint-disable-next-line max-len + `declare function toBlock(node: ${NODE_PREFIX}Statement | ${NODE_PREFIX}Expression, parent?: ${NODE_PREFIX}Function | null): ${NODE_PREFIX}BlockStatement`, + // eslint-disable-next-line max-len + `declare function toComputedKey(node: ${NODE_PREFIX}Method | ${NODE_PREFIX}Property, key?: ${NODE_PREFIX}Expression | ${NODE_PREFIX}Identifier): ${NODE_PREFIX}Expression`, + // eslint-disable-next-line max-len + `declare function toExpression(node: ${NODE_PREFIX}ExpressionStatement | ${NODE_PREFIX}Expression | ${NODE_PREFIX}Class | ${NODE_PREFIX}Function): ${NODE_PREFIX}Expression`, + `declare function toIdentifier(name?: ?string): string`, + // eslint-disable-next-line max-len + `declare function toKeyAlias(node: ${NODE_PREFIX}Method | ${NODE_PREFIX}Property, key?: ${NODE_PREFIX}): string`, + // toSequenceExpression relies on types that aren't declared in flow + // eslint-disable-next-line max-len + `declare function toStatement(node: ${NODE_PREFIX}Statement | ${NODE_PREFIX}Class | ${NODE_PREFIX}Function | ${NODE_PREFIX}AssignmentExpression, ignore?: boolean): ${NODE_PREFIX}Statement | void`, + `declare function valueToNode(value: any): ${NODE_PREFIX}Expression`, + + // modifications/ + // eslint-disable-next-line max-len + `declare function removeTypeDuplicates(types: Array<${NODE_PREFIX}FlowType>): Array<${NODE_PREFIX}FlowType>`, + // eslint-disable-next-line max-len + `declare function appendToMemberExpression(member: ${NODE_PREFIX}MemberExpression, append: ${NODE_PREFIX}, computed?: boolean): ${NODE_PREFIX}MemberExpression`, + // eslint-disable-next-line max-len + `declare function inherits(child: T, parent: ${NODE_PREFIX} | null | void): T`, + // eslint-disable-next-line max-len + `declare function prependToMemberExpression(member: ${NODE_PREFIX}MemberExpression, prepend: ${NODE_PREFIX}Expression): ${NODE_PREFIX}MemberExpression`, `declare function removeProperties(n: T, opts: ?{}): void;`, `declare function removePropertiesDeep(n: T, opts: ?{}): T;`, + + // retrievers/ + // eslint-disable-next-line max-len + `declare function getBindingIdentifiers(node: ${NODE_PREFIX}, duplicates: boolean, outerOnly?: boolean): { [key: string]: ${NODE_PREFIX}Identifier | Array<${NODE_PREFIX}Identifier> }`, + // eslint-disable-next-line max-len + `declare function getOuterBindingIdentifiers(node: Node, duplicates: boolean): { [key: string]: ${NODE_PREFIX}Identifier | Array<${NODE_PREFIX}Identifier> }`, + + // traverse/ `declare type TraversalAncestors = Array<{ node: BabelNode, key: string, @@ -131,7 +200,36 @@ lines.push( exit?: TraversalHandler, };`.replace(/(^|\n) {2}/g, "$1"), // eslint-disable-next-line - `declare function traverse(n: BabelNode, TraversalHandler | TraversalHandlers, state?: T): void;` + `declare function traverse(n: BabelNode, TraversalHandler | TraversalHandlers, state?: T): void;`, + `declare function traverseFast(n: Node, h: TraversalHandler, state?: T): void;`, + + // utils/ + // cleanJSXElementLiteralChild is not exported + // inherit is not exported + `declare function shallowEqual(actual: Object, expected: Object): boolean`, + + // validators/ + // eslint-disable-next-line max-len + `declare function buildMatchMemberExpression(match: string, allowPartial?: boolean): (?BabelNode) => boolean`, + `declare function is(type: string, n: BabelNode, opts: Object): boolean;`, + `declare function isBinding(node: BabelNode, parent: BabelNode, grandparent?: BabelNode): boolean`, + `declare function isBlockScoped(node: BabelNode): boolean`, + `declare function isImmutable(node: BabelNode): boolean`, + `declare function isLet(node: BabelNode): boolean`, + `declare function isNode(node: ?Object): boolean`, + `declare function isNodesEquivalent(a: any, b: any): boolean`, + `declare function isPlaceholderType(placeholderType: string, targetType: string): boolean`, + `declare function isReferenced(node: BabelNode, parent: BabelNode, grandparent?: BabelNode): boolean`, + `declare function isScope(node: BabelNode, parent: BabelNode): boolean`, + `declare function isSpecifierDefault(specifier: BabelNodeModuleSpecifier): boolean`, + `declare function isType(nodetype: ?string, targetType: string): boolean`, + `declare function isValidES3Identifier(name: string): boolean`, + `declare function isValidES3Identifier(name: string): boolean`, + `declare function isValidIdentifier(name: string): boolean`, + `declare function isVar(node: BabelNode): boolean`, + // eslint-disable-next-line max-len + `declare function matchesPattern(node: ?BabelNode, match: string | Array, allowPartial?: boolean): boolean`, + `declare function validate(n: BabelNode, key: string, value: mixed): void;` ); for (const type in t.FLIPPED_ALIAS_KEYS) { diff --git a/packages/babel-types/scripts/generators/generateAsserts.js b/packages/babel-types/scripts/generators/generateAsserts.js index 150e8557c733..26bdb8dccbed 100644 --- a/packages/babel-types/scripts/generators/generateAsserts.js +++ b/packages/babel-types/scripts/generators/generateAsserts.js @@ -18,7 +18,8 @@ import is from "../../validators/is"; function assert(type: string, node: Object, opts?: Object): void { if (!is(type, node, opts)) { throw new Error( - \`Expected type "\${type}" with option \${JSON.stringify(opts)}, but instead got "\${node.type}".\`, + \`Expected type "\${type}" with option \${JSON.stringify((opts: any))}, \` + + \`but instead got "\${node.type}".\`, ); } }\n\n`; diff --git a/packages/babel-types/scripts/generators/typescript.js b/packages/babel-types/scripts/generators/typescript.js index b6019ec37324..ef460a73456e 100644 --- a/packages/babel-types/scripts/generators/typescript.js +++ b/packages/babel-types/scripts/generators/typescript.js @@ -56,30 +56,40 @@ const lines = []; for (const type in t.NODE_FIELDS) { const fields = t.NODE_FIELDS[type]; const fieldNames = sortFieldNames(Object.keys(t.NODE_FIELDS[type]), type); + const builderNames = t.BUILDER_KEYS[type]; const struct = ['type: "' + type + '";']; const args = []; fieldNames.forEach(fieldName => { const field = fields[fieldName]; + // Future / annoying TODO: + // MemberExpression.property, ObjectProperty.key and ObjectMethod.key need special cases; either: + // - convert the declaration to chain() like ClassProperty.key and ClassMethod.key, + // - declare an alias type for valid keys, detect the case and reuse it here, + // - declare a disjoint union with, for example, ObjectPropertyBase, + // ObjectPropertyLiteralKey and ObjectPropertyComputedKey, and declare ObjectProperty + // as "ObjectPropertyBase & (ObjectPropertyLiteralKey | ObjectPropertyComputedKey)" let typeAnnotation = stringifyValidator(field.validate, ""); if (isNullable(field) && !hasDefault(field)) { typeAnnotation += " | null"; } - if (areAllRemainingFieldsNullable(fieldName, fieldNames, fields)) { - args.push( - `${t.toBindingIdentifierName(fieldName)}${ - isNullable(field) ? "?:" : ":" - } ${typeAnnotation}` - ); - } else { - args.push( - `${t.toBindingIdentifierName(fieldName)}: ${typeAnnotation}${ - isNullable(field) ? " | undefined" : "" - }` - ); + if (builderNames.includes(fieldName)) { + if (areAllRemainingFieldsNullable(fieldName, builderNames, fields)) { + args.push( + `${t.toBindingIdentifierName(fieldName)}${ + isNullable(field) ? "?:" : ":" + } ${typeAnnotation}` + ); + } else { + args.push( + `${t.toBindingIdentifierName(fieldName)}: ${typeAnnotation}${ + isNullable(field) ? " | undefined" : "" + }` + ); + } } const alphaNumeric = /^\w+$/; @@ -100,29 +110,125 @@ for (const type in t.NODE_FIELDS) { lines.push( `export function ${toFunctionName(type)}(${args.join(", ")}): ${type};` ); - } -} - -for (let i = 0; i < t.TYPES.length; i++) { - let decl = `export function is${ - t.TYPES[i] - }(node: object | null | undefined, opts?: object | null): `; - - if (t.NODE_FIELDS[t.TYPES[i]]) { - decl += `node is ${t.TYPES[i]};`; - } else if (t.FLIPPED_ALIAS_KEYS[t.TYPES[i]]) { - decl += `node is ${t.TYPES[i]};`; } else { - decl += `boolean;`; + const functionName = toFunctionName(type); + lines.push( + `declare function _${functionName}(${args.join(", ")}): ${type};`, + `export { _${functionName} as ${functionName}}` + ); } +} - lines.push(decl); +for (const typeName of t.TYPES) { + const result = + t.NODE_FIELDS[typeName] || t.FLIPPED_ALIAS_KEYS[typeName] + ? `node is ${typeName}` + : "boolean"; + + lines.push( + `export function is${typeName}(node: object | null | undefined, opts?: object | null): ${result};`, + // TypeScript 3.7: https://github.com/microsoft/TypeScript/pull/32695 will allow assert declarations + // eslint-disable-next-line max-len + `// export function assert${typeName}(node: object | null | undefined, opts?: object | null): asserts ${ + result === "boolean" ? "node" : result + };` + ); } lines.push( - `export function validate(n: Node, key: string, value: any): void;`, + // assert/ + // Commented out as this declaration requires TypeScript 3.7 (what do?) + `// export function assertNode(obj: any): asserts obj is Node`, + + // builders/ + // eslint-disable-next-line max-len + `export function createTypeAnnotationBasedOnTypeof(type: 'string' | 'number' | 'undefined' | 'boolean' | 'function' | 'object' | 'symbol'): StringTypeAnnotation | VoidTypeAnnotation | NumberTypeAnnotation | BooleanTypeAnnotation | GenericTypeAnnotation`, + `export function createUnionTypeAnnotation(types: [T]): T`, + `export function createFlowUnionType(types: [T]): T`, + // this probably misbehaves if there are 0 elements, and it's not a UnionTypeAnnotation if there's only 1 + // it is possible to require "2 or more" for this overload ([T, T, ...T[]]) but it requires typescript 3.0 + `export function createUnionTypeAnnotation(types: ReadonlyArray): UnionTypeAnnotation`, + `export function createFlowUnionType(types: ReadonlyArray): UnionTypeAnnotation`, + // this smells like "internal API" + // eslint-disable-next-line max-len + `export function buildChildren(node: { children: ReadonlyArray }): JSXElement['children']`, + + // clone/ `export function clone(n: T): T;`, `export function cloneDeep(n: T): T;`, + `export function cloneDeepWithoutLoc(n: T): T;`, + `export function cloneNode(n: T, deep?: boolean, withoutLoc?: boolean): T;`, + `export function cloneWithoutLoc(n: T): T;`, + + // comments/ + `export type CommentTypeShorthand = 'leading' | 'inner' | 'trailing'`, + // eslint-disable-next-line max-len + `export function addComment(node: T, type: CommentTypeShorthand, content: string, line?: boolean): T`, + // eslint-disable-next-line max-len + `export function addComments(node: T, type: CommentTypeShorthand, comments: ReadonlyArray): T`, + `export function inheritInnerComments(node: Node, parent: Node): void`, + `export function inheritLeadingComments(node: Node, parent: Node): void`, + `export function inheritsComments(node: T, parent: Node): void`, + `export function inheritTrailingComments(node: Node, parent: Node): void`, + `export function removeComments(node: T): T`, + + // converters/ + // eslint-disable-next-line max-len + `export function ensureBlock(node: Extract): BlockStatement`, + // too complex? + // eslint-disable-next-line max-len + `export function ensureBlock = 'body'>(node: Extract>, key: K): BlockStatement`, + // gatherSequenceExpressions is not exported + `export function toBindingIdentifierName(name: { toString(): string } | null | undefined): string`, + `export function toBlock(node: Statement | Expression, parent?: Function | null): BlockStatement`, + // it is possible for `node` to be an arbitrary object if `key` is always provided, + // but that doesn't look like intended API + // eslint-disable-next-line max-len + `export function toComputedKey>(node: T, key?: Expression | Identifier): Expression`, + `export function toExpression(node: Function): FunctionExpression`, + `export function toExpression(node: Class): ClassExpression`, + `export function toExpression(node: ExpressionStatement | Expression | Class | Function): Expression`, + `export function toIdentifier(name: { toString(): string } | null | undefined): string`, + `export function toKeyAlias(node: Method | Property, key?: Node): string`, + // NOTE: this actually uses Scope from @babel/traverse, but we can't add a dependency on its types, + // as they live in @types. Declare the structural subset that is required. + // eslint-disable-next-line max-len + `export function toSequenceExpression(nodes: ReadonlyArray, scope: { push(value: { id: LVal; kind: 'var'; init?: Expression}): void; buildUndefinedNode(): Node }): SequenceExpression | undefined`, + `export function toStatement(node: AssignmentExpression, ignore?: boolean): ExpressionStatement`, + `export function toStatement(node: Statement | AssignmentExpression, ignore?: boolean): Statement`, + `export function toStatement(node: Class, ignore: true): ClassDeclaration | undefined`, + `export function toStatement(node: Class, ignore?: boolean): ClassDeclaration`, + `export function toStatement(node: Function, ignore: true): FunctionDeclaration | undefined`, + `export function toStatement(node: Function, ignore?: boolean): FunctionDeclaration`, + // eslint-disable-next-line max-len + `export function toStatement(node: Statement | Class | Function | AssignmentExpression, ignore: true): Statement | undefined`, + // eslint-disable-next-line max-len + `export function toStatement(node: Statement | Class | Function | AssignmentExpression, ignore?: boolean): Statement`, + // eslint-disable-next-line max-len + `export function valueToNode(value: undefined): Identifier`, // (should this not be a UnaryExpression to avoid shadowing?) + `export function valueToNode(value: boolean): BooleanLiteral`, + `export function valueToNode(value: null): NullLiteral`, + `export function valueToNode(value: string): StringLiteral`, + // Infinities and NaN need to use a BinaryExpression; negative values must be wrapped in UnaryExpression + `export function valueToNode(value: number): NumericLiteral | BinaryExpression | UnaryExpression`, + `export function valueToNode(value: RegExp): RegExpLiteral`, + // eslint-disable-next-line max-len + `export function valueToNode(value: ReadonlyArray): ArrayExpression`, + // this throws with objects that are not PlainObject according to lodash, + // or if there are non-valueToNode-able values + `export function valueToNode(value: object): ObjectExpression`, + // eslint-disable-next-line max-len + `export function valueToNode(value: undefined | boolean | null | string | number | RegExp | object): Expression`, + + // modifications/ + // eslint-disable-next-line max-len + `export function removeTypeDuplicates(types: ReadonlyArray): FlowType[]`, + // eslint-disable-next-line max-len + `export function appendToMemberExpression>(member: T, append: MemberExpression['property'], computed?: boolean): T`, + // eslint-disable-next-line max-len + `export function inherits(child: T, parent: Node | null | undefined): T`, + // eslint-disable-next-line max-len + `export function prependToMemberExpression>(member: T, prepend: MemberExpression['object']): T`, `export function removeProperties( n: Node, opts?: { preserveComments: boolean } | null @@ -131,18 +237,76 @@ lines.push( n: T, opts?: { preserveComments: boolean } | null ): T;`, + + // retrievers/ + // eslint-disable-next-line max-len + `export function getBindingIdentifiers(node: Node, duplicates: true, outerOnly?: boolean): Record>`, + // eslint-disable-next-line max-len + `export function getBindingIdentifiers(node: Node, duplicates?: false, outerOnly?: boolean): Record`, + // eslint-disable-next-line max-len + `export function getBindingIdentifiers(node: Node, duplicates: boolean, outerOnly?: boolean): Record>`, + // eslint-disable-next-line max-len + `export function getOuterBindingIdentifiers(node: Node, duplicates: true): Record>`, + `export function getOuterBindingIdentifiers(node: Node, duplicates?: false): Record`, + // eslint-disable-next-line max-len + `export function getOuterBindingIdentifiers(node: Node, duplicates: boolean): Record>`, + + // traverse/ `export type TraversalAncestors = ReadonlyArray<{ node: Node, key: string, index?: number, }>; - export type TraversalHandler = (node: Node, parent: TraversalAncestors, type: T) => void; + export type TraversalHandler = ( + this: undefined, node: Node, parent: TraversalAncestors, type: T + ) => void; export type TraversalHandlers = { enter?: TraversalHandler, exit?: TraversalHandler, };`.replace(/(^|\n) {2}/g, "$1"), // eslint-disable-next-line - `export function traverse(n: Node, h: TraversalHandler | TraversalHandlers, state?: T): void;` + `export function traverse(n: Node, h: TraversalHandler | TraversalHandlers, state?: T): void;`, + `export function traverseFast(n: Node, h: TraversalHandler, state?: T): void;`, + + // utils/ + // cleanJSXElementLiteralChild is not exported + // inherit is not exported + `export function shallowEqual(actual: object, expected: T): actual is T`, + + // validators/ + // eslint-disable-next-line max-len + `export function buildMatchMemberExpression(match: string, allowPartial?: boolean): (node: Node | null | undefined) => node is MemberExpression`, + // eslint-disable-next-line max-len + `export function is(type: T, n: Node | null | undefined, required?: undefined): n is Extract`, + // eslint-disable-next-line max-len + `export function is>(type: T, n: Node | null | undefined, required: Partial

): n is P`, + // eslint-disable-next-line max-len + `export function is

(type: string, n: Node | null | undefined, required: Partial

): n is P`, + `export function is(type: string, n: Node | null | undefined, required?: Partial): n is Node`, + `export function isBinding(node: Node, parent: Node, grandparent?: Node): boolean`, + // eslint-disable-next-line max-len + `export function isBlockScoped(node: Node): node is FunctionDeclaration | ClassDeclaration | VariableDeclaration`, + `export function isImmutable(node: Node): node is Immutable`, + `export function isLet(node: Node): node is VariableDeclaration`, + `export function isNode(node: object | null | undefined): node is Node`, + `export function isNodesEquivalent>(a: T, b: any): b is T`, + `export function isNodesEquivalent(a: any, b: any): boolean`, + `export function isPlaceholderType(placeholderType: Node['type'], targetType: Node['type']): boolean`, + `export function isReferenced(node: Node, parent: Node, grandparent?: Node): boolean`, + `export function isScope(node: Node, parent: Node): node is Scopable`, + `export function isSpecifierDefault(specifier: ModuleSpecifier): boolean`, + `export function isType(nodetype: string, targetType: T): nodetype is T`, + `export function isType(nodetype: string | null | undefined, targetType: string): boolean`, + `export function isValidES3Identifier(name: string): boolean`, + `export function isValidIdentifier(name: string): boolean`, + `export function isVar(node: Node): node is VariableDeclaration`, + // the MemberExpression implication is incidental, but it follows from the implementation + // eslint-disable-next-line max-len + `export function matchesPattern(node: Node | null | undefined, match: string | ReadonlyArray, allowPartial?: boolean): node is MemberExpression`, + // TypeScript 3.7: ": asserts n is T" + // eslint-disable-next-line max-len + `export function validate(n: Node | null | undefined, key: K, value: T[K]): void`, + `export function validate(n: Node, key: string, value: any): void;` ); for (const type in t.DEPRECATED_KEYS) { diff --git a/packages/babel-types/scripts/utils/formatBuilderName.js b/packages/babel-types/scripts/utils/formatBuilderName.js index 1b543a9bfaf5..621c46821951 100644 --- a/packages/babel-types/scripts/utils/formatBuilderName.js +++ b/packages/babel-types/scripts/utils/formatBuilderName.js @@ -5,5 +5,6 @@ const toLowerCase = Function.call.bind("".toLowerCase); module.exports = function formatBuilderName(type) { // FunctionExpression -> functionExpression // JSXIdentifier -> jsxIdentifier - return type.replace(/^([A-Z](?=[a-z])|[A-Z]+(?=[A-Z]))/, toLowerCase); + // V8IntrinsicIdentifier -> v8IntrinsicIdentifier + return type.replace(/^([A-Z](?=[a-z0-9])|[A-Z]+(?=[A-Z]))/, toLowerCase); }; diff --git a/packages/babel-types/src/asserts/assertNode.js b/packages/babel-types/src/asserts/assertNode.js index 61891e54de40..0097871ebc94 100644 --- a/packages/babel-types/src/asserts/assertNode.js +++ b/packages/babel-types/src/asserts/assertNode.js @@ -4,6 +4,6 @@ import isNode from "../validators/isNode"; export default function assertNode(node?: Object): void { if (!isNode(node)) { const type = (node && node.type) || JSON.stringify(node); - throw new TypeError(`Not a valid node of type "${type}"`); + throw new TypeError(`Not a valid node of type "${(type: any)}"`); } } diff --git a/packages/babel-types/src/asserts/generated/index.js b/packages/babel-types/src/asserts/generated/index.js index 3a4e81d34700..a99c58081d41 100644 --- a/packages/babel-types/src/asserts/generated/index.js +++ b/packages/babel-types/src/asserts/generated/index.js @@ -8,9 +8,8 @@ import is from "../../validators/is"; function assert(type: string, node: Object, opts?: Object): void { if (!is(type, node, opts)) { throw new Error( - `Expected type "${type}" with option ${JSON.stringify( - opts, - )}, but instead got "${node.type}".`, + `Expected type "${type}" with option ${JSON.stringify((opts: any))}, ` + + `but instead got "${node.type}".`, ); } } @@ -225,12 +224,12 @@ export function assertArrowFunctionExpression( export function assertClassBody(node: Object, opts?: Object = {}): void { assert("ClassBody", node, opts); } -export function assertClassDeclaration(node: Object, opts?: Object = {}): void { - assert("ClassDeclaration", node, opts); -} export function assertClassExpression(node: Object, opts?: Object = {}): void { assert("ClassExpression", node, opts); } +export function assertClassDeclaration(node: Object, opts?: Object = {}): void { + assert("ClassDeclaration", node, opts); +} export function assertExportAllDeclaration( node: Object, opts?: Object = {}, @@ -525,6 +524,12 @@ export function assertStringTypeAnnotation( ): void { assert("StringTypeAnnotation", node, opts); } +export function assertSymbolTypeAnnotation( + node: Object, + opts?: Object = {}, +): void { + assert("SymbolTypeAnnotation", node, opts); +} export function assertThisTypeAnnotation( node: Object, opts?: Object = {}, @@ -585,6 +590,39 @@ export function assertVoidTypeAnnotation( ): void { assert("VoidTypeAnnotation", node, opts); } +export function assertEnumDeclaration(node: Object, opts?: Object = {}): void { + assert("EnumDeclaration", node, opts); +} +export function assertEnumBooleanBody(node: Object, opts?: Object = {}): void { + assert("EnumBooleanBody", node, opts); +} +export function assertEnumNumberBody(node: Object, opts?: Object = {}): void { + assert("EnumNumberBody", node, opts); +} +export function assertEnumStringBody(node: Object, opts?: Object = {}): void { + assert("EnumStringBody", node, opts); +} +export function assertEnumSymbolBody(node: Object, opts?: Object = {}): void { + assert("EnumSymbolBody", node, opts); +} +export function assertEnumBooleanMember( + node: Object, + opts?: Object = {}, +): void { + assert("EnumBooleanMember", node, opts); +} +export function assertEnumNumberMember(node: Object, opts?: Object = {}): void { + assert("EnumNumberMember", node, opts); +} +export function assertEnumStringMember(node: Object, opts?: Object = {}): void { + assert("EnumStringMember", node, opts); +} +export function assertEnumDefaultedMember( + node: Object, + opts?: Object = {}, +): void { + assert("EnumDefaultedMember", node, opts); +} export function assertJSXAttribute(node: Object, opts?: Object = {}): void { assert("JSXAttribute", node, opts); } @@ -663,6 +701,12 @@ export function assertNoop(node: Object, opts?: Object = {}): void { export function assertPlaceholder(node: Object, opts?: Object = {}): void { assert("Placeholder", node, opts); } +export function assertV8IntrinsicIdentifier( + node: Object, + opts?: Object = {}, +): void { + assert("V8IntrinsicIdentifier", node, opts); +} export function assertArgumentPlaceholder( node: Object, opts?: Object = {}, @@ -747,6 +791,12 @@ export function assertPrivateName(node: Object, opts?: Object = {}): void { export function assertBigIntLiteral(node: Object, opts?: Object = {}): void { assert("BigIntLiteral", node, opts); } +export function assertRecordExpression(node: Object, opts?: Object = {}): void { + assert("RecordExpression", node, opts); +} +export function assertTupleExpression(node: Object, opts?: Object = {}): void { + assert("TupleExpression", node, opts); +} export function assertTSParameterProperty( node: Object, opts?: Object = {}, @@ -795,8 +845,17 @@ export function assertTSIndexSignature(node: Object, opts?: Object = {}): void { export function assertTSAnyKeyword(node: Object, opts?: Object = {}): void { assert("TSAnyKeyword", node, opts); } -export function assertTSUnknownKeyword(node: Object, opts?: Object = {}): void { - assert("TSUnknownKeyword", node, opts); +export function assertTSBooleanKeyword(node: Object, opts?: Object = {}): void { + assert("TSBooleanKeyword", node, opts); +} +export function assertTSBigIntKeyword(node: Object, opts?: Object = {}): void { + assert("TSBigIntKeyword", node, opts); +} +export function assertTSNeverKeyword(node: Object, opts?: Object = {}): void { + assert("TSNeverKeyword", node, opts); +} +export function assertTSNullKeyword(node: Object, opts?: Object = {}): void { + assert("TSNullKeyword", node, opts); } export function assertTSNumberKeyword(node: Object, opts?: Object = {}): void { assert("TSNumberKeyword", node, opts); @@ -804,29 +863,23 @@ export function assertTSNumberKeyword(node: Object, opts?: Object = {}): void { export function assertTSObjectKeyword(node: Object, opts?: Object = {}): void { assert("TSObjectKeyword", node, opts); } -export function assertTSBooleanKeyword(node: Object, opts?: Object = {}): void { - assert("TSBooleanKeyword", node, opts); -} export function assertTSStringKeyword(node: Object, opts?: Object = {}): void { assert("TSStringKeyword", node, opts); } export function assertTSSymbolKeyword(node: Object, opts?: Object = {}): void { assert("TSSymbolKeyword", node, opts); } -export function assertTSVoidKeyword(node: Object, opts?: Object = {}): void { - assert("TSVoidKeyword", node, opts); -} export function assertTSUndefinedKeyword( node: Object, opts?: Object = {}, ): void { assert("TSUndefinedKeyword", node, opts); } -export function assertTSNullKeyword(node: Object, opts?: Object = {}): void { - assert("TSNullKeyword", node, opts); +export function assertTSUnknownKeyword(node: Object, opts?: Object = {}): void { + assert("TSUnknownKeyword", node, opts); } -export function assertTSNeverKeyword(node: Object, opts?: Object = {}): void { - assert("TSNeverKeyword", node, opts); +export function assertTSVoidKeyword(node: Object, opts?: Object = {}): void { + assert("TSVoidKeyword", node, opts); } export function assertTSThisType(node: Object, opts?: Object = {}): void { assert("TSThisType", node, opts); @@ -1131,6 +1184,12 @@ export function assertFlowDeclaration(node: Object, opts?: Object = {}): void { export function assertFlowPredicate(node: Object, opts?: Object = {}): void { assert("FlowPredicate", node, opts); } +export function assertEnumBody(node: Object, opts?: Object = {}): void { + assert("EnumBody", node, opts); +} +export function assertEnumMember(node: Object, opts?: Object = {}): void { + assert("EnumMember", node, opts); +} export function assertJSX(node: Object, opts?: Object = {}): void { assert("JSX", node, opts); } @@ -1143,6 +1202,9 @@ export function assertTSTypeElement(node: Object, opts?: Object = {}): void { export function assertTSType(node: Object, opts?: Object = {}): void { assert("TSType", node, opts); } +export function assertTSBaseType(node: Object, opts?: Object = {}): void { + assert("TSBaseType", node, opts); +} export function assertNumberLiteral(node: Object, opts: Object): void { console.trace( "The node type NumberLiteral has been renamed to NumericLiteral", diff --git a/packages/babel-types/src/builders/builder.js b/packages/babel-types/src/builders/builder.js index e01cf9fd97d6..04b5df08b888 100644 --- a/packages/babel-types/src/builders/builder.js +++ b/packages/babel-types/src/builders/builder.js @@ -8,9 +8,7 @@ export default function builder(type: string, ...args: Array): Object { const countArgs = args.length; if (countArgs > keys.length) { throw new Error( - `${type}: Too many arguments passed. Received ${countArgs} but can receive no more than ${ - keys.length - }`, + `${type}: Too many arguments passed. Received ${countArgs} but can receive no more than ${keys.length}`, ); } diff --git a/packages/babel-types/src/builders/flow/createFlowUnionType.js b/packages/babel-types/src/builders/flow/createFlowUnionType.js new file mode 100644 index 000000000000..30a6f08771d7 --- /dev/null +++ b/packages/babel-types/src/builders/flow/createFlowUnionType.js @@ -0,0 +1,17 @@ +// @flow +import { unionTypeAnnotation } from "../generated"; +import removeTypeDuplicates from "../../modifications/flow/removeTypeDuplicates"; + +/** + * Takes an array of `types` and flattens them, removing duplicates and + * returns a `UnionTypeAnnotation` node containg them. + */ +export default function createFlowUnionType(types: Array): Object { + const flattened = removeTypeDuplicates(types); + + if (flattened.length === 1) { + return flattened[0]; + } else { + return unionTypeAnnotation(flattened); + } +} diff --git a/packages/babel-types/src/builders/flow/createUnionTypeAnnotation.js b/packages/babel-types/src/builders/flow/createUnionTypeAnnotation.js deleted file mode 100644 index 4b181dab0c2b..000000000000 --- a/packages/babel-types/src/builders/flow/createUnionTypeAnnotation.js +++ /dev/null @@ -1,19 +0,0 @@ -// @flow -import { unionTypeAnnotation } from "../generated"; -import removeTypeDuplicates from "../../modifications/flow/removeTypeDuplicates"; - -/** - * Takes an array of `types` and flattens them, removing duplicates and - * returns a `UnionTypeAnnotation` node containg them. - */ -export default function createUnionTypeAnnotation( - types: Array, -): Object { - const flattened = removeTypeDuplicates(types); - - if (flattened.length === 1) { - return flattened[0]; - } else { - return unionTypeAnnotation(flattened); - } -} diff --git a/packages/babel-types/src/builders/generated/index.js b/packages/babel-types/src/builders/generated/index.js index e4ca375762cc..fc319d6ad114 100644 --- a/packages/babel-types/src/builders/generated/index.js +++ b/packages/babel-types/src/builders/generated/index.js @@ -225,14 +225,14 @@ export function ClassBody(...args: Array): Object { return builder("ClassBody", ...args); } export { ClassBody as classBody }; -export function ClassDeclaration(...args: Array): Object { - return builder("ClassDeclaration", ...args); -} -export { ClassDeclaration as classDeclaration }; export function ClassExpression(...args: Array): Object { return builder("ClassExpression", ...args); } export { ClassExpression as classExpression }; +export function ClassDeclaration(...args: Array): Object { + return builder("ClassDeclaration", ...args); +} +export { ClassDeclaration as classDeclaration }; export function ExportAllDeclaration(...args: Array): Object { return builder("ExportAllDeclaration", ...args); } @@ -469,6 +469,10 @@ export function StringTypeAnnotation(...args: Array): Object { return builder("StringTypeAnnotation", ...args); } export { StringTypeAnnotation as stringTypeAnnotation }; +export function SymbolTypeAnnotation(...args: Array): Object { + return builder("SymbolTypeAnnotation", ...args); +} +export { SymbolTypeAnnotation as symbolTypeAnnotation }; export function ThisTypeAnnotation(...args: Array): Object { return builder("ThisTypeAnnotation", ...args); } @@ -517,6 +521,42 @@ export function VoidTypeAnnotation(...args: Array): Object { return builder("VoidTypeAnnotation", ...args); } export { VoidTypeAnnotation as voidTypeAnnotation }; +export function EnumDeclaration(...args: Array): Object { + return builder("EnumDeclaration", ...args); +} +export { EnumDeclaration as enumDeclaration }; +export function EnumBooleanBody(...args: Array): Object { + return builder("EnumBooleanBody", ...args); +} +export { EnumBooleanBody as enumBooleanBody }; +export function EnumNumberBody(...args: Array): Object { + return builder("EnumNumberBody", ...args); +} +export { EnumNumberBody as enumNumberBody }; +export function EnumStringBody(...args: Array): Object { + return builder("EnumStringBody", ...args); +} +export { EnumStringBody as enumStringBody }; +export function EnumSymbolBody(...args: Array): Object { + return builder("EnumSymbolBody", ...args); +} +export { EnumSymbolBody as enumSymbolBody }; +export function EnumBooleanMember(...args: Array): Object { + return builder("EnumBooleanMember", ...args); +} +export { EnumBooleanMember as enumBooleanMember }; +export function EnumNumberMember(...args: Array): Object { + return builder("EnumNumberMember", ...args); +} +export { EnumNumberMember as enumNumberMember }; +export function EnumStringMember(...args: Array): Object { + return builder("EnumStringMember", ...args); +} +export { EnumStringMember as enumStringMember }; +export function EnumDefaultedMember(...args: Array): Object { + return builder("EnumDefaultedMember", ...args); +} +export { EnumDefaultedMember as enumDefaultedMember }; export function JSXAttribute(...args: Array): Object { return builder("JSXAttribute", ...args); } @@ -600,6 +640,10 @@ export function Placeholder(...args: Array): Object { return builder("Placeholder", ...args); } export { Placeholder as placeholder }; +export function V8IntrinsicIdentifier(...args: Array): Object { + return builder("V8IntrinsicIdentifier", ...args); +} +export { V8IntrinsicIdentifier as v8IntrinsicIdentifier }; export function ArgumentPlaceholder(...args: Array): Object { return builder("ArgumentPlaceholder", ...args); } @@ -672,6 +716,14 @@ export function BigIntLiteral(...args: Array): Object { return builder("BigIntLiteral", ...args); } export { BigIntLiteral as bigIntLiteral }; +export function RecordExpression(...args: Array): Object { + return builder("RecordExpression", ...args); +} +export { RecordExpression as recordExpression }; +export function TupleExpression(...args: Array): Object { + return builder("TupleExpression", ...args); +} +export { TupleExpression as tupleExpression }; export function TSParameterProperty(...args: Array): Object { return builder("TSParameterProperty", ...args); } @@ -722,11 +774,26 @@ export function TSAnyKeyword(...args: Array): Object { } export { TSAnyKeyword as tsAnyKeyword }; export { TSAnyKeyword as tSAnyKeyword }; -export function TSUnknownKeyword(...args: Array): Object { - return builder("TSUnknownKeyword", ...args); +export function TSBooleanKeyword(...args: Array): Object { + return builder("TSBooleanKeyword", ...args); } -export { TSUnknownKeyword as tsUnknownKeyword }; -export { TSUnknownKeyword as tSUnknownKeyword }; +export { TSBooleanKeyword as tsBooleanKeyword }; +export { TSBooleanKeyword as tSBooleanKeyword }; +export function TSBigIntKeyword(...args: Array): Object { + return builder("TSBigIntKeyword", ...args); +} +export { TSBigIntKeyword as tsBigIntKeyword }; +export { TSBigIntKeyword as tSBigIntKeyword }; +export function TSNeverKeyword(...args: Array): Object { + return builder("TSNeverKeyword", ...args); +} +export { TSNeverKeyword as tsNeverKeyword }; +export { TSNeverKeyword as tSNeverKeyword }; +export function TSNullKeyword(...args: Array): Object { + return builder("TSNullKeyword", ...args); +} +export { TSNullKeyword as tsNullKeyword }; +export { TSNullKeyword as tSNullKeyword }; export function TSNumberKeyword(...args: Array): Object { return builder("TSNumberKeyword", ...args); } @@ -737,11 +804,6 @@ export function TSObjectKeyword(...args: Array): Object { } export { TSObjectKeyword as tsObjectKeyword }; export { TSObjectKeyword as tSObjectKeyword }; -export function TSBooleanKeyword(...args: Array): Object { - return builder("TSBooleanKeyword", ...args); -} -export { TSBooleanKeyword as tsBooleanKeyword }; -export { TSBooleanKeyword as tSBooleanKeyword }; export function TSStringKeyword(...args: Array): Object { return builder("TSStringKeyword", ...args); } @@ -752,26 +814,21 @@ export function TSSymbolKeyword(...args: Array): Object { } export { TSSymbolKeyword as tsSymbolKeyword }; export { TSSymbolKeyword as tSSymbolKeyword }; -export function TSVoidKeyword(...args: Array): Object { - return builder("TSVoidKeyword", ...args); -} -export { TSVoidKeyword as tsVoidKeyword }; -export { TSVoidKeyword as tSVoidKeyword }; export function TSUndefinedKeyword(...args: Array): Object { return builder("TSUndefinedKeyword", ...args); } export { TSUndefinedKeyword as tsUndefinedKeyword }; export { TSUndefinedKeyword as tSUndefinedKeyword }; -export function TSNullKeyword(...args: Array): Object { - return builder("TSNullKeyword", ...args); +export function TSUnknownKeyword(...args: Array): Object { + return builder("TSUnknownKeyword", ...args); } -export { TSNullKeyword as tsNullKeyword }; -export { TSNullKeyword as tSNullKeyword }; -export function TSNeverKeyword(...args: Array): Object { - return builder("TSNeverKeyword", ...args); +export { TSUnknownKeyword as tsUnknownKeyword }; +export { TSUnknownKeyword as tSUnknownKeyword }; +export function TSVoidKeyword(...args: Array): Object { + return builder("TSVoidKeyword", ...args); } -export { TSNeverKeyword as tsNeverKeyword }; -export { TSNeverKeyword as tSNeverKeyword }; +export { TSVoidKeyword as tsVoidKeyword }; +export { TSVoidKeyword as tSVoidKeyword }; export function TSThisType(...args: Array): Object { return builder("TSThisType", ...args); } diff --git a/packages/babel-types/src/builders/typescript/createTSUnionType.js b/packages/babel-types/src/builders/typescript/createTSUnionType.js new file mode 100644 index 000000000000..49138ad029f3 --- /dev/null +++ b/packages/babel-types/src/builders/typescript/createTSUnionType.js @@ -0,0 +1,19 @@ +import { TSUnionType } from "../generated"; +import removeTypeDuplicates from "../../modifications/typescript/removeTypeDuplicates"; + +/** + * Takes an array of `types` and flattens them, removing duplicates and + * returns a `UnionTypeAnnotation` node containg them. + */ +export default function createTSUnionType( + typeAnnotations: Array, +): Object { + const types = typeAnnotations.map(type => type.typeAnnotations); + const flattened = removeTypeDuplicates(types); + + if (flattened.length === 1) { + return flattened[0]; + } else { + return TSUnionType(flattened); + } +} diff --git a/packages/babel-types/src/clone/cloneDeepWithoutLoc.js b/packages/babel-types/src/clone/cloneDeepWithoutLoc.js new file mode 100644 index 000000000000..80c1872308b2 --- /dev/null +++ b/packages/babel-types/src/clone/cloneDeepWithoutLoc.js @@ -0,0 +1,10 @@ +// @flow +import cloneNode from "./cloneNode"; +/** + * Create a deep clone of a `node` and all of it's child nodes + * including only properties belonging to the node. + * excluding `_private` and location properties. + */ +export default function cloneDeepWithoutLoc(node: T): T { + return cloneNode(node, /* deep */ true, /* withoutLoc */ true); +} diff --git a/packages/babel-types/src/clone/cloneNode.js b/packages/babel-types/src/clone/cloneNode.js index 72347d4a0d45..9f71429a2c51 100644 --- a/packages/babel-types/src/clone/cloneNode.js +++ b/packages/babel-types/src/clone/cloneNode.js @@ -2,33 +2,32 @@ import { NODE_FIELDS } from "../definitions"; const has = Function.call.bind(Object.prototype.hasOwnProperty); -function cloneIfNode(obj, deep) { - if ( - obj && - typeof obj.type === "string" && - // CommentLine and CommentBlock are used in File#comments, but they are - // not defined in babel-types - obj.type !== "CommentLine" && - obj.type !== "CommentBlock" - ) { - return cloneNode(obj, deep); +// This function will never be called for comments, only for real nodes. +function cloneIfNode(obj, deep, withoutLoc) { + if (obj && typeof obj.type === "string") { + return cloneNode(obj, deep, withoutLoc); } return obj; } -function cloneIfNodeOrArray(obj, deep) { +function cloneIfNodeOrArray(obj, deep, withoutLoc) { if (Array.isArray(obj)) { - return obj.map(node => cloneIfNode(node, deep)); + return obj.map(node => cloneIfNode(node, deep, withoutLoc)); } - return cloneIfNode(obj, deep); + return cloneIfNode(obj, deep, withoutLoc); } /** * Create a clone of a `node` including only properties belonging to the node. * If the second parameter is `false`, cloneNode performs a shallow clone. + * If the third parameter is true, the cloned nodes exclude location properties. */ -export default function cloneNode(node: T, deep: boolean = true): T { +export default function cloneNode( + node: T, + deep: boolean = true, + withoutLoc: boolean = false, +): T { if (!node) return node; const { type } = node; @@ -44,7 +43,7 @@ export default function cloneNode(node: T, deep: boolean = true): T { if (has(node, "typeAnnotation")) { newNode.typeAnnotation = deep - ? cloneIfNodeOrArray(node.typeAnnotation, true) + ? cloneIfNodeOrArray(node.typeAnnotation, true, withoutLoc) : node.typeAnnotation; } } else if (!has(NODE_FIELDS, type)) { @@ -52,24 +51,45 @@ export default function cloneNode(node: T, deep: boolean = true): T { } else { for (const field of Object.keys(NODE_FIELDS[type])) { if (has(node, field)) { - newNode[field] = deep - ? cloneIfNodeOrArray(node[field], true) - : node[field]; + if (deep) { + newNode[field] = + type === "File" && field === "comments" + ? maybeCloneComments(node.comments, deep, withoutLoc) + : cloneIfNodeOrArray(node[field], true, withoutLoc); + } else { + newNode[field] = node[field]; + } } } } if (has(node, "loc")) { - newNode.loc = node.loc; + if (withoutLoc) { + newNode.loc = null; + } else { + newNode.loc = node.loc; + } } if (has(node, "leadingComments")) { - newNode.leadingComments = node.leadingComments; + newNode.leadingComments = maybeCloneComments( + node.leadingComments, + deep, + withoutLoc, + ); } if (has(node, "innerComments")) { - newNode.innerComments = node.innerComments; + newNode.innerComments = maybeCloneComments( + node.innerComments, + deep, + withoutLoc, + ); } if (has(node, "trailingComments")) { - newNode.trailingComments = node.trailingComments; + newNode.trailingComments = maybeCloneComments( + node.trailingComments, + deep, + withoutLoc, + ); } if (has(node, "extra")) { newNode.extra = { @@ -79,3 +99,11 @@ export default function cloneNode(node: T, deep: boolean = true): T { return newNode; } + +function cloneCommentsWithoutLoc(comments: T[]): T { + return comments.map(({ type, value }) => ({ type, value, loc: null })); +} + +function maybeCloneComments(comments, deep, withoutLoc) { + return deep && withoutLoc ? cloneCommentsWithoutLoc(comments) : comments; +} diff --git a/packages/babel-types/src/clone/cloneWithoutLoc.js b/packages/babel-types/src/clone/cloneWithoutLoc.js index f495f94b8fff..b5cfe2fff028 100644 --- a/packages/babel-types/src/clone/cloneWithoutLoc.js +++ b/packages/babel-types/src/clone/cloneWithoutLoc.js @@ -1,12 +1,8 @@ // @flow -import clone from "./clone"; - +import cloneNode from "./cloneNode"; /** * Create a shallow clone of a `node` excluding `_private` and location properties. */ export default function cloneWithoutLoc(node: T): T { - const newNode = clone(node); - newNode.loc = null; - - return newNode; + return cloneNode(node, /* deep */ false, /* withoutLoc */ true); } diff --git a/packages/babel-types/src/constants/generated/index.js b/packages/babel-types/src/constants/generated/index.js index eedb7038ed28..acdf21744af7 100644 --- a/packages/babel-types/src/constants/generated/index.js +++ b/packages/babel-types/src/constants/generated/index.js @@ -45,7 +45,10 @@ export const FLOWBASEANNOTATION_TYPES = FLIPPED_ALIAS_KEYS["FlowBaseAnnotation"]; export const FLOWDECLARATION_TYPES = FLIPPED_ALIAS_KEYS["FlowDeclaration"]; export const FLOWPREDICATE_TYPES = FLIPPED_ALIAS_KEYS["FlowPredicate"]; +export const ENUMBODY_TYPES = FLIPPED_ALIAS_KEYS["EnumBody"]; +export const ENUMMEMBER_TYPES = FLIPPED_ALIAS_KEYS["EnumMember"]; export const JSX_TYPES = FLIPPED_ALIAS_KEYS["JSX"]; export const PRIVATE_TYPES = FLIPPED_ALIAS_KEYS["Private"]; export const TSTYPEELEMENT_TYPES = FLIPPED_ALIAS_KEYS["TSTypeElement"]; export const TSTYPE_TYPES = FLIPPED_ALIAS_KEYS["TSType"]; +export const TSBASETYPE_TYPES = FLIPPED_ALIAS_KEYS["TSBaseType"]; diff --git a/packages/babel-types/src/constants/index.js b/packages/babel-types/src/constants/index.js index b777caa0f11e..4cac678b73a7 100644 --- a/packages/babel-types/src/constants/index.js +++ b/packages/babel-types/src/constants/index.js @@ -41,6 +41,13 @@ export const BINARY_OPERATORS = [ ...BOOLEAN_BINARY_OPERATORS, ]; +export const ASSIGNMENT_OPERATORS = [ + "=", + "+=", + ...NUMBER_BINARY_OPERATORS.map(op => op + "="), + ...LOGICAL_OPERATORS.map(op => op + "="), +]; + export const BOOLEAN_UNARY_OPERATORS = ["delete", "!"]; export const NUMBER_UNARY_OPERATORS = ["+", "-", "~"]; export const STRING_UNARY_OPERATORS = ["typeof"]; diff --git a/packages/babel-types/src/definitions/core.js b/packages/babel-types/src/definitions/core.js index 1e4de3ebbfa0..f27aa81c9172 100644 --- a/packages/babel-types/src/definitions/core.js +++ b/packages/babel-types/src/definitions/core.js @@ -1,9 +1,13 @@ // @flow + +import is from "../validators/is"; import isValidIdentifier from "../validators/isValidIdentifier"; +import { isKeyword, isReservedWord } from "@babel/helper-validator-identifier"; import { BINARY_OPERATORS, LOGICAL_OPERATORS, + ASSIGNMENT_OPERATORS, UNARY_OPERATORS, UPDATE_OPERATORS, } from "../constants"; @@ -26,7 +30,7 @@ defineType("ArrayExpression", { assertNodeOrValueType("null", "Expression", "SpreadElement"), ), ), - default: [], + default: !process.env.BABEL_TYPES_8_BREAKING ? [] : undefined, }, }, visitor: ["elements"], @@ -36,10 +40,29 @@ defineType("ArrayExpression", { defineType("AssignmentExpression", { fields: { operator: { - validate: assertValueType("string"), + validate: (function() { + if (!process.env.BABEL_TYPES_8_BREAKING) { + return assertValueType("string"); + } + + const identifier = assertOneOf(...ASSIGNMENT_OPERATORS); + const pattern = assertOneOf("="); + + return function(node, key, val) { + const validator = is("Pattern", node.left) ? pattern : identifier; + validator(node, key, val); + }; + })(), }, left: { - validate: assertNodeType("LVal"), + validate: !process.env.BABEL_TYPES_8_BREAKING + ? assertNodeType("LVal") + : assertNodeType( + "Identifier", + "MemberExpression", + "ArrayPattern", + "ObjectPattern", + ), }, right: { validate: assertNodeType("Expression"), @@ -132,7 +155,7 @@ defineType("CallExpression", { aliases: ["Expression"], fields: { callee: { - validate: assertNodeType("Expression"), + validate: assertNodeType("Expression", "V8IntrinsicIdentifier"), }, arguments: { validate: chain( @@ -147,10 +170,14 @@ defineType("CallExpression", { ), ), }, - optional: { - validate: assertOneOf(true, false), - optional: true, - }, + ...(!process.env.BABEL_TYPES_8_BREAKING + ? { + optional: { + validate: assertOneOf(true, false), + optional: true, + }, + } + : {}), typeArguments: { validate: assertNodeType("TypeParameterInstantiation"), optional: true, @@ -166,7 +193,7 @@ defineType("CatchClause", { visitor: ["param", "body"], fields: { param: { - validate: assertNodeType("Identifier"), + validate: assertNodeType("Identifier", "ArrayPattern", "ObjectPattern"), optional: true, }, body: { @@ -256,7 +283,15 @@ defineType("ForInStatement", { ], fields: { left: { - validate: assertNodeType("VariableDeclaration", "LVal"), + validate: !process.env.BABEL_TYPES_8_BREAKING + ? assertNodeType("VariableDeclaration", "LVal") + : assertNodeType( + "VariableDeclaration", + "Identifier", + "MemberExpression", + "ArrayPattern", + "ObjectPattern", + ), }, right: { validate: assertNodeType("Expression"), @@ -305,10 +340,8 @@ export const functionCommon = { }, generator: { default: false, - validate: assertValueType("boolean"), }, async: { - validate: assertValueType("boolean"), default: false, }, }; @@ -359,6 +392,17 @@ defineType("FunctionDeclaration", { "Pureish", "Declaration", ], + validate: (function() { + if (!process.env.BABEL_TYPES_8_BREAKING) return () => {}; + + const identifier = assertNodeType("Identifier"); + + return function(parent, key, node) { + if (!is("ExportDefaultDeclaration", parent)) { + identifier(node, "id", node.id); + } + }; + })(), }); defineType("FunctionExpression", { @@ -405,17 +449,56 @@ defineType("Identifier", { fields: { ...patternLikeCommon, name: { - validate: chain(function(node, key, val) { - if (!isValidIdentifier(val)) { - // throw new TypeError(`"${val}" is not a valid identifer name`); + validate: chain(assertValueType("string"), function(node, key, val) { + if (!process.env.BABEL_TYPES_8_BREAKING) return; + + if (!isValidIdentifier(val, false)) { + throw new TypeError(`"${val}" is not a valid identifier name`); } - }, assertValueType("string")), + }), }, optional: { validate: assertValueType("boolean"), optional: true, }, }, + validate(parent, key, node) { + if (!process.env.BABEL_TYPES_8_BREAKING) return; + + const match = /\.(\w+)$/.exec(key); + if (!match) return; + + const [, parentKey] = match; + const nonComp = { computed: false }; + + // We can't check if `parent.property === node`, because nodes are validated + // before replacing them in the AST. + if (parentKey === "property") { + if (is("MemberExpression", parent, nonComp)) return; + if (is("OptionalMemberExpression", parent, nonComp)) return; + } else if (parentKey === "key") { + if (is("Property", parent, nonComp)) return; + if (is("Method", parent, nonComp)) return; + } else if (parentKey === "exported") { + if (is("ExportSpecifier", parent)) return; + } else if (parentKey === "imported") { + if (is("ImportSpecifier", parent, { imported: node })) return; + } else if (parentKey === "meta") { + if (is("MetaProperty", parent, { meta: node })) return; + } + + if ( + // Ideally we should call isStrictReservedWord if this node is a descendant + // of a block in strict mode. Also, we should pass the inModule option so + // we can disable "await" in module. + (isKeyword(node.name) || isReservedWord(node.name)) && + // Even if "this" is a keyword, we are using the Identifier + // node to represent it. + node.name !== "this" + ) { + throw new TypeError(`"${node.name}" is not a valid identifier`); + } + }, }); defineType("IfStatement", { @@ -486,13 +569,20 @@ defineType("BooleanLiteral", { defineType("RegExpLiteral", { builder: ["pattern", "flags"], deprecatedAlias: "RegexLiteral", - aliases: ["Expression", "Literal"], + aliases: ["Expression", "Pureish", "Literal"], fields: { pattern: { validate: assertValueType("string"), }, flags: { - validate: assertValueType("string"), + validate: chain(assertValueType("string"), function(node, key, val) { + if (!process.env.BABEL_TYPES_8_BREAKING) return; + + const invalid = /[^gimsuy]/.exec(val); + if (invalid) { + throw new TypeError(`"${invalid[0]}" is not a valid RegExp flag`); + } + }), default: "", }, }, @@ -537,10 +627,14 @@ defineType("MemberExpression", { computed: { default: false, }, - optional: { - validate: assertOneOf(true, false), - optional: true, - }, + ...(!process.env.BABEL_TYPES_8_BREAKING + ? { + optional: { + validate: assertOneOf(true, false), + optional: true, + }, + } + : {}), }, }); @@ -597,19 +691,15 @@ defineType("ObjectExpression", { }); defineType("ObjectMethod", { - builder: ["kind", "key", "params", "body", "computed"], + builder: ["kind", "key", "params", "body", "computed", "generator", "async"], fields: { ...functionCommon, ...functionTypeAnnotationCommon, kind: { - validate: chain( - assertValueType("string"), - assertOneOf("method", "get", "set"), - ), - default: "method", + validate: assertOneOf("method", "get", "set"), + ...(!process.env.BABEL_TYPES_8_BREAKING ? { default: "method" } : {}), }, computed: { - validate: assertValueType("boolean"), default: false, }, key: { @@ -632,6 +722,7 @@ defineType("ObjectMethod", { assertValueType("array"), assertEach(assertNodeType("Decorator")), ), + optional: true, }, body: { validate: assertNodeType("BlockStatement"), @@ -657,10 +748,15 @@ defineType("ObjectMethod", { }); defineType("ObjectProperty", { - builder: ["key", "value", "computed", "shorthand", "decorators"], + builder: [ + "key", + "value", + "computed", + "shorthand", + ...(!process.env.BABEL_TYPES_8_BREAKING ? ["decorators"] : []), + ], fields: { computed: { - validate: assertValueType("boolean"), default: false, }, key: { @@ -684,7 +780,27 @@ defineType("ObjectProperty", { validate: assertNodeType("Expression", "PatternLike"), }, shorthand: { - validate: assertValueType("boolean"), + validate: chain( + assertValueType("boolean"), + function(node, key, val) { + if (!process.env.BABEL_TYPES_8_BREAKING) return; + + if (val && node.computed) { + throw new TypeError( + "Property shorthand of ObjectProperty cannot be true if computed is true", + ); + } + }, + function(node, key, val) { + if (!process.env.BABEL_TYPES_8_BREAKING) return; + + if (val && !is("Identifier", node.key)) { + throw new TypeError( + "Property shorthand of ObjectProperty cannot be true if key is not an Identifier", + ); + } + }, + ), default: false, }, decorators: { @@ -697,6 +813,17 @@ defineType("ObjectProperty", { }, visitor: ["key", "value", "decorators"], aliases: ["UserWhitespacable", "Property", "ObjectMember"], + validate: (function() { + const pattern = assertNodeType("Identifier", "Pattern"); + const expression = assertNodeType("Expression"); + + return function(parent, key, node) { + if (!process.env.BABEL_TYPES_8_BREAKING) return; + + const validator = is("ObjectPattern", parent) ? pattern : expression; + validator(node, "value", node.value); + }; + })(), }); defineType("RestElement", { @@ -707,9 +834,22 @@ defineType("RestElement", { fields: { ...patternLikeCommon, argument: { - validate: assertNodeType("LVal"), + validate: !process.env.BABEL_TYPES_8_BREAKING + ? assertNodeType("LVal") + : assertNodeType("Identifier", "Pattern", "MemberExpression"), }, }, + validate(parent, key) { + if (!process.env.BABEL_TYPES_8_BREAKING) return; + + const match = /(\w+)\[(\d+)\]/.exec(key); + if (!match) throw new Error("Internal Babel error: malformed key."); + + const [, listKey, index] = match; + if (parent[listKey].length > index + 1) { + throw new TypeError(`RestElement must be last element of ${listKey}`); + } + }, }); defineType("ReturnStatement", { @@ -792,13 +932,23 @@ defineType("ThrowStatement", { }, }); -// todo: at least handler or finalizer should be set to be valid defineType("TryStatement", { visitor: ["block", "handler", "finalizer"], aliases: ["Statement"], fields: { block: { - validate: assertNodeType("BlockStatement"), + validate: chain(assertNodeType("BlockStatement"), function(node) { + if (!process.env.BABEL_TYPES_8_BREAKING) return; + + // This validator isn't put at the top level because we can run it + // even if this node doesn't have a parent. + + if (!node.handler && !node.finalizer) { + throw new TypeError( + "TryStatement expects either a handler or finalizer, or both", + ); + } + }), }, handler: { optional: true, @@ -835,7 +985,9 @@ defineType("UpdateExpression", { default: false, }, argument: { - validate: assertNodeType("Expression"), + validate: !process.env.BABEL_TYPES_8_BREAKING + ? assertNodeType("Expression") + : assertNodeType("Identifier", "MemberExpression"), }, operator: { validate: assertOneOf(...UPDATE_OPERATORS), @@ -855,10 +1007,7 @@ defineType("VariableDeclaration", { optional: true, }, kind: { - validate: chain( - assertValueType("string"), - assertOneOf("var", "let", "const"), - ), + validate: assertOneOf("var", "let", "const"), }, declarations: { validate: chain( @@ -867,13 +1016,39 @@ defineType("VariableDeclaration", { ), }, }, + validate(parent, key, node) { + if (!process.env.BABEL_TYPES_8_BREAKING) return; + + if (!is("ForXStatement", parent, { left: node })) return; + if (node.declarations.length !== 1) { + throw new TypeError( + `Exactly one VariableDeclarator is required in the VariableDeclaration of a ${parent.type}`, + ); + } + }, }); defineType("VariableDeclarator", { visitor: ["id", "init"], fields: { id: { - validate: assertNodeType("LVal"), + validate: (function() { + if (!process.env.BABEL_TYPES_8_BREAKING) { + return assertNodeType("LVal"); + } + + const normal = assertNodeType( + "Identifier", + "ArrayPattern", + "ObjectPattern", + ); + const without = assertNodeType("Identifier"); + + return function(node, key, val) { + const validator = node.init ? normal : without; + validator(node, key, val); + }; + })(), }, definite: { optional: true, @@ -894,7 +1069,7 @@ defineType("WhileStatement", { validate: assertNodeType("Expression"), }, body: { - validate: assertNodeType("BlockStatement", "Statement"), + validate: assertNodeType("Statement"), }, }, }); @@ -907,7 +1082,7 @@ defineType("WithStatement", { validate: assertNodeType("Expression"), }, body: { - validate: assertNodeType("BlockStatement", "Statement"), + validate: assertNodeType("Statement"), }, }, }); diff --git a/packages/babel-types/src/definitions/es2015.js b/packages/babel-types/src/definitions/es2015.js index 26445747cdd3..535673bde5b4 100644 --- a/packages/babel-types/src/definitions/es2015.js +++ b/packages/babel-types/src/definitions/es2015.js @@ -3,6 +3,7 @@ import defineType, { assertShape, assertNodeType, assertValueType, + assertNodeOrValueType, chain, assertEach, assertOneOf, @@ -13,6 +14,7 @@ import { functionTypeAnnotationCommon, patternLikeCommon, } from "./core"; +import is from "../validators/is"; defineType("AssignmentPattern", { visitor: ["left", "right", "decorators" /* for legacy param decorators */], @@ -31,11 +33,13 @@ defineType("AssignmentPattern", { right: { validate: assertNodeType("Expression"), }, + // For TypeScript decorators: { validate: chain( assertValueType("array"), assertEach(assertNodeType("Decorator")), ), + optional: true, }, }, }); @@ -49,14 +53,16 @@ defineType("ArrayPattern", { elements: { validate: chain( assertValueType("array"), - assertEach(assertNodeType("PatternLike")), + assertEach(assertNodeOrValueType("null", "PatternLike")), ), }, + // For TypeScript decorators: { validate: chain( assertValueType("array"), assertEach(assertNodeType("Decorator")), ), + optional: true, }, }, }); @@ -106,41 +112,7 @@ defineType("ClassBody", { }, }); -const classCommon = { - typeParameters: { - validate: assertNodeType( - "TypeParameterDeclaration", - "TSTypeParameterDeclaration", - "Noop", - ), - optional: true, - }, - body: { - validate: assertNodeType("ClassBody"), - }, - superClass: { - optional: true, - validate: assertNodeType("Expression"), - }, - superTypeParameters: { - validate: assertNodeType( - "TypeParameterInstantiation", - "TSTypeParameterInstantiation", - ), - optional: true, - }, - implements: { - validate: chain( - assertValueType("array"), - assertEach( - assertNodeType("TSExpressionWithTypeArguments", "ClassImplements"), - ), - ), - optional: true, - }, -}; - -defineType("ClassDeclaration", { +defineType("ClassExpression", { builder: ["id", "superClass", "body", "decorators"], visitor: [ "id", @@ -152,40 +124,22 @@ defineType("ClassDeclaration", { "implements", "decorators", ], - aliases: ["Scopable", "Class", "Statement", "Declaration", "Pureish"], + aliases: ["Scopable", "Class", "Expression"], fields: { - ...classCommon, - declare: { - validate: assertValueType("boolean"), - optional: true, - }, - abstract: { - validate: assertValueType("boolean"), - optional: true, - }, id: { validate: assertNodeType("Identifier"), - optional: true, // Missing if this is the child of an ExportDefaultDeclaration. + // In declarations, this is missing if this is the + // child of an ExportDefaultDeclaration. + optional: true, }, - decorators: { - validate: chain( - assertValueType("array"), - assertEach(assertNodeType("Decorator")), + typeParameters: { + validate: assertNodeType( + "TypeParameterDeclaration", + "TSTypeParameterDeclaration", + "Noop", ), optional: true, }, - }, -}); - -defineType("ClassExpression", { - inherits: "ClassDeclaration", - aliases: ["Scopable", "Class", "Expression", "Pureish"], - fields: { - ...classCommon, - id: { - optional: true, - validate: assertNodeType("Identifier"), - }, body: { validate: assertNodeType("ClassBody"), }, @@ -193,6 +147,22 @@ defineType("ClassExpression", { optional: true, validate: assertNodeType("Expression"), }, + superTypeParameters: { + validate: assertNodeType( + "TypeParameterInstantiation", + "TSTypeParameterInstantiation", + ), + optional: true, + }, + implements: { + validate: chain( + assertValueType("array"), + assertEach( + assertNodeType("TSExpressionWithTypeArguments", "ClassImplements"), + ), + ), + optional: true, + }, decorators: { validate: chain( assertValueType("array"), @@ -203,6 +173,32 @@ defineType("ClassExpression", { }, }); +defineType("ClassDeclaration", { + inherits: "ClassExpression", + aliases: ["Scopable", "Class", "Statement", "Declaration"], + fields: { + declare: { + validate: assertValueType("boolean"), + optional: true, + }, + abstract: { + validate: assertValueType("boolean"), + optional: true, + }, + }, + validate: (function() { + const identifier = assertNodeType("Identifier"); + + return function(parent, key, node) { + if (!process.env.BABEL_TYPES_8_BREAKING) return; + + if (!is("ExportDefaultDeclaration", parent)) { + identifier(node, "id", node.id); + } + }; + })(), +}); + defineType("ExportAllDeclaration", { visitor: ["source"], aliases: [ @@ -248,18 +244,53 @@ defineType("ExportNamedDeclaration", { ], fields: { declaration: { - validate: assertNodeType("Declaration"), optional: true, + validate: chain( + assertNodeType("Declaration"), + function(node, key, val) { + if (!process.env.BABEL_TYPES_8_BREAKING) return; + + // This validator isn't put at the top level because we can run it + // even if this node doesn't have a parent. + + if (val && node.specifiers.length) { + throw new TypeError( + "Only declaration or specifiers is allowed on ExportNamedDeclaration", + ); + } + }, + function(node, key, val) { + if (!process.env.BABEL_TYPES_8_BREAKING) return; + + // This validator isn't put at the top level because we can run it + // even if this node doesn't have a parent. + + if (val && node.source) { + throw new TypeError("Cannot export a declaration from a source"); + } + }, + ), }, specifiers: { + default: [], validate: chain( assertValueType("array"), assertEach( - assertNodeType( - "ExportSpecifier", - "ExportDefaultSpecifier", - "ExportNamespaceSpecifier", - ), + (function() { + const sourced = assertNodeType( + "ExportSpecifier", + "ExportDefaultSpecifier", + "ExportNamespaceSpecifier", + ); + const sourceless = assertNodeType("ExportSpecifier"); + + if (!process.env.BABEL_TYPES_8_BREAKING) return sourced; + + return function(node, key, val) { + const validator = node.source ? sourced : sourceless; + validator(node, key, val); + }; + })(), ), ), }, @@ -286,6 +317,7 @@ defineType("ExportSpecifier", { defineType("ForOfStatement", { visitor: ["left", "right", "body"], + builder: ["left", "right", "body", "await"], aliases: [ "Scopable", "Statement", @@ -296,7 +328,27 @@ defineType("ForOfStatement", { ], fields: { left: { - validate: assertNodeType("VariableDeclaration", "LVal"), + validate: (function() { + if (!process.env.BABEL_TYPES_8_BREAKING) { + return assertNodeType("VariableDeclaration", "LVal"); + } + + const declaration = assertNodeType("VariableDeclaration"); + const lval = assertNodeType( + "Identifier", + "MemberExpression", + "ArrayPattern", + "ObjectPattern", + ); + + return function(node, key, val) { + if (is("VariableDeclaration", val)) { + declaration(node, key, val); + } else { + lval(node, key, val); + } + }; + })(), }, right: { validate: assertNodeType("Expression"), @@ -306,7 +358,6 @@ defineType("ForOfStatement", { }, await: { default: false, - validate: assertValueType("boolean"), }, }, }); @@ -331,7 +382,8 @@ defineType("ImportDeclaration", { validate: assertNodeType("StringLiteral"), }, importKind: { - // Handle Flowtype's extension "import {typeof foo} from" + // Handle TypeScript/Flowtype's extension "import type foo from" + // TypeScript doesn't support typeof validate: assertOneOf("type", "typeof", "value"), optional: true, }, @@ -380,9 +432,26 @@ defineType("MetaProperty", { visitor: ["meta", "property"], aliases: ["Expression"], fields: { - // todo: limit to new.target meta: { - validate: assertNodeType("Identifier"), + validate: chain(assertNodeType("Identifier"), function(node, key, val) { + if (!process.env.BABEL_TYPES_8_BREAKING) return; + + let property; + switch (val.name) { + case "function": + property = "sent"; + break; + case "new": + property = "target"; + break; + case "import": + property = "meta"; + break; + } + if (!is("Identifier", node.property, { name: property })) { + throw new TypeError("Unrecognised MetaProperty"); + } + }), }, property: { validate: assertNodeType("Identifier"), @@ -396,19 +465,14 @@ export const classMethodOrPropertyCommon = { optional: true, }, accessibility: { - validate: chain( - assertValueType("string"), - assertOneOf("public", "private", "protected"), - ), + validate: assertOneOf("public", "private", "protected"), optional: true, }, static: { - validate: assertValueType("boolean"), - optional: true, + default: false, }, computed: { default: false, - validate: assertValueType("boolean"), }, optional: { validate: assertValueType("boolean"), @@ -443,10 +507,7 @@ export const classMethodOrDeclareMethodCommon = { ...functionCommon, ...classMethodOrPropertyCommon, kind: { - validate: chain( - assertValueType("string"), - assertOneOf("get", "set", "method", "constructor"), - ), + validate: assertOneOf("get", "set", "method", "constructor"), default: "method", }, access: { @@ -467,7 +528,16 @@ export const classMethodOrDeclareMethodCommon = { defineType("ClassMethod", { aliases: ["Function", "Scopable", "BlockParent", "FunctionParent", "Method"], - builder: ["kind", "key", "params", "body", "computed", "static"], + builder: [ + "kind", + "key", + "params", + "body", + "computed", + "static", + "generator", + "async", + ], visitor: [ "key", "params", @@ -554,7 +624,6 @@ defineType("TemplateElement", { }), }, tail: { - validate: assertValueType("boolean"), default: false, }, }, @@ -574,6 +643,16 @@ defineType("TemplateLiteral", { validate: chain( assertValueType("array"), assertEach(assertNodeType("Expression")), + function(node, key, val) { + if (node.quasis.length !== val.length + 1) { + throw new TypeError( + `Number of ${ + node.type + } quasis should be exactly one more than the number of expressions.\nExpected ${val.length + + 1} quasis but got ${node.quasis.length}`, + ); + } + }, ), }, }, @@ -585,7 +664,15 @@ defineType("YieldExpression", { aliases: ["Expression", "Terminatorless"], fields: { delegate: { - validate: assertValueType("boolean"), + validate: chain(assertValueType("boolean"), function(node, key, val) { + if (!process.env.BABEL_TYPES_8_BREAKING) return; + + if (val && !node.argument) { + throw new TypeError( + "Property delegate of YieldExpression cannot be true if there is no argument", + ); + } + }), default: false, }, argument: { diff --git a/packages/babel-types/src/definitions/experimental.js b/packages/babel-types/src/definitions/experimental.js index ed088af74bd6..062f96660707 100644 --- a/packages/babel-types/src/definitions/experimental.js +++ b/packages/babel-types/src/definitions/experimental.js @@ -1,7 +1,9 @@ // @flow import defineType, { + assertOptionalChainStart, assertEach, assertNodeType, + assertNodeOrValueType, assertValueType, chain, } from "./utils"; @@ -26,14 +28,28 @@ defineType("AwaitExpression", { defineType("BindExpression", { visitor: ["object", "callee"], aliases: ["Expression"], - fields: { - // todo - }, + fields: !process.env.BABEL_TYPES_8_BREAKING + ? {} + : { + object: { + validate: assertNodeType("Expression"), + }, + callee: { + validate: assertNodeType("Expression"), + }, + }, }); defineType("ClassProperty", { visitor: ["key", "value", "typeAnnotation", "decorators"], - builder: ["key", "value", "typeAnnotation", "decorators", "computed"], + builder: [ + "key", + "value", + "typeAnnotation", + "decorators", + "computed", + "static", + ], aliases: ["Property"], fields: { ...classMethodOrPropertyCommon, @@ -60,6 +76,10 @@ defineType("ClassProperty", { validate: assertValueType("boolean"), optional: true, }, + declare: { + validate: assertValueType("boolean"), + optional: true, + }, }, }); @@ -86,7 +106,9 @@ defineType("OptionalMemberExpression", { default: false, }, optional: { - validate: assertValueType("boolean"), + validate: !process.env.BABEL_TYPES_8_BREAKING + ? assertValueType("boolean") + : chain(assertValueType("boolean"), assertOptionalChainStart()), }, }, }); @@ -132,7 +154,9 @@ defineType("OptionalCallExpression", { ), }, optional: { - validate: assertValueType("boolean"), + validate: !process.env.BABEL_TYPES_8_BREAKING + ? assertValueType("boolean") + : chain(assertValueType("boolean"), assertOptionalChainStart()), }, typeArguments: { validate: assertNodeType("TypeParameterInstantiation"), @@ -146,8 +170,8 @@ defineType("OptionalCallExpression", { }); defineType("ClassPrivateProperty", { - visitor: ["key", "value"], - builder: ["key", "value"], + visitor: ["key", "value", "decorators"], + builder: ["key", "value", "decorators"], aliases: ["Property", "Private"], fields: { key: { @@ -157,6 +181,13 @@ defineType("ClassPrivateProperty", { validate: assertNodeType("Expression"), optional: true, }, + decorators: { + validate: chain( + assertValueType("array"), + assertEach(assertNodeType("Decorator")), + ), + optional: true, + }, }, }); @@ -251,3 +282,34 @@ defineType("BigIntLiteral", { }, aliases: ["Expression", "Pureish", "Literal", "Immutable"], }); + +defineType("RecordExpression", { + visitor: ["properties"], + aliases: ["Expression"], + fields: { + properties: { + validate: chain( + assertValueType("array"), + assertEach( + assertNodeType("ObjectProperty", "ObjectMethod", "SpreadElement"), + ), + ), + }, + }, +}); + +defineType("TupleExpression", { + fields: { + elements: { + validate: chain( + assertValueType("array"), + assertEach( + assertNodeOrValueType("null", "Expression", "SpreadElement"), + ), + ), + default: [], + }, + }, + visitor: ["elements"], + aliases: ["Expression"], +}); diff --git a/packages/babel-types/src/definitions/flow.js b/packages/babel-types/src/definitions/flow.js index 75f6c8801966..182b6fec6e4e 100644 --- a/packages/babel-types/src/definitions/flow.js +++ b/packages/babel-types/src/definitions/flow.js @@ -4,6 +4,7 @@ import defineType, { assertOneOf, assertValueType, validate, + validateArrayOfType, validateOptional, validateOptionalType, validateType, @@ -371,6 +372,10 @@ defineType("StringTypeAnnotation", { aliases: ["Flow", "FlowType", "FlowBaseAnnotation"], }); +defineType("SymbolTypeAnnotation", { + aliases: ["Flow", "FlowType", "FlowBaseAnnotation"], +}); + defineType("ThisTypeAnnotation", { aliases: ["Flow", "FlowType", "FlowBaseAnnotation"], }); @@ -464,3 +469,88 @@ defineType("Variance", { defineType("VoidTypeAnnotation", { aliases: ["Flow", "FlowType", "FlowBaseAnnotation"], }); + +// Enums +defineType("EnumDeclaration", { + aliases: ["Statement", "Declaration"], + visitor: ["id", "body"], + fields: { + id: validateType("Identifier"), + body: validateType([ + "EnumBooleanBody", + "EnumNumberBody", + "EnumStringBody", + "EnumSymbolBody", + ]), + }, +}); + +defineType("EnumBooleanBody", { + aliases: ["EnumBody"], + visitor: ["members"], + fields: { + explicit: validate(assertValueType("boolean")), + members: validateArrayOfType("EnumBooleanMember"), + }, +}); + +defineType("EnumNumberBody", { + aliases: ["EnumBody"], + visitor: ["members"], + fields: { + explicit: validate(assertValueType("boolean")), + members: validateArrayOfType("EnumNumberMember"), + }, +}); + +defineType("EnumStringBody", { + aliases: ["EnumBody"], + visitor: ["members"], + fields: { + explicit: validate(assertValueType("boolean")), + members: validateArrayOfType(["EnumStringMember", "EnumDefaultedMember"]), + }, +}); + +defineType("EnumSymbolBody", { + aliases: ["EnumBody"], + visitor: ["members"], + fields: { + members: validateArrayOfType("EnumDefaultedMember"), + }, +}); + +defineType("EnumBooleanMember", { + aliases: ["EnumMember"], + visitor: ["id"], + fields: { + id: validateType("Identifier"), + init: validateType("BooleanLiteral"), + }, +}); + +defineType("EnumNumberMember", { + aliases: ["EnumMember"], + visitor: ["id", "init"], + fields: { + id: validateType("Identifier"), + init: validateType("NumericLiteral"), + }, +}); + +defineType("EnumStringMember", { + aliases: ["EnumMember"], + visitor: ["id", "init"], + fields: { + id: validateType("Identifier"), + init: validateType("StringLiteral"), + }, +}); + +defineType("EnumDefaultedMember", { + aliases: ["EnumMember"], + visitor: ["id"], + fields: { + id: validateType("Identifier"), + }, +}); diff --git a/packages/babel-types/src/definitions/index.js b/packages/babel-types/src/definitions/index.js index d6e1763ebdf0..7341c67369a9 100644 --- a/packages/babel-types/src/definitions/index.js +++ b/packages/babel-types/src/definitions/index.js @@ -14,6 +14,7 @@ import { NODE_FIELDS, BUILDER_KEYS, DEPRECATED_KEYS, + NODE_PARENT_VALIDATIONS, } from "./utils"; import { PLACEHOLDERS, @@ -43,6 +44,7 @@ export { NODE_FIELDS, BUILDER_KEYS, DEPRECATED_KEYS, + NODE_PARENT_VALIDATIONS, PLACEHOLDERS, PLACEHOLDERS_ALIAS, PLACEHOLDERS_FLIPPED_ALIAS, diff --git a/packages/babel-types/src/definitions/jsx.js b/packages/babel-types/src/definitions/jsx.js index 776714c873f7..9b74dd52f488 100644 --- a/packages/babel-types/src/definitions/jsx.js +++ b/packages/babel-types/src/definitions/jsx.js @@ -30,7 +30,11 @@ defineType("JSXClosingElement", { aliases: ["JSX", "Immutable"], fields: { name: { - validate: assertNodeType("JSXIdentifier", "JSXMemberExpression"), + validate: assertNodeType( + "JSXIdentifier", + "JSXMemberExpression", + "JSXNamespacedName", + ), }, }, }); @@ -130,11 +134,14 @@ defineType("JSXOpeningElement", { aliases: ["JSX", "Immutable"], fields: { name: { - validate: assertNodeType("JSXIdentifier", "JSXMemberExpression"), + validate: assertNodeType( + "JSXIdentifier", + "JSXMemberExpression", + "JSXNamespacedName", + ), }, selfClosing: { default: false, - validate: assertValueType("boolean"), }, attributes: { validate: chain( diff --git a/packages/babel-types/src/definitions/misc.js b/packages/babel-types/src/definitions/misc.js index e319235b2c15..da67c68706fc 100644 --- a/packages/babel-types/src/definitions/misc.js +++ b/packages/babel-types/src/definitions/misc.js @@ -1,5 +1,9 @@ // @flow -import defineType, { assertNodeType, assertOneOf } from "./utils"; +import defineType, { + assertNodeType, + assertOneOf, + assertValueType, +} from "./utils"; import { PLACEHOLDERS } from "./placeholders"; defineType("Noop", { @@ -19,3 +23,12 @@ defineType("Placeholder", { }, }, }); + +defineType("V8IntrinsicIdentifier", { + builder: ["name"], + fields: { + name: { + validate: assertValueType("string"), + }, + }, +}); diff --git a/packages/babel-types/src/definitions/typescript.js b/packages/babel-types/src/definitions/typescript.js index 843f2408ecc9..421b16c47d6c 100644 --- a/packages/babel-types/src/definitions/typescript.js +++ b/packages/babel-types/src/definitions/typescript.js @@ -128,28 +128,29 @@ defineType("TSIndexSignature", { const tsKeywordTypes = [ "TSAnyKeyword", - "TSUnknownKeyword", + "TSBooleanKeyword", + "TSBigIntKeyword", + "TSNeverKeyword", + "TSNullKeyword", "TSNumberKeyword", "TSObjectKeyword", - "TSBooleanKeyword", "TSStringKeyword", "TSSymbolKeyword", - "TSVoidKeyword", "TSUndefinedKeyword", - "TSNullKeyword", - "TSNeverKeyword", + "TSUnknownKeyword", + "TSVoidKeyword", ]; for (const type of tsKeywordTypes) { defineType(type, { - aliases: ["TSType"], + aliases: ["TSType", "TSBaseType"], visitor: [], fields: {}, }); } defineType("TSThisType", { - aliases: ["TSType"], + aliases: ["TSType", "TSBaseType"], visitor: [], fields: {}, }); @@ -175,9 +176,11 @@ defineType("TSTypeReference", { defineType("TSTypePredicate", { aliases: ["TSType"], visitor: ["parameterName", "typeAnnotation"], + builder: ["parameterName", "typeAnnotation", "asserts"], fields: { parameterName: validateType(["Identifier", "TSThisType"]), - typeAnnotation: validateType("TSTypeAnnotation"), + typeAnnotation: validateOptionalType("TSTypeAnnotation"), + asserts: validateOptional(bool), }, }); @@ -297,7 +300,7 @@ defineType("TSMappedType", { }); defineType("TSLiteralType", { - aliases: ["TSType"], + aliases: ["TSType", "TSBaseType"], visitor: ["literal"], fields: { literal: validateType([ @@ -494,6 +497,7 @@ defineType("TSTypeParameterDeclaration", { }); defineType("TSTypeParameter", { + builder: ["constraint", "default", "name"], visitor: ["constraint", "default"], fields: { name: { diff --git a/packages/babel-types/src/definitions/utils.js b/packages/babel-types/src/definitions/utils.js index 3f7225bd50b2..6fc112be19a2 100644 --- a/packages/babel-types/src/definitions/utils.js +++ b/packages/babel-types/src/definitions/utils.js @@ -1,6 +1,6 @@ // @flow import is from "../validators/is"; -import { validateField } from "../validators/validate"; +import { validateField, validateChild } from "../validators/validate"; export const VISITOR_KEYS: { [string]: Array } = {}; export const ALIAS_KEYS: { [string]: Array } = {}; @@ -8,14 +8,13 @@ export const FLIPPED_ALIAS_KEYS: { [string]: Array } = {}; export const NODE_FIELDS: { [string]: {} } = {}; export const BUILDER_KEYS: { [string]: Array } = {}; export const DEPRECATED_KEYS: { [string]: string } = {}; +export const NODE_PARENT_VALIDATIONS = {}; function getType(val) { if (Array.isArray(val)) { return "array"; } else if (val === null) { return "null"; - } else if (val === undefined) { - return "undefined"; } else { return typeof val; } @@ -71,7 +70,10 @@ export function assertEach(callback: Validator): Validator { if (!Array.isArray(val)) return; for (let i = 0; i < val.length; i++) { - callback(node, `${key}[${i}]`, val[i]); + const subkey = `${key}[${i}]`; + const v = val[i]; + callback(node, subkey, v); + if (process.env.BABEL_TYPES_8_BREAKING) validateChild(node, subkey, v); } } validator.each = callback; @@ -96,23 +98,20 @@ export function assertOneOf(...values: Array): Validator { export function assertNodeType(...types: Array): Validator { function validate(node, key, val) { - let valid = false; - for (const type of types) { if (is(type, val)) { - valid = true; - break; + validateChild(node, key, val); + return; } } - if (!valid) { - throw new TypeError( - `Property ${key} of ${ - node.type - } expected node to be of a type ${JSON.stringify(types)} ` + - `but instead got ${JSON.stringify(val && val.type)}`, - ); - } + throw new TypeError( + `Property ${key} of ${ + node.type + } expected node to be of a type ${JSON.stringify( + types, + )} but instead got ${JSON.stringify(val && val.type)}`, + ); } validate.oneOfNodeTypes = types; @@ -122,23 +121,20 @@ export function assertNodeType(...types: Array): Validator { export function assertNodeOrValueType(...types: Array): Validator { function validate(node, key, val) { - let valid = false; - for (const type of types) { if (getType(val) === type || is(type, val)) { - valid = true; - break; + validateChild(node, key, val); + return; } } - if (!valid) { - throw new TypeError( - `Property ${key} of ${ - node.type - } expected node to be of a type ${JSON.stringify(types)} ` + - `but instead got ${JSON.stringify(val && val.type)}`, - ); - } + throw new TypeError( + `Property ${key} of ${ + node.type + } expected node to be of a type ${JSON.stringify( + types, + )} but instead got ${JSON.stringify(val && val.type)}`, + ); } validate.oneOfNodeOrValueTypes = types; @@ -190,6 +186,34 @@ export function assertShape(shape: { [string]: FieldOptions }): Validator { return validate; } +export function assertOptionalChainStart(): Validator { + function validate(node) { + let current = node; + while (node) { + const { type } = current; + if (type === "OptionalCallExpression") { + if (current.optional) return; + current = current.callee; + continue; + } + + if (type === "OptionalMemberExpression") { + if (current.optional) return; + current = current.object; + continue; + } + + break; + } + + throw new TypeError( + `Non-optional ${node.type} must chain from an optional OptionalMemberExpression or OptionalCallExpression. Found chain from ${current?.type}`, + ); + } + + return validate; +} + export function chain(...fns: Array): Validator { function validate(...args) { for (const fn of fns) { @@ -200,6 +224,17 @@ export function chain(...fns: Array): Validator { return validate; } +const validTypeOpts = [ + "aliases", + "builder", + "deprecatedAlias", + "fields", + "inherits", + "visitor", + "validate", +]; +const validFieldKeys = ["default", "optional", "validate"]; + export default function defineType( type: string, opts: { @@ -211,16 +246,38 @@ export default function defineType( builder?: Array, inherits?: string, deprecatedAlias?: string, + validate?: Validator, } = {}, ) { const inherits = (opts.inherits && store[opts.inherits]) || {}; - const fields: Object = opts.fields || inherits.fields || {}; + let fields = opts.fields; + if (!fields) { + fields = {}; + if (inherits.fields) { + const keys = Object.getOwnPropertyNames(inherits.fields); + for (const key of (keys: Array)) { + const field = inherits.fields[key]; + fields[key] = { + default: field.default, + optional: field.optional, + validate: field.validate, + }; + } + } + } + const visitor: Array = opts.visitor || inherits.visitor || []; const aliases: Array = opts.aliases || inherits.aliases || []; const builder: Array = opts.builder || inherits.builder || opts.visitor || []; + for (const k of (Object.keys(opts): Array)) { + if (validTypeOpts.indexOf(k) === -1) { + throw new Error(`Unknown type option "${k}" on ${type}`); + } + } + if (opts.deprecatedAlias) { DEPRECATED_KEYS[opts.deprecatedAlias] = type; } @@ -233,14 +290,20 @@ export default function defineType( for (const key of Object.keys(fields)) { const field = fields[key]; - if (builder.indexOf(key) === -1) { + if (field.default !== undefined && builder.indexOf(key) === -1) { field.optional = true; } if (field.default === undefined) { field.default = null; - } else if (!field.validate) { + } else if (!field.validate && field.default != null) { field.validate = assertValueType(getType(field.default)); } + + for (const k of (Object.keys(field): Array)) { + if (validFieldKeys.indexOf(k) === -1) { + throw new Error(`Unknown field key "${k}" on ${type}.${key}`); + } + } } VISITOR_KEYS[type] = opts.visitor = visitor; @@ -252,6 +315,10 @@ export default function defineType( FLIPPED_ALIAS_KEYS[alias].push(type); }); + if (opts.validate) { + NODE_PARENT_VALIDATIONS[type] = opts.validate; + } + store[type] = opts; } diff --git a/packages/babel-types/src/index.js b/packages/babel-types/src/index.js index d3311dfc9f2f..7239401fd68f 100644 --- a/packages/babel-types/src/index.js +++ b/packages/babel-types/src/index.js @@ -7,34 +7,27 @@ import buildChildren from "./builders/react/buildChildren"; export { default as assertNode } from "./asserts/assertNode"; export * from "./asserts/generated"; -//builders -export { - default as createTypeAnnotationBasedOnTypeof, -} from "./builders/flow/createTypeAnnotationBasedOnTypeof"; -export { - default as createUnionTypeAnnotation, -} from "./builders/flow/createUnionTypeAnnotation"; +// builders +export { default as createTypeAnnotationBasedOnTypeof } from "./builders/flow/createTypeAnnotationBasedOnTypeof"; +export { default as createUnionTypeAnnotation } from "./builders/flow/createFlowUnionType"; +export { default as createFlowUnionType } from "./builders/flow/createFlowUnionType"; +export { default as createTSUnionType } from "./builders/typescript/createTSUnionType"; export * from "./builders/generated"; // clone export { default as cloneNode } from "./clone/cloneNode"; export { default as clone } from "./clone/clone"; export { default as cloneDeep } from "./clone/cloneDeep"; +export { default as cloneDeepWithoutLoc } from "./clone/cloneDeepWithoutLoc"; export { default as cloneWithoutLoc } from "./clone/cloneWithoutLoc"; // comments export { default as addComment } from "./comments/addComment"; export { default as addComments } from "./comments/addComments"; -export { - default as inheritInnerComments, -} from "./comments/inheritInnerComments"; -export { - default as inheritLeadingComments, -} from "./comments/inheritLeadingComments"; +export { default as inheritInnerComments } from "./comments/inheritInnerComments"; +export { default as inheritLeadingComments } from "./comments/inheritLeadingComments"; export { default as inheritsComments } from "./comments/inheritsComments"; -export { - default as inheritTrailingComments, -} from "./comments/inheritTrailingComments"; +export { default as inheritTrailingComments } from "./comments/inheritTrailingComments"; export { default as removeComments } from "./comments/removeComments"; // constants @@ -43,17 +36,13 @@ export * from "./constants"; // converters export { default as ensureBlock } from "./converters/ensureBlock"; -export { - default as toBindingIdentifierName, -} from "./converters/toBindingIdentifierName"; +export { default as toBindingIdentifierName } from "./converters/toBindingIdentifierName"; export { default as toBlock } from "./converters/toBlock"; export { default as toComputedKey } from "./converters/toComputedKey"; export { default as toExpression } from "./converters/toExpression"; export { default as toIdentifier } from "./converters/toIdentifier"; export { default as toKeyAlias } from "./converters/toKeyAlias"; -export { - default as toSequenceExpression, -} from "./converters/toSequenceExpression"; +export { default as toSequenceExpression } from "./converters/toSequenceExpression"; export { default as toStatement } from "./converters/toStatement"; export { default as valueToNode } from "./converters/valueToNode"; @@ -61,28 +50,16 @@ export { default as valueToNode } from "./converters/valueToNode"; export * from "./definitions"; // modifications -export { - default as appendToMemberExpression, -} from "./modifications/appendToMemberExpression"; +export { default as appendToMemberExpression } from "./modifications/appendToMemberExpression"; export { default as inherits } from "./modifications/inherits"; -export { - default as prependToMemberExpression, -} from "./modifications/prependToMemberExpression"; +export { default as prependToMemberExpression } from "./modifications/prependToMemberExpression"; export { default as removeProperties } from "./modifications/removeProperties"; -export { - default as removePropertiesDeep, -} from "./modifications/removePropertiesDeep"; -export { - default as removeTypeDuplicates, -} from "./modifications/flow/removeTypeDuplicates"; +export { default as removePropertiesDeep } from "./modifications/removePropertiesDeep"; +export { default as removeTypeDuplicates } from "./modifications/flow/removeTypeDuplicates"; // retrievers -export { - default as getBindingIdentifiers, -} from "./retrievers/getBindingIdentifiers"; -export { - default as getOuterBindingIdentifiers, -} from "./retrievers/getOuterBindingIdentifiers"; +export { default as getBindingIdentifiers } from "./retrievers/getBindingIdentifiers"; +export { default as getOuterBindingIdentifiers } from "./retrievers/getOuterBindingIdentifiers"; // traverse export { default as traverse } from "./traverse/traverse"; @@ -105,16 +82,12 @@ export { default as isReferenced } from "./validators/isReferenced"; export { default as isScope } from "./validators/isScope"; export { default as isSpecifierDefault } from "./validators/isSpecifierDefault"; export { default as isType } from "./validators/isType"; -export { - default as isValidES3Identifier, -} from "./validators/isValidES3Identifier"; +export { default as isValidES3Identifier } from "./validators/isValidES3Identifier"; export { default as isValidIdentifier } from "./validators/isValidIdentifier"; export { default as isVar } from "./validators/isVar"; export { default as matchesPattern } from "./validators/matchesPattern"; export { default as validate } from "./validators/validate"; -export { - default as buildMatchMemberExpression, -} from "./validators/buildMatchMemberExpression"; +export { default as buildMatchMemberExpression } from "./validators/buildMatchMemberExpression"; export * from "./validators/generated"; // react diff --git a/packages/babel-types/src/modifications/typescript/removeTypeDuplicates.js b/packages/babel-types/src/modifications/typescript/removeTypeDuplicates.js new file mode 100644 index 000000000000..1ed0e34f3f2b --- /dev/null +++ b/packages/babel-types/src/modifications/typescript/removeTypeDuplicates.js @@ -0,0 +1,65 @@ +import { + isTSAnyKeyword, + isTSUnionType, + isTSBaseType, +} from "../../validators/generated"; + +/** + * Dedupe type annotations. + */ +export default function removeTypeDuplicates( + nodes: Array, +): Array { + const generics = {}; + const bases = {}; + + // store union type groups to circular references + const typeGroups = []; + + const types = []; + + for (let i = 0; i < nodes.length; i++) { + const node = nodes[i]; + if (!node) continue; + + // detect duplicates + if (types.indexOf(node) >= 0) { + continue; + } + + // this type matches anything + if (isTSAnyKeyword(node.type)) { + return [node]; + } + + // Analogue of FlowBaseAnnotation + if (isTSBaseType(node)) { + bases[node.type] = node; + continue; + } + + if (isTSUnionType(node)) { + if (typeGroups.indexOf(node.types) < 0) { + nodes = nodes.concat(node.types); + typeGroups.push(node.types); + } + continue; + } + + // TODO: add generic types + + types.push(node); + } + + // add back in bases + for (const type of Object.keys(bases)) { + types.push(bases[type]); + } + + // add back in generics + for (const name of Object.keys(generics)) { + types.push(generics[name]); + } + + return types; +} diff --git a/packages/babel-types/src/traverse/traverseFast.js b/packages/babel-types/src/traverse/traverseFast.js index 580628343cfb..e262c10ad47d 100644 --- a/packages/babel-types/src/traverse/traverseFast.js +++ b/packages/babel-types/src/traverse/traverseFast.js @@ -7,7 +7,7 @@ import { VISITOR_KEYS } from "../definitions"; */ export default function traverseFast( node: Object, - enter: (node: Node, opts?: Object) => void, + enter: (node: BabelNode, opts?: Object) => void, opts?: Object, ): void { if (!node) return; diff --git a/packages/babel-types/src/validators/generated/index.js b/packages/babel-types/src/validators/generated/index.js index 076495d5cb28..4fc045c201a9 100644 --- a/packages/babel-types/src/validators/generated/index.js +++ b/packages/babel-types/src/validators/generated/index.js @@ -781,11 +781,11 @@ export function isClassBody(node: ?Object, opts?: Object): boolean { return false; } -export function isClassDeclaration(node: ?Object, opts?: Object): boolean { +export function isClassExpression(node: ?Object, opts?: Object): boolean { if (!node) return false; const nodeType = node.type; - if (nodeType === "ClassDeclaration") { + if (nodeType === "ClassExpression") { if (typeof opts === "undefined") { return true; } else { @@ -795,11 +795,11 @@ export function isClassDeclaration(node: ?Object, opts?: Object): boolean { return false; } -export function isClassExpression(node: ?Object, opts?: Object): boolean { +export function isClassDeclaration(node: ?Object, opts?: Object): boolean { if (!node) return false; const nodeType = node.type; - if (nodeType === "ClassExpression") { + if (nodeType === "ClassDeclaration") { if (typeof opts === "undefined") { return true; } else { @@ -1692,6 +1692,20 @@ export function isStringTypeAnnotation(node: ?Object, opts?: Object): boolean { return false; } +export function isSymbolTypeAnnotation(node: ?Object, opts?: Object): boolean { + if (!node) return false; + + const nodeType = node.type; + if (nodeType === "SymbolTypeAnnotation") { + if (typeof opts === "undefined") { + return true; + } else { + return shallowEqual(node, opts); + } + } + + return false; +} export function isThisTypeAnnotation(node: ?Object, opts?: Object): boolean { if (!node) return false; @@ -1866,6 +1880,132 @@ export function isVoidTypeAnnotation(node: ?Object, opts?: Object): boolean { return false; } +export function isEnumDeclaration(node: ?Object, opts?: Object): boolean { + if (!node) return false; + + const nodeType = node.type; + if (nodeType === "EnumDeclaration") { + if (typeof opts === "undefined") { + return true; + } else { + return shallowEqual(node, opts); + } + } + + return false; +} +export function isEnumBooleanBody(node: ?Object, opts?: Object): boolean { + if (!node) return false; + + const nodeType = node.type; + if (nodeType === "EnumBooleanBody") { + if (typeof opts === "undefined") { + return true; + } else { + return shallowEqual(node, opts); + } + } + + return false; +} +export function isEnumNumberBody(node: ?Object, opts?: Object): boolean { + if (!node) return false; + + const nodeType = node.type; + if (nodeType === "EnumNumberBody") { + if (typeof opts === "undefined") { + return true; + } else { + return shallowEqual(node, opts); + } + } + + return false; +} +export function isEnumStringBody(node: ?Object, opts?: Object): boolean { + if (!node) return false; + + const nodeType = node.type; + if (nodeType === "EnumStringBody") { + if (typeof opts === "undefined") { + return true; + } else { + return shallowEqual(node, opts); + } + } + + return false; +} +export function isEnumSymbolBody(node: ?Object, opts?: Object): boolean { + if (!node) return false; + + const nodeType = node.type; + if (nodeType === "EnumSymbolBody") { + if (typeof opts === "undefined") { + return true; + } else { + return shallowEqual(node, opts); + } + } + + return false; +} +export function isEnumBooleanMember(node: ?Object, opts?: Object): boolean { + if (!node) return false; + + const nodeType = node.type; + if (nodeType === "EnumBooleanMember") { + if (typeof opts === "undefined") { + return true; + } else { + return shallowEqual(node, opts); + } + } + + return false; +} +export function isEnumNumberMember(node: ?Object, opts?: Object): boolean { + if (!node) return false; + + const nodeType = node.type; + if (nodeType === "EnumNumberMember") { + if (typeof opts === "undefined") { + return true; + } else { + return shallowEqual(node, opts); + } + } + + return false; +} +export function isEnumStringMember(node: ?Object, opts?: Object): boolean { + if (!node) return false; + + const nodeType = node.type; + if (nodeType === "EnumStringMember") { + if (typeof opts === "undefined") { + return true; + } else { + return shallowEqual(node, opts); + } + } + + return false; +} +export function isEnumDefaultedMember(node: ?Object, opts?: Object): boolean { + if (!node) return false; + + const nodeType = node.type; + if (nodeType === "EnumDefaultedMember") { + if (typeof opts === "undefined") { + return true; + } else { + return shallowEqual(node, opts); + } + } + + return false; +} export function isJSXAttribute(node: ?Object, opts?: Object): boolean { if (!node) return false; @@ -2107,6 +2247,20 @@ export function isPlaceholder(node: ?Object, opts?: Object): boolean { return false; } +export function isV8IntrinsicIdentifier(node: ?Object, opts?: Object): boolean { + if (!node) return false; + + const nodeType = node.type; + if (nodeType === "V8IntrinsicIdentifier") { + if (typeof opts === "undefined") { + return true; + } else { + return shallowEqual(node, opts); + } + } + + return false; +} export function isArgumentPlaceholder(node: ?Object, opts?: Object): boolean { if (!node) return false; @@ -2377,6 +2531,34 @@ export function isBigIntLiteral(node: ?Object, opts?: Object): boolean { return false; } +export function isRecordExpression(node: ?Object, opts?: Object): boolean { + if (!node) return false; + + const nodeType = node.type; + if (nodeType === "RecordExpression") { + if (typeof opts === "undefined") { + return true; + } else { + return shallowEqual(node, opts); + } + } + + return false; +} +export function isTupleExpression(node: ?Object, opts?: Object): boolean { + if (!node) return false; + + const nodeType = node.type; + if (nodeType === "TupleExpression") { + if (typeof opts === "undefined") { + return true; + } else { + return shallowEqual(node, opts); + } + } + + return false; +} export function isTSParameterProperty(node: ?Object, opts?: Object): boolean { if (!node) return false; @@ -2523,11 +2705,11 @@ export function isTSAnyKeyword(node: ?Object, opts?: Object): boolean { return false; } -export function isTSUnknownKeyword(node: ?Object, opts?: Object): boolean { +export function isTSBooleanKeyword(node: ?Object, opts?: Object): boolean { if (!node) return false; const nodeType = node.type; - if (nodeType === "TSUnknownKeyword") { + if (nodeType === "TSBooleanKeyword") { if (typeof opts === "undefined") { return true; } else { @@ -2537,11 +2719,11 @@ export function isTSUnknownKeyword(node: ?Object, opts?: Object): boolean { return false; } -export function isTSNumberKeyword(node: ?Object, opts?: Object): boolean { +export function isTSBigIntKeyword(node: ?Object, opts?: Object): boolean { if (!node) return false; const nodeType = node.type; - if (nodeType === "TSNumberKeyword") { + if (nodeType === "TSBigIntKeyword") { if (typeof opts === "undefined") { return true; } else { @@ -2551,11 +2733,11 @@ export function isTSNumberKeyword(node: ?Object, opts?: Object): boolean { return false; } -export function isTSObjectKeyword(node: ?Object, opts?: Object): boolean { +export function isTSNeverKeyword(node: ?Object, opts?: Object): boolean { if (!node) return false; const nodeType = node.type; - if (nodeType === "TSObjectKeyword") { + if (nodeType === "TSNeverKeyword") { if (typeof opts === "undefined") { return true; } else { @@ -2565,11 +2747,11 @@ export function isTSObjectKeyword(node: ?Object, opts?: Object): boolean { return false; } -export function isTSBooleanKeyword(node: ?Object, opts?: Object): boolean { +export function isTSNullKeyword(node: ?Object, opts?: Object): boolean { if (!node) return false; const nodeType = node.type; - if (nodeType === "TSBooleanKeyword") { + if (nodeType === "TSNullKeyword") { if (typeof opts === "undefined") { return true; } else { @@ -2579,11 +2761,11 @@ export function isTSBooleanKeyword(node: ?Object, opts?: Object): boolean { return false; } -export function isTSStringKeyword(node: ?Object, opts?: Object): boolean { +export function isTSNumberKeyword(node: ?Object, opts?: Object): boolean { if (!node) return false; const nodeType = node.type; - if (nodeType === "TSStringKeyword") { + if (nodeType === "TSNumberKeyword") { if (typeof opts === "undefined") { return true; } else { @@ -2593,11 +2775,11 @@ export function isTSStringKeyword(node: ?Object, opts?: Object): boolean { return false; } -export function isTSSymbolKeyword(node: ?Object, opts?: Object): boolean { +export function isTSObjectKeyword(node: ?Object, opts?: Object): boolean { if (!node) return false; const nodeType = node.type; - if (nodeType === "TSSymbolKeyword") { + if (nodeType === "TSObjectKeyword") { if (typeof opts === "undefined") { return true; } else { @@ -2607,11 +2789,25 @@ export function isTSSymbolKeyword(node: ?Object, opts?: Object): boolean { return false; } -export function isTSVoidKeyword(node: ?Object, opts?: Object): boolean { +export function isTSStringKeyword(node: ?Object, opts?: Object): boolean { if (!node) return false; const nodeType = node.type; - if (nodeType === "TSVoidKeyword") { + if (nodeType === "TSStringKeyword") { + if (typeof opts === "undefined") { + return true; + } else { + return shallowEqual(node, opts); + } + } + + return false; +} +export function isTSSymbolKeyword(node: ?Object, opts?: Object): boolean { + if (!node) return false; + + const nodeType = node.type; + if (nodeType === "TSSymbolKeyword") { if (typeof opts === "undefined") { return true; } else { @@ -2635,11 +2831,11 @@ export function isTSUndefinedKeyword(node: ?Object, opts?: Object): boolean { return false; } -export function isTSNullKeyword(node: ?Object, opts?: Object): boolean { +export function isTSUnknownKeyword(node: ?Object, opts?: Object): boolean { if (!node) return false; const nodeType = node.type; - if (nodeType === "TSNullKeyword") { + if (nodeType === "TSUnknownKeyword") { if (typeof opts === "undefined") { return true; } else { @@ -2649,11 +2845,11 @@ export function isTSNullKeyword(node: ?Object, opts?: Object): boolean { return false; } -export function isTSNeverKeyword(node: ?Object, opts?: Object): boolean { +export function isTSVoidKeyword(node: ?Object, opts?: Object): boolean { if (!node) return false; const nodeType = node.type; - if (nodeType === "TSNeverKeyword") { + if (nodeType === "TSVoidKeyword") { if (typeof opts === "undefined") { return true; } else { @@ -3292,6 +3488,8 @@ export function isExpression(node: ?Object, opts?: Object): boolean { "Import" === nodeType || "DoExpression" === nodeType || "BigIntLiteral" === nodeType || + "RecordExpression" === nodeType || + "TupleExpression" === nodeType || "TSAsExpression" === nodeType || "TSTypeAssertion" === nodeType || "TSNonNullExpression" === nodeType || @@ -3345,8 +3543,8 @@ export function isScopable(node: ?Object, opts?: Object): boolean { "SwitchStatement" === nodeType || "WhileStatement" === nodeType || "ArrowFunctionExpression" === nodeType || - "ClassDeclaration" === nodeType || "ClassExpression" === nodeType || + "ClassDeclaration" === nodeType || "ForOfStatement" === nodeType || "ClassMethod" === nodeType || "ClassPrivateMethod" === nodeType || @@ -3459,6 +3657,7 @@ export function isStatement(node: ?Object, opts?: Object): boolean { "InterfaceDeclaration" === nodeType || "OpaqueType" === nodeType || "TypeAlias" === nodeType || + "EnumDeclaration" === nodeType || "TSDeclareFunction" === nodeType || "TSInterfaceDeclaration" === nodeType || "TSTypeAliasDeclaration" === nodeType || @@ -3692,9 +3891,8 @@ export function isPureish(node: ?Object, opts?: Object): boolean { "NumericLiteral" === nodeType || "NullLiteral" === nodeType || "BooleanLiteral" === nodeType || + "RegExpLiteral" === nodeType || "ArrowFunctionExpression" === nodeType || - "ClassDeclaration" === nodeType || - "ClassExpression" === nodeType || "BigIntLiteral" === nodeType || (nodeType === "Placeholder" && "StringLiteral" === node.expectedNode) ) { @@ -3733,6 +3931,7 @@ export function isDeclaration(node: ?Object, opts?: Object): boolean { "InterfaceDeclaration" === nodeType || "OpaqueType" === nodeType || "TypeAlias" === nodeType || + "EnumDeclaration" === nodeType || "TSDeclareFunction" === nodeType || "TSInterfaceDeclaration" === nodeType || "TSTypeAliasDeclaration" === nodeType || @@ -3995,8 +4194,8 @@ export function isClass(node: ?Object, opts?: Object): boolean { const nodeType = node.type; if ( nodeType === "Class" || - "ClassDeclaration" === nodeType || - "ClassExpression" === nodeType + "ClassExpression" === nodeType || + "ClassDeclaration" === nodeType ) { if (typeof opts === "undefined") { return true; @@ -4115,6 +4314,7 @@ export function isFlow(node: ?Object, opts?: Object): boolean { "QualifiedTypeIdentifier" === nodeType || "StringLiteralTypeAnnotation" === nodeType || "StringTypeAnnotation" === nodeType || + "SymbolTypeAnnotation" === nodeType || "ThisTypeAnnotation" === nodeType || "TupleTypeAnnotation" === nodeType || "TypeofTypeAnnotation" === nodeType || @@ -4161,6 +4361,7 @@ export function isFlowType(node: ?Object, opts?: Object): boolean { "ObjectTypeAnnotation" === nodeType || "StringLiteralTypeAnnotation" === nodeType || "StringTypeAnnotation" === nodeType || + "SymbolTypeAnnotation" === nodeType || "ThisTypeAnnotation" === nodeType || "TupleTypeAnnotation" === nodeType || "TypeofTypeAnnotation" === nodeType || @@ -4189,6 +4390,7 @@ export function isFlowBaseAnnotation(node: ?Object, opts?: Object): boolean { "EmptyTypeAnnotation" === nodeType || "NumberTypeAnnotation" === nodeType || "StringTypeAnnotation" === nodeType || + "SymbolTypeAnnotation" === nodeType || "ThisTypeAnnotation" === nodeType || "VoidTypeAnnotation" === nodeType ) { @@ -4248,6 +4450,46 @@ export function isFlowPredicate(node: ?Object, opts?: Object): boolean { return false; } +export function isEnumBody(node: ?Object, opts?: Object): boolean { + if (!node) return false; + + const nodeType = node.type; + if ( + nodeType === "EnumBody" || + "EnumBooleanBody" === nodeType || + "EnumNumberBody" === nodeType || + "EnumStringBody" === nodeType || + "EnumSymbolBody" === nodeType + ) { + if (typeof opts === "undefined") { + return true; + } else { + return shallowEqual(node, opts); + } + } + + return false; +} +export function isEnumMember(node: ?Object, opts?: Object): boolean { + if (!node) return false; + + const nodeType = node.type; + if ( + nodeType === "EnumMember" || + "EnumBooleanMember" === nodeType || + "EnumNumberMember" === nodeType || + "EnumStringMember" === nodeType || + "EnumDefaultedMember" === nodeType + ) { + if (typeof opts === "undefined") { + return true; + } else { + return shallowEqual(node, opts); + } + } + + return false; +} export function isJSX(node: ?Object, opts?: Object): boolean { if (!node) return false; @@ -4326,16 +4568,17 @@ export function isTSType(node: ?Object, opts?: Object): boolean { if ( nodeType === "TSType" || "TSAnyKeyword" === nodeType || - "TSUnknownKeyword" === nodeType || + "TSBooleanKeyword" === nodeType || + "TSBigIntKeyword" === nodeType || + "TSNeverKeyword" === nodeType || + "TSNullKeyword" === nodeType || "TSNumberKeyword" === nodeType || "TSObjectKeyword" === nodeType || - "TSBooleanKeyword" === nodeType || "TSStringKeyword" === nodeType || "TSSymbolKeyword" === nodeType || - "TSVoidKeyword" === nodeType || "TSUndefinedKeyword" === nodeType || - "TSNullKeyword" === nodeType || - "TSNeverKeyword" === nodeType || + "TSUnknownKeyword" === nodeType || + "TSVoidKeyword" === nodeType || "TSThisType" === nodeType || "TSFunctionType" === nodeType || "TSConstructorType" === nodeType || @@ -4368,6 +4611,36 @@ export function isTSType(node: ?Object, opts?: Object): boolean { return false; } +export function isTSBaseType(node: ?Object, opts?: Object): boolean { + if (!node) return false; + + const nodeType = node.type; + if ( + nodeType === "TSBaseType" || + "TSAnyKeyword" === nodeType || + "TSBooleanKeyword" === nodeType || + "TSBigIntKeyword" === nodeType || + "TSNeverKeyword" === nodeType || + "TSNullKeyword" === nodeType || + "TSNumberKeyword" === nodeType || + "TSObjectKeyword" === nodeType || + "TSStringKeyword" === nodeType || + "TSSymbolKeyword" === nodeType || + "TSUndefinedKeyword" === nodeType || + "TSUnknownKeyword" === nodeType || + "TSVoidKeyword" === nodeType || + "TSThisType" === nodeType || + "TSLiteralType" === nodeType + ) { + if (typeof opts === "undefined") { + return true; + } else { + return shallowEqual(node, opts); + } + } + + return false; +} export function isNumberLiteral(node: ?Object, opts?: Object): boolean { console.trace( "The node type NumberLiteral has been renamed to NumericLiteral", diff --git a/packages/babel-types/src/validators/isPlaceholderType.js b/packages/babel-types/src/validators/isPlaceholderType.js index fa775b7ed803..fac93b274532 100644 --- a/packages/babel-types/src/validators/isPlaceholderType.js +++ b/packages/babel-types/src/validators/isPlaceholderType.js @@ -5,7 +5,7 @@ import { PLACEHOLDERS_ALIAS } from "../definitions"; * Test if a `placeholderType` is a `targetType` or if `targetType` is an alias of `placeholderType`. */ export default function isPlaceholderType( - placeholderType: ?string, + placeholderType: string, targetType: string, ): boolean { if (placeholderType === targetType) return true; diff --git a/packages/babel-types/src/validators/isReferenced.js b/packages/babel-types/src/validators/isReferenced.js index 699b291a01d6..9ae72f9423d2 100644 --- a/packages/babel-types/src/validators/isReferenced.js +++ b/packages/babel-types/src/validators/isReferenced.js @@ -45,21 +45,29 @@ export default function isReferenced( case "PrivateName": return false; + // no: class { NODE() {} } + // yes: class { [NODE]() {} } + // no: class { foo(NODE) {} } + case "ClassMethod": + case "ClassPrivateMethod": + case "ObjectMethod": + if (parent.params.includes(node)) { + return false; + } + // fall through + // yes: { [NODE]: "" } // no: { NODE: "" } // depends: { NODE } // depends: { key: NODE } + // fall through case "ObjectProperty": // no: class { NODE = value; } // yes: class { [NODE] = value; } // yes: class { key = NODE; } + // fall through case "ClassProperty": case "ClassPrivateProperty": - // no: class { NODE() {} } - // yes: class { [NODE]() {} } - case "ClassMethod": - case "ClassPrivateMethod": - case "ObjectMethod": if (parent.key === node) { return !!parent.computed; } diff --git a/packages/babel-types/src/validators/isScope.js b/packages/babel-types/src/validators/isScope.js index 51d6c91924ec..dfd2f5edd96f 100644 --- a/packages/babel-types/src/validators/isScope.js +++ b/packages/babel-types/src/validators/isScope.js @@ -4,6 +4,7 @@ import { isCatchClause, isBlockStatement, isScopable, + isPattern, } from "./generated"; /** @@ -18,5 +19,11 @@ export default function isScope(node: Object, parent: Object): boolean { return false; } + // If a Pattern is an immediate descendent of a Function, it must be in the params. + // Hence we skipped the parentKey === "params" check + if (isPattern(node) && isFunction(parent)) { + return true; + } + return isScopable(node); } diff --git a/packages/babel-types/src/validators/isValidIdentifier.js b/packages/babel-types/src/validators/isValidIdentifier.js index 6dbbb7c32cd0..4862274ae177 100644 --- a/packages/babel-types/src/validators/isValidIdentifier.js +++ b/packages/babel-types/src/validators/isValidIdentifier.js @@ -1,20 +1,28 @@ // @flow -import esutils from "esutils"; +import { + isIdentifierName, + isStrictReservedWord, + isKeyword, +} from "@babel/helper-validator-identifier"; /** * Check if the input `name` is a valid identifier name * and isn't a reserved word. */ -export default function isValidIdentifier(name: string): boolean { - if ( - typeof name !== "string" || - esutils.keyword.isReservedWordES6(name, true) - ) { - return false; - } else if (name === "await") { - // invalid in module, valid in script; better be safe (see #4952) - return false; - } else { - return esutils.keyword.isIdentifierNameES6(name); +export default function isValidIdentifier( + name: string, + reserved: boolean = true, +): boolean { + if (typeof name !== "string") return false; + + if (reserved) { + if (isKeyword(name) || isStrictReservedWord(name)) { + return false; + } else if (name === "await") { + // invalid in module, valid in script; better be safe (see #4952) + return false; + } } + + return isIdentifierName(name); } diff --git a/packages/babel-types/src/validators/validate.js b/packages/babel-types/src/validators/validate.js index 738683849927..0ec35b684a0f 100644 --- a/packages/babel-types/src/validators/validate.js +++ b/packages/babel-types/src/validators/validate.js @@ -1,5 +1,5 @@ // @flow -import { NODE_FIELDS } from "../definitions"; +import { NODE_FIELDS, NODE_PARENT_VALIDATIONS } from "../definitions"; export default function validate(node?: Object, key: string, val: any): void { if (!node) return; @@ -9,6 +9,7 @@ export default function validate(node?: Object, key: string, val: any): void { const field = fields[key]; validateField(node, key, val, field); + validateChild(node, key, val); } export function validateField( @@ -22,3 +23,10 @@ export function validateField( field.validate(node, key, val); } + +export function validateChild(node?: Object, key: string, val?: Object) { + if (val == null) return; + const validate = NODE_PARENT_VALIDATIONS[val.type]; + if (!validate) return; + validate(node, key, val); +} diff --git a/packages/babel-types/test/builders/es2015/__snapshots__/templateElement.js.snap b/packages/babel-types/test/builders/es2015/__snapshots__/templateElement.js.snap index a2f178169233..2915dd37948f 100644 --- a/packages/babel-types/test/builders/es2015/__snapshots__/templateElement.js.snap +++ b/packages/babel-types/test/builders/es2015/__snapshots__/templateElement.js.snap @@ -35,3 +35,61 @@ exports[`builders es2015 templateElement should validate 5`] = ` "Property value of TemplateElement expected to have the following: Property raw expected type of string but got undefined" `; + +exports[`builders es2015 templateLiteral should validate 1`] = ` +Object { + "expressions": Array [], + "quasis": Array [ + Object { + "tail": false, + "type": "TemplateElement", + "value": Object { + "raw": "foo", + }, + }, + ], + "type": "TemplateLiteral", +} +`; + +exports[`builders es2015 templateLiteral should validate 2`] = ` +Object { + "expressions": Array [ + Object { + "type": "StringLiteral", + "value": "baz", + }, + ], + "quasis": Array [ + Object { + "tail": false, + "type": "TemplateElement", + "value": Object { + "raw": "foo", + }, + }, + Object { + "tail": false, + "type": "TemplateElement", + "value": Object { + "raw": "bar", + }, + }, + ], + "type": "TemplateLiteral", +} +`; + +exports[`builders es2015 templateLiteral should validate 3`] = ` +"Number of TemplateLiteral quasis should be exactly one more than the number of expressions. +Expected 3 quasis but got 2" +`; + +exports[`builders es2015 templateLiteral should validate 4`] = ` +"Number of TemplateLiteral quasis should be exactly one more than the number of expressions. +Expected 1 quasis but got 2" +`; + +exports[`builders es2015 templateLiteral should validate 5`] = `"Property quasis expected type of array but got object"`; + +exports[`builders es2015 templateLiteral should validate 6`] = `"Property expressions expected type of array but got null"`; diff --git a/packages/babel-types/test/builders/es2015/templateElement.js b/packages/babel-types/test/builders/es2015/templateElement.js index 0a93e7c8662a..0e5985ae89de 100644 --- a/packages/babel-types/test/builders/es2015/templateElement.js +++ b/packages/babel-types/test/builders/es2015/templateElement.js @@ -21,5 +21,34 @@ describe("builders", function() { expect(() => t.templateElement("foo")).toThrowErrorMatchingSnapshot(); }); }); + describe("templateLiteral", function() { + it("should validate", function() { + const foo = t.templateElement({ raw: "foo" }); + const bar = t.templateElement({ raw: "bar" }); + + const baz = t.stringLiteral("baz"); + const qux = t.stringLiteral("qux"); + + expect(t.templateLiteral([foo], [])).toMatchSnapshot(); + + expect(t.templateLiteral([foo, bar], [baz])).toMatchSnapshot(); + + expect(() => + t.templateLiteral([foo, bar], [baz, qux]), + ).toThrowErrorMatchingSnapshot(); + + expect(() => + t.templateLiteral([foo, bar], []), + ).toThrowErrorMatchingSnapshot(); + + expect(() => + t.templateLiteral({}, [baz]), + ).toThrowErrorMatchingSnapshot(); + + expect(() => + t.templateLiteral([foo, bar]), + ).toThrowErrorMatchingSnapshot(); + }); + }); }); }); diff --git a/packages/babel-types/test/builders/experimental/__snapshots__/classProperty.js.snap b/packages/babel-types/test/builders/experimental/__snapshots__/classProperty.js.snap new file mode 100644 index 000000000000..4d10897ac020 --- /dev/null +++ b/packages/babel-types/test/builders/experimental/__snapshots__/classProperty.js.snap @@ -0,0 +1,37 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`builders experimental classProperty should validate 1`] = ` +Object { + "computed": false, + "decorators": null, + "key": Object { + "type": "StringLiteral", + "value": "test", + }, + "static": false, + "type": "ClassProperty", + "typeAnnotation": null, + "value": Object { + "type": "NumericLiteral", + "value": 1, + }, +} +`; + +exports[`builders experimental classProperty should validate 2`] = ` +Object { + "computed": false, + "decorators": null, + "key": Object { + "type": "StringLiteral", + "value": "test", + }, + "static": true, + "type": "ClassProperty", + "typeAnnotation": null, + "value": Object { + "type": "NumericLiteral", + "value": 1, + }, +} +`; diff --git a/packages/babel-types/test/builders/experimental/classProperty.js b/packages/babel-types/test/builders/experimental/classProperty.js new file mode 100644 index 000000000000..3b35a1317c50 --- /dev/null +++ b/packages/babel-types/test/builders/experimental/classProperty.js @@ -0,0 +1,24 @@ +import * as t from "../../.."; + +describe("builders", function() { + describe("experimental", function() { + describe("classProperty", function() { + it("should validate", function() { + expect( + t.classProperty(t.stringLiteral("test"), t.numericLiteral(1)), + ).toMatchSnapshot(); + + expect( + t.classProperty( + t.stringLiteral("test"), + t.numericLiteral(1), + null, + null, + false, + true, + ), + ).toMatchSnapshot(); + }); + }); + }); +}); diff --git a/packages/babel-types/test/builders/typescript/__snapshots__/tsTypeParameter.js.snap b/packages/babel-types/test/builders/typescript/__snapshots__/tsTypeParameter.js.snap new file mode 100644 index 000000000000..51940ca2d50a --- /dev/null +++ b/packages/babel-types/test/builders/typescript/__snapshots__/tsTypeParameter.js.snap @@ -0,0 +1,24 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`builders typescript tsTypeParameter accept name as argument for tsTypeParameter 1`] = ` +Object { + "constraint": Object { + "type": "TSTypeReference", + "typeName": Object { + "name": "bar", + "type": "Identifier", + }, + "typeParameters": null, + }, + "default": Object { + "type": "TSTypeReference", + "typeName": Object { + "name": "baz", + "type": "Identifier", + }, + "typeParameters": null, + }, + "name": "foo", + "type": "TSTypeParameter", +} +`; diff --git a/packages/babel-types/test/builders/typescript/tsTypeParameter.js b/packages/babel-types/test/builders/typescript/tsTypeParameter.js new file mode 100644 index 000000000000..985d67909c2a --- /dev/null +++ b/packages/babel-types/test/builders/typescript/tsTypeParameter.js @@ -0,0 +1,24 @@ +import * as t from "../../.."; + +describe("builders", function() { + describe("typescript", function() { + describe("tsTypeParameter", function() { + it("accept name as argument for tsTypeParameter", function() { + const tsTypeParameter = t.tsTypeParameter( + t.tsTypeReference(t.identifier("bar")), + t.tsTypeReference(t.identifier("baz")), + "foo", + ); + expect(tsTypeParameter).toMatchSnapshot(); + }); + it("throws when name is missing", function() { + expect(() => { + t.tsTypeParameter( + t.tsTypeReference(t.identifier("bar")), + t.tsTypeReference(t.identifier("baz")), + ); + }).toThrow("Property name expected type of string but got null"); + }); + }); + }); +}); diff --git a/packages/babel-types/test/cloning.js b/packages/babel-types/test/cloning.js index 83e7c70491e0..fecc1bd700bb 100644 --- a/packages/babel-types/test/cloning.js +++ b/packages/babel-types/test/cloning.js @@ -72,4 +72,72 @@ describe("cloneNode", function() { node.declarations[0].id.typeAnnotation, ); }); + + it("should support shallow cloning without loc", function() { + const node = t.variableDeclaration("let", [ + t.variableDeclarator({ + ...t.identifier("value"), + typeAnnotation: t.anyTypeAnnotation(), + }), + ]); + node.loc = {}; + const cloned = t.cloneNode(node, /* deep */ false, /* withoutLoc */ true); + expect(cloned.loc).toBeNull(); + }); + + it("should support deep cloning without loc", function() { + const node = t.variableDeclaration("let", [ + t.variableDeclarator({ + ...t.identifier("value"), + typeAnnotation: t.anyTypeAnnotation(), + }), + ]); + node.loc = {}; + node.declarations[0].id.loc = {}; + const cloned = t.cloneNode(node, /* deep */ true, /* withoutLoc */ true); + expect(cloned.loc).toBeNull(); + expect(cloned.declarations[0].id.loc).toBeNull(); + }); + + it("should support deep cloning for comments", function() { + const node = t.variableDeclaration("let", [ + t.variableDeclarator({ + ...t.identifier("value"), + leadingComments: [{ loc: {} }], + innerComments: [{ loc: {} }], + trailingComments: [{ loc: {} }], + }), + ]); + node.loc = {}; + node.declarations[0].id.loc = {}; + + const cloned = t.cloneNode(node, /* deep */ true, /* withoutLoc */ false); + expect(cloned.declarations[0].id.leadingComments[0].loc).toBe( + node.declarations[0].id.leadingComments[0].loc, + ); + expect(cloned.declarations[0].id.innerComments[0].loc).toBe( + node.declarations[0].id.innerComments[0].loc, + ); + expect(cloned.declarations[0].id.trailingComments[0].loc).toBe( + node.declarations[0].id.trailingComments[0].loc, + ); + }); + + it("should support deep cloning for comments without loc", function() { + const node = t.variableDeclaration("let", [ + t.variableDeclarator({ + ...t.identifier("value"), + leadingComments: [{ loc: {} }], + innerComments: [{ loc: {} }], + trailingComments: [{ loc: {} }], + }), + ]); + node.loc = {}; + node.declarations[0].id.loc = {}; + + const cloned = t.cloneNode(node, /* deep */ true, /* withoutLoc */ true); + expect(cloned.declarations[0].id.leadingComments[0].loc).toBe(null); + expect(cloned.declarations[0].id.innerComments[0].loc).toBe(null); + expect(cloned.declarations[0].id.trailingComments[0].loc).toBe(null); + }); }); diff --git a/packages/babel-types/test/validators.js b/packages/babel-types/test/validators.js index f08dedab1a87..b8ff2e7d8b04 100644 --- a/packages/babel-types/test/validators.js +++ b/packages/babel-types/test/validators.js @@ -179,6 +179,74 @@ describe("validators", function() { expect(t.isReferenced(node, parent)).toBe(true); }); }); + + describe("ObjectMethod", function() { + it("returns false if node is method key", function() { + const node = t.identifier("A"); + const parent = t.objectMethod("method", node, [], t.blockStatement([])); + + expect(t.isReferenced(node, parent)).toBe(false); + }); + + it("returns true if node is computed method key", function() { + const node = t.identifier("A"); + const parent = t.objectMethod( + "method", + node, + [], + t.blockStatement([]), + true, + ); + + expect(t.isReferenced(node, parent)).toBe(true); + }); + + it("returns false if node is method param", function() { + const node = t.identifier("A"); + const parent = t.objectMethod( + "method", + t.identifier("foo"), + [node], + t.blockStatement([]), + ); + + expect(t.isReferenced(node, parent)).toBe(false); + }); + }); + + describe("ClassMethod", function() { + it("returns false if node is method key", function() { + const node = t.identifier("A"); + const parent = t.classMethod("method", node, [], t.blockStatement([])); + + expect(t.isReferenced(node, parent)).toBe(false); + }); + + it("returns true if node is computed method key", function() { + const node = t.identifier("A"); + const parent = t.classMethod( + "method", + node, + [], + t.blockStatement([]), + true, + ); + + expect(t.isReferenced(node, parent)).toBe(true); + }); + + it("returns false if node is method param", function() { + const node = t.identifier("A"); + const parent = t.classMethod( + "method", + t.identifier("foo"), + [node], + t.blockStatement([]), + ); + + expect(t.isReferenced(node, parent)).toBe(false); + }); + }); }); describe("isBinding", function() { diff --git a/scripts/clone-license.sh b/scripts/clone-license.sh index e901ca00ba01..8c025097cbcb 100755 --- a/scripts/clone-license.sh +++ b/scripts/clone-license.sh @@ -1,3 +1,4 @@ echo "Cloning LICENSE to babel packages" cat LICENSE ls -db ./packages/*/ | egrep -v '.*packages\/(babel-parser|babel-plugin-transform-object-assign)\/?$' | xargs -n 1 cp LICENSE +ls -db ./eslint/*/ | egrep -v '.*eslint\/(babel-eslint-plugin)\/?$' | xargs -n 1 cp LICENSE diff --git a/scripts/gulp-tasks.js b/scripts/gulp-tasks.js deleted file mode 100644 index 73c1f7db2e3f..000000000000 --- a/scripts/gulp-tasks.js +++ /dev/null @@ -1,170 +0,0 @@ -"use strict"; - -/** - * This file contains the Gulp tasks for babel-standalone. Note that - * babel-standalone is compiled using Webpack, and performs its own Babel - * compilation of all the JavaScript files. This is because it targets web - * browsers, so more transforms are needed than the regular Babel builds that - * only target Node.js. - * - * The tasks in this file are designed to be reusable, so that they can be used - * to make standalone builds of other Babel plugins/presets (such as babel-minify) - */ - -const path = require("path"); -const pump = require("pump"); -const chalk = require("chalk"); -const through = require("through2"); -const fancyLog = require("fancy-log"); -const rename = require("gulp-rename"); -const webpack = require("webpack"); -const { RootMostResolvePlugin } = require("webpack-dependency-suite"); -const DuplicatePackageCheckerPlugin = require("duplicate-package-checker-webpack-plugin"); -const WarningsToErrorsPlugin = require("warnings-to-errors-webpack-plugin"); -const webpackStream = require("webpack-stream"); -const uglify = require("gulp-uglify"); - -function webpackBuild(opts) { - const plugins = opts.plugins || []; - let babelVersion = require("../packages/babel-core/package.json").version; - let version = opts.version || babelVersion; - // If this build is part of a pull request, include the pull request number in - // the version number. - if (process.env.CIRCLE_PR_NUMBER) { - const prVersion = "+pr." + process.env.CIRCLE_PR_NUMBER; - babelVersion += prVersion; - version += prVersion; - } - - const config = { - module: { - rules: [ - { - test: /\.js$/, - loader: "babel-loader", - options: { - // Use the bundled config so that module syntax is passed through - // for Webpack. - envName: "standalone", - }, - }, - ], - }, - node: { - // Mock Node.js modules that Babel require()s but that we don't - // particularly care about. - fs: "empty", - module: "empty", - net: "empty", - }, - output: { - filename: opts.filename, - library: opts.library, - libraryTarget: "umd", - }, - plugins: [ - new WarningsToErrorsPlugin(), - new DuplicatePackageCheckerPlugin({ - exclude(instance) { - return instance.name === "semver"; - }, - }), - new webpack.DefinePlugin({ - "process.env.NODE_ENV": '"production"', - "process.env": JSON.stringify({ NODE_ENV: "production" }), - BABEL_VERSION: JSON.stringify(babelVersion), - VERSION: JSON.stringify(version), - }), - /*new webpack.NormalModuleReplacementPlugin( - /..\/..\/package/, - "../../../../src/babel-package-shim" - ),*/ - new webpack.optimize.ModuleConcatenationPlugin(), - ].concat(plugins), - resolve: { - plugins: [ - // Dedupe packages that are used across multiple plugins. - // This replaces DedupePlugin from Webpack 1.x - new RootMostResolvePlugin(__dirname, true), - ], - }, - }; - - if (opts.library !== "Babel") { - config.externals = { - "@babel/standalone": "Babel", - }; - } - - return webpackStream(config, webpack); - // To write JSON for debugging: - /*return webpackStream(config, webpack, (err, stats) => { - require("fancy-log")(stats.toString({ colors: true })); - require("fs").writeFileSync( - "webpack-debug.json", - JSON.stringify(stats.toJson()) - ); - });*/ -} - -function logUglify() { - return through.obj(function(file, enc, callback) { - fancyLog( - `Minifying '${chalk.cyan( - path.relative(path.join(__dirname, ".."), file.path) - )}'...` - ); - callback(null, file); - }); -} - -function logNoUglify() { - return through.obj(function(file, enc, callback) { - fancyLog( - chalk.yellow( - `Skipped minification of '${chalk.cyan( - path.relative(path.join(__dirname, ".."), file.path) - )}' because not publishing` - ) - ); - callback(null, file); - }); -} - -function registerStandalonePackageTask( - gulp, - name, - exportName, - pathname, - version, - plugins -) { - const standaloneName = name + "-standalone"; - const standalonePath = path.join(pathname, standaloneName); - gulp.task("build-" + standaloneName, cb => { - pump( - [ - gulp.src(path.join(standalonePath, "src/index.js")), - webpackBuild({ - filename: name + ".js", - library: exportName, - version, - plugins, - }), - gulp.dest(standalonePath), - ].concat( - // Minification is super slow, so we skip it unless we are publishing - process.env.IS_PUBLISH ? logUglify() : logNoUglify(), - process.env.IS_PUBLISH ? uglify() : [], - rename({ extname: ".min.js" }), - gulp.dest(standalonePath) - ), - cb - ); - }); -} - -module.exports = { - webpackBuild: webpackBuild, - registerStandalonePackageTask: registerStandalonePackageTask, -}; diff --git a/scripts/integration-tests/e2e-babel-old-version.sh b/scripts/integration-tests/e2e-babel-old-version.sh new file mode 100755 index 000000000000..1f72a237582d --- /dev/null +++ b/scripts/integration-tests/e2e-babel-old-version.sh @@ -0,0 +1,43 @@ +#!/bin/bash + +#==============================================================================# +# SETUP # +#==============================================================================# + +# Start in scripts/integration-tests/ even if run from root directory +cd "$(dirname "$0")" || exit + +source utils/local-registry.sh +source utils/cleanup.sh + +# Echo every command being executed +set -x + +# Go to the root of the monorepo +cd ../.. + +#==============================================================================# +# TEST # +#==============================================================================# + +startLocalRegistry "$PWD"/scripts/integration-tests/verdaccio-config.yml +yarn upgrade --scope @babel + +node -e "\ + var pkg = require('./package.json');\ + pkg.devDependencies['@babel/core'] = '7.0.0';\ + Object.assign(pkg.resolutions, {\ + '@babel/core': '7.0.0',\ + '@babel/helpers': '7.0.0',\ + '@babel/traverse': '7.0.0'\ + });\ + fs.writeFileSync('./package.json', JSON.stringify(pkg, null, 2));\ +" + +rm yarn.lock +make bootstrap + +# Test +make test-ci + +cleanup diff --git a/scripts/integration-tests/e2e-babel.sh b/scripts/integration-tests/e2e-babel.sh new file mode 100755 index 000000000000..f73b75f95bd5 --- /dev/null +++ b/scripts/integration-tests/e2e-babel.sh @@ -0,0 +1,29 @@ +#!/bin/bash + +#==============================================================================# +# SETUP # +#==============================================================================# + +# Start in scripts/integration-tests/ even if run from root directory +cd "$(dirname "$0")" || exit + +source utils/local-registry.sh +source utils/cleanup.sh + +# Echo every command being executed +set -x + +# Go to the root of the monorepo +cd ../.. + +#==============================================================================# +# TEST # +#==============================================================================# + +startLocalRegistry "$PWD"/scripts/integration-tests/verdaccio-config.yml +yarn upgrade --scope @babel + +# Test +make test-ci + +cleanup diff --git a/scripts/integration-tests/e2e-create-react-app.sh b/scripts/integration-tests/e2e-create-react-app.sh new file mode 100755 index 000000000000..8be49ae89902 --- /dev/null +++ b/scripts/integration-tests/e2e-create-react-app.sh @@ -0,0 +1,33 @@ +#!/bin/bash + +#==============================================================================# +# SETUP # +#==============================================================================# + +# Start in scripts/integration-tests/ even if run from root directory +cd "$(dirname "$0")" || exit + +source utils/local-registry.sh +source utils/cleanup.sh + +# Echo every command being executed +set -x + +# Clone create-react-app +git clone --depth=1 https://github.com/facebook/create-react-app.git tmp/create-react-app +cd tmp/create-react-app || exit + +#==============================================================================# +# TEST # +#==============================================================================# + +startLocalRegistry "$PWD"/../../verdaccio-config.yml +yarn install +node "$PWD"/../../utils/bump-babel-dependencies.js +yarn lerna exec -- node "$PWD"/../../utils/bump-babel-dependencies.js +yarn install + +# Test +CI=true yarn test + +cleanup diff --git a/scripts/integration-tests/e2e-vue-cli.sh b/scripts/integration-tests/e2e-vue-cli.sh new file mode 100755 index 000000000000..b43ed96db988 --- /dev/null +++ b/scripts/integration-tests/e2e-vue-cli.sh @@ -0,0 +1,33 @@ +#!/bin/bash + +#==============================================================================# +# SETUP # +#==============================================================================# + +# Start in scripts/integration-tests/ even if run from root directory +cd "$(dirname "$0")" || exit + +source utils/local-registry.sh +source utils/cleanup.sh + +# Echo every command being executed +set -x + +# Clone vue-cli +git clone --depth=1 https://github.com/vuejs/vue-cli tmp/vue-cli +cd tmp/vue-cli || exit + +#==============================================================================# +# TEST # +#==============================================================================# + +startLocalRegistry "$PWD"/../../verdaccio-config.yml +yarn install +node "$PWD"/../../utils/bump-babel-dependencies.js +yarn lerna exec -- node "$PWD"/../../utils/bump-babel-dependencies.js +yarn install + +# Test +CI=true yarn test -p babel,babel-preset-app + +cleanup diff --git a/scripts/integration-tests/publish-local.sh b/scripts/integration-tests/publish-local.sh new file mode 100755 index 000000000000..210bcc04b25b --- /dev/null +++ b/scripts/integration-tests/publish-local.sh @@ -0,0 +1,51 @@ +#!/bin/bash + +#==============================================================================# +# SETUP # +#==============================================================================# + +# Start in scripts/integration-tests/ even if run from root directory +cd "$(dirname "$0")" + +source utils/local-registry.sh +source utils/git.sh +source utils/cleanup.sh + +function publishESLintPkg { + cd eslint/$1 + yarn version --new-version $2 --no-git-tag-version + cd ../.. + make -j publish-eslint PKG=$1 +} + +# Echo every command being executed +set -x + +# Go to the root of the monorepo +cd ../.. + +initializeE2Egit + +#==============================================================================# +# PUBLISH # +#==============================================================================# + +make -j bootstrap-only + +startLocalRegistry "$PWD"/scripts/integration-tests/verdaccio-config.yml +loginLocalRegistry + +# This script gets the last @babel/standalone version (because it's always published), +# and then increases by one the patch number +VERSION=$( + node -p "'$(npm view @babel/standalone version)'.replace(/(?<=\\d+\\.\\d+\\.)\\d+/, x => ++x)" +) + +I_AM_USING_VERDACCIO=I_AM_SURE VERSION="$VERSION" make publish-test + +publishESLintPkg babel-eslint-config-internal "$VERSION" +publishESLintPkg babel-eslint-parser "$VERSION" +publishESLintPkg babel-eslint-plugin "$VERSION" +publishESLintPkg babel-eslint-plugin-development "$VERSION" + +cleanup diff --git a/scripts/integration-tests/utils/bump-babel-dependencies.js b/scripts/integration-tests/utils/bump-babel-dependencies.js new file mode 100644 index 000000000000..03863f588847 --- /dev/null +++ b/scripts/integration-tests/utils/bump-babel-dependencies.js @@ -0,0 +1,29 @@ +const fs = require("fs"); +const path = require("path"); +const cwd = process.cwd(); +const packageJSONPath = path.resolve(cwd, "./package.json"); +const content = JSON.parse(fs.readFileSync(packageJSONPath)); + +let bumped = false; +function bumpBabelDependency(dependencies) { + for (const dep of Object.keys(dependencies)) { + if (dep.startsWith("@babel/")) { + dependencies[dep] = "latest"; + bumped = true; + } + } +} + +if ("peerDependencies" in content) { + bumpBabelDependency(content.peerDependencies); +} +if ("devDependencies" in content) { + bumpBabelDependency(content.devDependencies); +} +if ("dependencies" in content) { + bumpBabelDependency(content.dependencies); +} + +if (bumped) { + fs.writeFileSync(packageJSONPath, JSON.stringify(content, undefined, 2)); +} diff --git a/scripts/integration-tests/utils/cleanup.sh b/scripts/integration-tests/utils/cleanup.sh new file mode 100755 index 000000000000..0a578b79fdc7 --- /dev/null +++ b/scripts/integration-tests/utils/cleanup.sh @@ -0,0 +1,30 @@ +#!/bin/bash + +function cleanup { + echo "Cleaning up." + stopLocalRegistry + + if [ -n "$GIT_E2E_SETUP" ]; then + cleanupE2Egit + fi +} + +# Error messages are redirected to stderr +function handle_error { + echo "$(basename $0): ERROR! An error was encountered executing line $1." 1>&2; + cleanup + echo "Exiting with error." 1>&2; + exit 1 +} + +function handle_exit { + cleanup + echo "Exiting without error." 1>&2; + exit +} + +# Exit the script with a helpful error message when any error is encountered +trap 'set +x; handle_error $LINENO $BASH_COMMAND' ERR + +# Cleanup before exit on any termination signal +trap 'set +x; handle_exit' SIGQUIT SIGTERM SIGINT SIGKILL SIGHUP diff --git a/scripts/integration-tests/utils/git.sh b/scripts/integration-tests/utils/git.sh new file mode 100755 index 000000000000..2cce5ee99077 --- /dev/null +++ b/scripts/integration-tests/utils/git.sh @@ -0,0 +1,29 @@ +#!/bin/bash + +original_git_branch=`git rev-parse --abbrev-ref HEAD` +tmp_branch_name="integration-tests-$(date +'%F-%H-%M-%N')" +original_user_name=`git config user.name` +original_user_email=`git config user.email` + +export GIT_E2E_SETUP="true" + +function initializeE2Egit { + git checkout -b $tmp_branch_name + + # This is needed by lerna, which commits when publishing + git config user.name "Babel E2E Test" + git config user.email "babel-e2e@example.com" +} + +function cleanupE2Egit { + # Delete release tags + git tag -d $(git tag -l "version-e2e-test-*") + + # Checkout the previous branch + git checkout -f $original_git_branch + git branch -D $tmp_branch_name + + # Restore git user + git config user.name "$original_user_name" + git config user.email "$original_user_email" +} diff --git a/scripts/integration-tests/utils/local-registry.sh b/scripts/integration-tests/utils/local-registry.sh new file mode 100755 index 000000000000..e0212d2529b3 --- /dev/null +++ b/scripts/integration-tests/utils/local-registry.sh @@ -0,0 +1,34 @@ +#!/bin/bash + +# Copied from https://github.com/facebook/create-react-app/blob/053f9774d3f592c17741d2a86de66a7ca58f90c0/tasks/local-registry.sh + +custom_registry_url=http://localhost:4873 +original_npm_registry_url=`npm get registry` +original_yarn_registry_url=`yarn config get registry` +default_verdaccio_package=verdaccio@~4.3.3 + +function startLocalRegistry { + # Start local registry + tmp_registry_log=`mktemp` + echo "Registry output file: $tmp_registry_log" + (cd && nohup npx ${VERDACCIO_PACKAGE:-$default_verdaccio_package} -c $1 &>$tmp_registry_log &) + + # Wait for Verdaccio to boot + grep -q "http address" <(tail -f $tmp_registry_log) + + # Set registry to local registry + npm set registry "$custom_registry_url" + yarn config set registry "$custom_registry_url" +} + +function loginLocalRegistry { + # Login so we can publish packages + (cd && npx npm-auth-to-token@1.0.0 -u user -p password -e user@example.com -r "$custom_registry_url") +} + +function stopLocalRegistry { + # Restore the original NPM and Yarn registry URLs and stop Verdaccio + fuser -k 4873/tcp + npm set registry "$original_npm_registry_url" + yarn config set registry "$original_yarn_registry_url" +} diff --git a/scripts/integration-tests/verdaccio-config.yml b/scripts/integration-tests/verdaccio-config.yml new file mode 100755 index 000000000000..69d210aa3933 --- /dev/null +++ b/scripts/integration-tests/verdaccio-config.yml @@ -0,0 +1,61 @@ +# +# This is the default config file. It allows all users to do anything, +# so don't use it on production systems. +# +# Look here for more config file examples: +# https://github.com/verdaccio/verdaccio/tree/master/conf +# + +# path to a directory with all packages +storage: /tmp/verdaccio-workspace/storage + +auth: + htpasswd: + file: /tmp/verdaccio-workspace/htpasswd + # Maximum amount of users allowed to register, defaults to "+inf". + # You can set this to -1 to disable registration. + # max_users: 1000 + +# a list of other known repositories we can talk to +uplinks: + npmjs: + url: https://registry.npmjs.org/ + +packages: + '@*/*': + # scoped packages + access: $all + publish: $all + unpublish: $all + proxy: npmjs + + '**': + # allow all users (including non-authenticated users) to read and + # publish all packages + # + # you can specify usernames/groupnames (depending on your auth plugin) + # and three keywords: "$all", "$anonymous", "$authenticated" + access: $all + publish: $all + unpublish: $all + + # if package is not available locally, proxy requests to 'npmjs' registry + proxy: npmjs + +# You can specify HTTP/1.1 server keep alive timeout in seconds for incoming connections. +# A value of 0 makes the http server behave similarly to Node.js versions prior to 8.0.0, which did not have a keep-alive timeout. +# WORKAROUND: Through given configuration you can workaround following issue https://github.com/verdaccio/verdaccio/issues/301. Set to 0 in case 60 is not enough. +server: + keepAliveTimeout: 60 + +middlewares: + audit: + enabled: true + +# log settings +logs: + - { type: stdout, format: pretty, level: http } + #- {type: file, path: verdaccio.log, level: info} +#experiments: +# # support for npm token command +# token: false diff --git a/scripts/lint-ts-typings.sh b/scripts/lint-ts-typings.sh new file mode 100755 index 000000000000..1e308cd44ce8 --- /dev/null +++ b/scripts/lint-ts-typings.sh @@ -0,0 +1,6 @@ +#!/bin/bash +set -e + +tsFlags="--strict" + +yarn --silent tsc $tsFlags ./packages/babel-types/lib/index.d.ts diff --git a/scripts/parser-tests/flow/index.js b/scripts/parser-tests/flow/index.js new file mode 100644 index 000000000000..1a18471ded03 --- /dev/null +++ b/scripts/parser-tests/flow/index.js @@ -0,0 +1,136 @@ +const fs = require("fs").promises; +const path = require("path"); +const merge = require("mergeiterator"); +const TestRunner = require("../utils/parser-test-runner"); + +const flowOptionsMapping = { + esproposal_class_instance_fields: "classProperties", + esproposal_class_static_fields: "classProperties", + esproposal_export_star_as: "exportNamespaceFrom", + esproposal_decorators: "decorators-legacy", + esproposal_nullish_coalescing: "nullishCoalescingOperator", + esproposal_optional_chaining: "optionalChaining", + types: "flowComments", + intern_comments: false, +}; + +function getPlugins(test) { + const flowOptions = { all: true }; + + const plugins = [ + "dynamicImport", + ["flow", flowOptions], + "flowComments", + "jsx", + "classProperties", + "classPrivateProperties", + "classPrivateMethods", + "bigInt", + "numericSeparator", + ]; + + if (!test.options) return plugins; + + for (const [option, enabled] of Object.entries(test.options)) { + if (!enabled) { + const idx = plugins.indexOf(flowOptionsMapping[option]); + if (idx !== -1) plugins.splice(idx, 1); + } else if (option === "enums") { + flowOptions.enums = true; + } else if (!(option in flowOptionsMapping)) { + throw new Error("Parser options not mapped " + option); + } else if (flowOptionsMapping[option]) { + plugins.push(flowOptionsMapping[option]); + } + } + + return plugins; +} + +async function* readdirRecursive(root, dir = ".") { + const names = await fs.readdir(path.join(root, dir)); + + const dirs = []; + + for (const name of names) { + const file = path.join(dir, name); + const stats = await fs.stat(path.join(root, file)); + if (!stats.isDirectory()) { + if (!file) continue; + yield file; + } else { + dirs.push(readdirRecursive(root, file)); + } + } + + yield* merge(dirs); +} + +async function* loadTests(root) { + for await (const file of readdirRecursive(root)) { + if (file.slice(-3) === ".js") { + const noExt = path.join(root, file).slice(0, -3); + + const [contents, tree, options] = await Promise.all([ + fs.readFile(noExt + ".js", "utf8"), + fs.readFile(noExt + ".tree.json", "utf8").catch(() => null), + fs.readFile(noExt + ".options.json", "utf8").catch(() => null), + ]); + + yield { + file, + contents, + tree: JSON.parse(tree), + options: JSON.parse(options), + }; + } + } +} + +const runner = new TestRunner({ + testDir: path.join(__dirname, "../../../build/flow/src/parser/test/flow"), + whitelist: path.join(__dirname, "whitelist.txt"), + shouldUpdate: process.argv.includes("--update-whitelist"), + + async *getTests() { + for await (const test of loadTests(this.testDir)) { + const shouldSuccess = + test.tree && (!test.tree.errors || !test.tree.errors.length); + + yield { + contents: test.contents, + fileName: test.file, + id: test.file, + expectedError: !shouldSuccess, + plugins: getPlugins(test), + }; + } + }, + + parse(test, parser) { + try { + parser(test.contents, { + sourceType: "module", + plugins: test.plugins, + }); + } catch (e) { + // lets retry in script mode + if (!test.expectedError) { + try { + parser(test.contents, { + sourceType: "script", + plugins: test.plugins, + }); + return; + } catch {} + } + + throw e; + } + }, +}); + +runner.run().catch(err => { + console.error(err); + process.exitCode = 1; +}); diff --git a/scripts/parser-tests/flow/whitelist.txt b/scripts/parser-tests/flow/whitelist.txt new file mode 100644 index 000000000000..b2d5b21fdd04 --- /dev/null +++ b/scripts/parser-tests/flow/whitelist.txt @@ -0,0 +1,20 @@ +ES6/modules/export_default_class_implements.js +ES6/modules/migrated_0020.js +JSX/invalid_unpaired_gt.js +JSX/invalid_unpaired_rcurly.js +JSX_invalid/migrated_0000.js +arrow_function/object_return_type.js +arrow_function_invalid/migrated_0002.js +async_await/migrated_0020.js +async_await/migrated_0024.js +async_await/migrated_0027.js +class_expression/anonymous_implements.js +class_method_kinds/polymorphic_getter.js +class_properties/migrated_0021.js +class_properties/migrated_0026.js +decorators/migrated_0003.js +export_import_reserved_words/migrated_0003.js +export_statements/export_trailing_comma.js +nullish_coalescing/missing-plugin.js +optional_chaining/missing-plugin.js +types/member/reserved_words.js diff --git a/scripts/parser-tests/test262/index.js b/scripts/parser-tests/test262/index.js new file mode 100644 index 000000000000..e2f8b08fcae0 --- /dev/null +++ b/scripts/parser-tests/test262/index.js @@ -0,0 +1,198 @@ +const path = require("path"); +const TestStream = require("test262-stream"); +const TestRunner = require("../utils/parser-test-runner"); + +const ignoredFeatures = [ + "AggregateError", + "Array.prototype.flat", + "Array.prototype.flatMap", + "Array.prototype.values", + "ArrayBuffer", + "async-functions", + "async-iteration", + "arrow-function", + "Atomics", + "caller", + "class", + "computed-property-names", + "const", + "cross-realm", + "DataView", + "DataView.prototype.getFloat32", + "DataView.prototype.getFloat64", + "DataView.prototype.getInt8", + "DataView.prototype.getInt16", + "DataView.prototype.getInt32", + "DataView.prototype.getUint16", + "DataView.prototype.getUint32", + "DataView.prototype.setUint8", + "default-parameters", + "destructuring-assignment", + "destructuring-binding", + "FinalizationGroup", + "Float32Array", + "Float64Array", + "for-in-order", + "for-of", + "generators", + "globalThis", + "hashbang", + "host-gc-required", + "Int8Array", + "Int32Array", + "Intl.DateTimeFormat-datetimestyle", + "Intl.DateTimeFormat-dayPeriod", + "Intl.DateTimeFormat-fractionalSecondDigits", + "Intl.DateTimeFormat-formatRange", + "Intl.DisplayNames", + "Intl.ListFormat", + "Intl.Locale", + "Intl.NumberFormat-unified", + "Intl.RelativeTimeFormat", + "Intl.Segmenter", + "IsHTMLDDA", + "json-superset", + "let", + "Map", + "new.target", + "Object.fromEntries", + "Object.is", + "object-rest", + "object-spread", + "optional-catch-binding", + "Promise.allSettled", + "Promise.prototype.finally", + "Proxy", + "proxy-missing-checks", + "Reflect", + "Reflect.construct", + "Reflect.set", + "Reflect.setPrototypeOf", + "regexp-dotall", + "regexp-lookbehind", + "regexp-named-groups", + "regexp-unicode-property-escapes", + "rest-parameters", + "SharedArrayBuffer", + "Set", + "String.fromCodePoint", + "String.prototype.endsWith", + "String.prototype.includes", + "String.prototype.matchAll", + "String.prototype.replaceAll", + "String.prototype.trimEnd", + "String.prototype.trimStart", + "string-trimming", + "super", + "Symbol", + "Symbol.asyncIterator", + "Symbol.hasInstance", + "Symbol.isConcatSpreadable", + "Symbol.iterator", + "Symbol.match", + "Symbol.matchAll", + "Symbol.prototype.description", + "Symbol.replace", + "Symbol.search", + "Symbol.split", + "Symbol.species", + "Symbol.toPrimitive", + "Symbol.toStringTag", + "Symbol.unscopables", + "tail-call-optimization", + "template", + "TypedArray", + "u180e", + "Uint8Array", + "Uint8ClampedArray", + "Uint16Array", + "WeakMap", + "WeakSet", + "WeakRef", + "well-formed-json-stringify", +]; + +const ignoredTests = ["built-ins/RegExp/", "language/literals/regexp/"]; + +const featuresToPlugins = { + BigInt: "bigInt", + "class-fields-private": "classPrivateProperties", + "class-fields-public": "classProperties", + "class-methods-private": "classPrivateMethods", + "class-static-fields-public": "classProperties", + "class-static-fields-private": "classPrivateProperties", + "class-static-methods-private": "classPrivateMethods", + "coalesce-expression": "nullishCoalescingOperator", + "dynamic-import": "dynamicImport", + "export-star-as-namespace-from-module": "exportNamespaceFrom", + "import.meta": "importMeta", + "numeric-separator-literal": "numericSeparator", + "optional-chaining": "optionalChaining", + "top-level-await": "topLevelAwait", +}; + +const unmappedFeatures = new Set(); + +function* getPlugins(features) { + if (!features) return; + + for (const f of features) { + if (featuresToPlugins[f]) { + yield featuresToPlugins[f]; + } else if (!ignoredFeatures.includes(f)) { + unmappedFeatures.add(f); + } + } +} + +const runner = new TestRunner({ + testDir: path.join(__dirname, "../../../build/test262"), + whitelist: path.join(__dirname, "whitelist.txt"), + logInterval: 500, + shouldUpdate: process.argv.includes("--update-whitelist"), + + async *getTests() { + const stream = new TestStream(this.testDir, { + omitRuntime: true, + }); + + for await (const test of stream) { + // strip test/ + const fileName = test.file.substr(5); + + if (ignoredTests.some(start => fileName.startsWith(start))) continue; + + yield { + contents: test.contents, + fileName, + id: `${fileName}(${test.scenario})`, + sourceType: test.attrs.flags.module ? "module" : "script", + plugins: Array.from(getPlugins(test.attrs.features)), + expectedError: + !!test.attrs.negative && + (test.attrs.negative.phase === "parse" || + test.attrs.negative.phase === "early"), + }; + } + }, +}); + +runner + .run() + .then(() => { + if (unmappedFeatures.size) { + console.log(""); + console.log( + "The following Features are not currently mapped or ignored:" + ); + console.log( + Array.from(unmappedFeatures) + .join("\n") + .replace(/^/gm, " ") + ); + } + }) + .catch(err => { + console.error(err); + process.exitCode = 1; + }); diff --git a/scripts/parser-tests/test262/whitelist.txt b/scripts/parser-tests/test262/whitelist.txt new file mode 100644 index 000000000000..8b137891791f --- /dev/null +++ b/scripts/parser-tests/test262/whitelist.txt @@ -0,0 +1 @@ + diff --git a/scripts/parser-tests/typescript/error-codes.js b/scripts/parser-tests/typescript/error-codes.js new file mode 100644 index 000000000000..2a2580dfb8a2 --- /dev/null +++ b/scripts/parser-tests/typescript/error-codes.js @@ -0,0 +1,71 @@ +/* +This file includes the code of TS Diagnostics error that should also be thrown from babel-parser. +The TypeScript parser is highly tolerant on errors so these error would not produce parseDiagnostics which can be checked +in the parser test runner. We check these error codes against the stderr log in the build/typescript/tests/baselines/reference + +Note that babel-parser should not throw for the TypeChecking Diagnostics + +The commented out diagnostic codes will introduce false positive cases that should be addressed in separate PRs. +*/ + +module.exports = [ + // "TS1005", // '{0}' expected. + "TS1009", // Trailing comma not allowed. + "TS1014", // A rest parameter must be last in a parameter list. + "TS1019", // An index signature parameter cannot have a question mark. + "TS1028", // Accessibility modifier already seen. + "TS1029", // '{0}' modifier must precede '{1}' modifier. + "TS1030", // '{0}' modifier already seen. + "TS1031", // '{0}' modifier cannot appear on a class element. + "TS1042", // '{0}' modifier cannot be used here. + "TS1048", // A rest parameter cannot have an initializer. + "TS1053", // A 'set' accessor cannot have rest parameter. + "TS1054", // A 'get' accessor cannot have parameters. + // "TS1071", // '{0}' modifier cannot appear on an index signature. + "TS1089", // '{0}' modifier cannot appear on a constructor declaration. + "TS1090", // '{0}' modifier cannot appear on a parameter. + "TS1100", // Invalid use of 'arguments' in strict mode. + "TS1101", // 'with' statements are not allowed in strict mode. + "TS1104", // A 'continue' statement can only be used within an enclosing iteration statement. + "TS1105", // A 'break' statement can only be used within an enclosing iteration or switch statement. + "TS1107", // Jump target cannot cross function boundary. + "TS1108", // A 'return' statement can only be used within a function body. + "TS1113", // A 'default' clause cannot appear more than once in a 'switch' statement. + "TS1115", // A 'continue' statement can only jump to a label of an enclosing iteration statement. + "TS1116", // A 'break' statement can only jump to a label of an enclosing statement. + "TS1123", // Variable declaration list cannot be empty. + "TS1141", // String literal expected. + "TS1142", // Line break not permitted here. + "TS1162", // An object member cannot be declared optional. + "TS1163", // A 'yield' expression is only allowed in a generator body. + "TS1184", // Modifiers cannot appear here. + "TS1191", // An import declaration cannot have modifiers. + "TS1196", // Catch clause variable cannot have a type annotation. + "TS1197", // Catch clause variable cannot have an initializer. + "TS1200", // Line terminator not permitted before arrow. + "TS1312", // '=' can only be used in an object literal property inside a destructuring assignment. + // "TS1212", // Identifier expected. '{0}' is a reserved word in strict mode." + // "TS1213", // Identifier expected. '{0}' is a reserved word in strict mode. Class definitions are automatically in strict mode. + // "TS1214", // Identifier expected. '{0}' is a reserved word in strict mode. Modules are automatically in strict mode. + "TS1246", // An interface property cannot have an initializer. + "TS1247", // A type literal property cannot have an initializer. + "TS1248", // A class member cannot have the 'const' keyword. + "TS1308", // 'await' expression is only allowed within an async function. + "TS2337", // Super calls are not permitted outside constructors or in nested functions inside constructors. + // "TS2300", // Duplicate identifier '{0}'. + "TS2364", // The left-hand side of an assignment expression must be a variable or a property access. + // "TS2371", // A parameter initializer is only allowed in a function or constructor implementation. + // "TS2393", // Duplicate function implementation. + "TS2396", // Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. + // "TS2440", // Import declaration conflicts with local declaration of '{0}'. + // "TS2451", // Cannot redeclare block-scoped variable '{0}'. + "TS2452", // An enum member cannot have a numeric name. + "TS2566", // A rest element cannot have a property name. + "TS2481", // Cannot initialize outer scoped variable '{0}' in the same scope as block scoped declaration '{0}'. + // "TS2567", // Enum declarations can only merge with namespace or other enum declarations. + "TS2659", // 'super' is only allowed in members of object literal expressions when option 'target' is 'ES2015' or higher. + "TS2660", // 'super' can only be referenced in members of derived classes or object literal expressions. + "TS2699", // Static property '{0}' conflicts with built-in property 'Function.{0}' of constructor function '{1}'. + "TS8018", // Octal literals are not allowed in enums members initializer. + // "TS17012", // '{0}' is not a valid meta-property for keyword '{1}'. Did you mean '{2}'? +]; diff --git a/scripts/parser-tests/typescript/index.js b/scripts/parser-tests/typescript/index.js new file mode 100644 index 000000000000..5e3e4b2a9d63 --- /dev/null +++ b/scripts/parser-tests/typescript/index.js @@ -0,0 +1,81 @@ +const path = require("path"); +const fs = require("fs").promises; +const ts = require("../../../build/typescript"); +const TestRunner = require("../utils/parser-test-runner"); +const parsingErrorCodes = require("./error-codes"); + +async function* loadTests(dir) { + const names = await fs.readdir(dir); + + for (const name of names) { + const contents = await fs.readFile(path.join(dir, name), "utf8"); + yield { name, contents }; + } +} + +const plugins = [ + "typescript", + "classProperties", + "decorators-legacy", + "bigInt", + "dynamicImport", +]; + +const TSTestsPath = path.join(__dirname, "../../../build/typescript/tests"); + +// Check if the baseline errors contain the codes that should also be thrown from babel-parser +async function baselineContainsParserErrorCodes(testName) { + try { + const baselineErrors = await fs.readFile( + path.join( + TSTestsPath, + "baselines/reference", + testName.replace(/\.tsx?$/, ".errors.txt") + ), + "utf8" + ); + return parsingErrorCodes.some(code => baselineErrors.includes(code)); + } catch (e) { + if (e.code !== "ENOENT") { + throw e; + } + return false; + } +} + +const runner = new TestRunner({ + testDir: path.join(TSTestsPath, "./cases/compiler"), + whitelist: path.join(__dirname, "whitelist.txt"), + logInterval: 50, + shouldUpdate: process.argv.includes("--update-whitelist"), + + async *getTests() { + for await (const test of loadTests(this.testDir)) { + const isTSX = test.name.slice(-4) === ".tsx"; + + const ast = ts.createSourceFile( + test.name, + test.contents, + ts.ScriptTarget.Latest, + false, + isTSX ? ts.ScriptKind.TSX : ts.ScriptKind.TS + ); + + yield { + contents: test.contents, + fileName: test.name, + id: test.name, + expectedError: + ast.parseDiagnostics.length > 0 || + (await baselineContainsParserErrorCodes(test.name)), + sourceType: "module", + plugins: isTSX ? plugins.concat("jsx") : plugins, + }; + } + }, +}); + +runner.run().catch(err => { + console.error(err); + process.exitCode = 1; +}); diff --git a/scripts/parser-tests/typescript/whitelist.txt b/scripts/parser-tests/typescript/whitelist.txt new file mode 100644 index 000000000000..36d525c171eb --- /dev/null +++ b/scripts/parser-tests/typescript/whitelist.txt @@ -0,0 +1,399 @@ +ArrowFunctionExpression1.ts +MemberAccessorDeclaration15.ts +ParameterList13.ts +ParameterList4.ts +ParameterList5.ts +ParameterList6.ts +accessorParameterAccessibilityModifier.ts +accessorWithoutBody1.ts +accessorWithoutBody2.ts +aliasUsageInAccessorsOfClass.ts +aliasUsageInArray.ts +aliasUsageInFunctionExpression.ts +aliasUsageInGenericFunction.ts +aliasUsageInIndexerOfClass.ts +aliasUsageInObjectLiteral.ts +aliasUsageInOrExpression.ts +aliasUsageInTypeArgumentOfExtendsClause.ts +aliasUsageInVarAssignment.ts +aliasUsedAsNameValue.ts +allowImportClausesToMergeWithTypes.ts +allowJscheckJsTypeParameterNoCrash.ts +amdDeclarationEmitNoExtraDeclare.ts +amdModuleConstEnumUsage.ts +amdModuleName2.ts +anonClassDeclarationEmitIsAnon.ts +anyDeclare.ts +argumentsBindsToFunctionScopeArgumentList.ts +arrayOfExportedClass.ts +asyncFunctionsAcrossFiles.ts +augmentExportEquals1.ts +augmentExportEquals1_1.ts +augmentExportEquals2.ts +augmentExportEquals2_1.ts +augmentExportEquals3.ts +augmentExportEquals3_1.ts +augmentExportEquals4.ts +augmentExportEquals4_1.ts +augmentExportEquals6.ts +augmentExportEquals6_1.ts +augmentExportEquals7.ts +augmentedTypesClass.ts +augmentedTypesClass2.ts +augmentedTypesClass2a.ts +augmentedTypesClass4.ts +augmentedTypesEnum.ts +augmentedTypesEnum2.ts +augmentedTypesFunction.ts +augmentedTypesInterface.ts +augmentedTypesVar.ts +bigIntWithTargetES3.ts +bigintIndex.ts +bigintWithLib.ts +cacheResolutions.ts +cachedModuleResolution1.ts +cachedModuleResolution2.ts +cachedModuleResolution3.ts +cachedModuleResolution4.ts +cachedModuleResolution5.ts +cachedModuleResolution6.ts +cachedModuleResolution7.ts +cachedModuleResolution8.ts +cachedModuleResolution9.ts +callOverloads2.ts +checkSuperCallBeforeThisAccessing9.ts +classCannotExtendVar.ts +classExpressionWithDecorator1.ts +classExtendsAcrossFiles.ts +classExtendsMultipleBaseClasses.ts +classOverloadForFunction.ts +collisionExportsRequireAndClass.ts +commonSourceDir5.ts +commonSourceDir6.ts +commonjsSafeImport.ts +conflictingTypeAnnotatedVar.ts +constDeclarations-invalidContexts.ts +constDeclarations-scopes.ts +constDeclarations-validContexts.ts +constEnumNoEmitReexport.ts +constEnumNoPreserveDeclarationReexport.ts +constEnumPreserveEmitReexport.ts +convertKeywordsYes.ts +declarationEmitAmdModuleNameDirective.ts +declarationEmitComputedNameCausesImportToBePainted.ts +declarationEmitComputedNameConstEnumAlias.ts +declarationEmitCrossFileImportTypeOfAmbientModule.ts +declarationEmitDefaultExportWithStaticAssignment.ts +declarationEmitDestructuring2.ts +declarationEmitDestructuringOptionalBindingParametersInOverloads.ts +declarationEmitDestructuringParameterProperties.ts +declarationEmitDestructuringWithOptionalBindingParameters.ts +declarationEmitExpandoPropertyPrivateName.ts +declarationEmitExportAssignment.ts +declarationEmitExportDeclaration.ts +declarationEmitForTypesWhichNeedImportTypes.ts +declarationEmitInterfaceWithNonEntityNameExpressionHeritage.ts +declarationEmitPrefersPathKindBasedOnBundling.ts +declarationEmitPrefersPathKindBasedOnBundling2.ts +declarationEmitPrivateSymbolCausesVarDeclarationEmit2.ts +declarationImportTypeAliasInferredAndEmittable.ts +declarationMapsMultifile.ts +declarationMapsOutFile.ts +declarationsForInferredTypeFromOtherFile.ts +declareModifierOnImport1.ts +decoratorMetadataRestParameterWithImportedType.ts +decoratorMetadataWithImportDeclarationNameCollision.ts +decoratorMetadataWithImportDeclarationNameCollision3.ts +decoratorMetadataWithImportDeclarationNameCollision4.ts +decoratorMetadataWithImportDeclarationNameCollision5.ts +decoratorMetadataWithImportDeclarationNameCollision7.ts +decoratorReferenceOnOtherProperty.ts +decoratorsOnComputedProperties.ts +decrementAndIncrementOperators.ts +defaultArgsInOverloads.ts +defaultDeclarationEmitDefaultImport.ts +defaultIsNotVisibleInLocalScope.ts +defaultPropsEmptyCurlyBecomesAnyForJs.ts +defaultValueInFunctionTypes.ts +deleteOperator1.ts +deleteOperatorInStrictMode.ts +dependencyViaImportAlias.ts +destructureOptionalParameter.ts +destructuredDeclarationEmit.ts +doubleUnderscoreExportStarConflict.ts +duplicateIdentifierBindingElementInParameterDeclaration1.ts +duplicateIdentifierBindingElementInParameterDeclaration2.ts +duplicateIdentifierEnum.ts +duplicateIdentifierInCatchBlock.ts +duplicateIdentifierRelatedSpans1.ts +duplicateIdentifierRelatedSpans2.ts +duplicateIdentifiersAcrossFileBoundaries.ts +duplicateLabel1.ts +duplicateLabel2.ts +duplicateVarAndImport.ts +duplicateVarAndImport2.ts +duplicateVarsAcrossFileBoundaries.ts +dynamicNames.ts +elidedEmbeddedStatementsReplacedWithSemicolon.ts +emitClassMergedWithConstNamespaceNotElided.ts +emitSuperCallBeforeEmitParameterPropertyDeclaration1.ts +emitSuperCallBeforeEmitParameterPropertyDeclaration1ES6.ts +emitSuperCallBeforeEmitPropertyDeclarationAndParameterPropertyDeclaration1.ts +emitSuperCallBeforeEmitPropertyDeclarationAndParameterPropertyDeclaration1ES6.ts +enumGenericTypeClash.ts +es3-oldStyleOctalLiteralTypes.ts +es3defaultAliasIsQuoted.ts +es5-asyncFunctionWithStatements.ts +es5-importHelpersAsyncFunctions.ts +es5-oldStyleOctalLiteralInEnums.ts +es5ModuleInternalNamedImports.ts +es6ExportAssignment2.ts +es6ExportAssignment3.ts +es6ImportDefaultBindingFollowedWithNamedImport.ts +es6ImportDefaultBindingFollowedWithNamedImport1.ts +es6ImportDefaultBindingFollowedWithNamedImport1InEs5.ts +es6ImportDefaultBindingFollowedWithNamedImportDts.ts +es6ImportDefaultBindingFollowedWithNamedImportDts1.ts +es6ImportDefaultBindingFollowedWithNamedImportInEs5.ts +es6ImportDefaultBindingMergeErrors.ts +es6ImportEqualsDeclaration.ts +es6ImportEqualsExportModuleCommonJsError.ts +es6ImportEqualsExportModuleEs2015Error.ts +es6ImportNameSpaceImportMergeErrors.ts +es6ImportNamedImport.ts +es6ImportNamedImportAmd.ts +es6ImportNamedImportDts.ts +es6ImportNamedImportInEs5.ts +es6ImportNamedImportInExportAssignment.ts +es6ImportNamedImportMergeErrors.ts +es6ImportNamedImportNoExportMember.ts +es6ImportNamedImportNoNamedExports.ts +es6ImportNamedImportWithTypesAndValues.ts +es6ModuleInternalNamedImports.ts +es6ModuleInternalNamedImports2.ts +es6UseOfTopLevelRequire.ts +esModuleInterop.ts +esModuleInteropImportTSLibHasImport.ts +esModuleInteropNamedDefaultImports.ts +esModuleInteropTslibHelpers.ts +exportAssignClassAndModule.ts +exportAssignmentImportMergeNoCrash.ts +exportAssignmentMembersVisibleInAugmentation.ts +exportAssignmentWithDeclareAndExportModifiers.ts +exportAssignmentWithDeclareModifier.ts +exportAssignmentWithExportModifier.ts +exportAssignmentWithoutAllowSyntheticDefaultImportsError.ts +exportClassExtendingIntersection.ts +exportClassWithoutName.ts +exportDeclarationsInAmbientNamespaces.ts +exportDefaultAbstractClass.ts +exportDefaultAsyncFunction2.ts +exportDefaultMarksIdentifierAsUsed.ts +exportDefaultStripsFreshness.ts +exportEqualsOfModule.ts +exportImport.ts +exportImportNonInstantiatedModule2.ts +exportSameNameFuncVar.ts +exportSpecifierAndExportedMemberDeclaration.ts +exportSpecifierAndLocalMemberDeclaration.ts +exportStarFromEmptyModule.ts +expressionsForbiddenInParameterInitializers.ts +extendingClassFromAliasAndUsageInIndexer.ts +extendsClauseAlreadySeen.ts +extendsClauseAlreadySeen2.ts +externalModuleAssignToVar.ts +fileWithNextLine2.ts +funClodule.ts +functionAndImportNameConflict.ts +functionCall15.ts +functionDeclarationWithResolutionOfTypeNamedArguments01.ts +functionExpressionInWithBlock.ts +functionExpressionWithResolutionOfTypeNamedArguments01.ts +gettersAndSettersErrors.ts +giant.ts +implementClausePrecedingExtends.ts +implementsClauseAlreadySeen.ts +importAndVariableDeclarationConflict1.ts +importAndVariableDeclarationConflict3.ts +importAndVariableDeclarationConflict4.ts +importAsBaseClass.ts +importDecl.ts +importDeclWithClassModifiers.ts +importDeclWithDeclareModifierInAmbientContext.ts +importHelpers.ts +importHelpersAmd.ts +importHelpersInAmbientContext.ts +importHelpersInIsolatedModules.ts +importHelpersInTsx.tsx +importHelpersNoHelpers.ts +importHelpersNoModule.ts +importHelpersOutFile.ts +importHelpersSystem.ts +importWithTrailingSlash.ts +importedModuleClassNameClash.ts +indexSignatureWithAccessibilityModifier.ts +indexSignatureWithInitializer1.ts +indexTypeCheck.ts +indexWithoutParamType.ts +indexerSignatureWithRestParam.ts +initializedParameterBeforeNonoptionalNotOptional.ts +interfaceMayNotBeExtendedWitACall.ts +interfaceWithImplements1.ts +invalidReferenceSyntax1.ts +isLiteral1.ts +isLiteral2.ts +isolatedModulesReExportType.ts +jsEnumTagOnObjectFrozen.ts +jsFileCompilationBindDuplicateIdentifier.ts +jsFileCompilationDuplicateFunctionImplementation.ts +jsFileCompilationDuplicateFunctionImplementationFileOrderReversed.ts +jsFileCompilationExternalPackageError.ts +jsNoImplicitAnyNoCascadingReferenceErrors.ts +jsdocAccessEnumType.ts +jsxAttributeWithoutExpressionReact.tsx +jsxIntrinsicElementsExtendsRecord.tsx +letAndVarRedeclaration.ts +letAsIdentifier.ts +letAsIdentifierInStrictMode.ts +letDeclarations-invalidContexts.ts +letDeclarations-scopes-duplicates.ts +letDeclarations-scopes-duplicates2.ts +letDeclarations-scopes-duplicates3.ts +letDeclarations-scopes-duplicates4.ts +letDeclarations-scopes-duplicates5.ts +letDeclarations-scopes-duplicates6.ts +letDeclarations-scopes-duplicates7.ts +letDeclarations-scopes.ts +letDeclarations-validContexts.ts +mergeWithImportedType.ts +mergedDeclarations6.ts +metadataOfClassFromAlias.ts +metadataOfClassFromAlias2.ts +metadataReferencedWithinFilteredUnion.ts +mismatchedClassConstructorVariable.ts +missingSemicolonInModuleSpecifier.ts +misspelledNewMetaProperty.ts +modifiersOnInterfaceIndexSignature1.ts +moduleAugmentationCollidingNamesInAugmentation1.ts +moduleAugmentationDeclarationEmit1.ts +moduleAugmentationDeclarationEmit2.ts +moduleAugmentationDisallowedExtensions.ts +moduleAugmentationDuringSyntheticDefaultCheck.ts +moduleAugmentationExtendAmbientModule1.ts +moduleAugmentationExtendAmbientModule2.ts +moduleAugmentationExtendFileModule1.ts +moduleAugmentationExtendFileModule2.ts +moduleAugmentationGlobal1.ts +moduleAugmentationGlobal2.ts +moduleAugmentationGlobal3.ts +moduleAugmentationImportsAndExports1.ts +moduleAugmentationImportsAndExports2.ts +moduleAugmentationImportsAndExports3.ts +moduleAugmentationImportsAndExports4.ts +moduleAugmentationImportsAndExports5.ts +moduleAugmentationImportsAndExports6.ts +moduleAugmentationNoNewNames.ts +moduleAugmentationsBundledOutput1.ts +moduleAugmentationsImports1.ts +moduleAugmentationsImports2.ts +moduleAugmentationsImports3.ts +moduleAugmentationsImports4.ts +moduleDuplicateIdentifiers.ts +moduleResolutionNoTs.ts +moduleResolutionWithSymlinks.ts +moduleResolutionWithSymlinks_withOutDir.ts +moduleResolution_automaticTypeDirectiveNames.ts +moduleSharesNameWithImportDeclarationInsideIt3.ts +moduleSharesNameWithImportDeclarationInsideIt5.ts +module_augmentUninstantiatedModule2.ts +multiImportExport.ts +multipleInheritance.ts +nameCollisions.ts +namespacesWithTypeAliasOnlyExportsMerge.ts +narrowedImports.ts +newNamesInGlobalAugmentations1.ts +noBundledEmitFromNodeModules.ts +noCrashOnImportShadowing.ts +noImplicitAnyDestructuringVarDeclaration.ts +noSymbolForMergeCrash.ts +nodeResolution4.ts +nodeResolution6.ts +nodeResolution8.ts +nonMergedOverloads.ts +numberVsBigIntOperations.ts +objectLiteralMemberWithoutBlock1.ts +outModuleConcatAmd.ts +outModuleConcatCommonjs.ts +outModuleConcatCommonjsDeclarationOnly.ts +outModuleConcatES6.ts +outModuleConcatSystem.ts +outModuleConcatUmd.ts +outModuleTripleSlashRefs.ts +parameterInitializerBeforeDestructuringEmit.ts +parameterPropertyOutsideConstructor.ts +parseGenericArrowRatherThanLeftShift.ts +pathMappingBasedModuleResolution3_classic.ts +pathMappingBasedModuleResolution3_node.ts +preserveUnusedImports.ts +privacyCheckExternalModuleExportAssignmentOfGenericClass.ts +privacyTopLevelAmbientExternalModuleImportWithExport.ts +privacyTopLevelAmbientExternalModuleImportWithoutExport.ts +reExportGlobalDeclaration1.ts +reExportUndefined1.ts +reExportUndefined2.ts +readonlyInNonPropertyParameters.ts +recursiveExportAssignmentAndFindAliasedType1.ts +recursiveExportAssignmentAndFindAliasedType2.ts +recursiveExportAssignmentAndFindAliasedType3.ts +recursiveExportAssignmentAndFindAliasedType4.ts +recursiveExportAssignmentAndFindAliasedType5.ts +recursiveExportAssignmentAndFindAliasedType6.ts +recursiveExportAssignmentAndFindAliasedType7.ts +redeclareParameterInCatchBlock.ts +reexportedMissingAlias.ts +relativeNamesInClassicResolution.ts +requireAsFunctionInExternalModule.ts +restParamModifier2.ts +shadowedReservedCompilerDeclarationsWithNoEmit.ts +shorthandPropertyAssignmentInES6Module.ts +sourceMap-LineBreaks.ts +sourceMapValidationDecorators.ts +sourceMapValidationStatements.ts +staticIndexer.ts +strictModeReservedWord.ts +strictModeReservedWordInClassDeclaration.ts +superCallFromClassThatHasNoBaseType1.ts +symbolLinkDeclarationEmitModuleNames.ts +symbolMergeValueAndImportedType.ts +systemExportAssignment.ts +systemExportAssignment2.ts +systemModule11.ts +systemModule15.ts +systemModule17.ts +systemModuleWithSuperClass.ts +systemObjectShorthandRename.ts +targetEs6DecoratorMetadataImportNotElided.ts +targetTypeCastTest.ts +tsxDeepAttributeAssignabilityError.tsx +typeReferenceDirectives10.ts +typeReferenceDirectives11.ts +typeReferenceDirectives12.ts +typeReferenceDirectives13.ts +typeReferenceDirectives5.ts +typeReferenceDirectives7.ts +typeReferenceDirectives8.ts +typeReferenceDirectives9.ts +unusedImports1.ts +unusedImports11.ts +unusedImports12.ts +unusedImports2.ts +unusedImports3.ts +unusedImports4.ts +unusedImports5.ts +unusedInvalidTypeArguments.ts +varAndFunctionShareName.ts +varArgConstructorMemberParameter.ts +withStatement.ts +withStatementErrors.ts +withStatementInternalComments.ts +withStatementNestedScope.ts diff --git a/scripts/parser-tests/utils/parser-test-runner.js b/scripts/parser-tests/utils/parser-test-runner.js new file mode 100644 index 000000000000..764ef593d4f5 --- /dev/null +++ b/scripts/parser-tests/utils/parser-test-runner.js @@ -0,0 +1,237 @@ +"use strict"; + +const fs = require("fs").promises; +const chalk = require("chalk"); +const { parse: parser } = require("../../../packages/babel-parser"); + +const dot = chalk.gray("."); + +class TestRunner { + constructor({ + testDir, + whitelist, + logInterval = 1, + shouldUpdate, + getTests, + parse = this.parse, + }) { + this.testDir = testDir; + this.whitelist = whitelist; + this.logInterval = logInterval; + this.shouldUpdate = shouldUpdate; + this.getTests = getTests; + this.parse = parse; + } + + async run() { + const whitelistP = this.getWhitelist(); + + console.log(`Now running tests...`); + + const results = []; + for await (const result of this.runTests()) { + results.push(result); + if (results.length % this.logInterval === 0) process.stdout.write(dot); + } + process.stdout.write("\n"); + + const summary = this.interpret(results, await whitelistP); + + await this.output(summary); + } + + async *runTests() { + for await (const test of this.getTests()) { + yield this.runTest(test); + } + } + + runTest(test) { + try { + this.parse(test, parser); + test.actualError = false; + } catch (err) { + test.actualError = true; + } + + test.result = test.expectedError !== test.actualError ? "fail" : "pass"; + + return test; + } + + parse(test, parser) { + parser(test.contents, { + sourceType: test.sourceType, + plugins: test.plugins, + }); + } + + async getWhitelist() { + const contents = await fs.readFile(this.whitelist, "utf-8"); + const table = new Set(); + + for (const line of contents.split("\n")) { + const filename = line.replace(/#.*$/, "").trim(); + if (filename) table.add(filename); + } + + return table; + } + + async updateWhitelist(summary) { + const contents = await fs.readFile(this.whitelist, "utf-8"); + + const toRemove = summary.disallowed.success + .concat(summary.disallowed.failure) + .map(test => test.id) + .concat(summary.unrecognized); + + const updated = summary.disallowed.falsePositive + .concat(summary.disallowed.falseNegative) + .map(test => test.id); + + for (const line of contents.split("\n")) { + const testId = line.replace(/#.*$/, "").trim(); + if (!toRemove.includes(testId) && line) { + updated.push(line); + } + } + + updated.sort(); + + await fs.writeFile(this.whitelist, updated.join("\n") + "\n", "utf8"); + } + + interpret(results, whitelist) { + const summary = { + passed: true, + allowed: { + success: [], + failure: [], + falsePositive: [], + falseNegative: [], + }, + disallowed: { + success: [], + failure: [], + falsePositive: [], + falseNegative: [], + }, + unrecognized: null, + count: results.length, + }; + + results.forEach(function(result) { + let classification, isAllowed; + const inWhitelist = whitelist.has(result.id); + whitelist.delete(result.id); + + if (!result.expectedError) { + if (!result.actualError) { + classification = "success"; + isAllowed = !inWhitelist; + } else { + classification = "falseNegative"; + isAllowed = inWhitelist; + } + } else { + if (!result.actualError) { + classification = "falsePositive"; + isAllowed = inWhitelist; + } else { + classification = "failure"; + isAllowed = !inWhitelist; + } + } + + summary.passed &= isAllowed; + summary[isAllowed ? "allowed" : "disallowed"][classification].push( + result + ); + }); + + summary.unrecognized = Array.from(whitelist); + summary.passed = !!summary.passed && summary.unrecognized.length === 0; + + return summary; + } + + async output(summary) { + const goodnews = [ + summary.allowed.success.length + " valid programs parsed without error", + summary.allowed.failure.length + + " invalid programs produced a parsing error", + summary.allowed.falsePositive.length + + " invalid programs did not produce a parsing error" + + " (and allowed by the whitelist file)", + summary.allowed.falseNegative.length + + " valid programs produced a parsing error" + + " (and allowed by the whitelist file)", + ]; + const badnews = []; + const badnewsDetails = []; + + void [ + { + tests: summary.disallowed.success, + label: + "valid programs parsed without error" + + " (in violation of the whitelist file)", + }, + { + tests: summary.disallowed.failure, + label: + "invalid programs produced a parsing error" + + " (in violation of the whitelist file)", + }, + { + tests: summary.disallowed.falsePositive, + label: + "invalid programs did not produce a parsing error" + + " (without a corresponding entry in the whitelist file)", + }, + { + tests: summary.disallowed.falseNegative, + label: + "valid programs produced a parsing error" + + " (without a corresponding entry in the whitelist file)", + }, + { + tests: summary.unrecognized, + label: "non-existent programs specified in the whitelist file", + }, + ].forEach(function({ tests, label }) { + if (!tests.length) { + return; + } + + const desc = tests.length + " " + label; + + badnews.push(desc); + badnewsDetails.push(desc + ":"); + badnewsDetails.push(...tests.map(test => ` ${test.id || test}`)); + }); + + console.log(`Testing complete (${summary.count} tests).`); + console.log("Summary:"); + console.log(chalk.green(goodnews.join("\n").replace(/^/gm, " ✔ "))); + + if (!summary.passed) { + console.log(""); + console.log(chalk.red(badnews.join("\n").replace(/^/gm, " ✘ "))); + console.log(""); + console.log("Details:"); + console.log(badnewsDetails.join("\n").replace(/^/gm, " ")); + } + + if (this.shouldUpdate) { + await this.updateWhitelist(summary); + console.log(""); + console.log("Whitelist file updated."); + } else { + process.exitCode = summary.passed ? 0 : 1; + } + } +} + +module.exports = exports = TestRunner; diff --git a/scripts/rollup-plugin-babel-source.js b/scripts/rollup-plugin-babel-source.js new file mode 100644 index 000000000000..892401a21924 --- /dev/null +++ b/scripts/rollup-plugin-babel-source.js @@ -0,0 +1,84 @@ +const path = require("path"); +const fs = require("fs"); +const dirname = path.join(__dirname, ".."); + +module.exports = function() { + return { + name: "babel-source", + load(id) { + const matches = id.match(/packages\/(babel-[^/]+)\/src\//); + if (matches) { + // check if browser field exists for this file and replace + const packageFolder = path.join(dirname, "packages", matches[1]); + const packageJson = require(path.join(packageFolder, "package.json")); + + if ( + packageJson["browser"] && + typeof packageJson["browser"] === "object" + ) { + for (let nodeFile in packageJson["browser"]) { + const browserFile = packageJson["browser"][nodeFile].replace( + /^(\.\/)?lib\//, + "src/" + ); + nodeFile = nodeFile.replace(/^(\.\/)?lib\//, "src/"); + if (id.endsWith(nodeFile)) { + if (browserFile === false) { + return ""; + } + return fs.readFileSync( + path.join(packageFolder, browserFile), + "UTF-8" + ); + } + } + } + } + return null; + }, + resolveId(importee) { + if (importee === "@babel/runtime/regenerator") { + return path.join( + dirname, + "packages", + "babel-runtime", + "regenerator", + "index.js" + ); + } + + const matches = importee.match(/^@babel\/([^/]+)$/); + if (!matches) return null; + + // resolve babel package names to their src index file + const packageFolder = path.join( + dirname, + "packages", + `babel-${matches[1]}` + ); + + let packageJsonSource; + try { + packageJsonSource = fs.readFileSync( + path.join(packageFolder, "package.json") + ); + } catch (e) { + // Some Babel packahes aren't in this repository, but in + return null; + } + + const packageJson = JSON.parse(packageJsonSource); + + const filename = + typeof packageJson["browser"] === "string" + ? packageJson["browser"] + : packageJson["main"]; + + return path.join( + packageFolder, + // replace lib with src in the pkg.json entry + filename.replace(/^(\.\/)?lib\//, "src/") + ); + }, + }; +}; diff --git a/scripts/test-cov.sh b/scripts/test-cov.sh index 6914ef3fb0f9..4d90d4bda385 100755 --- a/scripts/test-cov.sh +++ b/scripts/test-cov.sh @@ -1,10 +1,11 @@ #!/bin/bash set -e +node="yarn --silent node" jestArgs="--coverage" if [ -n "$CI" ]; then jestArgs="${jestArgs} --maxWorkers=4 --ci" fi -node_modules/.bin/jest $jestArgs +$node node_modules/.bin/jest $jestArgs diff --git a/scripts/test.sh b/scripts/test.sh index f9c9e384e2e1..40109fbe3aa3 100755 --- a/scripts/test.sh +++ b/scripts/test.sh @@ -1,11 +1,11 @@ #!/bin/bash set -e -node="node" +node="yarn --silent node" jestArgs=() if [ "$TEST_DEBUG" ]; then - node="node --inspect-brk" + node="$node --inspect-brk" jestArgs+=("--runInBand") fi @@ -20,7 +20,7 @@ if [ -n "$TEST_GREP" ]; then fi if [ -n "$TEST_ONLY" ]; then - jestArgs+=("(packages|codemods)/.*$TEST_ONLY.*/test") + jestArgs+=("(packages|codemods|eslint)/.*$TEST_ONLY.*/test") fi -$node node_modules/jest/bin/jest.js "${jestArgs[@]}" +$node node_modules/.bin/jest "${jestArgs[@]}" diff --git a/scripts/tests/flow/flow_tests_whitelist.txt b/scripts/tests/flow/flow_tests_whitelist.txt deleted file mode 100644 index 7549e6a49ae1..000000000000 --- a/scripts/tests/flow/flow_tests_whitelist.txt +++ /dev/null @@ -1,31 +0,0 @@ -# This file lists tests that are known to produce incorrect results when parsed -# with the babel parser: -# -# - Tests that are expected to parse successfully but for which the babel parser reports -# a syntax error -# - Tests that contain invalid syntax but for which the babel parser reports no syntax -# error -# -# Entries should be removed incrementally as the babel parser is improved. - -JSX_invalid/migrated_0000.js -arrow_function_invalid/migrated_0002.js -async_await/migrated_0007.js -async_await/migrated_0020.js -async_await/migrated_0024.js -async_await/migrated_0027.js -async_generators/migrated_0007.js -class_properties/migrated_0021.js -class_properties/migrated_0026.js -decorators/migrated_0003.js -private_class_properties/multiple.js -private_class_properties/super.js -private_class_properties/getter_and_field.js -private_class_properties/getter_duplicate.js -private_class_properties/setter_and_field.js -private_class_properties/setter_duplicate.js -types/member/reserved_words.js -class_method_kinds/polymorphic_getter.js -ES6/modules/migrated_0020.js -export_import_reserved_words/migrated_0003.js -export_statements/export_trailing_comma.js diff --git a/scripts/tests/flow/run_babel_parser_flow_tests.js b/scripts/tests/flow/run_babel_parser_flow_tests.js deleted file mode 100644 index f087fb6614e3..000000000000 --- a/scripts/tests/flow/run_babel_parser_flow_tests.js +++ /dev/null @@ -1,311 +0,0 @@ -"use strict"; - -const path = require("path"); -const fs = require("fs"); -const chalk = require("chalk"); -const parse = require("../../../packages/babel-parser").parse; - -const TESTS_FOLDER = path.join( - __dirname, - "../../../build/flow/src/parser/test/flow" -); -const WHITELIST_PATH = path.join(__dirname, "./flow_tests_whitelist.txt"); - -const shouldUpdateWhitelist = process.argv.indexOf("--update-whitelist") > 0; - -function map_get_default(map, key, defaultConstructor) { - if (map.has(key)) { - return map.get(key); - } - const value = new defaultConstructor(); - map.set(key, value); - return value; -} - -function get_whitelist(filename) { - return fs - .readFileSync(filename, "utf8") - .split("\n") - .map(line => line.replace(/#.*$/, "").trim()) - .filter(Boolean); -} - -function list_files(root, dir) { - const files = fs.readdirSync(dir ? path.join(root, dir) : root); - let result = []; - for (let i = 0; i < files.length; i++) { - const file = dir ? path.join(dir, files[i]) : files[i]; - const stats = fs.statSync(path.join(root, file)); - if (stats.isDirectory()) { - result = result.concat(list_files(root, file)); - } else { - result.push(file); - } - } - return result.sort(); -} - -function get_tests(root_dir) { - const files = list_files(root_dir); - const tests = new Map(); - for (let i = 0; i < files.length; i++) { - const file = files[i]; - const test_name = path.dirname(file); - const case_parts = path.basename(file).split("."); - const case_name = case_parts[0]; - - // Hack to ignore hidden files. - if (case_name === "") { - continue; - } - - const cases = map_get_default(tests, test_name, Map); - const case_ = map_get_default(cases, case_name, Object); - - const content = fs.readFileSync(path.join(root_dir, file), "utf8"); - const ext = case_parts[case_parts.length - 1]; - const kind = - case_parts.length > 2 ? case_parts[case_parts.length - 2] : null; - - if (ext === "js") { - case_.file = file; - case_.content = content; - } else if (ext === "json" && kind === "tree") { - case_.expected_ast = JSON.parse(content); - } else if (ext === "json" && kind === "options") { - case_.options = JSON.parse(content); - } - } - return tests; -} - -function update_whitelist(summary) { - const contains = (tests, file) => - tests.some(({ test }) => test.file === file); - - const disallowed = summary.disallowed.success.concat( - summary.disallowed.failure - ); - - const oldLines = fs - .readFileSync(WHITELIST_PATH, "utf8") - .trim() - .split("\n") - .filter(line => { - const file = line.replace(/#.*$/, "").trim(); - return ( - !contains(disallowed, file) && summary.unrecognized.indexOf(file) === -1 - ); - }); - - const newLines = summary.disallowed.failure - .map(({ test }) => test.file) - .filter(test => oldLines.indexOf(test) === -1); - - const result = oldLines.concat(newLines).join("\n") + "\n"; - - fs.writeFileSync(WHITELIST_PATH, result); -} - -const options = { - plugins: [ - "dynamicImport", - ["flow", { all: true }], - "flowComments", - "jsx", - "classProperties", - "classPrivateProperties", - "classPrivateMethods", - "bigInt", - "numericSeparator", - ], - sourceType: "module", - ranges: true, -}; - -const flowOptionsMapping = { - esproposal_class_instance_fields: "classProperties", - esproposal_class_static_fields: "classProperties", - esproposal_export_star_as: "exportNamespaceFrom", - esproposal_decorators: "decorators-legacy", - esproposal_nullish_coalescing: "nullishCoalescingOperator", - esproposal_optional_chaining: "optionalChaining", - types: "flowComments", - intern_comments: false, -}; - -const summary = { - passed: true, - allowed: { - success: [], - failure: [], - }, - disallowed: { - success: [], - failure: [], - }, - unrecognized: [], -}; - -const tests = get_tests(TESTS_FOLDER); -const whitelist = get_whitelist(WHITELIST_PATH); - -const unrecognized = new Set(whitelist); - -tests.forEach(section => { - section.forEach(test => { - const shouldSuccess = - test.expected_ast && - (!Array.isArray(test.expected_ast.errors) || - test.expected_ast.errors.length === 0); - const inWhitelist = whitelist.indexOf(test.file) > -1; - - const babelParserOptions = Object.assign({}, options); - babelParserOptions.plugins = babelParserOptions.plugins.slice(); - - if (test.options) { - Object.keys(test.options).forEach(option => { - if (!test.options[option]) { - const idx = babelParserOptions.plugins.indexOf( - flowOptionsMapping[option] - ); - if (idx) { - babelParserOptions.plugins.splice(idx, 1); - } - return; - } - if (!(option in flowOptionsMapping)) { - throw new Error("Parser options not mapped " + option); - } - if (flowOptionsMapping[option]) { - babelParserOptions.plugins.push(flowOptionsMapping[option]); - } - }); - } - - let failed = false; - let exception = null; - try { - parse(test.content, babelParserOptions); - } catch (e) { - exception = e; - failed = true; - - // lets retry in script mode - if (shouldSuccess) { - try { - parse( - test.content, - Object.assign({}, babelParserOptions, { sourceType: "script" }) - ); - exception = null; - failed = false; - } catch (e) {} - } - } - - const isSuccess = shouldSuccess !== failed; - const isAllowed = isSuccess !== inWhitelist; - - summary[isAllowed ? "allowed" : "disallowed"][ - isSuccess ? "success" : "failure" - ].push({ test, exception, shouldSuccess, babelParserOptions }); - summary.passed &= isAllowed; - - unrecognized.delete(test.file); - - process.stdout.write(chalk.gray(".")); - }); -}); - -summary.unrecognized = Array.from(unrecognized); -summary.passed &= summary.unrecognized.length === 0; - -// This is needed because, after the dots written using -// `process.stdout.write(".")` there is no final newline -console.log(); - -if (summary.disallowed.failure.length || summary.disallowed.success.length) { - console.log("\n-- FAILED TESTS --"); - summary.disallowed.failure.forEach( - ({ test, shouldSuccess, exception, babelParserOptions }) => { - console.log(chalk.red(`✘ ${test.file}`)); - if (shouldSuccess) { - console.log(chalk.yellow(" Should parse successfully, but did not")); - console.log(chalk.yellow(` Failed with: \`${exception.message}\``)); - } else { - console.log(chalk.yellow(" Should fail parsing, but did not")); - } - console.log( - chalk.yellow( - ` Active plugins: ${JSON.stringify(babelParserOptions.plugins)}` - ) - ); - } - ); - summary.disallowed.success.forEach( - ({ test, shouldSuccess, babelParserOptions }) => { - console.log(chalk.red(`✘ ${test.file}`)); - if (shouldSuccess) { - console.log( - chalk.yellow( - " Correctly parsed successfully, but" + - " was disallowed by the whitelist" - ) - ); - } else { - console.log( - chalk.yellow( - " Correctly failed parsing, but" + - " was disallowed by the whitelist" - ) - ); - } - console.log( - chalk.yellow( - ` Active plugins: ${JSON.stringify(babelParserOptions.plugins)}` - ) - ); - } - ); -} - -console.log("-- SUMMARY --"); -console.log( - chalk.green("✔ " + summary.allowed.success.length + " tests passed") -); -console.log( - chalk.green( - "✔ " + - summary.allowed.failure.length + - " tests failed but were allowed in the whitelist" - ) -); -console.log( - chalk.red("✘ " + summary.disallowed.failure.length + " tests failed") -); -console.log( - chalk.red( - "✘ " + - summary.disallowed.success.length + - " tests passed but were disallowed in the whitelist" - ) -); -console.log( - chalk.red( - "✘ " + - summary.unrecognized.length + - " tests specified in the whitelist were not found" - ) -); - -// Some padding to separate the output from the message `make` -// adds at the end of failing scripts -console.log(); - -if (shouldUpdateWhitelist) { - update_whitelist(summary); - console.log("\nWhitelist updated"); -} else { - process.exit(summary.passed ? 0 : 1); -} diff --git a/scripts/tests/test262/run_babel_parser_test262.js b/scripts/tests/test262/run_babel_parser_test262.js deleted file mode 100644 index acd0c5122606..000000000000 --- a/scripts/tests/test262/run_babel_parser_test262.js +++ /dev/null @@ -1,126 +0,0 @@ -"use strict"; - -const path = require("path"); -const chalk = require("chalk"); -const utils = require("./run_babel_parser_test262_utils"); - -const testDir = path.join(__dirname, "../../../build/test262"); -const whitelistFile = path.join(__dirname, "test262_whitelist.txt"); -const shouldUpdate = process.argv.indexOf("--update-whitelist") > -1; - -Promise.all([utils.getTests(testDir), utils.getWhitelist(whitelistFile)]) - .then(function([tests, whitelist]) { - const total = tests.length; - const reportInc = Math.floor(total / 20); - - console.log(`Now running ${total} tests...`); - - const results = tests.map(function(test, idx) { - if (idx % reportInc === 0) { - console.log(`> ${Math.round((100 * idx) / total)}% complete`); - } - - return utils.runTest(test); - }); - - return utils.interpret(results, whitelist); - }) - .then(function(summary) { - const goodnews = [ - summary.allowed.success.length + " valid programs parsed without error", - summary.allowed.failure.length + - " invalid programs produced a parsing error", - summary.allowed.falsePositive.length + - " invalid programs did not produce a parsing error" + - " (and allowed by the whitelist file)", - summary.allowed.falseNegative.length + - " valid programs produced a parsing error" + - " (and allowed by the whitelist file)", - ]; - const badnews = []; - const badnewsDetails = []; - - void [ - { - tests: summary.disallowed.success, - label: - "valid programs parsed without error" + - " (in violation of the whitelist file)", - }, - { - tests: summary.disallowed.failure, - label: - "invalid programs produced a parsing error" + - " (in violation of the whitelist file)", - }, - { - tests: summary.disallowed.falsePositive, - label: - "invalid programs did not produce a parsing error" + - " (without a corresponding entry in the whitelist file)", - }, - { - tests: summary.disallowed.falseNegative, - label: - "valid programs produced a parsing error" + - " (without a corresponding entry in the whitelist file)", - }, - { - tests: summary.unrecognized, - label: "non-existent programs specified in the whitelist file", - }, - ].forEach(function({ tests, label }) { - if (!tests.length) { - return; - } - - const desc = tests.length + " " + label; - - badnews.push(desc); - badnewsDetails.push(desc + ":"); - badnewsDetails.push( - ...tests.map(function(test) { - return test.id || test; - }) - ); - }); - - console.log("Testing complete."); - console.log("Summary:"); - console.log(chalk.green(goodnews.join("\n").replace(/^/gm, " ✔ "))); - - if (!summary.passed) { - console.log(""); - console.log(chalk.red(badnews.join("\n").replace(/^/gm, " ✘ "))); - console.log(""); - console.log("Details:"); - console.log(badnewsDetails.join("\n").replace(/^/gm, " ")); - } - - if (shouldUpdate) { - return utils.updateWhitelist(whitelistFile, summary).then(function() { - console.log(""); - console.log("Whitelist file updated."); - }); - } else { - process.exitCode = summary.passed ? 0 : 1; - } - - const unmappedFeatures = utils.getUnmappedFeatures(); - - if (unmappedFeatures.size) { - console.log(""); - console.log( - "The following Features are not currently mapped or ignored:" - ); - console.log( - Array.from(unmappedFeatures) - .join("\n") - .replace(/^/gm, " ") - ); - } - }) - .catch(function(err) { - console.error(err); - process.exitCode = 1; - }); diff --git a/scripts/tests/test262/run_babel_parser_test262_utils.js b/scripts/tests/test262/run_babel_parser_test262_utils.js deleted file mode 100644 index 974e4a88e795..000000000000 --- a/scripts/tests/test262/run_babel_parser_test262_utils.js +++ /dev/null @@ -1,291 +0,0 @@ -"use strict"; - -const fs = require("graceful-fs"); -const promisify = require("util").promisify; -const TestStream = require("test262-stream"); -const pfs = { - readFile: promisify(fs.readFile), - writeFile: promisify(fs.writeFile), - readdir: promisify(fs.readdir), - stat: promisify(fs.stat), -}; - -const parse = require("../../../packages/babel-parser").parse; - -const ignoredFeatures = [ - "Array.prototype.flat", - "Array.prototype.flatMap", - "Array.prototype.values", - "ArrayBuffer", - "async-functions", - "async-iteration", - "arrow-function", - "Atomics", - "caller", - "class", - "computed-property-names", - "const", - "cross-realm", - "DataView", - "DataView.prototype.getFloat32", - "DataView.prototype.getFloat64", - "DataView.prototype.getInt8", - "DataView.prototype.getInt16", - "DataView.prototype.getInt32", - "DataView.prototype.getUint16", - "DataView.prototype.getUint32", - "DataView.prototype.setUint8", - "default-parameters", - "destructuring-assignment", - "destructuring-binding", - "Float32Array", - "Float64Array", - "for-of", - "generators", - "globalThis", - "hashbang", - "Int8Array", - "Int32Array", - "Intl.ListFormat", - "Intl.Locale", - "Intl.NumberFormat-unified", - "Intl.RelativeTimeFormat", - "Intl.Segmenter", - "IsHTMLDDA", - "json-superset", - "let", - "Map", - "new.target", - "Object.fromEntries", - "Object.is", - "object-rest", - "object-spread", - "optional-catch-binding", - "Promise.prototype.finally", - "Proxy", - "Reflect", - "Reflect.construct", - "Reflect.set", - "Reflect.setPrototypeOf", - "regexp-dotall", - "regexp-lookbehind", - "regexp-named-groups", - "regexp-unicode-property-escapes", - "SharedArrayBuffer", - "Set", - "String.fromCodePoint", - "String.prototype.endsWith", - "String.prototype.includes", - "String.prototype.matchAll", - "String.prototype.trimEnd", - "String.prototype.trimStart", - "string-trimming", - "super", - "Symbol", - "Symbol.asyncIterator", - "Symbol.hasInstance", - "Symbol.isConcatSpreadable", - "Symbol.iterator", - "Symbol.match", - "Symbol.matchAll", - "Symbol.prototype.description", - "Symbol.replace", - "Symbol.search", - "Symbol.split", - "Symbol.species", - "Symbol.toPrimitive", - "Symbol.toStringTag", - "Symbol.unscopables", - "tail-call-optimization", - "template", - "TypedArray", - "u180e", - "Uint8Array", - "Uint8ClampedArray", - "Uint16Array", - "WeakMap", - "WeakSet", - "well-formed-json-stringify", -]; - -const featuresToPlugins = { - BigInt: "bigInt", - "class-fields-private": "classPrivateProperties", - "class-fields-public": "classProperties", - "class-methods-private": "classPrivateMethods", - "class-static-fields-public": "classProperties", - "class-static-fields-private": "classPrivateProperties", - "class-static-methods-private": "classPrivateMethods", - "dynamic-import": "dynamicImport", - "export-star-as-namespace-from-module": "exportNamespaceFrom", - "import.meta": "importMeta", - "numeric-separator-literal": "numericSeparator", -}; - -function getPlugins(features) { - return ( - features && - features - .map(f => { - if (!featuresToPlugins[f] && !ignoredFeatures.includes(f)) { - unmappedFeatures.add(f); - } - return featuresToPlugins[f]; - }) - .filter(Boolean) - ); -} - -const unmappedFeatures = new Set(); - -exports.getUnmappedFeatures = function() { - return unmappedFeatures; -}; - -exports.getTests = function(testDir) { - const stream = new TestStream(testDir, { - omitRuntime: true, - }); - const tests = []; - - stream.on("data", test => { - // strip test/ - const fileName = test.file.substr(5); - - tests.push({ - contents: test.contents, - fileName, - id: `${fileName}(${test.scenario})`, - sourceType: test.attrs.flags.module ? "module" : "script", - plugins: getPlugins(test.attrs.features), - expectedError: - !!test.attrs.negative && - (test.attrs.negative.phase === "parse" || - test.attrs.negative.phase === "early"), - }); - }); - - return new Promise((resolve, reject) => { - stream.on("end", () => resolve(tests)); - stream.on("error", reject); - }); -}; - -exports.runTest = function(test) { - try { - parse(test.contents, { - sourceType: test.sourceType, - plugins: test.plugins, - }); - test.actualError = false; - } catch (err) { - test.actualError = true; - } - - test.result = test.expectedError !== test.actualError ? "fail" : "pass"; - - return test; -}; - -exports.getWhitelist = function(filename) { - return pfs.readFile(filename, "utf-8").then(function(contents) { - return contents - .split("\n") - .map(function(line) { - return line.replace(/#.*$/, "").trim(); - }) - .filter(function(line) { - return line.length > 0; - }) - .reduce(function(table, filename) { - table[filename] = true; - return table; - }, Object.create(null)); - }); -}; - -exports.updateWhitelist = function(filename, summary) { - return pfs.readFile(filename, "utf-8").then(function(contents) { - const toRemove = summary.disallowed.success - .concat(summary.disallowed.failure) - .map(function(test) { - return test.id; - }) - .concat(summary.unrecognized); - const toAdd = summary.disallowed.falsePositive - .concat(summary.disallowed.falseNegative) - .map(function(test) { - return test.id; - }); - const newContents = contents - .split("\n") - .map(function(line) { - const testId = line.replace(/#.*$/, "").trim(); - - if (toRemove.indexOf(testId) > -1) { - return null; - } - - return line; - }) - .filter(function(line) { - return line !== null && line !== ""; - }) - .concat(toAdd) - .sort() - .join("\n"); - - return pfs.writeFile(filename, newContents, "utf-8"); - }); -}; - -exports.interpret = function(results, whitelist) { - const summary = { - passed: true, - allowed: { - success: [], - failure: [], - falsePositive: [], - falseNegative: [], - }, - disallowed: { - success: [], - failure: [], - falsePositive: [], - falseNegative: [], - }, - unrecognized: null, - }; - - results.forEach(function(result) { - let classification, isAllowed; - const inWhitelist = result.id in whitelist; - delete whitelist[result.id]; - - if (!result.expectedError) { - if (!result.actualError) { - classification = "success"; - isAllowed = !inWhitelist; - } else { - classification = "falseNegative"; - isAllowed = inWhitelist; - } - } else { - if (!result.actualError) { - classification = "falsePositive"; - isAllowed = inWhitelist; - } else { - classification = "failure"; - isAllowed = !inWhitelist; - } - } - - summary.passed &= isAllowed; - summary[isAllowed ? "allowed" : "disallowed"][classification].push(result); - }); - - summary.unrecognized = Object.keys(whitelist); - summary.passed = !!summary.passed && summary.unrecognized.length === 0; - - return summary; -}; diff --git a/scripts/tests/test262/test262_whitelist.txt b/scripts/tests/test262/test262_whitelist.txt deleted file mode 100644 index b832b67af6ab..000000000000 --- a/scripts/tests/test262/test262_whitelist.txt +++ /dev/null @@ -1,682 +0,0 @@ -built-ins/RegExp/property-escapes/binary-property-with-value-ASCII_-_F-negated.js(default) -built-ins/RegExp/property-escapes/binary-property-with-value-ASCII_-_F-negated.js(strict mode) -built-ins/RegExp/property-escapes/binary-property-with-value-ASCII_-_F.js(default) -built-ins/RegExp/property-escapes/binary-property-with-value-ASCII_-_F.js(strict mode) -built-ins/RegExp/property-escapes/binary-property-with-value-ASCII_-_Invalid-negated.js(default) -built-ins/RegExp/property-escapes/binary-property-with-value-ASCII_-_Invalid-negated.js(strict mode) -built-ins/RegExp/property-escapes/binary-property-with-value-ASCII_-_Invalid.js(default) -built-ins/RegExp/property-escapes/binary-property-with-value-ASCII_-_Invalid.js(strict mode) -built-ins/RegExp/property-escapes/binary-property-with-value-ASCII_-_N-negated.js(default) -built-ins/RegExp/property-escapes/binary-property-with-value-ASCII_-_N-negated.js(strict mode) -built-ins/RegExp/property-escapes/binary-property-with-value-ASCII_-_N.js(default) -built-ins/RegExp/property-escapes/binary-property-with-value-ASCII_-_N.js(strict mode) -built-ins/RegExp/property-escapes/binary-property-with-value-ASCII_-_No-negated.js(default) -built-ins/RegExp/property-escapes/binary-property-with-value-ASCII_-_No-negated.js(strict mode) -built-ins/RegExp/property-escapes/binary-property-with-value-ASCII_-_No.js(default) -built-ins/RegExp/property-escapes/binary-property-with-value-ASCII_-_No.js(strict mode) -built-ins/RegExp/property-escapes/binary-property-with-value-ASCII_-_T-negated.js(default) -built-ins/RegExp/property-escapes/binary-property-with-value-ASCII_-_T-negated.js(strict mode) -built-ins/RegExp/property-escapes/binary-property-with-value-ASCII_-_T.js(default) -built-ins/RegExp/property-escapes/binary-property-with-value-ASCII_-_T.js(strict mode) -built-ins/RegExp/property-escapes/binary-property-with-value-ASCII_-_Y-negated.js(default) -built-ins/RegExp/property-escapes/binary-property-with-value-ASCII_-_Y-negated.js(strict mode) -built-ins/RegExp/property-escapes/binary-property-with-value-ASCII_-_Y.js(default) -built-ins/RegExp/property-escapes/binary-property-with-value-ASCII_-_Y.js(strict mode) -built-ins/RegExp/property-escapes/binary-property-with-value-ASCII_-_Yes-negated.js(default) -built-ins/RegExp/property-escapes/binary-property-with-value-ASCII_-_Yes-negated.js(strict mode) -built-ins/RegExp/property-escapes/binary-property-with-value-ASCII_-_Yes.js(default) -built-ins/RegExp/property-escapes/binary-property-with-value-ASCII_-_Yes.js(strict mode) -built-ins/RegExp/property-escapes/character-class-range-end.js(default) -built-ins/RegExp/property-escapes/character-class-range-end.js(strict mode) -built-ins/RegExp/property-escapes/character-class-range-no-dash-end.js(default) -built-ins/RegExp/property-escapes/character-class-range-no-dash-end.js(strict mode) -built-ins/RegExp/property-escapes/character-class-range-no-dash-start.js(default) -built-ins/RegExp/property-escapes/character-class-range-no-dash-start.js(strict mode) -built-ins/RegExp/property-escapes/character-class-range-start.js(default) -built-ins/RegExp/property-escapes/character-class-range-start.js(strict mode) -built-ins/RegExp/property-escapes/grammar-extension-In-prefix-Block-implicit-negated.js(default) -built-ins/RegExp/property-escapes/grammar-extension-In-prefix-Block-implicit-negated.js(strict mode) -built-ins/RegExp/property-escapes/grammar-extension-In-prefix-Block-implicit.js(default) -built-ins/RegExp/property-escapes/grammar-extension-In-prefix-Block-implicit.js(strict mode) -built-ins/RegExp/property-escapes/grammar-extension-In-prefix-Script-implicit-negated.js(default) -built-ins/RegExp/property-escapes/grammar-extension-In-prefix-Script-implicit-negated.js(strict mode) -built-ins/RegExp/property-escapes/grammar-extension-In-prefix-Script-implicit.js(default) -built-ins/RegExp/property-escapes/grammar-extension-In-prefix-Script-implicit.js(strict mode) -built-ins/RegExp/property-escapes/grammar-extension-In-prefix-Script-negated.js(default) -built-ins/RegExp/property-escapes/grammar-extension-In-prefix-Script-negated.js(strict mode) -built-ins/RegExp/property-escapes/grammar-extension-In-prefix-Script.js(default) -built-ins/RegExp/property-escapes/grammar-extension-In-prefix-Script.js(strict mode) -built-ins/RegExp/property-escapes/grammar-extension-Is-prefix-Script-negated.js(default) -built-ins/RegExp/property-escapes/grammar-extension-Is-prefix-Script-negated.js(strict mode) -built-ins/RegExp/property-escapes/grammar-extension-Is-prefix-Script.js(default) -built-ins/RegExp/property-escapes/grammar-extension-Is-prefix-Script.js(strict mode) -built-ins/RegExp/property-escapes/grammar-extension-circumflex-negation-negated.js(default) -built-ins/RegExp/property-escapes/grammar-extension-circumflex-negation-negated.js(strict mode) -built-ins/RegExp/property-escapes/grammar-extension-circumflex-negation.js(default) -built-ins/RegExp/property-escapes/grammar-extension-circumflex-negation.js(strict mode) -built-ins/RegExp/property-escapes/grammar-extension-empty-negated.js(default) -built-ins/RegExp/property-escapes/grammar-extension-empty-negated.js(strict mode) -built-ins/RegExp/property-escapes/grammar-extension-empty.js(default) -built-ins/RegExp/property-escapes/grammar-extension-empty.js(strict mode) -built-ins/RegExp/property-escapes/grammar-extension-invalid-negated.js(default) -built-ins/RegExp/property-escapes/grammar-extension-invalid-negated.js(strict mode) -built-ins/RegExp/property-escapes/grammar-extension-invalid.js(default) -built-ins/RegExp/property-escapes/grammar-extension-invalid.js(strict mode) -built-ins/RegExp/property-escapes/grammar-extension-no-braces-negated.js(default) -built-ins/RegExp/property-escapes/grammar-extension-no-braces-negated.js(strict mode) -built-ins/RegExp/property-escapes/grammar-extension-no-braces-value-negated.js(default) -built-ins/RegExp/property-escapes/grammar-extension-no-braces-value-negated.js(strict mode) -built-ins/RegExp/property-escapes/grammar-extension-no-braces-value.js(default) -built-ins/RegExp/property-escapes/grammar-extension-no-braces-value.js(strict mode) -built-ins/RegExp/property-escapes/grammar-extension-no-braces.js(default) -built-ins/RegExp/property-escapes/grammar-extension-no-braces.js(strict mode) -built-ins/RegExp/property-escapes/grammar-extension-separator-and-value-only-negated.js(default) -built-ins/RegExp/property-escapes/grammar-extension-separator-and-value-only-negated.js(strict mode) -built-ins/RegExp/property-escapes/grammar-extension-separator-and-value-only.js(default) -built-ins/RegExp/property-escapes/grammar-extension-separator-and-value-only.js(strict mode) -built-ins/RegExp/property-escapes/grammar-extension-separator-negated.js(default) -built-ins/RegExp/property-escapes/grammar-extension-separator-negated.js(strict mode) -built-ins/RegExp/property-escapes/grammar-extension-separator-only-negated.js(default) -built-ins/RegExp/property-escapes/grammar-extension-separator-only-negated.js(strict mode) -built-ins/RegExp/property-escapes/grammar-extension-separator-only.js(default) -built-ins/RegExp/property-escapes/grammar-extension-separator-only.js(strict mode) -built-ins/RegExp/property-escapes/grammar-extension-separator.js(default) -built-ins/RegExp/property-escapes/grammar-extension-separator.js(strict mode) -built-ins/RegExp/property-escapes/grammar-extension-unclosed-negated.js(default) -built-ins/RegExp/property-escapes/grammar-extension-unclosed-negated.js(strict mode) -built-ins/RegExp/property-escapes/grammar-extension-unclosed.js(default) -built-ins/RegExp/property-escapes/grammar-extension-unclosed.js(strict mode) -built-ins/RegExp/property-escapes/grammar-extension-unopened-negated.js(default) -built-ins/RegExp/property-escapes/grammar-extension-unopened-negated.js(strict mode) -built-ins/RegExp/property-escapes/grammar-extension-unopened.js(default) -built-ins/RegExp/property-escapes/grammar-extension-unopened.js(strict mode) -built-ins/RegExp/property-escapes/loose-matching-01-negated.js(default) -built-ins/RegExp/property-escapes/loose-matching-01-negated.js(strict mode) -built-ins/RegExp/property-escapes/loose-matching-01.js(default) -built-ins/RegExp/property-escapes/loose-matching-01.js(strict mode) -built-ins/RegExp/property-escapes/loose-matching-02-negated.js(default) -built-ins/RegExp/property-escapes/loose-matching-02-negated.js(strict mode) -built-ins/RegExp/property-escapes/loose-matching-02.js(default) -built-ins/RegExp/property-escapes/loose-matching-02.js(strict mode) -built-ins/RegExp/property-escapes/loose-matching-03-negated.js(default) -built-ins/RegExp/property-escapes/loose-matching-03-negated.js(strict mode) -built-ins/RegExp/property-escapes/loose-matching-03.js(default) -built-ins/RegExp/property-escapes/loose-matching-03.js(strict mode) -built-ins/RegExp/property-escapes/loose-matching-04-negated.js(default) -built-ins/RegExp/property-escapes/loose-matching-04-negated.js(strict mode) -built-ins/RegExp/property-escapes/loose-matching-04.js(default) -built-ins/RegExp/property-escapes/loose-matching-04.js(strict mode) -built-ins/RegExp/property-escapes/loose-matching-05-negated.js(default) -built-ins/RegExp/property-escapes/loose-matching-05-negated.js(strict mode) -built-ins/RegExp/property-escapes/loose-matching-05.js(default) -built-ins/RegExp/property-escapes/loose-matching-05.js(strict mode) -built-ins/RegExp/property-escapes/loose-matching-06-negated.js(default) -built-ins/RegExp/property-escapes/loose-matching-06-negated.js(strict mode) -built-ins/RegExp/property-escapes/loose-matching-06.js(default) -built-ins/RegExp/property-escapes/loose-matching-06.js(strict mode) -built-ins/RegExp/property-escapes/loose-matching-07-negated.js(default) -built-ins/RegExp/property-escapes/loose-matching-07-negated.js(strict mode) -built-ins/RegExp/property-escapes/loose-matching-07.js(default) -built-ins/RegExp/property-escapes/loose-matching-07.js(strict mode) -built-ins/RegExp/property-escapes/loose-matching-08-negated.js(default) -built-ins/RegExp/property-escapes/loose-matching-08-negated.js(strict mode) -built-ins/RegExp/property-escapes/loose-matching-08.js(default) -built-ins/RegExp/property-escapes/loose-matching-08.js(strict mode) -built-ins/RegExp/property-escapes/loose-matching-09-negated.js(default) -built-ins/RegExp/property-escapes/loose-matching-09-negated.js(strict mode) -built-ins/RegExp/property-escapes/loose-matching-09.js(default) -built-ins/RegExp/property-escapes/loose-matching-09.js(strict mode) -built-ins/RegExp/property-escapes/loose-matching-10-negated.js(default) -built-ins/RegExp/property-escapes/loose-matching-10-negated.js(strict mode) -built-ins/RegExp/property-escapes/loose-matching-10.js(default) -built-ins/RegExp/property-escapes/loose-matching-10.js(strict mode) -built-ins/RegExp/property-escapes/loose-matching-11-negated.js(default) -built-ins/RegExp/property-escapes/loose-matching-11-negated.js(strict mode) -built-ins/RegExp/property-escapes/loose-matching-11.js(default) -built-ins/RegExp/property-escapes/loose-matching-11.js(strict mode) -built-ins/RegExp/property-escapes/loose-matching-12-negated.js(default) -built-ins/RegExp/property-escapes/loose-matching-12-negated.js(strict mode) -built-ins/RegExp/property-escapes/loose-matching-12.js(default) -built-ins/RegExp/property-escapes/loose-matching-12.js(strict mode) -built-ins/RegExp/property-escapes/loose-matching-13-negated.js(default) -built-ins/RegExp/property-escapes/loose-matching-13-negated.js(strict mode) -built-ins/RegExp/property-escapes/loose-matching-13.js(default) -built-ins/RegExp/property-escapes/loose-matching-13.js(strict mode) -built-ins/RegExp/property-escapes/loose-matching-14-negated.js(default) -built-ins/RegExp/property-escapes/loose-matching-14-negated.js(strict mode) -built-ins/RegExp/property-escapes/loose-matching-14.js(default) -built-ins/RegExp/property-escapes/loose-matching-14.js(strict mode) -built-ins/RegExp/property-escapes/non-binary-property-without-value-General_Category-equals-negated.js(default) -built-ins/RegExp/property-escapes/non-binary-property-without-value-General_Category-equals-negated.js(strict mode) -built-ins/RegExp/property-escapes/non-binary-property-without-value-General_Category-equals.js(default) -built-ins/RegExp/property-escapes/non-binary-property-without-value-General_Category-equals.js(strict mode) -built-ins/RegExp/property-escapes/non-binary-property-without-value-General_Category-negated.js(default) -built-ins/RegExp/property-escapes/non-binary-property-without-value-General_Category-negated.js(strict mode) -built-ins/RegExp/property-escapes/non-binary-property-without-value-General_Category.js(default) -built-ins/RegExp/property-escapes/non-binary-property-without-value-General_Category.js(strict mode) -built-ins/RegExp/property-escapes/non-binary-property-without-value-Script-equals-negated.js(default) -built-ins/RegExp/property-escapes/non-binary-property-without-value-Script-equals-negated.js(strict mode) -built-ins/RegExp/property-escapes/non-binary-property-without-value-Script-equals.js(default) -built-ins/RegExp/property-escapes/non-binary-property-without-value-Script-equals.js(strict mode) -built-ins/RegExp/property-escapes/non-binary-property-without-value-Script-negated.js(default) -built-ins/RegExp/property-escapes/non-binary-property-without-value-Script-negated.js(strict mode) -built-ins/RegExp/property-escapes/non-binary-property-without-value-Script.js(default) -built-ins/RegExp/property-escapes/non-binary-property-without-value-Script.js(strict mode) -built-ins/RegExp/property-escapes/non-binary-property-without-value-Script_Extensions-equals-negated.js(default) -built-ins/RegExp/property-escapes/non-binary-property-without-value-Script_Extensions-equals-negated.js(strict mode) -built-ins/RegExp/property-escapes/non-binary-property-without-value-Script_Extensions-equals.js(default) -built-ins/RegExp/property-escapes/non-binary-property-without-value-Script_Extensions-equals.js(strict mode) -built-ins/RegExp/property-escapes/non-binary-property-without-value-Script_Extensions-negated.js(default) -built-ins/RegExp/property-escapes/non-binary-property-without-value-Script_Extensions-negated.js(strict mode) -built-ins/RegExp/property-escapes/non-binary-property-without-value-Script_Extensions.js(default) -built-ins/RegExp/property-escapes/non-binary-property-without-value-Script_Extensions.js(strict mode) -built-ins/RegExp/property-escapes/non-existent-binary-property-negated.js(default) -built-ins/RegExp/property-escapes/non-existent-binary-property-negated.js(strict mode) -built-ins/RegExp/property-escapes/non-existent-binary-property.js(default) -built-ins/RegExp/property-escapes/non-existent-binary-property.js(strict mode) -built-ins/RegExp/property-escapes/non-existent-property-and-value-negated.js(default) -built-ins/RegExp/property-escapes/non-existent-property-and-value-negated.js(strict mode) -built-ins/RegExp/property-escapes/non-existent-property-and-value.js(default) -built-ins/RegExp/property-escapes/non-existent-property-and-value.js(strict mode) -built-ins/RegExp/property-escapes/non-existent-property-existing-value-negated.js(default) -built-ins/RegExp/property-escapes/non-existent-property-existing-value-negated.js(strict mode) -built-ins/RegExp/property-escapes/non-existent-property-existing-value.js(default) -built-ins/RegExp/property-escapes/non-existent-property-existing-value.js(strict mode) -built-ins/RegExp/property-escapes/non-existent-property-value-General_Category-negated.js(default) -built-ins/RegExp/property-escapes/non-existent-property-value-General_Category-negated.js(strict mode) -built-ins/RegExp/property-escapes/non-existent-property-value-Script-negated.js(default) -built-ins/RegExp/property-escapes/non-existent-property-value-Script-negated.js(strict mode) -built-ins/RegExp/property-escapes/non-existent-property-value-Script.js(default) -built-ins/RegExp/property-escapes/non-existent-property-value-Script.js(strict mode) -built-ins/RegExp/property-escapes/non-existent-property-value-Script_Extensions-negated.js(default) -built-ins/RegExp/property-escapes/non-existent-property-value-Script_Extensions-negated.js(strict mode) -built-ins/RegExp/property-escapes/non-existent-property-value-Script_Extensions.js(default) -built-ins/RegExp/property-escapes/non-existent-property-value-Script_Extensions.js(strict mode) -built-ins/RegExp/property-escapes/non-existent-property-value-general-category.js(default) -built-ins/RegExp/property-escapes/non-existent-property-value-general-category.js(strict mode) -built-ins/RegExp/property-escapes/unsupported-binary-property-Composition_Exclusion-negated.js(default) -built-ins/RegExp/property-escapes/unsupported-binary-property-Composition_Exclusion-negated.js(strict mode) -built-ins/RegExp/property-escapes/unsupported-binary-property-Composition_Exclusion.js(default) -built-ins/RegExp/property-escapes/unsupported-binary-property-Composition_Exclusion.js(strict mode) -built-ins/RegExp/property-escapes/unsupported-binary-property-Expands_On_NFC-negated.js(default) -built-ins/RegExp/property-escapes/unsupported-binary-property-Expands_On_NFC-negated.js(strict mode) -built-ins/RegExp/property-escapes/unsupported-binary-property-Expands_On_NFC.js(default) -built-ins/RegExp/property-escapes/unsupported-binary-property-Expands_On_NFC.js(strict mode) -built-ins/RegExp/property-escapes/unsupported-binary-property-Expands_On_NFD-negated.js(default) -built-ins/RegExp/property-escapes/unsupported-binary-property-Expands_On_NFD-negated.js(strict mode) -built-ins/RegExp/property-escapes/unsupported-binary-property-Expands_On_NFD.js(default) -built-ins/RegExp/property-escapes/unsupported-binary-property-Expands_On_NFD.js(strict mode) -built-ins/RegExp/property-escapes/unsupported-binary-property-Expands_On_NFKC-negated.js(default) -built-ins/RegExp/property-escapes/unsupported-binary-property-Expands_On_NFKC-negated.js(strict mode) -built-ins/RegExp/property-escapes/unsupported-binary-property-Expands_On_NFKC.js(default) -built-ins/RegExp/property-escapes/unsupported-binary-property-Expands_On_NFKC.js(strict mode) -built-ins/RegExp/property-escapes/unsupported-binary-property-Expands_On_NFKD-negated.js(default) -built-ins/RegExp/property-escapes/unsupported-binary-property-Expands_On_NFKD-negated.js(strict mode) -built-ins/RegExp/property-escapes/unsupported-binary-property-Expands_On_NFKD.js(default) -built-ins/RegExp/property-escapes/unsupported-binary-property-Expands_On_NFKD.js(strict mode) -built-ins/RegExp/property-escapes/unsupported-binary-property-FC_NFKC_Closure-negated.js(default) -built-ins/RegExp/property-escapes/unsupported-binary-property-FC_NFKC_Closure-negated.js(strict mode) -built-ins/RegExp/property-escapes/unsupported-binary-property-FC_NFKC_Closure.js(default) -built-ins/RegExp/property-escapes/unsupported-binary-property-FC_NFKC_Closure.js(strict mode) -built-ins/RegExp/property-escapes/unsupported-binary-property-Full_Composition_Exclusion-negated.js(default) -built-ins/RegExp/property-escapes/unsupported-binary-property-Full_Composition_Exclusion-negated.js(strict mode) -built-ins/RegExp/property-escapes/unsupported-binary-property-Full_Composition_Exclusion.js(default) -built-ins/RegExp/property-escapes/unsupported-binary-property-Full_Composition_Exclusion.js(strict mode) -built-ins/RegExp/property-escapes/unsupported-binary-property-Grapheme_Link-negated.js(default) -built-ins/RegExp/property-escapes/unsupported-binary-property-Grapheme_Link-negated.js(strict mode) -built-ins/RegExp/property-escapes/unsupported-binary-property-Grapheme_Link.js(default) -built-ins/RegExp/property-escapes/unsupported-binary-property-Grapheme_Link.js(strict mode) -built-ins/RegExp/property-escapes/unsupported-binary-property-Hyphen-negated.js(default) -built-ins/RegExp/property-escapes/unsupported-binary-property-Hyphen-negated.js(strict mode) -built-ins/RegExp/property-escapes/unsupported-binary-property-Hyphen.js(default) -built-ins/RegExp/property-escapes/unsupported-binary-property-Hyphen.js(strict mode) -built-ins/RegExp/property-escapes/unsupported-binary-property-Other_Alphabetic-negated.js(default) -built-ins/RegExp/property-escapes/unsupported-binary-property-Other_Alphabetic-negated.js(strict mode) -built-ins/RegExp/property-escapes/unsupported-binary-property-Other_Alphabetic.js(default) -built-ins/RegExp/property-escapes/unsupported-binary-property-Other_Alphabetic.js(strict mode) -built-ins/RegExp/property-escapes/unsupported-binary-property-Other_Default_Ignorable_Code_Point-negated.js(default) -built-ins/RegExp/property-escapes/unsupported-binary-property-Other_Default_Ignorable_Code_Point-negated.js(strict mode) -built-ins/RegExp/property-escapes/unsupported-binary-property-Other_Default_Ignorable_Code_Point.js(default) -built-ins/RegExp/property-escapes/unsupported-binary-property-Other_Default_Ignorable_Code_Point.js(strict mode) -built-ins/RegExp/property-escapes/unsupported-binary-property-Other_Grapheme_Extend-negated.js(default) -built-ins/RegExp/property-escapes/unsupported-binary-property-Other_Grapheme_Extend-negated.js(strict mode) -built-ins/RegExp/property-escapes/unsupported-binary-property-Other_Grapheme_Extend.js(default) -built-ins/RegExp/property-escapes/unsupported-binary-property-Other_Grapheme_Extend.js(strict mode) -built-ins/RegExp/property-escapes/unsupported-binary-property-Other_ID_Continue-negated.js(default) -built-ins/RegExp/property-escapes/unsupported-binary-property-Other_ID_Continue-negated.js(strict mode) -built-ins/RegExp/property-escapes/unsupported-binary-property-Other_ID_Continue.js(default) -built-ins/RegExp/property-escapes/unsupported-binary-property-Other_ID_Continue.js(strict mode) -built-ins/RegExp/property-escapes/unsupported-binary-property-Other_ID_Start-negated.js(default) -built-ins/RegExp/property-escapes/unsupported-binary-property-Other_ID_Start-negated.js(strict mode) -built-ins/RegExp/property-escapes/unsupported-binary-property-Other_ID_Start.js(default) -built-ins/RegExp/property-escapes/unsupported-binary-property-Other_ID_Start.js(strict mode) -built-ins/RegExp/property-escapes/unsupported-binary-property-Other_Lowercase-negated.js(default) -built-ins/RegExp/property-escapes/unsupported-binary-property-Other_Lowercase-negated.js(strict mode) -built-ins/RegExp/property-escapes/unsupported-binary-property-Other_Lowercase.js(default) -built-ins/RegExp/property-escapes/unsupported-binary-property-Other_Lowercase.js(strict mode) -built-ins/RegExp/property-escapes/unsupported-binary-property-Other_Math-negated.js(default) -built-ins/RegExp/property-escapes/unsupported-binary-property-Other_Math-negated.js(strict mode) -built-ins/RegExp/property-escapes/unsupported-binary-property-Other_Math.js(default) -built-ins/RegExp/property-escapes/unsupported-binary-property-Other_Math.js(strict mode) -built-ins/RegExp/property-escapes/unsupported-binary-property-Other_Uppercase-negated.js(default) -built-ins/RegExp/property-escapes/unsupported-binary-property-Other_Uppercase-negated.js(strict mode) -built-ins/RegExp/property-escapes/unsupported-binary-property-Other_Uppercase.js(default) -built-ins/RegExp/property-escapes/unsupported-binary-property-Other_Uppercase.js(strict mode) -built-ins/RegExp/property-escapes/unsupported-binary-property-Prepended_Concatenation_Mark-negated.js(default) -built-ins/RegExp/property-escapes/unsupported-binary-property-Prepended_Concatenation_Mark-negated.js(strict mode) -built-ins/RegExp/property-escapes/unsupported-binary-property-Prepended_Concatenation_Mark.js(default) -built-ins/RegExp/property-escapes/unsupported-binary-property-Prepended_Concatenation_Mark.js(strict mode) -built-ins/RegExp/property-escapes/unsupported-property-Block-with-value-negated.js(default) -built-ins/RegExp/property-escapes/unsupported-property-Block-with-value-negated.js(strict mode) -built-ins/RegExp/property-escapes/unsupported-property-Block-with-value.js(default) -built-ins/RegExp/property-escapes/unsupported-property-Block-with-value.js(strict mode) -built-ins/RegExp/property-escapes/unsupported-property-FC_NFKC_Closure-negated.js(default) -built-ins/RegExp/property-escapes/unsupported-property-FC_NFKC_Closure-negated.js(strict mode) -built-ins/RegExp/property-escapes/unsupported-property-FC_NFKC_Closure.js(default) -built-ins/RegExp/property-escapes/unsupported-property-FC_NFKC_Closure.js(strict mode) -built-ins/RegExp/property-escapes/unsupported-property-Line_Break-negated.js(default) -built-ins/RegExp/property-escapes/unsupported-property-Line_Break-negated.js(strict mode) -built-ins/RegExp/property-escapes/unsupported-property-Line_Break-with-value-negated.js(default) -built-ins/RegExp/property-escapes/unsupported-property-Line_Break-with-value-negated.js(strict mode) -built-ins/RegExp/property-escapes/unsupported-property-Line_Break-with-value.js(default) -built-ins/RegExp/property-escapes/unsupported-property-Line_Break-with-value.js(strict mode) -built-ins/RegExp/property-escapes/unsupported-property-Line_Break.js(default) -built-ins/RegExp/property-escapes/unsupported-property-Line_Break.js(strict mode) -language/comments/hashbang/escaped-bang-041.js(default) -language/comments/hashbang/escaped-bang-u0021.js(default) -language/comments/hashbang/escaped-bang-u21.js(default) -language/comments/hashbang/escaped-bang-x21.js(default) -language/comments/hashbang/escaped-hash-043.js(default) -language/comments/hashbang/escaped-hash-u0023.js(default) -language/comments/hashbang/escaped-hash-u23.js(default) -language/comments/hashbang/escaped-hash-x23.js(default) -language/comments/hashbang/escaped-hashbang.js(default) -language/comments/hashbang/multi-line-comment.js(default) -language/comments/hashbang/preceding-directive-prologue-sc.js(default) -language/comments/hashbang/preceding-directive-prologue.js(default) -language/comments/hashbang/preceding-empty-statement.js(default) -language/comments/hashbang/preceding-hashbang.js(default) -language/comments/hashbang/preceding-line-comment.js(default) -language/comments/hashbang/preceding-multi-line-comment.js(default) -language/comments/hashbang/preceding-whitespace.js(default) -language/expressions/assignment/destructuring/obj-prop-__proto__dup.js(default) -language/expressions/assignment/destructuring/obj-prop-__proto__dup.js(strict mode) -language/expressions/async-arrow-function/await-as-param-ident-nested-arrow-parameter-position.js(default) -language/expressions/async-arrow-function/await-as-param-ident-nested-arrow-parameter-position.js(strict mode) -language/expressions/async-arrow-function/await-as-param-nested-arrow-parameter-position.js(default) -language/expressions/async-arrow-function/await-as-param-nested-arrow-parameter-position.js(strict mode) -language/expressions/async-arrow-function/await-as-param-rest-nested-arrow-parameter-position.js(default) -language/expressions/async-arrow-function/await-as-param-rest-nested-arrow-parameter-position.js(strict mode) -language/expressions/async-arrow-function/early-errors-arrow-await-in-formals-default.js(default) -language/expressions/async-arrow-function/early-errors-arrow-await-in-formals-default.js(strict mode) -language/expressions/async-arrow-function/early-errors-arrow-await-in-formals.js(default) -language/expressions/async-arrow-function/early-errors-arrow-await-in-formals.js(strict mode) -language/expressions/class/elements/fields-duplicate-privatenames.js(default) -language/expressions/class/elements/fields-duplicate-privatenames.js(strict mode) -language/expressions/class/elements/fields-literal-name-static-propname-constructor.js(default) -language/expressions/class/elements/fields-literal-name-static-propname-constructor.js(strict mode) -language/expressions/class/elements/fields-string-name-static-propname-constructor.js(default) -language/expressions/class/elements/fields-string-name-static-propname-constructor.js(strict mode) -language/expressions/class/elements/private-methods/prod-private-method-initialize-order.js(default) -language/expressions/class/elements/private-methods/prod-private-method-initialize-order.js(strict mode) -language/expressions/class/elements/syntax/early-errors/grammar-private-field-on-object-destructuring.js(default) -language/expressions/class/elements/syntax/early-errors/grammar-private-field-on-object-destructuring.js(strict mode) -language/expressions/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-get-field.js(default) -language/expressions/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-get-field.js(strict mode) -language/expressions/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-get-get.js(default) -language/expressions/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-get-get.js(strict mode) -language/expressions/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-meth-field.js(default) -language/expressions/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-meth-field.js(strict mode) -language/expressions/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-meth-get.js(default) -language/expressions/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-meth-get.js(strict mode) -language/expressions/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-meth-meth.js(default) -language/expressions/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-meth-meth.js(strict mode) -language/expressions/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-meth-set.js(default) -language/expressions/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-meth-set.js(strict mode) -language/expressions/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-meth-staticfield.js(default) -language/expressions/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-meth-staticfield.js(strict mode) -language/expressions/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-meth-staticmeth.js(default) -language/expressions/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-meth-staticmeth.js(strict mode) -language/expressions/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-set-field.js(default) -language/expressions/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-set-field.js(strict mode) -language/expressions/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-set-set.js(default) -language/expressions/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-set-set.js(strict mode) -language/expressions/class/elements/syntax/early-errors/invalid-names/field-init-call-expression-bad-reference.js(default) -language/expressions/class/elements/syntax/early-errors/invalid-names/field-init-call-expression-bad-reference.js(strict mode) -language/expressions/class/elements/syntax/early-errors/invalid-names/field-init-call-expression-this.js(default) -language/expressions/class/elements/syntax/early-errors/invalid-names/field-init-call-expression-this.js(strict mode) -language/expressions/class/elements/syntax/early-errors/invalid-names/field-init-fn-call-expression-bad-reference.js(default) -language/expressions/class/elements/syntax/early-errors/invalid-names/field-init-fn-call-expression-bad-reference.js(strict mode) -language/expressions/class/elements/syntax/early-errors/invalid-names/field-init-fn-call-expression-this.js(default) -language/expressions/class/elements/syntax/early-errors/invalid-names/field-init-fn-call-expression-this.js(strict mode) -language/expressions/class/elements/syntax/early-errors/invalid-names/field-init-fn-member-expression-bad-reference.js(default) -language/expressions/class/elements/syntax/early-errors/invalid-names/field-init-fn-member-expression-bad-reference.js(strict mode) -language/expressions/class/elements/syntax/early-errors/invalid-names/field-init-fn-member-expression-this.js(default) -language/expressions/class/elements/syntax/early-errors/invalid-names/field-init-fn-member-expression-this.js(strict mode) -language/expressions/class/elements/syntax/early-errors/invalid-names/field-init-member-expression-bad-reference.js(default) -language/expressions/class/elements/syntax/early-errors/invalid-names/field-init-member-expression-bad-reference.js(strict mode) -language/expressions/class/elements/syntax/early-errors/invalid-names/field-init-member-expression-this.js(default) -language/expressions/class/elements/syntax/early-errors/invalid-names/field-init-member-expression-this.js(strict mode) -language/expressions/class/elements/syntax/early-errors/invalid-names/method-call-expression-bad-reference.js(default) -language/expressions/class/elements/syntax/early-errors/invalid-names/method-call-expression-bad-reference.js(strict mode) -language/expressions/class/elements/syntax/early-errors/invalid-names/method-call-expression-this.js(default) -language/expressions/class/elements/syntax/early-errors/invalid-names/method-call-expression-this.js(strict mode) -language/expressions/class/elements/syntax/early-errors/invalid-names/method-fn-call-expression-bad-reference.js(default) -language/expressions/class/elements/syntax/early-errors/invalid-names/method-fn-call-expression-bad-reference.js(strict mode) -language/expressions/class/elements/syntax/early-errors/invalid-names/method-fn-call-expression-this.js(default) -language/expressions/class/elements/syntax/early-errors/invalid-names/method-fn-call-expression-this.js(strict mode) -language/expressions/class/elements/syntax/early-errors/invalid-names/method-fn-member-expression-bad-reference.js(default) -language/expressions/class/elements/syntax/early-errors/invalid-names/method-fn-member-expression-bad-reference.js(strict mode) -language/expressions/class/elements/syntax/early-errors/invalid-names/method-fn-member-expression-this.js(default) -language/expressions/class/elements/syntax/early-errors/invalid-names/method-fn-member-expression-this.js(strict mode) -language/expressions/class/elements/syntax/early-errors/invalid-names/method-heritage-call-expression-bad-reference.js(default) -language/expressions/class/elements/syntax/early-errors/invalid-names/method-heritage-call-expression-bad-reference.js(strict mode) -language/expressions/class/elements/syntax/early-errors/invalid-names/method-heritage-call-expression-this.js(default) -language/expressions/class/elements/syntax/early-errors/invalid-names/method-heritage-call-expression-this.js(strict mode) -language/expressions/class/elements/syntax/early-errors/invalid-names/method-heritage-member-expression-bad-reference.js(default) -language/expressions/class/elements/syntax/early-errors/invalid-names/method-heritage-member-expression-bad-reference.js(strict mode) -language/expressions/class/elements/syntax/early-errors/invalid-names/method-heritage-member-expression-this.js(default) -language/expressions/class/elements/syntax/early-errors/invalid-names/method-heritage-member-expression-this.js(strict mode) -language/expressions/class/elements/syntax/early-errors/invalid-names/method-member-expression-bad-reference.js(default) -language/expressions/class/elements/syntax/early-errors/invalid-names/method-member-expression-bad-reference.js(strict mode) -language/expressions/class/elements/syntax/early-errors/invalid-names/method-member-expression-this.js(default) -language/expressions/class/elements/syntax/early-errors/invalid-names/method-member-expression-this.js(strict mode) -language/expressions/class/elements/syntax/early-errors/invalid-names/method-outter-call-expression-bad-reference.js(default) -language/expressions/class/elements/syntax/early-errors/invalid-names/method-outter-call-expression-bad-reference.js(strict mode) -language/expressions/class/elements/syntax/early-errors/invalid-names/method-outter-call-expression-this.js(default) -language/expressions/class/elements/syntax/early-errors/invalid-names/method-outter-call-expression-this.js(strict mode) -language/expressions/class/elements/syntax/early-errors/invalid-names/method-outter-member-expression-bad-reference.js(default) -language/expressions/class/elements/syntax/early-errors/invalid-names/method-outter-member-expression-bad-reference.js(strict mode) -language/expressions/class/elements/syntax/early-errors/invalid-names/method-outter-member-expression-this.js(default) -language/expressions/class/elements/syntax/early-errors/invalid-names/method-outter-member-expression-this.js(strict mode) -language/expressions/class/elements/syntax/early-errors/super-private-access-invalid.js(default) -language/expressions/class/elements/syntax/early-errors/super-private-access-invalid.js(strict mode) -language/expressions/object/method-definition/private-name-early-error-async-gen-inside-class.js(default) -language/expressions/object/method-definition/private-name-early-error-async-gen-inside-class.js(strict mode) -language/expressions/object/method-definition/private-name-early-error-gen-inside-class.js(default) -language/expressions/object/method-definition/private-name-early-error-gen-inside-class.js(strict mode) -language/expressions/object/method-definition/private-name-early-error-method-inside-class.js(default) -language/expressions/object/method-definition/private-name-early-error-method-inside-class.js(strict mode) -language/expressions/template-literal/unicode-escape-nls-err.js(default) -language/expressions/template-literal/unicode-escape-nls-err.js(strict mode) -language/identifiers/unicode-escape-nls-err.js(default) -language/identifiers/unicode-escape-nls-err.js(strict mode) -language/literals/numeric/numeric-separator-literal-nzd-nsl-dds-leading-zero-err.js(default) -language/literals/regexp/early-err-pattern.js(default) -language/literals/regexp/early-err-pattern.js(strict mode) -language/literals/regexp/invalid-braced-quantifier-exact.js(default) -language/literals/regexp/invalid-braced-quantifier-exact.js(strict mode) -language/literals/regexp/invalid-braced-quantifier-lower.js(default) -language/literals/regexp/invalid-braced-quantifier-lower.js(strict mode) -language/literals/regexp/invalid-braced-quantifier-range.js(default) -language/literals/regexp/invalid-braced-quantifier-range.js(strict mode) -language/literals/regexp/invalid-optional-lookbehind.js(default) -language/literals/regexp/invalid-optional-lookbehind.js(strict mode) -language/literals/regexp/invalid-optional-negative-lookbehind.js(default) -language/literals/regexp/invalid-optional-negative-lookbehind.js(strict mode) -language/literals/regexp/invalid-range-lookbehind.js(default) -language/literals/regexp/invalid-range-lookbehind.js(strict mode) -language/literals/regexp/invalid-range-negative-lookbehind.js(default) -language/literals/regexp/invalid-range-negative-lookbehind.js(strict mode) -language/literals/regexp/named-groups/invalid-dangling-groupname-2-u.js(default) -language/literals/regexp/named-groups/invalid-dangling-groupname-2-u.js(strict mode) -language/literals/regexp/named-groups/invalid-dangling-groupname-2.js(default) -language/literals/regexp/named-groups/invalid-dangling-groupname-2.js(strict mode) -language/literals/regexp/named-groups/invalid-dangling-groupname-3-u.js(default) -language/literals/regexp/named-groups/invalid-dangling-groupname-3-u.js(strict mode) -language/literals/regexp/named-groups/invalid-dangling-groupname-3.js(default) -language/literals/regexp/named-groups/invalid-dangling-groupname-3.js(strict mode) -language/literals/regexp/named-groups/invalid-dangling-groupname-4-u.js(default) -language/literals/regexp/named-groups/invalid-dangling-groupname-4-u.js(strict mode) -language/literals/regexp/named-groups/invalid-dangling-groupname-4.js(default) -language/literals/regexp/named-groups/invalid-dangling-groupname-4.js(strict mode) -language/literals/regexp/named-groups/invalid-dangling-groupname-5.js(default) -language/literals/regexp/named-groups/invalid-dangling-groupname-5.js(strict mode) -language/literals/regexp/named-groups/invalid-dangling-groupname-u.js(default) -language/literals/regexp/named-groups/invalid-dangling-groupname-u.js(strict mode) -language/literals/regexp/named-groups/invalid-dangling-groupname-without-group-u.js(default) -language/literals/regexp/named-groups/invalid-dangling-groupname-without-group-u.js(strict mode) -language/literals/regexp/named-groups/invalid-dangling-groupname.js(default) -language/literals/regexp/named-groups/invalid-dangling-groupname.js(strict mode) -language/literals/regexp/named-groups/invalid-duplicate-groupspecifier-2-u.js(default) -language/literals/regexp/named-groups/invalid-duplicate-groupspecifier-2-u.js(strict mode) -language/literals/regexp/named-groups/invalid-duplicate-groupspecifier-2.js(default) -language/literals/regexp/named-groups/invalid-duplicate-groupspecifier-2.js(strict mode) -language/literals/regexp/named-groups/invalid-duplicate-groupspecifier-u.js(default) -language/literals/regexp/named-groups/invalid-duplicate-groupspecifier-u.js(strict mode) -language/literals/regexp/named-groups/invalid-duplicate-groupspecifier.js(default) -language/literals/regexp/named-groups/invalid-duplicate-groupspecifier.js(strict mode) -language/literals/regexp/named-groups/invalid-empty-groupspecifier-u.js(default) -language/literals/regexp/named-groups/invalid-empty-groupspecifier-u.js(strict mode) -language/literals/regexp/named-groups/invalid-empty-groupspecifier.js(default) -language/literals/regexp/named-groups/invalid-empty-groupspecifier.js(strict mode) -language/literals/regexp/named-groups/invalid-identity-escape-in-capture-u.js(default) -language/literals/regexp/named-groups/invalid-identity-escape-in-capture-u.js(strict mode) -language/literals/regexp/named-groups/invalid-incomplete-groupname-2-u.js(default) -language/literals/regexp/named-groups/invalid-incomplete-groupname-2-u.js(strict mode) -language/literals/regexp/named-groups/invalid-incomplete-groupname-2.js(default) -language/literals/regexp/named-groups/invalid-incomplete-groupname-2.js(strict mode) -language/literals/regexp/named-groups/invalid-incomplete-groupname-3-u.js(default) -language/literals/regexp/named-groups/invalid-incomplete-groupname-3-u.js(strict mode) -language/literals/regexp/named-groups/invalid-incomplete-groupname-3.js(default) -language/literals/regexp/named-groups/invalid-incomplete-groupname-3.js(strict mode) -language/literals/regexp/named-groups/invalid-incomplete-groupname-4.js(default) -language/literals/regexp/named-groups/invalid-incomplete-groupname-4.js(strict mode) -language/literals/regexp/named-groups/invalid-incomplete-groupname-5.js(default) -language/literals/regexp/named-groups/invalid-incomplete-groupname-5.js(strict mode) -language/literals/regexp/named-groups/invalid-incomplete-groupname-6.js(default) -language/literals/regexp/named-groups/invalid-incomplete-groupname-6.js(strict mode) -language/literals/regexp/named-groups/invalid-incomplete-groupname-u.js(default) -language/literals/regexp/named-groups/invalid-incomplete-groupname-u.js(strict mode) -language/literals/regexp/named-groups/invalid-incomplete-groupname-without-group-2-u.js(default) -language/literals/regexp/named-groups/invalid-incomplete-groupname-without-group-2-u.js(strict mode) -language/literals/regexp/named-groups/invalid-incomplete-groupname-without-group-3-u.js(default) -language/literals/regexp/named-groups/invalid-incomplete-groupname-without-group-3-u.js(strict mode) -language/literals/regexp/named-groups/invalid-incomplete-groupname-without-group-u.js(default) -language/literals/regexp/named-groups/invalid-incomplete-groupname-without-group-u.js(strict mode) -language/literals/regexp/named-groups/invalid-incomplete-groupname.js(default) -language/literals/regexp/named-groups/invalid-incomplete-groupname.js(strict mode) -language/literals/regexp/named-groups/invalid-non-id-continue-groupspecifier-4-u.js(default) -language/literals/regexp/named-groups/invalid-non-id-continue-groupspecifier-4-u.js(strict mode) -language/literals/regexp/named-groups/invalid-non-id-continue-groupspecifier-4.js(default) -language/literals/regexp/named-groups/invalid-non-id-continue-groupspecifier-4.js(strict mode) -language/literals/regexp/named-groups/invalid-non-id-continue-groupspecifier.js(default) -language/literals/regexp/named-groups/invalid-non-id-continue-groupspecifier.js(strict mode) -language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-2-u.js(default) -language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-2-u.js(strict mode) -language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-2.js(default) -language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-2.js(strict mode) -language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-3.js(default) -language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-3.js(strict mode) -language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-4-u.js(default) -language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-4-u.js(strict mode) -language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-4.js(default) -language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-4.js(strict mode) -language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-5-u.js(default) -language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-5-u.js(strict mode) -language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-5.js(default) -language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-5.js(strict mode) -language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-6.js(default) -language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-6.js(strict mode) -language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-7.js(default) -language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-7.js(strict mode) -language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-8-u.js(default) -language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-8-u.js(strict mode) -language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-8.js(default) -language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-8.js(strict mode) -language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-9-u.js(default) -language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-9-u.js(strict mode) -language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-u.js(default) -language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-u.js(strict mode) -language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier.js(default) -language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier.js(strict mode) -language/literals/regexp/named-groups/invalid-numeric-groupspecifier-u.js(default) -language/literals/regexp/named-groups/invalid-numeric-groupspecifier-u.js(strict mode) -language/literals/regexp/named-groups/invalid-numeric-groupspecifier.js(default) -language/literals/regexp/named-groups/invalid-numeric-groupspecifier.js(strict mode) -language/literals/regexp/named-groups/invalid-punctuator-starting-groupspecifier-u.js(default) -language/literals/regexp/named-groups/invalid-punctuator-starting-groupspecifier-u.js(strict mode) -language/literals/regexp/named-groups/invalid-punctuator-starting-groupspecifier.js(default) -language/literals/regexp/named-groups/invalid-punctuator-starting-groupspecifier.js(strict mode) -language/literals/regexp/named-groups/invalid-punctuator-within-groupspecifier-u.js(default) -language/literals/regexp/named-groups/invalid-punctuator-within-groupspecifier-u.js(strict mode) -language/literals/regexp/named-groups/invalid-punctuator-within-groupspecifier.js(default) -language/literals/regexp/named-groups/invalid-punctuator-within-groupspecifier.js(strict mode) -language/literals/regexp/named-groups/invalid-u-escape-in-groupspecifier-2.js(default) -language/literals/regexp/named-groups/invalid-u-escape-in-groupspecifier-2.js(strict mode) -language/literals/regexp/named-groups/invalid-u-escape-in-groupspecifier.js(default) -language/literals/regexp/named-groups/invalid-u-escape-in-groupspecifier.js(strict mode) -language/literals/regexp/named-groups/invalid-unterminated-groupspecifier-u.js(default) -language/literals/regexp/named-groups/invalid-unterminated-groupspecifier-u.js(strict mode) -language/literals/regexp/named-groups/invalid-unterminated-groupspecifier.js(default) -language/literals/regexp/named-groups/invalid-unterminated-groupspecifier.js(strict mode) -language/literals/regexp/u-dec-esc.js(default) -language/literals/regexp/u-dec-esc.js(strict mode) -language/literals/regexp/u-invalid-class-escape.js(default) -language/literals/regexp/u-invalid-class-escape.js(strict mode) -language/literals/regexp/u-invalid-extended-pattern-char.js(default) -language/literals/regexp/u-invalid-extended-pattern-char.js(strict mode) -language/literals/regexp/u-invalid-identity-escape.js(default) -language/literals/regexp/u-invalid-identity-escape.js(strict mode) -language/literals/regexp/u-invalid-legacy-octal-escape.js(default) -language/literals/regexp/u-invalid-legacy-octal-escape.js(strict mode) -language/literals/regexp/u-invalid-non-empty-class-ranges-no-dash-a.js(default) -language/literals/regexp/u-invalid-non-empty-class-ranges-no-dash-a.js(strict mode) -language/literals/regexp/u-invalid-non-empty-class-ranges-no-dash-ab.js(default) -language/literals/regexp/u-invalid-non-empty-class-ranges-no-dash-ab.js(strict mode) -language/literals/regexp/u-invalid-non-empty-class-ranges-no-dash-b.js(default) -language/literals/regexp/u-invalid-non-empty-class-ranges-no-dash-b.js(strict mode) -language/literals/regexp/u-invalid-non-empty-class-ranges.js(default) -language/literals/regexp/u-invalid-non-empty-class-ranges.js(strict mode) -language/literals/regexp/u-invalid-oob-decimal-escape.js(default) -language/literals/regexp/u-invalid-oob-decimal-escape.js(strict mode) -language/literals/regexp/u-invalid-optional-lookahead.js(default) -language/literals/regexp/u-invalid-optional-lookahead.js(strict mode) -language/literals/regexp/u-invalid-optional-lookbehind.js(default) -language/literals/regexp/u-invalid-optional-lookbehind.js(strict mode) -language/literals/regexp/u-invalid-optional-negative-lookahead.js(default) -language/literals/regexp/u-invalid-optional-negative-lookahead.js(strict mode) -language/literals/regexp/u-invalid-optional-negative-lookbehind.js(default) -language/literals/regexp/u-invalid-optional-negative-lookbehind.js(strict mode) -language/literals/regexp/u-invalid-range-lookahead.js(default) -language/literals/regexp/u-invalid-range-lookahead.js(strict mode) -language/literals/regexp/u-invalid-range-lookbehind.js(default) -language/literals/regexp/u-invalid-range-lookbehind.js(strict mode) -language/literals/regexp/u-invalid-range-negative-lookahead.js(default) -language/literals/regexp/u-invalid-range-negative-lookahead.js(strict mode) -language/literals/regexp/u-invalid-range-negative-lookbehind.js(default) -language/literals/regexp/u-invalid-range-negative-lookbehind.js(strict mode) -language/literals/regexp/u-unicode-esc-bounds.js(default) -language/literals/regexp/u-unicode-esc-bounds.js(strict mode) -language/literals/regexp/u-unicode-esc-non-hex.js(default) -language/literals/regexp/u-unicode-esc-non-hex.js(strict mode) -language/literals/regexp/unicode-escape-nls-err.js(default) -language/literals/regexp/unicode-escape-nls-err.js(strict mode) -language/literals/string/unicode-escape-nls-err-double.js(default) -language/literals/string/unicode-escape-nls-err-double.js(strict mode) -language/literals/string/unicode-escape-nls-err-single.js(default) -language/literals/string/unicode-escape-nls-err-single.js(strict mode) -language/module-code/privatename-not-valid-earlyerr-module-1.js(default) -language/module-code/privatename-not-valid-earlyerr-module-1.js(strict mode) -language/module-code/privatename-not-valid-earlyerr-module-2.js(default) -language/module-code/privatename-not-valid-earlyerr-module-2.js(strict mode) -language/module-code/privatename-not-valid-earlyerr-module-3.js(default) -language/module-code/privatename-not-valid-earlyerr-module-3.js(strict mode) -language/module-code/privatename-not-valid-earlyerr-module-4.js(default) -language/module-code/privatename-not-valid-earlyerr-module-4.js(strict mode) -language/statements/class/elements/fields-duplicate-privatenames.js(default) -language/statements/class/elements/fields-duplicate-privatenames.js(strict mode) -language/statements/class/elements/fields-literal-name-static-propname-constructor.js(default) -language/statements/class/elements/fields-literal-name-static-propname-constructor.js(strict mode) -language/statements/class/elements/fields-string-name-static-propname-constructor.js(default) -language/statements/class/elements/fields-string-name-static-propname-constructor.js(strict mode) -language/statements/class/elements/private-methods/prod-private-method-initialize-order.js(default) -language/statements/class/elements/private-methods/prod-private-method-initialize-order.js(strict mode) -language/statements/class/elements/privatename-not-valid-earlyerr-script-1.js(default) -language/statements/class/elements/privatename-not-valid-earlyerr-script-1.js(strict mode) -language/statements/class/elements/privatename-not-valid-earlyerr-script-2.js(default) -language/statements/class/elements/privatename-not-valid-earlyerr-script-2.js(strict mode) -language/statements/class/elements/privatename-not-valid-earlyerr-script-3.js(default) -language/statements/class/elements/privatename-not-valid-earlyerr-script-3.js(strict mode) -language/statements/class/elements/privatename-not-valid-earlyerr-script-4.js(default) -language/statements/class/elements/privatename-not-valid-earlyerr-script-4.js(strict mode) -language/statements/class/elements/syntax/early-errors/grammar-private-field-on-object-destructuring.js(default) -language/statements/class/elements/syntax/early-errors/grammar-private-field-on-object-destructuring.js(strict mode) -language/statements/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-get-field.js(default) -language/statements/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-get-field.js(strict mode) -language/statements/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-get-get.js(default) -language/statements/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-get-get.js(strict mode) -language/statements/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-meth-field.js(default) -language/statements/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-meth-field.js(strict mode) -language/statements/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-meth-get.js(default) -language/statements/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-meth-get.js(strict mode) -language/statements/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-meth-meth.js(default) -language/statements/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-meth-meth.js(strict mode) -language/statements/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-meth-set.js(default) -language/statements/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-meth-set.js(strict mode) -language/statements/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-meth-staticfield.js(default) -language/statements/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-meth-staticfield.js(strict mode) -language/statements/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-meth-staticmeth.js(default) -language/statements/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-meth-staticmeth.js(strict mode) -language/statements/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-set-field.js(default) -language/statements/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-set-field.js(strict mode) -language/statements/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-set-set.js(default) -language/statements/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-set-set.js(strict mode) -language/statements/class/elements/syntax/early-errors/invalid-names/field-init-call-expression-bad-reference.js(default) -language/statements/class/elements/syntax/early-errors/invalid-names/field-init-call-expression-bad-reference.js(strict mode) -language/statements/class/elements/syntax/early-errors/invalid-names/field-init-call-expression-this.js(default) -language/statements/class/elements/syntax/early-errors/invalid-names/field-init-call-expression-this.js(strict mode) -language/statements/class/elements/syntax/early-errors/invalid-names/field-init-fn-call-expression-bad-reference.js(default) -language/statements/class/elements/syntax/early-errors/invalid-names/field-init-fn-call-expression-bad-reference.js(strict mode) -language/statements/class/elements/syntax/early-errors/invalid-names/field-init-fn-call-expression-this.js(default) -language/statements/class/elements/syntax/early-errors/invalid-names/field-init-fn-call-expression-this.js(strict mode) -language/statements/class/elements/syntax/early-errors/invalid-names/field-init-fn-member-expression-bad-reference.js(default) -language/statements/class/elements/syntax/early-errors/invalid-names/field-init-fn-member-expression-bad-reference.js(strict mode) -language/statements/class/elements/syntax/early-errors/invalid-names/field-init-fn-member-expression-this.js(default) -language/statements/class/elements/syntax/early-errors/invalid-names/field-init-fn-member-expression-this.js(strict mode) -language/statements/class/elements/syntax/early-errors/invalid-names/field-init-member-expression-bad-reference.js(default) -language/statements/class/elements/syntax/early-errors/invalid-names/field-init-member-expression-bad-reference.js(strict mode) -language/statements/class/elements/syntax/early-errors/invalid-names/field-init-member-expression-this.js(default) -language/statements/class/elements/syntax/early-errors/invalid-names/field-init-member-expression-this.js(strict mode) -language/statements/class/elements/syntax/early-errors/invalid-names/method-call-expression-bad-reference.js(default) -language/statements/class/elements/syntax/early-errors/invalid-names/method-call-expression-bad-reference.js(strict mode) -language/statements/class/elements/syntax/early-errors/invalid-names/method-call-expression-this.js(default) -language/statements/class/elements/syntax/early-errors/invalid-names/method-call-expression-this.js(strict mode) -language/statements/class/elements/syntax/early-errors/invalid-names/method-fn-call-expression-bad-reference.js(default) -language/statements/class/elements/syntax/early-errors/invalid-names/method-fn-call-expression-bad-reference.js(strict mode) -language/statements/class/elements/syntax/early-errors/invalid-names/method-fn-call-expression-this.js(default) -language/statements/class/elements/syntax/early-errors/invalid-names/method-fn-call-expression-this.js(strict mode) -language/statements/class/elements/syntax/early-errors/invalid-names/method-fn-member-expression-bad-reference.js(default) -language/statements/class/elements/syntax/early-errors/invalid-names/method-fn-member-expression-bad-reference.js(strict mode) -language/statements/class/elements/syntax/early-errors/invalid-names/method-fn-member-expression-this.js(default) -language/statements/class/elements/syntax/early-errors/invalid-names/method-fn-member-expression-this.js(strict mode) -language/statements/class/elements/syntax/early-errors/invalid-names/method-heritage-call-expression-bad-reference.js(default) -language/statements/class/elements/syntax/early-errors/invalid-names/method-heritage-call-expression-bad-reference.js(strict mode) -language/statements/class/elements/syntax/early-errors/invalid-names/method-heritage-call-expression-this.js(default) -language/statements/class/elements/syntax/early-errors/invalid-names/method-heritage-call-expression-this.js(strict mode) -language/statements/class/elements/syntax/early-errors/invalid-names/method-heritage-member-expression-bad-reference.js(default) -language/statements/class/elements/syntax/early-errors/invalid-names/method-heritage-member-expression-bad-reference.js(strict mode) -language/statements/class/elements/syntax/early-errors/invalid-names/method-heritage-member-expression-this.js(default) -language/statements/class/elements/syntax/early-errors/invalid-names/method-heritage-member-expression-this.js(strict mode) -language/statements/class/elements/syntax/early-errors/invalid-names/method-member-expression-bad-reference.js(default) -language/statements/class/elements/syntax/early-errors/invalid-names/method-member-expression-bad-reference.js(strict mode) -language/statements/class/elements/syntax/early-errors/invalid-names/method-member-expression-this.js(default) -language/statements/class/elements/syntax/early-errors/invalid-names/method-member-expression-this.js(strict mode) -language/statements/class/elements/syntax/early-errors/invalid-names/method-outter-call-expression-bad-reference.js(default) -language/statements/class/elements/syntax/early-errors/invalid-names/method-outter-call-expression-bad-reference.js(strict mode) -language/statements/class/elements/syntax/early-errors/invalid-names/method-outter-call-expression-this.js(default) -language/statements/class/elements/syntax/early-errors/invalid-names/method-outter-call-expression-this.js(strict mode) -language/statements/class/elements/syntax/early-errors/invalid-names/method-outter-member-expression-bad-reference.js(default) -language/statements/class/elements/syntax/early-errors/invalid-names/method-outter-member-expression-bad-reference.js(strict mode) -language/statements/class/elements/syntax/early-errors/invalid-names/method-outter-member-expression-this.js(default) -language/statements/class/elements/syntax/early-errors/invalid-names/method-outter-member-expression-this.js(strict mode) -language/statements/class/elements/syntax/early-errors/super-private-access-invalid.js(default) -language/statements/class/elements/syntax/early-errors/super-private-access-invalid.js(strict mode) -language/statements/for-in/dstr/array-rest-before-elision.js(default) -language/statements/for-in/dstr/array-rest-before-elision.js(strict mode) -language/statements/for-in/dstr/array-rest-elision-invalid.js(default) -language/statements/for-in/dstr/array-rest-elision-invalid.js(strict mode) -language/statements/for-of/dstr/array-rest-before-elision.js(default) -language/statements/for-of/dstr/array-rest-before-elision.js(strict mode) -language/statements/for-of/dstr/array-rest-elision-invalid.js(default) -language/statements/for-of/dstr/array-rest-elision-invalid.js(strict mode) \ No newline at end of file diff --git a/yarn.lock b/yarn.lock index b9d237c25ec1..55abcd7e0e08 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2,46 +2,56 @@ # yarn lockfile v1 -"@babel/cli@^7.4.4": - version "7.4.4" - resolved "https://registry.yarnpkg.com/@babel/cli/-/cli-7.4.4.tgz#5454bb7112f29026a4069d8e6f0e1794e651966c" - integrity sha512-XGr5YjQSjgTa6OzQZY57FAJsdeVSAKR/u/KA5exWIz66IKtv/zXtHy+fIZcMry/EgYegwuHE7vzGnrFhjdIAsQ== +"@babel/cli@^7.8.4": + version "7.8.4" + resolved "https://registry.yarnpkg.com/@babel/cli/-/cli-7.8.4.tgz#505fb053721a98777b2b175323ea4f090b7d3c1c" + integrity sha512-XXLgAm6LBbaNxaGhMAznXXaxtCWfuv6PIDJ9Alsy9JYTOh+j2jJz+L/162kkfU1j/pTSxK1xGmlwI4pdIMkoag== dependencies: - commander "^2.8.1" + commander "^4.0.1" convert-source-map "^1.1.0" fs-readdir-recursive "^1.1.0" glob "^7.0.0" - lodash "^4.17.11" - mkdirp "^0.5.1" - output-file-sync "^2.0.0" + lodash "^4.17.13" + make-dir "^2.1.0" slash "^2.0.0" source-map "^0.5.0" optionalDependencies: - chokidar "^2.0.4" + chokidar "^2.1.8" -"@babel/code-frame@^7.0.0": - version "7.0.0" - resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.0.0.tgz#06e2ab19bdb535385559aabb5ba59729482800f8" - integrity sha512-OfC2uemaknXr87bdLUkWog7nYuliM9Ij5HUcajsVcMCpQrcLmtxRbVFTIqmcSkSeYRBFBRxs2FiUqFJDLdiebA== +"@babel/code-frame@^7.0.0", "@babel/code-frame@^7.5.5", "@babel/code-frame@^7.8.3": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.8.3.tgz#33e25903d7481181534e12ec0a25f16b6fcf419e" + integrity sha512-a9gxpmdXtZEInkCSHUJDLHZVBgb1QS0jhss4cPP93EW7s+uC5bikET2twEF3KV+7rDblJcmNvTR7VJejqd2C2g== dependencies: - "@babel/highlight" "^7.0.0" + "@babel/highlight" "^7.8.3" -"@babel/core@^7.1.0", "@babel/core@^7.4.5": - version "7.4.5" - resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.4.5.tgz#081f97e8ffca65a9b4b0fdc7e274e703f000c06a" - integrity sha512-OvjIh6aqXtlsA8ujtGKfC7LYWksYSX8yQcM8Ay3LuvVeQ63lcOKgoZWVqcpFwkd29aYU9rVx7jxhfhiEDV9MZA== +"@babel/compat-data@^7.8.6", "@babel/compat-data@^7.9.0": + version "7.9.0" + resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.9.0.tgz#04815556fc90b0c174abd2c0c1bb966faa036a6c" + integrity sha512-zeFQrr+284Ekvd9e7KAX954LkapWiOmQtsfHirhxqfdlX6MEC32iRE+pqUGlYIBchdevaCwvzxWGSy/YBNI85g== dependencies: - "@babel/code-frame" "^7.0.0" - "@babel/generator" "^7.4.4" - "@babel/helpers" "^7.4.4" - "@babel/parser" "^7.4.5" - "@babel/template" "^7.4.4" - "@babel/traverse" "^7.4.5" - "@babel/types" "^7.4.4" - convert-source-map "^1.1.0" + browserslist "^4.9.1" + invariant "^2.2.4" + semver "^5.5.0" + +"@babel/core@^7.1.0", "@babel/core@^7.9.0": + version "7.9.0" + resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.9.0.tgz#ac977b538b77e132ff706f3b8a4dbad09c03c56e" + integrity sha512-kWc7L0fw1xwvI0zi8OKVBuxRVefwGOrKSQMvrQ3dW+bIIavBY3/NpXmpjMy7bQnLgwgzWQZ8TlM57YHpHNHz4w== + dependencies: + "@babel/code-frame" "^7.8.3" + "@babel/generator" "^7.9.0" + "@babel/helper-module-transforms" "^7.9.0" + "@babel/helpers" "^7.9.0" + "@babel/parser" "^7.9.0" + "@babel/template" "^7.8.6" + "@babel/traverse" "^7.9.0" + "@babel/types" "^7.9.0" + convert-source-map "^1.7.0" debug "^4.1.0" - json5 "^2.1.0" - lodash "^4.17.11" + gensync "^1.0.0-beta.1" + json5 "^2.1.2" + lodash "^4.17.13" resolve "^1.3.2" semver "^5.4.1" source-map "^0.5.0" @@ -51,695 +61,786 @@ resolved "https://registry.yarnpkg.com/@babel/eslint-plugin-development/-/eslint-plugin-development-1.0.1.tgz#1f5206ae95795db09b65e7dbc2b158d66497a44c" integrity sha512-ioEhN8HgKr4Yx8ef+XryNpKN4FimSFceb0qVVxvoUzpFn3xyq17MlY5AquEqtXObE7Nu7WKq7QL9INzjCrugyw== -"@babel/generator@^7.0.0", "@babel/generator@^7.4.4": - version "7.4.4" - resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.4.4.tgz#174a215eb843fc392c7edcaabeaa873de6e8f041" - integrity sha512-53UOLK6TVNqKxf7RUh8NE851EHRxOOeVXKbK2bivdb+iziMyk03Sr4eaE9OELCbyZAAafAKPDwF2TPUES5QbxQ== +"@babel/generator@^7.4.0", "@babel/generator@^7.9.0", "@babel/generator@^7.9.5": + version "7.9.5" + resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.9.5.tgz#27f0917741acc41e6eaaced6d68f96c3fa9afaf9" + integrity sha512-GbNIxVB3ZJe3tLeDm1HSn2AhuD/mVcyLDpgtLXa5tplmWrJdF/elxB56XNqCuD6szyNkDi6wuoKXln3QeBmCHQ== dependencies: - "@babel/types" "^7.4.4" + "@babel/types" "^7.9.5" jsesc "^2.5.1" - lodash "^4.17.11" + lodash "^4.17.13" source-map "^0.5.0" - trim-right "^1.0.1" - -"@babel/helper-annotate-as-pure@^7.0.0": - version "7.0.0" - resolved "https://registry.yarnpkg.com/@babel/helper-annotate-as-pure/-/helper-annotate-as-pure-7.0.0.tgz#323d39dd0b50e10c7c06ca7d7638e6864d8c5c32" - integrity sha512-3UYcJUj9kvSLbLbUIfQTqzcy5VX7GRZ/CCDrnOaZorFFM01aXp1+GJwuFGV4NDDoAS+mOUyHcO6UD/RfqOks3Q== - dependencies: - "@babel/types" "^7.0.0" - -"@babel/helper-builder-binary-assignment-operator-visitor@^7.1.0": - version "7.1.0" - resolved "https://registry.yarnpkg.com/@babel/helper-builder-binary-assignment-operator-visitor/-/helper-builder-binary-assignment-operator-visitor-7.1.0.tgz#6b69628dfe4087798e0c4ed98e3d4a6b2fbd2f5f" - integrity sha512-qNSR4jrmJ8M1VMM9tibvyRAHXQs2PmaksQF7c1CGJNipfe3D8p+wgNwgso/P2A2r2mdgBWAXljNWR0QRZAMW8w== - dependencies: - "@babel/helper-explode-assignable-expression" "^7.1.0" - "@babel/types" "^7.0.0" - -"@babel/helper-call-delegate@^7.4.4": - version "7.4.4" - resolved "https://registry.yarnpkg.com/@babel/helper-call-delegate/-/helper-call-delegate-7.4.4.tgz#87c1f8ca19ad552a736a7a27b1c1fcf8b1ff1f43" - integrity sha512-l79boDFJ8S1c5hvQvG+rc+wHw6IuH7YldmRKsYtpbawsxURu/paVy57FZMomGK22/JckepaikOkY0MoAmdyOlQ== - dependencies: - "@babel/helper-hoist-variables" "^7.4.4" - "@babel/traverse" "^7.4.4" - "@babel/types" "^7.4.4" - -"@babel/helper-create-class-features-plugin@^7.4.4": - version "7.4.4" - resolved "https://registry.yarnpkg.com/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.4.4.tgz#fc3d690af6554cc9efc607364a82d48f58736dba" - integrity sha512-UbBHIa2qeAGgyiNR9RszVF7bUHEdgS4JAUNT8SiqrAN6YJVxlOxeLr5pBzb5kan302dejJ9nla4RyKcR1XT6XA== - dependencies: - "@babel/helper-function-name" "^7.1.0" - "@babel/helper-member-expression-to-functions" "^7.0.0" - "@babel/helper-optimise-call-expression" "^7.0.0" - "@babel/helper-plugin-utils" "^7.0.0" - "@babel/helper-replace-supers" "^7.4.4" - "@babel/helper-split-export-declaration" "^7.4.4" - -"@babel/helper-define-map@^7.4.4": - version "7.4.4" - resolved "https://registry.yarnpkg.com/@babel/helper-define-map/-/helper-define-map-7.4.4.tgz#6969d1f570b46bdc900d1eba8e5d59c48ba2c12a" - integrity sha512-IX3Ln8gLhZpSuqHJSnTNBWGDE9kdkTEWl21A/K7PQ00tseBwbqCHTvNLHSBd9M0R5rER4h5Rsvj9vw0R5SieBg== - dependencies: - "@babel/helper-function-name" "^7.1.0" - "@babel/types" "^7.4.4" - lodash "^4.17.11" - -"@babel/helper-explode-assignable-expression@^7.1.0": - version "7.1.0" - resolved "https://registry.yarnpkg.com/@babel/helper-explode-assignable-expression/-/helper-explode-assignable-expression-7.1.0.tgz#537fa13f6f1674df745b0c00ec8fe4e99681c8f6" - integrity sha512-NRQpfHrJ1msCHtKjbzs9YcMmJZOg6mQMmGRB+hbamEdG5PNpaSm95275VD92DvJKuyl0s2sFiDmMZ+EnnvufqA== - dependencies: - "@babel/traverse" "^7.1.0" - "@babel/types" "^7.0.0" - -"@babel/helper-function-name@^7.1.0": - version "7.1.0" - resolved "https://registry.yarnpkg.com/@babel/helper-function-name/-/helper-function-name-7.1.0.tgz#a0ceb01685f73355d4360c1247f582bfafc8ff53" - integrity sha512-A95XEoCpb3TO+KZzJ4S/5uW5fNe26DjBGqf1o9ucyLyCmi1dXq/B3c8iaWTfBk3VvetUxl16e8tIrd5teOCfGw== - dependencies: - "@babel/helper-get-function-arity" "^7.0.0" - "@babel/template" "^7.1.0" - "@babel/types" "^7.0.0" - -"@babel/helper-get-function-arity@^7.0.0": - version "7.0.0" - resolved "https://registry.yarnpkg.com/@babel/helper-get-function-arity/-/helper-get-function-arity-7.0.0.tgz#83572d4320e2a4657263734113c42868b64e49c3" - integrity sha512-r2DbJeg4svYvt3HOS74U4eWKsUAMRH01Z1ds1zx8KNTPtpTL5JAsdFv8BNyOpVqdFhHkkRDIg5B4AsxmkjAlmQ== - dependencies: - "@babel/types" "^7.0.0" - -"@babel/helper-hoist-variables@^7.4.4": - version "7.4.4" - resolved "https://registry.yarnpkg.com/@babel/helper-hoist-variables/-/helper-hoist-variables-7.4.4.tgz#0298b5f25c8c09c53102d52ac4a98f773eb2850a" - integrity sha512-VYk2/H/BnYbZDDg39hr3t2kKyifAm1W6zHRfhx8jGjIHpQEBv9dry7oQ2f3+J703TLu69nYdxsovl0XYfcnK4w== - dependencies: - "@babel/types" "^7.4.4" -"@babel/helper-member-expression-to-functions@^7.0.0": - version "7.0.0" - resolved "https://registry.yarnpkg.com/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.0.0.tgz#8cd14b0a0df7ff00f009e7d7a436945f47c7a16f" - integrity sha512-avo+lm/QmZlv27Zsi0xEor2fKcqWG56D5ae9dzklpIaY7cQMK5N8VSpaNVPPagiqmy7LrEjK1IWdGMOqPu5csg== +"@babel/helper-annotate-as-pure@^7.8.3": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/helper-annotate-as-pure/-/helper-annotate-as-pure-7.8.3.tgz#60bc0bc657f63a0924ff9a4b4a0b24a13cf4deee" + integrity sha512-6o+mJrZBxOoEX77Ezv9zwW7WV8DdluouRKNY/IR5u/YTMuKHgugHOzYWlYvYLpLA9nPsQCAAASpCIbjI9Mv+Uw== dependencies: - "@babel/types" "^7.0.0" + "@babel/types" "^7.8.3" -"@babel/helper-module-imports@^7.0.0": - version "7.0.0" - resolved "https://registry.yarnpkg.com/@babel/helper-module-imports/-/helper-module-imports-7.0.0.tgz#96081b7111e486da4d2cd971ad1a4fe216cc2e3d" - integrity sha512-aP/hlLq01DWNEiDg4Jn23i+CXxW/owM4WpDLFUbpjxe4NS3BhLVZQ5i7E0ZrxuQ/vwekIeciyamgB1UIYxxM6A== +"@babel/helper-builder-binary-assignment-operator-visitor@^7.8.3": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/helper-builder-binary-assignment-operator-visitor/-/helper-builder-binary-assignment-operator-visitor-7.8.3.tgz#c84097a427a061ac56a1c30ebf54b7b22d241503" + integrity sha512-5eFOm2SyFPK4Rh3XMMRDjN7lBH0orh3ss0g3rTYZnBQ+r6YPj7lgDyCvPphynHvUrobJmeMignBr6Acw9mAPlw== dependencies: - "@babel/types" "^7.0.0" + "@babel/helper-explode-assignable-expression" "^7.8.3" + "@babel/types" "^7.8.3" -"@babel/helper-module-transforms@^7.1.0", "@babel/helper-module-transforms@^7.4.4": - version "7.4.4" - resolved "https://registry.yarnpkg.com/@babel/helper-module-transforms/-/helper-module-transforms-7.4.4.tgz#96115ea42a2f139e619e98ed46df6019b94414b8" - integrity sha512-3Z1yp8TVQf+B4ynN7WoHPKS8EkdTbgAEy0nU0rs/1Kw4pDgmvYH3rz3aI11KgxKCba2cn7N+tqzV1mY2HMN96w== +"@babel/helper-compilation-targets@^7.8.7": + version "7.8.7" + resolved "https://registry.yarnpkg.com/@babel/helper-compilation-targets/-/helper-compilation-targets-7.8.7.tgz#dac1eea159c0e4bd46e309b5a1b04a66b53c1dde" + integrity sha512-4mWm8DCK2LugIS+p1yArqvG1Pf162upsIsjE7cNBjez+NjliQpVhj20obE520nao0o14DaTnFJv+Fw5a0JpoUw== dependencies: - "@babel/helper-module-imports" "^7.0.0" - "@babel/helper-simple-access" "^7.1.0" - "@babel/helper-split-export-declaration" "^7.4.4" - "@babel/template" "^7.4.4" - "@babel/types" "^7.4.4" - lodash "^4.17.11" + "@babel/compat-data" "^7.8.6" + browserslist "^4.9.1" + invariant "^2.2.4" + levenary "^1.1.1" + semver "^5.5.0" -"@babel/helper-optimise-call-expression@^7.0.0": - version "7.0.0" - resolved "https://registry.yarnpkg.com/@babel/helper-optimise-call-expression/-/helper-optimise-call-expression-7.0.0.tgz#a2920c5702b073c15de51106200aa8cad20497d5" - integrity sha512-u8nd9NQePYNQV8iPWu/pLLYBqZBa4ZaY1YWRFMuxrid94wKI1QNt67NEZ7GAe5Kc/0LLScbim05xZFWkAdrj9g== +"@babel/helper-create-class-features-plugin@^7.8.3": + version "7.8.6" + resolved "https://registry.yarnpkg.com/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.8.6.tgz#243a5b46e2f8f0f674dc1387631eb6b28b851de0" + integrity sha512-klTBDdsr+VFFqaDHm5rR69OpEQtO2Qv8ECxHS1mNhJJvaHArR6a1xTf5K/eZW7eZpJbhCx3NW1Yt/sKsLXLblg== + dependencies: + "@babel/helper-function-name" "^7.8.3" + "@babel/helper-member-expression-to-functions" "^7.8.3" + "@babel/helper-optimise-call-expression" "^7.8.3" + "@babel/helper-plugin-utils" "^7.8.3" + "@babel/helper-replace-supers" "^7.8.6" + "@babel/helper-split-export-declaration" "^7.8.3" + +"@babel/helper-create-regexp-features-plugin@^7.8.3", "@babel/helper-create-regexp-features-plugin@^7.8.8": + version "7.8.8" + resolved "https://registry.yarnpkg.com/@babel/helper-create-regexp-features-plugin/-/helper-create-regexp-features-plugin-7.8.8.tgz#5d84180b588f560b7864efaeea89243e58312087" + integrity sha512-LYVPdwkrQEiX9+1R29Ld/wTrmQu1SSKYnuOk3g0CkcZMA1p0gsNxJFj/3gBdaJ7Cg0Fnek5z0DsMULePP7Lrqg== + dependencies: + "@babel/helper-annotate-as-pure" "^7.8.3" + "@babel/helper-regex" "^7.8.3" + regexpu-core "^4.7.0" + +"@babel/helper-define-map@^7.8.3": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/helper-define-map/-/helper-define-map-7.8.3.tgz#a0655cad5451c3760b726eba875f1cd8faa02c15" + integrity sha512-PoeBYtxoZGtct3md6xZOCWPcKuMuk3IHhgxsRRNtnNShebf4C8YonTSblsK4tvDbm+eJAw2HAPOfCr+Q/YRG/g== + dependencies: + "@babel/helper-function-name" "^7.8.3" + "@babel/types" "^7.8.3" + lodash "^4.17.13" + +"@babel/helper-explode-assignable-expression@^7.8.3": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/helper-explode-assignable-expression/-/helper-explode-assignable-expression-7.8.3.tgz#a728dc5b4e89e30fc2dfc7d04fa28a930653f982" + integrity sha512-N+8eW86/Kj147bO9G2uclsg5pwfs/fqqY5rwgIL7eTBklgXjcOJ3btzS5iM6AitJcftnY7pm2lGsrJVYLGjzIw== + dependencies: + "@babel/traverse" "^7.8.3" + "@babel/types" "^7.8.3" + +"@babel/helper-function-name@^7.8.3", "@babel/helper-function-name@^7.9.5": + version "7.9.5" + resolved "https://registry.yarnpkg.com/@babel/helper-function-name/-/helper-function-name-7.9.5.tgz#2b53820d35275120e1874a82e5aabe1376920a5c" + integrity sha512-JVcQZeXM59Cd1qanDUxv9fgJpt3NeKUaqBqUEvfmQ+BCOKq2xUgaWZW2hr0dkbyJgezYuplEoh5knmrnS68efw== + dependencies: + "@babel/helper-get-function-arity" "^7.8.3" + "@babel/template" "^7.8.3" + "@babel/types" "^7.9.5" + +"@babel/helper-get-function-arity@^7.8.3": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/helper-get-function-arity/-/helper-get-function-arity-7.8.3.tgz#b894b947bd004381ce63ea1db9f08547e920abd5" + integrity sha512-FVDR+Gd9iLjUMY1fzE2SR0IuaJToR4RkCDARVfsBBPSP53GEqSFjD8gNyxg246VUyc/ALRxFaAK8rVG7UT7xRA== + dependencies: + "@babel/types" "^7.8.3" + +"@babel/helper-hoist-variables@^7.8.3": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/helper-hoist-variables/-/helper-hoist-variables-7.8.3.tgz#1dbe9b6b55d78c9b4183fc8cdc6e30ceb83b7134" + integrity sha512-ky1JLOjcDUtSc+xkt0xhYff7Z6ILTAHKmZLHPxAhOP0Nd77O+3nCsd6uSVYur6nJnCI029CrNbYlc0LoPfAPQg== + dependencies: + "@babel/types" "^7.8.3" + +"@babel/helper-member-expression-to-functions@^7.8.3": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.8.3.tgz#659b710498ea6c1d9907e0c73f206eee7dadc24c" + integrity sha512-fO4Egq88utkQFjbPrSHGmGLFqmrshs11d46WI+WZDESt7Wu7wN2G2Iu+NMMZJFDOVRHAMIkB5SNh30NtwCA7RA== + dependencies: + "@babel/types" "^7.8.3" + +"@babel/helper-module-imports@^7.0.0", "@babel/helper-module-imports@^7.8.3": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/helper-module-imports/-/helper-module-imports-7.8.3.tgz#7fe39589b39c016331b6b8c3f441e8f0b1419498" + integrity sha512-R0Bx3jippsbAEtzkpZ/6FIiuzOURPcMjHp+Z6xPe6DtApDJx+w7UYyOLanZqO8+wKR9G10s/FmHXvxaMd9s6Kg== + dependencies: + "@babel/types" "^7.8.3" + +"@babel/helper-module-transforms@^7.9.0": + version "7.9.0" + resolved "https://registry.yarnpkg.com/@babel/helper-module-transforms/-/helper-module-transforms-7.9.0.tgz#43b34dfe15961918707d247327431388e9fe96e5" + integrity sha512-0FvKyu0gpPfIQ8EkxlrAydOWROdHpBmiCiRwLkUiBGhCUPRRbVD2/tm3sFr/c/GWFrQ/ffutGUAnx7V0FzT2wA== + dependencies: + "@babel/helper-module-imports" "^7.8.3" + "@babel/helper-replace-supers" "^7.8.6" + "@babel/helper-simple-access" "^7.8.3" + "@babel/helper-split-export-declaration" "^7.8.3" + "@babel/template" "^7.8.6" + "@babel/types" "^7.9.0" + lodash "^4.17.13" + +"@babel/helper-optimise-call-expression@^7.8.3": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/helper-optimise-call-expression/-/helper-optimise-call-expression-7.8.3.tgz#7ed071813d09c75298ef4f208956006b6111ecb9" + integrity sha512-Kag20n86cbO2AvHca6EJsvqAd82gc6VMGule4HwebwMlwkpXuVqrNRj6CkCV2sKxgi9MyAUnZVnZ6lJ1/vKhHQ== + dependencies: + "@babel/types" "^7.8.3" + +"@babel/helper-plugin-utils@^7.0.0", "@babel/helper-plugin-utils@^7.8.0", "@babel/helper-plugin-utils@^7.8.3": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/helper-plugin-utils/-/helper-plugin-utils-7.8.3.tgz#9ea293be19babc0f52ff8ca88b34c3611b208670" + integrity sha512-j+fq49Xds2smCUNYmEHF9kGNkhbet6yVIBp4e6oeQpH1RUs/Ir06xUKzDjDkGcaaokPiTNs2JBWHjaE4csUkZQ== + +"@babel/helper-regex@^7.8.3": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/helper-regex/-/helper-regex-7.8.3.tgz#139772607d51b93f23effe72105b319d2a4c6965" + integrity sha512-BWt0QtYv/cg/NecOAZMdcn/waj/5P26DR4mVLXfFtDokSR6fyuG0Pj+e2FqtSME+MqED1khnSMulkmGl8qWiUQ== + dependencies: + lodash "^4.17.13" + +"@babel/helper-remap-async-to-generator@^7.8.3": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/helper-remap-async-to-generator/-/helper-remap-async-to-generator-7.8.3.tgz#273c600d8b9bf5006142c1e35887d555c12edd86" + integrity sha512-kgwDmw4fCg7AVgS4DukQR/roGp+jP+XluJE5hsRZwxCYGg+Rv9wSGErDWhlI90FODdYfd4xG4AQRiMDjjN0GzA== + dependencies: + "@babel/helper-annotate-as-pure" "^7.8.3" + "@babel/helper-wrap-function" "^7.8.3" + "@babel/template" "^7.8.3" + "@babel/traverse" "^7.8.3" + "@babel/types" "^7.8.3" + +"@babel/helper-replace-supers@^7.8.3", "@babel/helper-replace-supers@^7.8.6": + version "7.8.6" + resolved "https://registry.yarnpkg.com/@babel/helper-replace-supers/-/helper-replace-supers-7.8.6.tgz#5ada744fd5ad73203bf1d67459a27dcba67effc8" + integrity sha512-PeMArdA4Sv/Wf4zXwBKPqVj7n9UF/xg6slNRtZW84FM7JpE1CbG8B612FyM4cxrf4fMAMGO0kR7voy1ForHHFA== + dependencies: + "@babel/helper-member-expression-to-functions" "^7.8.3" + "@babel/helper-optimise-call-expression" "^7.8.3" + "@babel/traverse" "^7.8.6" + "@babel/types" "^7.8.6" + +"@babel/helper-simple-access@^7.8.3": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/helper-simple-access/-/helper-simple-access-7.8.3.tgz#7f8109928b4dab4654076986af575231deb639ae" + integrity sha512-VNGUDjx5cCWg4vvCTR8qQ7YJYZ+HBjxOgXEl7ounz+4Sn7+LMD3CFrCTEU6/qXKbA2nKg21CwhhBzO0RpRbdCw== + dependencies: + "@babel/template" "^7.8.3" + "@babel/types" "^7.8.3" + +"@babel/helper-split-export-declaration@^7.8.3": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.8.3.tgz#31a9f30070f91368a7182cf05f831781065fc7a9" + integrity sha512-3x3yOeyBhW851hroze7ElzdkeRXQYQbFIb7gLK1WQYsw2GWDay5gAJNw1sWJ0VFP6z5J1whqeXH/WCdCjZv6dA== + dependencies: + "@babel/types" "^7.8.3" + +"@babel/helper-validator-identifier@^7.9.5": + version "7.9.5" + resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.9.5.tgz#90977a8e6fbf6b431a7dc31752eee233bf052d80" + integrity sha512-/8arLKUFq882w4tWGj9JYzRpAlZgiWUJ+dtteNTDqrRBz9Iguck9Rn3ykuBDoUwh2TO4tSAJlrxDUOXWklJe4g== + +"@babel/helper-wrap-function@^7.8.3": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/helper-wrap-function/-/helper-wrap-function-7.8.3.tgz#9dbdb2bb55ef14aaa01fe8c99b629bd5352d8610" + integrity sha512-LACJrbUET9cQDzb6kG7EeD7+7doC3JNvUgTEQOx2qaO1fKlzE/Bf05qs9w1oXQMmXlPO65lC3Tq9S6gZpTErEQ== + dependencies: + "@babel/helper-function-name" "^7.8.3" + "@babel/template" "^7.8.3" + "@babel/traverse" "^7.8.3" + "@babel/types" "^7.8.3" + +"@babel/helpers@^7.9.0": + version "7.9.2" + resolved "https://registry.yarnpkg.com/@babel/helpers/-/helpers-7.9.2.tgz#b42a81a811f1e7313b88cba8adc66b3d9ae6c09f" + integrity sha512-JwLvzlXVPjO8eU9c/wF9/zOIN7X6h8DYf7mG4CiFRZRvZNKEF5dQ3H3V+ASkHoIB3mWhatgl5ONhyqHRI6MppA== + dependencies: + "@babel/template" "^7.8.3" + "@babel/traverse" "^7.9.0" + "@babel/types" "^7.9.0" + +"@babel/highlight@^7.8.3": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.8.3.tgz#28f173d04223eaaa59bc1d439a3836e6d1265797" + integrity sha512-PX4y5xQUvy0fnEVHrYOarRPXVWafSjTW9T0Hab8gVIawpl2Sj0ORyrygANq+KjcNlSSTw0YCLSNA8OyZ1I4yEg== dependencies: - "@babel/types" "^7.0.0" + chalk "^2.0.0" + esutils "^2.0.2" + js-tokens "^4.0.0" -"@babel/helper-plugin-utils@^7.0.0": - version "7.0.0" - resolved "https://registry.yarnpkg.com/@babel/helper-plugin-utils/-/helper-plugin-utils-7.0.0.tgz#bbb3fbee98661c569034237cc03967ba99b4f250" - integrity sha512-CYAOUCARwExnEixLdB6sDm2dIJ/YgEAKDM1MOeMeZu9Ld/bDgVo8aiWrXwcY7OBh+1Ea2uUcVRcxKk0GJvW7QA== +"@babel/parser@^7.0.0", "@babel/parser@^7.1.0", "@babel/parser@^7.4.3", "@babel/parser@^7.8.6", "@babel/parser@^7.9.0": + version "7.9.4" + resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.9.4.tgz#68a35e6b0319bbc014465be43828300113f2f2e8" + integrity sha512-bC49otXX6N0/VYhgOMh4gnP26E9xnDZK3TmbNpxYzzz9BQLBosQwfyOe9/cXUU3txYhTzLCbcqd5c8y/OmCjHA== -"@babel/helper-regex@^7.0.0", "@babel/helper-regex@^7.4.4": - version "7.4.4" - resolved "https://registry.yarnpkg.com/@babel/helper-regex/-/helper-regex-7.4.4.tgz#a47e02bc91fb259d2e6727c2a30013e3ac13c4a2" - integrity sha512-Y5nuB/kESmR3tKjU8Nkn1wMGEx1tjJX076HBMeL3XLQCu6vA/YRzuTW0bbb+qRnXvQGn+d6Rx953yffl8vEy7Q== +"@babel/plugin-proposal-async-generator-functions@^7.8.3": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-async-generator-functions/-/plugin-proposal-async-generator-functions-7.8.3.tgz#bad329c670b382589721b27540c7d288601c6e6f" + integrity sha512-NZ9zLv848JsV3hs8ryEh7Uaz/0KsmPLqv0+PdkDJL1cJy0K4kOCFa8zc1E3mp+RHPQcpdfb/6GovEsW4VDrOMw== dependencies: - lodash "^4.17.11" + "@babel/helper-plugin-utils" "^7.8.3" + "@babel/helper-remap-async-to-generator" "^7.8.3" + "@babel/plugin-syntax-async-generators" "^7.8.0" -"@babel/helper-remap-async-to-generator@^7.1.0": - version "7.1.0" - resolved "https://registry.yarnpkg.com/@babel/helper-remap-async-to-generator/-/helper-remap-async-to-generator-7.1.0.tgz#361d80821b6f38da75bd3f0785ece20a88c5fe7f" - integrity sha512-3fOK0L+Fdlg8S5al8u/hWE6vhufGSn0bN09xm2LXMy//REAF8kDCrYoOBKYmA8m5Nom+sV9LyLCwrFynA8/slg== +"@babel/plugin-proposal-class-properties@^7.8.3": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-class-properties/-/plugin-proposal-class-properties-7.8.3.tgz#5e06654af5cd04b608915aada9b2a6788004464e" + integrity sha512-EqFhbo7IosdgPgZggHaNObkmO1kNUe3slaKu54d5OWvy+p9QIKOzK1GAEpAIsZtWVtPXUHSMcT4smvDrCfY4AA== dependencies: - "@babel/helper-annotate-as-pure" "^7.0.0" - "@babel/helper-wrap-function" "^7.1.0" - "@babel/template" "^7.1.0" - "@babel/traverse" "^7.1.0" - "@babel/types" "^7.0.0" + "@babel/helper-create-class-features-plugin" "^7.8.3" + "@babel/helper-plugin-utils" "^7.8.3" -"@babel/helper-replace-supers@^7.1.0", "@babel/helper-replace-supers@^7.4.4": - version "7.4.4" - resolved "https://registry.yarnpkg.com/@babel/helper-replace-supers/-/helper-replace-supers-7.4.4.tgz#aee41783ebe4f2d3ab3ae775e1cc6f1a90cefa27" - integrity sha512-04xGEnd+s01nY1l15EuMS1rfKktNF+1CkKmHoErDppjAAZL+IUBZpzT748x262HF7fibaQPhbvWUl5HeSt1EXg== +"@babel/plugin-proposal-dynamic-import@^7.8.3": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-dynamic-import/-/plugin-proposal-dynamic-import-7.8.3.tgz#38c4fe555744826e97e2ae930b0fb4cc07e66054" + integrity sha512-NyaBbyLFXFLT9FP+zk0kYlUlA8XtCUbehs67F0nnEg7KICgMc2mNkIeu9TYhKzyXMkrapZFwAhXLdnt4IYHy1w== dependencies: - "@babel/helper-member-expression-to-functions" "^7.0.0" - "@babel/helper-optimise-call-expression" "^7.0.0" - "@babel/traverse" "^7.4.4" - "@babel/types" "^7.4.4" + "@babel/helper-plugin-utils" "^7.8.3" + "@babel/plugin-syntax-dynamic-import" "^7.8.0" -"@babel/helper-simple-access@^7.1.0": - version "7.1.0" - resolved "https://registry.yarnpkg.com/@babel/helper-simple-access/-/helper-simple-access-7.1.0.tgz#65eeb954c8c245beaa4e859da6188f39d71e585c" - integrity sha512-Vk+78hNjRbsiu49zAPALxTb+JUQCz1aolpd8osOF16BGnLtseD21nbHgLPGUwrXEurZgiCOUmvs3ExTu4F5x6w== +"@babel/plugin-proposal-export-namespace-from@^7.8.3": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-export-namespace-from/-/plugin-proposal-export-namespace-from-7.8.3.tgz#63ad57265d0e3912afd666eb44ce26fa8cd2c774" + integrity sha512-WKK+9jz6TWUTX1uej9/EUVOmM1sK7aHv6bZyxbUV3NJjbiIZRqJITeXGMo7D631J72PEnIORh5VOlFCSlrLicg== dependencies: - "@babel/template" "^7.1.0" - "@babel/types" "^7.0.0" + "@babel/helper-plugin-utils" "^7.8.3" + "@babel/plugin-syntax-export-namespace-from" "^7.8.3" -"@babel/helper-split-export-declaration@^7.4.4": - version "7.4.4" - resolved "https://registry.yarnpkg.com/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.4.4.tgz#ff94894a340be78f53f06af038b205c49d993677" - integrity sha512-Ro/XkzLf3JFITkW6b+hNxzZ1n5OQ80NvIUdmHspih1XAhtN3vPTuUFT4eQnela+2MaZ5ulH+iyP513KJrxbN7Q== +"@babel/plugin-proposal-json-strings@^7.8.3": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-json-strings/-/plugin-proposal-json-strings-7.8.3.tgz#da5216b238a98b58a1e05d6852104b10f9a70d6b" + integrity sha512-KGhQNZ3TVCQG/MjRbAUwuH+14y9q0tpxs1nWWs3pbSleRdDro9SAMMDyye8HhY1gqZ7/NqIc8SKhya0wRDgP1Q== dependencies: - "@babel/types" "^7.4.4" + "@babel/helper-plugin-utils" "^7.8.3" + "@babel/plugin-syntax-json-strings" "^7.8.0" -"@babel/helper-wrap-function@^7.1.0": - version "7.2.0" - resolved "https://registry.yarnpkg.com/@babel/helper-wrap-function/-/helper-wrap-function-7.2.0.tgz#c4e0012445769e2815b55296ead43a958549f6fa" - integrity sha512-o9fP1BZLLSrYlxYEYyl2aS+Flun5gtjTIG8iln+XuEzQTs0PLagAGSXUcqruJwD5fM48jzIEggCKpIfWTcR7pQ== +"@babel/plugin-proposal-nullish-coalescing-operator@^7.8.3": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-nullish-coalescing-operator/-/plugin-proposal-nullish-coalescing-operator-7.8.3.tgz#e4572253fdeed65cddeecfdab3f928afeb2fd5d2" + integrity sha512-TS9MlfzXpXKt6YYomudb/KU7nQI6/xnapG6in1uZxoxDghuSMZsPb6D2fyUwNYSAp4l1iR7QtFOjkqcRYcUsfw== dependencies: - "@babel/helper-function-name" "^7.1.0" - "@babel/template" "^7.1.0" - "@babel/traverse" "^7.1.0" - "@babel/types" "^7.2.0" + "@babel/helper-plugin-utils" "^7.8.3" + "@babel/plugin-syntax-nullish-coalescing-operator" "^7.8.0" -"@babel/helpers@^7.4.4": - version "7.4.4" - resolved "https://registry.yarnpkg.com/@babel/helpers/-/helpers-7.4.4.tgz#868b0ef59c1dd4e78744562d5ce1b59c89f2f2a5" - integrity sha512-igczbR/0SeuPR8RFfC7tGrbdTbFL3QTvH6D+Z6zNxnTe//GyqmtHmDkzrqDmyZ3eSwPqB/LhyKoU5DXsp+Vp2A== +"@babel/plugin-proposal-numeric-separator@^7.8.3": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-numeric-separator/-/plugin-proposal-numeric-separator-7.8.3.tgz#5d6769409699ec9b3b68684cd8116cedff93bad8" + integrity sha512-jWioO1s6R/R+wEHizfaScNsAx+xKgwTLNXSh7tTC4Usj3ItsPEhYkEpU4h+lpnBwq7NBVOJXfO6cRFYcX69JUQ== dependencies: - "@babel/template" "^7.4.4" - "@babel/traverse" "^7.4.4" - "@babel/types" "^7.4.4" + "@babel/helper-plugin-utils" "^7.8.3" + "@babel/plugin-syntax-numeric-separator" "^7.8.3" -"@babel/highlight@^7.0.0": - version "7.0.0" - resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.0.0.tgz#f710c38c8d458e6dd9a201afb637fcb781ce99e4" - integrity sha512-UFMC4ZeFC48Tpvj7C8UgLvtkaUuovQX+5xNWrsIoMG8o2z+XFKjKaN9iVmS84dPwVN00W4wPmqvYoZF3EGAsfw== +"@babel/plugin-proposal-object-rest-spread@^7.9.5": + version "7.9.5" + resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-object-rest-spread/-/plugin-proposal-object-rest-spread-7.9.5.tgz#3fd65911306d8746014ec0d0cf78f0e39a149116" + integrity sha512-VP2oXvAf7KCYTthbUHwBlewbl1Iq059f6seJGsxMizaCdgHIeczOr7FBqELhSqfkIl04Fi8okzWzl63UKbQmmg== dependencies: - chalk "^2.0.0" - esutils "^2.0.2" - js-tokens "^4.0.0" - -"@babel/parser@^7.0.0", "@babel/parser@^7.1.0", "@babel/parser@^7.4.4", "@babel/parser@^7.4.5": - version "7.4.5" - resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.4.5.tgz#04af8d5d5a2b044a2a1bffacc1e5e6673544e872" - integrity sha512-9mUqkL1FF5T7f0WDFfAoDdiMVPWsdD1gZYzSnaXsxUCUqzuch/8of9G3VUSNiZmMBoRxT3neyVsqeiL/ZPcjew== + "@babel/helper-plugin-utils" "^7.8.3" + "@babel/plugin-syntax-object-rest-spread" "^7.8.0" + "@babel/plugin-transform-parameters" "^7.9.5" -"@babel/plugin-proposal-async-generator-functions@^7.2.0": - version "7.2.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-async-generator-functions/-/plugin-proposal-async-generator-functions-7.2.0.tgz#b289b306669dce4ad20b0252889a15768c9d417e" - integrity sha512-+Dfo/SCQqrwx48ptLVGLdE39YtWRuKc/Y9I5Fy0P1DDBB9lsAHpjcEJQt+4IifuSOSTLBKJObJqMvaO1pIE8LQ== +"@babel/plugin-proposal-optional-catch-binding@^7.8.3": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-optional-catch-binding/-/plugin-proposal-optional-catch-binding-7.8.3.tgz#9dee96ab1650eed88646ae9734ca167ac4a9c5c9" + integrity sha512-0gkX7J7E+AtAw9fcwlVQj8peP61qhdg/89D5swOkjYbkboA2CVckn3kiyum1DE0wskGb7KJJxBdyEBApDLLVdw== dependencies: - "@babel/helper-plugin-utils" "^7.0.0" - "@babel/helper-remap-async-to-generator" "^7.1.0" - "@babel/plugin-syntax-async-generators" "^7.2.0" + "@babel/helper-plugin-utils" "^7.8.3" + "@babel/plugin-syntax-optional-catch-binding" "^7.8.0" -"@babel/plugin-proposal-class-properties@^7.4.4": - version "7.4.4" - resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-class-properties/-/plugin-proposal-class-properties-7.4.4.tgz#93a6486eed86d53452ab9bab35e368e9461198ce" - integrity sha512-WjKTI8g8d5w1Bc9zgwSz2nfrsNQsXcCf9J9cdCvrJV6RF56yztwm4TmJC0MgJ9tvwO9gUA/mcYe89bLdGfiXFg== +"@babel/plugin-proposal-optional-chaining@^7.9.0": + version "7.9.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-optional-chaining/-/plugin-proposal-optional-chaining-7.9.0.tgz#31db16b154c39d6b8a645292472b98394c292a58" + integrity sha512-NDn5tu3tcv4W30jNhmc2hyD5c56G6cXx4TesJubhxrJeCvuuMpttxr0OnNCqbZGhFjLrg+NIhxxC+BK5F6yS3w== dependencies: - "@babel/helper-create-class-features-plugin" "^7.4.4" - "@babel/helper-plugin-utils" "^7.0.0" + "@babel/helper-plugin-utils" "^7.8.3" + "@babel/plugin-syntax-optional-chaining" "^7.8.0" -"@babel/plugin-proposal-export-namespace-from@^7.2.0": - version "7.2.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-export-namespace-from/-/plugin-proposal-export-namespace-from-7.2.0.tgz#308fd4d04ff257fc3e4be090550840eeabad5dd9" - integrity sha512-DZUxbHYxQ5fUFIkMEnh75ogEdBLPfL+mQUqrO2hNY2LGm+tqFnxE924+mhAcCOh/8za8AaZsWHbq6bBoS3TAzA== +"@babel/plugin-proposal-unicode-property-regex@^7.4.4", "@babel/plugin-proposal-unicode-property-regex@^7.8.3": + version "7.8.8" + resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-unicode-property-regex/-/plugin-proposal-unicode-property-regex-7.8.8.tgz#ee3a95e90cdc04fe8cd92ec3279fa017d68a0d1d" + integrity sha512-EVhjVsMpbhLw9ZfHWSx2iy13Q8Z/eg8e8ccVWt23sWQK5l1UdkoLJPN5w69UA4uITGBnEZD2JOe4QOHycYKv8A== dependencies: - "@babel/helper-plugin-utils" "^7.0.0" - "@babel/plugin-syntax-export-namespace-from" "^7.2.0" + "@babel/helper-create-regexp-features-plugin" "^7.8.8" + "@babel/helper-plugin-utils" "^7.8.3" -"@babel/plugin-proposal-json-strings@^7.2.0": - version "7.2.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-json-strings/-/plugin-proposal-json-strings-7.2.0.tgz#568ecc446c6148ae6b267f02551130891e29f317" - integrity sha512-MAFV1CA/YVmYwZG0fBQyXhmj0BHCB5egZHCKWIFVv/XCxAeVGIHfos3SwDck4LvCllENIAg7xMKOG5kH0dzyUg== +"@babel/plugin-syntax-async-generators@^7.8.0": + version "7.8.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-async-generators/-/plugin-syntax-async-generators-7.8.4.tgz#a983fb1aeb2ec3f6ed042a210f640e90e786fe0d" + integrity sha512-tycmZxkGfZaxhMRbXlPXuVFpdWlXpir2W4AMhSJgRKzk/eDlIXOhb2LHWoLpDF7TEHylV5zNhykX6KAgHJmTNw== dependencies: - "@babel/helper-plugin-utils" "^7.0.0" - "@babel/plugin-syntax-json-strings" "^7.2.0" + "@babel/helper-plugin-utils" "^7.8.0" -"@babel/plugin-proposal-numeric-separator@^7.2.0": - version "7.2.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-numeric-separator/-/plugin-proposal-numeric-separator-7.2.0.tgz#646854daf4cd22fd6733f6076013a936310443ac" - integrity sha512-DohMOGDrZiMKS7LthjUZNNcWl8TAf5BZDwZAH4wpm55FuJTHgfqPGdibg7rZDmont/8Yg0zA03IgT6XLeP+4sg== +"@babel/plugin-syntax-dynamic-import@^7.8.0": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-dynamic-import/-/plugin-syntax-dynamic-import-7.8.3.tgz#62bf98b2da3cd21d626154fc96ee5b3cb68eacb3" + integrity sha512-5gdGbFon+PszYzqs83S3E5mpi7/y/8M9eC90MRTZfduQOYW76ig6SOSPNe41IG5LoP3FGBn2N0RjVDSQiS94kQ== dependencies: - "@babel/helper-plugin-utils" "^7.0.0" - "@babel/plugin-syntax-numeric-separator" "^7.2.0" + "@babel/helper-plugin-utils" "^7.8.0" -"@babel/plugin-proposal-object-rest-spread@^7.4.4": - version "7.4.4" - resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-object-rest-spread/-/plugin-proposal-object-rest-spread-7.4.4.tgz#1ef173fcf24b3e2df92a678f027673b55e7e3005" - integrity sha512-dMBG6cSPBbHeEBdFXeQ2QLc5gUpg4Vkaz8octD4aoW/ISO+jBOcsuxYL7bsb5WSu8RLP6boxrBIALEHgoHtO9g== +"@babel/plugin-syntax-export-namespace-from@^7.8.3": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-export-namespace-from/-/plugin-syntax-export-namespace-from-7.8.3.tgz#028964a9ba80dbc094c915c487ad7c4e7a66465a" + integrity sha512-MXf5laXo6c1IbEbegDmzGPwGNTsHZmEy6QGznu5Sh2UCWvueywb2ee+CCE4zQiZstxU9BMoQO9i6zUFSY0Kj0Q== dependencies: - "@babel/helper-plugin-utils" "^7.0.0" - "@babel/plugin-syntax-object-rest-spread" "^7.2.0" + "@babel/helper-plugin-utils" "^7.8.3" -"@babel/plugin-proposal-optional-catch-binding@^7.2.0": - version "7.2.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-optional-catch-binding/-/plugin-proposal-optional-catch-binding-7.2.0.tgz#135d81edb68a081e55e56ec48541ece8065c38f5" - integrity sha512-mgYj3jCcxug6KUcX4OBoOJz3CMrwRfQELPQ5560F70YQUBZB7uac9fqaWamKR1iWUzGiK2t0ygzjTScZnVz75g== +"@babel/plugin-syntax-flow@^7.8.3": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-flow/-/plugin-syntax-flow-7.8.3.tgz#f2c883bd61a6316f2c89380ae5122f923ba4527f" + integrity sha512-innAx3bUbA0KSYj2E2MNFSn9hiCeowOFLxlsuhXzw8hMQnzkDomUr9QCD7E9VF60NmnG1sNTuuv6Qf4f8INYsg== dependencies: - "@babel/helper-plugin-utils" "^7.0.0" - "@babel/plugin-syntax-optional-catch-binding" "^7.2.0" + "@babel/helper-plugin-utils" "^7.8.3" -"@babel/plugin-proposal-unicode-property-regex@^7.4.4": - version "7.4.4" - resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-unicode-property-regex/-/plugin-proposal-unicode-property-regex-7.4.4.tgz#501ffd9826c0b91da22690720722ac7cb1ca9c78" - integrity sha512-j1NwnOqMG9mFUOH58JTFsA/+ZYzQLUZ/drqWUqxCYLGeu2JFZL8YrNC9hBxKmWtAuOCHPcRpgv7fhap09Fb4kA== +"@babel/plugin-syntax-json-strings@^7.8.0": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-json-strings/-/plugin-syntax-json-strings-7.8.3.tgz#01ca21b668cd8218c9e640cb6dd88c5412b2c96a" + integrity sha512-lY6kdGpWHvjoe2vk4WrAapEuBR69EMxZl+RoGRhrFGNYVK8mOPAW8VfbT/ZgrFbXlDNiiaxQnAtgVCZ6jv30EA== dependencies: - "@babel/helper-plugin-utils" "^7.0.0" - "@babel/helper-regex" "^7.4.4" - regexpu-core "^4.5.4" + "@babel/helper-plugin-utils" "^7.8.0" -"@babel/plugin-syntax-async-generators@^7.2.0": - version "7.2.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-async-generators/-/plugin-syntax-async-generators-7.2.0.tgz#69e1f0db34c6f5a0cf7e2b3323bf159a76c8cb7f" - integrity sha512-1ZrIRBv2t0GSlcwVoQ6VgSLpLgiN/FVQUzt9znxo7v2Ov4jJrs8RY8tv0wvDmFN3qIdMKWrmMMW6yZ0G19MfGg== +"@babel/plugin-syntax-nullish-coalescing-operator@^7.8.0": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-nullish-coalescing-operator/-/plugin-syntax-nullish-coalescing-operator-7.8.3.tgz#167ed70368886081f74b5c36c65a88c03b66d1a9" + integrity sha512-aSff4zPII1u2QD7y+F8oDsz19ew4IGEJg9SVW+bqwpwtfFleiQDMdzA/R+UlWDzfnHFCxxleFT0PMIrR36XLNQ== dependencies: - "@babel/helper-plugin-utils" "^7.0.0" + "@babel/helper-plugin-utils" "^7.8.0" -"@babel/plugin-syntax-export-namespace-from@^7.2.0": - version "7.2.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-export-namespace-from/-/plugin-syntax-export-namespace-from-7.2.0.tgz#8d257838c6b3b779db52c0224443459bd27fb039" - integrity sha512-1zGA3UNch6A+A11nIzBVEaE3DDJbjfB+eLIcf0GGOh/BJr/8NxL3546MGhV/r0RhH4xADFIEso39TKCfEMlsGA== +"@babel/plugin-syntax-numeric-separator@^7.8.0", "@babel/plugin-syntax-numeric-separator@^7.8.3": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-numeric-separator/-/plugin-syntax-numeric-separator-7.8.3.tgz#0e3fb63e09bea1b11e96467271c8308007e7c41f" + integrity sha512-H7dCMAdN83PcCmqmkHB5dtp+Xa9a6LKSvA2hiFBC/5alSHxM5VgWZXFqDi0YFe8XNGT6iCa+z4V4zSt/PdZ7Dw== dependencies: - "@babel/helper-plugin-utils" "^7.0.0" + "@babel/helper-plugin-utils" "^7.8.3" -"@babel/plugin-syntax-flow@^7.2.0": - version "7.2.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-flow/-/plugin-syntax-flow-7.2.0.tgz#a765f061f803bc48f240c26f8747faf97c26bf7c" - integrity sha512-r6YMuZDWLtLlu0kqIim5o/3TNRAlWb073HwT3e2nKf9I8IIvOggPrnILYPsrrKilmn/mYEMCf/Z07w3yQJF6dg== +"@babel/plugin-syntax-object-rest-spread@^7.0.0", "@babel/plugin-syntax-object-rest-spread@^7.8.0": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-object-rest-spread/-/plugin-syntax-object-rest-spread-7.8.3.tgz#60e225edcbd98a640332a2e72dd3e66f1af55871" + integrity sha512-XoqMijGZb9y3y2XskN+P1wUGiVwWZ5JmoDRwx5+3GmEplNyVM2s2Dg8ILFQm8rWM48orGy5YpI5Bl8U1y7ydlA== dependencies: - "@babel/helper-plugin-utils" "^7.0.0" + "@babel/helper-plugin-utils" "^7.8.0" -"@babel/plugin-syntax-json-strings@^7.2.0": - version "7.2.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-json-strings/-/plugin-syntax-json-strings-7.2.0.tgz#72bd13f6ffe1d25938129d2a186b11fd62951470" - integrity sha512-5UGYnMSLRE1dqqZwug+1LISpA403HzlSfsg6P9VXU6TBjcSHeNlw4DxDx7LgpF+iKZoOG/+uzqoRHTdcUpiZNg== - dependencies: - "@babel/helper-plugin-utils" "^7.0.0" - -"@babel/plugin-syntax-numeric-separator@^7.2.0": - version "7.2.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-numeric-separator/-/plugin-syntax-numeric-separator-7.2.0.tgz#7470fe070c2944469a756752a69a6963135018be" - integrity sha512-DroeVNkO/BnGpL2R7+ZNZqW+E24aR/4YWxP3Qb15d6lPU8KDzF8HlIUIRCOJRn4X77/oyW4mJY+7FHfY82NLtQ== +"@babel/plugin-syntax-optional-catch-binding@^7.8.0": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-optional-catch-binding/-/plugin-syntax-optional-catch-binding-7.8.3.tgz#6111a265bcfb020eb9efd0fdfd7d26402b9ed6c1" + integrity sha512-6VPD0Pc1lpTqw0aKoeRTMiB+kWhAoT24PA+ksWSBrFtl5SIRVpZlwN3NNPQjehA2E/91FV3RjLWoVTglWcSV3Q== dependencies: - "@babel/helper-plugin-utils" "^7.0.0" + "@babel/helper-plugin-utils" "^7.8.0" -"@babel/plugin-syntax-object-rest-spread@^7.0.0", "@babel/plugin-syntax-object-rest-spread@^7.2.0": - version "7.2.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-object-rest-spread/-/plugin-syntax-object-rest-spread-7.2.0.tgz#3b7a3e733510c57e820b9142a6579ac8b0dfad2e" - integrity sha512-t0JKGgqk2We+9may3t0xDdmneaXmyxq0xieYcKHxIsrJO64n1OiMWNUtc5gQK1PA0NpdCRrtZp4z+IUaKugrSA== +"@babel/plugin-syntax-optional-chaining@^7.8.0": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-optional-chaining/-/plugin-syntax-optional-chaining-7.8.3.tgz#4f69c2ab95167e0180cd5336613f8c5788f7d48a" + integrity sha512-KoK9ErH1MBlCPxV0VANkXW2/dw4vlbGDrFgz8bmUsBGYkFRcbRwMh6cIJubdPrkxRwuGdtCk0v/wPTKbQgBjkg== dependencies: - "@babel/helper-plugin-utils" "^7.0.0" + "@babel/helper-plugin-utils" "^7.8.0" -"@babel/plugin-syntax-optional-catch-binding@^7.2.0": - version "7.2.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-optional-catch-binding/-/plugin-syntax-optional-catch-binding-7.2.0.tgz#a94013d6eda8908dfe6a477e7f9eda85656ecf5c" - integrity sha512-bDe4xKNhb0LI7IvZHiA13kff0KEfaGX/Hv4lMA9+7TEc63hMNvfKo6ZFpXhKuEp+II/q35Gc4NoMeDZyaUbj9w== +"@babel/plugin-syntax-top-level-await@^7.8.3": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-top-level-await/-/plugin-syntax-top-level-await-7.8.3.tgz#3acdece695e6b13aaf57fc291d1a800950c71391" + integrity sha512-kwj1j9lL/6Wd0hROD3b/OZZ7MSrZLqqn9RAZ5+cYYsflQ9HZBIKCUkr3+uL1MEJ1NePiUbf98jjiMQSv0NMR9g== dependencies: - "@babel/helper-plugin-utils" "^7.0.0" + "@babel/helper-plugin-utils" "^7.8.3" -"@babel/plugin-transform-arrow-functions@^7.2.0": - version "7.2.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-arrow-functions/-/plugin-transform-arrow-functions-7.2.0.tgz#9aeafbe4d6ffc6563bf8f8372091628f00779550" - integrity sha512-ER77Cax1+8/8jCB9fo4Ud161OZzWN5qawi4GusDuRLcDbDG+bIGYY20zb2dfAFdTRGzrfq2xZPvF0R64EHnimg== +"@babel/plugin-transform-arrow-functions@^7.8.3": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-arrow-functions/-/plugin-transform-arrow-functions-7.8.3.tgz#82776c2ed0cd9e1a49956daeb896024c9473b8b6" + integrity sha512-0MRF+KC8EqH4dbuITCWwPSzsyO3HIWWlm30v8BbbpOrS1B++isGxPnnuq/IZvOX5J2D/p7DQalQm+/2PnlKGxg== dependencies: - "@babel/helper-plugin-utils" "^7.0.0" + "@babel/helper-plugin-utils" "^7.8.3" -"@babel/plugin-transform-async-to-generator@^7.4.4": - version "7.4.4" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-async-to-generator/-/plugin-transform-async-to-generator-7.4.4.tgz#a3f1d01f2f21cadab20b33a82133116f14fb5894" - integrity sha512-YiqW2Li8TXmzgbXw+STsSqPBPFnGviiaSp6CYOq55X8GQ2SGVLrXB6pNid8HkqkZAzOH6knbai3snhP7v0fNwA== +"@babel/plugin-transform-async-to-generator@^7.8.3": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-async-to-generator/-/plugin-transform-async-to-generator-7.8.3.tgz#4308fad0d9409d71eafb9b1a6ee35f9d64b64086" + integrity sha512-imt9tFLD9ogt56Dd5CI/6XgpukMwd/fLGSrix2httihVe7LOGVPhyhMh1BU5kDM7iHD08i8uUtmV2sWaBFlHVQ== dependencies: - "@babel/helper-module-imports" "^7.0.0" - "@babel/helper-plugin-utils" "^7.0.0" - "@babel/helper-remap-async-to-generator" "^7.1.0" + "@babel/helper-module-imports" "^7.8.3" + "@babel/helper-plugin-utils" "^7.8.3" + "@babel/helper-remap-async-to-generator" "^7.8.3" -"@babel/plugin-transform-block-scoped-functions@^7.2.0": - version "7.2.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-block-scoped-functions/-/plugin-transform-block-scoped-functions-7.2.0.tgz#5d3cc11e8d5ddd752aa64c9148d0db6cb79fd190" - integrity sha512-ntQPR6q1/NKuphly49+QiQiTN0O63uOwjdD6dhIjSWBI5xlrbUFh720TIpzBhpnrLfv2tNH/BXvLIab1+BAI0w== +"@babel/plugin-transform-block-scoped-functions@^7.8.3": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-block-scoped-functions/-/plugin-transform-block-scoped-functions-7.8.3.tgz#437eec5b799b5852072084b3ae5ef66e8349e8a3" + integrity sha512-vo4F2OewqjbB1+yaJ7k2EJFHlTP3jR634Z9Cj9itpqNjuLXvhlVxgnjsHsdRgASR8xYDrx6onw4vW5H6We0Jmg== dependencies: - "@babel/helper-plugin-utils" "^7.0.0" + "@babel/helper-plugin-utils" "^7.8.3" -"@babel/plugin-transform-block-scoping@^7.4.4": - version "7.4.4" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-block-scoping/-/plugin-transform-block-scoping-7.4.4.tgz#c13279fabf6b916661531841a23c4b7dae29646d" - integrity sha512-jkTUyWZcTrwxu5DD4rWz6rDB5Cjdmgz6z7M7RLXOJyCUkFBawssDGcGh8M/0FTSB87avyJI1HsTwUXp9nKA1PA== +"@babel/plugin-transform-block-scoping@^7.8.3": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-block-scoping/-/plugin-transform-block-scoping-7.8.3.tgz#97d35dab66857a437c166358b91d09050c868f3a" + integrity sha512-pGnYfm7RNRgYRi7bids5bHluENHqJhrV4bCZRwc5GamaWIIs07N4rZECcmJL6ZClwjDz1GbdMZFtPs27hTB06w== dependencies: - "@babel/helper-plugin-utils" "^7.0.0" - lodash "^4.17.11" + "@babel/helper-plugin-utils" "^7.8.3" + lodash "^4.17.13" -"@babel/plugin-transform-classes@^7.4.4": - version "7.4.4" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-classes/-/plugin-transform-classes-7.4.4.tgz#0ce4094cdafd709721076d3b9c38ad31ca715eb6" - integrity sha512-/e44eFLImEGIpL9qPxSRat13I5QNRgBLu2hOQJCF7VLy/otSM/sypV1+XaIw5+502RX/+6YaSAPmldk+nhHDPw== +"@babel/plugin-transform-classes@^7.9.5": + version "7.9.5" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-classes/-/plugin-transform-classes-7.9.5.tgz#800597ddb8aefc2c293ed27459c1fcc935a26c2c" + integrity sha512-x2kZoIuLC//O5iA7PEvecB105o7TLzZo8ofBVhP79N+DO3jaX+KYfww9TQcfBEZD0nikNyYcGB1IKtRq36rdmg== dependencies: - "@babel/helper-annotate-as-pure" "^7.0.0" - "@babel/helper-define-map" "^7.4.4" - "@babel/helper-function-name" "^7.1.0" - "@babel/helper-optimise-call-expression" "^7.0.0" - "@babel/helper-plugin-utils" "^7.0.0" - "@babel/helper-replace-supers" "^7.4.4" - "@babel/helper-split-export-declaration" "^7.4.4" + "@babel/helper-annotate-as-pure" "^7.8.3" + "@babel/helper-define-map" "^7.8.3" + "@babel/helper-function-name" "^7.9.5" + "@babel/helper-optimise-call-expression" "^7.8.3" + "@babel/helper-plugin-utils" "^7.8.3" + "@babel/helper-replace-supers" "^7.8.6" + "@babel/helper-split-export-declaration" "^7.8.3" globals "^11.1.0" -"@babel/plugin-transform-computed-properties@^7.2.0": - version "7.2.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-computed-properties/-/plugin-transform-computed-properties-7.2.0.tgz#83a7df6a658865b1c8f641d510c6f3af220216da" - integrity sha512-kP/drqTxY6Xt3NNpKiMomfgkNn4o7+vKxK2DDKcBG9sHj51vHqMBGy8wbDS/J4lMxnqs153/T3+DmCEAkC5cpA== +"@babel/plugin-transform-computed-properties@^7.8.3": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-computed-properties/-/plugin-transform-computed-properties-7.8.3.tgz#96d0d28b7f7ce4eb5b120bb2e0e943343c86f81b" + integrity sha512-O5hiIpSyOGdrQZRQ2ccwtTVkgUDBBiCuK//4RJ6UfePllUTCENOzKxfh6ulckXKc0DixTFLCfb2HVkNA7aDpzA== dependencies: - "@babel/helper-plugin-utils" "^7.0.0" + "@babel/helper-plugin-utils" "^7.8.3" -"@babel/plugin-transform-destructuring@^7.4.4": - version "7.4.4" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-destructuring/-/plugin-transform-destructuring-7.4.4.tgz#9d964717829cc9e4b601fc82a26a71a4d8faf20f" - integrity sha512-/aOx+nW0w8eHiEHm+BTERB2oJn5D127iye/SUQl7NjHy0lf+j7h4MKMMSOwdazGq9OxgiNADncE+SRJkCxjZpQ== +"@babel/plugin-transform-destructuring@^7.9.5": + version "7.9.5" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-destructuring/-/plugin-transform-destructuring-7.9.5.tgz#72c97cf5f38604aea3abf3b935b0e17b1db76a50" + integrity sha512-j3OEsGel8nHL/iusv/mRd5fYZ3DrOxWC82x0ogmdN/vHfAP4MYw+AFKYanzWlktNwikKvlzUV//afBW5FTp17Q== dependencies: - "@babel/helper-plugin-utils" "^7.0.0" + "@babel/helper-plugin-utils" "^7.8.3" -"@babel/plugin-transform-dotall-regex@^7.4.4": - version "7.4.4" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-dotall-regex/-/plugin-transform-dotall-regex-7.4.4.tgz#361a148bc951444312c69446d76ed1ea8e4450c3" - integrity sha512-P05YEhRc2h53lZDjRPk/OektxCVevFzZs2Gfjd545Wde3k+yFDbXORgl2e0xpbq8mLcKJ7Idss4fAg0zORN/zg== +"@babel/plugin-transform-dotall-regex@^7.4.4", "@babel/plugin-transform-dotall-regex@^7.8.3": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-dotall-regex/-/plugin-transform-dotall-regex-7.8.3.tgz#c3c6ec5ee6125c6993c5cbca20dc8621a9ea7a6e" + integrity sha512-kLs1j9Nn4MQoBYdRXH6AeaXMbEJFaFu/v1nQkvib6QzTj8MZI5OQzqmD83/2jEM1z0DLilra5aWO5YpyC0ALIw== dependencies: - "@babel/helper-plugin-utils" "^7.0.0" - "@babel/helper-regex" "^7.4.4" - regexpu-core "^4.5.4" + "@babel/helper-create-regexp-features-plugin" "^7.8.3" + "@babel/helper-plugin-utils" "^7.8.3" -"@babel/plugin-transform-duplicate-keys@^7.2.0": - version "7.2.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-duplicate-keys/-/plugin-transform-duplicate-keys-7.2.0.tgz#d952c4930f312a4dbfff18f0b2914e60c35530b3" - integrity sha512-q+yuxW4DsTjNceUiTzK0L+AfQ0zD9rWaTLiUqHA8p0gxx7lu1EylenfzjeIWNkPy6e/0VG/Wjw9uf9LueQwLOw== +"@babel/plugin-transform-duplicate-keys@^7.8.3": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-duplicate-keys/-/plugin-transform-duplicate-keys-7.8.3.tgz#8d12df309aa537f272899c565ea1768e286e21f1" + integrity sha512-s8dHiBUbcbSgipS4SMFuWGqCvyge5V2ZeAWzR6INTVC3Ltjig/Vw1G2Gztv0vU/hRG9X8IvKvYdoksnUfgXOEQ== dependencies: - "@babel/helper-plugin-utils" "^7.0.0" + "@babel/helper-plugin-utils" "^7.8.3" -"@babel/plugin-transform-exponentiation-operator@^7.2.0": - version "7.2.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-exponentiation-operator/-/plugin-transform-exponentiation-operator-7.2.0.tgz#a63868289e5b4007f7054d46491af51435766008" - integrity sha512-umh4hR6N7mu4Elq9GG8TOu9M0bakvlsREEC+ialrQN6ABS4oDQ69qJv1VtR3uxlKMCQMCvzk7vr17RHKcjx68A== +"@babel/plugin-transform-exponentiation-operator@^7.8.3": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-exponentiation-operator/-/plugin-transform-exponentiation-operator-7.8.3.tgz#581a6d7f56970e06bf51560cd64f5e947b70d7b7" + integrity sha512-zwIpuIymb3ACcInbksHaNcR12S++0MDLKkiqXHl3AzpgdKlFNhog+z/K0+TGW+b0w5pgTq4H6IwV/WhxbGYSjQ== dependencies: - "@babel/helper-builder-binary-assignment-operator-visitor" "^7.1.0" - "@babel/helper-plugin-utils" "^7.0.0" + "@babel/helper-builder-binary-assignment-operator-visitor" "^7.8.3" + "@babel/helper-plugin-utils" "^7.8.3" -"@babel/plugin-transform-flow-strip-types@^7.0.0": - version "7.4.4" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-flow-strip-types/-/plugin-transform-flow-strip-types-7.4.4.tgz#d267a081f49a8705fc9146de0768c6b58dccd8f7" - integrity sha512-WyVedfeEIILYEaWGAUWzVNyqG4sfsNooMhXWsu/YzOvVGcsnPb5PguysjJqI3t3qiaYj0BR8T2f5njdjTGe44Q== +"@babel/plugin-transform-flow-strip-types@^7.9.0": + version "7.9.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-flow-strip-types/-/plugin-transform-flow-strip-types-7.9.0.tgz#8a3538aa40434e000b8f44a3c5c9ac7229bd2392" + integrity sha512-7Qfg0lKQhEHs93FChxVLAvhBshOPQDtJUTVHr/ZwQNRccCm4O9D79r9tVSoV8iNwjP1YgfD+e/fgHcPkN1qEQg== dependencies: - "@babel/helper-plugin-utils" "^7.0.0" - "@babel/plugin-syntax-flow" "^7.2.0" + "@babel/helper-plugin-utils" "^7.8.3" + "@babel/plugin-syntax-flow" "^7.8.3" -"@babel/plugin-transform-for-of@^7.4.4": - version "7.4.4" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-for-of/-/plugin-transform-for-of-7.4.4.tgz#0267fc735e24c808ba173866c6c4d1440fc3c556" - integrity sha512-9T/5Dlr14Z9TIEXLXkt8T1DU7F24cbhwhMNUziN3hB1AXoZcdzPcTiKGRn/6iOymDqtTKWnr/BtRKN9JwbKtdQ== +"@babel/plugin-transform-for-of@^7.9.0": + version "7.9.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-for-of/-/plugin-transform-for-of-7.9.0.tgz#0f260e27d3e29cd1bb3128da5e76c761aa6c108e" + integrity sha512-lTAnWOpMwOXpyDx06N+ywmF3jNbafZEqZ96CGYabxHrxNX8l5ny7dt4bK/rGwAh9utyP2b2Hv7PlZh1AAS54FQ== dependencies: - "@babel/helper-plugin-utils" "^7.0.0" + "@babel/helper-plugin-utils" "^7.8.3" -"@babel/plugin-transform-function-name@^7.4.4": - version "7.4.4" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-function-name/-/plugin-transform-function-name-7.4.4.tgz#e1436116abb0610c2259094848754ac5230922ad" - integrity sha512-iU9pv7U+2jC9ANQkKeNF6DrPy4GBa4NWQtl6dHB4Pb3izX2JOEvDTFarlNsBj/63ZEzNNIAMs3Qw4fNCcSOXJA== +"@babel/plugin-transform-function-name@^7.8.3": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-function-name/-/plugin-transform-function-name-7.8.3.tgz#279373cb27322aaad67c2683e776dfc47196ed8b" + integrity sha512-rO/OnDS78Eifbjn5Py9v8y0aR+aSYhDhqAwVfsTl0ERuMZyr05L1aFSCJnbv2mmsLkit/4ReeQ9N2BgLnOcPCQ== dependencies: - "@babel/helper-function-name" "^7.1.0" - "@babel/helper-plugin-utils" "^7.0.0" + "@babel/helper-function-name" "^7.8.3" + "@babel/helper-plugin-utils" "^7.8.3" -"@babel/plugin-transform-literals@^7.2.0": - version "7.2.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-literals/-/plugin-transform-literals-7.2.0.tgz#690353e81f9267dad4fd8cfd77eafa86aba53ea1" - integrity sha512-2ThDhm4lI4oV7fVQ6pNNK+sx+c/GM5/SaML0w/r4ZB7sAneD/piDJtwdKlNckXeyGK7wlwg2E2w33C/Hh+VFCg== +"@babel/plugin-transform-literals@^7.8.3": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-literals/-/plugin-transform-literals-7.8.3.tgz#aef239823d91994ec7b68e55193525d76dbd5dc1" + integrity sha512-3Tqf8JJ/qB7TeldGl+TT55+uQei9JfYaregDcEAyBZ7akutriFrt6C/wLYIer6OYhleVQvH/ntEhjE/xMmy10A== dependencies: - "@babel/helper-plugin-utils" "^7.0.0" + "@babel/helper-plugin-utils" "^7.8.3" -"@babel/plugin-transform-member-expression-literals@^7.2.0": - version "7.2.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-member-expression-literals/-/plugin-transform-member-expression-literals-7.2.0.tgz#fa10aa5c58a2cb6afcf2c9ffa8cb4d8b3d489a2d" - integrity sha512-HiU3zKkSU6scTidmnFJ0bMX8hz5ixC93b4MHMiYebmk2lUVNGOboPsqQvx5LzooihijUoLR/v7Nc1rbBtnc7FA== +"@babel/plugin-transform-member-expression-literals@^7.8.3": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-member-expression-literals/-/plugin-transform-member-expression-literals-7.8.3.tgz#963fed4b620ac7cbf6029c755424029fa3a40410" + integrity sha512-3Wk2EXhnw+rP+IDkK6BdtPKsUE5IeZ6QOGrPYvw52NwBStw9V1ZVzxgK6fSKSxqUvH9eQPR3tm3cOq79HlsKYA== dependencies: - "@babel/helper-plugin-utils" "^7.0.0" + "@babel/helper-plugin-utils" "^7.8.3" -"@babel/plugin-transform-modules-amd@^7.2.0": - version "7.2.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-amd/-/plugin-transform-modules-amd-7.2.0.tgz#82a9bce45b95441f617a24011dc89d12da7f4ee6" - integrity sha512-mK2A8ucqz1qhrdqjS9VMIDfIvvT2thrEsIQzbaTdc5QFzhDjQv2CkJJ5f6BXIkgbmaoax3zBr2RyvV/8zeoUZw== +"@babel/plugin-transform-modules-amd@^7.9.0": + version "7.9.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-amd/-/plugin-transform-modules-amd-7.9.0.tgz#19755ee721912cf5bb04c07d50280af3484efef4" + integrity sha512-vZgDDF003B14O8zJy0XXLnPH4sg+9X5hFBBGN1V+B2rgrB+J2xIypSN6Rk9imB2hSTHQi5OHLrFWsZab1GMk+Q== dependencies: - "@babel/helper-module-transforms" "^7.1.0" - "@babel/helper-plugin-utils" "^7.0.0" + "@babel/helper-module-transforms" "^7.9.0" + "@babel/helper-plugin-utils" "^7.8.3" + babel-plugin-dynamic-import-node "^2.3.0" -"@babel/plugin-transform-modules-commonjs@^7.4.4": - version "7.4.4" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.4.4.tgz#0bef4713d30f1d78c2e59b3d6db40e60192cac1e" - integrity sha512-4sfBOJt58sEo9a2BQXnZq+Q3ZTSAUXyK3E30o36BOGnJ+tvJ6YSxF0PG6kERvbeISgProodWuI9UVG3/FMY6iw== +"@babel/plugin-transform-modules-commonjs@^7.9.0": + version "7.9.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.9.0.tgz#e3e72f4cbc9b4a260e30be0ea59bdf5a39748940" + integrity sha512-qzlCrLnKqio4SlgJ6FMMLBe4bySNis8DFn1VkGmOcxG9gqEyPIOzeQrA//u0HAKrWpJlpZbZMPB1n/OPa4+n8g== dependencies: - "@babel/helper-module-transforms" "^7.4.4" - "@babel/helper-plugin-utils" "^7.0.0" - "@babel/helper-simple-access" "^7.1.0" + "@babel/helper-module-transforms" "^7.9.0" + "@babel/helper-plugin-utils" "^7.8.3" + "@babel/helper-simple-access" "^7.8.3" + babel-plugin-dynamic-import-node "^2.3.0" -"@babel/plugin-transform-modules-systemjs@^7.4.4": - version "7.4.4" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-systemjs/-/plugin-transform-modules-systemjs-7.4.4.tgz#dc83c5665b07d6c2a7b224c00ac63659ea36a405" - integrity sha512-MSiModfILQc3/oqnG7NrP1jHaSPryO6tA2kOMmAQApz5dayPxWiHqmq4sWH2xF5LcQK56LlbKByCd8Aah/OIkQ== +"@babel/plugin-transform-modules-systemjs@^7.9.0": + version "7.9.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-systemjs/-/plugin-transform-modules-systemjs-7.9.0.tgz#e9fd46a296fc91e009b64e07ddaa86d6f0edeb90" + integrity sha512-FsiAv/nao/ud2ZWy4wFacoLOm5uxl0ExSQ7ErvP7jpoihLR6Cq90ilOFyX9UXct3rbtKsAiZ9kFt5XGfPe/5SQ== dependencies: - "@babel/helper-hoist-variables" "^7.4.4" - "@babel/helper-plugin-utils" "^7.0.0" + "@babel/helper-hoist-variables" "^7.8.3" + "@babel/helper-module-transforms" "^7.9.0" + "@babel/helper-plugin-utils" "^7.8.3" + babel-plugin-dynamic-import-node "^2.3.0" -"@babel/plugin-transform-modules-umd@^7.2.0": - version "7.2.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-umd/-/plugin-transform-modules-umd-7.2.0.tgz#7678ce75169f0877b8eb2235538c074268dd01ae" - integrity sha512-BV3bw6MyUH1iIsGhXlOK6sXhmSarZjtJ/vMiD9dNmpY8QXFFQTj+6v92pcfy1iqa8DeAfJFwoxcrS/TUZda6sw== +"@babel/plugin-transform-modules-umd@^7.9.0": + version "7.9.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-umd/-/plugin-transform-modules-umd-7.9.0.tgz#e909acae276fec280f9b821a5f38e1f08b480697" + integrity sha512-uTWkXkIVtg/JGRSIABdBoMsoIeoHQHPTL0Y2E7xf5Oj7sLqwVsNXOkNk0VJc7vF0IMBsPeikHxFjGe+qmwPtTQ== dependencies: - "@babel/helper-module-transforms" "^7.1.0" - "@babel/helper-plugin-utils" "^7.0.0" + "@babel/helper-module-transforms" "^7.9.0" + "@babel/helper-plugin-utils" "^7.8.3" -"@babel/plugin-transform-named-capturing-groups-regex@^7.4.5": - version "7.4.5" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-named-capturing-groups-regex/-/plugin-transform-named-capturing-groups-regex-7.4.5.tgz#9d269fd28a370258199b4294736813a60bbdd106" - integrity sha512-z7+2IsWafTBbjNsOxU/Iv5CvTJlr5w4+HGu1HovKYTtgJ362f7kBcQglkfmlspKKZ3bgrbSGvLfNx++ZJgCWsg== +"@babel/plugin-transform-named-capturing-groups-regex@^7.8.3": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-named-capturing-groups-regex/-/plugin-transform-named-capturing-groups-regex-7.8.3.tgz#a2a72bffa202ac0e2d0506afd0939c5ecbc48c6c" + integrity sha512-f+tF/8UVPU86TrCb06JoPWIdDpTNSGGcAtaD9mLP0aYGA0OS0j7j7DHJR0GTFrUZPUU6loZhbsVZgTh0N+Qdnw== dependencies: - regexp-tree "^0.1.6" + "@babel/helper-create-regexp-features-plugin" "^7.8.3" -"@babel/plugin-transform-new-target@^7.4.4": - version "7.4.4" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-new-target/-/plugin-transform-new-target-7.4.4.tgz#18d120438b0cc9ee95a47f2c72bc9768fbed60a5" - integrity sha512-r1z3T2DNGQwwe2vPGZMBNjioT2scgWzK9BCnDEh+46z8EEwXBq24uRzd65I7pjtugzPSj921aM15RpESgzsSuA== +"@babel/plugin-transform-new-target@^7.8.3": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-new-target/-/plugin-transform-new-target-7.8.3.tgz#60cc2ae66d85c95ab540eb34babb6434d4c70c43" + integrity sha512-QuSGysibQpyxexRyui2vca+Cmbljo8bcRckgzYV4kRIsHpVeyeC3JDO63pY+xFZ6bWOBn7pfKZTqV4o/ix9sFw== dependencies: - "@babel/helper-plugin-utils" "^7.0.0" + "@babel/helper-plugin-utils" "^7.8.3" -"@babel/plugin-transform-object-super@^7.2.0": - version "7.2.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-object-super/-/plugin-transform-object-super-7.2.0.tgz#b35d4c10f56bab5d650047dad0f1d8e8814b6598" - integrity sha512-VMyhPYZISFZAqAPVkiYb7dUe2AsVi2/wCT5+wZdsNO31FojQJa9ns40hzZ6U9f50Jlq4w6qwzdBB2uwqZ00ebg== +"@babel/plugin-transform-object-super@^7.8.3": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-object-super/-/plugin-transform-object-super-7.8.3.tgz#ebb6a1e7a86ffa96858bd6ac0102d65944261725" + integrity sha512-57FXk+gItG/GejofIyLIgBKTas4+pEU47IXKDBWFTxdPd7F80H8zybyAY7UoblVfBhBGs2EKM+bJUu2+iUYPDQ== dependencies: - "@babel/helper-plugin-utils" "^7.0.0" - "@babel/helper-replace-supers" "^7.1.0" + "@babel/helper-plugin-utils" "^7.8.3" + "@babel/helper-replace-supers" "^7.8.3" -"@babel/plugin-transform-parameters@^7.4.4": - version "7.4.4" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-parameters/-/plugin-transform-parameters-7.4.4.tgz#7556cf03f318bd2719fe4c922d2d808be5571e16" - integrity sha512-oMh5DUO1V63nZcu/ZVLQFqiihBGo4OpxJxR1otF50GMeCLiRx5nUdtokd+u9SuVJrvvuIh9OosRFPP4pIPnwmw== +"@babel/plugin-transform-parameters@^7.9.5": + version "7.9.5" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-parameters/-/plugin-transform-parameters-7.9.5.tgz#173b265746f5e15b2afe527eeda65b73623a0795" + integrity sha512-0+1FhHnMfj6lIIhVvS4KGQJeuhe1GI//h5uptK4PvLt+BGBxsoUJbd3/IW002yk//6sZPlFgsG1hY6OHLcy6kA== dependencies: - "@babel/helper-call-delegate" "^7.4.4" - "@babel/helper-get-function-arity" "^7.0.0" - "@babel/helper-plugin-utils" "^7.0.0" + "@babel/helper-get-function-arity" "^7.8.3" + "@babel/helper-plugin-utils" "^7.8.3" -"@babel/plugin-transform-property-literals@^7.2.0": - version "7.2.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-property-literals/-/plugin-transform-property-literals-7.2.0.tgz#03e33f653f5b25c4eb572c98b9485055b389e905" - integrity sha512-9q7Dbk4RhgcLp8ebduOpCbtjh7C0itoLYHXd9ueASKAG/is5PQtMR5VJGka9NKqGhYEGn5ITahd4h9QeBMylWQ== +"@babel/plugin-transform-property-literals@^7.8.3": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-property-literals/-/plugin-transform-property-literals-7.8.3.tgz#33194300d8539c1ed28c62ad5087ba3807b98263" + integrity sha512-uGiiXAZMqEoQhRWMK17VospMZh5sXWg+dlh2soffpkAl96KAm+WZuJfa6lcELotSRmooLqg0MWdH6UUq85nmmg== dependencies: - "@babel/helper-plugin-utils" "^7.0.0" + "@babel/helper-plugin-utils" "^7.8.3" -"@babel/plugin-transform-regenerator@^7.4.5": - version "7.4.5" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-regenerator/-/plugin-transform-regenerator-7.4.5.tgz#629dc82512c55cee01341fb27bdfcb210354680f" - integrity sha512-gBKRh5qAaCWntnd09S8QC7r3auLCqq5DI6O0DlfoyDjslSBVqBibrMdsqO+Uhmx3+BlOmE/Kw1HFxmGbv0N9dA== +"@babel/plugin-transform-regenerator@^7.8.7": + version "7.8.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-regenerator/-/plugin-transform-regenerator-7.8.7.tgz#5e46a0dca2bee1ad8285eb0527e6abc9c37672f8" + integrity sha512-TIg+gAl4Z0a3WmD3mbYSk+J9ZUH6n/Yc57rtKRnlA/7rcCvpekHXe0CMZHP1gYp7/KLe9GHTuIba0vXmls6drA== dependencies: - regenerator-transform "^0.14.0" + regenerator-transform "^0.14.2" -"@babel/plugin-transform-reserved-words@^7.2.0": - version "7.2.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-reserved-words/-/plugin-transform-reserved-words-7.2.0.tgz#4792af87c998a49367597d07fedf02636d2e1634" - integrity sha512-fz43fqW8E1tAB3DKF19/vxbpib1fuyCwSPE418ge5ZxILnBhWyhtPgz8eh1RCGGJlwvksHkyxMxh0eenFi+kFw== +"@babel/plugin-transform-reserved-words@^7.8.3": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-reserved-words/-/plugin-transform-reserved-words-7.8.3.tgz#9a0635ac4e665d29b162837dd3cc50745dfdf1f5" + integrity sha512-mwMxcycN3omKFDjDQUl+8zyMsBfjRFr0Zn/64I41pmjv4NJuqcYlEtezwYtw9TFd9WR1vN5kiM+O0gMZzO6L0A== dependencies: - "@babel/helper-plugin-utils" "^7.0.0" + "@babel/helper-plugin-utils" "^7.8.3" -"@babel/plugin-transform-runtime@^7.4.4": - version "7.4.4" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-runtime/-/plugin-transform-runtime-7.4.4.tgz#a50f5d16e9c3a4ac18a1a9f9803c107c380bce08" - integrity sha512-aMVojEjPszvau3NRg+TIH14ynZLvPewH4xhlCW1w6A3rkxTS1m4uwzRclYR9oS+rl/dr+kT+pzbfHuAWP/lc7Q== +"@babel/plugin-transform-runtime@^7.9.0": + version "7.9.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-runtime/-/plugin-transform-runtime-7.9.0.tgz#45468c0ae74cc13204e1d3b1f4ce6ee83258af0b" + integrity sha512-pUu9VSf3kI1OqbWINQ7MaugnitRss1z533436waNXp+0N3ur3zfut37sXiQMxkuCF4VUjwZucen/quskCh7NHw== dependencies: - "@babel/helper-module-imports" "^7.0.0" - "@babel/helper-plugin-utils" "^7.0.0" + "@babel/helper-module-imports" "^7.8.3" + "@babel/helper-plugin-utils" "^7.8.3" resolve "^1.8.1" semver "^5.5.1" -"@babel/plugin-transform-shorthand-properties@^7.2.0": - version "7.2.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-shorthand-properties/-/plugin-transform-shorthand-properties-7.2.0.tgz#6333aee2f8d6ee7e28615457298934a3b46198f0" - integrity sha512-QP4eUM83ha9zmYtpbnyjTLAGKQritA5XW/iG9cjtuOI8s1RuL/3V6a3DeSHfKutJQ+ayUfeZJPcnCYEQzaPQqg== - dependencies: - "@babel/helper-plugin-utils" "^7.0.0" - -"@babel/plugin-transform-spread@^7.2.0": - version "7.2.2" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-spread/-/plugin-transform-spread-7.2.2.tgz#3103a9abe22f742b6d406ecd3cd49b774919b406" - integrity sha512-KWfky/58vubwtS0hLqEnrWJjsMGaOeSBn90Ezn5Jeg9Z8KKHmELbP1yGylMlm5N6TPKeY9A2+UaSYLdxahg01w== - dependencies: - "@babel/helper-plugin-utils" "^7.0.0" - -"@babel/plugin-transform-sticky-regex@^7.2.0": - version "7.2.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-sticky-regex/-/plugin-transform-sticky-regex-7.2.0.tgz#a1e454b5995560a9c1e0d537dfc15061fd2687e1" - integrity sha512-KKYCoGaRAf+ckH8gEL3JHUaFVyNHKe3ASNsZ+AlktgHevvxGigoIttrEJb8iKN03Q7Eazlv1s6cx2B2cQ3Jabw== - dependencies: - "@babel/helper-plugin-utils" "^7.0.0" - "@babel/helper-regex" "^7.0.0" - -"@babel/plugin-transform-template-literals@^7.4.4": - version "7.4.4" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-template-literals/-/plugin-transform-template-literals-7.4.4.tgz#9d28fea7bbce637fb7612a0750989d8321d4bcb0" - integrity sha512-mQrEC4TWkhLN0z8ygIvEL9ZEToPhG5K7KDW3pzGqOfIGZ28Jb0POUkeWcoz8HnHvhFy6dwAT1j8OzqN8s804+g== - dependencies: - "@babel/helper-annotate-as-pure" "^7.0.0" - "@babel/helper-plugin-utils" "^7.0.0" - -"@babel/plugin-transform-typeof-symbol@^7.2.0": - version "7.2.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-typeof-symbol/-/plugin-transform-typeof-symbol-7.2.0.tgz#117d2bcec2fbf64b4b59d1f9819894682d29f2b2" - integrity sha512-2LNhETWYxiYysBtrBTqL8+La0jIoQQnIScUJc74OYvUGRmkskNY4EzLCnjHBzdmb38wqtTaixpo1NctEcvMDZw== - dependencies: - "@babel/helper-plugin-utils" "^7.0.0" +"@babel/plugin-transform-shorthand-properties@^7.8.3": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-shorthand-properties/-/plugin-transform-shorthand-properties-7.8.3.tgz#28545216e023a832d4d3a1185ed492bcfeac08c8" + integrity sha512-I9DI6Odg0JJwxCHzbzW08ggMdCezoWcuQRz3ptdudgwaHxTjxw5HgdFJmZIkIMlRymL6YiZcped4TTCB0JcC8w== + dependencies: + "@babel/helper-plugin-utils" "^7.8.3" + +"@babel/plugin-transform-spread@^7.8.3": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-spread/-/plugin-transform-spread-7.8.3.tgz#9c8ffe8170fdfb88b114ecb920b82fb6e95fe5e8" + integrity sha512-CkuTU9mbmAoFOI1tklFWYYbzX5qCIZVXPVy0jpXgGwkplCndQAa58s2jr66fTeQnA64bDox0HL4U56CFYoyC7g== + dependencies: + "@babel/helper-plugin-utils" "^7.8.3" + +"@babel/plugin-transform-sticky-regex@^7.8.3": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-sticky-regex/-/plugin-transform-sticky-regex-7.8.3.tgz#be7a1290f81dae767475452199e1f76d6175b100" + integrity sha512-9Spq0vGCD5Bb4Z/ZXXSK5wbbLFMG085qd2vhL1JYu1WcQ5bXqZBAYRzU1d+p79GcHs2szYv5pVQCX13QgldaWw== + dependencies: + "@babel/helper-plugin-utils" "^7.8.3" + "@babel/helper-regex" "^7.8.3" + +"@babel/plugin-transform-template-literals@^7.8.3": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-template-literals/-/plugin-transform-template-literals-7.8.3.tgz#7bfa4732b455ea6a43130adc0ba767ec0e402a80" + integrity sha512-820QBtykIQOLFT8NZOcTRJ1UNuztIELe4p9DCgvj4NK+PwluSJ49we7s9FB1HIGNIYT7wFUJ0ar2QpCDj0escQ== + dependencies: + "@babel/helper-annotate-as-pure" "^7.8.3" + "@babel/helper-plugin-utils" "^7.8.3" + +"@babel/plugin-transform-typeof-symbol@^7.8.4": + version "7.8.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-typeof-symbol/-/plugin-transform-typeof-symbol-7.8.4.tgz#ede4062315ce0aaf8a657a920858f1a2f35fc412" + integrity sha512-2QKyfjGdvuNfHsb7qnBBlKclbD4CfshH2KvDabiijLMGXPHJXGxtDzwIF7bQP+T0ysw8fYTtxPafgfs/c1Lrqg== + dependencies: + "@babel/helper-plugin-utils" "^7.8.3" + +"@babel/plugin-transform-unicode-regex@^7.8.3": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-unicode-regex/-/plugin-transform-unicode-regex-7.8.3.tgz#0cef36e3ba73e5c57273effb182f46b91a1ecaad" + integrity sha512-+ufgJjYdmWfSQ+6NS9VGUR2ns8cjJjYbrbi11mZBTaWm+Fui/ncTLFF28Ei1okavY+xkojGr1eJxNsWYeA5aZw== + dependencies: + "@babel/helper-create-regexp-features-plugin" "^7.8.3" + "@babel/helper-plugin-utils" "^7.8.3" + +"@babel/preset-env@^7.9.5": + version "7.9.5" + resolved "https://registry.yarnpkg.com/@babel/preset-env/-/preset-env-7.9.5.tgz#8ddc76039bc45b774b19e2fc548f6807d8a8919f" + integrity sha512-eWGYeADTlPJH+wq1F0wNfPbVS1w1wtmMJiYk55Td5Yu28AsdR9AsC97sZ0Qq8fHqQuslVSIYSGJMcblr345GfQ== + dependencies: + "@babel/compat-data" "^7.9.0" + "@babel/helper-compilation-targets" "^7.8.7" + "@babel/helper-module-imports" "^7.8.3" + "@babel/helper-plugin-utils" "^7.8.3" + "@babel/plugin-proposal-async-generator-functions" "^7.8.3" + "@babel/plugin-proposal-dynamic-import" "^7.8.3" + "@babel/plugin-proposal-json-strings" "^7.8.3" + "@babel/plugin-proposal-nullish-coalescing-operator" "^7.8.3" + "@babel/plugin-proposal-numeric-separator" "^7.8.3" + "@babel/plugin-proposal-object-rest-spread" "^7.9.5" + "@babel/plugin-proposal-optional-catch-binding" "^7.8.3" + "@babel/plugin-proposal-optional-chaining" "^7.9.0" + "@babel/plugin-proposal-unicode-property-regex" "^7.8.3" + "@babel/plugin-syntax-async-generators" "^7.8.0" + "@babel/plugin-syntax-dynamic-import" "^7.8.0" + "@babel/plugin-syntax-json-strings" "^7.8.0" + "@babel/plugin-syntax-nullish-coalescing-operator" "^7.8.0" + "@babel/plugin-syntax-numeric-separator" "^7.8.0" + "@babel/plugin-syntax-object-rest-spread" "^7.8.0" + "@babel/plugin-syntax-optional-catch-binding" "^7.8.0" + "@babel/plugin-syntax-optional-chaining" "^7.8.0" + "@babel/plugin-syntax-top-level-await" "^7.8.3" + "@babel/plugin-transform-arrow-functions" "^7.8.3" + "@babel/plugin-transform-async-to-generator" "^7.8.3" + "@babel/plugin-transform-block-scoped-functions" "^7.8.3" + "@babel/plugin-transform-block-scoping" "^7.8.3" + "@babel/plugin-transform-classes" "^7.9.5" + "@babel/plugin-transform-computed-properties" "^7.8.3" + "@babel/plugin-transform-destructuring" "^7.9.5" + "@babel/plugin-transform-dotall-regex" "^7.8.3" + "@babel/plugin-transform-duplicate-keys" "^7.8.3" + "@babel/plugin-transform-exponentiation-operator" "^7.8.3" + "@babel/plugin-transform-for-of" "^7.9.0" + "@babel/plugin-transform-function-name" "^7.8.3" + "@babel/plugin-transform-literals" "^7.8.3" + "@babel/plugin-transform-member-expression-literals" "^7.8.3" + "@babel/plugin-transform-modules-amd" "^7.9.0" + "@babel/plugin-transform-modules-commonjs" "^7.9.0" + "@babel/plugin-transform-modules-systemjs" "^7.9.0" + "@babel/plugin-transform-modules-umd" "^7.9.0" + "@babel/plugin-transform-named-capturing-groups-regex" "^7.8.3" + "@babel/plugin-transform-new-target" "^7.8.3" + "@babel/plugin-transform-object-super" "^7.8.3" + "@babel/plugin-transform-parameters" "^7.9.5" + "@babel/plugin-transform-property-literals" "^7.8.3" + "@babel/plugin-transform-regenerator" "^7.8.7" + "@babel/plugin-transform-reserved-words" "^7.8.3" + "@babel/plugin-transform-shorthand-properties" "^7.8.3" + "@babel/plugin-transform-spread" "^7.8.3" + "@babel/plugin-transform-sticky-regex" "^7.8.3" + "@babel/plugin-transform-template-literals" "^7.8.3" + "@babel/plugin-transform-typeof-symbol" "^7.8.4" + "@babel/plugin-transform-unicode-regex" "^7.8.3" + "@babel/preset-modules" "^0.1.3" + "@babel/types" "^7.9.5" + browserslist "^4.9.1" + core-js-compat "^3.6.2" + invariant "^2.2.2" + levenary "^1.1.1" + semver "^5.5.0" -"@babel/plugin-transform-unicode-regex@^7.4.4": - version "7.4.4" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-unicode-regex/-/plugin-transform-unicode-regex-7.4.4.tgz#ab4634bb4f14d36728bf5978322b35587787970f" - integrity sha512-il+/XdNw01i93+M9J9u4T7/e/Ue/vWfNZE4IRUQjplu2Mqb/AFTDimkw2tdEdSH50wuQXZAbXSql0UphQke+vA== +"@babel/preset-flow@^7.9.0": + version "7.9.0" + resolved "https://registry.yarnpkg.com/@babel/preset-flow/-/preset-flow-7.9.0.tgz#fee847c3e090b0b2d9227c1949e4da1d1379280d" + integrity sha512-88uSmlshIrlmPkNkEcx3UpSZ6b8n0UGBq0/0ZMZCF/uxAW0XIAUuDHBhIOAh0pvweafH4RxOwi/H3rWhtqOYPA== dependencies: - "@babel/helper-plugin-utils" "^7.0.0" - "@babel/helper-regex" "^7.4.4" - regexpu-core "^4.5.4" + "@babel/helper-plugin-utils" "^7.8.3" + "@babel/plugin-transform-flow-strip-types" "^7.9.0" -"@babel/preset-env@^7.4.5": - version "7.4.5" - resolved "https://registry.yarnpkg.com/@babel/preset-env/-/preset-env-7.4.5.tgz#2fad7f62983d5af563b5f3139242755884998a58" - integrity sha512-f2yNVXM+FsR5V8UwcFeIHzHWgnhXg3NpRmy0ADvALpnhB0SLbCvrCRr4BLOUYbQNLS+Z0Yer46x9dJXpXewI7w== +"@babel/preset-modules@^0.1.3": + version "0.1.3" + resolved "https://registry.yarnpkg.com/@babel/preset-modules/-/preset-modules-0.1.3.tgz#13242b53b5ef8c883c3cf7dddd55b36ce80fbc72" + integrity sha512-Ra3JXOHBq2xd56xSF7lMKXdjBn3T772Y1Wet3yWnkDly9zHvJki029tAFzvAAK5cf4YV3yoxuP61crYRol6SVg== dependencies: - "@babel/helper-module-imports" "^7.0.0" "@babel/helper-plugin-utils" "^7.0.0" - "@babel/plugin-proposal-async-generator-functions" "^7.2.0" - "@babel/plugin-proposal-json-strings" "^7.2.0" - "@babel/plugin-proposal-object-rest-spread" "^7.4.4" - "@babel/plugin-proposal-optional-catch-binding" "^7.2.0" "@babel/plugin-proposal-unicode-property-regex" "^7.4.4" - "@babel/plugin-syntax-async-generators" "^7.2.0" - "@babel/plugin-syntax-json-strings" "^7.2.0" - "@babel/plugin-syntax-object-rest-spread" "^7.2.0" - "@babel/plugin-syntax-optional-catch-binding" "^7.2.0" - "@babel/plugin-transform-arrow-functions" "^7.2.0" - "@babel/plugin-transform-async-to-generator" "^7.4.4" - "@babel/plugin-transform-block-scoped-functions" "^7.2.0" - "@babel/plugin-transform-block-scoping" "^7.4.4" - "@babel/plugin-transform-classes" "^7.4.4" - "@babel/plugin-transform-computed-properties" "^7.2.0" - "@babel/plugin-transform-destructuring" "^7.4.4" "@babel/plugin-transform-dotall-regex" "^7.4.4" - "@babel/plugin-transform-duplicate-keys" "^7.2.0" - "@babel/plugin-transform-exponentiation-operator" "^7.2.0" - "@babel/plugin-transform-for-of" "^7.4.4" - "@babel/plugin-transform-function-name" "^7.4.4" - "@babel/plugin-transform-literals" "^7.2.0" - "@babel/plugin-transform-member-expression-literals" "^7.2.0" - "@babel/plugin-transform-modules-amd" "^7.2.0" - "@babel/plugin-transform-modules-commonjs" "^7.4.4" - "@babel/plugin-transform-modules-systemjs" "^7.4.4" - "@babel/plugin-transform-modules-umd" "^7.2.0" - "@babel/plugin-transform-named-capturing-groups-regex" "^7.4.5" - "@babel/plugin-transform-new-target" "^7.4.4" - "@babel/plugin-transform-object-super" "^7.2.0" - "@babel/plugin-transform-parameters" "^7.4.4" - "@babel/plugin-transform-property-literals" "^7.2.0" - "@babel/plugin-transform-regenerator" "^7.4.5" - "@babel/plugin-transform-reserved-words" "^7.2.0" - "@babel/plugin-transform-shorthand-properties" "^7.2.0" - "@babel/plugin-transform-spread" "^7.2.0" - "@babel/plugin-transform-sticky-regex" "^7.2.0" - "@babel/plugin-transform-template-literals" "^7.4.4" - "@babel/plugin-transform-typeof-symbol" "^7.2.0" - "@babel/plugin-transform-unicode-regex" "^7.4.4" "@babel/types" "^7.4.4" - browserslist "^4.6.0" - core-js-compat "^3.1.1" - invariant "^2.2.2" - js-levenshtein "^1.1.3" - semver "^5.5.0" - -"@babel/preset-flow@^7.0.0": - version "7.0.0" - resolved "https://registry.yarnpkg.com/@babel/preset-flow/-/preset-flow-7.0.0.tgz#afd764835d9535ec63d8c7d4caf1c06457263da2" - integrity sha512-bJOHrYOPqJZCkPVbG1Lot2r5OSsB+iUOaxiHdlOeB1yPWS6evswVHwvkDLZ54WTaTRIk89ds0iHmGZSnxlPejQ== - dependencies: - "@babel/helper-plugin-utils" "^7.0.0" - "@babel/plugin-transform-flow-strip-types" "^7.0.0" + esutils "^2.0.2" -"@babel/register@^7.4.4": - version "7.4.4" - resolved "https://registry.yarnpkg.com/@babel/register/-/register-7.4.4.tgz#370a68ba36f08f015a8b35d4864176c6b65d7a23" - integrity sha512-sn51H88GRa00+ZoMqCVgOphmswG4b7mhf9VOB0LUBAieykq2GnRFerlN+JQkO/ntT7wz4jaHNSRPg9IdMPEUkA== +"@babel/register@^7.9.0": + version "7.9.0" + resolved "https://registry.yarnpkg.com/@babel/register/-/register-7.9.0.tgz#02464ede57548bddbb5e9f705d263b7c3f43d48b" + integrity sha512-Tv8Zyi2J2VRR8g7pC5gTeIN8Ihultbmk0ocyNz8H2nEZbmhp1N6q0A1UGsQbDvGP/sNinQKUHf3SqXwqjtFv4Q== dependencies: - core-js "^3.0.0" find-cache-dir "^2.0.0" - lodash "^4.17.11" - mkdirp "^0.5.1" + lodash "^4.17.13" + make-dir "^2.1.0" pirates "^4.0.0" - source-map-support "^0.5.9" - -"@babel/runtime@^7.0.0", "@babel/runtime@^7.4.5": - version "7.4.5" - resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.4.5.tgz#582bb531f5f9dc67d2fcb682979894f75e253f12" - integrity sha512-TuI4qpWZP6lGOGIuGWtp9sPluqYICmbk8T/1vpSysqJxRPkudh/ofFWyqdcMsDf2s7KvDL4/YHgKyvcS3g9CJQ== - dependencies: - regenerator-runtime "^0.13.2" - -"@babel/template@^7.0.0", "@babel/template@^7.1.0", "@babel/template@^7.4.4": - version "7.4.4" - resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.4.4.tgz#f4b88d1225689a08f5bc3a17483545be9e4ed237" - integrity sha512-CiGzLN9KgAvgZsnivND7rkA+AeJ9JB0ciPOD4U59GKbQP2iQl+olF1l76kJOupqidozfZ32ghwBEJDhnk9MEcw== - dependencies: - "@babel/code-frame" "^7.0.0" - "@babel/parser" "^7.4.4" - "@babel/types" "^7.4.4" - -"@babel/traverse@^7.0.0", "@babel/traverse@^7.1.0", "@babel/traverse@^7.4.4", "@babel/traverse@^7.4.5": - version "7.4.5" - resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.4.5.tgz#4e92d1728fd2f1897dafdd321efbff92156c3216" - integrity sha512-Vc+qjynwkjRmIFGxy0KYoPj4FdVDxLej89kMHFsWScq999uX+pwcX4v9mWRjW0KcAYTPAuVQl2LKP1wEVLsp+A== - dependencies: - "@babel/code-frame" "^7.0.0" - "@babel/generator" "^7.4.4" - "@babel/helper-function-name" "^7.1.0" - "@babel/helper-split-export-declaration" "^7.4.4" - "@babel/parser" "^7.4.5" - "@babel/types" "^7.4.4" + source-map-support "^0.5.16" + +"@babel/runtime@^7.8.4", "@babel/runtime@^7.9.2": + version "7.9.2" + resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.9.2.tgz#d90df0583a3a252f09aaa619665367bae518db06" + integrity sha512-NE2DtOdufG7R5vnfQUTehdTfNycfUANEtCa9PssN9O/xmTzP4E08UI797ixaei6hBEVL9BI/PsdJS5x7mWoB9Q== + dependencies: + regenerator-runtime "^0.13.4" + +"@babel/template@^7.4.0", "@babel/template@^7.8.3", "@babel/template@^7.8.6": + version "7.8.6" + resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.8.6.tgz#86b22af15f828dfb086474f964dcc3e39c43ce2b" + integrity sha512-zbMsPMy/v0PWFZEhQJ66bqjhH+z0JgMoBWuikXybgG3Gkd/3t5oQ1Rw2WQhnSrsOmsKXnZOx15tkC4qON/+JPg== + dependencies: + "@babel/code-frame" "^7.8.3" + "@babel/parser" "^7.8.6" + "@babel/types" "^7.8.6" + +"@babel/traverse@^7.0.0", "@babel/traverse@^7.1.0", "@babel/traverse@^7.4.3", "@babel/traverse@^7.8.3", "@babel/traverse@^7.8.6", "@babel/traverse@^7.9.0": + version "7.9.5" + resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.9.5.tgz#6e7c56b44e2ac7011a948c21e283ddd9d9db97a2" + integrity sha512-c4gH3jsvSuGUezlP6rzSJ6jf8fYjLj3hsMZRx/nX0h+fmHN0w+ekubRrHPqnMec0meycA2nwCsJ7dC8IPem2FQ== + dependencies: + "@babel/code-frame" "^7.8.3" + "@babel/generator" "^7.9.5" + "@babel/helper-function-name" "^7.9.5" + "@babel/helper-split-export-declaration" "^7.8.3" + "@babel/parser" "^7.9.0" + "@babel/types" "^7.9.5" debug "^4.1.0" globals "^11.1.0" - lodash "^4.17.11" + lodash "^4.17.13" -"@babel/types@^7.0.0", "@babel/types@^7.2.0", "@babel/types@^7.3.0", "@babel/types@^7.4.4": - version "7.4.4" - resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.4.4.tgz#8db9e9a629bb7c29370009b4b779ed93fe57d5f0" - integrity sha512-dOllgYdnEFOebhkKCjzSVFqw/PmmB8pH6RGOWkY4GsboQNd47b1fBThBSwlHAq9alF9vc1M3+6oqR47R50L0tQ== +"@babel/types@^7.0.0", "@babel/types@^7.3.0", "@babel/types@^7.4.0", "@babel/types@^7.4.4", "@babel/types@^7.8.3", "@babel/types@^7.8.6", "@babel/types@^7.9.0", "@babel/types@^7.9.5": + version "7.9.5" + resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.9.5.tgz#89231f82915a8a566a703b3b20133f73da6b9444" + integrity sha512-XjnvNqenk818r5zMaba+sLQjnbda31UfUURv3ei0qPQw4u+j2jMyJ5b11y8ZHYTRSI3NnInQkkkRT4fLqqPdHg== dependencies: - esutils "^2.0.2" - lodash "^4.17.11" + "@babel/helper-validator-identifier" "^7.9.5" + lodash "^4.17.13" to-fast-properties "^2.0.0" "@cnakazawa/watch@^1.0.3": @@ -750,23 +851,23 @@ exec-sh "^0.3.2" minimist "^1.2.0" -"@evocateur/libnpmaccess@^3.1.0": - version "3.1.0" - resolved "https://registry.yarnpkg.com/@evocateur/libnpmaccess/-/libnpmaccess-3.1.0.tgz#e546ee4e4bedca54ed9303948ec54c985cec33e4" - integrity sha512-bfrqZ0v+Il5TJBsgF2oyepeJg34K2pBItapzP+UT1QMIGpUh/Zc1pQql4jrafamZTqP3ZvdJxaElat8B5K3ICA== +"@evocateur/libnpmaccess@^3.1.2": + version "3.1.2" + resolved "https://registry.yarnpkg.com/@evocateur/libnpmaccess/-/libnpmaccess-3.1.2.tgz#ecf7f6ce6b004e9f942b098d92200be4a4b1c845" + integrity sha512-KSCAHwNWro0CF2ukxufCitT9K5LjL/KuMmNzSu8wuwN2rjyKHD8+cmOsiybK+W5hdnwc5M1SmRlVCaMHQo+3rg== dependencies: - "@evocateur/npm-registry-fetch" "^3.9.1" + "@evocateur/npm-registry-fetch" "^4.0.0" aproba "^2.0.0" figgy-pudding "^3.5.1" get-stream "^4.0.0" npm-package-arg "^6.1.0" -"@evocateur/libnpmpublish@^1.2.0": - version "1.2.0" - resolved "https://registry.yarnpkg.com/@evocateur/libnpmpublish/-/libnpmpublish-1.2.0.tgz#3e0d79fdc0a75f212adabb7c7e341b017effeac2" - integrity sha512-sezhX9FSnPIyrBBvxVocVJVO1uIWPczf6rOmUZSntCWfQMraO8pWTFlDJbroFqPbEqFFHf3eyw8NQ0Eb7OLd1g== +"@evocateur/libnpmpublish@^1.2.2": + version "1.2.2" + resolved "https://registry.yarnpkg.com/@evocateur/libnpmpublish/-/libnpmpublish-1.2.2.tgz#55df09d2dca136afba9c88c759ca272198db9f1a" + integrity sha512-MJrrk9ct1FeY9zRlyeoyMieBjGDG9ihyyD9/Ft6MMrTxql9NyoEx2hw9casTIP4CdqEVu+3nQ2nXxoJ8RCXyFg== dependencies: - "@evocateur/npm-registry-fetch" "^3.9.1" + "@evocateur/npm-registry-fetch" "^4.0.0" aproba "^2.0.0" figgy-pudding "^3.5.1" get-stream "^4.0.0" @@ -776,122 +877,125 @@ semver "^5.5.1" ssri "^6.0.1" -"@evocateur/npm-registry-fetch@^3.9.1": - version "3.9.1" - resolved "https://registry.yarnpkg.com/@evocateur/npm-registry-fetch/-/npm-registry-fetch-3.9.1.tgz#75b3917320e559f6c91e26af17e62b085ec457a2" - integrity sha512-6v1bHbcAypQ+te/1RGSNL4JkK6mcMtcZrUusqo5iKRtYSAig9UJXlOaCcBR+eLywt2DQMNpEwAj24jwWDX5G/w== +"@evocateur/npm-registry-fetch@^4.0.0": + version "4.0.0" + resolved "https://registry.yarnpkg.com/@evocateur/npm-registry-fetch/-/npm-registry-fetch-4.0.0.tgz#8c4c38766d8d32d3200fcb0a83f064b57365ed66" + integrity sha512-k1WGfKRQyhJpIr+P17O5vLIo2ko1PFLKwoetatdduUSt/aQ4J2sJrJwwatdI5Z3SiYk/mRH9S3JpdmMFd/IK4g== dependencies: JSONStream "^1.3.4" bluebird "^3.5.1" figgy-pudding "^3.4.1" - lru-cache "^4.1.3" - make-fetch-happen "^4.0.1" + lru-cache "^5.1.1" + make-fetch-happen "^5.0.0" npm-package-arg "^6.1.0" safe-buffer "^5.1.2" -"@evocateur/pacote@^9.6.0": - version "9.6.0" - resolved "https://registry.yarnpkg.com/@evocateur/pacote/-/pacote-9.6.0.tgz#3f0d08fb81c572289a2dfa981e7f97b6dd83cef2" - integrity sha512-nKx8EPxXhzqNfePbqC6603z7Kkf6GBS2q+SNGtBS/bCgS5Q+p3OVR6MXKOkpvC3WHse98W2WLu8QaV9axtfxyw== +"@evocateur/pacote@^9.6.3": + version "9.6.5" + resolved "https://registry.yarnpkg.com/@evocateur/pacote/-/pacote-9.6.5.tgz#33de32ba210b6f17c20ebab4d497efc6755f4ae5" + integrity sha512-EI552lf0aG2nOV8NnZpTxNo2PcXKPmDbF9K8eCBFQdIZwHNGN/mi815fxtmUMa2wTa1yndotICIDt/V0vpEx2w== dependencies: - "@evocateur/npm-registry-fetch" "^3.9.1" + "@evocateur/npm-registry-fetch" "^4.0.0" bluebird "^3.5.3" - cacache "^11.3.2" + cacache "^12.0.3" + chownr "^1.1.2" figgy-pudding "^3.5.1" get-stream "^4.1.0" - glob "^7.1.3" + glob "^7.1.4" + infer-owner "^1.0.4" lru-cache "^5.1.1" - make-fetch-happen "^4.0.1" + make-fetch-happen "^5.0.0" minimatch "^3.0.4" minipass "^2.3.5" mississippi "^3.0.0" mkdirp "^0.5.1" - normalize-package-data "^2.4.0" + normalize-package-data "^2.5.0" npm-package-arg "^6.1.0" - npm-packlist "^1.1.12" - npm-pick-manifest "^2.2.3" + npm-packlist "^1.4.4" + npm-pick-manifest "^3.0.0" osenv "^0.1.5" promise-inflight "^1.0.1" promise-retry "^1.1.1" protoduck "^5.0.1" - rimraf "^2.6.2" - safe-buffer "^5.1.2" - semver "^5.6.0" + rimraf "^2.6.3" + safe-buffer "^5.2.0" + semver "^5.7.0" ssri "^6.0.1" - tar "^4.4.8" + tar "^4.4.10" unique-filename "^1.1.1" which "^1.3.1" -"@jest/console@^24.7.1": - version "24.7.1" - resolved "https://registry.yarnpkg.com/@jest/console/-/console-24.7.1.tgz#32a9e42535a97aedfe037e725bd67e954b459545" - integrity sha512-iNhtIy2M8bXlAOULWVTUxmnelTLFneTNEkHCgPmgd+zNwy9zVddJ6oS5rZ9iwoscNdT5mMwUd0C51v/fSlzItg== +"@jest/console@^24.7.1", "@jest/console@^24.9.0": + version "24.9.0" + resolved "https://registry.yarnpkg.com/@jest/console/-/console-24.9.0.tgz#79b1bc06fb74a8cfb01cbdedf945584b1b9707f0" + integrity sha512-Zuj6b8TnKXi3q4ymac8EQfc3ea/uhLeCGThFqXeC8H9/raaH8ARPUTdId+XyGd03Z4In0/VjD2OYFcBF09fNLQ== dependencies: - "@jest/source-map" "^24.3.0" + "@jest/source-map" "^24.9.0" chalk "^2.0.1" slash "^2.0.0" -"@jest/core@^24.8.0": - version "24.8.0" - resolved "https://registry.yarnpkg.com/@jest/core/-/core-24.8.0.tgz#fbbdcd42a41d0d39cddbc9f520c8bab0c33eed5b" - integrity sha512-R9rhAJwCBQzaRnrRgAdVfnglUuATXdwTRsYqs6NMdVcAl5euG8LtWDe+fVkN27YfKVBW61IojVsXKaOmSnqd/A== +"@jest/core@^24.9.0": + version "24.9.0" + resolved "https://registry.yarnpkg.com/@jest/core/-/core-24.9.0.tgz#2ceccd0b93181f9c4850e74f2a9ad43d351369c4" + integrity sha512-Fogg3s4wlAr1VX7q+rhV9RVnUv5tD7VuWfYy1+whMiWUrvl7U3QJSJyWcDio9Lq2prqYsZaeTv2Rz24pWGkJ2A== dependencies: "@jest/console" "^24.7.1" - "@jest/reporters" "^24.8.0" - "@jest/test-result" "^24.8.0" - "@jest/transform" "^24.8.0" - "@jest/types" "^24.8.0" + "@jest/reporters" "^24.9.0" + "@jest/test-result" "^24.9.0" + "@jest/transform" "^24.9.0" + "@jest/types" "^24.9.0" ansi-escapes "^3.0.0" chalk "^2.0.1" exit "^0.1.2" graceful-fs "^4.1.15" - jest-changed-files "^24.8.0" - jest-config "^24.8.0" - jest-haste-map "^24.8.0" - jest-message-util "^24.8.0" + jest-changed-files "^24.9.0" + jest-config "^24.9.0" + jest-haste-map "^24.9.0" + jest-message-util "^24.9.0" jest-regex-util "^24.3.0" - jest-resolve-dependencies "^24.8.0" - jest-runner "^24.8.0" - jest-runtime "^24.8.0" - jest-snapshot "^24.8.0" - jest-util "^24.8.0" - jest-validate "^24.8.0" - jest-watcher "^24.8.0" + jest-resolve "^24.9.0" + jest-resolve-dependencies "^24.9.0" + jest-runner "^24.9.0" + jest-runtime "^24.9.0" + jest-snapshot "^24.9.0" + jest-util "^24.9.0" + jest-validate "^24.9.0" + jest-watcher "^24.9.0" micromatch "^3.1.10" p-each-series "^1.0.0" - pirates "^4.0.1" realpath-native "^1.1.0" rimraf "^2.5.4" + slash "^2.0.0" strip-ansi "^5.0.0" -"@jest/environment@^24.8.0": - version "24.8.0" - resolved "https://registry.yarnpkg.com/@jest/environment/-/environment-24.8.0.tgz#0342261383c776bdd652168f68065ef144af0eac" - integrity sha512-vlGt2HLg7qM+vtBrSkjDxk9K0YtRBi7HfRFaDxoRtyi+DyVChzhF20duvpdAnKVBV6W5tym8jm0U9EfXbDk1tw== - dependencies: - "@jest/fake-timers" "^24.8.0" - "@jest/transform" "^24.8.0" - "@jest/types" "^24.8.0" - jest-mock "^24.8.0" - -"@jest/fake-timers@^24.8.0": - version "24.8.0" - resolved "https://registry.yarnpkg.com/@jest/fake-timers/-/fake-timers-24.8.0.tgz#2e5b80a4f78f284bcb4bd5714b8e10dd36a8d3d1" - integrity sha512-2M4d5MufVXwi6VzZhJ9f5S/wU4ud2ck0kxPof1Iz3zWx6Y+V2eJrES9jEktB6O3o/oEyk+il/uNu9PvASjWXQw== - dependencies: - "@jest/types" "^24.8.0" - jest-message-util "^24.8.0" - jest-mock "^24.8.0" - -"@jest/reporters@^24.8.0": - version "24.8.0" - resolved "https://registry.yarnpkg.com/@jest/reporters/-/reporters-24.8.0.tgz#075169cd029bddec54b8f2c0fc489fd0b9e05729" - integrity sha512-eZ9TyUYpyIIXfYCrw0UHUWUvE35vx5I92HGMgS93Pv7du+GHIzl+/vh8Qj9MCWFK/4TqyttVBPakWMOfZRIfxw== - dependencies: - "@jest/environment" "^24.8.0" - "@jest/test-result" "^24.8.0" - "@jest/transform" "^24.8.0" - "@jest/types" "^24.8.0" +"@jest/environment@^24.9.0": + version "24.9.0" + resolved "https://registry.yarnpkg.com/@jest/environment/-/environment-24.9.0.tgz#21e3afa2d65c0586cbd6cbefe208bafade44ab18" + integrity sha512-5A1QluTPhvdIPFYnO3sZC3smkNeXPVELz7ikPbhUj0bQjB07EoE9qtLrem14ZUYWdVayYbsjVwIiL4WBIMV4aQ== + dependencies: + "@jest/fake-timers" "^24.9.0" + "@jest/transform" "^24.9.0" + "@jest/types" "^24.9.0" + jest-mock "^24.9.0" + +"@jest/fake-timers@^24.9.0": + version "24.9.0" + resolved "https://registry.yarnpkg.com/@jest/fake-timers/-/fake-timers-24.9.0.tgz#ba3e6bf0eecd09a636049896434d306636540c93" + integrity sha512-eWQcNa2YSwzXWIMC5KufBh3oWRIijrQFROsIqt6v/NS9Io/gknw1jsAC9c+ih/RQX4A3O7SeWAhQeN0goKhT9A== + dependencies: + "@jest/types" "^24.9.0" + jest-message-util "^24.9.0" + jest-mock "^24.9.0" + +"@jest/reporters@^24.9.0": + version "24.9.0" + resolved "https://registry.yarnpkg.com/@jest/reporters/-/reporters-24.9.0.tgz#86660eff8e2b9661d042a8e98a028b8d631a5b43" + integrity sha512-mu4X0yjaHrffOsWmVLzitKmmmWSQ3GGuefgNscUSWNiUNcEOSEQk9k3pERKEQVBb0Cnn88+UESIsZEMH3o88Gw== + dependencies: + "@jest/environment" "^24.9.0" + "@jest/test-result" "^24.9.0" + "@jest/transform" "^24.9.0" + "@jest/types" "^24.9.0" chalk "^2.0.1" exit "^0.1.2" glob "^7.1.2" @@ -899,313 +1003,307 @@ istanbul-lib-instrument "^3.0.1" istanbul-lib-report "^2.0.4" istanbul-lib-source-maps "^3.0.1" - istanbul-reports "^2.1.1" - jest-haste-map "^24.8.0" - jest-resolve "^24.8.0" - jest-runtime "^24.8.0" - jest-util "^24.8.0" + istanbul-reports "^2.2.6" + jest-haste-map "^24.9.0" + jest-resolve "^24.9.0" + jest-runtime "^24.9.0" + jest-util "^24.9.0" jest-worker "^24.6.0" - node-notifier "^5.2.1" + node-notifier "^5.4.2" slash "^2.0.0" source-map "^0.6.0" string-length "^2.0.0" -"@jest/source-map@^24.3.0": - version "24.3.0" - resolved "https://registry.yarnpkg.com/@jest/source-map/-/source-map-24.3.0.tgz#563be3aa4d224caf65ff77edc95cd1ca4da67f28" - integrity sha512-zALZt1t2ou8le/crCeeiRYzvdnTzaIlpOWaet45lNSqNJUnXbppUUFR4ZUAlzgDmKee4Q5P/tKXypI1RiHwgag== +"@jest/source-map@^24.3.0", "@jest/source-map@^24.9.0": + version "24.9.0" + resolved "https://registry.yarnpkg.com/@jest/source-map/-/source-map-24.9.0.tgz#0e263a94430be4b41da683ccc1e6bffe2a191714" + integrity sha512-/Xw7xGlsZb4MJzNDgB7PW5crou5JqWiBQaz6xyPd3ArOg2nfn/PunV8+olXbbEZzNl591o5rWKE9BRDaFAuIBg== dependencies: callsites "^3.0.0" graceful-fs "^4.1.15" source-map "^0.6.0" -"@jest/test-result@^24.8.0": - version "24.8.0" - resolved "https://registry.yarnpkg.com/@jest/test-result/-/test-result-24.8.0.tgz#7675d0aaf9d2484caa65e048d9b467d160f8e9d3" - integrity sha512-+YdLlxwizlfqkFDh7Mc7ONPQAhA4YylU1s529vVM1rsf67vGZH/2GGm5uO8QzPeVyaVMobCQ7FTxl38QrKRlng== +"@jest/test-result@^24.9.0": + version "24.9.0" + resolved "https://registry.yarnpkg.com/@jest/test-result/-/test-result-24.9.0.tgz#11796e8aa9dbf88ea025757b3152595ad06ba0ca" + integrity sha512-XEFrHbBonBJ8dGp2JmF8kP/nQI/ImPpygKHwQ/SY+es59Z3L5PI4Qb9TQQMAEeYsThG1xF0k6tmG0tIKATNiiA== dependencies: - "@jest/console" "^24.7.1" - "@jest/types" "^24.8.0" + "@jest/console" "^24.9.0" + "@jest/types" "^24.9.0" "@types/istanbul-lib-coverage" "^2.0.0" -"@jest/test-sequencer@^24.8.0": - version "24.8.0" - resolved "https://registry.yarnpkg.com/@jest/test-sequencer/-/test-sequencer-24.8.0.tgz#2f993bcf6ef5eb4e65e8233a95a3320248cf994b" - integrity sha512-OzL/2yHyPdCHXEzhoBuq37CE99nkme15eHkAzXRVqthreWZamEMA0WoetwstsQBCXABhczpK03JNbc4L01vvLg== +"@jest/test-sequencer@^24.9.0": + version "24.9.0" + resolved "https://registry.yarnpkg.com/@jest/test-sequencer/-/test-sequencer-24.9.0.tgz#f8f334f35b625a4f2f355f2fe7e6036dad2e6b31" + integrity sha512-6qqsU4o0kW1dvA95qfNog8v8gkRN9ph6Lz7r96IvZpHdNipP2cBcb07J1Z45mz/VIS01OHJ3pY8T5fUY38tg4A== dependencies: - "@jest/test-result" "^24.8.0" - jest-haste-map "^24.8.0" - jest-runner "^24.8.0" - jest-runtime "^24.8.0" + "@jest/test-result" "^24.9.0" + jest-haste-map "^24.9.0" + jest-runner "^24.9.0" + jest-runtime "^24.9.0" -"@jest/transform@^24.8.0": - version "24.8.0" - resolved "https://registry.yarnpkg.com/@jest/transform/-/transform-24.8.0.tgz#628fb99dce4f9d254c6fd9341e3eea262e06fef5" - integrity sha512-xBMfFUP7TortCs0O+Xtez2W7Zu1PLH9bvJgtraN1CDST6LBM/eTOZ9SfwS/lvV8yOfcDpFmwf9bq5cYbXvqsvA== +"@jest/transform@^24.9.0": + version "24.9.0" + resolved "https://registry.yarnpkg.com/@jest/transform/-/transform-24.9.0.tgz#4ae2768b296553fadab09e9ec119543c90b16c56" + integrity sha512-TcQUmyNRxV94S0QpMOnZl0++6RMiqpbH/ZMccFB/amku6Uwvyb1cjYX7xkp5nGNkbX4QPH/FcB6q1HBTHynLmQ== dependencies: "@babel/core" "^7.1.0" - "@jest/types" "^24.8.0" + "@jest/types" "^24.9.0" babel-plugin-istanbul "^5.1.0" chalk "^2.0.1" convert-source-map "^1.4.0" fast-json-stable-stringify "^2.0.0" graceful-fs "^4.1.15" - jest-haste-map "^24.8.0" - jest-regex-util "^24.3.0" - jest-util "^24.8.0" + jest-haste-map "^24.9.0" + jest-regex-util "^24.9.0" + jest-util "^24.9.0" micromatch "^3.1.10" + pirates "^4.0.1" realpath-native "^1.1.0" slash "^2.0.0" source-map "^0.6.1" write-file-atomic "2.4.1" -"@jest/types@^24.8.0": - version "24.8.0" - resolved "https://registry.yarnpkg.com/@jest/types/-/types-24.8.0.tgz#f31e25948c58f0abd8c845ae26fcea1491dea7ad" - integrity sha512-g17UxVr2YfBtaMUxn9u/4+siG1ptg9IGYAYwvpwn61nBg779RXnjE/m7CxYcIzEt0AbHZZAHSEZNhkE2WxURVg== +"@jest/types@^24.9.0": + version "24.9.0" + resolved "https://registry.yarnpkg.com/@jest/types/-/types-24.9.0.tgz#63cb26cb7500d069e5a389441a7c6ab5e909fc59" + integrity sha512-XKK7ze1apu5JWQ5eZjHITP66AX+QsLlbaJRBGYr8pNzwcAE2JVkwnf0yqjHTsDRcjR0mujy/NmZMXw5kl+kGBw== dependencies: "@types/istanbul-lib-coverage" "^2.0.0" "@types/istanbul-reports" "^1.1.1" - "@types/yargs" "^12.0.9" - -"@lerna/add@3.15.0": - version "3.15.0" - resolved "https://registry.yarnpkg.com/@lerna/add/-/add-3.15.0.tgz#10be562f43cde59b60f299083d54ac39520ec60a" - integrity sha512-+KrG4GFy/6FISZ+DwWf5Fj5YB4ESa4VTnSn/ujf3VEda6dxngHPN629j+TcPbsdOxUYVah+HuZbC/B8NnkrKpQ== - dependencies: - "@evocateur/pacote" "^9.6.0" - "@lerna/bootstrap" "3.15.0" - "@lerna/command" "3.15.0" - "@lerna/filter-options" "3.14.2" - "@lerna/npm-conf" "3.13.0" + "@types/yargs" "^13.0.0" + +"@lerna/add@3.19.0": + version "3.19.0" + resolved "https://registry.yarnpkg.com/@lerna/add/-/add-3.19.0.tgz#33b6251c669895f842c14f05961432d464166249" + integrity sha512-qzhxPyoczvvT1W0wwCK9I0iJ4B9WR+HzYsusmRuzM3mEhWjowhbuvKEl5BjGYuXc9AvEErM/S0Fm5K0RcuS39Q== + dependencies: + "@evocateur/pacote" "^9.6.3" + "@lerna/bootstrap" "3.18.5" + "@lerna/command" "3.18.5" + "@lerna/filter-options" "3.18.4" + "@lerna/npm-conf" "3.16.0" "@lerna/validation-error" "3.13.0" dedent "^0.7.0" npm-package-arg "^6.1.0" - p-map "^1.2.0" - semver "^5.5.0" - -"@lerna/batch-packages@3.14.0": - version "3.14.0" - resolved "https://registry.yarnpkg.com/@lerna/batch-packages/-/batch-packages-3.14.0.tgz#0208663bab3ddbf57956b370aaec4c9ebee6c800" - integrity sha512-RlBkQVNTqk1qvn6PFWiWNiskllUHh6tXbTVm43mZRNd+vhAyvrQC8RWJxH0ECVvnFAt9rSNGRIVbEJ31WnNQLg== - dependencies: - "@lerna/package-graph" "3.14.0" - npmlog "^4.1.2" - -"@lerna/bootstrap@3.15.0": - version "3.15.0" - resolved "https://registry.yarnpkg.com/@lerna/bootstrap/-/bootstrap-3.15.0.tgz#f53e0bbbbfb8367e609a06378409bfc673ff2930" - integrity sha512-4AxsPKKbgj2Ju03qDddQTpOHvpqnwd0yaiEU/aCcWv/4tDTe79NqUne2Z3+P2WZY0Zzb8+nUKcskwYBMTeq+Mw== - dependencies: - "@lerna/batch-packages" "3.14.0" - "@lerna/command" "3.15.0" - "@lerna/filter-options" "3.14.2" - "@lerna/has-npm-version" "3.14.2" - "@lerna/npm-install" "3.14.2" - "@lerna/package-graph" "3.14.0" + p-map "^2.1.0" + semver "^6.2.0" + +"@lerna/bootstrap@3.18.5": + version "3.18.5" + resolved "https://registry.yarnpkg.com/@lerna/bootstrap/-/bootstrap-3.18.5.tgz#cc22a750d6b0402e136926e8b214148dfc2e1390" + integrity sha512-9vD/BfCz8YSF2Dx7sHaMVo6Cy33WjLEmoN1yrHgNkHjm7ykWbLHG5wru0f4Y4pvwa0s5Hf76rvT8aJWzGHk9IQ== + dependencies: + "@lerna/command" "3.18.5" + "@lerna/filter-options" "3.18.4" + "@lerna/has-npm-version" "3.16.5" + "@lerna/npm-install" "3.16.5" + "@lerna/package-graph" "3.18.5" "@lerna/pulse-till-done" "3.13.0" - "@lerna/rimraf-dir" "3.14.2" - "@lerna/run-lifecycle" "3.14.0" - "@lerna/run-parallel-batches" "3.13.0" - "@lerna/symlink-binary" "3.14.2" - "@lerna/symlink-dependencies" "3.14.2" + "@lerna/rimraf-dir" "3.16.5" + "@lerna/run-lifecycle" "3.16.2" + "@lerna/run-topologically" "3.18.5" + "@lerna/symlink-binary" "3.17.0" + "@lerna/symlink-dependencies" "3.17.0" "@lerna/validation-error" "3.13.0" dedent "^0.7.0" - get-port "^3.2.0" - multimatch "^2.1.0" + get-port "^4.2.0" + multimatch "^3.0.0" npm-package-arg "^6.1.0" npmlog "^4.1.2" p-finally "^1.0.0" - p-map "^1.2.0" + p-map "^2.1.0" p-map-series "^1.0.0" p-waterfall "^1.0.0" read-package-tree "^5.1.6" - semver "^5.5.0" + semver "^6.2.0" -"@lerna/changed@3.15.0": - version "3.15.0" - resolved "https://registry.yarnpkg.com/@lerna/changed/-/changed-3.15.0.tgz#20db9d992d697e4288c260aa38b989dcb93f4b40" - integrity sha512-Hns1ssI9T9xOTGVc7PT2jUaqzsSkxV3hV/Y7iFO0uKTk+fduyTwGTHU9A/ybQ/xi/9iaJbvaXyjxKiGoEnzmhg== +"@lerna/changed@3.18.5": + version "3.18.5" + resolved "https://registry.yarnpkg.com/@lerna/changed/-/changed-3.18.5.tgz#ef2c460f5497b8b4cfac7e5165fe46d7181fcdf5" + integrity sha512-IXS7VZ5VDQUfCsgK56WYxd42luMBxL456cNUf1yBgQ1cy1U2FPVMitIdLN4AcP7bJizdPWeG8yDptf47jN/xVw== dependencies: - "@lerna/collect-updates" "3.14.2" - "@lerna/command" "3.15.0" - "@lerna/listable" "3.14.0" + "@lerna/collect-updates" "3.18.0" + "@lerna/command" "3.18.5" + "@lerna/listable" "3.18.5" "@lerna/output" "3.13.0" - "@lerna/version" "3.15.0" -"@lerna/check-working-tree@3.14.2": - version "3.14.2" - resolved "https://registry.yarnpkg.com/@lerna/check-working-tree/-/check-working-tree-3.14.2.tgz#5ce007722180a69643a8456766ed8a91fc7e9ae1" - integrity sha512-7safqxM/MYoAoxZxulUDtIJIbnBIgo0PB/FHytueG+9VaX7GMnDte2Bt1EKa0dz2sAyQdmQ3Q8ZXpf/6JDjaeg== +"@lerna/check-working-tree@3.16.5": + version "3.16.5" + resolved "https://registry.yarnpkg.com/@lerna/check-working-tree/-/check-working-tree-3.16.5.tgz#b4f8ae61bb4523561dfb9f8f8d874dd46bb44baa" + integrity sha512-xWjVBcuhvB8+UmCSb5tKVLB5OuzSpw96WEhS2uz6hkWVa/Euh1A0/HJwn2cemyK47wUrCQXtczBUiqnq9yX5VQ== dependencies: - "@lerna/collect-uncommitted" "3.14.2" - "@lerna/describe-ref" "3.14.2" + "@lerna/collect-uncommitted" "3.16.5" + "@lerna/describe-ref" "3.16.5" "@lerna/validation-error" "3.13.0" -"@lerna/child-process@3.14.2", "@lerna/child-process@^3.3.0": - version "3.14.2" - resolved "https://registry.yarnpkg.com/@lerna/child-process/-/child-process-3.14.2.tgz#950240cba83f7dfe25247cfa6c9cebf30b7d94f6" - integrity sha512-xnq+W5yQb6RkwI0p16ZQnrn6HkloH/MWTw4lGE1nKsBLAUbmSU5oTE93W1nrG0X3IMF/xWc9UYvNdUGMWvZZ4w== +"@lerna/child-process@3.16.5", "@lerna/child-process@^3.3.0": + version "3.16.5" + resolved "https://registry.yarnpkg.com/@lerna/child-process/-/child-process-3.16.5.tgz#38fa3c18064aa4ac0754ad80114776a7b36a69b2" + integrity sha512-vdcI7mzei9ERRV4oO8Y1LHBZ3A5+ampRKg1wq5nutLsUA4mEBN6H7JqjWOMY9xZemv6+kATm2ofjJ3lW5TszQg== dependencies: chalk "^2.3.1" execa "^1.0.0" strong-log-transformer "^2.0.0" -"@lerna/clean@3.15.0": - version "3.15.0" - resolved "https://registry.yarnpkg.com/@lerna/clean/-/clean-3.15.0.tgz#a94da50908a80ba443a0a682706aca79ac2ecf27" - integrity sha512-D1BN7BnJk6YjrSR7E7RiCmWiFVWDo3L+OSe6zDq6rNNYexPBtSi2JOCeF/Dibi3jd2luVu0zkVpUtuEEdPiD+A== +"@lerna/clean@3.18.5": + version "3.18.5" + resolved "https://registry.yarnpkg.com/@lerna/clean/-/clean-3.18.5.tgz#44b4a6db68ae369778f2921c85ec6961bdd86072" + integrity sha512-tHxOj9frTIhB/H2gtgMU3xpIc4IJEhXcUlReko6RJt8TTiDZGPDudCcgjg6i7n15v9jXMOc1y4F+y5/1089bfA== dependencies: - "@lerna/command" "3.15.0" - "@lerna/filter-options" "3.14.2" - "@lerna/prompt" "3.13.0" + "@lerna/command" "3.18.5" + "@lerna/filter-options" "3.18.4" + "@lerna/prompt" "3.18.5" "@lerna/pulse-till-done" "3.13.0" - "@lerna/rimraf-dir" "3.14.2" - p-map "^1.2.0" + "@lerna/rimraf-dir" "3.16.5" + p-map "^2.1.0" p-map-series "^1.0.0" p-waterfall "^1.0.0" -"@lerna/cli@3.13.0": - version "3.13.0" - resolved "https://registry.yarnpkg.com/@lerna/cli/-/cli-3.13.0.tgz#3d7b357fdd7818423e9681a7b7f2abd106c8a266" - integrity sha512-HgFGlyCZbYaYrjOr3w/EsY18PdvtsTmDfpUQe8HwDjXlPeCCUgliZjXLOVBxSjiOvPeOSwvopwIHKWQmYbwywg== +"@lerna/cli@3.18.5": + version "3.18.5" + resolved "https://registry.yarnpkg.com/@lerna/cli/-/cli-3.18.5.tgz#c90c461542fcd35b6d5b015a290fb0dbfb41d242" + integrity sha512-erkbxkj9jfc89vVs/jBLY/fM0I80oLmJkFUV3Q3wk9J3miYhP14zgVEBsPZY68IZlEjT6T3Xlq2xO1AVaatHsA== dependencies: "@lerna/global-options" "3.13.0" dedent "^0.7.0" npmlog "^4.1.2" - yargs "^12.0.1" + yargs "^14.2.2" -"@lerna/collect-uncommitted@3.14.2": - version "3.14.2" - resolved "https://registry.yarnpkg.com/@lerna/collect-uncommitted/-/collect-uncommitted-3.14.2.tgz#b5ed00d800bea26bb0d18404432b051eee8d030e" - integrity sha512-4EkQu4jIOdNL2BMzy/N0ydHB8+Z6syu6xiiKXOoFl0WoWU9H1jEJCX4TH7CmVxXL1+jcs8FIS2pfQz4oew99Eg== +"@lerna/collect-uncommitted@3.16.5": + version "3.16.5" + resolved "https://registry.yarnpkg.com/@lerna/collect-uncommitted/-/collect-uncommitted-3.16.5.tgz#a494d61aac31cdc7aec4bbe52c96550274132e63" + integrity sha512-ZgqnGwpDZiWyzIQVZtQaj9tRizsL4dUOhuOStWgTAw1EMe47cvAY2kL709DzxFhjr6JpJSjXV5rZEAeU3VE0Hg== dependencies: - "@lerna/child-process" "3.14.2" + "@lerna/child-process" "3.16.5" chalk "^2.3.1" figgy-pudding "^3.5.1" npmlog "^4.1.2" -"@lerna/collect-updates@3.14.2", "@lerna/collect-updates@https://github.com/babel/lerna.git#babel-collect-updates": - version "3.14.2" - resolved "https://github.com/babel/lerna.git#89eab830be040fbaabc31ad7206c5efab878c6c3" +"@lerna/collect-updates@3.18.0", "@lerna/collect-updates@https://github.com/babel/lerna.git#babel-collect-updates": + version "3.16.0" + resolved "https://github.com/babel/lerna.git#ae87fff020c5ad00366878c14b749e8ee0a34145" dependencies: "@lerna/child-process" "^3.3.0" "@lerna/describe-ref" "^3.6.0" minimatch "^3.0.4" npmlog "^4.1.2" - slash "^1.0.0" + slash "^2.0.0" -"@lerna/command@3.15.0": - version "3.15.0" - resolved "https://registry.yarnpkg.com/@lerna/command/-/command-3.15.0.tgz#e1dc1319054f1cf0b135aa0c5730f3335641a0ca" - integrity sha512-dZqr4rKFN+veuXakIQ1DcGUpzBgcWKaYFNN4O6/skOdVQaEfGefzo1sZET+q7k/BkypxkhXHXpv5UqqSuL/EHQ== +"@lerna/command@3.18.5": + version "3.18.5" + resolved "https://registry.yarnpkg.com/@lerna/command/-/command-3.18.5.tgz#14c6d2454adbfd365f8027201523e6c289cd3cd9" + integrity sha512-36EnqR59yaTU4HrR1C9XDFti2jRx0BgpIUBeWn129LZZB8kAB3ov1/dJNa1KcNRKp91DncoKHLY99FZ6zTNpMQ== dependencies: - "@lerna/child-process" "3.14.2" - "@lerna/package-graph" "3.14.0" - "@lerna/project" "3.15.0" + "@lerna/child-process" "3.16.5" + "@lerna/package-graph" "3.18.5" + "@lerna/project" "3.18.0" "@lerna/validation-error" "3.13.0" "@lerna/write-log-file" "3.13.0" + clone-deep "^4.0.1" dedent "^0.7.0" execa "^1.0.0" - is-ci "^1.0.10" - lodash "^4.17.5" + is-ci "^2.0.0" npmlog "^4.1.2" -"@lerna/conventional-commits@3.14.0": - version "3.14.0" - resolved "https://registry.yarnpkg.com/@lerna/conventional-commits/-/conventional-commits-3.14.0.tgz#24f643550dc29d4f1249cc26d0eb453d7a1c513d" - integrity sha512-hGZ2qQZ9uEGf2eeIiIpEodSs9Qkkf/2uYEtNT7QN1RYISPUh6/lKGBssc5dpbCF64aEuxmemWLdlDf1ogG6++w== +"@lerna/conventional-commits@3.18.5": + version "3.18.5" + resolved "https://registry.yarnpkg.com/@lerna/conventional-commits/-/conventional-commits-3.18.5.tgz#08efd2e5b45acfaf3f151a53a3ec7ecade58a7bc" + integrity sha512-qcvXIEJ3qSgalxXnQ7Yxp5H9Ta5TVyai6vEor6AAEHc20WiO7UIdbLDCxBtiiHMdGdpH85dTYlsoYUwsCJu3HQ== dependencies: "@lerna/validation-error" "3.13.0" conventional-changelog-angular "^5.0.3" conventional-changelog-core "^3.1.6" - conventional-recommended-bump "^4.0.4" - fs-extra "^7.0.0" + conventional-recommended-bump "^5.0.0" + fs-extra "^8.1.0" get-stream "^4.0.0" + lodash.template "^4.5.0" npm-package-arg "^6.1.0" npmlog "^4.1.2" - pify "^3.0.0" - semver "^5.5.0" + pify "^4.0.1" + semver "^6.2.0" -"@lerna/create-symlink@3.14.0": - version "3.14.0" - resolved "https://registry.yarnpkg.com/@lerna/create-symlink/-/create-symlink-3.14.0.tgz#f40ae06e8cebe70c694368ebf9a4af5ab380fbea" - integrity sha512-Kw51HYOOi6UfCKncqkgEU1k/SYueSBXgkNL91FR8HAZH7EPSRTEtp9mnJo568g0+Hog5C+3cOaWySwhHpRG29A== +"@lerna/create-symlink@3.16.2": + version "3.16.2" + resolved "https://registry.yarnpkg.com/@lerna/create-symlink/-/create-symlink-3.16.2.tgz#412cb8e59a72f5a7d9463e4e4721ad2070149967" + integrity sha512-pzXIJp6av15P325sgiIRpsPXLFmkisLhMBCy4764d+7yjf2bzrJ4gkWVMhsv4AdF0NN3OyZ5jjzzTtLNqfR+Jw== dependencies: - cmd-shim "^2.0.2" - fs-extra "^7.0.0" + "@zkochan/cmd-shim" "^3.1.0" + fs-extra "^8.1.0" npmlog "^4.1.2" -"@lerna/create@3.15.0": - version "3.15.0" - resolved "https://registry.yarnpkg.com/@lerna/create/-/create-3.15.0.tgz#27bfadcbdf71d34226aa82432293f5290f7ab1aa" - integrity sha512-doXGt0HTwTQl8GkC2tOrraA/5OWbz35hJqi7Dsl3Fl0bAxiv9XmF3LykHFJ+YTDHfGpdoJ8tKu66f/VKP16G0w== +"@lerna/create@3.18.5": + version "3.18.5" + resolved "https://registry.yarnpkg.com/@lerna/create/-/create-3.18.5.tgz#11ac539f069248eaf7bc4c42e237784330f4fc47" + integrity sha512-cHpjocbpKmLopCuZFI7cKEM3E/QY8y+yC7VtZ4FQRSaLU8D8i2xXtXmYaP1GOlVNavji0iwoXjuNpnRMInIr2g== dependencies: - "@evocateur/pacote" "^9.6.0" - "@lerna/child-process" "3.14.2" - "@lerna/command" "3.15.0" - "@lerna/npm-conf" "3.13.0" + "@evocateur/pacote" "^9.6.3" + "@lerna/child-process" "3.16.5" + "@lerna/command" "3.18.5" + "@lerna/npm-conf" "3.16.0" "@lerna/validation-error" "3.13.0" camelcase "^5.0.0" dedent "^0.7.0" - fs-extra "^7.0.0" - globby "^8.0.1" + fs-extra "^8.1.0" + globby "^9.2.0" init-package-json "^1.10.3" npm-package-arg "^6.1.0" p-reduce "^1.0.0" - pify "^3.0.0" - semver "^5.5.0" - slash "^1.0.0" + pify "^4.0.1" + semver "^6.2.0" + slash "^2.0.0" validate-npm-package-license "^3.0.3" validate-npm-package-name "^3.0.0" whatwg-url "^7.0.0" -"@lerna/describe-ref@3.14.2", "@lerna/describe-ref@^3.6.0": - version "3.14.2" - resolved "https://registry.yarnpkg.com/@lerna/describe-ref/-/describe-ref-3.14.2.tgz#edc3c973f5ca9728d23358c4f4d3b55a21f65be5" - integrity sha512-qa5pzDRK2oBQXNjyRmRnN7E8a78NMYfQjjlRFB0KNHMsT6mCiL9+8kIS39sSE2NqT8p7xVNo2r2KAS8R/m3CoQ== +"@lerna/describe-ref@3.16.5", "@lerna/describe-ref@^3.6.0": + version "3.16.5" + resolved "https://registry.yarnpkg.com/@lerna/describe-ref/-/describe-ref-3.16.5.tgz#a338c25aaed837d3dc70b8a72c447c5c66346ac0" + integrity sha512-c01+4gUF0saOOtDBzbLMFOTJDHTKbDFNErEY6q6i9QaXuzy9LNN62z+Hw4acAAZuJQhrVWncVathcmkkjvSVGw== dependencies: - "@lerna/child-process" "3.14.2" + "@lerna/child-process" "3.16.5" npmlog "^4.1.2" -"@lerna/diff@3.15.0": - version "3.15.0" - resolved "https://registry.yarnpkg.com/@lerna/diff/-/diff-3.15.0.tgz#573d6f58f6809d16752dcfab74c5e286b6678371" - integrity sha512-N1Pr0M554Bt+DlVoD+DXWGh92gcq6G9icn8sH5GSqfwi0XCpPNJ2i1BNEZpUQ6ulLWOMa1YHR4PypPxecRGBjA== +"@lerna/diff@3.18.5": + version "3.18.5" + resolved "https://registry.yarnpkg.com/@lerna/diff/-/diff-3.18.5.tgz#e9e2cb882f84d5b84f0487c612137305f07accbc" + integrity sha512-u90lGs+B8DRA9Z/2xX4YaS3h9X6GbypmGV6ITzx9+1Ga12UWGTVlKaCXBgONMBjzJDzAQOK8qPTwLA57SeBLgA== dependencies: - "@lerna/child-process" "3.14.2" - "@lerna/command" "3.15.0" + "@lerna/child-process" "3.16.5" + "@lerna/command" "3.18.5" "@lerna/validation-error" "3.13.0" npmlog "^4.1.2" -"@lerna/exec@3.15.0": - version "3.15.0" - resolved "https://registry.yarnpkg.com/@lerna/exec/-/exec-3.15.0.tgz#b31510f47255367eb0d3e4a4f7b6ef8f7e41b985" - integrity sha512-YuXPd64TNG9wbb3lRvyMARQbdlbMZ1bJZ+GCm0enivnIWUyg0qtBDcfPY2dWpIgOif04zx+K/gmOX4lCaGM4UQ== +"@lerna/exec@3.18.5": + version "3.18.5" + resolved "https://registry.yarnpkg.com/@lerna/exec/-/exec-3.18.5.tgz#50f1bd6b8f88f2ec02c0768b8b1d9024feb1a96a" + integrity sha512-Q1nz95MeAxctS9bF+aG8FkjixzqEjRpg6ujtnDW84J42GgxedkPtNcJ2o/MBqLd/mxAlr+fW3UZ6CPC/zgoyCg== dependencies: - "@lerna/child-process" "3.14.2" - "@lerna/command" "3.15.0" - "@lerna/filter-options" "3.14.2" - "@lerna/run-topologically" "3.14.0" + "@lerna/child-process" "3.16.5" + "@lerna/command" "3.18.5" + "@lerna/filter-options" "3.18.4" + "@lerna/run-topologically" "3.18.5" "@lerna/validation-error" "3.13.0" - p-map "^1.2.0" + p-map "^2.1.0" -"@lerna/filter-options@3.14.2": - version "3.14.2" - resolved "https://registry.yarnpkg.com/@lerna/filter-options/-/filter-options-3.14.2.tgz#7ba91cb54ff3fd9f4650ad8d7c40bc1075e44c2d" - integrity sha512-Ct8oYvRttbYB9JalngHhirb8o9ZVyLm5a9MpXNevXoHiu6j0vNhI19BQCwNnrL6wZvEHJnzPuUl/jO23tWxemg== +"@lerna/filter-options@3.18.4": + version "3.18.4" + resolved "https://registry.yarnpkg.com/@lerna/filter-options/-/filter-options-3.18.4.tgz#f5476a7ee2169abed27ad433222e92103f56f9f1" + integrity sha512-4giVQD6tauRwweO/322LP2gfVDOVrt/xN4khkXyfkJDfcsZziFXq+668otD9KSLL8Ps+To4Fah3XbK0MoNuEvA== dependencies: - "@lerna/collect-updates" "3.14.2" - "@lerna/filter-packages" "3.13.0" + "@lerna/collect-updates" "3.18.0" + "@lerna/filter-packages" "3.18.0" dedent "^0.7.0" + figgy-pudding "^3.5.1" + npmlog "^4.1.2" -"@lerna/filter-packages@3.13.0": - version "3.13.0" - resolved "https://registry.yarnpkg.com/@lerna/filter-packages/-/filter-packages-3.13.0.tgz#f5371249e7e1a15928e5e88c544a242e0162c21c" - integrity sha512-RWiZWyGy3Mp7GRVBn//CacSnE3Kw82PxE4+H6bQ3pDUw/9atXn7NRX+gkBVQIYeKamh7HyumJtyOKq3Pp9BADQ== +"@lerna/filter-packages@3.18.0": + version "3.18.0" + resolved "https://registry.yarnpkg.com/@lerna/filter-packages/-/filter-packages-3.18.0.tgz#6a7a376d285208db03a82958cfb8172e179b4e70" + integrity sha512-6/0pMM04bCHNATIOkouuYmPg6KH3VkPCIgTfQmdkPJTullERyEQfNUKikrefjxo1vHOoCACDpy65JYyKiAbdwQ== dependencies: "@lerna/validation-error" "3.13.0" - multimatch "^2.1.0" + multimatch "^3.0.0" npmlog "^4.1.2" "@lerna/get-npm-exec-opts@3.13.0": @@ -1215,23 +1313,23 @@ dependencies: npmlog "^4.1.2" -"@lerna/get-packed@3.13.0": - version "3.13.0" - resolved "https://registry.yarnpkg.com/@lerna/get-packed/-/get-packed-3.13.0.tgz#335e40d77f3c1855aa248587d3e0b2d8f4b06e16" - integrity sha512-EgSim24sjIjqQDC57bgXD9l22/HCS93uQBbGpkzEOzxAVzEgpZVm7Fm1t8BVlRcT2P2zwGnRadIvxTbpQuDPTg== +"@lerna/get-packed@3.16.0": + version "3.16.0" + resolved "https://registry.yarnpkg.com/@lerna/get-packed/-/get-packed-3.16.0.tgz#1b316b706dcee86c7baa55e50b087959447852ff" + integrity sha512-AjsFiaJzo1GCPnJUJZiTW6J1EihrPkc2y3nMu6m3uWFxoleklsSCyImumzVZJssxMi3CPpztj8LmADLedl9kXw== dependencies: - fs-extra "^7.0.0" + fs-extra "^8.1.0" ssri "^6.0.1" tar "^4.4.8" -"@lerna/github-client@3.14.2": - version "3.14.2" - resolved "https://registry.yarnpkg.com/@lerna/github-client/-/github-client-3.14.2.tgz#a743792b51cd9bdfb785186e429568827a6372eb" - integrity sha512-+2Xh7t4qVmXiXE2utPnh5T7YwSltG74JP7c+EiooRY5+3zjh9MpPOcTKxVY3xKclzpsyXMohk2KpTF4tzA5rrg== +"@lerna/github-client@3.16.5": + version "3.16.5" + resolved "https://registry.yarnpkg.com/@lerna/github-client/-/github-client-3.16.5.tgz#2eb0235c3bf7a7e5d92d73e09b3761ab21f35c2e" + integrity sha512-rHQdn8Dv/CJrO3VouOP66zAcJzrHsm+wFuZ4uGAai2At2NkgKH+tpNhQy2H1PSC0Ezj9LxvdaHYrUzULqVK5Hw== dependencies: - "@lerna/child-process" "3.14.2" - "@octokit/plugin-enterprise-rest" "^2.1.1" - "@octokit/rest" "^16.16.0" + "@lerna/child-process" "3.16.5" + "@octokit/plugin-enterprise-rest" "^3.6.1" + "@octokit/rest" "^16.28.4" git-url-parse "^11.1.2" npmlog "^4.1.2" @@ -1249,141 +1347,141 @@ resolved "https://registry.yarnpkg.com/@lerna/global-options/-/global-options-3.13.0.tgz#217662290db06ad9cf2c49d8e3100ee28eaebae1" integrity sha512-SlZvh1gVRRzYLVluz9fryY1nJpZ0FHDGB66U9tFfvnnxmueckRQxLopn3tXj3NU1kc3QANT2I5BsQkOqZ4TEFQ== -"@lerna/has-npm-version@3.14.2": - version "3.14.2" - resolved "https://registry.yarnpkg.com/@lerna/has-npm-version/-/has-npm-version-3.14.2.tgz#ac17f7c68e92114b8332b95ae6cffec9c0d67a7b" - integrity sha512-cG+z5bB8JPd5f+nT2eLN2LmKg06O11AxlnUxgw2W7cLyc7cnsmMSp/rxt2JBMwW2r4Yn+CLLJIRwJZ2Es8jFSw== +"@lerna/has-npm-version@3.16.5": + version "3.16.5" + resolved "https://registry.yarnpkg.com/@lerna/has-npm-version/-/has-npm-version-3.16.5.tgz#ab83956f211d8923ea6afe9b979b38cc73b15326" + integrity sha512-WL7LycR9bkftyqbYop5rEGJ9sRFIV55tSGmbN1HLrF9idwOCD7CLrT64t235t3t4O5gehDnwKI5h2U3oxTrF8Q== dependencies: - "@lerna/child-process" "3.14.2" - semver "^5.5.0" + "@lerna/child-process" "3.16.5" + semver "^6.2.0" -"@lerna/import@3.15.0": - version "3.15.0" - resolved "https://registry.yarnpkg.com/@lerna/import/-/import-3.15.0.tgz#47f2da52059a96bb08a4c09e18d985258fce9ce1" - integrity sha512-4GKQgeTXBTwMbZNkYyPdQIVA41HIISD7D6XRNrDaG0falUfvoPsknijQPCBmGqeh66u1Fcn2+4lkL3OCTj2FMg== +"@lerna/import@3.18.5": + version "3.18.5" + resolved "https://registry.yarnpkg.com/@lerna/import/-/import-3.18.5.tgz#a9c7d8601870729851293c10abd18b3707f7ba5e" + integrity sha512-PH0WVLEgp+ORyNKbGGwUcrueW89K3Iuk/DDCz8mFyG2IG09l/jOF0vzckEyGyz6PO5CMcz4TI1al/qnp3FrahQ== dependencies: - "@lerna/child-process" "3.14.2" - "@lerna/command" "3.15.0" - "@lerna/prompt" "3.13.0" + "@lerna/child-process" "3.16.5" + "@lerna/command" "3.18.5" + "@lerna/prompt" "3.18.5" "@lerna/pulse-till-done" "3.13.0" "@lerna/validation-error" "3.13.0" dedent "^0.7.0" - fs-extra "^7.0.0" + fs-extra "^8.1.0" p-map-series "^1.0.0" -"@lerna/init@3.15.0": - version "3.15.0" - resolved "https://registry.yarnpkg.com/@lerna/init/-/init-3.15.0.tgz#bda36de44c365972f87cbd287fe85b6fb7bb1070" - integrity sha512-VOqH6kFbFtfUbXxhSqXKY6bjnVp9nLuLRI6x9tVHOANX2LmSlXm17OUGBnNt+eM4uJLuiUsAR8nTlpCiz//lPQ== - dependencies: - "@lerna/child-process" "3.14.2" - "@lerna/command" "3.15.0" - fs-extra "^7.0.0" - p-map "^1.2.0" - write-json-file "^2.3.0" - -"@lerna/link@3.15.0": - version "3.15.0" - resolved "https://registry.yarnpkg.com/@lerna/link/-/link-3.15.0.tgz#718b4116a8eacb3fc73414ae8d97f8fdaf8125da" - integrity sha512-yKHuifADINobvDOLljBGkVGpVwy6J3mg5p9lQXBdOLXBoIKC8o/UKBR9JvZMFvT/Iy6zn6FPy1v5lz9iU1Ib0Q== - dependencies: - "@lerna/command" "3.15.0" - "@lerna/package-graph" "3.14.0" - "@lerna/symlink-dependencies" "3.14.2" - p-map "^1.2.0" - slash "^1.0.0" +"@lerna/init@3.18.5": + version "3.18.5" + resolved "https://registry.yarnpkg.com/@lerna/init/-/init-3.18.5.tgz#86dd0b2b3290755a96975069b5cb007f775df9f5" + integrity sha512-oCwipWrha98EcJAHm8AGd2YFFLNI7AW9AWi0/LbClj1+XY9ah+uifXIgYGfTk63LbgophDd8936ZEpHMxBsbAg== + dependencies: + "@lerna/child-process" "3.16.5" + "@lerna/command" "3.18.5" + fs-extra "^8.1.0" + p-map "^2.1.0" + write-json-file "^3.2.0" + +"@lerna/link@3.18.5": + version "3.18.5" + resolved "https://registry.yarnpkg.com/@lerna/link/-/link-3.18.5.tgz#f24347e4f0b71d54575bd37cfa1794bc8ee91b18" + integrity sha512-xTN3vktJpkT7Nqc3QkZRtHO4bT5NvuLMtKNIBDkks0HpGxC9PRyyqwOoCoh1yOGbrWIuDezhfMg3Qow+6I69IQ== + dependencies: + "@lerna/command" "3.18.5" + "@lerna/package-graph" "3.18.5" + "@lerna/symlink-dependencies" "3.17.0" + p-map "^2.1.0" + slash "^2.0.0" -"@lerna/list@3.15.0": - version "3.15.0" - resolved "https://registry.yarnpkg.com/@lerna/list/-/list-3.15.0.tgz#4e401c1ad990bb12bd38298cb61d21136420ff68" - integrity sha512-8SvxnlfAnbEzQDf2NL0IxWyUuqWTykF9cHt5/f5TOzgESClpaOkDtqwh/UlE8nVTzWMnxnQUPQi3UTKyJD3i3g== +"@lerna/list@3.18.5": + version "3.18.5" + resolved "https://registry.yarnpkg.com/@lerna/list/-/list-3.18.5.tgz#58863f17c81e24e2c38018eb8619fc99d7cc5c82" + integrity sha512-qIeomm28C2OCM8TMjEe/chTnQf6XLN54wPVQ6kZy+axMYxANFNt/uhs6GZEmhem7GEVawzkyHSz5ZJPsfH3IFg== dependencies: - "@lerna/command" "3.15.0" - "@lerna/filter-options" "3.14.2" - "@lerna/listable" "3.14.0" + "@lerna/command" "3.18.5" + "@lerna/filter-options" "3.18.4" + "@lerna/listable" "3.18.5" "@lerna/output" "3.13.0" -"@lerna/listable@3.14.0": - version "3.14.0" - resolved "https://registry.yarnpkg.com/@lerna/listable/-/listable-3.14.0.tgz#08f4c78e0466568e8e8a57d4ad09537f2bb7bbb9" - integrity sha512-ZK44Mo8xf/N97eQZ236SPSq0ek6+gk4HqHIx05foEMZVV1iIDH4a/nblLsJNjGQVsIdMYFPaqNJ0z+ZQfiJazQ== +"@lerna/listable@3.18.5": + version "3.18.5" + resolved "https://registry.yarnpkg.com/@lerna/listable/-/listable-3.18.5.tgz#e82798405b5ed8fc51843c8ef1e7a0e497388a1a" + integrity sha512-Sdr3pVyaEv5A7ZkGGYR7zN+tTl2iDcinryBPvtuv20VJrXBE8wYcOks1edBTcOWsPjCE/rMP4bo1pseyk3UTsg== dependencies: - "@lerna/query-graph" "3.14.0" + "@lerna/query-graph" "3.18.5" chalk "^2.3.1" columnify "^1.5.4" -"@lerna/log-packed@3.13.0": - version "3.13.0" - resolved "https://registry.yarnpkg.com/@lerna/log-packed/-/log-packed-3.13.0.tgz#497b5f692a8d0e3f669125da97b0dadfd9e480f3" - integrity sha512-Rmjrcz+6aM6AEcEVWmurbo8+AnHOvYtDpoeMMJh9IZ9SmZr2ClXzmD7wSvjTQc8BwOaiWjjC/ukcT0UYA2m7wg== +"@lerna/log-packed@3.16.0": + version "3.16.0" + resolved "https://registry.yarnpkg.com/@lerna/log-packed/-/log-packed-3.16.0.tgz#f83991041ee77b2495634e14470b42259fd2bc16" + integrity sha512-Fp+McSNBV/P2mnLUYTaSlG8GSmpXM7krKWcllqElGxvAqv6chk2K3c2k80MeVB4WvJ9tRjUUf+i7HUTiQ9/ckQ== dependencies: - byte-size "^4.0.3" + byte-size "^5.0.1" columnify "^1.5.4" has-unicode "^2.0.1" npmlog "^4.1.2" -"@lerna/npm-conf@3.13.0": - version "3.13.0" - resolved "https://registry.yarnpkg.com/@lerna/npm-conf/-/npm-conf-3.13.0.tgz#6b434ed75ff757e8c14381b9bbfe5d5ddec134a7" - integrity sha512-Jg2kANsGnhg+fbPEzE0X9nX5oviEAvWj0nYyOkcE+cgWuT7W0zpnPXC4hA4C5IPQGhwhhh0IxhWNNHtjTuw53g== +"@lerna/npm-conf@3.16.0": + version "3.16.0" + resolved "https://registry.yarnpkg.com/@lerna/npm-conf/-/npm-conf-3.16.0.tgz#1c10a89ae2f6c2ee96962557738685300d376827" + integrity sha512-HbO3DUrTkCAn2iQ9+FF/eisDpWY5POQAOF1m7q//CZjdC2HSW3UYbKEGsSisFxSfaF9Z4jtrV+F/wX6qWs3CuA== dependencies: config-chain "^1.1.11" - pify "^3.0.0" + pify "^4.0.1" -"@lerna/npm-dist-tag@3.15.0": - version "3.15.0" - resolved "https://registry.yarnpkg.com/@lerna/npm-dist-tag/-/npm-dist-tag-3.15.0.tgz#262dd1e67a4cf82ae78fadfe02622ebce4add078" - integrity sha512-lnbdwc4Ebs7/EI9fTIgbH3dxXnP+SuCcGhG7P5ZjOqo67SY09sRZGcygEzabpvIwXvKpBF8vCd4xxzjnF2u+PA== +"@lerna/npm-dist-tag@3.18.5": + version "3.18.5" + resolved "https://registry.yarnpkg.com/@lerna/npm-dist-tag/-/npm-dist-tag-3.18.5.tgz#9ef9abb7c104077b31f6fab22cc73b314d54ac55" + integrity sha512-xw0HDoIG6HreVsJND9/dGls1c+lf6vhu7yJoo56Sz5bvncTloYGLUppIfDHQr4ZvmPCK8rsh0euCVh2giPxzKQ== dependencies: - "@evocateur/npm-registry-fetch" "^3.9.1" - "@lerna/otplease" "3.14.0" + "@evocateur/npm-registry-fetch" "^4.0.0" + "@lerna/otplease" "3.18.5" figgy-pudding "^3.5.1" npm-package-arg "^6.1.0" npmlog "^4.1.2" -"@lerna/npm-install@3.14.2": - version "3.14.2" - resolved "https://registry.yarnpkg.com/@lerna/npm-install/-/npm-install-3.14.2.tgz#fd22ff432f8b7cbe05bedfd36b0506482f1a4732" - integrity sha512-JYJJRtLETrGpcQZa8Rj16vbye399RqnaXmJlZuZ2twjJ2DYVYtwkfsGEOdvdaKw5KVOEpWcAxBA9OMmKQtCLQw== +"@lerna/npm-install@3.16.5": + version "3.16.5" + resolved "https://registry.yarnpkg.com/@lerna/npm-install/-/npm-install-3.16.5.tgz#d6bfdc16f81285da66515ae47924d6e278d637d3" + integrity sha512-hfiKk8Eku6rB9uApqsalHHTHY+mOrrHeWEs+gtg7+meQZMTS3kzv4oVp5cBZigndQr3knTLjwthT/FX4KvseFg== dependencies: - "@lerna/child-process" "3.14.2" + "@lerna/child-process" "3.16.5" "@lerna/get-npm-exec-opts" "3.13.0" - fs-extra "^7.0.0" + fs-extra "^8.1.0" npm-package-arg "^6.1.0" npmlog "^4.1.2" signal-exit "^3.0.2" write-pkg "^3.1.0" -"@lerna/npm-publish@3.15.0": - version "3.15.0" - resolved "https://registry.yarnpkg.com/@lerna/npm-publish/-/npm-publish-3.15.0.tgz#89126d74ec97186475767b852954a5f55b732a71" - integrity sha512-G7rcNcSGjG0La8eHPXDvCvoNXbwNnP6XJ+GPh3CH5xiR/nikfLOa+Bfm4ytdjVWWxnKfCT4qyMTCoV1rROlqQQ== +"@lerna/npm-publish@3.18.5": + version "3.18.5" + resolved "https://registry.yarnpkg.com/@lerna/npm-publish/-/npm-publish-3.18.5.tgz#240e4039959fd9816b49c5b07421e11b5cb000af" + integrity sha512-3etLT9+2L8JAx5F8uf7qp6iAtOLSMj+ZYWY6oUgozPi/uLqU0/gsMsEXh3F0+YVW33q0M61RpduBoAlOOZnaTg== dependencies: - "@evocateur/libnpmpublish" "^1.2.0" - "@lerna/otplease" "3.14.0" - "@lerna/run-lifecycle" "3.14.0" + "@evocateur/libnpmpublish" "^1.2.2" + "@lerna/otplease" "3.18.5" + "@lerna/run-lifecycle" "3.16.2" figgy-pudding "^3.5.1" - fs-extra "^7.0.0" + fs-extra "^8.1.0" npm-package-arg "^6.1.0" npmlog "^4.1.2" - pify "^3.0.0" + pify "^4.0.1" read-package-json "^2.0.13" -"@lerna/npm-run-script@3.14.2": - version "3.14.2" - resolved "https://registry.yarnpkg.com/@lerna/npm-run-script/-/npm-run-script-3.14.2.tgz#8c518ea9d241a641273e77aad6f6fddc16779c3f" - integrity sha512-LbVFv+nvAoRTYLMrJlJ8RiakHXrLslL7Jp/m1R18vYrB8LYWA3ey+nz5Tel2OELzmjUiemAKZsD9h6i+Re5egg== +"@lerna/npm-run-script@3.16.5": + version "3.16.5" + resolved "https://registry.yarnpkg.com/@lerna/npm-run-script/-/npm-run-script-3.16.5.tgz#9c2ec82453a26c0b46edc0bb7c15816c821f5c15" + integrity sha512-1asRi+LjmVn3pMjEdpqKJZFT/3ZNpb+VVeJMwrJaV/3DivdNg7XlPK9LTrORuKU4PSvhdEZvJmSlxCKyDpiXsQ== dependencies: - "@lerna/child-process" "3.14.2" + "@lerna/child-process" "3.16.5" "@lerna/get-npm-exec-opts" "3.13.0" npmlog "^4.1.2" -"@lerna/otplease@3.14.0": - version "3.14.0" - resolved "https://registry.yarnpkg.com/@lerna/otplease/-/otplease-3.14.0.tgz#b539fd3e7a08452fc0db3b10010ca3cf0e4a73e7" - integrity sha512-rYAWzaYZ81bwnrmTkYWGgcc13bl/6DlG7pjWQWNGAJNLzO5zzj0xmXN5sMFJnNvDpSiS/ZS1sIuPvb4xnwLUkg== +"@lerna/otplease@3.18.5": + version "3.18.5" + resolved "https://registry.yarnpkg.com/@lerna/otplease/-/otplease-3.18.5.tgz#b77b8e760b40abad9f7658d988f3ea77d4fd0231" + integrity sha512-S+SldXAbcXTEDhzdxYLU0ZBKuYyURP/ND2/dK6IpKgLxQYh/z4ScljPDMyKymmEvgiEJmBsPZAAPfmNPEzxjog== dependencies: - "@lerna/prompt" "3.13.0" + "@lerna/prompt" "3.18.5" figgy-pudding "^3.5.1" "@lerna/output@3.13.0": @@ -1393,107 +1491,108 @@ dependencies: npmlog "^4.1.2" -"@lerna/pack-directory@3.14.2": - version "3.14.2" - resolved "https://registry.yarnpkg.com/@lerna/pack-directory/-/pack-directory-3.14.2.tgz#577b8ebf867c9b636a2e4659a27552ee24d83b9d" - integrity sha512-b3LnJEmIml3sDj94TQT8R+kVyrDlmE7Su0WwcBYZDySXPMSZ38WA2/2Xjy/EWhXlFxp/nUJKyUG78nDrZ/00Uw== +"@lerna/pack-directory@3.16.4": + version "3.16.4" + resolved "https://registry.yarnpkg.com/@lerna/pack-directory/-/pack-directory-3.16.4.tgz#3eae5f91bdf5acfe0384510ed53faddc4c074693" + integrity sha512-uxSF0HZeGyKaaVHz5FroDY9A5NDDiCibrbYR6+khmrhZtY0Bgn6hWq8Gswl9iIlymA+VzCbshWIMX4o2O8C8ng== dependencies: - "@lerna/get-packed" "3.13.0" - "@lerna/package" "3.14.2" - "@lerna/run-lifecycle" "3.14.0" + "@lerna/get-packed" "3.16.0" + "@lerna/package" "3.16.0" + "@lerna/run-lifecycle" "3.16.2" figgy-pudding "^3.5.1" - npm-packlist "^1.4.1" + npm-packlist "^1.4.4" npmlog "^4.1.2" - tar "^4.4.8" + tar "^4.4.10" temp-write "^3.4.0" -"@lerna/package-graph@3.14.0": - version "3.14.0" - resolved "https://registry.yarnpkg.com/@lerna/package-graph/-/package-graph-3.14.0.tgz#4ccdf446dccedfbbeb4efff3eb720cb6fcb109fc" - integrity sha512-dNpA/64STD5YXhaSlg4gT6Z474WPJVCHoX1ibsVIFu0fVgH609Y69bsdmbvTRdI7r6Dcu4ZfGxdR636RTrH+Eg== +"@lerna/package-graph@3.18.5": + version "3.18.5" + resolved "https://registry.yarnpkg.com/@lerna/package-graph/-/package-graph-3.18.5.tgz#c740e2ea3578d059e551633e950690831b941f6b" + integrity sha512-8QDrR9T+dBegjeLr+n9WZTVxUYUhIUjUgZ0gvNxUBN8S1WB9r6H5Yk56/MVaB64tA3oGAN9IIxX6w0WvTfFudA== dependencies: - "@lerna/prerelease-id-from-version" "3.14.0" + "@lerna/prerelease-id-from-version" "3.16.0" "@lerna/validation-error" "3.13.0" npm-package-arg "^6.1.0" npmlog "^4.1.2" - semver "^5.5.0" + semver "^6.2.0" -"@lerna/package@3.14.2": - version "3.14.2" - resolved "https://registry.yarnpkg.com/@lerna/package/-/package-3.14.2.tgz#f893cb42e26c869df272dafbe1dd5a3473b0bd4d" - integrity sha512-YR/+CzYdufJYfsUlrfuhTjA35iSZpXK7mVOZmeR9iRWhSaqesm4kq2zfxm9vCpZV2oAQQZOwi4eo5h0rQBtdiw== +"@lerna/package@3.16.0": + version "3.16.0" + resolved "https://registry.yarnpkg.com/@lerna/package/-/package-3.16.0.tgz#7e0a46e4697ed8b8a9c14d59c7f890e0d38ba13c" + integrity sha512-2lHBWpaxcBoiNVbtyLtPUuTYEaB/Z+eEqRS9duxpZs6D+mTTZMNy6/5vpEVSCBmzvdYpyqhqaYjjSLvjjr5Riw== dependencies: - load-json-file "^4.0.0" + load-json-file "^5.3.0" npm-package-arg "^6.1.0" write-pkg "^3.1.0" -"@lerna/prerelease-id-from-version@3.14.0": - version "3.14.0" - resolved "https://registry.yarnpkg.com/@lerna/prerelease-id-from-version/-/prerelease-id-from-version-3.14.0.tgz#d5da9c26ac4a0d0ecde09018f06e41ca4dd444c2" - integrity sha512-Ap3Z/dNhqQuSrKmK+JmzYvQYI2vowxHvUVxZJiDVilW8dyNnxkCsYFmkuZytk5sxVz4VeGLNPS2RSsU5eeSS+Q== +"@lerna/prerelease-id-from-version@3.16.0": + version "3.16.0" + resolved "https://registry.yarnpkg.com/@lerna/prerelease-id-from-version/-/prerelease-id-from-version-3.16.0.tgz#b24bfa789f5e1baab914d7b08baae9b7bd7d83a1" + integrity sha512-qZyeUyrE59uOK8rKdGn7jQz+9uOpAaF/3hbslJVFL1NqF9ELDTqjCPXivuejMX/lN4OgD6BugTO4cR7UTq/sZA== dependencies: - semver "^5.5.0" + semver "^6.2.0" -"@lerna/project@3.15.0": - version "3.15.0" - resolved "https://registry.yarnpkg.com/@lerna/project/-/project-3.15.0.tgz#733b0993a849dcf5b68fcd0ec11d8f7de38a6999" - integrity sha512-eNGUWiMbQ9kh9kGkomtMnsLypS0rfLqxKgZP2+VnNVtIXjnLv4paeTm+1lkL+naNJUwhnpMk2NSLEeoxT/20QA== +"@lerna/project@3.18.0": + version "3.18.0" + resolved "https://registry.yarnpkg.com/@lerna/project/-/project-3.18.0.tgz#56feee01daeb42c03cbdf0ed8a2a10cbce32f670" + integrity sha512-+LDwvdAp0BurOAWmeHE3uuticsq9hNxBI0+FMHiIai8jrygpJGahaQrBYWpwbshbQyVLeQgx3+YJdW2TbEdFWA== dependencies: - "@lerna/package" "3.14.2" + "@lerna/package" "3.16.0" "@lerna/validation-error" "3.13.0" cosmiconfig "^5.1.0" dedent "^0.7.0" dot-prop "^4.2.0" - glob-parent "^3.1.0" - globby "^8.0.1" - load-json-file "^4.0.0" + glob-parent "^5.0.0" + globby "^9.2.0" + load-json-file "^5.3.0" npmlog "^4.1.2" - p-map "^1.2.0" + p-map "^2.1.0" resolve-from "^4.0.0" - write-json-file "^2.3.0" + write-json-file "^3.2.0" -"@lerna/prompt@3.13.0": - version "3.13.0" - resolved "https://registry.yarnpkg.com/@lerna/prompt/-/prompt-3.13.0.tgz#53571462bb3f5399cc1ca6d335a411fe093426a5" - integrity sha512-P+lWSFokdyvYpkwC3it9cE0IF2U5yy2mOUbGvvE4iDb9K7TyXGE+7lwtx2thtPvBAfIb7O13POMkv7df03HJeA== +"@lerna/prompt@3.18.5": + version "3.18.5" + resolved "https://registry.yarnpkg.com/@lerna/prompt/-/prompt-3.18.5.tgz#628cd545f225887d060491ab95df899cfc5218a1" + integrity sha512-rkKj4nm1twSbBEb69+Em/2jAERK8htUuV8/xSjN0NPC+6UjzAwY52/x9n5cfmpa9lyKf/uItp7chCI7eDmNTKQ== dependencies: inquirer "^6.2.0" npmlog "^4.1.2" -"@lerna/publish@3.15.0": - version "3.15.0" - resolved "https://registry.yarnpkg.com/@lerna/publish/-/publish-3.15.0.tgz#54f93f8f0820d2d419d0b65df1eb55d8277090c9" - integrity sha512-6tRRBJ8olLSXfrUsR4f7vSfx0cT1oPi6/v06yI3afDSsUX6eQ3ooZh7gMY4RWmd+nM/IJHTUzhlKF6WhTvo+9g== - dependencies: - "@evocateur/libnpmaccess" "^3.1.0" - "@evocateur/npm-registry-fetch" "^3.9.1" - "@evocateur/pacote" "^9.6.0" - "@lerna/check-working-tree" "3.14.2" - "@lerna/child-process" "3.14.2" - "@lerna/collect-updates" "3.14.2" - "@lerna/command" "3.15.0" - "@lerna/describe-ref" "3.14.2" - "@lerna/log-packed" "3.13.0" - "@lerna/npm-conf" "3.13.0" - "@lerna/npm-dist-tag" "3.15.0" - "@lerna/npm-publish" "3.15.0" +"@lerna/publish@3.18.5": + version "3.18.5" + resolved "https://registry.yarnpkg.com/@lerna/publish/-/publish-3.18.5.tgz#8cc708d83a4cb7ab1c4cc020a02e7ebc4b6b0b0e" + integrity sha512-ifYqLX6mvw95T8vYRlhT68UC7Al0flQvnf5uF9lDgdrgR5Bs+BTwzk3D+0ctdqMtfooekrV6pqfW0R3gtwRffQ== + dependencies: + "@evocateur/libnpmaccess" "^3.1.2" + "@evocateur/npm-registry-fetch" "^4.0.0" + "@evocateur/pacote" "^9.6.3" + "@lerna/check-working-tree" "3.16.5" + "@lerna/child-process" "3.16.5" + "@lerna/collect-updates" "3.18.0" + "@lerna/command" "3.18.5" + "@lerna/describe-ref" "3.16.5" + "@lerna/log-packed" "3.16.0" + "@lerna/npm-conf" "3.16.0" + "@lerna/npm-dist-tag" "3.18.5" + "@lerna/npm-publish" "3.18.5" + "@lerna/otplease" "3.18.5" "@lerna/output" "3.13.0" - "@lerna/pack-directory" "3.14.2" - "@lerna/prerelease-id-from-version" "3.14.0" - "@lerna/prompt" "3.13.0" + "@lerna/pack-directory" "3.16.4" + "@lerna/prerelease-id-from-version" "3.16.0" + "@lerna/prompt" "3.18.5" "@lerna/pulse-till-done" "3.13.0" - "@lerna/run-lifecycle" "3.14.0" - "@lerna/run-topologically" "3.14.0" + "@lerna/run-lifecycle" "3.16.2" + "@lerna/run-topologically" "3.18.5" "@lerna/validation-error" "3.13.0" - "@lerna/version" "3.15.0" + "@lerna/version" "3.18.5" figgy-pudding "^3.5.1" - fs-extra "^7.0.0" + fs-extra "^8.1.0" npm-package-arg "^6.1.0" npmlog "^4.1.2" p-finally "^1.0.0" - p-map "^1.2.0" + p-map "^2.1.0" p-pipe "^1.2.0" - semver "^5.5.0" + semver "^6.2.0" "@lerna/pulse-till-done@3.13.0": version "3.13.0" @@ -1502,95 +1601,87 @@ dependencies: npmlog "^4.1.2" -"@lerna/query-graph@3.14.0": - version "3.14.0" - resolved "https://registry.yarnpkg.com/@lerna/query-graph/-/query-graph-3.14.0.tgz#2abb36f445bd924d0f85ac7aec1445e9ef1e2c6c" - integrity sha512-6YTh3vDMW2hUxHdKeRvx4bosc9lZClKaN+DzC1XKTkwDbWrsjmEzLcemKL6QnyyeuryN2f/eto7P9iSe3z3pQQ== +"@lerna/query-graph@3.18.5": + version "3.18.5" + resolved "https://registry.yarnpkg.com/@lerna/query-graph/-/query-graph-3.18.5.tgz#df4830bb5155273003bf35e8dda1c32d0927bd86" + integrity sha512-50Lf4uuMpMWvJ306be3oQDHrWV42nai9gbIVByPBYJuVW8dT8O8pA3EzitNYBUdLL9/qEVbrR0ry1HD7EXwtRA== dependencies: - "@lerna/package-graph" "3.14.0" + "@lerna/package-graph" "3.18.5" figgy-pudding "^3.5.1" -"@lerna/resolve-symlink@3.13.0": - version "3.13.0" - resolved "https://registry.yarnpkg.com/@lerna/resolve-symlink/-/resolve-symlink-3.13.0.tgz#3e6809ef53b63fe914814bfa071cd68012e22fbb" - integrity sha512-Lc0USSFxwDxUs5JvIisS8JegjA6SHSAWJCMvi2osZx6wVRkEDlWG2B1JAfXUzCMNfHoZX0/XX9iYZ+4JIpjAtg== +"@lerna/resolve-symlink@3.16.0": + version "3.16.0" + resolved "https://registry.yarnpkg.com/@lerna/resolve-symlink/-/resolve-symlink-3.16.0.tgz#37fc7095fabdbcf317c26eb74e0d0bde8efd2386" + integrity sha512-Ibj5e7njVHNJ/NOqT4HlEgPFPtPLWsO7iu59AM5bJDcAJcR96mLZ7KGVIsS2tvaO7akMEJvt2P+ErwCdloG3jQ== dependencies: - fs-extra "^7.0.0" + fs-extra "^8.1.0" npmlog "^4.1.2" read-cmd-shim "^1.0.1" -"@lerna/rimraf-dir@3.14.2": - version "3.14.2" - resolved "https://registry.yarnpkg.com/@lerna/rimraf-dir/-/rimraf-dir-3.14.2.tgz#103a49882abd85d42285d05cc76869b89f21ffd2" - integrity sha512-eFNkZsy44Bu9v1Hrj5Zk6omzg8O9h/7W6QYK1TTUHeyrjTEwytaNQlqF0lrTLmEvq55sviV42NC/8P3M2cvq8Q== +"@lerna/rimraf-dir@3.16.5": + version "3.16.5" + resolved "https://registry.yarnpkg.com/@lerna/rimraf-dir/-/rimraf-dir-3.16.5.tgz#04316ab5ffd2909657aaf388ea502cb8c2f20a09" + integrity sha512-bQlKmO0pXUsXoF8lOLknhyQjOZsCc0bosQDoX4lujBXSWxHVTg1VxURtWf2lUjz/ACsJVDfvHZbDm8kyBk5okA== dependencies: - "@lerna/child-process" "3.14.2" + "@lerna/child-process" "3.16.5" npmlog "^4.1.2" path-exists "^3.0.0" rimraf "^2.6.2" -"@lerna/run-lifecycle@3.14.0": - version "3.14.0" - resolved "https://registry.yarnpkg.com/@lerna/run-lifecycle/-/run-lifecycle-3.14.0.tgz#0499eca0e7f393faf4e24e6c8737302a9059c22b" - integrity sha512-GUM3L9MzGRSW0WQ8wbLW1+SYStU1OFjW0GBzShhBnFrO4nGRrU7VchsLpcLu0hk2uCzyhsrDKzifEdOdUyMoEQ== +"@lerna/run-lifecycle@3.16.2": + version "3.16.2" + resolved "https://registry.yarnpkg.com/@lerna/run-lifecycle/-/run-lifecycle-3.16.2.tgz#67b288f8ea964db9ea4fb1fbc7715d5bbb0bce00" + integrity sha512-RqFoznE8rDpyyF0rOJy3+KjZCeTkO8y/OB9orPauR7G2xQ7PTdCpgo7EO6ZNdz3Al+k1BydClZz/j78gNCmL2A== dependencies: - "@lerna/npm-conf" "3.13.0" + "@lerna/npm-conf" "3.16.0" figgy-pudding "^3.5.1" - npm-lifecycle "^2.1.1" + npm-lifecycle "^3.1.2" npmlog "^4.1.2" -"@lerna/run-parallel-batches@3.13.0": - version "3.13.0" - resolved "https://registry.yarnpkg.com/@lerna/run-parallel-batches/-/run-parallel-batches-3.13.0.tgz#0276bb4e7cd0995297db82d134ca2bd08d63e311" - integrity sha512-bICFBR+cYVF1FFW+Tlm0EhWDioTUTM6dOiVziDEGE1UZha1dFkMYqzqdSf4bQzfLS31UW/KBd/2z8jy2OIjEjg== +"@lerna/run-topologically@3.18.5": + version "3.18.5" + resolved "https://registry.yarnpkg.com/@lerna/run-topologically/-/run-topologically-3.18.5.tgz#3cd639da20e967d7672cb88db0f756b92f2fdfc3" + integrity sha512-6N1I+6wf4hLOnPW+XDZqwufyIQ6gqoPfHZFkfWlvTQ+Ue7CuF8qIVQ1Eddw5HKQMkxqN10thKOFfq/9NQZ4NUg== dependencies: - p-map "^1.2.0" - p-map-series "^1.0.0" - -"@lerna/run-topologically@3.14.0": - version "3.14.0" - resolved "https://registry.yarnpkg.com/@lerna/run-topologically/-/run-topologically-3.14.0.tgz#2a560cb657f0ef1565c680b6001b4b01b872dc07" - integrity sha512-y+KBpC1YExFzGynovt9MY4O/bc3RrJaKeuXieiPfKGKxrdtmZe/r33oj/xePTXZq65jnw3SaU3H8S5CrrdkwDg== - dependencies: - "@lerna/query-graph" "3.14.0" + "@lerna/query-graph" "3.18.5" figgy-pudding "^3.5.1" p-queue "^4.0.0" -"@lerna/run@3.15.0": - version "3.15.0" - resolved "https://registry.yarnpkg.com/@lerna/run/-/run-3.15.0.tgz#465028b5b561a050bd760924e4a0749de3f43172" - integrity sha512-KQBkzZYoEKmzILKjbjsm1KKVWFBXwAdwzqJWj/lfxxd3V5LRF8STASk8aiw8bSpB0bUL9TU/pbXakRxiNzjDwQ== +"@lerna/run@3.18.5": + version "3.18.5" + resolved "https://registry.yarnpkg.com/@lerna/run/-/run-3.18.5.tgz#09ae809b16445d3621249c24596cf4ae8e250d5d" + integrity sha512-1S0dZccNJO8+gT5ztYE4rHTEnbXVwThHOfDnlVt2KDxl9cbnBALk3xprGLW7lSzJsxegS849hxrAPUh0UorMgw== dependencies: - "@lerna/command" "3.15.0" - "@lerna/filter-options" "3.14.2" - "@lerna/npm-run-script" "3.14.2" + "@lerna/command" "3.18.5" + "@lerna/filter-options" "3.18.4" + "@lerna/npm-run-script" "3.16.5" "@lerna/output" "3.13.0" - "@lerna/run-topologically" "3.14.0" + "@lerna/run-topologically" "3.18.5" "@lerna/timer" "3.13.0" "@lerna/validation-error" "3.13.0" - p-map "^1.2.0" - -"@lerna/symlink-binary@3.14.2": - version "3.14.2" - resolved "https://registry.yarnpkg.com/@lerna/symlink-binary/-/symlink-binary-3.14.2.tgz#a832fdc6c4b1e5aaf9e6ac9c7e6c322746965eb0" - integrity sha512-tqMwuWi6z1da0AFFbleWyu3H9fqayiV50rjj4anFTfayel9jSjlA1xPG+56sGIP6zUUNuUSc9kLh7oRRmlauoA== - dependencies: - "@lerna/create-symlink" "3.14.0" - "@lerna/package" "3.14.2" - fs-extra "^7.0.0" - p-map "^1.2.0" - -"@lerna/symlink-dependencies@3.14.2": - version "3.14.2" - resolved "https://registry.yarnpkg.com/@lerna/symlink-dependencies/-/symlink-dependencies-3.14.2.tgz#e6b2a9544ff26addc1f4324734595e2f71dfc795" - integrity sha512-Ox7WKXnHZ7IwWlejcCq3n0Hd/yMLv8AwIryhvWxM/RauAge+ML4wg578SsdCyKob8ecgm/R0ytHiU06j81iL1w== - dependencies: - "@lerna/create-symlink" "3.14.0" - "@lerna/resolve-symlink" "3.13.0" - "@lerna/symlink-binary" "3.14.2" - fs-extra "^7.0.0" + p-map "^2.1.0" + +"@lerna/symlink-binary@3.17.0": + version "3.17.0" + resolved "https://registry.yarnpkg.com/@lerna/symlink-binary/-/symlink-binary-3.17.0.tgz#8f8031b309863814883d3f009877f82e38aef45a" + integrity sha512-RLpy9UY6+3nT5J+5jkM5MZyMmjNHxZIZvXLV+Q3MXrf7Eaa1hNqyynyj4RO95fxbS+EZc4XVSk25DGFQbcRNSQ== + dependencies: + "@lerna/create-symlink" "3.16.2" + "@lerna/package" "3.16.0" + fs-extra "^8.1.0" + p-map "^2.1.0" + +"@lerna/symlink-dependencies@3.17.0": + version "3.17.0" + resolved "https://registry.yarnpkg.com/@lerna/symlink-dependencies/-/symlink-dependencies-3.17.0.tgz#48d6360e985865a0e56cd8b51b308a526308784a" + integrity sha512-KmjU5YT1bpt6coOmdFueTJ7DFJL4H1w5eF8yAQ2zsGNTtZ+i5SGFBWpb9AQaw168dydc3s4eu0W0Sirda+F59Q== + dependencies: + "@lerna/create-symlink" "3.16.2" + "@lerna/resolve-symlink" "3.16.0" + "@lerna/symlink-binary" "3.17.0" + fs-extra "^8.1.0" p-finally "^1.0.0" - p-map "^1.2.0" + p-map "^2.1.0" p-map-series "^1.0.0" "@lerna/timer@3.13.0": @@ -1605,35 +1696,37 @@ dependencies: npmlog "^4.1.2" -"@lerna/version@3.15.0": - version "3.15.0" - resolved "https://registry.yarnpkg.com/@lerna/version/-/version-3.15.0.tgz#3c65d223d94f211312995266abb07ee6606d5f73" - integrity sha512-vReYX1NMXZ9PwzTZm97wAl/k3bmRnRZhnQi3mq/m49xTnDavq7p4sbUdFpvu8cVZNKnYS02pNIVGHrQw+K8ZCw== - dependencies: - "@lerna/check-working-tree" "3.14.2" - "@lerna/child-process" "3.14.2" - "@lerna/collect-updates" "3.14.2" - "@lerna/command" "3.15.0" - "@lerna/conventional-commits" "3.14.0" - "@lerna/github-client" "3.14.2" +"@lerna/version@3.18.5": + version "3.18.5" + resolved "https://registry.yarnpkg.com/@lerna/version/-/version-3.18.5.tgz#0c4f0c2f8d23e9c95c2aa77ad9ce5c7ef025fac0" + integrity sha512-eSMxLIDuVxZIq0JZKNih50x1IZuMmViwF59uwOGMx0hHB84N3waE8HXOF9CJXDSjeP6sHB8tS+Y+X5fFpBop2Q== + dependencies: + "@lerna/check-working-tree" "3.16.5" + "@lerna/child-process" "3.16.5" + "@lerna/collect-updates" "3.18.0" + "@lerna/command" "3.18.5" + "@lerna/conventional-commits" "3.18.5" + "@lerna/github-client" "3.16.5" "@lerna/gitlab-client" "3.15.0" "@lerna/output" "3.13.0" - "@lerna/prerelease-id-from-version" "3.14.0" - "@lerna/prompt" "3.13.0" - "@lerna/run-lifecycle" "3.14.0" - "@lerna/run-topologically" "3.14.0" + "@lerna/prerelease-id-from-version" "3.16.0" + "@lerna/prompt" "3.18.5" + "@lerna/run-lifecycle" "3.16.2" + "@lerna/run-topologically" "3.18.5" "@lerna/validation-error" "3.13.0" chalk "^2.3.1" dedent "^0.7.0" + load-json-file "^5.3.0" minimatch "^3.0.4" npmlog "^4.1.2" - p-map "^1.2.0" + p-map "^2.1.0" p-pipe "^1.2.0" p-reduce "^1.0.0" p-waterfall "^1.0.0" - semver "^5.5.0" - slash "^1.0.0" + semver "^6.2.0" + slash "^2.0.0" temp-write "^3.4.0" + write-json-file "^3.2.0" "@lerna/write-log-file@3.13.0": version "3.13.0" @@ -1646,49 +1739,83 @@ "@mrmlnc/readdir-enhanced@^2.2.1": version "2.2.1" resolved "https://registry.yarnpkg.com/@mrmlnc/readdir-enhanced/-/readdir-enhanced-2.2.1.tgz#524af240d1a360527b730475ecfa1344aa540dde" + integrity sha512-bPHp6Ji8b41szTOcaP63VlnbbO5Ny6dwAATtY6JTjh5N2OLrb5Qk/Th5cRkRQhkWCt+EJsYrNB0MiL+Gpn6e3g== dependencies: call-me-maybe "^1.0.1" glob-to-regexp "^0.3.0" +"@nodelib/fs.scandir@2.1.3": + version "2.1.3" + resolved "https://registry.yarnpkg.com/@nodelib/fs.scandir/-/fs.scandir-2.1.3.tgz#3a582bdb53804c6ba6d146579c46e52130cf4a3b" + integrity sha512-eGmwYQn3gxo4r7jdQnkrrN6bY478C3P+a/y72IJukF8LjB6ZHeB3c+Ehacj3sYeSmUXGlnA67/PmbM9CVwL7Dw== + dependencies: + "@nodelib/fs.stat" "2.0.3" + run-parallel "^1.1.9" + +"@nodelib/fs.stat@2.0.3", "@nodelib/fs.stat@^2.0.2": + version "2.0.3" + resolved "https://registry.yarnpkg.com/@nodelib/fs.stat/-/fs.stat-2.0.3.tgz#34dc5f4cabbc720f4e60f75a747e7ecd6c175bd3" + integrity sha512-bQBFruR2TAwoevBEd/NWMoAAtNGzTRgdrqnYCc7dhzfoNvqPzLyqlEQnzZ3kVnNrSp25iyxE00/3h2fqGAGArA== + "@nodelib/fs.stat@^1.1.2": version "1.1.3" resolved "https://registry.yarnpkg.com/@nodelib/fs.stat/-/fs.stat-1.1.3.tgz#2b5a3ab3f918cca48a8c754c08168e3f03eba61b" + integrity sha512-shAmDyaQC4H92APFoIaVDHCx5bStIocgvbwQyxPRrbUY20V1EYTbSDchWbuwlMG3V17cprZhA6+78JfB+3DTPw== -"@octokit/endpoint@^5.1.0": - version "5.1.2" - resolved "https://registry.yarnpkg.com/@octokit/endpoint/-/endpoint-5.1.2.tgz#45fd879e33a25ee10fa4cffc4d098ee04135afe6" - integrity sha512-bBGGmcRFq1x0jrB29G/9KjYmO3cdHfk3476B2JOHRvLsNw1Pn3l+ZvbiqtcO9qAS4Ti+zFedLB84ziHZRZclQA== +"@nodelib/fs.walk@^1.2.3": + version "1.2.4" + resolved "https://registry.yarnpkg.com/@nodelib/fs.walk/-/fs.walk-1.2.4.tgz#011b9202a70a6366e436ca5c065844528ab04976" + integrity sha512-1V9XOY4rDW0rehzbrcqAmHnz8e7SKvX27gh8Gt2WgB0+pdzdiLV83p72kZPU+jvMbS1qU5mauP2iOvO8rhmurQ== dependencies: - deepmerge "3.2.0" + "@nodelib/fs.scandir" "2.1.3" + fastq "^1.6.0" + +"@octokit/endpoint@^5.5.0": + version "5.5.1" + resolved "https://registry.yarnpkg.com/@octokit/endpoint/-/endpoint-5.5.1.tgz#2eea81e110ca754ff2de11c79154ccab4ae16b3f" + integrity sha512-nBFhRUb5YzVTCX/iAK1MgQ4uWo89Gu0TH00qQHoYRCsE12dWcG1OiLd7v2EIo2+tpUKPMOQ62QFy9hy9Vg2ULg== + dependencies: + "@octokit/types" "^2.0.0" is-plain-object "^3.0.0" - universal-user-agent "^2.1.0" - url-template "^2.0.8" + universal-user-agent "^4.0.0" -"@octokit/plugin-enterprise-rest@^2.1.1": - version "2.2.2" - resolved "https://registry.yarnpkg.com/@octokit/plugin-enterprise-rest/-/plugin-enterprise-rest-2.2.2.tgz#c0e22067a043e19f96ff9c7832e2a3019f9be75c" - integrity sha512-CTZr64jZYhGWNTDGlSJ2mvIlFsm9OEO3LqWn9I/gmoHI4jRBp4kpHoFYNemG4oA75zUAcmbuWblb7jjP877YZw== +"@octokit/plugin-enterprise-rest@^3.6.1": + version "3.6.2" + resolved "https://registry.yarnpkg.com/@octokit/plugin-enterprise-rest/-/plugin-enterprise-rest-3.6.2.tgz#74de25bef21e0182b4fa03a8678cd00a4e67e561" + integrity sha512-3wF5eueS5OHQYuAEudkpN+xVeUsg8vYEMMenEzLphUZ7PRZ8OJtDcsreL3ad9zxXmBbaFWzLmFcdob5CLyZftA== -"@octokit/request@3.0.3": - version "3.0.3" - resolved "https://registry.yarnpkg.com/@octokit/request/-/request-3.0.3.tgz#ace63b5ea196cc00ad27f3fbe5c13a9698681ec8" - integrity sha512-M7pUfsiaiiUMEP4/SMysTeWxyGrkoQg6FBPEtCBIFgeDnzHaPboTpUZGTh6u1GQXdrlzMfPVn/vQs98js1QtwQ== +"@octokit/request-error@^1.0.1", "@octokit/request-error@^1.0.2": + version "1.2.0" + resolved "https://registry.yarnpkg.com/@octokit/request-error/-/request-error-1.2.0.tgz#a64d2a9d7a13555570cd79722de4a4d76371baaa" + integrity sha512-DNBhROBYjjV/I9n7A8kVkmQNkqFAMem90dSxqvPq57e2hBr7mNTX98y3R2zDpqMQHVRpBDjsvsfIGgBzy+4PAg== dependencies: - "@octokit/endpoint" "^5.1.0" - deprecation "^1.0.1" + "@octokit/types" "^2.0.0" + deprecation "^2.0.0" + once "^1.4.0" + +"@octokit/request@^5.2.0": + version "5.3.1" + resolved "https://registry.yarnpkg.com/@octokit/request/-/request-5.3.1.tgz#3a1ace45e6f88b1be4749c5da963b3a3b4a2f120" + integrity sha512-5/X0AL1ZgoU32fAepTfEoggFinO3rxsMLtzhlUX+RctLrusn/CApJuGFCd0v7GMFhF+8UiCsTTfsu7Fh1HnEJg== + dependencies: + "@octokit/endpoint" "^5.5.0" + "@octokit/request-error" "^1.0.1" + "@octokit/types" "^2.0.0" + deprecation "^2.0.0" is-plain-object "^3.0.0" node-fetch "^2.3.0" once "^1.4.0" - universal-user-agent "^2.0.1" + universal-user-agent "^4.0.0" -"@octokit/rest@^16.16.0": - version "16.25.5" - resolved "https://registry.yarnpkg.com/@octokit/rest/-/rest-16.25.5.tgz#9268afad252f72a1e39553cf87e1aa0493e355de" - integrity sha512-xemNMkhjSBPnPR7gzGNDelRJvAOu1T9oVABUADyQ2gE9E788qgVOr/xnBPusVLlYfhX7FhGhvGiVrgho/D4pfw== +"@octokit/rest@^16.28.4": + version "16.35.0" + resolved "https://registry.yarnpkg.com/@octokit/rest/-/rest-16.35.0.tgz#7ccc1f802f407d5b8eb21768c6deca44e7b4c0d8" + integrity sha512-9ShFqYWo0CLoGYhA1FdtdykJuMzS/9H6vSbbQWDX4pWr4p9v+15MsH/wpd/3fIU+tSxylaNO48+PIHqOkBRx3w== dependencies: - "@octokit/request" "3.0.3" + "@octokit/request" "^5.2.0" + "@octokit/request-error" "^1.0.2" atob-lite "^2.0.0" - before-after-hook "^1.4.0" + before-after-hook "^2.0.0" btoa-lite "^1.0.0" deprecation "^2.0.0" lodash.get "^4.4.2" @@ -1696,25 +1823,33 @@ lodash.uniq "^4.5.0" octokit-pagination-methods "^1.1.0" once "^1.4.0" - universal-user-agent "^2.0.0" - url-template "^2.0.8" + universal-user-agent "^4.0.0" + +"@octokit/types@^2.0.0": + version "2.0.2" + resolved "https://registry.yarnpkg.com/@octokit/types/-/types-2.0.2.tgz#0888497f5a664e28b0449731d5e88e19b2a74f90" + integrity sha512-StASIL2lgT3TRjxv17z9pAqbnI7HGu9DrJlg3sEBFfCLaMEqp+O3IQPUF6EZtQ4xkAu2ml6kMBBCtGxjvmtmuQ== + dependencies: + "@types/node" ">= 8" + +"@rollup/plugin-json@4.0.1": + version "4.0.1" + resolved "https://registry.yarnpkg.com/@rollup/plugin-json/-/plugin-json-4.0.1.tgz#223898c6c37993886da06989b0e93ceef52aa3ce" + integrity sha512-soxllkhOGgchswBAAaTe7X9G80U2tjjHvXv0sBrriLJcC/89PkP59iTrKPOfbz3SjX088mKDmMhAscuyLz8ZSg== + dependencies: + rollup-pluginutils "^2.5.0" "@samverschueren/stream-to-observable@^0.3.0": version "0.3.0" resolved "https://registry.yarnpkg.com/@samverschueren/stream-to-observable/-/stream-to-observable-0.3.0.tgz#ecdf48d532c58ea477acfcab80348424f8d0662f" + integrity sha512-MI4Xx6LHs4Webyvi6EbspgyAb4D2Q2VtnCQ1blOJcoLS6mVa8lNN2rkIy1CVxfTUpoyIbCTkXES1rLXztFD1lg== dependencies: any-observable "^0.3.0" -"@types/acorn@^4.0.2": - version "4.0.3" - resolved "https://registry.yarnpkg.com/@types/acorn/-/acorn-4.0.3.tgz#d1f3e738dde52536f9aad3d3380d14e448820afd" - dependencies: - "@types/estree" "*" - "@types/babel__core@^7.1.0": - version "7.1.0" - resolved "https://registry.yarnpkg.com/@types/babel__core/-/babel__core-7.1.0.tgz#710f2487dda4dcfd010ca6abb2b4dc7394365c51" - integrity sha512-wJTeJRt7BToFx3USrCDs2BhEi4ijBInTQjOIukj6a/5tEkwpFMVZ+1ppgmE+Q/FQyc5P/VWUbx7I9NELrKruHA== + version "7.1.3" + resolved "https://registry.yarnpkg.com/@types/babel__core/-/babel__core-7.1.3.tgz#e441ea7df63cd080dfcd02ab199e6d16a735fc30" + integrity sha512-8fBo0UR2CcwWxeX7WIIgJ7lXjasFxoYgRnFHUj+hRvKkpiBJbxhdAPTCY6/ZKM0uxANFVzt4yObSLuTiTnazDA== dependencies: "@babel/parser" "^7.1.0" "@babel/types" "^7.0.0" @@ -1723,9 +1858,9 @@ "@types/babel__traverse" "*" "@types/babel__generator@*": - version "7.0.2" - resolved "https://registry.yarnpkg.com/@types/babel__generator/-/babel__generator-7.0.2.tgz#d2112a6b21fad600d7674274293c85dce0cb47fc" - integrity sha512-NHcOfab3Zw4q5sEE2COkpfXjoE7o+PmqD9DQW4koUT3roNxwziUdXGnRndMat/LJNUtePwn1TlP4do3uoe3KZQ== + version "7.6.0" + resolved "https://registry.yarnpkg.com/@types/babel__generator/-/babel__generator-7.6.0.tgz#f1ec1c104d1bb463556ecb724018ab788d0c172a" + integrity sha512-c1mZUu4up5cp9KROs/QAw0gTeHrw/x7m52LcnvMxxOZ03DmLwPV0MlGmlgzV3cnSdjhJOZsj7E7FHeioai+egw== dependencies: "@babel/types" "^7.0.0" @@ -1738,39 +1873,40 @@ "@babel/types" "^7.0.0" "@types/babel__traverse@*", "@types/babel__traverse@^7.0.6": - version "7.0.6" - resolved "https://registry.yarnpkg.com/@types/babel__traverse/-/babel__traverse-7.0.6.tgz#328dd1a8fc4cfe3c8458be9477b219ea158fd7b2" - integrity sha512-XYVgHF2sQ0YblLRMLNPB3CkFMewzFmlDsH/TneZFHUXDlABQgh88uOxuez7ZcXxayLFrqLwtDH1t+FmlFwNZxw== + version "7.0.8" + resolved "https://registry.yarnpkg.com/@types/babel__traverse/-/babel__traverse-7.0.8.tgz#479a4ee3e291a403a1096106013ec22cf9b64012" + integrity sha512-yGeB2dHEdvxjP0y4UbRtQaSkXJ9649fYCmIdRoul5kfAoGCwxuCbMhag0k3RPfnuh9kPGm8x89btcfDEXdVWGw== dependencies: "@babel/types" "^7.3.0" -"@types/cheerio@^0.22.1": - version "0.22.7" - resolved "https://registry.yarnpkg.com/@types/cheerio/-/cheerio-0.22.7.tgz#4a92eafedfb2b9f4437d3a4410006d81114c66ce" - -"@types/debug@^0.0.29": - version "0.0.29" - resolved "https://registry.yarnpkg.com/@types/debug/-/debug-0.0.29.tgz#a1e514adfbd92f03a224ba54d693111dbf1f3754" - -"@types/enhanced-resolve@^3.0.3": - version "3.0.4" - resolved "https://registry.yarnpkg.com/@types/enhanced-resolve/-/enhanced-resolve-3.0.4.tgz#d93cb91b0b14dbcba0f45948bed73db9456697c2" - dependencies: - "@types/node" "*" - "@types/tapable" "*" +"@types/color-name@^1.1.1": + version "1.1.1" + resolved "https://registry.yarnpkg.com/@types/color-name/-/color-name-1.1.1.tgz#1c1261bbeaa10a8055bbc5d8ab84b7b2afc846a0" + integrity sha512-rr+OQyAjxze7GgWrSaJwydHStIhHq2lvY3BOC2Mj7KnzI7XK0Uw1TOOdI9lDoajEbSWLiYgoo4f1R51erQfhPQ== -"@types/escape-string-regexp@^0.0.30": - version "0.0.30" - resolved "https://registry.yarnpkg.com/@types/escape-string-regexp/-/escape-string-regexp-0.0.30.tgz#8cfaf0b5d2e46943d6efd77d3f4d18bfa1c9f225" +"@types/estree@*": + version "0.0.40" + resolved "https://registry.yarnpkg.com/@types/estree/-/estree-0.0.40.tgz#0e6cb9b9bbd098031fa19e4b4e8131bc70e5de13" + integrity sha512-p3KZgMto/JyxosKGmnLDJ/dG5wf+qTRMUjHJcspC2oQKa4jP7mz+tv0ND56lLBu3ojHlhzY33Ol+khLyNmilkA== -"@types/estree@*", "@types/estree@0.0.39": +"@types/estree@0.0.39": version "0.0.39" resolved "https://registry.yarnpkg.com/@types/estree/-/estree-0.0.39.tgz#e177e699ee1b8c22d23174caaa7422644389509f" integrity sha512-EYNwp3bU+98cpU4lAWYYL7Zz+2gryWH1qbdDTidVd6hkiR6weksdbMadyXKXNPEkQFhXM+hVO9ZygomHXp+AIw== -"@types/estree@0.0.35": - version "0.0.35" - resolved "https://registry.yarnpkg.com/@types/estree/-/estree-0.0.35.tgz#8999974b34028686a8d61a719e61c138d3755107" +"@types/events@*": + version "3.0.0" + resolved "https://registry.yarnpkg.com/@types/events/-/events-3.0.0.tgz#2862f3f58a9a7f7c3e78d79f130dd4d71c25c2a7" + integrity sha512-EaObqwIvayI5a8dCzhFrjKzVwKLxjoG9T6Ppd5CEo07LRKfQ8Yokw54r5+Wq7FaBQ+yXRvQAYPrHwya1/UFt9g== + +"@types/glob@^7.1.1": + version "7.1.1" + resolved "https://registry.yarnpkg.com/@types/glob/-/glob-7.1.1.tgz#aa59a1c6e3fbc421e07ccd31a944c30eba521575" + integrity sha512-1Bh06cbWJUHMC97acuD6UMG29nMt0Aqz1vF3guLfG+kHHJhy3AyohZFFxYk2f7Q1SQIrNwvncxAE0N/9s70F2w== + dependencies: + "@types/events" "*" + "@types/minimatch" "*" + "@types/node" "*" "@types/istanbul-lib-coverage@*", "@types/istanbul-lib-coverage@^2.0.0": version "2.0.1" @@ -1792,18 +1928,20 @@ "@types/istanbul-lib-coverage" "*" "@types/istanbul-lib-report" "*" -"@types/lodash@^4.14.67": - version "4.14.104" - resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.14.104.tgz#53ee2357fa2e6e68379341d92eb2ecea4b11bb80" +"@types/json-schema@^7.0.3": + version "7.0.4" + resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.4.tgz#38fd73ddfd9b55abb1e1b2ed578cb55bd7b7d339" + integrity sha512-8+KAKzEvSUdeo+kmqnKrqgeE+LcA0tjYWFY7RPProVYwnqDjukzO+3b6dLD56rYX5TdWejnEOLJYOIeh4CXKuA== -"@types/node@*", "@types/node@^12.0.2": - version "12.0.2" - resolved "https://registry.yarnpkg.com/@types/node/-/node-12.0.2.tgz#3452a24edf9fea138b48fad4a0a028a683da1e40" - integrity sha512-5tabW/i+9mhrfEOUcLDu2xBPsHJ+X5Orqy9FKpale3SjDA17j5AEpYq5vfy3oAeAHGcvANRCO3NV3d2D6q3NiA== +"@types/minimatch@*": + version "3.0.3" + resolved "https://registry.yarnpkg.com/@types/minimatch/-/minimatch-3.0.3.tgz#3dca0e3f33b200fc7d1139c0cd96c1268cadfd9d" + integrity sha512-tHq6qdbT9U1IRSGf14CL0pUlULksvY9OZ+5eEgl1N7t+OA3tGvNpxJCzuKQlsNgCVwbAs670L1vcVQi8j9HjnA== -"@types/node@^8.0.0": - version "8.9.4" - resolved "https://registry.yarnpkg.com/@types/node/-/node-8.9.4.tgz#dfd327582a06c114eb6e0441fa3d6fab35edad48" +"@types/node@*", "@types/node@>= 8": + version "12.12.15" + resolved "https://registry.yarnpkg.com/@types/node/-/node-12.12.15.tgz#8dfb6ce22fedd469128137640a3aa8f17415422f" + integrity sha512-Pv+vWicyFd07Hw/SmNnTUguqrHgDfMtjabvD9sQyxeqbpCEg8CmViLBaVPHtNsoBgZECrRf5/pgV6FJIBrGSjw== "@types/normalize-package-data@^2.4.0": version "2.4.0" @@ -1817,147 +1955,186 @@ dependencies: "@types/node" "*" -"@types/semver@^5.3.32": - version "5.5.0" - resolved "https://registry.yarnpkg.com/@types/semver/-/semver-5.5.0.tgz#146c2a29ee7d3bae4bf2fcb274636e264c813c45" - "@types/stack-utils@^1.0.1": version "1.0.1" resolved "https://registry.yarnpkg.com/@types/stack-utils/-/stack-utils-1.0.1.tgz#0a851d3bd96498fa25c33ab7278ed3bd65f06c3e" integrity sha512-l42BggppR6zLmpfU6fq9HEa2oGPEI8yrSPL3GITjfRInppYFahObbIQOQK3UGxEnyQpltZLaPe75046NOZQikw== -"@types/tapable@*": - version "0.2.4" - resolved "https://registry.yarnpkg.com/@types/tapable/-/tapable-0.2.4.tgz#8181a228da46185439300e600c5ae3b3b3982585" +"@types/yargs-parser@*": + version "13.1.0" + resolved "https://registry.yarnpkg.com/@types/yargs-parser/-/yargs-parser-13.1.0.tgz#c563aa192f39350a1d18da36c5a8da382bbd8228" + integrity sha512-gCubfBUZ6KxzoibJ+SCUc/57Ms1jz5NjHe4+dI2krNmU5zCPAphyLJYyTOg06ueIyfj+SaCUqmzun7ImlxDcKg== -"@types/uglify-js@*": - version "2.6.30" - resolved "https://registry.yarnpkg.com/@types/uglify-js/-/uglify-js-2.6.30.tgz#257d2b6dd86673d60da476680fba90f2e30c6eef" +"@types/yargs@^13.0.0": + version "13.0.3" + resolved "https://registry.yarnpkg.com/@types/yargs/-/yargs-13.0.3.tgz#76482af3981d4412d65371a318f992d33464a380" + integrity sha512-K8/LfZq2duW33XW/tFwEAfnZlqIfVsoyRB3kfXdPXYhl0nfM8mmh7GS0jg7WrX2Dgq/0Ha/pR1PaR+BvmWwjiQ== dependencies: - source-map "^0.6.1" + "@types/yargs-parser" "*" -"@types/webpack@^3.0.0": - version "3.8.8" - resolved "https://registry.yarnpkg.com/@types/webpack/-/webpack-3.8.8.tgz#fd9483edf2d6935eaab52aa530b1f737c188cd9a" +"@typescript-eslint/experimental-utils@^2.5.0": + version "2.19.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/experimental-utils/-/experimental-utils-2.19.0.tgz#d5ca732f22c009e515ba09fcceb5f2127d841568" + integrity sha512-zwpg6zEOPbhB3+GaQfufzlMUOO6GXCNZq6skk+b2ZkZAIoBhVoanWK255BS1g5x9bMwHpLhX0Rpn5Fc3NdCZdg== dependencies: - "@types/node" "*" - "@types/tapable" "*" - "@types/uglify-js" "*" - source-map "^0.6.0" + "@types/json-schema" "^7.0.3" + "@typescript-eslint/typescript-estree" "2.19.0" + eslint-scope "^5.0.0" -"@types/yargs@^12.0.2", "@types/yargs@^12.0.9": - version "12.0.9" - resolved "https://registry.yarnpkg.com/@types/yargs/-/yargs-12.0.9.tgz#693e76a52f61a2f1e7fb48c0eef167b95ea4ffd0" - integrity sha512-sCZy4SxP9rN2w30Hlmg5dtdRwgYQfYRiLo9usw8X9cxlf+H4FqM1xX7+sNH7NNKVdbXMJWqva7iyy+fxh/V7fA== +"@typescript-eslint/typescript-estree@2.19.0": + version "2.19.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-2.19.0.tgz#6bd7310b9827e04756fe712909f26956aac4b196" + integrity sha512-n6/Xa37k0jQdwpUszffi19AlNbVCR0sdvCs3DmSKMD7wBttKY31lhD2fug5kMD91B2qW4mQldaTEc1PEzvGu8w== + dependencies: + debug "^4.1.1" + eslint-visitor-keys "^1.1.0" + glob "^7.1.6" + is-glob "^4.0.1" + lodash "^4.17.15" + semver "^6.3.0" + tsutils "^3.17.1" + +"@zkochan/cmd-shim@^3.1.0": + version "3.1.0" + resolved "https://registry.yarnpkg.com/@zkochan/cmd-shim/-/cmd-shim-3.1.0.tgz#2ab8ed81f5bb5452a85f25758eb9b8681982fd2e" + integrity sha512-o8l0+x7C7sMZU3v9GuJIAU10qQLtwR1dtRQIOmlNMtyaqhmpXOzx1HWiYoWfmmf9HHZoAkXpc9TM9PQYF9d4Jg== + dependencies: + is-windows "^1.0.0" + mkdirp-promise "^5.0.1" + mz "^2.5.0" JSONStream@^1.0.3, JSONStream@^1.0.4, JSONStream@^1.3.4: version "1.3.5" resolved "https://registry.yarnpkg.com/JSONStream/-/JSONStream-1.3.5.tgz#3208c1f08d3a4d99261ab64f92302bc15e111ca0" + integrity sha512-E+iruNOY8VV9s4JEbe1aNEm6MiszPRr/UfcHMz0TQh1BXSxHK+ASV1R6W4HpjBhSeS+54PIsAMCBmwD06LLsqQ== dependencies: jsonparse "^1.2.0" through ">=2.2.7 <3" -abab@^1.0.4: - version "1.0.4" - resolved "https://registry.yarnpkg.com/abab/-/abab-1.0.4.tgz#5faad9c2c07f60dd76770f71cf025b62a63cfd4e" +abab@^2.0.0: + version "2.0.3" + resolved "https://registry.yarnpkg.com/abab/-/abab-2.0.3.tgz#623e2075e02eb2d3f2475e49f99c91846467907a" + integrity sha512-tsFzPpcttalNjFBCFMqsKYQcWxxen1pgJR56by//QwvJc4/OUS3kPOOttx2tSIfjsylB0pYu7f5D3K1RCxUnUg== abbrev@1: version "1.1.1" resolved "https://registry.yarnpkg.com/abbrev/-/abbrev-1.1.1.tgz#f8f2c887ad10bf67f634f005b6987fed3179aac8" + integrity sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q== -acorn-dynamic-import@^2.0.0: - version "2.0.2" - resolved "https://registry.yarnpkg.com/acorn-dynamic-import/-/acorn-dynamic-import-2.0.2.tgz#c752bd210bef679501b6c6cb7fc84f8f47158cc4" +abstract-leveldown@~0.12.0, abstract-leveldown@~0.12.1: + version "0.12.4" + resolved "https://registry.yarnpkg.com/abstract-leveldown/-/abstract-leveldown-0.12.4.tgz#29e18e632e60e4e221d5810247852a63d7b2e410" + integrity sha1-KeGOYy5g5OIh1YECR4UqY9ey5BA= dependencies: - acorn "^4.0.3" - -acorn-dynamic-import@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/acorn-dynamic-import/-/acorn-dynamic-import-4.0.0.tgz#482210140582a36b83c3e342e1cfebcaa9240948" + xtend "~3.0.0" acorn-globals@^4.1.0: - version "4.1.0" - resolved "https://registry.yarnpkg.com/acorn-globals/-/acorn-globals-4.1.0.tgz#ab716025dbe17c54d3ef81d32ece2b2d99fe2538" + version "4.3.4" + resolved "https://registry.yarnpkg.com/acorn-globals/-/acorn-globals-4.3.4.tgz#9fa1926addc11c97308c4e66d7add0d40c3272e7" + integrity sha512-clfQEh21R+D0leSbUdWf3OcfqyaCSAQ8Ryq00bofSekfr9W8u1jyYZo6ir0xu9Gtcf7BjcHJpnbZH7JOCpP60A== dependencies: - acorn "^5.0.0" + acorn "^6.0.1" + acorn-walk "^6.0.1" -acorn-jsx@^5.0.0: - version "5.0.1" - resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-5.0.1.tgz#32a064fd925429216a09b141102bfdd185fae40e" +acorn-jsx@^5.1.0: + version "5.1.0" + resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-5.1.0.tgz#294adb71b57398b0680015f0a38c563ee1db5384" + integrity sha512-tMUqwBWfLFbJbizRmEcWSLw6HnFzfdJs2sOJEOwwtVPMoH/0Ay+E703oZz78VSXZiiDcZrQ5XKjPIUQixhmgVw== -acorn-node@^1.2.0, acorn-node@^1.3.0: - version "1.6.2" - resolved "https://registry.yarnpkg.com/acorn-node/-/acorn-node-1.6.2.tgz#b7d7ceca6f22e6417af933a62cad4de01048d5d2" +acorn-node@^1.2.0, acorn-node@^1.3.0, acorn-node@^1.5.2, acorn-node@^1.6.1: + version "1.8.2" + resolved "https://registry.yarnpkg.com/acorn-node/-/acorn-node-1.8.2.tgz#114c95d64539e53dede23de8b9d96df7c7ae2af8" + integrity sha512-8mt+fslDufLYntIoPAaIMUe/lrbrehIiwmR3t2k9LljIzoigEPF27eLk2hy8zSGzmR/ogr7zbRKINMo1u0yh5A== dependencies: - acorn "^6.0.2" - acorn-dynamic-import "^4.0.0" - acorn-walk "^6.1.0" - xtend "^4.0.1" + acorn "^7.0.0" + acorn-walk "^7.0.0" + xtend "^4.0.2" -acorn-walk@^6.1.0: - version "6.1.1" - resolved "https://registry.yarnpkg.com/acorn-walk/-/acorn-walk-6.1.1.tgz#d363b66f5fac5f018ff9c3a1e7b6f8e310cc3913" +acorn-walk@^6.0.1: + version "6.2.0" + resolved "https://registry.yarnpkg.com/acorn-walk/-/acorn-walk-6.2.0.tgz#123cb8f3b84c2171f1f7fb252615b1c78a6b1a8c" + integrity sha512-7evsyfH1cLOCdAzZAd43Cic04yKydNx0cF+7tiA19p1XnLLPU4dpCQOqpjqwokFe//vS0QqfqqjCS2JkiIs0cA== + +acorn-walk@^7.0.0: + version "7.0.0" + resolved "https://registry.yarnpkg.com/acorn-walk/-/acorn-walk-7.0.0.tgz#c8ba6f0f1aac4b0a9e32d1f0af12be769528f36b" + integrity sha512-7Bv1We7ZGuU79zZbb6rRqcpxo3OY+zrdtloZWoyD8fmGX+FeXRjE+iuGkZjSXLVovLzrsvMGMy0EkwA0E0umxg== acorn@^4.0.3: version "4.0.13" resolved "https://registry.yarnpkg.com/acorn/-/acorn-4.0.13.tgz#105495ae5361d697bd195c825192e1ad7f253787" + integrity sha1-EFSVrlNh1pe9GVyCUZLhrX8lN4c= -acorn@^5.0.0, acorn@^5.0.3, acorn@^5.3.0: - version "5.5.0" - resolved "https://registry.yarnpkg.com/acorn/-/acorn-5.5.0.tgz#1abb587fbf051f94e3de20e6b26ef910b1828298" +acorn@^5.0.0, acorn@^5.5.3, acorn@^5.7.3: + version "5.7.4" + resolved "https://registry.yarnpkg.com/acorn/-/acorn-5.7.4.tgz#3e8d8a9947d0599a1796d10225d7432f4a4acf5e" + integrity sha512-1D++VG7BhrtvQpNbBzovKNc1FLGGEE/oGe7b9xJm/RFHMBeUaUGpluV9RLjZa47YFdPcDAenEYuq9pQPcMdLJg== -acorn@^6.0.2, acorn@^6.0.7, acorn@^6.1.1: - version "6.1.1" - resolved "https://registry.yarnpkg.com/acorn/-/acorn-6.1.1.tgz#7d25ae05bb8ad1f9b699108e1094ecd7884adc1f" - integrity sha512-jPTiwtOxaHNaAPg/dmrJ/beuzLRnXtB0kQPQ8JpotKJgTB6rX6c8mlf315941pyjBSaPg8NHXS9fhP4u17DpGA== +acorn@^6.0.1: + version "6.4.1" + resolved "https://registry.yarnpkg.com/acorn/-/acorn-6.4.1.tgz#531e58ba3f51b9dacb9a6646ca4debf5b14ca474" + integrity sha512-ZVA9k326Nwrj3Cj9jlh3wGFutC2ZornPNARZwsNYqQYgN0EsV2d53w5RN/co65Ohn4sUAUtb1rSUAOD6XN9idA== + +acorn@^7.0.0, acorn@^7.1.0: + version "7.1.1" + resolved "https://registry.yarnpkg.com/acorn/-/acorn-7.1.1.tgz#e35668de0b402f359de515c5482a1ab9f89a69bf" + integrity sha512-add7dgA5ppRPxCFJoAGfMDi7PIBXq1RtGo7BhbLaxwrXPOmw8gq48Y9ozT01hUKy9byMjlR20EJhu5zlkErEkg== -agent-base@4, agent-base@^4.1.0, agent-base@~4.2.0: +agent-base@4, agent-base@^4.3.0: + version "4.3.0" + resolved "https://registry.yarnpkg.com/agent-base/-/agent-base-4.3.0.tgz#8165f01c436009bccad0b1d122f05ed770efc6ee" + integrity sha512-salcGninV0nPrwpGNn4VTXBb1SOuXQBiqbrNXoeizJsHrsL6ERFM2Ne3JUSBWRE6aeNJI2ROP/WEEIDUiDe3cg== + dependencies: + es6-promisify "^5.0.0" + +agent-base@~4.2.1: version "4.2.1" resolved "https://registry.yarnpkg.com/agent-base/-/agent-base-4.2.1.tgz#d89e5999f797875674c07d87f260fc41e83e8ca9" + integrity sha512-JVwXMr9nHYTUXsBFKUqhJwvlcYU/blreOEUkhNR2eXZIvwd+c+o5V4MgDPKWnMS/56awN3TRzIP+KoPn+roQtg== dependencies: es6-promisify "^5.0.0" agentkeepalive@^3.4.1: version "3.5.2" resolved "https://registry.yarnpkg.com/agentkeepalive/-/agentkeepalive-3.5.2.tgz#a113924dd3fa24a0bc3b78108c450c2abee00f67" + integrity sha512-e0L/HNe6qkQ7H19kTlRRqUibEAwDK5AFk6y3PtMsuut2VAH6+Q4xZml1tNDJD7kSAyqmbG/K08K5WEJYtUrSlQ== dependencies: humanize-ms "^1.2.1" -ajv-keywords@^3.1.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/ajv-keywords/-/ajv-keywords-3.1.0.tgz#ac2b27939c543e95d2c06e7f7f5c27be4aa543be" +aggregate-error@^3.0.0: + version "3.0.1" + resolved "https://registry.yarnpkg.com/aggregate-error/-/aggregate-error-3.0.1.tgz#db2fe7246e536f40d9b5442a39e117d7dd6a24e0" + integrity sha512-quoaXsZ9/BLNae5yiNoUz+Nhkwz83GhWwtYFglcjEQB2NDHCIpApbqXxIFnm4Pq/Nvhrsq5sYJFyohrrxnTGAA== + dependencies: + clean-stack "^2.0.0" + indent-string "^4.0.0" -ajv@^6.1.0, ajv@^6.5.5, ajv@^6.9.1: - version "6.9.2" - resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.9.2.tgz#4927adb83e7f48e5a32b45729744c71ec39c9c7b" - integrity sha512-4UFy0/LgDo7Oa/+wOAlj44tp9K78u38E5/359eSrqEp1Z5PdVfimCcs7SluXMP755RUQu6d2b4AvF0R1C9RZjg== +ajv@^6.10.0, ajv@^6.10.2, ajv@^6.5.5: + version "6.10.2" + resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.10.2.tgz#d3cea04d6b017b2894ad69040fec8b623eb4bd52" + integrity sha512-TXtUUEYHuaTEbLZWIKUr5pmBuhDLy+8KYtPYdcV8qC+pOZL+NKqYwvWSRrVXHn+ZmRRAu8vJTAznH7Oag6RVRw== dependencies: fast-deep-equal "^2.0.1" fast-json-stable-stringify "^2.0.0" json-schema-traverse "^0.4.1" uri-js "^4.2.2" -align-text@^0.1.1, align-text@^0.1.3: - version "0.1.4" - resolved "https://registry.yarnpkg.com/align-text/-/align-text-0.1.4.tgz#0cd90a561093f35d0a99256c22b7069433fad117" - dependencies: - kind-of "^3.0.2" - longest "^1.0.1" - repeat-string "^1.5.2" - amdefine@>=0.0.4: version "1.0.1" resolved "https://registry.yarnpkg.com/amdefine/-/amdefine-1.0.1.tgz#4a5282ac164729e93619bcfd3ad151f817ce91f5" + integrity sha1-SlKCrBZHKek2Gbz9OtFR+BfOkfU= -ansi-colors@1.1.0, ansi-colors@^1.0.1: +ansi-colors@^1.0.1: version "1.1.0" resolved "https://registry.yarnpkg.com/ansi-colors/-/ansi-colors-1.1.0.tgz#6374b4dd5d4718ff3ce27a671a3b1cad077132a9" + integrity sha512-SFKX67auSNoVR38N3L+nvsPjOE0bybKTYbkf5tRvushrAPQ9V75huw0ZxBkKVeRU9kqH3d6HA4xTckbwZ4ixmA== dependencies: ansi-wrap "^0.1.0" ansi-cyan@^0.1.1: version "0.1.1" resolved "https://registry.yarnpkg.com/ansi-cyan/-/ansi-cyan-0.1.1.tgz#538ae528af8982f28ae30d86f2f17456d2609873" + integrity sha1-U4rlKK+JgvKK4w2G8vF0VtJgmHM= dependencies: ansi-wrap "0.1.0" @@ -1966,58 +2143,86 @@ ansi-escapes@^3.0.0, ansi-escapes@^3.2.0: resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-3.2.0.tgz#8780b98ff9dbf5638152d1f1fe5c1d7b4442976b" integrity sha512-cBhpre4ma+U0T1oM5fXg7Dy1Jw7zzwv7lt/GoCpr+hDQJoYnKVPLL4dCvSEFMmQurOQvSrwT7SL/DAlhBI97RQ== +ansi-escapes@^4.2.1: + version "4.3.0" + resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-4.3.0.tgz#a4ce2b33d6b214b7950d8595c212f12ac9cc569d" + integrity sha512-EiYhwo0v255HUL6eDyuLrXEkTi7WwVCLAw+SeOQ7M7qdun1z1pum4DEm/nuqIVbPvi9RPPc9k9LbyBv6H0DwVg== + dependencies: + type-fest "^0.8.1" + ansi-gray@^0.1.1: version "0.1.1" resolved "https://registry.yarnpkg.com/ansi-gray/-/ansi-gray-0.1.1.tgz#2962cf54ec9792c48510a3deb524436861ef7251" + integrity sha1-KWLPVOyXksSFEKPetSRDaGHvclE= dependencies: ansi-wrap "0.1.0" ansi-red@^0.1.1: version "0.1.1" resolved "https://registry.yarnpkg.com/ansi-red/-/ansi-red-0.1.1.tgz#8c638f9d1080800a353c9c28c8a81ca4705d946c" + integrity sha1-jGOPnRCAgAo1PJwoyKgcpHBdlGw= dependencies: ansi-wrap "0.1.0" ansi-regex@^2.0.0: version "2.1.1" resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-2.1.1.tgz#c3b33ab5ee360d86e0e628f0468ae7ef27d654df" + integrity sha1-w7M6te42DYbg5ijwRorn7yfWVN8= ansi-regex@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-3.0.0.tgz#ed0317c322064f79466c02966bddb605ab37d998" + integrity sha1-7QMXwyIGT3lGbAKWa922Bas32Zg= -ansi-regex@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-4.0.0.tgz#70de791edf021404c3fd615aa89118ae0432e5a9" +ansi-regex@^4.0.0, ansi-regex@^4.1.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-4.1.0.tgz#8b9f8f08cf1acb843756a839ca8c7e3168c51997" + integrity sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg== + +ansi-regex@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-5.0.0.tgz#388539f55179bf39339c81af30a654d69f87cb75" + integrity sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg== ansi-styles@^2.2.1: version "2.2.1" resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-2.2.1.tgz#b432dd3358b634cf75e1e4664368240533c1ddbe" + integrity sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4= ansi-styles@^3.2.0, ansi-styles@^3.2.1: version "3.2.1" resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-3.2.1.tgz#41fbb20243e50b12be0f04b8dedbf07520ce841d" + integrity sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA== dependencies: color-convert "^1.9.0" +ansi-styles@^4.0.0: + version "4.2.1" + resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-4.2.1.tgz#90ae75c424d008d2624c5bf29ead3177ebfcf359" + integrity sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA== + dependencies: + "@types/color-name" "^1.1.1" + color-convert "^2.0.1" + ansi-wrap@0.1.0, ansi-wrap@^0.1.0: version "0.1.0" resolved "https://registry.yarnpkg.com/ansi-wrap/-/ansi-wrap-0.1.0.tgz#a82250ddb0015e9a27ca82e82ea603bbfa45efaf" + integrity sha1-qCJQ3bABXponyoLoLqYDu/pF768= any-observable@^0.3.0: version "0.3.0" resolved "https://registry.yarnpkg.com/any-observable/-/any-observable-0.3.0.tgz#af933475e5806a67d0d7df090dd5e8bef65d119b" + integrity sha512-/FQM1EDkTsf63Ub2C6O7GuYFDsSXUwsaZDurV0np41ocwq0jthUAYCmhBX9f+KwlaCgIuWyr/4WlUQUBfKfZog== -anymatch@^1.3.0: - version "1.3.2" - resolved "https://registry.yarnpkg.com/anymatch/-/anymatch-1.3.2.tgz#553dcb8f91e3c889845dfdba34c77721b90b9d7a" - dependencies: - micromatch "^2.1.5" - normalize-path "^2.0.0" +any-promise@^1.0.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/any-promise/-/any-promise-1.3.0.tgz#abc6afeedcea52e809cdc0376aed3ce39635d17f" + integrity sha1-q8av7tzqUugJzcA3au0845Y10X8= anymatch@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/anymatch/-/anymatch-2.0.0.tgz#bcb24b4f37934d9aa7ac17b4adaf89e7c76ef2eb" + integrity sha512-5teOsQWABXHHBFP9y3skS5P3d/WfWXpv3FUpy+LorMrNYaT9pI4oLMQX7jzQ2KklNpGpWHzdCXTDT2Y3XGlZBw== dependencies: micromatch "^3.1.4" normalize-path "^2.1.1" @@ -2025,24 +2230,29 @@ anymatch@^2.0.0: append-buffer@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/append-buffer/-/append-buffer-1.0.2.tgz#d8220cf466081525efea50614f3de6514dfa58f1" + integrity sha1-2CIM9GYIFSXv6lBhTz3mUU36WPE= dependencies: buffer-equal "^1.0.0" aproba@^1.0.3, aproba@^1.1.1: version "1.2.0" resolved "https://registry.yarnpkg.com/aproba/-/aproba-1.2.0.tgz#6802e6264efd18c790a1b0d517f0f2627bf2c94a" + integrity sha512-Y9J6ZjXtoYh8RnXVCMOU/ttDmk1aBjunq9vO0ta5x85WDQiQfUF9sIPBITdbiiIVcBo03Hi3jMxigBtsddlXRw== aproba@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/aproba/-/aproba-2.0.0.tgz#52520b8ae5b569215b354efc0caa3fe1e45a8adc" + integrity sha512-lYe4Gx7QT+MKGbDsA+Z+he/Wtef0BiwDOlK/XkBrdfsh9J/jPPXbX0tE9x9cl27Tmu5gg3QUbUrQYa/y+KOHPQ== archy@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/archy/-/archy-1.0.0.tgz#f9c8c13757cc1dd7bc379ac77b2c62a5c2868c40" + integrity sha1-+cjBN1fMHde8N5rHeyxipcKGjEA= are-we-there-yet@~1.1.2: - version "1.1.4" - resolved "https://registry.yarnpkg.com/are-we-there-yet/-/are-we-there-yet-1.1.4.tgz#bb5dca382bb94f05e15194373d16fd3ba1ca110d" + version "1.1.5" + resolved "https://registry.yarnpkg.com/are-we-there-yet/-/are-we-there-yet-1.1.5.tgz#4b35c2944f062a8bfcda66410760350fe9ddfc21" + integrity sha512-5hYdAkZlcG8tOLujVDTgCT+uPX0VnpAH28gWsLfzpXYm7wP6mp5Q/gYyR7YQ0cKVJcXJnl3j2kpBan13PtQf6w== dependencies: delegates "^1.0.0" readable-stream "^2.0.6" @@ -2050,73 +2260,81 @@ are-we-there-yet@~1.1.2: argparse@^1.0.7: version "1.0.10" resolved "https://registry.yarnpkg.com/argparse/-/argparse-1.0.10.tgz#bcd6791ea5ae09725e17e5ad988134cd40b3d911" + integrity sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg== dependencies: sprintf-js "~1.0.2" arr-diff@^1.0.1: version "1.1.0" resolved "https://registry.yarnpkg.com/arr-diff/-/arr-diff-1.1.0.tgz#687c32758163588fef7de7b36fabe495eb1a399a" + integrity sha1-aHwydYFjWI/vfeezb6vklesaOZo= dependencies: arr-flatten "^1.0.1" array-slice "^0.2.3" -arr-diff@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/arr-diff/-/arr-diff-2.0.0.tgz#8f3b827f955a8bd669697e4a4256ac3ceae356cf" - dependencies: - arr-flatten "^1.0.1" - arr-diff@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/arr-diff/-/arr-diff-4.0.0.tgz#d6461074febfec71e7e15235761a329a5dc7c520" + integrity sha1-1kYQdP6/7HHn4VI1dhoyml3HxSA= arr-filter@^1.1.1: version "1.1.2" resolved "https://registry.yarnpkg.com/arr-filter/-/arr-filter-1.1.2.tgz#43fdddd091e8ef11aa4c45d9cdc18e2dff1711ee" + integrity sha1-Q/3d0JHo7xGqTEXZzcGOLf8XEe4= dependencies: make-iterator "^1.0.0" arr-flatten@^1.0.1, arr-flatten@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/arr-flatten/-/arr-flatten-1.1.0.tgz#36048bbff4e7b47e136644316c99669ea5ae91f1" + integrity sha512-L3hKV5R/p5o81R7O02IGnwpDmkp6E982XhtbuwSe3O4qOtMMMtodicASA1Cny2U+aCXcNpml+m4dPsvsJ3jatg== arr-map@^2.0.0, arr-map@^2.0.2: version "2.0.2" resolved "https://registry.yarnpkg.com/arr-map/-/arr-map-2.0.2.tgz#3a77345ffc1cf35e2a91825601f9e58f2e24cac4" + integrity sha1-Onc0X/wc814qkYJWAfnljy4kysQ= dependencies: make-iterator "^1.0.0" arr-union@^2.0.1: version "2.1.0" resolved "https://registry.yarnpkg.com/arr-union/-/arr-union-2.1.0.tgz#20f9eab5ec70f5c7d215b1077b1c39161d292c7d" + integrity sha1-IPnqtexw9cfSFbEHexw5Fh0pLH0= arr-union@^3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/arr-union/-/arr-union-3.1.0.tgz#e39b09aea9def866a8f206e288af63919bae39c4" + integrity sha1-45sJrqne+Gao8gbiiK9jkZuuOcQ= array-differ@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/array-differ/-/array-differ-1.0.0.tgz#eff52e3758249d33be402b8bb8e564bb2b5d4031" + integrity sha1-7/UuN1gknTO+QCuLuOVkuytdQDE= + +array-differ@^2.0.3: + version "2.1.0" + resolved "https://registry.yarnpkg.com/array-differ/-/array-differ-2.1.0.tgz#4b9c1c3f14b906757082925769e8ab904f4801b1" + integrity sha512-KbUpJgx909ZscOc/7CLATBFam7P1Z1QRQInvgT0UztM9Q72aGKCunKASAl7WNW0tnPmPyEMeMhdsfWhfmW037w== array-each@^1.0.0, array-each@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/array-each/-/array-each-1.0.1.tgz#a794af0c05ab1752846ee753a1f211a05ba0c44f" + integrity sha1-p5SvDAWrF1KEbudTofIRoFugxE8= array-equal@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/array-equal/-/array-equal-1.0.0.tgz#8c2a5ef2472fd9ea742b04c77a75093ba2757c93" - -array-filter@~0.0.0: - version "0.0.1" - resolved "https://registry.yarnpkg.com/array-filter/-/array-filter-0.0.1.tgz#7da8cf2e26628ed732803581fd21f67cacd2eeec" + integrity sha1-jCpe8kcv2ep0KwTHenUJO6J1fJM= array-find-index@^1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/array-find-index/-/array-find-index-1.0.2.tgz#df010aa1287e164bbda6f9723b0a96a1ec4187a1" + integrity sha1-3wEKoSh+Fku9pvlyOwqWoexBh6E= array-ify@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/array-ify/-/array-ify-1.0.0.tgz#9e528762b4a9066ad163a6962a364418e9626ece" + integrity sha1-nlKHYrSpBmrRY6aWKjZEGOlibs4= array-includes@^3.0.3: version "3.0.3" @@ -2129,6 +2347,7 @@ array-includes@^3.0.3: array-initial@^1.0.0: version "1.1.0" resolved "https://registry.yarnpkg.com/array-initial/-/array-initial-1.1.0.tgz#2fa74b26739371c3947bd7a7adc73be334b3d795" + integrity sha1-L6dLJnOTccOUe9enrcc74zSz15U= dependencies: array-slice "^1.0.0" is-number "^4.0.0" @@ -2136,106 +2355,117 @@ array-initial@^1.0.0: array-last@^1.1.1: version "1.3.0" resolved "https://registry.yarnpkg.com/array-last/-/array-last-1.3.0.tgz#7aa77073fec565ddab2493f5f88185f404a9d336" + integrity sha512-eOCut5rXlI6aCOS7Z7kCplKRKyiFQ6dHFBem4PwlwKeNFk2/XxTrhRh5T9PyaEWGy/NHTZWbY+nsZlNFJu9rYg== dependencies: is-number "^4.0.0" -array-map@~0.0.0: - version "0.0.0" - resolved "https://registry.yarnpkg.com/array-map/-/array-map-0.0.0.tgz#88a2bab73d1cf7bcd5c1b118a003f66f665fa662" - -array-reduce@~0.0.0: - version "0.0.0" - resolved "https://registry.yarnpkg.com/array-reduce/-/array-reduce-0.0.0.tgz#173899d3ffd1c7d9383e4479525dbe278cab5f2b" - array-slice@^0.2.3: version "0.2.3" resolved "https://registry.yarnpkg.com/array-slice/-/array-slice-0.2.3.tgz#dd3cfb80ed7973a75117cdac69b0b99ec86186f5" + integrity sha1-3Tz7gO15c6dRF82sabC5nshhhvU= array-slice@^1.0.0: version "1.1.0" resolved "https://registry.yarnpkg.com/array-slice/-/array-slice-1.1.0.tgz#e368ea15f89bc7069f7ffb89aec3a6c7d4ac22d4" + integrity sha512-B1qMD3RBP7O8o0H2KbrXDyB0IccejMF15+87Lvlor12ONPRHP6gTjXMNkt/d3ZuOGbAe66hFmaCfECI24Ufp6w== array-sort@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/array-sort/-/array-sort-1.0.0.tgz#e4c05356453f56f53512a7d1d6123f2c54c0a88a" + integrity sha512-ihLeJkonmdiAsD7vpgN3CRcx2J2S0TiYW+IS/5zHBI7mKUq3ySvBdzzBfD236ubDBQFiiyG3SWCPc+msQ9KoYg== dependencies: default-compare "^1.0.0" get-value "^2.0.6" kind-of "^5.0.2" -array-union@^1.0.1: +array-union@^1.0.1, array-union@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/array-union/-/array-union-1.0.2.tgz#9a34410e4f4e3da23dea375be5be70f24778ec39" + integrity sha1-mjRBDk9OPaI96jdb5b5w8kd47Dk= dependencies: array-uniq "^1.0.1" +array-union@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/array-union/-/array-union-2.1.0.tgz#b798420adbeb1de828d84acd8a2e23d3efe85e8d" + integrity sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw== + array-uniq@^1.0.1: version "1.0.3" resolved "https://registry.yarnpkg.com/array-uniq/-/array-uniq-1.0.3.tgz#af6ac877a25cc7f74e058894753858dfdb24fdb6" - -array-unique@^0.2.1: - version "0.2.1" - resolved "https://registry.yarnpkg.com/array-unique/-/array-unique-0.2.1.tgz#a1d97ccafcbc2625cc70fadceb36a50c58b01a53" + integrity sha1-r2rId6Jcx/dOBYiUdThY39sk/bY= array-unique@^0.3.2: version "0.3.2" resolved "https://registry.yarnpkg.com/array-unique/-/array-unique-0.3.2.tgz#a894b75d4bc4f6cd679ef3244a9fd8f46ae2d428" + integrity sha1-qJS3XUvE9s1nnvMkSp/Y9Gri1Cg= + +array.prototype.flat@^1.2.1: + version "1.2.2" + resolved "https://registry.yarnpkg.com/array.prototype.flat/-/array.prototype.flat-1.2.2.tgz#8f3c71d245ba349b6b64b4078f76f5576f1fd723" + integrity sha512-VXjh7lAL4KXKF2hY4FnEW9eRW6IhdvFW1sN/JwLbmECbCgACCnBHNyP3lFiYuttr0jxRN9Bsc5+G27dMseSWqQ== + dependencies: + define-properties "^1.1.3" + es-abstract "^1.15.0" + function-bind "^1.1.1" arrify@^1.0.0, arrify@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/arrify/-/arrify-1.0.1.tgz#898508da2226f380df904728456849c1501a4b0d" + integrity sha1-iYUI2iIm84DfkEcoRWhJwVAaSw0= asap@^2.0.0: version "2.0.6" resolved "https://registry.yarnpkg.com/asap/-/asap-2.0.6.tgz#e50347611d7e690943208bbdafebcbc2fb866d46" + integrity sha1-5QNHYR1+aQlDIIu9r+vLwvuGbUY= asn1.js@^4.0.0: version "4.10.1" resolved "https://registry.yarnpkg.com/asn1.js/-/asn1.js-4.10.1.tgz#b9c2bf5805f1e64aadeed6df3a2bfafb5a73f5a0" + integrity sha512-p32cOF5q0Zqs9uBiONKYLm6BClCoBCM5O9JfeUSlnQLBTxYdTK+pW+nXflm8UkKd2UYlEbYz5qEi0JuZR9ckSw== dependencies: bn.js "^4.0.0" inherits "^2.0.1" minimalistic-assert "^1.0.0" asn1@~0.2.3: - version "0.2.3" - resolved "https://registry.yarnpkg.com/asn1/-/asn1-0.2.3.tgz#dac8787713c9966849fc8180777ebe9c1ddf3b86" + version "0.2.4" + resolved "https://registry.yarnpkg.com/asn1/-/asn1-0.2.4.tgz#8d2475dfab553bb33e77b54e59e880bb8ce23136" + integrity sha512-jxwzQpLQjSmWXgwaCZE9Nz+glAG01yF1QnWgbhGwHI5A6FRIEY6IVqtHhIepHqI7/kyEyQEagBC5mBEFlIYvdg== + dependencies: + safer-buffer "~2.1.0" assert-plus@1.0.0, assert-plus@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/assert-plus/-/assert-plus-1.0.0.tgz#f12e0f3c5d77b0b1cdd9146942e4e96c1e4dd525" + integrity sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU= -assert@^1.1.1, assert@^1.4.0: - version "1.4.1" - resolved "https://registry.yarnpkg.com/assert/-/assert-1.4.1.tgz#99912d591836b5a6f5b345c0f07eefc08fc65d91" +assert@^1.4.0: + version "1.5.0" + resolved "https://registry.yarnpkg.com/assert/-/assert-1.5.0.tgz#55c109aaf6e0aefdb3dc4b71240c70bf574b18eb" + integrity sha512-EDsgawzwoun2CZkCgtxJbv392v4nbk9XDD06zI+kQYoBM/3RBWLlEyJARDOmhAAosBjWACEkKL6S+lIZtcAubA== dependencies: + object-assign "^4.1.1" util "0.10.3" assign-symbols@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/assign-symbols/-/assign-symbols-1.0.0.tgz#59667f41fadd4f20ccbc2bb96b8d4f7f78ec0367" - -ast-types@0.9.6: - version "0.9.6" - resolved "https://registry.yarnpkg.com/ast-types/-/ast-types-0.9.6.tgz#102c9e9e9005d3e7e3829bf0c4fa24ee862ee9b9" + integrity sha1-WWZ/QfrdTyDMvCu5a41Pf3jsA2c= astral-regex@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/astral-regex/-/astral-regex-1.0.0.tgz#6c8c3fb827dd43ee3918f27b82782ab7658a6fd9" - -astw@^2.0.0: - version "2.2.0" - resolved "https://registry.yarnpkg.com/astw/-/astw-2.2.0.tgz#7bd41784d32493987aeb239b6b4e1c57a873b917" - dependencies: - acorn "^4.0.3" + integrity sha512-+Ryf6g3BKoRc7jfp7ad8tM4TtMiaWvbF/1/sQcZPkkS7ag3D5nMBCe2UfOTONtAkaG0tO0ij3C5Lwmf1EiyjHg== async-done@^1.2.0, async-done@^1.2.2: - version "1.2.4" - resolved "https://registry.yarnpkg.com/async-done/-/async-done-1.2.4.tgz#17b0fcefb9a33cb9de63daa8904c0a65bd535fa0" + version "1.3.2" + resolved "https://registry.yarnpkg.com/async-done/-/async-done-1.3.2.tgz#5e15aa729962a4b07414f528a88cdf18e0b290a2" + integrity sha512-uYkTP8dw2og1tu1nmza1n1CMW0qb8gWWlwqMmLb7MhBVs4BXrFziT6HXUd+/RlRA/i4H9AkofYloUbs1fwMqlw== dependencies: end-of-stream "^1.1.0" once "^1.3.2" - process-nextick-args "^1.0.7" + process-nextick-args "^2.0.0" stream-exhaust "^1.0.1" async-each@^1.0.1: @@ -2244,106 +2474,108 @@ async-each@^1.0.1: integrity sha512-z/WhQ5FPySLdvREByI2vZiTWwCnF0moMJ1hK9YQwDTHKh6I7/uSckMetoRGb5UBZPC1z0jlw+n/XCgjeH7y1AQ== async-limiter@~1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/async-limiter/-/async-limiter-1.0.0.tgz#78faed8c3d074ab81f22b4e985d79e8738f720f8" + version "1.0.1" + resolved "https://registry.yarnpkg.com/async-limiter/-/async-limiter-1.0.1.tgz#dd379e94f0db8310b08291f9d64c3209766617fd" + integrity sha512-csOlWGAcRFJaI6m+F2WKdnMKr4HhdhFVBk0H/QbJFMCr+uO2kwohwXQPxw/9OCxp05r5ghVBFSyioixx3gfkNQ== async-settle@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/async-settle/-/async-settle-1.0.0.tgz#1d0a914bb02575bec8a8f3a74e5080f72b2c0c6b" + integrity sha1-HQqRS7Aldb7IqPOnTlCA9yssDGs= dependencies: async-done "^1.2.2" -async@^2.1.2, async@^2.5.0: - version "2.6.1" - resolved "https://registry.yarnpkg.com/async/-/async-2.6.1.tgz#b245a23ca71930044ec53fa46aa00a3e87c6a610" - dependencies: - lodash "^4.17.10" - asynckit@^0.4.0: version "0.4.0" resolved "https://registry.yarnpkg.com/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79" + integrity sha1-x57Zf380y48robyXkLzDZkdLS3k= atob-lite@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/atob-lite/-/atob-lite-2.0.0.tgz#0fef5ad46f1bd7a8502c65727f0367d5ee43d696" integrity sha1-D+9a1G8b16hQLGVyfwNn1e5D1pY= -atob@^2.0.0: - version "2.0.3" - resolved "https://registry.yarnpkg.com/atob/-/atob-2.0.3.tgz#19c7a760473774468f20b2d2d03372ad7d4cbf5d" +atob@^2.1.1: + version "2.1.2" + resolved "https://registry.yarnpkg.com/atob/-/atob-2.1.2.tgz#6d9517eb9e030d2436666651e86bd9f6f13533c9" + integrity sha512-Wm6ukoaOGJi/73p/cl2GvLjTI5JM1k/O14isD73YML8StrH/7/lRFgmg8nICZgD3bZZvjwCGxtMOD3wWNAu8cg== aws-sign2@~0.7.0: version "0.7.0" resolved "https://registry.yarnpkg.com/aws-sign2/-/aws-sign2-0.7.0.tgz#b46e890934a9591f2d2f6f86d7e6a9f1b3fe76a8" + integrity sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg= aws4@^1.8.0: - version "1.8.0" - resolved "https://registry.yarnpkg.com/aws4/-/aws4-1.8.0.tgz#f0e003d9ca9e7f59c7a508945d7b2ef9a04a542f" - -babel-eslint@^11.0.0-beta.0: - version "11.0.0-beta.0" - resolved "https://registry.yarnpkg.com/babel-eslint/-/babel-eslint-11.0.0-beta.0.tgz#3645b9b84d848e070e0afadc95d0c8ff96f4c63a" - dependencies: - eslint-scope "3.7.1" - eslint-visitor-keys "^1.0.0" - semver "^5.6.0" - -babel-jest@^24.8.0: - version "24.8.0" - resolved "https://registry.yarnpkg.com/babel-jest/-/babel-jest-24.8.0.tgz#5c15ff2b28e20b0f45df43fe6b7f2aae93dba589" - integrity sha512-+5/kaZt4I9efoXzPlZASyK/lN9qdRKmmUav9smVc0ruPQD7IsfucQ87gpOE8mn2jbDuS6M/YOW6n3v9ZoIfgnw== - dependencies: - "@jest/transform" "^24.8.0" - "@jest/types" "^24.8.0" + version "1.9.0" + resolved "https://registry.yarnpkg.com/aws4/-/aws4-1.9.0.tgz#24390e6ad61386b0a747265754d2a17219de862c" + integrity sha512-Uvq6hVe90D0B2WEnUqtdgY1bATGz3mw33nH9Y+dmA+w5DHvUmBgkr5rM/KCHpCsiFNRUfokW/szpPPgMK2hm4A== + +babel-eslint@^11.0.0-beta.2: + version "11.0.0-beta.2" + resolved "https://registry.yarnpkg.com/babel-eslint/-/babel-eslint-11.0.0-beta.2.tgz#de1f06795aa0d8cedcf6ac943e63056f5b4a7048" + integrity sha512-D2tunrOu04XloEdU2XVUminUu25FILlGruZmffqH5OSnLDhCheKNvUoM1ihrexdUvhizlix8bjqRnsss4V/UIQ== + dependencies: + eslint-scope "5.0.0" + eslint-visitor-keys "^1.1.0" + semver "^6.3.0" + +babel-jest@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/babel-jest/-/babel-jest-24.9.0.tgz#3fc327cb8467b89d14d7bc70e315104a783ccd54" + integrity sha512-ntuddfyiN+EhMw58PTNL1ph4C9rECiQXjI4nMMBKBaNjXvqLdkXpPRcMSr4iyBrJg/+wz9brFUD6RhOAT6r4Iw== + dependencies: + "@jest/transform" "^24.9.0" + "@jest/types" "^24.9.0" "@types/babel__core" "^7.1.0" babel-plugin-istanbul "^5.1.0" - babel-preset-jest "^24.6.0" + babel-preset-jest "^24.9.0" chalk "^2.4.2" slash "^2.0.0" -babel-loader@^8.0.6: - version "8.0.6" - resolved "https://registry.yarnpkg.com/babel-loader/-/babel-loader-8.0.6.tgz#e33bdb6f362b03f4bb141a0c21ab87c501b70dfb" - integrity sha512-4BmWKtBOBm13uoUwd08UwjZlaw3O9GWf456R9j+5YykFZ6LUIjIKLc0zEZf+hauxPOJs96C8k6FvYD09vWzhYw== +babel-plugin-dynamic-import-node@^2.3.0: + version "2.3.0" + resolved "https://registry.yarnpkg.com/babel-plugin-dynamic-import-node/-/babel-plugin-dynamic-import-node-2.3.0.tgz#f00f507bdaa3c3e3ff6e7e5e98d90a7acab96f7f" + integrity sha512-o6qFkpeQEBxcqt0XYlWzAVxNCSCZdUgcR8IRlhD/8DylxjjO4foPcvTW0GGKa/cVt3rvxZ7o5ippJ+/0nvLhlQ== dependencies: - find-cache-dir "^2.0.0" - loader-utils "^1.0.2" - mkdirp "^0.5.1" - pify "^4.0.1" + object.assign "^4.1.0" babel-plugin-istanbul@^5.1.0: - version "5.1.0" - resolved "https://registry.yarnpkg.com/babel-plugin-istanbul/-/babel-plugin-istanbul-5.1.0.tgz#6892f529eff65a3e2d33d87dc5888ffa2ecd4a30" + version "5.2.0" + resolved "https://registry.yarnpkg.com/babel-plugin-istanbul/-/babel-plugin-istanbul-5.2.0.tgz#df4ade83d897a92df069c4d9a25cf2671293c854" + integrity sha512-5LphC0USA8t4i1zCtjbbNb6jJj/9+X6P37Qfirc/70EQ34xKlMW+a1RHGwxGI+SwWpNwZ27HqvzAobeqaXwiZw== dependencies: + "@babel/helper-plugin-utils" "^7.0.0" find-up "^3.0.0" - istanbul-lib-instrument "^3.0.0" - test-exclude "^5.0.0" + istanbul-lib-instrument "^3.3.0" + test-exclude "^5.2.3" -babel-plugin-jest-hoist@^24.6.0: - version "24.6.0" - resolved "https://registry.yarnpkg.com/babel-plugin-jest-hoist/-/babel-plugin-jest-hoist-24.6.0.tgz#f7f7f7ad150ee96d7a5e8e2c5da8319579e78019" - integrity sha512-3pKNH6hMt9SbOv0F3WVmy5CWQ4uogS3k0GY5XLyQHJ9EGpAT9XWkFd2ZiXXtkwFHdAHa5j7w7kfxSP5lAIwu7w== +babel-plugin-jest-hoist@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/babel-plugin-jest-hoist/-/babel-plugin-jest-hoist-24.9.0.tgz#4f837091eb407e01447c8843cbec546d0002d756" + integrity sha512-2EMA2P8Vp7lG0RAzr4HXqtYwacfMErOuv1U3wrvxHX6rD1sV6xS3WXG3r8TRQ2r6w8OhvSdWt+z41hQNwNm3Xw== dependencies: "@types/babel__traverse" "^7.0.6" babel-plugin-transform-charcodes@^0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/babel-plugin-transform-charcodes/-/babel-plugin-transform-charcodes-0.2.0.tgz#c17307cc852c979103ceafd97e1799ef10916941" + integrity sha512-owzuAMq9EIampG9G7DqeNDp/fl5i2FQ9RIgP1mTrYORByN0vZiVF9aHl4flDdAecxWtduxb0Peha/Fkd6t4n5A== dependencies: "@babel/parser" "^7.0.0" "@babel/traverse" "^7.0.0" -babel-preset-jest@^24.6.0: - version "24.6.0" - resolved "https://registry.yarnpkg.com/babel-preset-jest/-/babel-preset-jest-24.6.0.tgz#66f06136eefce87797539c0d63f1769cc3915984" - integrity sha512-pdZqLEdmy1ZK5kyRUfvBb2IfTPb2BUvIJczlPspS8fWmBQslNNDBqVfh7BW5leOVJMDZKzjD8XEyABTk6gQ5yw== +babel-preset-jest@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/babel-preset-jest/-/babel-preset-jest-24.9.0.tgz#192b521e2217fb1d1f67cf73f70c336650ad3cdc" + integrity sha512-izTUuhE4TMfTRPF92fFwD2QfdXaZW08qvWTFCI51V8rW5x00UuPgc3ajRoWofXOuxjfcOM5zzSYsQS3H8KGCAg== dependencies: "@babel/plugin-syntax-object-rest-spread" "^7.0.0" - babel-plugin-jest-hoist "^24.6.0" + babel-plugin-jest-hoist "^24.9.0" bach@^1.0.0: version "1.2.0" resolved "https://registry.yarnpkg.com/bach/-/bach-1.2.0.tgz#4b3ce96bf27134f79a1b414a51c14e34c3bd9880" + integrity sha1-Szzpa/JxNPeaG0FKUcFONMO9mIA= dependencies: arr-filter "^1.1.1" arr-flatten "^1.0.1" @@ -2358,14 +2590,17 @@ bach@^1.0.0: balanced-match@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.0.tgz#89b4d199ab2bee49de164ea02b89ce462d71b767" + integrity sha1-ibTRmasr7kneFk6gK4nORi1xt2c= base64-js@^1.0.2: - version "1.2.3" - resolved "https://registry.yarnpkg.com/base64-js/-/base64-js-1.2.3.tgz#fb13668233d9614cf5fb4bce95a9ba4096cdf801" + version "1.3.1" + resolved "https://registry.yarnpkg.com/base64-js/-/base64-js-1.3.1.tgz#58ece8cb75dd07e71ed08c736abc5fac4dbf8df1" + integrity sha512-mLQ4i2QO1ytvGWFWmcngKO//JXAQueZvwEKtjgQFM4jIK0kU+ytMfplL8j+n5mspOfjHwoAg+9yhb7BwAHm36g== base@^0.11.1: version "0.11.2" resolved "https://registry.yarnpkg.com/base/-/base-0.11.2.tgz#7bde5ced145b6d551a90db87f83c558b4eb48a8f" + integrity sha512-5T6P4xPgpp0YDFvSWwEZ4NoE3aM4QBQXDzmVbraCkFj8zHM+mba8SyqB5DbZWyR7mYHo6Y7BdQo3MoA4m0TeQg== dependencies: cache-base "^1.0.1" class-utils "^0.3.5" @@ -2376,51 +2611,47 @@ base@^0.11.1: pascalcase "^0.1.1" bcrypt-pbkdf@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.1.tgz#63bc5dcb61331b92bc05fd528953c33462a06f8d" + version "1.0.2" + resolved "https://registry.yarnpkg.com/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz#a4301d389b6a43f9b67ff3ca11a3f6637e360e9e" + integrity sha1-pDAdOJtqQ/m2f/PKEaP2Y342Dp4= dependencies: tweetnacl "^0.14.3" -before-after-hook@^1.4.0: - version "1.4.0" - resolved "https://registry.yarnpkg.com/before-after-hook/-/before-after-hook-1.4.0.tgz#2b6bf23dca4f32e628fd2747c10a37c74a4b484d" - integrity sha512-l5r9ir56nda3qu14nAXIlyq1MmUSs0meCIaFAh8HwkFwP1F8eToOuS3ah2VAHHcY04jaYD7FpJC5JTXHYRbkzg== - -big.js@^3.1.3: - version "3.2.0" - resolved "https://registry.yarnpkg.com/big.js/-/big.js-3.2.0.tgz#a5fc298b81b9e0dca2e458824784b65c52ba588e" +before-after-hook@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/before-after-hook/-/before-after-hook-2.1.0.tgz#b6c03487f44e24200dd30ca5e6a1979c5d2fb635" + integrity sha512-IWIbu7pMqyw3EAJHzzHbWa85b6oud/yfKYg5rqB5hNE8CeMi3nX+2C2sj0HswfblST86hpVEOAb9x34NZd6P7A== binary-extensions@^1.0.0: - version "1.11.0" - resolved "https://registry.yarnpkg.com/binary-extensions/-/binary-extensions-1.11.0.tgz#46aa1751fb6a2f93ee5e689bb1087d4b14c6c205" + version "1.13.1" + resolved "https://registry.yarnpkg.com/binary-extensions/-/binary-extensions-1.13.1.tgz#598afe54755b2868a5330d2aff9d4ebb53209b65" + integrity sha512-Un7MIEDdUC5gNpcGDV97op1Ywk748MpHcFTHoYs6qnj1Z3j7I53VG3nwZhKzoBZmbdRNnb6WRdFlwl7tSDuZGw== + +bl@~0.8.1: + version "0.8.2" + resolved "https://registry.yarnpkg.com/bl/-/bl-0.8.2.tgz#c9b6bca08d1bc2ea00fc8afb4f1a5fd1e1c66e4e" + integrity sha1-yba8oI0bwuoA/Ir7Txpf0eHGbk4= + dependencies: + readable-stream "~1.0.26" -bluebird@^3.5.1, bluebird@^3.5.3: - version "3.5.3" - resolved "https://registry.yarnpkg.com/bluebird/-/bluebird-3.5.3.tgz#7d01c6f9616c9a51ab0f8c549a79dfe6ec33efa7" +bluebird@^3.5.1, bluebird@^3.5.3, bluebird@^3.5.5: + version "3.7.2" + resolved "https://registry.yarnpkg.com/bluebird/-/bluebird-3.7.2.tgz#9f229c15be272454ffa973ace0dbee79a1b0c36f" + integrity sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg== bn.js@^4.0.0, bn.js@^4.1.0, bn.js@^4.1.1, bn.js@^4.4.0: version "4.11.8" resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-4.11.8.tgz#2cde09eb5ee341f484746bb0309b3253b1b1442f" - -boolbase@~1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/boolbase/-/boolbase-1.0.0.tgz#68dff5fbe60c51eb37725ea9e3ed310dcc1e776e" + integrity sha512-ItfYfPLkWHUjckQCk8xC+LwxgK8NYcXywGigJgSwOP8Y2iyWT4f2vsZnoOXTTbo+o5yXmIUJ4gn5538SO5S3gA== brace-expansion@^1.1.7: version "1.1.11" resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.11.tgz#3c7fcbf529d87226f3d2f52b966ff5271eb441dd" + integrity sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA== dependencies: balanced-match "^1.0.0" concat-map "0.0.1" -braces@^1.8.2: - version "1.8.5" - resolved "https://registry.yarnpkg.com/braces/-/braces-1.8.5.tgz#ba77962e12dff969d6b76711e914b737857bf6a7" - dependencies: - expand-range "^1.8.1" - preserve "^0.2.0" - repeat-element "^1.1.2" - braces@^2.3.1, braces@^2.3.2: version "2.3.2" resolved "https://registry.yarnpkg.com/braces/-/braces-2.3.2.tgz#5979fd3f14cd531565e5fa2df1abfff1dfaee729" @@ -2437,13 +2668,22 @@ braces@^2.3.1, braces@^2.3.2: split-string "^3.0.2" to-regex "^3.0.1" +braces@^3.0.1: + version "3.0.2" + resolved "https://registry.yarnpkg.com/braces/-/braces-3.0.2.tgz#3454e1a462ee8d599e236df336cd9ea4f8afe107" + integrity sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A== + dependencies: + fill-range "^7.0.1" + brorand@^1.0.1: version "1.1.0" resolved "https://registry.yarnpkg.com/brorand/-/brorand-1.1.0.tgz#12c25efe40a45e3c323eb8675a0a0ce57b22371f" + integrity sha1-EsJe/kCkXjwyPrhnWgoM5XsiNx8= browser-pack@^5.0.1: version "5.0.1" resolved "https://registry.yarnpkg.com/browser-pack/-/browser-pack-5.0.1.tgz#4197719b20c6e0aaa09451c5111e53efb6fbc18d" + integrity sha1-QZdxmyDG4KqglFHFER5T77b7wY0= dependencies: JSONStream "^1.0.3" combine-source-map "~0.6.1" @@ -2452,8 +2692,9 @@ browser-pack@^5.0.1: umd "^3.0.0" browser-pack@^6.0.1: - version "6.0.4" - resolved "https://registry.yarnpkg.com/browser-pack/-/browser-pack-6.0.4.tgz#9a73beb3b48f9e36868be007b64400102c04a99f" + version "6.1.0" + resolved "https://registry.yarnpkg.com/browser-pack/-/browser-pack-6.1.0.tgz#c34ba10d0b9ce162b5af227c7131c92c2ecd5774" + integrity sha512-erYug8XoqzU3IfcU8fUgyHqyOXqIE4tUTTQ+7mqUjQlvnXkOO6OlT9c/ZoJVHYoAaqGxr09CN53G7XIsO4KtWA== dependencies: JSONStream "^1.0.3" combine-source-map "~0.8.0" @@ -2463,8 +2704,9 @@ browser-pack@^6.0.1: umd "^3.0.0" browser-process-hrtime@^0.1.2: - version "0.1.2" - resolved "https://registry.yarnpkg.com/browser-process-hrtime/-/browser-process-hrtime-0.1.2.tgz#425d68a58d3447f02a04aa894187fce8af8b7b8e" + version "0.1.3" + resolved "https://registry.yarnpkg.com/browser-process-hrtime/-/browser-process-hrtime-0.1.3.tgz#616f00faef1df7ec1b5bf9cfe2bdc3170f26c7b4" + integrity sha512-bRFnI4NnjO6cnyLmOV/7PVoDEMJChlcfN0z4s1YMBY989/SvlfMI1lgCnkFUs53e9gQF+w7qu7XdllSTiSl8Aw== browser-resolve@^1.11.0, browser-resolve@^1.11.3, browser-resolve@^1.7.0: version "1.11.3" @@ -2474,17 +2716,18 @@ browser-resolve@^1.11.0, browser-resolve@^1.11.3, browser-resolve@^1.7.0: resolve "1.1.7" browser-unpack@^1.1.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/browser-unpack/-/browser-unpack-1.2.0.tgz#357aee31fc467831684d063e4355e070a782970d" + version "1.4.2" + resolved "https://registry.yarnpkg.com/browser-unpack/-/browser-unpack-1.4.2.tgz#7a708774dc7448df1c24a735d65d409708b95ce2" + integrity sha512-uHkiY4bmXjjBBWoKH1aRnEGTQxUUCCcVtoJfH9w1lmGGjETY4u93Zk+GRYkCE/SRMrdoMTINQ/1/manr/3aMVA== dependencies: - acorn "^4.0.3" - browser-pack "^5.0.1" + acorn-node "^1.5.2" concat-stream "^1.5.0" minimist "^1.1.1" browserify-aes@^1.0.0, browserify-aes@^1.0.4: - version "1.1.1" - resolved "https://registry.yarnpkg.com/browserify-aes/-/browserify-aes-1.1.1.tgz#38b7ab55edb806ff2dcda1a7f1620773a477c49f" + version "1.2.0" + resolved "https://registry.yarnpkg.com/browserify-aes/-/browserify-aes-1.2.0.tgz#326734642f403dabc3003209853bb70ad428ef48" + integrity sha512-+7CHXqGuspUn/Sl5aO7Ea0xWGAtETPXNSAjHo48JfLdPWcMng33Xe4znFvQweqc/uzk5zSOI3H52CYnjCfb5hA== dependencies: buffer-xor "^1.0.3" cipher-base "^1.0.0" @@ -2494,24 +2737,37 @@ browserify-aes@^1.0.0, browserify-aes@^1.0.4: safe-buffer "^5.0.1" browserify-cipher@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/browserify-cipher/-/browserify-cipher-1.0.0.tgz#9988244874bf5ed4e28da95666dcd66ac8fc363a" + version "1.0.1" + resolved "https://registry.yarnpkg.com/browserify-cipher/-/browserify-cipher-1.0.1.tgz#8d6474c1b870bfdabcd3bcfcc1934a10e94f15f0" + integrity sha512-sPhkz0ARKbf4rRQt2hTpAHqn47X3llLkUGn+xEJzLjwY8LRs2p0v7ljvI5EyoRO/mexrNunNECisZs+gw2zz1w== dependencies: browserify-aes "^1.0.4" browserify-des "^1.0.0" evp_bytestokey "^1.0.0" browserify-des@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/browserify-des/-/browserify-des-1.0.0.tgz#daa277717470922ed2fe18594118a175439721dd" + version "1.0.2" + resolved "https://registry.yarnpkg.com/browserify-des/-/browserify-des-1.0.2.tgz#3af4f1f59839403572f1c66204375f7a7f703e9c" + integrity sha512-BioO1xf3hFwz4kc6iBhI3ieDFompMhrMlnDFC4/0/vd5MokpuAc3R+LYbwTA9A5Yc9pq9UYPqffKpW2ObuwX5A== dependencies: cipher-base "^1.0.1" des.js "^1.0.0" inherits "^2.0.1" + safe-buffer "^5.1.2" + +browserify-fs@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/browserify-fs/-/browserify-fs-1.0.0.tgz#f075aa8a729d4d1716d066620e386fcc1311a96f" + integrity sha1-8HWqinKdTRcW0GZiDjhvzBMRqW8= + dependencies: + level-filesystem "^1.0.1" + level-js "^2.1.3" + levelup "^0.18.2" browserify-rsa@^4.0.0: version "4.0.1" resolved "https://registry.yarnpkg.com/browserify-rsa/-/browserify-rsa-4.0.1.tgz#21e0abfaf6f2029cf2fafb133567a701d4135524" + integrity sha1-IeCr+vbyApzy+vsTNWenAdQTVSQ= dependencies: bn.js "^4.1.0" randombytes "^2.0.1" @@ -2519,6 +2775,7 @@ browserify-rsa@^4.0.0: browserify-sign@^4.0.0: version "4.0.4" resolved "https://registry.yarnpkg.com/browserify-sign/-/browserify-sign-4.0.4.tgz#aa4eb68e5d7b658baa6bf6a57e630cbd7a93d298" + integrity sha1-qk62jl17ZYuqa/alfmMMvXqT0pg= dependencies: bn.js "^4.1.1" browserify-rsa "^4.0.0" @@ -2528,15 +2785,17 @@ browserify-sign@^4.0.0: inherits "^2.0.1" parse-asn1 "^5.0.0" -browserify-zlib@^0.2.0, browserify-zlib@~0.2.0: +browserify-zlib@~0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/browserify-zlib/-/browserify-zlib-0.2.0.tgz#2869459d9aa3be245fe8fe2ca1f46e2e7f54d73f" + integrity sha512-Z942RysHXmJrhqk88FmKBVq/v5tqmSkDz7p54G/MGyjMnCFFnC79XWNbg+Vta8W6Wb2qtSZTSxIGkJrRpCFEiA== dependencies: pako "~1.0.5" browserify@^16.2.3: - version "16.2.3" - resolved "https://registry.yarnpkg.com/browserify/-/browserify-16.2.3.tgz#7ee6e654ba4f92bce6ab3599c3485b1cc7a0ad0b" + version "16.5.0" + resolved "https://registry.yarnpkg.com/browserify/-/browserify-16.5.0.tgz#a1c2bc0431bec11fd29151941582e3f645ede881" + integrity sha512-6bfI3cl76YLAnCZ75AGu/XPOsqUhRyc0F/olGIJeCxtfxF2HvPKEcmjU9M8oAPxl4uBY1U7Nry33Q6koV3f2iw== dependencies: JSONStream "^1.0.3" assert "^1.4.0" @@ -2575,7 +2834,7 @@ browserify@^16.2.3: shasum "^1.0.0" shell-quote "^1.6.1" stream-browserify "^2.0.0" - stream-http "^2.0.0" + stream-http "^3.0.0" string_decoder "^1.1.1" subarg "^1.0.0" syntax-error "^1.1.1" @@ -2587,18 +2846,19 @@ browserify@^16.2.3: vm-browserify "^1.0.0" xtend "^4.0.0" -browserslist@^4.6.0: - version "4.6.0" - resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.6.0.tgz#5274028c26f4d933d5b1323307c1d1da5084c9ff" - integrity sha512-Jk0YFwXBuMOOol8n6FhgkDzn3mY9PYLYGk29zybF05SbRTsMgPqmTNeQQhOghCxq5oFqAXE3u4sYddr4C0uRhg== +browserslist@^4.8.3, browserslist@^4.9.1: + version "4.9.1" + resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.9.1.tgz#01ffb9ca31a1aef7678128fc6a2253316aa7287c" + integrity sha512-Q0DnKq20End3raFulq6Vfp1ecB9fh8yUNV55s8sekaDDeqBaCtWlRHCUdaWyUeSSBJM7IbM6HcsyaeYqgeDhnw== dependencies: - caniuse-lite "^1.0.30000967" - electron-to-chromium "^1.3.133" - node-releases "^1.1.19" + caniuse-lite "^1.0.30001030" + electron-to-chromium "^1.3.363" + node-releases "^1.1.50" -bser@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/bser/-/bser-2.0.0.tgz#9ac78d3ed5d915804fd87acb158bc797147a1719" +bser@2.1.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/bser/-/bser-2.1.1.tgz#e6787da20ece9d07998533cfd9de6f5c38f4bc05" + integrity sha512-gQxTNE/GAfIIrmHLUE3oJyp5FO6HRBfhjnw4/wMmA63ZGDJnWBmgY/lyQBpnDUkGmAhbSe39tx2d/iTOAfglwQ== dependencies: node-int64 "^0.4.0" @@ -2610,26 +2870,27 @@ btoa-lite@^1.0.0: buffer-equal@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/buffer-equal/-/buffer-equal-1.0.0.tgz#59616b498304d556abd466966b22eeda3eca5fbe" + integrity sha1-WWFrSYME1Var1GaWayLu2j7KX74= + +buffer-es6@^4.9.2, buffer-es6@^4.9.3: + version "4.9.3" + resolved "https://registry.yarnpkg.com/buffer-es6/-/buffer-es6-4.9.3.tgz#f26347b82df76fd37e18bcb5288c4970cfd5c404" + integrity sha1-8mNHuC33b9N+GLy1KIxJcM/VxAQ= buffer-from@^1.0.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/buffer-from/-/buffer-from-1.1.0.tgz#87fcaa3a298358e0ade6e442cfce840740d1ad04" + version "1.1.1" + resolved "https://registry.yarnpkg.com/buffer-from/-/buffer-from-1.1.1.tgz#32713bc028f75c02fdb710d7c7bcec1f2c6070ef" + integrity sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A== buffer-xor@^1.0.3: version "1.0.3" resolved "https://registry.yarnpkg.com/buffer-xor/-/buffer-xor-1.0.3.tgz#26e61ed1422fb70dd42e6e36729ed51d855fe8d9" - -buffer@^4.3.0: - version "4.9.1" - resolved "https://registry.yarnpkg.com/buffer/-/buffer-4.9.1.tgz#6d1bb601b07a4efced97094132093027c95bc298" - dependencies: - base64-js "^1.0.2" - ieee754 "^1.1.4" - isarray "^1.0.0" + integrity sha1-JuYe0UIvtw3ULm42cp7VHYVf6Nk= buffer@^5.0.2: - version "5.2.0" - resolved "https://registry.yarnpkg.com/buffer/-/buffer-5.2.0.tgz#53cf98241100099e9eeae20ee6d51d21b16e541e" + version "5.4.3" + resolved "https://registry.yarnpkg.com/buffer/-/buffer-5.4.3.tgz#3fbc9c69eb713d323e3fc1a895eee0710c072115" + integrity sha512-zvj65TkFeIt3i6aj5bIvJDzjjQQGs4o/sNoezg1F1kYap9Nu2jcUdpwzRSJTHMMzG0H7bZkn4rNQpImhuxWX2A== dependencies: base64-js "^1.0.2" ieee754 "^1.1.4" @@ -2642,14 +2903,17 @@ builtin-modules@^3.1.0: builtin-status-codes@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/builtin-status-codes/-/builtin-status-codes-3.0.0.tgz#85982878e21b98e1c66425e03d0174788f569ee8" + integrity sha1-hZgoeOIbmOHGZCXgPQF0eI9Wnug= builtins@^1.0.3: version "1.0.3" resolved "https://registry.yarnpkg.com/builtins/-/builtins-1.0.3.tgz#cb94faeb61c8696451db36534e1422f94f0aee88" + integrity sha1-y5T662HIaWRR2zZTThQi+U8K7og= bundle-collapser@^1.2.1: version "1.3.0" resolved "https://registry.yarnpkg.com/bundle-collapser/-/bundle-collapser-1.3.0.tgz#f4b4ff58b2f22ee7701b20fa76306e23f53a3fb6" + integrity sha1-9LT/WLLyLudwGyD6djBuI/U6P7Y= dependencies: browser-pack "^5.0.1" browser-unpack "^1.1.0" @@ -2661,27 +2925,30 @@ bundle-collapser@^1.2.1: byline@^5.0.0: version "5.0.0" resolved "https://registry.yarnpkg.com/byline/-/byline-5.0.0.tgz#741c5216468eadc457b03410118ad77de8c1ddb1" + integrity sha1-dBxSFkaOrcRXsDQQEYrXfejB3bE= -byte-size@^4.0.3: - version "4.0.4" - resolved "https://registry.yarnpkg.com/byte-size/-/byte-size-4.0.4.tgz#29d381709f41aae0d89c631f1c81aec88cd40b23" +byte-size@^5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/byte-size/-/byte-size-5.0.1.tgz#4b651039a5ecd96767e71a3d7ed380e48bed4191" + integrity sha512-/XuKeqWocKsYa/cBY1YbSJSWWqTi4cFgr9S6OyM7PBaPbr9zvNGwWP33vt0uqGhwDdN+y3yhbXVILEUpnwEWGw== -cacache@^11.0.1, cacache@^11.3.2: - version "11.3.2" - resolved "https://registry.yarnpkg.com/cacache/-/cacache-11.3.2.tgz#2d81e308e3d258ca38125b676b98b2ac9ce69bfa" - integrity sha512-E0zP4EPGDOaT2chM08Als91eYnf8Z+eH1awwwVsngUmgppfM5jjJ8l3z5vO5p5w/I3LsiXawb1sW0VY65pQABg== +cacache@^12.0.0, cacache@^12.0.3: + version "12.0.3" + resolved "https://registry.yarnpkg.com/cacache/-/cacache-12.0.3.tgz#be99abba4e1bf5df461cd5a2c1071fc432573390" + integrity sha512-kqdmfXEGFepesTuROHMs3MpFLWrPkSSpRqOw80RCflZXy/khxaArvFrQ7uJxSUduzAufc6G0g1VUCOZXxWavPw== dependencies: - bluebird "^3.5.3" + bluebird "^3.5.5" chownr "^1.1.1" figgy-pudding "^3.5.1" - glob "^7.1.3" + glob "^7.1.4" graceful-fs "^4.1.15" + infer-owner "^1.0.3" lru-cache "^5.1.1" mississippi "^3.0.0" mkdirp "^0.5.1" move-concurrently "^1.0.1" promise-inflight "^1.0.1" - rimraf "^2.6.2" + rimraf "^2.6.3" ssri "^6.0.1" unique-filename "^1.1.1" y18n "^4.0.0" @@ -2689,6 +2956,7 @@ cacache@^11.0.1, cacache@^11.3.2: cache-base@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/cache-base/-/cache-base-1.0.1.tgz#0a7f46416831c8b662ee36fe4e7c59d76f666ab2" + integrity sha512-AKcdTnFSWATd5/GCPRxr2ChwIJ85CeyrEyjRHlKxQ56d4XJMGym0uAiKn0xbLOGOl3+yRpOTi484dVCEc5AUzQ== dependencies: collection-visit "^1.0.0" component-emitter "^1.2.1" @@ -2700,44 +2968,44 @@ cache-base@^1.0.1: union-value "^1.0.0" unset-value "^1.0.0" -cached-path-relative@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/cached-path-relative/-/cached-path-relative-1.0.1.tgz#d09c4b52800aa4c078e2dd81a869aac90d2e54e7" +cached-path-relative@^1.0.0, cached-path-relative@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/cached-path-relative/-/cached-path-relative-1.0.2.tgz#a13df4196d26776220cc3356eb147a52dba2c6db" + integrity sha512-5r2GqsoEb4qMTTN9J+WzXfjov+hjxT+j3u5K+kIVNIwAd99DLCJE9pBIMP1qVeybV6JiijL385Oz0DcYxfbOIg== call-me-maybe@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/call-me-maybe/-/call-me-maybe-1.0.1.tgz#26d208ea89e37b5cbde60250a15f031c16a4d66b" + integrity sha1-JtII6onje1y95gJQoV8DHBak1ms= caller-callsite@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/caller-callsite/-/caller-callsite-2.0.0.tgz#847e0fce0a223750a9a027c54b33731ad3154134" + integrity sha1-hH4PzgoiN1CpoCfFSzNzGtMVQTQ= dependencies: callsites "^2.0.0" caller-path@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/caller-path/-/caller-path-2.0.0.tgz#468f83044e369ab2010fac5f06ceee15bb2cb1f4" + integrity sha1-Ro+DBE42mrIBD6xfBs7uFbsssfQ= dependencies: caller-callsite "^2.0.0" callsites@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/callsites/-/callsites-2.0.0.tgz#06eb84f00eea413da86affefacbffb36093b3c50" + integrity sha1-BuuE8A7qQT2oav/vrL/7Ngk7PFA= callsites@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/callsites/-/callsites-3.0.0.tgz#fb7eb569b72ad7a45812f93fd9430a3e410b3dd3" - -camel-case@3.0.x: - version "3.0.0" - resolved "https://registry.yarnpkg.com/camel-case/-/camel-case-3.0.0.tgz#ca3c3688a4e9cf3a4cda777dc4dcbc713249cf73" - dependencies: - no-case "^2.2.0" - upper-case "^1.1.1" + version "3.1.0" + resolved "https://registry.yarnpkg.com/callsites/-/callsites-3.1.0.tgz#b3630abd8943432f54b3f0519238e33cd7df2f73" + integrity sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ== camelcase-keys@^2.0.0: version "2.1.0" resolved "https://registry.yarnpkg.com/camelcase-keys/-/camelcase-keys-2.1.0.tgz#308beeaffdf28119051efa1d932213c91b8f92e7" + integrity sha1-MIvur/3ygRkFHvodkyITyRuPkuc= dependencies: camelcase "^2.0.0" map-obj "^1.0.0" @@ -2745,56 +3013,53 @@ camelcase-keys@^2.0.0: camelcase-keys@^4.0.0: version "4.2.0" resolved "https://registry.yarnpkg.com/camelcase-keys/-/camelcase-keys-4.2.0.tgz#a2aa5fb1af688758259c32c141426d78923b9b77" + integrity sha1-oqpfsa9oh1glnDLBQUJteJI7m3c= dependencies: camelcase "^4.1.0" map-obj "^2.0.0" quick-lru "^1.0.0" -camelcase@^1.0.2: - version "1.2.1" - resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-1.2.1.tgz#9bb5304d2e0b56698b2c758b08a3eaa9daa58a39" - camelcase@^2.0.0: version "2.1.1" resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-2.1.1.tgz#7c1d16d679a1bbe59ca02cacecfb011e201f5a1f" + integrity sha1-fB0W1nmhu+WcoCys7PsBHiAfWh8= camelcase@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-3.0.0.tgz#32fc4b9fcdaf845fcdf7e73bb97cac2261f0ab0a" + integrity sha1-MvxLn82vhF/N9+c7uXysImHwqwo= camelcase@^4.1.0: version "4.1.0" resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-4.1.0.tgz#d545635be1e33c542649c69173e5de6acfae34dd" + integrity sha1-1UVjW+HjPFQmScaRc+Xeas+uNN0= -camelcase@^5.0.0: - version "5.0.0" - resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-5.0.0.tgz#03295527d58bd3cd4aa75363f35b2e8d97be2f42" +camelcase@^5.0.0, camelcase@^5.3.1: + version "5.3.1" + resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-5.3.1.tgz#e3c9b31569e106811df242f715725a1f4c494320" + integrity sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg== -caniuse-lite@^1.0.30000967: - version "1.0.30000967" - resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30000967.tgz#a5039577806fccee80a04aaafb2c0890b1ee2f73" - integrity sha512-rUBIbap+VJfxTzrM4akJ00lkvVb5/n5v3EGXfWzSH5zT8aJmGzjA8HWhJ4U6kCpzxozUSnB+yvAYDRPY6mRpgQ== +caniuse-lite@^1.0.30001030: + version "1.0.30001033" + resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001033.tgz#60c328fb56860de60f9a2cb419c31fb80587cba0" + integrity sha512-8Ibzxee6ibc5q88cM1usPsMpJOG5CTq0s/dKOmlekPbDGKt+UrnOOTPSjQz3kVo6yL7N4SB5xd+FGLHQmbzh6A== -capture-exit@^1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/capture-exit/-/capture-exit-1.2.0.tgz#1c5fcc489fd0ab00d4f1ac7ae1072e3173fbab6f" +capture-exit@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/capture-exit/-/capture-exit-2.0.0.tgz#fb953bfaebeb781f62898239dabb426d08a509a4" + integrity sha512-PiT/hQmTonHhl/HFGN+Lx3JJUznrVYJ3+AQsnthneZbvW7x+f08Tk7yLJTLEOUvBTbduLeeBkxEaYXUOUrRq6g== dependencies: - rsvp "^3.3.3" + rsvp "^4.8.4" caseless@~0.12.0: version "0.12.0" resolved "https://registry.yarnpkg.com/caseless/-/caseless-0.12.0.tgz#1b681c21ff84033c826543090689420d187151dc" - -center-align@^0.1.1: - version "0.1.3" - resolved "https://registry.yarnpkg.com/center-align/-/center-align-0.1.3.tgz#aa0d32629b6ee972200411cbd4461c907bc2b7ad" - dependencies: - align-text "^0.1.3" - lazy-cache "^1.0.3" + integrity sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw= chalk@^1.0.0, chalk@^1.1.3: version "1.1.3" resolved "https://registry.yarnpkg.com/chalk/-/chalk-1.1.3.tgz#a8115c55e4a702fe4d150abd3872822a7e09fc98" + integrity sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg= dependencies: ansi-styles "^2.2.1" escape-string-regexp "^1.0.2" @@ -2802,7 +3067,7 @@ chalk@^1.0.0, chalk@^1.1.3: strip-ansi "^3.0.0" supports-color "^2.0.0" -chalk@^2.0.0, chalk@^2.0.1, chalk@^2.1.0, chalk@^2.3.0, chalk@^2.3.1, chalk@^2.4.1, chalk@^2.4.2: +chalk@^2.0.0, chalk@^2.0.1, chalk@^2.1.0, chalk@^2.3.1, chalk@^2.4.1, chalk@^2.4.2: version "2.4.2" resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.4.2.tgz#cd42541677a54333cf541a49108c1432b44c9424" integrity sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ== @@ -2814,26 +3079,17 @@ chalk@^2.0.0, chalk@^2.0.1, chalk@^2.1.0, chalk@^2.3.0, chalk@^2.3.1, chalk@^2.4 charcodes@^0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/charcodes/-/charcodes-0.2.0.tgz#5208d327e6cc05f99eb80ffc814707572d1f14e4" + integrity sha512-Y4kiDb+AM4Ecy58YkuZrrSRJBDQdQ2L+NyS1vHHFtNtUjgutcZfx3yp1dAONI/oPaPmyGfCLx5CxL+zauIMyKQ== chardet@^0.7.0: version "0.7.0" resolved "https://registry.yarnpkg.com/chardet/-/chardet-0.7.0.tgz#90094849f0937f2eedc2425d0d28a9e5f0cbad9e" + integrity sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA== -cheerio@^1.0.0-rc.1: - version "1.0.0-rc.2" - resolved "https://registry.yarnpkg.com/cheerio/-/cheerio-1.0.0-rc.2.tgz#4b9f53a81b27e4d5dac31c0ffd0cfa03cc6830db" - dependencies: - css-select "~1.2.0" - dom-serializer "~0.1.0" - entities "~1.1.1" - htmlparser2 "^3.9.1" - lodash "^4.15.0" - parse5 "^3.0.1" - -chokidar@^2.0.0, chokidar@^2.0.2, chokidar@^2.0.4: - version "2.1.6" - resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-2.1.6.tgz#b6cad653a929e244ce8a834244164d241fa954c5" - integrity sha512-V2jUo67OKkc6ySiRpJrjlpJKl9kDuG+Xb8VgsGzb+aEouhgS1D0weyPU4lEzdAcsCAvrih2J2BqyXqHWvVLw5g== +chokidar@^2.0.0, chokidar@^2.1.8: + version "2.1.8" + resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-2.1.8.tgz#804b3a7b6a99358c3c5c61e71d8728f041cff917" + integrity sha512-ZmZUazfOzf0Nve7duiCKD23PFSCs4JPoYyccjUFF3aQkQadqBhfzhjkwBH2mNOG9cTBwhamM37EIsIkZw3nRgg== dependencies: anymatch "^2.0.0" async-each "^1.0.1" @@ -2849,21 +3105,20 @@ chokidar@^2.0.0, chokidar@^2.0.2, chokidar@^2.0.4: optionalDependencies: fsevents "^1.2.7" -chownr@^1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/chownr/-/chownr-1.1.1.tgz#54726b8b8fff4df053c42187e801fb4412df1494" - -ci-info@^1.0.0: - version "1.1.2" - resolved "https://registry.yarnpkg.com/ci-info/-/ci-info-1.1.2.tgz#03561259db48d0474c8bdc90f5b47b068b6bbfb4" +chownr@^1.1.1, chownr@^1.1.2: + version "1.1.3" + resolved "https://registry.yarnpkg.com/chownr/-/chownr-1.1.3.tgz#42d837d5239688d55f303003a508230fa6727142" + integrity sha512-i70fVHhmV3DtTl6nqvZOnIjbY0Pe4kAUjwHj8z0zAdgBtYrJyYwLKCCuRBQ5ppkyL0AkN7HKRnETdmdp1zqNXw== ci-info@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/ci-info/-/ci-info-2.0.0.tgz#67a9e964be31a51e15e5010d58e6f12834002f46" + integrity sha512-5tK7EtrZ0N+OLFMthtqOj4fI2Jeb88C4CAZPu25LDVUgXJ0A3Js4PMGqrn0JU1W0Mh1/Z8wZzYPxqUrXeBboCQ== cipher-base@^1.0.0, cipher-base@^1.0.1, cipher-base@^1.0.3: version "1.0.4" resolved "https://registry.yarnpkg.com/cipher-base/-/cipher-base-1.0.4.tgz#8760e4ecc272f4c363532f926d874aae2c1397de" + integrity sha512-Kkht5ye6ZGmwv40uUDZztayT2ThLQGfnj/T71N/XzeZeo3nf8foyW7zGTsPYkEya3m5f3cAypH+qe7YOrM1U2Q== dependencies: inherits "^2.0.1" safe-buffer "^5.0.1" @@ -2871,27 +3126,36 @@ cipher-base@^1.0.0, cipher-base@^1.0.1, cipher-base@^1.0.3: class-utils@^0.3.5: version "0.3.6" resolved "https://registry.yarnpkg.com/class-utils/-/class-utils-0.3.6.tgz#f93369ae8b9a7ce02fd41faad0ca83033190c463" + integrity sha512-qOhPa/Fj7s6TY8H8esGu5QNpMMQxz79h+urzrNYN6mn+9BnxlDGf5QZ+XeCDsxSjPqsSR56XOZOJmpeurnLMeg== dependencies: arr-union "^3.1.0" define-property "^0.2.5" isobject "^3.0.0" static-extend "^0.1.1" -clean-css@4.1.x: - version "4.1.9" - resolved "https://registry.yarnpkg.com/clean-css/-/clean-css-4.1.9.tgz#35cee8ae7687a49b98034f70de00c4edd3826301" - dependencies: - source-map "0.5.x" +clean-stack@^2.0.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/clean-stack/-/clean-stack-2.2.0.tgz#ee8472dbb129e727b31e8a10a427dee9dfe4008b" + integrity sha512-4diC9HaTE+KRAMWhDhrGOECgWZxoevMc5TlkObMqNSsVU62PYzXZ/SMTjzyGAFF1YusgxGcSWTEXBhp0CPwQ1A== cli-cursor@^2.0.0, cli-cursor@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/cli-cursor/-/cli-cursor-2.1.0.tgz#b35dac376479facc3e94747d41d0d0f5238ffcb5" + integrity sha1-s12sN2R5+sw+lHR9QdDQ9SOP/LU= dependencies: restore-cursor "^2.0.0" +cli-cursor@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/cli-cursor/-/cli-cursor-3.1.0.tgz#264305a7ae490d1d03bf0c9ba7c925d1753af307" + integrity sha512-I/zHAwsKf9FqGoXM4WWRACob9+SNukZTd94DWF57E4toouRulbCxcUh6RKUEOQlYTHJnzkPMySvPNaaSLNfLZw== + dependencies: + restore-cursor "^3.1.0" + cli-truncate@^0.2.1: version "0.2.1" resolved "https://registry.yarnpkg.com/cli-truncate/-/cli-truncate-0.2.1.tgz#9f15cfbb0705005369216c626ac7d05ab90dd574" + integrity sha1-nxXPuwcFAFNpIWxiasfQWrkN1XQ= dependencies: slice-ansi "0.0.4" string-width "^1.0.1" @@ -2899,77 +3163,92 @@ cli-truncate@^0.2.1: cli-width@^2.0.0: version "2.2.0" resolved "https://registry.yarnpkg.com/cli-width/-/cli-width-2.2.0.tgz#ff19ede8a9a5e579324147b0c11f0fbcbabed639" - -cliui@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/cliui/-/cliui-2.1.0.tgz#4b475760ff80264c762c3a1719032e91c7fea0d1" - dependencies: - center-align "^0.1.1" - right-align "^0.1.1" - wordwrap "0.0.2" + integrity sha1-/xnt6Kml5XkyQUewwR8PvLq+1jk= cliui@^3.2.0: version "3.2.0" resolved "https://registry.yarnpkg.com/cliui/-/cliui-3.2.0.tgz#120601537a916d29940f934da3b48d585a39213d" + integrity sha1-EgYBU3qRbSmUD5NNo7SNWFo5IT0= dependencies: string-width "^1.0.1" strip-ansi "^3.0.1" wrap-ansi "^2.0.0" -cliui@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/cliui/-/cliui-4.0.0.tgz#743d4650e05f36d1ed2575b59638d87322bfbbcc" +cliui@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/cliui/-/cliui-5.0.0.tgz#deefcfdb2e800784aa34f46fa08e06851c7bbbc5" + integrity sha512-PYeGSEmmHM6zvoef2w8TPzlrnNpXIjTipYK780YswmIP9vjxmd6Y2a3CB2Ks6/AU8NHjZugXvo8w3oWM2qnwXA== dependencies: - string-width "^2.1.1" - strip-ansi "^4.0.0" - wrap-ansi "^2.0.0" + string-width "^3.1.0" + strip-ansi "^5.2.0" + wrap-ansi "^5.1.0" + +cliui@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/cliui/-/cliui-6.0.0.tgz#511d702c0c4e41ca156d7d0e96021f23e13225b1" + integrity sha512-t6wbgtoCXvAzst7QgXxJYqPt0usEfbgQdftEPbLL/cvv6HPE5VgvqCuAIDR0NgU52ds6rFwqrgakNLrHEjCbrQ== + dependencies: + string-width "^4.2.0" + strip-ansi "^6.0.0" + wrap-ansi "^6.2.0" clone-buffer@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/clone-buffer/-/clone-buffer-1.0.0.tgz#e3e25b207ac4e701af721e2cb5a16792cac3dc58" + integrity sha1-4+JbIHrE5wGvch4staFnksrD3Fg= -clone-stats@^0.0.1: - version "0.0.1" - resolved "https://registry.yarnpkg.com/clone-stats/-/clone-stats-0.0.1.tgz#b88f94a82cf38b8791d58046ea4029ad88ca99d1" +clone-deep@^4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/clone-deep/-/clone-deep-4.0.1.tgz#c19fd9bdbbf85942b4fd979c84dcf7d5f07c2387" + integrity sha512-neHB9xuzh/wk0dIHweyAXv2aPGZIVk3pLMe+/RNzINf17fe0OG96QroktYAUm7SM1PBnzTabaLboqqxDyMU+SQ== + dependencies: + is-plain-object "^2.0.4" + kind-of "^6.0.2" + shallow-clone "^3.0.0" clone-stats@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/clone-stats/-/clone-stats-1.0.0.tgz#b3782dff8bb5474e18b9b6bf0fdfe782f8777680" + integrity sha1-s3gt/4u1R04Yuba/D9/ngvh3doA= -clone@^1.0.0, clone@^1.0.2: - version "1.0.3" - resolved "https://registry.yarnpkg.com/clone/-/clone-1.0.3.tgz#298d7e2231660f40c003c2ed3140decf3f53085f" +clone@^1.0.2: + version "1.0.4" + resolved "https://registry.yarnpkg.com/clone/-/clone-1.0.4.tgz#da309cc263df15994c688ca902179ca3c7cd7c7e" + integrity sha1-2jCcwmPfFZlMaIypAheco8fNfH4= clone@^2.1.1: - version "2.1.1" - resolved "https://registry.yarnpkg.com/clone/-/clone-2.1.1.tgz#d217d1e961118e3ac9a4b8bba3285553bf647cdb" + version "2.1.2" + resolved "https://registry.yarnpkg.com/clone/-/clone-2.1.2.tgz#1b7f4b9f591f1e8f83670401600345a02887435f" + integrity sha1-G39Ln1kfHo+DZwQBYANFoCiHQ18= + +clone@~0.1.9: + version "0.1.19" + resolved "https://registry.yarnpkg.com/clone/-/clone-0.1.19.tgz#613fb68639b26a494ac53253e15b1a6bd88ada85" + integrity sha1-YT+2hjmyaklKxTJT4Vsaa9iK2oU= cloneable-readable@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/cloneable-readable/-/cloneable-readable-1.0.0.tgz#a6290d413f217a61232f95e458ff38418cfb0117" + version "1.1.3" + resolved "https://registry.yarnpkg.com/cloneable-readable/-/cloneable-readable-1.1.3.tgz#120a00cb053bfb63a222e709f9683ea2e11d8cec" + integrity sha512-2EF8zTQOxYq70Y4XKtorQupqF0m49MBz2/yf5Bj+MHjvpG3Hy7sImifnqD6UA+TKYxeSV+u6qqQPawN5UvnpKQ== dependencies: inherits "^2.0.1" - process-nextick-args "^1.0.6" - through2 "^2.0.1" - -cmd-shim@^2.0.2: - version "2.0.2" - resolved "https://registry.yarnpkg.com/cmd-shim/-/cmd-shim-2.0.2.tgz#6fcbda99483a8fd15d7d30a196ca69d688a2efdb" - dependencies: - graceful-fs "^4.1.2" - mkdirp "~0.5.0" + process-nextick-args "^2.0.0" + readable-stream "^2.3.5" co@^4.6.0: version "4.6.0" resolved "https://registry.yarnpkg.com/co/-/co-4.6.0.tgz#6ea6bdf3d853ae54ccb8e47bfa0bf3f9031fb184" + integrity sha1-bqa989hTrlTMuOR7+gvz+QMfsYQ= code-point-at@^1.0.0: version "1.1.0" resolved "https://registry.yarnpkg.com/code-point-at/-/code-point-at-1.1.0.tgz#0d070b4d043a5bea33a2f1a40e2edb3d9a4ccf77" + integrity sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c= collection-map@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/collection-map/-/collection-map-1.0.0.tgz#aea0f06f8d26c780c2b75494385544b2255af18c" + integrity sha1-rqDwb40mx4DCt1SUOFVEsiVa8Yw= dependencies: arr-map "^2.0.2" for-own "^1.0.0" @@ -2978,154 +3257,176 @@ collection-map@^1.0.0: collection-visit@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/collection-visit/-/collection-visit-1.0.0.tgz#4bc0373c164bc3291b4d368c829cf1a80a59dca0" + integrity sha1-S8A3PBZLwykbTTaMgpzxqApZ3KA= dependencies: map-visit "^1.0.0" object-visit "^1.0.0" color-convert@^1.9.0: - version "1.9.1" - resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-1.9.1.tgz#c1261107aeb2f294ebffec9ed9ecad529a6097ed" + version "1.9.3" + resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-1.9.3.tgz#bb71850690e1f136567de629d2d5471deda4c1e8" + integrity sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg== dependencies: - color-name "^1.1.1" + color-name "1.1.3" -color-name@^1.1.1: +color-convert@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-2.0.1.tgz#72d3a68d598c9bdb3af2ad1e84f21d896abd4de3" + integrity sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ== + dependencies: + color-name "~1.1.4" + +color-name@1.1.3: version "1.1.3" resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.3.tgz#a7d0558bd89c42f795dd42328f740831ca53bc25" + integrity sha1-p9BVi9icQveV3UIyj3QIMcpTvCU= + +color-name@~1.1.4: + version "1.1.4" + resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.4.tgz#c2a09a87acbde69543de6f63fa3995c826c536a2" + integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA== color-support@^1.1.3: version "1.1.3" resolved "https://registry.yarnpkg.com/color-support/-/color-support-1.1.3.tgz#93834379a1cc9a0c61f82f52f0d04322251bd5a2" + integrity sha512-qiBjkpbMLO/HL68y+lh4q0/O1MZFj2RX6X/KmMa3+gJD3z+WwI1ZzDHysvqHGS3mP6mznPckpXmw1nI9cJjyRg== columnify@^1.5.4: version "1.5.4" resolved "https://registry.yarnpkg.com/columnify/-/columnify-1.5.4.tgz#4737ddf1c7b69a8a7c340570782e947eec8e78bb" + integrity sha1-Rzfd8ce2mop8NAVweC6UfuyOeLs= dependencies: strip-ansi "^3.0.0" wcwidth "^1.0.0" -combine-source-map@~0.6.1: - version "0.6.1" - resolved "https://registry.yarnpkg.com/combine-source-map/-/combine-source-map-0.6.1.tgz#9b4a09c316033d768e0f11e029fa2730e079ad96" - dependencies: - convert-source-map "~1.1.0" - inline-source-map "~0.5.0" - lodash.memoize "~3.0.3" - source-map "~0.4.2" - -combine-source-map@~0.7.1: - version "0.7.2" - resolved "https://registry.yarnpkg.com/combine-source-map/-/combine-source-map-0.7.2.tgz#0870312856b307a87cc4ac486f3a9a62aeccc09e" +combine-source-map@^0.8.0, combine-source-map@~0.8.0: + version "0.8.0" + resolved "https://registry.yarnpkg.com/combine-source-map/-/combine-source-map-0.8.0.tgz#a58d0df042c186fcf822a8e8015f5450d2d79a8b" + integrity sha1-pY0N8ELBhvz4IqjoAV9UUNLXmos= dependencies: convert-source-map "~1.1.0" inline-source-map "~0.6.0" lodash.memoize "~3.0.3" source-map "~0.5.3" -combine-source-map@~0.8.0: - version "0.8.0" - resolved "https://registry.yarnpkg.com/combine-source-map/-/combine-source-map-0.8.0.tgz#a58d0df042c186fcf822a8e8015f5450d2d79a8b" +combine-source-map@~0.6.1: + version "0.6.1" + resolved "https://registry.yarnpkg.com/combine-source-map/-/combine-source-map-0.6.1.tgz#9b4a09c316033d768e0f11e029fa2730e079ad96" + integrity sha1-m0oJwxYDPXaODxHgKfonMOB5rZY= dependencies: convert-source-map "~1.1.0" - inline-source-map "~0.6.0" + inline-source-map "~0.5.0" lodash.memoize "~3.0.3" - source-map "~0.5.3" + source-map "~0.4.2" combined-stream@^1.0.6, combined-stream@~1.0.6: - version "1.0.7" - resolved "https://registry.yarnpkg.com/combined-stream/-/combined-stream-1.0.7.tgz#2d1d24317afb8abe95d6d2c0b07b57813539d828" + version "1.0.8" + resolved "https://registry.yarnpkg.com/combined-stream/-/combined-stream-1.0.8.tgz#c3d45a8b34fd730631a110a8a2520682b31d5a7f" + integrity sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg== dependencies: delayed-stream "~1.0.0" -commander@2.14.x, commander@^2.14.1, commander@^2.8.1, commander@^2.9.0, commander@~2.14.1: - version "2.14.1" - resolved "https://registry.yarnpkg.com/commander/-/commander-2.14.1.tgz#2235123e37af8ca3c65df45b026dbd357b01b9aa" +commander@^2.20.0, commander@~2.20.3: + version "2.20.3" + resolved "https://registry.yarnpkg.com/commander/-/commander-2.20.3.tgz#fd485e84c03eb4881c20722ba48035e8531aeb33" + integrity sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ== + +commander@^4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/commander/-/commander-4.0.1.tgz#b67622721785993182e807f4883633e6401ba53c" + integrity sha512-IPF4ouhCP+qdlcmCedhxX4xiGBPyigb8v5NeUp+0LyhwLgxMqyp3S0vl7TAPfS/hiP7FC3caI/PB9lTmP8r1NA== commondir@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/commondir/-/commondir-1.0.1.tgz#ddd800da0c66127393cca5950ea968a3aaf1253b" + integrity sha1-3dgA2gxmEnOTzKWVDqloo6rxJTs= compare-func@^1.3.1: version "1.3.2" resolved "https://registry.yarnpkg.com/compare-func/-/compare-func-1.3.2.tgz#99dd0ba457e1f9bc722b12c08ec33eeab31fa648" + integrity sha1-md0LpFfh+bxyKxLAjsM+6rMfpkg= dependencies: array-ify "^1.0.0" dot-prop "^3.0.0" component-emitter@^1.2.1: - version "1.2.1" - resolved "https://registry.yarnpkg.com/component-emitter/-/component-emitter-1.2.1.tgz#137918d6d78283f7df7a6b7c5a63e140e69425e6" + version "1.3.0" + resolved "https://registry.yarnpkg.com/component-emitter/-/component-emitter-1.3.0.tgz#16e4070fba8ae29b679f2215853ee181ab2eabc0" + integrity sha512-Rd3se6QB+sO1TwqZjscQrurpEPIfO0/yYnSin6Q/rD3mOutHvUrCAhJub3r90uNb+SESBuE0QYoB90YdfatsRg== concat-map@0.0.1: version "0.0.1" resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" + integrity sha1-2Klr13/Wjfd5OnMDajug1UBdR3s= -concat-stream@^1.4.6, concat-stream@^1.5.0, concat-stream@^1.6.0, concat-stream@~1.6.0: +concat-stream@^1.4.4, concat-stream@^1.4.6, concat-stream@^1.5.0, concat-stream@^1.6.0, concat-stream@^1.6.1, concat-stream@~1.6.0: version "1.6.2" resolved "https://registry.yarnpkg.com/concat-stream/-/concat-stream-1.6.2.tgz#904bdf194cd3122fc675c77fc4ac3d4ff0fd1a34" + integrity sha512-27HBghJxjiZtIk3Ycvn/4kbJk/1uZuJFfuPEns6LaEvpvG1f0hTea8lilrouyo9mVc2GWdcEZ8OLoGmSADlrCw== dependencies: buffer-from "^1.0.0" inherits "^2.0.3" readable-stream "^2.2.2" typedarray "^0.0.6" -concat-stream@~1.5.1: - version "1.5.2" - resolved "https://registry.yarnpkg.com/concat-stream/-/concat-stream-1.5.2.tgz#708978624d856af41a5a741defdd261da752c266" +concat-stream@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/concat-stream/-/concat-stream-2.0.0.tgz#414cf5af790a48c60ab9be4527d56d5e41133cb1" + integrity sha512-MWufYdFw53ccGjCA+Ol7XJYpAlW6/prSMzuPOTRnJGcGzuhLn4Scrz7qf6o8bROZ514ltazcIFJZevcfbo0x7A== dependencies: - inherits "~2.0.1" - readable-stream "~2.0.0" - typedarray "~0.0.5" + buffer-from "^1.0.0" + inherits "^2.0.3" + readable-stream "^3.0.2" + typedarray "^0.0.6" config-chain@^1.1.11: version "1.1.12" resolved "https://registry.yarnpkg.com/config-chain/-/config-chain-1.1.12.tgz#0fde8d091200eb5e808caf25fe618c02f48e4efa" + integrity sha512-a1eOIcu8+7lUInge4Rpf/n4Krkf3Dd9lqhljRzII1/Zno/kRtUWnznPO3jOKBmTEktkt3fkxisUcivoj0ebzoA== dependencies: ini "^1.3.4" proto-list "~1.2.1" console-browserify@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/console-browserify/-/console-browserify-1.1.0.tgz#f0241c45730a9fc6323b206dbf38edc741d0bb10" - dependencies: - date-now "^0.1.4" + version "1.2.0" + resolved "https://registry.yarnpkg.com/console-browserify/-/console-browserify-1.2.0.tgz#67063cef57ceb6cf4993a2ab3a55840ae8c49336" + integrity sha512-ZMkYO/LkF17QvCPqM0gxw8yUzigAOZOSWSHg91FH6orS7vcEj5dVZTidN2fQ14yBSdg97RqhSNwLUXInd52OTA== console-control-strings@^1.0.0, console-control-strings@~1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/console-control-strings/-/console-control-strings-1.1.0.tgz#3d7cf4464db6446ea644bf4b39507f9851008e8e" + integrity sha1-PXz0Rk22RG6mRL9LOVB/mFEAjo4= -constants-browserify@^1.0.0, constants-browserify@~1.0.0: +constants-browserify@~1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/constants-browserify/-/constants-browserify-1.0.0.tgz#c20b96d8c617748aaf1c16021760cd27fcb8cb75" + integrity sha1-wguW2MYXdIqvHBYCF2DNJ/y4y3U= contains-path@^0.1.0: version "0.1.0" resolved "https://registry.yarnpkg.com/contains-path/-/contains-path-0.1.0.tgz#fe8cf184ff6670b6baef01a9d4861a5cbec4120a" integrity sha1-/ozxhP9mcLa67wGp1IYaXL7EEgo= -content-type-parser@^1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/content-type-parser/-/content-type-parser-1.0.2.tgz#caabe80623e63638b2502fd4c7f12ff4ce2352e7" - conventional-changelog-angular@^5.0.3: - version "5.0.3" - resolved "https://registry.yarnpkg.com/conventional-changelog-angular/-/conventional-changelog-angular-5.0.3.tgz#299fdd43df5a1f095283ac16aeedfb0a682ecab0" - integrity sha512-YD1xzH7r9yXQte/HF9JBuEDfvjxxwDGGwZU1+ndanbY0oFgA+Po1T9JDSpPLdP0pZT6MhCAsdvFKC4TJ4MTJTA== + version "5.0.6" + resolved "https://registry.yarnpkg.com/conventional-changelog-angular/-/conventional-changelog-angular-5.0.6.tgz#269540c624553aded809c29a3508fdc2b544c059" + integrity sha512-QDEmLa+7qdhVIv8sFZfVxU1VSyVvnXPsxq8Vam49mKUcO1Z8VTLEJk9uI21uiJUsnmm0I4Hrsdc9TgkOQo9WSA== dependencies: compare-func "^1.3.1" q "^1.5.1" conventional-changelog-core@^3.1.6: - version "3.2.2" - resolved "https://registry.yarnpkg.com/conventional-changelog-core/-/conventional-changelog-core-3.2.2.tgz#de41e6b4a71011a18bcee58e744f6f8f0e7c29c0" - integrity sha512-cssjAKajxaOX5LNAJLB+UOcoWjAIBvXtDMedv/58G+YEmAXMNfC16mmPl0JDOuVJVfIqM0nqQiZ8UCm8IXbE0g== + version "3.2.3" + resolved "https://registry.yarnpkg.com/conventional-changelog-core/-/conventional-changelog-core-3.2.3.tgz#b31410856f431c847086a7dcb4d2ca184a7d88fb" + integrity sha512-LMMX1JlxPIq/Ez5aYAYS5CpuwbOk6QFp8O4HLAcZxe3vxoCtABkhfjetk8IYdRB9CDQGwJFLR3Dr55Za6XKgUQ== dependencies: - conventional-changelog-writer "^4.0.5" - conventional-commits-parser "^3.0.2" + conventional-changelog-writer "^4.0.6" + conventional-commits-parser "^3.0.3" dateformat "^3.0.0" get-pkg-repo "^1.0.0" git-raw-commits "2.0.0" git-remote-origin-url "^2.0.0" - git-semver-tags "^2.0.2" + git-semver-tags "^2.0.3" lodash "^4.2.1" normalize-package-data "^2.3.5" q "^1.5.1" @@ -3133,27 +3434,28 @@ conventional-changelog-core@^3.1.6: read-pkg-up "^3.0.0" through2 "^3.0.0" -conventional-changelog-preset-loader@^2.0.2: - version "2.0.2" - resolved "https://registry.yarnpkg.com/conventional-changelog-preset-loader/-/conventional-changelog-preset-loader-2.0.2.tgz#81d1a07523913f3d17da3a49f0091f967ad345b0" +conventional-changelog-preset-loader@^2.1.1: + version "2.3.0" + resolved "https://registry.yarnpkg.com/conventional-changelog-preset-loader/-/conventional-changelog-preset-loader-2.3.0.tgz#580fa8ab02cef22c24294d25e52d7ccd247a9a6a" + integrity sha512-/rHb32J2EJnEXeK4NpDgMaAVTFZS3o1ExmjKMtYVgIC4MQn0vkNSbYpdGRotkfGGRWiqk3Ri3FBkiZGbAfIfOQ== -conventional-changelog-writer@^4.0.5: - version "4.0.5" - resolved "https://registry.yarnpkg.com/conventional-changelog-writer/-/conventional-changelog-writer-4.0.5.tgz#fb9e384bb294e8e8a9f2568a3f4d1e11953d8641" - integrity sha512-g/Myp4MaJ1A+f7Ai+SnVhkcWtaHk6flw0SYN7A+vQ+MTu0+gSovQWs4Pg4NtcNUcIztYQ9YHsoxHP+GGQplI7Q== +conventional-changelog-writer@^4.0.6: + version "4.0.11" + resolved "https://registry.yarnpkg.com/conventional-changelog-writer/-/conventional-changelog-writer-4.0.11.tgz#9f56d2122d20c96eb48baae0bf1deffaed1edba4" + integrity sha512-g81GQOR392I+57Cw3IyP1f+f42ME6aEkbR+L7v1FBBWolB0xkjKTeCWVguzRrp6UiT1O6gBpJbEy2eq7AnV1rw== dependencies: compare-func "^1.3.1" conventional-commits-filter "^2.0.2" dateformat "^3.0.0" - handlebars "^4.1.0" + handlebars "^4.4.0" json-stringify-safe "^5.0.1" - lodash "^4.2.1" - meow "^4.0.0" - semver "^5.5.0" + lodash "^4.17.15" + meow "^5.0.0" + semver "^6.0.0" split "^1.0.0" through2 "^3.0.0" -conventional-commits-filter@^2.0.1, conventional-commits-filter@^2.0.2: +conventional-commits-filter@^2.0.2: version "2.0.2" resolved "https://registry.yarnpkg.com/conventional-commits-filter/-/conventional-commits-filter-2.0.2.tgz#f122f89fbcd5bb81e2af2fcac0254d062d1039c1" integrity sha512-WpGKsMeXfs21m1zIw4s9H5sys2+9JccTzpN6toXtxhpw2VNF2JUXwIakthKBy+LN4DvJm+TzWhxOMWOs1OFCFQ== @@ -3161,43 +3463,49 @@ conventional-commits-filter@^2.0.1, conventional-commits-filter@^2.0.2: lodash.ismatch "^4.4.0" modify-values "^1.0.0" -conventional-commits-parser@^3.0.1, conventional-commits-parser@^3.0.2: - version "3.0.2" - resolved "https://registry.yarnpkg.com/conventional-commits-parser/-/conventional-commits-parser-3.0.2.tgz#1295590dd195f64f53d6f8eb7c41114bb9a60742" - integrity sha512-y5eqgaKR0F6xsBNVSQ/5cI5qIF3MojddSUi1vKIggRkqUTbkqFKH9P5YX/AT1BVZp9DtSzBTIkvjyVLotLsVog== +conventional-commits-parser@^3.0.3: + version "3.0.8" + resolved "https://registry.yarnpkg.com/conventional-commits-parser/-/conventional-commits-parser-3.0.8.tgz#23310a9bda6c93c874224375e72b09fb275fe710" + integrity sha512-YcBSGkZbYp7d+Cr3NWUeXbPDFUN6g3SaSIzOybi8bjHL5IJ5225OSCxJJ4LgziyEJ7AaJtE9L2/EU6H7Nt/DDQ== dependencies: JSONStream "^1.0.4" - is-text-path "^1.0.0" - lodash "^4.2.1" - meow "^4.0.0" + is-text-path "^1.0.1" + lodash "^4.17.15" + meow "^5.0.0" split2 "^2.0.0" through2 "^3.0.0" trim-off-newlines "^1.0.0" -conventional-recommended-bump@^4.0.4: - version "4.0.4" - resolved "https://registry.yarnpkg.com/conventional-recommended-bump/-/conventional-recommended-bump-4.0.4.tgz#05540584641d3da758c8863c09788fcaeb586872" +conventional-recommended-bump@^5.0.0: + version "5.0.1" + resolved "https://registry.yarnpkg.com/conventional-recommended-bump/-/conventional-recommended-bump-5.0.1.tgz#5af63903947b6e089e77767601cb592cabb106ba" + integrity sha512-RVdt0elRcCxL90IrNP0fYCpq1uGt2MALko0eyeQ+zQuDVWtMGAy9ng6yYn3kax42lCj9+XBxQ8ZN6S9bdKxDhQ== dependencies: - concat-stream "^1.6.0" - conventional-changelog-preset-loader "^2.0.2" - conventional-commits-filter "^2.0.1" - conventional-commits-parser "^3.0.1" + concat-stream "^2.0.0" + conventional-changelog-preset-loader "^2.1.1" + conventional-commits-filter "^2.0.2" + conventional-commits-parser "^3.0.3" git-raw-commits "2.0.0" - git-semver-tags "^2.0.2" + git-semver-tags "^2.0.3" meow "^4.0.0" q "^1.5.1" -convert-source-map@^1.1.0, convert-source-map@^1.4.0, convert-source-map@^1.5.0: - version "1.5.1" - resolved "https://registry.yarnpkg.com/convert-source-map/-/convert-source-map-1.5.1.tgz#b8278097b9bc229365de5c62cf5fcaed8b5599e5" +convert-source-map@^1.1.0, convert-source-map@^1.4.0, convert-source-map@^1.5.0, convert-source-map@^1.7.0: + version "1.7.0" + resolved "https://registry.yarnpkg.com/convert-source-map/-/convert-source-map-1.7.0.tgz#17a2cb882d7f77d3490585e2ce6c524424a3a442" + integrity sha512-4FJkXzKXEDB1snCFZlLP4gpC3JILicCpGbzG9f9G7tGqGCzETQ2hWPrcinA9oU4wtf2biUaEH5065UnMeR33oA== + dependencies: + safe-buffer "~5.1.1" convert-source-map@~1.1.0: version "1.1.3" resolved "https://registry.yarnpkg.com/convert-source-map/-/convert-source-map-1.1.3.tgz#4829c877e9fe49b3161f3bf3673888e204699860" + integrity sha1-SCnId+n+SbMWHzvzZziI4gRpmGA= copy-concurrently@^1.0.0: version "1.0.5" resolved "https://registry.yarnpkg.com/copy-concurrently/-/copy-concurrently-1.0.5.tgz#92297398cae34937fcafd6ec8139c18051f0b5e0" + integrity sha512-f2domd9fsVDFtaFcbaRZuYXwtdmnzqbADSwhSWYxYB/Q8zsdUUFMXVRwXGDMWmbEzAn1kdRrtI1T/KTFOL4X2A== dependencies: aproba "^1.1.1" fs-write-stream-atomic "^1.0.8" @@ -3209,38 +3517,30 @@ copy-concurrently@^1.0.0: copy-descriptor@^0.1.0: version "0.1.1" resolved "https://registry.yarnpkg.com/copy-descriptor/-/copy-descriptor-0.1.1.tgz#676f6eb3c39997c2ee1ac3a924fd6124748f578d" + integrity sha1-Z29us8OZl8LuGsOpJP1hJHSPV40= copy-props@^2.0.1: - version "2.0.2" - resolved "https://registry.yarnpkg.com/copy-props/-/copy-props-2.0.2.tgz#6151fc8fd47fd8703df00f53940a0ebfeb8c2162" + version "2.0.4" + resolved "https://registry.yarnpkg.com/copy-props/-/copy-props-2.0.4.tgz#93bb1cadfafd31da5bb8a9d4b41f471ec3a72dfe" + integrity sha512-7cjuUME+p+S3HZlbllgsn2CDwS+5eCCX16qBgNC4jgSTf49qR1VKy/Zhl400m0IQXl/bPGEVqncgUUMjrr4s8A== dependencies: each-props "^1.3.0" is-plain-object "^2.0.1" -core-js-compat@^3.1.1: - version "3.1.1" - resolved "https://registry.yarnpkg.com/core-js-compat/-/core-js-compat-3.1.1.tgz#a1ae7edd5b791066d6eaa969c1b62986b844fd42" - integrity sha512-RH3kv8NFovFRMdeTEUgu8nMquEWKEVttOY3JFi8mN75sg72zygPqWbpWNTUw4JYEU43562tlzhdWsWqXmdFAnQ== +core-js-compat@^3.6.2: + version "3.6.4" + resolved "https://registry.yarnpkg.com/core-js-compat/-/core-js-compat-3.6.4.tgz#938476569ebb6cda80d339bcf199fae4f16fff17" + integrity sha512-zAa3IZPvsJ0slViBQ2z+vgyyTuhd3MFn1rBQjZSKVEgB0UMYhUkCj9jJUVPgGTGqWvsBVmfnruXgTcNyTlEiSA== dependencies: - browserslist "^4.6.0" - core-js-pure "3.1.1" - semver "^6.0.0" - -core-js-pure@3.1.1: - version "3.1.1" - resolved "https://registry.yarnpkg.com/core-js-pure/-/core-js-pure-3.1.1.tgz#92494ab7bae22f156ae93973a5e2738814efa7f8" - integrity sha512-jH3ZJ0CJ0wwDvWY0olbOComLo6tbWg4kE2x0j4+wlqYnofwF9mYm98YvADuENUzGw69IddmWFCF1FQ2S0jP96A== - -core-js@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/core-js/-/core-js-3.0.0.tgz#a8dbfa978d29bfc263bfb66c556d0ca924c28957" - integrity sha512-WBmxlgH2122EzEJ6GH8o9L/FeoUKxxxZ6q6VUxoTlsE4EvbTWKJb447eyVxTEuq0LpXjlq/kCB2qgBvsYRkLvQ== + browserslist "^4.8.3" + semver "7.0.0" core-util-is@1.0.2, core-util-is@~1.0.0: version "1.0.2" resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7" + integrity sha1-tf1UIgqivFq1eqtxQMlAdUUDwac= -cosmiconfig@^5.1.0, cosmiconfig@^5.2.0: +cosmiconfig@^5.1.0, cosmiconfig@^5.2.1: version "5.2.1" resolved "https://registry.yarnpkg.com/cosmiconfig/-/cosmiconfig-5.2.1.tgz#040f726809c591e77a17c0a3626ca45b4f168b1a" integrity sha512-H65gsXo1SKjf8zmrJ67eJk8aIRKV5ff2D4uKZIBZShbhGSpEmsQOPW/SKMKYhSTrqR7ufy6RP69rPogdaPh/kA== @@ -3251,24 +3551,28 @@ cosmiconfig@^5.1.0, cosmiconfig@^5.2.0: parse-json "^4.0.0" create-ecdh@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/create-ecdh/-/create-ecdh-4.0.0.tgz#888c723596cdf7612f6498233eebd7a35301737d" + version "4.0.3" + resolved "https://registry.yarnpkg.com/create-ecdh/-/create-ecdh-4.0.3.tgz#c9111b6f33045c4697f144787f9254cdc77c45ff" + integrity sha512-GbEHQPMOswGpKXM9kCWVrremUcBmjteUaQ01T9rkKCPDXfUHX0IoP9LpHYo2NPFampa4e+/pFDc3jQdxrxQLaw== dependencies: bn.js "^4.1.0" elliptic "^6.0.0" create-hash@^1.1.0, create-hash@^1.1.2: - version "1.1.3" - resolved "https://registry.yarnpkg.com/create-hash/-/create-hash-1.1.3.tgz#606042ac8b9262750f483caddab0f5819172d8fd" + version "1.2.0" + resolved "https://registry.yarnpkg.com/create-hash/-/create-hash-1.2.0.tgz#889078af11a63756bcfb59bd221996be3a9ef196" + integrity sha512-z00bCGNHDG8mHAkP7CtT1qVu+bFQUPjYq/4Iv3C3kWjTFV10zIjfSoeqXo9Asws8gwSHDGj/hl2u4OGIjapeCg== dependencies: cipher-base "^1.0.1" inherits "^2.0.1" - ripemd160 "^2.0.0" + md5.js "^1.3.4" + ripemd160 "^2.0.1" sha.js "^2.4.0" create-hmac@^1.1.0, create-hmac@^1.1.2, create-hmac@^1.1.4: - version "1.1.6" - resolved "https://registry.yarnpkg.com/create-hmac/-/create-hmac-1.1.6.tgz#acb9e221a4e17bdb076e90657c42b93e3726cf06" + version "1.1.7" + resolved "https://registry.yarnpkg.com/create-hmac/-/create-hmac-1.1.7.tgz#69170c78b3ab957147b2b8b04572e47ead2243ff" + integrity sha512-MJG9liiZ+ogc4TzUwuvbER1JRdgvUFSB5+VR/g5h82fGaIRWMWddtKBHi7/sVhfjQZ6SehlyhvQYrcYkaUIpLg== dependencies: cipher-base "^1.0.3" create-hash "^1.1.0" @@ -3277,17 +3581,10 @@ create-hmac@^1.1.0, create-hmac@^1.1.2, create-hmac@^1.1.4: safe-buffer "^5.0.1" sha.js "^2.4.8" -cross-spawn@^5.0.1: - version "5.1.0" - resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-5.1.0.tgz#e8bd0efee58fcff6f8f94510a0a554bbfa235449" - dependencies: - lru-cache "^4.0.1" - shebang-command "^1.2.0" - which "^1.2.9" - cross-spawn@^6.0.0, cross-spawn@^6.0.5: version "6.0.5" resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-6.0.5.tgz#4a5ec7c64dfae22c3a14124dbacdee846d80cbc4" + integrity sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ== dependencies: nice-try "^1.0.4" path-key "^2.0.1" @@ -3295,9 +3592,19 @@ cross-spawn@^6.0.0, cross-spawn@^6.0.5: shebang-command "^1.2.0" which "^1.2.9" +cross-spawn@^7.0.0: + version "7.0.1" + resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.1.tgz#0ab56286e0f7c24e153d04cc2aa027e43a9a5d14" + integrity sha512-u7v4o84SwFpD32Z8IIcPZ6z1/ie24O6RU3RbtL5Y316l3KuHVPx9ItBgWQ6VlfAFnRnTtMUrsQ9MUUTuEZjogg== + dependencies: + path-key "^3.1.0" + shebang-command "^2.0.0" + which "^2.0.1" + crypto-browserify@^3.0.0, crypto-browserify@^3.11.0: version "3.12.0" resolved "https://registry.yarnpkg.com/crypto-browserify/-/crypto-browserify-3.12.0.tgz#396cf9f3137f03e4b8e532c58f698254e00f80ec" + integrity sha512-fz4spIh+znjO2VjL+IdhEpRJ3YN6sMzITSBijk6FK2UvTqruSQW+/cCZTSNsMiZNvUeq0CqurF+dAbyiGOY6Wg== dependencies: browserify-cipher "^1.0.0" browserify-sign "^4.0.0" @@ -3311,161 +3618,193 @@ crypto-browserify@^3.0.0, crypto-browserify@^3.11.0: randombytes "^2.0.0" randomfill "^1.0.3" -css-select@~1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/css-select/-/css-select-1.2.0.tgz#2b3a110539c5355f1cd8d314623e870b121ec858" - dependencies: - boolbase "~1.0.0" - css-what "2.1" - domutils "1.5.1" - nth-check "~1.0.1" - -css-what@2.1: - version "2.1.0" - resolved "https://registry.yarnpkg.com/css-what/-/css-what-2.1.0.tgz#9467d032c38cfaefb9f2d79501253062f87fa1bd" - cssom@0.3.x, "cssom@>= 0.3.2 < 0.4.0": - version "0.3.2" - resolved "https://registry.yarnpkg.com/cssom/-/cssom-0.3.2.tgz#b8036170c79f07a90ff2f16e22284027a243848b" + version "0.3.8" + resolved "https://registry.yarnpkg.com/cssom/-/cssom-0.3.8.tgz#9f1276f5b2b463f2114d3f2c75250af8c1a36f4a" + integrity sha512-b0tGHbfegbhPJpxpiBPU2sCkigAqtM9O121le6bbOlgyV+NyGyCmVfJ6QW9eRjz8CpNfWEOYBIMIGRYkLwsIYg== -"cssstyle@>= 0.2.37 < 0.3.0": - version "0.2.37" - resolved "https://registry.yarnpkg.com/cssstyle/-/cssstyle-0.2.37.tgz#541097234cb2513c83ceed3acddc27ff27987d54" +cssstyle@^1.0.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/cssstyle/-/cssstyle-1.4.0.tgz#9d31328229d3c565c61e586b02041a28fccdccf1" + integrity sha512-GBrLZYZ4X4x6/QEoBnIrqb8B/f5l4+8me2dkom/j1Gtbxy0kBv6OGzKuAsGM75bkGwGAFkt56Iwg28S3XTZgSA== dependencies: cssom "0.3.x" currently-unhandled@^0.4.1: version "0.4.1" resolved "https://registry.yarnpkg.com/currently-unhandled/-/currently-unhandled-0.4.1.tgz#988df33feab191ef799a61369dd76c17adf957ea" + integrity sha1-mI3zP+qxke95mmE2nddsF635V+o= dependencies: array-find-index "^1.0.1" -cyclist@~0.2.2: - version "0.2.2" - resolved "https://registry.yarnpkg.com/cyclist/-/cyclist-0.2.2.tgz#1b33792e11e914a2fd6d6ed6447464444e5fa640" +cyclist@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/cyclist/-/cyclist-1.0.1.tgz#596e9698fd0c80e12038c2b82d6eb1b35b6224d9" + integrity sha1-WW6WmP0MgOEgOMK4LW6xs1tiJNk= -d@1: - version "1.0.0" - resolved "https://registry.yarnpkg.com/d/-/d-1.0.0.tgz#754bb5bfe55451da69a58b94d45f4c5b0462d58f" +d@1, d@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/d/-/d-1.0.1.tgz#8698095372d58dbee346ffd0c7093f99f8f9eb5a" + integrity sha512-m62ShEObQ39CfralilEQRjH6oAMtNCV1xJyEx5LpRYUVN+EviphDgUc/F3hnYbADmkiNs67Y+3ylmlG7Lnu+FA== dependencies: - es5-ext "^0.10.9" + es5-ext "^0.10.50" + type "^1.0.1" dargs@^4.0.1: version "4.1.0" resolved "https://registry.yarnpkg.com/dargs/-/dargs-4.1.0.tgz#03a9dbb4b5c2f139bf14ae53f0b8a2a6a86f4e17" + integrity sha1-A6nbtLXC8Tm/FK5T8LiipqhvThc= dependencies: number-is-nan "^1.0.0" +dash-ast@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/dash-ast/-/dash-ast-1.0.0.tgz#12029ba5fb2f8aa6f0a861795b23c1b4b6c27d37" + integrity sha512-Vy4dx7gquTeMcQR/hDkYLGUnwVil6vk4FOOct+djUnHOUWt+zJPJAaRIXaAFkPXtJjvlY7o3rfRu0/3hpnwoUA== + dashdash@^1.12.0: version "1.14.1" resolved "https://registry.yarnpkg.com/dashdash/-/dashdash-1.14.1.tgz#853cfa0f7cbe2fed5de20326b8dd581035f6e2f0" + integrity sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA= dependencies: assert-plus "^1.0.0" -date-fns@^1.27.2: - version "1.29.0" - resolved "https://registry.yarnpkg.com/date-fns/-/date-fns-1.29.0.tgz#12e609cdcb935127311d04d33334e2960a2a54e6" +data-urls@^1.0.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/data-urls/-/data-urls-1.1.0.tgz#15ee0582baa5e22bb59c77140da8f9c76963bbfe" + integrity sha512-YTWYI9se1P55u58gL5GkQHW4P6VJBJ5iBT+B5a7i2Tjadhv52paJG0qHX4A0OR6/t52odI64KP2YvFpkDOi3eQ== + dependencies: + abab "^2.0.0" + whatwg-mimetype "^2.2.0" + whatwg-url "^7.0.0" -date-now@^0.1.4: - version "0.1.4" - resolved "https://registry.yarnpkg.com/date-now/-/date-now-0.1.4.tgz#eaf439fd4d4848ad74e5cc7dbef200672b9e345b" +date-fns@^1.27.2: + version "1.30.1" + resolved "https://registry.yarnpkg.com/date-fns/-/date-fns-1.30.1.tgz#2e71bf0b119153dbb4cc4e88d9ea5acfb50dc05c" + integrity sha512-hBSVCvSmWC+QypYObzwGOd9wqdDpOt+0wl0KbU+R+uuZBS1jN8VsD1ss3irQDknRj5NvxiTF6oj/nDRnN/UQNw== dateformat@^3.0.0: version "3.0.3" resolved "https://registry.yarnpkg.com/dateformat/-/dateformat-3.0.3.tgz#a6e37499a4d9a9cf85ef5872044d62901c9889ae" + integrity sha512-jyCETtSl3VMZMWeRo7iY1FL19ges1t55hMo5yaam4Jrsm5EPL89UQkoQRyiI+Yf4k8r2ZpdngkV8hr1lIdjb3Q== -debug@3.1.0, debug@^3.0.0, debug@^3.1.0: +debug@3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/debug/-/debug-3.1.0.tgz#5bb5a0672628b64149566ba16819e61518c67261" + integrity sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g== dependencies: ms "2.0.0" -debug@^2.1.2, debug@^2.2.0, debug@^2.3.3, debug@^2.6.8, debug@^2.6.9: +debug@^2.2.0, debug@^2.3.3, debug@^2.6.9: version "2.6.9" resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.9.tgz#5d128515df134ff327e90a4c93f4e077a536341f" + integrity sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA== dependencies: ms "2.0.0" +debug@^3.1.0, debug@^3.2.6: + version "3.2.6" + resolved "https://registry.yarnpkg.com/debug/-/debug-3.2.6.tgz#e83d17de16d8a7efb7717edbe5fb10135eee629b" + integrity sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ== + dependencies: + ms "^2.1.1" + debug@^4.0.1, debug@^4.1.0, debug@^4.1.1: version "4.1.1" resolved "https://registry.yarnpkg.com/debug/-/debug-4.1.1.tgz#3b72260255109c6b589cee050f1d516139664791" + integrity sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw== dependencies: ms "^2.1.1" debuglog@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/debuglog/-/debuglog-1.0.1.tgz#aa24ffb9ac3df9a2351837cfb2d279360cd78492" + integrity sha1-qiT/uaw9+aI1GDfPstJ5NgzXhJI= decamelize-keys@^1.0.0: version "1.1.0" resolved "https://registry.yarnpkg.com/decamelize-keys/-/decamelize-keys-1.1.0.tgz#d171a87933252807eb3cb61dc1c1445d078df2d9" + integrity sha1-0XGoeTMlKAfrPLYdwcFEXQeN8tk= dependencies: decamelize "^1.1.0" map-obj "^1.0.0" -decamelize@^1.0.0, decamelize@^1.1.0, decamelize@^1.1.1, decamelize@^1.1.2, decamelize@^1.2.0: +decamelize@^1.1.0, decamelize@^1.1.1, decamelize@^1.1.2, decamelize@^1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-1.2.0.tgz#f6534d15148269b20352e7bee26f501f9a191290" + integrity sha1-9lNNFRSCabIDUue+4m9QH5oZEpA= decode-uri-component@^0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/decode-uri-component/-/decode-uri-component-0.2.0.tgz#eb3913333458775cb84cd1a1fae062106bb87545" + integrity sha1-6zkTMzRYd1y4TNGh+uBiEGu4dUU= dedent@^0.7.0: version "0.7.0" resolved "https://registry.yarnpkg.com/dedent/-/dedent-0.7.0.tgz#2495ddbaf6eb874abb0e1be9df22d2e5a544326c" + integrity sha1-JJXduvbrh0q7Dhvp3yLS5aVEMmw= deep-extend@^0.6.0: version "0.6.0" resolved "https://registry.yarnpkg.com/deep-extend/-/deep-extend-0.6.0.tgz#c4fa7c95404a17a9c3e8ca7e1537312b736330ac" + integrity sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA== deep-is@~0.1.3: version "0.1.3" resolved "https://registry.yarnpkg.com/deep-is/-/deep-is-0.1.3.tgz#b369d6fb5dbc13eecf524f91b070feedc357cf34" - -deepmerge@3.2.0: - version "3.2.0" - resolved "https://registry.yarnpkg.com/deepmerge/-/deepmerge-3.2.0.tgz#58ef463a57c08d376547f8869fdc5bcee957f44e" - integrity sha512-6+LuZGU7QCNUnAJyX8cIrlzoEgggTM6B7mm+znKOX4t5ltluT9KLjN6g61ECMS0LTsLW7yDpNoxhix5FZcrIow== + integrity sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ= default-compare@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/default-compare/-/default-compare-1.0.0.tgz#cb61131844ad84d84788fb68fd01681ca7781a2f" + integrity sha512-QWfXlM0EkAbqOCbD/6HjdwT19j7WCkMyiRhWilc4H9/5h/RzTF9gv5LYh1+CmDV5d1rki6KAWLtQale0xt20eQ== dependencies: kind-of "^5.0.2" default-resolution@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/default-resolution/-/default-resolution-2.0.0.tgz#bcb82baa72ad79b426a76732f1a81ad6df26d684" + integrity sha1-vLgrqnKtebQmp2cy8aga1t8m1oQ= defaults@^1.0.3: version "1.0.3" resolved "https://registry.yarnpkg.com/defaults/-/defaults-1.0.3.tgz#c656051e9817d9ff08ed881477f3fe4019f3ef7d" + integrity sha1-xlYFHpgX2f8I7YgUd/P+QBnz730= dependencies: clone "^1.0.2" -define-properties@^1.1.2: - version "1.1.2" - resolved "https://registry.yarnpkg.com/define-properties/-/define-properties-1.1.2.tgz#83a73f2fea569898fb737193c8f873caf6d45c94" +deferred-leveldown@~0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/deferred-leveldown/-/deferred-leveldown-0.2.0.tgz#2cef1f111e1c57870d8bbb8af2650e587cd2f5b4" + integrity sha1-LO8fER4cV4cNi7uK8mUOWHzS9bQ= + dependencies: + abstract-leveldown "~0.12.1" + +define-properties@^1.1.2, define-properties@^1.1.3: + version "1.1.3" + resolved "https://registry.yarnpkg.com/define-properties/-/define-properties-1.1.3.tgz#cf88da6cbee26fe6db7094f61d870cbd84cee9f1" + integrity sha512-3MqfYKj2lLzdMSf8ZIZE/V+Zuy+BgD6f164e8K2w7dgnpKArBDerGYpM46IYYcjnkdPNMjPk9A6VFB8+3SKlXQ== dependencies: - foreach "^2.0.5" - object-keys "^1.0.8" + object-keys "^1.0.12" define-property@^0.2.5: version "0.2.5" resolved "https://registry.yarnpkg.com/define-property/-/define-property-0.2.5.tgz#c35b1ef918ec3c990f9a5bc57be04aacec5c8116" + integrity sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY= dependencies: is-descriptor "^0.1.0" define-property@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/define-property/-/define-property-1.0.0.tgz#769ebaaf3f4a63aad3af9e8d304c9bbe79bfb0e6" + integrity sha1-dp66rz9KY6rTr56NMEybvnm/sOY= dependencies: is-descriptor "^1.0.0" define-property@^2.0.2: version "2.0.2" resolved "https://registry.yarnpkg.com/define-property/-/define-property-2.0.2.tgz#d459689e8d654ba77e02a817f8710d702cb16e9d" + integrity sha512-jwK2UV4cnPpbcG7+VRARKTZPUWowwXA8bzH5NP6ud0oeAxyYPuGZUAC7hMugpCdz4BeSZl2Dl9k66CHJ/46ZYQ== dependencies: is-descriptor "^1.0.2" isobject "^3.0.1" @@ -3473,48 +3812,51 @@ define-property@^2.0.2: defined@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/defined/-/defined-1.0.0.tgz#c98d9bcef75674188e110969151199e39b1fa693" + integrity sha1-yY2bzvdWdBiOEQlpFRGZ45sfppM= -del@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/del/-/del-3.0.0.tgz#53ecf699ffcbcb39637691ab13baf160819766e5" - dependencies: - globby "^6.1.0" - is-path-cwd "^1.0.0" - is-path-in-cwd "^1.0.0" - p-map "^1.1.1" - pify "^3.0.0" - rimraf "^2.2.8" +del@^5.0.0: + version "5.1.0" + resolved "https://registry.yarnpkg.com/del/-/del-5.1.0.tgz#d9487c94e367410e6eff2925ee58c0c84a75b3a7" + integrity sha512-wH9xOVHnczo9jN2IW68BabcecVPxacIA3g/7z6vhSU/4stOKQzeCRK0yD0A24WiAAUJmmVpWqrERcTxnLo3AnA== + dependencies: + globby "^10.0.1" + graceful-fs "^4.2.2" + is-glob "^4.0.1" + is-path-cwd "^2.2.0" + is-path-inside "^3.0.1" + p-map "^3.0.0" + rimraf "^3.0.0" + slash "^3.0.0" delayed-stream@~1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/delayed-stream/-/delayed-stream-1.0.0.tgz#df3ae199acadfb7d440aaae0b29e2272b24ec619" + integrity sha1-3zrhmayt+31ECqrgsp4icrJOxhk= delegates@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/delegates/-/delegates-1.0.0.tgz#84c6e159b81904fdca59a0ef44cd870d31250f9a" - -deprecation@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/deprecation/-/deprecation-1.0.1.tgz#2df79b79005752180816b7b6e079cbd80490d711" - integrity sha512-ccVHpE72+tcIKaGMql33x5MAjKQIZrk+3x2GbJ7TeraUCZWHoT+KSZpoC+JQFsUBlSTXUrBaGiF0j6zVTepPLg== + integrity sha1-hMbhWbgZBP3KWaDvRM2HDTElD5o= deprecation@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/deprecation/-/deprecation-2.0.0.tgz#dd0427cd920c78bc575ec39dab2f22e7c304fb9d" - integrity sha512-lbQN037mB3VfA2JFuguM5GCJ+zPinMeCrFe+AfSZ6eqrnJA/Fs+EYMnd6Nb2mn9lf2jO9xwEd9o9lic+D4vkcw== + version "2.3.1" + resolved "https://registry.yarnpkg.com/deprecation/-/deprecation-2.3.1.tgz#6368cbdb40abf3373b525ac87e4a260c3a700919" + integrity sha512-xmHIy4F3scKVwMsQ4WnVaS8bHOx0DmVwRywosKhaILI0ywMDWPtBSku2HNxRvF7jtwDRsoEwYQSfbxj8b7RlJQ== deps-sort@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/deps-sort/-/deps-sort-2.0.0.tgz#091724902e84658260eb910748cccd1af6e21fb5" + version "2.0.1" + resolved "https://registry.yarnpkg.com/deps-sort/-/deps-sort-2.0.1.tgz#9dfdc876d2bcec3386b6829ac52162cda9fa208d" + integrity sha512-1orqXQr5po+3KI6kQb9A4jnXT1PBwggGl2d7Sq2xsnOeI9GPcE/tGcF9UiSZtZBM7MukY4cAh7MemS6tZYipfw== dependencies: JSONStream "^1.0.3" - shasum "^1.0.0" + shasum-object "^1.0.0" subarg "^1.0.0" through2 "^2.0.0" derequire@^2.0.2: version "2.0.6" resolved "https://registry.yarnpkg.com/derequire/-/derequire-2.0.6.tgz#31a414bb7ca176239fa78b116636ef77d517e768" + integrity sha1-MaQUu3yhdiOfp4sRZjbvd9UX52g= dependencies: acorn "^4.0.3" concat-stream "^1.4.6" @@ -3523,8 +3865,9 @@ derequire@^2.0.2: yargs "^6.5.0" des.js@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/des.js/-/des.js-1.0.0.tgz#c074d2e2aa6a8a9a07dbd61f9a15c2cd83ec8ecc" + version "1.0.1" + resolved "https://registry.yarnpkg.com/des.js/-/des.js-1.0.1.tgz#5382142e1bdc53f85d86d53e5f4aa7deb91e0843" + integrity sha512-Q0I4pfFrv2VPd34/vfLrFOoRmlYj3OV50i7fskps1jZWK1kApMWWT9G6RRUeYedLcBDIhnSDaUvJMb3AhUlaEA== dependencies: inherits "^2.0.1" minimalistic-assert "^1.0.0" @@ -3532,54 +3875,68 @@ des.js@^1.0.0: detect-file@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/detect-file/-/detect-file-1.0.0.tgz#f0d66d03672a825cb1b73bdb3fe62310c8e552b7" + integrity sha1-8NZtA2cqglyxtzvbP+YjEMjlUrc= detect-indent@^5.0.0: version "5.0.0" resolved "https://registry.yarnpkg.com/detect-indent/-/detect-indent-5.0.0.tgz#3871cc0a6a002e8c3e5b3cf7f336264675f06b9d" + integrity sha1-OHHMCmoALow+Wzz38zYmRnXwa50= detect-libc@^1.0.2: version "1.0.3" resolved "https://registry.yarnpkg.com/detect-libc/-/detect-libc-1.0.3.tgz#fa137c4bd698edf55cd5cd02ac559f91a4c4ba9b" + integrity sha1-+hN8S9aY7fVc1c0CrFWfkaTEups= detect-newline@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/detect-newline/-/detect-newline-2.1.0.tgz#f41f1c10be4b00e87b5f13da680759f2c5bfd3e2" + integrity sha1-9B8cEL5LAOh7XxPaaAdZ8sW/0+I= detective@^5.0.2: - version "5.1.0" - resolved "https://registry.yarnpkg.com/detective/-/detective-5.1.0.tgz#7a20d89236d7b331ccea65832e7123b5551bb7cb" + version "5.2.0" + resolved "https://registry.yarnpkg.com/detective/-/detective-5.2.0.tgz#feb2a77e85b904ecdea459ad897cc90a99bd2a7b" + integrity sha512-6SsIx+nUUbuK0EthKjv0zrdnajCCXVYGmbYYiYjFVpzcjwEs/JMDZ8tPRG29J/HhN56t3GJp2cGSWDRjjot8Pg== dependencies: - acorn-node "^1.3.0" + acorn-node "^1.6.1" defined "^1.0.0" minimist "^1.1.1" dezalgo@^1.0.0: version "1.0.3" resolved "https://registry.yarnpkg.com/dezalgo/-/dezalgo-1.0.3.tgz#7f742de066fc748bc8db820569dddce49bf0d456" + integrity sha1-f3Qt4Gb8dIvI24IFad3c5Jvw1FY= dependencies: asap "^2.0.0" wrappy "1" -diff-sequences@^24.3.0: - version "24.3.0" - resolved "https://registry.yarnpkg.com/diff-sequences/-/diff-sequences-24.3.0.tgz#0f20e8a1df1abddaf4d9c226680952e64118b975" - integrity sha512-xLqpez+Zj9GKSnPWS0WZw1igGocZ+uua8+y+5dDNTT934N3QuY1sp2LkHzwiaYQGz60hMq0pjAshdeXm5VUOEw== +diff-sequences@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/diff-sequences/-/diff-sequences-24.9.0.tgz#5715d6244e2aa65f48bba0bc972db0b0b11e95b5" + integrity sha512-Dj6Wk3tWyTE+Fo1rW8v0Xhwk80um6yFYKbuAxc9c3EZxIHFDYwbi34Uk42u1CdnIiVorvt4RmlSDjIPyzGC2ew== diffie-hellman@^5.0.0: - version "5.0.2" - resolved "https://registry.yarnpkg.com/diffie-hellman/-/diffie-hellman-5.0.2.tgz#b5835739270cfe26acf632099fded2a07f209e5e" + version "5.0.3" + resolved "https://registry.yarnpkg.com/diffie-hellman/-/diffie-hellman-5.0.3.tgz#40e8ee98f55a2149607146921c63e1ae5f3d2875" + integrity sha512-kqag/Nl+f3GwyK25fhUMYj81BUOrZ9IuJsjIcDE5icNM9FJHAVm3VcUDxdLPoQtTuUylWm6ZIknYJwwaPxsUzg== dependencies: bn.js "^4.1.0" miller-rabin "^4.0.0" randombytes "^2.0.0" -dir-glob@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/dir-glob/-/dir-glob-2.0.0.tgz#0b205d2b6aef98238ca286598a8204d29d0a0034" +dir-glob@^2.2.2: + version "2.2.2" + resolved "https://registry.yarnpkg.com/dir-glob/-/dir-glob-2.2.2.tgz#fa09f0694153c8918b18ba0deafae94769fc50c4" + integrity sha512-f9LBi5QWzIW3I6e//uxZoLBlUt9kcp66qo0sSCxL6YZKc75R1c4MFCoe/LaZiBGmgujvQdxc5Bn3QhfyvK5Hsw== dependencies: - arrify "^1.0.1" path-type "^3.0.0" +dir-glob@^3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/dir-glob/-/dir-glob-3.0.1.tgz#56dbf73d992a4a93ba1584f4534063fd2e41717f" + integrity sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA== + dependencies: + path-type "^4.0.0" + doctrine@1.5.0: version "1.5.0" resolved "https://registry.yarnpkg.com/doctrine/-/doctrine-1.5.0.tgz#379dce730f6166f76cefa4e6707a159b02c5a6fa" @@ -3595,110 +3952,84 @@ doctrine@^3.0.0: dependencies: esutils "^2.0.2" -dom-serializer@0, dom-serializer@~0.1.0: - version "0.1.0" - resolved "https://registry.yarnpkg.com/dom-serializer/-/dom-serializer-0.1.0.tgz#073c697546ce0780ce23be4a28e293e40bc30c82" - dependencies: - domelementtype "~1.1.1" - entities "~1.1.1" - -domain-browser@^1.1.1, domain-browser@^1.2.0: +domain-browser@^1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/domain-browser/-/domain-browser-1.2.0.tgz#3d31f50191a6749dd1375a7f522e823d42e54eda" + integrity sha512-jnjyiM6eRyZl2H+W8Q/zLMA481hzi0eszAaBUzIVnmYVDBbnLxVNnfu1HgEBvCbL+71FrxMl3E6lpKH7Ge3OXA== -domelementtype@1, domelementtype@^1.3.0: - version "1.3.0" - resolved "https://registry.yarnpkg.com/domelementtype/-/domelementtype-1.3.0.tgz#b17aed82e8ab59e52dd9c19b1756e0fc187204c2" - -domelementtype@~1.1.1: - version "1.1.3" - resolved "https://registry.yarnpkg.com/domelementtype/-/domelementtype-1.1.3.tgz#bd28773e2642881aec51544924299c5cd822185b" - -domexception@^1.0.0: +domexception@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/domexception/-/domexception-1.0.1.tgz#937442644ca6a31261ef36e3ec677fe805582c90" + integrity sha512-raigMkn7CJNNo6Ihro1fzG7wr3fHuYVytzquZKX5n0yizGsTcYgzdIUwj1X9pK0VvjeihV+XiclP+DjwbsSKug== dependencies: webidl-conversions "^4.0.2" -domhandler@^2.3.0: - version "2.4.1" - resolved "https://registry.yarnpkg.com/domhandler/-/domhandler-2.4.1.tgz#892e47000a99be55bbf3774ffea0561d8879c259" - dependencies: - domelementtype "1" - -domutils@1.5.1, domutils@^1.5.1: - version "1.5.1" - resolved "https://registry.yarnpkg.com/domutils/-/domutils-1.5.1.tgz#dcd8488a26f563d61079e48c9f7b7e32373682cf" - dependencies: - dom-serializer "0" - domelementtype "1" - dot-prop@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/dot-prop/-/dot-prop-3.0.0.tgz#1b708af094a49c9a0e7dbcad790aba539dac1177" + integrity sha1-G3CK8JSknJoOfbyteQq6U52sEXc= dependencies: is-obj "^1.0.0" dot-prop@^4.2.0: version "4.2.0" resolved "https://registry.yarnpkg.com/dot-prop/-/dot-prop-4.2.0.tgz#1f19e0c2e1aa0e32797c49799f2837ac6af69c57" + integrity sha512-tUMXrxlExSW6U2EXiiKGSBVdYgtV8qlHL+C10TsW4PURY/ic+eaysnSkwB4kA/mBlCyy/IKDJ+Lc3wbWeaXtuQ== dependencies: is-obj "^1.0.0" duplexer2@^0.1.2, duplexer2@~0.1.0, duplexer2@~0.1.2: version "0.1.4" resolved "https://registry.yarnpkg.com/duplexer2/-/duplexer2-0.1.4.tgz#8b12dab878c0d69e3e7891051662a32fc6bddcc1" + integrity sha1-ixLauHjA1p4+eJEFFmKjL8a93ME= dependencies: readable-stream "^2.0.2" duplexer@^0.1.1: version "0.1.1" resolved "https://registry.yarnpkg.com/duplexer/-/duplexer-0.1.1.tgz#ace6ff808c1ce66b57d1ebf97977acb02334cfc1" + integrity sha1-rOb/gIwc5mtX0ev5eXessCM0z8E= duplexify@^3.4.2, duplexify@^3.6.0: - version "3.6.1" - resolved "https://registry.yarnpkg.com/duplexify/-/duplexify-3.6.1.tgz#b1a7a29c4abfd639585efaecce80d666b1e34125" + version "3.7.1" + resolved "https://registry.yarnpkg.com/duplexify/-/duplexify-3.7.1.tgz#2a4df5317f6ccfd91f86d6fd25d8d8a103b88309" + integrity sha512-07z8uv2wMyS51kKhD1KsdXJg5WQ6t93RneqRxUHnskXVtlYYkLqM0gqStQZ3pj073g687jPCHrqNfCzawLYh5g== dependencies: end-of-stream "^1.0.0" inherits "^2.0.1" readable-stream "^2.0.0" stream-shift "^1.0.0" -duplicate-package-checker-webpack-plugin@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/duplicate-package-checker-webpack-plugin/-/duplicate-package-checker-webpack-plugin-2.1.0.tgz#6723ee32d89947997470778973c10788cb69e496" - integrity sha512-Blok+Cb8zDavYQyeTtSkmNp/aiyRn5+JV/4EhDDH5VJChnyIzPhq+S5MyWnFpqpv8jNKmD3cXmXFEVU509pzXQ== - dependencies: - chalk "^2.3.0" - find-root "^1.0.0" - lodash "^4.17.4" - semver "^5.4.1" - each-props@^1.3.0: - version "1.3.1" - resolved "https://registry.yarnpkg.com/each-props/-/each-props-1.3.1.tgz#fc138f51e3a2774286d4858e02d6e7de462de158" + version "1.3.2" + resolved "https://registry.yarnpkg.com/each-props/-/each-props-1.3.2.tgz#ea45a414d16dd5cfa419b1a81720d5ca06892333" + integrity sha512-vV0Hem3zAGkJAyU7JSjixeU66rwdynTAa1vofCrSA5fEln+m67Az9CcnkVD776/fsN/UjIWmBDoNRS6t6G9RfA== dependencies: is-plain-object "^2.0.1" object.defaults "^1.1.0" ecc-jsbn@~0.1.1: - version "0.1.1" - resolved "https://registry.yarnpkg.com/ecc-jsbn/-/ecc-jsbn-0.1.1.tgz#0fc73a9ed5f0d53c38193398523ef7e543777505" + version "0.1.2" + resolved "https://registry.yarnpkg.com/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz#3a83a904e54353287874c564b7549386849a98c9" + integrity sha1-OoOpBOVDUyh4dMVkt1SThoSamMk= dependencies: jsbn "~0.1.0" + safer-buffer "^2.1.0" -electron-to-chromium@^1.3.133: - version "1.3.134" - resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.134.tgz#550222bddac43c6bd6c445c3543a0fe8a615021d" - integrity sha512-C3uK2SrtWg/gSWaluLHWSHjyebVZCe4ZC0NVgTAoTq8tCR9FareRK5T7R7AS/nPZShtlEcjVMX1kQ8wi4nU68w== +electron-to-chromium@^1.3.363: + version "1.3.372" + resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.372.tgz#fb61b6dfe06f3278a384d084ebef75d463ec7580" + integrity sha512-77a4jYC52OdisHM+Tne7dgWEvQT1FoNu/jYl279pP88ZtG4ZRIPyhQwAKxj6C2rzsyC1OwsOds9JlZtNncSz6g== elegant-spinner@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/elegant-spinner/-/elegant-spinner-1.0.1.tgz#db043521c95d7e303fd8f345bedc3349cfb0729e" + integrity sha1-2wQ1IcldfjA/2PNFvtwzSc+wcp4= elliptic@^6.0.0: - version "6.4.0" - resolved "https://registry.yarnpkg.com/elliptic/-/elliptic-6.4.0.tgz#cac9af8762c85836187003c8dfe193e5e2eae5df" + version "6.5.2" + resolved "https://registry.yarnpkg.com/elliptic/-/elliptic-6.5.2.tgz#05c5678d7173c049d8ca433552224a495d0e3762" + integrity sha512-f4x70okzZbIQl/NSRLkI/+tteV/9WqL98zx+SQ69KbXxmVrmjwsNUPn/gYJJ0sHvEak24cZgHIPegRePAtA/xw== dependencies: bn.js "^4.4.0" brorand "^1.0.1" @@ -3713,82 +4044,97 @@ emoji-regex@^7.0.1: resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-7.0.3.tgz#933a04052860c85e83c122479c4748a8e4c72156" integrity sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA== -emojis-list@^2.0.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/emojis-list/-/emojis-list-2.1.0.tgz#4daa4d9db00f9819880c79fa457ae5b09a1fd389" +emoji-regex@^8.0.0: + version "8.0.0" + resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-8.0.0.tgz#e818fd69ce5ccfcb404594f842963bf53164cc37" + integrity sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A== encoding@^0.1.11: version "0.1.12" resolved "https://registry.yarnpkg.com/encoding/-/encoding-0.1.12.tgz#538b66f3ee62cd1ab51ec323829d1f9480c74beb" + integrity sha1-U4tm8+5izRq1HsMjgp0flIDHS+s= dependencies: iconv-lite "~0.4.13" end-of-stream@^1.0.0, end-of-stream@^1.1.0: - version "1.4.1" - resolved "https://registry.yarnpkg.com/end-of-stream/-/end-of-stream-1.4.1.tgz#ed29634d19baba463b6ce6b80a37213eab71ec43" + version "1.4.4" + resolved "https://registry.yarnpkg.com/end-of-stream/-/end-of-stream-1.4.4.tgz#5ae64a5f45057baf3626ec14da0ca5e4b2431eb0" + integrity sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q== dependencies: once "^1.4.0" -enhanced-resolve@^3.0.0, enhanced-resolve@^3.4.0: +enhanced-resolve@^3.0.0: version "3.4.1" resolved "https://registry.yarnpkg.com/enhanced-resolve/-/enhanced-resolve-3.4.1.tgz#0421e339fd71419b3da13d129b3979040230476e" + integrity sha1-BCHjOf1xQZs9oT0Smzl5BAIwR24= dependencies: graceful-fs "^4.1.2" memory-fs "^0.4.0" object-assign "^4.0.1" tapable "^0.2.7" -entities@^1.1.1, entities@~1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/entities/-/entities-1.1.1.tgz#6e5c2d0a5621b5dadaecef80b90edfb5cd7772f0" +env-paths@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/env-paths/-/env-paths-1.0.0.tgz#4168133b42bb05c38a35b1ae4397c8298ab369e0" + integrity sha1-QWgTO0K7BcOKNbGuQ5fIKYqzaeA= err-code@^1.0.0: version "1.1.2" resolved "https://registry.yarnpkg.com/err-code/-/err-code-1.1.2.tgz#06e0116d3028f6aef4806849eb0ea6a748ae6960" + integrity sha1-BuARbTAo9q70gGhJ6w6mp0iuaWA= -errno@^0.1.3: +errno@^0.1.1, errno@^0.1.3, errno@~0.1.1: version "0.1.7" resolved "https://registry.yarnpkg.com/errno/-/errno-0.1.7.tgz#4684d71779ad39af177e3f007996f7c67c852618" + integrity sha512-MfrRBDWzIWifgq6tJj60gkAwtLNb6sQPlcFrSOflcP1aFmmruKQ2wRnze/8V6kgyz7H3FF8Npzv78mZ7XLLflg== dependencies: prr "~1.0.1" error-ex@^1.2.0, error-ex@^1.3.1: - version "1.3.1" - resolved "https://registry.yarnpkg.com/error-ex/-/error-ex-1.3.1.tgz#f855a86ce61adc4e8621c3cda21e7a7612c3a8dc" + version "1.3.2" + resolved "https://registry.yarnpkg.com/error-ex/-/error-ex-1.3.2.tgz#b4ac40648107fdcdcfae242f428bea8a14d4f1bf" + integrity sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g== dependencies: is-arrayish "^0.2.1" -es-abstract@^1.4.3, es-abstract@^1.5.1, es-abstract@^1.7.0: - version "1.13.0" - resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.13.0.tgz#ac86145fdd5099d8dd49558ccba2eaf9b88e24e9" - integrity sha512-vDZfg/ykNxQVwup/8E1BZhVzFfBxs9NqMzGcvIJrqg5k2/5Za2bWo40dK2J1pgLngZ7c+Shh8lwYtLGyrwPutg== +es-abstract@^1.12.0, es-abstract@^1.15.0, es-abstract@^1.4.3, es-abstract@^1.5.1, es-abstract@^1.7.0: + version "1.16.3" + resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.16.3.tgz#52490d978f96ff9f89ec15b5cf244304a5bca161" + integrity sha512-WtY7Fx5LiOnSYgF5eg/1T+GONaGmpvpPdCpSnYij+U2gDTL0UPfWrhDw7b2IYb+9NQJsYpCA0wOQvZfsd6YwRw== dependencies: - es-to-primitive "^1.2.0" + es-to-primitive "^1.2.1" function-bind "^1.1.1" has "^1.0.3" + has-symbols "^1.0.1" is-callable "^1.1.4" is-regex "^1.0.4" - object-keys "^1.0.12" + object-inspect "^1.7.0" + object-keys "^1.1.1" + string.prototype.trimleft "^2.1.0" + string.prototype.trimright "^2.1.0" -es-to-primitive@^1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/es-to-primitive/-/es-to-primitive-1.2.0.tgz#edf72478033456e8dda8ef09e00ad9650707f377" - integrity sha512-qZryBOJjV//LaxLTV6UC//WewneB3LcXOL9NP++ozKVXsIIIpm/2c13UDiD9Jp2eThsecw9m3jPqDwTyobcdbg== +es-to-primitive@^1.2.1: + version "1.2.1" + resolved "https://registry.yarnpkg.com/es-to-primitive/-/es-to-primitive-1.2.1.tgz#e55cd4c9cdc188bcefb03b366c736323fc5c898a" + integrity sha512-QCOllgZJtaUo9miYBcLChTUaHNjJF3PYs1VidD7AwiEj1kYxKeQTctLAezAOH5ZKRH0g2IgPn6KwB4IT8iRpvA== dependencies: is-callable "^1.1.4" is-date-object "^1.0.1" is-symbol "^1.0.2" -es5-ext@^0.10.14, es5-ext@^0.10.35, es5-ext@^0.10.9, es5-ext@~0.10.14: - version "0.10.39" - resolved "https://registry.yarnpkg.com/es5-ext/-/es5-ext-0.10.39.tgz#fca21b67559277ca4ac1a1ed7048b107b6f76d87" +es5-ext@^0.10.35, es5-ext@^0.10.46, es5-ext@^0.10.50, es5-ext@~0.10.14: + version "0.10.53" + resolved "https://registry.yarnpkg.com/es5-ext/-/es5-ext-0.10.53.tgz#93c5a3acfdbef275220ad72644ad02ee18368de1" + integrity sha512-Xs2Stw6NiNHWypzRTY1MtaG/uJlwCk8kH81920ma8mvN8Xq1gsfhZvpkImLQArw8AHnv8MT2I45J3c0R8slE+Q== dependencies: es6-iterator "~2.0.3" - es6-symbol "~3.1.1" + es6-symbol "~3.1.3" + next-tick "~1.0.0" -es6-iterator@^2.0.1, es6-iterator@~2.0.1, es6-iterator@~2.0.3: +es6-iterator@^2.0.1, es6-iterator@^2.0.3, es6-iterator@~2.0.1, es6-iterator@~2.0.3: version "2.0.3" resolved "https://registry.yarnpkg.com/es6-iterator/-/es6-iterator-2.0.3.tgz#a7de889141a05a94b0854403b2d0a0fbfa98f3b7" + integrity sha1-p96IkUGgWpSwhUQDstCg+/qY87c= dependencies: d "1" es5-ext "^0.10.35" @@ -3797,6 +4143,7 @@ es6-iterator@^2.0.1, es6-iterator@~2.0.1, es6-iterator@~2.0.3: es6-map@^0.1.3: version "0.1.5" resolved "https://registry.yarnpkg.com/es6-map/-/es6-map-0.1.5.tgz#9136e0503dcc06a301690f0bb14ff4e364e949f0" + integrity sha1-kTbgUD3MBqMBaQ8LsU/042TpSfA= dependencies: d "1" es5-ext "~0.10.14" @@ -3806,18 +4153,21 @@ es6-map@^0.1.3: event-emitter "~0.3.5" es6-promise@^4.0.3: - version "4.2.5" - resolved "https://registry.yarnpkg.com/es6-promise/-/es6-promise-4.2.5.tgz#da6d0d5692efb461e082c14817fe2427d8f5d054" + version "4.2.8" + resolved "https://registry.yarnpkg.com/es6-promise/-/es6-promise-4.2.8.tgz#4eb21594c972bc40553d276e510539143db53e0a" + integrity sha512-HJDGx5daxeIvxdBxvG2cb9g4tEvwIk3i8+nhX0yGrYmZUzbkdg8QbDevheDB8gd0//uPj4c1EQua8Q+MViT0/w== es6-promisify@^5.0.0: version "5.0.0" resolved "https://registry.yarnpkg.com/es6-promisify/-/es6-promisify-5.0.0.tgz#5109d62f3e56ea967c4b63505aef08291c8a5203" + integrity sha1-UQnWLz5W6pZ8S2NQWu8IKRyKUgM= dependencies: es6-promise "^4.0.3" es6-set@~0.1.5: version "0.1.5" resolved "https://registry.yarnpkg.com/es6-set/-/es6-set-0.1.5.tgz#d2b3ec5d4d800ced818db538d28974db0a73ccb1" + integrity sha1-0rPsXU2ADO2BjbU40ol02wpzzLE= dependencies: d "1" es5-ext "~0.10.14" @@ -3825,36 +4175,41 @@ es6-set@~0.1.5: es6-symbol "3.1.1" event-emitter "~0.3.5" -es6-symbol@3.1.1, es6-symbol@^3.1.1, es6-symbol@~3.1.1: +es6-symbol@3.1.1: version "3.1.1" resolved "https://registry.yarnpkg.com/es6-symbol/-/es6-symbol-3.1.1.tgz#bf00ef4fdab6ba1b46ecb7b629b4c7ed5715cc77" + integrity sha1-vwDvT9q2uhtG7Le2KbTH7VcVzHc= dependencies: d "1" es5-ext "~0.10.14" -es6-templates@^0.2.2: - version "0.2.3" - resolved "https://registry.yarnpkg.com/es6-templates/-/es6-templates-0.2.3.tgz#5cb9ac9fb1ded6eb1239342b81d792bbb4078ee4" +es6-symbol@^3.1.1, es6-symbol@~3.1.1, es6-symbol@~3.1.3: + version "3.1.3" + resolved "https://registry.yarnpkg.com/es6-symbol/-/es6-symbol-3.1.3.tgz#bad5d3c1bcdac28269f4cb331e431c78ac705d18" + integrity sha512-NJ6Yn3FuDinBaBRWl/q5X/s4koRHBrgKAu+yGI6JCBeiu3qrcbJhwT2GeR/EXVfylRk8dpQVJoLEFhK+Mu31NA== dependencies: - recast "~0.11.12" - through "~2.3.6" + d "^1.0.1" + ext "^1.1.2" es6-weak-map@^2.0.1: - version "2.0.2" - resolved "https://registry.yarnpkg.com/es6-weak-map/-/es6-weak-map-2.0.2.tgz#5e3ab32251ffd1538a1f8e5ffa1357772f92d96f" + version "2.0.3" + resolved "https://registry.yarnpkg.com/es6-weak-map/-/es6-weak-map-2.0.3.tgz#b6da1f16cc2cc0d9be43e6bdbfc5e7dfcdf31d53" + integrity sha512-p5um32HOTO1kP+w7PRnB+5lQ43Z6muuMuIMffvDN8ZB4GcnjLBV6zGStpbASIMk4DCAvEaamhe2zhyCb/QXXsA== dependencies: d "1" - es5-ext "^0.10.14" - es6-iterator "^2.0.1" + es5-ext "^0.10.46" + es6-iterator "^2.0.3" es6-symbol "^3.1.1" -escape-string-regexp@^1.0.2, escape-string-regexp@^1.0.4, escape-string-regexp@^1.0.5: +escape-string-regexp@^1.0.2, escape-string-regexp@^1.0.5: version "1.0.5" resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" + integrity sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ= -escodegen@^1.9.0: - version "1.9.1" - resolved "https://registry.yarnpkg.com/escodegen/-/escodegen-1.9.1.tgz#dbae17ef96c8e4bedb1356f4504fa4cc2f7cb7e2" +escodegen@^1.9.1: + version "1.12.0" + resolved "https://registry.yarnpkg.com/escodegen/-/escodegen-1.12.0.tgz#f763daf840af172bb3a2b6dd7219c0e17f7ff541" + integrity sha512-TuA+EhsanGcme5T3R0L80u4t8CpbXQjegRmf7+FPTJrtCTErXFeelblRgHQa1FofEzqYYJmJ/OqjTwREp9qgmg== dependencies: esprima "^3.1.3" estraverse "^4.2.0" @@ -3866,174 +4221,188 @@ escodegen@^1.9.0: escope@^3.6.0: version "3.6.0" resolved "https://registry.yarnpkg.com/escope/-/escope-3.6.0.tgz#e01975e812781a163a6dadfdd80398dc64c889c3" + integrity sha1-4Bl16BJ4GhY6ba392AOY3GTIicM= dependencies: es6-map "^0.1.3" es6-weak-map "^2.0.1" esrecurse "^4.1.0" estraverse "^4.1.1" -eslint-config-babel@^9.0.0: - version "9.0.0" - resolved "https://registry.yarnpkg.com/eslint-config-babel/-/eslint-config-babel-9.0.0.tgz#bcfb9e9a1892aff29b8773cb9d2c76639de83c07" - integrity sha512-J7l2KdDKi2y9QifMqXdSIkghrVXr6fcpxegj+803C+4xBfpp0h2LcY9X5N+ivJMBoX6G2PJ/TBTM1Kro0MELBA== - -eslint-import-resolver-node@^0.3.2: - version "0.3.2" - resolved "https://registry.yarnpkg.com/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.2.tgz#58f15fb839b8d0576ca980413476aab2472db66a" - integrity sha512-sfmTqJfPSizWu4aymbPr4Iidp5yKm8yDkHp+Ir3YiTHiiDfxh69mOUsmiqW6RZ9zRXFaF64GtYmN7e+8GHBv6Q== +eslint-import-resolver-node@^0.3.2, eslint-import-resolver-node@^0.3.3: + version "0.3.3" + resolved "https://registry.yarnpkg.com/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.3.tgz#dbaa52b6b2816b50bc6711af75422de808e98404" + integrity sha512-b8crLDo0M5RSe5YG8Pu2DYBj71tSB6OvXkfzwbJU2w7y8P4/yo0MyF8jU26IEuEuHF2K5/gcAJE3LhQGqBBbVg== dependencies: debug "^2.6.9" - resolve "^1.5.0" + resolve "^1.13.1" -eslint-module-utils@^2.4.0: - version "2.4.0" - resolved "https://registry.yarnpkg.com/eslint-module-utils/-/eslint-module-utils-2.4.0.tgz#8b93499e9b00eab80ccb6614e69f03678e84e09a" - integrity sha512-14tltLm38Eu3zS+mt0KvILC3q8jyIAH518MlG+HO0p+yK885Lb1UHTY/UgR91eOyGdmxAPb+OLoW4znqIT6Ndw== +eslint-module-utils@^2.4.1: + version "2.5.0" + resolved "https://registry.yarnpkg.com/eslint-module-utils/-/eslint-module-utils-2.5.0.tgz#cdf0b40d623032274ccd2abd7e64c4e524d6e19c" + integrity sha512-kCo8pZaNz2dsAW7nCUjuVoI11EBXXpIzfNxmaoLhXoRDOnqXLC4iSGVRdZPhOitfbdEfMEfKOiENaK6wDPZEGw== dependencies: - debug "^2.6.8" + debug "^2.6.9" pkg-dir "^2.0.0" -eslint-plugin-flowtype@^3.8.2: - version "3.8.2" - resolved "https://registry.yarnpkg.com/eslint-plugin-flowtype/-/eslint-plugin-flowtype-3.8.2.tgz#8e1ecaae570d149ba3ba2c73964ebac5582e8ff9" - integrity sha512-3fBLnSQ4WEVKtd+PWuqL9qhciYrJWjLuOGilEIN3LzEYnPtvDcnjQPHP2OFhzTCRlpojSv2EEqoPW+Sol0vn2A== +eslint-plugin-flowtype@^4.6.0: + version "4.6.0" + resolved "https://registry.yarnpkg.com/eslint-plugin-flowtype/-/eslint-plugin-flowtype-4.6.0.tgz#82b2bd6f21770e0e5deede0228e456cb35308451" + integrity sha512-W5hLjpFfZyZsXfo5anlu7HM970JBDqbEshAJUkeczP6BFCIfJXuiIBQXyberLRtOStT0OGPF8efeTbxlHk4LpQ== dependencies: - lodash "^4.17.11" + lodash "^4.17.15" -eslint-plugin-import@^2.17.2: - version "2.17.2" - resolved "https://registry.yarnpkg.com/eslint-plugin-import/-/eslint-plugin-import-2.17.2.tgz#d227d5c6dc67eca71eb590d2bb62fb38d86e9fcb" - integrity sha512-m+cSVxM7oLsIpmwNn2WXTJoReOF9f/CtLMo7qOVmKd1KntBy0hEcuNZ3erTmWjx+DxRO0Zcrm5KwAvI9wHcV5g== +eslint-plugin-import@^2.20.1: + version "2.20.1" + resolved "https://registry.yarnpkg.com/eslint-plugin-import/-/eslint-plugin-import-2.20.1.tgz#802423196dcb11d9ce8435a5fc02a6d3b46939b3" + integrity sha512-qQHgFOTjguR+LnYRoToeZWT62XM55MBVXObHM6SKFd1VzDcX/vqT1kAz8ssqigh5eMj8qXcRoXXGZpPP6RfdCw== dependencies: array-includes "^3.0.3" + array.prototype.flat "^1.2.1" contains-path "^0.1.0" debug "^2.6.9" doctrine "1.5.0" eslint-import-resolver-node "^0.3.2" - eslint-module-utils "^2.4.0" + eslint-module-utils "^2.4.1" has "^1.0.3" - lodash "^4.17.11" minimatch "^3.0.4" + object.values "^1.1.0" read-pkg-up "^2.0.0" - resolve "^1.10.0" + resolve "^1.12.0" -eslint-plugin-prettier@^3.1.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/eslint-plugin-prettier/-/eslint-plugin-prettier-3.1.0.tgz#8695188f95daa93b0dc54b249347ca3b79c4686d" - integrity sha512-XWX2yVuwVNLOUhQijAkXz+rMPPoCr7WFiAl8ig6I7Xn+pPVhDhzg4DxHpmbeb0iqjO9UronEA3Tb09ChnFVHHA== +eslint-plugin-jest@^23.8.2: + version "23.8.2" + resolved "https://registry.yarnpkg.com/eslint-plugin-jest/-/eslint-plugin-jest-23.8.2.tgz#6f28b41c67ef635f803ebd9e168f6b73858eb8d4" + integrity sha512-xwbnvOsotSV27MtAe7s8uGWOori0nUsrXh2f1EnpmXua8sDfY6VZhHAhHg2sqK7HBNycRQExF074XSZ7DvfoFg== dependencies: - prettier-linter-helpers "^1.0.0" + "@typescript-eslint/experimental-utils" "^2.5.0" -eslint-scope@3.7.1: - version "3.7.1" - resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-3.7.1.tgz#3d63c3edfda02e06e01a452ad88caacc7cdcb6e8" +eslint-plugin-prettier@^3.1.2: + version "3.1.2" + resolved "https://registry.yarnpkg.com/eslint-plugin-prettier/-/eslint-plugin-prettier-3.1.2.tgz#432e5a667666ab84ce72f945c72f77d996a5c9ba" + integrity sha512-GlolCC9y3XZfv3RQfwGew7NnuFDKsfI4lbvRK+PIIo23SFH+LemGs4cKwzAaRa+Mdb+lQO/STaIayno8T5sJJA== dependencies: - esrecurse "^4.1.0" - estraverse "^4.1.1" + prettier-linter-helpers "^1.0.0" -eslint-scope@^4.0.3: - version "4.0.3" - resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-4.0.3.tgz#ca03833310f6889a3264781aa82e63eb9cfe7848" - integrity sha512-p7VutNr1O/QrxysMo3E45FjYDTeXBy0iTltPFNSqKAIfjDSXC+4dj+qfyuD8bfAXrW/y6lW3O76VaYNPKfpKrg== +eslint-scope@5.0.0, eslint-scope@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-5.0.0.tgz#e87c8887c73e8d1ec84f1ca591645c358bfc8fb9" + integrity sha512-oYrhJW7S0bxAFDvWqzvMPRm6pcgcnWc4QnofCAqRTRfQC0JcwenzGglTtsLyIuuWFfkqDG9vz67cnttSd53djw== dependencies: esrecurse "^4.1.0" estraverse "^4.1.1" -eslint-utils@^1.3.1: - version "1.3.1" - resolved "https://registry.yarnpkg.com/eslint-utils/-/eslint-utils-1.3.1.tgz#9a851ba89ee7c460346f97cf8939c7298827e512" +eslint-utils@^1.4.3: + version "1.4.3" + resolved "https://registry.yarnpkg.com/eslint-utils/-/eslint-utils-1.4.3.tgz#74fec7c54d0776b6f67e0251040b5806564e981f" + integrity sha512-fbBN5W2xdY45KulGXmLHZ3c3FHfVYmKg0IrAKGOkT/464PQsx2UeIzfz1RmEci+KLm1bBaAzZAh8+/E+XAeZ8Q== + dependencies: + eslint-visitor-keys "^1.1.0" -eslint-visitor-keys@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-1.0.0.tgz#3f3180fb2e291017716acb4c9d6d5b5c34a6a81d" +eslint-visitor-keys@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-1.1.0.tgz#e2a82cea84ff246ad6fb57f9bde5b46621459ec2" + integrity sha512-8y9YjtM1JBJU/A9Kc+SbaOV4y29sSWckBwMHa+FGtVj5gN/sbnKDf6xJUl+8g7FAij9LVaP8C24DUiH/f/2Z9A== -eslint@^5.16.0: - version "5.16.0" - resolved "https://registry.yarnpkg.com/eslint/-/eslint-5.16.0.tgz#a1e3ac1aae4a3fbd8296fcf8f7ab7314cbb6abea" - integrity sha512-S3Rz11i7c8AA5JPv7xAH+dOyq/Cu/VXHiHXBPOU1k/JAM5dXqQPt3qcrhpHSorXmrpu2g0gkIBVXAqCpzfoZIg== +eslint@^6.8.0: + version "6.8.0" + resolved "https://registry.yarnpkg.com/eslint/-/eslint-6.8.0.tgz#62262d6729739f9275723824302fb227c8c93ffb" + integrity sha512-K+Iayyo2LtyYhDSYwz5D5QdWw0hCacNzyq1Y821Xna2xSJj7cijoLLYmLxTQgcgZ9mC61nryMy9S7GRbYpI5Ig== dependencies: "@babel/code-frame" "^7.0.0" - ajv "^6.9.1" + ajv "^6.10.0" chalk "^2.1.0" cross-spawn "^6.0.5" debug "^4.0.1" doctrine "^3.0.0" - eslint-scope "^4.0.3" - eslint-utils "^1.3.1" - eslint-visitor-keys "^1.0.0" - espree "^5.0.1" + eslint-scope "^5.0.0" + eslint-utils "^1.4.3" + eslint-visitor-keys "^1.1.0" + espree "^6.1.2" esquery "^1.0.1" esutils "^2.0.2" file-entry-cache "^5.0.1" functional-red-black-tree "^1.0.1" - glob "^7.1.2" - globals "^11.7.0" + glob-parent "^5.0.0" + globals "^12.1.0" ignore "^4.0.6" import-fresh "^3.0.0" imurmurhash "^0.1.4" - inquirer "^6.2.2" - js-yaml "^3.13.0" + inquirer "^7.0.0" + is-glob "^4.0.0" + js-yaml "^3.13.1" json-stable-stringify-without-jsonify "^1.0.1" levn "^0.3.0" - lodash "^4.17.11" + lodash "^4.17.14" minimatch "^3.0.4" mkdirp "^0.5.1" natural-compare "^1.4.0" - optionator "^0.8.2" - path-is-inside "^1.0.2" + optionator "^0.8.3" progress "^2.0.0" regexpp "^2.0.1" - semver "^5.5.1" - strip-ansi "^4.0.0" - strip-json-comments "^2.0.1" + semver "^6.1.2" + strip-ansi "^5.2.0" + strip-json-comments "^3.0.1" table "^5.2.3" text-table "^0.2.0" + v8-compile-cache "^2.0.3" -espree@^5.0.1: - version "5.0.1" - resolved "https://registry.yarnpkg.com/espree/-/espree-5.0.1.tgz#5d6526fa4fc7f0788a5cf75b15f30323e2f81f7a" - integrity sha512-qWAZcWh4XE/RwzLJejfcofscgMc9CamR6Tn1+XRXNzrvUSSbiAjGOI/fggztjIi7y9VLPqnICMIPiGyr8JaZ0A== +espree@^6.1.2: + version "6.1.2" + resolved "https://registry.yarnpkg.com/espree/-/espree-6.1.2.tgz#6c272650932b4f91c3714e5e7b5f5e2ecf47262d" + integrity sha512-2iUPuuPP+yW1PZaMSDM9eyVf8D5P0Hi8h83YtZ5bPc/zHYjII5khoixIUTMO794NOY8F/ThF1Bo8ncZILarUTA== dependencies: - acorn "^6.0.7" - acorn-jsx "^5.0.0" - eslint-visitor-keys "^1.0.0" + acorn "^7.1.0" + acorn-jsx "^5.1.0" + eslint-visitor-keys "^1.1.0" -esprima@^3.1.3, esprima@~3.1.0: +esprima@^3.1.3: version "3.1.3" resolved "https://registry.yarnpkg.com/esprima/-/esprima-3.1.3.tgz#fdca51cee6133895e3c88d535ce49dbff62a4633" + integrity sha1-/cpRzuYTOJXjyI1TXOSdv/YqRjM= esprima@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/esprima/-/esprima-4.0.0.tgz#4499eddcd1110e0b218bacf2fa7f7f59f55ca804" + version "4.0.1" + resolved "https://registry.yarnpkg.com/esprima/-/esprima-4.0.1.tgz#13b04cdb3e6c5d19df91ab6987a8695619b0aa71" + integrity sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A== esquery@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/esquery/-/esquery-1.0.1.tgz#406c51658b1f5991a5f9b62b1dc25b00e3e5c708" + integrity sha512-SmiyZ5zIWH9VM+SRUReLS5Q8a7GxtRdxEBVZpm98rJM7Sb+A9DVCndXfkeFUd3byderg+EbDkfnevfCwynWaNA== dependencies: estraverse "^4.0.0" esrecurse@^4.1.0: version "4.2.1" resolved "https://registry.yarnpkg.com/esrecurse/-/esrecurse-4.2.1.tgz#007a3b9fdbc2b3bb87e4879ea19c92fdbd3942cf" + integrity sha512-64RBB++fIOAXPw3P9cy89qfMlvZEXZkqqJkjqqXIvzP5ezRZjW+lPWjw35UX/3EhUPFYbg5ER4JYgDw4007/DQ== dependencies: estraverse "^4.1.0" estraverse@^4.0.0, estraverse@^4.1.0, estraverse@^4.1.1, estraverse@^4.2.0: - version "4.2.0" - resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-4.2.0.tgz#0dee3fed31fcd469618ce7342099fc1afa0bdb13" + version "4.3.0" + resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-4.3.0.tgz#398ad3f3c5a24948be7725e83d11a7de28cdbd1d" + integrity sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw== -estree-walker@^0.6.0: - version "0.6.0" - resolved "https://registry.yarnpkg.com/estree-walker/-/estree-walker-0.6.0.tgz#5d865327c44a618dde5699f763891ae31f257dae" - integrity sha512-peq1RfVAVzr3PU/jL31RaOjUKLoZJpObQWJJ+LgfcxDUifyLZ1RjPQZTl0pzj2uJ45b7A7XpyppXvxdEqzo4rw== +estree-walker@^0.5.2: + version "0.5.2" + resolved "https://registry.yarnpkg.com/estree-walker/-/estree-walker-0.5.2.tgz#d3850be7529c9580d815600b53126515e146dd39" + integrity sha512-XpCnW/AE10ws/kDAs37cngSkvgIR8aN3G0MS85m7dUpuK2EREo9VJ00uvw6Dg/hXEpfsE1I1TvJOJr+Z+TL+ig== + +estree-walker@^0.6.1: + version "0.6.1" + resolved "https://registry.yarnpkg.com/estree-walker/-/estree-walker-0.6.1.tgz#53049143f40c6eb918b23671d1fe3219f3a1b362" + integrity sha512-SqmZANLWS0mnatqbSfRP5g8OXZC12Fgg1IwNtLsyHDzJizORW4khDfjPqJZsemPWBB2uqykUah5YpQ6epsqC/w== esutils@^2.0.2: - version "2.0.2" - resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.2.tgz#0abf4f1caa5bcb1f7a9d8acc6dea4faaa04bac9b" + version "2.0.3" + resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.3.tgz#74d2eb4de0b8da1293711910d50775b9b710ef64" + integrity sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g== event-emitter@~0.3.5: version "0.3.5" resolved "https://registry.yarnpkg.com/event-emitter/-/event-emitter-0.3.5.tgz#df8c69eef1647923c7157b9ce83840610b02cc39" + integrity sha1-34xp7vFkeSPHFXuc6DhAYQsCzDk= dependencies: d "1" es5-ext "~0.10.14" @@ -4043,53 +4412,28 @@ eventemitter3@^3.1.0: resolved "https://registry.yarnpkg.com/eventemitter3/-/eventemitter3-3.1.2.tgz#2d3d48f9c346698fce83a85d7d664e98535df6e7" integrity sha512-tvtQIeLVHjDkJYnzf2dgVMxfuSGJeM/7UCG17TT4EumTfNtF+0nebF/4zWOIkCreAbtNqhGEboB6BWrwqNaw4Q== -events@^1.0.0: - version "1.1.1" - resolved "https://registry.yarnpkg.com/events/-/events-1.1.1.tgz#9ebdb7635ad099c70dcc4c2a1f5004288e8bd924" - events@^2.0.0: version "2.1.0" resolved "https://registry.yarnpkg.com/events/-/events-2.1.0.tgz#2a9a1e18e6106e0e812aa9ebd4a819b3c29c0ba5" + integrity sha512-3Zmiobend8P9DjmKAty0Era4jV8oJ0yGYe2nJJAxgymF9+N8F2m0hhZiMoWtcfepExzNKZumFU3ksdQbInGWCg== evp_bytestokey@^1.0.0, evp_bytestokey@^1.0.3: version "1.0.3" resolved "https://registry.yarnpkg.com/evp_bytestokey/-/evp_bytestokey-1.0.3.tgz#7fcbdb198dc71959432efe13842684e0525acb02" + integrity sha512-/f2Go4TognH/KvCISP7OUsHn85hT9nUkxxA9BEWxFn+Oj9o8ZNLm/40hdlgSLyuOimsrTKLUMEorQexp/aPQeA== dependencies: md5.js "^1.3.4" safe-buffer "^5.1.1" exec-sh@^0.3.2: - version "0.3.2" - resolved "https://registry.yarnpkg.com/exec-sh/-/exec-sh-0.3.2.tgz#6738de2eb7c8e671d0366aea0b0db8c6f7d7391b" - integrity sha512-9sLAvzhI5nc8TpuQUh4ahMdCrWT00wPWz7j47/emR5+2qEfoZP5zzUXvx+vdx+H6ohhnsYC31iX04QLYJK8zTg== - -execa@^0.10.0: - version "0.10.0" - resolved "https://registry.yarnpkg.com/execa/-/execa-0.10.0.tgz#ff456a8f53f90f8eccc71a96d11bdfc7f082cb50" - dependencies: - cross-spawn "^6.0.0" - get-stream "^3.0.0" - is-stream "^1.1.0" - npm-run-path "^2.0.0" - p-finally "^1.0.0" - signal-exit "^3.0.0" - strip-eof "^1.0.0" - -execa@^0.7.0: - version "0.7.0" - resolved "https://registry.yarnpkg.com/execa/-/execa-0.7.0.tgz#944becd34cc41ee32a63a9faf27ad5a65fc59777" - dependencies: - cross-spawn "^5.0.1" - get-stream "^3.0.0" - is-stream "^1.1.0" - npm-run-path "^2.0.0" - p-finally "^1.0.0" - signal-exit "^3.0.0" - strip-eof "^1.0.0" + version "0.3.4" + resolved "https://registry.yarnpkg.com/exec-sh/-/exec-sh-0.3.4.tgz#3a018ceb526cc6f6df2bb504b2bfe8e3a4934ec5" + integrity sha512-sEFIkc61v75sWeOe72qyrqg2Qg0OuLESziUDk/O/z2qgS15y2gWVFrI6f2Qn/qw/0/NCfCEsmNA4zOjkwEZT1A== execa@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/execa/-/execa-1.0.0.tgz#c6236a5bb4df6d6f15e88e7f017798216749ddd8" + integrity sha512-adbxcyWV46qiHyvSp50TKt05tB4tK3HcmF7/nxfAdhnox83seTDbwnaqKO4sXRy7roHAIFqJP/Rw/AuEbX61LA== dependencies: cross-spawn "^6.0.0" get-stream "^4.0.0" @@ -4099,19 +4443,30 @@ execa@^1.0.0: signal-exit "^3.0.0" strip-eof "^1.0.0" +execa@^2.0.3: + version "2.1.0" + resolved "https://registry.yarnpkg.com/execa/-/execa-2.1.0.tgz#e5d3ecd837d2a60ec50f3da78fd39767747bbe99" + integrity sha512-Y/URAVapfbYy2Xp/gb6A0E7iR8xeqOCXsuuaoMn7A5PzrXUK84E1gyiEfq0wQd/GHA6GsoHWwhNq8anb0mleIw== + dependencies: + cross-spawn "^7.0.0" + get-stream "^5.0.0" + is-stream "^2.0.0" + merge-stream "^2.0.0" + npm-run-path "^3.0.0" + onetime "^5.1.0" + p-finally "^2.0.0" + signal-exit "^3.0.2" + strip-final-newline "^2.0.0" + exit@^0.1.2: version "0.1.2" resolved "https://registry.yarnpkg.com/exit/-/exit-0.1.2.tgz#0632638f8d877cc82107d30a0fff1a17cba1cd0c" - -expand-brackets@^0.1.4: - version "0.1.5" - resolved "https://registry.yarnpkg.com/expand-brackets/-/expand-brackets-0.1.5.tgz#df07284e342a807cd733ac5af72411e581d1177b" - dependencies: - is-posix-bracket "^0.1.0" + integrity sha1-BjJjj42HfMghB9MKD/8aF8uhzQw= expand-brackets@^2.1.4: version "2.1.4" resolved "https://registry.yarnpkg.com/expand-brackets/-/expand-brackets-2.1.4.tgz#b77735e315ce30f6b6eff0f83b04151a22449622" + integrity sha1-t3c14xXOMPa27/D4OwQVGiJEliI= dependencies: debug "^2.3.3" define-property "^0.2.5" @@ -4121,45 +4476,50 @@ expand-brackets@^2.1.4: snapdragon "^0.8.1" to-regex "^3.0.1" -expand-range@^1.8.1: - version "1.8.2" - resolved "https://registry.yarnpkg.com/expand-range/-/expand-range-1.8.2.tgz#a299effd335fe2721ebae8e257ec79644fc85337" - dependencies: - fill-range "^2.1.0" - expand-tilde@^2.0.0, expand-tilde@^2.0.2: version "2.0.2" resolved "https://registry.yarnpkg.com/expand-tilde/-/expand-tilde-2.0.2.tgz#97e801aa052df02454de46b02bf621642cdc8502" + integrity sha1-l+gBqgUt8CRU3kawK/YhZCzchQI= dependencies: homedir-polyfill "^1.0.1" -expect@^24.8.0: - version "24.8.0" - resolved "https://registry.yarnpkg.com/expect/-/expect-24.8.0.tgz#471f8ec256b7b6129ca2524b2a62f030df38718d" - integrity sha512-/zYvP8iMDrzaaxHVa724eJBCKqSHmO0FA7EDkBiRHxg6OipmMn1fN+C8T9L9K8yr7UONkOifu6+LLH+z76CnaA== +expect@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/expect/-/expect-24.9.0.tgz#b75165b4817074fa4a157794f46fe9f1ba15b6ca" + integrity sha512-wvVAx8XIol3Z5m9zvZXiyZOQ+sRJqNTIm6sGjdWlaZIeupQGO3WbYI+15D/AmEwZywL6wtJkbAbJtzkOfBuR0Q== dependencies: - "@jest/types" "^24.8.0" + "@jest/types" "^24.9.0" ansi-styles "^3.2.0" - jest-get-type "^24.8.0" - jest-matcher-utils "^24.8.0" - jest-message-util "^24.8.0" - jest-regex-util "^24.3.0" + jest-get-type "^24.9.0" + jest-matcher-utils "^24.9.0" + jest-message-util "^24.9.0" + jest-regex-util "^24.9.0" + +ext@^1.1.2: + version "1.4.0" + resolved "https://registry.yarnpkg.com/ext/-/ext-1.4.0.tgz#89ae7a07158f79d35517882904324077e4379244" + integrity sha512-Key5NIsUxdqKg3vIsdw9dSuXpPCQ297y6wBjL30edxwPgt2E44WcWBZey/ZvUc6sERLTxKdyCu4gZFmUbk1Q7A== + dependencies: + type "^2.0.0" extend-shallow@^1.1.2: version "1.1.4" resolved "https://registry.yarnpkg.com/extend-shallow/-/extend-shallow-1.1.4.tgz#19d6bf94dfc09d76ba711f39b872d21ff4dd9071" + integrity sha1-Gda/lN/AnXa6cR85uHLSH/TdkHE= dependencies: kind-of "^1.1.0" extend-shallow@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/extend-shallow/-/extend-shallow-2.0.1.tgz#51af7d614ad9a9f610ea1bafbb989d6b1c56890f" + integrity sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8= dependencies: is-extendable "^0.1.0" extend-shallow@^3.0.0, extend-shallow@^3.0.2: version "3.0.2" resolved "https://registry.yarnpkg.com/extend-shallow/-/extend-shallow-3.0.2.tgz#26a71aaf073b39fb2127172746131c2704028db8" + integrity sha1-Jqcarwc7OfshJxcnRhMcJwQCjbg= dependencies: assign-symbols "^1.0.0" is-extendable "^1.0.1" @@ -4167,24 +4527,21 @@ extend-shallow@^3.0.0, extend-shallow@^3.0.2: extend@^3.0.0, extend@~3.0.2: version "3.0.2" resolved "https://registry.yarnpkg.com/extend/-/extend-3.0.2.tgz#f8b1136b4071fbd8eb140aff858b1019ec2915fa" + integrity sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g== external-editor@^3.0.3: - version "3.0.3" - resolved "https://registry.yarnpkg.com/external-editor/-/external-editor-3.0.3.tgz#5866db29a97826dbe4bf3afd24070ead9ea43a27" + version "3.1.0" + resolved "https://registry.yarnpkg.com/external-editor/-/external-editor-3.1.0.tgz#cb03f740befae03ea4d283caed2741a83f335495" + integrity sha512-hMQ4CX1p1izmuLYyZqLMO/qGNw10wSv9QDCPfzXfyFrOaCSSoRfqE1Kf1s5an66J5JZC62NewG+mK49jOCtQew== dependencies: chardet "^0.7.0" iconv-lite "^0.4.24" tmp "^0.0.33" -extglob@^0.3.1: - version "0.3.2" - resolved "https://registry.yarnpkg.com/extglob/-/extglob-0.3.2.tgz#2e18ff3d2f49ab2765cec9023f011daa8d8349a1" - dependencies: - is-extglob "^1.0.0" - extglob@^2.0.4: version "2.0.4" resolved "https://registry.yarnpkg.com/extglob/-/extglob-2.0.4.tgz#ad00fe4dc612a9232e8718711dc5cb5ab0285543" + integrity sha512-Nmb6QXkELsuBr24CJSkilo6UHHgbekK5UiZgfE6UHD3Eb27YC6oD+bhcT+tJ6cl8dmsgdQxnWlcry8ksBIBLpw== dependencies: array-unique "^0.3.2" define-property "^1.0.0" @@ -4195,30 +4552,30 @@ extglob@^2.0.4: snapdragon "^0.8.1" to-regex "^3.0.1" -extsprintf@1.3.0, extsprintf@^1.2.0: +extsprintf@1.3.0: version "1.3.0" resolved "https://registry.yarnpkg.com/extsprintf/-/extsprintf-1.3.0.tgz#96918440e3041a7a414f8c52e3c574eb3c3e1e05" + integrity sha1-lpGEQOMEGnpBT4xS48V06zw+HgU= + +extsprintf@^1.2.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/extsprintf/-/extsprintf-1.4.0.tgz#e2689f8f356fad62cca65a3a91c5df5f9551692f" + integrity sha1-4mifjzVvrWLMplo6kcXfX5VRaS8= falafel@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/falafel/-/falafel-2.1.0.tgz#96bb17761daba94f46d001738b3cedf3a67fe06c" + integrity sha1-lrsXdh2rqU9G0AFzizzt86Z/4Gw= dependencies: acorn "^5.0.0" foreach "^2.0.5" isarray "0.0.1" object-keys "^1.0.6" -fancy-log@1.3.2: - version "1.3.2" - resolved "https://registry.yarnpkg.com/fancy-log/-/fancy-log-1.3.2.tgz#f41125e3d84f2e7d89a43d06d958c8f78be16be1" - dependencies: - ansi-gray "^0.1.1" - color-support "^1.1.3" - time-stamp "^1.0.0" - fancy-log@^1.3.2, fancy-log@^1.3.3: version "1.3.3" resolved "https://registry.yarnpkg.com/fancy-log/-/fancy-log-1.3.3.tgz#dbc19154f558690150a23953a0adbd035be45fc7" + integrity sha512-k9oEhlyc0FrVh25qYuSELjr8oxsCoc4/LEZfg2iJJrfEk/tZL9bCoJE47gqAvI2m/AUjluCS4+3I0eTx8n3AEw== dependencies: ansi-gray "^0.1.1" color-support "^1.1.3" @@ -4228,14 +4585,17 @@ fancy-log@^1.3.2, fancy-log@^1.3.3: fast-deep-equal@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-2.0.1.tgz#7b05218ddf9667bf7f370bf7fdb2cb15fdd0aa49" + integrity sha1-ewUhjd+WZ79/Nwv3/bLLFf3Qqkk= fast-diff@^1.1.2: version "1.2.0" resolved "https://registry.yarnpkg.com/fast-diff/-/fast-diff-1.2.0.tgz#73ee11982d86caaf7959828d519cfe927fac5f03" + integrity sha512-xJuoT5+L99XlZ8twedaRf6Ax2TgQVxvgZOYoPKqZufmJib0tL2tegPBOZb1pVNgIhlqDlA0eO0c3wBvQcmzx4w== -fast-glob@^2.0.2: - version "2.2.4" - resolved "https://registry.yarnpkg.com/fast-glob/-/fast-glob-2.2.4.tgz#e54f4b66d378040e0e4d6a68ec36bbc5b04363c0" +fast-glob@^2.2.6: + version "2.2.7" + resolved "https://registry.yarnpkg.com/fast-glob/-/fast-glob-2.2.7.tgz#6953857c3afa475fff92ee6015d52da70a4cd39d" + integrity sha512-g1KuQwHOZAmOZMuBtHdxDtju+T2RT8jgCC9aANsbpdiDDTSnjgfuVsIBNKbUeJI3oKMRExcfNDtJl4OhbffMsw== dependencies: "@mrmlnc/readdir-enhanced" "^2.2.1" "@nodelib/fs.stat" "^1.1.2" @@ -4244,31 +4604,55 @@ fast-glob@^2.0.2: merge2 "^1.2.3" micromatch "^3.1.10" +fast-glob@^3.0.3: + version "3.1.1" + resolved "https://registry.yarnpkg.com/fast-glob/-/fast-glob-3.1.1.tgz#87ee30e9e9f3eb40d6f254a7997655da753d7c82" + integrity sha512-nTCREpBY8w8r+boyFYAx21iL6faSsQynliPHM4Uf56SbkyohCNxpVPEH9xrF5TXKy+IsjkPUHDKiUkzBVRXn9g== + dependencies: + "@nodelib/fs.stat" "^2.0.2" + "@nodelib/fs.walk" "^1.2.3" + glob-parent "^5.1.0" + merge2 "^1.3.0" + micromatch "^4.0.2" + fast-json-stable-stringify@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz#d5142c0caee6b1189f87d3a76111064f86c8bbf2" + integrity sha1-1RQsDK7msRifh9OnYREGT4bIu/I= -fast-levenshtein@~2.0.4: +fast-levenshtein@~2.0.6: version "2.0.6" resolved "https://registry.yarnpkg.com/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz#3d8a5c66883a16a30ca8643e851f19baa7797917" + integrity sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc= -fastparse@^1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/fastparse/-/fastparse-1.1.1.tgz#d1e2643b38a94d7583b479060e6c4affc94071f8" +fast-safe-stringify@^2.0.7: + version "2.0.7" + resolved "https://registry.yarnpkg.com/fast-safe-stringify/-/fast-safe-stringify-2.0.7.tgz#124aa885899261f68aedb42a7c080de9da608743" + integrity sha512-Utm6CdzT+6xsDk2m8S6uL8VHxNwI6Jub+e9NYTcAms28T84pTa25GJQV9j0CY0N1rM8hK4x6grpF2BQf+2qwVA== + +fastq@^1.6.0: + version "1.6.0" + resolved "https://registry.yarnpkg.com/fastq/-/fastq-1.6.0.tgz#4ec8a38f4ac25f21492673adb7eae9cfef47d1c2" + integrity sha512-jmxqQ3Z/nXoeyDmWAzF9kH1aGZSis6e/SbfPmJpUnyZ0ogr6iscHQaml4wsEepEWSdtmpy+eVXmCRIMpxaXqOA== + dependencies: + reusify "^1.0.0" fb-watchman@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/fb-watchman/-/fb-watchman-2.0.0.tgz#54e9abf7dfa2f26cd9b1636c588c1afc05de5d58" + version "2.0.1" + resolved "https://registry.yarnpkg.com/fb-watchman/-/fb-watchman-2.0.1.tgz#fc84fb39d2709cf3ff6d743706157bb5708a8a85" + integrity sha512-DkPJKQeY6kKwmuMretBhr7G6Vodr7bFwDYTXIkfG1gjvNpaxBTQV3PbXg6bR1c1UP4jPOX0jHUbbHANL9vRjVg== dependencies: - bser "^2.0.0" + bser "2.1.1" figgy-pudding@^3.4.1, figgy-pudding@^3.5.1: version "3.5.1" resolved "https://registry.yarnpkg.com/figgy-pudding/-/figgy-pudding-3.5.1.tgz#862470112901c727a0e495a80744bd5baa1d6790" + integrity sha512-vNKxJHTEKNThjfrdJwHc7brvM6eVevuO5nTj6ez8ZQ1qbXTvGthucRF7S4vf2cr71QVnT70V34v0S1DyQsti0w== figures@^1.7.0: version "1.7.0" resolved "https://registry.yarnpkg.com/figures/-/figures-1.7.0.tgz#cbe1e3affcf1cd44b80cadfed28dc793a9701d2e" + integrity sha1-y+Hjr/zxzUS4DK3+0o3Hk6lwHS4= dependencies: escape-string-regexp "^1.0.5" object-assign "^4.1.0" @@ -4276,6 +4660,14 @@ figures@^1.7.0: figures@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/figures/-/figures-2.0.0.tgz#3ab1a2d2a62c8bfb431a0c94cb797a2fce27c962" + integrity sha1-OrGi0qYsi/tDGgyUy3l6L84nyWI= + dependencies: + escape-string-regexp "^1.0.5" + +figures@^3.0.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/figures/-/figures-3.1.0.tgz#4b198dd07d8d71530642864af2d45dd9e459c4ec" + integrity sha512-ravh8VRXqHuMvZt/d8GblBeqDMkdJMBdv/2KntFH+ra5MXkO7nxNKpzQ3n6QD/2da1kH0aWmNISdvhM7gl2gVg== dependencies: escape-string-regexp "^1.0.5" @@ -4286,49 +4678,36 @@ file-entry-cache@^5.0.1: dependencies: flat-cache "^2.0.1" -filename-regex@^2.0.0: - version "2.0.1" - resolved "https://registry.yarnpkg.com/filename-regex/-/filename-regex-2.0.1.tgz#c1c4b9bee3e09725ddb106b75c1e301fe2f18b26" - -fill-range@^2.1.0: - version "2.2.3" - resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-2.2.3.tgz#50b77dfd7e469bc7492470963699fe7a8485a723" - dependencies: - is-number "^2.1.0" - isobject "^2.0.0" - randomatic "^1.1.3" - repeat-element "^1.1.2" - repeat-string "^1.5.2" - fill-range@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-4.0.0.tgz#d544811d428f98eb06a63dc402d2403c328c38f7" + integrity sha1-1USBHUKPmOsGpj3EAtJAPDKMOPc= dependencies: extend-shallow "^2.0.1" is-number "^3.0.0" repeat-string "^1.6.1" to-regex-range "^2.1.0" +fill-range@^7.0.1: + version "7.0.1" + resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-7.0.1.tgz#1919a6a7c75fe38b2c7c77e5198535da9acdda40" + integrity sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ== + dependencies: + to-regex-range "^5.0.1" + find-cache-dir@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/find-cache-dir/-/find-cache-dir-2.0.0.tgz#4c1faed59f45184530fb9d7fa123a4d04a98472d" + version "2.1.0" + resolved "https://registry.yarnpkg.com/find-cache-dir/-/find-cache-dir-2.1.0.tgz#8d0f94cd13fe43c6c7c261a0d86115ca918c05f7" + integrity sha512-Tq6PixE0w/VMFfCgbONnkiQIVol/JJL7nRMi20fqzA4NRs9AfeqMGeRdPi3wIhYkxjeBaWh2rxwapn5Tu3IqOQ== dependencies: commondir "^1.0.1" - make-dir "^1.0.0" + make-dir "^2.0.0" pkg-dir "^3.0.0" -find-parent-dir@^0.3.0: - version "0.3.0" - resolved "https://registry.yarnpkg.com/find-parent-dir/-/find-parent-dir-0.3.0.tgz#33c44b429ab2b2f0646299c5f9f718f376ff8d54" - -find-root@^1.0.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/find-root/-/find-root-1.1.0.tgz#abcfc8ba76f708c42a97b3d685b7e9450bfb9ce4" - integrity sha512-NKfW6bec6GfKc0SGx1e07QZY9PE99u0Bft/0rzSD5k3sO/vwkVUpDUKVm5Gpp5Ue3YfShPFTX2070tDs5kB9Ng== - find-up@^1.0.0: version "1.1.2" resolved "https://registry.yarnpkg.com/find-up/-/find-up-1.1.2.tgz#6b2e9822b1a2ce0a60ab64d610eccad53cb24d0f" + integrity sha1-ay6YIrGizgpgq2TWEOzK1TyyTQ8= dependencies: path-exists "^2.0.0" pinkie-promise "^2.0.0" @@ -4336,18 +4715,29 @@ find-up@^1.0.0: find-up@^2.0.0, find-up@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/find-up/-/find-up-2.1.0.tgz#45d1b7e506c717ddd482775a2b77920a3c0c57a7" + integrity sha1-RdG35QbHF93UgndaK3eSCjwMV6c= dependencies: locate-path "^2.0.0" find-up@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/find-up/-/find-up-3.0.0.tgz#49169f1d7993430646da61ecc5ae355c21c97b73" + integrity sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg== dependencies: locate-path "^3.0.0" +find-up@^4.0.0, find-up@^4.1.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/find-up/-/find-up-4.1.0.tgz#97afe7d6cdc0bc5928584b7c8d7b16e8a9aa5d19" + integrity sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw== + dependencies: + locate-path "^5.0.0" + path-exists "^4.0.0" + findup-sync@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/findup-sync/-/findup-sync-2.0.0.tgz#9326b1488c22d1a6088650a86901b2d9a90a2cbc" + integrity sha1-kyaxSIwi0aYIhlCoaQGy2akKLLw= dependencies: detect-file "^1.0.0" is-glob "^3.1.0" @@ -4365,8 +4755,9 @@ findup-sync@^3.0.0: resolve-dir "^1.0.1" fined@^1.0.1: - version "1.1.0" - resolved "https://registry.yarnpkg.com/fined/-/fined-1.1.0.tgz#b37dc844b76a2f5e7081e884f7c0ae344f153476" + version "1.2.0" + resolved "https://registry.yarnpkg.com/fined/-/fined-1.2.0.tgz#d00beccf1aa2b475d16d423b0238b713a2c4a37b" + integrity sha512-ZYDqPLGxDkDhDZBjZBb+oD1+j0rA4E0pXY50eplAAOPg2N/gUBSSk5IM1/QhPfyVo19lJ+CvXpqfvk+b2p/8Ng== dependencies: expand-tilde "^2.0.2" is-plain-object "^2.0.3" @@ -4374,15 +4765,10 @@ fined@^1.0.1: object.pick "^1.2.0" parse-filepath "^1.0.1" -first-chunk-stream@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/first-chunk-stream/-/first-chunk-stream-2.0.0.tgz#1bdecdb8e083c0664b91945581577a43a9f31d70" - dependencies: - readable-stream "^2.0.2" - flagged-respawn@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/flagged-respawn/-/flagged-respawn-1.0.0.tgz#4e79ae9b2eb38bf86b3bb56bf3e0a56aa5fcabd7" + version "1.0.1" + resolved "https://registry.yarnpkg.com/flagged-respawn/-/flagged-respawn-1.0.1.tgz#e7de6f1279ddd9ca9aac8a5971d618606b3aab41" + integrity sha512-lNaHNVymajmk0OJMBn8fVUAU1BtDeKIqKoVhk4xAALB57aALg6b4W0MfJ/cUE0g9YBXy5XhSlPIpYIJ7HaY/3Q== flat-cache@^2.0.1: version "2.0.1" @@ -4394,54 +4780,49 @@ flat-cache@^2.0.1: write "1.0.3" flatted@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/flatted/-/flatted-2.0.0.tgz#55122b6536ea496b4b44893ee2608141d10d9916" - integrity sha512-R+H8IZclI8AAkSBRQJLVOsxwAoHd6WC40b4QTNWIjzAa6BXOBfQcM587MXDTVPeYaopFNWHUFLx7eNmHDSxMWg== + version "2.0.1" + resolved "https://registry.yarnpkg.com/flatted/-/flatted-2.0.1.tgz#69e57caa8f0eacbc281d2e2cb458d46fdb449e08" + integrity sha512-a1hQMktqW9Nmqr5aktAux3JMNqaucxGcjtjWnZLHX7yyPCmlSV3M54nGYbqT8K+0GhF3NBgmJCc3ma+WOgX8Jg== -flow-bin@^0.94.0: - version "0.94.0" - resolved "https://registry.yarnpkg.com/flow-bin/-/flow-bin-0.94.0.tgz#b5d58fe7559705b73a18229f97edfc3ab6ffffcb" - integrity sha512-DYF7r9CJ/AksfmmB4+q+TyLMoeQPRnqtF1Pk7KY3zgfkB/nVuA3nXyzqgsIPIvnMSiFEXQcFK4z+iPxSLckZhQ== +flow-bin@^0.108.0: + version "0.108.0" + resolved "https://registry.yarnpkg.com/flow-bin/-/flow-bin-0.108.0.tgz#6a42c85fd664d23dd937d925851e8e6ab5d71393" + integrity sha512-hPEyCP1J8rdhNDfCAA5w7bN6HUNBDcHVg/ABU5JVo0gUFMx+uRewpyEH8LlLBGjVQuIpbaPpaqpoaQhAVyaYww== flush-write-stream@^1.0.0, flush-write-stream@^1.0.2: - version "1.0.3" - resolved "https://registry.yarnpkg.com/flush-write-stream/-/flush-write-stream-1.0.3.tgz#c5d586ef38af6097650b49bc41b55fabb19f35bd" + version "1.1.1" + resolved "https://registry.yarnpkg.com/flush-write-stream/-/flush-write-stream-1.1.1.tgz#8dd7d873a1babc207d94ead0c2e0e44276ebf2e8" + integrity sha512-3Z4XhFZ3992uIq0XOqb9AreonueSYphE6oYbpt5+3u06JWklbsPkNv3ZKkP9Bz/r+1MWCaMoSQ28P85+1Yc77w== dependencies: - inherits "^2.0.1" - readable-stream "^2.0.4" - -fn-name@~2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/fn-name/-/fn-name-2.0.1.tgz#5214d7537a4d06a4a301c0cc262feb84188002e7" - integrity sha1-UhTXU3pNBqSjAcDMJi/rhBiAAuc= + inherits "^2.0.3" + readable-stream "^2.3.6" for-in@^1.0.1, for-in@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/for-in/-/for-in-1.0.2.tgz#81068d295a8142ec0ac726c6e2200c30fb6d5e80" - -for-own@^0.1.4: - version "0.1.5" - resolved "https://registry.yarnpkg.com/for-own/-/for-own-0.1.5.tgz#5265c681a4f294dabbf17c9509b6763aa84510ce" - dependencies: - for-in "^1.0.1" + integrity sha1-gQaNKVqBQuwKxybG4iAMMPttXoA= for-own@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/for-own/-/for-own-1.0.0.tgz#c63332f415cedc4b04dbfe70cf836494c53cb44b" + integrity sha1-xjMy9BXO3EsE2/5wz4NklMU8tEs= dependencies: for-in "^1.0.1" -foreach@^2.0.5: +foreach@^2.0.5, foreach@~2.0.1: version "2.0.5" resolved "https://registry.yarnpkg.com/foreach/-/foreach-2.0.5.tgz#0bee005018aeb260d0a3af3ae658dd0136ec1b99" + integrity sha1-C+4AUBiusmDQo6865ljdATbsG5k= forever-agent@~0.6.1: version "0.6.1" resolved "https://registry.yarnpkg.com/forever-agent/-/forever-agent-0.6.1.tgz#fbc71f0c41adeb37f96c577ad1ed42d8fdacca91" + integrity sha1-+8cfDEGt6zf5bFd60e1C2P2sypE= form-data@~2.3.2: version "2.3.3" resolved "https://registry.yarnpkg.com/form-data/-/form-data-2.3.3.tgz#dcce52c05f644f298c6a7ab936bd724ceffbf3a6" + integrity sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ== dependencies: asynckit "^0.4.0" combined-stream "^1.0.6" @@ -4450,33 +4831,38 @@ form-data@~2.3.2: fragment-cache@^0.2.1: version "0.2.1" resolved "https://registry.yarnpkg.com/fragment-cache/-/fragment-cache-0.2.1.tgz#4290fad27f13e89be7f33799c6bc5a0abfff0d19" + integrity sha1-QpD60n8T6Jvn8zeZxrxaCr//DRk= dependencies: map-cache "^0.2.2" from2@^2.1.0: version "2.3.0" resolved "https://registry.yarnpkg.com/from2/-/from2-2.3.0.tgz#8bfb5502bde4a4d36cfdeea007fcca21d7e382af" + integrity sha1-i/tVAr3kpNNs/e6gB/zKIdfjgq8= dependencies: inherits "^2.0.1" readable-stream "^2.0.0" -fs-extra@^7.0.0: - version "7.0.1" - resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-7.0.1.tgz#4f189c44aa123b895f722804f55ea23eadc348e9" +fs-extra@^8.1.0: + version "8.1.0" + resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-8.1.0.tgz#49d43c45a88cd9677668cb7be1b46efdb8d2e1c0" + integrity sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g== dependencies: - graceful-fs "^4.1.2" + graceful-fs "^4.2.0" jsonfile "^4.0.0" universalify "^0.1.0" fs-minipass@^1.2.5: - version "1.2.5" - resolved "https://registry.yarnpkg.com/fs-minipass/-/fs-minipass-1.2.5.tgz#06c277218454ec288df77ada54a03b8702aacb9d" + version "1.2.7" + resolved "https://registry.yarnpkg.com/fs-minipass/-/fs-minipass-1.2.7.tgz#ccff8570841e7fe4265693da88936c55aed7f7c7" + integrity sha512-GWSSJGFy4e9GUeCcbIkED+bgAoFyj7XF1mV8rma3QW4NIqX9Kyx79N/PF61H5udOV3aY1IaMLs6pGbH71nlCTA== dependencies: - minipass "^2.2.1" + minipass "^2.6.0" fs-mkdirp-stream@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/fs-mkdirp-stream/-/fs-mkdirp-stream-1.0.0.tgz#0b7815fc3201c6a69e14db98ce098c16935259eb" + integrity sha1-C3gV/DIBxqaeFNuYzgmMFpNSWes= dependencies: graceful-fs "^4.1.11" through2 "^2.0.3" @@ -4484,10 +4870,12 @@ fs-mkdirp-stream@^1.0.0: fs-readdir-recursive@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/fs-readdir-recursive/-/fs-readdir-recursive-1.1.0.tgz#e32fc030a2ccee44a6b5371308da54be0b397d27" + integrity sha512-GNanXlVr2pf02+sPN40XN8HG+ePaNcvM0q5mZBd668Obwb0yD5GiUbZOFgwn8kGMY6I3mdyDJzieUy3PTYyTRA== fs-write-stream-atomic@^1.0.8: version "1.0.10" resolved "https://registry.yarnpkg.com/fs-write-stream-atomic/-/fs-write-stream-atomic-1.0.10.tgz#b47df53493ef911df75731e70a9ded0189db40c9" + integrity sha1-tH31NJPvkR33VzHnCp3tAYnbQMk= dependencies: graceful-fs "^4.1.2" iferr "^0.1.5" @@ -4497,6 +4885,7 @@ fs-write-stream-atomic@^1.0.8: fs.realpath@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" + integrity sha1-FQStJSMVjKpA20onh8sBQRmU6k8= fsevents@^1.2.7: version "1.2.9" @@ -4509,22 +4898,24 @@ fsevents@^1.2.7: function-bind@^1.0.2, function-bind@^1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.1.tgz#a56899d3ea3c9bab874bb9773b7c5ede92f4895d" + integrity sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A== functional-red-black-tree@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz#1b0ab3bd553b2a0d6399d29c0e3ea0b252078327" + integrity sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc= -g-status@^2.0.2: - version "2.0.2" - resolved "https://registry.yarnpkg.com/g-status/-/g-status-2.0.2.tgz#270fd32119e8fc9496f066fe5fe88e0a6bc78b97" +fwd-stream@^1.0.4: + version "1.0.4" + resolved "https://registry.yarnpkg.com/fwd-stream/-/fwd-stream-1.0.4.tgz#ed281cabed46feecf921ee32dc4c50b372ac7cfa" + integrity sha1-7Sgcq+1G/uz5Ie4y3ExQs3KsfPo= dependencies: - arrify "^1.0.1" - matcher "^1.0.0" - simple-git "^1.85.0" + readable-stream "~1.0.26-4" gauge@~2.7.3: version "2.7.4" resolved "https://registry.yarnpkg.com/gauge/-/gauge-2.7.4.tgz#2c03405c7538c39d7eb37b317022e325fb018bf7" + integrity sha1-LANAXHU4w51+s3sxcCLjJfsBi/c= dependencies: aproba "^1.0.3" console-control-strings "^1.0.0" @@ -4538,18 +4929,37 @@ gauge@~2.7.3: genfun@^5.0.0: version "5.0.0" resolved "https://registry.yarnpkg.com/genfun/-/genfun-5.0.0.tgz#9dd9710a06900a5c4a5bf57aca5da4e52fe76537" + integrity sha512-KGDOARWVga7+rnB3z9Sd2Letx515owfk0hSxHGuqjANb1M+x2bGZGqHLiozPsYMdM2OubeMni/Hpwmjq6qIUhA== + +gensync@^1.0.0-beta.1: + version "1.0.0-beta.1" + resolved "https://registry.yarnpkg.com/gensync/-/gensync-1.0.0-beta.1.tgz#58f4361ff987e5ff6e1e7a210827aa371eaac269" + integrity sha512-r8EC6NO1sngH/zdD9fiRDLdcgnbayXah+mLgManTaIZJqEC1MZstmnox8KpnI2/fxQwrp5OpCOYWLp4rBl4Jcg== + +get-assigned-identifiers@^1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/get-assigned-identifiers/-/get-assigned-identifiers-1.2.0.tgz#6dbf411de648cbaf8d9169ebb0d2d576191e2ff1" + integrity sha512-mBBwmeGTrxEMO4pMaaf/uUEFHnYtwr8FTe8Y/mer4rcV/bye0qGm6pw1bGZFGStxC5O76c5ZAVBGnqHmOaJpdQ== get-caller-file@^1.0.1: - version "1.0.2" - resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-1.0.2.tgz#f702e63127e7e231c160a80c1554acb70d5047e5" + version "1.0.3" + resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-1.0.3.tgz#f978fa4c90d1dfe7ff2d6beda2a515e713bdcf4a" + integrity sha512-3t6rVToeoZfYSGd8YoLFR2DJkiQrIiUrGcjvFX2mDw3bn6k2OtwHN0TNCLbBO+w8qTvimhDkv+LSscbJY1vE6w== -get-own-enumerable-property-symbols@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/get-own-enumerable-property-symbols/-/get-own-enumerable-property-symbols-2.0.1.tgz#5c4ad87f2834c4b9b4e84549dc1e0650fb38c24b" +get-caller-file@^2.0.1: + version "2.0.5" + resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-2.0.5.tgz#4f94412a82db32f36e3b0b9741f8a97feb031f7e" + integrity sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg== + +get-own-enumerable-property-symbols@^3.0.0: + version "3.0.1" + resolved "https://registry.yarnpkg.com/get-own-enumerable-property-symbols/-/get-own-enumerable-property-symbols-3.0.1.tgz#6f7764f88ea11e0b514bd9bd860a132259992ca4" + integrity sha512-09/VS4iek66Dh2bctjRkowueRJbY1JDGR1L/zRxO1Qk8Uxs6PnqaNSqalpizPT+CDjre3hnEsuzvhgomz9qYrA== get-pkg-repo@^1.0.0: version "1.4.0" resolved "https://registry.yarnpkg.com/get-pkg-repo/-/get-pkg-repo-1.4.0.tgz#c73b489c06d80cc5536c2c853f9e05232056972d" + integrity sha1-xztInAbYDMVTbCyFP54FIyBWly0= dependencies: hosted-git-info "^2.1.4" meow "^3.3.0" @@ -4557,42 +4967,51 @@ get-pkg-repo@^1.0.0: parse-github-repo-url "^1.3.0" through2 "^2.0.0" -get-port@^3.2.0: - version "3.2.0" - resolved "https://registry.yarnpkg.com/get-port/-/get-port-3.2.0.tgz#dd7ce7de187c06c8bf353796ac71e099f0980ebc" +get-port@^4.2.0: + version "4.2.0" + resolved "https://registry.yarnpkg.com/get-port/-/get-port-4.2.0.tgz#e37368b1e863b7629c43c5a323625f95cf24b119" + integrity sha512-/b3jarXkH8KJoOMQc3uVGHASwGLPq3gSFJ7tgJm2diza+bydJPTGOibin2steecKeOylE8oY2JERlVWkAJO6yw== get-stdin@^4.0.1: version "4.0.1" resolved "https://registry.yarnpkg.com/get-stdin/-/get-stdin-4.0.1.tgz#b968c6b0a04384324902e8bf1a5df32579a450fe" + integrity sha1-uWjGsKBDhDJJAui/Gl3zJXmkUP4= get-stdin@^7.0.0: version "7.0.0" resolved "https://registry.yarnpkg.com/get-stdin/-/get-stdin-7.0.0.tgz#8d5de98f15171a125c5e516643c7a6d0ea8a96f6" integrity sha512-zRKcywvrXlXsA0v0i9Io4KDRaAw7+a1ZpjRwl9Wox8PFlVCCHra7E9c4kqXCoCM9nR5tBkaTTZRBoCm60bFqTQ== -get-stream@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-3.0.0.tgz#8e943d1358dc37555054ecbe2edb05aa174ede14" - get-stream@^4.0.0, get-stream@^4.1.0: version "4.1.0" resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-4.1.0.tgz#c1b255575f3dc21d59bfc79cd3d2b46b1c3a54b5" + integrity sha512-GMat4EJ5161kIy2HevLlr4luNjBgvmj413KaQA7jt4V8B4RDsfpHk7WQ9GVqfYyyx8OS/L66Kox+rJRNklLK7w== + dependencies: + pump "^3.0.0" + +get-stream@^5.0.0: + version "5.1.0" + resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-5.1.0.tgz#01203cdc92597f9b909067c3e656cc1f4d3c4dc9" + integrity sha512-EXr1FOzrzTfGeL0gQdeFEvOMm2mzMOglyiOXSTpPC+iAjAKftbr3jpCMWynogwYnM+eSj9sHGc6wjIcDvYiygw== dependencies: pump "^3.0.0" get-value@^2.0.3, get-value@^2.0.6: version "2.0.6" resolved "https://registry.yarnpkg.com/get-value/-/get-value-2.0.6.tgz#dc15ca1c672387ca76bd37ac0a395ba2042a2c28" + integrity sha1-3BXKHGcjh8p2vTesCjlbogQqLCg= getpass@^0.1.1: version "0.1.7" resolved "https://registry.yarnpkg.com/getpass/-/getpass-0.1.7.tgz#5eff8e3e684d569ae4cb2b1282604e8ba62149fa" + integrity sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo= dependencies: assert-plus "^1.0.0" git-raw-commits@2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/git-raw-commits/-/git-raw-commits-2.0.0.tgz#d92addf74440c14bcc5c83ecce3fb7f8a79118b5" + integrity sha512-w4jFEJFgKXMQJ0H0ikBk2S+4KP2VEjhCvLCNqbNRQC8BgGWgLKNCO7a9K9LI+TVT7Gfoloje502sEnctibffgg== dependencies: dargs "^4.0.1" lodash.template "^4.0.2" @@ -4603,16 +5022,18 @@ git-raw-commits@2.0.0: git-remote-origin-url@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/git-remote-origin-url/-/git-remote-origin-url-2.0.0.tgz#5282659dae2107145a11126112ad3216ec5fa65f" + integrity sha1-UoJlna4hBxRaERJhEq0yFuxfpl8= dependencies: gitconfiglocal "^1.0.0" pify "^2.3.0" -git-semver-tags@^2.0.2: - version "2.0.2" - resolved "https://registry.yarnpkg.com/git-semver-tags/-/git-semver-tags-2.0.2.tgz#f506ec07caade191ac0c8d5a21bdb8131b4934e3" +git-semver-tags@^2.0.3: + version "2.0.3" + resolved "https://registry.yarnpkg.com/git-semver-tags/-/git-semver-tags-2.0.3.tgz#48988a718acf593800f99622a952a77c405bfa34" + integrity sha512-tj4FD4ww2RX2ae//jSrXZzrocla9db5h0V7ikPl1P/WwoZar9epdUhwR7XHXSgc+ZkNq72BEEerqQuicoEQfzA== dependencies: meow "^4.0.0" - semver "^5.5.0" + semver "^6.0.0" git-up@^4.0.0: version "4.0.1" @@ -4632,32 +5053,29 @@ git-url-parse@^11.1.2: gitconfiglocal@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/gitconfiglocal/-/gitconfiglocal-1.0.0.tgz#41d045f3851a5ea88f03f24ca1c6178114464b9b" + integrity sha1-QdBF84UaXqiPA/JMocYXgRRGS5s= dependencies: ini "^1.3.2" -glob-base@^0.3.0: - version "0.3.0" - resolved "https://registry.yarnpkg.com/glob-base/-/glob-base-0.3.0.tgz#dbb164f6221b1c0b1ccf82aea328b497df0ea3c4" - dependencies: - glob-parent "^2.0.0" - is-glob "^2.0.0" - -glob-parent@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-2.0.0.tgz#81383d72db054fcccf5336daa902f182f6edbb28" - dependencies: - is-glob "^2.0.0" - -glob-parent@^3.0.1, glob-parent@^3.1.0: +glob-parent@^3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-3.1.0.tgz#9e6af6299d8d3bd2bd40430832bd113df906c5ae" + integrity sha1-nmr2KZ2NO9K9QEMIMr0RPfkGxa4= dependencies: is-glob "^3.1.0" path-dirname "^1.0.0" +glob-parent@^5.0.0, glob-parent@^5.1.0: + version "5.1.0" + resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-5.1.0.tgz#5f4c1d1e748d30cd73ad2944b3577a81b081e8c2" + integrity sha512-qjtRgnIVmOfnKUE3NJAQEdk+lKrxfw8t5ke7SXtfMTHcjsBfOfWXCQfdb30zfDoZQ2IRSIiidmjtbHZPZ++Ihw== + dependencies: + is-glob "^4.0.1" + glob-stream@^6.1.0: version "6.1.0" resolved "https://registry.yarnpkg.com/glob-stream/-/glob-stream-6.1.0.tgz#7045c99413b3eb94888d83ab46d0b404cc7bdde4" + integrity sha1-cEXJlBOz65SIjYOrRtC0BMx73eQ= dependencies: extend "^3.0.0" glob "^7.1.1" @@ -4673,6 +5091,7 @@ glob-stream@^6.1.0: glob-to-regexp@^0.3.0: version "0.3.0" resolved "https://registry.yarnpkg.com/glob-to-regexp/-/glob-to-regexp-0.3.0.tgz#8c5a1494d2066c570cc3bfe4496175acc4d502ab" + integrity sha1-jFoUlNIGbFcMw7/kSWF1rMTVAqs= glob-watcher@^5.0.3: version "5.0.3" @@ -4686,10 +5105,10 @@ glob-watcher@^5.0.3: just-debounce "^1.0.0" object.defaults "^1.1.0" -glob@^7.0.0, glob@^7.0.3, glob@^7.1.0, glob@^7.1.1, glob@^7.1.2, glob@^7.1.3: - version "7.1.3" - resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.3.tgz#3960832d3f1574108342dafd3a67b332c0969df1" - integrity sha512-vcfuiIxogLV4DlGBHIUOwI0IbrJ8HWPc4MU7HzviGeNho/UJDfi6B5p3sHeWIQ0KGIU0Jpxi5ZHxemQfLkkAwQ== +glob@^7.0.0, glob@^7.0.3, glob@^7.1.0, glob@^7.1.1, glob@^7.1.2, glob@^7.1.3, glob@^7.1.4, glob@^7.1.6: + version "7.1.6" + resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.6.tgz#141f33b81a7c2492e125594307480c46679278a6" + integrity sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA== dependencies: fs.realpath "^1.0.0" inflight "^1.0.4" @@ -4701,6 +5120,7 @@ glob@^7.0.0, glob@^7.0.3, glob@^7.1.0, glob@^7.1.1, glob@^7.1.2, glob@^7.1.3: global-modules@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/global-modules/-/global-modules-1.0.0.tgz#6d770f0eb523ac78164d72b5e71a8877265cc3ea" + integrity sha512-sKzpEkf11GpOFuw0Zzjzmt4B4UZwjOcG757PPvrfhxcLFbq0wpsgpOqxpxtxFiCG4DtG93M6XRVbF2oGdev7bg== dependencies: global-prefix "^1.0.1" is-windows "^1.0.1" @@ -4709,6 +5129,7 @@ global-modules@^1.0.0: global-prefix@^1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/global-prefix/-/global-prefix-1.0.2.tgz#dbf743c6c14992593c655568cb66ed32c0122ebe" + integrity sha1-2/dDxsFJklk8ZVVoy2btMsASLr4= dependencies: expand-tilde "^2.0.2" homedir-polyfill "^1.0.1" @@ -4716,51 +5137,67 @@ global-prefix@^1.0.1: is-windows "^1.0.1" which "^1.2.14" -globals@^11.1.0, globals@^11.7.0: - version "11.11.0" - resolved "https://registry.yarnpkg.com/globals/-/globals-11.11.0.tgz#dcf93757fa2de5486fbeed7118538adf789e9c2e" - integrity sha512-WHq43gS+6ufNOEqlrDBxVEbb8ntfXrfAUU2ZOpCxrBdGKW3gyv8mCxAfIBD0DroPKGrJ2eSsXsLtY9MPntsyTw== +globals@^11.1.0: + version "11.12.0" + resolved "https://registry.yarnpkg.com/globals/-/globals-11.12.0.tgz#ab8795338868a0babd8525758018c2a7eb95c42e" + integrity sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA== -globby@^6.1.0: - version "6.1.0" - resolved "https://registry.yarnpkg.com/globby/-/globby-6.1.0.tgz#f5a6d70e8395e21c858fb0489d64df02424d506c" +globals@^12.1.0: + version "12.3.0" + resolved "https://registry.yarnpkg.com/globals/-/globals-12.3.0.tgz#1e564ee5c4dded2ab098b0f88f24702a3c56be13" + integrity sha512-wAfjdLgFsPZsklLJvOBUBmzYE8/CwhEqSBEMRXA3qxIiNtyqvjYurAtIfDh6chlEPUfmTY3MnZh5Hfh4q0UlIw== dependencies: - array-union "^1.0.1" - glob "^7.0.3" - object-assign "^4.0.1" - pify "^2.0.0" - pinkie-promise "^2.0.0" + type-fest "^0.8.1" -globby@^8.0.1: - version "8.0.1" - resolved "https://registry.yarnpkg.com/globby/-/globby-8.0.1.tgz#b5ad48b8aa80b35b814fc1281ecc851f1d2b5b50" +globby@^10.0.1: + version "10.0.1" + resolved "https://registry.yarnpkg.com/globby/-/globby-10.0.1.tgz#4782c34cb75dd683351335c5829cc3420e606b22" + integrity sha512-sSs4inE1FB2YQiymcmTv6NWENryABjUNPeWhOvmn4SjtKybglsyPZxFB3U1/+L1bYi0rNZDqCLlHyLYDl1Pq5A== dependencies: - array-union "^1.0.1" - dir-glob "^2.0.0" - fast-glob "^2.0.2" - glob "^7.1.2" - ignore "^3.3.5" - pify "^3.0.0" - slash "^1.0.0" + "@types/glob" "^7.1.1" + array-union "^2.1.0" + dir-glob "^3.0.1" + fast-glob "^3.0.3" + glob "^7.1.3" + ignore "^5.1.1" + merge2 "^1.2.3" + slash "^3.0.0" + +globby@^9.2.0: + version "9.2.0" + resolved "https://registry.yarnpkg.com/globby/-/globby-9.2.0.tgz#fd029a706c703d29bdd170f4b6db3a3f7a7cb63d" + integrity sha512-ollPHROa5mcxDEkwg6bPt3QbEf4pDQSNtd6JPL1YvOvAo/7/0VAm9TccUeoTmarjPw4pfUthSCqcyfNB1I3ZSg== + dependencies: + "@types/glob" "^7.1.1" + array-union "^1.0.2" + dir-glob "^2.2.2" + fast-glob "^2.2.6" + glob "^7.1.3" + ignore "^4.0.3" + pify "^4.0.1" + slash "^2.0.0" glogg@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/glogg/-/glogg-1.0.1.tgz#dcf758e44789cc3f3d32c1f3562a3676e6a34810" + version "1.0.2" + resolved "https://registry.yarnpkg.com/glogg/-/glogg-1.0.2.tgz#2d7dd702beda22eb3bffadf880696da6d846313f" + integrity sha512-5mwUoSuBk44Y4EshyiqcH95ZntbDdTQqA3QYSrxmzj28Ai0vXBGMH1ApSANH14j2sIRtqCEyg6PfsuP7ElOEDA== dependencies: sparkles "^1.0.0" -graceful-fs@^4.0.0, graceful-fs@^4.1.11, graceful-fs@^4.1.15, graceful-fs@^4.1.2, graceful-fs@^4.1.6, graceful-fs@^4.1.9: - version "4.1.15" - resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.1.15.tgz#ffb703e1066e8a0eeaa4c8b80ba9253eeefbfb00" - integrity sha512-6uHUhOPEBgQ24HM+r6b/QwWfZq+yiFcipKFrOFiBEnWdy5sdzYoi+pJeQaPI5qOLRFqWmAXUPQNsielzdLoecA== +graceful-fs@^4.0.0, graceful-fs@^4.1.11, graceful-fs@^4.1.15, graceful-fs@^4.1.2, graceful-fs@^4.1.6, graceful-fs@^4.1.9, graceful-fs@^4.2.0, graceful-fs@^4.2.2: + version "4.2.3" + resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.3.tgz#4a12ff1b60376ef09862c2093edd908328be8423" + integrity sha512-a30VEBm4PEdx1dRB7MFK7BejejvCvBronbLjht+sHuGYj8PHs7M/5Z+rt5lw551vZ7yfTCj4Vuyy3mSJytDWRQ== growly@^1.3.0: version "1.3.0" resolved "https://registry.yarnpkg.com/growly/-/growly-1.3.0.tgz#f10748cbe76af964b7c96c93c6bcc28af120c081" + integrity sha1-8QdIy+dq+WS3yWyTxrzCivEgwIE= gulp-babel@^8.0.0: version "8.0.0" resolved "https://registry.yarnpkg.com/gulp-babel/-/gulp-babel-8.0.0.tgz#e0da96f4f2ec4a88dd3a3030f476e38ab2126d87" + integrity sha512-oomaIqDXxFkg7lbpBou/gnUkX51/Y/M2ZfSjL2hdqXTAlSWZcgZtd2o0cOH0r/eE8LWD0+Q/PsLsr2DKOoqToQ== dependencies: plugin-error "^1.0.1" replace-ext "^1.0.0" @@ -4794,6 +5231,7 @@ gulp-cli@^2.2.0: gulp-filter@^5.1.0: version "5.1.0" resolved "https://registry.yarnpkg.com/gulp-filter/-/gulp-filter-5.1.0.tgz#a05e11affb07cf7dcf41a7de1cb7b63ac3783e73" + integrity sha1-oF4Rr/sHz33PQafeHLe2OsN4PnM= dependencies: multimatch "^2.0.0" plugin-error "^0.1.2" @@ -4802,6 +5240,7 @@ gulp-filter@^5.1.0: gulp-newer@^1.0.0: version "1.4.0" resolved "https://registry.yarnpkg.com/gulp-newer/-/gulp-newer-1.4.0.tgz#25243ed6eac8f5462b95894e0d41937b112e65f3" + integrity sha512-h79fGO55S/P9eAADbLAP9aTtVYpLSR1ONj08VPaSdVVNVYhTS8p1CO1TW7kEMu+hC+sytmCqcUr5LesvZEtDoQ== dependencies: glob "^7.0.3" kew "^0.7.0" @@ -4810,49 +5249,13 @@ gulp-newer@^1.0.0: gulp-plumber@^1.2.1: version "1.2.1" resolved "https://registry.yarnpkg.com/gulp-plumber/-/gulp-plumber-1.2.1.tgz#d38700755a300b9d372318e4ffb5ff7ced0b2c84" + integrity sha512-mctAi9msEAG7XzW5ytDVZ9PxWMzzi1pS2rBH7lA095DhMa6KEXjm+St0GOCc567pJKJ/oCvosVAZEpAey0q2eQ== dependencies: chalk "^1.1.3" fancy-log "^1.3.2" plugin-error "^0.1.2" through2 "^2.0.3" -gulp-rename@^1.4.0: - version "1.4.0" - resolved "https://registry.yarnpkg.com/gulp-rename/-/gulp-rename-1.4.0.tgz#de1c718e7c4095ae861f7296ef4f3248648240bd" - -gulp-uglify@^3.0.2: - version "3.0.2" - resolved "https://registry.yarnpkg.com/gulp-uglify/-/gulp-uglify-3.0.2.tgz#5f5b2e8337f879ca9dec971feb1b82a5a87850b0" - integrity sha512-gk1dhB74AkV2kzqPMQBLA3jPoIAPd/nlNzP2XMDSG8XZrqnlCiDGAqC+rZOumzFvB5zOphlFh6yr3lgcAb/OOg== - dependencies: - array-each "^1.0.1" - extend-shallow "^3.0.2" - gulplog "^1.0.0" - has-gulplog "^0.1.0" - isobject "^3.0.1" - make-error-cause "^1.1.1" - safe-buffer "^5.1.2" - through2 "^2.0.0" - uglify-js "^3.0.5" - vinyl-sourcemaps-apply "^0.2.0" - -gulp-watch@^5.0.1: - version "5.0.1" - resolved "https://registry.yarnpkg.com/gulp-watch/-/gulp-watch-5.0.1.tgz#83d378752f5bfb46da023e73c17ed1da7066215d" - dependencies: - ansi-colors "1.1.0" - anymatch "^1.3.0" - chokidar "^2.0.0" - fancy-log "1.3.2" - glob-parent "^3.0.1" - object-assign "^4.1.0" - path-is-absolute "^1.0.1" - plugin-error "1.0.1" - readable-stream "^2.2.2" - slash "^1.0.0" - vinyl "^2.1.0" - vinyl-file "^2.0.0" - gulp@^4.0.2: version "4.0.2" resolved "https://registry.yarnpkg.com/gulp/-/gulp-4.0.2.tgz#543651070fd0f6ab0a0650c6a3e6ff5a7cb09caa" @@ -4866,27 +5269,30 @@ gulp@^4.0.2: gulplog@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/gulplog/-/gulplog-1.0.0.tgz#e28c4d45d05ecbbed818363ce8f9c5926229ffe5" + integrity sha1-4oxNRdBey77YGDY86PnFkmIp/+U= dependencies: glogg "^1.0.0" -handlebars@^4.1.0: - version "4.1.0" - resolved "https://registry.yarnpkg.com/handlebars/-/handlebars-4.1.0.tgz#0d6a6f34ff1f63cecec8423aa4169827bf787c3a" - integrity sha512-l2jRuU1NAWK6AW5qqcTATWQJvNPEwkM7NEKSiv/gqOsoSQbVoWyqVEY5GS+XPQ88zLNmqASRpzfdm8d79hJS+w== +handlebars@^4.1.2, handlebars@^4.4.0: + version "4.7.4" + resolved "https://registry.yarnpkg.com/handlebars/-/handlebars-4.7.4.tgz#902c579cc97b350bb4bc12e6cabd85b57dcd9975" + integrity sha512-Is8+SzHv8K9STNadlBVpVhxXrSXxVgTyIvhdg2Qjak1SfSZ7iEozLHdwiX1jJ9lLFkcFJxqGK5s/cI7ZX+qGkQ== dependencies: - async "^2.5.0" - optimist "^0.6.1" + neo-async "^2.6.0" source-map "^0.6.1" + yargs "^15.3.1" optionalDependencies: uglify-js "^3.1.4" har-schema@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/har-schema/-/har-schema-2.0.0.tgz#a94c2224ebcac04782a0d9035521f24735b7ec92" + integrity sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI= har-validator@~5.1.0: version "5.1.3" resolved "https://registry.yarnpkg.com/har-validator/-/har-validator-5.1.3.tgz#1ef89ebd3e4996557675eed9893110dc350fa080" + integrity sha512-sNvOCzEQNr/qrvJgc3UG/kD4QtlHycrzwS+6mfTrrSq97BvaYcPZZI1ZSqGSPR73Cxn4LKTD4PttRwfU7jWq5g== dependencies: ajv "^6.5.5" har-schema "^2.0.0" @@ -4894,34 +5300,29 @@ har-validator@~5.1.0: has-ansi@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/has-ansi/-/has-ansi-2.0.0.tgz#34f5049ce1ecdf2b0649af3ef24e45ed35416d91" + integrity sha1-NPUEnOHs3ysGSa8+8k5F7TVBbZE= dependencies: ansi-regex "^2.0.0" -has-flag@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-2.0.0.tgz#e8207af1cc7b30d446cc70b734b5e8be18f88d51" - has-flag@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-3.0.0.tgz#b5d454dc2199ae225699f3467e5a07f3b955bafd" + integrity sha1-tdRU3CGZriJWmfNGfloH87lVuv0= -has-gulplog@^0.1.0: - version "0.1.0" - resolved "https://registry.yarnpkg.com/has-gulplog/-/has-gulplog-0.1.0.tgz#6414c82913697da51590397dafb12f22967811ce" - dependencies: - sparkles "^1.0.0" - -has-symbols@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/has-symbols/-/has-symbols-1.0.0.tgz#ba1a8f1af2a0fc39650f5c850367704122063b44" +has-symbols@^1.0.0, has-symbols@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/has-symbols/-/has-symbols-1.0.1.tgz#9f5214758a44196c406d9bd76cebf81ec2dd31e8" + integrity sha512-PLcsoqu++dmEIZB+6totNFKq/7Do+Z0u4oT0zKOJNl3lYK6vGwwu2hjHs+68OEZbTjiUE9bgOABXbP/GvrS0Kg== has-unicode@^2.0.0, has-unicode@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/has-unicode/-/has-unicode-2.0.1.tgz#e0e6fe6a28cf51138855e086d1691e771de2a8b9" + integrity sha1-4Ob+aijPUROIVeCG0Wkedx3iqLk= has-value@^0.3.1: version "0.3.1" resolved "https://registry.yarnpkg.com/has-value/-/has-value-0.3.1.tgz#7b1f58bada62ca827ec0a2078025654845995e1f" + integrity sha1-ex9YutpiyoJ+wKIHgCVlSEWZXh8= dependencies: get-value "^2.0.3" has-values "^0.1.4" @@ -4930,6 +5331,7 @@ has-value@^0.3.1: has-value@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/has-value/-/has-value-1.0.0.tgz#18b281da585b1c5c51def24c930ed29a0be6b177" + integrity sha1-GLKB2lhbHFxR3vJMkw7SmgvmsXc= dependencies: get-value "^2.0.6" has-values "^1.0.0" @@ -4938,10 +5340,12 @@ has-value@^1.0.0: has-values@^0.1.4: version "0.1.4" resolved "https://registry.yarnpkg.com/has-values/-/has-values-0.1.4.tgz#6d61de95d91dfca9b9a02089ad384bff8f62b771" + integrity sha1-bWHeldkd/Km5oCCJrThL/49it3E= has-values@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/has-values/-/has-values-1.0.0.tgz#95b0b63fec2146619a6fe57fe75628d5a39efe4f" + integrity sha1-lbC2P+whRmGab+V/51Yo1aOe/k8= dependencies: is-number "^3.0.0" kind-of "^4.0.0" @@ -4953,99 +5357,64 @@ has@^1.0.0, has@^1.0.1, has@^1.0.3: dependencies: function-bind "^1.1.1" -hash-base@^2.0.0: - version "2.0.2" - resolved "https://registry.yarnpkg.com/hash-base/-/hash-base-2.0.2.tgz#66ea1d856db4e8a5470cadf6fce23ae5244ef2e1" - dependencies: - inherits "^2.0.1" - hash-base@^3.0.0: version "3.0.4" resolved "https://registry.yarnpkg.com/hash-base/-/hash-base-3.0.4.tgz#5fc8686847ecd73499403319a6b0a3f3f6ae4918" + integrity sha1-X8hoaEfs1zSZQDMZprCj8/auSRg= dependencies: inherits "^2.0.1" safe-buffer "^5.0.1" hash.js@^1.0.0, hash.js@^1.0.3: - version "1.1.3" - resolved "https://registry.yarnpkg.com/hash.js/-/hash.js-1.1.3.tgz#340dedbe6290187151c1ea1d777a3448935df846" + version "1.1.7" + resolved "https://registry.yarnpkg.com/hash.js/-/hash.js-1.1.7.tgz#0babca538e8d4ee4a0f8988d68866537a003cf42" + integrity sha512-taOaskGt4z4SOANNseOviYDvjEJinIkRgmp7LbKP2YTTmVxWBl87s/uzK9r+44BclBSp2X7K1hqeNfz9JbBeXA== dependencies: inherits "^2.0.3" - minimalistic-assert "^1.0.0" - -he@1.1.x: - version "1.1.1" - resolved "https://registry.yarnpkg.com/he/-/he-1.1.1.tgz#93410fd21b009735151f8868c2f271f3427e23fd" + minimalistic-assert "^1.0.1" hmac-drbg@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/hmac-drbg/-/hmac-drbg-1.0.1.tgz#d2745701025a6c775a6c545793ed502fc0c649a1" + integrity sha1-0nRXAQJabHdabFRXk+1QL8DGSaE= dependencies: hash.js "^1.0.3" minimalistic-assert "^1.0.0" minimalistic-crypto-utils "^1.0.1" homedir-polyfill@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/homedir-polyfill/-/homedir-polyfill-1.0.1.tgz#4c2bbc8a758998feebf5ed68580f76d46768b4bc" + version "1.0.3" + resolved "https://registry.yarnpkg.com/homedir-polyfill/-/homedir-polyfill-1.0.3.tgz#743298cef4e5af3e194161fbadcc2151d3a058e8" + integrity sha512-eSmmWE5bZTK2Nou4g0AI3zZ9rswp7GRKoKXS1BLUkvPviOqs4YTN1djQIqrXy9k5gEtdLPy86JjRwsNM9tnDcA== dependencies: parse-passwd "^1.0.0" -hosted-git-info@^2.1.4, hosted-git-info@^2.6.0: - version "2.7.1" - resolved "https://registry.yarnpkg.com/hosted-git-info/-/hosted-git-info-2.7.1.tgz#97f236977bd6e125408930ff6de3eec6281ec047" +hosted-git-info@^2.1.4, hosted-git-info@^2.7.1: + version "2.8.5" + resolved "https://registry.yarnpkg.com/hosted-git-info/-/hosted-git-info-2.8.5.tgz#759cfcf2c4d156ade59b0b2dfabddc42a6b9c70c" + integrity sha512-kssjab8CvdXfcXMXVcvsXum4Hwdq9XGtRD3TteMEvEbq0LXyiNQr6AprqKqfeaDXze7SxWvRxdpwE6ku7ikLkg== html-encoding-sniffer@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/html-encoding-sniffer/-/html-encoding-sniffer-1.0.2.tgz#e70d84b94da53aa375e11fe3a351be6642ca46f8" + integrity sha512-71lZziiDnsuabfdYiUeWdCVyKuqwWi23L8YeIgV9jSSZHCtb6wB1BKWooH7L3tn4/FuZJMVWyNaIDr4RGmaSYw== dependencies: whatwg-encoding "^1.0.1" -html-loader@^0.4.5: - version "0.4.5" - resolved "https://registry.yarnpkg.com/html-loader/-/html-loader-0.4.5.tgz#5fbcd87cd63a5c49a7fce2fe56f425e05729c68c" - dependencies: - es6-templates "^0.2.2" - fastparse "^1.1.1" - html-minifier "^3.0.1" - loader-utils "^1.0.2" - object-assign "^4.1.0" - -html-minifier@^3.0.1: - version "3.5.10" - resolved "https://registry.yarnpkg.com/html-minifier/-/html-minifier-3.5.10.tgz#8522c772c388db81aa5c26f62033302d906ea1c7" - dependencies: - camel-case "3.0.x" - clean-css "4.1.x" - commander "2.14.x" - he "1.1.x" - ncname "1.0.x" - param-case "2.1.x" - relateurl "0.2.x" - uglify-js "3.3.x" - htmlescape@^1.1.0: version "1.1.1" resolved "https://registry.yarnpkg.com/htmlescape/-/htmlescape-1.1.1.tgz#3a03edc2214bca3b66424a3e7959349509cb0351" - -htmlparser2@^3.9.1: - version "3.9.2" - resolved "https://registry.yarnpkg.com/htmlparser2/-/htmlparser2-3.9.2.tgz#1bdf87acca0f3f9e53fa4fcceb0f4b4cbb00b338" - dependencies: - domelementtype "^1.3.0" - domhandler "^2.3.0" - domutils "^1.5.1" - entities "^1.1.1" - inherits "^2.0.1" - readable-stream "^2.0.2" + integrity sha1-OgPtwiFLyjtmQko+eVk0lQnLA1E= http-cache-semantics@^3.8.1: version "3.8.1" resolved "https://registry.yarnpkg.com/http-cache-semantics/-/http-cache-semantics-3.8.1.tgz#39b0e16add9b605bf0a9ef3d9daaf4843b4cacd2" + integrity sha512-5ai2iksyV8ZXmnZhHH4rWPoxxistEexSi5936zIQ1bnNTW5VnA85B6P/VpXiRM017IgRvb2kKo1a//y+0wSp3w== http-proxy-agent@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/http-proxy-agent/-/http-proxy-agent-2.1.0.tgz#e4821beef5b2142a2026bd73926fe537631c5405" + integrity sha512-qwHbBLV7WviBl0rQsOzH6o5lwyOIvwp/BdFnvVxXORldu5TmjFfjzBcWUWS5kWAZhmv+JtiDhSuQCp4sBfbIgg== dependencies: agent-base "4" debug "3.1.0" @@ -5053,6 +5422,7 @@ http-proxy-agent@^2.1.0: http-signature@~1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/http-signature/-/http-signature-1.2.0.tgz#9aecd925114772f3d95b65a60abb8f7c18fbace1" + integrity sha1-muzZJRFHcvPZW2WmCruPfBj7rOE= dependencies: assert-plus "^1.0.0" jsprim "^1.2.2" @@ -5061,92 +5431,99 @@ http-signature@~1.2.0: https-browserify@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/https-browserify/-/https-browserify-1.0.0.tgz#ec06c10e0a34c0f2faf199f7fd7fc78fffd03c73" + integrity sha1-7AbBDgo0wPL68Zn3/X/Hj//QPHM= -https-proxy-agent@^2.2.1: - version "2.2.1" - resolved "https://registry.yarnpkg.com/https-proxy-agent/-/https-proxy-agent-2.2.1.tgz#51552970fa04d723e04c56d04178c3f92592bbc0" +https-proxy-agent@^2.2.3: + version "2.2.4" + resolved "https://registry.yarnpkg.com/https-proxy-agent/-/https-proxy-agent-2.2.4.tgz#4ee7a737abd92678a293d9b34a1af4d0d08c787b" + integrity sha512-OmvfoQ53WLjtA9HeYP9RNrWMJzzAz1JGaSFr1nijg0PVR1JaD/xbJq1mdEIIlxGpXp9eSe/O2LgU9DJmTPd0Eg== dependencies: - agent-base "^4.1.0" + agent-base "^4.3.0" debug "^3.1.0" humanize-ms@^1.2.1: version "1.2.1" resolved "https://registry.yarnpkg.com/humanize-ms/-/humanize-ms-1.2.1.tgz#c46e3159a293f6b896da29316d8b6fe8bb79bbed" + integrity sha1-xG4xWaKT9riW2ikxbYtv6Lt5u+0= dependencies: ms "^2.0.0" -husky@^2.3.0: - version "2.3.0" - resolved "https://registry.yarnpkg.com/husky/-/husky-2.3.0.tgz#8b78ed24d763042df7fd899991985d65a976dd13" - integrity sha512-A/ZQSEILoq+mQM3yC3RIBSaw1bYXdkKnyyKVSUiJl+iBjVZc5LQEXdGY1ZjrDxC4IzfRPiJ0IqzEQGCN5TQa/A== +husky@^3.0.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/husky/-/husky-3.1.0.tgz#5faad520ab860582ed94f0c1a77f0f04c90b57c0" + integrity sha512-FJkPoHHB+6s4a+jwPqBudBDvYZsoQW5/HBuMSehC8qDiCe50kpcxeqFoDSlow+9I6wg47YxBoT3WxaURlrDIIQ== dependencies: - cosmiconfig "^5.2.0" + chalk "^2.4.2" + ci-info "^2.0.0" + cosmiconfig "^5.2.1" execa "^1.0.0" - find-up "^3.0.0" get-stdin "^7.0.0" - is-ci "^2.0.0" - pkg-dir "^4.1.0" - please-upgrade-node "^3.1.1" - read-pkg "^5.1.1" + opencollective-postinstall "^2.0.2" + pkg-dir "^4.2.0" + please-upgrade-node "^3.2.0" + read-pkg "^5.2.0" run-node "^1.0.0" slash "^3.0.0" -iconv-lite@0.4.19: - version "0.4.19" - resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.19.tgz#f7468f60135f5e5dad3399c0a81be9a1603a082b" - -iconv-lite@^0.4.24, iconv-lite@^0.4.4, iconv-lite@~0.4.13: +iconv-lite@0.4.24, iconv-lite@^0.4.24, iconv-lite@^0.4.4, iconv-lite@~0.4.13: version "0.4.24" resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.24.tgz#2022b4b25fbddc21d2f524974a474aafe733908b" + integrity sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA== dependencies: safer-buffer ">= 2.1.2 < 3" +idb-wrapper@^1.5.0: + version "1.7.2" + resolved "https://registry.yarnpkg.com/idb-wrapper/-/idb-wrapper-1.7.2.tgz#8251afd5e77fe95568b1c16152eb44b396767ea2" + integrity sha512-zfNREywMuf0NzDo9mVsL0yegjsirJxHpKHvWcyRozIqQy89g0a3U+oBPOCN4cc0oCiOuYgZHimzaW/R46G1Mpg== + ieee754@^1.1.4: - version "1.1.8" - resolved "https://registry.yarnpkg.com/ieee754/-/ieee754-1.1.8.tgz#be33d40ac10ef1926701f6f08a2d86fbfd1ad3e4" + version "1.1.13" + resolved "https://registry.yarnpkg.com/ieee754/-/ieee754-1.1.13.tgz#ec168558e95aa181fd87d37f55c32bbcb6708b84" + integrity sha512-4vf7I2LYV/HaWerSo3XmlMkp5eZ83i+/CDluXi/IGTs/O1sejBNhTtnxzmRZfvOUqj7lZjqHkeTvpgSFDlWZTg== iferr@^0.1.5: version "0.1.5" resolved "https://registry.yarnpkg.com/iferr/-/iferr-0.1.5.tgz#c60eed69e6d8fdb6b3104a1fcbca1c192dc5b501" + integrity sha1-xg7taebY/bazEEofy8ocGS3FtQE= ignore-walk@^3.0.1: - version "3.0.1" - resolved "https://registry.yarnpkg.com/ignore-walk/-/ignore-walk-3.0.1.tgz#a83e62e7d272ac0e3b551aaa82831a19b69f82f8" + version "3.0.3" + resolved "https://registry.yarnpkg.com/ignore-walk/-/ignore-walk-3.0.3.tgz#017e2447184bfeade7c238e4aefdd1e8f95b1e37" + integrity sha512-m7o6xuOaT1aqheYHKf8W6J5pYH85ZI9w077erOzLje3JsB1gkafkAhHHY19dqjulgIZHFm32Cp5uNZgcQqdJKw== dependencies: minimatch "^3.0.4" -ignore@^3.3.5: - version "3.3.10" - resolved "https://registry.yarnpkg.com/ignore/-/ignore-3.3.10.tgz#0a97fb876986e8081c631160f8f9f389157f0043" - -ignore@^4.0.6: +ignore@^4.0.3, ignore@^4.0.6: version "4.0.6" resolved "https://registry.yarnpkg.com/ignore/-/ignore-4.0.6.tgz#750e3db5862087b4737ebac8207ffd1ef27b25fc" + integrity sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg== + +ignore@^5.1.1: + version "5.1.4" + resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.1.4.tgz#84b7b3dbe64552b6ef0eca99f6743dbec6d97adf" + integrity sha512-MzbUSahkTW1u7JpKKjY7LCARd1fU5W2rLdxlM4kdkayuCwZImjkpluF9CM1aLewYJguPDqewLam18Y6AU69A8A== import-fresh@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/import-fresh/-/import-fresh-2.0.0.tgz#d81355c15612d386c61f9ddd3922d4304822a546" + integrity sha1-2BNVwVYS04bGH53dOSLUMEgipUY= dependencies: caller-path "^2.0.0" resolve-from "^3.0.0" import-fresh@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/import-fresh/-/import-fresh-3.0.0.tgz#a3d897f420cab0e671236897f75bc14b4885c390" + version "3.2.1" + resolved "https://registry.yarnpkg.com/import-fresh/-/import-fresh-3.2.1.tgz#633ff618506e793af5ac91bf48b72677e15cbe66" + integrity sha512-6e1q1cnWP2RXD9/keSkxHScg508CdXqXWgWBaETNhyuBFz+kUZlKboh+ISK+bU++DmbHimVBrOz/zzPe0sZ3sQ== dependencies: parent-module "^1.0.0" resolve-from "^4.0.0" -import-local@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/import-local/-/import-local-1.0.0.tgz#5e4ffdc03f4fe6c009c6729beb29631c2f8227bc" - dependencies: - pkg-dir "^2.0.0" - resolve-cwd "^2.0.0" - import-local@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/import-local/-/import-local-2.0.0.tgz#55070be38a5993cf18ef6db7e961f5bee5c5a09d" + integrity sha512-b6s04m3O+s3CGSbqDIyP4R6aAwAeYlVq9+WUWep6iHa8ETRf9yei1U48C5MmfJmV9AiLYYBKPMq/W+/WRpQmCQ== dependencies: pkg-dir "^3.0.0" resolve-cwd "^2.0.0" @@ -5154,43 +5531,67 @@ import-local@^2.0.0: imurmurhash@^0.1.4: version "0.1.4" resolved "https://registry.yarnpkg.com/imurmurhash/-/imurmurhash-0.1.4.tgz#9218b9b2b928a238b13dc4fb6b6d576f231453ea" + integrity sha1-khi5srkoojixPcT7a21XbyMUU+o= indent-string@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/indent-string/-/indent-string-2.1.0.tgz#8e2d48348742121b4a8218b7a137e9a52049dc80" + integrity sha1-ji1INIdCEhtKghi3oTfppSBJ3IA= dependencies: repeating "^2.0.0" indent-string@^3.0.0: version "3.2.0" resolved "https://registry.yarnpkg.com/indent-string/-/indent-string-3.2.0.tgz#4a5fd6d27cc332f37e5419a504dbb837105c9289" + integrity sha1-Sl/W0nzDMvN+VBmlBNu4NxBckok= + +indent-string@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/indent-string/-/indent-string-4.0.0.tgz#624f8f4497d619b2d9768531d58f4122854d7251" + integrity sha512-EdDDZu4A2OyIK7Lr/2zG+w5jmbuk1DVBnEwREQvBzspBJkCEbRa8GxU1lghYcaGJCnRWibjDXlq779X1/y5xwg== -indexof@0.0.1: +indexof@~0.0.1: version "0.0.1" resolved "https://registry.yarnpkg.com/indexof/-/indexof-0.0.1.tgz#82dc336d232b9062179d05ab3293a66059fd435d" + integrity sha1-gtwzbSMrkGIXnQWrMpOmYFn9Q10= + +infer-owner@^1.0.3, infer-owner@^1.0.4: + version "1.0.4" + resolved "https://registry.yarnpkg.com/infer-owner/-/infer-owner-1.0.4.tgz#c4cefcaa8e51051c2a40ba2ce8a3d27295af9467" + integrity sha512-IClj+Xz94+d7irH5qRyfJonOdfTzuDaifE6ZPWfx0N0+/ATZCbuTPq2prFl526urkQd90WyUKIh1DfBQ2hMz9A== inflight@^1.0.4: version "1.0.6" resolved "https://registry.yarnpkg.com/inflight/-/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9" + integrity sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk= dependencies: once "^1.3.0" wrappy "1" inherits@2, inherits@^2.0.1, inherits@^2.0.3, inherits@~2.0.1, inherits@~2.0.3: - version "2.0.3" - resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.3.tgz#633c2c83e3da42a502f52466022480f4208261de" + version "2.0.4" + resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c" + integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ== inherits@2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.1.tgz#b17d08d326b4423e568eff719f91b0b1cbdf69f1" + integrity sha1-sX0I0ya0Qj5Wjv9xn5GwscvfafE= + +inherits@2.0.3: + version "2.0.3" + resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.3.tgz#633c2c83e3da42a502f52466022480f4208261de" + integrity sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4= ini@^1.3.2, ini@^1.3.4, ini@~1.3.0: version "1.3.5" resolved "https://registry.yarnpkg.com/ini/-/ini-1.3.5.tgz#eee25f56db1c9ec6085e0c22778083f596abf927" + integrity sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw== init-package-json@^1.10.3: version "1.10.3" resolved "https://registry.yarnpkg.com/init-package-json/-/init-package-json-1.10.3.tgz#45ffe2f610a8ca134f2bd1db5637b235070f6cbe" + integrity sha512-zKSiXKhQveNteyhcj1CoOP8tqp1QuxPIPBl8Bid99DGLFqA1p87M6lNgfjJHSBoWJJlidGOv5rWjyYKEB3g2Jw== dependencies: glob "^7.1.1" npm-package-arg "^4.0.0 || ^5.0.0 || ^6.0.0" @@ -5204,19 +5605,21 @@ init-package-json@^1.10.3: inline-source-map@~0.5.0: version "0.5.0" resolved "https://registry.yarnpkg.com/inline-source-map/-/inline-source-map-0.5.0.tgz#4a4c5dd8e4fb5e9b3cda60c822dfadcaee66e0af" + integrity sha1-Skxd2OT7Xps82mDIIt+tyu5m4K8= dependencies: source-map "~0.4.0" inline-source-map@~0.6.0: version "0.6.2" resolved "https://registry.yarnpkg.com/inline-source-map/-/inline-source-map-0.6.2.tgz#f9393471c18a79d1724f863fa38b586370ade2a5" + integrity sha1-+Tk0ccGKedFyT4Y/o4tYY3Ct4qU= dependencies: source-map "~0.5.3" -inquirer@^6.2.0, inquirer@^6.2.2: - version "6.2.2" - resolved "https://registry.yarnpkg.com/inquirer/-/inquirer-6.2.2.tgz#46941176f65c9eb20804627149b743a218f25406" - integrity sha512-Z2rREiXA6cHRR9KBOarR3WuLlFzlIfAEIiB45ll5SSadMg7WqOh1MKEjjndfuH5ewXdixWCxqnVfGOQzPeiztA== +inquirer@^6.2.0: + version "6.5.2" + resolved "https://registry.yarnpkg.com/inquirer/-/inquirer-6.5.2.tgz#ad50942375d036d327ff528c08bd5fab089928ca" + integrity sha512-cntlB5ghuB0iuO65Ovoi8ogLHiWGs/5yNrtUcKjFhSSiVeAIVpD7koaSU9RM8mpXw5YDi9RdYXGQMaOURB7ycQ== dependencies: ansi-escapes "^3.2.0" chalk "^2.4.2" @@ -5224,52 +5627,75 @@ inquirer@^6.2.0, inquirer@^6.2.2: cli-width "^2.0.0" external-editor "^3.0.3" figures "^2.0.0" - lodash "^4.17.11" + lodash "^4.17.12" mute-stream "0.0.7" run-async "^2.2.0" rxjs "^6.4.0" string-width "^2.1.0" - strip-ansi "^5.0.0" + strip-ansi "^5.1.0" + through "^2.3.6" + +inquirer@^7.0.0: + version "7.0.0" + resolved "https://registry.yarnpkg.com/inquirer/-/inquirer-7.0.0.tgz#9e2b032dde77da1db5db804758b8fea3a970519a" + integrity sha512-rSdC7zelHdRQFkWnhsMu2+2SO41mpv2oF2zy4tMhmiLWkcKbOAs87fWAJhVXttKVwhdZvymvnuM95EyEXg2/tQ== + dependencies: + ansi-escapes "^4.2.1" + chalk "^2.4.2" + cli-cursor "^3.1.0" + cli-width "^2.0.0" + external-editor "^3.0.3" + figures "^3.0.0" + lodash "^4.17.15" + mute-stream "0.0.8" + run-async "^2.2.0" + rxjs "^6.4.0" + string-width "^4.1.0" + strip-ansi "^5.1.0" through "^2.3.6" insert-module-globals@^7.0.0: - version "7.0.2" - resolved "https://registry.yarnpkg.com/insert-module-globals/-/insert-module-globals-7.0.2.tgz#012c56baa7d3307a8b417d4ec5270cf9741c18f4" + version "7.2.0" + resolved "https://registry.yarnpkg.com/insert-module-globals/-/insert-module-globals-7.2.0.tgz#ec87e5b42728479e327bd5c5c71611ddfb4752ba" + integrity sha512-VE6NlW+WGn2/AeOMd496AHFYmE7eLKkUY6Ty31k4og5vmA3Fjuwe9v6ifH6Xx/Hz27QvdoMoviw1/pqWRB09Sw== dependencies: JSONStream "^1.0.3" - combine-source-map "~0.7.1" - concat-stream "~1.5.1" + acorn-node "^1.5.2" + combine-source-map "^0.8.0" + concat-stream "^1.6.1" is-buffer "^1.1.0" - lexical-scope "^1.2.0" + path-is-absolute "^1.0.1" process "~0.11.0" through2 "^2.0.0" + undeclared-identifiers "^1.1.2" xtend "^4.0.0" -interpret@^1.0.0, interpret@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/interpret/-/interpret-1.1.0.tgz#7ed1b1410c6a0e0f78cf95d3b8440c63f78b8614" +interpret@^1.1.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/interpret/-/interpret-1.2.0.tgz#d5061a6224be58e8083985f5014d844359576296" + integrity sha512-mT34yGKMNceBQUoVn7iCDKDntA7SC6gycMAWzGx1z/CMCTV7b2AAtXlo3nRyHZ1FelRkQbQjprHSYGwzLtkVbw== invariant@^2.2.2, invariant@^2.2.4: version "2.2.4" resolved "https://registry.yarnpkg.com/invariant/-/invariant-2.2.4.tgz#610f3c92c9359ce1db616e538008d23ff35158e6" + integrity sha512-phJfQVBuaJM5raOpJjSfkiD6BpbCE4Ns//LaXl6wGYtUBY83nWS6Rf9tXm2e8VaK60JEjYldbPif/A2B1C2gNA== dependencies: loose-envify "^1.0.0" invert-kv@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/invert-kv/-/invert-kv-1.0.0.tgz#104a8e4aaca6d3d8cd157a8ef8bfab2d7a3ffdb6" + integrity sha1-EEqOSqym09jNFXqO+L+rLXo//bY= -invert-kv@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/invert-kv/-/invert-kv-2.0.0.tgz#7393f5afa59ec9ff5f67a27620d11c226e3eec02" - -ip@^1.1.5: +ip@1.1.5: version "1.1.5" resolved "https://registry.yarnpkg.com/ip/-/ip-1.1.5.tgz#bdded70114290828c0a039e72ef25f5aaec4354a" + integrity sha1-vd7XARQpCCjAoDnnLvJfWq7ENUo= is-absolute@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/is-absolute/-/is-absolute-1.0.0.tgz#395e1ae84b11f26ad1795e73c17378e48a301576" + integrity sha512-dOWoqflvcydARa360Gvv18DZ/gRuHKi2NU/wU5X1ZFzdYfH29nkiNZsF3mp4OJ3H4yo9Mx8A/uAGNzpzPN3yBA== dependencies: is-relative "^1.0.0" is-windows "^1.0.1" @@ -5277,65 +5703,69 @@ is-absolute@^1.0.0: is-accessor-descriptor@^0.1.6: version "0.1.6" resolved "https://registry.yarnpkg.com/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz#a9e12cb3ae8d876727eeef3843f8a0897b5c98d6" + integrity sha1-qeEss66Nh2cn7u84Q/igiXtcmNY= dependencies: kind-of "^3.0.2" is-accessor-descriptor@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz#169c2f6d3df1f992618072365c9b0ea1f6878656" + integrity sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ== dependencies: kind-of "^6.0.0" is-arrayish@^0.2.1: version "0.2.1" resolved "https://registry.yarnpkg.com/is-arrayish/-/is-arrayish-0.2.1.tgz#77c99840527aa8ecb1a8ba697b80645a7a926a9d" + integrity sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0= is-binary-path@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/is-binary-path/-/is-binary-path-1.0.1.tgz#75f16642b480f187a711c814161fd3a4a7655898" + integrity sha1-dfFmQrSA8YenEcgUFh/TpKdlWJg= dependencies: binary-extensions "^1.0.0" is-buffer@^1.1.0, is-buffer@^1.1.5: version "1.1.6" resolved "https://registry.yarnpkg.com/is-buffer/-/is-buffer-1.1.6.tgz#efaa2ea9daa0d7ab2ea13a97b2b8ad51fefbe8be" + integrity sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w== is-callable@^1.1.4: version "1.1.4" resolved "https://registry.yarnpkg.com/is-callable/-/is-callable-1.1.4.tgz#1e1adf219e1eeb684d691f9d6a05ff0d30a24d75" integrity sha512-r5p9sxJjYnArLjObpjA4xu5EKI3CuKHkJXMhT7kwbpUyIFD1n5PMAsoPvWnvtZiNz7LjkYDRZhd7FlI0eMijEA== -is-ci@^1.0.10: - version "1.1.0" - resolved "https://registry.yarnpkg.com/is-ci/-/is-ci-1.1.0.tgz#247e4162e7860cebbdaf30b774d6b0ac7dcfe7a5" - dependencies: - ci-info "^1.0.0" - is-ci@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/is-ci/-/is-ci-2.0.0.tgz#6bc6334181810e04b5c22b3d589fdca55026404c" + integrity sha512-YfJT7rkpQB0updsdHLGWrvhBJfcfzNNawYDNIyQXJz0IViGf75O8EBPKSdvw2rF+LGCsX4FZ8tcr3b19LcZq4w== dependencies: ci-info "^2.0.0" is-data-descriptor@^0.1.4: version "0.1.4" resolved "https://registry.yarnpkg.com/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz#0b5ee648388e2c860282e793f1856fec3f301b56" + integrity sha1-C17mSDiOLIYCgueT8YVv7D8wG1Y= dependencies: kind-of "^3.0.2" is-data-descriptor@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz#d84876321d0e7add03990406abbbbd36ba9268c7" + integrity sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ== dependencies: kind-of "^6.0.0" is-date-object@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/is-date-object/-/is-date-object-1.0.1.tgz#9aa20eb6aeebbff77fbd33e74ca01b33581d3a16" + integrity sha1-mqIOtq7rv/d/vTPnTKAbM1gdOhY= is-descriptor@^0.1.0: version "0.1.6" resolved "https://registry.yarnpkg.com/is-descriptor/-/is-descriptor-0.1.6.tgz#366d8240dde487ca51823b1ab9f07a10a78251ca" + integrity sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg== dependencies: is-accessor-descriptor "^0.1.6" is-data-descriptor "^0.1.4" @@ -5344,6 +5774,7 @@ is-descriptor@^0.1.0: is-descriptor@^1.0.0, is-descriptor@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/is-descriptor/-/is-descriptor-1.0.2.tgz#3b159746a66604b04f8c81524ba365c5f14d86ec" + integrity sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg== dependencies: is-accessor-descriptor "^1.0.0" is-data-descriptor "^1.0.0" @@ -5352,136 +5783,131 @@ is-descriptor@^1.0.0, is-descriptor@^1.0.2: is-directory@^0.3.1: version "0.3.1" resolved "https://registry.yarnpkg.com/is-directory/-/is-directory-0.3.1.tgz#61339b6f2475fc772fd9c9d83f5c8575dc154ae1" - -is-dotfile@^1.0.0: - version "1.0.3" - resolved "https://registry.yarnpkg.com/is-dotfile/-/is-dotfile-1.0.3.tgz#a6a2f32ffd2dfb04f5ca25ecd0f6b83cf798a1e1" - -is-equal-shallow@^0.1.3: - version "0.1.3" - resolved "https://registry.yarnpkg.com/is-equal-shallow/-/is-equal-shallow-0.1.3.tgz#2238098fc221de0bcfa5d9eac4c45d638aa1c534" - dependencies: - is-primitive "^2.0.0" + integrity sha1-YTObbyR1/Hcv2cnYP1yFddwVSuE= is-extendable@^0.1.0, is-extendable@^0.1.1: version "0.1.1" resolved "https://registry.yarnpkg.com/is-extendable/-/is-extendable-0.1.1.tgz#62b110e289a471418e3ec36a617d472e301dfc89" + integrity sha1-YrEQ4omkcUGOPsNqYX1HLjAd/Ik= is-extendable@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/is-extendable/-/is-extendable-1.0.1.tgz#a7470f9e426733d81bd81e1155264e3a3507cab4" + integrity sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA== dependencies: is-plain-object "^2.0.4" -is-extglob@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/is-extglob/-/is-extglob-1.0.0.tgz#ac468177c4943405a092fc8f29760c6ffc6206c0" - is-extglob@^2.1.0, is-extglob@^2.1.1: version "2.1.1" resolved "https://registry.yarnpkg.com/is-extglob/-/is-extglob-2.1.1.tgz#a88c02535791f02ed37c76a1b9ea9773c833f8c2" + integrity sha1-qIwCU1eR8C7TfHahueqXc8gz+MI= is-finite@^1.0.0: version "1.0.2" resolved "https://registry.yarnpkg.com/is-finite/-/is-finite-1.0.2.tgz#cc6677695602be550ef11e8b4aa6305342b6d0aa" + integrity sha1-zGZ3aVYCvlUO8R6LSqYwU0K20Ko= dependencies: number-is-nan "^1.0.0" is-fullwidth-code-point@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz#ef9e31386f031a7f0d643af82fde50c457ef00cb" + integrity sha1-754xOG8DGn8NZDr4L95QxFfvAMs= dependencies: number-is-nan "^1.0.0" is-fullwidth-code-point@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz#a3b30a5c4f199183167aaab93beefae3ddfb654f" + integrity sha1-o7MKXE8ZkYMWeqq5O+764937ZU8= -is-generator-fn@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/is-generator-fn/-/is-generator-fn-2.0.0.tgz#038c31b774709641bda678b1f06a4e3227c10b3e" +is-fullwidth-code-point@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz#f116f8064fe90b3f7844a38997c0b75051269f1d" + integrity sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg== -is-glob@^2.0.0, is-glob@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-2.0.1.tgz#d096f926a3ded5600f3fdfd91198cb0888c2d863" - dependencies: - is-extglob "^1.0.0" +is-generator-fn@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/is-generator-fn/-/is-generator-fn-2.1.0.tgz#7d140adc389aaf3011a8f2a2a4cfa6faadffb118" + integrity sha512-cTIB4yPYL/Grw0EaSzASzg6bBy9gqCofvWN8okThAYIxKJZC+udlRAmGbM0XLeniEJSs8uEgHPGuHSe1XsOLSQ== is-glob@^3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-3.1.0.tgz#7ba5ae24217804ac70707b96922567486cc3e84a" + integrity sha1-e6WuJCF4BKxwcHuWkiVnSGzD6Eo= dependencies: is-extglob "^2.1.0" -is-glob@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-4.0.0.tgz#9521c76845cc2610a85203ddf080a958c2ffabc0" +is-glob@^4.0.0, is-glob@^4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-4.0.1.tgz#7567dbe9f2f5e2467bc77ab83c4a29482407a5dc" + integrity sha512-5G0tKtBTFImOqDnLB2hG6Bp2qcKEFduo4tZu9MT/H6NQv/ghhy30o55ufafxJ/LdH79LLs2Kfrn85TLKyA7BUg== dependencies: is-extglob "^2.1.1" is-module@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/is-module/-/is-module-1.0.0.tgz#3258fb69f78c14d5b815d664336b4cffb6441591" + integrity sha1-Mlj7afeMFNW4FdZkM2tM/7ZEFZE= is-negated-glob@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/is-negated-glob/-/is-negated-glob-1.0.0.tgz#6910bca5da8c95e784b5751b976cf5a10fee36d2" - -is-number@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/is-number/-/is-number-2.1.0.tgz#01fcbbb393463a548f2f466cce16dece49db908f" - dependencies: - kind-of "^3.0.2" + integrity sha1-aRC8pdqMleeEtXUbl2z1oQ/uNtI= is-number@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/is-number/-/is-number-3.0.0.tgz#24fd6201a4782cf50561c810276afc7d12d71195" + integrity sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU= dependencies: kind-of "^3.0.2" is-number@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/is-number/-/is-number-4.0.0.tgz#0026e37f5454d73e356dfe6564699867c6a7f0ff" + integrity sha512-rSklcAIlf1OmFdyAqbnWTLVelsQ58uvZ66S/ZyawjWqIviTWCjg2PzVGw8WUA+nNuPTqb4wgA+NszrJ+08LlgQ== + +is-number@^7.0.0: + version "7.0.0" + resolved "https://registry.yarnpkg.com/is-number/-/is-number-7.0.0.tgz#7535345b896734d5f80c4d06c50955527a14f12b" + integrity sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng== is-obj@^1.0.0, is-obj@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/is-obj/-/is-obj-1.0.1.tgz#3e4729ac1f5fde025cd7d83a896dab9f4f67db0f" + integrity sha1-PkcprB9f3gJc19g6iW2rn09n2w8= + +is-object@~0.1.2: + version "0.1.2" + resolved "https://registry.yarnpkg.com/is-object/-/is-object-0.1.2.tgz#00efbc08816c33cfc4ac8251d132e10dc65098d7" + integrity sha1-AO+8CIFsM8/ErIJR0TLhDcZQmNc= is-observable@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/is-observable/-/is-observable-1.1.0.tgz#b3e986c8f44de950867cab5403f5a3465005975e" + integrity sha512-NqCa4Sa2d+u7BWc6CukaObG3Fh+CU9bvixbpcXYhy2VvYS7vVGIdAgnIS5Ks3A/cqk4rebLJ9s8zBstT2aKnIA== dependencies: symbol-observable "^1.1.0" -is-odd@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/is-odd/-/is-odd-2.0.0.tgz#7646624671fd7ea558ccd9a2795182f2958f1b24" - dependencies: - is-number "^4.0.0" - -is-path-cwd@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/is-path-cwd/-/is-path-cwd-1.0.0.tgz#d225ec23132e89edd38fda767472e62e65f1106d" - -is-path-in-cwd@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/is-path-in-cwd/-/is-path-in-cwd-1.0.0.tgz#6477582b8214d602346094567003be8a9eac04dc" - dependencies: - is-path-inside "^1.0.0" +is-path-cwd@^2.2.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/is-path-cwd/-/is-path-cwd-2.2.0.tgz#67d43b82664a7b5191fd9119127eb300048a9fdb" + integrity sha512-w942bTcih8fdJPJmQHFzkS76NEP8Kzzvmw92cXsazb8intwLqPibPPdXf4ANdKV3rYMuuQYGIWtvz9JilB3NFQ== -is-path-inside@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/is-path-inside/-/is-path-inside-1.0.1.tgz#8ef5b7de50437a3fdca6b4e865ef7aa55cb48036" - dependencies: - path-is-inside "^1.0.1" +is-path-inside@^3.0.1: + version "3.0.2" + resolved "https://registry.yarnpkg.com/is-path-inside/-/is-path-inside-3.0.2.tgz#f5220fc82a3e233757291dddc9c5877f2a1f3017" + integrity sha512-/2UGPSgmtqwo1ktx8NDHjuPwZWmHhO+gj0f93EkhLB5RgW9RZevWYYlIkS6zePc6U2WpOdQYIwHe9YC4DWEBVg== is-plain-obj@^1.0.0, is-plain-obj@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/is-plain-obj/-/is-plain-obj-1.1.0.tgz#71a50c8429dfca773c92a390a4a03b39fcd51d3e" + integrity sha1-caUMhCnfync8kqOQpKA7OfzVHT4= is-plain-object@^2.0.1, is-plain-object@^2.0.3, is-plain-object@^2.0.4: version "2.0.4" resolved "https://registry.yarnpkg.com/is-plain-object/-/is-plain-object-2.0.4.tgz#2c163b3fafb1b606d9d17928f05c2a1c38e07677" + integrity sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og== dependencies: isobject "^3.0.1" @@ -5492,31 +5918,34 @@ is-plain-object@^3.0.0: dependencies: isobject "^4.0.0" -is-posix-bracket@^0.1.0: - version "0.1.1" - resolved "https://registry.yarnpkg.com/is-posix-bracket/-/is-posix-bracket-0.1.1.tgz#3334dc79774368e92f016e6fbc0a88f5cd6e6bc4" - -is-primitive@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/is-primitive/-/is-primitive-2.0.0.tgz#207bab91638499c07b2adf240a41a87210034575" - is-promise@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/is-promise/-/is-promise-2.1.0.tgz#79a2a9ece7f096e80f36d2b2f3bc16c1ff4bf3fa" + integrity sha1-eaKp7OfwlugPNtKy87wWwf9L8/o= + +is-reference@^1.1.2: + version "1.1.4" + resolved "https://registry.yarnpkg.com/is-reference/-/is-reference-1.1.4.tgz#3f95849886ddb70256a3e6d062b1a68c13c51427" + integrity sha512-uJA/CDPO3Tao3GTrxYn6AwkM4nUPJiGGYu5+cB8qbC7WGFlrKZbiRo7SFKxUAEpFUfiHofWCXBUNhvYJMh+6zw== + dependencies: + "@types/estree" "0.0.39" is-regex@^1.0.4: version "1.0.4" resolved "https://registry.yarnpkg.com/is-regex/-/is-regex-1.0.4.tgz#5517489b547091b0930e095654ced25ee97e9491" + integrity sha1-VRdIm1RwkbCTDglWVM7SXul+lJE= dependencies: has "^1.0.1" is-regexp@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/is-regexp/-/is-regexp-1.0.0.tgz#fd2d883545c46bac5a633e7b9a09e87fa2cb5069" + integrity sha1-/S2INUXEa6xaYz57mgnof6LLUGk= is-relative@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/is-relative/-/is-relative-1.0.0.tgz#a1bb6935ce8c5dba1e8b9754b9b2dcc020e2260d" + integrity sha512-Kw/ReK0iqwKeu0MITLFuj0jbPAmEiOsIwyIXvvbfa6QfmN9pkD1M+8pdk7Rl/dTKbH34/XBFMbgD4iMJhLQbGA== dependencies: is-unc-path "^1.0.0" @@ -5530,63 +5959,95 @@ is-ssh@^1.3.0: is-stream@^1.0.1, is-stream@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-1.1.0.tgz#12d4a3dd4e68e0b79ceb8dbc84173ae80d91ca44" + integrity sha1-EtSj3U5o4Lec6428hBc66A2RykQ= + +is-stream@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-2.0.0.tgz#bde9c32680d6fae04129d6ac9d921ce7815f78e3" + integrity sha512-XCoy+WlUr7d1+Z8GgSuXmpuUFC9fOhRXglJMx+dwLKTkL44Cjd4W1Z5P+BQZpr+cR93aGP4S/s7Ftw6Nd/kiEw== is-symbol@^1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/is-symbol/-/is-symbol-1.0.2.tgz#a055f6ae57192caee329e7a860118b497a950f38" - integrity sha512-HS8bZ9ox60yCJLH9snBpIwv9pYUAkcuLhSA1oero1UB5y9aiQpRA8y2ex945AOtCZL1lJDeIk3G5LthswI46Lw== + version "1.0.3" + resolved "https://registry.yarnpkg.com/is-symbol/-/is-symbol-1.0.3.tgz#38e1014b9e6329be0de9d24a414fd7441ec61937" + integrity sha512-OwijhaRSgqvhm/0ZdAcXNZt9lYdKFpcRDT5ULUuYXPoT794UNOdU+gpT6Rzo7b4V2HUl/op6GqY894AZwv9faQ== dependencies: - has-symbols "^1.0.0" + has-symbols "^1.0.1" -is-text-path@^1.0.0: +is-text-path@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/is-text-path/-/is-text-path-1.0.1.tgz#4e1aa0fb51bfbcb3e92688001397202c1775b66e" + integrity sha1-Thqg+1G/vLPpJogAE5cgLBd1tm4= dependencies: text-extensions "^1.0.0" is-typedarray@~1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/is-typedarray/-/is-typedarray-1.0.0.tgz#e479c80858df0c1b11ddda6940f96011fcda4a9a" + integrity sha1-5HnICFjfDBsR3dppQPlgEfzaSpo= is-unc-path@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/is-unc-path/-/is-unc-path-1.0.0.tgz#d731e8898ed090a12c352ad2eaed5095ad322c9d" + integrity sha512-mrGpVd0fs7WWLfVsStvgF6iEJnbjDFZh9/emhRDcGWTduTfNHd9CHeUwH3gYIjdbwo4On6hunkztwOaAw0yllQ== dependencies: unc-path-regex "^0.1.2" is-utf8@^0.2.0, is-utf8@^0.2.1: version "0.2.1" resolved "https://registry.yarnpkg.com/is-utf8/-/is-utf8-0.2.1.tgz#4b0da1442104d1b336340e80797e865cf39f7d72" + integrity sha1-Sw2hRCEE0bM2NA6AeX6GXPOffXI= is-valid-glob@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/is-valid-glob/-/is-valid-glob-1.0.0.tgz#29bf3eff701be2d4d315dbacc39bc39fe8f601aa" + integrity sha1-Kb8+/3Ab4tTTFdusw5vDn+j2Aao= -is-windows@^1.0.1, is-windows@^1.0.2: +is-windows@^1.0.0, is-windows@^1.0.1, is-windows@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/is-windows/-/is-windows-1.0.2.tgz#d1850eb9791ecd18e6182ce12a30f396634bb19d" + integrity sha512-eXK1UInq2bPmjyX6e3VHIzMLobc4J94i4AWn+Hpq3OU5KkrRC96OAcR3PRJ/pGu6m8TRnBHP9dkXQVsT/COVIA== + +is-wsl@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/is-wsl/-/is-wsl-1.1.0.tgz#1f16e4aa22b04d1336b66188a66af3c600c3a66d" + integrity sha1-HxbkqiKwTRM2tmGIpmrzxgDDpm0= + +is@~0.2.6: + version "0.2.7" + resolved "https://registry.yarnpkg.com/is/-/is-0.2.7.tgz#3b34a2c48f359972f35042849193ae7264b63562" + integrity sha1-OzSixI81mXLzUEKEkZOucmS2NWI= -isarray@0.0.1, isarray@~0.0.1: +isarray@0.0.1: version "0.0.1" resolved "https://registry.yarnpkg.com/isarray/-/isarray-0.0.1.tgz#8a18acfca9a8f4177e09abfc6038939b05d1eedf" + integrity sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8= isarray@1.0.0, isarray@^1.0.0, isarray@~1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/isarray/-/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11" + integrity sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE= + +isbuffer@~0.0.0: + version "0.0.0" + resolved "https://registry.yarnpkg.com/isbuffer/-/isbuffer-0.0.0.tgz#38c146d9df528b8bf9b0701c3d43cf12df3fc39b" + integrity sha1-OMFG2d9Si4v5sHAcPUPPEt8/w5s= isexe@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10" + integrity sha1-6PvzdNxVb/iUehDcsFctYz8s+hA= isobject@^2.0.0: version "2.1.0" resolved "https://registry.yarnpkg.com/isobject/-/isobject-2.1.0.tgz#f065561096a3f1da2ef46272f815c840d87e0c89" + integrity sha1-8GVWEJaj8dou9GJy+BXIQNh+DIk= dependencies: isarray "1.0.0" isobject@^3.0.0, isobject@^3.0.1: version "3.0.1" resolved "https://registry.yarnpkg.com/isobject/-/isobject-3.0.1.tgz#4e431e92b11a9731636aa1f9c8d1ccbcfdab78df" + integrity sha1-TkMekrEalzFjaqH5yNHMvP2reN8= isobject@^4.0.0: version "4.0.0" @@ -5596,351 +6057,358 @@ isobject@^4.0.0: isstream@~0.1.2: version "0.1.2" resolved "https://registry.yarnpkg.com/isstream/-/isstream-0.1.2.tgz#47e63f7af55afa6f92e1500e690eb8b8529c099a" + integrity sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo= -istanbul-lib-coverage@^2.0.2, istanbul-lib-coverage@^2.0.3: - version "2.0.3" - resolved "https://registry.yarnpkg.com/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.3.tgz#0b891e5ad42312c2b9488554f603795f9a2211ba" +istanbul-lib-coverage@^2.0.2, istanbul-lib-coverage@^2.0.5: + version "2.0.5" + resolved "https://registry.yarnpkg.com/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.5.tgz#675f0ab69503fad4b1d849f736baaca803344f49" + integrity sha512-8aXznuEPCJvGnMSRft4udDRDtb1V3pkQkMMI5LI+6HuQz5oQ4J2UFn1H82raA3qJtyOLkkwVqICBQkjnGtn5mA== -istanbul-lib-instrument@^3.0.0, istanbul-lib-instrument@^3.0.1: - version "3.1.0" - resolved "https://registry.yarnpkg.com/istanbul-lib-instrument/-/istanbul-lib-instrument-3.1.0.tgz#a2b5484a7d445f1f311e93190813fa56dfb62971" - dependencies: - "@babel/generator" "^7.0.0" - "@babel/parser" "^7.0.0" - "@babel/template" "^7.0.0" - "@babel/traverse" "^7.0.0" - "@babel/types" "^7.0.0" - istanbul-lib-coverage "^2.0.3" - semver "^5.5.0" +istanbul-lib-instrument@^3.0.1, istanbul-lib-instrument@^3.3.0: + version "3.3.0" + resolved "https://registry.yarnpkg.com/istanbul-lib-instrument/-/istanbul-lib-instrument-3.3.0.tgz#a5f63d91f0bbc0c3e479ef4c5de027335ec6d630" + integrity sha512-5nnIN4vo5xQZHdXno/YDXJ0G+I3dAm4XgzfSVTPLQpj/zAV2dV6Juy0yaf10/zrJOJeHoN3fraFe+XRq2bFVZA== + dependencies: + "@babel/generator" "^7.4.0" + "@babel/parser" "^7.4.3" + "@babel/template" "^7.4.0" + "@babel/traverse" "^7.4.3" + "@babel/types" "^7.4.0" + istanbul-lib-coverage "^2.0.5" + semver "^6.0.0" istanbul-lib-report@^2.0.4: - version "2.0.4" - resolved "https://registry.yarnpkg.com/istanbul-lib-report/-/istanbul-lib-report-2.0.4.tgz#bfd324ee0c04f59119cb4f07dab157d09f24d7e4" + version "2.0.8" + resolved "https://registry.yarnpkg.com/istanbul-lib-report/-/istanbul-lib-report-2.0.8.tgz#5a8113cd746d43c4889eba36ab10e7d50c9b4f33" + integrity sha512-fHBeG573EIihhAblwgxrSenp0Dby6tJMFR/HvlerBsrCTD5bkUuoNtn3gVh29ZCS824cGGBPn7Sg7cNk+2xUsQ== dependencies: - istanbul-lib-coverage "^2.0.3" - make-dir "^1.3.0" - supports-color "^6.0.0" + istanbul-lib-coverage "^2.0.5" + make-dir "^2.1.0" + supports-color "^6.1.0" istanbul-lib-source-maps@^3.0.1: - version "3.0.2" - resolved "https://registry.yarnpkg.com/istanbul-lib-source-maps/-/istanbul-lib-source-maps-3.0.2.tgz#f1e817229a9146e8424a28e5d69ba220fda34156" + version "3.0.6" + resolved "https://registry.yarnpkg.com/istanbul-lib-source-maps/-/istanbul-lib-source-maps-3.0.6.tgz#284997c48211752ec486253da97e3879defba8c8" + integrity sha512-R47KzMtDJH6X4/YW9XTx+jrLnZnscW4VpNN+1PViSYTejLVPWv7oov+Duf8YQSPyVRUvueQqz1TcsC6mooZTXw== dependencies: debug "^4.1.1" - istanbul-lib-coverage "^2.0.3" - make-dir "^1.3.0" - rimraf "^2.6.2" + istanbul-lib-coverage "^2.0.5" + make-dir "^2.1.0" + rimraf "^2.6.3" source-map "^0.6.1" -istanbul-reports@^2.1.1: - version "2.1.1" - resolved "https://registry.yarnpkg.com/istanbul-reports/-/istanbul-reports-2.1.1.tgz#72ef16b4ecb9a4a7bd0e2001e00f95d1eec8afa9" - integrity sha512-FzNahnidyEPBCI0HcufJoSEoKykesRlFcSzQqjH9x0+LC8tnnE/p/90PBLu8iZTxr8yYZNyTtiAujUqyN+CIxw== +istanbul-reports@^2.2.6: + version "2.2.6" + resolved "https://registry.yarnpkg.com/istanbul-reports/-/istanbul-reports-2.2.6.tgz#7b4f2660d82b29303a8fe6091f8ca4bf058da1af" + integrity sha512-SKi4rnMyLBKe0Jy2uUdx28h8oG7ph2PPuQPvIAh31d+Ci+lSiEu4C+h3oBPuJ9+mPKhOyW0M8gY4U5NM1WLeXA== dependencies: - handlebars "^4.1.0" + handlebars "^4.1.2" -jest-changed-files@^24.8.0: - version "24.8.0" - resolved "https://registry.yarnpkg.com/jest-changed-files/-/jest-changed-files-24.8.0.tgz#7e7eb21cf687587a85e50f3d249d1327e15b157b" - integrity sha512-qgANC1Yrivsq+UrLXsvJefBKVoCsKB0Hv+mBb6NMjjZ90wwxCDmU3hsCXBya30cH+LnPYjwgcU65i6yJ5Nfuug== +jest-changed-files@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-changed-files/-/jest-changed-files-24.9.0.tgz#08d8c15eb79a7fa3fc98269bc14b451ee82f8039" + integrity sha512-6aTWpe2mHF0DhL28WjdkO8LyGjs3zItPET4bMSeXU6T3ub4FPMw+mcOcbdGXQOAfmLcxofD23/5Bl9Z4AkFwqg== dependencies: - "@jest/types" "^24.8.0" + "@jest/types" "^24.9.0" execa "^1.0.0" throat "^4.0.0" -jest-cli@^24.8.0: - version "24.8.0" - resolved "https://registry.yarnpkg.com/jest-cli/-/jest-cli-24.8.0.tgz#b075ac914492ed114fa338ade7362a301693e989" - integrity sha512-+p6J00jSMPQ116ZLlHJJvdf8wbjNbZdeSX9ptfHX06/MSNaXmKihQzx5vQcw0q2G6JsdVkUIdWbOWtSnaYs3yA== +jest-cli@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-cli/-/jest-cli-24.9.0.tgz#ad2de62d07472d419c6abc301fc432b98b10d2af" + integrity sha512-+VLRKyitT3BWoMeSUIHRxV/2g8y9gw91Jh5z2UmXZzkZKpbC08CSehVxgHUwTpy+HwGcns/tqafQDJW7imYvGg== dependencies: - "@jest/core" "^24.8.0" - "@jest/test-result" "^24.8.0" - "@jest/types" "^24.8.0" + "@jest/core" "^24.9.0" + "@jest/test-result" "^24.9.0" + "@jest/types" "^24.9.0" chalk "^2.0.1" exit "^0.1.2" import-local "^2.0.0" is-ci "^2.0.0" - jest-config "^24.8.0" - jest-util "^24.8.0" - jest-validate "^24.8.0" + jest-config "^24.9.0" + jest-util "^24.9.0" + jest-validate "^24.9.0" prompts "^2.0.1" realpath-native "^1.1.0" - yargs "^12.0.2" + yargs "^13.3.0" -jest-config@^24.8.0: - version "24.8.0" - resolved "https://registry.yarnpkg.com/jest-config/-/jest-config-24.8.0.tgz#77db3d265a6f726294687cbbccc36f8a76ee0f4f" - integrity sha512-Czl3Nn2uEzVGsOeaewGWoDPD8GStxCpAe0zOYs2x2l0fZAgPbCr3uwUkgNKV3LwE13VXythM946cd5rdGkkBZw== +jest-config@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-config/-/jest-config-24.9.0.tgz#fb1bbc60c73a46af03590719efa4825e6e4dd1b5" + integrity sha512-RATtQJtVYQrp7fvWg6f5y3pEFj9I+H8sWw4aKxnDZ96mob5i5SD6ZEGWgMLXQ4LE8UurrjbdlLWdUeo+28QpfQ== dependencies: "@babel/core" "^7.1.0" - "@jest/test-sequencer" "^24.8.0" - "@jest/types" "^24.8.0" - babel-jest "^24.8.0" + "@jest/test-sequencer" "^24.9.0" + "@jest/types" "^24.9.0" + babel-jest "^24.9.0" chalk "^2.0.1" glob "^7.1.1" - jest-environment-jsdom "^24.8.0" - jest-environment-node "^24.8.0" - jest-get-type "^24.8.0" - jest-jasmine2 "^24.8.0" + jest-environment-jsdom "^24.9.0" + jest-environment-node "^24.9.0" + jest-get-type "^24.9.0" + jest-jasmine2 "^24.9.0" jest-regex-util "^24.3.0" - jest-resolve "^24.8.0" - jest-util "^24.8.0" - jest-validate "^24.8.0" + jest-resolve "^24.9.0" + jest-util "^24.9.0" + jest-validate "^24.9.0" micromatch "^3.1.10" - pretty-format "^24.8.0" + pretty-format "^24.9.0" realpath-native "^1.1.0" -jest-diff@^24.8.0: - version "24.8.0" - resolved "https://registry.yarnpkg.com/jest-diff/-/jest-diff-24.8.0.tgz#146435e7d1e3ffdf293d53ff97e193f1d1546172" - integrity sha512-wxetCEl49zUpJ/bvUmIFjd/o52J+yWcoc5ZyPq4/W1LUKGEhRYDIbP1KcF6t+PvqNrGAFk4/JhtxDq/Nnzs66g== +jest-diff@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-diff/-/jest-diff-24.9.0.tgz#931b7d0d5778a1baf7452cb816e325e3724055da" + integrity sha512-qMfrTs8AdJE2iqrTp0hzh7kTd2PQWrsFyj9tORoKmu32xjPjeE4NyjVRDz8ybYwqS2ik8N4hsIpiVTyFeo2lBQ== dependencies: chalk "^2.0.1" - diff-sequences "^24.3.0" - jest-get-type "^24.8.0" - pretty-format "^24.8.0" + diff-sequences "^24.9.0" + jest-get-type "^24.9.0" + pretty-format "^24.9.0" jest-docblock@^24.3.0: - version "24.3.0" - resolved "https://registry.yarnpkg.com/jest-docblock/-/jest-docblock-24.3.0.tgz#b9c32dac70f72e4464520d2ba4aec02ab14db5dd" - integrity sha512-nlANmF9Yq1dufhFlKG9rasfQlrY7wINJbo3q01tu56Jv5eBU5jirylhF2O5ZBnLxzOVBGRDz/9NAwNyBtG4Nyg== + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-docblock/-/jest-docblock-24.9.0.tgz#7970201802ba560e1c4092cc25cbedf5af5a8ce2" + integrity sha512-F1DjdpDMJMA1cN6He0FNYNZlo3yYmOtRUnktrT9Q37njYzC5WEaDdmbynIgy0L/IvXvvgsG8OsqhLPXTpfmZAA== dependencies: detect-newline "^2.1.0" -jest-each@^24.8.0: - version "24.8.0" - resolved "https://registry.yarnpkg.com/jest-each/-/jest-each-24.8.0.tgz#a05fd2bf94ddc0b1da66c6d13ec2457f35e52775" - integrity sha512-NrwK9gaL5+XgrgoCsd9svsoWdVkK4gnvyhcpzd6m487tXHqIdYeykgq3MKI1u4I+5Zf0tofr70at9dWJDeb+BA== +jest-each@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-each/-/jest-each-24.9.0.tgz#eb2da602e2a610898dbc5f1f6df3ba86b55f8b05" + integrity sha512-ONi0R4BvW45cw8s2Lrx8YgbeXL1oCQ/wIDwmsM3CqM/nlblNCPmnC3IPQlMbRFZu3wKdQ2U8BqM6lh3LJ5Bsog== dependencies: - "@jest/types" "^24.8.0" + "@jest/types" "^24.9.0" chalk "^2.0.1" - jest-get-type "^24.8.0" - jest-util "^24.8.0" - pretty-format "^24.8.0" - -jest-environment-jsdom@^24.8.0: - version "24.8.0" - resolved "https://registry.yarnpkg.com/jest-environment-jsdom/-/jest-environment-jsdom-24.8.0.tgz#300f6949a146cabe1c9357ad9e9ecf9f43f38857" - integrity sha512-qbvgLmR7PpwjoFjM/sbuqHJt/NCkviuq9vus9NBn/76hhSidO+Z6Bn9tU8friecegbJL8gzZQEMZBQlFWDCwAQ== - dependencies: - "@jest/environment" "^24.8.0" - "@jest/fake-timers" "^24.8.0" - "@jest/types" "^24.8.0" - jest-mock "^24.8.0" - jest-util "^24.8.0" + jest-get-type "^24.9.0" + jest-util "^24.9.0" + pretty-format "^24.9.0" + +jest-environment-jsdom@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-environment-jsdom/-/jest-environment-jsdom-24.9.0.tgz#4b0806c7fc94f95edb369a69cc2778eec2b7375b" + integrity sha512-Zv9FV9NBRzLuALXjvRijO2351DRQeLYXtpD4xNvfoVFw21IOKNhZAEUKcbiEtjTkm2GsJ3boMVgkaR7rN8qetA== + dependencies: + "@jest/environment" "^24.9.0" + "@jest/fake-timers" "^24.9.0" + "@jest/types" "^24.9.0" + jest-mock "^24.9.0" + jest-util "^24.9.0" jsdom "^11.5.1" -jest-environment-node@^24.8.0: - version "24.8.0" - resolved "https://registry.yarnpkg.com/jest-environment-node/-/jest-environment-node-24.8.0.tgz#d3f726ba8bc53087a60e7a84ca08883a4c892231" - integrity sha512-vIGUEScd1cdDgR6sqn2M08sJTRLQp6Dk/eIkCeO4PFHxZMOgy+uYLPMC4ix3PEfM5Au/x3uQ/5Tl0DpXXZsJ/Q== +jest-environment-node@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-environment-node/-/jest-environment-node-24.9.0.tgz#333d2d2796f9687f2aeebf0742b519f33c1cbfd3" + integrity sha512-6d4V2f4nxzIzwendo27Tr0aFm+IXWa0XEUnaH6nU0FMaozxovt+sfRvh4J47wL1OvF83I3SSTu0XK+i4Bqe7uA== dependencies: - "@jest/environment" "^24.8.0" - "@jest/fake-timers" "^24.8.0" - "@jest/types" "^24.8.0" - jest-mock "^24.8.0" - jest-util "^24.8.0" + "@jest/environment" "^24.9.0" + "@jest/fake-timers" "^24.9.0" + "@jest/types" "^24.9.0" + jest-mock "^24.9.0" + jest-util "^24.9.0" -jest-get-type@^24.8.0: - version "24.8.0" - resolved "https://registry.yarnpkg.com/jest-get-type/-/jest-get-type-24.8.0.tgz#a7440de30b651f5a70ea3ed7ff073a32dfe646fc" - integrity sha512-RR4fo8jEmMD9zSz2nLbs2j0zvPpk/KCEz3a62jJWbd2ayNo0cb+KFRxPHVhE4ZmgGJEQp0fosmNz84IfqM8cMQ== +jest-get-type@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-get-type/-/jest-get-type-24.9.0.tgz#1684a0c8a50f2e4901b6644ae861f579eed2ef0e" + integrity sha512-lUseMzAley4LhIcpSP9Jf+fTrQ4a1yHQwLNeeVa2cEmbCGeoZAtYPOIv8JaxLD/sUpKxetKGP+gsHl8f8TSj8Q== -jest-haste-map@^24.8.0: - version "24.8.0" - resolved "https://registry.yarnpkg.com/jest-haste-map/-/jest-haste-map-24.8.0.tgz#51794182d877b3ddfd6e6d23920e3fe72f305800" - integrity sha512-ZBPRGHdPt1rHajWelXdqygIDpJx8u3xOoLyUBWRW28r3tagrgoepPrzAozW7kW9HrQfhvmiv1tncsxqHJO1onQ== +jest-haste-map@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-haste-map/-/jest-haste-map-24.9.0.tgz#b38a5d64274934e21fa417ae9a9fbeb77ceaac7d" + integrity sha512-kfVFmsuWui2Sj1Rp1AJ4D9HqJwE4uwTlS/vO+eRUaMmd54BFpli2XhMQnPC2k4cHFVbB2Q2C+jtI1AGLgEnCjQ== dependencies: - "@jest/types" "^24.8.0" + "@jest/types" "^24.9.0" anymatch "^2.0.0" fb-watchman "^2.0.0" graceful-fs "^4.1.15" invariant "^2.2.4" - jest-serializer "^24.4.0" - jest-util "^24.8.0" - jest-worker "^24.6.0" + jest-serializer "^24.9.0" + jest-util "^24.9.0" + jest-worker "^24.9.0" micromatch "^3.1.10" sane "^4.0.3" walker "^1.0.7" optionalDependencies: fsevents "^1.2.7" -jest-jasmine2@^24.8.0: - version "24.8.0" - resolved "https://registry.yarnpkg.com/jest-jasmine2/-/jest-jasmine2-24.8.0.tgz#a9c7e14c83dd77d8b15e820549ce8987cc8cd898" - integrity sha512-cEky88npEE5LKd5jPpTdDCLvKkdyklnaRycBXL6GNmpxe41F0WN44+i7lpQKa/hcbXaQ+rc9RMaM4dsebrYong== +jest-jasmine2@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-jasmine2/-/jest-jasmine2-24.9.0.tgz#1f7b1bd3242c1774e62acabb3646d96afc3be6a0" + integrity sha512-Cq7vkAgaYKp+PsX+2/JbTarrk0DmNhsEtqBXNwUHkdlbrTBLtMJINADf2mf5FkowNsq8evbPc07/qFO0AdKTzw== dependencies: "@babel/traverse" "^7.1.0" - "@jest/environment" "^24.8.0" - "@jest/test-result" "^24.8.0" - "@jest/types" "^24.8.0" + "@jest/environment" "^24.9.0" + "@jest/test-result" "^24.9.0" + "@jest/types" "^24.9.0" chalk "^2.0.1" co "^4.6.0" - expect "^24.8.0" + expect "^24.9.0" is-generator-fn "^2.0.0" - jest-each "^24.8.0" - jest-matcher-utils "^24.8.0" - jest-message-util "^24.8.0" - jest-runtime "^24.8.0" - jest-snapshot "^24.8.0" - jest-util "^24.8.0" - pretty-format "^24.8.0" + jest-each "^24.9.0" + jest-matcher-utils "^24.9.0" + jest-message-util "^24.9.0" + jest-runtime "^24.9.0" + jest-snapshot "^24.9.0" + jest-util "^24.9.0" + pretty-format "^24.9.0" throat "^4.0.0" -jest-leak-detector@^24.8.0: - version "24.8.0" - resolved "https://registry.yarnpkg.com/jest-leak-detector/-/jest-leak-detector-24.8.0.tgz#c0086384e1f650c2d8348095df769f29b48e6980" - integrity sha512-cG0yRSK8A831LN8lIHxI3AblB40uhv0z+SsQdW3GoMMVcK+sJwrIIyax5tu3eHHNJ8Fu6IMDpnLda2jhn2pD/g== +jest-leak-detector@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-leak-detector/-/jest-leak-detector-24.9.0.tgz#b665dea7c77100c5c4f7dfcb153b65cf07dcf96a" + integrity sha512-tYkFIDsiKTGwb2FG1w8hX9V0aUb2ot8zY/2nFg087dUageonw1zrLMP4W6zsRO59dPkTSKie+D4rhMuP9nRmrA== dependencies: - pretty-format "^24.8.0" + jest-get-type "^24.9.0" + pretty-format "^24.9.0" -jest-matcher-utils@^24.8.0: - version "24.8.0" - resolved "https://registry.yarnpkg.com/jest-matcher-utils/-/jest-matcher-utils-24.8.0.tgz#2bce42204c9af12bde46f83dc839efe8be832495" - integrity sha512-lex1yASY51FvUuHgm0GOVj7DCYEouWSlIYmCW7APSqB9v8mXmKSn5+sWVF0MhuASG0bnYY106/49JU1FZNl5hw== +jest-matcher-utils@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-matcher-utils/-/jest-matcher-utils-24.9.0.tgz#f5b3661d5e628dffe6dd65251dfdae0e87c3a073" + integrity sha512-OZz2IXsu6eaiMAwe67c1T+5tUAtQyQx27/EMEkbFAGiw52tB9em+uGbzpcgYVpA8wl0hlxKPZxrly4CXU/GjHA== dependencies: chalk "^2.0.1" - jest-diff "^24.8.0" - jest-get-type "^24.8.0" - pretty-format "^24.8.0" + jest-diff "^24.9.0" + jest-get-type "^24.9.0" + pretty-format "^24.9.0" -jest-message-util@^24.8.0: - version "24.8.0" - resolved "https://registry.yarnpkg.com/jest-message-util/-/jest-message-util-24.8.0.tgz#0d6891e72a4beacc0292b638685df42e28d6218b" - integrity sha512-p2k71rf/b6ns8btdB0uVdljWo9h0ovpnEe05ZKWceQGfXYr4KkzgKo3PBi8wdnd9OtNh46VpNIJynUn/3MKm1g== +jest-message-util@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-message-util/-/jest-message-util-24.9.0.tgz#527f54a1e380f5e202a8d1149b0ec872f43119e3" + integrity sha512-oCj8FiZ3U0hTP4aSui87P4L4jC37BtQwUMqk+zk/b11FR19BJDeZsZAvIHutWnmtw7r85UmR3CEWZ0HWU2mAlw== dependencies: "@babel/code-frame" "^7.0.0" - "@jest/test-result" "^24.8.0" - "@jest/types" "^24.8.0" + "@jest/test-result" "^24.9.0" + "@jest/types" "^24.9.0" "@types/stack-utils" "^1.0.1" chalk "^2.0.1" micromatch "^3.1.10" slash "^2.0.0" stack-utils "^1.0.1" -jest-mock@^24.8.0: - version "24.8.0" - resolved "https://registry.yarnpkg.com/jest-mock/-/jest-mock-24.8.0.tgz#2f9d14d37699e863f1febf4e4d5a33b7fdbbde56" - integrity sha512-6kWugwjGjJw+ZkK4mDa0Df3sDlUTsV47MSrT0nGQ0RBWJbpODDQ8MHDVtGtUYBne3IwZUhtB7elxHspU79WH3A== +jest-mock@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-mock/-/jest-mock-24.9.0.tgz#c22835541ee379b908673ad51087a2185c13f1c6" + integrity sha512-3BEYN5WbSq9wd+SyLDES7AHnjH9A/ROBwmz7l2y+ol+NtSFO8DYiEBzoO1CeFc9a8DYy10EO4dDFVv/wN3zl1w== dependencies: - "@jest/types" "^24.8.0" + "@jest/types" "^24.9.0" jest-pnp-resolver@^1.2.1: version "1.2.1" resolved "https://registry.yarnpkg.com/jest-pnp-resolver/-/jest-pnp-resolver-1.2.1.tgz#ecdae604c077a7fbc70defb6d517c3c1c898923a" integrity sha512-pgFw2tm54fzgYvc/OHrnysABEObZCUNFnhjoRjaVOCN8NYc032/gVjPaHD4Aq6ApkSieWtfKAFQtmDKAmhupnQ== -jest-regex-util@^24.3.0: - version "24.3.0" - resolved "https://registry.yarnpkg.com/jest-regex-util/-/jest-regex-util-24.3.0.tgz#d5a65f60be1ae3e310d5214a0307581995227b36" - integrity sha512-tXQR1NEOyGlfylyEjg1ImtScwMq8Oh3iJbGTjN7p0J23EuVX1MA8rwU69K4sLbCmwzgCUbVkm0FkSF9TdzOhtg== +jest-regex-util@^24.3.0, jest-regex-util@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-regex-util/-/jest-regex-util-24.9.0.tgz#c13fb3380bde22bf6575432c493ea8fe37965636" + integrity sha512-05Cmb6CuxaA+Ys6fjr3PhvV3bGQmO+2p2La4hFbU+W5uOc479f7FdLXUWXw4pYMAhhSZIuKHwSXSu6CsSBAXQA== -jest-resolve-dependencies@^24.8.0: - version "24.8.0" - resolved "https://registry.yarnpkg.com/jest-resolve-dependencies/-/jest-resolve-dependencies-24.8.0.tgz#19eec3241f2045d3f990dba331d0d7526acff8e0" - integrity sha512-hyK1qfIf/krV+fSNyhyJeq3elVMhK9Eijlwy+j5jqmZ9QsxwKBiP6qukQxaHtK8k6zql/KYWwCTQ+fDGTIJauw== +jest-resolve-dependencies@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-resolve-dependencies/-/jest-resolve-dependencies-24.9.0.tgz#ad055198959c4cfba8a4f066c673a3f0786507ab" + integrity sha512-Fm7b6AlWnYhT0BXy4hXpactHIqER7erNgIsIozDXWl5dVm+k8XdGVe1oTg1JyaFnOxarMEbax3wyRJqGP2Pq+g== dependencies: - "@jest/types" "^24.8.0" + "@jest/types" "^24.9.0" jest-regex-util "^24.3.0" - jest-snapshot "^24.8.0" + jest-snapshot "^24.9.0" -jest-resolve@^24.8.0: - version "24.8.0" - resolved "https://registry.yarnpkg.com/jest-resolve/-/jest-resolve-24.8.0.tgz#84b8e5408c1f6a11539793e2b5feb1b6e722439f" - integrity sha512-+hjSzi1PoRvnuOICoYd5V/KpIQmkAsfjFO71458hQ2Whi/yf1GDeBOFj8Gxw4LrApHsVJvn5fmjcPdmoUHaVKw== +jest-resolve@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-resolve/-/jest-resolve-24.9.0.tgz#dff04c7687af34c4dd7e524892d9cf77e5d17321" + integrity sha512-TaLeLVL1l08YFZAt3zaPtjiVvyy4oSA6CRe+0AFPPVX3Q/VI0giIWWoAvoS5L96vj9Dqxj4fB5p2qrHCmTU/MQ== dependencies: - "@jest/types" "^24.8.0" + "@jest/types" "^24.9.0" browser-resolve "^1.11.3" chalk "^2.0.1" jest-pnp-resolver "^1.2.1" realpath-native "^1.1.0" -jest-runner@^24.8.0: - version "24.8.0" - resolved "https://registry.yarnpkg.com/jest-runner/-/jest-runner-24.8.0.tgz#4f9ae07b767db27b740d7deffad0cf67ccb4c5bb" - integrity sha512-utFqC5BaA3JmznbissSs95X1ZF+d+4WuOWwpM9+Ak356YtMhHE/GXUondZdcyAAOTBEsRGAgH/0TwLzfI9h7ow== +jest-runner@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-runner/-/jest-runner-24.9.0.tgz#574fafdbd54455c2b34b4bdf4365a23857fcdf42" + integrity sha512-KksJQyI3/0mhcfspnxxEOBueGrd5E4vV7ADQLT9ESaCzz02WnbdbKWIf5Mkaucoaj7obQckYPVX6JJhgUcoWWg== dependencies: "@jest/console" "^24.7.1" - "@jest/environment" "^24.8.0" - "@jest/test-result" "^24.8.0" - "@jest/types" "^24.8.0" + "@jest/environment" "^24.9.0" + "@jest/test-result" "^24.9.0" + "@jest/types" "^24.9.0" chalk "^2.4.2" exit "^0.1.2" graceful-fs "^4.1.15" - jest-config "^24.8.0" + jest-config "^24.9.0" jest-docblock "^24.3.0" - jest-haste-map "^24.8.0" - jest-jasmine2 "^24.8.0" - jest-leak-detector "^24.8.0" - jest-message-util "^24.8.0" - jest-resolve "^24.8.0" - jest-runtime "^24.8.0" - jest-util "^24.8.0" + jest-haste-map "^24.9.0" + jest-jasmine2 "^24.9.0" + jest-leak-detector "^24.9.0" + jest-message-util "^24.9.0" + jest-resolve "^24.9.0" + jest-runtime "^24.9.0" + jest-util "^24.9.0" jest-worker "^24.6.0" source-map-support "^0.5.6" throat "^4.0.0" -jest-runtime@^24.8.0: - version "24.8.0" - resolved "https://registry.yarnpkg.com/jest-runtime/-/jest-runtime-24.8.0.tgz#05f94d5b05c21f6dc54e427cd2e4980923350620" - integrity sha512-Mq0aIXhvO/3bX44ccT+czU1/57IgOMyy80oM0XR/nyD5zgBcesF84BPabZi39pJVA6UXw+fY2Q1N+4BiVUBWOA== +jest-runtime@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-runtime/-/jest-runtime-24.9.0.tgz#9f14583af6a4f7314a6a9d9f0226e1a781c8e4ac" + integrity sha512-8oNqgnmF3v2J6PVRM2Jfuj8oX3syKmaynlDMMKQ4iyzbQzIG6th5ub/lM2bCMTmoTKM3ykcUYI2Pw9xwNtjMnw== dependencies: "@jest/console" "^24.7.1" - "@jest/environment" "^24.8.0" + "@jest/environment" "^24.9.0" "@jest/source-map" "^24.3.0" - "@jest/transform" "^24.8.0" - "@jest/types" "^24.8.0" - "@types/yargs" "^12.0.2" + "@jest/transform" "^24.9.0" + "@jest/types" "^24.9.0" + "@types/yargs" "^13.0.0" chalk "^2.0.1" exit "^0.1.2" glob "^7.1.3" graceful-fs "^4.1.15" - jest-config "^24.8.0" - jest-haste-map "^24.8.0" - jest-message-util "^24.8.0" - jest-mock "^24.8.0" + jest-config "^24.9.0" + jest-haste-map "^24.9.0" + jest-message-util "^24.9.0" + jest-mock "^24.9.0" jest-regex-util "^24.3.0" - jest-resolve "^24.8.0" - jest-snapshot "^24.8.0" - jest-util "^24.8.0" - jest-validate "^24.8.0" + jest-resolve "^24.9.0" + jest-snapshot "^24.9.0" + jest-util "^24.9.0" + jest-validate "^24.9.0" realpath-native "^1.1.0" slash "^2.0.0" strip-bom "^3.0.0" - yargs "^12.0.2" + yargs "^13.3.0" -jest-serializer@^24.4.0: - version "24.4.0" - resolved "https://registry.yarnpkg.com/jest-serializer/-/jest-serializer-24.4.0.tgz#f70c5918c8ea9235ccb1276d232e459080588db3" - integrity sha512-k//0DtglVstc1fv+GY/VHDIjrtNjdYvYjMlbLUed4kxrE92sIUewOi5Hj3vrpB8CXfkJntRPDRjCrCvUhBdL8Q== +jest-serializer@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-serializer/-/jest-serializer-24.9.0.tgz#e6d7d7ef96d31e8b9079a714754c5d5c58288e73" + integrity sha512-DxYipDr8OvfrKH3Kel6NdED3OXxjvxXZ1uIY2I9OFbGg+vUkkg7AGvi65qbhbWNPvDckXmzMPbK3u3HaDO49bQ== -jest-snapshot@^24.8.0: - version "24.8.0" - resolved "https://registry.yarnpkg.com/jest-snapshot/-/jest-snapshot-24.8.0.tgz#3bec6a59da2ff7bc7d097a853fb67f9d415cb7c6" - integrity sha512-5ehtWoc8oU9/cAPe6fez6QofVJLBKyqkY2+TlKTOf0VllBB/mqUNdARdcjlZrs9F1Cv+/HKoCS/BknT0+tmfPg== +jest-snapshot@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-snapshot/-/jest-snapshot-24.9.0.tgz#ec8e9ca4f2ec0c5c87ae8f925cf97497b0e951ba" + integrity sha512-uI/rszGSs73xCM0l+up7O7a40o90cnrk429LOiK3aeTvfC0HHmldbd81/B7Ix81KSFe1lwkbl7GnBGG4UfuDew== dependencies: "@babel/types" "^7.0.0" - "@jest/types" "^24.8.0" + "@jest/types" "^24.9.0" chalk "^2.0.1" - expect "^24.8.0" - jest-diff "^24.8.0" - jest-matcher-utils "^24.8.0" - jest-message-util "^24.8.0" - jest-resolve "^24.8.0" + expect "^24.9.0" + jest-diff "^24.9.0" + jest-get-type "^24.9.0" + jest-matcher-utils "^24.9.0" + jest-message-util "^24.9.0" + jest-resolve "^24.9.0" mkdirp "^0.5.1" natural-compare "^1.4.0" - pretty-format "^24.8.0" - semver "^5.5.0" - -jest-util@^24.8.0: - version "24.8.0" - resolved "https://registry.yarnpkg.com/jest-util/-/jest-util-24.8.0.tgz#41f0e945da11df44cc76d64ffb915d0716f46cd1" - integrity sha512-DYZeE+XyAnbNt0BG1OQqKy/4GVLPtzwGx5tsnDrFcax36rVE3lTA5fbvgmbVPUZf9w77AJ8otqR4VBbfFJkUZA== - dependencies: - "@jest/console" "^24.7.1" - "@jest/fake-timers" "^24.8.0" - "@jest/source-map" "^24.3.0" - "@jest/test-result" "^24.8.0" - "@jest/types" "^24.8.0" + pretty-format "^24.9.0" + semver "^6.2.0" + +jest-util@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-util/-/jest-util-24.9.0.tgz#7396814e48536d2e85a37de3e4c431d7cb140162" + integrity sha512-x+cZU8VRmOJxbA1K5oDBdxQmdq0OIdADarLxk0Mq+3XS4jgvhG/oKGWcIDCtPG0HgjxOYvF+ilPJQsAyXfbNOg== + dependencies: + "@jest/console" "^24.9.0" + "@jest/fake-timers" "^24.9.0" + "@jest/source-map" "^24.9.0" + "@jest/test-result" "^24.9.0" + "@jest/types" "^24.9.0" callsites "^3.0.0" chalk "^2.0.1" graceful-fs "^4.1.15" @@ -5949,60 +6417,53 @@ jest-util@^24.8.0: slash "^2.0.0" source-map "^0.6.0" -jest-validate@^24.8.0: - version "24.8.0" - resolved "https://registry.yarnpkg.com/jest-validate/-/jest-validate-24.8.0.tgz#624c41533e6dfe356ffadc6e2423a35c2d3b4849" - integrity sha512-+/N7VOEMW1Vzsrk3UWBDYTExTPwf68tavEPKDnJzrC6UlHtUDU/fuEdXqFoHzv9XnQ+zW6X3qMZhJ3YexfeLDA== +jest-validate@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-validate/-/jest-validate-24.9.0.tgz#0775c55360d173cd854e40180756d4ff52def8ab" + integrity sha512-HPIt6C5ACwiqSiwi+OfSSHbK8sG7akG8eATl+IPKaeIjtPOeBUd/g3J7DghugzxrGjI93qS/+RPKe1H6PqvhRQ== dependencies: - "@jest/types" "^24.8.0" - camelcase "^5.0.0" + "@jest/types" "^24.9.0" + camelcase "^5.3.1" chalk "^2.0.1" - jest-get-type "^24.8.0" - leven "^2.1.0" - pretty-format "^24.8.0" - -jest-watcher@^24.8.0: - version "24.8.0" - resolved "https://registry.yarnpkg.com/jest-watcher/-/jest-watcher-24.8.0.tgz#58d49915ceddd2de85e238f6213cef1c93715de4" - integrity sha512-SBjwHt5NedQoVu54M5GEx7cl7IGEFFznvd/HNT8ier7cCAx/Qgu9ZMlaTQkvK22G1YOpcWBLQPFSImmxdn3DAw== - dependencies: - "@jest/test-result" "^24.8.0" - "@jest/types" "^24.8.0" - "@types/yargs" "^12.0.9" + jest-get-type "^24.9.0" + leven "^3.1.0" + pretty-format "^24.9.0" + +jest-watcher@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-watcher/-/jest-watcher-24.9.0.tgz#4b56e5d1ceff005f5b88e528dc9afc8dd4ed2b3b" + integrity sha512-+/fLOfKPXXYJDYlks62/4R4GoT+GU1tYZed99JSCOsmzkkF7727RqKrjNAxtfO4YpGv11wybgRvCjR73lK2GZw== + dependencies: + "@jest/test-result" "^24.9.0" + "@jest/types" "^24.9.0" + "@types/yargs" "^13.0.0" ansi-escapes "^3.0.0" chalk "^2.0.1" - jest-util "^24.8.0" + jest-util "^24.9.0" string-length "^2.0.0" -jest-worker@^24.6.0: - version "24.6.0" - resolved "https://registry.yarnpkg.com/jest-worker/-/jest-worker-24.6.0.tgz#7f81ceae34b7cde0c9827a6980c35b7cdc0161b3" - integrity sha512-jDwgW5W9qGNvpI1tNnvajh0a5IE/PuGLFmHk6aR/BZFz8tSgGw17GsDPXAJ6p91IvYDjOw8GpFbvvZGAK+DPQQ== +jest-worker@^24.6.0, jest-worker@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-worker/-/jest-worker-24.9.0.tgz#5dbfdb5b2d322e98567898238a9697bcce67b3e5" + integrity sha512-51PE4haMSXcHohnSMdM42anbvZANYTqMrr52tVKPqqsPJMzoP6FYYDVqahX/HrAoKEKz3uUPzSvKs9A3qR4iVw== dependencies: - merge-stream "^1.0.1" + merge-stream "^2.0.0" supports-color "^6.1.0" -jest@^24.8.0: - version "24.8.0" - resolved "https://registry.yarnpkg.com/jest/-/jest-24.8.0.tgz#d5dff1984d0d1002196e9b7f12f75af1b2809081" - integrity sha512-o0HM90RKFRNWmAWvlyV8i5jGZ97pFwkeVoGvPW1EtLTgJc2+jcuqcbbqcSZLE/3f2S5pt0y2ZBETuhpWNl1Reg== +jest@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest/-/jest-24.9.0.tgz#987d290c05a08b52c56188c1002e368edb007171" + integrity sha512-YvkBL1Zm7d2B1+h5fHEOdyjCG+sGMz4f8D86/0HiqJ6MB4MnDc8FgP5vdWsGnemOQro7lnYo8UakZ3+5A0jxGw== dependencies: import-local "^2.0.0" - jest-cli "^24.8.0" - -js-levenshtein@^1.1.3: - version "1.1.3" - resolved "https://registry.yarnpkg.com/js-levenshtein/-/js-levenshtein-1.1.3.tgz#3ef627df48ec8cf24bacf05c0f184ff30ef413c5" - -js-tokens@^3.0.0: - version "3.0.2" - resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-3.0.2.tgz#9866df395102130e38f7f996bceb65443209c25b" + jest-cli "^24.9.0" -js-tokens@^4.0.0: +"js-tokens@^3.0.0 || ^4.0.0", js-tokens@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499" + integrity sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ== -js-yaml@^3.13.0, js-yaml@^3.13.1, js-yaml@^3.2.1: +js-yaml@^3.13.1, js-yaml@^3.2.1: version "3.13.1" resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.13.1.tgz#aff151b30bfdfa8e49e05da22e7415e9dfa37847" integrity sha512-YfbcO7jXDdyj0DGxYVSlSeQNHbD7XPWvrVWeVUujrQEoZzWJIRrCPoyk6kL6IAjAG2IolMK4T0hNUe0HOUs5Jw== @@ -6013,109 +6474,110 @@ js-yaml@^3.13.0, js-yaml@^3.13.1, js-yaml@^3.2.1: jsbn@~0.1.0: version "0.1.1" resolved "https://registry.yarnpkg.com/jsbn/-/jsbn-0.1.1.tgz#a5e654c2e5a2deb5f201d96cefbca80c0ef2f513" + integrity sha1-peZUwuWi3rXyAdls77yoDA7y9RM= jsdom@^11.5.1: - version "11.6.2" - resolved "https://registry.yarnpkg.com/jsdom/-/jsdom-11.6.2.tgz#25d1ef332d48adf77fc5221fe2619967923f16bb" + version "11.12.0" + resolved "https://registry.yarnpkg.com/jsdom/-/jsdom-11.12.0.tgz#1a80d40ddd378a1de59656e9e6dc5a3ba8657bc8" + integrity sha512-y8Px43oyiBM13Zc1z780FrfNLJCXTL40EWlty/LXUtcjykRBNgLlCjWXpfSPBl2iv+N7koQN+dvqszHZgT/Fjw== dependencies: - abab "^1.0.4" - acorn "^5.3.0" + abab "^2.0.0" + acorn "^5.5.3" acorn-globals "^4.1.0" array-equal "^1.0.0" - browser-process-hrtime "^0.1.2" - content-type-parser "^1.0.2" cssom ">= 0.3.2 < 0.4.0" - cssstyle ">= 0.2.37 < 0.3.0" - domexception "^1.0.0" - escodegen "^1.9.0" + cssstyle "^1.0.0" + data-urls "^1.0.0" + domexception "^1.0.1" + escodegen "^1.9.1" html-encoding-sniffer "^1.0.2" - left-pad "^1.2.0" - nwmatcher "^1.4.3" + left-pad "^1.3.0" + nwsapi "^2.0.7" parse5 "4.0.0" pn "^1.1.0" - request "^2.83.0" + request "^2.87.0" request-promise-native "^1.0.5" sax "^1.2.4" symbol-tree "^3.2.2" - tough-cookie "^2.3.3" + tough-cookie "^2.3.4" w3c-hr-time "^1.0.1" webidl-conversions "^4.0.2" whatwg-encoding "^1.0.3" - whatwg-url "^6.4.0" - ws "^4.0.0" + whatwg-mimetype "^2.1.0" + whatwg-url "^6.4.1" + ws "^5.2.0" xml-name-validator "^3.0.0" jsesc@^2.5.1: - version "2.5.1" - resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-2.5.1.tgz#e421a2a8e20d6b0819df28908f782526b96dd1fe" + version "2.5.2" + resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-2.5.2.tgz#80564d2e483dacf6e8ef209650a67df3f0c283a4" + integrity sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA== jsesc@~0.5.0: version "0.5.0" resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-0.5.0.tgz#e7dee66e35d6fc16f710fe91d5cf69f70f08911d" - -json-loader@^0.5.4: - version "0.5.7" - resolved "https://registry.yarnpkg.com/json-loader/-/json-loader-0.5.7.tgz#dca14a70235ff82f0ac9a3abeb60d337a365185d" + integrity sha1-597mbjXW/Bb3EP6R1c9p9w8IkR0= json-parse-better-errors@^1.0.0, json-parse-better-errors@^1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz#bb867cfb3450e69107c131d1c514bab3dc8bcaa9" + integrity sha512-mrqyZKfX5EhL7hvqcV6WG1yYjnjeuYDzDhhcAAUrq8Po85NBQBJP+ZDUT75qZQ98IkUoBqdkExkukOU7Ts2wrw== json-schema-traverse@^0.4.1: version "0.4.1" resolved "https://registry.yarnpkg.com/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz#69f6a87d9513ab8bb8fe63bdb0979c448e684660" + integrity sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg== json-schema@0.2.3: version "0.2.3" resolved "https://registry.yarnpkg.com/json-schema/-/json-schema-0.2.3.tgz#b480c892e59a2f05954ce727bd3f2a4e882f9e13" + integrity sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM= json-stable-stringify-without-jsonify@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz#9db7b59496ad3f3cfef30a75142d2d930ad72651" - -json-stable-stringify@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/json-stable-stringify/-/json-stable-stringify-1.0.1.tgz#9a759d39c5f2ff503fd5300646ed445f88c4f9af" - dependencies: - jsonify "~0.0.0" + integrity sha1-nbe1lJatPzz+8wp1FC0tkwrXJlE= json-stable-stringify@~0.0.0: version "0.0.1" resolved "https://registry.yarnpkg.com/json-stable-stringify/-/json-stable-stringify-0.0.1.tgz#611c23e814db375527df851193db59dd2af27f45" + integrity sha1-YRwj6BTbN1Un34URk9tZ3Sryf0U= dependencies: jsonify "~0.0.0" json-stringify-safe@^5.0.1, json-stringify-safe@~5.0.1: version "5.0.1" resolved "https://registry.yarnpkg.com/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz#1296a2d58fd45f19a0f6ce01d65701e2c735b6eb" + integrity sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus= -json5@^0.5.0, json5@^0.5.1: - version "0.5.1" - resolved "https://registry.yarnpkg.com/json5/-/json5-0.5.1.tgz#1eade7acc012034ad84e2396767ead9fa5495821" - -json5@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/json5/-/json5-2.1.0.tgz#e7a0c62c48285c628d20a10b85c89bb807c32850" +json5@^2.1.2: + version "2.1.3" + resolved "https://registry.yarnpkg.com/json5/-/json5-2.1.3.tgz#c9b0f7fa9233bfe5807fe66fcf3a5617ed597d43" + integrity sha512-KXPvOm8K9IJKFM0bmdn8QXh7udDh1g/giieX0NLCaMnb4hEiVFqnop2ImTXCc5e0/oHz3LTqmHGtExn5hfMkOA== dependencies: - minimist "^1.2.0" + minimist "^1.2.5" jsonfile@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-4.0.0.tgz#8771aae0799b64076b76640fca058f9c10e33ecb" + integrity sha1-h3Gq4HmbZAdrdmQPygWPnBDjPss= optionalDependencies: graceful-fs "^4.1.6" jsonify@~0.0.0: version "0.0.0" resolved "https://registry.yarnpkg.com/jsonify/-/jsonify-0.0.0.tgz#2c74b6ee41d93ca51b7b5aaee8f503631d252a73" + integrity sha1-LHS27kHZPKUbe1qu6PUDYx0lKnM= jsonparse@^1.2.0: version "1.3.1" resolved "https://registry.yarnpkg.com/jsonparse/-/jsonparse-1.3.1.tgz#3f4dae4a91fac315f71062f8521cc239f1366280" + integrity sha1-P02uSpH6wxX3EGL4UhzCOfE2YoA= jsprim@^1.2.2: version "1.4.1" resolved "https://registry.yarnpkg.com/jsprim/-/jsprim-1.4.1.tgz#313e66bc1e5cc06e438bc1b7499c2e5c56acb6a2" + integrity sha1-MT5mvB5cwG5Di8G3SZwuXFastqI= dependencies: assert-plus "1.0.0" extsprintf "1.3.0" @@ -6125,101 +6587,100 @@ jsprim@^1.2.2: just-debounce@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/just-debounce/-/just-debounce-1.0.0.tgz#87fccfaeffc0b68cd19d55f6722943f929ea35ea" + integrity sha1-h/zPrv/AtozRnVX2cilD+SnqNeo= kew@^0.7.0: version "0.7.0" resolved "https://registry.yarnpkg.com/kew/-/kew-0.7.0.tgz#79d93d2d33363d6fdd2970b335d9141ad591d79b" + integrity sha1-edk9LTM2PW/dKXCzNdkUGtWR15s= kind-of@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-1.1.0.tgz#140a3d2d41a36d2efcfa9377b62c24f8495a5c44" + integrity sha1-FAo9LUGjbS78+pN3tiwk+ElaXEQ= -kind-of@^3.0.2, kind-of@^3.0.3, kind-of@^3.1.0, kind-of@^3.2.0: +kind-of@^3.0.2, kind-of@^3.0.3, kind-of@^3.2.0: version "3.2.2" resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-3.2.2.tgz#31ea21a734bab9bbb0f32466d893aea51e4a3c64" + integrity sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ= dependencies: is-buffer "^1.1.5" kind-of@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-4.0.0.tgz#20813df3d712928b207378691a45066fae72dd57" + integrity sha1-IIE989cSkosgc3hpGkUGb65y3Vc= dependencies: is-buffer "^1.1.5" kind-of@^5.0.0, kind-of@^5.0.2: version "5.1.0" resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-5.1.0.tgz#729c91e2d857b7a419a1f9aa65685c4c33f5845d" + integrity sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw== kind-of@^6.0.0, kind-of@^6.0.2: - version "6.0.2" - resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-6.0.2.tgz#01146b36a6218e64e58f3a8d66de5d7fc6f6d051" + version "6.0.3" + resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-6.0.3.tgz#07c05034a6c349fa06e24fa35aa76db4580ce4dd" + integrity sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw== klaw@^2.1.0: version "2.1.1" resolved "https://registry.yarnpkg.com/klaw/-/klaw-2.1.1.tgz#42b76894701169cc910fd0d19ce677b5fb378af1" + integrity sha1-QrdolHARacyRD9DRnOZ3tfs3ivE= dependencies: graceful-fs "^4.1.9" -kleur@^3.0.0: - version "3.0.1" - resolved "https://registry.yarnpkg.com/kleur/-/kleur-3.0.1.tgz#4f5b313f5fa315432a400f19a24db78d451ede62" +kleur@^3.0.3: + version "3.0.3" + resolved "https://registry.yarnpkg.com/kleur/-/kleur-3.0.3.tgz#a79c9ecc86ee1ce3fa6206d1216c501f147fc07e" + integrity sha512-eTIzlVOSUR+JxdDFepEYcBMtZ9Qqdef+rnzWdRZuMbOywu5tO2w2N7rqjoANZ5k9vywhL6Br1VRjUIgTQx4E8w== labeled-stream-splicer@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/labeled-stream-splicer/-/labeled-stream-splicer-2.0.0.tgz#a52e1d138024c00b86b1c0c91f677918b8ae0a59" + version "2.0.2" + resolved "https://registry.yarnpkg.com/labeled-stream-splicer/-/labeled-stream-splicer-2.0.2.tgz#42a41a16abcd46fd046306cf4f2c3576fffb1c21" + integrity sha512-Ca4LSXFFZUjPScRaqOcFxneA0VpKZr4MMYCljyQr4LIewTLb3Y0IUTIsnBBsVubIeEfxeSZpSjSsRM8APEQaAw== dependencies: inherits "^2.0.1" - isarray "~0.0.1" stream-splicer "^2.0.0" last-run@^1.1.0: version "1.1.1" resolved "https://registry.yarnpkg.com/last-run/-/last-run-1.1.1.tgz#45b96942c17b1c79c772198259ba943bebf8ca5b" + integrity sha1-RblpQsF7HHnHchmCWbqUO+v4yls= dependencies: default-resolution "^2.0.0" es6-weak-map "^2.0.1" -lazy-cache@^1.0.3: - version "1.0.4" - resolved "https://registry.yarnpkg.com/lazy-cache/-/lazy-cache-1.0.4.tgz#a1d78fc3a50474cb80845d3b3b6e1da49a446e8e" - -lazy-cache@^2.0.2: - version "2.0.2" - resolved "https://registry.yarnpkg.com/lazy-cache/-/lazy-cache-2.0.2.tgz#b9190a4f913354694840859f8a8f7084d8822264" - dependencies: - set-getter "^0.1.0" - lazystream@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/lazystream/-/lazystream-1.0.0.tgz#f6995fe0f820392f61396be89462407bb77168e4" + integrity sha1-9plf4PggOS9hOWvolGJAe7dxaOQ= dependencies: readable-stream "^2.0.5" lcid@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/lcid/-/lcid-1.0.0.tgz#308accafa0bc483a3867b4b6f2b9506251d1b835" + integrity sha1-MIrMr6C8SDo4Z7S28rlQYlHRuDU= dependencies: invert-kv "^1.0.0" -lcid@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/lcid/-/lcid-2.0.0.tgz#6ef5d2df60e52f82eb228a4c373e8d1f397253cf" - dependencies: - invert-kv "^2.0.0" - lead@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/lead/-/lead-1.0.0.tgz#6f14f99a37be3a9dd784f5495690e5903466ee42" + integrity sha1-bxT5mje+Op3XhPVJVpDlkDRm7kI= dependencies: flush-write-stream "^1.0.2" -left-pad@^1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/left-pad/-/left-pad-1.2.0.tgz#d30a73c6b8201d8f7d8e7956ba9616087a68e0ee" +left-pad@^1.3.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/left-pad/-/left-pad-1.3.0.tgz#5b8a3a7765dfe001261dde915589e782f8c94d1e" + integrity sha512-XI5MPzVNApjAyhQzphX8BkmKsKUxD4LdyK24iZeQGinBN9yTQT3bFlCBy/aVx2HrNcqQGsdot8ghrjyrvMCoEA== lerna-changelog@^0.5.0: version "0.5.0" resolved "https://registry.yarnpkg.com/lerna-changelog/-/lerna-changelog-0.5.0.tgz#1617a8193a1309451ffa1e686b425faf0424b3f8" + integrity sha512-+HFe8T3Q35Fwn2+fTRBvi0EdbKXrsGOozkuWBhq33DTJLBAqAFZ7m1LtKqF8LLuP0asZ0W9L+tGCAhoAt1+J1w== dependencies: chalk "^1.1.3" mkdirp "^0.5.1" @@ -6229,46 +6690,134 @@ lerna-changelog@^0.5.0: string.prototype.padend "^3.0.0" yargs "^6.6.0" -lerna@^3.14.2: - version "3.15.0" - resolved "https://registry.yarnpkg.com/lerna/-/lerna-3.15.0.tgz#b044dba8138d7a1a8dd48ac1d80e7541bdde0d1f" - integrity sha512-kRIQ3bgzkmew5/WZQ0C9WjH0IUf3ZmTNnBwTHfXgLkVY7td0lbwMQFD7zehflUn0zG4ou54o/gn+IfjF0ti/5A== - dependencies: - "@lerna/add" "3.15.0" - "@lerna/bootstrap" "3.15.0" - "@lerna/changed" "3.15.0" - "@lerna/clean" "3.15.0" - "@lerna/cli" "3.13.0" - "@lerna/create" "3.15.0" - "@lerna/diff" "3.15.0" - "@lerna/exec" "3.15.0" - "@lerna/import" "3.15.0" - "@lerna/init" "3.15.0" - "@lerna/link" "3.15.0" - "@lerna/list" "3.15.0" - "@lerna/publish" "3.15.0" - "@lerna/run" "3.15.0" - "@lerna/version" "3.15.0" - import-local "^1.0.0" +lerna@^3.19.0: + version "3.19.0" + resolved "https://registry.yarnpkg.com/lerna/-/lerna-3.19.0.tgz#6d53b613eca7da426ab1e97c01ce6fb39754da6c" + integrity sha512-YtMmwEqzWHQCh7Ynk7BvjrZri3EkSeVqTAcwZIqWlv9V/dCfvFPyRqp+2NIjPB5nj1FWXLRH6F05VT/qvzuuOA== + dependencies: + "@lerna/add" "3.19.0" + "@lerna/bootstrap" "3.18.5" + "@lerna/changed" "3.18.5" + "@lerna/clean" "3.18.5" + "@lerna/cli" "3.18.5" + "@lerna/create" "3.18.5" + "@lerna/diff" "3.18.5" + "@lerna/exec" "3.18.5" + "@lerna/import" "3.18.5" + "@lerna/init" "3.18.5" + "@lerna/link" "3.18.5" + "@lerna/list" "3.18.5" + "@lerna/publish" "3.18.5" + "@lerna/run" "3.18.5" + "@lerna/version" "3.18.5" + import-local "^2.0.0" npmlog "^4.1.2" -leven@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/leven/-/leven-2.1.0.tgz#c2e7a9f772094dee9d34202ae8acce4687875580" +level-blobs@^0.1.7: + version "0.1.7" + resolved "https://registry.yarnpkg.com/level-blobs/-/level-blobs-0.1.7.tgz#9ab9b97bb99f1edbf9f78a3433e21ed56386bdaf" + integrity sha1-mrm5e7mfHtv594o0M+Ie1WOGva8= + dependencies: + level-peek "1.0.6" + once "^1.3.0" + readable-stream "^1.0.26-4" + +level-filesystem@^1.0.1: + version "1.2.0" + resolved "https://registry.yarnpkg.com/level-filesystem/-/level-filesystem-1.2.0.tgz#a00aca9919c4a4dfafdca6a8108d225aadff63b3" + integrity sha1-oArKmRnEpN+v3KaoEI0iWq3/Y7M= + dependencies: + concat-stream "^1.4.4" + errno "^0.1.1" + fwd-stream "^1.0.4" + level-blobs "^0.1.7" + level-peek "^1.0.6" + level-sublevel "^5.2.0" + octal "^1.0.0" + once "^1.3.0" + xtend "^2.2.0" + +level-fix-range@2.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/level-fix-range/-/level-fix-range-2.0.0.tgz#c417d62159442151a19d9a2367868f1724c2d548" + integrity sha1-xBfWIVlEIVGhnZojZ4aPFyTC1Ug= + dependencies: + clone "~0.1.9" + +level-fix-range@~1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/level-fix-range/-/level-fix-range-1.0.2.tgz#bf15b915ae36d8470c821e883ddf79cd16420828" + integrity sha1-vxW5Fa422EcMgh6IPd95zRZCCCg= + +"level-hooks@>=4.4.0 <5": + version "4.5.0" + resolved "https://registry.yarnpkg.com/level-hooks/-/level-hooks-4.5.0.tgz#1b9ae61922930f3305d1a61fc4d83c8102c0dd93" + integrity sha1-G5rmGSKTDzMF0aYfxNg8gQLA3ZM= + dependencies: + string-range "~1.2" + +level-js@^2.1.3: + version "2.2.4" + resolved "https://registry.yarnpkg.com/level-js/-/level-js-2.2.4.tgz#bc055f4180635d4489b561c9486fa370e8c11697" + integrity sha1-vAVfQYBjXUSJtWHJSG+jcOjBFpc= + dependencies: + abstract-leveldown "~0.12.0" + idb-wrapper "^1.5.0" + isbuffer "~0.0.0" + ltgt "^2.1.2" + typedarray-to-buffer "~1.0.0" + xtend "~2.1.2" + +level-peek@1.0.6, level-peek@^1.0.6: + version "1.0.6" + resolved "https://registry.yarnpkg.com/level-peek/-/level-peek-1.0.6.tgz#bec51c72a82ee464d336434c7c876c3fcbcce77f" + integrity sha1-vsUccqgu5GTTNkNMfIdsP8vM538= + dependencies: + level-fix-range "~1.0.2" + +level-sublevel@^5.2.0: + version "5.2.3" + resolved "https://registry.yarnpkg.com/level-sublevel/-/level-sublevel-5.2.3.tgz#744c12c72d2e72be78dde3b9b5cd84d62191413a" + integrity sha1-dEwSxy0ucr543eO5tc2E1iGRQTo= + dependencies: + level-fix-range "2.0" + level-hooks ">=4.4.0 <5" + string-range "~1.2.1" + xtend "~2.0.4" + +levelup@^0.18.2: + version "0.18.6" + resolved "https://registry.yarnpkg.com/levelup/-/levelup-0.18.6.tgz#e6a01cb089616c8ecc0291c2a9bd3f0c44e3e5eb" + integrity sha1-5qAcsIlhbI7MApHCqb0/DETj5es= + dependencies: + bl "~0.8.1" + deferred-leveldown "~0.2.0" + errno "~0.1.1" + prr "~0.0.0" + readable-stream "~1.0.26" + semver "~2.3.1" + xtend "~3.0.0" + +leven@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/leven/-/leven-3.1.0.tgz#77891de834064cccba82ae7842bb6b14a13ed7f2" + integrity sha512-qsda+H8jTaUaN/x5vzW2rzc+8Rw4TAQ/4KjB46IwK5VH+IlVeeeje/EoZRpiXvIqjFgK84QffqPztGI3VBLG1A== + +levenary@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/levenary/-/levenary-1.1.1.tgz#842a9ee98d2075aa7faeedbe32679e9205f46f77" + integrity sha512-mkAdOIt79FD6irqjYSs4rdbnlT5vRonMEvBVPVb3XmevfS8kgRXwfes0dhPdEtzTWD/1eNE/Bm/G1iRt6DcnQQ== + dependencies: + leven "^3.1.0" levn@^0.3.0, levn@~0.3.0: version "0.3.0" resolved "https://registry.yarnpkg.com/levn/-/levn-0.3.0.tgz#3b09924edf9f083c0490fdd4c0bc4421e04764ee" + integrity sha1-OwmSTt+fCDwEkP3UwLxEIeBHZO4= dependencies: prelude-ls "~1.1.2" type-check "~0.3.2" -lexical-scope@^1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/lexical-scope/-/lexical-scope-1.2.0.tgz#fcea5edc704a4b3a8796cdca419c3a0afaf22df4" - dependencies: - astw "^2.0.0" - liftoff@^3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/liftoff/-/liftoff-3.1.0.tgz#c9ba6081f908670607ee79062d700df062c52ed3" @@ -6283,44 +6832,40 @@ liftoff@^3.1.0: rechoir "^0.6.2" resolve "^1.1.7" -lint-staged@^8.1.7: - version "8.1.7" - resolved "https://registry.yarnpkg.com/lint-staged/-/lint-staged-8.1.7.tgz#a8988bc83bdffa97d04adb09dbc0b1f3a58fa6fc" - integrity sha512-egT0goFhIFoOGk6rasPngTFh2qDqxZddM0PwI58oi66RxCDcn5uDwxmiasWIF0qGnchHSYVJ8HPRD5LrFo7TKA== +lines-and-columns@^1.1.6: + version "1.1.6" + resolved "https://registry.yarnpkg.com/lines-and-columns/-/lines-and-columns-1.1.6.tgz#1c00c743b433cd0a4e80758f7b64a57440d9ff00" + integrity sha1-HADHQ7QzzQpOgHWPe2SldEDZ/wA= + +lint-staged@^9.2.0: + version "9.5.0" + resolved "https://registry.yarnpkg.com/lint-staged/-/lint-staged-9.5.0.tgz#290ec605252af646d9b74d73a0fa118362b05a33" + integrity sha512-nawMob9cb/G1J98nb8v3VC/E8rcX1rryUYXVZ69aT9kde6YWX+uvNOEHY5yf2gcWcTJGiD0kqXmCnS3oD75GIA== dependencies: - chalk "^2.3.1" - commander "^2.14.1" - cosmiconfig "^5.2.0" - debug "^3.1.0" + chalk "^2.4.2" + commander "^2.20.0" + cosmiconfig "^5.2.1" + debug "^4.1.1" dedent "^0.7.0" - del "^3.0.0" - execa "^1.0.0" - find-parent-dir "^0.3.0" - g-status "^2.0.2" - is-glob "^4.0.0" - is-windows "^1.0.2" - listr "^0.14.2" - listr-update-renderer "^0.5.0" - lodash "^4.17.11" - log-symbols "^2.2.0" - micromatch "^3.1.8" - npm-which "^3.0.1" - p-map "^1.1.1" - path-is-inside "^1.0.2" - pify "^3.0.0" - please-upgrade-node "^3.0.2" - staged-git-files "1.1.2" - string-argv "^0.0.2" - stringify-object "^3.2.2" - yup "^0.27.0" + del "^5.0.0" + execa "^2.0.3" + listr "^0.14.3" + log-symbols "^3.0.0" + micromatch "^4.0.2" + normalize-path "^3.0.0" + please-upgrade-node "^3.1.1" + string-argv "^0.3.0" + stringify-object "^3.3.0" listr-silent-renderer@^1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/listr-silent-renderer/-/listr-silent-renderer-1.1.1.tgz#924b5a3757153770bf1a8e3fbf74b8bbf3f9242e" + integrity sha1-kktaN1cVN3C/Go4/v3S4u/P5JC4= listr-update-renderer@^0.5.0: version "0.5.0" resolved "https://registry.yarnpkg.com/listr-update-renderer/-/listr-update-renderer-0.5.0.tgz#4ea8368548a7b8aecb7e06d8c95cb45ae2ede6a2" + integrity sha512-tKRsZpKz8GSGqoI/+caPmfrypiaq+OQCbd+CovEC24uk1h952lVj5sC7SqyFUm+OaJ5HN/a1YLt5cit2FMNsFA== dependencies: chalk "^1.1.3" cli-truncate "^0.2.1" @@ -6334,15 +6879,17 @@ listr-update-renderer@^0.5.0: listr-verbose-renderer@^0.5.0: version "0.5.0" resolved "https://registry.yarnpkg.com/listr-verbose-renderer/-/listr-verbose-renderer-0.5.0.tgz#f1132167535ea4c1261102b9f28dac7cba1e03db" + integrity sha512-04PDPqSlsqIOaaaGZ+41vq5FejI9auqTInicFRndCBgE3bXG8D6W1I+mWhk+1nqbHmyhla/6BUrd5OSiHwKRXw== dependencies: chalk "^2.4.1" cli-cursor "^2.1.0" date-fns "^1.27.2" figures "^2.0.0" -listr@^0.14.2: +listr@^0.14.3: version "0.14.3" resolved "https://registry.yarnpkg.com/listr/-/listr-0.14.3.tgz#2fea909604e434be464c50bddba0d496928fa586" + integrity sha512-RmAl7su35BFd/xoMamRjpIE4j3v+L28o8CT5YhAXQJm1fD+1l9ngXY8JAQRJ+tFK2i5njvi0iRUKV09vPwA0iA== dependencies: "@samverschueren/stream-to-observable" "^0.3.0" is-observable "^1.1.0" @@ -6357,6 +6904,7 @@ listr@^0.14.2: load-json-file@^1.0.0: version "1.1.0" resolved "https://registry.yarnpkg.com/load-json-file/-/load-json-file-1.1.0.tgz#956905708d58b4bab4c2261b04f59f31c99374c0" + integrity sha1-lWkFcI1YtLq0wiYbBPWfMcmTdMA= dependencies: graceful-fs "^4.1.2" parse-json "^2.2.0" @@ -6367,6 +6915,7 @@ load-json-file@^1.0.0: load-json-file@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/load-json-file/-/load-json-file-2.0.0.tgz#7947e42149af80d696cbf797bcaabcfe1fe29ca8" + integrity sha1-eUfkIUmvgNaWy/eXvKq8/h/inKg= dependencies: graceful-fs "^4.1.2" parse-json "^2.2.0" @@ -6376,27 +6925,28 @@ load-json-file@^2.0.0: load-json-file@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/load-json-file/-/load-json-file-4.0.0.tgz#2f5f45ab91e33216234fd53adab668eb4ec0993b" + integrity sha1-L19Fq5HjMhYjT9U62rZo607AmTs= dependencies: graceful-fs "^4.1.2" parse-json "^4.0.0" pify "^3.0.0" strip-bom "^3.0.0" -loader-runner@^2.3.0: - version "2.3.0" - resolved "https://registry.yarnpkg.com/loader-runner/-/loader-runner-2.3.0.tgz#f482aea82d543e07921700d5a46ef26fdac6b8a2" - -loader-utils@^1.0.2, loader-utils@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/loader-utils/-/loader-utils-1.1.0.tgz#c98aef488bcceda2ffb5e2de646d6a754429f5cd" +load-json-file@^5.3.0: + version "5.3.0" + resolved "https://registry.yarnpkg.com/load-json-file/-/load-json-file-5.3.0.tgz#4d3c1e01fa1c03ea78a60ac7af932c9ce53403f3" + integrity sha512-cJGP40Jc/VXUsp8/OrnyKyTZ1y6v/dphm3bioS+RrKXjK2BB6wHUd6JptZEFDGgGahMT+InnZO5i1Ei9mpC8Bw== dependencies: - big.js "^3.1.3" - emojis-list "^2.0.0" - json5 "^0.5.0" + graceful-fs "^4.1.15" + parse-json "^4.0.0" + pify "^4.0.1" + strip-bom "^3.0.0" + type-fest "^0.3.0" locate-path@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-2.0.0.tgz#2b568b265eec944c6d9c0de9c3dbbbca0354cd8e" + integrity sha1-K1aLJl7slExtnA3pw9u7ygNUzY4= dependencies: p-locate "^2.0.0" path-exists "^3.0.0" @@ -6404,22 +6954,27 @@ locate-path@^2.0.0: locate-path@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-3.0.0.tgz#dbec3b3ab759758071b58fe59fc41871af21400e" + integrity sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A== dependencies: p-locate "^3.0.0" path-exists "^3.0.0" +locate-path@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-5.0.0.tgz#1afba396afd676a6d42504d0a67a3a7eb9f62aa0" + integrity sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g== + dependencies: + p-locate "^4.1.0" + lodash._reinterpolate@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/lodash._reinterpolate/-/lodash._reinterpolate-3.0.0.tgz#0ccf2d89166af03b3663c796538b75ac6e114d9d" integrity sha1-DM8tiRZq8Ds2Y8eWU4t1rG4RTZ0= -lodash.clone@^4.3.2: - version "4.5.0" - resolved "https://registry.yarnpkg.com/lodash.clone/-/lodash.clone-4.5.0.tgz#195870450f5a13192478df4bc3d23d2dea1907b6" - lodash.clonedeep@^4.5.0: version "4.5.0" resolved "https://registry.yarnpkg.com/lodash.clonedeep/-/lodash.clonedeep-4.5.0.tgz#e23f3f9c4f8fbdde872529c1071857a086e5ccef" + integrity sha1-4j8/nE+Pvd6HJSnBBxhXoIblzO8= lodash.get@^4.4.2: version "4.4.2" @@ -6434,21 +6989,19 @@ lodash.ismatch@^4.4.0: lodash.memoize@~3.0.3: version "3.0.4" resolved "https://registry.yarnpkg.com/lodash.memoize/-/lodash.memoize-3.0.4.tgz#2dcbd2c287cbc0a55cc42328bd0c736150d53e3f" + integrity sha1-LcvSwofLwKVcxCMovQxzYVDVPj8= lodash.set@^4.3.2: version "4.3.2" resolved "https://registry.yarnpkg.com/lodash.set/-/lodash.set-4.3.2.tgz#d8757b1da807dde24816b0d6a84bea1a76230b23" integrity sha1-2HV7HagH3eJIFrDWqEvqGnYjCyM= -lodash.some@^4.2.2: - version "4.6.0" - resolved "https://registry.yarnpkg.com/lodash.some/-/lodash.some-4.6.0.tgz#1bb9f314ef6b8baded13b549169b2a945eb68e4d" - lodash.sortby@^4.7.0: version "4.7.0" resolved "https://registry.yarnpkg.com/lodash.sortby/-/lodash.sortby-4.7.0.tgz#edd14c824e2cc9c1e0b0a1b42bb5210516a42438" + integrity sha1-7dFMgk4sycHgsKG0K7UhBRakJDg= -lodash.template@^4.0.2: +lodash.template@^4.0.2, lodash.template@^4.5.0: version "4.5.0" resolved "https://registry.yarnpkg.com/lodash.template/-/lodash.template-4.5.0.tgz#f976195cf3f347d0d5f52483569fe8031ccce8ab" integrity sha512-84vYFxIkmidUiFxidA/KjjH9pAycqW+h980j7Fuz5qxRtO9pgB7MDFTdys1N7A5mcucRiDyEq4fusljItR1T/A== @@ -6468,60 +7021,49 @@ lodash.uniq@^4.5.0: resolved "https://registry.yarnpkg.com/lodash.uniq/-/lodash.uniq-4.5.0.tgz#d0225373aeb652adc1bc82e4945339a842754773" integrity sha1-0CJTc662Uq3BvILklFM5qEJ1R3M= -lodash@^4.13.1, lodash@^4.15.0, lodash@^4.17.10, lodash@^4.17.11, lodash@^4.17.13, lodash@^4.17.4, lodash@^4.17.5, lodash@^4.2.1: - version "4.17.13" - resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.13.tgz#0bdc3a6adc873d2f4e0c4bac285df91b64fc7b93" - integrity sha512-vm3/XWXfWtRua0FkUyEHBZy8kCPjErNBT9fJx8Zvs+U6zjqPbTUOpkaoum3O5uiA8sm+yNMHXfYkTUHFoMxFNA== +lodash@^4.17.12, lodash@^4.17.13, lodash@^4.17.14, lodash@^4.17.15, lodash@^4.2.1: + version "4.17.15" + resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.15.tgz#b447f6670a0455bbfeedd11392eff330ea097548" + integrity sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A== log-symbols@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/log-symbols/-/log-symbols-1.0.2.tgz#376ff7b58ea3086a0f09facc74617eca501e1a18" + integrity sha1-N2/3tY6jCGoPCfrMdGF+ylAeGhg= dependencies: chalk "^1.0.0" -log-symbols@^2.2.0: - version "2.2.0" - resolved "https://registry.yarnpkg.com/log-symbols/-/log-symbols-2.2.0.tgz#5740e1c5d6f0dfda4ad9323b5332107ef6b4c40a" +log-symbols@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/log-symbols/-/log-symbols-3.0.0.tgz#f3a08516a5dea893336a7dee14d18a1cfdab77c4" + integrity sha512-dSkNGuI7iG3mfvDzUuYZyvk5dD9ocYCYzNU6CYDE6+Xqd+gwme6Z00NS3dUh8mq/73HaEtT7m6W+yUPtU6BZnQ== dependencies: - chalk "^2.0.1" + chalk "^2.4.2" log-update@^2.3.0: version "2.3.0" resolved "https://registry.yarnpkg.com/log-update/-/log-update-2.3.0.tgz#88328fd7d1ce7938b29283746f0b1bc126b24708" + integrity sha1-iDKP19HOeTiykoN0bwsbwSayRwg= dependencies: ansi-escapes "^3.0.0" cli-cursor "^2.0.0" wrap-ansi "^3.0.1" -longest@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/longest/-/longest-1.0.1.tgz#30a0b2da38f73770e8294a0d22e6625ed77d0097" - loose-envify@^1.0.0: - version "1.3.1" - resolved "https://registry.yarnpkg.com/loose-envify/-/loose-envify-1.3.1.tgz#d1a8ad33fa9ce0e713d65fdd0ac8b748d478c848" + version "1.4.0" + resolved "https://registry.yarnpkg.com/loose-envify/-/loose-envify-1.4.0.tgz#71ee51fa7be4caec1a63839f7e682d8132d30caf" + integrity sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q== dependencies: - js-tokens "^3.0.0" + js-tokens "^3.0.0 || ^4.0.0" loud-rejection@^1.0.0: version "1.6.0" resolved "https://registry.yarnpkg.com/loud-rejection/-/loud-rejection-1.6.0.tgz#5b46f80147edee578870f086d04821cf998e551f" + integrity sha1-W0b4AUft7leIcPCG0Eghz5mOVR8= dependencies: currently-unhandled "^0.4.1" signal-exit "^3.0.0" -lower-case@^1.1.1: - version "1.1.4" - resolved "https://registry.yarnpkg.com/lower-case/-/lower-case-1.1.4.tgz#9a2cabd1b9e8e0ae993a4bf7d5875c39c42e8eac" - -lru-cache@^4.0.1, lru-cache@^4.1.2, lru-cache@^4.1.3: - version "4.1.5" - resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-4.1.5.tgz#8bbe50ea85bed59bc9e33dcab8235ee9bcf443cd" - integrity sha512-sWZlbEP2OsHNkXrMl5GYk/jKk70MBng6UU4YI/qGDYbgf6YbP4EvmqISbXCoJiRKs+1bSpFHVgQxvJ17F2li5g== - dependencies: - pseudomap "^1.0.2" - yallist "^2.1.2" - lru-cache@^5.1.1: version "5.1.1" resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-5.1.1.tgz#1da27e6710271947695daf6848e847f01d84b920" @@ -6529,45 +7071,56 @@ lru-cache@^5.1.1: dependencies: yallist "^3.0.2" +ltgt@^2.1.2: + version "2.2.1" + resolved "https://registry.yarnpkg.com/ltgt/-/ltgt-2.2.1.tgz#f35ca91c493f7b73da0e07495304f17b31f87ee5" + integrity sha1-81ypHEk/e3PaDgdJUwTxezH4fuU= + macos-release@^2.2.0: - version "2.2.0" - resolved "https://registry.yarnpkg.com/macos-release/-/macos-release-2.2.0.tgz#ab58d55dd4714f0a05ad4b0e90f4370fef5cdea8" - integrity sha512-iV2IDxZaX8dIcM7fG6cI46uNmHUxHE4yN+Z8tKHAW1TBPMZDIKHf/3L+YnOuj/FK9il14UaVdHmiQ1tsi90ltA== + version "2.3.0" + resolved "https://registry.yarnpkg.com/macos-release/-/macos-release-2.3.0.tgz#eb1930b036c0800adebccd5f17bc4c12de8bb71f" + integrity sha512-OHhSbtcviqMPt7yfw5ef5aghS2jzFVKEFyCJndQt2YpSQ9qRVSEv2axSJI1paVThEu+FFGs584h/1YhxjVqajA== + +magic-string@^0.22.5: + version "0.22.5" + resolved "https://registry.yarnpkg.com/magic-string/-/magic-string-0.22.5.tgz#8e9cf5afddf44385c1da5bc2a6a0dbd10b03657e" + integrity sha512-oreip9rJZkzvA8Qzk9HFs8fZGF/u7H/gtrE8EN6RjKJ9kh2HlC+yQ2QezifqTZfGyiuAV0dRv5a+y/8gBb1m9w== + dependencies: + vlq "^0.2.2" magic-string@^0.25.2: - version "0.25.2" - resolved "https://registry.yarnpkg.com/magic-string/-/magic-string-0.25.2.tgz#139c3a729515ec55e96e69e82a11fe890a293ad9" - integrity sha512-iLs9mPjh9IuTtRsqqhNGYcZXGei0Nh/A4xirrsqW7c+QhKVFL2vm7U09ru6cHRD22azaP/wMDgI+HCqbETMTtg== + version "0.25.4" + resolved "https://registry.yarnpkg.com/magic-string/-/magic-string-0.25.4.tgz#325b8a0a79fc423db109b77fd5a19183b7ba5143" + integrity sha512-oycWO9nEVAP2RVPbIoDoA4Y7LFIJ3xRYov93gAyJhZkET1tNuB0u7uWkZS2LpBWTJUWnmau/To8ECWRC+jKNfw== dependencies: sourcemap-codec "^1.4.4" -make-dir@^1.0.0, make-dir@^1.3.0: +make-dir@^1.0.0: version "1.3.0" resolved "https://registry.yarnpkg.com/make-dir/-/make-dir-1.3.0.tgz#79c1033b80515bd6d24ec9933e860ca75ee27f0c" integrity sha512-2w31R7SJtieJJnQtGc7RVL2StM2vGYVfqUOvUDxH6bC6aJTxPxTF0GnIgCyu7tjockiUWAYQRbxa7vKn34s5sQ== dependencies: pify "^3.0.0" -make-error-cause@^1.1.1: - version "1.2.2" - resolved "https://registry.yarnpkg.com/make-error-cause/-/make-error-cause-1.2.2.tgz#df0388fcd0b37816dff0a5fb8108939777dcbc9d" +make-dir@^2.0.0, make-dir@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/make-dir/-/make-dir-2.1.0.tgz#5f0310e18b8be898cc07009295a30ae41e91e6f5" + integrity sha512-LS9X+dc8KLxXCb8dni79fLIIUA5VyZoyjSMCwTluaXA0o27cCK0bhXkpgw+sTXVpPy/lSO57ilRixqk0vDmtRA== dependencies: - make-error "^1.2.0" - -make-error@^1.2.0: - version "1.3.4" - resolved "https://registry.yarnpkg.com/make-error/-/make-error-1.3.4.tgz#19978ed575f9e9545d2ff8c13e33b5d18a67d535" + pify "^4.0.1" + semver "^5.6.0" -make-fetch-happen@^4.0.1: - version "4.0.1" - resolved "https://registry.yarnpkg.com/make-fetch-happen/-/make-fetch-happen-4.0.1.tgz#141497cb878f243ba93136c83d8aba12c216c083" +make-fetch-happen@^5.0.0: + version "5.0.2" + resolved "https://registry.yarnpkg.com/make-fetch-happen/-/make-fetch-happen-5.0.2.tgz#aa8387104f2687edca01c8687ee45013d02d19bd" + integrity sha512-07JHC0r1ykIoruKO8ifMXu+xEU8qOXDFETylktdug6vJDACnP+HKevOu3PXyNPzFyTSlz8vrBYlBO1JZRe8Cag== dependencies: agentkeepalive "^3.4.1" - cacache "^11.0.1" + cacache "^12.0.0" http-cache-semantics "^3.8.1" http-proxy-agent "^2.1.0" - https-proxy-agent "^2.2.1" - lru-cache "^4.1.2" + https-proxy-agent "^2.2.3" + lru-cache "^5.1.1" mississippi "^3.0.0" node-fetch-npm "^2.0.2" promise-retry "^1.1.1" @@ -6575,80 +7128,64 @@ make-fetch-happen@^4.0.1: ssri "^6.0.0" make-iterator@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/make-iterator/-/make-iterator-1.0.0.tgz#57bef5dc85d23923ba23767324d8e8f8f3d9694b" + version "1.0.1" + resolved "https://registry.yarnpkg.com/make-iterator/-/make-iterator-1.0.1.tgz#29b33f312aa8f547c4a5e490f56afcec99133ad6" + integrity sha512-pxiuXh0iVEq7VM7KMIhs5gxsfxCux2URptUQaXo4iZZJxBAzTPOLE2BumO5dbfVYq/hBJFBR/a1mFDmOx5AGmw== dependencies: - kind-of "^3.1.0" + kind-of "^6.0.2" makeerror@1.0.x: version "1.0.11" resolved "https://registry.yarnpkg.com/makeerror/-/makeerror-1.0.11.tgz#e01a5c9109f2af79660e4e8b9587790184f5a96c" + integrity sha1-4BpckQnyr3lmDk6LlYd5AYT1qWw= dependencies: tmpl "1.0.x" -map-age-cleaner@^0.1.1: - version "0.1.3" - resolved "https://registry.yarnpkg.com/map-age-cleaner/-/map-age-cleaner-0.1.3.tgz#7d583a7306434c055fe474b0f45078e6e1b4b92a" - dependencies: - p-defer "^1.0.0" - map-cache@^0.2.0, map-cache@^0.2.2: version "0.2.2" resolved "https://registry.yarnpkg.com/map-cache/-/map-cache-0.2.2.tgz#c32abd0bd6525d9b051645bb4f26ac5dc98a0dbf" + integrity sha1-wyq9C9ZSXZsFFkW7TyasXcmKDb8= map-obj@^1.0.0, map-obj@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/map-obj/-/map-obj-1.0.1.tgz#d933ceb9205d82bdcf4886f6742bdc2b4dea146d" + integrity sha1-2TPOuSBdgr3PSIb2dCvcK03qFG0= map-obj@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/map-obj/-/map-obj-2.0.0.tgz#a65cd29087a92598b8791257a523e021222ac1f9" + integrity sha1-plzSkIepJZi4eRJXpSPgISIqwfk= map-visit@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/map-visit/-/map-visit-1.0.0.tgz#ecdca8f13144e660f1b5bd41f12f3479d98dfb8f" + integrity sha1-7Nyo8TFE5mDxtb1B8S80edmN+48= dependencies: object-visit "^1.0.0" matchdep@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/matchdep/-/matchdep-2.0.0.tgz#c6f34834a0d8dbc3b37c27ee8bbcb27c7775582e" + integrity sha1-xvNINKDY28OzfCfui7yyfHd1WC4= dependencies: findup-sync "^2.0.0" micromatch "^3.0.4" resolve "^1.4.0" stack-trace "0.0.10" -matcher@^1.0.0: - version "1.1.1" - resolved "https://registry.yarnpkg.com/matcher/-/matcher-1.1.1.tgz#51d8301e138f840982b338b116bb0c09af62c1c2" - dependencies: - escape-string-regexp "^1.0.4" - md5.js@^1.3.4: - version "1.3.4" - resolved "https://registry.yarnpkg.com/md5.js/-/md5.js-1.3.4.tgz#e9bdbde94a20a5ac18b04340fc5764d5b09d901d" + version "1.3.5" + resolved "https://registry.yarnpkg.com/md5.js/-/md5.js-1.3.5.tgz#b5d07b8e3216e3e27cd728d72f70d1e6a342005f" + integrity sha512-xitP+WxNPcTTOgnTJcrhM0xvdPepipPSf3I8EIpGKeFLjt3PlJLIDG3u8EX53ZIubkb+5U2+3rELYpEhHhzdkg== dependencies: hash-base "^3.0.0" inherits "^2.0.1" + safe-buffer "^5.1.2" -mem@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/mem/-/mem-1.1.0.tgz#5edd52b485ca1d900fe64895505399a0dfa45f76" - dependencies: - mimic-fn "^1.0.0" - -mem@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/mem/-/mem-4.0.0.tgz#6437690d9471678f6cc83659c00cbafcd6b0cdaf" - dependencies: - map-age-cleaner "^0.1.1" - mimic-fn "^1.0.0" - p-is-promise "^1.1.0" - -memory-fs@^0.4.0, memory-fs@^0.4.1, memory-fs@~0.4.1: +memory-fs@^0.4.0: version "0.4.1" resolved "https://registry.yarnpkg.com/memory-fs/-/memory-fs-0.4.1.tgz#3a9a20b8462523e447cfbc7e8bb80ed667bfc552" + integrity sha1-OpoguEYlI+RHz7x+i7gO1me/xVI= dependencies: errno "^0.1.3" readable-stream "^2.0.1" @@ -6656,6 +7193,7 @@ memory-fs@^0.4.0, memory-fs@^0.4.1, memory-fs@~0.4.1: meow@^3.3.0: version "3.7.0" resolved "https://registry.yarnpkg.com/meow/-/meow-3.7.0.tgz#72cb668b425228290abbfa856892587308a801fb" + integrity sha1-cstmi0JSKCkKu/qFaJJYcwioAfs= dependencies: camelcase-keys "^2.0.0" decamelize "^1.1.2" @@ -6669,8 +7207,9 @@ meow@^3.3.0: trim-newlines "^1.0.0" meow@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/meow/-/meow-4.0.0.tgz#fd5855dd008db5b92c552082db1c307cba20b29d" + version "4.0.1" + resolved "https://registry.yarnpkg.com/meow/-/meow-4.0.1.tgz#d48598f6f4b1472f35bf6317a95945ace347f975" + integrity sha512-xcSBHD5Z86zaOc+781KrupuHAzeGXSLtiAOmBsiLDiPSaYSB6hdew2ng9EBAnZ62jagG9MHAOdxpDi/lWBFJ/A== dependencies: camelcase-keys "^4.0.0" decamelize-keys "^1.0.0" @@ -6682,35 +7221,37 @@ meow@^4.0.0: redent "^2.0.0" trim-newlines "^2.0.0" -merge-stream@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/merge-stream/-/merge-stream-1.0.1.tgz#4041202d508a342ba00174008df0c251b8c135e1" +meow@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/meow/-/meow-5.0.0.tgz#dfc73d63a9afc714a5e371760eb5c88b91078aa4" + integrity sha512-CbTqYU17ABaLefO8vCU153ZZlprKYWDljcndKKDCFcYQITzWCXZAVk4QMFZPgvzrnUQ3uItnIE/LoUOwrT15Ig== dependencies: - readable-stream "^2.0.1" + camelcase-keys "^4.0.0" + decamelize-keys "^1.0.0" + loud-rejection "^1.0.0" + minimist-options "^3.0.1" + normalize-package-data "^2.3.4" + read-pkg-up "^3.0.0" + redent "^2.0.0" + trim-newlines "^2.0.0" + yargs-parser "^10.0.0" -merge2@^1.2.3: - version "1.2.3" - resolved "https://registry.yarnpkg.com/merge2/-/merge2-1.2.3.tgz#7ee99dbd69bb6481689253f018488a1b902b0ed5" - -micromatch@^2.1.5: - version "2.3.11" - resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-2.3.11.tgz#86677c97d1720b363431d04d0d15293bd38c1565" - dependencies: - arr-diff "^2.0.0" - array-unique "^0.2.1" - braces "^1.8.2" - expand-brackets "^0.1.4" - extglob "^0.3.1" - filename-regex "^2.0.0" - is-extglob "^1.0.0" - is-glob "^2.0.1" - kind-of "^3.0.2" - normalize-path "^2.0.1" - object.omit "^2.0.0" - parse-glob "^3.0.4" - regex-cache "^0.4.2" +merge-stream@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/merge-stream/-/merge-stream-2.0.0.tgz#52823629a14dd00c9770fb6ad47dc6310f2c1f60" + integrity sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w== + +merge2@^1.2.3, merge2@^1.3.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/merge2/-/merge2-1.3.0.tgz#5b366ee83b2f1582c48f87e47cf1a9352103ca81" + integrity sha512-2j4DAdlBOkiSZIsaXk4mTE3sRS02yBHAtfy127xRV3bQUFqXkjHCHLW6Scv7DwNRbIWNHH8zpnz9zMaKXIdvYw== + +mergeiterator@^1.2.5: + version "1.2.5" + resolved "https://registry.yarnpkg.com/mergeiterator/-/mergeiterator-1.2.5.tgz#40f0a27888f2eb85d80fa4c29632cf400a0b8c7b" + integrity sha512-KVZWGnRkEgmVewnpVIEUm/KuQ2kHx4T0zYQlPbGypBk4kM5sJ1+7bPDR2N4yg3EoS1CiGKk2GRb5PkAsMEoh3w== -micromatch@^3.0.4, micromatch@^3.1.10, micromatch@^3.1.4, micromatch@^3.1.8: +micromatch@^3.0.4, micromatch@^3.1.10, micromatch@^3.1.4: version "3.1.10" resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-3.1.10.tgz#70859bc95c9840952f359a068a3fc49f9ecfac23" integrity sha512-MWikgl9n9M3w+bpsY3He8L+w9eF9338xRl8IAO5viDizwSzziFEyUzo2xrrloB64ADbTf8uA8vRqqttDTOmccg== @@ -6729,74 +7270,93 @@ micromatch@^3.0.4, micromatch@^3.1.10, micromatch@^3.1.4, micromatch@^3.1.8: snapdragon "^0.8.1" to-regex "^3.0.2" +micromatch@^4.0.2: + version "4.0.2" + resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-4.0.2.tgz#4fcb0999bf9fbc2fcbdd212f6d629b9a56c39259" + integrity sha512-y7FpHSbMUMoyPbYUSzO6PaZ6FyRnQOpHuKwbo1G+Knck95XVU4QAiKdGEnj5wwoS7PlOgthX/09u5iFJ+aYf5Q== + dependencies: + braces "^3.0.1" + picomatch "^2.0.5" + miller-rabin@^4.0.0: version "4.0.1" resolved "https://registry.yarnpkg.com/miller-rabin/-/miller-rabin-4.0.1.tgz#f080351c865b0dc562a8462966daa53543c78a4d" + integrity sha512-115fLhvZVqWwHPbClyntxEVfVDfl9DLLTuJvq3g2O/Oxi8AiNouAHvDSzHS0viUJc+V5vm3eq91Xwqn9dp4jRA== dependencies: bn.js "^4.0.0" brorand "^1.0.1" -mime-db@~1.38.0: - version "1.38.0" - resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.38.0.tgz#1a2aab16da9eb167b49c6e4df2d9c68d63d8e2ad" - integrity sha512-bqVioMFFzc2awcdJZIzR3HjZFX20QhilVS7hytkKrv7xFAn8bM1gzc/FOX2awLISvWe0PV8ptFKcon+wZ5qYkg== +mime-db@1.42.0: + version "1.42.0" + resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.42.0.tgz#3e252907b4c7adb906597b4b65636272cf9e7bac" + integrity sha512-UbfJCR4UAVRNgMpfImz05smAXK7+c+ZntjaA26ANtkXLlOe947Aag5zdIcKQULAiF9Cq4WxBi9jUs5zkA84bYQ== mime-types@^2.1.12, mime-types@~2.1.19: - version "2.1.22" - resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.22.tgz#fe6b355a190926ab7698c9a0556a11199b2199bd" - integrity sha512-aGl6TZGnhm/li6F7yx82bJiBZwgiEa4Hf6CNr8YO+r5UHr53tSTYZb102zyU50DOWWKeOv0uQLRL0/9EiKWCog== + version "2.1.25" + resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.25.tgz#39772d46621f93e2a80a856c53b86a62156a6437" + integrity sha512-5KhStqB5xpTAeGqKBAMgwaYMnQik7teQN4IAzC7npDv6kzeU6prfkR67bc87J1kWMPGkoaZSq1npmexMgkmEVg== dependencies: - mime-db "~1.38.0" + mime-db "1.42.0" mimic-fn@^1.0.0: version "1.2.0" resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-1.2.0.tgz#820c86a39334640e99516928bd03fca88057d022" + integrity sha512-jf84uxzwiuiIVKiOLpfYk7N46TSy8ubTonmneY9vrpHNAnp0QBt2BxWV9dO3/j+BoVAb+a5G6YDPW3M5HOdMWQ== -minimalistic-assert@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/minimalistic-assert/-/minimalistic-assert-1.0.0.tgz#702be2dda6b37f4836bcb3f5db56641b64a1d3d3" +mimic-fn@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-2.1.0.tgz#7ed2c2ccccaf84d3ffcb7a69b57711fc2083401b" + integrity sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg== + +minimalistic-assert@^1.0.0, minimalistic-assert@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz#2e194de044626d4a10e7f7fbc00ce73e83e4d5c7" + integrity sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A== minimalistic-crypto-utils@^1.0.0, minimalistic-crypto-utils@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz#f6c00c1c0b082246e5c4d99dfb8c7c083b2b582a" + integrity sha1-9sAMHAsIIkblxNmd+4x8CDsrWCo= minimatch@^3.0.0, minimatch@^3.0.4: version "3.0.4" resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083" + integrity sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA== dependencies: brace-expansion "^1.1.7" minimist-options@^3.0.1: version "3.0.2" resolved "https://registry.yarnpkg.com/minimist-options/-/minimist-options-3.0.2.tgz#fba4c8191339e13ecf4d61beb03f070103f3d954" + integrity sha512-FyBrT/d0d4+uiZRbqznPXqw3IpZZG3gl3wKWiX784FycUKVwBt0uLBFkQrtE4tZOrgo78nZp2jnKz3L65T5LdQ== dependencies: arrify "^1.0.1" is-plain-obj "^1.1.0" -minimist@0.0.8, minimist@~0.0.1: - version "0.0.8" - resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.0.8.tgz#857fcabfc3397d2625b8228262e86aa7a011b05d" - -minimist@^1.1.0, minimist@^1.1.1, minimist@^1.1.3, minimist@^1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.0.tgz#a35008b20f41383eec1fb914f4cd5df79a264284" +minimist@^1.1.0, minimist@^1.1.1, minimist@^1.1.3, minimist@^1.2.0, minimist@^1.2.5: + version "1.2.5" + resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.5.tgz#67d66014b66a6a8aaa0c083c5fd58df4e4e97602" + integrity sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw== -minipass@^2.2.1, minipass@^2.3.4, minipass@^2.3.5: - version "2.3.5" - resolved "https://registry.yarnpkg.com/minipass/-/minipass-2.3.5.tgz#cacebe492022497f656b0f0f51e2682a9ed2d848" +minipass@^2.3.5, minipass@^2.6.0, minipass@^2.8.6, minipass@^2.9.0: + version "2.9.0" + resolved "https://registry.yarnpkg.com/minipass/-/minipass-2.9.0.tgz#e713762e7d3e32fed803115cf93e04bca9fcc9a6" + integrity sha512-wxfUjg9WebH+CUDX/CdbRlh5SmfZiy/hpkxaRI16Y9W56Pa75sWgd/rvFilSgrauD9NyFymP/+JFV3KwzIsJeg== dependencies: safe-buffer "^5.1.2" yallist "^3.0.0" -minizlib@^1.1.1: - version "1.2.1" - resolved "https://registry.yarnpkg.com/minizlib/-/minizlib-1.2.1.tgz#dd27ea6136243c7c880684e8672bb3a45fd9b614" +minizlib@^1.2.1: + version "1.3.3" + resolved "https://registry.yarnpkg.com/minizlib/-/minizlib-1.3.3.tgz#2290de96818a34c29551c8a8d301216bd65a861d" + integrity sha512-6ZYMOEnmVsdCeTJVE0W9ZD+pVnE8h9Hma/iOwwRDsdQoePpoX56/8B6z3P9VNwppJuBKNRuFDRNRqRWexT9G9Q== dependencies: - minipass "^2.2.1" + minipass "^2.9.0" mississippi@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/mississippi/-/mississippi-3.0.0.tgz#ea0a3291f97e0b5e8776b363d5f0a12d94c67022" + integrity sha512-x471SsVjUtBRtcvd4BzKE9kFC+/2TeWgKCgw0bZcw1b9l2X3QX5vCWgF+KaZaYm87Ss//rHnWryupDrgLvmSkA== dependencies: concat-stream "^1.5.0" duplexify "^3.4.2" @@ -6810,29 +7370,40 @@ mississippi@^3.0.0: through2 "^2.0.0" mixin-deep@^1.2.0: - version "1.3.1" - resolved "https://registry.yarnpkg.com/mixin-deep/-/mixin-deep-1.3.1.tgz#a49e7268dce1a0d9698e45326c5626df3543d0fe" + version "1.3.2" + resolved "https://registry.yarnpkg.com/mixin-deep/-/mixin-deep-1.3.2.tgz#1120b43dc359a785dce65b55b82e257ccf479566" + integrity sha512-WRoDn//mXBiJ1H40rqa3vH0toePwSsGb45iInWlTySa+Uu4k3tYUSxa2v1KqAiLtvlrSzaExqS1gtk96A9zvEA== dependencies: for-in "^1.0.2" is-extendable "^1.0.1" -mkdirp@^0.5.0, mkdirp@^0.5.1, mkdirp@~0.5.0: - version "0.5.1" - resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.1.tgz#30057438eac6cf7f8c4767f38648d6697d75c903" +mkdirp-promise@^5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/mkdirp-promise/-/mkdirp-promise-5.0.1.tgz#e9b8f68e552c68a9c1713b84883f7a1dd039b8a1" + integrity sha1-6bj2jlUsaKnBcTuEiD96HdA5uKE= + dependencies: + mkdirp "*" + +mkdirp@*, mkdirp@^0.5.0, mkdirp@^0.5.1: + version "0.5.3" + resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.3.tgz#5a514b7179259287952881e94410ec5465659f8c" + integrity sha512-P+2gwrFqx8lhew375MQHHeTlY8AuOJSrGf0R5ddkEndUkmwpgUob/vQuBD1V22/Cw1/lJr4x+EjllSezBThzBg== dependencies: - minimist "0.0.8" + minimist "^1.2.5" modify-values@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/modify-values/-/modify-values-1.0.0.tgz#e2b6cdeb9ce19f99317a53722f3dbf5df5eaaab2" + version "1.0.1" + resolved "https://registry.yarnpkg.com/modify-values/-/modify-values-1.0.1.tgz#b3939fa605546474e3e3e3c63d64bd43b4ee6022" + integrity sha512-xV2bxeN6F7oYjZWTe/YPAy6MN2M+sL4u/Rlm2AHCIVGfo2p1yGmBHQ6vHehl4bRTZBdHu3TSkWdYgkwpYzAGSw== module-deps@^6.0.0: - version "6.1.0" - resolved "https://registry.yarnpkg.com/module-deps/-/module-deps-6.1.0.tgz#d1e1efc481c6886269f7112c52c3236188e16479" + version "6.2.1" + resolved "https://registry.yarnpkg.com/module-deps/-/module-deps-6.2.1.tgz#cfe558784060e926824f474b4e647287837cda50" + integrity sha512-UnEn6Ah36Tu4jFiBbJVUtt0h+iXqxpLqDvPS8nllbw5RZFmNJ1+Mz5BjYnM9ieH80zyxHkARGLnMIHlPK5bu6A== dependencies: JSONStream "^1.0.3" browser-resolve "^1.7.0" - cached-path-relative "^1.0.0" + cached-path-relative "^1.0.2" concat-stream "~1.6.0" defined "^1.0.0" detective "^5.0.2" @@ -6849,6 +7420,7 @@ module-deps@^6.0.0: move-concurrently@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/move-concurrently/-/move-concurrently-1.0.1.tgz#be2c005fda32e0b29af1f05d7c4b33214c701f92" + integrity sha1-viwAX9oy4LKa8fBdfEszIUxwH5I= dependencies: aproba "^1.1.1" copy-concurrently "^1.0.0" @@ -6860,43 +7432,72 @@ move-concurrently@^1.0.1: ms@2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8" + integrity sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g= ms@^2.0.0, ms@^2.1.1: - version "2.1.1" - resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.1.tgz#30a5864eb3ebb0a66f2ebe6d727af06a09d86e0a" + version "2.1.2" + resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009" + integrity sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w== -multimatch@^2.0.0, multimatch@^2.1.0: +multimatch@^2.0.0: version "2.1.0" resolved "https://registry.yarnpkg.com/multimatch/-/multimatch-2.1.0.tgz#9c7906a22fb4c02919e2f5f75161b4cdbd4b2a2b" + integrity sha1-nHkGoi+0wCkZ4vX3UWG0zb1LKis= dependencies: array-differ "^1.0.0" array-union "^1.0.1" arrify "^1.0.0" minimatch "^3.0.0" +multimatch@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/multimatch/-/multimatch-3.0.0.tgz#0e2534cc6bc238d9ab67e1b9cd5fcd85a6dbf70b" + integrity sha512-22foS/gqQfANZ3o+W7ST2x25ueHDVNWl/b9OlGcLpy/iKxjCpvcNCM51YCenUi7Mt/jAjjqv8JwZRs8YP5sRjA== + dependencies: + array-differ "^2.0.3" + array-union "^1.0.2" + arrify "^1.0.1" + minimatch "^3.0.4" + mute-stdout@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/mute-stdout/-/mute-stdout-1.0.0.tgz#5b32ea07eb43c9ded6130434cf926f46b2a7fd4d" + version "1.0.1" + resolved "https://registry.yarnpkg.com/mute-stdout/-/mute-stdout-1.0.1.tgz#acb0300eb4de23a7ddeec014e3e96044b3472331" + integrity sha512-kDcwXR4PS7caBpuRYYBUz9iVixUk3anO3f5OYFiIPwK/20vCzKCHyKoulbiDY1S53zD2bxUpxN/IJ+TnXjfvxg== -mute-stream@0.0.7, mute-stream@~0.0.4: +mute-stream@0.0.7: version "0.0.7" resolved "https://registry.yarnpkg.com/mute-stream/-/mute-stream-0.0.7.tgz#3075ce93bc21b8fab43e1bc4da7e8115ed1e7bab" + integrity sha1-MHXOk7whuPq0PhvE2n6BFe0ee6s= + +mute-stream@0.0.8, mute-stream@~0.0.4: + version "0.0.8" + resolved "https://registry.yarnpkg.com/mute-stream/-/mute-stream-0.0.8.tgz#1630c42b2251ff81e2a283de96a5497ea92e5e0d" + integrity sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA== + +mz@^2.5.0: + version "2.7.0" + resolved "https://registry.yarnpkg.com/mz/-/mz-2.7.0.tgz#95008057a56cafadc2bc63dde7f9ff6955948e32" + integrity sha512-z81GNO7nnYMEhrGh9LeymoE4+Yr0Wn5McHIZMK5cfQCl+NDX08sCZgUc9/6MHni9IWuFLm1Z3HTCXu2z9fN62Q== + dependencies: + any-promise "^1.0.0" + object-assign "^4.0.1" + thenify-all "^1.0.0" nan@^2.12.1: - version "2.13.2" - resolved "https://registry.yarnpkg.com/nan/-/nan-2.13.2.tgz#f51dc7ae66ba7d5d55e1e6d4d8092e802c9aefe7" - integrity sha512-TghvYc72wlMGMVMluVo9WRJc0mB8KxxF/gZ4YYFy7V2ZQX9l7rgbPg7vjS9mt6U5HXODVFVI2bOduCzwOMv/lw== + version "2.14.0" + resolved "https://registry.yarnpkg.com/nan/-/nan-2.14.0.tgz#7818f722027b2459a86f0295d434d1fc2336c52c" + integrity sha512-INOFj37C7k3AfaNTtX8RhsTw7qRy7eLET14cROi9+5HAVbbHuIWUHEauBv5qT4Av2tWasiTY1Jw6puUNqRJXQg== nanomatch@^1.2.9: - version "1.2.9" - resolved "https://registry.yarnpkg.com/nanomatch/-/nanomatch-1.2.9.tgz#879f7150cb2dab7a471259066c104eee6e0fa7c2" + version "1.2.13" + resolved "https://registry.yarnpkg.com/nanomatch/-/nanomatch-1.2.13.tgz#b87a8aa4fc0de8fe6be88895b38983ff265bd119" + integrity sha512-fpoe2T0RbHwBTBUOftAfBPaDEi06ufaUai0mE6Yn1kacc3SnTErfb/h+X94VXzI64rKFHYImXSvdwGGCmwOqCA== dependencies: arr-diff "^4.0.0" array-unique "^0.3.2" define-property "^2.0.2" extend-shallow "^3.0.2" fragment-cache "^0.2.1" - is-odd "^2.0.0" is-windows "^1.0.2" kind-of "^6.0.2" object.pick "^1.3.0" @@ -6907,38 +7508,36 @@ nanomatch@^1.2.9: natural-compare@^1.4.0: version "1.4.0" resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7" - -ncname@1.0.x: - version "1.0.0" - resolved "https://registry.yarnpkg.com/ncname/-/ncname-1.0.0.tgz#5b57ad18b1ca092864ef62b0b1ed8194f383b71c" - dependencies: - xml-char-classes "^1.0.0" + integrity sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc= needle@^2.2.1: - version "2.2.4" - resolved "https://registry.yarnpkg.com/needle/-/needle-2.2.4.tgz#51931bff82533b1928b7d1d69e01f1b00ffd2a4e" + version "2.4.0" + resolved "https://registry.yarnpkg.com/needle/-/needle-2.4.0.tgz#6833e74975c444642590e15a750288c5f939b57c" + integrity sha512-4Hnwzr3mi5L97hMYeNl8wRW/Onhy4nUKR/lVemJ8gJedxxUyBLm9kkrDColJvoSfwi0jCNhD+xCdOtiGDQiRZg== dependencies: - debug "^2.1.2" + debug "^3.2.6" iconv-lite "^0.4.4" sax "^1.2.4" -neo-async@^2.5.0: - version "2.5.0" - resolved "https://registry.yarnpkg.com/neo-async/-/neo-async-2.5.0.tgz#76b1c823130cca26acfbaccc8fbaf0a2fa33b18f" +neo-async@^2.6.0: + version "2.6.1" + resolved "https://registry.yarnpkg.com/neo-async/-/neo-async-2.6.1.tgz#ac27ada66167fa8849a6addd837f6b189ad2081c" + integrity sha512-iyam8fBuCUpWeKPGpaNMetEocMt364qkCsfL9JuhjXX6dRnguRVOfk2GZaDpPjcOKiiXCPINZC1GczQ7iTq3Zw== -nice-try@^1.0.4: - version "1.0.4" - resolved "https://registry.yarnpkg.com/nice-try/-/nice-try-1.0.4.tgz#d93962f6c52f2c1558c0fbda6d512819f1efe1c4" +next-tick@~1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/next-tick/-/next-tick-1.0.0.tgz#ca86d1fe8828169b0120208e3dc8424b9db8342c" + integrity sha1-yobR/ogoFpsBICCOPchCS524NCw= -no-case@^2.2.0: - version "2.3.2" - resolved "https://registry.yarnpkg.com/no-case/-/no-case-2.3.2.tgz#60b813396be39b3f1288a4c1ed5d1e7d28b464ac" - dependencies: - lower-case "^1.1.1" +nice-try@^1.0.4: + version "1.0.5" + resolved "https://registry.yarnpkg.com/nice-try/-/nice-try-1.0.5.tgz#a3378a7696ce7d223e88fc9b764bd7ef1089e366" + integrity sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ== node-fetch-npm@^2.0.2: version "2.0.2" resolved "https://registry.yarnpkg.com/node-fetch-npm/-/node-fetch-npm-2.0.2.tgz#7258c9046182dca345b4208eda918daf33697ff7" + integrity sha512-nJIxm1QmAj4v3nfCvEeCrYSoVwXyxLnaPBK5W1W5DGEJwjlKuC2VEUycGw5oxk+4zZahRrB84PUJJgEmhFTDFw== dependencies: encoding "^0.1.11" json-parse-better-errors "^1.0.0" @@ -6947,6 +7546,7 @@ node-fetch-npm@^2.0.2: node-fetch@^1.7.0: version "1.7.3" resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-1.7.3.tgz#980f6f72d85211a5347c6b2bc18c5b84c3eb47ef" + integrity sha512-NhZ4CsKx7cYm2vSrBAr2PvFOe6sWDf0UYLRqA6svUYg7+/TSfVAu49jYC4BvQ4Sms9SZgdqGBgroqfDhJdTyKQ== dependencies: encoding "^0.1.11" is-stream "^1.0.1" @@ -6956,65 +7556,41 @@ node-fetch@^2.3.0, node-fetch@^2.5.0: resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.0.tgz#e633456386d4aa55863f676a7ab0daa8fdecb0fd" integrity sha512-8dG4H5ujfvFiqDmVu9fQ5bOHUC15JMjMY/Zumv26oOvvVJjM67KF8koCWIabKQ1GJIa9r2mMZscBq/TbdOcmNA== -node-gyp@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/node-gyp/-/node-gyp-4.0.0.tgz#972654af4e5dd0cd2a19081b4b46fe0442ba6f45" - integrity sha512-2XiryJ8sICNo6ej8d0idXDEMKfVfFK7kekGCtJAuelGsYHQxhj13KTf95swTCN2dZ/4lTfZ84Fu31jqJEEgjWA== +node-gyp@^5.0.2: + version "5.0.5" + resolved "https://registry.yarnpkg.com/node-gyp/-/node-gyp-5.0.5.tgz#f6cf1da246eb8c42b097d7cd4d6c3ce23a4163af" + integrity sha512-WABl9s4/mqQdZneZHVWVG4TVr6QQJZUC6PAx47ITSk9lreZ1n+7Z9mMAIbA3vnO4J9W20P7LhCxtzfWsAD/KDw== dependencies: + env-paths "^1.0.0" glob "^7.0.3" graceful-fs "^4.1.2" mkdirp "^0.5.0" nopt "2 || 3" npmlog "0 || 1 || 2 || 3 || 4" - osenv "0" request "^2.87.0" rimraf "2" semver "~5.3.0" - tar "^4.4.8" + tar "^4.4.12" which "1" node-int64@^0.4.0: version "0.4.0" resolved "https://registry.yarnpkg.com/node-int64/-/node-int64-0.4.0.tgz#87a9065cdb355d3182d8f94ce11188b825c68a3b" - -node-libs-browser@^2.0.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/node-libs-browser/-/node-libs-browser-2.1.0.tgz#5f94263d404f6e44767d726901fff05478d600df" - dependencies: - assert "^1.1.1" - browserify-zlib "^0.2.0" - buffer "^4.3.0" - console-browserify "^1.1.0" - constants-browserify "^1.0.0" - crypto-browserify "^3.11.0" - domain-browser "^1.1.1" - events "^1.0.0" - https-browserify "^1.0.0" - os-browserify "^0.3.0" - path-browserify "0.0.0" - process "^0.11.10" - punycode "^1.2.4" - querystring-es3 "^0.2.0" - readable-stream "^2.3.3" - stream-browserify "^2.0.1" - stream-http "^2.7.2" - string_decoder "^1.0.0" - timers-browserify "^2.0.4" - tty-browserify "0.0.0" - url "^0.11.0" - util "^0.10.3" - vm-browserify "0.0.4" + integrity sha1-h6kGXNs1XTGC2PlM4RGIuCXGijs= node-modules-regexp@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/node-modules-regexp/-/node-modules-regexp-1.0.0.tgz#8d9dbe28964a4ac5712e9131642107c71e90ec40" + integrity sha1-jZ2+KJZKSsVxLpExZCEHxx6Q7EA= -node-notifier@^5.2.1: - version "5.2.1" - resolved "https://registry.yarnpkg.com/node-notifier/-/node-notifier-5.2.1.tgz#fa313dd08f5517db0e2502e5758d664ac69f9dea" +node-notifier@^5.4.2: + version "5.4.3" + resolved "https://registry.yarnpkg.com/node-notifier/-/node-notifier-5.4.3.tgz#cb72daf94c93904098e28b9c590fd866e464bd50" + integrity sha512-M4UBGcs4jeOK9CjTsYwkvH6/MzuUmGCyTW+kCY7uO+1ZVr0+FHGdPdIf5CCLqAaxnRrWidyoQlNkMIIVwbKB8Q== dependencies: growly "^1.3.0" - semver "^5.4.1" + is-wsl "^1.1.0" + semver "^5.5.0" shellwords "^0.1.1" which "^1.3.0" @@ -7034,22 +7610,24 @@ node-pre-gyp@^0.12.0: semver "^5.3.0" tar "^4" -node-releases@^1.1.19: - version "1.1.19" - resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-1.1.19.tgz#c492d1e381fea0350b338b646c27867e88e91b3d" - integrity sha512-SH/B4WwovHbulIALsQllAVwqZZD1kPmKCqrhGfR29dXjLAVZMHvBjD3S6nL9D/J9QkmZ1R92/0wCMDKXUUvyyA== +node-releases@^1.1.50: + version "1.1.51" + resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-1.1.51.tgz#70d0e054221343d2966006bfbd4d98622cc00bd0" + integrity sha512-1eQEs6HFYY1kMXQPOLzCf7HdjReErmvn85tZESMczdCNVWP3Y7URYLBAyYynuI7yef1zj4HN5q+oB2x67QU0lw== dependencies: - semver "^5.3.0" + semver "^6.3.0" "nopt@2 || 3": version "3.0.6" resolved "https://registry.yarnpkg.com/nopt/-/nopt-3.0.6.tgz#c6465dbf08abcd4db359317f79ac68a646b28ff9" + integrity sha1-xkZdvwirzU2zWTF/eaxopkayj/k= dependencies: abbrev "1" nopt@^4.0.1: version "4.0.1" resolved "https://registry.yarnpkg.com/nopt/-/nopt-4.0.1.tgz#d0d4685afd5415193c8c7505602d0d17cd64474d" + integrity sha1-0NRoWv1UFRk8jHUFYC0NF81kR00= dependencies: abbrev "1" osenv "^0.1.4" @@ -7064,9 +7642,10 @@ normalize-package-data@^2.0.0, normalize-package-data@^2.3.0, normalize-package- semver "2 || 3 || 4 || 5" validate-npm-package-license "^3.0.1" -normalize-path@^2.0.0, normalize-path@^2.0.1, normalize-path@^2.1.1: +normalize-path@^2.1.1: version "2.1.1" resolved "https://registry.yarnpkg.com/normalize-path/-/normalize-path-2.1.1.tgz#1ab28b556e198363a8c1a6f7e6fa20137fe6aed9" + integrity sha1-GrKLVW4Zg2Oowab35vogE3/mrtk= dependencies: remove-trailing-separator "^1.0.1" @@ -7081,23 +7660,25 @@ normalize-url@^3.3.0: integrity sha512-U+JJi7duF1o+u2pynbp2zXDW2/PADgC30f0GsHZtRh+HOcXHnw137TrNlyxxRvWW5fjKd3bcLHPxofWuCjaeZg== now-and-later@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/now-and-later/-/now-and-later-2.0.0.tgz#bc61cbb456d79cb32207ce47ca05136ff2e7d6ee" + version "2.0.1" + resolved "https://registry.yarnpkg.com/now-and-later/-/now-and-later-2.0.1.tgz#8e579c8685764a7cc02cb680380e94f43ccb1f7c" + integrity sha512-KGvQ0cB70AQfg107Xvs/Fbu+dGmZoTRJp2TaPwcwQm3/7PteUyN2BCgk8KBMPGBUXZdVwyWS8fDCGFygBm19UQ== dependencies: once "^1.3.2" npm-bundled@^1.0.1: - version "1.0.3" - resolved "https://registry.yarnpkg.com/npm-bundled/-/npm-bundled-1.0.3.tgz#7e71703d973af3370a9591bafe3a63aca0be2308" + version "1.1.0" + resolved "https://registry.yarnpkg.com/npm-bundled/-/npm-bundled-1.1.0.tgz#2e8fdb7e69eff2df963937b696243316537c284b" + integrity sha512-ez6dcKBFNo4FvlMqscBEFUum6M2FTLW5grqm3DyBKB5XOyKVCeeWvAuoZtbmW/5Cv8EM2bQUOA6ufxa/TKVN0g== -npm-lifecycle@^2.1.1: - version "2.1.1" - resolved "https://registry.yarnpkg.com/npm-lifecycle/-/npm-lifecycle-2.1.1.tgz#0027c09646f0fd346c5c93377bdaba59c6748fdf" - integrity sha512-+Vg6I60Z75V/09pdcH5iUo/99Q/vop35PaI99elvxk56azSVVsdsSsS/sXqKDNwbRRNN1qSxkcO45ZOu0yOWew== +npm-lifecycle@^3.1.2: + version "3.1.4" + resolved "https://registry.yarnpkg.com/npm-lifecycle/-/npm-lifecycle-3.1.4.tgz#de6975c7d8df65f5150db110b57cce498b0b604c" + integrity sha512-tgs1PaucZwkxECGKhC/stbEgFyc3TGh2TJcg2CDr6jbvQRdteHNhmMeljRzpe4wgFAXQADoy1cSqqi7mtiAa5A== dependencies: byline "^5.0.0" graceful-fs "^4.1.15" - node-gyp "^4.0.0" + node-gyp "^5.0.2" resolve-from "^4.0.0" slide "^1.1.6" uid-number "0.0.6" @@ -7105,31 +7686,27 @@ npm-lifecycle@^2.1.1: which "^1.3.1" "npm-package-arg@^4.0.0 || ^5.0.0 || ^6.0.0", npm-package-arg@^6.0.0, npm-package-arg@^6.1.0: - version "6.1.0" - resolved "https://registry.yarnpkg.com/npm-package-arg/-/npm-package-arg-6.1.0.tgz#15ae1e2758a5027efb4c250554b85a737db7fcc1" + version "6.1.1" + resolved "https://registry.yarnpkg.com/npm-package-arg/-/npm-package-arg-6.1.1.tgz#02168cb0a49a2b75bf988a28698de7b529df5cb7" + integrity sha512-qBpssaL3IOZWi5vEKUKW0cO7kzLeT+EQO9W8RsLOZf76KF9E/K9+wH0C7t06HXPpaH8WH5xF1MExLuCwbTqRUg== dependencies: - hosted-git-info "^2.6.0" + hosted-git-info "^2.7.1" osenv "^0.1.5" - semver "^5.5.0" + semver "^5.6.0" validate-npm-package-name "^3.0.0" -npm-packlist@^1.1.12, npm-packlist@^1.1.6, npm-packlist@^1.4.1: - version "1.4.1" - resolved "https://registry.yarnpkg.com/npm-packlist/-/npm-packlist-1.4.1.tgz#19064cdf988da80ea3cee45533879d90192bbfbc" - integrity sha512-+TcdO7HJJ8peiiYhvPxsEDhF3PJFGUGRcFsGve3vxvxdcpO2Z4Z7rkosRM0kWj6LfbK/P0gu3dzk5RU1ffvFcw== +npm-packlist@^1.1.6, npm-packlist@^1.4.4: + version "1.4.6" + resolved "https://registry.yarnpkg.com/npm-packlist/-/npm-packlist-1.4.6.tgz#53ba3ed11f8523079f1457376dd379ee4ea42ff4" + integrity sha512-u65uQdb+qwtGvEJh/DgQgW1Xg7sqeNbmxYyrvlNznaVTjV3E5P6F/EFjM+BVHXl7JJlsdG8A64M0XI8FI/IOlg== dependencies: ignore-walk "^3.0.1" npm-bundled "^1.0.1" -npm-path@^2.0.2: - version "2.0.4" - resolved "https://registry.yarnpkg.com/npm-path/-/npm-path-2.0.4.tgz#c641347a5ff9d6a09e4d9bce5580c4f505278e64" - dependencies: - which "^1.2.10" - -npm-pick-manifest@^2.2.3: - version "2.2.3" - resolved "https://registry.yarnpkg.com/npm-pick-manifest/-/npm-pick-manifest-2.2.3.tgz#32111d2a9562638bb2c8f2bf27f7f3092c8fae40" +npm-pick-manifest@^3.0.0: + version "3.0.2" + resolved "https://registry.yarnpkg.com/npm-pick-manifest/-/npm-pick-manifest-3.0.2.tgz#f4d9e5fd4be2153e5f4e5f9b7be8dc419a99abb7" + integrity sha512-wNprTNg+X5nf+tDi+hbjdHhM4bX+mKqv6XmPh7B5eG+QY9VARfQPfCEH013H5GqfNj6ee8Ij2fg8yk0mzps1Vw== dependencies: figgy-pudding "^3.5.1" npm-package-arg "^6.0.0" @@ -7138,70 +7715,91 @@ npm-pick-manifest@^2.2.3: npm-run-path@^2.0.0: version "2.0.2" resolved "https://registry.yarnpkg.com/npm-run-path/-/npm-run-path-2.0.2.tgz#35a9232dfa35d7067b4cb2ddf2357b1871536c5f" + integrity sha1-NakjLfo11wZ7TLLd8jV7GHFTbF8= dependencies: path-key "^2.0.0" -npm-which@^3.0.1: - version "3.0.1" - resolved "https://registry.yarnpkg.com/npm-which/-/npm-which-3.0.1.tgz#9225f26ec3a285c209cae67c3b11a6b4ab7140aa" +npm-run-path@^3.0.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/npm-run-path/-/npm-run-path-3.1.0.tgz#7f91be317f6a466efed3c9f2980ad8a4ee8b0fa5" + integrity sha512-Dbl4A/VfiVGLgQv29URL9xshU8XDY1GeLy+fsaZ1AA8JDSfjvr5P5+pzRbWqRSBxk6/DW7MIh8lTM/PaGnP2kg== dependencies: - commander "^2.9.0" - npm-path "^2.0.2" - which "^1.2.10" + path-key "^3.0.0" "npmlog@0 || 1 || 2 || 3 || 4", npmlog@^4.0.2, npmlog@^4.1.2: version "4.1.2" resolved "https://registry.yarnpkg.com/npmlog/-/npmlog-4.1.2.tgz#08a7f2a8bf734604779a9efa4ad5cc717abb954b" + integrity sha512-2uUqazuKlTaSI/dC8AzicUck7+IrEaOnN/e0jd3Xtt1KcGpwx30v50mL7oPyr/h9bL3E4aZccVwpwP+5W9Vjkg== dependencies: are-we-there-yet "~1.1.2" console-control-strings "~1.1.0" gauge "~2.7.3" set-blocking "~2.0.0" -nth-check@~1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/nth-check/-/nth-check-1.0.1.tgz#9929acdf628fc2c41098deab82ac580cf149aae4" - dependencies: - boolbase "~1.0.0" - number-is-nan@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/number-is-nan/-/number-is-nan-1.0.1.tgz#097b602b53422a522c1afb8790318336941a011d" + integrity sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0= -nwmatcher@^1.4.3: - version "1.4.3" - resolved "https://registry.yarnpkg.com/nwmatcher/-/nwmatcher-1.4.3.tgz#64348e3b3d80f035b40ac11563d278f8b72db89c" +nwsapi@^2.0.7: + version "2.2.0" + resolved "https://registry.yarnpkg.com/nwsapi/-/nwsapi-2.2.0.tgz#204879a9e3d068ff2a55139c2c772780681a38b7" + integrity sha512-h2AatdwYH+JHiZpv7pt/gSX1XoRGb7L/qSIeuqA6GwYoF9w1vP1cw42TO0aI2pNyshRK5893hNSl+1//vHK7hQ== oauth-sign@~0.9.0: version "0.9.0" resolved "https://registry.yarnpkg.com/oauth-sign/-/oauth-sign-0.9.0.tgz#47a7b016baa68b5fa0ecf3dee08a85c679ac6455" + integrity sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ== -object-assign@^4.0.1, object-assign@^4.1.0: +object-assign@^4.0.1, object-assign@^4.1.0, object-assign@^4.1.1: version "4.1.1" resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863" + integrity sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM= object-copy@^0.1.0: version "0.1.0" resolved "https://registry.yarnpkg.com/object-copy/-/object-copy-0.1.0.tgz#7e7d858b781bd7c991a41ba975ed3812754e998c" + integrity sha1-fn2Fi3gb18mRpBupde04EnVOmYw= dependencies: copy-descriptor "^0.1.0" define-property "^0.2.5" kind-of "^3.0.3" -object-keys@^1.0.11, object-keys@^1.0.12, object-keys@^1.0.6, object-keys@^1.0.8: +object-inspect@^1.7.0: + version "1.7.0" + resolved "https://registry.yarnpkg.com/object-inspect/-/object-inspect-1.7.0.tgz#f4f6bd181ad77f006b5ece60bd0b6f398ff74a67" + integrity sha512-a7pEHdh1xKIAgTySUGgLMx/xwDZskN1Ud6egYYN3EdRW4ZMPNEDUTF+hwy2LUC+Bl+SyLXANnwz/jyh/qutKUw== + +object-keys@^1.0.11, object-keys@^1.0.12, object-keys@^1.0.6, object-keys@^1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/object-keys/-/object-keys-1.1.1.tgz#1c47f272df277f3b1daf061677d9c82e2322c60e" integrity sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA== +object-keys@~0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/object-keys/-/object-keys-0.2.0.tgz#cddec02998b091be42bf1035ae32e49f1cb6ea67" + integrity sha1-zd7AKZiwkb5CvxA1rjLknxy26mc= + dependencies: + foreach "~2.0.1" + indexof "~0.0.1" + is "~0.2.6" + +object-keys@~0.4.0: + version "0.4.0" + resolved "https://registry.yarnpkg.com/object-keys/-/object-keys-0.4.0.tgz#28a6aae7428dd2c3a92f3d95f21335dd204e0336" + integrity sha1-KKaq50KN0sOpLz2V8hM13SBOAzY= + object-visit@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/object-visit/-/object-visit-1.0.1.tgz#f79c4493af0c5377b59fe39d395e41042dd045bb" + integrity sha1-95xEk68MU3e1n+OdOV5BBC3QRbs= dependencies: isobject "^3.0.0" -object.assign@^4.0.4: +object.assign@^4.0.4, object.assign@^4.1.0: version "4.1.0" resolved "https://registry.yarnpkg.com/object.assign/-/object.assign-4.1.0.tgz#968bf1100d7956bb3ca086f006f846b3bc4008da" + integrity sha512-exHJeq6kBKj58mqGyTQ9DFvrZC/eR6OwxzoM9YRoGBqrXYonaFyGiFMuc9VZrXf7DarreEwMpurG3dd+CNyW5w== dependencies: define-properties "^1.1.2" function-bind "^1.1.1" @@ -7211,6 +7809,7 @@ object.assign@^4.0.4: object.defaults@^1.0.0, object.defaults@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/object.defaults/-/object.defaults-1.1.0.tgz#3a7f868334b407dea06da16d88d5cd29e435fecf" + integrity sha1-On+GgzS0B96gbaFtiNXNKeQ1/s8= dependencies: array-each "^1.0.1" array-slice "^1.0.0" @@ -7220,6 +7819,7 @@ object.defaults@^1.0.0, object.defaults@^1.1.0: object.getownpropertydescriptors@^2.0.3: version "2.0.3" resolved "https://registry.yarnpkg.com/object.getownpropertydescriptors/-/object.getownpropertydescriptors-2.0.3.tgz#8758c846f5b407adab0f236e0986f14b051caa16" + integrity sha1-h1jIRvW0B62rDyNuCYbxSwUcqhY= dependencies: define-properties "^1.1.2" es-abstract "^1.5.1" @@ -7227,30 +7827,41 @@ object.getownpropertydescriptors@^2.0.3: object.map@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/object.map/-/object.map-1.0.1.tgz#cf83e59dc8fcc0ad5f4250e1f78b3b81bd801d37" + integrity sha1-z4Plncj8wK1fQlDh94s7gb2AHTc= dependencies: for-own "^1.0.0" make-iterator "^1.0.0" -object.omit@^2.0.0: - version "2.0.1" - resolved "https://registry.yarnpkg.com/object.omit/-/object.omit-2.0.1.tgz#1a9c744829f39dbb858c76ca3579ae2a54ebd1fa" - dependencies: - for-own "^0.1.4" - is-extendable "^0.1.1" - object.pick@^1.2.0, object.pick@^1.3.0: version "1.3.0" resolved "https://registry.yarnpkg.com/object.pick/-/object.pick-1.3.0.tgz#87a10ac4c1694bd2e1cbf53591a66141fb5dd747" + integrity sha1-h6EKxMFpS9Lhy/U1kaZhQftd10c= dependencies: isobject "^3.0.1" object.reduce@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/object.reduce/-/object.reduce-1.0.1.tgz#6fe348f2ac7fa0f95ca621226599096825bb03ad" + integrity sha1-b+NI8qx/oPlcpiEiZZkJaCW7A60= dependencies: for-own "^1.0.0" make-iterator "^1.0.0" +object.values@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/object.values/-/object.values-1.1.0.tgz#bf6810ef5da3e5325790eaaa2be213ea84624da9" + integrity sha512-8mf0nKLAoFX6VlNVdhGj31SVYpaNFtUnuoOXWyFEstsWRgU837AK+JYM0iAxwkSzGRbwn8cbFmgbyxj1j4VbXg== + dependencies: + define-properties "^1.1.3" + es-abstract "^1.12.0" + function-bind "^1.1.1" + has "^1.0.3" + +octal@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/octal/-/octal-1.0.0.tgz#63e7162a68efbeb9e213588d58e989d1e5c4530b" + integrity sha1-Y+cWKmjvvrniE1iNWOmJ0eXEUws= + octokit-pagination-methods@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/octokit-pagination-methods/-/octokit-pagination-methods-1.1.0.tgz#cf472edc9d551055f9ef73f6e42b4dbb4c80bea4" @@ -7259,70 +7870,66 @@ octokit-pagination-methods@^1.1.0: once@^1.3.0, once@^1.3.1, once@^1.3.2, once@^1.4.0: version "1.4.0" resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1" + integrity sha1-WDsap3WWHUsROsF9nFC6753Xa9E= dependencies: wrappy "1" onetime@^2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/onetime/-/onetime-2.0.1.tgz#067428230fd67443b2794b22bba528b6867962d4" + integrity sha1-BnQoIw/WdEOyeUsiu6UotoZ5YtQ= dependencies: mimic-fn "^1.0.0" -optimist@^0.6.1: - version "0.6.1" - resolved "https://registry.yarnpkg.com/optimist/-/optimist-0.6.1.tgz#da3ea74686fa21a19a111c326e90eb15a0196686" +onetime@^5.1.0: + version "5.1.0" + resolved "https://registry.yarnpkg.com/onetime/-/onetime-5.1.0.tgz#fff0f3c91617fe62bb50189636e99ac8a6df7be5" + integrity sha512-5NcSkPHhwTVFIQN+TUqXoS5+dlElHXdpAWu9I0HP20YOtIi+aZ0Ct82jdlILDxjLEAWwvm+qj1m6aEtsDVmm6Q== dependencies: - minimist "~0.0.1" - wordwrap "~0.0.2" + mimic-fn "^2.1.0" -optionator@^0.8.1, optionator@^0.8.2: - version "0.8.2" - resolved "https://registry.yarnpkg.com/optionator/-/optionator-0.8.2.tgz#364c5e409d3f4d6301d6c0b4c05bba50180aeb64" +opencollective-postinstall@^2.0.2: + version "2.0.2" + resolved "https://registry.yarnpkg.com/opencollective-postinstall/-/opencollective-postinstall-2.0.2.tgz#5657f1bede69b6e33a45939b061eb53d3c6c3a89" + integrity sha512-pVOEP16TrAO2/fjej1IdOyupJY8KDUM1CvsaScRbw6oddvpQoOfGk4ywha0HKKVAD6RkW4x6Q+tNBwhf3Bgpuw== + +optionator@^0.8.1, optionator@^0.8.3: + version "0.8.3" + resolved "https://registry.yarnpkg.com/optionator/-/optionator-0.8.3.tgz#84fa1d036fe9d3c7e21d99884b601167ec8fb495" + integrity sha512-+IW9pACdk3XWmmTXG8m3upGUJst5XRGzxMRjXzAuJ1XnIFNvfhjjIuYkDvysnPQ7qzqVzLt78BCruntqRhWQbA== dependencies: deep-is "~0.1.3" - fast-levenshtein "~2.0.4" + fast-levenshtein "~2.0.6" levn "~0.3.0" prelude-ls "~1.1.2" type-check "~0.3.2" - wordwrap "~1.0.0" + word-wrap "~1.2.3" ordered-read-streams@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/ordered-read-streams/-/ordered-read-streams-1.0.1.tgz#77c0cb37c41525d64166d990ffad7ec6a0e1363e" + integrity sha1-d8DLN8QVJdZBZtmQ/61+xqDhNj4= dependencies: readable-stream "^2.0.1" -os-browserify@^0.3.0, os-browserify@~0.3.0: +os-browserify@~0.3.0: version "0.3.0" resolved "https://registry.yarnpkg.com/os-browserify/-/os-browserify-0.3.0.tgz#854373c7f5c2315914fc9bfc6bd8238fdda1ec27" + integrity sha1-hUNzx/XCMVkU/Jv8a9gjj92h7Cc= os-homedir@^1.0.0: version "1.0.2" resolved "https://registry.yarnpkg.com/os-homedir/-/os-homedir-1.0.2.tgz#ffbc4988336e0e833de0c168c7ef152121aa7fb3" + integrity sha1-/7xJiDNuDoM94MFox+8VISGqf7M= os-locale@^1.4.0: version "1.4.0" resolved "https://registry.yarnpkg.com/os-locale/-/os-locale-1.4.0.tgz#20f9f17ae29ed345e8bde583b13d2009803c14d9" + integrity sha1-IPnxeuKe00XoveWDsT0gCYA8FNk= dependencies: lcid "^1.0.0" -os-locale@^2.0.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/os-locale/-/os-locale-2.1.0.tgz#42bc2900a6b5b8bd17376c8e882b65afccf24bf2" - dependencies: - execa "^0.7.0" - lcid "^1.0.0" - mem "^1.1.0" - -os-locale@^3.0.0: - version "3.0.1" - resolved "https://registry.yarnpkg.com/os-locale/-/os-locale-3.0.1.tgz#3b014fbf01d87f60a1e5348d80fe870dc82c4620" - dependencies: - execa "^0.10.0" - lcid "^2.0.0" - mem "^4.0.0" - -os-name@^3.0.0: +os-name@^3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/os-name/-/os-name-3.1.0.tgz#dec19d966296e1cd62d701a5a66ee1ddeae70801" integrity sha512-h8L+8aNjNcMpo/mAIBPn5PXCM16iyPGjHNWo6U1YO8sJTMHtEtyczI6QJnLoplswm6goopQkqc7OAnjhWcugVg== @@ -7333,10 +7940,12 @@ os-name@^3.0.0: os-tmpdir@^1.0.0, os-tmpdir@~1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/os-tmpdir/-/os-tmpdir-1.0.2.tgz#bbe67406c79aa85c5cfec766fe5734555dfa1274" + integrity sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ= -osenv@0, osenv@^0.1.4, osenv@^0.1.5: +osenv@^0.1.4, osenv@^0.1.5: version "0.1.5" resolved "https://registry.yarnpkg.com/osenv/-/osenv-0.1.5.tgz#85cdfafaeb28e8677f416e287592b5f3f49ea410" + integrity sha512-0CWcCECdMVc2Rw3U5w9ZjqX6ga6ubk1xDVKxtBQPK7wis/0F2r9T6k4ydGYhecl7YUBxBVxhL5oisPsNxAPe2g== dependencies: os-homedir "^1.0.0" os-tmpdir "^1.0.0" @@ -7344,70 +7953,92 @@ osenv@0, osenv@^0.1.4, osenv@^0.1.5: output-file-sync@^2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/output-file-sync/-/output-file-sync-2.0.1.tgz#f53118282f5f553c2799541792b723a4c71430c0" + integrity sha512-mDho4qm7WgIXIGf4eYU1RHN2UU5tPfVYVSRwDJw0uTmj35DQUt/eNp19N7v6T3SrR0ESTEf2up2CGO73qI35zQ== dependencies: graceful-fs "^4.1.11" is-plain-obj "^1.1.0" mkdirp "^0.5.1" -p-defer@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/p-defer/-/p-defer-1.0.0.tgz#9f6eb182f6c9aa8cd743004a7d4f96b196b0fb0c" - p-each-series@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/p-each-series/-/p-each-series-1.0.0.tgz#930f3d12dd1f50e7434457a22cd6f04ac6ad7f71" + integrity sha1-kw89Et0fUOdDRFeiLNbwSsatf3E= dependencies: p-reduce "^1.0.0" p-finally@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/p-finally/-/p-finally-1.0.0.tgz#3fbcfb15b899a44123b34b6dcc18b724336a2cae" + integrity sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4= -p-is-promise@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/p-is-promise/-/p-is-promise-1.1.0.tgz#9c9456989e9f6588017b0434d56097675c3da05e" +p-finally@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/p-finally/-/p-finally-2.0.1.tgz#bd6fcaa9c559a096b680806f4d657b3f0f240561" + integrity sha512-vpm09aKwq6H9phqRQzecoDpD8TmVyGw70qmWlyq5onxY7tqyTTFVvxMykxQSQKILBSFlbXpypIw2T1Ml7+DDtw== p-limit@^1.1.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-1.2.0.tgz#0e92b6bedcb59f022c13d0f1949dc82d15909f1c" + version "1.3.0" + resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-1.3.0.tgz#b86bd5f0c25690911c7590fcbfc2010d54b3ccb8" + integrity sha512-vvcXsLAJ9Dr5rQOPk7toZQZJApBl2K4J6dANSsEuh6QI41JYcsS/qhTGa9ErIUUgK3WNQoJYvylxvjqmiqEA9Q== dependencies: p-try "^1.0.0" -p-limit@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-2.0.0.tgz#e624ed54ee8c460a778b3c9f3670496ff8a57aec" +p-limit@^2.0.0, p-limit@^2.2.0: + version "2.2.1" + resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-2.2.1.tgz#aa07a788cc3151c939b5131f63570f0dd2009537" + integrity sha512-85Tk+90UCVWvbDavCLKPOLC9vvY8OwEX/RtKF+/1OADJMVlFfEHOiMTPVyxg7mk/dKa+ipdHm0OUkTvCpMTuwg== dependencies: p-try "^2.0.0" p-locate@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/p-locate/-/p-locate-2.0.0.tgz#20a0103b222a70c8fd39cc2e580680f3dde5ec43" + integrity sha1-IKAQOyIqcMj9OcwuWAaA893l7EM= dependencies: p-limit "^1.1.0" p-locate@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/p-locate/-/p-locate-3.0.0.tgz#322d69a05c0264b25997d9f40cd8a891ab0064a4" + integrity sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ== dependencies: p-limit "^2.0.0" +p-locate@^4.1.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/p-locate/-/p-locate-4.1.0.tgz#a3428bb7088b3a60292f66919278b7c297ad4f07" + integrity sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A== + dependencies: + p-limit "^2.2.0" + p-map-series@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/p-map-series/-/p-map-series-1.0.0.tgz#bf98fe575705658a9e1351befb85ae4c1f07bdca" + integrity sha1-v5j+V1cFZYqeE1G++4WuTB8Hvco= dependencies: p-reduce "^1.0.0" -p-map@^1.1.1, p-map@^1.2.0: +p-map@^1.1.1: version "1.2.0" resolved "https://registry.yarnpkg.com/p-map/-/p-map-1.2.0.tgz#e4e94f311eabbc8633a1e79908165fca26241b6b" + integrity sha512-r6zKACMNhjPJMTl8KcFH4li//gkrXWfbD6feV8l6doRHlzljFWGJ2AP6iKaCJXyZmAUMOPtvbW7EXkbWO/pLEA== -p-map@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/p-map/-/p-map-2.0.0.tgz#be18c5a5adeb8e156460651421aceca56c213a50" +p-map@^2.0.0, p-map@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/p-map/-/p-map-2.1.0.tgz#310928feef9c9ecc65b68b17693018a665cea175" + integrity sha512-y3b8Kpd8OAN444hxfBbFfj1FY/RjtTd8tzYwhUqNYXx0fXx2iX4maP4Qr6qhIKbQXI02wTLAda4fYUbDagTUFw== + +p-map@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/p-map/-/p-map-3.0.0.tgz#d704d9af8a2ba684e2600d9a215983d4141a979d" + integrity sha512-d3qXVTF/s+W+CdJ5A29wywV2n8CQQYahlgz2bFiA+4eVNJbHJodPZ+/gXwPGh0bOqA+j8S+6+ckmvLGPk1QpxQ== + dependencies: + aggregate-error "^3.0.0" p-pipe@^1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/p-pipe/-/p-pipe-1.2.0.tgz#4b1a11399a11520a67790ee5a0c1d5881d6befe9" + integrity sha1-SxoROZoRUgpneQ7loMHViB1r7+k= p-queue@^4.0.0: version "4.0.0" @@ -7419,64 +8050,69 @@ p-queue@^4.0.0: p-reduce@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/p-reduce/-/p-reduce-1.0.0.tgz#18c2b0dd936a4690a529f8231f58a0fdb6a47dfa" + integrity sha1-GMKw3ZNqRpClKfgjH1ig/bakffo= p-try@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/p-try/-/p-try-1.0.0.tgz#cbc79cdbaf8fd4228e13f621f2b1a237c1b207b3" + integrity sha1-y8ec26+P1CKOE/Yh8rGiN8GyB7M= p-try@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/p-try/-/p-try-2.0.0.tgz#85080bb87c64688fa47996fe8f7dfbe8211760b1" + version "2.2.0" + resolved "https://registry.yarnpkg.com/p-try/-/p-try-2.2.0.tgz#cb2868540e313d61de58fafbe35ce9004d5540e6" + integrity sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ== p-waterfall@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/p-waterfall/-/p-waterfall-1.0.0.tgz#7ed94b3ceb3332782353af6aae11aa9fc235bb00" + integrity sha1-ftlLPOszMngjU69qrhGqn8I1uwA= dependencies: p-reduce "^1.0.0" pako@~1.0.5: - version "1.0.6" - resolved "https://registry.yarnpkg.com/pako/-/pako-1.0.6.tgz#0101211baa70c4bca4a0f63f2206e97b7dfaf258" + version "1.0.10" + resolved "https://registry.yarnpkg.com/pako/-/pako-1.0.10.tgz#4328badb5086a426aa90f541977d4955da5c9732" + integrity sha512-0DTvPVU3ed8+HNXOu5Bs+o//Mbdj9VNQMUOe9oKCwh8l0GNwpTDMKCWbRjgtD291AWnkAgkqA/LOnQS8AmS1tw== parallel-transform@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/parallel-transform/-/parallel-transform-1.1.0.tgz#d410f065b05da23081fcd10f28854c29bda33b06" + version "1.2.0" + resolved "https://registry.yarnpkg.com/parallel-transform/-/parallel-transform-1.2.0.tgz#9049ca37d6cb2182c3b1d2c720be94d14a5814fc" + integrity sha512-P2vSmIu38uIlvdcU7fDkyrxj33gTUy/ABO5ZUbGowxNCopBq/OoD42bP4UmMrJoPyk4Uqf0mu3mtWBhHCZD8yg== dependencies: - cyclist "~0.2.2" + cyclist "^1.0.1" inherits "^2.0.3" readable-stream "^2.1.5" -param-case@2.1.x: - version "2.1.1" - resolved "https://registry.yarnpkg.com/param-case/-/param-case-2.1.1.tgz#df94fd8cf6531ecf75e6bef9a0858fbc72be2247" - dependencies: - no-case "^2.2.0" - parent-module@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/parent-module/-/parent-module-1.0.0.tgz#df250bdc5391f4a085fb589dad761f5ad6b865b5" + version "1.0.1" + resolved "https://registry.yarnpkg.com/parent-module/-/parent-module-1.0.1.tgz#691d2709e78c79fae3a156622452d00762caaaa2" + integrity sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g== dependencies: callsites "^3.0.0" parents@^1.0.0, parents@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/parents/-/parents-1.0.1.tgz#fedd4d2bf193a77745fe71e371d73c3307d9c751" + integrity sha1-/t1NK/GTp3dF/nHjcdc8MwfZx1E= dependencies: path-platform "~0.11.15" parse-asn1@^5.0.0: - version "5.1.0" - resolved "https://registry.yarnpkg.com/parse-asn1/-/parse-asn1-5.1.0.tgz#37c4f9b7ed3ab65c74817b5f2480937fbf97c712" + version "5.1.5" + resolved "https://registry.yarnpkg.com/parse-asn1/-/parse-asn1-5.1.5.tgz#003271343da58dc94cace494faef3d2147ecea0e" + integrity sha512-jkMYn1dcJqF6d5CpU689bq7w/b5ALS9ROVSpQDPrZsqqesUJii9qutvoT5ltGedNXMO2e16YUWIghG9KxaViTQ== dependencies: asn1.js "^4.0.0" browserify-aes "^1.0.0" create-hash "^1.1.0" evp_bytestokey "^1.0.0" pbkdf2 "^3.0.3" + safe-buffer "^5.1.1" parse-filepath@^1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/parse-filepath/-/parse-filepath-1.0.2.tgz#a632127f53aaf3d15876f5872f3ffac763d6c891" + integrity sha1-pjISf1Oq89FYdvWHLz/6x2PWyJE= dependencies: is-absolute "^1.0.0" map-cache "^0.2.0" @@ -7485,36 +8121,42 @@ parse-filepath@^1.0.1: parse-github-repo-url@^1.3.0: version "1.4.1" resolved "https://registry.yarnpkg.com/parse-github-repo-url/-/parse-github-repo-url-1.4.1.tgz#9e7d8bb252a6cb6ba42595060b7bf6df3dbc1f50" - -parse-glob@^3.0.4: - version "3.0.4" - resolved "https://registry.yarnpkg.com/parse-glob/-/parse-glob-3.0.4.tgz#b2c376cfb11f35513badd173ef0bb6e3a388391c" - dependencies: - glob-base "^0.3.0" - is-dotfile "^1.0.0" - is-extglob "^1.0.0" - is-glob "^2.0.0" + integrity sha1-nn2LslKmy2ukJZUGC3v23z28H1A= parse-json@^2.2.0: version "2.2.0" resolved "https://registry.yarnpkg.com/parse-json/-/parse-json-2.2.0.tgz#f480f40434ef80741f8469099f8dea18f55a4dc9" + integrity sha1-9ID0BDTvgHQfhGkJn43qGPVaTck= dependencies: error-ex "^1.2.0" parse-json@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/parse-json/-/parse-json-4.0.0.tgz#be35f5425be1f7f6c747184f98a788cb99477ee0" + integrity sha1-vjX1Qlvh9/bHRxhPmKeIy5lHfuA= + dependencies: + error-ex "^1.3.1" + json-parse-better-errors "^1.0.1" + +parse-json@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/parse-json/-/parse-json-5.0.0.tgz#73e5114c986d143efa3712d4ea24db9a4266f60f" + integrity sha512-OOY5b7PAEFV0E2Fir1KOkxchnZNCdowAJgQ5NuxjpBKTRP3pQhwkrkxqQjeoKJ+fO7bCpmIZaogI4eZGDMEGOw== dependencies: + "@babel/code-frame" "^7.0.0" error-ex "^1.3.1" json-parse-better-errors "^1.0.1" + lines-and-columns "^1.1.6" parse-node-version@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/parse-node-version/-/parse-node-version-1.0.1.tgz#e2b5dbede00e7fa9bc363607f53327e8b073189b" + integrity sha512-3YHlOa/JgH6Mnpr05jP9eDG254US9ek25LyIxZlDItp2iJtwyaXQb57lBYLdT3MowkUFYEV2XXNAYIPlESvJlA== parse-passwd@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/parse-passwd/-/parse-passwd-1.0.0.tgz#6d5b934a456993b23d37f40a382d6f1666a8e5c6" + integrity sha1-bVuTSkVpk7I9N/QKOC1vFmao5cY= parse-path@^4.0.0: version "4.0.1" @@ -7537,68 +8179,81 @@ parse-url@^5.0.0: parse5@4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/parse5/-/parse5-4.0.0.tgz#6d78656e3da8d78b4ec0b906f7c08ef1dfe3f608" - -parse5@^3.0.1: - version "3.0.3" - resolved "https://registry.yarnpkg.com/parse5/-/parse5-3.0.3.tgz#042f792ffdd36851551cf4e9e066b3874ab45b5c" - dependencies: - "@types/node" "*" + integrity sha512-VrZ7eOd3T1Fk4XWNXMgiGBK/z0MG48BWG2uQNU4I72fkQuKUTZpl+u9k+CxEG0twMVzSmXEEz12z5Fnw1jIQFA== pascalcase@^0.1.1: version "0.1.1" resolved "https://registry.yarnpkg.com/pascalcase/-/pascalcase-0.1.1.tgz#b363e55e8006ca6fe21784d2db22bd15d7917f14" + integrity sha1-s2PlXoAGym/iF4TS2yK9FdeRfxQ= -path-browserify@0.0.0, path-browserify@~0.0.0: - version "0.0.0" - resolved "https://registry.yarnpkg.com/path-browserify/-/path-browserify-0.0.0.tgz#a0b870729aae214005b7d5032ec2cbbb0fb4451a" +path-browserify@~0.0.0: + version "0.0.1" + resolved "https://registry.yarnpkg.com/path-browserify/-/path-browserify-0.0.1.tgz#e6c4ddd7ed3aa27c68a20cc4e50e1a4ee83bbc4a" + integrity sha512-BapA40NHICOS+USX9SN4tyhq+A2RrN/Ws5F0Z5aMHDp98Fl86lX8Oti8B7uN93L4Ifv4fHOEA+pQw87gmMO/lQ== path-dirname@^1.0.0: version "1.0.2" resolved "https://registry.yarnpkg.com/path-dirname/-/path-dirname-1.0.2.tgz#cc33d24d525e099a5388c0336c6e32b9160609e0" + integrity sha1-zDPSTVJeCZpTiMAzbG4yuRYGCeA= path-exists@^2.0.0: version "2.1.0" resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-2.1.0.tgz#0feb6c64f0fc518d9a754dd5efb62c7022761f4b" + integrity sha1-D+tsZPD8UY2adU3V77YscCJ2H0s= dependencies: pinkie-promise "^2.0.0" path-exists@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-3.0.0.tgz#ce0ebeaa5f78cb18925ea7d810d7b59b010fd515" + integrity sha1-zg6+ql94yxiSXqfYENe1mwEP1RU= + +path-exists@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-4.0.0.tgz#513bdbe2d3b95d7762e8c1137efa195c6c61b5b3" + integrity sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w== path-is-absolute@^1.0.0, path-is-absolute@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f" - -path-is-inside@^1.0.1, path-is-inside@^1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/path-is-inside/-/path-is-inside-1.0.2.tgz#365417dede44430d1c11af61027facf074bdfc53" + integrity sha1-F0uSaHNVNP+8es5r9TpanhtcX18= path-key@^2.0.0, path-key@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/path-key/-/path-key-2.0.1.tgz#411cadb574c5a140d3a4b1910d40d80cc9f40b40" + integrity sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A= + +path-key@^3.0.0, path-key@^3.1.0: + version "3.1.1" + resolved "https://registry.yarnpkg.com/path-key/-/path-key-3.1.1.tgz#581f6ade658cbba65a0d3380de7753295054f375" + integrity sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q== path-parse@^1.0.6: version "1.0.6" resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.6.tgz#d62dbb5679405d72c4737ec58600e9ddcf06d24c" + integrity sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw== path-platform@~0.11.15: version "0.11.15" resolved "https://registry.yarnpkg.com/path-platform/-/path-platform-0.11.15.tgz#e864217f74c36850f0852b78dc7bf7d4a5721bf2" + integrity sha1-6GQhf3TDaFDwhSt43Hv31KVyG/I= path-root-regex@^0.1.0: version "0.1.2" resolved "https://registry.yarnpkg.com/path-root-regex/-/path-root-regex-0.1.2.tgz#bfccdc8df5b12dc52c8b43ec38d18d72c04ba96d" + integrity sha1-v8zcjfWxLcUsi0PsONGNcsBLqW0= path-root@^0.1.1: version "0.1.1" resolved "https://registry.yarnpkg.com/path-root/-/path-root-0.1.1.tgz#9a4a6814cac1c0cd73360a95f32083c8ea4745b7" + integrity sha1-mkpoFMrBwM1zNgqV8yCDyOpHRbc= dependencies: path-root-regex "^0.1.0" path-type@^1.0.0: version "1.1.0" resolved "https://registry.yarnpkg.com/path-type/-/path-type-1.1.0.tgz#59c44f7ee491da704da415da5a4070ba4f8fe441" + integrity sha1-WcRPfuSR2nBNpBXaWkBwuk+P5EE= dependencies: graceful-fs "^4.1.2" pify "^2.0.0" @@ -7607,18 +8262,26 @@ path-type@^1.0.0: path-type@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/path-type/-/path-type-2.0.0.tgz#f012ccb8415b7096fc2daa1054c3d72389594c73" + integrity sha1-8BLMuEFbcJb8LaoQVMPXI4lZTHM= dependencies: pify "^2.0.0" path-type@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/path-type/-/path-type-3.0.0.tgz#cef31dc8e0a1a3bb0d105c0cd97cf3bf47f4e36f" + integrity sha512-T2ZUsdZFHgA3u4e5PfPbjd7HDDpxPnQb5jN0SrDsjNSuVXHJqtwTnWqG0B1jZrgmJ/7lj1EmVIByWt1gxGkWvg== dependencies: pify "^3.0.0" +path-type@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/path-type/-/path-type-4.0.0.tgz#84ed01c0a7ba380afe09d90a8c180dcd9d03043b" + integrity sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw== + pbkdf2@^3.0.3: - version "3.0.14" - resolved "https://registry.yarnpkg.com/pbkdf2/-/pbkdf2-3.0.14.tgz#a35e13c64799b06ce15320f459c230e68e73bade" + version "3.0.17" + resolved "https://registry.yarnpkg.com/pbkdf2/-/pbkdf2-3.0.17.tgz#976c206530617b14ebb32114239f7b09336e93a6" + integrity sha512-U/il5MsrZp7mGg3mSQfn742na2T+1/vHDCG5/iTI3X9MKUuYUZVLQhyRsg06mCgDBTd57TxzgZt7P+fYfjRLtA== dependencies: create-hash "^1.1.2" create-hmac "^1.1.4" @@ -7629,14 +8292,22 @@ pbkdf2@^3.0.3: performance-now@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/performance-now/-/performance-now-2.1.0.tgz#6309f4e0e5fa913ec1c69307ae364b4b377c9e7b" + integrity sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns= + +picomatch@^2.0.5: + version "2.1.1" + resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.1.1.tgz#ecdfbea7704adb5fe6fb47f9866c4c0e15e905c5" + integrity sha512-OYMyqkKzK7blWO/+XZYP6w8hH0LDvkBvdvKukti+7kqYFCiEAk+gI3DWnryapc0Dau05ugGTy0foQ6mqn4AHYA== pify@^2.0.0, pify@^2.3.0: version "2.3.0" resolved "https://registry.yarnpkg.com/pify/-/pify-2.3.0.tgz#ed141a6ac043a849ea588498e7dca8b15330e90c" + integrity sha1-7RQaasBDqEnqWISY59yosVMw6Qw= pify@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/pify/-/pify-3.0.0.tgz#e5a4acd2c101fdf3d9a4d07f0dbc4db49dd28176" + integrity sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY= pify@^4.0.1: version "4.0.1" @@ -7646,12 +8317,14 @@ pify@^4.0.1: pinkie-promise@^2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/pinkie-promise/-/pinkie-promise-2.0.1.tgz#2135d6dfa7a358c069ac9b178776288228450ffa" + integrity sha1-ITXW36ejWMBprJsXh3YogihFD/o= dependencies: pinkie "^2.0.0" pinkie@^2.0.0: version "2.0.4" resolved "https://registry.yarnpkg.com/pinkie/-/pinkie-2.0.4.tgz#72556b80cfa0d48a974e80e77248e80ed4f7f870" + integrity sha1-clVrgM+g1IqXToDnckjoDtT3+HA= pirates@^4.0.0, pirates@^4.0.1: version "4.0.1" @@ -7663,40 +8336,35 @@ pirates@^4.0.0, pirates@^4.0.1: pkg-dir@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/pkg-dir/-/pkg-dir-2.0.0.tgz#f6d5d1109e19d63edf428e0bd57e12777615334b" + integrity sha1-9tXREJ4Z1j7fQo4L1X4Sd3YVM0s= dependencies: find-up "^2.1.0" pkg-dir@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/pkg-dir/-/pkg-dir-3.0.0.tgz#2749020f239ed990881b1f71210d51eb6523bea3" + integrity sha512-/E57AYkoeQ25qkxMj5PBOVgF8Kiu/h7cYS30Z5+R7WaiCCBfLq58ZI/dSeaEKb9WVJV5n/03QwrN3IeWIFllvw== dependencies: find-up "^3.0.0" -pkg-dir@^4.1.0: - version "4.1.0" - resolved "https://registry.yarnpkg.com/pkg-dir/-/pkg-dir-4.1.0.tgz#aaeb91c0d3b9c4f74a44ad849f4de34781ae01de" - integrity sha512-55k9QN4saZ8q518lE6EFgYiu95u3BWkSajCifhdQjvLvmr8IpnRbhI+UGpWJQfa0KzDguHeeWT1ccO1PmkOi3A== +pkg-dir@^4.2.0: + version "4.2.0" + resolved "https://registry.yarnpkg.com/pkg-dir/-/pkg-dir-4.2.0.tgz#f099133df7ede422e81d1d8448270eeb3e4261f3" + integrity sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ== dependencies: - find-up "^3.0.0" + find-up "^4.0.0" -please-upgrade-node@^3.0.2, please-upgrade-node@^3.1.1: - version "3.1.1" - resolved "https://registry.yarnpkg.com/please-upgrade-node/-/please-upgrade-node-3.1.1.tgz#ed320051dfcc5024fae696712c8288993595e8ac" +please-upgrade-node@^3.1.1, please-upgrade-node@^3.2.0: + version "3.2.0" + resolved "https://registry.yarnpkg.com/please-upgrade-node/-/please-upgrade-node-3.2.0.tgz#aeddd3f994c933e4ad98b99d9a556efa0e2fe942" + integrity sha512-gQR3WpIgNIKwBMVLkpMUeR3e1/E1y42bqDQZfql+kDeXd8COYfM8PQA4X6y7a8u9Ua9FHmsrrmirW2vHs45hWg== dependencies: semver-compare "^1.0.0" -plugin-error@1.0.1, plugin-error@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/plugin-error/-/plugin-error-1.0.1.tgz#77016bd8919d0ac377fdcdd0322328953ca5781c" - dependencies: - ansi-colors "^1.0.1" - arr-diff "^4.0.0" - arr-union "^3.1.0" - extend-shallow "^3.0.2" - plugin-error@^0.1.2: version "0.1.2" resolved "https://registry.yarnpkg.com/plugin-error/-/plugin-error-0.1.2.tgz#3b9bb3335ccf00f425e07437e19276967da47ace" + integrity sha1-O5uzM1zPAPQl4HQ34ZJ2ln2kes4= dependencies: ansi-cyan "^0.1.1" ansi-red "^0.1.1" @@ -7704,39 +8372,49 @@ plugin-error@^0.1.2: arr-union "^2.0.1" extend-shallow "^1.1.2" +plugin-error@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/plugin-error/-/plugin-error-1.0.1.tgz#77016bd8919d0ac377fdcdd0322328953ca5781c" + integrity sha512-L1zP0dk7vGweZME2i+EeakvUNqSrdiI3F91TwEoYiGrAfUXmVv6fJIq4g82PAXxNsWOp0J7ZqQy/3Szz0ajTxA== + dependencies: + ansi-colors "^1.0.1" + arr-diff "^4.0.0" + arr-union "^3.1.0" + extend-shallow "^3.0.2" + pn@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/pn/-/pn-1.1.0.tgz#e2f4cef0e219f463c179ab37463e4e1ecdccbafb" + integrity sha512-2qHaIQr2VLRFoxe2nASzsV6ef4yOOH+Fi9FBOVH6cqeSgUnoyySPZkxzLuzd+RYOQTRpROA0ztTMqxROKSb/nA== posix-character-classes@^0.1.0: version "0.1.1" resolved "https://registry.yarnpkg.com/posix-character-classes/-/posix-character-classes-0.1.1.tgz#01eac0fe3b5af71a2a6c02feabb8c1fef7e00eab" + integrity sha1-AerA/jta9xoqbAL+q7jB/vfgDqs= prelude-ls@~1.1.2: version "1.1.2" resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.1.2.tgz#21932a549f5e52ffd9a827f570e04be62a97da54" - -preserve@^0.2.0: - version "0.2.0" - resolved "https://registry.yarnpkg.com/preserve/-/preserve-0.2.0.tgz#815ed1f6ebc65926f865b310c0713bcb3315ce4b" + integrity sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ= prettier-linter-helpers@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/prettier-linter-helpers/-/prettier-linter-helpers-1.0.0.tgz#d23d41fe1375646de2d0104d3454a3008802cf7b" + integrity sha512-GbK2cP9nraSSUF9N2XwUwqfzlAFlMNYYl+ShE/V+H8a9uNl/oUqB1w2EL54Jh0OlyRSd8RfWYJ3coVS4TROP2w== dependencies: fast-diff "^1.1.2" -prettier@^1.17.1: - version "1.17.1" - resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.17.1.tgz#ed64b4e93e370cb8a25b9ef7fef3e4fd1c0995db" - integrity sha512-TzGRNvuUSmPgwivDqkZ9tM/qTGW9hqDKWOE9YHiyQdixlKbv7kvEqsmDPrcHJTKwthU774TQwZXVtaQ/mMsvjg== +prettier@^1.19.1: + version "1.19.1" + resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.19.1.tgz#f7d7f5ff8a9cd872a7be4ca142095956a60797cb" + integrity sha512-s7PoyDv/II1ObgQunCbB9PdLmUcBZcnWOcxDh7O0N/UwDEsHyqkW+Qh28jW+mVuCdx7gLB0BotYI1Y6uI9iyew== -pretty-format@^24.8.0: - version "24.8.0" - resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-24.8.0.tgz#8dae7044f58db7cb8be245383b565a963e3c27f2" - integrity sha512-P952T7dkrDEplsR+TuY7q3VXDae5Sr7zmQb12JU/NDQa/3CH7/QW0yvqLcGN6jL+zQFKaoJcPc+yJxMTGmosqw== +pretty-format@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-24.9.0.tgz#12fac31b37019a4eea3c11aa9a959eb7628aa7c9" + integrity sha512-00ZMZUiHaJrNfk33guavqgvfJS30sLYf0f8+Srklv0AMPodGGHcoHgksZ3OThYnIvOd+8yMCn0YiEOogjlgsnA== dependencies: - "@jest/types" "^24.8.0" + "@jest/types" "^24.9.0" ansi-regex "^4.0.0" ansi-styles "^3.2.0" react-is "^16.8.4" @@ -7744,63 +8422,70 @@ pretty-format@^24.8.0: pretty-hrtime@^1.0.0: version "1.0.3" resolved "https://registry.yarnpkg.com/pretty-hrtime/-/pretty-hrtime-1.0.3.tgz#b7e3ea42435a4c9b2759d99e0f201eb195802ee1" + integrity sha1-t+PqQkNaTJsnWdmeDyAesZWALuE= -private@^0.1.6, private@~0.1.5: +private@^0.1.8: version "0.1.8" resolved "https://registry.yarnpkg.com/private/-/private-0.1.8.tgz#2381edb3689f7a53d653190060fcf822d2f368ff" + integrity sha512-VvivMrbvd2nKkiG38qjULzlc+4Vx4wm/whI9pQD35YrARNnhxeiRktSOhSukRLFNlzg6Br/cJPet5J/u19r/mg== -process-nextick-args@^1.0.6, process-nextick-args@^1.0.7, process-nextick-args@~1.0.6: - version "1.0.7" - resolved "https://registry.yarnpkg.com/process-nextick-args/-/process-nextick-args-1.0.7.tgz#150e20b756590ad3f91093f25a4f2ad8bff30ba3" +process-es6@^0.11.2, process-es6@^0.11.6: + version "0.11.6" + resolved "https://registry.yarnpkg.com/process-es6/-/process-es6-0.11.6.tgz#c6bb389f9a951f82bd4eb169600105bd2ff9c778" + integrity sha1-xrs4n5qVH4K9TrFpYAEFvS/5x3g= -process-nextick-args@~2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/process-nextick-args/-/process-nextick-args-2.0.0.tgz#a37d732f4271b4ab1ad070d35508e8290788ffaa" +process-nextick-args@^2.0.0, process-nextick-args@~2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/process-nextick-args/-/process-nextick-args-2.0.1.tgz#7820d9b16120cc55ca9ae7792680ae7dba6d7fe2" + integrity sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag== -process@^0.11.10, process@~0.11.0: +process@~0.11.0: version "0.11.10" resolved "https://registry.yarnpkg.com/process/-/process-0.11.10.tgz#7332300e840161bda3e69a1d1d91a7d4bc16f182" + integrity sha1-czIwDoQBYb2j5podHZGn1LwW8YI= progress@^1.1.8: version "1.1.8" resolved "https://registry.yarnpkg.com/progress/-/progress-1.1.8.tgz#e260c78f6161cdd9b0e56cc3e0a85de17c7a57be" + integrity sha1-4mDHj2Fhzdmw5WzD4Khd4Xx6V74= progress@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/progress/-/progress-2.0.0.tgz#8a1be366bf8fc23db2bd23f10c6fe920b4389d1f" + version "2.0.3" + resolved "https://registry.yarnpkg.com/progress/-/progress-2.0.3.tgz#7e8cf8d8f5b8f239c1bc68beb4eb78567d572ef8" + integrity sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA== promise-inflight@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/promise-inflight/-/promise-inflight-1.0.1.tgz#98472870bf228132fcbdd868129bad12c3c029e3" + integrity sha1-mEcocL8igTL8vdhoEputEsPAKeM= promise-retry@^1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/promise-retry/-/promise-retry-1.1.1.tgz#6739e968e3051da20ce6497fb2b50f6911df3d6d" + integrity sha1-ZznpaOMFHaIM5kl/srUPaRHfPW0= dependencies: err-code "^1.0.0" retry "^0.10.0" prompts@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/prompts/-/prompts-2.0.1.tgz#201b3718b4276fb407f037db48c0029d6465245c" + version "2.3.0" + resolved "https://registry.yarnpkg.com/prompts/-/prompts-2.3.0.tgz#a444e968fa4cc7e86689a74050685ac8006c4cc4" + integrity sha512-NfbbPPg/74fT7wk2XYQ7hAIp9zJyZp5Fu19iRbORqqy1BhtrkZ0fPafBU+7bmn8ie69DpT0R6QpJIN2oisYjJg== dependencies: - kleur "^3.0.0" - sisteransi "^1.0.0" + kleur "^3.0.3" + sisteransi "^1.0.3" promzard@^0.3.0: version "0.3.0" resolved "https://registry.yarnpkg.com/promzard/-/promzard-0.3.0.tgz#26a5d6ee8c7dee4cb12208305acfb93ba382a9ee" + integrity sha1-JqXW7ox97kyxIggwWs+5O6OCqe4= dependencies: read "1" -property-expr@^1.5.0: - version "1.5.1" - resolved "https://registry.yarnpkg.com/property-expr/-/property-expr-1.5.1.tgz#22e8706894a0c8e28d58735804f6ba3a3673314f" - integrity sha512-CGuc0VUTGthpJXL36ydB6jnbyOf/rAHFvmVrJlH+Rg0DqqLFQGAP6hIaxD/G0OAmBJPhXDHuEJigrp0e0wFV6g== - proto-list@~1.2.1: version "1.2.4" resolved "https://registry.yarnpkg.com/proto-list/-/proto-list-1.2.4.tgz#212d5bfe1318306a420f6402b8e26ff39647a849" + integrity sha1-IS1b/hMYMGpCD2QCuOJv85ZHqEk= protocols@^1.1.0, protocols@^1.4.0: version "1.4.7" @@ -7810,34 +8495,41 @@ protocols@^1.1.0, protocols@^1.4.0: protoduck@^5.0.1: version "5.0.1" resolved "https://registry.yarnpkg.com/protoduck/-/protoduck-5.0.1.tgz#03c3659ca18007b69a50fd82a7ebcc516261151f" + integrity sha512-WxoCeDCoCBY55BMvj4cAEjdVUFGRWed9ZxPlqTKYyw1nDDTQ4pqmnIMAGfJlg7Dx35uB/M+PHJPTmGOvaCaPTg== dependencies: genfun "^5.0.0" +prr@~0.0.0: + version "0.0.0" + resolved "https://registry.yarnpkg.com/prr/-/prr-0.0.0.tgz#1a84b85908325501411853d0081ee3fa86e2926a" + integrity sha1-GoS4WQgyVQFBGFPQCB7j+obikmo= + prr@~1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/prr/-/prr-1.0.1.tgz#d3fc114ba06995a45ec6893f484ceb1d78f5f476" + integrity sha1-0/wRS6BplaRexok/SEzrHXj19HY= -pseudomap@^1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/pseudomap/-/pseudomap-1.0.2.tgz#f052a28da70e618917ef0a8ac34c1ae5a68286b3" - -psl@^1.1.24: - version "1.1.31" - resolved "https://registry.yarnpkg.com/psl/-/psl-1.1.31.tgz#e9aa86d0101b5b105cbe93ac6b784cd547276184" +psl@^1.1.24, psl@^1.1.28: + version "1.6.0" + resolved "https://registry.yarnpkg.com/psl/-/psl-1.6.0.tgz#60557582ee23b6c43719d9890fb4170ecd91e110" + integrity sha512-SYKKmVel98NCOYXpkwUqZqh0ahZeeKfmisiLIcEZdsb+WbLv02g/dI5BUmZnIyOe7RzZtLax81nnb2HbvC2tzA== public-encrypt@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/public-encrypt/-/public-encrypt-4.0.0.tgz#39f699f3a46560dd5ebacbca693caf7c65c18cc6" + version "4.0.3" + resolved "https://registry.yarnpkg.com/public-encrypt/-/public-encrypt-4.0.3.tgz#4fcc9d77a07e48ba7527e7cbe0de33d0701331e0" + integrity sha512-zVpa8oKZSz5bTMTFClc1fQOnyyEzpl5ozpi1B5YcvBrdohMjH2rfsBtyXcuNuwjsDIXmBYlF2N5FlJYhR29t8Q== dependencies: bn.js "^4.1.0" browserify-rsa "^4.0.0" create-hash "^1.1.0" parse-asn1 "^5.0.0" randombytes "^2.0.1" + safe-buffer "^5.1.2" pump@^2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/pump/-/pump-2.0.1.tgz#12399add6e4cf7526d973cbc8b5ce2e2908b3909" + integrity sha512-ruPMNRkN3MHP1cWJc9OWr+T/xDP0jhXYCLfJcBuX54hhfIBnaQmAUMfDcG4DM5UMWByBbJY69QSphm3jtDKIkA== dependencies: end-of-stream "^1.1.0" once "^1.3.1" @@ -7845,6 +8537,7 @@ pump@^2.0.0: pump@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/pump/-/pump-3.0.0.tgz#b4a2116815bde2f4e1ea602354e8c75565107a64" + integrity sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww== dependencies: end-of-stream "^1.1.0" once "^1.3.1" @@ -7852,6 +8545,7 @@ pump@^3.0.0: pumpify@^1.3.3, pumpify@^1.3.5: version "1.5.1" resolved "https://registry.yarnpkg.com/pumpify/-/pumpify-1.5.1.tgz#36513be246ab27570b1a374a5ce278bfd74370ce" + integrity sha512-oClZI37HvuUJJxSKKrC17bZ9Cu0ZYhEAGPsPUy9KlMUmv9dKX2o77RUmq7f3XjIxbwyGwYzbzQ1L2Ks8sIradQ== dependencies: duplexify "^3.6.0" inherits "^2.0.3" @@ -7860,51 +8554,54 @@ pumpify@^1.3.3, pumpify@^1.3.5: punycode@1.3.2: version "1.3.2" resolved "https://registry.yarnpkg.com/punycode/-/punycode-1.3.2.tgz#9653a036fb7c1ee42342f2325cceefea3926c48d" + integrity sha1-llOgNvt8HuQjQvIyXM7v6jkmxI0= -punycode@^1.2.4, punycode@^1.3.2, punycode@^1.4.1: +punycode@^1.3.2, punycode@^1.4.1: version "1.4.1" resolved "https://registry.yarnpkg.com/punycode/-/punycode-1.4.1.tgz#c0d5a63b2718800ad8e1eb0fa5269c84dd41845e" + integrity sha1-wNWmOycYgArY4esPpSachN1BhF4= -punycode@^2.1.0: +punycode@^2.1.0, punycode@^2.1.1: version "2.1.1" resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.1.1.tgz#b58b010ac40c22c5657616c8d2c2c02c7bf479ec" + integrity sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A== q@^1.5.1: version "1.5.1" resolved "https://registry.yarnpkg.com/q/-/q-1.5.1.tgz#7e32f75b41381291d04611f1bf14109ac00651d7" + integrity sha1-fjL3W0E4EpHQRhHxvxQQmsAGUdc= qs@~6.5.2: version "6.5.2" resolved "https://registry.yarnpkg.com/qs/-/qs-6.5.2.tgz#cb3ae806e8740444584ef154ce8ee98d403f3e36" + integrity sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA== -querystring-es3@^0.2.0, querystring-es3@~0.2.0: +querystring-es3@~0.2.0: version "0.2.1" resolved "https://registry.yarnpkg.com/querystring-es3/-/querystring-es3-0.2.1.tgz#9ec61f79049875707d69414596fd907a4d711e73" + integrity sha1-nsYfeQSYdXB9aUFFlv2Qek1xHnM= querystring@0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/querystring/-/querystring-0.2.0.tgz#b209849203bb25df820da756e747005878521620" + integrity sha1-sgmEkgO7Jd+CDadW50cAWHhSFiA= quick-lru@^1.0.0: version "1.1.0" resolved "https://registry.yarnpkg.com/quick-lru/-/quick-lru-1.1.0.tgz#4360b17c61136ad38078397ff11416e186dcfbb8" - -randomatic@^1.1.3: - version "1.1.7" - resolved "https://registry.yarnpkg.com/randomatic/-/randomatic-1.1.7.tgz#c7abe9cc8b87c0baa876b19fde83fd464797e38c" - dependencies: - is-number "^3.0.0" - kind-of "^4.0.0" + integrity sha1-Q2CxfGETatOAeDl/8RQW4Ybc+7g= randombytes@^2.0.0, randombytes@^2.0.1, randombytes@^2.0.5: - version "2.0.6" - resolved "https://registry.yarnpkg.com/randombytes/-/randombytes-2.0.6.tgz#d302c522948588848a8d300c932b44c24231da80" + version "2.1.0" + resolved "https://registry.yarnpkg.com/randombytes/-/randombytes-2.1.0.tgz#df6f84372f0270dc65cdf6291349ab7a473d4f2a" + integrity sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ== dependencies: safe-buffer "^5.1.0" randomfill@^1.0.3: version "1.0.4" resolved "https://registry.yarnpkg.com/randomfill/-/randomfill-1.0.4.tgz#c92196fc86ab42be983f1bf31778224931d61458" + integrity sha512-87lcbR8+MhcWcUiQ+9e+Rwx8MyR2P7qnt15ynUlbm3TU/fjbgz4GsvfSUDTemtCCtVCqb4ZcEFlyPNTh9bBTLw== dependencies: randombytes "^2.0.5" safe-buffer "^5.1.0" @@ -7912,6 +8609,7 @@ randomfill@^1.0.3: rc@^1.2.7: version "1.2.8" resolved "https://registry.yarnpkg.com/rc/-/rc-1.2.8.tgz#cd924bf5200a075b83c188cd6b9e211b7fc0d3ed" + integrity sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw== dependencies: deep-extend "^0.6.0" ini "~1.3.0" @@ -7919,25 +8617,28 @@ rc@^1.2.7: strip-json-comments "~2.0.1" react-is@^16.8.4: - version "16.8.4" - resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.8.4.tgz#90f336a68c3a29a096a3d648ab80e87ec61482a2" - integrity sha512-PVadd+WaUDOAciICm/J1waJaSvgq+4rHE/K70j0PFqKhkTBsPv/82UGQJNXAngz1fOQLLxI6z1sEDmJDQhCTAA== + version "16.12.0" + resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.12.0.tgz#2cc0fe0fba742d97fd527c42a13bec4eeb06241c" + integrity sha512-rPCkf/mWBtKc97aLL9/txD8DZdemK0vkA3JMLShjlJB3Pj3s+lpf1KaBzMfQrAmhMQB0n1cU/SUGgKKBCe837Q== read-cmd-shim@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/read-cmd-shim/-/read-cmd-shim-1.0.1.tgz#2d5d157786a37c055d22077c32c53f8329e91c7b" + version "1.0.5" + resolved "https://registry.yarnpkg.com/read-cmd-shim/-/read-cmd-shim-1.0.5.tgz#87e43eba50098ba5a32d0ceb583ab8e43b961c16" + integrity sha512-v5yCqQ/7okKoZZkBQUAfTsQ3sVJtXdNfbPnI5cceppoxEVLYA3k+VtV2omkeo8MS94JCy4fSiUwlRBAwCVRPUA== dependencies: graceful-fs "^4.1.2" read-only-stream@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/read-only-stream/-/read-only-stream-2.0.0.tgz#2724fd6a8113d73764ac288d4386270c1dbf17f0" + integrity sha1-JyT9aoET1zdkrCiNQ4YnDB2/F/A= dependencies: readable-stream "^2.0.2" "read-package-json@1 || 2", read-package-json@^2.0.0, read-package-json@^2.0.13: - version "2.0.13" - resolved "https://registry.yarnpkg.com/read-package-json/-/read-package-json-2.0.13.tgz#2e82ebd9f613baa6d2ebe3aa72cefe3f68e41f4a" + version "2.1.0" + resolved "https://registry.yarnpkg.com/read-package-json/-/read-package-json-2.1.0.tgz#e3d42e6c35ea5ae820d9a03ab0c7291217fc51d5" + integrity sha512-KLhu8M1ZZNkMcrq1+0UJbR8Dii8KZUqB0Sha4mOx/bknfKI/fyrQVrG/YIt2UOtG667sD8+ee4EXMM91W9dC+A== dependencies: glob "^7.1.1" json-parse-better-errors "^1.0.1" @@ -7947,18 +8648,18 @@ read-only-stream@^2.0.0: graceful-fs "^4.1.2" read-package-tree@^5.1.6: - version "5.2.1" - resolved "https://registry.yarnpkg.com/read-package-tree/-/read-package-tree-5.2.1.tgz#6218b187d6fac82289ce4387bbbaf8eef536ad63" + version "5.3.1" + resolved "https://registry.yarnpkg.com/read-package-tree/-/read-package-tree-5.3.1.tgz#a32cb64c7f31eb8a6f31ef06f9cedf74068fe636" + integrity sha512-mLUDsD5JVtlZxjSlPPx1RETkNjjvQYuweKwNVt1Sn8kP5Jh44pvYuUHCp6xSVDZWbNxVxG5lyZJ921aJH61sTw== dependencies: - debuglog "^1.0.1" - dezalgo "^1.0.0" - once "^1.3.0" read-package-json "^2.0.0" readdir-scoped-modules "^1.0.0" + util-promisify "^2.1.0" read-pkg-up@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/read-pkg-up/-/read-pkg-up-1.0.1.tgz#9d63c13276c065918d57f002a57f40a1b643fb02" + integrity sha1-nWPBMnbAZZGNV/ACpX9AobZD+wI= dependencies: find-up "^1.0.0" read-pkg "^1.0.0" @@ -7966,6 +8667,7 @@ read-pkg-up@^1.0.1: read-pkg-up@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/read-pkg-up/-/read-pkg-up-2.0.0.tgz#6b72a8048984e0c41e79510fd5e9fa99b3b549be" + integrity sha1-a3KoBImE4MQeeVEP1en6mbO1Sb4= dependencies: find-up "^2.0.0" read-pkg "^2.0.0" @@ -7973,6 +8675,7 @@ read-pkg-up@^2.0.0: read-pkg-up@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/read-pkg-up/-/read-pkg-up-3.0.0.tgz#3ed496685dba0f8fe118d0691dc51f4a1ff96f07" + integrity sha1-PtSWaF26D4/hGNBpHcUfSh/5bwc= dependencies: find-up "^2.0.0" read-pkg "^3.0.0" @@ -7980,6 +8683,7 @@ read-pkg-up@^3.0.0: read-pkg-up@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/read-pkg-up/-/read-pkg-up-4.0.0.tgz#1b221c6088ba7799601c808f91161c66e58f8978" + integrity sha512-6etQSH7nJGsK0RbG/2TeDzZFa8shjQ1um+SwQQ5cwKy0dhSXdOncEhb1CPpvQG4h7FyOV6EB6YlV0yJvZQNAkA== dependencies: find-up "^3.0.0" read-pkg "^3.0.0" @@ -7987,6 +8691,7 @@ read-pkg-up@^4.0.0: read-pkg@^1.0.0: version "1.1.0" resolved "https://registry.yarnpkg.com/read-pkg/-/read-pkg-1.1.0.tgz#f5ffaa5ecd29cb31c0474bca7d756b6bb29e3f28" + integrity sha1-9f+qXs0pyzHAR0vKfXVra7KePyg= dependencies: load-json-file "^1.0.0" normalize-package-data "^2.3.2" @@ -7995,6 +8700,7 @@ read-pkg@^1.0.0: read-pkg@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/read-pkg/-/read-pkg-2.0.0.tgz#8ef1c0623c6a6db0dc6713c4bfac46332b2368f8" + integrity sha1-jvHAYjxqbbDcZxPEv6xGMysjaPg= dependencies: load-json-file "^2.0.0" normalize-package-data "^2.3.2" @@ -8003,30 +8709,33 @@ read-pkg@^2.0.0: read-pkg@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/read-pkg/-/read-pkg-3.0.0.tgz#9cbc686978fee65d16c00e2b19c237fcf6e38389" + integrity sha1-nLxoaXj+5l0WwA4rGcI3/Pbjg4k= dependencies: load-json-file "^4.0.0" normalize-package-data "^2.3.2" path-type "^3.0.0" -read-pkg@^5.1.1: - version "5.1.1" - resolved "https://registry.yarnpkg.com/read-pkg/-/read-pkg-5.1.1.tgz#5cf234dde7a405c90c88a519ab73c467e9cb83f5" - integrity sha512-dFcTLQi6BZ+aFUaICg7er+/usEoqFdQxiEBsEMNGoipenihtxxtdrQuBXvyANCEI8VuUIVYFgeHGx9sLLvim4w== +read-pkg@^5.2.0: + version "5.2.0" + resolved "https://registry.yarnpkg.com/read-pkg/-/read-pkg-5.2.0.tgz#7bf295438ca5a33e56cd30e053b34ee7250c93cc" + integrity sha512-Ug69mNOpfvKDAc2Q8DRpMjjzdtrnv9HcSMX+4VsZxD1aZ6ZzrIE7rlzXBtWTyhULSMKg076AW6WR5iZpD0JiOg== dependencies: "@types/normalize-package-data" "^2.4.0" normalize-package-data "^2.5.0" - parse-json "^4.0.0" - type-fest "^0.4.1" + parse-json "^5.0.0" + type-fest "^0.6.0" read@1, read@~1.0.1: version "1.0.7" resolved "https://registry.yarnpkg.com/read/-/read-1.0.7.tgz#b3da19bd052431a97671d44a42634adf710b40c4" + integrity sha1-s9oZvQUkMal2cdRKQmNK33ELQMQ= dependencies: mute-stream "~0.0.4" -"readable-stream@1 || 2", "readable-stream@2 || 3", readable-stream@^2.0.0, readable-stream@^2.0.1, readable-stream@^2.0.2, readable-stream@^2.0.4, readable-stream@^2.0.5, readable-stream@^2.0.6, readable-stream@^2.1.5, readable-stream@^2.2.2, readable-stream@^2.3.3, readable-stream@~2.3.6: +"readable-stream@1 || 2", readable-stream@^2.0.0, readable-stream@^2.0.1, readable-stream@^2.0.2, readable-stream@^2.0.5, readable-stream@^2.0.6, readable-stream@^2.1.5, readable-stream@^2.2.2, readable-stream@^2.3.3, readable-stream@^2.3.5, readable-stream@^2.3.6, readable-stream@~2.3.6: version "2.3.6" resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.3.6.tgz#b11c27d88b8ff1fbe070643cf94b0c79ae1b0aaf" + integrity sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw== dependencies: core-util-is "~1.0.0" inherits "~2.0.3" @@ -8036,29 +8745,39 @@ read@1, read@~1.0.1: string_decoder "~1.1.1" util-deprecate "~1.0.1" -"readable-stream@>=1.1.13-1 <1.2.0-0": +"readable-stream@2 || 3", readable-stream@^3.0.2, readable-stream@^3.0.6: + version "3.4.0" + resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-3.4.0.tgz#a51c26754658e0a3c21dbf59163bd45ba6f447fc" + integrity sha512-jItXPLmrSR8jmTRmRWJXCnGJsfy85mB3Wd/uINMXA65yrnFo0cPClFIUWzo2najVNSl+mx7/4W8ttlLWJe99pQ== + dependencies: + inherits "^2.0.3" + string_decoder "^1.1.1" + util-deprecate "^1.0.1" + +"readable-stream@>=1.1.13-1 <1.2.0-0", readable-stream@^1.0.26-4: version "1.1.14" resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-1.1.14.tgz#7cf4c54ef648e3813084c636dd2079e166c081d9" + integrity sha1-fPTFTvZI44EwhMY23SB54WbAgdk= dependencies: core-util-is "~1.0.0" inherits "~2.0.1" isarray "0.0.1" string_decoder "~0.10.x" -readable-stream@~2.0.0: - version "2.0.6" - resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.0.6.tgz#8f90341e68a53ccc928788dacfcd11b36eb9b78e" +readable-stream@~1.0.26, readable-stream@~1.0.26-4: + version "1.0.34" + resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-1.0.34.tgz#125820e34bc842d2f2aaafafe4c2916ee32c157c" + integrity sha1-Elgg40vIQtLyqq+v5MKRbuMsFXw= dependencies: core-util-is "~1.0.0" inherits "~2.0.1" - isarray "~1.0.0" - process-nextick-args "~1.0.6" + isarray "0.0.1" string_decoder "~0.10.x" - util-deprecate "~1.0.1" readdir-scoped-modules@^1.0.0: - version "1.0.2" - resolved "https://registry.yarnpkg.com/readdir-scoped-modules/-/readdir-scoped-modules-1.0.2.tgz#9fafa37d286be5d92cbaebdee030dc9b5f406747" + version "1.1.0" + resolved "https://registry.yarnpkg.com/readdir-scoped-modules/-/readdir-scoped-modules-1.1.0.tgz#8d45407b4f870a0dcaebc0e28670d18e74514309" + integrity sha512-asaikDeqAQg7JifRsZn1NJZXo9E+VwlyCfbkZhwyISinqk5zNS6266HS5kah6P0SaQKGF6SkNnZVHUzHFYxYDw== dependencies: debuglog "^1.0.1" dezalgo "^1.0.0" @@ -8081,24 +8800,17 @@ realpath-native@^1.1.0: dependencies: util.promisify "^1.0.0" -recast@~0.11.12: - version "0.11.23" - resolved "https://registry.yarnpkg.com/recast/-/recast-0.11.23.tgz#451fd3004ab1e4df9b4e4b66376b2a21912462d3" - dependencies: - ast-types "0.9.6" - esprima "~3.1.0" - private "~0.1.5" - source-map "~0.5.0" - rechoir@^0.6.2: version "0.6.2" resolved "https://registry.yarnpkg.com/rechoir/-/rechoir-0.6.2.tgz#85204b54dba82d5742e28c96756ef43af50e3384" + integrity sha1-hSBLVNuoLVdC4oyWdW70OvUOM4Q= dependencies: resolve "^1.1.6" redent@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/redent/-/redent-1.0.0.tgz#cf916ab1fd5f1f16dfb20822dd6ec7f730c2afde" + integrity sha1-z5Fqsf1fHxbfsggi3W7H9zDCr94= dependencies: indent-string "^2.1.0" strip-indent "^1.0.1" @@ -8106,84 +8818,77 @@ redent@^1.0.0: redent@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/redent/-/redent-2.0.0.tgz#c1b2007b42d57eb1389079b3c8333639d5e1ccaa" + integrity sha1-wbIAe0LVfrE4kHmzyDM2OdXhzKo= dependencies: indent-string "^3.0.0" strip-indent "^2.0.0" -regenerate-unicode-properties@^8.0.2: - version "8.0.2" - resolved "https://registry.yarnpkg.com/regenerate-unicode-properties/-/regenerate-unicode-properties-8.0.2.tgz#7b38faa296252376d363558cfbda90c9ce709662" - integrity sha512-SbA/iNrBUf6Pv2zU8Ekv1Qbhv92yxL4hiDa2siuxs4KKn4oOoMDHXjAf7+Nz9qinUQ46B1LcWEi/PhJfPWpZWQ== +regenerate-unicode-properties@^8.2.0: + version "8.2.0" + resolved "https://registry.yarnpkg.com/regenerate-unicode-properties/-/regenerate-unicode-properties-8.2.0.tgz#e5de7111d655e7ba60c057dbe9ff37c87e65cdec" + integrity sha512-F9DjY1vKLo/tPePDycuH3dn9H1OTPIkVD9Kz4LODu+F2C75mgjAJ7x/gwy6ZcSNRAAkhNlJSOHRe8k3p+K9WhA== dependencies: regenerate "^1.4.0" regenerate@^1.4.0: version "1.4.0" resolved "https://registry.yarnpkg.com/regenerate/-/regenerate-1.4.0.tgz#4a856ec4b56e4077c557589cae85e7a4c8869a11" + integrity sha512-1G6jJVDWrt0rK99kBjvEtziZNCICAuvIPkSiUFIQxVP06RCVpq3dmDo2oi6ABpYaDYaTRr67BEhL8r1wgEZZKg== -regenerator-runtime@^0.13.2: - version "0.13.2" - resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.13.2.tgz#32e59c9a6fb9b1a4aff09b4930ca2d4477343447" - integrity sha512-S/TQAZJO+D3m9xeN1WTI8dLKBBiRgXBlTJvbWjCThHWZj9EvHK70Ff50/tYj2J/fvBY6JtFVwRuazHN2E7M9BA== +regenerator-runtime@^0.13.4: + version "0.13.4" + resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.13.4.tgz#e96bf612a3362d12bb69f7e8f74ffeab25c7ac91" + integrity sha512-plpwicqEzfEyTQohIKktWigcLzmNStMGwbOUbykx51/29Z3JOGYldaaNGK7ngNXV+UcoqvIMmloZ48Sr74sd+g== -regenerator-transform@^0.14.0: - version "0.14.0" - resolved "https://registry.yarnpkg.com/regenerator-transform/-/regenerator-transform-0.14.0.tgz#2ca9aaf7a2c239dd32e4761218425b8c7a86ecaf" - integrity sha512-rtOelq4Cawlbmq9xuMR5gdFmv7ku/sFoB7sRiywx7aq53bc52b4j6zvH7Te1Vt/X2YveDKnCGUbioieU7FEL3w== +regenerator-transform@^0.14.2: + version "0.14.2" + resolved "https://registry.yarnpkg.com/regenerator-transform/-/regenerator-transform-0.14.2.tgz#949d9d87468ff88d5a7e4734ebb994a892de1ff2" + integrity sha512-V4+lGplCM/ikqi5/mkkpJ06e9Bujq1NFmNLvsCs56zg3ZbzrnUzAtizZ24TXxtRX/W2jcdScwQCnbL0CICTFkQ== dependencies: - private "^0.1.6" - -regex-cache@^0.4.2: - version "0.4.4" - resolved "https://registry.yarnpkg.com/regex-cache/-/regex-cache-0.4.4.tgz#75bdc58a2a1496cec48a12835bc54c8d562336dd" - dependencies: - is-equal-shallow "^0.1.3" + "@babel/runtime" "^7.8.4" + private "^0.1.8" regex-not@^1.0.0, regex-not@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/regex-not/-/regex-not-1.0.2.tgz#1f4ece27e00b0b65e0247a6810e6a85d83a5752c" + integrity sha512-J6SDjUgDxQj5NusnOtdFxDwN/+HWykR8GELwctJ7mdqhcyy1xEc4SRFHUXvxTp661YaVKAjfRLZ9cCqS6tn32A== dependencies: extend-shallow "^3.0.2" safe-regex "^1.1.0" -regexp-tree@^0.1.6: - version "0.1.10" - resolved "https://registry.yarnpkg.com/regexp-tree/-/regexp-tree-0.1.10.tgz#d837816a039c7af8a8d64d7a7c3cf6a1d93450bc" - integrity sha512-K1qVSbcedffwuIslMwpe6vGlj+ZXRnGkvjAtFHfDZZZuEdA/h0dxljAPu9vhUo6Rrx2U2AwJ+nSQ6hK+lrP5MQ== - regexpp@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/regexpp/-/regexpp-2.0.1.tgz#8d19d31cf632482b589049f8281f93dbcba4d07f" + integrity sha512-lv0M6+TkDVniA3aD1Eg0DVpfU/booSu7Eev3TDO/mZKHBfVjgCGTV4t4buppESEYDtkArYFOxTJWv6S5C+iaNw== -regexpu-core@^4.5.4: - version "4.5.4" - resolved "https://registry.yarnpkg.com/regexpu-core/-/regexpu-core-4.5.4.tgz#080d9d02289aa87fe1667a4f5136bc98a6aebaae" - integrity sha512-BtizvGtFQKGPUcTy56o3nk1bGRp4SZOTYrDtGNlqCQufptV5IkkLN6Emw+yunAJjzf+C9FQFtvq7IoA3+oMYHQ== +regexpu-core@^4.7.0: + version "4.7.0" + resolved "https://registry.yarnpkg.com/regexpu-core/-/regexpu-core-4.7.0.tgz#fcbf458c50431b0bb7b45d6967b8192d91f3d938" + integrity sha512-TQ4KXRnIn6tz6tjnrXEkD/sshygKH/j5KzK86X8MkeHyZ8qst/LZ89j3X4/8HEIfHANTFIP/AbXakeRhWIl5YQ== dependencies: regenerate "^1.4.0" - regenerate-unicode-properties "^8.0.2" - regjsgen "^0.5.0" - regjsparser "^0.6.0" + regenerate-unicode-properties "^8.2.0" + regjsgen "^0.5.1" + regjsparser "^0.6.4" unicode-match-property-ecmascript "^1.0.4" - unicode-match-property-value-ecmascript "^1.1.0" + unicode-match-property-value-ecmascript "^1.2.0" -regjsgen@^0.5.0: - version "0.5.0" - resolved "https://registry.yarnpkg.com/regjsgen/-/regjsgen-0.5.0.tgz#a7634dc08f89209c2049adda3525711fb97265dd" +regjsgen@^0.5.1: + version "0.5.1" + resolved "https://registry.yarnpkg.com/regjsgen/-/regjsgen-0.5.1.tgz#48f0bf1a5ea205196929c0d9798b42d1ed98443c" + integrity sha512-5qxzGZjDs9w4tzT3TPhCJqWdCc3RLYwy9J2NB0nm5Lz+S273lvWcpjaTGHsT1dc6Hhfq41uSEOw8wBmxrKOuyg== -regjsparser@^0.6.0: - version "0.6.0" - resolved "https://registry.yarnpkg.com/regjsparser/-/regjsparser-0.6.0.tgz#f1e6ae8b7da2bae96c99399b868cd6c933a2ba9c" +regjsparser@^0.6.4: + version "0.6.4" + resolved "https://registry.yarnpkg.com/regjsparser/-/regjsparser-0.6.4.tgz#a769f8684308401a66e9b529d2436ff4d0666272" + integrity sha512-64O87/dPDgfk8/RQqC4gkZoGyyWFIEUTTh80CU6CWuK5vkCGyekIx+oKcEIYtP/RAxSQltCZHCNu/mdd7fqlJw== dependencies: jsesc "~0.5.0" -relateurl@0.2.x: - version "0.2.7" - resolved "https://registry.yarnpkg.com/relateurl/-/relateurl-0.2.7.tgz#54dbf377e51440aca90a4cd274600d3ff2d888a9" - remove-bom-buffer@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/remove-bom-buffer/-/remove-bom-buffer-3.0.0.tgz#c2bf1e377520d324f623892e33c10cac2c252b53" + integrity sha512-8v2rWhaakv18qcvNeli2mZ/TMTL2nEyAKRvzo1WtnZBl15SHyEhrCu2/xKlJyUFKHiHgfXIyuY6g2dObJJycXQ== dependencies: is-buffer "^1.1.5" is-utf8 "^0.2.1" @@ -8191,6 +8896,7 @@ remove-bom-buffer@^3.0.0: remove-bom-stream@^1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/remove-bom-stream/-/remove-bom-stream-1.2.0.tgz#05f1a593f16e42e1fb90ebf59de8e569525f9523" + integrity sha1-BfGlk/FuQuH7kOv1nejlaVJflSM= dependencies: remove-bom-buffer "^3.0.0" safe-buffer "^5.1.0" @@ -8199,54 +8905,59 @@ remove-bom-stream@^1.2.0: remove-trailing-separator@^1.0.1, remove-trailing-separator@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/remove-trailing-separator/-/remove-trailing-separator-1.1.0.tgz#c24bce2a283adad5bc3f58e0d48249b92379d8ef" + integrity sha1-wkvOKig62tW8P1jg1IJJuSN52O8= repeat-element@^1.1.2: - version "1.1.2" - resolved "https://registry.yarnpkg.com/repeat-element/-/repeat-element-1.1.2.tgz#ef089a178d1483baae4d93eb98b4f9e4e11d990a" + version "1.1.3" + resolved "https://registry.yarnpkg.com/repeat-element/-/repeat-element-1.1.3.tgz#782e0d825c0c5a3bb39731f84efee6b742e6b1ce" + integrity sha512-ahGq0ZnV5m5XtZLMb+vP76kcAM5nkLqk0lpqAuojSKGgQtn4eRi4ZZGm2olo2zKFH+sMsWaqOCW1dqAnOru72g== -repeat-string@^1.5.2, repeat-string@^1.6.1: +repeat-string@^1.6.1: version "1.6.1" resolved "https://registry.yarnpkg.com/repeat-string/-/repeat-string-1.6.1.tgz#8dcae470e1c88abc2d600fff4a776286da75e637" + integrity sha1-jcrkcOHIirwtYA//Sndihtp15jc= repeating@^2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/repeating/-/repeating-2.0.1.tgz#5214c53a926d3552707527fbab415dbc08d06dda" + integrity sha1-UhTFOpJtNVJwdSf7q0FdvAjQbdo= dependencies: is-finite "^1.0.0" -replace-ext@0.0.1: - version "0.0.1" - resolved "https://registry.yarnpkg.com/replace-ext/-/replace-ext-0.0.1.tgz#29bbd92078a739f0bcce2b4ee41e837953522924" - replace-ext@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/replace-ext/-/replace-ext-1.0.0.tgz#de63128373fcbf7c3ccfa4de5a480c45a67958eb" + integrity sha1-3mMSg3P8v3w8z6TeWkgMRaZ5WOs= replace-homedir@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/replace-homedir/-/replace-homedir-1.0.0.tgz#e87f6d513b928dde808260c12be7fec6ff6e798c" + integrity sha1-6H9tUTuSjd6AgmDBK+f+xv9ueYw= dependencies: homedir-polyfill "^1.0.1" is-absolute "^1.0.0" remove-trailing-separator "^1.1.0" -request-promise-core@1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/request-promise-core/-/request-promise-core-1.1.1.tgz#3eee00b2c5aa83239cfb04c5700da36f81cd08b6" +request-promise-core@1.1.3: + version "1.1.3" + resolved "https://registry.yarnpkg.com/request-promise-core/-/request-promise-core-1.1.3.tgz#e9a3c081b51380dfea677336061fea879a829ee9" + integrity sha512-QIs2+ArIGQVp5ZYbWD5ZLCY29D5CfWizP8eWnm8FoGD1TX61veauETVQbrV60662V0oFBkrDOuaBI8XgtuyYAQ== dependencies: - lodash "^4.13.1" + lodash "^4.17.15" request-promise-native@^1.0.5: - version "1.0.5" - resolved "https://registry.yarnpkg.com/request-promise-native/-/request-promise-native-1.0.5.tgz#5281770f68e0c9719e5163fd3fab482215f4fda5" + version "1.0.8" + resolved "https://registry.yarnpkg.com/request-promise-native/-/request-promise-native-1.0.8.tgz#a455b960b826e44e2bf8999af64dff2bfe58cb36" + integrity sha512-dapwLGqkHtwL5AEbfenuzjTYg35Jd6KPytsC2/TLkVMz8rm+tNt72MGUWT1RP/aYawMpN6HqbNGBQaRcBtjQMQ== dependencies: - request-promise-core "1.1.1" - stealthy-require "^1.1.0" - tough-cookie ">=2.3.3" + request-promise-core "1.1.3" + stealthy-require "^1.1.1" + tough-cookie "^2.3.3" -request@^2.83.0, request@^2.87.0: +request@^2.87.0: version "2.88.0" resolved "https://registry.yarnpkg.com/request/-/request-2.88.0.tgz#9c2fca4f7d35b592efe57c7f0a55e81052124fef" + integrity sha512-NAqBSrijGLZdM0WZNsInLJpkJokL72XYjUpnB0iwsRgxh7dB6COrHnTBNwN0E+lHDAJzu7kLAkDeY08z2/A0hg== dependencies: aws-sign2 "~0.7.0" aws4 "^1.8.0" @@ -8272,20 +8983,29 @@ request@^2.83.0, request@^2.87.0: require-directory@^2.1.1: version "2.1.1" resolved "https://registry.yarnpkg.com/require-directory/-/require-directory-2.1.1.tgz#8c64ad5fd30dab1c976e2344ffe7f792a6a6df42" + integrity sha1-jGStX9MNqxyXbiNE/+f3kqam30I= require-main-filename@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/require-main-filename/-/require-main-filename-1.0.1.tgz#97f717b69d48784f5f526a6c5aa8ffdda055a4d1" + integrity sha1-l/cXtp1IeE9fUmpsWqj/3aBVpNE= + +require-main-filename@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/require-main-filename/-/require-main-filename-2.0.0.tgz#d0b329ecc7cc0f61649f62215be69af54aa8989b" + integrity sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg== resolve-cwd@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/resolve-cwd/-/resolve-cwd-2.0.0.tgz#00a9f7387556e27038eae232caa372a6a59b665a" + integrity sha1-AKn3OHVW4nA46uIyyqNypqWbZlo= dependencies: resolve-from "^3.0.0" resolve-dir@^1.0.0, resolve-dir@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/resolve-dir/-/resolve-dir-1.0.1.tgz#79a40644c362be82f26effe739c9bb5382046f43" + integrity sha1-eaQGRMNivoLybv/nOcm7U4IEb0M= dependencies: expand-tilde "^2.0.0" global-modules "^1.0.0" @@ -8293,85 +9013,148 @@ resolve-dir@^1.0.0, resolve-dir@^1.0.1: resolve-from@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-3.0.0.tgz#b22c7af7d9d6881bc8b6e653335eebcb0a188748" + integrity sha1-six699nWiBvItuZTM17rywoYh0g= resolve-from@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-4.0.0.tgz#4abcd852ad32dd7baabfe9b40e00a36db5f392e6" + integrity sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g== resolve-options@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/resolve-options/-/resolve-options-1.1.0.tgz#32bb9e39c06d67338dc9378c0d6d6074566ad131" + integrity sha1-MrueOcBtZzONyTeMDW1gdFZq0TE= dependencies: value-or-function "^3.0.0" resolve-url@^0.2.1: version "0.2.1" resolved "https://registry.yarnpkg.com/resolve-url/-/resolve-url-0.2.1.tgz#2c637fe77c893afd2a663fe21aa9080068e2052a" + integrity sha1-LGN/53yJOv0qZj/iGqkIAGjiBSo= resolve@1.1.7: version "1.1.7" resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.1.7.tgz#203114d82ad2c5ed9e8e0411b3932875e889e97b" integrity sha1-IDEU2CrSxe2ejgQRs5ModeiJ6Xs= -resolve@^1.1.4, resolve@^1.1.6, resolve@^1.1.7, resolve@^1.10.0, resolve@^1.10.1, resolve@^1.3.2, resolve@^1.4.0, resolve@^1.5.0, resolve@^1.8.1: - version "1.10.1" - resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.10.1.tgz#664842ac960795bbe758221cdccda61fb64b5f18" - integrity sha512-KuIe4mf++td/eFb6wkaPbMDnP6kObCaEtIDuHOUED6MNUo4K670KZUHuuvYPZDxNF0WVLw49n06M2m2dXphEzA== +resolve@^1.1.4, resolve@^1.1.6, resolve@^1.1.7, resolve@^1.10.0, resolve@^1.11.0, resolve@^1.11.1, resolve@^1.12.0, resolve@^1.13.1, resolve@^1.3.2, resolve@^1.4.0, resolve@^1.8.1: + version "1.15.1" + resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.15.1.tgz#27bdcdeffeaf2d6244b95bb0f9f4b4653451f3e8" + integrity sha512-84oo6ZTtoTUpjgNEr5SJyzQhzL72gaRodsSfyxC/AXRvwu0Yse9H8eF9IpGo7b8YetZhlI6v7ZQ6bKBFV/6S7w== dependencies: path-parse "^1.0.6" restore-cursor@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/restore-cursor/-/restore-cursor-2.0.0.tgz#9f7ee287f82fd326d4fd162923d62129eee0dfaf" + integrity sha1-n37ih/gv0ybU/RYpI9YhKe7g368= dependencies: onetime "^2.0.0" signal-exit "^3.0.2" +restore-cursor@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/restore-cursor/-/restore-cursor-3.1.0.tgz#39f67c54b3a7a58cea5236d95cf0034239631f7e" + integrity sha512-l+sSefzHpj5qimhFSE5a8nufZYAM3sBSVMAPtYkmC+4EH2anSGaEMXSD0izRQbu9nfyQ9y5JrVmp7E8oZrUjvA== + dependencies: + onetime "^5.1.0" + signal-exit "^3.0.2" + ret@~0.1.10: version "0.1.15" resolved "https://registry.yarnpkg.com/ret/-/ret-0.1.15.tgz#b8a4825d5bdb1fc3f6f53c2bc33f81388681c7bc" + integrity sha512-TTlYpa+OL+vMMNG24xSlQGEJ3B/RzEfUlLct7b5G/ytav+wPrplCpVMFuwzXbkecJrb6IYo1iFb0S9v37754mg== retry@^0.10.0: version "0.10.1" resolved "https://registry.yarnpkg.com/retry/-/retry-0.10.1.tgz#e76388d217992c252750241d3d3956fed98d8ff4" + integrity sha1-52OI0heZLCUnUCQdPTlW/tmNj/Q= -right-align@^0.1.1: - version "0.1.3" - resolved "https://registry.yarnpkg.com/right-align/-/right-align-0.1.3.tgz#61339b722fe6a3515689210d24e14c96148613ef" +reusify@^1.0.0: + version "1.0.4" + resolved "https://registry.yarnpkg.com/reusify/-/reusify-1.0.4.tgz#90da382b1e126efc02146e90845a88db12925d76" + integrity sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw== + +rimraf@2, rimraf@^2.5.4, rimraf@^2.6.1, rimraf@^2.6.2, rimraf@^2.6.3: + version "2.7.1" + resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.7.1.tgz#35797f13a7fdadc566142c29d4f07ccad483e3ec" + integrity sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w== dependencies: - align-text "^0.1.1" + glob "^7.1.3" -rimraf@2, rimraf@2.6.3, rimraf@^2.2.8, rimraf@^2.5.4, rimraf@^2.6.1, rimraf@^2.6.2, rimraf@^2.6.3: +rimraf@2.6.3: version "2.6.3" resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.6.3.tgz#b2d104fe0d8fb27cf9e0a1cda8262dd3833c6cab" + integrity sha512-mwqeW5XsA2qAejG46gYdENaxXjx9onRNCfn7L0duuP4hCuTIi/QO7PDK07KJfp1d+izWPrzEJDcSqBa0OZQriA== + dependencies: + glob "^7.1.3" + +rimraf@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-3.0.0.tgz#614176d4b3010b75e5c390eb0ee96f6dc0cebb9b" + integrity sha512-NDGVxTsjqfunkds7CqsOiEnxln4Bo7Nddl3XhS4pXg5OzwkLqJ971ZVAAnB+DDLnF76N+VnDEiBHaVV8I06SUg== dependencies: glob "^7.1.3" ripemd160@^2.0.0, ripemd160@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/ripemd160/-/ripemd160-2.0.1.tgz#0f4584295c53a3628af7e6d79aca21ce57d1c6e7" + version "2.0.2" + resolved "https://registry.yarnpkg.com/ripemd160/-/ripemd160-2.0.2.tgz#a1c1a6f624751577ba5d07914cbc92850585890c" + integrity sha512-ii4iagi25WusVoiC4B4lq7pbXfAp3D9v5CwfkY33vffw2+pkDjY1D8GaN7spsxvCSx8dkPqOZCEZyfxcmJG2IA== dependencies: - hash-base "^2.0.0" + hash-base "^3.0.0" inherits "^2.0.1" -rollup-plugin-babel@^4.0.0: - version "4.3.2" - resolved "https://registry.yarnpkg.com/rollup-plugin-babel/-/rollup-plugin-babel-4.3.2.tgz#8c0e1bd7aa9826e90769cf76895007098ffd1413" - integrity sha512-KfnizE258L/4enADKX61ozfwGHoqYauvoofghFJBhFnpH9Sb9dNPpWg8QHOaAfVASUYV8w0mCx430i9z0LJoJg== +rollup-plugin-babel@^4.4.0: + version "4.4.0" + resolved "https://registry.yarnpkg.com/rollup-plugin-babel/-/rollup-plugin-babel-4.4.0.tgz#d15bd259466a9d1accbdb2fe2fff17c52d030acb" + integrity sha512-Lek/TYp1+7g7I+uMfJnnSJ7YWoD58ajo6Oarhlex7lvUce+RCKRuGRSgztDO3/MF/PuGKmUL5iTHKf208UNszw== dependencies: "@babel/helper-module-imports" "^7.0.0" - rollup-pluginutils "^2.3.0" + rollup-pluginutils "^2.8.1" + +rollup-plugin-commonjs@^10.1.0: + version "10.1.0" + resolved "https://registry.yarnpkg.com/rollup-plugin-commonjs/-/rollup-plugin-commonjs-10.1.0.tgz#417af3b54503878e084d127adf4d1caf8beb86fb" + integrity sha512-jlXbjZSQg8EIeAAvepNwhJj++qJWNJw1Cl0YnOqKtP5Djx+fFGkp3WRh+W0ASCaFG5w1jhmzDxgu3SJuVxPF4Q== + dependencies: + estree-walker "^0.6.1" + is-reference "^1.1.2" + magic-string "^0.25.2" + resolve "^1.11.0" + rollup-pluginutils "^2.8.1" + +rollup-plugin-node-builtins@^2.1.2: + version "2.1.2" + resolved "https://registry.yarnpkg.com/rollup-plugin-node-builtins/-/rollup-plugin-node-builtins-2.1.2.tgz#24a1fed4a43257b6b64371d8abc6ce1ab14597e9" + integrity sha1-JKH+1KQyV7a2Q3HYq8bOGrFFl+k= + dependencies: + browserify-fs "^1.0.0" + buffer-es6 "^4.9.2" + crypto-browserify "^3.11.0" + process-es6 "^0.11.2" + +rollup-plugin-node-globals@^1.4.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/rollup-plugin-node-globals/-/rollup-plugin-node-globals-1.4.0.tgz#5e1f24a9bb97c0ef51249f625e16c7e61b7c020b" + integrity sha512-xRkB+W/m1KLIzPUmG0ofvR+CPNcvuCuNdjVBVS7ALKSxr3EDhnzNceGkGi1m8MToSli13AzKFYH4ie9w3I5L3g== + dependencies: + acorn "^5.7.3" + buffer-es6 "^4.9.3" + estree-walker "^0.5.2" + magic-string "^0.22.5" + process-es6 "^0.11.6" + rollup-pluginutils "^2.3.1" rollup-plugin-node-resolve@^5.0.0: - version "5.0.0" - resolved "https://registry.yarnpkg.com/rollup-plugin-node-resolve/-/rollup-plugin-node-resolve-5.0.0.tgz#754abf4841ed4bab2241551cba0a11d04c57f290" - integrity sha512-JUFr7DkFps3div9DYwpSg0O+s8zuSSRASUZUVNx6h6zhw2m8vcpToeS68JDPsFbmisMVSMYK0IxftngCRv7M9Q== + version "5.2.0" + resolved "https://registry.yarnpkg.com/rollup-plugin-node-resolve/-/rollup-plugin-node-resolve-5.2.0.tgz#730f93d10ed202473b1fb54a5997a7db8c6d8523" + integrity sha512-jUlyaDXts7TW2CqQ4GaO5VJ4PwwaV8VUGA7+km3n6k6xtOEacf61u0VXwN80phY/evMcaS+9eIeJ9MOyDxt5Zw== dependencies: "@types/resolve" "0.0.8" builtin-modules "^3.1.0" is-module "^1.0.0" - resolve "^1.10.1" - rollup-pluginutils "^2.7.0" + resolve "^1.11.1" + rollup-pluginutils "^2.8.1" rollup-plugin-replace@^2.2.0: version "2.2.0" @@ -8381,72 +9164,99 @@ rollup-plugin-replace@^2.2.0: magic-string "^0.25.2" rollup-pluginutils "^2.6.0" -rollup-pluginutils@^2.3.0, rollup-pluginutils@^2.6.0, rollup-pluginutils@^2.7.0: - version "2.7.1" - resolved "https://registry.yarnpkg.com/rollup-pluginutils/-/rollup-pluginutils-2.7.1.tgz#a7915ce8b12c177364784bf38a1590cc6c2c8250" - integrity sha512-3nRf3buQGR9qz/IsSzhZAJyoK663kzseps8itkYHr+Z7ESuaffEPfgRinxbCRA0pf0gzLqkNKkSb8aNVTq75NA== +rollup-plugin-terser@^5.3.0: + version "5.3.0" + resolved "https://registry.yarnpkg.com/rollup-plugin-terser/-/rollup-plugin-terser-5.3.0.tgz#9c0dd33d5771df9630cd027d6a2559187f65885e" + integrity sha512-XGMJihTIO3eIBsVGq7jiNYOdDMb3pVxuzY0uhOE/FM4x/u9nQgr3+McsjzqBn3QfHIpNSZmFnpoKAwHBEcsT7g== dependencies: - estree-walker "^0.6.0" - micromatch "^3.1.10" + "@babel/code-frame" "^7.5.5" + jest-worker "^24.9.0" + rollup-pluginutils "^2.8.2" + serialize-javascript "^2.1.2" + terser "^4.6.2" -rollup@^1.12.0: - version "1.12.0" - resolved "https://registry.yarnpkg.com/rollup/-/rollup-1.12.0.tgz#3e07e7d178bf61fe12325660a037ae0041219d8c" - integrity sha512-DFqgTupu9dkoS80AZ4xMgeLCeC96pGRCu1MLlOwRAjJ3qGItw+j4YWcL3/uWbgQO2mnmrAZphxAdjSXYsG5pWA== +rollup-pluginutils@^2.3.1, rollup-pluginutils@^2.5.0, rollup-pluginutils@^2.6.0, rollup-pluginutils@^2.8.1, rollup-pluginutils@^2.8.2: + version "2.8.2" + resolved "https://registry.yarnpkg.com/rollup-pluginutils/-/rollup-pluginutils-2.8.2.tgz#72f2af0748b592364dbd3389e600e5a9444a351e" + integrity sha512-EEp9NhnUkwY8aif6bxgovPHMoMoNr2FulJziTndpt5H9RdwC47GSGuII9XxpSdzVGM0GWrNPHV6ie1LTNJPaLQ== dependencies: - "@types/estree" "0.0.39" - "@types/node" "^12.0.2" - acorn "^6.1.1" + estree-walker "^0.6.1" -rsvp@^3.3.3: - version "3.6.2" - resolved "https://registry.yarnpkg.com/rsvp/-/rsvp-3.6.2.tgz#2e96491599a96cde1b515d5674a8f7a91452926a" +rollup@^1.32.1: + version "1.32.1" + resolved "https://registry.yarnpkg.com/rollup/-/rollup-1.32.1.tgz#4480e52d9d9e2ae4b46ba0d9ddeaf3163940f9c4" + integrity sha512-/2HA0Ec70TvQnXdzynFffkjA6XN+1e2pEv/uKS5Ulca40g2L7KuOE3riasHoNVHOsFD5KKZgDsMk1CP3Tw9s+A== + dependencies: + "@types/estree" "*" + "@types/node" "*" + acorn "^7.1.0" + +rsvp@^4.8.4: + version "4.8.5" + resolved "https://registry.yarnpkg.com/rsvp/-/rsvp-4.8.5.tgz#c8f155311d167f68f21e168df71ec5b083113734" + integrity sha512-nfMOlASu9OnRJo1mbEk2cz0D56a1MBNrJ7orjRZQG10XDyuvwksKbuXNp6qa+kbn839HwjwhBzhFmdsaEAfauA== run-async@^2.2.0: version "2.3.0" resolved "https://registry.yarnpkg.com/run-async/-/run-async-2.3.0.tgz#0371ab4ae0bdd720d4166d7dfda64ff7a445a6c0" + integrity sha1-A3GrSuC91yDUFm19/aZP96RFpsA= dependencies: is-promise "^2.1.0" run-node@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/run-node/-/run-node-1.0.0.tgz#46b50b946a2aa2d4947ae1d886e9856fd9cabe5e" + integrity sha512-kc120TBlQ3mih1LSzdAJXo4xn/GWS2ec0l3S+syHDXP9uRr0JAT8Qd3mdMuyjqCzeZktgP3try92cEgf9Nks8A== + +run-parallel@^1.1.9: + version "1.1.9" + resolved "https://registry.yarnpkg.com/run-parallel/-/run-parallel-1.1.9.tgz#c9dd3a7cf9f4b2c4b6244e173a6ed866e61dd679" + integrity sha512-DEqnSRTDw/Tc3FXf49zedI638Z9onwUotBMiUFKmrO2sdFKIbXamXGQ3Axd4qgphxKB4kw/qP1w5kTxnfU1B9Q== run-queue@^1.0.0, run-queue@^1.0.3: version "1.0.3" resolved "https://registry.yarnpkg.com/run-queue/-/run-queue-1.0.3.tgz#e848396f057d223f24386924618e25694161ec47" + integrity sha1-6Eg5bwV9Ij8kOGkkYY4laUFh7Ec= dependencies: aproba "^1.1.1" rxjs@^6.3.3, rxjs@^6.4.0: - version "6.4.0" - resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-6.4.0.tgz#f3bb0fe7bda7fb69deac0c16f17b50b0b8790504" - integrity sha512-Z9Yfa11F6B9Sg/BK9MnqnQ+aQYicPLtilXBp2yUtDt2JRCE0h26d33EnfO3ZxoNxG0T92OUucP3Ct7cpfkdFfw== + version "6.5.3" + resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-6.5.3.tgz#510e26317f4db91a7eb1de77d9dd9ba0a4899a3a" + integrity sha512-wuYsAYYFdWTAnAaPoKGNhfpWwKZbJW+HgAJ+mImp+Epl7BG8oNWBCTyRM8gba9k4lk8BgWdoYm21Mo/RYhhbgA== dependencies: tslib "^1.9.0" -safe-buffer@^5.0.1, safe-buffer@^5.1.0, safe-buffer@^5.1.1, safe-buffer@^5.1.2, safe-buffer@~5.1.0, safe-buffer@~5.1.1: +safe-buffer@^5.0.1, safe-buffer@^5.1.0, safe-buffer@^5.1.1, safe-buffer@^5.1.2, safe-buffer@^5.2.0, safe-buffer@~5.2.0: + version "5.2.0" + resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.0.tgz#b74daec49b1148f88c64b68d49b1e815c1f2f519" + integrity sha512-fZEwUGbVl7kouZs1jCdMLdt95hdIv0ZeHg6L7qPeciMZhZ+/gdesW4wgTARkrFWEpspjEATAzUGPG8N2jJiwbg== + +safe-buffer@~5.1.0, safe-buffer@~5.1.1: version "5.1.2" resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.2.tgz#991ec69d296e0313747d59bdfd2b745c35f8828d" + integrity sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g== safe-regex@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/safe-regex/-/safe-regex-1.1.0.tgz#40a3669f3b077d1e943d44629e157dd48023bf2e" + integrity sha1-QKNmnzsHfR6UPURinhV91IAjvy4= dependencies: ret "~0.1.10" -"safer-buffer@>= 2.1.2 < 3": +"safer-buffer@>= 2.1.2 < 3", safer-buffer@^2.0.2, safer-buffer@^2.1.0, safer-buffer@~2.1.0: version "2.1.2" resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a" + integrity sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg== sane@^4.0.3: - version "4.0.3" - resolved "https://registry.yarnpkg.com/sane/-/sane-4.0.3.tgz#e878c3f19e25cc57fbb734602f48f8a97818b181" - integrity sha512-hSLkC+cPHiBQs7LSyXkotC3UUtyn8C4FMn50TNaacRyvBlI+3ebcxMpqckmTdtXVtel87YS7GXN3UIOj7NiGVQ== + version "4.1.0" + resolved "https://registry.yarnpkg.com/sane/-/sane-4.1.0.tgz#ed881fd922733a6c461bc189dc2b6c006f3ffded" + integrity sha512-hhbzAgTIX8O7SHfp2c8/kREfEn4qO/9q8C9beyY6+tvZ87EpoZ3i1RIEvp27YBswnNbY9mWd6paKVmKbAgLfZA== dependencies: "@cnakazawa/watch" "^1.0.3" anymatch "^2.0.0" - capture-exit "^1.2.0" + capture-exit "^2.0.0" exec-sh "^0.3.2" execa "^1.0.0" fb-watchman "^2.0.0" @@ -8457,72 +9267,91 @@ sane@^4.0.3: sax@^1.2.4: version "1.2.4" resolved "https://registry.yarnpkg.com/sax/-/sax-1.2.4.tgz#2816234e2378bddc4e5354fab5caa895df7100d9" + integrity sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw== semver-compare@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/semver-compare/-/semver-compare-1.0.0.tgz#0dee216a1c941ab37e9efb1788f6afc5ff5537fc" + integrity sha1-De4hahyUGrN+nvsXiPavxf9VN/w= semver-greatest-satisfied-range@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/semver-greatest-satisfied-range/-/semver-greatest-satisfied-range-1.1.0.tgz#13e8c2658ab9691cb0cd71093240280d36f77a5b" + integrity sha1-E+jCZYq5aRywzXEJMkAoDTb3els= dependencies: sver-compat "^1.5.0" -"semver@2 || 3 || 4 || 5", "semver@2.x || 3.x || 4 || 5", semver@^5.3.0, semver@^5.4.1, semver@^5.5.0, semver@^5.5.1, semver@^5.6.0: - version "5.6.0" - resolved "https://registry.yarnpkg.com/semver/-/semver-5.6.0.tgz#7e74256fbaa49c75aa7c7a205cc22799cac80004" +"semver@2 || 3 || 4 || 5", "semver@2.x || 3.x || 4 || 5", semver@^5.3.0, semver@^5.4.1, semver@^5.5.0, semver@^5.5.1, semver@^5.6.0, semver@^5.7.0: + version "5.7.1" + resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.1.tgz#a954f931aeba508d307bbf069eff0c01c96116f7" + integrity sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ== -semver@^6.0.0: - version "6.0.0" - resolved "https://registry.yarnpkg.com/semver/-/semver-6.0.0.tgz#05e359ee571e5ad7ed641a6eec1e547ba52dea65" - integrity sha512-0UewU+9rFapKFnlbirLi3byoOuhrSsli/z/ihNnvM24vgF+8sNBiI1LZPBSH9wJKUwaUbw+s3hToDLCXkrghrQ== +semver@7.0.0: + version "7.0.0" + resolved "https://registry.yarnpkg.com/semver/-/semver-7.0.0.tgz#5f3ca35761e47e05b206c6daff2cf814f0316b8e" + integrity sha512-+GB6zVA9LWh6zovYQLALHwv5rb2PHGlJi3lfiqIHxR0uuwCgefcOJc59v9fv1w8GbStwxuuqqAjI9NMAOOgq1A== + +semver@^6.0.0, semver@^6.1.2, semver@^6.2.0, semver@^6.3.0: + version "6.3.0" + resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.0.tgz#ee0a64c8af5e8ceea67687b133761e1becbd1d3d" + integrity sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw== + +semver@~2.3.1: + version "2.3.2" + resolved "https://registry.yarnpkg.com/semver/-/semver-2.3.2.tgz#b9848f25d6cf36333073ec9ef8856d42f1233e52" + integrity sha1-uYSPJdbPNjMwc+ye+IVtQvEjPlI= semver@~5.3.0: version "5.3.0" resolved "https://registry.yarnpkg.com/semver/-/semver-5.3.0.tgz#9b2ce5d3de02d17c6012ad326aa6b4d0cf54f94f" + integrity sha1-myzl094C0XxgEq0yaqa00M9U+U8= + +serialize-javascript@^2.1.2: + version "2.1.2" + resolved "https://registry.yarnpkg.com/serialize-javascript/-/serialize-javascript-2.1.2.tgz#ecec53b0e0317bdc95ef76ab7074b7384785fa61" + integrity sha512-rs9OggEUF0V4jUSecXazOYsLfu7OGK2qIn3c7IPBiffz32XniEp/TX9Xmc9LQfK2nQ2QKHvZ2oygKUGU0lG4jQ== set-blocking@^2.0.0, set-blocking@~2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/set-blocking/-/set-blocking-2.0.0.tgz#045f9782d011ae9a6803ddd382b24392b3d890f7" + integrity sha1-BF+XgtARrppoA93TgrJDkrPYkPc= -set-getter@^0.1.0: - version "0.1.0" - resolved "https://registry.yarnpkg.com/set-getter/-/set-getter-0.1.0.tgz#d769c182c9d5a51f409145f2fba82e5e86e80376" - dependencies: - to-object-path "^0.3.0" - -set-value@^0.4.3: - version "0.4.3" - resolved "https://registry.yarnpkg.com/set-value/-/set-value-0.4.3.tgz#7db08f9d3d22dc7f78e53af3c3bf4666ecdfccf1" - dependencies: - extend-shallow "^2.0.1" - is-extendable "^0.1.1" - is-plain-object "^2.0.1" - to-object-path "^0.3.0" - -set-value@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/set-value/-/set-value-2.0.0.tgz#71ae4a88f0feefbbf52d1ea604f3fb315ebb6274" +set-value@^2.0.0, set-value@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/set-value/-/set-value-2.0.1.tgz#a18d40530e6f07de4228c7defe4227af8cad005b" + integrity sha512-JxHc1weCN68wRY0fhCoXpyK55m/XPHafOmK4UWD7m2CI14GMcFypt4w/0+NV5f/ZMby2F6S2wwA7fgynh9gWSw== dependencies: extend-shallow "^2.0.1" is-extendable "^0.1.1" is-plain-object "^2.0.3" split-string "^3.0.1" -setimmediate@^1.0.4: - version "1.0.5" - resolved "https://registry.yarnpkg.com/setimmediate/-/setimmediate-1.0.5.tgz#290cbb232e306942d7d7ea9b83732ab7856f8285" - sha.js@^2.4.0, sha.js@^2.4.8, sha.js@~2.4.4: - version "2.4.10" - resolved "https://registry.yarnpkg.com/sha.js/-/sha.js-2.4.10.tgz#b1fde5cd7d11a5626638a07c604ab909cfa31f9b" + version "2.4.11" + resolved "https://registry.yarnpkg.com/sha.js/-/sha.js-2.4.11.tgz#37a5cf0b81ecbc6943de109ba2960d1b26584ae7" + integrity sha512-QMEp5B7cftE7APOjk5Y6xgrbWu+WkLVQwk8JNjZ8nKRciZaByEW6MubieAiToS7+dwvrjGhH8jRXz3MVd0AYqQ== dependencies: inherits "^2.0.1" safe-buffer "^5.0.1" +shallow-clone@^3.0.0: + version "3.0.1" + resolved "https://registry.yarnpkg.com/shallow-clone/-/shallow-clone-3.0.1.tgz#8f2981ad92531f55035b01fb230769a40e02efa3" + integrity sha512-/6KqX+GVUdqPuPPd2LxDDxzX6CAbjJehAAOKlNpqqUpAqPM6HeL8f+o3a+JsyGjn2lv0WY8UsTgUJjU9Ok55NA== + dependencies: + kind-of "^6.0.2" + +shasum-object@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/shasum-object/-/shasum-object-1.0.0.tgz#0b7b74ff5b66ecf9035475522fa05090ac47e29e" + integrity sha512-Iqo5rp/3xVi6M4YheapzZhhGPVs0yZwHj7wvwQ1B9z8H6zk+FEnI7y3Teq7qwnekfEhu8WmG2z0z4iWZaxLWVg== + dependencies: + fast-safe-stringify "^2.0.7" + shasum@^1.0.0: version "1.0.2" resolved "https://registry.yarnpkg.com/shasum/-/shasum-1.0.2.tgz#e7012310d8f417f4deb5712150e5678b87ae565f" + integrity sha1-5wEjENj0F/TetXEhUOVni4euVl8= dependencies: json-stable-stringify "~0.0.0" sha.js "~2.4.4" @@ -8530,47 +9359,61 @@ shasum@^1.0.0: shebang-command@^1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/shebang-command/-/shebang-command-1.2.0.tgz#44aac65b695b03398968c39f363fee5deafdf1ea" + integrity sha1-RKrGW2lbAzmJaMOfNj/uXer98eo= dependencies: shebang-regex "^1.0.0" +shebang-command@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/shebang-command/-/shebang-command-2.0.0.tgz#ccd0af4f8835fbdc265b82461aaf0c36663f34ea" + integrity sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA== + dependencies: + shebang-regex "^3.0.0" + shebang-regex@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-1.0.0.tgz#da42f49740c0b42db2ca9728571cb190c98efea3" + integrity sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM= + +shebang-regex@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-3.0.0.tgz#ae16f1644d873ecad843b0307b143362d4c42172" + integrity sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A== shell-quote@^1.6.1: - version "1.6.1" - resolved "https://registry.yarnpkg.com/shell-quote/-/shell-quote-1.6.1.tgz#f4781949cce402697127430ea3b3c5476f481767" - dependencies: - array-filter "~0.0.0" - array-map "~0.0.0" - array-reduce "~0.0.0" - jsonify "~0.0.0" + version "1.7.2" + resolved "https://registry.yarnpkg.com/shell-quote/-/shell-quote-1.7.2.tgz#67a7d02c76c9da24f99d20808fcaded0e0e04be2" + integrity sha512-mRz/m/JVscCrkMyPqHc/bczi3OQHkLTqXHEFu0zDhK/qfv3UcOA4SVmRCLmos4bhjr9ekVQubj/R7waKapmiQg== shellwords@^0.1.1: version "0.1.1" resolved "https://registry.yarnpkg.com/shellwords/-/shellwords-0.1.1.tgz#d6b9181c1a48d397324c84871efbcfc73fc0654b" + integrity sha512-vFwSUfQvqybiICwZY5+DAWIPLKsWO31Q91JSKl3UYv+K5c2QRPzn0qzec6QPu1Qc9eHYItiP3NdJqNVqetYAww== signal-exit@^3.0.0, signal-exit@^3.0.2: version "3.0.2" resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.2.tgz#b5fdc08f1287ea1178628e415e25132b73646c6d" + integrity sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0= -simple-git@^1.85.0: - version "1.107.0" - resolved "https://registry.yarnpkg.com/simple-git/-/simple-git-1.107.0.tgz#12cffaf261c14d6f450f7fdb86c21ccee968b383" - dependencies: - debug "^4.0.1" - -sisteransi@^1.0.0: +simple-concat@^1.0.0: version "1.0.0" - resolved "https://registry.yarnpkg.com/sisteransi/-/sisteransi-1.0.0.tgz#77d9622ff909080f1c19e5f4a1df0c1b0a27b88c" + resolved "https://registry.yarnpkg.com/simple-concat/-/simple-concat-1.0.0.tgz#7344cbb8b6e26fb27d66b2fc86f9f6d5997521c6" + integrity sha1-c0TLuLbib7J9ZrL8hvn21Zl1IcY= + +sisteransi@^1.0.3: + version "1.0.4" + resolved "https://registry.yarnpkg.com/sisteransi/-/sisteransi-1.0.4.tgz#386713f1ef688c7c0304dc4c0632898941cad2e3" + integrity sha512-/ekMoM4NJ59ivGSfKapeG+FWtrmWvA1p6FBZwXrqojw90vJu8lBmrTxCMuBCydKtkaUe2zt4PlxeTKpjwMbyig== slash@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/slash/-/slash-1.0.0.tgz#c41f2f6c39fc16d1cd17ad4b5d896114ae470d55" + integrity sha1-xB8vbDn8FtHNF61LXYlhFK5HDVU= slash@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/slash/-/slash-2.0.0.tgz#de552851a1759df3a8f206535442f5ec4ddeab44" + integrity sha512-ZYKh3Wh2z1PpEXWr0MpSBZ0V6mZHAQfYevttO11c51CaWjGTaadiKZ+wVt1PbMlDV5qhMFslpZCemhwOK7C89A== slash@^3.0.0: version "3.0.0" @@ -8580,6 +9423,7 @@ slash@^3.0.0: slice-ansi@0.0.4: version "0.0.4" resolved "https://registry.yarnpkg.com/slice-ansi/-/slice-ansi-0.0.4.tgz#edbf8903f66f7ce2f8eafd6ceed65e264c831b35" + integrity sha1-7b+JA/ZvfOL46v1s7tZeJkyDGzU= slice-ansi@^2.1.0: version "2.1.0" @@ -8593,14 +9437,17 @@ slice-ansi@^2.1.0: slide@^1.1.6: version "1.1.6" resolved "https://registry.yarnpkg.com/slide/-/slide-1.1.6.tgz#56eb027d65b4d2dce6cb2e2d32c4d4afc9e1d707" + integrity sha1-VusCfWW00tzmyy4tMsTUr8nh1wc= -smart-buffer@^4.0.1: - version "4.0.1" - resolved "https://registry.yarnpkg.com/smart-buffer/-/smart-buffer-4.0.1.tgz#07ea1ca8d4db24eb4cac86537d7d18995221ace3" +smart-buffer@^4.1.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/smart-buffer/-/smart-buffer-4.1.0.tgz#91605c25d91652f4661ea69ccf45f1b331ca21ba" + integrity sha512-iVICrxOzCynf/SNaBQCw34eM9jROU/s5rzIhpOvzhzuYHfJR/DhZfDkXiZSgKXfgv26HT3Yni3AV/DGw0cGnnw== snapdragon-node@^2.0.1: version "2.1.1" resolved "https://registry.yarnpkg.com/snapdragon-node/-/snapdragon-node-2.1.1.tgz#6c175f86ff14bdb0724563e8f3c1b021a286853b" + integrity sha512-O27l4xaMYt/RSQ5TR3vpWCAB5Kb/czIcqUFOM/C4fYcLnbZUc1PkjTAMjof2pBWaSTwOUd6qUHcFGVGj7aIwnw== dependencies: define-property "^1.0.0" isobject "^3.0.0" @@ -8609,12 +9456,14 @@ snapdragon-node@^2.0.1: snapdragon-util@^3.0.1: version "3.0.1" resolved "https://registry.yarnpkg.com/snapdragon-util/-/snapdragon-util-3.0.1.tgz#f956479486f2acd79700693f6f7b805e45ab56e2" + integrity sha512-mbKkMdQKsjX4BAL4bRYTj21edOf8cN7XHdYUJEe+Zn99hVEYcMvKPct1IqNe7+AZPirn8BCDOQBHQZknqmKlZQ== dependencies: kind-of "^3.2.0" snapdragon@^0.8.1: - version "0.8.1" - resolved "https://registry.yarnpkg.com/snapdragon/-/snapdragon-0.8.1.tgz#e12b5487faded3e3dea0ac91e9400bf75b401370" + version "0.8.2" + resolved "https://registry.yarnpkg.com/snapdragon/-/snapdragon-0.8.2.tgz#64922e7c565b0e14204ba1aa7d6964278d25182d" + integrity sha512-FtyOnWN/wCHTVXOMwvSv26d+ko5vWlIDD6zoUJ7LW8vh+ZBC8QdljveRP+crNrtBwioEUWy/4dMtbBjA4ioNlg== dependencies: base "^0.11.1" debug "^2.2.0" @@ -8623,45 +9472,46 @@ snapdragon@^0.8.1: map-cache "^0.2.2" source-map "^0.5.6" source-map-resolve "^0.5.0" - use "^2.0.0" + use "^3.1.0" socks-proxy-agent@^4.0.0: - version "4.0.1" - resolved "https://registry.yarnpkg.com/socks-proxy-agent/-/socks-proxy-agent-4.0.1.tgz#5936bf8b707a993079c6f37db2091821bffa6473" + version "4.0.2" + resolved "https://registry.yarnpkg.com/socks-proxy-agent/-/socks-proxy-agent-4.0.2.tgz#3c8991f3145b2799e70e11bd5fbc8b1963116386" + integrity sha512-NT6syHhI9LmuEMSK6Kd2V7gNv5KFZoLE7V5udWmn0de+3Mkj3UMA/AJPLyeNUVmElCurSHtUdM3ETpR3z770Wg== dependencies: - agent-base "~4.2.0" - socks "~2.2.0" + agent-base "~4.2.1" + socks "~2.3.2" -socks@~2.2.0: - version "2.2.2" - resolved "https://registry.yarnpkg.com/socks/-/socks-2.2.2.tgz#f061219fc2d4d332afb4af93e865c84d3fa26e2b" +socks@~2.3.2: + version "2.3.3" + resolved "https://registry.yarnpkg.com/socks/-/socks-2.3.3.tgz#01129f0a5d534d2b897712ed8aceab7ee65d78e3" + integrity sha512-o5t52PCNtVdiOvzMry7wU4aOqYWL0PeCXRWBEiJow4/i/wr+wpsJQ9awEu1EonLIqsfGd5qSgDdxEOvCdmBEpA== dependencies: - ip "^1.1.5" - smart-buffer "^4.0.1" + ip "1.1.5" + smart-buffer "^4.1.0" sort-keys@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/sort-keys/-/sort-keys-2.0.0.tgz#658535584861ec97d730d6cf41822e1f56684128" + integrity sha1-ZYU1WEhh7JfXMNbPQYIuH1ZoQSg= dependencies: is-plain-obj "^1.0.0" -source-list-map@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/source-list-map/-/source-list-map-2.0.0.tgz#aaa47403f7b245a92fbc97ea08f250d6087ed085" - source-map-resolve@^0.5.0: - version "0.5.1" - resolved "https://registry.yarnpkg.com/source-map-resolve/-/source-map-resolve-0.5.1.tgz#7ad0f593f2281598e854df80f19aae4b92d7a11a" + version "0.5.2" + resolved "https://registry.yarnpkg.com/source-map-resolve/-/source-map-resolve-0.5.2.tgz#72e2cc34095543e43b2c62b2c4c10d4a9054f259" + integrity sha512-MjqsvNwyz1s0k81Goz/9vRBe9SZdB09Bdw+/zYyO+3CuPk6fouTaxscHkgtE8jKvf01kVfl8riHzERQ/kefaSA== dependencies: - atob "^2.0.0" + atob "^2.1.1" decode-uri-component "^0.2.0" resolve-url "^0.2.1" source-map-url "^0.4.0" urix "^0.1.0" -source-map-support@^0.5.6, source-map-support@^0.5.9: - version "0.5.9" - resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.9.tgz#41bc953b2534267ea2d605bccfa7bfa3111ced5f" +source-map-support@^0.5.16, source-map-support@^0.5.6, source-map-support@~0.5.12: + version "0.5.16" + resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.16.tgz#0ae069e7fe3ba7538c64c98515e35339eac5a042" + integrity sha512-efyLRJDr68D9hBBNIPWFjhpFzURh+KJykQwvMyW5UiZzYwoF6l4YMMDIJJEyFWxWCqfyxLzz6tSfUFR+kXXsVQ== dependencies: buffer-from "^1.0.0" source-map "^0.6.0" @@ -8669,120 +9519,136 @@ source-map-support@^0.5.6, source-map-support@^0.5.9: source-map-url@^0.4.0: version "0.4.0" resolved "https://registry.yarnpkg.com/source-map-url/-/source-map-url-0.4.0.tgz#3e935d7ddd73631b97659956d55128e87b5084a3" + integrity sha1-PpNdfd1zYxuXZZlW1VEo6HtQhKM= -source-map@0.5.x, source-map@^0.5.0, source-map@^0.5.1, source-map@^0.5.3, source-map@^0.5.6, source-map@~0.5.0, source-map@~0.5.1, source-map@~0.5.3: +source-map@^0.5.0, source-map@^0.5.1, source-map@^0.5.6, source-map@~0.5.3: version "0.5.7" resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.5.7.tgz#8a039d2d1021d22d1ea14c80d8ea468ba2ef3fcc" + integrity sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w= source-map@^0.6.0, source-map@^0.6.1, source-map@~0.6.1: version "0.6.1" resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263" + integrity sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g== source-map@~0.4.0, source-map@~0.4.2: version "0.4.4" resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.4.4.tgz#eba4f5da9c0dc999de68032d8b4f76173652036b" + integrity sha1-66T12pwNyZneaAMti092FzZSA2s= dependencies: amdefine ">=0.0.4" sourcemap-codec@^1.4.4: - version "1.4.4" - resolved "https://registry.yarnpkg.com/sourcemap-codec/-/sourcemap-codec-1.4.4.tgz#c63ea927c029dd6bd9a2b7fa03b3fec02ad56e9f" - integrity sha512-CYAPYdBu34781kLHkaW3m6b/uUSyMOC2R61gcYMWooeuaGtjof86ZA/8T+qVPPt7np1085CR9hmMGrySwEc8Xg== + version "1.4.6" + resolved "https://registry.yarnpkg.com/sourcemap-codec/-/sourcemap-codec-1.4.6.tgz#e30a74f0402bad09807640d39e971090a08ce1e9" + integrity sha512-1ZooVLYFxC448piVLBbtOxFcXwnymH9oUF8nRd3CuYDVvkRBxRl6pB4Mtas5a4drtL+E8LDgFkQNcgIw6tc8Hg== sparkles@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/sparkles/-/sparkles-1.0.0.tgz#1acbbfb592436d10bbe8f785b7cc6f82815012c3" + version "1.0.1" + resolved "https://registry.yarnpkg.com/sparkles/-/sparkles-1.0.1.tgz#008db65edce6c50eec0c5e228e1945061dd0437c" + integrity sha512-dSO0DDYUahUt/0/pD/Is3VIm5TGJjludZ0HVymmhYF6eNA53PVLhnUk0znSYbH8IYBuJdCE+1luR22jNLMaQdw== spdx-correct@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/spdx-correct/-/spdx-correct-3.0.0.tgz#05a5b4d7153a195bc92c3c425b69f3b2a9524c82" + version "3.1.0" + resolved "https://registry.yarnpkg.com/spdx-correct/-/spdx-correct-3.1.0.tgz#fb83e504445268f154b074e218c87c003cd31df4" + integrity sha512-lr2EZCctC2BNR7j7WzJ2FpDznxky1sjfxvvYEyzxNyb6lZXHODmEoJeFu4JupYlkfha1KZpJyoqiJ7pgA1qq8Q== dependencies: spdx-expression-parse "^3.0.0" spdx-license-ids "^3.0.0" spdx-exceptions@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/spdx-exceptions/-/spdx-exceptions-2.1.0.tgz#2c7ae61056c714a5b9b9b2b2af7d311ef5c78fe9" + version "2.2.0" + resolved "https://registry.yarnpkg.com/spdx-exceptions/-/spdx-exceptions-2.2.0.tgz#2ea450aee74f2a89bfb94519c07fcd6f41322977" + integrity sha512-2XQACfElKi9SlVb1CYadKDXvoajPgBVPn/gOQLrTvHdElaVhr7ZEbqJaRnJLVNeaI4cMEAgVCeBMKF6MWRDCRA== spdx-expression-parse@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/spdx-expression-parse/-/spdx-expression-parse-3.0.0.tgz#99e119b7a5da00e05491c9fa338b7904823b41d0" + integrity sha512-Yg6D3XpRD4kkOmTpdgbUiEJFKghJH03fiC1OPll5h/0sO6neh2jqRDVHOQ4o/LMea0tgCkbMgea5ip/e+MkWyg== dependencies: spdx-exceptions "^2.1.0" spdx-license-ids "^3.0.0" spdx-license-ids@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/spdx-license-ids/-/spdx-license-ids-3.0.0.tgz#7a7cd28470cc6d3a1cfe6d66886f6bc430d3ac87" + version "3.0.5" + resolved "https://registry.yarnpkg.com/spdx-license-ids/-/spdx-license-ids-3.0.5.tgz#3694b5804567a458d3c8045842a6358632f62654" + integrity sha512-J+FWzZoynJEXGphVIS+XEh3kFSjZX/1i9gFBaWQcB+/tmpe2qUsSBABpcxqxnAxFdiUFEgAX1bjYGQvIZmoz9Q== split-string@^3.0.1, split-string@^3.0.2: version "3.1.0" resolved "https://registry.yarnpkg.com/split-string/-/split-string-3.1.0.tgz#7cb09dda3a86585705c64b39a6466038682e8fe2" + integrity sha512-NzNVhJDYpwceVVii8/Hu6DKfD2G+NrQHlS/V/qgv763EYudVwEcMQNxd2lh+0VrUByXN/oJkl5grOhYWvQUYiw== dependencies: extend-shallow "^3.0.0" split2@^2.0.0: version "2.2.0" resolved "https://registry.yarnpkg.com/split2/-/split2-2.2.0.tgz#186b2575bcf83e85b7d18465756238ee4ee42493" + integrity sha512-RAb22TG39LhI31MbreBgIuKiIKhVsawfTgEGqKHTK87aG+ul/PB8Sqoi3I7kVdRWiCfrKxK3uo4/YUkpNvhPbw== dependencies: through2 "^2.0.2" split@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/split/-/split-1.0.1.tgz#605bd9be303aa59fb35f9229fbea0ddec9ea07d9" + integrity sha512-mTyOoPbrivtXnwnIxZRFYRrPNtEFKlpB2fvjSnCQUiAA6qAZzqwna5envK4uk6OIeP17CsdF3rSBGYVBsU0Tkg== dependencies: through "2" sprintf-js@~1.0.2: version "1.0.3" resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.0.3.tgz#04e6926f662895354f3dd015203633b857297e2c" + integrity sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw= sshpk@^1.7.0: - version "1.13.1" - resolved "https://registry.yarnpkg.com/sshpk/-/sshpk-1.13.1.tgz#512df6da6287144316dc4c18fe1cf1d940739be3" + version "1.16.1" + resolved "https://registry.yarnpkg.com/sshpk/-/sshpk-1.16.1.tgz#fb661c0bef29b39db40769ee39fa70093d6f6877" + integrity sha512-HXXqVUq7+pcKeLqqZj6mHFUMvXtOJt1uoUx09pFW6011inTMxqI8BA8PM95myrIyyKwdnzjdFjLiE6KBPVtJIg== dependencies: asn1 "~0.2.3" assert-plus "^1.0.0" - dashdash "^1.12.0" - getpass "^0.1.1" - optionalDependencies: bcrypt-pbkdf "^1.0.0" + dashdash "^1.12.0" ecc-jsbn "~0.1.1" + getpass "^0.1.1" jsbn "~0.1.0" + safer-buffer "^2.0.2" tweetnacl "~0.14.0" ssri@^6.0.0, ssri@^6.0.1: version "6.0.1" resolved "https://registry.yarnpkg.com/ssri/-/ssri-6.0.1.tgz#2a3c41b28dd45b62b63676ecb74001265ae9edd8" + integrity sha512-3Wge10hNcT1Kur4PDFwEieXSCMCJs/7WvSACcrMYrNp+b8kDL1/0wJch5Ni2WrtwEa2IO8OsVfeKIciKCDx/QA== dependencies: figgy-pudding "^3.5.1" stack-trace@0.0.10: version "0.0.10" resolved "https://registry.yarnpkg.com/stack-trace/-/stack-trace-0.0.10.tgz#547c70b347e8d32b4e108ea1a2a159e5fdde19c0" + integrity sha1-VHxws0fo0ytOEI6hoqFZ5f3eGcA= stack-utils@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/stack-utils/-/stack-utils-1.0.1.tgz#d4f33ab54e8e38778b0ca5cfd3b3afb12db68620" - -staged-git-files@1.1.2: - version "1.1.2" - resolved "https://registry.yarnpkg.com/staged-git-files/-/staged-git-files-1.1.2.tgz#4326d33886dc9ecfa29a6193bf511ba90a46454b" + version "1.0.2" + resolved "https://registry.yarnpkg.com/stack-utils/-/stack-utils-1.0.2.tgz#33eba3897788558bebfc2db059dc158ec36cebb8" + integrity sha512-MTX+MeG5U994cazkjd/9KNAapsHnibjMLnfXodlkXw76JEea0UiNzrqidzo1emMwk7w5Qhc9jd4Bn9TBb1MFwA== static-extend@^0.1.1: version "0.1.2" resolved "https://registry.yarnpkg.com/static-extend/-/static-extend-0.1.2.tgz#60809c39cbff55337226fd5e0b520f341f1fb5c6" + integrity sha1-YICcOcv/VTNyJv1eC1IPNB8ftcY= dependencies: define-property "^0.2.5" object-copy "^0.1.0" -stealthy-require@^1.1.0: +stealthy-require@^1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/stealthy-require/-/stealthy-require-1.1.1.tgz#35b09875b4ff49f26a777e509b3090a3226bf24b" + integrity sha1-NbCYdbT/SfJqd35QmzCQoyJr8ks= -stream-browserify@^2.0.0, stream-browserify@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/stream-browserify/-/stream-browserify-2.0.1.tgz#66266ee5f9bdb9940a4e4514cafb43bb71e5c9db" +stream-browserify@^2.0.0: + version "2.0.2" + resolved "https://registry.yarnpkg.com/stream-browserify/-/stream-browserify-2.0.2.tgz#87521d38a44aa7ee91ce1cd2a47df0cb49dd660b" + integrity sha512-nX6hmklHs/gr2FuxYDltq8fJA1GDlxKQCz8O/IM4atRqBH8OORmBNgfvW5gG10GT/qQ9u0CzIvr2X5Pkt6ntqg== dependencies: inherits "~2.0.1" readable-stream "^2.0.2" @@ -8790,6 +9656,7 @@ stream-browserify@^2.0.0, stream-browserify@^2.0.1: stream-combiner2@^1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/stream-combiner2/-/stream-combiner2-1.1.1.tgz#fb4d8a1420ea362764e21ad4780397bebcb41cbe" + integrity sha1-+02KFCDqNidk4hrUeAOXvry0HL4= dependencies: duplexer2 "~0.1.0" readable-stream "^2.0.2" @@ -8797,6 +9664,7 @@ stream-combiner2@^1.1.1: stream-each@^1.1.0: version "1.2.3" resolved "https://registry.yarnpkg.com/stream-each/-/stream-each-1.2.3.tgz#ebe27a0c389b04fbcc233642952e10731afa9bae" + integrity sha512-vlMC2f8I2u/bZGqkdfLQW/13Zihpej/7PmSiMQsbYddxuTsJp8vRe2x2FvVExZg7FaOds43ROAuFJwPR4MTZLw== dependencies: end-of-stream "^1.1.0" stream-shift "^1.0.0" @@ -8804,24 +9672,27 @@ stream-each@^1.1.0: stream-exhaust@^1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/stream-exhaust/-/stream-exhaust-1.0.2.tgz#acdac8da59ef2bc1e17a2c0ccf6c320d120e555d" + integrity sha512-b/qaq/GlBK5xaq1yrK9/zFcyRSTNxmcZwFLGSTG0mXgZl/4Z6GgiyYOXOvY7N3eEvFRAG1bkDRz5EPGSvPYQlw== -stream-http@^2.0.0, stream-http@^2.7.2: - version "2.8.0" - resolved "https://registry.yarnpkg.com/stream-http/-/stream-http-2.8.0.tgz#fd86546dac9b1c91aff8fc5d287b98fafb41bc10" +stream-http@^3.0.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/stream-http/-/stream-http-3.1.0.tgz#22fb33fe9b4056b4eccf58bd8f400c4b993ffe57" + integrity sha512-cuB6RgO7BqC4FBYzmnvhob5Do3wIdIsXAgGycHJnW+981gHqoYcYz9lqjJrk8WXRddbwPuqPYRl+bag6mYv4lw== dependencies: builtin-status-codes "^3.0.0" inherits "^2.0.1" - readable-stream "^2.3.3" - to-arraybuffer "^1.0.0" + readable-stream "^3.0.6" xtend "^4.0.0" stream-shift@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/stream-shift/-/stream-shift-1.0.0.tgz#d5c752825e5367e786f78e18e445ea223a155952" + integrity sha1-1cdSgl5TZ+eG944Y5EXqIjoVWVI= stream-splicer@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/stream-splicer/-/stream-splicer-2.0.0.tgz#1b63be438a133e4b671cc1935197600175910d83" + version "2.0.1" + resolved "https://registry.yarnpkg.com/stream-splicer/-/stream-splicer-2.0.1.tgz#0b13b7ee2b5ac7e0609a7463d83899589a363fcd" + integrity sha512-Xizh4/NPuYSyAXyT7g8IvdJ9HJpxIGL9PjyhtywCZvvP0OPIdqyrr4dMikeuvY8xahpdKEBlBTySe583totajg== dependencies: inherits "^2.0.1" readable-stream "^2.0.2" @@ -8829,126 +9700,192 @@ stream-splicer@^2.0.0: streamfilter@^1.0.5: version "1.0.7" resolved "https://registry.yarnpkg.com/streamfilter/-/streamfilter-1.0.7.tgz#ae3e64522aa5a35c061fd17f67620c7653c643c9" + integrity sha512-Gk6KZM+yNA1JpW0KzlZIhjo3EaBJDkYfXtYSbOwNIQ7Zd6006E6+sCFlW1NDvFG/vnXhKmw6TJJgiEQg/8lXfQ== dependencies: readable-stream "^2.0.2" -string-argv@^0.0.2: - version "0.0.2" - resolved "https://registry.yarnpkg.com/string-argv/-/string-argv-0.0.2.tgz#dac30408690c21f3c3630a3ff3a05877bdcbd736" +string-argv@^0.3.0: + version "0.3.1" + resolved "https://registry.yarnpkg.com/string-argv/-/string-argv-0.3.1.tgz#95e2fbec0427ae19184935f816d74aaa4c5c19da" + integrity sha512-a1uQGz7IyVy9YwhqjZIZu1c8JO8dNIe20xBmSS6qu9kv++k3JGzCVmprbNN5Kn+BgzD5E7YYwg1CcjuJMRNsvg== string-length@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/string-length/-/string-length-2.0.0.tgz#d40dbb686a3ace960c1cffca562bf2c45f8363ed" + integrity sha1-1A27aGo6zpYMHP/KVivyxF+DY+0= dependencies: astral-regex "^1.0.0" strip-ansi "^4.0.0" +string-range@~1.2, string-range@~1.2.1: + version "1.2.2" + resolved "https://registry.yarnpkg.com/string-range/-/string-range-1.2.2.tgz#a893ed347e72299bc83befbbf2a692a8d239d5dd" + integrity sha1-qJPtNH5yKZvIO++78qaSqNI51d0= + string-width@^1.0.1, string-width@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/string-width/-/string-width-1.0.2.tgz#118bdf5b8cdc51a2a7e70d211e07e2b0b9b107d3" + integrity sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M= dependencies: code-point-at "^1.0.0" is-fullwidth-code-point "^1.0.0" strip-ansi "^3.0.0" -string-width@^2.0.0, string-width@^2.1.0, string-width@^2.1.1: +"string-width@^1.0.2 || 2", string-width@^2.1.0, string-width@^2.1.1: version "2.1.1" resolved "https://registry.yarnpkg.com/string-width/-/string-width-2.1.1.tgz#ab93f27a8dc13d28cac815c462143a6d9012ae9e" + integrity sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw== dependencies: is-fullwidth-code-point "^2.0.0" strip-ansi "^4.0.0" -string-width@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/string-width/-/string-width-3.0.0.tgz#5a1690a57cc78211fffd9bf24bbe24d090604eb1" - integrity sha512-rr8CUxBbvOZDUvc5lNIJ+OC1nPVpz+Siw9VBtUjB9b6jZehZLFt0JMCZzShFHIsI8cbhm0EsNIfWJMFV3cu3Ew== +string-width@^3.0.0, string-width@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/string-width/-/string-width-3.1.0.tgz#22767be21b62af1081574306f69ac51b62203961" + integrity sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w== dependencies: emoji-regex "^7.0.1" is-fullwidth-code-point "^2.0.0" - strip-ansi "^5.0.0" + strip-ansi "^5.1.0" + +string-width@^4.1.0, string-width@^4.2.0: + version "4.2.0" + resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.0.tgz#952182c46cc7b2c313d1596e623992bd163b72b5" + integrity sha512-zUz5JD+tgqtuDjMhwIg5uFVV3dtqZ9yQJlZVfq4I01/K5Paj5UHj7VyrQOJvzawSVlKpObApbfD0Ed6yJc+1eg== + dependencies: + emoji-regex "^8.0.0" + is-fullwidth-code-point "^3.0.0" + strip-ansi "^6.0.0" string.prototype.padend@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/string.prototype.padend/-/string.prototype.padend-3.0.0.tgz#f3aaef7c1719f170c5eab1c32bf780d96e21f2f0" + integrity sha1-86rvfBcZ8XDF6rHDK/eA2W4h8vA= dependencies: define-properties "^1.1.2" es-abstract "^1.4.3" function-bind "^1.0.2" -string_decoder@^1.0.0, string_decoder@^1.1.1, string_decoder@~1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.1.1.tgz#9cf1611ba62685d7030ae9e4ba34149c3af03fc8" +string.prototype.trimleft@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/string.prototype.trimleft/-/string.prototype.trimleft-2.1.0.tgz#6cc47f0d7eb8d62b0f3701611715a3954591d634" + integrity sha512-FJ6b7EgdKxxbDxc79cOlok6Afd++TTs5szo+zJTUyow3ycrRfJVE2pq3vcN53XexvKZu/DJMDfeI/qMiZTrjTw== dependencies: - safe-buffer "~5.1.0" + define-properties "^1.1.3" + function-bind "^1.1.1" + +string.prototype.trimright@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/string.prototype.trimright/-/string.prototype.trimright-2.1.0.tgz#669d164be9df9b6f7559fa8e89945b168a5a6c58" + integrity sha512-fXZTSV55dNBwv16uw+hh5jkghxSnc5oHq+5K/gXgizHwAvMetdAJlHqqoFC1FSDVPYWLkAKl2cxpUT41sV7nSg== + dependencies: + define-properties "^1.1.3" + function-bind "^1.1.1" + +string_decoder@^1.1.1: + version "1.3.0" + resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.3.0.tgz#42f114594a46cf1a8e30b0a84f56c78c3edac21e" + integrity sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA== + dependencies: + safe-buffer "~5.2.0" string_decoder@~0.10.x: version "0.10.31" resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-0.10.31.tgz#62e203bc41766c6c28c9fc84301dab1c5310fa94" + integrity sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ= -stringify-object@^3.2.2: - version "3.2.2" - resolved "https://registry.yarnpkg.com/stringify-object/-/stringify-object-3.2.2.tgz#9853052e5a88fb605a44cd27445aa257ad7ffbcd" +string_decoder@~1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.1.1.tgz#9cf1611ba62685d7030ae9e4ba34149c3af03fc8" + integrity sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg== + dependencies: + safe-buffer "~5.1.0" + +stringify-object@^3.3.0: + version "3.3.0" + resolved "https://registry.yarnpkg.com/stringify-object/-/stringify-object-3.3.0.tgz#703065aefca19300d3ce88af4f5b3956d7556629" + integrity sha512-rHqiFh1elqCQ9WPLIC8I0Q/g/wj5J1eMkyoiD6eoQApWHP0FtlK7rqnhmabL5VUY9JQCcqwwvlOaSuutekgyrw== dependencies: - get-own-enumerable-property-symbols "^2.0.1" + get-own-enumerable-property-symbols "^3.0.0" is-obj "^1.0.1" is-regexp "^1.0.0" strip-ansi@^3.0.0, strip-ansi@^3.0.1: version "3.0.1" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-3.0.1.tgz#6a385fb8853d952d5ff05d0e8aaf94278dc63dcf" + integrity sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8= dependencies: ansi-regex "^2.0.0" strip-ansi@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-4.0.0.tgz#a8479022eb1ac368a871389b635262c505ee368f" + integrity sha1-qEeQIusaw2iocTibY1JixQXuNo8= dependencies: ansi-regex "^3.0.0" -strip-ansi@^5.0.0: - version "5.0.0" - resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-5.0.0.tgz#f78f68b5d0866c20b2c9b8c61b5298508dc8756f" +strip-ansi@^5.0.0, strip-ansi@^5.1.0, strip-ansi@^5.2.0: + version "5.2.0" + resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-5.2.0.tgz#8c9a536feb6afc962bdfa5b104a5091c1ad9c0ae" + integrity sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA== dependencies: - ansi-regex "^4.0.0" + ansi-regex "^4.1.0" -strip-bom-stream@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/strip-bom-stream/-/strip-bom-stream-2.0.0.tgz#f87db5ef2613f6968aa545abfe1ec728b6a829ca" +strip-ansi@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.0.tgz#0b1571dd7669ccd4f3e06e14ef1eed26225ae532" + integrity sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w== dependencies: - first-chunk-stream "^2.0.0" - strip-bom "^2.0.0" + ansi-regex "^5.0.0" strip-bom@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/strip-bom/-/strip-bom-2.0.0.tgz#6219a85616520491f35788bdbf1447a99c7e6b0e" + integrity sha1-YhmoVhZSBJHzV4i9vxRHqZx+aw4= dependencies: is-utf8 "^0.2.0" strip-bom@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/strip-bom/-/strip-bom-3.0.0.tgz#2334c18e9c759f7bdd56fdef7e9ae3d588e68ed3" + integrity sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM= strip-eof@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/strip-eof/-/strip-eof-1.0.0.tgz#bb43ff5598a6eb05d89b59fcd129c983313606bf" + integrity sha1-u0P/VZim6wXYm1n80SnJgzE2Br8= + +strip-final-newline@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/strip-final-newline/-/strip-final-newline-2.0.0.tgz#89b852fb2fcbe936f6f4b3187afb0a12c1ab58ad" + integrity sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA== strip-indent@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/strip-indent/-/strip-indent-1.0.1.tgz#0c7962a6adefa7bbd4ac366460a638552ae1a0a2" + integrity sha1-DHlipq3vp7vUrDZkYKY4VSrhoKI= dependencies: get-stdin "^4.0.1" strip-indent@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/strip-indent/-/strip-indent-2.0.0.tgz#5ef8db295d01e6ed6cbf7aab96998d7822527b68" + integrity sha1-XvjbKV0B5u1sv3qrlpmNeCJSe2g= + +strip-json-comments@^3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-3.0.1.tgz#85713975a91fb87bf1b305cca77395e40d2a64a7" + integrity sha512-VTyMAUfdm047mwKl+u79WIdrZxtFtn+nBxHeb844XBQ9uMNTuTHdx2hc5RiAJYqwTj3wc/xe5HLSdJSkJ+WfZw== -strip-json-comments@^2.0.1, strip-json-comments@~2.0.1: +strip-json-comments@~2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-2.0.1.tgz#3c531942e908c2697c0ec344858c286c7ca0a60a" + integrity sha1-PFMZQukIwml8DsNEhYwobHygpgo= strong-log-transformer@^2.0.0: version "2.1.0" resolved "https://registry.yarnpkg.com/strong-log-transformer/-/strong-log-transformer-2.1.0.tgz#0f5ed78d325e0421ac6f90f7f10e691d6ae3ae10" + integrity sha512-B3Hgul+z0L9a236FAUC9iZsL+nVHgoCJnqCbN588DjYxvGXaXaaFbfmQ/JhvKjZwsOukuR72XbHv71Qkug0HxA== dependencies: duplexer "^0.1.1" minimist "^1.2.0" @@ -8957,34 +9894,33 @@ strong-log-transformer@^2.0.0: subarg@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/subarg/-/subarg-1.0.0.tgz#f62cf17581e996b48fc965699f54c06ae268b8d2" + integrity sha1-9izxdYHplrSPyWVpn1TAauJouNI= dependencies: minimist "^1.1.0" supports-color@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-2.0.0.tgz#535d045ce6b6363fa40117084629995e9df324c7" - -supports-color@^4.2.1: - version "4.5.0" - resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-4.5.0.tgz#be7a0de484dec5c5cddf8b3d59125044912f635b" - dependencies: - has-flag "^2.0.0" + version "2.0.0" + resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-2.0.0.tgz#535d045ce6b6363fa40117084629995e9df324c7" + integrity sha1-U10EXOa2Nj+kARcIRimZXp3zJMc= -supports-color@^5.2.0, supports-color@^5.3.0: - version "5.3.0" - resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-5.3.0.tgz#5b24ac15db80fa927cf5227a4a33fd3c4c7676c0" +supports-color@^5.3.0: + version "5.5.0" + resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-5.5.0.tgz#e2e69a44ac8772f78a1ec0b35b689df6530efc8f" + integrity sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow== dependencies: has-flag "^3.0.0" -supports-color@^6.0.0, supports-color@^6.1.0: +supports-color@^6.1.0: version "6.1.0" resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-6.1.0.tgz#0764abc69c63d5ac842dd4867e8d025e880df8f3" + integrity sha512-qe1jfm1Mg7Nq/NSh6XE24gPXROEVsWHxC1LIx//XNlD9iw7YZQGjZNjYN7xGaEG6iKdA8EtNFW6R0gjnVXp+wQ== dependencies: has-flag "^3.0.0" sver-compat@^1.5.0: version "1.5.0" resolved "https://registry.yarnpkg.com/sver-compat/-/sver-compat-1.5.0.tgz#3cf87dfeb4d07b4a3f14827bc186b3fd0c645cd8" + integrity sha1-PPh9/rTQe0o/FIJ7wYaz/QxkXNg= dependencies: es6-iterator "^2.0.1" es6-symbol "^3.1.1" @@ -8992,55 +9928,57 @@ sver-compat@^1.5.0: symbol-observable@^1.1.0: version "1.2.0" resolved "https://registry.yarnpkg.com/symbol-observable/-/symbol-observable-1.2.0.tgz#c22688aed4eab3cdc2dfeacbb561660560a00804" + integrity sha512-e900nM8RRtGhlV36KGEU9k65K3mPb1WV70OdjfxlG2EAuM1noi/E/BaW/uMhL7bPEssK8QV57vN3esixjUvcXQ== symbol-tree@^3.2.2: - version "3.2.2" - resolved "https://registry.yarnpkg.com/symbol-tree/-/symbol-tree-3.2.2.tgz#ae27db38f660a7ae2e1c3b7d1bc290819b8519e6" - -synchronous-promise@^2.0.6: - version "2.0.8" - resolved "https://registry.yarnpkg.com/synchronous-promise/-/synchronous-promise-2.0.8.tgz#01fd026fffdbf2d3d39ec06ee1a7c971578136f7" - integrity sha512-xYavZtFC1vKgJu0AOSYdrLeikNCsNwmUeZaV1XF9cMqEhBVVxLq6rEbYzOGrF1MV2MNPkhsJqqiXuQ4a76CEUg== + version "3.2.4" + resolved "https://registry.yarnpkg.com/symbol-tree/-/symbol-tree-3.2.4.tgz#430637d248ba77e078883951fb9aa0eed7c63fa2" + integrity sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw== syntax-error@^1.1.1: version "1.4.0" resolved "https://registry.yarnpkg.com/syntax-error/-/syntax-error-1.4.0.tgz#2d9d4ff5c064acb711594a3e3b95054ad51d907c" + integrity sha512-YPPlu67mdnHGTup2A8ff7BC2Pjq0e0Yp/IyTFN03zWO0RcK07uLcbi7C2KpGR2FvWbaB0+bfE27a+sBKebSo7w== dependencies: acorn-node "^1.2.0" table@^5.2.3: - version "5.2.3" - resolved "https://registry.yarnpkg.com/table/-/table-5.2.3.tgz#cde0cc6eb06751c009efab27e8c820ca5b67b7f2" - integrity sha512-N2RsDAMvDLvYwFcwbPyF3VmVSSkuF+G1e+8inhBLtHpvwXGw4QRPEZhihQNeEN0i1up6/f6ObCJXNdlRG3YVyQ== + version "5.4.6" + resolved "https://registry.yarnpkg.com/table/-/table-5.4.6.tgz#1292d19500ce3f86053b05f0e8e7e4a3bb21079e" + integrity sha512-wmEc8m4fjnob4gt5riFRtTu/6+4rSe12TpAELNSqHMfF3IqnA+CH37USM6/YR3qRZv7e56kAEAtd6nKZaxe0Ug== dependencies: - ajv "^6.9.1" - lodash "^4.17.11" + ajv "^6.10.2" + lodash "^4.17.14" slice-ansi "^2.1.0" string-width "^3.0.0" tapable@^0.2.7: - version "0.2.8" - resolved "https://registry.yarnpkg.com/tapable/-/tapable-0.2.8.tgz#99372a5c999bf2df160afc0d74bed4f47948cd22" + version "0.2.9" + resolved "https://registry.yarnpkg.com/tapable/-/tapable-0.2.9.tgz#af2d8bbc9b04f74ee17af2b4d9048f807acd18a8" + integrity sha512-2wsvQ+4GwBvLPLWsNfLCDYGsW6xb7aeC6utq2Qh0PFwgEy7K7dsma9Jsmb2zSQj7GvYAyUGSntLtsv++GmgL1A== -tar@^4, tar@^4.4.8: - version "4.4.8" - resolved "https://registry.yarnpkg.com/tar/-/tar-4.4.8.tgz#b19eec3fde2a96e64666df9fdb40c5ca1bc3747d" +tar@^4, tar@^4.4.10, tar@^4.4.12, tar@^4.4.8: + version "4.4.13" + resolved "https://registry.yarnpkg.com/tar/-/tar-4.4.13.tgz#43b364bc52888d555298637b10d60790254ab525" + integrity sha512-w2VwSrBoHa5BsSyH+KxEqeQBAllHhccyMFVHtGtdMpF4W7IRWfZjFiQceJPChOeTsSDVUpER2T8FA93pr0L+QA== dependencies: chownr "^1.1.1" fs-minipass "^1.2.5" - minipass "^2.3.4" - minizlib "^1.1.1" + minipass "^2.8.6" + minizlib "^1.2.1" mkdirp "^0.5.0" safe-buffer "^5.1.2" - yallist "^3.0.2" + yallist "^3.0.3" temp-dir@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/temp-dir/-/temp-dir-1.0.0.tgz#0a7c0ea26d3a39afa7e0ebea9c1fc0bc4daa011d" + integrity sha1-CnwOom06Oa+n4OvqnB/AvE2qAR0= temp-write@^3.4.0: version "3.4.0" resolved "https://registry.yarnpkg.com/temp-write/-/temp-write-3.4.0.tgz#8cff630fb7e9da05f047c74ce4ce4d685457d492" + integrity sha1-jP9jD7fp2gXwR8dM5M5NaFRX1JI= dependencies: graceful-fs "^4.1.2" is-stream "^1.1.0" @@ -9049,44 +9987,66 @@ temp-write@^3.4.0: temp-dir "^1.0.0" uuid "^3.0.1" -test-exclude@^5.0.0: - version "5.0.0" - resolved "https://registry.yarnpkg.com/test-exclude/-/test-exclude-5.0.0.tgz#cdce7cece785e0e829cd5c2b27baf18bc583cfb7" +terser@^4.6.2: + version "4.6.6" + resolved "https://registry.yarnpkg.com/terser/-/terser-4.6.6.tgz#da2382e6cafbdf86205e82fb9a115bd664d54863" + integrity sha512-4lYPyeNmstjIIESr/ysHg2vUPRGf2tzF9z2yYwnowXVuVzLEamPN1Gfrz7f8I9uEPuHcbFlW4PLIAsJoxXyJ1g== dependencies: - arrify "^1.0.1" + commander "^2.20.0" + source-map "~0.6.1" + source-map-support "~0.5.12" + +test-exclude@^5.2.3: + version "5.2.3" + resolved "https://registry.yarnpkg.com/test-exclude/-/test-exclude-5.2.3.tgz#c3d3e1e311eb7ee405e092dac10aefd09091eac0" + integrity sha512-M+oxtseCFO3EDtAaGH7iiej3CBkzXqFMbzqYAACdzKui4eZA+pq3tZEwChvOdNfa7xxy8BfbmgJSIr43cC/+2g== + dependencies: + glob "^7.1.3" minimatch "^3.0.4" read-pkg-up "^4.0.0" - require-main-filename "^1.0.1" + require-main-filename "^2.0.0" -test262-parser@^2.0.7: - version "2.0.7" - resolved "https://registry.yarnpkg.com/test262-parser/-/test262-parser-2.0.7.tgz#733b46bf7759e747eae34b5b14d6a3c8d2082add" +test262-stream@^1.3.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/test262-stream/-/test262-stream-1.3.0.tgz#98c4ab9f8e74c7f9478afcf52e071a89d319df61" + integrity sha512-TSv+Z4hftmRuUJVJk7kaguWLlVLRfwyWm1DOt4kvTXAanATxv6A1HhjRTrSBI00XXEWQ+cUdsDii8tn+fkjXyw== dependencies: js-yaml "^3.2.1" - through "^2.3.4" - -test262-stream@^1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/test262-stream/-/test262-stream-1.2.0.tgz#37f03bf56672ec0f0120596372ea98313309d32e" - dependencies: klaw "^2.1.0" - test262-parser "^2.0.7" text-extensions@^1.0.0: - version "1.7.0" - resolved "https://registry.yarnpkg.com/text-extensions/-/text-extensions-1.7.0.tgz#faaaba2625ed746d568a23e4d0aacd9bf08a8b39" + version "1.9.0" + resolved "https://registry.yarnpkg.com/text-extensions/-/text-extensions-1.9.0.tgz#1853e45fee39c945ce6f6c36b2d659b5aabc2a26" + integrity sha512-wiBrwC1EhBelW12Zy26JeOUkQ5mRu+5o8rpsJk5+2t+Y5vE7e842qtZDQ2g1NpX/29HdyFeJ4nSIhI47ENSxlQ== text-table@^0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/text-table/-/text-table-0.2.0.tgz#7f5ee823ae805207c00af2df4a84ec3fcfa570b4" + integrity sha1-f17oI66AUgfACvLfSoTsP8+lcLQ= + +thenify-all@^1.0.0: + version "1.6.0" + resolved "https://registry.yarnpkg.com/thenify-all/-/thenify-all-1.6.0.tgz#1a1918d402d8fc3f98fbf234db0bcc8cc10e9726" + integrity sha1-GhkY1ALY/D+Y+/I02wvMjMEOlyY= + dependencies: + thenify ">= 3.1.0 < 4" + +"thenify@>= 3.1.0 < 4": + version "3.3.0" + resolved "https://registry.yarnpkg.com/thenify/-/thenify-3.3.0.tgz#e69e38a1babe969b0108207978b9f62b88604839" + integrity sha1-5p44obq+lpsBCCB5eLn2K4hgSDk= + dependencies: + any-promise "^1.0.0" throat@^4.0.0: version "4.1.0" resolved "https://registry.yarnpkg.com/throat/-/throat-4.1.0.tgz#89037cbc92c56ab18926e6ba4cbb200e15672a6a" + integrity sha1-iQN8vJLFarGJJua6TLsgDhVnKmo= -through2-filter@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/through2-filter/-/through2-filter-2.0.0.tgz#60bc55a0dacb76085db1f9dae99ab43f83d622ec" +through2-filter@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/through2-filter/-/through2-filter-3.0.0.tgz#700e786df2367c2c88cd8aa5be4cf9c1e7831254" + integrity sha512-jaRjI2WxN3W1V8/FMZ9HKIBXixtiqs3SQSX4/YGIiP3gL6djW48VoZq9tDqeCWs3MT8YY5wb/zli8VW8snY1CA== dependencies: through2 "~2.0.0" xtend "~4.0.0" @@ -9094,13 +10054,15 @@ through2-filter@^2.0.0: through2@^1.0.0: version "1.1.1" resolved "https://registry.yarnpkg.com/through2/-/through2-1.1.1.tgz#0847cbc4449f3405574dbdccd9bb841b83ac3545" + integrity sha1-CEfLxESfNAVXTb3M2buEG4OsNUU= dependencies: readable-stream ">=1.1.13-1 <1.2.0-0" xtend ">=4.0.0 <4.1.0-0" -through2@^2.0.0, through2@^2.0.1, through2@^2.0.2, through2@^2.0.3, through2@~2.0.0: +through2@^2.0.0, through2@^2.0.2, through2@^2.0.3, through2@~2.0.0: version "2.0.5" resolved "https://registry.yarnpkg.com/through2/-/through2-2.0.5.tgz#01c1e39eb31d07cb7d03a96a70823260b23132cd" + integrity sha512-/mrRod8xqpA+IHSLyGCQ2s8SPHiCDEeQJSep1jqLYeEUClOFG2Qsh+4FU6G9VeqpZnGW/Su8LQGc4YKni5rYSQ== dependencies: readable-stream "~2.3.6" xtend "~4.0.1" @@ -9112,67 +10074,74 @@ through2@^3.0.0: dependencies: readable-stream "2 || 3" -through@2, "through@>=2.2.7 <3", through@^2.3.4, through@^2.3.6, through@^2.3.8, through@~2.3.6: +through@2, "through@>=2.2.7 <3", through@^2.3.4, through@^2.3.6: version "2.3.8" resolved "https://registry.yarnpkg.com/through/-/through-2.3.8.tgz#0dd4c9ffaabc357960b1b724115d7e0e86a2e1f5" + integrity sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU= time-stamp@^1.0.0: version "1.1.0" resolved "https://registry.yarnpkg.com/time-stamp/-/time-stamp-1.1.0.tgz#764a5a11af50561921b133f3b44e618687e0f5c3" + integrity sha1-dkpaEa9QVhkhsTPztE5hhofg9cM= timers-browserify@^1.0.1: version "1.4.2" resolved "https://registry.yarnpkg.com/timers-browserify/-/timers-browserify-1.4.2.tgz#c9c58b575be8407375cb5e2462dacee74359f41d" + integrity sha1-ycWLV1voQHN1y14kYtrO50NZ9B0= dependencies: process "~0.11.0" -timers-browserify@^2.0.4: - version "2.0.6" - resolved "https://registry.yarnpkg.com/timers-browserify/-/timers-browserify-2.0.6.tgz#241e76927d9ca05f4d959819022f5b3664b64bae" - dependencies: - setimmediate "^1.0.4" - tmp@^0.0.33: version "0.0.33" resolved "https://registry.yarnpkg.com/tmp/-/tmp-0.0.33.tgz#6d34335889768d21b2bcda0aa277ced3b1bfadf9" + integrity sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw== dependencies: os-tmpdir "~1.0.2" tmpl@1.0.x: version "1.0.4" resolved "https://registry.yarnpkg.com/tmpl/-/tmpl-1.0.4.tgz#23640dd7b42d00433911140820e5cf440e521dd1" + integrity sha1-I2QN17QtAEM5ERQIIOXPRA5SHdE= to-absolute-glob@^2.0.0: version "2.0.2" resolved "https://registry.yarnpkg.com/to-absolute-glob/-/to-absolute-glob-2.0.2.tgz#1865f43d9e74b0822db9f145b78cff7d0f7c849b" + integrity sha1-GGX0PZ50sIItufFFt4z/fQ98hJs= dependencies: is-absolute "^1.0.0" is-negated-glob "^1.0.0" -to-arraybuffer@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/to-arraybuffer/-/to-arraybuffer-1.0.1.tgz#7d229b1fcc637e466ca081180836a7aabff83f43" - to-fast-properties@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/to-fast-properties/-/to-fast-properties-2.0.0.tgz#dc5e698cbd079265bc73e0377681a4e4e83f616e" + integrity sha1-3F5pjL0HkmW8c+A3doGk5Og/YW4= to-object-path@^0.3.0: version "0.3.0" resolved "https://registry.yarnpkg.com/to-object-path/-/to-object-path-0.3.0.tgz#297588b7b0e7e0ac08e04e672f85c1f4999e17af" + integrity sha1-KXWIt7Dn4KwI4E5nL4XB9JmeF68= dependencies: kind-of "^3.0.2" to-regex-range@^2.1.0: version "2.1.1" resolved "https://registry.yarnpkg.com/to-regex-range/-/to-regex-range-2.1.1.tgz#7c80c17b9dfebe599e27367e0d4dd5590141db38" + integrity sha1-fIDBe53+vlmeJzZ+DU3VWQFB2zg= dependencies: is-number "^3.0.0" repeat-string "^1.6.1" +to-regex-range@^5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/to-regex-range/-/to-regex-range-5.0.1.tgz#1648c44aae7c8d988a326018ed72f5b4dd0392e4" + integrity sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ== + dependencies: + is-number "^7.0.0" + to-regex@^3.0.1, to-regex@^3.0.2: version "3.0.2" resolved "https://registry.yarnpkg.com/to-regex/-/to-regex-3.0.2.tgz#13cfdd9b336552f30b51f33a8ae1b42a7a7599ce" + integrity sha512-FWtleNAtZ/Ki2qtqej2CXTOayOH9bHDQF+Q48VpWyDXjbYxA4Yz8iDB31zXOBUlOHHKidDbqGVrTUvQMPmBGBw== dependencies: define-property "^2.0.2" extend-shallow "^3.0.2" @@ -9182,127 +10151,167 @@ to-regex@^3.0.1, to-regex@^3.0.2: to-through@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/to-through/-/to-through-2.0.0.tgz#fc92adaba072647bc0b67d6b03664aa195093af6" + integrity sha1-/JKtq6ByZHvAtn1rA2ZKoZUJOvY= dependencies: through2 "^2.0.3" -toposort@^2.0.2: - version "2.0.2" - resolved "https://registry.yarnpkg.com/toposort/-/toposort-2.0.2.tgz#ae21768175d1559d48bef35420b2f4962f09c330" - integrity sha1-riF2gXXRVZ1IvvNUILL0li8JwzA= +tough-cookie@^2.3.3, tough-cookie@^2.3.4: + version "2.5.0" + resolved "https://registry.yarnpkg.com/tough-cookie/-/tough-cookie-2.5.0.tgz#cd9fb2a0aa1d5a12b473bd9fb96fa3dcff65ade2" + integrity sha512-nlLsUzgm1kfLXSXfRZMc1KLAugd4hqJHDTvc2hDIwS3mZAfMEuMbc03SujMF+GEcpaX/qboeycw6iO8JwVv2+g== + dependencies: + psl "^1.1.28" + punycode "^2.1.1" -tough-cookie@>=2.3.3, tough-cookie@^2.3.3, tough-cookie@~2.4.3: +tough-cookie@~2.4.3: version "2.4.3" resolved "https://registry.yarnpkg.com/tough-cookie/-/tough-cookie-2.4.3.tgz#53f36da3f47783b0925afa06ff9f3b165280f781" + integrity sha512-Q5srk/4vDM54WJsJio3XNn6K2sCG+CQ8G5Wz6bZhRZoAe/+TxjWB/GlFAnYEbkYVlON9FMk/fE3h2RLpPXo4lQ== dependencies: psl "^1.1.24" punycode "^1.4.1" -tr46@^1.0.0, tr46@^1.0.1: +tr46@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/tr46/-/tr46-1.0.1.tgz#a8b13fd6bfd2489519674ccde55ba3693b706d09" + integrity sha1-qLE/1r/SSJUZZ0zN5VujaTtwbQk= dependencies: punycode "^2.1.0" trim-newlines@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/trim-newlines/-/trim-newlines-1.0.0.tgz#5887966bb582a4503a41eb524f7d35011815a613" + integrity sha1-WIeWa7WCpFA6QetST301ARgVphM= trim-newlines@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/trim-newlines/-/trim-newlines-2.0.0.tgz#b403d0b91be50c331dfc4b82eeceb22c3de16d20" + integrity sha1-tAPQuRvlDDMd/EuC7s6yLD3hbSA= trim-off-newlines@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/trim-off-newlines/-/trim-off-newlines-1.0.1.tgz#9f9ba9d9efa8764c387698bcbfeb2c848f11adb3" + integrity sha1-n5up2e+odkw4dpi8v+sshI8RrbM= -trim-right@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/trim-right/-/trim-right-1.0.1.tgz#cb2e1203067e0c8de1f614094b9fe45704ea6003" - -tslib@^1.9.0: - version "1.9.3" - resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.9.3.tgz#d7e4dd79245d85428c4d7e4822a79917954ca286" +tslib@^1.8.1, tslib@^1.9.0: + version "1.10.0" + resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.10.0.tgz#c3c19f95973fb0a62973fb09d90d961ee43e5c8a" + integrity sha512-qOebF53frne81cf0S9B41ByenJ3/IuH8yJKngAX35CmiZySA0khhkovshKK+jGCaMnVomla7gVlIcc3EvKPbTQ== -tty-browserify@0.0.0: - version "0.0.0" - resolved "https://registry.yarnpkg.com/tty-browserify/-/tty-browserify-0.0.0.tgz#a157ba402da24e9bf957f9aa69d524eed42901a6" +tsutils@^3.17.1: + version "3.17.1" + resolved "https://registry.yarnpkg.com/tsutils/-/tsutils-3.17.1.tgz#ed719917f11ca0dee586272b2ac49e015a2dd759" + integrity sha512-kzeQ5B8H3w60nFY2g8cJIuH7JDpsALXySGtwGJ0p2LSjLgay3NdIpqq5SoOBe46bKDW2iq25irHCr8wjomUS2g== + dependencies: + tslib "^1.8.1" tty-browserify@0.0.1: version "0.0.1" resolved "https://registry.yarnpkg.com/tty-browserify/-/tty-browserify-0.0.1.tgz#3f05251ee17904dfd0677546670db9651682b811" + integrity sha512-C3TaO7K81YvjCgQH9Q1S3R3P3BtN3RIM8n+OvX4il1K1zgE8ZhI0op7kClgkxtutIE8hQrcrHBXvIheqKUUCxw== tunnel-agent@^0.6.0: version "0.6.0" resolved "https://registry.yarnpkg.com/tunnel-agent/-/tunnel-agent-0.6.0.tgz#27a5dea06b36b04a0a9966774b290868f0fc40fd" + integrity sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0= dependencies: safe-buffer "^5.0.1" tweetnacl@^0.14.3, tweetnacl@~0.14.0: version "0.14.5" resolved "https://registry.yarnpkg.com/tweetnacl/-/tweetnacl-0.14.5.tgz#5ae68177f192d4456269d108afa93ff8743f4f64" + integrity sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q= type-check@~0.3.2: version "0.3.2" resolved "https://registry.yarnpkg.com/type-check/-/type-check-0.3.2.tgz#5884cab512cf1d355e3fb784f30804b2b520db72" + integrity sha1-WITKtRLPHTVeP7eE8wgEsrUg23I= dependencies: prelude-ls "~1.1.2" -type-fest@^0.4.1: - version "0.4.1" - resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.4.1.tgz#8bdf77743385d8a4f13ba95f610f5ccd68c728f8" - integrity sha512-IwzA/LSfD2vC1/YDYMv/zHP4rDF1usCwllsDpbolT3D4fUepIO7f9K70jjmUewU/LmGUKJcwcVtDCpnKk4BPMw== +type-fest@^0.3.0: + version "0.3.1" + resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.3.1.tgz#63d00d204e059474fe5e1b7c011112bbd1dc29e1" + integrity sha512-cUGJnCdr4STbePCgqNFbpVNCepa+kAVohJs1sLhxzdH+gnEoOd8VhbYa7pD3zZYGiURWM2xzEII3fQcRizDkYQ== -typedarray@^0.0.6, typedarray@~0.0.5: - version "0.0.6" - resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777" +type-fest@^0.6.0: + version "0.6.0" + resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.6.0.tgz#8d2a2370d3df886eb5c90ada1c5bf6188acf838b" + integrity sha512-q+MB8nYR1KDLrgr4G5yemftpMC7/QLqVndBmEEdqzmNj5dcFOO4Oo8qlwZE3ULT3+Zim1F8Kq4cBnikNhlCMlg== -uglify-js@3.3.x, uglify-js@^3.0.5, uglify-js@^3.1.4: - version "3.3.13" - resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-3.3.13.tgz#8a1a89eeb16e2d6a66b0db2b04cb871af3c669cf" - dependencies: - commander "~2.14.1" - source-map "~0.6.1" +type-fest@^0.8.1: + version "0.8.1" + resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.8.1.tgz#09e249ebde851d3b1e48d27c105444667f17b83d" + integrity sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA== -uglify-js@^2.8.29: - version "2.8.29" - resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-2.8.29.tgz#29c5733148057bb4e1f75df35b7a9cb72e6a59dd" - dependencies: - source-map "~0.5.1" - yargs "~3.10.0" - optionalDependencies: - uglify-to-browserify "~1.0.0" +type@^1.0.1: + version "1.2.0" + resolved "https://registry.yarnpkg.com/type/-/type-1.2.0.tgz#848dd7698dafa3e54a6c479e759c4bc3f18847a0" + integrity sha512-+5nt5AAniqsCnu2cEQQdpzCAh33kVx8n0VoFidKpB1dVVLAN/F+bgVOqOJqOnEnrhp222clB5p3vUlD+1QAnfg== -uglify-to-browserify@~1.0.0: - version "1.0.2" - resolved "https://registry.yarnpkg.com/uglify-to-browserify/-/uglify-to-browserify-1.0.2.tgz#6e0924d6bda6b5afe349e39a6d632850a0f882b7" +type@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/type/-/type-2.0.0.tgz#5f16ff6ef2eb44f260494dae271033b29c09a9c3" + integrity sha512-KBt58xCHry4Cejnc2ISQAF7QY+ORngsWfxezO68+12hKV6lQY8P/psIkcbjeHWn7MqcgciWJyCCevFMJdIXpow== + +typedarray-to-buffer@~1.0.0: + version "1.0.4" + resolved "https://registry.yarnpkg.com/typedarray-to-buffer/-/typedarray-to-buffer-1.0.4.tgz#9bb8ba0e841fb3f4cf1fe7c245e9f3fa8a5fe99c" + integrity sha1-m7i6DoQfs/TPH+fCRenz+opf6Zw= -uglifyjs-webpack-plugin@^0.4.6: - version "0.4.6" - resolved "https://registry.yarnpkg.com/uglifyjs-webpack-plugin/-/uglifyjs-webpack-plugin-0.4.6.tgz#b951f4abb6bd617e66f63eb891498e391763e309" +typedarray@^0.0.6: + version "0.0.6" + resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777" + integrity sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c= + +typescript@^3.6.3: + version "3.7.3" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.7.3.tgz#b36840668a16458a7025b9eabfad11b66ab85c69" + integrity sha512-Mcr/Qk7hXqFBXMN7p7Lusj1ktCBydylfQM/FZCk5glCNQJrCUKPkMHdo9R0MTFWsC/4kPFvDS0fDPvukfCkFsw== + +uglify-js@^3.1.4: + version "3.7.2" + resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-3.7.2.tgz#cb1a601e67536e9ed094a92dd1e333459643d3f9" + integrity sha512-uhRwZcANNWVLrxLfNFEdltoPNhECUR3lc+UdJoG9CBpMcSnKyWA94tc3eAujB1GcMY5Uwq8ZMp4qWpxWYDQmaA== dependencies: - source-map "^0.5.6" - uglify-js "^2.8.29" - webpack-sources "^1.0.1" + commander "~2.20.3" + source-map "~0.6.1" uid-number@0.0.6: version "0.0.6" resolved "https://registry.yarnpkg.com/uid-number/-/uid-number-0.0.6.tgz#0ea10e8035e8eb5b8e4449f06da1c730663baa81" + integrity sha1-DqEOgDXo61uOREnwbaHHMGY7qoE= umask@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/umask/-/umask-1.1.0.tgz#f29cebf01df517912bb58ff9c4e50fde8e33320d" + integrity sha1-8pzr8B31F5ErtY/5xOUP3o4zMg0= umd@^3.0.0: - version "3.0.1" - resolved "https://registry.yarnpkg.com/umd/-/umd-3.0.1.tgz#8ae556e11011f63c2596708a8837259f01b3d60e" + version "3.0.3" + resolved "https://registry.yarnpkg.com/umd/-/umd-3.0.3.tgz#aa9fe653c42b9097678489c01000acb69f0b26cf" + integrity sha512-4IcGSufhFshvLNcMCV80UnQVlZ5pMOC8mvNPForqwA4+lzYQuetTESLDQkeLmihq8bRcnpbQa48Wb8Lh16/xow== unc-path-regex@^0.1.2: version "0.1.2" resolved "https://registry.yarnpkg.com/unc-path-regex/-/unc-path-regex-0.1.2.tgz#e73dd3d7b0d7c5ed86fbac6b0ae7d8c6a69d50fa" + integrity sha1-5z3T17DXxe2G+6xrCufYxqadUPo= + +undeclared-identifiers@^1.1.2: + version "1.1.3" + resolved "https://registry.yarnpkg.com/undeclared-identifiers/-/undeclared-identifiers-1.1.3.tgz#9254c1d37bdac0ac2b52de4b6722792d2a91e30f" + integrity sha512-pJOW4nxjlmfwKApE4zvxLScM/njmwj/DiUBv7EabwE4O8kRUy+HIwxQtZLBPll/jx1LJyBcqNfB3/cpv9EZwOw== + dependencies: + acorn-node "^1.3.0" + dash-ast "^1.0.0" + get-assigned-identifiers "^1.2.0" + simple-concat "^1.0.0" + xtend "^4.0.1" undertaker-registry@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/undertaker-registry/-/undertaker-registry-1.0.1.tgz#5e4bda308e4a8a2ae584f9b9a4359a499825cc50" + integrity sha1-XkvaMI5KiirlhPm5pDWaSZglzFA= undertaker@^1.2.1: version "1.2.1" @@ -9322,133 +10331,156 @@ undertaker@^1.2.1: unicode-canonical-property-names-ecmascript@^1.0.4: version "1.0.4" resolved "https://registry.yarnpkg.com/unicode-canonical-property-names-ecmascript/-/unicode-canonical-property-names-ecmascript-1.0.4.tgz#2619800c4c825800efdd8343af7dd9933cbe2818" + integrity sha512-jDrNnXWHd4oHiTZnx/ZG7gtUTVp+gCcTTKr8L0HjlwphROEW3+Him+IpvC+xcJEFegapiMZyZe02CyuOnRmbnQ== unicode-match-property-ecmascript@^1.0.4: version "1.0.4" resolved "https://registry.yarnpkg.com/unicode-match-property-ecmascript/-/unicode-match-property-ecmascript-1.0.4.tgz#8ed2a32569961bce9227d09cd3ffbb8fed5f020c" + integrity sha512-L4Qoh15vTfntsn4P1zqnHulG0LdXgjSO035fEpdtp6YxXhMT51Q6vgM5lYdG/5X3MjS+k/Y9Xw4SFCY9IkR0rg== dependencies: unicode-canonical-property-names-ecmascript "^1.0.4" unicode-property-aliases-ecmascript "^1.0.4" -unicode-match-property-value-ecmascript@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/unicode-match-property-value-ecmascript/-/unicode-match-property-value-ecmascript-1.1.0.tgz#5b4b426e08d13a80365e0d657ac7a6c1ec46a277" - integrity sha512-hDTHvaBk3RmFzvSl0UVrUmC3PuW9wKVnpoUDYH0JDkSIovzw+J5viQmeYHxVSBptubnr7PbH2e0fnpDRQnQl5g== +unicode-match-property-value-ecmascript@^1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/unicode-match-property-value-ecmascript/-/unicode-match-property-value-ecmascript-1.2.0.tgz#0d91f600eeeb3096aa962b1d6fc88876e64ea531" + integrity sha512-wjuQHGQVofmSJv1uVISKLE5zO2rNGzM/KCYZch/QQvez7C1hUhBIuZ701fYXExuufJFMPhv2SyL8CyoIfMLbIQ== unicode-property-aliases-ecmascript@^1.0.4: - version "1.0.4" - resolved "https://registry.yarnpkg.com/unicode-property-aliases-ecmascript/-/unicode-property-aliases-ecmascript-1.0.4.tgz#5a533f31b4317ea76f17d807fa0d116546111dd0" + version "1.0.5" + resolved "https://registry.yarnpkg.com/unicode-property-aliases-ecmascript/-/unicode-property-aliases-ecmascript-1.0.5.tgz#a9cc6cc7ce63a0a3023fc99e341b94431d405a57" + integrity sha512-L5RAqCfXqAwR3RriF8pM0lU0w4Ryf/GgzONwi6KnL1taJQa7x1TCxdJnILX59WIGOwR57IVxn7Nej0fz1Ny6fw== union-value@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/union-value/-/union-value-1.0.0.tgz#5c71c34cb5bad5dcebe3ea0cd08207ba5aa1aea4" + version "1.0.1" + resolved "https://registry.yarnpkg.com/union-value/-/union-value-1.0.1.tgz#0b6fe7b835aecda61c6ea4d4f02c14221e109847" + integrity sha512-tJfXmxMeWYnczCVs7XAEvIV7ieppALdyepWMkHkwciRpZraG/xwT+s2JN8+pr1+8jCRf80FFzvr+MpQeeoF4Xg== dependencies: arr-union "^3.1.0" get-value "^2.0.6" is-extendable "^0.1.1" - set-value "^0.4.3" + set-value "^2.0.1" unique-filename@^1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/unique-filename/-/unique-filename-1.1.1.tgz#1d69769369ada0583103a1e6ae87681b56573230" + integrity sha512-Vmp0jIp2ln35UTXuryvjzkjGdRyf9b2lTXuSYUiPmzRcl3FDtYqAwOnTJkAngD9SWhnoJzDbTKwaOrZ+STtxNQ== dependencies: unique-slug "^2.0.0" unique-slug@^2.0.0: - version "2.0.1" - resolved "https://registry.yarnpkg.com/unique-slug/-/unique-slug-2.0.1.tgz#5e9edc6d1ce8fb264db18a507ef9bd8544451ca6" + version "2.0.2" + resolved "https://registry.yarnpkg.com/unique-slug/-/unique-slug-2.0.2.tgz#baabce91083fc64e945b0f3ad613e264f7cd4e6c" + integrity sha512-zoWr9ObaxALD3DOPfjPSqxt4fnZiWblxHIgeWqW8x7UqDzEtHEQLzji2cuJYQFCU6KmoJikOYAZlrTHHebjx2w== dependencies: imurmurhash "^0.1.4" unique-stream@^2.0.2: - version "2.2.1" - resolved "https://registry.yarnpkg.com/unique-stream/-/unique-stream-2.2.1.tgz#5aa003cfbe94c5ff866c4e7d668bb1c4dbadb369" + version "2.3.1" + resolved "https://registry.yarnpkg.com/unique-stream/-/unique-stream-2.3.1.tgz#c65d110e9a4adf9a6c5948b28053d9a8d04cbeac" + integrity sha512-2nY4TnBE70yoxHkDli7DMazpWiP7xMdCYqU2nBRO0UB+ZpEkGsSija7MvmvnZFUeC+mrgiUfcHSr3LmRFIg4+A== dependencies: - json-stable-stringify "^1.0.0" - through2-filter "^2.0.0" + json-stable-stringify-without-jsonify "^1.0.1" + through2-filter "^3.0.0" -universal-user-agent@^2.0.0, universal-user-agent@^2.0.1, universal-user-agent@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/universal-user-agent/-/universal-user-agent-2.1.0.tgz#5abfbcc036a1ba490cb941f8fd68c46d3669e8e4" - integrity sha512-8itiX7G05Tu3mGDTdNY2fB4KJ8MgZLS54RdG6PkkfwMAavrXu1mV/lls/GABx9O3Rw4PnTtasxrvbMQoBYY92Q== +universal-user-agent@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/universal-user-agent/-/universal-user-agent-4.0.0.tgz#27da2ec87e32769619f68a14996465ea1cb9df16" + integrity sha512-eM8knLpev67iBDizr/YtqkJsF3GK8gzDc6st/WKzrTuPtcsOKW/0IdL4cnMBsU69pOx0otavLWBDGTwg+dB0aA== dependencies: - os-name "^3.0.0" + os-name "^3.1.0" universalify@^0.1.0: - version "0.1.1" - resolved "https://registry.yarnpkg.com/universalify/-/universalify-0.1.1.tgz#fa71badd4437af4c148841e3b3b165f9e9e590b7" + version "0.1.2" + resolved "https://registry.yarnpkg.com/universalify/-/universalify-0.1.2.tgz#b646f69be3942dabcecc9d6639c80dc105efaa66" + integrity sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg== unset-value@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/unset-value/-/unset-value-1.0.0.tgz#8376873f7d2335179ffb1e6fc3a8ed0dfc8ab559" + integrity sha1-g3aHP30jNRef+x5vw6jtDfyKtVk= dependencies: has-value "^0.3.1" isobject "^3.0.0" upath@^1.1.1: - version "1.1.2" - resolved "https://registry.yarnpkg.com/upath/-/upath-1.1.2.tgz#3db658600edaeeccbe6db5e684d67ee8c2acd068" - integrity sha512-kXpym8nmDmlCBr7nKdIx8P2jNBa+pBpIUFRnKJ4dr8htyYGJFokkr2ZvERRtUN+9SY+JqXouNgUPtv6JQva/2Q== - -upper-case@^1.1.1: - version "1.1.3" - resolved "https://registry.yarnpkg.com/upper-case/-/upper-case-1.1.3.tgz#f6b4501c2ec4cdd26ba78be7222961de77621598" + version "1.2.0" + resolved "https://registry.yarnpkg.com/upath/-/upath-1.2.0.tgz#8f66dbcd55a883acdae4408af8b035a5044c1894" + integrity sha512-aZwGpamFO61g3OlfT7OQCHqhGnW43ieH9WZeP7QxN/G/jS4jfqUkZxoryvJgVPEcrl5NL/ggHsSmLMHuH64Lhg== uri-js@^4.2.2: version "4.2.2" resolved "https://registry.yarnpkg.com/uri-js/-/uri-js-4.2.2.tgz#94c540e1ff772956e2299507c010aea6c8838eb0" + integrity sha512-KY9Frmirql91X2Qgjry0Wd4Y+YTdrdZheS8TFwvkbLWf/G5KNJDCh6pKL5OZctEW4+0Baa5idK2ZQuELRwPznQ== dependencies: punycode "^2.1.0" urix@^0.1.0: version "0.1.0" resolved "https://registry.yarnpkg.com/urix/-/urix-0.1.0.tgz#da937f7a62e21fec1fd18d49b35c2935067a6c72" + integrity sha1-2pN/emLiH+wf0Y1Js1wpNQZ6bHI= -url-template@^2.0.8: - version "2.0.8" - resolved "https://registry.yarnpkg.com/url-template/-/url-template-2.0.8.tgz#fc565a3cccbff7730c775f5641f9555791439f21" - integrity sha1-/FZaPMy/93MMd19WQflVV5FDnyE= - -url@^0.11.0, url@~0.11.0: +url@~0.11.0: version "0.11.0" resolved "https://registry.yarnpkg.com/url/-/url-0.11.0.tgz#3838e97cfc60521eb73c525a8e55bfdd9e2e28f1" + integrity sha1-ODjpfPxgUh63PFJajlW/3Z4uKPE= dependencies: punycode "1.3.2" querystring "0.2.0" -use@^2.0.0: - version "2.0.2" - resolved "https://registry.yarnpkg.com/use/-/use-2.0.2.tgz#ae28a0d72f93bf22422a18a2e379993112dec8e8" - dependencies: - define-property "^0.2.5" - isobject "^3.0.0" - lazy-cache "^2.0.2" +use@^3.1.0: + version "3.1.1" + resolved "https://registry.yarnpkg.com/use/-/use-3.1.1.tgz#d50c8cac79a19fbc20f2911f56eb973f4e10070f" + integrity sha512-cwESVXlO3url9YWlFW/TA9cshCEhtu7IKJ/p5soJ/gGpj7vbvFrAY/eIioQ6Dw23KjZhYgiIo8HOs1nQ2vr/oQ== -util-deprecate@~1.0.1: +util-deprecate@^1.0.1, util-deprecate@~1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf" + integrity sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8= + +util-promisify@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/util-promisify/-/util-promisify-2.1.0.tgz#3c2236476c4d32c5ff3c47002add7c13b9a82a53" + integrity sha1-PCI2R2xNMsX/PEcAKt18E7moKlM= + dependencies: + object.getownpropertydescriptors "^2.0.3" util.promisify@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/util.promisify/-/util.promisify-1.0.0.tgz#440f7165a459c9a16dc145eb8e72f35687097030" + integrity sha512-i+6qA2MPhvoKLuxnJNpXAGhg7HphQOSUq2LKMZD0m15EiskXUkMvKdF4Uui0WYeCUGea+o2cw/ZuwehtfsrNkA== dependencies: define-properties "^1.1.2" object.getownpropertydescriptors "^2.0.3" -util@0.10.3, util@^0.10.3, util@~0.10.1: +util@0.10.3: version "0.10.3" resolved "https://registry.yarnpkg.com/util/-/util-0.10.3.tgz#7afb1afe50805246489e3db7fe0ed379336ac0f9" + integrity sha1-evsa/lCAUkZInj23/g7TeTNqwPk= dependencies: inherits "2.0.1" +util@~0.10.1: + version "0.10.4" + resolved "https://registry.yarnpkg.com/util/-/util-0.10.4.tgz#3aa0125bfe668a4672de58857d3ace27ecb76901" + integrity sha512-0Pm9hTQ3se5ll1XihRic3FDIku70C+iHUdT/W926rSgHV5QgXsYbKZN8MSC3tJtSkhuROzvsQjAaFENRXr+19A== + dependencies: + inherits "2.0.3" + uuid@^3.0.1, uuid@^3.3.2: - version "3.3.2" - resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.3.2.tgz#1b4af4955eb3077c501c23872fc6513811587131" - integrity sha512-yXJmeNaw3DnnKAOKJE51sL/ZaYfWJRl1pK9dr19YFCu0ObS231AB1/LbqTKRAQ5kw8A90rA6fr4riOUpTZvQZA== + version "3.3.3" + resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.3.3.tgz#4568f0216e78760ee1dbf3a4d2cf53e224112866" + integrity sha512-pW0No1RGHgzlpHJO1nsVrHKpOEIxkGg1xB+v0ZmdNH5OAeAwzAVrCnI2/6Mtx+Uys6iaylxa+D3g4j63IKKjSQ== + +v8-compile-cache@^2.0.3: + version "2.1.0" + resolved "https://registry.yarnpkg.com/v8-compile-cache/-/v8-compile-cache-2.1.0.tgz#e14de37b31a6d194f5690d67efc4e7f6fc6ab30e" + integrity sha512-usZBT3PW+LOjM25wbqIlZwPeJV+3OSz3M1k1Ws8snlW39dZyYL9lOGC5FgPVHfk0jKmjiDV8Z0mIbVQPiwFs7g== v8flags@^3.0.1: - version "3.0.2" - resolved "https://registry.yarnpkg.com/v8flags/-/v8flags-3.0.2.tgz#ad6a78a20a6b23d03a8debc11211e3cc23149477" + version "3.1.3" + resolved "https://registry.yarnpkg.com/v8flags/-/v8flags-3.1.3.tgz#fc9dc23521ca20c5433f81cc4eb9b3033bb105d8" + integrity sha512-amh9CCg3ZxkzQ48Mhcb8iX7xpAfYJgePHxWMQCBWECpOSqJUXgY26ncA61UTV0BkPqfhcy6mzwCIoP4ygxpW8w== dependencies: homedir-polyfill "^1.0.1" @@ -9463,35 +10495,28 @@ validate-npm-package-license@^3.0.1, validate-npm-package-license@^3.0.3: validate-npm-package-name@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/validate-npm-package-name/-/validate-npm-package-name-3.0.0.tgz#5fa912d81eb7d0c74afc140de7317f0ca7df437e" + integrity sha1-X6kS2B630MdK/BQN5zF/DKffQ34= dependencies: builtins "^1.0.3" value-or-function@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/value-or-function/-/value-or-function-3.0.0.tgz#1c243a50b595c1be54a754bfece8563b9ff8d813" + integrity sha1-HCQ6ULWVwb5Up1S/7OhWO5/42BM= verror@1.10.0: version "1.10.0" resolved "https://registry.yarnpkg.com/verror/-/verror-1.10.0.tgz#3a105ca17053af55d6e270c1f8288682e18da400" + integrity sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA= dependencies: assert-plus "^1.0.0" core-util-is "1.0.2" extsprintf "^1.2.0" -vinyl-file@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/vinyl-file/-/vinyl-file-2.0.0.tgz#a7ebf5ffbefda1b7d18d140fcb07b223efb6751a" - dependencies: - graceful-fs "^4.1.2" - pify "^2.3.0" - pinkie-promise "^2.0.0" - strip-bom "^2.0.0" - strip-bom-stream "^2.0.0" - vinyl "^1.1.0" - vinyl-fs@^3.0.0: - version "3.0.2" - resolved "https://registry.yarnpkg.com/vinyl-fs/-/vinyl-fs-3.0.2.tgz#1b86258844383f57581fcaac081fe09ef6d6d752" + version "3.0.3" + resolved "https://registry.yarnpkg.com/vinyl-fs/-/vinyl-fs-3.0.3.tgz#c85849405f67428feabbbd5c5dbdd64f47d31bc7" + integrity sha512-vIu34EkyNyJxmP0jscNzWBSygh7VWhqun6RmqVfXePrOwi9lhvRs//dOaGOTRUQr4tx7/zd26Tk5WeSVZitgng== dependencies: fs-mkdirp-stream "^1.0.0" glob-stream "^6.1.0" @@ -9514,6 +10539,7 @@ vinyl-fs@^3.0.0: vinyl-sourcemap@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/vinyl-sourcemap/-/vinyl-sourcemap-1.1.0.tgz#92a800593a38703a8cdb11d8b300ad4be63b3e16" + integrity sha1-kqgAWTo4cDqM2xHYswCtS+Y7PhY= dependencies: append-buffer "^1.0.2" convert-source-map "^1.5.0" @@ -9526,20 +10552,14 @@ vinyl-sourcemap@^1.1.0: vinyl-sourcemaps-apply@^0.2.0: version "0.2.1" resolved "https://registry.yarnpkg.com/vinyl-sourcemaps-apply/-/vinyl-sourcemaps-apply-0.2.1.tgz#ab6549d61d172c2b1b87be5c508d239c8ef87705" + integrity sha1-q2VJ1h0XLCsbh75cUI0jnI74dwU= dependencies: source-map "^0.5.1" -vinyl@^1.1.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/vinyl/-/vinyl-1.2.0.tgz#5c88036cf565e5df05558bfc911f8656df218884" - dependencies: - clone "^1.0.0" - clone-stats "^0.0.1" - replace-ext "0.0.1" - -vinyl@^2.0.0, vinyl@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/vinyl/-/vinyl-2.1.0.tgz#021f9c2cf951d6b939943c89eb5ee5add4fd924c" +vinyl@^2.0.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/vinyl/-/vinyl-2.2.0.tgz#d85b07da96e458d25b2ffe19fece9f2caa13ed86" + integrity sha512-MBH+yP0kC/GQ5GwBqrTPTzEfiiLjta7hTtvQtbxBgTeSXsmKQRQecjibMbxIXzVT3Y9KJK+drOz1/k+vsu8Nkg== dependencies: clone "^2.1.1" clone-buffer "^1.0.0" @@ -9548,140 +10568,67 @@ vinyl@^2.0.0, vinyl@^2.1.0: remove-trailing-separator "^1.0.1" replace-ext "^1.0.0" -vm-browserify@0.0.4: - version "0.0.4" - resolved "https://registry.yarnpkg.com/vm-browserify/-/vm-browserify-0.0.4.tgz#5d7ea45bbef9e4a6ff65f95438e0a87c357d5a73" - dependencies: - indexof "0.0.1" +vlq@^0.2.2: + version "0.2.3" + resolved "https://registry.yarnpkg.com/vlq/-/vlq-0.2.3.tgz#8f3e4328cf63b1540c0d67e1b2778386f8975b26" + integrity sha512-DRibZL6DsNhIgYQ+wNdWDL2SL3bKPlVrRiBqV5yuMm++op8W4kGFtaQfCs4KEJn0wBZcHVHJ3eoywX8983k1ow== vm-browserify@^1.0.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/vm-browserify/-/vm-browserify-1.1.0.tgz#bd76d6a23323e2ca8ffa12028dc04559c75f9019" + version "1.1.2" + resolved "https://registry.yarnpkg.com/vm-browserify/-/vm-browserify-1.1.2.tgz#78641c488b8e6ca91a75f511e7a3b32a86e5dda0" + integrity sha512-2ham8XPWTONajOR0ohOKOHXkm3+gaBmGut3SRuu75xLd/RRaY6vqgh8NBYYk7+RW3u5AtzPQZG8F10LHkl0lAQ== w3c-hr-time@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/w3c-hr-time/-/w3c-hr-time-1.0.1.tgz#82ac2bff63d950ea9e3189a58a65625fedf19045" + integrity sha1-gqwr/2PZUOqeMYmlimViX+3xkEU= dependencies: browser-process-hrtime "^0.1.2" walker@^1.0.7, walker@~1.0.5: version "1.0.7" resolved "https://registry.yarnpkg.com/walker/-/walker-1.0.7.tgz#2f7f9b8fd10d677262b18a884e28d19618e028fb" + integrity sha1-L3+bj9ENZ3JisYqITijRlhjgKPs= dependencies: makeerror "1.0.x" -warnings-to-errors-webpack-plugin@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/warnings-to-errors-webpack-plugin/-/warnings-to-errors-webpack-plugin-2.0.0.tgz#1ce862fa845c77a3c21bb68c839efaa7ebbdb9fb" - integrity sha512-0Girb3F5xc5U1TpYMiLDcie5oB+Ko2EuujOYyS3aXpKS4Yp264WkIuJ+0vF8wnmkDkmZAOBxahBedEL0mLjHQA== - -watchpack@^1.4.0: - version "1.5.0" - resolved "https://registry.yarnpkg.com/watchpack/-/watchpack-1.5.0.tgz#231e783af830a22f8966f65c4c4bacc814072eed" - dependencies: - chokidar "^2.0.2" - graceful-fs "^4.1.2" - neo-async "^2.5.0" - wcwidth@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/wcwidth/-/wcwidth-1.0.1.tgz#f0b0dcf915bc5ff1528afadb2c0e17b532da2fe8" + integrity sha1-8LDc+RW8X/FSivrbLA4XtTLaL+g= dependencies: defaults "^1.0.3" -webidl-conversions@^4.0.1, webidl-conversions@^4.0.2: +webidl-conversions@^4.0.2: version "4.0.2" resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-4.0.2.tgz#a855980b1f0b6b359ba1d5d9fb39ae941faa63ad" - -webpack-dependency-suite@^2.4.4: - version "2.4.5" - resolved "https://registry.yarnpkg.com/webpack-dependency-suite/-/webpack-dependency-suite-2.4.5.tgz#e2d3c9a178140edb7be41de57413a31cb2f11ec0" - dependencies: - "@types/acorn" "^4.0.2" - "@types/cheerio" "^0.22.1" - "@types/debug" "^0.0.29" - "@types/enhanced-resolve" "^3.0.3" - "@types/escape-string-regexp" "^0.0.30" - "@types/estree" "0.0.35" - "@types/lodash" "^4.14.67" - "@types/node" "^8.0.0" - "@types/semver" "^5.3.32" - "@types/webpack" "^3.0.0" - acorn "^5.0.3" - cheerio "^1.0.0-rc.1" - debug "^3.0.0" - escape-string-regexp "^1.0.5" - html-loader "^0.4.5" - loader-utils "^1.1.0" - lodash "^4.17.4" - semver "^5.3.0" - source-map "^0.5.6" - -webpack-sources@^1.0.1: - version "1.1.0" - resolved "https://registry.yarnpkg.com/webpack-sources/-/webpack-sources-1.1.0.tgz#a101ebae59d6507354d71d8013950a3a8b7a5a54" - dependencies: - source-list-map "^2.0.0" - source-map "~0.6.1" - -webpack-stream@^4.0.0: - version "4.0.2" - resolved "https://registry.yarnpkg.com/webpack-stream/-/webpack-stream-4.0.2.tgz#7b90aec71d45c8a4519ff8b5a4d59e039cfd02c0" - dependencies: - fancy-log "^1.3.2" - lodash.clone "^4.3.2" - lodash.some "^4.2.2" - memory-fs "^0.4.1" - plugin-error "^1.0.1" - supports-color "^5.2.0" - through "^2.3.8" - vinyl "^2.1.0" - webpack "^3.4.1" - -webpack@^3.4.1: - version "3.11.0" - resolved "https://registry.yarnpkg.com/webpack/-/webpack-3.11.0.tgz#77da451b1d7b4b117adaf41a1a93b5742f24d894" - dependencies: - acorn "^5.0.0" - acorn-dynamic-import "^2.0.0" - ajv "^6.1.0" - ajv-keywords "^3.1.0" - async "^2.1.2" - enhanced-resolve "^3.4.0" - escope "^3.6.0" - interpret "^1.0.0" - json-loader "^0.5.4" - json5 "^0.5.1" - loader-runner "^2.3.0" - loader-utils "^1.1.0" - memory-fs "~0.4.1" - mkdirp "~0.5.0" - node-libs-browser "^2.0.0" - source-map "^0.5.3" - supports-color "^4.2.1" - tapable "^0.2.7" - uglifyjs-webpack-plugin "^0.4.6" - watchpack "^1.4.0" - webpack-sources "^1.0.1" - yargs "^8.0.2" + integrity sha512-YQ+BmxuTgd6UXZW3+ICGfyqRyHXVlD5GtQr5+qjiNW7bF0cqrzX500HVXPBOvgXb5YnzDd+h0zqyv61KUD7+Sg== whatwg-encoding@^1.0.1, whatwg-encoding@^1.0.3: - version "1.0.3" - resolved "https://registry.yarnpkg.com/whatwg-encoding/-/whatwg-encoding-1.0.3.tgz#57c235bc8657e914d24e1a397d3c82daee0a6ba3" + version "1.0.5" + resolved "https://registry.yarnpkg.com/whatwg-encoding/-/whatwg-encoding-1.0.5.tgz#5abacf777c32166a51d085d6b4f3e7d27113ddb0" + integrity sha512-b5lim54JOPN9HtzvK9HFXvBma/rnfFeqsic0hSpjtDbVxR3dJKLc+KB4V6GgiGOvl7CY/KNh8rxSo9DKQrnUEw== dependencies: - iconv-lite "0.4.19" + iconv-lite "0.4.24" + +whatwg-mimetype@^2.1.0, whatwg-mimetype@^2.2.0: + version "2.3.0" + resolved "https://registry.yarnpkg.com/whatwg-mimetype/-/whatwg-mimetype-2.3.0.tgz#3d4b1e0312d2079879f826aff18dbeeca5960fbf" + integrity sha512-M4yMwr6mAnQz76TbJm914+gPpB/nCwvZbJU28cUD6dR004SAxDLOOSUaB1JDRqLtaOV/vi0IC5lEAGFgrjGv/g== -whatwg-url@^6.4.0: - version "6.4.0" - resolved "https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-6.4.0.tgz#08fdf2b9e872783a7a1f6216260a1d66cc722e08" +whatwg-url@^6.4.1: + version "6.5.0" + resolved "https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-6.5.0.tgz#f2df02bff176fd65070df74ad5ccbb5a199965a8" + integrity sha512-rhRZRqx/TLJQWUpQ6bmrt2UV4f0HCQ463yQuONJqC6fO2VoEb1pTYddbe59SkYq87aoM5A3bdhMZiUiVws+fzQ== dependencies: lodash.sortby "^4.7.0" - tr46 "^1.0.0" - webidl-conversions "^4.0.1" + tr46 "^1.0.1" + webidl-conversions "^4.0.2" whatwg-url@^7.0.0: - version "7.0.0" - resolved "https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-7.0.0.tgz#fde926fa54a599f3adf82dff25a9f7be02dc6edd" + version "7.1.0" + resolved "https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-7.1.0.tgz#c2c492f1eca612988efd3d2266be1b9fc6170d06" + integrity sha512-WUu7Rg1DroM7oQvGWfOiAK21n74Gg+T4elXEQYkOhtyLeWiJFoOGLXPKI/9gzIie9CtwVLm8wtw6YJdKyxSjeg== dependencies: lodash.sortby "^4.7.0" tr46 "^1.0.1" @@ -9690,27 +10637,33 @@ whatwg-url@^7.0.0: which-module@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/which-module/-/which-module-1.0.0.tgz#bba63ca861948994ff307736089e3b96026c2a4f" + integrity sha1-u6Y8qGGUiZT/MHc2CJ47lgJsKk8= which-module@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/which-module/-/which-module-2.0.0.tgz#d9ef07dce77b9902b8a3a8fa4b31c3e3f7e6e87a" + integrity sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho= -which@1, which@^1.2.10, which@^1.2.14, which@^1.2.9, which@^1.3.0, which@^1.3.1: +which@1, which@^1.2.14, which@^1.2.9, which@^1.3.0, which@^1.3.1: version "1.3.1" resolved "https://registry.yarnpkg.com/which/-/which-1.3.1.tgz#a45043d54f5805316da8d62f9f50918d3da70b0a" integrity sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ== dependencies: isexe "^2.0.0" -wide-align@^1.1.0: - version "1.1.2" - resolved "https://registry.yarnpkg.com/wide-align/-/wide-align-1.1.2.tgz#571e0f1b0604636ebc0dfc21b0339bbe31341710" +which@^2.0.1: + version "2.0.2" + resolved "https://registry.yarnpkg.com/which/-/which-2.0.2.tgz#7c6a8dd0a636a0327e10b59c9286eee93f3f51b1" + integrity sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA== dependencies: - string-width "^1.0.2" + isexe "^2.0.0" -window-size@0.1.0: - version "0.1.0" - resolved "https://registry.yarnpkg.com/window-size/-/window-size-0.1.0.tgz#5438cd2ea93b202efa3a19fe8887aee7c94f9c9d" +wide-align@^1.1.0: + version "1.1.3" + resolved "https://registry.yarnpkg.com/wide-align/-/wide-align-1.1.3.tgz#ae074e6bdc0c14a431e804e624549c633b000457" + integrity sha512-QGkOQc8XL6Bt5PwnsExKBPuMKBxnGxWWW3fU55Xt4feHozMUhdUMaBCk290qpm/wG5u/RSKzwdAC4i51YigihA== + dependencies: + string-width "^1.0.2 || 2" windows-release@^3.1.0: version "3.2.0" @@ -9719,17 +10672,15 @@ windows-release@^3.1.0: dependencies: execa "^1.0.0" -wordwrap@0.0.2, wordwrap@~0.0.2: - version "0.0.2" - resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-0.0.2.tgz#b79669bb42ecb409f83d583cad52ca17eaa1643f" - -wordwrap@~1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-1.0.0.tgz#27584810891456a4171c8d0226441ade90cbcaeb" +word-wrap@~1.2.3: + version "1.2.3" + resolved "https://registry.yarnpkg.com/word-wrap/-/word-wrap-1.2.3.tgz#610636f6b1f703891bd34771ccb17fb93b47079c" + integrity sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ== wrap-ansi@^2.0.0: version "2.1.0" resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-2.1.0.tgz#d8fc3d284dd05794fe84973caecdd1cf824fdd85" + integrity sha1-2Pw9KE3QV5T+hJc8rs3Rz4JP3YU= dependencies: string-width "^1.0.1" strip-ansi "^3.0.1" @@ -9737,15 +10688,35 @@ wrap-ansi@^2.0.0: wrap-ansi@^3.0.1: version "3.0.1" resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-3.0.1.tgz#288a04d87eda5c286e060dfe8f135ce8d007f8ba" + integrity sha1-KIoE2H7aXChuBg3+jxNc6NAH+Lo= dependencies: string-width "^2.1.1" strip-ansi "^4.0.0" +wrap-ansi@^5.1.0: + version "5.1.0" + resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-5.1.0.tgz#1fd1f67235d5b6d0fee781056001bfb694c03b09" + integrity sha512-QC1/iN/2/RPVJ5jYK8BGttj5z83LmSKmvbvrXPNCLZSEb32KKVDJDl/MOt2N01qU2H/FkzEa9PKto1BqDjtd7Q== + dependencies: + ansi-styles "^3.2.0" + string-width "^3.0.0" + strip-ansi "^5.0.0" + +wrap-ansi@^6.2.0: + version "6.2.0" + resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-6.2.0.tgz#e9393ba07102e6c91a3b221478f0257cd2856e53" + integrity sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA== + dependencies: + ansi-styles "^4.0.0" + string-width "^4.1.0" + strip-ansi "^6.0.0" + wrappy@1: version "1.0.2" resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" + integrity sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8= -write-file-atomic@2.4.1, write-file-atomic@^2.0.0, write-file-atomic@^2.3.0: +write-file-atomic@2.4.1: version "2.4.1" resolved "https://registry.yarnpkg.com/write-file-atomic/-/write-file-atomic-2.4.1.tgz#d0b05463c188ae804396fd5ab2a370062af87529" integrity sha512-TGHFeZEZMnv+gBFRfjAcxL5bPHrsGKtnb4qsFAws7/vlh+QfwAaySIw4AXP9ZskTTh5GWu3FLuJhsWVdiJPGvg== @@ -9754,9 +10725,19 @@ write-file-atomic@2.4.1, write-file-atomic@^2.0.0, write-file-atomic@^2.3.0: imurmurhash "^0.1.4" signal-exit "^3.0.2" -write-json-file@^2.2.0, write-json-file@^2.3.0: +write-file-atomic@^2.0.0, write-file-atomic@^2.3.0, write-file-atomic@^2.4.2: + version "2.4.3" + resolved "https://registry.yarnpkg.com/write-file-atomic/-/write-file-atomic-2.4.3.tgz#1fd2e9ae1df3e75b8d8c367443c692d4ca81f481" + integrity sha512-GaETH5wwsX+GcnzhPgKcKjJ6M2Cq3/iZp1WyY/X1CSqrW+jVNM9Y7D8EC2sM4ZG/V8wZlSniJnCKWPmBYAucRQ== + dependencies: + graceful-fs "^4.1.11" + imurmurhash "^0.1.4" + signal-exit "^3.0.2" + +write-json-file@^2.2.0: version "2.3.0" resolved "https://registry.yarnpkg.com/write-json-file/-/write-json-file-2.3.0.tgz#2b64c8a33004d54b8698c76d585a77ceb61da32f" + integrity sha1-K2TIozAE1UuGmMdtWFp3zrYdoy8= dependencies: detect-indent "^5.0.0" graceful-fs "^4.1.2" @@ -9765,9 +10746,22 @@ write-json-file@^2.2.0, write-json-file@^2.3.0: sort-keys "^2.0.0" write-file-atomic "^2.0.0" +write-json-file@^3.2.0: + version "3.2.0" + resolved "https://registry.yarnpkg.com/write-json-file/-/write-json-file-3.2.0.tgz#65bbdc9ecd8a1458e15952770ccbadfcff5fe62a" + integrity sha512-3xZqT7Byc2uORAatYiP3DHUUAVEkNOswEWNs9H5KXiicRTvzYzYqKjYc4G7p+8pltvAw641lVByKVtMpf+4sYQ== + dependencies: + detect-indent "^5.0.0" + graceful-fs "^4.1.15" + make-dir "^2.1.0" + pify "^4.0.1" + sort-keys "^2.0.0" + write-file-atomic "^2.4.2" + write-pkg@^3.1.0: version "3.2.0" resolved "https://registry.yarnpkg.com/write-pkg/-/write-pkg-3.2.0.tgz#0e178fe97820d389a8928bc79535dbe68c2cff21" + integrity sha512-tX2ifZ0YqEFOF1wjRW2Pk93NLsj02+n1UP5RvO6rCs0K6R2g1padvf006cY74PQJKMGS2r42NK7FD0dG6Y6paw== dependencies: sort-keys "^2.0.0" write-json-file "^2.2.0" @@ -9779,44 +10773,90 @@ write@1.0.3: dependencies: mkdirp "^0.5.1" -ws@^4.0.0: - version "4.1.0" - resolved "https://registry.yarnpkg.com/ws/-/ws-4.1.0.tgz#a979b5d7d4da68bf54efe0408967c324869a7289" +ws@^5.2.0: + version "5.2.2" + resolved "https://registry.yarnpkg.com/ws/-/ws-5.2.2.tgz#dffef14866b8e8dc9133582514d1befaf96e980f" + integrity sha512-jaHFD6PFv6UgoIVda6qZllptQsMlDEJkTQcybzzXDYM1XO9Y8em691FGMPmM46WGyLU4z9KMgQN+qrux/nhlHA== dependencies: async-limiter "~1.0.0" - safe-buffer "~5.1.0" - -xml-char-classes@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/xml-char-classes/-/xml-char-classes-1.0.0.tgz#64657848a20ffc5df583a42ad8a277b4512bbc4d" xml-name-validator@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/xml-name-validator/-/xml-name-validator-3.0.0.tgz#6ae73e06de4d8c6e47f9fb181f78d648ad457c6a" + integrity sha512-A5CUptxDsvxKJEU3yO6DuWBSJz/qizqzJKOMIfUJHETbBw/sFaDxgd6fxm1ewUaM0jZ444Fc5vC5ROYurg/4Pw== -"xtend@>=4.0.0 <4.1.0-0", xtend@^4.0.0, xtend@^4.0.1, xtend@~4.0.0, xtend@~4.0.1: - version "4.0.1" - resolved "https://registry.yarnpkg.com/xtend/-/xtend-4.0.1.tgz#a5c6d532be656e23db820efb943a1f04998d63af" +"xtend@>=4.0.0 <4.1.0-0", xtend@^4.0.0, xtend@^4.0.1, xtend@^4.0.2, xtend@~4.0.0, xtend@~4.0.1: + version "4.0.2" + resolved "https://registry.yarnpkg.com/xtend/-/xtend-4.0.2.tgz#bb72779f5fa465186b1f438f674fa347fdb5db54" + integrity sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ== + +xtend@^2.2.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/xtend/-/xtend-2.2.0.tgz#eef6b1f198c1c8deafad8b1765a04dad4a01c5a9" + integrity sha1-7vax8ZjByN6vrYsXZaBNrUoBxak= + +xtend@~2.0.4: + version "2.0.6" + resolved "https://registry.yarnpkg.com/xtend/-/xtend-2.0.6.tgz#5ea657a6dba447069c2e59c58a1138cb0c5e6cee" + integrity sha1-XqZXptukRwacLlnFihE4ywxebO4= + dependencies: + is-object "~0.1.2" + object-keys "~0.2.0" + +xtend@~2.1.2: + version "2.1.2" + resolved "https://registry.yarnpkg.com/xtend/-/xtend-2.1.2.tgz#6efecc2a4dad8e6962c4901b337ce7ba87b5d28b" + integrity sha1-bv7MKk2tjmlixJAbM3znuoe10os= + dependencies: + object-keys "~0.4.0" + +xtend@~3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/xtend/-/xtend-3.0.0.tgz#5cce7407baf642cba7becda568111c493f59665a" + integrity sha1-XM50B7r2Qsunvs2laBEcST9ZZlo= y18n@^3.2.1: version "3.2.1" resolved "https://registry.yarnpkg.com/y18n/-/y18n-3.2.1.tgz#6d15fba884c08679c0d77e88e7759e811e07fa41" + integrity sha1-bRX7qITAhnnA136I53WegR4H+kE= -"y18n@^3.2.1 || ^4.0.0", y18n@^4.0.0: +y18n@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/y18n/-/y18n-4.0.0.tgz#95ef94f85ecc81d007c264e190a120f0a3c8566b" + integrity sha512-r9S/ZyXu/Xu9q1tYlpsLIsa3EeLXXk0VwlxqTcFRfg9EhMW+17kbt9G0NrgCmhGb5vT2hyhJZLfDGx+7+5Uj/w== -yallist@^2.1.2: - version "2.1.2" - resolved "https://registry.yarnpkg.com/yallist/-/yallist-2.1.2.tgz#1c11f9218f076089a47dd512f93c6699a6a81d52" +yallist@^3.0.0, yallist@^3.0.2, yallist@^3.0.3: + version "3.1.1" + resolved "https://registry.yarnpkg.com/yallist/-/yallist-3.1.1.tgz#dbb7daf9bfd8bac9ab45ebf602b8cbad0d5d08fd" + integrity sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g== -yallist@^3.0.0, yallist@^3.0.2: - version "3.0.2" - resolved "https://registry.yarnpkg.com/yallist/-/yallist-3.0.2.tgz#8452b4bb7e83c7c188d8041c1a837c773d6d8bb9" +yargs-parser@^10.0.0: + version "10.1.0" + resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-10.1.0.tgz#7202265b89f7e9e9f2e5765e0fe735a905edbaa8" + integrity sha512-VCIyR1wJoEBZUqk5PA+oOBF6ypbwh5aNB3I50guxAL/quggdfs4TtNHQrSazFA3fYZ+tEqfs0zIGlv0c/rgjbQ== + dependencies: + camelcase "^4.1.0" + +yargs-parser@^13.1.1: + version "13.1.1" + resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-13.1.1.tgz#d26058532aa06d365fe091f6a1fc06b2f7e5eca0" + integrity sha512-oVAVsHz6uFrg3XQheFII8ESO2ssAf9luWuAd6Wexsu4F3OtIW0o8IribPXYrD4WC24LWtPrJlGy87y5udK+dxQ== + dependencies: + camelcase "^5.0.0" + decamelize "^1.2.0" + +yargs-parser@^15.0.0: + version "15.0.0" + resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-15.0.0.tgz#cdd7a97490ec836195f59f3f4dbe5ea9e8f75f08" + integrity sha512-xLTUnCMc4JhxrPEPUYD5IBR1mWCK/aT6+RJ/K29JY2y1vD+FhtgKK0AXRWvI262q3QSffAQuTouFIKUuHX89wQ== + dependencies: + camelcase "^5.0.0" + decamelize "^1.2.0" -yargs-parser@^11.1.1: - version "11.1.1" - resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-11.1.1.tgz#879a0865973bca9f6bab5cbdf3b1c67ec7d3bcf4" +yargs-parser@^18.1.1: + version "18.1.2" + resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-18.1.2.tgz#2f482bea2136dbde0861683abea7756d30b504f1" + integrity sha512-hlIPNR3IzC1YuL1c2UwwDKpXlNFBqD1Fswwh1khz5+d8Cq/8yc/Mn0i+rQXduu8hcrFKvO7Eryk+09NecTQAAQ== dependencies: camelcase "^5.0.0" decamelize "^1.2.0" @@ -9824,41 +10864,71 @@ yargs-parser@^11.1.1: yargs-parser@^4.2.0: version "4.2.1" resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-4.2.1.tgz#29cceac0dc4f03c6c87b4a9f217dd18c9f74871c" + integrity sha1-KczqwNxPA8bIe0qfIX3RjJ90hxw= dependencies: camelcase "^3.0.0" yargs-parser@^5.0.0: version "5.0.0" resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-5.0.0.tgz#275ecf0d7ffe05c77e64e7c86e4cd94bf0e1228a" + integrity sha1-J17PDX/+Bcd+ZOfIbkzZS/DhIoo= dependencies: camelcase "^3.0.0" -yargs-parser@^7.0.0: - version "7.0.0" - resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-7.0.0.tgz#8d0ac42f16ea55debd332caf4c4038b3e3f5dfd9" +yargs@^13.3.0: + version "13.3.0" + resolved "https://registry.yarnpkg.com/yargs/-/yargs-13.3.0.tgz#4c657a55e07e5f2cf947f8a366567c04a0dedc83" + integrity sha512-2eehun/8ALW8TLoIl7MVaRUrg+yCnenu8B4kBlRxj3GJGDKU1Og7sMXPNm1BYyM1DOJmTZ4YeN/Nwxv+8XJsUA== dependencies: - camelcase "^4.1.0" + cliui "^5.0.0" + find-up "^3.0.0" + get-caller-file "^2.0.1" + require-directory "^2.1.1" + require-main-filename "^2.0.0" + set-blocking "^2.0.0" + string-width "^3.0.0" + which-module "^2.0.0" + y18n "^4.0.0" + yargs-parser "^13.1.1" -yargs@^12.0.1, yargs@^12.0.2: - version "12.0.5" - resolved "https://registry.yarnpkg.com/yargs/-/yargs-12.0.5.tgz#05f5997b609647b64f66b81e3b4b10a368e7ad13" +yargs@^14.2.2: + version "14.2.2" + resolved "https://registry.yarnpkg.com/yargs/-/yargs-14.2.2.tgz#2769564379009ff8597cdd38fba09da9b493c4b5" + integrity sha512-/4ld+4VV5RnrynMhPZJ/ZpOCGSCeghMykZ3BhdFBDa9Wy/RH6uEGNWDJog+aUlq+9OM1CFTgtYRW5Is1Po9NOA== dependencies: - cliui "^4.0.0" + cliui "^5.0.0" decamelize "^1.2.0" find-up "^3.0.0" - get-caller-file "^1.0.1" - os-locale "^3.0.0" + get-caller-file "^2.0.1" require-directory "^2.1.1" - require-main-filename "^1.0.1" + require-main-filename "^2.0.0" + set-blocking "^2.0.0" + string-width "^3.0.0" + which-module "^2.0.0" + y18n "^4.0.0" + yargs-parser "^15.0.0" + +yargs@^15.3.1: + version "15.3.1" + resolved "https://registry.yarnpkg.com/yargs/-/yargs-15.3.1.tgz#9505b472763963e54afe60148ad27a330818e98b" + integrity sha512-92O1HWEjw27sBfgmXiixJWT5hRBp2eobqXicLtPBIDBhYB+1HpwZlXmbW2luivBJHBzki+7VyCLRtAkScbTBQA== + dependencies: + cliui "^6.0.0" + decamelize "^1.2.0" + find-up "^4.1.0" + get-caller-file "^2.0.1" + require-directory "^2.1.1" + require-main-filename "^2.0.0" set-blocking "^2.0.0" - string-width "^2.0.0" + string-width "^4.2.0" which-module "^2.0.0" - y18n "^3.2.1 || ^4.0.0" - yargs-parser "^11.1.1" + y18n "^4.0.0" + yargs-parser "^18.1.1" yargs@^6.5.0, yargs@^6.6.0: version "6.6.0" resolved "https://registry.yarnpkg.com/yargs/-/yargs-6.6.0.tgz#782ec21ef403345f830a808ca3d513af56065208" + integrity sha1-eC7CHvQDNF+DCoCMo9UTr1YGUgg= dependencies: camelcase "^3.0.0" cliui "^3.2.0" @@ -9877,6 +10947,7 @@ yargs@^6.5.0, yargs@^6.6.0: yargs@^7.1.0: version "7.1.0" resolved "https://registry.yarnpkg.com/yargs/-/yargs-7.1.0.tgz#6ba318eb16961727f5d284f8ea003e8d6154d0c8" + integrity sha1-a6MY6xaWFyf10oT46gA+jWFU0Mg= dependencies: camelcase "^3.0.0" cliui "^3.2.0" @@ -9891,42 +10962,3 @@ yargs@^7.1.0: which-module "^1.0.0" y18n "^3.2.1" yargs-parser "^5.0.0" - -yargs@^8.0.2: - version "8.0.2" - resolved "https://registry.yarnpkg.com/yargs/-/yargs-8.0.2.tgz#6299a9055b1cefc969ff7e79c1d918dceb22c360" - dependencies: - camelcase "^4.1.0" - cliui "^3.2.0" - decamelize "^1.1.1" - get-caller-file "^1.0.1" - os-locale "^2.0.0" - read-pkg-up "^2.0.0" - require-directory "^2.1.1" - require-main-filename "^1.0.1" - set-blocking "^2.0.0" - string-width "^2.0.0" - which-module "^2.0.0" - y18n "^3.2.1" - yargs-parser "^7.0.0" - -yargs@~3.10.0: - version "3.10.0" - resolved "https://registry.yarnpkg.com/yargs/-/yargs-3.10.0.tgz#f7ee7bd857dd7c1d2d38c0e74efbd681d1431fd1" - dependencies: - camelcase "^1.0.2" - cliui "^2.1.0" - decamelize "^1.0.0" - window-size "0.1.0" - -yup@^0.27.0: - version "0.27.0" - resolved "https://registry.yarnpkg.com/yup/-/yup-0.27.0.tgz#f8cb198c8e7dd2124beddc2457571329096b06e7" - integrity sha512-v1yFnE4+u9za42gG/b/081E7uNW9mUj3qtkmelLbW5YPROZzSH/KUUyJu9Wt8vxFJcT9otL/eZopS0YK1L5yPQ== - dependencies: - "@babel/runtime" "^7.0.0" - fn-name "~2.0.1" - lodash "^4.17.11" - property-expr "^1.5.0" - synchronous-promise "^2.0.6" - toposort "^2.0.2"